From: Cris Di Sclafani Date: Fri, 12 Mar 2021 13:58:21 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.21 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%22javascript:void%28%27%7BtitleJs%7D%27%29/%22%22%29%20%27?a=commitdiff_plain;h=fcdd914f7957e47a11d5efca4387b1f578f32170;p=motion2.git Built motion from commit (unavailable).|2.5.21 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 0383480..0057251 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.5.21", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2021-03-12T13:51:00.299Z", "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 2a0b769..1f33b60 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 _0xd76d=['INTEGER','sequelize'];(function(_0x48bc0d,_0x30becd){var _0x35f641=function(_0x136926){while(--_0x136926){_0x48bc0d['push'](_0x48bc0d['shift']());}};_0x35f641(++_0x30becd);}(_0xd76d,0x139));var _0xdd76=function(_0x31eb98,_0x592fa2){_0x31eb98=_0x31eb98-0x0;var _0x20cf3e=_0xd76d[_0x31eb98];return _0x20cf3e;};'use strict';var Sequelize=require(_0xdd76('0x0'));module['exports']={'ChatInteractionId':{'type':Sequelize[_0xdd76('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xdd76('0x1')],'primaryKey':!![]}}; \ No newline at end of file +var _0xad5a=['exports','INTEGER','sequelize'];(function(_0x562b53,_0x9ec463){var _0x3f99be=function(_0x14f0ed){while(--_0x14f0ed){_0x562b53['push'](_0x562b53['shift']());}};_0x3f99be(++_0x9ec463);}(_0xad5a,0x158));var _0xaad5=function(_0x3a40ca,_0x2737a9){_0x3a40ca=_0x3a40ca-0x0;var _0x513dc6=_0xad5a[_0x3a40ca];return _0x513dc6;};'use strict';var Sequelize=require(_0xaad5('0x0'));module[_0xaad5('0x1')]={'ChatInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xaad5('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 45ad261..cc9f5c8 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 _0x38bd=['length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','UserChatInteraction','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','offset','set','apply','reject','save','update','then','get','destroy','sendStatus','error','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields'];(function(_0x1bd85d,_0xdc683f){var _0xd40669=function(_0x318648){while(--_0x318648){_0x1bd85d['push'](_0x1bd85d['shift']());}};_0xd40669(++_0xdc683f);}(_0x38bd,0x6d));var _0xd38b=function(_0xd58adc,_0x40ee73){_0xd58adc=_0xd58adc-0x0;var _0x5badea=_0x38bd[_0xd58adc];return _0x5badea;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd38b('0x0'));var rimraf=require(_0xd38b('0x1'));var zipdir=require(_0xd38b('0x2'));var jsonpatch=require(_0xd38b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd38b('0x4'));var Mustache=require('mustache');var util=require(_0xd38b('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xd38b('0x6'));var ejs=require(_0xd38b('0x7'));var fs=require('fs');var _=require(_0xd38b('0x8'));var squel=require('squel');var crypto=require(_0xd38b('0x9'));var jsforce=require(_0xd38b('0xa'));var deskjs=require(_0xd38b('0xb'));var toCsv=require(_0xd38b('0x6'));var querystring=require(_0xd38b('0xc'));var Papa=require(_0xd38b('0xd'));var Redis=require(_0xd38b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd38b('0xf'));var as=require(_0xd38b('0x10'));var hardwareService=require(_0xd38b('0x11'));var logger=require(_0xd38b('0x12'))(_0xd38b('0x13'));var utils=require('../../config/utils');var config=require(_0xd38b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd38b('0x15'))['db'];function respondWithStatusCode(_0x47770e,_0x465538){_0x465538=_0x465538||0xcc;return function(_0x4755b3){if(_0x4755b3){return _0x47770e['sendStatus'](_0x465538);}return _0x47770e[_0xd38b('0x16')](_0x465538)[_0xd38b('0x17')]();};}function respondWithResult(_0x57ec59,_0x323d8a){_0x323d8a=_0x323d8a||0xc8;return function(_0x245e52){if(_0x245e52){return _0x57ec59[_0xd38b('0x16')](_0x323d8a)[_0xd38b('0x18')](_0x245e52);}};}function respondWithFilteredResult(_0x36f11e,_0x5ce9a3){return function(_0x20b071){if(_0x20b071){var _0x7bff47=_0x20b071['count'],_0x5bd427=_0x5ce9a3[_0xd38b('0x19')],_0x47bc27=_0x5ce9a3[_0xd38b('0x19')]+_0x5ce9a3['limit'],_0x4c8d25;if(_0x47bc27>=_0x7bff47){_0x47bc27=_0x7bff47;_0x4c8d25=0xc8;}else{_0x4c8d25=0xce;}_0x36f11e[_0xd38b('0x16')](_0x4c8d25);return _0x36f11e[_0xd38b('0x1a')]('Content-Range',_0x5bd427+'-'+_0x47bc27+'/'+_0x7bff47)[_0xd38b('0x18')](_0x20b071);}return null;};}function patchUpdates(_0x173af8){return function(_0x4e8f17){try{jsonpatch[_0xd38b('0x1b')](_0x4e8f17,_0x173af8,!![]);}catch(_0x15846f){return BPromise[_0xd38b('0x1c')](_0x15846f);}return _0x4e8f17[_0xd38b('0x1d')]();};}function saveUpdates(_0x1b1b85,_0x3864e1){return function(_0x39a5c5){if(_0x39a5c5){return _0x39a5c5[_0xd38b('0x1e')](_0x1b1b85)[_0xd38b('0x1f')](function(_0x27d279){return _0x27d279;});}return null;};}function removeEntity(_0x4a4037,_0x104e3b){return function(_0x3f3b5e){if(_0x3f3b5e){return _0x3f3b5e['destroy']()['then'](function(){var _0xc33124=_0x3f3b5e[_0xd38b('0x20')]({'plain':!![]});var _0x9df35f='UserChatInteractions';return db['UserProfileResource'][_0xd38b('0x21')]({'where':{'type':_0x9df35f,'resourceId':_0xc33124['id']}})[_0xd38b('0x1f')](function(){return _0x3f3b5e;});})[_0xd38b('0x1f')](function(){_0x4a4037[_0xd38b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c5874,_0x48c53c){return function(_0x296087){if(!_0x296087){_0x3c5874[_0xd38b('0x22')](0x194);}return _0x296087;};}function handleError(_0x7a9591,_0x1a5f84){_0x1a5f84=_0x1a5f84||0x1f4;return function(_0x6ea76b){logger[_0xd38b('0x23')](_0x6ea76b['stack']);if(_0x6ea76b['name']){delete _0x6ea76b[_0xd38b('0x24')];}_0x7a9591['status'](_0x1a5f84)[_0xd38b('0x25')](_0x6ea76b);};}exports[_0xd38b('0x26')]=function(_0x5af236,_0x47db03){var _0x304ffc={},_0x424975={},_0x519aea={'count':0x0,'rows':[]};var _0x20a31a=_[_0xd38b('0x27')](db['UserChatInteraction'][_0xd38b('0x28')],function(_0x34ee98){return{'name':_0x34ee98['fieldName'],'type':_0x34ee98[_0xd38b('0x29')][_0xd38b('0x2a')]};});_0x424975[_0xd38b('0x2b')]=_[_0xd38b('0x27')](_0x20a31a,_0xd38b('0x24'));_0x424975[_0xd38b('0x2c')]=_[_0xd38b('0x2d')](_0x5af236[_0xd38b('0x2c')]);_0x424975['filters']=_[_0xd38b('0x2e')](_0x424975[_0xd38b('0x2b')],_0x424975[_0xd38b('0x2c')]);_0x304ffc[_0xd38b('0x2f')]=_[_0xd38b('0x2e')](_0x424975[_0xd38b('0x2b')],qs['fields'](_0x5af236[_0xd38b('0x2c')][_0xd38b('0x30')]));_0x304ffc[_0xd38b('0x2f')]=_0x304ffc[_0xd38b('0x2f')][_0xd38b('0x31')]?_0x304ffc[_0xd38b('0x2f')]:_0x424975['model'];if(!_0x5af236[_0xd38b('0x2c')][_0xd38b('0x32')](_0xd38b('0x33'))){_0x304ffc['limit']=qs[_0xd38b('0x34')](_0x5af236['query'][_0xd38b('0x34')]);_0x304ffc[_0xd38b('0x19')]=qs[_0xd38b('0x19')](_0x5af236[_0xd38b('0x2c')][_0xd38b('0x19')]);}_0x304ffc[_0xd38b('0x35')]=qs[_0xd38b('0x36')](_0x5af236[_0xd38b('0x2c')]['sort']);_0x304ffc[_0xd38b('0x37')]=qs[_0xd38b('0x38')](_[_0xd38b('0x39')](_0x5af236[_0xd38b('0x2c')],_0x424975[_0xd38b('0x38')]),_0x20a31a);if(_0x5af236[_0xd38b('0x2c')][_0xd38b('0x3a')]){_0x304ffc[_0xd38b('0x37')]=_['merge'](_0x304ffc[_0xd38b('0x37')],{'$or':_['map'](_0x20a31a,function(_0x440dda){if(_0x440dda['type']!==_0xd38b('0x3b')){var _0x2c5bb7={};_0x2c5bb7[_0x440dda[_0xd38b('0x24')]]={'$like':'%'+_0x5af236[_0xd38b('0x2c')][_0xd38b('0x3a')]+'%'};return _0x2c5bb7;}})});}_0x304ffc=_[_0xd38b('0x3c')]({},_0x304ffc,_0x5af236[_0xd38b('0x3d')]);var _0x49def0={'where':_0x304ffc[_0xd38b('0x37')]};return db[_0xd38b('0x3e')][_0xd38b('0x3f')](_0x49def0)[_0xd38b('0x1f')](function(_0x5886ce){_0x519aea['count']=_0x5886ce;if(_0x5af236[_0xd38b('0x2c')][_0xd38b('0x40')]){_0x304ffc[_0xd38b('0x41')]=[{'all':!![]}];}return db[_0xd38b('0x3e')][_0xd38b('0x42')](_0x304ffc);})[_0xd38b('0x1f')](function(_0x26a5c8){_0x519aea[_0xd38b('0x43')]=_0x26a5c8;return _0x519aea;})[_0xd38b('0x1f')](respondWithFilteredResult(_0x47db03,_0x304ffc))['catch'](handleError(_0x47db03,null));};exports[_0xd38b('0x44')]=function(_0x37763d,_0x458ead){var _0x2d53a3={'raw':!![],'where':{'id':_0x37763d[_0xd38b('0x45')]['id']}},_0x3df376={};_0x3df376[_0xd38b('0x2b')]=_[_0xd38b('0x2d')](db[_0xd38b('0x3e')][_0xd38b('0x28')]);_0x3df376[_0xd38b('0x2c')]=_[_0xd38b('0x2d')](_0x37763d[_0xd38b('0x2c')]);_0x3df376[_0xd38b('0x38')]=_[_0xd38b('0x2e')](_0x3df376[_0xd38b('0x2b')],_0x3df376['query']);_0x2d53a3['attributes']=_[_0xd38b('0x2e')](_0x3df376[_0xd38b('0x2b')],qs[_0xd38b('0x30')](_0x37763d[_0xd38b('0x2c')][_0xd38b('0x30')]));_0x2d53a3['attributes']=_0x2d53a3[_0xd38b('0x2f')][_0xd38b('0x31')]?_0x2d53a3['attributes']:_0x3df376[_0xd38b('0x2b')];if(_0x37763d[_0xd38b('0x2c')]['includeAll']){_0x2d53a3['include']=[{'all':!![]}];}_0x2d53a3=_[_0xd38b('0x3c')]({},_0x2d53a3,_0x37763d[_0xd38b('0x3d')]);return db['UserChatInteraction'][_0xd38b('0x46')](_0x2d53a3)[_0xd38b('0x1f')](handleEntityNotFound(_0x458ead,null))[_0xd38b('0x1f')](respondWithResult(_0x458ead,null))[_0xd38b('0x47')](handleError(_0x458ead,null));};exports[_0xd38b('0x48')]=function(_0x3a69fe,_0x1e77ec){return db[_0xd38b('0x3e')][_0xd38b('0x48')](_0x3a69fe[_0xd38b('0x49')],{})[_0xd38b('0x1f')](function(_0x375185){var _0x237b7=_0x3a69fe[_0xd38b('0x4a')][_0xd38b('0x20')]({'plain':!![]});if(!_0x237b7)throw new Error(_0xd38b('0x4b'));if(_0x237b7[_0xd38b('0x4c')]===_0xd38b('0x4a')){var _0x31674a=_0x375185[_0xd38b('0x20')]({'plain':!![]});var _0x3f0683='UserChatInteractions';return db[_0xd38b('0x4d')][_0xd38b('0x46')]({'where':{'name':_0x3f0683,'userProfileId':_0x237b7['userProfileId']},'raw':!![]})[_0xd38b('0x1f')](function(_0x52808c){if(_0x52808c&&_0x52808c['autoAssociation']===0x0){return db['UserProfileResource'][_0xd38b('0x48')]({'name':_0x31674a[_0xd38b('0x24')],'resourceId':_0x31674a['id'],'type':_0x52808c[_0xd38b('0x24')],'sectionId':_0x52808c['id']},{})[_0xd38b('0x1f')](function(){return _0x375185;});}else{return _0x375185;}})[_0xd38b('0x47')](function(_0x13f277){logger[_0xd38b('0x23')](_0xd38b('0x4e'),_0x13f277);throw _0x13f277;});}return _0x375185;})[_0xd38b('0x1f')](respondWithResult(_0x1e77ec,0xc9))[_0xd38b('0x47')](handleError(_0x1e77ec,null));};exports['update']=function(_0x506286,_0x1844c4){if(_0x506286[_0xd38b('0x49')]['id']){delete _0x506286[_0xd38b('0x49')]['id'];}return db[_0xd38b('0x3e')][_0xd38b('0x46')]({'where':{'id':_0x506286['params']['id']}})[_0xd38b('0x1f')](handleEntityNotFound(_0x1844c4,null))[_0xd38b('0x1f')](saveUpdates(_0x506286['body'],null))[_0xd38b('0x1f')](respondWithResult(_0x1844c4,null))['catch'](handleError(_0x1844c4,null));};exports[_0xd38b('0x21')]=function(_0x2abe73,_0x10e32b){return db[_0xd38b('0x3e')][_0xd38b('0x46')]({'where':{'id':_0x2abe73[_0xd38b('0x45')]['id']}})[_0xd38b('0x1f')](handleEntityNotFound(_0x10e32b,null))[_0xd38b('0x1f')](removeEntity(_0x10e32b,null))['catch'](handleError(_0x10e32b,null));}; \ No newline at end of file +var _0xebfc=['destroy','get','UserChatInteractions','sendStatus','stack','name','send','map','UserChatInteraction','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','nolimit','where','filter','merge','options','includeAll','include','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','Content-Range','apply','save','then'];(function(_0x2f60c9,_0x109fa3){var _0xd1e498=function(_0x1a525c){while(--_0x1a525c){_0x2f60c9['push'](_0x2f60c9['shift']());}};_0xd1e498(++_0x109fa3);}(_0xebfc,0xbf));var _0xcebf=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xebfc[_0x4fbfd9];return _0x31dc94;};'use strict';var pdf=require(_0xcebf('0x0'));var emlformat=require(_0xcebf('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcebf('0x2'));var jsonpatch=require(_0xcebf('0x3'));var rp=require('request-promise');var moment=require(_0xcebf('0x4'));var BPromise=require(_0xcebf('0x5'));var Mustache=require(_0xcebf('0x6'));var util=require(_0xcebf('0x7'));var path=require('path');var sox=require(_0xcebf('0x8'));var csv=require(_0xcebf('0x9'));var ejs=require(_0xcebf('0xa'));var fs=require('fs');var _=require(_0xcebf('0xb'));var squel=require(_0xcebf('0xc'));var crypto=require(_0xcebf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xcebf('0xe'));var toCsv=require(_0xcebf('0x9'));var querystring=require('querystring');var Papa=require(_0xcebf('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcebf('0x10'));var as=require(_0xcebf('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcebf('0x12'))(_0xcebf('0x13'));var utils=require(_0xcebf('0x14'));var config=require(_0xcebf('0x15'));var licenseUtil=require(_0xcebf('0x16'));var db=require(_0xcebf('0x17'))['db'];function respondWithStatusCode(_0x16a027,_0x5679fd){_0x5679fd=_0x5679fd||0xcc;return function(_0x10308b){if(_0x10308b){return _0x16a027['sendStatus'](_0x5679fd);}return _0x16a027['status'](_0x5679fd)[_0xcebf('0x18')]();};}function respondWithResult(_0x237029,_0x597ad6){_0x597ad6=_0x597ad6||0xc8;return function(_0x367533){if(_0x367533){return _0x237029[_0xcebf('0x19')](_0x597ad6)[_0xcebf('0x1a')](_0x367533);}};}function respondWithFilteredResult(_0x25e2cf,_0x4447ed){return function(_0x23e156){if(_0x23e156){var _0xb575ca=_0x23e156[_0xcebf('0x1b')],_0x7db639=_0x4447ed[_0xcebf('0x1c')],_0x2e39eb=_0x4447ed[_0xcebf('0x1c')]+_0x4447ed[_0xcebf('0x1d')],_0x25ecd1;if(_0x2e39eb>=_0xb575ca){_0x2e39eb=_0xb575ca;_0x25ecd1=0xc8;}else{_0x25ecd1=0xce;}_0x25e2cf['status'](_0x25ecd1);return _0x25e2cf['set'](_0xcebf('0x1e'),_0x7db639+'-'+_0x2e39eb+'/'+_0xb575ca)[_0xcebf('0x1a')](_0x23e156);}return null;};}function patchUpdates(_0x2d6829){return function(_0x6d3743){try{jsonpatch[_0xcebf('0x1f')](_0x6d3743,_0x2d6829,!![]);}catch(_0x18ef37){return BPromise['reject'](_0x18ef37);}return _0x6d3743[_0xcebf('0x20')]();};}function saveUpdates(_0x44295b,_0x5083c1){return function(_0x51458b){if(_0x51458b){return _0x51458b['update'](_0x44295b)[_0xcebf('0x21')](function(_0x117850){return _0x117850;});}return null;};}function removeEntity(_0x560760,_0x22c294){return function(_0xeea918){if(_0xeea918){return _0xeea918[_0xcebf('0x22')]()[_0xcebf('0x21')](function(){var _0xcfe32f=_0xeea918[_0xcebf('0x23')]({'plain':!![]});var _0x4bc0f7=_0xcebf('0x24');return db['UserProfileResource'][_0xcebf('0x22')]({'where':{'type':_0x4bc0f7,'resourceId':_0xcfe32f['id']}})[_0xcebf('0x21')](function(){return _0xeea918;});})[_0xcebf('0x21')](function(){_0x560760[_0xcebf('0x19')](0xcc)[_0xcebf('0x18')]();});}};}function handleEntityNotFound(_0x3b854d,_0x43f72a){return function(_0x49cbf5){if(!_0x49cbf5){_0x3b854d[_0xcebf('0x25')](0x194);}return _0x49cbf5;};}function handleError(_0x2411cd,_0x3f19ff){_0x3f19ff=_0x3f19ff||0x1f4;return function(_0x23ac61){logger['error'](_0x23ac61[_0xcebf('0x26')]);if(_0x23ac61['name']){delete _0x23ac61[_0xcebf('0x27')];}_0x2411cd[_0xcebf('0x19')](_0x3f19ff)[_0xcebf('0x28')](_0x23ac61);};}exports['index']=function(_0x31689d,_0x5756e5){var _0x28c4ec={},_0xd829f6={},_0x13533e={'count':0x0,'rows':[]};var _0x4a7c8b=_[_0xcebf('0x29')](db[_0xcebf('0x2a')][_0xcebf('0x2b')],function(_0xbdd299){return{'name':_0xbdd299[_0xcebf('0x2c')],'type':_0xbdd299['type']['key']};});_0xd829f6[_0xcebf('0x2d')]=_[_0xcebf('0x29')](_0x4a7c8b,_0xcebf('0x27'));_0xd829f6[_0xcebf('0x2e')]=_['keys'](_0x31689d[_0xcebf('0x2e')]);_0xd829f6[_0xcebf('0x2f')]=_[_0xcebf('0x30')](_0xd829f6[_0xcebf('0x2d')],_0xd829f6[_0xcebf('0x2e')]);_0x28c4ec['attributes']=_[_0xcebf('0x30')](_0xd829f6[_0xcebf('0x2d')],qs[_0xcebf('0x31')](_0x31689d[_0xcebf('0x2e')][_0xcebf('0x31')]));_0x28c4ec['attributes']=_0x28c4ec[_0xcebf('0x32')][_0xcebf('0x33')]?_0x28c4ec[_0xcebf('0x32')]:_0xd829f6[_0xcebf('0x2d')];if(!_0x31689d[_0xcebf('0x2e')]['hasOwnProperty'](_0xcebf('0x34'))){_0x28c4ec[_0xcebf('0x1d')]=qs['limit'](_0x31689d[_0xcebf('0x2e')][_0xcebf('0x1d')]);_0x28c4ec[_0xcebf('0x1c')]=qs['offset'](_0x31689d[_0xcebf('0x2e')]['offset']);}_0x28c4ec['order']=qs['sort'](_0x31689d[_0xcebf('0x2e')]['sort']);_0x28c4ec[_0xcebf('0x35')]=qs[_0xcebf('0x2f')](_['pick'](_0x31689d['query'],_0xd829f6[_0xcebf('0x2f')]),_0x4a7c8b);if(_0x31689d[_0xcebf('0x2e')][_0xcebf('0x36')]){_0x28c4ec['where']=_[_0xcebf('0x37')](_0x28c4ec[_0xcebf('0x35')],{'$or':_[_0xcebf('0x29')](_0x4a7c8b,function(_0x52f97a){if(_0x52f97a['type']!=='VIRTUAL'){var _0x446a38={};_0x446a38[_0x52f97a[_0xcebf('0x27')]]={'$like':'%'+_0x31689d['query']['filter']+'%'};return _0x446a38;}})});}_0x28c4ec=_[_0xcebf('0x37')]({},_0x28c4ec,_0x31689d[_0xcebf('0x38')]);var _0x381579={'where':_0x28c4ec[_0xcebf('0x35')]};return db['UserChatInteraction'][_0xcebf('0x1b')](_0x381579)['then'](function(_0x308caa){_0x13533e[_0xcebf('0x1b')]=_0x308caa;if(_0x31689d[_0xcebf('0x2e')][_0xcebf('0x39')]){_0x28c4ec[_0xcebf('0x3a')]=[{'all':!![]}];}return db[_0xcebf('0x2a')]['findAll'](_0x28c4ec);})['then'](function(_0x1812a5){_0x13533e['rows']=_0x1812a5;return _0x13533e;})[_0xcebf('0x21')](respondWithFilteredResult(_0x5756e5,_0x28c4ec))['catch'](handleError(_0x5756e5,null));};exports[_0xcebf('0x3b')]=function(_0x359725,_0x29ab18){var _0x5c2972={'raw':!![],'where':{'id':_0x359725[_0xcebf('0x3c')]['id']}},_0x2cb38f={};_0x2cb38f[_0xcebf('0x2d')]=_[_0xcebf('0x3d')](db[_0xcebf('0x2a')]['rawAttributes']);_0x2cb38f[_0xcebf('0x2e')]=_[_0xcebf('0x3d')](_0x359725[_0xcebf('0x2e')]);_0x2cb38f[_0xcebf('0x2f')]=_[_0xcebf('0x30')](_0x2cb38f[_0xcebf('0x2d')],_0x2cb38f[_0xcebf('0x2e')]);_0x5c2972[_0xcebf('0x32')]=_[_0xcebf('0x30')](_0x2cb38f[_0xcebf('0x2d')],qs[_0xcebf('0x31')](_0x359725[_0xcebf('0x2e')][_0xcebf('0x31')]));_0x5c2972[_0xcebf('0x32')]=_0x5c2972[_0xcebf('0x32')][_0xcebf('0x33')]?_0x5c2972['attributes']:_0x2cb38f[_0xcebf('0x2d')];if(_0x359725[_0xcebf('0x2e')][_0xcebf('0x39')]){_0x5c2972[_0xcebf('0x3a')]=[{'all':!![]}];}_0x5c2972=_[_0xcebf('0x37')]({},_0x5c2972,_0x359725[_0xcebf('0x38')]);return db[_0xcebf('0x2a')][_0xcebf('0x3e')](_0x5c2972)[_0xcebf('0x21')](handleEntityNotFound(_0x29ab18,null))['then'](respondWithResult(_0x29ab18,null))['catch'](handleError(_0x29ab18,null));};exports[_0xcebf('0x3f')]=function(_0x10c794,_0x425321){return db[_0xcebf('0x2a')][_0xcebf('0x3f')](_0x10c794[_0xcebf('0x40')],{})[_0xcebf('0x21')](function(_0x1b6430){var _0x53ca8c=_0x10c794[_0xcebf('0x41')]['get']({'plain':!![]});if(!_0x53ca8c)throw new Error(_0xcebf('0x42'));if(_0x53ca8c[_0xcebf('0x43')]==='user'){var _0x552806=_0x1b6430[_0xcebf('0x23')]({'plain':!![]});var _0x47d0a3=_0xcebf('0x24');return db[_0xcebf('0x44')]['find']({'where':{'name':_0x47d0a3,'userProfileId':_0x53ca8c['userProfileId']},'raw':!![]})[_0xcebf('0x21')](function(_0x4cba66){if(_0x4cba66&&_0x4cba66[_0xcebf('0x45')]===0x0){return db[_0xcebf('0x46')][_0xcebf('0x3f')]({'name':_0x552806[_0xcebf('0x27')],'resourceId':_0x552806['id'],'type':_0x4cba66[_0xcebf('0x27')],'sectionId':_0x4cba66['id']},{})[_0xcebf('0x21')](function(){return _0x1b6430;});}else{return _0x1b6430;}})[_0xcebf('0x47')](function(_0x336985){logger[_0xcebf('0x48')](_0xcebf('0x49'),_0x336985);throw _0x336985;});}return _0x1b6430;})[_0xcebf('0x21')](respondWithResult(_0x425321,0xc9))[_0xcebf('0x47')](handleError(_0x425321,null));};exports[_0xcebf('0x4a')]=function(_0x2fdf38,_0x149cb4){if(_0x2fdf38[_0xcebf('0x40')]['id']){delete _0x2fdf38[_0xcebf('0x40')]['id'];}return db[_0xcebf('0x2a')][_0xcebf('0x3e')]({'where':{'id':_0x2fdf38['params']['id']}})[_0xcebf('0x21')](handleEntityNotFound(_0x149cb4,null))['then'](saveUpdates(_0x2fdf38[_0xcebf('0x40')],null))['then'](respondWithResult(_0x149cb4,null))[_0xcebf('0x47')](handleError(_0x149cb4,null));};exports[_0xcebf('0x22')]=function(_0x5cda8a,_0x586523){return db[_0xcebf('0x2a')][_0xcebf('0x3e')]({'where':{'id':_0x5cda8a[_0xcebf('0x3c')]['id']}})[_0xcebf('0x21')](handleEntityNotFound(_0x586523,null))['then'](removeEntity(_0x586523,null))[_0xcebf('0x47')](handleError(_0x586523,null));}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.model.js b/server/api/UserChatInteraction/UserChatInteraction.model.js index 12e6dbf..6126e57 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 _0x626d=['exports','define','user_has_chat_interactions','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment'];(function(_0x2605dc,_0x50cf7e){var _0x4568c9=function(_0x447f7c){while(--_0x447f7c){_0x2605dc['push'](_0x2605dc['shift']());}};_0x4568c9(++_0x50cf7e);}(_0x626d,0xad));var _0xd626=function(_0x4983a2,_0x2491d9){_0x4983a2=_0x4983a2-0x0;var _0x3e3366=_0x626d[_0x4983a2];return _0x3e3366;};'use strict';var _=require(_0xd626('0x0'));var util=require(_0xd626('0x1'));var logger=require(_0xd626('0x2'))(_0xd626('0x3'));var moment=require('moment');var BPromise=require(_0xd626('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd626('0x5'));var config=require(_0xd626('0x6'));var attributes=require('./UserChatInteraction.attributes');module[_0xd626('0x7')]=function(_0x490906,_0x27be9a){return _0x490906[_0xd626('0x8')]('UserChatInteraction',attributes,{'tableName':_0xd626('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f85=['bluebird','request-promise','path','rimraf','../../config/environment','./UserChatInteraction.attributes','exports','define','user_has_chat_interactions','lodash','util','../../config/logger','api','moment'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x1f85,0xb1));var _0x51f8=function(_0x3a20d9,_0x23dbaf){_0x3a20d9=_0x3a20d9-0x0;var _0x2475ad=_0x1f85[_0x3a20d9];return _0x2475ad;};'use strict';var _=require(_0x51f8('0x0'));var util=require(_0x51f8('0x1'));var logger=require(_0x51f8('0x2'))(_0x51f8('0x3'));var moment=require(_0x51f8('0x4'));var BPromise=require(_0x51f8('0x5'));var rp=require(_0x51f8('0x6'));var fs=require('fs');var path=require(_0x51f8('0x7'));var rimraf=require(_0x51f8('0x8'));var config=require(_0x51f8('0x9'));var attributes=require(_0x51f8('0xa'));module[_0x51f8('0xb')]=function(_0x2aad88,_0x4cc532){return _0x2aad88[_0x51f8('0xc')]('UserChatInteraction',attributes,{'tableName':_0x51f8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.rpc.js b/server/api/UserChatInteraction/UserChatInteraction.rpc.js index fa307fd..615de85 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 _0x9647=['info','debug','UserChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserChatInteraction,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0xdbc920,_0x5b6900){var _0x3fbf9a=function(_0x4410b2){while(--_0x4410b2){_0xdbc920['push'](_0xdbc920['shift']());}};_0x3fbf9a(++_0x5b6900);}(_0x9647,0x1bb));var _0x7964=function(_0x51dddb,_0x205508){_0x51dddb=_0x51dddb-0x0;var _0x24770f=_0x9647[_0x51dddb];return _0x24770f;};'use strict';var _=require(_0x7964('0x0'));var util=require(_0x7964('0x1'));var moment=require(_0x7964('0x2'));var BPromise=require(_0x7964('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7964('0x4'));var db=require(_0x7964('0x5'))['db'];var utils=require(_0x7964('0x6'));var logger=require(_0x7964('0x7'))(_0x7964('0x8'));var config=require(_0x7964('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7964('0xa')][_0x7964('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9678,_0xfe8ab6,_0x496e8d){return new BPromise(function(_0x972d31,_0x392d4b){return client[_0x7964('0xc')](_0x3f9678,_0x496e8d)['then'](function(_0x347e8a){logger[_0x7964('0xd')]('UserChatInteraction,\x20%s,\x20%s',_0xfe8ab6,'request\x20sent');logger[_0x7964('0xe')](_0x7964('0xf'),_0xfe8ab6,_0x7964('0x10'),JSON[_0x7964('0x11')](_0x347e8a));if(_0x347e8a[_0x7964('0x12')]){if(_0x347e8a[_0x7964('0x12')][_0x7964('0x13')]===0x1f4){logger[_0x7964('0x12')](_0x7964('0x14'),_0xfe8ab6,_0x347e8a[_0x7964('0x12')][_0x7964('0x15')]);return _0x392d4b(_0x347e8a[_0x7964('0x12')]['message']);}logger[_0x7964('0x12')]('UserChatInteraction,\x20%s,\x20%s',_0xfe8ab6,_0x347e8a[_0x7964('0x12')][_0x7964('0x15')]);return _0x972d31(_0x347e8a[_0x7964('0x12')]['message']);}else{logger['info']('UserChatInteraction,\x20%s,\x20%s',_0xfe8ab6,_0x7964('0x10'));_0x972d31(_0x347e8a[_0x7964('0x16')][_0x7964('0x15')]);}})[_0x7964('0x17')](function(_0x1cbe59){logger[_0x7964('0x12')](_0x7964('0x14'),_0xfe8ab6,_0x1cbe59);_0x392d4b(_0x1cbe59);});});} \ No newline at end of file +var _0x0934=['code','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','UserChatInteraction,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x599dc3,_0x406b27){var _0x13c968=function(_0x5b2683){while(--_0x5b2683){_0x599dc3['push'](_0x599dc3['shift']());}};_0x13c968(++_0x406b27);}(_0x0934,0x148));var _0x4093=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x0934[_0x220dbb];return _0x2b77de;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4093('0x0'));var rs=require(_0x4093('0x1'));var fs=require('fs');var Redis=require(_0x4093('0x2'));var db=require(_0x4093('0x3'))['db'];var utils=require(_0x4093('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4093('0x5'));var jayson=require(_0x4093('0x6'));var client=jayson['client'][_0x4093('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x53981,_0x2024f8,_0x284b70){return new BPromise(function(_0x24e961,_0x2bab35){return client[_0x4093('0x8')](_0x53981,_0x284b70)[_0x4093('0x9')](function(_0x551603){logger['info'](_0x4093('0xa'),_0x2024f8,_0x4093('0xb'));logger['debug']('UserChatInteraction,\x20%s,\x20%s,\x20%s',_0x2024f8,'request\x20sent',JSON[_0x4093('0xc')](_0x551603));if(_0x551603['error']){if(_0x551603[_0x4093('0xd')][_0x4093('0xe')]===0x1f4){logger[_0x4093('0xd')]('UserChatInteraction,\x20%s,\x20%s',_0x2024f8,_0x551603[_0x4093('0xd')][_0x4093('0xf')]);return _0x2bab35(_0x551603[_0x4093('0xd')][_0x4093('0xf')]);}logger['error']('UserChatInteraction,\x20%s,\x20%s',_0x2024f8,_0x551603[_0x4093('0xd')][_0x4093('0xf')]);return _0x24e961(_0x551603['error'][_0x4093('0xf')]);}else{logger['info'](_0x4093('0xa'),_0x2024f8,_0x4093('0xb'));_0x24e961(_0x551603[_0x4093('0x10')][_0x4093('0xf')]);}})[_0x4093('0x11')](function(_0x1e7cc6){logger['error'](_0x4093('0xa'),_0x2024f8,_0x1e7cc6);_0x2bab35(_0x1e7cc6);});});} \ No newline at end of file diff --git a/server/api/UserChatInteraction/index.js b/server/api/UserChatInteraction/index.js index aa7e3f4..91806a7 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 _0x6baa=['util','express','Router','../../components/interaction/service','./UserChatInteraction.controller','get','index','/:id','isAuthenticated','post','put','update','destroy','exports'];(function(_0x2a5b19,_0x2fc190){var _0x4d2c62=function(_0x4e1d33){while(--_0x4e1d33){_0x2a5b19['push'](_0x2a5b19['shift']());}};_0x4d2c62(++_0x2fc190);}(_0x6baa,0x16c));var _0xa6ba=function(_0x4ec6b1,_0x2d8115){_0x4ec6b1=_0x4ec6b1-0x0;var _0x543841=_0x6baa[_0x4ec6b1];return _0x543841;};'use strict';var multer=require('multer');var util=require(_0xa6ba('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa6ba('0x1'));var router=express[_0xa6ba('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xa6ba('0x3'));var config=require('../../config/environment');var controller=require(_0xa6ba('0x4'));router[_0xa6ba('0x5')]('/',auth['isAuthenticated'](),controller[_0xa6ba('0x6')]);router['get'](_0xa6ba('0x7'),auth[_0xa6ba('0x8')](),controller['show']);router[_0xa6ba('0x9')]('/',auth[_0xa6ba('0x8')](),controller['create']);router[_0xa6ba('0xa')](_0xa6ba('0x7'),auth['isAuthenticated'](),controller[_0xa6ba('0xb')]);router['delete'](_0xa6ba('0x7'),auth[_0xa6ba('0x8')](),controller[_0xa6ba('0xc')]);module[_0xa6ba('0xd')]=router; \ No newline at end of file +var _0xe62b=['../../config/environment','./UserChatInteraction.controller','get','/:id','isAuthenticated','show','post','put','update','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x532a8f,_0x8b69a4){var _0xfc5446=function(_0x187724){while(--_0x187724){_0x532a8f['push'](_0x532a8f['shift']());}};_0xfc5446(++_0x8b69a4);}(_0xe62b,0xfb));var _0xbe62=function(_0x273dc5,_0x268a81){_0x273dc5=_0x273dc5-0x0;var _0x46dae7=_0xe62b[_0x273dc5];return _0x46dae7;};'use strict';var multer=require(_0xbe62('0x0'));var util=require(_0xbe62('0x1'));var path=require('path');var timeout=require(_0xbe62('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xbe62('0x3'));var interaction=require(_0xbe62('0x4'));var config=require(_0xbe62('0x5'));var controller=require(_0xbe62('0x6'));router[_0xbe62('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbe62('0x7')](_0xbe62('0x8'),auth[_0xbe62('0x9')](),controller[_0xbe62('0xa')]);router[_0xbe62('0xb')]('/',auth[_0xbe62('0x9')](),controller['create']);router[_0xbe62('0xc')](_0xbe62('0x8'),auth[_0xbe62('0x9')](),controller[_0xbe62('0xd')]);router['delete'](_0xbe62('0x8'),auth['isAuthenticated'](),controller[_0xbe62('0xe')]);module[_0xbe62('0xf')]=router; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js b/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js index c9ecf72..9e3ff77 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 _0x4410=['sequelize','INTEGER'];(function(_0x6f72b9,_0x5bf83d){var _0x48161d=function(_0x5a2fcb){while(--_0x5a2fcb){_0x6f72b9['push'](_0x6f72b9['shift']());}};_0x48161d(++_0x5bf83d);}(_0x4410,0x18e));var _0x0441=function(_0x435044,_0x36ab8e){_0x435044=_0x435044-0x0;var _0x33d4c6=_0x4410[_0x435044];return _0x33d4c6;};'use strict';var Sequelize=require(_0x0441('0x0'));module['exports']={'FaxInteractionId':{'type':Sequelize[_0x0441('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x0441('0x1')],'primaryKey':!![]}}; \ No newline at end of file +var _0x0035=['sequelize','exports','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0035,0x14d));var _0x5003=function(_0x111e94,_0x31c837){_0x111e94=_0x111e94-0x0;var _0x3de107=_0x0035[_0x111e94];return _0x3de107;};'use strict';var Sequelize=require(_0x5003('0x0'));module[_0x5003('0x1')]={'FaxInteractionId':{'type':Sequelize[_0x5003('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x5003('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 0655790..b34e3f4 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 _0x1104=['jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','save','update','then','get','UserFaxInteractions','UserProfileResource','error','stack','name','send','index','map','UserFaxInteraction','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','VIRTUAL','options','where','include','rows','show','params','keys','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash'];(function(_0x5693b9,_0x58e117){var _0x3e85bc=function(_0x25e502){while(--_0x25e502){_0x5693b9['push'](_0x5693b9['shift']());}};_0x3e85bc(++_0x58e117);}(_0x1104,0x184));var _0x4110=function(_0x1c1ad5,_0x19d2cc){_0x1c1ad5=_0x1c1ad5-0x0;var _0x477201=_0x1104[_0x1c1ad5];return _0x477201;};'use strict';var pdf=require(_0x4110('0x0'));var emlformat=require(_0x4110('0x1'));var rimraf=require(_0x4110('0x2'));var zipdir=require(_0x4110('0x3'));var jsonpatch=require(_0x4110('0x4'));var rp=require(_0x4110('0x5'));var moment=require(_0x4110('0x6'));var BPromise=require(_0x4110('0x7'));var Mustache=require(_0x4110('0x8'));var util=require('util');var path=require(_0x4110('0x9'));var sox=require('sox');var csv=require(_0x4110('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4110('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4110('0xc'));var deskjs=require(_0x4110('0xd'));var toCsv=require(_0x4110('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4110('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4110('0xf'));var as=require(_0x4110('0x10'));var hardwareService=require(_0x4110('0x11'));var logger=require(_0x4110('0x12'))('api');var utils=require(_0x4110('0x13'));var config=require(_0x4110('0x14'));var licenseUtil=require(_0x4110('0x15'));var db=require(_0x4110('0x16'))['db'];function respondWithStatusCode(_0x3d1906,_0x1cf04e){_0x1cf04e=_0x1cf04e||0xcc;return function(_0x156c30){if(_0x156c30){return _0x3d1906[_0x4110('0x17')](_0x1cf04e);}return _0x3d1906[_0x4110('0x18')](_0x1cf04e)[_0x4110('0x19')]();};}function respondWithResult(_0x2badd3,_0x116ee2){_0x116ee2=_0x116ee2||0xc8;return function(_0x524258){if(_0x524258){return _0x2badd3['status'](_0x116ee2)['json'](_0x524258);}};}function respondWithFilteredResult(_0xa07858,_0x40801c){return function(_0x36569f){if(_0x36569f){var _0xe72205=_0x36569f[_0x4110('0x1a')],_0x1f57bc=_0x40801c[_0x4110('0x1b')],_0x3589e7=_0x40801c[_0x4110('0x1b')]+_0x40801c[_0x4110('0x1c')],_0x12a6e0;if(_0x3589e7>=_0xe72205){_0x3589e7=_0xe72205;_0x12a6e0=0xc8;}else{_0x12a6e0=0xce;}_0xa07858[_0x4110('0x18')](_0x12a6e0);return _0xa07858[_0x4110('0x1d')](_0x4110('0x1e'),_0x1f57bc+'-'+_0x3589e7+'/'+_0xe72205)['json'](_0x36569f);}return null;};}function patchUpdates(_0x44c5ff){return function(_0x434ddf){try{jsonpatch[_0x4110('0x1f')](_0x434ddf,_0x44c5ff,!![]);}catch(_0x4cbb72){return BPromise['reject'](_0x4cbb72);}return _0x434ddf[_0x4110('0x20')]();};}function saveUpdates(_0x5755a8,_0x46c72e){return function(_0x4a2e1f){if(_0x4a2e1f){return _0x4a2e1f[_0x4110('0x21')](_0x5755a8)[_0x4110('0x22')](function(_0x12b7a9){return _0x12b7a9;});}return null;};}function removeEntity(_0x5e4864,_0xe04ffc){return function(_0x27ca26){if(_0x27ca26){return _0x27ca26['destroy']()[_0x4110('0x22')](function(){var _0x4e22fb=_0x27ca26[_0x4110('0x23')]({'plain':!![]});var _0x95fa66=_0x4110('0x24');return db[_0x4110('0x25')]['destroy']({'where':{'type':_0x95fa66,'resourceId':_0x4e22fb['id']}})[_0x4110('0x22')](function(){return _0x27ca26;});})[_0x4110('0x22')](function(){_0x5e4864[_0x4110('0x18')](0xcc)[_0x4110('0x19')]();});}};}function handleEntityNotFound(_0xfc7277,_0xea4842){return function(_0x3800ed){if(!_0x3800ed){_0xfc7277['sendStatus'](0x194);}return _0x3800ed;};}function handleError(_0x15052b,_0x3c2f3b){_0x3c2f3b=_0x3c2f3b||0x1f4;return function(_0x2c6970){logger[_0x4110('0x26')](_0x2c6970[_0x4110('0x27')]);if(_0x2c6970[_0x4110('0x28')]){delete _0x2c6970[_0x4110('0x28')];}_0x15052b[_0x4110('0x18')](_0x3c2f3b)[_0x4110('0x29')](_0x2c6970);};}exports[_0x4110('0x2a')]=function(_0x2d9689,_0x31c10d){var _0x1367d4={},_0x100e2a={},_0x12958a={'count':0x0,'rows':[]};var _0x212656=_[_0x4110('0x2b')](db[_0x4110('0x2c')][_0x4110('0x2d')],function(_0xb0ad90){return{'name':_0xb0ad90[_0x4110('0x2e')],'type':_0xb0ad90[_0x4110('0x2f')]['key']};});_0x100e2a[_0x4110('0x30')]=_[_0x4110('0x2b')](_0x212656,_0x4110('0x28'));_0x100e2a['query']=_['keys'](_0x2d9689[_0x4110('0x31')]);_0x100e2a[_0x4110('0x32')]=_[_0x4110('0x33')](_0x100e2a[_0x4110('0x30')],_0x100e2a[_0x4110('0x31')]);_0x1367d4[_0x4110('0x34')]=_[_0x4110('0x33')](_0x100e2a[_0x4110('0x30')],qs[_0x4110('0x35')](_0x2d9689['query'][_0x4110('0x35')]));_0x1367d4[_0x4110('0x34')]=_0x1367d4['attributes'][_0x4110('0x36')]?_0x1367d4[_0x4110('0x34')]:_0x100e2a[_0x4110('0x30')];if(!_0x2d9689[_0x4110('0x31')][_0x4110('0x37')]('nolimit')){_0x1367d4[_0x4110('0x1c')]=qs['limit'](_0x2d9689['query'][_0x4110('0x1c')]);_0x1367d4[_0x4110('0x1b')]=qs['offset'](_0x2d9689[_0x4110('0x31')][_0x4110('0x1b')]);}_0x1367d4[_0x4110('0x38')]=qs[_0x4110('0x39')](_0x2d9689[_0x4110('0x31')][_0x4110('0x39')]);_0x1367d4['where']=qs['filters'](_[_0x4110('0x3a')](_0x2d9689[_0x4110('0x31')],_0x100e2a[_0x4110('0x32')]),_0x212656);if(_0x2d9689['query'][_0x4110('0x3b')]){_0x1367d4['where']=_[_0x4110('0x3c')](_0x1367d4['where'],{'$or':_[_0x4110('0x2b')](_0x212656,function(_0x421cff){if(_0x421cff[_0x4110('0x2f')]!==_0x4110('0x3d')){var _0x253d35={};_0x253d35[_0x421cff[_0x4110('0x28')]]={'$like':'%'+_0x2d9689['query']['filter']+'%'};return _0x253d35;}})});}_0x1367d4=_['merge']({},_0x1367d4,_0x2d9689[_0x4110('0x3e')]);var _0x35c99d={'where':_0x1367d4[_0x4110('0x3f')]};return db['UserFaxInteraction']['count'](_0x35c99d)[_0x4110('0x22')](function(_0x4980e7){_0x12958a[_0x4110('0x1a')]=_0x4980e7;if(_0x2d9689[_0x4110('0x31')]['includeAll']){_0x1367d4[_0x4110('0x40')]=[{'all':!![]}];}return db[_0x4110('0x2c')]['findAll'](_0x1367d4);})['then'](function(_0x1ddea2){_0x12958a[_0x4110('0x41')]=_0x1ddea2;return _0x12958a;})[_0x4110('0x22')](respondWithFilteredResult(_0x31c10d,_0x1367d4))['catch'](handleError(_0x31c10d,null));};exports[_0x4110('0x42')]=function(_0x1072df,_0x84328){var _0x3bbded={'raw':!![],'where':{'id':_0x1072df[_0x4110('0x43')]['id']}},_0x6f96f9={};_0x6f96f9['model']=_[_0x4110('0x44')](db[_0x4110('0x2c')]['rawAttributes']);_0x6f96f9[_0x4110('0x31')]=_[_0x4110('0x44')](_0x1072df[_0x4110('0x31')]);_0x6f96f9[_0x4110('0x32')]=_['intersection'](_0x6f96f9[_0x4110('0x30')],_0x6f96f9['query']);_0x3bbded[_0x4110('0x34')]=_['intersection'](_0x6f96f9[_0x4110('0x30')],qs[_0x4110('0x35')](_0x1072df[_0x4110('0x31')][_0x4110('0x35')]));_0x3bbded['attributes']=_0x3bbded[_0x4110('0x34')]['length']?_0x3bbded['attributes']:_0x6f96f9['model'];if(_0x1072df[_0x4110('0x31')]['includeAll']){_0x3bbded['include']=[{'all':!![]}];}_0x3bbded=_[_0x4110('0x3c')]({},_0x3bbded,_0x1072df[_0x4110('0x3e')]);return db[_0x4110('0x2c')][_0x4110('0x45')](_0x3bbded)[_0x4110('0x22')](handleEntityNotFound(_0x84328,null))[_0x4110('0x22')](respondWithResult(_0x84328,null))['catch'](handleError(_0x84328,null));};exports[_0x4110('0x46')]=function(_0x33d681,_0x46a061){return db['UserFaxInteraction'][_0x4110('0x46')](_0x33d681['body'],{})['then'](function(_0x2387e9){var _0x1e9130=_0x33d681[_0x4110('0x47')][_0x4110('0x23')]({'plain':!![]});if(!_0x1e9130)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e9130[_0x4110('0x48')]===_0x4110('0x47')){var _0x4e8547=_0x2387e9[_0x4110('0x23')]({'plain':!![]});var _0x2637d8=_0x4110('0x24');return db[_0x4110('0x49')][_0x4110('0x45')]({'where':{'name':_0x2637d8,'userProfileId':_0x1e9130[_0x4110('0x4a')]},'raw':!![]})[_0x4110('0x22')](function(_0x408bb4){if(_0x408bb4&&_0x408bb4[_0x4110('0x4b')]===0x0){return db['UserProfileResource'][_0x4110('0x46')]({'name':_0x4e8547['name'],'resourceId':_0x4e8547['id'],'type':_0x408bb4[_0x4110('0x28')],'sectionId':_0x408bb4['id']},{})[_0x4110('0x22')](function(){return _0x2387e9;});}else{return _0x2387e9;}})['catch'](function(_0x3379f1){logger[_0x4110('0x26')](_0x4110('0x4c'),_0x3379f1);throw _0x3379f1;});}return _0x2387e9;})[_0x4110('0x22')](respondWithResult(_0x46a061,0xc9))['catch'](handleError(_0x46a061,null));};exports[_0x4110('0x21')]=function(_0x5b1b3e,_0x38a53c){if(_0x5b1b3e[_0x4110('0x4d')]['id']){delete _0x5b1b3e[_0x4110('0x4d')]['id'];}return db[_0x4110('0x2c')][_0x4110('0x45')]({'where':{'id':_0x5b1b3e[_0x4110('0x43')]['id']}})['then'](handleEntityNotFound(_0x38a53c,null))[_0x4110('0x22')](saveUpdates(_0x5b1b3e[_0x4110('0x4d')],null))[_0x4110('0x22')](respondWithResult(_0x38a53c,null))['catch'](handleError(_0x38a53c,null));};exports[_0x4110('0x4e')]=function(_0x125c2c,_0x270169){return db[_0x4110('0x2c')][_0x4110('0x45')]({'where':{'id':_0x125c2c[_0x4110('0x43')]['id']}})[_0x4110('0x22')](handleEntityNotFound(_0x270169,null))[_0x4110('0x22')](removeEntity(_0x270169,null))[_0x4110('0x4f')](handleError(_0x270169,null));}; \ No newline at end of file +var _0x5d98=['sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','UserFaxInteractions','UserProfileResource','stack','name','send','index','map','UserFaxInteraction','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','options','includeAll','include','catch','show','params','rawAttributes','length','merge','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path'];(function(_0x4f4b6c,_0x17aef3){var _0x207cd9=function(_0x8823b1){while(--_0x8823b1){_0x4f4b6c['push'](_0x4f4b6c['shift']());}};_0x207cd9(++_0x17aef3);}(_0x5d98,0x192));var _0x85d9=function(_0x17ff35,_0x438d07){_0x17ff35=_0x17ff35-0x0;var _0x59691d=_0x5d98[_0x17ff35];return _0x59691d;};'use strict';var pdf=require(_0x85d9('0x0'));var emlformat=require(_0x85d9('0x1'));var rimraf=require(_0x85d9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x85d9('0x3'));var rp=require('request-promise');var moment=require(_0x85d9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x85d9('0x5'));var util=require(_0x85d9('0x6'));var path=require(_0x85d9('0x7'));var sox=require(_0x85d9('0x8'));var csv=require(_0x85d9('0x9'));var ejs=require(_0x85d9('0xa'));var fs=require('fs');var _=require(_0x85d9('0xb'));var squel=require('squel');var crypto=require(_0x85d9('0xc'));var jsforce=require(_0x85d9('0xd'));var deskjs=require(_0x85d9('0xe'));var toCsv=require(_0x85d9('0x9'));var querystring=require(_0x85d9('0xf'));var Papa=require('papaparse');var Redis=require(_0x85d9('0x10'));var authService=require(_0x85d9('0x11'));var qs=require(_0x85d9('0x12'));var as=require(_0x85d9('0x13'));var hardwareService=require(_0x85d9('0x14'));var logger=require(_0x85d9('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x85d9('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a4f66,_0x1224cc){_0x1224cc=_0x1224cc||0xcc;return function(_0x272156){if(_0x272156){return _0x5a4f66[_0x85d9('0x17')](_0x1224cc);}return _0x5a4f66['status'](_0x1224cc)[_0x85d9('0x18')]();};}function respondWithResult(_0x2fa2b5,_0x5686e9){_0x5686e9=_0x5686e9||0xc8;return function(_0x10d19d){if(_0x10d19d){return _0x2fa2b5[_0x85d9('0x19')](_0x5686e9)[_0x85d9('0x1a')](_0x10d19d);}};}function respondWithFilteredResult(_0x39d98a,_0x1175d1){return function(_0x52e8ba){if(_0x52e8ba){var _0x5e2809=_0x52e8ba[_0x85d9('0x1b')],_0x456ffb=_0x1175d1[_0x85d9('0x1c')],_0x1ea216=_0x1175d1['offset']+_0x1175d1['limit'],_0x4fa6d9;if(_0x1ea216>=_0x5e2809){_0x1ea216=_0x5e2809;_0x4fa6d9=0xc8;}else{_0x4fa6d9=0xce;}_0x39d98a[_0x85d9('0x19')](_0x4fa6d9);return _0x39d98a[_0x85d9('0x1d')](_0x85d9('0x1e'),_0x456ffb+'-'+_0x1ea216+'/'+_0x5e2809)['json'](_0x52e8ba);}return null;};}function patchUpdates(_0x45a974){return function(_0x3dff00){try{jsonpatch[_0x85d9('0x1f')](_0x3dff00,_0x45a974,!![]);}catch(_0x2b9344){return BPromise[_0x85d9('0x20')](_0x2b9344);}return _0x3dff00[_0x85d9('0x21')]();};}function saveUpdates(_0xb5fb6c,_0x39edcf){return function(_0x57c636){if(_0x57c636){return _0x57c636['update'](_0xb5fb6c)[_0x85d9('0x22')](function(_0x2b9571){return _0x2b9571;});}return null;};}function removeEntity(_0x321649,_0x1d68ad){return function(_0xb5f1c6){if(_0xb5f1c6){return _0xb5f1c6[_0x85d9('0x23')]()[_0x85d9('0x22')](function(){var _0x232566=_0xb5f1c6[_0x85d9('0x24')]({'plain':!![]});var _0x57c448=_0x85d9('0x25');return db[_0x85d9('0x26')][_0x85d9('0x23')]({'where':{'type':_0x57c448,'resourceId':_0x232566['id']}})[_0x85d9('0x22')](function(){return _0xb5f1c6;});})[_0x85d9('0x22')](function(){_0x321649[_0x85d9('0x19')](0xcc)[_0x85d9('0x18')]();});}};}function handleEntityNotFound(_0x19bc8a,_0x37255b){return function(_0x2c5d0c){if(!_0x2c5d0c){_0x19bc8a[_0x85d9('0x17')](0x194);}return _0x2c5d0c;};}function handleError(_0x1493e5,_0x586806){_0x586806=_0x586806||0x1f4;return function(_0x946904){logger['error'](_0x946904[_0x85d9('0x27')]);if(_0x946904[_0x85d9('0x28')]){delete _0x946904[_0x85d9('0x28')];}_0x1493e5['status'](_0x586806)[_0x85d9('0x29')](_0x946904);};}exports[_0x85d9('0x2a')]=function(_0x1adfb4,_0x44f3a1){var _0xf7d6dc={},_0x27f683={},_0x3bc676={'count':0x0,'rows':[]};var _0x39128b=_[_0x85d9('0x2b')](db[_0x85d9('0x2c')]['rawAttributes'],function(_0x5c1695){return{'name':_0x5c1695['fieldName'],'type':_0x5c1695[_0x85d9('0x2d')][_0x85d9('0x2e')]};});_0x27f683[_0x85d9('0x2f')]=_[_0x85d9('0x2b')](_0x39128b,'name');_0x27f683[_0x85d9('0x30')]=_[_0x85d9('0x31')](_0x1adfb4['query']);_0x27f683[_0x85d9('0x32')]=_['intersection'](_0x27f683[_0x85d9('0x2f')],_0x27f683[_0x85d9('0x30')]);_0xf7d6dc['attributes']=_[_0x85d9('0x33')](_0x27f683[_0x85d9('0x2f')],qs[_0x85d9('0x34')](_0x1adfb4['query'][_0x85d9('0x34')]));_0xf7d6dc[_0x85d9('0x35')]=_0xf7d6dc['attributes']['length']?_0xf7d6dc['attributes']:_0x27f683['model'];if(!_0x1adfb4[_0x85d9('0x30')][_0x85d9('0x36')](_0x85d9('0x37'))){_0xf7d6dc[_0x85d9('0x38')]=qs[_0x85d9('0x38')](_0x1adfb4['query']['limit']);_0xf7d6dc[_0x85d9('0x1c')]=qs[_0x85d9('0x1c')](_0x1adfb4[_0x85d9('0x30')][_0x85d9('0x1c')]);}_0xf7d6dc[_0x85d9('0x39')]=qs['sort'](_0x1adfb4[_0x85d9('0x30')][_0x85d9('0x3a')]);_0xf7d6dc['where']=qs[_0x85d9('0x32')](_[_0x85d9('0x3b')](_0x1adfb4['query'],_0x27f683[_0x85d9('0x32')]),_0x39128b);if(_0x1adfb4[_0x85d9('0x30')][_0x85d9('0x3c')]){_0xf7d6dc[_0x85d9('0x3d')]=_['merge'](_0xf7d6dc[_0x85d9('0x3d')],{'$or':_[_0x85d9('0x2b')](_0x39128b,function(_0x565bd2){if(_0x565bd2[_0x85d9('0x2d')]!=='VIRTUAL'){var _0x5a49a8={};_0x5a49a8[_0x565bd2[_0x85d9('0x28')]]={'$like':'%'+_0x1adfb4[_0x85d9('0x30')][_0x85d9('0x3c')]+'%'};return _0x5a49a8;}})});}_0xf7d6dc=_['merge']({},_0xf7d6dc,_0x1adfb4[_0x85d9('0x3e')]);var _0x3591c1={'where':_0xf7d6dc[_0x85d9('0x3d')]};return db[_0x85d9('0x2c')][_0x85d9('0x1b')](_0x3591c1)[_0x85d9('0x22')](function(_0x38ffd3){_0x3bc676['count']=_0x38ffd3;if(_0x1adfb4[_0x85d9('0x30')][_0x85d9('0x3f')]){_0xf7d6dc[_0x85d9('0x40')]=[{'all':!![]}];}return db[_0x85d9('0x2c')]['findAll'](_0xf7d6dc);})[_0x85d9('0x22')](function(_0x160963){_0x3bc676['rows']=_0x160963;return _0x3bc676;})['then'](respondWithFilteredResult(_0x44f3a1,_0xf7d6dc))[_0x85d9('0x41')](handleError(_0x44f3a1,null));};exports[_0x85d9('0x42')]=function(_0x19fcfa,_0xecdc4f){var _0x1dba4b={'raw':!![],'where':{'id':_0x19fcfa[_0x85d9('0x43')]['id']}},_0x3d260a={};_0x3d260a[_0x85d9('0x2f')]=_[_0x85d9('0x31')](db[_0x85d9('0x2c')][_0x85d9('0x44')]);_0x3d260a['query']=_[_0x85d9('0x31')](_0x19fcfa[_0x85d9('0x30')]);_0x3d260a[_0x85d9('0x32')]=_[_0x85d9('0x33')](_0x3d260a[_0x85d9('0x2f')],_0x3d260a[_0x85d9('0x30')]);_0x1dba4b[_0x85d9('0x35')]=_[_0x85d9('0x33')](_0x3d260a['model'],qs[_0x85d9('0x34')](_0x19fcfa[_0x85d9('0x30')][_0x85d9('0x34')]));_0x1dba4b['attributes']=_0x1dba4b['attributes'][_0x85d9('0x45')]?_0x1dba4b[_0x85d9('0x35')]:_0x3d260a['model'];if(_0x19fcfa[_0x85d9('0x30')][_0x85d9('0x3f')]){_0x1dba4b[_0x85d9('0x40')]=[{'all':!![]}];}_0x1dba4b=_[_0x85d9('0x46')]({},_0x1dba4b,_0x19fcfa['options']);return db[_0x85d9('0x2c')]['find'](_0x1dba4b)[_0x85d9('0x22')](handleEntityNotFound(_0xecdc4f,null))[_0x85d9('0x22')](respondWithResult(_0xecdc4f,null))['catch'](handleError(_0xecdc4f,null));};exports[_0x85d9('0x47')]=function(_0x8ac216,_0x14db52){return db['UserFaxInteraction'][_0x85d9('0x47')](_0x8ac216[_0x85d9('0x48')],{})[_0x85d9('0x22')](function(_0x3ffe6a){var _0xba1f30=_0x8ac216[_0x85d9('0x49')][_0x85d9('0x24')]({'plain':!![]});if(!_0xba1f30)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xba1f30[_0x85d9('0x4a')]===_0x85d9('0x49')){var _0x3a1adc=_0x3ffe6a[_0x85d9('0x24')]({'plain':!![]});var _0x3595af=_0x85d9('0x25');return db[_0x85d9('0x4b')][_0x85d9('0x4c')]({'where':{'name':_0x3595af,'userProfileId':_0xba1f30[_0x85d9('0x4d')]},'raw':!![]})['then'](function(_0x866f2a){if(_0x866f2a&&_0x866f2a[_0x85d9('0x4e')]===0x0){return db[_0x85d9('0x26')][_0x85d9('0x47')]({'name':_0x3a1adc[_0x85d9('0x28')],'resourceId':_0x3a1adc['id'],'type':_0x866f2a['name'],'sectionId':_0x866f2a['id']},{})[_0x85d9('0x22')](function(){return _0x3ffe6a;});}else{return _0x3ffe6a;}})[_0x85d9('0x41')](function(_0x305713){logger[_0x85d9('0x4f')](_0x85d9('0x50'),_0x305713);throw _0x305713;});}return _0x3ffe6a;})[_0x85d9('0x22')](respondWithResult(_0x14db52,0xc9))['catch'](handleError(_0x14db52,null));};exports[_0x85d9('0x51')]=function(_0x8e2a95,_0x408546){if(_0x8e2a95['body']['id']){delete _0x8e2a95[_0x85d9('0x48')]['id'];}return db['UserFaxInteraction'][_0x85d9('0x4c')]({'where':{'id':_0x8e2a95[_0x85d9('0x43')]['id']}})[_0x85d9('0x22')](handleEntityNotFound(_0x408546,null))['then'](saveUpdates(_0x8e2a95['body'],null))['then'](respondWithResult(_0x408546,null))[_0x85d9('0x41')](handleError(_0x408546,null));};exports[_0x85d9('0x23')]=function(_0x47e660,_0x506be9){return db['UserFaxInteraction'][_0x85d9('0x4c')]({'where':{'id':_0x47e660[_0x85d9('0x43')]['id']}})[_0x85d9('0x22')](handleEntityNotFound(_0x506be9,null))['then'](removeEntity(_0x506be9,null))[_0x85d9('0x41')](handleError(_0x506be9,null));}; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.model.js b/server/api/UserFaxInteraction/UserFaxInteraction.model.js index 42cc644..e70092e 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(_0x36c569,_0x26f7e2){var _0xf972d7=function(_0x5a9ee8){while(--_0x5a9ee8){_0x36c569['push'](_0x36c569['shift']());}};_0xf972d7(++_0x26f7e2);}(_0xdb28,0x106));var _0x8db2=function(_0x2ad702,_0x55e19a){_0x2ad702=_0x2ad702-0x0;var _0x242ac0=_0xdb28[_0x2ad702];return _0x242ac0;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./UserFaxInteraction.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./UserFaxInteraction.attributes','exports','define','user_has_fax_interactions','lodash','../../config/logger'];(function(_0x2cf683,_0x3213de){var _0x5cddff=function(_0x454eed){while(--_0x454eed){_0x2cf683['push'](_0x2cf683['shift']());}};_0x5cddff(++_0x3213de);}(_0xb10b,0x12a));var _0xbb10=function(_0xafdec6,_0x3d94df){_0xafdec6=_0xafdec6-0x0;var _0x372bdb=_0xb10b[_0xafdec6];return _0x372bdb;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserFaxInteraction',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.rpc.js b/server/api/UserFaxInteraction/UserFaxInteraction.rpc.js index 32a5d16..5f0a487 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 _0x3f38=['stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','then','UserFaxInteraction,\x20%s,\x20%s','UserFaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x50f9cb,_0x5f4af7){var _0x5d9ab9=function(_0x45321f){while(--_0x45321f){_0x50f9cb['push'](_0x50f9cb['shift']());}};_0x5d9ab9(++_0x5f4af7);}(_0x3f38,0x6a));var _0x83f3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3f38[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x83f3('0x0'));var util=require(_0x83f3('0x1'));var moment=require(_0x83f3('0x2'));var BPromise=require(_0x83f3('0x3'));var rs=require(_0x83f3('0x4'));var fs=require('fs');var Redis=require(_0x83f3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x83f3('0x6'));var logger=require(_0x83f3('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x83f3('0x8'));var client=jayson['client'][_0x83f3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37de30,_0x7252f3,_0x6121e1){return new BPromise(function(_0x2505d0,_0x1887b6){return client['request'](_0x37de30,_0x6121e1)[_0x83f3('0xa')](function(_0x3815f5){logger['info'](_0x83f3('0xb'),_0x7252f3,'request\x20sent');logger['debug'](_0x83f3('0xc'),_0x7252f3,_0x83f3('0xd'),JSON[_0x83f3('0xe')](_0x3815f5));if(_0x3815f5[_0x83f3('0xf')]){if(_0x3815f5[_0x83f3('0xf')]['code']===0x1f4){logger[_0x83f3('0xf')](_0x83f3('0xb'),_0x7252f3,_0x3815f5[_0x83f3('0xf')][_0x83f3('0x10')]);return _0x1887b6(_0x3815f5[_0x83f3('0xf')]['message']);}logger[_0x83f3('0xf')](_0x83f3('0xb'),_0x7252f3,_0x3815f5['error'][_0x83f3('0x10')]);return _0x2505d0(_0x3815f5[_0x83f3('0xf')][_0x83f3('0x10')]);}else{logger[_0x83f3('0x11')](_0x83f3('0xb'),_0x7252f3,_0x83f3('0xd'));_0x2505d0(_0x3815f5[_0x83f3('0x12')][_0x83f3('0x10')]);}})[_0x83f3('0x13')](function(_0x210f76){logger[_0x83f3('0xf')](_0x83f3('0xb'),_0x7252f3,_0x210f76);_0x1887b6(_0x210f76);});});} \ No newline at end of file +var _0xb760=['catch','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserFaxInteraction,\x20%s,\x20%s','debug','UserFaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x5ecaab,_0x2f3053){var _0x3db1a8=function(_0x48df9f){while(--_0x48df9f){_0x5ecaab['push'](_0x5ecaab['shift']());}};_0x3db1a8(++_0x2f3053);}(_0xb760,0x191));var _0x0b76=function(_0x5b8f68,_0x4dfc87){_0x5b8f68=_0x5b8f68-0x0;var _0x4cec24=_0xb760[_0x5b8f68];return _0x4cec24;};'use strict';var _=require('lodash');var util=require(_0x0b76('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0b76('0x1'));var fs=require('fs');var Redis=require(_0x0b76('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0b76('0x3'));var logger=require(_0x0b76('0x4'))(_0x0b76('0x5'));var config=require('../../config/environment');var jayson=require(_0x0b76('0x6'));var client=jayson[_0x0b76('0x7')][_0x0b76('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d509a,_0x18bd45,_0x173613){return new BPromise(function(_0x4bfaef,_0x4daa30){return client[_0x0b76('0x9')](_0x2d509a,_0x173613)[_0x0b76('0xa')](function(_0x179288){logger[_0x0b76('0xb')](_0x0b76('0xc'),_0x18bd45,'request\x20sent');logger[_0x0b76('0xd')](_0x0b76('0xe'),_0x18bd45,_0x0b76('0xf'),JSON[_0x0b76('0x10')](_0x179288));if(_0x179288[_0x0b76('0x11')]){if(_0x179288['error']['code']===0x1f4){logger['error'](_0x0b76('0xc'),_0x18bd45,_0x179288[_0x0b76('0x11')][_0x0b76('0x12')]);return _0x4daa30(_0x179288[_0x0b76('0x11')]['message']);}logger[_0x0b76('0x11')]('UserFaxInteraction,\x20%s,\x20%s',_0x18bd45,_0x179288[_0x0b76('0x11')][_0x0b76('0x12')]);return _0x4bfaef(_0x179288[_0x0b76('0x11')][_0x0b76('0x12')]);}else{logger[_0x0b76('0xb')]('UserFaxInteraction,\x20%s,\x20%s',_0x18bd45,'request\x20sent');_0x4bfaef(_0x179288['result'][_0x0b76('0x12')]);}})[_0x0b76('0x13')](function(_0x4d968e){logger['error'](_0x0b76('0xc'),_0x18bd45,_0x4d968e);_0x4daa30(_0x4d968e);});});} \ No newline at end of file diff --git a/server/api/UserFaxInteraction/index.js b/server/api/UserFaxInteraction/index.js index ecef98d..d6bf45f 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 _0x6122=['post','put','update','delete','multer','util','path','connect-timeout','express','Router','get','isAuthenticated','index','/:id','show'];(function(_0x49988d,_0x15dae4){var _0x2259f7=function(_0x1c964d){while(--_0x1c964d){_0x49988d['push'](_0x49988d['shift']());}};_0x2259f7(++_0x15dae4);}(_0x6122,0xb8));var _0x2612=function(_0x45fb76,_0x35fd5d){_0x45fb76=_0x45fb76-0x0;var _0x338556=_0x6122[_0x45fb76];return _0x338556;};'use strict';var multer=require(_0x2612('0x0'));var util=require(_0x2612('0x1'));var path=require(_0x2612('0x2'));var timeout=require(_0x2612('0x3'));var express=require(_0x2612('0x4'));var router=express[_0x2612('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./UserFaxInteraction.controller');router[_0x2612('0x6')]('/',auth[_0x2612('0x7')](),controller[_0x2612('0x8')]);router[_0x2612('0x6')](_0x2612('0x9'),auth[_0x2612('0x7')](),controller[_0x2612('0xa')]);router[_0x2612('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2612('0xc')]('/:id',auth[_0x2612('0x7')](),controller[_0x2612('0xd')]);router[_0x2612('0xe')](_0x2612('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xadc0=['connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserFaxInteraction.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer'];(function(_0x100663,_0x1e41f3){var _0x44aeeb=function(_0x3f0c96){while(--_0x3f0c96){_0x100663['push'](_0x100663['shift']());}};_0x44aeeb(++_0x1e41f3);}(_0xadc0,0x1bf));var _0x0adc=function(_0x2f45a8,_0x2d140a){_0x2f45a8=_0x2f45a8-0x0;var _0x11f0e0=_0xadc0[_0x2f45a8];return _0x11f0e0;};'use strict';var multer=require(_0x0adc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0adc('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x0adc('0x2'));var interaction=require(_0x0adc('0x3'));var config=require(_0x0adc('0x4'));var controller=require(_0x0adc('0x5'));router[_0x0adc('0x6')]('/',auth[_0x0adc('0x7')](),controller[_0x0adc('0x8')]);router[_0x0adc('0x6')](_0x0adc('0x9'),auth[_0x0adc('0x7')](),controller[_0x0adc('0xa')]);router[_0x0adc('0xb')]('/',auth[_0x0adc('0x7')](),controller[_0x0adc('0xc')]);router[_0x0adc('0xd')](_0x0adc('0x9'),auth['isAuthenticated'](),controller[_0x0adc('0xe')]);router['delete'](_0x0adc('0x9'),auth[_0x0adc('0x7')](),controller['destroy']);module[_0x0adc('0xf')]=router; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.attributes.js b/server/api/UserMailInteraction/UserMailInteraction.attributes.js index e6d36ee..9b05ab0 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 _0xb78d=['sequelize','exports','INTEGER'];(function(_0x50693e,_0x78ac73){var _0xfaa806=function(_0x143ae7){while(--_0x143ae7){_0x50693e['push'](_0x50693e['shift']());}};_0xfaa806(++_0x78ac73);}(_0xb78d,0x126));var _0xdb78=function(_0x4e748d,_0x18dee4){_0x4e748d=_0x4e748d-0x0;var _0x2d786d=_0xb78d[_0x4e748d];return _0x2d786d;};'use strict';var Sequelize=require(_0xdb78('0x0'));module[_0xdb78('0x1')]={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xdb78('0x2')],'primaryKey':!![]}}; \ No newline at end of file +var _0xe1ca=['INTEGER','sequelize','exports'];(function(_0x409161,_0x1f3338){var _0x5a2482=function(_0x326eef){while(--_0x326eef){_0x409161['push'](_0x409161['shift']());}};_0x5a2482(++_0x1f3338);}(_0xe1ca,0x106));var _0xae1c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe1ca[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xae1c('0x0'));module[_0xae1c('0x1')]={'MailInteractionId':{'type':Sequelize[_0xae1c('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xae1c('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 7c6f716..dbd52cb 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 _0xbf4f=['fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','UserMailInteraction','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','role','autoAssociation','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','UserMailInteractions','UserProfileResource','error','name','send','map','rawAttributes'];(function(_0x46f62c,_0x49eb41){var _0x46d994=function(_0x225d69){while(--_0x225d69){_0x46f62c['push'](_0x46f62c['shift']());}};_0x46d994(++_0x49eb41);}(_0xbf4f,0x1c8));var _0xfbf4=function(_0x54691e,_0x28b041){_0x54691e=_0x54691e-0x0;var _0x5520b2=_0xbf4f[_0x54691e];return _0x5520b2;};'use strict';var pdf=require(_0xfbf4('0x0'));var emlformat=require(_0xfbf4('0x1'));var rimraf=require(_0xfbf4('0x2'));var zipdir=require(_0xfbf4('0x3'));var jsonpatch=require(_0xfbf4('0x4'));var rp=require(_0xfbf4('0x5'));var moment=require(_0xfbf4('0x6'));var BPromise=require(_0xfbf4('0x7'));var Mustache=require(_0xfbf4('0x8'));var util=require(_0xfbf4('0x9'));var path=require(_0xfbf4('0xa'));var sox=require(_0xfbf4('0xb'));var csv=require(_0xfbf4('0xc'));var ejs=require(_0xfbf4('0xd'));var fs=require('fs');var _=require(_0xfbf4('0xe'));var squel=require(_0xfbf4('0xf'));var crypto=require(_0xfbf4('0x10'));var jsforce=require(_0xfbf4('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xfbf4('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfbf4('0x12'));var authService=require(_0xfbf4('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xfbf4('0x14'));var hardwareService=require(_0xfbf4('0x15'));var logger=require(_0xfbf4('0x16'))(_0xfbf4('0x17'));var utils=require(_0xfbf4('0x18'));var config=require(_0xfbf4('0x19'));var licenseUtil=require(_0xfbf4('0x1a'));var db=require(_0xfbf4('0x1b'))['db'];function respondWithStatusCode(_0xa9a2ec,_0x39eca8){_0x39eca8=_0x39eca8||0xcc;return function(_0x112050){if(_0x112050){return _0xa9a2ec[_0xfbf4('0x1c')](_0x39eca8);}return _0xa9a2ec[_0xfbf4('0x1d')](_0x39eca8)[_0xfbf4('0x1e')]();};}function respondWithResult(_0x29f1cb,_0x15c5be){_0x15c5be=_0x15c5be||0xc8;return function(_0x1b2810){if(_0x1b2810){return _0x29f1cb[_0xfbf4('0x1d')](_0x15c5be)[_0xfbf4('0x1f')](_0x1b2810);}};}function respondWithFilteredResult(_0x4db88f,_0x48e0fc){return function(_0x4614c9){if(_0x4614c9){var _0x5f47a5=_0x4614c9['count'],_0x140954=_0x48e0fc[_0xfbf4('0x20')],_0x37276a=_0x48e0fc[_0xfbf4('0x20')]+_0x48e0fc[_0xfbf4('0x21')],_0x1e6cdf;if(_0x37276a>=_0x5f47a5){_0x37276a=_0x5f47a5;_0x1e6cdf=0xc8;}else{_0x1e6cdf=0xce;}_0x4db88f['status'](_0x1e6cdf);return _0x4db88f[_0xfbf4('0x22')](_0xfbf4('0x23'),_0x140954+'-'+_0x37276a+'/'+_0x5f47a5)[_0xfbf4('0x1f')](_0x4614c9);}return null;};}function patchUpdates(_0x1c0232){return function(_0x239bd5){try{jsonpatch[_0xfbf4('0x24')](_0x239bd5,_0x1c0232,!![]);}catch(_0x5131bb){return BPromise['reject'](_0x5131bb);}return _0x239bd5[_0xfbf4('0x25')]();};}function saveUpdates(_0x323ed0,_0x101a5c){return function(_0x2a43d8){if(_0x2a43d8){return _0x2a43d8[_0xfbf4('0x26')](_0x323ed0)[_0xfbf4('0x27')](function(_0x35d9a6){return _0x35d9a6;});}return null;};}function removeEntity(_0x1b43f0,_0x549acd){return function(_0x46bfdf){if(_0x46bfdf){return _0x46bfdf[_0xfbf4('0x28')]()['then'](function(){var _0x527716=_0x46bfdf['get']({'plain':!![]});var _0x3c408c=_0xfbf4('0x29');return db[_0xfbf4('0x2a')][_0xfbf4('0x28')]({'where':{'type':_0x3c408c,'resourceId':_0x527716['id']}})['then'](function(){return _0x46bfdf;});})[_0xfbf4('0x27')](function(){_0x1b43f0[_0xfbf4('0x1d')](0xcc)[_0xfbf4('0x1e')]();});}};}function handleEntityNotFound(_0x29bab1,_0x474514){return function(_0x46b1fd){if(!_0x46b1fd){_0x29bab1['sendStatus'](0x194);}return _0x46b1fd;};}function handleError(_0x24ce13,_0xb9cc73){_0xb9cc73=_0xb9cc73||0x1f4;return function(_0xe6a2df){logger[_0xfbf4('0x2b')](_0xe6a2df['stack']);if(_0xe6a2df[_0xfbf4('0x2c')]){delete _0xe6a2df[_0xfbf4('0x2c')];}_0x24ce13[_0xfbf4('0x1d')](_0xb9cc73)[_0xfbf4('0x2d')](_0xe6a2df);};}exports['index']=function(_0x2c192a,_0xa05ae7){var _0x2db60d={},_0x45fd96={},_0x3b2b6a={'count':0x0,'rows':[]};var _0x56e867=_[_0xfbf4('0x2e')](db['UserMailInteraction'][_0xfbf4('0x2f')],function(_0x1b2631){return{'name':_0x1b2631[_0xfbf4('0x30')],'type':_0x1b2631[_0xfbf4('0x31')][_0xfbf4('0x32')]};});_0x45fd96[_0xfbf4('0x33')]=_[_0xfbf4('0x2e')](_0x56e867,_0xfbf4('0x2c'));_0x45fd96[_0xfbf4('0x34')]=_[_0xfbf4('0x35')](_0x2c192a[_0xfbf4('0x34')]);_0x45fd96['filters']=_[_0xfbf4('0x36')](_0x45fd96['model'],_0x45fd96[_0xfbf4('0x34')]);_0x2db60d[_0xfbf4('0x37')]=_[_0xfbf4('0x36')](_0x45fd96[_0xfbf4('0x33')],qs[_0xfbf4('0x38')](_0x2c192a[_0xfbf4('0x34')][_0xfbf4('0x38')]));_0x2db60d[_0xfbf4('0x37')]=_0x2db60d[_0xfbf4('0x37')][_0xfbf4('0x39')]?_0x2db60d[_0xfbf4('0x37')]:_0x45fd96[_0xfbf4('0x33')];if(!_0x2c192a[_0xfbf4('0x34')][_0xfbf4('0x3a')](_0xfbf4('0x3b'))){_0x2db60d[_0xfbf4('0x21')]=qs['limit'](_0x2c192a[_0xfbf4('0x34')]['limit']);_0x2db60d[_0xfbf4('0x20')]=qs[_0xfbf4('0x20')](_0x2c192a[_0xfbf4('0x34')][_0xfbf4('0x20')]);}_0x2db60d[_0xfbf4('0x3c')]=qs['sort'](_0x2c192a[_0xfbf4('0x34')][_0xfbf4('0x3d')]);_0x2db60d[_0xfbf4('0x3e')]=qs[_0xfbf4('0x3f')](_[_0xfbf4('0x40')](_0x2c192a['query'],_0x45fd96[_0xfbf4('0x3f')]),_0x56e867);if(_0x2c192a[_0xfbf4('0x34')][_0xfbf4('0x41')]){_0x2db60d[_0xfbf4('0x3e')]=_[_0xfbf4('0x42')](_0x2db60d[_0xfbf4('0x3e')],{'$or':_[_0xfbf4('0x2e')](_0x56e867,function(_0x52a966){if(_0x52a966[_0xfbf4('0x31')]!=='VIRTUAL'){var _0x477460={};_0x477460[_0x52a966[_0xfbf4('0x2c')]]={'$like':'%'+_0x2c192a['query'][_0xfbf4('0x41')]+'%'};return _0x477460;}})});}_0x2db60d=_['merge']({},_0x2db60d,_0x2c192a[_0xfbf4('0x43')]);var _0x1a20bb={'where':_0x2db60d[_0xfbf4('0x3e')]};return db[_0xfbf4('0x44')][_0xfbf4('0x45')](_0x1a20bb)[_0xfbf4('0x27')](function(_0xf698d2){_0x3b2b6a[_0xfbf4('0x45')]=_0xf698d2;if(_0x2c192a[_0xfbf4('0x34')][_0xfbf4('0x46')]){_0x2db60d[_0xfbf4('0x47')]=[{'all':!![]}];}return db[_0xfbf4('0x44')][_0xfbf4('0x48')](_0x2db60d);})[_0xfbf4('0x27')](function(_0x28f877){_0x3b2b6a[_0xfbf4('0x49')]=_0x28f877;return _0x3b2b6a;})[_0xfbf4('0x27')](respondWithFilteredResult(_0xa05ae7,_0x2db60d))[_0xfbf4('0x4a')](handleError(_0xa05ae7,null));};exports[_0xfbf4('0x4b')]=function(_0x124b8b,_0x3126ba){var _0x102166={'raw':!![],'where':{'id':_0x124b8b[_0xfbf4('0x4c')]['id']}},_0x4624d6={};_0x4624d6[_0xfbf4('0x33')]=_[_0xfbf4('0x35')](db[_0xfbf4('0x44')][_0xfbf4('0x2f')]);_0x4624d6[_0xfbf4('0x34')]=_[_0xfbf4('0x35')](_0x124b8b['query']);_0x4624d6[_0xfbf4('0x3f')]=_[_0xfbf4('0x36')](_0x4624d6[_0xfbf4('0x33')],_0x4624d6[_0xfbf4('0x34')]);_0x102166[_0xfbf4('0x37')]=_[_0xfbf4('0x36')](_0x4624d6[_0xfbf4('0x33')],qs[_0xfbf4('0x38')](_0x124b8b['query']['fields']));_0x102166[_0xfbf4('0x37')]=_0x102166[_0xfbf4('0x37')][_0xfbf4('0x39')]?_0x102166[_0xfbf4('0x37')]:_0x4624d6['model'];if(_0x124b8b['query'][_0xfbf4('0x46')]){_0x102166[_0xfbf4('0x47')]=[{'all':!![]}];}_0x102166=_['merge']({},_0x102166,_0x124b8b[_0xfbf4('0x43')]);return db[_0xfbf4('0x44')][_0xfbf4('0x4d')](_0x102166)[_0xfbf4('0x27')](handleEntityNotFound(_0x3126ba,null))[_0xfbf4('0x27')](respondWithResult(_0x3126ba,null))[_0xfbf4('0x4a')](handleError(_0x3126ba,null));};exports[_0xfbf4('0x4e')]=function(_0x241282,_0x10ece0){return db[_0xfbf4('0x44')][_0xfbf4('0x4e')](_0x241282[_0xfbf4('0x4f')],{})[_0xfbf4('0x27')](function(_0x3cc65f){var _0x2954dd=_0x241282[_0xfbf4('0x50')][_0xfbf4('0x51')]({'plain':!![]});if(!_0x2954dd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2954dd[_0xfbf4('0x52')]===_0xfbf4('0x50')){var _0x11d875=_0x3cc65f[_0xfbf4('0x51')]({'plain':!![]});var _0x1b0601='UserMailInteractions';return db['UserProfileSection'][_0xfbf4('0x4d')]({'where':{'name':_0x1b0601,'userProfileId':_0x2954dd['userProfileId']},'raw':!![]})[_0xfbf4('0x27')](function(_0x107bbe){if(_0x107bbe&&_0x107bbe[_0xfbf4('0x53')]===0x0){return db[_0xfbf4('0x2a')]['create']({'name':_0x11d875[_0xfbf4('0x2c')],'resourceId':_0x11d875['id'],'type':_0x107bbe['name'],'sectionId':_0x107bbe['id']},{})[_0xfbf4('0x27')](function(){return _0x3cc65f;});}else{return _0x3cc65f;}})[_0xfbf4('0x4a')](function(_0x5e46c2){logger[_0xfbf4('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e46c2);throw _0x5e46c2;});}return _0x3cc65f;})[_0xfbf4('0x27')](respondWithResult(_0x10ece0,0xc9))[_0xfbf4('0x4a')](handleError(_0x10ece0,null));};exports[_0xfbf4('0x26')]=function(_0x21b4f8,_0x46f055){if(_0x21b4f8[_0xfbf4('0x4f')]['id']){delete _0x21b4f8['body']['id'];}return db[_0xfbf4('0x44')][_0xfbf4('0x4d')]({'where':{'id':_0x21b4f8[_0xfbf4('0x4c')]['id']}})[_0xfbf4('0x27')](handleEntityNotFound(_0x46f055,null))[_0xfbf4('0x27')](saveUpdates(_0x21b4f8[_0xfbf4('0x4f')],null))[_0xfbf4('0x27')](respondWithResult(_0x46f055,null))['catch'](handleError(_0x46f055,null));};exports[_0xfbf4('0x28')]=function(_0x32f03c,_0x261643){return db[_0xfbf4('0x44')][_0xfbf4('0x4d')]({'where':{'id':_0x32f03c[_0xfbf4('0x4c')]['id']}})[_0xfbf4('0x27')](handleEntityNotFound(_0x261643,null))['then'](removeEntity(_0x261643,null))['catch'](handleError(_0x261643,null));}; \ No newline at end of file +var _0x6bb6=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','update','then','destroy','get','end','error','stack','name','send','index','map','UserMailInteraction','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','findAll','catch','show','params','keys','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserMailInteractions','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','zip-dir','fast-json-patch','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x2e986d,_0x4b6b63){var _0x351c79=function(_0xf178c7){while(--_0xf178c7){_0x2e986d['push'](_0x2e986d['shift']());}};_0x351c79(++_0x4b6b63);}(_0x6bb6,0xd9));var _0x66bb=function(_0x8ea0c8,_0x3d6290){_0x8ea0c8=_0x8ea0c8-0x0;var _0x2cf0af=_0x6bb6[_0x8ea0c8];return _0x2cf0af;};'use strict';var pdf=require(_0x66bb('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x66bb('0x1'));var jsonpatch=require(_0x66bb('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x66bb('0x3'));var sox=require(_0x66bb('0x4'));var csv=require(_0x66bb('0x5'));var ejs=require(_0x66bb('0x6'));var fs=require('fs');var _=require(_0x66bb('0x7'));var squel=require(_0x66bb('0x8'));var crypto=require(_0x66bb('0x9'));var jsforce=require(_0x66bb('0xa'));var deskjs=require(_0x66bb('0xb'));var toCsv=require(_0x66bb('0x5'));var querystring=require(_0x66bb('0xc'));var Papa=require('papaparse');var Redis=require(_0x66bb('0xd'));var authService=require(_0x66bb('0xe'));var qs=require(_0x66bb('0xf'));var as=require(_0x66bb('0x10'));var hardwareService=require(_0x66bb('0x11'));var logger=require(_0x66bb('0x12'))(_0x66bb('0x13'));var utils=require(_0x66bb('0x14'));var config=require(_0x66bb('0x15'));var licenseUtil=require(_0x66bb('0x16'));var db=require(_0x66bb('0x17'))['db'];function respondWithStatusCode(_0x42ab20,_0x2d4dfa){_0x2d4dfa=_0x2d4dfa||0xcc;return function(_0x10ed3b){if(_0x10ed3b){return _0x42ab20[_0x66bb('0x18')](_0x2d4dfa);}return _0x42ab20['status'](_0x2d4dfa)['end']();};}function respondWithResult(_0x15b0bd,_0x5eae84){_0x5eae84=_0x5eae84||0xc8;return function(_0x5c39e7){if(_0x5c39e7){return _0x15b0bd[_0x66bb('0x19')](_0x5eae84)[_0x66bb('0x1a')](_0x5c39e7);}};}function respondWithFilteredResult(_0x1561fd,_0x1fb8e1){return function(_0x170306){if(_0x170306){var _0x54098d=_0x170306['count'],_0x354977=_0x1fb8e1[_0x66bb('0x1b')],_0x15adf9=_0x1fb8e1['offset']+_0x1fb8e1[_0x66bb('0x1c')],_0x48c2b9;if(_0x15adf9>=_0x54098d){_0x15adf9=_0x54098d;_0x48c2b9=0xc8;}else{_0x48c2b9=0xce;}_0x1561fd[_0x66bb('0x19')](_0x48c2b9);return _0x1561fd[_0x66bb('0x1d')](_0x66bb('0x1e'),_0x354977+'-'+_0x15adf9+'/'+_0x54098d)['json'](_0x170306);}return null;};}function patchUpdates(_0x318845){return function(_0x312986){try{jsonpatch[_0x66bb('0x1f')](_0x312986,_0x318845,!![]);}catch(_0x462d09){return BPromise['reject'](_0x462d09);}return _0x312986['save']();};}function saveUpdates(_0x2480cf,_0x42dca5){return function(_0x205b3c){if(_0x205b3c){return _0x205b3c[_0x66bb('0x20')](_0x2480cf)[_0x66bb('0x21')](function(_0x32d49e){return _0x32d49e;});}return null;};}function removeEntity(_0x173016,_0x1eb49a){return function(_0x475a72){if(_0x475a72){return _0x475a72[_0x66bb('0x22')]()[_0x66bb('0x21')](function(){var _0x2ffc29=_0x475a72[_0x66bb('0x23')]({'plain':!![]});var _0x229ba7='UserMailInteractions';return db['UserProfileResource']['destroy']({'where':{'type':_0x229ba7,'resourceId':_0x2ffc29['id']}})['then'](function(){return _0x475a72;});})[_0x66bb('0x21')](function(){_0x173016[_0x66bb('0x19')](0xcc)[_0x66bb('0x24')]();});}};}function handleEntityNotFound(_0x4c8fdd,_0x14d129){return function(_0x2d92d8){if(!_0x2d92d8){_0x4c8fdd[_0x66bb('0x18')](0x194);}return _0x2d92d8;};}function handleError(_0x4371c6,_0x31e08c){_0x31e08c=_0x31e08c||0x1f4;return function(_0x193c12){logger[_0x66bb('0x25')](_0x193c12[_0x66bb('0x26')]);if(_0x193c12['name']){delete _0x193c12[_0x66bb('0x27')];}_0x4371c6['status'](_0x31e08c)[_0x66bb('0x28')](_0x193c12);};}exports[_0x66bb('0x29')]=function(_0x18b9bd,_0x10d7a6){var _0x5e6a7c={},_0x49632e={},_0x12c344={'count':0x0,'rows':[]};var _0x40369a=_[_0x66bb('0x2a')](db[_0x66bb('0x2b')]['rawAttributes'],function(_0x36ca5c){return{'name':_0x36ca5c['fieldName'],'type':_0x36ca5c[_0x66bb('0x2c')]['key']};});_0x49632e[_0x66bb('0x2d')]=_[_0x66bb('0x2a')](_0x40369a,'name');_0x49632e['query']=_['keys'](_0x18b9bd[_0x66bb('0x2e')]);_0x49632e[_0x66bb('0x2f')]=_[_0x66bb('0x30')](_0x49632e['model'],_0x49632e[_0x66bb('0x2e')]);_0x5e6a7c[_0x66bb('0x31')]=_[_0x66bb('0x30')](_0x49632e[_0x66bb('0x2d')],qs[_0x66bb('0x32')](_0x18b9bd[_0x66bb('0x2e')][_0x66bb('0x32')]));_0x5e6a7c[_0x66bb('0x31')]=_0x5e6a7c[_0x66bb('0x31')]['length']?_0x5e6a7c['attributes']:_0x49632e['model'];if(!_0x18b9bd[_0x66bb('0x2e')][_0x66bb('0x33')]('nolimit')){_0x5e6a7c[_0x66bb('0x1c')]=qs[_0x66bb('0x1c')](_0x18b9bd[_0x66bb('0x2e')][_0x66bb('0x1c')]);_0x5e6a7c[_0x66bb('0x1b')]=qs['offset'](_0x18b9bd[_0x66bb('0x2e')][_0x66bb('0x1b')]);}_0x5e6a7c[_0x66bb('0x34')]=qs['sort'](_0x18b9bd[_0x66bb('0x2e')][_0x66bb('0x35')]);_0x5e6a7c['where']=qs[_0x66bb('0x2f')](_[_0x66bb('0x36')](_0x18b9bd[_0x66bb('0x2e')],_0x49632e['filters']),_0x40369a);if(_0x18b9bd['query'][_0x66bb('0x37')]){_0x5e6a7c[_0x66bb('0x38')]=_['merge'](_0x5e6a7c['where'],{'$or':_['map'](_0x40369a,function(_0x1dbadd){if(_0x1dbadd[_0x66bb('0x2c')]!==_0x66bb('0x39')){var _0x16dd1e={};_0x16dd1e[_0x1dbadd['name']]={'$like':'%'+_0x18b9bd[_0x66bb('0x2e')][_0x66bb('0x37')]+'%'};return _0x16dd1e;}})});}_0x5e6a7c=_[_0x66bb('0x3a')]({},_0x5e6a7c,_0x18b9bd[_0x66bb('0x3b')]);var _0x42929d={'where':_0x5e6a7c['where']};return db[_0x66bb('0x2b')][_0x66bb('0x3c')](_0x42929d)[_0x66bb('0x21')](function(_0x402441){_0x12c344[_0x66bb('0x3c')]=_0x402441;if(_0x18b9bd[_0x66bb('0x2e')][_0x66bb('0x3d')]){_0x5e6a7c['include']=[{'all':!![]}];}return db['UserMailInteraction'][_0x66bb('0x3e')](_0x5e6a7c);})[_0x66bb('0x21')](function(_0x2d4803){_0x12c344['rows']=_0x2d4803;return _0x12c344;})['then'](respondWithFilteredResult(_0x10d7a6,_0x5e6a7c))[_0x66bb('0x3f')](handleError(_0x10d7a6,null));};exports[_0x66bb('0x40')]=function(_0x484096,_0x37bc99){var _0xcb097a={'raw':!![],'where':{'id':_0x484096[_0x66bb('0x41')]['id']}},_0x80442b={};_0x80442b['model']=_[_0x66bb('0x42')](db[_0x66bb('0x2b')]['rawAttributes']);_0x80442b[_0x66bb('0x2e')]=_['keys'](_0x484096[_0x66bb('0x2e')]);_0x80442b['filters']=_[_0x66bb('0x30')](_0x80442b[_0x66bb('0x2d')],_0x80442b[_0x66bb('0x2e')]);_0xcb097a[_0x66bb('0x31')]=_[_0x66bb('0x30')](_0x80442b[_0x66bb('0x2d')],qs[_0x66bb('0x32')](_0x484096[_0x66bb('0x2e')][_0x66bb('0x32')]));_0xcb097a[_0x66bb('0x31')]=_0xcb097a[_0x66bb('0x31')][_0x66bb('0x43')]?_0xcb097a[_0x66bb('0x31')]:_0x80442b[_0x66bb('0x2d')];if(_0x484096[_0x66bb('0x2e')][_0x66bb('0x3d')]){_0xcb097a[_0x66bb('0x44')]=[{'all':!![]}];}_0xcb097a=_[_0x66bb('0x3a')]({},_0xcb097a,_0x484096[_0x66bb('0x3b')]);return db[_0x66bb('0x2b')][_0x66bb('0x45')](_0xcb097a)[_0x66bb('0x21')](handleEntityNotFound(_0x37bc99,null))[_0x66bb('0x21')](respondWithResult(_0x37bc99,null))[_0x66bb('0x3f')](handleError(_0x37bc99,null));};exports[_0x66bb('0x46')]=function(_0x59e445,_0xe12512){return db[_0x66bb('0x2b')][_0x66bb('0x46')](_0x59e445[_0x66bb('0x47')],{})[_0x66bb('0x21')](function(_0x5eda2c){var _0x545de3=_0x59e445[_0x66bb('0x48')][_0x66bb('0x23')]({'plain':!![]});if(!_0x545de3)throw new Error(_0x66bb('0x49'));if(_0x545de3[_0x66bb('0x4a')]===_0x66bb('0x48')){var _0x117881=_0x5eda2c['get']({'plain':!![]});var _0x5237f1=_0x66bb('0x4b');return db[_0x66bb('0x4c')][_0x66bb('0x45')]({'where':{'name':_0x5237f1,'userProfileId':_0x545de3['userProfileId']},'raw':!![]})[_0x66bb('0x21')](function(_0x31a21d){if(_0x31a21d&&_0x31a21d[_0x66bb('0x4d')]===0x0){return db['UserProfileResource'][_0x66bb('0x46')]({'name':_0x117881[_0x66bb('0x27')],'resourceId':_0x117881['id'],'type':_0x31a21d[_0x66bb('0x27')],'sectionId':_0x31a21d['id']},{})[_0x66bb('0x21')](function(){return _0x5eda2c;});}else{return _0x5eda2c;}})[_0x66bb('0x3f')](function(_0x343990){logger[_0x66bb('0x25')](_0x66bb('0x4e'),_0x343990);throw _0x343990;});}return _0x5eda2c;})[_0x66bb('0x21')](respondWithResult(_0xe12512,0xc9))[_0x66bb('0x3f')](handleError(_0xe12512,null));};exports[_0x66bb('0x20')]=function(_0x38d3f2,_0x2b2ca3){if(_0x38d3f2[_0x66bb('0x47')]['id']){delete _0x38d3f2[_0x66bb('0x47')]['id'];}return db['UserMailInteraction'][_0x66bb('0x45')]({'where':{'id':_0x38d3f2[_0x66bb('0x41')]['id']}})[_0x66bb('0x21')](handleEntityNotFound(_0x2b2ca3,null))[_0x66bb('0x21')](saveUpdates(_0x38d3f2[_0x66bb('0x47')],null))['then'](respondWithResult(_0x2b2ca3,null))['catch'](handleError(_0x2b2ca3,null));};exports[_0x66bb('0x22')]=function(_0x1c19b1,_0x459d4e){return db[_0x66bb('0x2b')]['find']({'where':{'id':_0x1c19b1[_0x66bb('0x41')]['id']}})[_0x66bb('0x21')](handleEntityNotFound(_0x459d4e,null))[_0x66bb('0x21')](removeEntity(_0x459d4e,null))['catch'](handleError(_0x459d4e,null));}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.model.js b/server/api/UserMailInteraction/UserMailInteraction.model.js index 4e09b71..b27cce0 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 _0x4dfc=['define','user_has_mail_interactions','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5e6226,_0x452265){var _0x58b6a5=function(_0x2fd5e3){while(--_0x2fd5e3){_0x5e6226['push'](_0x5e6226['shift']());}};_0x58b6a5(++_0x452265);}(_0x4dfc,0xda));var _0xc4df=function(_0x28f153,_0x4852ed){_0x28f153=_0x28f153-0x0;var _0x56b861=_0x4dfc[_0x28f153];return _0x56b861;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc4df('0x0'));var moment=require(_0xc4df('0x1'));var BPromise=require(_0xc4df('0x2'));var rp=require(_0xc4df('0x3'));var fs=require('fs');var path=require(_0xc4df('0x4'));var rimraf=require(_0xc4df('0x5'));var config=require(_0xc4df('0x6'));var attributes=require('./UserMailInteraction.attributes');module['exports']=function(_0x5814de,_0x27d2b2){return _0x5814de[_0xc4df('0x7')]('UserMailInteraction',attributes,{'tableName':_0xc4df('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe99c=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','./UserMailInteraction.attributes','define','UserMailInteraction','user_has_mail_interactions'];(function(_0x198609,_0x204fa7){var _0x33feea=function(_0x9b8ee0){while(--_0x9b8ee0){_0x198609['push'](_0x198609['shift']());}};_0x33feea(++_0x204fa7);}(_0xe99c,0x197));var _0xce99=function(_0x762382,_0x5c229d){_0x762382=_0x762382-0x0;var _0x5a8c45=_0xe99c[_0x762382];return _0x5a8c45;};'use strict';var _=require(_0xce99('0x0'));var util=require('util');var logger=require(_0xce99('0x1'))(_0xce99('0x2'));var moment=require(_0xce99('0x3'));var BPromise=require(_0xce99('0x4'));var rp=require(_0xce99('0x5'));var fs=require('fs');var path=require(_0xce99('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xce99('0x7'));module['exports']=function(_0x32fc7e,_0x58e2aa){return _0x32fc7e[_0xce99('0x8')](_0xce99('0x9'),attributes,{'tableName':_0xce99('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.rpc.js b/server/api/UserMailInteraction/UserMailInteraction.rpc.js index 1cc2e27..fee8372 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 _0x91e7=['then','info','request\x20sent','debug','UserMailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','UserMailInteraction,\x20%s,\x20%s','message','result','catch','lodash','moment','ioredis','../../config/utils','client','http','request'];(function(_0x29db36,_0x410ae9){var _0x234e87=function(_0x48697b){while(--_0x48697b){_0x29db36['push'](_0x29db36['shift']());}};_0x234e87(++_0x410ae9);}(_0x91e7,0xf0));var _0x791e=function(_0x20fdc1,_0xde1296){_0x20fdc1=_0x20fdc1-0x0;var _0x25397c=_0x91e7[_0x20fdc1];return _0x25397c;};'use strict';var _=require(_0x791e('0x0'));var util=require('util');var moment=require(_0x791e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x791e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x791e('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x791e('0x4')][_0x791e('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x2e4136,_0x10d070,_0x4da38a){return new BPromise(function(_0xb3dd0a,_0x3d2e72){return client[_0x791e('0x6')](_0x2e4136,_0x4da38a)[_0x791e('0x7')](function(_0x2a6703){logger[_0x791e('0x8')]('UserMailInteraction,\x20%s,\x20%s',_0x10d070,_0x791e('0x9'));logger[_0x791e('0xa')](_0x791e('0xb'),_0x10d070,_0x791e('0x9'),JSON[_0x791e('0xc')](_0x2a6703));if(_0x2a6703['error']){if(_0x2a6703[_0x791e('0xd')][_0x791e('0xe')]===0x1f4){logger['error'](_0x791e('0xf'),_0x10d070,_0x2a6703[_0x791e('0xd')]['message']);return _0x3d2e72(_0x2a6703[_0x791e('0xd')][_0x791e('0x10')]);}logger[_0x791e('0xd')](_0x791e('0xf'),_0x10d070,_0x2a6703[_0x791e('0xd')][_0x791e('0x10')]);return _0xb3dd0a(_0x2a6703[_0x791e('0xd')][_0x791e('0x10')]);}else{logger['info']('UserMailInteraction,\x20%s,\x20%s',_0x10d070,_0x791e('0x9'));_0xb3dd0a(_0x2a6703[_0x791e('0x11')][_0x791e('0x10')]);}})[_0x791e('0x12')](function(_0x316552){logger[_0x791e('0xd')](_0x791e('0xf'),_0x10d070,_0x316552);_0x3d2e72(_0x316552);});});} \ No newline at end of file +var _0xb92a=['jayson/promise','client','http','then','info','UserMailInteraction,\x20%s,\x20%s','request\x20sent','debug','UserMailInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x4733e4,_0x44a73a){var _0xf3de1=function(_0x5b204e){while(--_0x5b204e){_0x4733e4['push'](_0x4733e4['shift']());}};_0xf3de1(++_0x44a73a);}(_0xb92a,0x76));var _0xab92=function(_0x4c70d7,_0x43c5d6){_0x4c70d7=_0x4c70d7-0x0;var _0x31641f=_0xb92a[_0x4c70d7];return _0x31641f;};'use strict';var _=require(_0xab92('0x0'));var util=require(_0xab92('0x1'));var moment=require(_0xab92('0x2'));var BPromise=require(_0xab92('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab92('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xab92('0x5'));var logger=require(_0xab92('0x6'))(_0xab92('0x7'));var config=require('../../config/environment');var jayson=require(_0xab92('0x8'));var client=jayson[_0xab92('0x9')][_0xab92('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58448e,_0x1f2811,_0x3d1f60){return new BPromise(function(_0x3e81a9,_0x4cc2b5){return client['request'](_0x58448e,_0x3d1f60)[_0xab92('0xb')](function(_0x49f93d){logger[_0xab92('0xc')](_0xab92('0xd'),_0x1f2811,_0xab92('0xe'));logger[_0xab92('0xf')](_0xab92('0x10'),_0x1f2811,'request\x20sent',JSON['stringify'](_0x49f93d));if(_0x49f93d[_0xab92('0x11')]){if(_0x49f93d[_0xab92('0x11')]['code']===0x1f4){logger[_0xab92('0x11')](_0xab92('0xd'),_0x1f2811,_0x49f93d[_0xab92('0x11')][_0xab92('0x12')]);return _0x4cc2b5(_0x49f93d[_0xab92('0x11')][_0xab92('0x12')]);}logger[_0xab92('0x11')]('UserMailInteraction,\x20%s,\x20%s',_0x1f2811,_0x49f93d[_0xab92('0x11')][_0xab92('0x12')]);return _0x3e81a9(_0x49f93d[_0xab92('0x11')]['message']);}else{logger['info'](_0xab92('0xd'),_0x1f2811,_0xab92('0xe'));_0x3e81a9(_0x49f93d[_0xab92('0x13')][_0xab92('0x12')]);}})[_0xab92('0x14')](function(_0x2de2d4){logger[_0xab92('0x11')](_0xab92('0xd'),_0x1f2811,_0x2de2d4);_0x4cc2b5(_0x2de2d4);});});} \ No newline at end of file diff --git a/server/api/UserMailInteraction/index.js b/server/api/UserMailInteraction/index.js index 8701674..8c3790e 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 _0x524e=['/:id','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserMailInteraction.controller','get','isAuthenticated'];(function(_0xed1f11,_0x3c467c){var _0x59c722=function(_0x54c3cc){while(--_0x54c3cc){_0xed1f11['push'](_0xed1f11['shift']());}};_0x59c722(++_0x3c467c);}(_0x524e,0x15e));var _0xe524=function(_0x3a5a92,_0x45f630){_0x3a5a92=_0x3a5a92-0x0;var _0x2cad45=_0x524e[_0x3a5a92];return _0x2cad45;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var auth=require(_0xe524('0x4'));var interaction=require(_0xe524('0x5'));var config=require(_0xe524('0x6'));var controller=require(_0xe524('0x7'));router[_0xe524('0x8')]('/',auth[_0xe524('0x9')](),controller['index']);router[_0xe524('0x8')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller['show']);router[_0xe524('0xb')]('/',auth[_0xe524('0x9')](),controller[_0xe524('0xc')]);router[_0xe524('0xd')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller[_0xe524('0xe')]);router[_0xe524('0xf')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller[_0xe524('0x10')]);module[_0xe524('0x11')]=router; \ No newline at end of file +var _0x5496=['util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./UserMailInteraction.controller','get','/:id','show','post','isAuthenticated','put','update','delete','exports','multer'];(function(_0x4cf8dd,_0x55ea64){var _0x3427af=function(_0x91115e){while(--_0x91115e){_0x4cf8dd['push'](_0x4cf8dd['shift']());}};_0x3427af(++_0x55ea64);}(_0x5496,0x175));var _0x6549=function(_0x214443,_0xba5dbe){_0x214443=_0x214443-0x0;var _0x444085=_0x5496[_0x214443];return _0x444085;};'use strict';var multer=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var path=require(_0x6549('0x2'));var timeout=require(_0x6549('0x3'));var express=require(_0x6549('0x4'));var router=express['Router']();var auth=require(_0x6549('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6549('0x6'));var controller=require(_0x6549('0x7'));router[_0x6549('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6549('0x8')](_0x6549('0x9'),auth['isAuthenticated'](),controller[_0x6549('0xa')]);router[_0x6549('0xb')]('/',auth[_0x6549('0xc')](),controller['create']);router[_0x6549('0xd')](_0x6549('0x9'),auth[_0x6549('0xc')](),controller[_0x6549('0xe')]);router[_0x6549('0xf')](_0x6549('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x6549('0x10')]=router; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.attributes.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.attributes.js index 8be2d75..a01324a 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 _0xc034=['sequelize','exports','INTEGER'];(function(_0x215dc8,_0x52c245){var _0x583ea3=function(_0x32350d){while(--_0x32350d){_0x215dc8['push'](_0x215dc8['shift']());}};_0x583ea3(++_0x52c245);}(_0xc034,0x1d7));var _0x4c03=function(_0x4daee8,_0x4a13d3){_0x4daee8=_0x4daee8-0x0;var _0x53be12=_0xc034[_0x4daee8];return _0x53be12;};'use strict';var Sequelize=require(_0x4c03('0x0'));module[_0x4c03('0x1')]={'OpenchannelInteractionId':{'type':Sequelize[_0x4c03('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize['INTEGER'],'primaryKey':!![]}}; \ No newline at end of file +var _0x1599=['exports','INTEGER','sequelize'];(function(_0x263971,_0x1f3a81){var _0x31f758=function(_0x1326e6){while(--_0x1326e6){_0x263971['push'](_0x263971['shift']());}};_0x31f758(++_0x1f3a81);}(_0x1599,0xaa));var _0x9159=function(_0x1a1f66,_0x3e2948){_0x1a1f66=_0x1a1f66-0x0;var _0x458ef4=_0x1599[_0x1a1f66];return _0x458ef4;};'use strict';var Sequelize=require(_0x9159('0x0'));module[_0x9159('0x1')]={'OpenchannelInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x9159('0x2')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.controller.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.controller.js index 4d87bcc..82ed0d9 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 _0xa94d=['destroy','UserOpenchannelInteraction','UserProfileResource','end','send','map','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','count','limit','set','json','apply','save','update','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa94d,0x80));var _0xda94=function(_0x54dfd9,_0x1fb870){_0x54dfd9=_0x54dfd9-0x0;var _0x48987e=_0xa94d[_0x54dfd9];return _0x48987e;};'use strict';var pdf=require(_0xda94('0x0'));var emlformat=require(_0xda94('0x1'));var rimraf=require(_0xda94('0x2'));var zipdir=require(_0xda94('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xda94('0x4'));var moment=require('moment');var BPromise=require(_0xda94('0x5'));var Mustache=require(_0xda94('0x6'));var util=require(_0xda94('0x7'));var path=require('path');var sox=require(_0xda94('0x8'));var csv=require('to-csv');var ejs=require(_0xda94('0x9'));var fs=require('fs');var _=require(_0xda94('0xa'));var squel=require(_0xda94('0xb'));var crypto=require(_0xda94('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xda94('0xd'));var toCsv=require(_0xda94('0xe'));var querystring=require(_0xda94('0xf'));var Papa=require('papaparse');var Redis=require(_0xda94('0x10'));var authService=require(_0xda94('0x11'));var qs=require(_0xda94('0x12'));var as=require(_0xda94('0x13'));var hardwareService=require(_0xda94('0x14'));var logger=require(_0xda94('0x15'))('api');var utils=require(_0xda94('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xda94('0x17'))['db'];function respondWithStatusCode(_0x192f3d,_0x175143){_0x175143=_0x175143||0xcc;return function(_0x3e117f){if(_0x3e117f){return _0x192f3d[_0xda94('0x18')](_0x175143);}return _0x192f3d[_0xda94('0x19')](_0x175143)['end']();};}function respondWithResult(_0x374913,_0x59a175){_0x59a175=_0x59a175||0xc8;return function(_0x5523dc){if(_0x5523dc){return _0x374913[_0xda94('0x19')](_0x59a175)['json'](_0x5523dc);}};}function respondWithFilteredResult(_0x250631,_0x1e9cab){return function(_0x373196){if(_0x373196){var _0x30b80f=_0x373196[_0xda94('0x1a')],_0x5adb63=_0x1e9cab['offset'],_0x5d6190=_0x1e9cab['offset']+_0x1e9cab[_0xda94('0x1b')],_0x290f94;if(_0x5d6190>=_0x30b80f){_0x5d6190=_0x30b80f;_0x290f94=0xc8;}else{_0x290f94=0xce;}_0x250631['status'](_0x290f94);return _0x250631[_0xda94('0x1c')]('Content-Range',_0x5adb63+'-'+_0x5d6190+'/'+_0x30b80f)[_0xda94('0x1d')](_0x373196);}return null;};}function patchUpdates(_0x258371){return function(_0x4775e1){try{jsonpatch[_0xda94('0x1e')](_0x4775e1,_0x258371,!![]);}catch(_0x3374a9){return BPromise['reject'](_0x3374a9);}return _0x4775e1[_0xda94('0x1f')]();};}function saveUpdates(_0x39d05e,_0x4e8ee8){return function(_0x49bd6c){if(_0x49bd6c){return _0x49bd6c[_0xda94('0x20')](_0x39d05e)[_0xda94('0x21')](function(_0x285914){return _0x285914;});}return null;};}function removeEntity(_0x30369c,_0x3517a5){return function(_0x54fb08){if(_0x54fb08){return _0x54fb08[_0xda94('0x22')]()[_0xda94('0x21')](function(){var _0x38ddfe=_0x54fb08['get']({'plain':!![]});var _0x499805=_0xda94('0x23');return db[_0xda94('0x24')][_0xda94('0x22')]({'where':{'type':_0x499805,'resourceId':_0x38ddfe['id']}})[_0xda94('0x21')](function(){return _0x54fb08;});})[_0xda94('0x21')](function(){_0x30369c[_0xda94('0x19')](0xcc)[_0xda94('0x25')]();});}};}function handleEntityNotFound(_0x55406a,_0x42cb8d){return function(_0x9b4c20){if(!_0x9b4c20){_0x55406a[_0xda94('0x18')](0x194);}return _0x9b4c20;};}function handleError(_0x1be033,_0x3927db){_0x3927db=_0x3927db||0x1f4;return function(_0x3979de){logger['error'](_0x3979de['stack']);if(_0x3979de['name']){delete _0x3979de['name'];}_0x1be033[_0xda94('0x19')](_0x3927db)[_0xda94('0x26')](_0x3979de);};}exports['index']=function(_0x4f5618,_0x403e3b){var _0x4f8468={},_0x601dd2={},_0x241bdf={'count':0x0,'rows':[]};var _0x2846ed=_[_0xda94('0x27')](db[_0xda94('0x23')]['rawAttributes'],function(_0x395220){return{'name':_0x395220[_0xda94('0x28')],'type':_0x395220[_0xda94('0x29')][_0xda94('0x2a')]};});_0x601dd2[_0xda94('0x2b')]=_[_0xda94('0x27')](_0x2846ed,_0xda94('0x2c'));_0x601dd2['query']=_['keys'](_0x4f5618[_0xda94('0x2d')]);_0x601dd2[_0xda94('0x2e')]=_[_0xda94('0x2f')](_0x601dd2['model'],_0x601dd2[_0xda94('0x2d')]);_0x4f8468[_0xda94('0x30')]=_['intersection'](_0x601dd2[_0xda94('0x2b')],qs['fields'](_0x4f5618['query'][_0xda94('0x31')]));_0x4f8468[_0xda94('0x30')]=_0x4f8468['attributes'][_0xda94('0x32')]?_0x4f8468[_0xda94('0x30')]:_0x601dd2[_0xda94('0x2b')];if(!_0x4f5618[_0xda94('0x2d')][_0xda94('0x33')](_0xda94('0x34'))){_0x4f8468[_0xda94('0x1b')]=qs[_0xda94('0x1b')](_0x4f5618['query'][_0xda94('0x1b')]);_0x4f8468[_0xda94('0x35')]=qs['offset'](_0x4f5618[_0xda94('0x2d')][_0xda94('0x35')]);}_0x4f8468[_0xda94('0x36')]=qs['sort'](_0x4f5618[_0xda94('0x2d')][_0xda94('0x37')]);_0x4f8468[_0xda94('0x38')]=qs[_0xda94('0x2e')](_[_0xda94('0x39')](_0x4f5618[_0xda94('0x2d')],_0x601dd2[_0xda94('0x2e')]),_0x2846ed);if(_0x4f5618[_0xda94('0x2d')][_0xda94('0x3a')]){_0x4f8468[_0xda94('0x38')]=_[_0xda94('0x3b')](_0x4f8468[_0xda94('0x38')],{'$or':_[_0xda94('0x27')](_0x2846ed,function(_0x49d5ba){if(_0x49d5ba[_0xda94('0x29')]!==_0xda94('0x3c')){var _0x3b4ed4={};_0x3b4ed4[_0x49d5ba[_0xda94('0x2c')]]={'$like':'%'+_0x4f5618[_0xda94('0x2d')]['filter']+'%'};return _0x3b4ed4;}})});}_0x4f8468=_[_0xda94('0x3b')]({},_0x4f8468,_0x4f5618[_0xda94('0x3d')]);var _0x374817={'where':_0x4f8468[_0xda94('0x38')]};return db[_0xda94('0x23')][_0xda94('0x1a')](_0x374817)[_0xda94('0x21')](function(_0x54d652){_0x241bdf['count']=_0x54d652;if(_0x4f5618[_0xda94('0x2d')][_0xda94('0x3e')]){_0x4f8468[_0xda94('0x3f')]=[{'all':!![]}];}return db[_0xda94('0x23')][_0xda94('0x40')](_0x4f8468);})[_0xda94('0x21')](function(_0x11b53e){_0x241bdf[_0xda94('0x41')]=_0x11b53e;return _0x241bdf;})['then'](respondWithFilteredResult(_0x403e3b,_0x4f8468))[_0xda94('0x42')](handleError(_0x403e3b,null));};exports[_0xda94('0x43')]=function(_0x35b203,_0x5b9cc0){var _0x550e5c={'raw':!![],'where':{'id':_0x35b203[_0xda94('0x44')]['id']}},_0x393e0d={};_0x393e0d[_0xda94('0x2b')]=_[_0xda94('0x45')](db[_0xda94('0x23')][_0xda94('0x46')]);_0x393e0d[_0xda94('0x2d')]=_['keys'](_0x35b203['query']);_0x393e0d[_0xda94('0x2e')]=_['intersection'](_0x393e0d[_0xda94('0x2b')],_0x393e0d[_0xda94('0x2d')]);_0x550e5c[_0xda94('0x30')]=_[_0xda94('0x2f')](_0x393e0d[_0xda94('0x2b')],qs['fields'](_0x35b203[_0xda94('0x2d')][_0xda94('0x31')]));_0x550e5c[_0xda94('0x30')]=_0x550e5c['attributes'][_0xda94('0x32')]?_0x550e5c[_0xda94('0x30')]:_0x393e0d[_0xda94('0x2b')];if(_0x35b203[_0xda94('0x2d')][_0xda94('0x3e')]){_0x550e5c[_0xda94('0x3f')]=[{'all':!![]}];}_0x550e5c=_['merge']({},_0x550e5c,_0x35b203[_0xda94('0x3d')]);return db[_0xda94('0x23')][_0xda94('0x47')](_0x550e5c)[_0xda94('0x21')](handleEntityNotFound(_0x5b9cc0,null))[_0xda94('0x21')](respondWithResult(_0x5b9cc0,null))[_0xda94('0x42')](handleError(_0x5b9cc0,null));};exports[_0xda94('0x48')]=function(_0x6e6aaf,_0x69fe43){return db[_0xda94('0x23')]['create'](_0x6e6aaf[_0xda94('0x49')],{})[_0xda94('0x21')](function(_0x1a682a){var _0x5cca36=_0x6e6aaf[_0xda94('0x4a')][_0xda94('0x4b')]({'plain':!![]});if(!_0x5cca36)throw new Error(_0xda94('0x4c'));if(_0x5cca36[_0xda94('0x4d')]===_0xda94('0x4a')){var _0x480776=_0x1a682a['get']({'plain':!![]});var _0x3d45e0=_0xda94('0x23');return db[_0xda94('0x4e')][_0xda94('0x47')]({'where':{'name':_0x3d45e0,'userProfileId':_0x5cca36[_0xda94('0x4f')]},'raw':!![]})['then'](function(_0x1ccca8){if(_0x1ccca8&&_0x1ccca8[_0xda94('0x50')]===0x0){return db[_0xda94('0x24')][_0xda94('0x48')]({'name':_0x480776[_0xda94('0x2c')],'resourceId':_0x480776['id'],'type':_0x1ccca8[_0xda94('0x2c')],'sectionId':_0x1ccca8['id']},{})[_0xda94('0x21')](function(){return _0x1a682a;});}else{return _0x1a682a;}})[_0xda94('0x42')](function(_0x37e0dd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37e0dd);throw _0x37e0dd;});}return _0x1a682a;})[_0xda94('0x21')](respondWithResult(_0x69fe43,0xc9))[_0xda94('0x42')](handleError(_0x69fe43,null));};exports[_0xda94('0x20')]=function(_0x124acc,_0x9412b1){if(_0x124acc[_0xda94('0x49')]['id']){delete _0x124acc['body']['id'];}return db[_0xda94('0x23')][_0xda94('0x47')]({'where':{'id':_0x124acc[_0xda94('0x44')]['id']}})[_0xda94('0x21')](handleEntityNotFound(_0x9412b1,null))['then'](saveUpdates(_0x124acc[_0xda94('0x49')],null))[_0xda94('0x21')](respondWithResult(_0x9412b1,null))['catch'](handleError(_0x9412b1,null));};exports[_0xda94('0x22')]=function(_0x47e24e,_0x2eb9ef){return db[_0xda94('0x23')][_0xda94('0x47')]({'where':{'id':_0x47e24e[_0xda94('0x44')]['id']}})[_0xda94('0x21')](handleEntityNotFound(_0x2eb9ef,null))[_0xda94('0x21')](removeEntity(_0x2eb9ef,null))[_0xda94('0x42')](handleError(_0x2eb9ef,null));}; \ No newline at end of file +var _0xa9be=['mustache','util','path','sox','to-csv','ejs','squel','crypto','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','Content-Range','apply','update','then','destroy','get','error','stack','name','send','index','UserOpenchannelInteraction','fieldName','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','params','rawAttributes','include','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','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x4ee10a,_0x34b5c6){var _0x448a7b=function(_0x10cb46){while(--_0x10cb46){_0x4ee10a['push'](_0x4ee10a['shift']());}};_0x448a7b(++_0x34b5c6);}(_0xa9be,0x1eb));var _0xea9b=function(_0x533185,_0x4c152e){_0x533185=_0x533185-0x0;var _0x129212=_0xa9be[_0x533185];return _0x129212;};'use strict';var pdf=require(_0xea9b('0x0'));var emlformat=require(_0xea9b('0x1'));var rimraf=require(_0xea9b('0x2'));var zipdir=require(_0xea9b('0x3'));var jsonpatch=require(_0xea9b('0x4'));var rp=require(_0xea9b('0x5'));var moment=require('moment');var BPromise=require(_0xea9b('0x6'));var Mustache=require(_0xea9b('0x7'));var util=require(_0xea9b('0x8'));var path=require(_0xea9b('0x9'));var sox=require(_0xea9b('0xa'));var csv=require(_0xea9b('0xb'));var ejs=require(_0xea9b('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xea9b('0xd'));var crypto=require(_0xea9b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xea9b('0xf'));var toCsv=require('to-csv');var querystring=require(_0xea9b('0x10'));var Papa=require(_0xea9b('0x11'));var Redis=require(_0xea9b('0x12'));var authService=require(_0xea9b('0x13'));var qs=require(_0xea9b('0x14'));var as=require(_0xea9b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea9b('0x16'))('api');var utils=require(_0xea9b('0x17'));var config=require(_0xea9b('0x18'));var licenseUtil=require(_0xea9b('0x19'));var db=require(_0xea9b('0x1a'))['db'];function respondWithStatusCode(_0x3232b3,_0xd14299){_0xd14299=_0xd14299||0xcc;return function(_0x59b647){if(_0x59b647){return _0x3232b3[_0xea9b('0x1b')](_0xd14299);}return _0x3232b3[_0xea9b('0x1c')](_0xd14299)[_0xea9b('0x1d')]();};}function respondWithResult(_0x204e86,_0x1d0243){_0x1d0243=_0x1d0243||0xc8;return function(_0x372c5f){if(_0x372c5f){return _0x204e86['status'](_0x1d0243)[_0xea9b('0x1e')](_0x372c5f);}};}function respondWithFilteredResult(_0x3f93c6,_0x3dbfd7){return function(_0x5abe38){if(_0x5abe38){var _0x2a720a=_0x5abe38[_0xea9b('0x1f')],_0x109177=_0x3dbfd7[_0xea9b('0x20')],_0x1cf0d9=_0x3dbfd7[_0xea9b('0x20')]+_0x3dbfd7[_0xea9b('0x21')],_0x1c2dd8;if(_0x1cf0d9>=_0x2a720a){_0x1cf0d9=_0x2a720a;_0x1c2dd8=0xc8;}else{_0x1c2dd8=0xce;}_0x3f93c6['status'](_0x1c2dd8);return _0x3f93c6['set'](_0xea9b('0x22'),_0x109177+'-'+_0x1cf0d9+'/'+_0x2a720a)[_0xea9b('0x1e')](_0x5abe38);}return null;};}function patchUpdates(_0x447c77){return function(_0x3dfa1f){try{jsonpatch[_0xea9b('0x23')](_0x3dfa1f,_0x447c77,!![]);}catch(_0x2f5596){return BPromise['reject'](_0x2f5596);}return _0x3dfa1f['save']();};}function saveUpdates(_0x20f52f,_0x68351e){return function(_0x2ce19e){if(_0x2ce19e){return _0x2ce19e[_0xea9b('0x24')](_0x20f52f)[_0xea9b('0x25')](function(_0x3953bc){return _0x3953bc;});}return null;};}function removeEntity(_0x5c264d,_0x419586){return function(_0x507dee){if(_0x507dee){return _0x507dee[_0xea9b('0x26')]()[_0xea9b('0x25')](function(){var _0x400e12=_0x507dee[_0xea9b('0x27')]({'plain':!![]});var _0x3c4b0b='UserOpenchannelInteraction';return db['UserProfileResource'][_0xea9b('0x26')]({'where':{'type':_0x3c4b0b,'resourceId':_0x400e12['id']}})[_0xea9b('0x25')](function(){return _0x507dee;});})[_0xea9b('0x25')](function(){_0x5c264d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x13d7da,_0x3f6e3a){return function(_0x43f915){if(!_0x43f915){_0x13d7da[_0xea9b('0x1b')](0x194);}return _0x43f915;};}function handleError(_0x1488f0,_0xddfae0){_0xddfae0=_0xddfae0||0x1f4;return function(_0x316b42){logger[_0xea9b('0x28')](_0x316b42[_0xea9b('0x29')]);if(_0x316b42[_0xea9b('0x2a')]){delete _0x316b42[_0xea9b('0x2a')];}_0x1488f0[_0xea9b('0x1c')](_0xddfae0)[_0xea9b('0x2b')](_0x316b42);};}exports[_0xea9b('0x2c')]=function(_0x495482,_0xb4186){var _0x668016={},_0x882a15={},_0x34aee7={'count':0x0,'rows':[]};var _0x5a3528=_['map'](db[_0xea9b('0x2d')]['rawAttributes'],function(_0x47fbbd){return{'name':_0x47fbbd[_0xea9b('0x2e')],'type':_0x47fbbd['type'][_0xea9b('0x2f')]};});_0x882a15['model']=_[_0xea9b('0x30')](_0x5a3528,_0xea9b('0x2a'));_0x882a15[_0xea9b('0x31')]=_[_0xea9b('0x32')](_0x495482[_0xea9b('0x31')]);_0x882a15[_0xea9b('0x33')]=_['intersection'](_0x882a15[_0xea9b('0x34')],_0x882a15[_0xea9b('0x31')]);_0x668016[_0xea9b('0x35')]=_[_0xea9b('0x36')](_0x882a15[_0xea9b('0x34')],qs[_0xea9b('0x37')](_0x495482['query']['fields']));_0x668016[_0xea9b('0x35')]=_0x668016[_0xea9b('0x35')][_0xea9b('0x38')]?_0x668016[_0xea9b('0x35')]:_0x882a15[_0xea9b('0x34')];if(!_0x495482[_0xea9b('0x31')][_0xea9b('0x39')](_0xea9b('0x3a'))){_0x668016['limit']=qs[_0xea9b('0x21')](_0x495482[_0xea9b('0x31')]['limit']);_0x668016[_0xea9b('0x20')]=qs[_0xea9b('0x20')](_0x495482[_0xea9b('0x31')][_0xea9b('0x20')]);}_0x668016[_0xea9b('0x3b')]=qs[_0xea9b('0x3c')](_0x495482[_0xea9b('0x31')][_0xea9b('0x3c')]);_0x668016[_0xea9b('0x3d')]=qs[_0xea9b('0x33')](_['pick'](_0x495482[_0xea9b('0x31')],_0x882a15[_0xea9b('0x33')]),_0x5a3528);if(_0x495482[_0xea9b('0x31')][_0xea9b('0x3e')]){_0x668016[_0xea9b('0x3d')]=_[_0xea9b('0x3f')](_0x668016[_0xea9b('0x3d')],{'$or':_[_0xea9b('0x30')](_0x5a3528,function(_0x32bac7){if(_0x32bac7[_0xea9b('0x40')]!==_0xea9b('0x41')){var _0x229303={};_0x229303[_0x32bac7[_0xea9b('0x2a')]]={'$like':'%'+_0x495482[_0xea9b('0x31')][_0xea9b('0x3e')]+'%'};return _0x229303;}})});}_0x668016=_[_0xea9b('0x3f')]({},_0x668016,_0x495482[_0xea9b('0x42')]);var _0x2fad36={'where':_0x668016['where']};return db['UserOpenchannelInteraction']['count'](_0x2fad36)[_0xea9b('0x25')](function(_0x17a67f){_0x34aee7[_0xea9b('0x1f')]=_0x17a67f;if(_0x495482[_0xea9b('0x31')][_0xea9b('0x43')]){_0x668016['include']=[{'all':!![]}];}return db['UserOpenchannelInteraction'][_0xea9b('0x44')](_0x668016);})['then'](function(_0x5b30cb){_0x34aee7[_0xea9b('0x45')]=_0x5b30cb;return _0x34aee7;})['then'](respondWithFilteredResult(_0xb4186,_0x668016))['catch'](handleError(_0xb4186,null));};exports['show']=function(_0xdeb081,_0x5eb100){var _0xdf1eaf={'raw':!![],'where':{'id':_0xdeb081[_0xea9b('0x46')]['id']}},_0x162e16={};_0x162e16[_0xea9b('0x34')]=_[_0xea9b('0x32')](db[_0xea9b('0x2d')][_0xea9b('0x47')]);_0x162e16[_0xea9b('0x31')]=_[_0xea9b('0x32')](_0xdeb081[_0xea9b('0x31')]);_0x162e16[_0xea9b('0x33')]=_[_0xea9b('0x36')](_0x162e16[_0xea9b('0x34')],_0x162e16[_0xea9b('0x31')]);_0xdf1eaf[_0xea9b('0x35')]=_[_0xea9b('0x36')](_0x162e16['model'],qs[_0xea9b('0x37')](_0xdeb081['query'][_0xea9b('0x37')]));_0xdf1eaf[_0xea9b('0x35')]=_0xdf1eaf[_0xea9b('0x35')][_0xea9b('0x38')]?_0xdf1eaf['attributes']:_0x162e16[_0xea9b('0x34')];if(_0xdeb081['query'][_0xea9b('0x43')]){_0xdf1eaf[_0xea9b('0x48')]=[{'all':!![]}];}_0xdf1eaf=_['merge']({},_0xdf1eaf,_0xdeb081['options']);return db[_0xea9b('0x2d')][_0xea9b('0x49')](_0xdf1eaf)['then'](handleEntityNotFound(_0x5eb100,null))[_0xea9b('0x25')](respondWithResult(_0x5eb100,null))[_0xea9b('0x4a')](handleError(_0x5eb100,null));};exports['create']=function(_0x1ff09d,_0x2ade5d){return db[_0xea9b('0x2d')][_0xea9b('0x4b')](_0x1ff09d[_0xea9b('0x4c')],{})['then'](function(_0x2c0cfc){var _0x2addd9=_0x1ff09d[_0xea9b('0x4d')][_0xea9b('0x27')]({'plain':!![]});if(!_0x2addd9)throw new Error(_0xea9b('0x4e'));if(_0x2addd9[_0xea9b('0x4f')]===_0xea9b('0x4d')){var _0x484cba=_0x2c0cfc[_0xea9b('0x27')]({'plain':!![]});var _0x2accdd=_0xea9b('0x2d');return db[_0xea9b('0x50')][_0xea9b('0x49')]({'where':{'name':_0x2accdd,'userProfileId':_0x2addd9[_0xea9b('0x51')]},'raw':!![]})['then'](function(_0x20dd29){if(_0x20dd29&&_0x20dd29['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x484cba[_0xea9b('0x2a')],'resourceId':_0x484cba['id'],'type':_0x20dd29[_0xea9b('0x2a')],'sectionId':_0x20dd29['id']},{})[_0xea9b('0x25')](function(){return _0x2c0cfc;});}else{return _0x2c0cfc;}})[_0xea9b('0x4a')](function(_0x16055d){logger['error'](_0xea9b('0x52'),_0x16055d);throw _0x16055d;});}return _0x2c0cfc;})[_0xea9b('0x25')](respondWithResult(_0x2ade5d,0xc9))[_0xea9b('0x4a')](handleError(_0x2ade5d,null));};exports[_0xea9b('0x24')]=function(_0x56ad5f,_0x453b08){if(_0x56ad5f[_0xea9b('0x4c')]['id']){delete _0x56ad5f[_0xea9b('0x4c')]['id'];}return db['UserOpenchannelInteraction']['find']({'where':{'id':_0x56ad5f[_0xea9b('0x46')]['id']}})[_0xea9b('0x25')](handleEntityNotFound(_0x453b08,null))[_0xea9b('0x25')](saveUpdates(_0x56ad5f['body'],null))[_0xea9b('0x25')](respondWithResult(_0x453b08,null))[_0xea9b('0x4a')](handleError(_0x453b08,null));};exports[_0xea9b('0x26')]=function(_0x47068b,_0x988bc){return db[_0xea9b('0x2d')]['find']({'where':{'id':_0x47068b[_0xea9b('0x46')]['id']}})[_0xea9b('0x25')](handleEntityNotFound(_0x988bc,null))[_0xea9b('0x25')](removeEntity(_0x988bc,null))['catch'](handleError(_0x988bc,null));}; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js index 4f172ea..43dd229 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 _0x3cd3=['define','UserOpenchannelInteraction','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./UserOpenchannelInteraction.attributes','exports'];(function(_0x1dabb6,_0x1997b8){var _0x3c95e6=function(_0x3f6eb6){while(--_0x3f6eb6){_0x1dabb6['push'](_0x1dabb6['shift']());}};_0x3c95e6(++_0x1997b8);}(_0x3cd3,0x120));var _0x33cd=function(_0x5af4dd,_0x2dfaef){_0x5af4dd=_0x5af4dd-0x0;var _0x5a76b7=_0x3cd3[_0x5af4dd];return _0x5a76b7;};'use strict';var _=require(_0x33cd('0x0'));var util=require(_0x33cd('0x1'));var logger=require(_0x33cd('0x2'))(_0x33cd('0x3'));var moment=require(_0x33cd('0x4'));var BPromise=require('bluebird');var rp=require(_0x33cd('0x5'));var fs=require('fs');var path=require(_0x33cd('0x6'));var rimraf=require(_0x33cd('0x7'));var config=require(_0x33cd('0x8'));var attributes=require(_0x33cd('0x9'));module[_0x33cd('0xa')]=function(_0x18a5ad,_0xb2db4a){return _0x18a5ad[_0x33cd('0xb')](_0x33cd('0xc'),attributes,{'tableName':'user_has_openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a93=['util','../../config/logger','api','moment','bluebird','request-promise','path','./UserOpenchannelInteraction.attributes','exports','define','UserOpenchannelInteraction','lodash'];(function(_0x8e8ca7,_0x5a5e07){var _0x561381=function(_0x2f4bda){while(--_0x2f4bda){_0x8e8ca7['push'](_0x8e8ca7['shift']());}};_0x561381(++_0x5a5e07);}(_0x2a93,0xa7));var _0x32a9=function(_0x2230b3,_0x1590ad){_0x2230b3=_0x2230b3-0x0;var _0x591727=_0x2a93[_0x2230b3];return _0x591727;};'use strict';var _=require(_0x32a9('0x0'));var util=require(_0x32a9('0x1'));var logger=require(_0x32a9('0x2'))(_0x32a9('0x3'));var moment=require(_0x32a9('0x4'));var BPromise=require(_0x32a9('0x5'));var rp=require(_0x32a9('0x6'));var fs=require('fs');var path=require(_0x32a9('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x32a9('0x8'));module[_0x32a9('0x9')]=function(_0x11103c,_0x231746){return _0x11103c[_0x32a9('0xa')](_0x32a9('0xb'),attributes,{'tableName':'user_has_openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.rpc.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.rpc.js index 6e0bab5..fba96f6 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 _0x5946=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','UserOpenchannelInteraction,\x20%s,\x20%s','debug','UserOpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis'];(function(_0x2dbe2e,_0x127139){var _0x2d6400=function(_0x344148){while(--_0x344148){_0x2dbe2e['push'](_0x2dbe2e['shift']());}};_0x2d6400(++_0x127139);}(_0x5946,0x8f));var _0x6594=function(_0x3227c1,_0x4318c5){_0x3227c1=_0x3227c1-0x0;var _0x31fd48=_0x5946[_0x3227c1];return _0x31fd48;};'use strict';var _=require('lodash');var util=require(_0x6594('0x0'));var moment=require('moment');var BPromise=require(_0x6594('0x1'));var rs=require(_0x6594('0x2'));var fs=require('fs');var Redis=require(_0x6594('0x3'));var db=require(_0x6594('0x4'))['db'];var utils=require(_0x6594('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x6594('0x6'));var jayson=require(_0x6594('0x7'));var client=jayson[_0x6594('0x8')][_0x6594('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4aab4a,_0x10ff38,_0x578f64){return new BPromise(function(_0x2e6493,_0x49f15f){return client['request'](_0x4aab4a,_0x578f64)[_0x6594('0xa')](function(_0x35656f){logger[_0x6594('0xb')](_0x6594('0xc'),_0x10ff38,'request\x20sent');logger[_0x6594('0xd')](_0x6594('0xe'),_0x10ff38,_0x6594('0xf'),JSON[_0x6594('0x10')](_0x35656f));if(_0x35656f['error']){if(_0x35656f['error']['code']===0x1f4){logger['error'](_0x6594('0xc'),_0x10ff38,_0x35656f[_0x6594('0x11')][_0x6594('0x12')]);return _0x49f15f(_0x35656f[_0x6594('0x11')][_0x6594('0x12')]);}logger[_0x6594('0x11')](_0x6594('0xc'),_0x10ff38,_0x35656f[_0x6594('0x11')][_0x6594('0x12')]);return _0x2e6493(_0x35656f[_0x6594('0x11')][_0x6594('0x12')]);}else{logger[_0x6594('0xb')](_0x6594('0xc'),_0x10ff38,_0x6594('0xf'));_0x2e6493(_0x35656f[_0x6594('0x13')][_0x6594('0x12')]);}})[_0x6594('0x14')](function(_0x3dc798){logger[_0x6594('0x11')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x10ff38,_0x3dc798);_0x49f15f(_0x3dc798);});});} \ No newline at end of file +var _0x6fb5=['../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelInteraction,\x20%s,\x20%s','debug','UserOpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','ioredis','../../config/logger','rpc'];(function(_0x8bf37a,_0x47ecd9){var _0x4415b6=function(_0x4c9e9c){while(--_0x4c9e9c){_0x8bf37a['push'](_0x8bf37a['shift']());}};_0x4415b6(++_0x47ecd9);}(_0x6fb5,0x10c));var _0x56fb=function(_0x24f1ff,_0x4014c9){_0x24f1ff=_0x24f1ff-0x0;var _0x349109=_0x6fb5[_0x24f1ff];return _0x349109;};'use strict';var _=require(_0x56fb('0x0'));var util=require('util');var moment=require(_0x56fb('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x56fb('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x56fb('0x3'))(_0x56fb('0x4'));var config=require(_0x56fb('0x5'));var jayson=require(_0x56fb('0x6'));var client=jayson[_0x56fb('0x7')][_0x56fb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x216ec1,_0x7c837e,_0x36a42a){return new BPromise(function(_0x54bcfa,_0x623c59){return client[_0x56fb('0x9')](_0x216ec1,_0x36a42a)[_0x56fb('0xa')](function(_0x300340){logger[_0x56fb('0xb')](_0x56fb('0xc'),_0x7c837e,'request\x20sent');logger[_0x56fb('0xd')](_0x56fb('0xe'),_0x7c837e,_0x56fb('0xf'),JSON['stringify'](_0x300340));if(_0x300340[_0x56fb('0x10')]){if(_0x300340[_0x56fb('0x10')][_0x56fb('0x11')]===0x1f4){logger[_0x56fb('0x10')](_0x56fb('0xc'),_0x7c837e,_0x300340[_0x56fb('0x10')][_0x56fb('0x12')]);return _0x623c59(_0x300340[_0x56fb('0x10')][_0x56fb('0x12')]);}logger[_0x56fb('0x10')](_0x56fb('0xc'),_0x7c837e,_0x300340[_0x56fb('0x10')]['message']);return _0x54bcfa(_0x300340[_0x56fb('0x10')][_0x56fb('0x12')]);}else{logger['info']('UserOpenchannelInteraction,\x20%s,\x20%s',_0x7c837e,_0x56fb('0xf'));_0x54bcfa(_0x300340[_0x56fb('0x13')]['message']);}})[_0x56fb('0x14')](function(_0x4e208e){logger[_0x56fb('0x10')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x7c837e,_0x4e208e);_0x623c59(_0x4e208e);});});} \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/index.js b/server/api/UserOpenchannelInteraction/index.js index 62b1080..dd10bf2 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 _0xf367=['destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./UserOpenchannelInteraction.controller','get','isAuthenticated','post','create','put','update','delete','/:id'];(function(_0x45aa18,_0x412fc5){var _0x26119d=function(_0x68dcc6){while(--_0x68dcc6){_0x45aa18['push'](_0x45aa18['shift']());}};_0x26119d(++_0x412fc5);}(_0xf367,0xab));var _0x7f36=function(_0x1aa54c,_0x578a71){_0x1aa54c=_0x1aa54c-0x0;var _0x1c2801=_0xf367[_0x1aa54c];return _0x1c2801;};'use strict';var multer=require(_0x7f36('0x0'));var util=require(_0x7f36('0x1'));var path=require('path');var timeout=require(_0x7f36('0x2'));var express=require(_0x7f36('0x3'));var router=express[_0x7f36('0x4')]();var auth=require(_0x7f36('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7f36('0x6'));var controller=require(_0x7f36('0x7'));router[_0x7f36('0x8')]('/',auth[_0x7f36('0x9')](),controller['index']);router['get']('/:id',auth[_0x7f36('0x9')](),controller['show']);router[_0x7f36('0xa')]('/',auth['isAuthenticated'](),controller[_0x7f36('0xb')]);router[_0x7f36('0xc')]('/:id',auth[_0x7f36('0x9')](),controller[_0x7f36('0xd')]);router[_0x7f36('0xe')](_0x7f36('0xf'),auth['isAuthenticated'](),controller[_0x7f36('0x10')]);module['exports']=router; \ No newline at end of file +var _0xe426=['get','index','/:id','post','isAuthenticated','create','put','delete','multer','util','path','connect-timeout','express','Router','../../config/environment'];(function(_0x12e073,_0x2a6387){var _0x17e67b=function(_0x61b780){while(--_0x61b780){_0x12e073['push'](_0x12e073['shift']());}};_0x17e67b(++_0x2a6387);}(_0xe426,0x1e8));var _0x6e42=function(_0x1e89a0,_0x1ab0c3){_0x1e89a0=_0x1e89a0-0x0;var _0x451162=_0xe426[_0x1e89a0];return _0x451162;};'use strict';var multer=require(_0x6e42('0x0'));var util=require(_0x6e42('0x1'));var path=require(_0x6e42('0x2'));var timeout=require(_0x6e42('0x3'));var express=require(_0x6e42('0x4'));var router=express[_0x6e42('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6e42('0x6'));var controller=require('./UserOpenchannelInteraction.controller');router[_0x6e42('0x7')]('/',auth['isAuthenticated'](),controller[_0x6e42('0x8')]);router[_0x6e42('0x7')](_0x6e42('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x6e42('0xa')]('/',auth[_0x6e42('0xb')](),controller[_0x6e42('0xc')]);router[_0x6e42('0xd')](_0x6e42('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x6e42('0xe')]('/:id',auth[_0x6e42('0xb')](),controller['destroy']);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 e0e0035..e334aae 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 _0xa6a2=['sequelize','exports','INTEGER'];(function(_0x4c369e,_0x1d9e73){var _0xe7a14d=function(_0x2e81d9){while(--_0x2e81d9){_0x4c369e['push'](_0x4c369e['shift']());}};_0xe7a14d(++_0x1d9e73);}(_0xa6a2,0x168));var _0x2a6a=function(_0x4f3e1e,_0x270c16){_0x4f3e1e=_0x4f3e1e-0x0;var _0x3207ad=_0xa6a2[_0x4f3e1e];return _0x3207ad;};'use strict';var Sequelize=require(_0x2a6a('0x0'));module[_0x2a6a('0x1')]={'SmsInteractionId':{'type':Sequelize[_0x2a6a('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x2a6a('0x2')],'primaryKey':!![]}}; \ No newline at end of file +var _0x6610=['exports','INTEGER','sequelize'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x6610,0x1ca));var _0x0661=function(_0x431bfc,_0x2f698c){_0x431bfc=_0x431bfc-0x0;var _0x2b2b1a=_0x6610[_0x431bfc];return _0x2b2b1a;};'use strict';var Sequelize=require(_0x0661('0x0'));module[_0x0661('0x1')]={'SmsInteractionId':{'type':Sequelize[_0x0661('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize['INTEGER'],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.controller.js b/server/api/UserSmsInteraction/UserSmsInteraction.controller.js index 066727b..92c0058 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(_0x32384a,_0x49943f){var _0x294574=function(_0x2e908e){while(--_0x2e908e){_0x32384a['push'](_0x32384a['shift']());}};_0x294574(++_0x49943f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':!![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x47')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x8d6dd1[_0x0a9e('0x48')],{})[_0x0a9e('0x22')](function(_0x45c845){var _0x37be73=_0x8d6dd1[_0x0a9e('0x49')]['get']({'plain':!![]});if(!_0x37be73)throw new Error(_0x0a9e('0x4a'));if(_0x37be73[_0x0a9e('0x4b')]===_0x0a9e('0x49')){var _0x16f976=_0x45c845[_0x0a9e('0x4c')]({'plain':!![]});var _0x992c77=_0x0a9e('0x23');return db[_0x0a9e('0x4d')][_0x0a9e('0x4e')]({'where':{'name':_0x992c77,'userProfileId':_0x37be73['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x3fe430){if(_0x3fe430&&_0x3fe430['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x16f976[_0x0a9e('0x26')],'resourceId':_0x16f976['id'],'type':_0x3fe430[_0x0a9e('0x26')],'sectionId':_0x3fe430['id']},{})[_0x0a9e('0x22')](function(){return _0x45c845;});}else{return _0x45c845;}})[_0x0a9e('0x42')](function(_0x61bb17){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0x61bb17);throw _0x61bb17;});}return _0x45c845;})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))['catch'](handleError(_0x562fb4,null));};exports['update']=function(_0x53975a,_0x39d77d){if(_0x53975a[_0x0a9e('0x48')]['id']){delete _0x53975a[_0x0a9e('0x48')]['id'];}return db['UserSmsInteraction'][_0x0a9e('0x4e')]({'where':{'id':_0x53975a[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x39d77d,null))['then'](saveUpdates(_0x53975a[_0x0a9e('0x48')],null))['then'](respondWithResult(_0x39d77d,null))[_0x0a9e('0x42')](handleError(_0x39d77d,null));};exports['destroy']=function(_0x2e5e62,_0x3c20b2){return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x2e5e62[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3c20b2,null))['then'](removeEntity(_0x3c20b2,null))['catch'](handleError(_0x3c20b2,null));}; \ No newline at end of file +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(_0x10da5e,_0x176c8f){var _0xd50aaa=function(_0x413746){while(--_0x413746){_0x10da5e['push'](_0x10da5e['shift']());}};_0xd50aaa(++_0x176c8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 384edec..013b1da 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 _0x95b7=['path','rimraf','./UserSmsInteraction.attributes','exports','define','UserSmsInteraction','user_has_sms_interactions','lodash','../../config/logger','api','moment','request-promise'];(function(_0x34d1c7,_0x242f5f){var _0x27cb31=function(_0x5c5ee6){while(--_0x5c5ee6){_0x34d1c7['push'](_0x34d1c7['shift']());}};_0x27cb31(++_0x242f5f);}(_0x95b7,0xa3));var _0x795b=function(_0x3401ce,_0x5d1579){_0x3401ce=_0x3401ce-0x0;var _0x1bb79d=_0x95b7[_0x3401ce];return _0x1bb79d;};'use strict';var _=require(_0x795b('0x0'));var util=require('util');var logger=require(_0x795b('0x1'))(_0x795b('0x2'));var moment=require(_0x795b('0x3'));var BPromise=require('bluebird');var rp=require(_0x795b('0x4'));var fs=require('fs');var path=require(_0x795b('0x5'));var rimraf=require(_0x795b('0x6'));var config=require('../../config/environment');var attributes=require(_0x795b('0x7'));module[_0x795b('0x8')]=function(_0x4f2076,_0x530d64){return _0x4f2076[_0x795b('0x9')](_0x795b('0xa'),attributes,{'tableName':_0x795b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x42c7=['path','rimraf','../../config/environment','./UserSmsInteraction.attributes','exports','define','user_has_sms_interactions','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x36d1da,_0xfbde8d){var _0x28efe0=function(_0x1e1b7f){while(--_0x1e1b7f){_0x36d1da['push'](_0x36d1da['shift']());}};_0x28efe0(++_0xfbde8d);}(_0x42c7,0x12d));var _0x742c=function(_0x10bbfc,_0x4e2002){_0x10bbfc=_0x10bbfc-0x0;var _0x268e8d=_0x42c7[_0x10bbfc];return _0x268e8d;};'use strict';var _=require(_0x742c('0x0'));var util=require(_0x742c('0x1'));var logger=require(_0x742c('0x2'))(_0x742c('0x3'));var moment=require(_0x742c('0x4'));var BPromise=require(_0x742c('0x5'));var rp=require(_0x742c('0x6'));var fs=require('fs');var path=require(_0x742c('0x7'));var rimraf=require(_0x742c('0x8'));var config=require(_0x742c('0x9'));var attributes=require(_0x742c('0xa'));module[_0x742c('0xb')]=function(_0x17c30b,_0xb43ddc){return _0x17c30b[_0x742c('0xc')]('UserSmsInteraction',attributes,{'tableName':_0x742c('0xd'),'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 5d1eca3..e1e42ee 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 _0x4475=['../../config/utils','rpc','../../config/environment','client','http','request','then','info','UserSmsInteraction,\x20%s,\x20%s','request\x20sent','debug','UserSmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x148aa9,_0x421ae3){var _0x530a22=function(_0x458499){while(--_0x458499){_0x148aa9['push'](_0x148aa9['shift']());}};_0x530a22(++_0x421ae3);}(_0x4475,0x1f1));var _0x5447=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4475[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x5447('0x0'));var util=require(_0x5447('0x1'));var moment=require(_0x5447('0x2'));var BPromise=require(_0x5447('0x3'));var rs=require(_0x5447('0x4'));var fs=require('fs');var Redis=require(_0x5447('0x5'));var db=require(_0x5447('0x6'))['db'];var utils=require(_0x5447('0x7'));var logger=require('../../config/logger')(_0x5447('0x8'));var config=require(_0x5447('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5447('0xa')][_0x5447('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b5d3d,_0x443586,_0x1c6c78){return new BPromise(function(_0x21cd26,_0x4ea93e){return client[_0x5447('0xc')](_0x5b5d3d,_0x1c6c78)[_0x5447('0xd')](function(_0x2d8c79){logger[_0x5447('0xe')](_0x5447('0xf'),_0x443586,_0x5447('0x10'));logger[_0x5447('0x11')](_0x5447('0x12'),_0x443586,_0x5447('0x10'),JSON[_0x5447('0x13')](_0x2d8c79));if(_0x2d8c79[_0x5447('0x14')]){if(_0x2d8c79[_0x5447('0x14')]['code']===0x1f4){logger['error'](_0x5447('0xf'),_0x443586,_0x2d8c79[_0x5447('0x14')][_0x5447('0x15')]);return _0x4ea93e(_0x2d8c79[_0x5447('0x14')][_0x5447('0x15')]);}logger[_0x5447('0x14')](_0x5447('0xf'),_0x443586,_0x2d8c79[_0x5447('0x14')][_0x5447('0x15')]);return _0x21cd26(_0x2d8c79[_0x5447('0x14')]['message']);}else{logger[_0x5447('0xe')](_0x5447('0xf'),_0x443586,_0x5447('0x10'));_0x21cd26(_0x2d8c79[_0x5447('0x16')][_0x5447('0x15')]);}})[_0x5447('0x17')](function(_0x216cfc){logger[_0x5447('0x14')](_0x5447('0xf'),_0x443586,_0x216cfc);_0x4ea93e(_0x216cfc);});});} \ No newline at end of file +var _0x9030=['stringify','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x585f40,_0x4a3091){var _0x44fc86=function(_0x5bcedc){while(--_0x5bcedc){_0x585f40['push'](_0x585f40['shift']());}};_0x44fc86(++_0x4a3091);}(_0x9030,0xcb));var _0x0903=function(_0x5a8bb4,_0x3ad4ee){_0x5a8bb4=_0x5a8bb4-0x0;var _0x3d18b6=_0x9030[_0x5a8bb4];return _0x3d18b6;};'use strict';var _=require(_0x0903('0x0'));var util=require(_0x0903('0x1'));var moment=require(_0x0903('0x2'));var BPromise=require(_0x0903('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0903('0x4'))['db'];var utils=require(_0x0903('0x5'));var logger=require('../../config/logger')(_0x0903('0x6'));var config=require(_0x0903('0x7'));var jayson=require(_0x0903('0x8'));var client=jayson[_0x0903('0x9')][_0x0903('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x437704,_0x2f86b8,_0x3084be){return new BPromise(function(_0x1e4780,_0x44c50d){return client[_0x0903('0xb')](_0x437704,_0x3084be)[_0x0903('0xc')](function(_0x43c999){logger[_0x0903('0xd')](_0x0903('0xe'),_0x2f86b8,_0x0903('0xf'));logger[_0x0903('0x10')]('UserSmsInteraction,\x20%s,\x20%s,\x20%s',_0x2f86b8,_0x0903('0xf'),JSON[_0x0903('0x11')](_0x43c999));if(_0x43c999[_0x0903('0x12')]){if(_0x43c999[_0x0903('0x12')]['code']===0x1f4){logger['error'](_0x0903('0xe'),_0x2f86b8,_0x43c999['error'][_0x0903('0x13')]);return _0x44c50d(_0x43c999[_0x0903('0x12')][_0x0903('0x13')]);}logger[_0x0903('0x12')](_0x0903('0xe'),_0x2f86b8,_0x43c999[_0x0903('0x12')][_0x0903('0x13')]);return _0x1e4780(_0x43c999[_0x0903('0x12')][_0x0903('0x13')]);}else{logger[_0x0903('0xd')](_0x0903('0xe'),_0x2f86b8,_0x0903('0xf'));_0x1e4780(_0x43c999[_0x0903('0x14')]['message']);}})[_0x0903('0x15')](function(_0x38720b){logger[_0x0903('0x12')]('UserSmsInteraction,\x20%s,\x20%s',_0x2f86b8,_0x38720b);_0x44c50d(_0x38720b);});});} \ No newline at end of file diff --git a/server/api/UserSmsInteraction/index.js b/server/api/UserSmsInteraction/index.js index 8c81c96..f86dd3d 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 _0x6553=['express','Router','../../components/auth/service','../../config/environment','./UserSmsInteraction.controller','get','isAuthenticated','index','show','create','put','/:id','update','destroy','exports','util','connect-timeout'];(function(_0x2aef60,_0x299d5d){var _0xa1ee62=function(_0x266428){while(--_0x266428){_0x2aef60['push'](_0x2aef60['shift']());}};_0xa1ee62(++_0x299d5d);}(_0x6553,0x185));var _0x3655=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x6553[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require('multer');var util=require(_0x3655('0x0'));var path=require('path');var timeout=require(_0x3655('0x1'));var express=require(_0x3655('0x2'));var router=express[_0x3655('0x3')]();var auth=require(_0x3655('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3655('0x5'));var controller=require(_0x3655('0x6'));router[_0x3655('0x7')]('/',auth[_0x3655('0x8')](),controller[_0x3655('0x9')]);router[_0x3655('0x7')]('/:id',auth[_0x3655('0x8')](),controller[_0x3655('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3655('0xb')]);router[_0x3655('0xc')](_0x3655('0xd'),auth[_0x3655('0x8')](),controller[_0x3655('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3655('0xf')]);module[_0x3655('0x10')]=router; \ No newline at end of file +var _0x0c67=['../../components/auth/service','../../components/interaction/service','./UserSmsInteraction.controller','get','isAuthenticated','/:id','post','create','delete','multer','path','express','Router'];(function(_0x17758e,_0x540ccd){var _0x174785=function(_0xd8769d){while(--_0xd8769d){_0x17758e['push'](_0x17758e['shift']());}};_0x174785(++_0x540ccd);}(_0x0c67,0x1dd));var _0x70c6=function(_0x57fd1a,_0x45b211){_0x57fd1a=_0x57fd1a-0x0;var _0x3d0fe4=_0x0c67[_0x57fd1a];return _0x3d0fe4;};'use strict';var multer=require(_0x70c6('0x0'));var util=require('util');var path=require(_0x70c6('0x1'));var timeout=require('connect-timeout');var express=require(_0x70c6('0x2'));var router=express[_0x70c6('0x3')]();var auth=require(_0x70c6('0x4'));var interaction=require(_0x70c6('0x5'));var config=require('../../config/environment');var controller=require(_0x70c6('0x6'));router[_0x70c6('0x7')]('/',auth[_0x70c6('0x8')](),controller['index']);router[_0x70c6('0x7')](_0x70c6('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x70c6('0xa')]('/',auth['isAuthenticated'](),controller[_0x70c6('0xb')]);router['put']('/:id',auth[_0x70c6('0x8')](),controller['update']);router[_0x70c6('0xc')](_0x70c6('0x9'),auth[_0x70c6('0x8')](),controller['destroy']);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 fb5669b..27f9a5f 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 _0x3dc0=['exports','INTEGER','sequelize'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x3dc0,0xad));var _0x03dc=function(_0x3b0867,_0x4031cb){_0x3b0867=_0x3b0867-0x0;var _0x2e0923=_0x3dc0[_0x3b0867];return _0x2e0923;};'use strict';var Sequelize=require(_0x03dc('0x0'));module[_0x03dc('0x1')]={'WhatsappInteractionId':{'type':Sequelize[_0x03dc('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x03dc('0x2')],'primaryKey':!![]}}; \ No newline at end of file +var _0xecd2=['INTEGER','sequelize','exports'];(function(_0x3c693a,_0x540b4b){var _0x2d36ac=function(_0x56b675){while(--_0x56b675){_0x3c693a['push'](_0x3c693a['shift']());}};_0x2d36ac(++_0x540b4b);}(_0xecd2,0x139));var _0x2ecd=function(_0xcf6a7c,_0x3d1a14){_0xcf6a7c=_0xcf6a7c-0x0;var _0x2313bc=_0xecd2[_0xcf6a7c];return _0x2313bc;};'use strict';var Sequelize=require(_0x2ecd('0x0'));module[_0x2ecd('0x1')]={'WhatsappInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x2ecd('0x2')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.controller.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.controller.js index 6cc63a7..aa01bf8 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 _0x2c34=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','UserWhatsappInteractions','UserProfileResource','sendStatus','name','send','index','map','UserWhatsappInteraction','rawAttributes','fieldName','type','model'];(function(_0x28a502,_0x3fb0da){var _0xa67f37=function(_0xd4504b){while(--_0xd4504b){_0x28a502['push'](_0x28a502['shift']());}};_0xa67f37(++_0x3fb0da);}(_0x2c34,0x16c));var _0x42c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2c34[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x42c3('0x0'));var emlformat=require(_0x42c3('0x1'));var rimraf=require(_0x42c3('0x2'));var zipdir=require(_0x42c3('0x3'));var jsonpatch=require(_0x42c3('0x4'));var rp=require(_0x42c3('0x5'));var moment=require(_0x42c3('0x6'));var BPromise=require(_0x42c3('0x7'));var Mustache=require(_0x42c3('0x8'));var util=require(_0x42c3('0x9'));var path=require(_0x42c3('0xa'));var sox=require(_0x42c3('0xb'));var csv=require(_0x42c3('0xc'));var ejs=require(_0x42c3('0xd'));var fs=require('fs');var _=require(_0x42c3('0xe'));var squel=require(_0x42c3('0xf'));var crypto=require(_0x42c3('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x42c3('0xc'));var querystring=require(_0x42c3('0x11'));var Papa=require(_0x42c3('0x12'));var Redis=require(_0x42c3('0x13'));var authService=require(_0x42c3('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x42c3('0x15'));var logger=require('../../config/logger')(_0x42c3('0x16'));var utils=require(_0x42c3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x42c3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57c3d8,_0x5ec45c){_0x5ec45c=_0x5ec45c||0xcc;return function(_0x257ded){if(_0x257ded){return _0x57c3d8['sendStatus'](_0x5ec45c);}return _0x57c3d8[_0x42c3('0x19')](_0x5ec45c)[_0x42c3('0x1a')]();};}function respondWithResult(_0x3c9d0c,_0x386b5b){_0x386b5b=_0x386b5b||0xc8;return function(_0x507800){if(_0x507800){return _0x3c9d0c[_0x42c3('0x19')](_0x386b5b)[_0x42c3('0x1b')](_0x507800);}};}function respondWithFilteredResult(_0x13571d,_0x335495){return function(_0x502561){if(_0x502561){var _0x288c24=_0x502561[_0x42c3('0x1c')],_0x1be7d5=_0x335495[_0x42c3('0x1d')],_0x4f265f=_0x335495[_0x42c3('0x1d')]+_0x335495[_0x42c3('0x1e')],_0x38e43c;if(_0x4f265f>=_0x288c24){_0x4f265f=_0x288c24;_0x38e43c=0xc8;}else{_0x38e43c=0xce;}_0x13571d[_0x42c3('0x19')](_0x38e43c);return _0x13571d['set'](_0x42c3('0x1f'),_0x1be7d5+'-'+_0x4f265f+'/'+_0x288c24)[_0x42c3('0x1b')](_0x502561);}return null;};}function patchUpdates(_0x2e9faf){return function(_0xbccd17){try{jsonpatch[_0x42c3('0x20')](_0xbccd17,_0x2e9faf,!![]);}catch(_0x2f1302){return BPromise[_0x42c3('0x21')](_0x2f1302);}return _0xbccd17[_0x42c3('0x22')]();};}function saveUpdates(_0x10ada9,_0x2f2eec){return function(_0x237a6d){if(_0x237a6d){return _0x237a6d[_0x42c3('0x23')](_0x10ada9)[_0x42c3('0x24')](function(_0x3720fd){return _0x3720fd;});}return null;};}function removeEntity(_0x1f1174,_0x131af5){return function(_0x14f943){if(_0x14f943){return _0x14f943[_0x42c3('0x25')]()[_0x42c3('0x24')](function(){var _0x295831=_0x14f943[_0x42c3('0x26')]({'plain':!![]});var _0x13d7ae=_0x42c3('0x27');return db[_0x42c3('0x28')]['destroy']({'where':{'type':_0x13d7ae,'resourceId':_0x295831['id']}})[_0x42c3('0x24')](function(){return _0x14f943;});})[_0x42c3('0x24')](function(){_0x1f1174[_0x42c3('0x19')](0xcc)[_0x42c3('0x1a')]();});}};}function handleEntityNotFound(_0x20bfd9,_0x35412b){return function(_0x2caeb4){if(!_0x2caeb4){_0x20bfd9[_0x42c3('0x29')](0x194);}return _0x2caeb4;};}function handleError(_0x320383,_0x16176e){_0x16176e=_0x16176e||0x1f4;return function(_0x3f170c){logger['error'](_0x3f170c['stack']);if(_0x3f170c[_0x42c3('0x2a')]){delete _0x3f170c[_0x42c3('0x2a')];}_0x320383[_0x42c3('0x19')](_0x16176e)[_0x42c3('0x2b')](_0x3f170c);};}exports[_0x42c3('0x2c')]=function(_0x533739,_0x1205b8){var _0x51e85c={},_0x2c019e={},_0x5cbf48={'count':0x0,'rows':[]};var _0x34b2d3=_[_0x42c3('0x2d')](db[_0x42c3('0x2e')][_0x42c3('0x2f')],function(_0x47390f){return{'name':_0x47390f[_0x42c3('0x30')],'type':_0x47390f[_0x42c3('0x31')]['key']};});_0x2c019e[_0x42c3('0x32')]=_[_0x42c3('0x2d')](_0x34b2d3,_0x42c3('0x2a'));_0x2c019e[_0x42c3('0x33')]=_[_0x42c3('0x34')](_0x533739[_0x42c3('0x33')]);_0x2c019e[_0x42c3('0x35')]=_[_0x42c3('0x36')](_0x2c019e['model'],_0x2c019e[_0x42c3('0x33')]);_0x51e85c['attributes']=_[_0x42c3('0x36')](_0x2c019e[_0x42c3('0x32')],qs[_0x42c3('0x37')](_0x533739['query'][_0x42c3('0x37')]));_0x51e85c[_0x42c3('0x38')]=_0x51e85c[_0x42c3('0x38')][_0x42c3('0x39')]?_0x51e85c[_0x42c3('0x38')]:_0x2c019e[_0x42c3('0x32')];if(!_0x533739[_0x42c3('0x33')][_0x42c3('0x3a')](_0x42c3('0x3b'))){_0x51e85c[_0x42c3('0x1e')]=qs[_0x42c3('0x1e')](_0x533739[_0x42c3('0x33')][_0x42c3('0x1e')]);_0x51e85c[_0x42c3('0x1d')]=qs[_0x42c3('0x1d')](_0x533739[_0x42c3('0x33')][_0x42c3('0x1d')]);}_0x51e85c['order']=qs[_0x42c3('0x3c')](_0x533739['query'][_0x42c3('0x3c')]);_0x51e85c[_0x42c3('0x3d')]=qs[_0x42c3('0x35')](_[_0x42c3('0x3e')](_0x533739[_0x42c3('0x33')],_0x2c019e[_0x42c3('0x35')]),_0x34b2d3);if(_0x533739['query']['filter']){_0x51e85c[_0x42c3('0x3d')]=_[_0x42c3('0x3f')](_0x51e85c[_0x42c3('0x3d')],{'$or':_['map'](_0x34b2d3,function(_0x454e34){if(_0x454e34[_0x42c3('0x31')]!==_0x42c3('0x40')){var _0x40b0b9={};_0x40b0b9[_0x454e34['name']]={'$like':'%'+_0x533739[_0x42c3('0x33')][_0x42c3('0x41')]+'%'};return _0x40b0b9;}})});}_0x51e85c=_[_0x42c3('0x3f')]({},_0x51e85c,_0x533739[_0x42c3('0x42')]);var _0x3c8b46={'where':_0x51e85c[_0x42c3('0x3d')]};return db[_0x42c3('0x2e')][_0x42c3('0x1c')](_0x3c8b46)[_0x42c3('0x24')](function(_0x3aa0d9){_0x5cbf48['count']=_0x3aa0d9;if(_0x533739[_0x42c3('0x33')][_0x42c3('0x43')]){_0x51e85c[_0x42c3('0x44')]=[{'all':!![]}];}return db[_0x42c3('0x2e')][_0x42c3('0x45')](_0x51e85c);})['then'](function(_0x2a05db){_0x5cbf48[_0x42c3('0x46')]=_0x2a05db;return _0x5cbf48;})[_0x42c3('0x24')](respondWithFilteredResult(_0x1205b8,_0x51e85c))[_0x42c3('0x47')](handleError(_0x1205b8,null));};exports[_0x42c3('0x48')]=function(_0x3050f3,_0x4cc8aa){var _0x18c24c={'raw':!![],'where':{'id':_0x3050f3[_0x42c3('0x49')]['id']}},_0x3c5afd={};_0x3c5afd[_0x42c3('0x32')]=_['keys'](db[_0x42c3('0x2e')][_0x42c3('0x2f')]);_0x3c5afd[_0x42c3('0x33')]=_[_0x42c3('0x34')](_0x3050f3[_0x42c3('0x33')]);_0x3c5afd[_0x42c3('0x35')]=_[_0x42c3('0x36')](_0x3c5afd[_0x42c3('0x32')],_0x3c5afd['query']);_0x18c24c[_0x42c3('0x38')]=_[_0x42c3('0x36')](_0x3c5afd[_0x42c3('0x32')],qs[_0x42c3('0x37')](_0x3050f3[_0x42c3('0x33')]['fields']));_0x18c24c[_0x42c3('0x38')]=_0x18c24c[_0x42c3('0x38')][_0x42c3('0x39')]?_0x18c24c[_0x42c3('0x38')]:_0x3c5afd[_0x42c3('0x32')];if(_0x3050f3['query'][_0x42c3('0x43')]){_0x18c24c[_0x42c3('0x44')]=[{'all':!![]}];}_0x18c24c=_[_0x42c3('0x3f')]({},_0x18c24c,_0x3050f3[_0x42c3('0x42')]);return db[_0x42c3('0x2e')][_0x42c3('0x4a')](_0x18c24c)['then'](handleEntityNotFound(_0x4cc8aa,null))['then'](respondWithResult(_0x4cc8aa,null))[_0x42c3('0x47')](handleError(_0x4cc8aa,null));};exports['create']=function(_0x5cffa5,_0x43ac98){return db['UserWhatsappInteraction'][_0x42c3('0x4b')](_0x5cffa5[_0x42c3('0x4c')],{})[_0x42c3('0x24')](function(_0x4b0160){var _0x2e3ed6=_0x5cffa5[_0x42c3('0x4d')][_0x42c3('0x26')]({'plain':!![]});if(!_0x2e3ed6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e3ed6[_0x42c3('0x4e')]===_0x42c3('0x4d')){var _0x38e31d=_0x4b0160['get']({'plain':!![]});var _0x4729ff='UserWhatsappInteractions';return db['UserProfileSection'][_0x42c3('0x4a')]({'where':{'name':_0x4729ff,'userProfileId':_0x2e3ed6[_0x42c3('0x4f')]},'raw':!![]})[_0x42c3('0x24')](function(_0x5edf21){if(_0x5edf21&&_0x5edf21[_0x42c3('0x50')]===0x0){return db[_0x42c3('0x28')]['create']({'name':_0x38e31d[_0x42c3('0x2a')],'resourceId':_0x38e31d['id'],'type':_0x5edf21[_0x42c3('0x2a')],'sectionId':_0x5edf21['id']},{})[_0x42c3('0x24')](function(){return _0x4b0160;});}else{return _0x4b0160;}})[_0x42c3('0x47')](function(_0x55c793){logger[_0x42c3('0x51')](_0x42c3('0x52'),_0x55c793);throw _0x55c793;});}return _0x4b0160;})['then'](respondWithResult(_0x43ac98,0xc9))[_0x42c3('0x47')](handleError(_0x43ac98,null));};exports[_0x42c3('0x23')]=function(_0x7488db,_0x14d25e){if(_0x7488db['body']['id']){delete _0x7488db[_0x42c3('0x4c')]['id'];}return db[_0x42c3('0x2e')]['find']({'where':{'id':_0x7488db['params']['id']}})['then'](handleEntityNotFound(_0x14d25e,null))['then'](saveUpdates(_0x7488db[_0x42c3('0x4c')],null))[_0x42c3('0x24')](respondWithResult(_0x14d25e,null))[_0x42c3('0x47')](handleError(_0x14d25e,null));};exports['destroy']=function(_0x27f5c1,_0x45f1a3){return db['UserWhatsappInteraction'][_0x42c3('0x4a')]({'where':{'id':_0x27f5c1['params']['id']}})[_0x42c3('0x24')](handleEntityNotFound(_0x45f1a3,null))[_0x42c3('0x24')](removeEntity(_0x45f1a3,null))[_0x42c3('0x47')](handleError(_0x45f1a3,null));}; \ No newline at end of file +var _0xecc9=['count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','UserWhatsappInteraction','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserWhatsappInteractions','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0xb96c8b,_0x573ca5){var _0xf78ffc=function(_0x209c21){while(--_0x209c21){_0xb96c8b['push'](_0xb96c8b['shift']());}};_0xf78ffc(++_0x573ca5);}(_0xecc9,0x138));var _0x9ecc=function(_0x705b98,_0x1c345b){_0x705b98=_0x705b98-0x0;var _0x47b72f=_0xecc9[_0x705b98];return _0x47b72f;};'use strict';var pdf=require(_0x9ecc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9ecc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9ecc('0x2'));var rp=require(_0x9ecc('0x3'));var moment=require('moment');var BPromise=require(_0x9ecc('0x4'));var Mustache=require(_0x9ecc('0x5'));var util=require(_0x9ecc('0x6'));var path=require(_0x9ecc('0x7'));var sox=require(_0x9ecc('0x8'));var csv=require(_0x9ecc('0x9'));var ejs=require(_0x9ecc('0xa'));var fs=require('fs');var _=require(_0x9ecc('0xb'));var squel=require(_0x9ecc('0xc'));var crypto=require('crypto');var jsforce=require(_0x9ecc('0xd'));var deskjs=require(_0x9ecc('0xe'));var toCsv=require(_0x9ecc('0x9'));var querystring=require(_0x9ecc('0xf'));var Papa=require(_0x9ecc('0x10'));var Redis=require(_0x9ecc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9ecc('0x12'));var as=require(_0x9ecc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9ecc('0x14'))('api');var utils=require(_0x9ecc('0x15'));var config=require(_0x9ecc('0x16'));var licenseUtil=require(_0x9ecc('0x17'));var db=require(_0x9ecc('0x18'))['db'];function respondWithStatusCode(_0x32a925,_0x48cc60){_0x48cc60=_0x48cc60||0xcc;return function(_0x517636){if(_0x517636){return _0x32a925[_0x9ecc('0x19')](_0x48cc60);}return _0x32a925[_0x9ecc('0x1a')](_0x48cc60)['end']();};}function respondWithResult(_0x407f04,_0x5931d8){_0x5931d8=_0x5931d8||0xc8;return function(_0xb931a4){if(_0xb931a4){return _0x407f04['status'](_0x5931d8)[_0x9ecc('0x1b')](_0xb931a4);}};}function respondWithFilteredResult(_0x1eceda,_0x12a821){return function(_0x1fc623){if(_0x1fc623){var _0x303cf6=_0x1fc623[_0x9ecc('0x1c')],_0x589d14=_0x12a821[_0x9ecc('0x1d')],_0x2d2f9e=_0x12a821['offset']+_0x12a821[_0x9ecc('0x1e')],_0x16ea9d;if(_0x2d2f9e>=_0x303cf6){_0x2d2f9e=_0x303cf6;_0x16ea9d=0xc8;}else{_0x16ea9d=0xce;}_0x1eceda[_0x9ecc('0x1a')](_0x16ea9d);return _0x1eceda[_0x9ecc('0x1f')](_0x9ecc('0x20'),_0x589d14+'-'+_0x2d2f9e+'/'+_0x303cf6)['json'](_0x1fc623);}return null;};}function patchUpdates(_0x1f5a58){return function(_0x46bbd3){try{jsonpatch[_0x9ecc('0x21')](_0x46bbd3,_0x1f5a58,!![]);}catch(_0x354c5e){return BPromise['reject'](_0x354c5e);}return _0x46bbd3[_0x9ecc('0x22')]();};}function saveUpdates(_0x2c5cab,_0x166e6b){return function(_0x4898ae){if(_0x4898ae){return _0x4898ae[_0x9ecc('0x23')](_0x2c5cab)[_0x9ecc('0x24')](function(_0x3ca5c8){return _0x3ca5c8;});}return null;};}function removeEntity(_0x139bda,_0x4b1d9c){return function(_0x30c5f5){if(_0x30c5f5){return _0x30c5f5[_0x9ecc('0x25')]()[_0x9ecc('0x24')](function(){var _0x2676b7=_0x30c5f5[_0x9ecc('0x26')]({'plain':!![]});var _0x4f3d03='UserWhatsappInteractions';return db[_0x9ecc('0x27')][_0x9ecc('0x25')]({'where':{'type':_0x4f3d03,'resourceId':_0x2676b7['id']}})['then'](function(){return _0x30c5f5;});})[_0x9ecc('0x24')](function(){_0x139bda[_0x9ecc('0x1a')](0xcc)[_0x9ecc('0x28')]();});}};}function handleEntityNotFound(_0x2d8d63,_0xf2c901){return function(_0x524bbe){if(!_0x524bbe){_0x2d8d63[_0x9ecc('0x19')](0x194);}return _0x524bbe;};}function handleError(_0x1cc6f0,_0xc92fc6){_0xc92fc6=_0xc92fc6||0x1f4;return function(_0x5d40c8){logger[_0x9ecc('0x29')](_0x5d40c8[_0x9ecc('0x2a')]);if(_0x5d40c8[_0x9ecc('0x2b')]){delete _0x5d40c8[_0x9ecc('0x2b')];}_0x1cc6f0[_0x9ecc('0x1a')](_0xc92fc6)[_0x9ecc('0x2c')](_0x5d40c8);};}exports[_0x9ecc('0x2d')]=function(_0x5a3502,_0x376fd6){var _0x4798e8={},_0x338349={},_0x1e03d1={'count':0x0,'rows':[]};var _0x2c975b=_[_0x9ecc('0x2e')](db[_0x9ecc('0x2f')][_0x9ecc('0x30')],function(_0x406cb1){return{'name':_0x406cb1[_0x9ecc('0x31')],'type':_0x406cb1[_0x9ecc('0x32')][_0x9ecc('0x33')]};});_0x338349['model']=_[_0x9ecc('0x2e')](_0x2c975b,_0x9ecc('0x2b'));_0x338349[_0x9ecc('0x34')]=_[_0x9ecc('0x35')](_0x5a3502[_0x9ecc('0x34')]);_0x338349[_0x9ecc('0x36')]=_[_0x9ecc('0x37')](_0x338349['model'],_0x338349[_0x9ecc('0x34')]);_0x4798e8[_0x9ecc('0x38')]=_[_0x9ecc('0x37')](_0x338349[_0x9ecc('0x39')],qs[_0x9ecc('0x3a')](_0x5a3502[_0x9ecc('0x34')][_0x9ecc('0x3a')]));_0x4798e8[_0x9ecc('0x38')]=_0x4798e8[_0x9ecc('0x38')][_0x9ecc('0x3b')]?_0x4798e8[_0x9ecc('0x38')]:_0x338349[_0x9ecc('0x39')];if(!_0x5a3502[_0x9ecc('0x34')][_0x9ecc('0x3c')]('nolimit')){_0x4798e8[_0x9ecc('0x1e')]=qs[_0x9ecc('0x1e')](_0x5a3502[_0x9ecc('0x34')]['limit']);_0x4798e8['offset']=qs[_0x9ecc('0x1d')](_0x5a3502[_0x9ecc('0x34')][_0x9ecc('0x1d')]);}_0x4798e8[_0x9ecc('0x3d')]=qs[_0x9ecc('0x3e')](_0x5a3502[_0x9ecc('0x34')][_0x9ecc('0x3e')]);_0x4798e8[_0x9ecc('0x3f')]=qs['filters'](_['pick'](_0x5a3502['query'],_0x338349[_0x9ecc('0x36')]),_0x2c975b);if(_0x5a3502[_0x9ecc('0x34')][_0x9ecc('0x40')]){_0x4798e8[_0x9ecc('0x3f')]=_[_0x9ecc('0x41')](_0x4798e8[_0x9ecc('0x3f')],{'$or':_[_0x9ecc('0x2e')](_0x2c975b,function(_0x4d9412){if(_0x4d9412[_0x9ecc('0x32')]!==_0x9ecc('0x42')){var _0x35e0b8={};_0x35e0b8[_0x4d9412[_0x9ecc('0x2b')]]={'$like':'%'+_0x5a3502[_0x9ecc('0x34')]['filter']+'%'};return _0x35e0b8;}})});}_0x4798e8=_[_0x9ecc('0x41')]({},_0x4798e8,_0x5a3502[_0x9ecc('0x43')]);var _0x194631={'where':_0x4798e8[_0x9ecc('0x3f')]};return db['UserWhatsappInteraction'][_0x9ecc('0x1c')](_0x194631)[_0x9ecc('0x24')](function(_0x71d1f2){_0x1e03d1[_0x9ecc('0x1c')]=_0x71d1f2;if(_0x5a3502[_0x9ecc('0x34')]['includeAll']){_0x4798e8[_0x9ecc('0x44')]=[{'all':!![]}];}return db[_0x9ecc('0x2f')][_0x9ecc('0x45')](_0x4798e8);})[_0x9ecc('0x24')](function(_0x5c52bc){_0x1e03d1[_0x9ecc('0x46')]=_0x5c52bc;return _0x1e03d1;})[_0x9ecc('0x24')](respondWithFilteredResult(_0x376fd6,_0x4798e8))[_0x9ecc('0x47')](handleError(_0x376fd6,null));};exports[_0x9ecc('0x48')]=function(_0x4031b8,_0x506577){var _0x2f4639={'raw':!![],'where':{'id':_0x4031b8[_0x9ecc('0x49')]['id']}},_0x25c714={};_0x25c714[_0x9ecc('0x39')]=_[_0x9ecc('0x35')](db[_0x9ecc('0x2f')]['rawAttributes']);_0x25c714[_0x9ecc('0x34')]=_['keys'](_0x4031b8[_0x9ecc('0x34')]);_0x25c714[_0x9ecc('0x36')]=_[_0x9ecc('0x37')](_0x25c714['model'],_0x25c714[_0x9ecc('0x34')]);_0x2f4639['attributes']=_[_0x9ecc('0x37')](_0x25c714[_0x9ecc('0x39')],qs['fields'](_0x4031b8[_0x9ecc('0x34')]['fields']));_0x2f4639['attributes']=_0x2f4639[_0x9ecc('0x38')]['length']?_0x2f4639[_0x9ecc('0x38')]:_0x25c714[_0x9ecc('0x39')];if(_0x4031b8['query'][_0x9ecc('0x4a')]){_0x2f4639[_0x9ecc('0x44')]=[{'all':!![]}];}_0x2f4639=_['merge']({},_0x2f4639,_0x4031b8['options']);return db[_0x9ecc('0x2f')][_0x9ecc('0x4b')](_0x2f4639)[_0x9ecc('0x24')](handleEntityNotFound(_0x506577,null))[_0x9ecc('0x24')](respondWithResult(_0x506577,null))[_0x9ecc('0x47')](handleError(_0x506577,null));};exports[_0x9ecc('0x4c')]=function(_0x5bfb2b,_0x1048ef){return db[_0x9ecc('0x2f')][_0x9ecc('0x4c')](_0x5bfb2b[_0x9ecc('0x4d')],{})[_0x9ecc('0x24')](function(_0x1641c0){var _0x496cc0=_0x5bfb2b[_0x9ecc('0x4e')][_0x9ecc('0x26')]({'plain':!![]});if(!_0x496cc0)throw new Error(_0x9ecc('0x4f'));if(_0x496cc0['role']===_0x9ecc('0x4e')){var _0x2a9123=_0x1641c0[_0x9ecc('0x26')]({'plain':!![]});var _0x48190a=_0x9ecc('0x50');return db[_0x9ecc('0x51')]['find']({'where':{'name':_0x48190a,'userProfileId':_0x496cc0[_0x9ecc('0x52')]},'raw':!![]})['then'](function(_0x4c5778){if(_0x4c5778&&_0x4c5778[_0x9ecc('0x53')]===0x0){return db[_0x9ecc('0x27')][_0x9ecc('0x4c')]({'name':_0x2a9123[_0x9ecc('0x2b')],'resourceId':_0x2a9123['id'],'type':_0x4c5778[_0x9ecc('0x2b')],'sectionId':_0x4c5778['id']},{})[_0x9ecc('0x24')](function(){return _0x1641c0;});}else{return _0x1641c0;}})[_0x9ecc('0x47')](function(_0x42beee){logger[_0x9ecc('0x29')](_0x9ecc('0x54'),_0x42beee);throw _0x42beee;});}return _0x1641c0;})['then'](respondWithResult(_0x1048ef,0xc9))[_0x9ecc('0x47')](handleError(_0x1048ef,null));};exports[_0x9ecc('0x23')]=function(_0x2f53e0,_0x4ac446){if(_0x2f53e0[_0x9ecc('0x4d')]['id']){delete _0x2f53e0['body']['id'];}return db[_0x9ecc('0x2f')][_0x9ecc('0x4b')]({'where':{'id':_0x2f53e0[_0x9ecc('0x49')]['id']}})[_0x9ecc('0x24')](handleEntityNotFound(_0x4ac446,null))['then'](saveUpdates(_0x2f53e0['body'],null))[_0x9ecc('0x24')](respondWithResult(_0x4ac446,null))[_0x9ecc('0x47')](handleError(_0x4ac446,null));};exports['destroy']=function(_0x53f193,_0x19c03b){return db[_0x9ecc('0x2f')][_0x9ecc('0x4b')]({'where':{'id':_0x53f193[_0x9ecc('0x49')]['id']}})[_0x9ecc('0x24')](handleEntityNotFound(_0x19c03b,null))[_0x9ecc('0x24')](removeEntity(_0x19c03b,null))[_0x9ecc('0x47')](handleError(_0x19c03b,null));}; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js index 391ce37..11a2a49 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 _0x88fd=['bluebird','request-promise','rimraf','./UserWhatsappInteraction.attributes','define','user_has_whatsapp_interactions','lodash','util','../../config/logger','api','moment'];(function(_0x4ef64b,_0x245ad3){var _0x37dce9=function(_0x55208b){while(--_0x55208b){_0x4ef64b['push'](_0x4ef64b['shift']());}};_0x37dce9(++_0x245ad3);}(_0x88fd,0x1df));var _0xd88f=function(_0x1f8331,_0x443900){_0x1f8331=_0x1f8331-0x0;var _0x240dce=_0x88fd[_0x1f8331];return _0x240dce;};'use strict';var _=require(_0xd88f('0x0'));var util=require(_0xd88f('0x1'));var logger=require(_0xd88f('0x2'))(_0xd88f('0x3'));var moment=require(_0xd88f('0x4'));var BPromise=require(_0xd88f('0x5'));var rp=require(_0xd88f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd88f('0x7'));var config=require('../../config/environment');var attributes=require(_0xd88f('0x8'));module['exports']=function(_0x2ccc69,_0x44647d){return _0x2ccc69[_0xd88f('0x9')]('UserWhatsappInteraction',attributes,{'tableName':_0xd88f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20de=['bluebird','request-promise','path','rimraf','../../config/environment','./UserWhatsappInteraction.attributes','exports','define','lodash','../../config/logger','api','moment'];(function(_0x34ef22,_0x9c1eea){var _0x524a33=function(_0x55e2a8){while(--_0x55e2a8){_0x34ef22['push'](_0x34ef22['shift']());}};_0x524a33(++_0x9c1eea);}(_0x20de,0x134));var _0xe20d=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x20de[_0x4c445a];return _0x2f611c;};'use strict';var _=require(_0xe20d('0x0'));var util=require('util');var logger=require(_0xe20d('0x1'))(_0xe20d('0x2'));var moment=require(_0xe20d('0x3'));var BPromise=require(_0xe20d('0x4'));var rp=require(_0xe20d('0x5'));var fs=require('fs');var path=require(_0xe20d('0x6'));var rimraf=require(_0xe20d('0x7'));var config=require(_0xe20d('0x8'));var attributes=require(_0xe20d('0x9'));module[_0xe20d('0xa')]=function(_0x53f711,_0x5a8622){return _0x53f711[_0xe20d('0xb')]('UserWhatsappInteraction',attributes,{'tableName':'user_has_whatsapp_interactions','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 40295b7..7a1cc8c 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 _0x33f3=['rpc','../../config/environment','jayson/promise','http','request','then','info','UserWhatsappInteraction,\x20%s,\x20%s','debug','UserWhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x395155,_0x192ffd){var _0x179767=function(_0xb18ee3){while(--_0xb18ee3){_0x395155['push'](_0x395155['shift']());}};_0x179767(++_0x192ffd);}(_0x33f3,0x1a1));var _0x333f=function(_0x2cd9e8,_0x3520ed){_0x2cd9e8=_0x2cd9e8-0x0;var _0x2f712f=_0x33f3[_0x2cd9e8];return _0x2f712f;};'use strict';var _=require(_0x333f('0x0'));var util=require(_0x333f('0x1'));var moment=require(_0x333f('0x2'));var BPromise=require('bluebird');var rs=require(_0x333f('0x3'));var fs=require('fs');var Redis=require(_0x333f('0x4'));var db=require(_0x333f('0x5'))['db'];var utils=require(_0x333f('0x6'));var logger=require(_0x333f('0x7'))(_0x333f('0x8'));var config=require(_0x333f('0x9'));var jayson=require(_0x333f('0xa'));var client=jayson['client'][_0x333f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18ef46,_0x2529fd,_0x7f6b08){return new BPromise(function(_0xb677ae,_0x4204bf){return client[_0x333f('0xc')](_0x18ef46,_0x7f6b08)[_0x333f('0xd')](function(_0x496695){logger[_0x333f('0xe')](_0x333f('0xf'),_0x2529fd,'request\x20sent');logger[_0x333f('0x10')](_0x333f('0x11'),_0x2529fd,_0x333f('0x12'),JSON[_0x333f('0x13')](_0x496695));if(_0x496695[_0x333f('0x14')]){if(_0x496695['error'][_0x333f('0x15')]===0x1f4){logger[_0x333f('0x14')](_0x333f('0xf'),_0x2529fd,_0x496695[_0x333f('0x14')]['message']);return _0x4204bf(_0x496695[_0x333f('0x14')]['message']);}logger[_0x333f('0x14')](_0x333f('0xf'),_0x2529fd,_0x496695[_0x333f('0x14')][_0x333f('0x16')]);return _0xb677ae(_0x496695[_0x333f('0x14')][_0x333f('0x16')]);}else{logger[_0x333f('0xe')](_0x333f('0xf'),_0x2529fd,_0x333f('0x12'));_0xb677ae(_0x496695[_0x333f('0x17')][_0x333f('0x16')]);}})[_0x333f('0x18')](function(_0x21b7eb){logger['error']('UserWhatsappInteraction,\x20%s,\x20%s',_0x2529fd,_0x21b7eb);_0x4204bf(_0x21b7eb);});});} \ No newline at end of file +var _0x89bd=['rpc','../../config/environment','jayson/promise','client','http','then','info','UserWhatsappInteraction,\x20%s,\x20%s','debug','UserWhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis'];(function(_0x10204e,_0x3604c7){var _0x4390b1=function(_0x59944f){while(--_0x59944f){_0x10204e['push'](_0x10204e['shift']());}};_0x4390b1(++_0x3604c7);}(_0x89bd,0x122));var _0xd89b=function(_0x3fe0ec,_0x51e29e){_0x3fe0ec=_0x3fe0ec-0x0;var _0x1ce57b=_0x89bd[_0x3fe0ec];return _0x1ce57b;};'use strict';var _=require('lodash');var util=require(_0xd89b('0x0'));var moment=require(_0xd89b('0x1'));var BPromise=require(_0xd89b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd89b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd89b('0x4'));var config=require(_0xd89b('0x5'));var jayson=require(_0xd89b('0x6'));var client=jayson[_0xd89b('0x7')][_0xd89b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2745ae,_0x1fe816,_0x31ab7b){return new BPromise(function(_0x4031ea,_0x12ae3c){return client['request'](_0x2745ae,_0x31ab7b)[_0xd89b('0x9')](function(_0x54ccd1){logger[_0xd89b('0xa')](_0xd89b('0xb'),_0x1fe816,'request\x20sent');logger[_0xd89b('0xc')](_0xd89b('0xd'),_0x1fe816,_0xd89b('0xe'),JSON[_0xd89b('0xf')](_0x54ccd1));if(_0x54ccd1[_0xd89b('0x10')]){if(_0x54ccd1['error'][_0xd89b('0x11')]===0x1f4){logger[_0xd89b('0x10')](_0xd89b('0xb'),_0x1fe816,_0x54ccd1['error'][_0xd89b('0x12')]);return _0x12ae3c(_0x54ccd1['error'][_0xd89b('0x12')]);}logger['error'](_0xd89b('0xb'),_0x1fe816,_0x54ccd1['error']['message']);return _0x4031ea(_0x54ccd1['error'][_0xd89b('0x12')]);}else{logger[_0xd89b('0xa')](_0xd89b('0xb'),_0x1fe816,_0xd89b('0xe'));_0x4031ea(_0x54ccd1[_0xd89b('0x13')][_0xd89b('0x12')]);}})[_0xd89b('0x14')](function(_0x1f6198){logger['error']('UserWhatsappInteraction,\x20%s,\x20%s',_0x1fe816,_0x1f6198);_0x12ae3c(_0x1f6198);});});} \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/index.js b/server/api/UserWhatsappInteraction/index.js index e61996c..d723103 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 _0x3609=['get','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./UserWhatsappInteraction.controller'];(function(_0x3b6688,_0x1f58b1){var _0x1d6d89=function(_0x236c55){while(--_0x236c55){_0x3b6688['push'](_0x3b6688['shift']());}};_0x1d6d89(++_0x1f58b1);}(_0x3609,0x101));var _0x9360=function(_0x498008,_0x60f88d){_0x498008=_0x498008-0x0;var _0x531260=_0x3609[_0x498008];return _0x531260;};'use strict';var multer=require(_0x9360('0x0'));var util=require(_0x9360('0x1'));var path=require(_0x9360('0x2'));var timeout=require(_0x9360('0x3'));var express=require(_0x9360('0x4'));var router=express[_0x9360('0x5')]();var auth=require(_0x9360('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9360('0x7'));var controller=require(_0x9360('0x8'));router[_0x9360('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x9360('0xa'),auth[_0x9360('0xb')](),controller['show']);router[_0x9360('0xc')]('/',auth[_0x9360('0xb')](),controller[_0x9360('0xd')]);router[_0x9360('0xe')](_0x9360('0xa'),auth[_0x9360('0xb')](),controller[_0x9360('0xf')]);router[_0x9360('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9360('0x11')]);module[_0x9360('0x12')]=router; \ No newline at end of file +var _0x9755=['./UserWhatsappInteraction.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','../../config/environment'];(function(_0x1e9056,_0xa66939){var _0x27b30c=function(_0x582f26){while(--_0x582f26){_0x1e9056['push'](_0x1e9056['shift']());}};_0x27b30c(++_0xa66939);}(_0x9755,0x1c6));var _0x5975=function(_0x43a6cd,_0x503d1a){_0x43a6cd=_0x43a6cd-0x0;var _0x5acb36=_0x9755[_0x43a6cd];return _0x5acb36;};'use strict';var multer=require(_0x5975('0x0'));var util=require('util');var path=require(_0x5975('0x1'));var timeout=require(_0x5975('0x2'));var express=require(_0x5975('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5975('0x4'));var controller=require(_0x5975('0x5'));router[_0x5975('0x6')]('/',auth[_0x5975('0x7')](),controller[_0x5975('0x8')]);router[_0x5975('0x6')](_0x5975('0x9'),auth['isAuthenticated'](),controller[_0x5975('0xa')]);router[_0x5975('0xb')]('/',auth['isAuthenticated'](),controller[_0x5975('0xc')]);router[_0x5975('0xd')](_0x5975('0x9'),auth['isAuthenticated'](),controller[_0x5975('0xe')]);router['delete']('/:id',auth[_0x5975('0x7')](),controller[_0x5975('0xf')]);module[_0x5975('0x10')]=router; \ No newline at end of file diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 1cda36d..4280bfe 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 _0xb282=['jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','VIRTUAL','STRING','contactManager','integration','motionbar'];(function(_0x48a020,_0x492242){var _0x4756f8=function(_0x52c50e){while(--_0x52c50e){_0x48a020['push'](_0x48a020['shift']());}};_0x4756f8(++_0x492242);}(_0xb282,0xf8));var _0x2b28=function(_0x464bdc,_0xb0a019){_0x464bdc=_0x464bdc-0x0;var _0x1b1f84=_0xb282[_0x464bdc];return _0x1b1f84;};'use strict';var Sequelize=require(_0x2b28('0x0'));module[_0x2b28('0x1')]={'name':{'type':Sequelize[_0x2b28('0x2')],'get':function(_0x3722f7){return this['getDataValue']('action');}},'action':{'type':Sequelize[_0x2b28('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x2b28('0x4'),_0x2b28('0x5'),_0x2b28('0x6'),_0x2b28('0x7'),_0x2b28('0x8'),_0x2b28('0x9'),_0x2b28('0xa'),_0x2b28('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x2b28('0xc')},'data1':{'type':Sequelize[_0x2b28('0x3')](0x1000),'comment':_0x2b28('0xd')},'data2':{'type':Sequelize[_0x2b28('0x3')](0x1000),'comment':_0x2b28('0xe')},'data3':{'type':Sequelize[_0x2b28('0x3')](0x1000),'comment':_0x2b28('0xf')},'data4':{'type':Sequelize[_0x2b28('0x3')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0x2b28('0x10')]}}; \ No newline at end of file +var _0xa87f=['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','exports','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xa87f,0x18d));var _0xfa87=function(_0x8fa603,_0x5d0469){_0x8fa603=_0x8fa603-0x0;var _0x5d262a=_0xa87f[_0x8fa603];return _0x5d262a;};'use strict';var Sequelize=require(_0xfa87('0x0'));module[_0xfa87('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xc00fde){return this[_0xfa87('0x2')](_0xfa87('0x3'));}},'action':{'type':Sequelize[_0xfa87('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xfa87('0x5'),_0xfa87('0x6'),_0xfa87('0x7'),_0xfa87('0x8'),_0xfa87('0x9'),_0xfa87('0xa'),_0xfa87('0xb'),'script']],'msg':_0xfa87('0xc')}},'comment':_0xfa87('0xc')},'data1':{'type':Sequelize[_0xfa87('0x4')](0x1000),'comment':_0xfa87('0xd')},'data2':{'type':Sequelize[_0xfa87('0x4')](0x1000),'comment':_0xfa87('0xe')},'data3':{'type':Sequelize[_0xfa87('0x4')](0x1000),'comment':_0xfa87('0xf')},'data4':{'type':Sequelize[_0xfa87('0x4')](0x1000)},'data5':{'type':Sequelize[_0xfa87('0x4')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0xfa87('0x10')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 2cb2935..7c85016 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 _0x15b2=['moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','limit','set','Content-Range','json','reject','update','then','end','error','stack','name','body','Action','params','catch','find','eml-format','zip-dir','fast-json-patch'];(function(_0x392c8f,_0x7c843c){var _0x389e3c=function(_0x14516b){while(--_0x14516b){_0x392c8f['push'](_0x392c8f['shift']());}};_0x389e3c(++_0x7c843c);}(_0x15b2,0x145));var _0x215b=function(_0x4a45e2,_0x4873af){_0x4a45e2=_0x4a45e2-0x0;var _0x13a8e7=_0x15b2[_0x4a45e2];return _0x13a8e7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x215b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x215b('0x1'));var jsonpatch=require(_0x215b('0x2'));var rp=require('request-promise');var moment=require(_0x215b('0x3'));var BPromise=require(_0x215b('0x4'));var Mustache=require(_0x215b('0x5'));var util=require(_0x215b('0x6'));var path=require('path');var sox=require(_0x215b('0x7'));var csv=require('to-csv');var ejs=require(_0x215b('0x8'));var fs=require('fs');var _=require(_0x215b('0x9'));var squel=require(_0x215b('0xa'));var crypto=require(_0x215b('0xb'));var jsforce=require(_0x215b('0xc'));var deskjs=require(_0x215b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x215b('0xe'));var Papa=require(_0x215b('0xf'));var Redis=require('ioredis');var authService=require(_0x215b('0x10'));var qs=require(_0x215b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x215b('0x12'))('api');var utils=require(_0x215b('0x13'));var config=require(_0x215b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x215b('0x15'))['db'];function respondWithStatusCode(_0x49a9cc,_0x4a9360){_0x4a9360=_0x4a9360||0xcc;return function(_0x1cf40c){if(_0x1cf40c){return _0x49a9cc['sendStatus'](_0x4a9360);}return _0x49a9cc[_0x215b('0x16')](_0x4a9360)['end']();};}function respondWithResult(_0x2aa945,_0xc1d4d1){_0xc1d4d1=_0xc1d4d1||0xc8;return function(_0x38d765){if(_0x38d765){return _0x2aa945['status'](_0xc1d4d1)['json'](_0x38d765);}};}function respondWithFilteredResult(_0x4c39d1,_0x1006fe){return function(_0x1c4030){if(_0x1c4030){var _0x2d04cb=_0x1c4030[_0x215b('0x17')],_0x2e96f5=_0x1006fe['offset'],_0x35508e=_0x1006fe[_0x215b('0x18')]+_0x1006fe[_0x215b('0x19')],_0x31a491;if(_0x35508e>=_0x2d04cb){_0x35508e=_0x2d04cb;_0x31a491=0xc8;}else{_0x31a491=0xce;}_0x4c39d1[_0x215b('0x16')](_0x31a491);return _0x4c39d1[_0x215b('0x1a')](_0x215b('0x1b'),_0x2e96f5+'-'+_0x35508e+'/'+_0x2d04cb)[_0x215b('0x1c')](_0x1c4030);}return null;};}function patchUpdates(_0x3ef620){return function(_0x2a1921){try{jsonpatch['apply'](_0x2a1921,_0x3ef620,!![]);}catch(_0x534e73){return BPromise[_0x215b('0x1d')](_0x534e73);}return _0x2a1921['save']();};}function saveUpdates(_0x16732d,_0xac9792){return function(_0x2f9ed2){if(_0x2f9ed2){return _0x2f9ed2[_0x215b('0x1e')](_0x16732d)[_0x215b('0x1f')](function(_0x1a40a5){return _0x1a40a5;});}return null;};}function removeEntity(_0x7e413c,_0x1a41c0){return function(_0x5cce5d){if(_0x5cce5d){return _0x5cce5d['destroy']()[_0x215b('0x1f')](function(){_0x7e413c['status'](0xcc)[_0x215b('0x20')]();});}};}function handleEntityNotFound(_0x267af9,_0x48568a){return function(_0x91587a){if(!_0x91587a){_0x267af9['sendStatus'](0x194);}return _0x91587a;};}function handleError(_0x43e2dd,_0x286834){_0x286834=_0x286834||0x1f4;return function(_0x1b7c12){logger[_0x215b('0x21')](_0x1b7c12[_0x215b('0x22')]);if(_0x1b7c12[_0x215b('0x23')]){delete _0x1b7c12[_0x215b('0x23')];}_0x43e2dd[_0x215b('0x16')](_0x286834)['send'](_0x1b7c12);};}exports[_0x215b('0x1e')]=function(_0x1f1a6f,_0x47d96d){if(_0x1f1a6f[_0x215b('0x24')]['id']){delete _0x1f1a6f[_0x215b('0x24')]['id'];}return db[_0x215b('0x25')]['find']({'where':{'id':_0x1f1a6f[_0x215b('0x26')]['id']}})[_0x215b('0x1f')](handleEntityNotFound(_0x47d96d,null))[_0x215b('0x1f')](saveUpdates(_0x1f1a6f[_0x215b('0x24')],null))[_0x215b('0x1f')](respondWithResult(_0x47d96d,null))[_0x215b('0x27')](handleError(_0x47d96d,null));};exports['destroy']=function(_0x4698a0,_0x3903b7){return db[_0x215b('0x25')][_0x215b('0x28')]({'where':{'id':_0x4698a0['params']['id']}})['then'](handleEntityNotFound(_0x3903b7,null))['then'](removeEntity(_0x3903b7,null))['catch'](handleError(_0x3903b7,null));}; \ No newline at end of file +var _0x05bc=['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','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','body','Action','find','params','catch','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0x05bc,0xae));var _0xc05b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x05bc[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc05b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc05b('0x1'));var jsonpatch=require(_0xc05b('0x2'));var rp=require('request-promise');var moment=require(_0xc05b('0x3'));var BPromise=require(_0xc05b('0x4'));var Mustache=require(_0xc05b('0x5'));var util=require(_0xc05b('0x6'));var path=require(_0xc05b('0x7'));var sox=require(_0xc05b('0x8'));var csv=require(_0xc05b('0x9'));var ejs=require(_0xc05b('0xa'));var fs=require('fs');var _=require(_0xc05b('0xb'));var squel=require(_0xc05b('0xc'));var crypto=require(_0xc05b('0xd'));var jsforce=require(_0xc05b('0xe'));var deskjs=require(_0xc05b('0xf'));var toCsv=require(_0xc05b('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc05b('0x10'));var authService=require(_0xc05b('0x11'));var qs=require(_0xc05b('0x12'));var as=require(_0xc05b('0x13'));var hardwareService=require(_0xc05b('0x14'));var logger=require(_0xc05b('0x15'))(_0xc05b('0x16'));var utils=require(_0xc05b('0x17'));var config=require(_0xc05b('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc05b('0x19'))['db'];function respondWithStatusCode(_0x409384,_0x12c7ec){_0x12c7ec=_0x12c7ec||0xcc;return function(_0x160659){if(_0x160659){return _0x409384[_0xc05b('0x1a')](_0x12c7ec);}return _0x409384[_0xc05b('0x1b')](_0x12c7ec)['end']();};}function respondWithResult(_0xc3030a,_0x6b1880){_0x6b1880=_0x6b1880||0xc8;return function(_0x55ec04){if(_0x55ec04){return _0xc3030a['status'](_0x6b1880)[_0xc05b('0x1c')](_0x55ec04);}};}function respondWithFilteredResult(_0x142fd8,_0x5ce354){return function(_0xcceda9){if(_0xcceda9){var _0x387036=_0xcceda9[_0xc05b('0x1d')],_0x21435e=_0x5ce354[_0xc05b('0x1e')],_0xe94a8f=_0x5ce354[_0xc05b('0x1e')]+_0x5ce354[_0xc05b('0x1f')],_0x5a33c1;if(_0xe94a8f>=_0x387036){_0xe94a8f=_0x387036;_0x5a33c1=0xc8;}else{_0x5a33c1=0xce;}_0x142fd8[_0xc05b('0x1b')](_0x5a33c1);return _0x142fd8[_0xc05b('0x20')]('Content-Range',_0x21435e+'-'+_0xe94a8f+'/'+_0x387036)[_0xc05b('0x1c')](_0xcceda9);}return null;};}function patchUpdates(_0x49d1f8){return function(_0x3cc005){try{jsonpatch[_0xc05b('0x21')](_0x3cc005,_0x49d1f8,!![]);}catch(_0x45d561){return BPromise[_0xc05b('0x22')](_0x45d561);}return _0x3cc005[_0xc05b('0x23')]();};}function saveUpdates(_0x48c36e,_0x10eb99){return function(_0x40de30){if(_0x40de30){return _0x40de30[_0xc05b('0x24')](_0x48c36e)[_0xc05b('0x25')](function(_0x58374e){return _0x58374e;});}return null;};}function removeEntity(_0x1766bd,_0x456930){return function(_0x2692c2){if(_0x2692c2){return _0x2692c2[_0xc05b('0x26')]()[_0xc05b('0x25')](function(){_0x1766bd[_0xc05b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x585447,_0x2699fb){return function(_0x382743){if(!_0x382743){_0x585447['sendStatus'](0x194);}return _0x382743;};}function handleError(_0x949652,_0x5b9e1f){_0x5b9e1f=_0x5b9e1f||0x1f4;return function(_0x54b3a9){logger[_0xc05b('0x27')](_0x54b3a9['stack']);if(_0x54b3a9['name']){delete _0x54b3a9['name'];}_0x949652[_0xc05b('0x1b')](_0x5b9e1f)['send'](_0x54b3a9);};}exports[_0xc05b('0x24')]=function(_0xffe261,_0x4d1fd4){if(_0xffe261[_0xc05b('0x28')]['id']){delete _0xffe261[_0xc05b('0x28')]['id'];}return db[_0xc05b('0x29')][_0xc05b('0x2a')]({'where':{'id':_0xffe261[_0xc05b('0x2b')]['id']}})[_0xc05b('0x25')](handleEntityNotFound(_0x4d1fd4,null))[_0xc05b('0x25')](saveUpdates(_0xffe261[_0xc05b('0x28')],null))[_0xc05b('0x25')](respondWithResult(_0x4d1fd4,null))[_0xc05b('0x2c')](handleError(_0x4d1fd4,null));};exports[_0xc05b('0x26')]=function(_0x35f8f7,_0x4fbdc7){return db[_0xc05b('0x29')]['find']({'where':{'id':_0x35f8f7[_0xc05b('0x2b')]['id']}})['then'](handleEntityNotFound(_0x4fbdc7,null))['then'](removeEntity(_0x4fbdc7,null))[_0xc05b('0x2c')](handleError(_0x4fbdc7,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index c438d69..09bba36 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 _0x1ce5=['./action.attributes','exports','define','Action','tools_actions','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1ce5,0x7a));var _0x51ce=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x1ce5[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0x51ce('0x0'));var util=require(_0x51ce('0x1'));var logger=require('../../config/logger')(_0x51ce('0x2'));var moment=require(_0x51ce('0x3'));var BPromise=require('bluebird');var rp=require(_0x51ce('0x4'));var fs=require('fs');var path=require(_0x51ce('0x5'));var rimraf=require(_0x51ce('0x6'));var config=require(_0x51ce('0x7'));var attributes=require(_0x51ce('0x8'));module[_0x51ce('0x9')]=function(_0x24c858,_0x37cc3b){return _0x24c858[_0x51ce('0xa')](_0x51ce('0xb'),attributes,{'tableName':_0x51ce('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6cc0=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','Action'];(function(_0x4276de,_0x4bbd6f){var _0x8f7e=function(_0x86a01b){while(--_0x86a01b){_0x4276de['push'](_0x4276de['shift']());}};_0x8f7e(++_0x4bbd6f);}(_0x6cc0,0x15f));var _0x06cc=function(_0x476a0e,_0x37a2f8){_0x476a0e=_0x476a0e-0x0;var _0x28b7a8=_0x6cc0[_0x476a0e];return _0x28b7a8;};'use strict';var _=require(_0x06cc('0x0'));var util=require(_0x06cc('0x1'));var logger=require('../../config/logger')(_0x06cc('0x2'));var moment=require(_0x06cc('0x3'));var BPromise=require(_0x06cc('0x4'));var rp=require(_0x06cc('0x5'));var fs=require('fs');var path=require(_0x06cc('0x6'));var rimraf=require(_0x06cc('0x7'));var config=require(_0x06cc('0x8'));var attributes=require(_0x06cc('0x9'));module[_0x06cc('0xa')]=function(_0x5a35e8,_0x351cbb){return _0x5a35e8[_0x06cc('0xb')](_0x06cc('0xc'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index b2c8d18..7afc0eb 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(_0x4cea31,_0x54ef05){var _0x30bf16=function(_0x1530a7){while(--_0x1530a7){_0x4cea31['push'](_0x4cea31['shift']());}};_0x30bf16(++_0x54ef05);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var 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 _0xb7e7=['Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x1b4cd9,_0x2858ff){var _0x7f81e0=function(_0x2a8392){while(--_0x2a8392){_0x1b4cd9['push'](_0x1b4cd9['shift']());}};_0x7f81e0(++_0x2858ff);}(_0xb7e7,0x121));var _0x7b7e=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xb7e7[_0x432682];return _0x463d05;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('Action,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index b04bc0d..b7eb082 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 _0x0855=['isAuthenticated','delete','destroy','exports','util','path','express','Router','../../config/environment','put','/:id'];(function(_0x4c1c0f,_0x4606d2){var _0x300028=function(_0x2084a8){while(--_0x2084a8){_0x4c1c0f['push'](_0x4c1c0f['shift']());}};_0x300028(++_0x4606d2);}(_0x0855,0xe0));var _0x5085=function(_0x451681,_0x5136f9){_0x451681=_0x451681-0x0;var _0x5d08c0=_0x0855[_0x451681];return _0x5d08c0;};'use strict';var multer=require('multer');var util=require(_0x5085('0x0'));var path=require(_0x5085('0x1'));var timeout=require('connect-timeout');var express=require(_0x5085('0x2'));var router=express[_0x5085('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5085('0x4'));var controller=require('./action.controller');router[_0x5085('0x5')](_0x5085('0x6'),auth[_0x5085('0x7')](),controller['update']);router[_0x5085('0x8')](_0x5085('0x6'),auth[_0x5085('0x7')](),controller[_0x5085('0x9')]);module[_0x5085('0xa')]=router; \ No newline at end of file +var _0x8953=['delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','put','isAuthenticated','update'];(function(_0xbc3d9f,_0x14b050){var _0x9145de=function(_0x5408b4){while(--_0x5408b4){_0xbc3d9f['push'](_0xbc3d9f['shift']());}};_0x9145de(++_0x14b050);}(_0x8953,0xf2));var _0x3895=function(_0x139db3,_0x54d26b){_0x139db3=_0x139db3-0x0;var _0x10e5ac=_0x8953[_0x139db3];return _0x10e5ac;};'use strict';var multer=require(_0x3895('0x0'));var util=require(_0x3895('0x1'));var path=require(_0x3895('0x2'));var timeout=require(_0x3895('0x3'));var express=require(_0x3895('0x4'));var router=express['Router']();var auth=require(_0x3895('0x5'));var interaction=require(_0x3895('0x6'));var config=require('../../config/environment');var controller=require('./action.controller');router[_0x3895('0x7')]('/:id',auth[_0x3895('0x8')](),controller[_0x3895('0x9')]);router[_0x3895('0xa')](_0x3895('0xb'),auth[_0x3895('0x8')](),controller[_0x3895('0xc')]);module[_0x3895('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 b0b62a0..141461e 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 _0x9ac1=['sequelize','exports','STRING','TEXT'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x9ac1,0x1ac));var _0x19ac=function(_0x36d96b,_0x440d86){_0x36d96b=_0x36d96b-0x0;var _0x323ba0=_0x9ac1[_0x36d96b];return _0x323ba0;};'use strict';var Sequelize=require(_0x19ac('0x0'));module[_0x19ac('0x1')]={'name':{'type':Sequelize[_0x19ac('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x19ac('0x2')]},'parent':{'type':Sequelize[_0x19ac('0x2')]},'table':{'type':Sequelize[_0x19ac('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x19ac('0x3')]}}; \ No newline at end of file +var _0x59f4=['sequelize','exports','STRING','TEXT'];(function(_0xeda595,_0xd5ebc3){var _0x591ce3=function(_0x186805){while(--_0x186805){_0xeda595['push'](_0xeda595['shift']());}};_0x591ce3(++_0xd5ebc3);}(_0x59f4,0xe8));var _0x459f=function(_0x15e6fe,_0x1a5c39){_0x15e6fe=_0x15e6fe-0x0;var _0x34894d=_0x59f4[_0x15e6fe];return _0x34894d;};'use strict';var Sequelize=require(_0x459f('0x0'));module[_0x459f('0x1')]={'name':{'type':Sequelize[_0x459f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x459f('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x459f('0x2')]},'conditions':{'type':Sequelize[_0x459f('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index ed89a01..70366b3 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 _0x02fe=['AnalyticCustomReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','params','keys','includeAll','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','preview','join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','MetricId','metric','replace','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','format','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','value','ValidationErrorItem','function','output','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','startDate','endDate','info','child_process','../../components/export/','savename','countTable','COUNT(*)','run','keyBy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','status','end','json','offset','limit','apply','reject','save','then','destroy','get','CustomReports','UserProfileResource','sendStatus','error','stack','name','send','index','map'];(function(_0x573281,_0x38947c){var _0x414f1a=function(_0x2320db){while(--_0x2320db){_0x573281['push'](_0x573281['shift']());}};_0x414f1a(++_0x38947c);}(_0x02fe,0x1b8));var _0xe02f=function(_0x5ef8fa,_0x2f753a){_0x5ef8fa=_0x5ef8fa-0x0;var _0x29e9dd=_0x02fe[_0x5ef8fa];return _0x29e9dd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe02f('0x0'));var rimraf=require(_0xe02f('0x1'));var zipdir=require(_0xe02f('0x2'));var jsonpatch=require(_0xe02f('0x3'));var rp=require(_0xe02f('0x4'));var moment=require(_0xe02f('0x5'));var BPromise=require(_0xe02f('0x6'));var Mustache=require(_0xe02f('0x7'));var util=require(_0xe02f('0x8'));var path=require(_0xe02f('0x9'));var sox=require(_0xe02f('0xa'));var csv=require(_0xe02f('0xb'));var ejs=require(_0xe02f('0xc'));var fs=require('fs');var _=require(_0xe02f('0xd'));var squel=require(_0xe02f('0xe'));var crypto=require(_0xe02f('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xe02f('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe02f('0x11'));var Papa=require(_0xe02f('0x12'));var Redis=require(_0xe02f('0x13'));var authService=require(_0xe02f('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe02f('0x15'));var hardwareService=require(_0xe02f('0x16'));var logger=require(_0xe02f('0x17'))(_0xe02f('0x18'));var utils=require(_0xe02f('0x19'));var config=require(_0xe02f('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xe02f('0x1b'))['db'];var dbH=require(_0xe02f('0x1b'))[_0xe02f('0x1c')];function respondWithStatusCode(_0x2e0b21,_0x445c46){_0x445c46=_0x445c46||0xcc;return function(_0x4e6c5d){if(_0x4e6c5d){return _0x2e0b21['sendStatus'](_0x445c46);}return _0x2e0b21[_0xe02f('0x1d')](_0x445c46)[_0xe02f('0x1e')]();};}function respondWithResult(_0x35fe54,_0x5ed618){_0x5ed618=_0x5ed618||0xc8;return function(_0x5b5e3b){if(_0x5b5e3b){return _0x35fe54[_0xe02f('0x1d')](_0x5ed618)[_0xe02f('0x1f')](_0x5b5e3b);}};}function respondWithFilteredResult(_0x5ece1c,_0x489434){return function(_0x4f1198){if(_0x4f1198){var _0x3b1ff1=_0x4f1198['count'],_0x20d376=_0x489434[_0xe02f('0x20')],_0x4c5ed0=_0x489434[_0xe02f('0x20')]+_0x489434[_0xe02f('0x21')],_0x1ded9d;if(_0x4c5ed0>=_0x3b1ff1){_0x4c5ed0=_0x3b1ff1;_0x1ded9d=0xc8;}else{_0x1ded9d=0xce;}_0x5ece1c[_0xe02f('0x1d')](_0x1ded9d);return _0x5ece1c['set']('Content-Range',_0x20d376+'-'+_0x4c5ed0+'/'+_0x3b1ff1)[_0xe02f('0x1f')](_0x4f1198);}return null;};}function patchUpdates(_0x488d1e){return function(_0x1703aa){try{jsonpatch[_0xe02f('0x22')](_0x1703aa,_0x488d1e,!![]);}catch(_0x2d9b4d){return BPromise[_0xe02f('0x23')](_0x2d9b4d);}return _0x1703aa[_0xe02f('0x24')]();};}function saveUpdates(_0x2e8cdb,_0x4067e2){return function(_0x4b8ad8){if(_0x4b8ad8){return _0x4b8ad8['update'](_0x2e8cdb)[_0xe02f('0x25')](function(_0x1197fb){return _0x1197fb;});}return null;};}function removeEntity(_0x252385,_0x246c73){return function(_0x5eb0b9){if(_0x5eb0b9){return _0x5eb0b9[_0xe02f('0x26')]()[_0xe02f('0x25')](function(){var _0x53dfaa=_0x5eb0b9[_0xe02f('0x27')]({'plain':!![]});var _0xf17f29=_0xe02f('0x28');return db[_0xe02f('0x29')][_0xe02f('0x26')]({'where':{'type':_0xf17f29,'resourceId':_0x53dfaa['id']}})['then'](function(){return _0x5eb0b9;});})[_0xe02f('0x25')](function(){_0x252385['status'](0xcc)[_0xe02f('0x1e')]();});}};}function handleEntityNotFound(_0x4fa9ea,_0xd35be5){return function(_0x314ecf){if(!_0x314ecf){_0x4fa9ea[_0xe02f('0x2a')](0x194);}return _0x314ecf;};}function handleError(_0xa8d9ee,_0x18ce7c){_0x18ce7c=_0x18ce7c||0x1f4;return function(_0x35b481){logger[_0xe02f('0x2b')](_0x35b481[_0xe02f('0x2c')]);if(_0x35b481[_0xe02f('0x2d')]){delete _0x35b481[_0xe02f('0x2d')];}_0xa8d9ee['status'](_0x18ce7c)[_0xe02f('0x2e')](_0x35b481);};}exports[_0xe02f('0x2f')]=function(_0xf06764,_0x29ede1){var _0x389d59={},_0x17ff3e={},_0x25601c={'count':0x0,'rows':[]};var _0x98d21e=_[_0xe02f('0x30')](db[_0xe02f('0x31')]['rawAttributes'],function(_0x4d5c23){return{'name':_0x4d5c23[_0xe02f('0x32')],'type':_0x4d5c23[_0xe02f('0x33')][_0xe02f('0x34')]};});_0x17ff3e[_0xe02f('0x35')]=_['map'](_0x98d21e,_0xe02f('0x2d'));_0x17ff3e[_0xe02f('0x36')]=_['keys'](_0xf06764['query']);_0x17ff3e[_0xe02f('0x37')]=_[_0xe02f('0x38')](_0x17ff3e[_0xe02f('0x35')],_0x17ff3e['query']);_0x389d59[_0xe02f('0x39')]=_[_0xe02f('0x38')](_0x17ff3e[_0xe02f('0x35')],qs['fields'](_0xf06764[_0xe02f('0x36')][_0xe02f('0x3a')]));_0x389d59['attributes']=_0x389d59[_0xe02f('0x39')][_0xe02f('0x3b')]?_0x389d59['attributes']:_0x17ff3e[_0xe02f('0x35')];if(!_0xf06764['query']['hasOwnProperty'](_0xe02f('0x3c'))){_0x389d59['limit']=qs[_0xe02f('0x21')](_0xf06764['query'][_0xe02f('0x21')]);_0x389d59[_0xe02f('0x20')]=qs['offset'](_0xf06764['query'][_0xe02f('0x20')]);}_0x389d59[_0xe02f('0x3d')]=qs[_0xe02f('0x3e')](_0xf06764[_0xe02f('0x36')][_0xe02f('0x3e')]);_0x389d59[_0xe02f('0x3f')]=qs[_0xe02f('0x37')](_[_0xe02f('0x40')](_0xf06764[_0xe02f('0x36')],_0x17ff3e[_0xe02f('0x37')]),_0x98d21e);if(_0xf06764['query'][_0xe02f('0x41')]){_0x389d59[_0xe02f('0x3f')]=_[_0xe02f('0x42')](_0x389d59[_0xe02f('0x3f')],{'$or':_[_0xe02f('0x30')](_0x98d21e,function(_0x211c18){if(_0x211c18['type']!==_0xe02f('0x43')){var _0x27f6b1={};_0x27f6b1[_0x211c18[_0xe02f('0x2d')]]={'$like':'%'+_0xf06764[_0xe02f('0x36')][_0xe02f('0x41')]+'%'};return _0x27f6b1;}})});}_0x389d59=_[_0xe02f('0x42')]({},_0x389d59,_0xf06764[_0xe02f('0x44')]);var _0x7646db={'where':_0x389d59[_0xe02f('0x3f')]};return db[_0xe02f('0x31')][_0xe02f('0x45')](_0x7646db)['then'](function(_0x5e62f0){_0x25601c[_0xe02f('0x45')]=_0x5e62f0;if(_0xf06764[_0xe02f('0x36')]['includeAll']){_0x389d59[_0xe02f('0x46')]=[{'all':!![]}];}return db[_0xe02f('0x31')][_0xe02f('0x47')](_0x389d59);})[_0xe02f('0x25')](function(_0x8ea357){_0x25601c[_0xe02f('0x48')]=_0x8ea357;return _0x25601c;})['then'](respondWithFilteredResult(_0x29ede1,_0x389d59))['catch'](handleError(_0x29ede1,null));};exports['show']=function(_0x45cbab,_0x47b5a3){var _0x2e842f={'raw':![],'where':{'id':_0x45cbab[_0xe02f('0x49')]['id']}},_0x2318a0={};_0x2318a0['model']=_[_0xe02f('0x4a')](db[_0xe02f('0x31')]['rawAttributes']);_0x2318a0[_0xe02f('0x36')]=_[_0xe02f('0x4a')](_0x45cbab[_0xe02f('0x36')]);_0x2318a0['filters']=_[_0xe02f('0x38')](_0x2318a0[_0xe02f('0x35')],_0x2318a0['query']);_0x2e842f[_0xe02f('0x39')]=_[_0xe02f('0x38')](_0x2318a0[_0xe02f('0x35')],qs[_0xe02f('0x3a')](_0x45cbab[_0xe02f('0x36')][_0xe02f('0x3a')]));_0x2e842f[_0xe02f('0x39')]=_0x2e842f[_0xe02f('0x39')][_0xe02f('0x3b')]?_0x2e842f['attributes']:_0x2318a0[_0xe02f('0x35')];if(_0x45cbab['query'][_0xe02f('0x4b')]){_0x2e842f['include']=[{'all':!![]}];}_0x2e842f=_[_0xe02f('0x42')]({},_0x2e842f,_0x45cbab[_0xe02f('0x44')]);return db[_0xe02f('0x31')][_0xe02f('0x4c')](_0x2e842f)[_0xe02f('0x25')](handleEntityNotFound(_0x47b5a3,null))[_0xe02f('0x25')](respondWithResult(_0x47b5a3,null))[_0xe02f('0x4d')](handleError(_0x47b5a3,null));};exports[_0xe02f('0x4e')]=function(_0x17fc8b,_0x4ca463){return db[_0xe02f('0x31')][_0xe02f('0x4e')](_0x17fc8b['body'],{})[_0xe02f('0x25')](function(_0x45b0c9){var _0x33ad0c=_0x17fc8b[_0xe02f('0x4f')][_0xe02f('0x27')]({'plain':!![]});if(!_0x33ad0c)throw new Error(_0xe02f('0x50'));if(_0x33ad0c['role']===_0xe02f('0x4f')){var _0x55d6c1=_0x45b0c9[_0xe02f('0x27')]({'plain':!![]});var _0x2649cd='Reports';return db['UserProfileSection'][_0xe02f('0x4c')]({'where':{'name':_0x2649cd,'userProfileId':_0x33ad0c['userProfileId']},'raw':!![]})['then'](function(_0x21f7f8){if(_0x21f7f8&&_0x21f7f8[_0xe02f('0x51')]===0x0){return db[_0xe02f('0x29')][_0xe02f('0x4e')]({'name':_0x55d6c1[_0xe02f('0x2d')],'resourceId':_0x55d6c1['id'],'type':_0xe02f('0x28'),'sectionId':_0x21f7f8['id']},{})['then'](function(){return _0x45b0c9;});}else{return _0x45b0c9;}})['catch'](function(_0x1470dc){logger[_0xe02f('0x2b')](_0xe02f('0x52'),_0x1470dc);throw _0x1470dc;});}return _0x45b0c9;})[_0xe02f('0x25')](respondWithResult(_0x4ca463,0xc9))['catch'](handleError(_0x4ca463,null));};exports[_0xe02f('0x53')]=function(_0x1e8169,_0x3f8e92){if(_0x1e8169[_0xe02f('0x54')]['id']){delete _0x1e8169[_0xe02f('0x54')]['id'];}return db[_0xe02f('0x31')][_0xe02f('0x4c')]({'where':{'id':_0x1e8169[_0xe02f('0x49')]['id']}})[_0xe02f('0x25')](handleEntityNotFound(_0x3f8e92,null))[_0xe02f('0x25')](saveUpdates(_0x1e8169[_0xe02f('0x54')],null))[_0xe02f('0x25')](respondWithResult(_0x3f8e92,null))[_0xe02f('0x4d')](handleError(_0x3f8e92,null));};exports[_0xe02f('0x26')]=function(_0x4bc4fa,_0x561924){return db[_0xe02f('0x31')]['find']({'where':{'id':_0x4bc4fa[_0xe02f('0x49')]['id']}})['then'](handleEntityNotFound(_0x561924,null))[_0xe02f('0x25')](removeEntity(_0x561924,null))['catch'](handleError(_0x561924,null));};exports[_0xe02f('0x55')]=function(_0x261de3,_0x8ed22b){var _0x35ffcb=0xa;var _0x5233fa=[_0xe02f('0x56'),'left_join',_0xe02f('0x57'),'cross_join'];var _0x3bba20={'SUM':_0xe02f('0x58'),'COUNT':_0xe02f('0x59'),'COUNT DISTINCT':_0xe02f('0x5a'),'MAX':'MAX(%s)','MIN':_0xe02f('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xe02f('0x5c'),'GROUP_CONCAT ASC':_0xe02f('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4dd6f7={'SEC_TO_TIME':_0xe02f('0x5e'),'DATE':_0xe02f('0x5f'),'HOUR':_0xe02f('0x60'),'ROUND':_0xe02f('0x61'),'UNIX_TIMESTAMP':_0xe02f('0x62')};var _0x221e12=function(_0x4d67b8){return!_[_0xe02f('0x63')]([_0xe02f('0x64'),_0xe02f('0x65'),_0xe02f('0x66'),_0xe02f('0x67')],_0x4d67b8);};var _0x1930b9=function(_0x4fe505){if(!_0x4fe505||!_0x4fe505[_0xe02f('0x68')][_0xe02f('0x3b')]){return'';}for(var _0x51e886='(',_0x341285=0x0;_0x341285<_0x4fe505[_0xe02f('0x68')][_0xe02f('0x3b')];_0x341285+=0x1){_0x341285>0x0&&(_0x51e886+='\x20'+_0x4fe505[_0xe02f('0x69')]+'\x20');_0x51e886+=_0x4fe505[_0xe02f('0x68')][_0x341285][_0xe02f('0x6a')]?_0x1930b9(_0x4fe505[_0xe02f('0x68')][_0x341285]['group']):_0x4fe505['rules'][_0x341285][_0xe02f('0x6b')]+'\x20'+_0x4fe505[_0xe02f('0x68')][_0x341285][_0xe02f('0x6c')]+(_0x221e12(_0x4fe505[_0xe02f('0x68')][_0x341285][_0xe02f('0x6c')])?'\x20'+_0x4fe505[_0xe02f('0x68')][_0x341285]['value']:'');}return _0x51e886+')';};var _0x40ea13={'where':{'id':_0x261de3[_0xe02f('0x49')]['id']}},_0x211b2a,_0x207c40,_0x237ddd,_0x5732fd,_0x5343c9;_0x40ea13=_[_0xe02f('0x42')]({},_0x40ea13,_0x261de3[_0xe02f('0x44')]);return db['AnalyticCustomReport']['find'](_0x40ea13)['then'](function(_0x46ac4f){if(_0x46ac4f){_0x211b2a=_0x46ac4f;return _0x46ac4f[_0xe02f('0x6d')]();}return null;})['then'](function(_0x3a05e5){if(_0x3a05e5){if(!_0x3a05e5[_0xe02f('0x3b')]){throw new db[(_0xe02f('0x6e'))]['ValidationErrorItem'](_0xe02f('0x6f'),0x193);}_0x207c40=_0x3a05e5;return db[_0xe02f('0x70')][_0xe02f('0x47')]({'raw':!![]});}return null;})[_0xe02f('0x25')](function(_0x453260){if(_0x453260){_0x237ddd=_['keyBy'](_0x453260,'id');var _0x296e5e;var _0x525f90=squel[_0xe02f('0x71')]();_0x525f90[_0xe02f('0x72')](_0x211b2a[_0xe02f('0x73')]);for(var _0x4d566e=0x0;_0x4d566e<_0x207c40['length'];_0x4d566e+=0x1){_0x296e5e=_0x207c40[_0x4d566e][_0xe02f('0x74')]?_0x237ddd[_0x207c40[_0x4d566e][_0xe02f('0x74')]][_0xe02f('0x75')]:_0x207c40[_0x4d566e]['field'];_0x296e5e=_0x207c40[_0x4d566e]['function']?_[_0xe02f('0x76')](_0x3bba20[_0x207c40[_0x4d566e]['function']],'%s',_0x296e5e):_0x296e5e;_0x296e5e=_0x207c40[_0x4d566e]['format']?_[_0xe02f('0x76')](_0x4dd6f7[_0x207c40[_0x4d566e]['format']],'%s',_0x296e5e):_0x296e5e;if(_0x207c40[_0x4d566e][_0xe02f('0x77')]){_0x525f90[_0xe02f('0x6a')](_0x296e5e);}_0x207c40[_0x4d566e][_0xe02f('0x78')]&&_0x525f90[_0xe02f('0x3d')](_0x296e5e,_0x207c40[_0x4d566e][_0xe02f('0x78')]===_0xe02f('0x79')?![]:!![]);_0x525f90[_0xe02f('0x6b')](_0x296e5e,_0x207c40[_0x4d566e][_0xe02f('0x7a')]||_0x296e5e);}if(_0x211b2a[_0xe02f('0x7b')]){_0x211b2a['joins']=JSON[_0xe02f('0x7c')](_0x211b2a['joins']);for(var _0x3eb6b3=0x0;_0x3eb6b3<_0x211b2a[_0xe02f('0x7b')][_0xe02f('0x3b')];_0x3eb6b3+=0x1){if(_0x211b2a[_0xe02f('0x7b')][_0x3eb6b3][_0xe02f('0x33')]&&_['includes'](_0x5233fa,_0x211b2a[_0xe02f('0x7b')][_0x3eb6b3]['type'])&&_0x211b2a['joins'][_0x3eb6b3][_0xe02f('0x7d')]&&_0x211b2a[_0xe02f('0x7b')][_0x3eb6b3][_0xe02f('0x7e')]&&_0x211b2a[_0xe02f('0x7b')][_0x3eb6b3][_0xe02f('0x7f')]){_0x525f90[_0x211b2a['joins'][_0x3eb6b3]['type']](_0x211b2a[_0xe02f('0x7b')][_0x3eb6b3]['foreignTable'],null,util[_0xe02f('0x80')](_0xe02f('0x81'),_0x211b2a['table'],_0x211b2a[_0xe02f('0x7b')][_0x3eb6b3][_0xe02f('0x7d')],_0x211b2a[_0xe02f('0x7b')][_0x3eb6b3][_0xe02f('0x7e')],_0x211b2a[_0xe02f('0x7b')][_0x3eb6b3]['foreignKey']));}}}if(_0x211b2a[_0xe02f('0x82')]){_0x211b2a['conditions']=JSON[_0xe02f('0x7c')](_0x211b2a['conditions']);_0x525f90[_0xe02f('0x3f')](_0x1930b9(_0x211b2a[_0xe02f('0x82')][_0xe02f('0x6a')]));}_0x5343c9=_0x525f90[_0xe02f('0x83')]();_0x525f90[_0xe02f('0x21')](_0x35ffcb);_0x525f90['offset'](0x0);logger[_0xe02f('0x84')](_0xe02f('0x85'),_0x525f90[_0xe02f('0x86')]());return dbH['sequelize'][_0xe02f('0x36')](_0x525f90[_0xe02f('0x86')](),{'type':dbH[_0xe02f('0x87')][_0xe02f('0x88')][_0xe02f('0x89')]});}})['then'](respondWithResult(_0x8ed22b,null))['catch'](handleError(_0x8ed22b,null));};function runReport(_0x160c72,_0x5e1fc6,_0x3e1ca2){var _0xbab504=_0x5e1fc6[_0xe02f('0x2d')];var _0x5de61d=0xa;var _0x3c6472=[_0xe02f('0x56'),'left_join',_0xe02f('0x57'),_0xe02f('0x8a')];var _0x4a7190={'SUM':_0xe02f('0x58'),'COUNT':_0xe02f('0x59'),'COUNT DISTINCT':_0xe02f('0x5a'),'MAX':_0xe02f('0x8b'),'MIN':_0xe02f('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xe02f('0x5c'),'GROUP_CONCAT ASC':_0xe02f('0x5d'),'GROUP_CONCAT DESC':_0xe02f('0x8c')};var _0x4f4ed1={'SEC_TO_TIME':_0xe02f('0x5e'),'DATE':'DATE(%s)','HOUR':_0xe02f('0x60'),'ROUND':_0xe02f('0x61'),'UNIX_TIMESTAMP':_0xe02f('0x62')};var _0x3598c9=function(_0x166ef9){return!_[_0xe02f('0x63')]([_0xe02f('0x64'),_0xe02f('0x65'),'IS\x20EMPTY',_0xe02f('0x67')],_0x166ef9);};var _0x5dfc51=function(_0x31f6ad){if(!_0x31f6ad||!_0x31f6ad[_0xe02f('0x68')][_0xe02f('0x3b')]){return'';}for(var _0x4b78cb='(',_0x147e5f=0x0;_0x147e5f<_0x31f6ad[_0xe02f('0x68')][_0xe02f('0x3b')];_0x147e5f+=0x1){_0x147e5f>0x0&&(_0x4b78cb+='\x20'+_0x31f6ad[_0xe02f('0x69')]+'\x20');_0x4b78cb+=_0x31f6ad[_0xe02f('0x68')][_0x147e5f][_0xe02f('0x6a')]?_0x5dfc51(_0x31f6ad[_0xe02f('0x68')][_0x147e5f][_0xe02f('0x6a')]):_0x31f6ad[_0xe02f('0x68')][_0x147e5f][_0xe02f('0x6b')]+'\x20'+_0x31f6ad['rules'][_0x147e5f]['condition']+(_0x3598c9(_0x31f6ad[_0xe02f('0x68')][_0x147e5f][_0xe02f('0x6c')])?'\x20'+_0x31f6ad[_0xe02f('0x68')][_0x147e5f][_0xe02f('0x8d')]:'');}return _0x4b78cb+')';};var _0x2ebc93={'where':{'id':_0x160c72['id']}},_0x3a0f9b,_0x5a762c,_0x489775,_0x4377db,_0x5221de;_0x2ebc93=_[_0xe02f('0x42')]({},_0x2ebc93,_0x3e1ca2);return db[_0xe02f('0x31')][_0xe02f('0x4c')](_0x2ebc93)[_0xe02f('0x25')](function(_0x543007){if(_0x543007){_0x3a0f9b=_0x543007;return _0x543007[_0xe02f('0x6d')]();}return null;})[_0xe02f('0x25')](function(_0x839b05){if(_0x839b05){if(!_0x839b05[_0xe02f('0x3b')]){throw new db[(_0xe02f('0x6e'))][(_0xe02f('0x8e'))](_0xe02f('0x6f'),0x193);}_0x5a762c=_0x839b05;return db['AnalyticMetric'][_0xe02f('0x47')]({'raw':!![]});}return null;})[_0xe02f('0x25')](function(_0x428164){if(_0x428164){_0x489775=_['keyBy'](_0x428164,'id');var _0x10c1c6;var _0x2101c3=squel['select']();_0x2101c3[_0xe02f('0x72')](_0x3a0f9b['table']);for(var _0x233296=0x0;_0x233296<_0x5a762c[_0xe02f('0x3b')];_0x233296+=0x1){_0x10c1c6=_0x5a762c[_0x233296][_0xe02f('0x74')]?_0x489775[_0x5a762c[_0x233296][_0xe02f('0x74')]][_0xe02f('0x75')]:_0x5a762c[_0x233296][_0xe02f('0x6b')];_0x10c1c6=_0x5a762c[_0x233296][_0xe02f('0x8f')]?_['replace'](_0x4a7190[_0x5a762c[_0x233296][_0xe02f('0x8f')]],'%s',_0x10c1c6):_0x10c1c6;_0x10c1c6=_0x5a762c[_0x233296]['format']?_[_0xe02f('0x76')](_0x4f4ed1[_0x5a762c[_0x233296][_0xe02f('0x80')]],'%s',_0x10c1c6):_0x10c1c6;if(_0x5a762c[_0x233296][_0xe02f('0x77')]){_0x2101c3[_0xe02f('0x6a')](_0x10c1c6);}_0x5a762c[_0x233296]['orderBy']&&_0x2101c3[_0xe02f('0x3d')](_0x10c1c6,_0x5a762c[_0x233296][_0xe02f('0x78')]===_0xe02f('0x79')?![]:!![]);_0x2101c3[_0xe02f('0x6b')](_0x10c1c6,_0x5a762c[_0x233296]['alias']||_0x10c1c6);}if(_0x3a0f9b[_0xe02f('0x7b')]){_0x3a0f9b['joins']=JSON['parse'](_0x3a0f9b['joins']);for(var _0x272f0c=0x0;_0x272f0c<_0x3a0f9b[_0xe02f('0x7b')][_0xe02f('0x3b')];_0x272f0c+=0x1){if(_0x3a0f9b[_0xe02f('0x7b')][_0x272f0c]['type']&&_[_0xe02f('0x63')](_0x3c6472,_0x3a0f9b[_0xe02f('0x7b')][_0x272f0c][_0xe02f('0x33')])&&_0x3a0f9b[_0xe02f('0x7b')][_0x272f0c]['parentKey']&&_0x3a0f9b[_0xe02f('0x7b')][_0x272f0c]['foreignTable']&&_0x3a0f9b[_0xe02f('0x7b')][_0x272f0c][_0xe02f('0x7f')]){_0x2101c3[_0x3a0f9b[_0xe02f('0x7b')][_0x272f0c][_0xe02f('0x33')]](_0x3a0f9b[_0xe02f('0x7b')][_0x272f0c][_0xe02f('0x7e')],null,util['format'](_0xe02f('0x81'),_0x3a0f9b[_0xe02f('0x73')],_0x3a0f9b['joins'][_0x272f0c]['parentKey'],_0x3a0f9b[_0xe02f('0x7b')][_0x272f0c][_0xe02f('0x7e')],_0x3a0f9b[_0xe02f('0x7b')][_0x272f0c][_0xe02f('0x7f')]));}}}if(_0x3a0f9b[_0xe02f('0x82')]){_0x3a0f9b[_0xe02f('0x82')]=JSON[_0xe02f('0x7c')](_0x3a0f9b[_0xe02f('0x82')]);_0x2101c3[_0xe02f('0x3f')](_0x5dfc51(_0x3a0f9b[_0xe02f('0x82')][_0xe02f('0x6a')]));}_0x5221de=_0x2101c3['clone']();_0x2101c3[_0xe02f('0x21')](_0x5de61d);_0x2101c3[_0xe02f('0x20')](0x0);return;}})[_0xe02f('0x25')](function(){if(_0x5e1fc6[_0xe02f('0x90')]==='web'){return null;}var _0x5651f4=_[_0xe02f('0x42')](_0x5e1fc6,{'name':_0x5e1fc6[_0xe02f('0x91')]||_0x5e1fc6[_0xe02f('0x2d')]||_0x3a0f9b['name'],'basename':_0xbab504,'savename':util[_0xe02f('0x80')](_0xe02f('0x92'),_0x5e1fc6[_0xe02f('0x2d')]||_0x3a0f9b[_0xe02f('0x2d')],require(_0xe02f('0x93'))[_0xe02f('0x94')](0x4),_0x5e1fc6['output']||_0xe02f('0x95')),'reportId':_0x3a0f9b['id'],'reportType':_0xe02f('0x96')});return db[_0xe02f('0x97')][_0xe02f('0x4e')](_0x5651f4,{'raw':!![]});})[_0xe02f('0x25')](function(_0x4b0c67){if(_0x3a0f9b[_0xe02f('0x73')]===_0xe02f('0x98')){_0x5221de[_0xe02f('0x3f')](_0x3a0f9b['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x5e1fc6['startDate'],_0x5e1fc6['endDate']);}else{_0x5221de[_0xe02f('0x3f')](_0x3a0f9b[_0xe02f('0x73')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5e1fc6[_0xe02f('0x99')],_0x5e1fc6[_0xe02f('0x9a')]);}if(_0x4b0c67){logger[_0xe02f('0x9b')]('Run\x20Query:',_0x5221de['toString']());require(_0xe02f('0x9c'))['fork'](path[_0xe02f('0x56')](__dirname,_0xe02f('0x9d'),_0x4b0c67[_0xe02f('0x90')]),[_0x4b0c67['id'],_0x5221de[_0xe02f('0x86')](),path[_0xe02f('0x56')](__dirname,'../../files/reports',_0x4b0c67[_0xe02f('0x9e')]),_0xbab504]);return _0x4b0c67;}else{var _0x157c73=squel[_0xe02f('0x71')]();_0x157c73[_0xe02f('0x72')]('('+_0x5221de[_0xe02f('0x86')]()+')',_0xe02f('0x9f'));_0x157c73[_0xe02f('0x6b')](_0xe02f('0xa0'),'count');_0x5221de['limit'](_0x5e1fc6[_0xe02f('0x21')]||_0x5de61d);_0x5221de[_0xe02f('0x20')](_0x5e1fc6['offset']||0x0);return dbH[_0xe02f('0x87')]['query'](_0x157c73[_0xe02f('0x86')](),{'type':dbH['sequelize'][_0xe02f('0x88')][_0xe02f('0x89')]})['then'](function(_0x5c26f0){if(!_0x5c26f0[_0xe02f('0x3b')]){_0x4377db=0x0;}else{_0x4377db=_0x5c26f0[0x0][_0xe02f('0x45')]||0x0;}return dbH[_0xe02f('0x87')][_0xe02f('0x36')](_0x5221de['toString'](),{'type':dbH[_0xe02f('0x87')][_0xe02f('0x88')][_0xe02f('0x89')]});})['then'](function(_0x44e734){return{'rows':_0x44e734||[],'count':_0x4377db};});}});}exports[_0xe02f('0xa1')]=function(_0x281253,_0x4ee4fe){return runReport(_0x281253[_0xe02f('0x49')],_0x281253[_0xe02f('0x36')],_0x281253[_0xe02f('0x44')])[_0xe02f('0x25')](respondWithResult(_0x4ee4fe,null))[_0xe02f('0x4d')](handleError(_0x4ee4fe,null));};exports['runReport']=runReport;exports[_0xe02f('0x36')]=function(_0x14d6c9,_0x43eeff){var _0x12dc13=0xa;var _0x1ae9db=[_0xe02f('0x56'),'left_join',_0xe02f('0x57'),_0xe02f('0x8a')];var _0xdf384a={'SUM':'SUM(%s)','COUNT':_0xe02f('0x59'),'COUNT DISTINCT':_0xe02f('0x5a'),'MAX':_0xe02f('0x8b'),'MIN':_0xe02f('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xe02f('0x5c'),'GROUP_CONCAT ASC':_0xe02f('0x5d'),'GROUP_CONCAT DESC':_0xe02f('0x8c')};var _0x5979df={'SEC_TO_TIME':_0xe02f('0x5e'),'DATE':_0xe02f('0x5f'),'HOUR':_0xe02f('0x60'),'ROUND':_0xe02f('0x61'),'UNIX_TIMESTAMP':_0xe02f('0x62')};var _0x5a0f3b=function(_0x3c050a){return!_[_0xe02f('0x63')]([_0xe02f('0x64'),_0xe02f('0x65'),_0xe02f('0x66'),'IS\x20NOT\x20EMPTY'],_0x3c050a);};var _0x244585=function(_0x18440e){if(!_0x18440e||!_0x18440e[_0xe02f('0x68')][_0xe02f('0x3b')]){return'';}for(var _0x1820fb='(',_0x18b286=0x0;_0x18b286<_0x18440e[_0xe02f('0x68')][_0xe02f('0x3b')];_0x18b286+=0x1){_0x18b286>0x0&&(_0x1820fb+='\x20'+_0x18440e['operator']+'\x20');_0x1820fb+=_0x18440e[_0xe02f('0x68')][_0x18b286][_0xe02f('0x6a')]?_0x244585(_0x18440e[_0xe02f('0x68')][_0x18b286][_0xe02f('0x6a')]):_0x18440e[_0xe02f('0x68')][_0x18b286]['field']+'\x20'+_0x18440e[_0xe02f('0x68')][_0x18b286][_0xe02f('0x6c')]+(_0x5a0f3b(_0x18440e[_0xe02f('0x68')][_0x18b286]['condition'])?'\x20'+_0x18440e[_0xe02f('0x68')][_0x18b286][_0xe02f('0x8d')]:'');}return _0x1820fb+')';};var _0x31cd1f={'where':{'id':_0x14d6c9[_0xe02f('0x49')]['id']}},_0x5dab89,_0x3a4460,_0x2b3ef5,_0x2a0355,_0x338489;_0x31cd1f=_[_0xe02f('0x42')]({},_0x31cd1f,_0x14d6c9[_0xe02f('0x44')]);return db[_0xe02f('0x31')]['find'](_0x31cd1f)[_0xe02f('0x25')](function(_0x579311){if(_0x579311){_0x5dab89=_0x579311;return _0x579311[_0xe02f('0x6d')]();}return null;})[_0xe02f('0x25')](function(_0x573385){if(_0x573385){if(!_0x573385['length']){throw new db[(_0xe02f('0x6e'))][(_0xe02f('0x8e'))](_0xe02f('0x6f'),0x193);}_0x3a4460=_0x573385;return db['AnalyticMetric'][_0xe02f('0x47')]({'raw':!![]});}return null;})[_0xe02f('0x25')](function(_0x12595c){if(_0x12595c){_0x2b3ef5=_[_0xe02f('0xa2')](_0x12595c,'id');var _0x1ac3f7;var _0x398c05=squel[_0xe02f('0x71')]();_0x398c05[_0xe02f('0x72')](_0x5dab89['table']);for(var _0x12609b=0x0;_0x12609b<_0x3a4460['length'];_0x12609b+=0x1){_0x1ac3f7=_0x3a4460[_0x12609b][_0xe02f('0x74')]?_0x2b3ef5[_0x3a4460[_0x12609b][_0xe02f('0x74')]][_0xe02f('0x75')]:_0x3a4460[_0x12609b][_0xe02f('0x6b')];_0x1ac3f7=_0x3a4460[_0x12609b][_0xe02f('0x8f')]?_[_0xe02f('0x76')](_0xdf384a[_0x3a4460[_0x12609b][_0xe02f('0x8f')]],'%s',_0x1ac3f7):_0x1ac3f7;_0x1ac3f7=_0x3a4460[_0x12609b][_0xe02f('0x80')]?_[_0xe02f('0x76')](_0x5979df[_0x3a4460[_0x12609b]['format']],'%s',_0x1ac3f7):_0x1ac3f7;if(_0x3a4460[_0x12609b][_0xe02f('0x77')]){_0x398c05[_0xe02f('0x6a')](_0x1ac3f7);}_0x3a4460[_0x12609b][_0xe02f('0x78')]&&_0x398c05[_0xe02f('0x3d')](_0x1ac3f7,_0x3a4460[_0x12609b][_0xe02f('0x78')]===_0xe02f('0x79')?![]:!![]);_0x398c05[_0xe02f('0x6b')](_0x1ac3f7,_0x3a4460[_0x12609b]['alias']||_0x1ac3f7);}if(_0x5dab89['joins']){_0x5dab89[_0xe02f('0x7b')]=JSON['parse'](_0x5dab89[_0xe02f('0x7b')]);for(var _0x565056=0x0;_0x565056<_0x5dab89[_0xe02f('0x7b')][_0xe02f('0x3b')];_0x565056+=0x1){if(_0x5dab89['joins'][_0x565056][_0xe02f('0x33')]&&_[_0xe02f('0x63')](_0x1ae9db,_0x5dab89[_0xe02f('0x7b')][_0x565056][_0xe02f('0x33')])&&_0x5dab89['joins'][_0x565056][_0xe02f('0x7d')]&&_0x5dab89[_0xe02f('0x7b')][_0x565056][_0xe02f('0x7e')]&&_0x5dab89['joins'][_0x565056]['foreignKey']){_0x398c05[_0x5dab89['joins'][_0x565056][_0xe02f('0x33')]](_0x5dab89[_0xe02f('0x7b')][_0x565056]['foreignTable'],null,util['format'](_0xe02f('0x81'),_0x5dab89[_0xe02f('0x73')],_0x5dab89[_0xe02f('0x7b')][_0x565056][_0xe02f('0x7d')],_0x5dab89[_0xe02f('0x7b')][_0x565056][_0xe02f('0x7e')],_0x5dab89[_0xe02f('0x7b')][_0x565056]['foreignKey']));}}}if(_0x5dab89['conditions']){_0x5dab89[_0xe02f('0x82')]=JSON[_0xe02f('0x7c')](_0x5dab89[_0xe02f('0x82')]);_0x398c05[_0xe02f('0x3f')](_0x244585(_0x5dab89[_0xe02f('0x82')][_0xe02f('0x6a')]));}_0x338489=_0x398c05[_0xe02f('0x83')]();_0x398c05['limit'](_0x12dc13);_0x398c05['offset'](0x0);logger[_0xe02f('0x84')](_0xe02f('0x85'),_0x398c05['toString']());return dbH[_0xe02f('0x87')][_0xe02f('0x36')](_0x398c05[_0xe02f('0x86')](),{'type':dbH[_0xe02f('0x87')][_0xe02f('0x88')][_0xe02f('0x89')]});}})[_0xe02f('0x25')](function(){return{'sql':_0x338489[_0xe02f('0x86')]()};})[_0xe02f('0x25')](respondWithResult(_0x43eeff,null))[_0xe02f('0x4d')](handleError(_0x43eeff,null));}; \ No newline at end of file +var _0x2157=['right_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','SUM(%s)','COUNT(%s)','AVG(%s)','GROUP_CONCAT(%s)','ROUND(%s)','DESC','%s.%s\x20=\x20%s.%s','clone','output','web','fullPath','%s-%s.%s','randomstring','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','debug','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','status','json','offset','set','Content-Range','reject','save','then','destroy','get','CustomReports','UserProfileResource','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','nolimit','limit','order','sort','where','pick','filter','merge','options','AnalyticCustomReport','count','includeAll','include','findAll','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','catch','error','update','preview','left_join'];(function(_0x220afa,_0xf5f6cc){var _0x1b79d1=function(_0x178a39){while(--_0x178a39){_0x220afa['push'](_0x220afa['shift']());}};_0x1b79d1(++_0xf5f6cc);}(_0x2157,0xf6));var _0x7215=function(_0x5bee46,_0x1d05ed){_0x5bee46=_0x5bee46-0x0;var _0x480254=_0x2157[_0x5bee46];return _0x480254;};'use strict';var pdf=require(_0x7215('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7215('0x1'));var zipdir=require(_0x7215('0x2'));var jsonpatch=require(_0x7215('0x3'));var rp=require(_0x7215('0x4'));var moment=require(_0x7215('0x5'));var BPromise=require(_0x7215('0x6'));var Mustache=require(_0x7215('0x7'));var util=require(_0x7215('0x8'));var path=require(_0x7215('0x9'));var sox=require(_0x7215('0xa'));var csv=require(_0x7215('0xb'));var ejs=require(_0x7215('0xc'));var fs=require('fs');var _=require(_0x7215('0xd'));var squel=require('squel');var crypto=require(_0x7215('0xe'));var jsforce=require(_0x7215('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7215('0xb'));var querystring=require(_0x7215('0x10'));var Papa=require(_0x7215('0x11'));var Redis=require(_0x7215('0x12'));var authService=require(_0x7215('0x13'));var qs=require(_0x7215('0x14'));var as=require(_0x7215('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7215('0x16'))(_0x7215('0x17'));var utils=require(_0x7215('0x18'));var config=require(_0x7215('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x7215('0x1a'))['db'];var dbH=require(_0x7215('0x1a'))[_0x7215('0x1b')];function respondWithStatusCode(_0x358b22,_0x4c8687){_0x4c8687=_0x4c8687||0xcc;return function(_0x1dee34){if(_0x1dee34){return _0x358b22['sendStatus'](_0x4c8687);}return _0x358b22['status'](_0x4c8687)['end']();};}function respondWithResult(_0x1187ca,_0xb58a50){_0xb58a50=_0xb58a50||0xc8;return function(_0x14c162){if(_0x14c162){return _0x1187ca[_0x7215('0x1c')](_0xb58a50)[_0x7215('0x1d')](_0x14c162);}};}function respondWithFilteredResult(_0x476d27,_0x5cf83b){return function(_0x245161){if(_0x245161){var _0x274124=_0x245161['count'],_0x5e7576=_0x5cf83b[_0x7215('0x1e')],_0xa16140=_0x5cf83b[_0x7215('0x1e')]+_0x5cf83b['limit'],_0x146818;if(_0xa16140>=_0x274124){_0xa16140=_0x274124;_0x146818=0xc8;}else{_0x146818=0xce;}_0x476d27[_0x7215('0x1c')](_0x146818);return _0x476d27[_0x7215('0x1f')](_0x7215('0x20'),_0x5e7576+'-'+_0xa16140+'/'+_0x274124)['json'](_0x245161);}return null;};}function patchUpdates(_0x3a2138){return function(_0x120789){try{jsonpatch['apply'](_0x120789,_0x3a2138,!![]);}catch(_0x562583){return BPromise[_0x7215('0x21')](_0x562583);}return _0x120789[_0x7215('0x22')]();};}function saveUpdates(_0x466a6b,_0x2f4e32){return function(_0x31512a){if(_0x31512a){return _0x31512a['update'](_0x466a6b)[_0x7215('0x23')](function(_0x45c47a){return _0x45c47a;});}return null;};}function removeEntity(_0x232c29,_0x167444){return function(_0xad515a){if(_0xad515a){return _0xad515a[_0x7215('0x24')]()[_0x7215('0x23')](function(){var _0x5eca0e=_0xad515a[_0x7215('0x25')]({'plain':!![]});var _0x590882=_0x7215('0x26');return db[_0x7215('0x27')]['destroy']({'where':{'type':_0x590882,'resourceId':_0x5eca0e['id']}})[_0x7215('0x23')](function(){return _0xad515a;});})['then'](function(){_0x232c29['status'](0xcc)[_0x7215('0x28')]();});}};}function handleEntityNotFound(_0x6e2ecf,_0x597d5d){return function(_0x44da25){if(!_0x44da25){_0x6e2ecf[_0x7215('0x29')](0x194);}return _0x44da25;};}function handleError(_0x91926f,_0x1c50e7){_0x1c50e7=_0x1c50e7||0x1f4;return function(_0x98b2c){logger['error'](_0x98b2c[_0x7215('0x2a')]);if(_0x98b2c[_0x7215('0x2b')]){delete _0x98b2c[_0x7215('0x2b')];}_0x91926f[_0x7215('0x1c')](_0x1c50e7)[_0x7215('0x2c')](_0x98b2c);};}exports[_0x7215('0x2d')]=function(_0x13a56c,_0x167023){var _0x1a56ed={},_0x536905={},_0x326bc6={'count':0x0,'rows':[]};var _0x2c119c=_[_0x7215('0x2e')](db['AnalyticCustomReport'][_0x7215('0x2f')],function(_0x433e0b){return{'name':_0x433e0b[_0x7215('0x30')],'type':_0x433e0b[_0x7215('0x31')]['key']};});_0x536905['model']=_[_0x7215('0x2e')](_0x2c119c,_0x7215('0x2b'));_0x536905[_0x7215('0x32')]=_['keys'](_0x13a56c[_0x7215('0x32')]);_0x536905[_0x7215('0x33')]=_[_0x7215('0x34')](_0x536905[_0x7215('0x35')],_0x536905[_0x7215('0x32')]);_0x1a56ed[_0x7215('0x36')]=_[_0x7215('0x34')](_0x536905[_0x7215('0x35')],qs[_0x7215('0x37')](_0x13a56c[_0x7215('0x32')][_0x7215('0x37')]));_0x1a56ed[_0x7215('0x36')]=_0x1a56ed['attributes']['length']?_0x1a56ed[_0x7215('0x36')]:_0x536905['model'];if(!_0x13a56c[_0x7215('0x32')]['hasOwnProperty'](_0x7215('0x38'))){_0x1a56ed['limit']=qs[_0x7215('0x39')](_0x13a56c[_0x7215('0x32')]['limit']);_0x1a56ed['offset']=qs[_0x7215('0x1e')](_0x13a56c[_0x7215('0x32')][_0x7215('0x1e')]);}_0x1a56ed[_0x7215('0x3a')]=qs['sort'](_0x13a56c[_0x7215('0x32')][_0x7215('0x3b')]);_0x1a56ed[_0x7215('0x3c')]=qs[_0x7215('0x33')](_[_0x7215('0x3d')](_0x13a56c['query'],_0x536905[_0x7215('0x33')]),_0x2c119c);if(_0x13a56c['query'][_0x7215('0x3e')]){_0x1a56ed[_0x7215('0x3c')]=_[_0x7215('0x3f')](_0x1a56ed[_0x7215('0x3c')],{'$or':_[_0x7215('0x2e')](_0x2c119c,function(_0x304fa1){if(_0x304fa1['type']!=='VIRTUAL'){var _0xfadcf4={};_0xfadcf4[_0x304fa1[_0x7215('0x2b')]]={'$like':'%'+_0x13a56c[_0x7215('0x32')][_0x7215('0x3e')]+'%'};return _0xfadcf4;}})});}_0x1a56ed=_[_0x7215('0x3f')]({},_0x1a56ed,_0x13a56c[_0x7215('0x40')]);var _0x20635c={'where':_0x1a56ed[_0x7215('0x3c')]};return db[_0x7215('0x41')][_0x7215('0x42')](_0x20635c)['then'](function(_0x4beb23){_0x326bc6[_0x7215('0x42')]=_0x4beb23;if(_0x13a56c[_0x7215('0x32')][_0x7215('0x43')]){_0x1a56ed[_0x7215('0x44')]=[{'all':!![]}];}return db[_0x7215('0x41')][_0x7215('0x45')](_0x1a56ed);})[_0x7215('0x23')](function(_0x208355){_0x326bc6['rows']=_0x208355;return _0x326bc6;})[_0x7215('0x23')](respondWithFilteredResult(_0x167023,_0x1a56ed))['catch'](handleError(_0x167023,null));};exports['show']=function(_0x261b28,_0x30f8f8){var _0x543966={'raw':![],'where':{'id':_0x261b28[_0x7215('0x46')]['id']}},_0x5b7346={};_0x5b7346['model']=_[_0x7215('0x47')](db[_0x7215('0x41')]['rawAttributes']);_0x5b7346[_0x7215('0x32')]=_[_0x7215('0x47')](_0x261b28[_0x7215('0x32')]);_0x5b7346[_0x7215('0x33')]=_[_0x7215('0x34')](_0x5b7346[_0x7215('0x35')],_0x5b7346[_0x7215('0x32')]);_0x543966[_0x7215('0x36')]=_['intersection'](_0x5b7346[_0x7215('0x35')],qs[_0x7215('0x37')](_0x261b28[_0x7215('0x32')]['fields']));_0x543966[_0x7215('0x36')]=_0x543966[_0x7215('0x36')]['length']?_0x543966[_0x7215('0x36')]:_0x5b7346['model'];if(_0x261b28[_0x7215('0x32')]['includeAll']){_0x543966[_0x7215('0x44')]=[{'all':!![]}];}_0x543966=_[_0x7215('0x3f')]({},_0x543966,_0x261b28[_0x7215('0x40')]);return db[_0x7215('0x41')]['find'](_0x543966)[_0x7215('0x23')](handleEntityNotFound(_0x30f8f8,null))[_0x7215('0x23')](respondWithResult(_0x30f8f8,null))['catch'](handleError(_0x30f8f8,null));};exports[_0x7215('0x48')]=function(_0x4ce247,_0x5e70dd){return db['AnalyticCustomReport'][_0x7215('0x48')](_0x4ce247[_0x7215('0x49')],{})[_0x7215('0x23')](function(_0x44a4d8){var _0x568943=_0x4ce247[_0x7215('0x4a')][_0x7215('0x25')]({'plain':!![]});if(!_0x568943)throw new Error(_0x7215('0x4b'));if(_0x568943['role']==='user'){var _0xc2c45d=_0x44a4d8[_0x7215('0x25')]({'plain':!![]});var _0x610a6a='Reports';return db[_0x7215('0x4c')][_0x7215('0x4d')]({'where':{'name':_0x610a6a,'userProfileId':_0x568943['userProfileId']},'raw':!![]})[_0x7215('0x23')](function(_0x353943){if(_0x353943&&_0x353943[_0x7215('0x4e')]===0x0){return db[_0x7215('0x27')][_0x7215('0x48')]({'name':_0xc2c45d['name'],'resourceId':_0xc2c45d['id'],'type':_0x7215('0x26'),'sectionId':_0x353943['id']},{})[_0x7215('0x23')](function(){return _0x44a4d8;});}else{return _0x44a4d8;}})[_0x7215('0x4f')](function(_0x38db02){logger[_0x7215('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38db02);throw _0x38db02;});}return _0x44a4d8;})[_0x7215('0x23')](respondWithResult(_0x5e70dd,0xc9))[_0x7215('0x4f')](handleError(_0x5e70dd,null));};exports[_0x7215('0x51')]=function(_0x437df5,_0x37cb02){if(_0x437df5[_0x7215('0x49')]['id']){delete _0x437df5[_0x7215('0x49')]['id'];}return db[_0x7215('0x41')][_0x7215('0x4d')]({'where':{'id':_0x437df5[_0x7215('0x46')]['id']}})['then'](handleEntityNotFound(_0x37cb02,null))[_0x7215('0x23')](saveUpdates(_0x437df5[_0x7215('0x49')],null))['then'](respondWithResult(_0x37cb02,null))[_0x7215('0x4f')](handleError(_0x37cb02,null));};exports[_0x7215('0x24')]=function(_0x509b69,_0x3a0bc1){return db['AnalyticCustomReport'][_0x7215('0x4d')]({'where':{'id':_0x509b69[_0x7215('0x46')]['id']}})['then'](handleEntityNotFound(_0x3a0bc1,null))['then'](removeEntity(_0x3a0bc1,null))['catch'](handleError(_0x3a0bc1,null));};exports[_0x7215('0x52')]=function(_0x56ff98,_0x53adb8){var _0x97cbd6=0xa;var _0xdef4d=['join',_0x7215('0x53'),_0x7215('0x54'),_0x7215('0x55')];var _0x54256c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x7215('0x56'),'MAX':_0x7215('0x57'),'MIN':_0x7215('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x7215('0x59'),'GROUP_CONCAT DESC':_0x7215('0x5a')};var _0x54f0ed={'SEC_TO_TIME':_0x7215('0x5b'),'DATE':_0x7215('0x5c'),'HOUR':_0x7215('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x7215('0x5e')};var _0x5c3436=function(_0x251f7e){return!_[_0x7215('0x5f')]([_0x7215('0x60'),_0x7215('0x61'),_0x7215('0x62'),_0x7215('0x63')],_0x251f7e);};var _0x3492be=function(_0x4f3fd3){if(!_0x4f3fd3||!_0x4f3fd3[_0x7215('0x64')][_0x7215('0x65')]){return'';}for(var _0x426c2b='(',_0xe6fda8=0x0;_0xe6fda8<_0x4f3fd3[_0x7215('0x64')][_0x7215('0x65')];_0xe6fda8+=0x1){_0xe6fda8>0x0&&(_0x426c2b+='\x20'+_0x4f3fd3[_0x7215('0x66')]+'\x20');_0x426c2b+=_0x4f3fd3[_0x7215('0x64')][_0xe6fda8][_0x7215('0x67')]?_0x3492be(_0x4f3fd3[_0x7215('0x64')][_0xe6fda8][_0x7215('0x67')]):_0x4f3fd3[_0x7215('0x64')][_0xe6fda8][_0x7215('0x68')]+'\x20'+_0x4f3fd3['rules'][_0xe6fda8][_0x7215('0x69')]+(_0x5c3436(_0x4f3fd3['rules'][_0xe6fda8][_0x7215('0x69')])?'\x20'+_0x4f3fd3[_0x7215('0x64')][_0xe6fda8][_0x7215('0x6a')]:'');}return _0x426c2b+')';};var _0x1f7253={'where':{'id':_0x56ff98[_0x7215('0x46')]['id']}},_0x20266a,_0x204fdd,_0x5cf41c,_0x2ac62f,_0x551b1b;_0x1f7253=_[_0x7215('0x3f')]({},_0x1f7253,_0x56ff98[_0x7215('0x40')]);return db['AnalyticCustomReport'][_0x7215('0x4d')](_0x1f7253)[_0x7215('0x23')](function(_0x34f9cd){if(_0x34f9cd){_0x20266a=_0x34f9cd;return _0x34f9cd[_0x7215('0x6b')]();}return null;})[_0x7215('0x23')](function(_0x429ba4){if(_0x429ba4){if(!_0x429ba4[_0x7215('0x65')]){throw new db[(_0x7215('0x6c'))][(_0x7215('0x6d'))](_0x7215('0x6e'),0x193);}_0x204fdd=_0x429ba4;return db[_0x7215('0x6f')][_0x7215('0x45')]({'raw':!![]});}return null;})['then'](function(_0x1d2579){if(_0x1d2579){_0x5cf41c=_[_0x7215('0x70')](_0x1d2579,'id');var _0x42583b;var _0x2aa73f=squel[_0x7215('0x71')]();_0x2aa73f[_0x7215('0x72')](_0x20266a[_0x7215('0x73')]);for(var _0x2b2533=0x0;_0x2b2533<_0x204fdd[_0x7215('0x65')];_0x2b2533+=0x1){_0x42583b=_0x204fdd[_0x2b2533][_0x7215('0x74')]?_0x5cf41c[_0x204fdd[_0x2b2533][_0x7215('0x74')]][_0x7215('0x75')]:_0x204fdd[_0x2b2533][_0x7215('0x68')];_0x42583b=_0x204fdd[_0x2b2533][_0x7215('0x76')]?_[_0x7215('0x77')](_0x54256c[_0x204fdd[_0x2b2533][_0x7215('0x76')]],'%s',_0x42583b):_0x42583b;_0x42583b=_0x204fdd[_0x2b2533][_0x7215('0x78')]?_['replace'](_0x54f0ed[_0x204fdd[_0x2b2533]['format']],'%s',_0x42583b):_0x42583b;if(_0x204fdd[_0x2b2533][_0x7215('0x79')]){_0x2aa73f[_0x7215('0x67')](_0x42583b);}_0x204fdd[_0x2b2533][_0x7215('0x7a')]&&_0x2aa73f[_0x7215('0x3a')](_0x42583b,_0x204fdd[_0x2b2533][_0x7215('0x7a')]==='DESC'?![]:!![]);_0x2aa73f[_0x7215('0x68')](_0x42583b,_0x204fdd[_0x2b2533][_0x7215('0x7b')]||_0x42583b);}if(_0x20266a[_0x7215('0x7c')]){_0x20266a[_0x7215('0x7c')]=JSON[_0x7215('0x7d')](_0x20266a[_0x7215('0x7c')]);for(var _0x84c430=0x0;_0x84c430<_0x20266a['joins'][_0x7215('0x65')];_0x84c430+=0x1){if(_0x20266a['joins'][_0x84c430][_0x7215('0x31')]&&_['includes'](_0xdef4d,_0x20266a['joins'][_0x84c430][_0x7215('0x31')])&&_0x20266a[_0x7215('0x7c')][_0x84c430][_0x7215('0x7e')]&&_0x20266a[_0x7215('0x7c')][_0x84c430][_0x7215('0x7f')]&&_0x20266a[_0x7215('0x7c')][_0x84c430][_0x7215('0x80')]){_0x2aa73f[_0x20266a[_0x7215('0x7c')][_0x84c430]['type']](_0x20266a[_0x7215('0x7c')][_0x84c430][_0x7215('0x7f')],null,util[_0x7215('0x78')]('%s.%s\x20=\x20%s.%s',_0x20266a[_0x7215('0x73')],_0x20266a[_0x7215('0x7c')][_0x84c430]['parentKey'],_0x20266a['joins'][_0x84c430][_0x7215('0x7f')],_0x20266a['joins'][_0x84c430]['foreignKey']));}}}if(_0x20266a[_0x7215('0x81')]){_0x20266a['conditions']=JSON[_0x7215('0x7d')](_0x20266a[_0x7215('0x81')]);_0x2aa73f[_0x7215('0x3c')](_0x3492be(_0x20266a['conditions'][_0x7215('0x67')]));}_0x551b1b=_0x2aa73f['clone']();_0x2aa73f['limit'](_0x97cbd6);_0x2aa73f[_0x7215('0x1e')](0x0);logger['debug'](_0x7215('0x82'),_0x2aa73f[_0x7215('0x83')]());return dbH[_0x7215('0x84')][_0x7215('0x32')](_0x2aa73f[_0x7215('0x83')](),{'type':dbH[_0x7215('0x84')][_0x7215('0x85')][_0x7215('0x86')]});}})[_0x7215('0x23')](respondWithResult(_0x53adb8,null))['catch'](handleError(_0x53adb8,null));};function runReport(_0x55aaaf,_0x2ef9bd,_0x221760){var _0x3a7f55=_0x2ef9bd[_0x7215('0x2b')];var _0x22c54a=0xa;var _0x395c71=[_0x7215('0x87'),'left_join','right_join','cross_join'];var _0x12553f={'SUM':_0x7215('0x88'),'COUNT':_0x7215('0x89'),'COUNT DISTINCT':_0x7215('0x56'),'MAX':_0x7215('0x57'),'MIN':_0x7215('0x58'),'AVG':_0x7215('0x8a'),'GROUP_CONCAT':_0x7215('0x8b'),'GROUP_CONCAT ASC':_0x7215('0x59'),'GROUP_CONCAT DESC':_0x7215('0x5a')};var _0x37652a={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x7215('0x5c'),'HOUR':_0x7215('0x5d'),'ROUND':_0x7215('0x8c'),'UNIX_TIMESTAMP':_0x7215('0x5e')};var _0x21ea5d=function(_0x21c93d){return!_[_0x7215('0x5f')]([_0x7215('0x60'),_0x7215('0x61'),_0x7215('0x62'),_0x7215('0x63')],_0x21c93d);};var _0x2953eb=function(_0x389895){if(!_0x389895||!_0x389895[_0x7215('0x64')][_0x7215('0x65')]){return'';}for(var _0x4ad508='(',_0x40ec64=0x0;_0x40ec64<_0x389895[_0x7215('0x64')][_0x7215('0x65')];_0x40ec64+=0x1){_0x40ec64>0x0&&(_0x4ad508+='\x20'+_0x389895[_0x7215('0x66')]+'\x20');_0x4ad508+=_0x389895[_0x7215('0x64')][_0x40ec64][_0x7215('0x67')]?_0x2953eb(_0x389895[_0x7215('0x64')][_0x40ec64][_0x7215('0x67')]):_0x389895['rules'][_0x40ec64]['field']+'\x20'+_0x389895[_0x7215('0x64')][_0x40ec64][_0x7215('0x69')]+(_0x21ea5d(_0x389895[_0x7215('0x64')][_0x40ec64][_0x7215('0x69')])?'\x20'+_0x389895['rules'][_0x40ec64][_0x7215('0x6a')]:'');}return _0x4ad508+')';};var _0xde21dd={'where':{'id':_0x55aaaf['id']}},_0x17a9fc,_0xcb933a,_0x53a96c,_0x30b8aa,_0x30c4a2;_0xde21dd=_[_0x7215('0x3f')]({},_0xde21dd,_0x221760);return db[_0x7215('0x41')][_0x7215('0x4d')](_0xde21dd)[_0x7215('0x23')](function(_0x466bd7){if(_0x466bd7){_0x17a9fc=_0x466bd7;return _0x466bd7[_0x7215('0x6b')]();}return null;})['then'](function(_0x1a2242){if(_0x1a2242){if(!_0x1a2242[_0x7215('0x65')]){throw new db[(_0x7215('0x6c'))][(_0x7215('0x6d'))](_0x7215('0x6e'),0x193);}_0xcb933a=_0x1a2242;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x7215('0x23')](function(_0x5d28b5){if(_0x5d28b5){_0x53a96c=_[_0x7215('0x70')](_0x5d28b5,'id');var _0x260d16;var _0x4947cd=squel[_0x7215('0x71')]();_0x4947cd[_0x7215('0x72')](_0x17a9fc['table']);for(var _0x46f283=0x0;_0x46f283<_0xcb933a[_0x7215('0x65')];_0x46f283+=0x1){_0x260d16=_0xcb933a[_0x46f283][_0x7215('0x74')]?_0x53a96c[_0xcb933a[_0x46f283][_0x7215('0x74')]][_0x7215('0x75')]:_0xcb933a[_0x46f283]['field'];_0x260d16=_0xcb933a[_0x46f283][_0x7215('0x76')]?_[_0x7215('0x77')](_0x12553f[_0xcb933a[_0x46f283][_0x7215('0x76')]],'%s',_0x260d16):_0x260d16;_0x260d16=_0xcb933a[_0x46f283][_0x7215('0x78')]?_[_0x7215('0x77')](_0x37652a[_0xcb933a[_0x46f283][_0x7215('0x78')]],'%s',_0x260d16):_0x260d16;if(_0xcb933a[_0x46f283][_0x7215('0x79')]){_0x4947cd[_0x7215('0x67')](_0x260d16);}_0xcb933a[_0x46f283][_0x7215('0x7a')]&&_0x4947cd['order'](_0x260d16,_0xcb933a[_0x46f283][_0x7215('0x7a')]===_0x7215('0x8d')?![]:!![]);_0x4947cd[_0x7215('0x68')](_0x260d16,_0xcb933a[_0x46f283]['alias']||_0x260d16);}if(_0x17a9fc[_0x7215('0x7c')]){_0x17a9fc[_0x7215('0x7c')]=JSON['parse'](_0x17a9fc[_0x7215('0x7c')]);for(var _0x4e574f=0x0;_0x4e574f<_0x17a9fc[_0x7215('0x7c')][_0x7215('0x65')];_0x4e574f+=0x1){if(_0x17a9fc[_0x7215('0x7c')][_0x4e574f][_0x7215('0x31')]&&_[_0x7215('0x5f')](_0x395c71,_0x17a9fc['joins'][_0x4e574f][_0x7215('0x31')])&&_0x17a9fc[_0x7215('0x7c')][_0x4e574f][_0x7215('0x7e')]&&_0x17a9fc[_0x7215('0x7c')][_0x4e574f][_0x7215('0x7f')]&&_0x17a9fc[_0x7215('0x7c')][_0x4e574f][_0x7215('0x80')]){_0x4947cd[_0x17a9fc[_0x7215('0x7c')][_0x4e574f][_0x7215('0x31')]](_0x17a9fc[_0x7215('0x7c')][_0x4e574f][_0x7215('0x7f')],null,util['format'](_0x7215('0x8e'),_0x17a9fc[_0x7215('0x73')],_0x17a9fc[_0x7215('0x7c')][_0x4e574f][_0x7215('0x7e')],_0x17a9fc[_0x7215('0x7c')][_0x4e574f][_0x7215('0x7f')],_0x17a9fc[_0x7215('0x7c')][_0x4e574f][_0x7215('0x80')]));}}}if(_0x17a9fc[_0x7215('0x81')]){_0x17a9fc[_0x7215('0x81')]=JSON[_0x7215('0x7d')](_0x17a9fc[_0x7215('0x81')]);_0x4947cd[_0x7215('0x3c')](_0x2953eb(_0x17a9fc[_0x7215('0x81')][_0x7215('0x67')]));}_0x30c4a2=_0x4947cd[_0x7215('0x8f')]();_0x4947cd[_0x7215('0x39')](_0x22c54a);_0x4947cd[_0x7215('0x1e')](0x0);return;}})['then'](function(){if(_0x2ef9bd[_0x7215('0x90')]===_0x7215('0x91')){return null;}var _0x290b9a=_[_0x7215('0x3f')](_0x2ef9bd,{'name':_0x2ef9bd[_0x7215('0x92')]||_0x2ef9bd[_0x7215('0x2b')]||_0x17a9fc['name'],'basename':_0x3a7f55,'savename':util[_0x7215('0x78')](_0x7215('0x93'),_0x2ef9bd['name']||_0x17a9fc[_0x7215('0x2b')],require(_0x7215('0x94'))['generate'](0x4),_0x2ef9bd[_0x7215('0x90')]||_0x7215('0x95')),'reportId':_0x17a9fc['id'],'reportType':_0x7215('0x96')});return db[_0x7215('0x97')][_0x7215('0x48')](_0x290b9a,{'raw':!![]});})[_0x7215('0x23')](function(_0x2ac79f){if(_0x17a9fc['table']===_0x7215('0x98')){_0x30c4a2[_0x7215('0x3c')](_0x17a9fc['table']+_0x7215('0x99'),_0x2ef9bd[_0x7215('0x9a')],_0x2ef9bd['endDate']);}else{_0x30c4a2[_0x7215('0x3c')](_0x17a9fc['table']+_0x7215('0x9b'),_0x2ef9bd[_0x7215('0x9a')],_0x2ef9bd[_0x7215('0x9c')]);}if(_0x2ac79f){logger[_0x7215('0x9d')]('Run\x20Query:',_0x30c4a2[_0x7215('0x83')]());require('child_process')['fork'](path['join'](__dirname,_0x7215('0x9e'),_0x2ac79f[_0x7215('0x90')]),[_0x2ac79f['id'],_0x30c4a2['toString'](),path[_0x7215('0x87')](__dirname,_0x7215('0x9f'),_0x2ac79f[_0x7215('0xa0')]),_0x3a7f55]);return _0x2ac79f;}else{var _0x323bdf=squel['select']();_0x323bdf[_0x7215('0x72')]('('+_0x30c4a2[_0x7215('0x83')]()+')',_0x7215('0xa1'));_0x323bdf[_0x7215('0x68')](_0x7215('0xa2'),_0x7215('0x42'));_0x30c4a2[_0x7215('0x39')](_0x2ef9bd[_0x7215('0x39')]||_0x22c54a);_0x30c4a2[_0x7215('0x1e')](_0x2ef9bd[_0x7215('0x1e')]||0x0);return dbH['sequelize']['query'](_0x323bdf[_0x7215('0x83')](),{'type':dbH['sequelize'][_0x7215('0x85')][_0x7215('0x86')]})['then'](function(_0x30b388){if(!_0x30b388[_0x7215('0x65')]){_0x30b8aa=0x0;}else{_0x30b8aa=_0x30b388[0x0][_0x7215('0x42')]||0x0;}return dbH[_0x7215('0x84')]['query'](_0x30c4a2[_0x7215('0x83')](),{'type':dbH[_0x7215('0x84')][_0x7215('0x85')][_0x7215('0x86')]});})[_0x7215('0x23')](function(_0x220c48){return{'rows':_0x220c48||[],'count':_0x30b8aa};});}});}exports['run']=function(_0x3ac5a7,_0x1fb56f){return runReport(_0x3ac5a7[_0x7215('0x46')],_0x3ac5a7[_0x7215('0x32')],_0x3ac5a7[_0x7215('0x40')])[_0x7215('0x23')](respondWithResult(_0x1fb56f,null))['catch'](handleError(_0x1fb56f,null));};exports[_0x7215('0xa3')]=runReport;exports[_0x7215('0x32')]=function(_0x23c78f,_0x8b770a){var _0x45478e=0xa;var _0xf5d951=['join',_0x7215('0x53'),_0x7215('0x54'),_0x7215('0x55')];var _0x12439a={'SUM':_0x7215('0x88'),'COUNT':_0x7215('0x89'),'COUNT DISTINCT':_0x7215('0x56'),'MAX':'MAX(%s)','MIN':_0x7215('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x7215('0x59'),'GROUP_CONCAT DESC':_0x7215('0x5a')};var _0x122477={'SEC_TO_TIME':_0x7215('0x5b'),'DATE':_0x7215('0x5c'),'HOUR':'HOUR(%s)','ROUND':_0x7215('0x8c'),'UNIX_TIMESTAMP':_0x7215('0x5e')};var _0x2ee270=function(_0x3b341b){return!_[_0x7215('0x5f')](['IS\x20NULL',_0x7215('0x61'),_0x7215('0x62'),_0x7215('0x63')],_0x3b341b);};var _0x45b401=function(_0x478e8b){if(!_0x478e8b||!_0x478e8b[_0x7215('0x64')][_0x7215('0x65')]){return'';}for(var _0x5d8b8b='(',_0x52a460=0x0;_0x52a460<_0x478e8b[_0x7215('0x64')][_0x7215('0x65')];_0x52a460+=0x1){_0x52a460>0x0&&(_0x5d8b8b+='\x20'+_0x478e8b[_0x7215('0x66')]+'\x20');_0x5d8b8b+=_0x478e8b[_0x7215('0x64')][_0x52a460]['group']?_0x45b401(_0x478e8b[_0x7215('0x64')][_0x52a460][_0x7215('0x67')]):_0x478e8b[_0x7215('0x64')][_0x52a460]['field']+'\x20'+_0x478e8b['rules'][_0x52a460]['condition']+(_0x2ee270(_0x478e8b[_0x7215('0x64')][_0x52a460][_0x7215('0x69')])?'\x20'+_0x478e8b[_0x7215('0x64')][_0x52a460][_0x7215('0x6a')]:'');}return _0x5d8b8b+')';};var _0x4f9925={'where':{'id':_0x23c78f[_0x7215('0x46')]['id']}},_0x3bcc7d,_0x5140b8,_0x115844,_0x351d58,_0x29d236;_0x4f9925=_[_0x7215('0x3f')]({},_0x4f9925,_0x23c78f[_0x7215('0x40')]);return db[_0x7215('0x41')][_0x7215('0x4d')](_0x4f9925)[_0x7215('0x23')](function(_0x2667ec){if(_0x2667ec){_0x3bcc7d=_0x2667ec;return _0x2667ec[_0x7215('0x6b')]();}return null;})[_0x7215('0x23')](function(_0xc5886d){if(_0xc5886d){if(!_0xc5886d['length']){throw new db[(_0x7215('0x6c'))][(_0x7215('0x6d'))](_0x7215('0x6e'),0x193);}_0x5140b8=_0xc5886d;return db['AnalyticMetric'][_0x7215('0x45')]({'raw':!![]});}return null;})['then'](function(_0x2c984a){if(_0x2c984a){_0x115844=_[_0x7215('0x70')](_0x2c984a,'id');var _0x5be6ea;var _0x121315=squel['select']();_0x121315[_0x7215('0x72')](_0x3bcc7d[_0x7215('0x73')]);for(var _0x598518=0x0;_0x598518<_0x5140b8['length'];_0x598518+=0x1){_0x5be6ea=_0x5140b8[_0x598518][_0x7215('0x74')]?_0x115844[_0x5140b8[_0x598518][_0x7215('0x74')]][_0x7215('0x75')]:_0x5140b8[_0x598518][_0x7215('0x68')];_0x5be6ea=_0x5140b8[_0x598518][_0x7215('0x76')]?_[_0x7215('0x77')](_0x12439a[_0x5140b8[_0x598518][_0x7215('0x76')]],'%s',_0x5be6ea):_0x5be6ea;_0x5be6ea=_0x5140b8[_0x598518][_0x7215('0x78')]?_[_0x7215('0x77')](_0x122477[_0x5140b8[_0x598518][_0x7215('0x78')]],'%s',_0x5be6ea):_0x5be6ea;if(_0x5140b8[_0x598518][_0x7215('0x79')]){_0x121315[_0x7215('0x67')](_0x5be6ea);}_0x5140b8[_0x598518]['orderBy']&&_0x121315[_0x7215('0x3a')](_0x5be6ea,_0x5140b8[_0x598518]['orderBy']==='DESC'?![]:!![]);_0x121315['field'](_0x5be6ea,_0x5140b8[_0x598518][_0x7215('0x7b')]||_0x5be6ea);}if(_0x3bcc7d['joins']){_0x3bcc7d['joins']=JSON[_0x7215('0x7d')](_0x3bcc7d[_0x7215('0x7c')]);for(var _0x441995=0x0;_0x441995<_0x3bcc7d['joins'][_0x7215('0x65')];_0x441995+=0x1){if(_0x3bcc7d[_0x7215('0x7c')][_0x441995][_0x7215('0x31')]&&_['includes'](_0xf5d951,_0x3bcc7d[_0x7215('0x7c')][_0x441995][_0x7215('0x31')])&&_0x3bcc7d[_0x7215('0x7c')][_0x441995]['parentKey']&&_0x3bcc7d[_0x7215('0x7c')][_0x441995][_0x7215('0x7f')]&&_0x3bcc7d[_0x7215('0x7c')][_0x441995][_0x7215('0x80')]){_0x121315[_0x3bcc7d[_0x7215('0x7c')][_0x441995][_0x7215('0x31')]](_0x3bcc7d['joins'][_0x441995][_0x7215('0x7f')],null,util[_0x7215('0x78')](_0x7215('0x8e'),_0x3bcc7d[_0x7215('0x73')],_0x3bcc7d[_0x7215('0x7c')][_0x441995][_0x7215('0x7e')],_0x3bcc7d[_0x7215('0x7c')][_0x441995][_0x7215('0x7f')],_0x3bcc7d[_0x7215('0x7c')][_0x441995][_0x7215('0x80')]));}}}if(_0x3bcc7d[_0x7215('0x81')]){_0x3bcc7d[_0x7215('0x81')]=JSON[_0x7215('0x7d')](_0x3bcc7d[_0x7215('0x81')]);_0x121315[_0x7215('0x3c')](_0x45b401(_0x3bcc7d[_0x7215('0x81')][_0x7215('0x67')]));}_0x29d236=_0x121315[_0x7215('0x8f')]();_0x121315[_0x7215('0x39')](_0x45478e);_0x121315[_0x7215('0x1e')](0x0);logger[_0x7215('0xa4')]('Limited\x20Query:',_0x121315[_0x7215('0x83')]());return dbH['sequelize'][_0x7215('0x32')](_0x121315[_0x7215('0x83')](),{'type':dbH[_0x7215('0x84')][_0x7215('0x85')][_0x7215('0x86')]});}})[_0x7215('0x23')](function(){return{'sql':_0x29d236[_0x7215('0x83')]()};})['then'](respondWithResult(_0x8b770a,null))[_0x7215('0x4f')](handleError(_0x8b770a,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index e14fa78..a784359 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 _0x1f7b=['bluebird','request-promise','path','rimraf','define','analytics_custom_reports','lodash','../../config/logger','api','moment'];(function(_0x33a364,_0x4b904a){var _0x34fa78=function(_0x37aef6){while(--_0x37aef6){_0x33a364['push'](_0x33a364['shift']());}};_0x34fa78(++_0x4b904a);}(_0x1f7b,0x1b4));var _0xb1f7=function(_0x532685,_0x1a38c2){_0x532685=_0x532685-0x0;var _0x21426a=_0x1f7b[_0x532685];return _0x21426a;};'use strict';var _=require(_0xb1f7('0x0'));var util=require('util');var logger=require(_0xb1f7('0x1'))(_0xb1f7('0x2'));var moment=require(_0xb1f7('0x3'));var BPromise=require(_0xb1f7('0x4'));var rp=require(_0xb1f7('0x5'));var fs=require('fs');var path=require(_0xb1f7('0x6'));var rimraf=require(_0xb1f7('0x7'));var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module['exports']=function(_0x19cc78,_0x287664){return _0x19cc78[_0xb1f7('0x8')]('AnalyticCustomReport',attributes,{'tableName':_0xb1f7('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84d9=['AnalyticCustomReport','util','../../config/logger','api','bluebird','path','../../config/environment','./analyticCustomReport.attributes','exports','define'];(function(_0x5272e0,_0x169ce5){var _0xa4fc96=function(_0x4f359a){while(--_0x4f359a){_0x5272e0['push'](_0x5272e0['shift']());}};_0xa4fc96(++_0x169ce5);}(_0x84d9,0x1e1));var _0x984d=function(_0x9add26,_0x1eec23){_0x9add26=_0x9add26-0x0;var _0x1895b8=_0x84d9[_0x9add26];return _0x1895b8;};'use strict';var _=require('lodash');var util=require(_0x984d('0x0'));var logger=require(_0x984d('0x1'))(_0x984d('0x2'));var moment=require('moment');var BPromise=require(_0x984d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x984d('0x4'));var rimraf=require('rimraf');var config=require(_0x984d('0x5'));var attributes=require(_0x984d('0x6'));module[_0x984d('0x7')]=function(_0x2a8a2d,_0x4ce401){return _0x2a8a2d[_0x984d('0x8')](_0x984d('0x9'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 0cd0da1..031190f 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 _0xd4f5=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment'];(function(_0x28fa8f,_0x110107){var _0x520903=function(_0x5ba257){while(--_0x5ba257){_0x28fa8f['push'](_0x28fa8f['shift']());}};_0x520903(++_0x110107);}(_0xd4f5,0x1d8));var _0x5d4f=function(_0x265468,_0xcf7439){_0x265468=_0x265468-0x0;var _0x37d555=_0xd4f5[_0x265468];return _0x37d555;};'use strict';var _=require(_0x5d4f('0x0'));var util=require(_0x5d4f('0x1'));var moment=require(_0x5d4f('0x2'));var BPromise=require(_0x5d4f('0x3'));var rs=require(_0x5d4f('0x4'));var fs=require('fs');var Redis=require(_0x5d4f('0x5'));var db=require(_0x5d4f('0x6'))['db'];var utils=require(_0x5d4f('0x7'));var logger=require(_0x5d4f('0x8'))('rpc');var config=require(_0x5d4f('0x9'));var jayson=require(_0x5d4f('0xa'));var client=jayson[_0x5d4f('0xb')][_0x5d4f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ccd25,_0x4dac21,_0x4833ab){return new BPromise(function(_0x1bf35e,_0x3f64dc){return client[_0x5d4f('0xd')](_0x2ccd25,_0x4833ab)[_0x5d4f('0xe')](function(_0xa2625){logger[_0x5d4f('0xf')](_0x5d4f('0x10'),_0x4dac21,_0x5d4f('0x11'));logger['debug'](_0x5d4f('0x12'),_0x4dac21,_0x5d4f('0x11'),JSON[_0x5d4f('0x13')](_0xa2625));if(_0xa2625['error']){if(_0xa2625['error'][_0x5d4f('0x14')]===0x1f4){logger[_0x5d4f('0x15')](_0x5d4f('0x10'),_0x4dac21,_0xa2625[_0x5d4f('0x15')]['message']);return _0x3f64dc(_0xa2625[_0x5d4f('0x15')][_0x5d4f('0x16')]);}logger[_0x5d4f('0x15')](_0x5d4f('0x10'),_0x4dac21,_0xa2625[_0x5d4f('0x15')]['message']);return _0x1bf35e(_0xa2625[_0x5d4f('0x15')][_0x5d4f('0x16')]);}else{logger['info'](_0x5d4f('0x10'),_0x4dac21,'request\x20sent');_0x1bf35e(_0xa2625[_0x5d4f('0x17')][_0x5d4f('0x16')]);}})[_0x5d4f('0x18')](function(_0x36ee32){logger[_0x5d4f('0x15')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4dac21,_0x36ee32);_0x3f64dc(_0x36ee32);});});} \ No newline at end of file +var _0x4b47=['util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b47,0x99));var _0x74b4=function(_0x30c632,_0x239590){_0x30c632=_0x30c632-0x0;var _0x49e0d4=_0x4b47[_0x30c632];return _0x49e0d4;};'use strict';var _=require(_0x74b4('0x0'));var util=require(_0x74b4('0x1'));var moment=require(_0x74b4('0x2'));var BPromise=require('bluebird');var rs=require(_0x74b4('0x3'));var fs=require('fs');var Redis=require(_0x74b4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x74b4('0x5'));var logger=require(_0x74b4('0x6'))('rpc');var config=require(_0x74b4('0x7'));var jayson=require(_0x74b4('0x8'));var client=jayson[_0x74b4('0x9')][_0x74b4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x472d69,_0xcabded,_0x340013){return new BPromise(function(_0x2f9ea7,_0x71a2ed){return client[_0x74b4('0xb')](_0x472d69,_0x340013)[_0x74b4('0xc')](function(_0x49836e){logger[_0x74b4('0xd')](_0x74b4('0xe'),_0xcabded,_0x74b4('0xf'));logger[_0x74b4('0x10')](_0x74b4('0x11'),_0xcabded,_0x74b4('0xf'),JSON[_0x74b4('0x12')](_0x49836e));if(_0x49836e[_0x74b4('0x13')]){if(_0x49836e[_0x74b4('0x13')][_0x74b4('0x14')]===0x1f4){logger[_0x74b4('0x13')](_0x74b4('0xe'),_0xcabded,_0x49836e[_0x74b4('0x13')][_0x74b4('0x15')]);return _0x71a2ed(_0x49836e['error']['message']);}logger['error'](_0x74b4('0xe'),_0xcabded,_0x49836e[_0x74b4('0x13')][_0x74b4('0x15')]);return _0x2f9ea7(_0x49836e['error'][_0x74b4('0x15')]);}else{logger[_0x74b4('0xd')](_0x74b4('0xe'),_0xcabded,'request\x20sent');_0x2f9ea7(_0x49836e['result']['message']);}})['catch'](function(_0x49fdeb){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0xcabded,_0x49fdeb);_0x71a2ed(_0x49fdeb);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 2726e0f..5351c69 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 _0x983e=['../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','query','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x279755,_0x42ad77){var _0x138178=function(_0x462033){while(--_0x462033){_0x279755['push'](_0x279755['shift']());}};_0x138178(++_0x42ad77);}(_0x983e,0x1c0));var _0xe983=function(_0x285252,_0x113b0f){_0x285252=_0x285252-0x0;var _0xbb1266=_0x983e[_0x285252];return _0xbb1266;};'use strict';var multer=require(_0xe983('0x0'));var util=require(_0xe983('0x1'));var path=require(_0xe983('0x2'));var timeout=require(_0xe983('0x3'));var express=require(_0xe983('0x4'));var router=express[_0xe983('0x5')]();var auth=require(_0xe983('0x6'));var interaction=require(_0xe983('0x7'));var config=require(_0xe983('0x8'));var controller=require(_0xe983('0x9'));router[_0xe983('0xa')]('/',auth[_0xe983('0xb')](),controller[_0xe983('0xc')]);router[_0xe983('0xa')](_0xe983('0xd'),auth[_0xe983('0xb')](),controller[_0xe983('0xe')]);router['get'](_0xe983('0xf'),auth[_0xe983('0xb')](),controller[_0xe983('0x10')]);router[_0xe983('0xa')](_0xe983('0x11'),auth[_0xe983('0xb')](),controller['run']);router[_0xe983('0xa')]('/:id/query',auth[_0xe983('0xb')](),controller[_0xe983('0x12')]);router['post']('/',auth[_0xe983('0xb')](),controller[_0xe983('0x13')]);router['put'](_0xe983('0xd'),auth[_0xe983('0xb')](),controller[_0xe983('0x14')]);router[_0xe983('0x15')](_0xe983('0xd'),auth[_0xe983('0xb')](),controller[_0xe983('0x16')]);module[_0xe983('0x17')]=router; \ No newline at end of file +var _0x6ac8=['put','delete','destroy','exports','multer','util','Router','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','/:id','show','/:id/preview','preview','run','post','create'];(function(_0x4a3f3e,_0x581f5b){var _0x1bf6c4=function(_0x106db6){while(--_0x106db6){_0x4a3f3e['push'](_0x4a3f3e['shift']());}};_0x1bf6c4(++_0x581f5b);}(_0x6ac8,0x134));var _0x86ac=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x6ac8[_0x5e36d1];return _0x950b9e;};'use strict';var multer=require(_0x86ac('0x0'));var util=require(_0x86ac('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x86ac('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x86ac('0x3'));var config=require(_0x86ac('0x4'));var controller=require(_0x86ac('0x5'));router[_0x86ac('0x6')]('/',auth[_0x86ac('0x7')](),controller['index']);router[_0x86ac('0x6')](_0x86ac('0x8'),auth[_0x86ac('0x7')](),controller[_0x86ac('0x9')]);router[_0x86ac('0x6')](_0x86ac('0xa'),auth['isAuthenticated'](),controller[_0x86ac('0xb')]);router[_0x86ac('0x6')]('/:id/run',auth['isAuthenticated'](),controller[_0x86ac('0xc')]);router[_0x86ac('0x6')]('/:id/query',auth[_0x86ac('0x7')](),controller['query']);router[_0x86ac('0xd')]('/',auth[_0x86ac('0x7')](),controller[_0x86ac('0xe')]);router[_0x86ac('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x86ac('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x86ac('0x11')]);module[_0x86ac('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 3fa2c88..0132767 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 _0x49b6=['TEXT','sequelize','exports','STRING'];(function(_0x300e3f,_0x34637a){var _0x2c008a=function(_0x1d55e7){while(--_0x1d55e7){_0x300e3f['push'](_0x300e3f['shift']());}};_0x2c008a(++_0x34637a);}(_0x49b6,0x1a1));var _0x649b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x49b6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x649b('0x0'));module[_0x649b('0x1')]={'name':{'type':Sequelize[_0x649b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x649b('0x2')]},'parent':{'type':Sequelize[_0x649b('0x2')]},'table':{'type':Sequelize[_0x649b('0x2')]},'conditions':{'type':Sequelize[_0x649b('0x3')]},'joins':{'type':Sequelize[_0x649b('0x3')]}}; \ No newline at end of file +var _0xff6e=['sequelize','exports','STRING','TEXT'];(function(_0x120fec,_0x15cf88){var _0x13c014=function(_0x4c1d7d){while(--_0x4c1d7d){_0x120fec['push'](_0x120fec['shift']());}};_0x13c014(++_0x15cf88);}(_0xff6e,0x154));var _0xeff6=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0xff6e[_0x4ae829];return _0x256b31;};'use strict';var Sequelize=require(_0xeff6('0x0'));module[_0xeff6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xeff6('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xeff6('0x3')]},'joins':{'type':Sequelize[_0xeff6('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index c16d218..55ecc84 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 _0x8cb8=['html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','squel','crypto','jsforce','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','offset','limit','set','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','include','find','catch','create','body','user','Reports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','MetricId','metric','function','replace','format','groupBy','order','orderBy','DESC','alias','joins','parentKey','foreignKey','foreignTable','table','conditions','parse','clone','debug','toString','sequelize','QueryTypes','SELECT','left_join','SUM(%s)','GROUP_CONCAT(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','value','AnalyticMetric','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','default','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(*)','count','run','runReport'];(function(_0x5e27f2,_0x434e8d){var _0x51f4c6=function(_0x2fdcbe){while(--_0x2fdcbe){_0x5e27f2['push'](_0x5e27f2['shift']());}};_0x51f4c6(++_0x434e8d);}(_0x8cb8,0xa8));var _0x88cb=function(_0x9e0cb3,_0x9cd497){_0x9e0cb3=_0x9e0cb3-0x0;var _0x5926b7=_0x8cb8[_0x9e0cb3];return _0x5926b7;};'use strict';var pdf=require(_0x88cb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x88cb('0x1'));var zipdir=require(_0x88cb('0x2'));var jsonpatch=require(_0x88cb('0x3'));var rp=require(_0x88cb('0x4'));var moment=require('moment');var BPromise=require(_0x88cb('0x5'));var Mustache=require(_0x88cb('0x6'));var util=require(_0x88cb('0x7'));var path=require(_0x88cb('0x8'));var sox=require(_0x88cb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x88cb('0xa'));var crypto=require(_0x88cb('0xb'));var jsforce=require(_0x88cb('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x88cb('0xd'));var querystring=require(_0x88cb('0xe'));var Papa=require(_0x88cb('0xf'));var Redis=require(_0x88cb('0x10'));var authService=require(_0x88cb('0x11'));var qs=require(_0x88cb('0x12'));var as=require(_0x88cb('0x13'));var hardwareService=require(_0x88cb('0x14'));var logger=require(_0x88cb('0x15'))(_0x88cb('0x16'));var utils=require(_0x88cb('0x17'));var config=require(_0x88cb('0x18'));var licenseUtil=require(_0x88cb('0x19'));var db=require('../../mysqldb')['db'];var dbH=require(_0x88cb('0x1a'))['dbH'];function respondWithStatusCode(_0x5aca59,_0x871f91){_0x871f91=_0x871f91||0xcc;return function(_0x5253a4){if(_0x5253a4){return _0x5aca59[_0x88cb('0x1b')](_0x871f91);}return _0x5aca59[_0x88cb('0x1c')](_0x871f91)[_0x88cb('0x1d')]();};}function respondWithResult(_0x11a3f3,_0x516e27){_0x516e27=_0x516e27||0xc8;return function(_0x54fdb7){if(_0x54fdb7){return _0x11a3f3[_0x88cb('0x1c')](_0x516e27)[_0x88cb('0x1e')](_0x54fdb7);}};}function respondWithFilteredResult(_0x4aa05a,_0x26576f){return function(_0xebfad7){if(_0xebfad7){var _0x3dc46f=_0xebfad7['count'],_0x5a5d96=_0x26576f['offset'],_0x57be73=_0x26576f[_0x88cb('0x1f')]+_0x26576f[_0x88cb('0x20')],_0x515bf1;if(_0x57be73>=_0x3dc46f){_0x57be73=_0x3dc46f;_0x515bf1=0xc8;}else{_0x515bf1=0xce;}_0x4aa05a['status'](_0x515bf1);return _0x4aa05a[_0x88cb('0x21')]('Content-Range',_0x5a5d96+'-'+_0x57be73+'/'+_0x3dc46f)['json'](_0xebfad7);}return null;};}function patchUpdates(_0x4cbec5){return function(_0x1e468e){try{jsonpatch[_0x88cb('0x22')](_0x1e468e,_0x4cbec5,!![]);}catch(_0x24a3a5){return BPromise[_0x88cb('0x23')](_0x24a3a5);}return _0x1e468e[_0x88cb('0x24')]();};}function saveUpdates(_0x34dd10,_0x1e5061){return function(_0x1f3740){if(_0x1f3740){return _0x1f3740[_0x88cb('0x25')](_0x34dd10)[_0x88cb('0x26')](function(_0x20fd83){return _0x20fd83;});}return null;};}function removeEntity(_0x231aee,_0xef70fe){return function(_0x3996c0){if(_0x3996c0){return _0x3996c0['destroy']()[_0x88cb('0x26')](function(){var _0x2fa769=_0x3996c0[_0x88cb('0x27')]({'plain':!![]});var _0x5f1a48=_0x88cb('0x28');return db[_0x88cb('0x29')][_0x88cb('0x2a')]({'where':{'type':_0x5f1a48,'resourceId':_0x2fa769['id']}})['then'](function(){return _0x3996c0;});})['then'](function(){_0x231aee[_0x88cb('0x1c')](0xcc)[_0x88cb('0x1d')]();});}};}function handleEntityNotFound(_0xc338f6,_0x129903){return function(_0x4db179){if(!_0x4db179){_0xc338f6[_0x88cb('0x1b')](0x194);}return _0x4db179;};}function handleError(_0x32da7f,_0x46b472){_0x46b472=_0x46b472||0x1f4;return function(_0x1d54aa){logger[_0x88cb('0x2b')](_0x1d54aa[_0x88cb('0x2c')]);if(_0x1d54aa[_0x88cb('0x2d')]){delete _0x1d54aa[_0x88cb('0x2d')];}_0x32da7f[_0x88cb('0x1c')](_0x46b472)[_0x88cb('0x2e')](_0x1d54aa);};}exports['index']=function(_0x2ab08b,_0x2667b6){var _0x59b9f0={},_0x42b3a8={},_0x5869a0={'count':0x0,'rows':[]};var _0x3b1f6a=_[_0x88cb('0x2f')](db[_0x88cb('0x30')][_0x88cb('0x31')],function(_0x62f864){return{'name':_0x62f864[_0x88cb('0x32')],'type':_0x62f864[_0x88cb('0x33')][_0x88cb('0x34')]};});_0x42b3a8[_0x88cb('0x35')]=_[_0x88cb('0x2f')](_0x3b1f6a,_0x88cb('0x2d'));_0x42b3a8[_0x88cb('0x36')]=_['keys'](_0x2ab08b[_0x88cb('0x36')]);_0x42b3a8[_0x88cb('0x37')]=_['intersection'](_0x42b3a8[_0x88cb('0x35')],_0x42b3a8[_0x88cb('0x36')]);_0x59b9f0[_0x88cb('0x38')]=_[_0x88cb('0x39')](_0x42b3a8[_0x88cb('0x35')],qs[_0x88cb('0x3a')](_0x2ab08b[_0x88cb('0x36')]['fields']));_0x59b9f0[_0x88cb('0x38')]=_0x59b9f0[_0x88cb('0x38')][_0x88cb('0x3b')]?_0x59b9f0[_0x88cb('0x38')]:_0x42b3a8['model'];if(!_0x2ab08b[_0x88cb('0x36')][_0x88cb('0x3c')](_0x88cb('0x3d'))){_0x59b9f0['limit']=qs[_0x88cb('0x20')](_0x2ab08b[_0x88cb('0x36')]['limit']);_0x59b9f0['offset']=qs[_0x88cb('0x1f')](_0x2ab08b[_0x88cb('0x36')][_0x88cb('0x1f')]);}_0x59b9f0['order']=qs[_0x88cb('0x3e')](_0x2ab08b[_0x88cb('0x36')]['sort']);_0x59b9f0[_0x88cb('0x3f')]=qs['filters'](_[_0x88cb('0x40')](_0x2ab08b[_0x88cb('0x36')],_0x42b3a8[_0x88cb('0x37')]),_0x3b1f6a);if(_0x2ab08b[_0x88cb('0x36')][_0x88cb('0x41')]){_0x59b9f0[_0x88cb('0x3f')]=_[_0x88cb('0x42')](_0x59b9f0[_0x88cb('0x3f')],{'$or':_[_0x88cb('0x2f')](_0x3b1f6a,function(_0x1ff4f2){if(_0x1ff4f2[_0x88cb('0x33')]!==_0x88cb('0x43')){var _0x36260b={};_0x36260b[_0x1ff4f2[_0x88cb('0x2d')]]={'$like':'%'+_0x2ab08b[_0x88cb('0x36')]['filter']+'%'};return _0x36260b;}})});}_0x59b9f0=_[_0x88cb('0x42')]({},_0x59b9f0,_0x2ab08b[_0x88cb('0x44')]);var _0x5e96bb={'where':_0x59b9f0[_0x88cb('0x3f')]};return db['AnalyticDefaultReport']['count'](_0x5e96bb)[_0x88cb('0x26')](function(_0x8dd351){_0x5869a0['count']=_0x8dd351;if(_0x2ab08b['query'][_0x88cb('0x45')]){_0x59b9f0['include']=[{'all':!![]}];}return db[_0x88cb('0x30')][_0x88cb('0x46')](_0x59b9f0);})['then'](function(_0x36dbfe){_0x5869a0[_0x88cb('0x47')]=_0x36dbfe;return _0x5869a0;})[_0x88cb('0x26')](respondWithFilteredResult(_0x2667b6,_0x59b9f0))['catch'](handleError(_0x2667b6,null));};exports[_0x88cb('0x48')]=function(_0x163c7f,_0x3ffaa2){var _0x11928f={'raw':!![],'where':{'id':_0x163c7f[_0x88cb('0x49')]['id']}},_0xe34825={};_0xe34825[_0x88cb('0x35')]=_[_0x88cb('0x4a')](db['AnalyticDefaultReport']['rawAttributes']);_0xe34825[_0x88cb('0x36')]=_[_0x88cb('0x4a')](_0x163c7f[_0x88cb('0x36')]);_0xe34825[_0x88cb('0x37')]=_[_0x88cb('0x39')](_0xe34825[_0x88cb('0x35')],_0xe34825[_0x88cb('0x36')]);_0x11928f[_0x88cb('0x38')]=_['intersection'](_0xe34825[_0x88cb('0x35')],qs[_0x88cb('0x3a')](_0x163c7f[_0x88cb('0x36')][_0x88cb('0x3a')]));_0x11928f[_0x88cb('0x38')]=_0x11928f['attributes'][_0x88cb('0x3b')]?_0x11928f['attributes']:_0xe34825[_0x88cb('0x35')];if(_0x163c7f[_0x88cb('0x36')][_0x88cb('0x45')]){_0x11928f[_0x88cb('0x4b')]=[{'all':!![]}];}_0x11928f=_[_0x88cb('0x42')]({},_0x11928f,_0x163c7f[_0x88cb('0x44')]);return db[_0x88cb('0x30')][_0x88cb('0x4c')](_0x11928f)[_0x88cb('0x26')](handleEntityNotFound(_0x3ffaa2,null))[_0x88cb('0x26')](respondWithResult(_0x3ffaa2,null))[_0x88cb('0x4d')](handleError(_0x3ffaa2,null));};exports[_0x88cb('0x4e')]=function(_0x3774ee,_0x37502c){return db[_0x88cb('0x30')][_0x88cb('0x4e')](_0x3774ee[_0x88cb('0x4f')],{})[_0x88cb('0x26')](function(_0x48ffad){var _0x1cf200=_0x3774ee[_0x88cb('0x50')][_0x88cb('0x27')]({'plain':!![]});if(!_0x1cf200)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1cf200['role']===_0x88cb('0x50')){var _0x436532=_0x48ffad[_0x88cb('0x27')]({'plain':!![]});var _0x5aa6c4=_0x88cb('0x51');return db['UserProfileSection']['find']({'where':{'name':_0x5aa6c4,'userProfileId':_0x1cf200['userProfileId']},'raw':!![]})[_0x88cb('0x26')](function(_0x49a9b9){if(_0x49a9b9&&_0x49a9b9['autoAssociation']===0x0){return db[_0x88cb('0x29')]['create']({'name':_0x436532[_0x88cb('0x2d')],'resourceId':_0x436532['id'],'type':_0x88cb('0x28'),'sectionId':_0x49a9b9['id']},{})[_0x88cb('0x26')](function(){return _0x48ffad;});}else{return _0x48ffad;}})[_0x88cb('0x4d')](function(_0x519f8d){logger[_0x88cb('0x2b')](_0x88cb('0x52'),_0x519f8d);throw _0x519f8d;});}return _0x48ffad;})['then'](respondWithResult(_0x37502c,0xc9))['catch'](handleError(_0x37502c,null));};exports[_0x88cb('0x25')]=function(_0x1408b6,_0x345273){if(_0x1408b6['body']['id']){delete _0x1408b6[_0x88cb('0x4f')]['id'];}return db[_0x88cb('0x30')][_0x88cb('0x4c')]({'where':{'id':_0x1408b6[_0x88cb('0x49')]['id']}})[_0x88cb('0x26')](handleEntityNotFound(_0x345273,null))['then'](saveUpdates(_0x1408b6['body'],null))[_0x88cb('0x26')](respondWithResult(_0x345273,null))[_0x88cb('0x4d')](handleError(_0x345273,null));};exports[_0x88cb('0x2a')]=function(_0x1dbf01,_0x3adf8a){return db[_0x88cb('0x30')][_0x88cb('0x4c')]({'where':{'id':_0x1dbf01[_0x88cb('0x49')]['id']}})[_0x88cb('0x26')](handleEntityNotFound(_0x3adf8a,null))['then'](removeEntity(_0x3adf8a,null))[_0x88cb('0x4d')](handleError(_0x3adf8a,null));};exports[_0x88cb('0x53')]=function(_0x25dfac,_0x296444){var _0x555116=0xa;var _0x3a6f3a=[_0x88cb('0x54'),'left_join',_0x88cb('0x55'),_0x88cb('0x56')];var _0x135900={'SUM':'SUM(%s)','COUNT':_0x88cb('0x57'),'COUNT DISTINCT':_0x88cb('0x58'),'MAX':_0x88cb('0x59'),'MIN':_0x88cb('0x5a'),'AVG':_0x88cb('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x88cb('0x5c'),'GROUP_CONCAT DESC':_0x88cb('0x5d')};var _0x57c278={'SEC_TO_TIME':_0x88cb('0x5e'),'DATE':'DATE(%s)','HOUR':_0x88cb('0x5f'),'ROUND':_0x88cb('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x52ecd8=function(_0x5a519a){return!_[_0x88cb('0x61')](['IS\x20NULL',_0x88cb('0x62'),_0x88cb('0x63'),_0x88cb('0x64')],_0x5a519a);};var _0x10ab55=function(_0x10a038){if(!_0x10a038||!_0x10a038[_0x88cb('0x65')][_0x88cb('0x3b')]){return'';}for(var _0x55962f='(',_0x17d695=0x0;_0x17d695<_0x10a038[_0x88cb('0x65')][_0x88cb('0x3b')];_0x17d695+=0x1){_0x17d695>0x0&&(_0x55962f+='\x20'+_0x10a038[_0x88cb('0x66')]+'\x20');_0x55962f+=_0x10a038[_0x88cb('0x65')][_0x17d695][_0x88cb('0x67')]?_0x10ab55(_0x10a038['rules'][_0x17d695][_0x88cb('0x67')]):_0x10a038['rules'][_0x17d695][_0x88cb('0x68')]+'\x20'+_0x10a038[_0x88cb('0x65')][_0x17d695][_0x88cb('0x69')]+(_0x52ecd8(_0x10a038['rules'][_0x17d695]['condition'])?'\x20'+_0x10a038[_0x88cb('0x65')][_0x17d695]['value']:'');}return _0x55962f+')';};var _0x576048={'where':{'id':_0x25dfac[_0x88cb('0x49')]['id']}},_0x20d02d,_0x1bdb79,_0xfcfbdd,_0x1cfcb3,_0x2eb08f;_0x576048=_['merge']({},_0x576048,_0x25dfac[_0x88cb('0x44')]);return db['AnalyticDefaultReport']['find'](_0x576048)[_0x88cb('0x26')](function(_0x4f8bd6){if(_0x4f8bd6){_0x20d02d=_0x4f8bd6;return _0x4f8bd6[_0x88cb('0x6a')]();}return null;})[_0x88cb('0x26')](function(_0x33a8c6){if(_0x33a8c6){if(!_0x33a8c6['length']){throw new db[(_0x88cb('0x6b'))][(_0x88cb('0x6c'))](_0x88cb('0x6d'),0x193);}_0x1bdb79=_0x33a8c6;return db['AnalyticMetric'][_0x88cb('0x46')]({'raw':!![]});}return null;})[_0x88cb('0x26')](function(_0x13a0fd){if(_0x13a0fd){_0xfcfbdd=_[_0x88cb('0x6e')](_0x13a0fd,'id');var _0x55a089;var _0x1f29f1=squel[_0x88cb('0x6f')]();_0x1f29f1[_0x88cb('0x70')](_0x20d02d['table']);for(var _0x4a2f20=0x0;_0x4a2f20<_0x1bdb79[_0x88cb('0x3b')];_0x4a2f20+=0x1){_0x55a089=_0x1bdb79[_0x4a2f20]['MetricId']?_0xfcfbdd[_0x1bdb79[_0x4a2f20][_0x88cb('0x71')]][_0x88cb('0x72')]:_0x1bdb79[_0x4a2f20][_0x88cb('0x68')];_0x55a089=_0x1bdb79[_0x4a2f20][_0x88cb('0x73')]?_[_0x88cb('0x74')](_0x135900[_0x1bdb79[_0x4a2f20][_0x88cb('0x73')]],'%s',_0x55a089):_0x55a089;_0x55a089=_0x1bdb79[_0x4a2f20]['format']?_[_0x88cb('0x74')](_0x57c278[_0x1bdb79[_0x4a2f20][_0x88cb('0x75')]],'%s',_0x55a089):_0x55a089;if(_0x1bdb79[_0x4a2f20][_0x88cb('0x76')]){_0x1f29f1[_0x88cb('0x67')](_0x55a089);}_0x1bdb79[_0x4a2f20]['orderBy']&&_0x1f29f1[_0x88cb('0x77')](_0x55a089,_0x1bdb79[_0x4a2f20][_0x88cb('0x78')]===_0x88cb('0x79')?![]:!![]);_0x1f29f1['field'](_0x55a089,_0x1bdb79[_0x4a2f20][_0x88cb('0x7a')]||_0x55a089);}if(_0x20d02d[_0x88cb('0x7b')]){_0x20d02d[_0x88cb('0x7b')]=JSON['parse'](_0x20d02d[_0x88cb('0x7b')]);for(var _0x136274=0x0;_0x136274<_0x20d02d[_0x88cb('0x7b')][_0x88cb('0x3b')];_0x136274+=0x1){if(_0x20d02d[_0x88cb('0x7b')][_0x136274]['type']&&_[_0x88cb('0x61')](_0x3a6f3a,_0x20d02d['joins'][_0x136274]['type'])&&_0x20d02d[_0x88cb('0x7b')][_0x136274][_0x88cb('0x7c')]&&_0x20d02d['joins'][_0x136274]['foreignTable']&&_0x20d02d[_0x88cb('0x7b')][_0x136274][_0x88cb('0x7d')]){_0x1f29f1[_0x20d02d[_0x88cb('0x7b')][_0x136274][_0x88cb('0x33')]](_0x20d02d[_0x88cb('0x7b')][_0x136274][_0x88cb('0x7e')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x20d02d[_0x88cb('0x7f')],_0x20d02d['joins'][_0x136274][_0x88cb('0x7c')],_0x20d02d[_0x88cb('0x7b')][_0x136274][_0x88cb('0x7e')],_0x20d02d['joins'][_0x136274][_0x88cb('0x7d')]));}}}if(_0x20d02d['conditions']){_0x20d02d[_0x88cb('0x80')]=JSON[_0x88cb('0x81')](_0x20d02d[_0x88cb('0x80')]);_0x1f29f1[_0x88cb('0x3f')](_0x10ab55(_0x20d02d[_0x88cb('0x80')][_0x88cb('0x67')]));}_0x2eb08f=_0x1f29f1[_0x88cb('0x82')]();_0x1f29f1[_0x88cb('0x20')](_0x555116);_0x1f29f1[_0x88cb('0x1f')](0x0);logger[_0x88cb('0x83')]('Limited\x20Query:',_0x1f29f1[_0x88cb('0x84')]());return dbH[_0x88cb('0x85')]['query'](_0x1f29f1[_0x88cb('0x84')](),{'type':dbH[_0x88cb('0x85')][_0x88cb('0x86')][_0x88cb('0x87')]});}})['then'](respondWithResult(_0x296444,null))[_0x88cb('0x4d')](handleError(_0x296444,null));};function runReport(_0x30dfb8,_0x4f3f8e,_0x5857c3){var _0x34d78f=_0x4f3f8e[_0x88cb('0x2d')];var _0x1f6fb7=0xa;var _0x2f8a2d=['join',_0x88cb('0x88'),'right_join',_0x88cb('0x56')];var _0x1b0579={'SUM':_0x88cb('0x89'),'COUNT':_0x88cb('0x57'),'COUNT DISTINCT':_0x88cb('0x58'),'MAX':_0x88cb('0x59'),'MIN':_0x88cb('0x5a'),'AVG':_0x88cb('0x5b'),'GROUP_CONCAT':_0x88cb('0x8a'),'GROUP_CONCAT ASC':_0x88cb('0x5c'),'GROUP_CONCAT DESC':_0x88cb('0x5d')};var _0x22a7ae={'SEC_TO_TIME':_0x88cb('0x5e'),'DATE':_0x88cb('0x8b'),'HOUR':_0x88cb('0x5f'),'ROUND':_0x88cb('0x60'),'UNIX_TIMESTAMP':_0x88cb('0x8c')};var _0x4f47cc=function(_0x1ea32b){return!_[_0x88cb('0x61')]([_0x88cb('0x8d'),'IS\x20NOT\x20NULL',_0x88cb('0x63'),_0x88cb('0x64')],_0x1ea32b);};var _0x454fac=function(_0x42d37f){if(!_0x42d37f||!_0x42d37f[_0x88cb('0x65')][_0x88cb('0x3b')]){return'';}for(var _0x550468='(',_0x1b19e6=0x0;_0x1b19e6<_0x42d37f[_0x88cb('0x65')][_0x88cb('0x3b')];_0x1b19e6+=0x1){_0x1b19e6>0x0&&(_0x550468+='\x20'+_0x42d37f[_0x88cb('0x66')]+'\x20');_0x550468+=_0x42d37f[_0x88cb('0x65')][_0x1b19e6][_0x88cb('0x67')]?_0x454fac(_0x42d37f[_0x88cb('0x65')][_0x1b19e6][_0x88cb('0x67')]):_0x42d37f[_0x88cb('0x65')][_0x1b19e6]['field']+'\x20'+_0x42d37f[_0x88cb('0x65')][_0x1b19e6][_0x88cb('0x69')]+(_0x4f47cc(_0x42d37f[_0x88cb('0x65')][_0x1b19e6][_0x88cb('0x69')])?'\x20'+_0x42d37f[_0x88cb('0x65')][_0x1b19e6][_0x88cb('0x8e')]:'');}return _0x550468+')';};var _0x12fbf9={'where':{'id':_0x30dfb8['id']}},_0x2bafd4,_0xdaff87,_0x513af6,_0x25ccec,_0x2f72a5;_0x12fbf9=_[_0x88cb('0x42')]({},_0x12fbf9,_0x5857c3);return db[_0x88cb('0x30')][_0x88cb('0x4c')](_0x12fbf9)[_0x88cb('0x26')](function(_0x27b5b1){if(_0x27b5b1){_0x2bafd4=_0x27b5b1;return _0x27b5b1[_0x88cb('0x6a')]();}return null;})[_0x88cb('0x26')](function(_0x2a062c){if(_0x2a062c){if(!_0x2a062c['length']){throw new db['Sequelize'][(_0x88cb('0x6c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xdaff87=_0x2a062c;return db[_0x88cb('0x8f')][_0x88cb('0x46')]({'raw':!![]});}return null;})[_0x88cb('0x26')](function(_0x538d3c){if(_0x538d3c){_0x513af6=_[_0x88cb('0x6e')](_0x538d3c,'id');var _0x51e615;var _0x3c37e1=squel[_0x88cb('0x6f')]();_0x3c37e1[_0x88cb('0x70')](_0x2bafd4[_0x88cb('0x7f')]);for(var _0x494c1b=0x0;_0x494c1b<_0xdaff87[_0x88cb('0x3b')];_0x494c1b+=0x1){_0x51e615=_0xdaff87[_0x494c1b][_0x88cb('0x71')]?_0x513af6[_0xdaff87[_0x494c1b]['MetricId']][_0x88cb('0x72')]:_0xdaff87[_0x494c1b]['field'];_0x51e615=_0xdaff87[_0x494c1b][_0x88cb('0x73')]?_[_0x88cb('0x74')](_0x1b0579[_0xdaff87[_0x494c1b][_0x88cb('0x73')]],'%s',_0x51e615):_0x51e615;_0x51e615=_0xdaff87[_0x494c1b][_0x88cb('0x75')]?_[_0x88cb('0x74')](_0x22a7ae[_0xdaff87[_0x494c1b]['format']],'%s',_0x51e615):_0x51e615;if(_0xdaff87[_0x494c1b]['groupBy']){_0x3c37e1[_0x88cb('0x67')](_0x51e615);}_0xdaff87[_0x494c1b]['orderBy']&&_0x3c37e1[_0x88cb('0x77')](_0x51e615,_0xdaff87[_0x494c1b][_0x88cb('0x78')]===_0x88cb('0x79')?![]:!![]);_0x3c37e1[_0x88cb('0x68')](_0x51e615,_0xdaff87[_0x494c1b][_0x88cb('0x7a')]||_0x51e615);}if(_0x2bafd4['joins']){_0x2bafd4[_0x88cb('0x7b')]=JSON['parse'](_0x2bafd4['joins']);for(var _0xc33a9f=0x0;_0xc33a9f<_0x2bafd4[_0x88cb('0x7b')][_0x88cb('0x3b')];_0xc33a9f+=0x1){if(_0x2bafd4[_0x88cb('0x7b')][_0xc33a9f]['type']&&_[_0x88cb('0x61')](_0x2f8a2d,_0x2bafd4[_0x88cb('0x7b')][_0xc33a9f]['type'])&&_0x2bafd4[_0x88cb('0x7b')][_0xc33a9f]['parentKey']&&_0x2bafd4[_0x88cb('0x7b')][_0xc33a9f][_0x88cb('0x7e')]&&_0x2bafd4[_0x88cb('0x7b')][_0xc33a9f]['foreignKey']){_0x3c37e1[_0x2bafd4[_0x88cb('0x7b')][_0xc33a9f][_0x88cb('0x33')]](_0x2bafd4[_0x88cb('0x7b')][_0xc33a9f]['foreignTable'],null,util[_0x88cb('0x75')](_0x88cb('0x90'),_0x2bafd4['table'],_0x2bafd4[_0x88cb('0x7b')][_0xc33a9f]['parentKey'],_0x2bafd4['joins'][_0xc33a9f][_0x88cb('0x7e')],_0x2bafd4[_0x88cb('0x7b')][_0xc33a9f]['foreignKey']));}}}if(_0x2bafd4[_0x88cb('0x80')]){_0x2bafd4[_0x88cb('0x80')]=JSON[_0x88cb('0x81')](_0x2bafd4['conditions']);_0x3c37e1['where'](_0x454fac(_0x2bafd4[_0x88cb('0x80')][_0x88cb('0x67')]));}_0x2f72a5=_0x3c37e1[_0x88cb('0x82')]();_0x3c37e1['limit'](_0x1f6fb7);_0x3c37e1[_0x88cb('0x1f')](0x0);return;}})[_0x88cb('0x26')](function(){if(_0x4f3f8e[_0x88cb('0x91')]===_0x88cb('0x92')){return null;}var _0x2d174c=_[_0x88cb('0x42')](_0x4f3f8e,{'name':_0x4f3f8e[_0x88cb('0x93')]||_0x4f3f8e[_0x88cb('0x2d')]||_0x2bafd4[_0x88cb('0x2d')],'basename':_0x34d78f,'savename':util[_0x88cb('0x75')](_0x88cb('0x94'),_0x4f3f8e[_0x88cb('0x2d')]||_0x2bafd4['name'],require(_0x88cb('0x95'))[_0x88cb('0x96')](0x4),_0x4f3f8e[_0x88cb('0x91')]||'csv'),'reportId':_0x2bafd4['id'],'reportType':_0x88cb('0x97')});return db[_0x88cb('0x98')][_0x88cb('0x4e')](_0x2d174c,{'raw':!![]});})[_0x88cb('0x26')](function(_0x2b8e95){if(_0x2bafd4[_0x88cb('0x7f')]===_0x88cb('0x99')){_0x2f72a5[_0x88cb('0x3f')](_0x2bafd4[_0x88cb('0x7f')]+_0x88cb('0x9a'),_0x4f3f8e[_0x88cb('0x9b')],_0x4f3f8e[_0x88cb('0x9c')]);}else{_0x2f72a5[_0x88cb('0x3f')](_0x2bafd4[_0x88cb('0x7f')]+_0x88cb('0x9d'),_0x4f3f8e['startDate'],_0x4f3f8e[_0x88cb('0x9c')]);}if(_0x2b8e95){logger['info'](_0x88cb('0x9e'),_0x2f72a5[_0x88cb('0x84')]());require(_0x88cb('0x9f'))[_0x88cb('0xa0')](path[_0x88cb('0x54')](__dirname,_0x88cb('0xa1'),_0x2b8e95[_0x88cb('0x91')]),[_0x2b8e95['id'],_0x2f72a5[_0x88cb('0x84')](),path[_0x88cb('0x54')](__dirname,_0x88cb('0xa2'),_0x2b8e95[_0x88cb('0xa3')]),_0x34d78f]);return _0x2b8e95;}else{var _0x109d79=squel[_0x88cb('0x6f')]();_0x109d79[_0x88cb('0x70')]('('+_0x2f72a5[_0x88cb('0x84')]()+')','countTable');_0x109d79[_0x88cb('0x68')](_0x88cb('0xa4'),_0x88cb('0xa5'));_0x2f72a5[_0x88cb('0x20')](_0x4f3f8e[_0x88cb('0x20')]||_0x1f6fb7);_0x2f72a5[_0x88cb('0x1f')](_0x4f3f8e[_0x88cb('0x1f')]||0x0);return dbH[_0x88cb('0x85')][_0x88cb('0x36')](_0x109d79[_0x88cb('0x84')](),{'type':dbH['sequelize'][_0x88cb('0x86')][_0x88cb('0x87')]})[_0x88cb('0x26')](function(_0x4cf0ba){if(!_0x4cf0ba['length']){_0x25ccec=0x0;}else{_0x25ccec=_0x4cf0ba[0x0][_0x88cb('0xa5')]||0x0;}return dbH[_0x88cb('0x85')]['query'](_0x2f72a5[_0x88cb('0x84')](),{'type':dbH[_0x88cb('0x85')]['QueryTypes']['SELECT']});})[_0x88cb('0x26')](function(_0x15d9b4){return{'rows':_0x15d9b4||[],'count':_0x25ccec};});}});}exports[_0x88cb('0xa6')]=function(_0x17710d,_0x47be1a){return runReport(_0x17710d[_0x88cb('0x49')],_0x17710d['query'],_0x17710d[_0x88cb('0x44')])[_0x88cb('0x26')](respondWithResult(_0x47be1a,null))[_0x88cb('0x4d')](handleError(_0x47be1a,null));};exports[_0x88cb('0xa7')]=runReport;exports['query']=function(_0x2c06ef,_0x5f29e9){var _0x1f2a24=0xa;var _0x2d89f9=[_0x88cb('0x54'),'left_join',_0x88cb('0x55'),_0x88cb('0x56')];var _0x144afe={'SUM':_0x88cb('0x89'),'COUNT':_0x88cb('0x57'),'COUNT DISTINCT':_0x88cb('0x58'),'MAX':_0x88cb('0x59'),'MIN':_0x88cb('0x5a'),'AVG':_0x88cb('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x88cb('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4625b1={'SEC_TO_TIME':_0x88cb('0x5e'),'DATE':_0x88cb('0x8b'),'HOUR':'HOUR(%s)','ROUND':_0x88cb('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xe2029b=function(_0x4d3e8f){return!_[_0x88cb('0x61')]([_0x88cb('0x8d'),_0x88cb('0x62'),_0x88cb('0x63'),'IS\x20NOT\x20EMPTY'],_0x4d3e8f);};var _0xf43ad=function(_0x5947f6){if(!_0x5947f6||!_0x5947f6[_0x88cb('0x65')][_0x88cb('0x3b')]){return'';}for(var _0x6c963f='(',_0x23b487=0x0;_0x23b487<_0x5947f6['rules'][_0x88cb('0x3b')];_0x23b487+=0x1){_0x23b487>0x0&&(_0x6c963f+='\x20'+_0x5947f6['operator']+'\x20');_0x6c963f+=_0x5947f6[_0x88cb('0x65')][_0x23b487]['group']?_0xf43ad(_0x5947f6[_0x88cb('0x65')][_0x23b487][_0x88cb('0x67')]):_0x5947f6[_0x88cb('0x65')][_0x23b487][_0x88cb('0x68')]+'\x20'+_0x5947f6['rules'][_0x23b487][_0x88cb('0x69')]+(_0xe2029b(_0x5947f6[_0x88cb('0x65')][_0x23b487][_0x88cb('0x69')])?'\x20'+_0x5947f6['rules'][_0x23b487][_0x88cb('0x8e')]:'');}return _0x6c963f+')';};var _0x394672={'where':{'id':_0x2c06ef[_0x88cb('0x49')]['id']}},_0x22c3f1,_0x1ca3de,_0x16ceb2,_0x5d2a40,_0x54e043;_0x394672=_[_0x88cb('0x42')]({},_0x394672,_0x2c06ef['options']);return db[_0x88cb('0x30')][_0x88cb('0x4c')](_0x394672)[_0x88cb('0x26')](function(_0x25cd44){if(_0x25cd44){_0x22c3f1=_0x25cd44;return _0x25cd44[_0x88cb('0x6a')]();}return null;})[_0x88cb('0x26')](function(_0x36486a){if(_0x36486a){if(!_0x36486a['length']){throw new db[(_0x88cb('0x6b'))][(_0x88cb('0x6c'))](_0x88cb('0x6d'),0x193);}_0x1ca3de=_0x36486a;return db['AnalyticMetric'][_0x88cb('0x46')]({'raw':!![]});}return null;})[_0x88cb('0x26')](function(_0x6047f1){if(_0x6047f1){_0x16ceb2=_[_0x88cb('0x6e')](_0x6047f1,'id');var _0x340a1d;var _0x4fd8c8=squel[_0x88cb('0x6f')]();_0x4fd8c8[_0x88cb('0x70')](_0x22c3f1[_0x88cb('0x7f')]);for(var _0x4d071d=0x0;_0x4d071d<_0x1ca3de[_0x88cb('0x3b')];_0x4d071d+=0x1){_0x340a1d=_0x1ca3de[_0x4d071d][_0x88cb('0x71')]?_0x16ceb2[_0x1ca3de[_0x4d071d]['MetricId']][_0x88cb('0x72')]:_0x1ca3de[_0x4d071d]['field'];_0x340a1d=_0x1ca3de[_0x4d071d][_0x88cb('0x73')]?_[_0x88cb('0x74')](_0x144afe[_0x1ca3de[_0x4d071d][_0x88cb('0x73')]],'%s',_0x340a1d):_0x340a1d;_0x340a1d=_0x1ca3de[_0x4d071d][_0x88cb('0x75')]?_[_0x88cb('0x74')](_0x4625b1[_0x1ca3de[_0x4d071d][_0x88cb('0x75')]],'%s',_0x340a1d):_0x340a1d;if(_0x1ca3de[_0x4d071d][_0x88cb('0x76')]){_0x4fd8c8[_0x88cb('0x67')](_0x340a1d);}_0x1ca3de[_0x4d071d][_0x88cb('0x78')]&&_0x4fd8c8['order'](_0x340a1d,_0x1ca3de[_0x4d071d][_0x88cb('0x78')]===_0x88cb('0x79')?![]:!![]);_0x4fd8c8[_0x88cb('0x68')](_0x340a1d,_0x1ca3de[_0x4d071d][_0x88cb('0x7a')]||_0x340a1d);}if(_0x22c3f1[_0x88cb('0x7b')]){_0x22c3f1[_0x88cb('0x7b')]=JSON[_0x88cb('0x81')](_0x22c3f1[_0x88cb('0x7b')]);for(var _0x3eaec4=0x0;_0x3eaec4<_0x22c3f1[_0x88cb('0x7b')]['length'];_0x3eaec4+=0x1){if(_0x22c3f1[_0x88cb('0x7b')][_0x3eaec4][_0x88cb('0x33')]&&_[_0x88cb('0x61')](_0x2d89f9,_0x22c3f1[_0x88cb('0x7b')][_0x3eaec4]['type'])&&_0x22c3f1[_0x88cb('0x7b')][_0x3eaec4]['parentKey']&&_0x22c3f1[_0x88cb('0x7b')][_0x3eaec4][_0x88cb('0x7e')]&&_0x22c3f1['joins'][_0x3eaec4][_0x88cb('0x7d')]){_0x4fd8c8[_0x22c3f1[_0x88cb('0x7b')][_0x3eaec4][_0x88cb('0x33')]](_0x22c3f1[_0x88cb('0x7b')][_0x3eaec4][_0x88cb('0x7e')],null,util['format'](_0x88cb('0x90'),_0x22c3f1[_0x88cb('0x7f')],_0x22c3f1[_0x88cb('0x7b')][_0x3eaec4][_0x88cb('0x7c')],_0x22c3f1['joins'][_0x3eaec4][_0x88cb('0x7e')],_0x22c3f1[_0x88cb('0x7b')][_0x3eaec4][_0x88cb('0x7d')]));}}}if(_0x22c3f1['conditions']){_0x22c3f1[_0x88cb('0x80')]=JSON[_0x88cb('0x81')](_0x22c3f1[_0x88cb('0x80')]);_0x4fd8c8['where'](_0xf43ad(_0x22c3f1['conditions'][_0x88cb('0x67')]));}_0x54e043=_0x4fd8c8[_0x88cb('0x82')]();_0x4fd8c8['limit'](_0x1f2a24);_0x4fd8c8['offset'](0x0);logger[_0x88cb('0x83')]('Limited\x20Query:',_0x4fd8c8[_0x88cb('0x84')]());return dbH['sequelize'][_0x88cb('0x36')](_0x4fd8c8[_0x88cb('0x84')](),{'type':dbH[_0x88cb('0x85')][_0x88cb('0x86')][_0x88cb('0x87')]});}})[_0x88cb('0x26')](function(){return{'sql':_0x54e043[_0x88cb('0x84')]()};})[_0x88cb('0x26')](respondWithResult(_0x5f29e9,null))[_0x88cb('0x4d')](handleError(_0x5f29e9,null));}; \ No newline at end of file +var _0x7f13=['options','AnalyticDefaultReport','includeAll','include','findAll','catch','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','cross_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)','IS\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','field','function','format','orderBy','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','right_join','HOUR(%s)','includes','IS\x20EMPTY','replace','groupBy','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','run','COUNT(DISTINCT\x20%s)','IS\x20NOT\x20NULL','debug','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','name','map','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL'];(function(_0x4c7924,_0x52ee4b){var _0x497d87=function(_0x490643){while(--_0x490643){_0x4c7924['push'](_0x4c7924['shift']());}};_0x497d87(++_0x52ee4b);}(_0x7f13,0x107));var _0x37f1=function(_0x777641,_0x19607d){_0x777641=_0x777641-0x0;var _0x54a378=_0x7f13[_0x777641];return _0x54a378;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x37f1('0x0'));var rimraf=require(_0x37f1('0x1'));var zipdir=require(_0x37f1('0x2'));var jsonpatch=require(_0x37f1('0x3'));var rp=require(_0x37f1('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x37f1('0x5'));var util=require(_0x37f1('0x6'));var path=require('path');var sox=require(_0x37f1('0x7'));var csv=require(_0x37f1('0x8'));var ejs=require(_0x37f1('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x37f1('0xa'));var crypto=require(_0x37f1('0xb'));var jsforce=require(_0x37f1('0xc'));var deskjs=require(_0x37f1('0xd'));var toCsv=require(_0x37f1('0x8'));var querystring=require(_0x37f1('0xe'));var Papa=require(_0x37f1('0xf'));var Redis=require('ioredis');var authService=require(_0x37f1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x37f1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x37f1('0x12'))(_0x37f1('0x13'));var utils=require('../../config/utils');var config=require(_0x37f1('0x14'));var licenseUtil=require(_0x37f1('0x15'));var db=require(_0x37f1('0x16'))['db'];var dbH=require('../../mysqldb')[_0x37f1('0x17')];function respondWithStatusCode(_0x4bb069,_0x26f0f4){_0x26f0f4=_0x26f0f4||0xcc;return function(_0x912570){if(_0x912570){return _0x4bb069[_0x37f1('0x18')](_0x26f0f4);}return _0x4bb069[_0x37f1('0x19')](_0x26f0f4)[_0x37f1('0x1a')]();};}function respondWithResult(_0x11f37d,_0x3cb698){_0x3cb698=_0x3cb698||0xc8;return function(_0x258909){if(_0x258909){return _0x11f37d[_0x37f1('0x19')](_0x3cb698)[_0x37f1('0x1b')](_0x258909);}};}function respondWithFilteredResult(_0x5b2f5a,_0x5e5561){return function(_0x376137){if(_0x376137){var _0x553b5b=_0x376137[_0x37f1('0x1c')],_0x44f403=_0x5e5561[_0x37f1('0x1d')],_0x13a2d0=_0x5e5561[_0x37f1('0x1d')]+_0x5e5561[_0x37f1('0x1e')],_0x65d452;if(_0x13a2d0>=_0x553b5b){_0x13a2d0=_0x553b5b;_0x65d452=0xc8;}else{_0x65d452=0xce;}_0x5b2f5a[_0x37f1('0x19')](_0x65d452);return _0x5b2f5a['set'](_0x37f1('0x1f'),_0x44f403+'-'+_0x13a2d0+'/'+_0x553b5b)[_0x37f1('0x1b')](_0x376137);}return null;};}function patchUpdates(_0x1f7c7e){return function(_0x5916d9){try{jsonpatch[_0x37f1('0x20')](_0x5916d9,_0x1f7c7e,!![]);}catch(_0x503439){return BPromise[_0x37f1('0x21')](_0x503439);}return _0x5916d9[_0x37f1('0x22')]();};}function saveUpdates(_0x56fdb1,_0x350f85){return function(_0x39ec7c){if(_0x39ec7c){return _0x39ec7c[_0x37f1('0x23')](_0x56fdb1)['then'](function(_0x32b3a9){return _0x32b3a9;});}return null;};}function removeEntity(_0x272bcf,_0xb037fe){return function(_0x41e633){if(_0x41e633){return _0x41e633['destroy']()[_0x37f1('0x24')](function(){var _0xd3caa7=_0x41e633[_0x37f1('0x25')]({'plain':!![]});var _0x423305=_0x37f1('0x26');return db[_0x37f1('0x27')][_0x37f1('0x28')]({'where':{'type':_0x423305,'resourceId':_0xd3caa7['id']}})[_0x37f1('0x24')](function(){return _0x41e633;});})[_0x37f1('0x24')](function(){_0x272bcf[_0x37f1('0x19')](0xcc)[_0x37f1('0x1a')]();});}};}function handleEntityNotFound(_0x2851da,_0xc31d88){return function(_0x15895c){if(!_0x15895c){_0x2851da['sendStatus'](0x194);}return _0x15895c;};}function handleError(_0x5832fb,_0x1a3ec5){_0x1a3ec5=_0x1a3ec5||0x1f4;return function(_0x2ea241){logger['error'](_0x2ea241['stack']);if(_0x2ea241[_0x37f1('0x29')]){delete _0x2ea241[_0x37f1('0x29')];}_0x5832fb['status'](_0x1a3ec5)['send'](_0x2ea241);};}exports['index']=function(_0xf64e9e,_0x56aa7b){var _0x46312c={},_0x2fbdcc={},_0xe5f1a2={'count':0x0,'rows':[]};var _0x5a80d7=_[_0x37f1('0x2a')](db['AnalyticDefaultReport'][_0x37f1('0x2b')],function(_0xae0280){return{'name':_0xae0280[_0x37f1('0x2c')],'type':_0xae0280['type'][_0x37f1('0x2d')]};});_0x2fbdcc['model']=_[_0x37f1('0x2a')](_0x5a80d7,_0x37f1('0x29'));_0x2fbdcc[_0x37f1('0x2e')]=_[_0x37f1('0x2f')](_0xf64e9e['query']);_0x2fbdcc['filters']=_[_0x37f1('0x30')](_0x2fbdcc[_0x37f1('0x31')],_0x2fbdcc[_0x37f1('0x2e')]);_0x46312c[_0x37f1('0x32')]=_[_0x37f1('0x30')](_0x2fbdcc[_0x37f1('0x31')],qs[_0x37f1('0x33')](_0xf64e9e[_0x37f1('0x2e')][_0x37f1('0x33')]));_0x46312c[_0x37f1('0x32')]=_0x46312c[_0x37f1('0x32')]['length']?_0x46312c[_0x37f1('0x32')]:_0x2fbdcc[_0x37f1('0x31')];if(!_0xf64e9e[_0x37f1('0x2e')]['hasOwnProperty'](_0x37f1('0x34'))){_0x46312c['limit']=qs['limit'](_0xf64e9e[_0x37f1('0x2e')]['limit']);_0x46312c[_0x37f1('0x1d')]=qs[_0x37f1('0x1d')](_0xf64e9e[_0x37f1('0x2e')][_0x37f1('0x1d')]);}_0x46312c[_0x37f1('0x35')]=qs[_0x37f1('0x36')](_0xf64e9e[_0x37f1('0x2e')][_0x37f1('0x36')]);_0x46312c[_0x37f1('0x37')]=qs[_0x37f1('0x38')](_['pick'](_0xf64e9e[_0x37f1('0x2e')],_0x2fbdcc['filters']),_0x5a80d7);if(_0xf64e9e['query'][_0x37f1('0x39')]){_0x46312c[_0x37f1('0x37')]=_[_0x37f1('0x3a')](_0x46312c[_0x37f1('0x37')],{'$or':_['map'](_0x5a80d7,function(_0xcb7f6b){if(_0xcb7f6b[_0x37f1('0x3b')]!==_0x37f1('0x3c')){var _0x484d07={};_0x484d07[_0xcb7f6b[_0x37f1('0x29')]]={'$like':'%'+_0xf64e9e[_0x37f1('0x2e')][_0x37f1('0x39')]+'%'};return _0x484d07;}})});}_0x46312c=_[_0x37f1('0x3a')]({},_0x46312c,_0xf64e9e[_0x37f1('0x3d')]);var _0x255db3={'where':_0x46312c[_0x37f1('0x37')]};return db[_0x37f1('0x3e')][_0x37f1('0x1c')](_0x255db3)['then'](function(_0x151815){_0xe5f1a2['count']=_0x151815;if(_0xf64e9e[_0x37f1('0x2e')][_0x37f1('0x3f')]){_0x46312c[_0x37f1('0x40')]=[{'all':!![]}];}return db[_0x37f1('0x3e')][_0x37f1('0x41')](_0x46312c);})['then'](function(_0x410cd9){_0xe5f1a2['rows']=_0x410cd9;return _0xe5f1a2;})[_0x37f1('0x24')](respondWithFilteredResult(_0x56aa7b,_0x46312c))[_0x37f1('0x42')](handleError(_0x56aa7b,null));};exports[_0x37f1('0x43')]=function(_0x19f254,_0x1cf51b){var _0xa67c7d={'raw':!![],'where':{'id':_0x19f254[_0x37f1('0x44')]['id']}},_0x28b4c3={};_0x28b4c3[_0x37f1('0x31')]=_['keys'](db[_0x37f1('0x3e')][_0x37f1('0x2b')]);_0x28b4c3[_0x37f1('0x2e')]=_[_0x37f1('0x2f')](_0x19f254[_0x37f1('0x2e')]);_0x28b4c3[_0x37f1('0x38')]=_[_0x37f1('0x30')](_0x28b4c3[_0x37f1('0x31')],_0x28b4c3[_0x37f1('0x2e')]);_0xa67c7d['attributes']=_[_0x37f1('0x30')](_0x28b4c3['model'],qs['fields'](_0x19f254[_0x37f1('0x2e')][_0x37f1('0x33')]));_0xa67c7d[_0x37f1('0x32')]=_0xa67c7d[_0x37f1('0x32')][_0x37f1('0x45')]?_0xa67c7d[_0x37f1('0x32')]:_0x28b4c3[_0x37f1('0x31')];if(_0x19f254[_0x37f1('0x2e')][_0x37f1('0x3f')]){_0xa67c7d['include']=[{'all':!![]}];}_0xa67c7d=_[_0x37f1('0x3a')]({},_0xa67c7d,_0x19f254[_0x37f1('0x3d')]);return db[_0x37f1('0x3e')][_0x37f1('0x46')](_0xa67c7d)[_0x37f1('0x24')](handleEntityNotFound(_0x1cf51b,null))['then'](respondWithResult(_0x1cf51b,null))[_0x37f1('0x42')](handleError(_0x1cf51b,null));};exports[_0x37f1('0x47')]=function(_0x29d833,_0x438fea){return db['AnalyticDefaultReport']['create'](_0x29d833['body'],{})['then'](function(_0x1da89f){var _0x4724cf=_0x29d833[_0x37f1('0x48')]['get']({'plain':!![]});if(!_0x4724cf)throw new Error(_0x37f1('0x49'));if(_0x4724cf[_0x37f1('0x4a')]===_0x37f1('0x48')){var _0x3fe9e5=_0x1da89f[_0x37f1('0x25')]({'plain':!![]});var _0x3126c2=_0x37f1('0x4b');return db[_0x37f1('0x4c')]['find']({'where':{'name':_0x3126c2,'userProfileId':_0x4724cf['userProfileId']},'raw':!![]})[_0x37f1('0x24')](function(_0xe8bcf4){if(_0xe8bcf4&&_0xe8bcf4[_0x37f1('0x4d')]===0x0){return db[_0x37f1('0x27')][_0x37f1('0x47')]({'name':_0x3fe9e5['name'],'resourceId':_0x3fe9e5['id'],'type':'DefaultReports','sectionId':_0xe8bcf4['id']},{})[_0x37f1('0x24')](function(){return _0x1da89f;});}else{return _0x1da89f;}})[_0x37f1('0x42')](function(_0x129d11){logger['error'](_0x37f1('0x4e'),_0x129d11);throw _0x129d11;});}return _0x1da89f;})[_0x37f1('0x24')](respondWithResult(_0x438fea,0xc9))[_0x37f1('0x42')](handleError(_0x438fea,null));};exports[_0x37f1('0x23')]=function(_0x2566b3,_0x1f2e88){if(_0x2566b3['body']['id']){delete _0x2566b3[_0x37f1('0x4f')]['id'];}return db[_0x37f1('0x3e')][_0x37f1('0x46')]({'where':{'id':_0x2566b3[_0x37f1('0x44')]['id']}})[_0x37f1('0x24')](handleEntityNotFound(_0x1f2e88,null))[_0x37f1('0x24')](saveUpdates(_0x2566b3['body'],null))[_0x37f1('0x24')](respondWithResult(_0x1f2e88,null))[_0x37f1('0x42')](handleError(_0x1f2e88,null));};exports['destroy']=function(_0x8c1f22,_0x5f018e){return db[_0x37f1('0x3e')][_0x37f1('0x46')]({'where':{'id':_0x8c1f22[_0x37f1('0x44')]['id']}})[_0x37f1('0x24')](handleEntityNotFound(_0x5f018e,null))['then'](removeEntity(_0x5f018e,null))[_0x37f1('0x42')](handleError(_0x5f018e,null));};exports[_0x37f1('0x50')]=function(_0x3e4b11,_0x24b996){var _0x113cc3=0xa;var _0x2c483c=[_0x37f1('0x51'),'left_join','right_join',_0x37f1('0x52')];var _0x1aa984={'SUM':_0x37f1('0x53'),'COUNT':_0x37f1('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x37f1('0x55'),'MIN':_0x37f1('0x56'),'AVG':_0x37f1('0x57'),'GROUP_CONCAT':_0x37f1('0x58'),'GROUP_CONCAT ASC':_0x37f1('0x59'),'GROUP_CONCAT DESC':_0x37f1('0x5a')};var _0x2719d2={'SEC_TO_TIME':_0x37f1('0x5b'),'DATE':_0x37f1('0x5c'),'HOUR':'HOUR(%s)','ROUND':_0x37f1('0x5d'),'UNIX_TIMESTAMP':_0x37f1('0x5e')};var _0x5739d8=function(_0xaaa019){return!_['includes']([_0x37f1('0x5f'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x37f1('0x60')],_0xaaa019);};var _0x2e704f=function(_0xab1157){if(!_0xab1157||!_0xab1157['rules']['length']){return'';}for(var _0x1e04f9='(',_0x4f43ba=0x0;_0x4f43ba<_0xab1157[_0x37f1('0x61')][_0x37f1('0x45')];_0x4f43ba+=0x1){_0x4f43ba>0x0&&(_0x1e04f9+='\x20'+_0xab1157[_0x37f1('0x62')]+'\x20');_0x1e04f9+=_0xab1157[_0x37f1('0x61')][_0x4f43ba][_0x37f1('0x63')]?_0x2e704f(_0xab1157[_0x37f1('0x61')][_0x4f43ba][_0x37f1('0x63')]):_0xab1157[_0x37f1('0x61')][_0x4f43ba]['field']+'\x20'+_0xab1157['rules'][_0x4f43ba][_0x37f1('0x64')]+(_0x5739d8(_0xab1157[_0x37f1('0x61')][_0x4f43ba][_0x37f1('0x64')])?'\x20'+_0xab1157[_0x37f1('0x61')][_0x4f43ba][_0x37f1('0x65')]:'');}return _0x1e04f9+')';};var _0x2a0d18={'where':{'id':_0x3e4b11[_0x37f1('0x44')]['id']}},_0x19aba7,_0x4e5acd,_0x3dc25a,_0x4506e5,_0x1e26be;_0x2a0d18=_[_0x37f1('0x3a')]({},_0x2a0d18,_0x3e4b11[_0x37f1('0x3d')]);return db[_0x37f1('0x3e')][_0x37f1('0x46')](_0x2a0d18)[_0x37f1('0x24')](function(_0x2622f0){if(_0x2622f0){_0x19aba7=_0x2622f0;return _0x2622f0[_0x37f1('0x66')]();}return null;})[_0x37f1('0x24')](function(_0x5f3f82){if(_0x5f3f82){if(!_0x5f3f82[_0x37f1('0x45')]){throw new db[(_0x37f1('0x67'))][(_0x37f1('0x68'))](_0x37f1('0x69'),0x193);}_0x4e5acd=_0x5f3f82;return db[_0x37f1('0x6a')][_0x37f1('0x41')]({'raw':!![]});}return null;})['then'](function(_0x1b2a76){if(_0x1b2a76){_0x3dc25a=_[_0x37f1('0x6b')](_0x1b2a76,'id');var _0x5ebf90;var _0x4ea628=squel[_0x37f1('0x6c')]();_0x4ea628[_0x37f1('0x6d')](_0x19aba7[_0x37f1('0x6e')]);for(var _0x18f93e=0x0;_0x18f93e<_0x4e5acd[_0x37f1('0x45')];_0x18f93e+=0x1){_0x5ebf90=_0x4e5acd[_0x18f93e][_0x37f1('0x6f')]?_0x3dc25a[_0x4e5acd[_0x18f93e][_0x37f1('0x6f')]][_0x37f1('0x70')]:_0x4e5acd[_0x18f93e][_0x37f1('0x71')];_0x5ebf90=_0x4e5acd[_0x18f93e][_0x37f1('0x72')]?_['replace'](_0x1aa984[_0x4e5acd[_0x18f93e][_0x37f1('0x72')]],'%s',_0x5ebf90):_0x5ebf90;_0x5ebf90=_0x4e5acd[_0x18f93e][_0x37f1('0x73')]?_['replace'](_0x2719d2[_0x4e5acd[_0x18f93e][_0x37f1('0x73')]],'%s',_0x5ebf90):_0x5ebf90;if(_0x4e5acd[_0x18f93e]['groupBy']){_0x4ea628[_0x37f1('0x63')](_0x5ebf90);}_0x4e5acd[_0x18f93e][_0x37f1('0x74')]&&_0x4ea628[_0x37f1('0x35')](_0x5ebf90,_0x4e5acd[_0x18f93e][_0x37f1('0x74')]===_0x37f1('0x75')?![]:!![]);_0x4ea628[_0x37f1('0x71')](_0x5ebf90,_0x4e5acd[_0x18f93e][_0x37f1('0x76')]||_0x5ebf90);}if(_0x19aba7[_0x37f1('0x77')]){_0x19aba7[_0x37f1('0x77')]=JSON[_0x37f1('0x78')](_0x19aba7[_0x37f1('0x77')]);for(var _0x1d0acb=0x0;_0x1d0acb<_0x19aba7[_0x37f1('0x77')][_0x37f1('0x45')];_0x1d0acb+=0x1){if(_0x19aba7['joins'][_0x1d0acb][_0x37f1('0x3b')]&&_['includes'](_0x2c483c,_0x19aba7[_0x37f1('0x77')][_0x1d0acb]['type'])&&_0x19aba7[_0x37f1('0x77')][_0x1d0acb]['parentKey']&&_0x19aba7[_0x37f1('0x77')][_0x1d0acb][_0x37f1('0x79')]&&_0x19aba7[_0x37f1('0x77')][_0x1d0acb][_0x37f1('0x7a')]){_0x4ea628[_0x19aba7['joins'][_0x1d0acb][_0x37f1('0x3b')]](_0x19aba7[_0x37f1('0x77')][_0x1d0acb][_0x37f1('0x79')],null,util[_0x37f1('0x73')](_0x37f1('0x7b'),_0x19aba7['table'],_0x19aba7[_0x37f1('0x77')][_0x1d0acb][_0x37f1('0x7c')],_0x19aba7[_0x37f1('0x77')][_0x1d0acb][_0x37f1('0x79')],_0x19aba7[_0x37f1('0x77')][_0x1d0acb]['foreignKey']));}}}if(_0x19aba7[_0x37f1('0x7d')]){_0x19aba7[_0x37f1('0x7d')]=JSON[_0x37f1('0x78')](_0x19aba7[_0x37f1('0x7d')]);_0x4ea628[_0x37f1('0x37')](_0x2e704f(_0x19aba7['conditions'][_0x37f1('0x63')]));}_0x1e26be=_0x4ea628[_0x37f1('0x7e')]();_0x4ea628[_0x37f1('0x1e')](_0x113cc3);_0x4ea628['offset'](0x0);logger['debug'](_0x37f1('0x7f'),_0x4ea628[_0x37f1('0x80')]());return dbH['sequelize'][_0x37f1('0x2e')](_0x4ea628[_0x37f1('0x80')](),{'type':dbH[_0x37f1('0x81')][_0x37f1('0x82')][_0x37f1('0x83')]});}})[_0x37f1('0x24')](respondWithResult(_0x24b996,null))[_0x37f1('0x42')](handleError(_0x24b996,null));};function runReport(_0x2b2cdb,_0x44134c,_0xa34a35){var _0x927935=_0x44134c[_0x37f1('0x29')];var _0x23572e=0xa;var _0xd67017=[_0x37f1('0x51'),_0x37f1('0x84'),_0x37f1('0x85'),'cross_join'];var _0x1a6345={'SUM':_0x37f1('0x53'),'COUNT':_0x37f1('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x37f1('0x55'),'MIN':_0x37f1('0x56'),'AVG':_0x37f1('0x57'),'GROUP_CONCAT':_0x37f1('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x37f1('0x5a')};var _0x5cbcce={'SEC_TO_TIME':_0x37f1('0x5b'),'DATE':'DATE(%s)','HOUR':_0x37f1('0x86'),'ROUND':_0x37f1('0x5d'),'UNIX_TIMESTAMP':_0x37f1('0x5e')};var _0x2daa8e=function(_0x5e2c2e){return!_[_0x37f1('0x87')]([_0x37f1('0x5f'),'IS\x20NOT\x20NULL',_0x37f1('0x88'),_0x37f1('0x60')],_0x5e2c2e);};var _0x2a4e8f=function(_0x1b456b){if(!_0x1b456b||!_0x1b456b['rules']['length']){return'';}for(var _0x5e7234='(',_0x4e6574=0x0;_0x4e6574<_0x1b456b[_0x37f1('0x61')][_0x37f1('0x45')];_0x4e6574+=0x1){_0x4e6574>0x0&&(_0x5e7234+='\x20'+_0x1b456b[_0x37f1('0x62')]+'\x20');_0x5e7234+=_0x1b456b[_0x37f1('0x61')][_0x4e6574][_0x37f1('0x63')]?_0x2a4e8f(_0x1b456b[_0x37f1('0x61')][_0x4e6574]['group']):_0x1b456b[_0x37f1('0x61')][_0x4e6574][_0x37f1('0x71')]+'\x20'+_0x1b456b[_0x37f1('0x61')][_0x4e6574]['condition']+(_0x2daa8e(_0x1b456b[_0x37f1('0x61')][_0x4e6574][_0x37f1('0x64')])?'\x20'+_0x1b456b[_0x37f1('0x61')][_0x4e6574][_0x37f1('0x65')]:'');}return _0x5e7234+')';};var _0x37749a={'where':{'id':_0x2b2cdb['id']}},_0x304b8a,_0xfe59be,_0x2e091e,_0x42d3d4,_0x35b528;_0x37749a=_['merge']({},_0x37749a,_0xa34a35);return db['AnalyticDefaultReport']['find'](_0x37749a)[_0x37f1('0x24')](function(_0x4f41ba){if(_0x4f41ba){_0x304b8a=_0x4f41ba;return _0x4f41ba[_0x37f1('0x66')]();}return null;})['then'](function(_0x406651){if(_0x406651){if(!_0x406651['length']){throw new db[(_0x37f1('0x67'))][(_0x37f1('0x68'))](_0x37f1('0x69'),0x193);}_0xfe59be=_0x406651;return db[_0x37f1('0x6a')][_0x37f1('0x41')]({'raw':!![]});}return null;})[_0x37f1('0x24')](function(_0x4915d9){if(_0x4915d9){_0x2e091e=_[_0x37f1('0x6b')](_0x4915d9,'id');var _0x3fd056;var _0x46ec29=squel[_0x37f1('0x6c')]();_0x46ec29[_0x37f1('0x6d')](_0x304b8a[_0x37f1('0x6e')]);for(var _0x157688=0x0;_0x157688<_0xfe59be[_0x37f1('0x45')];_0x157688+=0x1){_0x3fd056=_0xfe59be[_0x157688]['MetricId']?_0x2e091e[_0xfe59be[_0x157688]['MetricId']][_0x37f1('0x70')]:_0xfe59be[_0x157688][_0x37f1('0x71')];_0x3fd056=_0xfe59be[_0x157688][_0x37f1('0x72')]?_[_0x37f1('0x89')](_0x1a6345[_0xfe59be[_0x157688]['function']],'%s',_0x3fd056):_0x3fd056;_0x3fd056=_0xfe59be[_0x157688][_0x37f1('0x73')]?_[_0x37f1('0x89')](_0x5cbcce[_0xfe59be[_0x157688][_0x37f1('0x73')]],'%s',_0x3fd056):_0x3fd056;if(_0xfe59be[_0x157688][_0x37f1('0x8a')]){_0x46ec29['group'](_0x3fd056);}_0xfe59be[_0x157688][_0x37f1('0x74')]&&_0x46ec29['order'](_0x3fd056,_0xfe59be[_0x157688][_0x37f1('0x74')]==='DESC'?![]:!![]);_0x46ec29[_0x37f1('0x71')](_0x3fd056,_0xfe59be[_0x157688][_0x37f1('0x76')]||_0x3fd056);}if(_0x304b8a[_0x37f1('0x77')]){_0x304b8a['joins']=JSON['parse'](_0x304b8a[_0x37f1('0x77')]);for(var _0x2dab8c=0x0;_0x2dab8c<_0x304b8a[_0x37f1('0x77')][_0x37f1('0x45')];_0x2dab8c+=0x1){if(_0x304b8a[_0x37f1('0x77')][_0x2dab8c][_0x37f1('0x3b')]&&_[_0x37f1('0x87')](_0xd67017,_0x304b8a['joins'][_0x2dab8c][_0x37f1('0x3b')])&&_0x304b8a[_0x37f1('0x77')][_0x2dab8c][_0x37f1('0x7c')]&&_0x304b8a['joins'][_0x2dab8c][_0x37f1('0x79')]&&_0x304b8a[_0x37f1('0x77')][_0x2dab8c]['foreignKey']){_0x46ec29[_0x304b8a[_0x37f1('0x77')][_0x2dab8c][_0x37f1('0x3b')]](_0x304b8a[_0x37f1('0x77')][_0x2dab8c]['foreignTable'],null,util['format'](_0x37f1('0x7b'),_0x304b8a['table'],_0x304b8a[_0x37f1('0x77')][_0x2dab8c][_0x37f1('0x7c')],_0x304b8a[_0x37f1('0x77')][_0x2dab8c]['foreignTable'],_0x304b8a[_0x37f1('0x77')][_0x2dab8c][_0x37f1('0x7a')]));}}}if(_0x304b8a[_0x37f1('0x7d')]){_0x304b8a['conditions']=JSON[_0x37f1('0x78')](_0x304b8a[_0x37f1('0x7d')]);_0x46ec29[_0x37f1('0x37')](_0x2a4e8f(_0x304b8a[_0x37f1('0x7d')][_0x37f1('0x63')]));}_0x35b528=_0x46ec29['clone']();_0x46ec29[_0x37f1('0x1e')](_0x23572e);_0x46ec29[_0x37f1('0x1d')](0x0);return;}})['then'](function(){if(_0x44134c['output']==='web'){return null;}var _0x27453a=_[_0x37f1('0x3a')](_0x44134c,{'name':_0x44134c[_0x37f1('0x8b')]||_0x44134c[_0x37f1('0x29')]||_0x304b8a['name'],'basename':_0x927935,'savename':util[_0x37f1('0x73')](_0x37f1('0x8c'),_0x44134c['name']||_0x304b8a[_0x37f1('0x29')],require(_0x37f1('0x8d'))[_0x37f1('0x8e')](0x4),_0x44134c['output']||_0x37f1('0x8f')),'reportId':_0x304b8a['id'],'reportType':'default'});return db[_0x37f1('0x90')][_0x37f1('0x47')](_0x27453a,{'raw':!![]});})[_0x37f1('0x24')](function(_0x2db20c){if(_0x304b8a['table']===_0x37f1('0x91')){_0x35b528[_0x37f1('0x37')](_0x304b8a[_0x37f1('0x6e')]+_0x37f1('0x92'),_0x44134c['startDate'],_0x44134c['endDate']);}else{_0x35b528[_0x37f1('0x37')](_0x304b8a[_0x37f1('0x6e')]+_0x37f1('0x93'),_0x44134c[_0x37f1('0x94')],_0x44134c[_0x37f1('0x95')]);}if(_0x2db20c){logger[_0x37f1('0x96')](_0x37f1('0x97'),_0x35b528[_0x37f1('0x80')]());require(_0x37f1('0x98'))[_0x37f1('0x99')](path[_0x37f1('0x51')](__dirname,_0x37f1('0x9a'),_0x2db20c['output']),[_0x2db20c['id'],_0x35b528[_0x37f1('0x80')](),path[_0x37f1('0x51')](__dirname,_0x37f1('0x9b'),_0x2db20c['savename']),_0x927935]);return _0x2db20c;}else{var _0x3aadbc=squel[_0x37f1('0x6c')]();_0x3aadbc[_0x37f1('0x6d')]('('+_0x35b528['toString']()+')',_0x37f1('0x9c'));_0x3aadbc[_0x37f1('0x71')](_0x37f1('0x9d'),_0x37f1('0x1c'));_0x35b528[_0x37f1('0x1e')](_0x44134c['limit']||_0x23572e);_0x35b528[_0x37f1('0x1d')](_0x44134c['offset']||0x0);return dbH['sequelize'][_0x37f1('0x2e')](_0x3aadbc[_0x37f1('0x80')](),{'type':dbH[_0x37f1('0x81')][_0x37f1('0x82')]['SELECT']})['then'](function(_0x539f8b){if(!_0x539f8b[_0x37f1('0x45')]){_0x42d3d4=0x0;}else{_0x42d3d4=_0x539f8b[0x0][_0x37f1('0x1c')]||0x0;}return dbH[_0x37f1('0x81')][_0x37f1('0x2e')](_0x35b528[_0x37f1('0x80')](),{'type':dbH[_0x37f1('0x81')][_0x37f1('0x82')][_0x37f1('0x83')]});})[_0x37f1('0x24')](function(_0xd75ac){return{'rows':_0xd75ac||[],'count':_0x42d3d4};});}});}exports[_0x37f1('0x9e')]=function(_0x5df00a,_0x494626){return runReport(_0x5df00a[_0x37f1('0x44')],_0x5df00a[_0x37f1('0x2e')],_0x5df00a[_0x37f1('0x3d')])[_0x37f1('0x24')](respondWithResult(_0x494626,null))['catch'](handleError(_0x494626,null));};exports['runReport']=runReport;exports['query']=function(_0x127d81,_0x52ddb2){var _0x539757=0xa;var _0x40df20=[_0x37f1('0x51'),_0x37f1('0x84'),_0x37f1('0x85'),'cross_join'];var _0x3b3217={'SUM':_0x37f1('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x37f1('0x9f'),'MAX':_0x37f1('0x55'),'MIN':_0x37f1('0x56'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x37f1('0x58'),'GROUP_CONCAT ASC':_0x37f1('0x59'),'GROUP_CONCAT DESC':_0x37f1('0x5a')};var _0x5af331={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x37f1('0x5d'),'UNIX_TIMESTAMP':_0x37f1('0x5e')};var _0x2b7cfc=function(_0x12e3f0){return!_[_0x37f1('0x87')]([_0x37f1('0x5f'),_0x37f1('0xa0'),_0x37f1('0x88'),_0x37f1('0x60')],_0x12e3f0);};var _0x10264b=function(_0x58334d){if(!_0x58334d||!_0x58334d['rules'][_0x37f1('0x45')]){return'';}for(var _0x576d22='(',_0x43ba6f=0x0;_0x43ba6f<_0x58334d[_0x37f1('0x61')][_0x37f1('0x45')];_0x43ba6f+=0x1){_0x43ba6f>0x0&&(_0x576d22+='\x20'+_0x58334d[_0x37f1('0x62')]+'\x20');_0x576d22+=_0x58334d['rules'][_0x43ba6f]['group']?_0x10264b(_0x58334d[_0x37f1('0x61')][_0x43ba6f][_0x37f1('0x63')]):_0x58334d[_0x37f1('0x61')][_0x43ba6f]['field']+'\x20'+_0x58334d['rules'][_0x43ba6f][_0x37f1('0x64')]+(_0x2b7cfc(_0x58334d['rules'][_0x43ba6f][_0x37f1('0x64')])?'\x20'+_0x58334d[_0x37f1('0x61')][_0x43ba6f][_0x37f1('0x65')]:'');}return _0x576d22+')';};var _0x4de59d={'where':{'id':_0x127d81[_0x37f1('0x44')]['id']}},_0x365606,_0x4468d7,_0x406183,_0x7e1af9,_0x247257;_0x4de59d=_['merge']({},_0x4de59d,_0x127d81[_0x37f1('0x3d')]);return db[_0x37f1('0x3e')][_0x37f1('0x46')](_0x4de59d)[_0x37f1('0x24')](function(_0x2211b9){if(_0x2211b9){_0x365606=_0x2211b9;return _0x2211b9[_0x37f1('0x66')]();}return null;})['then'](function(_0x2bfb87){if(_0x2bfb87){if(!_0x2bfb87['length']){throw new db['Sequelize'][(_0x37f1('0x68'))](_0x37f1('0x69'),0x193);}_0x4468d7=_0x2bfb87;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x5685aa){if(_0x5685aa){_0x406183=_['keyBy'](_0x5685aa,'id');var _0x57de43;var _0x376b7b=squel[_0x37f1('0x6c')]();_0x376b7b['from'](_0x365606[_0x37f1('0x6e')]);for(var _0x3d42e9=0x0;_0x3d42e9<_0x4468d7[_0x37f1('0x45')];_0x3d42e9+=0x1){_0x57de43=_0x4468d7[_0x3d42e9][_0x37f1('0x6f')]?_0x406183[_0x4468d7[_0x3d42e9][_0x37f1('0x6f')]][_0x37f1('0x70')]:_0x4468d7[_0x3d42e9][_0x37f1('0x71')];_0x57de43=_0x4468d7[_0x3d42e9][_0x37f1('0x72')]?_['replace'](_0x3b3217[_0x4468d7[_0x3d42e9][_0x37f1('0x72')]],'%s',_0x57de43):_0x57de43;_0x57de43=_0x4468d7[_0x3d42e9][_0x37f1('0x73')]?_['replace'](_0x5af331[_0x4468d7[_0x3d42e9][_0x37f1('0x73')]],'%s',_0x57de43):_0x57de43;if(_0x4468d7[_0x3d42e9][_0x37f1('0x8a')]){_0x376b7b['group'](_0x57de43);}_0x4468d7[_0x3d42e9][_0x37f1('0x74')]&&_0x376b7b[_0x37f1('0x35')](_0x57de43,_0x4468d7[_0x3d42e9][_0x37f1('0x74')]===_0x37f1('0x75')?![]:!![]);_0x376b7b['field'](_0x57de43,_0x4468d7[_0x3d42e9]['alias']||_0x57de43);}if(_0x365606[_0x37f1('0x77')]){_0x365606[_0x37f1('0x77')]=JSON['parse'](_0x365606[_0x37f1('0x77')]);for(var _0x2559fe=0x0;_0x2559fe<_0x365606[_0x37f1('0x77')][_0x37f1('0x45')];_0x2559fe+=0x1){if(_0x365606[_0x37f1('0x77')][_0x2559fe][_0x37f1('0x3b')]&&_[_0x37f1('0x87')](_0x40df20,_0x365606['joins'][_0x2559fe][_0x37f1('0x3b')])&&_0x365606[_0x37f1('0x77')][_0x2559fe]['parentKey']&&_0x365606[_0x37f1('0x77')][_0x2559fe][_0x37f1('0x79')]&&_0x365606['joins'][_0x2559fe]['foreignKey']){_0x376b7b[_0x365606['joins'][_0x2559fe][_0x37f1('0x3b')]](_0x365606[_0x37f1('0x77')][_0x2559fe][_0x37f1('0x79')],null,util[_0x37f1('0x73')](_0x37f1('0x7b'),_0x365606[_0x37f1('0x6e')],_0x365606[_0x37f1('0x77')][_0x2559fe]['parentKey'],_0x365606[_0x37f1('0x77')][_0x2559fe]['foreignTable'],_0x365606[_0x37f1('0x77')][_0x2559fe][_0x37f1('0x7a')]));}}}if(_0x365606['conditions']){_0x365606[_0x37f1('0x7d')]=JSON[_0x37f1('0x78')](_0x365606[_0x37f1('0x7d')]);_0x376b7b['where'](_0x10264b(_0x365606['conditions'][_0x37f1('0x63')]));}_0x247257=_0x376b7b[_0x37f1('0x7e')]();_0x376b7b[_0x37f1('0x1e')](_0x539757);_0x376b7b[_0x37f1('0x1d')](0x0);logger[_0x37f1('0xa1')](_0x37f1('0x7f'),_0x376b7b[_0x37f1('0x80')]());return dbH['sequelize'][_0x37f1('0x2e')](_0x376b7b[_0x37f1('0x80')](),{'type':dbH['sequelize']['QueryTypes'][_0x37f1('0x83')]});}})[_0x37f1('0x24')](function(){return{'sql':_0x247257[_0x37f1('0x80')]()};})[_0x37f1('0x24')](respondWithResult(_0x52ddb2,null))[_0x37f1('0x42')](handleError(_0x52ddb2,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 0386faa..f614d18 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 _0xb1f6=['exports','define','AnalyticDefaultReport','util','../../config/logger','rimraf'];(function(_0x5b1364,_0x284d9d){var _0x542b87=function(_0x2fde18){while(--_0x2fde18){_0x5b1364['push'](_0x5b1364['shift']());}};_0x542b87(++_0x284d9d);}(_0xb1f6,0x14d));var _0x6b1f=function(_0x53d8f8,_0x3c029c){_0x53d8f8=_0x53d8f8-0x0;var _0x3b53fe=_0xb1f6[_0x53d8f8];return _0x3b53fe;};'use strict';var _=require('lodash');var util=require(_0x6b1f('0x0'));var logger=require(_0x6b1f('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6b1f('0x2'));var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0x6b1f('0x3')]=function(_0x78923f,_0x5bbcad){return _0x78923f[_0x6b1f('0x4')](_0x6b1f('0x5'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a5c=['request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1a5c,0x6a));var _0xc1a5=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x1a5c[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0xc1a5('0x0'));var util=require(_0xc1a5('0x1'));var logger=require(_0xc1a5('0x2'))(_0xc1a5('0x3'));var moment=require(_0xc1a5('0x4'));var BPromise=require(_0xc1a5('0x5'));var rp=require(_0xc1a5('0x6'));var fs=require('fs');var path=require(_0xc1a5('0x7'));var rimraf=require(_0xc1a5('0x8'));var config=require(_0xc1a5('0x9'));var attributes=require(_0xc1a5('0xa'));module[_0xc1a5('0xb')]=function(_0x1dc8bd,_0x20f23f){return _0x1dc8bd[_0xc1a5('0xc')]('AnalyticDefaultReport',attributes,{'tableName':_0xc1a5('0xd'),'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 9a87dce..4537ac4 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 _0x0439=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0xbec422,_0x1c92fe){var _0x495053=function(_0x4dd2b9){while(--_0x4dd2b9){_0xbec422['push'](_0xbec422['shift']());}};_0x495053(++_0x1c92fe);}(_0x0439,0xdd));var _0x9043=function(_0x34bb68,_0x5b0079){_0x34bb68=_0x34bb68-0x0;var _0x3db9fb=_0x0439[_0x34bb68];return _0x3db9fb;};'use strict';var _=require(_0x9043('0x0'));var util=require(_0x9043('0x1'));var moment=require(_0x9043('0x2'));var BPromise=require(_0x9043('0x3'));var rs=require(_0x9043('0x4'));var fs=require('fs');var Redis=require(_0x9043('0x5'));var db=require(_0x9043('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9043('0x7'))(_0x9043('0x8'));var config=require(_0x9043('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9043('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f79c2,_0x2fe4da,_0x19bf02){return new BPromise(function(_0x5bea98,_0x135a40){return client['request'](_0x4f79c2,_0x19bf02)[_0x9043('0xb')](function(_0x36a5cb){logger['info'](_0x9043('0xc'),_0x2fe4da,_0x9043('0xd'));logger[_0x9043('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x2fe4da,'request\x20sent',JSON[_0x9043('0xf')](_0x36a5cb));if(_0x36a5cb[_0x9043('0x10')]){if(_0x36a5cb['error'][_0x9043('0x11')]===0x1f4){logger[_0x9043('0x10')](_0x9043('0xc'),_0x2fe4da,_0x36a5cb[_0x9043('0x10')][_0x9043('0x12')]);return _0x135a40(_0x36a5cb[_0x9043('0x10')]['message']);}logger[_0x9043('0x10')](_0x9043('0xc'),_0x2fe4da,_0x36a5cb['error'][_0x9043('0x12')]);return _0x5bea98(_0x36a5cb[_0x9043('0x10')]['message']);}else{logger[_0x9043('0x13')](_0x9043('0xc'),_0x2fe4da,_0x9043('0xd'));_0x5bea98(_0x36a5cb[_0x9043('0x14')][_0x9043('0x12')]);}})[_0x9043('0x15')](function(_0x13b613){logger[_0x9043('0x10')](_0x9043('0xc'),_0x2fe4da,_0x13b613);_0x135a40(_0x13b613);});});} \ No newline at end of file +var _0xe0dd=['../../config/utils','../../config/logger','jayson/promise','client','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xe0dd,0x163));var _0xde0d=function(_0x2bf888,_0x374f0b){_0x2bf888=_0x2bf888-0x0;var _0x3038d6=_0xe0dd[_0x2bf888];return _0x3038d6;};'use strict';var _=require(_0xde0d('0x0'));var util=require(_0xde0d('0x1'));var moment=require('moment');var BPromise=require(_0xde0d('0x2'));var rs=require(_0xde0d('0x3'));var fs=require('fs');var Redis=require(_0xde0d('0x4'));var db=require(_0xde0d('0x5'))['db'];var utils=require(_0xde0d('0x6'));var logger=require(_0xde0d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xde0d('0x8'));var client=jayson[_0xde0d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x323200,_0x3ce23c,_0x33a644){return new BPromise(function(_0x570b78,_0x25f0fe){return client['request'](_0x323200,_0x33a644)[_0xde0d('0xa')](function(_0x5e6588){logger[_0xde0d('0xb')](_0xde0d('0xc'),_0x3ce23c,_0xde0d('0xd'));logger['debug']('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x3ce23c,'request\x20sent',JSON[_0xde0d('0xe')](_0x5e6588));if(_0x5e6588[_0xde0d('0xf')]){if(_0x5e6588[_0xde0d('0xf')]['code']===0x1f4){logger[_0xde0d('0xf')](_0xde0d('0xc'),_0x3ce23c,_0x5e6588['error'][_0xde0d('0x10')]);return _0x25f0fe(_0x5e6588[_0xde0d('0xf')][_0xde0d('0x10')]);}logger[_0xde0d('0xf')](_0xde0d('0xc'),_0x3ce23c,_0x5e6588['error'][_0xde0d('0x10')]);return _0x570b78(_0x5e6588['error'][_0xde0d('0x10')]);}else{logger['info'](_0xde0d('0xc'),_0x3ce23c,'request\x20sent');_0x570b78(_0x5e6588[_0xde0d('0x11')][_0xde0d('0x10')]);}})[_0xde0d('0x12')](function(_0x228666){logger[_0xde0d('0xf')](_0xde0d('0xc'),_0x3ce23c,_0x228666);_0x25f0fe(_0x228666);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 6a32fbf..1877a32 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 _0xfb5e=['delete','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','index','show','/:id/run','isAuthenticated','run','/:id/query','query','post','create','/:id'];(function(_0x1b9043,_0x322520){var _0x314150=function(_0x357334){while(--_0x357334){_0x1b9043['push'](_0x1b9043['shift']());}};_0x314150(++_0x322520);}(_0xfb5e,0x144));var _0xefb5=function(_0x3a16d4,_0x23ecda){_0x3a16d4=_0x3a16d4-0x0;var _0x31ea9c=_0xfb5e[_0x3a16d4];return _0x31ea9c;};'use strict';var multer=require(_0xefb5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xefb5('0x1'));var express=require(_0xefb5('0x2'));var router=express['Router']();var auth=require(_0xefb5('0x3'));var interaction=require(_0xefb5('0x4'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0xefb5('0x5')]('/',auth['isAuthenticated'](),controller[_0xefb5('0x6')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xefb5('0x7')]);router['get']('/:id/preview',auth['isAuthenticated'](),controller['preview']);router[_0xefb5('0x5')](_0xefb5('0x8'),auth[_0xefb5('0x9')](),controller[_0xefb5('0xa')]);router['get'](_0xefb5('0xb'),auth[_0xefb5('0x9')](),controller[_0xefb5('0xc')]);router[_0xefb5('0xd')]('/',auth['isAuthenticated'](),controller[_0xefb5('0xe')]);router['put'](_0xefb5('0xf'),auth[_0xefb5('0x9')](),controller['update']);router[_0xefb5('0x10')](_0xefb5('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x959c=['express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','/:id','show','get','/:id/preview','/:id/run','run','query','create','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x959c,0xb9));var _0xc959=function(_0x1e13fa,_0x21c2b5){_0x1e13fa=_0x1e13fa-0x0;var _0x2c5266=_0x959c[_0x1e13fa];return _0x2c5266;};'use strict';var multer=require(_0xc959('0x0'));var util=require(_0xc959('0x1'));var path=require(_0xc959('0x2'));var timeout=require(_0xc959('0x3'));var express=require(_0xc959('0x4'));var router=express[_0xc959('0x5')]();var auth=require(_0xc959('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc959('0x7'));var controller=require('./analyticDefaultReport.controller');router['get']('/',auth[_0xc959('0x8')](),controller[_0xc959('0x9')]);router['get'](_0xc959('0xa'),auth[_0xc959('0x8')](),controller[_0xc959('0xb')]);router[_0xc959('0xc')](_0xc959('0xd'),auth[_0xc959('0x8')](),controller['preview']);router['get'](_0xc959('0xe'),auth[_0xc959('0x8')](),controller[_0xc959('0xf')]);router[_0xc959('0xc')]('/:id/query',auth[_0xc959('0x8')](),controller[_0xc959('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc959('0x11')]);router['put'](_0xc959('0xa'),auth['isAuthenticated'](),controller[_0xc959('0x12')]);router['delete']('/:id',auth[_0xc959('0x8')](),controller[_0xc959('0x13')]);module[_0xc959('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index c33f82d..bfdb47f 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 _0xb822=['STRING','ENUM','csv','xlsx','DATE','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment'];(function(_0x1d5400,_0x567e3c){var _0x21d9fe=function(_0x23fb75){while(--_0x23fb75){_0x1d5400['push'](_0x1d5400['shift']());}};_0x21d9fe(++_0x567e3c);}(_0xb822,0x17f));var _0x2b82=function(_0xfc02fc,_0x4ff80b){_0xfc02fc=_0xfc02fc-0x0;var _0x13a51f=_0xb822[_0xfc02fc];return _0x13a51f;};'use strict';var Sequelize=require(_0x2b82('0x0'));var moment=require(_0x2b82('0x1'));module['exports']={'name':{'type':Sequelize[_0x2b82('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x2b82('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x2b82('0x3')](_0x2b82('0x4'),'pdf',_0x2b82('0x5')),'allowNull':![],'defaultValue':_0x2b82('0x4')},'savename':{'type':Sequelize[_0x2b82('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x2b82('0x6')]},'endDate':{'type':Sequelize[_0x2b82('0x6')]},'status':{'type':Sequelize[_0x2b82('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x2b82('0x7'),_0x2b82('0x8')),'allowNull':![],'defaultValue':_0x2b82('0x7')},'reportId':{'type':Sequelize[_0x2b82('0x9')](0xb)[_0x2b82('0xa')]},'reportType':{'type':Sequelize[_0x2b82('0x2')]}}; \ No newline at end of file +var _0xaf36=['STRING','ENUM','pdf','csv','DATE','manual','UNSIGNED','sequelize','moment','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xaf36,0xc5));var _0x6af3=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0xaf36[_0x581af1];return _0x54c22e;};'use strict';var Sequelize=require(_0x6af3('0x0'));var moment=require(_0x6af3('0x1'));module[_0x6af3('0x2')]={'name':{'type':Sequelize[_0x6af3('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x6af3('0x4')]('csv',_0x6af3('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0x6af3('0x6')},'savename':{'type':Sequelize[_0x6af3('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x6af3('0x7')]},'endDate':{'type':Sequelize[_0x6af3('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x6af3('0x8'),'scheduled'),'allowNull':![],'defaultValue':_0x6af3('0x8')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x6af3('0x9')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index bd8e581..bdf4224 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 _0x809a=['filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','download','format','%s.%s','toLowerCase','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','key','model','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x809a,0x14d));var _0xa809=function(_0xbf6458,_0x5b4fcd){_0xbf6458=_0xbf6458-0x0;var _0x9a93b3=_0x809a[_0xbf6458];return _0x9a93b3;};'use strict';var pdf=require(_0xa809('0x0'));var emlformat=require(_0xa809('0x1'));var rimraf=require(_0xa809('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa809('0x3'));var rp=require(_0xa809('0x4'));var moment=require(_0xa809('0x5'));var BPromise=require(_0xa809('0x6'));var Mustache=require(_0xa809('0x7'));var util=require(_0xa809('0x8'));var path=require(_0xa809('0x9'));var sox=require(_0xa809('0xa'));var csv=require(_0xa809('0xb'));var ejs=require(_0xa809('0xc'));var fs=require('fs');var _=require(_0xa809('0xd'));var squel=require(_0xa809('0xe'));var crypto=require(_0xa809('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa809('0xb'));var querystring=require(_0xa809('0x10'));var Papa=require('papaparse');var Redis=require(_0xa809('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa809('0x12'));var as=require(_0xa809('0x13'));var hardwareService=require(_0xa809('0x14'));var logger=require('../../config/logger')(_0xa809('0x15'));var utils=require(_0xa809('0x16'));var config=require(_0xa809('0x17'));var licenseUtil=require(_0xa809('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xabc14a,_0x9a53b5){_0x9a53b5=_0x9a53b5||0xcc;return function(_0x4abceb){if(_0x4abceb){return _0xabc14a[_0xa809('0x19')](_0x9a53b5);}return _0xabc14a[_0xa809('0x1a')](_0x9a53b5)[_0xa809('0x1b')]();};}function respondWithResult(_0xf9b290,_0x2d2842){_0x2d2842=_0x2d2842||0xc8;return function(_0xf5f93c){if(_0xf5f93c){return _0xf9b290['status'](_0x2d2842)[_0xa809('0x1c')](_0xf5f93c);}};}function respondWithFilteredResult(_0x34d970,_0x555ea9){return function(_0x20bd36){if(_0x20bd36){var _0x4e0cf4=_0x20bd36[_0xa809('0x1d')],_0x10001f=_0x555ea9[_0xa809('0x1e')],_0x46baf0=_0x555ea9[_0xa809('0x1e')]+_0x555ea9[_0xa809('0x1f')],_0x1f7915;if(_0x46baf0>=_0x4e0cf4){_0x46baf0=_0x4e0cf4;_0x1f7915=0xc8;}else{_0x1f7915=0xce;}_0x34d970['status'](_0x1f7915);return _0x34d970['set'](_0xa809('0x20'),_0x10001f+'-'+_0x46baf0+'/'+_0x4e0cf4)['json'](_0x20bd36);}return null;};}function patchUpdates(_0x139e38){return function(_0x33f673){try{jsonpatch[_0xa809('0x21')](_0x33f673,_0x139e38,!![]);}catch(_0x46560f){return BPromise[_0xa809('0x22')](_0x46560f);}return _0x33f673['save']();};}function saveUpdates(_0x58a528,_0xe55f0b){return function(_0x81e980){if(_0x81e980){return _0x81e980[_0xa809('0x23')](_0x58a528)[_0xa809('0x24')](function(_0xc675a){return _0xc675a;});}return null;};}function removeEntity(_0x169b95,_0x1b6c99){return function(_0x40d9c8){if(_0x40d9c8){return _0x40d9c8[_0xa809('0x25')]()['then'](function(){var _0x55adb7=_0x40d9c8[_0xa809('0x26')]({'plain':!![]});var _0x179da7=_0xa809('0x27');return db[_0xa809('0x28')]['destroy']({'where':{'type':_0x179da7,'resourceId':_0x55adb7['id']}})['then'](function(){return _0x40d9c8;});})[_0xa809('0x24')](function(){_0x169b95[_0xa809('0x1a')](0xcc)[_0xa809('0x1b')]();});}};}function handleEntityNotFound(_0xe348fe,_0xbe55d4){return function(_0x51139e){if(!_0x51139e){_0xe348fe[_0xa809('0x19')](0x194);}return _0x51139e;};}function handleError(_0x377241,_0x15a733){_0x15a733=_0x15a733||0x1f4;return function(_0x491741){logger[_0xa809('0x29')](_0x491741[_0xa809('0x2a')]);if(_0x491741['name']){delete _0x491741[_0xa809('0x2b')];}_0x377241['status'](_0x15a733)[_0xa809('0x2c')](_0x491741);};}exports[_0xa809('0x2d')]=function(_0xb84eaa,_0x4769e1){var _0x4d5aeb={},_0x38c9d8={},_0xb57fbb={'count':0x0,'rows':[]};var _0x234ad7=_[_0xa809('0x2e')](db[_0xa809('0x2f')][_0xa809('0x30')],function(_0x1c9bfa){return{'name':_0x1c9bfa['fieldName'],'type':_0x1c9bfa['type'][_0xa809('0x31')]};});_0x38c9d8[_0xa809('0x32')]=_[_0xa809('0x2e')](_0x234ad7,_0xa809('0x2b'));_0x38c9d8['query']=_[_0xa809('0x33')](_0xb84eaa[_0xa809('0x34')]);_0x38c9d8[_0xa809('0x35')]=_[_0xa809('0x36')](_0x38c9d8[_0xa809('0x32')],_0x38c9d8[_0xa809('0x34')]);_0x4d5aeb['attributes']=_['intersection'](_0x38c9d8['model'],qs[_0xa809('0x37')](_0xb84eaa[_0xa809('0x34')][_0xa809('0x37')]));_0x4d5aeb['attributes']=_0x4d5aeb['attributes'][_0xa809('0x38')]?_0x4d5aeb[_0xa809('0x39')]:_0x38c9d8['model'];if(!_0xb84eaa[_0xa809('0x34')][_0xa809('0x3a')](_0xa809('0x3b'))){_0x4d5aeb[_0xa809('0x1f')]=qs[_0xa809('0x1f')](_0xb84eaa[_0xa809('0x34')]['limit']);_0x4d5aeb['offset']=qs['offset'](_0xb84eaa[_0xa809('0x34')][_0xa809('0x1e')]);}_0x4d5aeb[_0xa809('0x3c')]=qs[_0xa809('0x3d')](_0xb84eaa[_0xa809('0x34')]['sort']);_0x4d5aeb['where']=qs[_0xa809('0x35')](_[_0xa809('0x3e')](_0xb84eaa[_0xa809('0x34')],_0x38c9d8[_0xa809('0x35')]),_0x234ad7);if(_0xb84eaa['query'][_0xa809('0x3f')]){_0x4d5aeb['where']=_['merge'](_0x4d5aeb[_0xa809('0x40')],{'$or':_['map'](_0x234ad7,function(_0xa34697){if(_0xa34697[_0xa809('0x41')]!==_0xa809('0x42')){var _0x41b3ff={};_0x41b3ff[_0xa34697['name']]={'$like':'%'+_0xb84eaa[_0xa809('0x34')][_0xa809('0x3f')]+'%'};return _0x41b3ff;}})});}_0x4d5aeb=_[_0xa809('0x43')]({},_0x4d5aeb,_0xb84eaa[_0xa809('0x44')]);var _0x3ebfa0={'where':_0x4d5aeb[_0xa809('0x40')]};return db[_0xa809('0x2f')][_0xa809('0x1d')](_0x3ebfa0)[_0xa809('0x24')](function(_0x5534f3){_0xb57fbb['count']=_0x5534f3;if(_0xb84eaa[_0xa809('0x34')][_0xa809('0x45')]){_0x4d5aeb[_0xa809('0x46')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xa809('0x47')](_0x4d5aeb);})['then'](function(_0x70e734){_0xb57fbb[_0xa809('0x48')]=_0x70e734;return _0xb57fbb;})[_0xa809('0x24')](respondWithFilteredResult(_0x4769e1,_0x4d5aeb))[_0xa809('0x49')](handleError(_0x4769e1,null));};exports[_0xa809('0x4a')]=function(_0xd13d26,_0x203f2d){var _0xbd02c3={'raw':!![],'where':{'id':_0xd13d26[_0xa809('0x4b')]['id']}},_0xae08d0={};_0xae08d0[_0xa809('0x32')]=_['keys'](db[_0xa809('0x2f')]['rawAttributes']);_0xae08d0['query']=_[_0xa809('0x33')](_0xd13d26[_0xa809('0x34')]);_0xae08d0[_0xa809('0x35')]=_[_0xa809('0x36')](_0xae08d0[_0xa809('0x32')],_0xae08d0[_0xa809('0x34')]);_0xbd02c3['attributes']=_[_0xa809('0x36')](_0xae08d0[_0xa809('0x32')],qs['fields'](_0xd13d26[_0xa809('0x34')]['fields']));_0xbd02c3[_0xa809('0x39')]=_0xbd02c3[_0xa809('0x39')]['length']?_0xbd02c3['attributes']:_0xae08d0[_0xa809('0x32')];if(_0xd13d26['query']['includeAll']){_0xbd02c3[_0xa809('0x46')]=[{'all':!![]}];}_0xbd02c3=_['merge']({},_0xbd02c3,_0xd13d26[_0xa809('0x44')]);return db['AnalyticExtractedReport'][_0xa809('0x4c')](_0xbd02c3)[_0xa809('0x24')](handleEntityNotFound(_0x203f2d,null))[_0xa809('0x24')](respondWithResult(_0x203f2d,null))[_0xa809('0x49')](handleError(_0x203f2d,null));};exports[_0xa809('0x4d')]=function(_0x1719c8,_0x3b41fc){return db[_0xa809('0x2f')]['create'](_0x1719c8['body'],{})[_0xa809('0x24')](function(_0x49b252){var _0x28558e=_0x1719c8[_0xa809('0x4e')]['get']({'plain':!![]});if(!_0x28558e)throw new Error(_0xa809('0x4f'));if(_0x28558e['role']===_0xa809('0x4e')){var _0x5cefc5=_0x49b252['get']({'plain':!![]});var _0x3c48c2=_0xa809('0x27');return db[_0xa809('0x50')]['find']({'where':{'name':_0x3c48c2,'userProfileId':_0x28558e[_0xa809('0x51')]},'raw':!![]})[_0xa809('0x24')](function(_0x59012c){if(_0x59012c&&_0x59012c[_0xa809('0x52')]===0x0){return db[_0xa809('0x28')][_0xa809('0x4d')]({'name':_0x5cefc5[_0xa809('0x2b')],'resourceId':_0x5cefc5['id'],'type':_0x59012c[_0xa809('0x2b')],'sectionId':_0x59012c['id']},{})[_0xa809('0x24')](function(){return _0x49b252;});}else{return _0x49b252;}})['catch'](function(_0x492034){logger['error'](_0xa809('0x53'),_0x492034);throw _0x492034;});}return _0x49b252;})[_0xa809('0x24')](respondWithResult(_0x3b41fc,0xc9))['catch'](handleError(_0x3b41fc,null));};exports[_0xa809('0x23')]=function(_0x15737f,_0x15e35b){if(_0x15737f[_0xa809('0x54')]['id']){delete _0x15737f['body']['id'];}return db[_0xa809('0x2f')][_0xa809('0x4c')]({'where':{'id':_0x15737f[_0xa809('0x4b')]['id']}})['then'](handleEntityNotFound(_0x15e35b,null))['then'](saveUpdates(_0x15737f[_0xa809('0x54')],null))[_0xa809('0x24')](respondWithResult(_0x15e35b,null))[_0xa809('0x49')](handleError(_0x15e35b,null));};exports[_0xa809('0x25')]=function(_0x5bc0c0,_0x2a44a8){return db[_0xa809('0x2f')]['find']({'where':{'id':_0x5bc0c0[_0xa809('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2a44a8,null))[_0xa809('0x24')](removeEntity(_0x2a44a8,null))[_0xa809('0x49')](handleError(_0x2a44a8,null));};exports['download']=function(_0x74691e,_0x11dff2,_0x2e01b2){return db[_0xa809('0x2f')]['find']({'where':{'id':_0x74691e[_0xa809('0x4b')]['id']},'attributes':[_0xa809('0x2b'),_0xa809('0x55'),_0xa809('0x56'),_0xa809('0x57')],'raw':!![]})[_0xa809('0x24')](handleEntityNotFound(_0x11dff2,null))[_0xa809('0x24')](function(_0x304c13){if(_0x304c13){if(!fs[_0xa809('0x58')](path[_0xa809('0x59')](config[_0xa809('0x5a')],_0xa809('0x5b'),_0x304c13[_0xa809('0x56')]))){throw new db[(_0xa809('0x5c'))]['ValidationError'](_0xa809('0x5d'));}if(_0x74691e[_0xa809('0x34')][_0xa809('0x5e')]){return _0x11dff2[_0xa809('0x19')](0xc8);}return _0x11dff2[_0xa809('0x5f')](path[_0xa809('0x59')](config[_0xa809('0x5a')],_0xa809('0x5b'),_0x304c13['savename']),util[_0xa809('0x60')](_0xa809('0x61'),_0x304c13[_0xa809('0x55')]||_0x304c13[_0xa809('0x2b')],_0x304c13[_0xa809('0x57')][_0xa809('0x62')]()));}})[_0xa809('0x49')](handleError(_0x11dff2,null));}; \ No newline at end of file +var _0x804e=['VIRTUAL','AnalyticExtractedReport','includeAll','include','rows','catch','show','params','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','download','basename','existsSync','join','root','server/files/reports','savename','Sequelize','ValidationError','exists','format','%s.%s','output','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','get','ExtractedReports','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x3e2b54,_0x1a3da4){var _0x40bca0=function(_0x1f697f){while(--_0x1f697f){_0x3e2b54['push'](_0x3e2b54['shift']());}};_0x40bca0(++_0x1a3da4);}(_0x804e,0x14a));var _0xe804=function(_0x5c6274,_0x248866){_0x5c6274=_0x5c6274-0x0;var _0xcef312=_0x804e[_0x5c6274];return _0xcef312;};'use strict';var pdf=require(_0xe804('0x0'));var emlformat=require(_0xe804('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe804('0x2'));var jsonpatch=require(_0xe804('0x3'));var rp=require(_0xe804('0x4'));var moment=require(_0xe804('0x5'));var BPromise=require(_0xe804('0x6'));var Mustache=require(_0xe804('0x7'));var util=require(_0xe804('0x8'));var path=require(_0xe804('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe804('0xa'));var fs=require('fs');var _=require(_0xe804('0xb'));var squel=require(_0xe804('0xc'));var crypto=require(_0xe804('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe804('0xe'));var toCsv=require(_0xe804('0xf'));var querystring=require(_0xe804('0x10'));var Papa=require(_0xe804('0x11'));var Redis=require(_0xe804('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe804('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe804('0x14'));var logger=require(_0xe804('0x15'))(_0xe804('0x16'));var utils=require(_0xe804('0x17'));var config=require(_0xe804('0x18'));var licenseUtil=require(_0xe804('0x19'));var db=require(_0xe804('0x1a'))['db'];function respondWithStatusCode(_0xd98b7b,_0x3ee549){_0x3ee549=_0x3ee549||0xcc;return function(_0x3b9cb0){if(_0x3b9cb0){return _0xd98b7b['sendStatus'](_0x3ee549);}return _0xd98b7b[_0xe804('0x1b')](_0x3ee549)[_0xe804('0x1c')]();};}function respondWithResult(_0x258e9e,_0x5e8761){_0x5e8761=_0x5e8761||0xc8;return function(_0x546f59){if(_0x546f59){return _0x258e9e[_0xe804('0x1b')](_0x5e8761)[_0xe804('0x1d')](_0x546f59);}};}function respondWithFilteredResult(_0xccbdf0,_0x54097c){return function(_0x53a902){if(_0x53a902){var _0x360711=_0x53a902[_0xe804('0x1e')],_0xa9163b=_0x54097c[_0xe804('0x1f')],_0x49e681=_0x54097c[_0xe804('0x1f')]+_0x54097c[_0xe804('0x20')],_0x581d3d;if(_0x49e681>=_0x360711){_0x49e681=_0x360711;_0x581d3d=0xc8;}else{_0x581d3d=0xce;}_0xccbdf0[_0xe804('0x1b')](_0x581d3d);return _0xccbdf0['set']('Content-Range',_0xa9163b+'-'+_0x49e681+'/'+_0x360711)[_0xe804('0x1d')](_0x53a902);}return null;};}function patchUpdates(_0x48af7d){return function(_0x239b76){try{jsonpatch[_0xe804('0x21')](_0x239b76,_0x48af7d,!![]);}catch(_0x53ca43){return BPromise[_0xe804('0x22')](_0x53ca43);}return _0x239b76[_0xe804('0x23')]();};}function saveUpdates(_0x3891ed,_0x36e326){return function(_0x14cd83){if(_0x14cd83){return _0x14cd83[_0xe804('0x24')](_0x3891ed)[_0xe804('0x25')](function(_0x10213c){return _0x10213c;});}return null;};}function removeEntity(_0x3e3be8,_0x4fb2d7){return function(_0x1780da){if(_0x1780da){return _0x1780da[_0xe804('0x26')]()[_0xe804('0x25')](function(){var _0x6e096b=_0x1780da[_0xe804('0x27')]({'plain':!![]});var _0x358bee=_0xe804('0x28');return db['UserProfileResource'][_0xe804('0x26')]({'where':{'type':_0x358bee,'resourceId':_0x6e096b['id']}})['then'](function(){return _0x1780da;});})[_0xe804('0x25')](function(){_0x3e3be8[_0xe804('0x1b')](0xcc)[_0xe804('0x1c')]();});}};}function handleEntityNotFound(_0x1c5521,_0x5e3bc0){return function(_0x2af912){if(!_0x2af912){_0x1c5521[_0xe804('0x29')](0x194);}return _0x2af912;};}function handleError(_0x4ee518,_0x19843a){_0x19843a=_0x19843a||0x1f4;return function(_0x485502){logger[_0xe804('0x2a')](_0x485502[_0xe804('0x2b')]);if(_0x485502[_0xe804('0x2c')]){delete _0x485502[_0xe804('0x2c')];}_0x4ee518['status'](_0x19843a)[_0xe804('0x2d')](_0x485502);};}exports[_0xe804('0x2e')]=function(_0x11b045,_0x165a13){var _0x996e89={},_0x2fd36b={},_0x381f62={'count':0x0,'rows':[]};var _0x3a1511=_[_0xe804('0x2f')](db['AnalyticExtractedReport'][_0xe804('0x30')],function(_0x36dd27){return{'name':_0x36dd27['fieldName'],'type':_0x36dd27[_0xe804('0x31')][_0xe804('0x32')]};});_0x2fd36b['model']=_[_0xe804('0x2f')](_0x3a1511,_0xe804('0x2c'));_0x2fd36b[_0xe804('0x33')]=_[_0xe804('0x34')](_0x11b045[_0xe804('0x33')]);_0x2fd36b[_0xe804('0x35')]=_[_0xe804('0x36')](_0x2fd36b[_0xe804('0x37')],_0x2fd36b['query']);_0x996e89[_0xe804('0x38')]=_[_0xe804('0x36')](_0x2fd36b['model'],qs['fields'](_0x11b045[_0xe804('0x33')]['fields']));_0x996e89[_0xe804('0x38')]=_0x996e89[_0xe804('0x38')][_0xe804('0x39')]?_0x996e89['attributes']:_0x2fd36b[_0xe804('0x37')];if(!_0x11b045[_0xe804('0x33')][_0xe804('0x3a')](_0xe804('0x3b'))){_0x996e89[_0xe804('0x20')]=qs[_0xe804('0x20')](_0x11b045[_0xe804('0x33')]['limit']);_0x996e89[_0xe804('0x1f')]=qs[_0xe804('0x1f')](_0x11b045['query'][_0xe804('0x1f')]);}_0x996e89[_0xe804('0x3c')]=qs[_0xe804('0x3d')](_0x11b045[_0xe804('0x33')][_0xe804('0x3d')]);_0x996e89[_0xe804('0x3e')]=qs[_0xe804('0x35')](_[_0xe804('0x3f')](_0x11b045[_0xe804('0x33')],_0x2fd36b[_0xe804('0x35')]),_0x3a1511);if(_0x11b045[_0xe804('0x33')][_0xe804('0x40')]){_0x996e89[_0xe804('0x3e')]=_[_0xe804('0x41')](_0x996e89[_0xe804('0x3e')],{'$or':_[_0xe804('0x2f')](_0x3a1511,function(_0x35160b){if(_0x35160b['type']!==_0xe804('0x42')){var _0x487a8e={};_0x487a8e[_0x35160b['name']]={'$like':'%'+_0x11b045[_0xe804('0x33')]['filter']+'%'};return _0x487a8e;}})});}_0x996e89=_[_0xe804('0x41')]({},_0x996e89,_0x11b045['options']);var _0x1365e7={'where':_0x996e89[_0xe804('0x3e')]};return db[_0xe804('0x43')][_0xe804('0x1e')](_0x1365e7)['then'](function(_0x18d449){_0x381f62[_0xe804('0x1e')]=_0x18d449;if(_0x11b045[_0xe804('0x33')][_0xe804('0x44')]){_0x996e89[_0xe804('0x45')]=[{'all':!![]}];}return db[_0xe804('0x43')]['findAll'](_0x996e89);})[_0xe804('0x25')](function(_0x3e4368){_0x381f62[_0xe804('0x46')]=_0x3e4368;return _0x381f62;})[_0xe804('0x25')](respondWithFilteredResult(_0x165a13,_0x996e89))[_0xe804('0x47')](handleError(_0x165a13,null));};exports[_0xe804('0x48')]=function(_0x60a9ef,_0x1a2d5b){var _0x3ec2bf={'raw':!![],'where':{'id':_0x60a9ef[_0xe804('0x49')]['id']}},_0x1e556c={};_0x1e556c[_0xe804('0x37')]=_[_0xe804('0x34')](db[_0xe804('0x43')][_0xe804('0x30')]);_0x1e556c['query']=_[_0xe804('0x34')](_0x60a9ef[_0xe804('0x33')]);_0x1e556c[_0xe804('0x35')]=_['intersection'](_0x1e556c[_0xe804('0x37')],_0x1e556c[_0xe804('0x33')]);_0x3ec2bf[_0xe804('0x38')]=_['intersection'](_0x1e556c[_0xe804('0x37')],qs[_0xe804('0x4a')](_0x60a9ef['query'][_0xe804('0x4a')]));_0x3ec2bf[_0xe804('0x38')]=_0x3ec2bf['attributes'][_0xe804('0x39')]?_0x3ec2bf[_0xe804('0x38')]:_0x1e556c[_0xe804('0x37')];if(_0x60a9ef[_0xe804('0x33')][_0xe804('0x44')]){_0x3ec2bf['include']=[{'all':!![]}];}_0x3ec2bf=_[_0xe804('0x41')]({},_0x3ec2bf,_0x60a9ef[_0xe804('0x4b')]);return db['AnalyticExtractedReport'][_0xe804('0x4c')](_0x3ec2bf)[_0xe804('0x25')](handleEntityNotFound(_0x1a2d5b,null))[_0xe804('0x25')](respondWithResult(_0x1a2d5b,null))[_0xe804('0x47')](handleError(_0x1a2d5b,null));};exports[_0xe804('0x4d')]=function(_0xc9f0e6,_0x1e4193){return db[_0xe804('0x43')][_0xe804('0x4d')](_0xc9f0e6[_0xe804('0x4e')],{})['then'](function(_0xb96c92){var _0x5e0617=_0xc9f0e6[_0xe804('0x4f')][_0xe804('0x27')]({'plain':!![]});if(!_0x5e0617)throw new Error(_0xe804('0x50'));if(_0x5e0617[_0xe804('0x51')]===_0xe804('0x4f')){var _0x5a86d9=_0xb96c92[_0xe804('0x27')]({'plain':!![]});var _0x5cac14=_0xe804('0x28');return db[_0xe804('0x52')][_0xe804('0x4c')]({'where':{'name':_0x5cac14,'userProfileId':_0x5e0617[_0xe804('0x53')]},'raw':!![]})[_0xe804('0x25')](function(_0x183e86){if(_0x183e86&&_0x183e86[_0xe804('0x54')]===0x0){return db['UserProfileResource'][_0xe804('0x4d')]({'name':_0x5a86d9['name'],'resourceId':_0x5a86d9['id'],'type':_0x183e86['name'],'sectionId':_0x183e86['id']},{})[_0xe804('0x25')](function(){return _0xb96c92;});}else{return _0xb96c92;}})[_0xe804('0x47')](function(_0x20a817){logger['error'](_0xe804('0x55'),_0x20a817);throw _0x20a817;});}return _0xb96c92;})['then'](respondWithResult(_0x1e4193,0xc9))[_0xe804('0x47')](handleError(_0x1e4193,null));};exports[_0xe804('0x24')]=function(_0x50ffca,_0x30c31e){if(_0x50ffca[_0xe804('0x4e')]['id']){delete _0x50ffca['body']['id'];}return db[_0xe804('0x43')][_0xe804('0x4c')]({'where':{'id':_0x50ffca[_0xe804('0x49')]['id']}})[_0xe804('0x25')](handleEntityNotFound(_0x30c31e,null))['then'](saveUpdates(_0x50ffca[_0xe804('0x4e')],null))['then'](respondWithResult(_0x30c31e,null))['catch'](handleError(_0x30c31e,null));};exports[_0xe804('0x26')]=function(_0x39715d,_0x19ef4b){return db[_0xe804('0x43')]['find']({'where':{'id':_0x39715d[_0xe804('0x49')]['id']}})[_0xe804('0x25')](handleEntityNotFound(_0x19ef4b,null))[_0xe804('0x25')](removeEntity(_0x19ef4b,null))[_0xe804('0x47')](handleError(_0x19ef4b,null));};exports[_0xe804('0x56')]=function(_0x1ae1cc,_0x830053,_0x257283){return db['AnalyticExtractedReport'][_0xe804('0x4c')]({'where':{'id':_0x1ae1cc[_0xe804('0x49')]['id']},'attributes':[_0xe804('0x2c'),_0xe804('0x57'),'savename','output'],'raw':!![]})[_0xe804('0x25')](handleEntityNotFound(_0x830053,null))['then'](function(_0x177d55){if(_0x177d55){if(!fs[_0xe804('0x58')](path[_0xe804('0x59')](config[_0xe804('0x5a')],_0xe804('0x5b'),_0x177d55[_0xe804('0x5c')]))){throw new db[(_0xe804('0x5d'))][(_0xe804('0x5e'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x1ae1cc['query'][_0xe804('0x5f')]){return _0x830053[_0xe804('0x29')](0xc8);}return _0x830053[_0xe804('0x56')](path['join'](config[_0xe804('0x5a')],'server/files/reports',_0x177d55[_0xe804('0x5c')]),util[_0xe804('0x60')](_0xe804('0x61'),_0x177d55[_0xe804('0x57')]||_0x177d55['name'],_0x177d55[_0xe804('0x62')]['toLowerCase']()));}})['catch'](handleError(_0x830053,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index be67bab..e755644 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 _0xb6dd=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','lodash','util'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xb6dd,0xd6));var _0xdb6d=function(_0x34af08,_0x1cad6b){_0x34af08=_0x34af08-0x0;var _0x28ec57=_0xb6dd[_0x34af08];return _0x28ec57;};'use strict';var _=require(_0xdb6d('0x0'));var util=require(_0xdb6d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdb6d('0x2'));var BPromise=require(_0xdb6d('0x3'));var rp=require(_0xdb6d('0x4'));var fs=require('fs');var path=require(_0xdb6d('0x5'));var rimraf=require(_0xdb6d('0x6'));var config=require(_0xdb6d('0x7'));var attributes=require(_0xdb6d('0x8'));module[_0xdb6d('0x9')]=function(_0x59d286,_0x5c8e6a){return _0x59d286[_0xdb6d('0xa')]('AnalyticExtractedReport',attributes,{'tableName':_0xdb6d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d10=['bluebird','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','lodash','util','../../config/logger','api','moment'];(function(_0x315970,_0x49275f){var _0x2ee67c=function(_0x41fbb9){while(--_0x41fbb9){_0x315970['push'](_0x315970['shift']());}};_0x2ee67c(++_0x49275f);}(_0x4d10,0x8b));var _0x04d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d10[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x04d1('0x0'));var util=require(_0x04d1('0x1'));var logger=require(_0x04d1('0x2'))(_0x04d1('0x3'));var moment=require(_0x04d1('0x4'));var BPromise=require(_0x04d1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x04d1('0x6'));var rimraf=require(_0x04d1('0x7'));var config=require(_0x04d1('0x8'));var attributes=require(_0x04d1('0x9'));module['exports']=function(_0x2491d4,_0x6fb253){return _0x2491d4[_0x04d1('0xa')](_0x04d1('0xb'),attributes,{'tableName':'analytics_extracted_reports','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 3a33949..693a58a 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 _0x0b06=['info','request\x20sent','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x29dfdd,_0x3c5313){var _0x505c74=function(_0x4d2262){while(--_0x4d2262){_0x29dfdd['push'](_0x29dfdd['shift']());}};_0x505c74(++_0x3c5313);}(_0x0b06,0xb1));var _0x60b0=function(_0x301bf7,_0x58d5cb){_0x301bf7=_0x301bf7-0x0;var _0x2237cf=_0x0b06[_0x301bf7];return _0x2237cf;};'use strict';var _=require(_0x60b0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x60b0('0x1'));var fs=require('fs');var Redis=require(_0x60b0('0x2'));var db=require(_0x60b0('0x3'))['db'];var utils=require(_0x60b0('0x4'));var logger=require(_0x60b0('0x5'))('rpc');var config=require(_0x60b0('0x6'));var jayson=require(_0x60b0('0x7'));var client=jayson[_0x60b0('0x8')][_0x60b0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ed59d,_0x3b9365,_0x151439){return new BPromise(function(_0x9d4448,_0x786f84){return client['request'](_0x4ed59d,_0x151439)['then'](function(_0x2414fe){logger[_0x60b0('0xa')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3b9365,_0x60b0('0xb'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x3b9365,'request\x20sent',JSON[_0x60b0('0xc')](_0x2414fe));if(_0x2414fe[_0x60b0('0xd')]){if(_0x2414fe[_0x60b0('0xd')][_0x60b0('0xe')]===0x1f4){logger[_0x60b0('0xd')](_0x60b0('0xf'),_0x3b9365,_0x2414fe[_0x60b0('0xd')][_0x60b0('0x10')]);return _0x786f84(_0x2414fe[_0x60b0('0xd')][_0x60b0('0x10')]);}logger[_0x60b0('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3b9365,_0x2414fe[_0x60b0('0xd')][_0x60b0('0x10')]);return _0x9d4448(_0x2414fe[_0x60b0('0xd')][_0x60b0('0x10')]);}else{logger[_0x60b0('0xa')](_0x60b0('0xf'),_0x3b9365,'request\x20sent');_0x9d4448(_0x2414fe['result'][_0x60b0('0x10')]);}})['catch'](function(_0x37ca2e){logger['error'](_0x60b0('0xf'),_0x3b9365,_0x37ca2e);_0x786f84(_0x37ca2e);});});} \ No newline at end of file +var _0x8f1d=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x425b99,_0x4702f5){var _0x32cf11=function(_0x564f5c){while(--_0x564f5c){_0x425b99['push'](_0x425b99['shift']());}};_0x32cf11(++_0x4702f5);}(_0x8f1d,0xec));var _0xd8f1=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x8f1d[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0xd8f1('0x0'));var util=require(_0xd8f1('0x1'));var moment=require(_0xd8f1('0x2'));var BPromise=require(_0xd8f1('0x3'));var rs=require(_0xd8f1('0x4'));var fs=require('fs');var Redis=require(_0xd8f1('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd8f1('0x6'))(_0xd8f1('0x7'));var config=require(_0xd8f1('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd8f1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x385d7c,_0x22dbb3,_0x16e8db){return new BPromise(function(_0x2d7601,_0x1d2670){return client['request'](_0x385d7c,_0x16e8db)[_0xd8f1('0xa')](function(_0x1cbe33){logger['info'](_0xd8f1('0xb'),_0x22dbb3,_0xd8f1('0xc'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x22dbb3,'request\x20sent',JSON[_0xd8f1('0xd')](_0x1cbe33));if(_0x1cbe33[_0xd8f1('0xe')]){if(_0x1cbe33[_0xd8f1('0xe')][_0xd8f1('0xf')]===0x1f4){logger['error'](_0xd8f1('0xb'),_0x22dbb3,_0x1cbe33['error'][_0xd8f1('0x10')]);return _0x1d2670(_0x1cbe33[_0xd8f1('0xe')][_0xd8f1('0x10')]);}logger[_0xd8f1('0xe')](_0xd8f1('0xb'),_0x22dbb3,_0x1cbe33['error'][_0xd8f1('0x10')]);return _0x2d7601(_0x1cbe33[_0xd8f1('0xe')][_0xd8f1('0x10')]);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x22dbb3,_0xd8f1('0xc'));_0x2d7601(_0x1cbe33[_0xd8f1('0x11')]['message']);}})['catch'](function(_0x5a150f){logger[_0xd8f1('0xe')](_0xd8f1('0xb'),_0x22dbb3,_0x5a150f);_0x1d2670(_0x5a150f);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index f92f792..7d34c65 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 _0xdf46=['download','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','/:id/download'];(function(_0xf74c5f,_0x4ba01e){var _0x26c6b0=function(_0xef0c16){while(--_0xef0c16){_0xf74c5f['push'](_0xf74c5f['shift']());}};_0x26c6b0(++_0x4ba01e);}(_0xdf46,0x16f));var _0x6df4=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xdf46[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x6df4('0x0'));var util=require(_0x6df4('0x1'));var path=require(_0x6df4('0x2'));var timeout=require(_0x6df4('0x3'));var express=require('express');var router=express[_0x6df4('0x4')]();var auth=require(_0x6df4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6df4('0x6'));var controller=require(_0x6df4('0x7'));router[_0x6df4('0x8')]('/',auth[_0x6df4('0x9')](),controller[_0x6df4('0xa')]);router[_0x6df4('0x8')](_0x6df4('0xb'),auth[_0x6df4('0x9')](),controller['show']);router[_0x6df4('0x8')](_0x6df4('0xc'),auth[_0x6df4('0x9')](),controller[_0x6df4('0xd')]);router['post']('/',auth[_0x6df4('0x9')](),controller[_0x6df4('0xe')]);router['put'](_0x6df4('0xb'),auth[_0x6df4('0x9')](),controller[_0x6df4('0xf')]);router[_0x6df4('0x10')](_0x6df4('0xb'),auth[_0x6df4('0x9')](),controller[_0x6df4('0x11')]);module[_0x6df4('0x12')]=router; \ No newline at end of file +var _0x6cd2=['index','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated'];(function(_0x591eef,_0xef7f26){var _0x4e64b4=function(_0xb7a78c){while(--_0xb7a78c){_0x591eef['push'](_0x591eef['shift']());}};_0x4e64b4(++_0xef7f26);}(_0x6cd2,0x147));var _0x26cd=function(_0x5447f2,_0x153816){_0x5447f2=_0x5447f2-0x0;var _0x1bac25=_0x6cd2[_0x5447f2];return _0x1bac25;};'use strict';var multer=require(_0x26cd('0x0'));var util=require(_0x26cd('0x1'));var path=require(_0x26cd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x26cd('0x3')]();var auth=require(_0x26cd('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x26cd('0x5'));var controller=require(_0x26cd('0x6'));router[_0x26cd('0x7')]('/',auth[_0x26cd('0x8')](),controller[_0x26cd('0x9')]);router['get'](_0x26cd('0xa'),auth[_0x26cd('0x8')](),controller[_0x26cd('0xb')]);router['get'](_0x26cd('0xc'),auth[_0x26cd('0x8')](),controller[_0x26cd('0xd')]);router[_0x26cd('0xe')]('/',auth[_0x26cd('0x8')](),controller[_0x26cd('0xf')]);router[_0x26cd('0x10')](_0x26cd('0xa'),auth[_0x26cd('0x8')](),controller[_0x26cd('0x11')]);router[_0x26cd('0x12')]('/:id',auth[_0x26cd('0x8')](),controller[_0x26cd('0x13')]);module[_0x26cd('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 3ff6467..6a016c5 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 _0x814b=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x533676,_0x2be01c){var _0x32f7bd=function(_0x5b28fd){while(--_0x5b28fd){_0x533676['push'](_0x533676['shift']());}};_0x32f7bd(++_0x2be01c);}(_0x814b,0x1a2));var _0xb814=function(_0x4ddfe1,_0x35939d){_0x4ddfe1=_0x4ddfe1-0x0;var _0x4aaf51=_0x814b[_0x4ddfe1];return _0x4aaf51;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'field':{'type':Sequelize[_0xb814('0x2')]},'alias':{'type':Sequelize[_0xb814('0x3')]},'function':{'type':Sequelize[_0xb814('0x3')]},'format':{'type':Sequelize[_0xb814('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xb814('0x3')]},'custom':{'type':Sequelize[_0xb814('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x814b=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x814b,0x1a2));var _0xb814=function(_0xa599e2,_0x3046be){_0xa599e2=_0xa599e2-0x0;var _0x122f49=_0x814b[_0xa599e2];return _0x122f49;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'field':{'type':Sequelize[_0xb814('0x2')]},'alias':{'type':Sequelize[_0xb814('0x3')]},'function':{'type':Sequelize[_0xb814('0x3')]},'format':{'type':Sequelize[_0xb814('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xb814('0x3')]},'custom':{'type':Sequelize[_0xb814('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 9d930c0..ea66c6d 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 _0x96ad=['status','json','count','offset','limit','set','save','update','then','destroy','stack','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','where','filter','merge','VIRTUAL','name','options','include','rows','catch','params','includeAll','create','body','bulkCreate','find','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','CustomReportId','findAll','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x29947d,_0x2a50ae){var _0x897f64=function(_0x1db59f){while(--_0x1db59f){_0x29947d['push'](_0x29947d['shift']());}};_0x897f64(++_0x2a50ae);}(_0x96ad,0xcd));var _0xd96a=function(_0x2181fc,_0x7283aa){_0x2181fc=_0x2181fc-0x0;var _0x315da1=_0x96ad[_0x2181fc];return _0x315da1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd96a('0x0'));var rimraf=require(_0xd96a('0x1'));var zipdir=require(_0xd96a('0x2'));var jsonpatch=require(_0xd96a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd96a('0x4'));var Mustache=require(_0xd96a('0x5'));var util=require(_0xd96a('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd96a('0x7'));var ejs=require(_0xd96a('0x8'));var fs=require('fs');var _=require(_0xd96a('0x9'));var squel=require(_0xd96a('0xa'));var crypto=require(_0xd96a('0xb'));var jsforce=require(_0xd96a('0xc'));var deskjs=require(_0xd96a('0xd'));var toCsv=require(_0xd96a('0x7'));var querystring=require(_0xd96a('0xe'));var Papa=require(_0xd96a('0xf'));var Redis=require(_0xd96a('0x10'));var authService=require(_0xd96a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd96a('0x12'));var hardwareService=require(_0xd96a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xd96a('0x14'));var config=require(_0xd96a('0x15'));var licenseUtil=require(_0xd96a('0x16'));var db=require(_0xd96a('0x17'))['db'];function respondWithStatusCode(_0x1c7b9f,_0x37c2c7){_0x37c2c7=_0x37c2c7||0xcc;return function(_0x35efa4){if(_0x35efa4){return _0x1c7b9f[_0xd96a('0x18')](_0x37c2c7);}return _0x1c7b9f['status'](_0x37c2c7)[_0xd96a('0x19')]();};}function respondWithResult(_0x4d295d,_0x22313f){_0x22313f=_0x22313f||0xc8;return function(_0xc36411){if(_0xc36411){return _0x4d295d[_0xd96a('0x1a')](_0x22313f)[_0xd96a('0x1b')](_0xc36411);}};}function respondWithFilteredResult(_0x12de91,_0x4f485d){return function(_0x4d353e){if(_0x4d353e){var _0x590bce=_0x4d353e[_0xd96a('0x1c')],_0x10e9e4=_0x4f485d[_0xd96a('0x1d')],_0x33356c=_0x4f485d[_0xd96a('0x1d')]+_0x4f485d[_0xd96a('0x1e')],_0x862c36;if(_0x33356c>=_0x590bce){_0x33356c=_0x590bce;_0x862c36=0xc8;}else{_0x862c36=0xce;}_0x12de91[_0xd96a('0x1a')](_0x862c36);return _0x12de91[_0xd96a('0x1f')]('Content-Range',_0x10e9e4+'-'+_0x33356c+'/'+_0x590bce)[_0xd96a('0x1b')](_0x4d353e);}return null;};}function patchUpdates(_0x160547){return function(_0x3cd64d){try{jsonpatch['apply'](_0x3cd64d,_0x160547,!![]);}catch(_0x2786cc){return BPromise['reject'](_0x2786cc);}return _0x3cd64d[_0xd96a('0x20')]();};}function saveUpdates(_0x46a13c,_0x28f876){return function(_0x43b4f6){if(_0x43b4f6){return _0x43b4f6[_0xd96a('0x21')](_0x46a13c)[_0xd96a('0x22')](function(_0x19076c){return _0x19076c;});}return null;};}function removeEntity(_0x28bb79,_0x3176f4){return function(_0x55f4ba){if(_0x55f4ba){return _0x55f4ba[_0xd96a('0x23')]()['then'](function(){_0x28bb79[_0xd96a('0x1a')](0xcc)[_0xd96a('0x19')]();});}};}function handleEntityNotFound(_0x2cf664,_0x49bdf9){return function(_0x51a25d){if(!_0x51a25d){_0x2cf664['sendStatus'](0x194);}return _0x51a25d;};}function handleError(_0x14d186,_0x3b7d69){_0x3b7d69=_0x3b7d69||0x1f4;return function(_0x457a14){logger['error'](_0x457a14[_0xd96a('0x24')]);if(_0x457a14['name']){delete _0x457a14['name'];}_0x14d186['status'](_0x3b7d69)[_0xd96a('0x25')](_0x457a14);};}exports[_0xd96a('0x26')]=function(_0x18bed8,_0x44fdca){var _0x3478d3={},_0x201c0e={},_0x426809={'count':0x0,'rows':[]};var _0x214098=_[_0xd96a('0x27')](db[_0xd96a('0x28')][_0xd96a('0x29')],function(_0x265d8b){return{'name':_0x265d8b[_0xd96a('0x2a')],'type':_0x265d8b[_0xd96a('0x2b')][_0xd96a('0x2c')]};});_0x201c0e[_0xd96a('0x2d')]=_[_0xd96a('0x27')](_0x214098,'name');_0x201c0e[_0xd96a('0x2e')]=_[_0xd96a('0x2f')](_0x18bed8[_0xd96a('0x2e')]);_0x201c0e[_0xd96a('0x30')]=_['intersection'](_0x201c0e[_0xd96a('0x2d')],_0x201c0e[_0xd96a('0x2e')]);_0x3478d3[_0xd96a('0x31')]=_[_0xd96a('0x32')](_0x201c0e[_0xd96a('0x2d')],qs[_0xd96a('0x33')](_0x18bed8['query'][_0xd96a('0x33')]));_0x3478d3[_0xd96a('0x31')]=_0x3478d3[_0xd96a('0x31')][_0xd96a('0x34')]?_0x3478d3[_0xd96a('0x31')]:_0x201c0e['model'];if(!_0x18bed8['query'][_0xd96a('0x35')]('nolimit')){_0x3478d3[_0xd96a('0x1e')]=qs[_0xd96a('0x1e')](_0x18bed8[_0xd96a('0x2e')][_0xd96a('0x1e')]);_0x3478d3['offset']=qs[_0xd96a('0x1d')](_0x18bed8[_0xd96a('0x2e')][_0xd96a('0x1d')]);}_0x3478d3[_0xd96a('0x36')]=qs['sort'](_0x18bed8['query']['sort']);_0x3478d3[_0xd96a('0x37')]=qs[_0xd96a('0x30')](_['pick'](_0x18bed8[_0xd96a('0x2e')],_0x201c0e[_0xd96a('0x30')]),_0x214098);if(_0x18bed8[_0xd96a('0x2e')][_0xd96a('0x38')]){_0x3478d3[_0xd96a('0x37')]=_[_0xd96a('0x39')](_0x3478d3['where'],{'$or':_[_0xd96a('0x27')](_0x214098,function(_0x259958){if(_0x259958[_0xd96a('0x2b')]!==_0xd96a('0x3a')){var _0x4859e5={};_0x4859e5[_0x259958[_0xd96a('0x3b')]]={'$like':'%'+_0x18bed8['query'][_0xd96a('0x38')]+'%'};return _0x4859e5;}})});}_0x3478d3=_['merge']({},_0x3478d3,_0x18bed8[_0xd96a('0x3c')]);var _0x1537f2={'where':_0x3478d3[_0xd96a('0x37')]};return db[_0xd96a('0x28')][_0xd96a('0x1c')](_0x1537f2)[_0xd96a('0x22')](function(_0x1423d2){_0x426809[_0xd96a('0x1c')]=_0x1423d2;if(_0x18bed8[_0xd96a('0x2e')]['includeAll']){_0x3478d3[_0xd96a('0x3d')]=[{'all':!![]}];}return db[_0xd96a('0x28')]['findAll'](_0x3478d3);})[_0xd96a('0x22')](function(_0xa8fdb9){_0x426809[_0xd96a('0x3e')]=_0xa8fdb9;return _0x426809;})['then'](respondWithFilteredResult(_0x44fdca,_0x3478d3))[_0xd96a('0x3f')](handleError(_0x44fdca,null));};exports['show']=function(_0x1dba54,_0x33a779){var _0x3b95e6={'raw':![],'where':{'id':_0x1dba54[_0xd96a('0x40')]['id']}},_0x48624e={};_0x48624e[_0xd96a('0x2d')]=_[_0xd96a('0x2f')](db[_0xd96a('0x28')][_0xd96a('0x29')]);_0x48624e[_0xd96a('0x2e')]=_[_0xd96a('0x2f')](_0x1dba54[_0xd96a('0x2e')]);_0x48624e[_0xd96a('0x30')]=_['intersection'](_0x48624e['model'],_0x48624e[_0xd96a('0x2e')]);_0x3b95e6[_0xd96a('0x31')]=_[_0xd96a('0x32')](_0x48624e[_0xd96a('0x2d')],qs[_0xd96a('0x33')](_0x1dba54['query'][_0xd96a('0x33')]));_0x3b95e6[_0xd96a('0x31')]=_0x3b95e6[_0xd96a('0x31')][_0xd96a('0x34')]?_0x3b95e6['attributes']:_0x48624e[_0xd96a('0x2d')];if(_0x1dba54[_0xd96a('0x2e')][_0xd96a('0x41')]){_0x3b95e6[_0xd96a('0x3d')]=[{'all':!![]}];}_0x3b95e6=_[_0xd96a('0x39')]({},_0x3b95e6,_0x1dba54[_0xd96a('0x3c')]);return db['AnalyticFieldReport']['find'](_0x3b95e6)['then'](handleEntityNotFound(_0x33a779,null))[_0xd96a('0x22')](respondWithResult(_0x33a779,null))[_0xd96a('0x3f')](handleError(_0x33a779,null));};exports[_0xd96a('0x42')]=function(_0x1ded40,_0x157fb6){return db[_0xd96a('0x28')]['create'](_0x1ded40[_0xd96a('0x43')],{})[_0xd96a('0x22')](respondWithResult(_0x157fb6,0xc9))[_0xd96a('0x3f')](handleError(_0x157fb6,null));};exports['bulkCreate']=function(_0x314d2c,_0x4c2a49){return db[_0xd96a('0x28')][_0xd96a('0x44')](_0x314d2c[_0xd96a('0x43')],{'raw':![],'individualHooks':!![]})[_0xd96a('0x22')](respondWithResult(_0x4c2a49,0xc9))['catch'](handleError(_0x4c2a49,null));};exports[_0xd96a('0x21')]=function(_0x28b92c,_0x519ff6){if(_0x28b92c[_0xd96a('0x43')]['id']){delete _0x28b92c[_0xd96a('0x43')]['id'];}return db[_0xd96a('0x28')]['find']({'where':{'id':_0x28b92c[_0xd96a('0x40')]['id']}})['then'](handleEntityNotFound(_0x519ff6,null))[_0xd96a('0x22')](saveUpdates(_0x28b92c[_0xd96a('0x43')],null))['then'](respondWithResult(_0x519ff6,null))[_0xd96a('0x3f')](handleError(_0x519ff6,null));};exports['destroy']=function(_0x589ffb,_0x5f4f02){return db[_0xd96a('0x28')][_0xd96a('0x45')]({'where':{'id':_0x589ffb[_0xd96a('0x40')]['id']}})['then'](handleEntityNotFound(_0x5f4f02,null))[_0xd96a('0x22')](removeEntity(_0x5f4f02,null))[_0xd96a('0x3f')](handleError(_0x5f4f02,null));};exports[_0xd96a('0x46')]=function(_0xb3d02,_0xe5ba47){return db['AnalyticFieldReport'][_0xd96a('0x23')]({'where':{'id':_0xb3d02[_0xd96a('0x2e')][_0xd96a('0x47')]||[]},'raw':![],'individualHooks':!![]})[_0xd96a('0x22')](respondWithResult(_0xe5ba47,0xcc))[_0xd96a('0x3f')](handleError(_0xe5ba47,null));};exports[_0xd96a('0x48')]=function(_0x4fdfa5,_0x579111,_0x2d0a37){return db[_0xd96a('0x49')][_0xd96a('0x4a')]({'where':{'id':_0x4fdfa5[_0xd96a('0x40')]['id']}})[_0xd96a('0x22')](handleEntityNotFound(_0x579111,null))[_0xd96a('0x22')](function(_0x7e8b98){if(_0x7e8b98){return db['sequelize']['transaction'](function(_0x255f28){return db[_0xd96a('0x28')][_0xd96a('0x23')]({'where':{'CustomReportId':_0x4fdfa5[_0xd96a('0x40')]['id']},'transaction':_0x255f28})[_0xd96a('0x22')](function(_0x34954b){var _0x4fe728=_['map'](_0x4fdfa5[_0xd96a('0x43')],function(_0x44a94b){delete _0x44a94b['id'];_0x44a94b[_0xd96a('0x4b')]=_0x4fdfa5[_0xd96a('0x40')]['id'];return _0x44a94b;});return db['AnalyticFieldReport'][_0xd96a('0x44')](_0x4fe728,{'transaction':_0x255f28});});})[_0xd96a('0x22')](function(){return db[_0xd96a('0x28')][_0xd96a('0x4c')]({'where':{'CustomReportId':_0x4fdfa5[_0xd96a('0x40')]['id']}});});}})[_0xd96a('0x22')](respondWithResult(_0x579111,null))[_0xd96a('0x3f')](handleError(_0x579111,null));}; \ No newline at end of file +var _0xcfd8=['addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','rimraf','zip-dir','request-promise','moment','mustache','util','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','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','AnalyticFieldReport','then','includeAll','include','findAll','rows','show','params','find','create','body','bulkCreate','update','catch','bulkDestroy'];(function(_0x9d1e6b,_0x3bdc22){var _0x2b3070=function(_0x4c4ced){while(--_0x4c4ced){_0x9d1e6b['push'](_0x9d1e6b['shift']());}};_0x2b3070(++_0x3bdc22);}(_0xcfd8,0xa5));var _0x8cfd=function(_0xa03344,_0x581292){_0xa03344=_0xa03344-0x0;var _0x38acfd=_0xcfd8[_0xa03344];return _0x38acfd;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8cfd('0x0'));var zipdir=require(_0x8cfd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8cfd('0x2'));var moment=require(_0x8cfd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8cfd('0x4'));var util=require(_0x8cfd('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x8cfd('0x6'));var ejs=require(_0x8cfd('0x7'));var fs=require('fs');var _=require(_0x8cfd('0x8'));var squel=require('squel');var crypto=require(_0x8cfd('0x9'));var jsforce=require(_0x8cfd('0xa'));var deskjs=require(_0x8cfd('0xb'));var toCsv=require('to-csv');var querystring=require(_0x8cfd('0xc'));var Papa=require(_0x8cfd('0xd'));var Redis=require(_0x8cfd('0xe'));var authService=require(_0x8cfd('0xf'));var qs=require(_0x8cfd('0x10'));var as=require(_0x8cfd('0x11'));var hardwareService=require(_0x8cfd('0x12'));var logger=require(_0x8cfd('0x13'))(_0x8cfd('0x14'));var utils=require(_0x8cfd('0x15'));var config=require(_0x8cfd('0x16'));var licenseUtil=require(_0x8cfd('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c9cb8,_0x496051){_0x496051=_0x496051||0xcc;return function(_0x1d7243){if(_0x1d7243){return _0x4c9cb8[_0x8cfd('0x18')](_0x496051);}return _0x4c9cb8[_0x8cfd('0x19')](_0x496051)[_0x8cfd('0x1a')]();};}function respondWithResult(_0x282186,_0x38461f){_0x38461f=_0x38461f||0xc8;return function(_0x3871e5){if(_0x3871e5){return _0x282186[_0x8cfd('0x19')](_0x38461f)[_0x8cfd('0x1b')](_0x3871e5);}};}function respondWithFilteredResult(_0xf1f52a,_0x5958e8){return function(_0x16b8df){if(_0x16b8df){var _0x5ed5e0=_0x16b8df[_0x8cfd('0x1c')],_0x501659=_0x5958e8[_0x8cfd('0x1d')],_0x57b2b8=_0x5958e8['offset']+_0x5958e8[_0x8cfd('0x1e')],_0x15f4b6;if(_0x57b2b8>=_0x5ed5e0){_0x57b2b8=_0x5ed5e0;_0x15f4b6=0xc8;}else{_0x15f4b6=0xce;}_0xf1f52a[_0x8cfd('0x19')](_0x15f4b6);return _0xf1f52a[_0x8cfd('0x1f')](_0x8cfd('0x20'),_0x501659+'-'+_0x57b2b8+'/'+_0x5ed5e0)[_0x8cfd('0x1b')](_0x16b8df);}return null;};}function patchUpdates(_0x1b242f){return function(_0x36cf79){try{jsonpatch[_0x8cfd('0x21')](_0x36cf79,_0x1b242f,!![]);}catch(_0x5c24da){return BPromise[_0x8cfd('0x22')](_0x5c24da);}return _0x36cf79[_0x8cfd('0x23')]();};}function saveUpdates(_0x1995dc,_0x80c6be){return function(_0x3cbc70){if(_0x3cbc70){return _0x3cbc70['update'](_0x1995dc)['then'](function(_0x2bdbd7){return _0x2bdbd7;});}return null;};}function removeEntity(_0x1c4128,_0x187186){return function(_0x2095dd){if(_0x2095dd){return _0x2095dd[_0x8cfd('0x24')]()['then'](function(){_0x1c4128['status'](0xcc)[_0x8cfd('0x1a')]();});}};}function handleEntityNotFound(_0x243937,_0x62b82d){return function(_0x1aa4c9){if(!_0x1aa4c9){_0x243937['sendStatus'](0x194);}return _0x1aa4c9;};}function handleError(_0xc5e670,_0x2394ed){_0x2394ed=_0x2394ed||0x1f4;return function(_0x453571){logger['error'](_0x453571[_0x8cfd('0x25')]);if(_0x453571[_0x8cfd('0x26')]){delete _0x453571['name'];}_0xc5e670['status'](_0x2394ed)['send'](_0x453571);};}exports[_0x8cfd('0x27')]=function(_0x3e72b3,_0x416c85){var _0x1077cb={},_0x3516af={},_0x521074={'count':0x0,'rows':[]};var _0x24ddcc=_[_0x8cfd('0x28')](db['AnalyticFieldReport'][_0x8cfd('0x29')],function(_0x27a53f){return{'name':_0x27a53f[_0x8cfd('0x2a')],'type':_0x27a53f[_0x8cfd('0x2b')][_0x8cfd('0x2c')]};});_0x3516af[_0x8cfd('0x2d')]=_[_0x8cfd('0x28')](_0x24ddcc,_0x8cfd('0x26'));_0x3516af['query']=_[_0x8cfd('0x2e')](_0x3e72b3['query']);_0x3516af[_0x8cfd('0x2f')]=_[_0x8cfd('0x30')](_0x3516af[_0x8cfd('0x2d')],_0x3516af[_0x8cfd('0x31')]);_0x1077cb[_0x8cfd('0x32')]=_[_0x8cfd('0x30')](_0x3516af['model'],qs['fields'](_0x3e72b3[_0x8cfd('0x31')][_0x8cfd('0x33')]));_0x1077cb[_0x8cfd('0x32')]=_0x1077cb[_0x8cfd('0x32')][_0x8cfd('0x34')]?_0x1077cb['attributes']:_0x3516af[_0x8cfd('0x2d')];if(!_0x3e72b3[_0x8cfd('0x31')][_0x8cfd('0x35')](_0x8cfd('0x36'))){_0x1077cb[_0x8cfd('0x1e')]=qs[_0x8cfd('0x1e')](_0x3e72b3[_0x8cfd('0x31')]['limit']);_0x1077cb[_0x8cfd('0x1d')]=qs[_0x8cfd('0x1d')](_0x3e72b3['query']['offset']);}_0x1077cb[_0x8cfd('0x37')]=qs[_0x8cfd('0x38')](_0x3e72b3[_0x8cfd('0x31')][_0x8cfd('0x38')]);_0x1077cb['where']=qs[_0x8cfd('0x2f')](_['pick'](_0x3e72b3['query'],_0x3516af[_0x8cfd('0x2f')]),_0x24ddcc);if(_0x3e72b3[_0x8cfd('0x31')]['filter']){_0x1077cb[_0x8cfd('0x39')]=_['merge'](_0x1077cb[_0x8cfd('0x39')],{'$or':_['map'](_0x24ddcc,function(_0x32b783){if(_0x32b783[_0x8cfd('0x2b')]!=='VIRTUAL'){var _0x1624f7={};_0x1624f7[_0x32b783['name']]={'$like':'%'+_0x3e72b3[_0x8cfd('0x31')][_0x8cfd('0x3a')]+'%'};return _0x1624f7;}})});}_0x1077cb=_[_0x8cfd('0x3b')]({},_0x1077cb,_0x3e72b3['options']);var _0xcc7b87={'where':_0x1077cb['where']};return db[_0x8cfd('0x3c')][_0x8cfd('0x1c')](_0xcc7b87)[_0x8cfd('0x3d')](function(_0xe3f6fb){_0x521074['count']=_0xe3f6fb;if(_0x3e72b3[_0x8cfd('0x31')][_0x8cfd('0x3e')]){_0x1077cb[_0x8cfd('0x3f')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x8cfd('0x40')](_0x1077cb);})[_0x8cfd('0x3d')](function(_0x4fd3be){_0x521074[_0x8cfd('0x41')]=_0x4fd3be;return _0x521074;})[_0x8cfd('0x3d')](respondWithFilteredResult(_0x416c85,_0x1077cb))['catch'](handleError(_0x416c85,null));};exports[_0x8cfd('0x42')]=function(_0x4dbaca,_0x47af54){var _0x1dc035={'raw':![],'where':{'id':_0x4dbaca[_0x8cfd('0x43')]['id']}},_0x47fdb0={};_0x47fdb0['model']=_[_0x8cfd('0x2e')](db[_0x8cfd('0x3c')][_0x8cfd('0x29')]);_0x47fdb0[_0x8cfd('0x31')]=_[_0x8cfd('0x2e')](_0x4dbaca[_0x8cfd('0x31')]);_0x47fdb0[_0x8cfd('0x2f')]=_['intersection'](_0x47fdb0['model'],_0x47fdb0['query']);_0x1dc035[_0x8cfd('0x32')]=_['intersection'](_0x47fdb0['model'],qs[_0x8cfd('0x33')](_0x4dbaca[_0x8cfd('0x31')][_0x8cfd('0x33')]));_0x1dc035[_0x8cfd('0x32')]=_0x1dc035['attributes'][_0x8cfd('0x34')]?_0x1dc035[_0x8cfd('0x32')]:_0x47fdb0[_0x8cfd('0x2d')];if(_0x4dbaca[_0x8cfd('0x31')][_0x8cfd('0x3e')]){_0x1dc035['include']=[{'all':!![]}];}_0x1dc035=_[_0x8cfd('0x3b')]({},_0x1dc035,_0x4dbaca['options']);return db[_0x8cfd('0x3c')][_0x8cfd('0x44')](_0x1dc035)[_0x8cfd('0x3d')](handleEntityNotFound(_0x47af54,null))['then'](respondWithResult(_0x47af54,null))['catch'](handleError(_0x47af54,null));};exports[_0x8cfd('0x45')]=function(_0x348b2c,_0x15a08e){return db[_0x8cfd('0x3c')][_0x8cfd('0x45')](_0x348b2c[_0x8cfd('0x46')],{})[_0x8cfd('0x3d')](respondWithResult(_0x15a08e,0xc9))['catch'](handleError(_0x15a08e,null));};exports[_0x8cfd('0x47')]=function(_0x1c21d2,_0x3e2a86){return db['AnalyticFieldReport'][_0x8cfd('0x47')](_0x1c21d2[_0x8cfd('0x46')],{'raw':![],'individualHooks':!![]})[_0x8cfd('0x3d')](respondWithResult(_0x3e2a86,0xc9))['catch'](handleError(_0x3e2a86,null));};exports[_0x8cfd('0x48')]=function(_0x5c635c,_0x55980d){if(_0x5c635c['body']['id']){delete _0x5c635c[_0x8cfd('0x46')]['id'];}return db['AnalyticFieldReport'][_0x8cfd('0x44')]({'where':{'id':_0x5c635c[_0x8cfd('0x43')]['id']}})['then'](handleEntityNotFound(_0x55980d,null))[_0x8cfd('0x3d')](saveUpdates(_0x5c635c[_0x8cfd('0x46')],null))[_0x8cfd('0x3d')](respondWithResult(_0x55980d,null))[_0x8cfd('0x49')](handleError(_0x55980d,null));};exports['destroy']=function(_0x481cf3,_0x72e467){return db[_0x8cfd('0x3c')][_0x8cfd('0x44')]({'where':{'id':_0x481cf3['params']['id']}})[_0x8cfd('0x3d')](handleEntityNotFound(_0x72e467,null))[_0x8cfd('0x3d')](removeEntity(_0x72e467,null))[_0x8cfd('0x49')](handleError(_0x72e467,null));};exports[_0x8cfd('0x4a')]=function(_0xdb1960,_0x203ef1){return db[_0x8cfd('0x3c')]['destroy']({'where':{'id':_0xdb1960['query']['ids']||[]},'raw':![],'individualHooks':!![]})[_0x8cfd('0x3d')](respondWithResult(_0x203ef1,0xcc))[_0x8cfd('0x49')](handleError(_0x203ef1,null));};exports[_0x8cfd('0x4b')]=function(_0x15ae89,_0x480f1d,_0x254752){return db[_0x8cfd('0x4c')]['findOne']({'where':{'id':_0x15ae89[_0x8cfd('0x43')]['id']}})[_0x8cfd('0x3d')](handleEntityNotFound(_0x480f1d,null))[_0x8cfd('0x3d')](function(_0x3ef381){if(_0x3ef381){return db[_0x8cfd('0x4d')][_0x8cfd('0x4e')](function(_0x2cc6d9){return db[_0x8cfd('0x3c')][_0x8cfd('0x24')]({'where':{'CustomReportId':_0x15ae89[_0x8cfd('0x43')]['id']},'transaction':_0x2cc6d9})[_0x8cfd('0x3d')](function(_0x50b410){var _0x655945=_[_0x8cfd('0x28')](_0x15ae89['body'],function(_0x41d35b){delete _0x41d35b['id'];_0x41d35b[_0x8cfd('0x4f')]=_0x15ae89[_0x8cfd('0x43')]['id'];return _0x41d35b;});return db[_0x8cfd('0x3c')][_0x8cfd('0x47')](_0x655945,{'transaction':_0x2cc6d9});});})[_0x8cfd('0x3d')](function(){return db[_0x8cfd('0x3c')][_0x8cfd('0x40')]({'where':{'CustomReportId':_0x15ae89['params']['id']}});});}})[_0x8cfd('0x3d')](respondWithResult(_0x480f1d,null))[_0x8cfd('0x49')](handleError(_0x480f1d,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index b69f856..9b7b3b2 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 _0xf1dd=['exports','define','AnalyticFieldReport','analytics_report_fields','util','bluebird','path','rimraf','../../config/environment','./analyticFieldReport.attributes'];(function(_0x2627f8,_0x3c372c){var _0x573bf3=function(_0x501da6){while(--_0x501da6){_0x2627f8['push'](_0x2627f8['shift']());}};_0x573bf3(++_0x3c372c);}(_0xf1dd,0x176));var _0xdf1d=function(_0x54f7c0,_0x27af83){_0x54f7c0=_0x54f7c0-0x0;var _0x245d03=_0xf1dd[_0x54f7c0];return _0x245d03;};'use strict';var _=require('lodash');var util=require(_0xdf1d('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xdf1d('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf1d('0x2'));var rimraf=require(_0xdf1d('0x3'));var config=require(_0xdf1d('0x4'));var attributes=require(_0xdf1d('0x5'));module[_0xdf1d('0x6')]=function(_0x34ea0c,_0x135f68){return _0x34ea0c[_0xdf1d('0x7')](_0xdf1d('0x8'),attributes,{'tableName':_0xdf1d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd453=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment'];(function(_0x3582dc,_0x569d86){var _0x550d3c=function(_0x1aa4df){while(--_0x1aa4df){_0x3582dc['push'](_0x3582dc['shift']());}};_0x550d3c(++_0x569d86);}(_0xd453,0xfa));var _0x3d45=function(_0x1df79c,_0x5ad8fd){_0x1df79c=_0x1df79c-0x0;var _0x2f23e4=_0xd453[_0x1df79c];return _0x2f23e4;};'use strict';var _=require(_0x3d45('0x0'));var util=require(_0x3d45('0x1'));var logger=require(_0x3d45('0x2'))(_0x3d45('0x3'));var moment=require(_0x3d45('0x4'));var BPromise=require(_0x3d45('0x5'));var rp=require(_0x3d45('0x6'));var fs=require('fs');var path=require(_0x3d45('0x7'));var rimraf=require(_0x3d45('0x8'));var config=require(_0x3d45('0x9'));var attributes=require(_0x3d45('0xa'));module[_0x3d45('0xb')]=function(_0x1d1f73,_0x5245dc){return _0x1d1f73[_0x3d45('0xc')](_0x3d45('0xd'),attributes,{'tableName':_0x3d45('0xe'),'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 c2f5459..e9ebde1 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 _0xd152=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','bluebird'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0xd152,0x18a));var _0x2d15=function(_0x1f257c,_0x231de4){_0x1f257c=_0x1f257c-0x0;var _0x3d1bcd=_0xd152[_0x1f257c];return _0x3d1bcd;};'use strict';var _=require('lodash');var util=require(_0x2d15('0x0'));var moment=require('moment');var BPromise=require(_0x2d15('0x1'));var rs=require(_0x2d15('0x2'));var fs=require('fs');var Redis=require(_0x2d15('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2d15('0x4'))(_0x2d15('0x5'));var config=require(_0x2d15('0x6'));var jayson=require(_0x2d15('0x7'));var client=jayson[_0x2d15('0x8')][_0x2d15('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c0f86,_0x43bc1d,_0x4eee02){return new BPromise(function(_0x2cbdf1,_0x31ffa8){return client['request'](_0x5c0f86,_0x4eee02)[_0x2d15('0xa')](function(_0x4593f3){logger[_0x2d15('0xb')](_0x2d15('0xc'),_0x43bc1d,'request\x20sent');logger[_0x2d15('0xd')](_0x2d15('0xe'),_0x43bc1d,_0x2d15('0xf'),JSON[_0x2d15('0x10')](_0x4593f3));if(_0x4593f3[_0x2d15('0x11')]){if(_0x4593f3[_0x2d15('0x11')][_0x2d15('0x12')]===0x1f4){logger[_0x2d15('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x43bc1d,_0x4593f3[_0x2d15('0x11')][_0x2d15('0x13')]);return _0x31ffa8(_0x4593f3[_0x2d15('0x11')][_0x2d15('0x13')]);}logger[_0x2d15('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x43bc1d,_0x4593f3[_0x2d15('0x11')][_0x2d15('0x13')]);return _0x2cbdf1(_0x4593f3[_0x2d15('0x11')][_0x2d15('0x13')]);}else{logger[_0x2d15('0xb')](_0x2d15('0xc'),_0x43bc1d,_0x2d15('0xf'));_0x2cbdf1(_0x4593f3[_0x2d15('0x14')][_0x2d15('0x13')]);}})[_0x2d15('0x15')](function(_0x114119){logger[_0x2d15('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x43bc1d,_0x114119);_0x31ffa8(_0x114119);});});} \ No newline at end of file +var _0x64ef=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x54a479,_0x1b321d){var _0x2474ab=function(_0x428755){while(--_0x428755){_0x54a479['push'](_0x54a479['shift']());}};_0x2474ab(++_0x1b321d);}(_0x64ef,0xc8));var _0xf64e=function(_0x94de4c,_0x4739cf){_0x94de4c=_0x94de4c-0x0;var _0x477ebb=_0x64ef[_0x94de4c];return _0x477ebb;};'use strict';var _=require(_0xf64e('0x0'));var util=require(_0xf64e('0x1'));var moment=require(_0xf64e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf64e('0x3'));var fs=require('fs');var Redis=require(_0xf64e('0x4'));var db=require(_0xf64e('0x5'))['db'];var utils=require(_0xf64e('0x6'));var logger=require(_0xf64e('0x7'))(_0xf64e('0x8'));var config=require(_0xf64e('0x9'));var jayson=require(_0xf64e('0xa'));var client=jayson[_0xf64e('0xb')][_0xf64e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x33e6f8,_0x253fb6,_0x334e57){return new BPromise(function(_0xd32bf2,_0x375f02){return client[_0xf64e('0xd')](_0x33e6f8,_0x334e57)[_0xf64e('0xe')](function(_0x44c75e){logger[_0xf64e('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x253fb6,_0xf64e('0x10'));logger['debug'](_0xf64e('0x11'),_0x253fb6,_0xf64e('0x10'),JSON['stringify'](_0x44c75e));if(_0x44c75e[_0xf64e('0x12')]){if(_0x44c75e[_0xf64e('0x12')][_0xf64e('0x13')]===0x1f4){logger[_0xf64e('0x12')](_0xf64e('0x14'),_0x253fb6,_0x44c75e[_0xf64e('0x12')][_0xf64e('0x15')]);return _0x375f02(_0x44c75e['error'][_0xf64e('0x15')]);}logger[_0xf64e('0x12')](_0xf64e('0x14'),_0x253fb6,_0x44c75e['error'][_0xf64e('0x15')]);return _0xd32bf2(_0x44c75e[_0xf64e('0x12')][_0xf64e('0x15')]);}else{logger[_0xf64e('0xf')](_0xf64e('0x14'),_0x253fb6,_0xf64e('0x10'));_0xd32bf2(_0x44c75e[_0xf64e('0x16')]['message']);}})['catch'](function(_0x4507de){logger[_0xf64e('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x253fb6,_0x4507de);_0x375f02(_0x4507de);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index b9ea647..50fa495 100644 --- a/server/api/analyticFieldReport/index.js +++ b/server/api/analyticFieldReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['put','update','delete','bulkDestroy','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','show','post','create','/create_many','bulkCreate','/:id/create_many','addFields'];(function(_0x5d1305,_0x316ad2){var _0x3368aa=function(_0x403aeb){while(--_0x403aeb){_0x5d1305['push'](_0x5d1305['shift']());}};_0x3368aa(++_0x316ad2);}(_0x7217,0x19e));var _0x7721=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x7217[_0x138f59];return _0x3d114d;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var auth=require(_0x7721('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7721('0x6'));router[_0x7721('0x7')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0x9')]);router[_0x7721('0x7')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0xb')]);router[_0x7721('0xc')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0xc')](_0x7721('0xe'),auth[_0x7721('0x8')](),controller[_0x7721('0xf')]);router['post'](_0x7721('0x10'),auth[_0x7721('0x8')](),controller[_0x7721('0x11')]);router[_0x7721('0x12')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x13')]);router[_0x7721('0x14')]('/destroy_many',auth[_0x7721('0x8')](),controller[_0x7721('0x15')]);router['delete'](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file +var _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(_0x29206f,_0x390f1b){var _0x1de118=function(_0x2de279){while(--_0x2de279){_0x29206f['push'](_0x29206f['shift']());}};_0x1de118(++_0x390f1b);}(_0xe14b,0x93));var _0xbe14=function(_0x32bb8f,_0x3d4dfa){_0x32bb8f=_0x32bb8f-0x0;var _0x4c5327=_0xe14b[_0x32bb8f];return _0x4c5327;};'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 f0fa63e..c9556ff 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 _0xf04c=['name','sequelize','exports','STRING'];(function(_0xa84f31,_0x261b6f){var _0x4cc842=function(_0x33a31d){while(--_0x33a31d){_0xa84f31['push'](_0xa84f31['shift']());}};_0x4cc842(++_0x261b6f);}(_0xf04c,0xfd));var _0xcf04=function(_0x1b811b,_0x27b538){_0x1b811b=_0x1b811b-0x0;var _0x28dd36=_0xf04c[_0x1b811b];return _0x28dd36;};'use strict';var Sequelize=require(_0xcf04('0x0'));module[_0xcf04('0x1')]={'name':{'type':Sequelize[_0xcf04('0x2')],'allowNull':![],'unique':_0xcf04('0x3')},'table':{'type':Sequelize[_0xcf04('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xcf04('0x2')]}}; \ No newline at end of file +var _0xea28=['exports','STRING','name','TEXT','sequelize'];(function(_0x133df5,_0x4626bb){var _0x16c01c=function(_0x42cf87){while(--_0x42cf87){_0x133df5['push'](_0x133df5['shift']());}};_0x16c01c(++_0x4626bb);}(_0xea28,0x13a));var _0x8ea2=function(_0x13565a,_0x30124d){_0x13565a=_0x13565a-0x0;var _0x3a545e=_0xea28[_0x13565a];return _0x3a545e;};'use strict';var Sequelize=require(_0x8ea2('0x0'));module[_0x8ea2('0x1')]={'name':{'type':Sequelize[_0x8ea2('0x2')],'allowNull':![],'unique':_0x8ea2('0x3')},'table':{'type':Sequelize[_0x8ea2('0x2')]},'metric':{'type':Sequelize[_0x8ea2('0x4')]},'description':{'type':Sequelize[_0x8ea2('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 8abda27..184aa16 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 _0x30a7=['AnalyticMetric','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','reject','update','then','destroy','get','Metrics','UserProfileResource','stack','name','send','index','map','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','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'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x30a7,0xf4));var _0x730a=function(_0x267cd8,_0x2adc6d){_0x267cd8=_0x267cd8-0x0;var _0x232ab1=_0x30a7[_0x267cd8];return _0x232ab1;};'use strict';var pdf=require(_0x730a('0x0'));var emlformat=require(_0x730a('0x1'));var rimraf=require(_0x730a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x730a('0x3'));var rp=require(_0x730a('0x4'));var moment=require(_0x730a('0x5'));var BPromise=require(_0x730a('0x6'));var Mustache=require('mustache');var util=require(_0x730a('0x7'));var path=require(_0x730a('0x8'));var sox=require(_0x730a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x730a('0xa'));var squel=require('squel');var crypto=require(_0x730a('0xb'));var jsforce=require(_0x730a('0xc'));var deskjs=require(_0x730a('0xd'));var toCsv=require(_0x730a('0xe'));var querystring=require(_0x730a('0xf'));var Papa=require(_0x730a('0x10'));var Redis=require(_0x730a('0x11'));var authService=require(_0x730a('0x12'));var qs=require(_0x730a('0x13'));var as=require(_0x730a('0x14'));var hardwareService=require(_0x730a('0x15'));var logger=require(_0x730a('0x16'))(_0x730a('0x17'));var utils=require(_0x730a('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x730a('0x19'));var db=require(_0x730a('0x1a'))['db'];function respondWithStatusCode(_0x4afbbf,_0x3ab82a){_0x3ab82a=_0x3ab82a||0xcc;return function(_0x2faa30){if(_0x2faa30){return _0x4afbbf[_0x730a('0x1b')](_0x3ab82a);}return _0x4afbbf[_0x730a('0x1c')](_0x3ab82a)[_0x730a('0x1d')]();};}function respondWithResult(_0x3171c0,_0x1fd5f2){_0x1fd5f2=_0x1fd5f2||0xc8;return function(_0x2502a3){if(_0x2502a3){return _0x3171c0['status'](_0x1fd5f2)[_0x730a('0x1e')](_0x2502a3);}};}function respondWithFilteredResult(_0x4622ad,_0x369408){return function(_0x2970a7){if(_0x2970a7){var _0x22a8d9=_0x2970a7[_0x730a('0x1f')],_0x368786=_0x369408[_0x730a('0x20')],_0x39737b=_0x369408[_0x730a('0x20')]+_0x369408[_0x730a('0x21')],_0x5e1b59;if(_0x39737b>=_0x22a8d9){_0x39737b=_0x22a8d9;_0x5e1b59=0xc8;}else{_0x5e1b59=0xce;}_0x4622ad[_0x730a('0x1c')](_0x5e1b59);return _0x4622ad['set']('Content-Range',_0x368786+'-'+_0x39737b+'/'+_0x22a8d9)[_0x730a('0x1e')](_0x2970a7);}return null;};}function patchUpdates(_0x217619){return function(_0x7089fb){try{jsonpatch['apply'](_0x7089fb,_0x217619,!![]);}catch(_0x418de7){return BPromise[_0x730a('0x22')](_0x418de7);}return _0x7089fb['save']();};}function saveUpdates(_0xbc8149,_0x3fd623){return function(_0x455183){if(_0x455183){return _0x455183[_0x730a('0x23')](_0xbc8149)[_0x730a('0x24')](function(_0x2392e5){return _0x2392e5;});}return null;};}function removeEntity(_0x486e38,_0x52fdbd){return function(_0x372351){if(_0x372351){return _0x372351[_0x730a('0x25')]()[_0x730a('0x24')](function(){var _0x3b8696=_0x372351[_0x730a('0x26')]({'plain':!![]});var _0x598308=_0x730a('0x27');return db[_0x730a('0x28')][_0x730a('0x25')]({'where':{'type':_0x598308,'resourceId':_0x3b8696['id']}})[_0x730a('0x24')](function(){return _0x372351;});})[_0x730a('0x24')](function(){_0x486e38[_0x730a('0x1c')](0xcc)[_0x730a('0x1d')]();});}};}function handleEntityNotFound(_0x317d3c,_0x5eff4a){return function(_0x8ad44c){if(!_0x8ad44c){_0x317d3c[_0x730a('0x1b')](0x194);}return _0x8ad44c;};}function handleError(_0x43f018,_0x164b92){_0x164b92=_0x164b92||0x1f4;return function(_0x420cbc){logger['error'](_0x420cbc[_0x730a('0x29')]);if(_0x420cbc[_0x730a('0x2a')]){delete _0x420cbc[_0x730a('0x2a')];}_0x43f018[_0x730a('0x1c')](_0x164b92)[_0x730a('0x2b')](_0x420cbc);};}exports[_0x730a('0x2c')]=function(_0x1cfa1b,_0x18698a){var _0x9531bf={},_0xd26626={},_0x2744d9={'count':0x0,'rows':[]};var _0x261865=_[_0x730a('0x2d')](db['AnalyticMetric']['rawAttributes'],function(_0x123c40){return{'name':_0x123c40[_0x730a('0x2e')],'type':_0x123c40[_0x730a('0x2f')]['key']};});_0xd26626['model']=_[_0x730a('0x2d')](_0x261865,_0x730a('0x2a'));_0xd26626[_0x730a('0x30')]=_['keys'](_0x1cfa1b[_0x730a('0x30')]);_0xd26626[_0x730a('0x31')]=_[_0x730a('0x32')](_0xd26626[_0x730a('0x33')],_0xd26626[_0x730a('0x30')]);_0x9531bf[_0x730a('0x34')]=_[_0x730a('0x32')](_0xd26626['model'],qs[_0x730a('0x35')](_0x1cfa1b['query'][_0x730a('0x35')]));_0x9531bf[_0x730a('0x34')]=_0x9531bf[_0x730a('0x34')][_0x730a('0x36')]?_0x9531bf[_0x730a('0x34')]:_0xd26626[_0x730a('0x33')];if(!_0x1cfa1b[_0x730a('0x30')][_0x730a('0x37')]('nolimit')){_0x9531bf[_0x730a('0x21')]=qs['limit'](_0x1cfa1b[_0x730a('0x30')][_0x730a('0x21')]);_0x9531bf[_0x730a('0x20')]=qs[_0x730a('0x20')](_0x1cfa1b[_0x730a('0x30')]['offset']);}_0x9531bf['order']=qs[_0x730a('0x38')](_0x1cfa1b[_0x730a('0x30')]['sort']);_0x9531bf[_0x730a('0x39')]=qs[_0x730a('0x31')](_['pick'](_0x1cfa1b[_0x730a('0x30')],_0xd26626['filters']),_0x261865);if(_0x1cfa1b['query']['filter']){_0x9531bf[_0x730a('0x39')]=_[_0x730a('0x3a')](_0x9531bf[_0x730a('0x39')],{'$or':_[_0x730a('0x2d')](_0x261865,function(_0x9ae461){if(_0x9ae461['type']!==_0x730a('0x3b')){var _0x379e34={};_0x379e34[_0x9ae461[_0x730a('0x2a')]]={'$like':'%'+_0x1cfa1b['query'][_0x730a('0x3c')]+'%'};return _0x379e34;}})});}_0x9531bf=_[_0x730a('0x3a')]({},_0x9531bf,_0x1cfa1b[_0x730a('0x3d')]);var _0x15473c={'where':_0x9531bf[_0x730a('0x39')]};return db['AnalyticMetric'][_0x730a('0x1f')](_0x15473c)[_0x730a('0x24')](function(_0x532bc9){_0x2744d9[_0x730a('0x1f')]=_0x532bc9;if(_0x1cfa1b[_0x730a('0x30')][_0x730a('0x3e')]){_0x9531bf[_0x730a('0x3f')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x9531bf);})[_0x730a('0x24')](function(_0x5a313c){_0x2744d9[_0x730a('0x40')]=_0x5a313c;return _0x2744d9;})[_0x730a('0x24')](respondWithFilteredResult(_0x18698a,_0x9531bf))[_0x730a('0x41')](handleError(_0x18698a,null));};exports[_0x730a('0x42')]=function(_0x2f1a14,_0x4c769d){var _0x1e40df={'raw':!![],'where':{'id':_0x2f1a14[_0x730a('0x43')]['id']}},_0x14b13f={};_0x14b13f[_0x730a('0x33')]=_[_0x730a('0x44')](db['AnalyticMetric'][_0x730a('0x45')]);_0x14b13f['query']=_[_0x730a('0x44')](_0x2f1a14[_0x730a('0x30')]);_0x14b13f[_0x730a('0x31')]=_[_0x730a('0x32')](_0x14b13f[_0x730a('0x33')],_0x14b13f[_0x730a('0x30')]);_0x1e40df['attributes']=_[_0x730a('0x32')](_0x14b13f['model'],qs[_0x730a('0x35')](_0x2f1a14['query'][_0x730a('0x35')]));_0x1e40df['attributes']=_0x1e40df[_0x730a('0x34')]['length']?_0x1e40df[_0x730a('0x34')]:_0x14b13f['model'];if(_0x2f1a14[_0x730a('0x30')]['includeAll']){_0x1e40df['include']=[{'all':!![]}];}_0x1e40df=_['merge']({},_0x1e40df,_0x2f1a14['options']);return db['AnalyticMetric'][_0x730a('0x46')](_0x1e40df)['then'](handleEntityNotFound(_0x4c769d,null))['then'](respondWithResult(_0x4c769d,null))['catch'](handleError(_0x4c769d,null));};exports['create']=function(_0x11d1ab,_0x477815){return db['AnalyticMetric'][_0x730a('0x47')](_0x11d1ab[_0x730a('0x48')],{})[_0x730a('0x24')](function(_0x5e7207){var _0x55f953=_0x11d1ab[_0x730a('0x49')][_0x730a('0x26')]({'plain':!![]});if(!_0x55f953)throw new Error(_0x730a('0x4a'));if(_0x55f953[_0x730a('0x4b')]===_0x730a('0x49')){var _0x56eded=_0x5e7207[_0x730a('0x26')]({'plain':!![]});var _0x46354a='Metrics';return db[_0x730a('0x4c')][_0x730a('0x46')]({'where':{'name':_0x46354a,'userProfileId':_0x55f953[_0x730a('0x4d')]},'raw':!![]})[_0x730a('0x24')](function(_0x3c9c08){if(_0x3c9c08&&_0x3c9c08[_0x730a('0x4e')]===0x0){return db[_0x730a('0x28')]['create']({'name':_0x56eded['name'],'resourceId':_0x56eded['id'],'type':_0x3c9c08[_0x730a('0x2a')],'sectionId':_0x3c9c08['id']},{})[_0x730a('0x24')](function(){return _0x5e7207;});}else{return _0x5e7207;}})['catch'](function(_0x283840){logger['error'](_0x730a('0x4f'),_0x283840);throw _0x283840;});}return _0x5e7207;})[_0x730a('0x24')](respondWithResult(_0x477815,0xc9))[_0x730a('0x41')](handleError(_0x477815,null));};exports['update']=function(_0x323725,_0x1df085){if(_0x323725[_0x730a('0x48')]['id']){delete _0x323725['body']['id'];}return db[_0x730a('0x50')][_0x730a('0x46')]({'where':{'id':_0x323725[_0x730a('0x43')]['id']}})['then'](handleEntityNotFound(_0x1df085,null))[_0x730a('0x24')](saveUpdates(_0x323725[_0x730a('0x48')],null))[_0x730a('0x24')](respondWithResult(_0x1df085,null))['catch'](handleError(_0x1df085,null));};exports['destroy']=function(_0x2687fa,_0x4ec525){return db['AnalyticMetric']['find']({'where':{'id':_0x2687fa[_0x730a('0x43')]['id']}})[_0x730a('0x24')](handleEntityNotFound(_0x4ec525,null))[_0x730a('0x24')](removeEntity(_0x4ec525,null))[_0x730a('0x41')](handleError(_0x4ec525,null));}; \ No newline at end of file +var _0xce84=['get','Metrics','UserProfileResource','error','stack','name','send','index','map','AnalyticMetric','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','count','includeAll','include','rows','catch','show','rawAttributes','find','user','role','UserProfileSection','userProfileId','autoAssociation','update','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','apply','reject','save','then','destroy'];(function(_0x416f60,_0x57cbc0){var _0x46363f=function(_0x14e8c8){while(--_0x14e8c8){_0x416f60['push'](_0x416f60['shift']());}};_0x46363f(++_0x57cbc0);}(_0xce84,0x7b));var _0x4ce8=function(_0x47cbc4,_0x252ab7){_0x47cbc4=_0x47cbc4-0x0;var _0x48a23b=_0xce84[_0x47cbc4];return _0x48a23b;};'use strict';var pdf=require(_0x4ce8('0x0'));var emlformat=require(_0x4ce8('0x1'));var rimraf=require(_0x4ce8('0x2'));var zipdir=require(_0x4ce8('0x3'));var jsonpatch=require(_0x4ce8('0x4'));var rp=require(_0x4ce8('0x5'));var moment=require('moment');var BPromise=require(_0x4ce8('0x6'));var Mustache=require('mustache');var util=require(_0x4ce8('0x7'));var path=require(_0x4ce8('0x8'));var sox=require(_0x4ce8('0x9'));var csv=require(_0x4ce8('0xa'));var ejs=require(_0x4ce8('0xb'));var fs=require('fs');var _=require(_0x4ce8('0xc'));var squel=require(_0x4ce8('0xd'));var crypto=require(_0x4ce8('0xe'));var jsforce=require(_0x4ce8('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4ce8('0xa'));var querystring=require(_0x4ce8('0x10'));var Papa=require('papaparse');var Redis=require(_0x4ce8('0x11'));var authService=require(_0x4ce8('0x12'));var qs=require(_0x4ce8('0x13'));var as=require(_0x4ce8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4ce8('0x15'))(_0x4ce8('0x16'));var utils=require('../../config/utils');var config=require(_0x4ce8('0x17'));var licenseUtil=require(_0x4ce8('0x18'));var db=require(_0x4ce8('0x19'))['db'];function respondWithStatusCode(_0x4c653d,_0x204ddb){_0x204ddb=_0x204ddb||0xcc;return function(_0x3718fc){if(_0x3718fc){return _0x4c653d['sendStatus'](_0x204ddb);}return _0x4c653d[_0x4ce8('0x1a')](_0x204ddb)[_0x4ce8('0x1b')]();};}function respondWithResult(_0x5e0032,_0x46d0ae){_0x46d0ae=_0x46d0ae||0xc8;return function(_0x480442){if(_0x480442){return _0x5e0032[_0x4ce8('0x1a')](_0x46d0ae)[_0x4ce8('0x1c')](_0x480442);}};}function respondWithFilteredResult(_0x5f593d,_0x5525f7){return function(_0x35686d){if(_0x35686d){var _0x1af905=_0x35686d['count'],_0x3403a4=_0x5525f7['offset'],_0x3c2922=_0x5525f7[_0x4ce8('0x1d')]+_0x5525f7[_0x4ce8('0x1e')],_0x1e57d2;if(_0x3c2922>=_0x1af905){_0x3c2922=_0x1af905;_0x1e57d2=0xc8;}else{_0x1e57d2=0xce;}_0x5f593d[_0x4ce8('0x1a')](_0x1e57d2);return _0x5f593d[_0x4ce8('0x1f')]('Content-Range',_0x3403a4+'-'+_0x3c2922+'/'+_0x1af905)['json'](_0x35686d);}return null;};}function patchUpdates(_0xd4d60c){return function(_0x424483){try{jsonpatch[_0x4ce8('0x20')](_0x424483,_0xd4d60c,!![]);}catch(_0x247617){return BPromise[_0x4ce8('0x21')](_0x247617);}return _0x424483[_0x4ce8('0x22')]();};}function saveUpdates(_0x5b97e0,_0x4a4f93){return function(_0x2c808d){if(_0x2c808d){return _0x2c808d['update'](_0x5b97e0)[_0x4ce8('0x23')](function(_0x1afe25){return _0x1afe25;});}return null;};}function removeEntity(_0x168f93,_0x33b8d9){return function(_0xb761d0){if(_0xb761d0){return _0xb761d0[_0x4ce8('0x24')]()['then'](function(){var _0x3a426d=_0xb761d0[_0x4ce8('0x25')]({'plain':!![]});var _0x1842b9=_0x4ce8('0x26');return db[_0x4ce8('0x27')][_0x4ce8('0x24')]({'where':{'type':_0x1842b9,'resourceId':_0x3a426d['id']}})[_0x4ce8('0x23')](function(){return _0xb761d0;});})['then'](function(){_0x168f93[_0x4ce8('0x1a')](0xcc)[_0x4ce8('0x1b')]();});}};}function handleEntityNotFound(_0x4de367,_0x21065b){return function(_0x5193f6){if(!_0x5193f6){_0x4de367['sendStatus'](0x194);}return _0x5193f6;};}function handleError(_0x495df7,_0x4f8300){_0x4f8300=_0x4f8300||0x1f4;return function(_0x5d39e2){logger[_0x4ce8('0x28')](_0x5d39e2[_0x4ce8('0x29')]);if(_0x5d39e2[_0x4ce8('0x2a')]){delete _0x5d39e2['name'];}_0x495df7['status'](_0x4f8300)[_0x4ce8('0x2b')](_0x5d39e2);};}exports[_0x4ce8('0x2c')]=function(_0x395e4a,_0xebb701){var _0x185ed3={},_0x10cb86={},_0x6cfe98={'count':0x0,'rows':[]};var _0x54183d=_[_0x4ce8('0x2d')](db[_0x4ce8('0x2e')]['rawAttributes'],function(_0x3ed5a2){return{'name':_0x3ed5a2[_0x4ce8('0x2f')],'type':_0x3ed5a2['type'][_0x4ce8('0x30')]};});_0x10cb86[_0x4ce8('0x31')]=_['map'](_0x54183d,_0x4ce8('0x2a'));_0x10cb86[_0x4ce8('0x32')]=_[_0x4ce8('0x33')](_0x395e4a['query']);_0x10cb86[_0x4ce8('0x34')]=_[_0x4ce8('0x35')](_0x10cb86[_0x4ce8('0x31')],_0x10cb86['query']);_0x185ed3['attributes']=_[_0x4ce8('0x35')](_0x10cb86[_0x4ce8('0x31')],qs[_0x4ce8('0x36')](_0x395e4a[_0x4ce8('0x32')][_0x4ce8('0x36')]));_0x185ed3[_0x4ce8('0x37')]=_0x185ed3[_0x4ce8('0x37')]['length']?_0x185ed3[_0x4ce8('0x37')]:_0x10cb86[_0x4ce8('0x31')];if(!_0x395e4a[_0x4ce8('0x32')][_0x4ce8('0x38')](_0x4ce8('0x39'))){_0x185ed3['limit']=qs['limit'](_0x395e4a[_0x4ce8('0x32')][_0x4ce8('0x1e')]);_0x185ed3[_0x4ce8('0x1d')]=qs[_0x4ce8('0x1d')](_0x395e4a['query'][_0x4ce8('0x1d')]);}_0x185ed3[_0x4ce8('0x3a')]=qs[_0x4ce8('0x3b')](_0x395e4a[_0x4ce8('0x32')][_0x4ce8('0x3b')]);_0x185ed3['where']=qs[_0x4ce8('0x34')](_['pick'](_0x395e4a[_0x4ce8('0x32')],_0x10cb86[_0x4ce8('0x34')]),_0x54183d);if(_0x395e4a['query'][_0x4ce8('0x3c')]){_0x185ed3[_0x4ce8('0x3d')]=_[_0x4ce8('0x3e')](_0x185ed3[_0x4ce8('0x3d')],{'$or':_[_0x4ce8('0x2d')](_0x54183d,function(_0x43ba27){if(_0x43ba27['type']!=='VIRTUAL'){var _0x19d6c2={};_0x19d6c2[_0x43ba27['name']]={'$like':'%'+_0x395e4a[_0x4ce8('0x32')][_0x4ce8('0x3c')]+'%'};return _0x19d6c2;}})});}_0x185ed3=_[_0x4ce8('0x3e')]({},_0x185ed3,_0x395e4a[_0x4ce8('0x3f')]);var _0x7f8d5e={'where':_0x185ed3[_0x4ce8('0x3d')]};return db[_0x4ce8('0x2e')][_0x4ce8('0x40')](_0x7f8d5e)[_0x4ce8('0x23')](function(_0x1e5bc0){_0x6cfe98[_0x4ce8('0x40')]=_0x1e5bc0;if(_0x395e4a['query'][_0x4ce8('0x41')]){_0x185ed3[_0x4ce8('0x42')]=[{'all':!![]}];}return db[_0x4ce8('0x2e')]['findAll'](_0x185ed3);})[_0x4ce8('0x23')](function(_0x49f174){_0x6cfe98[_0x4ce8('0x43')]=_0x49f174;return _0x6cfe98;})[_0x4ce8('0x23')](respondWithFilteredResult(_0xebb701,_0x185ed3))[_0x4ce8('0x44')](handleError(_0xebb701,null));};exports[_0x4ce8('0x45')]=function(_0x238de8,_0x3c0853){var _0x32b3f7={'raw':!![],'where':{'id':_0x238de8['params']['id']}},_0x225d78={};_0x225d78[_0x4ce8('0x31')]=_['keys'](db[_0x4ce8('0x2e')][_0x4ce8('0x46')]);_0x225d78['query']=_[_0x4ce8('0x33')](_0x238de8[_0x4ce8('0x32')]);_0x225d78[_0x4ce8('0x34')]=_['intersection'](_0x225d78[_0x4ce8('0x31')],_0x225d78[_0x4ce8('0x32')]);_0x32b3f7[_0x4ce8('0x37')]=_['intersection'](_0x225d78[_0x4ce8('0x31')],qs[_0x4ce8('0x36')](_0x238de8['query'][_0x4ce8('0x36')]));_0x32b3f7[_0x4ce8('0x37')]=_0x32b3f7[_0x4ce8('0x37')]['length']?_0x32b3f7[_0x4ce8('0x37')]:_0x225d78[_0x4ce8('0x31')];if(_0x238de8['query'][_0x4ce8('0x41')]){_0x32b3f7['include']=[{'all':!![]}];}_0x32b3f7=_[_0x4ce8('0x3e')]({},_0x32b3f7,_0x238de8['options']);return db[_0x4ce8('0x2e')][_0x4ce8('0x47')](_0x32b3f7)[_0x4ce8('0x23')](handleEntityNotFound(_0x3c0853,null))['then'](respondWithResult(_0x3c0853,null))[_0x4ce8('0x44')](handleError(_0x3c0853,null));};exports['create']=function(_0x46d623,_0x262757){return db[_0x4ce8('0x2e')]['create'](_0x46d623['body'],{})[_0x4ce8('0x23')](function(_0x15f1c2){var _0x1954d5=_0x46d623[_0x4ce8('0x48')][_0x4ce8('0x25')]({'plain':!![]});if(!_0x1954d5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1954d5[_0x4ce8('0x49')]==='user'){var _0x2b7740=_0x15f1c2[_0x4ce8('0x25')]({'plain':!![]});var _0x3ff256=_0x4ce8('0x26');return db[_0x4ce8('0x4a')][_0x4ce8('0x47')]({'where':{'name':_0x3ff256,'userProfileId':_0x1954d5[_0x4ce8('0x4b')]},'raw':!![]})[_0x4ce8('0x23')](function(_0x3d434d){if(_0x3d434d&&_0x3d434d[_0x4ce8('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x2b7740['name'],'resourceId':_0x2b7740['id'],'type':_0x3d434d[_0x4ce8('0x2a')],'sectionId':_0x3d434d['id']},{})[_0x4ce8('0x23')](function(){return _0x15f1c2;});}else{return _0x15f1c2;}})[_0x4ce8('0x44')](function(_0x3a056e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a056e);throw _0x3a056e;});}return _0x15f1c2;})[_0x4ce8('0x23')](respondWithResult(_0x262757,0xc9))[_0x4ce8('0x44')](handleError(_0x262757,null));};exports[_0x4ce8('0x4d')]=function(_0x331e84,_0x36aa73){if(_0x331e84['body']['id']){delete _0x331e84[_0x4ce8('0x4e')]['id'];}return db[_0x4ce8('0x2e')][_0x4ce8('0x47')]({'where':{'id':_0x331e84[_0x4ce8('0x4f')]['id']}})[_0x4ce8('0x23')](handleEntityNotFound(_0x36aa73,null))['then'](saveUpdates(_0x331e84[_0x4ce8('0x4e')],null))[_0x4ce8('0x23')](respondWithResult(_0x36aa73,null))[_0x4ce8('0x44')](handleError(_0x36aa73,null));};exports[_0x4ce8('0x24')]=function(_0x486aec,_0x1d824d){return db[_0x4ce8('0x2e')]['find']({'where':{'id':_0x486aec['params']['id']}})[_0x4ce8('0x23')](handleEntityNotFound(_0x1d824d,null))[_0x4ce8('0x23')](removeEntity(_0x1d824d,null))[_0x4ce8('0x44')](handleError(_0x1d824d,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 864df8a..eb3728a 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 _0xcb94=['exports','define','AnalyticMetric','analytics_metrics','lodash','api','moment','path','rimraf','../../config/environment','./analyticMetric.attributes'];(function(_0x3ae2b2,_0x2d936f){var _0x1dbf00=function(_0x4072e9){while(--_0x4072e9){_0x3ae2b2['push'](_0x3ae2b2['shift']());}};_0x1dbf00(++_0x2d936f);}(_0xcb94,0x101));var _0x4cb9=function(_0x113386,_0x2fef03){_0x113386=_0x113386-0x0;var _0x369fe0=_0xcb94[_0x113386];return _0x369fe0;};'use strict';var _=require(_0x4cb9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4cb9('0x1'));var moment=require(_0x4cb9('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4cb9('0x3'));var rimraf=require(_0x4cb9('0x4'));var config=require(_0x4cb9('0x5'));var attributes=require(_0x4cb9('0x6'));module[_0x4cb9('0x7')]=function(_0x593f05,_0x5760a6){return _0x593f05[_0x4cb9('0x8')](_0x4cb9('0x9'),attributes,{'tableName':_0x4cb9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99b5=['path','rimraf','../../config/environment','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','moment','request-promise'];(function(_0x43c206,_0x56b5a9){var _0x57319f=function(_0x2b7239){while(--_0x2b7239){_0x43c206['push'](_0x43c206['shift']());}};_0x57319f(++_0x56b5a9);}(_0x99b5,0xf7));var _0x599b=function(_0x44e021,_0x3b763f){_0x44e021=_0x44e021-0x0;var _0x20a053=_0x99b5[_0x44e021];return _0x20a053;};'use strict';var _=require(_0x599b('0x0'));var util=require(_0x599b('0x1'));var logger=require(_0x599b('0x2'))('api');var moment=require(_0x599b('0x3'));var BPromise=require('bluebird');var rp=require(_0x599b('0x4'));var fs=require('fs');var path=require(_0x599b('0x5'));var rimraf=require(_0x599b('0x6'));var config=require(_0x599b('0x7'));var attributes=require('./analyticMetric.attributes');module[_0x599b('0x8')]=function(_0x5a777d,_0x297be8){return _0x5a777d[_0x599b('0x9')](_0x599b('0xa'),attributes,{'tableName':_0x599b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 4da86c9..711b200 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 _0x1396=['then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x1a7011,_0x44b2c2){var _0x5c1c7a=function(_0x5ae062){while(--_0x5ae062){_0x1a7011['push'](_0x1a7011['shift']());}};_0x5c1c7a(++_0x44b2c2);}(_0x1396,0x11d));var _0x6139=function(_0x46d87a,_0x5183db){_0x46d87a=_0x46d87a-0x0;var _0x115296=_0x1396[_0x46d87a];return _0x115296;};'use strict';var _=require(_0x6139('0x0'));var util=require('util');var moment=require(_0x6139('0x1'));var BPromise=require('bluebird');var rs=require(_0x6139('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6139('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6139('0x4'))(_0x6139('0x5'));var config=require('../../config/environment');var jayson=require(_0x6139('0x6'));var client=jayson[_0x6139('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a8a99,_0x27e347,_0x2b9fc8){return new BPromise(function(_0x1dc387,_0x49dfd4){return client[_0x6139('0x8')](_0x1a8a99,_0x2b9fc8)[_0x6139('0x9')](function(_0xd64464){logger[_0x6139('0xa')](_0x6139('0xb'),_0x27e347,_0x6139('0xc'));logger[_0x6139('0xd')](_0x6139('0xe'),_0x27e347,'request\x20sent',JSON[_0x6139('0xf')](_0xd64464));if(_0xd64464[_0x6139('0x10')]){if(_0xd64464[_0x6139('0x10')][_0x6139('0x11')]===0x1f4){logger[_0x6139('0x10')](_0x6139('0xb'),_0x27e347,_0xd64464['error'][_0x6139('0x12')]);return _0x49dfd4(_0xd64464[_0x6139('0x10')][_0x6139('0x12')]);}logger['error'](_0x6139('0xb'),_0x27e347,_0xd64464['error'][_0x6139('0x12')]);return _0x1dc387(_0xd64464[_0x6139('0x10')][_0x6139('0x12')]);}else{logger[_0x6139('0xa')](_0x6139('0xb'),_0x27e347,'request\x20sent');_0x1dc387(_0xd64464[_0x6139('0x13')][_0x6139('0x12')]);}})[_0x6139('0x14')](function(_0xb59d1a){logger[_0x6139('0x10')](_0x6139('0xb'),_0x27e347,_0xb59d1a);_0x49dfd4(_0xb59d1a);});});} \ No newline at end of file +var _0xf17e=['../../config/environment','jayson/promise','client','then','info','request\x20sent','stringify','error','AnalyticMetric,\x20%s,\x20%s','message','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x27e122,_0x5f1e96){var _0x4127b9=function(_0x11156a){while(--_0x11156a){_0x27e122['push'](_0x27e122['shift']());}};_0x4127b9(++_0x5f1e96);}(_0xf17e,0xc5));var _0xef17=function(_0xe9668f,_0x2b8398){_0xe9668f=_0xe9668f-0x0;var _0x513c4a=_0xf17e[_0xe9668f];return _0x513c4a;};'use strict';var _=require(_0xef17('0x0'));var util=require(_0xef17('0x1'));var moment=require(_0xef17('0x2'));var BPromise=require('bluebird');var rs=require(_0xef17('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef17('0x4'))['db'];var utils=require(_0xef17('0x5'));var logger=require('../../config/logger')(_0xef17('0x6'));var config=require(_0xef17('0x7'));var jayson=require(_0xef17('0x8'));var client=jayson[_0xef17('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17b89c,_0x1c0274,_0x59e75a){return new BPromise(function(_0x5e8572,_0x69e9dd){return client['request'](_0x17b89c,_0x59e75a)[_0xef17('0xa')](function(_0x518f55){logger[_0xef17('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x1c0274,_0xef17('0xc'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x1c0274,_0xef17('0xc'),JSON[_0xef17('0xd')](_0x518f55));if(_0x518f55[_0xef17('0xe')]){if(_0x518f55['error']['code']===0x1f4){logger[_0xef17('0xe')](_0xef17('0xf'),_0x1c0274,_0x518f55[_0xef17('0xe')][_0xef17('0x10')]);return _0x69e9dd(_0x518f55['error'][_0xef17('0x10')]);}logger[_0xef17('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x1c0274,_0x518f55[_0xef17('0xe')]['message']);return _0x5e8572(_0x518f55['error']['message']);}else{logger[_0xef17('0xb')](_0xef17('0xf'),_0x1c0274,_0xef17('0xc'));_0x5e8572(_0x518f55['result']['message']);}})['catch'](function(_0x210045){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x1c0274,_0x210045);_0x69e9dd(_0x210045);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index b210543..04b8672 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 _0x53ec=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./analyticMetric.controller','get','index','/:id','isAuthenticated'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x53ec,0x192));var _0xc53e=function(_0x33f3db,_0x19a892){_0x33f3db=_0x33f3db-0x0;var _0x2f7cbb=_0x53ec[_0x33f3db];return _0x2f7cbb;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc53e('0x6'));var config=require('../../config/environment');var controller=require(_0xc53e('0x7'));router[_0xc53e('0x8')]('/',auth['isAuthenticated'](),controller[_0xc53e('0x9')]);router['get'](_0xc53e('0xa'),auth[_0xc53e('0xb')](),controller['show']);router[_0xc53e('0xc')]('/',auth[_0xc53e('0xb')](),controller[_0xc53e('0xd')]);router[_0xc53e('0xe')](_0xc53e('0xa'),auth[_0xc53e('0xb')](),controller[_0xc53e('0xf')]);router[_0xc53e('0x10')](_0xc53e('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xc53e('0x11')]=router; \ No newline at end of file +var _0xc6ac=['show','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x1f10c3,_0x5c9244){_0x1f10c3=_0x1f10c3-0x0;var _0x57a56f=_0xc6ac[_0x1f10c3];return _0x57a56f;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var auth=require(_0xcc6a('0x6'));var interaction=require(_0xcc6a('0x7'));var config=require(_0xcc6a('0x8'));var controller=require(_0xcc6a('0x9'));router[_0xcc6a('0xa')]('/',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xc')]);router[_0xcc6a('0xa')]('/:id',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xd')]);router[_0xcc6a('0xe')]('/',auth['isAuthenticated'](),controller[_0xcc6a('0xf')]);router[_0xcc6a('0x10')](_0xcc6a('0x11'),auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x12')]);router['delete'](_0xcc6a('0x11'),auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 578cf53..36d0ab8 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 _0x1479=['exports','TEXT'];(function(_0x3b8a3b,_0x1a7652){var _0x504541=function(_0x3d0337){while(--_0x3d0337){_0x3b8a3b['push'](_0x3b8a3b['shift']());}};_0x504541(++_0x1a7652);}(_0x1479,0x1ce));var _0x9147=function(_0x1d2432,_0x52efd5){_0x1d2432=_0x1d2432-0x0;var _0x3e0ae1=_0x1479[_0x1d2432];return _0x3e0ae1;};'use strict';var Sequelize=require('sequelize');module[_0x9147('0x0')]={'tree':{'type':Sequelize[_0x9147('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xde30=['TEXT','sequelize','exports'];(function(_0x42228c,_0x21f77d){var _0x450787=function(_0x3c6245){while(--_0x3c6245){_0x42228c['push'](_0x42228c['shift']());}};_0x450787(++_0x21f77d);}(_0xde30,0xe2));var _0x0de3=function(_0x8c5b6d,_0x5a9e52){_0x8c5b6d=_0x8c5b6d-0x0;var _0x12c09a=_0xde30[_0x8c5b6d];return _0x12c09a;};'use strict';var Sequelize=require(_0x0de3('0x0'));module[_0x0de3('0x1')]={'tree':{'type':Sequelize[_0x0de3('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 6d6352f..3109410 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 _0x4744=['moment','mustache','util','sox','ejs','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','find','html-pdf','eml-format','zip-dir','fast-json-patch'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4744,0x1be));var _0x4474=function(_0x2757ad,_0x4cf1b8){_0x2757ad=_0x2757ad-0x0;var _0x2cab19=_0x4744[_0x2757ad];return _0x2cab19;};'use strict';var pdf=require(_0x4474('0x0'));var emlformat=require(_0x4474('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4474('0x2'));var jsonpatch=require(_0x4474('0x3'));var rp=require('request-promise');var moment=require(_0x4474('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4474('0x5'));var util=require(_0x4474('0x6'));var path=require('path');var sox=require(_0x4474('0x7'));var csv=require('to-csv');var ejs=require(_0x4474('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4474('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4474('0xa'));var toCsv=require(_0x4474('0xb'));var querystring=require(_0x4474('0xc'));var Papa=require(_0x4474('0xd'));var Redis=require(_0x4474('0xe'));var authService=require(_0x4474('0xf'));var qs=require(_0x4474('0x10'));var as=require(_0x4474('0x11'));var hardwareService=require(_0x4474('0x12'));var logger=require(_0x4474('0x13'))(_0x4474('0x14'));var utils=require(_0x4474('0x15'));var config=require(_0x4474('0x16'));var licenseUtil=require(_0x4474('0x17'));var db=require(_0x4474('0x18'))['db'];function respondWithStatusCode(_0x2ce251,_0x440a37){_0x440a37=_0x440a37||0xcc;return function(_0x33b5b9){if(_0x33b5b9){return _0x2ce251[_0x4474('0x19')](_0x440a37);}return _0x2ce251[_0x4474('0x1a')](_0x440a37)[_0x4474('0x1b')]();};}function respondWithResult(_0xb26158,_0x58ef8c){_0x58ef8c=_0x58ef8c||0xc8;return function(_0x2a85fe){if(_0x2a85fe){return _0xb26158[_0x4474('0x1a')](_0x58ef8c)[_0x4474('0x1c')](_0x2a85fe);}};}function respondWithFilteredResult(_0x2100fc,_0x27a690){return function(_0x449800){if(_0x449800){var _0x4acb46=_0x449800[_0x4474('0x1d')],_0x1d9f5d=_0x27a690[_0x4474('0x1e')],_0x5dd2a6=_0x27a690[_0x4474('0x1e')]+_0x27a690[_0x4474('0x1f')],_0x536df9;if(_0x5dd2a6>=_0x4acb46){_0x5dd2a6=_0x4acb46;_0x536df9=0xc8;}else{_0x536df9=0xce;}_0x2100fc[_0x4474('0x1a')](_0x536df9);return _0x2100fc[_0x4474('0x20')](_0x4474('0x21'),_0x1d9f5d+'-'+_0x5dd2a6+'/'+_0x4acb46)[_0x4474('0x1c')](_0x449800);}return null;};}function patchUpdates(_0x4c7d8f){return function(_0x169ba0){try{jsonpatch['apply'](_0x169ba0,_0x4c7d8f,!![]);}catch(_0x726f5){return BPromise[_0x4474('0x22')](_0x726f5);}return _0x169ba0[_0x4474('0x23')]();};}function saveUpdates(_0x128ca5,_0x22b87f){return function(_0x4545f7){if(_0x4545f7){return _0x4545f7[_0x4474('0x24')](_0x128ca5)[_0x4474('0x25')](function(_0x4c63b1){return _0x4c63b1;});}return null;};}function removeEntity(_0xfdf8ca,_0x2fbaac){return function(_0x5dc399){if(_0x5dc399){return _0x5dc399[_0x4474('0x26')]()['then'](function(){_0xfdf8ca[_0x4474('0x1a')](0xcc)[_0x4474('0x1b')]();});}};}function handleEntityNotFound(_0x100d87,_0x3da054){return function(_0x48df19){if(!_0x48df19){_0x100d87[_0x4474('0x19')](0x194);}return _0x48df19;};}function handleError(_0x9979e6,_0x2ee587){_0x2ee587=_0x2ee587||0x1f4;return function(_0x2143ca){logger['error'](_0x2143ca['stack']);if(_0x2143ca[_0x4474('0x27')]){delete _0x2143ca[_0x4474('0x27')];}_0x9979e6['status'](_0x2ee587)[_0x4474('0x28')](_0x2143ca);};}exports[_0x4474('0x29')]=function(_0xf29a82,_0x1b97af){var _0x383458={},_0x35925e={},_0x1f69a4={'count':0x0,'rows':[]};var _0x363e56=_['map'](db[_0x4474('0x2a')][_0x4474('0x2b')],function(_0x198c5b){return{'name':_0x198c5b[_0x4474('0x2c')],'type':_0x198c5b['type'][_0x4474('0x2d')]};});_0x35925e[_0x4474('0x2e')]=_['map'](_0x363e56,'name');_0x35925e[_0x4474('0x2f')]=_[_0x4474('0x30')](_0xf29a82[_0x4474('0x2f')]);_0x35925e[_0x4474('0x31')]=_[_0x4474('0x32')](_0x35925e[_0x4474('0x2e')],_0x35925e['query']);_0x383458['attributes']=_['intersection'](_0x35925e[_0x4474('0x2e')],qs['fields'](_0xf29a82[_0x4474('0x2f')][_0x4474('0x33')]));_0x383458[_0x4474('0x34')]=_0x383458['attributes'][_0x4474('0x35')]?_0x383458[_0x4474('0x34')]:_0x35925e[_0x4474('0x2e')];if(!_0xf29a82[_0x4474('0x2f')][_0x4474('0x36')](_0x4474('0x37'))){_0x383458['limit']=qs[_0x4474('0x1f')](_0xf29a82[_0x4474('0x2f')][_0x4474('0x1f')]);_0x383458[_0x4474('0x1e')]=qs[_0x4474('0x1e')](_0xf29a82[_0x4474('0x2f')][_0x4474('0x1e')]);}_0x383458[_0x4474('0x38')]=qs[_0x4474('0x39')](_0xf29a82[_0x4474('0x2f')][_0x4474('0x39')]);_0x383458[_0x4474('0x3a')]=qs[_0x4474('0x31')](_['pick'](_0xf29a82[_0x4474('0x2f')],_0x35925e[_0x4474('0x31')]),_0x363e56);if(_0xf29a82[_0x4474('0x2f')][_0x4474('0x3b')]){_0x383458['where']=_[_0x4474('0x3c')](_0x383458['where'],{'$or':_[_0x4474('0x3d')](_0x363e56,function(_0x396061){if(_0x396061[_0x4474('0x3e')]!==_0x4474('0x3f')){var _0x18de40={};_0x18de40[_0x396061[_0x4474('0x27')]]={'$like':'%'+_0xf29a82[_0x4474('0x2f')][_0x4474('0x3b')]+'%'};return _0x18de40;}})});}_0x383458=_[_0x4474('0x3c')]({},_0x383458,_0xf29a82[_0x4474('0x40')]);var _0x39a886={'where':_0x383458['where']};return db[_0x4474('0x2a')]['count'](_0x39a886)[_0x4474('0x25')](function(_0x1580e7){_0x1f69a4[_0x4474('0x1d')]=_0x1580e7;if(_0xf29a82[_0x4474('0x2f')]['includeAll']){_0x383458[_0x4474('0x41')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x4474('0x42')](_0x383458);})[_0x4474('0x25')](function(_0xff424e){_0x1f69a4[_0x4474('0x43')]=_0xff424e;return _0x1f69a4;})[_0x4474('0x25')](respondWithFilteredResult(_0x1b97af,_0x383458))[_0x4474('0x44')](handleError(_0x1b97af,null));};exports[_0x4474('0x45')]=function(_0x1664a1,_0x54b263){var _0x430a64={'raw':!![],'where':{'id':_0x1664a1[_0x4474('0x46')]['id']}},_0x21ae40={};_0x21ae40['model']=_[_0x4474('0x30')](db[_0x4474('0x2a')][_0x4474('0x2b')]);_0x21ae40[_0x4474('0x2f')]=_['keys'](_0x1664a1['query']);_0x21ae40[_0x4474('0x31')]=_[_0x4474('0x32')](_0x21ae40['model'],_0x21ae40[_0x4474('0x2f')]);_0x430a64[_0x4474('0x34')]=_[_0x4474('0x32')](_0x21ae40['model'],qs[_0x4474('0x33')](_0x1664a1[_0x4474('0x2f')]['fields']));_0x430a64['attributes']=_0x430a64[_0x4474('0x34')][_0x4474('0x35')]?_0x430a64[_0x4474('0x34')]:_0x21ae40[_0x4474('0x2e')];if(_0x1664a1[_0x4474('0x2f')][_0x4474('0x47')]){_0x430a64['include']=[{'all':!![]}];}_0x430a64=_[_0x4474('0x3c')]({},_0x430a64,_0x1664a1[_0x4474('0x40')]);return db['AnalyticTreeReport']['find'](_0x430a64)[_0x4474('0x25')](handleEntityNotFound(_0x54b263,null))[_0x4474('0x25')](respondWithResult(_0x54b263,null))[_0x4474('0x44')](handleError(_0x54b263,null));};exports[_0x4474('0x48')]=function(_0x1dec10,_0x18c486){return db[_0x4474('0x2a')][_0x4474('0x48')](_0x1dec10[_0x4474('0x49')],{})['then'](respondWithResult(_0x18c486,0xc9))[_0x4474('0x44')](handleError(_0x18c486,null));};exports['update']=function(_0x2ff020,_0x25b143){if(_0x2ff020[_0x4474('0x49')]['id']){delete _0x2ff020['body']['id'];}return db[_0x4474('0x2a')][_0x4474('0x4a')]({'where':{'id':_0x2ff020[_0x4474('0x46')]['id']}})[_0x4474('0x25')](handleEntityNotFound(_0x25b143,null))[_0x4474('0x25')](saveUpdates(_0x2ff020[_0x4474('0x49')],null))['then'](respondWithResult(_0x25b143,null))[_0x4474('0x44')](handleError(_0x25b143,null));};exports[_0x4474('0x26')]=function(_0x449786,_0x5837ae){return db[_0x4474('0x2a')][_0x4474('0x4a')]({'where':{'id':_0x449786['params']['id']}})[_0x4474('0x25')](handleEntityNotFound(_0x5837ae,null))[_0x4474('0x25')](removeEntity(_0x5837ae,null))['catch'](handleError(_0x5837ae,null));}; \ No newline at end of file +var _0xe492=['apply','reject','save','update','then','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','catch','params','keys','includeAll','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xe492,0x76));var _0x2e49=function(_0x3d5eb1,_0x46d5a5){_0x3d5eb1=_0x3d5eb1-0x0;var _0x3c7844=_0xe492[_0x3d5eb1];return _0x3c7844;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2e49('0x0'));var rimraf=require(_0x2e49('0x1'));var zipdir=require(_0x2e49('0x2'));var jsonpatch=require(_0x2e49('0x3'));var rp=require(_0x2e49('0x4'));var moment=require(_0x2e49('0x5'));var BPromise=require(_0x2e49('0x6'));var Mustache=require(_0x2e49('0x7'));var util=require('util');var path=require('path');var sox=require(_0x2e49('0x8'));var csv=require(_0x2e49('0x9'));var ejs=require(_0x2e49('0xa'));var fs=require('fs');var _=require(_0x2e49('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2e49('0xc'));var deskjs=require(_0x2e49('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2e49('0xe'));var Papa=require(_0x2e49('0xf'));var Redis=require('ioredis');var authService=require(_0x2e49('0x10'));var qs=require(_0x2e49('0x11'));var as=require(_0x2e49('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2e49('0x13'));var utils=require(_0x2e49('0x14'));var config=require(_0x2e49('0x15'));var licenseUtil=require(_0x2e49('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23889b,_0x46c03b){_0x46c03b=_0x46c03b||0xcc;return function(_0xd97ba8){if(_0xd97ba8){return _0x23889b[_0x2e49('0x17')](_0x46c03b);}return _0x23889b[_0x2e49('0x18')](_0x46c03b)[_0x2e49('0x19')]();};}function respondWithResult(_0x173406,_0x5da288){_0x5da288=_0x5da288||0xc8;return function(_0x58d23f){if(_0x58d23f){return _0x173406[_0x2e49('0x18')](_0x5da288)[_0x2e49('0x1a')](_0x58d23f);}};}function respondWithFilteredResult(_0x201b66,_0x4d3af2){return function(_0x3b2d7d){if(_0x3b2d7d){var _0x485400=_0x3b2d7d[_0x2e49('0x1b')],_0x2f95f1=_0x4d3af2[_0x2e49('0x1c')],_0xfde613=_0x4d3af2[_0x2e49('0x1c')]+_0x4d3af2[_0x2e49('0x1d')],_0x3099c4;if(_0xfde613>=_0x485400){_0xfde613=_0x485400;_0x3099c4=0xc8;}else{_0x3099c4=0xce;}_0x201b66[_0x2e49('0x18')](_0x3099c4);return _0x201b66[_0x2e49('0x1e')](_0x2e49('0x1f'),_0x2f95f1+'-'+_0xfde613+'/'+_0x485400)['json'](_0x3b2d7d);}return null;};}function patchUpdates(_0x1c4eac){return function(_0x1b46c9){try{jsonpatch[_0x2e49('0x20')](_0x1b46c9,_0x1c4eac,!![]);}catch(_0x3e5120){return BPromise[_0x2e49('0x21')](_0x3e5120);}return _0x1b46c9[_0x2e49('0x22')]();};}function saveUpdates(_0x427843,_0x7a1ece){return function(_0x3fbd2a){if(_0x3fbd2a){return _0x3fbd2a[_0x2e49('0x23')](_0x427843)[_0x2e49('0x24')](function(_0x1df767){return _0x1df767;});}return null;};}function removeEntity(_0x1ed93c,_0x2aac8b){return function(_0x1ed4c){if(_0x1ed4c){return _0x1ed4c['destroy']()['then'](function(){_0x1ed93c[_0x2e49('0x18')](0xcc)[_0x2e49('0x19')]();});}};}function handleEntityNotFound(_0x11e507,_0x31ea0e){return function(_0x59f224){if(!_0x59f224){_0x11e507[_0x2e49('0x17')](0x194);}return _0x59f224;};}function handleError(_0xbf23ca,_0x37d336){_0x37d336=_0x37d336||0x1f4;return function(_0x343bde){logger[_0x2e49('0x25')](_0x343bde[_0x2e49('0x26')]);if(_0x343bde[_0x2e49('0x27')]){delete _0x343bde['name'];}_0xbf23ca[_0x2e49('0x18')](_0x37d336)[_0x2e49('0x28')](_0x343bde);};}exports[_0x2e49('0x29')]=function(_0x327fa9,_0x51544a){var _0x1167ae={},_0x360b0e={},_0x2fa4b1={'count':0x0,'rows':[]};var _0x4d948f=_[_0x2e49('0x2a')](db[_0x2e49('0x2b')][_0x2e49('0x2c')],function(_0x851cb1){return{'name':_0x851cb1[_0x2e49('0x2d')],'type':_0x851cb1[_0x2e49('0x2e')][_0x2e49('0x2f')]};});_0x360b0e['model']=_[_0x2e49('0x2a')](_0x4d948f,_0x2e49('0x27'));_0x360b0e['query']=_['keys'](_0x327fa9['query']);_0x360b0e[_0x2e49('0x30')]=_[_0x2e49('0x31')](_0x360b0e[_0x2e49('0x32')],_0x360b0e[_0x2e49('0x33')]);_0x1167ae[_0x2e49('0x34')]=_[_0x2e49('0x31')](_0x360b0e[_0x2e49('0x32')],qs[_0x2e49('0x35')](_0x327fa9['query'][_0x2e49('0x35')]));_0x1167ae['attributes']=_0x1167ae[_0x2e49('0x34')][_0x2e49('0x36')]?_0x1167ae['attributes']:_0x360b0e[_0x2e49('0x32')];if(!_0x327fa9[_0x2e49('0x33')][_0x2e49('0x37')](_0x2e49('0x38'))){_0x1167ae[_0x2e49('0x1d')]=qs[_0x2e49('0x1d')](_0x327fa9[_0x2e49('0x33')]['limit']);_0x1167ae[_0x2e49('0x1c')]=qs[_0x2e49('0x1c')](_0x327fa9[_0x2e49('0x33')]['offset']);}_0x1167ae[_0x2e49('0x39')]=qs['sort'](_0x327fa9[_0x2e49('0x33')][_0x2e49('0x3a')]);_0x1167ae[_0x2e49('0x3b')]=qs[_0x2e49('0x30')](_[_0x2e49('0x3c')](_0x327fa9[_0x2e49('0x33')],_0x360b0e[_0x2e49('0x30')]),_0x4d948f);if(_0x327fa9['query'][_0x2e49('0x3d')]){_0x1167ae['where']=_['merge'](_0x1167ae[_0x2e49('0x3b')],{'$or':_[_0x2e49('0x2a')](_0x4d948f,function(_0x2126e5){if(_0x2126e5[_0x2e49('0x2e')]!==_0x2e49('0x3e')){var _0x99c3d8={};_0x99c3d8[_0x2126e5[_0x2e49('0x27')]]={'$like':'%'+_0x327fa9[_0x2e49('0x33')]['filter']+'%'};return _0x99c3d8;}})});}_0x1167ae=_[_0x2e49('0x3f')]({},_0x1167ae,_0x327fa9[_0x2e49('0x40')]);var _0x416451={'where':_0x1167ae['where']};return db[_0x2e49('0x2b')][_0x2e49('0x1b')](_0x416451)[_0x2e49('0x24')](function(_0x123f5a){_0x2fa4b1[_0x2e49('0x1b')]=_0x123f5a;if(_0x327fa9[_0x2e49('0x33')]['includeAll']){_0x1167ae[_0x2e49('0x41')]=[{'all':!![]}];}return db[_0x2e49('0x2b')]['findAll'](_0x1167ae);})['then'](function(_0x36947d){_0x2fa4b1[_0x2e49('0x42')]=_0x36947d;return _0x2fa4b1;})['then'](respondWithFilteredResult(_0x51544a,_0x1167ae))[_0x2e49('0x43')](handleError(_0x51544a,null));};exports['show']=function(_0x1e1f0b,_0xe48b1b){var _0x273e26={'raw':!![],'where':{'id':_0x1e1f0b[_0x2e49('0x44')]['id']}},_0x56a77c={};_0x56a77c[_0x2e49('0x32')]=_['keys'](db['AnalyticTreeReport'][_0x2e49('0x2c')]);_0x56a77c[_0x2e49('0x33')]=_[_0x2e49('0x45')](_0x1e1f0b[_0x2e49('0x33')]);_0x56a77c['filters']=_['intersection'](_0x56a77c[_0x2e49('0x32')],_0x56a77c['query']);_0x273e26['attributes']=_[_0x2e49('0x31')](_0x56a77c[_0x2e49('0x32')],qs[_0x2e49('0x35')](_0x1e1f0b[_0x2e49('0x33')][_0x2e49('0x35')]));_0x273e26[_0x2e49('0x34')]=_0x273e26[_0x2e49('0x34')][_0x2e49('0x36')]?_0x273e26[_0x2e49('0x34')]:_0x56a77c['model'];if(_0x1e1f0b[_0x2e49('0x33')][_0x2e49('0x46')]){_0x273e26['include']=[{'all':!![]}];}_0x273e26=_[_0x2e49('0x3f')]({},_0x273e26,_0x1e1f0b[_0x2e49('0x40')]);return db[_0x2e49('0x2b')][_0x2e49('0x47')](_0x273e26)[_0x2e49('0x24')](handleEntityNotFound(_0xe48b1b,null))[_0x2e49('0x24')](respondWithResult(_0xe48b1b,null))['catch'](handleError(_0xe48b1b,null));};exports[_0x2e49('0x48')]=function(_0x43d2c8,_0x3ee682){return db[_0x2e49('0x2b')]['create'](_0x43d2c8[_0x2e49('0x49')],{})[_0x2e49('0x24')](respondWithResult(_0x3ee682,0xc9))['catch'](handleError(_0x3ee682,null));};exports[_0x2e49('0x23')]=function(_0x3acbb6,_0x407e81){if(_0x3acbb6['body']['id']){delete _0x3acbb6[_0x2e49('0x49')]['id'];}return db[_0x2e49('0x2b')]['find']({'where':{'id':_0x3acbb6[_0x2e49('0x44')]['id']}})[_0x2e49('0x24')](handleEntityNotFound(_0x407e81,null))[_0x2e49('0x24')](saveUpdates(_0x3acbb6[_0x2e49('0x49')],null))[_0x2e49('0x24')](respondWithResult(_0x407e81,null))[_0x2e49('0x43')](handleError(_0x407e81,null));};exports[_0x2e49('0x4a')]=function(_0x596cfa,_0x4ac8ff){return db[_0x2e49('0x2b')]['find']({'where':{'id':_0x596cfa[_0x2e49('0x44')]['id']}})['then'](handleEntityNotFound(_0x4ac8ff,null))[_0x2e49('0x24')](removeEntity(_0x4ac8ff,null))[_0x2e49('0x43')](handleError(_0x4ac8ff,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 83aa3c9..3859f72 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 _0x3f35=['AnalyticTreeReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./analyticTreeReport.attributes','define'];(function(_0x30af1c,_0x4b7424){var _0x13f11c=function(_0x43e21b){while(--_0x43e21b){_0x30af1c['push'](_0x30af1c['shift']());}};_0x13f11c(++_0x4b7424);}(_0x3f35,0x1ae));var _0x53f3=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x3f35[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0x53f3('0x0'));var util=require(_0x53f3('0x1'));var logger=require(_0x53f3('0x2'))(_0x53f3('0x3'));var moment=require(_0x53f3('0x4'));var BPromise=require(_0x53f3('0x5'));var rp=require(_0x53f3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x53f3('0x7'));var config=require('../../config/environment');var attributes=require(_0x53f3('0x8'));module['exports']=function(_0x1b84bf,_0x325130){return _0x1b84bf[_0x53f3('0x9')](_0x53f3('0xa'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8814=['api','bluebird','request-promise','path','rimraf','./analyticTreeReport.attributes','exports','AnalyticTreeReport','lodash'];(function(_0x46a3ff,_0x470b9a){var _0x404bc2=function(_0x20f25f){while(--_0x20f25f){_0x46a3ff['push'](_0x46a3ff['shift']());}};_0x404bc2(++_0x470b9a);}(_0x8814,0x1b8));var _0x4881=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x8814[_0x31ced5];return _0x10d9e5;};'use strict';var _=require(_0x4881('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4881('0x1'));var moment=require('moment');var BPromise=require(_0x4881('0x2'));var rp=require(_0x4881('0x3'));var fs=require('fs');var path=require(_0x4881('0x4'));var rimraf=require(_0x4881('0x5'));var config=require('../../config/environment');var attributes=require(_0x4881('0x6'));module[_0x4881('0x7')]=function(_0x20bc6c,_0x1f292f){return _0x20bc6c['define'](_0x4881('0x8'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 11b146a..7e3cc9d 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 _0x6cde=['info','request\x20sent','stringify','error','message','AnalyticTreeReport,\x20%s,\x20%s','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x10d4e4,_0x9ff071){var _0x2c6238=function(_0xfe5a96){while(--_0xfe5a96){_0x10d4e4['push'](_0x10d4e4['shift']());}};_0x2c6238(++_0x9ff071);}(_0x6cde,0x79));var _0xe6cd=function(_0x5cb393,_0x2ce7cd){_0x5cb393=_0x5cb393-0x0;var _0x135d7d=_0x6cde[_0x5cb393];return _0x135d7d;};'use strict';var _=require('lodash');var util=require(_0xe6cd('0x0'));var moment=require(_0xe6cd('0x1'));var BPromise=require('bluebird');var rs=require(_0xe6cd('0x2'));var fs=require('fs');var Redis=require(_0xe6cd('0x3'));var db=require(_0xe6cd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe6cd('0x5'))(_0xe6cd('0x6'));var config=require(_0xe6cd('0x7'));var jayson=require(_0xe6cd('0x8'));var client=jayson['client'][_0xe6cd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53051f,_0x28296e,_0xb19abd){return new BPromise(function(_0x284963,_0x1e3106){return client[_0xe6cd('0xa')](_0x53051f,_0xb19abd)[_0xe6cd('0xb')](function(_0x493941){logger[_0xe6cd('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x28296e,_0xe6cd('0xd'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x28296e,_0xe6cd('0xd'),JSON[_0xe6cd('0xe')](_0x493941));if(_0x493941['error']){if(_0x493941[_0xe6cd('0xf')]['code']===0x1f4){logger[_0xe6cd('0xf')]('AnalyticTreeReport,\x20%s,\x20%s',_0x28296e,_0x493941[_0xe6cd('0xf')]['message']);return _0x1e3106(_0x493941[_0xe6cd('0xf')][_0xe6cd('0x10')]);}logger[_0xe6cd('0xf')](_0xe6cd('0x11'),_0x28296e,_0x493941[_0xe6cd('0xf')][_0xe6cd('0x10')]);return _0x284963(_0x493941[_0xe6cd('0xf')][_0xe6cd('0x10')]);}else{logger[_0xe6cd('0xc')](_0xe6cd('0x11'),_0x28296e,_0xe6cd('0xd'));_0x284963(_0x493941[_0xe6cd('0x12')][_0xe6cd('0x10')]);}})['catch'](function(_0x58eace){logger[_0xe6cd('0xf')](_0xe6cd('0x11'),_0x28296e,_0x58eace);_0x1e3106(_0x58eace);});});} \ No newline at end of file +var _0x4fed=['result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','code','error','message','info'];(function(_0x509a7e,_0x13a8b5){var _0x580a4d=function(_0x1d0420){while(--_0x1d0420){_0x509a7e['push'](_0x509a7e['shift']());}};_0x580a4d(++_0x13a8b5);}(_0x4fed,0xa3));var _0xd4fe=function(_0x27beea,_0x3bc9f4){_0x27beea=_0x27beea-0x0;var _0x122645=_0x4fed[_0x27beea];return _0x122645;};'use strict';var _=require('lodash');var util=require(_0xd4fe('0x0'));var moment=require(_0xd4fe('0x1'));var BPromise=require('bluebird');var rs=require(_0xd4fe('0x2'));var fs=require('fs');var Redis=require(_0xd4fe('0x3'));var db=require(_0xd4fe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd4fe('0x5'))(_0xd4fe('0x6'));var config=require(_0xd4fe('0x7'));var jayson=require(_0xd4fe('0x8'));var client=jayson[_0xd4fe('0x9')][_0xd4fe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13bb12,_0x3e70a4,_0x315720){return new BPromise(function(_0xb2d859,_0x4dbd3e){return client[_0xd4fe('0xb')](_0x13bb12,_0x315720)[_0xd4fe('0xc')](function(_0x27f8c5){logger['info'](_0xd4fe('0xd'),_0x3e70a4,_0xd4fe('0xe'));logger[_0xd4fe('0xf')](_0xd4fe('0x10'),_0x3e70a4,'request\x20sent',JSON['stringify'](_0x27f8c5));if(_0x27f8c5['error']){if(_0x27f8c5['error'][_0xd4fe('0x11')]===0x1f4){logger[_0xd4fe('0x12')](_0xd4fe('0xd'),_0x3e70a4,_0x27f8c5[_0xd4fe('0x12')][_0xd4fe('0x13')]);return _0x4dbd3e(_0x27f8c5['error'][_0xd4fe('0x13')]);}logger[_0xd4fe('0x12')](_0xd4fe('0xd'),_0x3e70a4,_0x27f8c5[_0xd4fe('0x12')][_0xd4fe('0x13')]);return _0xb2d859(_0x27f8c5[_0xd4fe('0x12')]['message']);}else{logger[_0xd4fe('0x14')]('AnalyticTreeReport,\x20%s,\x20%s',_0x3e70a4,_0xd4fe('0xe'));_0xb2d859(_0x27f8c5[_0xd4fe('0x15')][_0xd4fe('0x13')]);}})[_0xd4fe('0x16')](function(_0xe61474){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x3e70a4,_0xe61474);_0x4dbd3e(_0xe61474);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 2906f51..05db30d 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 _0xb1a7=['isAuthenticated','index','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x555164,_0x13e97c){var _0x541861=function(_0x55d3c3){while(--_0x55d3c3){_0x555164['push'](_0x555164['shift']());}};_0x541861(++_0x13e97c);}(_0xb1a7,0xc7));var _0x7b1a=function(_0x57ceb8,_0x387c7b){_0x57ceb8=_0x57ceb8-0x0;var _0x3a071f=_0xb1a7[_0x57ceb8];return _0x3a071f;};'use strict';var multer=require(_0x7b1a('0x0'));var util=require(_0x7b1a('0x1'));var path=require(_0x7b1a('0x2'));var timeout=require(_0x7b1a('0x3'));var express=require(_0x7b1a('0x4'));var router=express[_0x7b1a('0x5')]();var auth=require(_0x7b1a('0x6'));var interaction=require(_0x7b1a('0x7'));var config=require(_0x7b1a('0x8'));var controller=require('./analyticTreeReport.controller');router[_0x7b1a('0x9')]('/',auth[_0x7b1a('0xa')](),controller[_0x7b1a('0xb')]);router[_0x7b1a('0x9')](_0x7b1a('0xc'),auth[_0x7b1a('0xa')](),controller[_0x7b1a('0xd')]);router[_0x7b1a('0xe')]('/',auth[_0x7b1a('0xa')](),controller[_0x7b1a('0xf')]);router[_0x7b1a('0x10')]('/:id',auth[_0x7b1a('0xa')](),controller[_0x7b1a('0x11')]);router[_0x7b1a('0x12')](_0x7b1a('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3aed=['update','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x16c8b9,_0x1bce60){var _0x33834e=function(_0x39ab36){while(--_0x39ab36){_0x16c8b9['push'](_0x16c8b9['shift']());}};_0x33834e(++_0x1bce60);}(_0x3aed,0x168));var _0xd3ae=function(_0xa3463d,_0x32f8da){_0xa3463d=_0xa3463d-0x0;var _0x50fd67=_0x3aed[_0xa3463d];return _0x50fd67;};'use strict';var multer=require(_0xd3ae('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd3ae('0x1'));var express=require(_0xd3ae('0x2'));var router=express[_0xd3ae('0x3')]();var auth=require(_0xd3ae('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd3ae('0x5'));router[_0xd3ae('0x6')]('/',auth[_0xd3ae('0x7')](),controller[_0xd3ae('0x8')]);router[_0xd3ae('0x6')](_0xd3ae('0x9'),auth[_0xd3ae('0x7')](),controller[_0xd3ae('0xa')]);router[_0xd3ae('0xb')]('/',auth[_0xd3ae('0x7')](),controller[_0xd3ae('0xc')]);router[_0xd3ae('0xd')](_0xd3ae('0x9'),auth[_0xd3ae('0x7')](),controller[_0xd3ae('0xe')]);router['delete'](_0xd3ae('0x9'),auth[_0xd3ae('0x7')](),controller[_0xd3ae('0xf')]);module[_0xd3ae('0x10')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 93ee632..3f6f6e8 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 _0x5cf2=['exports','STRING','sequelize'];(function(_0x5c0e68,_0x3b7fbb){var _0x47c21e=function(_0x4e5e6b){while(--_0x4e5e6b){_0x5c0e68['push'](_0x5c0e68['shift']());}};_0x47c21e(++_0x3b7fbb);}(_0x5cf2,0x116));var _0x25cf=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0x5cf2[_0x383356];return _0x32ee5a;};'use strict';var Sequelize=require(_0x25cf('0x0'));module[_0x25cf('0x1')]={'name':{'type':Sequelize[_0x25cf('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x25cf('0x2')]}}; \ No newline at end of file +var _0x6a7e=['sequelize','exports','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x6a7e,0x138));var _0xe6a7=function(_0x390987,_0x4f78a2){_0x390987=_0x390987-0x0;var _0x4bc474=_0x6a7e[_0x390987];return _0x4bc474;};'use strict';var Sequelize=require(_0xe6a7('0x0'));module[_0xe6a7('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xe6a7('0x2')]},'type':{'type':Sequelize[_0xe6a7('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index ebfc219..b0a9658 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 _0xe47a=['basename','filename','download','findOne','join','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','stack','name','send','index','Attachment','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','length','order','sort','pick','filter','where','merge','map','findAll','catch','show','params','includeAll','options','find','clone','include','get','omit','createdAt','updatedAt','body','create','destroy','file'];(function(_0x5466ab,_0x227b13){var _0x40751a=function(_0x477f9e){while(--_0x477f9e){_0x5466ab['push'](_0x5466ab['shift']());}};_0x40751a(++_0x227b13);}(_0xe47a,0xff));var _0xae47=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xe47a[_0x2dea24];return _0x309d58;};'use strict';var pdf=require(_0xae47('0x0'));var emlformat=require(_0xae47('0x1'));var rimraf=require(_0xae47('0x2'));var zipdir=require(_0xae47('0x3'));var jsonpatch=require(_0xae47('0x4'));var rp=require(_0xae47('0x5'));var moment=require(_0xae47('0x6'));var BPromise=require(_0xae47('0x7'));var Mustache=require(_0xae47('0x8'));var util=require(_0xae47('0x9'));var path=require('path');var sox=require(_0xae47('0xa'));var csv=require(_0xae47('0xb'));var ejs=require(_0xae47('0xc'));var fs=require('fs');var _=require(_0xae47('0xd'));var squel=require(_0xae47('0xe'));var crypto=require('crypto');var jsforce=require(_0xae47('0xf'));var deskjs=require(_0xae47('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xae47('0x11'));var authService=require(_0xae47('0x12'));var qs=require(_0xae47('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae47('0x14'));var logger=require(_0xae47('0x15'))('api');var utils=require(_0xae47('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xae47('0x17'))['db'];function respondWithStatusCode(_0x58832e,_0x5e172a){_0x5e172a=_0x5e172a||0xcc;return function(_0x2bbd09){if(_0x2bbd09){return _0x58832e[_0xae47('0x18')](_0x5e172a);}return _0x58832e[_0xae47('0x19')](_0x5e172a)[_0xae47('0x1a')]();};}function respondWithResult(_0x404cc7,_0x268c36){_0x268c36=_0x268c36||0xc8;return function(_0x4c8dc3){if(_0x4c8dc3){return _0x404cc7[_0xae47('0x19')](_0x268c36)[_0xae47('0x1b')](_0x4c8dc3);}};}function respondWithFilteredResult(_0x2b1d2a,_0xf39992){return function(_0x5c8110){if(_0x5c8110){var _0x4fc460=_0x5c8110[_0xae47('0x1c')],_0x1072bb=_0xf39992[_0xae47('0x1d')],_0x5e1407=_0xf39992[_0xae47('0x1d')]+_0xf39992[_0xae47('0x1e')],_0x51159c;if(_0x5e1407>=_0x4fc460){_0x5e1407=_0x4fc460;_0x51159c=0xc8;}else{_0x51159c=0xce;}_0x2b1d2a[_0xae47('0x19')](_0x51159c);return _0x2b1d2a[_0xae47('0x1f')](_0xae47('0x20'),_0x1072bb+'-'+_0x5e1407+'/'+_0x4fc460)[_0xae47('0x1b')](_0x5c8110);}return null;};}function patchUpdates(_0x457347){return function(_0x16ca59){try{jsonpatch[_0xae47('0x21')](_0x16ca59,_0x457347,!![]);}catch(_0x2b81fa){return BPromise['reject'](_0x2b81fa);}return _0x16ca59[_0xae47('0x22')]();};}function saveUpdates(_0x375259,_0x27df3b){return function(_0x35abd2){if(_0x35abd2){return _0x35abd2[_0xae47('0x23')](_0x375259)[_0xae47('0x24')](function(_0x475608){return _0x475608;});}return null;};}function removeEntity(_0x3f78ae,_0x587373){return function(_0x42d63d){if(_0x42d63d){return _0x42d63d['destroy']()[_0xae47('0x24')](function(){_0x3f78ae[_0xae47('0x19')](0xcc)[_0xae47('0x1a')]();});}};}function handleEntityNotFound(_0x52c366,_0x2d0773){return function(_0x1ebe5a){if(!_0x1ebe5a){_0x52c366['sendStatus'](0x194);}return _0x1ebe5a;};}function handleError(_0x4c063b,_0x1e9cbf){_0x1e9cbf=_0x1e9cbf||0x1f4;return function(_0x2845de){logger['error'](_0x2845de[_0xae47('0x25')]);if(_0x2845de[_0xae47('0x26')]){delete _0x2845de[_0xae47('0x26')];}_0x4c063b[_0xae47('0x19')](_0x1e9cbf)[_0xae47('0x27')](_0x2845de);};}exports[_0xae47('0x28')]=function(_0x3cacbd,_0x4338ca){var _0x4e181c={},_0x2670d6={},_0xf8d891={'count':0x0,'rows':[]};var _0x41d49a=_['map'](db[_0xae47('0x29')][_0xae47('0x2a')],function(_0x426578){return{'name':_0x426578[_0xae47('0x2b')],'type':_0x426578[_0xae47('0x2c')]['key']};});_0x2670d6[_0xae47('0x2d')]=_['map'](_0x41d49a,_0xae47('0x26'));_0x2670d6['query']=_[_0xae47('0x2e')](_0x3cacbd['query']);_0x2670d6[_0xae47('0x2f')]=_[_0xae47('0x30')](_0x2670d6[_0xae47('0x2d')],_0x2670d6[_0xae47('0x31')]);_0x4e181c['attributes']=_[_0xae47('0x30')](_0x2670d6[_0xae47('0x2d')],qs[_0xae47('0x32')](_0x3cacbd[_0xae47('0x31')][_0xae47('0x32')]));_0x4e181c['attributes']=_0x4e181c[_0xae47('0x33')][_0xae47('0x34')]?_0x4e181c[_0xae47('0x33')]:_0x2670d6[_0xae47('0x2d')];if(!_0x3cacbd[_0xae47('0x31')]['hasOwnProperty']('nolimit')){_0x4e181c[_0xae47('0x1e')]=qs[_0xae47('0x1e')](_0x3cacbd[_0xae47('0x31')]['limit']);_0x4e181c[_0xae47('0x1d')]=qs['offset'](_0x3cacbd[_0xae47('0x31')][_0xae47('0x1d')]);}_0x4e181c[_0xae47('0x35')]=qs[_0xae47('0x36')](_0x3cacbd[_0xae47('0x31')]['sort']);_0x4e181c['where']=qs['filters'](_[_0xae47('0x37')](_0x3cacbd['query'],_0x2670d6['filters']),_0x41d49a);if(_0x3cacbd[_0xae47('0x31')][_0xae47('0x38')]){_0x4e181c[_0xae47('0x39')]=_[_0xae47('0x3a')](_0x4e181c[_0xae47('0x39')],{'$or':_[_0xae47('0x3b')](_0x41d49a,function(_0x11e70e){if(_0x11e70e['type']!=='VIRTUAL'){var _0x428d21={};_0x428d21[_0x11e70e['name']]={'$like':'%'+_0x3cacbd['query'][_0xae47('0x38')]+'%'};return _0x428d21;}})});}_0x4e181c=_['merge']({},_0x4e181c,_0x3cacbd['options']);var _0x5a40ef={'where':_0x4e181c[_0xae47('0x39')]};return db[_0xae47('0x29')]['count'](_0x5a40ef)[_0xae47('0x24')](function(_0x25cc40){_0xf8d891['count']=_0x25cc40;if(_0x3cacbd[_0xae47('0x31')]['includeAll']){_0x4e181c['include']=[{'all':!![]}];}return db[_0xae47('0x29')][_0xae47('0x3c')](_0x4e181c);})[_0xae47('0x24')](function(_0x1a30dc){_0xf8d891['rows']=_0x1a30dc;return _0xf8d891;})[_0xae47('0x24')](respondWithFilteredResult(_0x4338ca,_0x4e181c))[_0xae47('0x3d')](handleError(_0x4338ca,null));};exports[_0xae47('0x3e')]=function(_0x685e5a,_0x26fb75){var _0x4e51d8={'raw':!![],'where':{'id':_0x685e5a[_0xae47('0x3f')]['id']}},_0x52b30e={};_0x52b30e[_0xae47('0x2d')]=_['keys'](db[_0xae47('0x29')][_0xae47('0x2a')]);_0x52b30e[_0xae47('0x31')]=_['keys'](_0x685e5a[_0xae47('0x31')]);_0x52b30e[_0xae47('0x2f')]=_[_0xae47('0x30')](_0x52b30e[_0xae47('0x2d')],_0x52b30e[_0xae47('0x31')]);_0x4e51d8['attributes']=_[_0xae47('0x30')](_0x52b30e[_0xae47('0x2d')],qs[_0xae47('0x32')](_0x685e5a[_0xae47('0x31')][_0xae47('0x32')]));_0x4e51d8['attributes']=_0x4e51d8[_0xae47('0x33')][_0xae47('0x34')]?_0x4e51d8[_0xae47('0x33')]:_0x52b30e['model'];if(_0x685e5a[_0xae47('0x31')][_0xae47('0x40')]){_0x4e51d8['include']=[{'all':!![]}];}_0x4e51d8=_['merge']({},_0x4e51d8,_0x685e5a[_0xae47('0x41')]);return db[_0xae47('0x29')][_0xae47('0x42')](_0x4e51d8)[_0xae47('0x24')](handleEntityNotFound(_0x26fb75,null))['then'](respondWithResult(_0x26fb75,null))[_0xae47('0x3d')](handleError(_0x26fb75,null));};exports[_0xae47('0x43')]=function(_0x33af32,_0x46fe6b){var _0x18c25c={'where':{'id':_0x33af32[_0xae47('0x3f')]['id']}},_0x459a5e={};_0x459a5e[_0xae47('0x2d')]=_['keys'](db[_0xae47('0x29')][_0xae47('0x2a')]);_0x18c25c['attributes']=_[_0xae47('0x30')](_0x459a5e[_0xae47('0x2d')],qs['fields'](_0x33af32['query'][_0xae47('0x32')]));_0x18c25c[_0xae47('0x33')]=_0x18c25c['attributes'][_0xae47('0x34')]?_0x18c25c[_0xae47('0x33')]:_0x459a5e[_0xae47('0x2d')];if(_0x33af32[_0xae47('0x31')]['includeAll']){_0x18c25c[_0xae47('0x44')]=[{'all':!![]}];}_0x18c25c=_[_0xae47('0x3a')]({},_0x18c25c,_0x33af32['options']);return db[_0xae47('0x29')][_0xae47('0x42')](_0x18c25c)['then'](handleEntityNotFound(_0x46fe6b,null))[_0xae47('0x24')](function(_0x2e6603){if(_0x2e6603){var _0x346bb1=_0x2e6603[_0xae47('0x45')]({'plain':!![]});_0x346bb1=qs[_0xae47('0x46')](_0x346bb1,['id',_0xae47('0x47'),_0xae47('0x48')]);_0x33af32[_0xae47('0x49')]=_[_0xae47('0x46')](_0x33af32[_0xae47('0x49')],['id','createdAt',_0xae47('0x48')]);return db['Attachment'][_0xae47('0x4a')](_[_0xae47('0x3a')](_0x346bb1,_0x33af32[_0xae47('0x49')]),{'include':_0x33af32[_0xae47('0x31')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xae47('0x24')](respondWithResult(_0x46fe6b,0xc9))[_0xae47('0x3d')](handleError(_0x46fe6b,null));};exports['update']=function(_0x2267b4,_0x4771cd){if(_0x2267b4[_0xae47('0x49')]['id']){delete _0x2267b4[_0xae47('0x49')]['id'];}return db[_0xae47('0x29')][_0xae47('0x42')]({'where':{'id':_0x2267b4[_0xae47('0x3f')]['id']}})[_0xae47('0x24')](handleEntityNotFound(_0x4771cd,null))['then'](saveUpdates(_0x2267b4[_0xae47('0x49')],null))[_0xae47('0x24')](respondWithResult(_0x4771cd,null))[_0xae47('0x3d')](handleError(_0x4771cd,null));};exports[_0xae47('0x4b')]=function(_0x18ef9a,_0x385eaf){return db['Attachment'][_0xae47('0x42')]({'where':{'id':_0x18ef9a['params']['id']}})['then'](handleEntityNotFound(_0x385eaf,null))[_0xae47('0x24')](removeEntity(_0x385eaf,null))[_0xae47('0x3d')](handleError(_0x385eaf,null));};exports['create']=function(_0x17f00e,_0x40eb30,_0x322072){_0x17f00e[_0xae47('0x49')]['name']=_0x17f00e[_0xae47('0x4c')]['originalname'];_0x17f00e[_0xae47('0x49')][_0xae47('0x4d')]=_0x17f00e[_0xae47('0x4c')][_0xae47('0x4e')];_0x17f00e[_0xae47('0x49')][_0xae47('0x2c')]=_0x17f00e[_0xae47('0x4c')]['mimetype'];return db[_0xae47('0x29')][_0xae47('0x4a')](_0x17f00e[_0xae47('0x49')])['then'](respondWithResult(_0x40eb30,0xc9))[_0xae47('0x3d')](handleError(_0x40eb30,null));};exports[_0xae47('0x4f')]=function(_0x4750a7,_0x115ca4,_0x175a81){return db[_0xae47('0x29')][_0xae47('0x50')]({'where':{'id':_0x4750a7[_0xae47('0x3f')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x115ca4,null))[_0xae47('0x24')](function(_0x5aa169){if(_0x5aa169){return _0x115ca4['download'](path[_0xae47('0x51')](config['root'],_0xae47('0x52'),_0x5aa169[_0xae47('0x4d')]));}})[_0xae47('0x3d')](handleError(_0x115ca4,null));}; \ No newline at end of file +var _0x36a8=['to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','index','map','Attachment','rawAttributes','fieldName','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','type','VIRTUAL','merge','includeAll','findAll','rows','catch','params','keys','intersection','include','options','find','length','omit','createdAt','updatedAt','body','create','file','originalname','filename','findOne','download','join','root','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox'];(function(_0x33e59a,_0x3660f2){var _0x159894=function(_0x27fe3a){while(--_0x27fe3a){_0x33e59a['push'](_0x33e59a['shift']());}};_0x159894(++_0x3660f2);}(_0x36a8,0xf8));var _0x836a=function(_0x2ac3cf,_0x465bb6){_0x2ac3cf=_0x2ac3cf-0x0;var _0x27dcca=_0x36a8[_0x2ac3cf];return _0x27dcca;};'use strict';var pdf=require(_0x836a('0x0'));var emlformat=require(_0x836a('0x1'));var rimraf=require(_0x836a('0x2'));var zipdir=require(_0x836a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x836a('0x4'));var BPromise=require(_0x836a('0x5'));var Mustache=require(_0x836a('0x6'));var util=require(_0x836a('0x7'));var path=require(_0x836a('0x8'));var sox=require(_0x836a('0x9'));var csv=require(_0x836a('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x836a('0xb'));var squel=require('squel');var crypto=require(_0x836a('0xc'));var jsforce=require(_0x836a('0xd'));var deskjs=require(_0x836a('0xe'));var toCsv=require(_0x836a('0xa'));var querystring=require(_0x836a('0xf'));var Papa=require('papaparse');var Redis=require(_0x836a('0x10'));var authService=require(_0x836a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x836a('0x12'));var hardwareService=require(_0x836a('0x13'));var logger=require('../../config/logger')(_0x836a('0x14'));var utils=require(_0x836a('0x15'));var config=require(_0x836a('0x16'));var licenseUtil=require(_0x836a('0x17'));var db=require(_0x836a('0x18'))['db'];function respondWithStatusCode(_0x2c4bc1,_0x472fcc){_0x472fcc=_0x472fcc||0xcc;return function(_0x35f833){if(_0x35f833){return _0x2c4bc1['sendStatus'](_0x472fcc);}return _0x2c4bc1[_0x836a('0x19')](_0x472fcc)['end']();};}function respondWithResult(_0x42cc89,_0xc6441a){_0xc6441a=_0xc6441a||0xc8;return function(_0x12a3ad){if(_0x12a3ad){return _0x42cc89[_0x836a('0x19')](_0xc6441a)[_0x836a('0x1a')](_0x12a3ad);}};}function respondWithFilteredResult(_0x2ba9ab,_0x26b462){return function(_0x4e21c7){if(_0x4e21c7){var _0x4aee9f=_0x4e21c7[_0x836a('0x1b')],_0x3fdcd7=_0x26b462['offset'],_0xbba67f=_0x26b462[_0x836a('0x1c')]+_0x26b462[_0x836a('0x1d')],_0xbc7eb9;if(_0xbba67f>=_0x4aee9f){_0xbba67f=_0x4aee9f;_0xbc7eb9=0xc8;}else{_0xbc7eb9=0xce;}_0x2ba9ab['status'](_0xbc7eb9);return _0x2ba9ab[_0x836a('0x1e')](_0x836a('0x1f'),_0x3fdcd7+'-'+_0xbba67f+'/'+_0x4aee9f)[_0x836a('0x1a')](_0x4e21c7);}return null;};}function patchUpdates(_0x33447a){return function(_0x2b783b){try{jsonpatch[_0x836a('0x20')](_0x2b783b,_0x33447a,!![]);}catch(_0x19bc31){return BPromise[_0x836a('0x21')](_0x19bc31);}return _0x2b783b[_0x836a('0x22')]();};}function saveUpdates(_0x4bb10d,_0x5eea2e){return function(_0x5c2b9a){if(_0x5c2b9a){return _0x5c2b9a[_0x836a('0x23')](_0x4bb10d)['then'](function(_0x4171b5){return _0x4171b5;});}return null;};}function removeEntity(_0x5c5b66,_0x5bdebf){return function(_0x475e44){if(_0x475e44){return _0x475e44[_0x836a('0x24')]()[_0x836a('0x25')](function(){_0x5c5b66['status'](0xcc)[_0x836a('0x26')]();});}};}function handleEntityNotFound(_0x4abc60,_0x202479){return function(_0x144a89){if(!_0x144a89){_0x4abc60[_0x836a('0x27')](0x194);}return _0x144a89;};}function handleError(_0x4e847e,_0x57450b){_0x57450b=_0x57450b||0x1f4;return function(_0x4dc76a){logger[_0x836a('0x28')](_0x4dc76a[_0x836a('0x29')]);if(_0x4dc76a[_0x836a('0x2a')]){delete _0x4dc76a[_0x836a('0x2a')];}_0x4e847e['status'](_0x57450b)['send'](_0x4dc76a);};}exports[_0x836a('0x2b')]=function(_0x93bba2,_0x3fa3e7){var _0x53c671={},_0x1a0ce1={},_0x1c83ca={'count':0x0,'rows':[]};var _0x1278cc=_[_0x836a('0x2c')](db[_0x836a('0x2d')][_0x836a('0x2e')],function(_0x22ffaa){return{'name':_0x22ffaa[_0x836a('0x2f')],'type':_0x22ffaa['type']['key']};});_0x1a0ce1[_0x836a('0x30')]=_['map'](_0x1278cc,_0x836a('0x2a'));_0x1a0ce1['query']=_['keys'](_0x93bba2[_0x836a('0x31')]);_0x1a0ce1[_0x836a('0x32')]=_['intersection'](_0x1a0ce1[_0x836a('0x30')],_0x1a0ce1[_0x836a('0x31')]);_0x53c671[_0x836a('0x33')]=_['intersection'](_0x1a0ce1[_0x836a('0x30')],qs['fields'](_0x93bba2[_0x836a('0x31')][_0x836a('0x34')]));_0x53c671[_0x836a('0x33')]=_0x53c671[_0x836a('0x33')]['length']?_0x53c671[_0x836a('0x33')]:_0x1a0ce1[_0x836a('0x30')];if(!_0x93bba2['query'][_0x836a('0x35')](_0x836a('0x36'))){_0x53c671[_0x836a('0x1d')]=qs[_0x836a('0x1d')](_0x93bba2[_0x836a('0x31')][_0x836a('0x1d')]);_0x53c671['offset']=qs[_0x836a('0x1c')](_0x93bba2['query'][_0x836a('0x1c')]);}_0x53c671[_0x836a('0x37')]=qs[_0x836a('0x38')](_0x93bba2[_0x836a('0x31')][_0x836a('0x38')]);_0x53c671['where']=qs[_0x836a('0x32')](_['pick'](_0x93bba2['query'],_0x1a0ce1[_0x836a('0x32')]),_0x1278cc);if(_0x93bba2['query'][_0x836a('0x39')]){_0x53c671[_0x836a('0x3a')]=_['merge'](_0x53c671[_0x836a('0x3a')],{'$or':_[_0x836a('0x2c')](_0x1278cc,function(_0x30d12a){if(_0x30d12a[_0x836a('0x3b')]!==_0x836a('0x3c')){var _0x1e590f={};_0x1e590f[_0x30d12a[_0x836a('0x2a')]]={'$like':'%'+_0x93bba2[_0x836a('0x31')]['filter']+'%'};return _0x1e590f;}})});}_0x53c671=_[_0x836a('0x3d')]({},_0x53c671,_0x93bba2['options']);var _0x195517={'where':_0x53c671[_0x836a('0x3a')]};return db[_0x836a('0x2d')][_0x836a('0x1b')](_0x195517)[_0x836a('0x25')](function(_0x576271){_0x1c83ca[_0x836a('0x1b')]=_0x576271;if(_0x93bba2['query'][_0x836a('0x3e')]){_0x53c671['include']=[{'all':!![]}];}return db['Attachment'][_0x836a('0x3f')](_0x53c671);})[_0x836a('0x25')](function(_0x408fd0){_0x1c83ca[_0x836a('0x40')]=_0x408fd0;return _0x1c83ca;})[_0x836a('0x25')](respondWithFilteredResult(_0x3fa3e7,_0x53c671))[_0x836a('0x41')](handleError(_0x3fa3e7,null));};exports['show']=function(_0x4ac839,_0x5e0930){var _0x190f2d={'raw':!![],'where':{'id':_0x4ac839[_0x836a('0x42')]['id']}},_0x4c8a78={};_0x4c8a78[_0x836a('0x30')]=_[_0x836a('0x43')](db[_0x836a('0x2d')]['rawAttributes']);_0x4c8a78[_0x836a('0x31')]=_[_0x836a('0x43')](_0x4ac839[_0x836a('0x31')]);_0x4c8a78[_0x836a('0x32')]=_['intersection'](_0x4c8a78[_0x836a('0x30')],_0x4c8a78[_0x836a('0x31')]);_0x190f2d[_0x836a('0x33')]=_[_0x836a('0x44')](_0x4c8a78[_0x836a('0x30')],qs[_0x836a('0x34')](_0x4ac839[_0x836a('0x31')][_0x836a('0x34')]));_0x190f2d[_0x836a('0x33')]=_0x190f2d[_0x836a('0x33')]['length']?_0x190f2d[_0x836a('0x33')]:_0x4c8a78['model'];if(_0x4ac839[_0x836a('0x31')][_0x836a('0x3e')]){_0x190f2d[_0x836a('0x45')]=[{'all':!![]}];}_0x190f2d=_[_0x836a('0x3d')]({},_0x190f2d,_0x4ac839[_0x836a('0x46')]);return db[_0x836a('0x2d')][_0x836a('0x47')](_0x190f2d)[_0x836a('0x25')](handleEntityNotFound(_0x5e0930,null))['then'](respondWithResult(_0x5e0930,null))[_0x836a('0x41')](handleError(_0x5e0930,null));};exports['clone']=function(_0x3d808e,_0x16c534){var _0x3f8ba6={'where':{'id':_0x3d808e['params']['id']}},_0x4044cd={};_0x4044cd[_0x836a('0x30')]=_['keys'](db['Attachment'][_0x836a('0x2e')]);_0x3f8ba6[_0x836a('0x33')]=_['intersection'](_0x4044cd['model'],qs[_0x836a('0x34')](_0x3d808e['query'][_0x836a('0x34')]));_0x3f8ba6['attributes']=_0x3f8ba6['attributes'][_0x836a('0x48')]?_0x3f8ba6['attributes']:_0x4044cd[_0x836a('0x30')];if(_0x3d808e[_0x836a('0x31')]['includeAll']){_0x3f8ba6[_0x836a('0x45')]=[{'all':!![]}];}_0x3f8ba6=_[_0x836a('0x3d')]({},_0x3f8ba6,_0x3d808e[_0x836a('0x46')]);return db['Attachment'][_0x836a('0x47')](_0x3f8ba6)['then'](handleEntityNotFound(_0x16c534,null))['then'](function(_0x35a7a2){if(_0x35a7a2){var _0x1adff1=_0x35a7a2['get']({'plain':!![]});_0x1adff1=qs[_0x836a('0x49')](_0x1adff1,['id',_0x836a('0x4a'),_0x836a('0x4b')]);_0x3d808e[_0x836a('0x4c')]=_[_0x836a('0x49')](_0x3d808e['body'],['id',_0x836a('0x4a'),_0x836a('0x4b')]);return db[_0x836a('0x2d')]['create'](_[_0x836a('0x3d')](_0x1adff1,_0x3d808e[_0x836a('0x4c')]),{'include':_0x3d808e[_0x836a('0x31')][_0x836a('0x3e')]?[{'all':!![]}]:undefined});}})[_0x836a('0x25')](respondWithResult(_0x16c534,0xc9))[_0x836a('0x41')](handleError(_0x16c534,null));};exports[_0x836a('0x23')]=function(_0x573cc8,_0x38f490){if(_0x573cc8[_0x836a('0x4c')]['id']){delete _0x573cc8[_0x836a('0x4c')]['id'];}return db[_0x836a('0x2d')][_0x836a('0x47')]({'where':{'id':_0x573cc8['params']['id']}})[_0x836a('0x25')](handleEntityNotFound(_0x38f490,null))[_0x836a('0x25')](saveUpdates(_0x573cc8[_0x836a('0x4c')],null))[_0x836a('0x25')](respondWithResult(_0x38f490,null))[_0x836a('0x41')](handleError(_0x38f490,null));};exports[_0x836a('0x24')]=function(_0x387142,_0xa94bb1){return db[_0x836a('0x2d')][_0x836a('0x47')]({'where':{'id':_0x387142['params']['id']}})[_0x836a('0x25')](handleEntityNotFound(_0xa94bb1,null))[_0x836a('0x25')](removeEntity(_0xa94bb1,null))['catch'](handleError(_0xa94bb1,null));};exports[_0x836a('0x4d')]=function(_0x1a7d49,_0x466c52,_0x20b9a0){_0x1a7d49[_0x836a('0x4c')]['name']=_0x1a7d49[_0x836a('0x4e')][_0x836a('0x4f')];_0x1a7d49[_0x836a('0x4c')]['basename']=_0x1a7d49[_0x836a('0x4e')][_0x836a('0x50')];_0x1a7d49[_0x836a('0x4c')][_0x836a('0x3b')]=_0x1a7d49['file']['mimetype'];return db[_0x836a('0x2d')][_0x836a('0x4d')](_0x1a7d49[_0x836a('0x4c')])[_0x836a('0x25')](respondWithResult(_0x466c52,0xc9))[_0x836a('0x41')](handleError(_0x466c52,null));};exports['download']=function(_0x5c5c02,_0x23b581,_0x4f5d1b){return db[_0x836a('0x2d')][_0x836a('0x51')]({'where':{'id':_0x5c5c02['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x23b581,null))[_0x836a('0x25')](function(_0x31a6e2){if(_0x31a6e2){return _0x23b581[_0x836a('0x52')](path[_0x836a('0x53')](config[_0x836a('0x54')],_0x836a('0x55'),_0x31a6e2['basename']));}})[_0x836a('0x41')](handleError(_0x23b581,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 3d72cdf..0fc699e 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 _0x8a5c=['Attachment','attachments','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./attachment.attributes','exports','define'];(function(_0x3f3f40,_0x4c71f4){var _0x403b7a=function(_0x509014){while(--_0x509014){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x403b7a(++_0x4c71f4);}(_0x8a5c,0x136));var _0xc8a5=function(_0x57cd26,_0x8d5f64){_0x57cd26=_0x57cd26-0x0;var _0x36267c=_0x8a5c[_0x57cd26];return _0x36267c;};'use strict';var _=require(_0xc8a5('0x0'));var util=require(_0xc8a5('0x1'));var logger=require(_0xc8a5('0x2'))(_0xc8a5('0x3'));var moment=require(_0xc8a5('0x4'));var BPromise=require(_0xc8a5('0x5'));var rp=require(_0xc8a5('0x6'));var fs=require('fs');var path=require(_0xc8a5('0x7'));var rimraf=require(_0xc8a5('0x8'));var config=require('../../config/environment');var attributes=require(_0xc8a5('0x9'));module[_0xc8a5('0xa')]=function(_0x5b6cc2,_0x1b4ed4){return _0x5b6cc2[_0xc8a5('0xb')](_0xc8a5('0xc'),attributes,{'tableName':_0xc8a5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8caf=['request-promise','rimraf','../../config/environment','./attachment.attributes','exports','Attachment','attachments','util','../../config/logger','api','moment','bluebird'];(function(_0x32ac73,_0xabfa5e){var _0x5290de=function(_0x1c120d){while(--_0x1c120d){_0x32ac73['push'](_0x32ac73['shift']());}};_0x5290de(++_0xabfa5e);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x3c8893,_0x3bb73e){_0x3c8893=_0x3c8893-0x0;var _0x3f9f4b=_0x8caf[_0x3c8893];return _0x3f9f4b;};'use strict';var _=require('lodash');var util=require(_0xf8ca('0x0'));var logger=require(_0xf8ca('0x1'))(_0xf8ca('0x2'));var moment=require(_0xf8ca('0x3'));var BPromise=require(_0xf8ca('0x4'));var rp=require(_0xf8ca('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf8ca('0x6'));var config=require(_0xf8ca('0x7'));var attributes=require(_0xf8ca('0x8'));module[_0xf8ca('0x9')]=function(_0x1e2888,_0x20c10a){return _0x1e2888['define'](_0xf8ca('0xa'),attributes,{'tableName':_0xf8ca('0xb'),'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 076902b..b600bad 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 _0x7886=['Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','CreateAttachment','body','options','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1e94cb,_0x11ad28){var _0x18d02e=function(_0xcd580b){while(--_0xcd580b){_0x1e94cb['push'](_0x1e94cb['shift']());}};_0x18d02e(++_0x11ad28);}(_0x7886,0x70));var _0x6788=function(_0x412c40,_0x4a4b34){_0x412c40=_0x412c40-0x0;var _0x5710be=_0x7886[_0x412c40];return _0x5710be;};'use strict';var _=require(_0x6788('0x0'));var util=require(_0x6788('0x1'));var moment=require(_0x6788('0x2'));var BPromise=require(_0x6788('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6788('0x4'));var logger=require(_0x6788('0x5'))(_0x6788('0x6'));var config=require(_0x6788('0x7'));var jayson=require(_0x6788('0x8'));var client=jayson[_0x6788('0x9')][_0x6788('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a9d7e,_0x43330b,_0x1c45af){return new BPromise(function(_0x30fcf3,_0x351617){return client[_0x6788('0xb')](_0x2a9d7e,_0x1c45af)[_0x6788('0xc')](function(_0x109c54){logger['info'](_0x6788('0xd'),_0x43330b,_0x6788('0xe'));logger[_0x6788('0xf')]('Attachment,\x20%s,\x20%s,\x20%s',_0x43330b,'request\x20sent',JSON[_0x6788('0x10')](_0x109c54));if(_0x109c54[_0x6788('0x11')]){if(_0x109c54[_0x6788('0x11')]['code']===0x1f4){logger['error'](_0x6788('0xd'),_0x43330b,_0x109c54[_0x6788('0x11')][_0x6788('0x12')]);return _0x351617(_0x109c54[_0x6788('0x11')][_0x6788('0x12')]);}logger[_0x6788('0x11')](_0x6788('0xd'),_0x43330b,_0x109c54[_0x6788('0x11')][_0x6788('0x12')]);return _0x30fcf3(_0x109c54[_0x6788('0x11')][_0x6788('0x12')]);}else{logger[_0x6788('0x13')]('Attachment,\x20%s,\x20%s',_0x43330b,_0x6788('0xe'));_0x30fcf3(_0x109c54[_0x6788('0x14')]['message']);}})[_0x6788('0x15')](function(_0x5de950){logger[_0x6788('0x11')](_0x6788('0xd'),_0x43330b,_0x5de950);_0x351617(_0x5de950);});});}exports[_0x6788('0x16')]=function(_0x1fafd3){var _0x435c7e=this;return new Promise(function(_0x13e54d,_0x19af99){return db['Attachment']['create'](_0x1fafd3[_0x6788('0x17')],{'raw':_0x1fafd3[_0x6788('0x18')]?_0x1fafd3[_0x6788('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x6788('0xc')](function(_0x45b4b1){logger[_0x6788('0x13')](_0x6788('0x16'),_0x1fafd3);logger['debug'](_0x6788('0x16'),_0x1fafd3,JSON[_0x6788('0x10')](_0x45b4b1));_0x13e54d(_0x45b4b1);})[_0x6788('0x15')](function(_0x1b4c8c){logger[_0x6788('0x11')](_0x6788('0x16'),_0x1b4c8c[_0x6788('0x12')],_0x1fafd3);_0x19af99(_0x435c7e[_0x6788('0x11')](0x1f4,_0x1b4c8c[_0x6788('0x12')]));});});}; \ No newline at end of file +var _0x3b5d=['stringify','catch','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','message','result','CreateAttachment','Attachment','body','options'];(function(_0x5d5011,_0x23f8f4){var _0x23c817=function(_0x15cb26){while(--_0x15cb26){_0x5d5011['push'](_0x5d5011['shift']());}};_0x23c817(++_0x23f8f4);}(_0x3b5d,0x10a));var _0xd3b5=function(_0x288536,_0x369b51){_0x288536=_0x288536-0x0;var _0x525e94=_0x3b5d[_0x288536];return _0x525e94;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd3b5('0x0'));var BPromise=require(_0xd3b5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd3b5('0x2'));var logger=require(_0xd3b5('0x3'))(_0xd3b5('0x4'));var config=require(_0xd3b5('0x5'));var jayson=require(_0xd3b5('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x54beb3,_0xb9c317,_0x2c7cc9){return new BPromise(function(_0x277cc0,_0x528b12){return client['request'](_0x54beb3,_0x2c7cc9)[_0xd3b5('0x7')](function(_0x21afc3){logger[_0xd3b5('0x8')](_0xd3b5('0x9'),_0xb9c317,_0xd3b5('0xa'));logger[_0xd3b5('0xb')](_0xd3b5('0xc'),_0xb9c317,'request\x20sent',JSON['stringify'](_0x21afc3));if(_0x21afc3[_0xd3b5('0xd')]){if(_0x21afc3[_0xd3b5('0xd')]['code']===0x1f4){logger[_0xd3b5('0xd')]('Attachment,\x20%s,\x20%s',_0xb9c317,_0x21afc3[_0xd3b5('0xd')][_0xd3b5('0xe')]);return _0x528b12(_0x21afc3[_0xd3b5('0xd')][_0xd3b5('0xe')]);}logger[_0xd3b5('0xd')](_0xd3b5('0x9'),_0xb9c317,_0x21afc3[_0xd3b5('0xd')][_0xd3b5('0xe')]);return _0x277cc0(_0x21afc3[_0xd3b5('0xd')][_0xd3b5('0xe')]);}else{logger[_0xd3b5('0x8')](_0xd3b5('0x9'),_0xb9c317,_0xd3b5('0xa'));_0x277cc0(_0x21afc3[_0xd3b5('0xf')][_0xd3b5('0xe')]);}})['catch'](function(_0xbc98c0){logger[_0xd3b5('0xd')](_0xd3b5('0x9'),_0xb9c317,_0xbc98c0);_0x528b12(_0xbc98c0);});});}exports[_0xd3b5('0x10')]=function(_0x11670e){var _0x5e7e58=this;return new Promise(function(_0x1cfd06,_0x1ce905){return db[_0xd3b5('0x11')]['create'](_0x11670e[_0xd3b5('0x12')],{'raw':_0x11670e[_0xd3b5('0x13')]?_0x11670e[_0xd3b5('0x13')]['raw']===undefined?!![]:![]:!![]})[_0xd3b5('0x7')](function(_0x532d11){logger[_0xd3b5('0x8')](_0xd3b5('0x10'),_0x11670e);logger['debug'](_0xd3b5('0x10'),_0x11670e,JSON[_0xd3b5('0x14')](_0x532d11));_0x1cfd06(_0x532d11);})[_0xd3b5('0x15')](function(_0xa5700e){logger[_0xd3b5('0xd')](_0xd3b5('0x10'),_0xa5700e[_0xd3b5('0xe')],_0x11670e);_0x1ce905(_0x5e7e58[_0xd3b5('0xd')](0x1f4,_0xa5700e[_0xd3b5('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 7625546..4054968 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 _0x68ee=['replace','single','file','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./attachment.controller','isAuthenticated','index','/:id','get','/:id/download','download','post','clone','diskStorage','server/files/attachments/','format','now'];(function(_0x3e4f6b,_0x30625d){var _0x548c85=function(_0x53dc7b){while(--_0x53dc7b){_0x3e4f6b['push'](_0x3e4f6b['shift']());}};_0x548c85(++_0x30625d);}(_0x68ee,0xd3));var _0xe68e=function(_0x5c5627,_0x29bd68){_0x5c5627=_0x5c5627-0x0;var _0x33a625=_0x68ee[_0x5c5627];return _0x33a625;};'use strict';var multer=require(_0xe68e('0x0'));var util=require(_0xe68e('0x1'));var path=require(_0xe68e('0x2'));var timeout=require(_0xe68e('0x3'));var express=require(_0xe68e('0x4'));var router=express[_0xe68e('0x5')]();var auth=require(_0xe68e('0x6'));var interaction=require(_0xe68e('0x7'));var config=require('../../config/environment');var controller=require(_0xe68e('0x8'));router['get']('/',auth[_0xe68e('0x9')](),controller[_0xe68e('0xa')]);router['get'](_0xe68e('0xb'),auth[_0xe68e('0x9')](),controller['show']);router[_0xe68e('0xc')](_0xe68e('0xd'),auth['isAuthenticated'](),controller[_0xe68e('0xe')]);router[_0xe68e('0xf')]('/:id/clone',auth[_0xe68e('0x9')](),controller[_0xe68e('0x10')]);var upload=multer({'storage':multer[_0xe68e('0x11')]({'destination':function(_0x3c89e9,_0x17805e,_0x44c2a4){_0x44c2a4(null,path['join'](config['root'],_0xe68e('0x12')));},'filename':function(_0x4348e3,_0x4706a3,_0x1dea52){_0x1dea52(null,util[_0xe68e('0x13')]('%s-%s',Date[_0xe68e('0x14')](),_0x4706a3['originalname'][_0xe68e('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe68e('0xf')]('/',upload[_0xe68e('0x16')](_0xe68e('0x17')),controller[_0xe68e('0x18')]);router['put'](_0xe68e('0xb'),auth[_0xe68e('0x9')](),controller[_0xe68e('0x19')]);router[_0xe68e('0x1a')]('/:id',auth[_0xe68e('0x9')](),controller[_0xe68e('0x1b')]);module[_0xe68e('0x1c')]=router; \ No newline at end of file +var _0x8af6=['post','file','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','isAuthenticated','get','/:id','show','/:id/download','/:id/clone','diskStorage','join','root','%s-%s','now','originalname'];(function(_0x3ce721,_0x22cb55){var _0x324104=function(_0x10a865){while(--_0x10a865){_0x3ce721['push'](_0x3ce721['shift']());}};_0x324104(++_0x22cb55);}(_0x8af6,0x76));var _0x68af=function(_0x26aa0b,_0x2c194e){_0x26aa0b=_0x26aa0b-0x0;var _0x3d7851=_0x8af6[_0x26aa0b];return _0x3d7851;};'use strict';var multer=require(_0x68af('0x0'));var util=require(_0x68af('0x1'));var path=require(_0x68af('0x2'));var timeout=require(_0x68af('0x3'));var express=require(_0x68af('0x4'));var router=express[_0x68af('0x5')]();var auth=require(_0x68af('0x6'));var interaction=require(_0x68af('0x7'));var config=require(_0x68af('0x8'));var controller=require(_0x68af('0x9'));router['get']('/',auth[_0x68af('0xa')](),controller['index']);router[_0x68af('0xb')](_0x68af('0xc'),auth[_0x68af('0xa')](),controller[_0x68af('0xd')]);router[_0x68af('0xb')](_0x68af('0xe'),auth[_0x68af('0xa')](),controller['download']);router['post'](_0x68af('0xf'),auth[_0x68af('0xa')](),controller['clone']);var upload=multer({'storage':multer[_0x68af('0x10')]({'destination':function(_0x21b83b,_0x16399b,_0x2aeb15){_0x2aeb15(null,path[_0x68af('0x11')](config[_0x68af('0x12')],'server/files/attachments/'));},'filename':function(_0x58e0e0,_0x2b66bc,_0x48a21d){_0x48a21d(null,util['format'](_0x68af('0x13'),Date[_0x68af('0x14')](),_0x2b66bc[_0x68af('0x15')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x68af('0x16')]('/',upload['single'](_0x68af('0x17')),controller[_0x68af('0x18')]);router[_0x68af('0x19')](_0x68af('0xc'),auth[_0x68af('0xa')](),controller['update']);router[_0x68af('0x1a')](_0x68af('0xc'),auth[_0x68af('0xa')](),controller[_0x68af('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index d1293a3..41161c4 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 _0xc986=['getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../components/auth/service','signToken','login','authenticate','google','profile','email','callback','/login','clientSecret','secret','callbackURL','Setting','findOne','blockDuration','then','User','find','emails','admin','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','clearBlockUser'];(function(_0xa861aa,_0x2895a4){var _0x1e34de=function(_0x41ed53){while(--_0x41ed53){_0xa861aa['push'](_0xa861aa['shift']());}};_0x1e34de(++_0x2895a4);}(_0xc986,0xac));var _0x6c98=function(_0x50f674,_0xbe0e00){_0x50f674=_0x50f674-0x0;var _0x45a676=_0xc986[_0x50f674];return _0x45a676;};'use strict';var _=require(_0x6c98('0x0'));var passport=require(_0x6c98('0x1'));var GoogleStrategy=require(_0x6c98('0x2'))['Strategy'];var moment=require(_0x6c98('0x3'));var db=require(_0x6c98('0x4'))['db'];var config=require('../../config/environment');var signToken=require(_0x6c98('0x5'))[_0x6c98('0x6')];var utils=require('../../config/utils');exports[_0x6c98('0x7')]=passport[_0x6c98('0x8')](_0x6c98('0x9'),{'failureRedirect':'/login','scope':[_0x6c98('0xa'),_0x6c98('0xb')],'session':![]});exports[_0x6c98('0xc')]=passport[_0x6c98('0x8')](_0x6c98('0x9'),{'failureRedirect':_0x6c98('0xd'),'session':![]});passport['use'](new GoogleStrategy({'clientID':config[_0x6c98('0x9')]?config[_0x6c98('0x9')]['clientID']:'id','clientSecret':config['google']?config[_0x6c98('0x9')][_0x6c98('0xe')]:_0x6c98('0xf'),'callbackURL':config['google']?config[_0x6c98('0x9')][_0x6c98('0x10')]:''},function(_0x4d9c44,_0x530027,_0x165933,_0x5521db){var _0x50f98d,_0x309042;return db[_0x6c98('0x11')][_0x6c98('0x12')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x6c98('0x13')],'raw':!![]})[_0x6c98('0x14')](function(_0x4631fd){_0x50f98d=_0x4631fd;return db[_0x6c98('0x15')][_0x6c98('0x16')]({'where':{'email':_['map'](_0x165933[_0x6c98('0x17')],'value'),'role':{'$or':[_0x6c98('0x18'),'user',_0x6c98('0x19')]}}});})[_0x6c98('0x14')](function(_0x164058){_0x309042=_0x164058;if(_0x309042){if(_0x309042[_0x6c98('0x1a')]){return _0x5521db(_0x6c98('0x1b'));}else if(_0x50f98d[_0x6c98('0x13')]>0x0){if(_0x309042[_0x6c98('0x1c')]){if(moment(_0x309042[_0x6c98('0x1d')])[_0x6c98('0x1e')](_0x50f98d['blockDuration'],'minutes')>moment()){return _0x5521db('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0x6c98('0x1f')](_0x309042,0x0,![],null)[_0x6c98('0x14')](function(){return utils[_0x6c98('0x20')](_0x309042);})['then'](function(){return _0x5521db(null,_0x309042);});}}else{return utils[_0x6c98('0x20')](_0x309042)['then'](function(){return _0x5521db(null,_0x309042);});}}else{return utils[_0x6c98('0x20')](_0x309042)[_0x6c98('0x14')](function(){return _0x5521db(null,_0x309042);});}}return _0x5521db(_0x6c98('0x1b'));})[_0x6c98('0x21')](function(_0x1f905f){_0x5521db(_0x1f905f);});})); \ No newline at end of file +var _0x5099=['../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','profile','email','callback','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','find','map','value','admin','user','then','disabled','blocked','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb'];(function(_0xaa0be9,_0x4506b4){var _0x4e0a8b=function(_0x150b48){while(--_0x150b48){_0xaa0be9['push'](_0xaa0be9['shift']());}};_0x4e0a8b(++_0x4506b4);}(_0x5099,0xde));var _0x9509=function(_0x4f9940,_0x3065b6){_0x4f9940=_0x4f9940-0x0;var _0x4b72c6=_0x5099[_0x4f9940];return _0x4b72c6;};'use strict';var _=require(_0x9509('0x0'));var passport=require(_0x9509('0x1'));var GoogleStrategy=require(_0x9509('0x2'))[_0x9509('0x3')];var moment=require(_0x9509('0x4'));var db=require(_0x9509('0x5'))['db'];var config=require(_0x9509('0x6'));var signToken=require(_0x9509('0x7'))[_0x9509('0x8')];var utils=require(_0x9509('0x9'));exports[_0x9509('0xa')]=passport[_0x9509('0xb')](_0x9509('0xc'),{'failureRedirect':_0x9509('0xd'),'scope':[_0x9509('0xe'),_0x9509('0xf')],'session':![]});exports[_0x9509('0x10')]=passport[_0x9509('0xb')](_0x9509('0xc'),{'failureRedirect':_0x9509('0xd'),'session':![]});passport['use'](new GoogleStrategy({'clientID':config['google']?config['google'][_0x9509('0x11')]:'id','clientSecret':config[_0x9509('0xc')]?config[_0x9509('0xc')][_0x9509('0x12')]:_0x9509('0x13'),'callbackURL':config[_0x9509('0xc')]?config[_0x9509('0xc')][_0x9509('0x14')]:''},function(_0x15efc8,_0x470836,_0xa19a51,_0x5ced88){var _0x133e2b,_0x24b6f9;return db[_0x9509('0x15')][_0x9509('0x16')]({'where':{'id':0x1},'attributes':[_0x9509('0x17'),_0x9509('0x18')],'raw':!![]})['then'](function(_0x4e404f){_0x133e2b=_0x4e404f;return db['User'][_0x9509('0x19')]({'where':{'email':_[_0x9509('0x1a')](_0xa19a51['emails'],_0x9509('0x1b')),'role':{'$or':[_0x9509('0x1c'),_0x9509('0x1d'),'agent']}}});})[_0x9509('0x1e')](function(_0x245f5e){_0x24b6f9=_0x245f5e;if(_0x24b6f9){if(_0x24b6f9[_0x9509('0x1f')]){return _0x5ced88('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x133e2b[_0x9509('0x18')]>0x0){if(_0x24b6f9[_0x9509('0x20')]){if(moment(_0x24b6f9['blockedAt'])[_0x9509('0x21')](_0x133e2b[_0x9509('0x18')],_0x9509('0x22'))>moment()){return _0x5ced88(_0x9509('0x23'));}else{return utils['clearBlockUser'](_0x24b6f9,0x0,![],null)[_0x9509('0x1e')](function(){return utils[_0x9509('0x24')](_0x24b6f9);})[_0x9509('0x1e')](function(){return _0x5ced88(null,_0x24b6f9);});}}else{return utils[_0x9509('0x24')](_0x24b6f9)[_0x9509('0x1e')](function(){return _0x5ced88(null,_0x24b6f9);});}}else{return utils['getLicense'](_0x24b6f9)['then'](function(){return _0x5ced88(null,_0x24b6f9);});}}return _0x5ced88(_0x9509('0x23'));})[_0x9509('0x25')](function(_0x47e69b){_0x5ced88(_0x47e69b);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index f05d5ca..029b5f5 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 _0xdb76=['get','login','/callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js'];(function(_0xd21fe7,_0x225a39){var _0x14d570=function(_0x3c0674){while(--_0x3c0674){_0xd21fe7['push'](_0xd21fe7['shift']());}};_0x14d570(++_0x225a39);}(_0xdb76,0x1be));var _0x6db7=function(_0x1feaed,_0x23e5dd){_0x1feaed=_0x1feaed-0x0;var _0x5f2d3e=_0xdb76[_0x1feaed];return _0x5f2d3e;};'use strict';var express=require(_0x6db7('0x0'));var passport=require(_0x6db7('0x1'));var router=express[_0x6db7('0x2')]();var controller=require(_0x6db7('0x3'));var userController=require(_0x6db7('0x4'));var authService=require('../../components/auth/service');router[_0x6db7('0x5')]('/',controller[_0x6db7('0x6')]);router[_0x6db7('0x5')](_0x6db7('0x7'),controller['callback'],authService[_0x6db7('0x8')],userController[_0x6db7('0x6')],authService[_0x6db7('0x9')]);module[_0x6db7('0xa')]=router; \ No newline at end of file +var _0xa631=['../../components/auth/service','get','/callback','callback','passport','Router','./authGoogle.controller'];(function(_0x24437e,_0x4b122b){var _0x2f3244=function(_0x588fd7){while(--_0x588fd7){_0x24437e['push'](_0x24437e['shift']());}};_0x2f3244(++_0x4b122b);}(_0xa631,0xe4));var _0x1a63=function(_0x1930d0,_0x4782a5){_0x1930d0=_0x1930d0-0x0;var _0x441fd6=_0xa631[_0x1930d0];return _0x441fd6;};'use strict';var express=require('express');var passport=require(_0x1a63('0x0'));var router=express[_0x1a63('0x1')]();var controller=require(_0x1a63('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0x1a63('0x3'));router['get']('/',controller['login']);router[_0x1a63('0x4')](_0x1a63('0x5'),controller[_0x1a63('0x6')],authService['isMiddleware'],userController['login'],authService['setTokenCookie']);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 bb0c5a0..4e00b26 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 _0x7278=['../../mysqldb','../../components/auth/service','../../config/utils','client','http','blockDuration','then','findOne','name','password','salt','role','blocked','blockedAt','loginAttempts','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','allowedLoginAttempts','add','clearBlockUser','getLicense','catch','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','previousPasswords','validatePasswordHistory','passwordHistoryLimit','resetPasswordToken','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','randomstring','moment'];(function(_0x5d6335,_0xa7acbd){var _0x200f4a=function(_0x2192ae){while(--_0x2192ae){_0x5d6335['push'](_0x5d6335['shift']());}};_0x200f4a(++_0xa7acbd);}(_0x7278,0x161));var _0x8727=function(_0x656484,_0x5c83e6){_0x656484=_0x656484-0x0;var _0xe08f14=_0x7278[_0x656484];return _0xe08f14;};'use strict';var util=require(_0x8727('0x0'));var passport=require(_0x8727('0x1'));var LocalStrategy=require(_0x8727('0x2'))[_0x8727('0x3')];var jayson=require(_0x8727('0x4'));var _=require('lodash');var rs=require(_0x8727('0x5'));var moment=require(_0x8727('0x6'));var db=require(_0x8727('0x7'))['db'];var authService=require(_0x8727('0x8'));var utils=require(_0x8727('0x9'));var client=jayson[_0x8727('0xa')][_0x8727('0xb')]({'port':0x232b});function localAuthenticate(_0x5549d5,_0xfd1902,_0x2f491c,_0xffd783){var _0x435911,_0x4160c3;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x8727('0xc')],'raw':!![]})[_0x8727('0xd')](function(_0x3a6c9b){_0x435911=_0x3a6c9b;return _0x5549d5[_0x8727('0xe')]({'attributes':['id',_0x8727('0xf'),_0x8727('0x10'),_0x8727('0x11'),_0x8727('0x12'),'disabled',_0x8727('0x13'),_0x8727('0x14'),_0x8727('0x15')],'where':{'name':_0xfd1902,'role':{'$or':['admin',_0x8727('0x16'),_0x8727('0x17')]}}});})['then'](function(_0xbcde13){if(!_0xbcde13||_0xbcde13&&_0xbcde13[_0x8727('0xf')]!==_0xfd1902){throw new Error(_0x8727('0x18'));}else{_0x4160c3=_0xbcde13;return _0x4160c3;}})[_0x8727('0xd')](function(){_0x4160c3[_0x8727('0x19')](_0x2f491c,function(_0x3d84db,_0x3865e9){var _0x1916f7=_0x4160c3[_0x8727('0x15')]+0x1;if(_0x3d84db){return _0xffd783(_0x3d84db);}else if(!_0x3865e9){if(_0x4160c3[_0x8727('0x1a')]){return _0xffd783(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x435911[_0x8727('0x1b')]>0x0){if(_0x4160c3[_0x8727('0x13')]){if(_0x435911[_0x8727('0xc')]>0x0){if(moment(_0x4160c3[_0x8727('0x14')])[_0x8727('0x1c')](_0x435911[_0x8727('0xc')],'minutes')>moment()){return _0xffd783(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x8727('0x1d')](_0x4160c3,_0x1916f7,![],null)['then'](function(){return _0xffd783(null,![],{'message':_0x8727('0x18')});});}}else{return _0xffd783(null,![],{'message':_0x8727('0x18')});}}else{if(_0x1916f7>=_0x435911[_0x8727('0x1b')]){return utils[_0x8727('0x1d')](_0x4160c3,0x0,!![],moment())[_0x8727('0xd')](function(){return _0xffd783(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x8727('0x1d')](_0x4160c3,_0x1916f7,![],null)[_0x8727('0xd')](function(){return _0xffd783(null,![],{'message':_0x8727('0x18')});});}}}else{return _0xffd783(null,![],{'message':_0x8727('0x18')});}}else{if(_0x4160c3[_0x8727('0x1a')]){return _0xffd783(null,![],{'message':_0x8727('0x18')});}else if(_0x435911[_0x8727('0x1b')]>0x0){if(_0x4160c3[_0x8727('0x13')]){if(_0x435911[_0x8727('0xc')]>0x0){if(moment(_0x4160c3[_0x8727('0x14')])[_0x8727('0x1c')](_0x435911[_0x8727('0xc')],'minutes')>moment()){return _0xffd783(null,![],{'message':_0x8727('0x18')});}else{return utils[_0x8727('0x1d')](_0x4160c3,0x0,![],null)['then'](function(){return utils['getLicense'](_0x4160c3);})[_0x8727('0xd')](function(){return _0xffd783(null,_0x4160c3);});}}else{return _0xffd783(null,![],{'message':_0x8727('0x18')});}}else{return utils[_0x8727('0x1d')](_0x4160c3,0x0,![],null)['then'](function(){return utils[_0x8727('0x1e')](_0x4160c3);})[_0x8727('0xd')](function(){return _0xffd783(null,_0x4160c3);})[_0x8727('0x1f')](function(_0x440ff5){return _0xffd783(null,![],_0x440ff5);});}}else{if(_0x4160c3[_0x8727('0x13')]){return _0xffd783(null,![],{'message':_0x8727('0x18')});}else{return utils[_0x8727('0x1e')](_0x4160c3)[_0x8727('0xd')](function(){return _0xffd783(null,_0x4160c3);});}}}});})['catch'](function(_0x243f15){return _0xffd783(null,![],_0x243f15);});}function sendServiceMail(_0x307055){return db['MailAccount'][_0x8727('0x20')]({'where':{'service':!![]},'attributes':['id',_0x8727('0xf'),_0x8727('0x21')],'include':[{'model':db[_0x8727('0x22')],'as':_0x8727('0x23')}]})[_0x8727('0xd')](function(_0x57733d){if(!_0x57733d){throw new Error(_0x8727('0x24'));}var _0x563201={'tls':{'rejectUnauthorized':![]}};if(_0x57733d[_0x8727('0x23')]['service']){_0x563201[_0x8727('0x25')]=_0x57733d[_0x8727('0x23')][_0x8727('0x25')];}else{_0x563201[_0x8727('0x26')]=_0x57733d[_0x8727('0x23')][_0x8727('0x26')];_0x563201[_0x8727('0x27')]=_0x57733d['Smtp'][_0x8727('0x27')];_0x563201[_0x8727('0x28')]=_0x57733d[_0x8727('0x23')][_0x8727('0x28')];}if(_0x57733d[_0x8727('0x23')][_0x8727('0x29')]){_0x563201[_0x8727('0x2a')]={'user':_0x57733d[_0x8727('0x23')][_0x8727('0x16')],'pass':_0x57733d[_0x8727('0x23')][_0x8727('0x2b')]};}var _0x184905={'account':_0x563201,'message':_['merge']({'from':util['format'](_0x8727('0x2c'),_0x57733d[_0x8727('0xf')],_0x57733d[_0x8727('0x21')]||_0x57733d[_0x8727('0x23')]['user'])},_0x307055)};return client[_0x8727('0x2d')](_0x8727('0x2e'),_0x184905);})[_0x8727('0xd')](function(_0x26c545){if(_0x26c545[_0x8727('0x2f')]){throw new Error(util['format'](_0x8727('0x30'),_0x26c545[_0x8727('0x2f')][_0x8727('0x31')]||JSON[_0x8727('0x32')](_0x26c545[_0x8727('0x2f')])));}return!![];});}function handleError(_0x3b1022,_0x27b950,_0x30c0d0){return _0x3b1022[_0x8727('0x33')](_0x27b950||0x1f4)[_0x8727('0x34')]({'message':_0x30c0d0?_0x30c0d0[_0x8727('0x31')]||_0x30c0d0:''});}exports[_0x8727('0x35')]=function(_0x5e1ea1,_0x51c66d,_0x792419){passport[_0x8727('0x19')](_0x8727('0x36'),function(_0x703078,_0x2c60b0,_0x308035){var _0x41b08e=_0x703078||_0x308035;if(_0x41b08e){return handleError(_0x51c66d,0x191,_0x41b08e);}if(!_0x2c60b0){return handleError(_0x51c66d,0x194,{'message':_0x8727('0x37')});}else{var _0x2a1bd8={'payload':{'id':_0x2c60b0['id'],'role':_0x2c60b0[_0x8727('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0x8727('0x38')](_0x2a1bd8)[_0x8727('0xd')](function(_0x7e3454){_0x51c66d['json']({'id':_0x2c60b0['id'],'token':_0x7e3454,'statusCall':'','isAlreadyLogged':_0x2c60b0[_0x8727('0x39')]});});}})(_0x5e1ea1,_0x51c66d,_0x792419);};exports[_0x8727('0x3a')]=function(_0x19d08a,_0x4ac9d2,_0x2a506f){if(!_0x19d08a[_0x8727('0x3b')][_0x8727('0x21')]){return handleError(_0x4ac9d2,0x1f4,{'message':_0x8727('0x3c')});}var _0x57817f=rs[_0x8727('0x3d')]();_0x19d08a[_0x8727('0x3b')][_0x8727('0x21')]=_0x19d08a[_0x8727('0x3b')][_0x8727('0x21')][_0x8727('0x3e')]()[_0x8727('0x3f')]();var _0x15b764;return db[_0x8727('0x40')][_0x8727('0xe')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x8727('0xc')],'raw':!![]})[_0x8727('0xd')](function(_0x21bfe8){_0x15b764=_0x21bfe8;return db[_0x8727('0x41')][_0x8727('0x20')]({'where':{'email':_0x19d08a['body'][_0x8727('0x21')]}});})[_0x8727('0xd')](function(_0x116e05){if(!_0x116e05){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x116e05[_0x8727('0x1a')]){throw new Error(_0x8727('0x42'));}if(_0x116e05[_0x8727('0x13')]){if(moment(_0x116e05[_0x8727('0x14')])[_0x8727('0x1c')](_0x15b764[_0x8727('0xc')],'minutes')>moment()){throw new Error(_0x8727('0x43'));}else{_0x116e05[_0x8727('0x13')]=![];_0x116e05[_0x8727('0x14')]=null;}}_0x116e05['resetPasswordToken']=_0x57817f;_0x116e05[_0x8727('0x44')]=Date[_0x8727('0x45')]()+0x36ee80;return _0x116e05[_0x8727('0x46')]();})[_0x8727('0xd')](function(){return sendServiceMail({'to':_0x19d08a[_0x8727('0x3b')][_0x8727('0x21')],'subject':_0x8727('0x47'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x8727('0x48')+_0x8727('0x49')+_0x19d08a[_0x8727('0x4a')][_0x8727('0x26')]+_0x8727('0x4b')+_0x57817f+'\x0a\x0a'+_0x8727('0x4c')});})[_0x8727('0xd')](function(){_0x4ac9d2['status'](0xc8)[_0x8727('0x34')]({'message':_0x8727('0x4d')});})[_0x8727('0x1f')](function(_0x5d6c81){return handleError(_0x4ac9d2,0x1f4,_0x5d6c81);});};exports[_0x8727('0x4e')]=function(_0x22cd31,_0x24fd60,_0x4367e8){return db[_0x8727('0x41')][_0x8727('0x20')]({'where':{'resetPasswordToken':_0x22cd31[_0x8727('0x4f')]['token'],'resetPasswordExpires':{'$gt':Date[_0x8727('0x45')]()}}})['then'](function(_0x207893){if(!_0x207893){throw new Error(_0x8727('0x50'));}return db['Setting'][_0x8727('0xe')]({'attributes':['id',_0x8727('0x51'),_0x8727('0x52'),'passwordHistoryLimit']})['then'](function(_0x13f70f){if(_0x13f70f[_0x8727('0x51')])authService[_0x8727('0x53')](_0x22cd31['body'][_0x8727('0x10')]);if(!_0x13f70f[_0x8727('0x52')]||!_0x207893[_0x8727('0x54')])return _0x207893;authService[_0x8727('0x55')](_0x22cd31[_0x8727('0x3b')][_0x8727('0x10')],_0x207893[_0x8727('0x54')],_0x13f70f[_0x8727('0x56')]);return _0x207893;})['then'](function(){_0x207893[_0x8727('0x10')]=_0x22cd31[_0x8727('0x3b')][_0x8727('0x10')];_0x207893[_0x8727('0x57')]=null;_0x207893['resetPasswordExpires']=null;return _0x207893[_0x8727('0x46')]();});})[_0x8727('0xd')](function(){_0x24fd60[_0x8727('0x33')](0xc8)[_0x8727('0x34')]({'message':_0x8727('0x58')});})[_0x8727('0x1f')](function(_0x28b9c0){return handleError(_0x24fd60,0x1f4,_0x28b9c0);});};passport[_0x8727('0x59')](new LocalStrategy({'usernameField':'name','passwordField':_0x8727('0x10')},function(_0x291b3e,_0x168953,_0x47a9f0){return localAuthenticate(db[_0x8727('0x41')],_0x291b3e,_0x168953,_0x47a9f0);})); \ No newline at end of file +var _0x01d9=['You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport','passport-local','Strategy','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','Setting','findOne','allowedLoginAttempts','blockDuration','then','password','role','disabled','blocked','blockedAt','loginAttempts','user','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','catch','MailAccount','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','message','stringify','status','send','login','local','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','User','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x901d('0x0'));var passport=require(_0x901d('0x1'));var LocalStrategy=require(_0x901d('0x2'))[_0x901d('0x3')];var jayson=require('jayson/promise');var _=require(_0x901d('0x4'));var rs=require(_0x901d('0x5'));var moment=require(_0x901d('0x6'));var db=require(_0x901d('0x7'))['db'];var authService=require(_0x901d('0x8'));var utils=require(_0x901d('0x9'));var client=jayson[_0x901d('0xa')]['http']({'port':0x232b});function localAuthenticate(_0x1e5d7d,_0x6c9ac8,_0x21e1d7,_0x12c39f){var _0x313f85,_0x39fc94;return db[_0x901d('0xb')][_0x901d('0xc')]({'where':{'id':0x1},'attributes':[_0x901d('0xd'),_0x901d('0xe')],'raw':!![]})[_0x901d('0xf')](function(_0xd819f0){_0x313f85=_0xd819f0;return _0x1e5d7d[_0x901d('0xc')]({'attributes':['id','name',_0x901d('0x10'),'salt',_0x901d('0x11'),_0x901d('0x12'),_0x901d('0x13'),_0x901d('0x14'),_0x901d('0x15')],'where':{'name':_0x6c9ac8,'role':{'$or':['admin',_0x901d('0x16'),_0x901d('0x17')]}}});})[_0x901d('0xf')](function(_0x1618a8){if(!_0x1618a8||_0x1618a8&&_0x1618a8[_0x901d('0x18')]!==_0x6c9ac8){throw new Error(_0x901d('0x19'));}else{_0x39fc94=_0x1618a8;return _0x39fc94;}})['then'](function(){_0x39fc94[_0x901d('0x1a')](_0x21e1d7,function(_0x13903c,_0x11b0cc){var _0x17d451=_0x39fc94[_0x901d('0x15')]+0x1;if(_0x13903c){return _0x12c39f(_0x13903c);}else if(!_0x11b0cc){if(_0x39fc94[_0x901d('0x12')]){return _0x12c39f(null,![],{'message':_0x901d('0x19')});}else if(_0x313f85[_0x901d('0xd')]>0x0){if(_0x39fc94[_0x901d('0x13')]){if(_0x313f85[_0x901d('0xe')]>0x0){if(moment(_0x39fc94[_0x901d('0x14')])[_0x901d('0x1b')](_0x313f85[_0x901d('0xe')],_0x901d('0x1c'))>moment()){return _0x12c39f(null,![],{'message':_0x901d('0x19')});}else{return utils[_0x901d('0x1d')](_0x39fc94,_0x17d451,![],null)[_0x901d('0xf')](function(){return _0x12c39f(null,![],{'message':_0x901d('0x19')});});}}else{return _0x12c39f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x17d451>=_0x313f85[_0x901d('0xd')]){return utils[_0x901d('0x1d')](_0x39fc94,0x0,!![],moment())['then'](function(){return _0x12c39f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x39fc94,_0x17d451,![],null)['then'](function(){return _0x12c39f(null,![],{'message':_0x901d('0x19')});});}}}else{return _0x12c39f(null,![],{'message':_0x901d('0x19')});}}else{if(_0x39fc94['disabled']){return _0x12c39f(null,![],{'message':_0x901d('0x19')});}else if(_0x313f85[_0x901d('0xd')]>0x0){if(_0x39fc94['blocked']){if(_0x313f85[_0x901d('0xe')]>0x0){if(moment(_0x39fc94[_0x901d('0x14')])[_0x901d('0x1b')](_0x313f85[_0x901d('0xe')],_0x901d('0x1c'))>moment()){return _0x12c39f(null,![],{'message':_0x901d('0x19')});}else{return utils[_0x901d('0x1d')](_0x39fc94,0x0,![],null)[_0x901d('0xf')](function(){return utils['getLicense'](_0x39fc94);})[_0x901d('0xf')](function(){return _0x12c39f(null,_0x39fc94);});}}else{return _0x12c39f(null,![],{'message':_0x901d('0x19')});}}else{return utils[_0x901d('0x1d')](_0x39fc94,0x0,![],null)[_0x901d('0xf')](function(){return utils['getLicense'](_0x39fc94);})[_0x901d('0xf')](function(){return _0x12c39f(null,_0x39fc94);})[_0x901d('0x1e')](function(_0x27f4ca){return _0x12c39f(null,![],_0x27f4ca);});}}else{if(_0x39fc94[_0x901d('0x13')]){return _0x12c39f(null,![],{'message':_0x901d('0x19')});}else{return utils['getLicense'](_0x39fc94)[_0x901d('0xf')](function(){return _0x12c39f(null,_0x39fc94);});}}}});})[_0x901d('0x1e')](function(_0x14976e){return _0x12c39f(null,![],_0x14976e);});}function sendServiceMail(_0x2f3ae9){return db[_0x901d('0x1f')][_0x901d('0x20')]({'where':{'service':!![]},'attributes':['id','name',_0x901d('0x21')],'include':[{'model':db['MailServerOut'],'as':_0x901d('0x22')}]})[_0x901d('0xf')](function(_0x20dbc5){if(!_0x20dbc5){throw new Error(_0x901d('0x23'));}var _0x1b1c17={'tls':{'rejectUnauthorized':![]}};if(_0x20dbc5[_0x901d('0x22')][_0x901d('0x24')]){_0x1b1c17[_0x901d('0x24')]=_0x20dbc5[_0x901d('0x22')][_0x901d('0x24')];}else{_0x1b1c17[_0x901d('0x25')]=_0x20dbc5[_0x901d('0x22')][_0x901d('0x25')];_0x1b1c17[_0x901d('0x26')]=_0x20dbc5[_0x901d('0x22')]['port'];_0x1b1c17[_0x901d('0x27')]=_0x20dbc5[_0x901d('0x22')][_0x901d('0x27')];}if(_0x20dbc5['Smtp'][_0x901d('0x28')]){_0x1b1c17[_0x901d('0x29')]={'user':_0x20dbc5[_0x901d('0x22')][_0x901d('0x16')],'pass':_0x20dbc5[_0x901d('0x22')][_0x901d('0x2a')]};}var _0x41674c={'account':_0x1b1c17,'message':_[_0x901d('0x2b')]({'from':util[_0x901d('0x2c')](_0x901d('0x2d'),_0x20dbc5['name'],_0x20dbc5['email']||_0x20dbc5[_0x901d('0x22')]['user'])},_0x2f3ae9)};return client[_0x901d('0x2e')](_0x901d('0x2f'),_0x41674c);})['then'](function(_0x3716fa){if(_0x3716fa[_0x901d('0x30')]){throw new Error(util[_0x901d('0x2c')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x3716fa[_0x901d('0x30')][_0x901d('0x31')]||JSON[_0x901d('0x32')](_0x3716fa[_0x901d('0x30')])));}return!![];});}function handleError(_0x37bd5b,_0x32aa29,_0x20b002){return _0x37bd5b[_0x901d('0x33')](_0x32aa29||0x1f4)[_0x901d('0x34')]({'message':_0x20b002?_0x20b002[_0x901d('0x31')]||_0x20b002:''});}exports[_0x901d('0x35')]=function(_0x3d4f8b,_0x27b101,_0x3a6b5f){passport[_0x901d('0x1a')](_0x901d('0x36'),function(_0x54a654,_0x458c9b,_0x423cab){var _0x5abca2=_0x54a654||_0x423cab;if(_0x5abca2){return handleError(_0x27b101,0x191,_0x5abca2);}if(!_0x458c9b){return handleError(_0x27b101,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x28725d={'payload':{'id':_0x458c9b['id'],'role':_0x458c9b['role']},'options':{'expiresIn':0x15180}};return authService[_0x901d('0x37')](_0x28725d)[_0x901d('0xf')](function(_0x4bebe){_0x27b101[_0x901d('0x38')]({'id':_0x458c9b['id'],'token':_0x4bebe,'statusCall':'','isAlreadyLogged':_0x458c9b[_0x901d('0x39')]});});}})(_0x3d4f8b,_0x27b101,_0x3a6b5f);};exports[_0x901d('0x3a')]=function(_0x5df4cb,_0x4ce6e4,_0x4ee804){if(!_0x5df4cb['body'][_0x901d('0x21')]){return handleError(_0x4ce6e4,0x1f4,{'message':_0x901d('0x3b')});}var _0x5775eb=rs[_0x901d('0x3c')]();_0x5df4cb[_0x901d('0x3d')]['email']=_0x5df4cb[_0x901d('0x3d')][_0x901d('0x21')][_0x901d('0x3e')]()[_0x901d('0x3f')]();var _0x53663d;return db['Setting'][_0x901d('0xc')]({'where':{'id':0x1},'attributes':[_0x901d('0xd'),_0x901d('0xe')],'raw':!![]})[_0x901d('0xf')](function(_0x2a4c41){_0x53663d=_0x2a4c41;return db[_0x901d('0x40')][_0x901d('0x20')]({'where':{'email':_0x5df4cb[_0x901d('0x3d')][_0x901d('0x21')]}});})[_0x901d('0xf')](function(_0x31be2d){if(!_0x31be2d){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x31be2d[_0x901d('0x12')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x31be2d[_0x901d('0x13')]){if(moment(_0x31be2d['blockedAt'])[_0x901d('0x1b')](_0x53663d['blockDuration'],_0x901d('0x1c'))>moment()){throw new Error(_0x901d('0x41'));}else{_0x31be2d[_0x901d('0x13')]=![];_0x31be2d[_0x901d('0x14')]=null;}}_0x31be2d[_0x901d('0x42')]=_0x5775eb;_0x31be2d[_0x901d('0x43')]=Date[_0x901d('0x44')]()+0x36ee80;return _0x31be2d[_0x901d('0x45')]();})[_0x901d('0xf')](function(){return sendServiceMail({'to':_0x5df4cb[_0x901d('0x3d')][_0x901d('0x21')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x901d('0x46')+_0x901d('0x47')+_0x901d('0x48')+_0x5df4cb[_0x901d('0x49')][_0x901d('0x25')]+_0x901d('0x4a')+_0x5775eb+'\x0a\x0a'+_0x901d('0x4b')});})[_0x901d('0xf')](function(){_0x4ce6e4[_0x901d('0x33')](0xc8)[_0x901d('0x34')]({'message':_0x901d('0x4c')});})[_0x901d('0x1e')](function(_0x2cd965){return handleError(_0x4ce6e4,0x1f4,_0x2cd965);});};exports[_0x901d('0x4d')]=function(_0x4888e8,_0x505965,_0x3b85e3){return db[_0x901d('0x40')][_0x901d('0x20')]({'where':{'resetPasswordToken':_0x4888e8[_0x901d('0x4e')][_0x901d('0x4f')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x15b83a){if(!_0x15b83a){throw new Error(_0x901d('0x50'));}return db['Setting'][_0x901d('0xc')]({'attributes':['id',_0x901d('0x51'),'enforcePasswordHistory',_0x901d('0x52')]})['then'](function(_0x3d7c00){if(_0x3d7c00[_0x901d('0x51')])authService[_0x901d('0x53')](_0x4888e8[_0x901d('0x3d')]['password']);if(!_0x3d7c00[_0x901d('0x54')]||!_0x15b83a[_0x901d('0x55')])return _0x15b83a;authService[_0x901d('0x56')](_0x4888e8[_0x901d('0x3d')][_0x901d('0x10')],_0x15b83a[_0x901d('0x55')],_0x3d7c00[_0x901d('0x52')]);return _0x15b83a;})[_0x901d('0xf')](function(){_0x15b83a[_0x901d('0x10')]=_0x4888e8[_0x901d('0x3d')]['password'];_0x15b83a[_0x901d('0x42')]=null;_0x15b83a['resetPasswordExpires']=null;return _0x15b83a[_0x901d('0x45')]();});})[_0x901d('0xf')](function(){_0x505965[_0x901d('0x33')](0xc8)[_0x901d('0x34')]({'message':_0x901d('0x57')});})[_0x901d('0x1e')](function(_0x45c730){return handleError(_0x505965,0x1f4,_0x45c730);});};passport[_0x901d('0x58')](new LocalStrategy({'usernameField':'name','passwordField':_0x901d('0x10')},function(_0x3eeca4,_0x226b81,_0x4b7e88){return localAuthenticate(db[_0x901d('0x40')],_0x3eeca4,_0x226b81,_0x4b7e88);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index ca64e7f..afc81f9 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 _0xcc89=['/reset/:token','reset','exports','express','Router','post','login','/forgot'];(function(_0x3f94f9,_0x42774b){var _0x46f84f=function(_0xa080d8){while(--_0xa080d8){_0x3f94f9['push'](_0x3f94f9['shift']());}};_0x46f84f(++_0x42774b);}(_0xcc89,0x19b));var _0x9cc8=function(_0x2962a4,_0x38ce64){_0x2962a4=_0x2962a4-0x0;var _0x53d872=_0xcc89[_0x2962a4];return _0x53d872;};'use strict';var express=require(_0x9cc8('0x0'));var router=express[_0x9cc8('0x1')]();var controller=require('./authLocal.controller');router[_0x9cc8('0x2')]('/',controller[_0x9cc8('0x3')]);router[_0x9cc8('0x2')](_0x9cc8('0x4'),controller['forgot']);router['post'](_0x9cc8('0x5'),controller[_0x9cc8('0x6')]);module[_0x9cc8('0x7')]=router; \ No newline at end of file +var _0x59c9=['post','login','/forgot','forgot','exports','express','Router','./authLocal.controller'];(function(_0x461997,_0xf38fb8){var _0x43023a=function(_0x3b531c){while(--_0x3b531c){_0x461997['push'](_0x461997['shift']());}};_0x43023a(++_0xf38fb8);}(_0x59c9,0x125));var _0x959c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x59c9[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x959c('0x0'));var router=express[_0x959c('0x1')]();var controller=require(_0x959c('0x2'));router[_0x959c('0x3')]('/',controller[_0x959c('0x4')]);router[_0x959c('0x3')](_0x959c('0x5'),controller[_0x959c('0x6')]);router[_0x959c('0x3')]('/reset/:token',controller['reset']);module[_0x959c('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 b8637b1..8cc6d73 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 _0x8aca=['INTEGER','exports','STRING','BOOLEAN'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x8aca,0x15d));var _0xa8ac=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0x8aca[_0x4eafed];return _0x159c85;};'use strict';var Sequelize=require('sequelize');module[_0xa8ac('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0xa8ac('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xa8ac('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xa8ac('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x3d3b=['exports','BOOLEAN'];(function(_0x259ba0,_0xac3460){var _0x5e6c8d=function(_0x4241b4){while(--_0x4241b4){_0x259ba0['push'](_0x259ba0['shift']());}};_0x5e6c8d(++_0xac3460);}(_0x3d3b,0x14c));var _0xb3d3=function(_0x3ac769,_0x2825df){_0x3ac769=_0x3ac769-0x0;var _0x2185eb=_0x3d3b[_0x3ac769];return _0x2185eb;};'use strict';var Sequelize=require('sequelize');module[_0xb3d3('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xb3d3('0x1')],'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 820ef56..4d861f5 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(_0x156303,_0x39b5dc){var _0x3bf9af=function(_0x46fee9){while(--_0x46fee9){_0x156303['push'](_0x156303['shift']());}};_0x3bf9af(++_0x39b5dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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(_0x1b25d9,_0x3833a8){var _0x1cee33=function(_0x197256){while(--_0x197256){_0x1b25d9['push'](_0x1b25d9['shift']());}};_0x1cee33(++_0x3833a8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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 6f94017..a042365 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 _0x6918=['exports','define','Automation','tools_automations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x6918,0xc8));var _0x8691=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6918[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x8691('0x0'));var logger=require(_0x8691('0x1'))(_0x8691('0x2'));var moment=require(_0x8691('0x3'));var BPromise=require(_0x8691('0x4'));var rp=require(_0x8691('0x5'));var fs=require('fs');var path=require(_0x8691('0x6'));var rimraf=require(_0x8691('0x7'));var config=require(_0x8691('0x8'));var attributes=require(_0x8691('0x9'));module[_0x8691('0xa')]=function(_0x49a440,_0x4a5f14){return _0x49a440[_0x8691('0xb')](_0x8691('0xc'),attributes,{'tableName':_0x8691('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb50c=['exports','Automation','tools_automations','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./automation.attributes'];(function(_0x2b0e6c,_0x5834d9){var _0x501185=function(_0x3e62ca){while(--_0x3e62ca){_0x2b0e6c['push'](_0x2b0e6c['shift']());}};_0x501185(++_0x5834d9);}(_0xb50c,0x1bb));var _0xcb50=function(_0x49a8b5,_0x555b0b){_0x49a8b5=_0x49a8b5-0x0;var _0x2057a8=_0xb50c[_0x49a8b5];return _0x2057a8;};'use strict';var _=require(_0xcb50('0x0'));var util=require(_0xcb50('0x1'));var logger=require(_0xcb50('0x2'))('api');var moment=require('moment');var BPromise=require(_0xcb50('0x3'));var rp=require(_0xcb50('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcb50('0x5'));var config=require(_0xcb50('0x6'));var attributes=require(_0xcb50('0x7'));module[_0xcb50('0x8')]=function(_0x144411,_0x59fbb9){return _0x144411['define'](_0xcb50('0x9'),attributes,{'tableName':_0xcb50('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index ad32d73..2177133 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 _0xe091=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment','randomstring'];(function(_0x256580,_0xc458ba){var _0x34ea2a=function(_0x18f383){while(--_0x18f383){_0x256580['push'](_0x256580['shift']());}};_0x34ea2a(++_0xc458ba);}(_0xe091,0x123));var _0x1e09=function(_0x40ee01,_0x485b90){_0x40ee01=_0x40ee01-0x0;var _0x4ea3e7=_0xe091[_0x40ee01];return _0x4ea3e7;};'use strict';var _=require(_0x1e09('0x0'));var util=require('util');var moment=require(_0x1e09('0x1'));var BPromise=require('bluebird');var rs=require(_0x1e09('0x2'));var fs=require('fs');var Redis=require(_0x1e09('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1e09('0x4'));var logger=require(_0x1e09('0x5'))(_0x1e09('0x6'));var config=require(_0x1e09('0x7'));var jayson=require(_0x1e09('0x8'));var client=jayson[_0x1e09('0x9')][_0x1e09('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x179ba5,_0x34826e,_0x4109d2){return new BPromise(function(_0x140a8e,_0x1e625c){return client[_0x1e09('0xb')](_0x179ba5,_0x4109d2)['then'](function(_0x4844f9){logger['info'](_0x1e09('0xc'),_0x34826e,_0x1e09('0xd'));logger['debug'](_0x1e09('0xe'),_0x34826e,_0x1e09('0xd'),JSON[_0x1e09('0xf')](_0x4844f9));if(_0x4844f9[_0x1e09('0x10')]){if(_0x4844f9[_0x1e09('0x10')][_0x1e09('0x11')]===0x1f4){logger['error'](_0x1e09('0xc'),_0x34826e,_0x4844f9[_0x1e09('0x10')][_0x1e09('0x12')]);return _0x1e625c(_0x4844f9[_0x1e09('0x10')][_0x1e09('0x12')]);}logger[_0x1e09('0x10')]('Automation,\x20%s,\x20%s',_0x34826e,_0x4844f9[_0x1e09('0x10')][_0x1e09('0x12')]);return _0x140a8e(_0x4844f9[_0x1e09('0x10')][_0x1e09('0x12')]);}else{logger[_0x1e09('0x13')](_0x1e09('0xc'),_0x34826e,_0x1e09('0xd'));_0x140a8e(_0x4844f9['result'][_0x1e09('0x12')]);}})[_0x1e09('0x14')](function(_0x1bee01){logger['error'](_0x1e09('0xc'),_0x34826e,_0x1bee01);_0x1e625c(_0x1bee01);});});} \ No newline at end of file +var _0x34d2=['../../config/utils','../../config/logger','jayson/promise','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','util','ioredis'];(function(_0x198fd7,_0x1aa9b1){var _0x574ead=function(_0x311fc3){while(--_0x311fc3){_0x198fd7['push'](_0x198fd7['shift']());}};_0x574ead(++_0x1aa9b1);}(_0x34d2,0x12a));var _0x234d=function(_0x1e7bee,_0x1ea264){_0x1e7bee=_0x1e7bee-0x0;var _0x50beff=_0x34d2[_0x1e7bee];return _0x50beff;};'use strict';var _=require('lodash');var util=require(_0x234d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x234d('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x234d('0x2'));var logger=require(_0x234d('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x234d('0x4'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x31aa2c,_0x318ff0,_0x241af0){return new BPromise(function(_0x674ddc,_0x4e01ff){return client[_0x234d('0x5')](_0x31aa2c,_0x241af0)[_0x234d('0x6')](function(_0x1270a1){logger[_0x234d('0x7')](_0x234d('0x8'),_0x318ff0,_0x234d('0x9'));logger[_0x234d('0xa')]('Automation,\x20%s,\x20%s,\x20%s',_0x318ff0,'request\x20sent',JSON['stringify'](_0x1270a1));if(_0x1270a1[_0x234d('0xb')]){if(_0x1270a1['error'][_0x234d('0xc')]===0x1f4){logger[_0x234d('0xb')](_0x234d('0x8'),_0x318ff0,_0x1270a1[_0x234d('0xb')]['message']);return _0x4e01ff(_0x1270a1[_0x234d('0xb')][_0x234d('0xd')]);}logger['error'](_0x234d('0x8'),_0x318ff0,_0x1270a1[_0x234d('0xb')][_0x234d('0xd')]);return _0x674ddc(_0x1270a1[_0x234d('0xb')]['message']);}else{logger['info'](_0x234d('0x8'),_0x318ff0,_0x234d('0x9'));_0x674ddc(_0x1270a1[_0x234d('0xe')][_0x234d('0xd')]);}})['catch'](function(_0x2a487c){logger['error'](_0x234d('0x8'),_0x318ff0,_0x2a487c);_0x4e01ff(_0x2a487c);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index f4aa6d3..c827a2d 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 _0xb51d=['getActions','post','create','addConditions','addActions','put','/:id','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/conditions','/:id/actions'];(function(_0x65455c,_0x11d8be){var _0x5a251c=function(_0x56c5d2){while(--_0x56c5d2){_0x65455c['push'](_0x65455c['shift']());}};_0x5a251c(++_0x11d8be);}(_0xb51d,0x159));var _0xdb51=function(_0x3ed976,_0x20ebe0){_0x3ed976=_0x3ed976-0x0;var _0x44fa29=_0xb51d[_0x3ed976];return _0x44fa29;};'use strict';var multer=require('multer');var util=require(_0xdb51('0x0'));var path=require('path');var timeout=require(_0xdb51('0x1'));var express=require(_0xdb51('0x2'));var router=express[_0xdb51('0x3')]();var auth=require(_0xdb51('0x4'));var interaction=require(_0xdb51('0x5'));var config=require(_0xdb51('0x6'));var controller=require('./automation.controller');router[_0xdb51('0x7')]('/',auth[_0xdb51('0x8')](),controller[_0xdb51('0x9')]);router['get']('/:id',auth[_0xdb51('0x8')](),controller['show']);router['get'](_0xdb51('0xa'),auth[_0xdb51('0x8')](),controller['getConditions']);router[_0xdb51('0x7')](_0xdb51('0xb'),auth[_0xdb51('0x8')](),controller[_0xdb51('0xc')]);router[_0xdb51('0xd')]('/',auth[_0xdb51('0x8')](),controller[_0xdb51('0xe')]);router['post'](_0xdb51('0xa'),auth[_0xdb51('0x8')](),controller[_0xdb51('0xf')]);router[_0xdb51('0xd')](_0xdb51('0xb'),auth['isAuthenticated'](),controller[_0xdb51('0x10')]);router[_0xdb51('0x11')](_0xdb51('0x12'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xdb51('0x12'),auth[_0xdb51('0x8')](),controller[_0xdb51('0x13')]);module[_0xdb51('0x14')]=router; \ No newline at end of file +var _0x3a22=['getActions','post','create','addConditions','addActions','put','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./automation.controller','get','/:id','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions'];(function(_0x5f2901,_0x57545b){var _0x361957=function(_0x52caf8){while(--_0x52caf8){_0x5f2901['push'](_0x5f2901['shift']());}};_0x361957(++_0x57545b);}(_0x3a22,0xa9));var _0x23a2=function(_0x324a59,_0x13440f){_0x324a59=_0x324a59-0x0;var _0x4b6571=_0x3a22[_0x324a59];return _0x4b6571;};'use strict';var multer=require(_0x23a2('0x0'));var util=require('util');var path=require(_0x23a2('0x1'));var timeout=require(_0x23a2('0x2'));var express=require(_0x23a2('0x3'));var router=express[_0x23a2('0x4')]();var auth=require(_0x23a2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x23a2('0x6'));var controller=require(_0x23a2('0x7'));router[_0x23a2('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x23a2('0x9'),auth[_0x23a2('0xa')](),controller[_0x23a2('0xb')]);router[_0x23a2('0x8')](_0x23a2('0xc'),auth[_0x23a2('0xa')](),controller[_0x23a2('0xd')]);router[_0x23a2('0x8')](_0x23a2('0xe'),auth[_0x23a2('0xa')](),controller[_0x23a2('0xf')]);router[_0x23a2('0x10')]('/',auth['isAuthenticated'](),controller[_0x23a2('0x11')]);router['post'](_0x23a2('0xc'),auth[_0x23a2('0xa')](),controller[_0x23a2('0x12')]);router[_0x23a2('0x10')](_0x23a2('0xe'),auth[_0x23a2('0xa')](),controller[_0x23a2('0x13')]);router[_0x23a2('0x14')](_0x23a2('0x9'),auth[_0x23a2('0xa')](),controller['update']);router[_0x23a2('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x23a2('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 0e5526e..e325a5e 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 _0xb270=['#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words'];(function(_0x409a12,_0x440ec8){var _0x585ce5=function(_0x5601ac){while(--_0x5601ac){_0x409a12['push'](_0x409a12['shift']());}};_0x585ce5(++_0x440ec8);}(_0xb270,0x182));var _0x0b27=function(_0xac72f7,_0x237a87){_0xac72f7=_0xac72f7-0x0;var _0x5b1c13=_0xb270[_0xac72f7];return _0x5b1c13;};'use strict';var Sequelize=require(_0x0b27('0x0'));module['exports']={'name':{'type':Sequelize[_0x0b27('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x0b27('0x2')](_0x0b27('0x3')),'allowNull':![],'defaultValue':_0x0b27('0x3')},'description':{'type':Sequelize[_0x0b27('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x0b27('0x4')},'limitCalls':{'type':Sequelize[_0x0b27('0x5')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0b27('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0b27('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x0b27('0x5')](0x3)[_0x0b27('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x0b27('0x5')](0x3)[_0x0b27('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0b27('0x7')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0b27('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0b27('0x8')},'dialBusyMaxRetry':{'type':Sequelize[_0x0b27('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x0b27('0x5')](0x5)[_0x0b27('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0b27('0x9')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0b27('0x5')](0x3)[_0x0b27('0x6')],'defaultValue':0x3,'comment':_0x0b27('0xa')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0b27('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0b27('0xb')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0b27('0x5')](0x3)[_0x0b27('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0b27('0xc')},'dialTimezone':{'type':Sequelize[_0x0b27('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0b27('0x1')],'defaultValue':_0x0b27('0xd')},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always','never',_0x0b27('0xe')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x0b27('0xf')],'defaultValue':0x0,'comment':_0x0b27('0x10')},'dialAMDInitialSilence':{'type':Sequelize[_0x0b27('0x5')](0x9)[_0x0b27('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0b27('0x11')},'dialAMDGreeting':{'type':Sequelize[_0x0b27('0x5')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0b27('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0b27('0x5')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0b27('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0b27('0x5')](0x9)[_0x0b27('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x0b27('0x5')](0x9)[_0x0b27('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0b27('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0b27('0x5')](0x9)[_0x0b27('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0b27('0x5')](0x9)[_0x0b27('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0b27('0x15')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0b27('0x5')](0x5)[_0x0b27('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0b27('0x16')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0b27('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x0b27('0x2')]('DESC','ASC'),'defaultValue':_0x0b27('0x17')},'dialPrefix':{'type':Sequelize[_0x0b27('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0b27('0x5')](0x3)[_0x0b27('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0b27('0x18')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0b27('0x19')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0b27('0x5')](0x3)[_0x0b27('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0b27('0x1a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0b27('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x0b27('0x5')](0x3)[_0x0b27('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0b27('0x1b')},'dialDropRetryFrequency':{'type':Sequelize[_0x0b27('0x5')](0x5)[_0x0b27('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0b27('0x1c')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0b27('0x5')](0x3)[_0x0b27('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0b27('0x1d')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0b27('0x5')](0x5)[_0x0b27('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0b27('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0b27('0x1e')},'dialMachineRetryFrequency':{'type':Sequelize[_0x0b27('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0b27('0x1f')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0b27('0x5')](0x3)[_0x0b27('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0b27('0x20')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0b27('0x5')](0x5)[_0x0b27('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0b27('0x21')}}; \ No newline at end of file +var _0x62b4=['#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','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\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x62b4,0xa2));var _0x462b=function(_0x434b43,_0x2e0a0d){_0x434b43=_0x434b43-0x0;var _0x179ecc=_0x62b4[_0x434b43];return _0x179ecc;};'use strict';var Sequelize=require(_0x462b('0x0'));module[_0x462b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x462b('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x462b('0x3')](_0x462b('0x4')),'allowNull':![],'defaultValue':_0x462b('0x4')},'description':{'type':Sequelize[_0x462b('0x5')]},'active':{'type':Sequelize[_0x462b('0x6')],'defaultValue':0x0,'comment':_0x462b('0x7')},'limitCalls':{'type':Sequelize[_0x462b('0x8')](0x4)[_0x462b('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x462b('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0x462b('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x462b('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0x462b('0x8')](0x3)[_0x462b('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x462b('0xb')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x462b('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x462b('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x462b('0xd')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x462b('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x462b('0xe')},'dialBusyRetryFrequency':{'type':Sequelize[_0x462b('0x8')](0x5)[_0x462b('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x462b('0xf')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x462b('0x8')](0x3)[_0x462b('0x9')],'defaultValue':0x3,'comment':_0x462b('0x10')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x462b('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x462b('0x11')},'dialGlobalMaxRetry':{'type':Sequelize[_0x462b('0x8')](0x3)[_0x462b('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x462b('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x462b('0x12')},'dialCheckDuplicateType':{'type':Sequelize[_0x462b('0x3')](_0x462b('0x13'),_0x462b('0x14'),_0x462b('0x15')),'defaultValue':_0x462b('0x13')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x462b('0x8')](0x9)[_0x462b('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x462b('0x8')](0x9)[_0x462b('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x462b('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x462b('0x8')](0x9)[_0x462b('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x462b('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x462b('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0x462b('0x8')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x462b('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x462b('0x8')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x462b('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x462b('0x8')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x462b('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x462b('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x462b('0x8')](0x9)[_0x462b('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x462b('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0x462b('0x3')](_0x462b('0x1d'),_0x462b('0x1e')),'defaultValue':_0x462b('0x1d')},'dialPrefix':{'type':Sequelize[_0x462b('0x5')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x462b('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x462b('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x462b('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x462b('0x8')](0x3)[_0x462b('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x462b('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x462b('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0x462b('0x8')](0x3)[_0x462b('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x462b('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x462b('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x462b('0x8')](0x3)[_0x462b('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x462b('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x462b('0x8')](0x5)[_0x462b('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x462b('0x23')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x462b('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x462b('0x24')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x462b('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x462b('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x462b('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x462b('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x462b('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x462b('0x27')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 495010b..ff26ad6 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 _0x15d7=['eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','IvrCampaigns','UserProfileResource','end','error','stack','name','send','index','map','Campaign','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','show','params','rawAttributes','include','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','role','userProfileId','update','getHoppers','findOne','CmHopper','CampaignId','findAll','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','CampaignId\x20=\x20?','onlyIfOpen','cm_contacts','push','removeLists','getBlackLists','addBlackLists','cm_hopper_black','all','removeBlackLists','html-pdf'];(function(_0x1de0f8,_0xb4e238){var _0x529f11=function(_0x4c86b6){while(--_0x4c86b6){_0x1de0f8['push'](_0x1de0f8['shift']());}};_0x529f11(++_0xb4e238);}(_0x15d7,0x19d));var _0x715d=function(_0x108ab4,_0x1720ec){_0x108ab4=_0x108ab4-0x0;var _0x485b37=_0x15d7[_0x108ab4];return _0x485b37;};'use strict';var pdf=require(_0x715d('0x0'));var emlformat=require(_0x715d('0x1'));var rimraf=require(_0x715d('0x2'));var zipdir=require(_0x715d('0x3'));var jsonpatch=require(_0x715d('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x715d('0x5'));var Mustache=require(_0x715d('0x6'));var util=require(_0x715d('0x7'));var path=require(_0x715d('0x8'));var sox=require(_0x715d('0x9'));var csv=require(_0x715d('0xa'));var ejs=require(_0x715d('0xb'));var fs=require('fs');var _=require(_0x715d('0xc'));var squel=require(_0x715d('0xd'));var crypto=require(_0x715d('0xe'));var jsforce=require(_0x715d('0xf'));var deskjs=require(_0x715d('0x10'));var toCsv=require(_0x715d('0xa'));var querystring=require(_0x715d('0x11'));var Papa=require(_0x715d('0x12'));var Redis=require(_0x715d('0x13'));var authService=require(_0x715d('0x14'));var qs=require(_0x715d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x715d('0x16'))(_0x715d('0x17'));var utils=require('../../config/utils');var config=require(_0x715d('0x18'));var licenseUtil=require(_0x715d('0x19'));var db=require(_0x715d('0x1a'))['db'];function respondWithStatusCode(_0x48fcd0,_0x4e3279){_0x4e3279=_0x4e3279||0xcc;return function(_0x4fa67e){if(_0x4fa67e){return _0x48fcd0['sendStatus'](_0x4e3279);}return _0x48fcd0[_0x715d('0x1b')](_0x4e3279)['end']();};}function respondWithResult(_0x513de9,_0x2c1f5b){_0x2c1f5b=_0x2c1f5b||0xc8;return function(_0x58000f){if(_0x58000f){return _0x513de9[_0x715d('0x1b')](_0x2c1f5b)[_0x715d('0x1c')](_0x58000f);}};}function respondWithFilteredResult(_0x250d98,_0x735b9b){return function(_0x39cdb5){if(_0x39cdb5){var _0x2cc343=_0x39cdb5[_0x715d('0x1d')],_0x371103=_0x735b9b[_0x715d('0x1e')],_0x2d5b1b=_0x735b9b['offset']+_0x735b9b[_0x715d('0x1f')],_0x32943b;if(_0x2d5b1b>=_0x2cc343){_0x2d5b1b=_0x2cc343;_0x32943b=0xc8;}else{_0x32943b=0xce;}_0x250d98[_0x715d('0x1b')](_0x32943b);return _0x250d98[_0x715d('0x20')](_0x715d('0x21'),_0x371103+'-'+_0x2d5b1b+'/'+_0x2cc343)[_0x715d('0x1c')](_0x39cdb5);}return null;};}function patchUpdates(_0x4fc587){return function(_0x422409){try{jsonpatch['apply'](_0x422409,_0x4fc587,!![]);}catch(_0x3f65e4){return BPromise[_0x715d('0x22')](_0x3f65e4);}return _0x422409[_0x715d('0x23')]();};}function saveUpdates(_0x8182b1,_0x383120){return function(_0x2bfe89){if(_0x2bfe89){return _0x2bfe89['update'](_0x8182b1)[_0x715d('0x24')](function(_0xf4bd62){return _0xf4bd62;});}return null;};}function removeEntity(_0x367e21,_0x5ab705){return function(_0x2a6bb3){if(_0x2a6bb3){return _0x2a6bb3[_0x715d('0x25')]()[_0x715d('0x24')](function(){var _0x4c321e=_0x2a6bb3['get']({'plain':!![]});var _0x454e29=_0x715d('0x26');return db[_0x715d('0x27')][_0x715d('0x25')]({'where':{'type':_0x454e29,'resourceId':_0x4c321e['id']}})[_0x715d('0x24')](function(){return _0x2a6bb3;});})['then'](function(){_0x367e21[_0x715d('0x1b')](0xcc)[_0x715d('0x28')]();});}};}function handleEntityNotFound(_0x54d8ff,_0x5cb566){return function(_0x3e6a45){if(!_0x3e6a45){_0x54d8ff['sendStatus'](0x194);}return _0x3e6a45;};}function handleError(_0x471ad1,_0x260f81){_0x260f81=_0x260f81||0x1f4;return function(_0x1551fb){logger[_0x715d('0x29')](_0x1551fb[_0x715d('0x2a')]);if(_0x1551fb['name']){delete _0x1551fb[_0x715d('0x2b')];}_0x471ad1[_0x715d('0x1b')](_0x260f81)[_0x715d('0x2c')](_0x1551fb);};}exports[_0x715d('0x2d')]=function(_0x410f6b,_0x4bdf27){var _0x2b0508={},_0xf53fe1={},_0x493eb6={'count':0x0,'rows':[]};var _0x4a4737=_[_0x715d('0x2e')](db[_0x715d('0x2f')]['rawAttributes'],function(_0x162e35){return{'name':_0x162e35['fieldName'],'type':_0x162e35[_0x715d('0x30')][_0x715d('0x31')]};});_0xf53fe1[_0x715d('0x32')]=_['map'](_0x4a4737,_0x715d('0x2b'));_0xf53fe1[_0x715d('0x33')]=_[_0x715d('0x34')](_0x410f6b['query']);_0xf53fe1[_0x715d('0x35')]=_[_0x715d('0x36')](_0xf53fe1[_0x715d('0x32')],_0xf53fe1[_0x715d('0x33')]);_0x2b0508['attributes']=_['intersection'](_0xf53fe1['model'],qs[_0x715d('0x37')](_0x410f6b[_0x715d('0x33')][_0x715d('0x37')]));_0x2b0508[_0x715d('0x38')]=_0x2b0508[_0x715d('0x38')][_0x715d('0x39')]?_0x2b0508[_0x715d('0x38')]:_0xf53fe1['model'];if(!_0x410f6b[_0x715d('0x33')][_0x715d('0x3a')](_0x715d('0x3b'))){_0x2b0508['limit']=qs[_0x715d('0x1f')](_0x410f6b['query']['limit']);_0x2b0508[_0x715d('0x1e')]=qs[_0x715d('0x1e')](_0x410f6b[_0x715d('0x33')][_0x715d('0x1e')]);}_0x2b0508[_0x715d('0x3c')]=qs[_0x715d('0x3d')](_0x410f6b[_0x715d('0x33')][_0x715d('0x3d')]);_0x2b0508['where']=qs[_0x715d('0x35')](_[_0x715d('0x3e')](_0x410f6b[_0x715d('0x33')],_0xf53fe1[_0x715d('0x35')]),_0x4a4737);if(_0x410f6b['query'][_0x715d('0x3f')]){_0x2b0508[_0x715d('0x40')]=_[_0x715d('0x41')](_0x2b0508[_0x715d('0x40')],{'$or':_[_0x715d('0x2e')](_0x4a4737,function(_0x1ddf5a){if(_0x1ddf5a[_0x715d('0x30')]!==_0x715d('0x42')){var _0x4c7b65={};_0x4c7b65[_0x1ddf5a[_0x715d('0x2b')]]={'$like':'%'+_0x410f6b[_0x715d('0x33')]['filter']+'%'};return _0x4c7b65;}})});}_0x2b0508=_[_0x715d('0x41')]({},_0x2b0508,_0x410f6b[_0x715d('0x43')]);var _0xdb7000={'where':_0x2b0508[_0x715d('0x40')]};return db['Campaign']['count'](_0xdb7000)[_0x715d('0x24')](function(_0x1b6e2c){_0x493eb6['count']=_0x1b6e2c;if(_0x410f6b['query'][_0x715d('0x44')]){_0x2b0508['include']=[{'all':!![]}];}return db[_0x715d('0x2f')]['findAll'](_0x2b0508);})[_0x715d('0x24')](function(_0x2ef8a0){_0x493eb6[_0x715d('0x45')]=_0x2ef8a0;return _0x493eb6;})['then'](respondWithFilteredResult(_0x4bdf27,_0x2b0508))['catch'](handleError(_0x4bdf27,null));};exports[_0x715d('0x46')]=function(_0x2b5343,_0xb64145){var _0x4228ad={'raw':![],'where':{'id':_0x2b5343[_0x715d('0x47')]['id']}},_0x431afd={};_0x431afd[_0x715d('0x32')]=_[_0x715d('0x34')](db[_0x715d('0x2f')][_0x715d('0x48')]);_0x431afd[_0x715d('0x33')]=_['keys'](_0x2b5343[_0x715d('0x33')]);_0x431afd[_0x715d('0x35')]=_[_0x715d('0x36')](_0x431afd[_0x715d('0x32')],_0x431afd[_0x715d('0x33')]);_0x4228ad['attributes']=_[_0x715d('0x36')](_0x431afd[_0x715d('0x32')],qs['fields'](_0x2b5343[_0x715d('0x33')][_0x715d('0x37')]));_0x4228ad[_0x715d('0x38')]=_0x4228ad['attributes'][_0x715d('0x39')]?_0x4228ad['attributes']:_0x431afd[_0x715d('0x32')];if(_0x2b5343[_0x715d('0x33')]['includeAll']){_0x4228ad[_0x715d('0x49')]=[{'all':!![]}];}_0x4228ad=_['merge']({},_0x4228ad,_0x2b5343['options']);return db[_0x715d('0x2f')][_0x715d('0x4a')](_0x4228ad)[_0x715d('0x24')](handleEntityNotFound(_0xb64145,null))[_0x715d('0x24')](respondWithResult(_0xb64145,null))[_0x715d('0x4b')](handleError(_0xb64145,null));};exports[_0x715d('0x4c')]=function(_0xb9a757,_0x1d8211){return db['Campaign'][_0x715d('0x4c')](_0xb9a757[_0x715d('0x4d')],{})[_0x715d('0x24')](function(_0x584545){var _0x51e793=_0xb9a757[_0x715d('0x4e')][_0x715d('0x4f')]({'plain':!![]});if(!_0x51e793)throw new Error(_0x715d('0x50'));if(_0x51e793['role']==='user'){var _0x105128=_0x584545[_0x715d('0x4f')]({'plain':!![]});var _0x1d084e=_0x715d('0x26');return db[_0x715d('0x51')][_0x715d('0x4a')]({'where':{'name':_0x1d084e,'userProfileId':_0x51e793['userProfileId']},'raw':!![]})[_0x715d('0x24')](function(_0x5a254e){if(_0x5a254e&&_0x5a254e[_0x715d('0x52')]===0x0){return db[_0x715d('0x27')]['create']({'name':_0x105128[_0x715d('0x2b')],'resourceId':_0x105128['id'],'type':_0x5a254e[_0x715d('0x2b')],'sectionId':_0x5a254e['id']},{})[_0x715d('0x24')](function(){return _0x584545;});}else{return _0x584545;}})['catch'](function(_0x229106){logger[_0x715d('0x29')](_0x715d('0x53'),_0x229106);throw _0x229106;});}return _0x584545;})[_0x715d('0x24')](respondWithResult(_0x1d8211,0xc9))[_0x715d('0x4b')](handleError(_0x1d8211,null));};exports[_0x715d('0x54')]=function(_0x4149ea,_0x21f0dc){var _0x173781={'where':{'id':_0x4149ea[_0x715d('0x47')]['id']}},_0xc5f954={};_0xc5f954[_0x715d('0x32')]=_[_0x715d('0x34')](db[_0x715d('0x2f')]['rawAttributes']);_0x173781[_0x715d('0x38')]=_[_0x715d('0x36')](_0xc5f954['model'],qs[_0x715d('0x37')](_0x4149ea['query'][_0x715d('0x37')]));_0x173781[_0x715d('0x38')]=_0x173781[_0x715d('0x38')][_0x715d('0x39')]?_0x173781['attributes']:_0xc5f954['model'];if(_0x4149ea[_0x715d('0x33')][_0x715d('0x44')]){_0x173781[_0x715d('0x49')]=[{'all':!![]}];}_0x173781=_[_0x715d('0x41')]({},_0x173781,_0x4149ea[_0x715d('0x43')]);return db[_0x715d('0x2f')][_0x715d('0x4a')](_0x173781)[_0x715d('0x24')](handleEntityNotFound(_0x21f0dc,null))[_0x715d('0x24')](function(_0x4265e5){if(_0x4265e5){var _0x241ae7=_0x4265e5[_0x715d('0x4f')]({'plain':!![]});_0x241ae7=qs[_0x715d('0x55')](_0x241ae7,['id','createdAt',_0x715d('0x56')]);_0x4149ea[_0x715d('0x4d')]=_[_0x715d('0x55')](_0x4149ea[_0x715d('0x4d')],['id',_0x715d('0x57'),_0x715d('0x56')]);return db[_0x715d('0x2f')][_0x715d('0x4c')](_[_0x715d('0x41')](_0x241ae7,_0x4149ea[_0x715d('0x4d')]),{'include':_0x4149ea[_0x715d('0x33')][_0x715d('0x44')]?[{'all':!![]}]:undefined})[_0x715d('0x24')](function(_0x59db16){var _0x133f9e=_0x4149ea[_0x715d('0x4e')][_0x715d('0x4f')]({'plain':!![]});if(!_0x133f9e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x133f9e[_0x715d('0x58')]==='user'){var _0xbfb486=_0x59db16[_0x715d('0x4f')]({'plain':!![]});var _0x25a8d1='IvrCampaigns';return db['UserProfileSection'][_0x715d('0x4a')]({'where':{'name':_0x25a8d1,'userProfileId':_0x133f9e[_0x715d('0x59')]},'raw':!![]})[_0x715d('0x24')](function(_0x2964d5){if(_0x2964d5&&_0x2964d5[_0x715d('0x52')]===0x0){return db[_0x715d('0x27')][_0x715d('0x4c')]({'name':_0xbfb486['name'],'resourceId':_0xbfb486['id'],'type':_0x2964d5[_0x715d('0x2b')],'sectionId':_0x2964d5['id']},{})[_0x715d('0x24')](function(){return _0x59db16;});}else{return _0x59db16;}})[_0x715d('0x4b')](function(_0x9680d8){logger[_0x715d('0x29')](_0x715d('0x53'),_0x9680d8);throw _0x9680d8;});}return _0x59db16;});}})[_0x715d('0x24')](respondWithResult(_0x21f0dc,0xc9))[_0x715d('0x4b')](handleError(_0x21f0dc,null));};exports[_0x715d('0x5a')]=function(_0x4b1607,_0x1d8493){if(_0x4b1607[_0x715d('0x4d')]['id']){delete _0x4b1607['body']['id'];}return db[_0x715d('0x2f')][_0x715d('0x4a')]({'where':{'id':_0x4b1607[_0x715d('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d8493,null))[_0x715d('0x24')](saveUpdates(_0x4b1607[_0x715d('0x4d')],null))['then'](respondWithResult(_0x1d8493,null))[_0x715d('0x4b')](handleError(_0x1d8493,null));};exports['destroy']=function(_0x4e1ae2,_0x3788d5){return db[_0x715d('0x2f')][_0x715d('0x4a')]({'where':{'id':_0x4e1ae2['params']['id']}})[_0x715d('0x24')](handleEntityNotFound(_0x3788d5,null))[_0x715d('0x24')](removeEntity(_0x3788d5,null))['catch'](handleError(_0x3788d5,null));};exports[_0x715d('0x5b')]=function(_0x4e1006,_0x19c0d5,_0x3af0ae){var _0x1349d7={'raw':!![],'where':{}};var _0x28ed73={};var _0x97bf0d={'count':0x0,'rows':[]};return db[_0x715d('0x2f')][_0x715d('0x5c')]({'where':{'id':_0x4e1006[_0x715d('0x47')]['id']}})['then'](handleEntityNotFound(_0x19c0d5,null))[_0x715d('0x24')](function(_0x59b4dd){if(_0x59b4dd){_0x28ed73['model']=_[_0x715d('0x34')](db[_0x715d('0x5d')][_0x715d('0x48')]);_0x28ed73['query']=_[_0x715d('0x34')](_0x4e1006['query']);_0x28ed73[_0x715d('0x35')]=_[_0x715d('0x36')](_0x28ed73[_0x715d('0x32')],_0x28ed73['query']);_0x1349d7['attributes']=_['intersection'](_0x28ed73[_0x715d('0x32')],qs['fields'](_0x4e1006[_0x715d('0x33')]['fields']));_0x1349d7[_0x715d('0x38')]=_0x1349d7['attributes'][_0x715d('0x39')]?_0x1349d7[_0x715d('0x38')]:_0x28ed73['model'];if(!_0x4e1006['query'][_0x715d('0x3a')](_0x715d('0x3b'))){_0x1349d7[_0x715d('0x1f')]=qs['limit'](_0x4e1006[_0x715d('0x33')][_0x715d('0x1f')]);_0x1349d7[_0x715d('0x1e')]=qs[_0x715d('0x1e')](_0x4e1006[_0x715d('0x33')][_0x715d('0x1e')]);}_0x1349d7[_0x715d('0x3c')]=qs[_0x715d('0x3d')](_0x4e1006[_0x715d('0x33')][_0x715d('0x3d')]);_0x1349d7[_0x715d('0x40')]=qs[_0x715d('0x35')](_['pick'](_0x4e1006[_0x715d('0x33')],_0x28ed73['filters']));_0x1349d7[_0x715d('0x40')][_0x715d('0x5e')]=_0x59b4dd['id'];if(_0x4e1006[_0x715d('0x33')]['filter']){_0x1349d7[_0x715d('0x40')]=_[_0x715d('0x41')](_0x1349d7[_0x715d('0x40')],{'$or':_[_0x715d('0x2e')](_0x1349d7[_0x715d('0x38')],function(_0x3ed8a0){var _0x3a65e6={};_0x3a65e6[_0x3ed8a0]={'$like':'%'+_0x4e1006[_0x715d('0x33')][_0x715d('0x3f')]+'%'};return _0x3a65e6;})});}_0x1349d7=_[_0x715d('0x41')]({},_0x1349d7,_0x4e1006[_0x715d('0x43')]);return db[_0x715d('0x5d')]['count']({'where':_0x1349d7['where']})[_0x715d('0x24')](function(_0x1e4b07){_0x97bf0d[_0x715d('0x1d')]=_0x1e4b07;if(_0x4e1006[_0x715d('0x33')][_0x715d('0x44')]){_0x1349d7[_0x715d('0x49')]=[{'all':!![]}];}return db['CmHopper'][_0x715d('0x5f')](_0x1349d7);})[_0x715d('0x24')](function(_0x7ad952){_0x97bf0d[_0x715d('0x45')]=_0x7ad952;return _0x97bf0d;});}})[_0x715d('0x24')](respondWithFilteredResult(_0x19c0d5,_0x1349d7))[_0x715d('0x4b')](handleError(_0x19c0d5,null));};exports['getHopperHistories']=function(_0x1c21c2,_0x576e8c,_0x541ba4){var _0x113c61={'raw':!![],'where':{}};var _0x41f501={};var _0x16b12b={'count':0x0,'rows':[]};return db[_0x715d('0x2f')]['findOne']({'where':{'id':_0x1c21c2[_0x715d('0x47')]['id']}})['then'](handleEntityNotFound(_0x576e8c,null))[_0x715d('0x24')](function(_0x4e7202){if(_0x4e7202){_0x41f501[_0x715d('0x32')]=_[_0x715d('0x34')](db[_0x715d('0x60')][_0x715d('0x48')]);_0x41f501['query']=_[_0x715d('0x34')](_0x1c21c2[_0x715d('0x33')]);_0x41f501['filters']=_[_0x715d('0x36')](_0x41f501[_0x715d('0x32')],_0x41f501[_0x715d('0x33')]);_0x113c61[_0x715d('0x38')]=_[_0x715d('0x36')](_0x41f501[_0x715d('0x32')],qs['fields'](_0x1c21c2[_0x715d('0x33')][_0x715d('0x37')]));_0x113c61['attributes']=_0x113c61['attributes']['length']?_0x113c61[_0x715d('0x38')]:_0x41f501[_0x715d('0x32')];if(!_0x1c21c2[_0x715d('0x33')][_0x715d('0x3a')](_0x715d('0x3b'))){_0x113c61[_0x715d('0x1f')]=qs[_0x715d('0x1f')](_0x1c21c2[_0x715d('0x33')][_0x715d('0x1f')]);_0x113c61[_0x715d('0x1e')]=qs[_0x715d('0x1e')](_0x1c21c2[_0x715d('0x33')][_0x715d('0x1e')]);}_0x113c61[_0x715d('0x3c')]=qs[_0x715d('0x3d')](_0x1c21c2[_0x715d('0x33')][_0x715d('0x3d')]);_0x113c61[_0x715d('0x40')]=qs[_0x715d('0x35')](_['pick'](_0x1c21c2['query'],_0x41f501[_0x715d('0x35')]));_0x113c61['where'][_0x715d('0x5e')]=_0x4e7202['id'];if(_0x1c21c2[_0x715d('0x33')][_0x715d('0x3f')]){_0x113c61[_0x715d('0x40')]=_[_0x715d('0x41')](_0x113c61[_0x715d('0x40')],{'$or':_[_0x715d('0x2e')](_0x113c61[_0x715d('0x38')],function(_0x30adea){var _0x55960f={};_0x55960f[_0x30adea]={'$like':'%'+_0x1c21c2[_0x715d('0x33')]['filter']+'%'};return _0x55960f;})});}_0x113c61=_['merge']({},_0x113c61,_0x1c21c2['options']);return db['CmHopperHistory']['count']({'where':_0x113c61[_0x715d('0x40')]})[_0x715d('0x24')](function(_0x30d1c8){_0x16b12b['count']=_0x30d1c8;if(_0x1c21c2[_0x715d('0x33')][_0x715d('0x44')]){_0x113c61[_0x715d('0x49')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x715d('0x5f')](_0x113c61);})[_0x715d('0x24')](function(_0x2761b3){_0x16b12b[_0x715d('0x45')]=_0x2761b3;return _0x16b12b;});}})['then'](respondWithFilteredResult(_0x576e8c,_0x113c61))[_0x715d('0x4b')](handleError(_0x576e8c,null));};exports[_0x715d('0x61')]=function(_0xb121fd,_0x437265,_0x54f89b){var _0x1ef345={'raw':!![],'where':{}};var _0x39f365={};var _0x43fab4={'count':0x0,'rows':[]};return db[_0x715d('0x2f')][_0x715d('0x5c')]({'where':{'id':_0xb121fd['params']['id']}})[_0x715d('0x24')](handleEntityNotFound(_0x437265,null))[_0x715d('0x24')](function(_0x36ddde){if(_0x36ddde){_0x39f365[_0x715d('0x32')]=_[_0x715d('0x34')](db[_0x715d('0x62')][_0x715d('0x48')]);_0x39f365[_0x715d('0x33')]=_[_0x715d('0x34')](_0xb121fd[_0x715d('0x33')]);_0x39f365['filters']=_[_0x715d('0x36')](_0x39f365[_0x715d('0x32')],_0x39f365[_0x715d('0x33')]);_0x1ef345[_0x715d('0x38')]=_[_0x715d('0x36')](_0x39f365[_0x715d('0x32')],qs[_0x715d('0x37')](_0xb121fd[_0x715d('0x33')][_0x715d('0x37')]));_0x1ef345[_0x715d('0x38')]=_0x1ef345[_0x715d('0x38')][_0x715d('0x39')]?_0x1ef345[_0x715d('0x38')]:_0x39f365['model'];if(!_0xb121fd[_0x715d('0x33')][_0x715d('0x3a')](_0x715d('0x3b'))){_0x1ef345[_0x715d('0x1f')]=qs[_0x715d('0x1f')](_0xb121fd[_0x715d('0x33')][_0x715d('0x1f')]);_0x1ef345[_0x715d('0x1e')]=qs['offset'](_0xb121fd[_0x715d('0x33')]['offset']);}_0x1ef345['order']=qs[_0x715d('0x3d')](_0xb121fd['query'][_0x715d('0x3d')]);_0x1ef345['where']=qs[_0x715d('0x35')](_[_0x715d('0x3e')](_0xb121fd['query'],_0x39f365[_0x715d('0x35')]));_0x1ef345['where']['CampaignId']=_0x36ddde['id'];if(_0xb121fd['query'][_0x715d('0x3f')]){_0x1ef345[_0x715d('0x40')]=_[_0x715d('0x41')](_0x1ef345[_0x715d('0x40')],{'$or':_[_0x715d('0x2e')](_0x1ef345[_0x715d('0x38')],function(_0x24bb7f){var _0x58660a={};_0x58660a[_0x24bb7f]={'$like':'%'+_0xb121fd[_0x715d('0x33')]['filter']+'%'};return _0x58660a;})});}_0x1ef345=_['merge']({},_0x1ef345,_0xb121fd[_0x715d('0x43')]);return db[_0x715d('0x62')]['count']({'where':_0x1ef345[_0x715d('0x40')]})[_0x715d('0x24')](function(_0x58d886){_0x43fab4[_0x715d('0x1d')]=_0x58d886;if(_0xb121fd[_0x715d('0x33')][_0x715d('0x44')]){_0x1ef345[_0x715d('0x49')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x1ef345);})[_0x715d('0x24')](function(_0x1d60df){_0x43fab4[_0x715d('0x45')]=_0x1d60df;return _0x43fab4;});}})[_0x715d('0x24')](respondWithFilteredResult(_0x437265,_0x1ef345))[_0x715d('0x4b')](handleError(_0x437265,null));};exports[_0x715d('0x63')]=function(_0x268762,_0x31b50b,_0x8a4d13){var _0x167996={'raw':!![],'where':{}};var _0x169c0b={};var _0x1a089a={'count':0x0,'rows':[]};return db['Campaign'][_0x715d('0x5c')]({'where':{'id':_0x268762['params']['id']}})['then'](handleEntityNotFound(_0x31b50b,null))[_0x715d('0x24')](function(_0x38c9b6){if(_0x38c9b6){_0x169c0b[_0x715d('0x32')]=_[_0x715d('0x34')](db['CmHopperBlack'][_0x715d('0x48')]);_0x169c0b['query']=_['keys'](_0x268762[_0x715d('0x33')]);_0x169c0b[_0x715d('0x35')]=_['intersection'](_0x169c0b['model'],_0x169c0b[_0x715d('0x33')]);_0x167996[_0x715d('0x38')]=_['intersection'](_0x169c0b[_0x715d('0x32')],qs[_0x715d('0x37')](_0x268762[_0x715d('0x33')][_0x715d('0x37')]));_0x167996[_0x715d('0x38')]=_0x167996[_0x715d('0x38')][_0x715d('0x39')]?_0x167996['attributes']:_0x169c0b[_0x715d('0x32')];if(!_0x268762['query'][_0x715d('0x3a')]('nolimit')){_0x167996['limit']=qs['limit'](_0x268762[_0x715d('0x33')][_0x715d('0x1f')]);_0x167996[_0x715d('0x1e')]=qs[_0x715d('0x1e')](_0x268762[_0x715d('0x33')]['offset']);}_0x167996['order']=qs[_0x715d('0x3d')](_0x268762[_0x715d('0x33')][_0x715d('0x3d')]);_0x167996['where']=qs[_0x715d('0x35')](_[_0x715d('0x3e')](_0x268762[_0x715d('0x33')],_0x169c0b[_0x715d('0x35')]));_0x167996[_0x715d('0x40')][_0x715d('0x5e')]=_0x38c9b6['id'];if(_0x268762[_0x715d('0x33')][_0x715d('0x3f')]){_0x167996[_0x715d('0x40')]=_[_0x715d('0x41')](_0x167996['where'],{'$or':_['map'](_0x167996[_0x715d('0x38')],function(_0x3e0bd7){var _0x493aa6={};_0x493aa6[_0x3e0bd7]={'$like':'%'+_0x268762[_0x715d('0x33')][_0x715d('0x3f')]+'%'};return _0x493aa6;})});}_0x167996=_['merge']({},_0x167996,_0x268762[_0x715d('0x43')]);return db[_0x715d('0x64')][_0x715d('0x1d')]({'where':_0x167996[_0x715d('0x40')]})['then'](function(_0x4afbef){_0x1a089a[_0x715d('0x1d')]=_0x4afbef;if(_0x268762[_0x715d('0x33')][_0x715d('0x44')]){_0x167996['include']=[{'all':!![]}];}return db[_0x715d('0x64')][_0x715d('0x5f')](_0x167996);})[_0x715d('0x24')](function(_0x4d6121){_0x1a089a[_0x715d('0x45')]=_0x4d6121;return _0x1a089a;});}})[_0x715d('0x24')](respondWithFilteredResult(_0x31b50b,_0x167996))[_0x715d('0x4b')](handleError(_0x31b50b,null));};exports[_0x715d('0x65')]=function(_0x596fd7,_0x3582d5,_0x2deac1){var _0x23b8f9={};var _0x75d2f0={};var _0x50ba0a;var _0x3c5895;return db[_0x715d('0x2f')][_0x715d('0x5c')]({'where':{'id':_0x596fd7['params']['id']}})['then'](handleEntityNotFound(_0x3582d5,null))[_0x715d('0x24')](function(_0xe97383){if(_0xe97383){_0x50ba0a=_0xe97383;_0x75d2f0['model']=_['keys'](db[_0x715d('0x66')][_0x715d('0x48')]);_0x75d2f0['query']=_[_0x715d('0x34')](_0x596fd7['query']);_0x75d2f0[_0x715d('0x35')]=_[_0x715d('0x36')](_0x75d2f0[_0x715d('0x32')],_0x75d2f0['query']);_0x23b8f9[_0x715d('0x38')]=_[_0x715d('0x36')](_0x75d2f0[_0x715d('0x32')],qs[_0x715d('0x37')](_0x596fd7[_0x715d('0x33')][_0x715d('0x37')]));_0x23b8f9[_0x715d('0x38')]=_0x23b8f9[_0x715d('0x38')][_0x715d('0x39')]?_0x23b8f9[_0x715d('0x38')]:_0x75d2f0[_0x715d('0x32')];_0x23b8f9[_0x715d('0x3c')]=qs['sort'](_0x596fd7['query'][_0x715d('0x3d')]);_0x23b8f9[_0x715d('0x40')]=qs[_0x715d('0x35')](_[_0x715d('0x3e')](_0x596fd7[_0x715d('0x33')],_0x75d2f0[_0x715d('0x35')]));if(_0x596fd7['query'][_0x715d('0x3f')]){_0x23b8f9[_0x715d('0x40')]=_[_0x715d('0x41')](_0x23b8f9['where'],{'$or':_[_0x715d('0x2e')](_0x23b8f9[_0x715d('0x38')],function(_0x45ec84){var _0x248327={};_0x248327[_0x45ec84]={'$like':'%'+_0x596fd7[_0x715d('0x33')][_0x715d('0x3f')]+'%'};return _0x248327;})});}_0x23b8f9=_[_0x715d('0x41')]({},_0x23b8f9,_0x596fd7['options']);return _0x50ba0a[_0x715d('0x65')](_0x23b8f9);}})[_0x715d('0x24')](function(_0x6b8f44){if(_0x6b8f44){_0x3c5895=_0x6b8f44[_0x715d('0x39')];if(!_0x596fd7[_0x715d('0x33')][_0x715d('0x3a')](_0x715d('0x3b'))){_0x23b8f9[_0x715d('0x1f')]=qs[_0x715d('0x1f')](_0x596fd7[_0x715d('0x33')]['limit']);_0x23b8f9[_0x715d('0x1e')]=qs['offset'](_0x596fd7[_0x715d('0x33')][_0x715d('0x1e')]);}return _0x50ba0a[_0x715d('0x65')](_0x23b8f9);}})['then'](function(_0x33b5f3){if(_0x33b5f3){return _0x33b5f3?{'count':_0x3c5895,'rows':_0x33b5f3}:null;}})[_0x715d('0x24')](respondWithResult(_0x3582d5,null))[_0x715d('0x4b')](handleError(_0x3582d5,null));};exports[_0x715d('0x67')]=function(_0x17b26e,_0x242413,_0x2a2b09){var _0x33defa,_0x498b49;return db['Campaign'][_0x715d('0x4a')]({'where':{'id':_0x17b26e[_0x715d('0x47')]['id']}})[_0x715d('0x24')](handleEntityNotFound(_0x242413,null))[_0x715d('0x24')](function(_0x2d9a3c){if(_0x2d9a3c){_0x498b49=_0x2d9a3c;return _0x2d9a3c[_0x715d('0x67')](_0x17b26e[_0x715d('0x4d')]['ids'],_[_0x715d('0x55')](_0x17b26e['body'],[_0x715d('0x68'),'id'])||{});}return null;})[_0x715d('0x69')](function(_0x5eba2e){var _0x51a61e;_0x33defa=_0x5eba2e||[];var _0x23ace2=[];if(_0x5eba2e){for(var _0x227746=0x0;_0x227746<_0x5eba2e['length'];_0x227746+=0x1){var _0x1a87c4=_0x5eba2e[_0x227746]['get']({'plain':!![]});_0x498b49[_0x715d('0x6a')]=_0x17b26e[_0x715d('0x4d')][_0x715d('0x6a')]?_0x17b26e['body'][_0x715d('0x6a')]:_0x498b49['dialCheckDuplicateType'];switch(_0x498b49[_0x715d('0x6a')]){case'always':_0x51a61e=squel[_0x715d('0x6b')]()[_0x715d('0x6c')]('cm_hopper')[_0x715d('0x6d')]([_0x715d('0x6e'),_0x715d('0x6f'),_0x715d('0x70'),_0x715d('0x71'),_0x715d('0x5e'),_0x715d('0x57'),_0x715d('0x56')],squel['select']()[_0x715d('0x72')](_0x715d('0x6e'),_0x715d('0x6e'))[_0x715d('0x72')](_0x715d('0x73'),_0x715d('0x6f'))['field']('id',_0x715d('0x70'))[_0x715d('0x72')](_0x1a87c4[_0x715d('0x74')]['toString'](),_0x715d('0x71'))['field'](_0x17b26e[_0x715d('0x47')]['id'][_0x715d('0x75')](),_0x715d('0x5e'))[_0x715d('0x72')]('NOW()',_0x715d('0x57'))[_0x715d('0x72')]('NOW()','updatedAt')[_0x715d('0x76')]('cm_contacts')[_0x715d('0x40')](_0x715d('0x77'))[_0x715d('0x40')](_0x715d('0x78'),_0x1a87c4['CmListId'][_0x715d('0x75')]())[_0x715d('0x40')](_0x715d('0x79'))[_0x715d('0x40')](_0x715d('0x7a'),squel[_0x715d('0x7b')]()[_0x715d('0x72')](_0x715d('0x7c'))['from'](_0x715d('0x7d'))[_0x715d('0x40')]('CampaignId\x20=\x20?',_0x17b26e[_0x715d('0x47')]['id'][_0x715d('0x75')]()))[_0x715d('0x40')](_0x715d('0x7a'),squel[_0x715d('0x7b')]()['field'](_0x715d('0x7e'))[_0x715d('0x76')](_0x715d('0x7f'))[_0x715d('0x40')](_0x715d('0x80'),_0x17b26e[_0x715d('0x47')]['id']['toString']())))[_0x715d('0x75')]();break;case _0x715d('0x81'):_0x51a61e=squel[_0x715d('0x6b')]()[_0x715d('0x6c')](_0x715d('0x7f'))['fromQuery']([_0x715d('0x6e'),_0x715d('0x6f'),_0x715d('0x70'),_0x715d('0x71'),_0x715d('0x5e'),'createdAt','updatedAt'],squel[_0x715d('0x7b')]()[_0x715d('0x72')](_0x715d('0x6e'),_0x715d('0x6e'))[_0x715d('0x72')](_0x715d('0x73'),_0x715d('0x6f'))[_0x715d('0x72')]('id','ContactId')[_0x715d('0x72')](_0x1a87c4[_0x715d('0x74')][_0x715d('0x75')](),'ListId')[_0x715d('0x72')](_0x17b26e[_0x715d('0x47')]['id'][_0x715d('0x75')](),'CampaignId')[_0x715d('0x72')](_0x715d('0x73'),_0x715d('0x57'))[_0x715d('0x72')](_0x715d('0x73'),_0x715d('0x56'))['from']('cm_contacts')[_0x715d('0x40')](_0x715d('0x77'))['where'](_0x715d('0x78'),_0x1a87c4['CmListId'][_0x715d('0x75')]())[_0x715d('0x40')](_0x715d('0x79'))[_0x715d('0x40')](_0x715d('0x7a'),squel['select']()['field'](_0x715d('0x7e'))[_0x715d('0x76')](_0x715d('0x7f'))[_0x715d('0x40')]('CampaignId\x20=\x20?',_0x17b26e[_0x715d('0x47')]['id'][_0x715d('0x75')]())))[_0x715d('0x75')]();break;default:_0x51a61e=squel[_0x715d('0x6b')]()[_0x715d('0x6c')](_0x715d('0x7f'))[_0x715d('0x6d')]([_0x715d('0x6e'),'scheduledAt',_0x715d('0x70'),_0x715d('0x71'),'CampaignId',_0x715d('0x57'),_0x715d('0x56')],squel[_0x715d('0x7b')]()['field'](_0x715d('0x6e'),_0x715d('0x6e'))['field'](_0x715d('0x73'),'scheduledAt')['field']('id',_0x715d('0x70'))[_0x715d('0x72')](_0x1a87c4[_0x715d('0x74')][_0x715d('0x75')](),_0x715d('0x71'))[_0x715d('0x72')](_0x17b26e[_0x715d('0x47')]['id'][_0x715d('0x75')](),_0x715d('0x5e'))[_0x715d('0x72')]('NOW()',_0x715d('0x57'))[_0x715d('0x72')](_0x715d('0x73'),_0x715d('0x56'))[_0x715d('0x76')](_0x715d('0x82'))[_0x715d('0x40')](_0x715d('0x77'))[_0x715d('0x40')](_0x715d('0x78'),_0x1a87c4[_0x715d('0x74')]['toString']())[_0x715d('0x40')](_0x715d('0x79')))['toString']();}_0x23ace2[_0x715d('0x83')](db['sequelize'][_0x715d('0x33')](_0x51a61e));}return BPromise['all'](_0x23ace2);}})[_0x715d('0x24')](function(){return _0x33defa;})[_0x715d('0x24')](respondWithResult(_0x242413,null))[_0x715d('0x4b')](handleError(_0x242413,null));};exports[_0x715d('0x84')]=function(_0x2f7535,_0x455ed1,_0x45a4a9){return db[_0x715d('0x2f')][_0x715d('0x4a')]({'where':{'id':_0x2f7535[_0x715d('0x47')]['id']}})['then'](handleEntityNotFound(_0x455ed1,null))['then'](function(_0x2f6e1b){if(_0x2f6e1b){return _0x2f6e1b[_0x715d('0x84')](_0x2f7535['query']['ids']);}})[_0x715d('0x24')](function(_0x352ee2){if(_0x352ee2){return db[_0x715d('0x5d')][_0x715d('0x25')]({'where':{'ListId':_0x2f7535['query'][_0x715d('0x68')],'CampaignId':_0x2f7535['params']['id']}})[_0x715d('0x24')](function(){return _0x352ee2;});}})[_0x715d('0x24')](respondWithStatusCode(_0x455ed1,null))[_0x715d('0x4b')](handleError(_0x455ed1,null));};exports['getBlackLists']=function(_0x60fd84,_0x164f06,_0x245a49){var _0x31a834={};var _0x336e5e={};var _0xcf797c;var _0x22d998;return db['Campaign'][_0x715d('0x5c')]({'where':{'id':_0x60fd84[_0x715d('0x47')]['id']}})[_0x715d('0x24')](handleEntityNotFound(_0x164f06,null))[_0x715d('0x24')](function(_0x2c1a40){if(_0x2c1a40){_0xcf797c=_0x2c1a40;_0x336e5e[_0x715d('0x32')]=_[_0x715d('0x34')](db[_0x715d('0x66')][_0x715d('0x48')]);_0x336e5e[_0x715d('0x33')]=_[_0x715d('0x34')](_0x60fd84[_0x715d('0x33')]);_0x336e5e[_0x715d('0x35')]=_[_0x715d('0x36')](_0x336e5e['model'],_0x336e5e[_0x715d('0x33')]);_0x31a834[_0x715d('0x38')]=_[_0x715d('0x36')](_0x336e5e[_0x715d('0x32')],qs[_0x715d('0x37')](_0x60fd84[_0x715d('0x33')][_0x715d('0x37')]));_0x31a834[_0x715d('0x38')]=_0x31a834[_0x715d('0x38')][_0x715d('0x39')]?_0x31a834['attributes']:_0x336e5e['model'];_0x31a834[_0x715d('0x3c')]=qs['sort'](_0x60fd84[_0x715d('0x33')]['sort']);_0x31a834['where']=qs[_0x715d('0x35')](_['pick'](_0x60fd84[_0x715d('0x33')],_0x336e5e['filters']));if(_0x60fd84['query'][_0x715d('0x3f')]){_0x31a834[_0x715d('0x40')]=_['merge'](_0x31a834['where'],{'$or':_[_0x715d('0x2e')](_0x31a834[_0x715d('0x38')],function(_0x454bba){var _0x2ef9de={};_0x2ef9de[_0x454bba]={'$like':'%'+_0x60fd84['query'][_0x715d('0x3f')]+'%'};return _0x2ef9de;})});}_0x31a834=_['merge']({},_0x31a834,_0x60fd84[_0x715d('0x43')]);return _0xcf797c[_0x715d('0x85')](_0x31a834);}})[_0x715d('0x24')](function(_0x2768cb){if(_0x2768cb){_0x22d998=_0x2768cb[_0x715d('0x39')];if(!_0x60fd84[_0x715d('0x33')][_0x715d('0x3a')]('nolimit')){_0x31a834[_0x715d('0x1f')]=qs[_0x715d('0x1f')](_0x60fd84[_0x715d('0x33')][_0x715d('0x1f')]);_0x31a834[_0x715d('0x1e')]=qs[_0x715d('0x1e')](_0x60fd84[_0x715d('0x33')]['offset']);}return _0xcf797c['getBlackLists'](_0x31a834);}})[_0x715d('0x24')](function(_0x3c9fb6){if(_0x3c9fb6){return _0x3c9fb6?{'count':_0x22d998,'rows':_0x3c9fb6}:null;}})['then'](respondWithResult(_0x164f06,null))['catch'](handleError(_0x164f06,null));};exports[_0x715d('0x86')]=function(_0xb62f42,_0xd187c4,_0x28b7e9){var _0x30c7d6,_0x3adf9f;return db[_0x715d('0x2f')][_0x715d('0x4a')]({'where':{'id':_0xb62f42['params']['id']}})['then'](handleEntityNotFound(_0xd187c4,null))['then'](function(_0x52278a){if(_0x52278a){_0x3adf9f=_0x52278a;return _0x52278a[_0x715d('0x86')](_0xb62f42[_0x715d('0x4d')][_0x715d('0x68')],_[_0x715d('0x55')](_0xb62f42['body'],[_0x715d('0x68'),'id'])||{});}return null;})['spread'](function(_0x4a3d53){var _0x4aa5b2;_0x30c7d6=_0x4a3d53||[];var _0x223582=[];if(_0x4a3d53){for(var _0x569a55=0x0;_0x569a55<_0x4a3d53[_0x715d('0x39')];_0x569a55+=0x1){var _0x1c37c6=_0x4a3d53[_0x569a55][_0x715d('0x4f')]({'plain':!![]});_0x4aa5b2=squel[_0x715d('0x6b')]()['into'](_0x715d('0x87'))[_0x715d('0x6d')]([_0x715d('0x6e'),_0x715d('0x70'),_0x715d('0x71'),_0x715d('0x5e'),_0x715d('0x57'),_0x715d('0x56')],squel['select']()[_0x715d('0x72')](_0x715d('0x6e'),'phone')[_0x715d('0x72')]('id','ContactId')['field'](_0x1c37c6[_0x715d('0x74')][_0x715d('0x75')](),_0x715d('0x71'))[_0x715d('0x72')](_0xb62f42['params']['id']['toString'](),_0x715d('0x5e'))['field']('NOW()',_0x715d('0x57'))[_0x715d('0x72')](_0x715d('0x73'),'updatedAt')[_0x715d('0x76')](_0x715d('0x82'))[_0x715d('0x40')](_0x715d('0x77'))['where'](_0x715d('0x78'),_0x1c37c6[_0x715d('0x74')][_0x715d('0x75')]())[_0x715d('0x40')](_0x715d('0x79')))[_0x715d('0x75')]();_0x223582[_0x715d('0x83')](db['sequelize']['query'](_0x4aa5b2));}return BPromise[_0x715d('0x88')](_0x223582);}})['then'](function(){return _0x30c7d6;})['then'](respondWithResult(_0xd187c4,null))[_0x715d('0x4b')](handleError(_0xd187c4,null));};exports[_0x715d('0x89')]=function(_0x1acf2e,_0xe59bcf,_0x546a5f){return db['Campaign'][_0x715d('0x4a')]({'where':{'id':_0x1acf2e[_0x715d('0x47')]['id']}})[_0x715d('0x24')](handleEntityNotFound(_0xe59bcf,null))[_0x715d('0x24')](function(_0xf09fd7){if(_0xf09fd7){return _0xf09fd7[_0x715d('0x89')](_0x1acf2e[_0x715d('0x33')][_0x715d('0x68')]);}})[_0x715d('0x24')](function(_0x3f8b7b){if(_0x3f8b7b){return db['CmHopperBlack'][_0x715d('0x25')]({'where':{'ListId':_0x1acf2e[_0x715d('0x33')][_0x715d('0x68')],'CampaignId':_0x1acf2e[_0x715d('0x47')]['id']}})[_0x715d('0x24')](function(){return _0x3f8b7b;});}})[_0x715d('0x24')](respondWithStatusCode(_0xe59bcf,null))[_0x715d('0x4b')](handleError(_0xe59bcf,null));}; \ No newline at end of file +var _0xea09=['catch','show','params','find','create','user','get','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','getHoppers','CmHopper','hasOwnProperty','nolimit','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','field','NOW()','ListId','toString','from','cm_contacts','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','deletedAt\x20IS\x20NULL','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','push','removeBlackLists','rimraf','moment','bluebird','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','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','IvrCampaigns','UserProfileResource','sendStatus','stack','name','index','Campaign','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x5224eb,_0x39b569){var _0xabac08=function(_0x5ab2b3){while(--_0x5ab2b3){_0x5224eb['push'](_0x5224eb['shift']());}};_0xabac08(++_0x39b569);}(_0xea09,0xd0));var _0x9ea0=function(_0x1bf1c6,_0x1a79fa){_0x1bf1c6=_0x1bf1c6-0x0;var _0x595515=_0xea09[_0x1bf1c6];return _0x595515;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9ea0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9ea0('0x1'));var BPromise=require(_0x9ea0('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9ea0('0x3'));var sox=require(_0x9ea0('0x4'));var csv=require('to-csv');var ejs=require(_0x9ea0('0x5'));var fs=require('fs');var _=require(_0x9ea0('0x6'));var squel=require(_0x9ea0('0x7'));var crypto=require(_0x9ea0('0x8'));var jsforce=require(_0x9ea0('0x9'));var deskjs=require(_0x9ea0('0xa'));var toCsv=require(_0x9ea0('0xb'));var querystring=require(_0x9ea0('0xc'));var Papa=require('papaparse');var Redis=require(_0x9ea0('0xd'));var authService=require(_0x9ea0('0xe'));var qs=require(_0x9ea0('0xf'));var as=require(_0x9ea0('0x10'));var hardwareService=require(_0x9ea0('0x11'));var logger=require('../../config/logger')(_0x9ea0('0x12'));var utils=require(_0x9ea0('0x13'));var config=require(_0x9ea0('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9ea0('0x15'))['db'];function respondWithStatusCode(_0x4b6218,_0x50a847){_0x50a847=_0x50a847||0xcc;return function(_0x3d93b2){if(_0x3d93b2){return _0x4b6218['sendStatus'](_0x50a847);}return _0x4b6218[_0x9ea0('0x16')](_0x50a847)[_0x9ea0('0x17')]();};}function respondWithResult(_0x2bfc34,_0x310b61){_0x310b61=_0x310b61||0xc8;return function(_0x435362){if(_0x435362){return _0x2bfc34[_0x9ea0('0x16')](_0x310b61)[_0x9ea0('0x18')](_0x435362);}};}function respondWithFilteredResult(_0x57181f,_0x423832){return function(_0x2c7177){if(_0x2c7177){var _0xf15b45=_0x2c7177[_0x9ea0('0x19')],_0x1f7600=_0x423832['offset'],_0x477151=_0x423832[_0x9ea0('0x1a')]+_0x423832['limit'],_0x2ce7ae;if(_0x477151>=_0xf15b45){_0x477151=_0xf15b45;_0x2ce7ae=0xc8;}else{_0x2ce7ae=0xce;}_0x57181f['status'](_0x2ce7ae);return _0x57181f[_0x9ea0('0x1b')](_0x9ea0('0x1c'),_0x1f7600+'-'+_0x477151+'/'+_0xf15b45)[_0x9ea0('0x18')](_0x2c7177);}return null;};}function patchUpdates(_0x394190){return function(_0x207672){try{jsonpatch[_0x9ea0('0x1d')](_0x207672,_0x394190,!![]);}catch(_0xfefdb4){return BPromise[_0x9ea0('0x1e')](_0xfefdb4);}return _0x207672[_0x9ea0('0x1f')]();};}function saveUpdates(_0x544fd0,_0x34211c){return function(_0x27a057){if(_0x27a057){return _0x27a057[_0x9ea0('0x20')](_0x544fd0)[_0x9ea0('0x21')](function(_0x5c9c43){return _0x5c9c43;});}return null;};}function removeEntity(_0x5ee2d8,_0x4c91db){return function(_0x4c639b){if(_0x4c639b){return _0x4c639b[_0x9ea0('0x22')]()[_0x9ea0('0x21')](function(){var _0x22c54c=_0x4c639b['get']({'plain':!![]});var _0x3f2a60=_0x9ea0('0x23');return db[_0x9ea0('0x24')]['destroy']({'where':{'type':_0x3f2a60,'resourceId':_0x22c54c['id']}})[_0x9ea0('0x21')](function(){return _0x4c639b;});})['then'](function(){_0x5ee2d8[_0x9ea0('0x16')](0xcc)[_0x9ea0('0x17')]();});}};}function handleEntityNotFound(_0x363293,_0x182935){return function(_0x5090a1){if(!_0x5090a1){_0x363293[_0x9ea0('0x25')](0x194);}return _0x5090a1;};}function handleError(_0x47e800,_0x410340){_0x410340=_0x410340||0x1f4;return function(_0xa06d33){logger['error'](_0xa06d33[_0x9ea0('0x26')]);if(_0xa06d33['name']){delete _0xa06d33[_0x9ea0('0x27')];}_0x47e800[_0x9ea0('0x16')](_0x410340)['send'](_0xa06d33);};}exports[_0x9ea0('0x28')]=function(_0x353727,_0x3b0aca){var _0x117dd9={},_0x21b08b={},_0x1b1663={'count':0x0,'rows':[]};var _0x357ab4=_['map'](db[_0x9ea0('0x29')][_0x9ea0('0x2a')],function(_0x1d43e5){return{'name':_0x1d43e5[_0x9ea0('0x2b')],'type':_0x1d43e5[_0x9ea0('0x2c')][_0x9ea0('0x2d')]};});_0x21b08b['model']=_[_0x9ea0('0x2e')](_0x357ab4,_0x9ea0('0x27'));_0x21b08b[_0x9ea0('0x2f')]=_[_0x9ea0('0x30')](_0x353727[_0x9ea0('0x2f')]);_0x21b08b[_0x9ea0('0x31')]=_[_0x9ea0('0x32')](_0x21b08b[_0x9ea0('0x33')],_0x21b08b['query']);_0x117dd9[_0x9ea0('0x34')]=_[_0x9ea0('0x32')](_0x21b08b[_0x9ea0('0x33')],qs[_0x9ea0('0x35')](_0x353727[_0x9ea0('0x2f')]['fields']));_0x117dd9[_0x9ea0('0x34')]=_0x117dd9[_0x9ea0('0x34')][_0x9ea0('0x36')]?_0x117dd9['attributes']:_0x21b08b[_0x9ea0('0x33')];if(!_0x353727[_0x9ea0('0x2f')]['hasOwnProperty']('nolimit')){_0x117dd9['limit']=qs[_0x9ea0('0x37')](_0x353727[_0x9ea0('0x2f')]['limit']);_0x117dd9[_0x9ea0('0x1a')]=qs[_0x9ea0('0x1a')](_0x353727[_0x9ea0('0x2f')][_0x9ea0('0x1a')]);}_0x117dd9[_0x9ea0('0x38')]=qs[_0x9ea0('0x39')](_0x353727[_0x9ea0('0x2f')][_0x9ea0('0x39')]);_0x117dd9[_0x9ea0('0x3a')]=qs[_0x9ea0('0x31')](_[_0x9ea0('0x3b')](_0x353727['query'],_0x21b08b['filters']),_0x357ab4);if(_0x353727['query'][_0x9ea0('0x3c')]){_0x117dd9['where']=_[_0x9ea0('0x3d')](_0x117dd9[_0x9ea0('0x3a')],{'$or':_['map'](_0x357ab4,function(_0x22d0ae){if(_0x22d0ae[_0x9ea0('0x2c')]!==_0x9ea0('0x3e')){var _0x187728={};_0x187728[_0x22d0ae[_0x9ea0('0x27')]]={'$like':'%'+_0x353727[_0x9ea0('0x2f')]['filter']+'%'};return _0x187728;}})});}_0x117dd9=_[_0x9ea0('0x3d')]({},_0x117dd9,_0x353727[_0x9ea0('0x3f')]);var _0x388f01={'where':_0x117dd9['where']};return db[_0x9ea0('0x29')]['count'](_0x388f01)['then'](function(_0x13a63e){_0x1b1663[_0x9ea0('0x19')]=_0x13a63e;if(_0x353727[_0x9ea0('0x2f')][_0x9ea0('0x40')]){_0x117dd9[_0x9ea0('0x41')]=[{'all':!![]}];}return db['Campaign'][_0x9ea0('0x42')](_0x117dd9);})[_0x9ea0('0x21')](function(_0x37ed8){_0x1b1663[_0x9ea0('0x43')]=_0x37ed8;return _0x1b1663;})[_0x9ea0('0x21')](respondWithFilteredResult(_0x3b0aca,_0x117dd9))[_0x9ea0('0x44')](handleError(_0x3b0aca,null));};exports[_0x9ea0('0x45')]=function(_0x39fec7,_0x3c9929){var _0x35821d={'raw':![],'where':{'id':_0x39fec7[_0x9ea0('0x46')]['id']}},_0x6fc60e={};_0x6fc60e[_0x9ea0('0x33')]=_['keys'](db[_0x9ea0('0x29')][_0x9ea0('0x2a')]);_0x6fc60e['query']=_[_0x9ea0('0x30')](_0x39fec7[_0x9ea0('0x2f')]);_0x6fc60e[_0x9ea0('0x31')]=_[_0x9ea0('0x32')](_0x6fc60e['model'],_0x6fc60e[_0x9ea0('0x2f')]);_0x35821d['attributes']=_['intersection'](_0x6fc60e[_0x9ea0('0x33')],qs[_0x9ea0('0x35')](_0x39fec7[_0x9ea0('0x2f')][_0x9ea0('0x35')]));_0x35821d[_0x9ea0('0x34')]=_0x35821d['attributes'][_0x9ea0('0x36')]?_0x35821d[_0x9ea0('0x34')]:_0x6fc60e[_0x9ea0('0x33')];if(_0x39fec7[_0x9ea0('0x2f')][_0x9ea0('0x40')]){_0x35821d[_0x9ea0('0x41')]=[{'all':!![]}];}_0x35821d=_[_0x9ea0('0x3d')]({},_0x35821d,_0x39fec7[_0x9ea0('0x3f')]);return db[_0x9ea0('0x29')][_0x9ea0('0x47')](_0x35821d)[_0x9ea0('0x21')](handleEntityNotFound(_0x3c9929,null))['then'](respondWithResult(_0x3c9929,null))[_0x9ea0('0x44')](handleError(_0x3c9929,null));};exports['create']=function(_0x18f085,_0x2e553e){return db[_0x9ea0('0x29')][_0x9ea0('0x48')](_0x18f085['body'],{})[_0x9ea0('0x21')](function(_0xae1354){var _0x4f787c=_0x18f085[_0x9ea0('0x49')][_0x9ea0('0x4a')]({'plain':!![]});if(!_0x4f787c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f787c['role']==='user'){var _0x232713=_0xae1354[_0x9ea0('0x4a')]({'plain':!![]});var _0x3b8f88=_0x9ea0('0x23');return db['UserProfileSection'][_0x9ea0('0x47')]({'where':{'name':_0x3b8f88,'userProfileId':_0x4f787c[_0x9ea0('0x4b')]},'raw':!![]})[_0x9ea0('0x21')](function(_0x5967da){if(_0x5967da&&_0x5967da[_0x9ea0('0x4c')]===0x0){return db[_0x9ea0('0x24')][_0x9ea0('0x48')]({'name':_0x232713[_0x9ea0('0x27')],'resourceId':_0x232713['id'],'type':_0x5967da[_0x9ea0('0x27')],'sectionId':_0x5967da['id']},{})[_0x9ea0('0x21')](function(){return _0xae1354;});}else{return _0xae1354;}})[_0x9ea0('0x44')](function(_0x13fc77){logger[_0x9ea0('0x4d')](_0x9ea0('0x4e'),_0x13fc77);throw _0x13fc77;});}return _0xae1354;})['then'](respondWithResult(_0x2e553e,0xc9))[_0x9ea0('0x44')](handleError(_0x2e553e,null));};exports[_0x9ea0('0x4f')]=function(_0x5b66a8,_0x4f46f4){var _0x13593a={'where':{'id':_0x5b66a8[_0x9ea0('0x46')]['id']}},_0x2244f7={};_0x2244f7[_0x9ea0('0x33')]=_[_0x9ea0('0x30')](db[_0x9ea0('0x29')][_0x9ea0('0x2a')]);_0x13593a[_0x9ea0('0x34')]=_[_0x9ea0('0x32')](_0x2244f7['model'],qs['fields'](_0x5b66a8[_0x9ea0('0x2f')]['fields']));_0x13593a['attributes']=_0x13593a[_0x9ea0('0x34')][_0x9ea0('0x36')]?_0x13593a[_0x9ea0('0x34')]:_0x2244f7[_0x9ea0('0x33')];if(_0x5b66a8['query'][_0x9ea0('0x40')]){_0x13593a[_0x9ea0('0x41')]=[{'all':!![]}];}_0x13593a=_['merge']({},_0x13593a,_0x5b66a8[_0x9ea0('0x3f')]);return db[_0x9ea0('0x29')]['find'](_0x13593a)[_0x9ea0('0x21')](handleEntityNotFound(_0x4f46f4,null))[_0x9ea0('0x21')](function(_0x406081){if(_0x406081){var _0x2c2df7=_0x406081[_0x9ea0('0x4a')]({'plain':!![]});_0x2c2df7=qs[_0x9ea0('0x50')](_0x2c2df7,['id',_0x9ea0('0x51'),_0x9ea0('0x52')]);_0x5b66a8[_0x9ea0('0x53')]=_[_0x9ea0('0x50')](_0x5b66a8[_0x9ea0('0x53')],['id',_0x9ea0('0x51'),_0x9ea0('0x52')]);return db[_0x9ea0('0x29')]['create'](_[_0x9ea0('0x3d')](_0x2c2df7,_0x5b66a8[_0x9ea0('0x53')]),{'include':_0x5b66a8[_0x9ea0('0x2f')][_0x9ea0('0x40')]?[{'all':!![]}]:undefined})['then'](function(_0x509dd4){var _0x40aea7=_0x5b66a8[_0x9ea0('0x49')]['get']({'plain':!![]});if(!_0x40aea7)throw new Error(_0x9ea0('0x54'));if(_0x40aea7[_0x9ea0('0x55')]==='user'){var _0x509b05=_0x509dd4[_0x9ea0('0x4a')]({'plain':!![]});var _0x1ea7ae=_0x9ea0('0x23');return db[_0x9ea0('0x56')][_0x9ea0('0x47')]({'where':{'name':_0x1ea7ae,'userProfileId':_0x40aea7[_0x9ea0('0x4b')]},'raw':!![]})[_0x9ea0('0x21')](function(_0x46c4a6){if(_0x46c4a6&&_0x46c4a6[_0x9ea0('0x4c')]===0x0){return db[_0x9ea0('0x24')][_0x9ea0('0x48')]({'name':_0x509b05[_0x9ea0('0x27')],'resourceId':_0x509b05['id'],'type':_0x46c4a6['name'],'sectionId':_0x46c4a6['id']},{})[_0x9ea0('0x21')](function(){return _0x509dd4;});}else{return _0x509dd4;}})[_0x9ea0('0x44')](function(_0x46b91c){logger[_0x9ea0('0x4d')](_0x9ea0('0x4e'),_0x46b91c);throw _0x46b91c;});}return _0x509dd4;});}})['then'](respondWithResult(_0x4f46f4,0xc9))[_0x9ea0('0x44')](handleError(_0x4f46f4,null));};exports[_0x9ea0('0x20')]=function(_0x8b4905,_0x1d6d33){if(_0x8b4905[_0x9ea0('0x53')]['id']){delete _0x8b4905['body']['id'];}return db[_0x9ea0('0x29')][_0x9ea0('0x47')]({'where':{'id':_0x8b4905[_0x9ea0('0x46')]['id']}})['then'](handleEntityNotFound(_0x1d6d33,null))[_0x9ea0('0x21')](saveUpdates(_0x8b4905[_0x9ea0('0x53')],null))[_0x9ea0('0x21')](respondWithResult(_0x1d6d33,null))[_0x9ea0('0x44')](handleError(_0x1d6d33,null));};exports[_0x9ea0('0x22')]=function(_0x4b0e5f,_0x1c4c1a){return db[_0x9ea0('0x29')][_0x9ea0('0x47')]({'where':{'id':_0x4b0e5f[_0x9ea0('0x46')]['id']}})[_0x9ea0('0x21')](handleEntityNotFound(_0x1c4c1a,null))[_0x9ea0('0x21')](removeEntity(_0x1c4c1a,null))[_0x9ea0('0x44')](handleError(_0x1c4c1a,null));};exports[_0x9ea0('0x57')]=function(_0x232222,_0x4b946a,_0x1faa52){var _0x5deda3={'raw':!![],'where':{}};var _0x5e32db={};var _0x623241={'count':0x0,'rows':[]};return db[_0x9ea0('0x29')]['findOne']({'where':{'id':_0x232222[_0x9ea0('0x46')]['id']}})[_0x9ea0('0x21')](handleEntityNotFound(_0x4b946a,null))['then'](function(_0x516038){if(_0x516038){_0x5e32db['model']=_[_0x9ea0('0x30')](db[_0x9ea0('0x58')]['rawAttributes']);_0x5e32db['query']=_['keys'](_0x232222[_0x9ea0('0x2f')]);_0x5e32db[_0x9ea0('0x31')]=_[_0x9ea0('0x32')](_0x5e32db[_0x9ea0('0x33')],_0x5e32db[_0x9ea0('0x2f')]);_0x5deda3[_0x9ea0('0x34')]=_[_0x9ea0('0x32')](_0x5e32db['model'],qs[_0x9ea0('0x35')](_0x232222[_0x9ea0('0x2f')][_0x9ea0('0x35')]));_0x5deda3[_0x9ea0('0x34')]=_0x5deda3['attributes'][_0x9ea0('0x36')]?_0x5deda3[_0x9ea0('0x34')]:_0x5e32db['model'];if(!_0x232222[_0x9ea0('0x2f')][_0x9ea0('0x59')](_0x9ea0('0x5a'))){_0x5deda3['limit']=qs[_0x9ea0('0x37')](_0x232222[_0x9ea0('0x2f')][_0x9ea0('0x37')]);_0x5deda3[_0x9ea0('0x1a')]=qs['offset'](_0x232222[_0x9ea0('0x2f')][_0x9ea0('0x1a')]);}_0x5deda3['order']=qs['sort'](_0x232222[_0x9ea0('0x2f')][_0x9ea0('0x39')]);_0x5deda3['where']=qs['filters'](_['pick'](_0x232222['query'],_0x5e32db['filters']));_0x5deda3['where'][_0x9ea0('0x5b')]=_0x516038['id'];if(_0x232222['query'][_0x9ea0('0x3c')]){_0x5deda3[_0x9ea0('0x3a')]=_[_0x9ea0('0x3d')](_0x5deda3[_0x9ea0('0x3a')],{'$or':_['map'](_0x5deda3[_0x9ea0('0x34')],function(_0x35f3c2){var _0x39076e={};_0x39076e[_0x35f3c2]={'$like':'%'+_0x232222[_0x9ea0('0x2f')][_0x9ea0('0x3c')]+'%'};return _0x39076e;})});}_0x5deda3=_['merge']({},_0x5deda3,_0x232222[_0x9ea0('0x3f')]);return db['CmHopper'][_0x9ea0('0x19')]({'where':_0x5deda3[_0x9ea0('0x3a')]})[_0x9ea0('0x21')](function(_0x1dde38){_0x623241[_0x9ea0('0x19')]=_0x1dde38;if(_0x232222['query'][_0x9ea0('0x40')]){_0x5deda3['include']=[{'all':!![]}];}return db[_0x9ea0('0x58')][_0x9ea0('0x42')](_0x5deda3);})['then'](function(_0x3f7a55){_0x623241[_0x9ea0('0x43')]=_0x3f7a55;return _0x623241;});}})[_0x9ea0('0x21')](respondWithFilteredResult(_0x4b946a,_0x5deda3))[_0x9ea0('0x44')](handleError(_0x4b946a,null));};exports[_0x9ea0('0x5c')]=function(_0x30347d,_0x99b6a,_0x33a912){var _0x7a292={'raw':!![],'where':{}};var _0x454610={};var _0x127b8e={'count':0x0,'rows':[]};return db[_0x9ea0('0x29')]['findOne']({'where':{'id':_0x30347d[_0x9ea0('0x46')]['id']}})[_0x9ea0('0x21')](handleEntityNotFound(_0x99b6a,null))['then'](function(_0x7fd05d){if(_0x7fd05d){_0x454610[_0x9ea0('0x33')]=_[_0x9ea0('0x30')](db['CmHopperHistory'][_0x9ea0('0x2a')]);_0x454610[_0x9ea0('0x2f')]=_['keys'](_0x30347d[_0x9ea0('0x2f')]);_0x454610[_0x9ea0('0x31')]=_[_0x9ea0('0x32')](_0x454610[_0x9ea0('0x33')],_0x454610[_0x9ea0('0x2f')]);_0x7a292[_0x9ea0('0x34')]=_['intersection'](_0x454610[_0x9ea0('0x33')],qs[_0x9ea0('0x35')](_0x30347d[_0x9ea0('0x2f')][_0x9ea0('0x35')]));_0x7a292[_0x9ea0('0x34')]=_0x7a292['attributes'][_0x9ea0('0x36')]?_0x7a292['attributes']:_0x454610['model'];if(!_0x30347d['query'][_0x9ea0('0x59')](_0x9ea0('0x5a'))){_0x7a292[_0x9ea0('0x37')]=qs[_0x9ea0('0x37')](_0x30347d['query']['limit']);_0x7a292['offset']=qs['offset'](_0x30347d['query']['offset']);}_0x7a292[_0x9ea0('0x38')]=qs['sort'](_0x30347d['query'][_0x9ea0('0x39')]);_0x7a292['where']=qs['filters'](_[_0x9ea0('0x3b')](_0x30347d[_0x9ea0('0x2f')],_0x454610[_0x9ea0('0x31')]));_0x7a292['where'][_0x9ea0('0x5b')]=_0x7fd05d['id'];if(_0x30347d[_0x9ea0('0x2f')][_0x9ea0('0x3c')]){_0x7a292[_0x9ea0('0x3a')]=_['merge'](_0x7a292[_0x9ea0('0x3a')],{'$or':_[_0x9ea0('0x2e')](_0x7a292[_0x9ea0('0x34')],function(_0x5cc49b){var _0x15cb50={};_0x15cb50[_0x5cc49b]={'$like':'%'+_0x30347d[_0x9ea0('0x2f')]['filter']+'%'};return _0x15cb50;})});}_0x7a292=_[_0x9ea0('0x3d')]({},_0x7a292,_0x30347d[_0x9ea0('0x3f')]);return db[_0x9ea0('0x5d')][_0x9ea0('0x19')]({'where':_0x7a292['where']})[_0x9ea0('0x21')](function(_0x5c34cb){_0x127b8e[_0x9ea0('0x19')]=_0x5c34cb;if(_0x30347d['query']['includeAll']){_0x7a292[_0x9ea0('0x41')]=[{'all':!![]}];}return db[_0x9ea0('0x5d')][_0x9ea0('0x42')](_0x7a292);})[_0x9ea0('0x21')](function(_0x1b45b1){_0x127b8e[_0x9ea0('0x43')]=_0x1b45b1;return _0x127b8e;});}})[_0x9ea0('0x21')](respondWithFilteredResult(_0x99b6a,_0x7a292))['catch'](handleError(_0x99b6a,null));};exports[_0x9ea0('0x5e')]=function(_0x4099fe,_0x28f2a8,_0x53d7f3){var _0xb9a960={'raw':!![],'where':{}};var _0x34ece0={};var _0x4da768={'count':0x0,'rows':[]};return db['Campaign'][_0x9ea0('0x5f')]({'where':{'id':_0x4099fe[_0x9ea0('0x46')]['id']}})[_0x9ea0('0x21')](handleEntityNotFound(_0x28f2a8,null))[_0x9ea0('0x21')](function(_0x2074fb){if(_0x2074fb){_0x34ece0[_0x9ea0('0x33')]=_[_0x9ea0('0x30')](db[_0x9ea0('0x60')][_0x9ea0('0x2a')]);_0x34ece0['query']=_['keys'](_0x4099fe[_0x9ea0('0x2f')]);_0x34ece0[_0x9ea0('0x31')]=_['intersection'](_0x34ece0[_0x9ea0('0x33')],_0x34ece0[_0x9ea0('0x2f')]);_0xb9a960['attributes']=_[_0x9ea0('0x32')](_0x34ece0[_0x9ea0('0x33')],qs['fields'](_0x4099fe[_0x9ea0('0x2f')][_0x9ea0('0x35')]));_0xb9a960['attributes']=_0xb9a960[_0x9ea0('0x34')][_0x9ea0('0x36')]?_0xb9a960[_0x9ea0('0x34')]:_0x34ece0['model'];if(!_0x4099fe[_0x9ea0('0x2f')][_0x9ea0('0x59')](_0x9ea0('0x5a'))){_0xb9a960[_0x9ea0('0x37')]=qs['limit'](_0x4099fe[_0x9ea0('0x2f')]['limit']);_0xb9a960[_0x9ea0('0x1a')]=qs[_0x9ea0('0x1a')](_0x4099fe['query'][_0x9ea0('0x1a')]);}_0xb9a960['order']=qs[_0x9ea0('0x39')](_0x4099fe[_0x9ea0('0x2f')]['sort']);_0xb9a960['where']=qs[_0x9ea0('0x31')](_[_0x9ea0('0x3b')](_0x4099fe[_0x9ea0('0x2f')],_0x34ece0[_0x9ea0('0x31')]));_0xb9a960[_0x9ea0('0x3a')]['CampaignId']=_0x2074fb['id'];if(_0x4099fe[_0x9ea0('0x2f')][_0x9ea0('0x3c')]){_0xb9a960[_0x9ea0('0x3a')]=_['merge'](_0xb9a960[_0x9ea0('0x3a')],{'$or':_[_0x9ea0('0x2e')](_0xb9a960[_0x9ea0('0x34')],function(_0x3fcaef){var _0x40c042={};_0x40c042[_0x3fcaef]={'$like':'%'+_0x4099fe[_0x9ea0('0x2f')][_0x9ea0('0x3c')]+'%'};return _0x40c042;})});}_0xb9a960=_[_0x9ea0('0x3d')]({},_0xb9a960,_0x4099fe[_0x9ea0('0x3f')]);return db[_0x9ea0('0x60')][_0x9ea0('0x19')]({'where':_0xb9a960['where']})[_0x9ea0('0x21')](function(_0x56e33f){_0x4da768[_0x9ea0('0x19')]=_0x56e33f;if(_0x4099fe[_0x9ea0('0x2f')]['includeAll']){_0xb9a960[_0x9ea0('0x41')]=[{'all':!![]}];}return db[_0x9ea0('0x60')][_0x9ea0('0x42')](_0xb9a960);})[_0x9ea0('0x21')](function(_0xdccc7b){_0x4da768[_0x9ea0('0x43')]=_0xdccc7b;return _0x4da768;});}})[_0x9ea0('0x21')](respondWithFilteredResult(_0x28f2a8,_0xb9a960))['catch'](handleError(_0x28f2a8,null));};exports[_0x9ea0('0x61')]=function(_0x5dad67,_0x358f5b,_0x3e6bed){var _0x3b758b={'raw':!![],'where':{}};var _0x5ad665={};var _0x3578c3={'count':0x0,'rows':[]};return db['Campaign'][_0x9ea0('0x5f')]({'where':{'id':_0x5dad67['params']['id']}})[_0x9ea0('0x21')](handleEntityNotFound(_0x358f5b,null))[_0x9ea0('0x21')](function(_0x1b8ae4){if(_0x1b8ae4){_0x5ad665[_0x9ea0('0x33')]=_['keys'](db[_0x9ea0('0x62')][_0x9ea0('0x2a')]);_0x5ad665[_0x9ea0('0x2f')]=_[_0x9ea0('0x30')](_0x5dad67[_0x9ea0('0x2f')]);_0x5ad665[_0x9ea0('0x31')]=_[_0x9ea0('0x32')](_0x5ad665[_0x9ea0('0x33')],_0x5ad665[_0x9ea0('0x2f')]);_0x3b758b['attributes']=_['intersection'](_0x5ad665['model'],qs[_0x9ea0('0x35')](_0x5dad67[_0x9ea0('0x2f')][_0x9ea0('0x35')]));_0x3b758b['attributes']=_0x3b758b[_0x9ea0('0x34')][_0x9ea0('0x36')]?_0x3b758b[_0x9ea0('0x34')]:_0x5ad665[_0x9ea0('0x33')];if(!_0x5dad67['query'][_0x9ea0('0x59')](_0x9ea0('0x5a'))){_0x3b758b[_0x9ea0('0x37')]=qs[_0x9ea0('0x37')](_0x5dad67['query'][_0x9ea0('0x37')]);_0x3b758b['offset']=qs[_0x9ea0('0x1a')](_0x5dad67[_0x9ea0('0x2f')][_0x9ea0('0x1a')]);}_0x3b758b[_0x9ea0('0x38')]=qs[_0x9ea0('0x39')](_0x5dad67[_0x9ea0('0x2f')][_0x9ea0('0x39')]);_0x3b758b[_0x9ea0('0x3a')]=qs['filters'](_['pick'](_0x5dad67['query'],_0x5ad665[_0x9ea0('0x31')]));_0x3b758b[_0x9ea0('0x3a')][_0x9ea0('0x5b')]=_0x1b8ae4['id'];if(_0x5dad67[_0x9ea0('0x2f')][_0x9ea0('0x3c')]){_0x3b758b[_0x9ea0('0x3a')]=_[_0x9ea0('0x3d')](_0x3b758b[_0x9ea0('0x3a')],{'$or':_['map'](_0x3b758b[_0x9ea0('0x34')],function(_0xc25fab){var _0x303cd3={};_0x303cd3[_0xc25fab]={'$like':'%'+_0x5dad67[_0x9ea0('0x2f')]['filter']+'%'};return _0x303cd3;})});}_0x3b758b=_[_0x9ea0('0x3d')]({},_0x3b758b,_0x5dad67[_0x9ea0('0x3f')]);return db['CmHopperBlack']['count']({'where':_0x3b758b['where']})[_0x9ea0('0x21')](function(_0x5ea1d4){_0x3578c3[_0x9ea0('0x19')]=_0x5ea1d4;if(_0x5dad67['query']['includeAll']){_0x3b758b[_0x9ea0('0x41')]=[{'all':!![]}];}return db[_0x9ea0('0x62')][_0x9ea0('0x42')](_0x3b758b);})[_0x9ea0('0x21')](function(_0xeffe08){_0x3578c3[_0x9ea0('0x43')]=_0xeffe08;return _0x3578c3;});}})[_0x9ea0('0x21')](respondWithFilteredResult(_0x358f5b,_0x3b758b))['catch'](handleError(_0x358f5b,null));};exports[_0x9ea0('0x63')]=function(_0x316e5d,_0x343658,_0x3123d6){var _0x33f1d1={};var _0x5640a0={};var _0x28e0fc;var _0x4b3a22;return db[_0x9ea0('0x29')][_0x9ea0('0x5f')]({'where':{'id':_0x316e5d['params']['id']}})['then'](handleEntityNotFound(_0x343658,null))['then'](function(_0x2bf55f){if(_0x2bf55f){_0x28e0fc=_0x2bf55f;_0x5640a0[_0x9ea0('0x33')]=_[_0x9ea0('0x30')](db[_0x9ea0('0x64')]['rawAttributes']);_0x5640a0['query']=_[_0x9ea0('0x30')](_0x316e5d['query']);_0x5640a0['filters']=_[_0x9ea0('0x32')](_0x5640a0['model'],_0x5640a0['query']);_0x33f1d1[_0x9ea0('0x34')]=_[_0x9ea0('0x32')](_0x5640a0[_0x9ea0('0x33')],qs[_0x9ea0('0x35')](_0x316e5d['query'][_0x9ea0('0x35')]));_0x33f1d1[_0x9ea0('0x34')]=_0x33f1d1[_0x9ea0('0x34')][_0x9ea0('0x36')]?_0x33f1d1[_0x9ea0('0x34')]:_0x5640a0[_0x9ea0('0x33')];_0x33f1d1[_0x9ea0('0x38')]=qs[_0x9ea0('0x39')](_0x316e5d[_0x9ea0('0x2f')][_0x9ea0('0x39')]);_0x33f1d1[_0x9ea0('0x3a')]=qs['filters'](_[_0x9ea0('0x3b')](_0x316e5d['query'],_0x5640a0[_0x9ea0('0x31')]));if(_0x316e5d[_0x9ea0('0x2f')][_0x9ea0('0x3c')]){_0x33f1d1[_0x9ea0('0x3a')]=_[_0x9ea0('0x3d')](_0x33f1d1[_0x9ea0('0x3a')],{'$or':_[_0x9ea0('0x2e')](_0x33f1d1[_0x9ea0('0x34')],function(_0x3d04e7){var _0xf3cffc={};_0xf3cffc[_0x3d04e7]={'$like':'%'+_0x316e5d[_0x9ea0('0x2f')][_0x9ea0('0x3c')]+'%'};return _0xf3cffc;})});}_0x33f1d1=_[_0x9ea0('0x3d')]({},_0x33f1d1,_0x316e5d[_0x9ea0('0x3f')]);return _0x28e0fc[_0x9ea0('0x63')](_0x33f1d1);}})[_0x9ea0('0x21')](function(_0x4e97e6){if(_0x4e97e6){_0x4b3a22=_0x4e97e6[_0x9ea0('0x36')];if(!_0x316e5d[_0x9ea0('0x2f')][_0x9ea0('0x59')](_0x9ea0('0x5a'))){_0x33f1d1[_0x9ea0('0x37')]=qs['limit'](_0x316e5d[_0x9ea0('0x2f')][_0x9ea0('0x37')]);_0x33f1d1[_0x9ea0('0x1a')]=qs['offset'](_0x316e5d[_0x9ea0('0x2f')][_0x9ea0('0x1a')]);}return _0x28e0fc['getLists'](_0x33f1d1);}})['then'](function(_0x152e1d){if(_0x152e1d){return _0x152e1d?{'count':_0x4b3a22,'rows':_0x152e1d}:null;}})[_0x9ea0('0x21')](respondWithResult(_0x343658,null))[_0x9ea0('0x44')](handleError(_0x343658,null));};exports['addLists']=function(_0x2b7c05,_0x345c76,_0x71e672){var _0x310d9c,_0x54b122;return db[_0x9ea0('0x29')]['find']({'where':{'id':_0x2b7c05['params']['id']}})[_0x9ea0('0x21')](handleEntityNotFound(_0x345c76,null))['then'](function(_0x59e09c){if(_0x59e09c){_0x54b122=_0x59e09c;return _0x59e09c[_0x9ea0('0x65')](_0x2b7c05['body'][_0x9ea0('0x66')],_[_0x9ea0('0x50')](_0x2b7c05[_0x9ea0('0x53')],['ids','id'])||{});}return null;})[_0x9ea0('0x67')](function(_0x2593b1){var _0x357b1b;_0x310d9c=_0x2593b1||[];var _0x253799=[];if(_0x2593b1){for(var _0x539251=0x0;_0x539251<_0x2593b1[_0x9ea0('0x36')];_0x539251+=0x1){var _0x562030=_0x2593b1[_0x539251][_0x9ea0('0x4a')]({'plain':!![]});_0x54b122[_0x9ea0('0x68')]=_0x2b7c05[_0x9ea0('0x53')]['dialCheckDuplicateType']?_0x2b7c05[_0x9ea0('0x53')]['dialCheckDuplicateType']:_0x54b122[_0x9ea0('0x68')];switch(_0x54b122[_0x9ea0('0x68')]){case _0x9ea0('0x69'):_0x357b1b=squel['insert']()[_0x9ea0('0x6a')](_0x9ea0('0x6b'))[_0x9ea0('0x6c')]([_0x9ea0('0x6d'),_0x9ea0('0x6e'),_0x9ea0('0x6f'),'ListId',_0x9ea0('0x5b'),_0x9ea0('0x51'),_0x9ea0('0x52')],squel['select']()[_0x9ea0('0x70')](_0x9ea0('0x6d'),_0x9ea0('0x6d'))['field'](_0x9ea0('0x71'),_0x9ea0('0x6e'))['field']('id','ContactId')[_0x9ea0('0x70')](_0x562030['CmListId']['toString'](),_0x9ea0('0x72'))[_0x9ea0('0x70')](_0x2b7c05[_0x9ea0('0x46')]['id'][_0x9ea0('0x73')](),'CampaignId')[_0x9ea0('0x70')](_0x9ea0('0x71'),_0x9ea0('0x51'))[_0x9ea0('0x70')](_0x9ea0('0x71'),_0x9ea0('0x52'))[_0x9ea0('0x74')](_0x9ea0('0x75'))[_0x9ea0('0x3a')]('deletedAt\x20IS\x20NULL')[_0x9ea0('0x3a')](_0x9ea0('0x76'),_0x562030[_0x9ea0('0x77')]['toString']())[_0x9ea0('0x3a')](_0x9ea0('0x78'))[_0x9ea0('0x3a')](_0x9ea0('0x79'),squel[_0x9ea0('0x7a')]()[_0x9ea0('0x70')](_0x9ea0('0x7b'))[_0x9ea0('0x74')](_0x9ea0('0x7c'))[_0x9ea0('0x3a')](_0x9ea0('0x7d'),_0x2b7c05[_0x9ea0('0x46')]['id']['toString']()))[_0x9ea0('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0x9ea0('0x7a')]()[_0x9ea0('0x70')](_0x9ea0('0x7e'))[_0x9ea0('0x74')]('cm_hopper')[_0x9ea0('0x3a')]('CampaignId\x20=\x20?',_0x2b7c05[_0x9ea0('0x46')]['id'][_0x9ea0('0x73')]())))[_0x9ea0('0x73')]();break;case _0x9ea0('0x7f'):_0x357b1b=squel[_0x9ea0('0x80')]()[_0x9ea0('0x6a')](_0x9ea0('0x6b'))[_0x9ea0('0x6c')]([_0x9ea0('0x6d'),'scheduledAt',_0x9ea0('0x6f'),_0x9ea0('0x72'),_0x9ea0('0x5b'),'createdAt',_0x9ea0('0x52')],squel[_0x9ea0('0x7a')]()['field'](_0x9ea0('0x6d'),_0x9ea0('0x6d'))[_0x9ea0('0x70')](_0x9ea0('0x71'),_0x9ea0('0x6e'))[_0x9ea0('0x70')]('id','ContactId')[_0x9ea0('0x70')](_0x562030[_0x9ea0('0x77')][_0x9ea0('0x73')](),'ListId')[_0x9ea0('0x70')](_0x2b7c05[_0x9ea0('0x46')]['id'][_0x9ea0('0x73')](),_0x9ea0('0x5b'))['field'](_0x9ea0('0x71'),'createdAt')[_0x9ea0('0x70')]('NOW()',_0x9ea0('0x52'))[_0x9ea0('0x74')]('cm_contacts')[_0x9ea0('0x3a')](_0x9ea0('0x81'))['where'](_0x9ea0('0x76'),_0x562030['CmListId'][_0x9ea0('0x73')]())[_0x9ea0('0x3a')](_0x9ea0('0x78'))['where'](_0x9ea0('0x79'),squel[_0x9ea0('0x7a')]()[_0x9ea0('0x70')]('COALESCE(phone,\x27\x27)')[_0x9ea0('0x74')](_0x9ea0('0x6b'))['where'](_0x9ea0('0x7d'),_0x2b7c05[_0x9ea0('0x46')]['id'][_0x9ea0('0x73')]())))[_0x9ea0('0x73')]();break;default:_0x357b1b=squel[_0x9ea0('0x80')]()[_0x9ea0('0x6a')]('cm_hopper')[_0x9ea0('0x6c')]([_0x9ea0('0x6d'),_0x9ea0('0x6e'),'ContactId',_0x9ea0('0x72'),_0x9ea0('0x5b'),_0x9ea0('0x51'),_0x9ea0('0x52')],squel[_0x9ea0('0x7a')]()[_0x9ea0('0x70')](_0x9ea0('0x6d'),_0x9ea0('0x6d'))['field']('NOW()','scheduledAt')[_0x9ea0('0x70')]('id',_0x9ea0('0x6f'))[_0x9ea0('0x70')](_0x562030[_0x9ea0('0x77')][_0x9ea0('0x73')](),_0x9ea0('0x72'))['field'](_0x2b7c05[_0x9ea0('0x46')]['id'][_0x9ea0('0x73')](),_0x9ea0('0x5b'))[_0x9ea0('0x70')](_0x9ea0('0x71'),'createdAt')[_0x9ea0('0x70')](_0x9ea0('0x71'),_0x9ea0('0x52'))[_0x9ea0('0x74')](_0x9ea0('0x75'))[_0x9ea0('0x3a')](_0x9ea0('0x81'))['where'](_0x9ea0('0x76'),_0x562030['CmListId'][_0x9ea0('0x73')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x9ea0('0x73')]();}_0x253799['push'](db[_0x9ea0('0x82')]['query'](_0x357b1b));}return BPromise[_0x9ea0('0x83')](_0x253799);}})[_0x9ea0('0x21')](function(){return _0x310d9c;})['then'](respondWithResult(_0x345c76,null))[_0x9ea0('0x44')](handleError(_0x345c76,null));};exports[_0x9ea0('0x84')]=function(_0x1d25fa,_0x1420d2,_0x1ac480){return db[_0x9ea0('0x29')][_0x9ea0('0x47')]({'where':{'id':_0x1d25fa[_0x9ea0('0x46')]['id']}})[_0x9ea0('0x21')](handleEntityNotFound(_0x1420d2,null))['then'](function(_0x56a183){if(_0x56a183){return _0x56a183[_0x9ea0('0x84')](_0x1d25fa[_0x9ea0('0x2f')][_0x9ea0('0x66')]);}})[_0x9ea0('0x21')](function(_0x55c059){if(_0x55c059){return db[_0x9ea0('0x58')][_0x9ea0('0x22')]({'where':{'ListId':_0x1d25fa['query'][_0x9ea0('0x66')],'CampaignId':_0x1d25fa[_0x9ea0('0x46')]['id']}})[_0x9ea0('0x21')](function(){return _0x55c059;});}})[_0x9ea0('0x21')](respondWithStatusCode(_0x1420d2,null))[_0x9ea0('0x44')](handleError(_0x1420d2,null));};exports[_0x9ea0('0x85')]=function(_0x598d32,_0x44bb56,_0x288a8a){var _0x245844={};var _0xc4884f={};var _0x49a2a8;var _0x5c96a7;return db[_0x9ea0('0x29')][_0x9ea0('0x5f')]({'where':{'id':_0x598d32[_0x9ea0('0x46')]['id']}})['then'](handleEntityNotFound(_0x44bb56,null))[_0x9ea0('0x21')](function(_0x485bf6){if(_0x485bf6){_0x49a2a8=_0x485bf6;_0xc4884f[_0x9ea0('0x33')]=_[_0x9ea0('0x30')](db['CmList'][_0x9ea0('0x2a')]);_0xc4884f[_0x9ea0('0x2f')]=_[_0x9ea0('0x30')](_0x598d32[_0x9ea0('0x2f')]);_0xc4884f[_0x9ea0('0x31')]=_['intersection'](_0xc4884f[_0x9ea0('0x33')],_0xc4884f[_0x9ea0('0x2f')]);_0x245844[_0x9ea0('0x34')]=_[_0x9ea0('0x32')](_0xc4884f[_0x9ea0('0x33')],qs[_0x9ea0('0x35')](_0x598d32['query'][_0x9ea0('0x35')]));_0x245844[_0x9ea0('0x34')]=_0x245844[_0x9ea0('0x34')][_0x9ea0('0x36')]?_0x245844['attributes']:_0xc4884f[_0x9ea0('0x33')];_0x245844[_0x9ea0('0x38')]=qs['sort'](_0x598d32[_0x9ea0('0x2f')][_0x9ea0('0x39')]);_0x245844[_0x9ea0('0x3a')]=qs[_0x9ea0('0x31')](_['pick'](_0x598d32['query'],_0xc4884f['filters']));if(_0x598d32[_0x9ea0('0x2f')][_0x9ea0('0x3c')]){_0x245844[_0x9ea0('0x3a')]=_[_0x9ea0('0x3d')](_0x245844['where'],{'$or':_[_0x9ea0('0x2e')](_0x245844[_0x9ea0('0x34')],function(_0x509348){var _0x583f15={};_0x583f15[_0x509348]={'$like':'%'+_0x598d32[_0x9ea0('0x2f')][_0x9ea0('0x3c')]+'%'};return _0x583f15;})});}_0x245844=_[_0x9ea0('0x3d')]({},_0x245844,_0x598d32[_0x9ea0('0x3f')]);return _0x49a2a8[_0x9ea0('0x85')](_0x245844);}})[_0x9ea0('0x21')](function(_0x572942){if(_0x572942){_0x5c96a7=_0x572942['length'];if(!_0x598d32[_0x9ea0('0x2f')][_0x9ea0('0x59')]('nolimit')){_0x245844[_0x9ea0('0x37')]=qs['limit'](_0x598d32['query'][_0x9ea0('0x37')]);_0x245844[_0x9ea0('0x1a')]=qs['offset'](_0x598d32[_0x9ea0('0x2f')][_0x9ea0('0x1a')]);}return _0x49a2a8['getBlackLists'](_0x245844);}})[_0x9ea0('0x21')](function(_0x368d75){if(_0x368d75){return _0x368d75?{'count':_0x5c96a7,'rows':_0x368d75}:null;}})[_0x9ea0('0x21')](respondWithResult(_0x44bb56,null))[_0x9ea0('0x44')](handleError(_0x44bb56,null));};exports['addBlackLists']=function(_0x1eda0d,_0x49c82a,_0x47765a){var _0x4aa459,_0x5a149f;return db[_0x9ea0('0x29')][_0x9ea0('0x47')]({'where':{'id':_0x1eda0d[_0x9ea0('0x46')]['id']}})[_0x9ea0('0x21')](handleEntityNotFound(_0x49c82a,null))[_0x9ea0('0x21')](function(_0x3080ea){if(_0x3080ea){_0x5a149f=_0x3080ea;return _0x3080ea[_0x9ea0('0x86')](_0x1eda0d[_0x9ea0('0x53')][_0x9ea0('0x66')],_['omit'](_0x1eda0d[_0x9ea0('0x53')],[_0x9ea0('0x66'),'id'])||{});}return null;})[_0x9ea0('0x67')](function(_0x4fbd54){var _0xd6d6bc;_0x4aa459=_0x4fbd54||[];var _0x4c4e15=[];if(_0x4fbd54){for(var _0x398c74=0x0;_0x398c74<_0x4fbd54['length'];_0x398c74+=0x1){var _0x276454=_0x4fbd54[_0x398c74][_0x9ea0('0x4a')]({'plain':!![]});_0xd6d6bc=squel['insert']()[_0x9ea0('0x6a')](_0x9ea0('0x87'))[_0x9ea0('0x6c')]([_0x9ea0('0x6d'),'ContactId',_0x9ea0('0x72'),_0x9ea0('0x5b'),'createdAt',_0x9ea0('0x52')],squel['select']()['field'](_0x9ea0('0x6d'),_0x9ea0('0x6d'))[_0x9ea0('0x70')]('id','ContactId')[_0x9ea0('0x70')](_0x276454['CmListId']['toString'](),_0x9ea0('0x72'))[_0x9ea0('0x70')](_0x1eda0d[_0x9ea0('0x46')]['id'][_0x9ea0('0x73')](),'CampaignId')[_0x9ea0('0x70')]('NOW()','createdAt')[_0x9ea0('0x70')](_0x9ea0('0x71'),_0x9ea0('0x52'))[_0x9ea0('0x74')]('cm_contacts')[_0x9ea0('0x3a')](_0x9ea0('0x81'))['where'](_0x9ea0('0x76'),_0x276454['CmListId'][_0x9ea0('0x73')]())['where'](_0x9ea0('0x78')))[_0x9ea0('0x73')]();_0x4c4e15[_0x9ea0('0x88')](db[_0x9ea0('0x82')][_0x9ea0('0x2f')](_0xd6d6bc));}return BPromise[_0x9ea0('0x83')](_0x4c4e15);}})[_0x9ea0('0x21')](function(){return _0x4aa459;})['then'](respondWithResult(_0x49c82a,null))[_0x9ea0('0x44')](handleError(_0x49c82a,null));};exports[_0x9ea0('0x89')]=function(_0x182acc,_0x4f4aed,_0x27e489){return db[_0x9ea0('0x29')][_0x9ea0('0x47')]({'where':{'id':_0x182acc[_0x9ea0('0x46')]['id']}})[_0x9ea0('0x21')](handleEntityNotFound(_0x4f4aed,null))[_0x9ea0('0x21')](function(_0xd9fe84){if(_0xd9fe84){return _0xd9fe84[_0x9ea0('0x89')](_0x182acc['query']['ids']);}})[_0x9ea0('0x21')](function(_0x227429){if(_0x227429){return db[_0x9ea0('0x62')][_0x9ea0('0x22')]({'where':{'ListId':_0x182acc[_0x9ea0('0x2f')][_0x9ea0('0x66')],'CampaignId':_0x182acc[_0x9ea0('0x46')]['id']}})['then'](function(){return _0x227429;});}})[_0x9ea0('0x21')](respondWithStatusCode(_0x4f4aed,null))[_0x9ea0('0x44')](handleError(_0x4f4aed,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index bc11b94..69f694d 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 _0x7bca=['campaigns','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign'];(function(_0x479488,_0x14c951){var _0x26ca36=function(_0x3b2b87){while(--_0x3b2b87){_0x479488['push'](_0x479488['shift']());}};_0x26ca36(++_0x14c951);}(_0x7bca,0x1b1));var _0xa7bc=function(_0x2e2c1b,_0x94deaf){_0x2e2c1b=_0x2e2c1b-0x0;var _0x43a4f2=_0x7bca[_0x2e2c1b];return _0x43a4f2;};'use strict';var _=require(_0xa7bc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa7bc('0x1'));var moment=require(_0xa7bc('0x2'));var BPromise=require(_0xa7bc('0x3'));var rp=require(_0xa7bc('0x4'));var fs=require('fs');var path=require(_0xa7bc('0x5'));var rimraf=require(_0xa7bc('0x6'));var config=require(_0xa7bc('0x7'));var attributes=require(_0xa7bc('0x8'));module[_0xa7bc('0x9')]=function(_0x49e061,_0x6a5f44){return _0x49e061['define'](_0xa7bc('0xa'),attributes,{'tableName':_0xa7bc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc97d=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./campaign.attributes','exports','define','Campaign','campaigns','lodash'];(function(_0x41c9f3,_0x2faa06){var _0x40ff6a=function(_0x683795){while(--_0x683795){_0x41c9f3['push'](_0x41c9f3['shift']());}};_0x40ff6a(++_0x2faa06);}(_0xc97d,0x67));var _0xdc97=function(_0x1c82b,_0x1dee8b){_0x1c82b=_0x1c82b-0x0;var _0x5d2dd8=_0xc97d[_0x1c82b];return _0x5d2dd8;};'use strict';var _=require(_0xdc97('0x0'));var util=require(_0xdc97('0x1'));var logger=require(_0xdc97('0x2'))(_0xdc97('0x3'));var moment=require(_0xdc97('0x4'));var BPromise=require(_0xdc97('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc97('0x6'));var rimraf=require('rimraf');var config=require(_0xdc97('0x7'));var attributes=require(_0xdc97('0x8'));module[_0xdc97('0x9')]=function(_0x3790da,_0xa36dd8){return _0x3790da[_0xdc97('0xa')](_0xdc97('0xb'),attributes,{'tableName':_0xdc97('0xc'),'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 eb5e699..b506673 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x52db26,_0x5cf4cb){var _0xb82798=function(_0x5ddf87){while(--_0x5ddf87){_0x52db26['push'](_0x52db26['shift']());}};_0xb82798(++_0x5cf4cb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x34e769,_0xb5e72){var _0x54b2eb=function(_0x5688a4){while(--_0x5688a4){_0x34e769['push'](_0x34e769['shift']());}};_0x54b2eb(++_0xb5e72);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index e9a354f..a857213 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 _0x8389=['../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','getHopperBlacks','/:id/lists','/:id/blacklists','create','post','/:id/clone','clone','addLists','addBlackLists','put','update','delete','/:id','destroy','removeLists','removeBlackLists','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x502f0e,_0x3463b3){var _0x2522e8=function(_0x51c202){while(--_0x51c202){_0x502f0e['push'](_0x502f0e['shift']());}};_0x2522e8(++_0x3463b3);}(_0x8389,0x158));var _0x9838=function(_0x421745,_0x29979d){_0x421745=_0x421745-0x0;var _0x57127e=_0x8389[_0x421745];return _0x57127e;};'use strict';var multer=require(_0x9838('0x0'));var util=require(_0x9838('0x1'));var path=require('path');var timeout=require(_0x9838('0x2'));var express=require(_0x9838('0x3'));var router=express[_0x9838('0x4')]();var auth=require(_0x9838('0x5'));var interaction=require(_0x9838('0x6'));var config=require(_0x9838('0x7'));var controller=require(_0x9838('0x8'));router[_0x9838('0x9')]('/',auth[_0x9838('0xa')](),controller[_0x9838('0xb')]);router[_0x9838('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x9838('0xc')]);router[_0x9838('0x9')](_0x9838('0xd'),auth[_0x9838('0xa')](),controller[_0x9838('0xe')]);router['get'](_0x9838('0xf'),auth[_0x9838('0xa')](),controller[_0x9838('0x10')]);router['get']('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x9838('0x11')]);router[_0x9838('0x9')]('/:id/hopper_black',auth[_0x9838('0xa')](),controller[_0x9838('0x12')]);router[_0x9838('0x9')](_0x9838('0x13'),auth['isAuthenticated'](),controller['getLists']);router[_0x9838('0x9')](_0x9838('0x14'),auth['isAuthenticated'](),controller['getBlackLists']);router['post']('/',auth[_0x9838('0xa')](),controller[_0x9838('0x15')]);router[_0x9838('0x16')](_0x9838('0x17'),auth[_0x9838('0xa')](),controller[_0x9838('0x18')]);router[_0x9838('0x16')](_0x9838('0x13'),auth['isAuthenticated'](),controller[_0x9838('0x19')]);router[_0x9838('0x16')]('/:id/blacklists',auth[_0x9838('0xa')](),controller[_0x9838('0x1a')]);router[_0x9838('0x1b')]('/:id',auth[_0x9838('0xa')](),controller[_0x9838('0x1c')]);router[_0x9838('0x1d')](_0x9838('0x1e'),auth['isAuthenticated'](),controller[_0x9838('0x1f')]);router[_0x9838('0x1d')](_0x9838('0x13'),auth[_0x9838('0xa')](),controller[_0x9838('0x20')]);router['delete'](_0x9838('0x14'),auth[_0x9838('0xa')](),controller[_0x9838('0x21')]);module[_0x9838('0x22')]=router; \ No newline at end of file +var _0x27ae=['post','create','/:id/clone','clone','addLists','addBlackLists','put','update','delete','/:id','removeLists','removeBlackLists','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','index','isAuthenticated','show','get','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists'];(function(_0x5ecddd,_0x1a8b1c){var _0x33d0dc=function(_0x4dd270){while(--_0x4dd270){_0x5ecddd['push'](_0x5ecddd['shift']());}};_0x33d0dc(++_0x1a8b1c);}(_0x27ae,0xb6));var _0xe27a=function(_0x18aaaf,_0x385db6){_0x18aaaf=_0x18aaaf-0x0;var _0x52d892=_0x27ae[_0x18aaaf];return _0x52d892;};'use strict';var multer=require('multer');var util=require(_0xe27a('0x0'));var path=require('path');var timeout=require(_0xe27a('0x1'));var express=require('express');var router=express[_0xe27a('0x2')]();var auth=require(_0xe27a('0x3'));var interaction=require(_0xe27a('0x4'));var config=require(_0xe27a('0x5'));var controller=require(_0xe27a('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xe27a('0x7')]);router['get']('/:id',auth[_0xe27a('0x8')](),controller[_0xe27a('0x9')]);router[_0xe27a('0xa')](_0xe27a('0xb'),auth[_0xe27a('0x8')](),controller['getHoppers']);router['get'](_0xe27a('0xc'),auth[_0xe27a('0x8')](),controller[_0xe27a('0xd')]);router[_0xe27a('0xa')](_0xe27a('0xe'),auth[_0xe27a('0x8')](),controller[_0xe27a('0xf')]);router['get'](_0xe27a('0x10'),auth[_0xe27a('0x8')](),controller[_0xe27a('0x11')]);router[_0xe27a('0xa')](_0xe27a('0x12'),auth[_0xe27a('0x8')](),controller[_0xe27a('0x13')]);router[_0xe27a('0xa')](_0xe27a('0x14'),auth[_0xe27a('0x8')](),controller[_0xe27a('0x15')]);router[_0xe27a('0x16')]('/',auth['isAuthenticated'](),controller[_0xe27a('0x17')]);router[_0xe27a('0x16')](_0xe27a('0x18'),auth[_0xe27a('0x8')](),controller[_0xe27a('0x19')]);router[_0xe27a('0x16')](_0xe27a('0x12'),auth[_0xe27a('0x8')](),controller[_0xe27a('0x1a')]);router['post'](_0xe27a('0x14'),auth[_0xe27a('0x8')](),controller[_0xe27a('0x1b')]);router[_0xe27a('0x1c')]('/:id',auth[_0xe27a('0x8')](),controller[_0xe27a('0x1d')]);router[_0xe27a('0x1e')](_0xe27a('0x1f'),auth[_0xe27a('0x8')](),controller['destroy']);router['delete'](_0xe27a('0x12'),auth[_0xe27a('0x8')](),controller[_0xe27a('0x20')]);router[_0xe27a('0x1e')](_0xe27a('0x14'),auth[_0xe27a('0x8')](),controller[_0xe27a('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index a5c4fb2..ae9228a 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 _0x9e09=['key','sequelize','exports','STRING','TEXT','VIRTUAL','getDataValue'];(function(_0x723861,_0x3c721d){var _0x4374cb=function(_0x501f5b){while(--_0x501f5b){_0x723861['push'](_0x723861['shift']());}};_0x4374cb(++_0x3c721d);}(_0x9e09,0x94));var _0x99e0=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x9e09[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0x99e0('0x0'));module[_0x99e0('0x1')]={'key':{'type':Sequelize[_0x99e0('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x99e0('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x99e0('0x2')]},'name':{'type':Sequelize[_0x99e0('0x4')],'get':function(){return this[_0x99e0('0x5')](_0x99e0('0x6'));}}}; \ No newline at end of file +var _0x3163=['TEXT','getDataValue','key','sequelize','STRING'];(function(_0x479da6,_0x1a3a32){var _0x1b984d=function(_0x27abf7){while(--_0x27abf7){_0x479da6['push'](_0x479da6['shift']());}};_0x1b984d(++_0x1a3a32);}(_0x3163,0xee));var _0x3316=function(_0x36f271,_0x2bbe64){_0x36f271=_0x36f271-0x0;var _0x2de58b=_0x3163[_0x36f271];return _0x2de58b;};'use strict';var Sequelize=require(_0x3316('0x0'));module['exports']={'key':{'type':Sequelize[_0x3316('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x3316('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3316('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x3316('0x3')](_0x3316('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 397cc8c..dbb90db 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(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=_0x2202ce[_0x7995('0x1e')],_0x5377e5=_0x1a5310[_0x7995('0x1f')],_0x2eeacc=_0x1a5310[_0x7995('0x1f')]+_0x1a5310[_0x7995('0x20')],_0x565d97;if(_0x2eeacc>=_0x41cbf0){_0x2eeacc=_0x41cbf0;_0x565d97=0xc8;}else{_0x565d97=0xce;}_0x3f1d3e[_0x7995('0x1c')](_0x565d97);return _0x3f1d3e[_0x7995('0x21')]('Content-Range',_0x5377e5+'-'+_0x2eeacc+'/'+_0x41cbf0)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x2536c8){return function(_0x5e6f90){try{jsonpatch['apply'](_0x5e6f90,_0x2536c8,!![]);}catch(_0x3ec178){return BPromise[_0x7995('0x22')](_0x3ec178);}return _0x5e6f90['save']();};}function saveUpdates(_0x3a9b54,_0x51f276){return function(_0x4b1a8e){if(_0x4b1a8e){return _0x4b1a8e[_0x7995('0x23')](_0x3a9b54)[_0x7995('0x24')](function(_0x350fd9){return _0x350fd9;});}return null;};}function removeEntity(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['destroy']()[_0x7995('0x24')](function(){var _0x46ee4b=_0x1c278a[_0x7995('0x25')]({'plain':!![]});var _0x285437=_0x7995('0x26');return db[_0x7995('0x27')][_0x7995('0x28')]({'where':{'type':_0x285437,'resourceId':_0x46ee4b['id']}})[_0x7995('0x24')](function(){return _0x1c278a;});})['then'](function(){_0x1a8568[_0x7995('0x1c')](0xcc)[_0x7995('0x29')]();});}};}function handleEntityNotFound(_0x401dc3,_0x268ce7){return function(_0x3a3fcf){if(!_0x3a3fcf){_0x401dc3[_0x7995('0x1b')](0x194);}return _0x3a3fcf;};}function handleError(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0x1f4;return function(_0x5911c3){logger[_0x7995('0x2a')](_0x5911c3[_0x7995('0x2b')]);if(_0x5911c3[_0x7995('0x2c')]){delete _0x5911c3[_0x7995('0x2c')];}_0x56691a[_0x7995('0x1c')](_0x47625f)['send'](_0x5911c3);};}exports[_0x7995('0x2d')]=function(_0x514445,_0x456a28){var _0x3250e0={},_0x4253e5={},_0x574574={'count':0x0,'rows':[]};var _0x530611=_['map'](db[_0x7995('0x2e')][_0x7995('0x2f')],function(_0x327a81){return{'name':_0x327a81[_0x7995('0x30')],'type':_0x327a81[_0x7995('0x31')][_0x7995('0x32')]};});_0x4253e5['model']=_['map'](_0x530611,_0x7995('0x2c'));_0x4253e5['query']=_[_0x7995('0x33')](_0x514445[_0x7995('0x34')]);_0x4253e5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x4253e5[_0x7995('0x37')],_0x4253e5['query']);_0x3250e0[_0x7995('0x38')]=_[_0x7995('0x36')](_0x4253e5['model'],qs['fields'](_0x514445['query'][_0x7995('0x39')]));_0x3250e0[_0x7995('0x38')]=_0x3250e0['attributes'][_0x7995('0x3a')]?_0x3250e0['attributes']:_0x4253e5[_0x7995('0x37')];if(!_0x514445[_0x7995('0x34')][_0x7995('0x3b')]('nolimit')){_0x3250e0['limit']=qs[_0x7995('0x20')](_0x514445['query']['limit']);_0x3250e0[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x514445['query'][_0x7995('0x1f')]);}_0x3250e0[_0x7995('0x3c')]=qs[_0x7995('0x3d')](_0x514445[_0x7995('0x34')][_0x7995('0x3d')]);_0x3250e0['where']=qs[_0x7995('0x35')](_[_0x7995('0x3e')](_0x514445[_0x7995('0x34')],_0x4253e5[_0x7995('0x35')]),_0x530611);if(_0x514445['query'][_0x7995('0x3f')]){_0x3250e0[_0x7995('0x40')]=_[_0x7995('0x41')](_0x3250e0[_0x7995('0x40')],{'$or':_[_0x7995('0x42')](_0x530611,function(_0x1035dc){if(_0x1035dc['type']!==_0x7995('0x43')){var _0x3be298={};_0x3be298[_0x1035dc[_0x7995('0x2c')]]={'$like':'%'+_0x514445[_0x7995('0x34')][_0x7995('0x3f')]+'%'};return _0x3be298;}})});}_0x3250e0=_[_0x7995('0x41')]({},_0x3250e0,_0x514445[_0x7995('0x44')]);var _0x270c0e={'where':_0x3250e0[_0x7995('0x40')]};return db[_0x7995('0x2e')][_0x7995('0x1e')](_0x270c0e)[_0x7995('0x24')](function(_0x7b4e67){_0x574574['count']=_0x7b4e67;if(_0x514445['query'][_0x7995('0x45')]){_0x3250e0[_0x7995('0x46')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3250e0);})[_0x7995('0x24')](function(_0x4a9fef){_0x574574['rows']=_0x4a9fef;return _0x574574;})[_0x7995('0x24')](respondWithFilteredResult(_0x456a28,_0x3250e0))[_0x7995('0x47')](handleError(_0x456a28,null));};exports[_0x7995('0x48')]=function(_0x576b96,_0x46ac4f){var _0x5e85b9={'raw':!![],'where':{'id':_0x576b96['params']['id']}},_0x3993b5={};_0x3993b5['model']=_[_0x7995('0x33')](db[_0x7995('0x2e')][_0x7995('0x2f')]);_0x3993b5[_0x7995('0x34')]=_['keys'](_0x576b96[_0x7995('0x34')]);_0x3993b5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x3993b5[_0x7995('0x37')],_0x3993b5['query']);_0x5e85b9['attributes']=_[_0x7995('0x36')](_0x3993b5['model'],qs[_0x7995('0x39')](_0x576b96['query'][_0x7995('0x39')]));_0x5e85b9['attributes']=_0x5e85b9[_0x7995('0x38')][_0x7995('0x3a')]?_0x5e85b9['attributes']:_0x3993b5[_0x7995('0x37')];if(_0x576b96[_0x7995('0x34')][_0x7995('0x45')]){_0x5e85b9[_0x7995('0x46')]=[{'all':!![]}];}_0x5e85b9=_['merge']({},_0x5e85b9,_0x576b96[_0x7995('0x44')]);return db[_0x7995('0x2e')][_0x7995('0x49')](_0x5e85b9)['then'](handleEntityNotFound(_0x46ac4f,null))[_0x7995('0x24')](respondWithResult(_0x46ac4f,null))[_0x7995('0x47')](handleError(_0x46ac4f,null));};exports[_0x7995('0x23')]=function(_0x3d8ae3,_0x255313){if(_0x3d8ae3['body']['id']){delete _0x3d8ae3[_0x7995('0x4a')]['id'];}return db[_0x7995('0x2e')]['find']({'where':{'id':_0x3d8ae3[_0x7995('0x4b')]['id']}})['then'](handleEntityNotFound(_0x255313,null))[_0x7995('0x24')](saveUpdates(_0x3d8ae3[_0x7995('0x4a')],null))[_0x7995('0x24')](respondWithResult(_0x255313,null))[_0x7995('0x47')](handleError(_0x255313,null));};exports[_0x7995('0x28')]=function(_0x14b537,_0x1579b9){return db['CannedAnswer'][_0x7995('0x49')]({'where':{'id':_0x14b537[_0x7995('0x4b')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x1579b9,null))['then'](removeEntity(_0x1579b9,null))[_0x7995('0x47')](handleError(_0x1579b9,null));};exports[_0x7995('0x4c')]=function(_0x12d4b8,_0x47d1d8){var _0x4ec548={'key':_0x12d4b8['body'][_0x7995('0x32')]};if(_0x12d4b8[_0x7995('0x4a')]['MailAccountId']){_0x4ec548[_0x7995('0x4d')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4d')];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4e')]){_0x4ec548['SmsAccountId']=_0x12d4b8[_0x7995('0x4a')]['SmsAccountId'];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4f')]){_0x4ec548[_0x7995('0x4f')]=_0x12d4b8['body']['OpenchannelAccountId'];}else if(_0x12d4b8['body']['ChatWebsiteId']){_0x4ec548[_0x7995('0x50')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x50')];}return db[_0x7995('0x2e')][_0x7995('0x49')]({'where':_0x4ec548})[_0x7995('0x24')](function(_0x1f4270){if(_0x1f4270){throw new db[(_0x7995('0x51'))][(_0x7995('0x52'))](_0x7995('0x53'));}return db[_0x7995('0x2e')][_0x7995('0x4c')](_0x12d4b8[_0x7995('0x4a')]);})[_0x7995('0x24')](function(_0x1ea1dc){var _0x416133=_0x12d4b8[_0x7995('0x54')][_0x7995('0x25')]({'plain':!![]});if(!_0x416133)throw new Error(_0x7995('0x55'));if(_0x416133['role']===_0x7995('0x54')){var _0x630737=_0x1ea1dc[_0x7995('0x25')]({'plain':!![]});return db[_0x7995('0x56')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x416133[_0x7995('0x57')]},'raw':!![]})[_0x7995('0x24')](function(_0x5b9467){if(_0x5b9467&&_0x5b9467[_0x7995('0x58')]===0x0){return db['UserProfileResource'][_0x7995('0x4c')]({'name':_0x630737[_0x7995('0x2c')],'resourceId':_0x630737['id'],'type':_0x5b9467[_0x7995('0x2c')],'sectionId':_0x5b9467['id']},{})[_0x7995('0x24')](function(){return _0x1ea1dc;});}else{return _0x1ea1dc;}})['catch'](function(_0x5e2d97){logger[_0x7995('0x2a')](_0x7995('0x59'),_0x5e2d97);throw _0x5e2d97;});}return _0x1ea1dc;})[_0x7995('0x24')](respondWithResult(_0x47d1d8,0xc9))[_0x7995('0x47')](handleError(_0x47d1d8,null));}; \ No newline at end of file +var _0xa9e0=['filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','get','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','CannedAnswers','UserProfileResource','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x548707,_0x231195){var _0x3c6347=function(_0x5d885c){while(--_0x5d885c){_0x548707['push'](_0x548707['shift']());}};_0x3c6347(++_0x231195);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':!![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x47')]['id']){delete _0x8d6dd1[_0x0a9e('0x47')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x16f976[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x49')]=function(_0x4f7240,_0x4ae14b){var _0x5ddf84={'key':_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x2e')]};if(_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4a')]){_0x5ddf84[_0x0a9e('0x4a')]=_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4a')];}else if(_0x4f7240[_0x0a9e('0x47')]['SmsAccountId']){_0x5ddf84['SmsAccountId']=_0x4f7240['body'][_0x0a9e('0x4b')];}else if(_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4c')]){_0x5ddf84['OpenchannelAccountId']=_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4c')];}else if(_0x4f7240['body']['ChatWebsiteId']){_0x5ddf84[_0x0a9e('0x4d')]=_0x4f7240['body'][_0x0a9e('0x4d')];}return db['CannedAnswer'][_0x0a9e('0x48')]({'where':_0x5ddf84})[_0x0a9e('0x22')](function(_0x439340){if(_0x439340){throw new db['Sequelize'][(_0x0a9e('0x4e'))](_0x0a9e('0x4f'));}return db['CannedAnswer']['create'](_0x4f7240[_0x0a9e('0x47')]);})[_0x0a9e('0x22')](function(_0x49c095){var _0x145931=_0x4f7240['user'][_0x0a9e('0x50')]({'plain':!![]});if(!_0x145931)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x145931[_0x0a9e('0x51')]==='user'){var _0x5da27d=_0x49c095['get']({'plain':!![]});return db[_0x0a9e('0x52')]['find']({'where':{'name':_0x0a9e('0x23'),'userProfileId':_0x145931[_0x0a9e('0x53')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x19b4df){if(_0x19b4df&&_0x19b4df[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x49')]({'name':_0x5da27d[_0x0a9e('0x26')],'resourceId':_0x5da27d['id'],'type':_0x19b4df['name'],'sectionId':_0x19b4df['id']},{})[_0x0a9e('0x22')](function(){return _0x49c095;});}else{return _0x49c095;}})[_0x0a9e('0x42')](function(_0x2642bb){logger[_0x0a9e('0x55')](_0x0a9e('0x56'),_0x2642bb);throw _0x2642bb;});}return _0x49c095;})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,0xc9))['catch'](handleError(_0x4ae14b,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 586767e..01e6842 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 _0xc79f=['exports','define','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes'];(function(_0x27b77f,_0x381ac8){var _0xd790d6=function(_0x8f3511){while(--_0x8f3511){_0x27b77f['push'](_0x27b77f['shift']());}};_0xd790d6(++_0x381ac8);}(_0xc79f,0x82));var _0xfc79=function(_0x4d9442,_0x1e784a){_0x4d9442=_0x4d9442-0x0;var _0x5b0d83=_0xc79f[_0x4d9442];return _0x5b0d83;};'use strict';var _=require(_0xfc79('0x0'));var util=require(_0xfc79('0x1'));var logger=require(_0xfc79('0x2'))(_0xfc79('0x3'));var moment=require(_0xfc79('0x4'));var BPromise=require('bluebird');var rp=require(_0xfc79('0x5'));var fs=require('fs');var path=require(_0xfc79('0x6'));var rimraf=require(_0xfc79('0x7'));var config=require(_0xfc79('0x8'));var attributes=require(_0xfc79('0x9'));module[_0xfc79('0xa')]=function(_0x660769,_0x1ba054){return _0x660769[_0xfc79('0xb')]('CannedAnswer',attributes,{'tableName':_0xfc79('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xfc79('0xd')});}; \ No newline at end of file +var _0x8840=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0xb9c140,_0x4a0595){var _0x256992=function(_0x1e5c9a){while(--_0x1e5c9a){_0xb9c140['push'](_0xb9c140['shift']());}};_0x256992(++_0x4a0595);}(_0x8840,0x1ac));var _0x0884=function(_0x11de83,_0x49e1c1){_0x11de83=_0x11de83-0x0;var _0x45bdb0=_0x8840[_0x11de83];return _0x45bdb0;};'use strict';var _=require(_0x0884('0x0'));var util=require('util');var logger=require(_0x0884('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0884('0x2'));var rp=require(_0x0884('0x3'));var fs=require('fs');var path=require(_0x0884('0x4'));var rimraf=require(_0x0884('0x5'));var config=require(_0x0884('0x6'));var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x3011e4,_0x5d1866){return _0x3011e4[_0x0884('0x7')](_0x0884('0x8'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0884('0x9'),'collate':_0x0884('0xa')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index b7c7e85..196d109 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 _0x2cd6=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x5a5d46,_0x2f5e7e){var _0x1538c6=function(_0x4eca05){while(--_0x4eca05){_0x5a5d46['push'](_0x5a5d46['shift']());}};_0x1538c6(++_0x2f5e7e);}(_0x2cd6,0x10a));var _0x62cd=function(_0x296d30,_0x1b0a67){_0x296d30=_0x296d30-0x0;var _0x598073=_0x2cd6[_0x296d30];return _0x598073;};'use strict';var _=require(_0x62cd('0x0'));var util=require(_0x62cd('0x1'));var moment=require(_0x62cd('0x2'));var BPromise=require('bluebird');var rs=require(_0x62cd('0x3'));var fs=require('fs');var Redis=require(_0x62cd('0x4'));var db=require(_0x62cd('0x5'))['db'];var utils=require(_0x62cd('0x6'));var logger=require('../../config/logger')(_0x62cd('0x7'));var config=require(_0x62cd('0x8'));var jayson=require(_0x62cd('0x9'));var client=jayson['client'][_0x62cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f84c2,_0x56a5db,_0x1cef1b){return new BPromise(function(_0x35b4b,_0x15638d){return client[_0x62cd('0xb')](_0x3f84c2,_0x1cef1b)[_0x62cd('0xc')](function(_0x33ae4e){logger[_0x62cd('0xd')](_0x62cd('0xe'),_0x56a5db,_0x62cd('0xf'));logger[_0x62cd('0x10')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x56a5db,_0x62cd('0xf'),JSON['stringify'](_0x33ae4e));if(_0x33ae4e[_0x62cd('0x11')]){if(_0x33ae4e['error'][_0x62cd('0x12')]===0x1f4){logger[_0x62cd('0x11')]('CannedAnswer,\x20%s,\x20%s',_0x56a5db,_0x33ae4e[_0x62cd('0x11')][_0x62cd('0x13')]);return _0x15638d(_0x33ae4e[_0x62cd('0x11')][_0x62cd('0x13')]);}logger['error'](_0x62cd('0xe'),_0x56a5db,_0x33ae4e['error'][_0x62cd('0x13')]);return _0x35b4b(_0x33ae4e[_0x62cd('0x11')][_0x62cd('0x13')]);}else{logger[_0x62cd('0xd')](_0x62cd('0xe'),_0x56a5db,_0x62cd('0xf'));_0x35b4b(_0x33ae4e[_0x62cd('0x14')][_0x62cd('0x13')]);}})[_0x62cd('0x15')](function(_0x35caa4){logger[_0x62cd('0x11')](_0x62cd('0xe'),_0x56a5db,_0x35caa4);_0x15638d(_0x35caa4);});});} \ No newline at end of file +var _0x0d8e=['debug','stringify','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent'];(function(_0x3c3d9a,_0x51078e){var _0x34a24c=function(_0x2a7dcb){while(--_0x2a7dcb){_0x3c3d9a['push'](_0x3c3d9a['shift']());}};_0x34a24c(++_0x51078e);}(_0x0d8e,0x8a));var _0xe0d8=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x0d8e[_0x46698a];return _0x356db0;};'use strict';var _=require('lodash');var util=require(_0xe0d8('0x0'));var moment=require(_0xe0d8('0x1'));var BPromise=require(_0xe0d8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0d8('0x3'));var db=require(_0xe0d8('0x4'))['db'];var utils=require(_0xe0d8('0x5'));var logger=require(_0xe0d8('0x6'))(_0xe0d8('0x7'));var config=require(_0xe0d8('0x8'));var jayson=require(_0xe0d8('0x9'));var client=jayson[_0xe0d8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42fb42,_0x343398,_0x330fbc){return new BPromise(function(_0x19a914,_0x59474b){return client[_0xe0d8('0xb')](_0x42fb42,_0x330fbc)[_0xe0d8('0xc')](function(_0x3b26ab){logger[_0xe0d8('0xd')](_0xe0d8('0xe'),_0x343398,_0xe0d8('0xf'));logger[_0xe0d8('0x10')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x343398,_0xe0d8('0xf'),JSON[_0xe0d8('0x11')](_0x3b26ab));if(_0x3b26ab[_0xe0d8('0x12')]){if(_0x3b26ab['error']['code']===0x1f4){logger[_0xe0d8('0x12')](_0xe0d8('0xe'),_0x343398,_0x3b26ab[_0xe0d8('0x12')][_0xe0d8('0x13')]);return _0x59474b(_0x3b26ab[_0xe0d8('0x12')]['message']);}logger[_0xe0d8('0x12')](_0xe0d8('0xe'),_0x343398,_0x3b26ab[_0xe0d8('0x12')][_0xe0d8('0x13')]);return _0x19a914(_0x3b26ab[_0xe0d8('0x12')][_0xe0d8('0x13')]);}else{logger[_0xe0d8('0xd')]('CannedAnswer,\x20%s,\x20%s',_0x343398,_0xe0d8('0xf'));_0x19a914(_0x3b26ab[_0xe0d8('0x14')][_0xe0d8('0x13')]);}})[_0xe0d8('0x15')](function(_0x54494e){logger[_0xe0d8('0x12')](_0xe0d8('0xe'),_0x343398,_0x54494e);_0x59474b(_0x54494e);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 29339c9..41d6acc 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 _0xd32c=['isAuthenticated','index','show','post','create','put','/:id','update','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller'];(function(_0x556516,_0x1a1d03){var _0x41e8d7=function(_0x393930){while(--_0x393930){_0x556516['push'](_0x556516['shift']());}};_0x41e8d7(++_0x1a1d03);}(_0xd32c,0x64));var _0xcd32=function(_0x75b25d,_0x3fbae3){_0x75b25d=_0x75b25d-0x0;var _0x3400de=_0xd32c[_0x75b25d];return _0x3400de;};'use strict';var multer=require(_0xcd32('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcd32('0x1'));var express=require(_0xcd32('0x2'));var router=express[_0xcd32('0x3')]();var auth=require(_0xcd32('0x4'));var interaction=require(_0xcd32('0x5'));var config=require(_0xcd32('0x6'));var controller=require(_0xcd32('0x7'));router['get']('/',auth[_0xcd32('0x8')](),controller[_0xcd32('0x9')]);router['get']('/:id',auth[_0xcd32('0x8')](),controller[_0xcd32('0xa')]);router[_0xcd32('0xb')]('/',auth[_0xcd32('0x8')](),controller[_0xcd32('0xc')]);router[_0xcd32('0xd')](_0xcd32('0xe'),auth[_0xcd32('0x8')](),controller[_0xcd32('0xf')]);router[_0xcd32('0x10')]('/:id',auth[_0xcd32('0x8')](),controller['destroy']);module[_0xcd32('0x11')]=router; \ No newline at end of file +var _0x7e06=['isAuthenticated','index','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get'];(function(_0x41dffa,_0x4197f2){var _0x168bc7=function(_0x32ba68){while(--_0x32ba68){_0x41dffa['push'](_0x41dffa['shift']());}};_0x168bc7(++_0x4197f2);}(_0x7e06,0x1b0));var _0x67e0=function(_0xfc1c9a,_0xec967b){_0xfc1c9a=_0xfc1c9a-0x0;var _0x54191e=_0x7e06[_0xfc1c9a];return _0x54191e;};'use strict';var multer=require('multer');var util=require(_0x67e0('0x0'));var path=require(_0x67e0('0x1'));var timeout=require(_0x67e0('0x2'));var express=require(_0x67e0('0x3'));var router=express[_0x67e0('0x4')]();var auth=require(_0x67e0('0x5'));var interaction=require(_0x67e0('0x6'));var config=require(_0x67e0('0x7'));var controller=require(_0x67e0('0x8'));router[_0x67e0('0x9')]('/',auth[_0x67e0('0xa')](),controller[_0x67e0('0xb')]);router[_0x67e0('0x9')](_0x67e0('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x67e0('0xa')](),controller['create']);router['put'](_0x67e0('0xc'),auth[_0x67e0('0xa')](),controller[_0x67e0('0xd')]);router[_0x67e0('0xe')](_0x67e0('0xc'),auth['isAuthenticated'](),controller[_0x67e0('0xf')]);module[_0x67e0('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index f50b4c8..005cc33 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 _0x7ebf=['sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x7ae4b7,_0x59b111){var _0x4a13ef=function(_0x320853){while(--_0x320853){_0x7ae4b7['push'](_0x7ae4b7['shift']());}};_0x4a13ef(++_0x59b111);}(_0x7ebf,0x10e));var _0xf7eb=function(_0x5a07d4,_0x501d6c){_0x5a07d4=_0x5a07d4-0x0;var _0xacb3e3=_0x7ebf[_0x5a07d4];return _0xacb3e3;};'use strict';var Sequelize=require(_0xf7eb('0x0'));module[_0xf7eb('0x1')]={'calldate':{'type':Sequelize[_0xf7eb('0x2')],'allowNull':![],'defaultValue':_0xf7eb('0x3')},'clid':{'type':Sequelize[_0xf7eb('0x4')]},'src':{'type':Sequelize[_0xf7eb('0x4')]},'dst':{'type':Sequelize[_0xf7eb('0x4')]},'dcontext':{'type':Sequelize[_0xf7eb('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xf7eb('0x4')]},'lastdata':{'type':Sequelize[_0xf7eb('0x4')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xf7eb('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf7eb('0x4')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xf7eb('0x4')]},'userfield':{'type':Sequelize[_0xf7eb('0x4')]},'uniqueid':{'type':Sequelize[_0xf7eb('0x4')]},'linkedid':{'type':Sequelize[_0xf7eb('0x4')]},'sequence':{'type':Sequelize[_0xf7eb('0x4')]},'peeraccount':{'type':Sequelize[_0xf7eb('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xf7eb('0x4')]}}; \ No newline at end of file +var _0xc74b=['DATE','STRING','INTEGER','exports'];(function(_0x4674b2,_0x353c14){var _0x7bf418=function(_0x5b8b5b){while(--_0x5b8b5b){_0x4674b2['push'](_0x4674b2['shift']());}};_0x7bf418(++_0x353c14);}(_0xc74b,0xf3));var _0xbc74=function(_0x1e1d09,_0x653290){_0x1e1d09=_0x1e1d09-0x0;var _0x2685dd=_0xc74b[_0x1e1d09];return _0x2685dd;};'use strict';var Sequelize=require('sequelize');module[_0xbc74('0x0')]={'calldate':{'type':Sequelize[_0xbc74('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xbc74('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xbc74('0x2')]},'dcontext':{'type':Sequelize[_0xbc74('0x2')]},'channel':{'type':Sequelize[_0xbc74('0x2')]},'dstchannel':{'type':Sequelize[_0xbc74('0x2')]},'lastapp':{'type':Sequelize[_0xbc74('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xbc74('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xbc74('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xbc74('0x2')]},'amaflags':{'type':Sequelize[_0xbc74('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xbc74('0x2')]},'userfield':{'type':Sequelize[_0xbc74('0x2')]},'uniqueid':{'type':Sequelize[_0xbc74('0x2')]},'linkedid':{'type':Sequelize[_0xbc74('0x2')]},'sequence':{'type':Sequelize[_0xbc74('0x2')]},'peeraccount':{'type':Sequelize[_0xbc74('0x2')]},'type':{'type':Sequelize[_0xbc74('0x2')]},'tag':{'type':Sequelize[_0xbc74('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 69dc85e..2d1c594 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 _0xef21=['options','count','includeAll','findAll','catch','params','length','include','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','map','Cdr','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','order','sort','where','pick','filter','merge'];(function(_0x53310b,_0x1ac4a3){var _0x2f0db4=function(_0x464a33){while(--_0x464a33){_0x53310b['push'](_0x53310b['shift']());}};_0x2f0db4(++_0x1ac4a3);}(_0xef21,0x16a));var _0x1ef2=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xef21[_0x5f3f88];return _0xd08119;};'use strict';var pdf=require(_0x1ef2('0x0'));var emlformat=require(_0x1ef2('0x1'));var rimraf=require(_0x1ef2('0x2'));var zipdir=require(_0x1ef2('0x3'));var jsonpatch=require(_0x1ef2('0x4'));var rp=require(_0x1ef2('0x5'));var moment=require(_0x1ef2('0x6'));var BPromise=require(_0x1ef2('0x7'));var Mustache=require(_0x1ef2('0x8'));var util=require(_0x1ef2('0x9'));var path=require('path');var sox=require(_0x1ef2('0xa'));var csv=require(_0x1ef2('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1ef2('0xc'));var squel=require(_0x1ef2('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1ef2('0xe'));var toCsv=require(_0x1ef2('0xb'));var querystring=require(_0x1ef2('0xf'));var Papa=require(_0x1ef2('0x10'));var Redis=require(_0x1ef2('0x11'));var authService=require(_0x1ef2('0x12'));var qs=require(_0x1ef2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ef2('0x14'));var logger=require(_0x1ef2('0x15'))('api');var utils=require(_0x1ef2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1ef2('0x17'));var db=require(_0x1ef2('0x18'))['db'];function respondWithStatusCode(_0x5a6028,_0xd1fda2){_0xd1fda2=_0xd1fda2||0xcc;return function(_0x281f5b){if(_0x281f5b){return _0x5a6028[_0x1ef2('0x19')](_0xd1fda2);}return _0x5a6028['status'](_0xd1fda2)[_0x1ef2('0x1a')]();};}function respondWithResult(_0x1060af,_0x3427b0){_0x3427b0=_0x3427b0||0xc8;return function(_0x32d0f7){if(_0x32d0f7){return _0x1060af[_0x1ef2('0x1b')](_0x3427b0)[_0x1ef2('0x1c')](_0x32d0f7);}};}function respondWithFilteredResult(_0xeb8894,_0x39a50a){return function(_0x3f9ff2){if(_0x3f9ff2){var _0x5b2a8d=_0x3f9ff2['count'],_0x2cf0db=_0x39a50a[_0x1ef2('0x1d')],_0x52fc83=_0x39a50a[_0x1ef2('0x1d')]+_0x39a50a[_0x1ef2('0x1e')],_0xb3f212;if(_0x52fc83>=_0x5b2a8d){_0x52fc83=_0x5b2a8d;_0xb3f212=0xc8;}else{_0xb3f212=0xce;}_0xeb8894[_0x1ef2('0x1b')](_0xb3f212);return _0xeb8894[_0x1ef2('0x1f')](_0x1ef2('0x20'),_0x2cf0db+'-'+_0x52fc83+'/'+_0x5b2a8d)[_0x1ef2('0x1c')](_0x3f9ff2);}return null;};}function patchUpdates(_0x52824d){return function(_0x334b9d){try{jsonpatch[_0x1ef2('0x21')](_0x334b9d,_0x52824d,!![]);}catch(_0x2b6e08){return BPromise[_0x1ef2('0x22')](_0x2b6e08);}return _0x334b9d[_0x1ef2('0x23')]();};}function saveUpdates(_0xffbdf3,_0x88682d){return function(_0x1fba26){if(_0x1fba26){return _0x1fba26[_0x1ef2('0x24')](_0xffbdf3)[_0x1ef2('0x25')](function(_0x69ffa6){return _0x69ffa6;});}return null;};}function removeEntity(_0x1d78f1,_0x50e20c){return function(_0x52c29d){if(_0x52c29d){return _0x52c29d[_0x1ef2('0x26')]()[_0x1ef2('0x25')](function(){_0x1d78f1[_0x1ef2('0x1b')](0xcc)[_0x1ef2('0x1a')]();});}};}function handleEntityNotFound(_0x4d0a38,_0x4c801b){return function(_0x2f25f2){if(!_0x2f25f2){_0x4d0a38[_0x1ef2('0x19')](0x194);}return _0x2f25f2;};}function handleError(_0x493151,_0x1c2550){_0x1c2550=_0x1c2550||0x1f4;return function(_0x2d1d9e){logger[_0x1ef2('0x27')](_0x2d1d9e['stack']);if(_0x2d1d9e[_0x1ef2('0x28')]){delete _0x2d1d9e[_0x1ef2('0x28')];}_0x493151[_0x1ef2('0x1b')](_0x1c2550)['send'](_0x2d1d9e);};}exports['index']=function(_0x353505,_0x39a632){var _0x5a5079={},_0x3ef90b={},_0x1aa0f0={'count':0x0,'rows':[]};var _0x4dfdfc=_[_0x1ef2('0x29')](db[_0x1ef2('0x2a')][_0x1ef2('0x2b')],function(_0x189e64){return{'name':_0x189e64['fieldName'],'type':_0x189e64[_0x1ef2('0x2c')]['key']};});_0x3ef90b[_0x1ef2('0x2d')]=_[_0x1ef2('0x29')](_0x4dfdfc,'name');_0x3ef90b[_0x1ef2('0x2e')]=_[_0x1ef2('0x2f')](_0x353505[_0x1ef2('0x2e')]);_0x3ef90b[_0x1ef2('0x30')]=_[_0x1ef2('0x31')](_0x3ef90b[_0x1ef2('0x2d')],_0x3ef90b[_0x1ef2('0x2e')]);_0x5a5079['attributes']=_[_0x1ef2('0x31')](_0x3ef90b[_0x1ef2('0x2d')],qs[_0x1ef2('0x32')](_0x353505[_0x1ef2('0x2e')][_0x1ef2('0x32')]));_0x5a5079[_0x1ef2('0x33')]=_0x5a5079[_0x1ef2('0x33')]['length']?_0x5a5079['attributes']:_0x3ef90b[_0x1ef2('0x2d')];if(!_0x353505[_0x1ef2('0x2e')]['hasOwnProperty']('nolimit')){_0x5a5079[_0x1ef2('0x1e')]=qs[_0x1ef2('0x1e')](_0x353505[_0x1ef2('0x2e')][_0x1ef2('0x1e')]);_0x5a5079['offset']=qs[_0x1ef2('0x1d')](_0x353505[_0x1ef2('0x2e')][_0x1ef2('0x1d')]);}_0x5a5079[_0x1ef2('0x34')]=qs[_0x1ef2('0x35')](_0x353505['query']['sort']);_0x5a5079[_0x1ef2('0x36')]=qs[_0x1ef2('0x30')](_[_0x1ef2('0x37')](_0x353505[_0x1ef2('0x2e')],_0x3ef90b[_0x1ef2('0x30')]),_0x4dfdfc);if(_0x353505[_0x1ef2('0x2e')]['filter']){_0x5a5079['where']=_['merge'](_0x5a5079[_0x1ef2('0x36')],{'$or':_[_0x1ef2('0x29')](_0x4dfdfc,function(_0x4efd18){if(_0x4efd18[_0x1ef2('0x2c')]!=='VIRTUAL'){var _0x15b6a2={};_0x15b6a2[_0x4efd18[_0x1ef2('0x28')]]={'$like':'%'+_0x353505[_0x1ef2('0x2e')][_0x1ef2('0x38')]+'%'};return _0x15b6a2;}})});}_0x5a5079=_[_0x1ef2('0x39')]({},_0x5a5079,_0x353505[_0x1ef2('0x3a')]);var _0x2197f4={'where':_0x5a5079[_0x1ef2('0x36')]};return db[_0x1ef2('0x2a')][_0x1ef2('0x3b')](_0x2197f4)[_0x1ef2('0x25')](function(_0x23ff0b){_0x1aa0f0['count']=_0x23ff0b;if(_0x353505[_0x1ef2('0x2e')][_0x1ef2('0x3c')]){_0x5a5079['include']=[{'all':!![]}];}return db[_0x1ef2('0x2a')][_0x1ef2('0x3d')](_0x5a5079);})[_0x1ef2('0x25')](function(_0x422412){_0x1aa0f0['rows']=_0x422412;return _0x1aa0f0;})['then'](respondWithFilteredResult(_0x39a632,_0x5a5079))[_0x1ef2('0x3e')](handleError(_0x39a632,null));};exports['show']=function(_0x484cca,_0x41fa4a){var _0x3e45d3={'raw':!![],'where':{'id':_0x484cca[_0x1ef2('0x3f')]['id']}},_0x106d81={};_0x106d81[_0x1ef2('0x2d')]=_[_0x1ef2('0x2f')](db[_0x1ef2('0x2a')][_0x1ef2('0x2b')]);_0x106d81[_0x1ef2('0x2e')]=_['keys'](_0x484cca[_0x1ef2('0x2e')]);_0x106d81[_0x1ef2('0x30')]=_[_0x1ef2('0x31')](_0x106d81[_0x1ef2('0x2d')],_0x106d81[_0x1ef2('0x2e')]);_0x3e45d3['attributes']=_[_0x1ef2('0x31')](_0x106d81[_0x1ef2('0x2d')],qs['fields'](_0x484cca['query'][_0x1ef2('0x32')]));_0x3e45d3[_0x1ef2('0x33')]=_0x3e45d3[_0x1ef2('0x33')][_0x1ef2('0x40')]?_0x3e45d3['attributes']:_0x106d81[_0x1ef2('0x2d')];if(_0x484cca['query'][_0x1ef2('0x3c')]){_0x3e45d3[_0x1ef2('0x41')]=[{'all':!![]}];}_0x3e45d3=_[_0x1ef2('0x39')]({},_0x3e45d3,_0x484cca[_0x1ef2('0x3a')]);return db[_0x1ef2('0x2a')][_0x1ef2('0x42')](_0x3e45d3)[_0x1ef2('0x25')](handleEntityNotFound(_0x41fa4a,null))[_0x1ef2('0x25')](respondWithResult(_0x41fa4a,null))['catch'](handleError(_0x41fa4a,null));};exports[_0x1ef2('0x43')]=function(_0x703122,_0x458db1){return db['Cdr'][_0x1ef2('0x43')](_0x703122['body'],{})[_0x1ef2('0x25')](respondWithResult(_0x458db1,0xc9))[_0x1ef2('0x3e')](handleError(_0x458db1,null));};exports[_0x1ef2('0x24')]=function(_0x37ad1d,_0x1ae3d7){if(_0x37ad1d[_0x1ef2('0x44')]['id']){delete _0x37ad1d[_0x1ef2('0x44')]['id'];}return db['Cdr'][_0x1ef2('0x42')]({'where':{'id':_0x37ad1d[_0x1ef2('0x3f')]['id']}})[_0x1ef2('0x25')](handleEntityNotFound(_0x1ae3d7,null))[_0x1ef2('0x25')](saveUpdates(_0x37ad1d[_0x1ef2('0x44')],null))[_0x1ef2('0x25')](respondWithResult(_0x1ae3d7,null))['catch'](handleError(_0x1ae3d7,null));};exports['destroy']=function(_0xc11201,_0x39100a){return db[_0x1ef2('0x2a')]['find']({'where':{'id':_0xc11201['params']['id']}})[_0x1ef2('0x25')](handleEntityNotFound(_0x39100a,null))['then'](removeEntity(_0x39100a,null))[_0x1ef2('0x3e')](handleError(_0x39100a,null));};exports[_0x1ef2('0x45')]=function(_0x2acfaf,_0x3bf7c5){return db[_0x1ef2('0x2a')][_0x1ef2('0x45')]()[_0x1ef2('0x25')](respondWithResult(_0x3bf7c5,null))[_0x1ef2('0x3e')](handleError(_0x3bf7c5,null));}; \ No newline at end of file +var _0xba2e=['moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','then','error','stack','name','index','rawAttributes','fieldName','query','keys','model','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','map','type','VIRTUAL','options','Cdr','includeAll','include','findAll','catch','show','intersection','find','update','body','describe','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x44d85f,_0x329c55){var _0xa8d9e3=function(_0x2cec30){while(--_0x2cec30){_0x44d85f['push'](_0x44d85f['shift']());}};_0xa8d9e3(++_0x329c55);}(_0xba2e,0x1a0));var _0xeba2=function(_0x19853b,_0xa15f8a){_0x19853b=_0x19853b-0x0;var _0x38ca9d=_0xba2e[_0x19853b];return _0x38ca9d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xeba2('0x0'));var zipdir=require(_0xeba2('0x1'));var jsonpatch=require(_0xeba2('0x2'));var rp=require(_0xeba2('0x3'));var moment=require(_0xeba2('0x4'));var BPromise=require(_0xeba2('0x5'));var Mustache=require(_0xeba2('0x6'));var util=require('util');var path=require('path');var sox=require(_0xeba2('0x7'));var csv=require(_0xeba2('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeba2('0x9'));var squel=require(_0xeba2('0xa'));var crypto=require(_0xeba2('0xb'));var jsforce=require(_0xeba2('0xc'));var deskjs=require(_0xeba2('0xd'));var toCsv=require(_0xeba2('0x8'));var querystring=require(_0xeba2('0xe'));var Papa=require(_0xeba2('0xf'));var Redis=require(_0xeba2('0x10'));var authService=require(_0xeba2('0x11'));var qs=require(_0xeba2('0x12'));var as=require(_0xeba2('0x13'));var hardwareService=require(_0xeba2('0x14'));var logger=require('../../config/logger')(_0xeba2('0x15'));var utils=require('../../config/utils');var config=require(_0xeba2('0x16'));var licenseUtil=require(_0xeba2('0x17'));var db=require(_0xeba2('0x18'))['db'];function respondWithStatusCode(_0xfe49fc,_0x4b000b){_0x4b000b=_0x4b000b||0xcc;return function(_0x5e7088){if(_0x5e7088){return _0xfe49fc[_0xeba2('0x19')](_0x4b000b);}return _0xfe49fc[_0xeba2('0x1a')](_0x4b000b)[_0xeba2('0x1b')]();};}function respondWithResult(_0x2bc86d,_0x2b1521){_0x2b1521=_0x2b1521||0xc8;return function(_0x80e206){if(_0x80e206){return _0x2bc86d[_0xeba2('0x1a')](_0x2b1521)[_0xeba2('0x1c')](_0x80e206);}};}function respondWithFilteredResult(_0x54bcb2,_0xab0e77){return function(_0x5e2bd4){if(_0x5e2bd4){var _0x4b1bf8=_0x5e2bd4[_0xeba2('0x1d')],_0x3a708d=_0xab0e77[_0xeba2('0x1e')],_0x1abee5=_0xab0e77['offset']+_0xab0e77[_0xeba2('0x1f')],_0x2f5069;if(_0x1abee5>=_0x4b1bf8){_0x1abee5=_0x4b1bf8;_0x2f5069=0xc8;}else{_0x2f5069=0xce;}_0x54bcb2[_0xeba2('0x1a')](_0x2f5069);return _0x54bcb2[_0xeba2('0x20')]('Content-Range',_0x3a708d+'-'+_0x1abee5+'/'+_0x4b1bf8)[_0xeba2('0x1c')](_0x5e2bd4);}return null;};}function patchUpdates(_0x2e819f){return function(_0x595db3){try{jsonpatch['apply'](_0x595db3,_0x2e819f,!![]);}catch(_0x321e12){return BPromise[_0xeba2('0x21')](_0x321e12);}return _0x595db3[_0xeba2('0x22')]();};}function saveUpdates(_0x5b1fba,_0x5a6e53){return function(_0x43c720){if(_0x43c720){return _0x43c720['update'](_0x5b1fba)[_0xeba2('0x23')](function(_0x54f999){return _0x54f999;});}return null;};}function removeEntity(_0x21148e,_0x18eab0){return function(_0x49d434){if(_0x49d434){return _0x49d434['destroy']()[_0xeba2('0x23')](function(){_0x21148e[_0xeba2('0x1a')](0xcc)[_0xeba2('0x1b')]();});}};}function handleEntityNotFound(_0x26a112,_0x239b0c){return function(_0x493948){if(!_0x493948){_0x26a112['sendStatus'](0x194);}return _0x493948;};}function handleError(_0x4c86f4,_0x81510e){_0x81510e=_0x81510e||0x1f4;return function(_0x121ef5){logger[_0xeba2('0x24')](_0x121ef5[_0xeba2('0x25')]);if(_0x121ef5[_0xeba2('0x26')]){delete _0x121ef5['name'];}_0x4c86f4[_0xeba2('0x1a')](_0x81510e)['send'](_0x121ef5);};}exports[_0xeba2('0x27')]=function(_0x3ceb97,_0x55954a){var _0x24df40={},_0x5efe5c={},_0x3f4aba={'count':0x0,'rows':[]};var _0x22f506=_['map'](db['Cdr'][_0xeba2('0x28')],function(_0x3fa62f){return{'name':_0x3fa62f[_0xeba2('0x29')],'type':_0x3fa62f['type']['key']};});_0x5efe5c['model']=_['map'](_0x22f506,_0xeba2('0x26'));_0x5efe5c[_0xeba2('0x2a')]=_[_0xeba2('0x2b')](_0x3ceb97[_0xeba2('0x2a')]);_0x5efe5c['filters']=_['intersection'](_0x5efe5c[_0xeba2('0x2c')],_0x5efe5c[_0xeba2('0x2a')]);_0x24df40['attributes']=_['intersection'](_0x5efe5c[_0xeba2('0x2c')],qs[_0xeba2('0x2d')](_0x3ceb97[_0xeba2('0x2a')][_0xeba2('0x2d')]));_0x24df40[_0xeba2('0x2e')]=_0x24df40['attributes'][_0xeba2('0x2f')]?_0x24df40['attributes']:_0x5efe5c[_0xeba2('0x2c')];if(!_0x3ceb97['query']['hasOwnProperty'](_0xeba2('0x30'))){_0x24df40[_0xeba2('0x1f')]=qs[_0xeba2('0x1f')](_0x3ceb97[_0xeba2('0x2a')][_0xeba2('0x1f')]);_0x24df40[_0xeba2('0x1e')]=qs[_0xeba2('0x1e')](_0x3ceb97[_0xeba2('0x2a')]['offset']);}_0x24df40[_0xeba2('0x31')]=qs['sort'](_0x3ceb97[_0xeba2('0x2a')][_0xeba2('0x32')]);_0x24df40[_0xeba2('0x33')]=qs[_0xeba2('0x34')](_['pick'](_0x3ceb97[_0xeba2('0x2a')],_0x5efe5c[_0xeba2('0x34')]),_0x22f506);if(_0x3ceb97[_0xeba2('0x2a')][_0xeba2('0x35')]){_0x24df40[_0xeba2('0x33')]=_[_0xeba2('0x36')](_0x24df40['where'],{'$or':_[_0xeba2('0x37')](_0x22f506,function(_0x3d85a8){if(_0x3d85a8[_0xeba2('0x38')]!==_0xeba2('0x39')){var _0x4753f3={};_0x4753f3[_0x3d85a8[_0xeba2('0x26')]]={'$like':'%'+_0x3ceb97[_0xeba2('0x2a')][_0xeba2('0x35')]+'%'};return _0x4753f3;}})});}_0x24df40=_[_0xeba2('0x36')]({},_0x24df40,_0x3ceb97[_0xeba2('0x3a')]);var _0x29c017={'where':_0x24df40[_0xeba2('0x33')]};return db[_0xeba2('0x3b')]['count'](_0x29c017)[_0xeba2('0x23')](function(_0x2c5096){_0x3f4aba['count']=_0x2c5096;if(_0x3ceb97[_0xeba2('0x2a')][_0xeba2('0x3c')]){_0x24df40[_0xeba2('0x3d')]=[{'all':!![]}];}return db[_0xeba2('0x3b')][_0xeba2('0x3e')](_0x24df40);})[_0xeba2('0x23')](function(_0x5bf949){_0x3f4aba['rows']=_0x5bf949;return _0x3f4aba;})[_0xeba2('0x23')](respondWithFilteredResult(_0x55954a,_0x24df40))[_0xeba2('0x3f')](handleError(_0x55954a,null));};exports[_0xeba2('0x40')]=function(_0x4dac4e,_0x541689){var _0x1ebaa7={'raw':!![],'where':{'id':_0x4dac4e['params']['id']}},_0x2f7e7d={};_0x2f7e7d[_0xeba2('0x2c')]=_[_0xeba2('0x2b')](db[_0xeba2('0x3b')][_0xeba2('0x28')]);_0x2f7e7d[_0xeba2('0x2a')]=_[_0xeba2('0x2b')](_0x4dac4e['query']);_0x2f7e7d[_0xeba2('0x34')]=_[_0xeba2('0x41')](_0x2f7e7d['model'],_0x2f7e7d[_0xeba2('0x2a')]);_0x1ebaa7[_0xeba2('0x2e')]=_[_0xeba2('0x41')](_0x2f7e7d['model'],qs[_0xeba2('0x2d')](_0x4dac4e[_0xeba2('0x2a')][_0xeba2('0x2d')]));_0x1ebaa7[_0xeba2('0x2e')]=_0x1ebaa7[_0xeba2('0x2e')][_0xeba2('0x2f')]?_0x1ebaa7[_0xeba2('0x2e')]:_0x2f7e7d[_0xeba2('0x2c')];if(_0x4dac4e[_0xeba2('0x2a')]['includeAll']){_0x1ebaa7['include']=[{'all':!![]}];}_0x1ebaa7=_[_0xeba2('0x36')]({},_0x1ebaa7,_0x4dac4e[_0xeba2('0x3a')]);return db[_0xeba2('0x3b')][_0xeba2('0x42')](_0x1ebaa7)['then'](handleEntityNotFound(_0x541689,null))[_0xeba2('0x23')](respondWithResult(_0x541689,null))[_0xeba2('0x3f')](handleError(_0x541689,null));};exports['create']=function(_0x52f2c6,_0x773a23){return db[_0xeba2('0x3b')]['create'](_0x52f2c6['body'],{})[_0xeba2('0x23')](respondWithResult(_0x773a23,0xc9))['catch'](handleError(_0x773a23,null));};exports[_0xeba2('0x43')]=function(_0x59b174,_0x4b6579){if(_0x59b174[_0xeba2('0x44')]['id']){delete _0x59b174[_0xeba2('0x44')]['id'];}return db[_0xeba2('0x3b')]['find']({'where':{'id':_0x59b174['params']['id']}})[_0xeba2('0x23')](handleEntityNotFound(_0x4b6579,null))['then'](saveUpdates(_0x59b174['body'],null))['then'](respondWithResult(_0x4b6579,null))[_0xeba2('0x3f')](handleError(_0x4b6579,null));};exports['destroy']=function(_0x538317,_0x46d529){return db[_0xeba2('0x3b')][_0xeba2('0x42')]({'where':{'id':_0x538317['params']['id']}})[_0xeba2('0x23')](handleEntityNotFound(_0x46d529,null))[_0xeba2('0x23')](removeEntity(_0x46d529,null))[_0xeba2('0x3f')](handleError(_0x46d529,null));};exports[_0xeba2('0x45')]=function(_0xb04b9a,_0x49f2e0){return db[_0xeba2('0x3b')][_0xeba2('0x45')]()[_0xeba2('0x23')](respondWithResult(_0x49f2e0,null))[_0xeba2('0x3f')](handleError(_0x49f2e0,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 12cf5f7..07a3e7b 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 _0x2675=['path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','moment','bluebird'];(function(_0x311cf2,_0x1af59a){var _0x449e5d=function(_0x1417f9){while(--_0x1417f9){_0x311cf2['push'](_0x311cf2['shift']());}};_0x449e5d(++_0x1af59a);}(_0x2675,0x75));var _0x5267=function(_0xaba5bf,_0x1f81e4){_0xaba5bf=_0xaba5bf-0x0;var _0x4f2a54=_0x2675[_0xaba5bf];return _0x4f2a54;};'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':'cdr','paranoid':![],'indexes':[{'name':_0x5267('0x9'),'fields':[_0x5267('0x9')]},{'name':'calldate','fields':[_0x5267('0xa')]},{'name':'disposition','fields':[_0x5267('0xb')]},{'name':_0x5267('0xc'),'fields':[_0x5267('0xc')]},{'name':'src','fields':[_0x5267('0xd')]},{'name':'uniqueid','fields':[_0x5267('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x1967=['./cdr.attributes','define','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x60c8a1,_0x2a72de){var _0x12ba08=function(_0x1557f4){while(--_0x1557f4){_0x60c8a1['push'](_0x60c8a1['shift']());}};_0x12ba08(++_0x2a72de);}(_0x1967,0x173));var _0x7196=function(_0x455b6b,_0x21219a){_0x455b6b=_0x455b6b-0x0;var _0x3a20e6=_0x1967[_0x455b6b];return _0x3a20e6;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var fs=require('fs');var path=require(_0x7196('0x6'));var rimraf=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var attributes=require(_0x7196('0x9'));module['exports']=function(_0x36b01e,_0x186175){return _0x36b01e[_0x7196('0xa')](_0x7196('0xb'),attributes,{'tableName':_0x7196('0xc'),'paranoid':![],'indexes':[{'name':_0x7196('0xd'),'fields':['accountcode']},{'name':_0x7196('0xe'),'fields':[_0x7196('0xe')]},{'name':_0x7196('0xf'),'fields':[_0x7196('0xf')]},{'name':_0x7196('0x10'),'fields':['dst']},{'name':'src','fields':[_0x7196('0x11')]},{'name':_0x7196('0x12'),'fields':[_0x7196('0x12')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 0c5b637..63bec51 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 _0x24e5=['message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','request','info','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s'];(function(_0x231fcf,_0x57f8b3){var _0x140322=function(_0x4e81af){while(--_0x4e81af){_0x231fcf['push'](_0x231fcf['shift']());}};_0x140322(++_0x57f8b3);}(_0x24e5,0x1cb));var _0x524e=function(_0x528036,_0x5630a9){_0x528036=_0x528036-0x0;var _0xc9f7af=_0x24e5[_0x528036];return _0xc9f7af;};'use strict';var _=require(_0x524e('0x0'));var util=require('util');var moment=require(_0x524e('0x1'));var BPromise=require(_0x524e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x524e('0x3'));var db=require(_0x524e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x524e('0x5'));var config=require(_0x524e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x524e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30face,_0x88a97a,_0x1c92b2){return new BPromise(function(_0x4b061b,_0xcbe24e){return client[_0x524e('0x8')](_0x30face,_0x1c92b2)['then'](function(_0x5067a1){logger[_0x524e('0x9')]('Cdr,\x20%s,\x20%s',_0x88a97a,_0x524e('0xa'));logger['debug'](_0x524e('0xb'),_0x88a97a,'request\x20sent',JSON[_0x524e('0xc')](_0x5067a1));if(_0x5067a1[_0x524e('0xd')]){if(_0x5067a1['error'][_0x524e('0xe')]===0x1f4){logger[_0x524e('0xd')](_0x524e('0xf'),_0x88a97a,_0x5067a1['error'][_0x524e('0x10')]);return _0xcbe24e(_0x5067a1['error'][_0x524e('0x10')]);}logger['error']('Cdr,\x20%s,\x20%s',_0x88a97a,_0x5067a1[_0x524e('0xd')][_0x524e('0x10')]);return _0x4b061b(_0x5067a1[_0x524e('0xd')]['message']);}else{logger['info'](_0x524e('0xf'),_0x88a97a,_0x524e('0xa'));_0x4b061b(_0x5067a1[_0x524e('0x11')][_0x524e('0x10')]);}})[_0x524e('0x12')](function(_0x115d26){logger[_0x524e('0xd')](_0x524e('0xf'),_0x88a97a,_0x115d26);_0xcbe24e(_0x115d26);});});} \ No newline at end of file +var _0x73f3=['Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info'];(function(_0x354ab1,_0xec5b21){var _0x9918a1=function(_0x1becca){while(--_0x1becca){_0x354ab1['push'](_0x354ab1['shift']());}};_0x9918a1(++_0xec5b21);}(_0x73f3,0x1c0));var _0x373f=function(_0x5663b5,_0x1261f5){_0x5663b5=_0x5663b5-0x0;var _0x334f6d=_0x73f3[_0x5663b5];return _0x334f6d;};'use strict';var _=require(_0x373f('0x0'));var util=require(_0x373f('0x1'));var moment=require(_0x373f('0x2'));var BPromise=require(_0x373f('0x3'));var rs=require(_0x373f('0x4'));var fs=require('fs');var Redis=require(_0x373f('0x5'));var db=require(_0x373f('0x6'))['db'];var utils=require(_0x373f('0x7'));var logger=require(_0x373f('0x8'))(_0x373f('0x9'));var config=require('../../config/environment');var jayson=require(_0x373f('0xa'));var client=jayson[_0x373f('0xb')][_0x373f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2f0950,_0x698df8,_0x2f6e3c){return new BPromise(function(_0x259488,_0xff5670){return client['request'](_0x2f0950,_0x2f6e3c)['then'](function(_0x41eabe){logger[_0x373f('0xd')](_0x373f('0xe'),_0x698df8,_0x373f('0xf'));logger[_0x373f('0x10')](_0x373f('0x11'),_0x698df8,_0x373f('0xf'),JSON['stringify'](_0x41eabe));if(_0x41eabe[_0x373f('0x12')]){if(_0x41eabe[_0x373f('0x12')]['code']===0x1f4){logger['error'](_0x373f('0xe'),_0x698df8,_0x41eabe['error'][_0x373f('0x13')]);return _0xff5670(_0x41eabe['error']['message']);}logger[_0x373f('0x12')](_0x373f('0xe'),_0x698df8,_0x41eabe[_0x373f('0x12')][_0x373f('0x13')]);return _0x259488(_0x41eabe[_0x373f('0x12')]['message']);}else{logger[_0x373f('0xd')](_0x373f('0xe'),_0x698df8,_0x373f('0xf'));_0x259488(_0x41eabe[_0x373f('0x14')]['message']);}})[_0x373f('0x15')](function(_0x420276){logger['error']('Cdr,\x20%s,\x20%s',_0x698df8,_0x420276);_0xff5670(_0x420276);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 277efd1..f77cd60 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 _0x8366=['/describe','isAuthenticated','describe','/:id','show','put','delete','destroy','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get'];(function(_0x47e3c1,_0x4126ad){var _0x34dc4f=function(_0x1916c1){while(--_0x1916c1){_0x47e3c1['push'](_0x47e3c1['shift']());}};_0x34dc4f(++_0x4126ad);}(_0x8366,0xf7));var _0x6836=function(_0x7dbcdc,_0x29a870){_0x7dbcdc=_0x7dbcdc-0x0;var _0x78cb11=_0x8366[_0x7dbcdc];return _0x78cb11;};'use strict';var multer=require('multer');var util=require(_0x6836('0x0'));var path=require('path');var timeout=require(_0x6836('0x1'));var express=require(_0x6836('0x2'));var router=express['Router']();var auth=require(_0x6836('0x3'));var interaction=require(_0x6836('0x4'));var config=require(_0x6836('0x5'));var controller=require(_0x6836('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6836('0x7')](_0x6836('0x8'),auth[_0x6836('0x9')](),controller[_0x6836('0xa')]);router['get'](_0x6836('0xb'),auth[_0x6836('0x9')](),controller[_0x6836('0xc')]);router['post']('/',auth[_0x6836('0x9')](),controller['create']);router[_0x6836('0xd')](_0x6836('0xb'),auth[_0x6836('0x9')](),controller['update']);router[_0x6836('0xe')]('/:id',auth[_0x6836('0x9')](),controller[_0x6836('0xf')]);module[_0x6836('0x10')]=router; \ No newline at end of file +var _0x20a4=['Router','../../components/auth/service','../../config/environment','get','/describe','/:id','show','isAuthenticated','create','put','update','delete','destroy','exports','multer','path','express'];(function(_0x31f58e,_0x5215d9){var _0x2444ec=function(_0x2ff3bb){while(--_0x2ff3bb){_0x31f58e['push'](_0x31f58e['shift']());}};_0x2444ec(++_0x5215d9);}(_0x20a4,0x195));var _0x420a=function(_0x494965,_0x48ace5){_0x494965=_0x494965-0x0;var _0x3e682e=_0x20a4[_0x494965];return _0x3e682e;};'use strict';var multer=require(_0x420a('0x0'));var util=require('util');var path=require(_0x420a('0x1'));var timeout=require('connect-timeout');var express=require(_0x420a('0x2'));var router=express[_0x420a('0x3')]();var auth=require(_0x420a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x420a('0x5'));var controller=require('./cdr.controller');router[_0x420a('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x420a('0x7'),auth['isAuthenticated'](),controller['describe']);router[_0x420a('0x6')](_0x420a('0x8'),auth['isAuthenticated'](),controller[_0x420a('0x9')]);router['post']('/',auth[_0x420a('0xa')](),controller[_0x420a('0xb')]);router[_0x420a('0xc')](_0x420a('0x8'),auth['isAuthenticated'](),controller[_0x420a('0xd')]);router[_0x420a('0xe')](_0x420a('0x8'),auth[_0x420a('0xa')](),controller[_0x420a('0xf')]);module[_0x420a('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index e017a5e..be66eed 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 _0x1c33=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x55c708,_0x52344f){var _0x1ec499=function(_0x16fffd){while(--_0x16fffd){_0x55c708['push'](_0x55c708['shift']());}};_0x1ec499(++_0x52344f);}(_0x1c33,0xf6));var _0x31c3=function(_0x5b1488,_0x6a16d7){_0x5b1488=_0x5b1488-0x0;var _0x1adddf=_0x1c33[_0x5b1488];return _0x1adddf;};'use strict';var Sequelize=require(_0x31c3('0x0'));module[_0x31c3('0x1')]={'priority':{'type':Sequelize[_0x31c3('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x31c3('0x3')],'allowNull':![],'defaultValue':_0x31c3('0x4')},'appdata':{'type':Sequelize[_0x31c3('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x31c3('0x3')],'defaultValue':_0x31c3('0x6')}}; \ No newline at end of file +var _0x38b5=['exports','INTEGER','noop','STRING','*,*,*,*','sequelize'];(function(_0x5e8e54,_0xb75a7e){var _0x18f5d3=function(_0x26aa23){while(--_0x26aa23){_0x5e8e54['push'](_0x5e8e54['shift']());}};_0x18f5d3(++_0xb75a7e);}(_0x38b5,0x197));var _0x538b=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0x38b5[_0x59bcb1];return _0x4a737f;};'use strict';var Sequelize=require(_0x538b('0x0'));module[_0x538b('0x1')]={'priority':{'type':Sequelize[_0x538b('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x538b('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x538b('0x4')],'defaultValue':_0x538b('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 27fcf23..c1f39aa 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 _0x55b3=['save','update','then','error','name','send','show','params','model','ChatApplication','rawAttributes','query','keys','filters','attributes','intersection','fields','length','include','options','find','catch','body','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','lodash','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range'];(function(_0x4dc2a2,_0x48ed9d){var _0x33ed52=function(_0x40823e){while(--_0x40823e){_0x4dc2a2['push'](_0x4dc2a2['shift']());}};_0x33ed52(++_0x48ed9d);}(_0x55b3,0x17d));var _0x355b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x55b3[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0x355b('0x0'));var emlformat=require(_0x355b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x355b('0x2'));var jsonpatch=require(_0x355b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x355b('0x4'));var Mustache=require(_0x355b('0x5'));var util=require(_0x355b('0x6'));var path=require(_0x355b('0x7'));var sox=require(_0x355b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x355b('0x9'));var squel=require(_0x355b('0xa'));var crypto=require(_0x355b('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x355b('0xc'));var Papa=require(_0x355b('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x355b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x355b('0xf'));var logger=require(_0x355b('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x355b('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x355b('0x12'))['db'];function respondWithStatusCode(_0x5ad9db,_0x55766d){_0x55766d=_0x55766d||0xcc;return function(_0x4d1433){if(_0x4d1433){return _0x5ad9db[_0x355b('0x13')](_0x55766d);}return _0x5ad9db[_0x355b('0x14')](_0x55766d)[_0x355b('0x15')]();};}function respondWithResult(_0x36da8b,_0x1255d7){_0x1255d7=_0x1255d7||0xc8;return function(_0x154daa){if(_0x154daa){return _0x36da8b[_0x355b('0x14')](_0x1255d7)[_0x355b('0x16')](_0x154daa);}};}function respondWithFilteredResult(_0x99cc3e,_0x2ac80f){return function(_0x37635d){if(_0x37635d){var _0x2567ea=_0x37635d['count'],_0x5d6c6=_0x2ac80f[_0x355b('0x17')],_0x59775b=_0x2ac80f['offset']+_0x2ac80f[_0x355b('0x18')],_0x570080;if(_0x59775b>=_0x2567ea){_0x59775b=_0x2567ea;_0x570080=0xc8;}else{_0x570080=0xce;}_0x99cc3e['status'](_0x570080);return _0x99cc3e[_0x355b('0x19')](_0x355b('0x1a'),_0x5d6c6+'-'+_0x59775b+'/'+_0x2567ea)[_0x355b('0x16')](_0x37635d);}return null;};}function patchUpdates(_0x3024f5){return function(_0xccff82){try{jsonpatch['apply'](_0xccff82,_0x3024f5,!![]);}catch(_0x49a325){return BPromise['reject'](_0x49a325);}return _0xccff82[_0x355b('0x1b')]();};}function saveUpdates(_0x59e0a0,_0x4c30a3){return function(_0x43d391){if(_0x43d391){return _0x43d391[_0x355b('0x1c')](_0x59e0a0)[_0x355b('0x1d')](function(_0x1a2a1c){return _0x1a2a1c;});}return null;};}function removeEntity(_0xdd81e7,_0x77466c){return function(_0x7574bf){if(_0x7574bf){return _0x7574bf['destroy']()['then'](function(){_0xdd81e7[_0x355b('0x14')](0xcc)[_0x355b('0x15')]();});}};}function handleEntityNotFound(_0x52209b,_0x14cb6e){return function(_0x3b1549){if(!_0x3b1549){_0x52209b[_0x355b('0x13')](0x194);}return _0x3b1549;};}function handleError(_0x363883,_0x410eab){_0x410eab=_0x410eab||0x1f4;return function(_0x4d800c){logger[_0x355b('0x1e')](_0x4d800c['stack']);if(_0x4d800c[_0x355b('0x1f')]){delete _0x4d800c[_0x355b('0x1f')];}_0x363883[_0x355b('0x14')](_0x410eab)[_0x355b('0x20')](_0x4d800c);};}exports[_0x355b('0x21')]=function(_0x4d4a1b,_0x4c46da){var _0x68a6d0={'raw':!![],'where':{'id':_0x4d4a1b[_0x355b('0x22')]['id']}},_0x28d501={};_0x28d501[_0x355b('0x23')]=_['keys'](db[_0x355b('0x24')][_0x355b('0x25')]);_0x28d501[_0x355b('0x26')]=_[_0x355b('0x27')](_0x4d4a1b[_0x355b('0x26')]);_0x28d501[_0x355b('0x28')]=_['intersection'](_0x28d501['model'],_0x28d501[_0x355b('0x26')]);_0x68a6d0[_0x355b('0x29')]=_[_0x355b('0x2a')](_0x28d501['model'],qs[_0x355b('0x2b')](_0x4d4a1b['query'][_0x355b('0x2b')]));_0x68a6d0[_0x355b('0x29')]=_0x68a6d0['attributes'][_0x355b('0x2c')]?_0x68a6d0[_0x355b('0x29')]:_0x28d501[_0x355b('0x23')];if(_0x4d4a1b['query']['includeAll']){_0x68a6d0[_0x355b('0x2d')]=[{'all':!![]}];}_0x68a6d0=_['merge']({},_0x68a6d0,_0x4d4a1b[_0x355b('0x2e')]);return db['ChatApplication'][_0x355b('0x2f')](_0x68a6d0)[_0x355b('0x1d')](handleEntityNotFound(_0x4c46da,null))[_0x355b('0x1d')](respondWithResult(_0x4c46da,null))[_0x355b('0x30')](handleError(_0x4c46da,null));};exports[_0x355b('0x1c')]=function(_0x1a6f94,_0x34b95d){if(_0x1a6f94[_0x355b('0x31')]['id']){delete _0x1a6f94[_0x355b('0x31')]['id'];}return db[_0x355b('0x24')][_0x355b('0x2f')]({'where':{'id':_0x1a6f94[_0x355b('0x22')]['id']}})[_0x355b('0x1d')](handleEntityNotFound(_0x34b95d,null))['then'](saveUpdates(_0x1a6f94[_0x355b('0x31')],null))[_0x355b('0x1d')](respondWithResult(_0x34b95d,null))[_0x355b('0x30')](handleError(_0x34b95d,null));};exports[_0x355b('0x32')]=function(_0x30b605,_0x509406){return db[_0x355b('0x24')][_0x355b('0x2f')]({'where':{'id':_0x30b605[_0x355b('0x22')]['id']}})['then'](handleEntityNotFound(_0x509406,null))[_0x355b('0x1d')](removeEntity(_0x509406,null))['catch'](handleError(_0x509406,null));}; \ No newline at end of file +var _0x70bc=['path','to-csv','ejs','lodash','squel','crypto','jsforce','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','limit','set','Content-Range','apply','reject','destroy','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','then','body','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x1731d8,_0x1a8262){var _0xf07022=function(_0x511658){while(--_0x511658){_0x1731d8['push'](_0x1731d8['shift']());}};_0xf07022(++_0x1a8262);}(_0x70bc,0x72));var _0xc70b=function(_0x55ad5f,_0x2c7f1c){_0x55ad5f=_0x55ad5f-0x0;var _0x2fff07=_0x70bc[_0x55ad5f];return _0x2fff07;};'use strict';var pdf=require(_0xc70b('0x0'));var emlformat=require(_0xc70b('0x1'));var rimraf=require(_0xc70b('0x2'));var zipdir=require(_0xc70b('0x3'));var jsonpatch=require(_0xc70b('0x4'));var rp=require(_0xc70b('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc70b('0x6'));var sox=require('sox');var csv=require(_0xc70b('0x7'));var ejs=require(_0xc70b('0x8'));var fs=require('fs');var _=require(_0xc70b('0x9'));var squel=require(_0xc70b('0xa'));var crypto=require(_0xc70b('0xb'));var jsforce=require(_0xc70b('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc70b('0xd'));var Papa=require(_0xc70b('0xe'));var Redis=require(_0xc70b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc70b('0x10'));var as=require(_0xc70b('0x11'));var hardwareService=require(_0xc70b('0x12'));var logger=require('../../config/logger')(_0xc70b('0x13'));var utils=require(_0xc70b('0x14'));var config=require(_0xc70b('0x15'));var licenseUtil=require(_0xc70b('0x16'));var db=require(_0xc70b('0x17'))['db'];function respondWithStatusCode(_0x406831,_0x11a1bb){_0x11a1bb=_0x11a1bb||0xcc;return function(_0x2ce06d){if(_0x2ce06d){return _0x406831[_0xc70b('0x18')](_0x11a1bb);}return _0x406831['status'](_0x11a1bb)[_0xc70b('0x19')]();};}function respondWithResult(_0x4cb8db,_0x57544e){_0x57544e=_0x57544e||0xc8;return function(_0x1cb835){if(_0x1cb835){return _0x4cb8db[_0xc70b('0x1a')](_0x57544e)[_0xc70b('0x1b')](_0x1cb835);}};}function respondWithFilteredResult(_0x1b0760,_0x2ab350){return function(_0x693de5){if(_0x693de5){var _0x301cf0=_0x693de5[_0xc70b('0x1c')],_0x13afb2=_0x2ab350[_0xc70b('0x1d')],_0x13623e=_0x2ab350[_0xc70b('0x1d')]+_0x2ab350[_0xc70b('0x1e')],_0xd96a41;if(_0x13623e>=_0x301cf0){_0x13623e=_0x301cf0;_0xd96a41=0xc8;}else{_0xd96a41=0xce;}_0x1b0760[_0xc70b('0x1a')](_0xd96a41);return _0x1b0760[_0xc70b('0x1f')](_0xc70b('0x20'),_0x13afb2+'-'+_0x13623e+'/'+_0x301cf0)[_0xc70b('0x1b')](_0x693de5);}return null;};}function patchUpdates(_0x1ad0e4){return function(_0x5ae82b){try{jsonpatch[_0xc70b('0x21')](_0x5ae82b,_0x1ad0e4,!![]);}catch(_0x1e4139){return BPromise[_0xc70b('0x22')](_0x1e4139);}return _0x5ae82b['save']();};}function saveUpdates(_0x4a7b62,_0x583f1b){return function(_0x290841){if(_0x290841){return _0x290841['update'](_0x4a7b62)['then'](function(_0x9a0724){return _0x9a0724;});}return null;};}function removeEntity(_0x1f3980,_0x325a05){return function(_0x421042){if(_0x421042){return _0x421042[_0xc70b('0x23')]()['then'](function(){_0x1f3980[_0xc70b('0x1a')](0xcc)[_0xc70b('0x19')]();});}};}function handleEntityNotFound(_0x29da38,_0xbfa81){return function(_0x318e91){if(!_0x318e91){_0x29da38['sendStatus'](0x194);}return _0x318e91;};}function handleError(_0x41336d,_0x16aa69){_0x16aa69=_0x16aa69||0x1f4;return function(_0x1ef428){logger[_0xc70b('0x24')](_0x1ef428[_0xc70b('0x25')]);if(_0x1ef428[_0xc70b('0x26')]){delete _0x1ef428[_0xc70b('0x26')];}_0x41336d[_0xc70b('0x1a')](_0x16aa69)[_0xc70b('0x27')](_0x1ef428);};}exports[_0xc70b('0x28')]=function(_0xba3706,_0x1e9e92){var _0x4f3b65={'raw':!![],'where':{'id':_0xba3706[_0xc70b('0x29')]['id']}},_0xa9b8bd={};_0xa9b8bd[_0xc70b('0x2a')]=_[_0xc70b('0x2b')](db[_0xc70b('0x2c')][_0xc70b('0x2d')]);_0xa9b8bd['query']=_[_0xc70b('0x2b')](_0xba3706[_0xc70b('0x2e')]);_0xa9b8bd[_0xc70b('0x2f')]=_[_0xc70b('0x30')](_0xa9b8bd['model'],_0xa9b8bd[_0xc70b('0x2e')]);_0x4f3b65['attributes']=_[_0xc70b('0x30')](_0xa9b8bd['model'],qs[_0xc70b('0x31')](_0xba3706[_0xc70b('0x2e')]['fields']));_0x4f3b65[_0xc70b('0x32')]=_0x4f3b65['attributes'][_0xc70b('0x33')]?_0x4f3b65[_0xc70b('0x32')]:_0xa9b8bd[_0xc70b('0x2a')];if(_0xba3706[_0xc70b('0x2e')][_0xc70b('0x34')]){_0x4f3b65[_0xc70b('0x35')]=[{'all':!![]}];}_0x4f3b65=_[_0xc70b('0x36')]({},_0x4f3b65,_0xba3706[_0xc70b('0x37')]);return db[_0xc70b('0x2c')][_0xc70b('0x38')](_0x4f3b65)[_0xc70b('0x39')](handleEntityNotFound(_0x1e9e92,null))['then'](respondWithResult(_0x1e9e92,null))['catch'](handleError(_0x1e9e92,null));};exports['update']=function(_0x214d57,_0x177e4b){if(_0x214d57[_0xc70b('0x3a')]['id']){delete _0x214d57[_0xc70b('0x3a')]['id'];}return db['ChatApplication'][_0xc70b('0x38')]({'where':{'id':_0x214d57['params']['id']}})[_0xc70b('0x39')](handleEntityNotFound(_0x177e4b,null))[_0xc70b('0x39')](saveUpdates(_0x214d57[_0xc70b('0x3a')],null))[_0xc70b('0x39')](respondWithResult(_0x177e4b,null))[_0xc70b('0x3b')](handleError(_0x177e4b,null));};exports['destroy']=function(_0x591a20,_0x26917a){return db['ChatApplication']['find']({'where':{'id':_0x591a20[_0xc70b('0x29')]['id']}})['then'](handleEntityNotFound(_0x26917a,null))[_0xc70b('0x39')](removeEntity(_0x26917a,null))['catch'](handleError(_0x26917a,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 1348f72..c8475c8 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(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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 556935c..58729b4 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 _0x14c9=['request','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','ChatApplication,\x20%s,\x20%s','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0xe6feaf,_0x3ddce4){var _0x57ae9a=function(_0x32d3ac){while(--_0x32d3ac){_0xe6feaf['push'](_0xe6feaf['shift']());}};_0x57ae9a(++_0x3ddce4);}(_0x14c9,0xe6));var _0x914c=function(_0x290fe7,_0x10c1ff){_0x290fe7=_0x290fe7-0x0;var _0x27483e=_0x14c9[_0x290fe7];return _0x27483e;};'use strict';var _=require('lodash');var util=require(_0x914c('0x0'));var moment=require('moment');var BPromise=require(_0x914c('0x1'));var rs=require(_0x914c('0x2'));var fs=require('fs');var Redis=require(_0x914c('0x3'));var db=require(_0x914c('0x4'))['db'];var utils=require(_0x914c('0x5'));var logger=require(_0x914c('0x6'))('rpc');var config=require(_0x914c('0x7'));var jayson=require(_0x914c('0x8'));var client=jayson['client'][_0x914c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33f01b,_0x27728a,_0x444406){return new BPromise(function(_0x48b8f1,_0x52f2fb){return client[_0x914c('0xa')](_0x33f01b,_0x444406)['then'](function(_0x5fd003){logger[_0x914c('0xb')]('ChatApplication,\x20%s,\x20%s',_0x27728a,_0x914c('0xc'));logger[_0x914c('0xd')](_0x914c('0xe'),_0x27728a,'request\x20sent',JSON[_0x914c('0xf')](_0x5fd003));if(_0x5fd003['error']){if(_0x5fd003[_0x914c('0x10')]['code']===0x1f4){logger[_0x914c('0x10')](_0x914c('0x11'),_0x27728a,_0x5fd003[_0x914c('0x10')][_0x914c('0x12')]);return _0x52f2fb(_0x5fd003[_0x914c('0x10')]['message']);}logger[_0x914c('0x10')](_0x914c('0x11'),_0x27728a,_0x5fd003[_0x914c('0x10')][_0x914c('0x12')]);return _0x48b8f1(_0x5fd003[_0x914c('0x10')]['message']);}else{logger[_0x914c('0xb')]('ChatApplication,\x20%s,\x20%s',_0x27728a,_0x914c('0xc'));_0x48b8f1(_0x5fd003[_0x914c('0x13')][_0x914c('0x12')]);}})['catch'](function(_0x3a7be6){logger[_0x914c('0x10')](_0x914c('0x11'),_0x27728a,_0x3a7be6);_0x52f2fb(_0x3a7be6);});});} \ No newline at end of file +var _0xf1fa=['../../mysqldb','../../config/utils','../../config/environment','client','http','request','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x1aa617,_0x23271a){var _0x38653c=function(_0x1f17be){while(--_0x1f17be){_0x1aa617['push'](_0x1aa617['shift']());}};_0x38653c(++_0x23271a);}(_0xf1fa,0x121));var _0xaf1f=function(_0x5e9d51,_0x12636f){_0x5e9d51=_0x5e9d51-0x0;var _0x2e3662=_0xf1fa[_0x5e9d51];return _0x2e3662;};'use strict';var _=require('lodash');var util=require(_0xaf1f('0x0'));var moment=require(_0xaf1f('0x1'));var BPromise=require(_0xaf1f('0x2'));var rs=require(_0xaf1f('0x3'));var fs=require('fs');var Redis=require(_0xaf1f('0x4'));var db=require(_0xaf1f('0x5'))['db'];var utils=require(_0xaf1f('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xaf1f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xaf1f('0x8')][_0xaf1f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3afe82,_0xee9609,_0x112711){return new BPromise(function(_0x1263eb,_0x6e24f4){return client[_0xaf1f('0xa')](_0x3afe82,_0x112711)['then'](function(_0x21c4a6){logger[_0xaf1f('0xb')](_0xaf1f('0xc'),_0xee9609,'request\x20sent');logger[_0xaf1f('0xd')](_0xaf1f('0xe'),_0xee9609,_0xaf1f('0xf'),JSON[_0xaf1f('0x10')](_0x21c4a6));if(_0x21c4a6[_0xaf1f('0x11')]){if(_0x21c4a6[_0xaf1f('0x11')]['code']===0x1f4){logger[_0xaf1f('0x11')](_0xaf1f('0xc'),_0xee9609,_0x21c4a6[_0xaf1f('0x11')][_0xaf1f('0x12')]);return _0x6e24f4(_0x21c4a6[_0xaf1f('0x11')][_0xaf1f('0x12')]);}logger[_0xaf1f('0x11')](_0xaf1f('0xc'),_0xee9609,_0x21c4a6[_0xaf1f('0x11')][_0xaf1f('0x12')]);return _0x1263eb(_0x21c4a6['error'][_0xaf1f('0x12')]);}else{logger[_0xaf1f('0xb')](_0xaf1f('0xc'),_0xee9609,_0xaf1f('0xf'));_0x1263eb(_0x21c4a6[_0xaf1f('0x13')][_0xaf1f('0x12')]);}})[_0xaf1f('0x14')](function(_0x18e531){logger[_0xaf1f('0x11')]('ChatApplication,\x20%s,\x20%s',_0xee9609,_0x18e531);_0x6e24f4(_0x18e531);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index ab89c9f..1869d43 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 _0x2e6a=['Router','../../components/auth/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x533dd3,_0x35b59a){var _0x500636=function(_0x8633a3){while(--_0x8633a3){_0x533dd3['push'](_0x533dd3['shift']());}};_0x500636(++_0x35b59a);}(_0x2e6a,0xb1));var _0xa2e6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2e6a[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0xa2e6('0x0'));var path=require(_0xa2e6('0x1'));var timeout=require(_0xa2e6('0x2'));var express=require('express');var router=express[_0xa2e6('0x3')]();var auth=require(_0xa2e6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa2e6('0x5'));var controller=require(_0xa2e6('0x6'));router[_0xa2e6('0x7')](_0xa2e6('0x8'),auth[_0xa2e6('0x9')](),controller[_0xa2e6('0xa')]);router[_0xa2e6('0xb')](_0xa2e6('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xa2e6('0xc')]('/:id',auth[_0xa2e6('0x9')](),controller[_0xa2e6('0xd')]);module[_0xa2e6('0xe')]=router; \ No newline at end of file +var _0x93d4=['isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','put'];(function(_0x5a3c7b,_0x3fad44){var _0x5763f5=function(_0x238f9b){while(--_0x238f9b){_0x5a3c7b['push'](_0x5a3c7b['shift']());}};_0x5763f5(++_0x3fad44);}(_0x93d4,0x1e4));var _0x493d=function(_0xbc5114,_0x4a3578){_0xbc5114=_0xbc5114-0x0;var _0x10b8ce=_0x93d4[_0xbc5114];return _0x10b8ce;};'use strict';var multer=require(_0x493d('0x0'));var util=require(_0x493d('0x1'));var path=require(_0x493d('0x2'));var timeout=require(_0x493d('0x3'));var express=require(_0x493d('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x493d('0x5'));var config=require(_0x493d('0x6'));var controller=require(_0x493d('0x7'));router[_0x493d('0x8')](_0x493d('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x493d('0xa')](_0x493d('0x9'),auth[_0x493d('0xb')](),controller[_0x493d('0xc')]);router['delete'](_0x493d('0x9'),auth[_0x493d('0xb')](),controller[_0x493d('0xd')]);module[_0x493d('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index bae9eeb..e5401a5 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 _0xef08=['exports','STRING','BOOLEAN','sequelize'];(function(_0x333ee4,_0x47da07){var _0x580eee=function(_0x34fe4d){while(--_0x34fe4d){_0x333ee4['push'](_0x333ee4['shift']());}};_0x580eee(++_0x47da07);}(_0xef08,0x7b));var _0x8ef0=function(_0x53788f,_0x1bd496){_0x53788f=_0x53788f-0x0;var _0x2a0821=_0xef08[_0x53788f];return _0x2a0821;};'use strict';var Sequelize=require(_0x8ef0('0x0'));module[_0x8ef0('0x1')]={'name':{'type':Sequelize[_0x8ef0('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8ef0('0x2')]},'write':{'type':Sequelize[_0x8ef0('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf14b=['exports','STRING','BOOLEAN','sequelize'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xf14b,0x16b));var _0xbf14=function(_0x2a59e0,_0xc12ff){_0x2a59e0=_0x2a59e0-0x0;var _0x48813a=_0xf14b[_0x2a59e0];return _0x48813a;};'use strict';var Sequelize=require(_0xbf14('0x0'));module[_0xbf14('0x1')]={'name':{'type':Sequelize[_0xbf14('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xbf14('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 dea4138..88fda2c 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 _0x2ebd=['findAll','rows','show','params','keys','find','create','body','update','destroy','describe','getUnread','toInteger','addMembers','ids','omit','getMembers','findOne','User','pick','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','nolimit','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','../../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','./chatGroup.socket','jayson/promise','client','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','name','send','index','ChatGroup','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include'];(function(_0x9a41f1,_0x26a48b){var _0x1d2eab=function(_0x520a48){while(--_0x520a48){_0x9a41f1['push'](_0x9a41f1['shift']());}};_0x1d2eab(++_0x26a48b);}(_0x2ebd,0x1c8));var _0xd2eb=function(_0x13706a,_0xca0917){_0x13706a=_0x13706a-0x0;var _0x97e6ad=_0x2ebd[_0x13706a];return _0x97e6ad;};'use strict';var pdf=require(_0xd2eb('0x0'));var emlformat=require(_0xd2eb('0x1'));var rimraf=require(_0xd2eb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd2eb('0x3'));var moment=require(_0xd2eb('0x4'));var BPromise=require(_0xd2eb('0x5'));var Mustache=require(_0xd2eb('0x6'));var util=require(_0xd2eb('0x7'));var path=require(_0xd2eb('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd2eb('0x9'));var fs=require('fs');var _=require(_0xd2eb('0xa'));var squel=require(_0xd2eb('0xb'));var crypto=require(_0xd2eb('0xc'));var jsforce=require(_0xd2eb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd2eb('0xe'));var querystring=require(_0xd2eb('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd2eb('0x10'));var qs=require(_0xd2eb('0x11'));var as=require(_0xd2eb('0x12'));var hardwareService=require(_0xd2eb('0x13'));var logger=require(_0xd2eb('0x14'))(_0xd2eb('0x15'));var utils=require(_0xd2eb('0x16'));var config=require(_0xd2eb('0x17'));var licenseUtil=require(_0xd2eb('0x18'));var db=require(_0xd2eb('0x19'))['db'];config[_0xd2eb('0x1a')]=_[_0xd2eb('0x1b')](config['redis'],{'host':_0xd2eb('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd2eb('0x1a')]));require(_0xd2eb('0x1d'))['register'](socket);var jayson=require(_0xd2eb('0x1e'));var client=jayson[_0xd2eb('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa4f6c4,_0xa042c9,_0x216f82,_0x4bf46e){return new BPromise(function(_0x5a4db7,_0x80d2eb){var _0x5086ab=_0x4bf46e||client;return _0x5086ab['request'](_0xa4f6c4,_0x216f82)[_0xd2eb('0x20')](function(_0xda8ac1){logger['info'](_0xd2eb('0x21'),_0xa042c9,_0xd2eb('0x22'));logger[_0xd2eb('0x23')](_0xd2eb('0x24'),_0xa042c9,_0xd2eb('0x22'),JSON[_0xd2eb('0x25')](_0xda8ac1));if(_0xda8ac1[_0xd2eb('0x26')]){if(_0xda8ac1[_0xd2eb('0x26')]['code']===0x1f4){logger[_0xd2eb('0x26')]('ChatGroup,\x20%s,\x20%s',_0xa042c9,_0xda8ac1[_0xd2eb('0x26')][_0xd2eb('0x27')]);return _0x80d2eb(_0xda8ac1[_0xd2eb('0x26')][_0xd2eb('0x27')]);}logger['error'](_0xd2eb('0x21'),_0xa042c9,_0xda8ac1[_0xd2eb('0x26')]['message']);return _0x5a4db7(_0xda8ac1[_0xd2eb('0x26')][_0xd2eb('0x27')]);}else{logger[_0xd2eb('0x28')](_0xd2eb('0x21'),_0xa042c9,_0xd2eb('0x22'));_0x5a4db7(_0xda8ac1[_0xd2eb('0x29')][_0xd2eb('0x27')]);}})[_0xd2eb('0x2a')](function(_0x517536){logger[_0xd2eb('0x26')](_0xd2eb('0x21'),_0xa042c9,_0x517536);_0x80d2eb(_0x517536);});});}function respondWithStatusCode(_0x22329f,_0x3e6eb1){_0x3e6eb1=_0x3e6eb1||0xcc;return function(_0x33832f){if(_0x33832f){return _0x22329f[_0xd2eb('0x2b')](_0x3e6eb1);}return _0x22329f[_0xd2eb('0x2c')](_0x3e6eb1)[_0xd2eb('0x2d')]();};}function respondWithResult(_0x1c6c1b,_0x3db184){_0x3db184=_0x3db184||0xc8;return function(_0xd1154){if(_0xd1154){return _0x1c6c1b[_0xd2eb('0x2c')](_0x3db184)[_0xd2eb('0x2e')](_0xd1154);}};}function respondWithFilteredResult(_0x375c0e,_0x38b271){return function(_0x39ee3d){if(_0x39ee3d){var _0x448973=_0x39ee3d[_0xd2eb('0x2f')],_0x6996b=_0x38b271['offset'],_0x6998b1=_0x38b271[_0xd2eb('0x30')]+_0x38b271[_0xd2eb('0x31')],_0x39ed9d;if(_0x6998b1>=_0x448973){_0x6998b1=_0x448973;_0x39ed9d=0xc8;}else{_0x39ed9d=0xce;}_0x375c0e[_0xd2eb('0x2c')](_0x39ed9d);return _0x375c0e['set'](_0xd2eb('0x32'),_0x6996b+'-'+_0x6998b1+'/'+_0x448973)['json'](_0x39ee3d);}return null;};}function patchUpdates(_0x2e4559){return function(_0x1225f8){try{jsonpatch['apply'](_0x1225f8,_0x2e4559,!![]);}catch(_0x33abaa){return BPromise[_0xd2eb('0x33')](_0x33abaa);}return _0x1225f8[_0xd2eb('0x34')]();};}function saveUpdates(_0x13af38,_0x19b833){return function(_0x10a247){if(_0x10a247){return _0x10a247['update'](_0x13af38)['then'](function(_0x15d396){return _0x15d396;});}return null;};}function removeEntity(_0x4f573a,_0x4d6187){return function(_0x3e9efa){if(_0x3e9efa){return _0x3e9efa['destroy']()[_0xd2eb('0x20')](function(){_0x4f573a['status'](0xcc)[_0xd2eb('0x2d')]();});}};}function handleEntityNotFound(_0x3f9020,_0x4df58a){return function(_0x47a942){if(!_0x47a942){_0x3f9020[_0xd2eb('0x2b')](0x194);}return _0x47a942;};}function handleError(_0x564c76,_0x455011){_0x455011=_0x455011||0x1f4;return function(_0x38877b){logger[_0xd2eb('0x26')](_0x38877b['stack']);if(_0x38877b['name']){delete _0x38877b[_0xd2eb('0x35')];}_0x564c76['status'](_0x455011)[_0xd2eb('0x36')](_0x38877b);};}exports[_0xd2eb('0x37')]=function(_0x3d0be3,_0x2e0975){var _0x5c3070={},_0x7d4daa={},_0x5a6d73={'count':0x0,'rows':[]};var _0x46de47=_['map'](db[_0xd2eb('0x38')][_0xd2eb('0x39')],function(_0x45ada1){return{'name':_0x45ada1[_0xd2eb('0x3a')],'type':_0x45ada1[_0xd2eb('0x3b')][_0xd2eb('0x3c')]};});_0x7d4daa[_0xd2eb('0x3d')]=_[_0xd2eb('0x3e')](_0x46de47,_0xd2eb('0x35'));_0x7d4daa[_0xd2eb('0x3f')]=_['keys'](_0x3d0be3[_0xd2eb('0x3f')]);_0x7d4daa[_0xd2eb('0x40')]=_['intersection'](_0x7d4daa[_0xd2eb('0x3d')],_0x7d4daa[_0xd2eb('0x3f')]);_0x5c3070[_0xd2eb('0x41')]=_[_0xd2eb('0x42')](_0x7d4daa['model'],qs[_0xd2eb('0x43')](_0x3d0be3['query'][_0xd2eb('0x43')]));_0x5c3070[_0xd2eb('0x41')]=_0x5c3070['attributes'][_0xd2eb('0x44')]?_0x5c3070[_0xd2eb('0x41')]:_0x7d4daa[_0xd2eb('0x3d')];if(!_0x3d0be3[_0xd2eb('0x3f')][_0xd2eb('0x45')]('nolimit')){_0x5c3070[_0xd2eb('0x31')]=qs[_0xd2eb('0x31')](_0x3d0be3[_0xd2eb('0x3f')][_0xd2eb('0x31')]);_0x5c3070[_0xd2eb('0x30')]=qs['offset'](_0x3d0be3[_0xd2eb('0x3f')][_0xd2eb('0x30')]);}_0x5c3070[_0xd2eb('0x46')]=qs[_0xd2eb('0x47')](_0x3d0be3['query'][_0xd2eb('0x47')]);_0x5c3070['where']=qs[_0xd2eb('0x40')](_['pick'](_0x3d0be3[_0xd2eb('0x3f')],_0x7d4daa[_0xd2eb('0x40')]),_0x46de47);if(_0x3d0be3[_0xd2eb('0x3f')][_0xd2eb('0x48')]){_0x5c3070[_0xd2eb('0x49')]=_['merge'](_0x5c3070[_0xd2eb('0x49')],{'$or':_[_0xd2eb('0x3e')](_0x46de47,function(_0x5e5883){if(_0x5e5883[_0xd2eb('0x3b')]!==_0xd2eb('0x4a')){var _0x2ffceb={};_0x2ffceb[_0x5e5883[_0xd2eb('0x35')]]={'$like':'%'+_0x3d0be3[_0xd2eb('0x3f')][_0xd2eb('0x48')]+'%'};return _0x2ffceb;}})});}_0x5c3070=_[_0xd2eb('0x4b')]({},_0x5c3070,_0x3d0be3[_0xd2eb('0x4c')]);var _0x6fc4aa={'where':_0x5c3070['where']};return db[_0xd2eb('0x38')]['count'](_0x6fc4aa)[_0xd2eb('0x20')](function(_0x22f0fc){_0x5a6d73[_0xd2eb('0x2f')]=_0x22f0fc;if(_0x3d0be3[_0xd2eb('0x3f')][_0xd2eb('0x4d')]){_0x5c3070[_0xd2eb('0x4e')]=[{'all':!![]}];}return db[_0xd2eb('0x38')][_0xd2eb('0x4f')](_0x5c3070);})[_0xd2eb('0x20')](function(_0x10da6d){_0x5a6d73[_0xd2eb('0x50')]=_0x10da6d;return _0x5a6d73;})[_0xd2eb('0x20')](respondWithFilteredResult(_0x2e0975,_0x5c3070))[_0xd2eb('0x2a')](handleError(_0x2e0975,null));};exports[_0xd2eb('0x51')]=function(_0x375da1,_0x2f079c){var _0xe15d62={'raw':!![],'where':{'id':_0x375da1[_0xd2eb('0x52')]['id']}},_0x412b70={};_0x412b70[_0xd2eb('0x3d')]=_[_0xd2eb('0x53')](db[_0xd2eb('0x38')][_0xd2eb('0x39')]);_0x412b70['query']=_[_0xd2eb('0x53')](_0x375da1[_0xd2eb('0x3f')]);_0x412b70[_0xd2eb('0x40')]=_['intersection'](_0x412b70[_0xd2eb('0x3d')],_0x412b70['query']);_0xe15d62['attributes']=_[_0xd2eb('0x42')](_0x412b70[_0xd2eb('0x3d')],qs['fields'](_0x375da1[_0xd2eb('0x3f')]['fields']));_0xe15d62[_0xd2eb('0x41')]=_0xe15d62[_0xd2eb('0x41')][_0xd2eb('0x44')]?_0xe15d62[_0xd2eb('0x41')]:_0x412b70[_0xd2eb('0x3d')];if(_0x375da1[_0xd2eb('0x3f')]['includeAll']){_0xe15d62['include']=[{'all':!![]}];}_0xe15d62=_['merge']({},_0xe15d62,_0x375da1[_0xd2eb('0x4c')]);return db[_0xd2eb('0x38')][_0xd2eb('0x54')](_0xe15d62)[_0xd2eb('0x20')](handleEntityNotFound(_0x2f079c,null))[_0xd2eb('0x20')](respondWithResult(_0x2f079c,null))['catch'](handleError(_0x2f079c,null));};exports['create']=function(_0x5b2579,_0xeddd97){return db['ChatGroup'][_0xd2eb('0x55')](_0x5b2579[_0xd2eb('0x56')],{})[_0xd2eb('0x20')](respondWithResult(_0xeddd97,0xc9))['catch'](handleError(_0xeddd97,null));};exports[_0xd2eb('0x57')]=function(_0x4292b3,_0x4f98ce){if(_0x4292b3['body']['id']){delete _0x4292b3[_0xd2eb('0x56')]['id'];}return db[_0xd2eb('0x38')][_0xd2eb('0x54')]({'where':{'id':_0x4292b3[_0xd2eb('0x52')]['id']}})['then'](handleEntityNotFound(_0x4f98ce,null))['then'](saveUpdates(_0x4292b3[_0xd2eb('0x56')],null))[_0xd2eb('0x20')](respondWithResult(_0x4f98ce,null))[_0xd2eb('0x2a')](handleError(_0x4f98ce,null));};exports[_0xd2eb('0x58')]=function(_0x5840ab,_0x3ff2a8){return db[_0xd2eb('0x38')]['find']({'where':{'id':_0x5840ab['params']['id']}})['then'](handleEntityNotFound(_0x3ff2a8,null))[_0xd2eb('0x20')](removeEntity(_0x3ff2a8,null))[_0xd2eb('0x2a')](handleError(_0x3ff2a8,null));};exports[_0xd2eb('0x59')]=function(_0x3954de,_0x130e39){return db['ChatGroup'][_0xd2eb('0x59')]()[_0xd2eb('0x20')](respondWithResult(_0x130e39,null))[_0xd2eb('0x2a')](handleError(_0x130e39,null));};exports[_0xd2eb('0x5a')]=function(_0x329210,_0x33b5c6,_0x39352d){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x329210[_0xd2eb('0x52')]['id'],'ToId':_0x329210['user']['id'],'read':![]}})[_0xd2eb('0x20')](function(_0x15531c){return{'id':_[_0xd2eb('0x5b')](_0x329210['params']['id']),'count':_0x15531c};})[_0xd2eb('0x20')](respondWithResult(_0x33b5c6,null))[_0xd2eb('0x2a')](handleError(_0x33b5c6,null));};exports[_0xd2eb('0x5c')]=function(_0x3d1faf,_0x3775bf,_0x5a8cc8){return db[_0xd2eb('0x38')][_0xd2eb('0x54')]({'where':{'id':_0x3d1faf[_0xd2eb('0x52')]['id']}})[_0xd2eb('0x20')](handleEntityNotFound(_0x3775bf,null))[_0xd2eb('0x20')](function(_0x3db519){if(_0x3db519){return _0x3db519[_0xd2eb('0x5c')](_0x3d1faf[_0xd2eb('0x56')][_0xd2eb('0x5d')],_[_0xd2eb('0x5e')](_0x3d1faf['body'],[_0xd2eb('0x5d'),'id'])||{});}})['then'](respondWithResult(_0x3775bf,null))[_0xd2eb('0x2a')](handleError(_0x3775bf,null));};exports[_0xd2eb('0x5f')]=function(_0x425e32,_0x4c5eb7,_0x507556){var _0x48eb34={};var _0x306837={};var _0x2151df;var _0x420ec5;return db[_0xd2eb('0x38')][_0xd2eb('0x60')]({'where':{'id':_0x425e32[_0xd2eb('0x52')]['id']}})[_0xd2eb('0x20')](handleEntityNotFound(_0x4c5eb7,null))[_0xd2eb('0x20')](function(_0x2ea3fe){if(_0x2ea3fe){_0x2151df=_0x2ea3fe;_0x306837[_0xd2eb('0x3d')]=_[_0xd2eb('0x53')](db[_0xd2eb('0x61')][_0xd2eb('0x39')]);_0x306837[_0xd2eb('0x3f')]=_['keys'](_0x425e32[_0xd2eb('0x3f')]);_0x306837[_0xd2eb('0x40')]=_['intersection'](_0x306837[_0xd2eb('0x3d')],_0x306837[_0xd2eb('0x3f')]);_0x48eb34['attributes']=_[_0xd2eb('0x42')](_0x306837[_0xd2eb('0x3d')],qs[_0xd2eb('0x43')](_0x425e32[_0xd2eb('0x3f')]['fields']));_0x48eb34[_0xd2eb('0x41')]=_0x48eb34[_0xd2eb('0x41')][_0xd2eb('0x44')]?_0x48eb34['attributes']:_0x306837[_0xd2eb('0x3d')];_0x48eb34['order']=qs[_0xd2eb('0x47')](_0x425e32['query']['sort']);_0x48eb34['where']=qs['filters'](_[_0xd2eb('0x62')](_0x425e32['query'],_0x306837[_0xd2eb('0x40')]));if(_0x425e32['query'][_0xd2eb('0x48')]){_0x48eb34[_0xd2eb('0x49')]=_['merge'](_0x48eb34[_0xd2eb('0x49')],{'$or':_[_0xd2eb('0x3e')](_0x48eb34[_0xd2eb('0x41')],function(_0xbba508){var _0x4b27cc={};_0x4b27cc[_0xbba508]={'$like':'%'+_0x425e32[_0xd2eb('0x3f')][_0xd2eb('0x48')]+'%'};return _0x4b27cc;})});}_0x48eb34=_['merge']({},_0x48eb34,_0x425e32['options']);return _0x2151df[_0xd2eb('0x5f')](_0x48eb34);}})['then'](function(_0x3034d2){if(_0x3034d2){_0x420ec5=_0x3034d2['length'];if(!_0x425e32[_0xd2eb('0x3f')]['hasOwnProperty']('nolimit')){_0x48eb34[_0xd2eb('0x31')]=qs[_0xd2eb('0x31')](_0x425e32['query'][_0xd2eb('0x31')]);_0x48eb34['offset']=qs[_0xd2eb('0x30')](_0x425e32[_0xd2eb('0x3f')][_0xd2eb('0x30')]);}return _0x2151df[_0xd2eb('0x5f')](_0x48eb34);}})[_0xd2eb('0x20')](function(_0x33ce41){if(_0x33ce41){return _0x33ce41?{'count':_0x420ec5,'rows':_0x33ce41}:null;}})[_0xd2eb('0x20')](respondWithResult(_0x4c5eb7,null))[_0xd2eb('0x2a')](handleError(_0x4c5eb7,null));};exports[_0xd2eb('0x63')]=function(_0x3df54e,_0x446acf,_0x475c57){return db[_0xd2eb('0x38')][_0xd2eb('0x54')]({'where':{'id':_0x3df54e[_0xd2eb('0x52')]['id']}})[_0xd2eb('0x20')](handleEntityNotFound(_0x446acf,null))[_0xd2eb('0x20')](function(_0x5d4963){if(_0x5d4963){return _0x5d4963['removeMembers'](_0x3df54e[_0xd2eb('0x3f')]['ids']);}})[_0xd2eb('0x20')](respondWithStatusCode(_0x446acf,null))['catch'](handleError(_0x446acf,null));};exports[_0xd2eb('0x64')]=function(_0x4c0a96,_0x43c9b6,_0x18d317){if(_0x4c0a96['body']['id']){delete _0x4c0a96[_0xd2eb('0x56')]['id'];}return db[_0xd2eb('0x38')][_0xd2eb('0x54')]({'where':{'id':_0x4c0a96[_0xd2eb('0x52')]['id']}})[_0xd2eb('0x20')](handleEntityNotFound(_0x43c9b6,null))[_0xd2eb('0x20')](function(_0x10882c){if(_0x10882c){_0x4c0a96['body'][_0xd2eb('0x65')]=_0x10882c['id'];return db[_0xd2eb('0x66')][_0xd2eb('0x55')](_0x4c0a96['body']);}})[_0xd2eb('0x20')](respondWithResult(_0x43c9b6,null))[_0xd2eb('0x2a')](handleError(_0x43c9b6,null));};exports[_0xd2eb('0x67')]=function(_0xd93e33,_0x118c29,_0x232c4e){var _0x4108a2={};var _0xf28c6e={};var _0x3cb8d2;var _0xb1e3e0;return db[_0xd2eb('0x38')]['findOne']({'where':{'id':_0xd93e33['params']['id']}})[_0xd2eb('0x20')](handleEntityNotFound(_0x118c29,null))['then'](function(_0x53e6af){if(_0x53e6af){_0x3cb8d2=_0x53e6af;_0xf28c6e[_0xd2eb('0x3d')]=_[_0xd2eb('0x53')](db[_0xd2eb('0x66')][_0xd2eb('0x39')]);_0xf28c6e[_0xd2eb('0x3f')]=_['keys'](_0xd93e33[_0xd2eb('0x3f')]);_0xf28c6e[_0xd2eb('0x40')]=_[_0xd2eb('0x42')](_0xf28c6e[_0xd2eb('0x3d')],_0xf28c6e[_0xd2eb('0x3f')]);_0x4108a2[_0xd2eb('0x41')]=_['intersection'](_0xf28c6e[_0xd2eb('0x3d')],qs[_0xd2eb('0x43')](_0xd93e33[_0xd2eb('0x3f')][_0xd2eb('0x43')]));_0x4108a2[_0xd2eb('0x41')]=_0x4108a2[_0xd2eb('0x41')][_0xd2eb('0x44')]?_0x4108a2[_0xd2eb('0x41')]:_0xf28c6e['model'];_0x4108a2[_0xd2eb('0x46')]=qs[_0xd2eb('0x47')](_0xd93e33['query'][_0xd2eb('0x47')]);_0x4108a2[_0xd2eb('0x49')]=qs[_0xd2eb('0x40')](_[_0xd2eb('0x62')](_0xd93e33[_0xd2eb('0x3f')],_0xf28c6e[_0xd2eb('0x40')]));if(_0xd93e33[_0xd2eb('0x3f')][_0xd2eb('0x48')]){_0x4108a2[_0xd2eb('0x49')]=_['merge'](_0x4108a2['where'],{'$or':_[_0xd2eb('0x3e')](_0x4108a2[_0xd2eb('0x41')],function(_0xb56cc9){var _0x3737fa={};_0x3737fa[_0xb56cc9]={'$like':'%'+_0xd93e33[_0xd2eb('0x3f')][_0xd2eb('0x48')]+'%'};return _0x3737fa;})});}if(_0xd93e33[_0xd2eb('0x3f')]['$gte']){var _0x56c2a9=_0xd93e33['query'][_0xd2eb('0x68')]['split'](',');var _0x504edc={};_0x504edc[_0x56c2a9[0x0]]={'$gte':moment(_0x56c2a9[0x1])['format'](_0xd2eb('0x69'))};_0x4108a2[_0xd2eb('0x49')]=_['merge'](_0x4108a2[_0xd2eb('0x49')],_0x504edc);}_0x4108a2=_[_0xd2eb('0x4b')]({},_0x4108a2,_0xd93e33[_0xd2eb('0x4c')]);return _0x3cb8d2[_0xd2eb('0x67')](_0x4108a2);}})[_0xd2eb('0x20')](function(_0x56495d){if(_0x56495d){_0xb1e3e0=_0x56495d[_0xd2eb('0x44')];if(!_0xd93e33[_0xd2eb('0x3f')][_0xd2eb('0x45')](_0xd2eb('0x6a'))){_0x4108a2[_0xd2eb('0x31')]=qs['limit'](_0xd93e33[_0xd2eb('0x3f')][_0xd2eb('0x31')]);_0x4108a2[_0xd2eb('0x30')]=qs['offset'](_0xd93e33[_0xd2eb('0x3f')][_0xd2eb('0x30')]);}return _0x3cb8d2[_0xd2eb('0x67')](_0x4108a2);}})[_0xd2eb('0x20')](function(_0x4204f3){if(_0x4204f3){return _0x4204f3?{'count':_0xb1e3e0,'rows':_0x4204f3}:null;}})[_0xd2eb('0x20')](respondWithResult(_0x118c29,null))[_0xd2eb('0x2a')](handleError(_0x118c29,null));}; \ No newline at end of file +var _0xf29d=['jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','jayson/promise','http','request','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','end','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','offset','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','params','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','ids','omit','getMembers','findOne','User','pick','hasOwnProperty','nolimit','addMessage','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','squel','crypto'];(function(_0x385eb1,_0x497a94){var _0x5d40eb=function(_0x159029){while(--_0x159029){_0x385eb1['push'](_0x385eb1['shift']());}};_0x5d40eb(++_0x497a94);}(_0xf29d,0xc4));var _0xdf29=function(_0x3f06e8,_0x36e163){_0x3f06e8=_0x3f06e8-0x0;var _0xd2505d=_0xf29d[_0x3f06e8];return _0xd2505d;};'use strict';var pdf=require(_0xdf29('0x0'));var emlformat=require(_0xdf29('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xdf29('0x2'));var jsonpatch=require(_0xdf29('0x3'));var rp=require(_0xdf29('0x4'));var moment=require(_0xdf29('0x5'));var BPromise=require(_0xdf29('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xdf29('0x7'));var csv=require(_0xdf29('0x8'));var ejs=require(_0xdf29('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdf29('0xa'));var crypto=require(_0xdf29('0xb'));var jsforce=require(_0xdf29('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdf29('0x8'));var querystring=require(_0xdf29('0xd'));var Papa=require(_0xdf29('0xe'));var Redis=require(_0xdf29('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdf29('0x10'));var hardwareService=require(_0xdf29('0x11'));var logger=require('../../config/logger')(_0xdf29('0x12'));var utils=require(_0xdf29('0x13'));var config=require(_0xdf29('0x14'));var licenseUtil=require(_0xdf29('0x15'));var db=require(_0xdf29('0x16'))['db'];config['redis']=_[_0xdf29('0x17')](config['redis'],{'host':_0xdf29('0x18'),'port':0x18eb});var socket=require(_0xdf29('0x19'))(new Redis(config[_0xdf29('0x1a')]));require('./chatGroup.socket')[_0xdf29('0x1b')](socket);var jayson=require(_0xdf29('0x1c'));var client=jayson['client'][_0xdf29('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x950f44,_0x14ddaa,_0x598f2a,_0x45ea43){return new BPromise(function(_0x57df07,_0x4ef166){var _0x1c993b=_0x45ea43||client;return _0x1c993b[_0xdf29('0x1e')](_0x950f44,_0x598f2a)['then'](function(_0x5ecbf4){logger[_0xdf29('0x1f')](_0xdf29('0x20'),_0x14ddaa,'request\x20sent');logger[_0xdf29('0x21')](_0xdf29('0x22'),_0x14ddaa,_0xdf29('0x23'),JSON[_0xdf29('0x24')](_0x5ecbf4));if(_0x5ecbf4[_0xdf29('0x25')]){if(_0x5ecbf4[_0xdf29('0x25')][_0xdf29('0x26')]===0x1f4){logger[_0xdf29('0x25')](_0xdf29('0x20'),_0x14ddaa,_0x5ecbf4[_0xdf29('0x25')][_0xdf29('0x27')]);return _0x4ef166(_0x5ecbf4[_0xdf29('0x25')][_0xdf29('0x27')]);}logger[_0xdf29('0x25')](_0xdf29('0x20'),_0x14ddaa,_0x5ecbf4[_0xdf29('0x25')]['message']);return _0x57df07(_0x5ecbf4['error'][_0xdf29('0x27')]);}else{logger[_0xdf29('0x1f')](_0xdf29('0x20'),_0x14ddaa,_0xdf29('0x23'));_0x57df07(_0x5ecbf4[_0xdf29('0x28')]['message']);}})[_0xdf29('0x29')](function(_0x20907f){logger[_0xdf29('0x25')](_0xdf29('0x20'),_0x14ddaa,_0x20907f);_0x4ef166(_0x20907f);});});}function respondWithStatusCode(_0x4b2931,_0x29d3a1){_0x29d3a1=_0x29d3a1||0xcc;return function(_0x503cd4){if(_0x503cd4){return _0x4b2931['sendStatus'](_0x29d3a1);}return _0x4b2931['status'](_0x29d3a1)['end']();};}function respondWithResult(_0x4f70e8,_0x3ba001){_0x3ba001=_0x3ba001||0xc8;return function(_0x5ae2de){if(_0x5ae2de){return _0x4f70e8[_0xdf29('0x2a')](_0x3ba001)['json'](_0x5ae2de);}};}function respondWithFilteredResult(_0x50c533,_0x54d96d){return function(_0x3f5a96){if(_0x3f5a96){var _0x3cdca4=_0x3f5a96[_0xdf29('0x2b')],_0x4fd7c9=_0x54d96d['offset'],_0x333965=_0x54d96d['offset']+_0x54d96d[_0xdf29('0x2c')],_0x37ca23;if(_0x333965>=_0x3cdca4){_0x333965=_0x3cdca4;_0x37ca23=0xc8;}else{_0x37ca23=0xce;}_0x50c533[_0xdf29('0x2a')](_0x37ca23);return _0x50c533[_0xdf29('0x2d')](_0xdf29('0x2e'),_0x4fd7c9+'-'+_0x333965+'/'+_0x3cdca4)[_0xdf29('0x2f')](_0x3f5a96);}return null;};}function patchUpdates(_0x304b61){return function(_0x3157b6){try{jsonpatch[_0xdf29('0x30')](_0x3157b6,_0x304b61,!![]);}catch(_0x3780d2){return BPromise[_0xdf29('0x31')](_0x3780d2);}return _0x3157b6[_0xdf29('0x32')]();};}function saveUpdates(_0x38ad0d,_0x15141e){return function(_0x1a4c24){if(_0x1a4c24){return _0x1a4c24[_0xdf29('0x33')](_0x38ad0d)['then'](function(_0x2d65f9){return _0x2d65f9;});}return null;};}function removeEntity(_0x29151b,_0x581527){return function(_0xbd89a6){if(_0xbd89a6){return _0xbd89a6[_0xdf29('0x34')]()[_0xdf29('0x35')](function(){_0x29151b['status'](0xcc)[_0xdf29('0x36')]();});}};}function handleEntityNotFound(_0x31a0b3,_0x10d72f){return function(_0x27f330){if(!_0x27f330){_0x31a0b3['sendStatus'](0x194);}return _0x27f330;};}function handleError(_0x3b73c4,_0x29eb8b){_0x29eb8b=_0x29eb8b||0x1f4;return function(_0x5f183a){logger[_0xdf29('0x25')](_0x5f183a['stack']);if(_0x5f183a[_0xdf29('0x37')]){delete _0x5f183a[_0xdf29('0x37')];}_0x3b73c4[_0xdf29('0x2a')](_0x29eb8b)[_0xdf29('0x38')](_0x5f183a);};}exports[_0xdf29('0x39')]=function(_0x44419a,_0x47126b){var _0x331d66={},_0x2cb012={},_0x54b71c={'count':0x0,'rows':[]};var _0x1868ef=_[_0xdf29('0x3a')](db[_0xdf29('0x3b')][_0xdf29('0x3c')],function(_0x1bab4f){return{'name':_0x1bab4f[_0xdf29('0x3d')],'type':_0x1bab4f[_0xdf29('0x3e')][_0xdf29('0x3f')]};});_0x2cb012['model']=_['map'](_0x1868ef,_0xdf29('0x37'));_0x2cb012['query']=_[_0xdf29('0x40')](_0x44419a[_0xdf29('0x41')]);_0x2cb012[_0xdf29('0x42')]=_[_0xdf29('0x43')](_0x2cb012[_0xdf29('0x44')],_0x2cb012['query']);_0x331d66[_0xdf29('0x45')]=_[_0xdf29('0x43')](_0x2cb012['model'],qs[_0xdf29('0x46')](_0x44419a[_0xdf29('0x41')][_0xdf29('0x46')]));_0x331d66['attributes']=_0x331d66[_0xdf29('0x45')][_0xdf29('0x47')]?_0x331d66[_0xdf29('0x45')]:_0x2cb012['model'];if(!_0x44419a[_0xdf29('0x41')]['hasOwnProperty']('nolimit')){_0x331d66[_0xdf29('0x2c')]=qs[_0xdf29('0x2c')](_0x44419a[_0xdf29('0x41')][_0xdf29('0x2c')]);_0x331d66['offset']=qs[_0xdf29('0x48')](_0x44419a[_0xdf29('0x41')][_0xdf29('0x48')]);}_0x331d66[_0xdf29('0x49')]=qs[_0xdf29('0x4a')](_0x44419a['query'][_0xdf29('0x4a')]);_0x331d66[_0xdf29('0x4b')]=qs[_0xdf29('0x42')](_['pick'](_0x44419a[_0xdf29('0x41')],_0x2cb012[_0xdf29('0x42')]),_0x1868ef);if(_0x44419a['query'][_0xdf29('0x4c')]){_0x331d66[_0xdf29('0x4b')]=_[_0xdf29('0x4d')](_0x331d66[_0xdf29('0x4b')],{'$or':_['map'](_0x1868ef,function(_0x26f857){if(_0x26f857['type']!==_0xdf29('0x4e')){var _0xf81aa7={};_0xf81aa7[_0x26f857[_0xdf29('0x37')]]={'$like':'%'+_0x44419a[_0xdf29('0x41')][_0xdf29('0x4c')]+'%'};return _0xf81aa7;}})});}_0x331d66=_[_0xdf29('0x4d')]({},_0x331d66,_0x44419a[_0xdf29('0x4f')]);var _0x2475a1={'where':_0x331d66[_0xdf29('0x4b')]};return db[_0xdf29('0x3b')][_0xdf29('0x2b')](_0x2475a1)[_0xdf29('0x35')](function(_0x30c4b4){_0x54b71c['count']=_0x30c4b4;if(_0x44419a['query'][_0xdf29('0x50')]){_0x331d66[_0xdf29('0x51')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x331d66);})[_0xdf29('0x35')](function(_0x491ea4){_0x54b71c[_0xdf29('0x52')]=_0x491ea4;return _0x54b71c;})[_0xdf29('0x35')](respondWithFilteredResult(_0x47126b,_0x331d66))[_0xdf29('0x29')](handleError(_0x47126b,null));};exports['show']=function(_0xc9f50,_0x3db80f){var _0x330295={'raw':!![],'where':{'id':_0xc9f50[_0xdf29('0x53')]['id']}},_0x156c22={};_0x156c22[_0xdf29('0x44')]=_['keys'](db[_0xdf29('0x3b')][_0xdf29('0x3c')]);_0x156c22[_0xdf29('0x41')]=_[_0xdf29('0x40')](_0xc9f50[_0xdf29('0x41')]);_0x156c22['filters']=_[_0xdf29('0x43')](_0x156c22[_0xdf29('0x44')],_0x156c22['query']);_0x330295[_0xdf29('0x45')]=_[_0xdf29('0x43')](_0x156c22['model'],qs['fields'](_0xc9f50['query'][_0xdf29('0x46')]));_0x330295[_0xdf29('0x45')]=_0x330295['attributes'][_0xdf29('0x47')]?_0x330295['attributes']:_0x156c22['model'];if(_0xc9f50['query'][_0xdf29('0x50')]){_0x330295['include']=[{'all':!![]}];}_0x330295=_['merge']({},_0x330295,_0xc9f50[_0xdf29('0x4f')]);return db[_0xdf29('0x3b')][_0xdf29('0x54')](_0x330295)[_0xdf29('0x35')](handleEntityNotFound(_0x3db80f,null))[_0xdf29('0x35')](respondWithResult(_0x3db80f,null))[_0xdf29('0x29')](handleError(_0x3db80f,null));};exports[_0xdf29('0x55')]=function(_0x3fade5,_0x19ec82){return db['ChatGroup']['create'](_0x3fade5[_0xdf29('0x56')],{})[_0xdf29('0x35')](respondWithResult(_0x19ec82,0xc9))[_0xdf29('0x29')](handleError(_0x19ec82,null));};exports[_0xdf29('0x33')]=function(_0x362200,_0x3be3e2){if(_0x362200['body']['id']){delete _0x362200[_0xdf29('0x56')]['id'];}return db[_0xdf29('0x3b')][_0xdf29('0x54')]({'where':{'id':_0x362200[_0xdf29('0x53')]['id']}})[_0xdf29('0x35')](handleEntityNotFound(_0x3be3e2,null))[_0xdf29('0x35')](saveUpdates(_0x362200[_0xdf29('0x56')],null))[_0xdf29('0x35')](respondWithResult(_0x3be3e2,null))[_0xdf29('0x29')](handleError(_0x3be3e2,null));};exports[_0xdf29('0x34')]=function(_0x30b57f,_0x1d58da){return db[_0xdf29('0x3b')][_0xdf29('0x54')]({'where':{'id':_0x30b57f[_0xdf29('0x53')]['id']}})[_0xdf29('0x35')](handleEntityNotFound(_0x1d58da,null))[_0xdf29('0x35')](removeEntity(_0x1d58da,null))[_0xdf29('0x29')](handleError(_0x1d58da,null));};exports[_0xdf29('0x57')]=function(_0x5c799a,_0x5f3fda){return db['ChatGroup'][_0xdf29('0x57')]()[_0xdf29('0x35')](respondWithResult(_0x5f3fda,null))[_0xdf29('0x29')](handleError(_0x5f3fda,null));};exports[_0xdf29('0x58')]=function(_0x548677,_0x31fba0,_0x234cb8){return db[_0xdf29('0x59')][_0xdf29('0x2b')]({'where':{'ChatGroupId':_0x548677[_0xdf29('0x53')]['id'],'ToId':_0x548677[_0xdf29('0x5a')]['id'],'read':![]}})[_0xdf29('0x35')](function(_0x3c758b){return{'id':_[_0xdf29('0x5b')](_0x548677[_0xdf29('0x53')]['id']),'count':_0x3c758b};})[_0xdf29('0x35')](respondWithResult(_0x31fba0,null))['catch'](handleError(_0x31fba0,null));};exports['addMembers']=function(_0x57ded3,_0xc89856,_0x960979){return db[_0xdf29('0x3b')][_0xdf29('0x54')]({'where':{'id':_0x57ded3['params']['id']}})[_0xdf29('0x35')](handleEntityNotFound(_0xc89856,null))['then'](function(_0x563ecb){if(_0x563ecb){return _0x563ecb['addMembers'](_0x57ded3['body'][_0xdf29('0x5c')],_[_0xdf29('0x5d')](_0x57ded3[_0xdf29('0x56')],[_0xdf29('0x5c'),'id'])||{});}})[_0xdf29('0x35')](respondWithResult(_0xc89856,null))[_0xdf29('0x29')](handleError(_0xc89856,null));};exports[_0xdf29('0x5e')]=function(_0x24a24f,_0x16a0f1,_0x125ad0){var _0x49a783={};var _0x3d6f48={};var _0x401181;var _0x1b10d9;return db[_0xdf29('0x3b')][_0xdf29('0x5f')]({'where':{'id':_0x24a24f[_0xdf29('0x53')]['id']}})[_0xdf29('0x35')](handleEntityNotFound(_0x16a0f1,null))[_0xdf29('0x35')](function(_0x3d90e6){if(_0x3d90e6){_0x401181=_0x3d90e6;_0x3d6f48['model']=_['keys'](db[_0xdf29('0x60')][_0xdf29('0x3c')]);_0x3d6f48[_0xdf29('0x41')]=_['keys'](_0x24a24f['query']);_0x3d6f48[_0xdf29('0x42')]=_['intersection'](_0x3d6f48['model'],_0x3d6f48[_0xdf29('0x41')]);_0x49a783['attributes']=_['intersection'](_0x3d6f48[_0xdf29('0x44')],qs[_0xdf29('0x46')](_0x24a24f[_0xdf29('0x41')][_0xdf29('0x46')]));_0x49a783[_0xdf29('0x45')]=_0x49a783[_0xdf29('0x45')][_0xdf29('0x47')]?_0x49a783[_0xdf29('0x45')]:_0x3d6f48['model'];_0x49a783[_0xdf29('0x49')]=qs[_0xdf29('0x4a')](_0x24a24f[_0xdf29('0x41')][_0xdf29('0x4a')]);_0x49a783[_0xdf29('0x4b')]=qs[_0xdf29('0x42')](_[_0xdf29('0x61')](_0x24a24f[_0xdf29('0x41')],_0x3d6f48[_0xdf29('0x42')]));if(_0x24a24f['query']['filter']){_0x49a783[_0xdf29('0x4b')]=_[_0xdf29('0x4d')](_0x49a783[_0xdf29('0x4b')],{'$or':_[_0xdf29('0x3a')](_0x49a783[_0xdf29('0x45')],function(_0x55461e){var _0x422e9d={};_0x422e9d[_0x55461e]={'$like':'%'+_0x24a24f[_0xdf29('0x41')]['filter']+'%'};return _0x422e9d;})});}_0x49a783=_[_0xdf29('0x4d')]({},_0x49a783,_0x24a24f[_0xdf29('0x4f')]);return _0x401181[_0xdf29('0x5e')](_0x49a783);}})['then'](function(_0x292710){if(_0x292710){_0x1b10d9=_0x292710[_0xdf29('0x47')];if(!_0x24a24f[_0xdf29('0x41')][_0xdf29('0x62')](_0xdf29('0x63'))){_0x49a783[_0xdf29('0x2c')]=qs['limit'](_0x24a24f['query'][_0xdf29('0x2c')]);_0x49a783['offset']=qs[_0xdf29('0x48')](_0x24a24f[_0xdf29('0x41')][_0xdf29('0x48')]);}return _0x401181['getMembers'](_0x49a783);}})[_0xdf29('0x35')](function(_0x351d52){if(_0x351d52){return _0x351d52?{'count':_0x1b10d9,'rows':_0x351d52}:null;}})['then'](respondWithResult(_0x16a0f1,null))[_0xdf29('0x29')](handleError(_0x16a0f1,null));};exports['removeMembers']=function(_0x21f568,_0x485de5,_0x352b44){return db['ChatGroup'][_0xdf29('0x54')]({'where':{'id':_0x21f568[_0xdf29('0x53')]['id']}})[_0xdf29('0x35')](handleEntityNotFound(_0x485de5,null))[_0xdf29('0x35')](function(_0x570a34){if(_0x570a34){return _0x570a34['removeMembers'](_0x21f568[_0xdf29('0x41')][_0xdf29('0x5c')]);}})['then'](respondWithStatusCode(_0x485de5,null))[_0xdf29('0x29')](handleError(_0x485de5,null));};exports[_0xdf29('0x64')]=function(_0x33c274,_0x3a5ea9,_0x50b181){if(_0x33c274[_0xdf29('0x56')]['id']){delete _0x33c274[_0xdf29('0x56')]['id'];}return db[_0xdf29('0x3b')]['find']({'where':{'id':_0x33c274[_0xdf29('0x53')]['id']}})[_0xdf29('0x35')](handleEntityNotFound(_0x3a5ea9,null))[_0xdf29('0x35')](function(_0x4e0b66){if(_0x4e0b66){_0x33c274[_0xdf29('0x56')]['ChatGroupId']=_0x4e0b66['id'];return db[_0xdf29('0x59')][_0xdf29('0x55')](_0x33c274[_0xdf29('0x56')]);}})['then'](respondWithResult(_0x3a5ea9,null))['catch'](handleError(_0x3a5ea9,null));};exports[_0xdf29('0x65')]=function(_0x2dc429,_0x4a75c9,_0x47a133){var _0x150c1d={};var _0x535308={};var _0x592a60;var _0xc806f0;return db[_0xdf29('0x3b')]['findOne']({'where':{'id':_0x2dc429[_0xdf29('0x53')]['id']}})['then'](handleEntityNotFound(_0x4a75c9,null))[_0xdf29('0x35')](function(_0x1d5905){if(_0x1d5905){_0x592a60=_0x1d5905;_0x535308[_0xdf29('0x44')]=_[_0xdf29('0x40')](db[_0xdf29('0x59')][_0xdf29('0x3c')]);_0x535308['query']=_['keys'](_0x2dc429[_0xdf29('0x41')]);_0x535308[_0xdf29('0x42')]=_[_0xdf29('0x43')](_0x535308['model'],_0x535308['query']);_0x150c1d[_0xdf29('0x45')]=_[_0xdf29('0x43')](_0x535308[_0xdf29('0x44')],qs[_0xdf29('0x46')](_0x2dc429[_0xdf29('0x41')][_0xdf29('0x46')]));_0x150c1d[_0xdf29('0x45')]=_0x150c1d['attributes']['length']?_0x150c1d['attributes']:_0x535308[_0xdf29('0x44')];_0x150c1d[_0xdf29('0x49')]=qs[_0xdf29('0x4a')](_0x2dc429['query'][_0xdf29('0x4a')]);_0x150c1d['where']=qs[_0xdf29('0x42')](_[_0xdf29('0x61')](_0x2dc429[_0xdf29('0x41')],_0x535308[_0xdf29('0x42')]));if(_0x2dc429[_0xdf29('0x41')][_0xdf29('0x4c')]){_0x150c1d[_0xdf29('0x4b')]=_[_0xdf29('0x4d')](_0x150c1d[_0xdf29('0x4b')],{'$or':_[_0xdf29('0x3a')](_0x150c1d['attributes'],function(_0x36e454){var _0x11d651={};_0x11d651[_0x36e454]={'$like':'%'+_0x2dc429[_0xdf29('0x41')][_0xdf29('0x4c')]+'%'};return _0x11d651;})});}if(_0x2dc429[_0xdf29('0x41')][_0xdf29('0x66')]){var _0x1a1b82=_0x2dc429[_0xdf29('0x41')][_0xdf29('0x66')]['split'](',');var _0x3487ae={};_0x3487ae[_0x1a1b82[0x0]]={'$gte':moment(_0x1a1b82[0x1])['format'](_0xdf29('0x67'))};_0x150c1d['where']=_[_0xdf29('0x4d')](_0x150c1d[_0xdf29('0x4b')],_0x3487ae);}_0x150c1d=_[_0xdf29('0x4d')]({},_0x150c1d,_0x2dc429[_0xdf29('0x4f')]);return _0x592a60['getMessages'](_0x150c1d);}})[_0xdf29('0x35')](function(_0x45fbbf){if(_0x45fbbf){_0xc806f0=_0x45fbbf[_0xdf29('0x47')];if(!_0x2dc429['query'][_0xdf29('0x62')]('nolimit')){_0x150c1d[_0xdf29('0x2c')]=qs[_0xdf29('0x2c')](_0x2dc429[_0xdf29('0x41')]['limit']);_0x150c1d[_0xdf29('0x48')]=qs[_0xdf29('0x48')](_0x2dc429[_0xdf29('0x41')][_0xdf29('0x48')]);}return _0x592a60[_0xdf29('0x65')](_0x150c1d);}})[_0xdf29('0x35')](function(_0x15eec7){if(_0x15eec7){return _0x15eec7?{'count':_0xc806f0,'rows':_0x15eec7}:null;}})[_0xdf29('0x35')](respondWithResult(_0x4a75c9,null))[_0xdf29('0x29')](handleError(_0x4a75c9,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 3f37a4e..ece5df8 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 _0xb10b=['hasOwnProperty','hook','events','ChatGroup','setMaxListeners','save','remove','emit'];(function(_0xbc83d,_0x1cb8a3){var _0x591299=function(_0x33cd8c){while(--_0x33cd8c){_0xbc83d['push'](_0xbc83d['shift']());}};_0x591299(++_0x1cb8a3);}(_0xb10b,0x12a));var _0xbb10=function(_0x50e0c5,_0x49351f){_0x50e0c5=_0x50e0c5-0x0;var _0x11d623=_0xb10b[_0x50e0c5];return _0x11d623;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatGroupEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatGroupEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatGroup[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0xdb28=['ChatGroup','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x101a61,_0x43011c){var _0x51d456=function(_0x2be688){while(--_0x2be688){_0x101a61['push'](_0x101a61['shift']());}};_0x51d456(++_0x43011c);}(_0xdb28,0x106));var _0x8db2=function(_0x51b99d,_0xc1777b){_0x51b99d=_0x51b99d-0x0;var _0x2adbd5=_0xdb28[_0x51b99d];return _0x2adbd5;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var ChatGroup=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8db2('0x4'),'afterDestroy':_0x8db2('0x5')};function emitEvent(_0xfcf49f){return function(_0x4426fe,_0x11109e,_0x52bf99){ChatGroupEvents[_0x8db2('0x6')](_0xfcf49f+':'+_0x4426fe['id'],_0x4426fe);ChatGroupEvents[_0x8db2('0x6')](_0xfcf49f,_0x4426fe);_0x52bf99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x8db2('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index af665b8..26539de 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 _0x4a80=['api','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','chat_groups','lodash','../../config/logger'];(function(_0x40ec05,_0x39ff94){var _0x34dd43=function(_0x29a6de){while(--_0x29a6de){_0x40ec05['push'](_0x40ec05['shift']());}};_0x34dd43(++_0x39ff94);}(_0x4a80,0xbe));var _0x04a8=function(_0x154ecd,_0x152847){_0x154ecd=_0x154ecd-0x0;var _0x3b2edf=_0x4a80[_0x154ecd];return _0x3b2edf;};'use strict';var _=require(_0x04a8('0x0'));var util=require('util');var logger=require(_0x04a8('0x1'))(_0x04a8('0x2'));var moment=require('moment');var BPromise=require(_0x04a8('0x3'));var rp=require(_0x04a8('0x4'));var fs=require('fs');var path=require(_0x04a8('0x5'));var rimraf=require(_0x04a8('0x6'));var config=require(_0x04a8('0x7'));var attributes=require(_0x04a8('0x8'));module[_0x04a8('0x9')]=function(_0x353b43,_0x709eea){return _0x353b43[_0x04a8('0xa')]('ChatGroup',attributes,{'tableName':_0x04a8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16d8=['path','rimraf','../../config/environment','exports','define','ChatGroup','chat_groups','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x28e385,_0x3e2479){var _0x2e2a7b=function(_0x4afe1f){while(--_0x4afe1f){_0x28e385['push'](_0x28e385['shift']());}};_0x2e2a7b(++_0x3e2479);}(_0x16d8,0xa3));var _0x816d=function(_0x1fcfb9,_0x4e863c){_0x1fcfb9=_0x1fcfb9-0x0;var _0x2599b0=_0x16d8[_0x1fcfb9];return _0x2599b0;};'use strict';var _=require('lodash');var util=require(_0x816d('0x0'));var logger=require(_0x816d('0x1'))(_0x816d('0x2'));var moment=require(_0x816d('0x3'));var BPromise=require(_0x816d('0x4'));var rp=require(_0x816d('0x5'));var fs=require('fs');var path=require(_0x816d('0x6'));var rimraf=require(_0x816d('0x7'));var config=require(_0x816d('0x8'));var attributes=require('./chatGroup.attributes');module[_0x816d('0x9')]=function(_0x58d744,_0x39c8dc){return _0x58d744[_0x816d('0xa')](_0x816d('0xb'),attributes,{'tableName':_0x816d('0xc'),'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 6ecd490..ff4e264 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 _0xd509=['debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','ChatGroup,\x20%s,\x20%s'];(function(_0x2962d5,_0x38deda){var _0x273406=function(_0x3e0775){while(--_0x3e0775){_0x2962d5['push'](_0x2962d5['shift']());}};_0x273406(++_0x38deda);}(_0xd509,0xf9));var _0x9d50=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd509[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x9d50('0x0'));var moment=require(_0x9d50('0x1'));var BPromise=require(_0x9d50('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d50('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9d50('0x4'))(_0x9d50('0x5'));var config=require(_0x9d50('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9d50('0x7')]['http']({'port':0x232a});config[_0x9d50('0x8')]=_[_0x9d50('0x9')](config['redis'],{'host':_0x9d50('0xa'),'port':0x18eb});var socket=require(_0x9d50('0xb'))(new Redis(config['redis']));require(_0x9d50('0xc'))[_0x9d50('0xd')](socket);function respondWithRpcPromise(_0x1e3527,_0x1279e4,_0x1cf263){return new BPromise(function(_0x550cee,_0x9f47d2){return client['request'](_0x1e3527,_0x1cf263)['then'](function(_0x65256){logger['info'](_0x9d50('0xe'),_0x1279e4,'request\x20sent');logger[_0x9d50('0xf')](_0x9d50('0x10'),_0x1279e4,_0x9d50('0x11'),JSON['stringify'](_0x65256));if(_0x65256[_0x9d50('0x12')]){if(_0x65256[_0x9d50('0x12')][_0x9d50('0x13')]===0x1f4){logger[_0x9d50('0x12')]('ChatGroup,\x20%s,\x20%s',_0x1279e4,_0x65256[_0x9d50('0x12')]['message']);return _0x9f47d2(_0x65256[_0x9d50('0x12')][_0x9d50('0x14')]);}logger[_0x9d50('0x12')](_0x9d50('0xe'),_0x1279e4,_0x65256[_0x9d50('0x12')][_0x9d50('0x14')]);return _0x550cee(_0x65256[_0x9d50('0x12')][_0x9d50('0x14')]);}else{logger[_0x9d50('0x15')](_0x9d50('0xe'),_0x1279e4,_0x9d50('0x11'));_0x550cee(_0x65256[_0x9d50('0x16')][_0x9d50('0x14')]);}})[_0x9d50('0x17')](function(_0x3ce756){logger['error'](_0x9d50('0xe'),_0x1279e4,_0x3ce756);_0x9f47d2(_0x3ce756);});});} \ No newline at end of file +var _0x05a7=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x284506,_0x191316){var _0x1e9ee5=function(_0xe7eaa){while(--_0xe7eaa){_0x284506['push'](_0x284506['shift']());}};_0x1e9ee5(++_0x191316);}(_0x05a7,0x1e8));var _0x705a=function(_0x151dee,_0x3f620f){_0x151dee=_0x151dee-0x0;var _0x36879b=_0x05a7[_0x151dee];return _0x36879b;};'use strict';var _=require(_0x705a('0x0'));var util=require('util');var moment=require(_0x705a('0x1'));var BPromise=require('bluebird');var rs=require(_0x705a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x705a('0x3'))['db'];var utils=require(_0x705a('0x4'));var logger=require(_0x705a('0x5'))(_0x705a('0x6'));var config=require(_0x705a('0x7'));var jayson=require(_0x705a('0x8'));var client=jayson[_0x705a('0x9')][_0x705a('0xa')]({'port':0x232a});config[_0x705a('0xb')]=_[_0x705a('0xc')](config[_0x705a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x705a('0xd'))(new Redis(config[_0x705a('0xb')]));require('./chatGroup.socket')[_0x705a('0xe')](socket);function respondWithRpcPromise(_0x4c2f6f,_0x3b0d7f,_0xc48e20){return new BPromise(function(_0x4f452f,_0x5c547b){return client[_0x705a('0xf')](_0x4c2f6f,_0xc48e20)['then'](function(_0x21894e){logger['info'](_0x705a('0x10'),_0x3b0d7f,_0x705a('0x11'));logger[_0x705a('0x12')](_0x705a('0x13'),_0x3b0d7f,_0x705a('0x11'),JSON[_0x705a('0x14')](_0x21894e));if(_0x21894e[_0x705a('0x15')]){if(_0x21894e[_0x705a('0x15')][_0x705a('0x16')]===0x1f4){logger[_0x705a('0x15')](_0x705a('0x10'),_0x3b0d7f,_0x21894e[_0x705a('0x15')][_0x705a('0x17')]);return _0x5c547b(_0x21894e[_0x705a('0x15')]['message']);}logger[_0x705a('0x15')](_0x705a('0x10'),_0x3b0d7f,_0x21894e['error'][_0x705a('0x17')]);return _0x4f452f(_0x21894e[_0x705a('0x15')][_0x705a('0x17')]);}else{logger[_0x705a('0x18')](_0x705a('0x10'),_0x3b0d7f,'request\x20sent');_0x4f452f(_0x21894e['result'][_0x705a('0x17')]);}})[_0x705a('0x19')](function(_0x15599f){logger[_0x705a('0x15')](_0x705a('0x10'),_0x3b0d7f,_0x15599f);_0x5c547b(_0x15599f);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 601a8f8..984073f 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 _0xf45c=['remove','update','emit','register','chatGroup:','./chatGroup.events','save'];(function(_0x3fec04,_0x3bc634){var _0x48abe4=function(_0x46ca05){while(--_0x46ca05){_0x3fec04['push'](_0x3fec04['shift']());}};_0x48abe4(++_0x3bc634);}(_0xf45c,0x1e1));var _0xcf45=function(_0xa673ff,_0x4fc5f2){_0xa673ff=_0xa673ff-0x0;var _0x4271f9=_0xf45c[_0xa673ff];return _0x4271f9;};'use strict';var ChatGroupEvents=require(_0xcf45('0x0'));var events=[_0xcf45('0x1'),_0xcf45('0x2'),_0xcf45('0x3')];function createListener(_0x5764f1,_0x5b1a60){return function(_0x5efb21){_0x5b1a60[_0xcf45('0x4')](_0x5764f1,_0x5efb21);};}function removeListener(_0x28b52b,_0x57e4e6){return function(){ChatGroupEvents['removeListener'](_0x28b52b,_0x57e4e6);};}exports[_0xcf45('0x5')]=function(_0x16b014){for(var _0x347667=0x0,_0x6f3ff=events['length'];_0x347667<_0x6f3ff;_0x347667++){var _0x5abac2=events[_0x347667];var _0xe8682c=createListener(_0xcf45('0x6')+_0x5abac2,_0x16b014);ChatGroupEvents['on'](_0x5abac2,_0xe8682c);}}; \ No newline at end of file +var _0x926e=['remove','removeListener','chatGroup:','./chatGroup.events'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x926e,0x18f));var _0xe926=function(_0x46b542,_0x5db2fb){_0x46b542=_0x46b542-0x0;var _0x326b07=_0x926e[_0x46b542];return _0x326b07;};'use strict';var ChatGroupEvents=require(_0xe926('0x0'));var events=['save',_0xe926('0x1'),'update'];function createListener(_0x337b41,_0x12b6d5){return function(_0x24fc7b){_0x12b6d5['emit'](_0x337b41,_0x24fc7b);};}function removeListener(_0x3353ce,_0x49d934){return function(){ChatGroupEvents[_0xe926('0x2')](_0x3353ce,_0x49d934);};}exports['register']=function(_0x3bc61a){for(var _0x440a78=0x0,_0x5da5f6=events['length'];_0x440a78<_0x5da5f6;_0x440a78++){var _0x41ef05=events[_0x440a78];var _0x23e4c2=createListener(_0xe926('0x3')+_0x41ef05,_0x3bc61a);ChatGroupEvents['on'](_0x41ef05,_0x23e4c2);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 8f8d765..72dac69 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 _0x19c1=['isAuthenticated','describe','get','/:id','show','/:id/unread','/:id/members','getMembers','/:id/messages','post','create','addMembers','put','update','delete','removeMembers','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','index','/describe'];(function(_0x22608c,_0x5575da){var _0x50bfa2=function(_0x514222){while(--_0x514222){_0x22608c['push'](_0x22608c['shift']());}};_0x50bfa2(++_0x5575da);}(_0x19c1,0x7d));var _0x119c=function(_0x1183ae,_0x2e9e0f){_0x1183ae=_0x1183ae-0x0;var _0x45ac44=_0x19c1[_0x1183ae];return _0x45ac44;};'use strict';var multer=require(_0x119c('0x0'));var util=require('util');var path=require(_0x119c('0x1'));var timeout=require(_0x119c('0x2'));var express=require(_0x119c('0x3'));var router=express[_0x119c('0x4')]();var auth=require(_0x119c('0x5'));var interaction=require(_0x119c('0x6'));var config=require('../../config/environment');var controller=require(_0x119c('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x119c('0x8')]);router['get'](_0x119c('0x9'),auth[_0x119c('0xa')](),controller[_0x119c('0xb')]);router[_0x119c('0xc')](_0x119c('0xd'),auth['isAuthenticated'](),controller[_0x119c('0xe')]);router[_0x119c('0xc')](_0x119c('0xf'),auth['isAuthenticated'](),controller['getUnread']);router[_0x119c('0xc')](_0x119c('0x10'),auth['isAuthenticated'](),controller[_0x119c('0x11')]);router[_0x119c('0xc')](_0x119c('0x12'),auth[_0x119c('0xa')](),controller['getMessages']);router[_0x119c('0x13')]('/',auth['isAuthenticated'](),controller[_0x119c('0x14')]);router['post']('/:id/members',auth[_0x119c('0xa')](),controller[_0x119c('0x15')]);router['post'](_0x119c('0x12'),auth[_0x119c('0xa')](),controller['addMessage']);router[_0x119c('0x16')](_0x119c('0xd'),auth[_0x119c('0xa')](),controller[_0x119c('0x17')]);router[_0x119c('0x18')](_0x119c('0xd'),auth[_0x119c('0xa')](),controller['destroy']);router[_0x119c('0x18')](_0x119c('0x10'),auth[_0x119c('0xa')](),controller[_0x119c('0x19')]);module[_0x119c('0x1a')]=router; \ No newline at end of file +var _0x5b30=['getUnread','getMembers','/:id/messages','post','create','/:id/members','addMessage','put','update','delete','destroy','removeMembers','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/unread'];(function(_0x4084eb,_0x30c6ad){var _0x4c1f1c=function(_0x1ca12e){while(--_0x1ca12e){_0x4084eb['push'](_0x4084eb['shift']());}};_0x4c1f1c(++_0x30c6ad);}(_0x5b30,0x1cf));var _0x05b3=function(_0x143759,_0x249c49){_0x143759=_0x143759-0x0;var _0x4582be=_0x5b30[_0x143759];return _0x4582be;};'use strict';var multer=require('multer');var util=require(_0x05b3('0x0'));var path=require(_0x05b3('0x1'));var timeout=require(_0x05b3('0x2'));var express=require(_0x05b3('0x3'));var router=express[_0x05b3('0x4')]();var auth=require(_0x05b3('0x5'));var interaction=require(_0x05b3('0x6'));var config=require(_0x05b3('0x7'));var controller=require(_0x05b3('0x8'));router['get']('/',auth[_0x05b3('0x9')](),controller[_0x05b3('0xa')]);router[_0x05b3('0xb')](_0x05b3('0xc'),auth[_0x05b3('0x9')](),controller[_0x05b3('0xd')]);router[_0x05b3('0xb')](_0x05b3('0xe'),auth['isAuthenticated'](),controller[_0x05b3('0xf')]);router[_0x05b3('0xb')](_0x05b3('0x10'),auth[_0x05b3('0x9')](),controller[_0x05b3('0x11')]);router['get']('/:id/members',auth[_0x05b3('0x9')](),controller[_0x05b3('0x12')]);router['get'](_0x05b3('0x13'),auth[_0x05b3('0x9')](),controller['getMessages']);router[_0x05b3('0x14')]('/',auth['isAuthenticated'](),controller[_0x05b3('0x15')]);router[_0x05b3('0x14')](_0x05b3('0x16'),auth[_0x05b3('0x9')](),controller['addMembers']);router[_0x05b3('0x14')](_0x05b3('0x13'),auth[_0x05b3('0x9')](),controller[_0x05b3('0x17')]);router[_0x05b3('0x18')](_0x05b3('0xe'),auth[_0x05b3('0x9')](),controller[_0x05b3('0x19')]);router[_0x05b3('0x1a')](_0x05b3('0xe'),auth['isAuthenticated'](),controller[_0x05b3('0x1b')]);router[_0x05b3('0x1a')](_0x05b3('0x16'),auth[_0x05b3('0x9')](),controller[_0x05b3('0x1c')]);module[_0x05b3('0x1d')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 16e3fff..6d95563 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 _0x0691=['DATE','sequelize','exports','INTEGER','ENUM','star','thumb','TEXT','STRING','long'];(function(_0x2d092c,_0x1cac44){var _0x4c4061=function(_0x177eb5){while(--_0x177eb5){_0x2d092c['push'](_0x2d092c['shift']());}};_0x4c4061(++_0x1cac44);}(_0x0691,0x97));var _0x1069=function(_0x55c48b,_0x13a9c1){_0x55c48b=_0x55c48b-0x0;var _0x5d36a8=_0x0691[_0x55c48b];return _0x5d36a8;};'use strict';var Sequelize=require(_0x1069('0x0'));module[_0x1069('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x1069('0x2')]},'ratingType':{'type':Sequelize[_0x1069('0x3')](_0x1069('0x4'),_0x1069('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x1069('0x6')]},'mailTranscript':{'type':Sequelize[_0x1069('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x1069('0x7')]},'secondDisposition':{'type':Sequelize[_0x1069('0x7')]},'thirdDisposition':{'type':Sequelize[_0x1069('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x1069('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x1069('0x7')]},'osVersion':{'type':Sequelize[_0x1069('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x1069('0x7')]},'deviceType':{'type':Sequelize[_0x1069('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x1069('0x7')]},'formData':{'type':Sequelize[_0x1069('0x6')](_0x1069('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x1069('0x9')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x1069('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x1069('0x6')]}}; \ No newline at end of file +var _0x2767=['ENUM','star','thumb','TEXT','DATE','STRING','out','sequelize','exports','BOOLEAN','INTEGER'];(function(_0x3a7833,_0x465b76){var _0x17a395=function(_0x2a7b29){while(--_0x2a7b29){_0x3a7833['push'](_0x3a7833['shift']());}};_0x17a395(++_0x465b76);}(_0x2767,0xee));var _0x7276=function(_0x216b0b,_0x13a9e9){_0x216b0b=_0x216b0b-0x0;var _0x1aa1ce=_0x2767[_0x216b0b];return _0x1aa1ce;};'use strict';var Sequelize=require(_0x7276('0x0'));module[_0x7276('0x1')]={'closed':{'type':Sequelize[_0x7276('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x7276('0x3')]},'ratingType':{'type':Sequelize[_0x7276('0x4')](_0x7276('0x5'),_0x7276('0x6')),'defaultValue':_0x7276('0x5')},'ratingMessage':{'type':Sequelize[_0x7276('0x7')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x7276('0x8')]},'disposition':{'type':Sequelize[_0x7276('0x9')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x7276('0x9')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x7276('0x9')]},'browserVersion':{'type':Sequelize[_0x7276('0x9')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x7276('0x9')]},'deviceVendor':{'type':Sequelize[_0x7276('0x9')]},'deviceType':{'type':Sequelize[_0x7276('0x9')]},'referer':{'type':Sequelize[_0x7276('0x7')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x7276('0x7')]('long')},'read1stAt':{'type':Sequelize[_0x7276('0x8')]},'lastMsgAt':{'type':Sequelize[_0x7276('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x7276('0x4')]('in',_0x7276('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x7276('0x9')]},'customerPort':{'type':Sequelize[_0x7276('0x9')]},'vidaooSessionId':{'type':Sequelize[_0x7276('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 20dcfa7..d2a229b 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 _0x7b23=['error','message','result','catch','sendStatus','status','count','offset','limit','Content-Range','apply','reject','save','update','end','stack','name','send','Tags','TagIds','split','push','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','select','field','from','u.id','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','tools_tags','expr','parseSearch','search','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','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','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','isEmpty','forEach','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.id','Sequelize','SELECT','clone','contactName','DESC','t.id\x20IN\x20?','resolve','role','agent','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','ChatInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','groupBy','ChatInteractionId','all','show','params','options','create','destroy','describe','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','MotionCWB:','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','filename','mimetype','Attachment','attachmentDownload','json','Unauthorized','attachId','server/files/attachments/','basename','close','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ChatMessage','User','CmContact','Messages','%s%d','customer','agentIdentifier','website_alias','System','agent_alias','fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','Smtp','service','host','port','secure','auth','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ids','omit','getMessages','pick','YYYY-MM-DD\x20HH:mm:ss','include','findAll','getMyMessages','secret','includeAgent','alias','includeAll','rows','addTags','setTags','spread','color','chatInteractionTags:save','removeTags','join','server','files','tmp','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','Account','Owner','mkdirSync','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','N.A.','closedAt','browserName','osName','customerIp','customerPort','tail','existsSync','renderFile','toFile','transcript-','.pdf','download','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./chatInteraction.socket','register','jayson/promise','client','http','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2d73ea,_0x3bdef6){var _0x11310a=function(_0xe7648a){while(--_0xe7648a){_0x2d73ea['push'](_0x2d73ea['shift']());}};_0x11310a(++_0x3bdef6);}(_0x7b23,0x10b));var _0x37b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7b23[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x37b2('0x0'));var emlformat=require(_0x37b2('0x1'));var rimraf=require(_0x37b2('0x2'));var zipdir=require(_0x37b2('0x3'));var jsonpatch=require(_0x37b2('0x4'));var rp=require(_0x37b2('0x5'));var moment=require(_0x37b2('0x6'));var BPromise=require(_0x37b2('0x7'));var Mustache=require(_0x37b2('0x8'));var util=require(_0x37b2('0x9'));var path=require(_0x37b2('0xa'));var sox=require(_0x37b2('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x37b2('0xc'));var squel=require(_0x37b2('0xd'));var crypto=require('crypto');var jsforce=require(_0x37b2('0xe'));var deskjs=require(_0x37b2('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x37b2('0x10'));var qs=require(_0x37b2('0x11'));var as=require(_0x37b2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x37b2('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x37b2('0x14'));var db=require(_0x37b2('0x15'))['db'];config[_0x37b2('0x16')]=_[_0x37b2('0x17')](config[_0x37b2('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x37b2('0x16')]));require(_0x37b2('0x18'))[_0x37b2('0x19')](socket);var jayson=require(_0x37b2('0x1a'));var client=jayson[_0x37b2('0x1b')]['http']({'port':0x232b});var client9004=jayson[_0x37b2('0x1b')][_0x37b2('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x5e91a3,_0x37db1a,_0xacc349,_0x18fd5a){return new BPromise(function(_0x174d25,_0x2df145){var _0x56f604=_0x18fd5a||client;return _0x56f604['request'](_0x5e91a3,_0xacc349)[_0x37b2('0x1d')](function(_0x380c25){logger[_0x37b2('0x1e')](_0x37b2('0x1f'),_0x37db1a,_0x37b2('0x20'));logger[_0x37b2('0x21')](_0x37b2('0x22'),_0x37db1a,_0x37b2('0x20'),JSON[_0x37b2('0x23')](_0x380c25));if(_0x380c25['error']){if(_0x380c25[_0x37b2('0x24')]['code']===0x1f4){logger['error'](_0x37b2('0x1f'),_0x37db1a,_0x380c25[_0x37b2('0x24')][_0x37b2('0x25')]);return _0x2df145(_0x380c25['error'][_0x37b2('0x25')]);}logger['error'](_0x37b2('0x1f'),_0x37db1a,_0x380c25[_0x37b2('0x24')][_0x37b2('0x25')]);return _0x174d25(_0x380c25['error'][_0x37b2('0x25')]);}else{logger[_0x37b2('0x1e')](_0x37b2('0x1f'),_0x37db1a,_0x37b2('0x20'));_0x174d25(_0x380c25[_0x37b2('0x26')][_0x37b2('0x25')]);}})[_0x37b2('0x27')](function(_0x27ec21){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x37db1a,_0x27ec21);_0x2df145(_0x27ec21);});});}function respondWithStatusCode(_0x3783c9,_0x585fba){_0x585fba=_0x585fba||0xcc;return function(_0x425b46){if(_0x425b46){return _0x3783c9[_0x37b2('0x28')](_0x585fba);}return _0x3783c9[_0x37b2('0x29')](_0x585fba)['end']();};}function respondWithResult(_0x492c9e,_0x13765b){_0x13765b=_0x13765b||0xc8;return function(_0x5cd463){if(_0x5cd463){return _0x492c9e[_0x37b2('0x29')](_0x13765b)['json'](_0x5cd463);}};}function respondWithFilteredResult(_0xb5800b,_0x4e3f97){return function(_0x471216){if(_0x471216){var _0x336fec=_0x471216[_0x37b2('0x2a')],_0x15dc37=_0x4e3f97[_0x37b2('0x2b')],_0x53b8c4=_0x4e3f97[_0x37b2('0x2b')]+_0x4e3f97[_0x37b2('0x2c')],_0x3296e2;if(_0x53b8c4>=_0x336fec){_0x53b8c4=_0x336fec;_0x3296e2=0xc8;}else{_0x3296e2=0xce;}_0xb5800b[_0x37b2('0x29')](_0x3296e2);return _0xb5800b['set'](_0x37b2('0x2d'),_0x15dc37+'-'+_0x53b8c4+'/'+_0x336fec)['json'](_0x471216);}return null;};}function patchUpdates(_0x2497bb){return function(_0x28877e){try{jsonpatch[_0x37b2('0x2e')](_0x28877e,_0x2497bb,!![]);}catch(_0x5b0082){return BPromise[_0x37b2('0x2f')](_0x5b0082);}return _0x28877e[_0x37b2('0x30')]();};}function saveUpdates(_0x5b8107,_0x4b7b3d){return function(_0x3c3d2e){if(_0x3c3d2e){return _0x3c3d2e[_0x37b2('0x31')](_0x5b8107)[_0x37b2('0x1d')](function(_0x2916a4){return _0x2916a4;});}return null;};}function removeEntity(_0x5563fd,_0x368fe8){return function(_0x52785d){if(_0x52785d){return _0x52785d['destroy']()[_0x37b2('0x1d')](function(){_0x5563fd[_0x37b2('0x29')](0xcc)[_0x37b2('0x32')]();});}};}function handleEntityNotFound(_0x25c16a,_0x4c33c1){return function(_0x15bd03){if(!_0x15bd03){_0x25c16a[_0x37b2('0x28')](0x194);}return _0x15bd03;};}function handleError(_0x2cfb97,_0x1f3d9a){_0x1f3d9a=_0x1f3d9a||0x1f4;return function(_0x128bbf){logger[_0x37b2('0x24')](_0x128bbf[_0x37b2('0x33')]);if(_0x128bbf[_0x37b2('0x34')]){delete _0x128bbf[_0x37b2('0x34')];}_0x2cfb97[_0x37b2('0x29')](_0x1f3d9a)[_0x37b2('0x35')](_0x128bbf);};}function getInteractionUsers(_0x142612,_0x5dc5d6){return new BPromise(function(_0x3e0259,_0x10cd13){try{if(_0x5dc5d6[_0x142612['id']]){_0x142612['Users']=_['map'](_0x5dc5d6[_0x142612['id']],function(_0x2ad476){return{'id':_0x2ad476['id'],'fullname':_0x2ad476['fullname']};});}}catch(_0x190959){_0x10cd13(_0x190959);}_0x3e0259(_0x142612);});}function getInteractionTags(_0x28eb23,_0x3280a6){return new BPromise(function(_0x585251,_0x361f2b){try{if(_0x28eb23['TagIds']){_0x28eb23[_0x37b2('0x36')]=[];_0x28eb23[_0x37b2('0x37')][_0x37b2('0x38')](',')['forEach'](function(_0x3fbc91){_0x28eb23['Tags'][_0x37b2('0x39')](_0x3280a6[_0x3fbc91]);});}delete _0x28eb23['TagIds'];}catch(_0x7187f3){_0x361f2b(_0x7187f3);}_0x585251(_0x28eb23);});}function updateChatInteraction(_0x5d19f6,_0x9ee973,_0x472004){return new BPromise(function(_0xf0f814,_0x22b16e){return getInteractionUsers(_0x5d19f6,_0x472004)[_0x37b2('0x1d')](function(_0x28f9d7){return getInteractionTags(_0x28f9d7,_0x9ee973);})['then'](function(_0x38bd90){_0xf0f814(_0x38bd90);})[_0x37b2('0x27')](function(_0x5ab6fd){_0x22b16e(_0x5ab6fd);});});}exports[_0x37b2('0x3a')]=function(_0x498d89,_0x35333){var _0xcb08d8={},_0x985929={},_0x56b0a0={'count':0x0,'rows':[]};var _0x419930=_[_0x37b2('0x3b')](db['ChatInteraction'][_0x37b2('0x3c')],function(_0x5bea0c){return{'name':_0x5bea0c[_0x37b2('0x3d')],'type':_0x5bea0c[_0x37b2('0x3e')]['key']};});_0x985929[_0x37b2('0x3f')]=_[_0x37b2('0x3b')](_0x419930,_0x37b2('0x34'));_0x985929[_0x37b2('0x40')]=_['keys'](_0x498d89[_0x37b2('0x40')]);_0x985929[_0x37b2('0x41')]=_[_0x37b2('0x42')](_0x985929['model'],_0x985929[_0x37b2('0x40')]);_0xcb08d8['attributes']=_[_0x37b2('0x42')](_0x985929[_0x37b2('0x3f')],qs[_0x37b2('0x43')](_0x498d89['query']['fields']));_0xcb08d8[_0x37b2('0x44')]=_0xcb08d8[_0x37b2('0x44')][_0x37b2('0x45')]?_0xcb08d8[_0x37b2('0x44')]:_0x985929[_0x37b2('0x3f')];if(!_0x498d89['query'][_0x37b2('0x46')](_0x37b2('0x47'))){_0xcb08d8[_0x37b2('0x2c')]=qs[_0x37b2('0x2c')](_0x498d89[_0x37b2('0x40')][_0x37b2('0x2c')]);_0xcb08d8[_0x37b2('0x2b')]=qs[_0x37b2('0x2b')](_0x498d89[_0x37b2('0x40')][_0x37b2('0x2b')]);}_0xcb08d8[_0x37b2('0x48')]=qs['sort'](_0x498d89['query'][_0x37b2('0x49')]);_0xcb08d8[_0x37b2('0x4a')]=qs[_0x37b2('0x41')](_['pick'](_0x498d89[_0x37b2('0x40')],_0x985929[_0x37b2('0x41')]),_0x419930);var _0x12f9c8=[];var _0xa230d3=squel[_0x37b2('0x4b')]()[_0x37b2('0x4c')]('id')[_0x37b2('0x4c')](_0x37b2('0x34'))[_0x37b2('0x4c')]('color')[_0x37b2('0x4d')]('tools_tags');var _0x5d3cbc=squel['select']()[_0x37b2('0x4c')](_0x37b2('0x4e'))[_0x37b2('0x4c')]('u.fullname')[_0x37b2('0x4c')](_0x37b2('0x4f'))[_0x37b2('0x4d')](_0x37b2('0x50'),'ui')[_0x37b2('0x51')](_0x37b2('0x52'),'u',_0x37b2('0x53'));var _0x5ef49f=squel[_0x37b2('0x4b')]()['from'](_0x37b2('0x54'),'i')['left_join'](_0x37b2('0x55'),'c',_0x37b2('0x56'))[_0x37b2('0x51')](_0x37b2('0x52'),'o',_0x37b2('0x57'))[_0x37b2('0x51')](_0x37b2('0x58'),'a',_0x37b2('0x59'))[_0x37b2('0x51')](_0x37b2('0x5a'),'me',_0x37b2('0x5b'))['left_join']('chat_interaction_has_tags','it',_0x37b2('0x5c'))[_0x37b2('0x51')](_0x37b2('0x5d'),'t','t.id\x20=\x20it.TagId');var _0x2cef7b=squel[_0x37b2('0x5e')]();var _0xe215d6=[];var _0x5cd785=squel[_0x37b2('0x5e')]();var _0x45dccb;if(_0x498d89[_0x37b2('0x40')]['search']){_0x45dccb=as[_0x37b2('0x5f')](_0x498d89[_0x37b2('0x40')][_0x37b2('0x60')]);var _0x5a5386=_0x45dccb[_0x37b2('0x61')];for(var _0x52098b=0x0;_0x52098b<_0x45dccb[_0x37b2('0x62')][_0x37b2('0x45')];_0x52098b++){var _0x1ff746=_0x45dccb[_0x37b2('0x62')][_0x52098b];var _0x3b2deb='i';var _0x4e91ed=_['find'](_0x419930,['name',_0x1ff746[_0x37b2('0x4c')]]);if(!_0x4e91ed){switch(_0x1ff746['field']){case _0x37b2('0x63'):if(_0x1ff746[_0x37b2('0x64')]==0x1){_0x5ef49f[_0x37b2('0x65')]('`'+_0x1ff746['field']+'`\x20=\x200');}else{_0x5ef49f[_0x37b2('0x65')]('`'+_0x1ff746[_0x37b2('0x4c')]+_0x37b2('0x66'));}break;case'Contact':if(_0x1ff746[_0x37b2('0x67')]===_0x37b2('0x68')){if(_0x1ff746['value'][_0x37b2('0x38')]('\x20')[_0x37b2('0x45')]>0x1){_0x2cef7b[_0x5a5386](_0x37b2('0x69'),qs['getFullTextValue'](_0x1ff746[_0x37b2('0x64')]),null);}else{var _0x5c95ea='%'+_0x1ff746[_0x37b2('0x64')]+'%';_0x2cef7b[_0x5a5386](_0x37b2('0x6a'),_0x5c95ea,_0x5c95ea,_0x5c95ea);}}else{_0x4e91ed=_[_0x37b2('0x6b')](_0x419930,[_0x37b2('0x34'),_0x37b2('0x6c')]);_0x1ff746[_0x37b2('0x4c')]='ContactId';_0x2aabf7=as[_0x37b2('0x6d')](_0x3b2deb,_0x4e91ed['type'],_0x1ff746);_0x2cef7b[_0x5a5386](_0x2aabf7[_0x37b2('0x6e')],_0x2aabf7['value'][_0x37b2('0x6f')],_0x2aabf7[_0x37b2('0x64')][_0x37b2('0x32')]);}break;case _0x37b2('0x70'):var _0x42c6f1=_0x1ff746[_0x37b2('0x64')][_0x37b2('0x38')](',')[_0x37b2('0x3b')](function(_0x47c5a7){return Number(_0x47c5a7);});_0x42c6f1['forEach'](function(_0xdd032c){_0x5cd785['or'](_0x37b2('0x71'),'%,'+_0xdd032c+',%');});_0xe215d6=_[_0x37b2('0x72')](_0xe215d6,_0x42c6f1);break;case'User':if(_0x1ff746[_0x37b2('0x67')]===_0x37b2('0x68')){_0x2cef7b[_0x5a5386](_0x37b2('0x73'),'%'+_0x1ff746[_0x37b2('0x64')]+'%',null);}else{_0x4e91ed=_['find'](_0x419930,[_0x37b2('0x34'),'UserId']);_0x1ff746[_0x37b2('0x4c')]=_0x37b2('0x74');_0x2aabf7=as[_0x37b2('0x6d')](_0x3b2deb,_0x4e91ed['type'],_0x1ff746);_0x2cef7b[_0x5a5386](_0x2aabf7[_0x37b2('0x6e')],_0x2aabf7[_0x37b2('0x64')][_0x37b2('0x6f')],_0x2aabf7[_0x37b2('0x64')][_0x37b2('0x32')]);}break;case _0x37b2('0x75'):_0x2aabf7=as[_0x37b2('0x6d')]('me',null,_0x1ff746);_0x2cef7b[_0x5a5386](_0x2aabf7['text'],_0x2aabf7[_0x37b2('0x64')][_0x37b2('0x6f')],_0x2aabf7[_0x37b2('0x64')]['end']);break;}}else{var _0x2aabf7=as[_0x37b2('0x6d')](_0x3b2deb,_0x4e91ed['type'],_0x1ff746);_0x2cef7b[_0x5a5386](_0x2aabf7[_0x37b2('0x6e')],_0x2aabf7[_0x37b2('0x64')][_0x37b2('0x6f')],_0x2aabf7[_0x37b2('0x64')][_0x37b2('0x32')]);}}}else{var _0x232c63=_(_0x498d89[_0x37b2('0x40')])[_0x37b2('0x76')]()[_0x37b2('0x3b')](function(_0x2fd8ab){return _[_0x37b2('0x77')](_0x419930,[_0x37b2('0x34'),_0x2fd8ab])?_0x2fd8ab:undefined;})['compact']()[_0x37b2('0x64')]();if(!_[_0x37b2('0x78')](_0x232c63)){_0x232c63[_0x37b2('0x79')](function(_0x15ab03){if(_0x15ab03===_0x37b2('0x7a')){_0x5ef49f[_0x37b2('0x4a')](_0x37b2('0x7b'),[][_0x37b2('0x7c')](_0x498d89[_0x37b2('0x40')][_0x15ab03]));}else if(_0x15ab03===_0x37b2('0x7d')){var _0x416c87=JSON['parse'](_0x498d89[_0x37b2('0x40')][_0x15ab03])[_0x37b2('0x7e')];var _0x3fbf47=JSON[_0x37b2('0x7f')](_0x498d89['query'][_0x15ab03])[_0x37b2('0x80')];_0x5ef49f[_0x37b2('0x4a')](_0x37b2('0x81'),_0x416c87,_0x3fbf47);}else{if(_0x498d89[_0x37b2('0x40')][_0x15ab03]===_0x37b2('0x82')){_0x5ef49f[_0x37b2('0x4a')]('i.'+_0x15ab03+_0x37b2('0x83'));}else{_0x5ef49f['where']('i.'+_0x15ab03+'\x20=\x20?',_0x498d89[_0x37b2('0x40')][_0x15ab03]);}}});}if(_0x498d89[_0x37b2('0x40')][_0x37b2('0x84')]){if(_0x498d89[_0x37b2('0x40')][_0x37b2('0x84')]==0x1){_0x5ef49f['having'](_0x37b2('0x85'));}else{_0x5ef49f[_0x37b2('0x65')](_0x37b2('0x86'));}}if(_0x498d89[_0x37b2('0x40')][_0x37b2('0x87')]){_0xe215d6=_['isArray'](_0x498d89[_0x37b2('0x40')][_0x37b2('0x87')])?_0x498d89[_0x37b2('0x40')][_0x37b2('0x87')]:new Array(_0x498d89[_0x37b2('0x40')][_0x37b2('0x87')]);_0xe215d6[_0x37b2('0x79')](function(_0x1e3262){_0x5cd785['or'](_0x37b2('0x71'),'%,'+_0x1e3262+',%');});}if(_0x498d89[_0x37b2('0x40')][_0x37b2('0x88')]){var _0x3be479=_0x498d89['query'][_0x37b2('0x88')][_0x37b2('0x89')]('\x5c','\x5c\x5c')[_0x37b2('0x89')](/'/g,'\x27\x27');if(qs[_0x37b2('0x8a')](_0x3be479)){_0x2cef7b['or']('i.id\x20LIKE\x20?',_0x3be479+'%');}else{_0x2cef7b['or'](_0x37b2('0x8b'),qs[_0x37b2('0x8c')](_0x3be479))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3be479+'%');}}}_0x5ef49f[_0x37b2('0x4a')](_0x2cef7b);_0x5ef49f['group'](_0x37b2('0x8d'));var _0x4c8a68={'type':db[_0x37b2('0x8e')]['QueryTypes'][_0x37b2('0x8f')],'raw':!![]};var _0x30dcb0=_0x5ef49f[_0x37b2('0x90')]();_0x30dcb0[_0x37b2('0x4c')](_0x37b2('0x8d'));_0x30dcb0[_0x37b2('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x37b2('0x63'));if(_0xcb08d8[_0x37b2('0x48')]){_0xcb08d8[_0x37b2('0x48')][_0x37b2('0x79')](function(_0x372e60){var _0x5bb600=_0x372e60[0x0]===_0x37b2('0x91')?_0x372e60[0x0]:'i.'+_0x372e60[0x0];_0x5ef49f[_0x37b2('0x48')](_0x5bb600,_0x372e60[0x1]===_0x37b2('0x92')?![]:!![]);});}if(!_[_0x37b2('0x78')](_0xe215d6)){_0x5ef49f[_0x37b2('0x65')](_0x5cd785);_0x30dcb0['where'](_0x37b2('0x93'),_0xe215d6);}BPromise[_0x37b2('0x94')]()[_0x37b2('0x1d')](function(){if(!_0x45dccb){if(_0x498d89[_0x37b2('0x40')][_0x37b2('0x7a')])return;_0x30dcb0[_0x37b2('0x4a')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x5ef49f[_0x37b2('0x4a')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x498d89['user'][_0x37b2('0x95')]!==_0x37b2('0x96'))return;return _0x498d89[_0x37b2('0x97')][_0x37b2('0x98')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1dfc1){if(_[_0x37b2('0x78')](_0x1dfc1)){_0x30dcb0[_0x37b2('0x4a')]('i.ChatWebsiteId\x20IS\x20NULL');_0x5ef49f[_0x37b2('0x4a')](_0x37b2('0x99'));}else{_0x30dcb0['where'](_0x37b2('0x7b'),_[_0x37b2('0x3b')](_0x1dfc1,'id'));_0x5ef49f[_0x37b2('0x4a')](_0x37b2('0x7b'),_[_0x37b2('0x3b')](_0x1dfc1,'id'));}});})['then'](function(){if(_0x498d89['user'][_0x37b2('0x95')]===_0x37b2('0x96')&&!_0x45dccb&&!_0x498d89[_0x37b2('0x40')][_0x37b2('0x7a')])return[];return db[_0x37b2('0x9a')][_0x37b2('0x40')](_0x30dcb0['toString'](),_0x4c8a68);})[_0x37b2('0x1d')](function(_0x20d2bf){_0x56b0a0['count']=_0x20d2bf[_0x37b2('0x45')];if(_0x56b0a0[_0x37b2('0x2a')]===0x0)return[];return db[_0x37b2('0x9a')]['query'](_0xa230d3[_0x37b2('0x9b')](),_0x4c8a68)[_0x37b2('0x1d')](function(_0x267b9c){_0x12f9c8=_[_0x37b2('0x9c')](_0x267b9c,'id');_0x4c8a68=_[_0x37b2('0x9d')](_0x4c8a68,{'model':db[_0x37b2('0x9e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x498d89[_0x37b2('0x40')]['fields']){_0xcb08d8[_0x37b2('0x44')]['forEach'](function(_0x4abbbf){_0x5ef49f[_0x37b2('0x4c')]('i.'+_0x4abbbf);});}else{_0x5ef49f[_0x37b2('0x4c')](_0x37b2('0x9f'),_0x37b2('0x63'));_0x5ef49f[_0x37b2('0x4c')]('a.key','Account.key');_0x5ef49f[_0x37b2('0x4c')](_0x37b2('0xa0'),_0x37b2('0xa1'));_0x5ef49f[_0x37b2('0x4c')](_0x37b2('0xa2'),_0x37b2('0x91'));_0x5ef49f[_0x37b2('0x4c')]('i.*');_0x5ef49f[_0x37b2('0x4c')](_0x37b2('0xa3'),_0x37b2('0xa4'));_0x5ef49f[_0x37b2('0x4c')](_0x37b2('0xa5'),'Contact.lastName');_0x5ef49f[_0x37b2('0x4c')](_0x37b2('0xa6'),_0x37b2('0xa7'));_0x5ef49f[_0x37b2('0x4c')]('c.phone',_0x37b2('0xa8'));_0x5ef49f[_0x37b2('0x4c')](_0x37b2('0xa9'),_0x37b2('0xaa'));_0x5ef49f[_0x37b2('0x4c')](_0x37b2('0xab'),_0x37b2('0xac'));_0x5ef49f[_0x37b2('0x4c')](_0x37b2('0xad'),_0x37b2('0xae'));_0x5ef49f[_0x37b2('0x4c')](_0x37b2('0xaf'),_0x37b2('0xb0'));_0x5ef49f[_0x37b2('0x4c')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x37b2('0x37'));}if(_0xcb08d8[_0x37b2('0x2c')])_0x5ef49f[_0x37b2('0x2c')](_0xcb08d8[_0x37b2('0x2c')]);if(_0xcb08d8[_0x37b2('0x2b')])_0x5ef49f['offset'](_0xcb08d8[_0x37b2('0x2b')]);return db[_0x37b2('0x9a')]['query'](_0x5ef49f[_0x37b2('0x9b')](),_0x4c8a68);})[_0x37b2('0x1d')](function(_0x59ed4f){_0x5d3cbc[_0x37b2('0x4a')]('ui.ChatInteractionId\x20IN\x20?',_['map'](_0x59ed4f,'id'));return db[_0x37b2('0x9a')][_0x37b2('0x40')](_0x5d3cbc[_0x37b2('0x9b')](),_0x4c8a68)[_0x37b2('0x1d')](function(_0x416707){var _0x5c9da2=_[_0x37b2('0xb1')](_0x416707,_0x37b2('0xb2'));var _0x5d70f5=[];_0x59ed4f[_0x37b2('0x79')](function(_0x5666be){_0x5d70f5['push'](updateChatInteraction(_0x5666be,_0x12f9c8,_0x5c9da2));});return BPromise[_0x37b2('0xb3')](_0x5d70f5);});});})['then'](function(_0x3b7225){_0x56b0a0['rows']=_0x3b7225;return _0x56b0a0;})[_0x37b2('0x1d')](respondWithFilteredResult(_0x35333,_0xcb08d8))[_0x37b2('0x27')](handleError(_0x35333,null));};exports[_0x37b2('0xb4')]=function(_0x58799f,_0x21c145){var _0x39d4e9={'raw':![],'where':{'id':_0x58799f[_0x37b2('0xb5')]['id']}},_0x5c073a={};_0x5c073a[_0x37b2('0x3f')]=_[_0x37b2('0x76')](db[_0x37b2('0x9e')]['rawAttributes']);_0x5c073a[_0x37b2('0x40')]=_['keys'](_0x58799f[_0x37b2('0x40')]);_0x5c073a[_0x37b2('0x41')]=_[_0x37b2('0x42')](_0x5c073a[_0x37b2('0x3f')],_0x5c073a[_0x37b2('0x40')]);_0x39d4e9[_0x37b2('0x44')]=_[_0x37b2('0x42')](_0x5c073a[_0x37b2('0x3f')],qs[_0x37b2('0x43')](_0x58799f[_0x37b2('0x40')]['fields']));_0x39d4e9['attributes']=_0x39d4e9[_0x37b2('0x44')][_0x37b2('0x45')]?_0x39d4e9[_0x37b2('0x44')]:_0x5c073a[_0x37b2('0x3f')];if(_0x58799f[_0x37b2('0x40')]['includeAll']){_0x39d4e9['include']=[{'all':!![]}];}_0x39d4e9=_[_0x37b2('0x9d')]({},_0x39d4e9,_0x58799f[_0x37b2('0xb6')]);return db[_0x37b2('0x9e')]['find'](_0x39d4e9)[_0x37b2('0x1d')](handleEntityNotFound(_0x21c145,null))[_0x37b2('0x1d')](respondWithResult(_0x21c145,null))[_0x37b2('0x27')](handleError(_0x21c145,null));};exports[_0x37b2('0xb7')]=function(_0x2510fd,_0x514d89){return db[_0x37b2('0x9e')]['create'](_0x2510fd[_0x37b2('0x75')],{})[_0x37b2('0x1d')](respondWithResult(_0x514d89,0xc9))[_0x37b2('0x27')](handleError(_0x514d89,null));};exports[_0x37b2('0x31')]=function(_0x233114,_0x2c090b){if(_0x233114['body']['id']){delete _0x233114[_0x37b2('0x75')]['id'];}return db[_0x37b2('0x9e')]['find']({'where':{'id':_0x233114[_0x37b2('0xb5')]['id']}})[_0x37b2('0x1d')](handleEntityNotFound(_0x2c090b,null))[_0x37b2('0x1d')](saveUpdates(_0x233114['body'],null))[_0x37b2('0x1d')](respondWithResult(_0x2c090b,null))[_0x37b2('0x27')](handleError(_0x2c090b,null));};exports[_0x37b2('0xb8')]=function(_0x125bb8,_0x5163ee){return db[_0x37b2('0x9e')][_0x37b2('0x6b')]({'where':{'id':_0x125bb8[_0x37b2('0xb5')]['id']}})[_0x37b2('0x1d')](handleEntityNotFound(_0x5163ee,null))[_0x37b2('0x1d')](removeEntity(_0x5163ee,null))['catch'](handleError(_0x5163ee,null));};exports[_0x37b2('0xb9')]=function(_0x164f39,_0x3f1830){return db[_0x37b2('0x9e')][_0x37b2('0xb9')]()[_0x37b2('0x1d')](respondWithResult(_0x3f1830,null))[_0x37b2('0x27')](handleError(_0x3f1830,null));};exports['createVidaooSession']=function(_0x53b960,_0x59bfc3){var _0x4677f9=_0x53b960[_0x37b2('0xb5')]['id'];var _0x35f2e8;var _0x5c05f5;var _0x28cfb8;return db[_0x37b2('0x9e')][_0x37b2('0xba')]({'where':{'id':_0x4677f9}})['then'](function(_0x382474){_0x35f2e8=_0x382474;return db[_0x37b2('0xbb')][_0x37b2('0xba')]({'where':{'id':_0x382474[_0x37b2('0x7a')]},'attributes':['id',_0x37b2('0xbc'),_0x37b2('0xbd')],'raw':!![]});})['then'](function(_0x4464a1){if(_0x4464a1&&_0x4464a1[_0x37b2('0xbc')]&&_0x4464a1[_0x37b2('0xbd')]){_0x5c05f5=_0x4464a1;var _0x5893ad={'rejectUnauthorized':![],'method':_0x37b2('0xbe'),'uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x4464a1[_0x37b2('0xbc')]},'body':{'name':_0x37b2('0xbf')+_0x4677f9},'redirect':_0x37b2('0xc0'),'json':!![]};return rp(_0x5893ad);}else{throw new db[(_0x37b2('0x8e'))][(_0x37b2('0xc1'))](_0x37b2('0xc2'));}})[_0x37b2('0x1d')](function(_0x3d8908){_0x28cfb8=_0x3d8908;if(_0x28cfb8['id']){var _0x486e2a={'body':_0x28cfb8[_0x37b2('0xc3')],'ChatWebsiteId':_0x5c05f5['id'],'ChatInteractionId':_0x35f2e8['id'],'direction':_0x37b2('0xc4'),'UserId':_0x53b960[_0x37b2('0x97')]['id']};return db['ChatMessage'][_0x37b2('0xb7')](_0x486e2a,{});}else{throw new db[(_0x37b2('0x8e'))][(_0x37b2('0xc1'))](_0x37b2('0xc5'));}})[_0x37b2('0x1d')](function(){return _0x35f2e8[_0x37b2('0xc6')]({'vidaooSessionId':_0x28cfb8['id']});})['then'](respondWithResult(_0x59bfc3,null))['catch'](handleError(_0x59bfc3,null));};exports[_0x37b2('0xc7')]=function(_0x2b3094,_0x5e8ab4){if(_0x2b3094[_0x37b2('0x75')]['id']){delete _0x2b3094[_0x37b2('0x75')]['id'];}return db[_0x37b2('0x9e')][_0x37b2('0x6b')]({'where':{'id':_0x2b3094[_0x37b2('0xb5')]['id']}})[_0x37b2('0x1d')](handleEntityNotFound(_0x5e8ab4,null))[_0x37b2('0x1d')](saveUpdates(_0x2b3094[_0x37b2('0x75')],null))[_0x37b2('0x1d')](respondWithResult(_0x5e8ab4,null))[_0x37b2('0x27')](handleError(_0x5e8ab4,null));};exports[_0x37b2('0xc8')]=function(_0x384253,_0x19fc21,_0x224e6d){if(_0x384253[_0x37b2('0x75')]['id']){delete _0x384253['body']['id'];}return db['ChatInteraction'][_0x37b2('0x6b')]({'where':{'id':_0x384253[_0x37b2('0xb5')]['id']}})['then'](function(_0x1da6fe){if(!_0x1da6fe){logger[_0x37b2('0x24')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x37b2('0xc8'),0x194,'entity\x20not\x20found');_0x19fc21[_0x37b2('0x28')](0x194);}else{if(_0x1da6fe[_0x37b2('0x74')]){throw new db[(_0x37b2('0x8e'))][(_0x37b2('0xc1'))](_0x37b2('0xc9'));}}return _0x1da6fe;})['then'](function(_0x5aa720){if(_0x5aa720){return _0x5aa720['update']({'closed':_0x384253['body'][_0x37b2('0xca')],'disposition':_0x384253[_0x37b2('0x75')][_0x37b2('0xcb')]})[_0x37b2('0x1d')](function(_0x50f84a){return _0x50f84a;});}})['then'](function(_0xc2da67){return respondWithRpcPromise(_0x37b2('0xcc'),_0x37b2('0xc8'),_0x384253[_0x37b2('0x75')],client9004);})[_0x37b2('0x1d')](respondWithResult(_0x19fc21,null))[_0x37b2('0x27')](handleError(_0x19fc21,null));};exports[_0x37b2('0xcd')]=function(_0xd8d644,_0x30f780,_0x30795d){_0xd8d644[_0x37b2('0x75')][_0x37b2('0x34')]=_0xd8d644[_0x37b2('0xce')]['originalname'];_0xd8d644['body']['basename']=_0xd8d644[_0x37b2('0xce')][_0x37b2('0xcf')];_0xd8d644[_0x37b2('0x75')][_0x37b2('0x3e')]=_0xd8d644[_0x37b2('0xce')][_0x37b2('0xd0')];return db[_0x37b2('0xd1')][_0x37b2('0xb7')](_0xd8d644[_0x37b2('0x75')])[_0x37b2('0x1d')](respondWithResult(_0x30f780,0xc9))[_0x37b2('0x27')](handleError(_0x30f780,null));};exports[_0x37b2('0xd2')]=function(_0xd2ad7d,_0x2475f1,_0x2edacc){return db[_0x37b2('0x9e')]['findOne']({'where':{'id':_0xd2ad7d[_0x37b2('0xb5')]['id']},'raw':!![]})[_0x37b2('0x1d')](handleEntityNotFound(_0x2475f1,null))[_0x37b2('0x1d')](function(_0x17eb2e){if(_0x17eb2e){if(_0x17eb2e[_0x37b2('0xca')]){return _0x2475f1['status'](0x193)[_0x37b2('0xd3')]({'status':0x193,'message':_0x37b2('0xd4')});}return db[_0x37b2('0xd1')][_0x37b2('0xba')]({'where':{'id':_0xd2ad7d[_0x37b2('0x40')][_0x37b2('0xd5')]},'raw':!![]})[_0x37b2('0x1d')](handleEntityNotFound(_0x2475f1,null));}})[_0x37b2('0x1d')](function(_0x518f15){if(_0x518f15){return _0x2475f1['download'](path['join'](config['root'],_0x37b2('0xd6'),_0x518f15[_0x37b2('0xd7')]));}})['catch'](handleError(_0x2475f1,null));};exports[_0x37b2('0xd8')]=function(_0xe977bb,_0x3f2b12){var _0x46625f=null;var _0x1a9fd6=null;var _0x1adff5=null;var _0x34371b=null;if(_0xe977bb[_0x37b2('0x75')]['id']){delete _0xe977bb[_0x37b2('0x75')]['id'];}if(_0xe977bb[_0x37b2('0x75')][_0x37b2('0xd9')]){_0x34371b=path['join'](config[_0x37b2('0xda')],_0x37b2('0xdb'),util[_0x37b2('0xdc')](_0x37b2('0xdd'),Date[_0x37b2('0xde')]()));_0xe977bb[_0x37b2('0x75')][_0x37b2('0xdf')]=_0x34371b;}return db[_0x37b2('0x9e')][_0x37b2('0x6b')]({'where':{'id':_0xe977bb[_0x37b2('0xb5')]['id']},'include':[{'model':db[_0x37b2('0xe0')],'as':'Messages','include':[{'model':db['User'],'as':_0x37b2('0xe1')}]}]})[_0x37b2('0x1d')](handleEntityNotFound(_0x3f2b12,null))[_0x37b2('0x1d')](saveUpdates(_0xe977bb['body'],null))[_0x37b2('0x1d')](function(_0x1a6f19){if(_0x1a6f19){_0x46625f=_0x1a6f19;return db[_0x37b2('0xbb')][_0x37b2('0x6b')]({'where':{'id':_0x46625f[_0x37b2('0x7a')]}});}})[_0x37b2('0x1d')](function(_0x5a194d){if(_0x5a194d){_0x1adff5=_0x5a194d;return db[_0x37b2('0xe2')][_0x37b2('0x6b')]({'where':{'id':_0x46625f[_0x37b2('0x6c')]}});}})['then'](function(_0x38ef17){if(_0x38ef17){_0x1a9fd6=_0x38ef17;if(_0x34371b){var _0x44ac7a=null;for(var _0xf5dbd4=0x1;_0xf5dbd4<_0x46625f[_0x37b2('0xe3')]['length'];++_0xf5dbd4){_0x44ac7a=_0x46625f['Messages'][_0xf5dbd4];var _0x597759=_0x44ac7a['UserId']?util[_0x37b2('0xdc')](_0x37b2('0xe4'),_0x1adff5['agentAlias'],_0x44ac7a[_0x37b2('0x74')]):'System';var _0x150e68=_0xe977bb[_0x37b2('0x75')][_0x37b2('0xe5')]||util[_0x37b2('0xdc')](_0x37b2('0xe4'),'Visitor',_0x44ac7a['ContactId']);switch(_0x1adff5[_0x37b2('0xe6')]){case _0x37b2('0xe7'):_0x597759=_0x44ac7a['UserId']?util[_0x37b2('0xdc')](_0x37b2('0xe4'),_0x1adff5['agentAlias'],_0x44ac7a['UserId']):_0x37b2('0xe8');break;case _0x37b2('0xe9'):_0x597759=_0x44ac7a[_0x37b2('0x74')]?_0x44ac7a[_0x37b2('0xe1')]['alias']||_0x44ac7a[_0x37b2('0xe1')][_0x37b2('0xea')]:_0x37b2('0xe8');break;case'agent_fullname':_0x597759=_0x44ac7a['UserId']?_0x44ac7a['User']['fullname']:_0x37b2('0xe8');break;default:_0x597759=_0x44ac7a[_0x37b2('0x74')]?util[_0x37b2('0xdc')](_0x37b2('0xe4'),_0x1adff5['agentAlias'],_0x44ac7a['UserId']):'System';}var _0x31c5ec=util['format'](_0x37b2('0xeb'),moment(_0x44ac7a[_0x37b2('0x7d')])[_0x37b2('0xdc')](_0x37b2('0xec')),_0x44ac7a[_0x37b2('0xed')]==='in'?_0x150e68:_0x597759,_0x44ac7a[_0x37b2('0x75')]);if(!_0x44ac7a['secret']){fs[_0x37b2('0xee')](_0x34371b,_0x31c5ec);}}return db[_0x37b2('0xef')][_0x37b2('0xba')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}}})[_0x37b2('0x1d')](function(_0x1fae30){if(_0x1fae30&&_0x1fae30[_0x37b2('0xf0')]&&_0xe977bb[_0x37b2('0x75')]){var _0x11ea25={'tls':{'rejectUnauthorized':![]}};if(_0x1fae30[_0x37b2('0xf0')][_0x37b2('0xf1')]){_0x11ea25[_0x37b2('0xf1')]=_0x1fae30[_0x37b2('0xf0')][_0x37b2('0xf1')];}else{_0x11ea25[_0x37b2('0xf2')]=_0x1fae30['Smtp'][_0x37b2('0xf2')];_0x11ea25['port']=_0x1fae30[_0x37b2('0xf0')][_0x37b2('0xf3')];_0x11ea25[_0x37b2('0xf4')]=_0x1fae30[_0x37b2('0xf0')][_0x37b2('0xf4')];}if(_0x1fae30['Smtp']['authentication']){_0x11ea25[_0x37b2('0xf5')]={'user':_0x1fae30[_0x37b2('0xf0')][_0x37b2('0x97')],'pass':_0x1fae30[_0x37b2('0xf0')]['pass']};}return respondWithRpcPromise('SendMail',_0x37b2('0xf6'),{'account':_0x11ea25,'message':{'from':util[_0x37b2('0xdc')](_0x37b2('0xf7'),_0x1fae30[_0x37b2('0x34')],_0x1fae30[_0x37b2('0xf8')]||_0x1fae30[_0x37b2('0xf0')][_0x37b2('0x97')]),'to':_0xe977bb[_0x37b2('0x75')]['mailTranscript'],'subject':_0x37b2('0xf9'),'text':util[_0x37b2('0xdc')](_0x37b2('0xfa'),_0xe977bb['body'][_0x37b2('0xd9')]),'attachments':[{'path':_0x34371b}]}})[_0x37b2('0x1d')](function(){return _0x46625f;})[_0x37b2('0x27')](function(_0x38dbf1){console['error'](_0x38dbf1);});}else{return _0x46625f;}})[_0x37b2('0x1d')](respondWithStatusCode(_0x3f2b12,0xc8))[_0x37b2('0x27')](handleError(_0x3f2b12,null));};exports['addMessage']=function(_0x37916f,_0x179689,_0x751edd){return db['ChatMessage']['find']({'where':{'id':_0x37916f['params']['id']}})[_0x37b2('0x1d')](handleEntityNotFound(_0x179689,null))[_0x37b2('0x1d')](function(_0x1460f9){if(_0x1460f9){return _0x1460f9['addMessage'](_0x37916f['body'][_0x37b2('0xfb')],_[_0x37b2('0xfc')](_0x37916f[_0x37b2('0x75')],['ids','id'])||{});}})[_0x37b2('0x1d')](respondWithResult(_0x179689,null))[_0x37b2('0x27')](handleError(_0x179689,null));};exports[_0x37b2('0xfd')]=function(_0x39a3b2,_0x27ded4,_0x5de598){var _0x1b7484={'raw':![],'where':{}};var _0x33ae57={};var _0x244360={'count':0x0,'rows':[]};return db[_0x37b2('0x9e')][_0x37b2('0xba')]({'where':{'id':_0x39a3b2[_0x37b2('0xb5')]['id']}})[_0x37b2('0x1d')](handleEntityNotFound(_0x27ded4,null))[_0x37b2('0x1d')](function(_0x2d301d){if(_0x2d301d){_0x33ae57[_0x37b2('0x3f')]=_[_0x37b2('0x76')](db[_0x37b2('0xe0')][_0x37b2('0x3c')]);_0x33ae57[_0x37b2('0x40')]=_[_0x37b2('0x76')](_0x39a3b2[_0x37b2('0x40')]);_0x33ae57[_0x37b2('0x41')]=_[_0x37b2('0x42')](_0x33ae57[_0x37b2('0x3f')],_0x33ae57['query']);_0x1b7484['attributes']=_[_0x37b2('0x42')](_0x33ae57[_0x37b2('0x3f')],qs['fields'](_0x39a3b2[_0x37b2('0x40')][_0x37b2('0x43')]));_0x1b7484[_0x37b2('0x44')]=_0x1b7484[_0x37b2('0x44')]['length']?_0x1b7484[_0x37b2('0x44')]:_0x33ae57[_0x37b2('0x3f')];if(!_0x39a3b2['query'][_0x37b2('0x46')](_0x37b2('0x47'))){_0x1b7484[_0x37b2('0x2c')]=qs['limit'](_0x39a3b2[_0x37b2('0x40')]['limit']);_0x1b7484[_0x37b2('0x2b')]=qs[_0x37b2('0x2b')](_0x39a3b2['query'][_0x37b2('0x2b')]);}_0x1b7484[_0x37b2('0x48')]=qs[_0x37b2('0x49')](_0x39a3b2[_0x37b2('0x40')][_0x37b2('0x49')]);_0x1b7484[_0x37b2('0x4a')]=qs[_0x37b2('0x41')](_[_0x37b2('0xfe')](_0x39a3b2[_0x37b2('0x40')],_0x33ae57[_0x37b2('0x41')]));_0x1b7484[_0x37b2('0x4a')]['ChatInteractionId']=_0x2d301d['id'];if(_0x39a3b2[_0x37b2('0x40')][_0x37b2('0x88')]){_0x1b7484[_0x37b2('0x4a')]=_[_0x37b2('0x9d')](_0x1b7484[_0x37b2('0x4a')],{'$or':_[_0x37b2('0x3b')](_0x1b7484[_0x37b2('0x44')],function(_0x45a267){var _0x5629f4={};_0x5629f4[_0x45a267]={'$like':'%'+_0x39a3b2[_0x37b2('0x40')][_0x37b2('0x88')]+'%'};return _0x5629f4;})});}if(_0x39a3b2[_0x37b2('0x40')]['$gte']){var _0xc9bfd7=_0x39a3b2[_0x37b2('0x40')][_0x37b2('0x7e')][_0x37b2('0x38')](',');var _0x4a0bf8={};_0x4a0bf8[_0xc9bfd7[0x0]]={'$gte':moment(_0xc9bfd7[0x1])['format'](_0x37b2('0xff'))};_0x1b7484[_0x37b2('0x4a')]=_[_0x37b2('0x9d')](_0x1b7484[_0x37b2('0x4a')],_0x4a0bf8);}_0x1b7484=_[_0x37b2('0x9d')]({},_0x1b7484,_0x39a3b2[_0x37b2('0xb6')]);return db['ChatMessage'][_0x37b2('0x2a')]({'where':_0x1b7484[_0x37b2('0x4a')]})['then'](function(_0x48da82){_0x244360[_0x37b2('0x2a')]=_0x48da82;if(_0x39a3b2[_0x37b2('0x40')]['includeAll']){_0x1b7484[_0x37b2('0x100')]=[{'all':!![]}];}return db[_0x37b2('0xe0')][_0x37b2('0x101')](_0x1b7484);})[_0x37b2('0x1d')](function(_0x3f0fd7){_0x244360['rows']=_0x3f0fd7;return _0x244360;});}})[_0x37b2('0x1d')](respondWithFilteredResult(_0x27ded4,_0x1b7484))[_0x37b2('0x27')](handleError(_0x27ded4,null));};exports[_0x37b2('0x102')]=function(_0x36f3e,_0x496b92,_0xb1b5ba){var _0x19597b={'where':{}},_0x4f475c={},_0x23c4f1={'count':0x0,'rows':[]};return db[_0x37b2('0x9e')][_0x37b2('0xba')]({'where':{'id':_0x36f3e[_0x37b2('0xb5')]['id']}})['then'](handleEntityNotFound(_0x496b92,null))[_0x37b2('0x1d')](function(_0x113a87){if(_0x113a87){_0x4f475c['model']=_[_0x37b2('0x76')](db[_0x37b2('0xe0')][_0x37b2('0x3c')]);_0x4f475c[_0x37b2('0x40')]=_['keys'](_0x36f3e[_0x37b2('0x40')]);_0x4f475c[_0x37b2('0x41')]=_[_0x37b2('0x42')](_0x4f475c[_0x37b2('0x3f')],_0x4f475c['query']);_0x19597b['attributes']=_[_0x37b2('0x42')](_0x4f475c[_0x37b2('0x3f')],qs[_0x37b2('0x43')](_0x36f3e[_0x37b2('0x40')]['fields']));_0x19597b[_0x37b2('0x44')]=_0x19597b[_0x37b2('0x44')][_0x37b2('0x45')]?_0x19597b[_0x37b2('0x44')]:_0x4f475c[_0x37b2('0x3f')];if(!_0x36f3e['query'][_0x37b2('0x46')](_0x37b2('0x47'))){_0x19597b[_0x37b2('0x2c')]=qs['limit'](_0x36f3e[_0x37b2('0x40')][_0x37b2('0x2c')]);_0x19597b['offset']=qs[_0x37b2('0x2b')](_0x36f3e[_0x37b2('0x40')]['offset']);}_0x19597b['order']=qs['sort'](_0x36f3e[_0x37b2('0x40')][_0x37b2('0x49')]);_0x19597b[_0x37b2('0x4a')]=qs[_0x37b2('0x41')](_[_0x37b2('0xfe')](_0x36f3e[_0x37b2('0x40')],_0x4f475c['filters']));_0x19597b[_0x37b2('0x4a')][_0x37b2('0xb2')]=_0x113a87['id'];if(_0x36f3e[_0x37b2('0x40')][_0x37b2('0x88')]){_0x19597b['where']=_[_0x37b2('0x9d')](_0x19597b['where'],{'$or':_[_0x37b2('0x3b')](_0x19597b[_0x37b2('0x44')],function(_0x2280dd){var _0x466226={};_0x466226[_0x2280dd]={'$like':'%'+_0x36f3e[_0x37b2('0x40')][_0x37b2('0x88')]+'%'};return _0x466226;})});}_0x19597b[_0x37b2('0x4a')][_0x37b2('0x103')]=![];if(_0x36f3e['query']['id']){_0x19597b[_0x37b2('0x4a')]['id']={'$gt':_0x36f3e[_0x37b2('0x40')]['id']};}_0x19597b=_[_0x37b2('0x9d')]({},_0x19597b,_0x36f3e['options']);return db['ChatMessage']['count']({'where':_0x19597b['where']})['then'](function(_0x2d98e2){_0x23c4f1[_0x37b2('0x2a')]=_0x2d98e2;_0x19597b[_0x37b2('0x100')]=[];if(_0x36f3e['query'][_0x37b2('0x104')]){_0x19597b['include'][_0x37b2('0x39')]({'model':db['User'],'as':_0x37b2('0xe1'),'attributes':['id',_0x37b2('0xea'),_0x37b2('0x105')]});}if(_0x36f3e[_0x37b2('0x40')][_0x37b2('0x106')]){_0x19597b['include']=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x19597b);})[_0x37b2('0x1d')](function(_0x13a5b1){_0x23c4f1[_0x37b2('0x107')]=_0x13a5b1;return _0x23c4f1;});}})[_0x37b2('0x1d')](respondWithFilteredResult(_0x496b92,_0x19597b))[_0x37b2('0x27')](handleError(_0x496b92,null));};exports[_0x37b2('0x108')]=function(_0x104f1f,_0x2873da,_0x414401){return db['ChatInteraction'][_0x37b2('0x6b')]({'where':{'id':_0x104f1f['params']['id']}})[_0x37b2('0x1d')](handleEntityNotFound(_0x2873da,null))['then'](function(_0x4d61db){if(_0x4d61db){return _0x4d61db[_0x37b2('0x109')](_0x104f1f[_0x37b2('0x75')]['ids'],_[_0x37b2('0xfc')](_0x104f1f[_0x37b2('0x75')],[_0x37b2('0xfb'),'id'])||{})[_0x37b2('0x10a')](function(){return db[_0x37b2('0x70')][_0x37b2('0x101')]({'attributes':['id',_0x37b2('0x34'),_0x37b2('0x10b')],'where':{'id':_0x104f1f[_0x37b2('0x75')]['ids']}});})['then'](function(_0x1a1179){socket['emit'](_0x37b2('0x10c'),{'id':Number(_0x104f1f[_0x37b2('0xb5')]['id']),'tags':_0x1a1179||[]});return{'id':Number(_0x104f1f[_0x37b2('0xb5')]['id']),'tags':_0x1a1179||[]};});}})[_0x37b2('0x1d')](respondWithResult(_0x2873da,null))[_0x37b2('0x27')](handleError(_0x2873da,null));};exports[_0x37b2('0x10d')]=function(_0x235843,_0x3f0526,_0x245ef7){return db[_0x37b2('0x9e')][_0x37b2('0x6b')]({'where':{'id':_0x235843[_0x37b2('0xb5')]['id']}})[_0x37b2('0x1d')](handleEntityNotFound(_0x3f0526,null))['then'](function(_0x54897b){if(_0x54897b){return _0x54897b[_0x37b2('0x10d')](_0x235843[_0x37b2('0x40')][_0x37b2('0xfb')]);}})[_0x37b2('0x1d')](respondWithStatusCode(_0x3f0526,null))['catch'](handleError(_0x3f0526,null));};exports['download']=function(_0x44658c,_0x3b03f7){var _0x15fe21=moment()['unix']()['toString']();var _0x53c36f=path[_0x37b2('0x10e')](config[_0x37b2('0xda')],_0x37b2('0x10f'),_0x37b2('0x110'),_0x37b2('0x111'));var _0x48cc21=path[_0x37b2('0x10e')](config[_0x37b2('0xda')],_0x37b2('0x10f'),'files',_0x37b2('0x112'));var _0x1a88eb=path['join'](_0x53c36f,_0x15fe21);var _0x275920=util['format'](_0x37b2('0x113'),_0x44658c[_0x37b2('0xb5')]['id'],_0x15fe21);var _0x36dec0=path[_0x37b2('0x10e')](_0x53c36f,_0x275920);var _0x4584a9=[];_0x4584a9[_0x37b2('0x39')]({'model':db['User'],'as':_0x37b2('0xe1'),'attributes':['id',_0x37b2('0xea')],'raw':!![]});_0x4584a9['push']({'model':db['CmContact'],'as':_0x37b2('0x114'),'attributes':['id',_0x37b2('0x115'),_0x37b2('0x116')],'raw':!![]});if(_0x44658c[_0x37b2('0x40')]['attachments']){_0x4584a9[_0x37b2('0x39')]({'model':db[_0x37b2('0xd1')],'as':_0x37b2('0xd1'),'raw':!![]});}var _0x450c81=[{'model':db[_0x37b2('0xe0')],'as':_0x37b2('0xe3'),'attributes':['id','body',_0x37b2('0x7d'),_0x37b2('0xed'),_0x37b2('0x103'),'read'],'include':_0x4584a9}];_0x450c81[_0x37b2('0x39')]({'model':db[_0x37b2('0xbb')],'as':_0x37b2('0x117'),'attributes':['id',_0x37b2('0x34')]});_0x450c81['push']({'model':db['User'],'as':_0x37b2('0x118'),'attributes':['id','fullname']});return db[_0x37b2('0x9e')][_0x37b2('0x6b')]({'where':{'id':_0x44658c[_0x37b2('0xb5')]['id']},'include':_0x450c81})[_0x37b2('0x1d')](handleEntityNotFound(_0x3b03f7,null))[_0x37b2('0x1d')](function(_0x27aceb){if(_0x27aceb){var _0xc0ace3=_0x27aceb['get']({'plain':!![]});fs[_0x37b2('0x119')](_0x1a88eb);var _0x14b0e5={'format':'A4','border':_0x37b2('0x11a'),'header':{'height':_0x37b2('0x11b'),'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':_0x37b2('0x11c'),'contents':{'default':util[_0x37b2('0xdc')](_0x37b2('0x11d'),util[_0x37b2('0xdc')](_0x37b2('0x11e'),'Chat',_0xc0ace3['id']),moment()[_0x37b2('0xdc')]('YYYY-MM-DD')[_0x37b2('0x9b')]())}}};var _0x5ba727={'channel':_0x37b2('0x11f'),'account':_0xc0ace3['Account'][_0x37b2('0x34')],'agent':_0xc0ace3[_0x37b2('0x118')]?_0xc0ace3[_0x37b2('0x118')]['fullname']:_0x37b2('0x120'),'createdAt':moment(_0xc0ace3[_0x37b2('0x7d')])[_0x37b2('0xdc')](_0x37b2('0xff'))[_0x37b2('0x9b')](),'closedAt':_0xc0ace3[_0x37b2('0xca')]?moment(_0xc0ace3[_0x37b2('0x121')])[_0x37b2('0xdc')]('YYYY-MM-DD\x20HH:mm:ss')[_0x37b2('0x9b')]():'','disposition':_0xc0ace3['disposition'],'chatInfo':{'browser':_0xc0ace3[_0x37b2('0x122')],'os':_0xc0ace3[_0x37b2('0x123')],'referer':_0xc0ace3['referer'],'customerIp':_0xc0ace3[_0x37b2('0x124')],'customerPort':_0xc0ace3[_0x37b2('0x125')]?_0xc0ace3[_0x37b2('0x125')]:_0x37b2('0x120')},'messages':_(_0xc0ace3[_0x37b2('0xe3')])[_0x37b2('0x126')]()[_0x37b2('0x88')]({'secret':![]})[_0x37b2('0x3b')](function(_0xcac6f2){if(_0xcac6f2[_0x37b2('0xd1')]){var _0xb26f81=path[_0x37b2('0x10e')](_0x48cc21,_0xcac6f2['Attachment'][_0x37b2('0xd7')]);if(fs[_0x37b2('0x127')](_0xb26f81)){fs['createReadStream'](_0xb26f81)['pipe'](fs['createWriteStream'](path[_0x37b2('0x10e')](_0x1a88eb,_0xcac6f2[_0x37b2('0xd1')][_0x37b2('0xd7')])));}}return{'date':moment(_0xcac6f2['createdAt'])[_0x37b2('0xdc')](_0x37b2('0xff'))['toString'](),'sender':_0xcac6f2[_0x37b2('0xed')]===_0x37b2('0xc4')?_0xcac6f2[_0x37b2('0xe1')]?_0xcac6f2['User'][_0x37b2('0xea')]:_0x37b2('0xe8'):_0xcac6f2['Contact']['firstName']+(_0xcac6f2['Contact'][_0x37b2('0x116')]?'\x20'+_0xcac6f2[_0x37b2('0x114')]['lastName']:''),'body':_0xcac6f2[_0x37b2('0xd1')]?_0xcac6f2[_0x37b2('0xd1')]['basename']:_0xcac6f2[_0x37b2('0x75')],'direction':_0xcac6f2[_0x37b2('0xed')]===_0x37b2('0xc4')?'A':'C','secret':_0xcac6f2[_0x37b2('0x103')],'read':_0xcac6f2[_0x37b2('0x84')],'attachment':_0xcac6f2['Attachment']};})[_0x37b2('0x64')]()};return ejs[_0x37b2('0x128')](path['join'](config[_0x37b2('0xda')],'server','views','downloadInteraction.html'),{'interaction':_0x5ba727})[_0x37b2('0x1d')](function(_0x569222){return new BPromise(function(_0x9be16,_0x395823){pdf[_0x37b2('0xb7')](_0x569222,_0x14b0e5)[_0x37b2('0x129')](path[_0x37b2('0x10e')](_0x1a88eb,_0x37b2('0x12a')+_0xc0ace3['id']+'-'+_0x15fe21+_0x37b2('0x12b')),function(_0x136776,_0x392292){if(_0x136776)return _0x395823(_0x136776);_0x9be16(_0x392292);});});})[_0x37b2('0x1d')](function(){return new BPromise(function(_0x258928,_0x7f1e29){zipdir(_0x1a88eb,{'saveTo':_0x36dec0},function(_0x3c5c01,_0x17f410){if(_0x3c5c01)return _0x7f1e29(_0x3c5c01);return _0x258928(_0x17f410);});})[_0x37b2('0x1d')](function(){return new BPromise(function(_0x4212d1,_0x1afd60){rimraf(_0x1a88eb,function(_0x3eff2a){if(_0x3eff2a)_0x1afd60(_0x3eff2a);return _0x4212d1();});});})[_0x37b2('0x1d')](function(){return _0x3b03f7[_0x37b2('0x12c')](_0x36dec0,_0x275920,function(_0x36d9de){if(_0x36d9de){console['log'](_0x37b2('0x12d'),_0x36d9de);}else{fs[_0x37b2('0x12e')](_0x36dec0);}});});});}else{return _0x3b03f7['sendStatus'](0xc8);}})['catch'](handleError(_0x3b03f7,null));}; \ No newline at end of file +var _0x9064=['count','length','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','all','rows','show','params','rawAttributes','include','options','create','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','out','ChatMessage','Sequelize','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','ValidationError','closed','disposition','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','mimetype','Attachment','attachmentDownload','Unauthorized','download','join','server/files/attachments/','close','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','ChatWebsite','%s%d','System','customer','agentIdentifier','website_alias','agentAlias','agent_alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','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','nolimit','includeAll','findAll','getMyMessages','ChatInteractionId','secret','includeAgent','alias','addTags','setTags','spread','color','emit','chatInteractionTags:save','removeTags','unix','tmp','files','attachments','firstName','lastName','Account','Owner','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Chat','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','referer','customerIp','customerPort','N.A.','existsSync','pipe','createWriteStream','server','views','downloadInteraction.html','err','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','request','then','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','request\x20sent','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','push','index','ChatInteraction','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','field','from','tools_tags','u.id','ui.ChatInteractionId','left_join','users','u.id\x20=\x20ui.UserId','select','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','$substring','getFullTextValue','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','buildExpression','some','compact','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','agent','sequelize','toString'];(function(_0x962fc5,_0x58f074){var _0x43667c=function(_0x5e6ec0){while(--_0x5e6ec0){_0x962fc5['push'](_0x962fc5['shift']());}};_0x43667c(++_0x58f074);}(_0x9064,0x93));var _0x4906=function(_0x26d340,_0x19d9eb){_0x26d340=_0x26d340-0x0;var _0x355df9=_0x9064[_0x26d340];return _0x355df9;};'use strict';var pdf=require(_0x4906('0x0'));var emlformat=require(_0x4906('0x1'));var rimraf=require(_0x4906('0x2'));var zipdir=require(_0x4906('0x3'));var jsonpatch=require(_0x4906('0x4'));var rp=require('request-promise');var moment=require(_0x4906('0x5'));var BPromise=require(_0x4906('0x6'));var Mustache=require(_0x4906('0x7'));var util=require(_0x4906('0x8'));var path=require(_0x4906('0x9'));var sox=require(_0x4906('0xa'));var csv=require(_0x4906('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4906('0xc'));var squel=require(_0x4906('0xd'));var crypto=require(_0x4906('0xe'));var jsforce=require(_0x4906('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4906('0xb'));var querystring=require(_0x4906('0x10'));var Papa=require(_0x4906('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4906('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4906('0x13'));var logger=require('../../config/logger')(_0x4906('0x14'));var utils=require(_0x4906('0x15'));var config=require(_0x4906('0x16'));var licenseUtil=require(_0x4906('0x17'));var db=require(_0x4906('0x18'))['db'];config[_0x4906('0x19')]=_['defaults'](config[_0x4906('0x19')],{'host':_0x4906('0x1a'),'port':0x18eb});var socket=require(_0x4906('0x1b'))(new Redis(config[_0x4906('0x19')]));require('./chatInteraction.socket')[_0x4906('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4906('0x1d')]['http']({'port':0x232b});var client9004=jayson[_0x4906('0x1d')][_0x4906('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x3ca1cc,_0xb295f7,_0x416483,_0x1540ca){return new BPromise(function(_0x117466,_0x5c11bc){var _0x5e9984=_0x1540ca||client;return _0x5e9984[_0x4906('0x1f')](_0x3ca1cc,_0x416483)[_0x4906('0x20')](function(_0x46480e){logger['info'](_0x4906('0x21'),_0xb295f7,'request\x20sent');logger[_0x4906('0x22')](_0x4906('0x23'),_0xb295f7,'request\x20sent',JSON[_0x4906('0x24')](_0x46480e));if(_0x46480e['error']){if(_0x46480e['error'][_0x4906('0x25')]===0x1f4){logger[_0x4906('0x26')]('ChatInteraction,\x20%s,\x20%s',_0xb295f7,_0x46480e[_0x4906('0x26')][_0x4906('0x27')]);return _0x5c11bc(_0x46480e[_0x4906('0x26')][_0x4906('0x27')]);}logger[_0x4906('0x26')](_0x4906('0x21'),_0xb295f7,_0x46480e[_0x4906('0x26')]['message']);return _0x117466(_0x46480e[_0x4906('0x26')][_0x4906('0x27')]);}else{logger[_0x4906('0x28')]('ChatInteraction,\x20%s,\x20%s',_0xb295f7,_0x4906('0x29'));_0x117466(_0x46480e[_0x4906('0x2a')][_0x4906('0x27')]);}})[_0x4906('0x2b')](function(_0x46196e){logger[_0x4906('0x26')](_0x4906('0x21'),_0xb295f7,_0x46196e);_0x5c11bc(_0x46196e);});});}function respondWithStatusCode(_0x4f4ee3,_0x44dad8){_0x44dad8=_0x44dad8||0xcc;return function(_0x411f94){if(_0x411f94){return _0x4f4ee3[_0x4906('0x2c')](_0x44dad8);}return _0x4f4ee3[_0x4906('0x2d')](_0x44dad8)[_0x4906('0x2e')]();};}function respondWithResult(_0x2ee277,_0x4c7691){_0x4c7691=_0x4c7691||0xc8;return function(_0x45b1c3){if(_0x45b1c3){return _0x2ee277[_0x4906('0x2d')](_0x4c7691)[_0x4906('0x2f')](_0x45b1c3);}};}function respondWithFilteredResult(_0x5173f0,_0xaab935){return function(_0x16d16a){if(_0x16d16a){var _0x50c5fa=_0x16d16a['count'],_0x35de3e=_0xaab935[_0x4906('0x30')],_0x2668d2=_0xaab935[_0x4906('0x30')]+_0xaab935[_0x4906('0x31')],_0xa5f031;if(_0x2668d2>=_0x50c5fa){_0x2668d2=_0x50c5fa;_0xa5f031=0xc8;}else{_0xa5f031=0xce;}_0x5173f0[_0x4906('0x2d')](_0xa5f031);return _0x5173f0[_0x4906('0x32')](_0x4906('0x33'),_0x35de3e+'-'+_0x2668d2+'/'+_0x50c5fa)[_0x4906('0x2f')](_0x16d16a);}return null;};}function patchUpdates(_0x2454fd){return function(_0x1d726b){try{jsonpatch[_0x4906('0x34')](_0x1d726b,_0x2454fd,!![]);}catch(_0x50136e){return BPromise[_0x4906('0x35')](_0x50136e);}return _0x1d726b[_0x4906('0x36')]();};}function saveUpdates(_0x60eb6b,_0x2ca5f1){return function(_0x30808d){if(_0x30808d){return _0x30808d[_0x4906('0x37')](_0x60eb6b)[_0x4906('0x20')](function(_0x1315f5){return _0x1315f5;});}return null;};}function removeEntity(_0x35c1cc,_0xcb93bd){return function(_0x5ab444){if(_0x5ab444){return _0x5ab444[_0x4906('0x38')]()[_0x4906('0x20')](function(){_0x35c1cc[_0x4906('0x2d')](0xcc)[_0x4906('0x2e')]();});}};}function handleEntityNotFound(_0x1da007,_0x4f3fec){return function(_0x476fa5){if(!_0x476fa5){_0x1da007['sendStatus'](0x194);}return _0x476fa5;};}function handleError(_0x190d05,_0x2826bf){_0x2826bf=_0x2826bf||0x1f4;return function(_0x24e055){logger[_0x4906('0x26')](_0x24e055[_0x4906('0x39')]);if(_0x24e055[_0x4906('0x3a')]){delete _0x24e055['name'];}_0x190d05[_0x4906('0x2d')](_0x2826bf)['send'](_0x24e055);};}function getInteractionUsers(_0x2307a2,_0x1742a9){return new BPromise(function(_0x321742,_0x5ced11){try{if(_0x1742a9[_0x2307a2['id']]){_0x2307a2[_0x4906('0x3b')]=_[_0x4906('0x3c')](_0x1742a9[_0x2307a2['id']],function(_0x14c361){return{'id':_0x14c361['id'],'fullname':_0x14c361[_0x4906('0x3d')]};});}}catch(_0x227b47){_0x5ced11(_0x227b47);}_0x321742(_0x2307a2);});}function getInteractionTags(_0x5a143f,_0x6b8c53){return new BPromise(function(_0x1b3a95,_0x4de2b3){try{if(_0x5a143f[_0x4906('0x3e')]){_0x5a143f[_0x4906('0x3f')]=[];_0x5a143f[_0x4906('0x3e')][_0x4906('0x40')](',')[_0x4906('0x41')](function(_0x3bb296){_0x5a143f[_0x4906('0x3f')][_0x4906('0x42')](_0x6b8c53[_0x3bb296]);});}delete _0x5a143f[_0x4906('0x3e')];}catch(_0x39b2d8){_0x4de2b3(_0x39b2d8);}_0x1b3a95(_0x5a143f);});}function updateChatInteraction(_0x14862e,_0x23759e,_0x579c6c){return new BPromise(function(_0x48b4e4,_0x12f437){return getInteractionUsers(_0x14862e,_0x579c6c)[_0x4906('0x20')](function(_0x56bc9d){return getInteractionTags(_0x56bc9d,_0x23759e);})[_0x4906('0x20')](function(_0x298f8c){_0x48b4e4(_0x298f8c);})[_0x4906('0x2b')](function(_0x2e2dae){_0x12f437(_0x2e2dae);});});}exports[_0x4906('0x43')]=function(_0x49fd93,_0x5230ef){var _0x2b6106={},_0x5a70b4={},_0x49c989={'count':0x0,'rows':[]};var _0x502903=_['map'](db[_0x4906('0x44')]['rawAttributes'],function(_0xe49f5a){return{'name':_0xe49f5a[_0x4906('0x45')],'type':_0xe49f5a[_0x4906('0x46')][_0x4906('0x47')]};});_0x5a70b4[_0x4906('0x48')]=_['map'](_0x502903,_0x4906('0x3a'));_0x5a70b4[_0x4906('0x49')]=_[_0x4906('0x4a')](_0x49fd93[_0x4906('0x49')]);_0x5a70b4[_0x4906('0x4b')]=_[_0x4906('0x4c')](_0x5a70b4[_0x4906('0x48')],_0x5a70b4['query']);_0x2b6106[_0x4906('0x4d')]=_['intersection'](_0x5a70b4[_0x4906('0x48')],qs[_0x4906('0x4e')](_0x49fd93['query'][_0x4906('0x4e')]));_0x2b6106[_0x4906('0x4d')]=_0x2b6106['attributes']['length']?_0x2b6106['attributes']:_0x5a70b4['model'];if(!_0x49fd93[_0x4906('0x49')][_0x4906('0x4f')]('nolimit')){_0x2b6106[_0x4906('0x31')]=qs[_0x4906('0x31')](_0x49fd93[_0x4906('0x49')]['limit']);_0x2b6106['offset']=qs[_0x4906('0x30')](_0x49fd93[_0x4906('0x49')][_0x4906('0x30')]);}_0x2b6106['order']=qs[_0x4906('0x50')](_0x49fd93[_0x4906('0x49')][_0x4906('0x50')]);_0x2b6106[_0x4906('0x51')]=qs[_0x4906('0x4b')](_[_0x4906('0x52')](_0x49fd93['query'],_0x5a70b4[_0x4906('0x4b')]),_0x502903);var _0x1b19ae=[];var _0x384525=squel['select']()[_0x4906('0x53')]('id')[_0x4906('0x53')](_0x4906('0x3a'))[_0x4906('0x53')]('color')[_0x4906('0x54')](_0x4906('0x55'));var _0x1204d8=squel['select']()[_0x4906('0x53')](_0x4906('0x56'))[_0x4906('0x53')]('u.fullname')['field'](_0x4906('0x57'))[_0x4906('0x54')]('user_has_chat_interactions','ui')[_0x4906('0x58')](_0x4906('0x59'),'u',_0x4906('0x5a'));var _0x44c450=squel[_0x4906('0x5b')]()[_0x4906('0x54')]('chat_interactions','i')[_0x4906('0x58')](_0x4906('0x5c'),'c',_0x4906('0x5d'))[_0x4906('0x58')](_0x4906('0x59'),'o','o.id\x20=\x20i.UserId')[_0x4906('0x58')](_0x4906('0x5e'),'a',_0x4906('0x5f'))[_0x4906('0x58')](_0x4906('0x60'),'me',_0x4906('0x61'))[_0x4906('0x58')](_0x4906('0x62'),'it',_0x4906('0x63'))[_0x4906('0x58')](_0x4906('0x55'),'t',_0x4906('0x64'));var _0x4af7a8=squel[_0x4906('0x65')]();var _0x233536=[];var _0x4edc9c=squel[_0x4906('0x65')]();var _0x23f836;if(_0x49fd93['query']['search']){_0x23f836=as['parseSearch'](_0x49fd93[_0x4906('0x49')]['search']);var _0x332a5a=_0x23f836['sqlOperator'];for(var _0x14595d=0x0;_0x14595d<_0x23f836[_0x4906('0x66')]['length'];_0x14595d++){var _0x305cf5=_0x23f836[_0x4906('0x66')][_0x14595d];var _0x3bde7b='i';var _0x59ca96=_[_0x4906('0x67')](_0x502903,[_0x4906('0x3a'),_0x305cf5[_0x4906('0x53')]]);if(!_0x59ca96){switch(_0x305cf5[_0x4906('0x53')]){case _0x4906('0x68'):if(_0x305cf5[_0x4906('0x69')]==0x1){_0x44c450['having']('`'+_0x305cf5[_0x4906('0x53')]+_0x4906('0x6a'));}else{_0x44c450[_0x4906('0x6b')]('`'+_0x305cf5[_0x4906('0x53')]+_0x4906('0x6c'));}break;case _0x4906('0x6d'):if(_0x305cf5['operator']===_0x4906('0x6e')){if(_0x305cf5['value'][_0x4906('0x40')]('\x20')['length']>0x1){_0x4af7a8[_0x332a5a]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4906('0x6f')](_0x305cf5[_0x4906('0x69')]),null);}else{var _0x29f03d='%'+_0x305cf5[_0x4906('0x69')]+'%';_0x4af7a8[_0x332a5a]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x29f03d,_0x29f03d,_0x29f03d);}}else{_0x59ca96=_['find'](_0x502903,[_0x4906('0x3a'),'ContactId']);_0x305cf5['field']=_0x4906('0x70');_0x4d4075=as['buildExpression'](_0x3bde7b,_0x59ca96[_0x4906('0x46')],_0x305cf5);_0x4af7a8[_0x332a5a](_0x4d4075[_0x4906('0x71')],_0x4d4075[_0x4906('0x69')][_0x4906('0x72')],_0x4d4075[_0x4906('0x69')]['end']);}break;case _0x4906('0x73'):var _0x1544f7=_0x305cf5['value'][_0x4906('0x40')](',')[_0x4906('0x3c')](function(_0x49b83e){return Number(_0x49b83e);});_0x1544f7[_0x4906('0x41')](function(_0x601b36){_0x4edc9c['or'](_0x4906('0x74'),'%,'+_0x601b36+',%');});_0x233536=_[_0x4906('0x75')](_0x233536,_0x1544f7);break;case _0x4906('0x76'):if(_0x305cf5[_0x4906('0x77')]===_0x4906('0x6e')){_0x4af7a8[_0x332a5a](_0x4906('0x78'),'%'+_0x305cf5[_0x4906('0x69')]+'%',null);}else{_0x59ca96=_[_0x4906('0x67')](_0x502903,['name',_0x4906('0x79')]);_0x305cf5['field']='UserId';_0x4d4075=as['buildExpression'](_0x3bde7b,_0x59ca96[_0x4906('0x46')],_0x305cf5);_0x4af7a8[_0x332a5a](_0x4d4075[_0x4906('0x71')],_0x4d4075[_0x4906('0x69')][_0x4906('0x72')],_0x4d4075[_0x4906('0x69')][_0x4906('0x2e')]);}break;case _0x4906('0x7a'):_0x4d4075=as[_0x4906('0x7b')]('me',null,_0x305cf5);_0x4af7a8[_0x332a5a](_0x4d4075[_0x4906('0x71')],_0x4d4075[_0x4906('0x69')]['start'],_0x4d4075[_0x4906('0x69')]['end']);break;}}else{var _0x4d4075=as[_0x4906('0x7b')](_0x3bde7b,_0x59ca96['type'],_0x305cf5);_0x4af7a8[_0x332a5a](_0x4d4075[_0x4906('0x71')],_0x4d4075[_0x4906('0x69')][_0x4906('0x72')],_0x4d4075['value'][_0x4906('0x2e')]);}}}else{var _0x3e913a=_(_0x49fd93[_0x4906('0x49')])[_0x4906('0x4a')]()['map'](function(_0x48b0e9){return _[_0x4906('0x7c')](_0x502903,['name',_0x48b0e9])?_0x48b0e9:undefined;})[_0x4906('0x7d')]()[_0x4906('0x69')]();if(!_['isEmpty'](_0x3e913a)){_0x3e913a[_0x4906('0x41')](function(_0x4eb67f){if(_0x4eb67f===_0x4906('0x7e')){_0x44c450[_0x4906('0x51')](_0x4906('0x7f'),[]['concat'](_0x49fd93[_0x4906('0x49')][_0x4eb67f]));}else if(_0x4eb67f===_0x4906('0x80')){var _0x1c95ed=JSON[_0x4906('0x81')](_0x49fd93['query'][_0x4eb67f])[_0x4906('0x82')];var _0x324b8d=JSON[_0x4906('0x81')](_0x49fd93['query'][_0x4eb67f])[_0x4906('0x83')];_0x44c450[_0x4906('0x51')](_0x4906('0x84'),_0x1c95ed,_0x324b8d);}else{if(_0x49fd93[_0x4906('0x49')][_0x4eb67f]==='null'){_0x44c450[_0x4906('0x51')]('i.'+_0x4eb67f+'\x20IS\x20NULL');}else{_0x44c450[_0x4906('0x51')]('i.'+_0x4eb67f+_0x4906('0x85'),_0x49fd93['query'][_0x4eb67f]);}}});}if(_0x49fd93['query']['read']){if(_0x49fd93[_0x4906('0x49')][_0x4906('0x86')]==0x1){_0x44c450['having'](_0x4906('0x87'));}else{_0x44c450[_0x4906('0x6b')](_0x4906('0x88'));}}if(_0x49fd93[_0x4906('0x49')]['tag']){_0x233536=_['isArray'](_0x49fd93['query']['tag'])?_0x49fd93[_0x4906('0x49')]['tag']:new Array(_0x49fd93[_0x4906('0x49')]['tag']);_0x233536[_0x4906('0x41')](function(_0x4a1a9a){_0x4edc9c['or'](_0x4906('0x74'),'%,'+_0x4a1a9a+',%');});}if(_0x49fd93[_0x4906('0x49')][_0x4906('0x89')]){var _0x2e2892=_0x49fd93['query'][_0x4906('0x89')][_0x4906('0x8a')]('\x5c','\x5c\x5c')[_0x4906('0x8a')](/'/g,'\x27\x27');if(qs[_0x4906('0x8b')](_0x2e2892)){_0x4af7a8['or'](_0x4906('0x8c'),_0x2e2892+'%');}else{_0x4af7a8['or'](_0x4906('0x8d'),qs['getFullTextValue'](_0x2e2892))['or'](_0x4906('0x8e'),_0x2e2892+'%');}}}_0x44c450[_0x4906('0x51')](_0x4af7a8);_0x44c450[_0x4906('0x8f')](_0x4906('0x90'));var _0x44cf7b={'type':db['Sequelize'][_0x4906('0x91')][_0x4906('0x92')],'raw':!![]};var _0x404da3=_0x44c450[_0x4906('0x93')]();_0x404da3['field'](_0x4906('0x90'));_0x404da3['field'](_0x4906('0x94'),_0x4906('0x68'));if(_0x2b6106[_0x4906('0x95')]){_0x2b6106['order']['forEach'](function(_0x4e10af){var _0x2e131f=_0x4e10af[0x0]===_0x4906('0x96')?_0x4e10af[0x0]:'i.'+_0x4e10af[0x0];_0x44c450[_0x4906('0x95')](_0x2e131f,_0x4e10af[0x1]===_0x4906('0x97')?![]:!![]);});}if(!_[_0x4906('0x98')](_0x233536)){_0x44c450[_0x4906('0x6b')](_0x4edc9c);_0x404da3[_0x4906('0x51')](_0x4906('0x99'),_0x233536);}BPromise[_0x4906('0x9a')]()[_0x4906('0x20')](function(){if(!_0x23f836){if(_0x49fd93['query'][_0x4906('0x7e')])return;_0x404da3[_0x4906('0x51')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x44c450[_0x4906('0x51')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x49fd93[_0x4906('0x9b')][_0x4906('0x9c')]!=='agent')return;return _0x49fd93[_0x4906('0x9b')][_0x4906('0x9d')]({'attributes':['id'],'raw':!![]})[_0x4906('0x20')](function(_0x5f1e3f){if(_['isEmpty'](_0x5f1e3f)){_0x404da3['where'](_0x4906('0x9e'));_0x44c450['where']('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x404da3[_0x4906('0x51')](_0x4906('0x7f'),_[_0x4906('0x3c')](_0x5f1e3f,'id'));_0x44c450[_0x4906('0x51')](_0x4906('0x7f'),_['map'](_0x5f1e3f,'id'));}});})[_0x4906('0x20')](function(){if(_0x49fd93[_0x4906('0x9b')][_0x4906('0x9c')]===_0x4906('0x9f')&&!_0x23f836&&!_0x49fd93[_0x4906('0x49')]['ChatWebsiteId'])return[];return db[_0x4906('0xa0')]['query'](_0x404da3[_0x4906('0xa1')](),_0x44cf7b);})[_0x4906('0x20')](function(_0xbb1a89){_0x49c989[_0x4906('0xa2')]=_0xbb1a89[_0x4906('0xa3')];if(_0x49c989[_0x4906('0xa2')]===0x0)return[];return db[_0x4906('0xa0')][_0x4906('0x49')](_0x384525[_0x4906('0xa1')](),_0x44cf7b)[_0x4906('0x20')](function(_0x13fcb0){_0x1b19ae=_[_0x4906('0xa4')](_0x13fcb0,'id');_0x44cf7b=_[_0x4906('0xa5')](_0x44cf7b,{'model':db[_0x4906('0x44')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x49fd93['query']['fields']){_0x2b6106['attributes'][_0x4906('0x41')](function(_0x4c8c65){_0x44c450[_0x4906('0x53')]('i.'+_0x4c8c65);});}else{_0x44c450[_0x4906('0x53')](_0x4906('0x94'),'unreadMessages');_0x44c450[_0x4906('0x53')](_0x4906('0xa6'),_0x4906('0xa7'));_0x44c450['field'](_0x4906('0xa8'),_0x4906('0xa9'));_0x44c450[_0x4906('0x53')]('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',_0x4906('0x96'));_0x44c450['field'](_0x4906('0xaa'));_0x44c450[_0x4906('0x53')](_0x4906('0xab'),_0x4906('0xac'));_0x44c450['field']('c.lastName',_0x4906('0xad'));_0x44c450[_0x4906('0x53')](_0x4906('0xae'),_0x4906('0xaf'));_0x44c450[_0x4906('0x53')](_0x4906('0xb0'),'Contact.phone');_0x44c450[_0x4906('0x53')](_0x4906('0xb1'),_0x4906('0xb2'));_0x44c450[_0x4906('0x53')](_0x4906('0xb3'),_0x4906('0xb4'));_0x44c450[_0x4906('0x53')](_0x4906('0xb5'),_0x4906('0xb6'));_0x44c450['field'](_0x4906('0xb7'),_0x4906('0xb8'));_0x44c450[_0x4906('0x53')](_0x4906('0xb9'),'TagIds');}if(_0x2b6106['limit'])_0x44c450['limit'](_0x2b6106[_0x4906('0x31')]);if(_0x2b6106[_0x4906('0x30')])_0x44c450[_0x4906('0x30')](_0x2b6106[_0x4906('0x30')]);return db[_0x4906('0xa0')][_0x4906('0x49')](_0x44c450[_0x4906('0xa1')](),_0x44cf7b);})[_0x4906('0x20')](function(_0x28db52){_0x1204d8[_0x4906('0x51')](_0x4906('0xba'),_[_0x4906('0x3c')](_0x28db52,'id'));return db['sequelize'][_0x4906('0x49')](_0x1204d8[_0x4906('0xa1')](),_0x44cf7b)[_0x4906('0x20')](function(_0x518272){var _0x33d41d=_[_0x4906('0xbb')](_0x518272,'ChatInteractionId');var _0x144e50=[];_0x28db52['forEach'](function(_0x3e8e7a){_0x144e50[_0x4906('0x42')](updateChatInteraction(_0x3e8e7a,_0x1b19ae,_0x33d41d));});return BPromise[_0x4906('0xbc')](_0x144e50);});});})[_0x4906('0x20')](function(_0x55f75d){_0x49c989[_0x4906('0xbd')]=_0x55f75d;return _0x49c989;})[_0x4906('0x20')](respondWithFilteredResult(_0x5230ef,_0x2b6106))[_0x4906('0x2b')](handleError(_0x5230ef,null));};exports[_0x4906('0xbe')]=function(_0xb97d18,_0x440f77){var _0x318ef1={'raw':![],'where':{'id':_0xb97d18[_0x4906('0xbf')]['id']}},_0x58d934={};_0x58d934[_0x4906('0x48')]=_[_0x4906('0x4a')](db[_0x4906('0x44')][_0x4906('0xc0')]);_0x58d934['query']=_[_0x4906('0x4a')](_0xb97d18[_0x4906('0x49')]);_0x58d934[_0x4906('0x4b')]=_[_0x4906('0x4c')](_0x58d934[_0x4906('0x48')],_0x58d934[_0x4906('0x49')]);_0x318ef1[_0x4906('0x4d')]=_[_0x4906('0x4c')](_0x58d934[_0x4906('0x48')],qs[_0x4906('0x4e')](_0xb97d18['query'][_0x4906('0x4e')]));_0x318ef1[_0x4906('0x4d')]=_0x318ef1[_0x4906('0x4d')][_0x4906('0xa3')]?_0x318ef1['attributes']:_0x58d934[_0x4906('0x48')];if(_0xb97d18['query']['includeAll']){_0x318ef1[_0x4906('0xc1')]=[{'all':!![]}];}_0x318ef1=_[_0x4906('0xa5')]({},_0x318ef1,_0xb97d18[_0x4906('0xc2')]);return db[_0x4906('0x44')][_0x4906('0x67')](_0x318ef1)[_0x4906('0x20')](handleEntityNotFound(_0x440f77,null))[_0x4906('0x20')](respondWithResult(_0x440f77,null))[_0x4906('0x2b')](handleError(_0x440f77,null));};exports[_0x4906('0xc3')]=function(_0x45b06b,_0x3e644f){return db['ChatInteraction'][_0x4906('0xc3')](_0x45b06b[_0x4906('0x7a')],{})[_0x4906('0x20')](respondWithResult(_0x3e644f,0xc9))[_0x4906('0x2b')](handleError(_0x3e644f,null));};exports[_0x4906('0x37')]=function(_0x4c2fce,_0x5ea561){if(_0x4c2fce[_0x4906('0x7a')]['id']){delete _0x4c2fce[_0x4906('0x7a')]['id'];}return db['ChatInteraction'][_0x4906('0x67')]({'where':{'id':_0x4c2fce[_0x4906('0xbf')]['id']}})[_0x4906('0x20')](handleEntityNotFound(_0x5ea561,null))[_0x4906('0x20')](saveUpdates(_0x4c2fce[_0x4906('0x7a')],null))[_0x4906('0x20')](respondWithResult(_0x5ea561,null))[_0x4906('0x2b')](handleError(_0x5ea561,null));};exports[_0x4906('0x38')]=function(_0x4475f0,_0x1cde17){return db[_0x4906('0x44')][_0x4906('0x67')]({'where':{'id':_0x4475f0[_0x4906('0xbf')]['id']}})[_0x4906('0x20')](handleEntityNotFound(_0x1cde17,null))[_0x4906('0x20')](removeEntity(_0x1cde17,null))[_0x4906('0x2b')](handleError(_0x1cde17,null));};exports['describe']=function(_0x24b8fc,_0x38341d){return db[_0x4906('0x44')][_0x4906('0xc4')]()['then'](respondWithResult(_0x38341d,null))['catch'](handleError(_0x38341d,null));};exports[_0x4906('0xc5')]=function(_0x123e1c,_0x5df6cd){var _0x1a0c2c=_0x123e1c['params']['id'];var _0xd02d49;var _0x277498;var _0x5c8378;return db[_0x4906('0x44')][_0x4906('0xc6')]({'where':{'id':_0x1a0c2c}})[_0x4906('0x20')](function(_0x4f34a4){_0xd02d49=_0x4f34a4;return db['ChatWebsite'][_0x4906('0xc6')]({'where':{'id':_0x4f34a4[_0x4906('0x7e')]},'attributes':['id',_0x4906('0xc7'),_0x4906('0xc8')],'raw':!![]});})[_0x4906('0x20')](function(_0x47f43c){if(_0x47f43c&&_0x47f43c[_0x4906('0xc7')]&&_0x47f43c[_0x4906('0xc8')]){_0x277498=_0x47f43c;var _0x3c822d={'rejectUnauthorized':![],'method':'POST','uri':_0x4906('0xc9'),'headers':{'X-APIKEY':_0x47f43c['vidaooApiKey']},'body':{'name':_0x4906('0xca')+_0x1a0c2c},'redirect':'follow','json':!![]};return rp(_0x3c822d);}else{throw new db['Sequelize']['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0x4906('0x20')](function(_0x45c60b){_0x5c8378=_0x45c60b;if(_0x5c8378['id']){var _0x5ce731={'body':_0x5c8378['join_url'],'ChatWebsiteId':_0x277498['id'],'ChatInteractionId':_0xd02d49['id'],'direction':_0x4906('0xcb'),'UserId':_0x123e1c[_0x4906('0x9b')]['id']};return db[_0x4906('0xcc')][_0x4906('0xc3')](_0x5ce731,{});}else{throw new db[(_0x4906('0xcd'))]['ValidationError'](_0x4906('0xce'));}})['then'](function(){return _0xd02d49[_0x4906('0xcf')]({'vidaooSessionId':_0x5c8378['id']});})['then'](respondWithResult(_0x5df6cd,null))[_0x4906('0x2b')](handleError(_0x5df6cd,null));};exports[_0x4906('0xd0')]=function(_0x3e7518,_0x2996eb){if(_0x3e7518[_0x4906('0x7a')]['id']){delete _0x3e7518[_0x4906('0x7a')]['id'];}return db[_0x4906('0x44')]['find']({'where':{'id':_0x3e7518[_0x4906('0xbf')]['id']}})[_0x4906('0x20')](handleEntityNotFound(_0x2996eb,null))[_0x4906('0x20')](saveUpdates(_0x3e7518[_0x4906('0x7a')],null))[_0x4906('0x20')](respondWithResult(_0x2996eb,null))['catch'](handleError(_0x2996eb,null));};exports[_0x4906('0xd1')]=function(_0x196c10,_0x4cf3b2,_0x1f55f2){if(_0x196c10[_0x4906('0x7a')]['id']){delete _0x196c10['body']['id'];}return db[_0x4906('0x44')][_0x4906('0x67')]({'where':{'id':_0x196c10[_0x4906('0xbf')]['id']}})[_0x4906('0x20')](function(_0x409dde){if(!_0x409dde){logger[_0x4906('0x26')](_0x4906('0xd2'),_0x4906('0xd1'),0x194,_0x4906('0xd3'));_0x4cf3b2[_0x4906('0x2c')](0x194);}else{if(_0x409dde[_0x4906('0x79')]){throw new db['Sequelize'][(_0x4906('0xd4'))]('Interaction\x20already\x20assigned');}}return _0x409dde;})[_0x4906('0x20')](function(_0x4b712f){if(_0x4b712f){return _0x4b712f[_0x4906('0x37')]({'closed':_0x196c10[_0x4906('0x7a')][_0x4906('0xd5')],'disposition':_0x196c10[_0x4906('0x7a')][_0x4906('0xd6')]})[_0x4906('0x20')](function(_0x4ebd27){return _0x4ebd27;});}})[_0x4906('0x20')](function(_0x583b56){return respondWithRpcPromise(_0x4906('0xd7'),_0x4906('0xd1'),_0x196c10[_0x4906('0x7a')],client9004);})['then'](respondWithResult(_0x4cf3b2,null))[_0x4906('0x2b')](handleError(_0x4cf3b2,null));};exports[_0x4906('0xd8')]=function(_0xbb7995,_0x10d175,_0xa2d909){_0xbb7995[_0x4906('0x7a')][_0x4906('0x3a')]=_0xbb7995['file'][_0x4906('0xd9')];_0xbb7995[_0x4906('0x7a')][_0x4906('0xda')]=_0xbb7995[_0x4906('0xdb')][_0x4906('0xdc')];_0xbb7995[_0x4906('0x7a')][_0x4906('0x46')]=_0xbb7995[_0x4906('0xdb')][_0x4906('0xdd')];return db[_0x4906('0xde')][_0x4906('0xc3')](_0xbb7995[_0x4906('0x7a')])[_0x4906('0x20')](respondWithResult(_0x10d175,0xc9))[_0x4906('0x2b')](handleError(_0x10d175,null));};exports[_0x4906('0xdf')]=function(_0x1bcd65,_0x135e9b,_0x592da0){return db[_0x4906('0x44')][_0x4906('0xc6')]({'where':{'id':_0x1bcd65['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x135e9b,null))['then'](function(_0x33e877){if(_0x33e877){if(_0x33e877[_0x4906('0xd5')]){return _0x135e9b[_0x4906('0x2d')](0x193)['json']({'status':0x193,'message':_0x4906('0xe0')});}return db['Attachment'][_0x4906('0xc6')]({'where':{'id':_0x1bcd65[_0x4906('0x49')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x135e9b,null));}})[_0x4906('0x20')](function(_0x2389e8){if(_0x2389e8){return _0x135e9b[_0x4906('0xe1')](path[_0x4906('0xe2')](config['root'],_0x4906('0xe3'),_0x2389e8['basename']));}})[_0x4906('0x2b')](handleError(_0x135e9b,null));};exports[_0x4906('0xe4')]=function(_0x575102,_0x5267a4){var _0x5f27a0=null;var _0x119f79=null;var _0x3bd4a4=null;var _0x1d6a70=null;if(_0x575102[_0x4906('0x7a')]['id']){delete _0x575102[_0x4906('0x7a')]['id'];}if(_0x575102[_0x4906('0x7a')][_0x4906('0xe5')]){_0x1d6a70=path[_0x4906('0xe2')](config[_0x4906('0xe6')],_0x4906('0xe7'),util[_0x4906('0xe8')](_0x4906('0xe9'),Date[_0x4906('0xea')]()));_0x575102[_0x4906('0x7a')][_0x4906('0xeb')]=_0x1d6a70;}return db[_0x4906('0x44')]['find']({'where':{'id':_0x575102[_0x4906('0xbf')]['id']},'include':[{'model':db[_0x4906('0xcc')],'as':_0x4906('0xec'),'include':[{'model':db['User'],'as':_0x4906('0x76')}]}]})[_0x4906('0x20')](handleEntityNotFound(_0x5267a4,null))[_0x4906('0x20')](saveUpdates(_0x575102[_0x4906('0x7a')],null))[_0x4906('0x20')](function(_0x5d0507){if(_0x5d0507){_0x5f27a0=_0x5d0507;return db[_0x4906('0xed')]['find']({'where':{'id':_0x5f27a0['ChatWebsiteId']}});}})[_0x4906('0x20')](function(_0x38897a){if(_0x38897a){_0x3bd4a4=_0x38897a;return db['CmContact']['find']({'where':{'id':_0x5f27a0[_0x4906('0x70')]}});}})['then'](function(_0x567e6d){if(_0x567e6d){_0x119f79=_0x567e6d;if(_0x1d6a70){var _0x187084=null;for(var _0x3c0d6c=0x1;_0x3c0d6c<_0x5f27a0[_0x4906('0xec')]['length'];++_0x3c0d6c){_0x187084=_0x5f27a0[_0x4906('0xec')][_0x3c0d6c];var _0x39d96b=_0x187084[_0x4906('0x79')]?util[_0x4906('0xe8')](_0x4906('0xee'),_0x3bd4a4['agentAlias'],_0x187084[_0x4906('0x79')]):_0x4906('0xef');var _0x20cdff=_0x575102[_0x4906('0x7a')][_0x4906('0xf0')]||util['format'](_0x4906('0xee'),'Visitor',_0x187084[_0x4906('0x70')]);switch(_0x3bd4a4[_0x4906('0xf1')]){case _0x4906('0xf2'):_0x39d96b=_0x187084[_0x4906('0x79')]?util[_0x4906('0xe8')](_0x4906('0xee'),_0x3bd4a4[_0x4906('0xf3')],_0x187084[_0x4906('0x79')]):'System';break;case _0x4906('0xf4'):_0x39d96b=_0x187084[_0x4906('0x79')]?_0x187084['User']['alias']||_0x187084[_0x4906('0x76')][_0x4906('0x3d')]:'System';break;case _0x4906('0xf5'):_0x39d96b=_0x187084[_0x4906('0x79')]?_0x187084[_0x4906('0x76')][_0x4906('0x3d')]:'System';break;default:_0x39d96b=_0x187084[_0x4906('0x79')]?util[_0x4906('0xe8')](_0x4906('0xee'),_0x3bd4a4[_0x4906('0xf3')],_0x187084[_0x4906('0x79')]):_0x4906('0xef');}var _0x27b08b=util[_0x4906('0xe8')]('[%s]\x20%s:\x20%s\x0a',moment(_0x187084[_0x4906('0x80')])['format'](_0x4906('0xf6')),_0x187084[_0x4906('0xf7')]==='in'?_0x20cdff:_0x39d96b,_0x187084[_0x4906('0x7a')]);if(!_0x187084['secret']){fs[_0x4906('0xf8')](_0x1d6a70,_0x27b08b);}}return db['MailAccount'][_0x4906('0xc6')]({'where':{'service':!![]},'include':[{'model':db[_0x4906('0xf9')],'as':_0x4906('0xfa'),'raw':!![]}]});}}})['then'](function(_0x2b5f00){if(_0x2b5f00&&_0x2b5f00[_0x4906('0xfa')]&&_0x575102[_0x4906('0x7a')]){var _0x53ee93={'tls':{'rejectUnauthorized':![]}};if(_0x2b5f00[_0x4906('0xfa')][_0x4906('0xfb')]){_0x53ee93[_0x4906('0xfb')]=_0x2b5f00['Smtp']['service'];}else{_0x53ee93[_0x4906('0xfc')]=_0x2b5f00['Smtp'][_0x4906('0xfc')];_0x53ee93[_0x4906('0xfd')]=_0x2b5f00[_0x4906('0xfa')][_0x4906('0xfd')];_0x53ee93[_0x4906('0xfe')]=_0x2b5f00[_0x4906('0xfa')][_0x4906('0xfe')];}if(_0x2b5f00[_0x4906('0xfa')][_0x4906('0xff')]){_0x53ee93[_0x4906('0x100')]={'user':_0x2b5f00[_0x4906('0xfa')][_0x4906('0x9b')],'pass':_0x2b5f00[_0x4906('0xfa')][_0x4906('0x101')]};}return respondWithRpcPromise(_0x4906('0x102'),_0x4906('0x103'),{'account':_0x53ee93,'message':{'from':util['format'](_0x4906('0x104'),_0x2b5f00[_0x4906('0x3a')],_0x2b5f00[_0x4906('0x105')]||_0x2b5f00['Smtp']['user']),'to':_0x575102[_0x4906('0x7a')][_0x4906('0xe5')],'subject':'Mail\x20Transcript','text':util[_0x4906('0xe8')](_0x4906('0x106'),_0x575102[_0x4906('0x7a')][_0x4906('0xe5')]),'attachments':[{'path':_0x1d6a70}]}})[_0x4906('0x20')](function(){return _0x5f27a0;})[_0x4906('0x2b')](function(_0x118846){console['error'](_0x118846);});}else{return _0x5f27a0;}})['then'](respondWithStatusCode(_0x5267a4,0xc8))[_0x4906('0x2b')](handleError(_0x5267a4,null));};exports[_0x4906('0x107')]=function(_0x30e030,_0x143a22,_0x448aab){return db[_0x4906('0xcc')][_0x4906('0x67')]({'where':{'id':_0x30e030[_0x4906('0xbf')]['id']}})['then'](handleEntityNotFound(_0x143a22,null))[_0x4906('0x20')](function(_0x5e56c4){if(_0x5e56c4){return _0x5e56c4[_0x4906('0x107')](_0x30e030[_0x4906('0x7a')][_0x4906('0x108')],_['omit'](_0x30e030[_0x4906('0x7a')],[_0x4906('0x108'),'id'])||{});}})['then'](respondWithResult(_0x143a22,null))[_0x4906('0x2b')](handleError(_0x143a22,null));};exports['getMessages']=function(_0x1885d3,_0x3597f2,_0x45d421){var _0x52e06a={'raw':![],'where':{}};var _0x428a65={};var _0x47ebe5={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x4906('0xc6')]({'where':{'id':_0x1885d3[_0x4906('0xbf')]['id']}})[_0x4906('0x20')](handleEntityNotFound(_0x3597f2,null))['then'](function(_0x51e6a2){if(_0x51e6a2){_0x428a65['model']=_[_0x4906('0x4a')](db[_0x4906('0xcc')][_0x4906('0xc0')]);_0x428a65[_0x4906('0x49')]=_[_0x4906('0x4a')](_0x1885d3[_0x4906('0x49')]);_0x428a65[_0x4906('0x4b')]=_['intersection'](_0x428a65[_0x4906('0x48')],_0x428a65['query']);_0x52e06a[_0x4906('0x4d')]=_['intersection'](_0x428a65[_0x4906('0x48')],qs[_0x4906('0x4e')](_0x1885d3[_0x4906('0x49')][_0x4906('0x4e')]));_0x52e06a[_0x4906('0x4d')]=_0x52e06a[_0x4906('0x4d')]['length']?_0x52e06a['attributes']:_0x428a65[_0x4906('0x48')];if(!_0x1885d3[_0x4906('0x49')]['hasOwnProperty'](_0x4906('0x109'))){_0x52e06a['limit']=qs['limit'](_0x1885d3['query'][_0x4906('0x31')]);_0x52e06a['offset']=qs[_0x4906('0x30')](_0x1885d3[_0x4906('0x49')][_0x4906('0x30')]);}_0x52e06a[_0x4906('0x95')]=qs[_0x4906('0x50')](_0x1885d3[_0x4906('0x49')][_0x4906('0x50')]);_0x52e06a['where']=qs[_0x4906('0x4b')](_['pick'](_0x1885d3[_0x4906('0x49')],_0x428a65['filters']));_0x52e06a['where']['ChatInteractionId']=_0x51e6a2['id'];if(_0x1885d3['query']['filter']){_0x52e06a[_0x4906('0x51')]=_[_0x4906('0xa5')](_0x52e06a[_0x4906('0x51')],{'$or':_[_0x4906('0x3c')](_0x52e06a[_0x4906('0x4d')],function(_0x180622){var _0x3255c4={};_0x3255c4[_0x180622]={'$like':'%'+_0x1885d3['query']['filter']+'%'};return _0x3255c4;})});}if(_0x1885d3[_0x4906('0x49')][_0x4906('0x82')]){var _0x1a7843=_0x1885d3[_0x4906('0x49')][_0x4906('0x82')][_0x4906('0x40')](',');var _0x4d6fcb={};_0x4d6fcb[_0x1a7843[0x0]]={'$gte':moment(_0x1a7843[0x1])[_0x4906('0xe8')]('YYYY-MM-DD\x20HH:mm:ss')};_0x52e06a['where']=_['merge'](_0x52e06a[_0x4906('0x51')],_0x4d6fcb);}_0x52e06a=_[_0x4906('0xa5')]({},_0x52e06a,_0x1885d3[_0x4906('0xc2')]);return db[_0x4906('0xcc')][_0x4906('0xa2')]({'where':_0x52e06a[_0x4906('0x51')]})['then'](function(_0x26314d){_0x47ebe5[_0x4906('0xa2')]=_0x26314d;if(_0x1885d3['query'][_0x4906('0x10a')]){_0x52e06a[_0x4906('0xc1')]=[{'all':!![]}];}return db[_0x4906('0xcc')][_0x4906('0x10b')](_0x52e06a);})['then'](function(_0x457ac7){_0x47ebe5[_0x4906('0xbd')]=_0x457ac7;return _0x47ebe5;});}})['then'](respondWithFilteredResult(_0x3597f2,_0x52e06a))[_0x4906('0x2b')](handleError(_0x3597f2,null));};exports[_0x4906('0x10c')]=function(_0x42ac05,_0x1019e1,_0x78cea2){var _0x544e80={'where':{}},_0x1f37f1={},_0x940700={'count':0x0,'rows':[]};return db[_0x4906('0x44')][_0x4906('0xc6')]({'where':{'id':_0x42ac05[_0x4906('0xbf')]['id']}})[_0x4906('0x20')](handleEntityNotFound(_0x1019e1,null))[_0x4906('0x20')](function(_0x5a90f5){if(_0x5a90f5){_0x1f37f1[_0x4906('0x48')]=_[_0x4906('0x4a')](db[_0x4906('0xcc')][_0x4906('0xc0')]);_0x1f37f1['query']=_['keys'](_0x42ac05[_0x4906('0x49')]);_0x1f37f1[_0x4906('0x4b')]=_[_0x4906('0x4c')](_0x1f37f1[_0x4906('0x48')],_0x1f37f1['query']);_0x544e80[_0x4906('0x4d')]=_['intersection'](_0x1f37f1[_0x4906('0x48')],qs[_0x4906('0x4e')](_0x42ac05['query'][_0x4906('0x4e')]));_0x544e80[_0x4906('0x4d')]=_0x544e80[_0x4906('0x4d')][_0x4906('0xa3')]?_0x544e80[_0x4906('0x4d')]:_0x1f37f1[_0x4906('0x48')];if(!_0x42ac05[_0x4906('0x49')]['hasOwnProperty'](_0x4906('0x109'))){_0x544e80[_0x4906('0x31')]=qs[_0x4906('0x31')](_0x42ac05[_0x4906('0x49')][_0x4906('0x31')]);_0x544e80['offset']=qs['offset'](_0x42ac05[_0x4906('0x49')][_0x4906('0x30')]);}_0x544e80[_0x4906('0x95')]=qs['sort'](_0x42ac05['query'][_0x4906('0x50')]);_0x544e80[_0x4906('0x51')]=qs[_0x4906('0x4b')](_['pick'](_0x42ac05[_0x4906('0x49')],_0x1f37f1['filters']));_0x544e80[_0x4906('0x51')][_0x4906('0x10d')]=_0x5a90f5['id'];if(_0x42ac05[_0x4906('0x49')]['filter']){_0x544e80[_0x4906('0x51')]=_[_0x4906('0xa5')](_0x544e80[_0x4906('0x51')],{'$or':_[_0x4906('0x3c')](_0x544e80[_0x4906('0x4d')],function(_0x3ce8e0){var _0x13ee6d={};_0x13ee6d[_0x3ce8e0]={'$like':'%'+_0x42ac05['query']['filter']+'%'};return _0x13ee6d;})});}_0x544e80[_0x4906('0x51')][_0x4906('0x10e')]=![];if(_0x42ac05[_0x4906('0x49')]['id']){_0x544e80[_0x4906('0x51')]['id']={'$gt':_0x42ac05[_0x4906('0x49')]['id']};}_0x544e80=_[_0x4906('0xa5')]({},_0x544e80,_0x42ac05[_0x4906('0xc2')]);return db['ChatMessage']['count']({'where':_0x544e80[_0x4906('0x51')]})['then'](function(_0x37a152){_0x940700[_0x4906('0xa2')]=_0x37a152;_0x544e80['include']=[];if(_0x42ac05['query'][_0x4906('0x10f')]){_0x544e80[_0x4906('0xc1')][_0x4906('0x42')]({'model':db['User'],'as':_0x4906('0x76'),'attributes':['id',_0x4906('0x3d'),_0x4906('0x110')]});}if(_0x42ac05[_0x4906('0x49')][_0x4906('0x10a')]){_0x544e80[_0x4906('0xc1')]=[{'all':!![]}];}return db[_0x4906('0xcc')][_0x4906('0x10b')](_0x544e80);})[_0x4906('0x20')](function(_0x3a1c5c){_0x940700[_0x4906('0xbd')]=_0x3a1c5c;return _0x940700;});}})[_0x4906('0x20')](respondWithFilteredResult(_0x1019e1,_0x544e80))[_0x4906('0x2b')](handleError(_0x1019e1,null));};exports[_0x4906('0x111')]=function(_0x5356cc,_0x4fdb99,_0x16b5d6){return db[_0x4906('0x44')][_0x4906('0x67')]({'where':{'id':_0x5356cc[_0x4906('0xbf')]['id']}})['then'](handleEntityNotFound(_0x4fdb99,null))['then'](function(_0x1a510f){if(_0x1a510f){return _0x1a510f[_0x4906('0x112')](_0x5356cc[_0x4906('0x7a')][_0x4906('0x108')],_['omit'](_0x5356cc[_0x4906('0x7a')],[_0x4906('0x108'),'id'])||{})[_0x4906('0x113')](function(){return db[_0x4906('0x73')][_0x4906('0x10b')]({'attributes':['id',_0x4906('0x3a'),_0x4906('0x114')],'where':{'id':_0x5356cc['body'][_0x4906('0x108')]}});})['then'](function(_0x31a9e8){socket[_0x4906('0x115')](_0x4906('0x116'),{'id':Number(_0x5356cc[_0x4906('0xbf')]['id']),'tags':_0x31a9e8||[]});return{'id':Number(_0x5356cc['params']['id']),'tags':_0x31a9e8||[]};});}})[_0x4906('0x20')](respondWithResult(_0x4fdb99,null))['catch'](handleError(_0x4fdb99,null));};exports[_0x4906('0x117')]=function(_0x4bed21,_0x2123e1,_0x2d84df){return db['ChatInteraction']['find']({'where':{'id':_0x4bed21[_0x4906('0xbf')]['id']}})[_0x4906('0x20')](handleEntityNotFound(_0x2123e1,null))[_0x4906('0x20')](function(_0x427637){if(_0x427637){return _0x427637[_0x4906('0x117')](_0x4bed21['query'][_0x4906('0x108')]);}})['then'](respondWithStatusCode(_0x2123e1,null))[_0x4906('0x2b')](handleError(_0x2123e1,null));};exports['download']=function(_0x493b5f,_0x508dbe){var _0x2b6519=moment()[_0x4906('0x118')]()[_0x4906('0xa1')]();var _0x5db4ea=path['join'](config[_0x4906('0xe6')],'server','files',_0x4906('0x119'));var _0x470237=path[_0x4906('0xe2')](config['root'],'server',_0x4906('0x11a'),_0x4906('0x11b'));var _0x444936=path[_0x4906('0xe2')](_0x5db4ea,_0x2b6519);var _0x248d01=util[_0x4906('0xe8')]('transcript-%d-%s.zip',_0x493b5f['params']['id'],_0x2b6519);var _0x56c479=path['join'](_0x5db4ea,_0x248d01);var _0x5e9da0=[];_0x5e9da0[_0x4906('0x42')]({'model':db['User'],'as':_0x4906('0x76'),'attributes':['id',_0x4906('0x3d')],'raw':!![]});_0x5e9da0[_0x4906('0x42')]({'model':db['CmContact'],'as':_0x4906('0x6d'),'attributes':['id',_0x4906('0x11c'),_0x4906('0x11d')],'raw':!![]});if(_0x493b5f[_0x4906('0x49')]['attachments']){_0x5e9da0[_0x4906('0x42')]({'model':db[_0x4906('0xde')],'as':_0x4906('0xde'),'raw':!![]});}var _0x238d6e=[{'model':db[_0x4906('0xcc')],'as':_0x4906('0xec'),'attributes':['id','body',_0x4906('0x80'),_0x4906('0xf7'),_0x4906('0x10e'),'read'],'include':_0x5e9da0}];_0x238d6e[_0x4906('0x42')]({'model':db[_0x4906('0xed')],'as':_0x4906('0x11e'),'attributes':['id',_0x4906('0x3a')]});_0x238d6e[_0x4906('0x42')]({'model':db[_0x4906('0x76')],'as':_0x4906('0x11f'),'attributes':['id',_0x4906('0x3d')]});return db['ChatInteraction']['find']({'where':{'id':_0x493b5f[_0x4906('0xbf')]['id']},'include':_0x238d6e})[_0x4906('0x20')](handleEntityNotFound(_0x508dbe,null))[_0x4906('0x20')](function(_0x554291){if(_0x554291){var _0xdd229a=_0x554291['get']({'plain':!![]});fs[_0x4906('0x120')](_0x444936);var _0x47b254={'format':'A4','border':_0x4906('0x121'),'header':{'height':_0x4906('0x122'),'contents':{'first':_0x4906('0x123')}},'footer':{'height':_0x4906('0x124'),'contents':{'default':util['format'](_0x4906('0x125'),util[_0x4906('0xe8')]('%s\x20#%d',_0x4906('0x126'),_0xdd229a['id']),moment()[_0x4906('0xe8')]('YYYY-MM-DD')[_0x4906('0xa1')]())}}};var _0x5a2aeb={'channel':'Chat','account':_0xdd229a[_0x4906('0x11e')][_0x4906('0x3a')],'agent':_0xdd229a[_0x4906('0x11f')]?_0xdd229a['Owner'][_0x4906('0x3d')]:'N.A.','createdAt':moment(_0xdd229a['createdAt'])[_0x4906('0xe8')](_0x4906('0x127'))['toString'](),'closedAt':_0xdd229a[_0x4906('0xd5')]?moment(_0xdd229a[_0x4906('0x128')])[_0x4906('0xe8')](_0x4906('0x127'))[_0x4906('0xa1')]():'','disposition':_0xdd229a[_0x4906('0xd6')],'chatInfo':{'browser':_0xdd229a[_0x4906('0x129')],'os':_0xdd229a['osName'],'referer':_0xdd229a[_0x4906('0x12a')],'customerIp':_0xdd229a[_0x4906('0x12b')],'customerPort':_0xdd229a[_0x4906('0x12c')]?_0xdd229a[_0x4906('0x12c')]:_0x4906('0x12d')},'messages':_(_0xdd229a[_0x4906('0xec')])['tail']()[_0x4906('0x89')]({'secret':![]})[_0x4906('0x3c')](function(_0x526a01){if(_0x526a01[_0x4906('0xde')]){var _0x3df5f3=path['join'](_0x470237,_0x526a01[_0x4906('0xde')]['basename']);if(fs[_0x4906('0x12e')](_0x3df5f3)){fs['createReadStream'](_0x3df5f3)[_0x4906('0x12f')](fs[_0x4906('0x130')](path[_0x4906('0xe2')](_0x444936,_0x526a01[_0x4906('0xde')][_0x4906('0xda')])));}}return{'date':moment(_0x526a01[_0x4906('0x80')])[_0x4906('0xe8')](_0x4906('0x127'))[_0x4906('0xa1')](),'sender':_0x526a01['direction']===_0x4906('0xcb')?_0x526a01[_0x4906('0x76')]?_0x526a01['User'][_0x4906('0x3d')]:_0x4906('0xef'):_0x526a01[_0x4906('0x6d')][_0x4906('0x11c')]+(_0x526a01[_0x4906('0x6d')]['lastName']?'\x20'+_0x526a01[_0x4906('0x6d')]['lastName']:''),'body':_0x526a01['Attachment']?_0x526a01[_0x4906('0xde')][_0x4906('0xda')]:_0x526a01['body'],'direction':_0x526a01['direction']===_0x4906('0xcb')?'A':'C','secret':_0x526a01[_0x4906('0x10e')],'read':_0x526a01[_0x4906('0x86')],'attachment':_0x526a01['Attachment']};})[_0x4906('0x69')]()};return ejs['renderFile'](path[_0x4906('0xe2')](config[_0x4906('0xe6')],_0x4906('0x131'),_0x4906('0x132'),_0x4906('0x133')),{'interaction':_0x5a2aeb})[_0x4906('0x20')](function(_0x3b2eb6){return new BPromise(function(_0x174450,_0xb5404a){pdf[_0x4906('0xc3')](_0x3b2eb6,_0x47b254)['toFile'](path['join'](_0x444936,'transcript-'+_0xdd229a['id']+'-'+_0x2b6519+'.pdf'),function(_0xe2f641,_0x32f520){if(_0xe2f641)return _0xb5404a(_0xe2f641);_0x174450(_0x32f520);});});})[_0x4906('0x20')](function(){return new BPromise(function(_0x1c7810,_0x57b29a){zipdir(_0x444936,{'saveTo':_0x56c479},function(_0x51a4d9,_0x401175){if(_0x51a4d9)return _0x57b29a(_0x51a4d9);return _0x1c7810(_0x401175);});})[_0x4906('0x20')](function(){return new BPromise(function(_0x6ce39c,_0x433c5c){rimraf(_0x444936,function(_0x46684a){if(_0x46684a)_0x433c5c(_0x46684a);return _0x6ce39c();});});})[_0x4906('0x20')](function(){return _0x508dbe['download'](_0x56c479,_0x248d01,function(_0xfaf52a){if(_0xfaf52a){console['log'](_0x4906('0x134'),_0xfaf52a);}else{fs['unlinkSync'](_0x56c479);}});});});}else{return _0x508dbe[_0x4906('0x2c')](0xc8);}})[_0x4906('0x2b')](handleError(_0x508dbe,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 77f4039..742a7a3 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 _0x992b=['unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','save','remove','setDataValue','map','findAll','then'];(function(_0x1e0f42,_0x2567e5){var _0x4e9c54=function(_0x519f2d){while(--_0x519f2d){_0x1e0f42['push'](_0x1e0f42['shift']());}};_0x4e9c54(++_0x2567e5);}(_0x992b,0x127));var _0xb992=function(_0x42683a,_0x52c135){_0x42683a=_0x42683a-0x0;var _0x493076=_0x992b[_0x42683a];return _0x493076;};'use strict';var EventEmitter=require(_0xb992('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0xb992('0x1')];var ChatMessage=require(_0xb992('0x2'))['db'][_0xb992('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xb992('0x4')](0x0);var events={'afterCreate':_0xb992('0x5'),'afterUpdate':'update','afterDestroy':_0xb992('0x6')};function emitEvent(_0x4f7579){return function(_0x9fabba,_0x53aa29,_0x20d122){_0x9fabba['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x303b7a){_0x9fabba[_0xb992('0x7')]('Users',_0x303b7a[_0xb992('0x8')](function(_0x72a54){return{'id':_0x72a54['id']};}));return ChatMessage[_0xb992('0x9')]({'where':{'ChatInteractionId':_0x9fabba['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb992('0xa')](function(_0x235d02){_0x9fabba[_0xb992('0x7')](_0xb992('0xb'),_0x235d02['length']);ChatInteractionEvents[_0xb992('0xc')](_0x4f7579+':'+_0x9fabba['id'],_0x9fabba);ChatInteractionEvents[_0xb992('0xc')](_0x4f7579,_0x9fabba);_0x20d122(null);})[_0xb992('0xd')](_0x20d122(null));};}for(var e in events){if(events[_0xb992('0xe')](e)){var event=events[e];ChatInteraction[_0xb992('0xf')](e,emitEvent(event));}}module[_0xb992('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0xa29a=['map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users'];(function(_0x2914dd,_0xcde7ca){var _0x79ea12=function(_0x20315a){while(--_0x20315a){_0x2914dd['push'](_0x2914dd['shift']());}};_0x79ea12(++_0xcde7ca);}(_0xa29a,0x1ee));var _0xaa29=function(_0x2d7ff5,_0x62e53c){_0x2d7ff5=_0x2d7ff5-0x0;var _0x1f45bf=_0xa29a[_0x2d7ff5];return _0x1f45bf;};'use strict';var EventEmitter=require(_0xaa29('0x0'));var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require(_0xaa29('0x1'))['db'][_0xaa29('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xaa29('0x3')](0x0);var events={'afterCreate':_0xaa29('0x4'),'afterUpdate':_0xaa29('0x5'),'afterDestroy':'remove'};function emitEvent(_0x578514){return function(_0x2625f1,_0x3e69e0,_0x4ad456){_0x2625f1[_0xaa29('0x6')]({'attributes':['id'],'raw':!![]})[_0xaa29('0x7')](function(_0x31a354){_0x2625f1[_0xaa29('0x8')](_0xaa29('0x9'),_0x31a354[_0xaa29('0xa')](function(_0x444b57){return{'id':_0x444b57['id']};}));return ChatMessage[_0xaa29('0xb')]({'where':{'ChatInteractionId':_0x2625f1['id'],'direction':'in','read':![]},'raw':!![]});})[_0xaa29('0x7')](function(_0x4acd5e){_0x2625f1[_0xaa29('0x8')](_0xaa29('0xc'),_0x4acd5e[_0xaa29('0xd')]);ChatInteractionEvents['emit'](_0x578514+':'+_0x2625f1['id'],_0x2625f1);ChatInteractionEvents[_0xaa29('0xe')](_0x578514,_0x2625f1);_0x4ad456(null);})[_0xaa29('0xf')](_0x4ad456(null));};}for(var e in events){if(events[_0xaa29('0x10')](e)){var event=events[e];ChatInteraction[_0xaa29('0x11')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index add914e..e34ef1e 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 _0xdb43=['rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','closed','format','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x2e4d38,_0x341adb){var _0x550e6d=function(_0x53d463){while(--_0x53d463){_0x2e4d38['push'](_0x2e4d38['shift']());}};_0x550e6d(++_0x341adb);}(_0xdb43,0xba));var _0x3db4=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0xdb43[_0x46d0c9];return _0x174506;};'use strict';var _=require(_0x3db4('0x0'));var util=require('util');var logger=require(_0x3db4('0x1'))(_0x3db4('0x2'));var moment=require(_0x3db4('0x3'));var BPromise=require(_0x3db4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3db4('0x5'));var rimraf=require(_0x3db4('0x6'));var config=require(_0x3db4('0x7'));var attributes=require(_0x3db4('0x8'));module[_0x3db4('0x9')]=function(_0x1ea599,_0x3e4453){return _0x1ea599[_0x3db4('0xa')](_0x3db4('0xb'),attributes,{'tableName':_0x3db4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x403c9c,_0x116d5a,_0x188149){if(_0x403c9c['changed'](_0x3db4('0xd'))){_0x403c9c['closedAt']=moment()[_0x3db4('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x188149(null,_0x403c9c);}},'charset':'utf8mb4','collate':_0x3db4('0xf')});}; \ No newline at end of file +var _0x5a21=['ChatInteraction','chat_interactions','changed','closed','closedAt','format','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x5a21,0x178));var _0x15a2=function(_0x3327fd,_0x393a4b){_0x3327fd=_0x3327fd-0x0;var _0x204729=_0x5a21[_0x3327fd];return _0x204729;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x15a2('0x0'))(_0x15a2('0x1'));var moment=require(_0x15a2('0x2'));var BPromise=require('bluebird');var rp=require(_0x15a2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x15a2('0x4'));var config=require(_0x15a2('0x5'));var attributes=require('./chatInteraction.attributes');module[_0x15a2('0x6')]=function(_0x7b9712,_0x395415){return _0x7b9712[_0x15a2('0x7')](_0x15a2('0x8'),attributes,{'tableName':_0x15a2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x370e28,_0x4daf08,_0x261f09){if(_0x370e28[_0x15a2('0xa')](_0x15a2('0xb'))){_0x370e28[_0x15a2('0xc')]=moment()[_0x15a2('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x261f09(null,_0x370e28);}},'charset':_0x15a2('0xe'),'collate':_0x15a2('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 944d7e2..00faf0a 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 _0x78a9=['spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','UpdateChatInteraction','ChatInteraction','body','options','raw','where','attributes','limit','catch','AddTagsToChatInteraction','find','addTags','ids','omit'];(function(_0x9ec31f,_0x2ba206){var _0x93391f=function(_0x5f2d16){while(--_0x5f2d16){_0x9ec31f['push'](_0x9ec31f['shift']());}};_0x93391f(++_0x2ba206);}(_0x78a9,0xde));var _0x978a=function(_0x5c4d56,_0x3889f0){_0x5c4d56=_0x5c4d56-0x0;var _0x2b8e9f=_0x78a9[_0x5c4d56];return _0x2b8e9f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x978a('0x0'));var BPromise=require(_0x978a('0x1'));var rs=require(_0x978a('0x2'));var fs=require('fs');var Redis=require(_0x978a('0x3'));var db=require(_0x978a('0x4'))['db'];var utils=require(_0x978a('0x5'));var logger=require(_0x978a('0x6'))(_0x978a('0x7'));var config=require(_0x978a('0x8'));var jayson=require(_0x978a('0x9'));var client=jayson['client'][_0x978a('0xa')]({'port':0x232a});config[_0x978a('0xb')]=_[_0x978a('0xc')](config[_0x978a('0xb')],{'host':_0x978a('0xd'),'port':0x18eb});var socket=require(_0x978a('0xe'))(new Redis(config[_0x978a('0xb')]));require('./chatInteraction.socket')[_0x978a('0xf')](socket);function respondWithRpcPromise(_0x1dea76,_0x309e74,_0x121816){return new BPromise(function(_0x5d81e1,_0x59eb02){return client[_0x978a('0x10')](_0x1dea76,_0x121816)[_0x978a('0x11')](function(_0x528c01){logger[_0x978a('0x12')](_0x978a('0x13'),_0x309e74,'request\x20sent');logger[_0x978a('0x14')](_0x978a('0x15'),_0x309e74,'request\x20sent',JSON[_0x978a('0x16')](_0x528c01));if(_0x528c01[_0x978a('0x17')]){if(_0x528c01[_0x978a('0x17')][_0x978a('0x18')]===0x1f4){logger[_0x978a('0x17')](_0x978a('0x13'),_0x309e74,_0x528c01[_0x978a('0x17')][_0x978a('0x19')]);return _0x59eb02(_0x528c01[_0x978a('0x17')][_0x978a('0x19')]);}logger[_0x978a('0x17')](_0x978a('0x13'),_0x309e74,_0x528c01['error'][_0x978a('0x19')]);return _0x5d81e1(_0x528c01[_0x978a('0x17')]['message']);}else{logger['info'](_0x978a('0x13'),_0x309e74,_0x978a('0x1a'));_0x5d81e1(_0x528c01[_0x978a('0x1b')]['message']);}})['catch'](function(_0x34d404){logger[_0x978a('0x17')](_0x978a('0x13'),_0x309e74,_0x34d404);_0x59eb02(_0x34d404);});});}exports[_0x978a('0x1c')]=function(_0x5b20b2){var _0x1202ba=this;return new Promise(function(_0x2554cd,_0x38ca8b){return db[_0x978a('0x1d')]['update'](_0x5b20b2[_0x978a('0x1e')],{'raw':_0x5b20b2[_0x978a('0x1f')]?_0x5b20b2[_0x978a('0x1f')][_0x978a('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b20b2[_0x978a('0x1f')]?_0x5b20b2[_0x978a('0x1f')][_0x978a('0x21')]||null:null,'attributes':_0x5b20b2[_0x978a('0x1f')]?_0x5b20b2[_0x978a('0x1f')][_0x978a('0x22')]||null:null,'limit':_0x5b20b2[_0x978a('0x1f')]?_0x5b20b2[_0x978a('0x1f')][_0x978a('0x23')]||null:null})[_0x978a('0x11')](function(_0x3f3a36){logger[_0x978a('0x12')](_0x978a('0x1c'),_0x5b20b2);logger[_0x978a('0x14')](_0x978a('0x1c'),_0x5b20b2,JSON['stringify'](_0x3f3a36));_0x2554cd(_0x3f3a36);})[_0x978a('0x24')](function(_0x493e58){logger[_0x978a('0x17')](_0x978a('0x1c'),_0x493e58[_0x978a('0x19')],_0x5b20b2);_0x38ca8b(_0x1202ba[_0x978a('0x17')](0x1f4,_0x493e58['message']));});});};exports[_0x978a('0x25')]=function(_0x42c8e9){return new Promise(function(_0x511887,_0x3720d2){return db[_0x978a('0x1d')][_0x978a('0x26')]({'where':_0x42c8e9[_0x978a('0x1f')]?_0x42c8e9[_0x978a('0x1f')][_0x978a('0x21')]||null:null})[_0x978a('0x11')](function(_0x38b453){if(_0x38b453){return _0x38b453[_0x978a('0x27')](_0x42c8e9['body'][_0x978a('0x28')],_[_0x978a('0x29')](_0x42c8e9['body'],[_0x978a('0x28'),'id'])||{});}})[_0x978a('0x2a')](function(_0x20b0fc){logger[_0x978a('0x12')](_0x978a('0x2b'),_0x42c8e9);logger[_0x978a('0x14')](_0x978a('0x2b'),_0x42c8e9,JSON[_0x978a('0x16')](_0x20b0fc));_0x511887(_0x20b0fc);})['catch'](function(_0xa80b7f){logger[_0x978a('0x17')](_0x978a('0x2b'),_0xa80b7f['message'],_0x42c8e9);_0x3720d2(_this[_0x978a('0x17')](0x1f4,_0xa80b7f['message']));});});}; \ No newline at end of file +var _0xed6a=['../../config/logger','rpc','../../config/environment','client','http','defaults','redis','./chatInteraction.socket','register','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','where','attributes','limit','AddTagsToChatInteraction','addTags','ids','omit','spread','AddTags','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x526cfe,_0x3dcc88){var _0x59c246=function(_0x3116ca){while(--_0x3116ca){_0x526cfe['push'](_0x526cfe['shift']());}};_0x59c246(++_0x3dcc88);}(_0xed6a,0x173));var _0xaed6=function(_0xbe3f58,_0x37c5ba){_0xbe3f58=_0xbe3f58-0x0;var _0x867d69=_0xed6a[_0xbe3f58];return _0x867d69;};'use strict';var _=require(_0xaed6('0x0'));var util=require(_0xaed6('0x1'));var moment=require(_0xaed6('0x2'));var BPromise=require(_0xaed6('0x3'));var rs=require(_0xaed6('0x4'));var fs=require('fs');var Redis=require(_0xaed6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xaed6('0x6'));var logger=require(_0xaed6('0x7'))(_0xaed6('0x8'));var config=require(_0xaed6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaed6('0xa')][_0xaed6('0xb')]({'port':0x232a});config['redis']=_[_0xaed6('0xc')](config[_0xaed6('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xaed6('0xe'))[_0xaed6('0xf')](socket);function respondWithRpcPromise(_0x7c73e4,_0x4508da,_0x33948c){return new BPromise(function(_0x2dab47,_0x1d8e36){return client['request'](_0x7c73e4,_0x33948c)[_0xaed6('0x10')](function(_0x38a32f){logger['info'](_0xaed6('0x11'),_0x4508da,_0xaed6('0x12'));logger[_0xaed6('0x13')](_0xaed6('0x14'),_0x4508da,_0xaed6('0x12'),JSON['stringify'](_0x38a32f));if(_0x38a32f['error']){if(_0x38a32f[_0xaed6('0x15')][_0xaed6('0x16')]===0x1f4){logger[_0xaed6('0x15')](_0xaed6('0x11'),_0x4508da,_0x38a32f[_0xaed6('0x15')][_0xaed6('0x17')]);return _0x1d8e36(_0x38a32f['error'][_0xaed6('0x17')]);}logger[_0xaed6('0x15')](_0xaed6('0x11'),_0x4508da,_0x38a32f['error']['message']);return _0x2dab47(_0x38a32f[_0xaed6('0x15')][_0xaed6('0x17')]);}else{logger[_0xaed6('0x18')](_0xaed6('0x11'),_0x4508da,_0xaed6('0x12'));_0x2dab47(_0x38a32f[_0xaed6('0x19')]['message']);}})[_0xaed6('0x1a')](function(_0x502192){logger[_0xaed6('0x15')](_0xaed6('0x11'),_0x4508da,_0x502192);_0x1d8e36(_0x502192);});});}exports[_0xaed6('0x1b')]=function(_0x102a34){var _0x31957b=this;return new Promise(function(_0x1b6c36,_0x43cde5){return db[_0xaed6('0x1c')][_0xaed6('0x1d')](_0x102a34[_0xaed6('0x1e')],{'raw':_0x102a34[_0xaed6('0x1f')]?_0x102a34['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x102a34[_0xaed6('0x1f')]?_0x102a34[_0xaed6('0x1f')][_0xaed6('0x20')]||null:null,'attributes':_0x102a34[_0xaed6('0x1f')]?_0x102a34['options'][_0xaed6('0x21')]||null:null,'limit':_0x102a34['options']?_0x102a34[_0xaed6('0x1f')][_0xaed6('0x22')]||null:null})[_0xaed6('0x10')](function(_0x28f7d9){logger['info'](_0xaed6('0x1b'),_0x102a34);logger[_0xaed6('0x13')](_0xaed6('0x1b'),_0x102a34,JSON['stringify'](_0x28f7d9));_0x1b6c36(_0x28f7d9);})[_0xaed6('0x1a')](function(_0x20eee6){logger[_0xaed6('0x15')]('UpdateChatInteraction',_0x20eee6[_0xaed6('0x17')],_0x102a34);_0x43cde5(_0x31957b['error'](0x1f4,_0x20eee6[_0xaed6('0x17')]));});});};exports[_0xaed6('0x23')]=function(_0x2f70d1){return new Promise(function(_0xbee57b,_0x13b192){return db['ChatInteraction']['find']({'where':_0x2f70d1[_0xaed6('0x1f')]?_0x2f70d1[_0xaed6('0x1f')][_0xaed6('0x20')]||null:null})[_0xaed6('0x10')](function(_0xd8a760){if(_0xd8a760){return _0xd8a760[_0xaed6('0x24')](_0x2f70d1[_0xaed6('0x1e')][_0xaed6('0x25')],_[_0xaed6('0x26')](_0x2f70d1[_0xaed6('0x1e')],[_0xaed6('0x25'),'id'])||{});}})[_0xaed6('0x27')](function(_0x2fe0cb){logger[_0xaed6('0x18')](_0xaed6('0x28'),_0x2f70d1);logger[_0xaed6('0x13')](_0xaed6('0x28'),_0x2f70d1,JSON[_0xaed6('0x29')](_0x2fe0cb));_0xbee57b(_0x2fe0cb);})[_0xaed6('0x1a')](function(_0x54da16){logger['error'](_0xaed6('0x28'),_0x54da16[_0xaed6('0x17')],_0x2f70d1);_0x13b192(_this[_0xaed6('0x15')](0x1f4,_0x54da16[_0xaed6('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index a1043f9..5f73ea6 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 _0xc924=['register','chatInteraction:','./chatInteraction.events','save','update','emit','removeListener'];(function(_0x2a1d1d,_0x5cb96c){var _0x32f0b9=function(_0x2bdcea){while(--_0x2bdcea){_0x2a1d1d['push'](_0x2a1d1d['shift']());}};_0x32f0b9(++_0x5cb96c);}(_0xc924,0x1f3));var _0x4c92=function(_0x22c0cd,_0x3650e6){_0x22c0cd=_0x22c0cd-0x0;var _0x4d0b1f=_0xc924[_0x22c0cd];return _0x4d0b1f;};'use strict';var ChatInteractionEvents=require(_0x4c92('0x0'));var events=[_0x4c92('0x1'),'remove',_0x4c92('0x2')];function createListener(_0x4b3463,_0x507a18){return function(_0x48b11a){_0x507a18[_0x4c92('0x3')](_0x4b3463,_0x48b11a);};}function removeListener(_0x11a6c3,_0x23a479){return function(){ChatInteractionEvents[_0x4c92('0x4')](_0x11a6c3,_0x23a479);};}exports[_0x4c92('0x5')]=function(_0x564126){for(var _0x39f0ed=0x0,_0x3ef58f=events['length'];_0x39f0ed<_0x3ef58f;_0x39f0ed++){var _0x2d33ad=events[_0x39f0ed];var _0x1c9163=createListener(_0x4c92('0x6')+_0x2d33ad,_0x564126);ChatInteractionEvents['on'](_0x2d33ad,_0x1c9163);}}; \ No newline at end of file +var _0x3fad=['update','emit','removeListener','register','length','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x51ec61,_0xf9d1e3){var _0x223200=function(_0x3bd510){while(--_0x3bd510){_0x51ec61['push'](_0x51ec61['shift']());}};_0x223200(++_0xf9d1e3);}(_0x3fad,0x16e));var _0xd3fa=function(_0x3d4a8b,_0x5be165){_0x3d4a8b=_0x3d4a8b-0x0;var _0x248556=_0x3fad[_0x3d4a8b];return _0x248556;};'use strict';var ChatInteractionEvents=require(_0xd3fa('0x0'));var events=[_0xd3fa('0x1'),_0xd3fa('0x2'),_0xd3fa('0x3')];function createListener(_0x3e024d,_0x997ad3){return function(_0x1aa756){_0x997ad3[_0xd3fa('0x4')](_0x3e024d,_0x1aa756);};}function removeListener(_0x2ed48f,_0x406ebb){return function(){ChatInteractionEvents[_0xd3fa('0x5')](_0x2ed48f,_0x406ebb);};}exports[_0xd3fa('0x6')]=function(_0x3674ba){for(var _0x14cac4=0x0,_0x50a2b5=events[_0xd3fa('0x7')];_0x14cac4<_0x50a2b5;_0x14cac4++){var _0x1803e7=events[_0x14cac4];var _0x435ab3=createListener(_0xd3fa('0x8')+_0x1803e7,_0x3674ba);ChatInteractionEvents['on'](_0x1803e7,_0x435ab3);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 4c7964a..bddcad1 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 _0x5cf3=['getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','diskStorage','join','root','server/files/attachments/','%s-%s','now','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages'];(function(_0x3caeb5,_0x219363){var _0x5eca7e=function(_0x4cae6b){while(--_0x4cae6b){_0x3caeb5['push'](_0x3caeb5['shift']());}};_0x5eca7e(++_0x219363);}(_0x5cf3,0x92));var _0x35cf=function(_0x4dc4bd,_0x490bf0){_0x4dc4bd=_0x4dc4bd-0x0;var _0x22a362=_0x5cf3[_0x4dc4bd];return _0x22a362;};'use strict';var multer=require(_0x35cf('0x0'));var util=require(_0x35cf('0x1'));var path=require(_0x35cf('0x2'));var timeout=require(_0x35cf('0x3'));var express=require(_0x35cf('0x4'));var router=express[_0x35cf('0x5')]();var auth=require(_0x35cf('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35cf('0x7'));var controller=require(_0x35cf('0x8'));router[_0x35cf('0x9')]('/',auth[_0x35cf('0xa')](),controller[_0x35cf('0xb')]);router['get'](_0x35cf('0xc'),auth[_0x35cf('0xa')](),controller['describe']);router[_0x35cf('0x9')](_0x35cf('0xd'),auth[_0x35cf('0xe')](),controller[_0x35cf('0xf')]);router['get'](_0x35cf('0x10'),auth[_0x35cf('0xe')](),controller[_0x35cf('0x11')]);router[_0x35cf('0x9')](_0x35cf('0x12'),auth[_0x35cf('0xa')](),controller[_0x35cf('0x13')]);router[_0x35cf('0x9')](_0x35cf('0x14'),auth[_0x35cf('0xe')](),controller[_0x35cf('0x15')]);router[_0x35cf('0x9')](_0x35cf('0x16'),auth['isAuthenticated'](),controller[_0x35cf('0x17')]);router[_0x35cf('0x18')]('/',auth[_0x35cf('0xa')](),controller[_0x35cf('0x19')]);router['post'](_0x35cf('0x1a'),auth[_0x35cf('0xa')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x35cf('0x1b')]({'destination':function(_0x716f00,_0x1b064c,_0x2b4cf2){_0x2b4cf2(null,path[_0x35cf('0x1c')](config[_0x35cf('0x1d')],_0x35cf('0x1e')));},'filename':function(_0x479c09,_0x3004b8,_0x608cb2){_0x608cb2(null,util['format'](_0x35cf('0x1f'),Date[_0x35cf('0x20')](),_0x3004b8['originalname'][_0x35cf('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x35cf('0x18')](_0x35cf('0x22'),upload[_0x35cf('0x23')](_0x35cf('0x24')),controller[_0x35cf('0x25')]);router[_0x35cf('0x18')](_0x35cf('0x12'),auth[_0x35cf('0xe')](),controller['addMessage']);router[_0x35cf('0x18')](_0x35cf('0x26'),auth['isAuthenticated'](),interaction[_0x35cf('0x27')](_0x35cf('0x28'),_0x35cf('0x29')),controller[_0x35cf('0x2a')]);router[_0x35cf('0x2b')](_0x35cf('0xd'),auth[_0x35cf('0xa')](),interaction[_0x35cf('0x27')](_0x35cf('0x28'),'chatinteraction:update'),controller[_0x35cf('0x2c')]);router[_0x35cf('0x2b')](_0x35cf('0x2d'),controller[_0x35cf('0x2e')]);router[_0x35cf('0x2b')](_0x35cf('0x2f'),auth['isChatInteractionAuthorized'](),controller[_0x35cf('0x30')]);router['put'](_0x35cf('0x31'),controller[_0x35cf('0x32')]);router[_0x35cf('0x33')](_0x35cf('0xd'),auth[_0x35cf('0xa')](),interaction[_0x35cf('0x27')](_0x35cf('0x28'),_0x35cf('0x34')),controller[_0x35cf('0x35')]);router[_0x35cf('0x33')](_0x35cf('0x26'),auth[_0x35cf('0xa')](),controller['removeTags']);module[_0x35cf('0x36')]=router; \ No newline at end of file +var _0x1556=['/:id/abandon','abandon','close','delete','tracked','chatinteraction:destroy','destroy','/:id/tags','removeTags','multer','path','express','Router','../../components/interaction/service','./chatInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','replace','/:id/attachment_upload','single','file','attachmentUpload','chatinteraction:addtags','addTags','put','chat','chatinteraction:update','update','/:id/custom_update','customUpdate'];(function(_0x20ac3c,_0x3a2085){var _0x451abc=function(_0x1f17e3){while(--_0x1f17e3){_0x20ac3c['push'](_0x20ac3c['shift']());}};_0x451abc(++_0x3a2085);}(_0x1556,0x71));var _0x6155=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x1556[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0x6155('0x0'));var util=require('util');var path=require(_0x6155('0x1'));var timeout=require('connect-timeout');var express=require(_0x6155('0x2'));var router=express[_0x6155('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x6155('0x4'));var config=require('../../config/environment');var controller=require(_0x6155('0x5'));router['get']('/',auth[_0x6155('0x6')](),controller['index']);router[_0x6155('0x7')](_0x6155('0x8'),auth[_0x6155('0x6')](),controller[_0x6155('0x9')]);router[_0x6155('0x7')](_0x6155('0xa'),auth['isChatInteractionAuthorized'](),controller[_0x6155('0xb')]);router[_0x6155('0x7')](_0x6155('0xc'),auth[_0x6155('0xd')](),controller['attachmentDownload']);router['get'](_0x6155('0xe'),auth[_0x6155('0x6')](),controller[_0x6155('0xf')]);router[_0x6155('0x7')](_0x6155('0x10'),auth['isChatInteractionAuthorized'](),controller[_0x6155('0x11')]);router['get'](_0x6155('0x12'),auth[_0x6155('0x6')](),controller['download']);router[_0x6155('0x13')]('/',auth[_0x6155('0x6')](),controller[_0x6155('0x14')]);router['post'](_0x6155('0x15'),auth[_0x6155('0x6')](),controller[_0x6155('0x16')]);var upload=multer({'storage':multer[_0x6155('0x17')]({'destination':function(_0x57ad49,_0x2cd24a,_0xc73704){_0xc73704(null,path[_0x6155('0x18')](config[_0x6155('0x19')],_0x6155('0x1a')));},'filename':function(_0x2e2bb5,_0x100f61,_0x1d253c){_0x1d253c(null,util[_0x6155('0x1b')](_0x6155('0x1c'),Date[_0x6155('0x1d')](),_0x100f61['originalname'][_0x6155('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x6155('0x13')](_0x6155('0x1f'),upload[_0x6155('0x20')](_0x6155('0x21')),controller[_0x6155('0x22')]);router['post'](_0x6155('0xe'),auth['isChatInteractionAuthorized'](),controller['addMessage']);router[_0x6155('0x13')]('/:id/tags',auth[_0x6155('0x6')](),interaction['tracked']('chat',_0x6155('0x23')),controller[_0x6155('0x24')]);router[_0x6155('0x25')](_0x6155('0xa'),auth[_0x6155('0x6')](),interaction['tracked'](_0x6155('0x26'),_0x6155('0x27')),controller[_0x6155('0x28')]);router[_0x6155('0x25')](_0x6155('0x29'),controller[_0x6155('0x2a')]);router[_0x6155('0x25')](_0x6155('0x2b'),auth[_0x6155('0xd')](),controller[_0x6155('0x2c')]);router['put']('/:id/close',controller[_0x6155('0x2d')]);router[_0x6155('0x2e')](_0x6155('0xa'),auth[_0x6155('0x6')](),interaction[_0x6155('0x2f')]('chat',_0x6155('0x30')),controller[_0x6155('0x31')]);router['delete'](_0x6155('0x32'),auth[_0x6155('0x6')](),controller[_0x6155('0x33')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index efa73db..b08f102 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.attributes.js +++ b/server/api/chatInternalMessage/chatInternalMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['medium','INTEGER','sequelize','exports','TEXT'];(function(_0x40280e,_0x4df3d5){var _0x4aa46c=function(_0x86ccd0){while(--_0x86ccd0){_0x40280e['push'](_0x40280e['shift']());}};_0x4aa46c(++_0x4df3d5);}(_0xdb28,0x106));var _0x8db2=function(_0x1ec8c2,_0x3f2622){_0x1ec8c2=_0x1ec8c2-0x0;var _0x5a15f8=_0xdb28[_0x1ec8c2];return _0x5a15f8;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x8db2('0x4')]}}; \ No newline at end of file +var _0xadb5=['INTEGER','exports','medium','BOOLEAN'];(function(_0x12382a,_0x2c6a00){var _0x4de1a9=function(_0x439fe6){while(--_0x439fe6){_0x12382a['push'](_0x12382a['shift']());}};_0x4de1a9(++_0x2c6a00);}(_0xadb5,0xad));var _0x5adb=function(_0x4309c5,_0x21855e){_0x4309c5=_0x4309c5-0x0;var _0x4b7777=_0xadb5[_0x4309c5];return _0x4b7777;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x5adb('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 4207abd..3fd42bd 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 _0x5874=['body','describe','get','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','User','findAll','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','isEmpty','resourceId','push','createdAt','FromId','read','-createdAt','all','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','localhost','./chatInternalMessage.socket','register','status','json','offset','limit','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatInternalMessage','count','include','rows','catch','show','params','rawAttributes','includeAll','find','then','create'];(function(_0x506172,_0xbc3a3){var _0x2723c0=function(_0x57c3d9){while(--_0x57c3d9){_0x506172['push'](_0x506172['shift']());}};_0x2723c0(++_0xbc3a3);}(_0x5874,0x92));var _0x4587=function(_0x50bab4,_0x3e670f){_0x50bab4=_0x50bab4-0x0;var _0x4cc7f9=_0x5874[_0x50bab4];return _0x4cc7f9;};'use strict';var pdf=require(_0x4587('0x0'));var emlformat=require(_0x4587('0x1'));var rimraf=require(_0x4587('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4587('0x3'));var rp=require(_0x4587('0x4'));var moment=require(_0x4587('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4587('0x6'));var util=require(_0x4587('0x7'));var path=require(_0x4587('0x8'));var sox=require(_0x4587('0x9'));var csv=require(_0x4587('0xa'));var ejs=require(_0x4587('0xb'));var fs=require('fs');var _=require(_0x4587('0xc'));var squel=require(_0x4587('0xd'));var crypto=require(_0x4587('0xe'));var jsforce=require(_0x4587('0xf'));var deskjs=require(_0x4587('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4587('0x11'));var authService=require(_0x4587('0x12'));var qs=require(_0x4587('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4587('0x14'));var logger=require(_0x4587('0x15'))(_0x4587('0x16'));var utils=require('../../config/utils');var config=require(_0x4587('0x17'));var licenseUtil=require(_0x4587('0x18'));var db=require(_0x4587('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x4587('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4587('0x1b'))[_0x4587('0x1c')](socket);function respondWithStatusCode(_0x309b60,_0x182a5d){_0x182a5d=_0x182a5d||0xcc;return function(_0x291115){if(_0x291115){return _0x309b60['sendStatus'](_0x182a5d);}return _0x309b60[_0x4587('0x1d')](_0x182a5d)['end']();};}function respondWithResult(_0x4fb083,_0x4aa7e0){_0x4aa7e0=_0x4aa7e0||0xc8;return function(_0x175e9b){if(_0x175e9b){return _0x4fb083['status'](_0x4aa7e0)[_0x4587('0x1e')](_0x175e9b);}};}function respondWithFilteredResult(_0x47a80b,_0x11a75f){return function(_0x2e13d1){if(_0x2e13d1){var _0x4361cc=_0x2e13d1['count'],_0x42248a=_0x11a75f['offset'],_0x44e7c2=_0x11a75f[_0x4587('0x1f')]+_0x11a75f[_0x4587('0x20')],_0x201ae6;if(_0x44e7c2>=_0x4361cc){_0x44e7c2=_0x4361cc;_0x201ae6=0xc8;}else{_0x201ae6=0xce;}_0x47a80b['status'](_0x201ae6);return _0x47a80b['set'](_0x4587('0x21'),_0x42248a+'-'+_0x44e7c2+'/'+_0x4361cc)[_0x4587('0x1e')](_0x2e13d1);}return null;};}function patchUpdates(_0xb02809){return function(_0x52689b){try{jsonpatch[_0x4587('0x22')](_0x52689b,_0xb02809,!![]);}catch(_0x36ec39){return BPromise[_0x4587('0x23')](_0x36ec39);}return _0x52689b['save']();};}function saveUpdates(_0x430d24,_0x16a89e){return function(_0x46e5f4){if(_0x46e5f4){return _0x46e5f4[_0x4587('0x24')](_0x430d24)['then'](function(_0x394fa9){return _0x394fa9;});}return null;};}function removeEntity(_0xd92c49,_0x2d8376){return function(_0x2236b3){if(_0x2236b3){return _0x2236b3[_0x4587('0x25')]()['then'](function(){_0xd92c49[_0x4587('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5658c0,_0x2353eb){return function(_0x48dc16){if(!_0x48dc16){_0x5658c0[_0x4587('0x26')](0x194);}return _0x48dc16;};}function handleError(_0x398870,_0x44fd4d){_0x44fd4d=_0x44fd4d||0x1f4;return function(_0x477a9b){logger['error'](_0x477a9b[_0x4587('0x27')]);if(_0x477a9b[_0x4587('0x28')]){delete _0x477a9b['name'];}_0x398870['status'](_0x44fd4d)[_0x4587('0x29')](_0x477a9b);};}exports[_0x4587('0x2a')]=function(_0x1f0ebb,_0x552878){var _0x4e6d6e={},_0x41fafa={},_0x111d65={'count':0x0,'rows':[]};var _0x3598a8=_[_0x4587('0x2b')](db['ChatInternalMessage']['rawAttributes'],function(_0x147c0a){return{'name':_0x147c0a['fieldName'],'type':_0x147c0a[_0x4587('0x2c')][_0x4587('0x2d')]};});_0x41fafa[_0x4587('0x2e')]=_[_0x4587('0x2b')](_0x3598a8,'name');_0x41fafa[_0x4587('0x2f')]=_[_0x4587('0x30')](_0x1f0ebb[_0x4587('0x2f')]);_0x41fafa[_0x4587('0x31')]=_[_0x4587('0x32')](_0x41fafa[_0x4587('0x2e')],_0x41fafa[_0x4587('0x2f')]);_0x4e6d6e[_0x4587('0x33')]=_[_0x4587('0x32')](_0x41fafa[_0x4587('0x2e')],qs['fields'](_0x1f0ebb[_0x4587('0x2f')][_0x4587('0x34')]));_0x4e6d6e[_0x4587('0x33')]=_0x4e6d6e['attributes'][_0x4587('0x35')]?_0x4e6d6e[_0x4587('0x33')]:_0x41fafa[_0x4587('0x2e')];if(!_0x1f0ebb[_0x4587('0x2f')][_0x4587('0x36')](_0x4587('0x37'))){_0x4e6d6e['limit']=qs[_0x4587('0x20')](_0x1f0ebb['query'][_0x4587('0x20')]);_0x4e6d6e[_0x4587('0x1f')]=qs['offset'](_0x1f0ebb['query'][_0x4587('0x1f')]);}_0x4e6d6e[_0x4587('0x38')]=qs[_0x4587('0x39')](_0x1f0ebb[_0x4587('0x2f')][_0x4587('0x39')]);_0x4e6d6e[_0x4587('0x3a')]=qs[_0x4587('0x31')](_[_0x4587('0x3b')](_0x1f0ebb[_0x4587('0x2f')],_0x41fafa[_0x4587('0x31')]),_0x3598a8);if(_0x1f0ebb[_0x4587('0x2f')][_0x4587('0x3c')]){_0x4e6d6e[_0x4587('0x3a')]=_[_0x4587('0x3d')](_0x4e6d6e['where'],{'$or':_[_0x4587('0x2b')](_0x3598a8,function(_0x482669){if(_0x482669[_0x4587('0x2c')]!==_0x4587('0x3e')){var _0x5bc327={};_0x5bc327[_0x482669[_0x4587('0x28')]]={'$like':'%'+_0x1f0ebb[_0x4587('0x2f')][_0x4587('0x3c')]+'%'};return _0x5bc327;}})});}_0x4e6d6e=_[_0x4587('0x3d')]({},_0x4e6d6e,_0x1f0ebb[_0x4587('0x3f')]);var _0x2711e4={'where':_0x4e6d6e[_0x4587('0x3a')]};return db[_0x4587('0x40')][_0x4587('0x41')](_0x2711e4)['then'](function(_0x5d703b){_0x111d65[_0x4587('0x41')]=_0x5d703b;if(_0x1f0ebb[_0x4587('0x2f')]['includeAll']){_0x4e6d6e[_0x4587('0x42')]=[{'all':!![]}];}return db['ChatInternalMessage']['findAll'](_0x4e6d6e);})['then'](function(_0x234fb9){_0x111d65[_0x4587('0x43')]=_0x234fb9;return _0x111d65;})['then'](respondWithFilteredResult(_0x552878,_0x4e6d6e))[_0x4587('0x44')](handleError(_0x552878,null));};exports[_0x4587('0x45')]=function(_0x359d08,_0x47b281){var _0x2ef821={'raw':!![],'where':{'id':_0x359d08[_0x4587('0x46')]['id']}},_0x145f34={};_0x145f34['model']=_[_0x4587('0x30')](db['ChatInternalMessage'][_0x4587('0x47')]);_0x145f34[_0x4587('0x2f')]=_[_0x4587('0x30')](_0x359d08[_0x4587('0x2f')]);_0x145f34['filters']=_['intersection'](_0x145f34[_0x4587('0x2e')],_0x145f34[_0x4587('0x2f')]);_0x2ef821['attributes']=_[_0x4587('0x32')](_0x145f34[_0x4587('0x2e')],qs[_0x4587('0x34')](_0x359d08[_0x4587('0x2f')][_0x4587('0x34')]));_0x2ef821['attributes']=_0x2ef821[_0x4587('0x33')]['length']?_0x2ef821[_0x4587('0x33')]:_0x145f34[_0x4587('0x2e')];if(_0x359d08[_0x4587('0x2f')][_0x4587('0x48')]){_0x2ef821[_0x4587('0x42')]=[{'all':!![]}];}_0x2ef821=_[_0x4587('0x3d')]({},_0x2ef821,_0x359d08['options']);return db[_0x4587('0x40')][_0x4587('0x49')](_0x2ef821)[_0x4587('0x4a')](handleEntityNotFound(_0x47b281,null))['then'](respondWithResult(_0x47b281,null))[_0x4587('0x44')](handleError(_0x47b281,null));};exports[_0x4587('0x4b')]=function(_0x426c1a,_0x29a710){return db[_0x4587('0x40')][_0x4587('0x4b')](_0x426c1a['body'],{})['then'](respondWithResult(_0x29a710,0xc9))[_0x4587('0x44')](handleError(_0x29a710,null));};exports[_0x4587('0x24')]=function(_0x35a1f9,_0x369f8c){if(_0x35a1f9[_0x4587('0x4c')]['id']){delete _0x35a1f9['body']['id'];}return db[_0x4587('0x40')][_0x4587('0x49')]({'where':{'id':_0x35a1f9[_0x4587('0x46')]['id']}})['then'](handleEntityNotFound(_0x369f8c,null))[_0x4587('0x4a')](saveUpdates(_0x35a1f9[_0x4587('0x4c')],null))[_0x4587('0x4a')](respondWithResult(_0x369f8c,null))[_0x4587('0x44')](handleError(_0x369f8c,null));};exports[_0x4587('0x25')]=function(_0x1cb9f5,_0x5aa8c8){return db[_0x4587('0x40')]['find']({'where':{'id':_0x1cb9f5[_0x4587('0x46')]['id']}})['then'](handleEntityNotFound(_0x5aa8c8,null))[_0x4587('0x4a')](removeEntity(_0x5aa8c8,null))[_0x4587('0x44')](handleError(_0x5aa8c8,null));};exports[_0x4587('0x4d')]=function(_0x2d74b1,_0x3d11ac){return db[_0x4587('0x40')][_0x4587('0x4d')]()['then'](respondWithResult(_0x3d11ac,null))['catch'](handleError(_0x3d11ac,null));};function wrapUser(_0x15d3a0){return function(_0x32155b){var _0x3831c8=_0x15d3a0[_0x4587('0x4e')]({'plain':!![]});_0x3831c8[_0x4587('0x4f')]=[];if(_0x32155b){_0x3831c8[_0x4587('0x50')]=_0x32155b['createdAt'];_0x3831c8[_0x4587('0x51')]=_0x32155b;}else{_0x3831c8[_0x4587('0x50')]=moment(0x0)[_0x4587('0x52')](_0x4587('0x53'));_0x3831c8[_0x4587('0x51')]={};}return _0x3831c8;};}exports['getUsers']=function(_0x58c4d1,_0x425ede,_0x588e05){var _0x1ccd0d=[];return db[_0x4587('0x54')][_0x4587('0x55')]({'where':{'role':[_0x4587('0x56'),_0x4587('0x57'),_0x4587('0x58')]},'attributes':['id',_0x4587('0x59'),_0x4587('0x28'),_0x4587('0x5a'),_0x4587('0x5b'),_0x4587('0x5c'),_0x4587('0x5d'),_0x4587('0x5e'),_0x4587('0x5f'),_0x4587('0x60')],'order':qs[_0x4587('0x39')]('-online'),'include':[{'model':db[_0x4587('0x61')],'as':_0x4587('0x62'),'attributes':['id',_0x4587('0x28'),'type'],'through':{'attributes':[]}}]})[_0x4587('0x4a')](function(_0x2a3ab9){if(_0x2a3ab9){var _0x5b1326=_0x58c4d1[_0x4587('0x58')]['get']({'plain':!![]});if(!_0x5b1326)throw new Error(_0x4587('0x63'));if(_0x5b1326[_0x4587('0x5a')]===_0x4587('0x58')){return db[_0x4587('0x64')][_0x4587('0x49')]({'where':{'name':'Agents','userProfileId':_0x5b1326['userProfileId']},'raw':!![]})['then'](function(_0x128bfe){if(_0x128bfe){if(_0x128bfe[_0x4587('0x65')]===0x0){return db[_0x4587('0x66')][_0x4587('0x55')]({'where':{'sectionId':_0x128bfe['id']},'raw':!![]})[_0x4587('0x4a')](function(_0x2bf856){var _0x16cb47=[];if(_[_0x4587('0x67')](_0x2bf856)){_0x16cb47=_['filter'](_0x2a3ab9,function(_0x2cb438){if(_0x2cb438[_0x4587('0x5a')]!==_0x4587('0x56')){return _0x2cb438;}});return _0x16cb47;}else{for(var _0x1262a0=0x0;_0x1262a0<_0x2a3ab9[_0x4587('0x35')];_0x1262a0++){var _0x1da3dd=_0x2a3ab9[_0x1262a0];if(_0x1da3dd[_0x4587('0x5a')]===_0x4587('0x56')){var _0x27c581=_[_0x4587('0x49')](_0x2bf856,function(_0x1c929c){return _0x1c929c[_0x4587('0x68')]===_0x1da3dd['id'];});if(_0x27c581)_0x16cb47[_0x4587('0x69')](_0x1da3dd);}else{_0x16cb47[_0x4587('0x69')](_0x1da3dd);}}return _0x16cb47;}});}else{return _0x2a3ab9;}}else{var _0x2c326a=_[_0x4587('0x3c')](_0x2a3ab9,function(_0x1c4c0e){if(_0x1c4c0e[_0x4587('0x5a')]!==_0x4587('0x56')){return _0x1c4c0e;}});return _0x2c326a;}});}else{return _0x2a3ab9;}}})['then'](function(_0x45ebc7){var _0x1c3a1f=[];if(_0x45ebc7){_0x1ccd0d=_0x45ebc7;for(var _0x5a5026=0x0;_0x5a5026<_0x45ebc7[_0x4587('0x35')];_0x5a5026+=0x1){_0x1ccd0d[_0x5a5026][_0x4587('0x4f')]=[];_0x1c3a1f[_0x4587('0x69')](db[_0x4587('0x40')][_0x4587('0x49')]({'where':{'FromId':[_0x58c4d1[_0x4587('0x58')]['id'],_0x45ebc7[_0x5a5026]['id']],'ToId':[_0x58c4d1['user']['id'],_0x45ebc7[_0x5a5026]['id']],'ChatGroupId':null},'attributes':['id',_0x4587('0x6a'),_0x4587('0x6b'),'ToId',_0x4587('0x6c'),'body'],'order':qs[_0x4587('0x39')](_0x4587('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x4587('0x4a')](wrapUser(_0x45ebc7[_0x5a5026])));}return BPromise[_0x4587('0x6e')](_0x1c3a1f);}return[];})[_0x4587('0x4a')](function(_0x1e5c40){return{'rows':_0x1e5c40,'count':_0x1e5c40[_0x4587('0x35')]};})[_0x4587('0x4a')](respondWithResult(_0x425ede,null))[_0x4587('0x44')](handleError(_0x425ede,null));}; \ No newline at end of file +var _0xaea9=['ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','ChatInternalMessage','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','body','find','describe','get','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','userpic','internal','online','lastLoginAt','allowmessenger','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Agents','autoAssociation','UserProfileResource','isEmpty','length','resourceId','push','messages','FromId','ToId','read','all','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x4798ab,_0x46d4eb){var _0xf2ca70=function(_0x30cac7){while(--_0x30cac7){_0x4798ab['push'](_0x4798ab['shift']());}};_0xf2ca70(++_0x46d4eb);}(_0xaea9,0xda));var _0x9aea=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xaea9[_0x411add];return _0x238242;};'use strict';var pdf=require(_0x9aea('0x0'));var emlformat=require(_0x9aea('0x1'));var rimraf=require(_0x9aea('0x2'));var zipdir=require(_0x9aea('0x3'));var jsonpatch=require(_0x9aea('0x4'));var rp=require(_0x9aea('0x5'));var moment=require(_0x9aea('0x6'));var BPromise=require(_0x9aea('0x7'));var Mustache=require(_0x9aea('0x8'));var util=require(_0x9aea('0x9'));var path=require(_0x9aea('0xa'));var sox=require('sox');var csv=require(_0x9aea('0xb'));var ejs=require(_0x9aea('0xc'));var fs=require('fs');var _=require(_0x9aea('0xd'));var squel=require('squel');var crypto=require(_0x9aea('0xe'));var jsforce=require(_0x9aea('0xf'));var deskjs=require(_0x9aea('0x10'));var toCsv=require(_0x9aea('0xb'));var querystring=require(_0x9aea('0x11'));var Papa=require(_0x9aea('0x12'));var Redis=require(_0x9aea('0x13'));var authService=require(_0x9aea('0x14'));var qs=require(_0x9aea('0x15'));var as=require(_0x9aea('0x16'));var hardwareService=require(_0x9aea('0x17'));var logger=require(_0x9aea('0x18'))('api');var utils=require(_0x9aea('0x19'));var config=require(_0x9aea('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x9aea('0x1b'))['db'];config[_0x9aea('0x1c')]=_[_0x9aea('0x1d')](config[_0x9aea('0x1c')],{'host':_0x9aea('0x1e'),'port':0x18eb});var socket=require(_0x9aea('0x1f'))(new Redis(config[_0x9aea('0x1c')]));require(_0x9aea('0x20'))['register'](socket);function respondWithStatusCode(_0xd3485d,_0x4d1ef6){_0x4d1ef6=_0x4d1ef6||0xcc;return function(_0x4970c4){if(_0x4970c4){return _0xd3485d['sendStatus'](_0x4d1ef6);}return _0xd3485d[_0x9aea('0x21')](_0x4d1ef6)[_0x9aea('0x22')]();};}function respondWithResult(_0x484ea3,_0x36cf51){_0x36cf51=_0x36cf51||0xc8;return function(_0x116db4){if(_0x116db4){return _0x484ea3[_0x9aea('0x21')](_0x36cf51)[_0x9aea('0x23')](_0x116db4);}};}function respondWithFilteredResult(_0x9a8eb9,_0x4a5c2f){return function(_0x5cae15){if(_0x5cae15){var _0x3fa1ff=_0x5cae15[_0x9aea('0x24')],_0x40d97f=_0x4a5c2f[_0x9aea('0x25')],_0x16f992=_0x4a5c2f[_0x9aea('0x25')]+_0x4a5c2f[_0x9aea('0x26')],_0x357da5;if(_0x16f992>=_0x3fa1ff){_0x16f992=_0x3fa1ff;_0x357da5=0xc8;}else{_0x357da5=0xce;}_0x9a8eb9[_0x9aea('0x21')](_0x357da5);return _0x9a8eb9[_0x9aea('0x27')](_0x9aea('0x28'),_0x40d97f+'-'+_0x16f992+'/'+_0x3fa1ff)['json'](_0x5cae15);}return null;};}function patchUpdates(_0x39c9f4){return function(_0x3d4293){try{jsonpatch[_0x9aea('0x29')](_0x3d4293,_0x39c9f4,!![]);}catch(_0x3f1dd9){return BPromise[_0x9aea('0x2a')](_0x3f1dd9);}return _0x3d4293[_0x9aea('0x2b')]();};}function saveUpdates(_0x2fd631,_0x1acb7b){return function(_0x451317){if(_0x451317){return _0x451317[_0x9aea('0x2c')](_0x2fd631)[_0x9aea('0x2d')](function(_0x5a47d0){return _0x5a47d0;});}return null;};}function removeEntity(_0x41be6a,_0x599787){return function(_0xaafbf){if(_0xaafbf){return _0xaafbf[_0x9aea('0x2e')]()['then'](function(){_0x41be6a[_0x9aea('0x21')](0xcc)[_0x9aea('0x22')]();});}};}function handleEntityNotFound(_0x2c7ebe,_0x4f0cd4){return function(_0x4c102e){if(!_0x4c102e){_0x2c7ebe[_0x9aea('0x2f')](0x194);}return _0x4c102e;};}function handleError(_0x72d1ef,_0x42323a){_0x42323a=_0x42323a||0x1f4;return function(_0x35cec4){logger[_0x9aea('0x30')](_0x35cec4[_0x9aea('0x31')]);if(_0x35cec4[_0x9aea('0x32')]){delete _0x35cec4[_0x9aea('0x32')];}_0x72d1ef[_0x9aea('0x21')](_0x42323a)[_0x9aea('0x33')](_0x35cec4);};}exports['index']=function(_0x11311b,_0x5464ac){var _0x2852b5={},_0xc9428f={},_0x41d537={'count':0x0,'rows':[]};var _0x5f542b=_[_0x9aea('0x34')](db[_0x9aea('0x35')]['rawAttributes'],function(_0x2e7279){return{'name':_0x2e7279[_0x9aea('0x36')],'type':_0x2e7279[_0x9aea('0x37')][_0x9aea('0x38')]};});_0xc9428f[_0x9aea('0x39')]=_['map'](_0x5f542b,_0x9aea('0x32'));_0xc9428f['query']=_[_0x9aea('0x3a')](_0x11311b[_0x9aea('0x3b')]);_0xc9428f[_0x9aea('0x3c')]=_[_0x9aea('0x3d')](_0xc9428f[_0x9aea('0x39')],_0xc9428f['query']);_0x2852b5[_0x9aea('0x3e')]=_['intersection'](_0xc9428f[_0x9aea('0x39')],qs['fields'](_0x11311b['query'][_0x9aea('0x3f')]));_0x2852b5['attributes']=_0x2852b5[_0x9aea('0x3e')]['length']?_0x2852b5[_0x9aea('0x3e')]:_0xc9428f[_0x9aea('0x39')];if(!_0x11311b['query']['hasOwnProperty'](_0x9aea('0x40'))){_0x2852b5['limit']=qs['limit'](_0x11311b[_0x9aea('0x3b')]['limit']);_0x2852b5['offset']=qs[_0x9aea('0x25')](_0x11311b[_0x9aea('0x3b')][_0x9aea('0x25')]);}_0x2852b5[_0x9aea('0x41')]=qs[_0x9aea('0x42')](_0x11311b[_0x9aea('0x3b')][_0x9aea('0x42')]);_0x2852b5[_0x9aea('0x43')]=qs['filters'](_['pick'](_0x11311b[_0x9aea('0x3b')],_0xc9428f['filters']),_0x5f542b);if(_0x11311b[_0x9aea('0x3b')]['filter']){_0x2852b5['where']=_['merge'](_0x2852b5[_0x9aea('0x43')],{'$or':_['map'](_0x5f542b,function(_0x58af58){if(_0x58af58[_0x9aea('0x37')]!=='VIRTUAL'){var _0x289140={};_0x289140[_0x58af58['name']]={'$like':'%'+_0x11311b[_0x9aea('0x3b')][_0x9aea('0x44')]+'%'};return _0x289140;}})});}_0x2852b5=_[_0x9aea('0x45')]({},_0x2852b5,_0x11311b[_0x9aea('0x46')]);var _0x5ed99a={'where':_0x2852b5[_0x9aea('0x43')]};return db[_0x9aea('0x35')][_0x9aea('0x24')](_0x5ed99a)['then'](function(_0x151a0e){_0x41d537[_0x9aea('0x24')]=_0x151a0e;if(_0x11311b['query'][_0x9aea('0x47')]){_0x2852b5['include']=[{'all':!![]}];}return db[_0x9aea('0x35')][_0x9aea('0x48')](_0x2852b5);})[_0x9aea('0x2d')](function(_0x29c040){_0x41d537[_0x9aea('0x49')]=_0x29c040;return _0x41d537;})['then'](respondWithFilteredResult(_0x5464ac,_0x2852b5))[_0x9aea('0x4a')](handleError(_0x5464ac,null));};exports[_0x9aea('0x4b')]=function(_0x1a9fa1,_0x553586){var _0x29e4d2={'raw':!![],'where':{'id':_0x1a9fa1[_0x9aea('0x4c')]['id']}},_0xa72b7b={};_0xa72b7b[_0x9aea('0x39')]=_[_0x9aea('0x3a')](db['ChatInternalMessage'][_0x9aea('0x4d')]);_0xa72b7b[_0x9aea('0x3b')]=_[_0x9aea('0x3a')](_0x1a9fa1['query']);_0xa72b7b[_0x9aea('0x3c')]=_[_0x9aea('0x3d')](_0xa72b7b[_0x9aea('0x39')],_0xa72b7b[_0x9aea('0x3b')]);_0x29e4d2[_0x9aea('0x3e')]=_[_0x9aea('0x3d')](_0xa72b7b[_0x9aea('0x39')],qs[_0x9aea('0x3f')](_0x1a9fa1[_0x9aea('0x3b')][_0x9aea('0x3f')]));_0x29e4d2['attributes']=_0x29e4d2['attributes']['length']?_0x29e4d2[_0x9aea('0x3e')]:_0xa72b7b[_0x9aea('0x39')];if(_0x1a9fa1['query'][_0x9aea('0x47')]){_0x29e4d2[_0x9aea('0x4e')]=[{'all':!![]}];}_0x29e4d2=_['merge']({},_0x29e4d2,_0x1a9fa1[_0x9aea('0x46')]);return db[_0x9aea('0x35')]['find'](_0x29e4d2)[_0x9aea('0x2d')](handleEntityNotFound(_0x553586,null))[_0x9aea('0x2d')](respondWithResult(_0x553586,null))['catch'](handleError(_0x553586,null));};exports[_0x9aea('0x4f')]=function(_0x5a8f21,_0x1c6ce2){return db[_0x9aea('0x35')][_0x9aea('0x4f')](_0x5a8f21[_0x9aea('0x50')],{})[_0x9aea('0x2d')](respondWithResult(_0x1c6ce2,0xc9))[_0x9aea('0x4a')](handleError(_0x1c6ce2,null));};exports[_0x9aea('0x2c')]=function(_0xf52d2d,_0x3af669){if(_0xf52d2d['body']['id']){delete _0xf52d2d['body']['id'];}return db[_0x9aea('0x35')][_0x9aea('0x51')]({'where':{'id':_0xf52d2d[_0x9aea('0x4c')]['id']}})[_0x9aea('0x2d')](handleEntityNotFound(_0x3af669,null))[_0x9aea('0x2d')](saveUpdates(_0xf52d2d[_0x9aea('0x50')],null))[_0x9aea('0x2d')](respondWithResult(_0x3af669,null))['catch'](handleError(_0x3af669,null));};exports[_0x9aea('0x2e')]=function(_0x1f4e8b,_0x8e2819){return db[_0x9aea('0x35')][_0x9aea('0x51')]({'where':{'id':_0x1f4e8b[_0x9aea('0x4c')]['id']}})[_0x9aea('0x2d')](handleEntityNotFound(_0x8e2819,null))[_0x9aea('0x2d')](removeEntity(_0x8e2819,null))['catch'](handleError(_0x8e2819,null));};exports[_0x9aea('0x52')]=function(_0x27a3f8,_0x155ded){return db['ChatInternalMessage']['describe']()[_0x9aea('0x2d')](respondWithResult(_0x155ded,null))[_0x9aea('0x4a')](handleError(_0x155ded,null));};function wrapUser(_0x164ea4){return function(_0x3b2511){var _0xc1bf27=_0x164ea4[_0x9aea('0x53')]({'plain':!![]});_0xc1bf27['messages']=[];if(_0x3b2511){_0xc1bf27[_0x9aea('0x54')]=_0x3b2511[_0x9aea('0x55')];_0xc1bf27[_0x9aea('0x56')]=_0x3b2511;}else{_0xc1bf27[_0x9aea('0x54')]=moment(0x0)['format'](_0x9aea('0x57'));_0xc1bf27[_0x9aea('0x56')]={};}return _0xc1bf27;};}exports[_0x9aea('0x58')]=function(_0x5c1f45,_0x24b6e8,_0x367ee6){var _0x2150a9=[];return db[_0x9aea('0x59')]['findAll']({'where':{'role':[_0x9aea('0x5a'),_0x9aea('0x5b'),_0x9aea('0x5c')]},'attributes':['id',_0x9aea('0x5d'),_0x9aea('0x32'),'role',_0x9aea('0x5e'),_0x9aea('0x5f'),_0x9aea('0x60'),_0x9aea('0x61'),_0x9aea('0x62'),'showWebBar'],'order':qs[_0x9aea('0x42')]('-online'),'include':[{'model':db[_0x9aea('0x63')],'as':_0x9aea('0x64'),'attributes':['id',_0x9aea('0x32'),'type'],'through':{'attributes':[]}}]})[_0x9aea('0x2d')](function(_0x3303e7){if(_0x3303e7){var _0x31afb4=_0x5c1f45[_0x9aea('0x5c')][_0x9aea('0x53')]({'plain':!![]});if(!_0x31afb4)throw new Error(_0x9aea('0x65'));if(_0x31afb4[_0x9aea('0x66')]===_0x9aea('0x5c')){return db['UserProfileSection'][_0x9aea('0x51')]({'where':{'name':_0x9aea('0x67'),'userProfileId':_0x31afb4['userProfileId']},'raw':!![]})[_0x9aea('0x2d')](function(_0x42a2ca){if(_0x42a2ca){if(_0x42a2ca[_0x9aea('0x68')]===0x0){return db[_0x9aea('0x69')][_0x9aea('0x48')]({'where':{'sectionId':_0x42a2ca['id']},'raw':!![]})['then'](function(_0x447743){var _0x2e320f=[];if(_[_0x9aea('0x6a')](_0x447743)){_0x2e320f=_[_0x9aea('0x44')](_0x3303e7,function(_0x5d826b){if(_0x5d826b[_0x9aea('0x66')]!==_0x9aea('0x5a')){return _0x5d826b;}});return _0x2e320f;}else{for(var _0x2dce21=0x0;_0x2dce21<_0x3303e7[_0x9aea('0x6b')];_0x2dce21++){var _0x3ccdd7=_0x3303e7[_0x2dce21];if(_0x3ccdd7['role']===_0x9aea('0x5a')){var _0xaf9568=_[_0x9aea('0x51')](_0x447743,function(_0xc76ae8){return _0xc76ae8[_0x9aea('0x6c')]===_0x3ccdd7['id'];});if(_0xaf9568)_0x2e320f[_0x9aea('0x6d')](_0x3ccdd7);}else{_0x2e320f[_0x9aea('0x6d')](_0x3ccdd7);}}return _0x2e320f;}});}else{return _0x3303e7;}}else{var _0x499cfb=_[_0x9aea('0x44')](_0x3303e7,function(_0x4a8bd8){if(_0x4a8bd8[_0x9aea('0x66')]!=='agent'){return _0x4a8bd8;}});return _0x499cfb;}});}else{return _0x3303e7;}}})[_0x9aea('0x2d')](function(_0x52ff1e){var _0x7d42d=[];if(_0x52ff1e){_0x2150a9=_0x52ff1e;for(var _0x419ab8=0x0;_0x419ab8<_0x52ff1e[_0x9aea('0x6b')];_0x419ab8+=0x1){_0x2150a9[_0x419ab8][_0x9aea('0x6e')]=[];_0x7d42d[_0x9aea('0x6d')](db[_0x9aea('0x35')]['find']({'where':{'FromId':[_0x5c1f45['user']['id'],_0x52ff1e[_0x419ab8]['id']],'ToId':[_0x5c1f45['user']['id'],_0x52ff1e[_0x419ab8]['id']],'ChatGroupId':null},'attributes':['id',_0x9aea('0x55'),_0x9aea('0x6f'),_0x9aea('0x70'),_0x9aea('0x71'),_0x9aea('0x50')],'order':qs[_0x9aea('0x42')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x9aea('0x2d')](wrapUser(_0x52ff1e[_0x419ab8])));}return BPromise[_0x9aea('0x72')](_0x7d42d);}return[];})['then'](function(_0x276535){return{'rows':_0x276535,'count':_0x276535[_0x9aea('0x6b')]};})[_0x9aea('0x2d')](respondWithResult(_0x24b6e8,null))['catch'](handleError(_0x24b6e8,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index e987aaa..dcf0d7b 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 _0xa992=['events','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x5a5fb8,_0x3d22ad){var _0x126ef2=function(_0x41020b){while(--_0x41020b){_0x5a5fb8['push'](_0x5a5fb8['shift']());}};_0x126ef2(++_0x3d22ad);}(_0xa992,0xc4));var _0x2a99=function(_0x16345b,_0x164c21){_0x16345b=_0x16345b-0x0;var _0xcf6924=_0xa992[_0x16345b];return _0xcf6924;};'use strict';var EventEmitter=require(_0x2a99('0x0'));var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2a99('0x1'),'afterUpdate':_0x2a99('0x2'),'afterDestroy':'remove'};function emitEvent(_0x209156){return function(_0x4cb7d7,_0x89f03d,_0x4c79e8){ChatInternalMessageEvents[_0x2a99('0x3')](_0x209156+':'+_0x4cb7d7['id'],_0x4cb7d7);ChatInternalMessageEvents['emit'](_0x209156,_0x4cb7d7);_0x4c79e8(null);};}for(var e in events){if(events[_0x2a99('0x4')](e)){var event=events[e];ChatInternalMessage[_0x2a99('0x5')](e,emitEvent(event));}}module[_0x2a99('0x6')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x135c=['hook','exports','events','../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x533e10,_0x317b46){var _0x21d0cf=function(_0x1a074){while(--_0x1a074){_0x533e10['push'](_0x533e10['shift']());}};_0x21d0cf(++_0x317b46);}(_0x135c,0xda));var _0xc135=function(_0x3c9543,_0x5f1752){_0x3c9543=_0x3c9543-0x0;var _0xd59c38=_0x135c[_0x3c9543];return _0xd59c38;};'use strict';var EventEmitter=require(_0xc135('0x0'));var ChatInternalMessage=require(_0xc135('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xc135('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc135('0x3')};function emitEvent(_0x3c76c0){return function(_0x1d62b8,_0x4fea6a,_0x1f0aa0){ChatInternalMessageEvents[_0xc135('0x4')](_0x3c76c0+':'+_0x1d62b8['id'],_0x1d62b8);ChatInternalMessageEvents[_0xc135('0x4')](_0x3c76c0,_0x1d62b8);_0x1f0aa0(null);};}for(var e in events){if(events[_0xc135('0x5')](e)){var event=events[e];ChatInternalMessage[_0xc135('0x6')](e,emitEvent(event));}}module[_0xc135('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 5f0675a..6ab79ba 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 _0xbdb7=['define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatInternalMessage.attributes'];(function(_0x5959c9,_0x2ed153){var _0x4ffcbc=function(_0x459b7a){while(--_0x459b7a){_0x5959c9['push'](_0x5959c9['shift']());}};_0x4ffcbc(++_0x2ed153);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1e40df,_0x18b1a5){_0x1e40df=_0x1e40df-0x0;var _0x4bfb7b=_0xbdb7[_0x1e40df];return _0x4bfb7b;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var moment=require(_0x7bdb('0x4'));var BPromise=require(_0x7bdb('0x5'));var rp=require(_0x7bdb('0x6'));var fs=require('fs');var path=require(_0x7bdb('0x7'));var rimraf=require(_0x7bdb('0x8'));var config=require('../../config/environment');var attributes=require(_0x7bdb('0x9'));module['exports']=function(_0x4b5fff,_0xffdc86){return _0x4b5fff[_0x7bdb('0xa')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7bdb('0xb'),'collate':_0x7bdb('0xc')});}; \ No newline at end of file +var _0xbdb7=['define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatInternalMessage.attributes'];(function(_0x24f862,_0x4b645a){var _0x198aa4=function(_0x131195){while(--_0x131195){_0x24f862['push'](_0x24f862['shift']());}};_0x198aa4(++_0x4b645a);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1c2aeb,_0x48433c){_0x1c2aeb=_0x1c2aeb-0x0;var _0x783379=_0xbdb7[_0x1c2aeb];return _0x783379;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var moment=require(_0x7bdb('0x4'));var BPromise=require(_0x7bdb('0x5'));var rp=require(_0x7bdb('0x6'));var fs=require('fs');var path=require(_0x7bdb('0x7'));var rimraf=require(_0x7bdb('0x8'));var config=require('../../config/environment');var attributes=require(_0x7bdb('0x9'));module['exports']=function(_0x4b5fff,_0xffdc86){return _0x4b5fff[_0x7bdb('0xa')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7bdb('0xb'),'collate':_0x7bdb('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index bf395a0..21eb011 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 _0x2c10=['defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','info','ChatInternalMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis'];(function(_0x5aaeac,_0x1dd663){var _0x2986de=function(_0x2f154a){while(--_0x2f154a){_0x5aaeac['push'](_0x5aaeac['shift']());}};_0x2986de(++_0x1dd663);}(_0x2c10,0xaf));var _0x02c1=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x2c10[_0x4baae2];return _0x1a2285;};'use strict';var _=require('lodash');var util=require(_0x02c1('0x0'));var moment=require(_0x02c1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02c1('0x2'))['db'];var utils=require(_0x02c1('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x02c1('0x4'));var jayson=require(_0x02c1('0x5'));var client=jayson[_0x02c1('0x6')][_0x02c1('0x7')]({'port':0x232a});config[_0x02c1('0x8')]=_[_0x02c1('0x9')](config[_0x02c1('0x8')],{'host':_0x02c1('0xa'),'port':0x18eb});var socket=require(_0x02c1('0xb'))(new Redis(config[_0x02c1('0x8')]));require(_0x02c1('0xc'))['register'](socket);function respondWithRpcPromise(_0x160f73,_0x44602a,_0x438b2d){return new BPromise(function(_0x26c27d,_0x491e7e){return client['request'](_0x160f73,_0x438b2d)['then'](function(_0x1a31c9){logger[_0x02c1('0xd')](_0x02c1('0xe'),_0x44602a,'request\x20sent');logger[_0x02c1('0xf')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x44602a,_0x02c1('0x10'),JSON[_0x02c1('0x11')](_0x1a31c9));if(_0x1a31c9[_0x02c1('0x12')]){if(_0x1a31c9[_0x02c1('0x12')][_0x02c1('0x13')]===0x1f4){logger[_0x02c1('0x12')](_0x02c1('0xe'),_0x44602a,_0x1a31c9[_0x02c1('0x12')][_0x02c1('0x14')]);return _0x491e7e(_0x1a31c9[_0x02c1('0x12')]['message']);}logger[_0x02c1('0x12')](_0x02c1('0xe'),_0x44602a,_0x1a31c9['error'][_0x02c1('0x14')]);return _0x26c27d(_0x1a31c9[_0x02c1('0x12')][_0x02c1('0x14')]);}else{logger[_0x02c1('0xd')]('ChatInternalMessage,\x20%s,\x20%s',_0x44602a,_0x02c1('0x10'));_0x26c27d(_0x1a31c9[_0x02c1('0x15')][_0x02c1('0x14')]);}})[_0x02c1('0x16')](function(_0x1e17d1){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x44602a,_0x1e17d1);_0x491e7e(_0x1e17d1);});});} \ No newline at end of file +var _0xb00a=['ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug'];(function(_0x23efbd,_0x34a684){var _0x369390=function(_0x156744){while(--_0x156744){_0x23efbd['push'](_0x23efbd['shift']());}};_0x369390(++_0x34a684);}(_0xb00a,0xd1));var _0xab00=function(_0x9fda82,_0xca6cca){_0x9fda82=_0x9fda82-0x0;var _0x1e41e7=_0xb00a[_0x9fda82];return _0x1e41e7;};'use strict';var _=require(_0xab00('0x0'));var util=require(_0xab00('0x1'));var moment=require(_0xab00('0x2'));var BPromise=require(_0xab00('0x3'));var rs=require(_0xab00('0x4'));var fs=require('fs');var Redis=require(_0xab00('0x5'));var db=require(_0xab00('0x6'))['db'];var utils=require(_0xab00('0x7'));var logger=require(_0xab00('0x8'))(_0xab00('0x9'));var config=require('../../config/environment');var jayson=require(_0xab00('0xa'));var client=jayson['client'][_0xab00('0xb')]({'port':0x232a});config[_0xab00('0xc')]=_[_0xab00('0xd')](config[_0xab00('0xc')],{'host':_0xab00('0xe'),'port':0x18eb});var socket=require(_0xab00('0xf'))(new Redis(config['redis']));require(_0xab00('0x10'))[_0xab00('0x11')](socket);function respondWithRpcPromise(_0x414f18,_0x1bbf0c,_0x4f82ec){return new BPromise(function(_0x27645c,_0x4944ea){return client[_0xab00('0x12')](_0x414f18,_0x4f82ec)[_0xab00('0x13')](function(_0x4780da){logger[_0xab00('0x14')](_0xab00('0x15'),_0x1bbf0c,'request\x20sent');logger[_0xab00('0x16')](_0xab00('0x17'),_0x1bbf0c,_0xab00('0x18'),JSON['stringify'](_0x4780da));if(_0x4780da['error']){if(_0x4780da[_0xab00('0x19')]['code']===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x1bbf0c,_0x4780da[_0xab00('0x19')][_0xab00('0x1a')]);return _0x4944ea(_0x4780da[_0xab00('0x19')]['message']);}logger[_0xab00('0x19')](_0xab00('0x15'),_0x1bbf0c,_0x4780da['error'][_0xab00('0x1a')]);return _0x27645c(_0x4780da[_0xab00('0x19')][_0xab00('0x1a')]);}else{logger[_0xab00('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x1bbf0c,'request\x20sent');_0x27645c(_0x4780da[_0xab00('0x1b')]['message']);}})[_0xab00('0x1c')](function(_0x2c899a){logger[_0xab00('0x19')](_0xab00('0x15'),_0x1bbf0c,_0x2c899a);_0x4944ea(_0x2c899a);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index fc9b260..cf3b76d 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 _0xf874=['removeListener','register','remove','update','emit'];(function(_0x19d8d5,_0x50da50){var _0x3edb4e=function(_0x116198){while(--_0x116198){_0x19d8d5['push'](_0x19d8d5['shift']());}};_0x3edb4e(++_0x50da50);}(_0xf874,0xed));var _0x4f87=function(_0x2db40b,_0x150175){_0x2db40b=_0x2db40b-0x0;var _0xcbef95=_0xf874[_0x2db40b];return _0xcbef95;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save',_0x4f87('0x0'),_0x4f87('0x1')];function createListener(_0x298de3,_0x3fd8d5){return function(_0x36699b){_0x3fd8d5[_0x4f87('0x2')](_0x298de3,_0x36699b);};}function removeListener(_0x5b10c6,_0x402bfc){return function(){ChatInternalMessageEvents[_0x4f87('0x3')](_0x5b10c6,_0x402bfc);};}exports[_0x4f87('0x4')]=function(_0xf0ffb3){for(var _0x104682=0x0,_0x44fea6=events['length'];_0x104682<_0x44fea6;_0x104682++){var _0x3a89e3=events[_0x104682];var _0x194853=createListener('chatInternalMessage:'+_0x3a89e3,_0xf0ffb3);ChatInternalMessageEvents['on'](_0x3a89e3,_0x194853);}}; \ No newline at end of file +var _0x61a1=['remove','update','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x20542e,_0x252236){var _0x46b298=function(_0x4a3f7d){while(--_0x4a3f7d){_0x20542e['push'](_0x20542e['shift']());}};_0x46b298(++_0x252236);}(_0x61a1,0x127));var _0x161a=function(_0x24f862,_0x4b645a){_0x24f862=_0x24f862-0x0;var _0x198aa4=_0x61a1[_0x24f862];return _0x198aa4;};'use strict';var ChatInternalMessageEvents=require(_0x161a('0x0'));var events=[_0x161a('0x1'),_0x161a('0x2'),_0x161a('0x3')];function createListener(_0x180d9a,_0x4fd537){return function(_0x16162f){_0x4fd537[_0x161a('0x4')](_0x180d9a,_0x16162f);};}function removeListener(_0x52aadb,_0x1775e8){return function(){ChatInternalMessageEvents[_0x161a('0x5')](_0x52aadb,_0x1775e8);};}exports[_0x161a('0x6')]=function(_0x1442cf){for(var _0x1bb0ac=0x0,_0x45b1e8=events[_0x161a('0x7')];_0x1bb0ac<_0x45b1e8;_0x1bb0ac++){var _0x182e6c=events[_0x1bb0ac];var _0x3e07e5=createListener(_0x161a('0x8')+_0x182e6c,_0x1442cf);ChatInternalMessageEvents['on'](_0x182e6c,_0x3e07e5);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 13f08fb..a34c213 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 _0x70e0=['exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','describe','/users','isAuthenticated','getUsers','/:id','post','create','put','update','delete','destroy'];(function(_0x489730,_0x5226b9){var _0x7855d1=function(_0x3bce57){while(--_0x3bce57){_0x489730['push'](_0x489730['shift']());}};_0x7855d1(++_0x5226b9);}(_0x70e0,0x17b));var _0x070e=function(_0x19566a,_0x4615ab){_0x19566a=_0x19566a-0x0;var _0x1b75b6=_0x70e0[_0x19566a];return _0x1b75b6;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./chatInternalMessage.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0x7')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0x7')](_0x070e('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x070e('0xe')]('/',auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);router[_0x070e('0x10')](_0x070e('0xd'),controller[_0x070e('0x11')]);router[_0x070e('0x12')](_0x070e('0xd'),auth[_0x070e('0xb')](),controller[_0x070e('0x13')]);module[_0x070e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','/users','/:id','show','post','delete'];(function(_0x1437aa,_0xcaf84d){var _0x670b47=function(_0x320358){while(--_0x320358){_0x1437aa['push'](_0x1437aa['shift']());}};_0x670b47(++_0xcaf84d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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['getUsers']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['put']('/:id',controller['update']);router[_0x0a9e('0xe')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xf')]);module[_0x0a9e('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index a98f847..caeacdc 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 _0x50f9=['sequelize','exports','medium','BOOLEAN','out','DATE','STRING'];(function(_0x2b9efa,_0x1af483){var _0x48d857=function(_0x5b6415){while(--_0x5b6415){_0x2b9efa['push'](_0x2b9efa['shift']());}};_0x48d857(++_0x1af483);}(_0x50f9,0x1ce));var _0x950f=function(_0x366547,_0x54a1e7){_0x366547=_0x366547-0x0;var _0x5ca4e5=_0x50f9[_0x366547];return _0x5ca4e5;};'use strict';var Sequelize=require(_0x950f('0x0'));module[_0x950f('0x1')]={'body':{'type':Sequelize['TEXT'](_0x950f('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x950f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x950f('0x4')),'defaultValue':_0x950f('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x950f('0x5')]},'providerName':{'type':Sequelize[_0x950f('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xb338=['exports','medium','BOOLEAN','ENUM','out','DATE','TEXT','sequelize'];(function(_0x51d80d,_0x3b461e){var _0x14931e=function(_0x5a45b1){while(--_0x5a45b1){_0x51d80d['push'](_0x51d80d['shift']());}};_0x14931e(++_0x3b461e);}(_0xb338,0x17f));var _0x8b33=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xb338[_0x409353];return _0x4f4b59;};'use strict';var Sequelize=require(_0x8b33('0x0'));module[_0x8b33('0x1')]={'body':{'type':Sequelize['TEXT'](_0x8b33('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x8b33('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x8b33('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8b33('0x4')]('in',_0x8b33('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x8b33('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x8b33('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index a5f8248..6859fbf 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 _0x0901=['fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','save','update','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','show','include','find','body','params','describe','chat-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','Contact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','AcceptMessage','acceptMessage','channel','EventManager','acceptmessage','parse','formData','reject','chat','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','interface','SIP/%s','rejectmessage','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x39e164,_0x2cb93b){var _0x13fa6b=function(_0x511cb2){while(--_0x511cb2){_0x39e164['push'](_0x39e164['shift']());}};_0x13fa6b(++_0x2cb93b);}(_0x0901,0x7c));var _0x1090=function(_0x23e142,_0x3b0749){_0x23e142=_0x23e142-0x0;var _0x57937e=_0x0901[_0x23e142];return _0x57937e;};'use strict';var pdf=require(_0x1090('0x0'));var emlformat=require(_0x1090('0x1'));var rimraf=require(_0x1090('0x2'));var zipdir=require(_0x1090('0x3'));var jsonpatch=require(_0x1090('0x4'));var rp=require('request-promise');var moment=require(_0x1090('0x5'));var BPromise=require(_0x1090('0x6'));var Mustache=require('mustache');var util=require(_0x1090('0x7'));var path=require('path');var sox=require(_0x1090('0x8'));var csv=require(_0x1090('0x9'));var ejs=require(_0x1090('0xa'));var fs=require('fs');var _=require(_0x1090('0xb'));var squel=require(_0x1090('0xc'));var crypto=require(_0x1090('0xd'));var jsforce=require(_0x1090('0xe'));var deskjs=require(_0x1090('0xf'));var toCsv=require(_0x1090('0x9'));var querystring=require(_0x1090('0x10'));var Papa=require(_0x1090('0x11'));var Redis=require(_0x1090('0x12'));var authService=require(_0x1090('0x13'));var qs=require(_0x1090('0x14'));var as=require(_0x1090('0x15'));var hardwareService=require(_0x1090('0x16'));var logger=require(_0x1090('0x17'))(_0x1090('0x18'));var utils=require('../../config/utils');var config=require(_0x1090('0x19'));var licenseUtil=require(_0x1090('0x1a'));var db=require(_0x1090('0x1b'))['db'];config[_0x1090('0x1c')]=_[_0x1090('0x1d')](config[_0x1090('0x1c')],{'host':_0x1090('0x1e'),'port':0x18eb});var socket=require(_0x1090('0x1f'))(new Redis(config[_0x1090('0x1c')]));require(_0x1090('0x20'))['register'](socket);var jayson=require(_0x1090('0x21'));var client=jayson[_0x1090('0x22')][_0x1090('0x23')]({'port':0x232c});var client9002=jayson[_0x1090('0x22')][_0x1090('0x23')]({'port':0x232a});function respondWithRpcPromise(_0xf6b29e,_0x152ca2,_0x29b306,_0x375100){return new BPromise(function(_0x2b2b8c,_0xdece3b){var _0x1da7ac=_0x375100||client;return _0x1da7ac[_0x1090('0x24')](_0xf6b29e,_0x29b306)[_0x1090('0x25')](function(_0xc21c9d){logger['info'](_0x1090('0x26'),_0x152ca2,_0x1090('0x27'));logger[_0x1090('0x28')](_0x1090('0x29'),_0x152ca2,'request\x20sent',JSON['stringify'](_0xc21c9d));if(_0xc21c9d['error']){if(_0xc21c9d['error'][_0x1090('0x2a')]===0x1f4){logger['error'](_0x1090('0x26'),_0x152ca2,_0xc21c9d[_0x1090('0x2b')][_0x1090('0x2c')]);return _0xdece3b(_0xc21c9d[_0x1090('0x2b')][_0x1090('0x2c')]);}logger[_0x1090('0x2b')](_0x1090('0x26'),_0x152ca2,_0xc21c9d[_0x1090('0x2b')][_0x1090('0x2c')]);return _0x2b2b8c(_0xc21c9d['error']['message']);}else{logger[_0x1090('0x2d')]('ChatMessage,\x20%s,\x20%s',_0x152ca2,_0x1090('0x27'));_0x2b2b8c(_0xc21c9d[_0x1090('0x2e')][_0x1090('0x2c')]);}})[_0x1090('0x2f')](function(_0x1ca405){logger['error']('ChatMessage,\x20%s,\x20%s',_0x152ca2,_0x1ca405);_0xdece3b(_0x1ca405);});});}function respondWithStatusCode(_0x4da309,_0x36f76b){_0x36f76b=_0x36f76b||0xcc;return function(_0x599e76){if(_0x599e76){return _0x4da309[_0x1090('0x30')](_0x36f76b);}return _0x4da309[_0x1090('0x31')](_0x36f76b)[_0x1090('0x32')]();};}function respondWithResult(_0x2692b0,_0xa60415){_0xa60415=_0xa60415||0xc8;return function(_0x5af10b){if(_0x5af10b){return _0x2692b0[_0x1090('0x31')](_0xa60415)[_0x1090('0x33')](_0x5af10b);}};}function respondWithFilteredResult(_0x49e4af,_0x4854e8){return function(_0x1b4c18){if(_0x1b4c18){var _0xa5e16f=_0x1b4c18[_0x1090('0x34')],_0x448847=_0x4854e8[_0x1090('0x35')],_0x59441a=_0x4854e8[_0x1090('0x35')]+_0x4854e8['limit'],_0x1695c5;if(_0x59441a>=_0xa5e16f){_0x59441a=_0xa5e16f;_0x1695c5=0xc8;}else{_0x1695c5=0xce;}_0x49e4af[_0x1090('0x31')](_0x1695c5);return _0x49e4af[_0x1090('0x36')](_0x1090('0x37'),_0x448847+'-'+_0x59441a+'/'+_0xa5e16f)[_0x1090('0x33')](_0x1b4c18);}return null;};}function patchUpdates(_0x554767){return function(_0x12bd30){try{jsonpatch['apply'](_0x12bd30,_0x554767,!![]);}catch(_0x29e366){return BPromise['reject'](_0x29e366);}return _0x12bd30[_0x1090('0x38')]();};}function saveUpdates(_0x16c4f1,_0x4f3e9b){return function(_0x1f5e7b){if(_0x1f5e7b){return _0x1f5e7b[_0x1090('0x39')](_0x16c4f1)[_0x1090('0x25')](function(_0x28c495){return _0x28c495;});}return null;};}function removeEntity(_0x5f2d99,_0x14a337){return function(_0x52be11){if(_0x52be11){return _0x52be11[_0x1090('0x3a')]()[_0x1090('0x25')](function(){_0x5f2d99[_0x1090('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b3617,_0x414d27){return function(_0x5deeb1){if(!_0x5deeb1){_0x1b3617[_0x1090('0x30')](0x194);}return _0x5deeb1;};}function handleError(_0x302962,_0x574646){_0x574646=_0x574646||0x1f4;return function(_0x36614e){logger[_0x1090('0x2b')](_0x36614e[_0x1090('0x3b')]);if(_0x36614e[_0x1090('0x3c')]){delete _0x36614e[_0x1090('0x3c')];}_0x302962['status'](_0x574646)[_0x1090('0x3d')](_0x36614e);};}exports[_0x1090('0x3e')]=function(_0x49e902,_0x34afe2){var _0x12b61c={},_0x42c6ca={},_0x300c74={'count':0x0,'rows':[]};var _0x10a1ca=_[_0x1090('0x3f')](db[_0x1090('0x40')][_0x1090('0x41')],function(_0x2d831d){return{'name':_0x2d831d['fieldName'],'type':_0x2d831d[_0x1090('0x42')]['key']};});_0x42c6ca[_0x1090('0x43')]=_[_0x1090('0x3f')](_0x10a1ca,'name');_0x42c6ca['query']=_[_0x1090('0x44')](_0x49e902[_0x1090('0x45')]);_0x42c6ca[_0x1090('0x46')]=_[_0x1090('0x47')](_0x42c6ca['model'],_0x42c6ca[_0x1090('0x45')]);_0x12b61c[_0x1090('0x48')]=_[_0x1090('0x47')](_0x42c6ca[_0x1090('0x43')],qs[_0x1090('0x49')](_0x49e902['query']['fields']));_0x12b61c['attributes']=_0x12b61c[_0x1090('0x48')][_0x1090('0x4a')]?_0x12b61c['attributes']:_0x42c6ca[_0x1090('0x43')];if(!_0x49e902['query']['hasOwnProperty'](_0x1090('0x4b'))){_0x12b61c['limit']=qs[_0x1090('0x4c')](_0x49e902[_0x1090('0x45')][_0x1090('0x4c')]);_0x12b61c[_0x1090('0x35')]=qs[_0x1090('0x35')](_0x49e902[_0x1090('0x45')]['offset']);}_0x12b61c['order']=qs[_0x1090('0x4d')](_0x49e902[_0x1090('0x45')][_0x1090('0x4d')]);_0x12b61c['where']=qs['filters'](_[_0x1090('0x4e')](_0x49e902[_0x1090('0x45')],_0x42c6ca['filters']),_0x10a1ca);if(_0x49e902[_0x1090('0x45')][_0x1090('0x4f')]){_0x12b61c['where']=_[_0x1090('0x50')](_0x12b61c[_0x1090('0x51')],{'$or':_['map'](_0x10a1ca,function(_0x4c93e8){if(_0x4c93e8[_0x1090('0x42')]!==_0x1090('0x52')){var _0x7859f2={};_0x7859f2[_0x4c93e8[_0x1090('0x3c')]]={'$like':'%'+_0x49e902[_0x1090('0x45')]['filter']+'%'};return _0x7859f2;}})});}_0x12b61c=_[_0x1090('0x50')]({},_0x12b61c,_0x49e902[_0x1090('0x53')]);var _0x193e5d={'where':_0x12b61c['where']};return db['ChatMessage'][_0x1090('0x34')](_0x193e5d)[_0x1090('0x25')](function(_0x7ab0ae){_0x300c74['count']=_0x7ab0ae;if(_0x49e902[_0x1090('0x45')][_0x1090('0x54')]){_0x12b61c['include']=[{'all':!![]}];}return db[_0x1090('0x40')][_0x1090('0x55')](_0x12b61c);})[_0x1090('0x25')](function(_0x314d86){_0x300c74[_0x1090('0x56')]=_0x314d86;return _0x300c74;})[_0x1090('0x25')](respondWithFilteredResult(_0x34afe2,_0x12b61c))['catch'](handleError(_0x34afe2,null));};exports[_0x1090('0x57')]=function(_0x1d2cf1,_0x988e14){var _0x5cdc39={'raw':!![],'where':{'id':_0x1d2cf1['params']['id']}},_0x2d2008={};_0x2d2008[_0x1090('0x43')]=_[_0x1090('0x44')](db[_0x1090('0x40')][_0x1090('0x41')]);_0x2d2008[_0x1090('0x45')]=_[_0x1090('0x44')](_0x1d2cf1[_0x1090('0x45')]);_0x2d2008['filters']=_[_0x1090('0x47')](_0x2d2008['model'],_0x2d2008[_0x1090('0x45')]);_0x5cdc39['attributes']=_[_0x1090('0x47')](_0x2d2008['model'],qs[_0x1090('0x49')](_0x1d2cf1[_0x1090('0x45')]['fields']));_0x5cdc39[_0x1090('0x48')]=_0x5cdc39[_0x1090('0x48')][_0x1090('0x4a')]?_0x5cdc39['attributes']:_0x2d2008['model'];if(_0x1d2cf1[_0x1090('0x45')][_0x1090('0x54')]){_0x5cdc39[_0x1090('0x58')]=[{'all':!![]}];}_0x5cdc39=_[_0x1090('0x50')]({},_0x5cdc39,_0x1d2cf1[_0x1090('0x53')]);return db['ChatMessage'][_0x1090('0x59')](_0x5cdc39)[_0x1090('0x25')](handleEntityNotFound(_0x988e14,null))[_0x1090('0x25')](respondWithResult(_0x988e14,null))[_0x1090('0x2f')](handleError(_0x988e14,null));};exports['create']=function(_0x4da269,_0x589243){return db[_0x1090('0x40')]['create'](_0x4da269[_0x1090('0x5a')],{})[_0x1090('0x25')](respondWithResult(_0x589243,0xc9))[_0x1090('0x2f')](handleError(_0x589243,null));};exports['update']=function(_0x420527,_0x25cc4d){if(_0x420527[_0x1090('0x5a')]['id']){delete _0x420527['body']['id'];}return db[_0x1090('0x40')][_0x1090('0x59')]({'where':{'id':_0x420527[_0x1090('0x5b')]['id']}})[_0x1090('0x25')](handleEntityNotFound(_0x25cc4d,null))[_0x1090('0x25')](saveUpdates(_0x420527[_0x1090('0x5a')],null))['then'](respondWithResult(_0x25cc4d,null))['catch'](handleError(_0x25cc4d,null));};exports[_0x1090('0x3a')]=function(_0x20013e,_0x494ccf){return db['ChatMessage'][_0x1090('0x59')]({'where':{'id':_0x20013e[_0x1090('0x5b')]['id']}})[_0x1090('0x25')](handleEntityNotFound(_0x494ccf,null))['then'](removeEntity(_0x494ccf,null))[_0x1090('0x2f')](handleError(_0x494ccf,null));};exports[_0x1090('0x5c')]=function(_0x1f54a0,_0x21da6e){return db['ChatMessage'][_0x1090('0x5c')]()[_0x1090('0x25')](respondWithResult(_0x21da6e,null))[_0x1090('0x2f')](handleError(_0x21da6e,null));};var interaction_log=require(_0x1090('0x17'))(_0x1090('0x5d'));exports[_0x1090('0x5e')]=function(_0x2afa07,_0x17dfbd,_0x339d37){var _0x1432b0={'agent':{},'channel':'chat'};if(_0x2afa07[_0x1090('0x5a')]['id']){delete _0x2afa07['body']['id'];}_0x2afa07[_0x1090('0x5a')][_0x1090('0x5f')]=!![];_0x2afa07['body'][_0x1090('0x60')]=moment()[_0x1090('0x61')](_0x1090('0x62'));_0x2afa07['body']['UserId']=_0x2afa07[_0x1090('0x5a')][_0x1090('0x63')]||_0x2afa07['user']['id'];_0x1432b0[_0x1090('0x64')]['id']=_0x2afa07['body'][_0x1090('0x63')];return db[_0x1090('0x40')]['find']({'where':{'id':_0x2afa07['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x1090('0x65')}]})['then'](handleEntityNotFound(_0x17dfbd,null))[_0x1090('0x25')](saveUpdates(_0x2afa07[_0x1090('0x5a')],null))[_0x1090('0x25')](function(_0x356967){if(_0x356967){_0x1432b0[_0x1090('0x2c')]=_0x356967[_0x1090('0x66')]({'plain':!![]});return db[_0x1090('0x67')]['find']({'where':{'id':_0x356967[_0x1090('0x68')]}});}return null;})[_0x1090('0x25')](handleEntityNotFound(_0x17dfbd,null))['then'](function(_0x34a315){if(_0x34a315){return _0x34a315[_0x1090('0x39')]({'UserId':_0x2afa07[_0x1090('0x5a')][_0x1090('0x63')],'read1stAt':_[_0x1090('0x69')](_0x34a315[_0x1090('0x6a')])?moment()[_0x1090('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x1090('0x25')](function(_0x40842f){if(_0x40842f){_0x1432b0[_0x1090('0x6b')]=_0x40842f['get']({'plain':!![]});interaction_log['info'](_0x1090('0x6c'),_0x2afa07[_0x1090('0x6d')]['id'],_0x2afa07[_0x1090('0x6d')]['name'],_0x2afa07[_0x1090('0x6d')][_0x1090('0x6e')],_0x1432b0[_0x1090('0x6b')]['id'],_0x2afa07[_0x1090('0x5a')]?JSON[_0x1090('0x6f')](_0x2afa07[_0x1090('0x5a')]):'null');return respondWithRpcPromise(_0x1090('0x70'),_0x1090('0x71'),_0x1432b0);}return null;})[_0x1090('0x25')](function(_0x4fd166){if(_0x4fd166){if(_0x2afa07[_0x1090('0x5a')]['manual']){_0x1432b0['message']['interface']=util['format']('SIP/%s',_0x2afa07[_0x1090('0x6d')][_0x1090('0x3c')]);_0x1432b0[_0x1090('0x2c')][_0x1090('0x72')]=_0x1432b0['channel'];_0x1432b0[_0x1090('0x2c')]['event']=_0x1090('0x5e');return respondWithRpcPromise('EventManager',_0x1090('0x73'),{'event':_0x1090('0x74'),'message':_[_0x1090('0x50')](_0x1432b0[_0x1090('0x2c')],JSON[_0x1090('0x75')](_0x1432b0[_0x1090('0x6b')][_0x1090('0x76')]))},client9002)[_0x1090('0x25')](function(){return _0x1432b0;});}return _0x1432b0;}return null;})[_0x1090('0x25')](respondWithResult(_0x17dfbd,null))['catch'](handleError(_0x17dfbd,null));};var interaction_log=require(_0x1090('0x17'))(_0x1090('0x5d'));exports[_0x1090('0x77')]=function(_0x2a70fa,_0x4be2e0,_0x45ed58){var _0x53b945={'agent':{},'channel':_0x1090('0x78')};if(_0x2a70fa[_0x1090('0x5a')]['id']){delete _0x2a70fa[_0x1090('0x5a')]['id'];}_0x2a70fa[_0x1090('0x5a')][_0x1090('0x63')]=_0x2a70fa['body'][_0x1090('0x63')]||_0x2a70fa[_0x1090('0x6d')]['id'];_0x53b945[_0x1090('0x64')]['id']=_0x2a70fa[_0x1090('0x5a')][_0x1090('0x63')];return db['ChatMessage']['find']({'where':{'id':_0x2a70fa[_0x1090('0x5b')]['id'],'UserId':null}})[_0x1090('0x25')](handleEntityNotFound(_0x4be2e0,null))['then'](function(_0x185b25){if(_0x185b25){_0x53b945[_0x1090('0x2c')]=_0x185b25[_0x1090('0x66')]({'plain':!![]});return db[_0x1090('0x67')][_0x1090('0x59')]({'where':{'id':_0x185b25[_0x1090('0x68')]}});}return null;})[_0x1090('0x25')](handleEntityNotFound(_0x4be2e0,null))[_0x1090('0x25')](function(_0x4147e2){if(_0x4147e2){_0x53b945['interaction']=_0x4147e2[_0x1090('0x66')]({'plain':!![]});interaction_log[_0x1090('0x2d')](_0x1090('0x79'),_0x2a70fa[_0x1090('0x6d')]['id'],_0x2a70fa['user']['name'],_0x2a70fa['user']['role'],_0x53b945['interaction']['id'],_0x2a70fa[_0x1090('0x5a')]?JSON['stringify'](_0x2a70fa[_0x1090('0x5a')]):_0x1090('0x7a'));return respondWithRpcPromise(_0x1090('0x7b'),_0x1090('0x7c'),_0x53b945);}return null;})[_0x1090('0x25')](function(_0x505766){if(_0x505766){_0x505766[_0x1090('0x2c')][_0x1090('0x7d')]=util['format'](_0x1090('0x7e'),_0x2a70fa[_0x1090('0x6d')]['name']);_0x505766[_0x1090('0x2c')][_0x1090('0x72')]=_0x53b945[_0x1090('0x72')];_0x505766['message']['event']=_0x1090('0x77');respondWithRpcPromise(_0x1090('0x73'),_0x1090('0x73'),{'event':_0x1090('0x7f'),'message':_0x505766[_0x1090('0x2c')]},client9002);return _0x53b945;}return null;})['then'](respondWithResult(_0x4be2e0,null))[_0x1090('0x2f')](handleError(_0x4be2e0,null));}; \ No newline at end of file +var _0xb9aa=['accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','formData','reject','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','html-pdf','fast-json-patch','request-promise','moment','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatMessage.socket','register','jayson/promise','client','then','info','ChatMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','status','count','offset','limit','set','Content-Range','json','save','update','end','sendStatus','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','findAll','rows','show','params','keys','length','includeAll','include','options','find','create','body','destroy','describe','chat-interactions'];(function(_0x361c50,_0x35054e){var _0x1a14fe=function(_0x541689){while(--_0x541689){_0x361c50['push'](_0x361c50['shift']());}};_0x1a14fe(++_0x35054e);}(_0xb9aa,0x9a));var _0xab9a=function(_0x5886a6,_0x2c9288){_0x5886a6=_0x5886a6-0x0;var _0x563a59=_0xb9aa[_0x5886a6];return _0x563a59;};'use strict';var pdf=require(_0xab9a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xab9a('0x1'));var rp=require(_0xab9a('0x2'));var moment=require(_0xab9a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xab9a('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xab9a('0x5'));var ejs=require(_0xab9a('0x6'));var fs=require('fs');var _=require(_0xab9a('0x7'));var squel=require(_0xab9a('0x8'));var crypto=require(_0xab9a('0x9'));var jsforce=require(_0xab9a('0xa'));var deskjs=require(_0xab9a('0xb'));var toCsv=require(_0xab9a('0x5'));var querystring=require(_0xab9a('0xc'));var Papa=require(_0xab9a('0xd'));var Redis=require('ioredis');var authService=require(_0xab9a('0xe'));var qs=require(_0xab9a('0xf'));var as=require(_0xab9a('0x10'));var hardwareService=require(_0xab9a('0x11'));var logger=require(_0xab9a('0x12'))(_0xab9a('0x13'));var utils=require(_0xab9a('0x14'));var config=require(_0xab9a('0x15'));var licenseUtil=require(_0xab9a('0x16'));var db=require(_0xab9a('0x17'))['db'];config['redis']=_[_0xab9a('0x18')](config['redis'],{'host':_0xab9a('0x19'),'port':0x18eb});var socket=require(_0xab9a('0x1a'))(new Redis(config[_0xab9a('0x1b')]));require(_0xab9a('0x1c'))[_0xab9a('0x1d')](socket);var jayson=require(_0xab9a('0x1e'));var client=jayson[_0xab9a('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xab9a('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x315fc8,_0x4805b1,_0x239000,_0x3f03ce){return new BPromise(function(_0x4c4d96,_0x5daf94){var _0x487d33=_0x3f03ce||client;return _0x487d33['request'](_0x315fc8,_0x239000)[_0xab9a('0x20')](function(_0x4a4672){logger[_0xab9a('0x21')](_0xab9a('0x22'),_0x4805b1,'request\x20sent');logger[_0xab9a('0x23')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x4805b1,_0xab9a('0x24'),JSON[_0xab9a('0x25')](_0x4a4672));if(_0x4a4672['error']){if(_0x4a4672[_0xab9a('0x26')][_0xab9a('0x27')]===0x1f4){logger[_0xab9a('0x26')](_0xab9a('0x22'),_0x4805b1,_0x4a4672['error'][_0xab9a('0x28')]);return _0x5daf94(_0x4a4672[_0xab9a('0x26')][_0xab9a('0x28')]);}logger['error'](_0xab9a('0x22'),_0x4805b1,_0x4a4672['error'][_0xab9a('0x28')]);return _0x4c4d96(_0x4a4672[_0xab9a('0x26')][_0xab9a('0x28')]);}else{logger[_0xab9a('0x21')]('ChatMessage,\x20%s,\x20%s',_0x4805b1,_0xab9a('0x24'));_0x4c4d96(_0x4a4672[_0xab9a('0x29')][_0xab9a('0x28')]);}})[_0xab9a('0x2a')](function(_0x3f2c5d){logger['error'](_0xab9a('0x22'),_0x4805b1,_0x3f2c5d);_0x5daf94(_0x3f2c5d);});});}function respondWithStatusCode(_0x42d992,_0x1eacb0){_0x1eacb0=_0x1eacb0||0xcc;return function(_0x5c81ee){if(_0x5c81ee){return _0x42d992['sendStatus'](_0x1eacb0);}return _0x42d992[_0xab9a('0x2b')](_0x1eacb0)['end']();};}function respondWithResult(_0x50fa2b,_0x5d8d2a){_0x5d8d2a=_0x5d8d2a||0xc8;return function(_0x34bd06){if(_0x34bd06){return _0x50fa2b[_0xab9a('0x2b')](_0x5d8d2a)['json'](_0x34bd06);}};}function respondWithFilteredResult(_0xb284e9,_0x20de49){return function(_0x1804cf){if(_0x1804cf){var _0x1644d9=_0x1804cf[_0xab9a('0x2c')],_0x39a326=_0x20de49['offset'],_0x947604=_0x20de49[_0xab9a('0x2d')]+_0x20de49[_0xab9a('0x2e')],_0x16301f;if(_0x947604>=_0x1644d9){_0x947604=_0x1644d9;_0x16301f=0xc8;}else{_0x16301f=0xce;}_0xb284e9[_0xab9a('0x2b')](_0x16301f);return _0xb284e9[_0xab9a('0x2f')](_0xab9a('0x30'),_0x39a326+'-'+_0x947604+'/'+_0x1644d9)[_0xab9a('0x31')](_0x1804cf);}return null;};}function patchUpdates(_0x2b9bfb){return function(_0x776f24){try{jsonpatch['apply'](_0x776f24,_0x2b9bfb,!![]);}catch(_0x149fbd){return BPromise['reject'](_0x149fbd);}return _0x776f24[_0xab9a('0x32')]();};}function saveUpdates(_0x52541a,_0xcbcae8){return function(_0x3383d6){if(_0x3383d6){return _0x3383d6[_0xab9a('0x33')](_0x52541a)['then'](function(_0x48c601){return _0x48c601;});}return null;};}function removeEntity(_0x5ede79,_0x34b5b0){return function(_0x303fe7){if(_0x303fe7){return _0x303fe7['destroy']()[_0xab9a('0x20')](function(){_0x5ede79[_0xab9a('0x2b')](0xcc)[_0xab9a('0x34')]();});}};}function handleEntityNotFound(_0x2a2091,_0xa1e8fd){return function(_0x4575dd){if(!_0x4575dd){_0x2a2091[_0xab9a('0x35')](0x194);}return _0x4575dd;};}function handleError(_0x55690c,_0xa58f2a){_0xa58f2a=_0xa58f2a||0x1f4;return function(_0x1a2764){logger[_0xab9a('0x26')](_0x1a2764['stack']);if(_0x1a2764[_0xab9a('0x36')]){delete _0x1a2764[_0xab9a('0x36')];}_0x55690c[_0xab9a('0x2b')](_0xa58f2a)[_0xab9a('0x37')](_0x1a2764);};}exports[_0xab9a('0x38')]=function(_0x1b5200,_0x2f88e1){var _0x5d2243={},_0xa5d0f6={},_0x26caa2={'count':0x0,'rows':[]};var _0x1b9004=_[_0xab9a('0x39')](db[_0xab9a('0x3a')][_0xab9a('0x3b')],function(_0x5d9fa7){return{'name':_0x5d9fa7[_0xab9a('0x3c')],'type':_0x5d9fa7[_0xab9a('0x3d')][_0xab9a('0x3e')]};});_0xa5d0f6[_0xab9a('0x3f')]=_[_0xab9a('0x39')](_0x1b9004,'name');_0xa5d0f6[_0xab9a('0x40')]=_['keys'](_0x1b5200['query']);_0xa5d0f6['filters']=_['intersection'](_0xa5d0f6[_0xab9a('0x3f')],_0xa5d0f6['query']);_0x5d2243[_0xab9a('0x41')]=_[_0xab9a('0x42')](_0xa5d0f6[_0xab9a('0x3f')],qs[_0xab9a('0x43')](_0x1b5200['query'][_0xab9a('0x43')]));_0x5d2243[_0xab9a('0x41')]=_0x5d2243[_0xab9a('0x41')]['length']?_0x5d2243[_0xab9a('0x41')]:_0xa5d0f6[_0xab9a('0x3f')];if(!_0x1b5200[_0xab9a('0x40')][_0xab9a('0x44')](_0xab9a('0x45'))){_0x5d2243[_0xab9a('0x2e')]=qs['limit'](_0x1b5200[_0xab9a('0x40')]['limit']);_0x5d2243['offset']=qs[_0xab9a('0x2d')](_0x1b5200[_0xab9a('0x40')][_0xab9a('0x2d')]);}_0x5d2243['order']=qs[_0xab9a('0x46')](_0x1b5200[_0xab9a('0x40')][_0xab9a('0x46')]);_0x5d2243[_0xab9a('0x47')]=qs[_0xab9a('0x48')](_[_0xab9a('0x49')](_0x1b5200[_0xab9a('0x40')],_0xa5d0f6[_0xab9a('0x48')]),_0x1b9004);if(_0x1b5200[_0xab9a('0x40')][_0xab9a('0x4a')]){_0x5d2243[_0xab9a('0x47')]=_[_0xab9a('0x4b')](_0x5d2243[_0xab9a('0x47')],{'$or':_[_0xab9a('0x39')](_0x1b9004,function(_0x2b524c){if(_0x2b524c[_0xab9a('0x3d')]!==_0xab9a('0x4c')){var _0x2fed4b={};_0x2fed4b[_0x2b524c[_0xab9a('0x36')]]={'$like':'%'+_0x1b5200[_0xab9a('0x40')]['filter']+'%'};return _0x2fed4b;}})});}_0x5d2243=_[_0xab9a('0x4b')]({},_0x5d2243,_0x1b5200['options']);var _0x4bfe10={'where':_0x5d2243[_0xab9a('0x47')]};return db[_0xab9a('0x3a')]['count'](_0x4bfe10)[_0xab9a('0x20')](function(_0x4a7be7){_0x26caa2['count']=_0x4a7be7;if(_0x1b5200[_0xab9a('0x40')]['includeAll']){_0x5d2243['include']=[{'all':!![]}];}return db['ChatMessage'][_0xab9a('0x4d')](_0x5d2243);})[_0xab9a('0x20')](function(_0x309753){_0x26caa2[_0xab9a('0x4e')]=_0x309753;return _0x26caa2;})[_0xab9a('0x20')](respondWithFilteredResult(_0x2f88e1,_0x5d2243))[_0xab9a('0x2a')](handleError(_0x2f88e1,null));};exports[_0xab9a('0x4f')]=function(_0x21ca7e,_0x19e7c3){var _0x23945a={'raw':!![],'where':{'id':_0x21ca7e[_0xab9a('0x50')]['id']}},_0x154847={};_0x154847[_0xab9a('0x3f')]=_[_0xab9a('0x51')](db[_0xab9a('0x3a')][_0xab9a('0x3b')]);_0x154847[_0xab9a('0x40')]=_[_0xab9a('0x51')](_0x21ca7e['query']);_0x154847[_0xab9a('0x48')]=_['intersection'](_0x154847[_0xab9a('0x3f')],_0x154847[_0xab9a('0x40')]);_0x23945a[_0xab9a('0x41')]=_[_0xab9a('0x42')](_0x154847['model'],qs['fields'](_0x21ca7e['query'][_0xab9a('0x43')]));_0x23945a['attributes']=_0x23945a[_0xab9a('0x41')][_0xab9a('0x52')]?_0x23945a['attributes']:_0x154847[_0xab9a('0x3f')];if(_0x21ca7e['query'][_0xab9a('0x53')]){_0x23945a[_0xab9a('0x54')]=[{'all':!![]}];}_0x23945a=_['merge']({},_0x23945a,_0x21ca7e[_0xab9a('0x55')]);return db[_0xab9a('0x3a')][_0xab9a('0x56')](_0x23945a)['then'](handleEntityNotFound(_0x19e7c3,null))[_0xab9a('0x20')](respondWithResult(_0x19e7c3,null))[_0xab9a('0x2a')](handleError(_0x19e7c3,null));};exports[_0xab9a('0x57')]=function(_0x2cba69,_0x2d23d7){return db[_0xab9a('0x3a')]['create'](_0x2cba69['body'],{})[_0xab9a('0x20')](respondWithResult(_0x2d23d7,0xc9))[_0xab9a('0x2a')](handleError(_0x2d23d7,null));};exports[_0xab9a('0x33')]=function(_0x37bed8,_0x218569){if(_0x37bed8[_0xab9a('0x58')]['id']){delete _0x37bed8[_0xab9a('0x58')]['id'];}return db[_0xab9a('0x3a')]['find']({'where':{'id':_0x37bed8[_0xab9a('0x50')]['id']}})[_0xab9a('0x20')](handleEntityNotFound(_0x218569,null))['then'](saveUpdates(_0x37bed8[_0xab9a('0x58')],null))[_0xab9a('0x20')](respondWithResult(_0x218569,null))[_0xab9a('0x2a')](handleError(_0x218569,null));};exports[_0xab9a('0x59')]=function(_0x3b6c85,_0x4d7f3d){return db[_0xab9a('0x3a')][_0xab9a('0x56')]({'where':{'id':_0x3b6c85[_0xab9a('0x50')]['id']}})[_0xab9a('0x20')](handleEntityNotFound(_0x4d7f3d,null))['then'](removeEntity(_0x4d7f3d,null))[_0xab9a('0x2a')](handleError(_0x4d7f3d,null));};exports[_0xab9a('0x5a')]=function(_0x197a69,_0x3fbb82){return db['ChatMessage']['describe']()['then'](respondWithResult(_0x3fbb82,null))[_0xab9a('0x2a')](handleError(_0x3fbb82,null));};var interaction_log=require('../../config/logger')(_0xab9a('0x5b'));exports[_0xab9a('0x5c')]=function(_0x19fd72,_0x10905f,_0x26563f){var _0x125ff4={'agent':{},'channel':_0xab9a('0x5d')};if(_0x19fd72['body']['id']){delete _0x19fd72[_0xab9a('0x58')]['id'];}_0x19fd72['body'][_0xab9a('0x5e')]=!![];_0x19fd72['body']['readAt']=moment()[_0xab9a('0x5f')](_0xab9a('0x60'));_0x19fd72[_0xab9a('0x58')][_0xab9a('0x61')]=_0x19fd72['body'][_0xab9a('0x61')]||_0x19fd72['user']['id'];_0x125ff4['agent']['id']=_0x19fd72[_0xab9a('0x58')][_0xab9a('0x61')];return db[_0xab9a('0x3a')][_0xab9a('0x56')]({'where':{'id':_0x19fd72[_0xab9a('0x50')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xab9a('0x62')}]})[_0xab9a('0x20')](handleEntityNotFound(_0x10905f,null))[_0xab9a('0x20')](saveUpdates(_0x19fd72[_0xab9a('0x58')],null))['then'](function(_0x5a1635){if(_0x5a1635){_0x125ff4[_0xab9a('0x28')]=_0x5a1635[_0xab9a('0x63')]({'plain':!![]});return db[_0xab9a('0x64')][_0xab9a('0x56')]({'where':{'id':_0x5a1635[_0xab9a('0x65')]}});}return null;})[_0xab9a('0x20')](handleEntityNotFound(_0x10905f,null))[_0xab9a('0x20')](function(_0x4bc08b){if(_0x4bc08b){return _0x4bc08b[_0xab9a('0x33')]({'UserId':_0x19fd72[_0xab9a('0x58')][_0xab9a('0x61')],'read1stAt':_[_0xab9a('0x66')](_0x4bc08b[_0xab9a('0x67')])?moment()['format'](_0xab9a('0x60')):undefined});}return null;})['then'](function(_0x39289a){if(_0x39289a){_0x125ff4['interaction']=_0x39289a[_0xab9a('0x63')]({'plain':!![]});interaction_log[_0xab9a('0x21')](_0xab9a('0x68'),_0x19fd72[_0xab9a('0x69')]['id'],_0x19fd72[_0xab9a('0x69')][_0xab9a('0x36')],_0x19fd72['user'][_0xab9a('0x6a')],_0x125ff4[_0xab9a('0x6b')]['id'],_0x19fd72['body']?JSON[_0xab9a('0x25')](_0x19fd72[_0xab9a('0x58')]):_0xab9a('0x6c'));return respondWithRpcPromise(_0xab9a('0x6d'),_0xab9a('0x6e'),_0x125ff4);}return null;})[_0xab9a('0x20')](function(_0x4b3d04){if(_0x4b3d04){if(_0x19fd72[_0xab9a('0x58')]['manual']){_0x125ff4['message'][_0xab9a('0x6f')]=util[_0xab9a('0x5f')](_0xab9a('0x70'),_0x19fd72[_0xab9a('0x69')][_0xab9a('0x36')]);_0x125ff4[_0xab9a('0x28')]['channel']=_0x125ff4[_0xab9a('0x71')];_0x125ff4[_0xab9a('0x28')][_0xab9a('0x72')]=_0xab9a('0x5c');return respondWithRpcPromise(_0xab9a('0x73'),_0xab9a('0x73'),{'event':_0xab9a('0x74'),'message':_[_0xab9a('0x4b')](_0x125ff4[_0xab9a('0x28')],JSON['parse'](_0x125ff4[_0xab9a('0x6b')][_0xab9a('0x75')]))},client9002)['then'](function(){return _0x125ff4;});}return _0x125ff4;}return null;})[_0xab9a('0x20')](respondWithResult(_0x10905f,null))[_0xab9a('0x2a')](handleError(_0x10905f,null));};var interaction_log=require(_0xab9a('0x12'))(_0xab9a('0x5b'));exports[_0xab9a('0x76')]=function(_0x375b3a,_0x5ad17b,_0x12b0ab){var _0x5bfae1={'agent':{},'channel':'chat'};if(_0x375b3a[_0xab9a('0x58')]['id']){delete _0x375b3a[_0xab9a('0x58')]['id'];}_0x375b3a[_0xab9a('0x58')][_0xab9a('0x61')]=_0x375b3a[_0xab9a('0x58')][_0xab9a('0x61')]||_0x375b3a[_0xab9a('0x69')]['id'];_0x5bfae1[_0xab9a('0x77')]['id']=_0x375b3a[_0xab9a('0x58')][_0xab9a('0x61')];return db[_0xab9a('0x3a')][_0xab9a('0x56')]({'where':{'id':_0x375b3a[_0xab9a('0x50')]['id'],'UserId':null}})[_0xab9a('0x20')](handleEntityNotFound(_0x5ad17b,null))[_0xab9a('0x20')](function(_0x5703c6){if(_0x5703c6){_0x5bfae1[_0xab9a('0x28')]=_0x5703c6[_0xab9a('0x63')]({'plain':!![]});return db[_0xab9a('0x64')][_0xab9a('0x56')]({'where':{'id':_0x5703c6['ChatInteractionId']}});}return null;})[_0xab9a('0x20')](handleEntityNotFound(_0x5ad17b,null))[_0xab9a('0x20')](function(_0x41b161){if(_0x41b161){_0x5bfae1[_0xab9a('0x6b')]=_0x41b161[_0xab9a('0x63')]({'plain':!![]});interaction_log[_0xab9a('0x21')](_0xab9a('0x78'),_0x375b3a[_0xab9a('0x69')]['id'],_0x375b3a[_0xab9a('0x69')][_0xab9a('0x36')],_0x375b3a[_0xab9a('0x69')]['role'],_0x5bfae1['interaction']['id'],_0x375b3a[_0xab9a('0x58')]?JSON[_0xab9a('0x25')](_0x375b3a['body']):_0xab9a('0x6c'));return respondWithRpcPromise(_0xab9a('0x79'),'rejectMessage',_0x5bfae1);}return null;})[_0xab9a('0x20')](function(_0x40a76e){if(_0x40a76e){_0x40a76e[_0xab9a('0x28')][_0xab9a('0x6f')]=util[_0xab9a('0x5f')]('SIP/%s',_0x375b3a['user']['name']);_0x40a76e[_0xab9a('0x28')][_0xab9a('0x71')]=_0x5bfae1[_0xab9a('0x71')];_0x40a76e['message']['event']='reject';respondWithRpcPromise(_0xab9a('0x73'),_0xab9a('0x73'),{'event':_0xab9a('0x7a'),'message':_0x40a76e[_0xab9a('0x28')]},client9002);return _0x5bfae1;}return null;})[_0xab9a('0x20')](respondWithResult(_0x5ad17b,null))[_0xab9a('0x2a')](handleError(_0x5ad17b,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 4cd8300..2c19531 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 _0xc9c3=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x1d19d8,_0x2239e1){var _0x33a1d3=function(_0x152ed4){while(--_0x152ed4){_0x1d19d8['push'](_0x1d19d8['shift']());}};_0x33a1d3(++_0x2239e1);}(_0xc9c3,0xbe));var _0x3c9c=function(_0x27d8b3,_0xb73b0c){_0x27d8b3=_0x27d8b3-0x0;var _0x2c7ccb=_0xc9c3[_0x27d8b3];return _0x2c7ccb;};'use strict';var EventEmitter=require(_0x3c9c('0x0'));var ChatMessage=require(_0x3c9c('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x3c9c('0x2')](0x0);var events={'afterCreate':_0x3c9c('0x3'),'afterUpdate':_0x3c9c('0x4'),'afterDestroy':_0x3c9c('0x5')};function emitEvent(_0x421a83){return function(_0x46ed8f,_0x3ff900,_0x32f529){ChatMessageEvents[_0x3c9c('0x6')](_0x421a83+':'+_0x46ed8f['id'],_0x46ed8f);ChatMessageEvents['emit'](_0x421a83,_0x46ed8f);_0x32f529(null);};}for(var e in events){if(events[_0x3c9c('0x7')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x3c9c('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x378a=['emit','hasOwnProperty','hook','events','setMaxListeners','save','update','remove'];(function(_0x470e3f,_0x3b513d){var _0x4fd22b=function(_0x35d0b2){while(--_0x35d0b2){_0x470e3f['push'](_0x470e3f['shift']());}};_0x4fd22b(++_0x3b513d);}(_0x378a,0x93));var _0xa378=function(_0x1ceeac,_0x5e9e8a){_0x1ceeac=_0x1ceeac-0x0;var _0x39964e=_0x378a[_0x1ceeac];return _0x39964e;};'use strict';var EventEmitter=require(_0xa378('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xa378('0x1')](0x0);var events={'afterCreate':_0xa378('0x2'),'afterUpdate':_0xa378('0x3'),'afterDestroy':_0xa378('0x4')};function emitEvent(_0x5c8069){return function(_0x4c760b,_0x6b412c,_0x1656e8){ChatMessageEvents[_0xa378('0x5')](_0x5c8069+':'+_0x4c760b['id'],_0x4c760b);ChatMessageEvents['emit'](_0x5c8069,_0x4c760b);_0x1656e8(null);};}for(var e in events){if(events[_0xa378('0x6')](e)){var event=events[e];ChatMessage[_0xa378('0x7')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 01aa9b6..3b47905 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 _0xae26=['catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','exports','chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase','isNil','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt'];(function(_0x1a4014,_0x47ccba){var _0xa502fa=function(_0xe61de3){while(--_0xe61de3){_0x1a4014['push'](_0x1a4014['shift']());}};_0xa502fa(++_0x47ccba);}(_0xae26,0x111));var _0x6ae2=function(_0x291830,_0x386bb0){_0x291830=_0x291830-0x0;var _0x4713e2=_0xae26[_0x291830];return _0x4713e2;};'use strict';var _=require(_0x6ae2('0x0'));var util=require(_0x6ae2('0x1'));var logger=require(_0x6ae2('0x2'))(_0x6ae2('0x3'));var moment=require('moment');var BPromise=require(_0x6ae2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ae2('0x5'));var rimraf=require(_0x6ae2('0x6'));var config=require(_0x6ae2('0x7'));var attributes=require(_0x6ae2('0x8'));module[_0x6ae2('0x9')]=function(_0x245fc0,_0x488a80){return _0x245fc0['define']('ChatMessage',attributes,{'tableName':_0x6ae2('0xa'),'paranoid':![],'indexes':[{'name':_0x6ae2('0xb'),'fields':[_0x6ae2('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x20d7b0,_0x1f1dbf,_0xc0b56d){var _0x4c6d9e=_0x245fc0[_0x6ae2('0xd')];var _0x5d88d7=_0x20d7b0[_0x6ae2('0xe')]({'plain':!![]});if(_0x5d88d7[_0x6ae2('0xf')][_0x6ae2('0x10')]()==='in'||_0x5d88d7['direction'][_0x6ae2('0x10')]()==='out'&&!_0x5d88d7['secret']&&!_[_0x6ae2('0x11')](_0x5d88d7['UserId'])){_0x4c6d9e[_0x6ae2('0x12')][_0x6ae2('0x13')]({'where':{'id':_0x5d88d7[_0x6ae2('0x14')]}})[_0x6ae2('0x15')](function(_0x47ab72){if(_0x47ab72){_0x47ab72[_0x6ae2('0x16')]({'lastMsgAt':_0x5d88d7[_0x6ae2('0x17')],'lastMsgDirection':_0x5d88d7[_0x6ae2('0xf')][_0x6ae2('0x10')]()});}})[_0x6ae2('0x18')](function(_0x1cd108){console['error'](_0x1cd108);});}_0xc0b56d();}},'charset':_0x6ae2('0x19'),'collate':_0x6ae2('0x1a')});}; \ No newline at end of file +var _0x7b68=['../../config/logger','api','moment','bluebird','path','../../config/environment','./chatMessage.attributes','define','chat_messages','fti_chat_messages','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x57b991,_0x3f07b7){var _0xa9b9cd=function(_0x1b6053){while(--_0x1b6053){_0x57b991['push'](_0x57b991['shift']());}};_0xa9b9cd(++_0x3f07b7);}(_0x7b68,0x151));var _0x87b6=function(_0x4e0c97,_0x27808b){_0x4e0c97=_0x4e0c97-0x0;var _0x72813e=_0x7b68[_0x4e0c97];return _0x72813e;};'use strict';var _=require('lodash');var util=require(_0x87b6('0x0'));var logger=require(_0x87b6('0x1'))(_0x87b6('0x2'));var moment=require(_0x87b6('0x3'));var BPromise=require(_0x87b6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x87b6('0x5'));var rimraf=require('rimraf');var config=require(_0x87b6('0x6'));var attributes=require(_0x87b6('0x7'));module['exports']=function(_0x57b38c,_0x47f941){return _0x57b38c[_0x87b6('0x8')]('ChatMessage',attributes,{'tableName':_0x87b6('0x9'),'paranoid':![],'indexes':[{'name':_0x87b6('0xa'),'fields':['body'],'type':_0x87b6('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x34f0ca,_0x338d0f,_0x36b2d1){var _0x5a6c1a=_0x57b38c[_0x87b6('0xc')];var _0xd23b43=_0x34f0ca['get']({'plain':!![]});if(_0xd23b43[_0x87b6('0xd')][_0x87b6('0xe')]()==='in'||_0xd23b43[_0x87b6('0xd')]['toLowerCase']()===_0x87b6('0xf')&&!_0xd23b43[_0x87b6('0x10')]&&!_['isNil'](_0xd23b43[_0x87b6('0x11')])){_0x5a6c1a[_0x87b6('0x12')][_0x87b6('0x13')]({'where':{'id':_0xd23b43[_0x87b6('0x14')]}})[_0x87b6('0x15')](function(_0x1b6463){if(_0x1b6463){_0x1b6463[_0x87b6('0x16')]({'lastMsgAt':_0xd23b43[_0x87b6('0x17')],'lastMsgDirection':_0xd23b43['direction'][_0x87b6('0xe')]()});}})['catch'](function(_0x5cb2c7){console['error'](_0x5cb2c7);});}_0x36b2d1();}},'charset':_0x87b6('0x18'),'collate':_0x87b6('0x19')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index bc7b587..0e2ff6e 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 _0x6990=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','ChatMessage,\x20%s,\x20%s','error','message','info','request\x20sent','result','catch','create','body','options','raw','CreateChatMessage','stringify','moment','randomstring'];(function(_0x155382,_0x42defb){var _0x33aac2=function(_0x23a349){while(--_0x23a349){_0x155382['push'](_0x155382['shift']());}};_0x33aac2(++_0x42defb);}(_0x6990,0x186));var _0x0699=function(_0x518847,_0x482287){_0x518847=_0x518847-0x0;var _0x5089c4=_0x6990[_0x518847];return _0x5089c4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0699('0x0'));var BPromise=require('bluebird');var rs=require(_0x0699('0x1'));var fs=require('fs');var Redis=require(_0x0699('0x2'));var db=require(_0x0699('0x3'))['db'];var utils=require(_0x0699('0x4'));var logger=require('../../config/logger')(_0x0699('0x5'));var config=require('../../config/environment');var jayson=require(_0x0699('0x6'));var client=jayson['client'][_0x0699('0x7')]({'port':0x232a});config[_0x0699('0x8')]=_[_0x0699('0x9')](config[_0x0699('0x8')],{'host':_0x0699('0xa'),'port':0x18eb});var socket=require(_0x0699('0xb'))(new Redis(config[_0x0699('0x8')]));require('./chatMessage.socket')[_0x0699('0xc')](socket);function respondWithRpcPromise(_0x314935,_0x3c5661,_0x3de9f9){return new BPromise(function(_0x4d7035,_0x57b397){return client[_0x0699('0xd')](_0x314935,_0x3de9f9)[_0x0699('0xe')](function(_0x4d0929){logger['info'](_0x0699('0xf'),_0x3c5661,'request\x20sent');logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x3c5661,'request\x20sent',JSON['stringify'](_0x4d0929));if(_0x4d0929[_0x0699('0x10')]){if(_0x4d0929[_0x0699('0x10')]['code']===0x1f4){logger['error'](_0x0699('0xf'),_0x3c5661,_0x4d0929[_0x0699('0x10')]['message']);return _0x57b397(_0x4d0929['error']['message']);}logger[_0x0699('0x10')](_0x0699('0xf'),_0x3c5661,_0x4d0929[_0x0699('0x10')][_0x0699('0x11')]);return _0x4d7035(_0x4d0929[_0x0699('0x10')]['message']);}else{logger[_0x0699('0x12')]('ChatMessage,\x20%s,\x20%s',_0x3c5661,_0x0699('0x13'));_0x4d7035(_0x4d0929[_0x0699('0x14')][_0x0699('0x11')]);}})[_0x0699('0x15')](function(_0x54b7ba){logger[_0x0699('0x10')]('ChatMessage,\x20%s,\x20%s',_0x3c5661,_0x54b7ba);_0x57b397(_0x54b7ba);});});}exports['CreateChatMessage']=function(_0x54e585){var _0x2343d8=this;return new Promise(function(_0x4181b8,_0x10ba1d){return db['ChatMessage'][_0x0699('0x16')](_0x54e585[_0x0699('0x17')],{'raw':_0x54e585[_0x0699('0x18')]?_0x54e585['options'][_0x0699('0x19')]===undefined?!![]:![]:!![]})[_0x0699('0xe')](function(_0x3149ff){logger[_0x0699('0x12')](_0x0699('0x1a'),_0x54e585);logger['debug']('CreateChatMessage',_0x54e585,JSON[_0x0699('0x1b')](_0x3149ff));_0x4181b8(_0x3149ff);})['catch'](function(_0x465f3e){logger[_0x0699('0x10')](_0x0699('0x1a'),_0x465f3e[_0x0699('0x11')],_0x54e585);_0x10ba1d(_0x2343d8[_0x0699('0x10')](0x1f4,_0x465f3e['message']));});});}; \ No newline at end of file +var _0x7da2=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','result','CreateChatMessage','ChatMessage','create','body','options','raw','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0xe55254,_0x3fd3a6){var _0x2be49c=function(_0x2fa088){while(--_0x2fa088){_0xe55254['push'](_0xe55254['shift']());}};_0x2be49c(++_0x3fd3a6);}(_0x7da2,0xa5));var _0x27da=function(_0x3a8ca8,_0x45df86){_0x3a8ca8=_0x3a8ca8-0x0;var _0x473fbc=_0x7da2[_0x3a8ca8];return _0x473fbc;};'use strict';var _=require(_0x27da('0x0'));var util=require(_0x27da('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x27da('0x2'));var fs=require('fs');var Redis=require(_0x27da('0x3'));var db=require(_0x27da('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x27da('0x5'))(_0x27da('0x6'));var config=require(_0x27da('0x7'));var jayson=require(_0x27da('0x8'));var client=jayson[_0x27da('0x9')][_0x27da('0xa')]({'port':0x232a});config[_0x27da('0xb')]=_[_0x27da('0xc')](config[_0x27da('0xb')],{'host':_0x27da('0xd'),'port':0x18eb});var socket=require(_0x27da('0xe'))(new Redis(config[_0x27da('0xb')]));require(_0x27da('0xf'))[_0x27da('0x10')](socket);function respondWithRpcPromise(_0x17b4d8,_0xc0bf57,_0x1663e9){return new BPromise(function(_0x37a944,_0x3cc54f){return client[_0x27da('0x11')](_0x17b4d8,_0x1663e9)[_0x27da('0x12')](function(_0x4f2aa6){logger[_0x27da('0x13')](_0x27da('0x14'),_0xc0bf57,_0x27da('0x15'));logger[_0x27da('0x16')](_0x27da('0x17'),_0xc0bf57,_0x27da('0x15'),JSON['stringify'](_0x4f2aa6));if(_0x4f2aa6[_0x27da('0x18')]){if(_0x4f2aa6[_0x27da('0x18')]['code']===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0xc0bf57,_0x4f2aa6[_0x27da('0x18')][_0x27da('0x19')]);return _0x3cc54f(_0x4f2aa6['error'][_0x27da('0x19')]);}logger[_0x27da('0x18')](_0x27da('0x14'),_0xc0bf57,_0x4f2aa6['error'][_0x27da('0x19')]);return _0x37a944(_0x4f2aa6[_0x27da('0x18')][_0x27da('0x19')]);}else{logger[_0x27da('0x13')]('ChatMessage,\x20%s,\x20%s',_0xc0bf57,_0x27da('0x15'));_0x37a944(_0x4f2aa6[_0x27da('0x1a')][_0x27da('0x19')]);}})['catch'](function(_0x37e350){logger[_0x27da('0x18')](_0x27da('0x14'),_0xc0bf57,_0x37e350);_0x3cc54f(_0x37e350);});});}exports[_0x27da('0x1b')]=function(_0xcada59){var _0x5bae85=this;return new Promise(function(_0xd44801,_0x48e4f8){return db[_0x27da('0x1c')][_0x27da('0x1d')](_0xcada59[_0x27da('0x1e')],{'raw':_0xcada59['options']?_0xcada59[_0x27da('0x1f')][_0x27da('0x20')]===undefined?!![]:![]:!![]})[_0x27da('0x12')](function(_0x12527b){logger[_0x27da('0x13')](_0x27da('0x1b'),_0xcada59);logger[_0x27da('0x16')](_0x27da('0x1b'),_0xcada59,JSON['stringify'](_0x12527b));_0xd44801(_0x12527b);})[_0x27da('0x21')](function(_0x5a16b9){logger[_0x27da('0x18')](_0x27da('0x1b'),_0x5a16b9[_0x27da('0x19')],_0xcada59);_0x48e4f8(_0x5bae85[_0x27da('0x18')](0x1f4,_0x5a16b9[_0x27da('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 2a53638..f0278ed 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 _0x90b1=['save','remove','emit','length','chatMessage:','./chatMessage.events'];(function(_0x55ab4d,_0x23c88d){var _0x173566=function(_0xcdee8a){while(--_0xcdee8a){_0x55ab4d['push'](_0x55ab4d['shift']());}};_0x173566(++_0x23c88d);}(_0x90b1,0x1bb));var _0x190b=function(_0x5d008b,_0x12b7b2){_0x5d008b=_0x5d008b-0x0;var _0x381807=_0x90b1[_0x5d008b];return _0x381807;};'use strict';var ChatMessageEvents=require(_0x190b('0x0'));var events=[_0x190b('0x1'),_0x190b('0x2'),'update'];function createListener(_0x487731,_0x1e5984){return function(_0x44ca85){_0x1e5984[_0x190b('0x3')](_0x487731,_0x44ca85);};}function removeListener(_0x120ddc,_0x4fbcad){return function(){ChatMessageEvents['removeListener'](_0x120ddc,_0x4fbcad);};}exports['register']=function(_0x5da9c1){for(var _0x27ff8c=0x0,_0x34a689=events[_0x190b('0x4')];_0x27ff8c<_0x34a689;_0x27ff8c++){var _0x626aa1=events[_0x27ff8c];var _0x311161=createListener(_0x190b('0x5')+_0x626aa1,_0x5da9c1);ChatMessageEvents['on'](_0x626aa1,_0x311161);}}; \ No newline at end of file +var _0x33af=['emit','removeListener','register','length','chatMessage:','save','update'];(function(_0x2c5b98,_0x1718c7){var _0x328adf=function(_0x58d26f){while(--_0x58d26f){_0x2c5b98['push'](_0x2c5b98['shift']());}};_0x328adf(++_0x1718c7);}(_0x33af,0xec));var _0xf33a=function(_0xa6df52,_0x1b8584){_0xa6df52=_0xa6df52-0x0;var _0x5edd57=_0x33af[_0xa6df52];return _0x5edd57;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xf33a('0x0'),'remove',_0xf33a('0x1')];function createListener(_0x1111c6,_0x267057){return function(_0x4303f1){_0x267057[_0xf33a('0x2')](_0x1111c6,_0x4303f1);};}function removeListener(_0x25f156,_0x4c734e){return function(){ChatMessageEvents[_0xf33a('0x3')](_0x25f156,_0x4c734e);};}exports[_0xf33a('0x4')]=function(_0x583e54){for(var _0xc0dd13=0x0,_0x384b14=events[_0xf33a('0x5')];_0xc0dd13<_0x384b14;_0xc0dd13++){var _0x2f3730=events[_0xc0dd13];var _0x2baabb=createListener(_0xf33a('0x6')+_0x2f3730,_0x583e54);ChatMessageEvents['on'](_0x2f3730,_0x2baabb);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 51021b8..5d75c2b 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 _0xd85f=['destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','describe','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','/:id'];(function(_0x256ab5,_0xf48d8c){var _0x2d2dd7=function(_0x1d0af5){while(--_0x1d0af5){_0x256ab5['push'](_0x256ab5['shift']());}};_0x2d2dd7(++_0xf48d8c);}(_0xd85f,0x1c4));var _0xfd85=function(_0x76e88e,_0x4058cd){_0x76e88e=_0x76e88e-0x0;var _0x1a0b45=_0xd85f[_0x76e88e];return _0x1a0b45;};'use strict';var multer=require(_0xfd85('0x0'));var util=require(_0xfd85('0x1'));var path=require(_0xfd85('0x2'));var timeout=require(_0xfd85('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xfd85('0x4'));var config=require(_0xfd85('0x5'));var controller=require(_0xfd85('0x6'));router[_0xfd85('0x7')]('/',auth[_0xfd85('0x8')](),controller[_0xfd85('0x9')]);router[_0xfd85('0x7')]('/describe',auth[_0xfd85('0x8')](),controller[_0xfd85('0xa')]);router[_0xfd85('0x7')]('/:id',auth[_0xfd85('0x8')](),controller['show']);router[_0xfd85('0xb')]('/',auth[_0xfd85('0x8')](),interaction[_0xfd85('0xc')](_0xfd85('0xd'),_0xfd85('0xe')),controller[_0xfd85('0xf')]);router[_0xfd85('0x10')]('/:id',controller[_0xfd85('0x11')]);router['put'](_0xfd85('0x12'),auth[_0xfd85('0x8')](),controller[_0xfd85('0x13')]);router[_0xfd85('0x10')](_0xfd85('0x14'),auth[_0xfd85('0x8')](),controller['reject']);router[_0xfd85('0x15')](_0xfd85('0x16'),auth[_0xfd85('0x8')](),controller[_0xfd85('0x17')]);module[_0xfd85('0x18')]=router; \ No newline at end of file +var _0xe956=['tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','reject','delete','destroy','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','show','post'];(function(_0xd02b35,_0x57696b){var _0x1bd73c=function(_0x5eaab1){while(--_0x5eaab1){_0xd02b35['push'](_0xd02b35['shift']());}};_0x1bd73c(++_0x57696b);}(_0xe956,0x150));var _0x6e95=function(_0x6c53ec,_0x328f82){_0x6c53ec=_0x6c53ec-0x0;var _0x9cbe13=_0xe956[_0x6c53ec];return _0x9cbe13;};'use strict';var multer=require(_0x6e95('0x0'));var util=require(_0x6e95('0x1'));var path=require(_0x6e95('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e95('0x3'));var router=express[_0x6e95('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6e95('0x5'));var config=require(_0x6e95('0x6'));var controller=require('./chatMessage.controller');router['get']('/',auth[_0x6e95('0x7')](),controller[_0x6e95('0x8')]);router[_0x6e95('0x9')](_0x6e95('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x6e95('0x9')](_0x6e95('0xb'),auth[_0x6e95('0x7')](),controller[_0x6e95('0xc')]);router[_0x6e95('0xd')]('/',auth[_0x6e95('0x7')](),interaction[_0x6e95('0xe')](_0x6e95('0xf'),_0x6e95('0x10')),controller[_0x6e95('0x11')]);router[_0x6e95('0x12')](_0x6e95('0xb'),controller[_0x6e95('0x13')]);router[_0x6e95('0x12')](_0x6e95('0x14'),auth[_0x6e95('0x7')](),controller[_0x6e95('0x15')]);router['put']('/:id/reject',auth[_0x6e95('0x7')](),controller[_0x6e95('0x16')]);router[_0x6e95('0x17')](_0x6e95('0xb'),auth['isAuthenticated'](),controller[_0x6e95('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 56b0ac6..22005be 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 _0x279c=['exports','medium'];(function(_0x1499c4,_0x57c5c3){var _0x3cf45a=function(_0x4bb7cb){while(--_0x4bb7cb){_0x1499c4['push'](_0x1499c4['shift']());}};_0x3cf45a(++_0x57c5c3);}(_0x279c,0x1de));var _0xc279=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x279c[_0x122096];return _0x3d1966;};'use strict';var Sequelize=require('sequelize');module[_0xc279('0x0')]={'body':{'type':Sequelize['TEXT'](_0xc279('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0xc4a2=['TEXT','medium','sequelize'];(function(_0x5a38f0,_0x5f462c){var _0x12c2e5=function(_0x2e3b32){while(--_0x2e3b32){_0x5a38f0['push'](_0x5a38f0['shift']());}};_0x12c2e5(++_0x5f462c);}(_0xc4a2,0x182));var _0x2c4a=function(_0x5f3c5e,_0x23f769){_0x5f3c5e=_0x5f3c5e-0x0;var _0x307f35=_0xc4a2[_0x5f3c5e];return _0x307f35;};'use strict';var Sequelize=require(_0x2c4a('0x0'));module['exports']={'body':{'type':Sequelize[_0x2c4a('0x1')](_0x2c4a('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 f32a6d2..49f91b8 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 _0x0b37=['fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','rawAttributes','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','set','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatOfflineMessage','fieldName','type','model','keys','query','filters','intersection','attributes'];(function(_0x401db5,_0x513be2){var _0xe70993=function(_0x539381){while(--_0x539381){_0x401db5['push'](_0x401db5['shift']());}};_0xe70993(++_0x513be2);}(_0x0b37,0x1d7));var _0x70b3=function(_0x40a7e6,_0x286c40){_0x40a7e6=_0x40a7e6-0x0;var _0xddf317=_0x0b37[_0x40a7e6];return _0xddf317;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x70b3('0x0'));var rimraf=require(_0x70b3('0x1'));var zipdir=require(_0x70b3('0x2'));var jsonpatch=require(_0x70b3('0x3'));var rp=require('request-promise');var moment=require(_0x70b3('0x4'));var BPromise=require(_0x70b3('0x5'));var Mustache=require(_0x70b3('0x6'));var util=require(_0x70b3('0x7'));var path=require(_0x70b3('0x8'));var sox=require(_0x70b3('0x9'));var csv=require('to-csv');var ejs=require(_0x70b3('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x70b3('0xb'));var crypto=require(_0x70b3('0xc'));var jsforce=require(_0x70b3('0xd'));var deskjs=require(_0x70b3('0xe'));var toCsv=require(_0x70b3('0xf'));var querystring=require('querystring');var Papa=require(_0x70b3('0x10'));var Redis=require('ioredis');var authService=require(_0x70b3('0x11'));var qs=require(_0x70b3('0x12'));var as=require(_0x70b3('0x13'));var hardwareService=require(_0x70b3('0x14'));var logger=require(_0x70b3('0x15'))('api');var utils=require(_0x70b3('0x16'));var config=require(_0x70b3('0x17'));var licenseUtil=require(_0x70b3('0x18'));var db=require(_0x70b3('0x19'))['db'];function respondWithStatusCode(_0x419c0b,_0xe0df0c){_0xe0df0c=_0xe0df0c||0xcc;return function(_0x306244){if(_0x306244){return _0x419c0b['sendStatus'](_0xe0df0c);}return _0x419c0b['status'](_0xe0df0c)[_0x70b3('0x1a')]();};}function respondWithResult(_0x5b9c4a,_0x3c035d){_0x3c035d=_0x3c035d||0xc8;return function(_0x23dddd){if(_0x23dddd){return _0x5b9c4a[_0x70b3('0x1b')](_0x3c035d)[_0x70b3('0x1c')](_0x23dddd);}};}function respondWithFilteredResult(_0x357a7a,_0x42bcd2){return function(_0x182819){if(_0x182819){var _0x33acbd=_0x182819[_0x70b3('0x1d')],_0x363007=_0x42bcd2[_0x70b3('0x1e')],_0x58cf8f=_0x42bcd2['offset']+_0x42bcd2[_0x70b3('0x1f')],_0x22a017;if(_0x58cf8f>=_0x33acbd){_0x58cf8f=_0x33acbd;_0x22a017=0xc8;}else{_0x22a017=0xce;}_0x357a7a[_0x70b3('0x1b')](_0x22a017);return _0x357a7a[_0x70b3('0x20')]('Content-Range',_0x363007+'-'+_0x58cf8f+'/'+_0x33acbd)['json'](_0x182819);}return null;};}function patchUpdates(_0x4b512f){return function(_0x339407){try{jsonpatch['apply'](_0x339407,_0x4b512f,!![]);}catch(_0x4828ae){return BPromise[_0x70b3('0x21')](_0x4828ae);}return _0x339407[_0x70b3('0x22')]();};}function saveUpdates(_0x22db68,_0x4cf2c3){return function(_0x3d38c5){if(_0x3d38c5){return _0x3d38c5[_0x70b3('0x23')](_0x22db68)[_0x70b3('0x24')](function(_0x23c7f6){return _0x23c7f6;});}return null;};}function removeEntity(_0x37ee57,_0x183481){return function(_0x51faf8){if(_0x51faf8){return _0x51faf8[_0x70b3('0x25')]()[_0x70b3('0x24')](function(){_0x37ee57['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x336d7d,_0xa530ab){return function(_0x1b7c6c){if(!_0x1b7c6c){_0x336d7d[_0x70b3('0x26')](0x194);}return _0x1b7c6c;};}function handleError(_0x4f15d3,_0x530d7d){_0x530d7d=_0x530d7d||0x1f4;return function(_0x2c6682){logger[_0x70b3('0x27')](_0x2c6682[_0x70b3('0x28')]);if(_0x2c6682['name']){delete _0x2c6682[_0x70b3('0x29')];}_0x4f15d3[_0x70b3('0x1b')](_0x530d7d)[_0x70b3('0x2a')](_0x2c6682);};}exports[_0x70b3('0x2b')]=function(_0x26b2b3,_0x44a25f){var _0x1c1fc0={},_0x4ed57b={},_0x14b6a5={'count':0x0,'rows':[]};var _0x1b9727=_[_0x70b3('0x2c')](db[_0x70b3('0x2d')]['rawAttributes'],function(_0x41204e){return{'name':_0x41204e[_0x70b3('0x2e')],'type':_0x41204e[_0x70b3('0x2f')]['key']};});_0x4ed57b[_0x70b3('0x30')]=_['map'](_0x1b9727,_0x70b3('0x29'));_0x4ed57b['query']=_[_0x70b3('0x31')](_0x26b2b3[_0x70b3('0x32')]);_0x4ed57b[_0x70b3('0x33')]=_[_0x70b3('0x34')](_0x4ed57b['model'],_0x4ed57b['query']);_0x1c1fc0[_0x70b3('0x35')]=_[_0x70b3('0x34')](_0x4ed57b['model'],qs[_0x70b3('0x36')](_0x26b2b3[_0x70b3('0x32')][_0x70b3('0x36')]));_0x1c1fc0[_0x70b3('0x35')]=_0x1c1fc0[_0x70b3('0x35')][_0x70b3('0x37')]?_0x1c1fc0[_0x70b3('0x35')]:_0x4ed57b[_0x70b3('0x30')];if(!_0x26b2b3[_0x70b3('0x32')]['hasOwnProperty']('nolimit')){_0x1c1fc0['limit']=qs['limit'](_0x26b2b3[_0x70b3('0x32')][_0x70b3('0x1f')]);_0x1c1fc0[_0x70b3('0x1e')]=qs[_0x70b3('0x1e')](_0x26b2b3[_0x70b3('0x32')][_0x70b3('0x1e')]);}_0x1c1fc0[_0x70b3('0x38')]=qs['sort'](_0x26b2b3['query'][_0x70b3('0x39')]);_0x1c1fc0[_0x70b3('0x3a')]=qs['filters'](_[_0x70b3('0x3b')](_0x26b2b3[_0x70b3('0x32')],_0x4ed57b[_0x70b3('0x33')]),_0x1b9727);if(_0x26b2b3[_0x70b3('0x32')][_0x70b3('0x3c')]){_0x1c1fc0['where']=_[_0x70b3('0x3d')](_0x1c1fc0[_0x70b3('0x3a')],{'$or':_['map'](_0x1b9727,function(_0x3ce3ba){if(_0x3ce3ba[_0x70b3('0x2f')]!==_0x70b3('0x3e')){var _0xd5b951={};_0xd5b951[_0x3ce3ba[_0x70b3('0x29')]]={'$like':'%'+_0x26b2b3['query'][_0x70b3('0x3c')]+'%'};return _0xd5b951;}})});}_0x1c1fc0=_[_0x70b3('0x3d')]({},_0x1c1fc0,_0x26b2b3['options']);var _0x4635cb={'where':_0x1c1fc0[_0x70b3('0x3a')]};return db['ChatOfflineMessage']['count'](_0x4635cb)[_0x70b3('0x24')](function(_0x4b8928){_0x14b6a5[_0x70b3('0x1d')]=_0x4b8928;if(_0x26b2b3[_0x70b3('0x32')][_0x70b3('0x3f')]){_0x1c1fc0['include']=[{'all':!![]}];}return db[_0x70b3('0x2d')][_0x70b3('0x40')](_0x1c1fc0);})[_0x70b3('0x24')](function(_0x454de6){_0x14b6a5[_0x70b3('0x41')]=_0x454de6;return _0x14b6a5;})[_0x70b3('0x24')](respondWithFilteredResult(_0x44a25f,_0x1c1fc0))['catch'](handleError(_0x44a25f,null));};exports[_0x70b3('0x42')]=function(_0x4cbcb4,_0x56a88e){var _0x49f6b6={'raw':!![],'where':{'id':_0x4cbcb4[_0x70b3('0x43')]['id']}},_0x22b2c6={};_0x22b2c6['model']=_[_0x70b3('0x31')](db[_0x70b3('0x2d')][_0x70b3('0x44')]);_0x22b2c6['query']=_[_0x70b3('0x31')](_0x4cbcb4['query']);_0x22b2c6['filters']=_[_0x70b3('0x34')](_0x22b2c6[_0x70b3('0x30')],_0x22b2c6[_0x70b3('0x32')]);_0x49f6b6['attributes']=_[_0x70b3('0x34')](_0x22b2c6[_0x70b3('0x30')],qs[_0x70b3('0x36')](_0x4cbcb4[_0x70b3('0x32')]['fields']));_0x49f6b6[_0x70b3('0x35')]=_0x49f6b6[_0x70b3('0x35')][_0x70b3('0x37')]?_0x49f6b6[_0x70b3('0x35')]:_0x22b2c6[_0x70b3('0x30')];if(_0x4cbcb4['query'][_0x70b3('0x3f')]){_0x49f6b6['include']=[{'all':!![]}];}_0x49f6b6=_[_0x70b3('0x3d')]({},_0x49f6b6,_0x4cbcb4[_0x70b3('0x45')]);return db['ChatOfflineMessage'][_0x70b3('0x46')](_0x49f6b6)['then'](handleEntityNotFound(_0x56a88e,null))[_0x70b3('0x24')](respondWithResult(_0x56a88e,null))[_0x70b3('0x47')](handleError(_0x56a88e,null));};exports[_0x70b3('0x48')]=function(_0x1e9482,_0x2ed44a){return db['ChatOfflineMessage'][_0x70b3('0x48')](_0x1e9482[_0x70b3('0x49')],{})[_0x70b3('0x24')](respondWithResult(_0x2ed44a,0xc9))[_0x70b3('0x47')](handleError(_0x2ed44a,null));};exports[_0x70b3('0x23')]=function(_0x44b6ab,_0x20ca14){if(_0x44b6ab[_0x70b3('0x49')]['id']){delete _0x44b6ab[_0x70b3('0x49')]['id'];}return db[_0x70b3('0x2d')][_0x70b3('0x46')]({'where':{'id':_0x44b6ab[_0x70b3('0x43')]['id']}})[_0x70b3('0x24')](handleEntityNotFound(_0x20ca14,null))[_0x70b3('0x24')](saveUpdates(_0x44b6ab[_0x70b3('0x49')],null))[_0x70b3('0x24')](respondWithResult(_0x20ca14,null))['catch'](handleError(_0x20ca14,null));};exports[_0x70b3('0x25')]=function(_0xfb50aa,_0x329f99){return db[_0x70b3('0x2d')][_0x70b3('0x46')]({'where':{'id':_0xfb50aa[_0x70b3('0x43')]['id']}})[_0x70b3('0x24')](handleEntityNotFound(_0x329f99,null))[_0x70b3('0x24')](removeEntity(_0x329f99,null))[_0x70b3('0x47')](handleError(_0x329f99,null));};exports['describe']=function(_0x38dcba,_0x1deec1){return db[_0x70b3('0x2d')][_0x70b3('0x4a')]()[_0x70b3('0x24')](respondWithResult(_0x1deec1,null))[_0x70b3('0x47')](handleError(_0x1deec1,null));}; \ No newline at end of file +var _0x1730=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','stack','name','send','ChatOfflineMessage','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x2d4813,_0x589093){var _0x4b9f10=function(_0x4e9511){while(--_0x4e9511){_0x2d4813['push'](_0x2d4813['shift']());}};_0x4b9f10(++_0x589093);}(_0x1730,0xda));var _0x0173=function(_0x43fb8a,_0x52ff7a){_0x43fb8a=_0x43fb8a-0x0;var _0x7db7af=_0x1730[_0x43fb8a];return _0x7db7af;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0173('0x0'));var rimraf=require(_0x0173('0x1'));var zipdir=require(_0x0173('0x2'));var jsonpatch=require(_0x0173('0x3'));var rp=require(_0x0173('0x4'));var moment=require(_0x0173('0x5'));var BPromise=require(_0x0173('0x6'));var Mustache=require(_0x0173('0x7'));var util=require(_0x0173('0x8'));var path=require(_0x0173('0x9'));var sox=require(_0x0173('0xa'));var csv=require(_0x0173('0xb'));var ejs=require(_0x0173('0xc'));var fs=require('fs');var _=require(_0x0173('0xd'));var squel=require(_0x0173('0xe'));var crypto=require(_0x0173('0xf'));var jsforce=require(_0x0173('0x10'));var deskjs=require(_0x0173('0x11'));var toCsv=require('to-csv');var querystring=require(_0x0173('0x12'));var Papa=require(_0x0173('0x13'));var Redis=require(_0x0173('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x0173('0x15'));var as=require(_0x0173('0x16'));var hardwareService=require(_0x0173('0x17'));var logger=require(_0x0173('0x18'))(_0x0173('0x19'));var utils=require('../../config/utils');var config=require(_0x0173('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x0173('0x1b'))['db'];function respondWithStatusCode(_0x403369,_0x3c9e19){_0x3c9e19=_0x3c9e19||0xcc;return function(_0x4887c1){if(_0x4887c1){return _0x403369[_0x0173('0x1c')](_0x3c9e19);}return _0x403369[_0x0173('0x1d')](_0x3c9e19)[_0x0173('0x1e')]();};}function respondWithResult(_0x693155,_0x456f1d){_0x456f1d=_0x456f1d||0xc8;return function(_0x2bcde8){if(_0x2bcde8){return _0x693155[_0x0173('0x1d')](_0x456f1d)[_0x0173('0x1f')](_0x2bcde8);}};}function respondWithFilteredResult(_0x75e482,_0x21a92e){return function(_0x2ba465){if(_0x2ba465){var _0x5a924b=_0x2ba465[_0x0173('0x20')],_0x8e0072=_0x21a92e[_0x0173('0x21')],_0x4c9c20=_0x21a92e[_0x0173('0x21')]+_0x21a92e[_0x0173('0x22')],_0x262162;if(_0x4c9c20>=_0x5a924b){_0x4c9c20=_0x5a924b;_0x262162=0xc8;}else{_0x262162=0xce;}_0x75e482['status'](_0x262162);return _0x75e482[_0x0173('0x23')](_0x0173('0x24'),_0x8e0072+'-'+_0x4c9c20+'/'+_0x5a924b)[_0x0173('0x1f')](_0x2ba465);}return null;};}function patchUpdates(_0x16db42){return function(_0x39991c){try{jsonpatch[_0x0173('0x25')](_0x39991c,_0x16db42,!![]);}catch(_0x5bee44){return BPromise[_0x0173('0x26')](_0x5bee44);}return _0x39991c['save']();};}function saveUpdates(_0x5e6a1b,_0x44c0fa){return function(_0xc03928){if(_0xc03928){return _0xc03928['update'](_0x5e6a1b)[_0x0173('0x27')](function(_0x540f8a){return _0x540f8a;});}return null;};}function removeEntity(_0xb50a98,_0x454065){return function(_0x3fd8ef){if(_0x3fd8ef){return _0x3fd8ef[_0x0173('0x28')]()['then'](function(){_0xb50a98[_0x0173('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c1d42,_0x151503){return function(_0x16cb62){if(!_0x16cb62){_0x4c1d42[_0x0173('0x1c')](0x194);}return _0x16cb62;};}function handleError(_0x957a7c,_0x539763){_0x539763=_0x539763||0x1f4;return function(_0x4a6464){logger['error'](_0x4a6464[_0x0173('0x29')]);if(_0x4a6464[_0x0173('0x2a')]){delete _0x4a6464['name'];}_0x957a7c[_0x0173('0x1d')](_0x539763)[_0x0173('0x2b')](_0x4a6464);};}exports['index']=function(_0x5531a5,_0x659a80){var _0x40cee9={},_0x291719={},_0x19d518={'count':0x0,'rows':[]};var _0x574e45=_['map'](db[_0x0173('0x2c')][_0x0173('0x2d')],function(_0x12c95d){return{'name':_0x12c95d[_0x0173('0x2e')],'type':_0x12c95d[_0x0173('0x2f')][_0x0173('0x30')]};});_0x291719['model']=_[_0x0173('0x31')](_0x574e45,_0x0173('0x2a'));_0x291719[_0x0173('0x32')]=_[_0x0173('0x33')](_0x5531a5[_0x0173('0x32')]);_0x291719[_0x0173('0x34')]=_['intersection'](_0x291719[_0x0173('0x35')],_0x291719[_0x0173('0x32')]);_0x40cee9[_0x0173('0x36')]=_[_0x0173('0x37')](_0x291719['model'],qs[_0x0173('0x38')](_0x5531a5[_0x0173('0x32')]['fields']));_0x40cee9['attributes']=_0x40cee9['attributes'][_0x0173('0x39')]?_0x40cee9[_0x0173('0x36')]:_0x291719['model'];if(!_0x5531a5[_0x0173('0x32')][_0x0173('0x3a')](_0x0173('0x3b'))){_0x40cee9[_0x0173('0x22')]=qs[_0x0173('0x22')](_0x5531a5[_0x0173('0x32')][_0x0173('0x22')]);_0x40cee9[_0x0173('0x21')]=qs[_0x0173('0x21')](_0x5531a5[_0x0173('0x32')][_0x0173('0x21')]);}_0x40cee9['order']=qs['sort'](_0x5531a5[_0x0173('0x32')]['sort']);_0x40cee9[_0x0173('0x3c')]=qs[_0x0173('0x34')](_[_0x0173('0x3d')](_0x5531a5['query'],_0x291719[_0x0173('0x34')]),_0x574e45);if(_0x5531a5[_0x0173('0x32')][_0x0173('0x3e')]){_0x40cee9[_0x0173('0x3c')]=_[_0x0173('0x3f')](_0x40cee9[_0x0173('0x3c')],{'$or':_[_0x0173('0x31')](_0x574e45,function(_0x291141){if(_0x291141[_0x0173('0x2f')]!=='VIRTUAL'){var _0x43b569={};_0x43b569[_0x291141[_0x0173('0x2a')]]={'$like':'%'+_0x5531a5[_0x0173('0x32')][_0x0173('0x3e')]+'%'};return _0x43b569;}})});}_0x40cee9=_[_0x0173('0x3f')]({},_0x40cee9,_0x5531a5[_0x0173('0x40')]);var _0x114896={'where':_0x40cee9['where']};return db['ChatOfflineMessage'][_0x0173('0x20')](_0x114896)[_0x0173('0x27')](function(_0x7552e1){_0x19d518[_0x0173('0x20')]=_0x7552e1;if(_0x5531a5['query'][_0x0173('0x41')]){_0x40cee9[_0x0173('0x42')]=[{'all':!![]}];}return db[_0x0173('0x2c')][_0x0173('0x43')](_0x40cee9);})[_0x0173('0x27')](function(_0x45813c){_0x19d518[_0x0173('0x44')]=_0x45813c;return _0x19d518;})[_0x0173('0x27')](respondWithFilteredResult(_0x659a80,_0x40cee9))[_0x0173('0x45')](handleError(_0x659a80,null));};exports[_0x0173('0x46')]=function(_0x4fac72,_0x5be0e8){var _0x48d742={'raw':!![],'where':{'id':_0x4fac72[_0x0173('0x47')]['id']}},_0x229134={};_0x229134[_0x0173('0x35')]=_[_0x0173('0x33')](db['ChatOfflineMessage'][_0x0173('0x2d')]);_0x229134[_0x0173('0x32')]=_[_0x0173('0x33')](_0x4fac72['query']);_0x229134[_0x0173('0x34')]=_[_0x0173('0x37')](_0x229134[_0x0173('0x35')],_0x229134[_0x0173('0x32')]);_0x48d742[_0x0173('0x36')]=_[_0x0173('0x37')](_0x229134[_0x0173('0x35')],qs['fields'](_0x4fac72[_0x0173('0x32')][_0x0173('0x38')]));_0x48d742[_0x0173('0x36')]=_0x48d742['attributes'][_0x0173('0x39')]?_0x48d742[_0x0173('0x36')]:_0x229134[_0x0173('0x35')];if(_0x4fac72[_0x0173('0x32')][_0x0173('0x41')]){_0x48d742[_0x0173('0x42')]=[{'all':!![]}];}_0x48d742=_['merge']({},_0x48d742,_0x4fac72[_0x0173('0x40')]);return db[_0x0173('0x2c')]['find'](_0x48d742)[_0x0173('0x27')](handleEntityNotFound(_0x5be0e8,null))[_0x0173('0x27')](respondWithResult(_0x5be0e8,null))[_0x0173('0x45')](handleError(_0x5be0e8,null));};exports[_0x0173('0x48')]=function(_0x540a49,_0x656d7b){return db[_0x0173('0x2c')][_0x0173('0x48')](_0x540a49[_0x0173('0x49')],{})[_0x0173('0x27')](respondWithResult(_0x656d7b,0xc9))[_0x0173('0x45')](handleError(_0x656d7b,null));};exports[_0x0173('0x4a')]=function(_0x487bea,_0x2e3a50){if(_0x487bea[_0x0173('0x49')]['id']){delete _0x487bea[_0x0173('0x49')]['id'];}return db[_0x0173('0x2c')][_0x0173('0x4b')]({'where':{'id':_0x487bea[_0x0173('0x47')]['id']}})[_0x0173('0x27')](handleEntityNotFound(_0x2e3a50,null))['then'](saveUpdates(_0x487bea[_0x0173('0x49')],null))[_0x0173('0x27')](respondWithResult(_0x2e3a50,null))['catch'](handleError(_0x2e3a50,null));};exports['destroy']=function(_0x5f0020,_0x44e9c7){return db[_0x0173('0x2c')][_0x0173('0x4b')]({'where':{'id':_0x5f0020[_0x0173('0x47')]['id']}})[_0x0173('0x27')](handleEntityNotFound(_0x44e9c7,null))[_0x0173('0x27')](removeEntity(_0x44e9c7,null))[_0x0173('0x45')](handleError(_0x44e9c7,null));};exports[_0x0173('0x4c')]=function(_0x2da650,_0x506d44){return db[_0x0173('0x2c')][_0x0173('0x4c')]()['then'](respondWithResult(_0x506d44,null))['catch'](handleError(_0x506d44,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 10f11e2..32ebce5 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 _0xcea2=['rimraf','../../config/environment','./chatOfflineMessage.attributes','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x4e2198,_0x399d54){var _0x22fdd7=function(_0x2fc7d0){while(--_0x2fc7d0){_0x4e2198['push'](_0x4e2198['shift']());}};_0x22fdd7(++_0x399d54);}(_0xcea2,0x15a));var _0x2cea=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xcea2[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0x2cea('0x0'));var util=require('util');var logger=require(_0x2cea('0x1'))('api');var moment=require(_0x2cea('0x2'));var BPromise=require(_0x2cea('0x3'));var rp=require(_0x2cea('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2cea('0x5'));var config=require(_0x2cea('0x6'));var attributes=require(_0x2cea('0x7'));module['exports']=function(_0x34f0f2,_0x485c26){return _0x34f0f2[_0x2cea('0x8')](_0x2cea('0x9'),attributes,{'tableName':_0x2cea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2cea('0xb'),'collate':_0x2cea('0xc')});}; \ No newline at end of file +var _0xda55=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','./chatOfflineMessage.attributes'];(function(_0xc430bf,_0x49cf88){var _0x3e4116=function(_0x5831f6){while(--_0x5831f6){_0xc430bf['push'](_0xc430bf['shift']());}};_0x3e4116(++_0x49cf88);}(_0xda55,0x6d));var _0x5da5=function(_0x183a3c,_0xa4cc47){_0x183a3c=_0x183a3c-0x0;var _0x5c41d8=_0xda55[_0x183a3c];return _0x5c41d8;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5da5('0x2'));var BPromise=require(_0x5da5('0x3'));var rp=require(_0x5da5('0x4'));var fs=require('fs');var path=require(_0x5da5('0x5'));var rimraf=require(_0x5da5('0x6'));var config=require('../../config/environment');var attributes=require(_0x5da5('0x7'));module['exports']=function(_0x356a37,_0x58e7b3){return _0x356a37[_0x5da5('0x8')](_0x5da5('0x9'),attributes,{'tableName':_0x5da5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5da5('0xb'),'collate':_0x5da5('0xc')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index a5c06a3..1e96779 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 _0xbd92=['then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xbd92,0x1ed));var _0x2bd9=function(_0x1f854e,_0x22eaa9){_0x1f854e=_0x1f854e-0x0;var _0x5a64ed=_0xbd92[_0x1f854e];return _0x5a64ed;};'use strict';var _=require('lodash');var util=require(_0x2bd9('0x0'));var moment=require(_0x2bd9('0x1'));var BPromise=require(_0x2bd9('0x2'));var rs=require(_0x2bd9('0x3'));var fs=require('fs');var Redis=require(_0x2bd9('0x4'));var db=require(_0x2bd9('0x5'))['db'];var utils=require(_0x2bd9('0x6'));var logger=require(_0x2bd9('0x7'))(_0x2bd9('0x8'));var config=require(_0x2bd9('0x9'));var jayson=require(_0x2bd9('0xa'));var client=jayson[_0x2bd9('0xb')][_0x2bd9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x223e89,_0x4a6b62,_0x5c2ce3){return new BPromise(function(_0x584a63,_0x57d700){return client['request'](_0x223e89,_0x5c2ce3)[_0x2bd9('0xd')](function(_0x194040){logger['info'](_0x2bd9('0xe'),_0x4a6b62,_0x2bd9('0xf'));logger[_0x2bd9('0x10')](_0x2bd9('0x11'),_0x4a6b62,_0x2bd9('0xf'),JSON[_0x2bd9('0x12')](_0x194040));if(_0x194040[_0x2bd9('0x13')]){if(_0x194040['error']['code']===0x1f4){logger['error'](_0x2bd9('0xe'),_0x4a6b62,_0x194040[_0x2bd9('0x13')]['message']);return _0x57d700(_0x194040[_0x2bd9('0x13')]['message']);}logger[_0x2bd9('0x13')](_0x2bd9('0xe'),_0x4a6b62,_0x194040['error'][_0x2bd9('0x14')]);return _0x584a63(_0x194040['error'][_0x2bd9('0x14')]);}else{logger['info'](_0x2bd9('0xe'),_0x4a6b62,'request\x20sent');_0x584a63(_0x194040[_0x2bd9('0x15')][_0x2bd9('0x14')]);}})['catch'](function(_0xc7eb79){logger[_0x2bd9('0x13')](_0x2bd9('0xe'),_0x4a6b62,_0xc7eb79);_0x57d700(_0xc7eb79);});});} \ No newline at end of file +var _0x2824=['code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x586ba6,_0x5d0965){var _0x2fa827=function(_0x2fd849){while(--_0x2fd849){_0x586ba6['push'](_0x586ba6['shift']());}};_0x2fa827(++_0x5d0965);}(_0x2824,0x1bb));var _0x4282=function(_0x37059f,_0x23a5a2){_0x37059f=_0x37059f-0x0;var _0x556332=_0x2824[_0x37059f];return _0x556332;};'use strict';var _=require(_0x4282('0x0'));var util=require(_0x4282('0x1'));var moment=require(_0x4282('0x2'));var BPromise=require('bluebird');var rs=require(_0x4282('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4282('0x4'))['db'];var utils=require(_0x4282('0x5'));var logger=require('../../config/logger')(_0x4282('0x6'));var config=require(_0x4282('0x7'));var jayson=require(_0x4282('0x8'));var client=jayson[_0x4282('0x9')][_0x4282('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c65cb,_0x261f50,_0x1fd2a8){return new BPromise(function(_0x3f919b,_0x3e7997){return client[_0x4282('0xb')](_0x1c65cb,_0x1fd2a8)['then'](function(_0x2f0cbb){logger[_0x4282('0xc')](_0x4282('0xd'),_0x261f50,'request\x20sent');logger[_0x4282('0xe')](_0x4282('0xf'),_0x261f50,_0x4282('0x10'),JSON[_0x4282('0x11')](_0x2f0cbb));if(_0x2f0cbb[_0x4282('0x12')]){if(_0x2f0cbb[_0x4282('0x12')][_0x4282('0x13')]===0x1f4){logger[_0x4282('0x12')](_0x4282('0xd'),_0x261f50,_0x2f0cbb[_0x4282('0x12')][_0x4282('0x14')]);return _0x3e7997(_0x2f0cbb['error']['message']);}logger[_0x4282('0x12')](_0x4282('0xd'),_0x261f50,_0x2f0cbb[_0x4282('0x12')]['message']);return _0x3f919b(_0x2f0cbb[_0x4282('0x12')]['message']);}else{logger[_0x4282('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x261f50,_0x4282('0x10'));_0x3f919b(_0x2f0cbb[_0x4282('0x15')]['message']);}})['catch'](function(_0xa157b5){logger['error'](_0x4282('0xd'),_0x261f50,_0xa157b5);_0x3e7997(_0xa157b5);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 66903ec..3bceb80 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 _0x92ce=['show','post','put','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x5230ed,_0x2eb03e){var _0x43bb42=function(_0x407331){while(--_0x407331){_0x5230ed['push'](_0x5230ed['shift']());}};_0x43bb42(++_0x2eb03e);}(_0x92ce,0xcb));var _0xe92c=function(_0x803404,_0xb37f66){_0x803404=_0x803404-0x0;var _0x397a4e=_0x92ce[_0x803404];return _0x397a4e;};'use strict';var multer=require(_0xe92c('0x0'));var util=require(_0xe92c('0x1'));var path=require(_0xe92c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe92c('0x3')]();var auth=require(_0xe92c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe92c('0x5'));var controller=require(_0xe92c('0x6'));router[_0xe92c('0x7')]('/',auth[_0xe92c('0x8')](),controller[_0xe92c('0x9')]);router[_0xe92c('0x7')](_0xe92c('0xa'),auth[_0xe92c('0x8')](),controller[_0xe92c('0xb')]);router[_0xe92c('0x7')](_0xe92c('0xc'),auth[_0xe92c('0x8')](),controller[_0xe92c('0xd')]);router[_0xe92c('0xe')]('/',auth[_0xe92c('0x8')](),controller['create']);router[_0xe92c('0xf')](_0xe92c('0xc'),auth[_0xe92c('0x8')](),controller['update']);router['delete']('/:id',auth[_0xe92c('0x8')](),controller[_0xe92c('0x10')]);module[_0xe92c('0x11')]=router; \ No newline at end of file +var _0xc37e=['delete','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','/:id','show','post','put','update'];(function(_0x3643c0,_0x190fb5){var _0xe03f72=function(_0x4b9a9e){while(--_0x4b9a9e){_0x3643c0['push'](_0x3643c0['shift']());}};_0xe03f72(++_0x190fb5);}(_0xc37e,0xdf));var _0xec37=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xc37e[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0xec37('0x0'));var util=require(_0xec37('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xec37('0x2'));var router=express[_0xec37('0x3')]();var auth=require(_0xec37('0x4'));var interaction=require(_0xec37('0x5'));var config=require('../../config/environment');var controller=require('./chatOfflineMessage.controller');router[_0xec37('0x6')]('/',auth['isAuthenticated'](),controller[_0xec37('0x7')]);router[_0xec37('0x6')](_0xec37('0x8'),auth[_0xec37('0x9')](),controller['describe']);router[_0xec37('0x6')](_0xec37('0xa'),auth[_0xec37('0x9')](),controller[_0xec37('0xb')]);router[_0xec37('0xc')]('/',auth[_0xec37('0x9')](),controller['create']);router[_0xec37('0xd')]('/:id',auth[_0xec37('0x9')](),controller[_0xec37('0xe')]);router[_0xec37('0xf')](_0xec37('0xa'),auth[_0xec37('0x9')](),controller[_0xec37('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 35db528..b96bbbc 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 _0xe709=['timeout','INTEGER','STRING','ENUM','mouseOver'];(function(_0x7d46b8,_0x1f01c0){var _0x559072=function(_0xd878f7){while(--_0xd878f7){_0x7d46b8['push'](_0x7d46b8['shift']());}};_0x559072(++_0x1f01c0);}(_0xe709,0x11f));var _0x9e70=function(_0x2915cb,_0x2fb7c7){_0x2915cb=_0x2915cb-0x0;var _0xfbcdf9=_0xe709[_0x2915cb];return _0xfbcdf9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9e70('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x9e70('0x1')](_0x9e70('0x2'),_0x9e70('0x3')),'defaultValue':_0x9e70('0x2')},'selector':{'type':Sequelize[_0x9e70('0x0')]},'timeout':{'type':Sequelize[_0x9e70('0x4')]}}; \ No newline at end of file +var _0x7cd6=['STRING','mouseOver','timeout','INTEGER','exports'];(function(_0xa4e3e1,_0x2e53f8){var _0x34ca5f=function(_0x39cc72){while(--_0x39cc72){_0xa4e3e1['push'](_0xa4e3e1['shift']());}};_0x34ca5f(++_0x2e53f8);}(_0x7cd6,0x12b));var _0x67cd=function(_0xe8175f,_0x18d952){_0xe8175f=_0xe8175f-0x0;var _0x2b7dc9=_0x7cd6[_0xe8175f];return _0x2b7dc9;};'use strict';var Sequelize=require('sequelize');module[_0x67cd('0x0')]={'name':{'type':Sequelize[_0x67cd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x67cd('0x2'),_0x67cd('0x3')),'defaultValue':_0x67cd('0x2')},'selector':{'type':Sequelize[_0x67cd('0x1')]},'timeout':{'type':Sequelize[_0x67cd('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 7dca910..5a13cc6 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 _0xd7ee=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','show','model','keys','ChatProactiveAction','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','catch','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse'];(function(_0x43cee2,_0x4fe8c4){var _0x1538eb=function(_0x10d228){while(--_0x10d228){_0x43cee2['push'](_0x43cee2['shift']());}};_0x1538eb(++_0x4fe8c4);}(_0xd7ee,0x16a));var _0xed7e=function(_0x29a08d,_0x551eca){_0x29a08d=_0x29a08d-0x0;var _0x10fc1a=_0xd7ee[_0x29a08d];return _0x10fc1a;};'use strict';var pdf=require(_0xed7e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xed7e('0x1'));var zipdir=require(_0xed7e('0x2'));var jsonpatch=require(_0xed7e('0x3'));var rp=require('request-promise');var moment=require(_0xed7e('0x4'));var BPromise=require(_0xed7e('0x5'));var Mustache=require(_0xed7e('0x6'));var util=require(_0xed7e('0x7'));var path=require(_0xed7e('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xed7e('0x9'));var fs=require('fs');var _=require(_0xed7e('0xa'));var squel=require('squel');var crypto=require(_0xed7e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xed7e('0xc'));var toCsv=require(_0xed7e('0xd'));var querystring=require(_0xed7e('0xe'));var Papa=require(_0xed7e('0xf'));var Redis=require(_0xed7e('0x10'));var authService=require(_0xed7e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xed7e('0x12'));var hardwareService=require(_0xed7e('0x13'));var logger=require(_0xed7e('0x14'))(_0xed7e('0x15'));var utils=require(_0xed7e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xed7e('0x17'));var db=require(_0xed7e('0x18'))['db'];function respondWithStatusCode(_0x35c7ff,_0x43809c){_0x43809c=_0x43809c||0xcc;return function(_0x2a1844){if(_0x2a1844){return _0x35c7ff['sendStatus'](_0x43809c);}return _0x35c7ff[_0xed7e('0x19')](_0x43809c)['end']();};}function respondWithResult(_0x408f5c,_0x5398c6){_0x5398c6=_0x5398c6||0xc8;return function(_0x27b523){if(_0x27b523){return _0x408f5c['status'](_0x5398c6)['json'](_0x27b523);}};}function respondWithFilteredResult(_0x44609b,_0x544336){return function(_0x2ca8f6){if(_0x2ca8f6){var _0x14ddb3=_0x2ca8f6[_0xed7e('0x1a')],_0x58576f=_0x544336[_0xed7e('0x1b')],_0x25dc01=_0x544336[_0xed7e('0x1b')]+_0x544336[_0xed7e('0x1c')],_0x2f4197;if(_0x25dc01>=_0x14ddb3){_0x25dc01=_0x14ddb3;_0x2f4197=0xc8;}else{_0x2f4197=0xce;}_0x44609b[_0xed7e('0x19')](_0x2f4197);return _0x44609b[_0xed7e('0x1d')](_0xed7e('0x1e'),_0x58576f+'-'+_0x25dc01+'/'+_0x14ddb3)[_0xed7e('0x1f')](_0x2ca8f6);}return null;};}function patchUpdates(_0x25dacb){return function(_0x5be69f){try{jsonpatch[_0xed7e('0x20')](_0x5be69f,_0x25dacb,!![]);}catch(_0x560da4){return BPromise[_0xed7e('0x21')](_0x560da4);}return _0x5be69f[_0xed7e('0x22')]();};}function saveUpdates(_0x1f5e95,_0x143e16){return function(_0xf4ff88){if(_0xf4ff88){return _0xf4ff88[_0xed7e('0x23')](_0x1f5e95)[_0xed7e('0x24')](function(_0x2bf920){return _0x2bf920;});}return null;};}function removeEntity(_0x41bea0,_0x3eb96a){return function(_0x4cab91){if(_0x4cab91){return _0x4cab91[_0xed7e('0x25')]()[_0xed7e('0x24')](function(){_0x41bea0[_0xed7e('0x19')](0xcc)[_0xed7e('0x26')]();});}};}function handleEntityNotFound(_0x43f7e4,_0xbc8c04){return function(_0x830e64){if(!_0x830e64){_0x43f7e4[_0xed7e('0x27')](0x194);}return _0x830e64;};}function handleError(_0x53ac84,_0x2010cb){_0x2010cb=_0x2010cb||0x1f4;return function(_0x2e9db9){logger[_0xed7e('0x28')](_0x2e9db9[_0xed7e('0x29')]);if(_0x2e9db9[_0xed7e('0x2a')]){delete _0x2e9db9[_0xed7e('0x2a')];}_0x53ac84['status'](_0x2010cb)[_0xed7e('0x2b')](_0x2e9db9);};}exports[_0xed7e('0x2c')]=function(_0x2fd3ef,_0x50bedb){var _0x1745f7={'raw':!![],'where':{'id':_0x2fd3ef['params']['id']}},_0x303b3c={};_0x303b3c[_0xed7e('0x2d')]=_[_0xed7e('0x2e')](db[_0xed7e('0x2f')]['rawAttributes']);_0x303b3c[_0xed7e('0x30')]=_[_0xed7e('0x2e')](_0x2fd3ef[_0xed7e('0x30')]);_0x303b3c[_0xed7e('0x31')]=_['intersection'](_0x303b3c[_0xed7e('0x2d')],_0x303b3c[_0xed7e('0x30')]);_0x1745f7[_0xed7e('0x32')]=_[_0xed7e('0x33')](_0x303b3c[_0xed7e('0x2d')],qs['fields'](_0x2fd3ef['query'][_0xed7e('0x34')]));_0x1745f7[_0xed7e('0x32')]=_0x1745f7[_0xed7e('0x32')][_0xed7e('0x35')]?_0x1745f7[_0xed7e('0x32')]:_0x303b3c[_0xed7e('0x2d')];if(_0x2fd3ef['query'][_0xed7e('0x36')]){_0x1745f7[_0xed7e('0x37')]=[{'all':!![]}];}_0x1745f7=_[_0xed7e('0x38')]({},_0x1745f7,_0x2fd3ef[_0xed7e('0x39')]);return db['ChatProactiveAction'][_0xed7e('0x3a')](_0x1745f7)[_0xed7e('0x24')](handleEntityNotFound(_0x50bedb,null))[_0xed7e('0x24')](respondWithResult(_0x50bedb,null))[_0xed7e('0x3b')](handleError(_0x50bedb,null));};exports[_0xed7e('0x3c')]=function(_0x1881ec,_0x1d0a1c){return db[_0xed7e('0x2f')][_0xed7e('0x3c')](_0x1881ec[_0xed7e('0x3d')],{})['then'](respondWithResult(_0x1d0a1c,0xc9))[_0xed7e('0x3b')](handleError(_0x1d0a1c,null));};exports['update']=function(_0xd309ae,_0x10e66c){if(_0xd309ae[_0xed7e('0x3d')]['id']){delete _0xd309ae[_0xed7e('0x3d')]['id'];}return db[_0xed7e('0x2f')][_0xed7e('0x3a')]({'where':{'id':_0xd309ae['params']['id']}})[_0xed7e('0x24')](handleEntityNotFound(_0x10e66c,null))['then'](saveUpdates(_0xd309ae[_0xed7e('0x3d')],null))[_0xed7e('0x24')](respondWithResult(_0x10e66c,null))[_0xed7e('0x3b')](handleError(_0x10e66c,null));};exports[_0xed7e('0x25')]=function(_0x424b08,_0xbf6140){return db[_0xed7e('0x2f')][_0xed7e('0x3a')]({'where':{'id':_0x424b08[_0xed7e('0x3e')]['id']}})['then'](handleEntityNotFound(_0xbf6140,null))['then'](removeEntity(_0xbf6140,null))[_0xed7e('0x3b')](handleError(_0xbf6140,null));}; \ No newline at end of file +var _0xdd7e=['filters','intersection','attributes','length','includeAll','include','merge','options','ChatProactiveAction','catch','body','find','eml-format','rimraf','zip-dir','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','../../config/license/hardware','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','stack','send','show','params','model','keys','query'];(function(_0x2ce6a5,_0x386c0d){var _0x3ddf55=function(_0x2dc0da){while(--_0x2dc0da){_0x2ce6a5['push'](_0x2ce6a5['shift']());}};_0x3ddf55(++_0x386c0d);}(_0xdd7e,0x1b0));var _0xedd7=function(_0x1a8432,_0x1d9a6c){_0x1a8432=_0x1a8432-0x0;var _0x578f95=_0xdd7e[_0x1a8432];return _0x578f95;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xedd7('0x0'));var rimraf=require(_0xedd7('0x1'));var zipdir=require(_0xedd7('0x2'));var jsonpatch=require(_0xedd7('0x3'));var rp=require(_0xedd7('0x4'));var moment=require(_0xedd7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xedd7('0x6'));var util=require(_0xedd7('0x7'));var path=require('path');var sox=require(_0xedd7('0x8'));var csv=require(_0xedd7('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xedd7('0xa'));var squel=require(_0xedd7('0xb'));var crypto=require(_0xedd7('0xc'));var jsforce=require(_0xedd7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xedd7('0x9'));var querystring=require(_0xedd7('0xe'));var Papa=require(_0xedd7('0xf'));var Redis=require(_0xedd7('0x10'));var authService=require(_0xedd7('0x11'));var qs=require(_0xedd7('0x12'));var as=require(_0xedd7('0x13'));var hardwareService=require(_0xedd7('0x14'));var logger=require('../../config/logger')(_0xedd7('0x15'));var utils=require(_0xedd7('0x16'));var config=require(_0xedd7('0x17'));var licenseUtil=require(_0xedd7('0x18'));var db=require(_0xedd7('0x19'))['db'];function respondWithStatusCode(_0x133e09,_0x50411a){_0x50411a=_0x50411a||0xcc;return function(_0x2c9cae){if(_0x2c9cae){return _0x133e09[_0xedd7('0x1a')](_0x50411a);}return _0x133e09['status'](_0x50411a)[_0xedd7('0x1b')]();};}function respondWithResult(_0x9ec805,_0x2b144b){_0x2b144b=_0x2b144b||0xc8;return function(_0x1b85c4){if(_0x1b85c4){return _0x9ec805[_0xedd7('0x1c')](_0x2b144b)[_0xedd7('0x1d')](_0x1b85c4);}};}function respondWithFilteredResult(_0x31c604,_0x482aa2){return function(_0x452254){if(_0x452254){var _0x58c1cd=_0x452254[_0xedd7('0x1e')],_0x3a4539=_0x482aa2[_0xedd7('0x1f')],_0x42dc29=_0x482aa2[_0xedd7('0x1f')]+_0x482aa2[_0xedd7('0x20')],_0x250290;if(_0x42dc29>=_0x58c1cd){_0x42dc29=_0x58c1cd;_0x250290=0xc8;}else{_0x250290=0xce;}_0x31c604['status'](_0x250290);return _0x31c604[_0xedd7('0x21')](_0xedd7('0x22'),_0x3a4539+'-'+_0x42dc29+'/'+_0x58c1cd)[_0xedd7('0x1d')](_0x452254);}return null;};}function patchUpdates(_0x1f28e0){return function(_0x232dde){try{jsonpatch[_0xedd7('0x23')](_0x232dde,_0x1f28e0,!![]);}catch(_0x2cfb4a){return BPromise[_0xedd7('0x24')](_0x2cfb4a);}return _0x232dde[_0xedd7('0x25')]();};}function saveUpdates(_0x533df1,_0x33bcc0){return function(_0x5e1ca4){if(_0x5e1ca4){return _0x5e1ca4[_0xedd7('0x26')](_0x533df1)['then'](function(_0x12b08c){return _0x12b08c;});}return null;};}function removeEntity(_0x2a7378,_0x471c6a){return function(_0x11f846){if(_0x11f846){return _0x11f846[_0xedd7('0x27')]()[_0xedd7('0x28')](function(){_0x2a7378[_0xedd7('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a6e38,_0x5cabd7){return function(_0x523e22){if(!_0x523e22){_0x4a6e38['sendStatus'](0x194);}return _0x523e22;};}function handleError(_0x18cf27,_0x2cf716){_0x2cf716=_0x2cf716||0x1f4;return function(_0x4575d0){logger['error'](_0x4575d0[_0xedd7('0x29')]);if(_0x4575d0['name']){delete _0x4575d0['name'];}_0x18cf27[_0xedd7('0x1c')](_0x2cf716)[_0xedd7('0x2a')](_0x4575d0);};}exports[_0xedd7('0x2b')]=function(_0x350384,_0x51ca77){var _0x39e524={'raw':!![],'where':{'id':_0x350384[_0xedd7('0x2c')]['id']}},_0x3a4f74={};_0x3a4f74[_0xedd7('0x2d')]=_[_0xedd7('0x2e')](db['ChatProactiveAction']['rawAttributes']);_0x3a4f74[_0xedd7('0x2f')]=_['keys'](_0x350384['query']);_0x3a4f74[_0xedd7('0x30')]=_[_0xedd7('0x31')](_0x3a4f74[_0xedd7('0x2d')],_0x3a4f74[_0xedd7('0x2f')]);_0x39e524[_0xedd7('0x32')]=_[_0xedd7('0x31')](_0x3a4f74[_0xedd7('0x2d')],qs['fields'](_0x350384['query']['fields']));_0x39e524[_0xedd7('0x32')]=_0x39e524[_0xedd7('0x32')][_0xedd7('0x33')]?_0x39e524['attributes']:_0x3a4f74[_0xedd7('0x2d')];if(_0x350384[_0xedd7('0x2f')][_0xedd7('0x34')]){_0x39e524[_0xedd7('0x35')]=[{'all':!![]}];}_0x39e524=_[_0xedd7('0x36')]({},_0x39e524,_0x350384[_0xedd7('0x37')]);return db[_0xedd7('0x38')]['find'](_0x39e524)[_0xedd7('0x28')](handleEntityNotFound(_0x51ca77,null))[_0xedd7('0x28')](respondWithResult(_0x51ca77,null))[_0xedd7('0x39')](handleError(_0x51ca77,null));};exports['create']=function(_0x398698,_0x852000){return db[_0xedd7('0x38')]['create'](_0x398698[_0xedd7('0x3a')],{})[_0xedd7('0x28')](respondWithResult(_0x852000,0xc9))[_0xedd7('0x39')](handleError(_0x852000,null));};exports[_0xedd7('0x26')]=function(_0x4c618d,_0x33a39c){if(_0x4c618d[_0xedd7('0x3a')]['id']){delete _0x4c618d[_0xedd7('0x3a')]['id'];}return db['ChatProactiveAction'][_0xedd7('0x3b')]({'where':{'id':_0x4c618d[_0xedd7('0x2c')]['id']}})[_0xedd7('0x28')](handleEntityNotFound(_0x33a39c,null))[_0xedd7('0x28')](saveUpdates(_0x4c618d[_0xedd7('0x3a')],null))[_0xedd7('0x28')](respondWithResult(_0x33a39c,null))['catch'](handleError(_0x33a39c,null));};exports[_0xedd7('0x27')]=function(_0xe17fb,_0x37dcc8){return db[_0xedd7('0x38')]['find']({'where':{'id':_0xe17fb[_0xedd7('0x2c')]['id']}})[_0xedd7('0x28')](handleEntityNotFound(_0x37dcc8,null))['then'](removeEntity(_0x37dcc8,null))[_0xedd7('0x39')](handleError(_0x37dcc8,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index af14d02..8271836 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 _0xa87f=['path','rimraf','../../config/environment','exports','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','api','moment','bluebird'];(function(_0x354164,_0x4c30de){var _0x5db9a8=function(_0x319b08){while(--_0x319b08){_0x354164['push'](_0x354164['shift']());}};_0x5db9a8(++_0x4c30de);}(_0xa87f,0xe2));var _0xfa87=function(_0x1f8eaa,_0x484949){_0x1f8eaa=_0x1f8eaa-0x0;var _0x46ef8c=_0xa87f[_0x1f8eaa];return _0x46ef8c;};'use strict';var _=require('lodash');var util=require(_0xfa87('0x0'));var logger=require(_0xfa87('0x1'))(_0xfa87('0x2'));var moment=require(_0xfa87('0x3'));var BPromise=require(_0xfa87('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa87('0x5'));var rimraf=require(_0xfa87('0x6'));var config=require(_0xfa87('0x7'));var attributes=require('./chatProactiveAction.attributes');module[_0xfa87('0x8')]=function(_0x4106f9,_0x38d845){return _0x4106f9['define'](_0xfa87('0x9'),attributes,{'tableName':_0xfa87('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a91=['api','moment','request-promise','rimraf','../../config/environment','exports','define','chat_proactive_actions','lodash','util','../../config/logger'];(function(_0x28043f,_0x1dfabb){var _0x5c59f6=function(_0x8fb724){while(--_0x8fb724){_0x28043f['push'](_0x28043f['shift']());}};_0x5c59f6(++_0x1dfabb);}(_0x2a91,0x1b5));var _0x12a9=function(_0x64235e,_0x54a9d1){_0x64235e=_0x64235e-0x0;var _0x145482=_0x2a91[_0x64235e];return _0x145482;};'use strict';var _=require(_0x12a9('0x0'));var util=require(_0x12a9('0x1'));var logger=require(_0x12a9('0x2'))(_0x12a9('0x3'));var moment=require(_0x12a9('0x4'));var BPromise=require('bluebird');var rp=require(_0x12a9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x12a9('0x6'));var config=require(_0x12a9('0x7'));var attributes=require('./chatProactiveAction.attributes');module[_0x12a9('0x8')]=function(_0x5979d2,_0x559968){return _0x5979d2[_0x12a9('0x9')]('ChatProactiveAction',attributes,{'tableName':_0x12a9('0xa'),'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 571035f..c216ffd 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 _0x8d83=['message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x35cfa6,_0x56500d){var _0x43c6a7=function(_0x21beac){while(--_0x21beac){_0x35cfa6['push'](_0x35cfa6['shift']());}};_0x43c6a7(++_0x56500d);}(_0x8d83,0x178));var _0x38d8=function(_0x273ac8,_0x4ede8f){_0x273ac8=_0x273ac8-0x0;var _0x254f9b=_0x8d83[_0x273ac8];return _0x254f9b;};'use strict';var _=require(_0x38d8('0x0'));var util=require(_0x38d8('0x1'));var moment=require('moment');var BPromise=require(_0x38d8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x38d8('0x3'));var db=require(_0x38d8('0x4'))['db'];var utils=require(_0x38d8('0x5'));var logger=require(_0x38d8('0x6'))('rpc');var config=require(_0x38d8('0x7'));var jayson=require(_0x38d8('0x8'));var client=jayson[_0x38d8('0x9')][_0x38d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x289fbf,_0x59e00d,_0x20abe6){return new BPromise(function(_0x446533,_0x3c065e){return client[_0x38d8('0xb')](_0x289fbf,_0x20abe6)[_0x38d8('0xc')](function(_0x3b5f2c){logger['info'](_0x38d8('0xd'),_0x59e00d,_0x38d8('0xe'));logger[_0x38d8('0xf')](_0x38d8('0x10'),_0x59e00d,'request\x20sent',JSON[_0x38d8('0x11')](_0x3b5f2c));if(_0x3b5f2c[_0x38d8('0x12')]){if(_0x3b5f2c['error'][_0x38d8('0x13')]===0x1f4){logger[_0x38d8('0x12')](_0x38d8('0xd'),_0x59e00d,_0x3b5f2c[_0x38d8('0x12')]['message']);return _0x3c065e(_0x3b5f2c['error'][_0x38d8('0x14')]);}logger[_0x38d8('0x12')](_0x38d8('0xd'),_0x59e00d,_0x3b5f2c[_0x38d8('0x12')][_0x38d8('0x14')]);return _0x446533(_0x3b5f2c[_0x38d8('0x12')][_0x38d8('0x14')]);}else{logger['info'](_0x38d8('0xd'),_0x59e00d,_0x38d8('0xe'));_0x446533(_0x3b5f2c[_0x38d8('0x15')][_0x38d8('0x14')]);}})['catch'](function(_0x1ca455){logger[_0x38d8('0x12')](_0x38d8('0xd'),_0x59e00d,_0x1ca455);_0x3c065e(_0x1ca455);});});} \ No newline at end of file +var _0x79d9=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x4e6b4d,_0x10ac13){var _0x25efdd=function(_0x503039){while(--_0x503039){_0x4e6b4d['push'](_0x4e6b4d['shift']());}};_0x25efdd(++_0x10ac13);}(_0x79d9,0x107));var _0x979d=function(_0x43a7a5,_0x4258ca){_0x43a7a5=_0x43a7a5-0x0;var _0x763dc5=_0x79d9[_0x43a7a5];return _0x763dc5;};'use strict';var _=require('lodash');var util=require(_0x979d('0x0'));var moment=require(_0x979d('0x1'));var BPromise=require(_0x979d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x979d('0x3'));var db=require(_0x979d('0x4'))['db'];var utils=require(_0x979d('0x5'));var logger=require('../../config/logger')(_0x979d('0x6'));var config=require(_0x979d('0x7'));var jayson=require(_0x979d('0x8'));var client=jayson[_0x979d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1165df,_0x27b46c,_0xd5f08c){return new BPromise(function(_0x19ebff,_0x72d2dc){return client['request'](_0x1165df,_0xd5f08c)[_0x979d('0xa')](function(_0x805a00){logger[_0x979d('0xb')](_0x979d('0xc'),_0x27b46c,_0x979d('0xd'));logger[_0x979d('0xe')](_0x979d('0xf'),_0x27b46c,_0x979d('0xd'),JSON[_0x979d('0x10')](_0x805a00));if(_0x805a00[_0x979d('0x11')]){if(_0x805a00[_0x979d('0x11')][_0x979d('0x12')]===0x1f4){logger[_0x979d('0x11')](_0x979d('0xc'),_0x27b46c,_0x805a00[_0x979d('0x11')][_0x979d('0x13')]);return _0x72d2dc(_0x805a00[_0x979d('0x11')]['message']);}logger[_0x979d('0x11')](_0x979d('0xc'),_0x27b46c,_0x805a00[_0x979d('0x11')][_0x979d('0x13')]);return _0x19ebff(_0x805a00[_0x979d('0x11')][_0x979d('0x13')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x27b46c,_0x979d('0xd'));_0x19ebff(_0x805a00[_0x979d('0x14')][_0x979d('0x13')]);}})[_0x979d('0x15')](function(_0x5c5bc0){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x27b46c,_0x5c5bc0);_0x72d2dc(_0x5c5bc0);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index b40c883..7289467 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 _0x032e=['update','delete','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x032e,0x124));var _0xe032=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x032e[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0xe032('0x0'));var util=require('util');var path=require(_0xe032('0x1'));var timeout=require(_0xe032('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xe032('0x3'));var interaction=require(_0xe032('0x4'));var config=require(_0xe032('0x5'));var controller=require(_0xe032('0x6'));router[_0xe032('0x7')](_0xe032('0x8'),auth[_0xe032('0x9')](),controller[_0xe032('0xa')]);router[_0xe032('0xb')]('/',auth[_0xe032('0x9')](),controller[_0xe032('0xc')]);router[_0xe032('0xd')](_0xe032('0x8'),auth[_0xe032('0x9')](),controller[_0xe032('0xe')]);router[_0xe032('0xf')](_0xe032('0x8'),auth[_0xe032('0x9')](),controller['destroy']);module[_0xe032('0x10')]=router; \ No newline at end of file +var _0xd67e=['util','connect-timeout','express','../../config/environment','./chatProactiveAction.controller','get','isAuthenticated','show','post','create','/:id','update','destroy','exports','multer'];(function(_0x1ada54,_0x31f1d4){var _0x58a424=function(_0x1d390e){while(--_0x1d390e){_0x1ada54['push'](_0x1ada54['shift']());}};_0x58a424(++_0x31f1d4);}(_0xd67e,0xb3));var _0xed67=function(_0x56d47c,_0x441de7){_0x56d47c=_0x56d47c-0x0;var _0x482578=_0xd67e[_0x56d47c];return _0x482578;};'use strict';var multer=require(_0xed67('0x0'));var util=require(_0xed67('0x1'));var path=require('path');var timeout=require(_0xed67('0x2'));var express=require(_0xed67('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xed67('0x4'));var controller=require(_0xed67('0x5'));router[_0xed67('0x6')]('/:id',auth[_0xed67('0x7')](),controller[_0xed67('0x8')]);router[_0xed67('0x9')]('/',auth[_0xed67('0x7')](),controller[_0xed67('0xa')]);router['put'](_0xed67('0xb'),auth[_0xed67('0x7')](),controller[_0xed67('0xc')]);router['delete']('/:id',auth[_0xed67('0x7')](),controller[_0xed67('0xd')]);module[_0xed67('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 3823ab4..b3e311c 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 _0xdc90=['STRING','ENUM','rrmemory','beepall','roundrobin','exports'];(function(_0x26b90b,_0xa29c65){var _0x196aff=function(_0x2e1bd4){while(--_0x2e1bd4){_0x26b90b['push'](_0x26b90b['shift']());}};_0x196aff(++_0xa29c65);}(_0xdc90,0x1a9));var _0x0dc9=function(_0xf3a9b7,_0x3e0912){_0xf3a9b7=_0xf3a9b7-0x0;var _0x587881=_0xdc90[_0xf3a9b7];return _0x587881;};'use strict';var Sequelize=require('sequelize');module[_0x0dc9('0x0')]={'name':{'type':Sequelize[_0x0dc9('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0dc9('0x2')](_0x0dc9('0x3'),_0x0dc9('0x4'),_0x0dc9('0x5'))}}; \ No newline at end of file +var _0xbc7d=['sequelize','exports','STRING','name','INTEGER','rrmemory','beepall','roundrobin'];(function(_0xd21fe7,_0x225a39){var _0x14d570=function(_0x3c0674){while(--_0x3c0674){_0xd21fe7['push'](_0xd21fe7['shift']());}};_0x14d570(++_0x225a39);}(_0xbc7d,0x98));var _0xdbc7=function(_0x585133,_0x2412a1){_0x585133=_0x585133-0x0;var _0x18254a=_0xbc7d[_0x585133];return _0x18254a;};'use strict';var Sequelize=require(_0xdbc7('0x0'));module[_0xdbc7('0x1')]={'name':{'type':Sequelize[_0xdbc7('0x2')],'unique':_0xdbc7('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdbc7('0x2')]},'timeout':{'type':Sequelize[_0xdbc7('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xdbc7('0x5'),_0xdbc7('0x6'),_0xdbc7('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index dfc06bb..404cbf9 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 _0x9562=['options','includeAll','include','ChatQueue','params','find','create','body','user','role','get','ChatQueues','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','sort','UserChatQueue','findAll','User','findAndCountAll','UserId','agent','chatPause','updatedAt','rows','format','SIP','createdAt','getTeams','findOne','Team','ids','Agents','online','interface','flatMap','transaction','addTeams','each','findOrCreate','forEach','emit','select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','UserProfileResource','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge'];(function(_0x35e7d6,_0x242bf1){var _0x383a27=function(_0x312230){while(--_0x312230){_0x35e7d6['push'](_0x35e7d6['shift']());}};_0x383a27(++_0x242bf1);}(_0x9562,0xde));var _0x2956=function(_0x2f8873,_0x815b8d){_0x2f8873=_0x2f8873-0x0;var _0x5de4ff=_0x9562[_0x2f8873];return _0x5de4ff;};'use strict';var pdf=require(_0x2956('0x0'));var emlformat=require(_0x2956('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2956('0x2'));var jsonpatch=require(_0x2956('0x3'));var rp=require(_0x2956('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2956('0x5'));var csv=require(_0x2956('0x6'));var ejs=require(_0x2956('0x7'));var fs=require('fs');var _=require(_0x2956('0x8'));var squel=require(_0x2956('0x9'));var crypto=require(_0x2956('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2956('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2956('0xc'));var Redis=require(_0x2956('0xd'));var authService=require(_0x2956('0xe'));var qs=require(_0x2956('0xf'));var as=require(_0x2956('0x10'));var hardwareService=require(_0x2956('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x2956('0x12'));var config=require(_0x2956('0x13'));var licenseUtil=require(_0x2956('0x14'));var db=require(_0x2956('0x15'))['db'];config[_0x2956('0x16')]=_['defaults'](config[_0x2956('0x16')],{'host':_0x2956('0x17'),'port':0x18eb});var socket=require(_0x2956('0x18'))(new Redis(config['redis']));require(_0x2956('0x19'))[_0x2956('0x1a')](socket);var jayson=require(_0x2956('0x1b'));var client=jayson[_0x2956('0x1c')][_0x2956('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x45b379,_0x35e219,_0x2e05bc,_0x43080c){return new BPromise(function(_0x117f14,_0x247cc8){var _0x9c0662=_0x43080c||client;return _0x9c0662[_0x2956('0x1e')](_0x45b379,_0x2e05bc)[_0x2956('0x1f')](function(_0x3ba09c){logger['info']('ChatQueue,\x20%s,\x20%s',_0x35e219,'request\x20sent');logger[_0x2956('0x20')](_0x2956('0x21'),_0x35e219,_0x2956('0x22'),JSON[_0x2956('0x23')](_0x3ba09c));if(_0x3ba09c['error']){if(_0x3ba09c[_0x2956('0x24')][_0x2956('0x25')]===0x1f4){logger[_0x2956('0x24')](_0x2956('0x26'),_0x35e219,_0x3ba09c[_0x2956('0x24')][_0x2956('0x27')]);return _0x247cc8(_0x3ba09c['error']['message']);}logger[_0x2956('0x24')](_0x2956('0x26'),_0x35e219,_0x3ba09c[_0x2956('0x24')][_0x2956('0x27')]);return _0x117f14(_0x3ba09c[_0x2956('0x24')][_0x2956('0x27')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x35e219,_0x2956('0x22'));_0x117f14(_0x3ba09c['result'][_0x2956('0x27')]);}})[_0x2956('0x28')](function(_0x9f9fc4){logger[_0x2956('0x24')](_0x2956('0x26'),_0x35e219,_0x9f9fc4);_0x247cc8(_0x9f9fc4);});});}function respondWithStatusCode(_0x5483bd,_0x5119ad){_0x5119ad=_0x5119ad||0xcc;return function(_0x3cc077){if(_0x3cc077){return _0x5483bd[_0x2956('0x29')](_0x5119ad);}return _0x5483bd[_0x2956('0x2a')](_0x5119ad)[_0x2956('0x2b')]();};}function respondWithResult(_0x5cc936,_0x172d54){_0x172d54=_0x172d54||0xc8;return function(_0x249ada){if(_0x249ada){return _0x5cc936[_0x2956('0x2a')](_0x172d54)[_0x2956('0x2c')](_0x249ada);}};}function respondWithFilteredResult(_0x45df4b,_0x50ced6){return function(_0x2d955c){if(_0x2d955c){var _0x2ca70a=_0x2d955c[_0x2956('0x2d')],_0x4dc286=_0x50ced6[_0x2956('0x2e')],_0x501843=_0x50ced6[_0x2956('0x2e')]+_0x50ced6[_0x2956('0x2f')],_0x2f08a1;if(_0x501843>=_0x2ca70a){_0x501843=_0x2ca70a;_0x2f08a1=0xc8;}else{_0x2f08a1=0xce;}_0x45df4b['status'](_0x2f08a1);return _0x45df4b[_0x2956('0x30')]('Content-Range',_0x4dc286+'-'+_0x501843+'/'+_0x2ca70a)['json'](_0x2d955c);}return null;};}function patchUpdates(_0x2a1733){return function(_0x33c032){try{jsonpatch[_0x2956('0x31')](_0x33c032,_0x2a1733,!![]);}catch(_0x1c709b){return BPromise[_0x2956('0x32')](_0x1c709b);}return _0x33c032[_0x2956('0x33')]();};}function saveUpdates(_0x56003d,_0x4ab99b){return function(_0x31cdbc){if(_0x31cdbc){return _0x31cdbc[_0x2956('0x34')](_0x56003d)[_0x2956('0x1f')](function(_0x83f722){return _0x83f722;});}return null;};}function removeEntity(_0x3e2bf1,_0x10d915){return function(_0x5ae141){if(_0x5ae141){return _0x5ae141['destroy']()['then'](function(){var _0x296f93=_0x5ae141['get']({'plain':!![]});var _0x56b8ed='ChatQueues';return db[_0x2956('0x35')][_0x2956('0x36')]({'where':{'type':_0x56b8ed,'resourceId':_0x296f93['id']}})[_0x2956('0x1f')](function(){return _0x5ae141;});})[_0x2956('0x1f')](function(){_0x3e2bf1[_0x2956('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51f30f,_0x7d91d7){return function(_0x356159){if(!_0x356159){_0x51f30f[_0x2956('0x29')](0x194);}return _0x356159;};}function handleError(_0x15e962,_0x4db97f){_0x4db97f=_0x4db97f||0x1f4;return function(_0x3f9be6){logger[_0x2956('0x24')](_0x3f9be6[_0x2956('0x37')]);if(_0x3f9be6[_0x2956('0x38')]){delete _0x3f9be6['name'];}_0x15e962['status'](_0x4db97f)[_0x2956('0x39')](_0x3f9be6);};}exports[_0x2956('0x3a')]=function(_0x5ce7db,_0x3afdaf){var _0x1b2d8b={},_0x1f8e33={},_0xcce00c={'count':0x0,'rows':[]};var _0xa4f03a=_[_0x2956('0x3b')](db['ChatQueue'][_0x2956('0x3c')],function(_0x4b8f7a){return{'name':_0x4b8f7a[_0x2956('0x3d')],'type':_0x4b8f7a['type'][_0x2956('0x3e')]};});_0x1f8e33[_0x2956('0x3f')]=_[_0x2956('0x3b')](_0xa4f03a,_0x2956('0x38'));_0x1f8e33['query']=_[_0x2956('0x40')](_0x5ce7db[_0x2956('0x41')]);_0x1f8e33[_0x2956('0x42')]=_[_0x2956('0x43')](_0x1f8e33[_0x2956('0x3f')],_0x1f8e33[_0x2956('0x41')]);_0x1b2d8b[_0x2956('0x44')]=_[_0x2956('0x43')](_0x1f8e33[_0x2956('0x3f')],qs[_0x2956('0x45')](_0x5ce7db[_0x2956('0x41')][_0x2956('0x45')]));_0x1b2d8b[_0x2956('0x44')]=_0x1b2d8b[_0x2956('0x44')][_0x2956('0x46')]?_0x1b2d8b[_0x2956('0x44')]:_0x1f8e33[_0x2956('0x3f')];if(!_0x5ce7db[_0x2956('0x41')][_0x2956('0x47')](_0x2956('0x48'))){_0x1b2d8b[_0x2956('0x2f')]=qs[_0x2956('0x2f')](_0x5ce7db['query'][_0x2956('0x2f')]);_0x1b2d8b[_0x2956('0x2e')]=qs[_0x2956('0x2e')](_0x5ce7db[_0x2956('0x41')]['offset']);}_0x1b2d8b[_0x2956('0x49')]=qs['sort'](_0x5ce7db['query']['sort']);_0x1b2d8b[_0x2956('0x4a')]=qs[_0x2956('0x42')](_[_0x2956('0x4b')](_0x5ce7db['query'],_0x1f8e33[_0x2956('0x42')]),_0xa4f03a);if(_0x5ce7db['query'][_0x2956('0x4c')]){_0x1b2d8b[_0x2956('0x4a')]=_[_0x2956('0x4d')](_0x1b2d8b[_0x2956('0x4a')],{'$or':_[_0x2956('0x3b')](_0xa4f03a,function(_0x3a1ddc){if(_0x3a1ddc['type']!=='VIRTUAL'){var _0x481692={};_0x481692[_0x3a1ddc['name']]={'$like':'%'+_0x5ce7db[_0x2956('0x41')][_0x2956('0x4c')]+'%'};return _0x481692;}})});}_0x1b2d8b=_[_0x2956('0x4d')]({},_0x1b2d8b,_0x5ce7db[_0x2956('0x4e')]);var _0x8e1437={'where':_0x1b2d8b[_0x2956('0x4a')]};return db['ChatQueue'][_0x2956('0x2d')](_0x8e1437)[_0x2956('0x1f')](function(_0x5a4f46){_0xcce00c[_0x2956('0x2d')]=_0x5a4f46;if(_0x5ce7db['query'][_0x2956('0x4f')]){_0x1b2d8b[_0x2956('0x50')]=[{'all':!![]}];}return db[_0x2956('0x51')]['findAll'](_0x1b2d8b);})[_0x2956('0x1f')](function(_0x5009ed){_0xcce00c['rows']=_0x5009ed;return _0xcce00c;})[_0x2956('0x1f')](respondWithFilteredResult(_0x3afdaf,_0x1b2d8b))['catch'](handleError(_0x3afdaf,null));};exports['show']=function(_0x236e50,_0x5f5b88){var _0x3039b8={'raw':!![],'where':{'id':_0x236e50[_0x2956('0x52')]['id']}},_0x3152ed={};_0x3152ed[_0x2956('0x3f')]=_['keys'](db['ChatQueue']['rawAttributes']);_0x3152ed[_0x2956('0x41')]=_[_0x2956('0x40')](_0x236e50[_0x2956('0x41')]);_0x3152ed[_0x2956('0x42')]=_[_0x2956('0x43')](_0x3152ed[_0x2956('0x3f')],_0x3152ed[_0x2956('0x41')]);_0x3039b8[_0x2956('0x44')]=_['intersection'](_0x3152ed[_0x2956('0x3f')],qs[_0x2956('0x45')](_0x236e50['query'][_0x2956('0x45')]));_0x3039b8[_0x2956('0x44')]=_0x3039b8[_0x2956('0x44')]['length']?_0x3039b8[_0x2956('0x44')]:_0x3152ed[_0x2956('0x3f')];if(_0x236e50['query'][_0x2956('0x4f')]){_0x3039b8[_0x2956('0x50')]=[{'all':!![]}];}_0x3039b8=_[_0x2956('0x4d')]({},_0x3039b8,_0x236e50[_0x2956('0x4e')]);return db[_0x2956('0x51')][_0x2956('0x53')](_0x3039b8)[_0x2956('0x1f')](handleEntityNotFound(_0x5f5b88,null))[_0x2956('0x1f')](respondWithResult(_0x5f5b88,null))[_0x2956('0x28')](handleError(_0x5f5b88,null));};exports[_0x2956('0x54')]=function(_0x51c3ad,_0x15b41f){return db[_0x2956('0x51')]['create'](_0x51c3ad[_0x2956('0x55')],{})[_0x2956('0x1f')](function(_0x3a6ab6){var _0x2fdafe=_0x51c3ad[_0x2956('0x56')]['get']({'plain':!![]});if(!_0x2fdafe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fdafe[_0x2956('0x57')]===_0x2956('0x56')){var _0x10ef1b=_0x3a6ab6[_0x2956('0x58')]({'plain':!![]});var _0x1d3f03=_0x2956('0x59');return db[_0x2956('0x5a')][_0x2956('0x53')]({'where':{'name':_0x1d3f03,'userProfileId':_0x2fdafe[_0x2956('0x5b')]},'raw':!![]})[_0x2956('0x1f')](function(_0xf65ff6){if(_0xf65ff6&&_0xf65ff6[_0x2956('0x5c')]===0x0){return db[_0x2956('0x35')][_0x2956('0x54')]({'name':_0x10ef1b[_0x2956('0x38')],'resourceId':_0x10ef1b['id'],'type':_0xf65ff6[_0x2956('0x38')],'sectionId':_0xf65ff6['id']},{})[_0x2956('0x1f')](function(){return _0x3a6ab6;});}else{return _0x3a6ab6;}})[_0x2956('0x28')](function(_0x45bdb7){logger[_0x2956('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45bdb7);throw _0x45bdb7;});}return _0x3a6ab6;})['then'](respondWithResult(_0x15b41f,0xc9))['catch'](handleError(_0x15b41f,null));};exports['update']=function(_0x1ba21b,_0x14cfe1){if(_0x1ba21b['body']['id']){delete _0x1ba21b[_0x2956('0x55')]['id'];}return db[_0x2956('0x51')][_0x2956('0x53')]({'where':{'id':_0x1ba21b[_0x2956('0x52')]['id']}})[_0x2956('0x1f')](handleEntityNotFound(_0x14cfe1,null))[_0x2956('0x1f')](saveUpdates(_0x1ba21b[_0x2956('0x55')],null))[_0x2956('0x1f')](respondWithResult(_0x14cfe1,null))[_0x2956('0x28')](handleError(_0x14cfe1,null));};exports[_0x2956('0x36')]=function(_0x34fc33,_0x3c6ffb){return db[_0x2956('0x51')][_0x2956('0x53')]({'where':{'id':_0x34fc33[_0x2956('0x52')]['id']}})[_0x2956('0x1f')](handleEntityNotFound(_0x3c6ffb,null))[_0x2956('0x1f')](removeEntity(_0x3c6ffb,null))[_0x2956('0x28')](handleError(_0x3c6ffb,null));};exports[_0x2956('0x5d')]=function(_0x3c088d,_0x47ba5b){return db['ChatQueue'][_0x2956('0x5d')]()[_0x2956('0x1f')](respondWithResult(_0x47ba5b,null))[_0x2956('0x28')](handleError(_0x47ba5b,null));};exports[_0x2956('0x5e')]=function(_0x61260d,_0x53d6c5,_0x51b183){var _0x2cc943={'raw':!![],'where':{}},_0x1043c3={},_0x4cc8af;return db[_0x2956('0x51')]['findOne']({'where':{'id':_0x61260d[_0x2956('0x52')]['id']}})['then'](handleEntityNotFound(_0x53d6c5,null))[_0x2956('0x1f')](function(_0x5f4ebd){if(_0x5f4ebd){_0x4cc8af=_0x5f4ebd[_0x2956('0x58')]({'plain':!![]});_0x1043c3[_0x2956('0x3f')]=_[_0x2956('0x40')](db['UserChatQueue'][_0x2956('0x3c')]);_0x1043c3['query']=_[_0x2956('0x40')](_0x61260d[_0x2956('0x41')]);_0x1043c3[_0x2956('0x42')]=_[_0x2956('0x43')](_0x1043c3[_0x2956('0x3f')],_0x1043c3[_0x2956('0x41')]);_0x2cc943['attributes']=_['intersection'](_0x1043c3[_0x2956('0x3f')],qs[_0x2956('0x45')](_0x61260d['query']['fields']));_0x2cc943[_0x2956('0x44')]=_0x2cc943[_0x2956('0x44')][_0x2956('0x46')]?_0x2cc943[_0x2956('0x44')]:_0x1043c3[_0x2956('0x3f')];if(!_0x61260d[_0x2956('0x41')][_0x2956('0x47')](_0x2956('0x48'))){_0x2cc943[_0x2956('0x2f')]=qs[_0x2956('0x2f')](_0x61260d['query'][_0x2956('0x2f')]);_0x2cc943[_0x2956('0x2e')]=qs[_0x2956('0x2e')](_0x61260d['query'][_0x2956('0x2e')]);}_0x2cc943[_0x2956('0x49')]=qs[_0x2956('0x5f')](_0x61260d['query'][_0x2956('0x5f')]);_0x2cc943[_0x2956('0x4a')]=qs[_0x2956('0x42')](_['pick'](_0x61260d[_0x2956('0x41')],_0x1043c3[_0x2956('0x42')]));_0x2cc943[_0x2956('0x4a')]['ChatQueueId']=_0x5f4ebd['id'];if(_0x61260d['query']['filter']){_0x2cc943[_0x2956('0x4a')]=_[_0x2956('0x4d')](_0x2cc943[_0x2956('0x4a')],{'$or':_[_0x2956('0x3b')](_0x2cc943['attributes'],function(_0x45d6e2){var _0x3a82be={};_0x3a82be[_0x45d6e2]={'$like':'%'+_0x61260d[_0x2956('0x41')][_0x2956('0x4c')]+'%'};return _0x3a82be;})});}_0x2cc943=_['merge']({},_0x2cc943,_0x61260d[_0x2956('0x4e')]);return db[_0x2956('0x60')][_0x2956('0x61')](_0x2cc943);}})['then'](function(_0x20d220){if(_0x20d220){return db[_0x2956('0x62')][_0x2956('0x63')]({'where':{'id':_[_0x2956('0x3b')](_0x20d220,_0x2956('0x64')),'role':_0x2956('0x65')},'attributes':['id',_0x2956('0x38'),_0x2956('0x66'),_0x2956('0x67'),'createdAt']});}})[_0x2956('0x1f')](function(_0x166b63){if(_0x166b63){return{'count':_0x166b63[_0x2956('0x2d')],'rows':_[_0x2956('0x3b')](_0x166b63[_0x2956('0x68')],function(_0x52d23c){return{'membername':_0x52d23c[_0x2956('0x38')],'UserId':_0x52d23c['id'],'queue_name':_0x4cc8af[_0x2956('0x38')],'ChatQueueId':_0x4cc8af['id'],'interface':util[_0x2956('0x69')]('%s/%s',_0x2956('0x6a'),_0x52d23c['name']),'penalty':0x0,'paused':_0x52d23c[_0x2956('0x66')],'createdAt':_0x52d23c[_0x2956('0x6b')],'updatedAt':_0x52d23c[_0x2956('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2956('0x1f')](respondWithFilteredResult(_0x53d6c5,_0x2cc943))['catch'](handleError(_0x53d6c5,null));};exports[_0x2956('0x6c')]=function(_0x542ecf,_0xd77641,_0xc24d63){var _0x40ca31={};var _0xec1b3b={};var _0x4c8ce2;var _0x254d80;return db[_0x2956('0x51')][_0x2956('0x6d')]({'where':{'id':_0x542ecf[_0x2956('0x52')]['id']}})[_0x2956('0x1f')](handleEntityNotFound(_0xd77641,null))['then'](function(_0x23714f){if(_0x23714f){_0x4c8ce2=_0x23714f;_0xec1b3b[_0x2956('0x3f')]=_[_0x2956('0x40')](db[_0x2956('0x6e')][_0x2956('0x3c')]);_0xec1b3b[_0x2956('0x41')]=_[_0x2956('0x40')](_0x542ecf['query']);_0xec1b3b[_0x2956('0x42')]=_[_0x2956('0x43')](_0xec1b3b[_0x2956('0x3f')],_0xec1b3b[_0x2956('0x41')]);_0x40ca31['attributes']=_[_0x2956('0x43')](_0xec1b3b['model'],qs[_0x2956('0x45')](_0x542ecf[_0x2956('0x41')]['fields']));_0x40ca31[_0x2956('0x44')]=_0x40ca31[_0x2956('0x44')][_0x2956('0x46')]?_0x40ca31[_0x2956('0x44')]:_0xec1b3b[_0x2956('0x3f')];_0x40ca31[_0x2956('0x49')]=qs[_0x2956('0x5f')](_0x542ecf['query'][_0x2956('0x5f')]);_0x40ca31[_0x2956('0x4a')]=qs[_0x2956('0x42')](_[_0x2956('0x4b')](_0x542ecf['query'],_0xec1b3b[_0x2956('0x42')]));if(_0x542ecf['query'][_0x2956('0x4c')]){_0x40ca31[_0x2956('0x4a')]=_[_0x2956('0x4d')](_0x40ca31[_0x2956('0x4a')],{'$or':_[_0x2956('0x3b')](_0x40ca31[_0x2956('0x44')],function(_0x94a4a){var _0x5cb3ee={};_0x5cb3ee[_0x94a4a]={'$like':'%'+_0x542ecf['query'][_0x2956('0x4c')]+'%'};return _0x5cb3ee;})});}_0x40ca31=_['merge']({},_0x40ca31,_0x542ecf[_0x2956('0x4e')]);return _0x4c8ce2[_0x2956('0x6c')](_0x40ca31);}})[_0x2956('0x1f')](function(_0x5a0989){if(_0x5a0989){_0x254d80=_0x5a0989[_0x2956('0x46')];if(!_0x542ecf[_0x2956('0x41')]['hasOwnProperty'](_0x2956('0x48'))){_0x40ca31[_0x2956('0x2f')]=qs[_0x2956('0x2f')](_0x542ecf[_0x2956('0x41')][_0x2956('0x2f')]);_0x40ca31[_0x2956('0x2e')]=qs[_0x2956('0x2e')](_0x542ecf[_0x2956('0x41')][_0x2956('0x2e')]);}return _0x4c8ce2[_0x2956('0x6c')](_0x40ca31);}})['then'](function(_0x1bd2c6){if(_0x1bd2c6){return _0x1bd2c6?{'count':_0x254d80,'rows':_0x1bd2c6}:null;}})['then'](respondWithResult(_0xd77641,null))['catch'](handleError(_0xd77641,null));};exports['addTeams']=function(_0x3596c8,_0x16432b,_0x3fbf33){var _0x326f26=_0x3596c8['body'][_0x2956('0x6f')];return db[_0x2956('0x6e')][_0x2956('0x61')]({'where':{'id':_0x326f26},'attributes':['id'],'include':[{'model':db[_0x2956('0x62')],'as':_0x2956('0x70'),'attributes':['id','name',_0x2956('0x71'),'voicePause',_0x2956('0x72')],'raw':!![]}]})[_0x2956('0x1f')](function(_0x32c20e){if(_0x32c20e){var _0x35a5da=_[_0x2956('0x73')](_0x32c20e,function(_0x2bada6){var _0x18d860=_0x2bada6[_0x2956('0x58')]({'plain':!![]});return _0x18d860[_0x2956('0x70')];});return db['ChatQueue'][_0x2956('0x53')]({'where':{'id':_0x3596c8[_0x2956('0x52')]['id']}})[_0x2956('0x1f')](function(_0x10daf3){return db['sequelize'][_0x2956('0x74')](function(_0x5dd5e9){return _0x10daf3[_0x2956('0x75')](_0x326f26,{'transaction':_0x5dd5e9})[_0x2956('0x1f')](function(){return BPromise[_0x2956('0x76')](_0x35a5da,function(_0x24d3dd){return db[_0x2956('0x60')][_0x2956('0x77')]({'where':{'UserId':_0x24d3dd['id'],'ChatQueueId':_0x3596c8['params']['id']},'transaction':_0x5dd5e9});});})[_0x2956('0x1f')](function(){_0x35a5da[_0x2956('0x78')](function(_0x186a30){socket[_0x2956('0x79')]('userChatQueue:save',{'UserId':_0x186a30['id'],'ChatQueueId':_0x10daf3['id']});});});});});}})['then'](respondWithStatusCode(_0x16432b,null))[_0x2956('0x28')](handleError(_0x16432b,null));};exports['removeTeams']=function(_0x3cfb98,_0x138861,_0x333268){return db[_0x2956('0x6e')][_0x2956('0x61')]({'where':{'id':_0x3cfb98['query'][_0x2956('0x6f')]},'attributes':['id'],'include':[{'model':db[_0x2956('0x62')],'as':_0x2956('0x70'),'attributes':['id'],'raw':!![]}]})[_0x2956('0x1f')](handleEntityNotFound(_0x138861,null))[_0x2956('0x1f')](function(_0x418ef5){var _0x2e35a4=_[_0x2956('0x3b')](_0x418ef5,'id');var _0x51a8a2=[];var _0x574b6e=[];var _0x490479=squel[_0x2956('0x7a')]();_0x490479[_0x2956('0x7b')](_0x2956('0x7c'))['from'](_0x2956('0x7d'),'tq')[_0x2956('0x7e')](_0x2956('0x7f'),'ut',_0x2956('0x80'))['where'](_0x2956('0x81'),_0x3cfb98['params']['id']);for(var _0x186202=0x0;_0x186202<_0x418ef5[_0x2956('0x46')];_0x186202+=0x1){let _0x4bc89e=_0x418ef5[_0x186202];for(var _0x66adbc=0x0;_0x66adbc<_0x4bc89e['Agents'][_0x2956('0x46')];_0x66adbc+=0x1){let _0x79e762=_0x4bc89e[_0x2956('0x70')][_0x66adbc];var _0x312be4=_0x490479[_0x2956('0x82')]();_0x312be4[_0x2956('0x4a')](_0x2956('0x83'),_0x79e762['id']);_0x574b6e[_0x2956('0x84')](db[_0x2956('0x85')][_0x2956('0x41')](_0x312be4[_0x2956('0x86')](),{'type':db['sequelize'][_0x2956('0x87')]['SELECT']})['then'](function(_0x2ca8aa){if(_0x2ca8aa[_0x2956('0x46')]===0x1){return _0x79e762['id'];}else{var _0x3d38b8=_[_0x2956('0x88')](_[_0x2956('0x3b')](_0x2ca8aa,_0x2956('0x89')),function(_0x3ae6d2){return _[_0x2956('0x8a')](_0x2e35a4,_0x3ae6d2);});if(_0x3d38b8){return _0x79e762['id'];}}}));}}return BPromise[_0x2956('0x8b')](_0x574b6e)[_0x2956('0x1f')](function(_0x190c32){_0x51a8a2=_(_0x51a8a2)[_0x2956('0x8c')](_0x190c32)['compact']()[_0x2956('0x8d')]();return db[_0x2956('0x51')]['find']({'where':{'id':_0x3cfb98[_0x2956('0x52')]['id']}})[_0x2956('0x1f')](function(_0x3cce19){return db[_0x2956('0x85')]['transaction'](function(_0x239cb3){return _0x3cce19['removeTeams'](_0x3cfb98[_0x2956('0x41')]['ids'],{'transaction':_0x239cb3})[_0x2956('0x1f')](function(){if(!_[_0x2956('0x8e')](_0x51a8a2)){return _0x3cce19[_0x2956('0x8f')](_0x51a8a2,{'transaction':_0x239cb3});}})[_0x2956('0x1f')](function(){_0x51a8a2['forEach'](function(_0x3f97ef){socket['emit'](_0x2956('0x90'),{'UserId':_0x3f97ef,'ChatQueueId':_0x3cce19['id']});});});});});});})[_0x2956('0x1f')](respondWithStatusCode(_0x138861,null))[_0x2956('0x28')](handleError(_0x138861,null));};exports[_0x2956('0x91')]=function(_0x4ebc35,_0x47f5ad,_0x557f26){return db[_0x2956('0x51')][_0x2956('0x53')]({'where':{'id':_0x4ebc35['params']['id']}})[_0x2956('0x1f')](handleEntityNotFound(_0x47f5ad,null))[_0x2956('0x1f')](function(_0x23187d){if(_0x23187d){return _0x23187d['addAgents'](_0x4ebc35[_0x2956('0x55')]['ids'],_[_0x2956('0x92')](_0x4ebc35['body'],[_0x2956('0x6f'),'id'])||{})[_0x2956('0x93')](function(_0x31b5c6){for(var _0x5a9ba9=0x0;_0x5a9ba9<_0x4ebc35[_0x2956('0x55')][_0x2956('0x6f')]['length'];_0x5a9ba9+=0x1){socket[_0x2956('0x79')](_0x2956('0x94'),{'UserId':_0x4ebc35['body'][_0x2956('0x6f')][_0x5a9ba9],'ChatQueueId':_0x4ebc35[_0x2956('0x52')]['id']});}return _0x31b5c6;});}})[_0x2956('0x1f')](respondWithResult(_0x47f5ad,null))[_0x2956('0x28')](handleError(_0x47f5ad,null));};exports[_0x2956('0x8f')]=function(_0x1553de,_0x22ead7,_0x2c5157){return db[_0x2956('0x51')][_0x2956('0x53')]({'where':{'id':_0x1553de[_0x2956('0x52')]['id']}})[_0x2956('0x1f')](handleEntityNotFound(_0x22ead7,null))[_0x2956('0x1f')](function(_0x1b076a){if(_0x1b076a){return _0x1b076a[_0x2956('0x8f')](_0x1553de[_0x2956('0x41')][_0x2956('0x6f')])[_0x2956('0x1f')](function(){if(_['isArray'](_0x1553de[_0x2956('0x41')][_0x2956('0x6f')])){for(var _0x171e16=0x0;_0x171e16<_0x1553de[_0x2956('0x41')]['ids'][_0x2956('0x46')];_0x171e16+=0x1){socket[_0x2956('0x79')](_0x2956('0x90'),{'UserId':Number(_0x1553de[_0x2956('0x41')][_0x2956('0x6f')][_0x171e16]),'ChatQueueId':Number(_0x1553de[_0x2956('0x52')]['id'])});}}else{socket['emit'](_0x2956('0x90'),{'UserId':Number(_0x1553de[_0x2956('0x41')][_0x2956('0x6f')]),'ChatQueueId':Number(_0x1553de[_0x2956('0x52')]['id'])});}});}})['then'](respondWithStatusCode(_0x22ead7,null))[_0x2956('0x28')](handleError(_0x22ead7,null));};exports[_0x2956('0x95')]=function(_0x5e8f0e,_0x62e267,_0x53e1e8){var _0x1fcb13={};var _0x13aa71={};var _0x41a078;var _0x4bf141;return db[_0x2956('0x51')][_0x2956('0x6d')]({'where':{'id':_0x5e8f0e[_0x2956('0x52')]['id']}})['then'](handleEntityNotFound(_0x62e267,null))[_0x2956('0x1f')](function(_0x5ddc9b){if(_0x5ddc9b){_0x41a078=_0x5ddc9b;_0x13aa71[_0x2956('0x3f')]=_[_0x2956('0x40')](db['User'][_0x2956('0x3c')]);_0x13aa71[_0x2956('0x41')]=_['keys'](_0x5e8f0e[_0x2956('0x41')]);_0x13aa71[_0x2956('0x42')]=_[_0x2956('0x43')](_0x13aa71['model'],_0x13aa71[_0x2956('0x41')]);_0x1fcb13[_0x2956('0x44')]=_[_0x2956('0x43')](_0x13aa71[_0x2956('0x3f')],qs[_0x2956('0x45')](_0x5e8f0e[_0x2956('0x41')][_0x2956('0x45')]));_0x1fcb13[_0x2956('0x44')]=_0x1fcb13[_0x2956('0x44')]['length']?_0x1fcb13[_0x2956('0x44')]:_0x13aa71['model'];_0x1fcb13[_0x2956('0x49')]=qs['sort'](_0x5e8f0e['query'][_0x2956('0x5f')]);_0x1fcb13[_0x2956('0x4a')]=qs['filters'](_['pick'](_0x5e8f0e[_0x2956('0x41')],_0x13aa71[_0x2956('0x42')]));if(_0x5e8f0e[_0x2956('0x41')]['filter']){_0x1fcb13[_0x2956('0x4a')]=_[_0x2956('0x4d')](_0x1fcb13['where'],{'$or':_['map'](_0x1fcb13[_0x2956('0x44')],function(_0x288558){var _0x2275cc={};_0x2275cc[_0x288558]={'$like':'%'+_0x5e8f0e[_0x2956('0x41')]['filter']+'%'};return _0x2275cc;})});}_0x1fcb13=_[_0x2956('0x4d')]({},_0x1fcb13,_0x5e8f0e[_0x2956('0x4e')]);return _0x41a078['getAgents'](_0x1fcb13);}})[_0x2956('0x1f')](function(_0x46b8c9){if(_0x46b8c9){_0x4bf141=_0x46b8c9['length'];if(!_0x5e8f0e[_0x2956('0x41')][_0x2956('0x47')]('nolimit')){_0x1fcb13[_0x2956('0x2f')]=qs['limit'](_0x5e8f0e[_0x2956('0x41')][_0x2956('0x2f')]);_0x1fcb13[_0x2956('0x2e')]=qs[_0x2956('0x2e')](_0x5e8f0e['query'][_0x2956('0x2e')]);}return _0x41a078[_0x2956('0x95')](_0x1fcb13);}})[_0x2956('0x1f')](function(_0x50b00d){if(_0x50b00d){return _0x50b00d?{'count':_0x4bf141,'rows':_0x50b00d}:null;}})[_0x2956('0x1f')](respondWithResult(_0x62e267,null))['catch'](handleError(_0x62e267,null));}; \ No newline at end of file +var _0x25d1=['userProfileId','autoAssociation','findOne','UserChatQueue','pick','User','findAndCountAll','UserId','chatPause','updatedAt','format','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','forEach','emit','userChatQueue:save','removeTeams','join','user_has_teams','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./chatQueue.socket','register','jayson/promise','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','update','destroy','get','ChatQueues','UserProfileResource','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','ChatQueue','include','findAll','rows','show','params','rawAttributes','includeAll','create','body','role','UserProfileSection','find'];(function(_0x33db51,_0x55272d){var _0x4d19c7=function(_0x3dc4d1){while(--_0x3dc4d1){_0x33db51['push'](_0x33db51['shift']());}};_0x4d19c7(++_0x55272d);}(_0x25d1,0xb9));var _0x125d=function(_0x17ff72,_0x5a05c9){_0x17ff72=_0x17ff72-0x0;var _0x4b987c=_0x25d1[_0x17ff72];return _0x4b987c;};'use strict';var pdf=require(_0x125d('0x0'));var emlformat=require(_0x125d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x125d('0x2'));var jsonpatch=require(_0x125d('0x3'));var rp=require(_0x125d('0x4'));var moment=require('moment');var BPromise=require(_0x125d('0x5'));var Mustache=require(_0x125d('0x6'));var util=require(_0x125d('0x7'));var path=require(_0x125d('0x8'));var sox=require('sox');var csv=require(_0x125d('0x9'));var ejs=require(_0x125d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x125d('0xb'));var crypto=require(_0x125d('0xc'));var jsforce=require(_0x125d('0xd'));var deskjs=require(_0x125d('0xe'));var toCsv=require(_0x125d('0x9'));var querystring=require(_0x125d('0xf'));var Papa=require(_0x125d('0x10'));var Redis=require(_0x125d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x125d('0x12'));var as=require(_0x125d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x125d('0x14'))(_0x125d('0x15'));var utils=require('../../config/utils');var config=require(_0x125d('0x16'));var licenseUtil=require(_0x125d('0x17'));var db=require(_0x125d('0x18'))['db'];config['redis']=_[_0x125d('0x19')](config[_0x125d('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x125d('0x1a')]));require(_0x125d('0x1b'))[_0x125d('0x1c')](socket);var jayson=require(_0x125d('0x1d'));var client=jayson['client'][_0x125d('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1528f8,_0x446c5f,_0x5172d3,_0x1b4fd3){return new BPromise(function(_0x299ab1,_0x5ce559){var _0x5b5a8c=_0x1b4fd3||client;return _0x5b5a8c[_0x125d('0x1f')](_0x1528f8,_0x5172d3)[_0x125d('0x20')](function(_0x535204){logger[_0x125d('0x21')](_0x125d('0x22'),_0x446c5f,_0x125d('0x23'));logger[_0x125d('0x24')](_0x125d('0x25'),_0x446c5f,_0x125d('0x23'),JSON[_0x125d('0x26')](_0x535204));if(_0x535204[_0x125d('0x27')]){if(_0x535204[_0x125d('0x27')][_0x125d('0x28')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x446c5f,_0x535204[_0x125d('0x27')]['message']);return _0x5ce559(_0x535204[_0x125d('0x27')][_0x125d('0x29')]);}logger['error'](_0x125d('0x22'),_0x446c5f,_0x535204[_0x125d('0x27')][_0x125d('0x29')]);return _0x299ab1(_0x535204[_0x125d('0x27')][_0x125d('0x29')]);}else{logger[_0x125d('0x21')]('ChatQueue,\x20%s,\x20%s',_0x446c5f,_0x125d('0x23'));_0x299ab1(_0x535204[_0x125d('0x2a')][_0x125d('0x29')]);}})[_0x125d('0x2b')](function(_0x368dfa){logger[_0x125d('0x27')]('ChatQueue,\x20%s,\x20%s',_0x446c5f,_0x368dfa);_0x5ce559(_0x368dfa);});});}function respondWithStatusCode(_0xa22804,_0x559ddf){_0x559ddf=_0x559ddf||0xcc;return function(_0x5a299e){if(_0x5a299e){return _0xa22804[_0x125d('0x2c')](_0x559ddf);}return _0xa22804[_0x125d('0x2d')](_0x559ddf)[_0x125d('0x2e')]();};}function respondWithResult(_0x4204ea,_0x2fb4ce){_0x2fb4ce=_0x2fb4ce||0xc8;return function(_0x8c7a9c){if(_0x8c7a9c){return _0x4204ea[_0x125d('0x2d')](_0x2fb4ce)[_0x125d('0x2f')](_0x8c7a9c);}};}function respondWithFilteredResult(_0x1a8a10,_0x3a773e){return function(_0x4dc2d0){if(_0x4dc2d0){var _0x1a283a=_0x4dc2d0[_0x125d('0x30')],_0x53a65c=_0x3a773e[_0x125d('0x31')],_0x40321e=_0x3a773e[_0x125d('0x31')]+_0x3a773e[_0x125d('0x32')],_0x5cc041;if(_0x40321e>=_0x1a283a){_0x40321e=_0x1a283a;_0x5cc041=0xc8;}else{_0x5cc041=0xce;}_0x1a8a10['status'](_0x5cc041);return _0x1a8a10[_0x125d('0x33')](_0x125d('0x34'),_0x53a65c+'-'+_0x40321e+'/'+_0x1a283a)[_0x125d('0x2f')](_0x4dc2d0);}return null;};}function patchUpdates(_0x506d16){return function(_0x2493b8){try{jsonpatch['apply'](_0x2493b8,_0x506d16,!![]);}catch(_0x2ed9c5){return BPromise['reject'](_0x2ed9c5);}return _0x2493b8['save']();};}function saveUpdates(_0x50ba04,_0xbceaae){return function(_0x419b5d){if(_0x419b5d){return _0x419b5d[_0x125d('0x35')](_0x50ba04)['then'](function(_0x1b26a5){return _0x1b26a5;});}return null;};}function removeEntity(_0x790561,_0x27b6b1){return function(_0x229069){if(_0x229069){return _0x229069[_0x125d('0x36')]()[_0x125d('0x20')](function(){var _0x291b8a=_0x229069[_0x125d('0x37')]({'plain':!![]});var _0x22eb7a=_0x125d('0x38');return db[_0x125d('0x39')][_0x125d('0x36')]({'where':{'type':_0x22eb7a,'resourceId':_0x291b8a['id']}})[_0x125d('0x20')](function(){return _0x229069;});})[_0x125d('0x20')](function(){_0x790561[_0x125d('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38a035,_0x3e0da7){return function(_0x37f0d5){if(!_0x37f0d5){_0x38a035[_0x125d('0x2c')](0x194);}return _0x37f0d5;};}function handleError(_0x350c43,_0x2214ee){_0x2214ee=_0x2214ee||0x1f4;return function(_0x5aac24){logger[_0x125d('0x27')](_0x5aac24[_0x125d('0x3a')]);if(_0x5aac24['name']){delete _0x5aac24[_0x125d('0x3b')];}_0x350c43[_0x125d('0x2d')](_0x2214ee)[_0x125d('0x3c')](_0x5aac24);};}exports[_0x125d('0x3d')]=function(_0x301b47,_0x14c5ef){var _0x3da92d={},_0x2251ca={},_0x1883e1={'count':0x0,'rows':[]};var _0x5c5df4=_[_0x125d('0x3e')](db['ChatQueue']['rawAttributes'],function(_0x1277d6){return{'name':_0x1277d6[_0x125d('0x3f')],'type':_0x1277d6[_0x125d('0x40')][_0x125d('0x41')]};});_0x2251ca[_0x125d('0x42')]=_[_0x125d('0x3e')](_0x5c5df4,_0x125d('0x3b'));_0x2251ca[_0x125d('0x43')]=_[_0x125d('0x44')](_0x301b47[_0x125d('0x43')]);_0x2251ca[_0x125d('0x45')]=_[_0x125d('0x46')](_0x2251ca['model'],_0x2251ca[_0x125d('0x43')]);_0x3da92d[_0x125d('0x47')]=_[_0x125d('0x46')](_0x2251ca['model'],qs[_0x125d('0x48')](_0x301b47[_0x125d('0x43')][_0x125d('0x48')]));_0x3da92d['attributes']=_0x3da92d[_0x125d('0x47')][_0x125d('0x49')]?_0x3da92d[_0x125d('0x47')]:_0x2251ca[_0x125d('0x42')];if(!_0x301b47['query'][_0x125d('0x4a')](_0x125d('0x4b'))){_0x3da92d[_0x125d('0x32')]=qs[_0x125d('0x32')](_0x301b47[_0x125d('0x43')][_0x125d('0x32')]);_0x3da92d[_0x125d('0x31')]=qs['offset'](_0x301b47[_0x125d('0x43')][_0x125d('0x31')]);}_0x3da92d[_0x125d('0x4c')]=qs['sort'](_0x301b47[_0x125d('0x43')][_0x125d('0x4d')]);_0x3da92d[_0x125d('0x4e')]=qs[_0x125d('0x45')](_['pick'](_0x301b47[_0x125d('0x43')],_0x2251ca[_0x125d('0x45')]),_0x5c5df4);if(_0x301b47['query'][_0x125d('0x4f')]){_0x3da92d[_0x125d('0x4e')]=_[_0x125d('0x50')](_0x3da92d['where'],{'$or':_[_0x125d('0x3e')](_0x5c5df4,function(_0x3d5ecc){if(_0x3d5ecc['type']!=='VIRTUAL'){var _0x353cc3={};_0x353cc3[_0x3d5ecc[_0x125d('0x3b')]]={'$like':'%'+_0x301b47[_0x125d('0x43')][_0x125d('0x4f')]+'%'};return _0x353cc3;}})});}_0x3da92d=_[_0x125d('0x50')]({},_0x3da92d,_0x301b47[_0x125d('0x51')]);var _0x32dda1={'where':_0x3da92d[_0x125d('0x4e')]};return db[_0x125d('0x52')]['count'](_0x32dda1)['then'](function(_0x31791d){_0x1883e1['count']=_0x31791d;if(_0x301b47[_0x125d('0x43')]['includeAll']){_0x3da92d[_0x125d('0x53')]=[{'all':!![]}];}return db['ChatQueue'][_0x125d('0x54')](_0x3da92d);})['then'](function(_0x1b2a0a){_0x1883e1[_0x125d('0x55')]=_0x1b2a0a;return _0x1883e1;})[_0x125d('0x20')](respondWithFilteredResult(_0x14c5ef,_0x3da92d))[_0x125d('0x2b')](handleError(_0x14c5ef,null));};exports[_0x125d('0x56')]=function(_0x18f498,_0x54b93c){var _0x5295ad={'raw':!![],'where':{'id':_0x18f498[_0x125d('0x57')]['id']}},_0x59807e={};_0x59807e['model']=_[_0x125d('0x44')](db['ChatQueue'][_0x125d('0x58')]);_0x59807e['query']=_['keys'](_0x18f498[_0x125d('0x43')]);_0x59807e[_0x125d('0x45')]=_['intersection'](_0x59807e[_0x125d('0x42')],_0x59807e[_0x125d('0x43')]);_0x5295ad[_0x125d('0x47')]=_[_0x125d('0x46')](_0x59807e[_0x125d('0x42')],qs['fields'](_0x18f498[_0x125d('0x43')]['fields']));_0x5295ad[_0x125d('0x47')]=_0x5295ad[_0x125d('0x47')]['length']?_0x5295ad['attributes']:_0x59807e[_0x125d('0x42')];if(_0x18f498[_0x125d('0x43')][_0x125d('0x59')]){_0x5295ad['include']=[{'all':!![]}];}_0x5295ad=_[_0x125d('0x50')]({},_0x5295ad,_0x18f498['options']);return db[_0x125d('0x52')]['find'](_0x5295ad)[_0x125d('0x20')](handleEntityNotFound(_0x54b93c,null))['then'](respondWithResult(_0x54b93c,null))[_0x125d('0x2b')](handleError(_0x54b93c,null));};exports[_0x125d('0x5a')]=function(_0x49b787,_0x31a0f2){return db['ChatQueue'][_0x125d('0x5a')](_0x49b787[_0x125d('0x5b')],{})[_0x125d('0x20')](function(_0x3233d5){var _0x2ce5ba=_0x49b787['user']['get']({'plain':!![]});if(!_0x2ce5ba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ce5ba[_0x125d('0x5c')]==='user'){var _0x8f7791=_0x3233d5[_0x125d('0x37')]({'plain':!![]});var _0x1155e9=_0x125d('0x38');return db[_0x125d('0x5d')][_0x125d('0x5e')]({'where':{'name':_0x1155e9,'userProfileId':_0x2ce5ba[_0x125d('0x5f')]},'raw':!![]})[_0x125d('0x20')](function(_0x5c02be){if(_0x5c02be&&_0x5c02be[_0x125d('0x60')]===0x0){return db[_0x125d('0x39')]['create']({'name':_0x8f7791[_0x125d('0x3b')],'resourceId':_0x8f7791['id'],'type':_0x5c02be[_0x125d('0x3b')],'sectionId':_0x5c02be['id']},{})[_0x125d('0x20')](function(){return _0x3233d5;});}else{return _0x3233d5;}})[_0x125d('0x2b')](function(_0x9b2bc8){logger[_0x125d('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9b2bc8);throw _0x9b2bc8;});}return _0x3233d5;})[_0x125d('0x20')](respondWithResult(_0x31a0f2,0xc9))[_0x125d('0x2b')](handleError(_0x31a0f2,null));};exports[_0x125d('0x35')]=function(_0x1543ae,_0x6a8bbd){if(_0x1543ae['body']['id']){delete _0x1543ae[_0x125d('0x5b')]['id'];}return db[_0x125d('0x52')]['find']({'where':{'id':_0x1543ae[_0x125d('0x57')]['id']}})['then'](handleEntityNotFound(_0x6a8bbd,null))[_0x125d('0x20')](saveUpdates(_0x1543ae['body'],null))[_0x125d('0x20')](respondWithResult(_0x6a8bbd,null))[_0x125d('0x2b')](handleError(_0x6a8bbd,null));};exports[_0x125d('0x36')]=function(_0x16cdd2,_0xdadbd1){return db[_0x125d('0x52')]['find']({'where':{'id':_0x16cdd2[_0x125d('0x57')]['id']}})[_0x125d('0x20')](handleEntityNotFound(_0xdadbd1,null))[_0x125d('0x20')](removeEntity(_0xdadbd1,null))['catch'](handleError(_0xdadbd1,null));};exports['describe']=function(_0x591e5d,_0x136ab2){return db[_0x125d('0x52')]['describe']()[_0x125d('0x20')](respondWithResult(_0x136ab2,null))[_0x125d('0x2b')](handleError(_0x136ab2,null));};exports['getMembers']=function(_0x157741,_0x3f23f6,_0x537f92){var _0x2383e2={'raw':!![],'where':{}},_0x339c59={},_0xb1473c;return db[_0x125d('0x52')][_0x125d('0x61')]({'where':{'id':_0x157741[_0x125d('0x57')]['id']}})[_0x125d('0x20')](handleEntityNotFound(_0x3f23f6,null))[_0x125d('0x20')](function(_0x43375d){if(_0x43375d){_0xb1473c=_0x43375d[_0x125d('0x37')]({'plain':!![]});_0x339c59[_0x125d('0x42')]=_[_0x125d('0x44')](db[_0x125d('0x62')][_0x125d('0x58')]);_0x339c59[_0x125d('0x43')]=_[_0x125d('0x44')](_0x157741[_0x125d('0x43')]);_0x339c59[_0x125d('0x45')]=_[_0x125d('0x46')](_0x339c59['model'],_0x339c59['query']);_0x2383e2[_0x125d('0x47')]=_['intersection'](_0x339c59[_0x125d('0x42')],qs['fields'](_0x157741[_0x125d('0x43')][_0x125d('0x48')]));_0x2383e2[_0x125d('0x47')]=_0x2383e2[_0x125d('0x47')][_0x125d('0x49')]?_0x2383e2[_0x125d('0x47')]:_0x339c59[_0x125d('0x42')];if(!_0x157741[_0x125d('0x43')][_0x125d('0x4a')](_0x125d('0x4b'))){_0x2383e2['limit']=qs[_0x125d('0x32')](_0x157741[_0x125d('0x43')][_0x125d('0x32')]);_0x2383e2['offset']=qs[_0x125d('0x31')](_0x157741[_0x125d('0x43')][_0x125d('0x31')]);}_0x2383e2[_0x125d('0x4c')]=qs[_0x125d('0x4d')](_0x157741[_0x125d('0x43')][_0x125d('0x4d')]);_0x2383e2[_0x125d('0x4e')]=qs[_0x125d('0x45')](_[_0x125d('0x63')](_0x157741[_0x125d('0x43')],_0x339c59[_0x125d('0x45')]));_0x2383e2[_0x125d('0x4e')]['ChatQueueId']=_0x43375d['id'];if(_0x157741[_0x125d('0x43')][_0x125d('0x4f')]){_0x2383e2[_0x125d('0x4e')]=_['merge'](_0x2383e2[_0x125d('0x4e')],{'$or':_[_0x125d('0x3e')](_0x2383e2['attributes'],function(_0x32c825){var _0x1e72a8={};_0x1e72a8[_0x32c825]={'$like':'%'+_0x157741[_0x125d('0x43')][_0x125d('0x4f')]+'%'};return _0x1e72a8;})});}_0x2383e2=_[_0x125d('0x50')]({},_0x2383e2,_0x157741['options']);return db[_0x125d('0x62')][_0x125d('0x54')](_0x2383e2);}})[_0x125d('0x20')](function(_0x3d1c1e){if(_0x3d1c1e){return db[_0x125d('0x64')][_0x125d('0x65')]({'where':{'id':_['map'](_0x3d1c1e,_0x125d('0x66')),'role':'agent'},'attributes':['id',_0x125d('0x3b'),_0x125d('0x67'),_0x125d('0x68'),'createdAt']});}})[_0x125d('0x20')](function(_0x1e40a3){if(_0x1e40a3){return{'count':_0x1e40a3[_0x125d('0x30')],'rows':_[_0x125d('0x3e')](_0x1e40a3[_0x125d('0x55')],function(_0xd6df1a){return{'membername':_0xd6df1a[_0x125d('0x3b')],'UserId':_0xd6df1a['id'],'queue_name':_0xb1473c[_0x125d('0x3b')],'ChatQueueId':_0xb1473c['id'],'interface':util[_0x125d('0x69')]('%s/%s',_0x125d('0x6a'),_0xd6df1a[_0x125d('0x3b')]),'penalty':0x0,'paused':_0xd6df1a[_0x125d('0x67')],'createdAt':_0xd6df1a['createdAt'],'updatedAt':_0xd6df1a[_0x125d('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x125d('0x20')](respondWithFilteredResult(_0x3f23f6,_0x2383e2))['catch'](handleError(_0x3f23f6,null));};exports[_0x125d('0x6b')]=function(_0x5007ae,_0x82b245,_0x1592f4){var _0x1b1653={};var _0x31cf9a={};var _0x551b7d;var _0x5588e5;return db[_0x125d('0x52')][_0x125d('0x61')]({'where':{'id':_0x5007ae['params']['id']}})['then'](handleEntityNotFound(_0x82b245,null))[_0x125d('0x20')](function(_0x5717dd){if(_0x5717dd){_0x551b7d=_0x5717dd;_0x31cf9a[_0x125d('0x42')]=_[_0x125d('0x44')](db[_0x125d('0x6c')][_0x125d('0x58')]);_0x31cf9a['query']=_[_0x125d('0x44')](_0x5007ae[_0x125d('0x43')]);_0x31cf9a[_0x125d('0x45')]=_[_0x125d('0x46')](_0x31cf9a['model'],_0x31cf9a['query']);_0x1b1653[_0x125d('0x47')]=_[_0x125d('0x46')](_0x31cf9a[_0x125d('0x42')],qs[_0x125d('0x48')](_0x5007ae[_0x125d('0x43')][_0x125d('0x48')]));_0x1b1653[_0x125d('0x47')]=_0x1b1653[_0x125d('0x47')][_0x125d('0x49')]?_0x1b1653[_0x125d('0x47')]:_0x31cf9a['model'];_0x1b1653[_0x125d('0x4c')]=qs['sort'](_0x5007ae[_0x125d('0x43')][_0x125d('0x4d')]);_0x1b1653['where']=qs['filters'](_[_0x125d('0x63')](_0x5007ae['query'],_0x31cf9a[_0x125d('0x45')]));if(_0x5007ae[_0x125d('0x43')]['filter']){_0x1b1653[_0x125d('0x4e')]=_[_0x125d('0x50')](_0x1b1653[_0x125d('0x4e')],{'$or':_[_0x125d('0x3e')](_0x1b1653[_0x125d('0x47')],function(_0x74d416){var _0x5d9a79={};_0x5d9a79[_0x74d416]={'$like':'%'+_0x5007ae['query'][_0x125d('0x4f')]+'%'};return _0x5d9a79;})});}_0x1b1653=_[_0x125d('0x50')]({},_0x1b1653,_0x5007ae['options']);return _0x551b7d[_0x125d('0x6b')](_0x1b1653);}})[_0x125d('0x20')](function(_0x1f194d){if(_0x1f194d){_0x5588e5=_0x1f194d[_0x125d('0x49')];if(!_0x5007ae[_0x125d('0x43')][_0x125d('0x4a')](_0x125d('0x4b'))){_0x1b1653[_0x125d('0x32')]=qs['limit'](_0x5007ae[_0x125d('0x43')][_0x125d('0x32')]);_0x1b1653[_0x125d('0x31')]=qs[_0x125d('0x31')](_0x5007ae[_0x125d('0x43')][_0x125d('0x31')]);}return _0x551b7d['getTeams'](_0x1b1653);}})[_0x125d('0x20')](function(_0x38f5eb){if(_0x38f5eb){return _0x38f5eb?{'count':_0x5588e5,'rows':_0x38f5eb}:null;}})['then'](respondWithResult(_0x82b245,null))[_0x125d('0x2b')](handleError(_0x82b245,null));};exports[_0x125d('0x6d')]=function(_0x4596db,_0x20c7e9,_0x10a282){var _0x562043=_0x4596db[_0x125d('0x5b')][_0x125d('0x6e')];return db['Team'][_0x125d('0x54')]({'where':{'id':_0x562043},'attributes':['id'],'include':[{'model':db[_0x125d('0x64')],'as':_0x125d('0x6f'),'attributes':['id','name',_0x125d('0x70'),_0x125d('0x71'),_0x125d('0x72')],'raw':!![]}]})['then'](function(_0x31692c){if(_0x31692c){var _0x6cbdb=_[_0x125d('0x73')](_0x31692c,function(_0x2edf86){var _0x1e5ff3=_0x2edf86[_0x125d('0x37')]({'plain':!![]});return _0x1e5ff3[_0x125d('0x6f')];});return db['ChatQueue'][_0x125d('0x5e')]({'where':{'id':_0x4596db[_0x125d('0x57')]['id']}})[_0x125d('0x20')](function(_0x5091ee){return db[_0x125d('0x74')][_0x125d('0x75')](function(_0x2e253d){return _0x5091ee[_0x125d('0x6d')](_0x562043,{'transaction':_0x2e253d})[_0x125d('0x20')](function(){return BPromise['each'](_0x6cbdb,function(_0x1c2a14){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x1c2a14['id'],'ChatQueueId':_0x4596db[_0x125d('0x57')]['id']},'transaction':_0x2e253d});});})[_0x125d('0x20')](function(){_0x6cbdb[_0x125d('0x76')](function(_0x75b335){socket[_0x125d('0x77')](_0x125d('0x78'),{'UserId':_0x75b335['id'],'ChatQueueId':_0x5091ee['id']});});});});});}})[_0x125d('0x20')](respondWithStatusCode(_0x20c7e9,null))[_0x125d('0x2b')](handleError(_0x20c7e9,null));};exports[_0x125d('0x79')]=function(_0x323b64,_0x379435,_0x341b62){return db[_0x125d('0x6c')]['findAll']({'where':{'id':_0x323b64[_0x125d('0x43')][_0x125d('0x6e')]},'attributes':['id'],'include':[{'model':db[_0x125d('0x64')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x125d('0x20')](handleEntityNotFound(_0x379435,null))[_0x125d('0x20')](function(_0x3ae88d){var _0x345b78=_[_0x125d('0x3e')](_0x3ae88d,'id');var _0x28295f=[];var _0x3ebbfb=[];var _0x4c44b3=squel['select']();_0x4c44b3['field']('tq.TeamId')['from']('team_has_chat_queues','tq')[_0x125d('0x7a')](_0x125d('0x7b'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x125d('0x4e')]('ChatQueueId\x20=\x20?',_0x323b64['params']['id']);for(var _0x1e8d76=0x0;_0x1e8d76<_0x3ae88d[_0x125d('0x49')];_0x1e8d76+=0x1){let _0x14b29f=_0x3ae88d[_0x1e8d76];for(var _0x200b80=0x0;_0x200b80<_0x14b29f['Agents']['length'];_0x200b80+=0x1){let _0x53da7c=_0x14b29f[_0x125d('0x6f')][_0x200b80];var _0x11112c=_0x4c44b3['clone']();_0x11112c[_0x125d('0x4e')](_0x125d('0x7c'),_0x53da7c['id']);_0x3ebbfb[_0x125d('0x7d')](db[_0x125d('0x74')][_0x125d('0x43')](_0x11112c[_0x125d('0x7e')](),{'type':db['sequelize'][_0x125d('0x7f')][_0x125d('0x80')]})[_0x125d('0x20')](function(_0x33d9aa){if(_0x33d9aa[_0x125d('0x49')]===0x1){return _0x53da7c['id'];}else{var _0x46fda9=_[_0x125d('0x81')](_[_0x125d('0x3e')](_0x33d9aa,_0x125d('0x82')),function(_0x34ce92){return _['includes'](_0x345b78,_0x34ce92);});if(_0x46fda9){return _0x53da7c['id'];}}}));}}return BPromise[_0x125d('0x83')](_0x3ebbfb)[_0x125d('0x20')](function(_0x4bb2fc){_0x28295f=_(_0x28295f)['union'](_0x4bb2fc)['compact']()['value']();return db[_0x125d('0x52')][_0x125d('0x5e')]({'where':{'id':_0x323b64['params']['id']}})[_0x125d('0x20')](function(_0x3c031d){return db[_0x125d('0x74')]['transaction'](function(_0x78623c){return _0x3c031d[_0x125d('0x79')](_0x323b64[_0x125d('0x43')][_0x125d('0x6e')],{'transaction':_0x78623c})[_0x125d('0x20')](function(){if(!_[_0x125d('0x84')](_0x28295f)){return _0x3c031d[_0x125d('0x85')](_0x28295f,{'transaction':_0x78623c});}})[_0x125d('0x20')](function(){_0x28295f[_0x125d('0x76')](function(_0x223ed4){socket[_0x125d('0x77')](_0x125d('0x86'),{'UserId':_0x223ed4,'ChatQueueId':_0x3c031d['id']});});});});});});})[_0x125d('0x20')](respondWithStatusCode(_0x379435,null))[_0x125d('0x2b')](handleError(_0x379435,null));};exports[_0x125d('0x87')]=function(_0x2fcdc1,_0x581996,_0x3ad3dc){return db[_0x125d('0x52')][_0x125d('0x5e')]({'where':{'id':_0x2fcdc1['params']['id']}})[_0x125d('0x20')](handleEntityNotFound(_0x581996,null))['then'](function(_0x124d87){if(_0x124d87){return _0x124d87['addAgents'](_0x2fcdc1[_0x125d('0x5b')]['ids'],_[_0x125d('0x88')](_0x2fcdc1[_0x125d('0x5b')],[_0x125d('0x6e'),'id'])||{})[_0x125d('0x89')](function(_0x5a23c1){for(var _0x42a25a=0x0;_0x42a25a<_0x2fcdc1[_0x125d('0x5b')][_0x125d('0x6e')][_0x125d('0x49')];_0x42a25a+=0x1){socket['emit']('userChatQueue:save',{'UserId':_0x2fcdc1[_0x125d('0x5b')][_0x125d('0x6e')][_0x42a25a],'ChatQueueId':_0x2fcdc1[_0x125d('0x57')]['id']});}return _0x5a23c1;});}})[_0x125d('0x20')](respondWithResult(_0x581996,null))[_0x125d('0x2b')](handleError(_0x581996,null));};exports[_0x125d('0x85')]=function(_0x520bec,_0x40e71d,_0x4de83c){return db[_0x125d('0x52')]['find']({'where':{'id':_0x520bec[_0x125d('0x57')]['id']}})[_0x125d('0x20')](handleEntityNotFound(_0x40e71d,null))[_0x125d('0x20')](function(_0x46beb1){if(_0x46beb1){return _0x46beb1[_0x125d('0x85')](_0x520bec[_0x125d('0x43')]['ids'])[_0x125d('0x20')](function(){if(_[_0x125d('0x8a')](_0x520bec['query']['ids'])){for(var _0x28c7b9=0x0;_0x28c7b9<_0x520bec[_0x125d('0x43')][_0x125d('0x6e')][_0x125d('0x49')];_0x28c7b9+=0x1){socket[_0x125d('0x77')](_0x125d('0x86'),{'UserId':Number(_0x520bec[_0x125d('0x43')]['ids'][_0x28c7b9]),'ChatQueueId':Number(_0x520bec['params']['id'])});}}else{socket[_0x125d('0x77')](_0x125d('0x86'),{'UserId':Number(_0x520bec['query']['ids']),'ChatQueueId':Number(_0x520bec[_0x125d('0x57')]['id'])});}});}})[_0x125d('0x20')](respondWithStatusCode(_0x40e71d,null))[_0x125d('0x2b')](handleError(_0x40e71d,null));};exports[_0x125d('0x8b')]=function(_0xe59438,_0x1a0f49,_0x4c39d8){var _0x12e3af={};var _0x558f0b={};var _0x8903f8;var _0x40b00b;return db[_0x125d('0x52')][_0x125d('0x61')]({'where':{'id':_0xe59438[_0x125d('0x57')]['id']}})[_0x125d('0x20')](handleEntityNotFound(_0x1a0f49,null))[_0x125d('0x20')](function(_0x58f5d7){if(_0x58f5d7){_0x8903f8=_0x58f5d7;_0x558f0b[_0x125d('0x42')]=_[_0x125d('0x44')](db[_0x125d('0x64')]['rawAttributes']);_0x558f0b[_0x125d('0x43')]=_[_0x125d('0x44')](_0xe59438[_0x125d('0x43')]);_0x558f0b['filters']=_[_0x125d('0x46')](_0x558f0b[_0x125d('0x42')],_0x558f0b[_0x125d('0x43')]);_0x12e3af[_0x125d('0x47')]=_['intersection'](_0x558f0b[_0x125d('0x42')],qs[_0x125d('0x48')](_0xe59438[_0x125d('0x43')][_0x125d('0x48')]));_0x12e3af['attributes']=_0x12e3af[_0x125d('0x47')]['length']?_0x12e3af['attributes']:_0x558f0b[_0x125d('0x42')];_0x12e3af['order']=qs['sort'](_0xe59438[_0x125d('0x43')]['sort']);_0x12e3af[_0x125d('0x4e')]=qs[_0x125d('0x45')](_[_0x125d('0x63')](_0xe59438['query'],_0x558f0b['filters']));if(_0xe59438[_0x125d('0x43')][_0x125d('0x4f')]){_0x12e3af[_0x125d('0x4e')]=_[_0x125d('0x50')](_0x12e3af[_0x125d('0x4e')],{'$or':_[_0x125d('0x3e')](_0x12e3af[_0x125d('0x47')],function(_0x2cb015){var _0x112ff3={};_0x112ff3[_0x2cb015]={'$like':'%'+_0xe59438['query'][_0x125d('0x4f')]+'%'};return _0x112ff3;})});}_0x12e3af=_[_0x125d('0x50')]({},_0x12e3af,_0xe59438['options']);return _0x8903f8[_0x125d('0x8b')](_0x12e3af);}})[_0x125d('0x20')](function(_0xdfd6c3){if(_0xdfd6c3){_0x40b00b=_0xdfd6c3[_0x125d('0x49')];if(!_0xe59438[_0x125d('0x43')][_0x125d('0x4a')](_0x125d('0x4b'))){_0x12e3af[_0x125d('0x32')]=qs[_0x125d('0x32')](_0xe59438['query']['limit']);_0x12e3af[_0x125d('0x31')]=qs[_0x125d('0x31')](_0xe59438['query'][_0x125d('0x31')]);}return _0x8903f8[_0x125d('0x8b')](_0x12e3af);}})[_0x125d('0x20')](function(_0x26fd21){if(_0x26fd21){return _0x26fd21?{'count':_0x40b00b,'rows':_0x26fd21}:null;}})[_0x125d('0x20')](respondWithResult(_0x1a0f49,null))['catch'](handleError(_0x1a0f49,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index a56b104..bc7e782 100644 --- a/server/api/chatQueue/chatQueue.events.js +++ b/server/api/chatQueue/chatQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x536e7b,_0xd0448b){var _0x517f51=function(_0x2fbb2d){while(--_0x2fbb2d){_0x536e7b['push'](_0x536e7b['shift']());}};_0x517f51(++_0xd0448b);}(_0xb10b,0x12a));var _0xbb10=function(_0x33c090,_0x184b69){_0x33c090=_0x33c090-0x0;var _0x4081df=_0xb10b[_0x33c090];return _0x4081df;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x0b0e=['ChatQueue','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x293175,_0x4a50b3){var _0x20d885=function(_0x5e67b5){while(--_0x5e67b5){_0x293175['push'](_0x293175['shift']());}};_0x20d885(++_0x4a50b3);}(_0x0b0e,0x187));var _0xe0b0=function(_0x137d1d,_0x35c663){_0x137d1d=_0x137d1d-0x0;var _0x485108=_0x0b0e[_0x137d1d];return _0x485108;};'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 fc58248..12796dd 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 _0xb85e=['../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2bed4c,_0x8f26e8){var _0x49893f=function(_0xe023d){while(--_0xe023d){_0x2bed4c['push'](_0x2bed4c['shift']());}};_0x49893f(++_0x8f26e8);}(_0xb85e,0x150));var _0xeb85=function(_0x550168,_0x13e530){_0x550168=_0x550168-0x0;var _0xbc8494=_0xb85e[_0x550168];return _0xbc8494;};'use strict';var _=require('lodash');var util=require(_0xeb85('0x0'));var logger=require(_0xeb85('0x1'))('api');var moment=require(_0xeb85('0x2'));var BPromise=require(_0xeb85('0x3'));var rp=require(_0xeb85('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xeb85('0x5'));var attributes=require(_0xeb85('0x6'));module[_0xeb85('0x7')]=function(_0xfc80cc,_0x440d95){return _0xfc80cc[_0xeb85('0x8')](_0xeb85('0x9'),attributes,{'tableName':_0xeb85('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe447=['chat_queues','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatQueue'];(function(_0x54c51b,_0x41b25e){var _0x3dfe50=function(_0x1e513e){while(--_0x1e513e){_0x54c51b['push'](_0x54c51b['shift']());}};_0x3dfe50(++_0x41b25e);}(_0xe447,0xe5));var _0x7e44=function(_0xcc933b,_0xc40184){_0xcc933b=_0xcc933b-0x0;var _0x17d7dd=_0xe447[_0xcc933b];return _0x17d7dd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7e44('0x0'))(_0x7e44('0x1'));var moment=require(_0x7e44('0x2'));var BPromise=require(_0x7e44('0x3'));var rp=require(_0x7e44('0x4'));var fs=require('fs');var path=require(_0x7e44('0x5'));var rimraf=require(_0x7e44('0x6'));var config=require(_0x7e44('0x7'));var attributes=require('./chatQueue.attributes');module[_0x7e44('0x8')]=function(_0x491a83,_0x59b42e){return _0x491a83[_0x7e44('0x9')](_0x7e44('0xa'),attributes,{'tableName':_0x7e44('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 4aa9e73..7f87feb 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 _0x7980=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./chatQueue.socket','register','request','then','info','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','ChatQueue','options','raw','where','limit','map','include','model','attributes','debug','ShowChatQueue','find','lodash','util','bluebird'];(function(_0x29c5f2,_0x2e27f0){var _0x22a40e=function(_0x345f19){while(--_0x345f19){_0x29c5f2['push'](_0x29c5f2['shift']());}};_0x22a40e(++_0x2e27f0);}(_0x7980,0x123));var _0x0798=function(_0x1431db,_0x2160f7){_0x1431db=_0x1431db-0x0;var _0x5dcb4a=_0x7980[_0x1431db];return _0x5dcb4a;};'use strict';var _=require(_0x0798('0x0'));var util=require(_0x0798('0x1'));var moment=require('moment');var BPromise=require(_0x0798('0x2'));var rs=require(_0x0798('0x3'));var fs=require('fs');var Redis=require(_0x0798('0x4'));var db=require(_0x0798('0x5'))['db'];var utils=require(_0x0798('0x6'));var logger=require(_0x0798('0x7'))(_0x0798('0x8'));var config=require(_0x0798('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0798('0xa')][_0x0798('0xb')]({'port':0x232a});config[_0x0798('0xc')]=_[_0x0798('0xd')](config[_0x0798('0xc')],{'host':_0x0798('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0798('0xc')]));require(_0x0798('0xf'))[_0x0798('0x10')](socket);function respondWithRpcPromise(_0x2524a4,_0xf2c8dc,_0x393e71){return new BPromise(function(_0x329189,_0x218b3f){return client[_0x0798('0x11')](_0x2524a4,_0x393e71)[_0x0798('0x12')](function(_0xbbb97e){logger[_0x0798('0x13')]('ChatQueue,\x20%s,\x20%s',_0xf2c8dc,_0x0798('0x14'));logger['debug'](_0x0798('0x15'),_0xf2c8dc,'request\x20sent',JSON[_0x0798('0x16')](_0xbbb97e));if(_0xbbb97e['error']){if(_0xbbb97e[_0x0798('0x17')][_0x0798('0x18')]===0x1f4){logger[_0x0798('0x17')](_0x0798('0x19'),_0xf2c8dc,_0xbbb97e[_0x0798('0x17')][_0x0798('0x1a')]);return _0x218b3f(_0xbbb97e[_0x0798('0x17')][_0x0798('0x1a')]);}logger[_0x0798('0x17')](_0x0798('0x19'),_0xf2c8dc,_0xbbb97e[_0x0798('0x17')][_0x0798('0x1a')]);return _0x329189(_0xbbb97e[_0x0798('0x17')][_0x0798('0x1a')]);}else{logger[_0x0798('0x13')](_0x0798('0x19'),_0xf2c8dc,_0x0798('0x14'));_0x329189(_0xbbb97e[_0x0798('0x1b')]['message']);}})[_0x0798('0x1c')](function(_0x101221){logger[_0x0798('0x17')](_0x0798('0x19'),_0xf2c8dc,_0x101221);_0x218b3f(_0x101221);});});}exports[_0x0798('0x1d')]=function(_0x233855){var _0x583549=this;return new Promise(function(_0x17202c,_0x58e55c){return db[_0x0798('0x1e')]['findAll']({'raw':_0x233855['options']?_0x233855[_0x0798('0x1f')][_0x0798('0x20')]===undefined?!![]:![]:!![],'where':_0x233855[_0x0798('0x1f')]?_0x233855[_0x0798('0x1f')][_0x0798('0x21')]||null:null,'attributes':_0x233855['options']?_0x233855[_0x0798('0x1f')]['attributes']||null:null,'limit':_0x233855[_0x0798('0x1f')]?_0x233855['options'][_0x0798('0x22')]||null:null,'include':_0x233855[_0x0798('0x1f')]?_0x233855[_0x0798('0x1f')]['include']?_[_0x0798('0x23')](_0x233855['options'][_0x0798('0x24')],function(_0x1ced2f){return{'model':db[_0x1ced2f[_0x0798('0x25')]],'as':_0x1ced2f['as'],'attributes':_0x1ced2f[_0x0798('0x26')],'include':_0x1ced2f['include']?_[_0x0798('0x23')](_0x1ced2f['include'],function(_0x1467db){return{'model':db[_0x1467db[_0x0798('0x25')]],'as':_0x1467db['as'],'attributes':_0x1467db[_0x0798('0x26')],'include':_0x1467db['include']?_[_0x0798('0x23')](_0x1467db['include'],function(_0x12c9b0){return{'model':db[_0x12c9b0[_0x0798('0x25')]],'as':_0x12c9b0['as'],'attributes':_0x12c9b0[_0x0798('0x26')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50446d){logger[_0x0798('0x13')](_0x0798('0x1d'),_0x233855);logger[_0x0798('0x27')](_0x0798('0x1d'),_0x233855,JSON['stringify'](_0x50446d));_0x17202c(_0x50446d);})[_0x0798('0x1c')](function(_0x265fc1){logger[_0x0798('0x17')](_0x0798('0x1d'),_0x265fc1[_0x0798('0x1a')],_0x233855);_0x58e55c(_0x583549[_0x0798('0x17')](0x1f4,_0x265fc1[_0x0798('0x1a')]));});});};exports[_0x0798('0x28')]=function(_0x16a974){var _0x1dab74=this;return new Promise(function(_0x535a50,_0x45becc){return db[_0x0798('0x1e')][_0x0798('0x29')]({'raw':_0x16a974['options']?_0x16a974[_0x0798('0x1f')][_0x0798('0x20')]===undefined?!![]:![]:!![],'where':_0x16a974['options']?_0x16a974[_0x0798('0x1f')][_0x0798('0x21')]||null:null,'attributes':_0x16a974[_0x0798('0x1f')]?_0x16a974[_0x0798('0x1f')][_0x0798('0x26')]||null:null,'include':_0x16a974[_0x0798('0x1f')]?_0x16a974[_0x0798('0x1f')][_0x0798('0x24')]?_[_0x0798('0x23')](_0x16a974[_0x0798('0x1f')]['include'],function(_0x77cac1){return{'model':db[_0x77cac1['model']],'as':_0x77cac1['as'],'attributes':_0x77cac1[_0x0798('0x26')],'include':_0x77cac1['include']?_['map'](_0x77cac1[_0x0798('0x24')],function(_0x4109cd){return{'model':db[_0x4109cd[_0x0798('0x25')]],'as':_0x4109cd['as'],'attributes':_0x4109cd[_0x0798('0x26')],'include':_0x4109cd[_0x0798('0x24')]?_[_0x0798('0x23')](_0x4109cd['include'],function(_0x1dac1e){return{'model':db[_0x1dac1e['model']],'as':_0x1dac1e['as'],'attributes':_0x1dac1e[_0x0798('0x26')]};}):[]};}):[]};}):[]:[]})[_0x0798('0x12')](function(_0x4b0337){logger[_0x0798('0x13')](_0x0798('0x28'),_0x16a974);logger[_0x0798('0x27')](_0x0798('0x28'),_0x16a974,JSON['stringify'](_0x4b0337));_0x535a50(_0x4b0337);})['catch'](function(_0x5a877e){logger[_0x0798('0x17')](_0x0798('0x28'),_0x5a877e[_0x0798('0x1a')],_0x16a974);_0x45becc(_0x1dab74[_0x0798('0x17')](0x1f4,_0x5a877e[_0x0798('0x1a')]));});});}; \ No newline at end of file +var _0x657e=['../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','socket.io-emitter','./chatQueue.socket','register','then','info','request\x20sent','debug','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','catch','GetChatQueue','ChatQueue','findAll','raw','options','where','attributes','limit','include','map','model','find','ShowChatQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x2af45d,_0x1aab8c){var _0x9c9f38=function(_0x3adfdb){while(--_0x3adfdb){_0x2af45d['push'](_0x2af45d['shift']());}};_0x9c9f38(++_0x1aab8c);}(_0x657e,0x1c2));var _0xe657=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x657e[_0x10004e];return _0x5af990;};'use strict';var _=require(_0xe657('0x0'));var util=require(_0xe657('0x1'));var moment=require(_0xe657('0x2'));var BPromise=require(_0xe657('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe657('0x4'));var db=require(_0xe657('0x5'))['db'];var utils=require(_0xe657('0x6'));var logger=require(_0xe657('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe657('0x8'));var client=jayson[_0xe657('0x9')]['http']({'port':0x232a});config[_0xe657('0xa')]=_[_0xe657('0xb')](config[_0xe657('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xe657('0xc'))(new Redis(config[_0xe657('0xa')]));require(_0xe657('0xd'))[_0xe657('0xe')](socket);function respondWithRpcPromise(_0x37f91d,_0x3e33c8,_0x4ab4f0){return new BPromise(function(_0xe04ba9,_0xf06a03){return client['request'](_0x37f91d,_0x4ab4f0)[_0xe657('0xf')](function(_0x2a66d9){logger[_0xe657('0x10')]('ChatQueue,\x20%s,\x20%s',_0x3e33c8,_0xe657('0x11'));logger[_0xe657('0x12')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x3e33c8,'request\x20sent',JSON[_0xe657('0x13')](_0x2a66d9));if(_0x2a66d9[_0xe657('0x14')]){if(_0x2a66d9[_0xe657('0x14')][_0xe657('0x15')]===0x1f4){logger[_0xe657('0x14')](_0xe657('0x16'),_0x3e33c8,_0x2a66d9['error']['message']);return _0xf06a03(_0x2a66d9[_0xe657('0x14')][_0xe657('0x17')]);}logger['error'](_0xe657('0x16'),_0x3e33c8,_0x2a66d9[_0xe657('0x14')]['message']);return _0xe04ba9(_0x2a66d9[_0xe657('0x14')][_0xe657('0x17')]);}else{logger[_0xe657('0x10')](_0xe657('0x16'),_0x3e33c8,_0xe657('0x11'));_0xe04ba9(_0x2a66d9['result'][_0xe657('0x17')]);}})[_0xe657('0x18')](function(_0x4c41df){logger[_0xe657('0x14')]('ChatQueue,\x20%s,\x20%s',_0x3e33c8,_0x4c41df);_0xf06a03(_0x4c41df);});});}exports[_0xe657('0x19')]=function(_0x5c3a7d){var _0x163ae3=this;return new Promise(function(_0x1b8b2c,_0x1c563b){return db[_0xe657('0x1a')][_0xe657('0x1b')]({'raw':_0x5c3a7d['options']?_0x5c3a7d['options'][_0xe657('0x1c')]===undefined?!![]:![]:!![],'where':_0x5c3a7d['options']?_0x5c3a7d[_0xe657('0x1d')][_0xe657('0x1e')]||null:null,'attributes':_0x5c3a7d[_0xe657('0x1d')]?_0x5c3a7d[_0xe657('0x1d')][_0xe657('0x1f')]||null:null,'limit':_0x5c3a7d[_0xe657('0x1d')]?_0x5c3a7d['options'][_0xe657('0x20')]||null:null,'include':_0x5c3a7d[_0xe657('0x1d')]?_0x5c3a7d[_0xe657('0x1d')][_0xe657('0x21')]?_[_0xe657('0x22')](_0x5c3a7d[_0xe657('0x1d')][_0xe657('0x21')],function(_0xb39831){return{'model':db[_0xb39831[_0xe657('0x23')]],'as':_0xb39831['as'],'attributes':_0xb39831['attributes'],'include':_0xb39831['include']?_[_0xe657('0x22')](_0xb39831['include'],function(_0x5ed298){return{'model':db[_0x5ed298[_0xe657('0x23')]],'as':_0x5ed298['as'],'attributes':_0x5ed298['attributes'],'include':_0x5ed298[_0xe657('0x21')]?_[_0xe657('0x22')](_0x5ed298[_0xe657('0x21')],function(_0x54ae2b){return{'model':db[_0x54ae2b[_0xe657('0x23')]],'as':_0x54ae2b['as'],'attributes':_0x54ae2b[_0xe657('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe657('0xf')](function(_0x343732){logger[_0xe657('0x10')](_0xe657('0x19'),_0x5c3a7d);logger[_0xe657('0x12')](_0xe657('0x19'),_0x5c3a7d,JSON['stringify'](_0x343732));_0x1b8b2c(_0x343732);})[_0xe657('0x18')](function(_0x11aea3){logger['error'](_0xe657('0x19'),_0x11aea3['message'],_0x5c3a7d);_0x1c563b(_0x163ae3[_0xe657('0x14')](0x1f4,_0x11aea3['message']));});});};exports['ShowChatQueue']=function(_0x46050c){var _0x46edbd=this;return new Promise(function(_0x449d25,_0x507e10){return db['ChatQueue'][_0xe657('0x24')]({'raw':_0x46050c['options']?_0x46050c[_0xe657('0x1d')][_0xe657('0x1c')]===undefined?!![]:![]:!![],'where':_0x46050c[_0xe657('0x1d')]?_0x46050c[_0xe657('0x1d')]['where']||null:null,'attributes':_0x46050c['options']?_0x46050c[_0xe657('0x1d')][_0xe657('0x1f')]||null:null,'include':_0x46050c[_0xe657('0x1d')]?_0x46050c['options'][_0xe657('0x21')]?_['map'](_0x46050c['options'][_0xe657('0x21')],function(_0x3fd030){return{'model':db[_0x3fd030['model']],'as':_0x3fd030['as'],'attributes':_0x3fd030[_0xe657('0x1f')],'include':_0x3fd030[_0xe657('0x21')]?_[_0xe657('0x22')](_0x3fd030[_0xe657('0x21')],function(_0x1b951c){return{'model':db[_0x1b951c[_0xe657('0x23')]],'as':_0x1b951c['as'],'attributes':_0x1b951c[_0xe657('0x1f')],'include':_0x1b951c[_0xe657('0x21')]?_[_0xe657('0x22')](_0x1b951c[_0xe657('0x21')],function(_0x57c028){return{'model':db[_0x57c028[_0xe657('0x23')]],'as':_0x57c028['as'],'attributes':_0x57c028[_0xe657('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe657('0xf')](function(_0x17380b){logger[_0xe657('0x10')](_0xe657('0x25'),_0x46050c);logger[_0xe657('0x12')](_0xe657('0x25'),_0x46050c,JSON[_0xe657('0x13')](_0x17380b));_0x449d25(_0x17380b);})[_0xe657('0x18')](function(_0x1f8f6e){logger[_0xe657('0x14')](_0xe657('0x25'),_0x1f8f6e[_0xe657('0x17')],_0x46050c);_0x507e10(_0x46edbd[_0xe657('0x14')](0x1f4,_0x1f8f6e['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 51e7f40..4af437e 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x47f0c3,_0x589aca){var _0x15f05d=function(_0x2691fc){while(--_0x2691fc){_0x47f0c3['push'](_0x47f0c3['shift']());}};_0x15f05d(++_0x589aca);}(_0x0b0e,0x187));var _0xe0b0=function(_0x29e3ec,_0x138a18){_0x29e3ec=_0x29e3ec-0x0;var _0x25727e=_0x0b0e[_0x29e3ec];return _0x25727e;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file +var _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x111121,_0x411158){var _0x1aabca=function(_0x35639c){while(--_0x35639c){_0x111121['push'](_0x111121['shift']());}};_0x1aabca(++_0x411158);}(_0x0b0e,0x187));var _0xe0b0=function(_0x32f9ca,_0x2fa8bc){_0x32f9ca=_0x32f9ca-0x0;var _0x52e083=_0x0b0e[_0x32f9ca];return _0x52e083;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 830f17b..8b48c36 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 _0x678f=['get','isAuthenticated','index','describe','/:id','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','/:id/users','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./chatQueue.controller'];(function(_0x2f86c0,_0xdf9166){var _0x463de3=function(_0x10f05f){while(--_0x10f05f){_0x2f86c0['push'](_0x2f86c0['shift']());}};_0x463de3(++_0xdf9166);}(_0x678f,0x106));var _0xf678=function(_0x2405bc,_0x2f28a1){_0x2405bc=_0x2405bc-0x0;var _0x5272d4=_0x678f[_0x2405bc];return _0x5272d4;};'use strict';var multer=require(_0xf678('0x0'));var util=require(_0xf678('0x1'));var path=require(_0xf678('0x2'));var timeout=require(_0xf678('0x3'));var express=require(_0xf678('0x4'));var router=express[_0xf678('0x5')]();var auth=require(_0xf678('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf678('0x7'));router[_0xf678('0x8')]('/',auth[_0xf678('0x9')](),controller[_0xf678('0xa')]);router[_0xf678('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xf678('0xb')]);router[_0xf678('0x8')](_0xf678('0xc'),auth[_0xf678('0x9')](),controller['show']);router[_0xf678('0x8')]('/:id/members',auth[_0xf678('0x9')](),controller[_0xf678('0xd')]);router[_0xf678('0x8')](_0xf678('0xe'),auth[_0xf678('0x9')](),controller[_0xf678('0xf')]);router[_0xf678('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0xf678('0x10')]);router[_0xf678('0x11')]('/',auth['isAuthenticated'](),controller[_0xf678('0x12')]);router['post']('/:id/teams',auth[_0xf678('0x9')](),controller[_0xf678('0x13')]);router[_0xf678('0x11')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0xf678('0x14')](_0xf678('0xc'),auth[_0xf678('0x9')](),controller[_0xf678('0x15')]);router['delete']('/:id',auth[_0xf678('0x9')](),controller[_0xf678('0x16')]);router[_0xf678('0x17')]('/:id/teams',auth[_0xf678('0x9')](),controller[_0xf678('0x18')]);router[_0xf678('0x17')](_0xf678('0x19'),auth[_0xf678('0x9')](),controller['removeAgents']);module[_0xf678('0x1a')]=router; \ No newline at end of file +var _0xb0c6=['index','/describe','describe','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addAgents','/:id','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated'];(function(_0x494a1b,_0x34e33a){var _0x1d2829=function(_0x31f548){while(--_0x31f548){_0x494a1b['push'](_0x494a1b['shift']());}};_0x1d2829(++_0x34e33a);}(_0xb0c6,0x17d));var _0x6b0c=function(_0x2a7603,_0x42e6f6){_0x2a7603=_0x2a7603-0x0;var _0x5a07e7=_0xb0c6[_0x2a7603];return _0x5a07e7;};'use strict';var multer=require(_0x6b0c('0x0'));var util=require(_0x6b0c('0x1'));var path=require(_0x6b0c('0x2'));var timeout=require(_0x6b0c('0x3'));var express=require(_0x6b0c('0x4'));var router=express[_0x6b0c('0x5')]();var auth=require(_0x6b0c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6b0c('0x7'));var controller=require(_0x6b0c('0x8'));router[_0x6b0c('0x9')]('/',auth[_0x6b0c('0xa')](),controller[_0x6b0c('0xb')]);router[_0x6b0c('0x9')](_0x6b0c('0xc'),auth[_0x6b0c('0xa')](),controller[_0x6b0c('0xd')]);router[_0x6b0c('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6b0c('0x9')](_0x6b0c('0xe'),auth[_0x6b0c('0xa')](),controller[_0x6b0c('0xf')]);router[_0x6b0c('0x9')]('/:id/teams',auth[_0x6b0c('0xa')](),controller[_0x6b0c('0x10')]);router[_0x6b0c('0x9')](_0x6b0c('0x11'),auth['isAuthenticated'](),controller[_0x6b0c('0x12')]);router[_0x6b0c('0x13')]('/',auth[_0x6b0c('0xa')](),controller[_0x6b0c('0x14')]);router[_0x6b0c('0x13')]('/:id/teams',auth[_0x6b0c('0xa')](),controller['addTeams']);router[_0x6b0c('0x13')](_0x6b0c('0x11'),auth[_0x6b0c('0xa')](),controller[_0x6b0c('0x15')]);router['put'](_0x6b0c('0x16'),auth[_0x6b0c('0xa')](),controller['update']);router[_0x6b0c('0x17')](_0x6b0c('0x16'),auth[_0x6b0c('0xa')](),controller[_0x6b0c('0x18')]);router[_0x6b0c('0x17')]('/:id/teams',auth['isAuthenticated'](),controller[_0x6b0c('0x19')]);router['delete'](_0x6b0c('0x11'),auth['isAuthenticated'](),controller[_0x6b0c('0x1a')]);module[_0x6b0c('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index d49c85a..23e3bf3 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 _0xbc66=['STRING','DATE','moment','sequelize','exports'];(function(_0x3070e8,_0x4b72a7){var _0x7e6a1e=function(_0x580391){while(--_0x580391){_0x3070e8['push'](_0x3070e8['shift']());}};_0x7e6a1e(++_0x4b72a7);}(_0xbc66,0x174));var _0x6bc6=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xbc66[_0x3ab51d];return _0x29a04e;};'use strict';var moment=require(_0x6bc6('0x0'));var Sequelize=require(_0x6bc6('0x1'));module[_0x6bc6('0x2')]={'uniqueid':{'type':Sequelize[_0x6bc6('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x6bc6('0x3')]},'joinAt':{'type':Sequelize[_0x6bc6('0x4')]},'leaveAt':{'type':Sequelize[_0x6bc6('0x4')]},'acceptAt':{'type':Sequelize[_0x6bc6('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x6bc6('0x3')]}}; \ No newline at end of file +var _0x775c=['DATE','moment','sequelize','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x775c,0x1c9));var _0xc775=function(_0x111e94,_0x31c837){_0x111e94=_0x111e94-0x0;var _0x3de107=_0x775c[_0x111e94];return _0x3de107;};'use strict';var moment=require(_0xc775('0x0'));var Sequelize=require(_0xc775('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xc775('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xc775('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xc775('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 0f35880..7c920e8 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 _0x533d=['body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','set','reject','save','update','then','end','error','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','model','keys','filters','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','includeAll','catch','show','params','include','find','create'];(function(_0x278f93,_0x5d74c6){var _0x47d224=function(_0x3acef8){while(--_0x3acef8){_0x278f93['push'](_0x278f93['shift']());}};_0x47d224(++_0x5d74c6);}(_0x533d,0xde));var _0xd533=function(_0xd72a25,_0x37edf2){_0xd72a25=_0xd72a25-0x0;var _0x535d90=_0x533d[_0xd72a25];return _0x535d90;};'use strict';var pdf=require(_0xd533('0x0'));var emlformat=require(_0xd533('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd533('0x2'));var jsonpatch=require(_0xd533('0x3'));var rp=require(_0xd533('0x4'));var moment=require(_0xd533('0x5'));var BPromise=require(_0xd533('0x6'));var Mustache=require(_0xd533('0x7'));var util=require(_0xd533('0x8'));var path=require(_0xd533('0x9'));var sox=require(_0xd533('0xa'));var csv=require(_0xd533('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd533('0xc'));var squel=require(_0xd533('0xd'));var crypto=require('crypto');var jsforce=require(_0xd533('0xe'));var deskjs=require(_0xd533('0xf'));var toCsv=require(_0xd533('0xb'));var querystring=require(_0xd533('0x10'));var Papa=require(_0xd533('0x11'));var Redis=require(_0xd533('0x12'));var authService=require(_0xd533('0x13'));var qs=require(_0xd533('0x14'));var as=require(_0xd533('0x15'));var hardwareService=require(_0xd533('0x16'));var logger=require(_0xd533('0x17'))('api');var utils=require(_0xd533('0x18'));var config=require(_0xd533('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34a826,_0x5584de){_0x5584de=_0x5584de||0xcc;return function(_0x3baa6e){if(_0x3baa6e){return _0x34a826[_0xd533('0x1a')](_0x5584de);}return _0x34a826[_0xd533('0x1b')](_0x5584de)['end']();};}function respondWithResult(_0x1f3361,_0x24b2a9){_0x24b2a9=_0x24b2a9||0xc8;return function(_0x93502e){if(_0x93502e){return _0x1f3361[_0xd533('0x1b')](_0x24b2a9)[_0xd533('0x1c')](_0x93502e);}};}function respondWithFilteredResult(_0x15ef94,_0x310e59){return function(_0x5e11c3){if(_0x5e11c3){var _0x2bf6f0=_0x5e11c3[_0xd533('0x1d')],_0x93851=_0x310e59[_0xd533('0x1e')],_0x375449=_0x310e59['offset']+_0x310e59['limit'],_0x2e8301;if(_0x375449>=_0x2bf6f0){_0x375449=_0x2bf6f0;_0x2e8301=0xc8;}else{_0x2e8301=0xce;}_0x15ef94[_0xd533('0x1b')](_0x2e8301);return _0x15ef94[_0xd533('0x1f')]('Content-Range',_0x93851+'-'+_0x375449+'/'+_0x2bf6f0)[_0xd533('0x1c')](_0x5e11c3);}return null;};}function patchUpdates(_0x22c199){return function(_0x8b6583){try{jsonpatch['apply'](_0x8b6583,_0x22c199,!![]);}catch(_0x514e80){return BPromise[_0xd533('0x20')](_0x514e80);}return _0x8b6583[_0xd533('0x21')]();};}function saveUpdates(_0x59ee5f,_0x272f03){return function(_0x35f759){if(_0x35f759){return _0x35f759[_0xd533('0x22')](_0x59ee5f)[_0xd533('0x23')](function(_0x25fb3f){return _0x25fb3f;});}return null;};}function removeEntity(_0x95d015,_0x94147f){return function(_0x531b7f){if(_0x531b7f){return _0x531b7f['destroy']()['then'](function(){_0x95d015[_0xd533('0x1b')](0xcc)[_0xd533('0x24')]();});}};}function handleEntityNotFound(_0x35de7c,_0x411f81){return function(_0x2bfe13){if(!_0x2bfe13){_0x35de7c[_0xd533('0x1a')](0x194);}return _0x2bfe13;};}function handleError(_0x23d680,_0x6be187){_0x6be187=_0x6be187||0x1f4;return function(_0x5a81c1){logger[_0xd533('0x25')](_0x5a81c1['stack']);if(_0x5a81c1[_0xd533('0x26')]){delete _0x5a81c1[_0xd533('0x26')];}_0x23d680[_0xd533('0x1b')](_0x6be187)[_0xd533('0x27')](_0x5a81c1);};}exports[_0xd533('0x28')]=function(_0x49543d,_0x4ded86){var _0x57ae33={},_0x225f3b={},_0x6830ca={'count':0x0,'rows':[]};var _0x48a45a=_[_0xd533('0x29')](db[_0xd533('0x2a')][_0xd533('0x2b')],function(_0x4966a8){return{'name':_0x4966a8[_0xd533('0x2c')],'type':_0x4966a8[_0xd533('0x2d')]['key']};});_0x225f3b[_0xd533('0x2e')]=_[_0xd533('0x29')](_0x48a45a,_0xd533('0x26'));_0x225f3b['query']=_[_0xd533('0x2f')](_0x49543d['query']);_0x225f3b[_0xd533('0x30')]=_[_0xd533('0x31')](_0x225f3b[_0xd533('0x2e')],_0x225f3b['query']);_0x57ae33[_0xd533('0x32')]=_['intersection'](_0x225f3b[_0xd533('0x2e')],qs[_0xd533('0x33')](_0x49543d['query'][_0xd533('0x33')]));_0x57ae33['attributes']=_0x57ae33['attributes'][_0xd533('0x34')]?_0x57ae33[_0xd533('0x32')]:_0x225f3b[_0xd533('0x2e')];if(!_0x49543d[_0xd533('0x35')][_0xd533('0x36')](_0xd533('0x37'))){_0x57ae33[_0xd533('0x38')]=qs[_0xd533('0x38')](_0x49543d[_0xd533('0x35')]['limit']);_0x57ae33[_0xd533('0x1e')]=qs[_0xd533('0x1e')](_0x49543d[_0xd533('0x35')][_0xd533('0x1e')]);}_0x57ae33[_0xd533('0x39')]=qs['sort'](_0x49543d[_0xd533('0x35')]['sort']);_0x57ae33[_0xd533('0x3a')]=qs[_0xd533('0x30')](_[_0xd533('0x3b')](_0x49543d[_0xd533('0x35')],_0x225f3b[_0xd533('0x30')]),_0x48a45a);if(_0x49543d[_0xd533('0x35')][_0xd533('0x3c')]){_0x57ae33[_0xd533('0x3a')]=_[_0xd533('0x3d')](_0x57ae33['where'],{'$or':_[_0xd533('0x29')](_0x48a45a,function(_0x460be8){if(_0x460be8[_0xd533('0x2d')]!==_0xd533('0x3e')){var _0x88c552={};_0x88c552[_0x460be8[_0xd533('0x26')]]={'$like':'%'+_0x49543d['query'][_0xd533('0x3c')]+'%'};return _0x88c552;}})});}_0x57ae33=_[_0xd533('0x3d')]({},_0x57ae33,_0x49543d['options']);var _0x20adac={'where':_0x57ae33[_0xd533('0x3a')]};return db[_0xd533('0x2a')]['count'](_0x20adac)[_0xd533('0x23')](function(_0x330e0b){_0x6830ca['count']=_0x330e0b;if(_0x49543d[_0xd533('0x35')][_0xd533('0x3f')]){_0x57ae33['include']=[{'all':!![]}];}return db[_0xd533('0x2a')]['findAll'](_0x57ae33);})['then'](function(_0x589621){_0x6830ca['rows']=_0x589621;return _0x6830ca;})[_0xd533('0x23')](respondWithFilteredResult(_0x4ded86,_0x57ae33))[_0xd533('0x40')](handleError(_0x4ded86,null));};exports[_0xd533('0x41')]=function(_0x20514f,_0x4feed7){var _0xfb8182={'raw':!![],'where':{'id':_0x20514f[_0xd533('0x42')]['id']}},_0x16eb6a={};_0x16eb6a[_0xd533('0x2e')]=_[_0xd533('0x2f')](db[_0xd533('0x2a')][_0xd533('0x2b')]);_0x16eb6a[_0xd533('0x35')]=_[_0xd533('0x2f')](_0x20514f['query']);_0x16eb6a[_0xd533('0x30')]=_[_0xd533('0x31')](_0x16eb6a['model'],_0x16eb6a[_0xd533('0x35')]);_0xfb8182[_0xd533('0x32')]=_['intersection'](_0x16eb6a['model'],qs[_0xd533('0x33')](_0x20514f[_0xd533('0x35')]['fields']));_0xfb8182[_0xd533('0x32')]=_0xfb8182['attributes'][_0xd533('0x34')]?_0xfb8182[_0xd533('0x32')]:_0x16eb6a[_0xd533('0x2e')];if(_0x20514f['query']['includeAll']){_0xfb8182[_0xd533('0x43')]=[{'all':!![]}];}_0xfb8182=_['merge']({},_0xfb8182,_0x20514f['options']);return db[_0xd533('0x2a')][_0xd533('0x44')](_0xfb8182)[_0xd533('0x23')](handleEntityNotFound(_0x4feed7,null))[_0xd533('0x23')](respondWithResult(_0x4feed7,null))[_0xd533('0x40')](handleError(_0x4feed7,null));};exports['create']=function(_0x4d675b,_0x2c13a7){return db[_0xd533('0x2a')][_0xd533('0x45')](_0x4d675b['body'],{})[_0xd533('0x23')](respondWithResult(_0x2c13a7,0xc9))[_0xd533('0x40')](handleError(_0x2c13a7,null));};exports[_0xd533('0x22')]=function(_0x3cc8e2,_0x306aba){if(_0x3cc8e2[_0xd533('0x46')]['id']){delete _0x3cc8e2[_0xd533('0x46')]['id'];}return db[_0xd533('0x2a')][_0xd533('0x44')]({'where':{'id':_0x3cc8e2[_0xd533('0x42')]['id']}})[_0xd533('0x23')](handleEntityNotFound(_0x306aba,null))[_0xd533('0x23')](saveUpdates(_0x3cc8e2[_0xd533('0x46')],null))[_0xd533('0x23')](respondWithResult(_0x306aba,null))[_0xd533('0x40')](handleError(_0x306aba,null));};exports[_0xd533('0x47')]=function(_0x47d2a0,_0x4f75b7){return db['ChatQueueReport'][_0xd533('0x44')]({'where':{'id':_0x47d2a0['params']['id']}})[_0xd533('0x23')](handleEntityNotFound(_0x4f75b7,null))[_0xd533('0x23')](removeEntity(_0x4f75b7,null))[_0xd533('0x40')](handleError(_0x4f75b7,null));};exports['describe']=function(_0x198fc6,_0x135768){return db[_0xd533('0x2a')][_0xd533('0x48')]()['then'](respondWithResult(_0x135768,null))[_0xd533('0x40')](handleError(_0x135768,null));}; \ No newline at end of file +var _0x0221=['zip-dir','moment','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','apply','reject','save','update','then','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','options','find','body','params','destroy','describe','html-pdf','eml-format'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x0221,0x1a2));var _0x1022=function(_0x22bbf3,_0x4e3575){_0x22bbf3=_0x22bbf3-0x0;var _0x2e5269=_0x0221[_0x22bbf3];return _0x2e5269;};'use strict';var pdf=require(_0x1022('0x0'));var emlformat=require(_0x1022('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1022('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1022('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1022('0x4'));var util=require(_0x1022('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x1022('0x6'));var ejs=require(_0x1022('0x7'));var fs=require('fs');var _=require(_0x1022('0x8'));var squel=require('squel');var crypto=require(_0x1022('0x9'));var jsforce=require(_0x1022('0xa'));var deskjs=require(_0x1022('0xb'));var toCsv=require(_0x1022('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1022('0xc'));var authService=require(_0x1022('0xd'));var qs=require(_0x1022('0xe'));var as=require(_0x1022('0xf'));var hardwareService=require(_0x1022('0x10'));var logger=require(_0x1022('0x11'))(_0x1022('0x12'));var utils=require('../../config/utils');var config=require(_0x1022('0x13'));var licenseUtil=require(_0x1022('0x14'));var db=require(_0x1022('0x15'))['db'];function respondWithStatusCode(_0x1c4448,_0x393fd0){_0x393fd0=_0x393fd0||0xcc;return function(_0x1eafcb){if(_0x1eafcb){return _0x1c4448[_0x1022('0x16')](_0x393fd0);}return _0x1c4448['status'](_0x393fd0)[_0x1022('0x17')]();};}function respondWithResult(_0x547555,_0x4a0bc7){_0x4a0bc7=_0x4a0bc7||0xc8;return function(_0x4efcac){if(_0x4efcac){return _0x547555[_0x1022('0x18')](_0x4a0bc7)[_0x1022('0x19')](_0x4efcac);}};}function respondWithFilteredResult(_0x22b39,_0x10c256){return function(_0x4e2edc){if(_0x4e2edc){var _0x3df140=_0x4e2edc[_0x1022('0x1a')],_0x4fa264=_0x10c256[_0x1022('0x1b')],_0x17423d=_0x10c256['offset']+_0x10c256['limit'],_0x148205;if(_0x17423d>=_0x3df140){_0x17423d=_0x3df140;_0x148205=0xc8;}else{_0x148205=0xce;}_0x22b39[_0x1022('0x18')](_0x148205);return _0x22b39[_0x1022('0x1c')]('Content-Range',_0x4fa264+'-'+_0x17423d+'/'+_0x3df140)['json'](_0x4e2edc);}return null;};}function patchUpdates(_0x1cc7d2){return function(_0x2199d6){try{jsonpatch[_0x1022('0x1d')](_0x2199d6,_0x1cc7d2,!![]);}catch(_0x1a616f){return BPromise[_0x1022('0x1e')](_0x1a616f);}return _0x2199d6[_0x1022('0x1f')]();};}function saveUpdates(_0x4eab4e,_0xe0e6ad){return function(_0x3db474){if(_0x3db474){return _0x3db474[_0x1022('0x20')](_0x4eab4e)['then'](function(_0x57fb2a){return _0x57fb2a;});}return null;};}function removeEntity(_0x387667,_0xd25dcd){return function(_0x50b070){if(_0x50b070){return _0x50b070['destroy']()[_0x1022('0x21')](function(){_0x387667[_0x1022('0x18')](0xcc)[_0x1022('0x17')]();});}};}function handleEntityNotFound(_0x5edfe3,_0x3c2220){return function(_0x445b90){if(!_0x445b90){_0x5edfe3[_0x1022('0x16')](0x194);}return _0x445b90;};}function handleError(_0x530e11,_0x14a1a5){_0x14a1a5=_0x14a1a5||0x1f4;return function(_0x102032){logger[_0x1022('0x22')](_0x102032[_0x1022('0x23')]);if(_0x102032[_0x1022('0x24')]){delete _0x102032['name'];}_0x530e11[_0x1022('0x18')](_0x14a1a5)[_0x1022('0x25')](_0x102032);};}exports[_0x1022('0x26')]=function(_0x2200ea,_0x41dabd){var _0x30db07={},_0x4c9042={},_0x2e2ffa={'count':0x0,'rows':[]};var _0x317571=_[_0x1022('0x27')](db[_0x1022('0x28')][_0x1022('0x29')],function(_0x1ffa16){return{'name':_0x1ffa16['fieldName'],'type':_0x1ffa16[_0x1022('0x2a')]['key']};});_0x4c9042[_0x1022('0x2b')]=_[_0x1022('0x27')](_0x317571,_0x1022('0x24'));_0x4c9042['query']=_[_0x1022('0x2c')](_0x2200ea[_0x1022('0x2d')]);_0x4c9042[_0x1022('0x2e')]=_[_0x1022('0x2f')](_0x4c9042[_0x1022('0x2b')],_0x4c9042[_0x1022('0x2d')]);_0x30db07[_0x1022('0x30')]=_['intersection'](_0x4c9042[_0x1022('0x2b')],qs[_0x1022('0x31')](_0x2200ea[_0x1022('0x2d')][_0x1022('0x31')]));_0x30db07[_0x1022('0x30')]=_0x30db07['attributes'][_0x1022('0x32')]?_0x30db07[_0x1022('0x30')]:_0x4c9042[_0x1022('0x2b')];if(!_0x2200ea['query']['hasOwnProperty'](_0x1022('0x33'))){_0x30db07['limit']=qs[_0x1022('0x34')](_0x2200ea['query'][_0x1022('0x34')]);_0x30db07[_0x1022('0x1b')]=qs['offset'](_0x2200ea[_0x1022('0x2d')][_0x1022('0x1b')]);}_0x30db07[_0x1022('0x35')]=qs[_0x1022('0x36')](_0x2200ea[_0x1022('0x2d')][_0x1022('0x36')]);_0x30db07[_0x1022('0x37')]=qs['filters'](_[_0x1022('0x38')](_0x2200ea[_0x1022('0x2d')],_0x4c9042[_0x1022('0x2e')]),_0x317571);if(_0x2200ea[_0x1022('0x2d')][_0x1022('0x39')]){_0x30db07[_0x1022('0x37')]=_[_0x1022('0x3a')](_0x30db07['where'],{'$or':_[_0x1022('0x27')](_0x317571,function(_0x211a92){if(_0x211a92[_0x1022('0x2a')]!=='VIRTUAL'){var _0x3c23f9={};_0x3c23f9[_0x211a92[_0x1022('0x24')]]={'$like':'%'+_0x2200ea[_0x1022('0x2d')][_0x1022('0x39')]+'%'};return _0x3c23f9;}})});}_0x30db07=_[_0x1022('0x3a')]({},_0x30db07,_0x2200ea['options']);var _0x2e7b62={'where':_0x30db07[_0x1022('0x37')]};return db['ChatQueueReport']['count'](_0x2e7b62)[_0x1022('0x21')](function(_0x57e1c6){_0x2e2ffa['count']=_0x57e1c6;if(_0x2200ea[_0x1022('0x2d')][_0x1022('0x3b')]){_0x30db07[_0x1022('0x3c')]=[{'all':!![]}];}return db[_0x1022('0x28')][_0x1022('0x3d')](_0x30db07);})[_0x1022('0x21')](function(_0x239065){_0x2e2ffa['rows']=_0x239065;return _0x2e2ffa;})['then'](respondWithFilteredResult(_0x41dabd,_0x30db07))[_0x1022('0x3e')](handleError(_0x41dabd,null));};exports[_0x1022('0x3f')]=function(_0x36ea0d,_0x32c5e7){var _0xd1c01d={'raw':!![],'where':{'id':_0x36ea0d['params']['id']}},_0x2f46ac={};_0x2f46ac[_0x1022('0x2b')]=_[_0x1022('0x2c')](db[_0x1022('0x28')][_0x1022('0x29')]);_0x2f46ac['query']=_[_0x1022('0x2c')](_0x36ea0d[_0x1022('0x2d')]);_0x2f46ac[_0x1022('0x2e')]=_[_0x1022('0x2f')](_0x2f46ac[_0x1022('0x2b')],_0x2f46ac[_0x1022('0x2d')]);_0xd1c01d[_0x1022('0x30')]=_[_0x1022('0x2f')](_0x2f46ac['model'],qs[_0x1022('0x31')](_0x36ea0d['query'][_0x1022('0x31')]));_0xd1c01d[_0x1022('0x30')]=_0xd1c01d[_0x1022('0x30')]['length']?_0xd1c01d[_0x1022('0x30')]:_0x2f46ac[_0x1022('0x2b')];if(_0x36ea0d[_0x1022('0x2d')]['includeAll']){_0xd1c01d[_0x1022('0x3c')]=[{'all':!![]}];}_0xd1c01d=_[_0x1022('0x3a')]({},_0xd1c01d,_0x36ea0d[_0x1022('0x40')]);return db['ChatQueueReport'][_0x1022('0x41')](_0xd1c01d)[_0x1022('0x21')](handleEntityNotFound(_0x32c5e7,null))[_0x1022('0x21')](respondWithResult(_0x32c5e7,null))['catch'](handleError(_0x32c5e7,null));};exports['create']=function(_0x548738,_0xf0bbcc){return db['ChatQueueReport']['create'](_0x548738[_0x1022('0x42')],{})[_0x1022('0x21')](respondWithResult(_0xf0bbcc,0xc9))[_0x1022('0x3e')](handleError(_0xf0bbcc,null));};exports[_0x1022('0x20')]=function(_0x138f5b,_0x2fbea0){if(_0x138f5b[_0x1022('0x42')]['id']){delete _0x138f5b[_0x1022('0x42')]['id'];}return db['ChatQueueReport'][_0x1022('0x41')]({'where':{'id':_0x138f5b[_0x1022('0x43')]['id']}})[_0x1022('0x21')](handleEntityNotFound(_0x2fbea0,null))[_0x1022('0x21')](saveUpdates(_0x138f5b[_0x1022('0x42')],null))['then'](respondWithResult(_0x2fbea0,null))[_0x1022('0x3e')](handleError(_0x2fbea0,null));};exports[_0x1022('0x44')]=function(_0x4b39e1,_0x10779d){return db[_0x1022('0x28')][_0x1022('0x41')]({'where':{'id':_0x4b39e1['params']['id']}})[_0x1022('0x21')](handleEntityNotFound(_0x10779d,null))[_0x1022('0x21')](removeEntity(_0x10779d,null))[_0x1022('0x3e')](handleError(_0x10779d,null));};exports['describe']=function(_0x2ccd6b,_0xbc14b6){return db[_0x1022('0x28')][_0x1022('0x45')]()['then'](respondWithResult(_0xbc14b6,null))[_0x1022('0x3e')](handleError(_0xbc14b6,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index b8edb94..fb0da2f 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 _0x800f=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','ChatQueueReport','report_chat_queue','uniqueid','util'];(function(_0x33b584,_0x1b3df3){var _0x388ac4=function(_0x34659b){while(--_0x34659b){_0x33b584['push'](_0x33b584['shift']());}};_0x388ac4(++_0x1b3df3);}(_0x800f,0x1af));var _0xf800=function(_0x1367b2,_0x1d70ed){_0x1367b2=_0x1367b2-0x0;var _0x4ea793=_0x800f[_0x1367b2];return _0x4ea793;};'use strict';var _=require('lodash');var util=require(_0xf800('0x0'));var logger=require(_0xf800('0x1'))(_0xf800('0x2'));var moment=require('moment');var BPromise=require(_0xf800('0x3'));var rp=require(_0xf800('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf800('0x5'));var config=require(_0xf800('0x6'));var attributes=require('./chatQueueReport.attributes');module[_0xf800('0x7')]=function(_0x23e77c,_0x5ee240){return _0x23e77c[_0xf800('0x8')](_0xf800('0x9'),attributes,{'tableName':_0xf800('0xa'),'paranoid':![],'indexes':[{'name':_0xf800('0xb'),'fields':[_0xf800('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf53b=['lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./chatQueueReport.attributes','exports','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x1f3437,_0x4062c5){var _0x57b792=function(_0x8adb2){while(--_0x8adb2){_0x1f3437['push'](_0x1f3437['shift']());}};_0x57b792(++_0x4062c5);}(_0xf53b,0xd8));var _0xbf53=function(_0xec3058,_0x5c1446){_0xec3058=_0xec3058-0x0;var _0x1a670d=_0xf53b[_0xec3058];return _0x1a670d;};'use strict';var _=require(_0xbf53('0x0'));var util=require(_0xbf53('0x1'));var logger=require(_0xbf53('0x2'))(_0xbf53('0x3'));var moment=require('moment');var BPromise=require(_0xbf53('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbf53('0x5'));var config=require(_0xbf53('0x6'));var attributes=require(_0xbf53('0x7'));module[_0xbf53('0x8')]=function(_0x24b188,_0x50ae47){return _0x24b188['define'](_0xbf53('0x9'),attributes,{'tableName':_0xbf53('0xa'),'paranoid':![],'indexes':[{'name':_0xbf53('0xb'),'fields':[_0xbf53('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 5b45a2c..4e5d8d5 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 _0xbb17=['attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','UpdateChatQueueReport','update','where'];(function(_0x512e0b,_0x304ad7){var _0x2a7853=function(_0x15eafa){while(--_0x15eafa){_0x512e0b['push'](_0x512e0b['shift']());}};_0x2a7853(++_0x304ad7);}(_0xbb17,0x69));var _0x7bb1=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xbb17[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x7bb1('0x0'));var util=require(_0x7bb1('0x1'));var moment=require(_0x7bb1('0x2'));var BPromise=require(_0x7bb1('0x3'));var rs=require(_0x7bb1('0x4'));var fs=require('fs');var Redis=require(_0x7bb1('0x5'));var db=require(_0x7bb1('0x6'))['db'];var utils=require(_0x7bb1('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x7bb1('0x8'));var jayson=require(_0x7bb1('0x9'));var client=jayson[_0x7bb1('0xa')][_0x7bb1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43fd95,_0x18defd,_0x808b59){return new BPromise(function(_0x32ea89,_0xb43a7d){return client['request'](_0x43fd95,_0x808b59)[_0x7bb1('0xc')](function(_0x4d8c9a){logger[_0x7bb1('0xd')](_0x7bb1('0xe'),_0x18defd,'request\x20sent');logger[_0x7bb1('0xf')](_0x7bb1('0x10'),_0x18defd,'request\x20sent',JSON['stringify'](_0x4d8c9a));if(_0x4d8c9a[_0x7bb1('0x11')]){if(_0x4d8c9a[_0x7bb1('0x11')][_0x7bb1('0x12')]===0x1f4){logger['error'](_0x7bb1('0xe'),_0x18defd,_0x4d8c9a['error'][_0x7bb1('0x13')]);return _0xb43a7d(_0x4d8c9a[_0x7bb1('0x11')][_0x7bb1('0x13')]);}logger[_0x7bb1('0x11')](_0x7bb1('0xe'),_0x18defd,_0x4d8c9a['error']['message']);return _0x32ea89(_0x4d8c9a[_0x7bb1('0x11')][_0x7bb1('0x13')]);}else{logger[_0x7bb1('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x18defd,_0x7bb1('0x14'));_0x32ea89(_0x4d8c9a[_0x7bb1('0x15')][_0x7bb1('0x13')]);}})[_0x7bb1('0x16')](function(_0x197f32){logger['error'](_0x7bb1('0xe'),_0x18defd,_0x197f32);_0xb43a7d(_0x197f32);});});}exports[_0x7bb1('0x17')]=function(_0x36cb15){var _0x39e83b=this;return new Promise(function(_0x4b0948,_0x3e460c){return db[_0x7bb1('0x18')]['create'](_0x36cb15[_0x7bb1('0x19')],{'raw':_0x36cb15['options']?_0x36cb15[_0x7bb1('0x1a')][_0x7bb1('0x1b')]===undefined?!![]:![]:!![]})[_0x7bb1('0xc')](function(_0x2e2abc){logger['info'](_0x7bb1('0x17'),_0x36cb15);logger[_0x7bb1('0xf')](_0x7bb1('0x17'),_0x36cb15,JSON['stringify'](_0x2e2abc));_0x4b0948(_0x2e2abc);})[_0x7bb1('0x16')](function(_0x39cd34){logger['error'](_0x7bb1('0x17'),_0x39cd34[_0x7bb1('0x13')],_0x36cb15);_0x3e460c(_0x39e83b[_0x7bb1('0x11')](0x1f4,_0x39cd34['message']));});});};exports[_0x7bb1('0x1c')]=function(_0x58ece1){var _0x1813e6=this;return new Promise(function(_0x4128d9,_0x4661f9){return db[_0x7bb1('0x18')][_0x7bb1('0x1d')](_0x58ece1[_0x7bb1('0x19')],{'raw':_0x58ece1[_0x7bb1('0x1a')]?_0x58ece1[_0x7bb1('0x1a')][_0x7bb1('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58ece1[_0x7bb1('0x1a')]?_0x58ece1[_0x7bb1('0x1a')][_0x7bb1('0x1e')]||null:null,'attributes':_0x58ece1[_0x7bb1('0x1a')]?_0x58ece1[_0x7bb1('0x1a')][_0x7bb1('0x1f')]||null:null,'limit':_0x58ece1['options']?_0x58ece1[_0x7bb1('0x1a')][_0x7bb1('0x20')]||null:null})[_0x7bb1('0xc')](function(_0x227510){logger[_0x7bb1('0xd')](_0x7bb1('0x1c'),_0x58ece1);logger[_0x7bb1('0xf')]('UpdateChatQueueReport',_0x58ece1,JSON[_0x7bb1('0x21')](_0x227510));_0x4128d9(_0x227510);})[_0x7bb1('0x16')](function(_0x19d294){logger['error'](_0x7bb1('0x1c'),_0x19d294[_0x7bb1('0x13')],_0x58ece1);_0x4661f9(_0x1813e6[_0x7bb1('0x11')](0x1f4,_0x19d294[_0x7bb1('0x13')]));});});}; \ No newline at end of file +var _0x8c47=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatQueueReport,\x20%s,\x20%s','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird'];(function(_0x2ea6ef,_0x57c63c){var _0x5cd872=function(_0x2497e4){while(--_0x2497e4){_0x2ea6ef['push'](_0x2ea6ef['shift']());}};_0x5cd872(++_0x57c63c);}(_0x8c47,0x1b8));var _0x78c4=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x8c47[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x78c4('0x0'));var util=require(_0x78c4('0x1'));var moment=require(_0x78c4('0x2'));var BPromise=require(_0x78c4('0x3'));var rs=require(_0x78c4('0x4'));var fs=require('fs');var Redis=require(_0x78c4('0x5'));var db=require(_0x78c4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x78c4('0x7'))(_0x78c4('0x8'));var config=require(_0x78c4('0x9'));var jayson=require(_0x78c4('0xa'));var client=jayson[_0x78c4('0xb')][_0x78c4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5e30ba,_0x14e51c,_0x29160a){return new BPromise(function(_0xf5e8fe,_0x5d6cb7){return client[_0x78c4('0xd')](_0x5e30ba,_0x29160a)[_0x78c4('0xe')](function(_0x3ea432){logger[_0x78c4('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x14e51c,_0x78c4('0x10'));logger[_0x78c4('0x11')](_0x78c4('0x12'),_0x14e51c,'request\x20sent',JSON[_0x78c4('0x13')](_0x3ea432));if(_0x3ea432['error']){if(_0x3ea432[_0x78c4('0x14')][_0x78c4('0x15')]===0x1f4){logger[_0x78c4('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x14e51c,_0x3ea432[_0x78c4('0x14')][_0x78c4('0x16')]);return _0x5d6cb7(_0x3ea432[_0x78c4('0x14')][_0x78c4('0x16')]);}logger[_0x78c4('0x14')](_0x78c4('0x17'),_0x14e51c,_0x3ea432[_0x78c4('0x14')][_0x78c4('0x16')]);return _0xf5e8fe(_0x3ea432[_0x78c4('0x14')]['message']);}else{logger[_0x78c4('0xf')](_0x78c4('0x17'),_0x14e51c,_0x78c4('0x10'));_0xf5e8fe(_0x3ea432[_0x78c4('0x18')][_0x78c4('0x16')]);}})[_0x78c4('0x19')](function(_0x4ac673){logger['error'](_0x78c4('0x17'),_0x14e51c,_0x4ac673);_0x5d6cb7(_0x4ac673);});});}exports[_0x78c4('0x1a')]=function(_0x411e05){var _0x10c951=this;return new Promise(function(_0x1e5786,_0x23dbcf){return db[_0x78c4('0x1b')][_0x78c4('0x1c')](_0x411e05[_0x78c4('0x1d')],{'raw':_0x411e05[_0x78c4('0x1e')]?_0x411e05[_0x78c4('0x1e')][_0x78c4('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x27d5ab){logger[_0x78c4('0xf')](_0x78c4('0x1a'),_0x411e05);logger[_0x78c4('0x11')](_0x78c4('0x1a'),_0x411e05,JSON['stringify'](_0x27d5ab));_0x1e5786(_0x27d5ab);})[_0x78c4('0x19')](function(_0x2dfecb){logger[_0x78c4('0x14')](_0x78c4('0x1a'),_0x2dfecb[_0x78c4('0x16')],_0x411e05);_0x23dbcf(_0x10c951['error'](0x1f4,_0x2dfecb[_0x78c4('0x16')]));});});};exports[_0x78c4('0x20')]=function(_0x30190f){var _0x484128=this;return new Promise(function(_0x156152,_0x4cc2cb){return db['ChatQueueReport'][_0x78c4('0x21')](_0x30190f[_0x78c4('0x1d')],{'raw':_0x30190f['options']?_0x30190f[_0x78c4('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30190f[_0x78c4('0x1e')]?_0x30190f['options'][_0x78c4('0x22')]||null:null,'attributes':_0x30190f['options']?_0x30190f[_0x78c4('0x1e')][_0x78c4('0x23')]||null:null,'limit':_0x30190f[_0x78c4('0x1e')]?_0x30190f[_0x78c4('0x1e')][_0x78c4('0x24')]||null:null})[_0x78c4('0xe')](function(_0x5c5421){logger[_0x78c4('0xf')](_0x78c4('0x20'),_0x30190f);logger['debug'](_0x78c4('0x20'),_0x30190f,JSON[_0x78c4('0x13')](_0x5c5421));_0x156152(_0x5c5421);})[_0x78c4('0x19')](function(_0x3194bf){logger[_0x78c4('0x14')]('UpdateChatQueueReport',_0x3194bf[_0x78c4('0x16')],_0x30190f);_0x4cc2cb(_0x484128['error'](0x1f4,_0x3194bf[_0x78c4('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index d59b205..ac2b042 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 _0x7dc5=['./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x55b1ca,_0x2cff4c){var _0x47ad57=function(_0x290452){while(--_0x290452){_0x55b1ca['push'](_0x55b1ca['shift']());}};_0x47ad57(++_0x2cff4c);}(_0x7dc5,0x13b));var _0x57dc=function(_0x5de889,_0x115fc4){_0x5de889=_0x5de889-0x0;var _0x549a4f=_0x7dc5[_0x5de889];return _0x549a4f;};'use strict';var multer=require('multer');var util=require(_0x57dc('0x0'));var path=require(_0x57dc('0x1'));var timeout=require(_0x57dc('0x2'));var express=require(_0x57dc('0x3'));var router=express[_0x57dc('0x4')]();var auth=require(_0x57dc('0x5'));var interaction=require(_0x57dc('0x6'));var config=require(_0x57dc('0x7'));var controller=require(_0x57dc('0x8'));router[_0x57dc('0x9')]('/',auth[_0x57dc('0xa')](),controller[_0x57dc('0xb')]);router[_0x57dc('0x9')](_0x57dc('0xc'),auth[_0x57dc('0xa')](),controller[_0x57dc('0xd')]);router[_0x57dc('0x9')](_0x57dc('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x57dc('0xf')](_0x57dc('0xe'),auth[_0x57dc('0xa')](),controller[_0x57dc('0x10')]);router[_0x57dc('0x11')](_0x57dc('0xe'),auth['isAuthenticated'](),controller[_0x57dc('0x12')]);module['exports']=router; \ No newline at end of file +var _0xab5d=['update','delete','exports','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','describe','/:id','show','post','put'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xab5d,0x65));var _0xdab5=function(_0x42d888,_0x555198){_0x42d888=_0x42d888-0x0;var _0x179d2f=_0xab5d[_0x42d888];return _0x179d2f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdab5('0x0'));var router=express['Router']();var auth=require(_0xdab5('0x1'));var interaction=require(_0xdab5('0x2'));var config=require(_0xdab5('0x3'));var controller=require('./chatQueueReport.controller');router['get']('/',auth[_0xdab5('0x4')](),controller[_0xdab5('0x5')]);router['get']('/describe',auth[_0xdab5('0x4')](),controller[_0xdab5('0x6')]);router['get'](_0xdab5('0x7'),auth[_0xdab5('0x4')](),controller[_0xdab5('0x8')]);router[_0xdab5('0x9')]('/',auth[_0xdab5('0x4')](),controller['create']);router[_0xdab5('0xa')](_0xdab5('0x7'),auth[_0xdab5('0x4')](),controller[_0xdab5('0xb')]);router[_0xdab5('0xc')](_0xdab5('0x7'),auth[_0xdab5('0x4')](),controller['destroy']);module[_0xdab5('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index fe96b7e..6160b5e 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 _0xc03c=['DATE','NOW','moment','sequelize','exports','STRING','account','agent','queue'];(function(_0x53d198,_0x32c22b){var _0x753342=function(_0x207c8c){while(--_0x207c8c){_0x53d198['push'](_0x53d198['shift']());}};_0x753342(++_0x32c22b);}(_0xc03c,0xbf));var _0xcc03=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xc03c[_0x49b207];return _0x2dc8fa;};'use strict';var moment=require(_0xcc03('0x0'));var Sequelize=require(_0xcc03('0x1'));module[_0xcc03('0x2')]={'uniqueid':{'type':Sequelize[_0xcc03('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xcc03('0x4'),_0xcc03('0x5'),_0xcc03('0x6')),'allowNull':![],'defaultValue':_0xcc03('0x6')},'transferredAt':{'type':Sequelize[_0xcc03('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xcc03('0x8')]}}; \ No newline at end of file +var _0x87a7=['DATE','NOW','moment','exports','STRING','ENUM','account','agent','queue'];(function(_0x9265da,_0x4368e4){var _0x192de9=function(_0x346365){while(--_0x346365){_0x9265da['push'](_0x9265da['shift']());}};_0x192de9(++_0x4368e4);}(_0x87a7,0x1a0));var _0x787a=function(_0x653302,_0x51a7f0){_0x653302=_0x653302-0x0;var _0x3b8fca=_0x87a7[_0x653302];return _0x3b8fca;};'use strict';var moment=require(_0x787a('0x0'));var Sequelize=require('sequelize');module[_0x787a('0x1')]={'uniqueid':{'type':Sequelize[_0x787a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x787a('0x3')](_0x787a('0x4'),_0x787a('0x5'),'queue'),'allowNull':![],'defaultValue':_0x787a('0x6')},'transferredAt':{'type':Sequelize[_0x787a('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x787a('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index d0baccd..24d75ff 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 _0x9a18=['destroy','then','error','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','options','include','findAll','rows','catch','show','includeAll','find','body','params','describe','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','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/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','update'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x9a18,0x1e2));var _0x89a1=function(_0x564ee7,_0x35aee5){_0x564ee7=_0x564ee7-0x0;var _0x518f12=_0x9a18[_0x564ee7];return _0x518f12;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x89a1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x89a1('0x1'));var moment=require(_0x89a1('0x2'));var BPromise=require(_0x89a1('0x3'));var Mustache=require(_0x89a1('0x4'));var util=require(_0x89a1('0x5'));var path=require(_0x89a1('0x6'));var sox=require(_0x89a1('0x7'));var csv=require(_0x89a1('0x8'));var ejs=require(_0x89a1('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x89a1('0xa'));var crypto=require(_0x89a1('0xb'));var jsforce=require(_0x89a1('0xc'));var deskjs=require(_0x89a1('0xd'));var toCsv=require(_0x89a1('0x8'));var querystring=require(_0x89a1('0xe'));var Papa=require('papaparse');var Redis=require(_0x89a1('0xf'));var authService=require(_0x89a1('0x10'));var qs=require(_0x89a1('0x11'));var as=require(_0x89a1('0x12'));var hardwareService=require(_0x89a1('0x13'));var logger=require(_0x89a1('0x14'))(_0x89a1('0x15'));var utils=require(_0x89a1('0x16'));var config=require(_0x89a1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x89a1('0x18'))['db'];function respondWithStatusCode(_0x4df4a3,_0x3864ab){_0x3864ab=_0x3864ab||0xcc;return function(_0x238109){if(_0x238109){return _0x4df4a3[_0x89a1('0x19')](_0x3864ab);}return _0x4df4a3[_0x89a1('0x1a')](_0x3864ab)[_0x89a1('0x1b')]();};}function respondWithResult(_0x44c6bd,_0x513064){_0x513064=_0x513064||0xc8;return function(_0x5e39f7){if(_0x5e39f7){return _0x44c6bd[_0x89a1('0x1a')](_0x513064)['json'](_0x5e39f7);}};}function respondWithFilteredResult(_0x54ec23,_0x3a50cb){return function(_0x226d4e){if(_0x226d4e){var _0x33124c=_0x226d4e[_0x89a1('0x1c')],_0x374290=_0x3a50cb[_0x89a1('0x1d')],_0x5da1ea=_0x3a50cb[_0x89a1('0x1d')]+_0x3a50cb[_0x89a1('0x1e')],_0x265d2a;if(_0x5da1ea>=_0x33124c){_0x5da1ea=_0x33124c;_0x265d2a=0xc8;}else{_0x265d2a=0xce;}_0x54ec23[_0x89a1('0x1a')](_0x265d2a);return _0x54ec23['set'](_0x89a1('0x1f'),_0x374290+'-'+_0x5da1ea+'/'+_0x33124c)['json'](_0x226d4e);}return null;};}function patchUpdates(_0x3714ac){return function(_0x3c0923){try{jsonpatch[_0x89a1('0x20')](_0x3c0923,_0x3714ac,!![]);}catch(_0x4ca4c1){return BPromise[_0x89a1('0x21')](_0x4ca4c1);}return _0x3c0923[_0x89a1('0x22')]();};}function saveUpdates(_0x1d023a,_0x86ad23){return function(_0x42e9b7){if(_0x42e9b7){return _0x42e9b7[_0x89a1('0x23')](_0x1d023a)['then'](function(_0x5da5ec){return _0x5da5ec;});}return null;};}function removeEntity(_0x4d8006,_0x5def41){return function(_0xe6e4ae){if(_0xe6e4ae){return _0xe6e4ae[_0x89a1('0x24')]()[_0x89a1('0x25')](function(){_0x4d8006['status'](0xcc)[_0x89a1('0x1b')]();});}};}function handleEntityNotFound(_0x1e14c0,_0x405973){return function(_0x31c564){if(!_0x31c564){_0x1e14c0['sendStatus'](0x194);}return _0x31c564;};}function handleError(_0x450ce9,_0x115e3d){_0x115e3d=_0x115e3d||0x1f4;return function(_0x169db9){logger[_0x89a1('0x26')](_0x169db9['stack']);if(_0x169db9[_0x89a1('0x27')]){delete _0x169db9[_0x89a1('0x27')];}_0x450ce9[_0x89a1('0x1a')](_0x115e3d)[_0x89a1('0x28')](_0x169db9);};}exports[_0x89a1('0x29')]=function(_0x76b557,_0x4750b4){var _0x55c45d={},_0x4bc748={},_0xc1819f={'count':0x0,'rows':[]};var _0x28a7f4=_[_0x89a1('0x2a')](db[_0x89a1('0x2b')][_0x89a1('0x2c')],function(_0x13bc5f){return{'name':_0x13bc5f[_0x89a1('0x2d')],'type':_0x13bc5f['type'][_0x89a1('0x2e')]};});_0x4bc748[_0x89a1('0x2f')]=_[_0x89a1('0x2a')](_0x28a7f4,_0x89a1('0x27'));_0x4bc748[_0x89a1('0x30')]=_[_0x89a1('0x31')](_0x76b557['query']);_0x4bc748['filters']=_[_0x89a1('0x32')](_0x4bc748[_0x89a1('0x2f')],_0x4bc748['query']);_0x55c45d[_0x89a1('0x33')]=_['intersection'](_0x4bc748[_0x89a1('0x2f')],qs[_0x89a1('0x34')](_0x76b557[_0x89a1('0x30')][_0x89a1('0x34')]));_0x55c45d[_0x89a1('0x33')]=_0x55c45d['attributes'][_0x89a1('0x35')]?_0x55c45d[_0x89a1('0x33')]:_0x4bc748[_0x89a1('0x2f')];if(!_0x76b557['query'][_0x89a1('0x36')](_0x89a1('0x37'))){_0x55c45d['limit']=qs[_0x89a1('0x1e')](_0x76b557['query'][_0x89a1('0x1e')]);_0x55c45d[_0x89a1('0x1d')]=qs[_0x89a1('0x1d')](_0x76b557['query'][_0x89a1('0x1d')]);}_0x55c45d[_0x89a1('0x38')]=qs[_0x89a1('0x39')](_0x76b557[_0x89a1('0x30')][_0x89a1('0x39')]);_0x55c45d[_0x89a1('0x3a')]=qs[_0x89a1('0x3b')](_['pick'](_0x76b557[_0x89a1('0x30')],_0x4bc748[_0x89a1('0x3b')]),_0x28a7f4);if(_0x76b557[_0x89a1('0x30')][_0x89a1('0x3c')]){_0x55c45d[_0x89a1('0x3a')]=_[_0x89a1('0x3d')](_0x55c45d[_0x89a1('0x3a')],{'$or':_[_0x89a1('0x2a')](_0x28a7f4,function(_0x2bc330){if(_0x2bc330[_0x89a1('0x3e')]!=='VIRTUAL'){var _0x308fe2={};_0x308fe2[_0x2bc330[_0x89a1('0x27')]]={'$like':'%'+_0x76b557[_0x89a1('0x30')][_0x89a1('0x3c')]+'%'};return _0x308fe2;}})});}_0x55c45d=_[_0x89a1('0x3d')]({},_0x55c45d,_0x76b557[_0x89a1('0x3f')]);var _0x445314={'where':_0x55c45d['where']};return db[_0x89a1('0x2b')][_0x89a1('0x1c')](_0x445314)[_0x89a1('0x25')](function(_0x44d1ca){_0xc1819f[_0x89a1('0x1c')]=_0x44d1ca;if(_0x76b557[_0x89a1('0x30')]['includeAll']){_0x55c45d[_0x89a1('0x40')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x89a1('0x41')](_0x55c45d);})[_0x89a1('0x25')](function(_0x3ca44a){_0xc1819f[_0x89a1('0x42')]=_0x3ca44a;return _0xc1819f;})[_0x89a1('0x25')](respondWithFilteredResult(_0x4750b4,_0x55c45d))[_0x89a1('0x43')](handleError(_0x4750b4,null));};exports[_0x89a1('0x44')]=function(_0x120bad,_0x2f3b68){var _0x166e6f={'raw':!![],'where':{'id':_0x120bad['params']['id']}},_0xda81={};_0xda81[_0x89a1('0x2f')]=_[_0x89a1('0x31')](db['ChatTransferReport'][_0x89a1('0x2c')]);_0xda81[_0x89a1('0x30')]=_[_0x89a1('0x31')](_0x120bad[_0x89a1('0x30')]);_0xda81[_0x89a1('0x3b')]=_[_0x89a1('0x32')](_0xda81[_0x89a1('0x2f')],_0xda81['query']);_0x166e6f[_0x89a1('0x33')]=_['intersection'](_0xda81['model'],qs[_0x89a1('0x34')](_0x120bad[_0x89a1('0x30')]['fields']));_0x166e6f[_0x89a1('0x33')]=_0x166e6f[_0x89a1('0x33')][_0x89a1('0x35')]?_0x166e6f[_0x89a1('0x33')]:_0xda81[_0x89a1('0x2f')];if(_0x120bad[_0x89a1('0x30')][_0x89a1('0x45')]){_0x166e6f[_0x89a1('0x40')]=[{'all':!![]}];}_0x166e6f=_['merge']({},_0x166e6f,_0x120bad['options']);return db['ChatTransferReport'][_0x89a1('0x46')](_0x166e6f)[_0x89a1('0x25')](handleEntityNotFound(_0x2f3b68,null))[_0x89a1('0x25')](respondWithResult(_0x2f3b68,null))[_0x89a1('0x43')](handleError(_0x2f3b68,null));};exports['create']=function(_0x8afe2b,_0x5d9299){return db[_0x89a1('0x2b')]['create'](_0x8afe2b[_0x89a1('0x47')],{})[_0x89a1('0x25')](respondWithResult(_0x5d9299,0xc9))[_0x89a1('0x43')](handleError(_0x5d9299,null));};exports[_0x89a1('0x23')]=function(_0x335c23,_0x22bafd){if(_0x335c23['body']['id']){delete _0x335c23[_0x89a1('0x47')]['id'];}return db['ChatTransferReport'][_0x89a1('0x46')]({'where':{'id':_0x335c23[_0x89a1('0x48')]['id']}})[_0x89a1('0x25')](handleEntityNotFound(_0x22bafd,null))['then'](saveUpdates(_0x335c23[_0x89a1('0x47')],null))['then'](respondWithResult(_0x22bafd,null))[_0x89a1('0x43')](handleError(_0x22bafd,null));};exports[_0x89a1('0x24')]=function(_0x2e5476,_0x4b8aea){return db[_0x89a1('0x2b')][_0x89a1('0x46')]({'where':{'id':_0x2e5476[_0x89a1('0x48')]['id']}})[_0x89a1('0x25')](handleEntityNotFound(_0x4b8aea,null))[_0x89a1('0x25')](removeEntity(_0x4b8aea,null))[_0x89a1('0x43')](handleError(_0x4b8aea,null));};exports['describe']=function(_0x15744f,_0x28e05f){return db['ChatTransferReport'][_0x89a1('0x49')]()[_0x89a1('0x25')](respondWithResult(_0x28e05f,null))[_0x89a1('0x43')](handleError(_0x28e05f,null));}; \ No newline at end of file +var _0x8ddc=['options','include','findAll','rows','show','length','includeAll','catch','create','body','find','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','set','Content-Range','save','then','destroy','sendStatus','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','limit','order','sort','where','pick','filter','merge'];(function(_0x4cc845,_0x22483e){var _0x39fd13=function(_0xc6990e){while(--_0xc6990e){_0x4cc845['push'](_0x4cc845['shift']());}};_0x39fd13(++_0x22483e);}(_0x8ddc,0x139));var _0xc8dd=function(_0x2b0bc2,_0x4331f5){_0x2b0bc2=_0x2b0bc2-0x0;var _0x56e5b9=_0x8ddc[_0x2b0bc2];return _0x56e5b9;};'use strict';var pdf=require(_0xc8dd('0x0'));var emlformat=require(_0xc8dd('0x1'));var rimraf=require(_0xc8dd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc8dd('0x3'));var rp=require(_0xc8dd('0x4'));var moment=require(_0xc8dd('0x5'));var BPromise=require(_0xc8dd('0x6'));var Mustache=require(_0xc8dd('0x7'));var util=require(_0xc8dd('0x8'));var path=require('path');var sox=require(_0xc8dd('0x9'));var csv=require('to-csv');var ejs=require(_0xc8dd('0xa'));var fs=require('fs');var _=require(_0xc8dd('0xb'));var squel=require(_0xc8dd('0xc'));var crypto=require(_0xc8dd('0xd'));var jsforce=require(_0xc8dd('0xe'));var deskjs=require(_0xc8dd('0xf'));var toCsv=require(_0xc8dd('0x10'));var querystring=require(_0xc8dd('0x11'));var Papa=require(_0xc8dd('0x12'));var Redis=require(_0xc8dd('0x13'));var authService=require(_0xc8dd('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc8dd('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc8dd('0x16'))(_0xc8dd('0x17'));var utils=require(_0xc8dd('0x18'));var config=require(_0xc8dd('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc8dd('0x1a'))['db'];function respondWithStatusCode(_0x2b5c7c,_0xcb2e60){_0xcb2e60=_0xcb2e60||0xcc;return function(_0x4b9b2c){if(_0x4b9b2c){return _0x2b5c7c['sendStatus'](_0xcb2e60);}return _0x2b5c7c[_0xc8dd('0x1b')](_0xcb2e60)[_0xc8dd('0x1c')]();};}function respondWithResult(_0x43bb90,_0x190686){_0x190686=_0x190686||0xc8;return function(_0x1eddbd){if(_0x1eddbd){return _0x43bb90[_0xc8dd('0x1b')](_0x190686)['json'](_0x1eddbd);}};}function respondWithFilteredResult(_0x192379,_0x2bb56c){return function(_0x2d2622){if(_0x2d2622){var _0x1debe4=_0x2d2622[_0xc8dd('0x1d')],_0x2145dd=_0x2bb56c[_0xc8dd('0x1e')],_0x444a9c=_0x2bb56c['offset']+_0x2bb56c['limit'],_0x4edba2;if(_0x444a9c>=_0x1debe4){_0x444a9c=_0x1debe4;_0x4edba2=0xc8;}else{_0x4edba2=0xce;}_0x192379[_0xc8dd('0x1b')](_0x4edba2);return _0x192379[_0xc8dd('0x1f')](_0xc8dd('0x20'),_0x2145dd+'-'+_0x444a9c+'/'+_0x1debe4)['json'](_0x2d2622);}return null;};}function patchUpdates(_0x394a5b){return function(_0x222368){try{jsonpatch['apply'](_0x222368,_0x394a5b,!![]);}catch(_0x845a0d){return BPromise['reject'](_0x845a0d);}return _0x222368[_0xc8dd('0x21')]();};}function saveUpdates(_0xef96b3,_0x5c21c2){return function(_0x45d7cb){if(_0x45d7cb){return _0x45d7cb['update'](_0xef96b3)[_0xc8dd('0x22')](function(_0x4039ee){return _0x4039ee;});}return null;};}function removeEntity(_0xcb5ad9,_0x1eca54){return function(_0x4bf224){if(_0x4bf224){return _0x4bf224[_0xc8dd('0x23')]()['then'](function(){_0xcb5ad9[_0xc8dd('0x1b')](0xcc)[_0xc8dd('0x1c')]();});}};}function handleEntityNotFound(_0x27c737,_0x5336ba){return function(_0x2071e3){if(!_0x2071e3){_0x27c737[_0xc8dd('0x24')](0x194);}return _0x2071e3;};}function handleError(_0x150f40,_0x4795a9){_0x4795a9=_0x4795a9||0x1f4;return function(_0x42cc31){logger['error'](_0x42cc31[_0xc8dd('0x25')]);if(_0x42cc31[_0xc8dd('0x26')]){delete _0x42cc31['name'];}_0x150f40['status'](_0x4795a9)[_0xc8dd('0x27')](_0x42cc31);};}exports[_0xc8dd('0x28')]=function(_0x23cb3c,_0x393ca9){var _0x2da68e={},_0x46c59b={},_0x539c44={'count':0x0,'rows':[]};var _0x7ed1d2=_[_0xc8dd('0x29')](db[_0xc8dd('0x2a')][_0xc8dd('0x2b')],function(_0x3d79a8){return{'name':_0x3d79a8[_0xc8dd('0x2c')],'type':_0x3d79a8[_0xc8dd('0x2d')][_0xc8dd('0x2e')]};});_0x46c59b[_0xc8dd('0x2f')]=_[_0xc8dd('0x29')](_0x7ed1d2,_0xc8dd('0x26'));_0x46c59b[_0xc8dd('0x30')]=_[_0xc8dd('0x31')](_0x23cb3c['query']);_0x46c59b[_0xc8dd('0x32')]=_['intersection'](_0x46c59b[_0xc8dd('0x2f')],_0x46c59b[_0xc8dd('0x30')]);_0x2da68e[_0xc8dd('0x33')]=_[_0xc8dd('0x34')](_0x46c59b[_0xc8dd('0x2f')],qs[_0xc8dd('0x35')](_0x23cb3c[_0xc8dd('0x30')][_0xc8dd('0x35')]));_0x2da68e[_0xc8dd('0x33')]=_0x2da68e['attributes']['length']?_0x2da68e[_0xc8dd('0x33')]:_0x46c59b[_0xc8dd('0x2f')];if(!_0x23cb3c[_0xc8dd('0x30')]['hasOwnProperty'](_0xc8dd('0x36'))){_0x2da68e[_0xc8dd('0x37')]=qs['limit'](_0x23cb3c[_0xc8dd('0x30')][_0xc8dd('0x37')]);_0x2da68e['offset']=qs['offset'](_0x23cb3c['query'][_0xc8dd('0x1e')]);}_0x2da68e[_0xc8dd('0x38')]=qs[_0xc8dd('0x39')](_0x23cb3c['query'][_0xc8dd('0x39')]);_0x2da68e[_0xc8dd('0x3a')]=qs['filters'](_[_0xc8dd('0x3b')](_0x23cb3c[_0xc8dd('0x30')],_0x46c59b[_0xc8dd('0x32')]),_0x7ed1d2);if(_0x23cb3c[_0xc8dd('0x30')]['filter']){_0x2da68e[_0xc8dd('0x3a')]=_['merge'](_0x2da68e[_0xc8dd('0x3a')],{'$or':_['map'](_0x7ed1d2,function(_0x1bf464){if(_0x1bf464[_0xc8dd('0x2d')]!=='VIRTUAL'){var _0x1e9fdd={};_0x1e9fdd[_0x1bf464[_0xc8dd('0x26')]]={'$like':'%'+_0x23cb3c[_0xc8dd('0x30')][_0xc8dd('0x3c')]+'%'};return _0x1e9fdd;}})});}_0x2da68e=_[_0xc8dd('0x3d')]({},_0x2da68e,_0x23cb3c[_0xc8dd('0x3e')]);var _0x46d85e={'where':_0x2da68e[_0xc8dd('0x3a')]};return db[_0xc8dd('0x2a')][_0xc8dd('0x1d')](_0x46d85e)[_0xc8dd('0x22')](function(_0x18c873){_0x539c44['count']=_0x18c873;if(_0x23cb3c[_0xc8dd('0x30')]['includeAll']){_0x2da68e[_0xc8dd('0x3f')]=[{'all':!![]}];}return db[_0xc8dd('0x2a')][_0xc8dd('0x40')](_0x2da68e);})['then'](function(_0x254feb){_0x539c44[_0xc8dd('0x41')]=_0x254feb;return _0x539c44;})[_0xc8dd('0x22')](respondWithFilteredResult(_0x393ca9,_0x2da68e))['catch'](handleError(_0x393ca9,null));};exports[_0xc8dd('0x42')]=function(_0x39a1a4,_0x4ba98a){var _0x31aaf4={'raw':!![],'where':{'id':_0x39a1a4['params']['id']}},_0xd0df5c={};_0xd0df5c[_0xc8dd('0x2f')]=_[_0xc8dd('0x31')](db[_0xc8dd('0x2a')][_0xc8dd('0x2b')]);_0xd0df5c[_0xc8dd('0x30')]=_[_0xc8dd('0x31')](_0x39a1a4[_0xc8dd('0x30')]);_0xd0df5c['filters']=_[_0xc8dd('0x34')](_0xd0df5c[_0xc8dd('0x2f')],_0xd0df5c[_0xc8dd('0x30')]);_0x31aaf4[_0xc8dd('0x33')]=_['intersection'](_0xd0df5c['model'],qs[_0xc8dd('0x35')](_0x39a1a4['query'][_0xc8dd('0x35')]));_0x31aaf4[_0xc8dd('0x33')]=_0x31aaf4[_0xc8dd('0x33')][_0xc8dd('0x43')]?_0x31aaf4['attributes']:_0xd0df5c[_0xc8dd('0x2f')];if(_0x39a1a4['query'][_0xc8dd('0x44')]){_0x31aaf4[_0xc8dd('0x3f')]=[{'all':!![]}];}_0x31aaf4=_[_0xc8dd('0x3d')]({},_0x31aaf4,_0x39a1a4[_0xc8dd('0x3e')]);return db['ChatTransferReport']['find'](_0x31aaf4)['then'](handleEntityNotFound(_0x4ba98a,null))[_0xc8dd('0x22')](respondWithResult(_0x4ba98a,null))[_0xc8dd('0x45')](handleError(_0x4ba98a,null));};exports[_0xc8dd('0x46')]=function(_0x43b93f,_0x14b72f){return db['ChatTransferReport'][_0xc8dd('0x46')](_0x43b93f[_0xc8dd('0x47')],{})['then'](respondWithResult(_0x14b72f,0xc9))[_0xc8dd('0x45')](handleError(_0x14b72f,null));};exports['update']=function(_0xe02397,_0x4b9cc7){if(_0xe02397[_0xc8dd('0x47')]['id']){delete _0xe02397[_0xc8dd('0x47')]['id'];}return db[_0xc8dd('0x2a')][_0xc8dd('0x48')]({'where':{'id':_0xe02397[_0xc8dd('0x49')]['id']}})[_0xc8dd('0x22')](handleEntityNotFound(_0x4b9cc7,null))[_0xc8dd('0x22')](saveUpdates(_0xe02397[_0xc8dd('0x47')],null))[_0xc8dd('0x22')](respondWithResult(_0x4b9cc7,null))['catch'](handleError(_0x4b9cc7,null));};exports[_0xc8dd('0x23')]=function(_0x742b9f,_0x9d7f70){return db[_0xc8dd('0x2a')]['find']({'where':{'id':_0x742b9f['params']['id']}})[_0xc8dd('0x22')](handleEntityNotFound(_0x9d7f70,null))[_0xc8dd('0x22')](removeEntity(_0x9d7f70,null))[_0xc8dd('0x45')](handleError(_0x9d7f70,null));};exports[_0xc8dd('0x4a')]=function(_0x3c00c9,_0x490298){return db['ChatTransferReport']['describe']()[_0xc8dd('0x22')](respondWithResult(_0x490298,null))['catch'](handleError(_0x490298,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index ffc0217..454e7ec 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 _0xf98a=['report_chat_transfer','uniqueid','../../config/logger','api','moment','path','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport'];(function(_0x58b1ab,_0x4bf01b){var _0x471bc8=function(_0x2fbfd0){while(--_0x2fbfd0){_0x58b1ab['push'](_0x58b1ab['shift']());}};_0x471bc8(++_0x4bf01b);}(_0xf98a,0x162));var _0xaf98=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xf98a[_0x8de54f];return _0x14cba4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaf98('0x0'))(_0xaf98('0x1'));var moment=require(_0xaf98('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xaf98('0x3'));var rimraf=require('rimraf');var config=require(_0xaf98('0x4'));var attributes=require(_0xaf98('0x5'));module[_0xaf98('0x6')]=function(_0x20d54a,_0x1b846c){return _0x20d54a[_0xaf98('0x7')](_0xaf98('0x8'),attributes,{'tableName':_0xaf98('0x9'),'paranoid':![],'indexes':[{'name':_0xaf98('0xa'),'fields':[_0xaf98('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3f62=['ChatTransferReport','report_chat_transfer','uniqueid','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports'];(function(_0x533528,_0x409d05){var _0x3189f1=function(_0x5e63d2){while(--_0x5e63d2){_0x533528['push'](_0x533528['shift']());}};_0x3189f1(++_0x409d05);}(_0x3f62,0x177));var _0x23f6=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x3f62[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x23f6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x23f6('0x1'));var moment=require(_0x23f6('0x2'));var BPromise=require('bluebird');var rp=require(_0x23f6('0x3'));var fs=require('fs');var path=require(_0x23f6('0x4'));var rimraf=require(_0x23f6('0x5'));var config=require(_0x23f6('0x6'));var attributes=require(_0x23f6('0x7'));module[_0x23f6('0x8')]=function(_0x3e8c70,_0x12ebc0){return _0x3e8c70['define'](_0x23f6('0x9'),attributes,{'tableName':_0x23f6('0xa'),'paranoid':![],'indexes':[{'name':_0x23f6('0xb'),'fields':[_0x23f6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 4a6b7e0..3a27aa5 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 _0x93a4=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','moment','bluebird'];(function(_0x38550,_0x1e36a6){var _0x556e2c=function(_0x20777a){while(--_0x20777a){_0x38550['push'](_0x38550['shift']());}};_0x556e2c(++_0x1e36a6);}(_0x93a4,0x122));var _0x493a=function(_0xf2dc0e,_0x449e9a){_0xf2dc0e=_0xf2dc0e-0x0;var _0x28672f=_0x93a4[_0xf2dc0e];return _0x28672f;};'use strict';var _=require(_0x493a('0x0'));var util=require(_0x493a('0x1'));var moment=require(_0x493a('0x2'));var BPromise=require(_0x493a('0x3'));var rs=require(_0x493a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x493a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x493a('0x6'))(_0x493a('0x7'));var config=require(_0x493a('0x8'));var jayson=require(_0x493a('0x9'));var client=jayson['client'][_0x493a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b7a8c,_0x42d728,_0x3a1abb){return new BPromise(function(_0x2efeac,_0x55d102){return client[_0x493a('0xb')](_0x2b7a8c,_0x3a1abb)['then'](function(_0x5a373a){logger['info'](_0x493a('0xc'),_0x42d728,_0x493a('0xd'));logger[_0x493a('0xe')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x42d728,_0x493a('0xd'),JSON[_0x493a('0xf')](_0x5a373a));if(_0x5a373a[_0x493a('0x10')]){if(_0x5a373a['error'][_0x493a('0x11')]===0x1f4){logger[_0x493a('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x42d728,_0x5a373a[_0x493a('0x10')][_0x493a('0x12')]);return _0x55d102(_0x5a373a[_0x493a('0x10')][_0x493a('0x12')]);}logger['error'](_0x493a('0xc'),_0x42d728,_0x5a373a[_0x493a('0x10')][_0x493a('0x12')]);return _0x2efeac(_0x5a373a[_0x493a('0x10')]['message']);}else{logger[_0x493a('0x13')](_0x493a('0xc'),_0x42d728,'request\x20sent');_0x2efeac(_0x5a373a[_0x493a('0x14')][_0x493a('0x12')]);}})['catch'](function(_0x58331c){logger[_0x493a('0x10')](_0x493a('0xc'),_0x42d728,_0x58331c);_0x55d102(_0x58331c);});});} \ No newline at end of file +var _0x6fd2=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x4839d8,_0x3061e1){var _0x4a9191=function(_0x5f0164){while(--_0x5f0164){_0x4839d8['push'](_0x4839d8['shift']());}};_0x4a9191(++_0x3061e1);}(_0x6fd2,0x1ca));var _0x26fd=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x6fd2[_0x494d1f];return _0x457b6e;};'use strict';var _=require(_0x26fd('0x0'));var util=require(_0x26fd('0x1'));var moment=require(_0x26fd('0x2'));var BPromise=require(_0x26fd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x26fd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x26fd('0x5'));var logger=require(_0x26fd('0x6'))(_0x26fd('0x7'));var config=require(_0x26fd('0x8'));var jayson=require(_0x26fd('0x9'));var client=jayson[_0x26fd('0xa')][_0x26fd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5389da,_0x428b62,_0x4689f7){return new BPromise(function(_0x37089a,_0xc37df2){return client['request'](_0x5389da,_0x4689f7)['then'](function(_0x480973){logger[_0x26fd('0xc')](_0x26fd('0xd'),_0x428b62,_0x26fd('0xe'));logger[_0x26fd('0xf')](_0x26fd('0x10'),_0x428b62,_0x26fd('0xe'),JSON[_0x26fd('0x11')](_0x480973));if(_0x480973[_0x26fd('0x12')]){if(_0x480973[_0x26fd('0x12')][_0x26fd('0x13')]===0x1f4){logger[_0x26fd('0x12')](_0x26fd('0xd'),_0x428b62,_0x480973[_0x26fd('0x12')]['message']);return _0xc37df2(_0x480973[_0x26fd('0x12')][_0x26fd('0x14')]);}logger[_0x26fd('0x12')](_0x26fd('0xd'),_0x428b62,_0x480973['error'][_0x26fd('0x14')]);return _0x37089a(_0x480973[_0x26fd('0x12')][_0x26fd('0x14')]);}else{logger[_0x26fd('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x428b62,_0x26fd('0xe'));_0x37089a(_0x480973[_0x26fd('0x15')][_0x26fd('0x14')]);}})[_0x26fd('0x16')](function(_0x49c8ff){logger[_0x26fd('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x428b62,_0x49c8ff);_0xc37df2(_0x49c8ff);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index f5a489b..f44c172 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 _0x2032=['describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x53f5d9,_0x1875e3){var _0xff19b8=function(_0x2d7880){while(--_0x2d7880){_0x53f5d9['push'](_0x53f5d9['shift']());}};_0xff19b8(++_0x1875e3);}(_0x2032,0xd9));var _0x2203=function(_0x32ba7e,_0x21d482){_0x32ba7e=_0x32ba7e-0x0;var _0x55cd54=_0x2032[_0x32ba7e];return _0x55cd54;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var auth=require(_0x2203('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2203('0x5'));var controller=require(_0x2203('0x6'));router[_0x2203('0x7')]('/',auth[_0x2203('0x8')](),controller[_0x2203('0x9')]);router[_0x2203('0x7')](_0x2203('0xa'),auth[_0x2203('0x8')](),controller[_0x2203('0xb')]);router[_0x2203('0x7')](_0x2203('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller[_0x2203('0xe')]);router[_0x2203('0xf')](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x10')]);router['delete'](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);module[_0x2203('0x12')]=router; \ No newline at end of file +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(_0x10b317,_0x2adf32){var _0x1e3054=function(_0x38ed3e){while(--_0x38ed3e){_0x10b317['push'](_0x10b317['shift']());}};_0x1e3054(++_0x2adf32);}(_0x757a,0xde));var _0xa757=function(_0x4772af,_0x22da44){_0x4772af=_0x4772af-0x0;var _0x2f915d=_0x757a[_0x4772af];return _0x2f915d;};'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 99ebf77..5a9a365 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 _0x6657=['star','thumb','input','text','name','onlineForm','parse','getDataValue','stringify','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.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','alternate','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback'];(function(_0x47e235,_0x274f3e){var _0x3dde11=function(_0x2351b9){while(--_0x2351b9){_0x47e235['push'](_0x47e235['shift']());}};_0x3dde11(++_0x274f3e);}(_0x6657,0x17f));var _0x7665=function(_0x247cb6,_0x136177){_0x247cb6=_0x247cb6-0x0;var _0x554363=_0x6657[_0x247cb6];return _0x554363;};'use strict';var Sequelize=require(_0x7665('0x0'));var rs=require('randomstring');module[_0x7665('0x1')]={'name':{'type':Sequelize[_0x7665('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x7665('0x2')],'allowNull':![],'unique':_0x7665('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x4')},'mapKeyOffline':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x4')},'key':{'type':Sequelize[_0x7665('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x5')},'customerAlias':{'type':Sequelize[_0x7665('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7665('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x7665('0x2')],'allowNull':![],'defaultValue':_0x7665('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x7665('0x2')],'allowNull':![],'defaultValue':_0x7665('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x7665('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x7665('0x2')]},'animation':{'type':Sequelize[_0x7665('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x7665('0xa'),_0x7665('0xb')),'defaultValue':_0x7665('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x7665('0xc')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x7665('0xd')},'offline_chat_button':{'type':Sequelize[_0x7665('0x2')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x7665('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x7665('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x7665('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x7665('0xf')]},'closingQuestion':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x12')},'noteTitle':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x13')},'placeholderMessage':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x14')},'closingMessage':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x15')},'closingMessageButton':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x16')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x7665('0x17')},'conditionAgreement':{'type':Sequelize[_0x7665('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x7665('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x7665('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x18')},'ratingType':{'type':Sequelize['ENUM'](_0x7665('0x19'),_0x7665('0x1a')),'defaultValue':_0x7665('0x19')},'ratingStarsNumber':{'type':Sequelize[_0x7665('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x7665('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x7665('0x1b'),'variable':null,'config':{'placeholder':'name','type':_0x7665('0x1c'),'required':!![]},'props':{'title':_0x7665('0x1d'),'helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x7665('0x4'),'type':_0x7665('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x7665('0x1e'))?JSON[_0x7665('0x1f')](this[_0x7665('0x20')]('onlineForm')):{};},'set':function(_0x5b5be6){return this['setDataValue']('onlineForm',JSON[_0x7665('0x21')](_0x5b5be6));}},'offlineForm':{'type':Sequelize[_0x7665('0xf')],'defaultValue':function(){return JSON[_0x7665('0x21')]({'items':[{'type':'input','props':{'title':_0x7665('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x7665('0x4'),'type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':_0x7665('0x22')},'props':{'title':_0x7665('0x22'),'helpText':_0x7665('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0x7665('0x20')](_0x7665('0x24'))?JSON[_0x7665('0x1f')](this['getDataValue'](_0x7665('0x24'))):{};},'set':function(_0x55d046){return this['setDataValue'](_0x7665('0x24'),JSON[_0x7665('0x21')](_0x55d046));}},'token':{'type':Sequelize[_0x7665('0x2')],'defaultValue':function(){return rs[_0x7665('0x25')]();}},'autoclose':{'type':Sequelize[_0x7665('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x7665('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x7665('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x7665('0x2')]},'forwardOffline':{'type':Sequelize[_0x7665('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x7665('0x2')]},'waitingTitle':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x26')},'waitingMessage':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x28')},'offlineMessageBody':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0x7665('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x7665('0x2a')},'skipUnmanaged':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x17')},'sendUnmanaged':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x16')},'enableCustomerAttachment':{'type':Sequelize[_0x7665('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x7665('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x7665('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x7665('0x2')]},'notificationTemplate':{'type':Sequelize[_0x7665('0xf')],'defaultValue':function(){return _0x7665('0x2b');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7665('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x7665('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x7665('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x2c')},'verticalAlignment':{'type':Sequelize[_0x7665('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x7665('0x2')],'defaultValue':_0x7665('0x2d')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x7665('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x7665('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x7665('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x7665('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x7665('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7665('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7665('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7665('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x7665('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x7665('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7665('0x8')],'comment':_0x7665('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x7665('0x9')],'defaultValue':![],'comment':_0x7665('0x2f'),'set':function(_0x30d450){if(!_0x30d450)this[_0x7665('0x30')](_0x7665('0x31'),null);this[_0x7665('0x30')](_0x7665('0x32'),_0x30d450);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]}}; \ No newline at end of file +var _0xbca0=['We\x20are\x20here!','Send','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','thumb','star','TEXT','stringify','name','input','getDataValue','onlineForm','setDataValue','textarea','Comments','offlineForm','parse','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared'];(function(_0x2f3c6f,_0x385385){var _0x57afd5=function(_0x554330){while(--_0x554330){_0x2f3c6f['push'](_0x2f3c6f['shift']());}};_0x57afd5(++_0x385385);}(_0xbca0,0x17f));var _0x0bca=function(_0x291ea4,_0x546bb1){_0x291ea4=_0x291ea4-0x0;var _0x6e1c85=_0xbca0[_0x291ea4];return _0x6e1c85;};'use strict';var Sequelize=require(_0x0bca('0x0'));var rs=require(_0x0bca('0x1'));module[_0x0bca('0x2')]={'name':{'type':Sequelize[_0x0bca('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x0bca('0x3')]},'mapKey':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x0bca('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':_0x0bca('0x5')},'customerAlias':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0bca('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x0bca('0x3')],'allowNull':![],'defaultValue':_0x0bca('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0bca('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x0bca('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x0bca('0x3')]},'animation':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x0bca('0xa')](_0x0bca('0xb'),_0x0bca('0xc')),'defaultValue':_0x0bca('0xb')},'header_online':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':_0x0bca('0xd')},'start_chat_button':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':_0x0bca('0xe')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x0bca('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':_0x0bca('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x0bca('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':_0x0bca('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':_0x0bca('0x12')},'placeholderMessage':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':_0x0bca('0x13')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x0bca('0xe')},'skipMessageButton':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':_0x0bca('0x14')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x0bca('0x15')},'ratingType':{'type':Sequelize[_0x0bca('0xa')]('star',_0x0bca('0x16')),'defaultValue':_0x0bca('0x17')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x0bca('0x18')],'defaultValue':function(){return JSON[_0x0bca('0x19')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x0bca('0x1a'),'type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x0bca('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x0bca('0x4'),'type':_0x0bca('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x0bca('0x1c')](_0x0bca('0x1d'))?JSON['parse'](this[_0x0bca('0x1c')](_0x0bca('0x1d'))):{};},'set':function(_0x42b203){return this[_0x0bca('0x1e')](_0x0bca('0x1d'),JSON[_0x0bca('0x19')](_0x42b203));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x0bca('0x19')]({'items':[{'type':'input','props':{'title':_0x0bca('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x0bca('0x4'),'type':'email'},'variable':null},{'type':_0x0bca('0x1f'),'config':{'placeholder':_0x0bca('0x20')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x0bca('0x1c')](_0x0bca('0x21'))?JSON[_0x0bca('0x22')](this[_0x0bca('0x1c')](_0x0bca('0x21'))):{};},'set':function(_0x24fd0b){return this[_0x0bca('0x1e')](_0x0bca('0x21'),JSON[_0x0bca('0x19')](_0x24fd0b));}},'token':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x0bca('0x3')]},'forwardOffline':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':_0x0bca('0x23')},'offlineMessageSubject':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':_0x0bca('0x24')},'offlineMessageBody':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':_0x0bca('0x25')},'skipUnmanaged':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x0bca('0x18')]},'showAgentAvatar':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x0bca('0x3')]},'notificationTemplate':{'type':Sequelize[_0x0bca('0x18')],'defaultValue':function(){return _0x0bca('0x26');}},'notificationSound':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':_0x0bca('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x0bca('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x0bca('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x0bca('0x3')]},'customerAvatar':{'type':Sequelize[_0x0bca('0x18')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x0bca('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x0bca('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0bca('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0bca('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x0bca('0x3')],'defaultValue':_0x0bca('0x28')},'systemAvatar':{'type':Sequelize[_0x0bca('0x18')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0bca('0x8')],'comment':_0x0bca('0x29')},'mandatoryDisposition':{'type':Sequelize[_0x0bca('0x9')],'defaultValue':![],'comment':_0x0bca('0x2a'),'set':function(_0x37dcf9){if(!_0x37dcf9)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x0bca('0x1e')](_0x0bca('0x2b'),_0x37dcf9);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 1c6bba4..2d2f0a0 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 _0xd9c3=['autoAssociation','catch','body','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','order','options','removeDispositions','addAnswer','CannedAnswer','pick','removeAnswers','ids','sitepic','addAvatar','agentAvatar','addCustomerAvatar','file','filename','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','mapKey','CmList','List','Contacts','ChatApplication','Applications','account','applications','orderBy','priority','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','type','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','lastName','messageId','created','autoclose','close','unmanaged','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','EventManager','offline','difference','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','MailAccount','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','Owner','fullname','internal','Tag','Tags','color','tag','getSnippet','timezone','interval','indexOf','true','info','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','custom','License','increment','chatLicenseExceeded','push','all','some','server/files/chat/iframe.js','remote','x-real-ip','connection','remoteAddress','virtual','replace','alignment','verticalAlignment','textColor','addApplications','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','userChatWebsite:save','removeAgents','emit','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','show','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd9c3,0xc2));var _0x3d9c=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xd9c3[_0x2b7764];return _0x848dcb;};'use strict';var pdf=require(_0x3d9c('0x0'));var emlformat=require(_0x3d9c('0x1'));var rimraf=require(_0x3d9c('0x2'));var zipdir=require(_0x3d9c('0x3'));var jsonpatch=require(_0x3d9c('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3d9c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3d9c('0x6'));var sox=require(_0x3d9c('0x7'));var csv=require(_0x3d9c('0x8'));var ejs=require(_0x3d9c('0x9'));var fs=require('fs');var _=require(_0x3d9c('0xa'));var squel=require(_0x3d9c('0xb'));var crypto=require('crypto');var jsforce=require(_0x3d9c('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d9c('0xd'));var Papa=require(_0x3d9c('0xe'));var Redis=require(_0x3d9c('0xf'));var authService=require(_0x3d9c('0x10'));var qs=require(_0x3d9c('0x11'));var as=require(_0x3d9c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d9c('0x13'))(_0x3d9c('0x14'));var utils=require(_0x3d9c('0x15'));var config=require(_0x3d9c('0x16'));var licenseUtil=require(_0x3d9c('0x17'));var db=require(_0x3d9c('0x18'))['db'];config[_0x3d9c('0x19')]=_[_0x3d9c('0x1a')](config[_0x3d9c('0x19')],{'host':_0x3d9c('0x1b'),'port':0x18eb});var socket=require(_0x3d9c('0x1c'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x3d9c('0x1d')](socket);var jayson=require(_0x3d9c('0x1e'));var client=jayson[_0x3d9c('0x1f')][_0x3d9c('0x20')]({'port':0x232c});var client9002=jayson[_0x3d9c('0x1f')][_0x3d9c('0x20')]({'port':0x232a});var client9003=jayson[_0x3d9c('0x1f')]['http']({'port':0x232b});function respondWithRpcPromise(_0x25fe0,_0x504baf,_0xdaea50,_0x439fcc){return new BPromise(function(_0x4672bf,_0x563eb0){var _0x342656=_0x439fcc||client;return _0x342656['request'](_0x25fe0,_0xdaea50)['then'](function(_0x25bf54){logger['info'](_0x3d9c('0x21'),_0x504baf,_0x3d9c('0x22'));logger[_0x3d9c('0x23')](_0x3d9c('0x24'),_0x504baf,_0x3d9c('0x22'),JSON[_0x3d9c('0x25')](_0x25bf54));if(_0x25bf54['error']){if(_0x25bf54[_0x3d9c('0x26')][_0x3d9c('0x27')]===0x1f4){logger['error'](_0x3d9c('0x21'),_0x504baf,_0x25bf54[_0x3d9c('0x26')][_0x3d9c('0x28')]);return _0x563eb0(_0x25bf54[_0x3d9c('0x26')][_0x3d9c('0x28')]);}logger[_0x3d9c('0x26')](_0x3d9c('0x21'),_0x504baf,_0x25bf54[_0x3d9c('0x26')][_0x3d9c('0x28')]);return _0x4672bf(_0x25bf54[_0x3d9c('0x26')][_0x3d9c('0x28')]);}else{logger['info'](_0x3d9c('0x21'),_0x504baf,'request\x20sent');_0x4672bf(_0x25bf54[_0x3d9c('0x29')]['message']);}})['catch'](function(_0x55a998){logger[_0x3d9c('0x26')](_0x3d9c('0x21'),_0x504baf,_0x55a998);_0x563eb0(_0x55a998);});});}function respondWithStatusCode(_0x3f2bf1,_0x58d744){_0x58d744=_0x58d744||0xcc;return function(_0x3773d0){if(_0x3773d0){return _0x3f2bf1[_0x3d9c('0x2a')](_0x58d744);}return _0x3f2bf1[_0x3d9c('0x2b')](_0x58d744)[_0x3d9c('0x2c')]();};}function respondWithResult(_0x21dd4a,_0x4048fe){_0x4048fe=_0x4048fe||0xc8;return function(_0x58a1a3){if(_0x58a1a3){return _0x21dd4a['status'](_0x4048fe)[_0x3d9c('0x2d')](_0x58a1a3);}};}function respondWithFilteredResult(_0x38e909,_0x36ef10){return function(_0x5c9bfd){if(_0x5c9bfd){var _0x3e3458=_0x5c9bfd['count'],_0x34a2c4=_0x36ef10[_0x3d9c('0x2e')],_0x3ceae2=_0x36ef10['offset']+_0x36ef10[_0x3d9c('0x2f')],_0x20c846;if(_0x3ceae2>=_0x3e3458){_0x3ceae2=_0x3e3458;_0x20c846=0xc8;}else{_0x20c846=0xce;}_0x38e909[_0x3d9c('0x2b')](_0x20c846);return _0x38e909[_0x3d9c('0x30')](_0x3d9c('0x31'),_0x34a2c4+'-'+_0x3ceae2+'/'+_0x3e3458)[_0x3d9c('0x2d')](_0x5c9bfd);}return null;};}function patchUpdates(_0x3d70d9){return function(_0x402088){try{jsonpatch['apply'](_0x402088,_0x3d70d9,!![]);}catch(_0x2dd640){return BPromise[_0x3d9c('0x32')](_0x2dd640);}return _0x402088[_0x3d9c('0x33')]();};}function saveUpdates(_0x4d5502,_0x50badb){return function(_0x577516){if(_0x577516){return _0x577516[_0x3d9c('0x34')](_0x4d5502)[_0x3d9c('0x35')](function(_0x155556){return _0x155556;});}return null;};}function removeEntity(_0x4ff58c,_0x308391){return function(_0x5dd389){if(_0x5dd389){return _0x5dd389[_0x3d9c('0x36')]()['then'](function(){var _0x4839c8=_0x5dd389['get']({'plain':!![]});var _0x3f853c=_0x3d9c('0x37');return db[_0x3d9c('0x38')][_0x3d9c('0x36')]({'where':{'type':_0x3f853c,'resourceId':_0x4839c8['id']}})[_0x3d9c('0x35')](function(){return _0x5dd389;});})[_0x3d9c('0x35')](function(){_0x4ff58c[_0x3d9c('0x2b')](0xcc)[_0x3d9c('0x2c')]();});}};}function handleEntityNotFound(_0x38e755,_0x3cfd46){return function(_0x6e4e80){if(!_0x6e4e80){_0x38e755['sendStatus'](0x194);}return _0x6e4e80;};}function handleError(_0x5ec444,_0x4d1fca){_0x4d1fca=_0x4d1fca||0x1f4;return function(_0x5e89a1){logger[_0x3d9c('0x26')](_0x5e89a1[_0x3d9c('0x39')]);if(_0x5e89a1[_0x3d9c('0x3a')]){delete _0x5e89a1[_0x3d9c('0x3a')];}_0x5ec444[_0x3d9c('0x2b')](_0x4d1fca)[_0x3d9c('0x3b')](_0x5e89a1);};}exports[_0x3d9c('0x3c')]=function(_0x2e9a8b,_0x1e4eda){var _0x2755ea={'include':[{'model':db[_0x3d9c('0x3d')],'as':_0x3d9c('0x3e')}]},_0x32d456={},_0x50afe2={'count':0x0,'rows':[]};var _0x185b0e=_[_0x3d9c('0x3f')](db[_0x3d9c('0x40')][_0x3d9c('0x41')],function(_0x225375){return{'name':_0x225375[_0x3d9c('0x42')],'type':_0x225375['type']['key']};});_0x32d456[_0x3d9c('0x43')]=_[_0x3d9c('0x3f')](_0x185b0e,_0x3d9c('0x3a'));_0x32d456[_0x3d9c('0x44')]=_['keys'](_0x2e9a8b['query']);_0x32d456['filters']=_[_0x3d9c('0x45')](_0x32d456[_0x3d9c('0x43')],_0x32d456[_0x3d9c('0x44')]);_0x2755ea[_0x3d9c('0x46')]=_[_0x3d9c('0x45')](_0x32d456[_0x3d9c('0x43')],qs[_0x3d9c('0x47')](_0x2e9a8b[_0x3d9c('0x44')]['fields']));_0x2755ea[_0x3d9c('0x46')]=_0x2755ea[_0x3d9c('0x46')][_0x3d9c('0x48')]?_0x2755ea[_0x3d9c('0x46')]:_0x32d456[_0x3d9c('0x43')];if(!_0x2e9a8b[_0x3d9c('0x44')][_0x3d9c('0x49')](_0x3d9c('0x4a'))){_0x2755ea[_0x3d9c('0x2f')]=qs[_0x3d9c('0x2f')](_0x2e9a8b[_0x3d9c('0x44')][_0x3d9c('0x2f')]);_0x2755ea[_0x3d9c('0x2e')]=qs[_0x3d9c('0x2e')](_0x2e9a8b[_0x3d9c('0x44')]['offset']);}_0x2755ea['order']=qs[_0x3d9c('0x4b')](_0x2e9a8b[_0x3d9c('0x44')][_0x3d9c('0x4b')]);_0x2755ea[_0x3d9c('0x4c')]=qs['filters'](_['pick'](_0x2e9a8b['query'],_0x32d456[_0x3d9c('0x4d')]),_0x185b0e);if(_0x2e9a8b['query'][_0x3d9c('0x4e')]){_0x2755ea['where']=_[_0x3d9c('0x4f')](_0x2755ea[_0x3d9c('0x4c')],{'$or':_['map'](_0x185b0e,function(_0x2bcc8c){if(_0x2bcc8c['type']!==_0x3d9c('0x50')){var _0x326b65={};_0x326b65[_0x2bcc8c[_0x3d9c('0x3a')]]={'$like':'%'+_0x2e9a8b[_0x3d9c('0x44')][_0x3d9c('0x4e')]+'%'};return _0x326b65;}})});}_0x2755ea=_['merge']({},_0x2755ea,_0x2e9a8b['options']);var _0x467e6c={'where':_0x2755ea['where']};return db[_0x3d9c('0x40')]['count'](_0x467e6c)['then'](function(_0x922863){_0x50afe2[_0x3d9c('0x51')]=_0x922863;if(_0x2e9a8b[_0x3d9c('0x44')][_0x3d9c('0x52')]){_0x2755ea[_0x3d9c('0x53')]=[{'all':!![]}];}return db[_0x3d9c('0x40')][_0x3d9c('0x54')](_0x2755ea);})[_0x3d9c('0x35')](function(_0x7b0e8){_0x50afe2[_0x3d9c('0x55')]=_0x7b0e8;return _0x50afe2;})[_0x3d9c('0x35')](respondWithFilteredResult(_0x1e4eda,_0x2755ea))['catch'](handleError(_0x1e4eda,null));};exports[_0x3d9c('0x56')]=function(_0xe4db69,_0x2a7161){var _0x13292d={'raw':![],'where':{'id':_0xe4db69[_0x3d9c('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x3d9c('0x3e')}]},_0x18c691={};_0x18c691[_0x3d9c('0x43')]=_['keys'](db['ChatWebsite'][_0x3d9c('0x41')]);_0x18c691['query']=_[_0x3d9c('0x58')](_0xe4db69['query']);_0x18c691[_0x3d9c('0x4d')]=_['intersection'](_0x18c691[_0x3d9c('0x43')],_0x18c691[_0x3d9c('0x44')]);_0x13292d[_0x3d9c('0x46')]=_[_0x3d9c('0x45')](_0x18c691['model'],qs[_0x3d9c('0x47')](_0xe4db69[_0x3d9c('0x44')]['fields']));_0x13292d[_0x3d9c('0x46')]=_0x13292d[_0x3d9c('0x46')][_0x3d9c('0x48')]?_0x13292d[_0x3d9c('0x46')]:_0x18c691[_0x3d9c('0x43')];if(_0xe4db69[_0x3d9c('0x44')][_0x3d9c('0x52')]){_0x13292d['include']=[{'all':!![]}];}_0x13292d=_[_0x3d9c('0x4f')]({},_0x13292d,_0xe4db69['options']);return db[_0x3d9c('0x40')][_0x3d9c('0x59')](_0x13292d)['then'](handleEntityNotFound(_0x2a7161,null))[_0x3d9c('0x35')](respondWithResult(_0x2a7161,null))['catch'](handleError(_0x2a7161,null));};exports[_0x3d9c('0x5a')]=function(_0x3c6dcc,_0x45477c){return db[_0x3d9c('0x40')][_0x3d9c('0x5a')](_0x3c6dcc['body'],{})[_0x3d9c('0x35')](function(_0x1ed013){var _0xb0f987=_0x3c6dcc[_0x3d9c('0x5b')][_0x3d9c('0x5c')]({'plain':!![]});if(!_0xb0f987)throw new Error(_0x3d9c('0x5d'));if(_0xb0f987['role']===_0x3d9c('0x5b')){var _0x594618=_0x1ed013[_0x3d9c('0x5c')]({'plain':!![]});var _0x59a97a=_0x3d9c('0x37');return db[_0x3d9c('0x5e')][_0x3d9c('0x59')]({'where':{'name':_0x59a97a,'userProfileId':_0xb0f987[_0x3d9c('0x5f')]},'raw':!![]})['then'](function(_0x2b8491){if(_0x2b8491&&_0x2b8491[_0x3d9c('0x60')]===0x0){return db[_0x3d9c('0x38')]['create']({'name':_0x594618['name'],'resourceId':_0x594618['id'],'type':_0x2b8491[_0x3d9c('0x3a')],'sectionId':_0x2b8491['id']},{})[_0x3d9c('0x35')](function(){return _0x1ed013;});}else{return _0x1ed013;}})[_0x3d9c('0x61')](function(_0x5b58ab){logger[_0x3d9c('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b58ab);throw _0x5b58ab;});}return _0x1ed013;})['then'](respondWithResult(_0x45477c,0xc9))[_0x3d9c('0x61')](handleError(_0x45477c,null));};exports[_0x3d9c('0x34')]=function(_0x5ae139,_0x498857){if(_0x5ae139[_0x3d9c('0x62')]['id']){delete _0x5ae139['body']['id'];}return db[_0x3d9c('0x40')]['find']({'where':{'id':_0x5ae139[_0x3d9c('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x3d9c('0x3e')}]})[_0x3d9c('0x35')](handleEntityNotFound(_0x498857,null))['then'](saveUpdates(_0x5ae139['body'],null))['then'](respondWithResult(_0x498857,null))['catch'](handleError(_0x498857,null));};exports[_0x3d9c('0x36')]=function(_0x342959,_0x41059f){return db[_0x3d9c('0x40')][_0x3d9c('0x59')]({'where':{'id':_0x342959['params']['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x41059f,null))['then'](removeEntity(_0x41059f,null))[_0x3d9c('0x61')](handleError(_0x41059f,null));};exports['describe']=function(_0x348682,_0x5370a5){return db[_0x3d9c('0x40')][_0x3d9c('0x63')]()['then'](respondWithResult(_0x5370a5,null))[_0x3d9c('0x61')](handleError(_0x5370a5,null));};exports[_0x3d9c('0x64')]=function(_0x2e20e7,_0x1fe306,_0x2f20ad){if(_0x2e20e7[_0x3d9c('0x62')]['id']){delete _0x2e20e7[_0x3d9c('0x62')]['id'];}return db['ChatWebsite'][_0x3d9c('0x59')]({'where':{'id':_0x2e20e7[_0x3d9c('0x57')]['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x1fe306,null))[_0x3d9c('0x35')](function(_0x473c47){if(_0x473c47){_0x2e20e7[_0x3d9c('0x62')][_0x3d9c('0x65')]=_0x473c47['id'];return db[_0x3d9c('0x66')][_0x3d9c('0x5a')](_0x2e20e7[_0x3d9c('0x62')]);}})['then'](respondWithResult(_0x1fe306,null))[_0x3d9c('0x61')](handleError(_0x1fe306,null));};exports[_0x3d9c('0x67')]=function(_0x3fb9a0,_0x3f84cc,_0x3cb623){var _0xa74e69={'raw':![],'where':{}};var _0x6637c6={};var _0x3575f5={'count':0x0,'rows':[]};return db[_0x3d9c('0x40')][_0x3d9c('0x68')]({'where':{'id':_0x3fb9a0[_0x3d9c('0x57')]['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x3f84cc,null))['then'](function(_0x3912b0){if(_0x3912b0){_0x6637c6['model']=_[_0x3d9c('0x58')](db[_0x3d9c('0x66')][_0x3d9c('0x41')]);_0x6637c6[_0x3d9c('0x44')]=_[_0x3d9c('0x58')](_0x3fb9a0[_0x3d9c('0x44')]);_0x6637c6['filters']=_['intersection'](_0x6637c6['model'],_0x6637c6[_0x3d9c('0x44')]);_0xa74e69['attributes']=_[_0x3d9c('0x45')](_0x6637c6['model'],qs[_0x3d9c('0x47')](_0x3fb9a0[_0x3d9c('0x44')][_0x3d9c('0x47')]));_0xa74e69[_0x3d9c('0x46')]=_0xa74e69['attributes'][_0x3d9c('0x48')]?_0xa74e69['attributes']:_0x6637c6[_0x3d9c('0x43')];if(!_0x3fb9a0[_0x3d9c('0x44')][_0x3d9c('0x49')]('nolimit')){_0xa74e69[_0x3d9c('0x2f')]=qs[_0x3d9c('0x2f')](_0x3fb9a0['query']['limit']);_0xa74e69[_0x3d9c('0x2e')]=qs[_0x3d9c('0x2e')](_0x3fb9a0['query']['offset']);}_0xa74e69[_0x3d9c('0x69')]=qs['sort'](_0x3fb9a0['query'][_0x3d9c('0x4b')]);_0xa74e69[_0x3d9c('0x4c')]=qs['filters'](_['pick'](_0x3fb9a0[_0x3d9c('0x44')],_0x6637c6['filters']));_0xa74e69[_0x3d9c('0x4c')]['ChatWebsiteId']=_0x3912b0['id'];if(_0x3fb9a0[_0x3d9c('0x44')][_0x3d9c('0x4e')]){_0xa74e69[_0x3d9c('0x4c')]=_[_0x3d9c('0x4f')](_0xa74e69['where'],{'$or':_[_0x3d9c('0x3f')](_0xa74e69[_0x3d9c('0x46')],function(_0x4ca465){var _0x35d643={};_0x35d643[_0x4ca465]={'$like':'%'+_0x3fb9a0[_0x3d9c('0x44')][_0x3d9c('0x4e')]+'%'};return _0x35d643;})});}_0xa74e69=_['merge']({},_0xa74e69,_0x3fb9a0[_0x3d9c('0x6a')]);return db[_0x3d9c('0x66')]['count']({'where':_0xa74e69[_0x3d9c('0x4c')]})[_0x3d9c('0x35')](function(_0x24617e){_0x3575f5[_0x3d9c('0x51')]=_0x24617e;if(_0x3fb9a0['query'][_0x3d9c('0x52')]){_0xa74e69[_0x3d9c('0x53')]=[{'all':!![]}];}return db[_0x3d9c('0x66')][_0x3d9c('0x54')](_0xa74e69);})[_0x3d9c('0x35')](function(_0x220706){_0x3575f5[_0x3d9c('0x55')]=_0x220706;return _0x3575f5;});}})[_0x3d9c('0x35')](respondWithFilteredResult(_0x3f84cc,_0xa74e69))[_0x3d9c('0x61')](handleError(_0x3f84cc,null));};exports[_0x3d9c('0x6b')]=function(_0x216efc,_0x843aa3,_0x2f218e){return db['ChatWebsite'][_0x3d9c('0x59')]({'where':{'id':_0x216efc[_0x3d9c('0x57')]['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x843aa3,null))[_0x3d9c('0x35')](function(_0x58e52a){if(_0x58e52a){return _0x58e52a[_0x3d9c('0x6b')](_0x216efc[_0x3d9c('0x44')]['ids']);}})[_0x3d9c('0x35')](respondWithStatusCode(_0x843aa3,null))[_0x3d9c('0x61')](handleError(_0x843aa3,null));};exports[_0x3d9c('0x6c')]=function(_0xb1e63d,_0x5c0baf,_0x14ef74){if(_0xb1e63d[_0x3d9c('0x62')]['id']){delete _0xb1e63d[_0x3d9c('0x62')]['id'];}return db[_0x3d9c('0x40')][_0x3d9c('0x59')]({'where':{'id':_0xb1e63d[_0x3d9c('0x57')]['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x5c0baf,null))[_0x3d9c('0x35')](function(_0x1a6fbd){if(_0x1a6fbd){_0xb1e63d[_0x3d9c('0x62')][_0x3d9c('0x65')]=_0x1a6fbd['id'];return db[_0x3d9c('0x6d')][_0x3d9c('0x5a')](_0xb1e63d[_0x3d9c('0x62')]);}})[_0x3d9c('0x35')](respondWithResult(_0x5c0baf,null))[_0x3d9c('0x61')](handleError(_0x5c0baf,null));};exports['getAnswers']=function(_0x3afcba,_0x28bb9e,_0x3bcdb2){var _0x94e2a5={'raw':![],'where':{}};var _0x33cc90={};var _0x4f4e0c={'count':0x0,'rows':[]};return db[_0x3d9c('0x40')][_0x3d9c('0x68')]({'where':{'id':_0x3afcba[_0x3d9c('0x57')]['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x28bb9e,null))[_0x3d9c('0x35')](function(_0x8d3482){if(_0x8d3482){_0x33cc90['model']=_[_0x3d9c('0x58')](db[_0x3d9c('0x6d')][_0x3d9c('0x41')]);_0x33cc90['query']=_[_0x3d9c('0x58')](_0x3afcba[_0x3d9c('0x44')]);_0x33cc90[_0x3d9c('0x4d')]=_[_0x3d9c('0x45')](_0x33cc90[_0x3d9c('0x43')],_0x33cc90[_0x3d9c('0x44')]);_0x94e2a5[_0x3d9c('0x46')]=_[_0x3d9c('0x45')](_0x33cc90[_0x3d9c('0x43')],qs[_0x3d9c('0x47')](_0x3afcba['query']['fields']));_0x94e2a5[_0x3d9c('0x46')]=_0x94e2a5['attributes'][_0x3d9c('0x48')]?_0x94e2a5['attributes']:_0x33cc90[_0x3d9c('0x43')];if(!_0x3afcba[_0x3d9c('0x44')][_0x3d9c('0x49')](_0x3d9c('0x4a'))){_0x94e2a5[_0x3d9c('0x2f')]=qs[_0x3d9c('0x2f')](_0x3afcba[_0x3d9c('0x44')][_0x3d9c('0x2f')]);_0x94e2a5[_0x3d9c('0x2e')]=qs[_0x3d9c('0x2e')](_0x3afcba[_0x3d9c('0x44')]['offset']);}_0x94e2a5[_0x3d9c('0x69')]=qs[_0x3d9c('0x4b')](_0x3afcba[_0x3d9c('0x44')]['sort']);_0x94e2a5[_0x3d9c('0x4c')]=qs[_0x3d9c('0x4d')](_[_0x3d9c('0x6e')](_0x3afcba[_0x3d9c('0x44')],_0x33cc90[_0x3d9c('0x4d')]));_0x94e2a5[_0x3d9c('0x4c')][_0x3d9c('0x65')]=_0x8d3482['id'];if(_0x3afcba[_0x3d9c('0x44')]['filter']){_0x94e2a5[_0x3d9c('0x4c')]=_[_0x3d9c('0x4f')](_0x94e2a5['where'],{'$or':_['map'](_0x94e2a5[_0x3d9c('0x46')],function(_0x49dd9d){var _0xfcb8ee={};_0xfcb8ee[_0x49dd9d]={'$like':'%'+_0x3afcba['query']['filter']+'%'};return _0xfcb8ee;})});}_0x94e2a5=_[_0x3d9c('0x4f')]({},_0x94e2a5,_0x3afcba[_0x3d9c('0x6a')]);return db['CannedAnswer'][_0x3d9c('0x51')]({'where':_0x94e2a5['where']})[_0x3d9c('0x35')](function(_0x589f9d){_0x4f4e0c['count']=_0x589f9d;if(_0x3afcba[_0x3d9c('0x44')]['includeAll']){_0x94e2a5[_0x3d9c('0x53')]=[{'all':!![]}];}return db[_0x3d9c('0x6d')][_0x3d9c('0x54')](_0x94e2a5);})['then'](function(_0x541777){_0x4f4e0c[_0x3d9c('0x55')]=_0x541777;return _0x4f4e0c;});}})[_0x3d9c('0x35')](respondWithFilteredResult(_0x28bb9e,_0x94e2a5))[_0x3d9c('0x61')](handleError(_0x28bb9e,null));};exports[_0x3d9c('0x6f')]=function(_0x1b0d03,_0x135615,_0x2a3c72){return db[_0x3d9c('0x40')][_0x3d9c('0x59')]({'where':{'id':_0x1b0d03[_0x3d9c('0x57')]['id']}})['then'](handleEntityNotFound(_0x135615,null))[_0x3d9c('0x35')](function(_0x129fe2){if(_0x129fe2){return _0x129fe2[_0x3d9c('0x6f')](_0x1b0d03[_0x3d9c('0x44')][_0x3d9c('0x70')]);}})[_0x3d9c('0x35')](respondWithStatusCode(_0x135615,null))[_0x3d9c('0x61')](handleError(_0x135615,null));};exports['addLogo']=function(_0x20a9fb,_0x49a120,_0x390c9e){_0x20a9fb[_0x3d9c('0x62')][_0x3d9c('0x71')]=_0x20a9fb['file']['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x20a9fb[_0x3d9c('0x57')]['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x49a120,null))['then'](saveUpdates(_0x20a9fb['body'],null))[_0x3d9c('0x35')](respondWithResult(_0x49a120,null))[_0x3d9c('0x61')](handleError(_0x49a120,null));};exports[_0x3d9c('0x72')]=function(_0x4b9762,_0x12b288,_0x592326){_0x4b9762['body'][_0x3d9c('0x73')]=_0x4b9762['file']['filename'];return db[_0x3d9c('0x40')][_0x3d9c('0x59')]({'where':{'id':_0x4b9762['params']['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x12b288,null))[_0x3d9c('0x35')](saveUpdates(_0x4b9762['body'],null))[_0x3d9c('0x35')](respondWithResult(_0x12b288,null))[_0x3d9c('0x61')](handleError(_0x12b288,null));};exports[_0x3d9c('0x74')]=function(_0xe26896,_0xc71ad7,_0x4a128a){_0xe26896[_0x3d9c('0x62')]['customerAvatar']=_0xe26896[_0x3d9c('0x75')][_0x3d9c('0x76')];return db[_0x3d9c('0x40')][_0x3d9c('0x59')]({'where':{'id':_0xe26896['params']['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0xc71ad7,null))[_0x3d9c('0x35')](saveUpdates(_0xe26896['body'],null))[_0x3d9c('0x35')](respondWithResult(_0xc71ad7,null))['catch'](handleError(_0xc71ad7,null));};exports[_0x3d9c('0x77')]=function(_0x428bb0,_0x51adac,_0x27eb59){_0x428bb0[_0x3d9c('0x62')][_0x3d9c('0x78')]=_0x428bb0['file'][_0x3d9c('0x76')];return db[_0x3d9c('0x40')]['find']({'where':{'id':_0x428bb0[_0x3d9c('0x57')]['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x51adac,null))[_0x3d9c('0x35')](saveUpdates(_0x428bb0[_0x3d9c('0x62')],null))['then'](respondWithResult(_0x51adac,null))['catch'](handleError(_0x51adac,null));};exports[_0x3d9c('0x79')]=function(_0x3b402d,_0xa0dddc,_0x49f0fe){var _0x2ebb88=path[_0x3d9c('0x7a')](config[_0x3d9c('0x7b')],_0x3d9c('0x7c'));var _0x4eb7d1={'where':{'id':_0x3b402d[_0x3d9c('0x57')]['id']},'attributes':['id',_0x3d9c('0x71')],'raw':!![]};var _0x39c1a6=![];return require(_0x3d9c('0x17'))[_0x3d9c('0x7d')]()[_0x3d9c('0x35')](function(_0x3cfdb0){if(_0x3cfdb0){_0x39c1a6=_0x3cfdb0['custom'];}})[_0x3d9c('0x35')](function(){return db[_0x3d9c('0x40')]['find'](_0x4eb7d1);})[_0x3d9c('0x35')](handleEntityNotFound(_0xa0dddc,null))[_0x3d9c('0x35')](function(_0x5b3631){if(_0x5b3631){if(!_[_0x3d9c('0x7e')](_0x5b3631[_0x3d9c('0x71')])){if(fs['existsSync'](path[_0x3d9c('0x7a')](config[_0x3d9c('0x7b')],_0x3d9c('0x7f'),_0x5b3631[_0x3d9c('0x71')]))&&_0x39c1a6){_0x2ebb88=path['join'](config[_0x3d9c('0x7b')],_0x3d9c('0x7f'),_0x5b3631[_0x3d9c('0x71')]);}}return _0xa0dddc[_0x3d9c('0x80')](_0x2ebb88);}})['catch'](handleError(_0xa0dddc,null));};exports[_0x3d9c('0x81')]=function(_0x18f717,_0x3bddfb,_0x3c8b76){var _0x5264fe=path[_0x3d9c('0x7a')](config[_0x3d9c('0x7b')],_0x3d9c('0x82'));var _0x1b54e1={'where':{'id':_0x18f717[_0x3d9c('0x57')]['id']},'attributes':['id',_0x3d9c('0x73')],'raw':!![]};return db[_0x3d9c('0x40')][_0x3d9c('0x59')](_0x1b54e1)[_0x3d9c('0x35')](handleEntityNotFound(_0x3bddfb,null))['then'](function(_0x532fc9){if(_0x532fc9){if(!_[_0x3d9c('0x7e')](_0x532fc9['agentAvatar'])){if(fs[_0x3d9c('0x83')](path[_0x3d9c('0x7a')](config[_0x3d9c('0x7b')],_0x3d9c('0x84'),_0x532fc9[_0x3d9c('0x73')]))){_0x5264fe=path[_0x3d9c('0x7a')](config[_0x3d9c('0x7b')],_0x3d9c('0x84'),_0x532fc9[_0x3d9c('0x73')]);}}return _0x3bddfb[_0x3d9c('0x80')](_0x5264fe);}})['catch'](handleError(_0x3bddfb,null));};exports['getCustomerAvatar']=function(_0x4c8306,_0x458ae5,_0xcc9677){var _0x394c24=path[_0x3d9c('0x7a')](config[_0x3d9c('0x7b')],_0x3d9c('0x85'));var _0x5b1552={'where':{'id':_0x4c8306['params']['id']},'attributes':['id',_0x3d9c('0x86'),'showCustomerAvatar'],'raw':!![]};return db[_0x3d9c('0x40')]['find'](_0x5b1552)[_0x3d9c('0x35')](handleEntityNotFound(_0x458ae5,null))['then'](function(_0x44938a){if(_0x44938a){if(!_['isNil'](_0x44938a[_0x3d9c('0x86')])){if(fs['existsSync'](path[_0x3d9c('0x7a')](config[_0x3d9c('0x7b')],_0x3d9c('0x84'),_0x44938a[_0x3d9c('0x86')]))&&_0x44938a[_0x3d9c('0x87')]){_0x394c24=path['join'](config['root'],_0x3d9c('0x84'),_0x44938a['customerAvatar']);}}return _0x458ae5['download'](_0x394c24);}})['catch'](handleError(_0x458ae5,null));};exports[_0x3d9c('0x88')]=function(_0x6c5981,_0x19f91c,_0x34ea05){var _0x1508c5=path['join'](config['root'],_0x3d9c('0x89'));var _0x5acd8e={'where':{'id':_0x6c5981[_0x3d9c('0x57')]['id']},'attributes':['id',_0x3d9c('0x78')],'raw':!![]};return db[_0x3d9c('0x40')][_0x3d9c('0x59')](_0x5acd8e)[_0x3d9c('0x35')](handleEntityNotFound(_0x19f91c,null))[_0x3d9c('0x35')](function(_0x27bba3){if(_0x27bba3){if(!_[_0x3d9c('0x7e')](_0x27bba3[_0x3d9c('0x78')])){if(fs[_0x3d9c('0x83')](path[_0x3d9c('0x7a')](config[_0x3d9c('0x7b')],_0x3d9c('0x84'),_0x27bba3[_0x3d9c('0x78')]))){_0x1508c5=path[_0x3d9c('0x7a')](config[_0x3d9c('0x7b')],_0x3d9c('0x84'),_0x27bba3[_0x3d9c('0x78')]);}}return _0x19f91c[_0x3d9c('0x80')](_0x1508c5);}})[_0x3d9c('0x61')](handleError(_0x19f91c,null));};exports[_0x3d9c('0x8a')]=function(_0x2ee327,_0x463303,_0x12bfde){var _0x40d1d5=require(_0x3d9c('0x8b'));var _0x46b4b3=new _0x40d1d5();var _0x1e2d07=_0x46b4b3[_0x3d9c('0x8c')](_0x2ee327[_0x3d9c('0x8d')][_0x3d9c('0x8e')])[_0x3d9c('0x8f')]();var _0x20f431={'body':_0x2ee327['body'],'channel':_0x3d9c('0x90')};var _0xd87922=[];var _0x58f618=[];var _0x43d37a={};var _0x493f3c=![];return db[_0x3d9c('0x91')][_0x3d9c('0x63')]()['then'](function(_0x66a01e){if(!_0x66a01e){throw new db[(_0x3d9c('0x92'))][(_0x3d9c('0x93'))](_0x3d9c('0x94'));}_0xd87922=_['difference'](_['keys'](_0x66a01e),['createdAt',_0x3d9c('0x95')]);_0x58f618=_['difference'](_[_0x3d9c('0x58')](_0x66a01e),[_0x3d9c('0x96'),_0x3d9c('0x95'),_0x3d9c('0x97'),_0x3d9c('0x98')]);if(_0x2ee327[_0x3d9c('0x62')]['id']){delete _0x2ee327[_0x3d9c('0x62')]['id'];}if(_[_0x3d9c('0x7e')](_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0x99')])){throw new db[(_0x3d9c('0x92'))][(_0x3d9c('0x93'))](_0x3d9c('0x9a'));}if(_['isNil'](_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0x62')])||_0x2ee327['body']['body']===''){throw new db[(_0x3d9c('0x92'))][(_0x3d9c('0x93'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x3d9c('0x7e')](_0x2ee327['body'][_0x3d9c('0x9b')])){throw new db[(_0x3d9c('0x92'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x58f618);}if(!_['includes'](_0x58f618,_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0x9b')])){throw new db[(_0x3d9c('0x92'))][(_0x3d9c('0x93'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x58f618);}_0x43d37a[_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0x9b')]]=_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0x99')];})[_0x3d9c('0x35')](function(){return db[_0x3d9c('0x40')][_0x3d9c('0x59')]({'where':{'id':_0x2ee327[_0x3d9c('0x57')]['id']},'include':[{'model':db[_0x3d9c('0x9c')],'as':_0x3d9c('0x9d'),'include':[{'model':db['CmContact'],'as':_0x3d9c('0x9e'),'where':_0x43d37a,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x3d9c('0x9f')],'as':_0x3d9c('0xa0')}]});})[_0x3d9c('0x35')](handleEntityNotFound(_0x463303,null))[_0x3d9c('0x35')](function(_0x14fe50){if(_0x14fe50&&_0x14fe50[_0x3d9c('0x9d')]){_0x20f431[_0x3d9c('0xa1')]=_0x14fe50;_0x20f431[_0x3d9c('0xa2')]=_0x14fe50[_0x3d9c('0xa0')];_0x20f431['list']=_0x14fe50[_0x3d9c('0x9d')];_0x20f431[_0x3d9c('0xa2')]=_[_0x3d9c('0xa3')](_0x20f431[_0x3d9c('0xa2')],[_0x3d9c('0xa4')],[_0x3d9c('0xa5')]);if(_0x20f431[_0x3d9c('0xa1')][_0x3d9c('0xa0')]){delete _0x20f431[_0x3d9c('0xa1')][_0x3d9c('0xa0')];}if(_0x20f431[_0x3d9c('0xa1')]['List']&&_0x20f431[_0x3d9c('0xa1')][_0x3d9c('0x9d')]['Contacts'][_0x3d9c('0x48')]){return _0x20f431[_0x3d9c('0xa1')][_0x3d9c('0x9d')]['Contacts'][0x0];}var _0x2a7835=_[_0x3d9c('0x1a')](_0x2ee327['body'],{'firstName':_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0x99')],'ListId':_0x14fe50[_0x3d9c('0x98')]});_0x2a7835[_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0x9b')]]=_0x2ee327['body'][_0x3d9c('0x99')];return db[_0x3d9c('0x91')][_0x3d9c('0x5a')](_0x2a7835,{'fields':_0xd87922,'raw':!![]});}})[_0x3d9c('0x35')](handleEntityNotFound(_0x463303,null))[_0x3d9c('0x35')](function(_0x58f86e){_0x20f431[_0x3d9c('0xa6')]=_0x58f86e;var _0x2ff880=_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0xa7')];if(_0x2ee327[_0x3d9c('0x8d')][_0x3d9c('0xa8')]){_0x2ff880=_0x2ee327[_0x3d9c('0x8d')][_0x3d9c('0xa8')];}else if(_0x2ee327['headers'][_0x3d9c('0xa9')]){_0x2ff880=_['first'](_0x2ee327[_0x3d9c('0x8d')][_0x3d9c('0xa9')][_0x3d9c('0xaa')](','));}if(_0x58f86e){var _0x582803={'ContactId':_0x58f86e['id'],'ChatWebsiteId':_0x2ee327[_0x3d9c('0x57')]['id'],'from':(_0x58f86e[_0x3d9c('0xab')]||'')+'\x20'+(_0x58f86e['lastName']||''),'customerIp':_0x2ff880,'customerPort':_0x2ee327[_0x3d9c('0x8d')][_0x3d9c('0xac')]?_0x2ee327[_0x3d9c('0x8d')][_0x3d9c('0xac')]:null,'referer':_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0xad')],'browserName':_0x1e2d07[_0x3d9c('0xae')][_0x3d9c('0x3a')]&&_0x1e2d07[_0x3d9c('0xae')][_0x3d9c('0xaf')]?util[_0x3d9c('0xb0')](_0x3d9c('0xb1'),_0x1e2d07[_0x3d9c('0xae')][_0x3d9c('0x3a')],_0x1e2d07[_0x3d9c('0xae')][_0x3d9c('0xaf')]):_0x3d9c('0xb2'),'browserVersion':_0x1e2d07[_0x3d9c('0xae')][_0x3d9c('0xaf')]||_0x3d9c('0xb2'),'osName':util['format'](_0x3d9c('0xb1'),_0x1e2d07['os'][_0x3d9c('0x3a')],_0x1e2d07['os']['version']),'osVersion':_0x1e2d07['os'][_0x3d9c('0xaf')],'deviceModel':_0x1e2d07[_0x3d9c('0xb3')][_0x3d9c('0x43')]&&_0x1e2d07[_0x3d9c('0xb3')][_0x3d9c('0xb4')]?util[_0x3d9c('0xb0')](_0x3d9c('0xb5'),_0x1e2d07[_0x3d9c('0xb3')][_0x3d9c('0x43')],_0x1e2d07[_0x3d9c('0xb3')][_0x3d9c('0xb4')],_0x1e2d07[_0x3d9c('0xb3')][_0x3d9c('0xb6')]):null,'deviceVendor':_0x1e2d07[_0x3d9c('0xb3')]['vendor'],'deviceType':_0x1e2d07[_0x3d9c('0xb3')][_0x3d9c('0xb6')],'formData':JSON[_0x3d9c('0x25')](_0x2ee327[_0x3d9c('0x62')])};var _0x49ffc7={'ChatWebsiteId':_0x2ee327[_0x3d9c('0x57')]['id'],'closed':![]};if(_0x2ee327[_0x3d9c('0x62')]['threadId']){_0x49ffc7['threadId']=_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0xb7')];return db['ChatInteraction'][_0x3d9c('0x59')]({'where':_0x49ffc7})['then'](function(_0x2189db){if(_0x2189db){return[_0x2189db,![]];}_0x582803['threadId']=_0x2ee327[_0x3d9c('0x62')]['threadId'];_0x582803[_0x3d9c('0xb8')]=_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0xb8')];return db[_0x3d9c('0xb9')][_0x3d9c('0x5a')](_0x582803)[_0x3d9c('0x35')](function(_0xd31033){return[_0xd31033,!![]];});});}_0x49ffc7[_0x3d9c('0xba')]=_0x58f86e['id'];if(_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0xbb')]&&_0x2ee327['body'][_0x3d9c('0xbb')]['id']){_0x49ffc7['id']=_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0xbb')]['id'];return db[_0x3d9c('0xb9')][_0x3d9c('0x59')]({'where':_0x49ffc7})[_0x3d9c('0x35')](function(_0x1e4b3e){if(_0x1e4b3e){return[_0x1e4b3e,![]];}return db['ChatInteraction'][_0x3d9c('0x5a')](_0x582803)[_0x3d9c('0x35')](function(_0x27fddf){return[_0x27fddf,!![]];});});}return db[_0x3d9c('0xb9')][_0x3d9c('0x5a')](_0x582803)[_0x3d9c('0x35')](function(_0x155c9b){return[_0x155c9b,!![]];});}})[_0x3d9c('0xbc')](function(_0x6427c1,_0xd1c53c){if(_0x6427c1){_0x493f3c=_0xd1c53c;if(!_0xd1c53c){var _0x461ebf={'from':(_0x20f431[_0x3d9c('0xa6')][_0x3d9c('0xab')]||'')+'\x20'+(_0x20f431['contact'][_0x3d9c('0xbd')]||'')};if(_0x2ee327[_0x3d9c('0x62')]['threadId']&&_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0xbe')]&&_0x2ee327[_0x3d9c('0x62')]['threadId']!=_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0xbe')]){_0x461ebf[_0x3d9c('0xb7')]=_0x2ee327[_0x3d9c('0x62')][_0x3d9c('0xbe')];}return _0x6427c1[_0x3d9c('0x34')](_0x461ebf);}else{return _0x6427c1;}}})[_0x3d9c('0x35')](function(_0x2b9f08){_0x20f431[_0x3d9c('0xbb')]=_0x2b9f08[_0x3d9c('0x5c')]({'plain':!![]});_0x20f431[_0x3d9c('0xbb')][_0x3d9c('0xbf')]=_0x493f3c;if(_0x20f431[_0x3d9c('0xbb')][_0x3d9c('0xbf')]){if(_0x20f431[_0x3d9c('0xa1')][_0x3d9c('0xc0')]){_0x20f431[_0x3d9c('0xa2')]['push']({'id':0x0,'priority':_0x20f431[_0x3d9c('0xa2')][_0x3d9c('0x48')]+0x1,'app':_0x3d9c('0xc1'),'appdata':_0x3d9c('0xc2'),'interval':'*,*,*,*'});}}return db['ChatMessage'][_0x3d9c('0x5a')]({'body':_0x2ee327['body'][_0x3d9c('0x62')],'ChatWebsiteId':_0x2ee327['params']['id'],'ChatInteractionId':_0x2b9f08['id'],'direction':'in','ContactId':_0x20f431[_0x3d9c('0xa6')]['id'],'AttachmentId':_0x2ee327['body'][_0x3d9c('0xc3')]});})['then'](function(_0x21cca4){_0x20f431[_0x3d9c('0x28')]=_0x21cca4;if(_0x20f431['interaction'][_0x3d9c('0xc4')]){return db[_0x3d9c('0xc5')]['find']({'attributes':['id','name'],'where':{'id':_0x20f431['interaction'][_0x3d9c('0xc4')]}})[_0x3d9c('0x35')](function(_0x4387ec){if(_0x4387ec){_0x20f431['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x3d9c('0xc6'),'appdata':_0x4387ec['name']+','+(_0x20f431[_0x3d9c('0xa1')][_0x3d9c('0xc7')]||0xa),'interval':'*,*,*,*'});_0x20f431[_0x3d9c('0xc8')]=!![];}return respondWithRpcPromise(_0x3d9c('0xc9'),'startRouting',_0x20f431);});}return respondWithRpcPromise(_0x3d9c('0xc9'),'startRouting',_0x20f431);})[_0x3d9c('0x35')](function(_0x18aea1){respondWithRpcPromise(_0x3d9c('0xca'),_0x3d9c('0xca'),{'event':_0x3d9c('0x8a'),'message':_0x18aea1},client9002);return _0x18aea1;})['then'](respondWithResult(_0x463303,null))[_0x3d9c('0x61')](handleError(_0x463303,null));};exports[_0x3d9c('0xcb')]=function(_0x1e04a0,_0x150625,_0x108ac6){var _0x1cf29e,_0x25b109,_0x563705;var _0x4d1fb7=[];var _0xd6b12c=[];var _0x398524={};return db[_0x3d9c('0x91')][_0x3d9c('0x63')]()['then'](function(_0xcc25ef){if(!_0xcc25ef){throw new db[(_0x3d9c('0x92'))][(_0x3d9c('0x93'))](_0x3d9c('0x94'));}_0xd6b12c=_[_0x3d9c('0xcc')](_[_0x3d9c('0x58')](_0xcc25ef),[_0x3d9c('0x96'),_0x3d9c('0x95')]);_0x4d1fb7=_[_0x3d9c('0xcc')](_[_0x3d9c('0x58')](_0xcc25ef),[_0x3d9c('0x96'),_0x3d9c('0x95'),_0x3d9c('0x97'),_0x3d9c('0x98')]);if(_0x1e04a0[_0x3d9c('0x62')]['id']){delete _0x1e04a0['body']['id'];}if(_[_0x3d9c('0x7e')](_0x1e04a0['body'][_0x3d9c('0x99')])){throw _0x150625[_0x3d9c('0x2b')](0x1f4)[_0x3d9c('0x3b')](new db['Sequelize']['ValidationError'](_0x3d9c('0x9a')));}if(_[_0x3d9c('0x7e')](_0x1e04a0['body'][_0x3d9c('0x62')])||_0x1e04a0['body'][_0x3d9c('0x62')]===''){throw _0x150625[_0x3d9c('0x2b')](0x1f4)['send'](new db['Sequelize'][(_0x3d9c('0x93'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x3d9c('0x7e')](_0x1e04a0[_0x3d9c('0x62')][_0x3d9c('0xcd')])){throw _0x150625[_0x3d9c('0x2b')](0x1f4)[_0x3d9c('0x3b')](new db['Sequelize'][(_0x3d9c('0x93'))](_0x3d9c('0xce')+_0x4d1fb7));}if(!_[_0x3d9c('0xcf')](_0x4d1fb7,_0x1e04a0['body'][_0x3d9c('0xcd')])){throw _0x150625['status'](0x1f4)[_0x3d9c('0x3b')](new db[(_0x3d9c('0x92'))]['ValidationError'](_0x3d9c('0xd0')+_0x4d1fb7));}_0x398524[_0x1e04a0[_0x3d9c('0x62')][_0x3d9c('0xcd')]]=_0x1e04a0[_0x3d9c('0x62')][_0x3d9c('0x99')];})[_0x3d9c('0x35')](function(){return db[_0x3d9c('0x40')][_0x3d9c('0x59')]({'where':{'id':_0x1e04a0[_0x3d9c('0x57')]['id']},'include':[{'model':db[_0x3d9c('0x9c')],'as':_0x3d9c('0x9d')}]});})[_0x3d9c('0x35')](handleEntityNotFound(_0x150625,null))[_0x3d9c('0x35')](function(_0x80aa77){if(_0x80aa77&&_0x80aa77[_0x3d9c('0x9d')]){_0x25b109=_0x80aa77;var _0x5c809b=_[_0x3d9c('0x1a')](_0x1e04a0[_0x3d9c('0x62')],{'firstName':_0x1e04a0[_0x3d9c('0x62')][_0x3d9c('0x99')],'phone':_0x1e04a0[_0x3d9c('0x62')]['from'],'ListId':_0x80aa77[_0x3d9c('0x98')]});_0x5c809b[_0x1e04a0['body']['mapKeyOffline']]=_0x1e04a0['body'][_0x3d9c('0x99')];return db[_0x3d9c('0x91')][_0x3d9c('0xd1')]({'where':_0x398524,'defaults':_0x5c809b});}})[_0x3d9c('0xbc')](function(_0x130402){if(_0x130402){_0x563705=_0x130402;var _0x2eccf4=fs[_0x3d9c('0xd2')](path[_0x3d9c('0x7a')](config[_0x3d9c('0x7b')],_0x3d9c('0xd3')),_0x3d9c('0xd4'));var _0x55f6b1=ejs[_0x3d9c('0xd5')](_0x2eccf4,{'body':_[_0x3d9c('0xd6')](_0x1e04a0[_0x3d9c('0x62')]['body']),'bodyTitle':_0x25b109[_0x3d9c('0xd7')]});return db['ChatOfflineMessage'][_0x3d9c('0x5a')]({'body':_0x55f6b1,'ContactId':_0x130402['id'],'ChatWebsiteId':_0x25b109['id']});}})[_0x3d9c('0x35')](function(_0x3a582b){if(_0x3a582b){_0x1cf29e=_0x3a582b;return db[_0x3d9c('0xd8')][_0x3d9c('0x68')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x3d9c('0xd9'),'raw':!![]}]});}})[_0x3d9c('0x35')](function(_0x227864){if(_0x227864&&_0x227864['Smtp']&&_0x25b109[_0x3d9c('0xda')]){var _0x15ddf4={'tls':{'rejectUnauthorized':![]}};if(_0x227864[_0x3d9c('0xd9')][_0x3d9c('0xdb')]){_0x15ddf4[_0x3d9c('0xdb')]=_0x227864['Smtp'][_0x3d9c('0xdb')];}else{_0x15ddf4[_0x3d9c('0xdc')]=_0x227864[_0x3d9c('0xd9')][_0x3d9c('0xdc')];_0x15ddf4[_0x3d9c('0xdd')]=_0x227864[_0x3d9c('0xd9')][_0x3d9c('0xdd')];_0x15ddf4[_0x3d9c('0xde')]=_0x227864[_0x3d9c('0xd9')][_0x3d9c('0xde')];}if(_0x227864[_0x3d9c('0xd9')][_0x3d9c('0xdf')]){_0x15ddf4[_0x3d9c('0xe0')]={'user':_0x227864[_0x3d9c('0xd9')][_0x3d9c('0x5b')],'pass':_0x227864[_0x3d9c('0xd9')]['pass']};}return respondWithRpcPromise(_0x3d9c('0xe1'),_0x3d9c('0xe2'),{'account':_0x15ddf4,'message':{'from':util[_0x3d9c('0xb0')](_0x3d9c('0xe3'),_0x227864[_0x3d9c('0x3a')],_0x227864[_0x3d9c('0xe4')]||_0x227864[_0x3d9c('0xd9')]['user']),'to':_0x25b109[_0x3d9c('0xda')],'subject':_0x25b109[_0x3d9c('0xe5')],'text':_0x1cf29e['body']}},client9003)[_0x3d9c('0x35')](function(){return _0x1cf29e;})[_0x3d9c('0x61')](function(_0x4b1a3f){console[_0x3d9c('0x26')](_0x4b1a3f);});}})['then'](function(){if(_0x1cf29e){return _0x1cf29e;}})[_0x3d9c('0x35')](respondWithResult(_0x150625,null))[_0x3d9c('0x61')](handleError(_0x150625,null));};exports['addInteraction']=function(_0x4e6084,_0x413970,_0x3e95cc){return db[_0x3d9c('0xb9')][_0x3d9c('0x59')]({'where':{'id':_0x4e6084[_0x3d9c('0x57')]['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x413970,null))[_0x3d9c('0x35')](function(_0x12499e){if(_0x12499e){return _0x12499e[_0x3d9c('0xe6')](_0x4e6084[_0x3d9c('0x62')]['ids'],_[_0x3d9c('0xe7')](_0x4e6084['body'],[_0x3d9c('0x70'),'id'])||{});}})[_0x3d9c('0x35')](respondWithResult(_0x413970,null))[_0x3d9c('0x61')](handleError(_0x413970,null));};exports['getInteractions']=function(_0x395c83,_0x15a83f,_0xa3bac1){var _0x18581b={'raw':![],'where':{}};var _0xf728e4={};var _0x530ec7={'count':0x0,'rows':[]};return db[_0x3d9c('0x40')][_0x3d9c('0x68')]({'where':{'id':_0x395c83['params']['id']}})['then'](handleEntityNotFound(_0x15a83f,null))[_0x3d9c('0x35')](function(_0x16f4da){if(_0x16f4da){_0xf728e4[_0x3d9c('0x43')]=_[_0x3d9c('0x58')](db[_0x3d9c('0xb9')][_0x3d9c('0x41')]);_0xf728e4['query']=_['keys'](_0x395c83[_0x3d9c('0x44')]);_0xf728e4['filters']=_[_0x3d9c('0x45')](_0xf728e4[_0x3d9c('0x43')],_0xf728e4[_0x3d9c('0x44')]);_0x18581b[_0x3d9c('0x46')]=_[_0x3d9c('0x45')](_0xf728e4[_0x3d9c('0x43')],qs[_0x3d9c('0x47')](_0x395c83['query'][_0x3d9c('0x47')]));_0x18581b[_0x3d9c('0x46')]=_0x18581b[_0x3d9c('0x46')]['length']?_0x18581b[_0x3d9c('0x46')]:_0xf728e4[_0x3d9c('0x43')];if(!_0x395c83['query'][_0x3d9c('0x49')](_0x3d9c('0x4a'))){_0x18581b['limit']=qs[_0x3d9c('0x2f')](_0x395c83[_0x3d9c('0x44')]['limit']);_0x18581b['offset']=qs[_0x3d9c('0x2e')](_0x395c83['query'][_0x3d9c('0x2e')]);}_0x18581b['order']=qs[_0x3d9c('0x4b')](_0x395c83[_0x3d9c('0x44')][_0x3d9c('0x4b')]);_0x18581b[_0x3d9c('0x4c')]=qs[_0x3d9c('0x4d')](_['pick'](_0x395c83[_0x3d9c('0x44')],_0xf728e4[_0x3d9c('0x4d')]));_0x18581b['where']['ChatWebsiteId']=_0x16f4da['id'];if(_0x395c83[_0x3d9c('0x44')][_0x3d9c('0x4e')]){_0x18581b[_0x3d9c('0x4c')]=_[_0x3d9c('0x4f')](_0x18581b['where'],{'$or':_[_0x3d9c('0x3f')](_0x18581b[_0x3d9c('0x46')],function(_0x39b76d){var _0x427e75={};_0x427e75[_0x39b76d]={'$like':'%'+_0x395c83[_0x3d9c('0x44')][_0x3d9c('0x4e')]+'%'};return _0x427e75;})});}_0x18581b=_[_0x3d9c('0x4f')]({},_0x18581b,_0x395c83[_0x3d9c('0x6a')]);return db['ChatInteraction'][_0x3d9c('0x51')]({'where':_0x18581b[_0x3d9c('0x4c')]})[_0x3d9c('0x35')](function(_0x1862d8){_0x530ec7[_0x3d9c('0x51')]=_0x1862d8;if(_0x395c83[_0x3d9c('0x44')][_0x3d9c('0x52')]){_0x18581b['include']=[{'model':db[_0x3d9c('0x91')],'as':'Contact','required':![]},{'model':db[_0x3d9c('0xc5')],'as':_0x3d9c('0xe8'),'attributes':['name',_0x3d9c('0xe9'),_0x3d9c('0xea')],'required':![]},{'model':db[_0x3d9c('0xeb')],'as':_0x3d9c('0xec'),'attributes':['id',_0x3d9c('0x3a'),_0x3d9c('0xed')],'where':_0x395c83[_0x3d9c('0x44')][_0x3d9c('0xee')]?{'id':_0x395c83[_0x3d9c('0x44')]['tag']}:undefined,'required':_0x395c83['query'][_0x3d9c('0xee')]?!![]:![]}];}return db[_0x3d9c('0xb9')][_0x3d9c('0x54')](_0x18581b);})[_0x3d9c('0x35')](function(_0x5b0d63){_0x530ec7[_0x3d9c('0x55')]=_0x5b0d63;return _0x530ec7;});}})[_0x3d9c('0x35')](respondWithFilteredResult(_0x15a83f,_0x18581b))['catch'](handleError(_0x15a83f,null));};function iftimePromise(_0x1045d0,_0x8039d4){return respondWithRpcPromise('Command',_0x3d9c('0xef'),{'command':_0x8039d4[_0x3d9c('0xf0')]?util['format']('iftime\x20%s,%s',_0x1045d0[_0x3d9c('0xf1')],_0x8039d4[_0x3d9c('0xf0')]):util[_0x3d9c('0xb0')]('iftime\x20%s',_0x1045d0[_0x3d9c('0xf1')])},client9002)[_0x3d9c('0x35')](function(_0x109071){var _0x4d1605=_0x109071&&_0x109071[_0x3d9c('0xf2')](_0x3d9c('0xf3'))>=0x0?!![]:![];logger[_0x3d9c('0xf4')](_0x3d9c('0xf5'),_0x8039d4['id'],_0x1045d0['id'],_0x1045d0[_0x3d9c('0xf1')],_0x4d1605?'ONLINE':_0x3d9c('0xf6'),_0x8039d4[_0x3d9c('0xf0')]?_0x8039d4[_0x3d9c('0xf0')]:'No\x20timezone');return _0x4d1605;})[_0x3d9c('0x61')](function(_0x7de4c){logger[_0x3d9c('0x26')](_0x3d9c('0xf5'),_0x8039d4['id'],_0x1045d0['id'],_0x1045d0[_0x3d9c('0xf1')],util[_0x3d9c('0xf7')](_0x7de4c,{'showHidden':![],'depth':null}),_0x8039d4[_0x3d9c('0xf0')]?_0x8039d4[_0x3d9c('0xf0')]:_0x3d9c('0xf8'));return![];});}exports['getSnippet']=function(_0x2aebd9,_0x4323f0,_0x38668c){var _0x3f112f=0x0;var _0x41a0bf=0x0;var _0x3c0967=![];var _0x496c23;var _0x5ff9ba;return db[_0x3d9c('0x40')][_0x3d9c('0x59')]({'where':{'id':_0x2aebd9[_0x3d9c('0x57')]['id']},'include':[{'model':db['Interval'],'as':_0x3d9c('0xf9'),'include':[{'model':db['Interval'],'as':_0x3d9c('0xfa'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x3d9c('0x35')](handleEntityNotFound(_0x4323f0,null))[_0x3d9c('0x35')](function(_0x41855b){if(_0x41855b){_0x496c23=_0x41855b;return _0x41855b[_0x3d9c('0xfb')]({'raw':!![]});}})[_0x3d9c('0x35')](function(_0x414dd2){if(_0x496c23){if(_0x414dd2){_0x5ff9ba=_0x414dd2;}}return require('../../config/license/util')[_0x3d9c('0x7d')]();})[_0x3d9c('0x35')](function(_0x42b546){if(_0x42b546){_0x41a0bf=_0x42b546['virtual'];_0x3c0967=_0x42b546[_0x3d9c('0xfc')];}})['then'](function(){return db['ChatInteraction'][_0x3d9c('0x51')]({'where':{'closed':![]}});})[_0x3d9c('0x35')](function(_0x463176){_0x3f112f=_0x463176;if(_0x41a0bf&&_0x463176>_0x41a0bf){return db[_0x3d9c('0xfd')][_0x3d9c('0x68')]({'where':{'id':0x1}})['then'](function(_0x30b095){if(_0x30b095){_0x30b095[_0x3d9c('0xfe')](_0x3d9c('0xff'));}});}})[_0x3d9c('0x35')](function(){if(_0x496c23[_0x3d9c('0xf9')]&&_0x496c23[_0x3d9c('0xf9')][_0x3d9c('0xfa')]){var _0x34b769=[];for(var _0x4f9c57=0x0;_0x4f9c57<_0x496c23['Interval']['Intervals'][_0x3d9c('0x48')];_0x4f9c57++){var _0x1e3501=_0x496c23[_0x3d9c('0xf9')]['Intervals'][_0x4f9c57]['get']({'plain':!![]});_0x34b769[_0x3d9c('0x100')](iftimePromise(_0x1e3501,_0x496c23));}return BPromise[_0x3d9c('0x101')](_0x34b769)['then'](function(_0x5722db){return _[_0x3d9c('0x102')](_0x5722db);});}else{return!![];}})[_0x3d9c('0x35')](function(_0x121660){var _0x2c1cc9=fs[_0x3d9c('0xd2')](path['join'](config[_0x3d9c('0x7b')],_0x3d9c('0x103')),_0x3d9c('0xd4'));var _0x464d11={'remote':_0x496c23[_0x3d9c('0x104')],'query':querystring[_0x3d9c('0x25')](_[_0x3d9c('0x4f')](_0x496c23[_0x3d9c('0x5c')]({'plain':!![]}),{'customerIp':_0x2aebd9[_0x3d9c('0x8d')][_0x3d9c('0xa9')]||_0x2aebd9[_0x3d9c('0x8d')][_0x3d9c('0x105')]||_0x2aebd9[_0x3d9c('0x106')][_0x3d9c('0x107')]||_0x2aebd9['ip'],'referer':_0x2aebd9[_0x3d9c('0x8d')]['referer'],'openedInteractions':_0x3f112f,'maxInteractions':_0x41a0bf,'virtual':_0x3c0967[_0x3d9c('0x108')],'online':_0x121660,'custom':_0x3c0967}))[_0x3d9c('0x109')](/'/g,'\x5c\x27')};_0x4323f0['send'](ejs[_0x3d9c('0xd5')](Mustache[_0x3d9c('0xd5')](_0x2c1cc9,_0x464d11),{'proactiveActions':_0x5ff9ba,'alignment':_0x496c23[_0x3d9c('0x10a')],'verticalAlignment':_0x496c23[_0x3d9c('0x10b')],'div_color':_0x496c23[_0x3d9c('0xed')],'text_color':_0x496c23[_0x3d9c('0x10c')]}));})[_0x3d9c('0x61')](handleError(_0x4323f0,null));};exports[_0x3d9c('0x10d')]=function(_0x5aeffd,_0x179ea7,_0x28b818){return db['ChatWebsite'][_0x3d9c('0x68')]({'where':{'id':_0x5aeffd['params']['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x179ea7,null))['then'](function(_0x5a5e32){if(_0x5a5e32){return db['sequelize']['transaction'](function(_0x1e275d){return db[_0x3d9c('0x9f')][_0x3d9c('0x36')]({'where':{'ChatWebsiteId':_0x5aeffd[_0x3d9c('0x57')]['id']},'transaction':_0x1e275d})['then'](function(_0x446ecd){var _0x7a8901=_[_0x3d9c('0x3f')](_0x5aeffd[_0x3d9c('0x62')],function(_0x31ca8a){_0x31ca8a[_0x3d9c('0x65')]=_0x5aeffd[_0x3d9c('0x57')]['id'];return _0x31ca8a;});return db[_0x3d9c('0x9f')][_0x3d9c('0x10e')](_0x7a8901,{'transaction':_0x1e275d});});})[_0x3d9c('0x35')](function(){return db[_0x3d9c('0x9f')][_0x3d9c('0x10f')]({'where':{'ChatWebsiteId':_0x5aeffd[_0x3d9c('0x57')]['id']},'order':_0x3d9c('0xa4')});});}})[_0x3d9c('0x35')](respondWithResult(_0x179ea7,null))[_0x3d9c('0x61')](handleError(_0x179ea7,null));};exports[_0x3d9c('0x110')]=function(_0x27dfb1,_0x2daee2,_0x3f0f8d){var _0x3592a6={};var _0x3b0962={};var _0x175a1f;var _0x2be393;return db['ChatWebsite'][_0x3d9c('0x68')]({'where':{'id':_0x27dfb1['params']['id']}})['then'](handleEntityNotFound(_0x2daee2,null))[_0x3d9c('0x35')](function(_0x5e1333){if(_0x5e1333){_0x175a1f=_0x5e1333;_0x3b0962['model']=_[_0x3d9c('0x58')](db['ChatApplication'][_0x3d9c('0x41')]);_0x3b0962[_0x3d9c('0x44')]=_[_0x3d9c('0x58')](_0x27dfb1[_0x3d9c('0x44')]);_0x3b0962['filters']=_['intersection'](_0x3b0962[_0x3d9c('0x43')],_0x3b0962[_0x3d9c('0x44')]);_0x3592a6[_0x3d9c('0x46')]=_['intersection'](_0x3b0962[_0x3d9c('0x43')],qs[_0x3d9c('0x47')](_0x27dfb1[_0x3d9c('0x44')][_0x3d9c('0x47')]));_0x3592a6[_0x3d9c('0x46')]=_0x3592a6[_0x3d9c('0x46')]['length']?_0x3592a6['attributes']:_0x3b0962['model'];_0x3592a6[_0x3d9c('0x69')]=qs[_0x3d9c('0x4b')](_0x27dfb1[_0x3d9c('0x44')][_0x3d9c('0x4b')]);_0x3592a6[_0x3d9c('0x4c')]=qs['filters'](_[_0x3d9c('0x6e')](_0x27dfb1[_0x3d9c('0x44')],_0x3b0962[_0x3d9c('0x4d')]));if(_0x27dfb1[_0x3d9c('0x44')][_0x3d9c('0x4e')]){_0x3592a6['where']=_['merge'](_0x3592a6['where'],{'$or':_['map'](_0x3592a6[_0x3d9c('0x46')],function(_0xc50a70){var _0x59d7f5={};_0x59d7f5[_0xc50a70]={'$like':'%'+_0x27dfb1['query']['filter']+'%'};return _0x59d7f5;})});}_0x3592a6=_[_0x3d9c('0x4f')]({},_0x3592a6,_0x27dfb1[_0x3d9c('0x6a')]);return _0x175a1f[_0x3d9c('0x110')](_0x3592a6);}})[_0x3d9c('0x35')](function(_0x328586){if(_0x328586){_0x2be393=_0x328586[_0x3d9c('0x48')];if(!_0x27dfb1[_0x3d9c('0x44')][_0x3d9c('0x49')]('nolimit')){_0x3592a6['limit']=qs['limit'](_0x27dfb1[_0x3d9c('0x44')][_0x3d9c('0x2f')]);_0x3592a6[_0x3d9c('0x2e')]=qs[_0x3d9c('0x2e')](_0x27dfb1[_0x3d9c('0x44')]['offset']);}return _0x175a1f[_0x3d9c('0x110')](_0x3592a6);}})['then'](function(_0x5fa7b1){if(_0x5fa7b1){return _0x5fa7b1?{'count':_0x2be393,'rows':_0x5fa7b1}:null;}})['then'](respondWithResult(_0x2daee2,null))[_0x3d9c('0x61')](handleError(_0x2daee2,null));};exports[_0x3d9c('0x111')]=function(_0x3ba3b3,_0x17fed0,_0x34d5ba){return db[_0x3d9c('0x112')][_0x3d9c('0x59')]({'where':{'id':_0x3ba3b3[_0x3d9c('0x57')]['id']}})['then'](handleEntityNotFound(_0x17fed0,null))['then'](function(_0x3d755a){if(_0x3d755a){return _0x3d755a[_0x3d9c('0x111')](_0x3ba3b3[_0x3d9c('0x62')][_0x3d9c('0x70')],_['omit'](_0x3ba3b3[_0x3d9c('0x62')],[_0x3d9c('0x70'),'id'])||{});}})['then'](respondWithResult(_0x17fed0,null))[_0x3d9c('0x61')](handleError(_0x17fed0,null));};exports[_0x3d9c('0xfb')]=function(_0x5f33b1,_0x237ecf,_0x3674cd){var _0x7fd659={};var _0x2bfbdf={};var _0x1e0cf9;var _0x4fba91;return db['ChatWebsite'][_0x3d9c('0x68')]({'where':{'id':_0x5f33b1[_0x3d9c('0x57')]['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x237ecf,null))['then'](function(_0x6752b6){if(_0x6752b6){_0x1e0cf9=_0x6752b6;_0x2bfbdf['model']=_['keys'](db[_0x3d9c('0x113')]['rawAttributes']);_0x2bfbdf[_0x3d9c('0x44')]=_['keys'](_0x5f33b1[_0x3d9c('0x44')]);_0x2bfbdf[_0x3d9c('0x4d')]=_[_0x3d9c('0x45')](_0x2bfbdf[_0x3d9c('0x43')],_0x2bfbdf[_0x3d9c('0x44')]);_0x7fd659[_0x3d9c('0x46')]=_['intersection'](_0x2bfbdf[_0x3d9c('0x43')],qs[_0x3d9c('0x47')](_0x5f33b1['query'][_0x3d9c('0x47')]));_0x7fd659['attributes']=_0x7fd659[_0x3d9c('0x46')][_0x3d9c('0x48')]?_0x7fd659[_0x3d9c('0x46')]:_0x2bfbdf['model'];_0x7fd659[_0x3d9c('0x69')]=qs[_0x3d9c('0x4b')](_0x5f33b1[_0x3d9c('0x44')][_0x3d9c('0x4b')]);_0x7fd659[_0x3d9c('0x4c')]=qs[_0x3d9c('0x4d')](_[_0x3d9c('0x6e')](_0x5f33b1[_0x3d9c('0x44')],_0x2bfbdf[_0x3d9c('0x4d')]));if(_0x5f33b1[_0x3d9c('0x44')]['filter']){_0x7fd659[_0x3d9c('0x4c')]=_[_0x3d9c('0x4f')](_0x7fd659[_0x3d9c('0x4c')],{'$or':_['map'](_0x7fd659['attributes'],function(_0x1fb657){var _0xedf91d={};_0xedf91d[_0x1fb657]={'$like':'%'+_0x5f33b1[_0x3d9c('0x44')]['filter']+'%'};return _0xedf91d;})});}_0x7fd659=_[_0x3d9c('0x4f')]({},_0x7fd659,_0x5f33b1[_0x3d9c('0x6a')]);return _0x1e0cf9[_0x3d9c('0xfb')](_0x7fd659);}})[_0x3d9c('0x35')](function(_0x294206){if(_0x294206){_0x4fba91=_0x294206[_0x3d9c('0x48')];if(!_0x5f33b1[_0x3d9c('0x44')][_0x3d9c('0x49')](_0x3d9c('0x4a'))){_0x7fd659[_0x3d9c('0x2f')]=qs[_0x3d9c('0x2f')](_0x5f33b1[_0x3d9c('0x44')][_0x3d9c('0x2f')]);_0x7fd659[_0x3d9c('0x2e')]=qs['offset'](_0x5f33b1[_0x3d9c('0x44')]['offset']);}return _0x1e0cf9[_0x3d9c('0xfb')](_0x7fd659);}})[_0x3d9c('0x35')](function(_0x579c6b){if(_0x579c6b){return _0x579c6b?{'count':_0x4fba91,'rows':_0x579c6b}:null;}})[_0x3d9c('0x35')](respondWithResult(_0x237ecf,null))[_0x3d9c('0x61')](handleError(_0x237ecf,null));};exports['getFields']=function(_0x4489d2,_0x12f6a1,_0x230b2f){var _0x40491f=_0x4489d2['query'][_0x3d9c('0x114')]===_0x3d9c('0x115')?_0x3d9c('0x116'):_0x3d9c('0x117');return db[_0x3d9c('0x40')][_0x3d9c('0x59')]({'attributes':['id',_0x40491f],'where':{'id':_0x4489d2['params']['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x12f6a1,null))[_0x3d9c('0x35')](function(_0x426b38){if(_0x426b38){var _0x395378=_0x426b38[_0x40491f];var _0x2fd89e=_0x395378&&_0x395378[_0x3d9c('0x118')]?_0x395378[_0x3d9c('0x118')]:[];_0x12f6a1[_0x3d9c('0x3b')]({'fromKey':_[_0x3d9c('0x7e')](_0x395378[_0x3d9c('0x119')])?undefined:_0x395378['fromKey'],'count':_0x2fd89e[_0x3d9c('0x48')],'rows':_0x2fd89e});}})[_0x3d9c('0x61')](handleError(_0x12f6a1,null));};exports[_0x3d9c('0x11a')]=function(_0x1b8554,_0x5aa2b8,_0x28c668){var _0x4003b8={'raw':![],'where':{}};var _0x232597={};var _0x5b2f91={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x1b8554['params']['id']}})['then'](handleEntityNotFound(_0x5aa2b8,null))[_0x3d9c('0x35')](function(_0x219845){if(_0x219845){_0x232597['model']=_[_0x3d9c('0x58')](db[_0x3d9c('0x11b')][_0x3d9c('0x41')]);_0x232597['query']=_[_0x3d9c('0x58')](_0x1b8554[_0x3d9c('0x44')]);_0x232597['filters']=_[_0x3d9c('0x45')](_0x232597[_0x3d9c('0x43')],_0x232597[_0x3d9c('0x44')]);_0x4003b8['attributes']=_['intersection'](_0x232597['model'],qs['fields'](_0x1b8554[_0x3d9c('0x44')][_0x3d9c('0x47')]));_0x4003b8[_0x3d9c('0x46')]=_0x4003b8[_0x3d9c('0x46')][_0x3d9c('0x48')]?_0x4003b8['attributes']:_0x232597[_0x3d9c('0x43')];if(!_0x1b8554[_0x3d9c('0x44')][_0x3d9c('0x49')](_0x3d9c('0x4a'))){_0x4003b8[_0x3d9c('0x2f')]=qs[_0x3d9c('0x2f')](_0x1b8554[_0x3d9c('0x44')][_0x3d9c('0x2f')]);_0x4003b8['offset']=qs[_0x3d9c('0x2e')](_0x1b8554[_0x3d9c('0x44')]['offset']);}_0x4003b8[_0x3d9c('0x69')]=qs['sort'](_0x1b8554['query']['sort']);_0x4003b8['where']=qs[_0x3d9c('0x4d')](_['pick'](_0x1b8554[_0x3d9c('0x44')],_0x232597['filters']));_0x4003b8[_0x3d9c('0x4c')][_0x3d9c('0x65')]=_0x219845['id'];if(_0x1b8554[_0x3d9c('0x44')]['filter']){_0x4003b8[_0x3d9c('0x4c')]=_[_0x3d9c('0x4f')](_0x4003b8[_0x3d9c('0x4c')],{'$or':_[_0x3d9c('0x3f')](_0x4003b8['attributes'],function(_0x65bda0){var _0x1a2f30={};_0x1a2f30[_0x65bda0]={'$like':'%'+_0x1b8554[_0x3d9c('0x44')][_0x3d9c('0x4e')]+'%'};return _0x1a2f30;})});}_0x4003b8=_[_0x3d9c('0x4f')]({},_0x4003b8,_0x1b8554[_0x3d9c('0x6a')]);return db[_0x3d9c('0x11b')][_0x3d9c('0x51')]({'where':_0x4003b8[_0x3d9c('0x4c')]})[_0x3d9c('0x35')](function(_0x594224){_0x5b2f91[_0x3d9c('0x51')]=_0x594224;if(_0x1b8554[_0x3d9c('0x44')]['includeAll']){_0x4003b8[_0x3d9c('0x53')]=[{'all':!![]}];}else{_0x4003b8[_0x3d9c('0x53')]=[{'model':db[_0x3d9c('0x91')],'as':'Contact','required':![]}];}return db[_0x3d9c('0x11b')][_0x3d9c('0x54')](_0x4003b8);})[_0x3d9c('0x35')](function(_0x425afc){_0x5b2f91[_0x3d9c('0x55')]=_0x425afc;return _0x5b2f91;});}})['then'](respondWithFilteredResult(_0x5aa2b8,_0x4003b8))[_0x3d9c('0x61')](handleError(_0x5aa2b8,null));};exports[_0x3d9c('0x11c')]=function(_0x58f529,_0x850a60,_0x215dd6){return db[_0x3d9c('0x40')]['find']({'where':{'id':_0x58f529[_0x3d9c('0x57')]['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x850a60,null))['then'](function(_0xfff46){if(_0xfff46){return _0xfff46[_0x3d9c('0x11c')](_0x58f529[_0x3d9c('0x62')][_0x3d9c('0x70')],_[_0x3d9c('0xe7')](_0x58f529['body'],[_0x3d9c('0x70'),'id'])||{})[_0x3d9c('0xbc')](function(_0x77ca1e){for(var _0x2df8dd=0x0;_0x2df8dd<_0x58f529[_0x3d9c('0x62')][_0x3d9c('0x70')][_0x3d9c('0x48')];_0x2df8dd+=0x1){socket['emit'](_0x3d9c('0x11d'),{'UserId':_0x58f529[_0x3d9c('0x62')]['ids'][_0x2df8dd],'ChatWebsiteId':_0x58f529['params']['id']});}return _0x77ca1e;});}})[_0x3d9c('0x35')](respondWithResult(_0x850a60,null))[_0x3d9c('0x61')](handleError(_0x850a60,null));};exports[_0x3d9c('0x11e')]=function(_0x6806bc,_0x3ec0c7,_0x487c4d){return db[_0x3d9c('0x40')][_0x3d9c('0x59')]({'where':{'id':_0x6806bc['params']['id']}})['then'](handleEntityNotFound(_0x3ec0c7,null))[_0x3d9c('0x35')](function(_0x49be62){if(_0x49be62){return _0x49be62[_0x3d9c('0x11e')](_0x6806bc[_0x3d9c('0x44')][_0x3d9c('0x70')])['then'](function(){if(_['isArray'](_0x6806bc['query'][_0x3d9c('0x70')])){for(var _0x505f99=0x0;_0x505f99<_0x6806bc[_0x3d9c('0x44')][_0x3d9c('0x70')][_0x3d9c('0x48')];_0x505f99+=0x1){socket[_0x3d9c('0x11f')]('userChatWebsite:remove',{'UserId':Number(_0x6806bc['query'][_0x3d9c('0x70')][_0x505f99]),'ChatWebsiteId':Number(_0x6806bc[_0x3d9c('0x57')]['id'])});}}else{socket[_0x3d9c('0x11f')](_0x3d9c('0x120'),{'UserId':Number(_0x6806bc[_0x3d9c('0x44')][_0x3d9c('0x70')]),'ChatWebsiteId':Number(_0x6806bc[_0x3d9c('0x57')]['id'])});}});}})[_0x3d9c('0x35')](respondWithStatusCode(_0x3ec0c7,null))[_0x3d9c('0x61')](handleError(_0x3ec0c7,null));};exports['getAgents']=function(_0x47e067,_0x39ba7f,_0x370ba7){var _0x1fcc09={};var _0x3ec573={};var _0xac84b7;var _0xe63027;return db[_0x3d9c('0x40')][_0x3d9c('0x68')]({'where':{'id':_0x47e067[_0x3d9c('0x57')]['id']}})[_0x3d9c('0x35')](handleEntityNotFound(_0x39ba7f,null))[_0x3d9c('0x35')](function(_0x299e2c){if(_0x299e2c){_0xac84b7=_0x299e2c;_0x3ec573[_0x3d9c('0x43')]=_[_0x3d9c('0x58')](db[_0x3d9c('0xc5')][_0x3d9c('0x41')]);_0x3ec573[_0x3d9c('0x44')]=_['keys'](_0x47e067[_0x3d9c('0x44')]);_0x3ec573[_0x3d9c('0x4d')]=_[_0x3d9c('0x45')](_0x3ec573['model'],_0x3ec573[_0x3d9c('0x44')]);_0x1fcc09['attributes']=_[_0x3d9c('0x45')](_0x3ec573['model'],qs[_0x3d9c('0x47')](_0x47e067[_0x3d9c('0x44')]['fields']));_0x1fcc09[_0x3d9c('0x46')]=_0x1fcc09[_0x3d9c('0x46')]['length']?_0x1fcc09[_0x3d9c('0x46')]:_0x3ec573['model'];_0x1fcc09[_0x3d9c('0x69')]=qs['sort'](_0x47e067[_0x3d9c('0x44')][_0x3d9c('0x4b')]);_0x1fcc09[_0x3d9c('0x4c')]=qs['filters'](_['pick'](_0x47e067['query'],_0x3ec573[_0x3d9c('0x4d')]));if(_0x47e067[_0x3d9c('0x44')][_0x3d9c('0x4e')]){_0x1fcc09[_0x3d9c('0x4c')]=_[_0x3d9c('0x4f')](_0x1fcc09['where'],{'$or':_['map'](_0x1fcc09[_0x3d9c('0x46')],function(_0x289329){var _0x2ca134={};_0x2ca134[_0x289329]={'$like':'%'+_0x47e067[_0x3d9c('0x44')]['filter']+'%'};return _0x2ca134;})});}_0x1fcc09=_[_0x3d9c('0x4f')]({},_0x1fcc09,_0x47e067[_0x3d9c('0x6a')]);return _0xac84b7['getAgents'](_0x1fcc09);}})['then'](function(_0x1b360a){if(_0x1b360a){_0xe63027=_0x1b360a[_0x3d9c('0x48')];if(!_0x47e067['query'][_0x3d9c('0x49')](_0x3d9c('0x4a'))){_0x1fcc09[_0x3d9c('0x2f')]=qs[_0x3d9c('0x2f')](_0x47e067[_0x3d9c('0x44')][_0x3d9c('0x2f')]);_0x1fcc09[_0x3d9c('0x2e')]=qs['offset'](_0x47e067[_0x3d9c('0x44')][_0x3d9c('0x2e')]);}return _0xac84b7[_0x3d9c('0x121')](_0x1fcc09);}})['then'](function(_0x26bc89){if(_0x26bc89){return _0x26bc89?{'count':_0xe63027,'rows':_0x26bc89}:null;}})[_0x3d9c('0x35')](respondWithResult(_0x39ba7f,null))[_0x3d9c('0x61')](handleError(_0x39ba7f,null));}; \ No newline at end of file +var _0x9c4a=['mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','account','applications','Applications','orderBy','priority','asc','defaults','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','referer','browser','version','format','%s\x20%s','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','firstName','lastName','messageId','created','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','EventManager','no\x20available\x20attributes','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','Smtp','forwardOfflineAddress','service','host','port','authentication','pass','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','Interval','Intervals','getProactiveActions','getLicense','custom','License','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.js','remote','x-real-ip','connection','alignment','verticalAlignment','textColor','transaction','ChatApplication','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','jayson/promise','http','client','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','ChatWebsites','stack','name','send','map','ChatWebsite','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','show','params','Pause','rawAttributes','keys','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','mandatoryDispositionPause','destroy','describe','ChatWebsiteId','getDispositions','findOne','Disposition','include','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','from'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c4a,0x193));var _0xa9c4=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x9c4a[_0x5ddaac];return _0x2a9c58;};'use strict';var pdf=require(_0xa9c4('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa9c4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa9c4('0x2'));var moment=require(_0xa9c4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa9c4('0x4'));var util=require('util');var path=require(_0xa9c4('0x5'));var sox=require(_0xa9c4('0x6'));var csv=require(_0xa9c4('0x7'));var ejs=require(_0xa9c4('0x8'));var fs=require('fs');var _=require(_0xa9c4('0x9'));var squel=require(_0xa9c4('0xa'));var crypto=require(_0xa9c4('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa9c4('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa9c4('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xa9c4('0xd'));var as=require(_0xa9c4('0xe'));var hardwareService=require(_0xa9c4('0xf'));var logger=require(_0xa9c4('0x10'))('api');var utils=require(_0xa9c4('0x11'));var config=require(_0xa9c4('0x12'));var licenseUtil=require(_0xa9c4('0x13'));var db=require('../../mysqldb')['db'];config[_0xa9c4('0x14')]=_['defaults'](config['redis'],{'host':_0xa9c4('0x15'),'port':0x18eb});var socket=require(_0xa9c4('0x16'))(new Redis(config[_0xa9c4('0x14')]));require('./chatWebsite.socket')['register'](socket);var jayson=require(_0xa9c4('0x17'));var client=jayson['client'][_0xa9c4('0x18')]({'port':0x232c});var client9002=jayson[_0xa9c4('0x19')][_0xa9c4('0x18')]({'port':0x232a});var client9003=jayson[_0xa9c4('0x19')][_0xa9c4('0x18')]({'port':0x232b});function respondWithRpcPromise(_0x5a2fcd,_0xfc06d5,_0x45f5b0,_0xa6e294){return new BPromise(function(_0x1df1eb,_0x3560f0){var _0x4e7c81=_0xa6e294||client;return _0x4e7c81[_0xa9c4('0x1a')](_0x5a2fcd,_0x45f5b0)[_0xa9c4('0x1b')](function(_0x58aeea){logger[_0xa9c4('0x1c')](_0xa9c4('0x1d'),_0xfc06d5,_0xa9c4('0x1e'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0xfc06d5,'request\x20sent',JSON[_0xa9c4('0x1f')](_0x58aeea));if(_0x58aeea[_0xa9c4('0x20')]){if(_0x58aeea[_0xa9c4('0x20')][_0xa9c4('0x21')]===0x1f4){logger[_0xa9c4('0x20')](_0xa9c4('0x1d'),_0xfc06d5,_0x58aeea[_0xa9c4('0x20')][_0xa9c4('0x22')]);return _0x3560f0(_0x58aeea[_0xa9c4('0x20')][_0xa9c4('0x22')]);}logger[_0xa9c4('0x20')](_0xa9c4('0x1d'),_0xfc06d5,_0x58aeea[_0xa9c4('0x20')]['message']);return _0x1df1eb(_0x58aeea[_0xa9c4('0x20')][_0xa9c4('0x22')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0xfc06d5,_0xa9c4('0x1e'));_0x1df1eb(_0x58aeea[_0xa9c4('0x23')][_0xa9c4('0x22')]);}})[_0xa9c4('0x24')](function(_0x5b53f4){logger['error'](_0xa9c4('0x1d'),_0xfc06d5,_0x5b53f4);_0x3560f0(_0x5b53f4);});});}function respondWithStatusCode(_0x181466,_0x4a9c52){_0x4a9c52=_0x4a9c52||0xcc;return function(_0x3cfc18){if(_0x3cfc18){return _0x181466[_0xa9c4('0x25')](_0x4a9c52);}return _0x181466[_0xa9c4('0x26')](_0x4a9c52)[_0xa9c4('0x27')]();};}function respondWithResult(_0x9ceca4,_0x4f33d3){_0x4f33d3=_0x4f33d3||0xc8;return function(_0x57f57e){if(_0x57f57e){return _0x9ceca4[_0xa9c4('0x26')](_0x4f33d3)[_0xa9c4('0x28')](_0x57f57e);}};}function respondWithFilteredResult(_0x3abbbe,_0x3630b9){return function(_0x5ad66c){if(_0x5ad66c){var _0x5cfdc1=_0x5ad66c['count'],_0x3e27b2=_0x3630b9[_0xa9c4('0x29')],_0x348fba=_0x3630b9[_0xa9c4('0x29')]+_0x3630b9[_0xa9c4('0x2a')],_0x17302e;if(_0x348fba>=_0x5cfdc1){_0x348fba=_0x5cfdc1;_0x17302e=0xc8;}else{_0x17302e=0xce;}_0x3abbbe[_0xa9c4('0x26')](_0x17302e);return _0x3abbbe[_0xa9c4('0x2b')](_0xa9c4('0x2c'),_0x3e27b2+'-'+_0x348fba+'/'+_0x5cfdc1)[_0xa9c4('0x28')](_0x5ad66c);}return null;};}function patchUpdates(_0x538011){return function(_0x373e11){try{jsonpatch['apply'](_0x373e11,_0x538011,!![]);}catch(_0x3a7932){return BPromise[_0xa9c4('0x2d')](_0x3a7932);}return _0x373e11[_0xa9c4('0x2e')]();};}function saveUpdates(_0x166535,_0x7e9d9){return function(_0xe01eb6){if(_0xe01eb6){return _0xe01eb6[_0xa9c4('0x2f')](_0x166535)[_0xa9c4('0x1b')](function(_0x247c0b){return _0x247c0b;});}return null;};}function removeEntity(_0x56eb14,_0x335eb9){return function(_0x35c7eb){if(_0x35c7eb){return _0x35c7eb['destroy']()[_0xa9c4('0x1b')](function(){var _0x9d2ac9=_0x35c7eb['get']({'plain':!![]});var _0xd8ff8e=_0xa9c4('0x30');return db['UserProfileResource']['destroy']({'where':{'type':_0xd8ff8e,'resourceId':_0x9d2ac9['id']}})['then'](function(){return _0x35c7eb;});})[_0xa9c4('0x1b')](function(){_0x56eb14[_0xa9c4('0x26')](0xcc)[_0xa9c4('0x27')]();});}};}function handleEntityNotFound(_0x2fb50b,_0x506f78){return function(_0x5dd74b){if(!_0x5dd74b){_0x2fb50b[_0xa9c4('0x25')](0x194);}return _0x5dd74b;};}function handleError(_0x23ba43,_0x43ce85){_0x43ce85=_0x43ce85||0x1f4;return function(_0x5d4817){logger[_0xa9c4('0x20')](_0x5d4817[_0xa9c4('0x31')]);if(_0x5d4817['name']){delete _0x5d4817[_0xa9c4('0x32')];}_0x23ba43[_0xa9c4('0x26')](_0x43ce85)[_0xa9c4('0x33')](_0x5d4817);};}exports['index']=function(_0x45639f,_0x37322f){var _0x3b4b3d={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xeb9273={},_0xbd760a={'count':0x0,'rows':[]};var _0x59220b=_[_0xa9c4('0x34')](db[_0xa9c4('0x35')]['rawAttributes'],function(_0x4057f1){return{'name':_0x4057f1[_0xa9c4('0x36')],'type':_0x4057f1[_0xa9c4('0x37')][_0xa9c4('0x38')]};});_0xeb9273[_0xa9c4('0x39')]=_[_0xa9c4('0x34')](_0x59220b,_0xa9c4('0x32'));_0xeb9273[_0xa9c4('0x3a')]=_['keys'](_0x45639f[_0xa9c4('0x3a')]);_0xeb9273[_0xa9c4('0x3b')]=_['intersection'](_0xeb9273['model'],_0xeb9273[_0xa9c4('0x3a')]);_0x3b4b3d[_0xa9c4('0x3c')]=_[_0xa9c4('0x3d')](_0xeb9273[_0xa9c4('0x39')],qs[_0xa9c4('0x3e')](_0x45639f['query'][_0xa9c4('0x3e')]));_0x3b4b3d[_0xa9c4('0x3c')]=_0x3b4b3d[_0xa9c4('0x3c')]['length']?_0x3b4b3d[_0xa9c4('0x3c')]:_0xeb9273['model'];if(!_0x45639f[_0xa9c4('0x3a')][_0xa9c4('0x3f')](_0xa9c4('0x40'))){_0x3b4b3d[_0xa9c4('0x2a')]=qs['limit'](_0x45639f[_0xa9c4('0x3a')][_0xa9c4('0x2a')]);_0x3b4b3d[_0xa9c4('0x29')]=qs[_0xa9c4('0x29')](_0x45639f['query'][_0xa9c4('0x29')]);}_0x3b4b3d[_0xa9c4('0x41')]=qs[_0xa9c4('0x42')](_0x45639f[_0xa9c4('0x3a')][_0xa9c4('0x42')]);_0x3b4b3d[_0xa9c4('0x43')]=qs[_0xa9c4('0x3b')](_[_0xa9c4('0x44')](_0x45639f[_0xa9c4('0x3a')],_0xeb9273[_0xa9c4('0x3b')]),_0x59220b);if(_0x45639f[_0xa9c4('0x3a')][_0xa9c4('0x45')]){_0x3b4b3d[_0xa9c4('0x43')]=_[_0xa9c4('0x46')](_0x3b4b3d[_0xa9c4('0x43')],{'$or':_[_0xa9c4('0x34')](_0x59220b,function(_0x281751){if(_0x281751[_0xa9c4('0x37')]!==_0xa9c4('0x47')){var _0x40038f={};_0x40038f[_0x281751[_0xa9c4('0x32')]]={'$like':'%'+_0x45639f[_0xa9c4('0x3a')][_0xa9c4('0x45')]+'%'};return _0x40038f;}})});}_0x3b4b3d=_[_0xa9c4('0x46')]({},_0x3b4b3d,_0x45639f[_0xa9c4('0x48')]);var _0x61b7cd={'where':_0x3b4b3d['where']};return db[_0xa9c4('0x35')][_0xa9c4('0x49')](_0x61b7cd)['then'](function(_0x360660){_0xbd760a[_0xa9c4('0x49')]=_0x360660;if(_0x45639f[_0xa9c4('0x3a')][_0xa9c4('0x4a')]){_0x3b4b3d['include']=[{'all':!![]}];}return db[_0xa9c4('0x35')]['findAll'](_0x3b4b3d);})['then'](function(_0x869ee4){_0xbd760a[_0xa9c4('0x4b')]=_0x869ee4;return _0xbd760a;})['then'](respondWithFilteredResult(_0x37322f,_0x3b4b3d))[_0xa9c4('0x24')](handleError(_0x37322f,null));};exports[_0xa9c4('0x4c')]=function(_0x47d958,_0x973578){var _0x7aa1d1={'raw':![],'where':{'id':_0x47d958[_0xa9c4('0x4d')]['id']},'include':[{'model':db[_0xa9c4('0x4e')],'as':'mandatoryDispositionPause'}]},_0x18af74={};_0x18af74[_0xa9c4('0x39')]=_['keys'](db['ChatWebsite'][_0xa9c4('0x4f')]);_0x18af74['query']=_[_0xa9c4('0x50')](_0x47d958['query']);_0x18af74[_0xa9c4('0x3b')]=_['intersection'](_0x18af74[_0xa9c4('0x39')],_0x18af74['query']);_0x7aa1d1['attributes']=_[_0xa9c4('0x3d')](_0x18af74[_0xa9c4('0x39')],qs[_0xa9c4('0x3e')](_0x47d958[_0xa9c4('0x3a')][_0xa9c4('0x3e')]));_0x7aa1d1[_0xa9c4('0x3c')]=_0x7aa1d1['attributes'][_0xa9c4('0x51')]?_0x7aa1d1[_0xa9c4('0x3c')]:_0x18af74['model'];if(_0x47d958[_0xa9c4('0x3a')]['includeAll']){_0x7aa1d1['include']=[{'all':!![]}];}_0x7aa1d1=_['merge']({},_0x7aa1d1,_0x47d958[_0xa9c4('0x48')]);return db[_0xa9c4('0x35')][_0xa9c4('0x52')](_0x7aa1d1)[_0xa9c4('0x1b')](handleEntityNotFound(_0x973578,null))[_0xa9c4('0x1b')](respondWithResult(_0x973578,null))[_0xa9c4('0x24')](handleError(_0x973578,null));};exports[_0xa9c4('0x53')]=function(_0xac2923,_0x57c15e){return db[_0xa9c4('0x35')][_0xa9c4('0x53')](_0xac2923[_0xa9c4('0x54')],{})[_0xa9c4('0x1b')](function(_0x90441b){var _0x30774f=_0xac2923['user'][_0xa9c4('0x55')]({'plain':!![]});if(!_0x30774f)throw new Error(_0xa9c4('0x56'));if(_0x30774f['role']===_0xa9c4('0x57')){var _0x5e8fdb=_0x90441b[_0xa9c4('0x55')]({'plain':!![]});var _0x421fff=_0xa9c4('0x30');return db['UserProfileSection'][_0xa9c4('0x52')]({'where':{'name':_0x421fff,'userProfileId':_0x30774f[_0xa9c4('0x58')]},'raw':!![]})[_0xa9c4('0x1b')](function(_0x48e375){if(_0x48e375&&_0x48e375['autoAssociation']===0x0){return db['UserProfileResource'][_0xa9c4('0x53')]({'name':_0x5e8fdb[_0xa9c4('0x32')],'resourceId':_0x5e8fdb['id'],'type':_0x48e375[_0xa9c4('0x32')],'sectionId':_0x48e375['id']},{})[_0xa9c4('0x1b')](function(){return _0x90441b;});}else{return _0x90441b;}})[_0xa9c4('0x24')](function(_0x4ed663){logger[_0xa9c4('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ed663);throw _0x4ed663;});}return _0x90441b;})[_0xa9c4('0x1b')](respondWithResult(_0x57c15e,0xc9))[_0xa9c4('0x24')](handleError(_0x57c15e,null));};exports[_0xa9c4('0x2f')]=function(_0x370c64,_0xbb08b7){if(_0x370c64[_0xa9c4('0x54')]['id']){delete _0x370c64[_0xa9c4('0x54')]['id'];}return db[_0xa9c4('0x35')]['find']({'where':{'id':_0x370c64[_0xa9c4('0x4d')]['id']},'include':[{'model':db[_0xa9c4('0x4e')],'as':_0xa9c4('0x59')}]})['then'](handleEntityNotFound(_0xbb08b7,null))[_0xa9c4('0x1b')](saveUpdates(_0x370c64[_0xa9c4('0x54')],null))['then'](respondWithResult(_0xbb08b7,null))[_0xa9c4('0x24')](handleError(_0xbb08b7,null));};exports[_0xa9c4('0x5a')]=function(_0x56145a,_0x3ad402){return db[_0xa9c4('0x35')][_0xa9c4('0x52')]({'where':{'id':_0x56145a['params']['id']}})[_0xa9c4('0x1b')](handleEntityNotFound(_0x3ad402,null))[_0xa9c4('0x1b')](removeEntity(_0x3ad402,null))[_0xa9c4('0x24')](handleError(_0x3ad402,null));};exports[_0xa9c4('0x5b')]=function(_0xc8de3d,_0x154bad){return db[_0xa9c4('0x35')][_0xa9c4('0x5b')]()[_0xa9c4('0x1b')](respondWithResult(_0x154bad,null))[_0xa9c4('0x24')](handleError(_0x154bad,null));};exports['addDisposition']=function(_0x14a9d8,_0x1bf07f,_0x341707){if(_0x14a9d8[_0xa9c4('0x54')]['id']){delete _0x14a9d8[_0xa9c4('0x54')]['id'];}return db[_0xa9c4('0x35')][_0xa9c4('0x52')]({'where':{'id':_0x14a9d8['params']['id']}})['then'](handleEntityNotFound(_0x1bf07f,null))[_0xa9c4('0x1b')](function(_0x338c4a){if(_0x338c4a){_0x14a9d8[_0xa9c4('0x54')][_0xa9c4('0x5c')]=_0x338c4a['id'];return db['Disposition'][_0xa9c4('0x53')](_0x14a9d8[_0xa9c4('0x54')]);}})['then'](respondWithResult(_0x1bf07f,null))[_0xa9c4('0x24')](handleError(_0x1bf07f,null));};exports[_0xa9c4('0x5d')]=function(_0x4e65c7,_0x23e132,_0x55d2eb){var _0x1aa91f={'raw':![],'where':{}};var _0x162953={};var _0x5af120={'count':0x0,'rows':[]};return db[_0xa9c4('0x35')][_0xa9c4('0x5e')]({'where':{'id':_0x4e65c7['params']['id']}})[_0xa9c4('0x1b')](handleEntityNotFound(_0x23e132,null))['then'](function(_0x2fc76c){if(_0x2fc76c){_0x162953[_0xa9c4('0x39')]=_[_0xa9c4('0x50')](db['Disposition'][_0xa9c4('0x4f')]);_0x162953[_0xa9c4('0x3a')]=_[_0xa9c4('0x50')](_0x4e65c7[_0xa9c4('0x3a')]);_0x162953[_0xa9c4('0x3b')]=_[_0xa9c4('0x3d')](_0x162953[_0xa9c4('0x39')],_0x162953[_0xa9c4('0x3a')]);_0x1aa91f[_0xa9c4('0x3c')]=_[_0xa9c4('0x3d')](_0x162953[_0xa9c4('0x39')],qs['fields'](_0x4e65c7[_0xa9c4('0x3a')][_0xa9c4('0x3e')]));_0x1aa91f[_0xa9c4('0x3c')]=_0x1aa91f['attributes']['length']?_0x1aa91f[_0xa9c4('0x3c')]:_0x162953[_0xa9c4('0x39')];if(!_0x4e65c7[_0xa9c4('0x3a')][_0xa9c4('0x3f')](_0xa9c4('0x40'))){_0x1aa91f[_0xa9c4('0x2a')]=qs['limit'](_0x4e65c7[_0xa9c4('0x3a')][_0xa9c4('0x2a')]);_0x1aa91f[_0xa9c4('0x29')]=qs[_0xa9c4('0x29')](_0x4e65c7[_0xa9c4('0x3a')][_0xa9c4('0x29')]);}_0x1aa91f['order']=qs[_0xa9c4('0x42')](_0x4e65c7['query'][_0xa9c4('0x42')]);_0x1aa91f['where']=qs[_0xa9c4('0x3b')](_[_0xa9c4('0x44')](_0x4e65c7[_0xa9c4('0x3a')],_0x162953[_0xa9c4('0x3b')]));_0x1aa91f[_0xa9c4('0x43')][_0xa9c4('0x5c')]=_0x2fc76c['id'];if(_0x4e65c7['query']['filter']){_0x1aa91f[_0xa9c4('0x43')]=_[_0xa9c4('0x46')](_0x1aa91f[_0xa9c4('0x43')],{'$or':_[_0xa9c4('0x34')](_0x1aa91f[_0xa9c4('0x3c')],function(_0x495a6c){var _0x52a3c5={};_0x52a3c5[_0x495a6c]={'$like':'%'+_0x4e65c7[_0xa9c4('0x3a')]['filter']+'%'};return _0x52a3c5;})});}_0x1aa91f=_[_0xa9c4('0x46')]({},_0x1aa91f,_0x4e65c7[_0xa9c4('0x48')]);return db[_0xa9c4('0x5f')]['count']({'where':_0x1aa91f[_0xa9c4('0x43')]})['then'](function(_0x17f04e){_0x5af120[_0xa9c4('0x49')]=_0x17f04e;if(_0x4e65c7[_0xa9c4('0x3a')]['includeAll']){_0x1aa91f[_0xa9c4('0x60')]=[{'all':!![]}];}return db[_0xa9c4('0x5f')][_0xa9c4('0x61')](_0x1aa91f);})['then'](function(_0x47cee7){_0x5af120['rows']=_0x47cee7;return _0x5af120;});}})['then'](respondWithFilteredResult(_0x23e132,_0x1aa91f))[_0xa9c4('0x24')](handleError(_0x23e132,null));};exports[_0xa9c4('0x62')]=function(_0x2ee067,_0x633e05,_0x15cfc2){return db[_0xa9c4('0x35')][_0xa9c4('0x52')]({'where':{'id':_0x2ee067[_0xa9c4('0x4d')]['id']}})[_0xa9c4('0x1b')](handleEntityNotFound(_0x633e05,null))['then'](function(_0x3cdc9c){if(_0x3cdc9c){return _0x3cdc9c['removeDispositions'](_0x2ee067[_0xa9c4('0x3a')][_0xa9c4('0x63')]);}})[_0xa9c4('0x1b')](respondWithStatusCode(_0x633e05,null))[_0xa9c4('0x24')](handleError(_0x633e05,null));};exports[_0xa9c4('0x64')]=function(_0xb2449d,_0x12b009,_0x5a290f){if(_0xb2449d['body']['id']){delete _0xb2449d[_0xa9c4('0x54')]['id'];}return db[_0xa9c4('0x35')][_0xa9c4('0x52')]({'where':{'id':_0xb2449d[_0xa9c4('0x4d')]['id']}})[_0xa9c4('0x1b')](handleEntityNotFound(_0x12b009,null))[_0xa9c4('0x1b')](function(_0x317e07){if(_0x317e07){_0xb2449d[_0xa9c4('0x54')]['ChatWebsiteId']=_0x317e07['id'];return db[_0xa9c4('0x65')][_0xa9c4('0x53')](_0xb2449d[_0xa9c4('0x54')]);}})['then'](respondWithResult(_0x12b009,null))[_0xa9c4('0x24')](handleError(_0x12b009,null));};exports[_0xa9c4('0x66')]=function(_0x47fff8,_0x51c1c7,_0x2404f0){var _0x193b90={'raw':![],'where':{}};var _0x55c4ce={};var _0x28a730={'count':0x0,'rows':[]};return db[_0xa9c4('0x35')]['findOne']({'where':{'id':_0x47fff8[_0xa9c4('0x4d')]['id']}})[_0xa9c4('0x1b')](handleEntityNotFound(_0x51c1c7,null))[_0xa9c4('0x1b')](function(_0x13ab32){if(_0x13ab32){_0x55c4ce[_0xa9c4('0x39')]=_[_0xa9c4('0x50')](db[_0xa9c4('0x65')][_0xa9c4('0x4f')]);_0x55c4ce['query']=_['keys'](_0x47fff8[_0xa9c4('0x3a')]);_0x55c4ce[_0xa9c4('0x3b')]=_[_0xa9c4('0x3d')](_0x55c4ce['model'],_0x55c4ce[_0xa9c4('0x3a')]);_0x193b90[_0xa9c4('0x3c')]=_[_0xa9c4('0x3d')](_0x55c4ce[_0xa9c4('0x39')],qs[_0xa9c4('0x3e')](_0x47fff8['query'][_0xa9c4('0x3e')]));_0x193b90[_0xa9c4('0x3c')]=_0x193b90['attributes'][_0xa9c4('0x51')]?_0x193b90[_0xa9c4('0x3c')]:_0x55c4ce['model'];if(!_0x47fff8['query'][_0xa9c4('0x3f')](_0xa9c4('0x40'))){_0x193b90[_0xa9c4('0x2a')]=qs[_0xa9c4('0x2a')](_0x47fff8[_0xa9c4('0x3a')]['limit']);_0x193b90[_0xa9c4('0x29')]=qs[_0xa9c4('0x29')](_0x47fff8[_0xa9c4('0x3a')]['offset']);}_0x193b90[_0xa9c4('0x41')]=qs[_0xa9c4('0x42')](_0x47fff8[_0xa9c4('0x3a')]['sort']);_0x193b90[_0xa9c4('0x43')]=qs[_0xa9c4('0x3b')](_[_0xa9c4('0x44')](_0x47fff8[_0xa9c4('0x3a')],_0x55c4ce[_0xa9c4('0x3b')]));_0x193b90[_0xa9c4('0x43')][_0xa9c4('0x5c')]=_0x13ab32['id'];if(_0x47fff8['query'][_0xa9c4('0x45')]){_0x193b90[_0xa9c4('0x43')]=_['merge'](_0x193b90['where'],{'$or':_[_0xa9c4('0x34')](_0x193b90['attributes'],function(_0x4f22bc){var _0x30e4f3={};_0x30e4f3[_0x4f22bc]={'$like':'%'+_0x47fff8[_0xa9c4('0x3a')][_0xa9c4('0x45')]+'%'};return _0x30e4f3;})});}_0x193b90=_[_0xa9c4('0x46')]({},_0x193b90,_0x47fff8[_0xa9c4('0x48')]);return db[_0xa9c4('0x65')][_0xa9c4('0x49')]({'where':_0x193b90[_0xa9c4('0x43')]})['then'](function(_0x25610c){_0x28a730[_0xa9c4('0x49')]=_0x25610c;if(_0x47fff8[_0xa9c4('0x3a')][_0xa9c4('0x4a')]){_0x193b90[_0xa9c4('0x60')]=[{'all':!![]}];}return db[_0xa9c4('0x65')][_0xa9c4('0x61')](_0x193b90);})[_0xa9c4('0x1b')](function(_0x408fdc){_0x28a730[_0xa9c4('0x4b')]=_0x408fdc;return _0x28a730;});}})['then'](respondWithFilteredResult(_0x51c1c7,_0x193b90))[_0xa9c4('0x24')](handleError(_0x51c1c7,null));};exports['removeAnswers']=function(_0x2d945a,_0x2501f9,_0x45b96e){return db[_0xa9c4('0x35')][_0xa9c4('0x52')]({'where':{'id':_0x2d945a[_0xa9c4('0x4d')]['id']}})[_0xa9c4('0x1b')](handleEntityNotFound(_0x2501f9,null))[_0xa9c4('0x1b')](function(_0x38ea0a){if(_0x38ea0a){return _0x38ea0a[_0xa9c4('0x67')](_0x2d945a[_0xa9c4('0x3a')]['ids']);}})[_0xa9c4('0x1b')](respondWithStatusCode(_0x2501f9,null))[_0xa9c4('0x24')](handleError(_0x2501f9,null));};exports[_0xa9c4('0x68')]=function(_0x3f3092,_0x3908c6,_0x599644){_0x3f3092[_0xa9c4('0x54')][_0xa9c4('0x69')]=_0x3f3092[_0xa9c4('0x6a')][_0xa9c4('0x6b')];return db['ChatWebsite'][_0xa9c4('0x52')]({'where':{'id':_0x3f3092[_0xa9c4('0x4d')]['id']}})[_0xa9c4('0x1b')](handleEntityNotFound(_0x3908c6,null))['then'](saveUpdates(_0x3f3092[_0xa9c4('0x54')],null))[_0xa9c4('0x1b')](respondWithResult(_0x3908c6,null))[_0xa9c4('0x24')](handleError(_0x3908c6,null));};exports[_0xa9c4('0x6c')]=function(_0x3dae6b,_0x3ac63b,_0x1accdf){_0x3dae6b[_0xa9c4('0x54')][_0xa9c4('0x6d')]=_0x3dae6b[_0xa9c4('0x6a')][_0xa9c4('0x6b')];return db[_0xa9c4('0x35')]['find']({'where':{'id':_0x3dae6b['params']['id']}})['then'](handleEntityNotFound(_0x3ac63b,null))[_0xa9c4('0x1b')](saveUpdates(_0x3dae6b[_0xa9c4('0x54')],null))[_0xa9c4('0x1b')](respondWithResult(_0x3ac63b,null))[_0xa9c4('0x24')](handleError(_0x3ac63b,null));};exports[_0xa9c4('0x6e')]=function(_0x343b4e,_0x3c664f,_0x394a71){_0x343b4e[_0xa9c4('0x54')]['customerAvatar']=_0x343b4e['file'][_0xa9c4('0x6b')];return db[_0xa9c4('0x35')][_0xa9c4('0x52')]({'where':{'id':_0x343b4e[_0xa9c4('0x4d')]['id']}})[_0xa9c4('0x1b')](handleEntityNotFound(_0x3c664f,null))[_0xa9c4('0x1b')](saveUpdates(_0x343b4e[_0xa9c4('0x54')],null))[_0xa9c4('0x1b')](respondWithResult(_0x3c664f,null))[_0xa9c4('0x24')](handleError(_0x3c664f,null));};exports[_0xa9c4('0x6f')]=function(_0x599a49,_0x4ea9d3,_0x2fd338){_0x599a49[_0xa9c4('0x54')][_0xa9c4('0x70')]=_0x599a49[_0xa9c4('0x6a')][_0xa9c4('0x6b')];return db[_0xa9c4('0x35')]['find']({'where':{'id':_0x599a49['params']['id']}})['then'](handleEntityNotFound(_0x4ea9d3,null))[_0xa9c4('0x1b')](saveUpdates(_0x599a49[_0xa9c4('0x54')],null))[_0xa9c4('0x1b')](respondWithResult(_0x4ea9d3,null))[_0xa9c4('0x24')](handleError(_0x4ea9d3,null));};exports[_0xa9c4('0x71')]=function(_0x466b9c,_0x21e06f,_0x221b14){var _0x2578c9=path[_0xa9c4('0x72')](config[_0xa9c4('0x73')],_0xa9c4('0x74'));var _0x5dfd07={'where':{'id':_0x466b9c[_0xa9c4('0x4d')]['id']},'attributes':['id',_0xa9c4('0x69')],'raw':!![]};var _0x3b87bb=![];return require('../../config/license/util')['getLicense']()[_0xa9c4('0x1b')](function(_0x35f749){if(_0x35f749){_0x3b87bb=_0x35f749['custom'];}})['then'](function(){return db[_0xa9c4('0x35')][_0xa9c4('0x52')](_0x5dfd07);})['then'](handleEntityNotFound(_0x21e06f,null))['then'](function(_0x4edc03){if(_0x4edc03){if(!_[_0xa9c4('0x75')](_0x4edc03[_0xa9c4('0x69')])){if(fs['existsSync'](path['join'](config[_0xa9c4('0x73')],_0xa9c4('0x76'),_0x4edc03[_0xa9c4('0x69')]))&&_0x3b87bb){_0x2578c9=path[_0xa9c4('0x72')](config['root'],_0xa9c4('0x76'),_0x4edc03['sitepic']);}}return _0x21e06f[_0xa9c4('0x77')](_0x2578c9);}})[_0xa9c4('0x24')](handleError(_0x21e06f,null));};exports[_0xa9c4('0x78')]=function(_0x4ff2e2,_0x17a63c,_0x53da44){var _0x58f6c7=path['join'](config[_0xa9c4('0x73')],_0xa9c4('0x79'));var _0x228128={'where':{'id':_0x4ff2e2[_0xa9c4('0x4d')]['id']},'attributes':['id',_0xa9c4('0x6d')],'raw':!![]};return db[_0xa9c4('0x35')][_0xa9c4('0x52')](_0x228128)[_0xa9c4('0x1b')](handleEntityNotFound(_0x17a63c,null))['then'](function(_0x560fa2){if(_0x560fa2){if(!_[_0xa9c4('0x75')](_0x560fa2[_0xa9c4('0x6d')])){if(fs[_0xa9c4('0x7a')](path['join'](config[_0xa9c4('0x73')],_0xa9c4('0x7b'),_0x560fa2['agentAvatar']))){_0x58f6c7=path[_0xa9c4('0x72')](config[_0xa9c4('0x73')],_0xa9c4('0x7b'),_0x560fa2[_0xa9c4('0x6d')]);}}return _0x17a63c[_0xa9c4('0x77')](_0x58f6c7);}})[_0xa9c4('0x24')](handleError(_0x17a63c,null));};exports[_0xa9c4('0x7c')]=function(_0x3b9f90,_0x3ab5bc,_0x52e481){var _0x4c20c6=path[_0xa9c4('0x72')](config[_0xa9c4('0x73')],_0xa9c4('0x7d'));var _0x15632d={'where':{'id':_0x3b9f90[_0xa9c4('0x4d')]['id']},'attributes':['id',_0xa9c4('0x7e'),_0xa9c4('0x7f')],'raw':!![]};return db[_0xa9c4('0x35')][_0xa9c4('0x52')](_0x15632d)[_0xa9c4('0x1b')](handleEntityNotFound(_0x3ab5bc,null))[_0xa9c4('0x1b')](function(_0x40e23b){if(_0x40e23b){if(!_['isNil'](_0x40e23b[_0xa9c4('0x7e')])){if(fs[_0xa9c4('0x7a')](path[_0xa9c4('0x72')](config[_0xa9c4('0x73')],_0xa9c4('0x7b'),_0x40e23b[_0xa9c4('0x7e')]))&&_0x40e23b['showCustomerAvatar']){_0x4c20c6=path['join'](config['root'],_0xa9c4('0x7b'),_0x40e23b[_0xa9c4('0x7e')]);}}return _0x3ab5bc['download'](_0x4c20c6);}})['catch'](handleError(_0x3ab5bc,null));};exports[_0xa9c4('0x80')]=function(_0x15d195,_0x4e5980,_0x411bb5){var _0x1622c3=path[_0xa9c4('0x72')](config[_0xa9c4('0x73')],_0xa9c4('0x81'));var _0x51b553={'where':{'id':_0x15d195['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xa9c4('0x35')]['find'](_0x51b553)['then'](handleEntityNotFound(_0x4e5980,null))['then'](function(_0x3ea959){if(_0x3ea959){if(!_['isNil'](_0x3ea959['systemAvatar'])){if(fs[_0xa9c4('0x7a')](path[_0xa9c4('0x72')](config['root'],_0xa9c4('0x7b'),_0x3ea959[_0xa9c4('0x70')]))){_0x1622c3=path[_0xa9c4('0x72')](config['root'],_0xa9c4('0x7b'),_0x3ea959[_0xa9c4('0x70')]);}}return _0x4e5980[_0xa9c4('0x77')](_0x1622c3);}})[_0xa9c4('0x24')](handleError(_0x4e5980,null));};exports[_0xa9c4('0x82')]=function(_0x359a9d,_0xe680f,_0x5104d2){var _0x1884bd=require(_0xa9c4('0x83'));var _0x24c9fd=new _0x1884bd();var _0xf1268=_0x24c9fd[_0xa9c4('0x84')](_0x359a9d[_0xa9c4('0x85')]['user-agent'])['getResult']();var _0x500886={'body':_0x359a9d[_0xa9c4('0x54')],'channel':'chat'};var _0x1f39b1=[];var _0x50a7a7=[];var _0x4ef0e9={};var _0x169b41=![];return db[_0xa9c4('0x86')]['describe']()[_0xa9c4('0x1b')](function(_0x3507fa){if(!_0x3507fa){throw new db[(_0xa9c4('0x87'))][(_0xa9c4('0x88'))]('no\x20available\x20attributes');}_0x1f39b1=_[_0xa9c4('0x89')](_[_0xa9c4('0x50')](_0x3507fa),[_0xa9c4('0x8a'),_0xa9c4('0x8b')]);_0x50a7a7=_[_0xa9c4('0x89')](_[_0xa9c4('0x50')](_0x3507fa),['createdAt',_0xa9c4('0x8b'),_0xa9c4('0x8c'),_0xa9c4('0x8d')]);if(_0x359a9d[_0xa9c4('0x54')]['id']){delete _0x359a9d['body']['id'];}if(_[_0xa9c4('0x75')](_0x359a9d[_0xa9c4('0x54')][_0xa9c4('0x8e')])){throw new db['Sequelize'][(_0xa9c4('0x88'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x359a9d['body']['body'])||_0x359a9d[_0xa9c4('0x54')][_0xa9c4('0x54')]===''){throw new db['Sequelize'][(_0xa9c4('0x88'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa9c4('0x75')](_0x359a9d[_0xa9c4('0x54')][_0xa9c4('0x8f')])){throw new db[(_0xa9c4('0x87'))][(_0xa9c4('0x88'))](_0xa9c4('0x90')+_0x50a7a7);}if(!_[_0xa9c4('0x91')](_0x50a7a7,_0x359a9d[_0xa9c4('0x54')][_0xa9c4('0x8f')])){throw new db['Sequelize']['ValidationError'](_0xa9c4('0x92')+_0x50a7a7);}_0x4ef0e9[_0x359a9d['body']['mapKey']]=_0x359a9d['body'][_0xa9c4('0x8e')];})[_0xa9c4('0x1b')](function(){return db[_0xa9c4('0x35')][_0xa9c4('0x52')]({'where':{'id':_0x359a9d[_0xa9c4('0x4d')]['id']},'include':[{'model':db[_0xa9c4('0x93')],'as':_0xa9c4('0x94'),'include':[{'model':db[_0xa9c4('0x86')],'as':_0xa9c4('0x95'),'where':_0x4ef0e9,'limit':0x1,'order':[[_0xa9c4('0x8b'),_0xa9c4('0x96')]]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})['then'](handleEntityNotFound(_0xe680f,null))[_0xa9c4('0x1b')](function(_0x4f7309){if(_0x4f7309&&_0x4f7309['List']){_0x500886[_0xa9c4('0x97')]=_0x4f7309;_0x500886[_0xa9c4('0x98')]=_0x4f7309[_0xa9c4('0x99')];_0x500886['list']=_0x4f7309['List'];_0x500886[_0xa9c4('0x98')]=_[_0xa9c4('0x9a')](_0x500886[_0xa9c4('0x98')],[_0xa9c4('0x9b')],[_0xa9c4('0x9c')]);if(_0x500886['account'][_0xa9c4('0x99')]){delete _0x500886[_0xa9c4('0x97')][_0xa9c4('0x99')];}if(_0x500886[_0xa9c4('0x97')]['List']&&_0x500886['account']['List'][_0xa9c4('0x95')][_0xa9c4('0x51')]){return _0x500886[_0xa9c4('0x97')][_0xa9c4('0x94')][_0xa9c4('0x95')][0x0];}var _0x2eeeae=_[_0xa9c4('0x9d')](_0x359a9d[_0xa9c4('0x54')],{'firstName':_0x359a9d[_0xa9c4('0x54')][_0xa9c4('0x8e')],'ListId':_0x4f7309[_0xa9c4('0x8d')]});_0x2eeeae[_0x359a9d[_0xa9c4('0x54')][_0xa9c4('0x8f')]]=_0x359a9d[_0xa9c4('0x54')][_0xa9c4('0x8e')];return db[_0xa9c4('0x86')][_0xa9c4('0x53')](_0x2eeeae,{'fields':_0x1f39b1,'raw':!![]});}})['then'](handleEntityNotFound(_0xe680f,null))[_0xa9c4('0x1b')](function(_0x41ad02){_0x500886[_0xa9c4('0x9e')]=_0x41ad02;var _0xdff114=_0x359a9d[_0xa9c4('0x54')][_0xa9c4('0x9f')];if(_0x359a9d['headers'][_0xa9c4('0xa0')]){_0xdff114=_0x359a9d['headers'][_0xa9c4('0xa0')];}else if(_0x359a9d[_0xa9c4('0x85')][_0xa9c4('0xa1')]){_0xdff114=_['first'](_0x359a9d[_0xa9c4('0x85')][_0xa9c4('0xa1')][_0xa9c4('0xa2')](','));}if(_0x41ad02){var _0x5e2c1f={'ContactId':_0x41ad02['id'],'ChatWebsiteId':_0x359a9d[_0xa9c4('0x4d')]['id'],'from':(_0x41ad02['firstName']||'')+'\x20'+(_0x41ad02['lastName']||''),'customerIp':_0xdff114,'customerPort':_0x359a9d[_0xa9c4('0x85')]['x-real-port']?_0x359a9d[_0xa9c4('0x85')]['x-real-port']:null,'referer':_0x359a9d[_0xa9c4('0x54')][_0xa9c4('0xa3')],'browserName':_0xf1268['browser']['name']&&_0xf1268[_0xa9c4('0xa4')][_0xa9c4('0xa5')]?util[_0xa9c4('0xa6')](_0xa9c4('0xa7'),_0xf1268[_0xa9c4('0xa4')][_0xa9c4('0x32')],_0xf1268[_0xa9c4('0xa4')]['version']):'unknown','browserVersion':_0xf1268[_0xa9c4('0xa4')][_0xa9c4('0xa5')]||'unknown','osName':util[_0xa9c4('0xa6')](_0xa9c4('0xa7'),_0xf1268['os']['name'],_0xf1268['os']['version']),'osVersion':_0xf1268['os'][_0xa9c4('0xa5')],'deviceModel':_0xf1268[_0xa9c4('0xa8')][_0xa9c4('0x39')]&&_0xf1268['device'][_0xa9c4('0xa9')]?util[_0xa9c4('0xa6')]('%s\x20%s\x20%s',_0xf1268[_0xa9c4('0xa8')]['model'],_0xf1268[_0xa9c4('0xa8')][_0xa9c4('0xa9')],_0xf1268['device'][_0xa9c4('0x37')]):null,'deviceVendor':_0xf1268[_0xa9c4('0xa8')][_0xa9c4('0xa9')],'deviceType':_0xf1268['device']['type'],'formData':JSON['stringify'](_0x359a9d[_0xa9c4('0x54')])};var _0x1fc753={'ChatWebsiteId':_0x359a9d[_0xa9c4('0x4d')]['id'],'closed':![]};if(_0x359a9d[_0xa9c4('0x54')][_0xa9c4('0xaa')]){_0x1fc753['threadId']=_0x359a9d[_0xa9c4('0x54')][_0xa9c4('0xaa')];return db[_0xa9c4('0xab')][_0xa9c4('0x52')]({'where':_0x1fc753})[_0xa9c4('0x1b')](function(_0x1e680f){if(_0x1e680f){return[_0x1e680f,![]];}_0x5e2c1f[_0xa9c4('0xaa')]=_0x359a9d['body'][_0xa9c4('0xaa')];_0x5e2c1f[_0xa9c4('0xac')]=_0x359a9d['body'][_0xa9c4('0xac')];return db['ChatInteraction'][_0xa9c4('0x53')](_0x5e2c1f)[_0xa9c4('0x1b')](function(_0x402f51){return[_0x402f51,!![]];});});}_0x1fc753[_0xa9c4('0xad')]=_0x41ad02['id'];if(_0x359a9d['body'][_0xa9c4('0xae')]&&_0x359a9d[_0xa9c4('0x54')]['interaction']['id']){_0x1fc753['id']=_0x359a9d[_0xa9c4('0x54')]['interaction']['id'];return db[_0xa9c4('0xab')][_0xa9c4('0x52')]({'where':_0x1fc753})[_0xa9c4('0x1b')](function(_0x5cf0ec){if(_0x5cf0ec){return[_0x5cf0ec,![]];}return db[_0xa9c4('0xab')][_0xa9c4('0x53')](_0x5e2c1f)[_0xa9c4('0x1b')](function(_0x42b62e){return[_0x42b62e,!![]];});});}return db[_0xa9c4('0xab')][_0xa9c4('0x53')](_0x5e2c1f)[_0xa9c4('0x1b')](function(_0x3178e3){return[_0x3178e3,!![]];});}})[_0xa9c4('0xaf')](function(_0x3b929d,_0x2e3279){if(_0x3b929d){_0x169b41=_0x2e3279;if(!_0x2e3279){var _0x249887={'from':(_0x500886[_0xa9c4('0x9e')][_0xa9c4('0xb0')]||'')+'\x20'+(_0x500886['contact'][_0xa9c4('0xb1')]||'')};if(_0x359a9d[_0xa9c4('0x54')][_0xa9c4('0xaa')]&&_0x359a9d[_0xa9c4('0x54')][_0xa9c4('0xb2')]&&_0x359a9d[_0xa9c4('0x54')][_0xa9c4('0xaa')]!=_0x359a9d[_0xa9c4('0x54')][_0xa9c4('0xb2')]){_0x249887[_0xa9c4('0xaa')]=_0x359a9d[_0xa9c4('0x54')][_0xa9c4('0xb2')];}return _0x3b929d[_0xa9c4('0x2f')](_0x249887);}else{return _0x3b929d;}}})[_0xa9c4('0x1b')](function(_0x49924e){_0x500886[_0xa9c4('0xae')]=_0x49924e[_0xa9c4('0x55')]({'plain':!![]});_0x500886['interaction'][_0xa9c4('0xb3')]=_0x169b41;if(_0x500886[_0xa9c4('0xae')]['created']){if(_0x500886[_0xa9c4('0x97')]['autoclose']){_0x500886[_0xa9c4('0x98')][_0xa9c4('0xb4')]({'id':0x0,'priority':_0x500886[_0xa9c4('0x98')][_0xa9c4('0x51')]+0x1,'app':_0xa9c4('0xb5'),'appdata':_0xa9c4('0xb6'),'interval':_0xa9c4('0xb7')});}}return db[_0xa9c4('0xb8')]['create']({'body':_0x359a9d['body'][_0xa9c4('0x54')],'ChatWebsiteId':_0x359a9d[_0xa9c4('0x4d')]['id'],'ChatInteractionId':_0x49924e['id'],'direction':'in','ContactId':_0x500886[_0xa9c4('0x9e')]['id'],'AttachmentId':_0x359a9d[_0xa9c4('0x54')][_0xa9c4('0xb9')]});})[_0xa9c4('0x1b')](function(_0x56f0e0){_0x500886[_0xa9c4('0x22')]=_0x56f0e0;if(_0x500886[_0xa9c4('0xae')][_0xa9c4('0xba')]){return db['User'][_0xa9c4('0x52')]({'attributes':['id','name'],'where':{'id':_0x500886[_0xa9c4('0xae')]['UserId']}})[_0xa9c4('0x1b')](function(_0x508f4a){if(_0x508f4a){_0x500886['applications'][_0xa9c4('0xbb')]({'id':0x0,'priority':0x0,'app':_0xa9c4('0xbc'),'appdata':_0x508f4a[_0xa9c4('0x32')]+','+(_0x500886[_0xa9c4('0x97')][_0xa9c4('0xbd')]||0xa),'interval':_0xa9c4('0xb7')});_0x500886['forcedOwnership']=!![];}return respondWithRpcPromise('Start','startRouting',_0x500886);});}return respondWithRpcPromise('Start',_0xa9c4('0xbe'),_0x500886);})[_0xa9c4('0x1b')](function(_0x4e7be){respondWithRpcPromise('EventManager',_0xa9c4('0xbf'),{'event':_0xa9c4('0x82'),'message':_0x4e7be},client9002);return _0x4e7be;})[_0xa9c4('0x1b')](respondWithResult(_0xe680f,null))[_0xa9c4('0x24')](handleError(_0xe680f,null));};exports['offline']=function(_0x3ad40d,_0x199db3,_0xa9ec1f){var _0x505724,_0x9c226c,_0x412d43;var _0x303102=[];var _0x2693a7=[];var _0x93534a={};return db['CmContact'][_0xa9c4('0x5b')]()[_0xa9c4('0x1b')](function(_0x2eb9ee){if(!_0x2eb9ee){throw new db['Sequelize'][(_0xa9c4('0x88'))](_0xa9c4('0xc0'));}_0x2693a7=_['difference'](_['keys'](_0x2eb9ee),[_0xa9c4('0x8a'),_0xa9c4('0x8b')]);_0x303102=_[_0xa9c4('0x89')](_['keys'](_0x2eb9ee),[_0xa9c4('0x8a'),_0xa9c4('0x8b'),_0xa9c4('0x8c'),_0xa9c4('0x8d')]);if(_0x3ad40d['body']['id']){delete _0x3ad40d[_0xa9c4('0x54')]['id'];}if(_[_0xa9c4('0x75')](_0x3ad40d['body']['from'])){throw _0x199db3[_0xa9c4('0x26')](0x1f4)[_0xa9c4('0x33')](new db[(_0xa9c4('0x87'))]['ValidationError'](_0xa9c4('0xc1')));}if(_['isNil'](_0x3ad40d[_0xa9c4('0x54')][_0xa9c4('0x54')])||_0x3ad40d[_0xa9c4('0x54')][_0xa9c4('0x54')]===''){throw _0x199db3['status'](0x1f4)[_0xa9c4('0x33')](new db[(_0xa9c4('0x87'))][(_0xa9c4('0x88'))](_0xa9c4('0xc2')));}if(_[_0xa9c4('0x75')](_0x3ad40d[_0xa9c4('0x54')][_0xa9c4('0xc3')])){throw _0x199db3[_0xa9c4('0x26')](0x1f4)['send'](new db[(_0xa9c4('0x87'))]['ValidationError']('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x303102));}if(!_[_0xa9c4('0x91')](_0x303102,_0x3ad40d[_0xa9c4('0x54')][_0xa9c4('0xc3')])){throw _0x199db3['status'](0x1f4)['send'](new db[(_0xa9c4('0x87'))][(_0xa9c4('0x88'))](_0xa9c4('0xc4')+_0x303102));}_0x93534a[_0x3ad40d['body']['mapKeyOffline']]=_0x3ad40d[_0xa9c4('0x54')][_0xa9c4('0x8e')];})[_0xa9c4('0x1b')](function(){return db[_0xa9c4('0x35')][_0xa9c4('0x52')]({'where':{'id':_0x3ad40d[_0xa9c4('0x4d')]['id']},'include':[{'model':db[_0xa9c4('0x93')],'as':_0xa9c4('0x94')}]});})[_0xa9c4('0x1b')](handleEntityNotFound(_0x199db3,null))[_0xa9c4('0x1b')](function(_0x3c9d57){if(_0x3c9d57&&_0x3c9d57[_0xa9c4('0x94')]){_0x9c226c=_0x3c9d57;var _0x5c7587=_['defaults'](_0x3ad40d[_0xa9c4('0x54')],{'firstName':_0x3ad40d[_0xa9c4('0x54')][_0xa9c4('0x8e')],'phone':_0x3ad40d['body'][_0xa9c4('0x8e')],'ListId':_0x3c9d57[_0xa9c4('0x8d')]});_0x5c7587[_0x3ad40d['body'][_0xa9c4('0xc3')]]=_0x3ad40d[_0xa9c4('0x54')][_0xa9c4('0x8e')];return db[_0xa9c4('0x86')][_0xa9c4('0xc5')]({'where':_0x93534a,'defaults':_0x5c7587});}})['spread'](function(_0xab6890){if(_0xab6890){_0x412d43=_0xab6890;var _0x370065=fs['readFileSync'](path[_0xa9c4('0x72')](config['root'],'server/files/templates/chatOfflineMessage.ejs'),_0xa9c4('0xc6'));var _0x138fe0=ejs[_0xa9c4('0xc7')](_0x370065,{'body':_[_0xa9c4('0xc8')](_0x3ad40d[_0xa9c4('0x54')][_0xa9c4('0x54')]),'bodyTitle':_0x9c226c[_0xa9c4('0xc9')]});return db[_0xa9c4('0xca')][_0xa9c4('0x53')]({'body':_0x138fe0,'ContactId':_0xab6890['id'],'ChatWebsiteId':_0x9c226c['id']});}})['then'](function(_0x4eac8d){if(_0x4eac8d){_0x505724=_0x4eac8d;return db[_0xa9c4('0xcb')][_0xa9c4('0x5e')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xa9c4('0xcc'),'raw':!![]}]});}})[_0xa9c4('0x1b')](function(_0x411de6){if(_0x411de6&&_0x411de6[_0xa9c4('0xcc')]&&_0x9c226c[_0xa9c4('0xcd')]){var _0x47531e={'tls':{'rejectUnauthorized':![]}};if(_0x411de6['Smtp'][_0xa9c4('0xce')]){_0x47531e[_0xa9c4('0xce')]=_0x411de6[_0xa9c4('0xcc')][_0xa9c4('0xce')];}else{_0x47531e[_0xa9c4('0xcf')]=_0x411de6[_0xa9c4('0xcc')][_0xa9c4('0xcf')];_0x47531e['port']=_0x411de6[_0xa9c4('0xcc')][_0xa9c4('0xd0')];_0x47531e['secure']=_0x411de6[_0xa9c4('0xcc')]['secure'];}if(_0x411de6[_0xa9c4('0xcc')][_0xa9c4('0xd1')]){_0x47531e['auth']={'user':_0x411de6[_0xa9c4('0xcc')]['user'],'pass':_0x411de6['Smtp'][_0xa9c4('0xd2')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x47531e,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x411de6[_0xa9c4('0x32')],_0x411de6['email']||_0x411de6['Smtp'][_0xa9c4('0x57')]),'to':_0x9c226c[_0xa9c4('0xcd')],'subject':_0x9c226c[_0xa9c4('0xd3')],'text':_0x505724['body']}},client9003)['then'](function(){return _0x505724;})[_0xa9c4('0x24')](function(_0x5aff50){console[_0xa9c4('0x20')](_0x5aff50);});}})[_0xa9c4('0x1b')](function(){if(_0x505724){return _0x505724;}})[_0xa9c4('0x1b')](respondWithResult(_0x199db3,null))['catch'](handleError(_0x199db3,null));};exports['addInteraction']=function(_0x1711ed,_0x5639a7,_0x5d0793){return db[_0xa9c4('0xab')][_0xa9c4('0x52')]({'where':{'id':_0x1711ed['params']['id']}})[_0xa9c4('0x1b')](handleEntityNotFound(_0x5639a7,null))[_0xa9c4('0x1b')](function(_0x4f0a44){if(_0x4f0a44){return _0x4f0a44[_0xa9c4('0xd4')](_0x1711ed[_0xa9c4('0x54')][_0xa9c4('0x63')],_[_0xa9c4('0xd5')](_0x1711ed[_0xa9c4('0x54')],[_0xa9c4('0x63'),'id'])||{});}})[_0xa9c4('0x1b')](respondWithResult(_0x5639a7,null))[_0xa9c4('0x24')](handleError(_0x5639a7,null));};exports[_0xa9c4('0xd6')]=function(_0x45c3c8,_0x4cc737,_0x5e2065){var _0x446857={'raw':![],'where':{}};var _0x51e06e={};var _0x823a4={'count':0x0,'rows':[]};return db[_0xa9c4('0x35')][_0xa9c4('0x5e')]({'where':{'id':_0x45c3c8[_0xa9c4('0x4d')]['id']}})[_0xa9c4('0x1b')](handleEntityNotFound(_0x4cc737,null))[_0xa9c4('0x1b')](function(_0x7bcb62){if(_0x7bcb62){_0x51e06e[_0xa9c4('0x39')]=_[_0xa9c4('0x50')](db[_0xa9c4('0xab')][_0xa9c4('0x4f')]);_0x51e06e[_0xa9c4('0x3a')]=_[_0xa9c4('0x50')](_0x45c3c8['query']);_0x51e06e[_0xa9c4('0x3b')]=_[_0xa9c4('0x3d')](_0x51e06e[_0xa9c4('0x39')],_0x51e06e[_0xa9c4('0x3a')]);_0x446857[_0xa9c4('0x3c')]=_[_0xa9c4('0x3d')](_0x51e06e[_0xa9c4('0x39')],qs[_0xa9c4('0x3e')](_0x45c3c8['query']['fields']));_0x446857[_0xa9c4('0x3c')]=_0x446857[_0xa9c4('0x3c')][_0xa9c4('0x51')]?_0x446857[_0xa9c4('0x3c')]:_0x51e06e[_0xa9c4('0x39')];if(!_0x45c3c8[_0xa9c4('0x3a')][_0xa9c4('0x3f')](_0xa9c4('0x40'))){_0x446857[_0xa9c4('0x2a')]=qs['limit'](_0x45c3c8[_0xa9c4('0x3a')][_0xa9c4('0x2a')]);_0x446857['offset']=qs[_0xa9c4('0x29')](_0x45c3c8[_0xa9c4('0x3a')]['offset']);}_0x446857[_0xa9c4('0x41')]=qs[_0xa9c4('0x42')](_0x45c3c8[_0xa9c4('0x3a')][_0xa9c4('0x42')]);_0x446857[_0xa9c4('0x43')]=qs[_0xa9c4('0x3b')](_[_0xa9c4('0x44')](_0x45c3c8[_0xa9c4('0x3a')],_0x51e06e['filters']));_0x446857[_0xa9c4('0x43')][_0xa9c4('0x5c')]=_0x7bcb62['id'];if(_0x45c3c8[_0xa9c4('0x3a')][_0xa9c4('0x45')]){_0x446857['where']=_[_0xa9c4('0x46')](_0x446857[_0xa9c4('0x43')],{'$or':_[_0xa9c4('0x34')](_0x446857[_0xa9c4('0x3c')],function(_0x8ab3b6){var _0x144f0b={};_0x144f0b[_0x8ab3b6]={'$like':'%'+_0x45c3c8['query'][_0xa9c4('0x45')]+'%'};return _0x144f0b;})});}_0x446857=_[_0xa9c4('0x46')]({},_0x446857,_0x45c3c8['options']);return db[_0xa9c4('0xab')][_0xa9c4('0x49')]({'where':_0x446857[_0xa9c4('0x43')]})[_0xa9c4('0x1b')](function(_0x341a77){_0x823a4[_0xa9c4('0x49')]=_0x341a77;if(_0x45c3c8[_0xa9c4('0x3a')]['includeAll']){_0x446857[_0xa9c4('0x60')]=[{'model':db[_0xa9c4('0x86')],'as':_0xa9c4('0xd7'),'required':![]},{'model':db[_0xa9c4('0xd8')],'as':_0xa9c4('0xd9'),'attributes':[_0xa9c4('0x32'),_0xa9c4('0xda'),_0xa9c4('0xdb')],'required':![]},{'model':db['Tag'],'as':_0xa9c4('0xdc'),'attributes':['id','name',_0xa9c4('0xdd')],'where':_0x45c3c8[_0xa9c4('0x3a')][_0xa9c4('0xde')]?{'id':_0x45c3c8[_0xa9c4('0x3a')][_0xa9c4('0xde')]}:undefined,'required':_0x45c3c8[_0xa9c4('0x3a')]['tag']?!![]:![]}];}return db['ChatInteraction'][_0xa9c4('0x61')](_0x446857);})[_0xa9c4('0x1b')](function(_0x32d2d1){_0x823a4[_0xa9c4('0x4b')]=_0x32d2d1;return _0x823a4;});}})[_0xa9c4('0x1b')](respondWithFilteredResult(_0x4cc737,_0x446857))[_0xa9c4('0x24')](handleError(_0x4cc737,null));};function iftimePromise(_0x556e42,_0x5a9d0c){return respondWithRpcPromise(_0xa9c4('0xdf'),_0xa9c4('0xe0'),{'command':_0x5a9d0c[_0xa9c4('0xe1')]?util['format'](_0xa9c4('0xe2'),_0x556e42[_0xa9c4('0xe3')],_0x5a9d0c[_0xa9c4('0xe1')]):util[_0xa9c4('0xa6')](_0xa9c4('0xe4'),_0x556e42[_0xa9c4('0xe3')])},client9002)[_0xa9c4('0x1b')](function(_0x297100){var _0x36a674=_0x297100&&_0x297100[_0xa9c4('0xe5')](_0xa9c4('0xe6'))>=0x0?!![]:![];logger[_0xa9c4('0x1c')](_0xa9c4('0xe7'),_0x5a9d0c['id'],_0x556e42['id'],_0x556e42[_0xa9c4('0xe3')],_0x36a674?_0xa9c4('0xe8'):_0xa9c4('0xe9'),_0x5a9d0c[_0xa9c4('0xe1')]?_0x5a9d0c[_0xa9c4('0xe1')]:_0xa9c4('0xea'));return _0x36a674;})[_0xa9c4('0x24')](function(_0x57a381){logger[_0xa9c4('0x20')](_0xa9c4('0xe7'),_0x5a9d0c['id'],_0x556e42['id'],_0x556e42[_0xa9c4('0xe3')],util['inspect'](_0x57a381,{'showHidden':![],'depth':null}),_0x5a9d0c[_0xa9c4('0xe1')]?_0x5a9d0c[_0xa9c4('0xe1')]:_0xa9c4('0xea'));return![];});}exports['getSnippet']=function(_0x57c3a9,_0x26bca2,_0x2e3857){var _0x1c6adc=0x0;var _0xf9961b=0x0;var _0x5d51bf=![];var _0x155658;var _0x541684;return db[_0xa9c4('0x35')][_0xa9c4('0x52')]({'where':{'id':_0x57c3a9[_0xa9c4('0x4d')]['id']},'include':[{'model':db['Interval'],'as':_0xa9c4('0xeb'),'include':[{'model':db[_0xa9c4('0xeb')],'as':_0xa9c4('0xec'),'attributes':['id',_0xa9c4('0xe3')],'raw':!![]}]}]})[_0xa9c4('0x1b')](handleEntityNotFound(_0x26bca2,null))[_0xa9c4('0x1b')](function(_0x5f0e85){if(_0x5f0e85){_0x155658=_0x5f0e85;return _0x5f0e85[_0xa9c4('0xed')]({'raw':!![]});}})[_0xa9c4('0x1b')](function(_0x1057fc){if(_0x155658){if(_0x1057fc){_0x541684=_0x1057fc;}}return require('../../config/license/util')[_0xa9c4('0xee')]();})['then'](function(_0x53159c){if(_0x53159c){_0xf9961b=_0x53159c['virtual'];_0x5d51bf=_0x53159c[_0xa9c4('0xef')];}})[_0xa9c4('0x1b')](function(){return db['ChatInteraction'][_0xa9c4('0x49')]({'where':{'closed':![]}});})[_0xa9c4('0x1b')](function(_0x31d920){_0x1c6adc=_0x31d920;if(_0xf9961b&&_0x31d920>_0xf9961b){return db[_0xa9c4('0xf0')][_0xa9c4('0x5e')]({'where':{'id':0x1}})[_0xa9c4('0x1b')](function(_0x53d610){if(_0x53d610){_0x53d610[_0xa9c4('0xf1')](_0xa9c4('0xf2'));}});}})[_0xa9c4('0x1b')](function(){if(_0x155658[_0xa9c4('0xeb')]&&_0x155658['Interval']['Intervals']){var _0x1bda4c=[];for(var _0x53bd8c=0x0;_0x53bd8c<_0x155658[_0xa9c4('0xeb')][_0xa9c4('0xec')][_0xa9c4('0x51')];_0x53bd8c++){var _0x42f13f=_0x155658[_0xa9c4('0xeb')][_0xa9c4('0xec')][_0x53bd8c]['get']({'plain':!![]});_0x1bda4c[_0xa9c4('0xb4')](iftimePromise(_0x42f13f,_0x155658));}return BPromise[_0xa9c4('0xf3')](_0x1bda4c)[_0xa9c4('0x1b')](function(_0x3093f2){return _[_0xa9c4('0xf4')](_0x3093f2);});}else{return!![];}})['then'](function(_0x4277d9){var _0x309552=fs['readFileSync'](path[_0xa9c4('0x72')](config[_0xa9c4('0x73')],_0xa9c4('0xf5')),_0xa9c4('0xc6'));var _0xdaa41={'remote':_0x155658[_0xa9c4('0xf6')],'query':querystring[_0xa9c4('0x1f')](_[_0xa9c4('0x46')](_0x155658[_0xa9c4('0x55')]({'plain':!![]}),{'customerIp':_0x57c3a9[_0xa9c4('0x85')][_0xa9c4('0xa1')]||_0x57c3a9[_0xa9c4('0x85')][_0xa9c4('0xf7')]||_0x57c3a9[_0xa9c4('0xf8')]['remoteAddress']||_0x57c3a9['ip'],'referer':_0x57c3a9[_0xa9c4('0x85')][_0xa9c4('0xa3')],'openedInteractions':_0x1c6adc,'maxInteractions':_0xf9961b,'virtual':_0x5d51bf['virtual'],'online':_0x4277d9,'custom':_0x5d51bf}))['replace'](/'/g,'\x5c\x27')};_0x26bca2[_0xa9c4('0x33')](ejs[_0xa9c4('0xc7')](Mustache[_0xa9c4('0xc7')](_0x309552,_0xdaa41),{'proactiveActions':_0x541684,'alignment':_0x155658[_0xa9c4('0xf9')],'verticalAlignment':_0x155658[_0xa9c4('0xfa')],'div_color':_0x155658[_0xa9c4('0xdd')],'text_color':_0x155658[_0xa9c4('0xfb')]}));})[_0xa9c4('0x24')](handleError(_0x26bca2,null));};exports['addApplications']=function(_0x958b1,_0x355d1e,_0x101c7f){return db['ChatWebsite'][_0xa9c4('0x5e')]({'where':{'id':_0x958b1['params']['id']}})[_0xa9c4('0x1b')](handleEntityNotFound(_0x355d1e,null))['then'](function(_0x585eb6){if(_0x585eb6){return db['sequelize'][_0xa9c4('0xfc')](function(_0x211530){return db['ChatApplication'][_0xa9c4('0x5a')]({'where':{'ChatWebsiteId':_0x958b1[_0xa9c4('0x4d')]['id']},'transaction':_0x211530})[_0xa9c4('0x1b')](function(_0x1f398d){var _0x41873c=_['map'](_0x958b1[_0xa9c4('0x54')],function(_0x2e4e12){_0x2e4e12[_0xa9c4('0x5c')]=_0x958b1[_0xa9c4('0x4d')]['id'];return _0x2e4e12;});return db[_0xa9c4('0xfd')][_0xa9c4('0xfe')](_0x41873c,{'transaction':_0x211530});});})[_0xa9c4('0x1b')](function(){return db[_0xa9c4('0xfd')][_0xa9c4('0xff')]({'where':{'ChatWebsiteId':_0x958b1[_0xa9c4('0x4d')]['id']},'order':_0xa9c4('0x9b')});});}})[_0xa9c4('0x1b')](respondWithResult(_0x355d1e,null))[_0xa9c4('0x24')](handleError(_0x355d1e,null));};exports[_0xa9c4('0x100')]=function(_0x363989,_0x25d9e6,_0x363347){var _0x270435={};var _0x5bbbfa={};var _0x36c5d9;var _0x3158b3;return db[_0xa9c4('0x35')]['findOne']({'where':{'id':_0x363989[_0xa9c4('0x4d')]['id']}})[_0xa9c4('0x1b')](handleEntityNotFound(_0x25d9e6,null))[_0xa9c4('0x1b')](function(_0x51af74){if(_0x51af74){_0x36c5d9=_0x51af74;_0x5bbbfa[_0xa9c4('0x39')]=_[_0xa9c4('0x50')](db[_0xa9c4('0xfd')][_0xa9c4('0x4f')]);_0x5bbbfa[_0xa9c4('0x3a')]=_['keys'](_0x363989['query']);_0x5bbbfa[_0xa9c4('0x3b')]=_['intersection'](_0x5bbbfa[_0xa9c4('0x39')],_0x5bbbfa[_0xa9c4('0x3a')]);_0x270435[_0xa9c4('0x3c')]=_[_0xa9c4('0x3d')](_0x5bbbfa[_0xa9c4('0x39')],qs[_0xa9c4('0x3e')](_0x363989[_0xa9c4('0x3a')][_0xa9c4('0x3e')]));_0x270435[_0xa9c4('0x3c')]=_0x270435[_0xa9c4('0x3c')][_0xa9c4('0x51')]?_0x270435[_0xa9c4('0x3c')]:_0x5bbbfa[_0xa9c4('0x39')];_0x270435['order']=qs[_0xa9c4('0x42')](_0x363989['query'][_0xa9c4('0x42')]);_0x270435[_0xa9c4('0x43')]=qs[_0xa9c4('0x3b')](_['pick'](_0x363989[_0xa9c4('0x3a')],_0x5bbbfa['filters']));if(_0x363989[_0xa9c4('0x3a')][_0xa9c4('0x45')]){_0x270435[_0xa9c4('0x43')]=_[_0xa9c4('0x46')](_0x270435[_0xa9c4('0x43')],{'$or':_[_0xa9c4('0x34')](_0x270435[_0xa9c4('0x3c')],function(_0x573bf3){var _0x3a2ee1={};_0x3a2ee1[_0x573bf3]={'$like':'%'+_0x363989[_0xa9c4('0x3a')]['filter']+'%'};return _0x3a2ee1;})});}_0x270435=_['merge']({},_0x270435,_0x363989[_0xa9c4('0x48')]);return _0x36c5d9[_0xa9c4('0x100')](_0x270435);}})['then'](function(_0x420f7c){if(_0x420f7c){_0x3158b3=_0x420f7c[_0xa9c4('0x51')];if(!_0x363989[_0xa9c4('0x3a')]['hasOwnProperty']('nolimit')){_0x270435[_0xa9c4('0x2a')]=qs[_0xa9c4('0x2a')](_0x363989['query'][_0xa9c4('0x2a')]);_0x270435[_0xa9c4('0x29')]=qs[_0xa9c4('0x29')](_0x363989[_0xa9c4('0x3a')][_0xa9c4('0x29')]);}return _0x36c5d9['getApplications'](_0x270435);}})[_0xa9c4('0x1b')](function(_0x5bdd0c){if(_0x5bdd0c){return _0x5bdd0c?{'count':_0x3158b3,'rows':_0x5bdd0c}:null;}})['then'](respondWithResult(_0x25d9e6,null))[_0xa9c4('0x24')](handleError(_0x25d9e6,null));};exports[_0xa9c4('0x101')]=function(_0x23b274,_0x5ee696,_0x48b275){return db[_0xa9c4('0x102')][_0xa9c4('0x52')]({'where':{'id':_0x23b274[_0xa9c4('0x4d')]['id']}})[_0xa9c4('0x1b')](handleEntityNotFound(_0x5ee696,null))[_0xa9c4('0x1b')](function(_0x204e68){if(_0x204e68){return _0x204e68['addProactiveActions'](_0x23b274[_0xa9c4('0x54')][_0xa9c4('0x63')],_['omit'](_0x23b274['body'],[_0xa9c4('0x63'),'id'])||{});}})[_0xa9c4('0x1b')](respondWithResult(_0x5ee696,null))[_0xa9c4('0x24')](handleError(_0x5ee696,null));};exports[_0xa9c4('0xed')]=function(_0xfed2c2,_0x23cf44,_0xd54e92){var _0x51f988={};var _0x41848c={};var _0x1196a7;var _0x22e444;return db[_0xa9c4('0x35')][_0xa9c4('0x5e')]({'where':{'id':_0xfed2c2[_0xa9c4('0x4d')]['id']}})[_0xa9c4('0x1b')](handleEntityNotFound(_0x23cf44,null))[_0xa9c4('0x1b')](function(_0x328975){if(_0x328975){_0x1196a7=_0x328975;_0x41848c[_0xa9c4('0x39')]=_[_0xa9c4('0x50')](db[_0xa9c4('0x103')]['rawAttributes']);_0x41848c['query']=_['keys'](_0xfed2c2[_0xa9c4('0x3a')]);_0x41848c['filters']=_[_0xa9c4('0x3d')](_0x41848c[_0xa9c4('0x39')],_0x41848c[_0xa9c4('0x3a')]);_0x51f988[_0xa9c4('0x3c')]=_[_0xa9c4('0x3d')](_0x41848c[_0xa9c4('0x39')],qs[_0xa9c4('0x3e')](_0xfed2c2['query'][_0xa9c4('0x3e')]));_0x51f988['attributes']=_0x51f988[_0xa9c4('0x3c')][_0xa9c4('0x51')]?_0x51f988[_0xa9c4('0x3c')]:_0x41848c[_0xa9c4('0x39')];_0x51f988[_0xa9c4('0x41')]=qs[_0xa9c4('0x42')](_0xfed2c2[_0xa9c4('0x3a')][_0xa9c4('0x42')]);_0x51f988[_0xa9c4('0x43')]=qs[_0xa9c4('0x3b')](_[_0xa9c4('0x44')](_0xfed2c2[_0xa9c4('0x3a')],_0x41848c['filters']));if(_0xfed2c2[_0xa9c4('0x3a')][_0xa9c4('0x45')]){_0x51f988[_0xa9c4('0x43')]=_[_0xa9c4('0x46')](_0x51f988[_0xa9c4('0x43')],{'$or':_[_0xa9c4('0x34')](_0x51f988['attributes'],function(_0x42b5d2){var _0x30e180={};_0x30e180[_0x42b5d2]={'$like':'%'+_0xfed2c2['query']['filter']+'%'};return _0x30e180;})});}_0x51f988=_[_0xa9c4('0x46')]({},_0x51f988,_0xfed2c2[_0xa9c4('0x48')]);return _0x1196a7['getProactiveActions'](_0x51f988);}})[_0xa9c4('0x1b')](function(_0x5d2971){if(_0x5d2971){_0x22e444=_0x5d2971[_0xa9c4('0x51')];if(!_0xfed2c2[_0xa9c4('0x3a')]['hasOwnProperty'](_0xa9c4('0x40'))){_0x51f988[_0xa9c4('0x2a')]=qs[_0xa9c4('0x2a')](_0xfed2c2[_0xa9c4('0x3a')]['limit']);_0x51f988[_0xa9c4('0x29')]=qs[_0xa9c4('0x29')](_0xfed2c2['query'][_0xa9c4('0x29')]);}return _0x1196a7['getProactiveActions'](_0x51f988);}})[_0xa9c4('0x1b')](function(_0x3849d8){if(_0x3849d8){return _0x3849d8?{'count':_0x22e444,'rows':_0x3849d8}:null;}})[_0xa9c4('0x1b')](respondWithResult(_0x23cf44,null))[_0xa9c4('0x24')](handleError(_0x23cf44,null));};exports[_0xa9c4('0x104')]=function(_0x4b3ffa,_0x147b31,_0x140e13){var _0x406f4a=_0x4b3ffa[_0xa9c4('0x3a')][_0xa9c4('0x105')]===_0xa9c4('0x106')?'offlineForm':_0xa9c4('0x107');return db[_0xa9c4('0x35')][_0xa9c4('0x52')]({'attributes':['id',_0x406f4a],'where':{'id':_0x4b3ffa[_0xa9c4('0x4d')]['id']}})[_0xa9c4('0x1b')](handleEntityNotFound(_0x147b31,null))['then'](function(_0x47bc63){if(_0x47bc63){var _0x33f6b0=_0x47bc63[_0x406f4a];var _0x19469d=_0x33f6b0&&_0x33f6b0[_0xa9c4('0x108')]?_0x33f6b0[_0xa9c4('0x108')]:[];_0x147b31[_0xa9c4('0x33')]({'fromKey':_[_0xa9c4('0x75')](_0x33f6b0[_0xa9c4('0x109')])?undefined:_0x33f6b0[_0xa9c4('0x109')],'count':_0x19469d[_0xa9c4('0x51')],'rows':_0x19469d});}})[_0xa9c4('0x24')](handleError(_0x147b31,null));};exports['getOfflineMessages']=function(_0x4f3feb,_0x5ebb9b,_0xf83620){var _0x2bd429={'raw':![],'where':{}};var _0xa755d1={};var _0x535d90={'count':0x0,'rows':[]};return db[_0xa9c4('0x35')][_0xa9c4('0x5e')]({'where':{'id':_0x4f3feb[_0xa9c4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5ebb9b,null))[_0xa9c4('0x1b')](function(_0x232e35){if(_0x232e35){_0xa755d1['model']=_['keys'](db[_0xa9c4('0xca')][_0xa9c4('0x4f')]);_0xa755d1['query']=_[_0xa9c4('0x50')](_0x4f3feb[_0xa9c4('0x3a')]);_0xa755d1[_0xa9c4('0x3b')]=_[_0xa9c4('0x3d')](_0xa755d1[_0xa9c4('0x39')],_0xa755d1[_0xa9c4('0x3a')]);_0x2bd429[_0xa9c4('0x3c')]=_[_0xa9c4('0x3d')](_0xa755d1[_0xa9c4('0x39')],qs['fields'](_0x4f3feb[_0xa9c4('0x3a')][_0xa9c4('0x3e')]));_0x2bd429[_0xa9c4('0x3c')]=_0x2bd429[_0xa9c4('0x3c')][_0xa9c4('0x51')]?_0x2bd429['attributes']:_0xa755d1['model'];if(!_0x4f3feb[_0xa9c4('0x3a')][_0xa9c4('0x3f')](_0xa9c4('0x40'))){_0x2bd429[_0xa9c4('0x2a')]=qs['limit'](_0x4f3feb[_0xa9c4('0x3a')]['limit']);_0x2bd429['offset']=qs[_0xa9c4('0x29')](_0x4f3feb[_0xa9c4('0x3a')]['offset']);}_0x2bd429['order']=qs[_0xa9c4('0x42')](_0x4f3feb[_0xa9c4('0x3a')][_0xa9c4('0x42')]);_0x2bd429[_0xa9c4('0x43')]=qs[_0xa9c4('0x3b')](_[_0xa9c4('0x44')](_0x4f3feb[_0xa9c4('0x3a')],_0xa755d1[_0xa9c4('0x3b')]));_0x2bd429[_0xa9c4('0x43')]['ChatWebsiteId']=_0x232e35['id'];if(_0x4f3feb[_0xa9c4('0x3a')]['filter']){_0x2bd429['where']=_[_0xa9c4('0x46')](_0x2bd429['where'],{'$or':_[_0xa9c4('0x34')](_0x2bd429[_0xa9c4('0x3c')],function(_0x4d585c){var _0x18fb3e={};_0x18fb3e[_0x4d585c]={'$like':'%'+_0x4f3feb['query']['filter']+'%'};return _0x18fb3e;})});}_0x2bd429=_[_0xa9c4('0x46')]({},_0x2bd429,_0x4f3feb['options']);return db[_0xa9c4('0xca')]['count']({'where':_0x2bd429[_0xa9c4('0x43')]})[_0xa9c4('0x1b')](function(_0x349264){_0x535d90[_0xa9c4('0x49')]=_0x349264;if(_0x4f3feb[_0xa9c4('0x3a')][_0xa9c4('0x4a')]){_0x2bd429[_0xa9c4('0x60')]=[{'all':!![]}];}else{_0x2bd429[_0xa9c4('0x60')]=[{'model':db[_0xa9c4('0x86')],'as':_0xa9c4('0xd7'),'required':![]}];}return db[_0xa9c4('0xca')][_0xa9c4('0x61')](_0x2bd429);})['then'](function(_0xbe9287){_0x535d90[_0xa9c4('0x4b')]=_0xbe9287;return _0x535d90;});}})['then'](respondWithFilteredResult(_0x5ebb9b,_0x2bd429))[_0xa9c4('0x24')](handleError(_0x5ebb9b,null));};exports[_0xa9c4('0x10a')]=function(_0x2b33e7,_0x27a019,_0x1de1e5){return db['ChatWebsite'][_0xa9c4('0x52')]({'where':{'id':_0x2b33e7[_0xa9c4('0x4d')]['id']}})[_0xa9c4('0x1b')](handleEntityNotFound(_0x27a019,null))['then'](function(_0x3c99b2){if(_0x3c99b2){return _0x3c99b2['addAgents'](_0x2b33e7[_0xa9c4('0x54')][_0xa9c4('0x63')],_['omit'](_0x2b33e7[_0xa9c4('0x54')],[_0xa9c4('0x63'),'id'])||{})[_0xa9c4('0xaf')](function(_0x3bd518){for(var _0x49871f=0x0;_0x49871f<_0x2b33e7[_0xa9c4('0x54')][_0xa9c4('0x63')][_0xa9c4('0x51')];_0x49871f+=0x1){socket[_0xa9c4('0x10b')](_0xa9c4('0x10c'),{'UserId':_0x2b33e7[_0xa9c4('0x54')]['ids'][_0x49871f],'ChatWebsiteId':_0x2b33e7[_0xa9c4('0x4d')]['id']});}return _0x3bd518;});}})['then'](respondWithResult(_0x27a019,null))[_0xa9c4('0x24')](handleError(_0x27a019,null));};exports[_0xa9c4('0x10d')]=function(_0x42212d,_0x34d01e,_0xfc8497){return db[_0xa9c4('0x35')][_0xa9c4('0x52')]({'where':{'id':_0x42212d['params']['id']}})[_0xa9c4('0x1b')](handleEntityNotFound(_0x34d01e,null))[_0xa9c4('0x1b')](function(_0x4718c7){if(_0x4718c7){return _0x4718c7[_0xa9c4('0x10d')](_0x42212d[_0xa9c4('0x3a')][_0xa9c4('0x63')])[_0xa9c4('0x1b')](function(){if(_[_0xa9c4('0x10e')](_0x42212d[_0xa9c4('0x3a')][_0xa9c4('0x63')])){for(var _0x2d08cd=0x0;_0x2d08cd<_0x42212d[_0xa9c4('0x3a')]['ids'][_0xa9c4('0x51')];_0x2d08cd+=0x1){socket[_0xa9c4('0x10b')](_0xa9c4('0x10f'),{'UserId':Number(_0x42212d[_0xa9c4('0x3a')][_0xa9c4('0x63')][_0x2d08cd]),'ChatWebsiteId':Number(_0x42212d['params']['id'])});}}else{socket[_0xa9c4('0x10b')](_0xa9c4('0x10f'),{'UserId':Number(_0x42212d[_0xa9c4('0x3a')][_0xa9c4('0x63')]),'ChatWebsiteId':Number(_0x42212d['params']['id'])});}});}})[_0xa9c4('0x1b')](respondWithStatusCode(_0x34d01e,null))[_0xa9c4('0x24')](handleError(_0x34d01e,null));};exports['getAgents']=function(_0x141fc9,_0x3aec1a,_0x438346){var _0x578fc8={};var _0x378418={};var _0x5ccead;var _0x33725b;return db[_0xa9c4('0x35')][_0xa9c4('0x5e')]({'where':{'id':_0x141fc9['params']['id']}})['then'](handleEntityNotFound(_0x3aec1a,null))[_0xa9c4('0x1b')](function(_0x408360){if(_0x408360){_0x5ccead=_0x408360;_0x378418['model']=_[_0xa9c4('0x50')](db[_0xa9c4('0xd8')]['rawAttributes']);_0x378418[_0xa9c4('0x3a')]=_['keys'](_0x141fc9[_0xa9c4('0x3a')]);_0x378418[_0xa9c4('0x3b')]=_[_0xa9c4('0x3d')](_0x378418[_0xa9c4('0x39')],_0x378418[_0xa9c4('0x3a')]);_0x578fc8[_0xa9c4('0x3c')]=_[_0xa9c4('0x3d')](_0x378418[_0xa9c4('0x39')],qs[_0xa9c4('0x3e')](_0x141fc9['query'][_0xa9c4('0x3e')]));_0x578fc8[_0xa9c4('0x3c')]=_0x578fc8[_0xa9c4('0x3c')][_0xa9c4('0x51')]?_0x578fc8['attributes']:_0x378418[_0xa9c4('0x39')];_0x578fc8[_0xa9c4('0x41')]=qs['sort'](_0x141fc9[_0xa9c4('0x3a')][_0xa9c4('0x42')]);_0x578fc8[_0xa9c4('0x43')]=qs[_0xa9c4('0x3b')](_['pick'](_0x141fc9[_0xa9c4('0x3a')],_0x378418[_0xa9c4('0x3b')]));if(_0x141fc9[_0xa9c4('0x3a')][_0xa9c4('0x45')]){_0x578fc8['where']=_['merge'](_0x578fc8[_0xa9c4('0x43')],{'$or':_['map'](_0x578fc8[_0xa9c4('0x3c')],function(_0x48bb38){var _0x40c4a3={};_0x40c4a3[_0x48bb38]={'$like':'%'+_0x141fc9['query']['filter']+'%'};return _0x40c4a3;})});}_0x578fc8=_[_0xa9c4('0x46')]({},_0x578fc8,_0x141fc9[_0xa9c4('0x48')]);return _0x5ccead[_0xa9c4('0x110')](_0x578fc8);}})[_0xa9c4('0x1b')](function(_0x1b8ebf){if(_0x1b8ebf){_0x33725b=_0x1b8ebf[_0xa9c4('0x51')];if(!_0x141fc9[_0xa9c4('0x3a')]['hasOwnProperty'](_0xa9c4('0x40'))){_0x578fc8[_0xa9c4('0x2a')]=qs[_0xa9c4('0x2a')](_0x141fc9[_0xa9c4('0x3a')][_0xa9c4('0x2a')]);_0x578fc8['offset']=qs[_0xa9c4('0x29')](_0x141fc9[_0xa9c4('0x3a')][_0xa9c4('0x29')]);}return _0x5ccead[_0xa9c4('0x110')](_0x578fc8);}})[_0xa9c4('0x1b')](function(_0x3f4206){if(_0x3f4206){return _0x3f4206?{'count':_0x33725b,'rows':_0x3f4206}:null;}})[_0xa9c4('0x1b')](respondWithResult(_0x3aec1a,null))[_0xa9c4('0x24')](handleError(_0x3aec1a,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index c55f0f2..3801637 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 _0x0bde=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x2f6e2d,_0x3ba8a5){var _0x3d122c=function(_0x3f15ac){while(--_0x3f15ac){_0x2f6e2d['push'](_0x2f6e2d['shift']());}};_0x3d122c(++_0x3ba8a5);}(_0x0bde,0xe7));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xe0bd('0x0'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xe0bd('0x1')](0x0);var events={'afterCreate':_0xe0bd('0x2'),'afterUpdate':_0xe0bd('0x3'),'afterDestroy':_0xe0bd('0x4')};function emitEvent(_0x2da4bd){return function(_0x5541b9,_0x34df88,_0x124139){ChatWebsiteEvents[_0xe0bd('0x5')](_0x2da4bd+':'+_0x5541b9['id'],_0x5541b9);ChatWebsiteEvents[_0xe0bd('0x5')](_0x2da4bd,_0x5541b9);_0x124139(null);};}for(var e in events){if(events[_0xe0bd('0x6')](e)){var event=events[e];ChatWebsite[_0xe0bd('0x7')](e,emitEvent(event));}}module[_0xe0bd('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x0c29=['save','update','remove','emit','hasOwnProperty','hook','exports','ChatWebsite'];(function(_0x5f5a47,_0x1307bf){var _0x53ad3f=function(_0x3904d1){while(--_0x3904d1){_0x5f5a47['push'](_0x5f5a47['shift']());}};_0x53ad3f(++_0x1307bf);}(_0x0c29,0xb7));var _0x90c2=function(_0x30bd66,_0x36a93d){_0x30bd66=_0x30bd66-0x0;var _0x74c9dd=_0x0c29[_0x30bd66];return _0x74c9dd;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db'][_0x90c2('0x0')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x90c2('0x1'),'afterUpdate':_0x90c2('0x2'),'afterDestroy':_0x90c2('0x3')};function emitEvent(_0x59a229){return function(_0x4a0464,_0x262121,_0x432049){ChatWebsiteEvents[_0x90c2('0x4')](_0x59a229+':'+_0x4a0464['id'],_0x4a0464);ChatWebsiteEvents[_0x90c2('0x4')](_0x59a229,_0x4a0464);_0x432049(null);};}for(var e in events){if(events[_0x90c2('0x5')](e)){var event=events[e];ChatWebsite[_0x90c2('0x6')](e,emitEvent(event));}}module[_0x90c2('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 50df0e5..c0c7e60 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 _0x2750=['rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3acc9c,_0x5697a4){var _0x11df29=function(_0x42b0a6){while(--_0x42b0a6){_0x3acc9c['push'](_0x3acc9c['shift']());}};_0x11df29(++_0x5697a4);}(_0x2750,0x13b));var _0x0275=function(_0x374b1c,_0x2ac771){_0x374b1c=_0x374b1c-0x0;var _0x121d40=_0x2750[_0x374b1c];return _0x121d40;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var logger=require(_0x0275('0x1'))(_0x0275('0x2'));var moment=require(_0x0275('0x3'));var BPromise=require(_0x0275('0x4'));var rp=require(_0x0275('0x5'));var fs=require('fs');var path=require(_0x0275('0x6'));var rimraf=require(_0x0275('0x7'));var config=require(_0x0275('0x8'));var attributes=require(_0x0275('0x9'));module[_0x0275('0xa')]=function(_0x5953f9,_0x3f645f){return _0x5953f9[_0x0275('0xb')](_0x0275('0xc'),attributes,{'tableName':_0x0275('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2504=['../../config/environment','./chatWebsite.attributes','exports','chat_websites','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x2504,0xee));var _0x4250=function(_0xf1cb2,_0x2beb5f){_0xf1cb2=_0xf1cb2-0x0;var _0x4eefeb=_0x2504[_0xf1cb2];return _0x4eefeb;};'use strict';var _=require(_0x4250('0x0'));var util=require(_0x4250('0x1'));var logger=require(_0x4250('0x2'))(_0x4250('0x3'));var moment=require(_0x4250('0x4'));var BPromise=require(_0x4250('0x5'));var rp=require(_0x4250('0x6'));var fs=require('fs');var path=require(_0x4250('0x7'));var rimraf=require(_0x4250('0x8'));var config=require(_0x4250('0x9'));var attributes=require(_0x4250('0xa'));module[_0x4250('0xb')]=function(_0x493da9,_0x473cb8){return _0x493da9['define']('ChatWebsite',attributes,{'tableName':_0x4250('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 17375de..0db458f 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 _0x1623=['../../mysqldb','../../config/utils','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x2ca616,_0x384ec8){var _0x53155f=function(_0x108627){while(--_0x108627){_0x2ca616['push'](_0x2ca616['shift']());}};_0x53155f(++_0x384ec8);}(_0x1623,0xab));var _0x3162=function(_0x57a490,_0x3e3087){_0x57a490=_0x57a490-0x0;var _0x374528=_0x1623[_0x57a490];return _0x374528;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3162('0x1'));var rs=require(_0x3162('0x2'));var fs=require('fs');var Redis=require(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var utils=require(_0x3162('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3162('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3162('0x7')][_0x3162('0x8')]({'port':0x232a});config['redis']=_[_0x3162('0x9')](config[_0x3162('0xa')],{'host':_0x3162('0xb'),'port':0x18eb});var socket=require(_0x3162('0xc'))(new Redis(config[_0x3162('0xa')]));require(_0x3162('0xd'))[_0x3162('0xe')](socket);function respondWithRpcPromise(_0x113d28,_0x4bde10,_0x50814f){return new BPromise(function(_0x270de3,_0x3106d5){return client[_0x3162('0xf')](_0x113d28,_0x50814f)[_0x3162('0x10')](function(_0x813d62){logger[_0x3162('0x11')](_0x3162('0x12'),_0x4bde10,_0x3162('0x13'));logger[_0x3162('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4bde10,_0x3162('0x13'),JSON['stringify'](_0x813d62));if(_0x813d62[_0x3162('0x15')]){if(_0x813d62[_0x3162('0x15')]['code']===0x1f4){logger['error'](_0x3162('0x12'),_0x4bde10,_0x813d62[_0x3162('0x15')][_0x3162('0x16')]);return _0x3106d5(_0x813d62['error'][_0x3162('0x16')]);}logger[_0x3162('0x15')](_0x3162('0x12'),_0x4bde10,_0x813d62['error'][_0x3162('0x16')]);return _0x270de3(_0x813d62[_0x3162('0x15')][_0x3162('0x16')]);}else{logger[_0x3162('0x11')](_0x3162('0x12'),_0x4bde10,_0x3162('0x13'));_0x270de3(_0x813d62[_0x3162('0x17')]['message']);}})[_0x3162('0x18')](function(_0x1e3d75){logger[_0x3162('0x15')](_0x3162('0x12'),_0x4bde10,_0x1e3d75);_0x3106d5(_0x1e3d75);});});} \ No newline at end of file +var _0xc2c7=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','localhost','socket.io-emitter','redis','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0xae3306,_0x3d51d2){var _0x1f68ad=function(_0xb7c103){while(--_0xb7c103){_0xae3306['push'](_0xae3306['shift']());}};_0x1f68ad(++_0x3d51d2);}(_0xc2c7,0x134));var _0x7c2c=function(_0x43fe21,_0x26ffd6){_0x43fe21=_0x43fe21-0x0;var _0x8965e6=_0xc2c7[_0x43fe21];return _0x8965e6;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x7c2c('0xb'),'port':0x18eb});var socket=require(_0x7c2c('0xc'))(new Redis(config[_0x7c2c('0xd')]));require(_0x7c2c('0xe'))[_0x7c2c('0xf')](socket);function respondWithRpcPromise(_0x57b107,_0x3093d2,_0x307bec){return new BPromise(function(_0x285ff6,_0x1bfeaf){return client[_0x7c2c('0x10')](_0x57b107,_0x307bec)[_0x7c2c('0x11')](function(_0x2cb057){logger[_0x7c2c('0x12')](_0x7c2c('0x13'),_0x3093d2,_0x7c2c('0x14'));logger[_0x7c2c('0x15')](_0x7c2c('0x16'),_0x3093d2,_0x7c2c('0x14'),JSON[_0x7c2c('0x17')](_0x2cb057));if(_0x2cb057[_0x7c2c('0x18')]){if(_0x2cb057[_0x7c2c('0x18')]['code']===0x1f4){logger['error'](_0x7c2c('0x13'),_0x3093d2,_0x2cb057[_0x7c2c('0x18')][_0x7c2c('0x19')]);return _0x1bfeaf(_0x2cb057['error'][_0x7c2c('0x19')]);}logger[_0x7c2c('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x3093d2,_0x2cb057[_0x7c2c('0x18')]['message']);return _0x285ff6(_0x2cb057[_0x7c2c('0x18')]['message']);}else{logger[_0x7c2c('0x12')](_0x7c2c('0x13'),_0x3093d2,_0x7c2c('0x14'));_0x285ff6(_0x2cb057[_0x7c2c('0x1a')][_0x7c2c('0x19')]);}})[_0x7c2c('0x1b')](function(_0x2c1378){logger[_0x7c2c('0x18')](_0x7c2c('0x13'),_0x3093d2,_0x2c1378);_0x1bfeaf(_0x2c1378);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 0261e94..8141c2f 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(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1f2ce6,_0x3f6174){_0x1f2ce6=_0x1f2ce6-0x0;var _0x3cd2ab=_0x5f2f[_0x1f2ce6];return _0x3cd2ab;};'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 _0x7a54=['remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x4b9396,_0x5de72c){var _0x340779=function(_0x1ab16f){while(--_0x1ab16f){_0x4b9396['push'](_0x4b9396['shift']());}};_0x340779(++_0x5de72c);}(_0x7a54,0x106));var _0x47a5=function(_0x32a9ba,_0x144a14){_0x32a9ba=_0x32a9ba-0x0;var _0x16f9c0=_0x7a54[_0x32a9ba];return _0x16f9c0;};'use strict';var ChatWebsiteEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){ChatWebsiteEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);ChatWebsiteEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index cb6ab67..b4ce823 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 _0x0c31=['addAnswer','diskStorage','join','root','%s-%s','now','originalname','single','server/files/images/avatars/','format','file','addCustomerAvatar','notify','offline','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','addDisposition'];(function(_0x59943d,_0x2e751b){var _0x46ace9=function(_0xfbd5f2){while(--_0xfbd5f2){_0x59943d['push'](_0x59943d['shift']());}};_0x46ace9(++_0x2e751b);}(_0x0c31,0x11d));var _0x10c3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x0c31[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x10c3('0x0'));var util=require(_0x10c3('0x1'));var path=require(_0x10c3('0x2'));var timeout=require('connect-timeout');var express=require(_0x10c3('0x3'));var router=express[_0x10c3('0x4')]();var auth=require(_0x10c3('0x5'));var interaction=require(_0x10c3('0x6'));var config=require(_0x10c3('0x7'));var controller=require(_0x10c3('0x8'));router[_0x10c3('0x9')]('/',auth[_0x10c3('0xa')](),controller[_0x10c3('0xb')]);router[_0x10c3('0x9')](_0x10c3('0xc'),auth[_0x10c3('0xa')](),controller[_0x10c3('0xd')]);router[_0x10c3('0x9')](_0x10c3('0xe'),auth['isAuthenticated'](),controller[_0x10c3('0xf')]);router['get'](_0x10c3('0x10'),auth[_0x10c3('0xa')](),controller['getDispositions']);router['get'](_0x10c3('0x11'),auth[_0x10c3('0xa')](),controller[_0x10c3('0x12')]);router[_0x10c3('0x9')](_0x10c3('0x13'),controller[_0x10c3('0x14')]);router[_0x10c3('0x9')](_0x10c3('0x15'),controller['getAvatar']);router[_0x10c3('0x9')](_0x10c3('0x16'),controller[_0x10c3('0x17')]);router['get'](_0x10c3('0x18'),controller[_0x10c3('0x19')]);router['get'](_0x10c3('0x1a'),auth[_0x10c3('0xa')](),controller[_0x10c3('0x1b')]);router[_0x10c3('0x9')](_0x10c3('0x1c'),controller[_0x10c3('0x1d')]);router[_0x10c3('0x9')](_0x10c3('0x1e'),auth[_0x10c3('0xa')](),controller[_0x10c3('0x1f')]);router[_0x10c3('0x9')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x10c3('0x20')]);router['get']('/:id/fields',controller[_0x10c3('0x21')]);router['get'](_0x10c3('0x22'),auth[_0x10c3('0xa')](),controller[_0x10c3('0x23')]);router['get'](_0x10c3('0x24'),auth['isAuthenticated'](),controller[_0x10c3('0x25')]);router[_0x10c3('0x26')]('/',auth[_0x10c3('0xa')](),controller['create']);router['post'](_0x10c3('0x10'),auth[_0x10c3('0xa')](),controller[_0x10c3('0x27')]);router[_0x10c3('0x26')]('/:id/canned_answers',auth[_0x10c3('0xa')](),controller[_0x10c3('0x28')]);var upload=multer({'storage':multer[_0x10c3('0x29')]({'destination':function(_0xb315f7,_0x4b6644,_0xc10ba){_0xc10ba(null,path[_0x10c3('0x2a')](config[_0x10c3('0x2b')],'server/files/images/logos/'));},'filename':function(_0x2d8221,_0x815fb9,_0x2a0ee8){_0x2a0ee8(null,util['format'](_0x10c3('0x2c'),Date[_0x10c3('0x2d')](),_0x815fb9[_0x10c3('0x2e')]));}})});router[_0x10c3('0x26')]('/:id/logo',upload[_0x10c3('0x2f')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x10c3('0x29')]({'destination':function(_0x34e0fc,_0x3862cb,_0x2b66f0){_0x2b66f0(null,path[_0x10c3('0x2a')](config[_0x10c3('0x2b')],_0x10c3('0x30')));},'filename':function(_0x2cca89,_0x5a7aa7,_0x2e5247){_0x2e5247(null,util[_0x10c3('0x31')](_0x10c3('0x2c'),Date[_0x10c3('0x2d')](),_0x5a7aa7[_0x10c3('0x2e')]));}})});router['post']('/:id/avatar',upload['single'](_0x10c3('0x32')),controller['addAvatar']);var upload=multer({'storage':multer[_0x10c3('0x29')]({'destination':function(_0x3a4571,_0x31b6a6,_0x3a8e0c){_0x3a8e0c(null,path[_0x10c3('0x2a')](config[_0x10c3('0x2b')],_0x10c3('0x30')));},'filename':function(_0x4619f2,_0x9b13ce,_0x213e68){_0x213e68(null,util['format'](_0x10c3('0x2c'),Date[_0x10c3('0x2d')](),_0x9b13ce[_0x10c3('0x2e')]));}})});router[_0x10c3('0x26')]('/:id/customer_avatar',upload[_0x10c3('0x2f')](_0x10c3('0x32')),controller[_0x10c3('0x33')]);var upload=multer({'storage':multer[_0x10c3('0x29')]({'destination':function(_0xd4331a,_0xddbfa,_0x369d08){_0x369d08(null,path[_0x10c3('0x2a')](config[_0x10c3('0x2b')],_0x10c3('0x30')));},'filename':function(_0x13f3e2,_0x3ef05e,_0x2e4732){_0x2e4732(null,util[_0x10c3('0x31')](_0x10c3('0x2c'),Date[_0x10c3('0x2d')](),_0x3ef05e[_0x10c3('0x2e')]));}})});router['post'](_0x10c3('0x18'),upload[_0x10c3('0x2f')]('file'),controller['addSystemAvatar']);router[_0x10c3('0x26')]('/:id/notify',controller[_0x10c3('0x34')]);router['post']('/:id/offline',controller[_0x10c3('0x35')]);router[_0x10c3('0x26')](_0x10c3('0x1a'),auth[_0x10c3('0xa')](),controller['addInteraction']);router[_0x10c3('0x26')](_0x10c3('0x1e'),auth[_0x10c3('0xa')](),controller[_0x10c3('0x36')]);router[_0x10c3('0x26')]('/:id/proactive_actions',auth[_0x10c3('0xa')](),controller[_0x10c3('0x37')]);router['post']('/:id/users',auth[_0x10c3('0xa')](),controller[_0x10c3('0x38')]);router[_0x10c3('0x39')]('/:id',auth['isAuthenticated'](),controller[_0x10c3('0x3a')]);router[_0x10c3('0x3b')](_0x10c3('0xe'),auth['isAuthenticated'](),controller[_0x10c3('0x3c')]);router[_0x10c3('0x3b')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x10c3('0x3d')]);router[_0x10c3('0x3b')](_0x10c3('0x11'),auth[_0x10c3('0xa')](),controller[_0x10c3('0x3e')]);router[_0x10c3('0x3b')]('/:id/users',auth[_0x10c3('0xa')](),controller[_0x10c3('0x3f')]);module[_0x10c3('0x40')]=router; \ No newline at end of file +var _0xb79a=['index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','getCustomerAvatar','/:id/system_avatar','getInteractions','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','originalname','addLogo','now','/:id/avatar','single','file','addAvatar','server/files/images/avatars/','/:id/customer_avatar','addSystemAvatar','/:id/notify','notify','/:id/offline','offline','/:id/interactions','addInteraction','addApplications','addProactiveActions','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get'];(function(_0x5d351c,_0x5ccac8){var _0x526cf1=function(_0x44469d){while(--_0x44469d){_0x5d351c['push'](_0x5d351c['shift']());}};_0x526cf1(++_0x5ccac8);}(_0xb79a,0x18e));var _0xab79=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb79a[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xab79('0x0'));var util=require(_0xab79('0x1'));var path=require('path');var timeout=require(_0xab79('0x2'));var express=require(_0xab79('0x3'));var router=express[_0xab79('0x4')]();var auth=require(_0xab79('0x5'));var interaction=require(_0xab79('0x6'));var config=require(_0xab79('0x7'));var controller=require(_0xab79('0x8'));router[_0xab79('0x9')]('/',auth['isAuthenticated'](),controller[_0xab79('0xa')]);router['get'](_0xab79('0xb'),auth[_0xab79('0xc')](),controller[_0xab79('0xd')]);router[_0xab79('0x9')](_0xab79('0xe'),auth[_0xab79('0xc')](),controller[_0xab79('0xf')]);router[_0xab79('0x9')](_0xab79('0x10'),auth[_0xab79('0xc')](),controller[_0xab79('0x11')]);router['get']('/:id/canned_answers',auth[_0xab79('0xc')](),controller[_0xab79('0x12')]);router[_0xab79('0x9')](_0xab79('0x13'),controller[_0xab79('0x14')]);router[_0xab79('0x9')]('/:id/avatar',controller['getAvatar']);router[_0xab79('0x9')]('/:id/customer_avatar',controller[_0xab79('0x15')]);router[_0xab79('0x9')](_0xab79('0x16'),controller['getSystemAvatar']);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0xab79('0x17')]);router[_0xab79('0x9')]('/:id/snippet',controller['getSnippet']);router['get'](_0xab79('0x18'),auth[_0xab79('0xc')](),controller['getApplications']);router[_0xab79('0x9')](_0xab79('0x19'),auth[_0xab79('0xc')](),controller[_0xab79('0x1a')]);router['get'](_0xab79('0x1b'),controller[_0xab79('0x1c')]);router[_0xab79('0x9')](_0xab79('0x1d'),auth['isAuthenticated'](),controller[_0xab79('0x1e')]);router[_0xab79('0x9')](_0xab79('0x1f'),auth[_0xab79('0xc')](),controller[_0xab79('0x20')]);router['post']('/',auth[_0xab79('0xc')](),controller['create']);router[_0xab79('0x21')](_0xab79('0x10'),auth[_0xab79('0xc')](),controller[_0xab79('0x22')]);router[_0xab79('0x21')](_0xab79('0x23'),auth[_0xab79('0xc')](),controller[_0xab79('0x24')]);var upload=multer({'storage':multer[_0xab79('0x25')]({'destination':function(_0x1e440a,_0xb669a,_0x4f3773){_0x4f3773(null,path[_0xab79('0x26')](config[_0xab79('0x27')],_0xab79('0x28')));},'filename':function(_0x454ed8,_0x10b007,_0x241c89){_0x241c89(null,util[_0xab79('0x29')](_0xab79('0x2a'),Date['now'](),_0x10b007[_0xab79('0x2b')]));}})});router[_0xab79('0x21')](_0xab79('0x13'),upload['single']('file'),controller[_0xab79('0x2c')]);var upload=multer({'storage':multer[_0xab79('0x25')]({'destination':function(_0x5f10ef,_0x2f6dc3,_0x17b3ac){_0x17b3ac(null,path[_0xab79('0x26')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x9fc678,_0x859493,_0x4875c4){_0x4875c4(null,util[_0xab79('0x29')]('%s-%s',Date[_0xab79('0x2d')](),_0x859493[_0xab79('0x2b')]));}})});router['post'](_0xab79('0x2e'),upload[_0xab79('0x2f')](_0xab79('0x30')),controller[_0xab79('0x31')]);var upload=multer({'storage':multer[_0xab79('0x25')]({'destination':function(_0x5abac9,_0x3fac9b,_0x5dd893){_0x5dd893(null,path[_0xab79('0x26')](config['root'],_0xab79('0x32')));},'filename':function(_0x5dc432,_0x4263fd,_0x1bde3b){_0x1bde3b(null,util[_0xab79('0x29')](_0xab79('0x2a'),Date[_0xab79('0x2d')](),_0x4263fd['originalname']));}})});router[_0xab79('0x21')](_0xab79('0x33'),upload['single'](_0xab79('0x30')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xab79('0x25')]({'destination':function(_0x523c2f,_0x3d9fa9,_0x3e7580){_0x3e7580(null,path[_0xab79('0x26')](config[_0xab79('0x27')],_0xab79('0x32')));},'filename':function(_0x52bf90,_0x5e6fa4,_0x4d8396){_0x4d8396(null,util['format'](_0xab79('0x2a'),Date[_0xab79('0x2d')](),_0x5e6fa4['originalname']));}})});router[_0xab79('0x21')]('/:id/system_avatar',upload[_0xab79('0x2f')](_0xab79('0x30')),controller[_0xab79('0x34')]);router[_0xab79('0x21')](_0xab79('0x35'),controller[_0xab79('0x36')]);router[_0xab79('0x21')](_0xab79('0x37'),controller[_0xab79('0x38')]);router[_0xab79('0x21')](_0xab79('0x39'),auth['isAuthenticated'](),controller[_0xab79('0x3a')]);router['post']('/:id/applications',auth[_0xab79('0xc')](),controller[_0xab79('0x3b')]);router['post'](_0xab79('0x19'),auth['isAuthenticated'](),controller[_0xab79('0x3c')]);router[_0xab79('0x21')]('/:id/users',auth[_0xab79('0xc')](),controller['addAgents']);router[_0xab79('0x3d')]('/:id',auth[_0xab79('0xc')](),controller[_0xab79('0x3e')]);router['delete'](_0xab79('0xe'),auth['isAuthenticated'](),controller[_0xab79('0x3f')]);router[_0xab79('0x40')](_0xab79('0x10'),auth['isAuthenticated'](),controller[_0xab79('0x41')]);router[_0xab79('0x40')](_0xab79('0x23'),auth[_0xab79('0xc')](),controller[_0xab79('0x42')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xab79('0x43')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index f442cf7..d08cbbc 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 _0xf603=['ENUM','AmazonAWS','Google','STRING','sequelize','exports'];(function(_0x527fd7,_0x15af06){var _0x3ca79b=function(_0x200e97){while(--_0x200e97){_0x527fd7['push'](_0x527fd7['shift']());}};_0x3ca79b(++_0x15af06);}(_0xf603,0x124));var _0x3f60=function(_0x300184,_0xcfe529){_0x300184=_0x300184-0x0;var _0x332dfa=_0xf603[_0x300184];return _0x332dfa;};'use strict';var Sequelize=require(_0x3f60('0x0'));module[_0x3f60('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x3f60('0x2')](_0x3f60('0x3'),_0x3f60('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x3f60('0x5')]},'data2':{'type':Sequelize[_0x3f60('0x5')]}}; \ No newline at end of file +var _0xb242=['STRING','ENUM','AmazonAWS','Google','exports'];(function(_0x5a5395,_0x5361f6){var _0x4da43d=function(_0x149941){while(--_0x149941){_0x5a5395['push'](_0x5a5395['shift']());}};_0x4da43d(++_0x5361f6);}(_0xb242,0x1f3));var _0x2b24=function(_0x1ebeea,_0x2f54f4){_0x1ebeea=_0x1ebeea-0x0;var _0x576465=_0xb242[_0x1ebeea];return _0x576465;};'use strict';var Sequelize=require('sequelize');module[_0x2b24('0x0')]={'name':{'type':Sequelize[_0x2b24('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x2b24('0x2')](_0x2b24('0x3'),_0x2b24('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x2b24('0x1')]},'data2':{'type':Sequelize[_0x2b24('0x1')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index d89d9fa..60d34f5 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 _0x0404=['map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','CloudProvider','rawAttributes','fieldName','type','key','model'];(function(_0x314010,_0x1896d5){var _0x5e6300=function(_0xca1b26){while(--_0xca1b26){_0x314010['push'](_0x314010['shift']());}};_0x5e6300(++_0x1896d5);}(_0x0404,0xf4));var _0x4040=function(_0x24f862,_0x4b645a){_0x24f862=_0x24f862-0x0;var _0x198aa4=_0x0404[_0x24f862];return _0x198aa4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4040('0x0'));var rimraf=require(_0x4040('0x1'));var zipdir=require(_0x4040('0x2'));var jsonpatch=require(_0x4040('0x3'));var rp=require(_0x4040('0x4'));var moment=require(_0x4040('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4040('0x6'));var util=require(_0x4040('0x7'));var path=require(_0x4040('0x8'));var sox=require(_0x4040('0x9'));var csv=require('to-csv');var ejs=require(_0x4040('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4040('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4040('0xc'));var toCsv=require(_0x4040('0xd'));var querystring=require(_0x4040('0xe'));var Papa=require('papaparse');var Redis=require(_0x4040('0xf'));var authService=require(_0x4040('0x10'));var qs=require(_0x4040('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4040('0x12'));var logger=require(_0x4040('0x13'))('api');var utils=require(_0x4040('0x14'));var config=require(_0x4040('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4040('0x16'))['db'];function respondWithStatusCode(_0x6848fe,_0x43c6e6){_0x43c6e6=_0x43c6e6||0xcc;return function(_0x5ad97f){if(_0x5ad97f){return _0x6848fe[_0x4040('0x17')](_0x43c6e6);}return _0x6848fe['status'](_0x43c6e6)[_0x4040('0x18')]();};}function respondWithResult(_0x4b2336,_0x459e4c){_0x459e4c=_0x459e4c||0xc8;return function(_0x4d0771){if(_0x4d0771){return _0x4b2336[_0x4040('0x19')](_0x459e4c)[_0x4040('0x1a')](_0x4d0771);}};}function respondWithFilteredResult(_0x5f3a95,_0x4d4419){return function(_0x50022d){if(_0x50022d){var _0x2a49f4=_0x50022d[_0x4040('0x1b')],_0x458537=_0x4d4419[_0x4040('0x1c')],_0x439a20=_0x4d4419[_0x4040('0x1c')]+_0x4d4419[_0x4040('0x1d')],_0x29fbbb;if(_0x439a20>=_0x2a49f4){_0x439a20=_0x2a49f4;_0x29fbbb=0xc8;}else{_0x29fbbb=0xce;}_0x5f3a95[_0x4040('0x19')](_0x29fbbb);return _0x5f3a95[_0x4040('0x1e')](_0x4040('0x1f'),_0x458537+'-'+_0x439a20+'/'+_0x2a49f4)['json'](_0x50022d);}return null;};}function patchUpdates(_0x51efaf){return function(_0xb8aa7d){try{jsonpatch[_0x4040('0x20')](_0xb8aa7d,_0x51efaf,!![]);}catch(_0x343021){return BPromise['reject'](_0x343021);}return _0xb8aa7d[_0x4040('0x21')]();};}function saveUpdates(_0x39aebc,_0x68b36c){return function(_0x3a3ddc){if(_0x3a3ddc){return _0x3a3ddc[_0x4040('0x22')](_0x39aebc)[_0x4040('0x23')](function(_0xec1f81){return _0xec1f81;});}return null;};}function removeEntity(_0x2c0bc5,_0x1ca1b8){return function(_0x3cb9a9){if(_0x3cb9a9){return _0x3cb9a9[_0x4040('0x24')]()[_0x4040('0x23')](function(){_0x2c0bc5[_0x4040('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x429c77,_0x5686c2){return function(_0x152e67){if(!_0x152e67){_0x429c77['sendStatus'](0x194);}return _0x152e67;};}function handleError(_0x41f04b,_0x48d4d2){_0x48d4d2=_0x48d4d2||0x1f4;return function(_0xd96a68){logger[_0x4040('0x25')](_0xd96a68[_0x4040('0x26')]);if(_0xd96a68['name']){delete _0xd96a68[_0x4040('0x27')];}_0x41f04b[_0x4040('0x19')](_0x48d4d2)[_0x4040('0x28')](_0xd96a68);};}exports[_0x4040('0x29')]=function(_0x1d670f,_0x29cc8e){var _0x18a03b={},_0x3b48f8={},_0x23ef59={'count':0x0,'rows':[]};var _0x1b878c=_['map'](db[_0x4040('0x2a')][_0x4040('0x2b')],function(_0xa72be){return{'name':_0xa72be[_0x4040('0x2c')],'type':_0xa72be[_0x4040('0x2d')][_0x4040('0x2e')]};});_0x3b48f8[_0x4040('0x2f')]=_[_0x4040('0x30')](_0x1b878c,_0x4040('0x27'));_0x3b48f8[_0x4040('0x31')]=_[_0x4040('0x32')](_0x1d670f['query']);_0x3b48f8[_0x4040('0x33')]=_[_0x4040('0x34')](_0x3b48f8[_0x4040('0x2f')],_0x3b48f8[_0x4040('0x31')]);_0x18a03b[_0x4040('0x35')]=_['intersection'](_0x3b48f8[_0x4040('0x2f')],qs[_0x4040('0x36')](_0x1d670f[_0x4040('0x31')][_0x4040('0x36')]));_0x18a03b[_0x4040('0x35')]=_0x18a03b[_0x4040('0x35')]['length']?_0x18a03b[_0x4040('0x35')]:_0x3b48f8[_0x4040('0x2f')];if(!_0x1d670f[_0x4040('0x31')][_0x4040('0x37')]('nolimit')){_0x18a03b[_0x4040('0x1d')]=qs[_0x4040('0x1d')](_0x1d670f[_0x4040('0x31')][_0x4040('0x1d')]);_0x18a03b[_0x4040('0x1c')]=qs[_0x4040('0x1c')](_0x1d670f[_0x4040('0x31')]['offset']);}_0x18a03b[_0x4040('0x38')]=qs[_0x4040('0x39')](_0x1d670f[_0x4040('0x31')][_0x4040('0x39')]);_0x18a03b[_0x4040('0x3a')]=qs[_0x4040('0x33')](_[_0x4040('0x3b')](_0x1d670f[_0x4040('0x31')],_0x3b48f8[_0x4040('0x33')]),_0x1b878c);if(_0x1d670f[_0x4040('0x31')][_0x4040('0x3c')]){_0x18a03b[_0x4040('0x3a')]=_[_0x4040('0x3d')](_0x18a03b[_0x4040('0x3a')],{'$or':_['map'](_0x1b878c,function(_0x31a017){if(_0x31a017[_0x4040('0x2d')]!=='VIRTUAL'){var _0x5b4d60={};_0x5b4d60[_0x31a017[_0x4040('0x27')]]={'$like':'%'+_0x1d670f[_0x4040('0x31')][_0x4040('0x3c')]+'%'};return _0x5b4d60;}})});}_0x18a03b=_[_0x4040('0x3d')]({},_0x18a03b,_0x1d670f[_0x4040('0x3e')]);var _0x549997={'where':_0x18a03b['where']};return db[_0x4040('0x2a')][_0x4040('0x1b')](_0x549997)[_0x4040('0x23')](function(_0x42ed30){_0x23ef59['count']=_0x42ed30;if(_0x1d670f[_0x4040('0x31')][_0x4040('0x3f')]){_0x18a03b[_0x4040('0x40')]=[{'all':!![]}];}return db[_0x4040('0x2a')][_0x4040('0x41')](_0x18a03b);})[_0x4040('0x23')](function(_0x4ceffe){_0x23ef59[_0x4040('0x42')]=_0x4ceffe;return _0x23ef59;})[_0x4040('0x23')](respondWithFilteredResult(_0x29cc8e,_0x18a03b))[_0x4040('0x43')](handleError(_0x29cc8e,null));};exports['show']=function(_0x41e61b,_0x840b4a){var _0xb00fc7={'raw':!![],'where':{'id':_0x41e61b[_0x4040('0x44')]['id']}},_0x4de8fc={};_0x4de8fc[_0x4040('0x2f')]=_[_0x4040('0x32')](db[_0x4040('0x2a')]['rawAttributes']);_0x4de8fc[_0x4040('0x31')]=_[_0x4040('0x32')](_0x41e61b['query']);_0x4de8fc[_0x4040('0x33')]=_[_0x4040('0x34')](_0x4de8fc[_0x4040('0x2f')],_0x4de8fc[_0x4040('0x31')]);_0xb00fc7[_0x4040('0x35')]=_['intersection'](_0x4de8fc['model'],qs[_0x4040('0x36')](_0x41e61b['query'][_0x4040('0x36')]));_0xb00fc7[_0x4040('0x35')]=_0xb00fc7[_0x4040('0x35')][_0x4040('0x45')]?_0xb00fc7[_0x4040('0x35')]:_0x4de8fc['model'];if(_0x41e61b['query']['includeAll']){_0xb00fc7[_0x4040('0x40')]=[{'all':!![]}];}_0xb00fc7=_[_0x4040('0x3d')]({},_0xb00fc7,_0x41e61b['options']);return db['CloudProvider'][_0x4040('0x46')](_0xb00fc7)[_0x4040('0x23')](handleEntityNotFound(_0x840b4a,null))[_0x4040('0x23')](respondWithResult(_0x840b4a,null))['catch'](handleError(_0x840b4a,null));};exports['create']=function(_0x36bd23,_0x5a7f2e){return db[_0x4040('0x2a')][_0x4040('0x47')](_0x36bd23[_0x4040('0x48')],{})['then'](respondWithResult(_0x5a7f2e,0xc9))[_0x4040('0x43')](handleError(_0x5a7f2e,null));};exports[_0x4040('0x22')]=function(_0x17f021,_0x3149c0){if(_0x17f021[_0x4040('0x48')]['id']){delete _0x17f021['body']['id'];}return db[_0x4040('0x2a')][_0x4040('0x46')]({'where':{'id':_0x17f021[_0x4040('0x44')]['id']}})['then'](handleEntityNotFound(_0x3149c0,null))[_0x4040('0x23')](saveUpdates(_0x17f021['body'],null))[_0x4040('0x23')](respondWithResult(_0x3149c0,null))['catch'](handleError(_0x3149c0,null));};exports[_0x4040('0x24')]=function(_0x3e50e6,_0x5a7525){return db[_0x4040('0x2a')][_0x4040('0x46')]({'where':{'id':_0x3e50e6['params']['id']}})[_0x4040('0x23')](handleEntityNotFound(_0x5a7525,null))[_0x4040('0x23')](removeEntity(_0x5a7525,null))[_0x4040('0x43')](handleError(_0x5a7525,null));}; \ No newline at end of file +var _0xc543=['type','key','model','query','keys','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','intersection','length','include','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','apply','reject','save','then','destroy','name','send','index','map','CloudProvider','rawAttributes'];(function(_0x35206c,_0x1fab51){var _0x5460cc=function(_0x262eb7){while(--_0x262eb7){_0x35206c['push'](_0x35206c['shift']());}};_0x5460cc(++_0x1fab51);}(_0xc543,0x139));var _0x3c54=function(_0x4e4413,_0x1116a6){_0x4e4413=_0x4e4413-0x0;var _0x4c449a=_0xc543[_0x4e4413];return _0x4c449a;};'use strict';var pdf=require(_0x3c54('0x0'));var emlformat=require(_0x3c54('0x1'));var rimraf=require(_0x3c54('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3c54('0x3'));var rp=require(_0x3c54('0x4'));var moment=require('moment');var BPromise=require(_0x3c54('0x5'));var Mustache=require('mustache');var util=require(_0x3c54('0x6'));var path=require(_0x3c54('0x7'));var sox=require('sox');var csv=require(_0x3c54('0x8'));var ejs=require(_0x3c54('0x9'));var fs=require('fs');var _=require(_0x3c54('0xa'));var squel=require(_0x3c54('0xb'));var crypto=require('crypto');var jsforce=require(_0x3c54('0xc'));var deskjs=require(_0x3c54('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3c54('0xe'));var Papa=require(_0x3c54('0xf'));var Redis=require(_0x3c54('0x10'));var authService=require(_0x3c54('0x11'));var qs=require(_0x3c54('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c54('0x13'));var logger=require(_0x3c54('0x14'))(_0x3c54('0x15'));var utils=require(_0x3c54('0x16'));var config=require(_0x3c54('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b3a1c,_0x568f52){_0x568f52=_0x568f52||0xcc;return function(_0x1b8cfc){if(_0x1b8cfc){return _0x5b3a1c[_0x3c54('0x18')](_0x568f52);}return _0x5b3a1c[_0x3c54('0x19')](_0x568f52)[_0x3c54('0x1a')]();};}function respondWithResult(_0x2bd82f,_0x1af68f){_0x1af68f=_0x1af68f||0xc8;return function(_0x4952c8){if(_0x4952c8){return _0x2bd82f[_0x3c54('0x19')](_0x1af68f)[_0x3c54('0x1b')](_0x4952c8);}};}function respondWithFilteredResult(_0x505e34,_0x3b3e8f){return function(_0x4008a0){if(_0x4008a0){var _0x24f160=_0x4008a0[_0x3c54('0x1c')],_0x531ca3=_0x3b3e8f[_0x3c54('0x1d')],_0x22eb27=_0x3b3e8f['offset']+_0x3b3e8f[_0x3c54('0x1e')],_0x7b9cd3;if(_0x22eb27>=_0x24f160){_0x22eb27=_0x24f160;_0x7b9cd3=0xc8;}else{_0x7b9cd3=0xce;}_0x505e34['status'](_0x7b9cd3);return _0x505e34['set']('Content-Range',_0x531ca3+'-'+_0x22eb27+'/'+_0x24f160)['json'](_0x4008a0);}return null;};}function patchUpdates(_0xbe1bf0){return function(_0x21af38){try{jsonpatch[_0x3c54('0x1f')](_0x21af38,_0xbe1bf0,!![]);}catch(_0x57dded){return BPromise[_0x3c54('0x20')](_0x57dded);}return _0x21af38[_0x3c54('0x21')]();};}function saveUpdates(_0x4c62ff,_0x35366d){return function(_0x2126b8){if(_0x2126b8){return _0x2126b8['update'](_0x4c62ff)[_0x3c54('0x22')](function(_0x655276){return _0x655276;});}return null;};}function removeEntity(_0x58a699,_0x4da3b6){return function(_0x2cc404){if(_0x2cc404){return _0x2cc404[_0x3c54('0x23')]()[_0x3c54('0x22')](function(){_0x58a699[_0x3c54('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c78f2,_0xb900b9){return function(_0x22322f){if(!_0x22322f){_0x5c78f2[_0x3c54('0x18')](0x194);}return _0x22322f;};}function handleError(_0x526757,_0x5357b9){_0x5357b9=_0x5357b9||0x1f4;return function(_0x4097ab){logger['error'](_0x4097ab['stack']);if(_0x4097ab['name']){delete _0x4097ab[_0x3c54('0x24')];}_0x526757[_0x3c54('0x19')](_0x5357b9)[_0x3c54('0x25')](_0x4097ab);};}exports[_0x3c54('0x26')]=function(_0x546533,_0xb46630){var _0x339d78={},_0x184d51={},_0x5979ff={'count':0x0,'rows':[]};var _0x17b6d1=_[_0x3c54('0x27')](db[_0x3c54('0x28')][_0x3c54('0x29')],function(_0x6fb38){return{'name':_0x6fb38['fieldName'],'type':_0x6fb38[_0x3c54('0x2a')][_0x3c54('0x2b')]};});_0x184d51[_0x3c54('0x2c')]=_[_0x3c54('0x27')](_0x17b6d1,'name');_0x184d51[_0x3c54('0x2d')]=_[_0x3c54('0x2e')](_0x546533[_0x3c54('0x2d')]);_0x184d51['filters']=_['intersection'](_0x184d51[_0x3c54('0x2c')],_0x184d51[_0x3c54('0x2d')]);_0x339d78[_0x3c54('0x2f')]=_['intersection'](_0x184d51[_0x3c54('0x2c')],qs[_0x3c54('0x30')](_0x546533[_0x3c54('0x2d')][_0x3c54('0x30')]));_0x339d78[_0x3c54('0x2f')]=_0x339d78[_0x3c54('0x2f')]['length']?_0x339d78[_0x3c54('0x2f')]:_0x184d51['model'];if(!_0x546533[_0x3c54('0x2d')][_0x3c54('0x31')](_0x3c54('0x32'))){_0x339d78[_0x3c54('0x1e')]=qs[_0x3c54('0x1e')](_0x546533['query'][_0x3c54('0x1e')]);_0x339d78[_0x3c54('0x1d')]=qs[_0x3c54('0x1d')](_0x546533[_0x3c54('0x2d')][_0x3c54('0x1d')]);}_0x339d78[_0x3c54('0x33')]=qs[_0x3c54('0x34')](_0x546533[_0x3c54('0x2d')][_0x3c54('0x34')]);_0x339d78[_0x3c54('0x35')]=qs[_0x3c54('0x36')](_[_0x3c54('0x37')](_0x546533[_0x3c54('0x2d')],_0x184d51['filters']),_0x17b6d1);if(_0x546533['query']['filter']){_0x339d78[_0x3c54('0x35')]=_[_0x3c54('0x38')](_0x339d78[_0x3c54('0x35')],{'$or':_[_0x3c54('0x27')](_0x17b6d1,function(_0x22c999){if(_0x22c999[_0x3c54('0x2a')]!==_0x3c54('0x39')){var _0x1dfae4={};_0x1dfae4[_0x22c999[_0x3c54('0x24')]]={'$like':'%'+_0x546533[_0x3c54('0x2d')][_0x3c54('0x3a')]+'%'};return _0x1dfae4;}})});}_0x339d78=_[_0x3c54('0x38')]({},_0x339d78,_0x546533[_0x3c54('0x3b')]);var _0x3fc41e={'where':_0x339d78[_0x3c54('0x35')]};return db[_0x3c54('0x28')]['count'](_0x3fc41e)[_0x3c54('0x22')](function(_0x229f1a){_0x5979ff[_0x3c54('0x1c')]=_0x229f1a;if(_0x546533['query'][_0x3c54('0x3c')]){_0x339d78['include']=[{'all':!![]}];}return db[_0x3c54('0x28')]['findAll'](_0x339d78);})[_0x3c54('0x22')](function(_0x3eda60){_0x5979ff[_0x3c54('0x3d')]=_0x3eda60;return _0x5979ff;})[_0x3c54('0x22')](respondWithFilteredResult(_0xb46630,_0x339d78))[_0x3c54('0x3e')](handleError(_0xb46630,null));};exports[_0x3c54('0x3f')]=function(_0x32f931,_0x56b663){var _0x21e99d={'raw':!![],'where':{'id':_0x32f931[_0x3c54('0x40')]['id']}},_0xaa77e3={};_0xaa77e3[_0x3c54('0x2c')]=_[_0x3c54('0x2e')](db[_0x3c54('0x28')][_0x3c54('0x29')]);_0xaa77e3[_0x3c54('0x2d')]=_[_0x3c54('0x2e')](_0x32f931[_0x3c54('0x2d')]);_0xaa77e3[_0x3c54('0x36')]=_[_0x3c54('0x41')](_0xaa77e3['model'],_0xaa77e3[_0x3c54('0x2d')]);_0x21e99d[_0x3c54('0x2f')]=_[_0x3c54('0x41')](_0xaa77e3[_0x3c54('0x2c')],qs[_0x3c54('0x30')](_0x32f931[_0x3c54('0x2d')]['fields']));_0x21e99d[_0x3c54('0x2f')]=_0x21e99d[_0x3c54('0x2f')][_0x3c54('0x42')]?_0x21e99d['attributes']:_0xaa77e3['model'];if(_0x32f931[_0x3c54('0x2d')][_0x3c54('0x3c')]){_0x21e99d[_0x3c54('0x43')]=[{'all':!![]}];}_0x21e99d=_[_0x3c54('0x38')]({},_0x21e99d,_0x32f931[_0x3c54('0x3b')]);return db[_0x3c54('0x28')][_0x3c54('0x44')](_0x21e99d)['then'](handleEntityNotFound(_0x56b663,null))['then'](respondWithResult(_0x56b663,null))[_0x3c54('0x3e')](handleError(_0x56b663,null));};exports[_0x3c54('0x45')]=function(_0x5b81d8,_0x1ebf86){return db['CloudProvider'][_0x3c54('0x45')](_0x5b81d8[_0x3c54('0x46')],{})[_0x3c54('0x22')](respondWithResult(_0x1ebf86,0xc9))[_0x3c54('0x3e')](handleError(_0x1ebf86,null));};exports['update']=function(_0x42d3e6,_0x59c991){if(_0x42d3e6[_0x3c54('0x46')]['id']){delete _0x42d3e6[_0x3c54('0x46')]['id'];}return db['CloudProvider']['find']({'where':{'id':_0x42d3e6['params']['id']}})['then'](handleEntityNotFound(_0x59c991,null))[_0x3c54('0x22')](saveUpdates(_0x42d3e6[_0x3c54('0x46')],null))[_0x3c54('0x22')](respondWithResult(_0x59c991,null))[_0x3c54('0x3e')](handleError(_0x59c991,null));};exports[_0x3c54('0x23')]=function(_0x55338b,_0x2e031a){return db[_0x3c54('0x28')][_0x3c54('0x44')]({'where':{'id':_0x55338b['params']['id']}})[_0x3c54('0x22')](handleEntityNotFound(_0x2e031a,null))[_0x3c54('0x22')](removeEntity(_0x2e031a,null))[_0x3c54('0x3e')](handleError(_0x2e031a,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 8d1d2b6..f557a91 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 _0x0857=['bluebird','exports','CloudProvider','cloud_providers','util','../../config/logger','api'];(function(_0x542cda,_0x433711){var _0x2717dd=function(_0x33f5a7){while(--_0x33f5a7){_0x542cda['push'](_0x542cda['shift']());}};_0x2717dd(++_0x433711);}(_0x0857,0xd6));var _0x7085=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x0857[_0xc6be3a];return _0x56a310;};'use strict';var _=require('lodash');var util=require(_0x7085('0x0'));var logger=require(_0x7085('0x1'))(_0x7085('0x2'));var moment=require('moment');var BPromise=require(_0x7085('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module[_0x7085('0x4')]=function(_0x46a5c8,_0x46b914){return _0x46a5c8['define'](_0x7085('0x5'),attributes,{'tableName':_0x7085('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e16=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cloudProvider.attributes','cloud_providers','lodash'];(function(_0x37dbbb,_0x1909de){var _0x10068f=function(_0x2464b0){while(--_0x2464b0){_0x37dbbb['push'](_0x37dbbb['shift']());}};_0x10068f(++_0x1909de);}(_0x2e16,0x167));var _0x62e1=function(_0x11c949,_0x3ca30f){_0x11c949=_0x11c949-0x0;var _0x5c5414=_0x2e16[_0x11c949];return _0x5c5414;};'use strict';var _=require(_0x62e1('0x0'));var util=require('util');var logger=require(_0x62e1('0x1'))(_0x62e1('0x2'));var moment=require(_0x62e1('0x3'));var BPromise=require(_0x62e1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x62e1('0x5'));var config=require(_0x62e1('0x6'));var attributes=require(_0x62e1('0x7'));module['exports']=function(_0x377cc8,_0x2dd969){return _0x377cc8['define']('CloudProvider',attributes,{'tableName':_0x62e1('0x8'),'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 2b092d9..818093c 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 _0x6a4f=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x44b3bd,_0x44c97d){var _0x1efc4a=function(_0x5d0205){while(--_0x5d0205){_0x44b3bd['push'](_0x44b3bd['shift']());}};_0x1efc4a(++_0x44c97d);}(_0x6a4f,0x130));var _0xf6a4=function(_0xbdd26c,_0x2fcd86){_0xbdd26c=_0xbdd26c-0x0;var _0x4810dd=_0x6a4f[_0xbdd26c];return _0x4810dd;};'use strict';var _=require(_0xf6a4('0x0'));var util=require('util');var moment=require(_0xf6a4('0x1'));var BPromise=require(_0xf6a4('0x2'));var rs=require(_0xf6a4('0x3'));var fs=require('fs');var Redis=require(_0xf6a4('0x4'));var db=require(_0xf6a4('0x5'))['db'];var utils=require(_0xf6a4('0x6'));var logger=require('../../config/logger')(_0xf6a4('0x7'));var config=require('../../config/environment');var jayson=require(_0xf6a4('0x8'));var client=jayson[_0xf6a4('0x9')][_0xf6a4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51c060,_0x499205,_0x16a4fa){return new BPromise(function(_0x394ae7,_0x56edc5){return client[_0xf6a4('0xb')](_0x51c060,_0x16a4fa)[_0xf6a4('0xc')](function(_0x3896a3){logger[_0xf6a4('0xd')](_0xf6a4('0xe'),_0x499205,_0xf6a4('0xf'));logger['debug'](_0xf6a4('0x10'),_0x499205,_0xf6a4('0xf'),JSON[_0xf6a4('0x11')](_0x3896a3));if(_0x3896a3[_0xf6a4('0x12')]){if(_0x3896a3['error'][_0xf6a4('0x13')]===0x1f4){logger[_0xf6a4('0x12')](_0xf6a4('0xe'),_0x499205,_0x3896a3['error'][_0xf6a4('0x14')]);return _0x56edc5(_0x3896a3[_0xf6a4('0x12')][_0xf6a4('0x14')]);}logger[_0xf6a4('0x12')](_0xf6a4('0xe'),_0x499205,_0x3896a3[_0xf6a4('0x12')][_0xf6a4('0x14')]);return _0x394ae7(_0x3896a3[_0xf6a4('0x12')][_0xf6a4('0x14')]);}else{logger['info']('CloudProvider,\x20%s,\x20%s',_0x499205,_0xf6a4('0xf'));_0x394ae7(_0x3896a3[_0xf6a4('0x15')][_0xf6a4('0x14')]);}})[_0xf6a4('0x16')](function(_0x5e43a9){logger['error']('CloudProvider,\x20%s,\x20%s',_0x499205,_0x5e43a9);_0x56edc5(_0x5e43a9);});});} \ No newline at end of file +var _0x4f64=['debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent'];(function(_0x4b38c,_0x42c1be){var _0x1d57a8=function(_0x1f52e7){while(--_0x1f52e7){_0x4b38c['push'](_0x4b38c['shift']());}};_0x1d57a8(++_0x42c1be);}(_0x4f64,0x1a4));var _0x44f6=function(_0x1bbf64,_0x5b1819){_0x1bbf64=_0x1bbf64-0x0;var _0x4e8753=_0x4f64[_0x1bbf64];return _0x4e8753;};'use strict';var _=require(_0x44f6('0x0'));var util=require('util');var moment=require(_0x44f6('0x1'));var BPromise=require(_0x44f6('0x2'));var rs=require(_0x44f6('0x3'));var fs=require('fs');var Redis=require(_0x44f6('0x4'));var db=require(_0x44f6('0x5'))['db'];var utils=require(_0x44f6('0x6'));var logger=require(_0x44f6('0x7'))(_0x44f6('0x8'));var config=require(_0x44f6('0x9'));var jayson=require(_0x44f6('0xa'));var client=jayson['client'][_0x44f6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x462274,_0x16ca53,_0x3bacc2){return new BPromise(function(_0x345edc,_0x245e80){return client[_0x44f6('0xc')](_0x462274,_0x3bacc2)[_0x44f6('0xd')](function(_0x1db65b){logger[_0x44f6('0xe')](_0x44f6('0xf'),_0x16ca53,_0x44f6('0x10'));logger[_0x44f6('0x11')](_0x44f6('0x12'),_0x16ca53,_0x44f6('0x10'),JSON[_0x44f6('0x13')](_0x1db65b));if(_0x1db65b[_0x44f6('0x14')]){if(_0x1db65b['error']['code']===0x1f4){logger[_0x44f6('0x14')](_0x44f6('0xf'),_0x16ca53,_0x1db65b[_0x44f6('0x14')][_0x44f6('0x15')]);return _0x245e80(_0x1db65b[_0x44f6('0x14')]['message']);}logger[_0x44f6('0x14')](_0x44f6('0xf'),_0x16ca53,_0x1db65b[_0x44f6('0x14')][_0x44f6('0x15')]);return _0x345edc(_0x1db65b[_0x44f6('0x14')][_0x44f6('0x15')]);}else{logger['info'](_0x44f6('0xf'),_0x16ca53,_0x44f6('0x10'));_0x345edc(_0x1db65b['result']['message']);}})[_0x44f6('0x16')](function(_0x332a78){logger[_0x44f6('0x14')]('CloudProvider,\x20%s,\x20%s',_0x16ca53,_0x332a78);_0x245e80(_0x332a78);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 8bcb5ca..fc3d5e3 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 _0x7e1a=['put','update','delete','destroy','multer','connect-timeout','express','Router','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x2f453c,_0xad9d41){var _0xca358d=function(_0x3eac44){while(--_0x3eac44){_0x2f453c['push'](_0x2f453c['shift']());}};_0xca358d(++_0xad9d41);}(_0x7e1a,0x1b7));var _0xa7e1=function(_0xc47812,_0xe5e3e0){_0xc47812=_0xc47812-0x0;var _0x42ac55=_0x7e1a[_0xc47812];return _0x42ac55;};'use strict';var multer=require(_0xa7e1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa7e1('0x1'));var express=require(_0xa7e1('0x2'));var router=express[_0xa7e1('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cloudProvider.controller');router['get']('/',auth[_0xa7e1('0x4')](),controller[_0xa7e1('0x5')]);router[_0xa7e1('0x6')](_0xa7e1('0x7'),auth[_0xa7e1('0x4')](),controller[_0xa7e1('0x8')]);router[_0xa7e1('0x9')]('/',auth[_0xa7e1('0x4')](),controller[_0xa7e1('0xa')]);router[_0xa7e1('0xb')](_0xa7e1('0x7'),auth[_0xa7e1('0x4')](),controller[_0xa7e1('0xc')]);router[_0xa7e1('0xd')]('/:id',auth[_0xa7e1('0x4')](),controller[_0xa7e1('0xe')]);module['exports']=router; \ No newline at end of file +var _0x1a45=['../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x1a45,0x89));var _0x51a4=function(_0x12c456,_0x1f4f92){_0x12c456=_0x12c456-0x0;var _0x24e1f3=_0x1a45[_0x12c456];return _0x24e1f3;};'use strict';var multer=require(_0x51a4('0x0'));var util=require(_0x51a4('0x1'));var path=require(_0x51a4('0x2'));var timeout=require(_0x51a4('0x3'));var express=require(_0x51a4('0x4'));var router=express[_0x51a4('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x51a4('0x6'));var config=require(_0x51a4('0x7'));var controller=require(_0x51a4('0x8'));router[_0x51a4('0x9')]('/',auth[_0x51a4('0xa')](),controller[_0x51a4('0xb')]);router[_0x51a4('0x9')](_0x51a4('0xc'),auth[_0x51a4('0xa')](),controller['show']);router[_0x51a4('0xd')]('/',auth[_0x51a4('0xa')](),controller['create']);router[_0x51a4('0xe')](_0x51a4('0xc'),auth[_0x51a4('0xa')](),controller[_0x51a4('0xf')]);router[_0x51a4('0x10')](_0x51a4('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x51a4('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index ded7884..9b9637f 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 _0x2911=['exports','name','STRING','sequelize'];(function(_0x5302fb,_0x1a2db3){var _0x43e6a4=function(_0x324ae6){while(--_0x324ae6){_0x5302fb['push'](_0x5302fb['shift']());}};_0x43e6a4(++_0x1a2db3);}(_0x2911,0x1cf));var _0x1291=function(_0x578f2a,_0x1f5d46){_0x578f2a=_0x578f2a-0x0;var _0x46083a=_0x2911[_0x578f2a];return _0x46083a;};'use strict';var Sequelize=require(_0x1291('0x0'));module[_0x1291('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1291('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x1291('0x3')]},'companyId':{'type':Sequelize[_0x1291('0x3')]},'website':{'type':Sequelize[_0x1291('0x3')]},'phone':{'type':Sequelize[_0x1291('0x3')]},'fax':{'type':Sequelize[_0x1291('0x3')]},'type':{'type':Sequelize[_0x1291('0x3')]},'street':{'type':Sequelize[_0x1291('0x3')]},'postalCode':{'type':Sequelize[_0x1291('0x3')]},'city':{'type':Sequelize[_0x1291('0x3')]},'country':{'type':Sequelize[_0x1291('0x3')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x1291('0x3')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x1291('0x3')]},'sCity':{'type':Sequelize[_0x1291('0x3')]},'sCountry':{'type':Sequelize[_0x1291('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa7f0=['name','sequelize','STRING'];(function(_0x16ee82,_0xc83414){var _0x2db590=function(_0x1e8a44){while(--_0x1e8a44){_0x16ee82['push'](_0x16ee82['shift']());}};_0x2db590(++_0xc83414);}(_0xa7f0,0x14b));var _0x0a7f=function(_0x46cd8c,_0x46ac68){_0x46cd8c=_0x46cd8c-0x0;var _0x554b51=_0xa7f0[_0x46cd8c];return _0x554b51;};'use strict';var Sequelize=require(_0x0a7f('0x0'));module['exports']={'name':{'type':Sequelize[_0x0a7f('0x1')],'unique':_0x0a7f('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x0a7f('0x1')]},'companyId':{'type':Sequelize[_0x0a7f('0x1')]},'website':{'type':Sequelize[_0x0a7f('0x1')]},'phone':{'type':Sequelize[_0x0a7f('0x1')]},'fax':{'type':Sequelize[_0x0a7f('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x0a7f('0x1')]},'postalCode':{'type':Sequelize[_0x0a7f('0x1')]},'city':{'type':Sequelize[_0x0a7f('0x1')]},'country':{'type':Sequelize[_0x0a7f('0x1')]},'email':{'type':Sequelize[_0x0a7f('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x0a7f('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x0a7f('0x1')]},'sCity':{'type':Sequelize[_0x0a7f('0x1')]},'sCountry':{'type':Sequelize[_0x0a7f('0x1')]},'description':{'type':Sequelize[_0x0a7f('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 9be4d63..d383c04 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 _0xfc05=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','Companies','UserProfileResource','error','stack','name','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','includeAll','include','rows','catch','show','params','rawAttributes','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','findOne','getContacts','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel'];(function(_0x4762f9,_0x280e18){var _0x4b4c11=function(_0x559123){while(--_0x559123){_0x4762f9['push'](_0x4762f9['shift']());}};_0x4b4c11(++_0x280e18);}(_0xfc05,0x1ae));var _0x5fc0=function(_0x23b168,_0x3907aa){_0x23b168=_0x23b168-0x0;var _0x26c03f=_0xfc05[_0x23b168];return _0x26c03f;};'use strict';var pdf=require(_0x5fc0('0x0'));var emlformat=require(_0x5fc0('0x1'));var rimraf=require(_0x5fc0('0x2'));var zipdir=require(_0x5fc0('0x3'));var jsonpatch=require(_0x5fc0('0x4'));var rp=require(_0x5fc0('0x5'));var moment=require(_0x5fc0('0x6'));var BPromise=require(_0x5fc0('0x7'));var Mustache=require(_0x5fc0('0x8'));var util=require(_0x5fc0('0x9'));var path=require(_0x5fc0('0xa'));var sox=require(_0x5fc0('0xb'));var csv=require(_0x5fc0('0xc'));var ejs=require(_0x5fc0('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5fc0('0xe'));var crypto=require('crypto');var jsforce=require(_0x5fc0('0xf'));var deskjs=require(_0x5fc0('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5fc0('0x11'));var Papa=require(_0x5fc0('0x12'));var Redis=require(_0x5fc0('0x13'));var authService=require(_0x5fc0('0x14'));var qs=require(_0x5fc0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5fc0('0x16'));var logger=require(_0x5fc0('0x17'))(_0x5fc0('0x18'));var utils=require(_0x5fc0('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x5fc0('0x1a'));var db=require(_0x5fc0('0x1b'))['db'];function respondWithStatusCode(_0x22fa49,_0x1ba786){_0x1ba786=_0x1ba786||0xcc;return function(_0x470dfa){if(_0x470dfa){return _0x22fa49[_0x5fc0('0x1c')](_0x1ba786);}return _0x22fa49[_0x5fc0('0x1d')](_0x1ba786)[_0x5fc0('0x1e')]();};}function respondWithResult(_0x401cf0,_0xe3b3){_0xe3b3=_0xe3b3||0xc8;return function(_0x3facb2){if(_0x3facb2){return _0x401cf0[_0x5fc0('0x1d')](_0xe3b3)[_0x5fc0('0x1f')](_0x3facb2);}};}function respondWithFilteredResult(_0x7fce18,_0x9a10){return function(_0x4c06eb){if(_0x4c06eb){var _0x1f9f7a=_0x4c06eb[_0x5fc0('0x20')],_0x57143d=_0x9a10[_0x5fc0('0x21')],_0x2bd813=_0x9a10[_0x5fc0('0x21')]+_0x9a10[_0x5fc0('0x22')],_0x4d11b9;if(_0x2bd813>=_0x1f9f7a){_0x2bd813=_0x1f9f7a;_0x4d11b9=0xc8;}else{_0x4d11b9=0xce;}_0x7fce18['status'](_0x4d11b9);return _0x7fce18['set'](_0x5fc0('0x23'),_0x57143d+'-'+_0x2bd813+'/'+_0x1f9f7a)[_0x5fc0('0x1f')](_0x4c06eb);}return null;};}function patchUpdates(_0x18e316){return function(_0x49e13d){try{jsonpatch[_0x5fc0('0x24')](_0x49e13d,_0x18e316,!![]);}catch(_0x309620){return BPromise[_0x5fc0('0x25')](_0x309620);}return _0x49e13d[_0x5fc0('0x26')]();};}function saveUpdates(_0x7b193e,_0x21868b){return function(_0x53912b){if(_0x53912b){return _0x53912b[_0x5fc0('0x27')](_0x7b193e)['then'](function(_0x4daf54){return _0x4daf54;});}return null;};}function removeEntity(_0x129e26,_0x7514b0){return function(_0x16c2b1){if(_0x16c2b1){return _0x16c2b1[_0x5fc0('0x28')]()[_0x5fc0('0x29')](function(){var _0x5c9dc1=_0x16c2b1['get']({'plain':!![]});var _0x2c6a9e=_0x5fc0('0x2a');return db[_0x5fc0('0x2b')][_0x5fc0('0x28')]({'where':{'type':_0x2c6a9e,'resourceId':_0x5c9dc1['id']}})['then'](function(){return _0x16c2b1;});})[_0x5fc0('0x29')](function(){_0x129e26[_0x5fc0('0x1d')](0xcc)[_0x5fc0('0x1e')]();});}};}function handleEntityNotFound(_0x4038f6,_0x1ad2e9){return function(_0x44679f){if(!_0x44679f){_0x4038f6[_0x5fc0('0x1c')](0x194);}return _0x44679f;};}function handleError(_0xa3007e,_0x4db05f){_0x4db05f=_0x4db05f||0x1f4;return function(_0x245859){logger[_0x5fc0('0x2c')](_0x245859[_0x5fc0('0x2d')]);if(_0x245859['name']){delete _0x245859[_0x5fc0('0x2e')];}_0xa3007e[_0x5fc0('0x1d')](_0x4db05f)['send'](_0x245859);};}exports['index']=function(_0x4890b9,_0x1030d4){var _0x2b1362={},_0x5eb9a1={},_0x408d43={'count':0x0,'rows':[]};return db[_0x5fc0('0x2f')][_0x5fc0('0x30')]()['then'](function(_0x2a1ad7){_0x5eb9a1[_0x5fc0('0x31')]=_[_0x5fc0('0x32')](_0x2a1ad7);_0x5eb9a1['query']=_[_0x5fc0('0x32')](_0x4890b9[_0x5fc0('0x33')]);_0x5eb9a1[_0x5fc0('0x34')]=_[_0x5fc0('0x35')](_0x5eb9a1[_0x5fc0('0x31')],_0x5eb9a1['query']);_0x2b1362[_0x5fc0('0x36')]=_[_0x5fc0('0x35')](_0x5eb9a1[_0x5fc0('0x31')],qs[_0x5fc0('0x37')](_0x4890b9[_0x5fc0('0x33')][_0x5fc0('0x37')]));_0x2b1362[_0x5fc0('0x36')]=_0x2b1362[_0x5fc0('0x36')][_0x5fc0('0x38')]?_0x2b1362[_0x5fc0('0x36')]:_0x5eb9a1['model'];if(!_0x4890b9[_0x5fc0('0x33')][_0x5fc0('0x39')](_0x5fc0('0x3a'))){_0x2b1362[_0x5fc0('0x22')]=qs[_0x5fc0('0x22')](_0x4890b9['query'][_0x5fc0('0x22')]);_0x2b1362[_0x5fc0('0x21')]=qs[_0x5fc0('0x21')](_0x4890b9[_0x5fc0('0x33')]['offset']);}_0x2b1362[_0x5fc0('0x3b')]=qs[_0x5fc0('0x3c')](_0x4890b9[_0x5fc0('0x33')][_0x5fc0('0x3c')]);_0x2b1362[_0x5fc0('0x3d')]=qs[_0x5fc0('0x34')](_[_0x5fc0('0x3e')](_0x4890b9[_0x5fc0('0x33')],_0x5eb9a1[_0x5fc0('0x34')]),_0x2a1ad7);if(_0x4890b9[_0x5fc0('0x33')][_0x5fc0('0x3f')]){_0x2b1362[_0x5fc0('0x3d')]=_[_0x5fc0('0x40')](_0x2b1362[_0x5fc0('0x3d')],{'$or':_[_0x5fc0('0x41')](_0x2b1362[_0x5fc0('0x36')],function(_0x3afaef){var _0x3c6740={};_0x3c6740[_0x3afaef]={'$like':'%'+_0x4890b9['query'][_0x5fc0('0x3f')]+'%'};return _0x3c6740;})});}_0x2b1362=_[_0x5fc0('0x40')]({},_0x2b1362,_0x4890b9['options']);var _0x31503b={'where':_0x2b1362[_0x5fc0('0x3d')]};return db[_0x5fc0('0x2f')][_0x5fc0('0x20')](_0x31503b)['then'](function(_0x40e6d5){_0x408d43[_0x5fc0('0x20')]=_0x40e6d5;if(_0x4890b9[_0x5fc0('0x33')][_0x5fc0('0x42')]){_0x2b1362[_0x5fc0('0x43')]=[{'all':!![]}];}return db['CmCompany']['findAll'](_0x2b1362);})['then'](function(_0x38c72f){_0x408d43[_0x5fc0('0x44')]=_0x38c72f;return _0x408d43;})[_0x5fc0('0x29')](respondWithFilteredResult(_0x1030d4,_0x2b1362))[_0x5fc0('0x45')](handleError(_0x1030d4,null));})['catch'](handleError(_0x1030d4,null));};exports[_0x5fc0('0x46')]=function(_0x1d8a96,_0x36c503){var _0x2899b2={'raw':![],'where':{'id':_0x1d8a96[_0x5fc0('0x47')]['id']}},_0xd93bcf={};_0xd93bcf['model']=_['keys'](db[_0x5fc0('0x2f')][_0x5fc0('0x48')]);_0xd93bcf[_0x5fc0('0x33')]=_['keys'](_0x1d8a96[_0x5fc0('0x33')]);_0xd93bcf[_0x5fc0('0x34')]=_[_0x5fc0('0x35')](_0xd93bcf['model'],_0xd93bcf['query']);_0x2899b2['attributes']=_['intersection'](_0xd93bcf[_0x5fc0('0x31')],qs['fields'](_0x1d8a96['query'][_0x5fc0('0x37')]));_0x2899b2[_0x5fc0('0x36')]=_0x2899b2['attributes']['length']?_0x2899b2['attributes']:_0xd93bcf[_0x5fc0('0x31')];if(_0x1d8a96[_0x5fc0('0x33')][_0x5fc0('0x42')]){_0x2899b2[_0x5fc0('0x43')]=[{'all':!![]}];}_0x2899b2=_[_0x5fc0('0x40')]({},_0x2899b2,_0x1d8a96[_0x5fc0('0x49')]);return db[_0x5fc0('0x2f')][_0x5fc0('0x4a')](_0x2899b2)[_0x5fc0('0x29')](handleEntityNotFound(_0x36c503,null))[_0x5fc0('0x29')](respondWithResult(_0x36c503,null))[_0x5fc0('0x45')](handleError(_0x36c503,null));};exports[_0x5fc0('0x4b')]=function(_0x44ff91,_0x2f9f79){return db[_0x5fc0('0x2f')][_0x5fc0('0x4b')](_0x44ff91[_0x5fc0('0x4c')],{})['then'](function(_0x577e54){var _0x1c6b35=_0x44ff91[_0x5fc0('0x4d')][_0x5fc0('0x4e')]({'plain':!![]});if(!_0x1c6b35)throw new Error(_0x5fc0('0x4f'));if(_0x1c6b35[_0x5fc0('0x50')]===_0x5fc0('0x4d')){var _0x383022=_0x577e54[_0x5fc0('0x4e')]({'plain':!![]});var _0x3105ee=_0x5fc0('0x2a');return db['UserProfileSection'][_0x5fc0('0x4a')]({'where':{'name':_0x3105ee,'userProfileId':_0x1c6b35[_0x5fc0('0x51')]},'raw':!![]})['then'](function(_0x5688c4){if(_0x5688c4&&_0x5688c4['autoAssociation']===0x0){return db[_0x5fc0('0x2b')][_0x5fc0('0x4b')]({'name':_0x383022['name'],'resourceId':_0x383022['id'],'type':_0x5688c4[_0x5fc0('0x2e')],'sectionId':_0x5688c4['id']},{})[_0x5fc0('0x29')](function(){return _0x577e54;});}else{return _0x577e54;}})[_0x5fc0('0x45')](function(_0x2abd21){logger[_0x5fc0('0x2c')](_0x5fc0('0x52'),_0x2abd21);throw _0x2abd21;});}return _0x577e54;})[_0x5fc0('0x29')](respondWithResult(_0x2f9f79,0xc9))[_0x5fc0('0x45')](handleError(_0x2f9f79,null));};exports[_0x5fc0('0x27')]=function(_0x323264,_0x5262c6){if(_0x323264[_0x5fc0('0x4c')]['id']){delete _0x323264['body']['id'];}return db[_0x5fc0('0x2f')][_0x5fc0('0x4a')]({'where':{'id':_0x323264['params']['id']}})[_0x5fc0('0x29')](handleEntityNotFound(_0x5262c6,null))[_0x5fc0('0x29')](saveUpdates(_0x323264['body'],null))[_0x5fc0('0x29')](respondWithResult(_0x5262c6,null))[_0x5fc0('0x45')](handleError(_0x5262c6,null));};exports[_0x5fc0('0x28')]=function(_0x1a2c46,_0x10d402){return db[_0x5fc0('0x2f')]['find']({'where':{'id':_0x1a2c46[_0x5fc0('0x47')]['id']}})[_0x5fc0('0x29')](handleEntityNotFound(_0x10d402,null))[_0x5fc0('0x29')](removeEntity(_0x10d402,null))[_0x5fc0('0x45')](handleError(_0x10d402,null));};exports[_0x5fc0('0x30')]=function(_0x26b30a,_0x55cc72){return db[_0x5fc0('0x2f')][_0x5fc0('0x30')]()['then'](respondWithResult(_0x55cc72,null))[_0x5fc0('0x45')](handleError(_0x55cc72,null));};exports[_0x5fc0('0x53')]=function(_0x3430cd,_0x526300,_0xcb005){return db[_0x5fc0('0x54')][_0x5fc0('0x4a')]({'where':{'id':_0x3430cd['params']['id']}})[_0x5fc0('0x29')](handleEntityNotFound(_0x526300,null))[_0x5fc0('0x29')](function(_0x433575){if(_0x433575){return _0x433575[_0x5fc0('0x53')](_0x3430cd['body'][_0x5fc0('0x55')],_[_0x5fc0('0x56')](_0x3430cd[_0x5fc0('0x4c')],[_0x5fc0('0x55'),'id'])||{});}})[_0x5fc0('0x29')](respondWithResult(_0x526300,null))[_0x5fc0('0x45')](handleError(_0x526300,null));};exports['getContacts']=function(_0x1fac26,_0x1b9e7c,_0x4b65ea){var _0x6a02de={};var _0x2597e2={};var _0x41e56b;var _0x479cba;return db[_0x5fc0('0x2f')][_0x5fc0('0x57')]({'where':{'id':_0x1fac26[_0x5fc0('0x47')]['id']}})['then'](handleEntityNotFound(_0x1b9e7c,null))[_0x5fc0('0x29')](function(_0x2d5c2b){if(_0x2d5c2b){_0x41e56b=_0x2d5c2b;_0x2597e2[_0x5fc0('0x31')]=_['keys'](db[_0x5fc0('0x54')][_0x5fc0('0x48')]);_0x2597e2[_0x5fc0('0x33')]=_[_0x5fc0('0x32')](_0x1fac26['query']);_0x2597e2[_0x5fc0('0x34')]=_[_0x5fc0('0x35')](_0x2597e2[_0x5fc0('0x31')],_0x2597e2[_0x5fc0('0x33')]);_0x6a02de[_0x5fc0('0x36')]=_[_0x5fc0('0x35')](_0x2597e2[_0x5fc0('0x31')],qs['fields'](_0x1fac26[_0x5fc0('0x33')][_0x5fc0('0x37')]));_0x6a02de['attributes']=_0x6a02de[_0x5fc0('0x36')][_0x5fc0('0x38')]?_0x6a02de[_0x5fc0('0x36')]:_0x2597e2[_0x5fc0('0x31')];_0x6a02de['order']=qs[_0x5fc0('0x3c')](_0x1fac26[_0x5fc0('0x33')][_0x5fc0('0x3c')]);_0x6a02de['where']=qs[_0x5fc0('0x34')](_[_0x5fc0('0x3e')](_0x1fac26[_0x5fc0('0x33')],_0x2597e2['filters']));if(_0x1fac26[_0x5fc0('0x33')][_0x5fc0('0x3f')]){_0x6a02de[_0x5fc0('0x3d')]=_[_0x5fc0('0x40')](_0x6a02de['where'],{'$or':_[_0x5fc0('0x41')](_0x6a02de['attributes'],function(_0x189e25){var _0xd7f29={};_0xd7f29[_0x189e25]={'$like':'%'+_0x1fac26[_0x5fc0('0x33')]['filter']+'%'};return _0xd7f29;})});}_0x6a02de=_[_0x5fc0('0x40')]({},_0x6a02de,_0x1fac26['options']);return _0x41e56b[_0x5fc0('0x58')](_0x6a02de);}})[_0x5fc0('0x29')](function(_0x4c3810){if(_0x4c3810){_0x479cba=_0x4c3810[_0x5fc0('0x38')];if(!_0x1fac26[_0x5fc0('0x33')][_0x5fc0('0x39')](_0x5fc0('0x3a'))){_0x6a02de['limit']=qs[_0x5fc0('0x22')](_0x1fac26[_0x5fc0('0x33')][_0x5fc0('0x22')]);_0x6a02de['offset']=qs[_0x5fc0('0x21')](_0x1fac26[_0x5fc0('0x33')][_0x5fc0('0x21')]);}return _0x41e56b[_0x5fc0('0x58')](_0x6a02de);}})['then'](function(_0x49bffc){if(_0x49bffc){return _0x49bffc?{'count':_0x479cba,'rows':_0x49bffc}:null;}})['then'](respondWithResult(_0x1b9e7c,null))['catch'](handleError(_0x1b9e7c,null));}; \ No newline at end of file +var _0x4766=['body','addContacts','ids','omit','getContacts','findOne','CmContact','nolimit','html-pdf','eml-format','rimraf','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','Companies','UserProfileResource','error','stack','name','send','CmCompany','describe','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','map','options','includeAll','include','findAll','rows','catch','params','rawAttributes','merge','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x443e72,_0x50737f){var _0x87c5e2=function(_0x58c87b){while(--_0x58c87b){_0x443e72['push'](_0x443e72['shift']());}};_0x87c5e2(++_0x50737f);}(_0x4766,0xb2));var _0x6476=function(_0x9afbc5,_0x356002){_0x9afbc5=_0x9afbc5-0x0;var _0x46e521=_0x4766[_0x9afbc5];return _0x46e521;};'use strict';var pdf=require(_0x6476('0x0'));var emlformat=require(_0x6476('0x1'));var rimraf=require(_0x6476('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6476('0x3'));var moment=require(_0x6476('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x6476('0x5'));var sox=require(_0x6476('0x6'));var csv=require(_0x6476('0x7'));var ejs=require(_0x6476('0x8'));var fs=require('fs');var _=require(_0x6476('0x9'));var squel=require(_0x6476('0xa'));var crypto=require(_0x6476('0xb'));var jsforce=require(_0x6476('0xc'));var deskjs=require(_0x6476('0xd'));var toCsv=require(_0x6476('0x7'));var querystring=require(_0x6476('0xe'));var Papa=require(_0x6476('0xf'));var Redis=require('ioredis');var authService=require(_0x6476('0x10'));var qs=require(_0x6476('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6476('0x12'));var logger=require('../../config/logger')(_0x6476('0x13'));var utils=require('../../config/utils');var config=require(_0x6476('0x14'));var licenseUtil=require(_0x6476('0x15'));var db=require(_0x6476('0x16'))['db'];function respondWithStatusCode(_0x10479e,_0x47446e){_0x47446e=_0x47446e||0xcc;return function(_0x6afd7f){if(_0x6afd7f){return _0x10479e[_0x6476('0x17')](_0x47446e);}return _0x10479e[_0x6476('0x18')](_0x47446e)[_0x6476('0x19')]();};}function respondWithResult(_0xc36627,_0x1b3f44){_0x1b3f44=_0x1b3f44||0xc8;return function(_0x34c642){if(_0x34c642){return _0xc36627[_0x6476('0x18')](_0x1b3f44)['json'](_0x34c642);}};}function respondWithFilteredResult(_0x2031d4,_0x3ea577){return function(_0x1317fa){if(_0x1317fa){var _0x2bd5f0=_0x1317fa[_0x6476('0x1a')],_0xda82f=_0x3ea577[_0x6476('0x1b')],_0x3d193a=_0x3ea577[_0x6476('0x1b')]+_0x3ea577['limit'],_0x2534a6;if(_0x3d193a>=_0x2bd5f0){_0x3d193a=_0x2bd5f0;_0x2534a6=0xc8;}else{_0x2534a6=0xce;}_0x2031d4[_0x6476('0x18')](_0x2534a6);return _0x2031d4['set'](_0x6476('0x1c'),_0xda82f+'-'+_0x3d193a+'/'+_0x2bd5f0)[_0x6476('0x1d')](_0x1317fa);}return null;};}function patchUpdates(_0x77cd22){return function(_0xea055a){try{jsonpatch[_0x6476('0x1e')](_0xea055a,_0x77cd22,!![]);}catch(_0x3ec5fd){return BPromise[_0x6476('0x1f')](_0x3ec5fd);}return _0xea055a[_0x6476('0x20')]();};}function saveUpdates(_0x54a909,_0x424dea){return function(_0x20cd02){if(_0x20cd02){return _0x20cd02[_0x6476('0x21')](_0x54a909)[_0x6476('0x22')](function(_0x424ef4){return _0x424ef4;});}return null;};}function removeEntity(_0x536061,_0x52841c){return function(_0x2e5e40){if(_0x2e5e40){return _0x2e5e40[_0x6476('0x23')]()[_0x6476('0x22')](function(){var _0x281164=_0x2e5e40['get']({'plain':!![]});var _0x47f51a=_0x6476('0x24');return db[_0x6476('0x25')][_0x6476('0x23')]({'where':{'type':_0x47f51a,'resourceId':_0x281164['id']}})[_0x6476('0x22')](function(){return _0x2e5e40;});})['then'](function(){_0x536061[_0x6476('0x18')](0xcc)[_0x6476('0x19')]();});}};}function handleEntityNotFound(_0x59578c,_0x20d96a){return function(_0x5d07f4){if(!_0x5d07f4){_0x59578c['sendStatus'](0x194);}return _0x5d07f4;};}function handleError(_0x4ede8a,_0x3d28a0){_0x3d28a0=_0x3d28a0||0x1f4;return function(_0x160610){logger[_0x6476('0x26')](_0x160610[_0x6476('0x27')]);if(_0x160610['name']){delete _0x160610[_0x6476('0x28')];}_0x4ede8a['status'](_0x3d28a0)[_0x6476('0x29')](_0x160610);};}exports['index']=function(_0x4bcee9,_0x7f9f53){var _0x179694={},_0x393e83={},_0x29a81e={'count':0x0,'rows':[]};return db[_0x6476('0x2a')][_0x6476('0x2b')]()[_0x6476('0x22')](function(_0x505de1){_0x393e83['model']=_[_0x6476('0x2c')](_0x505de1);_0x393e83[_0x6476('0x2d')]=_['keys'](_0x4bcee9[_0x6476('0x2d')]);_0x393e83['filters']=_[_0x6476('0x2e')](_0x393e83[_0x6476('0x2f')],_0x393e83[_0x6476('0x2d')]);_0x179694[_0x6476('0x30')]=_[_0x6476('0x2e')](_0x393e83['model'],qs[_0x6476('0x31')](_0x4bcee9[_0x6476('0x2d')][_0x6476('0x31')]));_0x179694[_0x6476('0x30')]=_0x179694['attributes'][_0x6476('0x32')]?_0x179694[_0x6476('0x30')]:_0x393e83[_0x6476('0x2f')];if(!_0x4bcee9[_0x6476('0x2d')][_0x6476('0x33')]('nolimit')){_0x179694[_0x6476('0x34')]=qs[_0x6476('0x34')](_0x4bcee9[_0x6476('0x2d')][_0x6476('0x34')]);_0x179694[_0x6476('0x1b')]=qs[_0x6476('0x1b')](_0x4bcee9[_0x6476('0x2d')][_0x6476('0x1b')]);}_0x179694[_0x6476('0x35')]=qs[_0x6476('0x36')](_0x4bcee9[_0x6476('0x2d')][_0x6476('0x36')]);_0x179694[_0x6476('0x37')]=qs[_0x6476('0x38')](_[_0x6476('0x39')](_0x4bcee9[_0x6476('0x2d')],_0x393e83['filters']),_0x505de1);if(_0x4bcee9[_0x6476('0x2d')][_0x6476('0x3a')]){_0x179694[_0x6476('0x37')]=_['merge'](_0x179694['where'],{'$or':_[_0x6476('0x3b')](_0x179694[_0x6476('0x30')],function(_0x111d1e){var _0x28e653={};_0x28e653[_0x111d1e]={'$like':'%'+_0x4bcee9[_0x6476('0x2d')][_0x6476('0x3a')]+'%'};return _0x28e653;})});}_0x179694=_['merge']({},_0x179694,_0x4bcee9[_0x6476('0x3c')]);var _0x205eef={'where':_0x179694['where']};return db[_0x6476('0x2a')][_0x6476('0x1a')](_0x205eef)[_0x6476('0x22')](function(_0x39103f){_0x29a81e[_0x6476('0x1a')]=_0x39103f;if(_0x4bcee9[_0x6476('0x2d')][_0x6476('0x3d')]){_0x179694[_0x6476('0x3e')]=[{'all':!![]}];}return db[_0x6476('0x2a')][_0x6476('0x3f')](_0x179694);})[_0x6476('0x22')](function(_0x41bde2){_0x29a81e[_0x6476('0x40')]=_0x41bde2;return _0x29a81e;})[_0x6476('0x22')](respondWithFilteredResult(_0x7f9f53,_0x179694))[_0x6476('0x41')](handleError(_0x7f9f53,null));})['catch'](handleError(_0x7f9f53,null));};exports['show']=function(_0x424730,_0xc2d849){var _0x1366a8={'raw':![],'where':{'id':_0x424730[_0x6476('0x42')]['id']}},_0x1da57b={};_0x1da57b[_0x6476('0x2f')]=_[_0x6476('0x2c')](db[_0x6476('0x2a')][_0x6476('0x43')]);_0x1da57b[_0x6476('0x2d')]=_[_0x6476('0x2c')](_0x424730[_0x6476('0x2d')]);_0x1da57b[_0x6476('0x38')]=_['intersection'](_0x1da57b[_0x6476('0x2f')],_0x1da57b[_0x6476('0x2d')]);_0x1366a8[_0x6476('0x30')]=_[_0x6476('0x2e')](_0x1da57b[_0x6476('0x2f')],qs[_0x6476('0x31')](_0x424730['query']['fields']));_0x1366a8[_0x6476('0x30')]=_0x1366a8[_0x6476('0x30')]['length']?_0x1366a8[_0x6476('0x30')]:_0x1da57b['model'];if(_0x424730[_0x6476('0x2d')]['includeAll']){_0x1366a8[_0x6476('0x3e')]=[{'all':!![]}];}_0x1366a8=_[_0x6476('0x44')]({},_0x1366a8,_0x424730[_0x6476('0x3c')]);return db[_0x6476('0x2a')][_0x6476('0x45')](_0x1366a8)['then'](handleEntityNotFound(_0xc2d849,null))[_0x6476('0x22')](respondWithResult(_0xc2d849,null))['catch'](handleError(_0xc2d849,null));};exports[_0x6476('0x46')]=function(_0x1a10b5,_0xb6a222){return db[_0x6476('0x2a')][_0x6476('0x46')](_0x1a10b5['body'],{})[_0x6476('0x22')](function(_0x3f9e79){var _0x526daa=_0x1a10b5[_0x6476('0x47')][_0x6476('0x48')]({'plain':!![]});if(!_0x526daa)throw new Error(_0x6476('0x49'));if(_0x526daa['role']==='user'){var _0x1763d5=_0x3f9e79['get']({'plain':!![]});var _0x10fad3=_0x6476('0x24');return db['UserProfileSection'][_0x6476('0x45')]({'where':{'name':_0x10fad3,'userProfileId':_0x526daa[_0x6476('0x4a')]},'raw':!![]})[_0x6476('0x22')](function(_0x3f4d76){if(_0x3f4d76&&_0x3f4d76[_0x6476('0x4b')]===0x0){return db[_0x6476('0x25')]['create']({'name':_0x1763d5[_0x6476('0x28')],'resourceId':_0x1763d5['id'],'type':_0x3f4d76[_0x6476('0x28')],'sectionId':_0x3f4d76['id']},{})[_0x6476('0x22')](function(){return _0x3f9e79;});}else{return _0x3f9e79;}})[_0x6476('0x41')](function(_0x67e347){logger[_0x6476('0x26')](_0x6476('0x4c'),_0x67e347);throw _0x67e347;});}return _0x3f9e79;})[_0x6476('0x22')](respondWithResult(_0xb6a222,0xc9))[_0x6476('0x41')](handleError(_0xb6a222,null));};exports[_0x6476('0x21')]=function(_0x5960d5,_0x844bbd){if(_0x5960d5[_0x6476('0x4d')]['id']){delete _0x5960d5[_0x6476('0x4d')]['id'];}return db[_0x6476('0x2a')][_0x6476('0x45')]({'where':{'id':_0x5960d5[_0x6476('0x42')]['id']}})['then'](handleEntityNotFound(_0x844bbd,null))[_0x6476('0x22')](saveUpdates(_0x5960d5[_0x6476('0x4d')],null))[_0x6476('0x22')](respondWithResult(_0x844bbd,null))[_0x6476('0x41')](handleError(_0x844bbd,null));};exports[_0x6476('0x23')]=function(_0x1f1989,_0x5624fa){return db[_0x6476('0x2a')][_0x6476('0x45')]({'where':{'id':_0x1f1989['params']['id']}})[_0x6476('0x22')](handleEntityNotFound(_0x5624fa,null))[_0x6476('0x22')](removeEntity(_0x5624fa,null))[_0x6476('0x41')](handleError(_0x5624fa,null));};exports[_0x6476('0x2b')]=function(_0x872dd1,_0x1cb216){return db[_0x6476('0x2a')][_0x6476('0x2b')]()['then'](respondWithResult(_0x1cb216,null))[_0x6476('0x41')](handleError(_0x1cb216,null));};exports[_0x6476('0x4e')]=function(_0x4901d6,_0x4cebdb,_0x597617){return db['CmContact'][_0x6476('0x45')]({'where':{'id':_0x4901d6[_0x6476('0x42')]['id']}})['then'](handleEntityNotFound(_0x4cebdb,null))['then'](function(_0x4571ed){if(_0x4571ed){return _0x4571ed['addContacts'](_0x4901d6['body'][_0x6476('0x4f')],_[_0x6476('0x50')](_0x4901d6[_0x6476('0x4d')],['ids','id'])||{});}})[_0x6476('0x22')](respondWithResult(_0x4cebdb,null))[_0x6476('0x41')](handleError(_0x4cebdb,null));};exports[_0x6476('0x51')]=function(_0x4f0541,_0x16522c,_0xaea7c7){var _0x175f56={};var _0x29c2e8={};var _0x1c00f0;var _0x34244c;return db[_0x6476('0x2a')][_0x6476('0x52')]({'where':{'id':_0x4f0541[_0x6476('0x42')]['id']}})[_0x6476('0x22')](handleEntityNotFound(_0x16522c,null))['then'](function(_0x1558bb){if(_0x1558bb){_0x1c00f0=_0x1558bb;_0x29c2e8[_0x6476('0x2f')]=_[_0x6476('0x2c')](db[_0x6476('0x53')]['rawAttributes']);_0x29c2e8['query']=_['keys'](_0x4f0541[_0x6476('0x2d')]);_0x29c2e8['filters']=_[_0x6476('0x2e')](_0x29c2e8[_0x6476('0x2f')],_0x29c2e8[_0x6476('0x2d')]);_0x175f56[_0x6476('0x30')]=_[_0x6476('0x2e')](_0x29c2e8[_0x6476('0x2f')],qs[_0x6476('0x31')](_0x4f0541[_0x6476('0x2d')][_0x6476('0x31')]));_0x175f56['attributes']=_0x175f56[_0x6476('0x30')]['length']?_0x175f56[_0x6476('0x30')]:_0x29c2e8[_0x6476('0x2f')];_0x175f56[_0x6476('0x35')]=qs['sort'](_0x4f0541[_0x6476('0x2d')][_0x6476('0x36')]);_0x175f56[_0x6476('0x37')]=qs['filters'](_[_0x6476('0x39')](_0x4f0541['query'],_0x29c2e8[_0x6476('0x38')]));if(_0x4f0541['query'][_0x6476('0x3a')]){_0x175f56[_0x6476('0x37')]=_[_0x6476('0x44')](_0x175f56[_0x6476('0x37')],{'$or':_[_0x6476('0x3b')](_0x175f56['attributes'],function(_0x44abda){var _0x170284={};_0x170284[_0x44abda]={'$like':'%'+_0x4f0541[_0x6476('0x2d')][_0x6476('0x3a')]+'%'};return _0x170284;})});}_0x175f56=_[_0x6476('0x44')]({},_0x175f56,_0x4f0541[_0x6476('0x3c')]);return _0x1c00f0['getContacts'](_0x175f56);}})['then'](function(_0x3d1140){if(_0x3d1140){_0x34244c=_0x3d1140['length'];if(!_0x4f0541['query']['hasOwnProperty'](_0x6476('0x54'))){_0x175f56[_0x6476('0x34')]=qs['limit'](_0x4f0541['query'][_0x6476('0x34')]);_0x175f56[_0x6476('0x1b')]=qs[_0x6476('0x1b')](_0x4f0541[_0x6476('0x2d')][_0x6476('0x1b')]);}return _0x1c00f0[_0x6476('0x51')](_0x175f56);}})['then'](function(_0x57b76f){if(_0x57b76f){return _0x57b76f?{'count':_0x34244c,'rows':_0x57b76f}:null;}})['then'](respondWithResult(_0x16522c,null))['catch'](handleError(_0x16522c,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index ef4d080..66a3167 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 _0xe015=['lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./cmCompany.attributes','cm_companies'];(function(_0x4a1850,_0x21e229){var _0x464a80=function(_0x37feb7){while(--_0x37feb7){_0x4a1850['push'](_0x4a1850['shift']());}};_0x464a80(++_0x21e229);}(_0xe015,0x13b));var _0x5e01=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xe015[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var logger=require(_0x5e01('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5e01('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e01('0x4'));var rimraf=require(_0x5e01('0x5'));var config=require(_0x5e01('0x6'));var attributes=require(_0x5e01('0x7'));module['exports']=function(_0x1814cb,_0x3d2da2){return _0x1814cb['define']('CmCompany',attributes,{'tableName':_0x5e01('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b19=['api','moment','request-promise','path','rimraf','./cmCompany.attributes','exports','define','cm_companies','lodash','../../config/logger'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4b19,0x195));var _0x94b1=function(_0x2bae44,_0x33f37a){_0x2bae44=_0x2bae44-0x0;var _0x1e111b=_0x4b19[_0x2bae44];return _0x1e111b;};'use strict';var _=require(_0x94b1('0x0'));var util=require('util');var logger=require(_0x94b1('0x1'))(_0x94b1('0x2'));var moment=require(_0x94b1('0x3'));var BPromise=require('bluebird');var rp=require(_0x94b1('0x4'));var fs=require('fs');var path=require(_0x94b1('0x5'));var rimraf=require(_0x94b1('0x6'));var config=require('../../config/environment');var attributes=require(_0x94b1('0x7'));module[_0x94b1('0x8')]=function(_0x52d6c1,_0x24df76){return _0x52d6c1[_0x94b1('0x9')]('CmCompany',attributes,{'tableName':_0x94b1('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 8f4c267..e3c2e4e 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 _0x4522=['http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x4b466d,_0x4d140d){var _0x165fbb=function(_0x161257){while(--_0x161257){_0x4b466d['push'](_0x4b466d['shift']());}};_0x165fbb(++_0x4d140d);}(_0x4522,0x172));var _0x2452=function(_0x347ac1,_0x412f83){_0x347ac1=_0x347ac1-0x0;var _0x272b00=_0x4522[_0x347ac1];return _0x272b00;};'use strict';var _=require(_0x2452('0x0'));var util=require('util');var moment=require(_0x2452('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2452('0x2'));var db=require(_0x2452('0x3'))['db'];var utils=require(_0x2452('0x4'));var logger=require('../../config/logger')(_0x2452('0x5'));var config=require('../../config/environment');var jayson=require(_0x2452('0x6'));var client=jayson[_0x2452('0x7')][_0x2452('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x533338,_0x4ba430,_0xff4cf5){return new BPromise(function(_0x1b946a,_0x57fe61){return client[_0x2452('0x9')](_0x533338,_0xff4cf5)[_0x2452('0xa')](function(_0xf468b5){logger['info'](_0x2452('0xb'),_0x4ba430,_0x2452('0xc'));logger[_0x2452('0xd')](_0x2452('0xe'),_0x4ba430,_0x2452('0xc'),JSON[_0x2452('0xf')](_0xf468b5));if(_0xf468b5['error']){if(_0xf468b5[_0x2452('0x10')][_0x2452('0x11')]===0x1f4){logger[_0x2452('0x10')]('CmCompany,\x20%s,\x20%s',_0x4ba430,_0xf468b5['error'][_0x2452('0x12')]);return _0x57fe61(_0xf468b5[_0x2452('0x10')][_0x2452('0x12')]);}logger[_0x2452('0x10')](_0x2452('0xb'),_0x4ba430,_0xf468b5[_0x2452('0x10')][_0x2452('0x12')]);return _0x1b946a(_0xf468b5[_0x2452('0x10')][_0x2452('0x12')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x4ba430,_0x2452('0xc'));_0x1b946a(_0xf468b5[_0x2452('0x13')][_0x2452('0x12')]);}})[_0x2452('0x14')](function(_0xcd7b13){logger[_0x2452('0x10')](_0x2452('0xb'),_0x4ba430,_0xcd7b13);_0x57fe61(_0xcd7b13);});});} \ No newline at end of file +var _0x3363=['message','CmCompany,\x20%s,\x20%s','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x585d09,_0x1274bc){var _0x7d9a14=function(_0x343d4e){while(--_0x343d4e){_0x585d09['push'](_0x585d09['shift']());}};_0x7d9a14(++_0x1274bc);}(_0x3363,0xc0));var _0x3336=function(_0x4cfea7,_0x1c81c0){_0x4cfea7=_0x4cfea7-0x0;var _0x10d2d9=_0x3363[_0x4cfea7];return _0x10d2d9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3336('0x0'));var BPromise=require(_0x3336('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3336('0x2'));var db=require(_0x3336('0x3'))['db'];var utils=require(_0x3336('0x4'));var logger=require(_0x3336('0x5'))(_0x3336('0x6'));var config=require(_0x3336('0x7'));var jayson=require(_0x3336('0x8'));var client=jayson[_0x3336('0x9')][_0x3336('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1dc275,_0x7e1665,_0xa21ff6){return new BPromise(function(_0x3841fc,_0x178df0){return client['request'](_0x1dc275,_0xa21ff6)[_0x3336('0xb')](function(_0x208186){logger[_0x3336('0xc')]('CmCompany,\x20%s,\x20%s',_0x7e1665,'request\x20sent');logger['debug'](_0x3336('0xd'),_0x7e1665,_0x3336('0xe'),JSON[_0x3336('0xf')](_0x208186));if(_0x208186[_0x3336('0x10')]){if(_0x208186[_0x3336('0x10')][_0x3336('0x11')]===0x1f4){logger[_0x3336('0x10')]('CmCompany,\x20%s,\x20%s',_0x7e1665,_0x208186[_0x3336('0x10')]['message']);return _0x178df0(_0x208186[_0x3336('0x10')][_0x3336('0x12')]);}logger[_0x3336('0x10')]('CmCompany,\x20%s,\x20%s',_0x7e1665,_0x208186[_0x3336('0x10')][_0x3336('0x12')]);return _0x3841fc(_0x208186[_0x3336('0x10')][_0x3336('0x12')]);}else{logger[_0x3336('0xc')](_0x3336('0x13'),_0x7e1665,_0x3336('0xe'));_0x3841fc(_0x208186['result'][_0x3336('0x12')]);}})[_0x3336('0x14')](function(_0x332480){logger[_0x3336('0x10')](_0x3336('0x13'),_0x7e1665,_0x332480);_0x178df0(_0x332480);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index e096fca..d502271 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 _0xb44a=['/:id','show','post','/:id/contacts','addContacts','put','delete','exports','path','express','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2f2536,_0x3c43f3){var _0x4701b3=function(_0x55d537){while(--_0x55d537){_0x2f2536['push'](_0x2f2536['shift']());}};_0x4701b3(++_0x3c43f3);}(_0xb44a,0x1c2));var _0xab44=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xb44a[_0x49ca18];return _0x145d54;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xab44('0x0'));var timeout=require('connect-timeout');var express=require(_0xab44('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xab44('0x2'));var config=require('../../config/environment');var controller=require(_0xab44('0x3'));router[_0xab44('0x4')]('/',auth[_0xab44('0x5')](),controller[_0xab44('0x6')]);router[_0xab44('0x4')](_0xab44('0x7'),auth[_0xab44('0x5')](),controller[_0xab44('0x8')]);router[_0xab44('0x4')](_0xab44('0x9'),auth[_0xab44('0x5')](),controller[_0xab44('0xa')]);router[_0xab44('0x4')]('/:id/contacts',auth[_0xab44('0x5')](),controller['getContacts']);router[_0xab44('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xab44('0xb')](_0xab44('0xc'),auth[_0xab44('0x5')](),controller[_0xab44('0xd')]);router[_0xab44('0xe')](_0xab44('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xab44('0xf')]('/:id',auth[_0xab44('0x5')](),controller['destroy']);module[_0xab44('0x10')]=router; \ No newline at end of file +var _0x8ace=['post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','describe','/:id/contacts','getContacts'];(function(_0xb0b263,_0x4f3326){var _0x1c49bf=function(_0x4049ce){while(--_0x4049ce){_0xb0b263['push'](_0xb0b263['shift']());}};_0x1c49bf(++_0x4f3326);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x3b3750,_0x28f3b8){_0x3b3750=_0x3b3750-0x0;var _0x1b9e8b=_0x8ace[_0x3b3750];return _0x1b9e8b;};'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')]('/describe',auth[_0xe8ac('0xb')](),controller[_0xe8ac('0xd')]);router['get']('/:id',auth[_0xe8ac('0xb')](),controller['show']);router[_0xe8ac('0xa')](_0xe8ac('0xe'),auth[_0xe8ac('0xb')](),controller[_0xe8ac('0xf')]);router[_0xe8ac('0x10')]('/',auth[_0xe8ac('0xb')](),controller['create']);router[_0xe8ac('0x10')](_0xe8ac('0xe'),auth[_0xe8ac('0xb')](),controller['addContacts']);router[_0xe8ac('0x11')](_0xe8ac('0x12'),auth['isAuthenticated'](),controller[_0xe8ac('0x13')]);router[_0xe8ac('0x14')](_0xe8ac('0x12'),auth[_0xe8ac('0xb')](),controller[_0xe8ac('0x15')]);module[_0xe8ac('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 75a43b8..eec3428 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 _0x12af=['INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','STRING','TEXT'];(function(_0xe73161,_0x296347){var _0x54e94b=function(_0x57d1b2){while(--_0x57d1b2){_0xe73161['push'](_0xe73161['shift']());}};_0x54e94b(++_0x296347);}(_0x12af,0x1cc));var _0xf12a=function(_0x54ef43,_0x308497){_0x54ef43=_0x54ef43-0x0;var _0x4e3816=_0x12af[_0x54ef43];return _0x4e3816;};'use strict';var _=require(_0xf12a('0x0'));var Sequelize=require(_0xf12a('0x1'));module['exports']={'firstName':{'type':Sequelize[_0xf12a('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xf12a('0x2')]},'street':{'type':Sequelize[_0xf12a('0x2')]},'postalCode':{'type':Sequelize[_0xf12a('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xf12a('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf12a('0x3')]},'phone':{'type':Sequelize[_0xf12a('0x2')]},'mobile':{'type':Sequelize[_0xf12a('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xf12a('0x2')]},'url':{'type':Sequelize[_0xf12a('0x2')]},'facebook':{'type':Sequelize[_0xf12a('0x2')]},'fb_data':{'type':Sequelize[_0xf12a('0x2')]},'twitter':{'type':Sequelize[_0xf12a('0x2')]},'skype':{'type':Sequelize[_0xf12a('0x2')]},'teams':{'type':Sequelize[_0xf12a('0x2')]},'viber':{'type':Sequelize[_0xf12a('0x2')]},'line':{'type':Sequelize[_0xf12a('0x2')]},'wechat':{'type':Sequelize[_0xf12a('0x2')]},'telegram':{'type':Sequelize[_0xf12a('0x2')]},'UserId':{'type':Sequelize[_0xf12a('0x4')]},'priority':{'type':Sequelize[_0xf12a('0x4')](0x2)[_0xf12a('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xf12a('0x6')],'defaultValue':Sequelize[_0xf12a('0x7')]}}; \ No newline at end of file +var _0xc82e=['lodash','exports','STRING','UNSIGNED','DATE'];(function(_0x1acda8,_0x5c8b47){var _0x1c56be=function(_0x257202){while(--_0x257202){_0x1acda8['push'](_0x1acda8['shift']());}};_0x1c56be(++_0x5c8b47);}(_0xc82e,0xd2));var _0xec82=function(_0x19ccae,_0x51f642){_0x19ccae=_0x19ccae-0x0;var _0x19a3dd=_0xc82e[_0x19ccae];return _0x19a3dd;};'use strict';var _=require(_0xec82('0x0'));var Sequelize=require('sequelize');module[_0xec82('0x1')]={'firstName':{'type':Sequelize[_0xec82('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xec82('0x2')]},'street':{'type':Sequelize[_0xec82('0x2')]},'postalCode':{'type':Sequelize[_0xec82('0x2')]},'city':{'type':Sequelize[_0xec82('0x2')]},'country':{'type':Sequelize[_0xec82('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xec82('0x2')]},'mobile':{'type':Sequelize[_0xec82('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xec82('0x2')]},'url':{'type':Sequelize[_0xec82('0x2')]},'facebook':{'type':Sequelize[_0xec82('0x2')]},'fb_data':{'type':Sequelize[_0xec82('0x2')]},'twitter':{'type':Sequelize[_0xec82('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xec82('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xec82('0x2')]},'telegram':{'type':Sequelize[_0xec82('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xec82('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xec82('0x4')],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 1241cca..7b75a24 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 _0x9234=['GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','destroy','find','params','tags','columnName','displayName','findAll','alias','merge','body','get','mergeWith','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','info','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','MailQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','bulkCreate','each','duplicates','findOrCreate','show','omit','format','cf_%d','$and','pickBy','setFields','values','phone','CmHopper','getTags','findOne','rawAttributes','pick','setTags','getHoppers','options','includeAll','include','getHopperHistories','getHopperFinals','getJscriptySessions','ContactId','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','parse','import','binding','../../components/import/cm/csv2','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','channel','includes','toLowerCase','range','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','starttime','endtime','note','createdAt','userSecondDisposition','userThirdDisposition','fullname','DESC','VoiceCallReport','findAndCountAll','startCase','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','UserId','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','Interaction','reverse','slice','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','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','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','error','stack','name','send','index','CmContact','describe','keys','length','startsWith','cf_','push','CmCustomField','fieldType','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','field','color','from','select','cm_contacts','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','tools_tags','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','sqlOperator','conditions','Tag','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','DATE','buildExpression','type','start','isNil','Contact','ListId','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','filter','replace','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','isEmpty','having','role','agent','some','user','c.ListId\x20IS\x20NULL','sequelize','toString','c.firstName','c.lastName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.createdAt','c.CompanyId'];(function(_0x479e21,_0x385fd9){var _0x422e9c=function(_0x1dc4ca){while(--_0x1dc4ca){_0x479e21['push'](_0x479e21['shift']());}};_0x422e9c(++_0x385fd9);}(_0x9234,0x1bd));var _0x4923=function(_0x4706a6,_0x5a1c63){_0x4706a6=_0x4706a6-0x0;var _0x1bb705=_0x9234[_0x4706a6];return _0x1bb705;};'use strict';var pdf=require(_0x4923('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4923('0x1'));var zipdir=require(_0x4923('0x2'));var jsonpatch=require(_0x4923('0x3'));var rp=require(_0x4923('0x4'));var moment=require('moment');var BPromise=require(_0x4923('0x5'));var Mustache=require(_0x4923('0x6'));var util=require('util');var path=require(_0x4923('0x7'));var sox=require(_0x4923('0x8'));var csv=require(_0x4923('0x9'));var ejs=require(_0x4923('0xa'));var fs=require('fs');var _=require(_0x4923('0xb'));var squel=require(_0x4923('0xc'));var crypto=require(_0x4923('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4923('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4923('0xf'));var Papa=require(_0x4923('0x10'));var Redis=require(_0x4923('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4923('0x12'));var as=require(_0x4923('0x13'));var hardwareService=require(_0x4923('0x14'));var logger=require(_0x4923('0x15'))(_0x4923('0x16'));var utils=require(_0x4923('0x17'));var config=require(_0x4923('0x18'));var licenseUtil=require(_0x4923('0x19'));var db=require(_0x4923('0x1a'))['db'];config[_0x4923('0x1b')]=_['defaults'](config['redis'],{'host':_0x4923('0x1c'),'port':0x18eb});var socket=require(_0x4923('0x1d'))(new Redis(config[_0x4923('0x1b')]));require('./cmContact.socket')[_0x4923('0x1e')](socket);function respondWithStatusCode(_0x27a52b,_0x191257){_0x191257=_0x191257||0xcc;return function(_0x1716aa){if(_0x1716aa){return _0x27a52b[_0x4923('0x1f')](_0x191257);}return _0x27a52b[_0x4923('0x20')](_0x191257)[_0x4923('0x21')]();};}function respondWithResult(_0x2897da,_0x2e9944){_0x2e9944=_0x2e9944||0xc8;return function(_0x3fedc7){if(_0x3fedc7){return _0x2897da['status'](_0x2e9944)[_0x4923('0x22')](_0x3fedc7);}};}function respondWithFilteredResult(_0x260e53,_0x5dbb86){return function(_0x1be04d){if(_0x1be04d){var _0x517b95=_0x1be04d[_0x4923('0x23')],_0x50fd18=_0x5dbb86[_0x4923('0x24')],_0x16955b=_0x5dbb86['offset']+_0x5dbb86[_0x4923('0x25')],_0x4daed5;if(_0x16955b>=_0x517b95){_0x16955b=_0x517b95;_0x4daed5=0xc8;}else{_0x4daed5=0xce;}_0x260e53[_0x4923('0x20')](_0x4daed5);return _0x260e53[_0x4923('0x26')](_0x4923('0x27'),_0x50fd18+'-'+_0x16955b+'/'+_0x517b95)['json'](_0x1be04d);}return null;};}function patchUpdates(_0x3742d0){return function(_0x39039f){try{jsonpatch['apply'](_0x39039f,_0x3742d0,!![]);}catch(_0x43326e){return BPromise['reject'](_0x43326e);}return _0x39039f[_0x4923('0x28')]();};}function saveUpdates(_0x168bb4,_0x569b36){return function(_0x184f6a){if(_0x184f6a){return _0x184f6a[_0x4923('0x29')](_0x168bb4)[_0x4923('0x2a')](function(_0x161cf9){return _0x161cf9;});}return null;};}function removeEntity(_0x3aaede,_0x8a09e7){return function(_0x37aed2){if(_0x37aed2){return _0x37aed2['destroy']()['then'](function(){_0x3aaede[_0x4923('0x20')](0xcc)[_0x4923('0x21')]();});}};}function handleEntityNotFound(_0xdb893b,_0x32d508){return function(_0x2ea650){if(!_0x2ea650){_0xdb893b[_0x4923('0x1f')](0x194);}return _0x2ea650;};}function handleError(_0x13681b,_0x2c2a66){_0x2c2a66=_0x2c2a66||0x1f4;return function(_0x9982e8){logger[_0x4923('0x2b')](_0x9982e8[_0x4923('0x2c')]);if(_0x9982e8['name']){delete _0x9982e8[_0x4923('0x2d')];}_0x13681b[_0x4923('0x20')](_0x2c2a66)[_0x4923('0x2e')](_0x9982e8);};}exports[_0x4923('0x2f')]=function(_0x21c229,_0x47158c){var _0x158a30={},_0x7a97f3={},_0xb88ca4={'count':0x0,'rows':[]};return db[_0x4923('0x30')][_0x4923('0x31')]()[_0x4923('0x2a')](function(_0x140ecb){var _0x4184b2=[];for(var _0x53ce05=0x0;_0x53ce050x1){_0x9c58c1['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4923('0x6f')](_0x3981a9),null);}else{if(qs[_0x4923('0x70')](_0x3981a9)){_0x9c58c1['or'](_0x4923('0x71'),_0x3981a9+'%');_0x9c58c1['or'](_0x4923('0x72'),_0x3981a9+'%');_0x9c58c1['or'](_0x4923('0x73'),_0x3981a9+'%');_0x9c58c1['or'](_0x4923('0x74'),_0x3981a9+'%');}else if(qs[_0x4923('0x75')](_0x3981a9)){_0x9c58c1['or'](_0x4923('0x76'),_0x3981a9+'%');}else{_0x9c58c1['or']('c.firstName\x20LIKE\x20?','%'+_0x3981a9+'%');_0x9c58c1['or'](_0x4923('0x77'),'%'+_0x3981a9+'%');_0x9c58c1['or'](_0x4923('0x76'),'%'+_0x3981a9+'%');}}}}_0x15f0b2[_0x4923('0x42')](_0x9c58c1);_0x15f0b2[_0x4923('0x78')](_0x4923('0x79'));var _0x56de5d={'type':db[_0x4923('0x7a')][_0x4923('0x7b')][_0x4923('0x7c')],'raw':!![]};var _0x506cdc=_0x15f0b2['clone']()[_0x4923('0x44')](_0x4923('0x79'));if(_0x158a30['order']){_0x158a30['order'][_0x4923('0x59')](function(_0x2af427){_0x15f0b2[_0x4923('0x40')]('c.'+_0x2af427[0x0],_0x2af427[0x1]==='DESC'?![]:!![]);});}if(!_[_0x4923('0x7d')](_0x2e3edd)){_0x15f0b2[_0x4923('0x7e')](_0x2e09ca);_0x506cdc['where']('t.id\x20IN\x20?',_0x2e3edd);}BPromise['resolve']()[_0x4923('0x2a')](function(){if(!_0x26495c)return;if(_0x21c229['user'][_0x4923('0x7f')]!==_0x4923('0x80'))return;if(!_[_0x4923('0x81')](_0x26495c[_0x4923('0x54')],[_0x4923('0x44'),_0x4923('0x5c')])){return _0x21c229[_0x4923('0x82')]['getLists']({'attributes':['id'],'raw':!![]})[_0x4923('0x2a')](function(_0x3fd57a){if(_[_0x4923('0x7d')](_0x3fd57a)){_0x506cdc['where'](_0x4923('0x83'));_0x15f0b2[_0x4923('0x42')]('c.ListId\x20IS\x20NULL');}else{_0x506cdc[_0x4923('0x42')](_0x4923('0x68'),_[_0x4923('0x58')](_0x3fd57a,'id'));_0x15f0b2[_0x4923('0x42')]('c.ListId\x20IN\x20?',_[_0x4923('0x58')](_0x3fd57a,'id'));}});}})['then'](function(){if(_0x21c229[_0x4923('0x82')][_0x4923('0x7f')]==='agent'&&!_0x26495c&&!_0x21c229[_0x4923('0x3a')]['ListId'])return[];return db[_0x4923('0x84')][_0x4923('0x3a')](_0x506cdc[_0x4923('0x85')](),_0x56de5d);})['then'](function(_0x49e04a){_0xb88ca4[_0x4923('0x23')]=_0x49e04a['length'];if(_0xb88ca4['count']===0x0)return[];return db[_0x4923('0x84')][_0x4923('0x3a')](_0xd4a9f1[_0x4923('0x85')](),_0x56de5d)[_0x4923('0x2a')](function(_0x942cc8){_0x304139=_['keyBy'](_0x942cc8,'id');_0x56de5d=_['merge'](_0x56de5d,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x21c229['query'][_0x4923('0x3d')]){_0x158a30['attributes']['forEach'](function(_0x6ef528){_0x15f0b2['field']('c.'+_0x6ef528);});}else{_0x15f0b2['field'](_0x4923('0x79'));_0x15f0b2[_0x4923('0x44')](_0x4923('0x86'));_0x15f0b2[_0x4923('0x44')](_0x4923('0x87'));_0x15f0b2[_0x4923('0x44')](_0x4923('0x88'));_0x15f0b2[_0x4923('0x44')](_0x4923('0x89'));_0x15f0b2[_0x4923('0x44')](_0x4923('0x8a'));_0x15f0b2[_0x4923('0x44')](_0x4923('0x8b'));_0x15f0b2[_0x4923('0x44')](_0x4923('0x8c'));_0x15f0b2[_0x4923('0x44')](_0x4923('0x8d'));_0x15f0b2['field']('c.deletedAt');_0x15f0b2[_0x4923('0x44')](_0x4923('0x8e'));_0x15f0b2[_0x4923('0x44')](_0x4923('0x8f'),_0x4923('0x90'));}if(_0x158a30[_0x4923('0x25')])_0x15f0b2[_0x4923('0x25')](_0x158a30[_0x4923('0x25')]);if(_0x158a30['offset'])_0x15f0b2[_0x4923('0x24')](_0x158a30[_0x4923('0x24')]);return db[_0x4923('0x84')][_0x4923('0x3a')](_0x15f0b2[_0x4923('0x85')](),_0x56de5d);});})['then'](function(_0x4d111f){_0x4d111f[_0x4923('0x59')](function(_0x262f4e){if(_0x262f4e[_0x4923('0x90')]){_0x262f4e[_0x4923('0x91')]=[];_0x262f4e[_0x4923('0x90')]['split'](',')[_0x4923('0x59')](function(_0x424b64){_0x262f4e[_0x4923('0x91')][_0x4923('0x36')](_0x304139[_0x424b64]);});}delete _0x262f4e[_0x4923('0x90')];});_0xb88ca4[_0x4923('0x92')]=_0x4d111f;return _0xb88ca4;})[_0x4923('0x2a')](respondWithFilteredResult(_0x47158c,_0x158a30));})[_0x4923('0x93')](handleError(_0x47158c,null));};exports[_0x4923('0x94')]=function(_0x2a48bf,_0x12901d){return db[_0x4923('0x30')][_0x4923('0x95')]({'where':{'id':_0x2a48bf[_0x4923('0x96')]['id']}})[_0x4923('0x2a')](handleEntityNotFound(_0x12901d,null))[_0x4923('0x2a')](removeEntity(_0x12901d,null))[_0x4923('0x93')](handleError(_0x12901d,null));};exports[_0x4923('0x31')]=function(_0x41c526,_0x3628dd){return db[_0x4923('0x30')]['describe']()[_0x4923('0x2a')](function(_0x1fe7fc){delete _0x1fe7fc[_0x4923('0x97')];for(var _0x2a6dab=0x0;_0x2a6dab=_0x3678fc){_0x2f050b=_0x3678fc;_0x32061f=0xc8;}else{_0x32061f=0xce;}_0x154390[_0xe9c5('0x21')](_0x32061f);return _0x154390[_0xe9c5('0x25')]('Content-Range',_0x1cecae+'-'+_0x2f050b+'/'+_0x3678fc)['json'](_0x4d9c7d);}return null;};}function patchUpdates(_0xaa891){return function(_0x57818d){try{jsonpatch[_0xe9c5('0x26')](_0x57818d,_0xaa891,!![]);}catch(_0xc4d208){return BPromise[_0xe9c5('0x27')](_0xc4d208);}return _0x57818d[_0xe9c5('0x28')]();};}function saveUpdates(_0x5750ff,_0x391582){return function(_0x3f8bb9){if(_0x3f8bb9){return _0x3f8bb9[_0xe9c5('0x29')](_0x5750ff)[_0xe9c5('0x2a')](function(_0x34a7c8){return _0x34a7c8;});}return null;};}function removeEntity(_0x245161,_0x44ba59){return function(_0x155066){if(_0x155066){return _0x155066[_0xe9c5('0x2b')]()[_0xe9c5('0x2a')](function(){_0x245161['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x250e1c,_0x3dd39d){return function(_0x298dca){if(!_0x298dca){_0x250e1c[_0xe9c5('0x1f')](0x194);}return _0x298dca;};}function handleError(_0x33fe71,_0x100eda){_0x100eda=_0x100eda||0x1f4;return function(_0x493108){logger[_0xe9c5('0x2c')](_0x493108['stack']);if(_0x493108[_0xe9c5('0x2d')]){delete _0x493108['name'];}_0x33fe71[_0xe9c5('0x21')](_0x100eda)[_0xe9c5('0x2e')](_0x493108);};}exports['index']=function(_0x36d145,_0x46d253){var _0x334f5a={},_0x37cfa5={},_0x1fa0f6={'count':0x0,'rows':[]};return db['CmContact'][_0xe9c5('0x2f')]()['then'](function(_0x46d3e6){var _0x5088a6=[];for(var _0x348fee=0x0;_0x348fee0x1){_0x3c2f71['or'](_0xe9c5('0x6d'),qs['getFullTextValue'](_0x212a98),null);}else{if(qs[_0xe9c5('0x6e')](_0x212a98)){_0x3c2f71['or'](_0xe9c5('0x6f'),_0x212a98+'%');_0x3c2f71['or']('c.phone\x20LIKE\x20?',_0x212a98+'%');_0x3c2f71['or'](_0xe9c5('0x70'),_0x212a98+'%');_0x3c2f71['or']('c.fax\x20LIKE\x20?',_0x212a98+'%');}else if(qs[_0xe9c5('0x71')](_0x212a98)){_0x3c2f71['or'](_0xe9c5('0x72'),_0x212a98+'%');}else{_0x3c2f71['or'](_0xe9c5('0x73'),'%'+_0x212a98+'%');_0x3c2f71['or'](_0xe9c5('0x74'),'%'+_0x212a98+'%');_0x3c2f71['or'](_0xe9c5('0x72'),'%'+_0x212a98+'%');}}}}_0x3cc129[_0xe9c5('0x41')](_0x3c2f71);_0x3cc129[_0xe9c5('0x75')]('c.id');var _0x26b48b={'type':db[_0xe9c5('0x76')][_0xe9c5('0x77')]['SELECT'],'raw':!![]};var _0x377a0d=_0x3cc129['clone']()['field'](_0xe9c5('0x78'));if(_0x334f5a[_0xe9c5('0x3f')]){_0x334f5a[_0xe9c5('0x3f')][_0xe9c5('0x54')](function(_0x4712d1){_0x3cc129[_0xe9c5('0x3f')]('c.'+_0x4712d1[0x0],_0x4712d1[0x1]===_0xe9c5('0x79')?![]:!![]);});}if(!_[_0xe9c5('0x63')](_0x4488ba)){_0x3cc129[_0xe9c5('0x7a')](_0x2e8867);_0x377a0d[_0xe9c5('0x41')]('t.id\x20IN\x20?',_0x4488ba);}BPromise[_0xe9c5('0x7b')]()[_0xe9c5('0x2a')](function(){if(!_0xecc0c)return;if(_0x36d145[_0xe9c5('0x7c')][_0xe9c5('0x7d')]!==_0xe9c5('0x7e'))return;if(!_[_0xe9c5('0x7f')](_0xecc0c[_0xe9c5('0x4f')],[_0xe9c5('0x44'),_0xe9c5('0x56')])){return _0x36d145['user'][_0xe9c5('0x80')]({'attributes':['id'],'raw':!![]})[_0xe9c5('0x2a')](function(_0x41ac3e){if(_[_0xe9c5('0x63')](_0x41ac3e)){_0x377a0d[_0xe9c5('0x41')](_0xe9c5('0x81'));_0x3cc129[_0xe9c5('0x41')]('c.ListId\x20IS\x20NULL');}else{_0x377a0d[_0xe9c5('0x41')](_0xe9c5('0x64'),_[_0xe9c5('0x53')](_0x41ac3e,'id'));_0x3cc129[_0xe9c5('0x41')](_0xe9c5('0x64'),_['map'](_0x41ac3e,'id'));}});}})[_0xe9c5('0x2a')](function(){if(_0x36d145['user']['role']===_0xe9c5('0x7e')&&!_0xecc0c&&!_0x36d145[_0xe9c5('0x38')]['ListId'])return[];return db['sequelize'][_0xe9c5('0x38')](_0x377a0d['toString'](),_0x26b48b);})[_0xe9c5('0x2a')](function(_0x4155d4){_0x1fa0f6['count']=_0x4155d4[_0xe9c5('0x31')];if(_0x1fa0f6[_0xe9c5('0x82')]===0x0)return[];return db[_0xe9c5('0x83')][_0xe9c5('0x38')](_0x1fdf92[_0xe9c5('0x84')](),_0x26b48b)[_0xe9c5('0x2a')](function(_0x58b9b2){_0x3ede88=_[_0xe9c5('0x85')](_0x58b9b2,'id');_0x26b48b=_[_0xe9c5('0x86')](_0x26b48b,{'model':db[_0xe9c5('0x87')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x36d145[_0xe9c5('0x38')][_0xe9c5('0x3d')]){_0x334f5a[_0xe9c5('0x3c')]['forEach'](function(_0x394295){_0x3cc129[_0xe9c5('0x44')]('c.'+_0x394295);});}else{_0x3cc129['field'](_0xe9c5('0x78'));_0x3cc129[_0xe9c5('0x44')](_0xe9c5('0x88'));_0x3cc129[_0xe9c5('0x44')](_0xe9c5('0x89'));_0x3cc129[_0xe9c5('0x44')]('c.phone');_0x3cc129[_0xe9c5('0x44')]('c.mobile');_0x3cc129['field']('c.fax');_0x3cc129[_0xe9c5('0x44')](_0xe9c5('0x8a'));_0x3cc129[_0xe9c5('0x44')](_0xe9c5('0x8b'));_0x3cc129[_0xe9c5('0x44')](_0xe9c5('0x8c'));_0x3cc129['field'](_0xe9c5('0x8d'));_0x3cc129[_0xe9c5('0x44')](_0xe9c5('0x8e'));_0x3cc129[_0xe9c5('0x44')](_0xe9c5('0x8f'),'TagIds');}if(_0x334f5a['limit'])_0x3cc129[_0xe9c5('0x24')](_0x334f5a[_0xe9c5('0x24')]);if(_0x334f5a[_0xe9c5('0x23')])_0x3cc129[_0xe9c5('0x23')](_0x334f5a[_0xe9c5('0x23')]);return db['sequelize'][_0xe9c5('0x38')](_0x3cc129['toString'](),_0x26b48b);});})[_0xe9c5('0x2a')](function(_0x1867ad){_0x1867ad[_0xe9c5('0x54')](function(_0x524349){if(_0x524349['TagIds']){_0x524349['Tags']=[];_0x524349['TagIds']['split'](',')[_0xe9c5('0x54')](function(_0x29cb33){_0x524349[_0xe9c5('0x90')][_0xe9c5('0x33')](_0x3ede88[_0x29cb33]);});}delete _0x524349[_0xe9c5('0x91')];});_0x1fa0f6['rows']=_0x1867ad;return _0x1fa0f6;})[_0xe9c5('0x2a')](respondWithFilteredResult(_0x46d253,_0x334f5a));})['catch'](handleError(_0x46d253,null));};exports['destroy']=function(_0x1eadaf,_0x49bbc1){return db['CmContact']['find']({'where':{'id':_0x1eadaf[_0xe9c5('0x92')]['id']}})['then'](handleEntityNotFound(_0x49bbc1,null))[_0xe9c5('0x2a')](removeEntity(_0x49bbc1,null))['catch'](handleError(_0x49bbc1,null));};exports[_0xe9c5('0x2f')]=function(_0x1be32c,_0x34ca6a){return db[_0xe9c5('0x87')]['describe']()['then'](function(_0xdc740c){delete _0xdc740c[_0xe9c5('0x93')];for(var _0x1e7709=0x0;_0x1e7709{}\s\\|]/g,'-');_0x2fd1f2(null,util['format'](_0x0978('0x25'),path['basename'](_0x1ac591[_0x0978('0x23')],path['extname'](_0x1ac591[_0x0978('0x23')])),Date['now'](),path[_0x0978('0x26')](_0x1ac591['originalname'])));}})});router['post'](_0x0978('0x27'),upload[_0x0978('0x28')](_0x0978('0x29')),controller[_0x0978('0x2a')]);var upload=multer({'storage':multer[_0x0978('0x1f')]({'destination':function(_0x1fcb09,_0x3f5c6d,_0x39fff2){_0x39fff2(null,path[_0x0978('0x20')](config[_0x0978('0x21')],_0x0978('0x22')));},'filename':function(_0x46c522,_0x44422c,_0x1c1e6b){_0x44422c[_0x0978('0x23')]=_0x44422c[_0x0978('0x23')][_0x0978('0x24')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1c1e6b(null,util[_0x0978('0x2b')](_0x0978('0x25'),path['basename'](_0x44422c[_0x0978('0x23')],path['extname'](_0x44422c[_0x0978('0x23')])),Date[_0x0978('0x2c')](),path[_0x0978('0x26')](_0x44422c[_0x0978('0x23')])));}})});router[_0x0978('0x19')](_0x0978('0x2d'),upload[_0x0978('0x28')](_0x0978('0x29')),controller[_0x0978('0x2e')]);router[_0x0978('0x19')](_0x0978('0x2f'),auth[_0x0978('0x9')](),controller[_0x0978('0x30')]);router[_0x0978('0x31')](_0x0978('0xd'),auth[_0x0978('0x9')](),controller[_0x0978('0x32')]);router[_0x0978('0x33')]('/:id',auth[_0x0978('0x9')](),controller[_0x0978('0x34')]);module[_0x0978('0x35')]=router; \ No newline at end of file +var _0x261b=['/create_many','bulkCreate','setTags','diskStorage','join','root','server/files/tmp','originalname','replace','format','basename','extname','now','/csv','single','file','%s-%s%s','/upload','upload','/upload/:id','import','put','delete','destroy','multer','util','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','/:id/tags','getTags','/:id/hoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','getJscriptySessions','/:id/journey','getJourney','post','/merge','merge'];(function(_0x80f51a,_0x32e95e){var _0x327148=function(_0x16f788){while(--_0x16f788){_0x80f51a['push'](_0x80f51a['shift']());}};_0x327148(++_0x32e95e);}(_0x261b,0x15a));var _0xb261=function(_0x4bd569,_0x5c31bd){_0x4bd569=_0x4bd569-0x0;var _0x41074f=_0x261b[_0x4bd569];return _0x41074f;};'use strict';var multer=require(_0xb261('0x0'));var util=require(_0xb261('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xb261('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xb261('0x3'));var controller=require('./cmContact.controller');router[_0xb261('0x4')]('/',auth['isAuthenticated'](),controller[_0xb261('0x5')]);router[_0xb261('0x4')](_0xb261('0x6'),auth[_0xb261('0x7')](),controller['describe']);router[_0xb261('0x4')](_0xb261('0x8'),auth[_0xb261('0x7')](),controller[_0xb261('0x9')]);router['get'](_0xb261('0xa'),auth[_0xb261('0x7')](),controller[_0xb261('0xb')]);router[_0xb261('0x4')](_0xb261('0xc'),auth[_0xb261('0x7')](),controller['getHoppers']);router['get']('/:id/hopper_histories',auth[_0xb261('0x7')](),controller[_0xb261('0xd')]);router[_0xb261('0x4')](_0xb261('0xe'),auth[_0xb261('0x7')](),controller[_0xb261('0xf')]);router['get']('/:id/jscripty_sessions',auth[_0xb261('0x7')](),controller[_0xb261('0x10')]);router[_0xb261('0x4')](_0xb261('0x11'),auth[_0xb261('0x7')](),controller[_0xb261('0x12')]);router[_0xb261('0x13')](_0xb261('0x14'),auth[_0xb261('0x7')](),controller[_0xb261('0x15')]);router[_0xb261('0x13')]('/',auth[_0xb261('0x7')](),controller['create']);router[_0xb261('0x13')](_0xb261('0x16'),auth[_0xb261('0x7')](),controller[_0xb261('0x17')]);router['post'](_0xb261('0xa'),auth[_0xb261('0x7')](),controller[_0xb261('0x18')]);var upload=multer({'storage':multer[_0xb261('0x19')]({'destination':function(_0x38d35d,_0x19c9f2,_0x3a9f9f){_0x3a9f9f(null,path[_0xb261('0x1a')](config[_0xb261('0x1b')],_0xb261('0x1c')));},'filename':function(_0x147059,_0x226a61,_0x39385f){_0x226a61[_0xb261('0x1d')]=_0x226a61[_0xb261('0x1d')][_0xb261('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x39385f(null,util[_0xb261('0x1f')]('%s-%s%s',path[_0xb261('0x20')](_0x226a61['originalname'],path[_0xb261('0x21')](_0x226a61['originalname'])),Date[_0xb261('0x22')](),path[_0xb261('0x21')](_0x226a61[_0xb261('0x1d')])));}})});router[_0xb261('0x13')](_0xb261('0x23'),upload[_0xb261('0x24')](_0xb261('0x25')),controller['uploadCsv']);var upload=multer({'storage':multer[_0xb261('0x19')]({'destination':function(_0xee4662,_0x374c47,_0x4fbd81){_0x4fbd81(null,path['join'](config[_0xb261('0x1b')],_0xb261('0x1c')));},'filename':function(_0x1d7bc3,_0x22f933,_0x1e72f0){_0x22f933['originalname']=_0x22f933[_0xb261('0x1d')][_0xb261('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1e72f0(null,util['format'](_0xb261('0x26'),path[_0xb261('0x20')](_0x22f933[_0xb261('0x1d')],path['extname'](_0x22f933[_0xb261('0x1d')])),Date['now'](),path[_0xb261('0x21')](_0x22f933[_0xb261('0x1d')])));}})});router[_0xb261('0x13')](_0xb261('0x27'),upload[_0xb261('0x24')](_0xb261('0x25')),controller[_0xb261('0x28')]);router[_0xb261('0x13')](_0xb261('0x29'),auth['isAuthenticated'](),controller[_0xb261('0x2a')]);router[_0xb261('0x2b')](_0xb261('0x8'),auth[_0xb261('0x7')](),controller['update']);router[_0xb261('0x2c')](_0xb261('0x8'),auth[_0xb261('0x7')](),controller[_0xb261('0x2d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 427f06c..2643c42 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 _0x7d55=['exports','INTEGER','STRING','PHONE','sequelize'];(function(_0x406d39,_0xd3c8f1){var _0x2eb792=function(_0x572291){while(--_0x572291){_0x406d39['push'](_0x406d39['shift']());}};_0x2eb792(++_0xd3c8f1);}(_0x7d55,0x1bc));var _0x57d5=function(_0xa1f655,_0x5056af){_0xa1f655=_0xa1f655-0x0;var _0x11aaaa=_0x7d55[_0xa1f655];return _0x11aaaa;};'use strict';var Sequelize=require(_0x57d5('0x0'));module[_0x57d5('0x1')]={'CmContactId':{'type':Sequelize[_0x57d5('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x57d5('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x57d5('0x4')},'OrderBy':{'type':Sequelize[_0x57d5('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0xba0d=['STRING','PHONE','sequelize','INTEGER'];(function(_0x235a50,_0x24913b){var _0x271d55=function(_0x45363c){while(--_0x45363c){_0x235a50['push'](_0x235a50['shift']());}};_0x271d55(++_0x24913b);}(_0xba0d,0x8e));var _0xdba0=function(_0x5630b1,_0x5c2330){_0x5630b1=_0x5630b1-0x0;var _0x4c413f=_0xba0d[_0x5630b1];return _0x4c413f;};'use strict';var Sequelize=require(_0xdba0('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xdba0('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xdba0('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xdba0('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0xdba0('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'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 200d334..eaa6044 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 _0xbd44=['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','request-promise','bluebird','util','path','sox','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','update','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','limit','order','sort','filters','pick','merge','where','VIRTUAL','filter','options','findAll','rows','params','length','includeAll','include','find','catch'];(function(_0x16cad5,_0x2787f0){var _0x20eed1=function(_0x45126a){while(--_0x45126a){_0x16cad5['push'](_0x16cad5['shift']());}};_0x20eed1(++_0x2787f0);}(_0xbd44,0x151));var _0x4bd4=function(_0x58ae30,_0x4c58e1){_0x58ae30=_0x58ae30-0x0;var _0x3dfcd0=_0xbd44[_0x58ae30];return _0x3dfcd0;};'use strict';var pdf=require(_0x4bd4('0x0'));var emlformat=require(_0x4bd4('0x1'));var rimraf=require(_0x4bd4('0x2'));var zipdir=require(_0x4bd4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4bd4('0x4'));var moment=require('moment');var BPromise=require(_0x4bd4('0x5'));var Mustache=require('mustache');var util=require(_0x4bd4('0x6'));var path=require(_0x4bd4('0x7'));var sox=require(_0x4bd4('0x8'));var csv=require('to-csv');var ejs=require(_0x4bd4('0x9'));var fs=require('fs');var _=require(_0x4bd4('0xa'));var squel=require(_0x4bd4('0xb'));var crypto=require('crypto');var jsforce=require(_0x4bd4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4bd4('0xd'));var Papa=require('papaparse');var Redis=require(_0x4bd4('0xe'));var authService=require(_0x4bd4('0xf'));var qs=require(_0x4bd4('0x10'));var as=require(_0x4bd4('0x11'));var hardwareService=require(_0x4bd4('0x12'));var logger=require(_0x4bd4('0x13'))('api');var utils=require(_0x4bd4('0x14'));var config=require(_0x4bd4('0x15'));var licenseUtil=require(_0x4bd4('0x16'));var db=require(_0x4bd4('0x17'))['db'];function respondWithStatusCode(_0x3aeb31,_0x191707){_0x191707=_0x191707||0xcc;return function(_0xdb1dfc){if(_0xdb1dfc){return _0x3aeb31[_0x4bd4('0x18')](_0x191707);}return _0x3aeb31[_0x4bd4('0x19')](_0x191707)[_0x4bd4('0x1a')]();};}function respondWithResult(_0x221297,_0x187350){_0x187350=_0x187350||0xc8;return function(_0x5df37e){if(_0x5df37e){return _0x221297[_0x4bd4('0x19')](_0x187350)[_0x4bd4('0x1b')](_0x5df37e);}};}function respondWithFilteredResult(_0x5e165b,_0x382b94){return function(_0x595037){if(_0x595037){var _0x53de6e=_0x595037[_0x4bd4('0x1c')],_0x4de917=_0x382b94[_0x4bd4('0x1d')],_0x18b20a=_0x382b94[_0x4bd4('0x1d')]+_0x382b94['limit'],_0x1f42ab;if(_0x18b20a>=_0x53de6e){_0x18b20a=_0x53de6e;_0x1f42ab=0xc8;}else{_0x1f42ab=0xce;}_0x5e165b[_0x4bd4('0x19')](_0x1f42ab);return _0x5e165b[_0x4bd4('0x1e')]('Content-Range',_0x4de917+'-'+_0x18b20a+'/'+_0x53de6e)[_0x4bd4('0x1b')](_0x595037);}return null;};}function patchUpdates(_0x4852c7){return function(_0x56116a){try{jsonpatch[_0x4bd4('0x1f')](_0x56116a,_0x4852c7,!![]);}catch(_0x32babe){return BPromise['reject'](_0x32babe);}return _0x56116a['save']();};}function saveUpdates(_0x4b6bfb,_0x4f0d69){return function(_0x30945d){if(_0x30945d){return _0x30945d[_0x4bd4('0x20')](_0x4b6bfb)[_0x4bd4('0x21')](function(_0x24acb8){return _0x24acb8;});}return null;};}function removeEntity(_0x330037,_0x20849d){return function(_0x327072){if(_0x327072){return _0x327072[_0x4bd4('0x22')]()[_0x4bd4('0x21')](function(){var _0x149de6=_0x327072[_0x4bd4('0x23')]({'plain':!![]});var _0x1f9584=_0x4bd4('0x24');return db[_0x4bd4('0x25')][_0x4bd4('0x22')]({'where':{'type':_0x1f9584,'resourceId':_0x149de6['id']}})[_0x4bd4('0x21')](function(){return _0x327072;});})[_0x4bd4('0x21')](function(){_0x330037[_0x4bd4('0x19')](0xcc)[_0x4bd4('0x1a')]();});}};}function handleEntityNotFound(_0xde2a74,_0x5c36b2){return function(_0x10bc94){if(!_0x10bc94){_0xde2a74['sendStatus'](0x194);}return _0x10bc94;};}function handleError(_0x5053d7,_0x358fc9){_0x358fc9=_0x358fc9||0x1f4;return function(_0xb00321){logger[_0x4bd4('0x26')](_0xb00321[_0x4bd4('0x27')]);if(_0xb00321[_0x4bd4('0x28')]){delete _0xb00321[_0x4bd4('0x28')];}_0x5053d7[_0x4bd4('0x19')](_0x358fc9)[_0x4bd4('0x29')](_0xb00321);};}exports[_0x4bd4('0x2a')]=function(_0x7a1fa6,_0x4c3491){var _0x55e98f={},_0x30eb74={},_0x192a8c={'count':0x0,'rows':[]};var _0x374a23=_[_0x4bd4('0x2b')](db[_0x4bd4('0x2c')][_0x4bd4('0x2d')],function(_0x3791aa){return{'name':_0x3791aa['fieldName'],'type':_0x3791aa[_0x4bd4('0x2e')][_0x4bd4('0x2f')]};});_0x30eb74['model']=_[_0x4bd4('0x2b')](_0x374a23,_0x4bd4('0x28'));_0x30eb74[_0x4bd4('0x30')]=_[_0x4bd4('0x31')](_0x7a1fa6[_0x4bd4('0x30')]);_0x30eb74['filters']=_[_0x4bd4('0x32')](_0x30eb74[_0x4bd4('0x33')],_0x30eb74[_0x4bd4('0x30')]);_0x55e98f[_0x4bd4('0x34')]=_[_0x4bd4('0x32')](_0x30eb74['model'],qs[_0x4bd4('0x35')](_0x7a1fa6[_0x4bd4('0x30')][_0x4bd4('0x35')]));_0x55e98f['attributes']=_0x55e98f['attributes']['length']?_0x55e98f[_0x4bd4('0x34')]:_0x30eb74[_0x4bd4('0x33')];if(!_0x7a1fa6[_0x4bd4('0x30')][_0x4bd4('0x36')]('nolimit')){_0x55e98f[_0x4bd4('0x37')]=qs[_0x4bd4('0x37')](_0x7a1fa6[_0x4bd4('0x30')][_0x4bd4('0x37')]);_0x55e98f[_0x4bd4('0x1d')]=qs[_0x4bd4('0x1d')](_0x7a1fa6['query'][_0x4bd4('0x1d')]);}_0x55e98f[_0x4bd4('0x38')]=qs[_0x4bd4('0x39')](_0x7a1fa6[_0x4bd4('0x30')][_0x4bd4('0x39')]);_0x55e98f['where']=qs[_0x4bd4('0x3a')](_[_0x4bd4('0x3b')](_0x7a1fa6[_0x4bd4('0x30')],_0x30eb74['filters']),_0x374a23);if(_0x7a1fa6[_0x4bd4('0x30')]['filter']){_0x55e98f['where']=_[_0x4bd4('0x3c')](_0x55e98f[_0x4bd4('0x3d')],{'$or':_[_0x4bd4('0x2b')](_0x374a23,function(_0x5e9f28){if(_0x5e9f28[_0x4bd4('0x2e')]!==_0x4bd4('0x3e')){var _0x10a789={};_0x10a789[_0x5e9f28[_0x4bd4('0x28')]]={'$like':'%'+_0x7a1fa6[_0x4bd4('0x30')][_0x4bd4('0x3f')]+'%'};return _0x10a789;}})});}_0x55e98f=_[_0x4bd4('0x3c')]({},_0x55e98f,_0x7a1fa6[_0x4bd4('0x40')]);var _0x324532={'where':_0x55e98f[_0x4bd4('0x3d')]};return db[_0x4bd4('0x2c')][_0x4bd4('0x1c')](_0x324532)[_0x4bd4('0x21')](function(_0x221c3a){_0x192a8c['count']=_0x221c3a;if(_0x7a1fa6[_0x4bd4('0x30')]['includeAll']){_0x55e98f['include']=[{'all':!![]}];}return db['CmContactHasItem'][_0x4bd4('0x41')](_0x55e98f);})[_0x4bd4('0x21')](function(_0x133889){_0x192a8c[_0x4bd4('0x42')]=_0x133889;return _0x192a8c;})['then'](respondWithFilteredResult(_0x4c3491,_0x55e98f))['catch'](handleError(_0x4c3491,null));};exports['show']=function(_0x2ff306,_0x5a7dcd){var _0x188b08={'raw':!![],'where':{'id':_0x2ff306[_0x4bd4('0x43')]['id']}},_0x131dce={};_0x131dce['model']=_[_0x4bd4('0x31')](db[_0x4bd4('0x2c')]['rawAttributes']);_0x131dce['query']=_[_0x4bd4('0x31')](_0x2ff306['query']);_0x131dce[_0x4bd4('0x3a')]=_['intersection'](_0x131dce[_0x4bd4('0x33')],_0x131dce[_0x4bd4('0x30')]);_0x188b08[_0x4bd4('0x34')]=_['intersection'](_0x131dce['model'],qs[_0x4bd4('0x35')](_0x2ff306[_0x4bd4('0x30')][_0x4bd4('0x35')]));_0x188b08[_0x4bd4('0x34')]=_0x188b08[_0x4bd4('0x34')][_0x4bd4('0x44')]?_0x188b08[_0x4bd4('0x34')]:_0x131dce['model'];if(_0x2ff306[_0x4bd4('0x30')][_0x4bd4('0x45')]){_0x188b08[_0x4bd4('0x46')]=[{'all':!![]}];}_0x188b08=_['merge']({},_0x188b08,_0x2ff306[_0x4bd4('0x40')]);return db[_0x4bd4('0x2c')][_0x4bd4('0x47')](_0x188b08)[_0x4bd4('0x21')](handleEntityNotFound(_0x5a7dcd,null))[_0x4bd4('0x21')](respondWithResult(_0x5a7dcd,null))[_0x4bd4('0x48')](handleError(_0x5a7dcd,null));};exports['create']=function(_0x30893c,_0x5c7b86){return db[_0x4bd4('0x2c')][_0x4bd4('0x49')](_0x30893c['body'],{})[_0x4bd4('0x21')](function(_0x4dd3d3){var _0x31a5f4=_0x30893c[_0x4bd4('0x4a')][_0x4bd4('0x23')]({'plain':!![]});if(!_0x31a5f4)throw new Error(_0x4bd4('0x4b'));if(_0x31a5f4[_0x4bd4('0x4c')]===_0x4bd4('0x4a')){var _0x18d697=_0x4dd3d3[_0x4bd4('0x23')]({'plain':!![]});var _0x3731b0=_0x4bd4('0x24');return db[_0x4bd4('0x4d')][_0x4bd4('0x47')]({'where':{'name':_0x3731b0,'userProfileId':_0x31a5f4[_0x4bd4('0x4e')]},'raw':!![]})['then'](function(_0x391580){if(_0x391580&&_0x391580[_0x4bd4('0x4f')]===0x0){return db['UserProfileResource'][_0x4bd4('0x49')]({'name':_0x18d697['name'],'resourceId':_0x18d697['id'],'type':_0x391580[_0x4bd4('0x28')],'sectionId':_0x391580['id']},{})['then'](function(){return _0x4dd3d3;});}else{return _0x4dd3d3;}})[_0x4bd4('0x48')](function(_0x3b80ed){logger['error'](_0x4bd4('0x50'),_0x3b80ed);throw _0x3b80ed;});}return _0x4dd3d3;})[_0x4bd4('0x21')](respondWithResult(_0x5c7b86,0xc9))['catch'](handleError(_0x5c7b86,null));};exports[_0x4bd4('0x20')]=function(_0x3275d1,_0x2489d8){if(_0x3275d1[_0x4bd4('0x51')]['id']){delete _0x3275d1[_0x4bd4('0x51')]['id'];}return db[_0x4bd4('0x2c')]['find']({'where':{'id':_0x3275d1[_0x4bd4('0x43')]['id']}})['then'](handleEntityNotFound(_0x2489d8,null))[_0x4bd4('0x21')](saveUpdates(_0x3275d1[_0x4bd4('0x51')],null))[_0x4bd4('0x21')](respondWithResult(_0x2489d8,null))['catch'](handleError(_0x2489d8,null));};exports[_0x4bd4('0x22')]=function(_0x269ddd,_0x160f0d){return db[_0x4bd4('0x2c')][_0x4bd4('0x47')]({'where':{'id':_0x269ddd[_0x4bd4('0x43')]['id']}})[_0x4bd4('0x21')](handleEntityNotFound(_0x160f0d,null))[_0x4bd4('0x21')](removeEntity(_0x160f0d,null))[_0x4bd4('0x48')](handleError(_0x160f0d,null));}; \ No newline at end of file +var _0x94cc=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','json','offset','limit','status','Content-Range','apply','reject','then','destroy','get','CmContactHasItems','UserProfileResource','sendStatus','name','send','index','map','type','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','count','includeAll','include','findAll','show','params','CmContactHasItem','keys','length','options','find','catch','create'];(function(_0x4503c6,_0x31facf){var _0x1f185d=function(_0x492fbd){while(--_0x492fbd){_0x4503c6['push'](_0x4503c6['shift']());}};_0x1f185d(++_0x31facf);}(_0x94cc,0xf0));var _0xc94c=function(_0x32f072,_0xe8cfc1){_0x32f072=_0x32f072-0x0;var _0x1564f3=_0x94cc[_0x32f072];return _0x1564f3;};'use strict';var pdf=require(_0xc94c('0x0'));var emlformat=require(_0xc94c('0x1'));var rimraf=require(_0xc94c('0x2'));var zipdir=require(_0xc94c('0x3'));var jsonpatch=require(_0xc94c('0x4'));var rp=require(_0xc94c('0x5'));var moment=require(_0xc94c('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xc94c('0x7'));var util=require(_0xc94c('0x8'));var path=require(_0xc94c('0x9'));var sox=require(_0xc94c('0xa'));var csv=require('to-csv');var ejs=require(_0xc94c('0xb'));var fs=require('fs');var _=require(_0xc94c('0xc'));var squel=require('squel');var crypto=require(_0xc94c('0xd'));var jsforce=require(_0xc94c('0xe'));var deskjs=require(_0xc94c('0xf'));var toCsv=require(_0xc94c('0x10'));var querystring=require(_0xc94c('0x11'));var Papa=require(_0xc94c('0x12'));var Redis=require('ioredis');var authService=require(_0xc94c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc94c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc94c('0x15'))('api');var utils=require(_0xc94c('0x16'));var config=require(_0xc94c('0x17'));var licenseUtil=require(_0xc94c('0x18'));var db=require(_0xc94c('0x19'))['db'];function respondWithStatusCode(_0x469cee,_0x143da1){_0x143da1=_0x143da1||0xcc;return function(_0x1aa890){if(_0x1aa890){return _0x469cee['sendStatus'](_0x143da1);}return _0x469cee['status'](_0x143da1)['end']();};}function respondWithResult(_0x10aebb,_0x2cc503){_0x2cc503=_0x2cc503||0xc8;return function(_0x364e5e){if(_0x364e5e){return _0x10aebb['status'](_0x2cc503)[_0xc94c('0x1a')](_0x364e5e);}};}function respondWithFilteredResult(_0x4e0f99,_0xed1dd6){return function(_0x46bf18){if(_0x46bf18){var _0xb0816f=_0x46bf18['count'],_0x20a1ac=_0xed1dd6[_0xc94c('0x1b')],_0x579e7a=_0xed1dd6['offset']+_0xed1dd6[_0xc94c('0x1c')],_0x438019;if(_0x579e7a>=_0xb0816f){_0x579e7a=_0xb0816f;_0x438019=0xc8;}else{_0x438019=0xce;}_0x4e0f99[_0xc94c('0x1d')](_0x438019);return _0x4e0f99['set'](_0xc94c('0x1e'),_0x20a1ac+'-'+_0x579e7a+'/'+_0xb0816f)[_0xc94c('0x1a')](_0x46bf18);}return null;};}function patchUpdates(_0x173d48){return function(_0x1b8cfb){try{jsonpatch[_0xc94c('0x1f')](_0x1b8cfb,_0x173d48,!![]);}catch(_0x21be23){return BPromise[_0xc94c('0x20')](_0x21be23);}return _0x1b8cfb['save']();};}function saveUpdates(_0x4da8c9,_0x514576){return function(_0x30a39a){if(_0x30a39a){return _0x30a39a['update'](_0x4da8c9)[_0xc94c('0x21')](function(_0x48f1d3){return _0x48f1d3;});}return null;};}function removeEntity(_0x5147ce,_0x472dd6){return function(_0x26509a){if(_0x26509a){return _0x26509a[_0xc94c('0x22')]()['then'](function(){var _0xb39f4b=_0x26509a[_0xc94c('0x23')]({'plain':!![]});var _0x2cca86=_0xc94c('0x24');return db[_0xc94c('0x25')][_0xc94c('0x22')]({'where':{'type':_0x2cca86,'resourceId':_0xb39f4b['id']}})[_0xc94c('0x21')](function(){return _0x26509a;});})[_0xc94c('0x21')](function(){_0x5147ce['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5af346,_0x50d6c8){return function(_0x4d2449){if(!_0x4d2449){_0x5af346[_0xc94c('0x26')](0x194);}return _0x4d2449;};}function handleError(_0x1fcc34,_0x406acf){_0x406acf=_0x406acf||0x1f4;return function(_0x18a46a){logger['error'](_0x18a46a['stack']);if(_0x18a46a[_0xc94c('0x27')]){delete _0x18a46a['name'];}_0x1fcc34['status'](_0x406acf)[_0xc94c('0x28')](_0x18a46a);};}exports[_0xc94c('0x29')]=function(_0x55eb39,_0x3b255b){var _0x25096e={},_0x387ed4={},_0x3b050a={'count':0x0,'rows':[]};var _0x1d1028=_[_0xc94c('0x2a')](db['CmContactHasItem']['rawAttributes'],function(_0x314db3){return{'name':_0x314db3['fieldName'],'type':_0x314db3[_0xc94c('0x2b')]['key']};});_0x387ed4[_0xc94c('0x2c')]=_[_0xc94c('0x2a')](_0x1d1028,'name');_0x387ed4[_0xc94c('0x2d')]=_['keys'](_0x55eb39[_0xc94c('0x2d')]);_0x387ed4['filters']=_['intersection'](_0x387ed4[_0xc94c('0x2c')],_0x387ed4['query']);_0x25096e[_0xc94c('0x2e')]=_[_0xc94c('0x2f')](_0x387ed4[_0xc94c('0x2c')],qs[_0xc94c('0x30')](_0x55eb39['query'][_0xc94c('0x30')]));_0x25096e[_0xc94c('0x2e')]=_0x25096e[_0xc94c('0x2e')]['length']?_0x25096e[_0xc94c('0x2e')]:_0x387ed4[_0xc94c('0x2c')];if(!_0x55eb39[_0xc94c('0x2d')][_0xc94c('0x31')](_0xc94c('0x32'))){_0x25096e[_0xc94c('0x1c')]=qs[_0xc94c('0x1c')](_0x55eb39[_0xc94c('0x2d')][_0xc94c('0x1c')]);_0x25096e[_0xc94c('0x1b')]=qs[_0xc94c('0x1b')](_0x55eb39[_0xc94c('0x2d')][_0xc94c('0x1b')]);}_0x25096e[_0xc94c('0x33')]=qs[_0xc94c('0x34')](_0x55eb39[_0xc94c('0x2d')][_0xc94c('0x34')]);_0x25096e[_0xc94c('0x35')]=qs[_0xc94c('0x36')](_[_0xc94c('0x37')](_0x55eb39['query'],_0x387ed4[_0xc94c('0x36')]),_0x1d1028);if(_0x55eb39[_0xc94c('0x2d')]['filter']){_0x25096e[_0xc94c('0x35')]=_[_0xc94c('0x38')](_0x25096e['where'],{'$or':_['map'](_0x1d1028,function(_0x39149e){if(_0x39149e['type']!==_0xc94c('0x39')){var _0x6f1662={};_0x6f1662[_0x39149e[_0xc94c('0x27')]]={'$like':'%'+_0x55eb39['query'][_0xc94c('0x3a')]+'%'};return _0x6f1662;}})});}_0x25096e=_['merge']({},_0x25096e,_0x55eb39['options']);var _0x3f0b87={'where':_0x25096e[_0xc94c('0x35')]};return db['CmContactHasItem']['count'](_0x3f0b87)[_0xc94c('0x21')](function(_0x546e5f){_0x3b050a[_0xc94c('0x3b')]=_0x546e5f;if(_0x55eb39[_0xc94c('0x2d')][_0xc94c('0x3c')]){_0x25096e[_0xc94c('0x3d')]=[{'all':!![]}];}return db['CmContactHasItem'][_0xc94c('0x3e')](_0x25096e);})[_0xc94c('0x21')](function(_0x5aafc5){_0x3b050a['rows']=_0x5aafc5;return _0x3b050a;})[_0xc94c('0x21')](respondWithFilteredResult(_0x3b255b,_0x25096e))['catch'](handleError(_0x3b255b,null));};exports[_0xc94c('0x3f')]=function(_0x257665,_0x2328ed){var _0x43597b={'raw':!![],'where':{'id':_0x257665[_0xc94c('0x40')]['id']}},_0x1741f7={};_0x1741f7[_0xc94c('0x2c')]=_['keys'](db[_0xc94c('0x41')]['rawAttributes']);_0x1741f7['query']=_[_0xc94c('0x42')](_0x257665[_0xc94c('0x2d')]);_0x1741f7[_0xc94c('0x36')]=_['intersection'](_0x1741f7[_0xc94c('0x2c')],_0x1741f7[_0xc94c('0x2d')]);_0x43597b['attributes']=_['intersection'](_0x1741f7[_0xc94c('0x2c')],qs[_0xc94c('0x30')](_0x257665['query'][_0xc94c('0x30')]));_0x43597b[_0xc94c('0x2e')]=_0x43597b['attributes'][_0xc94c('0x43')]?_0x43597b[_0xc94c('0x2e')]:_0x1741f7['model'];if(_0x257665[_0xc94c('0x2d')][_0xc94c('0x3c')]){_0x43597b['include']=[{'all':!![]}];}_0x43597b=_['merge']({},_0x43597b,_0x257665[_0xc94c('0x44')]);return db[_0xc94c('0x41')][_0xc94c('0x45')](_0x43597b)[_0xc94c('0x21')](handleEntityNotFound(_0x2328ed,null))[_0xc94c('0x21')](respondWithResult(_0x2328ed,null))[_0xc94c('0x46')](handleError(_0x2328ed,null));};exports[_0xc94c('0x47')]=function(_0x2f78d9,_0x5ecda1){return db['CmContactHasItem'][_0xc94c('0x47')](_0x2f78d9[_0xc94c('0x48')],{})[_0xc94c('0x21')](function(_0x16e188){var _0x3895ea=_0x2f78d9[_0xc94c('0x49')][_0xc94c('0x23')]({'plain':!![]});if(!_0x3895ea)throw new Error(_0xc94c('0x4a'));if(_0x3895ea[_0xc94c('0x4b')]===_0xc94c('0x49')){var _0x1a12b0=_0x16e188[_0xc94c('0x23')]({'plain':!![]});var _0x18238d=_0xc94c('0x24');return db[_0xc94c('0x4c')][_0xc94c('0x45')]({'where':{'name':_0x18238d,'userProfileId':_0x3895ea['userProfileId']},'raw':!![]})['then'](function(_0xa0d917){if(_0xa0d917&&_0xa0d917['autoAssociation']===0x0){return db[_0xc94c('0x25')]['create']({'name':_0x1a12b0[_0xc94c('0x27')],'resourceId':_0x1a12b0['id'],'type':_0xa0d917[_0xc94c('0x27')],'sectionId':_0xa0d917['id']},{})[_0xc94c('0x21')](function(){return _0x16e188;});}else{return _0x16e188;}})[_0xc94c('0x46')](function(_0x201449){logger['error'](_0xc94c('0x4d'),_0x201449);throw _0x201449;});}return _0x16e188;})[_0xc94c('0x21')](respondWithResult(_0x5ecda1,0xc9))['catch'](handleError(_0x5ecda1,null));};exports['update']=function(_0x3ad187,_0x5481a5){if(_0x3ad187[_0xc94c('0x48')]['id']){delete _0x3ad187[_0xc94c('0x48')]['id'];}return db['CmContactHasItem']['find']({'where':{'id':_0x3ad187[_0xc94c('0x40')]['id']}})[_0xc94c('0x21')](handleEntityNotFound(_0x5481a5,null))[_0xc94c('0x21')](saveUpdates(_0x3ad187[_0xc94c('0x48')],null))[_0xc94c('0x21')](respondWithResult(_0x5481a5,null))[_0xc94c('0x46')](handleError(_0x5481a5,null));};exports[_0xc94c('0x22')]=function(_0x2294eb,_0x33dede){return db[_0xc94c('0x41')]['find']({'where':{'id':_0x2294eb[_0xc94c('0x40')]['id']}})['then'](handleEntityNotFound(_0x33dede,null))[_0xc94c('0x21')](removeEntity(_0x33dede,null))[_0xc94c('0x46')](handleError(_0x33dede,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 0b7d2d3..ef3420e 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 _0xaa3f=['rimraf','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2ff912,_0x1a1e20){var _0x356921=function(_0x2baf14){while(--_0x2baf14){_0x2ff912['push'](_0x2ff912['shift']());}};_0x356921(++_0x1a1e20);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x1b62b5,_0x7ae1f){_0x1b62b5=_0x1b62b5-0x0;var _0x30e905=_0xaa3f[_0x1b62b5];return _0x30e905;};'use strict';var _=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var logger=require(_0xfaa3('0x2'))(_0xfaa3('0x3'));var moment=require(_0xfaa3('0x4'));var BPromise=require(_0xfaa3('0x5'));var rp=require(_0xfaa3('0x6'));var fs=require('fs');var path=require(_0xfaa3('0x7'));var rimraf=require(_0xfaa3('0x8'));var config=require('../../config/environment');var attributes=require('./cmContactHasItem.attributes');module[_0xfaa3('0x9')]=function(_0x4bac92,_0x3d09aa){return _0x4bac92[_0xfaa3('0xa')](_0xfaa3('0xb'),attributes,{'tableName':_0xfaa3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8958=['define','CmContactHasItem','cm_contact_has_items','util','request-promise','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x811bc3,_0x24085c){var _0x1eb095=function(_0x237893){while(--_0x237893){_0x811bc3['push'](_0x811bc3['shift']());}};_0x1eb095(++_0x24085c);}(_0x8958,0x93));var _0x8895=function(_0x3a6c2c,_0x33b1b5){_0x3a6c2c=_0x3a6c2c-0x0;var _0xb93dcc=_0x8958[_0x3a6c2c];return _0xb93dcc;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8895('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var attributes=require(_0x8895('0x4'));module['exports']=function(_0x22fa52,_0x2f03ad){return _0x22fa52[_0x8895('0x5')](_0x8895('0x6'),attributes,{'tableName':_0x8895('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index fb255e8..6fe43da 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 _0x2056=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','moment'];(function(_0x334033,_0x1f6788){var _0x5aaba1=function(_0x5c5e8e){while(--_0x5c5e8e){_0x334033['push'](_0x334033['shift']());}};_0x5aaba1(++_0x1f6788);}(_0x2056,0x107));var _0x6205=function(_0x44b346,_0xeb097d){_0x44b346=_0x44b346-0x0;var _0x1c2f2b=_0x2056[_0x44b346];return _0x1c2f2b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6205('0x0'));var BPromise=require(_0x6205('0x1'));var rs=require(_0x6205('0x2'));var fs=require('fs');var Redis=require(_0x6205('0x3'));var db=require(_0x6205('0x4'))['db'];var utils=require(_0x6205('0x5'));var logger=require(_0x6205('0x6'))(_0x6205('0x7'));var config=require(_0x6205('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6205('0x9')][_0x6205('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27eb28,_0x446132,_0x271ffb){return new BPromise(function(_0x556d20,_0x1b7091){return client[_0x6205('0xb')](_0x27eb28,_0x271ffb)[_0x6205('0xc')](function(_0x20b0f6){logger[_0x6205('0xd')](_0x6205('0xe'),_0x446132,'request\x20sent');logger[_0x6205('0xf')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x446132,_0x6205('0x10'),JSON[_0x6205('0x11')](_0x20b0f6));if(_0x20b0f6[_0x6205('0x12')]){if(_0x20b0f6[_0x6205('0x12')][_0x6205('0x13')]===0x1f4){logger['error'](_0x6205('0xe'),_0x446132,_0x20b0f6[_0x6205('0x12')]['message']);return _0x1b7091(_0x20b0f6[_0x6205('0x12')][_0x6205('0x14')]);}logger['error'](_0x6205('0xe'),_0x446132,_0x20b0f6['error']['message']);return _0x556d20(_0x20b0f6['error'][_0x6205('0x14')]);}else{logger[_0x6205('0xd')](_0x6205('0xe'),_0x446132,_0x6205('0x10'));_0x556d20(_0x20b0f6[_0x6205('0x15')][_0x6205('0x14')]);}})['catch'](function(_0x4832fa){logger[_0x6205('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x446132,_0x4832fa);_0x1b7091(_0x4832fa);});});} \ No newline at end of file +var _0x0dec=['request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s'];(function(_0x36436d,_0x20292c){var _0x34615d=function(_0x5447af){while(--_0x5447af){_0x36436d['push'](_0x36436d['shift']());}};_0x34615d(++_0x20292c);}(_0x0dec,0x11c));var _0xc0de=function(_0x1aabf7,_0x3861d0){_0x1aabf7=_0x1aabf7-0x0;var _0x56c6a6=_0x0dec[_0x1aabf7];return _0x56c6a6;};'use strict';var _=require(_0xc0de('0x0'));var util=require(_0xc0de('0x1'));var moment=require(_0xc0de('0x2'));var BPromise=require(_0xc0de('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc0de('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc0de('0x5'))(_0xc0de('0x6'));var config=require(_0xc0de('0x7'));var jayson=require(_0xc0de('0x8'));var client=jayson[_0xc0de('0x9')][_0xc0de('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3639e8,_0x3f7c10,_0x4090cf){return new BPromise(function(_0x2d9bae,_0xfeb87c){return client[_0xc0de('0xb')](_0x3639e8,_0x4090cf)[_0xc0de('0xc')](function(_0x46ed3f){logger[_0xc0de('0xd')](_0xc0de('0xe'),_0x3f7c10,_0xc0de('0xf'));logger[_0xc0de('0x10')](_0xc0de('0x11'),_0x3f7c10,_0xc0de('0xf'),JSON[_0xc0de('0x12')](_0x46ed3f));if(_0x46ed3f[_0xc0de('0x13')]){if(_0x46ed3f[_0xc0de('0x13')][_0xc0de('0x14')]===0x1f4){logger[_0xc0de('0x13')]('CmContactHasItem,\x20%s,\x20%s',_0x3f7c10,_0x46ed3f[_0xc0de('0x13')][_0xc0de('0x15')]);return _0xfeb87c(_0x46ed3f[_0xc0de('0x13')][_0xc0de('0x15')]);}logger[_0xc0de('0x13')](_0xc0de('0xe'),_0x3f7c10,_0x46ed3f[_0xc0de('0x13')][_0xc0de('0x15')]);return _0x2d9bae(_0x46ed3f[_0xc0de('0x13')][_0xc0de('0x15')]);}else{logger[_0xc0de('0xd')](_0xc0de('0xe'),_0x3f7c10,'request\x20sent');_0x2d9bae(_0x46ed3f[_0xc0de('0x16')][_0xc0de('0x15')]);}})['catch'](function(_0x100458){logger[_0xc0de('0x13')](_0xc0de('0xe'),_0x3f7c10,_0x100458);_0xfeb87c(_0x100458);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index b2c2815..299a364 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 _0x74da=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x74da,0x1f3));var _0xa74d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x74da[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa74d('0x0'));var util=require('util');var path=require(_0xa74d('0x1'));var timeout=require(_0xa74d('0x2'));var express=require('express');var router=express[_0xa74d('0x3')]();var auth=require(_0xa74d('0x4'));var interaction=require(_0xa74d('0x5'));var config=require(_0xa74d('0x6'));var controller=require('./cmContactHasItem.controller');router[_0xa74d('0x7')]('/',auth[_0xa74d('0x8')](),controller[_0xa74d('0x9')]);router[_0xa74d('0x7')](_0xa74d('0xa'),auth[_0xa74d('0x8')](),controller['show']);router[_0xa74d('0xb')]('/',auth[_0xa74d('0x8')](),controller[_0xa74d('0xc')]);router[_0xa74d('0xd')](_0xa74d('0xa'),auth[_0xa74d('0x8')](),controller[_0xa74d('0xe')]);router[_0xa74d('0xf')](_0xa74d('0xa'),auth[_0xa74d('0x8')](),controller[_0xa74d('0x10')]);module[_0xa74d('0x11')]=router; \ No newline at end of file +var _0x5c1d=['put','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','isAuthenticated','get','/:id','post','create'];(function(_0x420e9c,_0xf56e66){var _0x1362dd=function(_0x20dee6){while(--_0x20dee6){_0x420e9c['push'](_0x420e9c['shift']());}};_0x1362dd(++_0xf56e66);}(_0x5c1d,0x153));var _0xd5c1=function(_0x1f06b5,_0x2eae48){_0x1f06b5=_0x1f06b5-0x0;var _0x2b7370=_0x5c1d[_0x1f06b5];return _0x2b7370;};'use strict';var multer=require(_0xd5c1('0x0'));var util=require(_0xd5c1('0x1'));var path=require(_0xd5c1('0x2'));var timeout=require(_0xd5c1('0x3'));var express=require(_0xd5c1('0x4'));var router=express['Router']();var auth=require(_0xd5c1('0x5'));var interaction=require(_0xd5c1('0x6'));var config=require('../../config/environment');var controller=require(_0xd5c1('0x7'));router['get']('/',auth[_0xd5c1('0x8')](),controller['index']);router[_0xd5c1('0x9')](_0xd5c1('0xa'),auth[_0xd5c1('0x8')](),controller['show']);router[_0xd5c1('0xb')]('/',auth[_0xd5c1('0x8')](),controller[_0xd5c1('0xc')]);router[_0xd5c1('0xd')](_0xd5c1('0xa'),auth[_0xd5c1('0x8')](),controller['update']);router['delete'](_0xd5c1('0xa'),auth[_0xd5c1('0x8')](),controller[_0xd5c1('0xe')]);module[_0xd5c1('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index 166a13f..a29b97c 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 _0xc00f=['exports','INTEGER','STRING','sequelize'];(function(_0xe28eae,_0x43f392){var _0x100f0f=function(_0x9da8a0){while(--_0x9da8a0){_0xe28eae['push'](_0xe28eae['shift']());}};_0x100f0f(++_0x43f392);}(_0xc00f,0x113));var _0xfc00=function(_0x146f9c,_0x43fa83){_0x146f9c=_0x146f9c-0x0;var _0x24d6b5=_0xc00f[_0x146f9c];return _0x24d6b5;};'use strict';var Sequelize=require(_0xfc00('0x0'));module[_0xfc00('0x1')]={'CmContactId':{'type':Sequelize[_0xfc00('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0xfc00('0x3')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0x0088=['sequelize','INTEGER'];(function(_0x231dda,_0x5b04cc){var _0x3f88cb=function(_0x16eb77){while(--_0x16eb77){_0x231dda['push'](_0x231dda['shift']());}};_0x3f88cb(++_0x5b04cc);}(_0x0088,0xa0));var _0x8008=function(_0x3b680c,_0x310391){_0x3b680c=_0x3b680c-0x0;var _0x5a20b3=_0x0088[_0x3b680c];return _0x5a20b3;};'use strict';var Sequelize=require(_0x8008('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x8008('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 ad02937..25b50fc 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 _0x872a=['rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasPhones','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','get','error','stack','name','CmContactHasPhone'];(function(_0x17b810,_0x5277c1){var _0x1d89da=function(_0x2cee65){while(--_0x2cee65){_0x17b810['push'](_0x17b810['shift']());}};_0x1d89da(++_0x5277c1);}(_0x872a,0x1ba));var _0xa872=function(_0x4420e6,_0x351214){_0x4420e6=_0x4420e6-0x0;var _0x5f3820=_0x872a[_0x4420e6];return _0x5f3820;};'use strict';var pdf=require(_0xa872('0x0'));var emlformat=require(_0xa872('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa872('0x2'));var jsonpatch=require(_0xa872('0x3'));var rp=require(_0xa872('0x4'));var moment=require(_0xa872('0x5'));var BPromise=require(_0xa872('0x6'));var Mustache=require(_0xa872('0x7'));var util=require(_0xa872('0x8'));var path=require(_0xa872('0x9'));var sox=require(_0xa872('0xa'));var csv=require(_0xa872('0xb'));var ejs=require(_0xa872('0xc'));var fs=require('fs');var _=require(_0xa872('0xd'));var squel=require('squel');var crypto=require(_0xa872('0xe'));var jsforce=require(_0xa872('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa872('0xb'));var querystring=require(_0xa872('0x10'));var Papa=require(_0xa872('0x11'));var Redis=require('ioredis');var authService=require(_0xa872('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa872('0x13'));var hardwareService=require(_0xa872('0x14'));var logger=require(_0xa872('0x15'))(_0xa872('0x16'));var utils=require('../../config/utils');var config=require(_0xa872('0x17'));var licenseUtil=require(_0xa872('0x18'));var db=require(_0xa872('0x19'))['db'];function respondWithStatusCode(_0x2bd104,_0x29c20e){_0x29c20e=_0x29c20e||0xcc;return function(_0x578004){if(_0x578004){return _0x2bd104[_0xa872('0x1a')](_0x29c20e);}return _0x2bd104[_0xa872('0x1b')](_0x29c20e)[_0xa872('0x1c')]();};}function respondWithResult(_0x3bfdbf,_0x1e4aa4){_0x1e4aa4=_0x1e4aa4||0xc8;return function(_0x5eff30){if(_0x5eff30){return _0x3bfdbf[_0xa872('0x1b')](_0x1e4aa4)[_0xa872('0x1d')](_0x5eff30);}};}function respondWithFilteredResult(_0xe47c97,_0x1da590){return function(_0x289edd){if(_0x289edd){var _0x2b303b=_0x289edd[_0xa872('0x1e')],_0x4afa8c=_0x1da590['offset'],_0x20eaf7=_0x1da590[_0xa872('0x1f')]+_0x1da590[_0xa872('0x20')],_0x234a12;if(_0x20eaf7>=_0x2b303b){_0x20eaf7=_0x2b303b;_0x234a12=0xc8;}else{_0x234a12=0xce;}_0xe47c97[_0xa872('0x1b')](_0x234a12);return _0xe47c97[_0xa872('0x21')](_0xa872('0x22'),_0x4afa8c+'-'+_0x20eaf7+'/'+_0x2b303b)['json'](_0x289edd);}return null;};}function patchUpdates(_0x124e38){return function(_0x5421fa){try{jsonpatch['apply'](_0x5421fa,_0x124e38,!![]);}catch(_0x3ac42e){return BPromise['reject'](_0x3ac42e);}return _0x5421fa[_0xa872('0x23')]();};}function saveUpdates(_0x40f0e1,_0x4facbe){return function(_0x32e41d){if(_0x32e41d){return _0x32e41d[_0xa872('0x24')](_0x40f0e1)[_0xa872('0x25')](function(_0xd0ddb9){return _0xd0ddb9;});}return null;};}function removeEntity(_0x4cf1f0,_0x374e90){return function(_0x4168e1){if(_0x4168e1){return _0x4168e1[_0xa872('0x26')]()[_0xa872('0x25')](function(){var _0x3afe69=_0x4168e1[_0xa872('0x27')]({'plain':!![]});var _0x5f2680='CmContactHasPhones';return db['UserProfileResource']['destroy']({'where':{'type':_0x5f2680,'resourceId':_0x3afe69['id']}})['then'](function(){return _0x4168e1;});})[_0xa872('0x25')](function(){_0x4cf1f0[_0xa872('0x1b')](0xcc)[_0xa872('0x1c')]();});}};}function handleEntityNotFound(_0x28c19b,_0x3bf1fc){return function(_0x5d0a71){if(!_0x5d0a71){_0x28c19b['sendStatus'](0x194);}return _0x5d0a71;};}function handleError(_0x1ba5b0,_0x4683a2){_0x4683a2=_0x4683a2||0x1f4;return function(_0x183d5f){logger[_0xa872('0x28')](_0x183d5f[_0xa872('0x29')]);if(_0x183d5f[_0xa872('0x2a')]){delete _0x183d5f[_0xa872('0x2a')];}_0x1ba5b0[_0xa872('0x1b')](_0x4683a2)['send'](_0x183d5f);};}exports['index']=function(_0x5a6df5,_0x49c65a){var _0x1aa335={},_0x1a6be1={},_0x1bfcc4={'count':0x0,'rows':[]};var _0x336faf=_['map'](db[_0xa872('0x2b')][_0xa872('0x2c')],function(_0x13f6ed){return{'name':_0x13f6ed['fieldName'],'type':_0x13f6ed[_0xa872('0x2d')][_0xa872('0x2e')]};});_0x1a6be1[_0xa872('0x2f')]=_[_0xa872('0x30')](_0x336faf,_0xa872('0x2a'));_0x1a6be1[_0xa872('0x31')]=_[_0xa872('0x32')](_0x5a6df5['query']);_0x1a6be1[_0xa872('0x33')]=_[_0xa872('0x34')](_0x1a6be1[_0xa872('0x2f')],_0x1a6be1[_0xa872('0x31')]);_0x1aa335['attributes']=_['intersection'](_0x1a6be1[_0xa872('0x2f')],qs[_0xa872('0x35')](_0x5a6df5['query']['fields']));_0x1aa335[_0xa872('0x36')]=_0x1aa335[_0xa872('0x36')]['length']?_0x1aa335[_0xa872('0x36')]:_0x1a6be1[_0xa872('0x2f')];if(!_0x5a6df5['query']['hasOwnProperty']('nolimit')){_0x1aa335[_0xa872('0x20')]=qs[_0xa872('0x20')](_0x5a6df5[_0xa872('0x31')][_0xa872('0x20')]);_0x1aa335[_0xa872('0x1f')]=qs[_0xa872('0x1f')](_0x5a6df5[_0xa872('0x31')][_0xa872('0x1f')]);}_0x1aa335[_0xa872('0x37')]=qs['sort'](_0x5a6df5[_0xa872('0x31')][_0xa872('0x38')]);_0x1aa335['where']=qs[_0xa872('0x33')](_[_0xa872('0x39')](_0x5a6df5[_0xa872('0x31')],_0x1a6be1[_0xa872('0x33')]),_0x336faf);if(_0x5a6df5[_0xa872('0x31')]['filter']){_0x1aa335[_0xa872('0x3a')]=_[_0xa872('0x3b')](_0x1aa335[_0xa872('0x3a')],{'$or':_['map'](_0x336faf,function(_0x2d9cca){if(_0x2d9cca['type']!==_0xa872('0x3c')){var _0x3e25b8={};_0x3e25b8[_0x2d9cca['name']]={'$like':'%'+_0x5a6df5[_0xa872('0x31')]['filter']+'%'};return _0x3e25b8;}})});}_0x1aa335=_[_0xa872('0x3b')]({},_0x1aa335,_0x5a6df5[_0xa872('0x3d')]);var _0x104749={'where':_0x1aa335[_0xa872('0x3a')]};return db[_0xa872('0x2b')]['count'](_0x104749)[_0xa872('0x25')](function(_0x413fe1){_0x1bfcc4[_0xa872('0x1e')]=_0x413fe1;if(_0x5a6df5[_0xa872('0x31')][_0xa872('0x3e')]){_0x1aa335[_0xa872('0x3f')]=[{'all':!![]}];}return db['CmContactHasPhone'][_0xa872('0x40')](_0x1aa335);})[_0xa872('0x25')](function(_0x21eb82){_0x1bfcc4[_0xa872('0x41')]=_0x21eb82;return _0x1bfcc4;})[_0xa872('0x25')](respondWithFilteredResult(_0x49c65a,_0x1aa335))[_0xa872('0x42')](handleError(_0x49c65a,null));};exports[_0xa872('0x43')]=function(_0x3bf4bd,_0x433dd9){var _0xb323f1={'raw':!![],'where':{'id':_0x3bf4bd[_0xa872('0x44')]['id']}},_0x2e8952={};_0x2e8952[_0xa872('0x2f')]=_[_0xa872('0x32')](db[_0xa872('0x2b')]['rawAttributes']);_0x2e8952[_0xa872('0x31')]=_[_0xa872('0x32')](_0x3bf4bd[_0xa872('0x31')]);_0x2e8952[_0xa872('0x33')]=_[_0xa872('0x34')](_0x2e8952[_0xa872('0x2f')],_0x2e8952['query']);_0xb323f1['attributes']=_[_0xa872('0x34')](_0x2e8952[_0xa872('0x2f')],qs[_0xa872('0x35')](_0x3bf4bd[_0xa872('0x31')][_0xa872('0x35')]));_0xb323f1[_0xa872('0x36')]=_0xb323f1[_0xa872('0x36')][_0xa872('0x45')]?_0xb323f1[_0xa872('0x36')]:_0x2e8952[_0xa872('0x2f')];if(_0x3bf4bd['query'][_0xa872('0x3e')]){_0xb323f1[_0xa872('0x3f')]=[{'all':!![]}];}_0xb323f1=_[_0xa872('0x3b')]({},_0xb323f1,_0x3bf4bd[_0xa872('0x3d')]);return db[_0xa872('0x2b')]['find'](_0xb323f1)[_0xa872('0x25')](handleEntityNotFound(_0x433dd9,null))['then'](respondWithResult(_0x433dd9,null))['catch'](handleError(_0x433dd9,null));};exports[_0xa872('0x46')]=function(_0x10f06a,_0x5495bd){return db[_0xa872('0x2b')][_0xa872('0x46')](_0x10f06a[_0xa872('0x47')],{})[_0xa872('0x25')](function(_0x4aaf03){var _0x3d4a03=_0x10f06a[_0xa872('0x48')][_0xa872('0x27')]({'plain':!![]});if(!_0x3d4a03)throw new Error(_0xa872('0x49'));if(_0x3d4a03[_0xa872('0x4a')]==='user'){var _0x137b9b=_0x4aaf03[_0xa872('0x27')]({'plain':!![]});var _0x2eec10=_0xa872('0x4b');return db[_0xa872('0x4c')][_0xa872('0x4d')]({'where':{'name':_0x2eec10,'userProfileId':_0x3d4a03[_0xa872('0x4e')]},'raw':!![]})[_0xa872('0x25')](function(_0x25a68a){if(_0x25a68a&&_0x25a68a['autoAssociation']===0x0){return db[_0xa872('0x4f')]['create']({'name':_0x137b9b[_0xa872('0x2a')],'resourceId':_0x137b9b['id'],'type':_0x25a68a[_0xa872('0x2a')],'sectionId':_0x25a68a['id']},{})[_0xa872('0x25')](function(){return _0x4aaf03;});}else{return _0x4aaf03;}})[_0xa872('0x42')](function(_0x1b8171){logger['error'](_0xa872('0x50'),_0x1b8171);throw _0x1b8171;});}return _0x4aaf03;})['then'](respondWithResult(_0x5495bd,0xc9))[_0xa872('0x42')](handleError(_0x5495bd,null));};exports[_0xa872('0x24')]=function(_0x44712f,_0x3082fa){if(_0x44712f[_0xa872('0x47')]['id']){delete _0x44712f['body']['id'];}return db[_0xa872('0x2b')]['find']({'where':{'id':_0x44712f['params']['id']}})[_0xa872('0x25')](handleEntityNotFound(_0x3082fa,null))[_0xa872('0x25')](saveUpdates(_0x44712f[_0xa872('0x47')],null))[_0xa872('0x25')](respondWithResult(_0x3082fa,null))[_0xa872('0x42')](handleError(_0x3082fa,null));};exports['destroy']=function(_0x3596c0,_0xcf36bb){return db[_0xa872('0x2b')][_0xa872('0x4d')]({'where':{'id':_0x3596c0[_0xa872('0x44')]['id']}})['then'](handleEntityNotFound(_0xcf36bb,null))[_0xa872('0x25')](removeEntity(_0xcf36bb,null))[_0xa872('0x42')](handleError(_0xcf36bb,null));}; \ No newline at end of file +var _0x357c=['name','send','index','fieldName','model','map','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','type','VIRTUAL','filter','options','count','includeAll','include','CmContactHasPhone','findAll','rows','catch','params','keys','fields','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../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','apply','reject','save','update','then','destroy','get','error','stack'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x357c,0x11a));var _0xc357=function(_0x55c979,_0x36c5f0){_0x55c979=_0x55c979-0x0;var _0x690107=_0x357c[_0x55c979];return _0x690107;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc357('0x0'));var rimraf=require(_0xc357('0x1'));var zipdir=require(_0xc357('0x2'));var jsonpatch=require(_0xc357('0x3'));var rp=require(_0xc357('0x4'));var moment=require(_0xc357('0x5'));var BPromise=require(_0xc357('0x6'));var Mustache=require(_0xc357('0x7'));var util=require('util');var path=require(_0xc357('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc357('0x9'));var fs=require('fs');var _=require(_0xc357('0xa'));var squel=require(_0xc357('0xb'));var crypto=require(_0xc357('0xc'));var jsforce=require(_0xc357('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc357('0xe'));var querystring=require(_0xc357('0xf'));var Papa=require(_0xc357('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc357('0x11'));var as=require(_0xc357('0x12'));var hardwareService=require(_0xc357('0x13'));var logger=require(_0xc357('0x14'))(_0xc357('0x15'));var utils=require(_0xc357('0x16'));var config=require(_0xc357('0x17'));var licenseUtil=require(_0xc357('0x18'));var db=require(_0xc357('0x19'))['db'];function respondWithStatusCode(_0x1ef2d3,_0x23b757){_0x23b757=_0x23b757||0xcc;return function(_0x2f69be){if(_0x2f69be){return _0x1ef2d3[_0xc357('0x1a')](_0x23b757);}return _0x1ef2d3[_0xc357('0x1b')](_0x23b757)[_0xc357('0x1c')]();};}function respondWithResult(_0x20d80e,_0x2cbdde){_0x2cbdde=_0x2cbdde||0xc8;return function(_0x3ae784){if(_0x3ae784){return _0x20d80e[_0xc357('0x1b')](_0x2cbdde)[_0xc357('0x1d')](_0x3ae784);}};}function respondWithFilteredResult(_0x2d53e9,_0x23f350){return function(_0x442e37){if(_0x442e37){var _0x4f9aea=_0x442e37['count'],_0x4c2ed9=_0x23f350[_0xc357('0x1e')],_0x8fd44a=_0x23f350['offset']+_0x23f350[_0xc357('0x1f')],_0x579ae9;if(_0x8fd44a>=_0x4f9aea){_0x8fd44a=_0x4f9aea;_0x579ae9=0xc8;}else{_0x579ae9=0xce;}_0x2d53e9['status'](_0x579ae9);return _0x2d53e9[_0xc357('0x20')]('Content-Range',_0x4c2ed9+'-'+_0x8fd44a+'/'+_0x4f9aea)[_0xc357('0x1d')](_0x442e37);}return null;};}function patchUpdates(_0x34c5da){return function(_0x52401d){try{jsonpatch[_0xc357('0x21')](_0x52401d,_0x34c5da,!![]);}catch(_0x5565bb){return BPromise[_0xc357('0x22')](_0x5565bb);}return _0x52401d[_0xc357('0x23')]();};}function saveUpdates(_0x37abc4,_0x2fba00){return function(_0x7415a1){if(_0x7415a1){return _0x7415a1[_0xc357('0x24')](_0x37abc4)[_0xc357('0x25')](function(_0x301258){return _0x301258;});}return null;};}function removeEntity(_0x3a1cef,_0xaa33a7){return function(_0x54786f){if(_0x54786f){return _0x54786f[_0xc357('0x26')]()[_0xc357('0x25')](function(){var _0x1c8175=_0x54786f[_0xc357('0x27')]({'plain':!![]});var _0x1a409b='CmContactHasPhones';return db['UserProfileResource'][_0xc357('0x26')]({'where':{'type':_0x1a409b,'resourceId':_0x1c8175['id']}})['then'](function(){return _0x54786f;});})[_0xc357('0x25')](function(){_0x3a1cef[_0xc357('0x1b')](0xcc)[_0xc357('0x1c')]();});}};}function handleEntityNotFound(_0x4dfee3,_0x57b70a){return function(_0x4e4588){if(!_0x4e4588){_0x4dfee3[_0xc357('0x1a')](0x194);}return _0x4e4588;};}function handleError(_0x3d321a,_0x1c14e0){_0x1c14e0=_0x1c14e0||0x1f4;return function(_0x5346f6){logger[_0xc357('0x28')](_0x5346f6[_0xc357('0x29')]);if(_0x5346f6['name']){delete _0x5346f6[_0xc357('0x2a')];}_0x3d321a['status'](_0x1c14e0)[_0xc357('0x2b')](_0x5346f6);};}exports[_0xc357('0x2c')]=function(_0x6d4cc5,_0x2737f0){var _0x3df804={},_0x2aba9b={},_0x5dfa65={'count':0x0,'rows':[]};var _0x55f6df=_['map'](db['CmContactHasPhone']['rawAttributes'],function(_0x294571){return{'name':_0x294571[_0xc357('0x2d')],'type':_0x294571['type']['key']};});_0x2aba9b[_0xc357('0x2e')]=_[_0xc357('0x2f')](_0x55f6df,_0xc357('0x2a'));_0x2aba9b['query']=_['keys'](_0x6d4cc5['query']);_0x2aba9b[_0xc357('0x30')]=_[_0xc357('0x31')](_0x2aba9b[_0xc357('0x2e')],_0x2aba9b[_0xc357('0x32')]);_0x3df804[_0xc357('0x33')]=_[_0xc357('0x31')](_0x2aba9b[_0xc357('0x2e')],qs['fields'](_0x6d4cc5[_0xc357('0x32')]['fields']));_0x3df804[_0xc357('0x33')]=_0x3df804['attributes'][_0xc357('0x34')]?_0x3df804[_0xc357('0x33')]:_0x2aba9b[_0xc357('0x2e')];if(!_0x6d4cc5[_0xc357('0x32')][_0xc357('0x35')](_0xc357('0x36'))){_0x3df804['limit']=qs[_0xc357('0x1f')](_0x6d4cc5[_0xc357('0x32')]['limit']);_0x3df804[_0xc357('0x1e')]=qs[_0xc357('0x1e')](_0x6d4cc5[_0xc357('0x32')][_0xc357('0x1e')]);}_0x3df804['order']=qs[_0xc357('0x37')](_0x6d4cc5[_0xc357('0x32')][_0xc357('0x37')]);_0x3df804['where']=qs[_0xc357('0x30')](_[_0xc357('0x38')](_0x6d4cc5[_0xc357('0x32')],_0x2aba9b[_0xc357('0x30')]),_0x55f6df);if(_0x6d4cc5[_0xc357('0x32')]['filter']){_0x3df804[_0xc357('0x39')]=_[_0xc357('0x3a')](_0x3df804[_0xc357('0x39')],{'$or':_['map'](_0x55f6df,function(_0x8540d6){if(_0x8540d6[_0xc357('0x3b')]!==_0xc357('0x3c')){var _0x2c9719={};_0x2c9719[_0x8540d6[_0xc357('0x2a')]]={'$like':'%'+_0x6d4cc5[_0xc357('0x32')][_0xc357('0x3d')]+'%'};return _0x2c9719;}})});}_0x3df804=_[_0xc357('0x3a')]({},_0x3df804,_0x6d4cc5[_0xc357('0x3e')]);var _0x428407={'where':_0x3df804[_0xc357('0x39')]};return db['CmContactHasPhone']['count'](_0x428407)['then'](function(_0x35bb2c){_0x5dfa65[_0xc357('0x3f')]=_0x35bb2c;if(_0x6d4cc5[_0xc357('0x32')][_0xc357('0x40')]){_0x3df804[_0xc357('0x41')]=[{'all':!![]}];}return db[_0xc357('0x42')][_0xc357('0x43')](_0x3df804);})[_0xc357('0x25')](function(_0x2ba138){_0x5dfa65[_0xc357('0x44')]=_0x2ba138;return _0x5dfa65;})['then'](respondWithFilteredResult(_0x2737f0,_0x3df804))[_0xc357('0x45')](handleError(_0x2737f0,null));};exports['show']=function(_0xf7e452,_0x50c405){var _0x5f4a57={'raw':!![],'where':{'id':_0xf7e452[_0xc357('0x46')]['id']}},_0x28f845={};_0x28f845['model']=_[_0xc357('0x47')](db[_0xc357('0x42')]['rawAttributes']);_0x28f845[_0xc357('0x32')]=_['keys'](_0xf7e452[_0xc357('0x32')]);_0x28f845['filters']=_[_0xc357('0x31')](_0x28f845[_0xc357('0x2e')],_0x28f845['query']);_0x5f4a57[_0xc357('0x33')]=_[_0xc357('0x31')](_0x28f845[_0xc357('0x2e')],qs['fields'](_0xf7e452['query'][_0xc357('0x48')]));_0x5f4a57[_0xc357('0x33')]=_0x5f4a57['attributes']['length']?_0x5f4a57['attributes']:_0x28f845[_0xc357('0x2e')];if(_0xf7e452['query'][_0xc357('0x40')]){_0x5f4a57[_0xc357('0x41')]=[{'all':!![]}];}_0x5f4a57=_['merge']({},_0x5f4a57,_0xf7e452[_0xc357('0x3e')]);return db[_0xc357('0x42')]['find'](_0x5f4a57)[_0xc357('0x25')](handleEntityNotFound(_0x50c405,null))['then'](respondWithResult(_0x50c405,null))[_0xc357('0x45')](handleError(_0x50c405,null));};exports[_0xc357('0x49')]=function(_0x408a04,_0x16a0bc){return db[_0xc357('0x42')]['create'](_0x408a04[_0xc357('0x4a')],{})[_0xc357('0x25')](function(_0x225ec7){var _0x3d39de=_0x408a04['user'][_0xc357('0x27')]({'plain':!![]});if(!_0x3d39de)throw new Error(_0xc357('0x4b'));if(_0x3d39de[_0xc357('0x4c')]==='user'){var _0x25dc0d=_0x225ec7[_0xc357('0x27')]({'plain':!![]});var _0x3f7a25='CmContactHasPhones';return db['UserProfileSection']['find']({'where':{'name':_0x3f7a25,'userProfileId':_0x3d39de[_0xc357('0x4d')]},'raw':!![]})[_0xc357('0x25')](function(_0xc133e0){if(_0xc133e0&&_0xc133e0['autoAssociation']===0x0){return db[_0xc357('0x4e')][_0xc357('0x49')]({'name':_0x25dc0d['name'],'resourceId':_0x25dc0d['id'],'type':_0xc133e0[_0xc357('0x2a')],'sectionId':_0xc133e0['id']},{})['then'](function(){return _0x225ec7;});}else{return _0x225ec7;}})['catch'](function(_0x3421fb){logger['error'](_0xc357('0x4f'),_0x3421fb);throw _0x3421fb;});}return _0x225ec7;})[_0xc357('0x25')](respondWithResult(_0x16a0bc,0xc9))[_0xc357('0x45')](handleError(_0x16a0bc,null));};exports[_0xc357('0x24')]=function(_0x50236c,_0x38ad1b){if(_0x50236c[_0xc357('0x4a')]['id']){delete _0x50236c[_0xc357('0x4a')]['id'];}return db[_0xc357('0x42')][_0xc357('0x50')]({'where':{'id':_0x50236c[_0xc357('0x46')]['id']}})[_0xc357('0x25')](handleEntityNotFound(_0x38ad1b,null))['then'](saveUpdates(_0x50236c['body'],null))[_0xc357('0x25')](respondWithResult(_0x38ad1b,null))[_0xc357('0x45')](handleError(_0x38ad1b,null));};exports[_0xc357('0x26')]=function(_0x4e8d27,_0x2d3853){return db[_0xc357('0x42')]['find']({'where':{'id':_0x4e8d27[_0xc357('0x46')]['id']}})[_0xc357('0x25')](handleEntityNotFound(_0x2d3853,null))['then'](removeEntity(_0x2d3853,null))[_0xc357('0x45')](handleError(_0x2d3853,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index 88ef49f..15871f8 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 _0xb40e=['bluebird','path','rimraf','./cmContactHasPhone.attributes','exports','define','CmContactHasPhone','cm_contact_has_phones','lodash','../../config/logger'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb40e,0x120));var _0xeb40=function(_0xe30e17,_0xce02be){_0xe30e17=_0xe30e17-0x0;var _0x2342c9=_0xb40e[_0xe30e17];return _0x2342c9;};'use strict';var _=require(_0xeb40('0x0'));var util=require('util');var logger=require(_0xeb40('0x1'))('api');var moment=require('moment');var BPromise=require(_0xeb40('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb40('0x3'));var rimraf=require(_0xeb40('0x4'));var config=require('../../config/environment');var attributes=require(_0xeb40('0x5'));module[_0xeb40('0x6')]=function(_0x2eae5a,_0x495277){return _0x2eae5a[_0xeb40('0x7')](_0xeb40('0x8'),attributes,{'tableName':_0xeb40('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d56=['exports','CmContactHasPhone','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasPhone.attributes'];(function(_0x58a826,_0x397d14){var _0x47d7c9=function(_0x347131){while(--_0x347131){_0x58a826['push'](_0x58a826['shift']());}};_0x47d7c9(++_0x397d14);}(_0x7d56,0x156));var _0x67d5=function(_0x48ef30,_0x273671){_0x48ef30=_0x48ef30-0x0;var _0x974bf3=_0x7d56[_0x48ef30];return _0x974bf3;};'use strict';var _=require(_0x67d5('0x0'));var util=require(_0x67d5('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x67d5('0x2'));var rp=require(_0x67d5('0x3'));var fs=require('fs');var path=require(_0x67d5('0x4'));var rimraf=require(_0x67d5('0x5'));var config=require(_0x67d5('0x6'));var attributes=require(_0x67d5('0x7'));module[_0x67d5('0x8')]=function(_0x20aecd,_0x1dbb93){return _0x20aecd['define'](_0x67d5('0x9'),attributes,{'tableName':'cm_contact_has_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js index cda5388..f6368bc 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 _0xab9a=['error','CmContactHasPhone,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','then','info','CmContactHasPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code'];(function(_0x283ac0,_0x3734cc){var _0x181dd3=function(_0x1c9dbb){while(--_0x1c9dbb){_0x283ac0['push'](_0x283ac0['shift']());}};_0x181dd3(++_0x3734cc);}(_0xab9a,0x1b9));var _0xaab9=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xab9a[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0xaab9('0x0'));var util=require(_0xaab9('0x1'));var moment=require(_0xaab9('0x2'));var BPromise=require(_0xaab9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaab9('0x4'));var db=require(_0xaab9('0x5'))['db'];var utils=require(_0xaab9('0x6'));var logger=require(_0xaab9('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xaab9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3bad6d,_0x226750,_0x46eb4f){return new BPromise(function(_0x568f89,_0x3e8b63){return client['request'](_0x3bad6d,_0x46eb4f)[_0xaab9('0x9')](function(_0x199f61){logger[_0xaab9('0xa')]('CmContactHasPhone,\x20%s,\x20%s',_0x226750,'request\x20sent');logger['debug'](_0xaab9('0xb'),_0x226750,_0xaab9('0xc'),JSON[_0xaab9('0xd')](_0x199f61));if(_0x199f61['error']){if(_0x199f61['error'][_0xaab9('0xe')]===0x1f4){logger[_0xaab9('0xf')](_0xaab9('0x10'),_0x226750,_0x199f61[_0xaab9('0xf')][_0xaab9('0x11')]);return _0x3e8b63(_0x199f61[_0xaab9('0xf')][_0xaab9('0x11')]);}logger[_0xaab9('0xf')](_0xaab9('0x10'),_0x226750,_0x199f61[_0xaab9('0xf')][_0xaab9('0x11')]);return _0x568f89(_0x199f61[_0xaab9('0xf')]['message']);}else{logger[_0xaab9('0xa')](_0xaab9('0x10'),_0x226750,'request\x20sent');_0x568f89(_0x199f61[_0xaab9('0x12')][_0xaab9('0x11')]);}})['catch'](function(_0x458c5e){logger[_0xaab9('0xf')](_0xaab9('0x10'),_0x226750,_0x458c5e);_0x3e8b63(_0x458c5e);});});} \ No newline at end of file +var _0xf130=['CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','CmContactHasPhone,\x20%s,\x20%s'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xf130,0x149));var _0x0f13=function(_0xfdd6ce,_0x11403d){_0xfdd6ce=_0xfdd6ce-0x0;var _0x4df03a=_0xf130[_0xfdd6ce];return _0x4df03a;};'use strict';var _=require(_0x0f13('0x0'));var util=require(_0x0f13('0x1'));var moment=require(_0x0f13('0x2'));var BPromise=require(_0x0f13('0x3'));var rs=require(_0x0f13('0x4'));var fs=require('fs');var Redis=require(_0x0f13('0x5'));var db=require(_0x0f13('0x6'))['db'];var utils=require(_0x0f13('0x7'));var logger=require('../../config/logger')(_0x0f13('0x8'));var config=require(_0x0f13('0x9'));var jayson=require(_0x0f13('0xa'));var client=jayson[_0x0f13('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x164d39,_0x4d637f,_0x40cade){return new BPromise(function(_0x488309,_0x4407fc){return client[_0x0f13('0xc')](_0x164d39,_0x40cade)[_0x0f13('0xd')](function(_0x11636e){logger[_0x0f13('0xe')](_0x0f13('0xf'),_0x4d637f,'request\x20sent');logger['debug'](_0x0f13('0x10'),_0x4d637f,'request\x20sent',JSON[_0x0f13('0x11')](_0x11636e));if(_0x11636e[_0x0f13('0x12')]){if(_0x11636e[_0x0f13('0x12')]['code']===0x1f4){logger[_0x0f13('0x12')](_0x0f13('0xf'),_0x4d637f,_0x11636e[_0x0f13('0x12')][_0x0f13('0x13')]);return _0x4407fc(_0x11636e[_0x0f13('0x12')][_0x0f13('0x13')]);}logger['error'](_0x0f13('0xf'),_0x4d637f,_0x11636e[_0x0f13('0x12')]['message']);return _0x488309(_0x11636e[_0x0f13('0x12')][_0x0f13('0x13')]);}else{logger[_0x0f13('0xe')](_0x0f13('0xf'),_0x4d637f,_0x0f13('0x14'));_0x488309(_0x11636e[_0x0f13('0x15')][_0x0f13('0x13')]);}})[_0x0f13('0x16')](function(_0x5702c3){logger[_0x0f13('0x12')](_0x0f13('0xf'),_0x4d637f,_0x5702c3);_0x4407fc(_0x5702c3);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index 4e9f267..caaa87e 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 _0xe193=['create','put','/:id','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','post'];(function(_0x102243,_0x2b4dde){var _0x1d302c=function(_0x50c1fb){while(--_0x50c1fb){_0x102243['push'](_0x102243['shift']());}};_0x1d302c(++_0x2b4dde);}(_0xe193,0xe7));var _0x3e19=function(_0x1c1afa,_0x13c9ed){_0x1c1afa=_0x1c1afa-0x0;var _0x5062e6=_0xe193[_0x1c1afa];return _0x5062e6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3e19('0x0'));var timeout=require(_0x3e19('0x1'));var express=require('express');var router=express[_0x3e19('0x2')]();var auth=require(_0x3e19('0x3'));var interaction=require(_0x3e19('0x4'));var config=require(_0x3e19('0x5'));var controller=require('./cmContactHasPhone.controller');router[_0x3e19('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3e19('0x6')]('/:id',auth[_0x3e19('0x7')](),controller['show']);router[_0x3e19('0x8')]('/',auth[_0x3e19('0x7')](),controller[_0x3e19('0x9')]);router[_0x3e19('0xa')](_0x3e19('0xb'),auth[_0x3e19('0x7')](),controller['update']);router['delete'](_0x3e19('0xb'),auth[_0x3e19('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc797=['destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cmContactHasPhone.controller','get','isAuthenticated','index','show','create','/:id'];(function(_0xd4310e,_0x3a7b02){var _0x35e53d=function(_0x176491){while(--_0x176491){_0xd4310e['push'](_0xd4310e['shift']());}};_0x35e53d(++_0x3a7b02);}(_0xc797,0x72));var _0x7c79=function(_0x3de3f4,_0x3eacf1){_0x3de3f4=_0x3de3f4-0x0;var _0x2f2285=_0xc797[_0x3de3f4];return _0x2f2285;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7c79('0x0'));var timeout=require(_0x7c79('0x1'));var express=require(_0x7c79('0x2'));var router=express['Router']();var auth=require(_0x7c79('0x3'));var interaction=require(_0x7c79('0x4'));var config=require('../../config/environment');var controller=require(_0x7c79('0x5'));router[_0x7c79('0x6')]('/',auth[_0x7c79('0x7')](),controller[_0x7c79('0x8')]);router[_0x7c79('0x6')]('/:id',auth[_0x7c79('0x7')](),controller[_0x7c79('0x9')]);router['post']('/',auth[_0x7c79('0x7')](),controller[_0x7c79('0xa')]);router['put'](_0x7c79('0xb'),auth[_0x7c79('0x7')](),controller['update']);router['delete'](_0x7c79('0xb'),auth[_0x7c79('0x7')](),controller[_0x7c79('0xc')]);module[_0x7c79('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 2a4b23b..c96b5fb 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 _0x3d6d=['TEXT','long','type','parse','values','isArray','stringify','BOOLEAN','ENUM','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue'];(function(_0x2945da,_0x23d4f5){var _0x23cbbc=function(_0x4c720b){while(--_0x4c720b){_0x2945da['push'](_0x2945da['shift']());}};_0x23cbbc(++_0x23d4f5);}(_0x3d6d,0xb3));var _0xd3d6=function(_0x33ca22,_0xbcc94){_0x33ca22=_0x33ca22-0x0;var _0x1790c3=_0x3d6d[_0x33ca22];return _0x1790c3;};'use strict';var Sequelize=require(_0xd3d6('0x0'));var _=require(_0xd3d6('0x1'));module[_0xd3d6('0x2')]={'name':{'type':Sequelize[_0xd3d6('0x3')],'get':function(_0x380c09){return this[_0xd3d6('0x4')](_0xd3d6('0x5'));}},'alias':{'type':Sequelize[_0xd3d6('0x6')],'allowNull':![],'set':function(_0x297bd6){this[_0xd3d6('0x7')](_0xd3d6('0x5'),_0x297bd6?_0x297bd6:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0xd3d6('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xd3d6('0x8')](_0xd3d6('0x9')),'get':function(){if(this[_0xd3d6('0x4')](_0xd3d6('0xa'))==='select'){return JSON[_0xd3d6('0xb')](this[_0xd3d6('0x4')](_0xd3d6('0xc')));}else{return this[_0xd3d6('0x4')]('values');}},'set':function(_0x4cfd1b){if(Array[_0xd3d6('0xd')](_0x4cfd1b)){this[_0xd3d6('0x7')](_0xd3d6('0xc'),JSON[_0xd3d6('0xe')](_0x4cfd1b));}else{this[_0xd3d6('0x7')](_0xd3d6('0xc'),_0x4cfd1b);}}},'required':{'type':Sequelize[_0xd3d6('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xd3d6('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xd3d6('0x10')]('voice')}}; \ No newline at end of file +var _0x2b83=['BOOLEAN','voice','lodash','exports','getDataValue','alias','setDataValue','name','TEXT','long','type','parse','values','isArray','stringify'];(function(_0x466b8c,_0x492ed0){var _0x3f461d=function(_0x1bb52c){while(--_0x1bb52c){_0x466b8c['push'](_0x466b8c['shift']());}};_0x3f461d(++_0x492ed0);}(_0x2b83,0x1d3));var _0x32b8=function(_0x4a20e1,_0x448709){_0x4a20e1=_0x4a20e1-0x0;var _0x406aed=_0x2b83[_0x4a20e1];return _0x406aed;};'use strict';var Sequelize=require('sequelize');var _=require(_0x32b8('0x0'));module[_0x32b8('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3fcbdc){return this[_0x32b8('0x2')](_0x32b8('0x3'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x51d3b4){this[_0x32b8('0x4')](_0x32b8('0x3'),_0x51d3b4?_0x51d3b4:this['getDataValue'](_0x32b8('0x5')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x32b8('0x6')](_0x32b8('0x7')),'get':function(){if(this[_0x32b8('0x2')](_0x32b8('0x8'))==='select'){return JSON[_0x32b8('0x9')](this[_0x32b8('0x2')]('values'));}else{return this['getDataValue'](_0x32b8('0xa'));}},'set':function(_0x5ecf4e){if(Array[_0x32b8('0xb')](_0x5ecf4e)){this[_0x32b8('0x4')](_0x32b8('0xa'),JSON[_0x32b8('0xc')](_0x5ecf4e));}else{this['setDataValue'](_0x32b8('0xa'),_0x5ecf4e);}}},'required':{'type':Sequelize[_0x32b8('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x32b8('0xe'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 928050a..093aeb0 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 _0xb692=['show','params','keys','rawAttributes','includeAll','body','create','sequelize','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','format','cf_%d','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','Content-Range','save','destroy','then','sendStatus','error','stack','name','send','map','fieldName','key','model','differenceBy','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','CmCustomField','count','include','findAll','rows','catch'];(function(_0x594000,_0x5e6177){var _0x51d971=function(_0x499df9){while(--_0x499df9){_0x594000['push'](_0x594000['shift']());}};_0x51d971(++_0x5e6177);}(_0xb692,0x163));var _0x2b69=function(_0x1111b6,_0x406ede){_0x1111b6=_0x1111b6-0x0;var _0x2b4945=_0xb692[_0x1111b6];return _0x2b4945;};'use strict';var pdf=require(_0x2b69('0x0'));var emlformat=require(_0x2b69('0x1'));var rimraf=require(_0x2b69('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b69('0x3'));var rp=require(_0x2b69('0x4'));var moment=require('moment');var BPromise=require(_0x2b69('0x5'));var Mustache=require(_0x2b69('0x6'));var util=require('util');var path=require(_0x2b69('0x7'));var sox=require('sox');var csv=require(_0x2b69('0x8'));var ejs=require(_0x2b69('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2b69('0xa'));var jsforce=require(_0x2b69('0xb'));var deskjs=require(_0x2b69('0xc'));var toCsv=require(_0x2b69('0x8'));var querystring=require(_0x2b69('0xd'));var Papa=require(_0x2b69('0xe'));var Redis=require(_0x2b69('0xf'));var authService=require(_0x2b69('0x10'));var qs=require(_0x2b69('0x11'));var as=require(_0x2b69('0x12'));var hardwareService=require(_0x2b69('0x13'));var logger=require(_0x2b69('0x14'))('api');var utils=require(_0x2b69('0x15'));var config=require(_0x2b69('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2b69('0x17'))['db'];function respondWithStatusCode(_0x140ef6,_0x3e09d8){_0x3e09d8=_0x3e09d8||0xcc;return function(_0x473f94){if(_0x473f94){return _0x140ef6['sendStatus'](_0x3e09d8);}return _0x140ef6[_0x2b69('0x18')](_0x3e09d8)[_0x2b69('0x19')]();};}function respondWithResult(_0x5b1822,_0x42c4c0){_0x42c4c0=_0x42c4c0||0xc8;return function(_0x17dc7c){if(_0x17dc7c){return _0x5b1822[_0x2b69('0x18')](_0x42c4c0)[_0x2b69('0x1a')](_0x17dc7c);}};}function respondWithFilteredResult(_0x4a44b5,_0x3f41a5){return function(_0x2f2321){if(_0x2f2321){var _0x4b89f7=_0x2f2321['count'],_0x31805d=_0x3f41a5['offset'],_0x4ee3ef=_0x3f41a5[_0x2b69('0x1b')]+_0x3f41a5[_0x2b69('0x1c')],_0xfa7fd9;if(_0x4ee3ef>=_0x4b89f7){_0x4ee3ef=_0x4b89f7;_0xfa7fd9=0xc8;}else{_0xfa7fd9=0xce;}_0x4a44b5[_0x2b69('0x18')](_0xfa7fd9);return _0x4a44b5[_0x2b69('0x1d')](_0x2b69('0x1e'),_0x31805d+'-'+_0x4ee3ef+'/'+_0x4b89f7)[_0x2b69('0x1a')](_0x2f2321);}return null;};}function patchUpdates(_0x2551a1){return function(_0xf2c172){try{jsonpatch['apply'](_0xf2c172,_0x2551a1,!![]);}catch(_0x1b3049){return BPromise['reject'](_0x1b3049);}return _0xf2c172[_0x2b69('0x1f')]();};}function saveUpdates(_0x159573,_0x25c0c3){return function(_0x99d8f4){if(_0x99d8f4){return _0x99d8f4['update'](_0x159573)['then'](function(_0x36dec3){return _0x36dec3;});}return null;};}function removeEntity(_0x1d9c18,_0x33e7e5){return function(_0x48b872){if(_0x48b872){return _0x48b872[_0x2b69('0x20')]()[_0x2b69('0x21')](function(){_0x1d9c18['status'](0xcc)[_0x2b69('0x19')]();});}};}function handleEntityNotFound(_0x50a685,_0x5943aa){return function(_0x100fa1){if(!_0x100fa1){_0x50a685[_0x2b69('0x22')](0x194);}return _0x100fa1;};}function handleError(_0x108e6c,_0xff787b){_0xff787b=_0xff787b||0x1f4;return function(_0x4f6985){logger[_0x2b69('0x23')](_0x4f6985[_0x2b69('0x24')]);if(_0x4f6985['name']){delete _0x4f6985[_0x2b69('0x25')];}_0x108e6c[_0x2b69('0x18')](_0xff787b)[_0x2b69('0x26')](_0x4f6985);};}exports['index']=function(_0xa42063,_0x2f6a87){var _0x4e0455={},_0x35779c={},_0x37b3a7={'count':0x0,'rows':[]};var _0x103808=_[_0x2b69('0x27')](db['CmCustomField']['rawAttributes'],function(_0x209dea){return{'name':_0x209dea[_0x2b69('0x28')],'type':_0x209dea['type'][_0x2b69('0x29')]};});_0x35779c[_0x2b69('0x2a')]=_[_0x2b69('0x2b')](_[_0x2b69('0x27')](_0x103808,_0x2b69('0x25')),[_0x2b69('0x25')]);_0x35779c[_0x2b69('0x2c')]=_['keys'](_0xa42063['query']);_0x35779c[_0x2b69('0x2d')]=_[_0x2b69('0x2e')](_0x35779c[_0x2b69('0x2a')],_0x35779c[_0x2b69('0x2c')]);_0x4e0455[_0x2b69('0x2f')]=_[_0x2b69('0x2e')](_0x35779c[_0x2b69('0x2a')],qs[_0x2b69('0x30')](_0xa42063[_0x2b69('0x2c')][_0x2b69('0x30')]));_0x4e0455['attributes']=_0x4e0455[_0x2b69('0x2f')][_0x2b69('0x31')]?_0x4e0455[_0x2b69('0x2f')]:_0x35779c[_0x2b69('0x2a')];if(!_0xa42063['query'][_0x2b69('0x32')](_0x2b69('0x33'))){_0x4e0455[_0x2b69('0x1c')]=qs[_0x2b69('0x1c')](_0xa42063['query'][_0x2b69('0x1c')]);_0x4e0455[_0x2b69('0x1b')]=qs[_0x2b69('0x1b')](_0xa42063[_0x2b69('0x2c')]['offset']);}_0x4e0455['order']=qs['sort'](_0xa42063[_0x2b69('0x2c')][_0x2b69('0x34')]);_0x4e0455[_0x2b69('0x35')]=qs['filters'](_['pick'](_0xa42063[_0x2b69('0x2c')],_0x35779c[_0x2b69('0x2d')]),_0x103808);if(_0xa42063['query'][_0x2b69('0x36')]){_0x4e0455[_0x2b69('0x35')]=_[_0x2b69('0x37')](_0x4e0455[_0x2b69('0x35')],{'$or':_[_0x2b69('0x27')](_0x103808,function(_0x2f8310){if(_0x2f8310[_0x2b69('0x38')]!==_0x2b69('0x39')){var _0x1e9f9c={};_0x1e9f9c[_0x2f8310[_0x2b69('0x25')]]={'$like':'%'+_0xa42063[_0x2b69('0x2c')][_0x2b69('0x36')]+'%'};return _0x1e9f9c;}})});}_0x4e0455=_[_0x2b69('0x37')]({},_0x4e0455,_0xa42063[_0x2b69('0x3a')]);var _0x56882f={'where':_0x4e0455[_0x2b69('0x35')]};return db[_0x2b69('0x3b')]['count'](_0x56882f)[_0x2b69('0x21')](function(_0xdbf6b7){_0x37b3a7[_0x2b69('0x3c')]=_0xdbf6b7;if(_0xa42063[_0x2b69('0x2c')]['includeAll']){_0x4e0455[_0x2b69('0x3d')]=[{'all':!![]}];}return db[_0x2b69('0x3b')][_0x2b69('0x3e')](_0x4e0455);})[_0x2b69('0x21')](function(_0x1f1316){_0x37b3a7[_0x2b69('0x3f')]=_0x1f1316;return _0x37b3a7;})[_0x2b69('0x21')](respondWithFilteredResult(_0x2f6a87,_0x4e0455))[_0x2b69('0x40')](handleError(_0x2f6a87,null));};exports[_0x2b69('0x41')]=function(_0x37555b,_0xa19f73){var _0x4499b1={'raw':!![],'where':{'id':_0x37555b[_0x2b69('0x42')]['id']}},_0x5d7ba7={};_0x5d7ba7['model']=_[_0x2b69('0x43')](db[_0x2b69('0x3b')][_0x2b69('0x44')]);_0x5d7ba7[_0x2b69('0x2c')]=_[_0x2b69('0x43')](_0x37555b[_0x2b69('0x2c')]);_0x5d7ba7[_0x2b69('0x2d')]=_[_0x2b69('0x2e')](_0x5d7ba7[_0x2b69('0x2a')],_0x5d7ba7[_0x2b69('0x2c')]);_0x4499b1[_0x2b69('0x2f')]=_[_0x2b69('0x2e')](_0x5d7ba7[_0x2b69('0x2a')],qs[_0x2b69('0x30')](_0x37555b[_0x2b69('0x2c')][_0x2b69('0x30')]));_0x4499b1[_0x2b69('0x2f')]=_0x4499b1[_0x2b69('0x2f')][_0x2b69('0x31')]?_0x4499b1['attributes']:_0x5d7ba7['model'];if(_0x37555b['query'][_0x2b69('0x45')]){_0x4499b1[_0x2b69('0x3d')]=[{'all':!![]}];}_0x4499b1=_[_0x2b69('0x37')]({},_0x4499b1,_0x37555b[_0x2b69('0x3a')]);return db[_0x2b69('0x3b')]['find'](_0x4499b1)[_0x2b69('0x21')](handleEntityNotFound(_0xa19f73,null))[_0x2b69('0x21')](respondWithResult(_0xa19f73,null))[_0x2b69('0x40')](handleError(_0xa19f73,null));};exports['update']=function(_0x30e8ad,_0x2ae6ee){if(_0x30e8ad['body']['id']){delete _0x30e8ad[_0x2b69('0x46')]['id'];}return db[_0x2b69('0x3b')]['find']({'where':{'id':_0x30e8ad[_0x2b69('0x42')]['id']}})[_0x2b69('0x21')](handleEntityNotFound(_0x2ae6ee,null))[_0x2b69('0x21')](saveUpdates(_0x30e8ad['body'],null))[_0x2b69('0x21')](respondWithResult(_0x2ae6ee,null))[_0x2b69('0x40')](handleError(_0x2ae6ee,null));};exports[_0x2b69('0x20')]=function(_0x8116fd,_0x493f78){return db[_0x2b69('0x3b')]['find']({'where':{'id':_0x8116fd[_0x2b69('0x42')]['id']}})[_0x2b69('0x21')](handleEntityNotFound(_0x493f78,null))[_0x2b69('0x21')](removeEntity(_0x493f78,null))['catch'](handleError(_0x493f78,null));};exports[_0x2b69('0x47')]=function(_0x28c55b,_0x277e20){var _0x419046;return db[_0x2b69('0x48')][_0x2b69('0x49')](function(_0x67fda0){return db['CmCustomField']['create'](_0x28c55b[_0x2b69('0x46')],{'transaction':_0x67fda0})[_0x2b69('0x21')](function(_0x399559){_0x419046=_0x399559;var _0x172b3c={'type':db[_0x2b69('0x4a')][_0x2b69('0x4b')],'transaction':_0x67fda0};switch(_0x28c55b[_0x2b69('0x46')][_0x2b69('0x38')]){case'text':_0x172b3c[_0x2b69('0x38')]=db['Sequelize']['TEXT'];break;case _0x2b69('0x4c'):_0x172b3c['type']=db['Sequelize'][_0x2b69('0x4d')];break;case _0x2b69('0x4e'):_0x172b3c[_0x2b69('0x38')]=db['Sequelize'][_0x2b69('0x4f')];_0x172b3c[_0x2b69('0x50')]=![];break;default:}return db[_0x2b69('0x48')][_0x2b69('0x51')]['addColumn']('cm_contacts',util[_0x2b69('0x52')](_0x2b69('0x53'),_0x419046['id']),_0x172b3c);})[_0x2b69('0x21')](function(){return _0x419046;});})[_0x2b69('0x21')](respondWithResult(_0x277e20,0xc9))[_0x2b69('0x40')](handleError(_0x277e20,null));}; \ No newline at end of file +var _0x8f5d=['create','transaction','TEXT','text','Sequelize','INTEGER','defaultValue','sequelize','cm_contacts','format','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','model','differenceBy','query','keys','filters','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','body'];(function(_0x11b090,_0x8d9e0c){var _0xd2d1f1=function(_0x43acf8){while(--_0x43acf8){_0x11b090['push'](_0x11b090['shift']());}};_0xd2d1f1(++_0x8d9e0c);}(_0x8f5d,0xb8));var _0xd8f5=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x8f5d[_0x1b2ff7];return _0x31656a;};'use strict';var pdf=require(_0xd8f5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd8f5('0x1'));var zipdir=require(_0xd8f5('0x2'));var jsonpatch=require(_0xd8f5('0x3'));var rp=require('request-promise');var moment=require(_0xd8f5('0x4'));var BPromise=require(_0xd8f5('0x5'));var Mustache=require('mustache');var util=require(_0xd8f5('0x6'));var path=require(_0xd8f5('0x7'));var sox=require(_0xd8f5('0x8'));var csv=require(_0xd8f5('0x9'));var ejs=require(_0xd8f5('0xa'));var fs=require('fs');var _=require(_0xd8f5('0xb'));var squel=require(_0xd8f5('0xc'));var crypto=require(_0xd8f5('0xd'));var jsforce=require(_0xd8f5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd8f5('0x9'));var querystring=require(_0xd8f5('0xf'));var Papa=require(_0xd8f5('0x10'));var Redis=require(_0xd8f5('0x11'));var authService=require(_0xd8f5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd8f5('0x13'));var hardwareService=require(_0xd8f5('0x14'));var logger=require(_0xd8f5('0x15'))(_0xd8f5('0x16'));var utils=require(_0xd8f5('0x17'));var config=require(_0xd8f5('0x18'));var licenseUtil=require(_0xd8f5('0x19'));var db=require(_0xd8f5('0x1a'))['db'];function respondWithStatusCode(_0x1ecefe,_0x508c08){_0x508c08=_0x508c08||0xcc;return function(_0x1b52a0){if(_0x1b52a0){return _0x1ecefe[_0xd8f5('0x1b')](_0x508c08);}return _0x1ecefe[_0xd8f5('0x1c')](_0x508c08)[_0xd8f5('0x1d')]();};}function respondWithResult(_0x28f01a,_0xb4b760){_0xb4b760=_0xb4b760||0xc8;return function(_0x4b5e9d){if(_0x4b5e9d){return _0x28f01a[_0xd8f5('0x1c')](_0xb4b760)['json'](_0x4b5e9d);}};}function respondWithFilteredResult(_0xc58ed0,_0x3935ab){return function(_0xa76d9){if(_0xa76d9){var _0x2c664a=_0xa76d9[_0xd8f5('0x1e')],_0x9e0c21=_0x3935ab[_0xd8f5('0x1f')],_0x4e23f1=_0x3935ab[_0xd8f5('0x1f')]+_0x3935ab['limit'],_0x55b796;if(_0x4e23f1>=_0x2c664a){_0x4e23f1=_0x2c664a;_0x55b796=0xc8;}else{_0x55b796=0xce;}_0xc58ed0[_0xd8f5('0x1c')](_0x55b796);return _0xc58ed0['set'](_0xd8f5('0x20'),_0x9e0c21+'-'+_0x4e23f1+'/'+_0x2c664a)['json'](_0xa76d9);}return null;};}function patchUpdates(_0x4fde14){return function(_0x41b7db){try{jsonpatch[_0xd8f5('0x21')](_0x41b7db,_0x4fde14,!![]);}catch(_0xe9871e){return BPromise[_0xd8f5('0x22')](_0xe9871e);}return _0x41b7db[_0xd8f5('0x23')]();};}function saveUpdates(_0x4c8978,_0x19c382){return function(_0xf722d5){if(_0xf722d5){return _0xf722d5[_0xd8f5('0x24')](_0x4c8978)[_0xd8f5('0x25')](function(_0x556d90){return _0x556d90;});}return null;};}function removeEntity(_0x1e3d61,_0x2be2e5){return function(_0xc4f025){if(_0xc4f025){return _0xc4f025[_0xd8f5('0x26')]()['then'](function(){_0x1e3d61['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22ec54,_0x4ea7cf){return function(_0x47e7fb){if(!_0x47e7fb){_0x22ec54[_0xd8f5('0x1b')](0x194);}return _0x47e7fb;};}function handleError(_0x2a2d17,_0x2d839e){_0x2d839e=_0x2d839e||0x1f4;return function(_0x3af343){logger[_0xd8f5('0x27')](_0x3af343[_0xd8f5('0x28')]);if(_0x3af343[_0xd8f5('0x29')]){delete _0x3af343[_0xd8f5('0x29')];}_0x2a2d17[_0xd8f5('0x1c')](_0x2d839e)[_0xd8f5('0x2a')](_0x3af343);};}exports[_0xd8f5('0x2b')]=function(_0x380e26,_0x2fd51c){var _0x3e054d={},_0x20bc79={},_0x20a46c={'count':0x0,'rows':[]};var _0x26ed4f=_[_0xd8f5('0x2c')](db[_0xd8f5('0x2d')][_0xd8f5('0x2e')],function(_0x4b6bf8){return{'name':_0x4b6bf8[_0xd8f5('0x2f')],'type':_0x4b6bf8[_0xd8f5('0x30')]['key']};});_0x20bc79[_0xd8f5('0x31')]=_[_0xd8f5('0x32')](_[_0xd8f5('0x2c')](_0x26ed4f,_0xd8f5('0x29')),[_0xd8f5('0x29')]);_0x20bc79[_0xd8f5('0x33')]=_[_0xd8f5('0x34')](_0x380e26['query']);_0x20bc79[_0xd8f5('0x35')]=_['intersection'](_0x20bc79['model'],_0x20bc79['query']);_0x3e054d['attributes']=_['intersection'](_0x20bc79[_0xd8f5('0x31')],qs[_0xd8f5('0x36')](_0x380e26[_0xd8f5('0x33')][_0xd8f5('0x36')]));_0x3e054d[_0xd8f5('0x37')]=_0x3e054d['attributes'][_0xd8f5('0x38')]?_0x3e054d[_0xd8f5('0x37')]:_0x20bc79['model'];if(!_0x380e26[_0xd8f5('0x33')]['hasOwnProperty'](_0xd8f5('0x39'))){_0x3e054d[_0xd8f5('0x3a')]=qs[_0xd8f5('0x3a')](_0x380e26['query']['limit']);_0x3e054d['offset']=qs[_0xd8f5('0x1f')](_0x380e26['query'][_0xd8f5('0x1f')]);}_0x3e054d[_0xd8f5('0x3b')]=qs[_0xd8f5('0x3c')](_0x380e26[_0xd8f5('0x33')][_0xd8f5('0x3c')]);_0x3e054d[_0xd8f5('0x3d')]=qs[_0xd8f5('0x35')](_[_0xd8f5('0x3e')](_0x380e26['query'],_0x20bc79[_0xd8f5('0x35')]),_0x26ed4f);if(_0x380e26[_0xd8f5('0x33')][_0xd8f5('0x3f')]){_0x3e054d[_0xd8f5('0x3d')]=_[_0xd8f5('0x40')](_0x3e054d[_0xd8f5('0x3d')],{'$or':_['map'](_0x26ed4f,function(_0x5795e2){if(_0x5795e2['type']!==_0xd8f5('0x41')){var _0x4b0a82={};_0x4b0a82[_0x5795e2[_0xd8f5('0x29')]]={'$like':'%'+_0x380e26[_0xd8f5('0x33')]['filter']+'%'};return _0x4b0a82;}})});}_0x3e054d=_['merge']({},_0x3e054d,_0x380e26[_0xd8f5('0x42')]);var _0x2ef35f={'where':_0x3e054d[_0xd8f5('0x3d')]};return db[_0xd8f5('0x2d')]['count'](_0x2ef35f)[_0xd8f5('0x25')](function(_0x446dbc){_0x20a46c[_0xd8f5('0x1e')]=_0x446dbc;if(_0x380e26[_0xd8f5('0x33')][_0xd8f5('0x43')]){_0x3e054d[_0xd8f5('0x44')]=[{'all':!![]}];}return db[_0xd8f5('0x2d')][_0xd8f5('0x45')](_0x3e054d);})[_0xd8f5('0x25')](function(_0x476482){_0x20a46c[_0xd8f5('0x46')]=_0x476482;return _0x20a46c;})[_0xd8f5('0x25')](respondWithFilteredResult(_0x2fd51c,_0x3e054d))[_0xd8f5('0x47')](handleError(_0x2fd51c,null));};exports[_0xd8f5('0x48')]=function(_0x131451,_0x37c737){var _0x32407e={'raw':!![],'where':{'id':_0x131451[_0xd8f5('0x49')]['id']}},_0x5df2bd={};_0x5df2bd[_0xd8f5('0x31')]=_[_0xd8f5('0x34')](db[_0xd8f5('0x2d')]['rawAttributes']);_0x5df2bd[_0xd8f5('0x33')]=_[_0xd8f5('0x34')](_0x131451['query']);_0x5df2bd[_0xd8f5('0x35')]=_[_0xd8f5('0x4a')](_0x5df2bd[_0xd8f5('0x31')],_0x5df2bd[_0xd8f5('0x33')]);_0x32407e[_0xd8f5('0x37')]=_[_0xd8f5('0x4a')](_0x5df2bd['model'],qs[_0xd8f5('0x36')](_0x131451[_0xd8f5('0x33')][_0xd8f5('0x36')]));_0x32407e[_0xd8f5('0x37')]=_0x32407e[_0xd8f5('0x37')]['length']?_0x32407e[_0xd8f5('0x37')]:_0x5df2bd[_0xd8f5('0x31')];if(_0x131451[_0xd8f5('0x33')][_0xd8f5('0x43')]){_0x32407e[_0xd8f5('0x44')]=[{'all':!![]}];}_0x32407e=_['merge']({},_0x32407e,_0x131451['options']);return db[_0xd8f5('0x2d')][_0xd8f5('0x4b')](_0x32407e)['then'](handleEntityNotFound(_0x37c737,null))[_0xd8f5('0x25')](respondWithResult(_0x37c737,null))[_0xd8f5('0x47')](handleError(_0x37c737,null));};exports['update']=function(_0x3497ca,_0x2cacbe){if(_0x3497ca[_0xd8f5('0x4c')]['id']){delete _0x3497ca[_0xd8f5('0x4c')]['id'];}return db[_0xd8f5('0x2d')]['find']({'where':{'id':_0x3497ca['params']['id']}})[_0xd8f5('0x25')](handleEntityNotFound(_0x2cacbe,null))[_0xd8f5('0x25')](saveUpdates(_0x3497ca['body'],null))[_0xd8f5('0x25')](respondWithResult(_0x2cacbe,null))['catch'](handleError(_0x2cacbe,null));};exports[_0xd8f5('0x26')]=function(_0x2e9c66,_0x1f64ef){return db[_0xd8f5('0x2d')]['find']({'where':{'id':_0x2e9c66['params']['id']}})[_0xd8f5('0x25')](handleEntityNotFound(_0x1f64ef,null))[_0xd8f5('0x25')](removeEntity(_0x1f64ef,null))[_0xd8f5('0x47')](handleError(_0x1f64ef,null));};exports[_0xd8f5('0x4d')]=function(_0x1c6935,_0x554da2){var _0xd0e699;return db['sequelize'][_0xd8f5('0x4e')](function(_0x5bd903){return db[_0xd8f5('0x2d')]['create'](_0x1c6935[_0xd8f5('0x4c')],{'transaction':_0x5bd903})[_0xd8f5('0x25')](function(_0x2d2071){_0xd0e699=_0x2d2071;var _0x370432={'type':db['Sequelize'][_0xd8f5('0x4f')],'transaction':_0x5bd903};switch(_0x1c6935['body']['type']){case _0xd8f5('0x50'):_0x370432['type']=db[_0xd8f5('0x51')]['TEXT'];break;case'number':_0x370432[_0xd8f5('0x30')]=db[_0xd8f5('0x51')][_0xd8f5('0x52')];break;case'switch':_0x370432[_0xd8f5('0x30')]=db[_0xd8f5('0x51')]['BOOLEAN'];_0x370432[_0xd8f5('0x53')]=![];break;default:}return db[_0xd8f5('0x54')]['queryInterface']['addColumn'](_0xd8f5('0x55'),util[_0xd8f5('0x56')]('cf_%d',_0xd0e699['id']),_0x370432);})[_0xd8f5('0x25')](function(){return _0xd0e699;});})[_0xd8f5('0x25')](respondWithResult(_0x554da2,0xc9))['catch'](handleError(_0x554da2,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 03be2ad..2fbef99 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 _0x622d=['rimraf','./cmCustomField.attributes','define','CmCustomField','lodash','util','api','bluebird','request-promise','path'];(function(_0x2ecc65,_0xd75c48){var _0x103cc3=function(_0x3f856b){while(--_0x3f856b){_0x2ecc65['push'](_0x2ecc65['shift']());}};_0x103cc3(++_0xd75c48);}(_0x622d,0x1c6));var _0xd622=function(_0xff6648,_0x40608e){_0xff6648=_0xff6648-0x0;var _0x2b6b96=_0x622d[_0xff6648];return _0x2b6b96;};'use strict';var _=require(_0xd622('0x0'));var util=require(_0xd622('0x1'));var logger=require('../../config/logger')(_0xd622('0x2'));var moment=require('moment');var BPromise=require(_0xd622('0x3'));var rp=require(_0xd622('0x4'));var fs=require('fs');var path=require(_0xd622('0x5'));var rimraf=require(_0xd622('0x6'));var config=require('../../config/environment');var attributes=require(_0xd622('0x7'));module['exports']=function(_0x51d808,_0x2bf02a){return _0x51d808[_0xd622('0x8')](_0xd622('0x9'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15e9=['rimraf','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x21200f,_0xf12c31){var _0x21d023=function(_0x56f96b){while(--_0x56f96b){_0x21200f['push'](_0x21200f['shift']());}};_0x21d023(++_0xf12c31);}(_0x15e9,0xd6));var _0x915e=function(_0x376b40,_0xcfdcdb){_0x376b40=_0x376b40-0x0;var _0x25e73a=_0x15e9[_0x376b40];return _0x25e73a;};'use strict';var _=require(_0x915e('0x0'));var util=require(_0x915e('0x1'));var logger=require('../../config/logger')(_0x915e('0x2'));var moment=require(_0x915e('0x3'));var BPromise=require(_0x915e('0x4'));var rp=require(_0x915e('0x5'));var fs=require('fs');var path=require(_0x915e('0x6'));var rimraf=require(_0x915e('0x7'));var config=require('../../config/environment');var attributes=require(_0x915e('0x8'));module[_0x915e('0x9')]=function(_0x461b96,_0x555092){return _0x461b96[_0x915e('0xa')](_0x915e('0xb'),attributes,{'tableName':_0x915e('0xc'),'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 c87fbdd..3a92e3c 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 _0xc874=['bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment'];(function(_0x7e6001,_0x35de22){var _0x5eded1=function(_0xf806b3){while(--_0xf806b3){_0x7e6001['push'](_0x7e6001['shift']());}};_0x5eded1(++_0x35de22);}(_0xc874,0x154));var _0x4c87=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xc874[_0x3c4737];return _0x2bb926;};'use strict';var _=require(_0x4c87('0x0'));var util=require('util');var moment=require(_0x4c87('0x1'));var BPromise=require(_0x4c87('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c87('0x3'))['db'];var utils=require(_0x4c87('0x4'));var logger=require(_0x4c87('0x5'))('rpc');var config=require(_0x4c87('0x6'));var jayson=require(_0x4c87('0x7'));var client=jayson['client'][_0x4c87('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dafe0,_0x30c939,_0xdc4a29){return new BPromise(function(_0x116649,_0x5b7720){return client[_0x4c87('0x9')](_0x3dafe0,_0xdc4a29)['then'](function(_0x384268){logger[_0x4c87('0xa')](_0x4c87('0xb'),_0x30c939,_0x4c87('0xc'));logger[_0x4c87('0xd')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x30c939,_0x4c87('0xc'),JSON[_0x4c87('0xe')](_0x384268));if(_0x384268['error']){if(_0x384268[_0x4c87('0xf')][_0x4c87('0x10')]===0x1f4){logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x384268[_0x4c87('0xf')]['message']);return _0x5b7720(_0x384268['error']['message']);}logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x384268[_0x4c87('0xf')][_0x4c87('0x11')]);return _0x116649(_0x384268[_0x4c87('0xf')][_0x4c87('0x11')]);}else{logger[_0x4c87('0xa')](_0x4c87('0xb'),_0x30c939,'request\x20sent');_0x116649(_0x384268[_0x4c87('0x12')][_0x4c87('0x11')]);}})['catch'](function(_0x575de5){logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x575de5);_0x5b7720(_0x575de5);});});} \ No newline at end of file +var _0x4ea3=['CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4ea3,0x70));var _0x34ea=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4ea3[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var moment=require(_0x34ea('0x2'));var BPromise=require(_0x34ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x34ea('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x34ea('0x6'));var jayson=require(_0x34ea('0x7'));var client=jayson[_0x34ea('0x8')][_0x34ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40434e,_0x18b461,_0x22b09e){return new BPromise(function(_0x5bec7c,_0x341727){return client[_0x34ea('0xa')](_0x40434e,_0x22b09e)[_0x34ea('0xb')](function(_0x5132c4){logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,'request\x20sent');logger['debug'](_0x34ea('0xe'),_0x18b461,_0x34ea('0xf'),JSON[_0x34ea('0x10')](_0x5132c4));if(_0x5132c4['error']){if(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x12')]===0x1f4){logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);return _0x341727(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')]['message']);return _0x5bec7c(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}else{logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,_0x34ea('0xf'));_0x5bec7c(_0x5132c4['result'][_0x34ea('0x13')]);}})[_0x34ea('0x14')](function(_0x3fa3b0){logger[_0x34ea('0x11')]('CmCustomField,\x20%s,\x20%s',_0x18b461,_0x3fa3b0);_0x341727(_0x3fa3b0);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index e9ce63a..b525559 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 _0x35d5=['post','put','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x458363,_0x1675db){var _0x4d0290=function(_0x22960f){while(--_0x22960f){_0x458363['push'](_0x458363['shift']());}};_0x4d0290(++_0x1675db);}(_0x35d5,0x1b5));var _0x535d=function(_0x250642,_0x266aa7){_0x250642=_0x250642-0x0;var _0x3b43cd=_0x35d5[_0x250642];return _0x3b43cd;};'use strict';var multer=require('multer');var util=require(_0x535d('0x0'));var path=require(_0x535d('0x1'));var timeout=require(_0x535d('0x2'));var express=require('express');var router=express[_0x535d('0x3')]();var auth=require(_0x535d('0x4'));var interaction=require(_0x535d('0x5'));var config=require(_0x535d('0x6'));var controller=require(_0x535d('0x7'));router[_0x535d('0x8')]('/',auth[_0x535d('0x9')](),controller[_0x535d('0xa')]);router[_0x535d('0x8')](_0x535d('0xb'),auth[_0x535d('0x9')](),controller[_0x535d('0xc')]);router[_0x535d('0xd')]('/',auth[_0x535d('0x9')](),controller['create']);router[_0x535d('0xe')]('/:id',auth[_0x535d('0x9')](),controller['update']);router[_0x535d('0xf')](_0x535d('0xb'),auth['isAuthenticated'](),controller[_0x535d('0x10')]);module[_0x535d('0x11')]=router; \ No newline at end of file +var _0x2752=['show','create','update','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','index','/:id','isAuthenticated'];(function(_0xa41215,_0x2a637a){var _0x54dd0f=function(_0x42194a){while(--_0x42194a){_0xa41215['push'](_0xa41215['shift']());}};_0x54dd0f(++_0x2a637a);}(_0x2752,0x199));var _0x2275=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2752[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x2275('0x0'));var util=require(_0x2275('0x1'));var path=require(_0x2275('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2275('0x3')]();var auth=require(_0x2275('0x4'));var interaction=require(_0x2275('0x5'));var config=require(_0x2275('0x6'));var controller=require(_0x2275('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x2275('0x8')]);router['get'](_0x2275('0x9'),auth[_0x2275('0xa')](),controller[_0x2275('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2275('0xc')]);router['put'](_0x2275('0x9'),auth[_0x2275('0xa')](),controller[_0x2275('0xd')]);router['delete']('/:id',auth[_0x2275('0xa')](),controller['destroy']);module[_0x2275('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 23f24fd..723555a 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 _0x98a8=['format','INTEGER','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x98a8,0x12c));var _0x898a=function(_0x216c41,_0xccfd30){_0x216c41=_0x216c41-0x0;var _0x590ecb=_0x98a8[_0x216c41];return _0x590ecb;};'use strict';var moment=require(_0x898a('0x0'));var Sequelize=require(_0x898a('0x1'));module[_0x898a('0x2')]={'phone':{'type':Sequelize[_0x898a('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x898a('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x898a('0x5')],'defaultValue':moment()[_0x898a('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x898a('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x898a('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x898a('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x898a('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x898a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x898a('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x898a('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x898a('0x8')},'ListId':{'type':Sequelize[_0x898a('0x7')],'unique':_0x898a('0x8')},'UserId':{'type':Sequelize[_0x898a('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x898a('0x7')],'unique':_0x898a('0x8')},'CampaignId':{'type':Sequelize[_0x898a('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x898a('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x898a('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x898a('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2eb2=['contactListQueue','sequelize','exports','STRING','BOOLEAN','DATE','format','INTEGER','UNSIGNED'];(function(_0x2592da,_0x996b3d){var _0x4d6148=function(_0x2de870){while(--_0x2de870){_0x2592da['push'](_0x2592da['shift']());}};_0x4d6148(++_0x996b3d);}(_0x2eb2,0x19f));var _0x22eb=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x2eb2[_0x3ff085];return _0x2b68c3;};'use strict';var moment=require('moment');var Sequelize=require(_0x22eb('0x0'));module[_0x22eb('0x1')]={'phone':{'type':Sequelize[_0x22eb('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x22eb('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x22eb('0x4')],'defaultValue':moment()[_0x22eb('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x22eb('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x22eb('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x22eb('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x22eb('0x4')]},'priority':{'type':Sequelize[_0x22eb('0x6')](0x2)[_0x22eb('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x22eb('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x22eb('0x6')],'unique':_0x22eb('0x8')},'ListId':{'type':Sequelize[_0x22eb('0x6')],'unique':_0x22eb('0x8')},'UserId':{'type':Sequelize[_0x22eb('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x22eb('0x6')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x22eb('0x6')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x22eb('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x22eb('0x6')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 90bd126..4a16c0d 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 _0x132f=['model','query','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$eq','$not','$notBetween','$in','$notLike','$iLike','$notILike','$like','$overlap','$contains','$contained','attributes','length','sort','where','filter','VIRTUAL','options','includeAll','include','rows','catch','params','keys','intersection','fields','merge','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','createdAt','updatedAt','statedesc','deleted','membername','UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','finally','CmHopperFinal','getVoiceQueues','dialOrderByScheduledAt','sequelize','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','literal','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','update','getOpenContacts','outbound','preview','isNumber','entity\x20not\x20found','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','name','index','map','CmHopper','rawAttributes','fieldName','type'];(function(_0x16b906,_0x12b7d4){var _0x300a0b=function(_0x38f3db){while(--_0x38f3db){_0x16b906['push'](_0x16b906['shift']());}};_0x300a0b(++_0x12b7d4);}(_0x132f,0x182));var _0xf132=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x132f[_0xa1e3e3];return _0xc980e9;};'use strict';var pdf=require(_0xf132('0x0'));var emlformat=require(_0xf132('0x1'));var rimraf=require(_0xf132('0x2'));var zipdir=require(_0xf132('0x3'));var jsonpatch=require(_0xf132('0x4'));var rp=require(_0xf132('0x5'));var moment=require('moment');var BPromise=require(_0xf132('0x6'));var Mustache=require(_0xf132('0x7'));var util=require(_0xf132('0x8'));var path=require(_0xf132('0x9'));var sox=require(_0xf132('0xa'));var csv=require('to-csv');var ejs=require(_0xf132('0xb'));var fs=require('fs');var _=require(_0xf132('0xc'));var squel=require('squel');var crypto=require(_0xf132('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf132('0xe'));var toCsv=require(_0xf132('0xf'));var querystring=require(_0xf132('0x10'));var Papa=require(_0xf132('0x11'));var Redis=require(_0xf132('0x12'));var authService=require(_0xf132('0x13'));var qs=require(_0xf132('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf132('0x15'))(_0xf132('0x16'));var utils=require(_0xf132('0x17'));var config=require(_0xf132('0x18'));var licenseUtil=require(_0xf132('0x19'));var db=require(_0xf132('0x1a'))['db'];function respondWithStatusCode(_0x37d148,_0x1c79e0){_0x1c79e0=_0x1c79e0||0xcc;return function(_0x3f0f56){if(_0x3f0f56){return _0x37d148[_0xf132('0x1b')](_0x1c79e0);}return _0x37d148[_0xf132('0x1c')](_0x1c79e0)[_0xf132('0x1d')]();};}function respondWithResult(_0x5b58f8,_0x79d371){_0x79d371=_0x79d371||0xc8;return function(_0x259b76){if(_0x259b76){return _0x5b58f8['status'](_0x79d371)[_0xf132('0x1e')](_0x259b76);}};}function respondWithFilteredResult(_0x4edb9c,_0x50ed67){return function(_0x206e0c){if(_0x206e0c){var _0x24c138=_0x206e0c[_0xf132('0x1f')],_0x438d8a=_0x50ed67[_0xf132('0x20')],_0x559a72=_0x50ed67[_0xf132('0x20')]+_0x50ed67[_0xf132('0x21')],_0x48686e;if(_0x559a72>=_0x24c138){_0x559a72=_0x24c138;_0x48686e=0xc8;}else{_0x48686e=0xce;}_0x4edb9c['status'](_0x48686e);return _0x4edb9c[_0xf132('0x22')](_0xf132('0x23'),_0x438d8a+'-'+_0x559a72+'/'+_0x24c138)[_0xf132('0x1e')](_0x206e0c);}return null;};}function patchUpdates(_0x16a03a){return function(_0x4b4f5d){try{jsonpatch[_0xf132('0x24')](_0x4b4f5d,_0x16a03a,!![]);}catch(_0x5de917){return BPromise[_0xf132('0x25')](_0x5de917);}return _0x4b4f5d[_0xf132('0x26')]();};}function saveUpdates(_0x53b78a,_0x129820){return function(_0x4de164){if(_0x4de164){return _0x4de164['update'](_0x53b78a)['then'](function(_0x4df1e8){return _0x4df1e8;});}return null;};}function removeEntity(_0xbb67a7,_0x202dca){return function(_0x2fb27d){if(_0x2fb27d){return _0x2fb27d[_0xf132('0x27')]()[_0xf132('0x28')](function(){_0xbb67a7[_0xf132('0x1c')](0xcc)[_0xf132('0x1d')]();});}};}function handleEntityNotFound(_0x5c9958,_0x3db8a0){return function(_0x191742){if(!_0x191742){_0x5c9958[_0xf132('0x1b')](0x194);}return _0x191742;};}function handleError(_0x46d563,_0x3c7014){_0x3c7014=_0x3c7014||0x1f4;return function(_0x271471){logger[_0xf132('0x29')](_0x271471['stack']);if(_0x271471[_0xf132('0x2a')]){delete _0x271471[_0xf132('0x2a')];}_0x46d563['status'](_0x3c7014)['send'](_0x271471);};}exports[_0xf132('0x2b')]=function(_0x1941d5,_0x3933bc){var _0x11aba6={},_0x2c589f={},_0x25eed0={'count':0x0,'rows':[]};var _0x1a19b5=_[_0xf132('0x2c')](db[_0xf132('0x2d')][_0xf132('0x2e')],function(_0x43a510){return{'name':_0x43a510[_0xf132('0x2f')],'type':_0x43a510[_0xf132('0x30')]['key']};});_0x2c589f[_0xf132('0x31')]=_['map'](_0x1a19b5,'name');_0x2c589f[_0xf132('0x32')]=_['keys'](_0x1941d5['query']);_0x2c589f[_0xf132('0x33')]=_['intersection'](_0x2c589f[_0xf132('0x31')],_0x2c589f[_0xf132('0x32')]);_0x2c589f[_0xf132('0x33')]=_[_0xf132('0x34')](_0x2c589f[_0xf132('0x33')],[_0xf132('0x35'),_0xf132('0x36'),_0xf132('0x37'),_0xf132('0x38'),_0xf132('0x39'),_0xf132('0x3a'),'$ne',_0xf132('0x3b'),_0xf132('0x3c'),'$between',_0xf132('0x3d'),_0xf132('0x3e'),'$notIn','$like',_0xf132('0x3f'),_0xf132('0x40'),_0xf132('0x41'),_0xf132('0x42'),_0xf132('0x43'),_0xf132('0x44'),_0xf132('0x45'),'$any']);_0x11aba6['attributes']=_['intersection'](_0x2c589f['model'],qs['fields'](_0x1941d5[_0xf132('0x32')]['fields']));_0x11aba6[_0xf132('0x46')]=_0x11aba6[_0xf132('0x46')][_0xf132('0x47')]?_0x11aba6[_0xf132('0x46')]:_0x2c589f[_0xf132('0x31')];if(!_0x1941d5[_0xf132('0x32')]['hasOwnProperty']('nolimit')){_0x11aba6['limit']=qs[_0xf132('0x21')](_0x1941d5['query'][_0xf132('0x21')]);_0x11aba6['offset']=qs['offset'](_0x1941d5[_0xf132('0x32')][_0xf132('0x20')]);}_0x11aba6['order']=qs[_0xf132('0x48')](_0x1941d5[_0xf132('0x32')][_0xf132('0x48')]);_0x11aba6[_0xf132('0x49')]=qs['filters'](_['pick'](_0x1941d5['query'],_0x2c589f[_0xf132('0x33')]),_0x1a19b5);if(_0x1941d5[_0xf132('0x32')][_0xf132('0x4a')]){_0x11aba6[_0xf132('0x49')]=_['merge'](_0x11aba6['where'],{'$or':_['map'](_0x1a19b5,function(_0x317c4c){if(_0x317c4c[_0xf132('0x30')]!==_0xf132('0x4b')){var _0x552c7e={};_0x552c7e[_0x317c4c[_0xf132('0x2a')]]={'$like':'%'+_0x1941d5[_0xf132('0x32')][_0xf132('0x4a')]+'%'};return _0x552c7e;}})});}_0x11aba6=_['merge']({},_0x11aba6,_0x1941d5[_0xf132('0x4c')]);var _0x4585fa={'where':_0x11aba6[_0xf132('0x49')]};return db['CmHopper'][_0xf132('0x1f')](_0x4585fa)['then'](function(_0x2d568f){_0x25eed0[_0xf132('0x1f')]=_0x2d568f;if(_0x1941d5[_0xf132('0x32')][_0xf132('0x4d')]){_0x11aba6[_0xf132('0x4e')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x11aba6);})[_0xf132('0x28')](function(_0x4b06d4){_0x25eed0[_0xf132('0x4f')]=_0x4b06d4;return _0x25eed0;})['then'](respondWithFilteredResult(_0x3933bc,_0x11aba6))[_0xf132('0x50')](handleError(_0x3933bc,null));};exports['show']=function(_0x1d77f6,_0x569509){var _0x4cde93={'raw':!![],'where':{'id':_0x1d77f6[_0xf132('0x51')]['id']}},_0x30a601={};_0x30a601[_0xf132('0x31')]=_[_0xf132('0x52')](db['CmHopper']['rawAttributes']);_0x30a601[_0xf132('0x32')]=_[_0xf132('0x52')](_0x1d77f6[_0xf132('0x32')]);_0x30a601[_0xf132('0x33')]=_[_0xf132('0x53')](_0x30a601[_0xf132('0x31')],_0x30a601[_0xf132('0x32')]);_0x4cde93[_0xf132('0x46')]=_[_0xf132('0x53')](_0x30a601['model'],qs[_0xf132('0x54')](_0x1d77f6[_0xf132('0x32')][_0xf132('0x54')]));_0x4cde93[_0xf132('0x46')]=_0x4cde93[_0xf132('0x46')]['length']?_0x4cde93[_0xf132('0x46')]:_0x30a601[_0xf132('0x31')];if(_0x1d77f6[_0xf132('0x32')][_0xf132('0x4d')]){_0x4cde93['include']=[{'all':!![]}];}_0x4cde93=_[_0xf132('0x55')]({},_0x4cde93,_0x1d77f6[_0xf132('0x4c')]);return db[_0xf132('0x2d')][_0xf132('0x56')](_0x4cde93)['then'](handleEntityNotFound(_0x569509,null))[_0xf132('0x28')](respondWithResult(_0x569509,null))[_0xf132('0x50')](handleError(_0x569509,null));};exports['create']=function(_0x143c44,_0x162086){return db[_0xf132('0x2d')][_0xf132('0x57')](_0x143c44[_0xf132('0x58')],{})[_0xf132('0x28')](respondWithResult(_0x162086,0xc9))['catch'](handleError(_0x162086,null));};exports['update']=function(_0x134a71,_0x5245f1){if(_0x134a71[_0xf132('0x58')]['id']){delete _0x134a71['body']['id'];}return db[_0xf132('0x2d')][_0xf132('0x56')]({'where':{'id':_0x134a71[_0xf132('0x51')]['id']}})[_0xf132('0x28')](handleEntityNotFound(_0x5245f1,null))[_0xf132('0x28')](saveUpdates(_0x134a71[_0xf132('0x58')],null))[_0xf132('0x28')](respondWithResult(_0x5245f1,null))[_0xf132('0x50')](handleError(_0x5245f1,null));};exports[_0xf132('0x59')]=function(_0x21e9e1,_0x303d95){return db['CmHopper']['describe']()[_0xf132('0x28')](respondWithResult(_0x303d95,null))[_0xf132('0x50')](handleError(_0x303d95,null));};exports[_0xf132('0x27')]=function(_0x4b5aa7,_0x54f015){var _0x5c7ca9;return db[_0xf132('0x2d')][_0xf132('0x56')]({'where':{'id':_0x4b5aa7[_0xf132('0x51')]['id']}})['then'](handleEntityNotFound(_0x54f015,null))[_0xf132('0x28')](function(_0x3e4d27){if(_0x3e4d27){return _0x3e4d27['destroy']()[_0xf132('0x28')](function(_0x576edb){return _0x576edb;});}})[_0xf132('0x28')](function(_0x3c09a4){_0x5c7ca9=_0x3c09a4;if(_0x3c09a4){if(_0x3c09a4[_0xf132('0x5a')]||_0x3c09a4[_0xf132('0x5b')]){return db[_0x3c09a4['VoiceQueueId']?_0xf132('0x5c'):'Campaign']['find']({'where':{'id':_0x3c09a4[_0xf132('0x5a')]?_0x3c09a4['VoiceQueueId']:_0x3c09a4[_0xf132('0x5b')]},'attributes':['id',_0xf132('0x2a')],'raw':!![]});}}})['then'](function(_0x46d2b2){var _0x2f6001={};if(_0x46d2b2){_[_0xf132('0x55')](_0x2f6001,_[_0xf132('0x5d')](_0x5c7ca9[_0xf132('0x5e')],[_0xf132('0x5f'),_0xf132('0x60'),'id']));_0x2f6001['state']=0x15;_0x2f6001[_0xf132('0x61')]=_0xf132('0x62');_0x2f6001['campaign']=_0x46d2b2[_0xf132('0x2a')];_0x2f6001[_0xf132('0x63')]=_0x4b5aa7['user'][_0xf132('0x2a')];_0x2f6001[_0xf132('0x64')]=_0x4b5aa7[_0xf132('0x65')]['id'];_0x2f6001[_0xf132('0x62')]=!![];_0x2f6001[_0xf132('0x66')]=moment()[_0xf132('0x67')](_0xf132('0x68'));_0x2f6001[_0xf132('0x69')]=_0x5c7ca9[_0xf132('0x6a')];_0x2f6001[_0xf132('0x6b')]=_0x5c7ca9[_0xf132('0x5a')]?'queue':_0xf132('0x6c');return db[_0xf132('0x6d')][_0xf132('0x56')]({'where':{'id':_0x2f6001[_0xf132('0x6e')]},'attributes':[_0xf132('0x6f'),_0xf132('0x70')]})[_0xf132('0x28')](function(_0x4b6299){if(!_[_0xf132('0x71')](_0x54f015)&&!_[_0xf132('0x71')](_0x4b6299[_0xf132('0x6f')])){_0x2f6001['calleridname']=_0x4b6299['firstName'];if(!_[_0xf132('0x71')](_0x4b6299['lastName'])){_0x2f6001['calleridname']+='\x20'+_0x4b6299[_0xf132('0x70')];}}})[_0xf132('0x72')](function(){return db[_0xf132('0x73')]['create'](_0x2f6001);});}})[_0xf132('0x28')](function(){return _0x54f015[_0xf132('0x1c')](0xcc)[_0xf132('0x1d')]();})[_0xf132('0x50')](handleError(_0x54f015,null));};exports['getPreview']=function(_0x3b8c7e,_0x1c388b,_0x7f633c){var _0x573a71=[];return db[_0xf132('0x6d')][_0xf132('0x59')]()[_0xf132('0x28')](function(_0x5afab9){_0x573a71=_[_0xf132('0x52')](_0x5afab9);return _0x3b8c7e['user'][_0xf132('0x74')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xf132('0x75')],'raw':!![]});})[_0xf132('0x28')](function(_0x28261f){if(_0x28261f&&_0x28261f['length']){return db[_0xf132('0x76')]['transaction'](function(_0x23c3f0){var _0x2e45e9={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf132('0x67')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xf132('0x2c')](_0x28261f,'id')},'$or':[{'UserId':null},{'UserId':_0x3b8c7e[_0xf132('0x65')]['id']}]};var _0x22f012=[];if(_0x3b8c7e[_0xf132('0x58')][_0xf132('0x77')]&&_0x3b8c7e['body'][_0xf132('0x77')]===_0xf132('0x78')){if(!_[_0xf132('0x79')](_0x3b8c7e[_0xf132('0x58')]['hopperIds'])){_0x2e45e9['id']={'$in':_0x3b8c7e[_0xf132('0x58')][_0xf132('0x7a')]};}_0x22f012=[[_0xf132('0x7b'),_0xf132('0x7c')],[_0xf132('0x7d'),_0x28261f[0x0]['dialOrderByScheduledAt']===_0xf132('0x7c')?'DESC':'ASC'],db[_0xf132('0x76')][_0xf132('0x7e')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_['isEmpty'](_0x3b8c7e[_0xf132('0x58')]['hopperIds'])){_0x2e45e9['id']={'$notIn':_0x3b8c7e[_0xf132('0x58')][_0xf132('0x7a')]};}_0x22f012=[[_0xf132('0x7b'),_0xf132('0x7f')],[_0xf132('0x7d'),_0x28261f[0x0]['dialOrderByScheduledAt']],db[_0xf132('0x76')][_0xf132('0x7e')](_0xf132('0x80')),['id',_0xf132('0x7c')]];}return db['CmHopper'][_0xf132('0x81')]({'attributes':['id','scheduledat'],'where':_0x2e45e9,'order':_0x22f012,'transaction':_0x23c3f0,'lock':_0x23c3f0[_0xf132('0x82')][_0xf132('0x83')],'include':[{'model':db['CmContact'],'as':_0xf132('0x84'),'attributes':_0x573a71,'include':[{'model':db[_0xf132('0x85')],'as':_0xf132('0x86'),'attributes':['id','name']}]},{'model':db[_0xf132('0x87')],'as':_0xf132('0x88'),'attributes':['id',_0xf132('0x2a')]},{'model':db[_0xf132('0x5c')],'as':_0xf132('0x89'),'attributes':['id',_0xf132('0x2a'),_0xf132('0x8a')]}]})[_0xf132('0x28')](function(_0x2bff8b){if(_0x2bff8b){return _0x2bff8b[_0xf132('0x8b')]({'UserId':_0x3b8c7e[_0xf132('0x65')]['id']},{'transaction':_0x23c3f0});}});});}})['then'](handleEntityNotFound(_0x1c388b,null))[_0xf132('0x28')](respondWithResult(_0x1c388b,null))['catch'](handleError(_0x1c388b,null));};exports[_0xf132('0x8c')]=function(_0x21308e,_0x1ebd3c,_0x4ddf29){return _0x21308e['user']['getVoiceQueues']({'where':{'type':_0xf132('0x8d'),'dialActive':!![],'dialMethod':_0xf132('0x8e')},'attributes':['id'],'raw':!![]})['then'](function(_0x4c1c58){if(_0x4c1c58&&_0x4c1c58['length']){return db[_0xf132('0x2d')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf132('0x67')](_0xf132('0x68'))},'VoiceQueueId':{'$in':_[_0xf132('0x2c')](_0x4c1c58,'id')},'$or':[{'UserId':null},{'UserId':_0x21308e['user']['id']}]}});}return 0x0;})[_0xf132('0x28')](function(_0x1e2505){if(!_['isNil'](_0x1e2505)&&_[_0xf132('0x8f')](_0x1e2505)){return _0x1ebd3c[_0xf132('0x1c')](0xc8)[_0xf132('0x1e')]({'contacts':_0x1e2505});}else{logger[_0xf132('0x29')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xf132('0x8c'),0x194,_0xf132('0x90'));_0x1ebd3c[_0xf132('0x1b')](0x194);}})[_0xf132('0x50')](handleError(_0x1ebd3c,null));}; \ No newline at end of file +var _0x78e2=['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','../../mysqldb','status','count','offset','limit','Content-Range','json','apply','reject','save','then','destroy','end','stack','name','send','map','CmHopper','rawAttributes','fieldName','type','model','query','filters','$and','$or','$gt','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$iLike','$notILike','$like','$overlap','$contained','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','describe','CampaignId','VoiceQueueId','omit','dataValues','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','sequelize','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','CmCompany','Company','CmList','List','VoiceQueue','dialActive','update','error','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','sendStatus','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv'];(function(_0x23d73d,_0x1950e5){var _0x6d3ae8=function(_0x291d1e){while(--_0x291d1e){_0x23d73d['push'](_0x23d73d['shift']());}};_0x6d3ae8(++_0x1950e5);}(_0x78e2,0x1a8));var _0x278e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78e2[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x278e('0x0'));var emlformat=require(_0x278e('0x1'));var rimraf=require(_0x278e('0x2'));var zipdir=require(_0x278e('0x3'));var jsonpatch=require(_0x278e('0x4'));var rp=require('request-promise');var moment=require(_0x278e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x278e('0x6'));var util=require(_0x278e('0x7'));var path=require(_0x278e('0x8'));var sox=require(_0x278e('0x9'));var csv=require(_0x278e('0xa'));var ejs=require(_0x278e('0xb'));var fs=require('fs');var _=require(_0x278e('0xc'));var squel=require(_0x278e('0xd'));var crypto=require(_0x278e('0xe'));var jsforce=require(_0x278e('0xf'));var deskjs=require(_0x278e('0x10'));var toCsv=require(_0x278e('0xa'));var querystring=require(_0x278e('0x11'));var Papa=require(_0x278e('0x12'));var Redis=require(_0x278e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x278e('0x14'));var as=require(_0x278e('0x15'));var hardwareService=require(_0x278e('0x16'));var logger=require(_0x278e('0x17'))(_0x278e('0x18'));var utils=require(_0x278e('0x19'));var config=require(_0x278e('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x278e('0x1b'))['db'];function respondWithStatusCode(_0x3f2a66,_0x4fe711){_0x4fe711=_0x4fe711||0xcc;return function(_0x2bfe2b){if(_0x2bfe2b){return _0x3f2a66['sendStatus'](_0x4fe711);}return _0x3f2a66[_0x278e('0x1c')](_0x4fe711)['end']();};}function respondWithResult(_0x580b58,_0x4503ba){_0x4503ba=_0x4503ba||0xc8;return function(_0x108ce5){if(_0x108ce5){return _0x580b58['status'](_0x4503ba)['json'](_0x108ce5);}};}function respondWithFilteredResult(_0x43f659,_0x15be55){return function(_0x58f1ec){if(_0x58f1ec){var _0x1b6300=_0x58f1ec[_0x278e('0x1d')],_0x2811e9=_0x15be55[_0x278e('0x1e')],_0x58cbd8=_0x15be55['offset']+_0x15be55[_0x278e('0x1f')],_0x10af6d;if(_0x58cbd8>=_0x1b6300){_0x58cbd8=_0x1b6300;_0x10af6d=0xc8;}else{_0x10af6d=0xce;}_0x43f659[_0x278e('0x1c')](_0x10af6d);return _0x43f659['set'](_0x278e('0x20'),_0x2811e9+'-'+_0x58cbd8+'/'+_0x1b6300)[_0x278e('0x21')](_0x58f1ec);}return null;};}function patchUpdates(_0x173217){return function(_0x4b66a9){try{jsonpatch[_0x278e('0x22')](_0x4b66a9,_0x173217,!![]);}catch(_0x56feb1){return BPromise[_0x278e('0x23')](_0x56feb1);}return _0x4b66a9[_0x278e('0x24')]();};}function saveUpdates(_0x576470,_0x380a10){return function(_0x2a9be4){if(_0x2a9be4){return _0x2a9be4['update'](_0x576470)[_0x278e('0x25')](function(_0x44598a){return _0x44598a;});}return null;};}function removeEntity(_0x2f4e73,_0x9562e3){return function(_0x461d37){if(_0x461d37){return _0x461d37[_0x278e('0x26')]()[_0x278e('0x25')](function(){_0x2f4e73[_0x278e('0x1c')](0xcc)[_0x278e('0x27')]();});}};}function handleEntityNotFound(_0x269148,_0x3c5de5){return function(_0x1d1722){if(!_0x1d1722){_0x269148['sendStatus'](0x194);}return _0x1d1722;};}function handleError(_0x57054f,_0x4fc261){_0x4fc261=_0x4fc261||0x1f4;return function(_0x42bccd){logger['error'](_0x42bccd[_0x278e('0x28')]);if(_0x42bccd[_0x278e('0x29')]){delete _0x42bccd[_0x278e('0x29')];}_0x57054f[_0x278e('0x1c')](_0x4fc261)[_0x278e('0x2a')](_0x42bccd);};}exports['index']=function(_0x2b2f0b,_0x15b8e6){var _0x14fbc0={},_0x20ca6a={},_0x50cc81={'count':0x0,'rows':[]};var _0x370151=_[_0x278e('0x2b')](db[_0x278e('0x2c')][_0x278e('0x2d')],function(_0x438aba){return{'name':_0x438aba[_0x278e('0x2e')],'type':_0x438aba[_0x278e('0x2f')]['key']};});_0x20ca6a[_0x278e('0x30')]=_[_0x278e('0x2b')](_0x370151,_0x278e('0x29'));_0x20ca6a[_0x278e('0x31')]=_['keys'](_0x2b2f0b['query']);_0x20ca6a['filters']=_['intersection'](_0x20ca6a[_0x278e('0x30')],_0x20ca6a['query']);_0x20ca6a[_0x278e('0x32')]=_['concat'](_0x20ca6a[_0x278e('0x32')],[_0x278e('0x33'),_0x278e('0x34'),_0x278e('0x35'),'$gte',_0x278e('0x36'),_0x278e('0x37'),_0x278e('0x38'),_0x278e('0x39'),'$not',_0x278e('0x3a'),_0x278e('0x3b'),_0x278e('0x3c'),'$notIn','$like','$notLike',_0x278e('0x3d'),_0x278e('0x3e'),_0x278e('0x3f'),_0x278e('0x40'),'$contains',_0x278e('0x41'),'$any']);_0x14fbc0[_0x278e('0x42')]=_[_0x278e('0x43')](_0x20ca6a[_0x278e('0x30')],qs[_0x278e('0x44')](_0x2b2f0b[_0x278e('0x31')]['fields']));_0x14fbc0[_0x278e('0x42')]=_0x14fbc0[_0x278e('0x42')][_0x278e('0x45')]?_0x14fbc0[_0x278e('0x42')]:_0x20ca6a[_0x278e('0x30')];if(!_0x2b2f0b['query'][_0x278e('0x46')](_0x278e('0x47'))){_0x14fbc0[_0x278e('0x1f')]=qs[_0x278e('0x1f')](_0x2b2f0b[_0x278e('0x31')]['limit']);_0x14fbc0[_0x278e('0x1e')]=qs[_0x278e('0x1e')](_0x2b2f0b[_0x278e('0x31')]['offset']);}_0x14fbc0[_0x278e('0x48')]=qs['sort'](_0x2b2f0b['query'][_0x278e('0x49')]);_0x14fbc0['where']=qs[_0x278e('0x32')](_[_0x278e('0x4a')](_0x2b2f0b[_0x278e('0x31')],_0x20ca6a['filters']),_0x370151);if(_0x2b2f0b[_0x278e('0x31')][_0x278e('0x4b')]){_0x14fbc0[_0x278e('0x4c')]=_[_0x278e('0x4d')](_0x14fbc0[_0x278e('0x4c')],{'$or':_['map'](_0x370151,function(_0x5deea0){if(_0x5deea0[_0x278e('0x2f')]!=='VIRTUAL'){var _0x34b3ba={};_0x34b3ba[_0x5deea0['name']]={'$like':'%'+_0x2b2f0b[_0x278e('0x31')][_0x278e('0x4b')]+'%'};return _0x34b3ba;}})});}_0x14fbc0=_['merge']({},_0x14fbc0,_0x2b2f0b[_0x278e('0x4e')]);var _0x961b6d={'where':_0x14fbc0[_0x278e('0x4c')]};return db[_0x278e('0x2c')][_0x278e('0x1d')](_0x961b6d)[_0x278e('0x25')](function(_0x46cc84){_0x50cc81[_0x278e('0x1d')]=_0x46cc84;if(_0x2b2f0b[_0x278e('0x31')][_0x278e('0x4f')]){_0x14fbc0[_0x278e('0x50')]=[{'all':!![]}];}return db[_0x278e('0x2c')][_0x278e('0x51')](_0x14fbc0);})[_0x278e('0x25')](function(_0x52e373){_0x50cc81[_0x278e('0x52')]=_0x52e373;return _0x50cc81;})[_0x278e('0x25')](respondWithFilteredResult(_0x15b8e6,_0x14fbc0))[_0x278e('0x53')](handleError(_0x15b8e6,null));};exports['show']=function(_0x4d55f0,_0x4f305b){var _0x53a73e={'raw':!![],'where':{'id':_0x4d55f0[_0x278e('0x54')]['id']}},_0x34b92b={};_0x34b92b[_0x278e('0x30')]=_[_0x278e('0x55')](db[_0x278e('0x2c')][_0x278e('0x2d')]);_0x34b92b[_0x278e('0x31')]=_[_0x278e('0x55')](_0x4d55f0[_0x278e('0x31')]);_0x34b92b[_0x278e('0x32')]=_[_0x278e('0x43')](_0x34b92b[_0x278e('0x30')],_0x34b92b[_0x278e('0x31')]);_0x53a73e[_0x278e('0x42')]=_[_0x278e('0x43')](_0x34b92b['model'],qs[_0x278e('0x44')](_0x4d55f0[_0x278e('0x31')][_0x278e('0x44')]));_0x53a73e[_0x278e('0x42')]=_0x53a73e[_0x278e('0x42')][_0x278e('0x45')]?_0x53a73e[_0x278e('0x42')]:_0x34b92b[_0x278e('0x30')];if(_0x4d55f0[_0x278e('0x31')][_0x278e('0x4f')]){_0x53a73e[_0x278e('0x50')]=[{'all':!![]}];}_0x53a73e=_[_0x278e('0x4d')]({},_0x53a73e,_0x4d55f0[_0x278e('0x4e')]);return db[_0x278e('0x2c')][_0x278e('0x56')](_0x53a73e)['then'](handleEntityNotFound(_0x4f305b,null))[_0x278e('0x25')](respondWithResult(_0x4f305b,null))[_0x278e('0x53')](handleError(_0x4f305b,null));};exports[_0x278e('0x57')]=function(_0x5e2e3a,_0x85ab93){return db[_0x278e('0x2c')][_0x278e('0x57')](_0x5e2e3a['body'],{})[_0x278e('0x25')](respondWithResult(_0x85ab93,0xc9))[_0x278e('0x53')](handleError(_0x85ab93,null));};exports['update']=function(_0x2eed3c,_0x575522){if(_0x2eed3c[_0x278e('0x58')]['id']){delete _0x2eed3c[_0x278e('0x58')]['id'];}return db['CmHopper'][_0x278e('0x56')]({'where':{'id':_0x2eed3c['params']['id']}})[_0x278e('0x25')](handleEntityNotFound(_0x575522,null))['then'](saveUpdates(_0x2eed3c[_0x278e('0x58')],null))[_0x278e('0x25')](respondWithResult(_0x575522,null))['catch'](handleError(_0x575522,null));};exports['describe']=function(_0xadbffa,_0x337804){return db[_0x278e('0x2c')][_0x278e('0x59')]()[_0x278e('0x25')](respondWithResult(_0x337804,null))[_0x278e('0x53')](handleError(_0x337804,null));};exports[_0x278e('0x26')]=function(_0x1c65d5,_0x4ffb78){var _0x1d820d;return db[_0x278e('0x2c')]['find']({'where':{'id':_0x1c65d5[_0x278e('0x54')]['id']}})[_0x278e('0x25')](handleEntityNotFound(_0x4ffb78,null))[_0x278e('0x25')](function(_0x48ba2d){if(_0x48ba2d){return _0x48ba2d['destroy']()[_0x278e('0x25')](function(_0x3d59d5){return _0x3d59d5;});}})[_0x278e('0x25')](function(_0x258ae7){_0x1d820d=_0x258ae7;if(_0x258ae7){if(_0x258ae7['VoiceQueueId']||_0x258ae7[_0x278e('0x5a')]){return db[_0x258ae7[_0x278e('0x5b')]?'VoiceQueue':'Campaign'][_0x278e('0x56')]({'where':{'id':_0x258ae7[_0x278e('0x5b')]?_0x258ae7[_0x278e('0x5b')]:_0x258ae7[_0x278e('0x5a')]},'attributes':['id',_0x278e('0x29')],'raw':!![]});}}})[_0x278e('0x25')](function(_0x467bf2){var _0x292ecc={};if(_0x467bf2){_[_0x278e('0x4d')](_0x292ecc,_[_0x278e('0x5c')](_0x1d820d[_0x278e('0x5d')],['createdAt','updatedAt','id']));_0x292ecc['state']=0x15;_0x292ecc[_0x278e('0x5e')]=_0x278e('0x5f');_0x292ecc[_0x278e('0x60')]=_0x467bf2[_0x278e('0x29')];_0x292ecc[_0x278e('0x61')]=_0x1c65d5[_0x278e('0x62')][_0x278e('0x29')];_0x292ecc[_0x278e('0x63')]=_0x1c65d5[_0x278e('0x62')]['id'];_0x292ecc[_0x278e('0x5f')]=!![];_0x292ecc[_0x278e('0x64')]=moment()[_0x278e('0x65')](_0x278e('0x66'));_0x292ecc[_0x278e('0x67')]=_0x1d820d[_0x278e('0x68')];_0x292ecc[_0x278e('0x69')]=_0x1d820d[_0x278e('0x5b')]?_0x278e('0x6a'):_0x278e('0x6b');return db[_0x278e('0x6c')][_0x278e('0x56')]({'where':{'id':_0x292ecc[_0x278e('0x6d')]},'attributes':[_0x278e('0x6e'),'lastName']})[_0x278e('0x25')](function(_0x46574a){if(!_['isNil'](_0x4ffb78)&&!_[_0x278e('0x6f')](_0x46574a['firstName'])){_0x292ecc['calleridname']=_0x46574a['firstName'];if(!_[_0x278e('0x6f')](_0x46574a['lastName'])){_0x292ecc[_0x278e('0x70')]+='\x20'+_0x46574a[_0x278e('0x71')];}}})[_0x278e('0x72')](function(){return db['CmHopperFinal'][_0x278e('0x57')](_0x292ecc);});}})[_0x278e('0x25')](function(){return _0x4ffb78[_0x278e('0x1c')](0xcc)[_0x278e('0x27')]();})[_0x278e('0x53')](handleError(_0x4ffb78,null));};exports[_0x278e('0x73')]=function(_0x42acfc,_0x3f002e,_0x12ba97){var _0x4a0bad=[];return db[_0x278e('0x6c')][_0x278e('0x59')]()[_0x278e('0x25')](function(_0x44213f){_0x4a0bad=_['keys'](_0x44213f);return _0x42acfc[_0x278e('0x62')][_0x278e('0x74')]({'where':{'type':_0x278e('0x75'),'dialActive':!![],'dialMethod':_0x278e('0x76')},'attributes':['id',_0x278e('0x77')],'raw':!![]});})[_0x278e('0x25')](function(_0x2a13f8){if(_0x2a13f8&&_0x2a13f8[_0x278e('0x45')]){return db['sequelize'][_0x278e('0x78')](function(_0x473edf){var _0x5d82c8={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x278e('0x65')](_0x278e('0x66'))},'VoiceQueueId':{'$in':_[_0x278e('0x2b')](_0x2a13f8,'id')},'$or':[{'UserId':null},{'UserId':_0x42acfc['user']['id']}]};var _0xebbd0c=[];if(_0x42acfc[_0x278e('0x58')][_0x278e('0x79')]&&_0x42acfc['body'][_0x278e('0x79')]===_0x278e('0x7a')){if(!_[_0x278e('0x7b')](_0x42acfc[_0x278e('0x58')]['hopperIds'])){_0x5d82c8['id']={'$in':_0x42acfc[_0x278e('0x58')][_0x278e('0x7c')]};}_0xebbd0c=[[_0x278e('0x7d'),_0x278e('0x7e')],[_0x278e('0x7f'),_0x2a13f8[0x0][_0x278e('0x77')]===_0x278e('0x7e')?_0x278e('0x80'):_0x278e('0x7e')],db[_0x278e('0x81')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x278e('0x80')]];}else{if(!_[_0x278e('0x7b')](_0x42acfc[_0x278e('0x58')][_0x278e('0x7c')])){_0x5d82c8['id']={'$notIn':_0x42acfc['body']['hopperIds']};}_0xebbd0c=[[_0x278e('0x7d'),_0x278e('0x80')],[_0x278e('0x7f'),_0x2a13f8[0x0][_0x278e('0x77')]],db[_0x278e('0x81')]['literal'](_0x278e('0x82')),['id',_0x278e('0x7e')]];}return db['CmHopper'][_0x278e('0x83')]({'attributes':['id',_0x278e('0x84')],'where':_0x5d82c8,'order':_0xebbd0c,'transaction':_0x473edf,'lock':_0x473edf['LOCK']['UPDATE'],'include':[{'model':db[_0x278e('0x6c')],'as':'Contact','attributes':_0x4a0bad,'include':[{'model':db[_0x278e('0x85')],'as':_0x278e('0x86'),'attributes':['id',_0x278e('0x29')]}]},{'model':db[_0x278e('0x87')],'as':_0x278e('0x88'),'attributes':['id',_0x278e('0x29')]},{'model':db[_0x278e('0x89')],'as':'Queue','attributes':['id',_0x278e('0x29'),_0x278e('0x8a')]}]})[_0x278e('0x25')](function(_0x4c4c4e){if(_0x4c4c4e){return _0x4c4c4e[_0x278e('0x8b')]({'UserId':_0x42acfc[_0x278e('0x62')]['id']},{'transaction':_0x473edf});}});});}})[_0x278e('0x25')](handleEntityNotFound(_0x3f002e,null))[_0x278e('0x25')](respondWithResult(_0x3f002e,null))[_0x278e('0x53')](handleError(_0x3f002e,null));};exports['getOpenContacts']=function(_0x8aee55,_0x2a189d,_0x309cfe){return _0x8aee55[_0x278e('0x62')][_0x278e('0x74')]({'where':{'type':_0x278e('0x75'),'dialActive':!![],'dialMethod':_0x278e('0x76')},'attributes':['id'],'raw':!![]})[_0x278e('0x25')](function(_0x9de4ab){if(_0x9de4ab&&_0x9de4ab[_0x278e('0x45')]){return db[_0x278e('0x2c')][_0x278e('0x1d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x9de4ab,'id')},'$or':[{'UserId':null},{'UserId':_0x8aee55[_0x278e('0x62')]['id']}]}});}return 0x0;})[_0x278e('0x25')](function(_0x3f4c82){if(!_[_0x278e('0x6f')](_0x3f4c82)&&_['isNumber'](_0x3f4c82)){return _0x2a189d[_0x278e('0x1c')](0xc8)['json']({'contacts':_0x3f4c82});}else{logger[_0x278e('0x8c')](_0x278e('0x8d'),_0x278e('0x8e'),0x194,_0x278e('0x8f'));_0x2a189d[_0x278e('0x90')](0x194);}})[_0x278e('0x53')](handleError(_0x2a189d,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index ccc01fc..27a13c7 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 _0xeadf=['scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cmHopper.attributes','exports'];(function(_0x2d70a4,_0x573370){var _0xd7877=function(_0x360e6e){while(--_0x360e6e){_0x2d70a4['push'](_0x2d70a4['shift']());}};_0xd7877(++_0x573370);}(_0xeadf,0x1bd));var _0xfead=function(_0x8ce506,_0x517f30){_0x8ce506=_0x8ce506-0x0;var _0x23c8e5=_0xeadf[_0x8ce506];return _0x23c8e5;};'use strict';var _=require(_0xfead('0x0'));var util=require(_0xfead('0x1'));var logger=require(_0xfead('0x2'))(_0xfead('0x3'));var moment=require('moment');var BPromise=require(_0xfead('0x4'));var rp=require(_0xfead('0x5'));var fs=require('fs');var path=require(_0xfead('0x6'));var rimraf=require(_0xfead('0x7'));var config=require('../../config/environment');var attributes=require(_0xfead('0x8'));module[_0xfead('0x9')]=function(_0x4450a1,_0x35203c){return _0x4450a1['define']('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0xfead('0xa')]},{'name':_0xfead('0xb'),'fields':[_0xfead('0xb')]},{'name':_0xfead('0xc'),'fields':[_0xfead('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x62a4=['../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x53afa6,_0x59e786){var _0x51f86a=function(_0x368385){while(--_0x368385){_0x53afa6['push'](_0x53afa6['shift']());}};_0x51f86a(++_0x59e786);}(_0x62a4,0xc3));var _0x462a=function(_0x5562c2,_0x1ac118){_0x5562c2=_0x5562c2-0x0;var _0x43427f=_0x62a4[_0x5562c2];return _0x43427f;};'use strict';var _=require(_0x462a('0x0'));var util=require(_0x462a('0x1'));var logger=require(_0x462a('0x2'))(_0x462a('0x3'));var moment=require(_0x462a('0x4'));var BPromise=require(_0x462a('0x5'));var rp=require(_0x462a('0x6'));var fs=require('fs');var path=require(_0x462a('0x7'));var rimraf=require(_0x462a('0x8'));var config=require(_0x462a('0x9'));var attributes=require(_0x462a('0xa'));module[_0x462a('0xb')]=function(_0x57d462,_0x24fdb2){return _0x57d462[_0x462a('0xc')](_0x462a('0xd'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x462a('0xe'),'fields':[_0x462a('0xe')]},{'name':'phone','fields':[_0x462a('0xf')]},{'name':_0x462a('0x10'),'fields':[_0x462a('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index c8557d3..fe4bece 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 _0x98e7=['where','attributes','limit','include','map','model','debug','ShowCmHopper','find','CreateCmHopper','body','UpdateCmHopper','update','DestroyCmHopper','destroy','CmContact','describe','sequelize','transaction','findAll','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','UserId','push','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','create','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','GetContactRecallMe','all','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopper','CmHopper','options','raw'];(function(_0x183a2e,_0x187c76){var _0x2dedff=function(_0x22703e){while(--_0x22703e){_0x183a2e['push'](_0x183a2e['shift']());}};_0x2dedff(++_0x187c76);}(_0x98e7,0x1c5));var _0x798e=function(_0x2a9421,_0x12acc6){_0x2a9421=_0x2a9421-0x0;var _0x520dd6=_0x98e7[_0x2a9421];return _0x520dd6;};'use strict';var _=require(_0x798e('0x0'));var util=require(_0x798e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x798e('0x2'));var db=require(_0x798e('0x3'))['db'];var utils=require(_0x798e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x798e('0x5'));var jayson=require(_0x798e('0x6'));var client=jayson[_0x798e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4355cd,_0x335f28,_0x88cb4f){return new BPromise(function(_0x3411f3,_0x29e35a){return client['request'](_0x4355cd,_0x88cb4f)[_0x798e('0x8')](function(_0x23d0bb){logger[_0x798e('0x9')](_0x798e('0xa'),_0x335f28,_0x798e('0xb'));logger['debug'](_0x798e('0xc'),_0x335f28,'request\x20sent',JSON[_0x798e('0xd')](_0x23d0bb));if(_0x23d0bb[_0x798e('0xe')]){if(_0x23d0bb[_0x798e('0xe')][_0x798e('0xf')]===0x1f4){logger[_0x798e('0xe')](_0x798e('0xa'),_0x335f28,_0x23d0bb[_0x798e('0xe')][_0x798e('0x10')]);return _0x29e35a(_0x23d0bb['error']['message']);}logger[_0x798e('0xe')]('CmHopper,\x20%s,\x20%s',_0x335f28,_0x23d0bb[_0x798e('0xe')][_0x798e('0x10')]);return _0x3411f3(_0x23d0bb['error'][_0x798e('0x10')]);}else{logger[_0x798e('0x9')](_0x798e('0xa'),_0x335f28,_0x798e('0xb'));_0x3411f3(_0x23d0bb[_0x798e('0x11')][_0x798e('0x10')]);}})[_0x798e('0x12')](function(_0x3cf24a){logger[_0x798e('0xe')](_0x798e('0xa'),_0x335f28,_0x3cf24a);_0x29e35a(_0x3cf24a);});});}exports[_0x798e('0x13')]=function(_0x3c2082){var _0x3b3f8c=this;return new Promise(function(_0x379ce3,_0x55977f){return db[_0x798e('0x14')]['findAll']({'raw':_0x3c2082[_0x798e('0x15')]?_0x3c2082[_0x798e('0x15')][_0x798e('0x16')]===undefined?!![]:![]:!![],'where':_0x3c2082[_0x798e('0x15')]?_0x3c2082['options'][_0x798e('0x17')]||null:null,'attributes':_0x3c2082['options']?_0x3c2082['options'][_0x798e('0x18')]||null:null,'limit':_0x3c2082[_0x798e('0x15')]?_0x3c2082[_0x798e('0x15')][_0x798e('0x19')]||null:null,'include':_0x3c2082['options']?_0x3c2082[_0x798e('0x15')][_0x798e('0x1a')]?_[_0x798e('0x1b')](_0x3c2082['options'][_0x798e('0x1a')],function(_0xfbeb72){return{'model':db[_0xfbeb72[_0x798e('0x1c')]],'as':_0xfbeb72['as'],'attributes':_0xfbeb72[_0x798e('0x18')],'include':_0xfbeb72[_0x798e('0x1a')]?_['map'](_0xfbeb72[_0x798e('0x1a')],function(_0x351ff3){return{'model':db[_0x351ff3['model']],'as':_0x351ff3['as'],'attributes':_0x351ff3['attributes'],'include':_0x351ff3[_0x798e('0x1a')]?_[_0x798e('0x1b')](_0x351ff3['include'],function(_0x192cbd){return{'model':db[_0x192cbd['model']],'as':_0x192cbd['as'],'attributes':_0x192cbd[_0x798e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x798e('0x8')](function(_0x27f441){logger[_0x798e('0x9')](_0x798e('0x13'),_0x3c2082);logger[_0x798e('0x1d')]('GetCmHopper',_0x3c2082,JSON[_0x798e('0xd')](_0x27f441));_0x379ce3(_0x27f441);})['catch'](function(_0x1d5ffb){logger['error']('GetCmHopper',_0x1d5ffb['message'],_0x3c2082);_0x55977f(_0x3b3f8c[_0x798e('0xe')](0x1f4,_0x1d5ffb[_0x798e('0x10')]));});});};exports[_0x798e('0x1e')]=function(_0x60003f){var _0x1492eb=this;return new Promise(function(_0x50006b,_0x2b31d3){return db[_0x798e('0x14')][_0x798e('0x1f')]({'raw':_0x60003f['options']?_0x60003f[_0x798e('0x15')][_0x798e('0x16')]===undefined?!![]:![]:!![],'where':_0x60003f[_0x798e('0x15')]?_0x60003f[_0x798e('0x15')][_0x798e('0x17')]||null:null,'attributes':_0x60003f[_0x798e('0x15')]?_0x60003f[_0x798e('0x15')][_0x798e('0x18')]||null:null,'include':_0x60003f[_0x798e('0x15')]?_0x60003f[_0x798e('0x15')][_0x798e('0x1a')]?_[_0x798e('0x1b')](_0x60003f[_0x798e('0x15')][_0x798e('0x1a')],function(_0x477371){return{'model':db[_0x477371[_0x798e('0x1c')]],'as':_0x477371['as'],'attributes':_0x477371[_0x798e('0x18')],'include':_0x477371['include']?_[_0x798e('0x1b')](_0x477371[_0x798e('0x1a')],function(_0x4ce984){return{'model':db[_0x4ce984[_0x798e('0x1c')]],'as':_0x4ce984['as'],'attributes':_0x4ce984[_0x798e('0x18')],'include':_0x4ce984[_0x798e('0x1a')]?_['map'](_0x4ce984['include'],function(_0xbf247b){return{'model':db[_0xbf247b[_0x798e('0x1c')]],'as':_0xbf247b['as'],'attributes':_0xbf247b[_0x798e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x798e('0x8')](function(_0x2607d9){logger[_0x798e('0x9')](_0x798e('0x1e'),_0x60003f);logger[_0x798e('0x1d')]('ShowCmHopper',_0x60003f,JSON[_0x798e('0xd')](_0x2607d9));_0x50006b(_0x2607d9);})[_0x798e('0x12')](function(_0x55ef97){logger[_0x798e('0xe')](_0x798e('0x1e'),_0x55ef97[_0x798e('0x10')],_0x60003f);_0x2b31d3(_0x1492eb[_0x798e('0xe')](0x1f4,_0x55ef97[_0x798e('0x10')]));});});};exports[_0x798e('0x20')]=function(_0x40a0b5){var _0x8053=this;return new Promise(function(_0xaf8ed7,_0x391e93){return db[_0x798e('0x14')]['create'](_0x40a0b5[_0x798e('0x21')],{'raw':_0x40a0b5['options']?_0x40a0b5[_0x798e('0x15')][_0x798e('0x16')]===undefined?!![]:![]:!![]})[_0x798e('0x8')](function(_0x462997){logger[_0x798e('0x9')](_0x798e('0x20'),_0x40a0b5);logger[_0x798e('0x1d')](_0x798e('0x20'),_0x40a0b5,JSON[_0x798e('0xd')](_0x462997));_0xaf8ed7(_0x462997);})[_0x798e('0x12')](function(_0x46ab75){logger[_0x798e('0xe')](_0x798e('0x20'),_0x46ab75[_0x798e('0x10')],_0x40a0b5);_0x391e93(_0x8053[_0x798e('0xe')](0x1f4,_0x46ab75[_0x798e('0x10')]));});});};exports[_0x798e('0x22')]=function(_0x295b1d){var _0x178912=this;return new Promise(function(_0x2e8d97,_0xa4dac8){return db[_0x798e('0x14')][_0x798e('0x23')](_0x295b1d[_0x798e('0x21')],{'raw':_0x295b1d[_0x798e('0x15')]?_0x295b1d['options'][_0x798e('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295b1d[_0x798e('0x15')]?_0x295b1d[_0x798e('0x15')][_0x798e('0x17')]||null:null,'attributes':_0x295b1d[_0x798e('0x15')]?_0x295b1d[_0x798e('0x15')][_0x798e('0x18')]||null:null,'limit':_0x295b1d[_0x798e('0x15')]?_0x295b1d[_0x798e('0x15')][_0x798e('0x19')]||null:null})[_0x798e('0x8')](function(_0x215abd){logger[_0x798e('0x9')](_0x798e('0x22'),_0x295b1d);logger[_0x798e('0x1d')](_0x798e('0x22'),_0x295b1d,JSON[_0x798e('0xd')](_0x215abd));_0x2e8d97(_0x215abd);})[_0x798e('0x12')](function(_0x2ac782){logger['error'](_0x798e('0x22'),_0x2ac782['message'],_0x295b1d);_0xa4dac8(_0x178912['error'](0x1f4,_0x2ac782[_0x798e('0x10')]));});});};exports[_0x798e('0x24')]=function(_0x2c5d01){var _0x51bde5=this;return new Promise(function(_0x209090,_0x3f7d69){return db[_0x798e('0x14')][_0x798e('0x25')]({'where':_0x2c5d01['options']?_0x2c5d01['options'][_0x798e('0x17')]||null:null})[_0x798e('0x8')](function(_0x490c01){logger[_0x798e('0x9')]('DestroyCmHopper',_0x2c5d01);logger[_0x798e('0x1d')](_0x798e('0x24'),_0x2c5d01,JSON[_0x798e('0xd')](_0x490c01));_0x209090(_0x490c01);})[_0x798e('0x12')](function(_0x475749){logger['error'](_0x798e('0x24'),_0x475749[_0x798e('0x10')],_0x2c5d01);_0x3f7d69(_0x51bde5[_0x798e('0xe')](0x1f4,_0x475749[_0x798e('0x10')]));});});};exports['GetContactDialer']=function(_0x3145a9){var _0x27eeb7=this;return new Promise(function(_0x219dfc,_0x51756d){return db[_0x798e('0x26')][_0x798e('0x27')]()['then'](function(_0x4bfc35){return db[_0x798e('0x28')][_0x798e('0x29')](function(_0x5edf08){return db['CmHopper'][_0x798e('0x2a')]({'where':_0x3145a9['options']?_0x3145a9[_0x798e('0x15')]['where']||null:null,'attributes':_0x3145a9[_0x798e('0x15')]?_0x3145a9['options']['attributes']||null:null,'limit':_0x3145a9['options']?_0x3145a9['options']['limit']||null:null,'order':_0x3145a9[_0x798e('0x15')]?_0x3145a9[_0x798e('0x15')][_0x798e('0x2b')]||null:null,'transaction':_0x5edf08,'lock':_0x5edf08[_0x798e('0x2c')][_0x798e('0x2d')],'include':[{'model':db[_0x798e('0x26')],'as':_0x798e('0x2e'),'attributes':_[_0x798e('0x2f')](_0x4bfc35)},{'model':db[_0x798e('0x30')],'as':_0x798e('0x31'),'attributes':['id',_0x798e('0x32'),_0x798e('0x33')]}]})['then'](function(_0x5a86af){var _0x5e5961=[];var _0x33a472=[];for(var _0x117702=0x0;_0x117702<_0x5a86af[_0x798e('0x34')];_0x117702+=0x1){if(!_0x33a472['includes'](_0x5a86af[_0x117702][_0x798e('0x35')])){_0x33a472['push'](_0x5a86af[_0x117702]['UserId']);_0x5e5961[_0x798e('0x36')](_0x5a86af[_0x117702][_0x798e('0x23')](_0x3145a9[_0x798e('0x21')],{'transaction':_0x5edf08}));}}return BPromise['all'](_0x5e5961);});})['then'](function(_0x3d0e9a){logger['info'](_0x798e('0x37'),_0x3145a9);logger[_0x798e('0x1d')]('GetContactDialer',_0x3145a9,JSON[_0x798e('0xd')](_0x3d0e9a));_0x219dfc(_0x3d0e9a);})['catch'](function(_0x2aa837){logger[_0x798e('0xe')](_0x798e('0x37'),_0x2aa837[_0x798e('0x10')],_0x3145a9);_0x51756d(_0x27eeb7[_0x798e('0xe')](0x1f4,_0x2aa837[_0x798e('0x10')]));});});});};exports[_0x798e('0x38')]=function(_0x21c4ad){var _0xafd01c=this;return new Promise(function(_0x154a05,_0x2fba51){return db[_0x798e('0x28')][_0x798e('0x29')](function(_0x1831a8){return db[_0x798e('0x39')][_0x798e('0x3a')](_0x21c4ad[_0x798e('0x21')],{'raw':_0x21c4ad[_0x798e('0x15')]?_0x21c4ad['options'][_0x798e('0x16')]===undefined?!![]:![]:!![],'transaction':_0x1831a8})['then'](function(){return db['CmHopper'][_0x798e('0x25')]({'where':_0x21c4ad[_0x798e('0x15')]?_0x21c4ad['options'][_0x798e('0x17')]||null:null,'transaction':_0x1831a8});});})[_0x798e('0x8')](function(_0x319729){logger['info']('MoveContactManagedDialer',_0x21c4ad);logger[_0x798e('0x1d')](_0x798e('0x38'),_0x21c4ad,JSON[_0x798e('0xd')](_0x319729));_0x154a05(_0x319729);})[_0x798e('0x12')](function(_0x581cec){logger['error'](_0x798e('0x38'),_0x581cec[_0x798e('0x10')],_0x21c4ad);_0x2fba51(_0xafd01c[_0x798e('0xe')](0x1f4,_0x581cec[_0x798e('0x10')]));});});};exports[_0x798e('0x3b')]=function(_0x482d8c){var _0x32b95d=this;return new Promise(function(_0x5bef00,_0x3e02f0){return db[_0x798e('0x14')][_0x798e('0x2a')]({'raw':_0x482d8c[_0x798e('0x15')]?_0x482d8c[_0x798e('0x15')][_0x798e('0x16')]===undefined?!![]:![]:!![],'where':_0x482d8c['options']?_0x482d8c[_0x798e('0x15')][_0x798e('0x17')]||null:null,'attributes':[[db[_0x798e('0x28')]['fn'](_0x798e('0x3c'),db['sequelize']['fn']('IF',db[_0x798e('0x28')][_0x798e('0x3d')](_0x798e('0x3e')+util[_0x798e('0x3f')](_0x798e('0x40'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+_0x798e('0x41')))),'contactsRescheduled']]})[_0x798e('0x8')](function(_0x54c69c){logger[_0x798e('0x9')](_0x798e('0x3b'),_0x482d8c);logger[_0x798e('0x1d')](_0x798e('0x3b'),_0x482d8c,JSON[_0x798e('0xd')](_0x54c69c));_0x5bef00(_0x54c69c);})['catch'](function(_0x646411){logger[_0x798e('0xe')](_0x798e('0x3b'),_0x646411[_0x798e('0x10')],_0x482d8c);_0x3e02f0(_0x32b95d[_0x798e('0xe')](0x1f4,_0x646411[_0x798e('0x10')]));});});};exports[_0x798e('0x42')]=function(_0x81963){var _0x12b432=this;return new Promise(function(_0x3832b8,_0x57ea60){return db[_0x798e('0x26')]['describe']()[_0x798e('0x8')](function(_0x54154f){return db['sequelize'][_0x798e('0x29')](function(_0x242aa9){return db['CmHopper']['findAll']({'where':_0x81963[_0x798e('0x15')]?_0x81963['options'][_0x798e('0x17')]||null:null,'attributes':_0x81963[_0x798e('0x15')]?_0x81963[_0x798e('0x15')][_0x798e('0x18')]||null:null,'limit':0x1,'order':_0x81963[_0x798e('0x15')]?_0x81963[_0x798e('0x15')][_0x798e('0x2b')]||null:null,'group':db[_0x798e('0x14')][_0x798e('0x35')],'transaction':_0x242aa9,'lock':_0x242aa9[_0x798e('0x2c')][_0x798e('0x2d')],'include':_0x81963[_0x798e('0x15')]?_0x81963[_0x798e('0x15')]['include']?_[_0x798e('0x1b')](_0x81963[_0x798e('0x15')]['include'],function(_0x304be4){return{'model':db[_0x304be4[_0x798e('0x1c')]],'as':_0x304be4['as'],'attributes':_0x304be4[_0x798e('0x18')],'include':_0x304be4[_0x798e('0x1a')]?_[_0x798e('0x1b')](_0x304be4[_0x798e('0x1a')],function(_0x5ad2a7){return{'model':db[_0x5ad2a7['model']],'as':_0x5ad2a7['as'],'attributes':_0x5ad2a7[_0x798e('0x18')],'include':_0x5ad2a7['include']?_[_0x798e('0x1b')](_0x5ad2a7[_0x798e('0x1a')],function(_0x80574d){return{'model':db[_0x80574d[_0x798e('0x1c')]],'as':_0x80574d['as'],'attributes':_0x80574d['attributes']};}):[]};}):[]};}):[]:[]})[_0x798e('0x8')](function(_0x15e958){var _0xb997ea=[];for(var _0x501a0f=0x0;_0x501a0f<_0x15e958['length'];_0x501a0f+=0x1){_0xb997ea[_0x798e('0x36')](_0x15e958[_0x501a0f][_0x798e('0x23')](_0x81963[_0x798e('0x21')],{'transaction':_0x242aa9}));}return BPromise[_0x798e('0x43')](_0xb997ea);});})[_0x798e('0x8')](function(_0xbb7dc3){logger[_0x798e('0x9')](_0x798e('0x42'),_0x81963);logger['debug'](_0x798e('0x42'),_0x81963,JSON['stringify'](_0xbb7dc3));_0x3832b8(_0xbb7dc3);})[_0x798e('0x12')](function(_0x134e06){logger[_0x798e('0xe')]('GetContactRecallMe',_0x134e06[_0x798e('0x10')],_0x81963);_0x57ea60(_0x12b432[_0x798e('0xe')](0x1f4,_0x134e06[_0x798e('0x10')]));});});});};exports['GetCmHopperPreview']=function(_0x388c0e){var _0x1c718d=this;return new Promise(function(_0x1cc42d,_0x5e95f8){db[_0x798e('0x26')]['describe']()[_0x798e('0x8')](function(_0x175f93){return db[_0x798e('0x14')][_0x798e('0x2a')]({'raw':_0x388c0e[_0x798e('0x15')]?_0x388c0e[_0x798e('0x15')][_0x798e('0x16')]===undefined?!![]:![]:!![],'where':_0x388c0e[_0x798e('0x15')]?_0x388c0e[_0x798e('0x15')]['where']||null:null,'attributes':_0x388c0e[_0x798e('0x15')]?_0x388c0e['options'][_0x798e('0x18')]||null:null,'limit':_0x388c0e['options']?_0x388c0e[_0x798e('0x15')]['limit']||null:null,'include':_0x388c0e['options']?_0x388c0e[_0x798e('0x15')][_0x798e('0x1a')]?_[_0x798e('0x1b')](_0x388c0e[_0x798e('0x15')]['include'],function(_0x1789c6){return{'model':db[_0x1789c6[_0x798e('0x1c')]],'as':_0x1789c6['as'],'attributes':_0x1789c6['as']===_0x798e('0x2e')?_[_0x798e('0x2f')](_0x175f93):_0x1789c6[_0x798e('0x18')],'include':_0x1789c6[_0x798e('0x1a')]?_[_0x798e('0x1b')](_0x1789c6[_0x798e('0x1a')],function(_0x20fe23){return{'model':db[_0x20fe23[_0x798e('0x1c')]],'as':_0x20fe23['as'],'attributes':_0x20fe23[_0x798e('0x18')],'include':_0x20fe23[_0x798e('0x1a')]?_[_0x798e('0x1b')](_0x20fe23[_0x798e('0x1a')],function(_0x1470d9){return{'model':db[_0x1470d9['model']],'as':_0x1470d9['as'],'attributes':_0x1470d9[_0x798e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x798e('0x8')](function(_0x4c0b9c){logger['info'](_0x798e('0x13'),_0x388c0e);logger[_0x798e('0x1d')](_0x798e('0x13'),_0x388c0e,JSON[_0x798e('0xd')](_0x4c0b9c));_0x1cc42d(_0x4c0b9c);})[_0x798e('0x12')](function(_0x371450){logger[_0x798e('0xe')](_0x798e('0x13'),_0x371450[_0x798e('0x10')],_0x388c0e);_0x5e95f8(_0x1c718d[_0x798e('0xe')](0x1f4,_0x371450['message']));});});});}; \ No newline at end of file +var _0x9893=['all','GetContactDialer','MoveContactManagedDialer','transaction','CmHopperFinal','CountReScheduled','sequelize','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','GetContactRecallMe','describe','GetCmHopperPreview','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCmHopper','CmHopper','findAll','options','where','attributes','limit','include','model','map','info','catch','ShowCmHopper','raw','CreateCmHopper','create','body','UpdateCmHopper','DestroyCmHopper','destroy','CmContact','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','includes','UserId','push','update'];(function(_0x15e4c0,_0x5ad321){var _0x44f2e2=function(_0x3bbf71){while(--_0x3bbf71){_0x15e4c0['push'](_0x15e4c0['shift']());}};_0x44f2e2(++_0x5ad321);}(_0x9893,0x177));var _0x3989=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9893[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3989('0x0'));var util=require(_0x3989('0x1'));var moment=require('moment');var BPromise=require(_0x3989('0x2'));var rs=require(_0x3989('0x3'));var fs=require('fs');var Redis=require(_0x3989('0x4'));var db=require(_0x3989('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3989('0x6'))(_0x3989('0x7'));var config=require(_0x3989('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3989('0x9')][_0x3989('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16e729,_0x4d0a71,_0x30ad1d){return new BPromise(function(_0x383343,_0x5add90){return client[_0x3989('0xb')](_0x16e729,_0x30ad1d)[_0x3989('0xc')](function(_0x22f9f3){logger['info'](_0x3989('0xd'),_0x4d0a71,_0x3989('0xe'));logger[_0x3989('0xf')](_0x3989('0x10'),_0x4d0a71,_0x3989('0xe'),JSON[_0x3989('0x11')](_0x22f9f3));if(_0x22f9f3[_0x3989('0x12')]){if(_0x22f9f3[_0x3989('0x12')][_0x3989('0x13')]===0x1f4){logger[_0x3989('0x12')](_0x3989('0xd'),_0x4d0a71,_0x22f9f3['error'][_0x3989('0x14')]);return _0x5add90(_0x22f9f3[_0x3989('0x12')][_0x3989('0x14')]);}logger[_0x3989('0x12')](_0x3989('0xd'),_0x4d0a71,_0x22f9f3[_0x3989('0x12')][_0x3989('0x14')]);return _0x383343(_0x22f9f3[_0x3989('0x12')]['message']);}else{logger['info'](_0x3989('0xd'),_0x4d0a71,_0x3989('0xe'));_0x383343(_0x22f9f3[_0x3989('0x15')][_0x3989('0x14')]);}})['catch'](function(_0x10f688){logger[_0x3989('0x12')](_0x3989('0xd'),_0x4d0a71,_0x10f688);_0x5add90(_0x10f688);});});}exports[_0x3989('0x16')]=function(_0x475b1c){var _0x4c9a25=this;return new Promise(function(_0x49ae39,_0x4338a6){return db[_0x3989('0x17')][_0x3989('0x18')]({'raw':_0x475b1c['options']?_0x475b1c['options']['raw']===undefined?!![]:![]:!![],'where':_0x475b1c['options']?_0x475b1c[_0x3989('0x19')][_0x3989('0x1a')]||null:null,'attributes':_0x475b1c[_0x3989('0x19')]?_0x475b1c['options'][_0x3989('0x1b')]||null:null,'limit':_0x475b1c[_0x3989('0x19')]?_0x475b1c[_0x3989('0x19')][_0x3989('0x1c')]||null:null,'include':_0x475b1c[_0x3989('0x19')]?_0x475b1c[_0x3989('0x19')][_0x3989('0x1d')]?_['map'](_0x475b1c['options'][_0x3989('0x1d')],function(_0x24f451){return{'model':db[_0x24f451[_0x3989('0x1e')]],'as':_0x24f451['as'],'attributes':_0x24f451[_0x3989('0x1b')],'include':_0x24f451['include']?_[_0x3989('0x1f')](_0x24f451['include'],function(_0x3ce07f){return{'model':db[_0x3ce07f[_0x3989('0x1e')]],'as':_0x3ce07f['as'],'attributes':_0x3ce07f['attributes'],'include':_0x3ce07f['include']?_[_0x3989('0x1f')](_0x3ce07f['include'],function(_0x22ad05){return{'model':db[_0x22ad05['model']],'as':_0x22ad05['as'],'attributes':_0x22ad05[_0x3989('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57b93b){logger[_0x3989('0x20')](_0x3989('0x16'),_0x475b1c);logger['debug'](_0x3989('0x16'),_0x475b1c,JSON['stringify'](_0x57b93b));_0x49ae39(_0x57b93b);})[_0x3989('0x21')](function(_0x767564){logger[_0x3989('0x12')](_0x3989('0x16'),_0x767564['message'],_0x475b1c);_0x4338a6(_0x4c9a25[_0x3989('0x12')](0x1f4,_0x767564['message']));});});};exports[_0x3989('0x22')]=function(_0x42ea46){var _0x14cf59=this;return new Promise(function(_0x50f71a,_0x319330){return db['CmHopper']['find']({'raw':_0x42ea46[_0x3989('0x19')]?_0x42ea46[_0x3989('0x19')][_0x3989('0x23')]===undefined?!![]:![]:!![],'where':_0x42ea46['options']?_0x42ea46[_0x3989('0x19')][_0x3989('0x1a')]||null:null,'attributes':_0x42ea46[_0x3989('0x19')]?_0x42ea46[_0x3989('0x19')][_0x3989('0x1b')]||null:null,'include':_0x42ea46[_0x3989('0x19')]?_0x42ea46[_0x3989('0x19')][_0x3989('0x1d')]?_['map'](_0x42ea46[_0x3989('0x19')][_0x3989('0x1d')],function(_0x3eddc0){return{'model':db[_0x3eddc0[_0x3989('0x1e')]],'as':_0x3eddc0['as'],'attributes':_0x3eddc0[_0x3989('0x1b')],'include':_0x3eddc0['include']?_[_0x3989('0x1f')](_0x3eddc0[_0x3989('0x1d')],function(_0x1f1d12){return{'model':db[_0x1f1d12[_0x3989('0x1e')]],'as':_0x1f1d12['as'],'attributes':_0x1f1d12[_0x3989('0x1b')],'include':_0x1f1d12[_0x3989('0x1d')]?_['map'](_0x1f1d12[_0x3989('0x1d')],function(_0x45bc4a){return{'model':db[_0x45bc4a[_0x3989('0x1e')]],'as':_0x45bc4a['as'],'attributes':_0x45bc4a[_0x3989('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3989('0xc')](function(_0x2f5ba7){logger['info'](_0x3989('0x22'),_0x42ea46);logger['debug']('ShowCmHopper',_0x42ea46,JSON[_0x3989('0x11')](_0x2f5ba7));_0x50f71a(_0x2f5ba7);})[_0x3989('0x21')](function(_0x4974f9){logger[_0x3989('0x12')](_0x3989('0x22'),_0x4974f9['message'],_0x42ea46);_0x319330(_0x14cf59['error'](0x1f4,_0x4974f9['message']));});});};exports[_0x3989('0x24')]=function(_0x223932){var _0x359f56=this;return new Promise(function(_0x14c7f3,_0x2428bb){return db[_0x3989('0x17')][_0x3989('0x25')](_0x223932[_0x3989('0x26')],{'raw':_0x223932[_0x3989('0x19')]?_0x223932[_0x3989('0x19')][_0x3989('0x23')]===undefined?!![]:![]:!![]})[_0x3989('0xc')](function(_0x853eb5){logger[_0x3989('0x20')](_0x3989('0x24'),_0x223932);logger[_0x3989('0xf')](_0x3989('0x24'),_0x223932,JSON[_0x3989('0x11')](_0x853eb5));_0x14c7f3(_0x853eb5);})[_0x3989('0x21')](function(_0xbe56b1){logger['error'](_0x3989('0x24'),_0xbe56b1[_0x3989('0x14')],_0x223932);_0x2428bb(_0x359f56[_0x3989('0x12')](0x1f4,_0xbe56b1[_0x3989('0x14')]));});});};exports[_0x3989('0x27')]=function(_0x278d79){var _0x24a8de=this;return new Promise(function(_0x3bec03,_0x5e3015){return db[_0x3989('0x17')]['update'](_0x278d79[_0x3989('0x26')],{'raw':_0x278d79[_0x3989('0x19')]?_0x278d79[_0x3989('0x19')][_0x3989('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x278d79[_0x3989('0x19')]?_0x278d79[_0x3989('0x19')]['where']||null:null,'attributes':_0x278d79[_0x3989('0x19')]?_0x278d79['options']['attributes']||null:null,'limit':_0x278d79[_0x3989('0x19')]?_0x278d79['options'][_0x3989('0x1c')]||null:null})['then'](function(_0x2f8d94){logger['info'](_0x3989('0x27'),_0x278d79);logger[_0x3989('0xf')]('UpdateCmHopper',_0x278d79,JSON[_0x3989('0x11')](_0x2f8d94));_0x3bec03(_0x2f8d94);})[_0x3989('0x21')](function(_0x3e5b59){logger[_0x3989('0x12')]('UpdateCmHopper',_0x3e5b59[_0x3989('0x14')],_0x278d79);_0x5e3015(_0x24a8de['error'](0x1f4,_0x3e5b59[_0x3989('0x14')]));});});};exports[_0x3989('0x28')]=function(_0xe3e198){var _0x48841f=this;return new Promise(function(_0x102812,_0x4652e8){return db[_0x3989('0x17')][_0x3989('0x29')]({'where':_0xe3e198[_0x3989('0x19')]?_0xe3e198[_0x3989('0x19')][_0x3989('0x1a')]||null:null})['then'](function(_0x846fdd){logger[_0x3989('0x20')](_0x3989('0x28'),_0xe3e198);logger[_0x3989('0xf')]('DestroyCmHopper',_0xe3e198,JSON[_0x3989('0x11')](_0x846fdd));_0x102812(_0x846fdd);})['catch'](function(_0x42406f){logger[_0x3989('0x12')](_0x3989('0x28'),_0x42406f[_0x3989('0x14')],_0xe3e198);_0x4652e8(_0x48841f['error'](0x1f4,_0x42406f[_0x3989('0x14')]));});});};exports['GetContactDialer']=function(_0x120002){var _0x541bb5=this;return new Promise(function(_0x28fcd7,_0x591dd1){return db[_0x3989('0x2a')]['describe']()[_0x3989('0xc')](function(_0x41c834){return db['sequelize']['transaction'](function(_0xa8c565){return db[_0x3989('0x17')][_0x3989('0x18')]({'where':_0x120002[_0x3989('0x19')]?_0x120002[_0x3989('0x19')][_0x3989('0x1a')]||null:null,'attributes':_0x120002['options']?_0x120002[_0x3989('0x19')]['attributes']||null:null,'limit':_0x120002['options']?_0x120002[_0x3989('0x19')][_0x3989('0x1c')]||null:null,'order':_0x120002[_0x3989('0x19')]?_0x120002[_0x3989('0x19')][_0x3989('0x2b')]||null:null,'transaction':_0xa8c565,'lock':_0xa8c565[_0x3989('0x2c')][_0x3989('0x2d')],'include':[{'model':db['CmContact'],'as':_0x3989('0x2e'),'attributes':_[_0x3989('0x2f')](_0x41c834)},{'model':db[_0x3989('0x30')],'as':_0x3989('0x31'),'attributes':['id',_0x3989('0x32'),_0x3989('0x33')]}]})['then'](function(_0x1baa27){var _0x42edf7=[];var _0x3f95d8=[];for(var _0x3f3ad2=0x0;_0x3f3ad2<_0x1baa27[_0x3989('0x34')];_0x3f3ad2+=0x1){if(!_0x3f95d8[_0x3989('0x35')](_0x1baa27[_0x3f3ad2][_0x3989('0x36')])){_0x3f95d8[_0x3989('0x37')](_0x1baa27[_0x3f3ad2][_0x3989('0x36')]);_0x42edf7['push'](_0x1baa27[_0x3f3ad2][_0x3989('0x38')](_0x120002[_0x3989('0x26')],{'transaction':_0xa8c565}));}}return BPromise[_0x3989('0x39')](_0x42edf7);});})[_0x3989('0xc')](function(_0x37685f){logger[_0x3989('0x20')]('GetContactDialer',_0x120002);logger[_0x3989('0xf')](_0x3989('0x3a'),_0x120002,JSON[_0x3989('0x11')](_0x37685f));_0x28fcd7(_0x37685f);})[_0x3989('0x21')](function(_0x4f2868){logger[_0x3989('0x12')]('GetContactDialer',_0x4f2868[_0x3989('0x14')],_0x120002);_0x591dd1(_0x541bb5['error'](0x1f4,_0x4f2868[_0x3989('0x14')]));});});});};exports[_0x3989('0x3b')]=function(_0x47782a){var _0x5adbe6=this;return new Promise(function(_0x1ed7f5,_0x2c0d2c){return db['sequelize'][_0x3989('0x3c')](function(_0x46036a){return db[_0x3989('0x3d')][_0x3989('0x25')](_0x47782a[_0x3989('0x26')],{'raw':_0x47782a[_0x3989('0x19')]?_0x47782a['options'][_0x3989('0x23')]===undefined?!![]:![]:!![],'transaction':_0x46036a})[_0x3989('0xc')](function(){return db[_0x3989('0x17')][_0x3989('0x29')]({'where':_0x47782a[_0x3989('0x19')]?_0x47782a[_0x3989('0x19')]['where']||null:null,'transaction':_0x46036a});});})[_0x3989('0xc')](function(_0xf377ef){logger[_0x3989('0x20')](_0x3989('0x3b'),_0x47782a);logger['debug']('MoveContactManagedDialer',_0x47782a,JSON[_0x3989('0x11')](_0xf377ef));_0x1ed7f5(_0xf377ef);})[_0x3989('0x21')](function(_0x51b125){logger[_0x3989('0x12')](_0x3989('0x3b'),_0x51b125[_0x3989('0x14')],_0x47782a);_0x2c0d2c(_0x5adbe6[_0x3989('0x12')](0x1f4,_0x51b125[_0x3989('0x14')]));});});};exports[_0x3989('0x3e')]=function(_0x33829d){var _0x300d6b=this;return new Promise(function(_0x39a367,_0x4e1373){return db[_0x3989('0x17')][_0x3989('0x18')]({'raw':_0x33829d[_0x3989('0x19')]?_0x33829d[_0x3989('0x19')][_0x3989('0x23')]===undefined?!![]:![]:!![],'where':_0x33829d['options']?_0x33829d[_0x3989('0x19')][_0x3989('0x1a')]||null:null,'attributes':[[db[_0x3989('0x3f')]['fn']('COUNT',db[_0x3989('0x3f')]['fn']('IF',db[_0x3989('0x3f')][_0x3989('0x40')](_0x3989('0x41')+util[_0x3989('0x42')](_0x3989('0x43'),moment()[_0x3989('0x42')](_0x3989('0x44')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})['then'](function(_0x3a5b97){logger[_0x3989('0x20')](_0x3989('0x3e'),_0x33829d);logger[_0x3989('0xf')](_0x3989('0x3e'),_0x33829d,JSON[_0x3989('0x11')](_0x3a5b97));_0x39a367(_0x3a5b97);})[_0x3989('0x21')](function(_0x31c347){logger[_0x3989('0x12')]('CountReScheduled',_0x31c347[_0x3989('0x14')],_0x33829d);_0x4e1373(_0x300d6b[_0x3989('0x12')](0x1f4,_0x31c347[_0x3989('0x14')]));});});};exports[_0x3989('0x45')]=function(_0x444bc3){var _0x1f1de1=this;return new Promise(function(_0xcd3e0a,_0x44663e){return db[_0x3989('0x2a')][_0x3989('0x46')]()[_0x3989('0xc')](function(_0x24cb35){return db['sequelize'][_0x3989('0x3c')](function(_0x1d1813){return db[_0x3989('0x17')][_0x3989('0x18')]({'where':_0x444bc3['options']?_0x444bc3['options'][_0x3989('0x1a')]||null:null,'attributes':_0x444bc3[_0x3989('0x19')]?_0x444bc3['options']['attributes']||null:null,'limit':0x1,'order':_0x444bc3['options']?_0x444bc3[_0x3989('0x19')][_0x3989('0x2b')]||null:null,'group':db['CmHopper'][_0x3989('0x36')],'transaction':_0x1d1813,'lock':_0x1d1813[_0x3989('0x2c')][_0x3989('0x2d')],'include':_0x444bc3['options']?_0x444bc3[_0x3989('0x19')][_0x3989('0x1d')]?_[_0x3989('0x1f')](_0x444bc3[_0x3989('0x19')][_0x3989('0x1d')],function(_0x188248){return{'model':db[_0x188248[_0x3989('0x1e')]],'as':_0x188248['as'],'attributes':_0x188248[_0x3989('0x1b')],'include':_0x188248[_0x3989('0x1d')]?_[_0x3989('0x1f')](_0x188248[_0x3989('0x1d')],function(_0x24caf9){return{'model':db[_0x24caf9[_0x3989('0x1e')]],'as':_0x24caf9['as'],'attributes':_0x24caf9[_0x3989('0x1b')],'include':_0x24caf9['include']?_[_0x3989('0x1f')](_0x24caf9[_0x3989('0x1d')],function(_0x42e06a){return{'model':db[_0x42e06a[_0x3989('0x1e')]],'as':_0x42e06a['as'],'attributes':_0x42e06a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x22c563){var _0x3d243e=[];for(var _0x80094b=0x0;_0x80094b<_0x22c563[_0x3989('0x34')];_0x80094b+=0x1){_0x3d243e[_0x3989('0x37')](_0x22c563[_0x80094b][_0x3989('0x38')](_0x444bc3[_0x3989('0x26')],{'transaction':_0x1d1813}));}return BPromise['all'](_0x3d243e);});})[_0x3989('0xc')](function(_0x2121e9){logger[_0x3989('0x20')]('GetContactRecallMe',_0x444bc3);logger[_0x3989('0xf')](_0x3989('0x45'),_0x444bc3,JSON['stringify'](_0x2121e9));_0xcd3e0a(_0x2121e9);})['catch'](function(_0x196417){logger[_0x3989('0x12')](_0x3989('0x45'),_0x196417[_0x3989('0x14')],_0x444bc3);_0x44663e(_0x1f1de1['error'](0x1f4,_0x196417['message']));});});});};exports[_0x3989('0x47')]=function(_0xa0a0ff){var _0x45e095=this;return new Promise(function(_0x53d9c9,_0x42d514){db[_0x3989('0x2a')][_0x3989('0x46')]()['then'](function(_0x444279){return db[_0x3989('0x17')][_0x3989('0x18')]({'raw':_0xa0a0ff[_0x3989('0x19')]?_0xa0a0ff['options'][_0x3989('0x23')]===undefined?!![]:![]:!![],'where':_0xa0a0ff[_0x3989('0x19')]?_0xa0a0ff['options'][_0x3989('0x1a')]||null:null,'attributes':_0xa0a0ff[_0x3989('0x19')]?_0xa0a0ff[_0x3989('0x19')][_0x3989('0x1b')]||null:null,'limit':_0xa0a0ff[_0x3989('0x19')]?_0xa0a0ff[_0x3989('0x19')][_0x3989('0x1c')]||null:null,'include':_0xa0a0ff['options']?_0xa0a0ff[_0x3989('0x19')][_0x3989('0x1d')]?_[_0x3989('0x1f')](_0xa0a0ff['options'][_0x3989('0x1d')],function(_0x284d23){return{'model':db[_0x284d23[_0x3989('0x1e')]],'as':_0x284d23['as'],'attributes':_0x284d23['as']===_0x3989('0x2e')?_[_0x3989('0x2f')](_0x444279):_0x284d23[_0x3989('0x1b')],'include':_0x284d23[_0x3989('0x1d')]?_[_0x3989('0x1f')](_0x284d23['include'],function(_0x36ed0f){return{'model':db[_0x36ed0f['model']],'as':_0x36ed0f['as'],'attributes':_0x36ed0f['attributes'],'include':_0x36ed0f[_0x3989('0x1d')]?_[_0x3989('0x1f')](_0x36ed0f[_0x3989('0x1d')],function(_0x500c11){return{'model':db[_0x500c11[_0x3989('0x1e')]],'as':_0x500c11['as'],'attributes':_0x500c11[_0x3989('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3989('0xc')](function(_0x2f2dc0){logger[_0x3989('0x20')](_0x3989('0x16'),_0xa0a0ff);logger['debug'](_0x3989('0x16'),_0xa0a0ff,JSON[_0x3989('0x11')](_0x2f2dc0));_0x53d9c9(_0x2f2dc0);})['catch'](function(_0x121c17){logger[_0x3989('0x12')](_0x3989('0x16'),_0x121c17[_0x3989('0x14')],_0xa0a0ff);_0x42d514(_0x45e095[_0x3989('0x12')](0x1f4,_0x121c17[_0x3989('0x14')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 02ec369..78f751f 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 _0xbb59=['create','/preview','getPreview','put','update','delete','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','isAuthenticated','index','get','/describe','describe','/opencontacts','getOpenContacts','/:id','post'];(function(_0x509220,_0x58a6ec){var _0x2335b2=function(_0x396624){while(--_0x396624){_0x509220['push'](_0x509220['shift']());}};_0x2335b2(++_0x58a6ec);}(_0xbb59,0xec));var _0x9bb5=function(_0x395438,_0x17bcae){_0x395438=_0x395438-0x0;var _0x298412=_0xbb59[_0x395438];return _0x298412;};'use strict';var multer=require(_0x9bb5('0x0'));var util=require(_0x9bb5('0x1'));var path=require(_0x9bb5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9bb5('0x3')]();var auth=require(_0x9bb5('0x4'));var interaction=require(_0x9bb5('0x5'));var config=require(_0x9bb5('0x6'));var controller=require(_0x9bb5('0x7'));router['get']('/',auth[_0x9bb5('0x8')](),controller[_0x9bb5('0x9')]);router[_0x9bb5('0xa')](_0x9bb5('0xb'),auth[_0x9bb5('0x8')](),controller[_0x9bb5('0xc')]);router[_0x9bb5('0xa')](_0x9bb5('0xd'),auth[_0x9bb5('0x8')](),controller[_0x9bb5('0xe')]);router[_0x9bb5('0xa')](_0x9bb5('0xf'),auth[_0x9bb5('0x8')](),controller['show']);router[_0x9bb5('0x10')]('/',auth[_0x9bb5('0x8')](),controller[_0x9bb5('0x11')]);router[_0x9bb5('0x10')](_0x9bb5('0x12'),auth[_0x9bb5('0x8')](),controller[_0x9bb5('0x13')]);router[_0x9bb5('0x14')](_0x9bb5('0xf'),auth[_0x9bb5('0x8')](),controller[_0x9bb5('0x15')]);router[_0x9bb5('0x16')](_0x9bb5('0xf'),auth[_0x9bb5('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf963=['getPreview','put','/:id','update','destroy','multer','connect-timeout','express','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','index','/describe','isAuthenticated','describe','/opencontacts','show','post','create'];(function(_0x3a094d,_0x2811f1){var _0x2fce9f=function(_0xf37d1c){while(--_0xf37d1c){_0x3a094d['push'](_0x3a094d['shift']());}};_0x2fce9f(++_0x2811f1);}(_0xf963,0x11d));var _0x3f96=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xf963[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x3f96('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3f96('0x1'));var express=require(_0x3f96('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3f96('0x3'));var config=require(_0x3f96('0x4'));var controller=require(_0x3f96('0x5'));router[_0x3f96('0x6')]('/',auth['isAuthenticated'](),controller[_0x3f96('0x7')]);router['get'](_0x3f96('0x8'),auth[_0x3f96('0x9')](),controller[_0x3f96('0xa')]);router['get'](_0x3f96('0xb'),auth[_0x3f96('0x9')](),controller['getOpenContacts']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3f96('0xc')]);router[_0x3f96('0xd')]('/',auth[_0x3f96('0x9')](),controller[_0x3f96('0xe')]);router[_0x3f96('0xd')]('/preview',auth[_0x3f96('0x9')](),controller[_0x3f96('0xf')]);router[_0x3f96('0x10')](_0x3f96('0x11'),auth['isAuthenticated'](),controller[_0x3f96('0x12')]);router['delete'](_0x3f96('0x11'),auth[_0x3f96('0x9')](),controller[_0x3f96('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 5c090f9..fecb67b 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 _0x1a17=['STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','exports','INTEGER'];(function(_0xa8e6d5,_0x30a6d3){var _0x60baf4=function(_0x156b35){while(--_0x156b35){_0xa8e6d5['push'](_0xa8e6d5['shift']());}};_0x60baf4(++_0x30a6d3);}(_0x1a17,0xf3));var _0x71a1=function(_0x5df657,_0x38d833){_0x5df657=_0x5df657-0x0;var _0x97387d=_0x1a17[_0x5df657];return _0x97387d;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x71a1('0x0')]={'CmHopperId':{'type':Sequelize[_0x71a1('0x1')]},'phone':{'type':Sequelize[_0x71a1('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x71a1('0x3')],'defaultValue':moment()['format'](_0x71a1('0x4'))},'countbusyretry':{'type':Sequelize[_0x71a1('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x71a1('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x71a1('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x71a1('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x71a1('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xab23=['moment','sequelize','INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1dadb4,_0x4b06ac){var _0x4e50fc=function(_0x49e3bd){while(--_0x49e3bd){_0x1dadb4['push'](_0x1dadb4['shift']());}};_0x4e50fc(++_0x4b06ac);}(_0xab23,0x66));var _0x3ab2=function(_0x118397,_0x2aad36){_0x118397=_0x118397-0x0;var _0x3055b3=_0xab23[_0x118397];return _0x3055b3;};'use strict';var moment=require(_0x3ab2('0x0'));var Sequelize=require(_0x3ab2('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0x3ab2('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x3ab2('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x3ab2('0x3')],'defaultValue':moment()[_0x3ab2('0x4')](_0x3ab2('0x5'))},'countbusyretry':{'type':Sequelize[_0x3ab2('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3ab2('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x3ab2('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3ab2('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3ab2('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3ab2('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3ab2('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 4a76997..f202530 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 _0xee87=['include','findAll','rows','show','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','then','destroy','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xee87,0x10d));var _0x7ee8=function(_0x4f27e4,_0x25aa19){_0x4f27e4=_0x4f27e4-0x0;var _0x2a849d=_0xee87[_0x4f27e4];return _0x2a849d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7ee8('0x0'));var rimraf=require(_0x7ee8('0x1'));var zipdir=require(_0x7ee8('0x2'));var jsonpatch=require(_0x7ee8('0x3'));var rp=require(_0x7ee8('0x4'));var moment=require(_0x7ee8('0x5'));var BPromise=require(_0x7ee8('0x6'));var Mustache=require(_0x7ee8('0x7'));var util=require(_0x7ee8('0x8'));var path=require(_0x7ee8('0x9'));var sox=require('sox');var csv=require(_0x7ee8('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7ee8('0xb'));var squel=require(_0x7ee8('0xc'));var crypto=require(_0x7ee8('0xd'));var jsforce=require(_0x7ee8('0xe'));var deskjs=require(_0x7ee8('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7ee8('0x10'));var Redis=require('ioredis');var authService=require(_0x7ee8('0x11'));var qs=require(_0x7ee8('0x12'));var as=require(_0x7ee8('0x13'));var hardwareService=require(_0x7ee8('0x14'));var logger=require(_0x7ee8('0x15'))(_0x7ee8('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7ee8('0x17'));var db=require(_0x7ee8('0x18'))['db'];function respondWithStatusCode(_0x39a4cd,_0x36e82a){_0x36e82a=_0x36e82a||0xcc;return function(_0xb4a1bc){if(_0xb4a1bc){return _0x39a4cd[_0x7ee8('0x19')](_0x36e82a);}return _0x39a4cd[_0x7ee8('0x1a')](_0x36e82a)[_0x7ee8('0x1b')]();};}function respondWithResult(_0x2a5fa3,_0x46b127){_0x46b127=_0x46b127||0xc8;return function(_0x1669d7){if(_0x1669d7){return _0x2a5fa3[_0x7ee8('0x1a')](_0x46b127)[_0x7ee8('0x1c')](_0x1669d7);}};}function respondWithFilteredResult(_0x12e853,_0x268b93){return function(_0x43f34c){if(_0x43f34c){var _0x192d8c=_0x43f34c[_0x7ee8('0x1d')],_0xf4a2c8=_0x268b93[_0x7ee8('0x1e')],_0xc46e32=_0x268b93[_0x7ee8('0x1e')]+_0x268b93[_0x7ee8('0x1f')],_0x3de0b8;if(_0xc46e32>=_0x192d8c){_0xc46e32=_0x192d8c;_0x3de0b8=0xc8;}else{_0x3de0b8=0xce;}_0x12e853[_0x7ee8('0x1a')](_0x3de0b8);return _0x12e853['set'](_0x7ee8('0x20'),_0xf4a2c8+'-'+_0xc46e32+'/'+_0x192d8c)['json'](_0x43f34c);}return null;};}function patchUpdates(_0x2bfa20){return function(_0x459ad1){try{jsonpatch['apply'](_0x459ad1,_0x2bfa20,!![]);}catch(_0x59e544){return BPromise[_0x7ee8('0x21')](_0x59e544);}return _0x459ad1[_0x7ee8('0x22')]();};}function saveUpdates(_0x298430,_0x15c00f){return function(_0x3de76){if(_0x3de76){return _0x3de76['update'](_0x298430)[_0x7ee8('0x23')](function(_0x43485e){return _0x43485e;});}return null;};}function removeEntity(_0x334b46,_0x555338){return function(_0x27bff9){if(_0x27bff9){return _0x27bff9[_0x7ee8('0x24')]()[_0x7ee8('0x23')](function(){var _0x1bcdd9=_0x27bff9['get']({'plain':!![]});var _0x40d420=_0x7ee8('0x25');return db[_0x7ee8('0x26')]['destroy']({'where':{'type':_0x40d420,'resourceId':_0x1bcdd9['id']}})[_0x7ee8('0x23')](function(){return _0x27bff9;});})[_0x7ee8('0x23')](function(){_0x334b46[_0x7ee8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f9cae,_0x3870e9){return function(_0x568ea){if(!_0x568ea){_0x3f9cae['sendStatus'](0x194);}return _0x568ea;};}function handleError(_0x27c94c,_0x4c360d){_0x4c360d=_0x4c360d||0x1f4;return function(_0x4d23fb){logger[_0x7ee8('0x27')](_0x4d23fb[_0x7ee8('0x28')]);if(_0x4d23fb['name']){delete _0x4d23fb[_0x7ee8('0x29')];}_0x27c94c['status'](_0x4c360d)[_0x7ee8('0x2a')](_0x4d23fb);};}exports['index']=function(_0x76beaa,_0x547147){var _0xf54bb1={},_0x33f20e={},_0x5455d0={'count':0x0,'rows':[]};var _0x2034c5=_[_0x7ee8('0x2b')](db[_0x7ee8('0x2c')][_0x7ee8('0x2d')],function(_0x2a8422){return{'name':_0x2a8422[_0x7ee8('0x2e')],'type':_0x2a8422[_0x7ee8('0x2f')]['key']};});_0x33f20e[_0x7ee8('0x30')]=_['map'](_0x2034c5,_0x7ee8('0x29'));_0x33f20e[_0x7ee8('0x31')]=_[_0x7ee8('0x32')](_0x76beaa[_0x7ee8('0x31')]);_0x33f20e['filters']=_[_0x7ee8('0x33')](_0x33f20e[_0x7ee8('0x30')],_0x33f20e['query']);_0xf54bb1[_0x7ee8('0x34')]=_[_0x7ee8('0x33')](_0x33f20e[_0x7ee8('0x30')],qs[_0x7ee8('0x35')](_0x76beaa[_0x7ee8('0x31')]['fields']));_0xf54bb1[_0x7ee8('0x34')]=_0xf54bb1[_0x7ee8('0x34')][_0x7ee8('0x36')]?_0xf54bb1['attributes']:_0x33f20e[_0x7ee8('0x30')];if(!_0x76beaa['query'][_0x7ee8('0x37')](_0x7ee8('0x38'))){_0xf54bb1['limit']=qs[_0x7ee8('0x1f')](_0x76beaa[_0x7ee8('0x31')][_0x7ee8('0x1f')]);_0xf54bb1['offset']=qs[_0x7ee8('0x1e')](_0x76beaa['query'][_0x7ee8('0x1e')]);}_0xf54bb1[_0x7ee8('0x39')]=qs[_0x7ee8('0x3a')](_0x76beaa[_0x7ee8('0x31')][_0x7ee8('0x3a')]);_0xf54bb1[_0x7ee8('0x3b')]=qs[_0x7ee8('0x3c')](_[_0x7ee8('0x3d')](_0x76beaa[_0x7ee8('0x31')],_0x33f20e[_0x7ee8('0x3c')]),_0x2034c5);if(_0x76beaa[_0x7ee8('0x31')][_0x7ee8('0x3e')]){_0xf54bb1[_0x7ee8('0x3b')]=_[_0x7ee8('0x3f')](_0xf54bb1['where'],{'$or':_['map'](_0x2034c5,function(_0x3442e7){if(_0x3442e7['type']!==_0x7ee8('0x40')){var _0x13be3e={};_0x13be3e[_0x3442e7[_0x7ee8('0x29')]]={'$like':'%'+_0x76beaa[_0x7ee8('0x31')][_0x7ee8('0x3e')]+'%'};return _0x13be3e;}})});}_0xf54bb1=_[_0x7ee8('0x3f')]({},_0xf54bb1,_0x76beaa[_0x7ee8('0x41')]);var _0x384d83={'where':_0xf54bb1[_0x7ee8('0x3b')]};return db[_0x7ee8('0x2c')][_0x7ee8('0x1d')](_0x384d83)[_0x7ee8('0x23')](function(_0x11f352){_0x5455d0[_0x7ee8('0x1d')]=_0x11f352;if(_0x76beaa[_0x7ee8('0x31')][_0x7ee8('0x42')]){_0xf54bb1[_0x7ee8('0x43')]=[{'all':!![]}];}return db[_0x7ee8('0x2c')][_0x7ee8('0x44')](_0xf54bb1);})[_0x7ee8('0x23')](function(_0x56ead5){_0x5455d0[_0x7ee8('0x45')]=_0x56ead5;return _0x5455d0;})[_0x7ee8('0x23')](respondWithFilteredResult(_0x547147,_0xf54bb1))['catch'](handleError(_0x547147,null));};exports[_0x7ee8('0x46')]=function(_0x29e866,_0x509838){var _0x12e9b0={'raw':!![],'where':{'id':_0x29e866['params']['id']}},_0x21c649={};_0x21c649[_0x7ee8('0x30')]=_['keys'](db['CmHopperAdditionalPhone']['rawAttributes']);_0x21c649['query']=_[_0x7ee8('0x32')](_0x29e866[_0x7ee8('0x31')]);_0x21c649['filters']=_[_0x7ee8('0x33')](_0x21c649[_0x7ee8('0x30')],_0x21c649[_0x7ee8('0x31')]);_0x12e9b0[_0x7ee8('0x34')]=_[_0x7ee8('0x33')](_0x21c649[_0x7ee8('0x30')],qs[_0x7ee8('0x35')](_0x29e866[_0x7ee8('0x31')]['fields']));_0x12e9b0[_0x7ee8('0x34')]=_0x12e9b0[_0x7ee8('0x34')]['length']?_0x12e9b0[_0x7ee8('0x34')]:_0x21c649['model'];if(_0x29e866['query'][_0x7ee8('0x42')]){_0x12e9b0['include']=[{'all':!![]}];}_0x12e9b0=_[_0x7ee8('0x3f')]({},_0x12e9b0,_0x29e866[_0x7ee8('0x41')]);return db[_0x7ee8('0x2c')]['find'](_0x12e9b0)[_0x7ee8('0x23')](handleEntityNotFound(_0x509838,null))['then'](respondWithResult(_0x509838,null))[_0x7ee8('0x47')](handleError(_0x509838,null));};exports[_0x7ee8('0x48')]=function(_0x4e1176,_0x3408a2){return db[_0x7ee8('0x2c')][_0x7ee8('0x48')](_0x4e1176[_0x7ee8('0x49')],{})['then'](function(_0x4f36d0){var _0x46e007=_0x4e1176[_0x7ee8('0x4a')]['get']({'plain':!![]});if(!_0x46e007)throw new Error(_0x7ee8('0x4b'));if(_0x46e007['role']==='user'){var _0x2f142d=_0x4f36d0[_0x7ee8('0x4c')]({'plain':!![]});var _0x2e43ac=_0x7ee8('0x25');return db[_0x7ee8('0x4d')][_0x7ee8('0x4e')]({'where':{'name':_0x2e43ac,'userProfileId':_0x46e007[_0x7ee8('0x4f')]},'raw':!![]})[_0x7ee8('0x23')](function(_0x419a16){if(_0x419a16&&_0x419a16[_0x7ee8('0x50')]===0x0){return db['UserProfileResource'][_0x7ee8('0x48')]({'name':_0x2f142d[_0x7ee8('0x29')],'resourceId':_0x2f142d['id'],'type':_0x419a16['name'],'sectionId':_0x419a16['id']},{})[_0x7ee8('0x23')](function(){return _0x4f36d0;});}else{return _0x4f36d0;}})[_0x7ee8('0x47')](function(_0x5d2e84){logger[_0x7ee8('0x27')](_0x7ee8('0x51'),_0x5d2e84);throw _0x5d2e84;});}return _0x4f36d0;})['then'](respondWithResult(_0x3408a2,0xc9))['catch'](handleError(_0x3408a2,null));};exports[_0x7ee8('0x52')]=function(_0x162216,_0x5b048d){if(_0x162216[_0x7ee8('0x49')]['id']){delete _0x162216[_0x7ee8('0x49')]['id'];}return db[_0x7ee8('0x2c')][_0x7ee8('0x4e')]({'where':{'id':_0x162216[_0x7ee8('0x53')]['id']}})[_0x7ee8('0x23')](handleEntityNotFound(_0x5b048d,null))[_0x7ee8('0x23')](saveUpdates(_0x162216['body'],null))[_0x7ee8('0x23')](respondWithResult(_0x5b048d,null))[_0x7ee8('0x47')](handleError(_0x5b048d,null));};exports[_0x7ee8('0x24')]=function(_0x45c7f6,_0x65d31b){return db[_0x7ee8('0x2c')][_0x7ee8('0x4e')]({'where':{'id':_0x45c7f6[_0x7ee8('0x53')]['id']}})[_0x7ee8('0x23')](handleEntityNotFound(_0x65d31b,null))[_0x7ee8('0x23')](removeEntity(_0x65d31b,null))[_0x7ee8('0x47')](handleError(_0x65d31b,null));}; \ No newline at end of file +var _0x6d19=['filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','params','include','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','CmHopperAdditionalPhones','destroy','error','stack','name','send','index','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','map','query','keys'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x6d19,0x160));var _0x96d1=function(_0x34ad72,_0x1e43f6){_0x34ad72=_0x34ad72-0x0;var _0x5c9aa8=_0x6d19[_0x34ad72];return _0x5c9aa8;};'use strict';var pdf=require(_0x96d1('0x0'));var emlformat=require(_0x96d1('0x1'));var rimraf=require(_0x96d1('0x2'));var zipdir=require(_0x96d1('0x3'));var jsonpatch=require(_0x96d1('0x4'));var rp=require(_0x96d1('0x5'));var moment=require(_0x96d1('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x96d1('0x7'));var util=require(_0x96d1('0x8'));var path=require(_0x96d1('0x9'));var sox=require(_0x96d1('0xa'));var csv=require('to-csv');var ejs=require(_0x96d1('0xb'));var fs=require('fs');var _=require(_0x96d1('0xc'));var squel=require(_0x96d1('0xd'));var crypto=require('crypto');var jsforce=require(_0x96d1('0xe'));var deskjs=require(_0x96d1('0xf'));var toCsv=require(_0x96d1('0x10'));var querystring=require(_0x96d1('0x11'));var Papa=require(_0x96d1('0x12'));var Redis=require(_0x96d1('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x96d1('0x14'));var hardwareService=require(_0x96d1('0x15'));var logger=require('../../config/logger')(_0x96d1('0x16'));var utils=require('../../config/utils');var config=require(_0x96d1('0x17'));var licenseUtil=require(_0x96d1('0x18'));var db=require(_0x96d1('0x19'))['db'];function respondWithStatusCode(_0xb019fb,_0x46905e){_0x46905e=_0x46905e||0xcc;return function(_0x673a11){if(_0x673a11){return _0xb019fb['sendStatus'](_0x46905e);}return _0xb019fb[_0x96d1('0x1a')](_0x46905e)[_0x96d1('0x1b')]();};}function respondWithResult(_0x10e057,_0xdcf1fc){_0xdcf1fc=_0xdcf1fc||0xc8;return function(_0x2fd5c6){if(_0x2fd5c6){return _0x10e057['status'](_0xdcf1fc)['json'](_0x2fd5c6);}};}function respondWithFilteredResult(_0x2e4cf5,_0x446023){return function(_0x21d7a4){if(_0x21d7a4){var _0x9eb2c4=_0x21d7a4[_0x96d1('0x1c')],_0x2d521d=_0x446023[_0x96d1('0x1d')],_0x3e9a0=_0x446023['offset']+_0x446023[_0x96d1('0x1e')],_0x45dc6f;if(_0x3e9a0>=_0x9eb2c4){_0x3e9a0=_0x9eb2c4;_0x45dc6f=0xc8;}else{_0x45dc6f=0xce;}_0x2e4cf5[_0x96d1('0x1a')](_0x45dc6f);return _0x2e4cf5[_0x96d1('0x1f')](_0x96d1('0x20'),_0x2d521d+'-'+_0x3e9a0+'/'+_0x9eb2c4)[_0x96d1('0x21')](_0x21d7a4);}return null;};}function patchUpdates(_0x4ae4c5){return function(_0x3c605a){try{jsonpatch[_0x96d1('0x22')](_0x3c605a,_0x4ae4c5,!![]);}catch(_0x28b2aa){return BPromise[_0x96d1('0x23')](_0x28b2aa);}return _0x3c605a['save']();};}function saveUpdates(_0x17e281,_0x11a666){return function(_0x292bf8){if(_0x292bf8){return _0x292bf8[_0x96d1('0x24')](_0x17e281)['then'](function(_0x339ce1){return _0x339ce1;});}return null;};}function removeEntity(_0x3393ec,_0x186bae){return function(_0x1390ac){if(_0x1390ac){return _0x1390ac['destroy']()[_0x96d1('0x25')](function(){var _0x38f350=_0x1390ac['get']({'plain':!![]});var _0x14334a=_0x96d1('0x26');return db['UserProfileResource'][_0x96d1('0x27')]({'where':{'type':_0x14334a,'resourceId':_0x38f350['id']}})[_0x96d1('0x25')](function(){return _0x1390ac;});})[_0x96d1('0x25')](function(){_0x3393ec['status'](0xcc)[_0x96d1('0x1b')]();});}};}function handleEntityNotFound(_0x46aa64,_0x7e7006){return function(_0x56be7f){if(!_0x56be7f){_0x46aa64['sendStatus'](0x194);}return _0x56be7f;};}function handleError(_0xd88eb7,_0x510a23){_0x510a23=_0x510a23||0x1f4;return function(_0x3728c8){logger[_0x96d1('0x28')](_0x3728c8[_0x96d1('0x29')]);if(_0x3728c8[_0x96d1('0x2a')]){delete _0x3728c8[_0x96d1('0x2a')];}_0xd88eb7['status'](_0x510a23)[_0x96d1('0x2b')](_0x3728c8);};}exports[_0x96d1('0x2c')]=function(_0x433b36,_0x443f9c){var _0x5a83e6={},_0x1b767b={},_0x3ea4e5={'count':0x0,'rows':[]};var _0x5c0952=_['map'](db[_0x96d1('0x2d')][_0x96d1('0x2e')],function(_0x3968f5){return{'name':_0x3968f5[_0x96d1('0x2f')],'type':_0x3968f5[_0x96d1('0x30')][_0x96d1('0x31')]};});_0x1b767b['model']=_[_0x96d1('0x32')](_0x5c0952,_0x96d1('0x2a'));_0x1b767b[_0x96d1('0x33')]=_[_0x96d1('0x34')](_0x433b36[_0x96d1('0x33')]);_0x1b767b[_0x96d1('0x35')]=_['intersection'](_0x1b767b[_0x96d1('0x36')],_0x1b767b[_0x96d1('0x33')]);_0x5a83e6[_0x96d1('0x37')]=_[_0x96d1('0x38')](_0x1b767b[_0x96d1('0x36')],qs[_0x96d1('0x39')](_0x433b36['query'][_0x96d1('0x39')]));_0x5a83e6['attributes']=_0x5a83e6['attributes']['length']?_0x5a83e6[_0x96d1('0x37')]:_0x1b767b[_0x96d1('0x36')];if(!_0x433b36[_0x96d1('0x33')][_0x96d1('0x3a')](_0x96d1('0x3b'))){_0x5a83e6['limit']=qs[_0x96d1('0x1e')](_0x433b36[_0x96d1('0x33')][_0x96d1('0x1e')]);_0x5a83e6[_0x96d1('0x1d')]=qs[_0x96d1('0x1d')](_0x433b36[_0x96d1('0x33')]['offset']);}_0x5a83e6[_0x96d1('0x3c')]=qs[_0x96d1('0x3d')](_0x433b36[_0x96d1('0x33')][_0x96d1('0x3d')]);_0x5a83e6[_0x96d1('0x3e')]=qs[_0x96d1('0x35')](_[_0x96d1('0x3f')](_0x433b36['query'],_0x1b767b['filters']),_0x5c0952);if(_0x433b36[_0x96d1('0x33')][_0x96d1('0x40')]){_0x5a83e6[_0x96d1('0x3e')]=_[_0x96d1('0x41')](_0x5a83e6[_0x96d1('0x3e')],{'$or':_['map'](_0x5c0952,function(_0x32e34b){if(_0x32e34b[_0x96d1('0x30')]!=='VIRTUAL'){var _0x34cb10={};_0x34cb10[_0x32e34b[_0x96d1('0x2a')]]={'$like':'%'+_0x433b36[_0x96d1('0x33')][_0x96d1('0x40')]+'%'};return _0x34cb10;}})});}_0x5a83e6=_['merge']({},_0x5a83e6,_0x433b36[_0x96d1('0x42')]);var _0x54054d={'where':_0x5a83e6['where']};return db[_0x96d1('0x2d')][_0x96d1('0x1c')](_0x54054d)['then'](function(_0x5c2cce){_0x3ea4e5[_0x96d1('0x1c')]=_0x5c2cce;if(_0x433b36['query'][_0x96d1('0x43')]){_0x5a83e6['include']=[{'all':!![]}];}return db[_0x96d1('0x2d')]['findAll'](_0x5a83e6);})[_0x96d1('0x25')](function(_0x52380e){_0x3ea4e5['rows']=_0x52380e;return _0x3ea4e5;})[_0x96d1('0x25')](respondWithFilteredResult(_0x443f9c,_0x5a83e6))['catch'](handleError(_0x443f9c,null));};exports['show']=function(_0x1244ed,_0x1f7dde){var _0x3940e7={'raw':!![],'where':{'id':_0x1244ed[_0x96d1('0x44')]['id']}},_0x12641a={};_0x12641a['model']=_['keys'](db['CmHopperAdditionalPhone'][_0x96d1('0x2e')]);_0x12641a[_0x96d1('0x33')]=_[_0x96d1('0x34')](_0x1244ed[_0x96d1('0x33')]);_0x12641a[_0x96d1('0x35')]=_[_0x96d1('0x38')](_0x12641a['model'],_0x12641a['query']);_0x3940e7[_0x96d1('0x37')]=_[_0x96d1('0x38')](_0x12641a[_0x96d1('0x36')],qs[_0x96d1('0x39')](_0x1244ed[_0x96d1('0x33')][_0x96d1('0x39')]));_0x3940e7[_0x96d1('0x37')]=_0x3940e7[_0x96d1('0x37')]['length']?_0x3940e7['attributes']:_0x12641a[_0x96d1('0x36')];if(_0x1244ed[_0x96d1('0x33')]['includeAll']){_0x3940e7[_0x96d1('0x45')]=[{'all':!![]}];}_0x3940e7=_['merge']({},_0x3940e7,_0x1244ed[_0x96d1('0x42')]);return db[_0x96d1('0x2d')][_0x96d1('0x46')](_0x3940e7)[_0x96d1('0x25')](handleEntityNotFound(_0x1f7dde,null))[_0x96d1('0x25')](respondWithResult(_0x1f7dde,null))[_0x96d1('0x47')](handleError(_0x1f7dde,null));};exports['create']=function(_0xa1bd8d,_0x1fe871){return db['CmHopperAdditionalPhone'][_0x96d1('0x48')](_0xa1bd8d[_0x96d1('0x49')],{})[_0x96d1('0x25')](function(_0x39e32b){var _0x33970f=_0xa1bd8d[_0x96d1('0x4a')][_0x96d1('0x4b')]({'plain':!![]});if(!_0x33970f)throw new Error(_0x96d1('0x4c'));if(_0x33970f[_0x96d1('0x4d')]===_0x96d1('0x4a')){var _0x3d9097=_0x39e32b[_0x96d1('0x4b')]({'plain':!![]});var _0x2451b7=_0x96d1('0x26');return db['UserProfileSection'][_0x96d1('0x46')]({'where':{'name':_0x2451b7,'userProfileId':_0x33970f[_0x96d1('0x4e')]},'raw':!![]})[_0x96d1('0x25')](function(_0xcda23d){if(_0xcda23d&&_0xcda23d[_0x96d1('0x4f')]===0x0){return db[_0x96d1('0x50')]['create']({'name':_0x3d9097[_0x96d1('0x2a')],'resourceId':_0x3d9097['id'],'type':_0xcda23d[_0x96d1('0x2a')],'sectionId':_0xcda23d['id']},{})['then'](function(){return _0x39e32b;});}else{return _0x39e32b;}})[_0x96d1('0x47')](function(_0x1cbd18){logger[_0x96d1('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1cbd18);throw _0x1cbd18;});}return _0x39e32b;})[_0x96d1('0x25')](respondWithResult(_0x1fe871,0xc9))['catch'](handleError(_0x1fe871,null));};exports[_0x96d1('0x24')]=function(_0x50e1be,_0x2eebee){if(_0x50e1be[_0x96d1('0x49')]['id']){delete _0x50e1be[_0x96d1('0x49')]['id'];}return db[_0x96d1('0x2d')][_0x96d1('0x46')]({'where':{'id':_0x50e1be['params']['id']}})[_0x96d1('0x25')](handleEntityNotFound(_0x2eebee,null))[_0x96d1('0x25')](saveUpdates(_0x50e1be[_0x96d1('0x49')],null))['then'](respondWithResult(_0x2eebee,null))[_0x96d1('0x47')](handleError(_0x2eebee,null));};exports[_0x96d1('0x27')]=function(_0x4b0898,_0x5c401a){return db[_0x96d1('0x2d')][_0x96d1('0x46')]({'where':{'id':_0x4b0898[_0x96d1('0x44')]['id']}})['then'](handleEntityNotFound(_0x5c401a,null))[_0x96d1('0x25')](removeEntity(_0x5c401a,null))['catch'](handleError(_0x5c401a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index b0a70b7..2a10949 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 _0x6951=['../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x429c17,_0xd89574){var _0x54454f=function(_0x1fa64d){while(--_0x1fa64d){_0x429c17['push'](_0x429c17['shift']());}};_0x54454f(++_0xd89574);}(_0x6951,0x124));var _0x1695=function(_0x1376e9,_0x19f5db){_0x1376e9=_0x1376e9-0x0;var _0x3db89a=_0x6951[_0x1376e9];return _0x3db89a;};'use strict';var _=require(_0x1695('0x0'));var util=require(_0x1695('0x1'));var logger=require(_0x1695('0x2'))('api');var moment=require(_0x1695('0x3'));var BPromise=require('bluebird');var rp=require(_0x1695('0x4'));var fs=require('fs');var path=require(_0x1695('0x5'));var rimraf=require(_0x1695('0x6'));var config=require(_0x1695('0x7'));var attributes=require(_0x1695('0x8'));module[_0x1695('0x9')]=function(_0x215be3,_0x1cbbed){return _0x215be3[_0x1695('0xa')](_0x1695('0xb'),attributes,{'tableName':_0x1695('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf6c=['./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x41d9cf,_0x5458ea){var _0x553cdf=function(_0x38093a){while(--_0x38093a){_0x41d9cf['push'](_0x41d9cf['shift']());}};_0x553cdf(++_0x5458ea);}(_0xdf6c,0x89));var _0xcdf6=function(_0x938a6,_0x38fad5){_0x938a6=_0x938a6-0x0;var _0x2500e7=_0xdf6c[_0x938a6];return _0x2500e7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcdf6('0x0'))('api');var moment=require('moment');var BPromise=require(_0xcdf6('0x1'));var rp=require(_0xcdf6('0x2'));var fs=require('fs');var path=require(_0xcdf6('0x3'));var rimraf=require(_0xcdf6('0x4'));var config=require(_0xcdf6('0x5'));var attributes=require(_0xcdf6('0x6'));module[_0xcdf6('0x7')]=function(_0x4fb6b3,_0x16a658){return _0x4fb6b3[_0xcdf6('0x8')](_0xcdf6('0x9'),attributes,{'tableName':_0xcdf6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 594fad6..a094c15 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 _0xfd32=['../../config/environment','client','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VerifyAdditionalPhones','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','phone','countnoanswerretry','createdAt','updatedAt','isNil','additionalToHop','sequelize','transaction','update','CmHopper','IncrementPreviewCounters','field','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc'];(function(_0x2a1076,_0xe55349){var _0x59ce38=function(_0x1c5e72){while(--_0x1c5e72){_0x2a1076['push'](_0x2a1076['shift']());}};_0x59ce38(++_0xe55349);}(_0xfd32,0xd9));var _0x2fd3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd32[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2fd3('0x0'));var util=require(_0x2fd3('0x1'));var moment=require(_0x2fd3('0x2'));var BPromise=require(_0x2fd3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2fd3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2fd3('0x5'))(_0x2fd3('0x6'));var config=require(_0x2fd3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2fd3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46853f,_0x4ae05b,_0x1fdb4d){return new BPromise(function(_0x4611b5,_0x35d36e){return client['request'](_0x46853f,_0x1fdb4d)[_0x2fd3('0x9')](function(_0x439f3d){logger[_0x2fd3('0xa')](_0x2fd3('0xb'),_0x4ae05b,_0x2fd3('0xc'));logger['debug'](_0x2fd3('0xd'),_0x4ae05b,_0x2fd3('0xc'),JSON[_0x2fd3('0xe')](_0x439f3d));if(_0x439f3d[_0x2fd3('0xf')]){if(_0x439f3d['error'][_0x2fd3('0x10')]===0x1f4){logger['error'](_0x2fd3('0xb'),_0x4ae05b,_0x439f3d[_0x2fd3('0xf')][_0x2fd3('0x11')]);return _0x35d36e(_0x439f3d[_0x2fd3('0xf')][_0x2fd3('0x11')]);}logger[_0x2fd3('0xf')](_0x2fd3('0xb'),_0x4ae05b,_0x439f3d[_0x2fd3('0xf')]['message']);return _0x4611b5(_0x439f3d[_0x2fd3('0xf')][_0x2fd3('0x11')]);}else{logger[_0x2fd3('0xa')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4ae05b,_0x2fd3('0xc'));_0x4611b5(_0x439f3d['result']['message']);}})[_0x2fd3('0x12')](function(_0x48777a){logger[_0x2fd3('0xf')](_0x2fd3('0xb'),_0x4ae05b,_0x48777a);_0x35d36e(_0x48777a);});});}exports[_0x2fd3('0x13')]=function(_0x5739f6){var _0x5bf94b=this;return new Promise(function(_0x31f6f2,_0x448561){return db['CmHopper'][_0x2fd3('0x14')]({'raw':!![],'where':{'ContactId':_0x5739f6[_0x2fd3('0x15')][_0x2fd3('0x16')],'ListId':_0x5739f6[_0x2fd3('0x15')][_0x2fd3('0x17')],'VoiceQueueId':_0x5739f6[_0x2fd3('0x15')]['VoiceQueueId']===undefined?null:_0x5739f6[_0x2fd3('0x15')][_0x2fd3('0x18')],'CampaignId':_0x5739f6[_0x2fd3('0x15')]['CampaignId']===undefined?null:_0x5739f6[_0x2fd3('0x15')][_0x2fd3('0x19')]}})[_0x2fd3('0x9')](function(_0x425401){if(_0x425401!=null){return db[_0x2fd3('0x1a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x425401['id'],'OrderBy':{'$gt':_0x425401[_0x2fd3('0x1b')]}},'order':[['OrderBy',_0x2fd3('0x1c')]]})[_0x2fd3('0x9')](function(_0x2f10e1){var _0xb1eaef=0x0;if(_0x2f10e1){if(_0x2f10e1[_0x2fd3('0x1d')]+_0x2f10e1[_0x2fd3('0x1e')]+_0x2f10e1['countnoanswerretry']+_0x2f10e1[_0x2fd3('0x1f')]+_0x2f10e1[_0x2fd3('0x20')]+_0x2f10e1[_0x2fd3('0x21')]+_0x2f10e1[_0x2fd3('0x22')]+_0x2f10e1[_0x2fd3('0x23')]<_0x5739f6[_0x2fd3('0x24')][_0x2fd3('0x25')])_0xb1eaef=0x1;_0x31f6f2({'additional':_0xb1eaef});}else{return db[_0x2fd3('0x1a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x425401['id']},'order':[[_0x2fd3('0x1b'),_0x2fd3('0x1c')]]})[_0x2fd3('0x9')](function(_0x305a83){var _0x16893d=0x0;if(_0x305a83){if(_0x305a83[_0x2fd3('0x1d')]+_0x305a83['countcongestionretry']+_0x305a83['countnoanswerretry']+_0x305a83['countnosuchnumberretry']+_0x305a83[_0x2fd3('0x20')]+_0x305a83[_0x2fd3('0x21')]+_0x305a83[_0x2fd3('0x22')]+_0x305a83[_0x2fd3('0x23')]<_0x5739f6[_0x2fd3('0x24')][_0x2fd3('0x25')])_0x16893d=0x1;_0x31f6f2({'additional':_0x16893d});}else{_0x31f6f2({'additional':0x0});}})['catch'](function(_0x28ca9d){logger[_0x2fd3('0xf')](_0x2fd3('0x13'),_0x28ca9d[_0x2fd3('0x11')],_0x5739f6);_0x448561(_0x5bf94b['error'](0x1f4,_0x28ca9d[_0x2fd3('0x11')]));});}})[_0x2fd3('0x12')](function(_0x2c35ae){logger[_0x2fd3('0xf')](_0x2fd3('0x13'),_0x2c35ae['message'],_0x5739f6);_0x448561(_0x5bf94b['error'](0x1f4,_0x2c35ae[_0x2fd3('0x11')]));});}else _0x31f6f2({'additional':0x0});});});};exports[_0x2fd3('0x26')]=function(_0x33c607){var _0x33ca56=this;return new Promise(function(_0x4df937,_0x23757f){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x33c607['body'][_0x2fd3('0x16')],'ListId':_0x33c607[_0x2fd3('0x15')]['ListId'],'VoiceQueueId':_0x33c607[_0x2fd3('0x15')]['VoiceQueueId']===undefined?null:_0x33c607[_0x2fd3('0x15')]['VoiceQueueId'],'CampaignId':_0x33c607[_0x2fd3('0x15')][_0x2fd3('0x19')]===undefined?null:_0x33c607['body']['CampaignId']}})[_0x2fd3('0x9')](function(_0xd3cf47){if(_0xd3cf47!=null){return db[_0x2fd3('0x1a')][_0x2fd3('0x14')]({'raw':!![],'where':{'CmHopperId':_0xd3cf47['id'],'OrderBy':{'$gt':_0xd3cf47[_0x2fd3('0x1b')]}},'order':[[_0x2fd3('0x1b'),_0x2fd3('0x1c')]]})[_0x2fd3('0x9')](function(_0x4e0fb7){if(_0x4e0fb7)return activateAdditionalPhone(_0xd3cf47,_0x33c607[_0x2fd3('0x15')],_0x4e0fb7,_0x33c607[_0x2fd3('0x27')],_0x33c607['waitTime'])['then'](function(_0x19b7ad){_0x4df937(_0x19b7ad);});else{return db[_0x2fd3('0x1a')][_0x2fd3('0x14')]({'raw':!![],'where':{'CmHopperId':_0xd3cf47['id']},'order':[[_0x2fd3('0x1b'),'ASC']]})[_0x2fd3('0x9')](function(_0x5e3076){if(_0x5e3076)return activateAdditionalPhone(_0xd3cf47,_0x33c607['body'],_0x5e3076,_0x33c607['duration'],_0x33c607[_0x2fd3('0x28')])['then'](function(_0x10b7a5){_0x4df937(_0x10b7a5);});else{_0x4df937({'id':_0xd3cf47['id'],'phone':''});}})[_0x2fd3('0x12')](function(_0xc73f2c){logger['error']('VerifyAdditionalPhones',_0xc73f2c['message'],_0x33c607);_0x23757f(_0x33ca56['error'](0x1f4,_0xc73f2c[_0x2fd3('0x11')]));});}})[_0x2fd3('0x12')](function(_0x5a9661){logger[_0x2fd3('0xf')](_0x2fd3('0x13'),_0x5a9661[_0x2fd3('0x11')],_0x33c607);_0x23757f(_0x33ca56[_0x2fd3('0xf')](0x1f4,_0x5a9661[_0x2fd3('0x11')]));});}else _0x4df937(0x1);});});};function activateAdditionalPhone(_0x469b0f,_0x242c8a,_0x20fdc3,_0x4257ce,_0x2352f8){return new Promise(function(_0x3f09a9,_0x233505){logger[_0x2fd3('0xa')](_0x2fd3('0x13'),_0x20fdc3);var _0x2181e9;if(moment()>moment(_0x20fdc3[_0x2fd3('0x29')])){_0x2181e9=moment()[_0x2fd3('0x2a')](_0x2352f8||0x3,_0x2fd3('0x2b'));}else{if(_0x20fdc3[_0x2fd3('0x1b')]==0x0){_0x2181e9=moment(_0x20fdc3['scheduledat']);}else{_0x2181e9=moment()['add'](_0x2352f8||0x3,'minutes');}}var _0xecf2d3={'phone':_0x469b0f[_0x2fd3('0x2c')],'active':0x0,'OrderBy':_['isNil'](_0x469b0f[_0x2fd3('0x1b')])?0x0:_0x469b0f['OrderBy'],'scheduledat':moment()[_0x2fd3('0x2a')](_0x4257ce||0x1,_0x2fd3('0x2b')),'countbusyretry':_0x242c8a['countbusyretry'],'countcongestionretry':_0x242c8a[_0x2fd3('0x1e')],'countnoanswerretry':_0x242c8a[_0x2fd3('0x2d')],'countnosuchnumberretry':_0x242c8a[_0x2fd3('0x1f')],'countdropretry':_0x242c8a[_0x2fd3('0x20')],'countabandonedretry':_0x242c8a[_0x2fd3('0x21')],'countmachineretry':_0x242c8a[_0x2fd3('0x22')],'countagentrejectretry':_0x242c8a[_0x2fd3('0x23')],'createdAt':_0x242c8a[_0x2fd3('0x2e')],'updatedAt':_0x242c8a[_0x2fd3('0x2f')]};var _0x5f1a46={'CmHopperId':_0x469b0f['id'],'phone':_0x20fdc3[_0x2fd3('0x2c')],'active':0x0,'OrderBy':_[_0x2fd3('0x30')](_0x20fdc3[_0x2fd3('0x1b')])?0x0:_0x20fdc3[_0x2fd3('0x1b')],'scheduledat':_0x2181e9,'countbusyretry':_0x20fdc3[_0x2fd3('0x1d')],'countcongestionretry':_0x20fdc3[_0x2fd3('0x1e')],'countnoanswerretry':_0x20fdc3[_0x2fd3('0x2d')],'countnosuchnumberretry':_0x242c8a['countnosuchnumberretry'],'countdropretry':_0x242c8a[_0x2fd3('0x20')],'countabandonedretry':_0x242c8a['countabandonedretry'],'countmachineretry':_0x242c8a['countmachineretry'],'countagentrejectretry':_0x242c8a[_0x2fd3('0x23')],'createdAt':_0x20fdc3[_0x2fd3('0x2e')],'updatedAt':_0x20fdc3[_0x2fd3('0x2f')]};logger[_0x2fd3('0xa')]('hopperToAdd',_0xecf2d3);logger[_0x2fd3('0xa')](_0x2fd3('0x31'),_0x5f1a46);return db[_0x2fd3('0x32')][_0x2fd3('0x33')](function(_0x3b0dab){return db[_0x2fd3('0x1a')][_0x2fd3('0x34')](_0xecf2d3,{'where':{'id':_0x20fdc3['id']}},{'transaction':_0x3b0dab})['then'](function(){return db[_0x2fd3('0x35')][_0x2fd3('0x34')](_0x5f1a46,{'where':{'id':_0x469b0f['id']}},{'transaction':_0x3b0dab});});})['then'](function(_0x4af106){_0x3f09a9({'id':_0x469b0f['id'],'phone':_0x20fdc3[_0x2fd3('0x2c')]});})[_0x2fd3('0x12')](function(_0x50c0a9){logger[_0x2fd3('0xf')]('VerifyAdditionalPhones',_0x50c0a9['message'],req);_0x233505(_this['error'](0x1f4,_0x50c0a9[_0x2fd3('0x11')]));});});}exports[_0x2fd3('0x36')]=function(_0x559d52){var _0x5d60f5=this;return new Promise(function(_0x346762,_0x22e5b9){return db[_0x2fd3('0x35')][_0x2fd3('0x34')](_0x559d52[_0x2fd3('0x15')][_0x2fd3('0x37')],{'where':{'id':_0x559d52[_0x2fd3('0x15')]['id']}})[_0x2fd3('0x9')](function(_0x31da49){_0x346762(_0x31da49);})[_0x2fd3('0x12')](function(_0x21f8d7){logger[_0x2fd3('0xf')](_0x2fd3('0x36'),_0x21f8d7['message'],_0x559d52);_0x22e5b9(_0x5d60f5[_0x2fd3('0xf')](0x1f4,_0x21f8d7['message']));});});}; \ No newline at end of file +var _0x9363=['body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','findOne','OrderBy','ASC','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','entity','dialGlobalMaxRetry','countcongestionretry','countabandonedretry','countmachineretry','countagentrejectretry','SwapAdditionalPhones','duration','waitTime','scheduledat','minutes','phone','isNil','add','createdAt','updatedAt','additionalToHop','transaction','update','field','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','VerifyAdditionalPhones','CmHopper'];(function(_0x252b5d,_0x127067){var _0x2b05f8=function(_0x51e44d){while(--_0x51e44d){_0x252b5d['push'](_0x252b5d['shift']());}};_0x2b05f8(++_0x127067);}(_0x9363,0x105));var _0x3936=function(_0x2bd1ec,_0x3fe65f){_0x2bd1ec=_0x2bd1ec-0x0;var _0x2f7577=_0x9363[_0x2bd1ec];return _0x2f7577;};'use strict';var _=require(_0x3936('0x0'));var util=require(_0x3936('0x1'));var moment=require(_0x3936('0x2'));var BPromise=require(_0x3936('0x3'));var rs=require(_0x3936('0x4'));var fs=require('fs');var Redis=require(_0x3936('0x5'));var db=require(_0x3936('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3936('0x7'))(_0x3936('0x8'));var config=require('../../config/environment');var jayson=require(_0x3936('0x9'));var client=jayson['client'][_0x3936('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x221bba,_0x5419b3,_0x1641b2){return new BPromise(function(_0x2f9d32,_0x4a2ba6){return client[_0x3936('0xb')](_0x221bba,_0x1641b2)[_0x3936('0xc')](function(_0x103ea1){logger[_0x3936('0xd')](_0x3936('0xe'),_0x5419b3,_0x3936('0xf'));logger['debug'](_0x3936('0x10'),_0x5419b3,_0x3936('0xf'),JSON[_0x3936('0x11')](_0x103ea1));if(_0x103ea1['error']){if(_0x103ea1['error'][_0x3936('0x12')]===0x1f4){logger[_0x3936('0x13')](_0x3936('0xe'),_0x5419b3,_0x103ea1['error'][_0x3936('0x14')]);return _0x4a2ba6(_0x103ea1['error'][_0x3936('0x14')]);}logger[_0x3936('0x13')](_0x3936('0xe'),_0x5419b3,_0x103ea1[_0x3936('0x13')][_0x3936('0x14')]);return _0x2f9d32(_0x103ea1['error']['message']);}else{logger['info'](_0x3936('0xe'),_0x5419b3,'request\x20sent');_0x2f9d32(_0x103ea1['result'][_0x3936('0x14')]);}})[_0x3936('0x15')](function(_0x1b0725){logger[_0x3936('0x13')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5419b3,_0x1b0725);_0x4a2ba6(_0x1b0725);});});}exports[_0x3936('0x16')]=function(_0x455269){var _0x32b3ca=this;return new Promise(function(_0x2329c9,_0x3d487f){return db[_0x3936('0x17')]['findOne']({'raw':!![],'where':{'ContactId':_0x455269[_0x3936('0x18')][_0x3936('0x19')],'ListId':_0x455269['body'][_0x3936('0x1a')],'VoiceQueueId':_0x455269['body']['VoiceQueueId']===undefined?null:_0x455269[_0x3936('0x18')][_0x3936('0x1b')],'CampaignId':_0x455269[_0x3936('0x18')]['CampaignId']===undefined?null:_0x455269[_0x3936('0x18')][_0x3936('0x1c')]}})[_0x3936('0xc')](function(_0x4eb278){if(_0x4eb278!=null){return db[_0x3936('0x1d')][_0x3936('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x4eb278['id'],'OrderBy':{'$gt':_0x4eb278[_0x3936('0x1f')]}},'order':[[_0x3936('0x1f'),_0x3936('0x20')]]})[_0x3936('0xc')](function(_0x36bbee){var _0x48ea22=0x0;if(_0x36bbee){if(_0x36bbee[_0x3936('0x21')]+_0x36bbee['countcongestionretry']+_0x36bbee[_0x3936('0x22')]+_0x36bbee[_0x3936('0x23')]+_0x36bbee[_0x3936('0x24')]+_0x36bbee['countabandonedretry']+_0x36bbee['countmachineretry']+_0x36bbee['countagentrejectretry']<_0x455269[_0x3936('0x25')][_0x3936('0x26')])_0x48ea22=0x1;_0x2329c9({'additional':_0x48ea22});}else{return db[_0x3936('0x1d')][_0x3936('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x4eb278['id']},'order':[[_0x3936('0x1f'),_0x3936('0x20')]]})[_0x3936('0xc')](function(_0x26df53){var _0x26615a=0x0;if(_0x26df53){if(_0x26df53[_0x3936('0x21')]+_0x26df53[_0x3936('0x27')]+_0x26df53[_0x3936('0x22')]+_0x26df53['countnosuchnumberretry']+_0x26df53[_0x3936('0x24')]+_0x26df53[_0x3936('0x28')]+_0x26df53[_0x3936('0x29')]+_0x26df53[_0x3936('0x2a')]<_0x455269['entity']['dialGlobalMaxRetry'])_0x26615a=0x1;_0x2329c9({'additional':_0x26615a});}else{_0x2329c9({'additional':0x0});}})[_0x3936('0x15')](function(_0x461cd1){logger[_0x3936('0x13')](_0x3936('0x16'),_0x461cd1[_0x3936('0x14')],_0x455269);_0x3d487f(_0x32b3ca[_0x3936('0x13')](0x1f4,_0x461cd1[_0x3936('0x14')]));});}})[_0x3936('0x15')](function(_0x18647a){logger[_0x3936('0x13')]('VerifyAdditionalPhones',_0x18647a[_0x3936('0x14')],_0x455269);_0x3d487f(_0x32b3ca[_0x3936('0x13')](0x1f4,_0x18647a[_0x3936('0x14')]));});}else _0x2329c9({'additional':0x0});});});};exports[_0x3936('0x2b')]=function(_0x2c2324){var _0x44a171=this;return new Promise(function(_0x3f7112,_0x3d7b2a){return db[_0x3936('0x17')][_0x3936('0x1e')]({'raw':!![],'where':{'ContactId':_0x2c2324['body']['ContactId'],'ListId':_0x2c2324['body'][_0x3936('0x1a')],'VoiceQueueId':_0x2c2324[_0x3936('0x18')]['VoiceQueueId']===undefined?null:_0x2c2324[_0x3936('0x18')][_0x3936('0x1b')],'CampaignId':_0x2c2324[_0x3936('0x18')]['CampaignId']===undefined?null:_0x2c2324[_0x3936('0x18')]['CampaignId']}})[_0x3936('0xc')](function(_0x4c1750){if(_0x4c1750!=null){return db[_0x3936('0x1d')][_0x3936('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x4c1750['id'],'OrderBy':{'$gt':_0x4c1750[_0x3936('0x1f')]}},'order':[[_0x3936('0x1f'),_0x3936('0x20')]]})[_0x3936('0xc')](function(_0x2cc847){if(_0x2cc847)return activateAdditionalPhone(_0x4c1750,_0x2c2324['body'],_0x2cc847,_0x2c2324[_0x3936('0x2c')],_0x2c2324['waitTime'])[_0x3936('0xc')](function(_0x1dff24){_0x3f7112(_0x1dff24);});else{return db[_0x3936('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x4c1750['id']},'order':[[_0x3936('0x1f'),_0x3936('0x20')]]})['then'](function(_0x7b8278){if(_0x7b8278)return activateAdditionalPhone(_0x4c1750,_0x2c2324['body'],_0x7b8278,_0x2c2324['duration'],_0x2c2324[_0x3936('0x2d')])['then'](function(_0x4dfb92){_0x3f7112(_0x4dfb92);});else{_0x3f7112({'id':_0x4c1750['id'],'phone':''});}})[_0x3936('0x15')](function(_0x1880e1){logger['error'](_0x3936('0x16'),_0x1880e1[_0x3936('0x14')],_0x2c2324);_0x3d7b2a(_0x44a171[_0x3936('0x13')](0x1f4,_0x1880e1['message']));});}})['catch'](function(_0x4f2761){logger[_0x3936('0x13')]('VerifyAdditionalPhones',_0x4f2761[_0x3936('0x14')],_0x2c2324);_0x3d7b2a(_0x44a171['error'](0x1f4,_0x4f2761[_0x3936('0x14')]));});}else _0x3f7112(0x1);});});};function activateAdditionalPhone(_0x780a9b,_0x1bb61d,_0x13dce9,_0x1a5d1e,_0x3ce7cb){return new Promise(function(_0x1bacd8,_0x4ae5c8){logger[_0x3936('0xd')](_0x3936('0x16'),_0x13dce9);var _0x3c18a2;if(moment()>moment(_0x13dce9[_0x3936('0x2e')])){_0x3c18a2=moment()['add'](_0x3ce7cb||0x3,_0x3936('0x2f'));}else{if(_0x13dce9[_0x3936('0x1f')]==0x0){_0x3c18a2=moment(_0x13dce9[_0x3936('0x2e')]);}else{_0x3c18a2=moment()['add'](_0x3ce7cb||0x3,'minutes');}}var _0x1a2079={'phone':_0x780a9b[_0x3936('0x30')],'active':0x0,'OrderBy':_[_0x3936('0x31')](_0x780a9b['OrderBy'])?0x0:_0x780a9b['OrderBy'],'scheduledat':moment()[_0x3936('0x32')](_0x1a5d1e||0x1,_0x3936('0x2f')),'countbusyretry':_0x1bb61d['countbusyretry'],'countcongestionretry':_0x1bb61d[_0x3936('0x27')],'countnoanswerretry':_0x1bb61d['countnoanswerretry'],'countnosuchnumberretry':_0x1bb61d[_0x3936('0x23')],'countdropretry':_0x1bb61d['countdropretry'],'countabandonedretry':_0x1bb61d[_0x3936('0x28')],'countmachineretry':_0x1bb61d[_0x3936('0x29')],'countagentrejectretry':_0x1bb61d[_0x3936('0x2a')],'createdAt':_0x1bb61d[_0x3936('0x33')],'updatedAt':_0x1bb61d[_0x3936('0x34')]};var _0x18ed54={'CmHopperId':_0x780a9b['id'],'phone':_0x13dce9[_0x3936('0x30')],'active':0x0,'OrderBy':_[_0x3936('0x31')](_0x13dce9['OrderBy'])?0x0:_0x13dce9[_0x3936('0x1f')],'scheduledat':_0x3c18a2,'countbusyretry':_0x13dce9[_0x3936('0x21')],'countcongestionretry':_0x13dce9[_0x3936('0x27')],'countnoanswerretry':_0x13dce9['countnoanswerretry'],'countnosuchnumberretry':_0x1bb61d[_0x3936('0x23')],'countdropretry':_0x1bb61d[_0x3936('0x24')],'countabandonedretry':_0x1bb61d[_0x3936('0x28')],'countmachineretry':_0x1bb61d[_0x3936('0x29')],'countagentrejectretry':_0x1bb61d['countagentrejectretry'],'createdAt':_0x13dce9['createdAt'],'updatedAt':_0x13dce9[_0x3936('0x34')]};logger['info']('hopperToAdd',_0x1a2079);logger[_0x3936('0xd')](_0x3936('0x35'),_0x18ed54);return db['sequelize'][_0x3936('0x36')](function(_0x1adb46){return db['CmHopperAdditionalPhone']['update'](_0x1a2079,{'where':{'id':_0x13dce9['id']}},{'transaction':_0x1adb46})[_0x3936('0xc')](function(){return db[_0x3936('0x17')]['update'](_0x18ed54,{'where':{'id':_0x780a9b['id']}},{'transaction':_0x1adb46});});})['then'](function(_0x37244d){_0x1bacd8({'id':_0x780a9b['id'],'phone':_0x13dce9[_0x3936('0x30')]});})[_0x3936('0x15')](function(_0x3ab73f){logger[_0x3936('0x13')](_0x3936('0x16'),_0x3ab73f[_0x3936('0x14')],req);_0x4ae5c8(_this[_0x3936('0x13')](0x1f4,_0x3ab73f[_0x3936('0x14')]));});});}exports['IncrementPreviewCounters']=function(_0x202691){var _0x52412e=this;return new Promise(function(_0x3a1ab2,_0x516a0b){return db[_0x3936('0x17')][_0x3936('0x37')](_0x202691[_0x3936('0x18')][_0x3936('0x38')],{'where':{'id':_0x202691[_0x3936('0x18')]['id']}})[_0x3936('0xc')](function(_0x246134){_0x3a1ab2(_0x246134);})['catch'](function(_0x4756c9){logger[_0x3936('0x13')]('IncrementPreviewCounters',_0x4756c9[_0x3936('0x14')],_0x202691);_0x516a0b(_0x52412e[_0x3936('0x13')](0x1f4,_0x4756c9[_0x3936('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 52f8309..1353efd 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 _0xb910=['get','index','/:id','isAuthenticated','post','create','put','update','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopperAdditionalPhone.controller'];(function(_0x55de0e,_0x225c8b){var _0x2faa2f=function(_0x2708da){while(--_0x2708da){_0x55de0e['push'](_0x55de0e['shift']());}};_0x2faa2f(++_0x225c8b);}(_0xb910,0x1b2));var _0x0b91=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xb910[_0x122096];return _0x3d1966;};'use strict';var multer=require(_0x0b91('0x0'));var util=require('util');var path=require(_0x0b91('0x1'));var timeout=require(_0x0b91('0x2'));var express=require(_0x0b91('0x3'));var router=express[_0x0b91('0x4')]();var auth=require(_0x0b91('0x5'));var interaction=require(_0x0b91('0x6'));var config=require('../../config/environment');var controller=require(_0x0b91('0x7'));router[_0x0b91('0x8')]('/',auth['isAuthenticated'](),controller[_0x0b91('0x9')]);router[_0x0b91('0x8')](_0x0b91('0xa'),auth[_0x0b91('0xb')](),controller['show']);router[_0x0b91('0xc')]('/',auth[_0x0b91('0xb')](),controller[_0x0b91('0xd')]);router[_0x0b91('0xe')](_0x0b91('0xa'),auth[_0x0b91('0xb')](),controller[_0x0b91('0xf')]);router['delete'](_0x0b91('0xa'),auth[_0x0b91('0xb')](),controller[_0x0b91('0x10')]);module['exports']=router; \ No newline at end of file +var _0x25e7=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','index','isAuthenticated','show','post','create','put','/:id','update','delete','multer','util','path','connect-timeout','express'];(function(_0xf832e8,_0x57c2bc){var _0x4ccfee=function(_0x5d9a98){while(--_0x5d9a98){_0xf832e8['push'](_0xf832e8['shift']());}};_0x4ccfee(++_0x57c2bc);}(_0x25e7,0x1d6));var _0x725e=function(_0x4a48cf,_0x5f1870){_0x4a48cf=_0x4a48cf-0x0;var _0x24a970=_0x25e7[_0x4a48cf];return _0x24a970;};'use strict';var multer=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var path=require(_0x725e('0x2'));var timeout=require(_0x725e('0x3'));var express=require(_0x725e('0x4'));var router=express[_0x725e('0x5')]();var auth=require(_0x725e('0x6'));var interaction=require(_0x725e('0x7'));var config=require(_0x725e('0x8'));var controller=require(_0x725e('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x725e('0xa')]);router['get']('/:id',auth[_0x725e('0xb')](),controller[_0x725e('0xc')]);router[_0x725e('0xd')]('/',auth[_0x725e('0xb')](),controller[_0x725e('0xe')]);router[_0x725e('0xf')](_0x725e('0x10'),auth[_0x725e('0xb')](),controller[_0x725e('0x11')]);router[_0x725e('0x12')](_0x725e('0x10'),auth[_0x725e('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index db971a7..40dae03 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 _0x8211=['contactListQueue','INTEGER','moment','exports'];(function(_0x568c27,_0x125911){var _0x289d92=function(_0x9476c5){while(--_0x9476c5){_0x568c27['push'](_0x568c27['shift']());}};_0x289d92(++_0x125911);}(_0x8211,0x10e));var _0x1821=function(_0x12e7c3,_0x2fe24b){_0x12e7c3=_0x12e7c3-0x0;var _0x148ea6=_0x8211[_0x12e7c3];return _0x148ea6;};'use strict';var moment=require(_0x1821('0x0'));var Sequelize=require('sequelize');module[_0x1821('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x1821('0x2')},'ListId':{'type':Sequelize[_0x1821('0x3')],'unique':_0x1821('0x2')},'VoiceQueueId':{'type':Sequelize[_0x1821('0x3')],'unique':_0x1821('0x2')}}; \ No newline at end of file +var _0xe86e=['INTEGER','contactListQueue','sequelize','exports','STRING'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0xe86e,0x9d));var _0xee86=function(_0x591e16,_0x5aefc1){_0x591e16=_0x591e16-0x0;var _0x543b35=_0xe86e[_0x591e16];return _0x543b35;};'use strict';var moment=require('moment');var Sequelize=require(_0xee86('0x0'));module[_0xee86('0x1')]={'phone':{'type':Sequelize[_0xee86('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xee86('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xee86('0x3')],'unique':_0xee86('0x4')},'VoiceQueueId':{'type':Sequelize[_0xee86('0x3')],'unique':_0xee86('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index cf8a5c6..45517b7 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 _0xd61d=['length','hasOwnProperty','order','sort','filters','filter','where','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','keys','find','body','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','sox','ejs','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','status','end','count','offset','limit','set','apply','save','update','then','destroy','error','stack','name','index','map','CmHopperBlack','type','query','model','attributes','intersection','fields'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd61d,0x14f));var _0xdd61=function(_0x5142ec,_0x4e1ac7){_0x5142ec=_0x5142ec-0x0;var _0x3572d0=_0xd61d[_0x5142ec];return _0x3572d0;};'use strict';var pdf=require(_0xdd61('0x0'));var emlformat=require(_0xdd61('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdd61('0x2'));var rp=require(_0xdd61('0x3'));var moment=require(_0xdd61('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdd61('0x5'));var util=require('util');var path=require('path');var sox=require(_0xdd61('0x6'));var csv=require('to-csv');var ejs=require(_0xdd61('0x7'));var fs=require('fs');var _=require(_0xdd61('0x8'));var squel=require(_0xdd61('0x9'));var crypto=require(_0xdd61('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xdd61('0xb'));var toCsv=require(_0xdd61('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdd61('0xd'));var authService=require(_0xdd61('0xe'));var qs=require(_0xdd61('0xf'));var as=require(_0xdd61('0x10'));var hardwareService=require(_0xdd61('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xdd61('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xdd61('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc8754b,_0xe1e621){_0xe1e621=_0xe1e621||0xcc;return function(_0x11d1df){if(_0x11d1df){return _0xc8754b['sendStatus'](_0xe1e621);}return _0xc8754b[_0xdd61('0x14')](_0xe1e621)[_0xdd61('0x15')]();};}function respondWithResult(_0x165edc,_0x7d14fc){_0x7d14fc=_0x7d14fc||0xc8;return function(_0x4c49c3){if(_0x4c49c3){return _0x165edc[_0xdd61('0x14')](_0x7d14fc)['json'](_0x4c49c3);}};}function respondWithFilteredResult(_0x2c23ce,_0x287d30){return function(_0x17bedd){if(_0x17bedd){var _0xa24786=_0x17bedd[_0xdd61('0x16')],_0x4df930=_0x287d30[_0xdd61('0x17')],_0x727d9c=_0x287d30[_0xdd61('0x17')]+_0x287d30[_0xdd61('0x18')],_0xcc368b;if(_0x727d9c>=_0xa24786){_0x727d9c=_0xa24786;_0xcc368b=0xc8;}else{_0xcc368b=0xce;}_0x2c23ce[_0xdd61('0x14')](_0xcc368b);return _0x2c23ce[_0xdd61('0x19')]('Content-Range',_0x4df930+'-'+_0x727d9c+'/'+_0xa24786)['json'](_0x17bedd);}return null;};}function patchUpdates(_0x204fdb){return function(_0x52dfb9){try{jsonpatch[_0xdd61('0x1a')](_0x52dfb9,_0x204fdb,!![]);}catch(_0x5a785a){return BPromise['reject'](_0x5a785a);}return _0x52dfb9[_0xdd61('0x1b')]();};}function saveUpdates(_0x660d8,_0x319b4d){return function(_0x129037){if(_0x129037){return _0x129037[_0xdd61('0x1c')](_0x660d8)[_0xdd61('0x1d')](function(_0x22ba7f){return _0x22ba7f;});}return null;};}function removeEntity(_0x5ab9d1,_0x2ddacb){return function(_0x1643ae){if(_0x1643ae){return _0x1643ae[_0xdd61('0x1e')]()[_0xdd61('0x1d')](function(){_0x5ab9d1['status'](0xcc)[_0xdd61('0x15')]();});}};}function handleEntityNotFound(_0x2b64f1,_0x41994d){return function(_0x314555){if(!_0x314555){_0x2b64f1['sendStatus'](0x194);}return _0x314555;};}function handleError(_0x18b2ff,_0x5cd95d){_0x5cd95d=_0x5cd95d||0x1f4;return function(_0x3c8bc6){logger[_0xdd61('0x1f')](_0x3c8bc6[_0xdd61('0x20')]);if(_0x3c8bc6[_0xdd61('0x21')]){delete _0x3c8bc6[_0xdd61('0x21')];}_0x18b2ff[_0xdd61('0x14')](_0x5cd95d)['send'](_0x3c8bc6);};}exports[_0xdd61('0x22')]=function(_0x25055f,_0x35451b){var _0x336795={},_0x48b506={},_0x4d0dae={'count':0x0,'rows':[]};var _0xc9e031=_[_0xdd61('0x23')](db[_0xdd61('0x24')]['rawAttributes'],function(_0x5b8178){return{'name':_0x5b8178['fieldName'],'type':_0x5b8178[_0xdd61('0x25')]['key']};});_0x48b506['model']=_['map'](_0xc9e031,'name');_0x48b506[_0xdd61('0x26')]=_['keys'](_0x25055f[_0xdd61('0x26')]);_0x48b506['filters']=_['intersection'](_0x48b506[_0xdd61('0x27')],_0x48b506['query']);_0x336795[_0xdd61('0x28')]=_[_0xdd61('0x29')](_0x48b506['model'],qs['fields'](_0x25055f['query'][_0xdd61('0x2a')]));_0x336795['attributes']=_0x336795[_0xdd61('0x28')][_0xdd61('0x2b')]?_0x336795[_0xdd61('0x28')]:_0x48b506[_0xdd61('0x27')];if(!_0x25055f['query'][_0xdd61('0x2c')]('nolimit')){_0x336795[_0xdd61('0x18')]=qs['limit'](_0x25055f[_0xdd61('0x26')][_0xdd61('0x18')]);_0x336795[_0xdd61('0x17')]=qs[_0xdd61('0x17')](_0x25055f['query'][_0xdd61('0x17')]);}_0x336795[_0xdd61('0x2d')]=qs['sort'](_0x25055f[_0xdd61('0x26')][_0xdd61('0x2e')]);_0x336795['where']=qs[_0xdd61('0x2f')](_['pick'](_0x25055f[_0xdd61('0x26')],_0x48b506[_0xdd61('0x2f')]),_0xc9e031);if(_0x25055f[_0xdd61('0x26')][_0xdd61('0x30')]){_0x336795[_0xdd61('0x31')]=_[_0xdd61('0x32')](_0x336795[_0xdd61('0x31')],{'$or':_[_0xdd61('0x23')](_0xc9e031,function(_0x480a26){if(_0x480a26['type']!=='VIRTUAL'){var _0x28d758={};_0x28d758[_0x480a26['name']]={'$like':'%'+_0x25055f['query'][_0xdd61('0x30')]+'%'};return _0x28d758;}})});}_0x336795=_[_0xdd61('0x32')]({},_0x336795,_0x25055f[_0xdd61('0x33')]);var _0x109862={'where':_0x336795['where']};return db[_0xdd61('0x24')][_0xdd61('0x16')](_0x109862)[_0xdd61('0x1d')](function(_0x5623a5){_0x4d0dae[_0xdd61('0x16')]=_0x5623a5;if(_0x25055f[_0xdd61('0x26')][_0xdd61('0x34')]){_0x336795['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0xdd61('0x35')](_0x336795);})['then'](function(_0x2e3442){_0x4d0dae[_0xdd61('0x36')]=_0x2e3442;return _0x4d0dae;})[_0xdd61('0x1d')](respondWithFilteredResult(_0x35451b,_0x336795))[_0xdd61('0x37')](handleError(_0x35451b,null));};exports[_0xdd61('0x38')]=function(_0x4e2f21,_0x258c31){var _0x193f80={'raw':!![],'where':{'id':_0x4e2f21[_0xdd61('0x39')]['id']}},_0x33ea0f={};_0x33ea0f[_0xdd61('0x27')]=_['keys'](db[_0xdd61('0x24')][_0xdd61('0x3a')]);_0x33ea0f[_0xdd61('0x26')]=_[_0xdd61('0x3b')](_0x4e2f21[_0xdd61('0x26')]);_0x33ea0f['filters']=_[_0xdd61('0x29')](_0x33ea0f['model'],_0x33ea0f[_0xdd61('0x26')]);_0x193f80[_0xdd61('0x28')]=_[_0xdd61('0x29')](_0x33ea0f['model'],qs[_0xdd61('0x2a')](_0x4e2f21[_0xdd61('0x26')][_0xdd61('0x2a')]));_0x193f80[_0xdd61('0x28')]=_0x193f80[_0xdd61('0x28')][_0xdd61('0x2b')]?_0x193f80[_0xdd61('0x28')]:_0x33ea0f[_0xdd61('0x27')];if(_0x4e2f21[_0xdd61('0x26')][_0xdd61('0x34')]){_0x193f80['include']=[{'all':!![]}];}_0x193f80=_['merge']({},_0x193f80,_0x4e2f21[_0xdd61('0x33')]);return db[_0xdd61('0x24')][_0xdd61('0x3c')](_0x193f80)[_0xdd61('0x1d')](handleEntityNotFound(_0x258c31,null))[_0xdd61('0x1d')](respondWithResult(_0x258c31,null))[_0xdd61('0x37')](handleError(_0x258c31,null));};exports['update']=function(_0x4dd7ca,_0x5cdfe9){if(_0x4dd7ca[_0xdd61('0x3d')]['id']){delete _0x4dd7ca[_0xdd61('0x3d')]['id'];}return db[_0xdd61('0x24')][_0xdd61('0x3c')]({'where':{'id':_0x4dd7ca[_0xdd61('0x39')]['id']}})[_0xdd61('0x1d')](handleEntityNotFound(_0x5cdfe9,null))['then'](saveUpdates(_0x4dd7ca['body'],null))[_0xdd61('0x1d')](respondWithResult(_0x5cdfe9,null))[_0xdd61('0x37')](handleError(_0x5cdfe9,null));};exports[_0xdd61('0x1e')]=function(_0x5b5132,_0x3fb259){return db['CmHopperBlack'][_0xdd61('0x3c')]({'where':{'id':_0x5b5132[_0xdd61('0x39')]['id']}})[_0xdd61('0x1d')](handleEntityNotFound(_0x3fb259,null))[_0xdd61('0x1d')](removeEntity(_0x3fb259,null))[_0xdd61('0x37')](handleError(_0x3fb259,null));};exports[_0xdd61('0x3e')]=function(_0x38f892,_0x5a1e32){return db[_0xdd61('0x24')][_0xdd61('0x3e')]()[_0xdd61('0x1d')](respondWithResult(_0x5a1e32,null))[_0xdd61('0x37')](handleError(_0x5a1e32,null));}; \ No newline at end of file +var _0x3e9d=['name','merge','options','includeAll','include','findAll','catch','show','params','keys','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','update','then','error','stack','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL'];(function(_0x28292,_0x428c91){var _0x2ad6d1=function(_0x12e4fb){while(--_0x12e4fb){_0x28292['push'](_0x28292['shift']());}};_0x2ad6d1(++_0x428c91);}(_0x3e9d,0xf2));var _0xd3e9=function(_0x4e34c8,_0x5d5286){_0x4e34c8=_0x4e34c8-0x0;var _0x54c3a1=_0x3e9d[_0x4e34c8];return _0x54c3a1;};'use strict';var pdf=require(_0xd3e9('0x0'));var emlformat=require(_0xd3e9('0x1'));var rimraf=require(_0xd3e9('0x2'));var zipdir=require(_0xd3e9('0x3'));var jsonpatch=require(_0xd3e9('0x4'));var rp=require(_0xd3e9('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd3e9('0x6'));var util=require(_0xd3e9('0x7'));var path=require(_0xd3e9('0x8'));var sox=require('sox');var csv=require(_0xd3e9('0x9'));var ejs=require(_0xd3e9('0xa'));var fs=require('fs');var _=require(_0xd3e9('0xb'));var squel=require('squel');var crypto=require(_0xd3e9('0xc'));var jsforce=require(_0xd3e9('0xd'));var deskjs=require(_0xd3e9('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd3e9('0xf'));var Redis=require('ioredis');var authService=require(_0xd3e9('0x10'));var qs=require(_0xd3e9('0x11'));var as=require(_0xd3e9('0x12'));var hardwareService=require(_0xd3e9('0x13'));var logger=require(_0xd3e9('0x14'))(_0xd3e9('0x15'));var utils=require(_0xd3e9('0x16'));var config=require(_0xd3e9('0x17'));var licenseUtil=require(_0xd3e9('0x18'));var db=require(_0xd3e9('0x19'))['db'];function respondWithStatusCode(_0x5913c5,_0x69bee4){_0x69bee4=_0x69bee4||0xcc;return function(_0x40b7d1){if(_0x40b7d1){return _0x5913c5[_0xd3e9('0x1a')](_0x69bee4);}return _0x5913c5[_0xd3e9('0x1b')](_0x69bee4)[_0xd3e9('0x1c')]();};}function respondWithResult(_0x38e349,_0x4ab247){_0x4ab247=_0x4ab247||0xc8;return function(_0x1a689d){if(_0x1a689d){return _0x38e349[_0xd3e9('0x1b')](_0x4ab247)['json'](_0x1a689d);}};}function respondWithFilteredResult(_0x1e1595,_0x5cd32a){return function(_0x3a5870){if(_0x3a5870){var _0x50b2bf=_0x3a5870[_0xd3e9('0x1d')],_0x1ee93c=_0x5cd32a['offset'],_0x371b48=_0x5cd32a[_0xd3e9('0x1e')]+_0x5cd32a[_0xd3e9('0x1f')],_0x762f16;if(_0x371b48>=_0x50b2bf){_0x371b48=_0x50b2bf;_0x762f16=0xc8;}else{_0x762f16=0xce;}_0x1e1595['status'](_0x762f16);return _0x1e1595['set'](_0xd3e9('0x20'),_0x1ee93c+'-'+_0x371b48+'/'+_0x50b2bf)[_0xd3e9('0x21')](_0x3a5870);}return null;};}function patchUpdates(_0x51d07a){return function(_0x44d4c4){try{jsonpatch[_0xd3e9('0x22')](_0x44d4c4,_0x51d07a,!![]);}catch(_0x1d16a9){return BPromise[_0xd3e9('0x23')](_0x1d16a9);}return _0x44d4c4['save']();};}function saveUpdates(_0x33d5b0,_0x59bdb5){return function(_0x2eb7bd){if(_0x2eb7bd){return _0x2eb7bd[_0xd3e9('0x24')](_0x33d5b0)[_0xd3e9('0x25')](function(_0xd1298b){return _0xd1298b;});}return null;};}function removeEntity(_0x2dfb1e,_0x3a9d76){return function(_0x406802){if(_0x406802){return _0x406802['destroy']()['then'](function(){_0x2dfb1e['status'](0xcc)[_0xd3e9('0x1c')]();});}};}function handleEntityNotFound(_0x3e8b66,_0x2bb6d5){return function(_0x1766c4){if(!_0x1766c4){_0x3e8b66[_0xd3e9('0x1a')](0x194);}return _0x1766c4;};}function handleError(_0x39e0dd,_0x3e070b){_0x3e070b=_0x3e070b||0x1f4;return function(_0x3c19bc){logger[_0xd3e9('0x26')](_0x3c19bc[_0xd3e9('0x27')]);if(_0x3c19bc['name']){delete _0x3c19bc['name'];}_0x39e0dd[_0xd3e9('0x1b')](_0x3e070b)['send'](_0x3c19bc);};}exports[_0xd3e9('0x28')]=function(_0x4aefaf,_0x401312){var _0xf7175c={},_0x2041c8={},_0x4a6f32={'count':0x0,'rows':[]};var _0x4755f6=_[_0xd3e9('0x29')](db[_0xd3e9('0x2a')][_0xd3e9('0x2b')],function(_0x541edb){return{'name':_0x541edb[_0xd3e9('0x2c')],'type':_0x541edb[_0xd3e9('0x2d')][_0xd3e9('0x2e')]};});_0x2041c8[_0xd3e9('0x2f')]=_[_0xd3e9('0x29')](_0x4755f6,'name');_0x2041c8[_0xd3e9('0x30')]=_['keys'](_0x4aefaf[_0xd3e9('0x30')]);_0x2041c8[_0xd3e9('0x31')]=_[_0xd3e9('0x32')](_0x2041c8[_0xd3e9('0x2f')],_0x2041c8[_0xd3e9('0x30')]);_0xf7175c['attributes']=_[_0xd3e9('0x32')](_0x2041c8[_0xd3e9('0x2f')],qs[_0xd3e9('0x33')](_0x4aefaf[_0xd3e9('0x30')][_0xd3e9('0x33')]));_0xf7175c[_0xd3e9('0x34')]=_0xf7175c[_0xd3e9('0x34')][_0xd3e9('0x35')]?_0xf7175c['attributes']:_0x2041c8[_0xd3e9('0x2f')];if(!_0x4aefaf[_0xd3e9('0x30')][_0xd3e9('0x36')](_0xd3e9('0x37'))){_0xf7175c[_0xd3e9('0x1f')]=qs[_0xd3e9('0x1f')](_0x4aefaf[_0xd3e9('0x30')]['limit']);_0xf7175c['offset']=qs[_0xd3e9('0x1e')](_0x4aefaf[_0xd3e9('0x30')][_0xd3e9('0x1e')]);}_0xf7175c[_0xd3e9('0x38')]=qs[_0xd3e9('0x39')](_0x4aefaf[_0xd3e9('0x30')][_0xd3e9('0x39')]);_0xf7175c[_0xd3e9('0x3a')]=qs[_0xd3e9('0x31')](_[_0xd3e9('0x3b')](_0x4aefaf[_0xd3e9('0x30')],_0x2041c8[_0xd3e9('0x31')]),_0x4755f6);if(_0x4aefaf[_0xd3e9('0x30')][_0xd3e9('0x3c')]){_0xf7175c[_0xd3e9('0x3a')]=_['merge'](_0xf7175c[_0xd3e9('0x3a')],{'$or':_[_0xd3e9('0x29')](_0x4755f6,function(_0x469f33){if(_0x469f33[_0xd3e9('0x2d')]!==_0xd3e9('0x3d')){var _0x45a997={};_0x45a997[_0x469f33[_0xd3e9('0x3e')]]={'$like':'%'+_0x4aefaf[_0xd3e9('0x30')]['filter']+'%'};return _0x45a997;}})});}_0xf7175c=_[_0xd3e9('0x3f')]({},_0xf7175c,_0x4aefaf[_0xd3e9('0x40')]);var _0x52bfe8={'where':_0xf7175c[_0xd3e9('0x3a')]};return db[_0xd3e9('0x2a')][_0xd3e9('0x1d')](_0x52bfe8)[_0xd3e9('0x25')](function(_0x12871e){_0x4a6f32['count']=_0x12871e;if(_0x4aefaf['query'][_0xd3e9('0x41')]){_0xf7175c[_0xd3e9('0x42')]=[{'all':!![]}];}return db[_0xd3e9('0x2a')][_0xd3e9('0x43')](_0xf7175c);})[_0xd3e9('0x25')](function(_0x53794b){_0x4a6f32['rows']=_0x53794b;return _0x4a6f32;})['then'](respondWithFilteredResult(_0x401312,_0xf7175c))[_0xd3e9('0x44')](handleError(_0x401312,null));};exports[_0xd3e9('0x45')]=function(_0x4272bd,_0x83f13d){var _0x2c31b9={'raw':!![],'where':{'id':_0x4272bd[_0xd3e9('0x46')]['id']}},_0x202b88={};_0x202b88[_0xd3e9('0x2f')]=_[_0xd3e9('0x47')](db[_0xd3e9('0x2a')]['rawAttributes']);_0x202b88['query']=_[_0xd3e9('0x47')](_0x4272bd[_0xd3e9('0x30')]);_0x202b88[_0xd3e9('0x31')]=_['intersection'](_0x202b88[_0xd3e9('0x2f')],_0x202b88['query']);_0x2c31b9[_0xd3e9('0x34')]=_['intersection'](_0x202b88['model'],qs[_0xd3e9('0x33')](_0x4272bd[_0xd3e9('0x30')]['fields']));_0x2c31b9['attributes']=_0x2c31b9[_0xd3e9('0x34')][_0xd3e9('0x35')]?_0x2c31b9['attributes']:_0x202b88[_0xd3e9('0x2f')];if(_0x4272bd[_0xd3e9('0x30')]['includeAll']){_0x2c31b9[_0xd3e9('0x42')]=[{'all':!![]}];}_0x2c31b9=_['merge']({},_0x2c31b9,_0x4272bd[_0xd3e9('0x40')]);return db[_0xd3e9('0x2a')]['find'](_0x2c31b9)[_0xd3e9('0x25')](handleEntityNotFound(_0x83f13d,null))[_0xd3e9('0x25')](respondWithResult(_0x83f13d,null))[_0xd3e9('0x44')](handleError(_0x83f13d,null));};exports[_0xd3e9('0x24')]=function(_0x10aae0,_0x19b125){if(_0x10aae0[_0xd3e9('0x48')]['id']){delete _0x10aae0[_0xd3e9('0x48')]['id'];}return db[_0xd3e9('0x2a')][_0xd3e9('0x49')]({'where':{'id':_0x10aae0['params']['id']}})[_0xd3e9('0x25')](handleEntityNotFound(_0x19b125,null))[_0xd3e9('0x25')](saveUpdates(_0x10aae0[_0xd3e9('0x48')],null))[_0xd3e9('0x25')](respondWithResult(_0x19b125,null))[_0xd3e9('0x44')](handleError(_0x19b125,null));};exports[_0xd3e9('0x4a')]=function(_0x14d3f1,_0x33b871){return db[_0xd3e9('0x2a')][_0xd3e9('0x49')]({'where':{'id':_0x14d3f1[_0xd3e9('0x46')]['id']}})[_0xd3e9('0x25')](handleEntityNotFound(_0x33b871,null))[_0xd3e9('0x25')](removeEntity(_0x33b871,null))[_0xd3e9('0x44')](handleError(_0x33b871,null));};exports[_0xd3e9('0x4b')]=function(_0x450342,_0xddfe3e){return db[_0xd3e9('0x2a')]['describe']()[_0xd3e9('0x25')](respondWithResult(_0xddfe3e,null))[_0xd3e9('0x44')](handleError(_0xddfe3e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 83879b4..d1e5919 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 _0xdce4=['rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','api','moment','request-promise','path'];(function(_0x53eff4,_0x55b2c0){var _0x1fa828=function(_0x50da64){while(--_0x50da64){_0x53eff4['push'](_0x53eff4['shift']());}};_0x1fa828(++_0x55b2c0);}(_0xdce4,0xc7));var _0x4dce=function(_0x337a5e,_0x4e13ee){_0x337a5e=_0x337a5e-0x0;var _0x1c0f76=_0xdce4[_0x337a5e];return _0x1c0f76;};'use strict';var _=require(_0x4dce('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4dce('0x1'));var moment=require(_0x4dce('0x2'));var BPromise=require('bluebird');var rp=require(_0x4dce('0x3'));var fs=require('fs');var path=require(_0x4dce('0x4'));var rimraf=require(_0x4dce('0x5'));var config=require(_0x4dce('0x6'));var attributes=require(_0x4dce('0x7'));module[_0x4dce('0x8')]=function(_0xcab864,_0x116d42){return _0xcab864[_0x4dce('0x9')](_0x4dce('0xa'),attributes,{'tableName':_0x4dce('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8568=['exports','CmHopperBlack','cm_hopper_black','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x8116f3,_0x4875d8){var _0x395b39=function(_0x53f3db){while(--_0x53f3db){_0x8116f3['push'](_0x8116f3['shift']());}};_0x395b39(++_0x4875d8);}(_0x8568,0x85));var _0x8856=function(_0x5a187b,_0x1f64fe){_0x5a187b=_0x5a187b-0x0;var _0x14d601=_0x8568[_0x5a187b];return _0x14d601;};'use strict';var _=require('lodash');var util=require(_0x8856('0x0'));var logger=require(_0x8856('0x1'))(_0x8856('0x2'));var moment=require(_0x8856('0x3'));var BPromise=require(_0x8856('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8856('0x5'));var rimraf=require('rimraf');var config=require(_0x8856('0x6'));var attributes=require('./cmHopperBlack.attributes');module[_0x8856('0x7')]=function(_0x497d0f,_0x5485f0){return _0x497d0f['define'](_0x8856('0x8'),attributes,{'tableName':_0x8856('0x9'),'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 3b42951..66e784a 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 _0xbae7=['client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetCmHopperBlack','UpdateCmHopperBlack','body','DestroyCmHopperBlack','CmHopperBlack','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x37fd42,_0x9fb5f7){var _0x24e1f8=function(_0x1be4d2){while(--_0x1be4d2){_0x37fd42['push'](_0x37fd42['shift']());}};_0x24e1f8(++_0x9fb5f7);}(_0xbae7,0x6a));var _0x7bae=function(_0xee397d,_0x5cf526){_0xee397d=_0xee397d-0x0;var _0x1ec970=_0xbae7[_0xee397d];return _0x1ec970;};'use strict';var _=require(_0x7bae('0x0'));var util=require(_0x7bae('0x1'));var moment=require('moment');var BPromise=require(_0x7bae('0x2'));var rs=require(_0x7bae('0x3'));var fs=require('fs');var Redis=require(_0x7bae('0x4'));var db=require(_0x7bae('0x5'))['db'];var utils=require(_0x7bae('0x6'));var logger=require(_0x7bae('0x7'))(_0x7bae('0x8'));var config=require(_0x7bae('0x9'));var jayson=require(_0x7bae('0xa'));var client=jayson[_0x7bae('0xb')][_0x7bae('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x193adf,_0x5a0ede,_0x1cde49){return new BPromise(function(_0x217369,_0x50c3c0){return client[_0x7bae('0xd')](_0x193adf,_0x1cde49)[_0x7bae('0xe')](function(_0x56994c){logger['info'](_0x7bae('0xf'),_0x5a0ede,_0x7bae('0x10'));logger[_0x7bae('0x11')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x5a0ede,_0x7bae('0x10'),JSON[_0x7bae('0x12')](_0x56994c));if(_0x56994c['error']){if(_0x56994c['error'][_0x7bae('0x13')]===0x1f4){logger[_0x7bae('0x14')](_0x7bae('0xf'),_0x5a0ede,_0x56994c[_0x7bae('0x14')]['message']);return _0x50c3c0(_0x56994c[_0x7bae('0x14')][_0x7bae('0x15')]);}logger[_0x7bae('0x14')](_0x7bae('0xf'),_0x5a0ede,_0x56994c[_0x7bae('0x14')][_0x7bae('0x15')]);return _0x217369(_0x56994c['error']['message']);}else{logger[_0x7bae('0x16')](_0x7bae('0xf'),_0x5a0ede,_0x7bae('0x10'));_0x217369(_0x56994c[_0x7bae('0x17')]['message']);}})[_0x7bae('0x18')](function(_0x1048dd){logger[_0x7bae('0x14')](_0x7bae('0xf'),_0x5a0ede,_0x1048dd);_0x50c3c0(_0x1048dd);});});}exports['GetCmHopperBlack']=function(_0x21efa8){var _0x5790ca=this;return new Promise(function(_0x7d862a,_0x3f6009){return db['CmHopperBlack'][_0x7bae('0x19')]({'raw':_0x21efa8[_0x7bae('0x1a')]?_0x21efa8[_0x7bae('0x1a')][_0x7bae('0x1b')]===undefined?!![]:![]:!![],'where':_0x21efa8[_0x7bae('0x1a')]?_0x21efa8['options'][_0x7bae('0x1c')]||null:null,'attributes':_0x21efa8[_0x7bae('0x1a')]?_0x21efa8['options'][_0x7bae('0x1d')]||null:null,'limit':_0x21efa8[_0x7bae('0x1a')]?_0x21efa8[_0x7bae('0x1a')][_0x7bae('0x1e')]||null:null,'include':_0x21efa8[_0x7bae('0x1a')]?_0x21efa8[_0x7bae('0x1a')][_0x7bae('0x1f')]?_[_0x7bae('0x20')](_0x21efa8[_0x7bae('0x1a')][_0x7bae('0x1f')],function(_0x571d46){return{'model':db[_0x571d46[_0x7bae('0x21')]],'as':_0x571d46['as'],'attributes':_0x571d46['attributes'],'include':_0x571d46[_0x7bae('0x1f')]?_[_0x7bae('0x20')](_0x571d46[_0x7bae('0x1f')],function(_0x393745){return{'model':db[_0x393745[_0x7bae('0x21')]],'as':_0x393745['as'],'attributes':_0x393745[_0x7bae('0x1d')],'include':_0x393745[_0x7bae('0x1f')]?_[_0x7bae('0x20')](_0x393745[_0x7bae('0x1f')],function(_0xa9567a){return{'model':db[_0xa9567a['model']],'as':_0xa9567a['as'],'attributes':_0xa9567a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7bae('0xe')](function(_0x34f1f4){logger[_0x7bae('0x16')](_0x7bae('0x22'),_0x21efa8);logger[_0x7bae('0x11')](_0x7bae('0x22'),_0x21efa8,JSON[_0x7bae('0x12')](_0x34f1f4));_0x7d862a(_0x34f1f4);})[_0x7bae('0x18')](function(_0x17bb11){logger[_0x7bae('0x14')](_0x7bae('0x22'),_0x17bb11[_0x7bae('0x15')],_0x21efa8);_0x3f6009(_0x5790ca['error'](0x1f4,_0x17bb11[_0x7bae('0x15')]));});});};exports[_0x7bae('0x23')]=function(_0x43c21d){var _0x459fec=this;return new Promise(function(_0x4bec22,_0x2f2a7e){return db['CmHopperBlack']['update'](_0x43c21d[_0x7bae('0x24')],{'raw':_0x43c21d[_0x7bae('0x1a')]?_0x43c21d['options'][_0x7bae('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43c21d[_0x7bae('0x1a')]?_0x43c21d[_0x7bae('0x1a')][_0x7bae('0x1c')]||null:null,'attributes':_0x43c21d['options']?_0x43c21d['options']['attributes']||null:null,'limit':_0x43c21d['options']?_0x43c21d[_0x7bae('0x1a')][_0x7bae('0x1e')]||null:null})['then'](function(_0x2239ee){logger[_0x7bae('0x16')](_0x7bae('0x23'),_0x43c21d);logger[_0x7bae('0x11')]('UpdateCmHopperBlack',_0x43c21d,JSON[_0x7bae('0x12')](_0x2239ee));_0x4bec22(_0x2239ee);})[_0x7bae('0x18')](function(_0x19e034){logger['error'](_0x7bae('0x23'),_0x19e034['message'],_0x43c21d);_0x2f2a7e(_0x459fec[_0x7bae('0x14')](0x1f4,_0x19e034[_0x7bae('0x15')]));});});};exports[_0x7bae('0x25')]=function(_0xae0c2f){var _0x16ffb4=this;return new Promise(function(_0x51dbc6,_0x314645){return db[_0x7bae('0x26')]['destroy']({'where':_0xae0c2f[_0x7bae('0x1a')]?_0xae0c2f['options'][_0x7bae('0x1c')]||null:null})['then'](function(_0x33221c){logger[_0x7bae('0x16')](_0x7bae('0x25'),_0xae0c2f);logger['debug'](_0x7bae('0x25'),_0xae0c2f,JSON[_0x7bae('0x12')](_0x33221c));_0x51dbc6(_0x33221c);})[_0x7bae('0x18')](function(_0x349158){logger[_0x7bae('0x14')]('DestroyCmHopperBlack',_0x349158[_0x7bae('0x15')],_0xae0c2f);_0x314645(_0x16ffb4['error'](0x1f4,_0x349158[_0x7bae('0x15')]));});});}; \ No newline at end of file +var _0xd779=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','where','attributes','limit','include','map','model','UpdateCmHopperBlack','body','raw','destroy','DestroyCmHopperBlack'];(function(_0x329664,_0x130748){var _0x4e346e=function(_0x172b0d){while(--_0x172b0d){_0x329664['push'](_0x329664['shift']());}};_0x4e346e(++_0x130748);}(_0xd779,0x111));var _0x9d77=function(_0x5dcdb7,_0x57ff91){_0x5dcdb7=_0x5dcdb7-0x0;var _0x146513=_0xd779[_0x5dcdb7];return _0x146513;};'use strict';var _=require(_0x9d77('0x0'));var util=require(_0x9d77('0x1'));var moment=require(_0x9d77('0x2'));var BPromise=require('bluebird');var rs=require(_0x9d77('0x3'));var fs=require('fs');var Redis=require(_0x9d77('0x4'));var db=require(_0x9d77('0x5'))['db'];var utils=require(_0x9d77('0x6'));var logger=require(_0x9d77('0x7'))('rpc');var config=require(_0x9d77('0x8'));var jayson=require(_0x9d77('0x9'));var client=jayson[_0x9d77('0xa')][_0x9d77('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x156905,_0x130a6f,_0x2ea332){return new BPromise(function(_0x5cadf4,_0xa791d6){return client['request'](_0x156905,_0x2ea332)[_0x9d77('0xc')](function(_0x5c1ee3){logger[_0x9d77('0xd')](_0x9d77('0xe'),_0x130a6f,_0x9d77('0xf'));logger[_0x9d77('0x10')](_0x9d77('0x11'),_0x130a6f,'request\x20sent',JSON[_0x9d77('0x12')](_0x5c1ee3));if(_0x5c1ee3[_0x9d77('0x13')]){if(_0x5c1ee3[_0x9d77('0x13')][_0x9d77('0x14')]===0x1f4){logger[_0x9d77('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x130a6f,_0x5c1ee3[_0x9d77('0x13')][_0x9d77('0x15')]);return _0xa791d6(_0x5c1ee3['error'][_0x9d77('0x15')]);}logger['error'](_0x9d77('0xe'),_0x130a6f,_0x5c1ee3[_0x9d77('0x13')][_0x9d77('0x15')]);return _0x5cadf4(_0x5c1ee3[_0x9d77('0x13')]['message']);}else{logger[_0x9d77('0xd')](_0x9d77('0xe'),_0x130a6f,_0x9d77('0xf'));_0x5cadf4(_0x5c1ee3[_0x9d77('0x16')][_0x9d77('0x15')]);}})[_0x9d77('0x17')](function(_0x1f05ea){logger[_0x9d77('0x13')](_0x9d77('0xe'),_0x130a6f,_0x1f05ea);_0xa791d6(_0x1f05ea);});});}exports[_0x9d77('0x18')]=function(_0x4f59c4){var _0x520fff=this;return new Promise(function(_0x345251,_0x1adb7a){return db[_0x9d77('0x19')][_0x9d77('0x1a')]({'raw':_0x4f59c4[_0x9d77('0x1b')]?_0x4f59c4[_0x9d77('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4f59c4['options']?_0x4f59c4[_0x9d77('0x1b')][_0x9d77('0x1c')]||null:null,'attributes':_0x4f59c4['options']?_0x4f59c4[_0x9d77('0x1b')][_0x9d77('0x1d')]||null:null,'limit':_0x4f59c4[_0x9d77('0x1b')]?_0x4f59c4[_0x9d77('0x1b')][_0x9d77('0x1e')]||null:null,'include':_0x4f59c4['options']?_0x4f59c4[_0x9d77('0x1b')][_0x9d77('0x1f')]?_[_0x9d77('0x20')](_0x4f59c4[_0x9d77('0x1b')][_0x9d77('0x1f')],function(_0x54791a){return{'model':db[_0x54791a[_0x9d77('0x21')]],'as':_0x54791a['as'],'attributes':_0x54791a['attributes'],'include':_0x54791a['include']?_[_0x9d77('0x20')](_0x54791a[_0x9d77('0x1f')],function(_0x1b52a0){return{'model':db[_0x1b52a0['model']],'as':_0x1b52a0['as'],'attributes':_0x1b52a0[_0x9d77('0x1d')],'include':_0x1b52a0[_0x9d77('0x1f')]?_['map'](_0x1b52a0[_0x9d77('0x1f')],function(_0x2cd471){return{'model':db[_0x2cd471[_0x9d77('0x21')]],'as':_0x2cd471['as'],'attributes':_0x2cd471[_0x9d77('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9d77('0xc')](function(_0x5ad087){logger[_0x9d77('0xd')](_0x9d77('0x18'),_0x4f59c4);logger['debug'](_0x9d77('0x18'),_0x4f59c4,JSON[_0x9d77('0x12')](_0x5ad087));_0x345251(_0x5ad087);})[_0x9d77('0x17')](function(_0xcbadf2){logger['error'](_0x9d77('0x18'),_0xcbadf2[_0x9d77('0x15')],_0x4f59c4);_0x1adb7a(_0x520fff[_0x9d77('0x13')](0x1f4,_0xcbadf2[_0x9d77('0x15')]));});});};exports[_0x9d77('0x22')]=function(_0x358421){var _0x4ae993=this;return new Promise(function(_0x53e285,_0x40a479){return db['CmHopperBlack']['update'](_0x358421[_0x9d77('0x23')],{'raw':_0x358421['options']?_0x358421['options'][_0x9d77('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x358421[_0x9d77('0x1b')]?_0x358421[_0x9d77('0x1b')][_0x9d77('0x1c')]||null:null,'attributes':_0x358421[_0x9d77('0x1b')]?_0x358421[_0x9d77('0x1b')]['attributes']||null:null,'limit':_0x358421[_0x9d77('0x1b')]?_0x358421[_0x9d77('0x1b')]['limit']||null:null})[_0x9d77('0xc')](function(_0x4ee828){logger[_0x9d77('0xd')]('UpdateCmHopperBlack',_0x358421);logger[_0x9d77('0x10')](_0x9d77('0x22'),_0x358421,JSON[_0x9d77('0x12')](_0x4ee828));_0x53e285(_0x4ee828);})['catch'](function(_0x3f5b28){logger[_0x9d77('0x13')](_0x9d77('0x22'),_0x3f5b28[_0x9d77('0x15')],_0x358421);_0x40a479(_0x4ae993[_0x9d77('0x13')](0x1f4,_0x3f5b28[_0x9d77('0x15')]));});});};exports['DestroyCmHopperBlack']=function(_0x599abf){var _0x3bf6f9=this;return new Promise(function(_0x4137c5,_0x20bb1a){return db[_0x9d77('0x19')][_0x9d77('0x25')]({'where':_0x599abf[_0x9d77('0x1b')]?_0x599abf[_0x9d77('0x1b')][_0x9d77('0x1c')]||null:null})[_0x9d77('0xc')](function(_0x375276){logger[_0x9d77('0xd')](_0x9d77('0x26'),_0x599abf);logger[_0x9d77('0x10')]('DestroyCmHopperBlack',_0x599abf,JSON[_0x9d77('0x12')](_0x375276));_0x4137c5(_0x375276);})[_0x9d77('0x17')](function(_0x390eac){logger[_0x9d77('0x13')](_0x9d77('0x26'),_0x390eac[_0x9d77('0x15')],_0x599abf);_0x20bb1a(_0x3bf6f9['error'](0x1f4,_0x390eac[_0x9d77('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index b648b84..dd79b5b 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 _0x4bc3=['get','isAuthenticated','index','/describe','/:id','show','put','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller'];(function(_0x22202a,_0x40272c){var _0x4fa680=function(_0x403b45){while(--_0x403b45){_0x22202a['push'](_0x22202a['shift']());}};_0x4fa680(++_0x40272c);}(_0x4bc3,0x16e));var _0x34bc=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x4bc3[_0x2064e5];return _0x21a233;};'use strict';var multer=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var path=require('path');var timeout=require(_0x34bc('0x2'));var express=require(_0x34bc('0x3'));var router=express['Router']();var auth=require(_0x34bc('0x4'));var interaction=require(_0x34bc('0x5'));var config=require(_0x34bc('0x6'));var controller=require(_0x34bc('0x7'));router[_0x34bc('0x8')]('/',auth[_0x34bc('0x9')](),controller[_0x34bc('0xa')]);router['get'](_0x34bc('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x34bc('0x8')](_0x34bc('0xc'),auth[_0x34bc('0x9')](),controller[_0x34bc('0xd')]);router[_0x34bc('0xe')](_0x34bc('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x34bc('0xf')](_0x34bc('0xc'),auth[_0x34bc('0x9')](),controller['destroy']);module[_0x34bc('0x10')]=router; \ No newline at end of file +var _0x4c4e=['delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','update'];(function(_0x433d4e,_0x1b8b47){var _0x1f39a8=function(_0x1eeb01){while(--_0x1eeb01){_0x433d4e['push'](_0x433d4e['shift']());}};_0x1f39a8(++_0x1b8b47);}(_0x4c4e,0x152));var _0xe4c4=function(_0x508214,_0x4631ff){_0x508214=_0x508214-0x0;var _0x441bac=_0x4c4e[_0x508214];return _0x441bac;};'use strict';var multer=require(_0xe4c4('0x0'));var util=require('util');var path=require(_0xe4c4('0x1'));var timeout=require(_0xe4c4('0x2'));var express=require(_0xe4c4('0x3'));var router=express['Router']();var auth=require(_0xe4c4('0x4'));var interaction=require(_0xe4c4('0x5'));var config=require(_0xe4c4('0x6'));var controller=require('./cmHopperBlack.controller');router[_0xe4c4('0x7')]('/',auth['isAuthenticated'](),controller[_0xe4c4('0x8')]);router[_0xe4c4('0x7')](_0xe4c4('0x9'),auth[_0xe4c4('0xa')](),controller[_0xe4c4('0xb')]);router[_0xe4c4('0x7')](_0xe4c4('0xc'),auth[_0xe4c4('0xa')](),controller['show']);router['put'](_0xe4c4('0xc'),auth[_0xe4c4('0xa')](),controller[_0xe4c4('0xd')]);router[_0xe4c4('0xe')](_0xe4c4('0xc'),auth[_0xe4c4('0xa')](),controller['destroy']);module[_0xe4c4('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index ef98a6d..5fef4fe 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 _0xdedc=['followuptime','diff','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','setDataValue'];(function(_0x445c98,_0x132bf7){var _0x2fe913=function(_0x32e864){while(--_0x32e864){_0x445c98['push'](_0x445c98['shift']());}};_0x2fe913(++_0x132bf7);}(_0xdedc,0xb8));var _0xcded=function(_0xfdd6b6,_0x19497a){_0xfdd6b6=_0xfdd6b6-0x0;var _0x464439=_0xdedc[_0xfdd6b6];return _0x464439;};'use strict';var Sequelize=require(_0xcded('0x0'));var moment=require(_0xcded('0x1'));module[_0xcded('0x2')]={'state':{'type':Sequelize[_0xcded('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xcded('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xcded('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xcded('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xcded('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xcded('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xcded('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xcded('0x4')]},'calleridname':{'type':Sequelize[_0xcded('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xcded('0x5')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xcded('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xcded('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xcded('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xcded('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xcded('0x4')]},'membername':{'type':Sequelize[_0xcded('0x4')]},'reason':{'type':Sequelize[_0xcded('0x4')]},'disposition':{'type':Sequelize[_0xcded('0x4')]},'secondDisposition':{'type':Sequelize[_0xcded('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xcded('0x5')],'set':function(_0x20ea13){var _0x42c214=this[_0xcded('0x6')]('endtime');if(_0x42c214&&_0x20ea13){this[_0xcded('0x7')](_0xcded('0x8'),moment(_0x20ea13)[_0xcded('0x9')](moment(_0x42c214),'seconds'));}return this[_0xcded('0x7')](_0xcded('0xa'),_0x20ea13);}},'amd':{'type':Sequelize[_0xcded('0xb')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xcded('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xcded('0x5')]},'callback':{'type':Sequelize[_0xcded('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xcded('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xcded('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xcded('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xcded('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcded('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xcded('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2d66=['setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','moment','exports','INTEGER','DATE','STRING','getDataValue','endtime'];(function(_0x3e5366,_0x4c76d4){var _0x2d102d=function(_0x376d74){while(--_0x376d74){_0x3e5366['push'](_0x3e5366['shift']());}};_0x2d102d(++_0x4c76d4);}(_0x2d66,0x18c));var _0x62d6=function(_0x5b409c,_0x2c894e){_0x5b409c=_0x5b409c-0x0;var _0x5425bb=_0x2d66[_0x5b409c];return _0x5425bb;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x62d6('0x0'));module[_0x62d6('0x1')]={'state':{'type':Sequelize[_0x62d6('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x62d6('0x3')]},'countbusyretry':{'type':Sequelize[_0x62d6('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x62d6('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x62d6('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x62d6('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x62d6('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x62d6('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x62d6('0x3')]},'responsetime':{'type':Sequelize[_0x62d6('0x3')]},'answertime':{'type':Sequelize[_0x62d6('0x3')]},'droptime':{'type':Sequelize[_0x62d6('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x62d6('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x62d6('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x62d6('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x62d6('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x62d6('0x4')]},'campaign':{'type':Sequelize[_0x62d6('0x4')]},'campaigntype':{'type':Sequelize[_0x62d6('0x4')]},'membername':{'type':Sequelize[_0x62d6('0x4')]},'reason':{'type':Sequelize[_0x62d6('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x62d6('0x4')]},'thirdDisposition':{'type':Sequelize[_0x62d6('0x4')]},'dispositionat':{'type':Sequelize[_0x62d6('0x3')],'set':function(_0x393ee6){var _0x18bb95=this[_0x62d6('0x5')](_0x62d6('0x6'));if(_0x18bb95&&_0x393ee6){this[_0x62d6('0x7')](_0x62d6('0x8'),moment(_0x393ee6)[_0x62d6('0x9')](moment(_0x18bb95),_0x62d6('0xa')));}return this['setDataValue'](_0x62d6('0xb'),_0x393ee6);}},'amd':{'type':Sequelize[_0x62d6('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x62d6('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x62d6('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x62d6('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x62d6('0x3')]},'callback':{'type':Sequelize[_0x62d6('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x62d6('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x62d6('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x62d6('0x3')]},'recallme':{'type':Sequelize[_0x62d6('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x62d6('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x62d6('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x62d6('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x62d6('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 564bc4f..4d98d01 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 _0x0e9f=['scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','VoiceQueueId\x20=\x20?','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','updatedAt','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','findOne','html-pdf','eml-format','fast-json-patch','bluebird','path','sox','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','apply','save','then','destroy','error','stack','name','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','params','include','find','catch','describe','update','body','uniqueid','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','literal','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','ContactId','VoiceQueueId','createdAt','field','ANY_VALUE(calleridnum)','NOW()'];(function(_0x825c1c,_0x9119ef){var _0x1baa74=function(_0x54d220){while(--_0x54d220){_0x825c1c['push'](_0x825c1c['shift']());}};_0x1baa74(++_0x9119ef);}(_0x0e9f,0x116));var _0xf0e9=function(_0x1e5b67,_0x1aacd7){_0x1e5b67=_0x1e5b67-0x0;var _0x1fe947=_0x0e9f[_0x1e5b67];return _0x1fe947;};'use strict';var pdf=require(_0xf0e9('0x0'));var emlformat=require(_0xf0e9('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf0e9('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0e9('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf0e9('0x4'));var sox=require(_0xf0e9('0x5'));var csv=require('to-csv');var ejs=require(_0xf0e9('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf0e9('0x7'));var crypto=require(_0xf0e9('0x8'));var jsforce=require(_0xf0e9('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf0e9('0xa'));var Papa=require(_0xf0e9('0xb'));var Redis=require(_0xf0e9('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xf0e9('0xd'));var as=require(_0xf0e9('0xe'));var hardwareService=require(_0xf0e9('0xf'));var logger=require('../../config/logger')(_0xf0e9('0x10'));var utils=require(_0xf0e9('0x11'));var config=require(_0xf0e9('0x12'));var licenseUtil=require(_0xf0e9('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa9d7e3,_0x541cd6){_0x541cd6=_0x541cd6||0xcc;return function(_0x1461af){if(_0x1461af){return _0xa9d7e3[_0xf0e9('0x14')](_0x541cd6);}return _0xa9d7e3['status'](_0x541cd6)[_0xf0e9('0x15')]();};}function respondWithResult(_0x34ebf1,_0x261100){_0x261100=_0x261100||0xc8;return function(_0x1b87cf){if(_0x1b87cf){return _0x34ebf1[_0xf0e9('0x16')](_0x261100)[_0xf0e9('0x17')](_0x1b87cf);}};}function respondWithFilteredResult(_0x5c7787,_0x933fea){return function(_0x1eb36f){if(_0x1eb36f){var _0x4f37b5=_0x1eb36f[_0xf0e9('0x18')],_0x320a29=_0x933fea['offset'],_0xcf4be0=_0x933fea[_0xf0e9('0x19')]+_0x933fea[_0xf0e9('0x1a')],_0x3d0b4d;if(_0xcf4be0>=_0x4f37b5){_0xcf4be0=_0x4f37b5;_0x3d0b4d=0xc8;}else{_0x3d0b4d=0xce;}_0x5c7787[_0xf0e9('0x16')](_0x3d0b4d);return _0x5c7787[_0xf0e9('0x1b')]('Content-Range',_0x320a29+'-'+_0xcf4be0+'/'+_0x4f37b5)['json'](_0x1eb36f);}return null;};}function patchUpdates(_0x360f8b){return function(_0x98bb88){try{jsonpatch[_0xf0e9('0x1c')](_0x98bb88,_0x360f8b,!![]);}catch(_0x49c120){return BPromise['reject'](_0x49c120);}return _0x98bb88[_0xf0e9('0x1d')]();};}function saveUpdates(_0x1ac91f,_0x4992c5){return function(_0x3d6c12){if(_0x3d6c12){return _0x3d6c12['update'](_0x1ac91f)[_0xf0e9('0x1e')](function(_0x1c956d){return _0x1c956d;});}return null;};}function removeEntity(_0x4afcff,_0x5dd652){return function(_0x186fa5){if(_0x186fa5){return _0x186fa5[_0xf0e9('0x1f')]()['then'](function(){_0x4afcff[_0xf0e9('0x16')](0xcc)[_0xf0e9('0x15')]();});}};}function handleEntityNotFound(_0x52612e,_0x2f44ee){return function(_0x2a31fc){if(!_0x2a31fc){_0x52612e['sendStatus'](0x194);}return _0x2a31fc;};}function handleError(_0x297936,_0x423dd1){_0x423dd1=_0x423dd1||0x1f4;return function(_0x9acc21){logger[_0xf0e9('0x20')](_0x9acc21[_0xf0e9('0x21')]);if(_0x9acc21[_0xf0e9('0x22')]){delete _0x9acc21[_0xf0e9('0x22')];}_0x297936['status'](_0x423dd1)['send'](_0x9acc21);};}exports[_0xf0e9('0x23')]=function(_0x4f9e96,_0x553788){var _0x5aac7f={},_0x8b5167={},_0x8fd443={'count':0x0,'rows':[]};var _0x5620a5=_[_0xf0e9('0x24')](db[_0xf0e9('0x25')][_0xf0e9('0x26')],function(_0x480b7d){return{'name':_0x480b7d[_0xf0e9('0x27')],'type':_0x480b7d[_0xf0e9('0x28')][_0xf0e9('0x29')]};});_0x8b5167[_0xf0e9('0x2a')]=_[_0xf0e9('0x24')](_0x5620a5,_0xf0e9('0x22'));_0x8b5167[_0xf0e9('0x2b')]=_[_0xf0e9('0x2c')](_0x4f9e96['query']);_0x8b5167[_0xf0e9('0x2d')]=_[_0xf0e9('0x2e')](_0x8b5167['model'],_0x8b5167['query']);_0x5aac7f[_0xf0e9('0x2f')]=_[_0xf0e9('0x2e')](_0x8b5167['model'],qs[_0xf0e9('0x30')](_0x4f9e96[_0xf0e9('0x2b')][_0xf0e9('0x30')]));_0x5aac7f[_0xf0e9('0x2f')]=_0x5aac7f[_0xf0e9('0x2f')][_0xf0e9('0x31')]?_0x5aac7f[_0xf0e9('0x2f')]:_0x8b5167[_0xf0e9('0x2a')];if(!_0x4f9e96['query'][_0xf0e9('0x32')](_0xf0e9('0x33'))){_0x5aac7f['limit']=qs[_0xf0e9('0x1a')](_0x4f9e96['query'][_0xf0e9('0x1a')]);_0x5aac7f['offset']=qs['offset'](_0x4f9e96[_0xf0e9('0x2b')][_0xf0e9('0x19')]);}_0x5aac7f[_0xf0e9('0x34')]=qs[_0xf0e9('0x35')](_0x4f9e96[_0xf0e9('0x2b')][_0xf0e9('0x35')]);_0x5aac7f['where']=qs[_0xf0e9('0x2d')](_[_0xf0e9('0x36')](_0x4f9e96[_0xf0e9('0x2b')],_0x8b5167['filters']),_0x5620a5);if(_0x4f9e96[_0xf0e9('0x2b')][_0xf0e9('0x37')]){_0x5aac7f[_0xf0e9('0x38')]=_[_0xf0e9('0x39')](_0x5aac7f[_0xf0e9('0x38')],{'$or':_[_0xf0e9('0x24')](_0x5620a5,function(_0xd20a18){if(_0xd20a18[_0xf0e9('0x28')]!==_0xf0e9('0x3a')){var _0x346250={};_0x346250[_0xd20a18['name']]={'$like':'%'+_0x4f9e96[_0xf0e9('0x2b')][_0xf0e9('0x37')]+'%'};return _0x346250;}})});}_0x5aac7f=_['merge']({},_0x5aac7f,_0x4f9e96[_0xf0e9('0x3b')]);var _0x36c0e0={'where':_0x5aac7f[_0xf0e9('0x38')]};return db[_0xf0e9('0x25')][_0xf0e9('0x18')](_0x36c0e0)['then'](function(_0xc5ab58){_0x8fd443[_0xf0e9('0x18')]=_0xc5ab58;if(_0x4f9e96['query'][_0xf0e9('0x3c')]){_0x5aac7f['include']=[{'all':!![]}];}return db[_0xf0e9('0x25')]['findAll'](_0x5aac7f);})[_0xf0e9('0x1e')](function(_0xf7c1b5){_0x8fd443['rows']=_0xf7c1b5;return _0x8fd443;})[_0xf0e9('0x1e')](respondWithFilteredResult(_0x553788,_0x5aac7f))['catch'](handleError(_0x553788,null));};exports['show']=function(_0x4bad5b,_0x3935d8){var _0x36d96e={'raw':!![],'where':{'id':_0x4bad5b[_0xf0e9('0x3d')]['id']}},_0x13975e={};_0x13975e['model']=_[_0xf0e9('0x2c')](db[_0xf0e9('0x25')]['rawAttributes']);_0x13975e['query']=_[_0xf0e9('0x2c')](_0x4bad5b[_0xf0e9('0x2b')]);_0x13975e[_0xf0e9('0x2d')]=_[_0xf0e9('0x2e')](_0x13975e[_0xf0e9('0x2a')],_0x13975e['query']);_0x36d96e[_0xf0e9('0x2f')]=_[_0xf0e9('0x2e')](_0x13975e[_0xf0e9('0x2a')],qs[_0xf0e9('0x30')](_0x4bad5b[_0xf0e9('0x2b')][_0xf0e9('0x30')]));_0x36d96e[_0xf0e9('0x2f')]=_0x36d96e['attributes'][_0xf0e9('0x31')]?_0x36d96e[_0xf0e9('0x2f')]:_0x13975e[_0xf0e9('0x2a')];if(_0x4bad5b[_0xf0e9('0x2b')]['includeAll']){_0x36d96e[_0xf0e9('0x3e')]=[{'all':!![]}];}_0x36d96e=_[_0xf0e9('0x39')]({},_0x36d96e,_0x4bad5b[_0xf0e9('0x3b')]);return db['CmHopperFinal'][_0xf0e9('0x3f')](_0x36d96e)[_0xf0e9('0x1e')](handleEntityNotFound(_0x3935d8,null))[_0xf0e9('0x1e')](respondWithResult(_0x3935d8,null))[_0xf0e9('0x40')](handleError(_0x3935d8,null));};exports[_0xf0e9('0x41')]=function(_0xe3a44f,_0x25f741){return db[_0xf0e9('0x25')][_0xf0e9('0x41')]()[_0xf0e9('0x1e')](respondWithResult(_0x25f741,null))[_0xf0e9('0x40')](handleError(_0x25f741,null));};exports[_0xf0e9('0x42')]=function(_0x317419,_0x26ea90){if(_0x317419[_0xf0e9('0x43')][_0xf0e9('0x44')]){delete _0x317419[_0xf0e9('0x43')][_0xf0e9('0x44')];}return db[_0xf0e9('0x25')][_0xf0e9('0x3f')]({'where':{'uniqueid':_0x317419[_0xf0e9('0x3d')]['id']}})[_0xf0e9('0x1e')](handleEntityNotFound(_0x26ea90,null))[_0xf0e9('0x1e')](saveUpdates(_0x317419[_0xf0e9('0x43')],null))[_0xf0e9('0x1e')](respondWithResult(_0x26ea90,null))[_0xf0e9('0x40')](handleError(_0x26ea90,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x3b82d8,_0x2ea9e0,_0x4b750e){return db[_0xf0e9('0x25')][_0xf0e9('0x45')]({'raw':![],'where':{'VoiceQueueId':_0x3b82d8[_0xf0e9('0x3d')]['id']},'attributes':[[db[_0xf0e9('0x46')]['fn'](_0xf0e9('0x47'),db['sequelize']['fn']('IF',db[_0xf0e9('0x46')]['literal'](_0xf0e9('0x48')))),'noSuchContacts'],[db[_0xf0e9('0x46')]['fn'](_0xf0e9('0x47'),db[_0xf0e9('0x46')]['fn']('IF',db[_0xf0e9('0x46')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0xf0e9('0x49')],[db['sequelize']['fn'](_0xf0e9('0x47'),db[_0xf0e9('0x46')]['fn']('IF',db['sequelize'][_0xf0e9('0x4a')]('`state`\x20=\x205,\x201,\x20null'))),_0xf0e9('0x4b')],[db['sequelize']['fn'](_0xf0e9('0x47'),db['sequelize']['fn']('IF',db[_0xf0e9('0x46')][_0xf0e9('0x4a')](_0xf0e9('0x4c')))),_0xf0e9('0x4d')],[db['sequelize']['fn'](_0xf0e9('0x47'),db['sequelize']['fn']('IF',db[_0xf0e9('0x46')]['literal'](_0xf0e9('0x4e')))),_0xf0e9('0x4f')],[db[_0xf0e9('0x46')]['fn'](_0xf0e9('0x47'),db['sequelize']['fn']('IF',db[_0xf0e9('0x46')]['literal'](_0xf0e9('0x50')))),'abandonedContacts'],[db[_0xf0e9('0x46')]['fn'](_0xf0e9('0x47'),db[_0xf0e9('0x46')]['fn']('IF',db[_0xf0e9('0x46')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0xf0e9('0x51')],[db[_0xf0e9('0x46')]['fn'](_0xf0e9('0x47'),db[_0xf0e9('0x46')]['fn']('IF',db[_0xf0e9('0x46')][_0xf0e9('0x4a')](_0xf0e9('0x52')))),_0xf0e9('0x53')]]})[_0xf0e9('0x1e')](handleEntityNotFound(_0x2ea9e0,null))[_0xf0e9('0x1e')](respondWithResult(_0x2ea9e0,null))[_0xf0e9('0x40')](handleError(_0x2ea9e0,null));};exports[_0xf0e9('0x54')]=function(_0xd7c77c,_0x1794b6,_0x5d9ebb){return db['CmHopperFinal'][_0xf0e9('0x45')]({'raw':![],'where':{'CampaignId':_0xd7c77c['params']['id']},'attributes':[[db[_0xf0e9('0x46')]['fn'](_0xf0e9('0x47'),db['sequelize']['fn']('IF',db[_0xf0e9('0x46')][_0xf0e9('0x4a')](_0xf0e9('0x48')))),_0xf0e9('0x55')],[db[_0xf0e9('0x46')]['fn'](_0xf0e9('0x47'),db[_0xf0e9('0x46')]['fn']('IF',db[_0xf0e9('0x46')][_0xf0e9('0x4a')](_0xf0e9('0x56')))),'noAnswerContacts'],[db[_0xf0e9('0x46')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf0e9('0x46')][_0xf0e9('0x4a')](_0xf0e9('0x57')))),'busyContacts'],[db[_0xf0e9('0x46')]['fn'](_0xf0e9('0x47'),db['sequelize']['fn']('IF',db['sequelize'][_0xf0e9('0x4a')](_0xf0e9('0x4c')))),_0xf0e9('0x4d')],[db[_0xf0e9('0x46')]['fn'](_0xf0e9('0x47'),db['sequelize']['fn']('IF',db[_0xf0e9('0x46')][_0xf0e9('0x4a')](_0xf0e9('0x4e')))),'dropContacts'],[db[_0xf0e9('0x46')]['fn']('COUNT',db[_0xf0e9('0x46')]['fn']('IF',db[_0xf0e9('0x46')]['literal'](_0xf0e9('0x50')))),_0xf0e9('0x58')],[db[_0xf0e9('0x46')]['fn'](_0xf0e9('0x47'),db[_0xf0e9('0x46')]['fn']('IF',db[_0xf0e9('0x46')][_0xf0e9('0x4a')](_0xf0e9('0x59')))),_0xf0e9('0x51')],[db[_0xf0e9('0x46')]['fn'](_0xf0e9('0x47'),db[_0xf0e9('0x46')]['fn']('IF',db['sequelize'][_0xf0e9('0x4a')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})['then'](handleEntityNotFound(_0x1794b6,null))[_0xf0e9('0x1e')](respondWithResult(_0x1794b6,null))[_0xf0e9('0x40')](handleError(_0x1794b6,null));};exports[_0xf0e9('0x5a')]=function(_0x4955a5,_0x2bfd7e,_0x490260){return db[_0xf0e9('0x5b')][_0xf0e9('0x3f')]({'where':{'id':_0x4955a5[_0xf0e9('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2bfd7e,null))[_0xf0e9('0x1e')](function(_0x134aa7){var _0x13f6f9;if(_0x134aa7){_0x13f6f9=squel[_0xf0e9('0x5c')]()[_0xf0e9('0x5d')](_0xf0e9('0x5e'))[_0xf0e9('0x5f')]([_0xf0e9('0x60'),'scheduledAt',_0xf0e9('0x61'),'ListId',_0xf0e9('0x62'),_0xf0e9('0x63'),'updatedAt'],squel['select']()[_0xf0e9('0x64')](_0xf0e9('0x65'),'phone')['field'](_0xf0e9('0x66'),_0xf0e9('0x67'))[_0xf0e9('0x64')](_0xf0e9('0x68'),_0xf0e9('0x61'))[_0xf0e9('0x64')](_0xf0e9('0x69'),_0xf0e9('0x6a'))[_0xf0e9('0x64')](_0xf0e9('0x6b'),_0xf0e9('0x62'))[_0xf0e9('0x64')]('NOW()','createdAt')[_0xf0e9('0x64')](_0xf0e9('0x66'),'updatedAt')[_0xf0e9('0x6c')](_0xf0e9('0x6d'))[_0xf0e9('0x38')]('VoiceQueueId\x20=\x20?',_0x4955a5['params']['id']['toString']())['where'](_0xf0e9('0x6e'),_0x4955a5[_0xf0e9('0x43')][_0xf0e9('0x6f')][_0xf0e9('0x70')]())[_0xf0e9('0x38')](_0xf0e9('0x71'))['where'](_0xf0e9('0x72'),squel[_0xf0e9('0x73')]()['field'](_0xf0e9('0x60'))[_0xf0e9('0x6c')](_0xf0e9('0x5e'))[_0xf0e9('0x38')](_0xf0e9('0x74'),_0x4955a5[_0xf0e9('0x3d')]['id'][_0xf0e9('0x70')]()))['where'](_0xf0e9('0x72'),squel[_0xf0e9('0x73')]()[_0xf0e9('0x64')]('calleridnum')[_0xf0e9('0x6c')](_0xf0e9('0x6d'))[_0xf0e9('0x38')](_0xf0e9('0x74'),_0x4955a5[_0xf0e9('0x3d')]['id']['toString']())[_0xf0e9('0x38')](_0xf0e9('0x75')))[_0xf0e9('0x76')](_0xf0e9('0x61')))[_0xf0e9('0x70')]();return db[_0xf0e9('0x46')][_0xf0e9('0x2b')](_0x13f6f9);}return[];})['then'](respondWithResult(_0x2bfd7e,null))[_0xf0e9('0x40')](handleError(_0x2bfd7e,null));};exports[_0xf0e9('0x77')]=function(_0x4bd24f,_0x470228,_0x5309cd){return db[_0xf0e9('0x78')][_0xf0e9('0x3f')]({'where':{'id':_0x4bd24f[_0xf0e9('0x3d')]['id']}})[_0xf0e9('0x1e')](handleEntityNotFound(_0x470228,null))['then'](function(_0x5644c0){var _0x3ccc3a;if(_0x5644c0){_0x3ccc3a=squel['insert']()[_0xf0e9('0x5d')](_0xf0e9('0x5e'))[_0xf0e9('0x5f')]([_0xf0e9('0x60'),_0xf0e9('0x67'),_0xf0e9('0x61'),_0xf0e9('0x6a'),_0xf0e9('0x79'),'createdAt',_0xf0e9('0x7a')],squel['select']()[_0xf0e9('0x64')]('ANY_VALUE(calleridnum)',_0xf0e9('0x60'))[_0xf0e9('0x64')](_0xf0e9('0x66'),'scheduledAt')[_0xf0e9('0x64')]('ANY_VALUE(ContactId)',_0xf0e9('0x61'))['field'](_0xf0e9('0x69'),'ListId')[_0xf0e9('0x64')](_0xf0e9('0x7b'),_0xf0e9('0x79'))['field'](_0xf0e9('0x66'),_0xf0e9('0x63'))['field']('NOW()','updatedAt')[_0xf0e9('0x6c')](_0xf0e9('0x6d'))[_0xf0e9('0x38')](_0xf0e9('0x7c'),_0x4bd24f[_0xf0e9('0x3d')]['id']['toString']())[_0xf0e9('0x38')]('state\x20=\x20?',_0x4bd24f['body'][_0xf0e9('0x6f')][_0xf0e9('0x70')]())[_0xf0e9('0x38')](_0xf0e9('0x71'))[_0xf0e9('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xf0e9('0x73')]()['field']('phone')['from'](_0xf0e9('0x5e'))['where'](_0xf0e9('0x7c'),_0x4bd24f['params']['id'][_0xf0e9('0x70')]()))[_0xf0e9('0x38')](_0xf0e9('0x72'),squel[_0xf0e9('0x73')]()[_0xf0e9('0x64')](_0xf0e9('0x7d'))['from'](_0xf0e9('0x6d'))[_0xf0e9('0x38')](_0xf0e9('0x7c'),_0x4bd24f[_0xf0e9('0x3d')]['id'][_0xf0e9('0x70')]())['where'](_0xf0e9('0x75')))['group'](_0xf0e9('0x61')))[_0xf0e9('0x70')]();return db[_0xf0e9('0x46')][_0xf0e9('0x2b')](_0x3ccc3a);}return[];})['then'](respondWithResult(_0x470228,null))[_0xf0e9('0x40')](handleError(_0x470228,null));};exports['checkContactHopper']=function(_0x8f83ae,_0x35772b,_0x194baf){return db['CmHopper'][_0xf0e9('0x7e')]({'where':{'VoiceQueueId':_0x8f83ae[_0xf0e9('0x43')][_0xf0e9('0x62')],'CampaignId':_0x8f83ae[_0xf0e9('0x43')][_0xf0e9('0x79')],'ContactId':_0x8f83ae['body']['ContactId']}})[_0xf0e9('0x1e')](handleEntityNotFound(_0x35772b,null))[_0xf0e9('0x1e')](function(_0x223f69){if(_0x223f69){return _0x223f69;}return null;})[_0xf0e9('0x1e')](respondWithResult(_0x35772b,null))['catch'](handleError(_0x35772b,null));}; \ No newline at end of file +var _0x34e8=['NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','createdAt','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','cm_hopper_final','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','cm_hopper','CampaignId','select','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','group','checkContactHopper','CmHopper','findOne','html-pdf','eml-format','rimraf','zip-dir','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','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','include','CmHopperFinal','findAll','rows','catch','params','includeAll','find','describe','update','body','uniqueid','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','insert','into','phone','scheduledAt','ContactId','ListId','VoiceQueueId','updatedAt','field','ANY_VALUE(calleridnum)'];(function(_0x4bc221,_0x51adfe){var _0x188462=function(_0x147bee){while(--_0x147bee){_0x4bc221['push'](_0x4bc221['shift']());}};_0x188462(++_0x51adfe);}(_0x34e8,0x12c));var _0x834e=function(_0x10dc22,_0x154943){_0x10dc22=_0x10dc22-0x0;var _0x2be71a=_0x34e8[_0x10dc22];return _0x2be71a;};'use strict';var pdf=require(_0x834e('0x0'));var emlformat=require(_0x834e('0x1'));var rimraf=require(_0x834e('0x2'));var zipdir=require(_0x834e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x834e('0x4'));var moment=require(_0x834e('0x5'));var BPromise=require(_0x834e('0x6'));var Mustache=require(_0x834e('0x7'));var util=require(_0x834e('0x8'));var path=require(_0x834e('0x9'));var sox=require(_0x834e('0xa'));var csv=require('to-csv');var ejs=require(_0x834e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0x10'));var querystring=require(_0x834e('0x11'));var Papa=require(_0x834e('0x12'));var Redis=require(_0x834e('0x13'));var authService=require(_0x834e('0x14'));var qs=require(_0x834e('0x15'));var as=require(_0x834e('0x16'));var hardwareService=require(_0x834e('0x17'));var logger=require(_0x834e('0x18'))(_0x834e('0x19'));var utils=require(_0x834e('0x1a'));var config=require(_0x834e('0x1b'));var licenseUtil=require(_0x834e('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1e')](_0x6cd9b9)[_0x834e('0x1f')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1e')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=_0x38a8cd[_0x834e('0x20')],_0x478afe=_0x4a9cdc['offset'],_0x43ac41=_0x4a9cdc[_0x834e('0x21')]+_0x4a9cdc[_0x834e('0x22')],_0x22106e;if(_0x43ac41>=_0x36d443){_0x43ac41=_0x36d443;_0x22106e=0xc8;}else{_0x22106e=0xce;}_0x316205[_0x834e('0x1e')](_0x22106e);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x478afe+'-'+_0x43ac41+'/'+_0x36d443)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x1dd214){return function(_0x595515){try{jsonpatch[_0x834e('0x26')](_0x595515,_0x1dd214,!![]);}catch(_0x1fd2c6){return BPromise[_0x834e('0x27')](_0x1fd2c6);}return _0x595515[_0x834e('0x28')]();};}function saveUpdates(_0x4ab05d,_0x45a630){return function(_0x62f8f1){if(_0x62f8f1){return _0x62f8f1['update'](_0x4ab05d)[_0x834e('0x29')](function(_0x28d687){return _0x28d687;});}return null;};}function removeEntity(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x2a')]()[_0x834e('0x29')](function(){_0x8d406e['status'](0xcc)[_0x834e('0x1f')]();});}};}function handleEntityNotFound(_0x1dc1e0,_0x58f4fd){return function(_0x3bc4f7){if(!_0x3bc4f7){_0x1dc1e0[_0x834e('0x1d')](0x194);}return _0x3bc4f7;};}function handleError(_0x338636,_0x561cd2){_0x561cd2=_0x561cd2||0x1f4;return function(_0x24fcf7){logger[_0x834e('0x2b')](_0x24fcf7['stack']);if(_0x24fcf7['name']){delete _0x24fcf7[_0x834e('0x2c')];}_0x338636['status'](_0x561cd2)[_0x834e('0x2d')](_0x24fcf7);};}exports[_0x834e('0x2e')]=function(_0x3db026,_0x2cc2eb){var _0x3cd928={},_0x130cc5={},_0x491919={'count':0x0,'rows':[]};var _0x510780=_['map'](db['CmHopperFinal'][_0x834e('0x2f')],function(_0x567cea){return{'name':_0x567cea[_0x834e('0x30')],'type':_0x567cea['type'][_0x834e('0x31')]};});_0x130cc5[_0x834e('0x32')]=_[_0x834e('0x33')](_0x510780,_0x834e('0x2c'));_0x130cc5[_0x834e('0x34')]=_[_0x834e('0x35')](_0x3db026[_0x834e('0x34')]);_0x130cc5[_0x834e('0x36')]=_[_0x834e('0x37')](_0x130cc5['model'],_0x130cc5[_0x834e('0x34')]);_0x3cd928['attributes']=_[_0x834e('0x37')](_0x130cc5[_0x834e('0x32')],qs[_0x834e('0x38')](_0x3db026[_0x834e('0x34')][_0x834e('0x38')]));_0x3cd928[_0x834e('0x39')]=_0x3cd928[_0x834e('0x39')][_0x834e('0x3a')]?_0x3cd928[_0x834e('0x39')]:_0x130cc5[_0x834e('0x32')];if(!_0x3db026['query'][_0x834e('0x3b')](_0x834e('0x3c'))){_0x3cd928[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x3db026['query'][_0x834e('0x22')]);_0x3cd928[_0x834e('0x21')]=qs['offset'](_0x3db026['query']['offset']);}_0x3cd928[_0x834e('0x3d')]=qs[_0x834e('0x3e')](_0x3db026[_0x834e('0x34')][_0x834e('0x3e')]);_0x3cd928[_0x834e('0x3f')]=qs[_0x834e('0x36')](_['pick'](_0x3db026[_0x834e('0x34')],_0x130cc5['filters']),_0x510780);if(_0x3db026[_0x834e('0x34')][_0x834e('0x40')]){_0x3cd928['where']=_[_0x834e('0x41')](_0x3cd928[_0x834e('0x3f')],{'$or':_['map'](_0x510780,function(_0x481f70){if(_0x481f70[_0x834e('0x42')]!==_0x834e('0x43')){var _0x2e9383={};_0x2e9383[_0x481f70[_0x834e('0x2c')]]={'$like':'%'+_0x3db026[_0x834e('0x34')]['filter']+'%'};return _0x2e9383;}})});}_0x3cd928=_[_0x834e('0x41')]({},_0x3cd928,_0x3db026['options']);var _0x50c243={'where':_0x3cd928[_0x834e('0x3f')]};return db['CmHopperFinal'][_0x834e('0x20')](_0x50c243)[_0x834e('0x29')](function(_0x16aea6){_0x491919[_0x834e('0x20')]=_0x16aea6;if(_0x3db026[_0x834e('0x34')]['includeAll']){_0x3cd928[_0x834e('0x44')]=[{'all':!![]}];}return db[_0x834e('0x45')][_0x834e('0x46')](_0x3cd928);})['then'](function(_0x35380e){_0x491919[_0x834e('0x47')]=_0x35380e;return _0x491919;})['then'](respondWithFilteredResult(_0x2cc2eb,_0x3cd928))[_0x834e('0x48')](handleError(_0x2cc2eb,null));};exports['show']=function(_0x2ebfb6,_0x585335){var _0x4a18bb={'raw':!![],'where':{'id':_0x2ebfb6[_0x834e('0x49')]['id']}},_0x4a6942={};_0x4a6942[_0x834e('0x32')]=_[_0x834e('0x35')](db[_0x834e('0x45')][_0x834e('0x2f')]);_0x4a6942[_0x834e('0x34')]=_[_0x834e('0x35')](_0x2ebfb6['query']);_0x4a6942[_0x834e('0x36')]=_['intersection'](_0x4a6942[_0x834e('0x32')],_0x4a6942['query']);_0x4a18bb[_0x834e('0x39')]=_['intersection'](_0x4a6942[_0x834e('0x32')],qs[_0x834e('0x38')](_0x2ebfb6['query'][_0x834e('0x38')]));_0x4a18bb[_0x834e('0x39')]=_0x4a18bb[_0x834e('0x39')][_0x834e('0x3a')]?_0x4a18bb[_0x834e('0x39')]:_0x4a6942[_0x834e('0x32')];if(_0x2ebfb6[_0x834e('0x34')][_0x834e('0x4a')]){_0x4a18bb[_0x834e('0x44')]=[{'all':!![]}];}_0x4a18bb=_[_0x834e('0x41')]({},_0x4a18bb,_0x2ebfb6['options']);return db[_0x834e('0x45')][_0x834e('0x4b')](_0x4a18bb)['then'](handleEntityNotFound(_0x585335,null))[_0x834e('0x29')](respondWithResult(_0x585335,null))[_0x834e('0x48')](handleError(_0x585335,null));};exports[_0x834e('0x4c')]=function(_0x2112d5,_0x19b5ef){return db[_0x834e('0x45')]['describe']()['then'](respondWithResult(_0x19b5ef,null))[_0x834e('0x48')](handleError(_0x19b5ef,null));};exports[_0x834e('0x4d')]=function(_0x30568e,_0x40ff5a){if(_0x30568e[_0x834e('0x4e')][_0x834e('0x4f')]){delete _0x30568e[_0x834e('0x4e')][_0x834e('0x4f')];}return db[_0x834e('0x45')][_0x834e('0x4b')]({'where':{'uniqueid':_0x30568e[_0x834e('0x49')]['id']}})[_0x834e('0x29')](handleEntityNotFound(_0x40ff5a,null))[_0x834e('0x29')](saveUpdates(_0x30568e[_0x834e('0x4e')],null))[_0x834e('0x29')](respondWithResult(_0x40ff5a,null))[_0x834e('0x48')](handleError(_0x40ff5a,null));};exports[_0x834e('0x50')]=function(_0x32b8f7,_0x420841,_0x1adf86){return db['CmHopperFinal'][_0x834e('0x46')]({'raw':![],'where':{'VoiceQueueId':_0x32b8f7[_0x834e('0x49')]['id']},'attributes':[[db['sequelize']['fn'](_0x834e('0x51'),db[_0x834e('0x52')]['fn']('IF',db['sequelize'][_0x834e('0x53')](_0x834e('0x54')))),_0x834e('0x55')],[db[_0x834e('0x52')]['fn'](_0x834e('0x51'),db[_0x834e('0x52')]['fn']('IF',db[_0x834e('0x52')]['literal'](_0x834e('0x56')))),_0x834e('0x57')],[db[_0x834e('0x52')]['fn'](_0x834e('0x51'),db[_0x834e('0x52')]['fn']('IF',db[_0x834e('0x52')][_0x834e('0x53')](_0x834e('0x58')))),'busyContacts'],[db[_0x834e('0x52')]['fn']('COUNT',db[_0x834e('0x52')]['fn']('IF',db['sequelize'][_0x834e('0x53')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x834e('0x52')]['fn'](_0x834e('0x51'),db['sequelize']['fn']('IF',db['sequelize'][_0x834e('0x53')](_0x834e('0x59')))),_0x834e('0x5a')],[db[_0x834e('0x52')]['fn'](_0x834e('0x51'),db[_0x834e('0x52')]['fn']('IF',db[_0x834e('0x52')][_0x834e('0x53')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x834e('0x5b')],[db[_0x834e('0x52')]['fn']('COUNT',db[_0x834e('0x52')]['fn']('IF',db['sequelize'][_0x834e('0x53')](_0x834e('0x5c')))),'reCallContacts'],[db[_0x834e('0x52')]['fn'](_0x834e('0x51'),db[_0x834e('0x52')]['fn']('IF',db[_0x834e('0x52')]['literal'](_0x834e('0x5d')))),_0x834e('0x5e')]]})[_0x834e('0x29')](handleEntityNotFound(_0x420841,null))['then'](respondWithResult(_0x420841,null))[_0x834e('0x48')](handleError(_0x420841,null));};exports[_0x834e('0x5f')]=function(_0x3a7683,_0x1a0cd0,_0x3183c5){return db[_0x834e('0x45')][_0x834e('0x46')]({'raw':![],'where':{'CampaignId':_0x3a7683[_0x834e('0x49')]['id']},'attributes':[[db[_0x834e('0x52')]['fn'](_0x834e('0x51'),db[_0x834e('0x52')]['fn']('IF',db[_0x834e('0x52')][_0x834e('0x53')](_0x834e('0x54')))),_0x834e('0x55')],[db[_0x834e('0x52')]['fn'](_0x834e('0x51'),db[_0x834e('0x52')]['fn']('IF',db[_0x834e('0x52')][_0x834e('0x53')](_0x834e('0x56')))),_0x834e('0x57')],[db['sequelize']['fn'](_0x834e('0x51'),db[_0x834e('0x52')]['fn']('IF',db[_0x834e('0x52')][_0x834e('0x53')]('`state`\x20=\x205,\x201,\x20null'))),_0x834e('0x60')],[db['sequelize']['fn']('COUNT',db[_0x834e('0x52')]['fn']('IF',db[_0x834e('0x52')][_0x834e('0x53')](_0x834e('0x61')))),_0x834e('0x62')],[db[_0x834e('0x52')]['fn'](_0x834e('0x51'),db[_0x834e('0x52')]['fn']('IF',db['sequelize'][_0x834e('0x53')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x834e('0x5a')],[db[_0x834e('0x52')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x834e('0x52')][_0x834e('0x53')](_0x834e('0x63')))),_0x834e('0x5b')],[db[_0x834e('0x52')]['fn']('COUNT',db[_0x834e('0x52')]['fn']('IF',db[_0x834e('0x52')][_0x834e('0x53')](_0x834e('0x5c')))),_0x834e('0x64')],[db[_0x834e('0x52')]['fn'](_0x834e('0x51'),db[_0x834e('0x52')]['fn']('IF',db[_0x834e('0x52')][_0x834e('0x53')]('`state`\x20=\x2019,\x201,\x20null'))),_0x834e('0x5e')]]})[_0x834e('0x29')](handleEntityNotFound(_0x1a0cd0,null))[_0x834e('0x29')](respondWithResult(_0x1a0cd0,null))[_0x834e('0x48')](handleError(_0x1a0cd0,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x46fa0d,_0x4ac5f2,_0x5ce8b0){return db['VoiceQueue'][_0x834e('0x4b')]({'where':{'id':_0x46fa0d[_0x834e('0x49')]['id']}})['then'](handleEntityNotFound(_0x4ac5f2,null))[_0x834e('0x29')](function(_0x1b200d){var _0x4d4477;if(_0x1b200d){_0x4d4477=squel[_0x834e('0x65')]()[_0x834e('0x66')]('cm_hopper')['fromQuery']([_0x834e('0x67'),_0x834e('0x68'),_0x834e('0x69'),_0x834e('0x6a'),_0x834e('0x6b'),'createdAt',_0x834e('0x6c')],squel['select']()[_0x834e('0x6d')](_0x834e('0x6e'),_0x834e('0x67'))['field'](_0x834e('0x6f'),_0x834e('0x68'))['field'](_0x834e('0x70'),_0x834e('0x69'))[_0x834e('0x6d')]('ANY_VALUE(ListId)',_0x834e('0x6a'))[_0x834e('0x6d')](_0x834e('0x71'),_0x834e('0x6b'))[_0x834e('0x6d')](_0x834e('0x6f'),_0x834e('0x72'))[_0x834e('0x6d')](_0x834e('0x6f'),_0x834e('0x6c'))['from']('cm_hopper_final')['where'](_0x834e('0x73'),_0x46fa0d[_0x834e('0x49')]['id'][_0x834e('0x74')]())[_0x834e('0x3f')](_0x834e('0x75'),_0x46fa0d['body']['state'][_0x834e('0x74')]())[_0x834e('0x3f')](_0x834e('0x76'))[_0x834e('0x3f')](_0x834e('0x77'),squel['select']()[_0x834e('0x6d')](_0x834e('0x67'))[_0x834e('0x78')]('cm_hopper')[_0x834e('0x3f')](_0x834e('0x73'),_0x46fa0d[_0x834e('0x49')]['id'][_0x834e('0x74')]()))[_0x834e('0x3f')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x834e('0x6d')](_0x834e('0x79'))['from'](_0x834e('0x7a'))['where'](_0x834e('0x73'),_0x46fa0d[_0x834e('0x49')]['id'][_0x834e('0x74')]())['where'](_0x834e('0x7b')))['group']('ContactId'))['toString']();return db[_0x834e('0x52')][_0x834e('0x34')](_0x4d4477);}return[];})[_0x834e('0x29')](respondWithResult(_0x4ac5f2,null))[_0x834e('0x48')](handleError(_0x4ac5f2,null));};exports[_0x834e('0x7c')]=function(_0x2dad55,_0x3aa388,_0x179892){return db[_0x834e('0x7d')]['find']({'where':{'id':_0x2dad55[_0x834e('0x49')]['id']}})['then'](handleEntityNotFound(_0x3aa388,null))[_0x834e('0x29')](function(_0x97c1a6){var _0x38bfa4;if(_0x97c1a6){_0x38bfa4=squel[_0x834e('0x65')]()[_0x834e('0x66')](_0x834e('0x7e'))['fromQuery'](['phone',_0x834e('0x68'),_0x834e('0x69'),'ListId',_0x834e('0x7f'),_0x834e('0x72'),_0x834e('0x6c')],squel[_0x834e('0x80')]()[_0x834e('0x6d')]('ANY_VALUE(calleridnum)',_0x834e('0x67'))[_0x834e('0x6d')]('NOW()','scheduledAt')['field'](_0x834e('0x70'),_0x834e('0x69'))['field'](_0x834e('0x81'),_0x834e('0x6a'))['field'](_0x834e('0x82'),'CampaignId')['field'](_0x834e('0x6f'),_0x834e('0x72'))[_0x834e('0x6d')](_0x834e('0x6f'),'updatedAt')[_0x834e('0x78')](_0x834e('0x7a'))[_0x834e('0x3f')](_0x834e('0x83'),_0x2dad55[_0x834e('0x49')]['id'][_0x834e('0x74')]())[_0x834e('0x3f')](_0x834e('0x75'),_0x2dad55[_0x834e('0x4e')][_0x834e('0x84')][_0x834e('0x74')]())[_0x834e('0x3f')](_0x834e('0x76'))[_0x834e('0x3f')](_0x834e('0x77'),squel[_0x834e('0x80')]()[_0x834e('0x6d')](_0x834e('0x67'))[_0x834e('0x78')](_0x834e('0x7e'))[_0x834e('0x3f')](_0x834e('0x83'),_0x2dad55['params']['id'][_0x834e('0x74')]()))[_0x834e('0x3f')](_0x834e('0x77'),squel[_0x834e('0x80')]()[_0x834e('0x6d')](_0x834e('0x79'))[_0x834e('0x78')](_0x834e('0x7a'))[_0x834e('0x3f')]('CampaignId\x20=\x20?',_0x2dad55['params']['id']['toString']())[_0x834e('0x3f')]('state\x20=\x204'))[_0x834e('0x85')](_0x834e('0x69')))[_0x834e('0x74')]();return db['sequelize'][_0x834e('0x34')](_0x38bfa4);}return[];})[_0x834e('0x29')](respondWithResult(_0x3aa388,null))[_0x834e('0x48')](handleError(_0x3aa388,null));};exports[_0x834e('0x86')]=function(_0x3ef0ad,_0x473e89,_0x528052){return db[_0x834e('0x87')][_0x834e('0x88')]({'where':{'VoiceQueueId':_0x3ef0ad[_0x834e('0x4e')][_0x834e('0x6b')],'CampaignId':_0x3ef0ad[_0x834e('0x4e')]['CampaignId'],'ContactId':_0x3ef0ad['body']['ContactId']}})['then'](handleEntityNotFound(_0x473e89,null))[_0x834e('0x29')](function(_0x2ccdde){if(_0x2ccdde){return _0x2ccdde;}return null;})['then'](respondWithResult(_0x473e89,null))[_0x834e('0x48')](handleError(_0x473e89,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index f6ab264..15947a0 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 _0x5eae=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5eae,0x137));var _0xe5ea=function(_0x2d2b7d,_0x82ce5f){_0x2d2b7d=_0x2d2b7d-0x0;var _0x4efe2f=_0x5eae[_0x2d2b7d];return _0x4efe2f;};'use strict';var _=require(_0xe5ea('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe5ea('0x1'));var BPromise=require(_0xe5ea('0x2'));var rp=require(_0xe5ea('0x3'));var fs=require('fs');var path=require(_0xe5ea('0x4'));var rimraf=require(_0xe5ea('0x5'));var config=require(_0xe5ea('0x6'));var attributes=require('./cmHopperFinal.attributes');module[_0xe5ea('0x7')]=function(_0x3780ad,_0x44a152){return _0x3780ad[_0xe5ea('0x8')](_0xe5ea('0x9'),attributes,{'tableName':_0xe5ea('0xa'),'paranoid':![],'indexes':[{'name':_0xe5ea('0xb'),'fields':[_0xe5ea('0xb')]},{'name':_0xe5ea('0xc'),'fields':[_0xe5ea('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3b94=['calleridnum','uniqueid','lodash','util','api','moment','path','rimraf','../../config/environment','./cmHopperFinal.attributes','CmHopperFinal','cm_hopper_final'];(function(_0x39e487,_0x13b3de){var _0x187394=function(_0xbfe7d){while(--_0xbfe7d){_0x39e487['push'](_0x39e487['shift']());}};_0x187394(++_0x13b3de);}(_0x3b94,0xf2));var _0x43b9=function(_0x426396,_0xb585c9){_0x426396=_0x426396-0x0;var _0x540f26=_0x3b94[_0x426396];return _0x540f26;};'use strict';var _=require(_0x43b9('0x0'));var util=require(_0x43b9('0x1'));var logger=require('../../config/logger')(_0x43b9('0x2'));var moment=require(_0x43b9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43b9('0x4'));var rimraf=require(_0x43b9('0x5'));var config=require(_0x43b9('0x6'));var attributes=require(_0x43b9('0x7'));module['exports']=function(_0x8f0c5b,_0x5b76d0){return _0x8f0c5b['define'](_0x43b9('0x8'),attributes,{'tableName':_0x43b9('0x9'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x43b9('0xa')]},{'name':_0x43b9('0xb'),'fields':[_0x43b9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 9174ef0..4812dbd 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 _0xdae5=['message','catch','CreateCmHopperFinal','create','options','raw','then','lodash','moment','ioredis','../../mysqldb','../../config/environment','http','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdae5,0x118));var _0x5dae=function(_0x5ae22c,_0x59fbfe){_0x5ae22c=_0x5ae22c-0x0;var _0x43fa63=_0xdae5[_0x5ae22c];return _0x43fa63;};'use strict';var _=require(_0x5dae('0x0'));var util=require('util');var moment=require(_0x5dae('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5dae('0x2'));var db=require(_0x5dae('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5dae('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5dae('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x512076,_0x3073fa,_0x4df2de){return new BPromise(function(_0x5533a9,_0x59ca5f){return client['request'](_0x512076,_0x4df2de)['then'](function(_0x4661e3){logger[_0x5dae('0x6')](_0x5dae('0x7'),_0x3073fa,_0x5dae('0x8'));logger[_0x5dae('0x9')](_0x5dae('0xa'),_0x3073fa,_0x5dae('0x8'),JSON[_0x5dae('0xb')](_0x4661e3));if(_0x4661e3[_0x5dae('0xc')]){if(_0x4661e3[_0x5dae('0xc')][_0x5dae('0xd')]===0x1f4){logger[_0x5dae('0xc')](_0x5dae('0x7'),_0x3073fa,_0x4661e3[_0x5dae('0xc')][_0x5dae('0xe')]);return _0x59ca5f(_0x4661e3['error'][_0x5dae('0xe')]);}logger[_0x5dae('0xc')](_0x5dae('0x7'),_0x3073fa,_0x4661e3['error'][_0x5dae('0xe')]);return _0x5533a9(_0x4661e3[_0x5dae('0xc')][_0x5dae('0xe')]);}else{logger[_0x5dae('0x6')](_0x5dae('0x7'),_0x3073fa,_0x5dae('0x8'));_0x5533a9(_0x4661e3['result']['message']);}})[_0x5dae('0xf')](function(_0x1f19a4){logger[_0x5dae('0xc')]('CmHopperFinal,\x20%s,\x20%s',_0x3073fa,_0x1f19a4);_0x59ca5f(_0x1f19a4);});});}exports[_0x5dae('0x10')]=function(_0x168545){var _0x34cca9=this;return new Promise(function(_0x425136,_0x3c12cf){return db['CmHopperFinal'][_0x5dae('0x11')](_0x168545['body'],{'raw':_0x168545[_0x5dae('0x12')]?_0x168545[_0x5dae('0x12')][_0x5dae('0x13')]===undefined?!![]:![]:!![]})[_0x5dae('0x14')](function(_0x238c94){logger['info']('CreateCmHopperFinal',_0x168545);logger[_0x5dae('0x9')](_0x5dae('0x10'),_0x168545,JSON['stringify'](_0x238c94));_0x425136(_0x238c94);})[_0x5dae('0xf')](function(_0x4919b7){logger[_0x5dae('0xc')]('CreateCmHopperFinal',_0x4919b7[_0x5dae('0xe')],_0x168545);_0x3c12cf(_0x34cca9['error'](0x1f4,_0x4919b7[_0x5dae('0xe')]));});});}; \ No newline at end of file +var _0xba04=['rpc','../../config/environment','client','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','error','message','catch','CmHopperFinal','create','body','options','CreateCmHopperFinal','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0xf738ad,_0x5e1d7f){var _0x598570=function(_0x35088e){while(--_0x35088e){_0xf738ad['push'](_0xf738ad['shift']());}};_0x598570(++_0x5e1d7f);}(_0xba04,0x85));var _0x4ba0=function(_0xb60643,_0x5a28f0){_0xb60643=_0xb60643-0x0;var _0x2375d3=_0xba04[_0xb60643];return _0x2375d3;};'use strict';var _=require('lodash');var util=require(_0x4ba0('0x0'));var moment=require('moment');var BPromise=require(_0x4ba0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ba0('0x2'));var db=require(_0x4ba0('0x3'))['db'];var utils=require(_0x4ba0('0x4'));var logger=require('../../config/logger')(_0x4ba0('0x5'));var config=require(_0x4ba0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4ba0('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a98cb,_0x1d09d2,_0x2d2636){return new BPromise(function(_0x120643,_0x59ca10){return client[_0x4ba0('0x8')](_0x2a98cb,_0x2d2636)[_0x4ba0('0x9')](function(_0x402430){logger[_0x4ba0('0xa')](_0x4ba0('0xb'),_0x1d09d2,_0x4ba0('0xc'));logger[_0x4ba0('0xd')](_0x4ba0('0xe'),_0x1d09d2,_0x4ba0('0xc'),JSON['stringify'](_0x402430));if(_0x402430[_0x4ba0('0xf')]){if(_0x402430[_0x4ba0('0xf')]['code']===0x1f4){logger[_0x4ba0('0xf')]('CmHopperFinal,\x20%s,\x20%s',_0x1d09d2,_0x402430[_0x4ba0('0xf')][_0x4ba0('0x10')]);return _0x59ca10(_0x402430[_0x4ba0('0xf')]['message']);}logger[_0x4ba0('0xf')](_0x4ba0('0xb'),_0x1d09d2,_0x402430[_0x4ba0('0xf')]['message']);return _0x120643(_0x402430['error'][_0x4ba0('0x10')]);}else{logger['info']('CmHopperFinal,\x20%s,\x20%s',_0x1d09d2,_0x4ba0('0xc'));_0x120643(_0x402430['result'][_0x4ba0('0x10')]);}})[_0x4ba0('0x11')](function(_0x475e13){logger[_0x4ba0('0xf')]('CmHopperFinal,\x20%s,\x20%s',_0x1d09d2,_0x475e13);_0x59ca10(_0x475e13);});});}exports['CreateCmHopperFinal']=function(_0x43e837){var _0x48967a=this;return new Promise(function(_0x5f38e6,_0x5ad559){return db[_0x4ba0('0x12')][_0x4ba0('0x13')](_0x43e837[_0x4ba0('0x14')],{'raw':_0x43e837[_0x4ba0('0x15')]?_0x43e837[_0x4ba0('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x4ba0('0x9')](function(_0xe691e1){logger[_0x4ba0('0xa')]('CreateCmHopperFinal',_0x43e837);logger[_0x4ba0('0xd')](_0x4ba0('0x16'),_0x43e837,JSON['stringify'](_0xe691e1));_0x5f38e6(_0xe691e1);})[_0x4ba0('0x11')](function(_0x42ab90){logger['error'](_0x4ba0('0x16'),_0x42ab90[_0x4ba0('0x10')],_0x43e837);_0x5ad559(_0x48967a[_0x4ba0('0xf')](0x1f4,_0x42ab90[_0x4ba0('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 94c8dc9..9dcd7d7 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 _0xec06=['update','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','/:id'];(function(_0x39e9f4,_0x28f56e){var _0x431a65=function(_0xbc1fc4){while(--_0xbc1fc4){_0x39e9f4['push'](_0x39e9f4['shift']());}};_0x431a65(++_0x28f56e);}(_0xec06,0x72));var _0x6ec0=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xec06[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x6ec0('0x0'));var util=require(_0x6ec0('0x1'));var path=require(_0x6ec0('0x2'));var timeout=require(_0x6ec0('0x3'));var express=require('express');var router=express[_0x6ec0('0x4')]();var auth=require(_0x6ec0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6ec0('0x6'));var controller=require(_0x6ec0('0x7'));router[_0x6ec0('0x8')]('/',auth[_0x6ec0('0x9')](),controller[_0x6ec0('0xa')]);router[_0x6ec0('0x8')]('/describe',auth[_0x6ec0('0x9')](),controller[_0x6ec0('0xb')]);router['get']('/:id',auth[_0x6ec0('0x9')](),controller[_0x6ec0('0xc')]);router['get'](_0x6ec0('0xd'),auth[_0x6ec0('0x9')](),controller[_0x6ec0('0xe')]);router['get'](_0x6ec0('0xf'),auth[_0x6ec0('0x9')](),controller[_0x6ec0('0x10')]);router[_0x6ec0('0x11')](_0x6ec0('0x12'),auth['isAuthenticated'](),controller[_0x6ec0('0x13')]);router[_0x6ec0('0x11')](_0x6ec0('0x14'),auth[_0x6ec0('0x9')](),controller[_0x6ec0('0x15')]);router['post'](_0x6ec0('0x16'),auth['isAuthenticated'](),controller[_0x6ec0('0x17')]);router[_0x6ec0('0x18')](_0x6ec0('0x19'),auth['isAuthenticated'](),controller[_0x6ec0('0x1a')]);module[_0x6ec0('0x1b')]=router; \ No newline at end of file +var _0xef0e=['/describe','get','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index'];(function(_0x129471,_0x27dd0d){var _0x63414=function(_0x304814){while(--_0x304814){_0x129471['push'](_0x129471['shift']());}};_0x63414(++_0x27dd0d);}(_0xef0e,0x72));var _0xeef0=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xef0e[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0xeef0('0x0'));var util=require(_0xeef0('0x1'));var path=require(_0xeef0('0x2'));var timeout=require(_0xeef0('0x3'));var express=require(_0xeef0('0x4'));var router=express[_0xeef0('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xeef0('0x6'));var config=require(_0xeef0('0x7'));var controller=require(_0xeef0('0x8'));router['get']('/',auth[_0xeef0('0x9')](),controller[_0xeef0('0xa')]);router['get'](_0xeef0('0xb'),auth[_0xeef0('0x9')](),controller['describe']);router[_0xeef0('0xc')](_0xeef0('0xd'),auth[_0xeef0('0x9')](),controller['show']);router[_0xeef0('0xc')](_0xeef0('0xe'),auth[_0xeef0('0x9')](),controller[_0xeef0('0xf')]);router['get']('/campaign/countAttributes/:id',auth[_0xeef0('0x9')](),controller[_0xeef0('0x10')]);router[_0xeef0('0x11')]('/voice/queue/moveContacts/:id',auth[_0xeef0('0x9')](),controller[_0xeef0('0x12')]);router['post'](_0xeef0('0x13'),auth[_0xeef0('0x9')](),controller[_0xeef0('0x14')]);router['post'](_0xeef0('0x15'),auth[_0xeef0('0x9')](),controller[_0xeef0('0x16')]);router[_0xeef0('0x17')]('/:id',auth[_0xeef0('0x9')](),controller[_0xeef0('0x18')]);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 e85870f..5c295bb 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 _0x4bbc=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4bbc,0x91));var _0xc4bb=function(_0x43f629,_0x16931c){_0x43f629=_0x43f629-0x0;var _0x2b25c6=_0x4bbc[_0x43f629];return _0x2b25c6;};'use strict';var Sequelize=require(_0xc4bb('0x0'));module[_0xc4bb('0x1')]={'state':{'type':Sequelize[_0xc4bb('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xc4bb('0x3')]},'scheduledat':{'type':Sequelize[_0xc4bb('0x4')]},'countbusyretry':{'type':Sequelize[_0xc4bb('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc4bb('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc4bb('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xc4bb('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xc4bb('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xc4bb('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc4bb('0x3')]},'calleridname':{'type':Sequelize[_0xc4bb('0x3')]},'starttime':{'type':Sequelize[_0xc4bb('0x4')]},'responsetime':{'type':Sequelize[_0xc4bb('0x4')]},'answertime':{'type':Sequelize[_0xc4bb('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xc4bb('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xc4bb('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xc4bb('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xc4bb('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xc4bb('0x3')]},'campaign':{'type':Sequelize[_0xc4bb('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xc4bb('0x3')]},'reason':{'type':Sequelize[_0xc4bb('0x3')]},'amd':{'type':Sequelize[_0xc4bb('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xc4bb('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xc4bb('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc4bb('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc4bb('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xc4bb('0x4')]},'edited':{'type':Sequelize[_0xc4bb('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xc4bb('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc4bb('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc4bb('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x62b2=['BOOLEAN','exports','INTEGER','STRING','DATE'];(function(_0x43b17d,_0x16eeee){var _0xd083fb=function(_0xc43030){while(--_0xc43030){_0x43b17d['push'](_0x43b17d['shift']());}};_0xd083fb(++_0x16eeee);}(_0x62b2,0x150));var _0x262b=function(_0x1715d0,_0x493c4d){_0x1715d0=_0x1715d0-0x0;var _0x56495a=_0x62b2[_0x1715d0];return _0x56495a;};'use strict';var Sequelize=require('sequelize');module[_0x262b('0x0')]={'state':{'type':Sequelize[_0x262b('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x262b('0x2')]},'scheduledat':{'type':Sequelize[_0x262b('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x262b('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x262b('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x262b('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x262b('0x2')]},'originatecalleridname':{'type':Sequelize[_0x262b('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x262b('0x3')]},'answertime':{'type':Sequelize[_0x262b('0x3')]},'droptime':{'type':Sequelize[_0x262b('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x262b('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x262b('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x262b('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x262b('0x2')]},'campaign':{'type':Sequelize[_0x262b('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x262b('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x262b('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x262b('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x262b('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x262b('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x262b('0x3')]},'recallme':{'type':Sequelize[_0x262b('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x262b('0x3')]},'edited':{'type':Sequelize[_0x262b('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x262b('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x262b('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x262b('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x262b('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 254dffc..d0fc7a9 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 _0xe1ae=['limit','set','Content-Range','reject','update','destroy','then','error','stack','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','keys','filters','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','show','include','find','create','describe','body','uniqueid','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset'];(function(_0x24af86,_0x8b1a57){var _0x21a99c=function(_0x430076){while(--_0x430076){_0x24af86['push'](_0x24af86['shift']());}};_0x21a99c(++_0x8b1a57);}(_0xe1ae,0x162));var _0xee1a=function(_0x271a80,_0x268bac){_0x271a80=_0x271a80-0x0;var _0xf8233e=_0xe1ae[_0x271a80];return _0xf8233e;};'use strict';var pdf=require(_0xee1a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xee1a('0x1'));var zipdir=require(_0xee1a('0x2'));var jsonpatch=require(_0xee1a('0x3'));var rp=require(_0xee1a('0x4'));var moment=require(_0xee1a('0x5'));var BPromise=require(_0xee1a('0x6'));var Mustache=require(_0xee1a('0x7'));var util=require('util');var path=require(_0xee1a('0x8'));var sox=require(_0xee1a('0x9'));var csv=require('to-csv');var ejs=require(_0xee1a('0xa'));var fs=require('fs');var _=require(_0xee1a('0xb'));var squel=require(_0xee1a('0xc'));var crypto=require(_0xee1a('0xd'));var jsforce=require(_0xee1a('0xe'));var deskjs=require(_0xee1a('0xf'));var toCsv=require(_0xee1a('0x10'));var querystring=require('querystring');var Papa=require(_0xee1a('0x11'));var Redis=require(_0xee1a('0x12'));var authService=require(_0xee1a('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee1a('0x14'));var logger=require(_0xee1a('0x15'))(_0xee1a('0x16'));var utils=require(_0xee1a('0x17'));var config=require(_0xee1a('0x18'));var licenseUtil=require(_0xee1a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48aa42,_0x4233c0){_0x4233c0=_0x4233c0||0xcc;return function(_0x3ee751){if(_0x3ee751){return _0x48aa42[_0xee1a('0x1a')](_0x4233c0);}return _0x48aa42[_0xee1a('0x1b')](_0x4233c0)[_0xee1a('0x1c')]();};}function respondWithResult(_0x2d46f,_0x5bc6d8){_0x5bc6d8=_0x5bc6d8||0xc8;return function(_0x4075c2){if(_0x4075c2){return _0x2d46f['status'](_0x5bc6d8)[_0xee1a('0x1d')](_0x4075c2);}};}function respondWithFilteredResult(_0x75e19f,_0x5875c6){return function(_0xc07321){if(_0xc07321){var _0x4c4777=_0xc07321['count'],_0x26dc11=_0x5875c6[_0xee1a('0x1e')],_0x12f212=_0x5875c6[_0xee1a('0x1e')]+_0x5875c6[_0xee1a('0x1f')],_0xa162db;if(_0x12f212>=_0x4c4777){_0x12f212=_0x4c4777;_0xa162db=0xc8;}else{_0xa162db=0xce;}_0x75e19f[_0xee1a('0x1b')](_0xa162db);return _0x75e19f[_0xee1a('0x20')](_0xee1a('0x21'),_0x26dc11+'-'+_0x12f212+'/'+_0x4c4777)['json'](_0xc07321);}return null;};}function patchUpdates(_0x424c2f){return function(_0xb63503){try{jsonpatch['apply'](_0xb63503,_0x424c2f,!![]);}catch(_0x5c28a6){return BPromise[_0xee1a('0x22')](_0x5c28a6);}return _0xb63503['save']();};}function saveUpdates(_0x3f89f6,_0x2190b5){return function(_0x3cfbcf){if(_0x3cfbcf){return _0x3cfbcf[_0xee1a('0x23')](_0x3f89f6)['then'](function(_0x3e156b){return _0x3e156b;});}return null;};}function removeEntity(_0x42eb40,_0x3237f7){return function(_0x453156){if(_0x453156){return _0x453156[_0xee1a('0x24')]()[_0xee1a('0x25')](function(){_0x42eb40['status'](0xcc)[_0xee1a('0x1c')]();});}};}function handleEntityNotFound(_0x2caeec,_0x345a7c){return function(_0x503780){if(!_0x503780){_0x2caeec[_0xee1a('0x1a')](0x194);}return _0x503780;};}function handleError(_0x3c9b69,_0xc98154){_0xc98154=_0xc98154||0x1f4;return function(_0x50437c){logger[_0xee1a('0x26')](_0x50437c[_0xee1a('0x27')]);if(_0x50437c[_0xee1a('0x28')]){delete _0x50437c[_0xee1a('0x28')];}_0x3c9b69[_0xee1a('0x1b')](_0xc98154)['send'](_0x50437c);};}exports[_0xee1a('0x29')]=function(_0x269676,_0xb39288){var _0x54a81d={},_0x328eae={},_0xa7366b={'count':0x0,'rows':[]};var _0x40cd06=_[_0xee1a('0x2a')](db[_0xee1a('0x2b')][_0xee1a('0x2c')],function(_0x43d5e2){return{'name':_0x43d5e2[_0xee1a('0x2d')],'type':_0x43d5e2[_0xee1a('0x2e')][_0xee1a('0x2f')]};});_0x328eae['model']=_[_0xee1a('0x2a')](_0x40cd06,'name');_0x328eae['query']=_[_0xee1a('0x30')](_0x269676['query']);_0x328eae[_0xee1a('0x31')]=_['intersection'](_0x328eae[_0xee1a('0x32')],_0x328eae[_0xee1a('0x33')]);_0x54a81d[_0xee1a('0x34')]=_[_0xee1a('0x35')](_0x328eae[_0xee1a('0x32')],qs['fields'](_0x269676[_0xee1a('0x33')][_0xee1a('0x36')]));_0x54a81d[_0xee1a('0x34')]=_0x54a81d[_0xee1a('0x34')][_0xee1a('0x37')]?_0x54a81d['attributes']:_0x328eae[_0xee1a('0x32')];if(!_0x269676['query'][_0xee1a('0x38')](_0xee1a('0x39'))){_0x54a81d['limit']=qs[_0xee1a('0x1f')](_0x269676[_0xee1a('0x33')]['limit']);_0x54a81d['offset']=qs[_0xee1a('0x1e')](_0x269676['query']['offset']);}_0x54a81d[_0xee1a('0x3a')]=qs['sort'](_0x269676['query'][_0xee1a('0x3b')]);_0x54a81d[_0xee1a('0x3c')]=qs[_0xee1a('0x31')](_[_0xee1a('0x3d')](_0x269676[_0xee1a('0x33')],_0x328eae['filters']),_0x40cd06);if(_0x269676['query'][_0xee1a('0x3e')]){_0x54a81d[_0xee1a('0x3c')]=_[_0xee1a('0x3f')](_0x54a81d[_0xee1a('0x3c')],{'$or':_[_0xee1a('0x2a')](_0x40cd06,function(_0x121bdf){if(_0x121bdf[_0xee1a('0x2e')]!==_0xee1a('0x40')){var _0x25bd42={};_0x25bd42[_0x121bdf[_0xee1a('0x28')]]={'$like':'%'+_0x269676['query'][_0xee1a('0x3e')]+'%'};return _0x25bd42;}})});}_0x54a81d=_['merge']({},_0x54a81d,_0x269676[_0xee1a('0x41')]);var _0xfdb5ed={'where':_0x54a81d[_0xee1a('0x3c')]};return db[_0xee1a('0x2b')][_0xee1a('0x42')](_0xfdb5ed)[_0xee1a('0x25')](function(_0x304f0c){_0xa7366b[_0xee1a('0x42')]=_0x304f0c;if(_0x269676[_0xee1a('0x33')][_0xee1a('0x43')]){_0x54a81d['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x54a81d);})['then'](function(_0x1c2bcb){_0xa7366b[_0xee1a('0x44')]=_0x1c2bcb;return _0xa7366b;})['then'](respondWithFilteredResult(_0xb39288,_0x54a81d))[_0xee1a('0x45')](handleError(_0xb39288,null));};exports[_0xee1a('0x46')]=function(_0x452a98,_0x50ba1a){var _0x4c4e2b={'raw':!![],'where':{'id':_0x452a98['params']['id']}},_0xedea1b={};_0xedea1b['model']=_['keys'](db[_0xee1a('0x2b')]['rawAttributes']);_0xedea1b[_0xee1a('0x33')]=_[_0xee1a('0x30')](_0x452a98[_0xee1a('0x33')]);_0xedea1b['filters']=_[_0xee1a('0x35')](_0xedea1b[_0xee1a('0x32')],_0xedea1b['query']);_0x4c4e2b[_0xee1a('0x34')]=_['intersection'](_0xedea1b['model'],qs[_0xee1a('0x36')](_0x452a98[_0xee1a('0x33')][_0xee1a('0x36')]));_0x4c4e2b[_0xee1a('0x34')]=_0x4c4e2b['attributes'][_0xee1a('0x37')]?_0x4c4e2b['attributes']:_0xedea1b[_0xee1a('0x32')];if(_0x452a98[_0xee1a('0x33')][_0xee1a('0x43')]){_0x4c4e2b[_0xee1a('0x47')]=[{'all':!![]}];}_0x4c4e2b=_[_0xee1a('0x3f')]({},_0x4c4e2b,_0x452a98[_0xee1a('0x41')]);return db[_0xee1a('0x2b')][_0xee1a('0x48')](_0x4c4e2b)[_0xee1a('0x25')](handleEntityNotFound(_0x50ba1a,null))['then'](respondWithResult(_0x50ba1a,null))[_0xee1a('0x45')](handleError(_0x50ba1a,null));};exports['create']=function(_0x446a78,_0x46a7e2){return db[_0xee1a('0x2b')][_0xee1a('0x49')](_0x446a78['body'],{})['then'](respondWithResult(_0x46a7e2,0xc9))['catch'](handleError(_0x46a7e2,null));};exports['describe']=function(_0x229817,_0x55f4ca){return db[_0xee1a('0x2b')][_0xee1a('0x4a')]()[_0xee1a('0x25')](respondWithResult(_0x55f4ca,null))[_0xee1a('0x45')](handleError(_0x55f4ca,null));};exports[_0xee1a('0x23')]=function(_0x476899,_0x54eae9){if(_0x476899['body']['uniqueid']){delete _0x476899[_0xee1a('0x4b')][_0xee1a('0x4c')];}return db['CmHopperHistory'][_0xee1a('0x48')]({'where':{'uniqueid':_0x476899['params']['id']}})[_0xee1a('0x25')](handleEntityNotFound(_0x54eae9,null))[_0xee1a('0x25')](saveUpdates(_0x476899[_0xee1a('0x4b')],null))[_0xee1a('0x25')](respondWithResult(_0x54eae9,null))[_0xee1a('0x45')](handleError(_0x54eae9,null));}; \ No newline at end of file +var _0x0367=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','type','VIRTUAL','merge','options','CmHopperHistory','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','describe','uniqueid','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','end','stack','name','send','map','fieldName','key','model','keys','query','intersection'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0367,0xb5));var _0x7036=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0367[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x7036('0x0'));var emlformat=require(_0x7036('0x1'));var rimraf=require(_0x7036('0x2'));var zipdir=require(_0x7036('0x3'));var jsonpatch=require(_0x7036('0x4'));var rp=require(_0x7036('0x5'));var moment=require(_0x7036('0x6'));var BPromise=require(_0x7036('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7036('0x8'));var sox=require(_0x7036('0x9'));var csv=require(_0x7036('0xa'));var ejs=require(_0x7036('0xb'));var fs=require('fs');var _=require(_0x7036('0xc'));var squel=require(_0x7036('0xd'));var crypto=require(_0x7036('0xe'));var jsforce=require(_0x7036('0xf'));var deskjs=require(_0x7036('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7036('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7036('0x12'));var as=require(_0x7036('0x13'));var hardwareService=require(_0x7036('0x14'));var logger=require(_0x7036('0x15'))(_0x7036('0x16'));var utils=require(_0x7036('0x17'));var config=require(_0x7036('0x18'));var licenseUtil=require(_0x7036('0x19'));var db=require(_0x7036('0x1a'))['db'];function respondWithStatusCode(_0x2ebe69,_0x5db6f5){_0x5db6f5=_0x5db6f5||0xcc;return function(_0x2e4e51){if(_0x2e4e51){return _0x2ebe69[_0x7036('0x1b')](_0x5db6f5);}return _0x2ebe69[_0x7036('0x1c')](_0x5db6f5)['end']();};}function respondWithResult(_0x30da1d,_0x49fa12){_0x49fa12=_0x49fa12||0xc8;return function(_0x56870b){if(_0x56870b){return _0x30da1d[_0x7036('0x1c')](_0x49fa12)[_0x7036('0x1d')](_0x56870b);}};}function respondWithFilteredResult(_0x40f43c,_0x4e3cbe){return function(_0x4c983e){if(_0x4c983e){var _0x279415=_0x4c983e[_0x7036('0x1e')],_0x104eb8=_0x4e3cbe[_0x7036('0x1f')],_0x29c78f=_0x4e3cbe[_0x7036('0x1f')]+_0x4e3cbe[_0x7036('0x20')],_0x7b9174;if(_0x29c78f>=_0x279415){_0x29c78f=_0x279415;_0x7b9174=0xc8;}else{_0x7b9174=0xce;}_0x40f43c[_0x7036('0x1c')](_0x7b9174);return _0x40f43c[_0x7036('0x21')](_0x7036('0x22'),_0x104eb8+'-'+_0x29c78f+'/'+_0x279415)[_0x7036('0x1d')](_0x4c983e);}return null;};}function patchUpdates(_0x304acd){return function(_0x32bd54){try{jsonpatch['apply'](_0x32bd54,_0x304acd,!![]);}catch(_0x33abfb){return BPromise[_0x7036('0x23')](_0x33abfb);}return _0x32bd54[_0x7036('0x24')]();};}function saveUpdates(_0x2a346f,_0xeae426){return function(_0x232933){if(_0x232933){return _0x232933[_0x7036('0x25')](_0x2a346f)[_0x7036('0x26')](function(_0xd883b){return _0xd883b;});}return null;};}function removeEntity(_0x1a61e0,_0x2fd7b0){return function(_0x41621b){if(_0x41621b){return _0x41621b['destroy']()['then'](function(){_0x1a61e0['status'](0xcc)[_0x7036('0x27')]();});}};}function handleEntityNotFound(_0x4f382a,_0x538ff5){return function(_0x2e20d4){if(!_0x2e20d4){_0x4f382a[_0x7036('0x1b')](0x194);}return _0x2e20d4;};}function handleError(_0x365823,_0x2b732d){_0x2b732d=_0x2b732d||0x1f4;return function(_0x3a85ff){logger['error'](_0x3a85ff[_0x7036('0x28')]);if(_0x3a85ff['name']){delete _0x3a85ff[_0x7036('0x29')];}_0x365823[_0x7036('0x1c')](_0x2b732d)[_0x7036('0x2a')](_0x3a85ff);};}exports['index']=function(_0x47d373,_0x3e9e74){var _0x5d516a={},_0x27612a={},_0x49c995={'count':0x0,'rows':[]};var _0x150069=_[_0x7036('0x2b')](db['CmHopperHistory']['rawAttributes'],function(_0x43c8ef){return{'name':_0x43c8ef[_0x7036('0x2c')],'type':_0x43c8ef['type'][_0x7036('0x2d')]};});_0x27612a[_0x7036('0x2e')]=_[_0x7036('0x2b')](_0x150069,_0x7036('0x29'));_0x27612a['query']=_[_0x7036('0x2f')](_0x47d373[_0x7036('0x30')]);_0x27612a['filters']=_[_0x7036('0x31')](_0x27612a[_0x7036('0x2e')],_0x27612a[_0x7036('0x30')]);_0x5d516a['attributes']=_['intersection'](_0x27612a['model'],qs[_0x7036('0x32')](_0x47d373['query'][_0x7036('0x32')]));_0x5d516a[_0x7036('0x33')]=_0x5d516a[_0x7036('0x33')][_0x7036('0x34')]?_0x5d516a['attributes']:_0x27612a[_0x7036('0x2e')];if(!_0x47d373[_0x7036('0x30')][_0x7036('0x35')](_0x7036('0x36'))){_0x5d516a[_0x7036('0x20')]=qs[_0x7036('0x20')](_0x47d373[_0x7036('0x30')][_0x7036('0x20')]);_0x5d516a['offset']=qs[_0x7036('0x1f')](_0x47d373[_0x7036('0x30')][_0x7036('0x1f')]);}_0x5d516a[_0x7036('0x37')]=qs[_0x7036('0x38')](_0x47d373[_0x7036('0x30')][_0x7036('0x38')]);_0x5d516a['where']=qs[_0x7036('0x39')](_[_0x7036('0x3a')](_0x47d373[_0x7036('0x30')],_0x27612a['filters']),_0x150069);if(_0x47d373[_0x7036('0x30')][_0x7036('0x3b')]){_0x5d516a[_0x7036('0x3c')]=_['merge'](_0x5d516a[_0x7036('0x3c')],{'$or':_['map'](_0x150069,function(_0x101658){if(_0x101658[_0x7036('0x3d')]!==_0x7036('0x3e')){var _0x5038b1={};_0x5038b1[_0x101658['name']]={'$like':'%'+_0x47d373[_0x7036('0x30')][_0x7036('0x3b')]+'%'};return _0x5038b1;}})});}_0x5d516a=_[_0x7036('0x3f')]({},_0x5d516a,_0x47d373[_0x7036('0x40')]);var _0xbadb45={'where':_0x5d516a['where']};return db[_0x7036('0x41')][_0x7036('0x1e')](_0xbadb45)[_0x7036('0x26')](function(_0x1489d9){_0x49c995[_0x7036('0x1e')]=_0x1489d9;if(_0x47d373[_0x7036('0x30')][_0x7036('0x42')]){_0x5d516a[_0x7036('0x43')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x7036('0x44')](_0x5d516a);})[_0x7036('0x26')](function(_0x1331ba){_0x49c995['rows']=_0x1331ba;return _0x49c995;})[_0x7036('0x26')](respondWithFilteredResult(_0x3e9e74,_0x5d516a))[_0x7036('0x45')](handleError(_0x3e9e74,null));};exports[_0x7036('0x46')]=function(_0x51c880,_0x1b99b1){var _0x27bb05={'raw':!![],'where':{'id':_0x51c880[_0x7036('0x47')]['id']}},_0x28a681={};_0x28a681[_0x7036('0x2e')]=_[_0x7036('0x2f')](db[_0x7036('0x41')][_0x7036('0x48')]);_0x28a681['query']=_['keys'](_0x51c880[_0x7036('0x30')]);_0x28a681[_0x7036('0x39')]=_['intersection'](_0x28a681['model'],_0x28a681[_0x7036('0x30')]);_0x27bb05[_0x7036('0x33')]=_[_0x7036('0x31')](_0x28a681[_0x7036('0x2e')],qs[_0x7036('0x32')](_0x51c880[_0x7036('0x30')]['fields']));_0x27bb05[_0x7036('0x33')]=_0x27bb05[_0x7036('0x33')][_0x7036('0x34')]?_0x27bb05[_0x7036('0x33')]:_0x28a681['model'];if(_0x51c880['query'][_0x7036('0x42')]){_0x27bb05[_0x7036('0x43')]=[{'all':!![]}];}_0x27bb05=_[_0x7036('0x3f')]({},_0x27bb05,_0x51c880[_0x7036('0x40')]);return db[_0x7036('0x41')]['find'](_0x27bb05)['then'](handleEntityNotFound(_0x1b99b1,null))[_0x7036('0x26')](respondWithResult(_0x1b99b1,null))['catch'](handleError(_0x1b99b1,null));};exports['create']=function(_0x2a601e,_0x8b10b6){return db[_0x7036('0x41')][_0x7036('0x49')](_0x2a601e[_0x7036('0x4a')],{})[_0x7036('0x26')](respondWithResult(_0x8b10b6,0xc9))[_0x7036('0x45')](handleError(_0x8b10b6,null));};exports['describe']=function(_0x49c33d,_0x44b8ad){return db[_0x7036('0x41')][_0x7036('0x4b')]()[_0x7036('0x26')](respondWithResult(_0x44b8ad,null))[_0x7036('0x45')](handleError(_0x44b8ad,null));};exports[_0x7036('0x25')]=function(_0x4ffe5f,_0x4ff1d3){if(_0x4ffe5f[_0x7036('0x4a')][_0x7036('0x4c')]){delete _0x4ffe5f[_0x7036('0x4a')][_0x7036('0x4c')];}return db[_0x7036('0x41')]['find']({'where':{'uniqueid':_0x4ffe5f[_0x7036('0x47')]['id']}})['then'](handleEntityNotFound(_0x4ff1d3,null))[_0x7036('0x26')](saveUpdates(_0x4ffe5f[_0x7036('0x4a')],null))[_0x7036('0x26')](respondWithResult(_0x4ff1d3,null))[_0x7036('0x45')](handleError(_0x4ff1d3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 9de393e..3efc22c 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 _0xfcb0=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','../../config/logger','api'];(function(_0x1beccc,_0x1e5588){var _0x5c843f=function(_0x3f053a){while(--_0x3f053a){_0x1beccc['push'](_0x1beccc['shift']());}};_0x5c843f(++_0x1e5588);}(_0xfcb0,0x148));var _0x0fcb=function(_0x2ae8dc,_0x4a45c8){_0x2ae8dc=_0x2ae8dc-0x0;var _0x48fb4d=_0xfcb0[_0x2ae8dc];return _0x48fb4d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0fcb('0x0'))(_0x0fcb('0x1'));var moment=require(_0x0fcb('0x2'));var BPromise=require(_0x0fcb('0x3'));var rp=require(_0x0fcb('0x4'));var fs=require('fs');var path=require(_0x0fcb('0x5'));var rimraf=require(_0x0fcb('0x6'));var config=require(_0x0fcb('0x7'));var attributes=require(_0x0fcb('0x8'));module[_0x0fcb('0x9')]=function(_0xd963ff,_0x144871){return _0xd963ff[_0x0fcb('0xa')](_0x0fcb('0xb'),attributes,{'tableName':_0x0fcb('0xc'),'paranoid':![],'indexes':[{'name':_0x0fcb('0xd'),'fields':[_0x0fcb('0xd')]},{'name':_0x0fcb('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x10a8=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid'];(function(_0x3c7b3d,_0x535efd){var _0x5e2c06=function(_0x1ced21){while(--_0x1ced21){_0x3c7b3d['push'](_0x3c7b3d['shift']());}};_0x5e2c06(++_0x535efd);}(_0x10a8,0x78));var _0x810a=function(_0x2f102c,_0x273b4a){_0x2f102c=_0x2f102c-0x0;var _0x5101a3=_0x10a8[_0x2f102c];return _0x5101a3;};'use strict';var _=require(_0x810a('0x0'));var util=require(_0x810a('0x1'));var logger=require(_0x810a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x810a('0x3'));var rp=require(_0x810a('0x4'));var fs=require('fs');var path=require(_0x810a('0x5'));var rimraf=require(_0x810a('0x6'));var config=require(_0x810a('0x7'));var attributes=require(_0x810a('0x8'));module[_0x810a('0x9')]=function(_0xde8b87,_0x2b7b0a){return _0xde8b87[_0x810a('0xa')](_0x810a('0xb'),attributes,{'tableName':_0x810a('0xc'),'paranoid':![],'indexes':[{'name':_0x810a('0xd'),'fields':[_0x810a('0xd')]},{'name':_0x810a('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 0361f99..4db0a7d 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 _0x7878=['GetCampaignHopperHistory','where','col','ivrTotalCallsDays','`state`\x20=\x204,\x201,\x20null','ivrAnswerCallsDay','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','raw','AvgHandleTime','findAll','options','sequelize','predictiveIntervalTotalCalls','COUNT','literal','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','stringify','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay'];(function(_0x197cb4,_0x5c8fae){var _0x1527a9=function(_0x53e621){while(--_0x53e621){_0x197cb4['push'](_0x197cb4['shift']());}};_0x1527a9(++_0x5c8fae);}(_0x7878,0x88));var _0x8787=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7878[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x8787('0x0'));var moment=require(_0x8787('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8787('0x2'));var db=require(_0x8787('0x3'))['db'];var utils=require(_0x8787('0x4'));var logger=require(_0x8787('0x5'))(_0x8787('0x6'));var config=require('../../config/environment');var jayson=require(_0x8787('0x7'));var client=jayson[_0x8787('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd52ef2,_0x4d36f5,_0x26d680){return new BPromise(function(_0x127f49,_0x5eabe7){return client[_0x8787('0x9')](_0xd52ef2,_0x26d680)[_0x8787('0xa')](function(_0x5f3c9e){logger[_0x8787('0xb')](_0x8787('0xc'),_0x4d36f5,_0x8787('0xd'));logger[_0x8787('0xe')](_0x8787('0xf'),_0x4d36f5,'request\x20sent',JSON['stringify'](_0x5f3c9e));if(_0x5f3c9e['error']){if(_0x5f3c9e[_0x8787('0x10')][_0x8787('0x11')]===0x1f4){logger[_0x8787('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x4d36f5,_0x5f3c9e[_0x8787('0x10')][_0x8787('0x12')]);return _0x5eabe7(_0x5f3c9e['error'][_0x8787('0x12')]);}logger[_0x8787('0x10')](_0x8787('0xc'),_0x4d36f5,_0x5f3c9e['error'][_0x8787('0x12')]);return _0x127f49(_0x5f3c9e['error']['message']);}else{logger[_0x8787('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x4d36f5,'request\x20sent');_0x127f49(_0x5f3c9e[_0x8787('0x13')][_0x8787('0x12')]);}})[_0x8787('0x14')](function(_0x998c01){logger['error'](_0x8787('0xc'),_0x4d36f5,_0x998c01);_0x5eabe7(_0x998c01);});});}exports[_0x8787('0x15')]=function(_0x3259d2){var _0xb24abf=this;return new Promise(function(_0x1900c0,_0x2a6717){return db[_0x8787('0x16')][_0x8787('0x17')](_0x3259d2['body'],{'raw':_0x3259d2['options']?_0x3259d2['options'][_0x8787('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x28bee3){logger[_0x8787('0xb')](_0x8787('0x15'),_0x3259d2);logger[_0x8787('0xe')](_0x8787('0x15'),_0x3259d2,JSON['stringify'](_0x28bee3));_0x1900c0(_0x28bee3);})[_0x8787('0x14')](function(_0x41804f){logger[_0x8787('0x10')]('CreateCmHopperHistory',_0x41804f['message'],_0x3259d2);_0x2a6717(_0xb24abf[_0x8787('0x10')](0x1f4,_0x41804f[_0x8787('0x12')]));});});};exports[_0x8787('0x19')]=function(_0x62aee9){var _0x2b9651=this;return new Promise(function(_0x500e25,_0x463e87){return db['CmHopperHistory'][_0x8787('0x1a')]({'raw':_0x62aee9[_0x8787('0x1b')]?_0x62aee9[_0x8787('0x1b')][_0x8787('0x18')]===undefined?!![]:![]:!![],'where':_0x62aee9['options']?_0x62aee9[_0x8787('0x1b')]['where']||null:null,'attributes':[[db[_0x8787('0x1c')]['fn']('COUNT',db[_0x8787('0x1c')]['col']('id')),_0x8787('0x1d')],[db[_0x8787('0x1c')]['fn'](_0x8787('0x1e'),db[_0x8787('0x1c')]['fn']('IF',db[_0x8787('0x1c')][_0x8787('0x1f')]('`state`\x20=\x204,\x201,\x20null'))),_0x8787('0x20')],[db[_0x8787('0x1c')]['fn'](_0x8787('0x1e'),db[_0x8787('0x1c')]['fn']('IF',db[_0x8787('0x1c')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0x8787('0x21')],[db[_0x8787('0x1c')]['fn']('COUNT',db[_0x8787('0x1c')]['fn']('IF',db['sequelize'][_0x8787('0x1f')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x8787('0x1c')]['fn']('AVG',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x8787('0x22')],[db['sequelize']['fn'](_0x8787('0x23'),db[_0x8787('0x1c')]['fn']('IF',db[_0x8787('0x1c')]['literal'](_0x8787('0x24')))),'predictiveIntervalAvgTalktime']]})[_0x8787('0xa')](function(_0x4accc4){logger['info']('AvgHandleTime',_0x62aee9);logger['debug'](_0x8787('0x19'),_0x62aee9,JSON[_0x8787('0x25')](_0x4accc4));_0x500e25(_0x4accc4);})[_0x8787('0x14')](function(_0xdd2c14){logger[_0x8787('0x10')](_0x8787('0x19'),_0xdd2c14['message'],_0x62aee9);_0x463e87(_0x2b9651[_0x8787('0x10')](0x1f4,_0xdd2c14['message']));});});};exports[_0x8787('0x26')]=function(_0x20ff75){var _0x3f1cda=this;return new Promise(function(_0x518f7c,_0x8b2f64){return db[_0x8787('0x16')]['findAll']({'raw':_0x20ff75[_0x8787('0x1b')]?_0x20ff75[_0x8787('0x1b')][_0x8787('0x18')]===undefined?!![]:![]:!![],'where':_0x20ff75[_0x8787('0x1b')]?_0x20ff75[_0x8787('0x1b')]['where']||null:null,'attributes':[[_0x8787('0x27'),_0x8787('0x28')],[db['sequelize']['fn'](_0x8787('0x1e'),db[_0x8787('0x1c')]['fn']('IF',db[_0x8787('0x1c')]['literal'](_0x8787('0x29')))),_0x8787('0x2a')],[db[_0x8787('0x1c')]['fn'](_0x8787('0x1e'),db[_0x8787('0x1c')]['fn']('IF',db[_0x8787('0x1c')][_0x8787('0x1f')]('`state`\x20=\x203,\x201,\x20null'))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn'](_0x8787('0x1e'),db[_0x8787('0x1c')]['fn']('IF',db['sequelize'][_0x8787('0x1f')]('`state`\x20=\x204,\x201,\x20null'))),_0x8787('0x2b')],[db[_0x8787('0x1c')]['fn'](_0x8787('0x1e'),db[_0x8787('0x1c')]['fn']('IF',db['sequelize'][_0x8787('0x1f')](_0x8787('0x2c')))),_0x8787('0x2d')],[db[_0x8787('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8787('0x1c')][_0x8787('0x1f')](_0x8787('0x2e')))),'outboundCongestionCallsDay'],[db[_0x8787('0x1c')]['fn'](_0x8787('0x1e'),db[_0x8787('0x1c')]['fn']('IF',db[_0x8787('0x1c')][_0x8787('0x1f')](_0x8787('0x2f')))),'outboundDropCallsDayTimeout'],[db[_0x8787('0x1c')]['fn']('COUNT',db[_0x8787('0x1c')]['fn']('IF',db[_0x8787('0x1c')]['literal'](_0x8787('0x30')))),_0x8787('0x31')],[db[_0x8787('0x1c')]['fn']('COUNT',db[_0x8787('0x1c')]['fn']('IF',db[_0x8787('0x1c')]['literal'](_0x8787('0x32')))),_0x8787('0x33')],[db[_0x8787('0x1c')]['fn'](_0x8787('0x1e'),db[_0x8787('0x1c')]['fn']('IF',db[_0x8787('0x1c')][_0x8787('0x1f')]('`state`\x20=\x2013,\x201,\x20null'))),'outboundBlacklistCallsDay'],[db[_0x8787('0x1c')]['fn'](_0x8787('0x1e'),db[_0x8787('0x1c')]['fn']('IF',db[_0x8787('0x1c')]['literal'](_0x8787('0x34')))),_0x8787('0x35')],[db['sequelize']['fn'](_0x8787('0x1e'),db[_0x8787('0x1c')]['fn']('IF',db['sequelize'][_0x8787('0x1f')]('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x8787('0x1c')]['fn'](_0x8787('0x1e'),db[_0x8787('0x1c')]['fn']('IF',db[_0x8787('0x1c')][_0x8787('0x1f')](_0x8787('0x36')))),_0x8787('0x37')],[db[_0x8787('0x1c')]['fn'](_0x8787('0x1e'),db[_0x8787('0x1c')]['fn']('IF',db['sequelize'][_0x8787('0x1f')](_0x8787('0x38')))),'outboundRejectCallsDay'],[db[_0x8787('0x1c')]['fn']('COUNT',db[_0x8787('0x1c')]['fn']('IF',db[_0x8787('0x1c')][_0x8787('0x1f')](_0x8787('0x39')))),_0x8787('0x3a')]],'group':[_0x8787('0x27')]})['then'](function(_0xd87d07){logger[_0x8787('0xb')](_0x8787('0x26'),_0x20ff75);logger[_0x8787('0xe')](_0x8787('0x26'),_0x20ff75,JSON[_0x8787('0x25')](_0xd87d07));_0x518f7c(_0xd87d07);})[_0x8787('0x14')](function(_0x5790dc){logger[_0x8787('0x10')](_0x8787('0x26'),_0x5790dc['message'],_0x20ff75);_0x8b2f64(_0x3f1cda[_0x8787('0x10')](0x1f4,_0x5790dc['message']));});});};exports[_0x8787('0x3b')]=function(_0x1b206e){var _0x489d0b=this;return new Promise(function(_0xf623c1,_0x4bbda3){return db[_0x8787('0x16')][_0x8787('0x1a')]({'raw':_0x1b206e[_0x8787('0x1b')]?_0x1b206e[_0x8787('0x1b')][_0x8787('0x18')]===undefined?!![]:![]:!![],'where':_0x1b206e['options']?_0x1b206e[_0x8787('0x1b')][_0x8787('0x3c')]||null:null,'attributes':[[_0x8787('0x27'),_0x8787('0x28')],[db['sequelize']['fn'](_0x8787('0x1e'),db['sequelize'][_0x8787('0x3d')]('id')),_0x8787('0x3e')],[db[_0x8787('0x1c')]['fn'](_0x8787('0x1e'),db[_0x8787('0x1c')]['fn']('IF',db[_0x8787('0x1c')]['literal'](_0x8787('0x3f')))),_0x8787('0x40')]],'group':[_0x8787('0x27')]})[_0x8787('0xa')](function(_0x4d6069){logger['info'](_0x8787('0x3b'),_0x1b206e);logger[_0x8787('0xe')](_0x8787('0x3b'),_0x1b206e,JSON[_0x8787('0x25')](_0x4d6069));_0xf623c1(_0x4d6069);})['catch'](function(_0x2d91d3){logger[_0x8787('0x10')](_0x8787('0x3b'),_0x2d91d3['message'],_0x1b206e);_0x4bbda3(_0x489d0b['error'](0x1f4,_0x2d91d3['message']));});});}; \ No newline at end of file +var _0xf409=['outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','campaign','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopperHistory','create','body','options','raw','CreateCmHopperHistory','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','name','`state`\x20=\x200,\x201,\x20null'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf409,0x18a));var _0x9f40=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xf409[_0x2b7764];return _0x848dcb;};'use strict';var _=require(_0x9f40('0x0'));var util=require('util');var moment=require(_0x9f40('0x1'));var BPromise=require('bluebird');var rs=require(_0x9f40('0x2'));var fs=require('fs');var Redis=require(_0x9f40('0x3'));var db=require(_0x9f40('0x4'))['db'];var utils=require(_0x9f40('0x5'));var logger=require(_0x9f40('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9f40('0x7'));var client=jayson['client'][_0x9f40('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x747bee,_0xfae9d4,_0x5cccb6){return new BPromise(function(_0x1f474d,_0x489d89){return client[_0x9f40('0x9')](_0x747bee,_0x5cccb6)[_0x9f40('0xa')](function(_0x1a3476){logger[_0x9f40('0xb')](_0x9f40('0xc'),_0xfae9d4,_0x9f40('0xd'));logger[_0x9f40('0xe')](_0x9f40('0xf'),_0xfae9d4,_0x9f40('0xd'),JSON[_0x9f40('0x10')](_0x1a3476));if(_0x1a3476['error']){if(_0x1a3476[_0x9f40('0x11')][_0x9f40('0x12')]===0x1f4){logger[_0x9f40('0x11')](_0x9f40('0xc'),_0xfae9d4,_0x1a3476[_0x9f40('0x11')][_0x9f40('0x13')]);return _0x489d89(_0x1a3476[_0x9f40('0x11')][_0x9f40('0x13')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0xfae9d4,_0x1a3476[_0x9f40('0x11')]['message']);return _0x1f474d(_0x1a3476[_0x9f40('0x11')][_0x9f40('0x13')]);}else{logger[_0x9f40('0xb')](_0x9f40('0xc'),_0xfae9d4,_0x9f40('0xd'));_0x1f474d(_0x1a3476[_0x9f40('0x14')][_0x9f40('0x13')]);}})[_0x9f40('0x15')](function(_0x4f07b0){logger[_0x9f40('0x11')](_0x9f40('0xc'),_0xfae9d4,_0x4f07b0);_0x489d89(_0x4f07b0);});});}exports['CreateCmHopperHistory']=function(_0x3f4015){var _0x1dbf13=this;return new Promise(function(_0x2bd3b4,_0x46a831){return db[_0x9f40('0x16')][_0x9f40('0x17')](_0x3f4015[_0x9f40('0x18')],{'raw':_0x3f4015[_0x9f40('0x19')]?_0x3f4015[_0x9f40('0x19')][_0x9f40('0x1a')]===undefined?!![]:![]:!![]})[_0x9f40('0xa')](function(_0xe6ce9e){logger[_0x9f40('0xb')](_0x9f40('0x1b'),_0x3f4015);logger[_0x9f40('0xe')](_0x9f40('0x1b'),_0x3f4015,JSON['stringify'](_0xe6ce9e));_0x2bd3b4(_0xe6ce9e);})[_0x9f40('0x15')](function(_0x20eb39){logger['error'](_0x9f40('0x1b'),_0x20eb39[_0x9f40('0x13')],_0x3f4015);_0x46a831(_0x1dbf13[_0x9f40('0x11')](0x1f4,_0x20eb39[_0x9f40('0x13')]));});});};exports['AvgHandleTime']=function(_0x178ac6){var _0x100ffa=this;return new Promise(function(_0x4bfce1,_0x361171){return db['CmHopperHistory'][_0x9f40('0x1c')]({'raw':_0x178ac6[_0x9f40('0x19')]?_0x178ac6[_0x9f40('0x19')][_0x9f40('0x1a')]===undefined?!![]:![]:!![],'where':_0x178ac6[_0x9f40('0x19')]?_0x178ac6[_0x9f40('0x19')][_0x9f40('0x1d')]||null:null,'attributes':[[db[_0x9f40('0x1e')]['fn'](_0x9f40('0x1f'),db[_0x9f40('0x1e')][_0x9f40('0x20')]('id')),_0x9f40('0x21')],[db[_0x9f40('0x1e')]['fn'](_0x9f40('0x1f'),db[_0x9f40('0x1e')]['fn']('IF',db['sequelize'][_0x9f40('0x22')](_0x9f40('0x23')))),_0x9f40('0x24')],[db[_0x9f40('0x1e')]['fn'](_0x9f40('0x1f'),db[_0x9f40('0x1e')]['fn']('IF',db['sequelize'][_0x9f40('0x22')](_0x9f40('0x25')))),_0x9f40('0x26')],[db[_0x9f40('0x1e')]['fn']('COUNT',db[_0x9f40('0x1e')]['fn']('IF',db[_0x9f40('0x1e')]['literal'](_0x9f40('0x27')))),_0x9f40('0x28')],[db['sequelize']['fn'](_0x9f40('0x29'),db['sequelize']['fn']('IF',db['sequelize'][_0x9f40('0x22')](_0x9f40('0x2a')))),_0x9f40('0x2b')],[db[_0x9f40('0x1e')]['fn'](_0x9f40('0x29'),db[_0x9f40('0x1e')]['fn']('IF',db[_0x9f40('0x1e')]['literal'](_0x9f40('0x2c')))),_0x9f40('0x2d')]]})[_0x9f40('0xa')](function(_0x50272c){logger['info']('AvgHandleTime',_0x178ac6);logger[_0x9f40('0xe')](_0x9f40('0x2e'),_0x178ac6,JSON[_0x9f40('0x10')](_0x50272c));_0x4bfce1(_0x50272c);})[_0x9f40('0x15')](function(_0x5a75d3){logger['error'](_0x9f40('0x2e'),_0x5a75d3[_0x9f40('0x13')],_0x178ac6);_0x361171(_0x100ffa[_0x9f40('0x11')](0x1f4,_0x5a75d3[_0x9f40('0x13')]));});});};exports[_0x9f40('0x2f')]=function(_0x285a45){var _0x2baa89=this;return new Promise(function(_0x21fc20,_0x259335){return db['CmHopperHistory'][_0x9f40('0x1c')]({'raw':_0x285a45[_0x9f40('0x19')]?_0x285a45[_0x9f40('0x19')][_0x9f40('0x1a')]===undefined?!![]:![]:!![],'where':_0x285a45[_0x9f40('0x19')]?_0x285a45[_0x9f40('0x19')][_0x9f40('0x1d')]||null:null,'attributes':[['campaign',_0x9f40('0x30')],[db['sequelize']['fn'](_0x9f40('0x1f'),db[_0x9f40('0x1e')]['fn']('IF',db[_0x9f40('0x1e')][_0x9f40('0x22')](_0x9f40('0x31')))),_0x9f40('0x32')],[db['sequelize']['fn'](_0x9f40('0x1f'),db[_0x9f40('0x1e')]['fn']('IF',db[_0x9f40('0x1e')][_0x9f40('0x22')](_0x9f40('0x33')))),_0x9f40('0x34')],[db[_0x9f40('0x1e')]['fn']('COUNT',db[_0x9f40('0x1e')]['fn']('IF',db['sequelize'][_0x9f40('0x22')](_0x9f40('0x23')))),_0x9f40('0x35')],[db['sequelize']['fn'](_0x9f40('0x1f'),db[_0x9f40('0x1e')]['fn']('IF',db[_0x9f40('0x1e')]['literal'](_0x9f40('0x36')))),_0x9f40('0x37')],[db[_0x9f40('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x9f40('0x1e')]['literal'](_0x9f40('0x38')))),_0x9f40('0x39')],[db[_0x9f40('0x1e')]['fn'](_0x9f40('0x1f'),db[_0x9f40('0x1e')]['fn']('IF',db[_0x9f40('0x1e')][_0x9f40('0x22')](_0x9f40('0x3a')))),_0x9f40('0x3b')],[db['sequelize']['fn']('COUNT',db[_0x9f40('0x1e')]['fn']('IF',db['sequelize'][_0x9f40('0x22')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x9f40('0x3c')],[db['sequelize']['fn']('COUNT',db[_0x9f40('0x1e')]['fn']('IF',db[_0x9f40('0x1e')][_0x9f40('0x22')](_0x9f40('0x3d')))),_0x9f40('0x3e')],[db[_0x9f40('0x1e')]['fn'](_0x9f40('0x1f'),db[_0x9f40('0x1e')]['fn']('IF',db[_0x9f40('0x1e')][_0x9f40('0x22')]('`state`\x20=\x2013,\x201,\x20null'))),_0x9f40('0x3f')],[db[_0x9f40('0x1e')]['fn']('COUNT',db[_0x9f40('0x1e')]['fn']('IF',db[_0x9f40('0x1e')]['literal'](_0x9f40('0x40')))),_0x9f40('0x41')],[db[_0x9f40('0x1e')]['fn'](_0x9f40('0x1f'),db[_0x9f40('0x1e')]['fn']('IF',db[_0x9f40('0x1e')]['literal'](_0x9f40('0x42')))),_0x9f40('0x43')],[db[_0x9f40('0x1e')]['fn'](_0x9f40('0x1f'),db[_0x9f40('0x1e')]['fn']('IF',db[_0x9f40('0x1e')][_0x9f40('0x22')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db[_0x9f40('0x1e')]['fn']('COUNT',db[_0x9f40('0x1e')]['fn']('IF',db['sequelize'][_0x9f40('0x22')](_0x9f40('0x44')))),_0x9f40('0x43')],[db[_0x9f40('0x1e')]['fn']('COUNT',db[_0x9f40('0x1e')]['fn']('IF',db[_0x9f40('0x1e')]['literal'](_0x9f40('0x45')))),'outboundReCallsDay']],'group':[_0x9f40('0x46')]})[_0x9f40('0xa')](function(_0x1f484c){logger[_0x9f40('0xb')]('GetVoiceQueueHopperHistory',_0x285a45);logger[_0x9f40('0xe')](_0x9f40('0x2f'),_0x285a45,JSON['stringify'](_0x1f484c));_0x21fc20(_0x1f484c);})['catch'](function(_0x448fc5){logger[_0x9f40('0x11')](_0x9f40('0x2f'),_0x448fc5[_0x9f40('0x13')],_0x285a45);_0x259335(_0x2baa89[_0x9f40('0x11')](0x1f4,_0x448fc5[_0x9f40('0x13')]));});});};exports[_0x9f40('0x47')]=function(_0x4de552){var _0x2821d5=this;return new Promise(function(_0x5f44f6,_0x5b19e0){return db[_0x9f40('0x16')][_0x9f40('0x1c')]({'raw':_0x4de552[_0x9f40('0x19')]?_0x4de552['options'][_0x9f40('0x1a')]===undefined?!![]:![]:!![],'where':_0x4de552['options']?_0x4de552[_0x9f40('0x19')][_0x9f40('0x1d')]||null:null,'attributes':[[_0x9f40('0x46'),_0x9f40('0x30')],[db[_0x9f40('0x1e')]['fn'](_0x9f40('0x1f'),db[_0x9f40('0x1e')][_0x9f40('0x20')]('id')),_0x9f40('0x48')],[db[_0x9f40('0x1e')]['fn'](_0x9f40('0x1f'),db[_0x9f40('0x1e')]['fn']('IF',db['sequelize'][_0x9f40('0x22')](_0x9f40('0x23')))),_0x9f40('0x49')]],'group':['campaign']})[_0x9f40('0xa')](function(_0x4c78fb){logger['info'](_0x9f40('0x47'),_0x4de552);logger['debug']('GetCampaignHopperHistory',_0x4de552,JSON[_0x9f40('0x10')](_0x4c78fb));_0x5f44f6(_0x4c78fb);})['catch'](function(_0x4f5cc8){logger[_0x9f40('0x11')](_0x9f40('0x47'),_0x4f5cc8[_0x9f40('0x13')],_0x4de552);_0x5b19e0(_0x2821d5[_0x9f40('0x11')](0x1f4,_0x4f5cc8[_0x9f40('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index c1a44e4..c816b86 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 _0x8f53=['/describe','describe','/:id','show','create','put','update','exports','multer','util','path','Router','../../components/auth/service','get','isAuthenticated','index'];(function(_0x4734d8,_0x479950){var _0x3b1120=function(_0x4a5d1c){while(--_0x4a5d1c){_0x4734d8['push'](_0x4734d8['shift']());}};_0x3b1120(++_0x479950);}(_0x8f53,0x128));var _0x38f5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8f53[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x38f5('0x0'));var util=require(_0x38f5('0x1'));var path=require(_0x38f5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x38f5('0x3')]();var auth=require(_0x38f5('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router[_0x38f5('0x5')]('/',auth[_0x38f5('0x6')](),controller[_0x38f5('0x7')]);router[_0x38f5('0x5')](_0x38f5('0x8'),auth[_0x38f5('0x6')](),controller[_0x38f5('0x9')]);router[_0x38f5('0x5')](_0x38f5('0xa'),auth['isAuthenticated'](),controller[_0x38f5('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x38f5('0xc')]);router[_0x38f5('0xd')](_0x38f5('0xa'),auth[_0x38f5('0x6')](),controller[_0x38f5('0xe')]);module[_0x38f5('0xf')]=router; \ No newline at end of file +var _0xa7af=['/:id','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','post','create','put'];(function(_0x563c86,_0x49d85c){var _0x28a12b=function(_0x1f2bca){while(--_0x1f2bca){_0x563c86['push'](_0x563c86['shift']());}};_0x28a12b(++_0x49d85c);}(_0xa7af,0x1a6));var _0xfa7a=function(_0x4d90cb,_0x88a177){_0x4d90cb=_0x4d90cb-0x0;var _0x13786e=_0xa7af[_0x4d90cb];return _0x13786e;};'use strict';var multer=require(_0xfa7a('0x0'));var util=require(_0xfa7a('0x1'));var path=require(_0xfa7a('0x2'));var timeout=require(_0xfa7a('0x3'));var express=require(_0xfa7a('0x4'));var router=express[_0xfa7a('0x5')]();var auth=require(_0xfa7a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router[_0xfa7a('0x7')]('/',auth[_0xfa7a('0x8')](),controller[_0xfa7a('0x9')]);router[_0xfa7a('0x7')]('/describe',auth[_0xfa7a('0x8')](),controller['describe']);router[_0xfa7a('0x7')]('/:id',auth[_0xfa7a('0x8')](),controller['show']);router[_0xfa7a('0xa')]('/',auth['isAuthenticated'](),controller[_0xfa7a('0xb')]);router[_0xfa7a('0xc')](_0xfa7a('0xd'),auth['isAuthenticated'](),controller['update']);module[_0xfa7a('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 19c9a43..8e6f7dd 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 _0xb4b6=['name','STRING','sequelize'];(function(_0x5d36a7,_0x5cdb1a){var _0x4f9bc6=function(_0x48b0e1){while(--_0x48b0e1){_0x5d36a7['push'](_0x5d36a7['shift']());}};_0x4f9bc6(++_0x5cdb1a);}(_0xb4b6,0x14c));var _0x6b4b=function(_0x3b81c9,_0x21a20a){_0x3b81c9=_0x3b81c9-0x0;var _0x115587=_0xb4b6[_0x3b81c9];return _0x115587;};'use strict';var Sequelize=require(_0x6b4b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x6b4b('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6b4b('0x2')]},'dialPrefix':{'type':Sequelize[_0x6b4b('0x2')]}}; \ No newline at end of file +var _0x723e=['sequelize','exports','STRING','name'];(function(_0x7566d2,_0x315864){var _0x53758a=function(_0x514c81){while(--_0x514c81){_0x7566d2['push'](_0x7566d2['shift']());}};_0x53758a(++_0x315864);}(_0x723e,0x1b0));var _0xe723=function(_0x232635,_0x1dcb1b){_0x232635=_0x232635-0x0;var _0x27028b=_0x723e[_0x232635];return _0x27028b;};'use strict';var Sequelize=require(_0xe723('0x0'));module[_0xe723('0x1')]={'name':{'type':Sequelize[_0xe723('0x2')],'unique':_0xe723('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe723('0x2')]},'dialPrefix':{'type':Sequelize[_0xe723('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 7b8b5ea..bf002dc 100644 --- a/server/api/cmList/cmList.controller.js +++ b/server/api/cmList/cmList.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','getCustomFields','addAgents','spread','removeAgents','emit','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','Lists','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','addDisposition','Disposition','getDispositions','findOne','ListId','ids','CmContact','describe','tags','isArray','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','hasOwnProperty','raw','getContactsCsv','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT'];(function(_0x47faad,_0x230b04){var _0x4c449a=function(_0x426c7e){while(--_0x426c7e){_0x47faad['push'](_0x47faad['shift']());}};_0x4c449a(++_0x230b04);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x16b1ca=_0x4d00e6['get']({'plain':!![]});var _0x59181e=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0x59181e,'resourceId':_0x16b1ca['id']}})[_0x0a9e('0x22')](function(){return _0x4d00e6;});})['then'](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a1e7,_0x5bfb33){return function(_0x1dc186){if(!_0x1dc186){_0x45a1e7[_0x0a9e('0x25')](0x194);}return _0x1dc186;};}function handleError(_0x25fba9,_0x14433c){_0x14433c=_0x14433c||0x1f4;return function(_0x140511){logger[_0x0a9e('0x26')](_0x140511[_0x0a9e('0x27')]);if(_0x140511[_0x0a9e('0x28')]){delete _0x140511['name'];}_0x25fba9[_0x0a9e('0x1a')](_0x14433c)[_0x0a9e('0x29')](_0x140511);};}exports[_0x0a9e('0x2a')]=function(_0x2ec755,_0x5c877d){var _0x15b200={},_0x40e7a3={},_0x1843b2={'count':0x0,'rows':[]};var _0x824a4f=_[_0x0a9e('0x2b')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')],function(_0x2e8759){return{'name':_0x2e8759[_0x0a9e('0x2e')],'type':_0x2e8759['type'][_0x0a9e('0x2f')]};});_0x40e7a3['model']=_[_0x0a9e('0x2b')](_0x824a4f,_0x0a9e('0x28'));_0x40e7a3[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2ec755[_0x0a9e('0x30')]);_0x40e7a3['filters']=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],_0x40e7a3[_0x0a9e('0x30')]);_0x15b200[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x2ec755[_0x0a9e('0x30')]['fields']));_0x15b200[_0x0a9e('0x34')]=_0x15b200['attributes'][_0x0a9e('0x36')]?_0x15b200[_0x0a9e('0x34')]:_0x40e7a3[_0x0a9e('0x33')];if(!_0x2ec755[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x15b200[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2ec755[_0x0a9e('0x30')]['limit']);_0x15b200['offset']=qs[_0x0a9e('0x1c')](_0x2ec755['query'][_0x0a9e('0x1c')]);}_0x15b200[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x2ec755[_0x0a9e('0x30')]['sort']);_0x15b200[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x2ec755['query'],_0x40e7a3[_0x0a9e('0x3b')]),_0x824a4f);if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x15b200['where']=_['merge'](_0x15b200[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x824a4f,function(_0x5adda1){if(_0x5adda1[_0x0a9e('0x3e')]!==_0x0a9e('0x3f')){var _0x2e1b3a={};_0x2e1b3a[_0x5adda1[_0x0a9e('0x28')]]={'$like':'%'+_0x2ec755['query']['filter']+'%'};return _0x2e1b3a;}})});}_0x15b200=_[_0x0a9e('0x40')]({},_0x15b200,_0x2ec755[_0x0a9e('0x41')]);var _0x53f3ee={'where':_0x15b200[_0x0a9e('0x3a')]};return db[_0x0a9e('0x2c')][_0x0a9e('0x1b')](_0x53f3ee)['then'](function(_0x316c8f){_0x1843b2[_0x0a9e('0x1b')]=_0x316c8f;if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x15b200[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x2c')][_0x0a9e('0x44')](_0x15b200);})[_0x0a9e('0x22')](function(_0x23b089){_0x1843b2[_0x0a9e('0x45')]=_0x23b089;return _0x1843b2;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5c877d,_0x15b200))[_0x0a9e('0x46')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x47')]=function(_0x11ca30,_0x37f6cc){var _0x4d04c8={'raw':![],'where':{'id':_0x11ca30[_0x0a9e('0x48')]['id']}},_0x52628e={};_0x52628e[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')]);_0x52628e[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x11ca30[_0x0a9e('0x30')]);_0x52628e[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],_0x52628e[_0x0a9e('0x30')]);_0x4d04c8['attributes']=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x11ca30[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x4d04c8[_0x0a9e('0x34')]=_0x4d04c8[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4d04c8['attributes']:_0x52628e[_0x0a9e('0x33')];if(_0x11ca30['query'][_0x0a9e('0x42')]){_0x4d04c8[_0x0a9e('0x43')]=[{'all':!![]}];}_0x4d04c8=_[_0x0a9e('0x40')]({},_0x4d04c8,_0x11ca30['options']);return db[_0x0a9e('0x2c')][_0x0a9e('0x49')](_0x4d04c8)[_0x0a9e('0x22')](handleEntityNotFound(_0x37f6cc,null))[_0x0a9e('0x22')](respondWithResult(_0x37f6cc,null))[_0x0a9e('0x46')](handleError(_0x37f6cc,null));};exports[_0x0a9e('0x4a')]=function(_0x45bf7f,_0x5bbcde){return db[_0x0a9e('0x2c')][_0x0a9e('0x4a')](_0x45bf7f[_0x0a9e('0x4b')],{})[_0x0a9e('0x22')](function(_0x409789){var _0x992c77=_0x45bf7f[_0x0a9e('0x4c')][_0x0a9e('0x4d')]({'plain':!![]});if(!_0x992c77)throw new Error(_0x0a9e('0x4e'));if(_0x992c77['role']===_0x0a9e('0x4c')){var _0x3fe430=_0x409789['get']({'plain':!![]});var _0x4ae14b='Lists';return db[_0x0a9e('0x4f')][_0x0a9e('0x49')]({'where':{'name':_0x4ae14b,'userProfileId':_0x992c77[_0x0a9e('0x50')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x61bb17){if(_0x61bb17&&_0x61bb17[_0x0a9e('0x51')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x4a')]({'name':_0x3fe430['name'],'resourceId':_0x3fe430['id'],'type':_0x61bb17['name'],'sectionId':_0x61bb17['id']},{})['then'](function(){return _0x409789;});}else{return _0x409789;}})[_0x0a9e('0x46')](function(_0x204173){logger[_0x0a9e('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x204173);throw _0x204173;});}return _0x409789;})[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,0xc9))[_0x0a9e('0x46')](handleError(_0x5bbcde,null));};exports['update']=function(_0x5a88da,_0x2ef381){if(_0x5a88da['body']['id']){delete _0x5a88da[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x5a88da[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x2ef381,null))['then'](saveUpdates(_0x5a88da[_0x0a9e('0x4b')],null))[_0x0a9e('0x22')](respondWithResult(_0x2ef381,null))['catch'](handleError(_0x2ef381,null));};exports['destroy']=function(_0x128aa6,_0x3aedd0){return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x128aa6['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3aedd0,null))['then'](removeEntity(_0x3aedd0,null))[_0x0a9e('0x46')](handleError(_0x3aedd0,null));};exports['describe']=function(_0x5da27d,_0x5df0ad){return db[_0x0a9e('0x2c')]['describe']()[_0x0a9e('0x22')](respondWithResult(_0x5df0ad,null))[_0x0a9e('0x46')](handleError(_0x5df0ad,null));};exports[_0x0a9e('0x52')]=function(_0x19b4df,_0x232830,_0x272738){if(_0x19b4df[_0x0a9e('0x4b')]['id']){delete _0x19b4df[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x19b4df[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x232830,null))[_0x0a9e('0x22')](function(_0xb83dfd){if(_0xb83dfd){_0x19b4df[_0x0a9e('0x4b')]['ListId']=_0xb83dfd['id'];return db[_0x0a9e('0x53')][_0x0a9e('0x4a')](_0x19b4df['body']);}})[_0x0a9e('0x22')](respondWithResult(_0x232830,null))['catch'](handleError(_0x232830,null));};exports[_0x0a9e('0x54')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'raw':![],'where':{}};var _0x49d231={};var _0x2244d6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4b3c1a,null))[_0x0a9e('0x22')](function(_0x49eed0){if(_0x49eed0){_0x49d231[_0x0a9e('0x33')]=_['keys'](db[_0x0a9e('0x53')][_0x0a9e('0x2d')]);_0x49d231[_0x0a9e('0x30')]=_['keys'](_0x5ba1f9[_0x0a9e('0x30')]);_0x49d231[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x49d231[_0x0a9e('0x33')],_0x49d231['query']);_0x273cb5[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x49d231['model'],qs[_0x0a9e('0x35')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x273cb5[_0x0a9e('0x34')]=_0x273cb5[_0x0a9e('0x34')]['length']?_0x273cb5[_0x0a9e('0x34')]:_0x49d231[_0x0a9e('0x33')];if(!_0x5ba1f9[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x273cb5['limit']=qs['limit'](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x273cb5[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x273cb5[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x273cb5[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x5ba1f9[_0x0a9e('0x30')],_0x49d231[_0x0a9e('0x3b')]));_0x273cb5[_0x0a9e('0x3a')][_0x0a9e('0x56')]=_0x49eed0['id'];if(_0x5ba1f9[_0x0a9e('0x30')]['filter']){_0x273cb5[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x273cb5[_0x0a9e('0x3a')],{'$or':_['map'](_0x273cb5[_0x0a9e('0x34')],function(_0x30944e){var _0x4b341d={};_0x4b341d[_0x30944e]={'$like':'%'+_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x4b341d;})});}_0x273cb5=_[_0x0a9e('0x40')]({},_0x273cb5,_0x5ba1f9[_0x0a9e('0x41')]);return db[_0x0a9e('0x53')]['count']({'where':_0x273cb5['where']})['then'](function(_0x40fb85){_0x2244d6[_0x0a9e('0x1b')]=_0x40fb85;if(_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x273cb5[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x53')][_0x0a9e('0x44')](_0x273cb5);})[_0x0a9e('0x22')](function(_0x5512d1){_0x2244d6[_0x0a9e('0x45')]=_0x5512d1;return _0x2244d6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4b3c1a,_0x273cb5))[_0x0a9e('0x46')](handleError(_0x4b3c1a,null));};exports['removeDispositions']=function(_0x2bdc44,_0x583b2e,_0x4437ff){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x2bdc44[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x583b2e,null))[_0x0a9e('0x22')](function(_0x317c0c){if(_0x317c0c){return _0x317c0c['removeDispositions'](_0x2bdc44[_0x0a9e('0x30')][_0x0a9e('0x57')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x583b2e,null))[_0x0a9e('0x46')](handleError(_0x583b2e,null));};exports['addContacts']=function(_0x109ccb,_0x3d91db,_0x2d5506){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x109ccb[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3d91db,null))[_0x0a9e('0x22')](function(_0xf410e5){if(_0xf410e5){var _0x332367=[];var _0xdb98ca={'success':[],'errors':[]};return db[_0x0a9e('0x58')][_0x0a9e('0x59')]()[_0x0a9e('0x22')](function(_0x336dc3){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]&&_[_0x0a9e('0x5b')](_0x109ccb[_0x0a9e('0x4b')]['tags'])){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x36')]){_0x109ccb['body'][_0x0a9e('0x5a')]=_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x5c')](';')+';';}else{_0x109ccb['body']['tags']=null;}}else{_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]=null;}if(_0x109ccb['body']&&_[_0x0a9e('0x5b')](_0x109ccb['body'])){for(var _0x260f4b=0x0;_0x260f4b<_0x109ccb[_0x0a9e('0x4b')]['length'];_0x260f4b+=0x1){_0x109ccb[_0x0a9e('0x4b')][_0x260f4b][_0x0a9e('0x56')]=_0x109ccb[_0x0a9e('0x48')]['id'];_0x332367[_0x0a9e('0x5d')](_0x109ccb[_0x0a9e('0x4b')][_0x260f4b]);}return BPromise[_0x0a9e('0x5e')](_0x332367,function(_0x444f1f){return db['CmContact'][_0x0a9e('0x4a')](_[_0x0a9e('0x5f')](_0x444f1f,[_0x0a9e('0x57'),'id'])||{},{'fields':_[_0x0a9e('0x31')](_0x336dc3),'raw':!![]})['then'](function(_0xf51744){_0xdb98ca[_0x0a9e('0x60')]['push'](_0xf51744[_0x0a9e('0x61')]);})['catch'](function(_0x163710){_0xdb98ca[_0x0a9e('0x62')][_0x0a9e('0x5d')]({'data':_0x444f1f,'error':_0x163710[_0x0a9e('0x63')]});});})['then'](function(_0x51ccd7){return _0xdb98ca;})[_0x0a9e('0x46')](function(_0x2b9c01){return _0x2b9c01;});}else{_0x3d91db[_0x0a9e('0x1a')](0x190)['json']({'message':_0x0a9e('0x64')});}});}})[_0x0a9e('0x22')](respondWithResult(_0x3d91db,null))['catch'](handleError(_0x3d91db,null));};exports['getContacts']=function(_0xf0a802,_0x56acca,_0x5ea541){var _0x4dc6b3;return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0xf0a802[_0x0a9e('0x48')]['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x56acca,null))['then'](function(_0x5fd5db){if(_0x5fd5db){_0x4dc6b3=_0x5fd5db;return db['CmContact'][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x18ad56){if(_0x18ad56){var _0x4566b0={};var _0x50f8d7={};_0x50f8d7[_0x0a9e('0x33')]=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x18ad56),_['map'](_0x4dc6b3[_0x0a9e('0x66')],function(_0x21e592){return util[_0x0a9e('0x68')](_0x0a9e('0x69'),_0x21e592['id']);}));_0x50f8d7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0xf0a802[_0x0a9e('0x30')]);_0x50f8d7[_0x0a9e('0x3b')]=_['intersection'](_0x50f8d7[_0x0a9e('0x33')],_0x50f8d7[_0x0a9e('0x30')]);_0x4566b0['attributes']=_[_0x0a9e('0x32')](_0x50f8d7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0xf0a802['query'][_0x0a9e('0x35')]));_0x4566b0['attributes']=_0x4566b0[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4566b0[_0x0a9e('0x34')]:_0x50f8d7[_0x0a9e('0x33')];if(!_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x4566b0[_0x0a9e('0x1d')]=qs['limit'](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x4566b0[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x4566b0[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x4566b0[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0xf0a802['query'],_0x50f8d7[_0x0a9e('0x3b')]));_0x4566b0[_0x0a9e('0x6b')]=!![];if(_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x4566b0[_0x0a9e('0x3a')]=_['merge'](_0x4566b0[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x4566b0['attributes'],function(_0x23b447){var _0x5e725e={};_0x5e725e[_0x23b447]={'$like':'%'+_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x5e725e;})});}_0x4566b0=_[_0x0a9e('0x40')]({},_0x4566b0,_0xf0a802[_0x0a9e('0x41')]);return _0x4dc6b3['getContacts'](_0x4566b0);}})[_0x0a9e('0x22')](respondWithResult(_0x56acca,null))['catch'](handleError(_0x56acca,null));};exports[_0x0a9e('0x6c')]=function(_0x3d0a77,_0x5e5b89,_0x231c6a){var _0x63c9f7;return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x3d0a77['params']['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x5e5b89,null))[_0x0a9e('0x22')](function(_0x3f2f40){if(_0x3f2f40){_0x63c9f7=_0x3f2f40;return db[_0x0a9e('0x58')][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x3f8124){if(_0x3f8124){var _0x586510={};var _0x3156c7={};_0x3156c7['model']=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x3f8124),_[_0x0a9e('0x2b')](_0x63c9f7[_0x0a9e('0x66')],function(_0x1b61d5){return util['format'](_0x0a9e('0x69'),_0x1b61d5['id']);}));_0x3156c7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x3d0a77[_0x0a9e('0x30')]);_0x3156c7[_0x0a9e('0x3b')]=_['intersection'](_0x3156c7['model'],_0x3156c7[_0x0a9e('0x30')]);_0x586510['attributes']=_[_0x0a9e('0x32')](_0x3156c7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x586510[_0x0a9e('0x34')]=_0x586510['attributes']['length']?_0x586510[_0x0a9e('0x34')]:_0x3156c7['model'];if(!_0x3d0a77[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x586510['limit']=qs['limit'](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x586510['offset']=qs[_0x0a9e('0x1c')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x586510[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x3d0a77['query']['sort']);_0x586510[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x3d0a77[_0x0a9e('0x30')],_0x3156c7[_0x0a9e('0x3b')]));_0x586510['raw']=!![];if(_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x586510['where']=_[_0x0a9e('0x40')](_0x586510[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x586510[_0x0a9e('0x34')],function(_0x23b25b){var _0x23b39e={};_0x23b39e[_0x23b25b]={'$like':'%'+_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x23b39e;})});}_0x586510=_[_0x0a9e('0x40')]({},_0x586510,_0x3d0a77[_0x0a9e('0x41')]);return _0x63c9f7['getContacts'](_0x586510);}})[_0x0a9e('0x22')](function(_0x301047){if(!_[_0x0a9e('0x6d')](_0x301047)){var _0x1c4232=toCsv(_0x301047);var _0x1d0b02=Date['now']();fs['writeFileSync'](util[_0x0a9e('0x68')](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02),_0x1c4232);_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x70'),_0x0a9e('0x71')+util['format'](_0x0a9e('0x72'),_0x63c9f7['id'],_0x1d0b02));_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x73'),'text/csv');return _0x5e5b89[_0x0a9e('0x74')](util['format'](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02));}else{return _0x5e5b89['sendStatus'](0xcc);}})[_0x0a9e('0x46')](handleError(_0x5e5b89,null));};exports[_0x0a9e('0x75')]=function(_0xe339b1,_0x5c500c,_0xc9529d){var _0x5ed560;delete _0xe339b1[_0x0a9e('0x4b')]['id'];return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0xe339b1[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5c500c,null))[_0x0a9e('0x22')](function(_0x4014c7){if(_0x4014c7){return db[_0x0a9e('0x76')][_0x0a9e('0x77')](function(_0x27d1f5){return db[_0x0a9e('0x65')][_0x0a9e('0x4a')](_0xe339b1[_0x0a9e('0x4b')],{'transaction':_0x27d1f5})[_0x0a9e('0x22')](function(_0x98c62c){_0x5ed560=_0x98c62c;return _0x4014c7[_0x0a9e('0x78')](_0x98c62c,{'transaction':_0x27d1f5});})['then'](function(){var _0x556443={'type':db[_0x0a9e('0x79')]['TEXT'],'transaction':_0x27d1f5};switch(_0xe339b1[_0x0a9e('0x4b')][_0x0a9e('0x3e')]){case'text':_0x556443[_0x0a9e('0x3e')]=db[_0x0a9e('0x79')][_0x0a9e('0x7a')];break;case _0x0a9e('0x7b'):_0x556443['type']=db[_0x0a9e('0x79')][_0x0a9e('0x7c')];break;case _0x0a9e('0x7d'):_0x556443[_0x0a9e('0x3e')]=db['Sequelize'][_0x0a9e('0x7e')];_0x556443[_0x0a9e('0x7f')]=![];break;default:}return db[_0x0a9e('0x76')]['queryInterface'][_0x0a9e('0x80')](_0x0a9e('0x81'),util[_0x0a9e('0x68')]('cf_%s',_0x5ed560['id']),_0x556443);})[_0x0a9e('0x22')](function(){return _0x5ed560;});});}})[_0x0a9e('0x22')](respondWithResult(_0x5c500c,null))[_0x0a9e('0x46')](handleError(_0x5c500c,null));};exports[_0x0a9e('0x82')]=function(_0x2394d3,_0x555780,_0x3211d2){var _0x289e65={};var _0x4795ae={};var _0x3bab3e;var _0x1fcfe6;return db[_0x0a9e('0x2c')]['findOne']({'where':{'id':_0x2394d3['params']['id']}})['then'](handleEntityNotFound(_0x555780,null))[_0x0a9e('0x22')](function(_0x4a70ce){if(_0x4a70ce){_0x3bab3e=_0x4a70ce;_0x4795ae['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x65')][_0x0a9e('0x2d')]);_0x4795ae['query']=_[_0x0a9e('0x31')](_0x2394d3[_0x0a9e('0x30')]);_0x4795ae[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],_0x4795ae[_0x0a9e('0x30')]);_0x289e65[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],qs['fields'](_0x2394d3[_0x0a9e('0x30')]['fields']));_0x289e65[_0x0a9e('0x34')]=_0x289e65[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x289e65[_0x0a9e('0x34')]:_0x4795ae[_0x0a9e('0x33')];_0x289e65[_0x0a9e('0x38')]=qs['sort'](_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x289e65[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x2394d3[_0x0a9e('0x30')],_0x4795ae[_0x0a9e('0x3b')]));_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':[{'ListId':_0x4a70ce['id']},{'ListId':null}]});if(_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':_['map'](_0x289e65[_0x0a9e('0x34')],function(_0x88b25f){var _0x2ff265={};_0x2ff265[_0x88b25f]={'$like':'%'+_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x2ff265;})});}_0x289e65=_[_0x0a9e('0x40')]({},_0x289e65,_0x2394d3[_0x0a9e('0x41')]);return db[_0x0a9e('0x65')]['findAndCountAll'](_0x289e65);}})[_0x0a9e('0x22')](respondWithResult(_0x555780,null))[_0x0a9e('0x46')](handleError(_0x555780,null));};exports[_0x0a9e('0x83')]=function(_0x5c65fc,_0x1402c7,_0x41e446){return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0x5c65fc[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1402c7,null))[_0x0a9e('0x22')](function(_0x336a19){if(_0x336a19){return _0x336a19[_0x0a9e('0x83')](_0x5c65fc[_0x0a9e('0x4b')]['ids'],_[_0x0a9e('0x5f')](_0x5c65fc[_0x0a9e('0x4b')],[_0x0a9e('0x57'),'id'])||{})[_0x0a9e('0x84')](function(_0x2b624e){for(var _0x3942fd=0x0;_0x3942fd<_0x5c65fc['body'][_0x0a9e('0x57')]['length'];_0x3942fd+=0x1){socket['emit']('userCmList:save',{'UserId':_0x5c65fc[_0x0a9e('0x4b')][_0x0a9e('0x57')][_0x3942fd],'CmListId':_0x5c65fc[_0x0a9e('0x48')]['id']});}return _0x2b624e;});}})[_0x0a9e('0x22')](respondWithResult(_0x1402c7,null))['catch'](handleError(_0x1402c7,null));};exports[_0x0a9e('0x85')]=function(_0x309fa9,_0x3ddbc7,_0x1fdb10){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x309fa9['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3ddbc7,null))[_0x0a9e('0x22')](function(_0x2a293f){if(_0x2a293f){return _0x2a293f['removeAgents'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])[_0x0a9e('0x22')](function(){if(_['isArray'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])){for(var _0x15ba6b=0x0;_0x15ba6b<_0x309fa9['query'][_0x0a9e('0x57')][_0x0a9e('0x36')];_0x15ba6b+=0x1){socket[_0x0a9e('0x86')]('userCmList:remove',{'UserId':Number(_0x309fa9['query']['ids'][_0x15ba6b]),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}}else{socket[_0x0a9e('0x86')](_0x0a9e('0x87'),{'UserId':Number(_0x309fa9[_0x0a9e('0x30')]['ids']),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x3ddbc7,null))[_0x0a9e('0x46')](handleError(_0x3ddbc7,null));};exports[_0x0a9e('0x88')]=function(_0x242f23,_0x57f673,_0x33b4b3){var _0x33a26c={};var _0xb8a476={};var _0x580dd6;var _0x40eb5d;return db['CmList'][_0x0a9e('0x55')]({'where':{'id':_0x242f23['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x57f673,null))['then'](function(_0xb14971){if(_0xb14971){_0x580dd6=_0xb14971;_0xb8a476[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x89')][_0x0a9e('0x2d')]);_0xb8a476[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x242f23['query']);_0xb8a476[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0xb8a476['model'],_0xb8a476[_0x0a9e('0x30')]);_0x33a26c[_0x0a9e('0x34')]=_['intersection'](_0xb8a476[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x242f23[_0x0a9e('0x30')]['fields']));_0x33a26c[_0x0a9e('0x34')]=_0x33a26c[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x33a26c[_0x0a9e('0x34')]:_0xb8a476[_0x0a9e('0x33')];_0x33a26c[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x33a26c[_0x0a9e('0x3a')]=qs['filters'](_[_0x0a9e('0x3c')](_0x242f23['query'],_0xb8a476[_0x0a9e('0x3b')]));if(_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x33a26c[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x33a26c[_0x0a9e('0x3a')],{'$or':_['map'](_0x33a26c[_0x0a9e('0x34')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x242f23['query'][_0x0a9e('0x3d')]+'%'};return _0x2977a7;})});}_0x33a26c=_[_0x0a9e('0x40')]({},_0x33a26c,_0x242f23[_0x0a9e('0x41')]);return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1d0a78){if(_0x1d0a78){_0x40eb5d=_0x1d0a78[_0x0a9e('0x36')];if(!_0x242f23['query'][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x33a26c[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x33a26c[_0x0a9e('0x1c')]=qs['offset'](_0x242f23['query'][_0x0a9e('0x1c')]);}return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1bf692){if(_0x1bf692){return _0x1bf692?{'count':_0x40eb5d,'rows':_0x1bf692}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x57f673,null))[_0x0a9e('0x46')](handleError(_0x57f673,null));}; \ No newline at end of file +var _0xa9e0=['number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','getCustomFields','addAgents','spread','removeAgents','emit','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','Lists','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','addDisposition','Disposition','getDispositions','findOne','ListId','ids','CmContact','describe','tags','isArray','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','hasOwnProperty','raw','getContactsCsv','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT'];(function(_0x1c89c4,_0x5b8b57){var _0x4a4717=function(_0x2421a2){while(--_0x2421a2){_0x1c89c4['push'](_0x1c89c4['shift']());}};_0x4a4717(++_0x5b8b57);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x16b1ca=_0x4d00e6['get']({'plain':!![]});var _0x59181e=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0x59181e,'resourceId':_0x16b1ca['id']}})[_0x0a9e('0x22')](function(){return _0x4d00e6;});})['then'](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a1e7,_0x5bfb33){return function(_0x1dc186){if(!_0x1dc186){_0x45a1e7[_0x0a9e('0x25')](0x194);}return _0x1dc186;};}function handleError(_0x25fba9,_0x14433c){_0x14433c=_0x14433c||0x1f4;return function(_0x140511){logger[_0x0a9e('0x26')](_0x140511[_0x0a9e('0x27')]);if(_0x140511[_0x0a9e('0x28')]){delete _0x140511['name'];}_0x25fba9[_0x0a9e('0x1a')](_0x14433c)[_0x0a9e('0x29')](_0x140511);};}exports[_0x0a9e('0x2a')]=function(_0x2ec755,_0x5c877d){var _0x15b200={},_0x40e7a3={},_0x1843b2={'count':0x0,'rows':[]};var _0x824a4f=_[_0x0a9e('0x2b')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')],function(_0x2e8759){return{'name':_0x2e8759[_0x0a9e('0x2e')],'type':_0x2e8759['type'][_0x0a9e('0x2f')]};});_0x40e7a3['model']=_[_0x0a9e('0x2b')](_0x824a4f,_0x0a9e('0x28'));_0x40e7a3[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2ec755[_0x0a9e('0x30')]);_0x40e7a3['filters']=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],_0x40e7a3[_0x0a9e('0x30')]);_0x15b200[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x2ec755[_0x0a9e('0x30')]['fields']));_0x15b200[_0x0a9e('0x34')]=_0x15b200['attributes'][_0x0a9e('0x36')]?_0x15b200[_0x0a9e('0x34')]:_0x40e7a3[_0x0a9e('0x33')];if(!_0x2ec755[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x15b200[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2ec755[_0x0a9e('0x30')]['limit']);_0x15b200['offset']=qs[_0x0a9e('0x1c')](_0x2ec755['query'][_0x0a9e('0x1c')]);}_0x15b200[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x2ec755[_0x0a9e('0x30')]['sort']);_0x15b200[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x2ec755['query'],_0x40e7a3[_0x0a9e('0x3b')]),_0x824a4f);if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x15b200['where']=_['merge'](_0x15b200[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x824a4f,function(_0x5adda1){if(_0x5adda1[_0x0a9e('0x3e')]!==_0x0a9e('0x3f')){var _0x2e1b3a={};_0x2e1b3a[_0x5adda1[_0x0a9e('0x28')]]={'$like':'%'+_0x2ec755['query']['filter']+'%'};return _0x2e1b3a;}})});}_0x15b200=_[_0x0a9e('0x40')]({},_0x15b200,_0x2ec755[_0x0a9e('0x41')]);var _0x53f3ee={'where':_0x15b200[_0x0a9e('0x3a')]};return db[_0x0a9e('0x2c')][_0x0a9e('0x1b')](_0x53f3ee)['then'](function(_0x316c8f){_0x1843b2[_0x0a9e('0x1b')]=_0x316c8f;if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x15b200[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x2c')][_0x0a9e('0x44')](_0x15b200);})[_0x0a9e('0x22')](function(_0x23b089){_0x1843b2[_0x0a9e('0x45')]=_0x23b089;return _0x1843b2;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5c877d,_0x15b200))[_0x0a9e('0x46')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x47')]=function(_0x11ca30,_0x37f6cc){var _0x4d04c8={'raw':![],'where':{'id':_0x11ca30[_0x0a9e('0x48')]['id']}},_0x52628e={};_0x52628e[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')]);_0x52628e[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x11ca30[_0x0a9e('0x30')]);_0x52628e[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],_0x52628e[_0x0a9e('0x30')]);_0x4d04c8['attributes']=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x11ca30[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x4d04c8[_0x0a9e('0x34')]=_0x4d04c8[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4d04c8['attributes']:_0x52628e[_0x0a9e('0x33')];if(_0x11ca30['query'][_0x0a9e('0x42')]){_0x4d04c8[_0x0a9e('0x43')]=[{'all':!![]}];}_0x4d04c8=_[_0x0a9e('0x40')]({},_0x4d04c8,_0x11ca30['options']);return db[_0x0a9e('0x2c')][_0x0a9e('0x49')](_0x4d04c8)[_0x0a9e('0x22')](handleEntityNotFound(_0x37f6cc,null))[_0x0a9e('0x22')](respondWithResult(_0x37f6cc,null))[_0x0a9e('0x46')](handleError(_0x37f6cc,null));};exports[_0x0a9e('0x4a')]=function(_0x45bf7f,_0x5bbcde){return db[_0x0a9e('0x2c')][_0x0a9e('0x4a')](_0x45bf7f[_0x0a9e('0x4b')],{})[_0x0a9e('0x22')](function(_0x409789){var _0x992c77=_0x45bf7f[_0x0a9e('0x4c')][_0x0a9e('0x4d')]({'plain':!![]});if(!_0x992c77)throw new Error(_0x0a9e('0x4e'));if(_0x992c77['role']===_0x0a9e('0x4c')){var _0x3fe430=_0x409789['get']({'plain':!![]});var _0x4ae14b='Lists';return db[_0x0a9e('0x4f')][_0x0a9e('0x49')]({'where':{'name':_0x4ae14b,'userProfileId':_0x992c77[_0x0a9e('0x50')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x61bb17){if(_0x61bb17&&_0x61bb17[_0x0a9e('0x51')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x4a')]({'name':_0x3fe430['name'],'resourceId':_0x3fe430['id'],'type':_0x61bb17['name'],'sectionId':_0x61bb17['id']},{})['then'](function(){return _0x409789;});}else{return _0x409789;}})[_0x0a9e('0x46')](function(_0x204173){logger[_0x0a9e('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x204173);throw _0x204173;});}return _0x409789;})[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,0xc9))[_0x0a9e('0x46')](handleError(_0x5bbcde,null));};exports['update']=function(_0x5a88da,_0x2ef381){if(_0x5a88da['body']['id']){delete _0x5a88da[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x5a88da[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x2ef381,null))['then'](saveUpdates(_0x5a88da[_0x0a9e('0x4b')],null))[_0x0a9e('0x22')](respondWithResult(_0x2ef381,null))['catch'](handleError(_0x2ef381,null));};exports['destroy']=function(_0x128aa6,_0x3aedd0){return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x128aa6['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3aedd0,null))['then'](removeEntity(_0x3aedd0,null))[_0x0a9e('0x46')](handleError(_0x3aedd0,null));};exports['describe']=function(_0x5da27d,_0x5df0ad){return db[_0x0a9e('0x2c')]['describe']()[_0x0a9e('0x22')](respondWithResult(_0x5df0ad,null))[_0x0a9e('0x46')](handleError(_0x5df0ad,null));};exports[_0x0a9e('0x52')]=function(_0x19b4df,_0x232830,_0x272738){if(_0x19b4df[_0x0a9e('0x4b')]['id']){delete _0x19b4df[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x19b4df[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x232830,null))[_0x0a9e('0x22')](function(_0xb83dfd){if(_0xb83dfd){_0x19b4df[_0x0a9e('0x4b')]['ListId']=_0xb83dfd['id'];return db[_0x0a9e('0x53')][_0x0a9e('0x4a')](_0x19b4df['body']);}})[_0x0a9e('0x22')](respondWithResult(_0x232830,null))['catch'](handleError(_0x232830,null));};exports[_0x0a9e('0x54')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'raw':![],'where':{}};var _0x49d231={};var _0x2244d6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4b3c1a,null))[_0x0a9e('0x22')](function(_0x49eed0){if(_0x49eed0){_0x49d231[_0x0a9e('0x33')]=_['keys'](db[_0x0a9e('0x53')][_0x0a9e('0x2d')]);_0x49d231[_0x0a9e('0x30')]=_['keys'](_0x5ba1f9[_0x0a9e('0x30')]);_0x49d231[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x49d231[_0x0a9e('0x33')],_0x49d231['query']);_0x273cb5[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x49d231['model'],qs[_0x0a9e('0x35')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x273cb5[_0x0a9e('0x34')]=_0x273cb5[_0x0a9e('0x34')]['length']?_0x273cb5[_0x0a9e('0x34')]:_0x49d231[_0x0a9e('0x33')];if(!_0x5ba1f9[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x273cb5['limit']=qs['limit'](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x273cb5[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x273cb5[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x273cb5[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x5ba1f9[_0x0a9e('0x30')],_0x49d231[_0x0a9e('0x3b')]));_0x273cb5[_0x0a9e('0x3a')][_0x0a9e('0x56')]=_0x49eed0['id'];if(_0x5ba1f9[_0x0a9e('0x30')]['filter']){_0x273cb5[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x273cb5[_0x0a9e('0x3a')],{'$or':_['map'](_0x273cb5[_0x0a9e('0x34')],function(_0x30944e){var _0x4b341d={};_0x4b341d[_0x30944e]={'$like':'%'+_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x4b341d;})});}_0x273cb5=_[_0x0a9e('0x40')]({},_0x273cb5,_0x5ba1f9[_0x0a9e('0x41')]);return db[_0x0a9e('0x53')]['count']({'where':_0x273cb5['where']})['then'](function(_0x40fb85){_0x2244d6[_0x0a9e('0x1b')]=_0x40fb85;if(_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x273cb5[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x53')][_0x0a9e('0x44')](_0x273cb5);})[_0x0a9e('0x22')](function(_0x5512d1){_0x2244d6[_0x0a9e('0x45')]=_0x5512d1;return _0x2244d6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4b3c1a,_0x273cb5))[_0x0a9e('0x46')](handleError(_0x4b3c1a,null));};exports['removeDispositions']=function(_0x2bdc44,_0x583b2e,_0x4437ff){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x2bdc44[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x583b2e,null))[_0x0a9e('0x22')](function(_0x317c0c){if(_0x317c0c){return _0x317c0c['removeDispositions'](_0x2bdc44[_0x0a9e('0x30')][_0x0a9e('0x57')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x583b2e,null))[_0x0a9e('0x46')](handleError(_0x583b2e,null));};exports['addContacts']=function(_0x109ccb,_0x3d91db,_0x2d5506){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x109ccb[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3d91db,null))[_0x0a9e('0x22')](function(_0xf410e5){if(_0xf410e5){var _0x332367=[];var _0xdb98ca={'success':[],'errors':[]};return db[_0x0a9e('0x58')][_0x0a9e('0x59')]()[_0x0a9e('0x22')](function(_0x336dc3){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]&&_[_0x0a9e('0x5b')](_0x109ccb[_0x0a9e('0x4b')]['tags'])){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x36')]){_0x109ccb['body'][_0x0a9e('0x5a')]=_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x5c')](';')+';';}else{_0x109ccb['body']['tags']=null;}}else{_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]=null;}if(_0x109ccb['body']&&_[_0x0a9e('0x5b')](_0x109ccb['body'])){for(var _0x260f4b=0x0;_0x260f4b<_0x109ccb[_0x0a9e('0x4b')]['length'];_0x260f4b+=0x1){_0x109ccb[_0x0a9e('0x4b')][_0x260f4b][_0x0a9e('0x56')]=_0x109ccb[_0x0a9e('0x48')]['id'];_0x332367[_0x0a9e('0x5d')](_0x109ccb[_0x0a9e('0x4b')][_0x260f4b]);}return BPromise[_0x0a9e('0x5e')](_0x332367,function(_0x444f1f){return db['CmContact'][_0x0a9e('0x4a')](_[_0x0a9e('0x5f')](_0x444f1f,[_0x0a9e('0x57'),'id'])||{},{'fields':_[_0x0a9e('0x31')](_0x336dc3),'raw':!![]})['then'](function(_0xf51744){_0xdb98ca[_0x0a9e('0x60')]['push'](_0xf51744[_0x0a9e('0x61')]);})['catch'](function(_0x163710){_0xdb98ca[_0x0a9e('0x62')][_0x0a9e('0x5d')]({'data':_0x444f1f,'error':_0x163710[_0x0a9e('0x63')]});});})['then'](function(_0x51ccd7){return _0xdb98ca;})[_0x0a9e('0x46')](function(_0x2b9c01){return _0x2b9c01;});}else{_0x3d91db[_0x0a9e('0x1a')](0x190)['json']({'message':_0x0a9e('0x64')});}});}})[_0x0a9e('0x22')](respondWithResult(_0x3d91db,null))['catch'](handleError(_0x3d91db,null));};exports['getContacts']=function(_0xf0a802,_0x56acca,_0x5ea541){var _0x4dc6b3;return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0xf0a802[_0x0a9e('0x48')]['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x56acca,null))['then'](function(_0x5fd5db){if(_0x5fd5db){_0x4dc6b3=_0x5fd5db;return db['CmContact'][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x18ad56){if(_0x18ad56){var _0x4566b0={};var _0x50f8d7={};_0x50f8d7[_0x0a9e('0x33')]=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x18ad56),_['map'](_0x4dc6b3[_0x0a9e('0x66')],function(_0x21e592){return util[_0x0a9e('0x68')](_0x0a9e('0x69'),_0x21e592['id']);}));_0x50f8d7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0xf0a802[_0x0a9e('0x30')]);_0x50f8d7[_0x0a9e('0x3b')]=_['intersection'](_0x50f8d7[_0x0a9e('0x33')],_0x50f8d7[_0x0a9e('0x30')]);_0x4566b0['attributes']=_[_0x0a9e('0x32')](_0x50f8d7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0xf0a802['query'][_0x0a9e('0x35')]));_0x4566b0['attributes']=_0x4566b0[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4566b0[_0x0a9e('0x34')]:_0x50f8d7[_0x0a9e('0x33')];if(!_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x4566b0[_0x0a9e('0x1d')]=qs['limit'](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x4566b0[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x4566b0[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x4566b0[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0xf0a802['query'],_0x50f8d7[_0x0a9e('0x3b')]));_0x4566b0[_0x0a9e('0x6b')]=!![];if(_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x4566b0[_0x0a9e('0x3a')]=_['merge'](_0x4566b0[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x4566b0['attributes'],function(_0x23b447){var _0x5e725e={};_0x5e725e[_0x23b447]={'$like':'%'+_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x5e725e;})});}_0x4566b0=_[_0x0a9e('0x40')]({},_0x4566b0,_0xf0a802[_0x0a9e('0x41')]);return _0x4dc6b3['getContacts'](_0x4566b0);}})[_0x0a9e('0x22')](respondWithResult(_0x56acca,null))['catch'](handleError(_0x56acca,null));};exports[_0x0a9e('0x6c')]=function(_0x3d0a77,_0x5e5b89,_0x231c6a){var _0x63c9f7;return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x3d0a77['params']['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x5e5b89,null))[_0x0a9e('0x22')](function(_0x3f2f40){if(_0x3f2f40){_0x63c9f7=_0x3f2f40;return db[_0x0a9e('0x58')][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x3f8124){if(_0x3f8124){var _0x586510={};var _0x3156c7={};_0x3156c7['model']=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x3f8124),_[_0x0a9e('0x2b')](_0x63c9f7[_0x0a9e('0x66')],function(_0x1b61d5){return util['format'](_0x0a9e('0x69'),_0x1b61d5['id']);}));_0x3156c7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x3d0a77[_0x0a9e('0x30')]);_0x3156c7[_0x0a9e('0x3b')]=_['intersection'](_0x3156c7['model'],_0x3156c7[_0x0a9e('0x30')]);_0x586510['attributes']=_[_0x0a9e('0x32')](_0x3156c7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x586510[_0x0a9e('0x34')]=_0x586510['attributes']['length']?_0x586510[_0x0a9e('0x34')]:_0x3156c7['model'];if(!_0x3d0a77[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x586510['limit']=qs['limit'](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x586510['offset']=qs[_0x0a9e('0x1c')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x586510[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x3d0a77['query']['sort']);_0x586510[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x3d0a77[_0x0a9e('0x30')],_0x3156c7[_0x0a9e('0x3b')]));_0x586510['raw']=!![];if(_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x586510['where']=_[_0x0a9e('0x40')](_0x586510[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x586510[_0x0a9e('0x34')],function(_0x23b25b){var _0x23b39e={};_0x23b39e[_0x23b25b]={'$like':'%'+_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x23b39e;})});}_0x586510=_[_0x0a9e('0x40')]({},_0x586510,_0x3d0a77[_0x0a9e('0x41')]);return _0x63c9f7['getContacts'](_0x586510);}})[_0x0a9e('0x22')](function(_0x301047){if(!_[_0x0a9e('0x6d')](_0x301047)){var _0x1c4232=toCsv(_0x301047);var _0x1d0b02=Date['now']();fs['writeFileSync'](util[_0x0a9e('0x68')](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02),_0x1c4232);_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x70'),_0x0a9e('0x71')+util['format'](_0x0a9e('0x72'),_0x63c9f7['id'],_0x1d0b02));_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x73'),'text/csv');return _0x5e5b89[_0x0a9e('0x74')](util['format'](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02));}else{return _0x5e5b89['sendStatus'](0xcc);}})[_0x0a9e('0x46')](handleError(_0x5e5b89,null));};exports[_0x0a9e('0x75')]=function(_0xe339b1,_0x5c500c,_0xc9529d){var _0x5ed560;delete _0xe339b1[_0x0a9e('0x4b')]['id'];return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0xe339b1[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5c500c,null))[_0x0a9e('0x22')](function(_0x4014c7){if(_0x4014c7){return db[_0x0a9e('0x76')][_0x0a9e('0x77')](function(_0x27d1f5){return db[_0x0a9e('0x65')][_0x0a9e('0x4a')](_0xe339b1[_0x0a9e('0x4b')],{'transaction':_0x27d1f5})[_0x0a9e('0x22')](function(_0x98c62c){_0x5ed560=_0x98c62c;return _0x4014c7[_0x0a9e('0x78')](_0x98c62c,{'transaction':_0x27d1f5});})['then'](function(){var _0x556443={'type':db[_0x0a9e('0x79')]['TEXT'],'transaction':_0x27d1f5};switch(_0xe339b1[_0x0a9e('0x4b')][_0x0a9e('0x3e')]){case'text':_0x556443[_0x0a9e('0x3e')]=db[_0x0a9e('0x79')][_0x0a9e('0x7a')];break;case _0x0a9e('0x7b'):_0x556443['type']=db[_0x0a9e('0x79')][_0x0a9e('0x7c')];break;case _0x0a9e('0x7d'):_0x556443[_0x0a9e('0x3e')]=db['Sequelize'][_0x0a9e('0x7e')];_0x556443[_0x0a9e('0x7f')]=![];break;default:}return db[_0x0a9e('0x76')]['queryInterface'][_0x0a9e('0x80')](_0x0a9e('0x81'),util[_0x0a9e('0x68')]('cf_%s',_0x5ed560['id']),_0x556443);})[_0x0a9e('0x22')](function(){return _0x5ed560;});});}})[_0x0a9e('0x22')](respondWithResult(_0x5c500c,null))[_0x0a9e('0x46')](handleError(_0x5c500c,null));};exports[_0x0a9e('0x82')]=function(_0x2394d3,_0x555780,_0x3211d2){var _0x289e65={};var _0x4795ae={};var _0x3bab3e;var _0x1fcfe6;return db[_0x0a9e('0x2c')]['findOne']({'where':{'id':_0x2394d3['params']['id']}})['then'](handleEntityNotFound(_0x555780,null))[_0x0a9e('0x22')](function(_0x4a70ce){if(_0x4a70ce){_0x3bab3e=_0x4a70ce;_0x4795ae['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x65')][_0x0a9e('0x2d')]);_0x4795ae['query']=_[_0x0a9e('0x31')](_0x2394d3[_0x0a9e('0x30')]);_0x4795ae[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],_0x4795ae[_0x0a9e('0x30')]);_0x289e65[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],qs['fields'](_0x2394d3[_0x0a9e('0x30')]['fields']));_0x289e65[_0x0a9e('0x34')]=_0x289e65[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x289e65[_0x0a9e('0x34')]:_0x4795ae[_0x0a9e('0x33')];_0x289e65[_0x0a9e('0x38')]=qs['sort'](_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x289e65[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x2394d3[_0x0a9e('0x30')],_0x4795ae[_0x0a9e('0x3b')]));_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':[{'ListId':_0x4a70ce['id']},{'ListId':null}]});if(_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':_['map'](_0x289e65[_0x0a9e('0x34')],function(_0x88b25f){var _0x2ff265={};_0x2ff265[_0x88b25f]={'$like':'%'+_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x2ff265;})});}_0x289e65=_[_0x0a9e('0x40')]({},_0x289e65,_0x2394d3[_0x0a9e('0x41')]);return db[_0x0a9e('0x65')]['findAndCountAll'](_0x289e65);}})[_0x0a9e('0x22')](respondWithResult(_0x555780,null))[_0x0a9e('0x46')](handleError(_0x555780,null));};exports[_0x0a9e('0x83')]=function(_0x5c65fc,_0x1402c7,_0x41e446){return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0x5c65fc[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1402c7,null))[_0x0a9e('0x22')](function(_0x336a19){if(_0x336a19){return _0x336a19[_0x0a9e('0x83')](_0x5c65fc[_0x0a9e('0x4b')]['ids'],_[_0x0a9e('0x5f')](_0x5c65fc[_0x0a9e('0x4b')],[_0x0a9e('0x57'),'id'])||{})[_0x0a9e('0x84')](function(_0x2b624e){for(var _0x3942fd=0x0;_0x3942fd<_0x5c65fc['body'][_0x0a9e('0x57')]['length'];_0x3942fd+=0x1){socket['emit']('userCmList:save',{'UserId':_0x5c65fc[_0x0a9e('0x4b')][_0x0a9e('0x57')][_0x3942fd],'CmListId':_0x5c65fc[_0x0a9e('0x48')]['id']});}return _0x2b624e;});}})[_0x0a9e('0x22')](respondWithResult(_0x1402c7,null))['catch'](handleError(_0x1402c7,null));};exports[_0x0a9e('0x85')]=function(_0x309fa9,_0x3ddbc7,_0x1fdb10){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x309fa9['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3ddbc7,null))[_0x0a9e('0x22')](function(_0x2a293f){if(_0x2a293f){return _0x2a293f['removeAgents'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])[_0x0a9e('0x22')](function(){if(_['isArray'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])){for(var _0x15ba6b=0x0;_0x15ba6b<_0x309fa9['query'][_0x0a9e('0x57')][_0x0a9e('0x36')];_0x15ba6b+=0x1){socket[_0x0a9e('0x86')]('userCmList:remove',{'UserId':Number(_0x309fa9['query']['ids'][_0x15ba6b]),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}}else{socket[_0x0a9e('0x86')](_0x0a9e('0x87'),{'UserId':Number(_0x309fa9[_0x0a9e('0x30')]['ids']),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x3ddbc7,null))[_0x0a9e('0x46')](handleError(_0x3ddbc7,null));};exports[_0x0a9e('0x88')]=function(_0x242f23,_0x57f673,_0x33b4b3){var _0x33a26c={};var _0xb8a476={};var _0x580dd6;var _0x40eb5d;return db['CmList'][_0x0a9e('0x55')]({'where':{'id':_0x242f23['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x57f673,null))['then'](function(_0xb14971){if(_0xb14971){_0x580dd6=_0xb14971;_0xb8a476[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x89')][_0x0a9e('0x2d')]);_0xb8a476[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x242f23['query']);_0xb8a476[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0xb8a476['model'],_0xb8a476[_0x0a9e('0x30')]);_0x33a26c[_0x0a9e('0x34')]=_['intersection'](_0xb8a476[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x242f23[_0x0a9e('0x30')]['fields']));_0x33a26c[_0x0a9e('0x34')]=_0x33a26c[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x33a26c[_0x0a9e('0x34')]:_0xb8a476[_0x0a9e('0x33')];_0x33a26c[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x33a26c[_0x0a9e('0x3a')]=qs['filters'](_[_0x0a9e('0x3c')](_0x242f23['query'],_0xb8a476[_0x0a9e('0x3b')]));if(_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x33a26c[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x33a26c[_0x0a9e('0x3a')],{'$or':_['map'](_0x33a26c[_0x0a9e('0x34')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x242f23['query'][_0x0a9e('0x3d')]+'%'};return _0x2977a7;})});}_0x33a26c=_[_0x0a9e('0x40')]({},_0x33a26c,_0x242f23[_0x0a9e('0x41')]);return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1d0a78){if(_0x1d0a78){_0x40eb5d=_0x1d0a78[_0x0a9e('0x36')];if(!_0x242f23['query'][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x33a26c[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x33a26c[_0x0a9e('0x1c')]=qs['offset'](_0x242f23['query'][_0x0a9e('0x1c')]);}return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1bf692){if(_0x1bf692){return _0x1bf692?{'count':_0x40eb5d,'rows':_0x1bf692}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x57f673,null))[_0x0a9e('0x46')](handleError(_0x57f673,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 0d7397c..cc7eb7e 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 _0x5453=['../../mysqldb','CmList','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x43cda6,_0x49d8cb){var _0x3ef70e=function(_0x3b8094){while(--_0x3b8094){_0x43cda6['push'](_0x43cda6['shift']());}};_0x3ef70e(++_0x49d8cb);}(_0x5453,0x185));var _0x3545=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5453[_0x138adb];return _0x1b27f2;};'use strict';var EventEmitter=require(_0x3545('0x0'));var CmList=require(_0x3545('0x1'))['db'][_0x3545('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x3545('0x3')](0x0);var events={'afterCreate':_0x3545('0x4'),'afterUpdate':_0x3545('0x5'),'afterDestroy':'remove'};function emitEvent(_0x579a7b){return function(_0x38531e,_0xe317d0,_0x5382ea){CmListEvents[_0x3545('0x6')](_0x579a7b+':'+_0x38531e['id'],_0x38531e);CmListEvents[_0x3545('0x6')](_0x579a7b,_0x38531e);_0x5382ea(null);};}for(var e in events){if(events[_0x3545('0x7')](e)){var event=events[e];CmList[_0x3545('0x8')](e,emitEvent(event));}}module[_0x3545('0x9')]=CmListEvents; \ No newline at end of file +var _0x69f0=['events','../../mysqldb','CmList','setMaxListeners','update','remove','emit','hook'];(function(_0x18f478,_0x40ca8c){var _0x399309=function(_0x139491){while(--_0x139491){_0x18f478['push'](_0x18f478['shift']());}};_0x399309(++_0x40ca8c);}(_0x69f0,0x148));var _0x069f=function(_0x3a0bed,_0x377d33){_0x3a0bed=_0x3a0bed-0x0;var _0x14ed51=_0x69f0[_0x3a0bed];return _0x14ed51;};'use strict';var EventEmitter=require(_0x069f('0x0'));var CmList=require(_0x069f('0x1'))['db'][_0x069f('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x069f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x069f('0x4'),'afterDestroy':_0x069f('0x5')};function emitEvent(_0x169efd){return function(_0x1bc97f,_0x36c54b,_0x573e64){CmListEvents[_0x069f('0x6')](_0x169efd+':'+_0x1bc97f['id'],_0x1bc97f);CmListEvents[_0x069f('0x6')](_0x169efd,_0x1bc97f);_0x573e64(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x069f('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 64af490..a5ab460 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 _0x89fd=['exports','define','CmList','cm_lists','util','../../config/logger','request-promise','path','../../config/environment'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x89fd,0x82));var _0xd89f=function(_0x2d9bba,_0x1ea6b0){_0x2d9bba=_0x2d9bba-0x0;var _0x2cb7e7=_0x89fd[_0x2d9bba];return _0x2cb7e7;};'use strict';var _=require('lodash');var util=require(_0xd89f('0x0'));var logger=require(_0xd89f('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd89f('0x2'));var fs=require('fs');var path=require(_0xd89f('0x3'));var rimraf=require('rimraf');var config=require(_0xd89f('0x4'));var attributes=require('./cmList.attributes');module[_0xd89f('0x5')]=function(_0xcd0d29,_0x174b05){return _0xcd0d29[_0xd89f('0x6')](_0xd89f('0x7'),attributes,{'tableName':_0xd89f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1e8=['define','CmList','cm_lists','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc1e8,0x1f1));var _0x8c1e=function(_0x31ead7,_0x2e9a7c){_0x31ead7=_0x31ead7-0x0;var _0x3516f0=_0xc1e8[_0x31ead7];return _0x3516f0;};'use strict';var _=require(_0x8c1e('0x0'));var util=require(_0x8c1e('0x1'));var logger=require(_0x8c1e('0x2'))('api');var moment=require(_0x8c1e('0x3'));var BPromise=require(_0x8c1e('0x4'));var rp=require(_0x8c1e('0x5'));var fs=require('fs');var path=require(_0x8c1e('0x6'));var rimraf=require(_0x8c1e('0x7'));var config=require(_0x8c1e('0x8'));var attributes=require(_0x8c1e('0x9'));module['exports']=function(_0x517f1a,_0x38a74b){return _0x517f1a[_0x8c1e('0xa')](_0x8c1e('0xb'),attributes,{'tableName':_0x8c1e('0xc'),'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 9e6277f..aaa54de 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 _0xee9d=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./cmList.socket','register','info','CmList,\x20%s,\x20%s','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xee9d,0x12d));var _0xdee9=function(_0x3597e8,_0x499912){_0x3597e8=_0x3597e8-0x0;var _0x1da563=_0xee9d[_0x3597e8];return _0x1da563;};'use strict';var _=require(_0xdee9('0x0'));var util=require(_0xdee9('0x1'));var moment=require(_0xdee9('0x2'));var BPromise=require(_0xdee9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdee9('0x4'));var db=require(_0xdee9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdee9('0x6'))('rpc');var config=require(_0xdee9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdee9('0x8')][_0xdee9('0x9')]({'port':0x232a});config[_0xdee9('0xa')]=_[_0xdee9('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xdee9('0xc'))(new Redis(config[_0xdee9('0xa')]));require(_0xdee9('0xd'))[_0xdee9('0xe')](socket);function respondWithRpcPromise(_0x494bef,_0x3fe385,_0x37954e){return new BPromise(function(_0x20de16,_0x17036b){return client['request'](_0x494bef,_0x37954e)['then'](function(_0x51f4a5){logger[_0xdee9('0xf')](_0xdee9('0x10'),_0x3fe385,'request\x20sent');logger['debug'](_0xdee9('0x11'),_0x3fe385,_0xdee9('0x12'),JSON[_0xdee9('0x13')](_0x51f4a5));if(_0x51f4a5['error']){if(_0x51f4a5[_0xdee9('0x14')][_0xdee9('0x15')]===0x1f4){logger[_0xdee9('0x14')](_0xdee9('0x10'),_0x3fe385,_0x51f4a5[_0xdee9('0x14')]['message']);return _0x17036b(_0x51f4a5[_0xdee9('0x14')][_0xdee9('0x16')]);}logger['error'](_0xdee9('0x10'),_0x3fe385,_0x51f4a5[_0xdee9('0x14')]['message']);return _0x20de16(_0x51f4a5[_0xdee9('0x14')][_0xdee9('0x16')]);}else{logger[_0xdee9('0xf')]('CmList,\x20%s,\x20%s',_0x3fe385,_0xdee9('0x12'));_0x20de16(_0x51f4a5[_0xdee9('0x17')]['message']);}})[_0xdee9('0x18')](function(_0x5e0497){logger[_0xdee9('0x14')](_0xdee9('0x10'),_0x3fe385,_0x5e0497);_0x17036b(_0x5e0497);});});} \ No newline at end of file +var _0xf12b=['client','http','defaults','redis','./cmList.socket','register','request','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','CmList,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0xf12b,0x1a0));var _0xbf12=function(_0x28b90f,_0x4d4a2a){_0x28b90f=_0x28b90f-0x0;var _0xeb30a1=_0xf12b[_0x28b90f];return _0xeb30a1;};'use strict';var _=require(_0xbf12('0x0'));var util=require('util');var moment=require(_0xbf12('0x1'));var BPromise=require(_0xbf12('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf12('0x3'));var db=require(_0xbf12('0x4'))['db'];var utils=require(_0xbf12('0x5'));var logger=require(_0xbf12('0x6'))(_0xbf12('0x7'));var config=require('../../config/environment');var jayson=require(_0xbf12('0x8'));var client=jayson[_0xbf12('0x9')][_0xbf12('0xa')]({'port':0x232a});config['redis']=_[_0xbf12('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbf12('0xc')]));require(_0xbf12('0xd'))[_0xbf12('0xe')](socket);function respondWithRpcPromise(_0x2c1470,_0x2c717f,_0x3a0a9d){return new BPromise(function(_0x2b9fc5,_0xcc2c44){return client[_0xbf12('0xf')](_0x2c1470,_0x3a0a9d)['then'](function(_0x25ee37){logger['info']('CmList,\x20%s,\x20%s',_0x2c717f,_0xbf12('0x10'));logger[_0xbf12('0x11')](_0xbf12('0x12'),_0x2c717f,_0xbf12('0x10'),JSON['stringify'](_0x25ee37));if(_0x25ee37[_0xbf12('0x13')]){if(_0x25ee37[_0xbf12('0x13')][_0xbf12('0x14')]===0x1f4){logger[_0xbf12('0x13')](_0xbf12('0x15'),_0x2c717f,_0x25ee37['error'][_0xbf12('0x16')]);return _0xcc2c44(_0x25ee37[_0xbf12('0x13')]['message']);}logger[_0xbf12('0x13')]('CmList,\x20%s,\x20%s',_0x2c717f,_0x25ee37[_0xbf12('0x13')][_0xbf12('0x16')]);return _0x2b9fc5(_0x25ee37[_0xbf12('0x13')]['message']);}else{logger[_0xbf12('0x17')](_0xbf12('0x15'),_0x2c717f,_0xbf12('0x10'));_0x2b9fc5(_0x25ee37['result']['message']);}})[_0xbf12('0x18')](function(_0x1f52d4){logger[_0xbf12('0x13')]('CmList,\x20%s,\x20%s',_0x2c717f,_0x1f52d4);_0xcc2c44(_0x1f52d4);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index c994cc0..97a926a 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 _0x96f1=['emit','removeListener','register','cmList:','./cmList.events','save','remove','update'];(function(_0xa6c9b6,_0x51bfc6){var _0x593599=function(_0x19f957){while(--_0x19f957){_0xa6c9b6['push'](_0xa6c9b6['shift']());}};_0x593599(++_0x51bfc6);}(_0x96f1,0x19c));var _0x196f=function(_0x3e043a,_0x3beb96){_0x3e043a=_0x3e043a-0x0;var _0x57647f=_0x96f1[_0x3e043a];return _0x57647f;};'use strict';var CmListEvents=require(_0x196f('0x0'));var events=[_0x196f('0x1'),_0x196f('0x2'),_0x196f('0x3')];function createListener(_0x227254,_0x219e87){return function(_0xe61e26){_0x219e87[_0x196f('0x4')](_0x227254,_0xe61e26);};}function removeListener(_0x5b8eb5,_0x56fc61){return function(){CmListEvents[_0x196f('0x5')](_0x5b8eb5,_0x56fc61);};}exports[_0x196f('0x6')]=function(_0x267906){for(var _0x1f401c=0x0,_0x17f603=events['length'];_0x1f401c<_0x17f603;_0x1f401c++){var _0x427333=events[_0x1f401c];var _0x425e5c=createListener(_0x196f('0x7')+_0x427333,_0x267906);CmListEvents['on'](_0x427333,_0x425e5c);}}; \ No newline at end of file +var _0x8375=['cmList:','save','remove','update','register'];(function(_0x19e294,_0x341182){var _0x59cd9a=function(_0x395775){while(--_0x395775){_0x19e294['push'](_0x19e294['shift']());}};_0x59cd9a(++_0x341182);}(_0x8375,0x132));var _0x5837=function(_0x53be55,_0x4f3bb1){_0x53be55=_0x53be55-0x0;var _0x127655=_0x8375[_0x53be55];return _0x127655;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x5837('0x0'),_0x5837('0x1'),_0x5837('0x2')];function createListener(_0x1fb900,_0x3bd795){return function(_0x144751){_0x3bd795['emit'](_0x1fb900,_0x144751);};}function removeListener(_0x2ddfc1,_0x110a7d){return function(){CmListEvents['removeListener'](_0x2ddfc1,_0x110a7d);};}exports[_0x5837('0x3')]=function(_0x438491){for(var _0x21c9bd=0x0,_0x1e0d00=events['length'];_0x21c9bd<_0x1e0d00;_0x21c9bd++){var _0x23454c=events[_0x21c9bd];var _0x1f4f78=createListener(_0x5837('0x4')+_0x23454c,_0x438491);CmListEvents['on'](_0x23454c,_0x1f4f78);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 6bfb628..aaaf51a 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(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 e5bec87..e24b613 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x19b85d,_0x32ec71){var _0xe2703d=function(_0x50a050){while(--_0x50a050){_0x19b85d['push'](_0x19b85d['shift']());}};_0xe2703d(++_0x32ec71);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x5a649c,_0x592cac){var _0x53d3f4=function(_0x5023f1){while(--_0x5023f1){_0x5a649c['push'](_0x5a649c['shift']());}};_0x53d3f4(++_0x592cac);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 2b0845e..8c2f28e 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 _0xe695=['bluebird','mustache','util','path','sox','squel','jsforce','desk.js','to-csv','querystring','../../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','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','update','body','Condition','find','params','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x3e1d23,_0xd6a3d3){var _0x259e98=function(_0xaec5e3){while(--_0xaec5e3){_0x3e1d23['push'](_0x3e1d23['shift']());}};_0x259e98(++_0xd6a3d3);}(_0xe695,0xe9));var _0x5e69=function(_0x2b4933,_0x2edb2d){_0x2b4933=_0x2b4933-0x0;var _0x33ad51=_0xe695[_0x2b4933];return _0x33ad51;};'use strict';var pdf=require(_0x5e69('0x0'));var emlformat=require(_0x5e69('0x1'));var rimraf=require(_0x5e69('0x2'));var zipdir=require(_0x5e69('0x3'));var jsonpatch=require(_0x5e69('0x4'));var rp=require(_0x5e69('0x5'));var moment=require(_0x5e69('0x6'));var BPromise=require(_0x5e69('0x7'));var Mustache=require(_0x5e69('0x8'));var util=require(_0x5e69('0x9'));var path=require(_0x5e69('0xa'));var sox=require(_0x5e69('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5e69('0xc'));var crypto=require('crypto');var jsforce=require(_0x5e69('0xd'));var deskjs=require(_0x5e69('0xe'));var toCsv=require(_0x5e69('0xf'));var querystring=require(_0x5e69('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5e69('0x11'));var qs=require(_0x5e69('0x12'));var as=require(_0x5e69('0x13'));var hardwareService=require(_0x5e69('0x14'));var logger=require(_0x5e69('0x15'))(_0x5e69('0x16'));var utils=require(_0x5e69('0x17'));var config=require(_0x5e69('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x245536,_0x355a6e){_0x355a6e=_0x355a6e||0xcc;return function(_0x4f1704){if(_0x4f1704){return _0x245536[_0x5e69('0x19')](_0x355a6e);}return _0x245536[_0x5e69('0x1a')](_0x355a6e)[_0x5e69('0x1b')]();};}function respondWithResult(_0x57206c,_0x580108){_0x580108=_0x580108||0xc8;return function(_0x17c702){if(_0x17c702){return _0x57206c['status'](_0x580108)[_0x5e69('0x1c')](_0x17c702);}};}function respondWithFilteredResult(_0x50e17e,_0x3383d1){return function(_0x51f5b2){if(_0x51f5b2){var _0x55278b=_0x51f5b2[_0x5e69('0x1d')],_0x5e89e7=_0x3383d1[_0x5e69('0x1e')],_0x5d2b1f=_0x3383d1[_0x5e69('0x1e')]+_0x3383d1[_0x5e69('0x1f')],_0x1b2b67;if(_0x5d2b1f>=_0x55278b){_0x5d2b1f=_0x55278b;_0x1b2b67=0xc8;}else{_0x1b2b67=0xce;}_0x50e17e['status'](_0x1b2b67);return _0x50e17e[_0x5e69('0x20')](_0x5e69('0x21'),_0x5e89e7+'-'+_0x5d2b1f+'/'+_0x55278b)[_0x5e69('0x1c')](_0x51f5b2);}return null;};}function patchUpdates(_0x4faa4f){return function(_0x4a90ed){try{jsonpatch[_0x5e69('0x22')](_0x4a90ed,_0x4faa4f,!![]);}catch(_0x521289){return BPromise['reject'](_0x521289);}return _0x4a90ed[_0x5e69('0x23')]();};}function saveUpdates(_0xa16a32,_0x4bac66){return function(_0x50873c){if(_0x50873c){return _0x50873c['update'](_0xa16a32)[_0x5e69('0x24')](function(_0x245298){return _0x245298;});}return null;};}function removeEntity(_0x25d924,_0x44bc4a){return function(_0x512de1){if(_0x512de1){return _0x512de1[_0x5e69('0x25')]()['then'](function(){_0x25d924[_0x5e69('0x1a')](0xcc)[_0x5e69('0x1b')]();});}};}function handleEntityNotFound(_0x54f0cd,_0x49dc02){return function(_0x3e2b05){if(!_0x3e2b05){_0x54f0cd[_0x5e69('0x19')](0x194);}return _0x3e2b05;};}function handleError(_0x182940,_0x41ff9a){_0x41ff9a=_0x41ff9a||0x1f4;return function(_0x3125d3){logger[_0x5e69('0x26')](_0x3125d3[_0x5e69('0x27')]);if(_0x3125d3[_0x5e69('0x28')]){delete _0x3125d3[_0x5e69('0x28')];}_0x182940[_0x5e69('0x1a')](_0x41ff9a)[_0x5e69('0x29')](_0x3125d3);};}exports[_0x5e69('0x2a')]=function(_0x4a9ad5,_0x5d8a65){if(_0x4a9ad5['body']['id']){delete _0x4a9ad5[_0x5e69('0x2b')]['id'];}return db[_0x5e69('0x2c')][_0x5e69('0x2d')]({'where':{'id':_0x4a9ad5[_0x5e69('0x2e')]['id']}})[_0x5e69('0x24')](handleEntityNotFound(_0x5d8a65,null))[_0x5e69('0x24')](saveUpdates(_0x4a9ad5[_0x5e69('0x2b')],null))[_0x5e69('0x24')](respondWithResult(_0x5d8a65,null))[_0x5e69('0x2f')](handleError(_0x5d8a65,null));};exports[_0x5e69('0x25')]=function(_0x2d725a,_0x422c2d){return db[_0x5e69('0x2c')][_0x5e69('0x2d')]({'where':{'id':_0x2d725a[_0x5e69('0x2e')]['id']}})[_0x5e69('0x24')](handleEntityNotFound(_0x422c2d,null))['then'](removeEntity(_0x422c2d,null))[_0x5e69('0x2f')](handleError(_0x422c2d,null));}; \ No newline at end of file +var _0x13df=['body','catch','Condition','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','reject','update','then','destroy','end','error','stack','send','params'];(function(_0x255733,_0x52db8c){var _0x2c0d55=function(_0x1062b0){while(--_0x1062b0){_0x255733['push'](_0x255733['shift']());}};_0x2c0d55(++_0x52db8c);}(_0x13df,0x175));var _0xf13d=function(_0x2f525e,_0x35434e){_0x2f525e=_0x2f525e-0x0;var _0x3d31b2=_0x13df[_0x2f525e];return _0x3d31b2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf13d('0x0'));var rimraf=require(_0xf13d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf13d('0x2'));var rp=require(_0xf13d('0x3'));var moment=require(_0xf13d('0x4'));var BPromise=require(_0xf13d('0x5'));var Mustache=require(_0xf13d('0x6'));var util=require(_0xf13d('0x7'));var path=require(_0xf13d('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf13d('0x9'));var fs=require('fs');var _=require(_0xf13d('0xa'));var squel=require('squel');var crypto=require(_0xf13d('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf13d('0xc'));var querystring=require(_0xf13d('0xd'));var Papa=require(_0xf13d('0xe'));var Redis=require(_0xf13d('0xf'));var authService=require(_0xf13d('0x10'));var qs=require(_0xf13d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf13d('0x12'));var utils=require(_0xf13d('0x13'));var config=require(_0xf13d('0x14'));var licenseUtil=require(_0xf13d('0x15'));var db=require(_0xf13d('0x16'))['db'];function respondWithStatusCode(_0x29fb2d,_0x4db030){_0x4db030=_0x4db030||0xcc;return function(_0x19abba){if(_0x19abba){return _0x29fb2d[_0xf13d('0x17')](_0x4db030);}return _0x29fb2d[_0xf13d('0x18')](_0x4db030)['end']();};}function respondWithResult(_0x27fcc3,_0x11737b){_0x11737b=_0x11737b||0xc8;return function(_0x286628){if(_0x286628){return _0x27fcc3[_0xf13d('0x18')](_0x11737b)[_0xf13d('0x19')](_0x286628);}};}function respondWithFilteredResult(_0x3d6d21,_0x26a7fa){return function(_0x21a1e8){if(_0x21a1e8){var _0x1f51fa=_0x21a1e8[_0xf13d('0x1a')],_0x7be8f2=_0x26a7fa[_0xf13d('0x1b')],_0x445406=_0x26a7fa['offset']+_0x26a7fa['limit'],_0xdb9a5c;if(_0x445406>=_0x1f51fa){_0x445406=_0x1f51fa;_0xdb9a5c=0xc8;}else{_0xdb9a5c=0xce;}_0x3d6d21[_0xf13d('0x18')](_0xdb9a5c);return _0x3d6d21['set']('Content-Range',_0x7be8f2+'-'+_0x445406+'/'+_0x1f51fa)[_0xf13d('0x19')](_0x21a1e8);}return null;};}function patchUpdates(_0x5dd321){return function(_0x3f141d){try{jsonpatch['apply'](_0x3f141d,_0x5dd321,!![]);}catch(_0x495992){return BPromise[_0xf13d('0x1c')](_0x495992);}return _0x3f141d['save']();};}function saveUpdates(_0x4fce19,_0x55fd02){return function(_0x480348){if(_0x480348){return _0x480348[_0xf13d('0x1d')](_0x4fce19)[_0xf13d('0x1e')](function(_0x5bdb20){return _0x5bdb20;});}return null;};}function removeEntity(_0x1b4d2c,_0x153650){return function(_0x306bf2){if(_0x306bf2){return _0x306bf2[_0xf13d('0x1f')]()[_0xf13d('0x1e')](function(){_0x1b4d2c[_0xf13d('0x18')](0xcc)[_0xf13d('0x20')]();});}};}function handleEntityNotFound(_0x2cf72c,_0x5f30cf){return function(_0xb69889){if(!_0xb69889){_0x2cf72c[_0xf13d('0x17')](0x194);}return _0xb69889;};}function handleError(_0x101347,_0x38c0f7){_0x38c0f7=_0x38c0f7||0x1f4;return function(_0x345b2e){logger[_0xf13d('0x21')](_0x345b2e[_0xf13d('0x22')]);if(_0x345b2e['name']){delete _0x345b2e['name'];}_0x101347[_0xf13d('0x18')](_0x38c0f7)[_0xf13d('0x23')](_0x345b2e);};}exports[_0xf13d('0x1d')]=function(_0x520a3a,_0x5f5371){if(_0x520a3a['body']['id']){delete _0x520a3a['body']['id'];}return db['Condition']['find']({'where':{'id':_0x520a3a[_0xf13d('0x24')]['id']}})[_0xf13d('0x1e')](handleEntityNotFound(_0x5f5371,null))['then'](saveUpdates(_0x520a3a[_0xf13d('0x25')],null))[_0xf13d('0x1e')](respondWithResult(_0x5f5371,null))[_0xf13d('0x26')](handleError(_0x5f5371,null));};exports['destroy']=function(_0x1d30dc,_0x49760a){return db[_0xf13d('0x27')][_0xf13d('0x28')]({'where':{'id':_0x1d30dc[_0xf13d('0x24')]['id']}})[_0xf13d('0x1e')](handleEntityNotFound(_0x49760a,null))[_0xf13d('0x1e')](removeEntity(_0x49760a,null))[_0xf13d('0x26')](handleError(_0x49760a,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 626cba1..0ede23f 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 _0xfdb7=['exports','define','Condition','lodash','util','api','moment','request-promise','rimraf','./condition.attributes'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xfdb7,0x7b));var _0x7fdb=function(_0x53fb59,_0x39628b){_0x53fb59=_0x53fb59-0x0;var _0x3c31c0=_0xfdb7[_0x53fb59];return _0x3c31c0;};'use strict';var _=require(_0x7fdb('0x0'));var util=require(_0x7fdb('0x1'));var logger=require('../../config/logger')(_0x7fdb('0x2'));var moment=require(_0x7fdb('0x3'));var BPromise=require('bluebird');var rp=require(_0x7fdb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7fdb('0x5'));var config=require('../../config/environment');var attributes=require(_0x7fdb('0x6'));module[_0x7fdb('0x7')]=function(_0x124646,_0x2daa5c){return _0x124646[_0x7fdb('0x8')](_0x7fdb('0x9'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf43d=['./condition.attributes','exports','define','Condition','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x564992,_0x2ca814){var _0x1012ab=function(_0xd1db1c){while(--_0xd1db1c){_0x564992['push'](_0x564992['shift']());}};_0x1012ab(++_0x2ca814);}(_0xf43d,0xd5));var _0xdf43=function(_0x571577,_0x176b20){_0x571577=_0x571577-0x0;var _0x14cd8a=_0xf43d[_0x571577];return _0x14cd8a;};'use strict';var _=require(_0xdf43('0x0'));var util=require(_0xdf43('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdf43('0x2'));var BPromise=require(_0xdf43('0x3'));var rp=require(_0xdf43('0x4'));var fs=require('fs');var path=require(_0xdf43('0x5'));var rimraf=require(_0xdf43('0x6'));var config=require('../../config/environment');var attributes=require(_0xdf43('0x7'));module[_0xdf43('0x8')]=function(_0x310572,_0xade9ff){return _0x310572[_0xdf43('0x9')](_0xdf43('0xa'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 61816e8..99340c0 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 _0xcd31=['info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','Condition,\x20%s,\x20%s','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x27b97a,_0x50cec2){var _0x1b8dff=function(_0x41e700){while(--_0x41e700){_0x27b97a['push'](_0x27b97a['shift']());}};_0x1b8dff(++_0x50cec2);}(_0xcd31,0x163));var _0x1cd3=function(_0x43b8b2,_0x4393a6){_0x43b8b2=_0x43b8b2-0x0;var _0x52a2e4=_0xcd31[_0x43b8b2];return _0x52a2e4;};'use strict';var _=require('lodash');var util=require(_0x1cd3('0x0'));var moment=require(_0x1cd3('0x1'));var BPromise=require(_0x1cd3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1cd3('0x3'));var db=require(_0x1cd3('0x4'))['db'];var utils=require(_0x1cd3('0x5'));var logger=require(_0x1cd3('0x6'))(_0x1cd3('0x7'));var config=require(_0x1cd3('0x8'));var jayson=require(_0x1cd3('0x9'));var client=jayson[_0x1cd3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38262f,_0x2d53d4,_0x2e7a6a){return new BPromise(function(_0x195b06,_0x54e180){return client[_0x1cd3('0xb')](_0x38262f,_0x2e7a6a)[_0x1cd3('0xc')](function(_0x4ea2c7){logger[_0x1cd3('0xd')]('Condition,\x20%s,\x20%s',_0x2d53d4,_0x1cd3('0xe'));logger[_0x1cd3('0xf')](_0x1cd3('0x10'),_0x2d53d4,_0x1cd3('0xe'),JSON[_0x1cd3('0x11')](_0x4ea2c7));if(_0x4ea2c7[_0x1cd3('0x12')]){if(_0x4ea2c7[_0x1cd3('0x12')]['code']===0x1f4){logger[_0x1cd3('0x12')]('Condition,\x20%s,\x20%s',_0x2d53d4,_0x4ea2c7[_0x1cd3('0x12')][_0x1cd3('0x13')]);return _0x54e180(_0x4ea2c7[_0x1cd3('0x12')][_0x1cd3('0x13')]);}logger[_0x1cd3('0x12')](_0x1cd3('0x14'),_0x2d53d4,_0x4ea2c7['error'][_0x1cd3('0x13')]);return _0x195b06(_0x4ea2c7['error'][_0x1cd3('0x13')]);}else{logger['info'](_0x1cd3('0x14'),_0x2d53d4,'request\x20sent');_0x195b06(_0x4ea2c7[_0x1cd3('0x15')][_0x1cd3('0x13')]);}})[_0x1cd3('0x16')](function(_0x1250b3){logger[_0x1cd3('0x12')](_0x1cd3('0x14'),_0x2d53d4,_0x1250b3);_0x54e180(_0x1250b3);});});} \ No newline at end of file +var _0x6136=['stringify','error','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','Condition,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x53e3fa,_0x50c5f2){var _0xe8584a=function(_0x1771a5){while(--_0x1771a5){_0x53e3fa['push'](_0x53e3fa['shift']());}};_0xe8584a(++_0x50c5f2);}(_0x6136,0xc3));var _0x6613=function(_0xd8511d,_0x50880c){_0xd8511d=_0xd8511d-0x0;var _0x4423ac=_0x6136[_0xd8511d];return _0x4423ac;};'use strict';var _=require(_0x6613('0x0'));var util=require(_0x6613('0x1'));var moment=require(_0x6613('0x2'));var BPromise=require(_0x6613('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6613('0x4'))['db'];var utils=require(_0x6613('0x5'));var logger=require(_0x6613('0x6'))(_0x6613('0x7'));var config=require('../../config/environment');var jayson=require(_0x6613('0x8'));var client=jayson[_0x6613('0x9')][_0x6613('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16b2bb,_0x27e389,_0x28e6cd){return new BPromise(function(_0x5b7745,_0x4da73a){return client[_0x6613('0xb')](_0x16b2bb,_0x28e6cd)['then'](function(_0x1b3f38){logger['info'](_0x6613('0xc'),_0x27e389,_0x6613('0xd'));logger[_0x6613('0xe')]('Condition,\x20%s,\x20%s,\x20%s',_0x27e389,_0x6613('0xd'),JSON[_0x6613('0xf')](_0x1b3f38));if(_0x1b3f38[_0x6613('0x10')]){if(_0x1b3f38['error']['code']===0x1f4){logger[_0x6613('0x10')](_0x6613('0xc'),_0x27e389,_0x1b3f38['error'][_0x6613('0x11')]);return _0x4da73a(_0x1b3f38['error']['message']);}logger[_0x6613('0x10')](_0x6613('0xc'),_0x27e389,_0x1b3f38[_0x6613('0x10')]['message']);return _0x5b7745(_0x1b3f38[_0x6613('0x10')]['message']);}else{logger[_0x6613('0x12')](_0x6613('0xc'),_0x27e389,'request\x20sent');_0x5b7745(_0x1b3f38[_0x6613('0x13')]['message']);}})[_0x6613('0x14')](function(_0x180c7b){logger['error'](_0x6613('0xc'),_0x27e389,_0x180c7b);_0x4da73a(_0x180c7b);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index b159c4b..1c0559d 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 _0xafc0=['/:id','multer','util','path','connect-timeout','Router','../../config/environment','./condition.controller'];(function(_0x2998db,_0x3424f1){var _0x115fea=function(_0x3b493c){while(--_0x3b493c){_0x2998db['push'](_0x2998db['shift']());}};_0x115fea(++_0x3424f1);}(_0xafc0,0x69));var _0x0afc=function(_0x975237,_0x347cbe){_0x975237=_0x975237-0x0;var _0x99e9e=_0xafc0[_0x975237];return _0x99e9e;};'use strict';var multer=require(_0x0afc('0x0'));var util=require(_0x0afc('0x1'));var path=require(_0x0afc('0x2'));var timeout=require(_0x0afc('0x3'));var express=require('express');var router=express[_0x0afc('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0afc('0x5'));var controller=require(_0x0afc('0x6'));router['put'](_0x0afc('0x7'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x0afc('0x7'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x41a3=['../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','delete','destroy','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x1f530d,_0x18a19e){var _0x22103f=function(_0x2664c5){while(--_0x2664c5){_0x1f530d['push'](_0x1f530d['shift']());}};_0x22103f(++_0x18a19e);}(_0x41a3,0x140));var _0x341a=function(_0x316fcc,_0xd92f6c){_0x316fcc=_0x316fcc-0x0;var _0x39cefa=_0x41a3[_0x316fcc];return _0x39cefa;};'use strict';var multer=require(_0x341a('0x0'));var util=require('util');var path=require(_0x341a('0x1'));var timeout=require(_0x341a('0x2'));var express=require(_0x341a('0x3'));var router=express['Router']();var auth=require(_0x341a('0x4'));var interaction=require(_0x341a('0x5'));var config=require(_0x341a('0x6'));var controller=require('./condition.controller');router[_0x341a('0x7')](_0x341a('0x8'),auth[_0x341a('0x9')](),controller[_0x341a('0xa')]);router[_0x341a('0xb')]('/:id',auth[_0x341a('0x9')](),controller[_0x341a('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index a684bb9..7b89304 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 _0x9b2a=['STRING','name','INTEGER','sequelize'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x9b2a,0x127));var _0xa9b2=function(_0x33e967,_0x487721){_0x33e967=_0x33e967-0x0;var _0xe0c64e=_0x9b2a[_0x33e967];return _0xe0c64e;};'use strict';var Sequelize=require(_0xa9b2('0x0'));module['exports']={'name':{'type':Sequelize[_0xa9b2('0x1')],'allowNull':![],'unique':_0xa9b2('0x2')},'OrderBy':{'type':Sequelize[_0xa9b2('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x66fa=['sequelize','exports','STRING'];(function(_0x96740a,_0x3766b1){var _0x58a141=function(_0x490e11){while(--_0x490e11){_0x96740a['push'](_0x96740a['shift']());}};_0x58a141(++_0x3766b1);}(_0x66fa,0x168));var _0xa66f=function(_0x14b959,_0x3d4854){_0x14b959=_0x14b959-0x0;var _0x287a03=_0x66fa[_0x14b959];return _0x287a03;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'name':{'type':Sequelize[_0xa66f('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xa66f('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 1be9f3e..0c01113 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 _0x89b8=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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/utils','../../config/environment','../../mysqldb','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','map','ContactItemType','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','count','includeAll','include','findAll','catch','show','keys','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ContactItemTypes','userProfileId','autoAssociation','error','params'];(function(_0x2c4d34,_0x2ee772){var _0x438b83=function(_0x1328fe){while(--_0x1328fe){_0x2c4d34['push'](_0x2c4d34['shift']());}};_0x438b83(++_0x2ee772);}(_0x89b8,0x19f));var _0x889b=function(_0x5db6fc,_0xfb7b12){_0x5db6fc=_0x5db6fc-0x0;var _0x5282b4=_0x89b8[_0x5db6fc];return _0x5282b4;};'use strict';var pdf=require(_0x889b('0x0'));var emlformat=require(_0x889b('0x1'));var rimraf=require(_0x889b('0x2'));var zipdir=require(_0x889b('0x3'));var jsonpatch=require(_0x889b('0x4'));var rp=require(_0x889b('0x5'));var moment=require('moment');var BPromise=require(_0x889b('0x6'));var Mustache=require(_0x889b('0x7'));var util=require(_0x889b('0x8'));var path=require('path');var sox=require(_0x889b('0x9'));var csv=require(_0x889b('0xa'));var ejs=require(_0x889b('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x889b('0xc'));var crypto=require(_0x889b('0xd'));var jsforce=require(_0x889b('0xe'));var deskjs=require(_0x889b('0xf'));var toCsv=require(_0x889b('0xa'));var querystring=require(_0x889b('0x10'));var Papa=require(_0x889b('0x11'));var Redis=require(_0x889b('0x12'));var authService=require(_0x889b('0x13'));var qs=require(_0x889b('0x14'));var as=require(_0x889b('0x15'));var hardwareService=require(_0x889b('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x889b('0x17'));var config=require(_0x889b('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x889b('0x19'))['db'];function respondWithStatusCode(_0x38ef17,_0x59d037){_0x59d037=_0x59d037||0xcc;return function(_0x39faa4){if(_0x39faa4){return _0x38ef17['sendStatus'](_0x59d037);}return _0x38ef17[_0x889b('0x1a')](_0x59d037)[_0x889b('0x1b')]();};}function respondWithResult(_0x52be1e,_0x5769eb){_0x5769eb=_0x5769eb||0xc8;return function(_0x10c838){if(_0x10c838){return _0x52be1e['status'](_0x5769eb)['json'](_0x10c838);}};}function respondWithFilteredResult(_0x4b2a7c,_0x2bf9f3){return function(_0xedb905){if(_0xedb905){var _0x3eda0b=_0xedb905['count'],_0x20e313=_0x2bf9f3[_0x889b('0x1c')],_0x41e548=_0x2bf9f3['offset']+_0x2bf9f3[_0x889b('0x1d')],_0x339556;if(_0x41e548>=_0x3eda0b){_0x41e548=_0x3eda0b;_0x339556=0xc8;}else{_0x339556=0xce;}_0x4b2a7c[_0x889b('0x1a')](_0x339556);return _0x4b2a7c[_0x889b('0x1e')](_0x889b('0x1f'),_0x20e313+'-'+_0x41e548+'/'+_0x3eda0b)[_0x889b('0x20')](_0xedb905);}return null;};}function patchUpdates(_0x49aed0){return function(_0x2eb6a3){try{jsonpatch[_0x889b('0x21')](_0x2eb6a3,_0x49aed0,!![]);}catch(_0x2c80f9){return BPromise[_0x889b('0x22')](_0x2c80f9);}return _0x2eb6a3[_0x889b('0x23')]();};}function saveUpdates(_0x13e7b7,_0x16c439){return function(_0x278a87){if(_0x278a87){return _0x278a87[_0x889b('0x24')](_0x13e7b7)[_0x889b('0x25')](function(_0x46534d){return _0x46534d;});}return null;};}function removeEntity(_0x5bf7e2,_0x4cb5a3){return function(_0x51440c){if(_0x51440c){return _0x51440c[_0x889b('0x26')]()['then'](function(){var _0x478824=_0x51440c[_0x889b('0x27')]({'plain':!![]});var _0x3ebaad='ContactItemTypes';return db[_0x889b('0x28')]['destroy']({'where':{'type':_0x3ebaad,'resourceId':_0x478824['id']}})[_0x889b('0x25')](function(){return _0x51440c;});})[_0x889b('0x25')](function(){_0x5bf7e2[_0x889b('0x1a')](0xcc)[_0x889b('0x1b')]();});}};}function handleEntityNotFound(_0x5b0469,_0x534663){return function(_0x11c41e){if(!_0x11c41e){_0x5b0469['sendStatus'](0x194);}return _0x11c41e;};}function handleError(_0x3962d8,_0x53ccc5){_0x53ccc5=_0x53ccc5||0x1f4;return function(_0x7badfe){logger['error'](_0x7badfe[_0x889b('0x29')]);if(_0x7badfe[_0x889b('0x2a')]){delete _0x7badfe[_0x889b('0x2a')];}_0x3962d8[_0x889b('0x1a')](_0x53ccc5)[_0x889b('0x2b')](_0x7badfe);};}exports['index']=function(_0x498a00,_0x395aab){var _0x39fce8={},_0x5dd57e={},_0x5d13b2={'count':0x0,'rows':[]};var _0x2b1802=_[_0x889b('0x2c')](db[_0x889b('0x2d')][_0x889b('0x2e')],function(_0x1321c9){return{'name':_0x1321c9[_0x889b('0x2f')],'type':_0x1321c9[_0x889b('0x30')][_0x889b('0x31')]};});_0x5dd57e['model']=_['map'](_0x2b1802,'name');_0x5dd57e[_0x889b('0x32')]=_['keys'](_0x498a00[_0x889b('0x32')]);_0x5dd57e['filters']=_[_0x889b('0x33')](_0x5dd57e[_0x889b('0x34')],_0x5dd57e[_0x889b('0x32')]);_0x39fce8[_0x889b('0x35')]=_[_0x889b('0x33')](_0x5dd57e['model'],qs[_0x889b('0x36')](_0x498a00['query'][_0x889b('0x36')]));_0x39fce8[_0x889b('0x35')]=_0x39fce8[_0x889b('0x35')]['length']?_0x39fce8[_0x889b('0x35')]:_0x5dd57e[_0x889b('0x34')];if(!_0x498a00[_0x889b('0x32')][_0x889b('0x37')]('nolimit')){_0x39fce8['limit']=qs['limit'](_0x498a00[_0x889b('0x32')]['limit']);_0x39fce8[_0x889b('0x1c')]=qs[_0x889b('0x1c')](_0x498a00[_0x889b('0x32')]['offset']);}_0x39fce8[_0x889b('0x38')]=qs[_0x889b('0x39')](_0x498a00[_0x889b('0x32')]['sort']);_0x39fce8[_0x889b('0x3a')]=qs[_0x889b('0x3b')](_[_0x889b('0x3c')](_0x498a00[_0x889b('0x32')],_0x5dd57e[_0x889b('0x3b')]),_0x2b1802);if(_0x498a00[_0x889b('0x32')][_0x889b('0x3d')]){_0x39fce8[_0x889b('0x3a')]=_[_0x889b('0x3e')](_0x39fce8[_0x889b('0x3a')],{'$or':_[_0x889b('0x2c')](_0x2b1802,function(_0x106358){if(_0x106358['type']!=='VIRTUAL'){var _0x1d9a11={};_0x1d9a11[_0x106358[_0x889b('0x2a')]]={'$like':'%'+_0x498a00['query'][_0x889b('0x3d')]+'%'};return _0x1d9a11;}})});}_0x39fce8=_[_0x889b('0x3e')]({},_0x39fce8,_0x498a00['options']);var _0x5333b0={'where':_0x39fce8[_0x889b('0x3a')]};return db[_0x889b('0x2d')]['count'](_0x5333b0)[_0x889b('0x25')](function(_0x195dd6){_0x5d13b2[_0x889b('0x3f')]=_0x195dd6;if(_0x498a00['query'][_0x889b('0x40')]){_0x39fce8[_0x889b('0x41')]=[{'all':!![]}];}return db['ContactItemType'][_0x889b('0x42')](_0x39fce8);})[_0x889b('0x25')](function(_0x6498ef){_0x5d13b2['rows']=_0x6498ef;return _0x5d13b2;})[_0x889b('0x25')](respondWithFilteredResult(_0x395aab,_0x39fce8))[_0x889b('0x43')](handleError(_0x395aab,null));};exports[_0x889b('0x44')]=function(_0x3a01df,_0x2c2e09){var _0x397219={'raw':!![],'where':{'id':_0x3a01df['params']['id']}},_0x45cc9f={};_0x45cc9f[_0x889b('0x34')]=_[_0x889b('0x45')](db[_0x889b('0x2d')][_0x889b('0x2e')]);_0x45cc9f[_0x889b('0x32')]=_[_0x889b('0x45')](_0x3a01df['query']);_0x45cc9f['filters']=_[_0x889b('0x33')](_0x45cc9f[_0x889b('0x34')],_0x45cc9f[_0x889b('0x32')]);_0x397219[_0x889b('0x35')]=_[_0x889b('0x33')](_0x45cc9f[_0x889b('0x34')],qs[_0x889b('0x36')](_0x3a01df[_0x889b('0x32')][_0x889b('0x36')]));_0x397219[_0x889b('0x35')]=_0x397219['attributes'][_0x889b('0x46')]?_0x397219['attributes']:_0x45cc9f[_0x889b('0x34')];if(_0x3a01df[_0x889b('0x32')]['includeAll']){_0x397219[_0x889b('0x41')]=[{'all':!![]}];}_0x397219=_[_0x889b('0x3e')]({},_0x397219,_0x3a01df[_0x889b('0x47')]);return db[_0x889b('0x2d')][_0x889b('0x48')](_0x397219)['then'](handleEntityNotFound(_0x2c2e09,null))[_0x889b('0x25')](respondWithResult(_0x2c2e09,null))[_0x889b('0x43')](handleError(_0x2c2e09,null));};exports[_0x889b('0x49')]=function(_0x5728c3,_0x70d13e){return db[_0x889b('0x2d')][_0x889b('0x49')](_0x5728c3[_0x889b('0x4a')],{})[_0x889b('0x25')](function(_0x1cca7a){var _0x2ff87b=_0x5728c3[_0x889b('0x4b')]['get']({'plain':!![]});if(!_0x2ff87b)throw new Error(_0x889b('0x4c'));if(_0x2ff87b[_0x889b('0x4d')]===_0x889b('0x4b')){var _0x4f6d54=_0x1cca7a['get']({'plain':!![]});var _0x6b274=_0x889b('0x4e');return db['UserProfileSection']['find']({'where':{'name':_0x6b274,'userProfileId':_0x2ff87b[_0x889b('0x4f')]},'raw':!![]})[_0x889b('0x25')](function(_0x5b6a8e){if(_0x5b6a8e&&_0x5b6a8e[_0x889b('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x4f6d54[_0x889b('0x2a')],'resourceId':_0x4f6d54['id'],'type':_0x5b6a8e[_0x889b('0x2a')],'sectionId':_0x5b6a8e['id']},{})[_0x889b('0x25')](function(){return _0x1cca7a;});}else{return _0x1cca7a;}})['catch'](function(_0x37e044){logger[_0x889b('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37e044);throw _0x37e044;});}return _0x1cca7a;})[_0x889b('0x25')](respondWithResult(_0x70d13e,0xc9))['catch'](handleError(_0x70d13e,null));};exports[_0x889b('0x24')]=function(_0x991a74,_0x1bcb36){if(_0x991a74['body']['id']){delete _0x991a74['body']['id'];}return db[_0x889b('0x2d')][_0x889b('0x48')]({'where':{'id':_0x991a74[_0x889b('0x52')]['id']}})[_0x889b('0x25')](handleEntityNotFound(_0x1bcb36,null))[_0x889b('0x25')](saveUpdates(_0x991a74[_0x889b('0x4a')],null))[_0x889b('0x25')](respondWithResult(_0x1bcb36,null))['catch'](handleError(_0x1bcb36,null));};exports[_0x889b('0x26')]=function(_0x5e8f87,_0x129c60){return db['ContactItemType'][_0x889b('0x48')]({'where':{'id':_0x5e8f87[_0x889b('0x52')]['id']}})['then'](handleEntityNotFound(_0x129c60,null))[_0x889b('0x25')](removeEntity(_0x129c60,null))[_0x889b('0x43')](handleError(_0x129c60,null));}; \ No newline at end of file +var _0x5031=['fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','update','then','destroy','get','ContactItemTypes','sendStatus','error','name','send','index','map','ContactItemType','rawAttributes','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','findAll','catch','params','includeAll','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x51418b,_0x3420bd){var _0x3ec0dd=function(_0x216c06){while(--_0x216c06){_0x51418b['push'](_0x51418b['shift']());}};_0x3ec0dd(++_0x3420bd);}(_0x5031,0x144));var _0x1503=function(_0x2117db,_0x42410f){_0x2117db=_0x2117db-0x0;var _0x53e1c7=_0x5031[_0x2117db];return _0x53e1c7;};'use strict';var pdf=require(_0x1503('0x0'));var emlformat=require(_0x1503('0x1'));var rimraf=require(_0x1503('0x2'));var zipdir=require(_0x1503('0x3'));var jsonpatch=require(_0x1503('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1503('0x5'));var Mustache=require(_0x1503('0x6'));var util=require(_0x1503('0x7'));var path=require(_0x1503('0x8'));var sox=require(_0x1503('0x9'));var csv=require(_0x1503('0xa'));var ejs=require(_0x1503('0xb'));var fs=require('fs');var _=require(_0x1503('0xc'));var squel=require(_0x1503('0xd'));var crypto=require('crypto');var jsforce=require(_0x1503('0xe'));var deskjs=require(_0x1503('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1503('0x10'));var Papa=require(_0x1503('0x11'));var Redis=require(_0x1503('0x12'));var authService=require(_0x1503('0x13'));var qs=require(_0x1503('0x14'));var as=require(_0x1503('0x15'));var hardwareService=require(_0x1503('0x16'));var logger=require(_0x1503('0x17'))(_0x1503('0x18'));var utils=require(_0x1503('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x1503('0x1a'));var db=require(_0x1503('0x1b'))['db'];function respondWithStatusCode(_0x178564,_0x3431be){_0x3431be=_0x3431be||0xcc;return function(_0x3fd873){if(_0x3fd873){return _0x178564['sendStatus'](_0x3431be);}return _0x178564[_0x1503('0x1c')](_0x3431be)[_0x1503('0x1d')]();};}function respondWithResult(_0x1f5753,_0x8395f){_0x8395f=_0x8395f||0xc8;return function(_0x3ab7c2){if(_0x3ab7c2){return _0x1f5753[_0x1503('0x1c')](_0x8395f)[_0x1503('0x1e')](_0x3ab7c2);}};}function respondWithFilteredResult(_0xf8d9c1,_0x4405a8){return function(_0x1e35b2){if(_0x1e35b2){var _0x38868d=_0x1e35b2[_0x1503('0x1f')],_0x3c6935=_0x4405a8[_0x1503('0x20')],_0x2a3c8b=_0x4405a8[_0x1503('0x20')]+_0x4405a8[_0x1503('0x21')],_0x33dae9;if(_0x2a3c8b>=_0x38868d){_0x2a3c8b=_0x38868d;_0x33dae9=0xc8;}else{_0x33dae9=0xce;}_0xf8d9c1[_0x1503('0x1c')](_0x33dae9);return _0xf8d9c1['set'](_0x1503('0x22'),_0x3c6935+'-'+_0x2a3c8b+'/'+_0x38868d)[_0x1503('0x1e')](_0x1e35b2);}return null;};}function patchUpdates(_0x43b821){return function(_0x2e83aa){try{jsonpatch[_0x1503('0x23')](_0x2e83aa,_0x43b821,!![]);}catch(_0x501f7c){return BPromise['reject'](_0x501f7c);}return _0x2e83aa['save']();};}function saveUpdates(_0x57a7ea,_0x3ac90b){return function(_0x2915ff){if(_0x2915ff){return _0x2915ff[_0x1503('0x24')](_0x57a7ea)[_0x1503('0x25')](function(_0x5d0e02){return _0x5d0e02;});}return null;};}function removeEntity(_0xcf9963,_0x3b9835){return function(_0x13e757){if(_0x13e757){return _0x13e757[_0x1503('0x26')]()[_0x1503('0x25')](function(){var _0x68d82=_0x13e757[_0x1503('0x27')]({'plain':!![]});var _0xde9620=_0x1503('0x28');return db['UserProfileResource'][_0x1503('0x26')]({'where':{'type':_0xde9620,'resourceId':_0x68d82['id']}})['then'](function(){return _0x13e757;});})[_0x1503('0x25')](function(){_0xcf9963[_0x1503('0x1c')](0xcc)[_0x1503('0x1d')]();});}};}function handleEntityNotFound(_0x223cf2,_0x499ed6){return function(_0x346f55){if(!_0x346f55){_0x223cf2[_0x1503('0x29')](0x194);}return _0x346f55;};}function handleError(_0x1116b0,_0x322b6e){_0x322b6e=_0x322b6e||0x1f4;return function(_0x366d14){logger[_0x1503('0x2a')](_0x366d14['stack']);if(_0x366d14[_0x1503('0x2b')]){delete _0x366d14[_0x1503('0x2b')];}_0x1116b0[_0x1503('0x1c')](_0x322b6e)[_0x1503('0x2c')](_0x366d14);};}exports[_0x1503('0x2d')]=function(_0xcdb7ea,_0x3e7b2b){var _0x2cb8fa={},_0x13ec48={},_0x675da5={'count':0x0,'rows':[]};var _0x58d1df=_[_0x1503('0x2e')](db[_0x1503('0x2f')][_0x1503('0x30')],function(_0x53acd7){return{'name':_0x53acd7['fieldName'],'type':_0x53acd7['type'][_0x1503('0x31')]};});_0x13ec48['model']=_['map'](_0x58d1df,_0x1503('0x2b'));_0x13ec48[_0x1503('0x32')]=_[_0x1503('0x33')](_0xcdb7ea[_0x1503('0x32')]);_0x13ec48['filters']=_[_0x1503('0x34')](_0x13ec48['model'],_0x13ec48[_0x1503('0x32')]);_0x2cb8fa[_0x1503('0x35')]=_[_0x1503('0x34')](_0x13ec48[_0x1503('0x36')],qs['fields'](_0xcdb7ea[_0x1503('0x32')][_0x1503('0x37')]));_0x2cb8fa['attributes']=_0x2cb8fa[_0x1503('0x35')][_0x1503('0x38')]?_0x2cb8fa['attributes']:_0x13ec48[_0x1503('0x36')];if(!_0xcdb7ea[_0x1503('0x32')][_0x1503('0x39')](_0x1503('0x3a'))){_0x2cb8fa['limit']=qs[_0x1503('0x21')](_0xcdb7ea[_0x1503('0x32')][_0x1503('0x21')]);_0x2cb8fa[_0x1503('0x20')]=qs[_0x1503('0x20')](_0xcdb7ea['query'][_0x1503('0x20')]);}_0x2cb8fa[_0x1503('0x3b')]=qs['sort'](_0xcdb7ea[_0x1503('0x32')][_0x1503('0x3c')]);_0x2cb8fa[_0x1503('0x3d')]=qs[_0x1503('0x3e')](_['pick'](_0xcdb7ea['query'],_0x13ec48[_0x1503('0x3e')]),_0x58d1df);if(_0xcdb7ea[_0x1503('0x32')][_0x1503('0x3f')]){_0x2cb8fa[_0x1503('0x3d')]=_[_0x1503('0x40')](_0x2cb8fa[_0x1503('0x3d')],{'$or':_[_0x1503('0x2e')](_0x58d1df,function(_0xbf77a5){if(_0xbf77a5[_0x1503('0x41')]!==_0x1503('0x42')){var _0x1c9cda={};_0x1c9cda[_0xbf77a5[_0x1503('0x2b')]]={'$like':'%'+_0xcdb7ea[_0x1503('0x32')][_0x1503('0x3f')]+'%'};return _0x1c9cda;}})});}_0x2cb8fa=_[_0x1503('0x40')]({},_0x2cb8fa,_0xcdb7ea[_0x1503('0x43')]);var _0x49568d={'where':_0x2cb8fa['where']};return db[_0x1503('0x2f')][_0x1503('0x1f')](_0x49568d)[_0x1503('0x25')](function(_0x399f2d){_0x675da5[_0x1503('0x1f')]=_0x399f2d;if(_0xcdb7ea[_0x1503('0x32')]['includeAll']){_0x2cb8fa['include']=[{'all':!![]}];}return db[_0x1503('0x2f')][_0x1503('0x44')](_0x2cb8fa);})['then'](function(_0x360c26){_0x675da5['rows']=_0x360c26;return _0x675da5;})[_0x1503('0x25')](respondWithFilteredResult(_0x3e7b2b,_0x2cb8fa))[_0x1503('0x45')](handleError(_0x3e7b2b,null));};exports['show']=function(_0x54722c,_0x3a1501){var _0x1cd50e={'raw':!![],'where':{'id':_0x54722c[_0x1503('0x46')]['id']}},_0x58eb93={};_0x58eb93['model']=_['keys'](db[_0x1503('0x2f')]['rawAttributes']);_0x58eb93[_0x1503('0x32')]=_[_0x1503('0x33')](_0x54722c[_0x1503('0x32')]);_0x58eb93[_0x1503('0x3e')]=_[_0x1503('0x34')](_0x58eb93[_0x1503('0x36')],_0x58eb93[_0x1503('0x32')]);_0x1cd50e['attributes']=_['intersection'](_0x58eb93[_0x1503('0x36')],qs[_0x1503('0x37')](_0x54722c['query'][_0x1503('0x37')]));_0x1cd50e['attributes']=_0x1cd50e[_0x1503('0x35')][_0x1503('0x38')]?_0x1cd50e[_0x1503('0x35')]:_0x58eb93[_0x1503('0x36')];if(_0x54722c[_0x1503('0x32')][_0x1503('0x47')]){_0x1cd50e[_0x1503('0x48')]=[{'all':!![]}];}_0x1cd50e=_['merge']({},_0x1cd50e,_0x54722c[_0x1503('0x43')]);return db[_0x1503('0x2f')][_0x1503('0x49')](_0x1cd50e)[_0x1503('0x25')](handleEntityNotFound(_0x3a1501,null))[_0x1503('0x25')](respondWithResult(_0x3a1501,null))[_0x1503('0x45')](handleError(_0x3a1501,null));};exports[_0x1503('0x4a')]=function(_0x22c4db,_0x10dd97){return db[_0x1503('0x2f')][_0x1503('0x4a')](_0x22c4db[_0x1503('0x4b')],{})[_0x1503('0x25')](function(_0x581061){var _0x416d3b=_0x22c4db[_0x1503('0x4c')]['get']({'plain':!![]});if(!_0x416d3b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x416d3b[_0x1503('0x4d')]===_0x1503('0x4c')){var _0x203a28=_0x581061[_0x1503('0x27')]({'plain':!![]});var _0x2ec18d=_0x1503('0x28');return db[_0x1503('0x4e')]['find']({'where':{'name':_0x2ec18d,'userProfileId':_0x416d3b[_0x1503('0x4f')]},'raw':!![]})[_0x1503('0x25')](function(_0x986178){if(_0x986178&&_0x986178[_0x1503('0x50')]===0x0){return db[_0x1503('0x51')][_0x1503('0x4a')]({'name':_0x203a28[_0x1503('0x2b')],'resourceId':_0x203a28['id'],'type':_0x986178[_0x1503('0x2b')],'sectionId':_0x986178['id']},{})['then'](function(){return _0x581061;});}else{return _0x581061;}})[_0x1503('0x45')](function(_0x5b7884){logger[_0x1503('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b7884);throw _0x5b7884;});}return _0x581061;})[_0x1503('0x25')](respondWithResult(_0x10dd97,0xc9))[_0x1503('0x45')](handleError(_0x10dd97,null));};exports['update']=function(_0x76a98d,_0x3e3932){if(_0x76a98d['body']['id']){delete _0x76a98d[_0x1503('0x4b')]['id'];}return db[_0x1503('0x2f')]['find']({'where':{'id':_0x76a98d[_0x1503('0x46')]['id']}})[_0x1503('0x25')](handleEntityNotFound(_0x3e3932,null))['then'](saveUpdates(_0x76a98d[_0x1503('0x4b')],null))[_0x1503('0x25')](respondWithResult(_0x3e3932,null))[_0x1503('0x45')](handleError(_0x3e3932,null));};exports[_0x1503('0x26')]=function(_0x2ad8ff,_0x4e7e5f){return db['ContactItemType'][_0x1503('0x49')]({'where':{'id':_0x2ad8ff[_0x1503('0x46')]['id']}})[_0x1503('0x25')](handleEntityNotFound(_0x4e7e5f,null))[_0x1503('0x25')](removeEntity(_0x4e7e5f,null))['catch'](handleError(_0x4e7e5f,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index bed6fbc..6af337a 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 _0xd916=['../../config/logger','api','moment','request-promise','path','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util'];(function(_0x27714d,_0x457b53){var _0x18e2fb=function(_0x28f1d9){while(--_0x28f1d9){_0x27714d['push'](_0x27714d['shift']());}};_0x18e2fb(++_0x457b53);}(_0xd916,0x18a));var _0x6d91=function(_0x581537,_0x69d09e){_0x581537=_0x581537-0x0;var _0x5d64e0=_0xd916[_0x581537];return _0x5d64e0;};'use strict';var _=require(_0x6d91('0x0'));var util=require(_0x6d91('0x1'));var logger=require(_0x6d91('0x2'))(_0x6d91('0x3'));var moment=require(_0x6d91('0x4'));var BPromise=require('bluebird');var rp=require(_0x6d91('0x5'));var fs=require('fs');var path=require(_0x6d91('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6d91('0x7'));module[_0x6d91('0x8')]=function(_0x59c589,_0x1f5cfc){return _0x59c589[_0x6d91('0x9')](_0x6d91('0xa'),attributes,{'tableName':_0x6d91('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6bb4=['exports','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./contactItemType.attributes'];(function(_0x16452a,_0x3f9bdc){var _0x4b44c7=function(_0x3c6f71){while(--_0x3c6f71){_0x16452a['push'](_0x16452a['shift']());}};_0x4b44c7(++_0x3f9bdc);}(_0x6bb4,0x1a7));var _0x46bb=function(_0x2050a3,_0x5d2ae5){_0x2050a3=_0x2050a3-0x0;var _0x33db3c=_0x6bb4[_0x2050a3];return _0x33db3c;};'use strict';var _=require(_0x46bb('0x0'));var util=require(_0x46bb('0x1'));var logger=require(_0x46bb('0x2'))('api');var moment=require(_0x46bb('0x3'));var BPromise=require(_0x46bb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x46bb('0x5'));var rimraf=require(_0x46bb('0x6'));var config=require(_0x46bb('0x7'));var attributes=require(_0x46bb('0x8'));module[_0x46bb('0x9')]=function(_0x2ae90f,_0x5dd7d6){return _0x2ae90f['define'](_0x46bb('0xa'),attributes,{'tableName':_0x46bb('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 73f1008..8fd4d7f 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 _0x8e44=['ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x48f476,_0x596ff6){var _0x12c6d9=function(_0x4e0fe4){while(--_0x4e0fe4){_0x48f476['push'](_0x48f476['shift']());}};_0x12c6d9(++_0x596ff6);}(_0x8e44,0x1ac));var _0x48e4=function(_0x30683e,_0x31e018){_0x30683e=_0x30683e-0x0;var _0x14eb02=_0x8e44[_0x30683e];return _0x14eb02;};'use strict';var _=require(_0x48e4('0x0'));var util=require(_0x48e4('0x1'));var moment=require(_0x48e4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x48e4('0x3'));var db=require(_0x48e4('0x4'))['db'];var utils=require(_0x48e4('0x5'));var logger=require(_0x48e4('0x6'))('rpc');var config=require(_0x48e4('0x7'));var jayson=require(_0x48e4('0x8'));var client=jayson[_0x48e4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e2c12,_0x26c5de,_0xfd30df){return new BPromise(function(_0x552cb1,_0x1ae7a7){return client[_0x48e4('0xa')](_0x4e2c12,_0xfd30df)[_0x48e4('0xb')](function(_0x2ba319){logger[_0x48e4('0xc')](_0x48e4('0xd'),_0x26c5de,'request\x20sent');logger[_0x48e4('0xe')](_0x48e4('0xf'),_0x26c5de,_0x48e4('0x10'),JSON['stringify'](_0x2ba319));if(_0x2ba319['error']){if(_0x2ba319[_0x48e4('0x11')][_0x48e4('0x12')]===0x1f4){logger[_0x48e4('0x11')](_0x48e4('0xd'),_0x26c5de,_0x2ba319['error'][_0x48e4('0x13')]);return _0x1ae7a7(_0x2ba319['error'][_0x48e4('0x13')]);}logger[_0x48e4('0x11')](_0x48e4('0xd'),_0x26c5de,_0x2ba319[_0x48e4('0x11')][_0x48e4('0x13')]);return _0x552cb1(_0x2ba319[_0x48e4('0x11')][_0x48e4('0x13')]);}else{logger['info'](_0x48e4('0xd'),_0x26c5de,_0x48e4('0x10'));_0x552cb1(_0x2ba319['result'][_0x48e4('0x13')]);}})[_0x48e4('0x14')](function(_0x4dc92e){logger[_0x48e4('0x11')](_0x48e4('0xd'),_0x26c5de,_0x4dc92e);_0x1ae7a7(_0x4dc92e);});});} \ No newline at end of file +var _0xa902=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xa902,0x8d));var _0x2a90=function(_0x2320ff,_0x2cf2b9){_0x2320ff=_0x2320ff-0x0;var _0x88a621=_0xa902[_0x2320ff];return _0x88a621;};'use strict';var _=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var moment=require(_0x2a90('0x2'));var BPromise=require(_0x2a90('0x3'));var rs=require(_0x2a90('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a90('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2a90('0x6'));var config=require(_0x2a90('0x7'));var jayson=require(_0x2a90('0x8'));var client=jayson[_0x2a90('0x9')][_0x2a90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25bcfc,_0x58369a,_0x4109e6){return new BPromise(function(_0x570659,_0x5ec2b9){return client[_0x2a90('0xb')](_0x25bcfc,_0x4109e6)[_0x2a90('0xc')](function(_0xe500bc){logger[_0x2a90('0xd')](_0x2a90('0xe'),_0x58369a,'request\x20sent');logger[_0x2a90('0xf')](_0x2a90('0x10'),_0x58369a,_0x2a90('0x11'),JSON[_0x2a90('0x12')](_0xe500bc));if(_0xe500bc['error']){if(_0xe500bc[_0x2a90('0x13')]['code']===0x1f4){logger[_0x2a90('0x13')]('ContactItemType,\x20%s,\x20%s',_0x58369a,_0xe500bc[_0x2a90('0x13')]['message']);return _0x5ec2b9(_0xe500bc[_0x2a90('0x13')][_0x2a90('0x14')]);}logger[_0x2a90('0x13')]('ContactItemType,\x20%s,\x20%s',_0x58369a,_0xe500bc['error']['message']);return _0x570659(_0xe500bc[_0x2a90('0x13')][_0x2a90('0x14')]);}else{logger['info'](_0x2a90('0xe'),_0x58369a,_0x2a90('0x11'));_0x570659(_0xe500bc[_0x2a90('0x15')][_0x2a90('0x14')]);}})[_0x2a90('0x16')](function(_0x37858e){logger[_0x2a90('0x13')](_0x2a90('0xe'),_0x58369a,_0x37858e);_0x5ec2b9(_0x37858e);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index fa1696f..837d1af 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 _0x8303=['create','put','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./contactItemType.controller','isAuthenticated','index','get','/:id','show'];(function(_0x10baeb,_0x1f83cf){var _0x54493e=function(_0x14cb8c){while(--_0x14cb8c){_0x10baeb['push'](_0x10baeb['shift']());}};_0x54493e(++_0x1f83cf);}(_0x8303,0xa3));var _0x3830=function(_0x2bdaf5,_0x270c7a){_0x2bdaf5=_0x2bdaf5-0x0;var _0x14f43a=_0x8303[_0x2bdaf5];return _0x14f43a;};'use strict';var multer=require(_0x3830('0x0'));var util=require(_0x3830('0x1'));var path=require(_0x3830('0x2'));var timeout=require(_0x3830('0x3'));var express=require(_0x3830('0x4'));var router=express['Router']();var auth=require(_0x3830('0x5'));var interaction=require(_0x3830('0x6'));var config=require('../../config/environment');var controller=require(_0x3830('0x7'));router['get']('/',auth[_0x3830('0x8')](),controller[_0x3830('0x9')]);router[_0x3830('0xa')](_0x3830('0xb'),auth['isAuthenticated'](),controller[_0x3830('0xc')]);router['post']('/',auth[_0x3830('0x8')](),controller[_0x3830('0xd')]);router[_0x3830('0xe')](_0x3830('0xb'),auth[_0x3830('0x8')](),controller['update']);router['delete'](_0x3830('0xb'),auth[_0x3830('0x8')](),controller[_0x3830('0xf')]);module['exports']=router; \ No newline at end of file +var _0x3b83=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','index','get','isAuthenticated','post','create'];(function(_0x4b1c78,_0x3ddc23){var _0x4c2d9b=function(_0xcdf308){while(--_0xcdf308){_0x4b1c78['push'](_0x4b1c78['shift']());}};_0x4c2d9b(++_0x3ddc23);}(_0x3b83,0x6a));var _0x33b8=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x3b83[_0x39096d];return _0x13da4f;};'use strict';var multer=require(_0x33b8('0x0'));var util=require(_0x33b8('0x1'));var path=require(_0x33b8('0x2'));var timeout=require(_0x33b8('0x3'));var express=require(_0x33b8('0x4'));var router=express['Router']();var auth=require(_0x33b8('0x5'));var interaction=require(_0x33b8('0x6'));var config=require(_0x33b8('0x7'));var controller=require(_0x33b8('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x33b8('0x9')]);router[_0x33b8('0xa')]('/:id',auth[_0x33b8('0xb')](),controller['show']);router[_0x33b8('0xc')]('/',auth[_0x33b8('0xb')](),controller[_0x33b8('0xd')]);router[_0x33b8('0xe')](_0x33b8('0xf'),auth['isAuthenticated'](),controller[_0x33b8('0x10')]);router[_0x33b8('0x11')](_0x33b8('0xf'),auth['isAuthenticated'](),controller[_0x33b8('0x12')]);module[_0x33b8('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index a1b38d4..5a6c18a 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 _0x15c6=['name','sequelize','exports','STRING'];(function(_0x4d7995,_0x25050c){var _0x1b8592=function(_0x400ba9){while(--_0x400ba9){_0x4d7995['push'](_0x4d7995['shift']());}};_0x1b8592(++_0x25050c);}(_0x15c6,0x1cd));var _0x615c=function(_0x22dac7,_0x45d32a){_0x22dac7=_0x22dac7-0x0;var _0x3e6cfa=_0x15c6[_0x22dac7];return _0x3e6cfa;};'use strict';var Sequelize=require(_0x615c('0x0'));module[_0x615c('0x1')]={'name':{'type':Sequelize[_0x615c('0x2')],'allowNull':![],'unique':_0x615c('0x3')},'description':{'type':Sequelize[_0x615c('0x2')]}}; \ No newline at end of file +var _0x088e=['STRING','sequelize','exports'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0x088e,0x172));var _0xe088=function(_0x3d38ae,_0x51102b){_0x3d38ae=_0x3d38ae-0x0;var _0x3757ee=_0x088e[_0x3d38ae];return _0x3757ee;};'use strict';var Sequelize=require(_0xe088('0x0'));module[_0xe088('0x1')]={'name':{'type':Sequelize[_0xe088('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0xe088('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 681e9fc..e41e567 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 _0x7752=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','sendStatus','status','end','json','count','offset','limit','apply','reject','save','then','get','CustomDashboards','UserProfileResource','stack','name','send','index','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','Dashboard','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','update','destroy','attrUrl','attrs','https://','attrPath','clock','attrHourFormat','value','HH:mm:ss','attrTimezone','counter','attrMetric','total','attrVoiceQueues','attrFontSize','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','stringify','addItem','DashboardItem','getItems','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x315aea,_0x318a80){var _0x4a4bdb=function(_0x7c049c){while(--_0x7c049c){_0x315aea['push'](_0x315aea['shift']());}};_0x4a4bdb(++_0x318a80);}(_0x7752,0x14f));var _0x2775=function(_0x30b5e0,_0x532f1a){_0x30b5e0=_0x30b5e0-0x0;var _0x1f7afa=_0x7752[_0x30b5e0];return _0x1f7afa;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2775('0x0'));var rimraf=require(_0x2775('0x1'));var zipdir=require(_0x2775('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2775('0x3'));var moment=require(_0x2775('0x4'));var BPromise=require(_0x2775('0x5'));var Mustache=require(_0x2775('0x6'));var util=require(_0x2775('0x7'));var path=require(_0x2775('0x8'));var sox=require('sox');var csv=require(_0x2775('0x9'));var ejs=require(_0x2775('0xa'));var fs=require('fs');var _=require(_0x2775('0xb'));var squel=require(_0x2775('0xc'));var crypto=require(_0x2775('0xd'));var jsforce=require(_0x2775('0xe'));var deskjs=require(_0x2775('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2775('0x10'));var Papa=require(_0x2775('0x11'));var Redis=require(_0x2775('0x12'));var authService=require(_0x2775('0x13'));var qs=require(_0x2775('0x14'));var as=require(_0x2775('0x15'));var hardwareService=require(_0x2775('0x16'));var logger=require(_0x2775('0x17'))(_0x2775('0x18'));var utils=require(_0x2775('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x2775('0x1a'));var db=require(_0x2775('0x1b'))['db'];config[_0x2775('0x1c')]=_[_0x2775('0x1d')](config[_0x2775('0x1c')],{'host':_0x2775('0x1e'),'port':0x18eb});var socket=require(_0x2775('0x1f'))(new Redis(config[_0x2775('0x1c')]));require(_0x2775('0x20'))['register'](socket);function respondWithStatusCode(_0x4c51a4,_0x3dd9e3){_0x3dd9e3=_0x3dd9e3||0xcc;return function(_0x5da369){if(_0x5da369){return _0x4c51a4[_0x2775('0x21')](_0x3dd9e3);}return _0x4c51a4[_0x2775('0x22')](_0x3dd9e3)[_0x2775('0x23')]();};}function respondWithResult(_0x3474ce,_0x1b6df5){_0x1b6df5=_0x1b6df5||0xc8;return function(_0x353a76){if(_0x353a76){return _0x3474ce['status'](_0x1b6df5)[_0x2775('0x24')](_0x353a76);}};}function respondWithFilteredResult(_0x18558f,_0x2dae5a){return function(_0x5ec31a){if(_0x5ec31a){var _0x4ca6f1=_0x5ec31a[_0x2775('0x25')],_0x29b85c=_0x2dae5a[_0x2775('0x26')],_0x5cfe1f=_0x2dae5a[_0x2775('0x26')]+_0x2dae5a[_0x2775('0x27')],_0x15561d;if(_0x5cfe1f>=_0x4ca6f1){_0x5cfe1f=_0x4ca6f1;_0x15561d=0xc8;}else{_0x15561d=0xce;}_0x18558f[_0x2775('0x22')](_0x15561d);return _0x18558f['set']('Content-Range',_0x29b85c+'-'+_0x5cfe1f+'/'+_0x4ca6f1)[_0x2775('0x24')](_0x5ec31a);}return null;};}function patchUpdates(_0x52ebd3){return function(_0xa4e538){try{jsonpatch[_0x2775('0x28')](_0xa4e538,_0x52ebd3,!![]);}catch(_0xaad438){return BPromise[_0x2775('0x29')](_0xaad438);}return _0xa4e538[_0x2775('0x2a')]();};}function saveUpdates(_0x4f324e,_0x513c6a){return function(_0x425671){if(_0x425671){return _0x425671['update'](_0x4f324e)[_0x2775('0x2b')](function(_0x36c815){return _0x36c815;});}return null;};}function removeEntity(_0x2e28d5,_0x40de02){return function(_0x4d15b8){if(_0x4d15b8){return _0x4d15b8['destroy']()[_0x2775('0x2b')](function(){var _0x549ba1=_0x4d15b8[_0x2775('0x2c')]({'plain':!![]});var _0x5a6d18=_0x2775('0x2d');return db[_0x2775('0x2e')]['destroy']({'where':{'type':_0x5a6d18,'resourceId':_0x549ba1['id']}})[_0x2775('0x2b')](function(){return _0x4d15b8;});})[_0x2775('0x2b')](function(){_0x2e28d5['status'](0xcc)[_0x2775('0x23')]();});}};}function handleEntityNotFound(_0x3e9b13,_0x34ea30){return function(_0xe01380){if(!_0xe01380){_0x3e9b13[_0x2775('0x21')](0x194);}return _0xe01380;};}function handleError(_0x3af105,_0x355c37){_0x355c37=_0x355c37||0x1f4;return function(_0x159fe9){logger['error'](_0x159fe9[_0x2775('0x2f')]);if(_0x159fe9[_0x2775('0x30')]){delete _0x159fe9[_0x2775('0x30')];}_0x3af105[_0x2775('0x22')](_0x355c37)[_0x2775('0x31')](_0x159fe9);};}exports[_0x2775('0x32')]=function(_0x110a30,_0x1eb5e1){var _0x10b28c={},_0x3d711c={},_0x2aed55={'count':0x0,'rows':[]};var _0x4e6a8e=_['map'](db['Dashboard']['rawAttributes'],function(_0x3100b1){return{'name':_0x3100b1[_0x2775('0x33')],'type':_0x3100b1[_0x2775('0x34')][_0x2775('0x35')]};});_0x3d711c[_0x2775('0x36')]=_[_0x2775('0x37')](_0x4e6a8e,'name');_0x3d711c[_0x2775('0x38')]=_[_0x2775('0x39')](_0x110a30[_0x2775('0x38')]);_0x3d711c['filters']=_['intersection'](_0x3d711c[_0x2775('0x36')],_0x3d711c[_0x2775('0x38')]);_0x10b28c[_0x2775('0x3a')]=_[_0x2775('0x3b')](_0x3d711c[_0x2775('0x36')],qs['fields'](_0x110a30[_0x2775('0x38')][_0x2775('0x3c')]));_0x10b28c[_0x2775('0x3a')]=_0x10b28c[_0x2775('0x3a')][_0x2775('0x3d')]?_0x10b28c['attributes']:_0x3d711c['model'];if(!_0x110a30['query']['hasOwnProperty'](_0x2775('0x3e'))){_0x10b28c[_0x2775('0x27')]=qs[_0x2775('0x27')](_0x110a30['query'][_0x2775('0x27')]);_0x10b28c[_0x2775('0x26')]=qs['offset'](_0x110a30[_0x2775('0x38')]['offset']);}_0x10b28c[_0x2775('0x3f')]=qs[_0x2775('0x40')](_0x110a30[_0x2775('0x38')][_0x2775('0x40')]);_0x10b28c[_0x2775('0x41')]=qs[_0x2775('0x42')](_[_0x2775('0x43')](_0x110a30[_0x2775('0x38')],_0x3d711c[_0x2775('0x42')]),_0x4e6a8e);if(_0x110a30[_0x2775('0x38')][_0x2775('0x44')]){_0x10b28c[_0x2775('0x41')]=_[_0x2775('0x45')](_0x10b28c[_0x2775('0x41')],{'$or':_[_0x2775('0x37')](_0x4e6a8e,function(_0x2ea1c9){if(_0x2ea1c9[_0x2775('0x34')]!=='VIRTUAL'){var _0x4e1163={};_0x4e1163[_0x2ea1c9['name']]={'$like':'%'+_0x110a30[_0x2775('0x38')][_0x2775('0x44')]+'%'};return _0x4e1163;}})});}_0x10b28c=_[_0x2775('0x45')]({},_0x10b28c,_0x110a30[_0x2775('0x46')]);var _0x13417f={'where':_0x10b28c[_0x2775('0x41')]};return db[_0x2775('0x47')][_0x2775('0x25')](_0x13417f)[_0x2775('0x2b')](function(_0x43ab36){_0x2aed55[_0x2775('0x25')]=_0x43ab36;if(_0x110a30['query'][_0x2775('0x48')]){_0x10b28c[_0x2775('0x49')]=[{'all':!![]}];}return db[_0x2775('0x47')][_0x2775('0x4a')](_0x10b28c);})[_0x2775('0x2b')](function(_0x2619e1){_0x2aed55[_0x2775('0x4b')]=_0x2619e1;return _0x2aed55;})['then'](respondWithFilteredResult(_0x1eb5e1,_0x10b28c))['catch'](handleError(_0x1eb5e1,null));};exports[_0x2775('0x4c')]=function(_0x2f15de,_0x31c4b3){var _0x5ba81f={'raw':![],'where':{'id':_0x2f15de[_0x2775('0x4d')]['id']}},_0x5ea260={};_0x5ea260[_0x2775('0x36')]=_[_0x2775('0x39')](db[_0x2775('0x47')][_0x2775('0x4e')]);_0x5ea260[_0x2775('0x38')]=_[_0x2775('0x39')](_0x2f15de[_0x2775('0x38')]);_0x5ea260[_0x2775('0x42')]=_['intersection'](_0x5ea260['model'],_0x5ea260[_0x2775('0x38')]);_0x5ba81f[_0x2775('0x3a')]=_[_0x2775('0x3b')](_0x5ea260[_0x2775('0x36')],qs[_0x2775('0x3c')](_0x2f15de[_0x2775('0x38')][_0x2775('0x3c')]));_0x5ba81f['attributes']=_0x5ba81f[_0x2775('0x3a')][_0x2775('0x3d')]?_0x5ba81f['attributes']:_0x5ea260[_0x2775('0x36')];if(_0x2f15de[_0x2775('0x38')][_0x2775('0x48')]){_0x5ba81f[_0x2775('0x49')]=[{'all':!![]}];}_0x5ba81f=_[_0x2775('0x45')]({},_0x5ba81f,_0x2f15de[_0x2775('0x46')]);return db[_0x2775('0x47')][_0x2775('0x4f')](_0x5ba81f)['then'](handleEntityNotFound(_0x31c4b3,null))['then'](respondWithResult(_0x31c4b3,null))[_0x2775('0x50')](handleError(_0x31c4b3,null));};exports[_0x2775('0x51')]=function(_0x384cd0,_0x4d7b82){return db['Dashboard']['create'](_0x384cd0[_0x2775('0x52')],{})[_0x2775('0x2b')](function(_0x235c6b){var _0x30d8a6=_0x384cd0['user'][_0x2775('0x2c')]({'plain':!![]});if(!_0x30d8a6)throw new Error(_0x2775('0x53'));if(_0x30d8a6['role']===_0x2775('0x54')){var _0x49461a=_0x235c6b[_0x2775('0x2c')]({'plain':!![]});var _0x261dd5=_0x2775('0x2d');return db[_0x2775('0x55')][_0x2775('0x4f')]({'where':{'name':_0x261dd5,'userProfileId':_0x30d8a6['userProfileId']},'raw':!![]})[_0x2775('0x2b')](function(_0x2d74b3){if(_0x2d74b3&&_0x2d74b3[_0x2775('0x56')]===0x0){return db[_0x2775('0x2e')][_0x2775('0x51')]({'name':_0x49461a['name'],'resourceId':_0x49461a['id'],'type':_0x2d74b3[_0x2775('0x30')],'sectionId':_0x2d74b3['id']},{})[_0x2775('0x2b')](function(){return _0x235c6b;});}else{return _0x235c6b;}})[_0x2775('0x50')](function(_0x4ef61){logger[_0x2775('0x57')](_0x2775('0x58'),_0x4ef61);throw _0x4ef61;});}return _0x235c6b;})[_0x2775('0x2b')](respondWithResult(_0x4d7b82,0xc9))[_0x2775('0x50')](handleError(_0x4d7b82,null));};exports[_0x2775('0x59')]=function(_0x5106ac,_0x54d69f){var _0x13b44b={'where':{'id':_0x5106ac[_0x2775('0x4d')]['id']}},_0x29b582={};_0x29b582[_0x2775('0x36')]=_[_0x2775('0x39')](db[_0x2775('0x47')][_0x2775('0x4e')]);_0x13b44b[_0x2775('0x3a')]=_['intersection'](_0x29b582[_0x2775('0x36')],qs[_0x2775('0x3c')](_0x5106ac['query'][_0x2775('0x3c')]));_0x13b44b['attributes']=_0x13b44b['attributes']['length']?_0x13b44b[_0x2775('0x3a')]:_0x29b582[_0x2775('0x36')];if(_0x5106ac['query'][_0x2775('0x48')]){_0x13b44b[_0x2775('0x49')]=[{'all':!![]}];}_0x13b44b=_[_0x2775('0x45')]({},_0x13b44b,_0x5106ac[_0x2775('0x46')]);return db[_0x2775('0x47')][_0x2775('0x4f')](_0x13b44b)['then'](handleEntityNotFound(_0x54d69f,null))['then'](function(_0x338d54){if(_0x338d54){var _0x36109e=_0x338d54[_0x2775('0x2c')]({'plain':!![]});_0x36109e=qs[_0x2775('0x5a')](_0x36109e,['id','createdAt','updatedAt']);_0x5106ac[_0x2775('0x52')]=_[_0x2775('0x5a')](_0x5106ac[_0x2775('0x52')],['id','createdAt',_0x2775('0x5b')]);return db[_0x2775('0x47')][_0x2775('0x51')](_['merge'](_0x36109e,_0x5106ac[_0x2775('0x52')]),{'include':_0x5106ac[_0x2775('0x38')][_0x2775('0x48')]?[{'all':!![]}]:undefined})['then'](function(_0x1729a1){var _0x21852b=_0x5106ac[_0x2775('0x54')][_0x2775('0x2c')]({'plain':!![]});if(!_0x21852b)throw new Error(_0x2775('0x53'));if(_0x21852b['role']===_0x2775('0x54')){var _0x2b2ec1=_0x1729a1[_0x2775('0x2c')]({'plain':!![]});var _0x8e4bf0=_0x2775('0x2d');return db[_0x2775('0x55')][_0x2775('0x4f')]({'where':{'name':_0x8e4bf0,'userProfileId':_0x21852b['userProfileId']},'raw':!![]})['then'](function(_0xa021bf){if(_0xa021bf&&_0xa021bf[_0x2775('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x2b2ec1[_0x2775('0x30')],'resourceId':_0x2b2ec1['id'],'type':_0xa021bf['name'],'sectionId':_0xa021bf['id']},{})[_0x2775('0x2b')](function(){return _0x1729a1;});}else{return _0x1729a1;}})[_0x2775('0x50')](function(_0x18765b){logger['error'](_0x2775('0x58'),_0x18765b);throw _0x18765b;});}return _0x1729a1;});}})['then'](respondWithResult(_0x54d69f,0xc9))[_0x2775('0x50')](handleError(_0x54d69f,null));};exports[_0x2775('0x5c')]=function(_0x4931f5,_0x40035a){if(_0x4931f5[_0x2775('0x52')]['id']){delete _0x4931f5['body']['id'];}return db[_0x2775('0x47')][_0x2775('0x4f')]({'where':{'id':_0x4931f5[_0x2775('0x4d')]['id']}})[_0x2775('0x2b')](handleEntityNotFound(_0x40035a,null))['then'](saveUpdates(_0x4931f5[_0x2775('0x52')],null))[_0x2775('0x2b')](respondWithResult(_0x40035a,null))[_0x2775('0x50')](handleError(_0x40035a,null));};exports[_0x2775('0x5d')]=function(_0x591de9,_0x984e5f){return db[_0x2775('0x47')][_0x2775('0x4f')]({'where':{'id':_0x591de9['params']['id']}})[_0x2775('0x2b')](handleEntityNotFound(_0x984e5f,null))[_0x2775('0x2b')](removeEntity(_0x984e5f,null))[_0x2775('0x50')](handleError(_0x984e5f,null));};function widgetAttributes(_0x5a31e8){try{switch(_0x5a31e8['type']){case'iframe':return[{'name':_0x2775('0x5e'),'value':_0x5a31e8[_0x2775('0x5e')]||(_0x5a31e8[_0x2775('0x5f')]&&_0x5a31e8[_0x2775('0x5f')][0x0]?_0x5a31e8['attrs'][0x0]['value']:undefined)||_0x2775('0x60')}];case'custom':return[{'name':_0x2775('0x61'),'value':_0x5a31e8[_0x2775('0x61')]||(_0x5a31e8[_0x2775('0x5f')]&&_0x5a31e8[_0x2775('0x5f')][0x0]?_0x5a31e8[_0x2775('0x5f')][0x0]['value']:undefined)||''}];case _0x2775('0x62'):return[{'name':_0x2775('0x63'),'value':_0x5a31e8[_0x2775('0x63')]||(_0x5a31e8[_0x2775('0x5f')]&&_0x5a31e8['attrs'][0x0]?_0x5a31e8['attrs'][0x0][_0x2775('0x64')]:undefined)||_0x2775('0x65')},{'name':_0x2775('0x66'),'value':_0x5a31e8[_0x2775('0x66')]||(_0x5a31e8[_0x2775('0x5f')]&&_0x5a31e8[_0x2775('0x5f')][0x1]?_0x5a31e8[_0x2775('0x5f')][0x1][_0x2775('0x64')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x5a31e8['attrFontSize']||(_0x5a31e8[_0x2775('0x5f')]&&_0x5a31e8[_0x2775('0x5f')][0x2]?_0x5a31e8[_0x2775('0x5f')][0x2]['value']:undefined)||0xc}];case _0x2775('0x67'):return[{'name':_0x2775('0x68'),'value':_0x5a31e8[_0x2775('0x68')]||(_0x5a31e8['attrs']&&_0x5a31e8[_0x2775('0x5f')][0x0]?_0x5a31e8[_0x2775('0x5f')][0x0][_0x2775('0x64')]:undefined)||_0x2775('0x69')},{'name':_0x2775('0x6a'),'value':_0x5a31e8['attrVoiceQueues']||(_0x5a31e8[_0x2775('0x5f')]&&_0x5a31e8['attrs'][0x1]?_0x5a31e8[_0x2775('0x5f')][0x1][_0x2775('0x64')]:undefined)||[]},{'name':_0x2775('0x6b'),'value':_0x5a31e8['attrFontSize']||(_0x5a31e8[_0x2775('0x5f')]&&_0x5a31e8[_0x2775('0x5f')][0x2]?_0x5a31e8[_0x2775('0x5f')][0x2]['value']:undefined)||0x14}];case _0x2775('0x6c'):case'pie-chart':return[{'name':_0x2775('0x6d'),'value':_0x5a31e8[_0x2775('0x6d')]||(_0x5a31e8[_0x2775('0x5f')]&&_0x5a31e8['attrs'][0x0]?_0x5a31e8[_0x2775('0x5f')][0x0]['value']:undefined)||_0x2775('0x69')},{'name':_0x2775('0x6e'),'value':_0x5a31e8['attrSerie2']||(_0x5a31e8[_0x2775('0x5f')]&&_0x5a31e8[_0x2775('0x5f')][0x1]?_0x5a31e8[_0x2775('0x5f')][0x1][_0x2775('0x64')]:undefined)||null},{'name':_0x2775('0x6f'),'value':_0x5a31e8[_0x2775('0x6f')]||(_0x5a31e8[_0x2775('0x5f')]&&_0x5a31e8[_0x2775('0x5f')][0x2]?_0x5a31e8[_0x2775('0x5f')][0x2][_0x2775('0x64')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x5a31e8['attrVoiceQueues']||(_0x5a31e8['attrs']&&_0x5a31e8['attrs'][0x3]?_0x5a31e8[_0x2775('0x5f')][0x3][_0x2775('0x64')]:undefined)||[]}];case'web-report':return[{'name':_0x2775('0x70'),'type':_0x5a31e8[_0x2775('0x71')]||(_0x5a31e8[_0x2775('0x5f')]&&_0x5a31e8[_0x2775('0x5f')][0x0]?_0x5a31e8[_0x2775('0x5f')][0x0][_0x2775('0x34')]:undefined)||null,'value':_0x5a31e8[_0x2775('0x70')]||(_0x5a31e8['attrs']&&_0x5a31e8[_0x2775('0x5f')][0x0]?_0x5a31e8[_0x2775('0x5f')][0x0]['value']:undefined)||null},{'name':_0x2775('0x72'),'value':_0x5a31e8[_0x2775('0x72')]||(_0x5a31e8['attrs']&&_0x5a31e8[_0x2775('0x5f')][0x1]?_0x5a31e8[_0x2775('0x5f')][0x1][_0x2775('0x64')]:undefined)||0x0}];default:return[];}}catch(_0x3d182a){logger[_0x2775('0x57')]('widgetAttributes:\x20%s',JSON[_0x2775('0x73')](_0x3d182a));return[];}}exports[_0x2775('0x74')]=function(_0x34c338,_0x2043fe,_0x52bf5e){if(_0x34c338[_0x2775('0x52')]['id']){delete _0x34c338['body']['id'];}return db['Dashboard'][_0x2775('0x4f')]({'where':{'id':_0x34c338['params']['id']}})['then'](handleEntityNotFound(_0x2043fe,null))[_0x2775('0x2b')](function(_0x1de62b){if(_0x1de62b){_0x34c338[_0x2775('0x52')]['DashboardId']=_0x1de62b['id'];_0x34c338[_0x2775('0x52')][_0x2775('0x5f')]=widgetAttributes(_0x34c338[_0x2775('0x52')]);return db[_0x2775('0x75')][_0x2775('0x51')](_0x34c338[_0x2775('0x52')]);}})[_0x2775('0x2b')](respondWithResult(_0x2043fe,null))['catch'](handleError(_0x2043fe,null));};exports[_0x2775('0x76')]=function(_0x2edf06,_0x4da3f6,_0x449408){var _0x4b9a33={};var _0x26311c={};var _0x2fca99;var _0x1df59d;return db[_0x2775('0x47')]['findOne']({'where':{'id':_0x2edf06[_0x2775('0x4d')]['id']}})[_0x2775('0x2b')](handleEntityNotFound(_0x4da3f6,null))[_0x2775('0x2b')](function(_0x51e0a6){if(_0x51e0a6){_0x2fca99=_0x51e0a6;_0x26311c[_0x2775('0x36')]=_[_0x2775('0x39')](db[_0x2775('0x75')]['rawAttributes']);_0x26311c['query']=_[_0x2775('0x39')](_0x2edf06[_0x2775('0x38')]);_0x26311c[_0x2775('0x42')]=_[_0x2775('0x3b')](_0x26311c['model'],_0x26311c[_0x2775('0x38')]);_0x4b9a33[_0x2775('0x3a')]=_[_0x2775('0x3b')](_0x26311c[_0x2775('0x36')],qs[_0x2775('0x3c')](_0x2edf06[_0x2775('0x38')]['fields']));_0x4b9a33[_0x2775('0x3a')]=_0x4b9a33[_0x2775('0x3a')][_0x2775('0x3d')]?_0x4b9a33['attributes']:_0x26311c[_0x2775('0x36')];_0x4b9a33[_0x2775('0x3f')]=qs[_0x2775('0x40')](_0x2edf06[_0x2775('0x38')][_0x2775('0x40')]);_0x4b9a33['where']=qs[_0x2775('0x42')](_[_0x2775('0x43')](_0x2edf06[_0x2775('0x38')],_0x26311c[_0x2775('0x42')]));if(_0x2edf06['query']['filter']){_0x4b9a33['where']=_['merge'](_0x4b9a33[_0x2775('0x41')],{'$or':_['map'](_0x4b9a33[_0x2775('0x3a')],function(_0x1a38b6){var _0x54237b={};_0x54237b[_0x1a38b6]={'$like':'%'+_0x2edf06[_0x2775('0x38')][_0x2775('0x44')]+'%'};return _0x54237b;})});}_0x4b9a33=_[_0x2775('0x45')]({},_0x4b9a33,_0x2edf06['options']);return _0x2fca99[_0x2775('0x76')](_0x4b9a33);}})['then'](function(_0x195ec3){if(_0x195ec3){_0x1df59d=_0x195ec3[_0x2775('0x3d')];if(!_0x2edf06[_0x2775('0x38')]['hasOwnProperty'](_0x2775('0x3e'))){_0x4b9a33[_0x2775('0x27')]=qs['limit'](_0x2edf06[_0x2775('0x38')][_0x2775('0x27')]);_0x4b9a33[_0x2775('0x26')]=qs['offset'](_0x2edf06[_0x2775('0x38')][_0x2775('0x26')]);}return _0x2fca99[_0x2775('0x76')](_0x4b9a33);}})[_0x2775('0x2b')](function(_0x585a2f){if(_0x585a2f){return _0x585a2f?{'count':_0x1df59d,'rows':_0x585a2f}:null;}})['then'](respondWithResult(_0x4da3f6,null))[_0x2775('0x50')](handleError(_0x4da3f6,null));}; \ No newline at end of file +var _0xa39c=['catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','body','createdAt','updatedAt','UserProfileSection','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','DashboardItem','hasOwnProperty','nolimit','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','./dashboard.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','CustomDashboards','error','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','order','sort','where','pick','filter','type','VIRTUAL','merge','options','Dashboard','count','includeAll','include','findAll','rows','show','params','fields','length'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0xa39c,0x129));var _0xca39=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xa39c[_0x4565bf];return _0x5610ba;};'use strict';var pdf=require(_0xca39('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xca39('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xca39('0x2'));var moment=require(_0xca39('0x3'));var BPromise=require(_0xca39('0x4'));var Mustache=require(_0xca39('0x5'));var util=require(_0xca39('0x6'));var path=require(_0xca39('0x7'));var sox=require('sox');var csv=require(_0xca39('0x8'));var ejs=require(_0xca39('0x9'));var fs=require('fs');var _=require(_0xca39('0xa'));var squel=require('squel');var crypto=require(_0xca39('0xb'));var jsforce=require(_0xca39('0xc'));var deskjs=require(_0xca39('0xd'));var toCsv=require('to-csv');var querystring=require(_0xca39('0xe'));var Papa=require(_0xca39('0xf'));var Redis=require(_0xca39('0x10'));var authService=require(_0xca39('0x11'));var qs=require(_0xca39('0x12'));var as=require(_0xca39('0x13'));var hardwareService=require(_0xca39('0x14'));var logger=require(_0xca39('0x15'))('api');var utils=require(_0xca39('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xca39('0x17'));var db=require(_0xca39('0x18'))['db'];config['redis']=_[_0xca39('0x19')](config[_0xca39('0x1a')],{'host':_0xca39('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xca39('0x1a')]));require(_0xca39('0x1c'))[_0xca39('0x1d')](socket);function respondWithStatusCode(_0x2dfb82,_0x9ee6c5){_0x9ee6c5=_0x9ee6c5||0xcc;return function(_0x428ebf){if(_0x428ebf){return _0x2dfb82[_0xca39('0x1e')](_0x9ee6c5);}return _0x2dfb82[_0xca39('0x1f')](_0x9ee6c5)[_0xca39('0x20')]();};}function respondWithResult(_0x3c5694,_0x720a87){_0x720a87=_0x720a87||0xc8;return function(_0x1d8971){if(_0x1d8971){return _0x3c5694[_0xca39('0x1f')](_0x720a87)[_0xca39('0x21')](_0x1d8971);}};}function respondWithFilteredResult(_0xb2c139,_0x827433){return function(_0x527685){if(_0x527685){var _0x5ef70c=_0x527685['count'],_0x21d441=_0x827433[_0xca39('0x22')],_0x3ed68d=_0x827433['offset']+_0x827433[_0xca39('0x23')],_0x3aa172;if(_0x3ed68d>=_0x5ef70c){_0x3ed68d=_0x5ef70c;_0x3aa172=0xc8;}else{_0x3aa172=0xce;}_0xb2c139['status'](_0x3aa172);return _0xb2c139[_0xca39('0x24')](_0xca39('0x25'),_0x21d441+'-'+_0x3ed68d+'/'+_0x5ef70c)[_0xca39('0x21')](_0x527685);}return null;};}function patchUpdates(_0x5e8d4a){return function(_0x404803){try{jsonpatch[_0xca39('0x26')](_0x404803,_0x5e8d4a,!![]);}catch(_0x3ac341){return BPromise[_0xca39('0x27')](_0x3ac341);}return _0x404803[_0xca39('0x28')]();};}function saveUpdates(_0x410e78,_0x46c412){return function(_0x3e1bae){if(_0x3e1bae){return _0x3e1bae[_0xca39('0x29')](_0x410e78)['then'](function(_0xd5c57a){return _0xd5c57a;});}return null;};}function removeEntity(_0x33b4b4,_0x8ca889){return function(_0x533f50){if(_0x533f50){return _0x533f50[_0xca39('0x2a')]()[_0xca39('0x2b')](function(){var _0x2f65a0=_0x533f50[_0xca39('0x2c')]({'plain':!![]});var _0x2c6a12=_0xca39('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x2c6a12,'resourceId':_0x2f65a0['id']}})['then'](function(){return _0x533f50;});})[_0xca39('0x2b')](function(){_0x33b4b4[_0xca39('0x1f')](0xcc)[_0xca39('0x20')]();});}};}function handleEntityNotFound(_0xd6c611,_0x5577bb){return function(_0x53ef01){if(!_0x53ef01){_0xd6c611[_0xca39('0x1e')](0x194);}return _0x53ef01;};}function handleError(_0x34cb31,_0x4c0a0a){_0x4c0a0a=_0x4c0a0a||0x1f4;return function(_0x2d670f){logger[_0xca39('0x2e')](_0x2d670f['stack']);if(_0x2d670f[_0xca39('0x2f')]){delete _0x2d670f[_0xca39('0x2f')];}_0x34cb31[_0xca39('0x1f')](_0x4c0a0a)['send'](_0x2d670f);};}exports[_0xca39('0x30')]=function(_0x135434,_0x574688){var _0x58a778={},_0x536409={},_0xc8b355={'count':0x0,'rows':[]};var _0x183112=_[_0xca39('0x31')](db['Dashboard'][_0xca39('0x32')],function(_0x327ae8){return{'name':_0x327ae8[_0xca39('0x33')],'type':_0x327ae8['type'][_0xca39('0x34')]};});_0x536409[_0xca39('0x35')]=_['map'](_0x183112,_0xca39('0x2f'));_0x536409[_0xca39('0x36')]=_[_0xca39('0x37')](_0x135434[_0xca39('0x36')]);_0x536409[_0xca39('0x38')]=_[_0xca39('0x39')](_0x536409[_0xca39('0x35')],_0x536409['query']);_0x58a778['attributes']=_[_0xca39('0x39')](_0x536409[_0xca39('0x35')],qs['fields'](_0x135434[_0xca39('0x36')]['fields']));_0x58a778['attributes']=_0x58a778[_0xca39('0x3a')]['length']?_0x58a778[_0xca39('0x3a')]:_0x536409[_0xca39('0x35')];if(!_0x135434['query']['hasOwnProperty']('nolimit')){_0x58a778['limit']=qs[_0xca39('0x23')](_0x135434[_0xca39('0x36')][_0xca39('0x23')]);_0x58a778[_0xca39('0x22')]=qs[_0xca39('0x22')](_0x135434[_0xca39('0x36')][_0xca39('0x22')]);}_0x58a778[_0xca39('0x3b')]=qs['sort'](_0x135434[_0xca39('0x36')][_0xca39('0x3c')]);_0x58a778[_0xca39('0x3d')]=qs['filters'](_[_0xca39('0x3e')](_0x135434['query'],_0x536409[_0xca39('0x38')]),_0x183112);if(_0x135434['query'][_0xca39('0x3f')]){_0x58a778['where']=_['merge'](_0x58a778[_0xca39('0x3d')],{'$or':_['map'](_0x183112,function(_0x20a82f){if(_0x20a82f[_0xca39('0x40')]!==_0xca39('0x41')){var _0x2fab43={};_0x2fab43[_0x20a82f['name']]={'$like':'%'+_0x135434[_0xca39('0x36')]['filter']+'%'};return _0x2fab43;}})});}_0x58a778=_[_0xca39('0x42')]({},_0x58a778,_0x135434[_0xca39('0x43')]);var _0x35b32e={'where':_0x58a778[_0xca39('0x3d')]};return db[_0xca39('0x44')][_0xca39('0x45')](_0x35b32e)[_0xca39('0x2b')](function(_0x345b08){_0xc8b355['count']=_0x345b08;if(_0x135434[_0xca39('0x36')][_0xca39('0x46')]){_0x58a778[_0xca39('0x47')]=[{'all':!![]}];}return db[_0xca39('0x44')][_0xca39('0x48')](_0x58a778);})[_0xca39('0x2b')](function(_0x200cf1){_0xc8b355[_0xca39('0x49')]=_0x200cf1;return _0xc8b355;})[_0xca39('0x2b')](respondWithFilteredResult(_0x574688,_0x58a778))['catch'](handleError(_0x574688,null));};exports[_0xca39('0x4a')]=function(_0x3d4736,_0x5d91c0){var _0x1db28d={'raw':![],'where':{'id':_0x3d4736[_0xca39('0x4b')]['id']}},_0x580662={};_0x580662[_0xca39('0x35')]=_[_0xca39('0x37')](db['Dashboard']['rawAttributes']);_0x580662[_0xca39('0x36')]=_['keys'](_0x3d4736[_0xca39('0x36')]);_0x580662['filters']=_[_0xca39('0x39')](_0x580662[_0xca39('0x35')],_0x580662[_0xca39('0x36')]);_0x1db28d[_0xca39('0x3a')]=_[_0xca39('0x39')](_0x580662[_0xca39('0x35')],qs[_0xca39('0x4c')](_0x3d4736[_0xca39('0x36')][_0xca39('0x4c')]));_0x1db28d[_0xca39('0x3a')]=_0x1db28d['attributes'][_0xca39('0x4d')]?_0x1db28d[_0xca39('0x3a')]:_0x580662['model'];if(_0x3d4736['query']['includeAll']){_0x1db28d[_0xca39('0x47')]=[{'all':!![]}];}_0x1db28d=_[_0xca39('0x42')]({},_0x1db28d,_0x3d4736['options']);return db['Dashboard']['find'](_0x1db28d)[_0xca39('0x2b')](handleEntityNotFound(_0x5d91c0,null))['then'](respondWithResult(_0x5d91c0,null))[_0xca39('0x4e')](handleError(_0x5d91c0,null));};exports[_0xca39('0x4f')]=function(_0x6cbe4d,_0x470918){return db['Dashboard'][_0xca39('0x4f')](_0x6cbe4d['body'],{})[_0xca39('0x2b')](function(_0x1b7dd9){var _0x4ef7c4=_0x6cbe4d[_0xca39('0x50')][_0xca39('0x2c')]({'plain':!![]});if(!_0x4ef7c4)throw new Error(_0xca39('0x51'));if(_0x4ef7c4[_0xca39('0x52')]==='user'){var _0x5a1da6=_0x1b7dd9[_0xca39('0x2c')]({'plain':!![]});var _0x293b9b=_0xca39('0x2d');return db['UserProfileSection'][_0xca39('0x53')]({'where':{'name':_0x293b9b,'userProfileId':_0x4ef7c4[_0xca39('0x54')]},'raw':!![]})['then'](function(_0x2023af){if(_0x2023af&&_0x2023af[_0xca39('0x55')]===0x0){return db[_0xca39('0x56')]['create']({'name':_0x5a1da6[_0xca39('0x2f')],'resourceId':_0x5a1da6['id'],'type':_0x2023af['name'],'sectionId':_0x2023af['id']},{})['then'](function(){return _0x1b7dd9;});}else{return _0x1b7dd9;}})[_0xca39('0x4e')](function(_0x40f0be){logger[_0xca39('0x2e')](_0xca39('0x57'),_0x40f0be);throw _0x40f0be;});}return _0x1b7dd9;})['then'](respondWithResult(_0x470918,0xc9))[_0xca39('0x4e')](handleError(_0x470918,null));};exports[_0xca39('0x58')]=function(_0x2dea08,_0x4245f9){var _0x15e90e={'where':{'id':_0x2dea08[_0xca39('0x4b')]['id']}},_0x11b2a5={};_0x11b2a5[_0xca39('0x35')]=_['keys'](db[_0xca39('0x44')][_0xca39('0x32')]);_0x15e90e[_0xca39('0x3a')]=_[_0xca39('0x39')](_0x11b2a5[_0xca39('0x35')],qs[_0xca39('0x4c')](_0x2dea08['query']['fields']));_0x15e90e[_0xca39('0x3a')]=_0x15e90e[_0xca39('0x3a')][_0xca39('0x4d')]?_0x15e90e[_0xca39('0x3a')]:_0x11b2a5['model'];if(_0x2dea08['query'][_0xca39('0x46')]){_0x15e90e['include']=[{'all':!![]}];}_0x15e90e=_[_0xca39('0x42')]({},_0x15e90e,_0x2dea08[_0xca39('0x43')]);return db[_0xca39('0x44')][_0xca39('0x53')](_0x15e90e)[_0xca39('0x2b')](handleEntityNotFound(_0x4245f9,null))['then'](function(_0x5b8141){if(_0x5b8141){var _0x2be52c=_0x5b8141[_0xca39('0x2c')]({'plain':!![]});_0x2be52c=qs[_0xca39('0x59')](_0x2be52c,['id','createdAt','updatedAt']);_0x2dea08['body']=_[_0xca39('0x59')](_0x2dea08[_0xca39('0x5a')],['id',_0xca39('0x5b'),_0xca39('0x5c')]);return db[_0xca39('0x44')][_0xca39('0x4f')](_[_0xca39('0x42')](_0x2be52c,_0x2dea08[_0xca39('0x5a')]),{'include':_0x2dea08[_0xca39('0x36')][_0xca39('0x46')]?[{'all':!![]}]:undefined})[_0xca39('0x2b')](function(_0x352a64){var _0x40a608=_0x2dea08[_0xca39('0x50')][_0xca39('0x2c')]({'plain':!![]});if(!_0x40a608)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40a608[_0xca39('0x52')]===_0xca39('0x50')){var _0x5a8d17=_0x352a64[_0xca39('0x2c')]({'plain':!![]});var _0x242aba=_0xca39('0x2d');return db[_0xca39('0x5d')][_0xca39('0x53')]({'where':{'name':_0x242aba,'userProfileId':_0x40a608['userProfileId']},'raw':!![]})[_0xca39('0x2b')](function(_0x424ab1){if(_0x424ab1&&_0x424ab1[_0xca39('0x55')]===0x0){return db[_0xca39('0x56')]['create']({'name':_0x5a8d17['name'],'resourceId':_0x5a8d17['id'],'type':_0x424ab1['name'],'sectionId':_0x424ab1['id']},{})[_0xca39('0x2b')](function(){return _0x352a64;});}else{return _0x352a64;}})[_0xca39('0x4e')](function(_0x5a3d04){logger['error'](_0xca39('0x57'),_0x5a3d04);throw _0x5a3d04;});}return _0x352a64;});}})[_0xca39('0x2b')](respondWithResult(_0x4245f9,0xc9))[_0xca39('0x4e')](handleError(_0x4245f9,null));};exports['update']=function(_0x32e9ee,_0x5c3f39){if(_0x32e9ee[_0xca39('0x5a')]['id']){delete _0x32e9ee['body']['id'];}return db[_0xca39('0x44')][_0xca39('0x53')]({'where':{'id':_0x32e9ee['params']['id']}})['then'](handleEntityNotFound(_0x5c3f39,null))[_0xca39('0x2b')](saveUpdates(_0x32e9ee['body'],null))[_0xca39('0x2b')](respondWithResult(_0x5c3f39,null))[_0xca39('0x4e')](handleError(_0x5c3f39,null));};exports['destroy']=function(_0x211d80,_0x49b66e){return db['Dashboard'][_0xca39('0x53')]({'where':{'id':_0x211d80[_0xca39('0x4b')]['id']}})['then'](handleEntityNotFound(_0x49b66e,null))[_0xca39('0x2b')](removeEntity(_0x49b66e,null))['catch'](handleError(_0x49b66e,null));};function widgetAttributes(_0x35c47c){try{switch(_0x35c47c[_0xca39('0x40')]){case'iframe':return[{'name':_0xca39('0x5e'),'value':_0x35c47c[_0xca39('0x5e')]||(_0x35c47c[_0xca39('0x5f')]&&_0x35c47c[_0xca39('0x5f')][0x0]?_0x35c47c[_0xca39('0x5f')][0x0][_0xca39('0x60')]:undefined)||_0xca39('0x61')}];case _0xca39('0x62'):return[{'name':'attrPath','value':_0x35c47c[_0xca39('0x63')]||(_0x35c47c[_0xca39('0x5f')]&&_0x35c47c[_0xca39('0x5f')][0x0]?_0x35c47c[_0xca39('0x5f')][0x0][_0xca39('0x60')]:undefined)||''}];case _0xca39('0x64'):return[{'name':_0xca39('0x65'),'value':_0x35c47c[_0xca39('0x65')]||(_0x35c47c[_0xca39('0x5f')]&&_0x35c47c['attrs'][0x0]?_0x35c47c[_0xca39('0x5f')][0x0][_0xca39('0x60')]:undefined)||_0xca39('0x66')},{'name':_0xca39('0x67'),'value':_0x35c47c[_0xca39('0x67')]||(_0x35c47c[_0xca39('0x5f')]&&_0x35c47c[_0xca39('0x5f')][0x1]?_0x35c47c[_0xca39('0x5f')][0x1][_0xca39('0x60')]:undefined)||_0xca39('0x68')},{'name':_0xca39('0x69'),'value':_0x35c47c[_0xca39('0x69')]||(_0x35c47c['attrs']&&_0x35c47c[_0xca39('0x5f')][0x2]?_0x35c47c['attrs'][0x2][_0xca39('0x60')]:undefined)||0xc}];case _0xca39('0x6a'):return[{'name':_0xca39('0x6b'),'value':_0x35c47c[_0xca39('0x6b')]||(_0x35c47c[_0xca39('0x5f')]&&_0x35c47c[_0xca39('0x5f')][0x0]?_0x35c47c['attrs'][0x0]['value']:undefined)||_0xca39('0x6c')},{'name':_0xca39('0x6d'),'value':_0x35c47c[_0xca39('0x6d')]||(_0x35c47c[_0xca39('0x5f')]&&_0x35c47c['attrs'][0x1]?_0x35c47c['attrs'][0x1][_0xca39('0x60')]:undefined)||[]},{'name':_0xca39('0x69'),'value':_0x35c47c[_0xca39('0x69')]||(_0x35c47c[_0xca39('0x5f')]&&_0x35c47c['attrs'][0x2]?_0x35c47c[_0xca39('0x5f')][0x2][_0xca39('0x60')]:undefined)||0x14}];case _0xca39('0x6e'):case'pie-chart':return[{'name':_0xca39('0x6f'),'value':_0x35c47c['attrSerie1']||(_0x35c47c[_0xca39('0x5f')]&&_0x35c47c[_0xca39('0x5f')][0x0]?_0x35c47c[_0xca39('0x5f')][0x0][_0xca39('0x60')]:undefined)||_0xca39('0x6c')},{'name':'attrSerie2','value':_0x35c47c[_0xca39('0x70')]||(_0x35c47c[_0xca39('0x5f')]&&_0x35c47c[_0xca39('0x5f')][0x1]?_0x35c47c[_0xca39('0x5f')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x35c47c['attrSerie3']||(_0x35c47c[_0xca39('0x5f')]&&_0x35c47c[_0xca39('0x5f')][0x2]?_0x35c47c[_0xca39('0x5f')][0x2][_0xca39('0x60')]:undefined)||null},{'name':_0xca39('0x6d'),'value':_0x35c47c[_0xca39('0x6d')]||(_0x35c47c[_0xca39('0x5f')]&&_0x35c47c[_0xca39('0x5f')][0x3]?_0x35c47c['attrs'][0x3][_0xca39('0x60')]:undefined)||[]}];case _0xca39('0x71'):return[{'name':_0xca39('0x72'),'type':_0x35c47c[_0xca39('0x73')]||(_0x35c47c[_0xca39('0x5f')]&&_0x35c47c[_0xca39('0x5f')][0x0]?_0x35c47c[_0xca39('0x5f')][0x0][_0xca39('0x40')]:undefined)||null,'value':_0x35c47c[_0xca39('0x72')]||(_0x35c47c[_0xca39('0x5f')]&&_0x35c47c[_0xca39('0x5f')][0x0]?_0x35c47c[_0xca39('0x5f')][0x0]['value']:undefined)||null},{'name':_0xca39('0x74'),'value':_0x35c47c['attrRefresh']||(_0x35c47c['attrs']&&_0x35c47c['attrs'][0x1]?_0x35c47c[_0xca39('0x5f')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x10d1b8){logger[_0xca39('0x2e')](_0xca39('0x75'),JSON[_0xca39('0x76')](_0x10d1b8));return[];}}exports[_0xca39('0x77')]=function(_0x3964c6,_0x51dbe2,_0x325067){if(_0x3964c6[_0xca39('0x5a')]['id']){delete _0x3964c6['body']['id'];}return db[_0xca39('0x44')][_0xca39('0x53')]({'where':{'id':_0x3964c6['params']['id']}})[_0xca39('0x2b')](handleEntityNotFound(_0x51dbe2,null))[_0xca39('0x2b')](function(_0x48cadf){if(_0x48cadf){_0x3964c6[_0xca39('0x5a')][_0xca39('0x78')]=_0x48cadf['id'];_0x3964c6[_0xca39('0x5a')][_0xca39('0x5f')]=widgetAttributes(_0x3964c6[_0xca39('0x5a')]);return db['DashboardItem'][_0xca39('0x4f')](_0x3964c6[_0xca39('0x5a')]);}})[_0xca39('0x2b')](respondWithResult(_0x51dbe2,null))['catch'](handleError(_0x51dbe2,null));};exports[_0xca39('0x79')]=function(_0x29a7b8,_0x4db5aa,_0x239af3){var _0x7a7bba={};var _0x859587={};var _0x56ac12;var _0x53a3e0;return db[_0xca39('0x44')]['findOne']({'where':{'id':_0x29a7b8['params']['id']}})[_0xca39('0x2b')](handleEntityNotFound(_0x4db5aa,null))['then'](function(_0x449ee8){if(_0x449ee8){_0x56ac12=_0x449ee8;_0x859587['model']=_[_0xca39('0x37')](db[_0xca39('0x7a')][_0xca39('0x32')]);_0x859587[_0xca39('0x36')]=_['keys'](_0x29a7b8[_0xca39('0x36')]);_0x859587[_0xca39('0x38')]=_[_0xca39('0x39')](_0x859587[_0xca39('0x35')],_0x859587[_0xca39('0x36')]);_0x7a7bba[_0xca39('0x3a')]=_[_0xca39('0x39')](_0x859587[_0xca39('0x35')],qs['fields'](_0x29a7b8[_0xca39('0x36')][_0xca39('0x4c')]));_0x7a7bba[_0xca39('0x3a')]=_0x7a7bba['attributes'][_0xca39('0x4d')]?_0x7a7bba[_0xca39('0x3a')]:_0x859587['model'];_0x7a7bba[_0xca39('0x3b')]=qs[_0xca39('0x3c')](_0x29a7b8[_0xca39('0x36')][_0xca39('0x3c')]);_0x7a7bba[_0xca39('0x3d')]=qs['filters'](_[_0xca39('0x3e')](_0x29a7b8[_0xca39('0x36')],_0x859587[_0xca39('0x38')]));if(_0x29a7b8[_0xca39('0x36')][_0xca39('0x3f')]){_0x7a7bba[_0xca39('0x3d')]=_[_0xca39('0x42')](_0x7a7bba[_0xca39('0x3d')],{'$or':_[_0xca39('0x31')](_0x7a7bba[_0xca39('0x3a')],function(_0x260ab8){var _0x1b469a={};_0x1b469a[_0x260ab8]={'$like':'%'+_0x29a7b8['query'][_0xca39('0x3f')]+'%'};return _0x1b469a;})});}_0x7a7bba=_[_0xca39('0x42')]({},_0x7a7bba,_0x29a7b8[_0xca39('0x43')]);return _0x56ac12[_0xca39('0x79')](_0x7a7bba);}})[_0xca39('0x2b')](function(_0x28e2bb){if(_0x28e2bb){_0x53a3e0=_0x28e2bb['length'];if(!_0x29a7b8[_0xca39('0x36')][_0xca39('0x7b')](_0xca39('0x7c'))){_0x7a7bba[_0xca39('0x23')]=qs[_0xca39('0x23')](_0x29a7b8[_0xca39('0x36')][_0xca39('0x23')]);_0x7a7bba[_0xca39('0x22')]=qs['offset'](_0x29a7b8['query'][_0xca39('0x22')]);}return _0x56ac12[_0xca39('0x79')](_0x7a7bba);}})['then'](function(_0x28357c){if(_0x28357c){return _0x28357c?{'count':_0x53a3e0,'rows':_0x28357c}:null;}})[_0xca39('0x2b')](respondWithResult(_0x4db5aa,null))[_0xca39('0x4e')](handleError(_0x4db5aa,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index b35c80b..434b67a 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 _0x1ae5=['events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x436184,_0x295ad3){var _0x1b115b=function(_0x5290ed){while(--_0x5290ed){_0x436184['push'](_0x436184['shift']());}};_0x1b115b(++_0x295ad3);}(_0x1ae5,0x129));var _0x51ae=function(_0x12f958,_0x3cda84){_0x12f958=_0x12f958-0x0;var _0x29967c=_0x1ae5[_0x12f958];return _0x29967c;};'use strict';var EventEmitter=require(_0x51ae('0x0'));var Dashboard=require(_0x51ae('0x1'))['db'][_0x51ae('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x51ae('0x3')](0x0);var events={'afterCreate':_0x51ae('0x4'),'afterUpdate':_0x51ae('0x5'),'afterDestroy':_0x51ae('0x6')};function emitEvent(_0x478e6a){return function(_0x4e3c89,_0x364d35,_0x8bbaf3){DashboardEvents[_0x51ae('0x7')](_0x478e6a+':'+_0x4e3c89['id'],_0x4e3c89);DashboardEvents[_0x51ae('0x7')](_0x478e6a,_0x4e3c89);_0x8bbaf3(null);};}for(var e in events){if(events[_0x51ae('0x8')](e)){var event=events[e];Dashboard[_0x51ae('0x9')](e,emitEvent(event));}}module[_0x51ae('0xa')]=DashboardEvents; \ No newline at end of file +var _0x6459=['hook','exports','events','../../mysqldb','Dashboard','save','update','emit','hasOwnProperty'];(function(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0x6459,0x18e));var _0x9645=function(_0x2498ec,_0x3d5b07){_0x2498ec=_0x2498ec-0x0;var _0x1592f1=_0x6459[_0x2498ec];return _0x1592f1;};'use strict';var EventEmitter=require(_0x9645('0x0'));var Dashboard=require(_0x9645('0x1'))['db'][_0x9645('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9645('0x3'),'afterUpdate':_0x9645('0x4'),'afterDestroy':'remove'};function emitEvent(_0x423804){return function(_0x36e3ca,_0x4438c8,_0x3e11ae){DashboardEvents[_0x9645('0x5')](_0x423804+':'+_0x36e3ca['id'],_0x36e3ca);DashboardEvents[_0x9645('0x5')](_0x423804,_0x36e3ca);_0x3e11ae(null);};}for(var e in events){if(events[_0x9645('0x6')](e)){var event=events[e];Dashboard[_0x9645('0x7')](e,emitEvent(event));}}module[_0x9645('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 2d6471c..b0937b0 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 _0x1665=['dashboards','lodash','../../config/logger','api','moment','path','./dashboard.attributes','exports','define','Dashboard'];(function(_0x254c9e,_0xab8a1b){var _0x2d4cb6=function(_0x15b027){while(--_0x15b027){_0x254c9e['push'](_0x254c9e['shift']());}};_0x2d4cb6(++_0xab8a1b);}(_0x1665,0x155));var _0x5166=function(_0xe1b12b,_0x241bd1){_0xe1b12b=_0xe1b12b-0x0;var _0x1b697a=_0x1665[_0xe1b12b];return _0x1b697a;};'use strict';var _=require(_0x5166('0x0'));var util=require('util');var logger=require(_0x5166('0x1'))(_0x5166('0x2'));var moment=require(_0x5166('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5166('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5166('0x5'));module[_0x5166('0x6')]=function(_0x412a9e,_0x42d1c1){return _0x412a9e[_0x5166('0x7')](_0x5166('0x8'),attributes,{'tableName':_0x5166('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xffd2=['define','Dashboard','dashboards','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./dashboard.attributes','exports'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xffd2,0xac));var _0x2ffd=function(_0x2a4095,_0x13f4f0){_0x2a4095=_0x2a4095-0x0;var _0x52eeab=_0xffd2[_0x2a4095];return _0x52eeab;};'use strict';var _=require(_0x2ffd('0x0'));var util=require(_0x2ffd('0x1'));var logger=require(_0x2ffd('0x2'))('api');var moment=require(_0x2ffd('0x3'));var BPromise=require(_0x2ffd('0x4'));var rp=require(_0x2ffd('0x5'));var fs=require('fs');var path=require(_0x2ffd('0x6'));var rimraf=require('rimraf');var config=require(_0x2ffd('0x7'));var attributes=require(_0x2ffd('0x8'));module[_0x2ffd('0x9')]=function(_0xb34621,_0x2a775f){return _0xb34621[_0x2ffd('0xa')](_0x2ffd('0xb'),attributes,{'tableName':_0x2ffd('0xc'),'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 8084029..4bfc2bd 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 _0x6c98=['redis','localhost','socket.io-emitter','./dashboard.socket','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c98,0xdf));var _0x86c9=function(_0x1ae929,_0x5396c6){_0x1ae929=_0x1ae929-0x0;var _0x57343b=_0x6c98[_0x1ae929];return _0x57343b;};'use strict';var _=require(_0x86c9('0x0'));var util=require(_0x86c9('0x1'));var moment=require(_0x86c9('0x2'));var BPromise=require(_0x86c9('0x3'));var rs=require(_0x86c9('0x4'));var fs=require('fs');var Redis=require(_0x86c9('0x5'));var db=require(_0x86c9('0x6'))['db'];var utils=require(_0x86c9('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x86c9('0x8'));var jayson=require(_0x86c9('0x9'));var client=jayson[_0x86c9('0xa')]['http']({'port':0x232a});config[_0x86c9('0xb')]=_['defaults'](config[_0x86c9('0xb')],{'host':_0x86c9('0xc'),'port':0x18eb});var socket=require(_0x86c9('0xd'))(new Redis(config[_0x86c9('0xb')]));require(_0x86c9('0xe'))['register'](socket);function respondWithRpcPromise(_0x3203fd,_0x134efb,_0xed441b){return new BPromise(function(_0xf38ad3,_0x56c3f5){return client[_0x86c9('0xf')](_0x3203fd,_0xed441b)[_0x86c9('0x10')](function(_0x3bc9b9){logger['info'](_0x86c9('0x11'),_0x134efb,_0x86c9('0x12'));logger[_0x86c9('0x13')](_0x86c9('0x14'),_0x134efb,_0x86c9('0x12'),JSON[_0x86c9('0x15')](_0x3bc9b9));if(_0x3bc9b9['error']){if(_0x3bc9b9[_0x86c9('0x16')][_0x86c9('0x17')]===0x1f4){logger[_0x86c9('0x16')]('Dashboard,\x20%s,\x20%s',_0x134efb,_0x3bc9b9['error']['message']);return _0x56c3f5(_0x3bc9b9['error'][_0x86c9('0x18')]);}logger[_0x86c9('0x16')]('Dashboard,\x20%s,\x20%s',_0x134efb,_0x3bc9b9['error'][_0x86c9('0x18')]);return _0xf38ad3(_0x3bc9b9[_0x86c9('0x16')][_0x86c9('0x18')]);}else{logger['info'](_0x86c9('0x11'),_0x134efb,_0x86c9('0x12'));_0xf38ad3(_0x3bc9b9[_0x86c9('0x19')][_0x86c9('0x18')]);}})['catch'](function(_0x323da6){logger[_0x86c9('0x16')](_0x86c9('0x11'),_0x134efb,_0x323da6);_0x56c3f5(_0x323da6);});});} \ No newline at end of file +var _0x0b1a=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x2c2bc6,_0x3b917e){var _0x1cb105=function(_0x2ae854){while(--_0x2ae854){_0x2c2bc6['push'](_0x2c2bc6['shift']());}};_0x1cb105(++_0x3b917e);}(_0x0b1a,0xab));var _0xa0b1=function(_0x199841,_0x570443){_0x199841=_0x199841-0x0;var _0x1aeb31=_0x0b1a[_0x199841];return _0x1aeb31;};'use strict';var _=require(_0xa0b1('0x0'));var util=require(_0xa0b1('0x1'));var moment=require('moment');var BPromise=require(_0xa0b1('0x2'));var rs=require(_0xa0b1('0x3'));var fs=require('fs');var Redis=require(_0xa0b1('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa0b1('0x5'))(_0xa0b1('0x6'));var config=require(_0xa0b1('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa0b1('0x8')]({'port':0x232a});config[_0xa0b1('0x9')]=_[_0xa0b1('0xa')](config[_0xa0b1('0x9')],{'host':_0xa0b1('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa0b1('0x9')]));require('./dashboard.socket')[_0xa0b1('0xc')](socket);function respondWithRpcPromise(_0x2bb02b,_0x2360da,_0x598c68){return new BPromise(function(_0x44593a,_0x1eba63){return client[_0xa0b1('0xd')](_0x2bb02b,_0x598c68)[_0xa0b1('0xe')](function(_0x5032e2){logger[_0xa0b1('0xf')](_0xa0b1('0x10'),_0x2360da,_0xa0b1('0x11'));logger['debug'](_0xa0b1('0x12'),_0x2360da,_0xa0b1('0x11'),JSON['stringify'](_0x5032e2));if(_0x5032e2[_0xa0b1('0x13')]){if(_0x5032e2[_0xa0b1('0x13')][_0xa0b1('0x14')]===0x1f4){logger[_0xa0b1('0x13')](_0xa0b1('0x10'),_0x2360da,_0x5032e2[_0xa0b1('0x13')][_0xa0b1('0x15')]);return _0x1eba63(_0x5032e2[_0xa0b1('0x13')][_0xa0b1('0x15')]);}logger[_0xa0b1('0x13')](_0xa0b1('0x10'),_0x2360da,_0x5032e2['error'][_0xa0b1('0x15')]);return _0x44593a(_0x5032e2[_0xa0b1('0x13')][_0xa0b1('0x15')]);}else{logger['info'](_0xa0b1('0x10'),_0x2360da,_0xa0b1('0x11'));_0x44593a(_0x5032e2[_0xa0b1('0x16')][_0xa0b1('0x15')]);}})[_0xa0b1('0x17')](function(_0x304997){logger[_0xa0b1('0x13')](_0xa0b1('0x10'),_0x2360da,_0x304997);_0x1eba63(_0x304997);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index cf6b54a..0df6d13 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 _0xc4b4=['remove','update','register','length','dashboard:','./dashboard.events','save'];(function(_0x1742fa,_0x643f74){var _0x5c240e=function(_0x32320a){while(--_0x32320a){_0x1742fa['push'](_0x1742fa['shift']());}};_0x5c240e(++_0x643f74);}(_0xc4b4,0x1e1));var _0x4c4b=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xc4b4[_0x27af45];return _0x18df21;};'use strict';var DashboardEvents=require(_0x4c4b('0x0'));var events=[_0x4c4b('0x1'),_0x4c4b('0x2'),_0x4c4b('0x3')];function createListener(_0x33718b,_0x5b0f29){return function(_0x578e7a){_0x5b0f29['emit'](_0x33718b,_0x578e7a);};}function removeListener(_0x499d95,_0x573310){return function(){DashboardEvents['removeListener'](_0x499d95,_0x573310);};}exports[_0x4c4b('0x4')]=function(_0x4ca153){for(var _0x87e13=0x0,_0x3b44b2=events[_0x4c4b('0x5')];_0x87e13<_0x3b44b2;_0x87e13++){var _0x455761=events[_0x87e13];var _0x108285=createListener(_0x4c4b('0x6')+_0x455761,_0x4ca153);DashboardEvents['on'](_0x455761,_0x108285);}}; \ No newline at end of file +var _0x976d=['emit','removeListener','register','length','dashboard:','save','remove','update'];(function(_0x5119cd,_0x1761d2){var _0x40b8e6=function(_0x300e47){while(--_0x300e47){_0x5119cd['push'](_0x5119cd['shift']());}};_0x40b8e6(++_0x1761d2);}(_0x976d,0xed));var _0xd976=function(_0x49aa7d,_0x5d46d8){_0x49aa7d=_0x49aa7d-0x0;var _0xdd0d26=_0x976d[_0x49aa7d];return _0xdd0d26;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xd976('0x0'),_0xd976('0x1'),_0xd976('0x2')];function createListener(_0x561a9b,_0x16455b){return function(_0x47667d){_0x16455b[_0xd976('0x3')](_0x561a9b,_0x47667d);};}function removeListener(_0x5aaafd,_0x32a821){return function(){DashboardEvents[_0xd976('0x4')](_0x5aaafd,_0x32a821);};}exports[_0xd976('0x5')]=function(_0x2b2cf0){for(var _0x4227e8=0x0,_0x3e7211=events[_0xd976('0x6')];_0x4227e8<_0x3e7211;_0x4227e8++){var _0x16f1c8=events[_0x4227e8];var _0xb5223b=createListener(_0xd976('0x7')+_0x16f1c8,_0x2b2cf0);DashboardEvents['on'](_0x16f1c8,_0xb5223b);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index be2af72..74a5294 100644 --- a/server/api/dashboard/index.js +++ b/server/api/dashboard/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['/:id','/:id/items','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated'];(function(_0x26ca72,_0x119131){var _0xb39f6d=function(_0x27766d){while(--_0x27766d){_0x26ca72['push'](_0x26ca72['shift']());}};_0xb39f6d(++_0x119131);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getItems']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xb')](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['clone']);router['post']('/:id/items',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=router; \ No newline at end of file +var _0xd8b0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','index','get','/:id','show','isAuthenticated','getItems','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','Router'];(function(_0x51b661,_0x566ef8){var _0x5d1971=function(_0x5cc6b8){while(--_0x5cc6b8){_0x51b661['push'](_0x51b661['shift']());}};_0x5d1971(++_0x566ef8);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xd')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller['clone']);router[_0x0d8b('0xd')]('/:id/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0x11')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x13')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x14')]);module[_0x0d8b('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 0dfbe2c..7ba28f5 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 _0x53a9=['sequelize','squel','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3'];(function(_0x3bfa22,_0x17ef2c){var _0x19fb0b=function(_0x4889dc){while(--_0x4889dc){_0x3bfa22['push'](_0x3bfa22['shift']());}};_0x19fb0b(++_0x17ef2c);}(_0x53a9,0x188));var _0x953a=function(_0x1f3044,_0x2a3426){_0x1f3044=_0x1f3044-0x0;var _0x2aa7d7=_0x53a9[_0x1f3044];return _0x2aa7d7;};'use strict';var Sequelize=require(_0x953a('0x0'));var squel=require(_0x953a('0x1'));var _=require('lodash');module[_0x953a('0x2')]={'title':{'type':Sequelize[_0x953a('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x953a('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x953a('0x4')](_0x953a('0x5')),'get':function(){try{return JSON[_0x953a('0x6')](this[_0x953a('0x7')]('attrs'));}catch(_0x4e22a2){return[];}},'set':function(_0x3ce61f){try{this['setDataValue'](_0x953a('0x8'),JSON['stringify'](_0x3ce61f));}catch(_0x2d5f68){this[_0x953a('0x9')](_0x953a('0x8'),JSON[_0x953a('0xa')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x953a('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x953a('0xb')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x953a('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x953a('0x3')],'allowNull':![],'defaultValue':_0x953a('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x953a('0x3')]},'titleFontSize':{'type':Sequelize[_0x953a('0xb')],'defaultValue':0xc}}; \ No newline at end of file +var _0x9478=['STRING','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','#2196f3','sequelize','lodash','exports'];(function(_0x87b85b,_0x54afde){var _0x29a80c=function(_0x14ffb9){while(--_0x14ffb9){_0x87b85b['push'](_0x87b85b['shift']());}};_0x29a80c(++_0x54afde);}(_0x9478,0xb1));var _0x8947=function(_0x5a41ab,_0x3d801a){_0x5a41ab=_0x5a41ab-0x0;var _0x36e54e=_0x9478[_0x5a41ab];return _0x36e54e;};'use strict';var Sequelize=require(_0x8947('0x0'));var squel=require('squel');var _=require(_0x8947('0x1'));module[_0x8947('0x2')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x8947('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON[_0x8947('0x4')](this[_0x8947('0x5')](_0x8947('0x6')));}catch(_0x57ab2c){return[];}},'set':function(_0x3d5ec0){try{this['setDataValue']('attrs',JSON[_0x8947('0x7')](_0x3d5ec0));}catch(_0x56b219){this[_0x8947('0x8')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x8947('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x8947('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x8947('0x9')]},'col':{'type':Sequelize[_0x8947('0x9')]},'background':{'type':Sequelize[_0x8947('0x3')],'allowNull':![],'defaultValue':_0x8947('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x8947('0x3')],'allowNull':![],'defaultValue':_0x8947('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x8947('0x3')]},'titleFontSize':{'type':Sequelize[_0x8947('0x9')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index d241b0f..5b789ec 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 _0x8b6d=['intersection','fields','length','includeAll','include','merge','options','find','params','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','sendStatus','status','json','count','offset','limit','Content-Range','save','update','then','destroy','end','error','stack','show','keys','DashboardItem','rawAttributes','query','filters','model','attributes'];(function(_0x2ceec2,_0x284b13){var _0x11d812=function(_0x58f3ec){while(--_0x58f3ec){_0x2ceec2['push'](_0x2ceec2['shift']());}};_0x11d812(++_0x284b13);}(_0x8b6d,0x17d));var _0xd8b6=function(_0x3eb350,_0x40205e){_0x3eb350=_0x3eb350-0x0;var _0x175e2d=_0x8b6d[_0x3eb350];return _0x175e2d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd8b6('0x0'));var zipdir=require(_0xd8b6('0x1'));var jsonpatch=require(_0xd8b6('0x2'));var rp=require('request-promise');var moment=require(_0xd8b6('0x3'));var BPromise=require(_0xd8b6('0x4'));var Mustache=require(_0xd8b6('0x5'));var util=require('util');var path=require(_0xd8b6('0x6'));var sox=require('sox');var csv=require(_0xd8b6('0x7'));var ejs=require(_0xd8b6('0x8'));var fs=require('fs');var _=require(_0xd8b6('0x9'));var squel=require(_0xd8b6('0xa'));var crypto=require(_0xd8b6('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd8b6('0xc'));var Papa=require(_0xd8b6('0xd'));var Redis=require(_0xd8b6('0xe'));var authService=require(_0xd8b6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd8b6('0x10'));var hardwareService=require(_0xd8b6('0x11'));var logger=require(_0xd8b6('0x12'))(_0xd8b6('0x13'));var utils=require(_0xd8b6('0x14'));var config=require(_0xd8b6('0x15'));var licenseUtil=require(_0xd8b6('0x16'));var db=require(_0xd8b6('0x17'))['db'];config[_0xd8b6('0x18')]=_['defaults'](config['redis'],{'host':_0xd8b6('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd8b6('0x18')]));require('./dashboardItem.socket')[_0xd8b6('0x1a')](socket);function respondWithStatusCode(_0x114fdf,_0x4cf19c){_0x4cf19c=_0x4cf19c||0xcc;return function(_0x2cd02c){if(_0x2cd02c){return _0x114fdf[_0xd8b6('0x1b')](_0x4cf19c);}return _0x114fdf[_0xd8b6('0x1c')](_0x4cf19c)['end']();};}function respondWithResult(_0x31ccaf,_0x101ee2){_0x101ee2=_0x101ee2||0xc8;return function(_0x46cb0b){if(_0x46cb0b){return _0x31ccaf[_0xd8b6('0x1c')](_0x101ee2)[_0xd8b6('0x1d')](_0x46cb0b);}};}function respondWithFilteredResult(_0x44f55d,_0x4d6612){return function(_0x64b812){if(_0x64b812){var _0x30e556=_0x64b812[_0xd8b6('0x1e')],_0x2e0fa7=_0x4d6612[_0xd8b6('0x1f')],_0xeffc4b=_0x4d6612[_0xd8b6('0x1f')]+_0x4d6612[_0xd8b6('0x20')],_0x451807;if(_0xeffc4b>=_0x30e556){_0xeffc4b=_0x30e556;_0x451807=0xc8;}else{_0x451807=0xce;}_0x44f55d[_0xd8b6('0x1c')](_0x451807);return _0x44f55d['set'](_0xd8b6('0x21'),_0x2e0fa7+'-'+_0xeffc4b+'/'+_0x30e556)[_0xd8b6('0x1d')](_0x64b812);}return null;};}function patchUpdates(_0x106b06){return function(_0x3db9f4){try{jsonpatch['apply'](_0x3db9f4,_0x106b06,!![]);}catch(_0x2e790b){return BPromise['reject'](_0x2e790b);}return _0x3db9f4[_0xd8b6('0x22')]();};}function saveUpdates(_0x4c1578,_0x5ed2ac){return function(_0x1006da){if(_0x1006da){return _0x1006da[_0xd8b6('0x23')](_0x4c1578)[_0xd8b6('0x24')](function(_0x1e0ba5){return _0x1e0ba5;});}return null;};}function removeEntity(_0x2aeead,_0x11f76c){return function(_0x4136d6){if(_0x4136d6){return _0x4136d6[_0xd8b6('0x25')]()[_0xd8b6('0x24')](function(){_0x2aeead['status'](0xcc)[_0xd8b6('0x26')]();});}};}function handleEntityNotFound(_0x426fdf,_0x494675){return function(_0x5c1e45){if(!_0x5c1e45){_0x426fdf[_0xd8b6('0x1b')](0x194);}return _0x5c1e45;};}function handleError(_0xc0bfad,_0x80c72){_0x80c72=_0x80c72||0x1f4;return function(_0x33827d){logger[_0xd8b6('0x27')](_0x33827d[_0xd8b6('0x28')]);if(_0x33827d['name']){delete _0x33827d['name'];}_0xc0bfad['status'](_0x80c72)['send'](_0x33827d);};}exports[_0xd8b6('0x29')]=function(_0x5a50d9,_0x4ba926){var _0x45fa08={'raw':![],'where':{'id':_0x5a50d9['params']['id']}},_0x5d338a={};_0x5d338a['model']=_[_0xd8b6('0x2a')](db[_0xd8b6('0x2b')][_0xd8b6('0x2c')]);_0x5d338a[_0xd8b6('0x2d')]=_[_0xd8b6('0x2a')](_0x5a50d9[_0xd8b6('0x2d')]);_0x5d338a[_0xd8b6('0x2e')]=_['intersection'](_0x5d338a[_0xd8b6('0x2f')],_0x5d338a[_0xd8b6('0x2d')]);_0x45fa08[_0xd8b6('0x30')]=_[_0xd8b6('0x31')](_0x5d338a['model'],qs[_0xd8b6('0x32')](_0x5a50d9[_0xd8b6('0x2d')][_0xd8b6('0x32')]));_0x45fa08[_0xd8b6('0x30')]=_0x45fa08[_0xd8b6('0x30')][_0xd8b6('0x33')]?_0x45fa08[_0xd8b6('0x30')]:_0x5d338a[_0xd8b6('0x2f')];if(_0x5a50d9[_0xd8b6('0x2d')][_0xd8b6('0x34')]){_0x45fa08[_0xd8b6('0x35')]=[{'all':!![]}];}_0x45fa08=_[_0xd8b6('0x36')]({},_0x45fa08,_0x5a50d9[_0xd8b6('0x37')]);return db['DashboardItem'][_0xd8b6('0x38')](_0x45fa08)[_0xd8b6('0x24')](handleEntityNotFound(_0x4ba926,null))[_0xd8b6('0x24')](respondWithResult(_0x4ba926,null))['catch'](handleError(_0x4ba926,null));};exports[_0xd8b6('0x25')]=function(_0x5d0951,_0x2119d8){return db[_0xd8b6('0x2b')][_0xd8b6('0x38')]({'where':{'id':_0x5d0951[_0xd8b6('0x39')]['id']}})[_0xd8b6('0x24')](handleEntityNotFound(_0x2119d8,null))[_0xd8b6('0x24')](removeEntity(_0x2119d8,null))[_0xd8b6('0x3a')](handleError(_0x2119d8,null));};function widgetAttributes(_0x51777b){try{switch(_0x51777b[_0xd8b6('0x3b')]){case _0xd8b6('0x3c'):return[{'name':_0xd8b6('0x3d'),'value':_0x51777b['attrUrl']||(_0x51777b['attrs']&&_0x51777b[_0xd8b6('0x3e')][0x0]?_0x51777b[_0xd8b6('0x3e')][0x0][_0xd8b6('0x3f')]:undefined)||_0xd8b6('0x40')}];case _0xd8b6('0x41'):return[{'name':_0xd8b6('0x42'),'value':_0x51777b[_0xd8b6('0x42')]||(_0x51777b[_0xd8b6('0x3e')]&&_0x51777b['attrs'][0x0]?_0x51777b['attrs'][0x0][_0xd8b6('0x3f')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x51777b[_0xd8b6('0x43')]||(_0x51777b[_0xd8b6('0x3e')]&&_0x51777b['attrs'][0x0]?_0x51777b[_0xd8b6('0x3e')][0x0][_0xd8b6('0x3f')]:undefined)||_0xd8b6('0x44')},{'name':_0xd8b6('0x45'),'value':_0x51777b[_0xd8b6('0x45')]||(_0x51777b[_0xd8b6('0x3e')]&&_0x51777b[_0xd8b6('0x3e')][0x1]?_0x51777b[_0xd8b6('0x3e')][0x1][_0xd8b6('0x3f')]:undefined)||_0xd8b6('0x46')},{'name':_0xd8b6('0x47'),'value':_0x51777b[_0xd8b6('0x47')]||(_0x51777b[_0xd8b6('0x3e')]&&_0x51777b[_0xd8b6('0x3e')][0x2]?_0x51777b[_0xd8b6('0x3e')][0x2]['value']:undefined)||0xc}];case _0xd8b6('0x48'):return[{'name':_0xd8b6('0x49'),'value':_0x51777b[_0xd8b6('0x49')]||(_0x51777b[_0xd8b6('0x3e')]&&_0x51777b[_0xd8b6('0x3e')][0x0]?_0x51777b[_0xd8b6('0x3e')][0x0][_0xd8b6('0x3f')]:undefined)||_0xd8b6('0x4a')},{'name':'attrVoiceQueues','value':_0x51777b['attrVoiceQueues']||(_0x51777b[_0xd8b6('0x3e')]&&_0x51777b[_0xd8b6('0x3e')][0x1]?_0x51777b['attrs'][0x1][_0xd8b6('0x3f')]:undefined)||[]},{'name':_0xd8b6('0x47'),'value':_0x51777b[_0xd8b6('0x47')]||(_0x51777b[_0xd8b6('0x3e')]&&_0x51777b[_0xd8b6('0x3e')][0x2]?_0x51777b['attrs'][0x2][_0xd8b6('0x3f')]:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':_0xd8b6('0x4b'),'value':_0x51777b['attrSerie1']||(_0x51777b['attrs']&&_0x51777b['attrs'][0x0]?_0x51777b[_0xd8b6('0x3e')][0x0][_0xd8b6('0x3f')]:undefined)||_0xd8b6('0x4a')},{'name':_0xd8b6('0x4c'),'value':_0x51777b[_0xd8b6('0x4c')]||(_0x51777b[_0xd8b6('0x3e')]&&_0x51777b[_0xd8b6('0x3e')][0x1]?_0x51777b[_0xd8b6('0x3e')][0x1][_0xd8b6('0x3f')]:undefined)||null},{'name':_0xd8b6('0x4d'),'value':_0x51777b[_0xd8b6('0x4d')]||(_0x51777b[_0xd8b6('0x3e')]&&_0x51777b[_0xd8b6('0x3e')][0x2]?_0x51777b['attrs'][0x2][_0xd8b6('0x3f')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x51777b['attrVoiceQueues']||(_0x51777b[_0xd8b6('0x3e')]&&_0x51777b[_0xd8b6('0x3e')][0x3]?_0x51777b[_0xd8b6('0x3e')][0x3]['value']:undefined)||[]}];case _0xd8b6('0x4e'):return[{'name':'attrReport','type':_0x51777b[_0xd8b6('0x4f')]||(_0x51777b[_0xd8b6('0x3e')]&&_0x51777b['attrs'][0x0]?_0x51777b['attrs'][0x0][_0xd8b6('0x3b')]:undefined)||null,'value':_0x51777b[_0xd8b6('0x50')]||(_0x51777b[_0xd8b6('0x3e')]&&_0x51777b[_0xd8b6('0x3e')][0x0]?_0x51777b[_0xd8b6('0x3e')][0x0][_0xd8b6('0x3f')]:undefined)||null},{'name':'attrRefresh','value':_0x51777b[_0xd8b6('0x51')]||(_0x51777b['attrs']&&_0x51777b[_0xd8b6('0x3e')][0x1]?_0x51777b[_0xd8b6('0x3e')][0x1][_0xd8b6('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x18a2ac){logger['error'](_0xd8b6('0x52'),JSON[_0xd8b6('0x53')](_0x18a2ac));return[];}}exports[_0xd8b6('0x54')]=function(_0x4724b5,_0x282cea){if(_0x4724b5[_0xd8b6('0x55')]){_0x4724b5[_0xd8b6('0x55')][_0xd8b6('0x3e')]=widgetAttributes(_0x4724b5[_0xd8b6('0x55')]);}return db[_0xd8b6('0x2b')][_0xd8b6('0x54')](_0x4724b5[_0xd8b6('0x55')],{})[_0xd8b6('0x24')](respondWithResult(_0x282cea,0xc9))['catch'](handleError(_0x282cea,null));};exports[_0xd8b6('0x23')]=function(_0x56499c,_0x5e3f57){if(_0x56499c[_0xd8b6('0x55')]['id']){delete _0x56499c['body']['id'];}_0x56499c[_0xd8b6('0x55')]['attrs']=widgetAttributes(_0x56499c[_0xd8b6('0x55')]);return db[_0xd8b6('0x2b')][_0xd8b6('0x38')]({'where':{'id':_0x56499c[_0xd8b6('0x39')]['id']}})['then'](handleEntityNotFound(_0x5e3f57,null))[_0xd8b6('0x24')](saveUpdates(_0x56499c[_0xd8b6('0x55')],null))[_0xd8b6('0x24')](respondWithResult(_0x5e3f57,null))[_0xd8b6('0x3a')](handleError(_0x5e3f57,null));}; \ No newline at end of file +var _0xa0bc=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','count','offset','limit','apply','reject','then','destroy','error','stack','name','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','type','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','counter','attrMetric','attrVoiceQueues','attrFontSize','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update'];(function(_0x35640f,_0x3351bb){var _0x508de1=function(_0x4efcbf){while(--_0x4efcbf){_0x35640f['push'](_0x35640f['shift']());}};_0x508de1(++_0x3351bb);}(_0xa0bc,0x10b));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xca0b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xca0b('0x1'));var jsonpatch=require(_0xca0b('0x2'));var rp=require(_0xca0b('0x3'));var moment=require(_0xca0b('0x4'));var BPromise=require(_0xca0b('0x5'));var Mustache=require(_0xca0b('0x6'));var util=require(_0xca0b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xca0b('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xca0b('0x9'));var squel=require(_0xca0b('0xa'));var crypto=require(_0xca0b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xca0b('0xc'));var toCsv=require('to-csv');var querystring=require(_0xca0b('0xd'));var Papa=require('papaparse');var Redis=require(_0xca0b('0xe'));var authService=require(_0xca0b('0xf'));var qs=require(_0xca0b('0x10'));var as=require(_0xca0b('0x11'));var hardwareService=require(_0xca0b('0x12'));var logger=require(_0xca0b('0x13'))(_0xca0b('0x14'));var utils=require(_0xca0b('0x15'));var config=require(_0xca0b('0x16'));var licenseUtil=require(_0xca0b('0x17'));var db=require(_0xca0b('0x18'))['db'];config[_0xca0b('0x19')]=_['defaults'](config[_0xca0b('0x19')],{'host':_0xca0b('0x1a'),'port':0x18eb});var socket=require(_0xca0b('0x1b'))(new Redis(config[_0xca0b('0x19')]));require(_0xca0b('0x1c'))[_0xca0b('0x1d')](socket);function respondWithStatusCode(_0x36cc09,_0x482d08){_0x482d08=_0x482d08||0xcc;return function(_0xf788fd){if(_0xf788fd){return _0x36cc09[_0xca0b('0x1e')](_0x482d08);}return _0x36cc09[_0xca0b('0x1f')](_0x482d08)[_0xca0b('0x20')]();};}function respondWithResult(_0x593b3c,_0x296f67){_0x296f67=_0x296f67||0xc8;return function(_0x229727){if(_0x229727){return _0x593b3c[_0xca0b('0x1f')](_0x296f67)[_0xca0b('0x21')](_0x229727);}};}function respondWithFilteredResult(_0x5823fb,_0x1692cd){return function(_0x37a5f8){if(_0x37a5f8){var _0x670876=_0x37a5f8[_0xca0b('0x22')],_0x439c4a=_0x1692cd[_0xca0b('0x23')],_0x1c0d2b=_0x1692cd[_0xca0b('0x23')]+_0x1692cd[_0xca0b('0x24')],_0x2684bf;if(_0x1c0d2b>=_0x670876){_0x1c0d2b=_0x670876;_0x2684bf=0xc8;}else{_0x2684bf=0xce;}_0x5823fb['status'](_0x2684bf);return _0x5823fb['set']('Content-Range',_0x439c4a+'-'+_0x1c0d2b+'/'+_0x670876)['json'](_0x37a5f8);}return null;};}function patchUpdates(_0x3c9524){return function(_0x4fb3b2){try{jsonpatch[_0xca0b('0x25')](_0x4fb3b2,_0x3c9524,!![]);}catch(_0x144223){return BPromise[_0xca0b('0x26')](_0x144223);}return _0x4fb3b2['save']();};}function saveUpdates(_0x4eefd9,_0x4491ea){return function(_0x728cab){if(_0x728cab){return _0x728cab['update'](_0x4eefd9)[_0xca0b('0x27')](function(_0x16ef74){return _0x16ef74;});}return null;};}function removeEntity(_0x431bef,_0xc06f37){return function(_0x7086d5){if(_0x7086d5){return _0x7086d5[_0xca0b('0x28')]()[_0xca0b('0x27')](function(){_0x431bef[_0xca0b('0x1f')](0xcc)[_0xca0b('0x20')]();});}};}function handleEntityNotFound(_0x4f09fa,_0x69f455){return function(_0x157e6c){if(!_0x157e6c){_0x4f09fa['sendStatus'](0x194);}return _0x157e6c;};}function handleError(_0x403920,_0x237d66){_0x237d66=_0x237d66||0x1f4;return function(_0x580975){logger[_0xca0b('0x29')](_0x580975[_0xca0b('0x2a')]);if(_0x580975[_0xca0b('0x2b')]){delete _0x580975[_0xca0b('0x2b')];}_0x403920[_0xca0b('0x1f')](_0x237d66)['send'](_0x580975);};}exports[_0xca0b('0x2c')]=function(_0x22d97c,_0x20b5fb){var _0x4a51bc={'raw':![],'where':{'id':_0x22d97c[_0xca0b('0x2d')]['id']}},_0x26c08a={};_0x26c08a[_0xca0b('0x2e')]=_[_0xca0b('0x2f')](db[_0xca0b('0x30')][_0xca0b('0x31')]);_0x26c08a[_0xca0b('0x32')]=_[_0xca0b('0x2f')](_0x22d97c[_0xca0b('0x32')]);_0x26c08a[_0xca0b('0x33')]=_[_0xca0b('0x34')](_0x26c08a['model'],_0x26c08a[_0xca0b('0x32')]);_0x4a51bc[_0xca0b('0x35')]=_[_0xca0b('0x34')](_0x26c08a[_0xca0b('0x2e')],qs[_0xca0b('0x36')](_0x22d97c[_0xca0b('0x32')]['fields']));_0x4a51bc[_0xca0b('0x35')]=_0x4a51bc[_0xca0b('0x35')][_0xca0b('0x37')]?_0x4a51bc[_0xca0b('0x35')]:_0x26c08a[_0xca0b('0x2e')];if(_0x22d97c[_0xca0b('0x32')][_0xca0b('0x38')]){_0x4a51bc['include']=[{'all':!![]}];}_0x4a51bc=_[_0xca0b('0x39')]({},_0x4a51bc,_0x22d97c[_0xca0b('0x3a')]);return db[_0xca0b('0x30')][_0xca0b('0x3b')](_0x4a51bc)[_0xca0b('0x27')](handleEntityNotFound(_0x20b5fb,null))['then'](respondWithResult(_0x20b5fb,null))[_0xca0b('0x3c')](handleError(_0x20b5fb,null));};exports[_0xca0b('0x28')]=function(_0x59e340,_0x6d6413){return db[_0xca0b('0x30')][_0xca0b('0x3b')]({'where':{'id':_0x59e340[_0xca0b('0x2d')]['id']}})['then'](handleEntityNotFound(_0x6d6413,null))[_0xca0b('0x27')](removeEntity(_0x6d6413,null))['catch'](handleError(_0x6d6413,null));};function widgetAttributes(_0x35ede3){try{switch(_0x35ede3[_0xca0b('0x3d')]){case _0xca0b('0x3e'):return[{'name':_0xca0b('0x3f'),'value':_0x35ede3[_0xca0b('0x3f')]||(_0x35ede3[_0xca0b('0x40')]&&_0x35ede3[_0xca0b('0x40')][0x0]?_0x35ede3['attrs'][0x0][_0xca0b('0x41')]:undefined)||_0xca0b('0x42')}];case'custom':return[{'name':'attrPath','value':_0x35ede3[_0xca0b('0x43')]||(_0x35ede3[_0xca0b('0x40')]&&_0x35ede3[_0xca0b('0x40')][0x0]?_0x35ede3[_0xca0b('0x40')][0x0][_0xca0b('0x41')]:undefined)||''}];case _0xca0b('0x44'):return[{'name':'attrHourFormat','value':_0x35ede3[_0xca0b('0x45')]||(_0x35ede3[_0xca0b('0x40')]&&_0x35ede3[_0xca0b('0x40')][0x0]?_0x35ede3[_0xca0b('0x40')][0x0][_0xca0b('0x41')]:undefined)||'HH:mm:ss'},{'name':_0xca0b('0x46'),'value':_0x35ede3[_0xca0b('0x46')]||(_0x35ede3['attrs']&&_0x35ede3[_0xca0b('0x40')][0x1]?_0x35ede3['attrs'][0x1]['value']:undefined)||_0xca0b('0x47')},{'name':'attrFontSize','value':_0x35ede3['attrFontSize']||(_0x35ede3[_0xca0b('0x40')]&&_0x35ede3[_0xca0b('0x40')][0x2]?_0x35ede3[_0xca0b('0x40')][0x2][_0xca0b('0x41')]:undefined)||0xc}];case _0xca0b('0x48'):return[{'name':_0xca0b('0x49'),'value':_0x35ede3['attrMetric']||(_0x35ede3[_0xca0b('0x40')]&&_0x35ede3[_0xca0b('0x40')][0x0]?_0x35ede3[_0xca0b('0x40')][0x0][_0xca0b('0x41')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x35ede3[_0xca0b('0x4a')]||(_0x35ede3[_0xca0b('0x40')]&&_0x35ede3[_0xca0b('0x40')][0x1]?_0x35ede3[_0xca0b('0x40')][0x1]['value']:undefined)||[]},{'name':_0xca0b('0x4b'),'value':_0x35ede3[_0xca0b('0x4b')]||(_0x35ede3['attrs']&&_0x35ede3[_0xca0b('0x40')][0x2]?_0x35ede3[_0xca0b('0x40')][0x2]['value']:undefined)||0x14}];case'multibar-chart':case _0xca0b('0x4c'):return[{'name':_0xca0b('0x4d'),'value':_0x35ede3[_0xca0b('0x4d')]||(_0x35ede3[_0xca0b('0x40')]&&_0x35ede3[_0xca0b('0x40')][0x0]?_0x35ede3[_0xca0b('0x40')][0x0][_0xca0b('0x41')]:undefined)||_0xca0b('0x4e')},{'name':_0xca0b('0x4f'),'value':_0x35ede3['attrSerie2']||(_0x35ede3[_0xca0b('0x40')]&&_0x35ede3[_0xca0b('0x40')][0x1]?_0x35ede3[_0xca0b('0x40')][0x1][_0xca0b('0x41')]:undefined)||null},{'name':_0xca0b('0x50'),'value':_0x35ede3[_0xca0b('0x50')]||(_0x35ede3[_0xca0b('0x40')]&&_0x35ede3[_0xca0b('0x40')][0x2]?_0x35ede3[_0xca0b('0x40')][0x2][_0xca0b('0x41')]:undefined)||null},{'name':_0xca0b('0x4a'),'value':_0x35ede3[_0xca0b('0x4a')]||(_0x35ede3[_0xca0b('0x40')]&&_0x35ede3[_0xca0b('0x40')][0x3]?_0x35ede3['attrs'][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0x35ede3[_0xca0b('0x51')]||(_0x35ede3[_0xca0b('0x40')]&&_0x35ede3[_0xca0b('0x40')][0x0]?_0x35ede3[_0xca0b('0x40')][0x0][_0xca0b('0x3d')]:undefined)||null,'value':_0x35ede3[_0xca0b('0x52')]||(_0x35ede3[_0xca0b('0x40')]&&_0x35ede3['attrs'][0x0]?_0x35ede3['attrs'][0x0]['value']:undefined)||null},{'name':_0xca0b('0x53'),'value':_0x35ede3['attrRefresh']||(_0x35ede3[_0xca0b('0x40')]&&_0x35ede3['attrs'][0x1]?_0x35ede3[_0xca0b('0x40')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x2e232a){logger[_0xca0b('0x29')](_0xca0b('0x54'),JSON[_0xca0b('0x55')](_0x2e232a));return[];}}exports[_0xca0b('0x56')]=function(_0x5b4737,_0x5a97a4){if(_0x5b4737[_0xca0b('0x57')]){_0x5b4737[_0xca0b('0x57')][_0xca0b('0x40')]=widgetAttributes(_0x5b4737[_0xca0b('0x57')]);}return db[_0xca0b('0x30')][_0xca0b('0x56')](_0x5b4737[_0xca0b('0x57')],{})[_0xca0b('0x27')](respondWithResult(_0x5a97a4,0xc9))[_0xca0b('0x3c')](handleError(_0x5a97a4,null));};exports[_0xca0b('0x58')]=function(_0x2c2c09,_0x266e13){if(_0x2c2c09[_0xca0b('0x57')]['id']){delete _0x2c2c09[_0xca0b('0x57')]['id'];}_0x2c2c09['body'][_0xca0b('0x40')]=widgetAttributes(_0x2c2c09[_0xca0b('0x57')]);return db[_0xca0b('0x30')][_0xca0b('0x3b')]({'where':{'id':_0x2c2c09[_0xca0b('0x2d')]['id']}})[_0xca0b('0x27')](handleEntityNotFound(_0x266e13,null))[_0xca0b('0x27')](saveUpdates(_0x2c2c09['body'],null))['then'](respondWithResult(_0x266e13,null))['catch'](handleError(_0x266e13,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 5370216..fae022b 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 _0xf0c7=['emit','hasOwnProperty','hook','events','DashboardItem','setMaxListeners','save','update','remove'];(function(_0x48c53f,_0x2964da){var _0x51297a=function(_0x250784){while(--_0x250784){_0x48c53f['push'](_0x48c53f['shift']());}};_0x51297a(++_0x2964da);}(_0xf0c7,0xc9));var _0x7f0c=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xf0c7[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require(_0x7f0c('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x7f0c('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x7f0c('0x2')](0x0);var events={'afterCreate':_0x7f0c('0x3'),'afterUpdate':_0x7f0c('0x4'),'afterDestroy':_0x7f0c('0x5')};function emitEvent(_0x2cbc41){return function(_0x1a60a8,_0x37edd2,_0x5b8840){DashboardItemEvents[_0x7f0c('0x6')](_0x2cbc41+':'+_0x1a60a8['id'],_0x1a60a8);DashboardItemEvents['emit'](_0x2cbc41,_0x1a60a8);_0x5b8840(null);};}for(var e in events){if(events[_0x7f0c('0x7')](e)){var event=events[e];DashboardItem[_0x7f0c('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x1fec=['remove','hasOwnProperty','hook','exports','../../mysqldb','DashboardItem','setMaxListeners','save','update'];(function(_0x5dea23,_0x2735ed){var _0xa3e05c=function(_0x4fce25){while(--_0x4fce25){_0x5dea23['push'](_0x5dea23['shift']());}};_0xa3e05c(++_0x2735ed);}(_0x1fec,0x1ea));var _0xc1fe=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x1fec[_0x1ccdf7];return _0x52a0ae;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xc1fe('0x0'))['db'][_0xc1fe('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xc1fe('0x2')](0x0);var events={'afterCreate':_0xc1fe('0x3'),'afterUpdate':_0xc1fe('0x4'),'afterDestroy':_0xc1fe('0x5')};function emitEvent(_0x391d0f){return function(_0x381dfc,_0x4d2952,_0x39f5e5){DashboardItemEvents['emit'](_0x391d0f+':'+_0x381dfc['id'],_0x381dfc);DashboardItemEvents['emit'](_0x391d0f,_0x381dfc);_0x39f5e5(null);};}for(var e in events){if(events[_0xc1fe('0x6')](e)){var event=events[e];DashboardItem[_0xc1fe('0x7')](e,emitEvent(event));}}module[_0xc1fe('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index bfeb55a..2579d05 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 _0x4176=['../../config/logger','api','moment','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash'];(function(_0x362e90,_0x597372){var _0x5ef58a=function(_0x26e548){while(--_0x26e548){_0x362e90['push'](_0x362e90['shift']());}};_0x5ef58a(++_0x597372);}(_0x4176,0x180));var _0x6417=function(_0x555b2f,_0x43b622){_0x555b2f=_0x555b2f-0x0;var _0x81c0a6=_0x4176[_0x555b2f];return _0x81c0a6;};'use strict';var _=require(_0x6417('0x0'));var util=require('util');var logger=require(_0x6417('0x1'))(_0x6417('0x2'));var moment=require(_0x6417('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6417('0x4'));var config=require(_0x6417('0x5'));var attributes=require(_0x6417('0x6'));module[_0x6417('0x7')]=function(_0x14fe80,_0x19ced4){return _0x14fe80[_0x6417('0x8')](_0x6417('0x9'),attributes,{'tableName':_0x6417('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe845=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','define','dashboard_items'];(function(_0x296cae,_0x5f0757){var _0x41f225=function(_0x1656c5){while(--_0x1656c5){_0x296cae['push'](_0x296cae['shift']());}};_0x41f225(++_0x5f0757);}(_0xe845,0x19a));var _0x5e84=function(_0x566b9c,_0x56a9f3){_0x566b9c=_0x566b9c-0x0;var _0x4a1789=_0xe845[_0x566b9c];return _0x4a1789;};'use strict';var _=require(_0x5e84('0x0'));var util=require(_0x5e84('0x1'));var logger=require(_0x5e84('0x2'))('api');var moment=require(_0x5e84('0x3'));var BPromise=require(_0x5e84('0x4'));var rp=require(_0x5e84('0x5'));var fs=require('fs');var path=require(_0x5e84('0x6'));var rimraf=require(_0x5e84('0x7'));var config=require('../../config/environment');var attributes=require('./dashboardItem.attributes');module['exports']=function(_0x4f5432,_0x1dac06){return _0x4f5432[_0x5e84('0x8')]('DashboardItem',attributes,{'tableName':_0x5e84('0x9'),'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 b508028..57e0399 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 _0x1b6a=['../../config/logger','rpc','client','http','redis','defaults','localhost','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xfb8226,_0x3d41ef){var _0x47b880=function(_0x382c1d){while(--_0x382c1d){_0xfb8226['push'](_0xfb8226['shift']());}};_0x47b880(++_0x3d41ef);}(_0x1b6a,0x163));var _0xa1b6=function(_0x37918a,_0x2e2c82){_0x37918a=_0x37918a-0x0;var _0x4b0532=_0x1b6a[_0x37918a];return _0x4b0532;};'use strict';var _=require('lodash');var util=require(_0xa1b6('0x0'));var moment=require('moment');var BPromise=require(_0xa1b6('0x1'));var rs=require(_0xa1b6('0x2'));var fs=require('fs');var Redis=require(_0xa1b6('0x3'));var db=require(_0xa1b6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1b6('0x5'))(_0xa1b6('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa1b6('0x7')][_0xa1b6('0x8')]({'port':0x232a});config[_0xa1b6('0x9')]=_[_0xa1b6('0xa')](config[_0xa1b6('0x9')],{'host':_0xa1b6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa1b6('0x9')]));require('./dashboardItem.socket')[_0xa1b6('0xc')](socket);function respondWithRpcPromise(_0x5146fd,_0x5882b6,_0x387592){return new BPromise(function(_0x356964,_0x52d9a2){return client['request'](_0x5146fd,_0x387592)[_0xa1b6('0xd')](function(_0x3d7758){logger[_0xa1b6('0xe')](_0xa1b6('0xf'),_0x5882b6,_0xa1b6('0x10'));logger['debug'](_0xa1b6('0x11'),_0x5882b6,_0xa1b6('0x10'),JSON[_0xa1b6('0x12')](_0x3d7758));if(_0x3d7758[_0xa1b6('0x13')]){if(_0x3d7758[_0xa1b6('0x13')][_0xa1b6('0x14')]===0x1f4){logger[_0xa1b6('0x13')]('DashboardItem,\x20%s,\x20%s',_0x5882b6,_0x3d7758['error'][_0xa1b6('0x15')]);return _0x52d9a2(_0x3d7758[_0xa1b6('0x13')][_0xa1b6('0x15')]);}logger[_0xa1b6('0x13')]('DashboardItem,\x20%s,\x20%s',_0x5882b6,_0x3d7758[_0xa1b6('0x13')][_0xa1b6('0x15')]);return _0x356964(_0x3d7758['error'][_0xa1b6('0x15')]);}else{logger[_0xa1b6('0xe')]('DashboardItem,\x20%s,\x20%s',_0x5882b6,_0xa1b6('0x10'));_0x356964(_0x3d7758[_0xa1b6('0x16')][_0xa1b6('0x15')]);}})[_0xa1b6('0x17')](function(_0x3166ba){logger[_0xa1b6('0x13')](_0xa1b6('0xf'),_0x5882b6,_0x3166ba);_0x52d9a2(_0x3166ba);});});} \ No newline at end of file +var _0xdef6=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','randomstring'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xdef6,0xed));var _0x6def=function(_0x13e300,_0x1bcb41){_0x13e300=_0x13e300-0x0;var _0x5a3eea=_0xdef6[_0x13e300];return _0x5a3eea;};'use strict';var _=require(_0x6def('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6def('0x1'));var rs=require(_0x6def('0x2'));var fs=require('fs');var Redis=require(_0x6def('0x3'));var db=require(_0x6def('0x4'))['db'];var utils=require(_0x6def('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x6def('0x6'));var jayson=require(_0x6def('0x7'));var client=jayson[_0x6def('0x8')]['http']({'port':0x232a});config[_0x6def('0x9')]=_['defaults'](config[_0x6def('0x9')],{'host':_0x6def('0xa'),'port':0x18eb});var socket=require(_0x6def('0xb'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0x6def('0xc')](socket);function respondWithRpcPromise(_0x265927,_0x3815dc,_0x11522b){return new BPromise(function(_0x18eabb,_0x1eb3b2){return client['request'](_0x265927,_0x11522b)[_0x6def('0xd')](function(_0x3d91a9){logger[_0x6def('0xe')](_0x6def('0xf'),_0x3815dc,_0x6def('0x10'));logger[_0x6def('0x11')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x3815dc,'request\x20sent',JSON[_0x6def('0x12')](_0x3d91a9));if(_0x3d91a9[_0x6def('0x13')]){if(_0x3d91a9['error'][_0x6def('0x14')]===0x1f4){logger[_0x6def('0x13')]('DashboardItem,\x20%s,\x20%s',_0x3815dc,_0x3d91a9[_0x6def('0x13')][_0x6def('0x15')]);return _0x1eb3b2(_0x3d91a9[_0x6def('0x13')]['message']);}logger[_0x6def('0x13')](_0x6def('0xf'),_0x3815dc,_0x3d91a9[_0x6def('0x13')][_0x6def('0x15')]);return _0x18eabb(_0x3d91a9['error'][_0x6def('0x15')]);}else{logger[_0x6def('0xe')](_0x6def('0xf'),_0x3815dc,_0x6def('0x10'));_0x18eabb(_0x3d91a9[_0x6def('0x16')][_0x6def('0x15')]);}})[_0x6def('0x17')](function(_0x37e309){logger['error'](_0x6def('0xf'),_0x3815dc,_0x37e309);_0x1eb3b2(_0x37e309);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index dafc1bc..82eba77 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 _0xdc9f=['length','dashboardItem:','./dashboardItem.events','save','emit','removeListener','register'];(function(_0x4f78eb,_0x13a22){var _0xb020e9=function(_0x13c88b){while(--_0x13c88b){_0x4f78eb['push'](_0x4f78eb['shift']());}};_0xb020e9(++_0x13a22);}(_0xdc9f,0x9c));var _0xfdc9=function(_0xe87aa5,_0x51c211){_0xe87aa5=_0xe87aa5-0x0;var _0x1272cb=_0xdc9f[_0xe87aa5];return _0x1272cb;};'use strict';var DashboardItemEvents=require(_0xfdc9('0x0'));var events=[_0xfdc9('0x1'),'remove','update'];function createListener(_0x552fd9,_0x72f5f){return function(_0x2b092b){_0x72f5f[_0xfdc9('0x2')](_0x552fd9,_0x2b092b);};}function removeListener(_0x210961,_0xf21f51){return function(){DashboardItemEvents[_0xfdc9('0x3')](_0x210961,_0xf21f51);};}exports[_0xfdc9('0x4')]=function(_0x5554e8){for(var _0x3bbaad=0x0,_0x7ae1c6=events[_0xfdc9('0x5')];_0x3bbaad<_0x7ae1c6;_0x3bbaad++){var _0x18ffbf=events[_0x3bbaad];var _0x4a8646=createListener(_0xfdc9('0x6')+_0x18ffbf,_0x5554e8);DashboardItemEvents['on'](_0x18ffbf,_0x4a8646);}}; \ No newline at end of file +var _0x4969=['removeListener','length','save','remove','update','emit'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4969,0xfe));var _0x9496=function(_0x2316b9,_0x87059b){_0x2316b9=_0x2316b9-0x0;var _0x4405a9=_0x4969[_0x2316b9];return _0x4405a9;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x9496('0x0'),_0x9496('0x1'),_0x9496('0x2')];function createListener(_0x37150a,_0x555c40){return function(_0x3207a7){_0x555c40[_0x9496('0x3')](_0x37150a,_0x3207a7);};}function removeListener(_0x458c72,_0x4873cc){return function(){DashboardItemEvents[_0x9496('0x4')](_0x458c72,_0x4873cc);};}exports['register']=function(_0x47da5b){for(var _0x505ccd=0x0,_0x5c8e4f=events[_0x9496('0x5')];_0x505ccd<_0x5c8e4f;_0x505ccd++){var _0x6a3441=events[_0x505ccd];var _0x39221b=createListener('dashboardItem:'+_0x6a3441,_0x47da5b);DashboardItemEvents['on'](_0x6a3441,_0x39221b);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index d2620fc..d060822 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 _0xabce=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./dashboardItem.controller','isAuthenticated','post','create','put','/:id'];(function(_0x47408e,_0x481428){var _0x1636bc=function(_0x2fe7a6){while(--_0x2fe7a6){_0x47408e['push'](_0x47408e['shift']());}};_0x1636bc(++_0x481428);}(_0xabce,0x103));var _0xeabc=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xabce[_0x32d457];return _0x338386;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xeabc('0x5'));var config=require(_0xeabc('0x6'));var controller=require(_0xeabc('0x7'));router['get']('/:id',auth[_0xeabc('0x8')](),controller['show']);router[_0xeabc('0x9')]('/',auth['isAuthenticated'](),controller[_0xeabc('0xa')]);router[_0xeabc('0xb')](_0xeabc('0xc'),auth['isAuthenticated'](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xf')]);module[_0xeabc('0x10')]=router; \ No newline at end of file +var _0x1261=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','show','post','create','put','/:id','isAuthenticated','update','destroy'];(function(_0x3f53f8,_0x2a960f){var _0x324c17=function(_0x1f6934){while(--_0x1f6934){_0x3f53f8['push'](_0x3f53f8['shift']());}};_0x324c17(++_0x2a960f);}(_0x1261,0x144));var _0x1126=function(_0x3b3dcb,_0x5c873f){_0x3b3dcb=_0x3b3dcb-0x0;var _0x4054b4=_0x1261[_0x3b3dcb];return _0x4054b4;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var auth=require(_0x1126('0x5'));var interaction=require(_0x1126('0x6'));var config=require(_0x1126('0x7'));var controller=require(_0x1126('0x8'));router[_0x1126('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/',auth['isAuthenticated'](),controller[_0x1126('0xc')]);router[_0x1126('0xd')](_0x1126('0xe'),auth[_0x1126('0xf')](),controller[_0x1126('0x10')]);router['delete'](_0x1126('0xe'),auth[_0x1126('0xf')](),controller[_0x1126('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 3bef196..12e817d 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 _0x2e50=['ENUM','second','STRING'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x2e50,0x182));var _0x02e5=function(_0x1646fa,_0x4e5bd7){_0x1646fa=_0x1646fa-0x0;var _0x5a47a5=_0x2e50[_0x1646fa];return _0x5a47a5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x02e5('0x0')],'allowNull':![]},'level':{'type':Sequelize[_0x02e5('0x1')]('first',_0x02e5('0x2'),'third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x02e5('0x0')]}}; \ No newline at end of file +var _0x0b68=['second','sequelize','exports','STRING','first'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x0b68,0x1a5));var _0x80b6=function(_0x403485,_0x147f66){_0x403485=_0x403485-0x0;var _0x185912=_0x0b68[_0x403485];return _0x185912;};'use strict';var Sequelize=require(_0x80b6('0x0'));module[_0x80b6('0x1')]={'name':{'type':Sequelize[_0x80b6('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x80b6('0x3'),_0x80b6('0x4'),'third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x80b6('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 2a77166..575c74f 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 _0xdef3=['include','catch','show','params','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','Dispositions','UserProfileResource','end','stack','name','send','index','map','rawAttributes','model','query','keys','filters','intersection','attributes','fields','nolimit','offset','sort','filter','where','merge','VIRTUAL','options','Disposition','includeAll'];(function(_0x5e5f5b,_0xe5a72){var _0x5a1499=function(_0x3c3143){while(--_0x3c3143){_0x5e5f5b['push'](_0x5e5f5b['shift']());}};_0x5a1499(++_0xe5a72);}(_0xdef3,0x19a));var _0x3def=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xdef3[_0x5783f4];return _0x28e380;};'use strict';var pdf=require(_0x3def('0x0'));var emlformat=require(_0x3def('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3def('0x2'));var jsonpatch=require(_0x3def('0x3'));var rp=require(_0x3def('0x4'));var moment=require(_0x3def('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3def('0x6'));var path=require(_0x3def('0x7'));var sox=require(_0x3def('0x8'));var csv=require(_0x3def('0x9'));var ejs=require(_0x3def('0xa'));var fs=require('fs');var _=require(_0x3def('0xb'));var squel=require(_0x3def('0xc'));var crypto=require(_0x3def('0xd'));var jsforce=require(_0x3def('0xe'));var deskjs=require(_0x3def('0xf'));var toCsv=require(_0x3def('0x9'));var querystring=require('querystring');var Papa=require(_0x3def('0x10'));var Redis=require(_0x3def('0x11'));var authService=require(_0x3def('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3def('0x13'));var hardwareService=require(_0x3def('0x14'));var logger=require('../../config/logger')(_0x3def('0x15'));var utils=require(_0x3def('0x16'));var config=require(_0x3def('0x17'));var licenseUtil=require(_0x3def('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d49be,_0x40a08c){_0x40a08c=_0x40a08c||0xcc;return function(_0x1e9fea){if(_0x1e9fea){return _0x4d49be[_0x3def('0x19')](_0x40a08c);}return _0x4d49be[_0x3def('0x1a')](_0x40a08c)['end']();};}function respondWithResult(_0x48317a,_0x348f4d){_0x348f4d=_0x348f4d||0xc8;return function(_0x185ec8){if(_0x185ec8){return _0x48317a[_0x3def('0x1a')](_0x348f4d)[_0x3def('0x1b')](_0x185ec8);}};}function respondWithFilteredResult(_0x58f6d3,_0x17af76){return function(_0x4572fd){if(_0x4572fd){var _0x3fd378=_0x4572fd[_0x3def('0x1c')],_0x44942d=_0x17af76['offset'],_0x3051cd=_0x17af76['offset']+_0x17af76[_0x3def('0x1d')],_0x1c1a6d;if(_0x3051cd>=_0x3fd378){_0x3051cd=_0x3fd378;_0x1c1a6d=0xc8;}else{_0x1c1a6d=0xce;}_0x58f6d3['status'](_0x1c1a6d);return _0x58f6d3[_0x3def('0x1e')](_0x3def('0x1f'),_0x44942d+'-'+_0x3051cd+'/'+_0x3fd378)[_0x3def('0x1b')](_0x4572fd);}return null;};}function patchUpdates(_0x1af5de){return function(_0x52800f){try{jsonpatch[_0x3def('0x20')](_0x52800f,_0x1af5de,!![]);}catch(_0x26b777){return BPromise[_0x3def('0x21')](_0x26b777);}return _0x52800f[_0x3def('0x22')]();};}function saveUpdates(_0x468db3,_0x5e00ec){return function(_0x11524a){if(_0x11524a){return _0x11524a[_0x3def('0x23')](_0x468db3)[_0x3def('0x24')](function(_0x3cf387){return _0x3cf387;});}return null;};}function removeEntity(_0x4ab007,_0x1727bc){return function(_0x1c7dc0){if(_0x1c7dc0){return _0x1c7dc0[_0x3def('0x25')]()['then'](function(){var _0x4d1d9c=_0x1c7dc0['get']({'plain':!![]});var _0x505373=_0x3def('0x26');return db[_0x3def('0x27')][_0x3def('0x25')]({'where':{'type':_0x505373,'resourceId':_0x4d1d9c['id']}})[_0x3def('0x24')](function(){return _0x1c7dc0;});})[_0x3def('0x24')](function(){_0x4ab007['status'](0xcc)[_0x3def('0x28')]();});}};}function handleEntityNotFound(_0x39ce60,_0x33c621){return function(_0x3c1d03){if(!_0x3c1d03){_0x39ce60[_0x3def('0x19')](0x194);}return _0x3c1d03;};}function handleError(_0x1766a0,_0x58a4bc){_0x58a4bc=_0x58a4bc||0x1f4;return function(_0x423565){logger['error'](_0x423565[_0x3def('0x29')]);if(_0x423565['name']){delete _0x423565[_0x3def('0x2a')];}_0x1766a0[_0x3def('0x1a')](_0x58a4bc)[_0x3def('0x2b')](_0x423565);};}exports[_0x3def('0x2c')]=function(_0x106623,_0x1ebb5c){var _0x3784d3={},_0x429bcc={},_0x5479a8={'count':0x0,'rows':[]};var _0x1ec952=_[_0x3def('0x2d')](db['Disposition'][_0x3def('0x2e')],function(_0x343395){return{'name':_0x343395['fieldName'],'type':_0x343395['type']['key']};});_0x429bcc[_0x3def('0x2f')]=_[_0x3def('0x2d')](_0x1ec952,'name');_0x429bcc[_0x3def('0x30')]=_[_0x3def('0x31')](_0x106623[_0x3def('0x30')]);_0x429bcc[_0x3def('0x32')]=_[_0x3def('0x33')](_0x429bcc[_0x3def('0x2f')],_0x429bcc[_0x3def('0x30')]);_0x3784d3[_0x3def('0x34')]=_[_0x3def('0x33')](_0x429bcc[_0x3def('0x2f')],qs[_0x3def('0x35')](_0x106623[_0x3def('0x30')][_0x3def('0x35')]));_0x3784d3[_0x3def('0x34')]=_0x3784d3[_0x3def('0x34')]['length']?_0x3784d3[_0x3def('0x34')]:_0x429bcc[_0x3def('0x2f')];if(!_0x106623['query']['hasOwnProperty'](_0x3def('0x36'))){_0x3784d3['limit']=qs[_0x3def('0x1d')](_0x106623[_0x3def('0x30')][_0x3def('0x1d')]);_0x3784d3[_0x3def('0x37')]=qs[_0x3def('0x37')](_0x106623[_0x3def('0x30')][_0x3def('0x37')]);}_0x3784d3['order']=qs[_0x3def('0x38')](_0x106623[_0x3def('0x30')][_0x3def('0x38')]);_0x3784d3['where']=qs[_0x3def('0x32')](_['pick'](_0x106623[_0x3def('0x30')],_0x429bcc[_0x3def('0x32')]),_0x1ec952);if(_0x106623[_0x3def('0x30')][_0x3def('0x39')]){_0x3784d3[_0x3def('0x3a')]=_[_0x3def('0x3b')](_0x3784d3[_0x3def('0x3a')],{'$or':_['map'](_0x1ec952,function(_0x31fd84){if(_0x31fd84['type']!==_0x3def('0x3c')){var _0x4a61d8={};_0x4a61d8[_0x31fd84[_0x3def('0x2a')]]={'$like':'%'+_0x106623[_0x3def('0x30')][_0x3def('0x39')]+'%'};return _0x4a61d8;}})});}_0x3784d3=_[_0x3def('0x3b')]({},_0x3784d3,_0x106623[_0x3def('0x3d')]);var _0x7dd4e9={'where':_0x3784d3[_0x3def('0x3a')]};return db[_0x3def('0x3e')][_0x3def('0x1c')](_0x7dd4e9)[_0x3def('0x24')](function(_0x454dab){_0x5479a8[_0x3def('0x1c')]=_0x454dab;if(_0x106623[_0x3def('0x30')][_0x3def('0x3f')]){_0x3784d3[_0x3def('0x40')]=[{'all':!![]}];}return db[_0x3def('0x3e')]['findAll'](_0x3784d3);})[_0x3def('0x24')](function(_0xc69b3b){_0x5479a8['rows']=_0xc69b3b;return _0x5479a8;})[_0x3def('0x24')](respondWithFilteredResult(_0x1ebb5c,_0x3784d3))[_0x3def('0x41')](handleError(_0x1ebb5c,null));};exports[_0x3def('0x42')]=function(_0x5adebb,_0x32c21b){var _0x485bef={'raw':!![],'where':{'id':_0x5adebb[_0x3def('0x43')]['id']}},_0x4388c4={};_0x4388c4[_0x3def('0x2f')]=_[_0x3def('0x31')](db[_0x3def('0x3e')][_0x3def('0x2e')]);_0x4388c4['query']=_[_0x3def('0x31')](_0x5adebb['query']);_0x4388c4[_0x3def('0x32')]=_['intersection'](_0x4388c4[_0x3def('0x2f')],_0x4388c4[_0x3def('0x30')]);_0x485bef[_0x3def('0x34')]=_['intersection'](_0x4388c4['model'],qs[_0x3def('0x35')](_0x5adebb[_0x3def('0x30')][_0x3def('0x35')]));_0x485bef[_0x3def('0x34')]=_0x485bef[_0x3def('0x34')][_0x3def('0x44')]?_0x485bef[_0x3def('0x34')]:_0x4388c4[_0x3def('0x2f')];if(_0x5adebb['query'][_0x3def('0x3f')]){_0x485bef['include']=[{'all':!![]}];}_0x485bef=_[_0x3def('0x3b')]({},_0x485bef,_0x5adebb['options']);return db['Disposition']['find'](_0x485bef)['then'](handleEntityNotFound(_0x32c21b,null))['then'](respondWithResult(_0x32c21b,null))[_0x3def('0x41')](handleError(_0x32c21b,null));};exports[_0x3def('0x45')]=function(_0x7c5356,_0x1401e8){return db[_0x3def('0x3e')][_0x3def('0x45')](_0x7c5356[_0x3def('0x46')],{})[_0x3def('0x24')](function(_0x4b8d49){var _0x5aee25=_0x7c5356[_0x3def('0x47')][_0x3def('0x48')]({'plain':!![]});if(!_0x5aee25)throw new Error(_0x3def('0x49'));if(_0x5aee25['role']===_0x3def('0x47')){var _0x22460e=_0x4b8d49[_0x3def('0x48')]({'plain':!![]});var _0x5b3d05=_0x3def('0x26');return db[_0x3def('0x4a')]['find']({'where':{'name':_0x5b3d05,'userProfileId':_0x5aee25[_0x3def('0x4b')]},'raw':!![]})['then'](function(_0x1eea0e){if(_0x1eea0e&&_0x1eea0e[_0x3def('0x4c')]===0x0){return db[_0x3def('0x27')][_0x3def('0x45')]({'name':_0x22460e[_0x3def('0x2a')],'resourceId':_0x22460e['id'],'type':_0x1eea0e['name'],'sectionId':_0x1eea0e['id']},{})[_0x3def('0x24')](function(){return _0x4b8d49;});}else{return _0x4b8d49;}})['catch'](function(_0x32185e){logger[_0x3def('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32185e);throw _0x32185e;});}return _0x4b8d49;})[_0x3def('0x24')](respondWithResult(_0x1401e8,0xc9))[_0x3def('0x41')](handleError(_0x1401e8,null));};exports['update']=function(_0x1b9dec,_0x243ab3){if(_0x1b9dec[_0x3def('0x46')]['id']){delete _0x1b9dec[_0x3def('0x46')]['id'];}return db[_0x3def('0x3e')][_0x3def('0x4e')]({'where':{'id':_0x1b9dec['params']['id']}})['then'](handleEntityNotFound(_0x243ab3,null))['then'](saveUpdates(_0x1b9dec[_0x3def('0x46')],null))[_0x3def('0x24')](respondWithResult(_0x243ab3,null))['catch'](handleError(_0x243ab3,null));};exports['destroy']=function(_0x487556,_0x1b52be){return db[_0x3def('0x3e')][_0x3def('0x4e')]({'where':{'id':_0x487556[_0x3def('0x43')]['id']}})[_0x3def('0x24')](handleEntityNotFound(_0x1b52be,null))[_0x3def('0x24')](removeEntity(_0x1b52be,null))['catch'](handleError(_0x1b52be,null));}; \ No newline at end of file +var _0x55aa=['crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','get','Dispositions','UserProfileResource','stack','send','map','Disposition','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','catch','show','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','squel'];(function(_0x12fc6d,_0x1b2dc1){var _0x2929f0=function(_0x406001){while(--_0x406001){_0x12fc6d['push'](_0x12fc6d['shift']());}};_0x2929f0(++_0x1b2dc1);}(_0x55aa,0x148));var _0xa55a=function(_0x28ca36,_0x53ca65){_0x28ca36=_0x28ca36-0x0;var _0x30d544=_0x55aa[_0x28ca36];return _0x30d544;};'use strict';var pdf=require(_0xa55a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa55a('0x1'));var zipdir=require(_0xa55a('0x2'));var jsonpatch=require(_0xa55a('0x3'));var rp=require('request-promise');var moment=require(_0xa55a('0x4'));var BPromise=require(_0xa55a('0x5'));var Mustache=require(_0xa55a('0x6'));var util=require('util');var path=require(_0xa55a('0x7'));var sox=require(_0xa55a('0x8'));var csv=require('to-csv');var ejs=require(_0xa55a('0x9'));var fs=require('fs');var _=require(_0xa55a('0xa'));var squel=require(_0xa55a('0xb'));var crypto=require(_0xa55a('0xc'));var jsforce=require(_0xa55a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa55a('0xe'));var querystring=require(_0xa55a('0xf'));var Papa=require(_0xa55a('0x10'));var Redis=require(_0xa55a('0x11'));var authService=require(_0xa55a('0x12'));var qs=require(_0xa55a('0x13'));var as=require(_0xa55a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa55a('0x15'))(_0xa55a('0x16'));var utils=require(_0xa55a('0x17'));var config=require(_0xa55a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa55a('0x19'))['db'];function respondWithStatusCode(_0x57b175,_0x295efa){_0x295efa=_0x295efa||0xcc;return function(_0x24b82e){if(_0x24b82e){return _0x57b175[_0xa55a('0x1a')](_0x295efa);}return _0x57b175[_0xa55a('0x1b')](_0x295efa)[_0xa55a('0x1c')]();};}function respondWithResult(_0x3f5d9b,_0x5f02c8){_0x5f02c8=_0x5f02c8||0xc8;return function(_0x4196f5){if(_0x4196f5){return _0x3f5d9b[_0xa55a('0x1b')](_0x5f02c8)[_0xa55a('0x1d')](_0x4196f5);}};}function respondWithFilteredResult(_0x46baac,_0x49a7da){return function(_0x54f63b){if(_0x54f63b){var _0x4db624=_0x54f63b[_0xa55a('0x1e')],_0x5016c7=_0x49a7da[_0xa55a('0x1f')],_0x36756b=_0x49a7da['offset']+_0x49a7da[_0xa55a('0x20')],_0x4e3bc2;if(_0x36756b>=_0x4db624){_0x36756b=_0x4db624;_0x4e3bc2=0xc8;}else{_0x4e3bc2=0xce;}_0x46baac[_0xa55a('0x1b')](_0x4e3bc2);return _0x46baac[_0xa55a('0x21')](_0xa55a('0x22'),_0x5016c7+'-'+_0x36756b+'/'+_0x4db624)['json'](_0x54f63b);}return null;};}function patchUpdates(_0x51212d){return function(_0x3c3651){try{jsonpatch['apply'](_0x3c3651,_0x51212d,!![]);}catch(_0x22de51){return BPromise[_0xa55a('0x23')](_0x22de51);}return _0x3c3651[_0xa55a('0x24')]();};}function saveUpdates(_0x60dca0,_0x56ec44){return function(_0x15b758){if(_0x15b758){return _0x15b758[_0xa55a('0x25')](_0x60dca0)['then'](function(_0x1375c9){return _0x1375c9;});}return null;};}function removeEntity(_0x55559d,_0x51bdc4){return function(_0x1ea7d9){if(_0x1ea7d9){return _0x1ea7d9[_0xa55a('0x26')]()[_0xa55a('0x27')](function(){var _0x2c129c=_0x1ea7d9[_0xa55a('0x28')]({'plain':!![]});var _0x1f35af=_0xa55a('0x29');return db[_0xa55a('0x2a')]['destroy']({'where':{'type':_0x1f35af,'resourceId':_0x2c129c['id']}})[_0xa55a('0x27')](function(){return _0x1ea7d9;});})[_0xa55a('0x27')](function(){_0x55559d[_0xa55a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46eade,_0x2a1658){return function(_0x1c4343){if(!_0x1c4343){_0x46eade[_0xa55a('0x1a')](0x194);}return _0x1c4343;};}function handleError(_0xb7536e,_0x487b19){_0x487b19=_0x487b19||0x1f4;return function(_0x23dcae){logger['error'](_0x23dcae[_0xa55a('0x2b')]);if(_0x23dcae['name']){delete _0x23dcae['name'];}_0xb7536e['status'](_0x487b19)[_0xa55a('0x2c')](_0x23dcae);};}exports['index']=function(_0x47b256,_0x8aec3a){var _0x32b76e={},_0x52d580={},_0x1f79bc={'count':0x0,'rows':[]};var _0x566360=_[_0xa55a('0x2d')](db[_0xa55a('0x2e')][_0xa55a('0x2f')],function(_0x529c37){return{'name':_0x529c37[_0xa55a('0x30')],'type':_0x529c37[_0xa55a('0x31')][_0xa55a('0x32')]};});_0x52d580[_0xa55a('0x33')]=_[_0xa55a('0x2d')](_0x566360,_0xa55a('0x34'));_0x52d580[_0xa55a('0x35')]=_['keys'](_0x47b256[_0xa55a('0x35')]);_0x52d580[_0xa55a('0x36')]=_[_0xa55a('0x37')](_0x52d580[_0xa55a('0x33')],_0x52d580['query']);_0x32b76e[_0xa55a('0x38')]=_[_0xa55a('0x37')](_0x52d580[_0xa55a('0x33')],qs[_0xa55a('0x39')](_0x47b256[_0xa55a('0x35')][_0xa55a('0x39')]));_0x32b76e[_0xa55a('0x38')]=_0x32b76e[_0xa55a('0x38')][_0xa55a('0x3a')]?_0x32b76e[_0xa55a('0x38')]:_0x52d580[_0xa55a('0x33')];if(!_0x47b256['query'][_0xa55a('0x3b')](_0xa55a('0x3c'))){_0x32b76e['limit']=qs[_0xa55a('0x20')](_0x47b256[_0xa55a('0x35')][_0xa55a('0x20')]);_0x32b76e[_0xa55a('0x1f')]=qs[_0xa55a('0x1f')](_0x47b256['query']['offset']);}_0x32b76e['order']=qs[_0xa55a('0x3d')](_0x47b256[_0xa55a('0x35')][_0xa55a('0x3d')]);_0x32b76e['where']=qs[_0xa55a('0x36')](_[_0xa55a('0x3e')](_0x47b256[_0xa55a('0x35')],_0x52d580[_0xa55a('0x36')]),_0x566360);if(_0x47b256[_0xa55a('0x35')][_0xa55a('0x3f')]){_0x32b76e[_0xa55a('0x40')]=_[_0xa55a('0x41')](_0x32b76e[_0xa55a('0x40')],{'$or':_['map'](_0x566360,function(_0x402ef5){if(_0x402ef5['type']!==_0xa55a('0x42')){var _0x3fb60b={};_0x3fb60b[_0x402ef5['name']]={'$like':'%'+_0x47b256[_0xa55a('0x35')][_0xa55a('0x3f')]+'%'};return _0x3fb60b;}})});}_0x32b76e=_['merge']({},_0x32b76e,_0x47b256[_0xa55a('0x43')]);var _0x321e4d={'where':_0x32b76e[_0xa55a('0x40')]};return db[_0xa55a('0x2e')][_0xa55a('0x1e')](_0x321e4d)[_0xa55a('0x27')](function(_0x303a65){_0x1f79bc[_0xa55a('0x1e')]=_0x303a65;if(_0x47b256[_0xa55a('0x35')]['includeAll']){_0x32b76e[_0xa55a('0x44')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x32b76e);})[_0xa55a('0x27')](function(_0xe1309c){_0x1f79bc[_0xa55a('0x45')]=_0xe1309c;return _0x1f79bc;})['then'](respondWithFilteredResult(_0x8aec3a,_0x32b76e))[_0xa55a('0x46')](handleError(_0x8aec3a,null));};exports[_0xa55a('0x47')]=function(_0x4425e2,_0x312532){var _0x4b0019={'raw':!![],'where':{'id':_0x4425e2['params']['id']}},_0x5f497c={};_0x5f497c[_0xa55a('0x33')]=_['keys'](db[_0xa55a('0x2e')]['rawAttributes']);_0x5f497c[_0xa55a('0x35')]=_['keys'](_0x4425e2[_0xa55a('0x35')]);_0x5f497c['filters']=_[_0xa55a('0x37')](_0x5f497c[_0xa55a('0x33')],_0x5f497c[_0xa55a('0x35')]);_0x4b0019[_0xa55a('0x38')]=_[_0xa55a('0x37')](_0x5f497c['model'],qs[_0xa55a('0x39')](_0x4425e2[_0xa55a('0x35')][_0xa55a('0x39')]));_0x4b0019[_0xa55a('0x38')]=_0x4b0019[_0xa55a('0x38')][_0xa55a('0x3a')]?_0x4b0019[_0xa55a('0x38')]:_0x5f497c['model'];if(_0x4425e2['query'][_0xa55a('0x48')]){_0x4b0019['include']=[{'all':!![]}];}_0x4b0019=_[_0xa55a('0x41')]({},_0x4b0019,_0x4425e2[_0xa55a('0x43')]);return db[_0xa55a('0x2e')]['find'](_0x4b0019)[_0xa55a('0x27')](handleEntityNotFound(_0x312532,null))[_0xa55a('0x27')](respondWithResult(_0x312532,null))[_0xa55a('0x46')](handleError(_0x312532,null));};exports[_0xa55a('0x49')]=function(_0x3fdcd3,_0x240e42){return db[_0xa55a('0x2e')][_0xa55a('0x49')](_0x3fdcd3[_0xa55a('0x4a')],{})[_0xa55a('0x27')](function(_0x551425){var _0xe021=_0x3fdcd3[_0xa55a('0x4b')]['get']({'plain':!![]});if(!_0xe021)throw new Error(_0xa55a('0x4c'));if(_0xe021[_0xa55a('0x4d')]===_0xa55a('0x4b')){var _0x2441c8=_0x551425['get']({'plain':!![]});var _0x372e6b=_0xa55a('0x29');return db[_0xa55a('0x4e')][_0xa55a('0x4f')]({'where':{'name':_0x372e6b,'userProfileId':_0xe021[_0xa55a('0x50')]},'raw':!![]})[_0xa55a('0x27')](function(_0x16af47){if(_0x16af47&&_0x16af47[_0xa55a('0x51')]===0x0){return db[_0xa55a('0x2a')][_0xa55a('0x49')]({'name':_0x2441c8[_0xa55a('0x34')],'resourceId':_0x2441c8['id'],'type':_0x16af47[_0xa55a('0x34')],'sectionId':_0x16af47['id']},{})[_0xa55a('0x27')](function(){return _0x551425;});}else{return _0x551425;}})[_0xa55a('0x46')](function(_0x5c795c){logger[_0xa55a('0x52')](_0xa55a('0x53'),_0x5c795c);throw _0x5c795c;});}return _0x551425;})['then'](respondWithResult(_0x240e42,0xc9))[_0xa55a('0x46')](handleError(_0x240e42,null));};exports[_0xa55a('0x25')]=function(_0x34e620,_0x5b4e81){if(_0x34e620[_0xa55a('0x4a')]['id']){delete _0x34e620[_0xa55a('0x4a')]['id'];}return db[_0xa55a('0x2e')]['find']({'where':{'id':_0x34e620[_0xa55a('0x54')]['id']}})[_0xa55a('0x27')](handleEntityNotFound(_0x5b4e81,null))['then'](saveUpdates(_0x34e620[_0xa55a('0x4a')],null))[_0xa55a('0x27')](respondWithResult(_0x5b4e81,null))[_0xa55a('0x46')](handleError(_0x5b4e81,null));};exports[_0xa55a('0x26')]=function(_0x3bebe6,_0x18b280){return db[_0xa55a('0x2e')]['find']({'where':{'id':_0x3bebe6['params']['id']}})[_0xa55a('0x27')](handleEntityNotFound(_0x18b280,null))[_0xa55a('0x27')](removeEntity(_0x18b280,null))[_0xa55a('0x46')](handleError(_0x18b280,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 054d7d0..3c3e4e0 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 _0xc1fa=['rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','name_chat','ChatWebsiteId','name_mail','FaxAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x1ad926,_0x3e1fed){var _0x1b81dc=function(_0x506f83){while(--_0x506f83){_0x1ad926['push'](_0x1ad926['shift']());}};_0x1b81dc(++_0x3e1fed);}(_0xc1fa,0x83));var _0xac1f=function(_0x1793de,_0x4d7233){_0x1793de=_0x1793de-0x0;var _0x4f0309=_0xc1fa[_0x1793de];return _0x4f0309;};'use strict';var _=require(_0xac1f('0x0'));var util=require(_0xac1f('0x1'));var logger=require(_0xac1f('0x2'))(_0xac1f('0x3'));var moment=require(_0xac1f('0x4'));var BPromise=require(_0xac1f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xac1f('0x6'));var rimraf=require(_0xac1f('0x7'));var config=require(_0xac1f('0x8'));var attributes=require(_0xac1f('0x9'));module[_0xac1f('0xa')]=function(_0x4342a5,_0x38bd1d){return _0x4342a5[_0xac1f('0xb')](_0xac1f('0xc'),attributes,{'tableName':_0xac1f('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xac1f('0xe'),'fields':[_0xac1f('0xf'),'ListId']},{'unique':!![],'name':_0xac1f('0x10'),'fields':[_0xac1f('0xf'),_0xac1f('0x11')]},{'unique':!![],'name':_0xac1f('0x12'),'fields':[_0xac1f('0xf'),'MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0xac1f('0xf'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':[_0xac1f('0xf'),_0xac1f('0x13')]},{'unique':!![],'name':'name_openchannel','fields':[_0xac1f('0xf'),_0xac1f('0x14')]},{'unique':!![],'name':_0xac1f('0x15'),'fields':[_0xac1f('0xf'),_0xac1f('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa6bb=['ListId','name_chat','name','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions'];(function(_0x19635f,_0x564859){var _0x482132=function(_0x177ea7){while(--_0x177ea7){_0x19635f['push'](_0x19635f['shift']());}};_0x482132(++_0x564859);}(_0xa6bb,0x12c));var _0xba6b=function(_0x2ab586,_0x133ce3){_0x2ab586=_0x2ab586-0x0;var _0xa3be82=_0xa6bb[_0x2ab586];return _0xa3be82;};'use strict';var _=require('lodash');var util=require(_0xba6b('0x0'));var logger=require(_0xba6b('0x1'))(_0xba6b('0x2'));var moment=require(_0xba6b('0x3'));var BPromise=require(_0xba6b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xba6b('0x5'));var config=require(_0xba6b('0x6'));var attributes=require(_0xba6b('0x7'));module[_0xba6b('0x8')]=function(_0x517d10,_0x4cc381){return _0x517d10[_0xba6b('0x9')](_0xba6b('0xa'),attributes,{'tableName':_0xba6b('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':['name',_0xba6b('0xc')]},{'unique':!![],'name':_0xba6b('0xd'),'fields':[_0xba6b('0xe'),_0xba6b('0xf')]},{'unique':!![],'name':_0xba6b('0x10'),'fields':['name',_0xba6b('0x11')]},{'unique':!![],'name':_0xba6b('0x12'),'fields':[_0xba6b('0xe'),'SmsAccountId']},{'unique':!![],'name':_0xba6b('0x13'),'fields':[_0xba6b('0xe'),_0xba6b('0x14')]},{'unique':!![],'name':_0xba6b('0x15'),'fields':['name',_0xba6b('0x16')]},{'unique':!![],'name':'name_whatsapp','fields':[_0xba6b('0xe'),_0xba6b('0x17')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 130f380..db83d10 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 _0x2bee=['request\x20sent','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','Disposition,\x20%s,\x20%s'];(function(_0x3462fc,_0xcd0e27){var _0x5c1db5=function(_0x183f15){while(--_0x183f15){_0x3462fc['push'](_0x3462fc['shift']());}};_0x5c1db5(++_0xcd0e27);}(_0x2bee,0xe3));var _0xe2be=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x2bee[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0xe2be('0x0'));var util=require('util');var moment=require(_0xe2be('0x1'));var BPromise=require(_0xe2be('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe2be('0x3'));var db=require(_0xe2be('0x4'))['db'];var utils=require(_0xe2be('0x5'));var logger=require(_0xe2be('0x6'))(_0xe2be('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe2be('0x8')][_0xe2be('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcbe6cc,_0x4551d8,_0x1d941b){return new BPromise(function(_0x4bc8cd,_0xe49884){return client[_0xe2be('0xa')](_0xcbe6cc,_0x1d941b)[_0xe2be('0xb')](function(_0x2dc346){logger['info'](_0xe2be('0xc'),_0x4551d8,_0xe2be('0xd'));logger['debug'](_0xe2be('0xe'),_0x4551d8,_0xe2be('0xd'),JSON[_0xe2be('0xf')](_0x2dc346));if(_0x2dc346[_0xe2be('0x10')]){if(_0x2dc346[_0xe2be('0x10')]['code']===0x1f4){logger['error'](_0xe2be('0xc'),_0x4551d8,_0x2dc346[_0xe2be('0x10')][_0xe2be('0x11')]);return _0xe49884(_0x2dc346[_0xe2be('0x10')][_0xe2be('0x11')]);}logger[_0xe2be('0x10')]('Disposition,\x20%s,\x20%s',_0x4551d8,_0x2dc346[_0xe2be('0x10')][_0xe2be('0x11')]);return _0x4bc8cd(_0x2dc346[_0xe2be('0x10')][_0xe2be('0x11')]);}else{logger[_0xe2be('0x12')](_0xe2be('0xc'),_0x4551d8,'request\x20sent');_0x4bc8cd(_0x2dc346['result'][_0xe2be('0x11')]);}})[_0xe2be('0x13')](function(_0x35815b){logger[_0xe2be('0x10')](_0xe2be('0xc'),_0x4551d8,_0x35815b);_0xe49884(_0x35815b);});});} \ No newline at end of file +var _0x98c7=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x98c7,0xc3));var _0x798c=function(_0x1667df,_0x266940){_0x1667df=_0x1667df-0x0;var _0x341abf=_0x98c7[_0x1667df];return _0x341abf;};'use strict';var _=require(_0x798c('0x0'));var util=require(_0x798c('0x1'));var moment=require(_0x798c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x798c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x798c('0x4'));var logger=require(_0x798c('0x5'))(_0x798c('0x6'));var config=require(_0x798c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x798c('0x8')][_0x798c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xdee41e,_0x48ed3c,_0x22cfff){return new BPromise(function(_0x5bb157,_0x5108a3){return client[_0x798c('0xa')](_0xdee41e,_0x22cfff)[_0x798c('0xb')](function(_0x3ba608){logger[_0x798c('0xc')](_0x798c('0xd'),_0x48ed3c,'request\x20sent');logger['debug']('Disposition,\x20%s,\x20%s,\x20%s',_0x48ed3c,_0x798c('0xe'),JSON[_0x798c('0xf')](_0x3ba608));if(_0x3ba608[_0x798c('0x10')]){if(_0x3ba608[_0x798c('0x10')]['code']===0x1f4){logger[_0x798c('0x10')](_0x798c('0xd'),_0x48ed3c,_0x3ba608['error'][_0x798c('0x11')]);return _0x5108a3(_0x3ba608[_0x798c('0x10')][_0x798c('0x11')]);}logger[_0x798c('0x10')](_0x798c('0xd'),_0x48ed3c,_0x3ba608[_0x798c('0x10')]['message']);return _0x5bb157(_0x3ba608[_0x798c('0x10')][_0x798c('0x11')]);}else{logger[_0x798c('0xc')](_0x798c('0xd'),_0x48ed3c,'request\x20sent');_0x5bb157(_0x3ba608[_0x798c('0x12')][_0x798c('0x11')]);}})[_0x798c('0x13')](function(_0x774d6d){logger[_0x798c('0x10')]('Disposition,\x20%s,\x20%s',_0x48ed3c,_0x774d6d);_0x5108a3(_0x774d6d);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 5948aa0..180d346 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 _0xe0ad=['show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./disposition.controller','get','isAuthenticated','/:id'];(function(_0x21b232,_0x1b9b77){var _0x54a541=function(_0x466d43){while(--_0x466d43){_0x21b232['push'](_0x21b232['shift']());}};_0x54a541(++_0x1b9b77);}(_0xe0ad,0x127));var _0xde0a=function(_0x13b827,_0x494baa){_0x13b827=_0x13b827-0x0;var _0x22895d=_0xe0ad[_0x13b827];return _0x22895d;};'use strict';var multer=require(_0xde0a('0x0'));var util=require(_0xde0a('0x1'));var path=require(_0xde0a('0x2'));var timeout=require(_0xde0a('0x3'));var express=require(_0xde0a('0x4'));var router=express['Router']();var auth=require(_0xde0a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xde0a('0x6'));var controller=require(_0xde0a('0x7'));router[_0xde0a('0x8')]('/',auth[_0xde0a('0x9')](),controller['index']);router[_0xde0a('0x8')](_0xde0a('0xa'),auth['isAuthenticated'](),controller[_0xde0a('0xb')]);router[_0xde0a('0xc')]('/',auth[_0xde0a('0x9')](),controller['create']);router[_0xde0a('0xd')](_0xde0a('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xde0a('0xe')](_0xde0a('0xa'),auth['isAuthenticated'](),controller[_0xde0a('0xf')]);module[_0xde0a('0x10')]=router; \ No newline at end of file +var _0x128e=['isAuthenticated','create','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../config/environment','./disposition.controller','get','index','/:id'];(function(_0xb4cc9b,_0x5015a8){var _0x198fe2=function(_0x12c22e){while(--_0x12c22e){_0xb4cc9b['push'](_0xb4cc9b['shift']());}};_0x198fe2(++_0x5015a8);}(_0x128e,0xd7));var _0xe128=function(_0xe62e61,_0x29e8e7){_0xe62e61=_0xe62e61-0x0;var _0xb0dcc0=_0x128e[_0xe62e61];return _0xb0dcc0;};'use strict';var multer=require(_0xe128('0x0'));var util=require('util');var path=require(_0xe128('0x1'));var timeout=require(_0xe128('0x2'));var express=require(_0xe128('0x3'));var router=express[_0xe128('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe128('0x5'));var controller=require(_0xe128('0x6'));router[_0xe128('0x7')]('/',auth['isAuthenticated'](),controller[_0xe128('0x8')]);router[_0xe128('0x7')](_0xe128('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xe128('0xa')](),controller[_0xe128('0xb')]);router['put'](_0xe128('0x9'),auth[_0xe128('0xa')](),controller['update']);router[_0xe128('0xc')](_0xe128('0x9'),auth[_0xe128('0xa')](),controller[_0xe128('0xd')]);module[_0xe128('0xe')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 06c9b6d..ea71666 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 _0x0916=['KHOMP','TEXT','BOOLEAN','setDataValue','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','IAX','DADHI'];(function(_0x4720af,_0x3eaa74){var _0x4917e1=function(_0x2c0e74){while(--_0x2c0e74){_0x4720af['push'](_0x4720af['shift']());}};_0x4917e1(++_0x3eaa74);}(_0x0916,0x12a));var _0x6091=function(_0x575cfd,_0x47ec81){_0x575cfd=_0x575cfd-0x0;var _0xd863ad=_0x0916[_0x575cfd];return _0xd863ad;};'use strict';var Sequelize=require(_0x6091('0x0'));module[_0x6091('0x1')]={'name':{'type':Sequelize[_0x6091('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6091('0x2')]},'ecm':{'type':Sequelize[_0x6091('0x3')]('yes','no'),'defaultValue':_0x6091('0x4')},'headerinfo':{'type':Sequelize[_0x6091('0x2')],'defaultValue':_0x6091('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x6091('0x6')},'minrate':{'type':Sequelize[_0x6091('0x3')](_0x6091('0x7'),_0x6091('0x8'),_0x6091('0x9'),_0x6091('0xa'),_0x6091('0xb'),_0x6091('0xc')),'defaultValue':_0x6091('0x8')},'maxrate':{'type':Sequelize[_0x6091('0x3')](_0x6091('0x7'),_0x6091('0x8'),_0x6091('0x9'),_0x6091('0xa'),_0x6091('0xb'),_0x6091('0xc')),'defaultValue':_0x6091('0xc')},'modem':{'type':Sequelize[_0x6091('0x2')],'defaultValue':_0x6091('0xd')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x6091('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x6091('0x3')]('SIP',_0x6091('0xf'),_0x6091('0x10'),_0x6091('0x11')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x6091('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6091('0x12')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x6091('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6091('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6091('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6091('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6091('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6091('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6091('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x6091('0x13')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3a5df9){if(!_0x3a5df9)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x6091('0x14')]('mandatoryDisposition',_0x3a5df9);}}}; \ No newline at end of file +var _0x29bd=['xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','14400','v17,v27,v29','INTEGER','SIP','IAX','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','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x29bd,0x199));var _0xd29b=function(_0x32a872,_0x1ce03a){_0x32a872=_0x32a872-0x0;var _0x26e4bc=_0x29bd[_0x32a872];return _0x26e4bc;};'use strict';var Sequelize=require(_0xd29b('0x0'));module[_0xd29b('0x1')]={'name':{'type':Sequelize[_0xd29b('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd29b('0x2')]},'ecm':{'type':Sequelize[_0xd29b('0x3')](_0xd29b('0x4'),'no'),'defaultValue':_0xd29b('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0xd29b('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0xd29b('0x6')},'minrate':{'type':Sequelize[_0xd29b('0x3')](_0xd29b('0x7'),_0xd29b('0x8'),_0xd29b('0x9'),'9600','12000',_0xd29b('0xa')),'defaultValue':_0xd29b('0x8')},'maxrate':{'type':Sequelize[_0xd29b('0x3')](_0xd29b('0x7'),'4800','7200','9600','12000',_0xd29b('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xd29b('0x2')],'defaultValue':_0xd29b('0xb')},'gateway':{'type':Sequelize[_0xd29b('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xd29b('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xd29b('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xd29b('0x3')](_0xd29b('0xd'),_0xd29b('0xe'),'DADHI','KHOMP'),'defaultValue':_0xd29b('0xd')},'key':{'type':Sequelize[_0xd29b('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xd29b('0xf')],'defaultValue':function(){return _0xd29b('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd29b('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd29b('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd29b('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd29b('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xd29b('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xd29b('0x11')],'defaultValue':![],'comment':_0xd29b('0x13'),'set':function(_0x23199f){if(!_0x23199f)this[_0xd29b('0x14')](_0xd29b('0x15'),null);this[_0xd29b('0x14')](_0xd29b('0x16'),_0x23199f);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 05b899b..c79bdd6 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 _0xed1f=['params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','FaxInteraction','addInteraction','CmContact','Contact','User','Owner','fullname','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','priority','getApplications','context','exten','app','system','description','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','omit','key','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','spread','out','ContactId','dataValues','SendFax','info','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','register','http','client','request','then','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','limit','set','json','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','show'];(function(_0x136320,_0x4e1dd6){var _0x4cb77c=function(_0x45aea8){while(--_0x45aea8){_0x136320['push'](_0x136320['shift']());}};_0x4cb77c(++_0x4e1dd6);}(_0xed1f,0x6a));var _0xfed1=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xed1f[_0x243b59];return _0x3e1676;};'use strict';var pdf=require(_0xfed1('0x0'));var emlformat=require(_0xfed1('0x1'));var rimraf=require(_0xfed1('0x2'));var zipdir=require(_0xfed1('0x3'));var jsonpatch=require(_0xfed1('0x4'));var rp=require(_0xfed1('0x5'));var moment=require(_0xfed1('0x6'));var BPromise=require(_0xfed1('0x7'));var Mustache=require(_0xfed1('0x8'));var util=require(_0xfed1('0x9'));var path=require(_0xfed1('0xa'));var sox=require(_0xfed1('0xb'));var csv=require(_0xfed1('0xc'));var ejs=require(_0xfed1('0xd'));var fs=require('fs');var _=require(_0xfed1('0xe'));var squel=require(_0xfed1('0xf'));var crypto=require(_0xfed1('0x10'));var jsforce=require(_0xfed1('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xfed1('0xc'));var querystring=require(_0xfed1('0x12'));var Papa=require('papaparse');var Redis=require(_0xfed1('0x13'));var authService=require(_0xfed1('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xfed1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfed1('0x16'))(_0xfed1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfed1('0x18'));var db=require(_0xfed1('0x19'))['db'];config['redis']=_[_0xfed1('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfed1('0x1b'))(new Redis(config[_0xfed1('0x1c')]));require('./faxAccount.socket')[_0xfed1('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xfed1('0x1e')]({'port':0x232c});var client9002=jayson[_0xfed1('0x1f')][_0xfed1('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x123c46,_0x582e67,_0x1a00f6,_0x4af928){return new BPromise(function(_0x36ff34,_0x29a32f){var _0x489a0f=_0x4af928||client;return _0x489a0f[_0xfed1('0x20')](_0x123c46,_0x1a00f6)[_0xfed1('0x21')](function(_0x5c0d9f){logger['info']('FaxAccount,\x20%s,\x20%s',_0x582e67,_0xfed1('0x22'));logger['debug'](_0xfed1('0x23'),_0x582e67,_0xfed1('0x22'),JSON['stringify'](_0x5c0d9f));if(_0x5c0d9f[_0xfed1('0x24')]){if(_0x5c0d9f[_0xfed1('0x24')]['code']===0x1f4){logger[_0xfed1('0x24')](_0xfed1('0x25'),_0x582e67,_0x5c0d9f[_0xfed1('0x24')][_0xfed1('0x26')]);return _0x29a32f(_0x5c0d9f['error'][_0xfed1('0x26')]);}logger['error'](_0xfed1('0x25'),_0x582e67,_0x5c0d9f[_0xfed1('0x24')][_0xfed1('0x26')]);return _0x36ff34(_0x5c0d9f['error'][_0xfed1('0x26')]);}else{logger['info'](_0xfed1('0x25'),_0x582e67,_0xfed1('0x22'));_0x36ff34(_0x5c0d9f[_0xfed1('0x27')][_0xfed1('0x26')]);}})[_0xfed1('0x28')](function(_0x1199b7){logger['error'](_0xfed1('0x25'),_0x582e67,_0x1199b7);_0x29a32f(_0x1199b7);});});}function respondWithStatusCode(_0xcb1cdc,_0x49072b){_0x49072b=_0x49072b||0xcc;return function(_0x1d6c72){if(_0x1d6c72){return _0xcb1cdc[_0xfed1('0x29')](_0x49072b);}return _0xcb1cdc[_0xfed1('0x2a')](_0x49072b)[_0xfed1('0x2b')]();};}function respondWithResult(_0x3b9122,_0x1761d1){_0x1761d1=_0x1761d1||0xc8;return function(_0x583953){if(_0x583953){return _0x3b9122[_0xfed1('0x2a')](_0x1761d1)['json'](_0x583953);}};}function respondWithFilteredResult(_0x3106ee,_0x4e5249){return function(_0x53b0c9){if(_0x53b0c9){var _0x1cec64=_0x53b0c9[_0xfed1('0x2c')],_0x42c950=_0x4e5249[_0xfed1('0x2d')],_0x2d334e=_0x4e5249[_0xfed1('0x2d')]+_0x4e5249[_0xfed1('0x2e')],_0x599c23;if(_0x2d334e>=_0x1cec64){_0x2d334e=_0x1cec64;_0x599c23=0xc8;}else{_0x599c23=0xce;}_0x3106ee[_0xfed1('0x2a')](_0x599c23);return _0x3106ee[_0xfed1('0x2f')]('Content-Range',_0x42c950+'-'+_0x2d334e+'/'+_0x1cec64)[_0xfed1('0x30')](_0x53b0c9);}return null;};}function patchUpdates(_0x16ca13){return function(_0x4fc309){try{jsonpatch['apply'](_0x4fc309,_0x16ca13,!![]);}catch(_0x28bd98){return BPromise[_0xfed1('0x31')](_0x28bd98);}return _0x4fc309[_0xfed1('0x32')]();};}function saveUpdates(_0x71147f,_0x44c24a){return function(_0x57ca74){if(_0x57ca74){return _0x57ca74[_0xfed1('0x33')](_0x71147f)[_0xfed1('0x21')](function(_0x10143b){return _0x10143b;});}return null;};}function removeEntity(_0x349de1,_0xa4c53c){return function(_0x4fde94){if(_0x4fde94){return _0x4fde94[_0xfed1('0x34')]()['then'](function(){var _0x11c5bd=_0x4fde94[_0xfed1('0x35')]({'plain':!![]});var _0x17554f=_0xfed1('0x36');return db[_0xfed1('0x37')][_0xfed1('0x34')]({'where':{'type':_0x17554f,'resourceId':_0x11c5bd['id']}})[_0xfed1('0x21')](function(){return _0x4fde94;});})[_0xfed1('0x21')](function(){_0x349de1['status'](0xcc)[_0xfed1('0x2b')]();});}};}function handleEntityNotFound(_0x46268a,_0x45f106){return function(_0x28adfc){if(!_0x28adfc){_0x46268a['sendStatus'](0x194);}return _0x28adfc;};}function handleError(_0x4b1d7b,_0x42d5df){_0x42d5df=_0x42d5df||0x1f4;return function(_0x3c026d){logger[_0xfed1('0x24')](_0x3c026d[_0xfed1('0x38')]);if(_0x3c026d[_0xfed1('0x39')]){delete _0x3c026d[_0xfed1('0x39')];}_0x4b1d7b[_0xfed1('0x2a')](_0x42d5df)[_0xfed1('0x3a')](_0x3c026d);};}exports['index']=function(_0x52c7b8,_0x23f75f){var _0x2f6250={'include':[{'model':db[_0xfed1('0x3b')],'as':_0xfed1('0x3c')}]},_0x5f599f={},_0x1dae7c={'count':0x0,'rows':[]};var _0x421620=_[_0xfed1('0x3d')](db[_0xfed1('0x3e')][_0xfed1('0x3f')],function(_0x4118d4){return{'name':_0x4118d4[_0xfed1('0x40')],'type':_0x4118d4['type']['key']};});_0x5f599f['model']=_[_0xfed1('0x3d')](_0x421620,_0xfed1('0x39'));_0x5f599f[_0xfed1('0x41')]=_['keys'](_0x52c7b8[_0xfed1('0x41')]);_0x5f599f['filters']=_[_0xfed1('0x42')](_0x5f599f[_0xfed1('0x43')],_0x5f599f[_0xfed1('0x41')]);_0x2f6250['attributes']=_[_0xfed1('0x42')](_0x5f599f[_0xfed1('0x43')],qs[_0xfed1('0x44')](_0x52c7b8['query'][_0xfed1('0x44')]));_0x2f6250['attributes']=_0x2f6250[_0xfed1('0x45')][_0xfed1('0x46')]?_0x2f6250[_0xfed1('0x45')]:_0x5f599f[_0xfed1('0x43')];if(!_0x52c7b8[_0xfed1('0x41')][_0xfed1('0x47')](_0xfed1('0x48'))){_0x2f6250[_0xfed1('0x2e')]=qs[_0xfed1('0x2e')](_0x52c7b8['query'][_0xfed1('0x2e')]);_0x2f6250[_0xfed1('0x2d')]=qs[_0xfed1('0x2d')](_0x52c7b8['query']['offset']);}_0x2f6250[_0xfed1('0x49')]=qs[_0xfed1('0x4a')](_0x52c7b8[_0xfed1('0x41')][_0xfed1('0x4a')]);_0x2f6250[_0xfed1('0x4b')]=qs[_0xfed1('0x4c')](_[_0xfed1('0x4d')](_0x52c7b8[_0xfed1('0x41')],_0x5f599f[_0xfed1('0x4c')]),_0x421620);if(_0x52c7b8[_0xfed1('0x41')][_0xfed1('0x4e')]){_0x2f6250[_0xfed1('0x4b')]=_['merge'](_0x2f6250[_0xfed1('0x4b')],{'$or':_[_0xfed1('0x3d')](_0x421620,function(_0x280d6e){if(_0x280d6e[_0xfed1('0x4f')]!==_0xfed1('0x50')){var _0x1e4781={};_0x1e4781[_0x280d6e['name']]={'$like':'%'+_0x52c7b8[_0xfed1('0x41')][_0xfed1('0x4e')]+'%'};return _0x1e4781;}})});}_0x2f6250=_[_0xfed1('0x51')]({},_0x2f6250,_0x52c7b8['options']);var _0x22874a={'where':_0x2f6250[_0xfed1('0x4b')]};return db[_0xfed1('0x3e')][_0xfed1('0x2c')](_0x22874a)['then'](function(_0x2e0de7){_0x1dae7c[_0xfed1('0x2c')]=_0x2e0de7;if(_0x52c7b8[_0xfed1('0x41')][_0xfed1('0x52')]){_0x2f6250[_0xfed1('0x53')]=[{'all':!![]}];}return db[_0xfed1('0x3e')][_0xfed1('0x54')](_0x2f6250);})[_0xfed1('0x21')](function(_0x2365db){_0x1dae7c[_0xfed1('0x55')]=_0x2365db;return _0x1dae7c;})[_0xfed1('0x21')](respondWithFilteredResult(_0x23f75f,_0x2f6250))[_0xfed1('0x28')](handleError(_0x23f75f,null));};exports[_0xfed1('0x56')]=function(_0x20c493,_0x33c77a){var _0x37418b={'raw':![],'where':{'id':_0x20c493[_0xfed1('0x57')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xd1f984={};_0xd1f984[_0xfed1('0x43')]=_[_0xfed1('0x58')](db[_0xfed1('0x3e')][_0xfed1('0x3f')]);_0xd1f984['query']=_[_0xfed1('0x58')](_0x20c493[_0xfed1('0x41')]);_0xd1f984['filters']=_['intersection'](_0xd1f984['model'],_0xd1f984[_0xfed1('0x41')]);_0x37418b[_0xfed1('0x45')]=_[_0xfed1('0x42')](_0xd1f984[_0xfed1('0x43')],qs[_0xfed1('0x44')](_0x20c493[_0xfed1('0x41')][_0xfed1('0x44')]));_0x37418b[_0xfed1('0x45')]=_0x37418b[_0xfed1('0x45')][_0xfed1('0x46')]?_0x37418b['attributes']:_0xd1f984['model'];if(_0x20c493[_0xfed1('0x41')][_0xfed1('0x52')]){_0x37418b[_0xfed1('0x53')]=[{'all':!![]}];}_0x37418b=_[_0xfed1('0x51')]({},_0x37418b,_0x20c493[_0xfed1('0x59')]);return db[_0xfed1('0x3e')][_0xfed1('0x5a')](_0x37418b)[_0xfed1('0x21')](handleEntityNotFound(_0x33c77a,null))[_0xfed1('0x21')](respondWithResult(_0x33c77a,null))[_0xfed1('0x28')](handleError(_0x33c77a,null));};exports[_0xfed1('0x5b')]=function(_0x103492,_0x430d71){return db[_0xfed1('0x3e')][_0xfed1('0x5b')](_0x103492[_0xfed1('0x5c')],{})[_0xfed1('0x21')](function(_0x54eb53){var _0x5b167b=_0x103492[_0xfed1('0x5d')][_0xfed1('0x35')]({'plain':!![]});if(!_0x5b167b)throw new Error(_0xfed1('0x5e'));if(_0x5b167b[_0xfed1('0x5f')]===_0xfed1('0x5d')){var _0x41a22a=_0x54eb53[_0xfed1('0x35')]({'plain':!![]});var _0xea879f=_0xfed1('0x36');return db[_0xfed1('0x60')][_0xfed1('0x5a')]({'where':{'name':_0xea879f,'userProfileId':_0x5b167b[_0xfed1('0x61')]},'raw':!![]})[_0xfed1('0x21')](function(_0x1a8ebe){if(_0x1a8ebe&&_0x1a8ebe['autoAssociation']===0x0){return db[_0xfed1('0x37')]['create']({'name':_0x41a22a['name'],'resourceId':_0x41a22a['id'],'type':_0x1a8ebe[_0xfed1('0x39')],'sectionId':_0x1a8ebe['id']},{})['then'](function(){return _0x54eb53;});}else{return _0x54eb53;}})[_0xfed1('0x28')](function(_0x5acc45){logger[_0xfed1('0x24')](_0xfed1('0x62'),_0x5acc45);throw _0x5acc45;});}return _0x54eb53;})['then'](respondWithResult(_0x430d71,0xc9))[_0xfed1('0x28')](handleError(_0x430d71,null));};exports[_0xfed1('0x33')]=function(_0x502ebb,_0x29b51e){if(_0x502ebb[_0xfed1('0x5c')]['id']){delete _0x502ebb[_0xfed1('0x5c')]['id'];}return db[_0xfed1('0x3e')]['find']({'where':{'id':_0x502ebb[_0xfed1('0x57')]['id']},'include':[{'model':db[_0xfed1('0x3b')],'as':_0xfed1('0x3c')}]})[_0xfed1('0x21')](handleEntityNotFound(_0x29b51e,null))[_0xfed1('0x21')](saveUpdates(_0x502ebb[_0xfed1('0x5c')],null))[_0xfed1('0x21')](respondWithResult(_0x29b51e,null))[_0xfed1('0x28')](handleError(_0x29b51e,null));};exports['destroy']=function(_0x2d66ec,_0x400520){return db[_0xfed1('0x3e')][_0xfed1('0x5a')]({'where':{'id':_0x2d66ec[_0xfed1('0x57')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x400520,null))['then'](removeEntity(_0x400520,null))['catch'](handleError(_0x400520,null));};exports['describe']=function(_0x33a479,_0x364fbd){return db[_0xfed1('0x3e')][_0xfed1('0x63')]()['then'](respondWithResult(_0x364fbd,null))[_0xfed1('0x28')](handleError(_0x364fbd,null));};exports['addDisposition']=function(_0x3747cd,_0xb399aa,_0x18af7d){if(_0x3747cd[_0xfed1('0x5c')]['id']){delete _0x3747cd[_0xfed1('0x5c')]['id'];}return db['FaxAccount'][_0xfed1('0x5a')]({'where':{'id':_0x3747cd[_0xfed1('0x57')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0xb399aa,null))['then'](function(_0x40d25d){if(_0x40d25d){_0x3747cd[_0xfed1('0x5c')][_0xfed1('0x64')]=_0x40d25d['id'];return db[_0xfed1('0x65')]['create'](_0x3747cd[_0xfed1('0x5c')]);}})['then'](respondWithResult(_0xb399aa,null))[_0xfed1('0x28')](handleError(_0xb399aa,null));};exports[_0xfed1('0x66')]=function(_0x4b685b,_0x480c52,_0x43b172){var _0x340ba3={'raw':![],'where':{}};var _0x1dc791={};var _0x2ee25f={'count':0x0,'rows':[]};return db['FaxAccount'][_0xfed1('0x67')]({'where':{'id':_0x4b685b[_0xfed1('0x57')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x480c52,null))[_0xfed1('0x21')](function(_0x6f174e){if(_0x6f174e){_0x1dc791[_0xfed1('0x43')]=_['keys'](db[_0xfed1('0x65')][_0xfed1('0x3f')]);_0x1dc791['query']=_[_0xfed1('0x58')](_0x4b685b[_0xfed1('0x41')]);_0x1dc791[_0xfed1('0x4c')]=_[_0xfed1('0x42')](_0x1dc791[_0xfed1('0x43')],_0x1dc791[_0xfed1('0x41')]);_0x340ba3['attributes']=_['intersection'](_0x1dc791[_0xfed1('0x43')],qs['fields'](_0x4b685b[_0xfed1('0x41')][_0xfed1('0x44')]));_0x340ba3[_0xfed1('0x45')]=_0x340ba3[_0xfed1('0x45')][_0xfed1('0x46')]?_0x340ba3[_0xfed1('0x45')]:_0x1dc791[_0xfed1('0x43')];if(!_0x4b685b[_0xfed1('0x41')][_0xfed1('0x47')](_0xfed1('0x48'))){_0x340ba3['limit']=qs[_0xfed1('0x2e')](_0x4b685b[_0xfed1('0x41')]['limit']);_0x340ba3['offset']=qs[_0xfed1('0x2d')](_0x4b685b['query'][_0xfed1('0x2d')]);}_0x340ba3[_0xfed1('0x49')]=qs[_0xfed1('0x4a')](_0x4b685b['query'][_0xfed1('0x4a')]);_0x340ba3[_0xfed1('0x4b')]=qs[_0xfed1('0x4c')](_[_0xfed1('0x4d')](_0x4b685b[_0xfed1('0x41')],_0x1dc791['filters']));_0x340ba3[_0xfed1('0x4b')][_0xfed1('0x64')]=_0x6f174e['id'];if(_0x4b685b[_0xfed1('0x41')][_0xfed1('0x4e')]){_0x340ba3[_0xfed1('0x4b')]=_['merge'](_0x340ba3[_0xfed1('0x4b')],{'$or':_[_0xfed1('0x3d')](_0x340ba3[_0xfed1('0x45')],function(_0x413c53){var _0x2dcadd={};_0x2dcadd[_0x413c53]={'$like':'%'+_0x4b685b[_0xfed1('0x41')][_0xfed1('0x4e')]+'%'};return _0x2dcadd;})});}_0x340ba3=_[_0xfed1('0x51')]({},_0x340ba3,_0x4b685b[_0xfed1('0x59')]);return db[_0xfed1('0x65')]['count']({'where':_0x340ba3[_0xfed1('0x4b')]})[_0xfed1('0x21')](function(_0x248bae){_0x2ee25f[_0xfed1('0x2c')]=_0x248bae;if(_0x4b685b[_0xfed1('0x41')]['includeAll']){_0x340ba3[_0xfed1('0x53')]=[{'all':!![]}];}return db[_0xfed1('0x65')][_0xfed1('0x54')](_0x340ba3);})[_0xfed1('0x21')](function(_0x221ed8){_0x2ee25f[_0xfed1('0x55')]=_0x221ed8;return _0x2ee25f;});}})[_0xfed1('0x21')](respondWithFilteredResult(_0x480c52,_0x340ba3))[_0xfed1('0x28')](handleError(_0x480c52,null));};exports[_0xfed1('0x68')]=function(_0x59a736,_0x5188f8,_0xc3b72a){return db['FaxAccount'][_0xfed1('0x5a')]({'where':{'id':_0x59a736[_0xfed1('0x57')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x5188f8,null))['then'](function(_0x5ce292){if(_0x5ce292){return _0x5ce292[_0xfed1('0x68')](_0x59a736['query'][_0xfed1('0x69')]);}})['then'](respondWithStatusCode(_0x5188f8,null))[_0xfed1('0x28')](handleError(_0x5188f8,null));};exports[_0xfed1('0x6a')]=function(_0x112ed5,_0x17ccc6,_0x3c6ddd){if(_0x112ed5['body']['id']){delete _0x112ed5[_0xfed1('0x5c')]['id'];}return db[_0xfed1('0x3e')]['find']({'where':{'id':_0x112ed5[_0xfed1('0x57')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x17ccc6,null))['then'](function(_0x12ce90){if(_0x12ce90){_0x112ed5[_0xfed1('0x5c')][_0xfed1('0x64')]=_0x12ce90['id'];return db['CannedAnswer'][_0xfed1('0x5b')](_0x112ed5[_0xfed1('0x5c')]);}})['then'](respondWithResult(_0x17ccc6,null))[_0xfed1('0x28')](handleError(_0x17ccc6,null));};exports[_0xfed1('0x6b')]=function(_0x44d1fc,_0x4ea8bd,_0xd14bd0){var _0x36d7de={'raw':![],'where':{}};var _0x49f600={};var _0x48172c={'count':0x0,'rows':[]};return db[_0xfed1('0x3e')][_0xfed1('0x67')]({'where':{'id':_0x44d1fc[_0xfed1('0x57')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x4ea8bd,null))[_0xfed1('0x21')](function(_0x23efe3){if(_0x23efe3){_0x49f600[_0xfed1('0x43')]=_[_0xfed1('0x58')](db[_0xfed1('0x6c')][_0xfed1('0x3f')]);_0x49f600[_0xfed1('0x41')]=_[_0xfed1('0x58')](_0x44d1fc['query']);_0x49f600[_0xfed1('0x4c')]=_[_0xfed1('0x42')](_0x49f600['model'],_0x49f600[_0xfed1('0x41')]);_0x36d7de[_0xfed1('0x45')]=_['intersection'](_0x49f600[_0xfed1('0x43')],qs[_0xfed1('0x44')](_0x44d1fc[_0xfed1('0x41')][_0xfed1('0x44')]));_0x36d7de['attributes']=_0x36d7de[_0xfed1('0x45')][_0xfed1('0x46')]?_0x36d7de[_0xfed1('0x45')]:_0x49f600[_0xfed1('0x43')];if(!_0x44d1fc[_0xfed1('0x41')][_0xfed1('0x47')](_0xfed1('0x48'))){_0x36d7de[_0xfed1('0x2e')]=qs['limit'](_0x44d1fc[_0xfed1('0x41')][_0xfed1('0x2e')]);_0x36d7de[_0xfed1('0x2d')]=qs['offset'](_0x44d1fc[_0xfed1('0x41')][_0xfed1('0x2d')]);}_0x36d7de[_0xfed1('0x49')]=qs['sort'](_0x44d1fc['query'][_0xfed1('0x4a')]);_0x36d7de[_0xfed1('0x4b')]=qs[_0xfed1('0x4c')](_[_0xfed1('0x4d')](_0x44d1fc[_0xfed1('0x41')],_0x49f600[_0xfed1('0x4c')]));_0x36d7de[_0xfed1('0x4b')][_0xfed1('0x64')]=_0x23efe3['id'];if(_0x44d1fc[_0xfed1('0x41')][_0xfed1('0x4e')]){_0x36d7de[_0xfed1('0x4b')]=_[_0xfed1('0x51')](_0x36d7de[_0xfed1('0x4b')],{'$or':_[_0xfed1('0x3d')](_0x36d7de[_0xfed1('0x45')],function(_0x5bcc5f){var _0x241156={};_0x241156[_0x5bcc5f]={'$like':'%'+_0x44d1fc[_0xfed1('0x41')][_0xfed1('0x4e')]+'%'};return _0x241156;})});}_0x36d7de=_[_0xfed1('0x51')]({},_0x36d7de,_0x44d1fc['options']);return db[_0xfed1('0x6c')][_0xfed1('0x2c')]({'where':_0x36d7de[_0xfed1('0x4b')]})['then'](function(_0x23447c){_0x48172c[_0xfed1('0x2c')]=_0x23447c;if(_0x44d1fc[_0xfed1('0x41')][_0xfed1('0x52')]){_0x36d7de[_0xfed1('0x53')]=[{'all':!![]}];}return db[_0xfed1('0x6c')][_0xfed1('0x54')](_0x36d7de);})['then'](function(_0x56b69d){_0x48172c[_0xfed1('0x55')]=_0x56b69d;return _0x48172c;});}})[_0xfed1('0x21')](respondWithFilteredResult(_0x4ea8bd,_0x36d7de))[_0xfed1('0x28')](handleError(_0x4ea8bd,null));};exports['removeAnswers']=function(_0x552be6,_0x2f14e8,_0x1a158b){return db['FaxAccount'][_0xfed1('0x5a')]({'where':{'id':_0x552be6[_0xfed1('0x57')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x2f14e8,null))[_0xfed1('0x21')](function(_0x3b5381){if(_0x3b5381){return _0x3b5381['removeAnswers'](_0x552be6['query'][_0xfed1('0x69')]);}})[_0xfed1('0x21')](respondWithStatusCode(_0x2f14e8,null))['catch'](handleError(_0x2f14e8,null));};exports['addInteraction']=function(_0x17c0d0,_0x145d60,_0xb1ec32){return db[_0xfed1('0x6d')][_0xfed1('0x5a')]({'where':{'id':_0x17c0d0[_0xfed1('0x57')]['id']}})['then'](handleEntityNotFound(_0x145d60,null))[_0xfed1('0x21')](function(_0x42884f){if(_0x42884f){return _0x42884f[_0xfed1('0x6e')](_0x17c0d0[_0xfed1('0x5c')][_0xfed1('0x69')],_['omit'](_0x17c0d0[_0xfed1('0x5c')],['ids','id'])||{});}})[_0xfed1('0x21')](respondWithResult(_0x145d60,null))['catch'](handleError(_0x145d60,null));};exports['getInteractions']=function(_0x5d6b5a,_0x538112,_0x98b720){var _0x33228b={'raw':![],'where':{}};var _0x3444f6={};var _0x577159={'count':0x0,'rows':[]};return db[_0xfed1('0x3e')][_0xfed1('0x67')]({'where':{'id':_0x5d6b5a[_0xfed1('0x57')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x538112,null))[_0xfed1('0x21')](function(_0x2cfe0a){if(_0x2cfe0a){_0x3444f6['model']=_[_0xfed1('0x58')](db[_0xfed1('0x6d')][_0xfed1('0x3f')]);_0x3444f6[_0xfed1('0x41')]=_[_0xfed1('0x58')](_0x5d6b5a[_0xfed1('0x41')]);_0x3444f6[_0xfed1('0x4c')]=_['intersection'](_0x3444f6[_0xfed1('0x43')],_0x3444f6[_0xfed1('0x41')]);_0x33228b[_0xfed1('0x45')]=_[_0xfed1('0x42')](_0x3444f6[_0xfed1('0x43')],qs['fields'](_0x5d6b5a[_0xfed1('0x41')][_0xfed1('0x44')]));_0x33228b[_0xfed1('0x45')]=_0x33228b[_0xfed1('0x45')][_0xfed1('0x46')]?_0x33228b['attributes']:_0x3444f6[_0xfed1('0x43')];if(!_0x5d6b5a[_0xfed1('0x41')]['hasOwnProperty'](_0xfed1('0x48'))){_0x33228b[_0xfed1('0x2e')]=qs[_0xfed1('0x2e')](_0x5d6b5a[_0xfed1('0x41')][_0xfed1('0x2e')]);_0x33228b['offset']=qs[_0xfed1('0x2d')](_0x5d6b5a[_0xfed1('0x41')][_0xfed1('0x2d')]);}_0x33228b[_0xfed1('0x49')]=qs[_0xfed1('0x4a')](_0x5d6b5a[_0xfed1('0x41')][_0xfed1('0x4a')]);_0x33228b[_0xfed1('0x4b')]=qs['filters'](_[_0xfed1('0x4d')](_0x5d6b5a[_0xfed1('0x41')],_0x3444f6[_0xfed1('0x4c')]));_0x33228b['where'][_0xfed1('0x64')]=_0x2cfe0a['id'];if(_0x5d6b5a[_0xfed1('0x41')][_0xfed1('0x4e')]){_0x33228b[_0xfed1('0x4b')]=_[_0xfed1('0x51')](_0x33228b[_0xfed1('0x4b')],{'$or':_['map'](_0x33228b[_0xfed1('0x45')],function(_0x2a7b0e){var _0x304baf={};_0x304baf[_0x2a7b0e]={'$like':'%'+_0x5d6b5a[_0xfed1('0x41')][_0xfed1('0x4e')]+'%'};return _0x304baf;})});}_0x33228b=_[_0xfed1('0x51')]({},_0x33228b,_0x5d6b5a['options']);return db[_0xfed1('0x6d')][_0xfed1('0x2c')]({'where':_0x33228b['where']})[_0xfed1('0x21')](function(_0x3471d1){_0x577159[_0xfed1('0x2c')]=_0x3471d1;if(_0x5d6b5a[_0xfed1('0x41')]['includeAll']){_0x33228b[_0xfed1('0x53')]=[{'model':db[_0xfed1('0x6f')],'as':_0xfed1('0x70'),'required':![]},{'model':db[_0xfed1('0x71')],'as':_0xfed1('0x72'),'attributes':[_0xfed1('0x39'),_0xfed1('0x73'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xfed1('0x74'),'attributes':['id',_0xfed1('0x39'),_0xfed1('0x75')],'where':_0x5d6b5a['query'][_0xfed1('0x76')]?{'id':_0x5d6b5a['query'][_0xfed1('0x76')]}:undefined,'required':_0x5d6b5a[_0xfed1('0x41')][_0xfed1('0x76')]?!![]:![]}];}return db[_0xfed1('0x6d')][_0xfed1('0x54')](_0x33228b);})['then'](function(_0x3d9c3c){_0x577159[_0xfed1('0x55')]=_0x3d9c3c;return _0x577159;});}})[_0xfed1('0x21')](respondWithFilteredResult(_0x538112,_0x33228b))[_0xfed1('0x28')](handleError(_0x538112,null));};exports[_0xfed1('0x77')]=function(_0x29ae92,_0x1b1f3a,_0x4ad11d){return db[_0xfed1('0x3e')]['findOne']({'where':{'id':_0x29ae92[_0xfed1('0x57')]['id']}})['then'](handleEntityNotFound(_0x1b1f3a,null))[_0xfed1('0x21')](function(_0x485aec){if(_0x485aec){return db[_0xfed1('0x78')][_0xfed1('0x79')](function(_0x25ecb6){return db[_0xfed1('0x7a')]['destroy']({'where':{'FaxAccountId':_0x29ae92[_0xfed1('0x57')]['id']},'transaction':_0x25ecb6})[_0xfed1('0x21')](function(_0x4a2587){var _0x5d7b2c=_[_0xfed1('0x3d')](_0x29ae92[_0xfed1('0x5c')],function(_0x5d9d44){_0x5d9d44[_0xfed1('0x64')]=_0x29ae92[_0xfed1('0x57')]['id'];return _0x5d9d44;});return db[_0xfed1('0x7a')][_0xfed1('0x7b')](_0x5d7b2c,{'transaction':_0x25ecb6});});})[_0xfed1('0x21')](function(){return db[_0xfed1('0x7a')]['findAndCountAll']({'where':{'FaxAccountId':_0x29ae92[_0xfed1('0x57')]['id']},'order':_0xfed1('0x7c')});});}})['then'](respondWithResult(_0x1b1f3a,null))[_0xfed1('0x28')](handleError(_0x1b1f3a,null));};exports['getApplications']=function(_0x32ee9b,_0x2f81e7,_0x2f06dd){var _0x2b6645={};var _0x4abcca={};var _0x31a881;var _0x851081;return db[_0xfed1('0x3e')][_0xfed1('0x67')]({'where':{'id':_0x32ee9b[_0xfed1('0x57')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x2f81e7,null))[_0xfed1('0x21')](function(_0x4f9066){if(_0x4f9066){_0x31a881=_0x4f9066;_0x4abcca[_0xfed1('0x43')]=_[_0xfed1('0x58')](db[_0xfed1('0x7a')][_0xfed1('0x3f')]);_0x4abcca[_0xfed1('0x41')]=_[_0xfed1('0x58')](_0x32ee9b[_0xfed1('0x41')]);_0x4abcca['filters']=_[_0xfed1('0x42')](_0x4abcca[_0xfed1('0x43')],_0x4abcca[_0xfed1('0x41')]);_0x2b6645[_0xfed1('0x45')]=_[_0xfed1('0x42')](_0x4abcca[_0xfed1('0x43')],qs['fields'](_0x32ee9b[_0xfed1('0x41')]['fields']));_0x2b6645[_0xfed1('0x45')]=_0x2b6645[_0xfed1('0x45')][_0xfed1('0x46')]?_0x2b6645[_0xfed1('0x45')]:_0x4abcca[_0xfed1('0x43')];_0x2b6645[_0xfed1('0x49')]=qs[_0xfed1('0x4a')](_0x32ee9b[_0xfed1('0x41')][_0xfed1('0x4a')]);_0x2b6645[_0xfed1('0x4b')]=qs[_0xfed1('0x4c')](_[_0xfed1('0x4d')](_0x32ee9b['query'],_0x4abcca[_0xfed1('0x4c')]));if(_0x32ee9b[_0xfed1('0x41')][_0xfed1('0x4e')]){_0x2b6645['where']=_[_0xfed1('0x51')](_0x2b6645['where'],{'$or':_[_0xfed1('0x3d')](_0x2b6645[_0xfed1('0x45')],function(_0x426927){var _0x54099f={};_0x54099f[_0x426927]={'$like':'%'+_0x32ee9b[_0xfed1('0x41')][_0xfed1('0x4e')]+'%'};return _0x54099f;})});}_0x2b6645=_[_0xfed1('0x51')]({},_0x2b6645,_0x32ee9b[_0xfed1('0x59')]);return _0x31a881[_0xfed1('0x7d')](_0x2b6645);}})[_0xfed1('0x21')](function(_0x44ed12){if(_0x44ed12){_0x851081=_0x44ed12[_0xfed1('0x46')];if(!_0x32ee9b[_0xfed1('0x41')][_0xfed1('0x47')](_0xfed1('0x48'))){_0x2b6645[_0xfed1('0x2e')]=qs['limit'](_0x32ee9b[_0xfed1('0x41')][_0xfed1('0x2e')]);_0x2b6645[_0xfed1('0x2d')]=qs[_0xfed1('0x2d')](_0x32ee9b[_0xfed1('0x41')][_0xfed1('0x2d')]);}return _0x31a881[_0xfed1('0x7d')](_0x2b6645);}})[_0xfed1('0x21')](function(_0x3b6ced){if(_0x3b6ced){return _0x3b6ced?{'count':_0x851081,'rows':_0x3b6ced}:null;}})[_0xfed1('0x21')](respondWithResult(_0x2f81e7,null))[_0xfed1('0x28')](handleError(_0x2f81e7,null));};function Extension(_0x5b345d,_0x466167,_0x150b4f,_0x8f20f3){this[_0xfed1('0x7e')]='from-voip-provider';this[_0xfed1('0x7f')]=_0x5b345d['localstationid'];this[_0xfed1('0x80')]=_0x8f20f3;this['type']=_0xfed1('0x81');this[_0xfed1('0x82')]='Fax\x20Extension';this[_0xfed1('0x64')]=_0x5b345d['id'];this['priority']=_0x466167;this[_0xfed1('0x83')]=_0x150b4f;}function createExtensionsReciveFax(_0x231b03){var _0xfcdfa=0x1;var _0x2faeaf=[];_0x2faeaf[_0xfed1('0x84')](new Extension(_0x231b03,_0xfcdfa,'',_0xfed1('0x85')));_0xfcdfa+=0x1;_0x2faeaf[_0xfed1('0x84')](new Extension(_0x231b03,_0xfcdfa,_0xfed1('0x86'),_0xfed1('0x87')));_0xfcdfa+=0x1;for(var _0x57e3e1 in _0x231b03){if(_0x231b03[_0xfed1('0x47')](_0x57e3e1)&&(_0x57e3e1===_0xfed1('0x88')||_0x57e3e1==='localstationid'||_0x57e3e1===_0xfed1('0x89')||_0x57e3e1===_0xfed1('0x8a')||_0x57e3e1===_0xfed1('0x8b')||_0x57e3e1===_0xfed1('0x8c')||_0x57e3e1===_0xfed1('0x8d')||_0x57e3e1===_0xfed1('0x8e')||_0x57e3e1==='t38timeout')){_0x2faeaf['push'](new Extension(_0x231b03,_0xfcdfa,'FAXOPT('+_0x57e3e1+')='+_0x231b03[_0x57e3e1],_0xfed1('0x87')));_0xfcdfa+=0x1;}}_0x2faeaf[_0xfed1('0x84')](new Extension(_0x231b03,_0xfcdfa,'6',_0xfed1('0x8f')));_0xfcdfa+=0x1;_0x2faeaf[_0xfed1('0x84')](new Extension(_0x231b03,_0xfcdfa,_0xfed1('0x90'),_0xfed1('0x91')));_0xfcdfa=0x0;return _0x2faeaf;}exports[_0xfed1('0x92')]=function(_0x5350f4,_0x1bf70b,_0x4432c){var _0x547dcb;return db['sequelize'][_0xfed1('0x79')](function(_0x66b445){return db[_0xfed1('0x3e')][_0xfed1('0x5b')](_0x5350f4[_0xfed1('0x5c')],{'transaction':_0x66b445})[_0xfed1('0x21')](function(_0x2ec39a){_0x547dcb=_0x2ec39a['get']({'plain':!![]});return db[_0xfed1('0x93')][_0xfed1('0x7b')](createExtensionsReciveFax(_0x547dcb),{'transaction':_0x66b445});});})[_0xfed1('0x21')](function(){return _0x547dcb;})[_0xfed1('0x21')](respondWithResult(_0x1bf70b,null))['catch'](handleError(_0x1bf70b,null));};exports[_0xfed1('0x94')]=function(_0x2fc8ea,_0x1df835,_0x69ce10){var _0x287c37;return db[_0xfed1('0x78')][_0xfed1('0x79')](function(_0x5ea156){return db[_0xfed1('0x3e')][_0xfed1('0x33')](_0x2fc8ea[_0xfed1('0x5c')],{'where':{'id':_0x2fc8ea[_0xfed1('0x5c')]['id']},'transaction':_0x5ea156})[_0xfed1('0x21')](function(_0x4a4bb8){return db[_0xfed1('0x93')][_0xfed1('0x34')]({'where':{'FaxAccountId':_0x2fc8ea['body']['id']},'transaction':_0x5ea156})[_0xfed1('0x21')](function(_0x5d8612){return db[_0xfed1('0x93')][_0xfed1('0x7b')](createExtensionsReciveFax(_[_0xfed1('0x95')](_0x2fc8ea[_0xfed1('0x5c')],['tech',_0xfed1('0x96'),_0xfed1('0x97'),_0xfed1('0x98'),_0xfed1('0x99'),_0xfed1('0x9a')])),{'transaction':_0x5ea156});});});})['then'](function(){return db[_0xfed1('0x3e')][_0xfed1('0x9b')](_0x2fc8ea[_0xfed1('0x5c')]['id']);})[_0xfed1('0x21')](respondWithResult(_0x1df835,null))[_0xfed1('0x28')](handleError(_0x1df835,null));};exports[_0xfed1('0x9c')]=function(_0x4fc52c,_0x29097d,_0x150457){var _0x35e4eb={'raw':!![],'where':{}};var _0x4da7b5={};var _0x4af132={'count':0x0,'rows':[]};return db[_0xfed1('0x3e')]['findOne']({'where':{'id':_0x4fc52c['params']['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x29097d,null))[_0xfed1('0x21')](function(_0x1a74fb){if(_0x1a74fb){_0x4da7b5[_0xfed1('0x43')]=_[_0xfed1('0x58')](db['FaxMessage'][_0xfed1('0x3f')]);_0x4da7b5[_0xfed1('0x41')]=_[_0xfed1('0x58')](_0x4fc52c[_0xfed1('0x41')]);_0x4da7b5[_0xfed1('0x4c')]=_[_0xfed1('0x42')](_0x4da7b5[_0xfed1('0x43')],_0x4da7b5[_0xfed1('0x41')]);_0x35e4eb[_0xfed1('0x45')]=_[_0xfed1('0x42')](_0x4da7b5[_0xfed1('0x43')],qs[_0xfed1('0x44')](_0x4fc52c[_0xfed1('0x41')][_0xfed1('0x44')]));_0x35e4eb[_0xfed1('0x45')]=_0x35e4eb[_0xfed1('0x45')][_0xfed1('0x46')]?_0x35e4eb[_0xfed1('0x45')]:_0x4da7b5[_0xfed1('0x43')];if(!_0x4fc52c['query'][_0xfed1('0x47')]('nolimit')){_0x35e4eb['limit']=qs[_0xfed1('0x2e')](_0x4fc52c[_0xfed1('0x41')]['limit']);_0x35e4eb[_0xfed1('0x2d')]=qs['offset'](_0x4fc52c['query'][_0xfed1('0x2d')]);}_0x35e4eb[_0xfed1('0x49')]=qs[_0xfed1('0x4a')](_0x4fc52c['query']['sort']);_0x35e4eb['where']=qs[_0xfed1('0x4c')](_[_0xfed1('0x4d')](_0x4fc52c[_0xfed1('0x41')],_0x4da7b5[_0xfed1('0x4c')]));_0x35e4eb[_0xfed1('0x4b')]['FaxAccountId']=_0x1a74fb['id'];if(_0x4fc52c['query'][_0xfed1('0x4e')]){_0x35e4eb['where']=_['merge'](_0x35e4eb[_0xfed1('0x4b')],{'$or':_[_0xfed1('0x3d')](_0x35e4eb[_0xfed1('0x45')],function(_0x1f2a56){var _0x5582dc={};_0x5582dc[_0x1f2a56]={'$like':'%'+_0x4fc52c[_0xfed1('0x41')][_0xfed1('0x4e')]+'%'};return _0x5582dc;})});}if(_0x4fc52c[_0xfed1('0x41')]['$gte']){var _0x8a9aa=_0x4fc52c[_0xfed1('0x41')][_0xfed1('0x9d')][_0xfed1('0x9e')](',');var _0x3a9016={};_0x3a9016[_0x8a9aa[0x0]]={'$gte':moment(_0x8a9aa[0x1])['format'](_0xfed1('0x9f'))};_0x35e4eb[_0xfed1('0x4b')]=_['merge'](_0x35e4eb[_0xfed1('0x4b')],_0x3a9016);}_0x35e4eb=_[_0xfed1('0x51')]({},_0x35e4eb,_0x4fc52c[_0xfed1('0x59')]);return db['FaxMessage'][_0xfed1('0x2c')]({'where':_0x35e4eb[_0xfed1('0x4b')]})[_0xfed1('0x21')](function(_0xa2838a){_0x4af132['count']=_0xa2838a;if(_0x4fc52c[_0xfed1('0x41')][_0xfed1('0x52')]){_0x35e4eb[_0xfed1('0x53')]=[{'all':!![]}];}return db[_0xfed1('0xa0')][_0xfed1('0x54')](_0x35e4eb);})['then'](function(_0x5c221a){_0x4af132[_0xfed1('0x55')]=_0x5c221a;return _0x4af132;});}})['then'](respondWithFilteredResult(_0x29097d,_0x35e4eb))[_0xfed1('0x28')](handleError(_0x29097d,null));};exports[_0xfed1('0x3a')]=function(_0xf3c04,_0x4c6909,_0x25093c){var _0x2aa5b0,_0x2040af={},_0x311b36;if(_0xf3c04[_0xfed1('0x5c')]['to']){_0x311b36=_0xf3c04['body']['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0xf3c04['params']['id']},'include':[{'model':db[_0xfed1('0xa1')],'as':_0xfed1('0xa2'),'include':[{'model':db['CmContact'],'as':_0xfed1('0xa3'),'where':{'fax':_0x311b36},'limit':0x1,'order':[['updatedAt',_0xfed1('0xa4')]]}]}]})[_0xfed1('0x21')](handleEntityNotFound(_0x4c6909,null))[_0xfed1('0x21')](function(_0x2227c5){_0x2aa5b0=_0x2227c5;if(_0xf3c04[_0xfed1('0x5c')][_0xfed1('0xa5')]&&_0xf3c04[_0xfed1('0x5c')][_0xfed1('0xa5')][_0xfed1('0x46')]){for(var _0x2df68d=0x0;_0x2df68d<_0xf3c04[_0xfed1('0x5c')][_0xfed1('0xa5')]['length'];_0x2df68d+=0x1){_0xf3c04[_0xfed1('0x5c')][_0xfed1('0xa5')][_0x2df68d]={'filename':_0xf3c04[_0xfed1('0x5c')]['attachments'][_0x2df68d][_0xfed1('0x39')],'id':_0xf3c04[_0xfed1('0x5c')][_0xfed1('0xa5')][_0x2df68d]['id'],'path':path['join'](config[_0xfed1('0xa6')],_0xfed1('0xa7'),_0xf3c04['body']['attachments'][_0x2df68d][_0xfed1('0xa8')])};}}return respondWithRpcPromise(_0xfed1('0xa9'),_0xfed1('0xa9'),{'FaxAccountId':_[_0xfed1('0xaa')](_0xf3c04[_0xfed1('0x57')]['id'])?undefined:_0xf3c04[_0xfed1('0x57')]['id'],'path':_[_0xfed1('0xaa')](_0xf3c04[_0xfed1('0x5c')][_0xfed1('0xa5')][0x0][_0xfed1('0xa')])?undefined:_0xf3c04[_0xfed1('0x5c')][_0xfed1('0xa5')][0x0]['path'],'fax':_[_0xfed1('0xaa')](_0xf3c04[_0xfed1('0x5c')]['to'][0x0])?undefined:_0xf3c04[_0xfed1('0x5c')]['to'][0x0]},client9002);})[_0xfed1('0x21')](function(){if(_0x2aa5b0){if(_[_0xfed1('0xaa')](_0xf3c04[_0xfed1('0x5c')]['from'])){_0xf3c04['body'][_0xfed1('0xab')]=util[_0xfed1('0xac')](_0xfed1('0xad'),_0x2aa5b0[_0xfed1('0x39')],_0x2aa5b0[_0xfed1('0xae')]);}if(_0x2aa5b0['List']){if(_0x2aa5b0[_0xfed1('0xa2')][_0xfed1('0xa3')][_0xfed1('0x46')]){return _0x2aa5b0[_0xfed1('0xa2')][_0xfed1('0xa3')][0x0];}else{return db['CmContact'][_0xfed1('0x5b')](_[_0xfed1('0x1a')](_0xf3c04[_0xfed1('0x5c')],{'firstName':_0xf3c04[_0xfed1('0x5c')]['to'][0x0],'phone':_0xf3c04[_0xfed1('0x5c')]['to'][0x0],'fax':_0xf3c04['body']['to'][0x0],'ListId':_0x2aa5b0[_0xfed1('0x9a')]}));}}else{throw new Error(_0xfed1('0xaf'));}}else{throw new Error(_0xfed1('0xb0'));}})['then'](function(_0x486975){if(_0x486975){return db[_0xfed1('0x6d')][_0xfed1('0x5a')]({'where':{'ContactId':_0x486975['id'],'closed':![],'FaxAccountId':_0x2aa5b0['id']}})['then'](function(_0x2171f6){if(_0x2171f6){return[_0x2171f6,![]];}return db[_0xfed1('0x6d')][_0xfed1('0x5b')]({'UserId':_0xf3c04[_0xfed1('0x5d')]['id'],'ContactId':_0x486975['id'],'FaxAccountId':_0x2aa5b0['id'],'fax':_0xf3c04[_0xfed1('0x5c')]['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0xf3c04['body'],{'read':![],'body':_0xf3c04['body'][_0xfed1('0xa5')][0x0][_0xfed1('0xb1')],'FaxAccountId':_0x2aa5b0['id'],'UserId':_0xf3c04[_0xfed1('0x5d')]['id'],'ContactId':_0x486975['id'],'AttachmentId':_0xf3c04[_0xfed1('0x5c')][_0xfed1('0xa5')][0x0]['id']})]},{'include':[{'model':db[_0xfed1('0xa0')],'as':_0xfed1('0xb2')}]})[_0xfed1('0x21')](function(_0xde4ad2){return[_0xde4ad2,!![]];});});}else{throw new Error(_0xfed1('0xb3'));}})[_0xfed1('0xb4')](function(_0x18b626,_0x22656a){if(_0x22656a){return _0x18b626;}return db[_0xfed1('0xa0')][_0xfed1('0x5b')]({'direction':_0xfed1('0xb5'),'read':![],'body':_0xf3c04[_0xfed1('0x5c')][_0xfed1('0xa5')][0x0][_0xfed1('0xb1')],'FaxAccountId':_0x2aa5b0['id'],'FaxInteractionId':_0x18b626['id'],'UserId':_0xf3c04[_0xfed1('0x5d')]['id'],'ContactId':_0x18b626[_0xfed1('0xb6')],'AttachmentId':_0xf3c04[_0xfed1('0x5c')][_0xfed1('0xa5')][0x0]['id']})[_0xfed1('0x21')](function(_0x30207e){_0x18b626[_0xfed1('0xb7')][_0xfed1('0xb2')]=[];_0x18b626[_0xfed1('0xb7')][_0xfed1('0xb2')]['push'](_0x30207e[_0xfed1('0xb7')]);return _0x18b626;});})[_0xfed1('0x21')](function(_0x2567a0){respondWithRpcPromise(_0xfed1('0xb8'),_0xfed1('0xb8'),{'FaxAccountId':_[_0xfed1('0xaa')](_0xf3c04[_0xfed1('0x57')]['id'])?undefined:_0xf3c04[_0xfed1('0x57')]['id'],'path':_[_0xfed1('0xaa')](_0xf3c04[_0xfed1('0x5c')][_0xfed1('0xa5')][0x0][_0xfed1('0xa')])?undefined:_0xf3c04[_0xfed1('0x5c')]['attachments'][0x0][_0xfed1('0xa')],'fax':_[_0xfed1('0xaa')](_0xf3c04['body']['to'][0x0])?undefined:_0xf3c04['body']['to'][0x0],'AttachmentId':_0xf3c04['body'][_0xfed1('0xa5')][0x0]['id']},client9002)['then'](function(_0x2f407b){logger[_0xfed1('0xb9')](_0xfed1('0xba'),_0x2f407b);})['catch'](function(_0x43acd4){logger[_0xfed1('0xb9')](_0xfed1('0xba'),_0x43acd4);});return _0x2567a0;})['then'](respondWithResult(_0x4c6909,null))['catch'](handleError(_0x4c6909,null));};exports[_0xfed1('0xbb')]=function(_0x3d8c97,_0x5b00b8,_0x524fc3){return db[_0xfed1('0x3e')][_0xfed1('0x5a')]({'where':{'id':_0x3d8c97[_0xfed1('0x57')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x5b00b8,null))[_0xfed1('0x21')](function(_0x117c21){if(_0x117c21){return _0x117c21[_0xfed1('0xbb')](_0x3d8c97['body'][_0xfed1('0x69')],_[_0xfed1('0x95')](_0x3d8c97['body'],['ids','id'])||{})['spread'](function(_0x2f2481){for(var _0x503ea8=0x0;_0x503ea8<_0x3d8c97['body'][_0xfed1('0x69')][_0xfed1('0x46')];_0x503ea8+=0x1){socket[_0xfed1('0xbc')](_0xfed1('0xbd'),{'UserId':_0x3d8c97['body']['ids'][_0x503ea8],'FaxAccountId':_0x3d8c97[_0xfed1('0x57')]['id']});}return _0x2f2481;});}})['then'](respondWithResult(_0x5b00b8,null))[_0xfed1('0x28')](handleError(_0x5b00b8,null));};exports['removeAgents']=function(_0x490325,_0x339750,_0x57b0cc){return db[_0xfed1('0x3e')][_0xfed1('0x5a')]({'where':{'id':_0x490325[_0xfed1('0x57')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x339750,null))[_0xfed1('0x21')](function(_0x967af){if(_0x967af){return _0x967af['removeAgents'](_0x490325[_0xfed1('0x41')][_0xfed1('0x69')])[_0xfed1('0x21')](function(){if(_[_0xfed1('0xbe')](_0x490325[_0xfed1('0x41')][_0xfed1('0x69')])){for(var _0x2de989=0x0;_0x2de989<_0x490325[_0xfed1('0x41')][_0xfed1('0x69')]['length'];_0x2de989+=0x1){socket[_0xfed1('0xbc')](_0xfed1('0xbf'),{'UserId':Number(_0x490325[_0xfed1('0x41')][_0xfed1('0x69')][_0x2de989]),'FaxAccountId':Number(_0x490325[_0xfed1('0x57')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x490325['query'][_0xfed1('0x69')]),'FaxAccountId':Number(_0x490325['params']['id'])});}});}})[_0xfed1('0x21')](respondWithStatusCode(_0x339750,null))['catch'](handleError(_0x339750,null));};exports[_0xfed1('0xc0')]=function(_0x3cb83d,_0x507fb1,_0x5ac5f3){var _0x1638c6={};var _0x5c3fe1={};var _0x4fa721;var _0x1d9d65;return db[_0xfed1('0x3e')]['findOne']({'where':{'id':_0x3cb83d[_0xfed1('0x57')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x507fb1,null))[_0xfed1('0x21')](function(_0x51e85f){if(_0x51e85f){_0x4fa721=_0x51e85f;_0x5c3fe1[_0xfed1('0x43')]=_[_0xfed1('0x58')](db[_0xfed1('0x71')][_0xfed1('0x3f')]);_0x5c3fe1[_0xfed1('0x41')]=_[_0xfed1('0x58')](_0x3cb83d['query']);_0x5c3fe1[_0xfed1('0x4c')]=_[_0xfed1('0x42')](_0x5c3fe1[_0xfed1('0x43')],_0x5c3fe1[_0xfed1('0x41')]);_0x1638c6[_0xfed1('0x45')]=_[_0xfed1('0x42')](_0x5c3fe1[_0xfed1('0x43')],qs['fields'](_0x3cb83d[_0xfed1('0x41')][_0xfed1('0x44')]));_0x1638c6['attributes']=_0x1638c6[_0xfed1('0x45')][_0xfed1('0x46')]?_0x1638c6[_0xfed1('0x45')]:_0x5c3fe1['model'];_0x1638c6[_0xfed1('0x49')]=qs[_0xfed1('0x4a')](_0x3cb83d[_0xfed1('0x41')]['sort']);_0x1638c6['where']=qs['filters'](_[_0xfed1('0x4d')](_0x3cb83d[_0xfed1('0x41')],_0x5c3fe1[_0xfed1('0x4c')]));if(_0x3cb83d[_0xfed1('0x41')][_0xfed1('0x4e')]){_0x1638c6[_0xfed1('0x4b')]=_[_0xfed1('0x51')](_0x1638c6[_0xfed1('0x4b')],{'$or':_[_0xfed1('0x3d')](_0x1638c6[_0xfed1('0x45')],function(_0x85c3f5){var _0x5aa57a={};_0x5aa57a[_0x85c3f5]={'$like':'%'+_0x3cb83d[_0xfed1('0x41')][_0xfed1('0x4e')]+'%'};return _0x5aa57a;})});}_0x1638c6=_[_0xfed1('0x51')]({},_0x1638c6,_0x3cb83d[_0xfed1('0x59')]);return _0x4fa721[_0xfed1('0xc0')](_0x1638c6);}})[_0xfed1('0x21')](function(_0x534411){if(_0x534411){_0x1d9d65=_0x534411['length'];if(!_0x3cb83d[_0xfed1('0x41')][_0xfed1('0x47')](_0xfed1('0x48'))){_0x1638c6[_0xfed1('0x2e')]=qs['limit'](_0x3cb83d[_0xfed1('0x41')]['limit']);_0x1638c6[_0xfed1('0x2d')]=qs[_0xfed1('0x2d')](_0x3cb83d[_0xfed1('0x41')][_0xfed1('0x2d')]);}return _0x4fa721[_0xfed1('0xc0')](_0x1638c6);}})[_0xfed1('0x21')](function(_0x38a155){if(_0x38a155){return _0x38a155?{'count':_0x1d9d65,'rows':_0x38a155}:null;}})[_0xfed1('0x21')](respondWithResult(_0x507fb1,null))[_0xfed1('0x28')](handleError(_0x507fb1,null));}; \ No newline at end of file +var _0x33c5=['attachments','join','root','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','Contacts','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','http','client','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','type','options','includeAll','findAll','show','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','nolimit','order','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addInteraction','FaxInteraction','omit','getInteractions','Contact','User','Owner','fullname','Tag','Tags','tag','addApplications','findOne','sequelize','transaction','FaxApplication','findAndCountAll','getApplications','from-voip-provider','exten','localstationid','system','description','priority','push','Answer','Set','ecm','faxdetect','minrate','modem','t38timeout','FAXOPT(','ReceiveFax','addAccountApplications','bulkCreate','updateAccountApplications','VoiceExtension','tech','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','CmContact','DESC'];(function(_0x236b54,_0x2c38d6){var _0x3be391=function(_0x4d17e9){while(--_0x4d17e9){_0x236b54['push'](_0x236b54['shift']());}};_0x3be391(++_0x2c38d6);}(_0x33c5,0xe6));var _0x533c=function(_0x5ef905,_0x564b87){_0x5ef905=_0x5ef905-0x0;var _0x367808=_0x33c5[_0x5ef905];return _0x367808;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x533c('0x0'));var rimraf=require(_0x533c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x533c('0x2'));var rp=require(_0x533c('0x3'));var moment=require(_0x533c('0x4'));var BPromise=require(_0x533c('0x5'));var Mustache=require(_0x533c('0x6'));var util=require('util');var path=require(_0x533c('0x7'));var sox=require(_0x533c('0x8'));var csv=require(_0x533c('0x9'));var ejs=require(_0x533c('0xa'));var fs=require('fs');var _=require(_0x533c('0xb'));var squel=require(_0x533c('0xc'));var crypto=require(_0x533c('0xd'));var jsforce=require(_0x533c('0xe'));var deskjs=require(_0x533c('0xf'));var toCsv=require(_0x533c('0x9'));var querystring=require(_0x533c('0x10'));var Papa=require(_0x533c('0x11'));var Redis=require(_0x533c('0x12'));var authService=require(_0x533c('0x13'));var qs=require(_0x533c('0x14'));var as=require(_0x533c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x533c('0x16'))(_0x533c('0x17'));var utils=require(_0x533c('0x18'));var config=require(_0x533c('0x19'));var licenseUtil=require(_0x533c('0x1a'));var db=require(_0x533c('0x1b'))['db'];config['redis']=_[_0x533c('0x1c')](config[_0x533c('0x1d')],{'host':_0x533c('0x1e'),'port':0x18eb});var socket=require(_0x533c('0x1f'))(new Redis(config[_0x533c('0x1d')]));require(_0x533c('0x20'))[_0x533c('0x21')](socket);var jayson=require(_0x533c('0x22'));var client=jayson['client'][_0x533c('0x23')]({'port':0x232c});var client9002=jayson[_0x533c('0x24')][_0x533c('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x3e544f,_0x56dfb7,_0x1031e7,_0x1ed6ba){return new BPromise(function(_0x41e22c,_0x311700){var _0x2854ab=_0x1ed6ba||client;return _0x2854ab[_0x533c('0x25')](_0x3e544f,_0x1031e7)[_0x533c('0x26')](function(_0x35bfd3){logger[_0x533c('0x27')](_0x533c('0x28'),_0x56dfb7,_0x533c('0x29'));logger[_0x533c('0x2a')](_0x533c('0x2b'),_0x56dfb7,_0x533c('0x29'),JSON[_0x533c('0x2c')](_0x35bfd3));if(_0x35bfd3[_0x533c('0x2d')]){if(_0x35bfd3[_0x533c('0x2d')][_0x533c('0x2e')]===0x1f4){logger['error'](_0x533c('0x28'),_0x56dfb7,_0x35bfd3['error']['message']);return _0x311700(_0x35bfd3[_0x533c('0x2d')][_0x533c('0x2f')]);}logger['error'](_0x533c('0x28'),_0x56dfb7,_0x35bfd3[_0x533c('0x2d')][_0x533c('0x2f')]);return _0x41e22c(_0x35bfd3[_0x533c('0x2d')]['message']);}else{logger[_0x533c('0x27')](_0x533c('0x28'),_0x56dfb7,_0x533c('0x29'));_0x41e22c(_0x35bfd3[_0x533c('0x30')][_0x533c('0x2f')]);}})[_0x533c('0x31')](function(_0xb51a5){logger[_0x533c('0x2d')](_0x533c('0x28'),_0x56dfb7,_0xb51a5);_0x311700(_0xb51a5);});});}function respondWithStatusCode(_0x3eef9f,_0x4d47d0){_0x4d47d0=_0x4d47d0||0xcc;return function(_0x11d775){if(_0x11d775){return _0x3eef9f[_0x533c('0x32')](_0x4d47d0);}return _0x3eef9f['status'](_0x4d47d0)[_0x533c('0x33')]();};}function respondWithResult(_0x4f9f4a,_0x21f58d){_0x21f58d=_0x21f58d||0xc8;return function(_0x14d783){if(_0x14d783){return _0x4f9f4a[_0x533c('0x34')](_0x21f58d)[_0x533c('0x35')](_0x14d783);}};}function respondWithFilteredResult(_0x425f60,_0x146a8e){return function(_0x212d1b){if(_0x212d1b){var _0x38d886=_0x212d1b[_0x533c('0x36')],_0x3c559b=_0x146a8e['offset'],_0x2fc7fa=_0x146a8e[_0x533c('0x37')]+_0x146a8e['limit'],_0x441680;if(_0x2fc7fa>=_0x38d886){_0x2fc7fa=_0x38d886;_0x441680=0xc8;}else{_0x441680=0xce;}_0x425f60[_0x533c('0x34')](_0x441680);return _0x425f60[_0x533c('0x38')](_0x533c('0x39'),_0x3c559b+'-'+_0x2fc7fa+'/'+_0x38d886)[_0x533c('0x35')](_0x212d1b);}return null;};}function patchUpdates(_0x16006a){return function(_0x397ad3){try{jsonpatch[_0x533c('0x3a')](_0x397ad3,_0x16006a,!![]);}catch(_0x624d84){return BPromise[_0x533c('0x3b')](_0x624d84);}return _0x397ad3[_0x533c('0x3c')]();};}function saveUpdates(_0x1bbcb7,_0x3ec4c8){return function(_0x3f7ffc){if(_0x3f7ffc){return _0x3f7ffc[_0x533c('0x3d')](_0x1bbcb7)[_0x533c('0x26')](function(_0x5ac6b4){return _0x5ac6b4;});}return null;};}function removeEntity(_0x2b801e,_0x182d69){return function(_0x188223){if(_0x188223){return _0x188223[_0x533c('0x3e')]()['then'](function(){var _0x3f1db9=_0x188223[_0x533c('0x3f')]({'plain':!![]});var _0x2350fe=_0x533c('0x40');return db[_0x533c('0x41')]['destroy']({'where':{'type':_0x2350fe,'resourceId':_0x3f1db9['id']}})['then'](function(){return _0x188223;});})['then'](function(){_0x2b801e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xf21fa4,_0x4b6c22){return function(_0x42994d){if(!_0x42994d){_0xf21fa4['sendStatus'](0x194);}return _0x42994d;};}function handleError(_0x34243d,_0x3cd1e6){_0x3cd1e6=_0x3cd1e6||0x1f4;return function(_0x14c121){logger['error'](_0x14c121[_0x533c('0x42')]);if(_0x14c121[_0x533c('0x43')]){delete _0x14c121[_0x533c('0x43')];}_0x34243d['status'](_0x3cd1e6)[_0x533c('0x44')](_0x14c121);};}exports[_0x533c('0x45')]=function(_0x30e5eb,_0x5dfe21){var _0x245a57={'include':[{'model':db[_0x533c('0x46')],'as':_0x533c('0x47')}]},_0xdfeb18={},_0x2cd02f={'count':0x0,'rows':[]};var _0x4154f9=_[_0x533c('0x48')](db[_0x533c('0x49')][_0x533c('0x4a')],function(_0x2c03fa){return{'name':_0x2c03fa[_0x533c('0x4b')],'type':_0x2c03fa['type'][_0x533c('0x4c')]};});_0xdfeb18[_0x533c('0x4d')]=_[_0x533c('0x48')](_0x4154f9,_0x533c('0x43'));_0xdfeb18[_0x533c('0x4e')]=_[_0x533c('0x4f')](_0x30e5eb['query']);_0xdfeb18[_0x533c('0x50')]=_[_0x533c('0x51')](_0xdfeb18[_0x533c('0x4d')],_0xdfeb18['query']);_0x245a57[_0x533c('0x52')]=_[_0x533c('0x51')](_0xdfeb18[_0x533c('0x4d')],qs[_0x533c('0x53')](_0x30e5eb['query'][_0x533c('0x53')]));_0x245a57['attributes']=_0x245a57[_0x533c('0x52')][_0x533c('0x54')]?_0x245a57['attributes']:_0xdfeb18[_0x533c('0x4d')];if(!_0x30e5eb[_0x533c('0x4e')][_0x533c('0x55')]('nolimit')){_0x245a57['limit']=qs['limit'](_0x30e5eb['query'][_0x533c('0x56')]);_0x245a57['offset']=qs[_0x533c('0x37')](_0x30e5eb['query'][_0x533c('0x37')]);}_0x245a57['order']=qs[_0x533c('0x57')](_0x30e5eb[_0x533c('0x4e')]['sort']);_0x245a57[_0x533c('0x58')]=qs[_0x533c('0x50')](_[_0x533c('0x59')](_0x30e5eb[_0x533c('0x4e')],_0xdfeb18[_0x533c('0x50')]),_0x4154f9);if(_0x30e5eb['query'][_0x533c('0x5a')]){_0x245a57[_0x533c('0x58')]=_[_0x533c('0x5b')](_0x245a57[_0x533c('0x58')],{'$or':_['map'](_0x4154f9,function(_0x40cbe0){if(_0x40cbe0[_0x533c('0x5c')]!=='VIRTUAL'){var _0x4b74e5={};_0x4b74e5[_0x40cbe0[_0x533c('0x43')]]={'$like':'%'+_0x30e5eb['query'][_0x533c('0x5a')]+'%'};return _0x4b74e5;}})});}_0x245a57=_[_0x533c('0x5b')]({},_0x245a57,_0x30e5eb[_0x533c('0x5d')]);var _0x471c59={'where':_0x245a57[_0x533c('0x58')]};return db[_0x533c('0x49')][_0x533c('0x36')](_0x471c59)[_0x533c('0x26')](function(_0x52411e){_0x2cd02f[_0x533c('0x36')]=_0x52411e;if(_0x30e5eb[_0x533c('0x4e')][_0x533c('0x5e')]){_0x245a57['include']=[{'all':!![]}];}return db[_0x533c('0x49')][_0x533c('0x5f')](_0x245a57);})['then'](function(_0x1d081c){_0x2cd02f['rows']=_0x1d081c;return _0x2cd02f;})[_0x533c('0x26')](respondWithFilteredResult(_0x5dfe21,_0x245a57))[_0x533c('0x31')](handleError(_0x5dfe21,null));};exports[_0x533c('0x60')]=function(_0x23b2ef,_0x32d110){var _0x3c46f3={'raw':![],'where':{'id':_0x23b2ef['params']['id']},'include':[{'model':db[_0x533c('0x46')],'as':_0x533c('0x47')}]},_0x1745d5={};_0x1745d5[_0x533c('0x4d')]=_[_0x533c('0x4f')](db[_0x533c('0x49')][_0x533c('0x4a')]);_0x1745d5[_0x533c('0x4e')]=_['keys'](_0x23b2ef['query']);_0x1745d5['filters']=_['intersection'](_0x1745d5[_0x533c('0x4d')],_0x1745d5[_0x533c('0x4e')]);_0x3c46f3['attributes']=_[_0x533c('0x51')](_0x1745d5[_0x533c('0x4d')],qs[_0x533c('0x53')](_0x23b2ef['query'][_0x533c('0x53')]));_0x3c46f3['attributes']=_0x3c46f3['attributes'][_0x533c('0x54')]?_0x3c46f3[_0x533c('0x52')]:_0x1745d5[_0x533c('0x4d')];if(_0x23b2ef[_0x533c('0x4e')][_0x533c('0x5e')]){_0x3c46f3[_0x533c('0x61')]=[{'all':!![]}];}_0x3c46f3=_[_0x533c('0x5b')]({},_0x3c46f3,_0x23b2ef['options']);return db[_0x533c('0x49')]['find'](_0x3c46f3)[_0x533c('0x26')](handleEntityNotFound(_0x32d110,null))[_0x533c('0x26')](respondWithResult(_0x32d110,null))[_0x533c('0x31')](handleError(_0x32d110,null));};exports[_0x533c('0x62')]=function(_0x416769,_0x178ef7){return db[_0x533c('0x49')][_0x533c('0x62')](_0x416769['body'],{})[_0x533c('0x26')](function(_0x43a333){var _0x163563=_0x416769[_0x533c('0x63')][_0x533c('0x3f')]({'plain':!![]});if(!_0x163563)throw new Error(_0x533c('0x64'));if(_0x163563['role']===_0x533c('0x63')){var _0x554a9f=_0x43a333[_0x533c('0x3f')]({'plain':!![]});var _0x451737=_0x533c('0x40');return db[_0x533c('0x65')][_0x533c('0x66')]({'where':{'name':_0x451737,'userProfileId':_0x163563[_0x533c('0x67')]},'raw':!![]})['then'](function(_0x591985){if(_0x591985&&_0x591985[_0x533c('0x68')]===0x0){return db[_0x533c('0x41')][_0x533c('0x62')]({'name':_0x554a9f[_0x533c('0x43')],'resourceId':_0x554a9f['id'],'type':_0x591985['name'],'sectionId':_0x591985['id']},{})[_0x533c('0x26')](function(){return _0x43a333;});}else{return _0x43a333;}})[_0x533c('0x31')](function(_0x8e04c7){logger[_0x533c('0x2d')](_0x533c('0x69'),_0x8e04c7);throw _0x8e04c7;});}return _0x43a333;})[_0x533c('0x26')](respondWithResult(_0x178ef7,0xc9))[_0x533c('0x31')](handleError(_0x178ef7,null));};exports[_0x533c('0x3d')]=function(_0x10689d,_0x3aba19){if(_0x10689d[_0x533c('0x6a')]['id']){delete _0x10689d[_0x533c('0x6a')]['id'];}return db[_0x533c('0x49')][_0x533c('0x66')]({'where':{'id':_0x10689d[_0x533c('0x6b')]['id']},'include':[{'model':db[_0x533c('0x46')],'as':_0x533c('0x47')}]})['then'](handleEntityNotFound(_0x3aba19,null))[_0x533c('0x26')](saveUpdates(_0x10689d['body'],null))['then'](respondWithResult(_0x3aba19,null))[_0x533c('0x31')](handleError(_0x3aba19,null));};exports[_0x533c('0x3e')]=function(_0x965b85,_0x3b8e0b){return db[_0x533c('0x49')][_0x533c('0x66')]({'where':{'id':_0x965b85[_0x533c('0x6b')]['id']}})['then'](handleEntityNotFound(_0x3b8e0b,null))[_0x533c('0x26')](removeEntity(_0x3b8e0b,null))[_0x533c('0x31')](handleError(_0x3b8e0b,null));};exports['describe']=function(_0x1fbad2,_0x1c1b8a){return db[_0x533c('0x49')][_0x533c('0x6c')]()['then'](respondWithResult(_0x1c1b8a,null))[_0x533c('0x31')](handleError(_0x1c1b8a,null));};exports[_0x533c('0x6d')]=function(_0x50223e,_0x1589b0,_0x3e8d57){if(_0x50223e['body']['id']){delete _0x50223e[_0x533c('0x6a')]['id'];}return db[_0x533c('0x49')]['find']({'where':{'id':_0x50223e[_0x533c('0x6b')]['id']}})['then'](handleEntityNotFound(_0x1589b0,null))['then'](function(_0xf36c93){if(_0xf36c93){_0x50223e[_0x533c('0x6a')][_0x533c('0x6e')]=_0xf36c93['id'];return db[_0x533c('0x6f')]['create'](_0x50223e[_0x533c('0x6a')]);}})[_0x533c('0x26')](respondWithResult(_0x1589b0,null))[_0x533c('0x31')](handleError(_0x1589b0,null));};exports[_0x533c('0x70')]=function(_0x20d344,_0x56e046,_0x309725){var _0x4d5ad1={'raw':![],'where':{}};var _0x45b589={};var _0x5dc719={'count':0x0,'rows':[]};return db[_0x533c('0x49')]['findOne']({'where':{'id':_0x20d344['params']['id']}})['then'](handleEntityNotFound(_0x56e046,null))[_0x533c('0x26')](function(_0x3f3981){if(_0x3f3981){_0x45b589[_0x533c('0x4d')]=_['keys'](db[_0x533c('0x6f')][_0x533c('0x4a')]);_0x45b589[_0x533c('0x4e')]=_[_0x533c('0x4f')](_0x20d344[_0x533c('0x4e')]);_0x45b589['filters']=_['intersection'](_0x45b589[_0x533c('0x4d')],_0x45b589[_0x533c('0x4e')]);_0x4d5ad1[_0x533c('0x52')]=_[_0x533c('0x51')](_0x45b589[_0x533c('0x4d')],qs[_0x533c('0x53')](_0x20d344[_0x533c('0x4e')][_0x533c('0x53')]));_0x4d5ad1[_0x533c('0x52')]=_0x4d5ad1['attributes'][_0x533c('0x54')]?_0x4d5ad1[_0x533c('0x52')]:_0x45b589[_0x533c('0x4d')];if(!_0x20d344[_0x533c('0x4e')][_0x533c('0x55')](_0x533c('0x71'))){_0x4d5ad1[_0x533c('0x56')]=qs[_0x533c('0x56')](_0x20d344[_0x533c('0x4e')][_0x533c('0x56')]);_0x4d5ad1[_0x533c('0x37')]=qs[_0x533c('0x37')](_0x20d344[_0x533c('0x4e')][_0x533c('0x37')]);}_0x4d5ad1[_0x533c('0x72')]=qs[_0x533c('0x57')](_0x20d344[_0x533c('0x4e')]['sort']);_0x4d5ad1[_0x533c('0x58')]=qs[_0x533c('0x50')](_['pick'](_0x20d344['query'],_0x45b589[_0x533c('0x50')]));_0x4d5ad1['where'][_0x533c('0x6e')]=_0x3f3981['id'];if(_0x20d344[_0x533c('0x4e')][_0x533c('0x5a')]){_0x4d5ad1[_0x533c('0x58')]=_[_0x533c('0x5b')](_0x4d5ad1['where'],{'$or':_[_0x533c('0x48')](_0x4d5ad1[_0x533c('0x52')],function(_0x1a34c8){var _0x3a6c02={};_0x3a6c02[_0x1a34c8]={'$like':'%'+_0x20d344[_0x533c('0x4e')][_0x533c('0x5a')]+'%'};return _0x3a6c02;})});}_0x4d5ad1=_[_0x533c('0x5b')]({},_0x4d5ad1,_0x20d344[_0x533c('0x5d')]);return db[_0x533c('0x6f')][_0x533c('0x36')]({'where':_0x4d5ad1[_0x533c('0x58')]})[_0x533c('0x26')](function(_0x1a5db5){_0x5dc719[_0x533c('0x36')]=_0x1a5db5;if(_0x20d344[_0x533c('0x4e')][_0x533c('0x5e')]){_0x4d5ad1[_0x533c('0x61')]=[{'all':!![]}];}return db[_0x533c('0x6f')]['findAll'](_0x4d5ad1);})[_0x533c('0x26')](function(_0x15d09a){_0x5dc719[_0x533c('0x73')]=_0x15d09a;return _0x5dc719;});}})[_0x533c('0x26')](respondWithFilteredResult(_0x56e046,_0x4d5ad1))['catch'](handleError(_0x56e046,null));};exports[_0x533c('0x74')]=function(_0xc0cf5d,_0x4d1b98,_0x411f86){return db['FaxAccount'][_0x533c('0x66')]({'where':{'id':_0xc0cf5d['params']['id']}})[_0x533c('0x26')](handleEntityNotFound(_0x4d1b98,null))[_0x533c('0x26')](function(_0x3909d2){if(_0x3909d2){return _0x3909d2['removeDispositions'](_0xc0cf5d['query']['ids']);}})[_0x533c('0x26')](respondWithStatusCode(_0x4d1b98,null))['catch'](handleError(_0x4d1b98,null));};exports[_0x533c('0x75')]=function(_0x1a8176,_0x445da2,_0x450152){if(_0x1a8176['body']['id']){delete _0x1a8176['body']['id'];}return db[_0x533c('0x49')]['find']({'where':{'id':_0x1a8176[_0x533c('0x6b')]['id']}})[_0x533c('0x26')](handleEntityNotFound(_0x445da2,null))[_0x533c('0x26')](function(_0x4cfd36){if(_0x4cfd36){_0x1a8176[_0x533c('0x6a')]['FaxAccountId']=_0x4cfd36['id'];return db[_0x533c('0x76')][_0x533c('0x62')](_0x1a8176['body']);}})[_0x533c('0x26')](respondWithResult(_0x445da2,null))[_0x533c('0x31')](handleError(_0x445da2,null));};exports[_0x533c('0x77')]=function(_0xfba909,_0x1cea69,_0x4d74a6){var _0x51444d={'raw':![],'where':{}};var _0x1c9d48={};var _0xaf42ce={'count':0x0,'rows':[]};return db[_0x533c('0x49')]['findOne']({'where':{'id':_0xfba909[_0x533c('0x6b')]['id']}})['then'](handleEntityNotFound(_0x1cea69,null))['then'](function(_0x1960c3){if(_0x1960c3){_0x1c9d48[_0x533c('0x4d')]=_['keys'](db[_0x533c('0x76')][_0x533c('0x4a')]);_0x1c9d48[_0x533c('0x4e')]=_[_0x533c('0x4f')](_0xfba909[_0x533c('0x4e')]);_0x1c9d48[_0x533c('0x50')]=_[_0x533c('0x51')](_0x1c9d48[_0x533c('0x4d')],_0x1c9d48[_0x533c('0x4e')]);_0x51444d[_0x533c('0x52')]=_[_0x533c('0x51')](_0x1c9d48[_0x533c('0x4d')],qs[_0x533c('0x53')](_0xfba909['query'][_0x533c('0x53')]));_0x51444d[_0x533c('0x52')]=_0x51444d[_0x533c('0x52')]['length']?_0x51444d[_0x533c('0x52')]:_0x1c9d48['model'];if(!_0xfba909[_0x533c('0x4e')][_0x533c('0x55')](_0x533c('0x71'))){_0x51444d['limit']=qs[_0x533c('0x56')](_0xfba909[_0x533c('0x4e')][_0x533c('0x56')]);_0x51444d['offset']=qs['offset'](_0xfba909[_0x533c('0x4e')]['offset']);}_0x51444d[_0x533c('0x72')]=qs['sort'](_0xfba909[_0x533c('0x4e')][_0x533c('0x57')]);_0x51444d[_0x533c('0x58')]=qs['filters'](_['pick'](_0xfba909[_0x533c('0x4e')],_0x1c9d48[_0x533c('0x50')]));_0x51444d[_0x533c('0x58')][_0x533c('0x6e')]=_0x1960c3['id'];if(_0xfba909[_0x533c('0x4e')][_0x533c('0x5a')]){_0x51444d[_0x533c('0x58')]=_[_0x533c('0x5b')](_0x51444d[_0x533c('0x58')],{'$or':_['map'](_0x51444d[_0x533c('0x52')],function(_0x185243){var _0x345884={};_0x345884[_0x185243]={'$like':'%'+_0xfba909['query'][_0x533c('0x5a')]+'%'};return _0x345884;})});}_0x51444d=_[_0x533c('0x5b')]({},_0x51444d,_0xfba909[_0x533c('0x5d')]);return db[_0x533c('0x76')][_0x533c('0x36')]({'where':_0x51444d[_0x533c('0x58')]})[_0x533c('0x26')](function(_0x2e2b47){_0xaf42ce[_0x533c('0x36')]=_0x2e2b47;if(_0xfba909[_0x533c('0x4e')][_0x533c('0x5e')]){_0x51444d[_0x533c('0x61')]=[{'all':!![]}];}return db['CannedAnswer'][_0x533c('0x5f')](_0x51444d);})['then'](function(_0x1ffb6e){_0xaf42ce[_0x533c('0x73')]=_0x1ffb6e;return _0xaf42ce;});}})['then'](respondWithFilteredResult(_0x1cea69,_0x51444d))['catch'](handleError(_0x1cea69,null));};exports[_0x533c('0x78')]=function(_0x544bcc,_0x2c731b,_0x492938){return db[_0x533c('0x49')]['find']({'where':{'id':_0x544bcc[_0x533c('0x6b')]['id']}})[_0x533c('0x26')](handleEntityNotFound(_0x2c731b,null))[_0x533c('0x26')](function(_0x1295c8){if(_0x1295c8){return _0x1295c8[_0x533c('0x78')](_0x544bcc[_0x533c('0x4e')][_0x533c('0x79')]);}})[_0x533c('0x26')](respondWithStatusCode(_0x2c731b,null))['catch'](handleError(_0x2c731b,null));};exports[_0x533c('0x7a')]=function(_0x17ab27,_0x185825,_0x4abaab){return db[_0x533c('0x7b')]['find']({'where':{'id':_0x17ab27['params']['id']}})[_0x533c('0x26')](handleEntityNotFound(_0x185825,null))[_0x533c('0x26')](function(_0x19af4a){if(_0x19af4a){return _0x19af4a['addInteraction'](_0x17ab27['body'][_0x533c('0x79')],_[_0x533c('0x7c')](_0x17ab27[_0x533c('0x6a')],[_0x533c('0x79'),'id'])||{});}})['then'](respondWithResult(_0x185825,null))[_0x533c('0x31')](handleError(_0x185825,null));};exports[_0x533c('0x7d')]=function(_0x7d1205,_0x1d2e74,_0x5cb95a){var _0x4c9b50={'raw':![],'where':{}};var _0x5f1456={};var _0x648909={'count':0x0,'rows':[]};return db[_0x533c('0x49')]['findOne']({'where':{'id':_0x7d1205[_0x533c('0x6b')]['id']}})[_0x533c('0x26')](handleEntityNotFound(_0x1d2e74,null))['then'](function(_0x32a492){if(_0x32a492){_0x5f1456[_0x533c('0x4d')]=_['keys'](db['FaxInteraction'][_0x533c('0x4a')]);_0x5f1456['query']=_['keys'](_0x7d1205[_0x533c('0x4e')]);_0x5f1456[_0x533c('0x50')]=_[_0x533c('0x51')](_0x5f1456[_0x533c('0x4d')],_0x5f1456[_0x533c('0x4e')]);_0x4c9b50[_0x533c('0x52')]=_['intersection'](_0x5f1456['model'],qs[_0x533c('0x53')](_0x7d1205[_0x533c('0x4e')][_0x533c('0x53')]));_0x4c9b50[_0x533c('0x52')]=_0x4c9b50[_0x533c('0x52')][_0x533c('0x54')]?_0x4c9b50[_0x533c('0x52')]:_0x5f1456[_0x533c('0x4d')];if(!_0x7d1205[_0x533c('0x4e')]['hasOwnProperty'](_0x533c('0x71'))){_0x4c9b50[_0x533c('0x56')]=qs[_0x533c('0x56')](_0x7d1205['query'][_0x533c('0x56')]);_0x4c9b50[_0x533c('0x37')]=qs[_0x533c('0x37')](_0x7d1205[_0x533c('0x4e')][_0x533c('0x37')]);}_0x4c9b50['order']=qs[_0x533c('0x57')](_0x7d1205[_0x533c('0x4e')][_0x533c('0x57')]);_0x4c9b50['where']=qs['filters'](_[_0x533c('0x59')](_0x7d1205[_0x533c('0x4e')],_0x5f1456[_0x533c('0x50')]));_0x4c9b50['where'][_0x533c('0x6e')]=_0x32a492['id'];if(_0x7d1205[_0x533c('0x4e')][_0x533c('0x5a')]){_0x4c9b50[_0x533c('0x58')]=_[_0x533c('0x5b')](_0x4c9b50[_0x533c('0x58')],{'$or':_[_0x533c('0x48')](_0x4c9b50['attributes'],function(_0xd95984){var _0x50afa9={};_0x50afa9[_0xd95984]={'$like':'%'+_0x7d1205['query'][_0x533c('0x5a')]+'%'};return _0x50afa9;})});}_0x4c9b50=_[_0x533c('0x5b')]({},_0x4c9b50,_0x7d1205[_0x533c('0x5d')]);return db['FaxInteraction'][_0x533c('0x36')]({'where':_0x4c9b50['where']})[_0x533c('0x26')](function(_0x4c8992){_0x648909[_0x533c('0x36')]=_0x4c8992;if(_0x7d1205['query'][_0x533c('0x5e')]){_0x4c9b50[_0x533c('0x61')]=[{'model':db['CmContact'],'as':_0x533c('0x7e'),'required':![]},{'model':db[_0x533c('0x7f')],'as':_0x533c('0x80'),'attributes':[_0x533c('0x43'),_0x533c('0x81'),'internal'],'required':![]},{'model':db[_0x533c('0x82')],'as':_0x533c('0x83'),'attributes':['id',_0x533c('0x43'),'color'],'where':_0x7d1205[_0x533c('0x4e')][_0x533c('0x84')]?{'id':_0x7d1205['query']['tag']}:undefined,'required':_0x7d1205[_0x533c('0x4e')][_0x533c('0x84')]?!![]:![]}];}return db[_0x533c('0x7b')][_0x533c('0x5f')](_0x4c9b50);})['then'](function(_0x5eec44){_0x648909['rows']=_0x5eec44;return _0x648909;});}})[_0x533c('0x26')](respondWithFilteredResult(_0x1d2e74,_0x4c9b50))[_0x533c('0x31')](handleError(_0x1d2e74,null));};exports[_0x533c('0x85')]=function(_0x4af774,_0x21b1c0,_0x5e0ada){return db['FaxAccount'][_0x533c('0x86')]({'where':{'id':_0x4af774[_0x533c('0x6b')]['id']}})['then'](handleEntityNotFound(_0x21b1c0,null))[_0x533c('0x26')](function(_0x2650f3){if(_0x2650f3){return db[_0x533c('0x87')][_0x533c('0x88')](function(_0x1a42aa){return db[_0x533c('0x89')][_0x533c('0x3e')]({'where':{'FaxAccountId':_0x4af774[_0x533c('0x6b')]['id']},'transaction':_0x1a42aa})[_0x533c('0x26')](function(_0x30ebfb){var _0x429339=_['map'](_0x4af774['body'],function(_0x3482c4){_0x3482c4[_0x533c('0x6e')]=_0x4af774[_0x533c('0x6b')]['id'];return _0x3482c4;});return db[_0x533c('0x89')]['bulkCreate'](_0x429339,{'transaction':_0x1a42aa});});})[_0x533c('0x26')](function(){return db[_0x533c('0x89')][_0x533c('0x8a')]({'where':{'FaxAccountId':_0x4af774[_0x533c('0x6b')]['id']},'order':'priority'});});}})[_0x533c('0x26')](respondWithResult(_0x21b1c0,null))[_0x533c('0x31')](handleError(_0x21b1c0,null));};exports[_0x533c('0x8b')]=function(_0x76c62,_0x59c381,_0x2aa3d6){var _0x1625c6={};var _0x1f2efe={};var _0x4873bc;var _0x1b8504;return db[_0x533c('0x49')][_0x533c('0x86')]({'where':{'id':_0x76c62[_0x533c('0x6b')]['id']}})[_0x533c('0x26')](handleEntityNotFound(_0x59c381,null))[_0x533c('0x26')](function(_0x5761b5){if(_0x5761b5){_0x4873bc=_0x5761b5;_0x1f2efe[_0x533c('0x4d')]=_[_0x533c('0x4f')](db[_0x533c('0x89')][_0x533c('0x4a')]);_0x1f2efe[_0x533c('0x4e')]=_[_0x533c('0x4f')](_0x76c62[_0x533c('0x4e')]);_0x1f2efe[_0x533c('0x50')]=_[_0x533c('0x51')](_0x1f2efe[_0x533c('0x4d')],_0x1f2efe[_0x533c('0x4e')]);_0x1625c6['attributes']=_['intersection'](_0x1f2efe[_0x533c('0x4d')],qs[_0x533c('0x53')](_0x76c62[_0x533c('0x4e')]['fields']));_0x1625c6[_0x533c('0x52')]=_0x1625c6[_0x533c('0x52')]['length']?_0x1625c6[_0x533c('0x52')]:_0x1f2efe['model'];_0x1625c6[_0x533c('0x72')]=qs[_0x533c('0x57')](_0x76c62[_0x533c('0x4e')][_0x533c('0x57')]);_0x1625c6['where']=qs['filters'](_[_0x533c('0x59')](_0x76c62['query'],_0x1f2efe[_0x533c('0x50')]));if(_0x76c62[_0x533c('0x4e')][_0x533c('0x5a')]){_0x1625c6[_0x533c('0x58')]=_[_0x533c('0x5b')](_0x1625c6['where'],{'$or':_[_0x533c('0x48')](_0x1625c6[_0x533c('0x52')],function(_0x2769dc){var _0x1880bf={};_0x1880bf[_0x2769dc]={'$like':'%'+_0x76c62[_0x533c('0x4e')][_0x533c('0x5a')]+'%'};return _0x1880bf;})});}_0x1625c6=_[_0x533c('0x5b')]({},_0x1625c6,_0x76c62[_0x533c('0x5d')]);return _0x4873bc[_0x533c('0x8b')](_0x1625c6);}})[_0x533c('0x26')](function(_0x5c1b88){if(_0x5c1b88){_0x1b8504=_0x5c1b88['length'];if(!_0x76c62[_0x533c('0x4e')][_0x533c('0x55')]('nolimit')){_0x1625c6[_0x533c('0x56')]=qs[_0x533c('0x56')](_0x76c62[_0x533c('0x4e')][_0x533c('0x56')]);_0x1625c6[_0x533c('0x37')]=qs[_0x533c('0x37')](_0x76c62[_0x533c('0x4e')][_0x533c('0x37')]);}return _0x4873bc['getApplications'](_0x1625c6);}})[_0x533c('0x26')](function(_0x3ab390){if(_0x3ab390){return _0x3ab390?{'count':_0x1b8504,'rows':_0x3ab390}:null;}})[_0x533c('0x26')](respondWithResult(_0x59c381,null))[_0x533c('0x31')](handleError(_0x59c381,null));};function Extension(_0xe3fb95,_0x341baf,_0x3738e6,_0x53d796){this['context']=_0x533c('0x8c');this[_0x533c('0x8d')]=_0xe3fb95[_0x533c('0x8e')];this['app']=_0x53d796;this['type']=_0x533c('0x8f');this[_0x533c('0x90')]='Fax\x20Extension';this[_0x533c('0x6e')]=_0xe3fb95['id'];this[_0x533c('0x91')]=_0x341baf;this['appdata']=_0x3738e6;}function createExtensionsReciveFax(_0x134813){var _0x33cda6=0x1;var _0x1f9e07=[];_0x1f9e07[_0x533c('0x92')](new Extension(_0x134813,_0x33cda6,'',_0x533c('0x93')));_0x33cda6+=0x1;_0x1f9e07['push'](new Extension(_0x134813,_0x33cda6,'CDR(type)=inbound-fax',_0x533c('0x94')));_0x33cda6+=0x1;for(var _0x45f639 in _0x134813){if(_0x134813[_0x533c('0x55')](_0x45f639)&&(_0x45f639===_0x533c('0x95')||_0x45f639===_0x533c('0x8e')||_0x45f639==='gateway'||_0x45f639===_0x533c('0x96')||_0x45f639==='headerinfo'||_0x45f639==='maxrate'||_0x45f639===_0x533c('0x97')||_0x45f639===_0x533c('0x98')||_0x45f639===_0x533c('0x99'))){_0x1f9e07[_0x533c('0x92')](new Extension(_0x134813,_0x33cda6,_0x533c('0x9a')+_0x45f639+')='+_0x134813[_0x45f639],_0x533c('0x94')));_0x33cda6+=0x1;}}_0x1f9e07[_0x533c('0x92')](new Extension(_0x134813,_0x33cda6,'6','Wait'));_0x33cda6+=0x1;_0x1f9e07['push'](new Extension(_0x134813,_0x33cda6,'/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',_0x533c('0x9b')));_0x33cda6=0x0;return _0x1f9e07;}exports[_0x533c('0x9c')]=function(_0x1612a1,_0x44faf2,_0x2f6398){var _0x5576df;return db[_0x533c('0x87')]['transaction'](function(_0xeb07b0){return db[_0x533c('0x49')][_0x533c('0x62')](_0x1612a1[_0x533c('0x6a')],{'transaction':_0xeb07b0})[_0x533c('0x26')](function(_0x3dabbe){_0x5576df=_0x3dabbe['get']({'plain':!![]});return db['VoiceExtension'][_0x533c('0x9d')](createExtensionsReciveFax(_0x5576df),{'transaction':_0xeb07b0});});})['then'](function(){return _0x5576df;})[_0x533c('0x26')](respondWithResult(_0x44faf2,null))['catch'](handleError(_0x44faf2,null));};exports[_0x533c('0x9e')]=function(_0x2a8876,_0x318baf,_0x753cf7){var _0x43f29c;return db[_0x533c('0x87')][_0x533c('0x88')](function(_0x3ef9da){return db[_0x533c('0x49')][_0x533c('0x3d')](_0x2a8876['body'],{'where':{'id':_0x2a8876['body']['id']},'transaction':_0x3ef9da})['then'](function(_0x2020cc){return db[_0x533c('0x9f')]['destroy']({'where':{'FaxAccountId':_0x2a8876[_0x533c('0x6a')]['id']},'transaction':_0x3ef9da})['then'](function(_0x43cf17){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0x533c('0x7c')](_0x2a8876[_0x533c('0x6a')],[_0x533c('0xa0'),'key','createdAt',_0x533c('0xa1'),_0x533c('0xa2'),_0x533c('0xa3')])),{'transaction':_0x3ef9da});});});})['then'](function(){return db['FaxAccount'][_0x533c('0xa4')](_0x2a8876[_0x533c('0x6a')]['id']);})[_0x533c('0x26')](respondWithResult(_0x318baf,null))[_0x533c('0x31')](handleError(_0x318baf,null));};exports[_0x533c('0xa5')]=function(_0x1dffbf,_0x1f7cbe,_0x213327){var _0xb877={'raw':!![],'where':{}};var _0x2ae07a={};var _0x47c02c={'count':0x0,'rows':[]};return db['FaxAccount'][_0x533c('0x86')]({'where':{'id':_0x1dffbf[_0x533c('0x6b')]['id']}})['then'](handleEntityNotFound(_0x1f7cbe,null))[_0x533c('0x26')](function(_0x52a1e8){if(_0x52a1e8){_0x2ae07a[_0x533c('0x4d')]=_['keys'](db[_0x533c('0xa6')]['rawAttributes']);_0x2ae07a[_0x533c('0x4e')]=_[_0x533c('0x4f')](_0x1dffbf['query']);_0x2ae07a['filters']=_[_0x533c('0x51')](_0x2ae07a[_0x533c('0x4d')],_0x2ae07a[_0x533c('0x4e')]);_0xb877[_0x533c('0x52')]=_[_0x533c('0x51')](_0x2ae07a['model'],qs[_0x533c('0x53')](_0x1dffbf[_0x533c('0x4e')][_0x533c('0x53')]));_0xb877[_0x533c('0x52')]=_0xb877[_0x533c('0x52')][_0x533c('0x54')]?_0xb877[_0x533c('0x52')]:_0x2ae07a[_0x533c('0x4d')];if(!_0x1dffbf['query'][_0x533c('0x55')](_0x533c('0x71'))){_0xb877[_0x533c('0x56')]=qs[_0x533c('0x56')](_0x1dffbf[_0x533c('0x4e')][_0x533c('0x56')]);_0xb877[_0x533c('0x37')]=qs[_0x533c('0x37')](_0x1dffbf[_0x533c('0x4e')]['offset']);}_0xb877['order']=qs[_0x533c('0x57')](_0x1dffbf[_0x533c('0x4e')][_0x533c('0x57')]);_0xb877['where']=qs['filters'](_['pick'](_0x1dffbf['query'],_0x2ae07a[_0x533c('0x50')]));_0xb877[_0x533c('0x58')]['FaxAccountId']=_0x52a1e8['id'];if(_0x1dffbf[_0x533c('0x4e')][_0x533c('0x5a')]){_0xb877[_0x533c('0x58')]=_[_0x533c('0x5b')](_0xb877[_0x533c('0x58')],{'$or':_[_0x533c('0x48')](_0xb877[_0x533c('0x52')],function(_0x4c27eb){var _0x2f4738={};_0x2f4738[_0x4c27eb]={'$like':'%'+_0x1dffbf[_0x533c('0x4e')]['filter']+'%'};return _0x2f4738;})});}if(_0x1dffbf[_0x533c('0x4e')][_0x533c('0xa7')]){var _0x29ab82=_0x1dffbf[_0x533c('0x4e')]['$gte'][_0x533c('0xa8')](',');var _0x379a77={};_0x379a77[_0x29ab82[0x0]]={'$gte':moment(_0x29ab82[0x1])[_0x533c('0xa9')](_0x533c('0xaa'))};_0xb877[_0x533c('0x58')]=_[_0x533c('0x5b')](_0xb877[_0x533c('0x58')],_0x379a77);}_0xb877=_[_0x533c('0x5b')]({},_0xb877,_0x1dffbf['options']);return db[_0x533c('0xa6')]['count']({'where':_0xb877[_0x533c('0x58')]})['then'](function(_0x10d8e5){_0x47c02c[_0x533c('0x36')]=_0x10d8e5;if(_0x1dffbf[_0x533c('0x4e')]['includeAll']){_0xb877[_0x533c('0x61')]=[{'all':!![]}];}return db[_0x533c('0xa6')][_0x533c('0x5f')](_0xb877);})[_0x533c('0x26')](function(_0x16c949){_0x47c02c[_0x533c('0x73')]=_0x16c949;return _0x47c02c;});}})[_0x533c('0x26')](respondWithFilteredResult(_0x1f7cbe,_0xb877))[_0x533c('0x31')](handleError(_0x1f7cbe,null));};exports['send']=function(_0x1cb474,_0x13b411,_0x19a89b){var _0x5cedfe,_0x460b20={},_0x319656;if(_0x1cb474[_0x533c('0x6a')]['to']){_0x319656=_0x1cb474[_0x533c('0x6a')]['to'][0x0];}return db[_0x533c('0x49')][_0x533c('0x66')]({'where':{'id':_0x1cb474[_0x533c('0x6b')]['id']},'include':[{'model':db[_0x533c('0xab')],'as':'List','include':[{'model':db[_0x533c('0xac')],'as':'Contacts','where':{'fax':_0x319656},'limit':0x1,'order':[['updatedAt',_0x533c('0xad')]]}]}]})[_0x533c('0x26')](handleEntityNotFound(_0x13b411,null))[_0x533c('0x26')](function(_0xb207cf){_0x5cedfe=_0xb207cf;if(_0x1cb474[_0x533c('0x6a')]['attachments']&&_0x1cb474[_0x533c('0x6a')]['attachments'][_0x533c('0x54')]){for(var _0x1a2853=0x0;_0x1a2853<_0x1cb474[_0x533c('0x6a')]['attachments'][_0x533c('0x54')];_0x1a2853+=0x1){_0x1cb474['body'][_0x533c('0xae')][_0x1a2853]={'filename':_0x1cb474[_0x533c('0x6a')][_0x533c('0xae')][_0x1a2853][_0x533c('0x43')],'id':_0x1cb474[_0x533c('0x6a')][_0x533c('0xae')][_0x1a2853]['id'],'path':path[_0x533c('0xaf')](config[_0x533c('0xb0')],'server/files/attachments',_0x1cb474['body'][_0x533c('0xae')][_0x1a2853][_0x533c('0xb1')])};}}return respondWithRpcPromise(_0x533c('0xb2'),_0x533c('0xb2'),{'FaxAccountId':_[_0x533c('0xb3')](_0x1cb474[_0x533c('0x6b')]['id'])?undefined:_0x1cb474[_0x533c('0x6b')]['id'],'path':_[_0x533c('0xb3')](_0x1cb474[_0x533c('0x6a')][_0x533c('0xae')][0x0][_0x533c('0x7')])?undefined:_0x1cb474[_0x533c('0x6a')]['attachments'][0x0][_0x533c('0x7')],'fax':_[_0x533c('0xb3')](_0x1cb474[_0x533c('0x6a')]['to'][0x0])?undefined:_0x1cb474[_0x533c('0x6a')]['to'][0x0]},client9002);})[_0x533c('0x26')](function(){if(_0x5cedfe){if(_[_0x533c('0xb3')](_0x1cb474[_0x533c('0x6a')][_0x533c('0xb4')])){_0x1cb474['body'][_0x533c('0xb4')]=util[_0x533c('0xa9')](_0x533c('0xb5'),_0x5cedfe[_0x533c('0x43')],_0x5cedfe[_0x533c('0xb6')]);}if(_0x5cedfe[_0x533c('0xb7')]){if(_0x5cedfe[_0x533c('0xb7')][_0x533c('0xb8')][_0x533c('0x54')]){return _0x5cedfe[_0x533c('0xb7')][_0x533c('0xb8')][0x0];}else{return db[_0x533c('0xac')][_0x533c('0x62')](_[_0x533c('0x1c')](_0x1cb474[_0x533c('0x6a')],{'firstName':_0x1cb474['body']['to'][0x0],'phone':_0x1cb474[_0x533c('0x6a')]['to'][0x0],'fax':_0x1cb474[_0x533c('0x6a')]['to'][0x0],'ListId':_0x5cedfe[_0x533c('0xa3')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x533c('0xb9'));}})['then'](function(_0x2d7b15){if(_0x2d7b15){return db[_0x533c('0x7b')]['find']({'where':{'ContactId':_0x2d7b15['id'],'closed':![],'FaxAccountId':_0x5cedfe['id']}})[_0x533c('0x26')](function(_0x1cd848){if(_0x1cd848){return[_0x1cd848,![]];}return db[_0x533c('0x7b')][_0x533c('0x62')]({'UserId':_0x1cb474['user']['id'],'ContactId':_0x2d7b15['id'],'FaxAccountId':_0x5cedfe['id'],'fax':_0x1cb474['body']['to'][0x0],'firstMsgDirection':_0x533c('0xba'),'Messages':[_[_0x533c('0x5b')](_0x1cb474[_0x533c('0x6a')],{'read':![],'body':_0x1cb474[_0x533c('0x6a')][_0x533c('0xae')][0x0]['filename'],'FaxAccountId':_0x5cedfe['id'],'UserId':_0x1cb474['user']['id'],'ContactId':_0x2d7b15['id'],'AttachmentId':_0x1cb474[_0x533c('0x6a')][_0x533c('0xae')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x533c('0xbb')}]})['then'](function(_0x5a6e68){return[_0x5a6e68,!![]];});});}else{throw new Error(_0x533c('0xbc'));}})[_0x533c('0xbd')](function(_0x4bc232,_0xf516a5){if(_0xf516a5){return _0x4bc232;}return db[_0x533c('0xa6')][_0x533c('0x62')]({'direction':_0x533c('0xba'),'read':![],'body':_0x1cb474[_0x533c('0x6a')][_0x533c('0xae')][0x0][_0x533c('0xbe')],'FaxAccountId':_0x5cedfe['id'],'FaxInteractionId':_0x4bc232['id'],'UserId':_0x1cb474[_0x533c('0x63')]['id'],'ContactId':_0x4bc232[_0x533c('0xbf')],'AttachmentId':_0x1cb474[_0x533c('0x6a')][_0x533c('0xae')][0x0]['id']})[_0x533c('0x26')](function(_0x3b1ba3){_0x4bc232['dataValues'][_0x533c('0xbb')]=[];_0x4bc232['dataValues'][_0x533c('0xbb')]['push'](_0x3b1ba3[_0x533c('0xc0')]);return _0x4bc232;});})['then'](function(_0x4f3b36){respondWithRpcPromise(_0x533c('0xc1'),'SendFax',{'FaxAccountId':_['isNil'](_0x1cb474[_0x533c('0x6b')]['id'])?undefined:_0x1cb474[_0x533c('0x6b')]['id'],'path':_[_0x533c('0xb3')](_0x1cb474[_0x533c('0x6a')]['attachments'][0x0][_0x533c('0x7')])?undefined:_0x1cb474[_0x533c('0x6a')][_0x533c('0xae')][0x0][_0x533c('0x7')],'fax':_[_0x533c('0xb3')](_0x1cb474[_0x533c('0x6a')]['to'][0x0])?undefined:_0x1cb474[_0x533c('0x6a')]['to'][0x0],'AttachmentId':_0x1cb474[_0x533c('0x6a')][_0x533c('0xae')][0x0]['id']},client9002)['then'](function(_0x4e6e89){logger['info'](_0x533c('0xc2'),_0x4e6e89);})[_0x533c('0x31')](function(_0x105c5f){logger[_0x533c('0x27')](_0x533c('0xc2'),_0x105c5f);});return _0x4f3b36;})[_0x533c('0x26')](respondWithResult(_0x13b411,null))[_0x533c('0x31')](handleError(_0x13b411,null));};exports[_0x533c('0xc3')]=function(_0x2015e3,_0x1e5c74,_0x56035f){return db[_0x533c('0x49')][_0x533c('0x66')]({'where':{'id':_0x2015e3['params']['id']}})[_0x533c('0x26')](handleEntityNotFound(_0x1e5c74,null))['then'](function(_0x334f92){if(_0x334f92){return _0x334f92[_0x533c('0xc3')](_0x2015e3[_0x533c('0x6a')][_0x533c('0x79')],_[_0x533c('0x7c')](_0x2015e3['body'],['ids','id'])||{})[_0x533c('0xbd')](function(_0xde79e2){for(var _0x2e3df4=0x0;_0x2e3df4<_0x2015e3[_0x533c('0x6a')][_0x533c('0x79')]['length'];_0x2e3df4+=0x1){socket[_0x533c('0xc4')](_0x533c('0xc5'),{'UserId':_0x2015e3[_0x533c('0x6a')][_0x533c('0x79')][_0x2e3df4],'FaxAccountId':_0x2015e3[_0x533c('0x6b')]['id']});}return _0xde79e2;});}})[_0x533c('0x26')](respondWithResult(_0x1e5c74,null))['catch'](handleError(_0x1e5c74,null));};exports[_0x533c('0xc6')]=function(_0x3de587,_0xbe45fd,_0xe0b3b3){return db['FaxAccount'][_0x533c('0x66')]({'where':{'id':_0x3de587[_0x533c('0x6b')]['id']}})['then'](handleEntityNotFound(_0xbe45fd,null))[_0x533c('0x26')](function(_0x4c61c2){if(_0x4c61c2){return _0x4c61c2[_0x533c('0xc6')](_0x3de587['query'][_0x533c('0x79')])['then'](function(){if(_[_0x533c('0xc7')](_0x3de587['query'][_0x533c('0x79')])){for(var _0x4177f6=0x0;_0x4177f6<_0x3de587[_0x533c('0x4e')][_0x533c('0x79')][_0x533c('0x54')];_0x4177f6+=0x1){socket[_0x533c('0xc4')](_0x533c('0xc8'),{'UserId':Number(_0x3de587[_0x533c('0x4e')][_0x533c('0x79')][_0x4177f6]),'FaxAccountId':Number(_0x3de587[_0x533c('0x6b')]['id'])});}}else{socket[_0x533c('0xc4')](_0x533c('0xc8'),{'UserId':Number(_0x3de587[_0x533c('0x4e')][_0x533c('0x79')]),'FaxAccountId':Number(_0x3de587[_0x533c('0x6b')]['id'])});}});}})['then'](respondWithStatusCode(_0xbe45fd,null))[_0x533c('0x31')](handleError(_0xbe45fd,null));};exports[_0x533c('0xc9')]=function(_0x14b970,_0x1612c2,_0x555617){var _0x33f610={};var _0x2c6728={};var _0x199d26;var _0x5b3e72;return db[_0x533c('0x49')][_0x533c('0x86')]({'where':{'id':_0x14b970['params']['id']}})['then'](handleEntityNotFound(_0x1612c2,null))[_0x533c('0x26')](function(_0x18a82a){if(_0x18a82a){_0x199d26=_0x18a82a;_0x2c6728[_0x533c('0x4d')]=_[_0x533c('0x4f')](db[_0x533c('0x7f')][_0x533c('0x4a')]);_0x2c6728['query']=_[_0x533c('0x4f')](_0x14b970[_0x533c('0x4e')]);_0x2c6728['filters']=_[_0x533c('0x51')](_0x2c6728[_0x533c('0x4d')],_0x2c6728[_0x533c('0x4e')]);_0x33f610[_0x533c('0x52')]=_['intersection'](_0x2c6728[_0x533c('0x4d')],qs[_0x533c('0x53')](_0x14b970['query'][_0x533c('0x53')]));_0x33f610['attributes']=_0x33f610['attributes'][_0x533c('0x54')]?_0x33f610['attributes']:_0x2c6728[_0x533c('0x4d')];_0x33f610[_0x533c('0x72')]=qs[_0x533c('0x57')](_0x14b970[_0x533c('0x4e')]['sort']);_0x33f610[_0x533c('0x58')]=qs[_0x533c('0x50')](_[_0x533c('0x59')](_0x14b970['query'],_0x2c6728['filters']));if(_0x14b970[_0x533c('0x4e')][_0x533c('0x5a')]){_0x33f610[_0x533c('0x58')]=_[_0x533c('0x5b')](_0x33f610[_0x533c('0x58')],{'$or':_[_0x533c('0x48')](_0x33f610[_0x533c('0x52')],function(_0x3231d5){var _0x357e25={};_0x357e25[_0x3231d5]={'$like':'%'+_0x14b970[_0x533c('0x4e')][_0x533c('0x5a')]+'%'};return _0x357e25;})});}_0x33f610=_['merge']({},_0x33f610,_0x14b970[_0x533c('0x5d')]);return _0x199d26[_0x533c('0xc9')](_0x33f610);}})[_0x533c('0x26')](function(_0x1c774f){if(_0x1c774f){_0x5b3e72=_0x1c774f['length'];if(!_0x14b970[_0x533c('0x4e')][_0x533c('0x55')]('nolimit')){_0x33f610[_0x533c('0x56')]=qs[_0x533c('0x56')](_0x14b970[_0x533c('0x4e')][_0x533c('0x56')]);_0x33f610[_0x533c('0x37')]=qs[_0x533c('0x37')](_0x14b970[_0x533c('0x4e')][_0x533c('0x37')]);}return _0x199d26[_0x533c('0xc9')](_0x33f610);}})[_0x533c('0x26')](function(_0x40692d){if(_0x40692d){return _0x40692d?{'count':_0x5b3e72,'rows':_0x40692d}:null;}})[_0x533c('0x26')](respondWithResult(_0x1612c2,null))['catch'](handleError(_0x1612c2,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 8edd729..1d184a6 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 _0x192b=['../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x32dc5a,_0x44b7ca){var _0x5d3945=function(_0x401b9c){while(--_0x401b9c){_0x32dc5a['push'](_0x32dc5a['shift']());}};_0x5d3945(++_0x44b7ca);}(_0x192b,0x82));var _0xb192=function(_0x2fbb95,_0x3a9af6){_0x2fbb95=_0x2fbb95-0x0;var _0x2b9ecb=_0x192b[_0x2fbb95];return _0x2b9ecb;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xb192('0x0'))['db'][_0xb192('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xb192('0x2')](0x0);var events={'afterCreate':_0xb192('0x3'),'afterUpdate':_0xb192('0x4'),'afterDestroy':_0xb192('0x5')};function emitEvent(_0x24b6be){return function(_0x2486b7,_0x2c2a6f,_0x386514){FaxAccountEvents[_0xb192('0x6')](_0x24b6be+':'+_0x2486b7['id'],_0x2486b7);FaxAccountEvents[_0xb192('0x6')](_0x24b6be,_0x2486b7);_0x386514(null);};}for(var e in events){if(events[_0xb192('0x7')](e)){var event=events[e];FaxAccount[_0xb192('0x8')](e,emitEvent(event));}}module[_0xb192('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0x3f69=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','emit'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3f69,0xf3));var _0x93f6=function(_0x50c89d,_0x52a3f9){_0x50c89d=_0x50c89d-0x0;var _0x1c7b06=_0x3f69[_0x50c89d];return _0x1c7b06;};'use strict';var EventEmitter=require(_0x93f6('0x0'));var FaxAccount=require(_0x93f6('0x1'))['db'][_0x93f6('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x93f6('0x3')](0x0);var events={'afterCreate':_0x93f6('0x4'),'afterUpdate':_0x93f6('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5a778e){return function(_0x56d6a8,_0x10bd58,_0x1eed0b){FaxAccountEvents['emit'](_0x5a778e+':'+_0x56d6a8['id'],_0x56d6a8);FaxAccountEvents[_0x93f6('0x6')](_0x5a778e,_0x56d6a8);_0x1eed0b(null);};}for(var e in events){if(events[_0x93f6('0x7')](e)){var event=events[e];FaxAccount[_0x93f6('0x8')](e,emitEvent(event));}}module[_0x93f6('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index db1fe80..558eece 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 _0x8e5b=['path','rimraf','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x41f88d,_0x1cb1d8){var _0x5617aa=function(_0x2c14aa){while(--_0x2c14aa){_0x41f88d['push'](_0x41f88d['shift']());}};_0x5617aa(++_0x1cb1d8);}(_0x8e5b,0x125));var _0xb8e5=function(_0x20e266,_0x52b972){_0x20e266=_0x20e266-0x0;var _0x2baeca=_0x8e5b[_0x20e266];return _0x2baeca;};'use strict';var _=require(_0xb8e5('0x0'));var util=require('util');var logger=require(_0xb8e5('0x1'))(_0xb8e5('0x2'));var moment=require(_0xb8e5('0x3'));var BPromise=require(_0xb8e5('0x4'));var rp=require(_0xb8e5('0x5'));var fs=require('fs');var path=require(_0xb8e5('0x6'));var rimraf=require(_0xb8e5('0x7'));var config=require('../../config/environment');var attributes=require(_0xb8e5('0x8'));module[_0xb8e5('0x9')]=function(_0x8d750d,_0x123374){return _0x8d750d[_0xb8e5('0xa')](_0xb8e5('0xb'),attributes,{'tableName':_0xb8e5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0266=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','fax_accounts','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0266,0x194));var _0x6026=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0266[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x6026('0x0'));var logger=require(_0x6026('0x1'))(_0x6026('0x2'));var moment=require(_0x6026('0x3'));var BPromise=require(_0x6026('0x4'));var rp=require(_0x6026('0x5'));var fs=require('fs');var path=require(_0x6026('0x6'));var rimraf=require(_0x6026('0x7'));var config=require(_0x6026('0x8'));var attributes=require('./faxAccount.attributes');module[_0x6026('0x9')]=function(_0x2c9882,_0x5a2e59){return _0x2c9882[_0x6026('0xa')]('FaxAccount',attributes,{'tableName':_0x6026('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 9192c9e..5d91915 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 _0xfc26=['FaxMessage','AttachmentId','User','name','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','defaults','redis','socket.io-emitter','./faxAccount.socket','register','request','then','debug','request\x20sent','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','info','catch','GetFaxAccount','findAll','options','raw','where','attributes','limit','include','model','map','NotifyFaxAccount','body','fax','CmContact','describe','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','isNil','from','ValidationError','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','List','DESC','FaxApplication','Applications','applications','list','orderBy','priority','asc','account','Contacts','length','ListId','create','contact','FaxInteraction','Contact\x20not\x20found','spread','get','push','close','*,*,*,*','created','interaction'];(function(_0x3f7ba9,_0xa85c88){var _0x22ca79=function(_0x465a0e){while(--_0x465a0e){_0x3f7ba9['push'](_0x3f7ba9['shift']());}};_0x22ca79(++_0xa85c88);}(_0xfc26,0x115));var _0x6fc2=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0xfc26[_0x19b3f9];return _0x18c3f6;};'use strict';var _=require(_0x6fc2('0x0'));var util=require('util');var moment=require(_0x6fc2('0x1'));var BPromise=require('bluebird');var rs=require(_0x6fc2('0x2'));var fs=require('fs');var Redis=require(_0x6fc2('0x3'));var db=require(_0x6fc2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6fc2('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6fc2('0x6'));var client=jayson[_0x6fc2('0x7')][_0x6fc2('0x8')]({'port':0x232c});config['redis']=_[_0x6fc2('0x9')](config[_0x6fc2('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6fc2('0xb'))(new Redis(config[_0x6fc2('0xa')]));require(_0x6fc2('0xc'))[_0x6fc2('0xd')](socket);function respondWithRpcPromise(_0x33f2ea,_0x2915b7,_0x1e4121){return new BPromise(function(_0x31eb53,_0x430f5e){return client[_0x6fc2('0xe')](_0x33f2ea,_0x1e4121)[_0x6fc2('0xf')](function(_0x224880){logger['info']('FaxAccount,\x20%s,\x20%s',_0x2915b7,'request\x20sent');logger[_0x6fc2('0x10')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2915b7,_0x6fc2('0x11'),JSON[_0x6fc2('0x12')](_0x224880));if(_0x224880[_0x6fc2('0x13')]){if(_0x224880[_0x6fc2('0x13')][_0x6fc2('0x14')]===0x1f4){logger[_0x6fc2('0x13')](_0x6fc2('0x15'),_0x2915b7,_0x224880['error'][_0x6fc2('0x16')]);return _0x430f5e(_0x224880['error'][_0x6fc2('0x16')]);}logger['error'](_0x6fc2('0x15'),_0x2915b7,_0x224880['error'][_0x6fc2('0x16')]);return _0x31eb53(_0x224880[_0x6fc2('0x13')][_0x6fc2('0x16')]);}else{logger[_0x6fc2('0x17')]('FaxAccount,\x20%s,\x20%s',_0x2915b7,_0x6fc2('0x11'));_0x31eb53(_0x224880['result'][_0x6fc2('0x16')]);}})[_0x6fc2('0x18')](function(_0x5af6c2){logger[_0x6fc2('0x13')]('FaxAccount,\x20%s,\x20%s',_0x2915b7,_0x5af6c2);_0x430f5e(_0x5af6c2);});});}exports[_0x6fc2('0x19')]=function(_0x4f5956){var _0x4e826e=this;return new Promise(function(_0x51cdaa,_0x813b96){return db['FaxAccount'][_0x6fc2('0x1a')]({'raw':_0x4f5956[_0x6fc2('0x1b')]?_0x4f5956[_0x6fc2('0x1b')][_0x6fc2('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f5956[_0x6fc2('0x1b')]?_0x4f5956[_0x6fc2('0x1b')][_0x6fc2('0x1d')]||null:null,'attributes':_0x4f5956['options']?_0x4f5956[_0x6fc2('0x1b')][_0x6fc2('0x1e')]||null:null,'limit':_0x4f5956[_0x6fc2('0x1b')]?_0x4f5956[_0x6fc2('0x1b')][_0x6fc2('0x1f')]||null:null,'include':_0x4f5956[_0x6fc2('0x1b')]?_0x4f5956[_0x6fc2('0x1b')][_0x6fc2('0x20')]?_['map'](_0x4f5956['options'][_0x6fc2('0x20')],function(_0x25f7c5){return{'model':db[_0x25f7c5[_0x6fc2('0x21')]],'as':_0x25f7c5['as'],'attributes':_0x25f7c5[_0x6fc2('0x1e')],'include':_0x25f7c5[_0x6fc2('0x20')]?_[_0x6fc2('0x22')](_0x25f7c5['include'],function(_0x3d243c){return{'model':db[_0x3d243c[_0x6fc2('0x21')]],'as':_0x3d243c['as'],'attributes':_0x3d243c[_0x6fc2('0x1e')],'include':_0x3d243c[_0x6fc2('0x20')]?_[_0x6fc2('0x22')](_0x3d243c[_0x6fc2('0x20')],function(_0x55dd3f){return{'model':db[_0x55dd3f[_0x6fc2('0x21')]],'as':_0x55dd3f['as'],'attributes':_0x55dd3f[_0x6fc2('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6fc2('0xf')](function(_0xd7fcc2){logger[_0x6fc2('0x17')]('GetFaxAccount',_0x4f5956);logger[_0x6fc2('0x10')]('GetFaxAccount',_0x4f5956,JSON[_0x6fc2('0x12')](_0xd7fcc2));_0x51cdaa(_0xd7fcc2);})[_0x6fc2('0x18')](function(_0xa219b7){logger[_0x6fc2('0x13')](_0x6fc2('0x19'),_0xa219b7[_0x6fc2('0x16')],_0x4f5956);_0x813b96(_0x4e826e[_0x6fc2('0x13')](0x1f4,_0xa219b7[_0x6fc2('0x16')]));});});};exports[_0x6fc2('0x23')]=function(_0x439461,_0x26404b,_0xf9820c){var _0x580b68=this;return new Promise(function(_0x42c960,_0x51e75c){var _0x3a6c1e={'body':_0x439461[_0x6fc2('0x24')],'channel':_0x6fc2('0x25')};var _0x3dbba6=[];var _0x3e350d=[];var _0xa42273={};return db[_0x6fc2('0x26')][_0x6fc2('0x27')]()['then'](function(_0x20f8eb){if(!_0x20f8eb){throw new db['Sequelize']['ValidationError'](_0x6fc2('0x28'));}_0x3dbba6=_[_0x6fc2('0x29')](_[_0x6fc2('0x2a')](_0x20f8eb),['createdAt','updatedAt']);_0x3e350d=_[_0x6fc2('0x29')](_[_0x6fc2('0x2a')](_0x20f8eb),[_0x6fc2('0x2b'),_0x6fc2('0x2c'),'CompanyId','ListId']);if(_0x439461[_0x6fc2('0x24')]['id']){delete _0x439461[_0x6fc2('0x24')]['id'];}if(_[_0x6fc2('0x2d')](_0x439461['body'][_0x6fc2('0x2e')])){throw new db['Sequelize'][(_0x6fc2('0x2f'))](_0x6fc2('0x30'));}if(_[_0x6fc2('0x2d')](_0x439461[_0x6fc2('0x24')][_0x6fc2('0x24')])||_0x439461[_0x6fc2('0x24')][_0x6fc2('0x24')]===''){throw new db[(_0x6fc2('0x31'))][(_0x6fc2('0x2f'))](_0x6fc2('0x32'));}if(_[_0x6fc2('0x2d')](_0x439461[_0x6fc2('0x24')][_0x6fc2('0x33')])){throw new db[(_0x6fc2('0x31'))][(_0x6fc2('0x2f'))](_0x6fc2('0x34')+_0x3e350d);}if(!_['includes'](_0x3e350d,_0x439461['body'][_0x6fc2('0x33')])){throw new db[(_0x6fc2('0x31'))][(_0x6fc2('0x2f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3e350d);}_0xa42273[_0x439461[_0x6fc2('0x24')]['mapKey']]=_0x439461[_0x6fc2('0x24')][_0x6fc2('0x2e')];})[_0x6fc2('0xf')](function(){return db[_0x6fc2('0x35')][_0x6fc2('0x36')]({'where':{'id':_0x439461['account']['id']},'include':[{'model':db['CmList'],'as':_0x6fc2('0x37'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0xa42273,'limit':0x1,'order':[[_0x6fc2('0x2c'),_0x6fc2('0x38')]]}]},{'model':db[_0x6fc2('0x39')],'as':_0x6fc2('0x3a')}]});})[_0x6fc2('0xf')](function(_0x2e66fe){if(_0x2e66fe&&_0x2e66fe['List']){var _0x32f969=_0x2e66fe['get']({'plain':!![]});_0x3a6c1e['account']=_0x32f969;_0x3a6c1e[_0x6fc2('0x3b')]=_0x32f969['Applications'];_0x3a6c1e[_0x6fc2('0x3c')]=_0x32f969[_0x6fc2('0x37')];_0x3a6c1e['applications']=_[_0x6fc2('0x3d')](_0x3a6c1e['applications'],[_0x6fc2('0x3e')],[_0x6fc2('0x3f')]);if(_0x3a6c1e['account'][_0x6fc2('0x3a')]){delete _0x3a6c1e[_0x6fc2('0x40')][_0x6fc2('0x3a')];}if(_0x3a6c1e[_0x6fc2('0x40')][_0x6fc2('0x37')]&&_0x3a6c1e[_0x6fc2('0x40')][_0x6fc2('0x37')][_0x6fc2('0x41')][_0x6fc2('0x42')]){return _0x3a6c1e[_0x6fc2('0x40')]['List'][_0x6fc2('0x41')][0x0];}var _0x3ed3ea=_['defaults'](_0x439461['body'],{'firstName':_0x439461['body'][_0x6fc2('0x2e')],'ListId':_0x32f969[_0x6fc2('0x43')]});_0x3ed3ea[_0x439461[_0x6fc2('0x24')][_0x6fc2('0x33')]]=_0x439461['body']['from'];return db[_0x6fc2('0x26')][_0x6fc2('0x44')](_0x3ed3ea,{'fields':_0x3dbba6,'raw':!![]});}})['then'](function(_0x1a36f4){_0x3a6c1e[_0x6fc2('0x45')]=_0x1a36f4;if(_0x1a36f4){var _0x1b6501={'ContactId':_0x1a36f4['id'],'FaxAccountId':_0x439461['account']['id'],'fax':_0x1a36f4[_0x6fc2('0x25')]};return db['FaxInteraction'][_0x6fc2('0x36')]({'where':{'ContactId':_0x1a36f4['id'],'closed':![],'FaxAccountId':_0x439461[_0x6fc2('0x40')]['id']}})[_0x6fc2('0xf')](function(_0x3957d8){if(_0x3957d8){return[_0x3957d8,![]];}return db[_0x6fc2('0x46')][_0x6fc2('0x44')](_0x1b6501)[_0x6fc2('0xf')](function(_0x4f638f){return[_0x4f638f,!![]];});});}else{throw new Error(_0x6fc2('0x47'));}})[_0x6fc2('0x48')](function(_0x59929d,_0x52ead3){var _0x140849=_0x59929d[_0x6fc2('0x49')]({'plain':!![]});if(_0x52ead3){if(_0x3a6c1e[_0x6fc2('0x40')]['autoclose']){_0x3a6c1e[_0x6fc2('0x3b')][_0x6fc2('0x4a')]({'id':0x0,'priority':_0x3a6c1e['applications']['length']+0x1,'app':_0x6fc2('0x4b'),'appdata':'unmanaged','interval':_0x6fc2('0x4c')});}_0x140849[_0x6fc2('0x4d')]=!![];}else{_0x140849[_0x6fc2('0x4d')]=![];}_0x3a6c1e[_0x6fc2('0x4e')]=_0x140849;return db[_0x6fc2('0x4f')]['create']({'body':_0x439461[_0x6fc2('0x24')]['body'],'FaxAccountId':_0x439461['account']['id'],'FaxInteractionId':_0x59929d['id'],'direction':'in','ContactId':_0x59929d['ContactId'],'AttachmentId':_0x439461[_0x6fc2('0x24')][_0x6fc2('0x50')]});})[_0x6fc2('0xf')](function(_0x180e64){_0x3a6c1e[_0x6fc2('0x16')]=_0x180e64;if(_0x3a6c1e[_0x6fc2('0x4e')]['UserId']){return db[_0x6fc2('0x51')][_0x6fc2('0x36')]({'attributes':['id',_0x6fc2('0x52')],'where':{'id':_0x3a6c1e['interaction'][_0x6fc2('0x53')]}})[_0x6fc2('0xf')](function(_0x18b955){if(_0x18b955){_0x3a6c1e[_0x6fc2('0x3b')][_0x6fc2('0x54')]({'id':0x0,'priority':0x0,'app':_0x6fc2('0x55'),'appdata':_0x18b955['name']+','+(_0x3a6c1e[_0x6fc2('0x40')][_0x6fc2('0x56')]||0xa),'interval':_0x6fc2('0x4c')});}return respondWithRpcPromise(_0x6fc2('0x57'),_0x6fc2('0x58'),_0x3a6c1e);});}return respondWithRpcPromise(_0x6fc2('0x57'),_0x6fc2('0x58'),_0x3a6c1e);})['then'](function(_0x18ee36){_0x42c960(_0x18ee36);})['catch'](function(_0x5ecdc0){_0x51e75c(_0x580b68[_0x6fc2('0x13')](0x1f4,_0x5ecdc0[_0x6fc2('0x16')]));});});}; \ No newline at end of file +var _0xb9c2=['account','CmList','List','Applications','get','applications','orderBy','priority','asc','length','contact','create','Contact\x20not\x20found','spread','autoclose','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','register','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','include','map','model','NotifyFaxAccount','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','keys','CompanyId','ListId','body','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find'];(function(_0x432c73,_0x1df9da){var _0x5d7baa=function(_0x303ca5){while(--_0x303ca5){_0x432c73['push'](_0x432c73['shift']());}};_0x5d7baa(++_0x1df9da);}(_0xb9c2,0x72));var _0x2b9c=function(_0x47c6b9,_0x210b3c){_0x47c6b9=_0x47c6b9-0x0;var _0x34f34d=_0xb9c2[_0x47c6b9];return _0x34f34d;};'use strict';var _=require('lodash');var util=require(_0x2b9c('0x0'));var moment=require(_0x2b9c('0x1'));var BPromise=require(_0x2b9c('0x2'));var rs=require(_0x2b9c('0x3'));var fs=require('fs');var Redis=require(_0x2b9c('0x4'));var db=require(_0x2b9c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2b9c('0x6'))(_0x2b9c('0x7'));var config=require(_0x2b9c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2b9c('0x9')][_0x2b9c('0xa')]({'port':0x232c});config[_0x2b9c('0xb')]=_[_0x2b9c('0xc')](config[_0x2b9c('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxAccount.socket')[_0x2b9c('0xd')](socket);function respondWithRpcPromise(_0x4d39a0,_0x5dd9ae,_0x4eb723){return new BPromise(function(_0x49af93,_0x5286a1){return client[_0x2b9c('0xe')](_0x4d39a0,_0x4eb723)[_0x2b9c('0xf')](function(_0x481081){logger[_0x2b9c('0x10')]('FaxAccount,\x20%s,\x20%s',_0x5dd9ae,_0x2b9c('0x11'));logger[_0x2b9c('0x12')](_0x2b9c('0x13'),_0x5dd9ae,_0x2b9c('0x11'),JSON[_0x2b9c('0x14')](_0x481081));if(_0x481081[_0x2b9c('0x15')]){if(_0x481081[_0x2b9c('0x15')][_0x2b9c('0x16')]===0x1f4){logger[_0x2b9c('0x15')](_0x2b9c('0x17'),_0x5dd9ae,_0x481081[_0x2b9c('0x15')][_0x2b9c('0x18')]);return _0x5286a1(_0x481081['error'][_0x2b9c('0x18')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x5dd9ae,_0x481081['error'][_0x2b9c('0x18')]);return _0x49af93(_0x481081[_0x2b9c('0x15')][_0x2b9c('0x18')]);}else{logger[_0x2b9c('0x10')](_0x2b9c('0x17'),_0x5dd9ae,_0x2b9c('0x11'));_0x49af93(_0x481081['result'][_0x2b9c('0x18')]);}})[_0x2b9c('0x19')](function(_0x2802e0){logger[_0x2b9c('0x15')](_0x2b9c('0x17'),_0x5dd9ae,_0x2802e0);_0x5286a1(_0x2802e0);});});}exports[_0x2b9c('0x1a')]=function(_0x5cfb4f){var _0x323b44=this;return new Promise(function(_0x301e01,_0x46b891){return db[_0x2b9c('0x1b')][_0x2b9c('0x1c')]({'raw':_0x5cfb4f[_0x2b9c('0x1d')]?_0x5cfb4f[_0x2b9c('0x1d')][_0x2b9c('0x1e')]===undefined?!![]:![]:!![],'where':_0x5cfb4f['options']?_0x5cfb4f[_0x2b9c('0x1d')]['where']||null:null,'attributes':_0x5cfb4f[_0x2b9c('0x1d')]?_0x5cfb4f[_0x2b9c('0x1d')][_0x2b9c('0x1f')]||null:null,'limit':_0x5cfb4f[_0x2b9c('0x1d')]?_0x5cfb4f[_0x2b9c('0x1d')][_0x2b9c('0x20')]||null:null,'include':_0x5cfb4f[_0x2b9c('0x1d')]?_0x5cfb4f[_0x2b9c('0x1d')][_0x2b9c('0x21')]?_[_0x2b9c('0x22')](_0x5cfb4f[_0x2b9c('0x1d')]['include'],function(_0x30c71b){return{'model':db[_0x30c71b[_0x2b9c('0x23')]],'as':_0x30c71b['as'],'attributes':_0x30c71b['attributes'],'include':_0x30c71b['include']?_[_0x2b9c('0x22')](_0x30c71b[_0x2b9c('0x21')],function(_0x1ebb15){return{'model':db[_0x1ebb15[_0x2b9c('0x23')]],'as':_0x1ebb15['as'],'attributes':_0x1ebb15[_0x2b9c('0x1f')],'include':_0x1ebb15[_0x2b9c('0x21')]?_[_0x2b9c('0x22')](_0x1ebb15['include'],function(_0x54b022){return{'model':db[_0x54b022['model']],'as':_0x54b022['as'],'attributes':_0x54b022['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x36c8bd){logger[_0x2b9c('0x10')](_0x2b9c('0x1a'),_0x5cfb4f);logger[_0x2b9c('0x12')]('GetFaxAccount',_0x5cfb4f,JSON['stringify'](_0x36c8bd));_0x301e01(_0x36c8bd);})[_0x2b9c('0x19')](function(_0x107e11){logger['error'](_0x2b9c('0x1a'),_0x107e11[_0x2b9c('0x18')],_0x5cfb4f);_0x46b891(_0x323b44['error'](0x1f4,_0x107e11[_0x2b9c('0x18')]));});});};exports[_0x2b9c('0x24')]=function(_0x19909c,_0x19104e,_0x379d40){var _0x315829=this;return new Promise(function(_0x15ce18,_0x48944b){var _0x11b8fd={'body':_0x19909c['body'],'channel':'fax'};var _0x2598d4=[];var _0x46978c=[];var _0x3a529c={};return db[_0x2b9c('0x25')]['describe']()[_0x2b9c('0xf')](function(_0x18c891){if(!_0x18c891){throw new db[(_0x2b9c('0x26'))][(_0x2b9c('0x27'))](_0x2b9c('0x28'));}_0x2598d4=_['difference'](_['keys'](_0x18c891),[_0x2b9c('0x29'),_0x2b9c('0x2a')]);_0x46978c=_[_0x2b9c('0x2b')](_[_0x2b9c('0x2c')](_0x18c891),[_0x2b9c('0x29'),_0x2b9c('0x2a'),_0x2b9c('0x2d'),_0x2b9c('0x2e')]);if(_0x19909c['body']['id']){delete _0x19909c[_0x2b9c('0x2f')]['id'];}if(_[_0x2b9c('0x30')](_0x19909c[_0x2b9c('0x2f')][_0x2b9c('0x31')])){throw new db['Sequelize'][(_0x2b9c('0x27'))]('from\x20is\x20mandatory');}if(_[_0x2b9c('0x30')](_0x19909c['body'][_0x2b9c('0x2f')])||_0x19909c[_0x2b9c('0x2f')][_0x2b9c('0x2f')]===''){throw new db[(_0x2b9c('0x26'))][(_0x2b9c('0x27'))](_0x2b9c('0x32'));}if(_['isNil'](_0x19909c[_0x2b9c('0x2f')][_0x2b9c('0x33')])){throw new db[(_0x2b9c('0x26'))][(_0x2b9c('0x27'))](_0x2b9c('0x34')+_0x46978c);}if(!_[_0x2b9c('0x35')](_0x46978c,_0x19909c[_0x2b9c('0x2f')][_0x2b9c('0x33')])){throw new db[(_0x2b9c('0x26'))][(_0x2b9c('0x27'))](_0x2b9c('0x36')+_0x46978c);}_0x3a529c[_0x19909c['body'][_0x2b9c('0x33')]]=_0x19909c[_0x2b9c('0x2f')]['from'];})[_0x2b9c('0xf')](function(){return db['FaxAccount'][_0x2b9c('0x37')]({'where':{'id':_0x19909c[_0x2b9c('0x38')]['id']},'include':[{'model':db[_0x2b9c('0x39')],'as':_0x2b9c('0x3a'),'include':[{'model':db[_0x2b9c('0x25')],'as':'Contacts','where':_0x3a529c,'limit':0x1,'order':[[_0x2b9c('0x2a'),'DESC']]}]},{'model':db['FaxApplication'],'as':_0x2b9c('0x3b')}]});})[_0x2b9c('0xf')](function(_0x209e62){if(_0x209e62&&_0x209e62[_0x2b9c('0x3a')]){var _0xc63bd8=_0x209e62[_0x2b9c('0x3c')]({'plain':!![]});_0x11b8fd[_0x2b9c('0x38')]=_0xc63bd8;_0x11b8fd[_0x2b9c('0x3d')]=_0xc63bd8[_0x2b9c('0x3b')];_0x11b8fd['list']=_0xc63bd8[_0x2b9c('0x3a')];_0x11b8fd[_0x2b9c('0x3d')]=_[_0x2b9c('0x3e')](_0x11b8fd['applications'],[_0x2b9c('0x3f')],[_0x2b9c('0x40')]);if(_0x11b8fd[_0x2b9c('0x38')][_0x2b9c('0x3b')]){delete _0x11b8fd[_0x2b9c('0x38')]['Applications'];}if(_0x11b8fd['account'][_0x2b9c('0x3a')]&&_0x11b8fd[_0x2b9c('0x38')][_0x2b9c('0x3a')]['Contacts'][_0x2b9c('0x41')]){return _0x11b8fd[_0x2b9c('0x38')][_0x2b9c('0x3a')]['Contacts'][0x0];}var _0x2c4f91=_['defaults'](_0x19909c[_0x2b9c('0x2f')],{'firstName':_0x19909c['body']['from'],'ListId':_0xc63bd8[_0x2b9c('0x2e')]});_0x2c4f91[_0x19909c[_0x2b9c('0x2f')]['mapKey']]=_0x19909c[_0x2b9c('0x2f')][_0x2b9c('0x31')];return db[_0x2b9c('0x25')]['create'](_0x2c4f91,{'fields':_0x2598d4,'raw':!![]});}})[_0x2b9c('0xf')](function(_0x178ec8){_0x11b8fd[_0x2b9c('0x42')]=_0x178ec8;if(_0x178ec8){var _0x24ead6={'ContactId':_0x178ec8['id'],'FaxAccountId':_0x19909c['account']['id'],'fax':_0x178ec8['fax']};return db['FaxInteraction'][_0x2b9c('0x37')]({'where':{'ContactId':_0x178ec8['id'],'closed':![],'FaxAccountId':_0x19909c[_0x2b9c('0x38')]['id']}})[_0x2b9c('0xf')](function(_0x2d0078){if(_0x2d0078){return[_0x2d0078,![]];}return db['FaxInteraction'][_0x2b9c('0x43')](_0x24ead6)[_0x2b9c('0xf')](function(_0x3d156d){return[_0x3d156d,!![]];});});}else{throw new Error(_0x2b9c('0x44'));}})[_0x2b9c('0x45')](function(_0x2d79d6,_0x3300a4){var _0x1cd205=_0x2d79d6[_0x2b9c('0x3c')]({'plain':!![]});if(_0x3300a4){if(_0x11b8fd['account'][_0x2b9c('0x46')]){_0x11b8fd[_0x2b9c('0x3d')]['push']({'id':0x0,'priority':_0x11b8fd[_0x2b9c('0x3d')][_0x2b9c('0x41')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x2b9c('0x47')});}_0x1cd205['created']=!![];}else{_0x1cd205[_0x2b9c('0x48')]=![];}_0x11b8fd[_0x2b9c('0x49')]=_0x1cd205;return db[_0x2b9c('0x4a')]['create']({'body':_0x19909c[_0x2b9c('0x2f')][_0x2b9c('0x2f')],'FaxAccountId':_0x19909c[_0x2b9c('0x38')]['id'],'FaxInteractionId':_0x2d79d6['id'],'direction':'in','ContactId':_0x2d79d6[_0x2b9c('0x4b')],'AttachmentId':_0x19909c[_0x2b9c('0x2f')][_0x2b9c('0x4c')]});})[_0x2b9c('0xf')](function(_0x3b29de){_0x11b8fd[_0x2b9c('0x18')]=_0x3b29de;if(_0x11b8fd[_0x2b9c('0x49')][_0x2b9c('0x4d')]){return db[_0x2b9c('0x4e')][_0x2b9c('0x37')]({'attributes':['id',_0x2b9c('0x4f')],'where':{'id':_0x11b8fd[_0x2b9c('0x49')]['UserId']}})[_0x2b9c('0xf')](function(_0x4e1a74){if(_0x4e1a74){_0x11b8fd['applications'][_0x2b9c('0x50')]({'id':0x0,'priority':0x0,'app':_0x2b9c('0x51'),'appdata':_0x4e1a74[_0x2b9c('0x4f')]+','+(_0x11b8fd['account'][_0x2b9c('0x52')]||0xa),'interval':_0x2b9c('0x47')});}return respondWithRpcPromise(_0x2b9c('0x53'),_0x2b9c('0x54'),_0x11b8fd);});}return respondWithRpcPromise(_0x2b9c('0x53'),_0x2b9c('0x54'),_0x11b8fd);})['then'](function(_0x1fcc1e){_0x15ce18(_0x1fcc1e);})[_0x2b9c('0x19')](function(_0xa608ed){_0x48944b(_0x315829['error'](0x1f4,_0xa608ed[_0x2b9c('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index e499b65..65237e9 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 _0xdb28=['remove','update','emit','register','length','faxAccount:','./faxAccount.events','save'];(function(_0x167a71,_0x68d27d){var _0x3778c5=function(_0x2e8b76){while(--_0x2e8b76){_0x167a71['push'](_0x167a71['shift']());}};_0x3778c5(++_0x68d27d);}(_0xdb28,0x106));var _0x8db2=function(_0x545ce3,_0xe88d98){_0x545ce3=_0x545ce3-0x0;var _0x9dbbb=_0xdb28[_0x545ce3];return _0x9dbbb;};'use strict';var FaxAccountEvents=require(_0x8db2('0x0'));var events=[_0x8db2('0x1'),_0x8db2('0x2'),_0x8db2('0x3')];function createListener(_0x585da1,_0x1f4c45){return function(_0x11c26d){_0x1f4c45[_0x8db2('0x4')](_0x585da1,_0x11c26d);};}function removeListener(_0x4426fe,_0x11109e){return function(){FaxAccountEvents['removeListener'](_0x4426fe,_0x11109e);};}exports[_0x8db2('0x5')]=function(_0x1d2dd3){for(var _0x5f42ee=0x0,_0x494b40=events[_0x8db2('0x6')];_0x5f42ee<_0x494b40;_0x5f42ee++){var _0x46932f=events[_0x5f42ee];var _0x131537=createListener(_0x8db2('0x7')+_0x46932f,_0x1d2dd3);FaxAccountEvents['on'](_0x46932f,_0x131537);}}; \ No newline at end of file +var _0x958a=['register','length','./faxAccount.events','save','update','emit'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x958a,0x128));var _0xa958=function(_0x1c5de1,_0x1ae6c5){_0x1c5de1=_0x1c5de1-0x0;var _0x66cb5e=_0x958a[_0x1c5de1];return _0x66cb5e;};'use strict';var FaxAccountEvents=require(_0xa958('0x0'));var events=[_0xa958('0x1'),'remove',_0xa958('0x2')];function createListener(_0x24e669,_0xa48257){return function(_0x3079b4){_0xa48257[_0xa958('0x3')](_0x24e669,_0x3079b4);};}function removeListener(_0x5194f8,_0x3424b0){return function(){FaxAccountEvents['removeListener'](_0x5194f8,_0x3424b0);};}exports[_0xa958('0x4')]=function(_0x9b7d9e){for(var _0x2692d6=0x0,_0x3ddaa9=events[_0xa958('0x5')];_0x2692d6<_0x3ddaa9;_0x2692d6++){var _0x3b2693=events[_0x2692d6];var _0x1895da=createListener('faxAccount:'+_0x3b2693,_0x9b7d9e);FaxAccountEvents['on'](_0x3b2693,_0x1895da);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 9f86aba..b50c639 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 _0xee7e=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','getApplications','/:id/messages','/:id/users','create','addDisposition','post','addAnswer','addInteraction','/:id/applications','addApplications','/addaccountapplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x40c402,_0x42ee7d){var _0x4e7680=function(_0x52b150){while(--_0x52b150){_0x40c402['push'](_0x40c402['shift']());}};_0x4e7680(++_0x42ee7d);}(_0xee7e,0xca));var _0xeee7=function(_0x2a6b4b,_0x3d063e){_0x2a6b4b=_0x2a6b4b-0x0;var _0x47c88a=_0xee7e[_0x2a6b4b];return _0x47c88a;};'use strict';var multer=require(_0xeee7('0x0'));var util=require(_0xeee7('0x1'));var path=require(_0xeee7('0x2'));var timeout=require(_0xeee7('0x3'));var express=require('express');var router=express[_0xeee7('0x4')]();var auth=require(_0xeee7('0x5'));var interaction=require(_0xeee7('0x6'));var config=require(_0xeee7('0x7'));var controller=require('./faxAccount.controller');router[_0xeee7('0x8')]('/',auth[_0xeee7('0x9')](),controller[_0xeee7('0xa')]);router['get'](_0xeee7('0xb'),auth[_0xeee7('0x9')](),controller[_0xeee7('0xc')]);router[_0xeee7('0x8')](_0xeee7('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0xeee7('0xe'),auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0xeee7('0xf'),auth['isAuthenticated'](),controller[_0xeee7('0x10')]);router[_0xeee7('0x8')](_0xeee7('0x11'),auth[_0xeee7('0x9')](),controller[_0xeee7('0x12')]);router['get']('/:id/applications',auth[_0xeee7('0x9')](),controller[_0xeee7('0x13')]);router[_0xeee7('0x8')](_0xeee7('0x14'),auth['isAuthenticated'](),controller['getMessages']);router[_0xeee7('0x8')](_0xeee7('0x15'),auth[_0xeee7('0x9')](),controller['getAgents']);router['post']('/',auth[_0xeee7('0x9')](),controller[_0xeee7('0x16')]);router['post'](_0xeee7('0xe'),auth['isAuthenticated'](),controller[_0xeee7('0x17')]);router[_0xeee7('0x18')](_0xeee7('0xf'),auth[_0xeee7('0x9')](),controller[_0xeee7('0x19')]);router[_0xeee7('0x18')](_0xeee7('0x11'),auth[_0xeee7('0x9')](),controller[_0xeee7('0x1a')]);router['post'](_0xeee7('0x1b'),auth['isAuthenticated'](),controller[_0xeee7('0x1c')]);router[_0xeee7('0x18')](_0xeee7('0x1d'),auth[_0xeee7('0x9')](),controller['addAccountApplications']);router[_0xeee7('0x18')](_0xeee7('0x1e'),auth[_0xeee7('0x9')](),controller[_0xeee7('0x1f')]);router[_0xeee7('0x18')](_0xeee7('0x20'),auth[_0xeee7('0x9')](),controller[_0xeee7('0x21')]);router[_0xeee7('0x18')](_0xeee7('0x15'),auth[_0xeee7('0x9')](),controller[_0xeee7('0x22')]);router['put']('/:id',auth[_0xeee7('0x9')](),controller[_0xeee7('0x23')]);router[_0xeee7('0x24')](_0xeee7('0xd'),auth[_0xeee7('0x9')](),controller['destroy']);router['delete'](_0xeee7('0xe'),auth['isAuthenticated'](),controller[_0xeee7('0x25')]);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xeee7('0x26')]);router[_0xeee7('0x24')]('/:id/users',auth['isAuthenticated'](),controller[_0xeee7('0x27')]);module[_0xeee7('0x28')]=router; \ No newline at end of file +var _0x2dec=['post','create','/:id/dispositions','addDisposition','addAnswer','addApplications','/addaccountapplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','/:id/users','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/canned_answers','getAnswers','getInteractions','/:id/applications','/:id/messages','getMessages'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0x2dec,0x1e3));var _0xc2de=function(_0x1082ab,_0x133d5b){_0x1082ab=_0x1082ab-0x0;var _0x2de4cf=_0x2dec[_0x1082ab];return _0x2de4cf;};'use strict';var multer=require(_0xc2de('0x0'));var util=require(_0xc2de('0x1'));var path=require(_0xc2de('0x2'));var timeout=require(_0xc2de('0x3'));var express=require(_0xc2de('0x4'));var router=express[_0xc2de('0x5')]();var auth=require(_0xc2de('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc2de('0x7'));router[_0xc2de('0x8')]('/',auth[_0xc2de('0x9')](),controller[_0xc2de('0xa')]);router[_0xc2de('0x8')](_0xc2de('0xb'),auth[_0xc2de('0x9')](),controller[_0xc2de('0xc')]);router[_0xc2de('0x8')](_0xc2de('0xd'),auth[_0xc2de('0x9')](),controller[_0xc2de('0xe')]);router[_0xc2de('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0xc2de('0x8')](_0xc2de('0xf'),auth['isAuthenticated'](),controller[_0xc2de('0x10')]);router[_0xc2de('0x8')]('/:id/interactions',auth[_0xc2de('0x9')](),controller[_0xc2de('0x11')]);router[_0xc2de('0x8')](_0xc2de('0x12'),auth[_0xc2de('0x9')](),controller['getApplications']);router[_0xc2de('0x8')](_0xc2de('0x13'),auth[_0xc2de('0x9')](),controller[_0xc2de('0x14')]);router[_0xc2de('0x8')]('/:id/users',auth[_0xc2de('0x9')](),controller['getAgents']);router[_0xc2de('0x15')]('/',auth['isAuthenticated'](),controller[_0xc2de('0x16')]);router[_0xc2de('0x15')](_0xc2de('0x17'),auth[_0xc2de('0x9')](),controller[_0xc2de('0x18')]);router[_0xc2de('0x15')]('/:id/canned_answers',auth[_0xc2de('0x9')](),controller[_0xc2de('0x19')]);router[_0xc2de('0x15')]('/:id/interactions',auth['isAuthenticated'](),controller['addInteraction']);router[_0xc2de('0x15')](_0xc2de('0x12'),auth[_0xc2de('0x9')](),controller[_0xc2de('0x1a')]);router[_0xc2de('0x15')](_0xc2de('0x1b'),auth[_0xc2de('0x9')](),controller['addAccountApplications']);router[_0xc2de('0x15')](_0xc2de('0x1c'),auth[_0xc2de('0x9')](),controller[_0xc2de('0x1d')]);router[_0xc2de('0x15')](_0xc2de('0x1e'),auth[_0xc2de('0x9')](),controller[_0xc2de('0x1f')]);router['post'](_0xc2de('0x20'),auth['isAuthenticated'](),controller[_0xc2de('0x21')]);router[_0xc2de('0x22')](_0xc2de('0xd'),auth[_0xc2de('0x9')](),controller[_0xc2de('0x23')]);router[_0xc2de('0x24')](_0xc2de('0xd'),auth['isAuthenticated'](),controller[_0xc2de('0x25')]);router['delete']('/:id/dispositions',auth[_0xc2de('0x9')](),controller[_0xc2de('0x26')]);router[_0xc2de('0x24')](_0xc2de('0xf'),auth[_0xc2de('0x9')](),controller[_0xc2de('0x27')]);router[_0xc2de('0x24')](_0xc2de('0x20'),auth[_0xc2de('0x9')](),controller[_0xc2de('0x28')]);module[_0xc2de('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 0b71d73..6c84f95 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 _0xee4a=['STRING','noop','*,*,*,*','sequelize','INTEGER'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xee4a,0x9e));var _0xaee4=function(_0x226f04,_0x10f2fc){_0x226f04=_0x226f04-0x0;var _0x184678=_0xee4a[_0x226f04];return _0x184678;};'use strict';var Sequelize=require(_0xaee4('0x0'));module['exports']={'priority':{'type':Sequelize[_0xaee4('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xaee4('0x2')],'allowNull':![],'defaultValue':_0xaee4('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xaee4('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xaee4('0x4')}}; \ No newline at end of file +var _0xbeb6=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xbeb6,0x19e));var _0x6beb=function(_0x3afc54,_0x5297f3){_0x3afc54=_0x3afc54-0x0;var _0x117a4f=_0xbeb6[_0x3afc54];return _0x117a4f;};'use strict';var Sequelize=require('sequelize');module[_0x6beb('0x0')]={'priority':{'type':Sequelize[_0x6beb('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6beb('0x2')],'allowNull':![],'defaultValue':_0x6beb('0x3')},'appdata':{'type':Sequelize[_0x6beb('0x4')]()},'description':{'type':Sequelize[_0x6beb('0x2')]},'interval':{'type':Sequelize[_0x6beb('0x2')],'defaultValue':_0x6beb('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 979e9ee..61d3fc0 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 _0xd034=['body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','FaxApplication','includeAll','include','findAll','rows','catch','show','params','find','create'];(function(_0x1526e1,_0x5ed5a5){var _0x249a1e=function(_0x4a7c12){while(--_0x4a7c12){_0x1526e1['push'](_0x1526e1['shift']());}};_0x249a1e(++_0x5ed5a5);}(_0xd034,0x93));var _0x4d03=function(_0x5b9252,_0x4bc2f8){_0x5b9252=_0x5b9252-0x0;var _0x1a4284=_0xd034[_0x5b9252];return _0x1a4284;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4d03('0x0'));var rimraf=require(_0x4d03('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d03('0x2'));var rp=require(_0x4d03('0x3'));var moment=require(_0x4d03('0x4'));var BPromise=require(_0x4d03('0x5'));var Mustache=require(_0x4d03('0x6'));var util=require(_0x4d03('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x4d03('0x8'));var ejs=require(_0x4d03('0x9'));var fs=require('fs');var _=require(_0x4d03('0xa'));var squel=require('squel');var crypto=require(_0x4d03('0xb'));var jsforce=require(_0x4d03('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4d03('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4d03('0xe'));var as=require(_0x4d03('0xf'));var hardwareService=require(_0x4d03('0x10'));var logger=require(_0x4d03('0x11'))(_0x4d03('0x12'));var utils=require(_0x4d03('0x13'));var config=require(_0x4d03('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4d03('0x15'))['db'];function respondWithStatusCode(_0x472179,_0x1de135){_0x1de135=_0x1de135||0xcc;return function(_0x496e97){if(_0x496e97){return _0x472179[_0x4d03('0x16')](_0x1de135);}return _0x472179[_0x4d03('0x17')](_0x1de135)[_0x4d03('0x18')]();};}function respondWithResult(_0xe4c354,_0x2dc8ab){_0x2dc8ab=_0x2dc8ab||0xc8;return function(_0x31f0ad){if(_0x31f0ad){return _0xe4c354[_0x4d03('0x17')](_0x2dc8ab)[_0x4d03('0x19')](_0x31f0ad);}};}function respondWithFilteredResult(_0x57e68b,_0x5a4a){return function(_0x1e963b){if(_0x1e963b){var _0x5dd9d6=_0x1e963b[_0x4d03('0x1a')],_0x4bb7dd=_0x5a4a['offset'],_0xea6d5a=_0x5a4a[_0x4d03('0x1b')]+_0x5a4a[_0x4d03('0x1c')],_0xeb981c;if(_0xea6d5a>=_0x5dd9d6){_0xea6d5a=_0x5dd9d6;_0xeb981c=0xc8;}else{_0xeb981c=0xce;}_0x57e68b[_0x4d03('0x17')](_0xeb981c);return _0x57e68b[_0x4d03('0x1d')](_0x4d03('0x1e'),_0x4bb7dd+'-'+_0xea6d5a+'/'+_0x5dd9d6)['json'](_0x1e963b);}return null;};}function patchUpdates(_0x4a94fe){return function(_0xc0d4a1){try{jsonpatch[_0x4d03('0x1f')](_0xc0d4a1,_0x4a94fe,!![]);}catch(_0x1f417a){return BPromise[_0x4d03('0x20')](_0x1f417a);}return _0xc0d4a1['save']();};}function saveUpdates(_0x5d65ca,_0x4dcb6c){return function(_0x301c47){if(_0x301c47){return _0x301c47[_0x4d03('0x21')](_0x5d65ca)[_0x4d03('0x22')](function(_0x1e4fb7){return _0x1e4fb7;});}return null;};}function removeEntity(_0x3c1949,_0x1b7838){return function(_0x508676){if(_0x508676){return _0x508676[_0x4d03('0x23')]()[_0x4d03('0x22')](function(){_0x3c1949[_0x4d03('0x17')](0xcc)[_0x4d03('0x18')]();});}};}function handleEntityNotFound(_0x40d6cf,_0x372a24){return function(_0x50c032){if(!_0x50c032){_0x40d6cf[_0x4d03('0x16')](0x194);}return _0x50c032;};}function handleError(_0x32d185,_0x1c8d60){_0x1c8d60=_0x1c8d60||0x1f4;return function(_0x4e3b9b){logger[_0x4d03('0x24')](_0x4e3b9b[_0x4d03('0x25')]);if(_0x4e3b9b['name']){delete _0x4e3b9b[_0x4d03('0x26')];}_0x32d185[_0x4d03('0x17')](_0x1c8d60)[_0x4d03('0x27')](_0x4e3b9b);};}exports['index']=function(_0xa86979,_0x1034c5){var _0xea7d4b={},_0xbb3c8f={},_0x598206={'count':0x0,'rows':[]};var _0x2d6d64=_[_0x4d03('0x28')](db['FaxApplication'][_0x4d03('0x29')],function(_0x6cab76){return{'name':_0x6cab76[_0x4d03('0x2a')],'type':_0x6cab76[_0x4d03('0x2b')][_0x4d03('0x2c')]};});_0xbb3c8f[_0x4d03('0x2d')]=_[_0x4d03('0x28')](_0x2d6d64,_0x4d03('0x26'));_0xbb3c8f[_0x4d03('0x2e')]=_[_0x4d03('0x2f')](_0xa86979[_0x4d03('0x2e')]);_0xbb3c8f[_0x4d03('0x30')]=_[_0x4d03('0x31')](_0xbb3c8f[_0x4d03('0x2d')],_0xbb3c8f[_0x4d03('0x2e')]);_0xea7d4b[_0x4d03('0x32')]=_[_0x4d03('0x31')](_0xbb3c8f[_0x4d03('0x2d')],qs[_0x4d03('0x33')](_0xa86979[_0x4d03('0x2e')]['fields']));_0xea7d4b[_0x4d03('0x32')]=_0xea7d4b[_0x4d03('0x32')][_0x4d03('0x34')]?_0xea7d4b[_0x4d03('0x32')]:_0xbb3c8f[_0x4d03('0x2d')];if(!_0xa86979['query'][_0x4d03('0x35')](_0x4d03('0x36'))){_0xea7d4b[_0x4d03('0x1c')]=qs[_0x4d03('0x1c')](_0xa86979[_0x4d03('0x2e')][_0x4d03('0x1c')]);_0xea7d4b[_0x4d03('0x1b')]=qs[_0x4d03('0x1b')](_0xa86979[_0x4d03('0x2e')][_0x4d03('0x1b')]);}_0xea7d4b[_0x4d03('0x37')]=qs[_0x4d03('0x38')](_0xa86979[_0x4d03('0x2e')][_0x4d03('0x38')]);_0xea7d4b['where']=qs[_0x4d03('0x30')](_['pick'](_0xa86979[_0x4d03('0x2e')],_0xbb3c8f['filters']),_0x2d6d64);if(_0xa86979[_0x4d03('0x2e')][_0x4d03('0x39')]){_0xea7d4b[_0x4d03('0x3a')]=_[_0x4d03('0x3b')](_0xea7d4b[_0x4d03('0x3a')],{'$or':_[_0x4d03('0x28')](_0x2d6d64,function(_0x3d652b){if(_0x3d652b[_0x4d03('0x2b')]!==_0x4d03('0x3c')){var _0x290b52={};_0x290b52[_0x3d652b['name']]={'$like':'%'+_0xa86979[_0x4d03('0x2e')][_0x4d03('0x39')]+'%'};return _0x290b52;}})});}_0xea7d4b=_['merge']({},_0xea7d4b,_0xa86979[_0x4d03('0x3d')]);var _0x3457ca={'where':_0xea7d4b[_0x4d03('0x3a')]};return db[_0x4d03('0x3e')][_0x4d03('0x1a')](_0x3457ca)[_0x4d03('0x22')](function(_0x4d7b59){_0x598206[_0x4d03('0x1a')]=_0x4d7b59;if(_0xa86979[_0x4d03('0x2e')][_0x4d03('0x3f')]){_0xea7d4b[_0x4d03('0x40')]=[{'all':!![]}];}return db['FaxApplication'][_0x4d03('0x41')](_0xea7d4b);})[_0x4d03('0x22')](function(_0x4dfb6e){_0x598206[_0x4d03('0x42')]=_0x4dfb6e;return _0x598206;})[_0x4d03('0x22')](respondWithFilteredResult(_0x1034c5,_0xea7d4b))[_0x4d03('0x43')](handleError(_0x1034c5,null));};exports[_0x4d03('0x44')]=function(_0x219a21,_0x262ea8){var _0x2c32a0={'raw':!![],'where':{'id':_0x219a21[_0x4d03('0x45')]['id']}},_0xf95ecf={};_0xf95ecf[_0x4d03('0x2d')]=_['keys'](db[_0x4d03('0x3e')][_0x4d03('0x29')]);_0xf95ecf[_0x4d03('0x2e')]=_[_0x4d03('0x2f')](_0x219a21[_0x4d03('0x2e')]);_0xf95ecf[_0x4d03('0x30')]=_[_0x4d03('0x31')](_0xf95ecf[_0x4d03('0x2d')],_0xf95ecf[_0x4d03('0x2e')]);_0x2c32a0[_0x4d03('0x32')]=_[_0x4d03('0x31')](_0xf95ecf[_0x4d03('0x2d')],qs[_0x4d03('0x33')](_0x219a21[_0x4d03('0x2e')]['fields']));_0x2c32a0[_0x4d03('0x32')]=_0x2c32a0[_0x4d03('0x32')][_0x4d03('0x34')]?_0x2c32a0['attributes']:_0xf95ecf[_0x4d03('0x2d')];if(_0x219a21[_0x4d03('0x2e')][_0x4d03('0x3f')]){_0x2c32a0[_0x4d03('0x40')]=[{'all':!![]}];}_0x2c32a0=_[_0x4d03('0x3b')]({},_0x2c32a0,_0x219a21['options']);return db['FaxApplication'][_0x4d03('0x46')](_0x2c32a0)[_0x4d03('0x22')](handleEntityNotFound(_0x262ea8,null))[_0x4d03('0x22')](respondWithResult(_0x262ea8,null))[_0x4d03('0x43')](handleError(_0x262ea8,null));};exports[_0x4d03('0x47')]=function(_0x48ffaa,_0x36ad25){return db['FaxApplication']['create'](_0x48ffaa[_0x4d03('0x48')],{})[_0x4d03('0x22')](respondWithResult(_0x36ad25,0xc9))[_0x4d03('0x43')](handleError(_0x36ad25,null));};exports['update']=function(_0xaa89d6,_0x20058b){if(_0xaa89d6[_0x4d03('0x48')]['id']){delete _0xaa89d6['body']['id'];}return db['FaxApplication']['find']({'where':{'id':_0xaa89d6[_0x4d03('0x45')]['id']}})['then'](handleEntityNotFound(_0x20058b,null))[_0x4d03('0x22')](saveUpdates(_0xaa89d6[_0x4d03('0x48')],null))[_0x4d03('0x22')](respondWithResult(_0x20058b,null))[_0x4d03('0x43')](handleError(_0x20058b,null));};exports[_0x4d03('0x23')]=function(_0x236a68,_0x3977d3){return db[_0x4d03('0x3e')][_0x4d03('0x46')]({'where':{'id':_0x236a68['params']['id']}})[_0x4d03('0x22')](handleEntityNotFound(_0x3977d3,null))[_0x4d03('0x22')](removeEntity(_0x3977d3,null))[_0x4d03('0x43')](handleError(_0x3977d3,null));}; \ No newline at end of file +var _0xf4b2=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','end','error','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0xca4536,_0x2dcd8f){var _0x23ddc8=function(_0x34a3e0){while(--_0x34a3e0){_0xca4536['push'](_0xca4536['shift']());}};_0x23ddc8(++_0x2dcd8f);}(_0xf4b2,0x85));var _0x2f4b=function(_0x1f1562,_0x30c661){_0x1f1562=_0x1f1562-0x0;var _0x28d121=_0xf4b2[_0x1f1562];return _0x28d121;};'use strict';var pdf=require(_0x2f4b('0x0'));var emlformat=require(_0x2f4b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2f4b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2f4b('0x3'));var moment=require(_0x2f4b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2f4b('0x5'));var util=require(_0x2f4b('0x6'));var path=require('path');var sox=require(_0x2f4b('0x7'));var csv=require('to-csv');var ejs=require(_0x2f4b('0x8'));var fs=require('fs');var _=require(_0x2f4b('0x9'));var squel=require(_0x2f4b('0xa'));var crypto=require(_0x2f4b('0xb'));var jsforce=require(_0x2f4b('0xc'));var deskjs=require(_0x2f4b('0xd'));var toCsv=require(_0x2f4b('0xe'));var querystring=require(_0x2f4b('0xf'));var Papa=require(_0x2f4b('0x10'));var Redis=require(_0x2f4b('0x11'));var authService=require(_0x2f4b('0x12'));var qs=require(_0x2f4b('0x13'));var as=require(_0x2f4b('0x14'));var hardwareService=require(_0x2f4b('0x15'));var logger=require('../../config/logger')(_0x2f4b('0x16'));var utils=require(_0x2f4b('0x17'));var config=require(_0x2f4b('0x18'));var licenseUtil=require(_0x2f4b('0x19'));var db=require(_0x2f4b('0x1a'))['db'];function respondWithStatusCode(_0x5b5ad4,_0x4e26a7){_0x4e26a7=_0x4e26a7||0xcc;return function(_0x13e096){if(_0x13e096){return _0x5b5ad4[_0x2f4b('0x1b')](_0x4e26a7);}return _0x5b5ad4[_0x2f4b('0x1c')](_0x4e26a7)['end']();};}function respondWithResult(_0x3a9a8e,_0x3be3c3){_0x3be3c3=_0x3be3c3||0xc8;return function(_0x1ca206){if(_0x1ca206){return _0x3a9a8e[_0x2f4b('0x1c')](_0x3be3c3)[_0x2f4b('0x1d')](_0x1ca206);}};}function respondWithFilteredResult(_0x40f9be,_0x382f39){return function(_0xa72a58){if(_0xa72a58){var _0x4208f9=_0xa72a58[_0x2f4b('0x1e')],_0x1be93a=_0x382f39[_0x2f4b('0x1f')],_0x46ee2a=_0x382f39[_0x2f4b('0x1f')]+_0x382f39['limit'],_0x1dcbeb;if(_0x46ee2a>=_0x4208f9){_0x46ee2a=_0x4208f9;_0x1dcbeb=0xc8;}else{_0x1dcbeb=0xce;}_0x40f9be[_0x2f4b('0x1c')](_0x1dcbeb);return _0x40f9be[_0x2f4b('0x20')](_0x2f4b('0x21'),_0x1be93a+'-'+_0x46ee2a+'/'+_0x4208f9)[_0x2f4b('0x1d')](_0xa72a58);}return null;};}function patchUpdates(_0x2ca1f0){return function(_0x5a0a7d){try{jsonpatch[_0x2f4b('0x22')](_0x5a0a7d,_0x2ca1f0,!![]);}catch(_0x2bcc68){return BPromise[_0x2f4b('0x23')](_0x2bcc68);}return _0x5a0a7d[_0x2f4b('0x24')]();};}function saveUpdates(_0x264da5,_0x3eab1d){return function(_0x4625c6){if(_0x4625c6){return _0x4625c6[_0x2f4b('0x25')](_0x264da5)[_0x2f4b('0x26')](function(_0x2c448f){return _0x2c448f;});}return null;};}function removeEntity(_0x304528,_0x5f3294){return function(_0x43bda5){if(_0x43bda5){return _0x43bda5['destroy']()[_0x2f4b('0x26')](function(){_0x304528[_0x2f4b('0x1c')](0xcc)[_0x2f4b('0x27')]();});}};}function handleEntityNotFound(_0xa66cd4,_0x296b83){return function(_0x2199ba){if(!_0x2199ba){_0xa66cd4[_0x2f4b('0x1b')](0x194);}return _0x2199ba;};}function handleError(_0x202ff0,_0x2f1b91){_0x2f1b91=_0x2f1b91||0x1f4;return function(_0x27c202){logger[_0x2f4b('0x28')](_0x27c202['stack']);if(_0x27c202['name']){delete _0x27c202['name'];}_0x202ff0['status'](_0x2f1b91)[_0x2f4b('0x29')](_0x27c202);};}exports[_0x2f4b('0x2a')]=function(_0x51bc29,_0x1c9c94){var _0x1dcff0={},_0x407138={},_0x2aaf90={'count':0x0,'rows':[]};var _0x386bba=_[_0x2f4b('0x2b')](db[_0x2f4b('0x2c')][_0x2f4b('0x2d')],function(_0x1a1b25){return{'name':_0x1a1b25[_0x2f4b('0x2e')],'type':_0x1a1b25[_0x2f4b('0x2f')][_0x2f4b('0x30')]};});_0x407138[_0x2f4b('0x31')]=_[_0x2f4b('0x2b')](_0x386bba,_0x2f4b('0x32'));_0x407138[_0x2f4b('0x33')]=_[_0x2f4b('0x34')](_0x51bc29['query']);_0x407138['filters']=_[_0x2f4b('0x35')](_0x407138[_0x2f4b('0x31')],_0x407138['query']);_0x1dcff0[_0x2f4b('0x36')]=_[_0x2f4b('0x35')](_0x407138[_0x2f4b('0x31')],qs[_0x2f4b('0x37')](_0x51bc29[_0x2f4b('0x33')][_0x2f4b('0x37')]));_0x1dcff0[_0x2f4b('0x36')]=_0x1dcff0[_0x2f4b('0x36')][_0x2f4b('0x38')]?_0x1dcff0[_0x2f4b('0x36')]:_0x407138[_0x2f4b('0x31')];if(!_0x51bc29[_0x2f4b('0x33')]['hasOwnProperty'](_0x2f4b('0x39'))){_0x1dcff0[_0x2f4b('0x3a')]=qs[_0x2f4b('0x3a')](_0x51bc29[_0x2f4b('0x33')][_0x2f4b('0x3a')]);_0x1dcff0[_0x2f4b('0x1f')]=qs[_0x2f4b('0x1f')](_0x51bc29[_0x2f4b('0x33')][_0x2f4b('0x1f')]);}_0x1dcff0[_0x2f4b('0x3b')]=qs[_0x2f4b('0x3c')](_0x51bc29['query'][_0x2f4b('0x3c')]);_0x1dcff0[_0x2f4b('0x3d')]=qs[_0x2f4b('0x3e')](_[_0x2f4b('0x3f')](_0x51bc29[_0x2f4b('0x33')],_0x407138[_0x2f4b('0x3e')]),_0x386bba);if(_0x51bc29[_0x2f4b('0x33')][_0x2f4b('0x40')]){_0x1dcff0[_0x2f4b('0x3d')]=_[_0x2f4b('0x41')](_0x1dcff0['where'],{'$or':_[_0x2f4b('0x2b')](_0x386bba,function(_0x11f5f4){if(_0x11f5f4[_0x2f4b('0x2f')]!==_0x2f4b('0x42')){var _0x50d7cf={};_0x50d7cf[_0x11f5f4[_0x2f4b('0x32')]]={'$like':'%'+_0x51bc29[_0x2f4b('0x33')][_0x2f4b('0x40')]+'%'};return _0x50d7cf;}})});}_0x1dcff0=_[_0x2f4b('0x41')]({},_0x1dcff0,_0x51bc29[_0x2f4b('0x43')]);var _0x1a95a7={'where':_0x1dcff0[_0x2f4b('0x3d')]};return db[_0x2f4b('0x2c')][_0x2f4b('0x1e')](_0x1a95a7)[_0x2f4b('0x26')](function(_0x373210){_0x2aaf90[_0x2f4b('0x1e')]=_0x373210;if(_0x51bc29['query'][_0x2f4b('0x44')]){_0x1dcff0[_0x2f4b('0x45')]=[{'all':!![]}];}return db[_0x2f4b('0x2c')]['findAll'](_0x1dcff0);})[_0x2f4b('0x26')](function(_0x1633b6){_0x2aaf90[_0x2f4b('0x46')]=_0x1633b6;return _0x2aaf90;})[_0x2f4b('0x26')](respondWithFilteredResult(_0x1c9c94,_0x1dcff0))[_0x2f4b('0x47')](handleError(_0x1c9c94,null));};exports[_0x2f4b('0x48')]=function(_0x3e98f9,_0x6c2433){var _0x25c82e={'raw':!![],'where':{'id':_0x3e98f9[_0x2f4b('0x49')]['id']}},_0x3d9c81={};_0x3d9c81['model']=_[_0x2f4b('0x34')](db[_0x2f4b('0x2c')][_0x2f4b('0x2d')]);_0x3d9c81[_0x2f4b('0x33')]=_[_0x2f4b('0x34')](_0x3e98f9[_0x2f4b('0x33')]);_0x3d9c81[_0x2f4b('0x3e')]=_[_0x2f4b('0x35')](_0x3d9c81['model'],_0x3d9c81[_0x2f4b('0x33')]);_0x25c82e['attributes']=_[_0x2f4b('0x35')](_0x3d9c81[_0x2f4b('0x31')],qs[_0x2f4b('0x37')](_0x3e98f9[_0x2f4b('0x33')][_0x2f4b('0x37')]));_0x25c82e[_0x2f4b('0x36')]=_0x25c82e[_0x2f4b('0x36')][_0x2f4b('0x38')]?_0x25c82e['attributes']:_0x3d9c81[_0x2f4b('0x31')];if(_0x3e98f9[_0x2f4b('0x33')]['includeAll']){_0x25c82e['include']=[{'all':!![]}];}_0x25c82e=_[_0x2f4b('0x41')]({},_0x25c82e,_0x3e98f9['options']);return db[_0x2f4b('0x2c')][_0x2f4b('0x4a')](_0x25c82e)['then'](handleEntityNotFound(_0x6c2433,null))[_0x2f4b('0x26')](respondWithResult(_0x6c2433,null))['catch'](handleError(_0x6c2433,null));};exports['create']=function(_0x1f630d,_0x4165e7){return db['FaxApplication'][_0x2f4b('0x4b')](_0x1f630d[_0x2f4b('0x4c')],{})[_0x2f4b('0x26')](respondWithResult(_0x4165e7,0xc9))[_0x2f4b('0x47')](handleError(_0x4165e7,null));};exports[_0x2f4b('0x25')]=function(_0x81b5e8,_0x21e0da){if(_0x81b5e8[_0x2f4b('0x4c')]['id']){delete _0x81b5e8[_0x2f4b('0x4c')]['id'];}return db[_0x2f4b('0x2c')][_0x2f4b('0x4a')]({'where':{'id':_0x81b5e8[_0x2f4b('0x49')]['id']}})[_0x2f4b('0x26')](handleEntityNotFound(_0x21e0da,null))[_0x2f4b('0x26')](saveUpdates(_0x81b5e8[_0x2f4b('0x4c')],null))[_0x2f4b('0x26')](respondWithResult(_0x21e0da,null))[_0x2f4b('0x47')](handleError(_0x21e0da,null));};exports[_0x2f4b('0x4d')]=function(_0x404eb4,_0x5b2a54){return db[_0x2f4b('0x2c')][_0x2f4b('0x4a')]({'where':{'id':_0x404eb4['params']['id']}})['then'](handleEntityNotFound(_0x5b2a54,null))['then'](removeEntity(_0x5b2a54,null))['catch'](handleError(_0x5b2a54,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index fe1d10c..8b91702 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 _0x02bb=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x277821,_0x441826){var _0x54025f=function(_0x15e01a){while(--_0x15e01a){_0x277821['push'](_0x277821['shift']());}};_0x54025f(++_0x441826);}(_0x02bb,0x80));var _0xb02b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x02bb[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xb02b('0x0'));var util=require(_0xb02b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb02b('0x2'));var BPromise=require(_0xb02b('0x3'));var rp=require(_0xb02b('0x4'));var fs=require('fs');var path=require(_0xb02b('0x5'));var rimraf=require(_0xb02b('0x6'));var config=require(_0xb02b('0x7'));var attributes=require(_0xb02b('0x8'));module['exports']=function(_0x12e699,_0x380d56){return _0x12e699[_0xb02b('0x9')]('FaxApplication',attributes,{'tableName':_0xb02b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb02b('0xb'),'collate':_0xb02b('0xc')});}; \ No newline at end of file +var _0xfd66=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','FaxApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0x5826ee,_0xafb4f){var _0x556007=function(_0x1bc350){while(--_0x1bc350){_0x5826ee['push'](_0x5826ee['shift']());}};_0x556007(++_0xafb4f);}(_0xfd66,0x1e0));var _0x6fd6=function(_0x3b8199,_0x222373){_0x3b8199=_0x3b8199-0x0;var _0x4ec241=_0xfd66[_0x3b8199];return _0x4ec241;};'use strict';var _=require(_0x6fd6('0x0'));var util=require(_0x6fd6('0x1'));var logger=require(_0x6fd6('0x2'))(_0x6fd6('0x3'));var moment=require('moment');var BPromise=require(_0x6fd6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6fd6('0x5'));var rimraf=require(_0x6fd6('0x6'));var config=require(_0x6fd6('0x7'));var attributes=require('./faxApplication.attributes');module[_0x6fd6('0x8')]=function(_0x4c3f8c,_0x15e526){return _0x4c3f8c['define'](_0x6fd6('0x9'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6fd6('0xa'),'collate':_0x6fd6('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index f9b1dd3..407ca43 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 _0x6355=['debug','stringify','error','code','message','request\x20sent','result','UpdateFaxApplication','update','body','options','raw','where','attributes','limit','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s'];(function(_0x1d1916,_0x7db2df){var _0x1082cb=function(_0x1a6475){while(--_0x1a6475){_0x1d1916['push'](_0x1d1916['shift']());}};_0x1082cb(++_0x7db2df);}(_0x6355,0x6a));var _0x5635=function(_0x2743d1,_0x4b2dfa){_0x2743d1=_0x2743d1-0x0;var _0x5e26fb=_0x6355[_0x2743d1];return _0x5e26fb;};'use strict';var _=require(_0x5635('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5635('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5635('0x2'));var db=require(_0x5635('0x3'))['db'];var utils=require(_0x5635('0x4'));var logger=require(_0x5635('0x5'))('rpc');var config=require(_0x5635('0x6'));var jayson=require(_0x5635('0x7'));var client=jayson[_0x5635('0x8')][_0x5635('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fff87,_0x28e35c,_0x1fc016){return new BPromise(function(_0x3856c8,_0x12e1ea){return client[_0x5635('0xa')](_0x3fff87,_0x1fc016)[_0x5635('0xb')](function(_0x52b754){logger[_0x5635('0xc')](_0x5635('0xd'),_0x28e35c,'request\x20sent');logger[_0x5635('0xe')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x28e35c,'request\x20sent',JSON[_0x5635('0xf')](_0x52b754));if(_0x52b754[_0x5635('0x10')]){if(_0x52b754[_0x5635('0x10')][_0x5635('0x11')]===0x1f4){logger[_0x5635('0x10')](_0x5635('0xd'),_0x28e35c,_0x52b754[_0x5635('0x10')][_0x5635('0x12')]);return _0x12e1ea(_0x52b754['error'][_0x5635('0x12')]);}logger['error'](_0x5635('0xd'),_0x28e35c,_0x52b754[_0x5635('0x10')][_0x5635('0x12')]);return _0x3856c8(_0x52b754[_0x5635('0x10')][_0x5635('0x12')]);}else{logger[_0x5635('0xc')](_0x5635('0xd'),_0x28e35c,_0x5635('0x13'));_0x3856c8(_0x52b754[_0x5635('0x14')]['message']);}})['catch'](function(_0x4b371d){logger['error'](_0x5635('0xd'),_0x28e35c,_0x4b371d);_0x12e1ea(_0x4b371d);});});}exports[_0x5635('0x15')]=function(_0x422205){var _0x5d460b=this;return new Promise(function(_0x33da12,_0x2907b6){return db['FaxApplication'][_0x5635('0x16')](_0x422205[_0x5635('0x17')],{'raw':_0x422205[_0x5635('0x18')]?_0x422205[_0x5635('0x18')][_0x5635('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x422205[_0x5635('0x18')]?_0x422205['options'][_0x5635('0x1a')]||null:null,'attributes':_0x422205[_0x5635('0x18')]?_0x422205['options'][_0x5635('0x1b')]||null:null,'limit':_0x422205[_0x5635('0x18')]?_0x422205[_0x5635('0x18')][_0x5635('0x1c')]||null:null})[_0x5635('0xb')](function(_0x8a8d3e){logger[_0x5635('0xc')](_0x5635('0x15'),_0x422205);logger['debug'](_0x5635('0x15'),_0x422205,JSON[_0x5635('0xf')](_0x8a8d3e));_0x33da12(_0x8a8d3e);})[_0x5635('0x1d')](function(_0xcb9e33){logger[_0x5635('0x10')](_0x5635('0x15'),_0xcb9e33['message'],_0x422205);_0x2907b6(_0x5d460b[_0x5635('0x10')](0x1f4,_0xcb9e33['message']));});});}; \ No newline at end of file +var _0x5538=['attributes','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','where'];(function(_0x5d9867,_0x5cc4a4){var _0x53fd0b=function(_0x559f12){while(--_0x559f12){_0x5d9867['push'](_0x5d9867['shift']());}};_0x53fd0b(++_0x5cc4a4);}(_0x5538,0x110));var _0x8553=function(_0x211632,_0x378e2e){_0x211632=_0x211632-0x0;var _0x5a1da1=_0x5538[_0x211632];return _0x5a1da1;};'use strict';var _=require(_0x8553('0x0'));var util=require('util');var moment=require(_0x8553('0x1'));var BPromise=require(_0x8553('0x2'));var rs=require(_0x8553('0x3'));var fs=require('fs');var Redis=require(_0x8553('0x4'));var db=require(_0x8553('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8553('0x6'));var config=require(_0x8553('0x7'));var jayson=require(_0x8553('0x8'));var client=jayson['client'][_0x8553('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16e591,_0x12808f,_0xe28882){return new BPromise(function(_0x38703f,_0x49046b){return client[_0x8553('0xa')](_0x16e591,_0xe28882)[_0x8553('0xb')](function(_0x2d1ba1){logger[_0x8553('0xc')](_0x8553('0xd'),_0x12808f,_0x8553('0xe'));logger[_0x8553('0xf')](_0x8553('0x10'),_0x12808f,_0x8553('0xe'),JSON['stringify'](_0x2d1ba1));if(_0x2d1ba1[_0x8553('0x11')]){if(_0x2d1ba1[_0x8553('0x11')][_0x8553('0x12')]===0x1f4){logger[_0x8553('0x11')](_0x8553('0xd'),_0x12808f,_0x2d1ba1[_0x8553('0x11')][_0x8553('0x13')]);return _0x49046b(_0x2d1ba1[_0x8553('0x11')]['message']);}logger['error'](_0x8553('0xd'),_0x12808f,_0x2d1ba1[_0x8553('0x11')][_0x8553('0x13')]);return _0x38703f(_0x2d1ba1[_0x8553('0x11')][_0x8553('0x13')]);}else{logger[_0x8553('0xc')](_0x8553('0xd'),_0x12808f,_0x8553('0xe'));_0x38703f(_0x2d1ba1[_0x8553('0x14')][_0x8553('0x13')]);}})[_0x8553('0x15')](function(_0x53207c){logger[_0x8553('0x11')]('FaxApplication,\x20%s,\x20%s',_0x12808f,_0x53207c);_0x49046b(_0x53207c);});});}exports[_0x8553('0x16')]=function(_0x18a981){var _0x1843b2=this;return new Promise(function(_0x5c1909,_0x532531){return db[_0x8553('0x17')][_0x8553('0x18')](_0x18a981[_0x8553('0x19')],{'raw':_0x18a981['options']?_0x18a981[_0x8553('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18a981['options']?_0x18a981[_0x8553('0x1a')][_0x8553('0x1b')]||null:null,'attributes':_0x18a981[_0x8553('0x1a')]?_0x18a981[_0x8553('0x1a')][_0x8553('0x1c')]||null:null,'limit':_0x18a981['options']?_0x18a981[_0x8553('0x1a')]['limit']||null:null})['then'](function(_0x1c9883){logger[_0x8553('0xc')](_0x8553('0x16'),_0x18a981);logger[_0x8553('0xf')](_0x8553('0x16'),_0x18a981,JSON[_0x8553('0x1d')](_0x1c9883));_0x5c1909(_0x1c9883);})['catch'](function(_0x32bd7c){logger[_0x8553('0x11')]('UpdateFaxApplication',_0x32bd7c[_0x8553('0x13')],_0x18a981);_0x532531(_0x1843b2[_0x8553('0x11')](0x1f4,_0x32bd7c[_0x8553('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 02a5ceb..4383604 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 _0x6f47=['put','delete','exports','util','path','express','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','/:id','post','create'];(function(_0x2c15c2,_0x347f92){var _0x419788=function(_0x54ae44){while(--_0x54ae44){_0x2c15c2['push'](_0x2c15c2['shift']());}};_0x419788(++_0x347f92);}(_0x6f47,0xc7));var _0x76f4=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x6f47[_0x186376];return _0x2dbdd9;};'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 +var _0x5d58=['../../components/auth/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','get','/:id','show','post','create','update','destroy','exports','Router'];(function(_0x541ae9,_0x185c5e){var _0x75d6e8=function(_0x5d27c8){while(--_0x5d27c8){_0x541ae9['push'](_0x541ae9['shift']());}};_0x75d6e8(++_0x185c5e);}(_0x5d58,0x187));var _0x85d5=function(_0x55c238,_0x40b065){_0x55c238=_0x55c238-0x0;var _0x126b61=_0x5d58[_0x55c238];return _0x126b61;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x85d5('0x0')]();var auth=require(_0x85d5('0x1'));var interaction=require('../../components/interaction/service');var config=require(_0x85d5('0x2'));var controller=require(_0x85d5('0x3'));router['get']('/',auth[_0x85d5('0x4')](),controller[_0x85d5('0x5')]);router[_0x85d5('0x6')](_0x85d5('0x7'),auth['isAuthenticated'](),controller[_0x85d5('0x8')]);router[_0x85d5('0x9')]('/',auth['isAuthenticated'](),controller[_0x85d5('0xa')]);router['put'](_0x85d5('0x7'),auth[_0x85d5('0x4')](),controller[_0x85d5('0xb')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x85d5('0xc')]);module[_0x85d5('0xd')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 2d24e62..6da73b5 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 _0x1dcc=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x545ded,_0x2a556a){var _0x483a5c=function(_0x59d39e){while(--_0x59d39e){_0x545ded['push'](_0x545ded['shift']());}};_0x483a5c(++_0x2a556a);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x5c7b29,_0x3674db){_0x5c7b29=_0x5c7b29-0x0;var _0x27f1c6=_0x1dcc[_0x5c7b29];return _0x27f1c6;};'use strict';var Sequelize=require(_0xc1dc('0x0'));module[_0xc1dc('0x1')]={'closed':{'type':Sequelize[_0xc1dc('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc1dc('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc1dc('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xc1dc('0x4')]},'read1stAt':{'type':Sequelize[_0xc1dc('0x3')]},'fax':{'type':Sequelize[_0xc1dc('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc1dc('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc1dc('0x5')]('in',_0xc1dc('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x34f2=['DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x405359,_0x1e86ea){var _0x2bded1=function(_0x51eda6){while(--_0x51eda6){_0x405359['push'](_0x405359['shift']());}};_0x2bded1(++_0x1e86ea);}(_0x34f2,0x15a));var _0x234f=function(_0x5e5c2c,_0x2c2b21){_0x5e5c2c=_0x5e5c2c-0x0;var _0x5ae392=_0x34f2[_0x5e5c2c];return _0x5ae392;};'use strict';var Sequelize=require(_0x234f('0x0'));module[_0x234f('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x234f('0x2')]},'disposition':{'type':Sequelize[_0x234f('0x3')]},'secondDisposition':{'type':Sequelize[_0x234f('0x3')]},'thirdDisposition':{'type':Sequelize[_0x234f('0x3')]},'note':{'type':Sequelize[_0x234f('0x3')]},'read1stAt':{'type':Sequelize[_0x234f('0x2')]},'fax':{'type':Sequelize[_0x234f('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x234f('0x4')]('in',_0x234f('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x234f('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x234f('0x4')]('in',_0x234f('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 b9f96f0..b6a4f89 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 _0x9f7b=['user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','expr','search','parseSearch','sqlOperator','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','ContactId','buildExpression','text','start','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.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)','contactName','DESC','isEmpty','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','all','rows','show','params','includeAll','options','create','body','destroy','describe','addMessage','FaxMessage','ids','omit','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','color','emit','faxInteractionTags:save','removeTags','download','unix','server','files','root','attachments','join','transcript-%d-%s.zip','push','Attachment','Messages','get','existsSync','createReadStream','pipe','createWriteStream','basename','log','err','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','sox','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./faxInteraction.socket','end','json','count','offset','limit','status','set','Content-Range','apply','reject','update','then','stack','name','send','Users','map','fullname','Tags','split','forEach','catch','index','FaxInteraction','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','select','field','tools_tags','u.id'];(function(_0x264c79,_0xa663df){var _0x5cc41d=function(_0x36cef1){while(--_0x36cef1){_0x264c79['push'](_0x264c79['shift']());}};_0x5cc41d(++_0xa663df);}(_0x9f7b,0x15c));var _0xb9f7=function(_0x5586fc,_0x303e2a){_0x5586fc=_0x5586fc-0x0;var _0x57ae1f=_0x9f7b[_0x5586fc];return _0x57ae1f;};'use strict';var pdf=require(_0xb9f7('0x0'));var emlformat=require(_0xb9f7('0x1'));var rimraf=require(_0xb9f7('0x2'));var zipdir=require(_0xb9f7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb9f7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb9f7('0x5'));var util=require(_0xb9f7('0x6'));var path=require('path');var sox=require(_0xb9f7('0x7'));var csv=require('to-csv');var ejs=require(_0xb9f7('0x8'));var fs=require('fs');var _=require(_0xb9f7('0x9'));var squel=require('squel');var crypto=require(_0xb9f7('0xa'));var jsforce=require(_0xb9f7('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb9f7('0xc'));var Papa=require(_0xb9f7('0xd'));var Redis=require(_0xb9f7('0xe'));var authService=require(_0xb9f7('0xf'));var qs=require(_0xb9f7('0x10'));var as=require(_0xb9f7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb9f7('0x12'))(_0xb9f7('0x13'));var utils=require(_0xb9f7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb9f7('0x15'));var db=require('../../mysqldb')['db'];config[_0xb9f7('0x16')]=_['defaults'](config['redis'],{'host':_0xb9f7('0x17'),'port':0x18eb});var socket=require(_0xb9f7('0x18'))(new Redis(config[_0xb9f7('0x16')]));require(_0xb9f7('0x19'))['register'](socket);function respondWithStatusCode(_0x2094d5,_0x169141){_0x169141=_0x169141||0xcc;return function(_0x50a157){if(_0x50a157){return _0x2094d5['sendStatus'](_0x169141);}return _0x2094d5['status'](_0x169141)[_0xb9f7('0x1a')]();};}function respondWithResult(_0x2f91ec,_0x718517){_0x718517=_0x718517||0xc8;return function(_0x2d8ae5){if(_0x2d8ae5){return _0x2f91ec['status'](_0x718517)[_0xb9f7('0x1b')](_0x2d8ae5);}};}function respondWithFilteredResult(_0x1dfbb3,_0x119d83){return function(_0x303631){if(_0x303631){var _0x5eb039=_0x303631[_0xb9f7('0x1c')],_0x2188e0=_0x119d83[_0xb9f7('0x1d')],_0x44a04a=_0x119d83['offset']+_0x119d83[_0xb9f7('0x1e')],_0x3a9f19;if(_0x44a04a>=_0x5eb039){_0x44a04a=_0x5eb039;_0x3a9f19=0xc8;}else{_0x3a9f19=0xce;}_0x1dfbb3[_0xb9f7('0x1f')](_0x3a9f19);return _0x1dfbb3[_0xb9f7('0x20')](_0xb9f7('0x21'),_0x2188e0+'-'+_0x44a04a+'/'+_0x5eb039)[_0xb9f7('0x1b')](_0x303631);}return null;};}function patchUpdates(_0x5a2d58){return function(_0x5b2ca0){try{jsonpatch[_0xb9f7('0x22')](_0x5b2ca0,_0x5a2d58,!![]);}catch(_0x54d810){return BPromise[_0xb9f7('0x23')](_0x54d810);}return _0x5b2ca0['save']();};}function saveUpdates(_0x373cb8,_0x3a777b){return function(_0x383807){if(_0x383807){return _0x383807[_0xb9f7('0x24')](_0x373cb8)[_0xb9f7('0x25')](function(_0x4e98fd){return _0x4e98fd;});}return null;};}function removeEntity(_0x21e38b,_0x261375){return function(_0x8bc4e6){if(_0x8bc4e6){return _0x8bc4e6['destroy']()[_0xb9f7('0x25')](function(){_0x21e38b[_0xb9f7('0x1f')](0xcc)[_0xb9f7('0x1a')]();});}};}function handleEntityNotFound(_0x2a8faf,_0xa13798){return function(_0x1a8970){if(!_0x1a8970){_0x2a8faf['sendStatus'](0x194);}return _0x1a8970;};}function handleError(_0x39c802,_0x413d67){_0x413d67=_0x413d67||0x1f4;return function(_0xf5cef3){logger['error'](_0xf5cef3[_0xb9f7('0x26')]);if(_0xf5cef3[_0xb9f7('0x27')]){delete _0xf5cef3['name'];}_0x39c802[_0xb9f7('0x1f')](_0x413d67)[_0xb9f7('0x28')](_0xf5cef3);};}function getInteractionUsers(_0x2dfc64,_0x3d0465){return new BPromise(function(_0x482d3d,_0x3cc750){try{if(_0x3d0465[_0x2dfc64['id']]){_0x2dfc64[_0xb9f7('0x29')]=_[_0xb9f7('0x2a')](_0x3d0465[_0x2dfc64['id']],function(_0x2e8ce9){return{'id':_0x2e8ce9['id'],'fullname':_0x2e8ce9[_0xb9f7('0x2b')]};});}}catch(_0x13eaff){_0x3cc750(_0x13eaff);}_0x482d3d(_0x2dfc64);});}function getInteractionTags(_0x526e79,_0x3a9a16){return new BPromise(function(_0x51b573,_0xb30d41){try{if(_0x526e79['TagIds']){_0x526e79[_0xb9f7('0x2c')]=[];_0x526e79['TagIds'][_0xb9f7('0x2d')](',')[_0xb9f7('0x2e')](function(_0x4d2eb5){_0x526e79[_0xb9f7('0x2c')]['push'](_0x3a9a16[_0x4d2eb5]);});}delete _0x526e79['TagIds'];}catch(_0x42aecc){_0xb30d41(_0x42aecc);}_0x51b573(_0x526e79);});}function updateFaxInteraction(_0x1d38ef,_0xe99d8c,_0x1dfdf7){return new BPromise(function(_0x4cfba7,_0x5f534a){return getInteractionUsers(_0x1d38ef,_0x1dfdf7)[_0xb9f7('0x25')](function(_0xcaaeea){return getInteractionTags(_0xcaaeea,_0xe99d8c);})['then'](function(_0x50132b){_0x4cfba7(_0x50132b);})[_0xb9f7('0x2f')](function(_0x3e3c02){_0x5f534a(_0x3e3c02);});});}exports[_0xb9f7('0x30')]=function(_0x2b3934,_0x1f68b1){var _0x43ad05={},_0x49d806={},_0x3247cf={'count':0x0,'rows':[]};var _0x30c8e=_[_0xb9f7('0x2a')](db[_0xb9f7('0x31')][_0xb9f7('0x32')],function(_0x4cb3a5){return{'name':_0x4cb3a5[_0xb9f7('0x33')],'type':_0x4cb3a5[_0xb9f7('0x34')][_0xb9f7('0x35')]};});_0x49d806['model']=_[_0xb9f7('0x2a')](_0x30c8e,'name');_0x49d806[_0xb9f7('0x36')]=_[_0xb9f7('0x37')](_0x2b3934[_0xb9f7('0x36')]);_0x49d806[_0xb9f7('0x38')]=_[_0xb9f7('0x39')](_0x49d806[_0xb9f7('0x3a')],_0x49d806[_0xb9f7('0x36')]);_0x43ad05[_0xb9f7('0x3b')]=_[_0xb9f7('0x39')](_0x49d806[_0xb9f7('0x3a')],qs['fields'](_0x2b3934[_0xb9f7('0x36')][_0xb9f7('0x3c')]));_0x43ad05[_0xb9f7('0x3b')]=_0x43ad05['attributes']['length']?_0x43ad05['attributes']:_0x49d806[_0xb9f7('0x3a')];if(!_0x2b3934[_0xb9f7('0x36')]['hasOwnProperty'](_0xb9f7('0x3d'))){_0x43ad05[_0xb9f7('0x1e')]=qs[_0xb9f7('0x1e')](_0x2b3934[_0xb9f7('0x36')][_0xb9f7('0x1e')]);_0x43ad05[_0xb9f7('0x1d')]=qs['offset'](_0x2b3934[_0xb9f7('0x36')][_0xb9f7('0x1d')]);}_0x43ad05[_0xb9f7('0x3e')]=qs[_0xb9f7('0x3f')](_0x2b3934['query']['sort']);_0x43ad05[_0xb9f7('0x40')]=qs[_0xb9f7('0x38')](_[_0xb9f7('0x41')](_0x2b3934['query'],_0x49d806[_0xb9f7('0x38')]),_0x30c8e);var _0x145e31=[];var _0x5ca9cb=squel[_0xb9f7('0x42')]()[_0xb9f7('0x43')]('id')[_0xb9f7('0x43')](_0xb9f7('0x27'))[_0xb9f7('0x43')]('color')['from'](_0xb9f7('0x44'));var _0x2fc41c=squel[_0xb9f7('0x42')]()[_0xb9f7('0x43')](_0xb9f7('0x45'))[_0xb9f7('0x43')]('u.fullname')[_0xb9f7('0x43')]('ui.FaxInteractionId')['from'](_0xb9f7('0x46'),'ui')[_0xb9f7('0x47')](_0xb9f7('0x48'),'u',_0xb9f7('0x49'));var _0x5b9139=squel['select']()['from']('fax_interactions','i')[_0xb9f7('0x47')](_0xb9f7('0x4a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xb9f7('0x47')](_0xb9f7('0x48'),'o',_0xb9f7('0x4b'))[_0xb9f7('0x47')](_0xb9f7('0x4c'),'a','a.id\x20=\x20i.FaxAccountId')[_0xb9f7('0x47')](_0xb9f7('0x4d'),'me','me.FaxInteractionId\x20=\x20i.id')[_0xb9f7('0x47')]('fax_interaction_has_tags','it','it.FaxInteractionId\x20=\x20i.id')['left_join'](_0xb9f7('0x44'),'t','t.id\x20=\x20it.TagId');var _0xb4b6fd=squel[_0xb9f7('0x4e')]();var _0x5aa510=[];var _0x3e19ab=squel['expr']();var _0x2f2d19;if(_0x2b3934[_0xb9f7('0x36')][_0xb9f7('0x4f')]){_0x2f2d19=as[_0xb9f7('0x50')](_0x2b3934[_0xb9f7('0x36')][_0xb9f7('0x4f')]);var _0x5f3ab3=_0x2f2d19[_0xb9f7('0x51')];for(var _0x114584=0x0;_0x114584<_0x2f2d19['conditions'][_0xb9f7('0x52')];_0x114584++){var _0x4101c1=_0x2f2d19['conditions'][_0x114584];var _0x5e8f0f='i';var _0x40f2be=_[_0xb9f7('0x53')](_0x30c8e,[_0xb9f7('0x27'),_0x4101c1[_0xb9f7('0x43')]]);if(!_0x40f2be){switch(_0x4101c1[_0xb9f7('0x43')]){case _0xb9f7('0x54'):if(_0x4101c1[_0xb9f7('0x55')]==0x1){_0x5b9139[_0xb9f7('0x56')]('`'+_0x4101c1[_0xb9f7('0x43')]+_0xb9f7('0x57'));}else{_0x5b9139[_0xb9f7('0x56')]('`'+_0x4101c1[_0xb9f7('0x43')]+_0xb9f7('0x58'));}break;case _0xb9f7('0x59'):if(_0x4101c1[_0xb9f7('0x5a')]===_0xb9f7('0x5b')){if(_0x4101c1[_0xb9f7('0x55')][_0xb9f7('0x2d')]('\x20')[_0xb9f7('0x52')]>0x1){_0xb4b6fd[_0x5f3ab3]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb9f7('0x5c')](_0x4101c1[_0xb9f7('0x55')]),null);}else{var _0x54e524='%'+_0x4101c1[_0xb9f7('0x55')]+'%';_0xb4b6fd[_0x5f3ab3]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x54e524,_0x54e524,_0x54e524);}}else{_0x40f2be=_['find'](_0x30c8e,[_0xb9f7('0x27'),_0xb9f7('0x5d')]);_0x4101c1[_0xb9f7('0x43')]='ContactId';_0x26399e=as[_0xb9f7('0x5e')](_0x5e8f0f,_0x40f2be[_0xb9f7('0x34')],_0x4101c1);_0xb4b6fd[_0x5f3ab3](_0x26399e[_0xb9f7('0x5f')],_0x26399e['value'][_0xb9f7('0x60')],_0x26399e[_0xb9f7('0x55')][_0xb9f7('0x1a')]);}break;case'Tag':var _0x3c5303=_0x4101c1['value']['split'](',')[_0xb9f7('0x2a')](function(_0x53ed5d){return Number(_0x53ed5d);});_0x3c5303[_0xb9f7('0x2e')](function(_0x2cae9a){_0x3e19ab['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2cae9a+',%');});_0x5aa510=_[_0xb9f7('0x61')](_0x5aa510,_0x3c5303);break;case _0xb9f7('0x62'):if(_0x4101c1[_0xb9f7('0x5a')]===_0xb9f7('0x5b')){_0xb4b6fd[_0x5f3ab3](_0xb9f7('0x63'),'%'+_0x4101c1[_0xb9f7('0x55')]+'%',null);}else{_0x40f2be=_[_0xb9f7('0x53')](_0x30c8e,[_0xb9f7('0x27'),_0xb9f7('0x64')]);_0x4101c1[_0xb9f7('0x43')]=_0xb9f7('0x64');_0x26399e=as['buildExpression'](_0x5e8f0f,_0x40f2be[_0xb9f7('0x34')],_0x4101c1);_0xb4b6fd[_0x5f3ab3](_0x26399e['text'],_0x26399e[_0xb9f7('0x55')][_0xb9f7('0x60')],_0x26399e['value'][_0xb9f7('0x1a')]);}break;case'body':_0x26399e=as[_0xb9f7('0x5e')]('me',null,_0x4101c1);_0xb4b6fd[_0x5f3ab3](_0x26399e[_0xb9f7('0x5f')],_0x26399e[_0xb9f7('0x55')][_0xb9f7('0x60')],_0x26399e[_0xb9f7('0x55')]['end']);break;}}else{var _0x26399e=as['buildExpression'](_0x5e8f0f,_0x40f2be[_0xb9f7('0x34')],_0x4101c1);_0xb4b6fd[_0x5f3ab3](_0x26399e[_0xb9f7('0x5f')],_0x26399e[_0xb9f7('0x55')][_0xb9f7('0x60')],_0x26399e[_0xb9f7('0x55')][_0xb9f7('0x1a')]);}}}else{var _0x492a9c=_(_0x2b3934['query'])[_0xb9f7('0x37')]()[_0xb9f7('0x2a')](function(_0x2fcd34){return _['some'](_0x30c8e,['name',_0x2fcd34])?_0x2fcd34:undefined;})['compact']()[_0xb9f7('0x55')]();if(!_['isEmpty'](_0x492a9c)){_0x492a9c[_0xb9f7('0x2e')](function(_0x5bc299){if(_0x5bc299==='FaxAccountId'){_0x5b9139[_0xb9f7('0x40')](_0xb9f7('0x65'),[][_0xb9f7('0x66')](_0x2b3934['query'][_0x5bc299]));}else if(_0x5bc299===_0xb9f7('0x67')){var _0x221427=JSON[_0xb9f7('0x68')](_0x2b3934[_0xb9f7('0x36')][_0x5bc299])[_0xb9f7('0x69')];var _0x25b96c=JSON['parse'](_0x2b3934[_0xb9f7('0x36')][_0x5bc299])['$lte'];_0x5b9139[_0xb9f7('0x40')](_0xb9f7('0x6a'),_0x221427,_0x25b96c);}else{if(_0x2b3934['query'][_0x5bc299]==='null'){_0x5b9139[_0xb9f7('0x40')]('i.'+_0x5bc299+_0xb9f7('0x6b'));}else{_0x5b9139[_0xb9f7('0x40')]('i.'+_0x5bc299+_0xb9f7('0x6c'),_0x2b3934[_0xb9f7('0x36')][_0x5bc299]);}}});}if(_0x2b3934[_0xb9f7('0x36')][_0xb9f7('0x6d')]){if(_0x2b3934['query'][_0xb9f7('0x6d')]==0x1){_0x5b9139['having'](_0xb9f7('0x6e'));}else{_0x5b9139[_0xb9f7('0x56')](_0xb9f7('0x6f'));}}if(_0x2b3934['query']['tag']){_0x5aa510=_[_0xb9f7('0x70')](_0x2b3934[_0xb9f7('0x36')][_0xb9f7('0x71')])?_0x2b3934[_0xb9f7('0x36')][_0xb9f7('0x71')]:new Array(_0x2b3934[_0xb9f7('0x36')][_0xb9f7('0x71')]);_0x5aa510[_0xb9f7('0x2e')](function(_0x475069){_0x3e19ab['or'](_0xb9f7('0x72'),'%,'+_0x475069+',%');});}if(_0x2b3934[_0xb9f7('0x36')][_0xb9f7('0x73')]){var _0x83153f=_0x2b3934[_0xb9f7('0x36')]['filter'][_0xb9f7('0x74')]('\x5c','\x5c\x5c')[_0xb9f7('0x74')](/'/g,'\x27\x27');if(qs[_0xb9f7('0x75')](_0x83153f)){_0xb4b6fd['or'](_0xb9f7('0x76'),_0x83153f+'%')['or'](_0xb9f7('0x77'),_0x83153f+'%');}_0xb4b6fd['or'](_0xb9f7('0x78'),_0x83153f+'%');}}_0x5b9139[_0xb9f7('0x40')](_0xb4b6fd);_0x5b9139[_0xb9f7('0x79')](_0xb9f7('0x7a'));var _0x5e6709={'type':db[_0xb9f7('0x7b')][_0xb9f7('0x7c')][_0xb9f7('0x7d')],'raw':!![]};var _0x1166a1=_0x5b9139[_0xb9f7('0x7e')]();_0x1166a1[_0xb9f7('0x43')](_0xb9f7('0x7a'));_0x1166a1[_0xb9f7('0x43')](_0xb9f7('0x7f'),_0xb9f7('0x54'));if(_0x43ad05[_0xb9f7('0x3e')]){_0x43ad05['order'][_0xb9f7('0x2e')](function(_0x446aec){var _0x28e5f1=_0x446aec[0x0]===_0xb9f7('0x80')?_0x446aec[0x0]:'i.'+_0x446aec[0x0];_0x5b9139['order'](_0x28e5f1,_0x446aec[0x1]===_0xb9f7('0x81')?![]:!![]);});}if(!_[_0xb9f7('0x82')](_0x5aa510)){_0x5b9139[_0xb9f7('0x56')](_0x3e19ab);_0x1166a1['where']('t.id\x20IN\x20?',_0x5aa510);}BPromise[_0xb9f7('0x83')]()[_0xb9f7('0x25')](function(){if(!_0x2f2d19){if(_0x2b3934[_0xb9f7('0x36')][_0xb9f7('0x84')])return;_0x1166a1['where'](_0xb9f7('0x85'));_0x5b9139[_0xb9f7('0x40')](_0xb9f7('0x85'));return;}if(_0x2b3934[_0xb9f7('0x86')][_0xb9f7('0x87')]!==_0xb9f7('0x88'))return;return _0x2b3934[_0xb9f7('0x86')][_0xb9f7('0x89')]({'attributes':['id'],'raw':!![]})['then'](function(_0x34a316){if(_[_0xb9f7('0x82')](_0x34a316)){_0x1166a1[_0xb9f7('0x40')]('i.FaxAccountId\x20IS\x20NULL');_0x5b9139[_0xb9f7('0x40')](_0xb9f7('0x8a'));}else{_0x1166a1[_0xb9f7('0x40')]('i.FaxAccountId\x20IN\x20?',_[_0xb9f7('0x2a')](_0x34a316,'id'));_0x5b9139[_0xb9f7('0x40')](_0xb9f7('0x65'),_[_0xb9f7('0x2a')](_0x34a316,'id'));}});})[_0xb9f7('0x25')](function(){if(_0x2b3934[_0xb9f7('0x86')][_0xb9f7('0x87')]===_0xb9f7('0x88')&&!_0x2f2d19&&!_0x2b3934[_0xb9f7('0x36')][_0xb9f7('0x84')])return[];return db['sequelize'][_0xb9f7('0x36')](_0x1166a1[_0xb9f7('0x8b')](),_0x5e6709);})[_0xb9f7('0x25')](function(_0x14e46f){_0x3247cf[_0xb9f7('0x1c')]=_0x14e46f[_0xb9f7('0x52')];if(_0x3247cf[_0xb9f7('0x1c')]===0x0)return[];return db[_0xb9f7('0x8c')][_0xb9f7('0x36')](_0x5ca9cb[_0xb9f7('0x8b')](),_0x5e6709)[_0xb9f7('0x25')](function(_0x185196){_0x145e31=_[_0xb9f7('0x8d')](_0x185196,'id');_0x5e6709=_[_0xb9f7('0x8e')](_0x5e6709,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b3934[_0xb9f7('0x36')][_0xb9f7('0x3c')]){_0x43ad05['attributes'][_0xb9f7('0x2e')](function(_0x590252){_0x5b9139[_0xb9f7('0x43')]('i.'+_0x590252);});}else{_0x5b9139[_0xb9f7('0x43')](_0xb9f7('0x7f'),_0xb9f7('0x54'));_0x5b9139[_0xb9f7('0x43')](_0xb9f7('0x8f'),_0xb9f7('0x90'));_0x5b9139[_0xb9f7('0x43')](_0xb9f7('0x91'),_0xb9f7('0x92'));_0x5b9139[_0xb9f7('0x43')](_0xb9f7('0x93'),_0xb9f7('0x80'));_0x5b9139[_0xb9f7('0x43')](_0xb9f7('0x94'));_0x5b9139[_0xb9f7('0x43')](_0xb9f7('0x95'),_0xb9f7('0x96'));_0x5b9139[_0xb9f7('0x43')]('c.lastName','Contact.lastName');_0x5b9139['field'](_0xb9f7('0x97'),'Contact.email');_0x5b9139['field']('c.phone',_0xb9f7('0x98'));_0x5b9139[_0xb9f7('0x43')](_0xb9f7('0x99'),_0xb9f7('0x9a'));_0x5b9139['field'](_0xb9f7('0x9b'),_0xb9f7('0x9c'));_0x5b9139['field'](_0xb9f7('0x9d'),_0xb9f7('0x9e'));_0x5b9139[_0xb9f7('0x43')](_0xb9f7('0x9f'),_0xb9f7('0xa0'));_0x5b9139['field'](_0xb9f7('0xa1'),'TagIds');}if(_0x43ad05[_0xb9f7('0x1e')])_0x5b9139[_0xb9f7('0x1e')](_0x43ad05[_0xb9f7('0x1e')]);if(_0x43ad05[_0xb9f7('0x1d')])_0x5b9139[_0xb9f7('0x1d')](_0x43ad05[_0xb9f7('0x1d')]);return db[_0xb9f7('0x8c')][_0xb9f7('0x36')](_0x5b9139[_0xb9f7('0x8b')](),_0x5e6709);})[_0xb9f7('0x25')](function(_0x3023d3){_0x2fc41c[_0xb9f7('0x40')](_0xb9f7('0xa2'),_[_0xb9f7('0x2a')](_0x3023d3,'id'));return db['sequelize'][_0xb9f7('0x36')](_0x2fc41c['toString'](),_0x5e6709)[_0xb9f7('0x25')](function(_0xe1f4d9){var _0x1deaef=_[_0xb9f7('0xa3')](_0xe1f4d9,'FaxInteractionId');var _0x25cc8a=[];_0x3023d3['forEach'](function(_0x1a744c){_0x25cc8a['push'](updateFaxInteraction(_0x1a744c,_0x145e31,_0x1deaef));});return BPromise[_0xb9f7('0xa4')](_0x25cc8a);});});})[_0xb9f7('0x25')](function(_0x151a11){_0x3247cf[_0xb9f7('0xa5')]=_0x151a11;return _0x3247cf;})[_0xb9f7('0x25')](respondWithFilteredResult(_0x1f68b1,_0x43ad05))[_0xb9f7('0x2f')](handleError(_0x1f68b1,null));};exports[_0xb9f7('0xa6')]=function(_0x54c228,_0x1a82ef){var _0x57c7a8={'raw':![],'where':{'id':_0x54c228[_0xb9f7('0xa7')]['id']}},_0x5a9d63={};_0x5a9d63[_0xb9f7('0x3a')]=_[_0xb9f7('0x37')](db['FaxInteraction'][_0xb9f7('0x32')]);_0x5a9d63['query']=_[_0xb9f7('0x37')](_0x54c228[_0xb9f7('0x36')]);_0x5a9d63[_0xb9f7('0x38')]=_['intersection'](_0x5a9d63[_0xb9f7('0x3a')],_0x5a9d63['query']);_0x57c7a8[_0xb9f7('0x3b')]=_[_0xb9f7('0x39')](_0x5a9d63[_0xb9f7('0x3a')],qs[_0xb9f7('0x3c')](_0x54c228[_0xb9f7('0x36')]['fields']));_0x57c7a8[_0xb9f7('0x3b')]=_0x57c7a8[_0xb9f7('0x3b')][_0xb9f7('0x52')]?_0x57c7a8[_0xb9f7('0x3b')]:_0x5a9d63[_0xb9f7('0x3a')];if(_0x54c228['query'][_0xb9f7('0xa8')]){_0x57c7a8['include']=[{'all':!![]}];}_0x57c7a8=_[_0xb9f7('0x8e')]({},_0x57c7a8,_0x54c228[_0xb9f7('0xa9')]);return db[_0xb9f7('0x31')][_0xb9f7('0x53')](_0x57c7a8)['then'](handleEntityNotFound(_0x1a82ef,null))[_0xb9f7('0x25')](respondWithResult(_0x1a82ef,null))[_0xb9f7('0x2f')](handleError(_0x1a82ef,null));};exports['create']=function(_0x163408,_0x51fd6b){return db[_0xb9f7('0x31')][_0xb9f7('0xaa')](_0x163408[_0xb9f7('0xab')],{})['then'](respondWithResult(_0x51fd6b,0xc9))[_0xb9f7('0x2f')](handleError(_0x51fd6b,null));};exports[_0xb9f7('0x24')]=function(_0x2504fc,_0x10c990){if(_0x2504fc[_0xb9f7('0xab')]['id']){delete _0x2504fc[_0xb9f7('0xab')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x2504fc['params']['id']}})[_0xb9f7('0x25')](handleEntityNotFound(_0x10c990,null))['then'](saveUpdates(_0x2504fc[_0xb9f7('0xab')],null))[_0xb9f7('0x25')](respondWithResult(_0x10c990,null))[_0xb9f7('0x2f')](handleError(_0x10c990,null));};exports[_0xb9f7('0xac')]=function(_0x5accbb,_0x16d560){return db[_0xb9f7('0x31')][_0xb9f7('0x53')]({'where':{'id':_0x5accbb['params']['id']}})[_0xb9f7('0x25')](handleEntityNotFound(_0x16d560,null))[_0xb9f7('0x25')](removeEntity(_0x16d560,null))[_0xb9f7('0x2f')](handleError(_0x16d560,null));};exports[_0xb9f7('0xad')]=function(_0x4be15c,_0x37135c){return db[_0xb9f7('0x31')][_0xb9f7('0xad')]()[_0xb9f7('0x25')](respondWithResult(_0x37135c,null))[_0xb9f7('0x2f')](handleError(_0x37135c,null));};exports[_0xb9f7('0xae')]=function(_0x5dbca7,_0x58bd82,_0x493c0b){return db[_0xb9f7('0xaf')][_0xb9f7('0x53')]({'where':{'id':_0x5dbca7[_0xb9f7('0xa7')]['id']}})[_0xb9f7('0x25')](handleEntityNotFound(_0x58bd82,null))['then'](function(_0x53fc9b){if(_0x53fc9b){return _0x53fc9b[_0xb9f7('0xae')](_0x5dbca7[_0xb9f7('0xab')][_0xb9f7('0xb0')],_[_0xb9f7('0xb1')](_0x5dbca7[_0xb9f7('0xab')],[_0xb9f7('0xb0'),'id'])||{});}})[_0xb9f7('0x25')](respondWithResult(_0x58bd82,null))[_0xb9f7('0x2f')](handleError(_0x58bd82,null));};exports['getMessages']=function(_0x2d6fa8,_0x7a3c75,_0xf61f02){var _0x29fdb3={'raw':![],'where':{}};var _0x1f9932={};var _0xfa2e88={'count':0x0,'rows':[]};return db[_0xb9f7('0x31')]['findOne']({'where':{'id':_0x2d6fa8[_0xb9f7('0xa7')]['id']}})['then'](handleEntityNotFound(_0x7a3c75,null))[_0xb9f7('0x25')](function(_0x37249d){if(_0x37249d){_0x1f9932[_0xb9f7('0x3a')]=_[_0xb9f7('0x37')](db[_0xb9f7('0xaf')]['rawAttributes']);_0x1f9932[_0xb9f7('0x36')]=_[_0xb9f7('0x37')](_0x2d6fa8['query']);_0x1f9932[_0xb9f7('0x38')]=_[_0xb9f7('0x39')](_0x1f9932['model'],_0x1f9932[_0xb9f7('0x36')]);_0x29fdb3[_0xb9f7('0x3b')]=_[_0xb9f7('0x39')](_0x1f9932[_0xb9f7('0x3a')],qs[_0xb9f7('0x3c')](_0x2d6fa8[_0xb9f7('0x36')][_0xb9f7('0x3c')]));_0x29fdb3[_0xb9f7('0x3b')]=_0x29fdb3[_0xb9f7('0x3b')]['length']?_0x29fdb3[_0xb9f7('0x3b')]:_0x1f9932[_0xb9f7('0x3a')];if(!_0x2d6fa8['query'][_0xb9f7('0xb2')](_0xb9f7('0x3d'))){_0x29fdb3[_0xb9f7('0x1e')]=qs[_0xb9f7('0x1e')](_0x2d6fa8['query'][_0xb9f7('0x1e')]);_0x29fdb3['offset']=qs[_0xb9f7('0x1d')](_0x2d6fa8[_0xb9f7('0x36')][_0xb9f7('0x1d')]);}_0x29fdb3[_0xb9f7('0x3e')]=qs['sort'](_0x2d6fa8[_0xb9f7('0x36')]['sort']);_0x29fdb3[_0xb9f7('0x40')]=qs[_0xb9f7('0x38')](_[_0xb9f7('0x41')](_0x2d6fa8[_0xb9f7('0x36')],_0x1f9932[_0xb9f7('0x38')]));_0x29fdb3['where']['FaxInteractionId']=_0x37249d['id'];if(_0x2d6fa8[_0xb9f7('0x36')]['filter']){_0x29fdb3['where']=_['merge'](_0x29fdb3[_0xb9f7('0x40')],{'$or':_[_0xb9f7('0x2a')](_0x29fdb3[_0xb9f7('0x3b')],function(_0x3435c1){var _0x29e3ca={};_0x29e3ca[_0x3435c1]={'$like':'%'+_0x2d6fa8[_0xb9f7('0x36')]['filter']+'%'};return _0x29e3ca;})});}if(_0x2d6fa8['query'][_0xb9f7('0x69')]){var _0x424b41=_0x2d6fa8[_0xb9f7('0x36')]['$gte'][_0xb9f7('0x2d')](',');var _0x5444d5={};_0x5444d5[_0x424b41[0x0]]={'$gte':moment(_0x424b41[0x1])[_0xb9f7('0xb3')](_0xb9f7('0xb4'))};_0x29fdb3[_0xb9f7('0x40')]=_[_0xb9f7('0x8e')](_0x29fdb3[_0xb9f7('0x40')],_0x5444d5);}_0x29fdb3=_['merge']({},_0x29fdb3,_0x2d6fa8[_0xb9f7('0xa9')]);return db[_0xb9f7('0xaf')][_0xb9f7('0x1c')]({'where':_0x29fdb3[_0xb9f7('0x40')]})['then'](function(_0x2c4dac){_0xfa2e88[_0xb9f7('0x1c')]=_0x2c4dac;if(_0x2d6fa8['query']['includeAll']){_0x29fdb3[_0xb9f7('0xb5')]=[{'all':!![]}];}return db[_0xb9f7('0xaf')][_0xb9f7('0xb6')](_0x29fdb3);})[_0xb9f7('0x25')](function(_0x52e57e){_0xfa2e88['rows']=_0x52e57e;return _0xfa2e88;});}})[_0xb9f7('0x25')](respondWithFilteredResult(_0x7a3c75,_0x29fdb3))[_0xb9f7('0x2f')](handleError(_0x7a3c75,null));};exports[_0xb9f7('0xb7')]=function(_0x47e557,_0x3aa030,_0x2f5eb9){return db[_0xb9f7('0x31')][_0xb9f7('0x53')]({'where':{'id':_0x47e557['params']['id']}})[_0xb9f7('0x25')](handleEntityNotFound(_0x3aa030,null))[_0xb9f7('0x25')](function(_0x764317){if(_0x764317){return _0x764317[_0xb9f7('0xb8')](_0x47e557[_0xb9f7('0xab')]['ids'],_[_0xb9f7('0xb1')](_0x47e557[_0xb9f7('0xab')],[_0xb9f7('0xb0'),'id'])||{})[_0xb9f7('0xb9')](function(){return db['Tag'][_0xb9f7('0xb6')]({'attributes':['id',_0xb9f7('0x27'),_0xb9f7('0xba')],'where':{'id':_0x47e557['body'][_0xb9f7('0xb0')]}});})['then'](function(_0x43dfaa){socket[_0xb9f7('0xbb')](_0xb9f7('0xbc'),{'id':Number(_0x47e557[_0xb9f7('0xa7')]['id']),'tags':_0x43dfaa||[]});return{'id':Number(_0x47e557[_0xb9f7('0xa7')]['id']),'tags':_0x43dfaa||[]};});}})[_0xb9f7('0x25')](respondWithResult(_0x3aa030,null))['catch'](handleError(_0x3aa030,null));};exports[_0xb9f7('0xbd')]=function(_0x397d36,_0x4dda7a,_0x28d13a){return db[_0xb9f7('0x31')][_0xb9f7('0x53')]({'where':{'id':_0x397d36['params']['id']}})[_0xb9f7('0x25')](handleEntityNotFound(_0x4dda7a,null))[_0xb9f7('0x25')](function(_0x231d8e){if(_0x231d8e){return _0x231d8e['removeTags'](_0x397d36[_0xb9f7('0x36')][_0xb9f7('0xb0')]);}})[_0xb9f7('0x25')](respondWithStatusCode(_0x4dda7a,null))[_0xb9f7('0x2f')](handleError(_0x4dda7a,null));};exports[_0xb9f7('0xbe')]=function(_0x3b29cf,_0x2e7931){var _0x5c8bb1=moment()[_0xb9f7('0xbf')]()['toString']();var _0x31556a=path['join'](config['root'],_0xb9f7('0xc0'),_0xb9f7('0xc1'),'tmp');var _0xf7a61b=path['join'](config[_0xb9f7('0xc2')],_0xb9f7('0xc0'),_0xb9f7('0xc1'),_0xb9f7('0xc3'));var _0x1c4a04=path[_0xb9f7('0xc4')](_0x31556a,_0x5c8bb1);var _0x35573c=util[_0xb9f7('0xb3')](_0xb9f7('0xc5'),_0x3b29cf[_0xb9f7('0xa7')]['id'],_0x5c8bb1);var _0x4346fb=path[_0xb9f7('0xc4')](_0x31556a,_0x35573c);var _0x13af44=[];_0x13af44[_0xb9f7('0xc6')]({'model':db[_0xb9f7('0xc7')],'as':_0xb9f7('0xc7'),'raw':!![]});var _0x5a3665=[{'model':db[_0xb9f7('0xaf')],'as':_0xb9f7('0xc8'),'attributes':['id',_0xb9f7('0xab'),'createdAt'],'include':_0x13af44}];return db[_0xb9f7('0x31')][_0xb9f7('0x53')]({'where':{'id':_0x3b29cf[_0xb9f7('0xa7')]['id']},'include':_0x5a3665})[_0xb9f7('0x25')](handleEntityNotFound(_0x2e7931,null))[_0xb9f7('0x25')](function(_0x433028){if(_0x433028&&_0x433028[_0xb9f7('0xc8')]){var _0x349647=_0x433028[_0xb9f7('0xc9')]({'plain':!![]});fs['mkdirSync'](_0x1c4a04);for(var _0x29d143=0x0;_0x29d143<_0x349647[_0xb9f7('0xc8')][_0xb9f7('0x52')];_0x29d143++){var _0x2b306c=_0x349647['Messages'][_0x29d143]['Attachment'];if(_0x2b306c){var _0x24ecac=path[_0xb9f7('0xc4')](_0xf7a61b,_0x2b306c['basename']);if(fs[_0xb9f7('0xca')](_0x24ecac)){fs[_0xb9f7('0xcb')](_0x24ecac)[_0xb9f7('0xcc')](fs[_0xb9f7('0xcd')](path[_0xb9f7('0xc4')](_0x1c4a04,_0x2b306c[_0xb9f7('0xce')])));}}}return BPromise[_0xb9f7('0x83')]()[_0xb9f7('0x25')](function(){return new BPromise(function(_0x5612a3,_0x1aa16f){zipdir(_0x1c4a04,{'saveTo':_0x4346fb},function(_0x94d16b,_0x53bd21){if(_0x94d16b)return _0x1aa16f(_0x94d16b);return _0x5612a3(_0x53bd21);});})[_0xb9f7('0x25')](function(){return new BPromise(function(_0xbead3c,_0x58d3d7){rimraf(_0x1c4a04,function(_0x36fbc3){if(_0x36fbc3)_0x58d3d7(_0x36fbc3);return _0xbead3c();});});})[_0xb9f7('0x25')](function(){return _0x2e7931[_0xb9f7('0xbe')](_0x4346fb,_0x35573c,function(_0x41f6d7){if(_0x41f6d7){console[_0xb9f7('0xcf')](_0xb9f7('0xd0'),_0x41f6d7);}else{fs['unlinkSync'](_0x4346fb);}});});});}else{return _0x2e7931['sendStatus'](0xc8);}})['catch'](handleError(_0x2e7931,null));}; \ No newline at end of file +var _0xabce=['push','catch','FaxInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','select','field','tools_tags','u.id','u.fullname','ui.FaxInteractionId','from','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','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','some','compact','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','i.fax\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','isEmpty','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','agent','merge','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','sequelize','toString','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','includeAll','include','create','body','describe','addMessage','ids','omit','findOne','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','setTags','spread','color','emit','faxInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','createdAt','Messages','get','mkdirSync','basename','log','err','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','json','count','offset','apply','reject','save','update','then','destroy','error','stack','name','Users','map','fullname','TagIds','split','forEach','Tags'];(function(_0x571064,_0x1ac60b){var _0x148d46=function(_0x5183b9){while(--_0x5183b9){_0x571064['push'](_0x571064['shift']());}};_0x148d46(++_0x1ac60b);}(_0xabce,0xa2));var _0xeabc=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xabce[_0x92c450];return _0x2a9599;};'use strict';var pdf=require(_0xeabc('0x0'));var emlformat=require(_0xeabc('0x1'));var rimraf=require(_0xeabc('0x2'));var zipdir=require(_0xeabc('0x3'));var jsonpatch=require(_0xeabc('0x4'));var rp=require('request-promise');var moment=require(_0xeabc('0x5'));var BPromise=require(_0xeabc('0x6'));var Mustache=require(_0xeabc('0x7'));var util=require(_0xeabc('0x8'));var path=require(_0xeabc('0x9'));var sox=require(_0xeabc('0xa'));var csv=require('to-csv');var ejs=require(_0xeabc('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xeabc('0xc'));var crypto=require(_0xeabc('0xd'));var jsforce=require(_0xeabc('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xeabc('0xf'));var querystring=require('querystring');var Papa=require(_0xeabc('0x10'));var Redis=require(_0xeabc('0x11'));var authService=require(_0xeabc('0x12'));var qs=require(_0xeabc('0x13'));var as=require(_0xeabc('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeabc('0x15'))(_0xeabc('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xeabc('0x17'));var db=require(_0xeabc('0x18'))['db'];config[_0xeabc('0x19')]=_[_0xeabc('0x1a')](config[_0xeabc('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xeabc('0x1b'))(new Redis(config[_0xeabc('0x19')]));require(_0xeabc('0x1c'))['register'](socket);function respondWithStatusCode(_0x133508,_0x2f6c68){_0x2f6c68=_0x2f6c68||0xcc;return function(_0x4c3178){if(_0x4c3178){return _0x133508[_0xeabc('0x1d')](_0x2f6c68);}return _0x133508[_0xeabc('0x1e')](_0x2f6c68)[_0xeabc('0x1f')]();};}function respondWithResult(_0x22803b,_0xac3b80){_0xac3b80=_0xac3b80||0xc8;return function(_0xb5db6d){if(_0xb5db6d){return _0x22803b['status'](_0xac3b80)[_0xeabc('0x20')](_0xb5db6d);}};}function respondWithFilteredResult(_0x5d4395,_0x4d7c73){return function(_0x31b5ca){if(_0x31b5ca){var _0x1547cb=_0x31b5ca[_0xeabc('0x21')],_0x1aeb58=_0x4d7c73[_0xeabc('0x22')],_0x408b1f=_0x4d7c73[_0xeabc('0x22')]+_0x4d7c73['limit'],_0x31ed02;if(_0x408b1f>=_0x1547cb){_0x408b1f=_0x1547cb;_0x31ed02=0xc8;}else{_0x31ed02=0xce;}_0x5d4395[_0xeabc('0x1e')](_0x31ed02);return _0x5d4395['set']('Content-Range',_0x1aeb58+'-'+_0x408b1f+'/'+_0x1547cb)[_0xeabc('0x20')](_0x31b5ca);}return null;};}function patchUpdates(_0x2b5d4d){return function(_0x43561f){try{jsonpatch[_0xeabc('0x23')](_0x43561f,_0x2b5d4d,!![]);}catch(_0x1200fc){return BPromise[_0xeabc('0x24')](_0x1200fc);}return _0x43561f[_0xeabc('0x25')]();};}function saveUpdates(_0xb95a12,_0x3ec3c1){return function(_0x34080c){if(_0x34080c){return _0x34080c[_0xeabc('0x26')](_0xb95a12)[_0xeabc('0x27')](function(_0x16d264){return _0x16d264;});}return null;};}function removeEntity(_0x12808a,_0x45b83e){return function(_0x575605){if(_0x575605){return _0x575605[_0xeabc('0x28')]()[_0xeabc('0x27')](function(){_0x12808a[_0xeabc('0x1e')](0xcc)[_0xeabc('0x1f')]();});}};}function handleEntityNotFound(_0x49ffdd,_0x1f37ac){return function(_0x2ead9b){if(!_0x2ead9b){_0x49ffdd[_0xeabc('0x1d')](0x194);}return _0x2ead9b;};}function handleError(_0x129000,_0x3f3c35){_0x3f3c35=_0x3f3c35||0x1f4;return function(_0x56119b){logger[_0xeabc('0x29')](_0x56119b[_0xeabc('0x2a')]);if(_0x56119b[_0xeabc('0x2b')]){delete _0x56119b[_0xeabc('0x2b')];}_0x129000[_0xeabc('0x1e')](_0x3f3c35)['send'](_0x56119b);};}function getInteractionUsers(_0xa3b34f,_0x2cac14){return new BPromise(function(_0x6b0c91,_0x4225c4){try{if(_0x2cac14[_0xa3b34f['id']]){_0xa3b34f[_0xeabc('0x2c')]=_[_0xeabc('0x2d')](_0x2cac14[_0xa3b34f['id']],function(_0x477acd){return{'id':_0x477acd['id'],'fullname':_0x477acd[_0xeabc('0x2e')]};});}}catch(_0x743894){_0x4225c4(_0x743894);}_0x6b0c91(_0xa3b34f);});}function getInteractionTags(_0x2bd794,_0x23f0b1){return new BPromise(function(_0xe29973,_0x34162a){try{if(_0x2bd794[_0xeabc('0x2f')]){_0x2bd794['Tags']=[];_0x2bd794['TagIds'][_0xeabc('0x30')](',')[_0xeabc('0x31')](function(_0x79c034){_0x2bd794[_0xeabc('0x32')][_0xeabc('0x33')](_0x23f0b1[_0x79c034]);});}delete _0x2bd794[_0xeabc('0x2f')];}catch(_0x185582){_0x34162a(_0x185582);}_0xe29973(_0x2bd794);});}function updateFaxInteraction(_0x2a589f,_0x4f7bb5,_0x3687d1){return new BPromise(function(_0x14496a,_0x4558b7){return getInteractionUsers(_0x2a589f,_0x3687d1)[_0xeabc('0x27')](function(_0xb205d5){return getInteractionTags(_0xb205d5,_0x4f7bb5);})[_0xeabc('0x27')](function(_0x1778ca){_0x14496a(_0x1778ca);})[_0xeabc('0x34')](function(_0x267e15){_0x4558b7(_0x267e15);});});}exports['index']=function(_0x2240dc,_0x5ea578){var _0x417f8a={},_0x265557={},_0x267510={'count':0x0,'rows':[]};var _0x5deaf7=_[_0xeabc('0x2d')](db[_0xeabc('0x35')][_0xeabc('0x36')],function(_0x4da0bf){return{'name':_0x4da0bf['fieldName'],'type':_0x4da0bf[_0xeabc('0x37')][_0xeabc('0x38')]};});_0x265557[_0xeabc('0x39')]=_[_0xeabc('0x2d')](_0x5deaf7,_0xeabc('0x2b'));_0x265557[_0xeabc('0x3a')]=_[_0xeabc('0x3b')](_0x2240dc['query']);_0x265557[_0xeabc('0x3c')]=_[_0xeabc('0x3d')](_0x265557['model'],_0x265557[_0xeabc('0x3a')]);_0x417f8a[_0xeabc('0x3e')]=_['intersection'](_0x265557[_0xeabc('0x39')],qs[_0xeabc('0x3f')](_0x2240dc[_0xeabc('0x3a')][_0xeabc('0x3f')]));_0x417f8a[_0xeabc('0x3e')]=_0x417f8a[_0xeabc('0x3e')][_0xeabc('0x40')]?_0x417f8a[_0xeabc('0x3e')]:_0x265557[_0xeabc('0x39')];if(!_0x2240dc[_0xeabc('0x3a')][_0xeabc('0x41')](_0xeabc('0x42'))){_0x417f8a[_0xeabc('0x43')]=qs[_0xeabc('0x43')](_0x2240dc[_0xeabc('0x3a')][_0xeabc('0x43')]);_0x417f8a[_0xeabc('0x22')]=qs['offset'](_0x2240dc[_0xeabc('0x3a')][_0xeabc('0x22')]);}_0x417f8a[_0xeabc('0x44')]=qs['sort'](_0x2240dc[_0xeabc('0x3a')][_0xeabc('0x45')]);_0x417f8a[_0xeabc('0x46')]=qs[_0xeabc('0x3c')](_[_0xeabc('0x47')](_0x2240dc[_0xeabc('0x3a')],_0x265557[_0xeabc('0x3c')]),_0x5deaf7);var _0x264636=[];var _0x224632=squel[_0xeabc('0x48')]()['field']('id')[_0xeabc('0x49')](_0xeabc('0x2b'))['field']('color')['from'](_0xeabc('0x4a'));var _0x556acd=squel[_0xeabc('0x48')]()[_0xeabc('0x49')](_0xeabc('0x4b'))['field'](_0xeabc('0x4c'))[_0xeabc('0x49')](_0xeabc('0x4d'))[_0xeabc('0x4e')](_0xeabc('0x4f'),'ui')[_0xeabc('0x50')]('users','u',_0xeabc('0x51'));var _0x38ab99=squel['select']()['from'](_0xeabc('0x52'),'i')[_0xeabc('0x50')]('cm_contacts','c',_0xeabc('0x53'))[_0xeabc('0x50')]('users','o',_0xeabc('0x54'))[_0xeabc('0x50')](_0xeabc('0x55'),'a','a.id\x20=\x20i.FaxAccountId')[_0xeabc('0x50')](_0xeabc('0x56'),'me',_0xeabc('0x57'))[_0xeabc('0x50')]('fax_interaction_has_tags','it',_0xeabc('0x58'))[_0xeabc('0x50')](_0xeabc('0x4a'),'t',_0xeabc('0x59'));var _0x2ecc34=squel[_0xeabc('0x5a')]();var _0x5c29bf=[];var _0x5ac591=squel[_0xeabc('0x5a')]();var _0x292f8f;if(_0x2240dc['query'][_0xeabc('0x5b')]){_0x292f8f=as[_0xeabc('0x5c')](_0x2240dc['query'][_0xeabc('0x5b')]);var _0x533ae4=_0x292f8f['sqlOperator'];for(var _0x2fac8d=0x0;_0x2fac8d<_0x292f8f['conditions'][_0xeabc('0x40')];_0x2fac8d++){var _0x185a56=_0x292f8f[_0xeabc('0x5d')][_0x2fac8d];var _0x59b19a='i';var _0x415150=_['find'](_0x5deaf7,[_0xeabc('0x2b'),_0x185a56['field']]);if(!_0x415150){switch(_0x185a56[_0xeabc('0x49')]){case _0xeabc('0x5e'):if(_0x185a56[_0xeabc('0x5f')]==0x1){_0x38ab99['having']('`'+_0x185a56['field']+'`\x20=\x200');}else{_0x38ab99[_0xeabc('0x60')]('`'+_0x185a56['field']+_0xeabc('0x61'));}break;case _0xeabc('0x62'):if(_0x185a56[_0xeabc('0x63')]===_0xeabc('0x64')){if(_0x185a56[_0xeabc('0x5f')][_0xeabc('0x30')]('\x20')[_0xeabc('0x40')]>0x1){_0x2ecc34[_0x533ae4](_0xeabc('0x65'),qs[_0xeabc('0x66')](_0x185a56[_0xeabc('0x5f')]),null);}else{var _0x3864f3='%'+_0x185a56[_0xeabc('0x5f')]+'%';_0x2ecc34[_0x533ae4](_0xeabc('0x67'),_0x3864f3,_0x3864f3,_0x3864f3);}}else{_0x415150=_[_0xeabc('0x68')](_0x5deaf7,[_0xeabc('0x2b'),_0xeabc('0x69')]);_0x185a56[_0xeabc('0x49')]=_0xeabc('0x69');_0x240d32=as[_0xeabc('0x6a')](_0x59b19a,_0x415150['type'],_0x185a56);_0x2ecc34[_0x533ae4](_0x240d32[_0xeabc('0x6b')],_0x240d32[_0xeabc('0x5f')][_0xeabc('0x6c')],_0x240d32[_0xeabc('0x5f')][_0xeabc('0x1f')]);}break;case _0xeabc('0x6d'):var _0x426f76=_0x185a56[_0xeabc('0x5f')]['split'](',')[_0xeabc('0x2d')](function(_0x2d8988){return Number(_0x2d8988);});_0x426f76[_0xeabc('0x31')](function(_0x17217c){_0x5ac591['or'](_0xeabc('0x6e'),'%,'+_0x17217c+',%');});_0x5c29bf=_[_0xeabc('0x6f')](_0x5c29bf,_0x426f76);break;case _0xeabc('0x70'):if(_0x185a56['operator']==='$substring'){_0x2ecc34[_0x533ae4](_0xeabc('0x71'),'%'+_0x185a56[_0xeabc('0x5f')]+'%',null);}else{_0x415150=_[_0xeabc('0x68')](_0x5deaf7,[_0xeabc('0x2b'),_0xeabc('0x72')]);_0x185a56[_0xeabc('0x49')]='UserId';_0x240d32=as['buildExpression'](_0x59b19a,_0x415150[_0xeabc('0x37')],_0x185a56);_0x2ecc34[_0x533ae4](_0x240d32[_0xeabc('0x6b')],_0x240d32['value'][_0xeabc('0x6c')],_0x240d32[_0xeabc('0x5f')][_0xeabc('0x1f')]);}break;case'body':_0x240d32=as[_0xeabc('0x6a')]('me',null,_0x185a56);_0x2ecc34[_0x533ae4](_0x240d32[_0xeabc('0x6b')],_0x240d32[_0xeabc('0x5f')][_0xeabc('0x6c')],_0x240d32['value'][_0xeabc('0x1f')]);break;}}else{var _0x240d32=as[_0xeabc('0x6a')](_0x59b19a,_0x415150[_0xeabc('0x37')],_0x185a56);_0x2ecc34[_0x533ae4](_0x240d32[_0xeabc('0x6b')],_0x240d32['value'][_0xeabc('0x6c')],_0x240d32[_0xeabc('0x5f')][_0xeabc('0x1f')]);}}}else{var _0x945125=_(_0x2240dc[_0xeabc('0x3a')])[_0xeabc('0x3b')]()[_0xeabc('0x2d')](function(_0x4ffc9c){return _[_0xeabc('0x73')](_0x5deaf7,[_0xeabc('0x2b'),_0x4ffc9c])?_0x4ffc9c:undefined;})[_0xeabc('0x74')]()['value']();if(!_['isEmpty'](_0x945125)){_0x945125['forEach'](function(_0x465f73){if(_0x465f73==='FaxAccountId'){_0x38ab99[_0xeabc('0x46')]('i.FaxAccountId\x20IN\x20?',[][_0xeabc('0x75')](_0x2240dc[_0xeabc('0x3a')][_0x465f73]));}else if(_0x465f73==='createdAt'){var _0x42d6ea=JSON[_0xeabc('0x76')](_0x2240dc[_0xeabc('0x3a')][_0x465f73])['$gte'];var _0x24fe92=JSON[_0xeabc('0x76')](_0x2240dc[_0xeabc('0x3a')][_0x465f73])[_0xeabc('0x77')];_0x38ab99[_0xeabc('0x46')](_0xeabc('0x78'),_0x42d6ea,_0x24fe92);}else{if(_0x2240dc[_0xeabc('0x3a')][_0x465f73]===_0xeabc('0x79')){_0x38ab99['where']('i.'+_0x465f73+_0xeabc('0x7a'));}else{_0x38ab99[_0xeabc('0x46')]('i.'+_0x465f73+_0xeabc('0x7b'),_0x2240dc['query'][_0x465f73]);}}});}if(_0x2240dc[_0xeabc('0x3a')][_0xeabc('0x7c')]){if(_0x2240dc[_0xeabc('0x3a')][_0xeabc('0x7c')]==0x1){_0x38ab99['having'](_0xeabc('0x7d'));}else{_0x38ab99[_0xeabc('0x60')](_0xeabc('0x7e'));}}if(_0x2240dc[_0xeabc('0x3a')][_0xeabc('0x7f')]){_0x5c29bf=_['isArray'](_0x2240dc[_0xeabc('0x3a')]['tag'])?_0x2240dc[_0xeabc('0x3a')][_0xeabc('0x7f')]:new Array(_0x2240dc[_0xeabc('0x3a')]['tag']);_0x5c29bf[_0xeabc('0x31')](function(_0x1b17cd){_0x5ac591['or'](_0xeabc('0x6e'),'%,'+_0x1b17cd+',%');});}if(_0x2240dc[_0xeabc('0x3a')][_0xeabc('0x80')]){var _0x56895d=_0x2240dc[_0xeabc('0x3a')][_0xeabc('0x80')][_0xeabc('0x81')]('\x5c','\x5c\x5c')[_0xeabc('0x81')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x56895d)){_0x2ecc34['or']('i.id\x20LIKE\x20?',_0x56895d+'%')['or'](_0xeabc('0x82'),_0x56895d+'%');}_0x2ecc34['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x56895d+'%');}}_0x38ab99['where'](_0x2ecc34);_0x38ab99['group'](_0xeabc('0x83'));var _0x3dc299={'type':db[_0xeabc('0x84')][_0xeabc('0x85')][_0xeabc('0x86')],'raw':!![]};var _0x111900=_0x38ab99['clone']();_0x111900['field'](_0xeabc('0x83'));_0x111900['field'](_0xeabc('0x87'),_0xeabc('0x5e'));if(_0x417f8a[_0xeabc('0x44')]){_0x417f8a['order'][_0xeabc('0x31')](function(_0x33972b){var _0x223616=_0x33972b[0x0]===_0xeabc('0x88')?_0x33972b[0x0]:'i.'+_0x33972b[0x0];_0x38ab99[_0xeabc('0x44')](_0x223616,_0x33972b[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x5c29bf)){_0x38ab99['having'](_0x5ac591);_0x111900[_0xeabc('0x46')](_0xeabc('0x89'),_0x5c29bf);}BPromise[_0xeabc('0x8a')]()[_0xeabc('0x27')](function(){if(!_0x292f8f){if(_0x2240dc[_0xeabc('0x3a')][_0xeabc('0x8b')])return;_0x111900[_0xeabc('0x46')](_0xeabc('0x8c'));_0x38ab99[_0xeabc('0x46')](_0xeabc('0x8c'));return;}if(_0x2240dc[_0xeabc('0x8d')]['role']!=='agent')return;return _0x2240dc[_0xeabc('0x8d')][_0xeabc('0x8e')]({'attributes':['id'],'raw':!![]})[_0xeabc('0x27')](function(_0x406dc6){if(_[_0xeabc('0x8f')](_0x406dc6)){_0x111900[_0xeabc('0x46')]('i.FaxAccountId\x20IS\x20NULL');_0x38ab99[_0xeabc('0x46')](_0xeabc('0x90'));}else{_0x111900[_0xeabc('0x46')](_0xeabc('0x91'),_[_0xeabc('0x2d')](_0x406dc6,'id'));_0x38ab99[_0xeabc('0x46')](_0xeabc('0x91'),_['map'](_0x406dc6,'id'));}});})[_0xeabc('0x27')](function(){if(_0x2240dc[_0xeabc('0x8d')]['role']===_0xeabc('0x92')&&!_0x292f8f&&!_0x2240dc[_0xeabc('0x3a')][_0xeabc('0x8b')])return[];return db['sequelize'][_0xeabc('0x3a')](_0x111900['toString'](),_0x3dc299);})[_0xeabc('0x27')](function(_0x4f9e36){_0x267510[_0xeabc('0x21')]=_0x4f9e36[_0xeabc('0x40')];if(_0x267510[_0xeabc('0x21')]===0x0)return[];return db['sequelize'][_0xeabc('0x3a')](_0x224632['toString'](),_0x3dc299)['then'](function(_0x2f2268){_0x264636=_['keyBy'](_0x2f2268,'id');_0x3dc299=_[_0xeabc('0x93')](_0x3dc299,{'model':db[_0xeabc('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2240dc[_0xeabc('0x3a')]['fields']){_0x417f8a[_0xeabc('0x3e')][_0xeabc('0x31')](function(_0x2d0e3d){_0x38ab99['field']('i.'+_0x2d0e3d);});}else{_0x38ab99[_0xeabc('0x49')](_0xeabc('0x87'),_0xeabc('0x5e'));_0x38ab99[_0xeabc('0x49')](_0xeabc('0x94'),_0xeabc('0x95'));_0x38ab99['field']('a.mandatoryDisposition',_0xeabc('0x96'));_0x38ab99['field'](_0xeabc('0x97'),'contactName');_0x38ab99[_0xeabc('0x49')](_0xeabc('0x98'));_0x38ab99[_0xeabc('0x49')]('c.firstName',_0xeabc('0x99'));_0x38ab99[_0xeabc('0x49')](_0xeabc('0x9a'),_0xeabc('0x9b'));_0x38ab99[_0xeabc('0x49')](_0xeabc('0x9c'),_0xeabc('0x9d'));_0x38ab99[_0xeabc('0x49')](_0xeabc('0x9e'),_0xeabc('0x9f'));_0x38ab99[_0xeabc('0x49')](_0xeabc('0xa0'),_0xeabc('0xa1'));_0x38ab99[_0xeabc('0x49')](_0xeabc('0xa2'),_0xeabc('0xa3'));_0x38ab99[_0xeabc('0x49')](_0xeabc('0xa4'),_0xeabc('0xa5'));_0x38ab99[_0xeabc('0x49')](_0xeabc('0xa6'),'Owner.internal');_0x38ab99[_0xeabc('0x49')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xeabc('0x2f'));}if(_0x417f8a[_0xeabc('0x43')])_0x38ab99[_0xeabc('0x43')](_0x417f8a[_0xeabc('0x43')]);if(_0x417f8a[_0xeabc('0x22')])_0x38ab99['offset'](_0x417f8a[_0xeabc('0x22')]);return db[_0xeabc('0xa7')][_0xeabc('0x3a')](_0x38ab99[_0xeabc('0xa8')](),_0x3dc299);})[_0xeabc('0x27')](function(_0x4d2ff9){_0x556acd['where'](_0xeabc('0xa9'),_[_0xeabc('0x2d')](_0x4d2ff9,'id'));return db[_0xeabc('0xa7')]['query'](_0x556acd['toString'](),_0x3dc299)[_0xeabc('0x27')](function(_0x5c16cd){var _0x135cf1=_[_0xeabc('0xaa')](_0x5c16cd,_0xeabc('0xab'));var _0x5858ce=[];_0x4d2ff9[_0xeabc('0x31')](function(_0x55b321){_0x5858ce[_0xeabc('0x33')](updateFaxInteraction(_0x55b321,_0x264636,_0x135cf1));});return BPromise[_0xeabc('0xac')](_0x5858ce);});});})[_0xeabc('0x27')](function(_0x4a590d){_0x267510[_0xeabc('0xad')]=_0x4a590d;return _0x267510;})[_0xeabc('0x27')](respondWithFilteredResult(_0x5ea578,_0x417f8a))[_0xeabc('0x34')](handleError(_0x5ea578,null));};exports[_0xeabc('0xae')]=function(_0x3c4168,_0x24a88e){var _0x543bc4={'raw':![],'where':{'id':_0x3c4168[_0xeabc('0xaf')]['id']}},_0x2346d5={};_0x2346d5[_0xeabc('0x39')]=_['keys'](db[_0xeabc('0x35')][_0xeabc('0x36')]);_0x2346d5['query']=_[_0xeabc('0x3b')](_0x3c4168[_0xeabc('0x3a')]);_0x2346d5[_0xeabc('0x3c')]=_[_0xeabc('0x3d')](_0x2346d5[_0xeabc('0x39')],_0x2346d5[_0xeabc('0x3a')]);_0x543bc4[_0xeabc('0x3e')]=_['intersection'](_0x2346d5[_0xeabc('0x39')],qs[_0xeabc('0x3f')](_0x3c4168['query']['fields']));_0x543bc4[_0xeabc('0x3e')]=_0x543bc4['attributes'][_0xeabc('0x40')]?_0x543bc4[_0xeabc('0x3e')]:_0x2346d5[_0xeabc('0x39')];if(_0x3c4168[_0xeabc('0x3a')][_0xeabc('0xb0')]){_0x543bc4[_0xeabc('0xb1')]=[{'all':!![]}];}_0x543bc4=_[_0xeabc('0x93')]({},_0x543bc4,_0x3c4168['options']);return db[_0xeabc('0x35')][_0xeabc('0x68')](_0x543bc4)[_0xeabc('0x27')](handleEntityNotFound(_0x24a88e,null))[_0xeabc('0x27')](respondWithResult(_0x24a88e,null))[_0xeabc('0x34')](handleError(_0x24a88e,null));};exports[_0xeabc('0xb2')]=function(_0x2d4866,_0x3626c3){return db[_0xeabc('0x35')]['create'](_0x2d4866[_0xeabc('0xb3')],{})['then'](respondWithResult(_0x3626c3,0xc9))['catch'](handleError(_0x3626c3,null));};exports[_0xeabc('0x26')]=function(_0x33bba1,_0x54355f){if(_0x33bba1[_0xeabc('0xb3')]['id']){delete _0x33bba1[_0xeabc('0xb3')]['id'];}return db[_0xeabc('0x35')][_0xeabc('0x68')]({'where':{'id':_0x33bba1[_0xeabc('0xaf')]['id']}})[_0xeabc('0x27')](handleEntityNotFound(_0x54355f,null))[_0xeabc('0x27')](saveUpdates(_0x33bba1[_0xeabc('0xb3')],null))[_0xeabc('0x27')](respondWithResult(_0x54355f,null))[_0xeabc('0x34')](handleError(_0x54355f,null));};exports[_0xeabc('0x28')]=function(_0x40935d,_0x110d70){return db[_0xeabc('0x35')][_0xeabc('0x68')]({'where':{'id':_0x40935d[_0xeabc('0xaf')]['id']}})['then'](handleEntityNotFound(_0x110d70,null))[_0xeabc('0x27')](removeEntity(_0x110d70,null))[_0xeabc('0x34')](handleError(_0x110d70,null));};exports[_0xeabc('0xb4')]=function(_0x1fd1c3,_0x5932de){return db['FaxInteraction'][_0xeabc('0xb4')]()[_0xeabc('0x27')](respondWithResult(_0x5932de,null))[_0xeabc('0x34')](handleError(_0x5932de,null));};exports[_0xeabc('0xb5')]=function(_0x3bda64,_0x35833c,_0x4247c1){return db['FaxMessage']['find']({'where':{'id':_0x3bda64[_0xeabc('0xaf')]['id']}})[_0xeabc('0x27')](handleEntityNotFound(_0x35833c,null))[_0xeabc('0x27')](function(_0x398d4b){if(_0x398d4b){return _0x398d4b[_0xeabc('0xb5')](_0x3bda64[_0xeabc('0xb3')][_0xeabc('0xb6')],_[_0xeabc('0xb7')](_0x3bda64[_0xeabc('0xb3')],[_0xeabc('0xb6'),'id'])||{});}})[_0xeabc('0x27')](respondWithResult(_0x35833c,null))[_0xeabc('0x34')](handleError(_0x35833c,null));};exports['getMessages']=function(_0x4f0d7d,_0x5dccce,_0x239fa5){var _0x277bca={'raw':![],'where':{}};var _0xe829e7={};var _0x3dfa3d={'count':0x0,'rows':[]};return db[_0xeabc('0x35')][_0xeabc('0xb8')]({'where':{'id':_0x4f0d7d['params']['id']}})['then'](handleEntityNotFound(_0x5dccce,null))[_0xeabc('0x27')](function(_0x45d5a8){if(_0x45d5a8){_0xe829e7['model']=_[_0xeabc('0x3b')](db[_0xeabc('0xb9')][_0xeabc('0x36')]);_0xe829e7[_0xeabc('0x3a')]=_['keys'](_0x4f0d7d[_0xeabc('0x3a')]);_0xe829e7['filters']=_['intersection'](_0xe829e7[_0xeabc('0x39')],_0xe829e7[_0xeabc('0x3a')]);_0x277bca['attributes']=_['intersection'](_0xe829e7['model'],qs['fields'](_0x4f0d7d[_0xeabc('0x3a')][_0xeabc('0x3f')]));_0x277bca[_0xeabc('0x3e')]=_0x277bca[_0xeabc('0x3e')][_0xeabc('0x40')]?_0x277bca['attributes']:_0xe829e7[_0xeabc('0x39')];if(!_0x4f0d7d['query'][_0xeabc('0x41')]('nolimit')){_0x277bca['limit']=qs[_0xeabc('0x43')](_0x4f0d7d[_0xeabc('0x3a')][_0xeabc('0x43')]);_0x277bca[_0xeabc('0x22')]=qs[_0xeabc('0x22')](_0x4f0d7d[_0xeabc('0x3a')][_0xeabc('0x22')]);}_0x277bca['order']=qs[_0xeabc('0x45')](_0x4f0d7d[_0xeabc('0x3a')][_0xeabc('0x45')]);_0x277bca[_0xeabc('0x46')]=qs['filters'](_[_0xeabc('0x47')](_0x4f0d7d[_0xeabc('0x3a')],_0xe829e7[_0xeabc('0x3c')]));_0x277bca['where']['FaxInteractionId']=_0x45d5a8['id'];if(_0x4f0d7d[_0xeabc('0x3a')][_0xeabc('0x80')]){_0x277bca[_0xeabc('0x46')]=_['merge'](_0x277bca['where'],{'$or':_[_0xeabc('0x2d')](_0x277bca[_0xeabc('0x3e')],function(_0x390a39){var _0x20304b={};_0x20304b[_0x390a39]={'$like':'%'+_0x4f0d7d[_0xeabc('0x3a')][_0xeabc('0x80')]+'%'};return _0x20304b;})});}if(_0x4f0d7d[_0xeabc('0x3a')][_0xeabc('0xba')]){var _0x111e2a=_0x4f0d7d[_0xeabc('0x3a')][_0xeabc('0xba')][_0xeabc('0x30')](',');var _0x267a66={};_0x267a66[_0x111e2a[0x0]]={'$gte':moment(_0x111e2a[0x1])[_0xeabc('0xbb')](_0xeabc('0xbc'))};_0x277bca[_0xeabc('0x46')]=_['merge'](_0x277bca[_0xeabc('0x46')],_0x267a66);}_0x277bca=_[_0xeabc('0x93')]({},_0x277bca,_0x4f0d7d[_0xeabc('0xbd')]);return db[_0xeabc('0xb9')][_0xeabc('0x21')]({'where':_0x277bca[_0xeabc('0x46')]})[_0xeabc('0x27')](function(_0x2a3b84){_0x3dfa3d[_0xeabc('0x21')]=_0x2a3b84;if(_0x4f0d7d[_0xeabc('0x3a')][_0xeabc('0xb0')]){_0x277bca[_0xeabc('0xb1')]=[{'all':!![]}];}return db[_0xeabc('0xb9')][_0xeabc('0xbe')](_0x277bca);})['then'](function(_0x11594d){_0x3dfa3d['rows']=_0x11594d;return _0x3dfa3d;});}})[_0xeabc('0x27')](respondWithFilteredResult(_0x5dccce,_0x277bca))[_0xeabc('0x34')](handleError(_0x5dccce,null));};exports['addTags']=function(_0x148d50,_0x543f28,_0x3c004b){return db[_0xeabc('0x35')][_0xeabc('0x68')]({'where':{'id':_0x148d50[_0xeabc('0xaf')]['id']}})[_0xeabc('0x27')](handleEntityNotFound(_0x543f28,null))[_0xeabc('0x27')](function(_0x4cebf8){if(_0x4cebf8){return _0x4cebf8[_0xeabc('0xbf')](_0x148d50[_0xeabc('0xb3')][_0xeabc('0xb6')],_[_0xeabc('0xb7')](_0x148d50['body'],[_0xeabc('0xb6'),'id'])||{})[_0xeabc('0xc0')](function(){return db[_0xeabc('0x6d')]['findAll']({'attributes':['id',_0xeabc('0x2b'),_0xeabc('0xc1')],'where':{'id':_0x148d50['body'][_0xeabc('0xb6')]}});})[_0xeabc('0x27')](function(_0x3782b0){socket[_0xeabc('0xc2')](_0xeabc('0xc3'),{'id':Number(_0x148d50[_0xeabc('0xaf')]['id']),'tags':_0x3782b0||[]});return{'id':Number(_0x148d50['params']['id']),'tags':_0x3782b0||[]};});}})[_0xeabc('0x27')](respondWithResult(_0x543f28,null))[_0xeabc('0x34')](handleError(_0x543f28,null));};exports[_0xeabc('0xc4')]=function(_0x5115fa,_0x3bf1e9,_0x315684){return db[_0xeabc('0x35')][_0xeabc('0x68')]({'where':{'id':_0x5115fa[_0xeabc('0xaf')]['id']}})[_0xeabc('0x27')](handleEntityNotFound(_0x3bf1e9,null))[_0xeabc('0x27')](function(_0x15b24a){if(_0x15b24a){return _0x15b24a['removeTags'](_0x5115fa[_0xeabc('0x3a')][_0xeabc('0xb6')]);}})['then'](respondWithStatusCode(_0x3bf1e9,null))[_0xeabc('0x34')](handleError(_0x3bf1e9,null));};exports[_0xeabc('0xc5')]=function(_0x2eaf32,_0x477866){var _0x59a9ff=moment()['unix']()[_0xeabc('0xa8')]();var _0x45ae6b=path[_0xeabc('0xc6')](config[_0xeabc('0xc7')],_0xeabc('0xc8'),_0xeabc('0xc9'),_0xeabc('0xca'));var _0x3ac9c0=path[_0xeabc('0xc6')](config[_0xeabc('0xc7')],_0xeabc('0xc8'),_0xeabc('0xc9'),_0xeabc('0xcb'));var _0x278f8a=path[_0xeabc('0xc6')](_0x45ae6b,_0x59a9ff);var _0x168df7=util[_0xeabc('0xbb')](_0xeabc('0xcc'),_0x2eaf32[_0xeabc('0xaf')]['id'],_0x59a9ff);var _0x22ef0e=path[_0xeabc('0xc6')](_0x45ae6b,_0x168df7);var _0x44ee02=[];_0x44ee02[_0xeabc('0x33')]({'model':db['Attachment'],'as':_0xeabc('0xcd'),'raw':!![]});var _0x9d6973=[{'model':db[_0xeabc('0xb9')],'as':'Messages','attributes':['id',_0xeabc('0xb3'),_0xeabc('0xce')],'include':_0x44ee02}];return db[_0xeabc('0x35')][_0xeabc('0x68')]({'where':{'id':_0x2eaf32[_0xeabc('0xaf')]['id']},'include':_0x9d6973})[_0xeabc('0x27')](handleEntityNotFound(_0x477866,null))[_0xeabc('0x27')](function(_0x26059a){if(_0x26059a&&_0x26059a[_0xeabc('0xcf')]){var _0x5c3ace=_0x26059a[_0xeabc('0xd0')]({'plain':!![]});fs[_0xeabc('0xd1')](_0x278f8a);for(var _0x46a8cd=0x0;_0x46a8cd<_0x5c3ace[_0xeabc('0xcf')]['length'];_0x46a8cd++){var _0x580a68=_0x5c3ace[_0xeabc('0xcf')][_0x46a8cd][_0xeabc('0xcd')];if(_0x580a68){var _0x49bc32=path[_0xeabc('0xc6')](_0x3ac9c0,_0x580a68[_0xeabc('0xd2')]);if(fs['existsSync'](_0x49bc32)){fs['createReadStream'](_0x49bc32)['pipe'](fs['createWriteStream'](path[_0xeabc('0xc6')](_0x278f8a,_0x580a68[_0xeabc('0xd2')])));}}}return BPromise['resolve']()[_0xeabc('0x27')](function(){return new BPromise(function(_0x365ee7,_0x46b5d8){zipdir(_0x278f8a,{'saveTo':_0x22ef0e},function(_0x41a253,_0x2bbb41){if(_0x41a253)return _0x46b5d8(_0x41a253);return _0x365ee7(_0x2bbb41);});})[_0xeabc('0x27')](function(){return new BPromise(function(_0x3f5966,_0x3709f6){rimraf(_0x278f8a,function(_0x462d1a){if(_0x462d1a)_0x3709f6(_0x462d1a);return _0x3f5966();});});})[_0xeabc('0x27')](function(){return _0x477866[_0xeabc('0xc5')](_0x22ef0e,_0x168df7,function(_0x5acbdc){if(_0x5acbdc){console[_0xeabc('0xd3')](_0xeabc('0xd4'),_0x5acbdc);}else{fs['unlinkSync'](_0x22ef0e);}});});});}else{return _0x477866['sendStatus'](0xc8);}})['catch'](handleError(_0x477866,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 42aa6b5..cfcd3cc 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 _0x7a54=['setDataValue','map','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers'];(function(_0xb40c20,_0x17eb24){var _0x386683=function(_0x47a3f6){while(--_0x47a3f6){_0xb40c20['push'](_0xb40c20['shift']());}};_0x386683(++_0x17eb24);}(_0x7a54,0x106));var _0x47a5=function(_0x22f64a,_0xcce96b){_0x22f64a=_0x22f64a-0x0;var _0x4ceb3a=_0x7a54[_0x22f64a];return _0x4ceb3a;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var FaxInteraction=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x47a5('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x47a5('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x47a5('0x5'),'afterDestroy':_0x47a5('0x6')};function emitEvent(_0x2a1a7e){return function(_0x3717e1,_0xfdf934,_0x545a97){_0x3717e1[_0x47a5('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x343372){_0x3717e1[_0x47a5('0x8')]('Users',_0x343372[_0x47a5('0x9')](function(_0x5077f3){return{'id':_0x5077f3['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x3717e1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2a0e98){_0x3717e1[_0x47a5('0x8')]('unreadMessages',_0x2a0e98[_0x47a5('0xa')]);FaxInteractionEvents['emit'](_0x2a1a7e+':'+_0x3717e1['id'],_0x3717e1);FaxInteractionEvents['emit'](_0x2a1a7e,_0x3717e1);_0x545a97(null);})[_0x47a5('0xb')](_0x545a97(null));};}for(var e in events){if(events[_0x47a5('0xc')](e)){var event=events[e];FaxInteraction[_0x47a5('0xd')](e,emitEvent(event));}}module[_0x47a5('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0x7a54=['setDataValue','map','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers'];(function(_0xe1661c,_0x20cfac){var _0x8d0787=function(_0x3b5bb1){while(--_0x3b5bb1){_0xe1661c['push'](_0xe1661c['shift']());}};_0x8d0787(++_0x20cfac);}(_0x7a54,0x106));var _0x47a5=function(_0x2ff7cb,_0x258971){_0x2ff7cb=_0x2ff7cb-0x0;var _0x154aec=_0x7a54[_0x2ff7cb];return _0x154aec;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var FaxInteraction=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x47a5('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x47a5('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x47a5('0x5'),'afterDestroy':_0x47a5('0x6')};function emitEvent(_0x2a1a7e){return function(_0x3717e1,_0xfdf934,_0x545a97){_0x3717e1[_0x47a5('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x343372){_0x3717e1[_0x47a5('0x8')]('Users',_0x343372[_0x47a5('0x9')](function(_0x5077f3){return{'id':_0x5077f3['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x3717e1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2a0e98){_0x3717e1[_0x47a5('0x8')]('unreadMessages',_0x2a0e98[_0x47a5('0xa')]);FaxInteractionEvents['emit'](_0x2a1a7e+':'+_0x3717e1['id'],_0x3717e1);FaxInteractionEvents['emit'](_0x2a1a7e,_0x3717e1);_0x545a97(null);})[_0x47a5('0xb')](_0x545a97(null));};}for(var e in events){if(events[_0x47a5('0xc')](e)){var event=events[e];FaxInteraction[_0x47a5('0xd')](e,emitEvent(event));}}module[_0x47a5('0xe')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 0b1ffa2..0b89f64 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 _0x2af3=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','FaxInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2af3,0x121));var _0x32af=function(_0x3b9703,_0x4ec964){_0x3b9703=_0x3b9703-0x0;var _0x1bb1cb=_0x2af3[_0x3b9703];return _0x1bb1cb;};'use strict';var _=require(_0x32af('0x0'));var util=require(_0x32af('0x1'));var logger=require(_0x32af('0x2'))(_0x32af('0x3'));var moment=require(_0x32af('0x4'));var BPromise=require(_0x32af('0x5'));var rp=require(_0x32af('0x6'));var fs=require('fs');var path=require(_0x32af('0x7'));var rimraf=require(_0x32af('0x8'));var config=require(_0x32af('0x9'));var attributes=require(_0x32af('0xa'));module['exports']=function(_0x5bad5d,_0x38fcd4){return _0x5bad5d['define'](_0x32af('0xb'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x461bf0,_0x444c01,_0x3a3b8a){if(_0x461bf0[_0x32af('0xc')](_0x32af('0xd'))){_0x461bf0[_0x32af('0xe')]=moment()[_0x32af('0xf')](_0x32af('0x10'));}_0x3a3b8a(null,_0x461bf0);}}});}; \ No newline at end of file +var _0x32b0=['../../config/environment','./faxInteraction.attributes','exports','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','path'];(function(_0x467cb0,_0x303070){var _0x2153f7=function(_0x51775a){while(--_0x51775a){_0x467cb0['push'](_0x467cb0['shift']());}};_0x2153f7(++_0x303070);}(_0x32b0,0xca));var _0x032b=function(_0x42850d,_0x4fa30f){_0x42850d=_0x42850d-0x0;var _0x2f6721=_0x32b0[_0x42850d];return _0x2f6721;};'use strict';var _=require('lodash');var util=require(_0x032b('0x0'));var logger=require(_0x032b('0x1'))(_0x032b('0x2'));var moment=require(_0x032b('0x3'));var BPromise=require(_0x032b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x032b('0x5'));var rimraf=require('rimraf');var config=require(_0x032b('0x6'));var attributes=require(_0x032b('0x7'));module[_0x032b('0x8')]=function(_0x3ee907,_0x4d58c1){return _0x3ee907['define'](_0x032b('0x9'),attributes,{'tableName':_0x032b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x390883,_0x18fb95,_0x27d3fa){if(_0x390883[_0x032b('0xb')](_0x032b('0xc'))){_0x390883[_0x032b('0xd')]=moment()[_0x032b('0xe')](_0x032b('0xf'));}_0x27d3fa(null,_0x390883);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 3d8783f..eda1199 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 _0x604c=['FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','options','raw','where','attributes','AddTagsToFaxInteraction','find','ids','omit','body','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info'];(function(_0x1b9115,_0x362439){var _0x5ac926=function(_0x24fd00){while(--_0x24fd00){_0x1b9115['push'](_0x1b9115['shift']());}};_0x5ac926(++_0x362439);}(_0x604c,0x13c));var _0xc604=function(_0x466b26,_0x1f2a06){_0x466b26=_0x466b26-0x0;var _0x572cda=_0x604c[_0x466b26];return _0x572cda;};'use strict';var _=require(_0xc604('0x0'));var util=require(_0xc604('0x1'));var moment=require(_0xc604('0x2'));var BPromise=require(_0xc604('0x3'));var rs=require(_0xc604('0x4'));var fs=require('fs');var Redis=require(_0xc604('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc604('0x6'));var logger=require(_0xc604('0x7'))(_0xc604('0x8'));var config=require(_0xc604('0x9'));var jayson=require(_0xc604('0xa'));var client=jayson[_0xc604('0xb')][_0xc604('0xc')]({'port':0x232a});config[_0xc604('0xd')]=_[_0xc604('0xe')](config[_0xc604('0xd')],{'host':_0xc604('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc604('0xd')]));require('./faxInteraction.socket')[_0xc604('0x10')](socket);function respondWithRpcPromise(_0x1c50dc,_0x4c2194,_0x4a242b){return new BPromise(function(_0x51ec4a,_0x14adf4){return client[_0xc604('0x11')](_0x1c50dc,_0x4a242b)[_0xc604('0x12')](function(_0x463224){logger[_0xc604('0x13')](_0xc604('0x14'),_0x4c2194,_0xc604('0x15'));logger[_0xc604('0x16')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x4c2194,_0xc604('0x15'),JSON[_0xc604('0x17')](_0x463224));if(_0x463224[_0xc604('0x18')]){if(_0x463224[_0xc604('0x18')][_0xc604('0x19')]===0x1f4){logger[_0xc604('0x18')](_0xc604('0x14'),_0x4c2194,_0x463224[_0xc604('0x18')][_0xc604('0x1a')]);return _0x14adf4(_0x463224[_0xc604('0x18')][_0xc604('0x1a')]);}logger[_0xc604('0x18')](_0xc604('0x14'),_0x4c2194,_0x463224[_0xc604('0x18')]['message']);return _0x51ec4a(_0x463224['error'][_0xc604('0x1a')]);}else{logger[_0xc604('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x4c2194,'request\x20sent');_0x51ec4a(_0x463224[_0xc604('0x1b')]['message']);}})[_0xc604('0x1c')](function(_0x5b7277){logger[_0xc604('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x4c2194,_0x5b7277);_0x14adf4(_0x5b7277);});});}exports[_0xc604('0x1d')]=function(_0xce9f23){var _0x2e722c=this;return new Promise(function(_0x3dbbc2,_0x10fed6){return db[_0xc604('0x1e')]['update'](_0xce9f23['body'],{'raw':_0xce9f23[_0xc604('0x1f')]?_0xce9f23[_0xc604('0x1f')][_0xc604('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xce9f23[_0xc604('0x1f')]?_0xce9f23[_0xc604('0x1f')][_0xc604('0x21')]||null:null,'attributes':_0xce9f23[_0xc604('0x1f')]?_0xce9f23[_0xc604('0x1f')][_0xc604('0x22')]||null:null,'limit':_0xce9f23[_0xc604('0x1f')]?_0xce9f23[_0xc604('0x1f')]['limit']||null:null})[_0xc604('0x12')](function(_0x338679){logger[_0xc604('0x13')](_0xc604('0x1d'),_0xce9f23);logger['debug'](_0xc604('0x1d'),_0xce9f23,JSON[_0xc604('0x17')](_0x338679));_0x3dbbc2(_0x338679);})[_0xc604('0x1c')](function(_0x42a20e){logger[_0xc604('0x18')](_0xc604('0x1d'),_0x42a20e[_0xc604('0x1a')],_0xce9f23);_0x10fed6(_0x2e722c['error'](0x1f4,_0x42a20e[_0xc604('0x1a')]));});});};exports[_0xc604('0x23')]=function(_0x30b245){return new Promise(function(_0x2098cd,_0x2ad06d){return db[_0xc604('0x1e')][_0xc604('0x24')]({'where':_0x30b245[_0xc604('0x1f')]?_0x30b245['options'][_0xc604('0x21')]||null:null})['then'](function(_0x210fab){if(_0x210fab){return _0x210fab['addTags'](_0x30b245['body'][_0xc604('0x25')],_[_0xc604('0x26')](_0x30b245[_0xc604('0x27')],['ids','id'])||{});}})[_0xc604('0x28')](function(_0x35d1b5){logger[_0xc604('0x13')]('AddTags',_0x30b245);logger['debug'](_0xc604('0x29'),_0x30b245,JSON[_0xc604('0x17')](_0x35d1b5));_0x2098cd(_0x35d1b5);})[_0xc604('0x1c')](function(_0x107812){logger[_0xc604('0x18')](_0xc604('0x29'),_0x107812[_0xc604('0x1a')],_0x30b245);_0x2ad06d(_this[_0xc604('0x18')](0x1f4,_0x107812[_0xc604('0x1a')]));});});}; \ No newline at end of file +var _0xa9f8=['info','FaxInteraction,\x20%s,\x20%s','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','options','raw','where','limit','then','debug','AddTagsToFaxInteraction','addTags','body','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register'];(function(_0x5e6ea3,_0x9addd2){var _0x4048b5=function(_0x9092e4){while(--_0x9092e4){_0x5e6ea3['push'](_0x5e6ea3['shift']());}};_0x4048b5(++_0x9addd2);}(_0xa9f8,0x108));var _0x8a9f=function(_0x2db7c7,_0x3b7e79){_0x2db7c7=_0x2db7c7-0x0;var _0x2e8bf0=_0xa9f8[_0x2db7c7];return _0x2e8bf0;};'use strict';var _=require(_0x8a9f('0x0'));var util=require('util');var moment=require(_0x8a9f('0x1'));var BPromise=require(_0x8a9f('0x2'));var rs=require(_0x8a9f('0x3'));var fs=require('fs');var Redis=require(_0x8a9f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a9f('0x5'));var logger=require(_0x8a9f('0x6'))(_0x8a9f('0x7'));var config=require('../../config/environment');var jayson=require(_0x8a9f('0x8'));var client=jayson[_0x8a9f('0x9')][_0x8a9f('0xa')]({'port':0x232a});config['redis']=_[_0x8a9f('0xb')](config[_0x8a9f('0xc')],{'host':_0x8a9f('0xd'),'port':0x18eb});var socket=require(_0x8a9f('0xe'))(new Redis(config[_0x8a9f('0xc')]));require('./faxInteraction.socket')[_0x8a9f('0xf')](socket);function respondWithRpcPromise(_0x439fc4,_0x2dbd9c,_0xf0528f){return new BPromise(function(_0x5764a4,_0x27930b){return client['request'](_0x439fc4,_0xf0528f)['then'](function(_0xc632b5){logger[_0x8a9f('0x10')](_0x8a9f('0x11'),_0x2dbd9c,'request\x20sent');logger['debug'](_0x8a9f('0x12'),_0x2dbd9c,_0x8a9f('0x13'),JSON[_0x8a9f('0x14')](_0xc632b5));if(_0xc632b5[_0x8a9f('0x15')]){if(_0xc632b5[_0x8a9f('0x15')][_0x8a9f('0x16')]===0x1f4){logger[_0x8a9f('0x15')](_0x8a9f('0x11'),_0x2dbd9c,_0xc632b5[_0x8a9f('0x15')]['message']);return _0x27930b(_0xc632b5[_0x8a9f('0x15')][_0x8a9f('0x17')]);}logger[_0x8a9f('0x15')](_0x8a9f('0x11'),_0x2dbd9c,_0xc632b5[_0x8a9f('0x15')][_0x8a9f('0x17')]);return _0x5764a4(_0xc632b5[_0x8a9f('0x15')][_0x8a9f('0x17')]);}else{logger[_0x8a9f('0x10')](_0x8a9f('0x11'),_0x2dbd9c,_0x8a9f('0x13'));_0x5764a4(_0xc632b5[_0x8a9f('0x18')][_0x8a9f('0x17')]);}})[_0x8a9f('0x19')](function(_0x1fa3d5){logger[_0x8a9f('0x15')](_0x8a9f('0x11'),_0x2dbd9c,_0x1fa3d5);_0x27930b(_0x1fa3d5);});});}exports[_0x8a9f('0x1a')]=function(_0x45744d){var _0x717c48=this;return new Promise(function(_0x2d3a64,_0x2a842f){return db[_0x8a9f('0x1b')]['update'](_0x45744d['body'],{'raw':_0x45744d[_0x8a9f('0x1c')]?_0x45744d['options'][_0x8a9f('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45744d[_0x8a9f('0x1c')]?_0x45744d['options'][_0x8a9f('0x1e')]||null:null,'attributes':_0x45744d[_0x8a9f('0x1c')]?_0x45744d[_0x8a9f('0x1c')]['attributes']||null:null,'limit':_0x45744d[_0x8a9f('0x1c')]?_0x45744d[_0x8a9f('0x1c')][_0x8a9f('0x1f')]||null:null})[_0x8a9f('0x20')](function(_0x5f1d8e){logger['info']('UpdateFaxInteraction',_0x45744d);logger[_0x8a9f('0x21')](_0x8a9f('0x1a'),_0x45744d,JSON['stringify'](_0x5f1d8e));_0x2d3a64(_0x5f1d8e);})['catch'](function(_0x1bfa38){logger[_0x8a9f('0x15')](_0x8a9f('0x1a'),_0x1bfa38[_0x8a9f('0x17')],_0x45744d);_0x2a842f(_0x717c48['error'](0x1f4,_0x1bfa38[_0x8a9f('0x17')]));});});};exports[_0x8a9f('0x22')]=function(_0x5c057d){return new Promise(function(_0x16ae92,_0x1e062b){return db['FaxInteraction']['find']({'where':_0x5c057d['options']?_0x5c057d['options'][_0x8a9f('0x1e')]||null:null})[_0x8a9f('0x20')](function(_0x191d40){if(_0x191d40){return _0x191d40[_0x8a9f('0x23')](_0x5c057d[_0x8a9f('0x24')][_0x8a9f('0x25')],_['omit'](_0x5c057d[_0x8a9f('0x24')],['ids','id'])||{});}})[_0x8a9f('0x26')](function(_0x51067b){logger[_0x8a9f('0x10')](_0x8a9f('0x27'),_0x5c057d);logger[_0x8a9f('0x21')](_0x8a9f('0x27'),_0x5c057d,JSON[_0x8a9f('0x14')](_0x51067b));_0x16ae92(_0x51067b);})[_0x8a9f('0x19')](function(_0x4cd47f){logger['error'](_0x8a9f('0x27'),_0x4cd47f[_0x8a9f('0x17')],_0x5c057d);_0x1e062b(_this['error'](0x1f4,_0x4cd47f[_0x8a9f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index bc47ee0..17d8ee8 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 _0xf3dd=['save','update','register','length','faxInteraction:','./faxInteraction.events'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0xf3dd,0xad));var _0xdf3d=function(_0x5c38a2,_0x40e4e4){_0x5c38a2=_0x5c38a2-0x0;var _0x22869c=_0xf3dd[_0x5c38a2];return _0x22869c;};'use strict';var FaxInteractionEvents=require(_0xdf3d('0x0'));var events=[_0xdf3d('0x1'),'remove',_0xdf3d('0x2')];function createListener(_0x586b70,_0x49b691){return function(_0x35f3b5){_0x49b691['emit'](_0x586b70,_0x35f3b5);};}function removeListener(_0x122500,_0x3dc94f){return function(){FaxInteractionEvents['removeListener'](_0x122500,_0x3dc94f);};}exports[_0xdf3d('0x3')]=function(_0x4c6f5c){for(var _0x4c83fc=0x0,_0x40fb28=events[_0xdf3d('0x4')];_0x4c83fc<_0x40fb28;_0x4c83fc++){var _0x531753=events[_0x4c83fc];var _0x3950b9=createListener(_0xdf3d('0x5')+_0x531753,_0x4c6f5c);FaxInteractionEvents['on'](_0x531753,_0x3950b9);}}; \ No newline at end of file +var _0x7512=['length','faxInteraction:','./faxInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x492af5,_0xd51471){var _0x59f529=function(_0x40c9aa){while(--_0x40c9aa){_0x492af5['push'](_0x492af5['shift']());}};_0x59f529(++_0xd51471);}(_0x7512,0xe3));var _0x2751=function(_0x4aa33b,_0x18235f){_0x4aa33b=_0x4aa33b-0x0;var _0x5efce2=_0x7512[_0x4aa33b];return _0x5efce2;};'use strict';var FaxInteractionEvents=require(_0x2751('0x0'));var events=[_0x2751('0x1'),_0x2751('0x2'),_0x2751('0x3')];function createListener(_0x57ef80,_0x3044cc){return function(_0x5a29e){_0x3044cc[_0x2751('0x4')](_0x57ef80,_0x5a29e);};}function removeListener(_0x126615,_0x3dd500){return function(){FaxInteractionEvents[_0x2751('0x5')](_0x126615,_0x3dd500);};}exports[_0x2751('0x6')]=function(_0x2ef971){for(var _0x30a1a3=0x0,_0x276013=events[_0x2751('0x7')];_0x30a1a3<_0x276013;_0x30a1a3++){var _0x5533e3=events[_0x30a1a3];var _0x3d685e=createListener(_0x2751('0x8')+_0x5533e3,_0x2ef971);FaxInteractionEvents['on'](_0x5533e3,_0x3d685e);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index e43b7cf..45bf60f 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 _0x878f=['../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','/:id','faxinteraction:update','update','delete','destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x17e2b3,_0x534cca){var _0x5bbf15=function(_0x4e8a69){while(--_0x4e8a69){_0x17e2b3['push'](_0x17e2b3['shift']());}};_0x5bbf15(++_0x534cca);}(_0x878f,0x173));var _0xf878=function(_0x19f69b,_0x496be4){_0x19f69b=_0x19f69b-0x0;var _0x52043e=_0x878f[_0x19f69b];return _0x52043e;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var auth=require(_0xf878('0x5'));var interaction=require(_0xf878('0x6'));var config=require(_0xf878('0x7'));var controller=require(_0xf878('0x8'));router[_0xf878('0x9')]('/',auth[_0xf878('0xa')](),controller['index']);router['get'](_0xf878('0xb'),auth[_0xf878('0xa')](),controller['describe']);router['get']('/:id',auth[_0xf878('0xa')](),controller['show']);router['get'](_0xf878('0xc'),auth[_0xf878('0xa')](),controller[_0xf878('0xd')]);router['get'](_0xf878('0xe'),auth[_0xf878('0xa')](),controller['download']);router[_0xf878('0xf')]('/',auth['isAuthenticated'](),controller[_0xf878('0x10')]);router[_0xf878('0xf')](_0xf878('0xc'),auth['isAuthenticated'](),controller[_0xf878('0x11')]);router[_0xf878('0xf')](_0xf878('0x12'),auth['isAuthenticated'](),interaction[_0xf878('0x13')](_0xf878('0x14'),_0xf878('0x15')),controller['addTags']);router['put'](_0xf878('0x16'),auth[_0xf878('0xa')](),interaction[_0xf878('0x13')](_0xf878('0x14'),_0xf878('0x17')),controller[_0xf878('0x18')]);router[_0xf878('0x19')](_0xf878('0x16'),auth[_0xf878('0xa')](),interaction[_0xf878('0x13')](_0xf878('0x14'),'faxinteraction:destroy'),controller[_0xf878('0x1a')]);router[_0xf878('0x19')](_0xf878('0x12'),auth[_0xf878('0xa')](),controller[_0xf878('0x1b')]);module[_0xf878('0x1c')]=router; \ No newline at end of file +var _0xa9e0=['exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','/:id','/:id/messages','getMessages','/:id/download','create','post','addMessage','tracked','fax','faxinteraction:addtags','addTags','put','update','delete','faxinteraction:destroy','destroy','/:id/tags','removeTags'];(function(_0x21c76e,_0x657e32){var _0x1c28c7=function(_0x1053ed){while(--_0x1053ed){_0x21c76e['push'](_0x21c76e['shift']());}};_0x1c28c7(++_0x657e32);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')]('/:id/tags',auth[_0x0a9e('0x8')](),interaction[_0x0a9e('0x11')](_0x0a9e('0x12'),_0x0a9e('0x13')),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),interaction['tracked'](_0x0a9e('0x12'),'faxinteraction:update'),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x17')]('/:id',auth[_0x0a9e('0x8')](),interaction['tracked'](_0x0a9e('0x12'),_0x0a9e('0x18')),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x17')](_0x0a9e('0x1a'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1b')]);module[_0x0a9e('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 8f0e6be..fc25b9a 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 _0x2b7e=['TEXT','medium','ENUM','out','DATE','sequelize','exports'];(function(_0x31a736,_0x2fb5b4){var _0x3eee1e=function(_0x5431e7){while(--_0x5431e7){_0x31a736['push'](_0x31a736['shift']());}};_0x3eee1e(++_0x2fb5b4);}(_0x2b7e,0xd7));var _0xe2b7=function(_0x56ff3f,_0x11132e){_0x56ff3f=_0x56ff3f-0x0;var _0x73c95c=_0x2b7e[_0x56ff3f];return _0x73c95c;};'use strict';var Sequelize=require(_0xe2b7('0x0'));module[_0xe2b7('0x1')]={'body':{'type':Sequelize[_0xe2b7('0x2')](_0xe2b7('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xe2b7('0x4')]('in',_0xe2b7('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xe2b7('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xe2b7('0x6')]}}; \ No newline at end of file +var _0x5a2d=['BOOLEAN','ENUM','out','DATE','TEXT','medium'];(function(_0x5e68f0,_0x181383){var _0x320008=function(_0x5cf8ac){while(--_0x5cf8ac){_0x5e68f0['push'](_0x5e68f0['shift']());}};_0x320008(++_0x181383);}(_0x5a2d,0x148));var _0xd5a2=function(_0x44c974,_0x1bcfde){_0x44c974=_0x44c974-0x0;var _0x5214c6=_0x5a2d[_0x44c974];return _0x5214c6;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xd5a2('0x0')](_0xd5a2('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xd5a2('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd5a2('0x3')]('in',_0xd5a2('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xd5a2('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 380482e..7f0c5b9 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 _0x8f59=['null','acceptMessage','interface','channel','accept','EventManager','acceptmessage','agent','SIP/%s','event','create','findOne','ContactId','AttachmentId','SendFax','isNil','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','files','attachments','Attachment','download','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','send','index','map','FaxMessage','fieldName','type','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','options','includeAll','include','findAll','rows','params','merge','find','body','describe','../../config/logger','fax-interactions','fax','read','readAt','UserId','CmContact','Contact','FaxInteraction','FaxInteractionId','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','get','user','role','interaction'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8f59,0x11d));var _0x98f5=function(_0x23118b,_0x562da3){_0x23118b=_0x23118b-0x0;var _0x3636cf=_0x8f59[_0x23118b];return _0x3636cf;};'use strict';var pdf=require(_0x98f5('0x0'));var emlformat=require(_0x98f5('0x1'));var rimraf=require(_0x98f5('0x2'));var zipdir=require(_0x98f5('0x3'));var jsonpatch=require(_0x98f5('0x4'));var rp=require(_0x98f5('0x5'));var moment=require('moment');var BPromise=require(_0x98f5('0x6'));var Mustache=require(_0x98f5('0x7'));var util=require(_0x98f5('0x8'));var path=require(_0x98f5('0x9'));var sox=require('sox');var csv=require(_0x98f5('0xa'));var ejs=require(_0x98f5('0xb'));var fs=require('fs');var _=require(_0x98f5('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x98f5('0xd'));var deskjs=require(_0x98f5('0xe'));var toCsv=require(_0x98f5('0xa'));var querystring=require('querystring');var Papa=require(_0x98f5('0xf'));var Redis=require(_0x98f5('0x10'));var authService=require(_0x98f5('0x11'));var qs=require(_0x98f5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98f5('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x98f5('0x14'));var config=require(_0x98f5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x98f5('0x16'))['db'];config[_0x98f5('0x17')]=_[_0x98f5('0x18')](config[_0x98f5('0x17')],{'host':_0x98f5('0x19'),'port':0x18eb});var socket=require(_0x98f5('0x1a'))(new Redis(config['redis']));require(_0x98f5('0x1b'))[_0x98f5('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x98f5('0x1d')][_0x98f5('0x1e')]({'port':0x232c});var client9002=jayson[_0x98f5('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2437e7,_0xc7a49b,_0x113545,_0x5bb486){return new BPromise(function(_0x440cfa,_0x215360){var _0x574644=_0x5bb486||client;return _0x574644[_0x98f5('0x1f')](_0x2437e7,_0x113545)['then'](function(_0x10c57c){logger[_0x98f5('0x20')](_0x98f5('0x21'),_0xc7a49b,_0x98f5('0x22'));logger[_0x98f5('0x23')](_0x98f5('0x24'),_0xc7a49b,'request\x20sent',JSON[_0x98f5('0x25')](_0x10c57c));if(_0x10c57c['error']){if(_0x10c57c[_0x98f5('0x26')][_0x98f5('0x27')]===0x1f4){logger['error'](_0x98f5('0x21'),_0xc7a49b,_0x10c57c[_0x98f5('0x26')][_0x98f5('0x28')]);return _0x215360(_0x10c57c[_0x98f5('0x26')][_0x98f5('0x28')]);}logger[_0x98f5('0x26')](_0x98f5('0x21'),_0xc7a49b,_0x10c57c['error'][_0x98f5('0x28')]);return _0x440cfa(_0x10c57c['error'][_0x98f5('0x28')]);}else{logger['info'](_0x98f5('0x21'),_0xc7a49b,_0x98f5('0x22'));_0x440cfa(_0x10c57c[_0x98f5('0x29')][_0x98f5('0x28')]);}})[_0x98f5('0x2a')](function(_0x18052d){logger[_0x98f5('0x26')]('FaxMessage,\x20%s,\x20%s',_0xc7a49b,_0x18052d);_0x215360(_0x18052d);});});}function respondWithStatusCode(_0x27a533,_0x2b80a1){_0x2b80a1=_0x2b80a1||0xcc;return function(_0x5d7423){if(_0x5d7423){return _0x27a533[_0x98f5('0x2b')](_0x2b80a1);}return _0x27a533[_0x98f5('0x2c')](_0x2b80a1)[_0x98f5('0x2d')]();};}function respondWithResult(_0x214130,_0x230d1b){_0x230d1b=_0x230d1b||0xc8;return function(_0xe5a019){if(_0xe5a019){return _0x214130[_0x98f5('0x2c')](_0x230d1b)[_0x98f5('0x2e')](_0xe5a019);}};}function respondWithFilteredResult(_0x576c4b,_0x4c10b8){return function(_0x428c85){if(_0x428c85){var _0x71661e=_0x428c85[_0x98f5('0x2f')],_0x18bb29=_0x4c10b8['offset'],_0x209d15=_0x4c10b8[_0x98f5('0x30')]+_0x4c10b8[_0x98f5('0x31')],_0x15bf92;if(_0x209d15>=_0x71661e){_0x209d15=_0x71661e;_0x15bf92=0xc8;}else{_0x15bf92=0xce;}_0x576c4b[_0x98f5('0x2c')](_0x15bf92);return _0x576c4b[_0x98f5('0x32')](_0x98f5('0x33'),_0x18bb29+'-'+_0x209d15+'/'+_0x71661e)[_0x98f5('0x2e')](_0x428c85);}return null;};}function patchUpdates(_0x53d274){return function(_0x1e7027){try{jsonpatch[_0x98f5('0x34')](_0x1e7027,_0x53d274,!![]);}catch(_0x229495){return BPromise[_0x98f5('0x35')](_0x229495);}return _0x1e7027['save']();};}function saveUpdates(_0x45ca95,_0x25766e){return function(_0x3e9ae4){if(_0x3e9ae4){return _0x3e9ae4[_0x98f5('0x36')](_0x45ca95)[_0x98f5('0x37')](function(_0x341003){return _0x341003;});}return null;};}function removeEntity(_0xc18b23,_0x3e7e56){return function(_0x1d0427){if(_0x1d0427){return _0x1d0427[_0x98f5('0x38')]()[_0x98f5('0x37')](function(){_0xc18b23[_0x98f5('0x2c')](0xcc)[_0x98f5('0x2d')]();});}};}function handleEntityNotFound(_0xe4a944,_0x2fc7c6){return function(_0x903259){if(!_0x903259){_0xe4a944[_0x98f5('0x2b')](0x194);}return _0x903259;};}function handleError(_0x3e4e3e,_0x3187bd){_0x3187bd=_0x3187bd||0x1f4;return function(_0x39d935){logger['error'](_0x39d935[_0x98f5('0x39')]);if(_0x39d935['name']){delete _0x39d935['name'];}_0x3e4e3e[_0x98f5('0x2c')](_0x3187bd)[_0x98f5('0x3a')](_0x39d935);};}exports[_0x98f5('0x3b')]=function(_0x32d722,_0x5a280e){var _0x29e9e2={},_0x250933={},_0x163b27={'count':0x0,'rows':[]};var _0x4f4e9d=_[_0x98f5('0x3c')](db[_0x98f5('0x3d')]['rawAttributes'],function(_0x3074b2){return{'name':_0x3074b2[_0x98f5('0x3e')],'type':_0x3074b2[_0x98f5('0x3f')]['key']};});_0x250933[_0x98f5('0x40')]=_[_0x98f5('0x3c')](_0x4f4e9d,_0x98f5('0x41'));_0x250933[_0x98f5('0x42')]=_[_0x98f5('0x43')](_0x32d722['query']);_0x250933['filters']=_[_0x98f5('0x44')](_0x250933[_0x98f5('0x40')],_0x250933[_0x98f5('0x42')]);_0x29e9e2[_0x98f5('0x45')]=_[_0x98f5('0x44')](_0x250933[_0x98f5('0x40')],qs['fields'](_0x32d722['query'][_0x98f5('0x46')]));_0x29e9e2[_0x98f5('0x45')]=_0x29e9e2[_0x98f5('0x45')][_0x98f5('0x47')]?_0x29e9e2['attributes']:_0x250933['model'];if(!_0x32d722[_0x98f5('0x42')][_0x98f5('0x48')](_0x98f5('0x49'))){_0x29e9e2[_0x98f5('0x31')]=qs['limit'](_0x32d722['query'][_0x98f5('0x31')]);_0x29e9e2[_0x98f5('0x30')]=qs[_0x98f5('0x30')](_0x32d722['query'][_0x98f5('0x30')]);}_0x29e9e2['order']=qs[_0x98f5('0x4a')](_0x32d722['query'][_0x98f5('0x4a')]);_0x29e9e2[_0x98f5('0x4b')]=qs[_0x98f5('0x4c')](_['pick'](_0x32d722[_0x98f5('0x42')],_0x250933[_0x98f5('0x4c')]),_0x4f4e9d);if(_0x32d722['query'][_0x98f5('0x4d')]){_0x29e9e2[_0x98f5('0x4b')]=_['merge'](_0x29e9e2[_0x98f5('0x4b')],{'$or':_['map'](_0x4f4e9d,function(_0x27bf7c){if(_0x27bf7c[_0x98f5('0x3f')]!=='VIRTUAL'){var _0x4dd7fc={};_0x4dd7fc[_0x27bf7c['name']]={'$like':'%'+_0x32d722['query'][_0x98f5('0x4d')]+'%'};return _0x4dd7fc;}})});}_0x29e9e2=_['merge']({},_0x29e9e2,_0x32d722[_0x98f5('0x4e')]);var _0x188796={'where':_0x29e9e2[_0x98f5('0x4b')]};return db[_0x98f5('0x3d')][_0x98f5('0x2f')](_0x188796)[_0x98f5('0x37')](function(_0x485289){_0x163b27[_0x98f5('0x2f')]=_0x485289;if(_0x32d722[_0x98f5('0x42')][_0x98f5('0x4f')]){_0x29e9e2[_0x98f5('0x50')]=[{'all':!![]}];}return db[_0x98f5('0x3d')][_0x98f5('0x51')](_0x29e9e2);})['then'](function(_0x3a4cc5){_0x163b27[_0x98f5('0x52')]=_0x3a4cc5;return _0x163b27;})[_0x98f5('0x37')](respondWithFilteredResult(_0x5a280e,_0x29e9e2))[_0x98f5('0x2a')](handleError(_0x5a280e,null));};exports['show']=function(_0x2c5f96,_0x157ac0){var _0x151617={'raw':!![],'where':{'id':_0x2c5f96[_0x98f5('0x53')]['id']}},_0x331ab0={};_0x331ab0['model']=_[_0x98f5('0x43')](db[_0x98f5('0x3d')]['rawAttributes']);_0x331ab0[_0x98f5('0x42')]=_['keys'](_0x2c5f96[_0x98f5('0x42')]);_0x331ab0['filters']=_[_0x98f5('0x44')](_0x331ab0[_0x98f5('0x40')],_0x331ab0[_0x98f5('0x42')]);_0x151617['attributes']=_[_0x98f5('0x44')](_0x331ab0[_0x98f5('0x40')],qs[_0x98f5('0x46')](_0x2c5f96[_0x98f5('0x42')][_0x98f5('0x46')]));_0x151617[_0x98f5('0x45')]=_0x151617[_0x98f5('0x45')][_0x98f5('0x47')]?_0x151617[_0x98f5('0x45')]:_0x331ab0[_0x98f5('0x40')];if(_0x2c5f96[_0x98f5('0x42')][_0x98f5('0x4f')]){_0x151617[_0x98f5('0x50')]=[{'all':!![]}];}_0x151617=_[_0x98f5('0x54')]({},_0x151617,_0x2c5f96[_0x98f5('0x4e')]);return db[_0x98f5('0x3d')][_0x98f5('0x55')](_0x151617)['then'](handleEntityNotFound(_0x157ac0,null))[_0x98f5('0x37')](respondWithResult(_0x157ac0,null))[_0x98f5('0x2a')](handleError(_0x157ac0,null));};exports[_0x98f5('0x36')]=function(_0x4663f2,_0x196d34){if(_0x4663f2[_0x98f5('0x56')]['id']){delete _0x4663f2['body']['id'];}return db['FaxMessage']['find']({'where':{'id':_0x4663f2[_0x98f5('0x53')]['id']}})[_0x98f5('0x37')](handleEntityNotFound(_0x196d34,null))[_0x98f5('0x37')](saveUpdates(_0x4663f2[_0x98f5('0x56')],null))['then'](respondWithResult(_0x196d34,null))[_0x98f5('0x2a')](handleError(_0x196d34,null));};exports['destroy']=function(_0x31c413,_0x583be6){return db['FaxMessage'][_0x98f5('0x55')]({'where':{'id':_0x31c413[_0x98f5('0x53')]['id']}})[_0x98f5('0x37')](handleEntityNotFound(_0x583be6,null))['then'](removeEntity(_0x583be6,null))['catch'](handleError(_0x583be6,null));};exports[_0x98f5('0x57')]=function(_0x139ca3,_0x54233b){return db[_0x98f5('0x3d')][_0x98f5('0x57')]()['then'](respondWithResult(_0x54233b,null))[_0x98f5('0x2a')](handleError(_0x54233b,null));};var interaction_log=require(_0x98f5('0x58'))(_0x98f5('0x59'));exports['accept']=function(_0x2ac5ed,_0x1b49a0,_0x1aaa07){var _0xabde69={'agent':{},'channel':_0x98f5('0x5a')};if(_0x2ac5ed[_0x98f5('0x56')]['id']){delete _0x2ac5ed[_0x98f5('0x56')]['id'];}_0x2ac5ed['body'][_0x98f5('0x5b')]=!![];_0x2ac5ed[_0x98f5('0x56')][_0x98f5('0x5c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2ac5ed[_0x98f5('0x56')][_0x98f5('0x5d')]=_0x2ac5ed['body']['UserId']||_0x2ac5ed['user']['id'];_0xabde69['agent']['id']=_0x2ac5ed[_0x98f5('0x56')]['UserId'];return db[_0x98f5('0x3d')][_0x98f5('0x55')]({'where':{'id':_0x2ac5ed[_0x98f5('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x98f5('0x5e')],'as':_0x98f5('0x5f')}]})[_0x98f5('0x37')](handleEntityNotFound(_0x1b49a0,null))[_0x98f5('0x37')](saveUpdates(_0x2ac5ed[_0x98f5('0x56')],null))['then'](function(_0x4d89b6){if(_0x4d89b6){_0xabde69[_0x98f5('0x28')]=_0x4d89b6['get']({'plain':!![]});return db[_0x98f5('0x60')][_0x98f5('0x55')]({'where':{'id':_0x4d89b6[_0x98f5('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x1b49a0,null))[_0x98f5('0x37')](function(_0x56b308){if(_0x56b308){return _0x56b308['update']({'UserId':_0x2ac5ed['body'][_0x98f5('0x5d')],'read1stAt':_['isNil'](_0x56b308[_0x98f5('0x62')])?moment()[_0x98f5('0x63')](_0x98f5('0x64')):undefined});}return null;})['then'](function(_0x5df83d){if(_0x5df83d){_0xabde69['interaction']=_0x5df83d[_0x98f5('0x65')]({'plain':!![]});interaction_log[_0x98f5('0x20')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2ac5ed['user']['id'],_0x2ac5ed[_0x98f5('0x66')][_0x98f5('0x41')],_0x2ac5ed[_0x98f5('0x66')][_0x98f5('0x67')],_0xabde69[_0x98f5('0x68')]['id'],_0x2ac5ed[_0x98f5('0x56')]?JSON[_0x98f5('0x25')](_0x2ac5ed[_0x98f5('0x56')]):_0x98f5('0x69'));return respondWithRpcPromise('AcceptMessage',_0x98f5('0x6a'),_0xabde69);}return null;})[_0x98f5('0x37')](function(_0x205677){if(_0x205677){if(_0x2ac5ed[_0x98f5('0x56')]['manual']){_0xabde69[_0x98f5('0x28')][_0x98f5('0x6b')]=util[_0x98f5('0x63')]('SIP/%s',_0x2ac5ed[_0x98f5('0x66')][_0x98f5('0x41')]);_0xabde69['message'][_0x98f5('0x6c')]=_0xabde69[_0x98f5('0x6c')];_0xabde69[_0x98f5('0x28')]['event']=_0x98f5('0x6d');return respondWithRpcPromise(_0x98f5('0x6e'),_0x98f5('0x6e'),{'event':_0x98f5('0x6f'),'message':_0xabde69[_0x98f5('0x28')]},client9002)[_0x98f5('0x37')](function(){return _0xabde69;});}return _0xabde69;}return null;})[_0x98f5('0x37')](respondWithResult(_0x1b49a0,null))[_0x98f5('0x2a')](handleError(_0x1b49a0,null));};var interaction_log=require(_0x98f5('0x58'))('fax-interactions');exports[_0x98f5('0x35')]=function(_0x486ff6,_0x1b4082,_0x5c69f0){var _0x3bb728={'agent':{},'channel':_0x98f5('0x5a')};if(_0x486ff6['body']['id']){delete _0x486ff6[_0x98f5('0x56')]['id'];}_0x486ff6[_0x98f5('0x56')]['UserId']=_0x486ff6[_0x98f5('0x56')]['UserId']||_0x486ff6[_0x98f5('0x66')]['id'];_0x3bb728[_0x98f5('0x70')]['id']=_0x486ff6[_0x98f5('0x56')][_0x98f5('0x5d')];return db['FaxMessage']['find']({'where':{'id':_0x486ff6[_0x98f5('0x53')]['id'],'UserId':null}})[_0x98f5('0x37')](handleEntityNotFound(_0x1b4082,null))['then'](function(_0x198094){if(_0x198094){_0x3bb728[_0x98f5('0x28')]=_0x198094[_0x98f5('0x65')]({'plain':!![]});return db[_0x98f5('0x60')][_0x98f5('0x55')]({'where':{'id':_0x198094[_0x98f5('0x61')]}});}return null;})[_0x98f5('0x37')](handleEntityNotFound(_0x1b4082,null))[_0x98f5('0x37')](function(_0x2e0484){if(_0x2e0484){_0x3bb728[_0x98f5('0x68')]=_0x2e0484[_0x98f5('0x65')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x486ff6[_0x98f5('0x66')]['id'],_0x486ff6[_0x98f5('0x66')][_0x98f5('0x41')],_0x486ff6['user'][_0x98f5('0x67')],_0x3bb728[_0x98f5('0x68')]['id'],_0x486ff6['body']?JSON[_0x98f5('0x25')](_0x486ff6[_0x98f5('0x56')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x3bb728);}return null;})['then'](function(_0x3d69d2){if(_0x3d69d2){_0x3d69d2[_0x98f5('0x28')]['interface']=util[_0x98f5('0x63')](_0x98f5('0x71'),_0x486ff6['user'][_0x98f5('0x41')]);_0x3d69d2['message']['channel']=_0x3bb728[_0x98f5('0x6c')];_0x3d69d2[_0x98f5('0x28')][_0x98f5('0x72')]=_0x98f5('0x35');respondWithRpcPromise('EventManager',_0x98f5('0x6e'),{'event':'rejectmessage','message':_0x3d69d2['message']},client9002);return _0x3bb728;}return null;})['then'](respondWithResult(_0x1b4082,null))[_0x98f5('0x2a')](handleError(_0x1b4082,null));};exports[_0x98f5('0x73')]=function(_0x251c1c,_0x138981){var _0x1dbd36;return db[_0x98f5('0x3d')][_0x98f5('0x73')](_0x251c1c[_0x98f5('0x56')],{})[_0x98f5('0x37')](function(_0x2aa9a4){_0x1dbd36=_0x2aa9a4;return db['CmContact'][_0x98f5('0x74')]({'where':{'id':_0x1dbd36[_0x98f5('0x75')]}});})[_0x98f5('0x37')](function(_0x449422){if(_['isNil'](_0x449422)){return;}else{_0x1dbd36[_0x98f5('0x5a')]=_0x449422[_0x98f5('0x5a')];return db['Attachment'][_0x98f5('0x74')]({'where':{'id':_0x1dbd36[_0x98f5('0x76')]}});}})[_0x98f5('0x37')](function(_0x4bda79){return respondWithRpcPromise(_0x98f5('0x77'),_0x98f5('0x77'),{'FaxAccountId':_[_0x98f5('0x78')](_0x251c1c[_0x98f5('0x56')])?undefined:_0x251c1c[_0x98f5('0x56')][_0x98f5('0x79')],'path':_['isNil'](_0x4bda79)?undefined:util['format'](_0x98f5('0x7a'),_0x4bda79[_0x98f5('0x7b')]),'fax':_[_0x98f5('0x78')](_0x1dbd36[_0x98f5('0x5a')])?undefined:_0x1dbd36['fax'],'AttachmentId':_0x1dbd36[_0x98f5('0x76')]},client9002);})[_0x98f5('0x37')](respondWithResult(_0x138981,0xc9))['catch'](handleError(_0x138981,null));};exports['download']=function(_0x20b275,_0x50c380){var _0xcbe143=path[_0x98f5('0x7c')](config[_0x98f5('0x7d')],'server',_0x98f5('0x7e'),_0x98f5('0x7f'));return db['FaxMessage'][_0x98f5('0x55')]({'where':{'id':_0x20b275[_0x98f5('0x53')]['id']},'include':[{'model':db[_0x98f5('0x80')],'as':_0x98f5('0x80')}]})['then'](handleEntityNotFound(_0x50c380,null))['then'](function(_0x33b3d4){if(_0x33b3d4){return _0x50c380[_0x98f5('0x81')](path[_0x98f5('0x7c')](_0xcbe143,_0x33b3d4[_0x98f5('0x80')][_0x98f5('0x7b')]));}})[_0x98f5('0x2a')](handleError(_0x50c380,null));}; \ No newline at end of file +var _0x373d=['send','index','map','FaxMessage','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','filter','where','type','VIRTUAL','merge','options','findAll','rows','rawAttributes','includeAll','include','find','params','body','describe','../../config/logger','fax-interactions','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','RejectMessage','rejectMessage','rejectmessage','create','ContactId','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','files','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./faxMessage.socket','register','jayson/promise','client','http','then','FaxMessage,\x20%s,\x20%s','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x373d,0x1e2));var _0xd373=function(_0x52be03,_0x5bf5f6){_0x52be03=_0x52be03-0x0;var _0xc64bda=_0x373d[_0x52be03];return _0xc64bda;};'use strict';var pdf=require(_0xd373('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd373('0x1'));var zipdir=require(_0xd373('0x2'));var jsonpatch=require(_0xd373('0x3'));var rp=require(_0xd373('0x4'));var moment=require('moment');var BPromise=require(_0xd373('0x5'));var Mustache=require(_0xd373('0x6'));var util=require(_0xd373('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xd373('0x8'));var ejs=require(_0xd373('0x9'));var fs=require('fs');var _=require(_0xd373('0xa'));var squel=require(_0xd373('0xb'));var crypto=require('crypto');var jsforce=require(_0xd373('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd373('0xd'));var Redis=require(_0xd373('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd373('0xf'));var as=require(_0xd373('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd373('0x11'));var utils=require(_0xd373('0x12'));var config=require(_0xd373('0x13'));var licenseUtil=require(_0xd373('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xd373('0x15')],{'host':_0xd373('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd373('0x15')]));require(_0xd373('0x17'))[_0xd373('0x18')](socket);var jayson=require(_0xd373('0x19'));var client=jayson[_0xd373('0x1a')][_0xd373('0x1b')]({'port':0x232c});var client9002=jayson[_0xd373('0x1a')][_0xd373('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5a286a,_0x2c5854,_0x3a5316,_0x263ae3){return new BPromise(function(_0x1921dd,_0x4e5768){var _0x1e26cf=_0x263ae3||client;return _0x1e26cf['request'](_0x5a286a,_0x3a5316)[_0xd373('0x1c')](function(_0x36d47a){logger['info'](_0xd373('0x1d'),_0x2c5854,'request\x20sent');logger['debug'](_0xd373('0x1e'),_0x2c5854,_0xd373('0x1f'),JSON[_0xd373('0x20')](_0x36d47a));if(_0x36d47a[_0xd373('0x21')]){if(_0x36d47a[_0xd373('0x21')][_0xd373('0x22')]===0x1f4){logger['error'](_0xd373('0x1d'),_0x2c5854,_0x36d47a[_0xd373('0x21')][_0xd373('0x23')]);return _0x4e5768(_0x36d47a[_0xd373('0x21')][_0xd373('0x23')]);}logger[_0xd373('0x21')]('FaxMessage,\x20%s,\x20%s',_0x2c5854,_0x36d47a[_0xd373('0x21')][_0xd373('0x23')]);return _0x1921dd(_0x36d47a[_0xd373('0x21')][_0xd373('0x23')]);}else{logger[_0xd373('0x24')](_0xd373('0x1d'),_0x2c5854,_0xd373('0x1f'));_0x1921dd(_0x36d47a[_0xd373('0x25')][_0xd373('0x23')]);}})[_0xd373('0x26')](function(_0x437110){logger[_0xd373('0x21')](_0xd373('0x1d'),_0x2c5854,_0x437110);_0x4e5768(_0x437110);});});}function respondWithStatusCode(_0x420a30,_0x18d7ab){_0x18d7ab=_0x18d7ab||0xcc;return function(_0x38ba50){if(_0x38ba50){return _0x420a30[_0xd373('0x27')](_0x18d7ab);}return _0x420a30[_0xd373('0x28')](_0x18d7ab)[_0xd373('0x29')]();};}function respondWithResult(_0x470612,_0x45ee58){_0x45ee58=_0x45ee58||0xc8;return function(_0x3ad8c){if(_0x3ad8c){return _0x470612[_0xd373('0x28')](_0x45ee58)[_0xd373('0x2a')](_0x3ad8c);}};}function respondWithFilteredResult(_0xf85ca8,_0x2869e5){return function(_0x158825){if(_0x158825){var _0xbc420b=_0x158825[_0xd373('0x2b')],_0x2ee37c=_0x2869e5['offset'],_0x7dad3e=_0x2869e5['offset']+_0x2869e5[_0xd373('0x2c')],_0x5287e7;if(_0x7dad3e>=_0xbc420b){_0x7dad3e=_0xbc420b;_0x5287e7=0xc8;}else{_0x5287e7=0xce;}_0xf85ca8[_0xd373('0x28')](_0x5287e7);return _0xf85ca8[_0xd373('0x2d')](_0xd373('0x2e'),_0x2ee37c+'-'+_0x7dad3e+'/'+_0xbc420b)[_0xd373('0x2a')](_0x158825);}return null;};}function patchUpdates(_0x4e45be){return function(_0x6659f6){try{jsonpatch[_0xd373('0x2f')](_0x6659f6,_0x4e45be,!![]);}catch(_0x4e17c9){return BPromise[_0xd373('0x30')](_0x4e17c9);}return _0x6659f6[_0xd373('0x31')]();};}function saveUpdates(_0x146e24,_0x37d3bf){return function(_0x26538a){if(_0x26538a){return _0x26538a[_0xd373('0x32')](_0x146e24)[_0xd373('0x1c')](function(_0x470d6e){return _0x470d6e;});}return null;};}function removeEntity(_0x42faaa,_0x52ff26){return function(_0x11fcab){if(_0x11fcab){return _0x11fcab[_0xd373('0x33')]()[_0xd373('0x1c')](function(){_0x42faaa[_0xd373('0x28')](0xcc)[_0xd373('0x29')]();});}};}function handleEntityNotFound(_0x28da03,_0x4569d1){return function(_0x2aba63){if(!_0x2aba63){_0x28da03[_0xd373('0x27')](0x194);}return _0x2aba63;};}function handleError(_0x10fa13,_0x38e0ea){_0x38e0ea=_0x38e0ea||0x1f4;return function(_0x13a1cd){logger[_0xd373('0x21')](_0x13a1cd[_0xd373('0x34')]);if(_0x13a1cd[_0xd373('0x35')]){delete _0x13a1cd['name'];}_0x10fa13[_0xd373('0x28')](_0x38e0ea)[_0xd373('0x36')](_0x13a1cd);};}exports[_0xd373('0x37')]=function(_0x3b4382,_0x4b1080){var _0x35392b={},_0x470d91={},_0x109fb2={'count':0x0,'rows':[]};var _0x3af9f7=_[_0xd373('0x38')](db[_0xd373('0x39')]['rawAttributes'],function(_0x4a2fc5){return{'name':_0x4a2fc5[_0xd373('0x3a')],'type':_0x4a2fc5['type'][_0xd373('0x3b')]};});_0x470d91[_0xd373('0x3c')]=_[_0xd373('0x38')](_0x3af9f7,'name');_0x470d91[_0xd373('0x3d')]=_[_0xd373('0x3e')](_0x3b4382[_0xd373('0x3d')]);_0x470d91[_0xd373('0x3f')]=_['intersection'](_0x470d91['model'],_0x470d91['query']);_0x35392b[_0xd373('0x40')]=_['intersection'](_0x470d91[_0xd373('0x3c')],qs[_0xd373('0x41')](_0x3b4382['query']['fields']));_0x35392b['attributes']=_0x35392b[_0xd373('0x40')][_0xd373('0x42')]?_0x35392b[_0xd373('0x40')]:_0x470d91['model'];if(!_0x3b4382['query'][_0xd373('0x43')](_0xd373('0x44'))){_0x35392b['limit']=qs[_0xd373('0x2c')](_0x3b4382[_0xd373('0x3d')][_0xd373('0x2c')]);_0x35392b[_0xd373('0x45')]=qs[_0xd373('0x45')](_0x3b4382['query']['offset']);}_0x35392b[_0xd373('0x46')]=qs[_0xd373('0x47')](_0x3b4382[_0xd373('0x3d')][_0xd373('0x47')]);_0x35392b['where']=qs[_0xd373('0x3f')](_['pick'](_0x3b4382[_0xd373('0x3d')],_0x470d91[_0xd373('0x3f')]),_0x3af9f7);if(_0x3b4382[_0xd373('0x3d')][_0xd373('0x48')]){_0x35392b[_0xd373('0x49')]=_['merge'](_0x35392b[_0xd373('0x49')],{'$or':_[_0xd373('0x38')](_0x3af9f7,function(_0x4fc7bf){if(_0x4fc7bf[_0xd373('0x4a')]!==_0xd373('0x4b')){var _0x427310={};_0x427310[_0x4fc7bf[_0xd373('0x35')]]={'$like':'%'+_0x3b4382[_0xd373('0x3d')][_0xd373('0x48')]+'%'};return _0x427310;}})});}_0x35392b=_[_0xd373('0x4c')]({},_0x35392b,_0x3b4382[_0xd373('0x4d')]);var _0x9f2a2e={'where':_0x35392b[_0xd373('0x49')]};return db['FaxMessage']['count'](_0x9f2a2e)[_0xd373('0x1c')](function(_0x53cd82){_0x109fb2[_0xd373('0x2b')]=_0x53cd82;if(_0x3b4382['query']['includeAll']){_0x35392b['include']=[{'all':!![]}];}return db[_0xd373('0x39')][_0xd373('0x4e')](_0x35392b);})[_0xd373('0x1c')](function(_0xead46f){_0x109fb2[_0xd373('0x4f')]=_0xead46f;return _0x109fb2;})[_0xd373('0x1c')](respondWithFilteredResult(_0x4b1080,_0x35392b))[_0xd373('0x26')](handleError(_0x4b1080,null));};exports['show']=function(_0x28ec3e,_0x57c705){var _0x4076e0={'raw':!![],'where':{'id':_0x28ec3e['params']['id']}},_0x224196={};_0x224196[_0xd373('0x3c')]=_['keys'](db[_0xd373('0x39')][_0xd373('0x50')]);_0x224196[_0xd373('0x3d')]=_[_0xd373('0x3e')](_0x28ec3e[_0xd373('0x3d')]);_0x224196['filters']=_['intersection'](_0x224196['model'],_0x224196[_0xd373('0x3d')]);_0x4076e0[_0xd373('0x40')]=_['intersection'](_0x224196[_0xd373('0x3c')],qs[_0xd373('0x41')](_0x28ec3e['query'][_0xd373('0x41')]));_0x4076e0[_0xd373('0x40')]=_0x4076e0[_0xd373('0x40')][_0xd373('0x42')]?_0x4076e0[_0xd373('0x40')]:_0x224196[_0xd373('0x3c')];if(_0x28ec3e[_0xd373('0x3d')][_0xd373('0x51')]){_0x4076e0[_0xd373('0x52')]=[{'all':!![]}];}_0x4076e0=_[_0xd373('0x4c')]({},_0x4076e0,_0x28ec3e[_0xd373('0x4d')]);return db['FaxMessage']['find'](_0x4076e0)['then'](handleEntityNotFound(_0x57c705,null))['then'](respondWithResult(_0x57c705,null))['catch'](handleError(_0x57c705,null));};exports['update']=function(_0x409246,_0x289ec2){if(_0x409246['body']['id']){delete _0x409246['body']['id'];}return db['FaxMessage'][_0xd373('0x53')]({'where':{'id':_0x409246[_0xd373('0x54')]['id']}})['then'](handleEntityNotFound(_0x289ec2,null))['then'](saveUpdates(_0x409246[_0xd373('0x55')],null))[_0xd373('0x1c')](respondWithResult(_0x289ec2,null))[_0xd373('0x26')](handleError(_0x289ec2,null));};exports[_0xd373('0x33')]=function(_0x38c01c,_0x59da03){return db[_0xd373('0x39')][_0xd373('0x53')]({'where':{'id':_0x38c01c[_0xd373('0x54')]['id']}})[_0xd373('0x1c')](handleEntityNotFound(_0x59da03,null))[_0xd373('0x1c')](removeEntity(_0x59da03,null))[_0xd373('0x26')](handleError(_0x59da03,null));};exports[_0xd373('0x56')]=function(_0x2e4298,_0x10fffb){return db[_0xd373('0x39')][_0xd373('0x56')]()[_0xd373('0x1c')](respondWithResult(_0x10fffb,null))[_0xd373('0x26')](handleError(_0x10fffb,null));};var interaction_log=require(_0xd373('0x57'))(_0xd373('0x58'));exports['accept']=function(_0xc41581,_0x1f775c,_0x1de907){var _0x4dba1d={'agent':{},'channel':_0xd373('0x59')};if(_0xc41581['body']['id']){delete _0xc41581[_0xd373('0x55')]['id'];}_0xc41581['body'][_0xd373('0x5a')]=!![];_0xc41581[_0xd373('0x55')][_0xd373('0x5b')]=moment()[_0xd373('0x5c')](_0xd373('0x5d'));_0xc41581[_0xd373('0x55')][_0xd373('0x5e')]=_0xc41581[_0xd373('0x55')][_0xd373('0x5e')]||_0xc41581[_0xd373('0x5f')]['id'];_0x4dba1d[_0xd373('0x60')]['id']=_0xc41581[_0xd373('0x55')][_0xd373('0x5e')];return db[_0xd373('0x39')][_0xd373('0x53')]({'where':{'id':_0xc41581[_0xd373('0x54')]['id'],'UserId':null},'include':[{'model':db[_0xd373('0x61')],'as':_0xd373('0x62')}]})[_0xd373('0x1c')](handleEntityNotFound(_0x1f775c,null))[_0xd373('0x1c')](saveUpdates(_0xc41581[_0xd373('0x55')],null))[_0xd373('0x1c')](function(_0x296242){if(_0x296242){_0x4dba1d[_0xd373('0x23')]=_0x296242[_0xd373('0x63')]({'plain':!![]});return db[_0xd373('0x64')]['find']({'where':{'id':_0x296242[_0xd373('0x65')]}});}return null;})[_0xd373('0x1c')](handleEntityNotFound(_0x1f775c,null))[_0xd373('0x1c')](function(_0x4a7d01){if(_0x4a7d01){return _0x4a7d01[_0xd373('0x32')]({'UserId':_0xc41581[_0xd373('0x55')][_0xd373('0x5e')],'read1stAt':_[_0xd373('0x66')](_0x4a7d01[_0xd373('0x67')])?moment()[_0xd373('0x5c')](_0xd373('0x5d')):undefined});}return null;})['then'](function(_0x1afe12){if(_0x1afe12){_0x4dba1d[_0xd373('0x68')]=_0x1afe12[_0xd373('0x63')]({'plain':!![]});interaction_log[_0xd373('0x24')](_0xd373('0x69'),_0xc41581[_0xd373('0x5f')]['id'],_0xc41581[_0xd373('0x5f')][_0xd373('0x35')],_0xc41581['user'][_0xd373('0x6a')],_0x4dba1d['interaction']['id'],_0xc41581[_0xd373('0x55')]?JSON[_0xd373('0x20')](_0xc41581[_0xd373('0x55')]):_0xd373('0x6b'));return respondWithRpcPromise(_0xd373('0x6c'),_0xd373('0x6d'),_0x4dba1d);}return null;})[_0xd373('0x1c')](function(_0x3317b1){if(_0x3317b1){if(_0xc41581['body'][_0xd373('0x6e')]){_0x4dba1d['message'][_0xd373('0x6f')]=util[_0xd373('0x5c')](_0xd373('0x70'),_0xc41581[_0xd373('0x5f')][_0xd373('0x35')]);_0x4dba1d[_0xd373('0x23')][_0xd373('0x71')]=_0x4dba1d['channel'];_0x4dba1d[_0xd373('0x23')][_0xd373('0x72')]=_0xd373('0x73');return respondWithRpcPromise('EventManager',_0xd373('0x74'),{'event':_0xd373('0x75'),'message':_0x4dba1d[_0xd373('0x23')]},client9002)[_0xd373('0x1c')](function(){return _0x4dba1d;});}return _0x4dba1d;}return null;})[_0xd373('0x1c')](respondWithResult(_0x1f775c,null))[_0xd373('0x26')](handleError(_0x1f775c,null));};var interaction_log=require(_0xd373('0x57'))(_0xd373('0x58'));exports[_0xd373('0x30')]=function(_0x727541,_0x3d4805,_0x475efb){var _0x5bbea5={'agent':{},'channel':_0xd373('0x59')};if(_0x727541[_0xd373('0x55')]['id']){delete _0x727541[_0xd373('0x55')]['id'];}_0x727541['body'][_0xd373('0x5e')]=_0x727541[_0xd373('0x55')][_0xd373('0x5e')]||_0x727541['user']['id'];_0x5bbea5[_0xd373('0x60')]['id']=_0x727541['body'][_0xd373('0x5e')];return db[_0xd373('0x39')][_0xd373('0x53')]({'where':{'id':_0x727541[_0xd373('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3d4805,null))[_0xd373('0x1c')](function(_0x535dfd){if(_0x535dfd){_0x5bbea5[_0xd373('0x23')]=_0x535dfd[_0xd373('0x63')]({'plain':!![]});return db[_0xd373('0x64')][_0xd373('0x53')]({'where':{'id':_0x535dfd[_0xd373('0x65')]}});}return null;})[_0xd373('0x1c')](handleEntityNotFound(_0x3d4805,null))['then'](function(_0xb01a00){if(_0xb01a00){_0x5bbea5['interaction']=_0xb01a00[_0xd373('0x63')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x727541[_0xd373('0x5f')]['id'],_0x727541[_0xd373('0x5f')][_0xd373('0x35')],_0x727541[_0xd373('0x5f')]['role'],_0x5bbea5['interaction']['id'],_0x727541[_0xd373('0x55')]?JSON[_0xd373('0x20')](_0x727541[_0xd373('0x55')]):_0xd373('0x6b'));return respondWithRpcPromise(_0xd373('0x76'),_0xd373('0x77'),_0x5bbea5);}return null;})[_0xd373('0x1c')](function(_0x2d2ea6){if(_0x2d2ea6){_0x2d2ea6[_0xd373('0x23')][_0xd373('0x6f')]=util['format'](_0xd373('0x70'),_0x727541[_0xd373('0x5f')][_0xd373('0x35')]);_0x2d2ea6[_0xd373('0x23')][_0xd373('0x71')]=_0x5bbea5[_0xd373('0x71')];_0x2d2ea6[_0xd373('0x23')]['event']=_0xd373('0x30');respondWithRpcPromise('EventManager','EventManager',{'event':_0xd373('0x78'),'message':_0x2d2ea6[_0xd373('0x23')]},client9002);return _0x5bbea5;}return null;})[_0xd373('0x1c')](respondWithResult(_0x3d4805,null))[_0xd373('0x26')](handleError(_0x3d4805,null));};exports[_0xd373('0x79')]=function(_0x13116c,_0x578a5e){var _0x30732e;return db[_0xd373('0x39')][_0xd373('0x79')](_0x13116c['body'],{})[_0xd373('0x1c')](function(_0x2c543a){_0x30732e=_0x2c543a;return db[_0xd373('0x61')]['findOne']({'where':{'id':_0x30732e[_0xd373('0x7a')]}});})[_0xd373('0x1c')](function(_0x768dac){if(_['isNil'](_0x768dac)){return;}else{_0x30732e[_0xd373('0x59')]=_0x768dac[_0xd373('0x59')];return db[_0xd373('0x7b')][_0xd373('0x7c')]({'where':{'id':_0x30732e[_0xd373('0x7d')]}});}})[_0xd373('0x1c')](function(_0x14a554){return respondWithRpcPromise(_0xd373('0x7e'),_0xd373('0x7e'),{'FaxAccountId':_[_0xd373('0x66')](_0x13116c[_0xd373('0x55')])?undefined:_0x13116c[_0xd373('0x55')][_0xd373('0x7f')],'path':_['isNil'](_0x14a554)?undefined:util[_0xd373('0x5c')](_0xd373('0x80'),_0x14a554[_0xd373('0x81')]),'fax':_['isNil'](_0x30732e[_0xd373('0x59')])?undefined:_0x30732e[_0xd373('0x59')],'AttachmentId':_0x30732e['AttachmentId']},client9002);})[_0xd373('0x1c')](respondWithResult(_0x578a5e,0xc9))['catch'](handleError(_0x578a5e,null));};exports[_0xd373('0x82')]=function(_0x473cf1,_0x2a00e8){var _0x3bc47a=path[_0xd373('0x83')](config[_0xd373('0x84')],'server',_0xd373('0x85'),'attachments');return db[_0xd373('0x39')][_0xd373('0x53')]({'where':{'id':_0x473cf1[_0xd373('0x54')]['id']},'include':[{'model':db[_0xd373('0x7b')],'as':_0xd373('0x7b')}]})['then'](handleEntityNotFound(_0x2a00e8,null))[_0xd373('0x1c')](function(_0x4334be){if(_0x4334be){return _0x2a00e8[_0xd373('0x82')](path[_0xd373('0x83')](_0x3bc47a,_0x4334be[_0xd373('0x7b')][_0xd373('0x81')]));}})['catch'](handleError(_0x2a00e8,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 8954f52..1dd9844 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 _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0x55ca,0x126));var _0xa55c=function(_0x4c11f7,_0x5a0447){_0x4c11f7=_0x4c11f7-0x0;var _0x587d6b=_0x55ca[_0x4c11f7];return _0x587d6b;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var FaxMessage=require(_0xa55c('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){FaxMessageEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);FaxMessageEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];FaxMessage[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe14b,0x93));var _0xbe14=function(_0x14fb46,_0x314204){_0x14fb46=_0x14fb46-0x0;var _0x2c0e49=_0xe14b[_0x14fb46];return _0x2c0e49;};'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 diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 9669c6f..676d0b5 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 _0xc512=['rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fti_fax_messages','body','FULLTEXT','get','direction','out','secret','isNil','UserId','findOne','FaxInteractionId','then','createdAt','toLowerCase','catch','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1861da,_0x1e939d){var _0x4403cc=function(_0x336a39){while(--_0x336a39){_0x1861da['push'](_0x1861da['shift']());}};_0x4403cc(++_0x1e939d);}(_0xc512,0x167));var _0x2c51=function(_0x35a59c,_0x3c08ef){_0x35a59c=_0x35a59c-0x0;var _0x11bf0e=_0xc512[_0x35a59c];return _0x11bf0e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2c51('0x0'))('api');var moment=require(_0x2c51('0x1'));var BPromise=require(_0x2c51('0x2'));var rp=require(_0x2c51('0x3'));var fs=require('fs');var path=require(_0x2c51('0x4'));var rimraf=require(_0x2c51('0x5'));var config=require(_0x2c51('0x6'));var attributes=require(_0x2c51('0x7'));module[_0x2c51('0x8')]=function(_0x29ccd6,_0x1d8197){return _0x29ccd6[_0x2c51('0x9')](_0x2c51('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x2c51('0xb'),'fields':[_0x2c51('0xc')],'type':_0x2c51('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x15bccc,_0x2e81c0,_0x42fe80){var _0x3678b0=_0x29ccd6['models'];var _0x28dc24=_0x15bccc[_0x2c51('0xe')]({'plain':!![]});if(_0x28dc24[_0x2c51('0xf')]['toLowerCase']()==='in'||_0x28dc24[_0x2c51('0xf')]['toLowerCase']()===_0x2c51('0x10')&&!_0x28dc24[_0x2c51('0x11')]&&!_[_0x2c51('0x12')](_0x28dc24[_0x2c51('0x13')])){_0x3678b0['FaxInteraction'][_0x2c51('0x14')]({'where':{'id':_0x28dc24[_0x2c51('0x15')]}})[_0x2c51('0x16')](function(_0x47d7ce){if(_0x47d7ce){_0x47d7ce['update']({'lastMsgAt':_0x28dc24[_0x2c51('0x17')],'lastMsgDirection':_0x28dc24[_0x2c51('0xf')][_0x2c51('0x18')]()});}})[_0x2c51('0x19')](function(_0x3ea4a5){console['error'](_0x3ea4a5);});}_0x42fe80();}},'charset':_0x2c51('0x1a'),'collate':_0x2c51('0x1b')});}; \ No newline at end of file +var _0xa078=['FaxInteraction','findOne','FaxInteractionId','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','fti_fax_messages','models','toLowerCase','direction','isNil','UserId'];(function(_0x498098,_0x2c52e2){var _0x2dd51f=function(_0x38e97c){while(--_0x38e97c){_0x498098['push'](_0x498098['shift']());}};_0x2dd51f(++_0x2c52e2);}(_0xa078,0x133));var _0x8a07=function(_0x75ebdd,_0x3dc35e){_0x75ebdd=_0x75ebdd-0x0;var _0x22152f=_0xa078[_0x75ebdd];return _0x22152f;};'use strict';var _=require(_0x8a07('0x0'));var util=require(_0x8a07('0x1'));var logger=require(_0x8a07('0x2'))(_0x8a07('0x3'));var moment=require('moment');var BPromise=require(_0x8a07('0x4'));var rp=require(_0x8a07('0x5'));var fs=require('fs');var path=require(_0x8a07('0x6'));var rimraf=require(_0x8a07('0x7'));var config=require(_0x8a07('0x8'));var attributes=require(_0x8a07('0x9'));module[_0x8a07('0xa')]=function(_0x27a6da,_0x4cef26){return _0x27a6da[_0x8a07('0xb')]('FaxMessage',attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x8a07('0xc'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1d2f4a,_0xb09338,_0x30157f){var _0x7b329f=_0x27a6da[_0x8a07('0xd')];var _0x2fc58a=_0x1d2f4a['get']({'plain':!![]});if(_0x2fc58a['direction'][_0x8a07('0xe')]()==='in'||_0x2fc58a[_0x8a07('0xf')][_0x8a07('0xe')]()==='out'&&!_0x2fc58a['secret']&&!_[_0x8a07('0x10')](_0x2fc58a[_0x8a07('0x11')])){_0x7b329f[_0x8a07('0x12')][_0x8a07('0x13')]({'where':{'id':_0x2fc58a[_0x8a07('0x14')]}})['then'](function(_0x426bc0){if(_0x426bc0){_0x426bc0['update']({'lastMsgAt':_0x2fc58a['createdAt'],'lastMsgDirection':_0x2fc58a[_0x8a07('0xf')][_0x8a07('0xe')]()});}})[_0x8a07('0x15')](function(_0x3598c2){console[_0x8a07('0x16')](_0x3598c2);});}_0x30157f();}},'charset':_0x8a07('0x17'),'collate':_0x8a07('0x18')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 3771206..7880cf5 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 _0x4a47=['FaxMessage,\x20%s,\x20%s','message','result','catch','FaxMessage','create','body','options','CreateFaxMessage','debug','UpdateFaxMessage','raw','where','attributes','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./faxMessage.socket','register','request','then','info','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x4a47,0x103));var _0x74a4=function(_0x4acb73,_0xb4f550){_0x4acb73=_0x4acb73-0x0;var _0x1598e7=_0x4a47[_0x4acb73];return _0x1598e7;};'use strict';var _=require(_0x74a4('0x0'));var util=require(_0x74a4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x74a4('0x2'));var db=require(_0x74a4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x74a4('0x4'))(_0x74a4('0x5'));var config=require('../../config/environment');var jayson=require(_0x74a4('0x6'));var client=jayson[_0x74a4('0x7')][_0x74a4('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x74a4('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x74a4('0xa'))(new Redis(config[_0x74a4('0x9')]));require(_0x74a4('0xb'))[_0x74a4('0xc')](socket);function respondWithRpcPromise(_0x14ce41,_0x3b437f,_0x11b0e2){return new BPromise(function(_0x4e6a5a,_0xb16ff7){return client[_0x74a4('0xd')](_0x14ce41,_0x11b0e2)[_0x74a4('0xe')](function(_0x428742){logger[_0x74a4('0xf')]('FaxMessage,\x20%s,\x20%s',_0x3b437f,_0x74a4('0x10'));logger['debug'](_0x74a4('0x11'),_0x3b437f,_0x74a4('0x10'),JSON[_0x74a4('0x12')](_0x428742));if(_0x428742[_0x74a4('0x13')]){if(_0x428742[_0x74a4('0x13')][_0x74a4('0x14')]===0x1f4){logger[_0x74a4('0x13')](_0x74a4('0x15'),_0x3b437f,_0x428742[_0x74a4('0x13')][_0x74a4('0x16')]);return _0xb16ff7(_0x428742[_0x74a4('0x13')][_0x74a4('0x16')]);}logger[_0x74a4('0x13')](_0x74a4('0x15'),_0x3b437f,_0x428742[_0x74a4('0x13')]['message']);return _0x4e6a5a(_0x428742['error'][_0x74a4('0x16')]);}else{logger[_0x74a4('0xf')](_0x74a4('0x15'),_0x3b437f,'request\x20sent');_0x4e6a5a(_0x428742[_0x74a4('0x17')][_0x74a4('0x16')]);}})[_0x74a4('0x18')](function(_0x16edbf){logger['error']('FaxMessage,\x20%s,\x20%s',_0x3b437f,_0x16edbf);_0xb16ff7(_0x16edbf);});});}exports['CreateFaxMessage']=function(_0x2ac474){var _0x300681=this;return new Promise(function(_0x1775ac,_0x13f1b3){return db[_0x74a4('0x19')][_0x74a4('0x1a')](_0x2ac474[_0x74a4('0x1b')],{'raw':_0x2ac474[_0x74a4('0x1c')]?_0x2ac474[_0x74a4('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x74a4('0xe')](function(_0x158acf){logger['info'](_0x74a4('0x1d'),_0x2ac474);logger[_0x74a4('0x1e')](_0x74a4('0x1d'),_0x2ac474,JSON[_0x74a4('0x12')](_0x158acf));_0x1775ac(_0x158acf);})['catch'](function(_0x295eb6){logger[_0x74a4('0x13')](_0x74a4('0x1d'),_0x295eb6[_0x74a4('0x16')],_0x2ac474);_0x13f1b3(_0x300681[_0x74a4('0x13')](0x1f4,_0x295eb6[_0x74a4('0x16')]));});});};exports[_0x74a4('0x1f')]=function(_0x4ef8d1){var _0x5df363=this;return new Promise(function(_0x33d7e1,_0x29d463){return db[_0x74a4('0x19')]['update'](_0x4ef8d1['body'],{'raw':_0x4ef8d1[_0x74a4('0x1c')]?_0x4ef8d1[_0x74a4('0x1c')][_0x74a4('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ef8d1[_0x74a4('0x1c')]?_0x4ef8d1[_0x74a4('0x1c')][_0x74a4('0x21')]||null:null,'attributes':_0x4ef8d1[_0x74a4('0x1c')]?_0x4ef8d1[_0x74a4('0x1c')][_0x74a4('0x22')]||null:null,'limit':_0x4ef8d1['options']?_0x4ef8d1[_0x74a4('0x1c')]['limit']||null:null})[_0x74a4('0xe')](function(_0x1195f4){logger[_0x74a4('0xf')](_0x74a4('0x1f'),_0x4ef8d1);logger[_0x74a4('0x1e')]('UpdateFaxMessage',_0x4ef8d1,JSON['stringify'](_0x1195f4));_0x33d7e1(_0x1195f4);})['catch'](function(_0x517284){logger['error'](_0x74a4('0x1f'),_0x517284[_0x74a4('0x16')],_0x4ef8d1);_0x29d463(_0x5df363['error'](0x1f4,_0x517284[_0x74a4('0x16')]));});});}; \ No newline at end of file +var _0xb314=['../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','create','body','options','raw','CreateFaxMessage','debug','UpdateFaxMessage','FaxMessage','update','attributes','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x40d5fa,_0x587701){var _0x110ca9=function(_0x4e4fa2){while(--_0x4e4fa2){_0x40d5fa['push'](_0x40d5fa['shift']());}};_0x110ca9(++_0x587701);}(_0xb314,0x123));var _0x4b31=function(_0x507483,_0x246e9b){_0x507483=_0x507483-0x0;var _0x199eeb=_0xb314[_0x507483];return _0x199eeb;};'use strict';var _=require(_0x4b31('0x0'));var util=require('util');var moment=require(_0x4b31('0x1'));var BPromise=require('bluebird');var rs=require(_0x4b31('0x2'));var fs=require('fs');var Redis=require(_0x4b31('0x3'));var db=require(_0x4b31('0x4'))['db'];var utils=require(_0x4b31('0x5'));var logger=require('../../config/logger')(_0x4b31('0x6'));var config=require(_0x4b31('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4b31('0x8')][_0x4b31('0x9')]({'port':0x232a});config[_0x4b31('0xa')]=_[_0x4b31('0xb')](config[_0x4b31('0xa')],{'host':_0x4b31('0xc'),'port':0x18eb});var socket=require(_0x4b31('0xd'))(new Redis(config[_0x4b31('0xa')]));require(_0x4b31('0xe'))[_0x4b31('0xf')](socket);function respondWithRpcPromise(_0x1a9287,_0x33c1df,_0x218e36){return new BPromise(function(_0xb1e087,_0x31733){return client[_0x4b31('0x10')](_0x1a9287,_0x218e36)[_0x4b31('0x11')](function(_0x1beef9){logger[_0x4b31('0x12')](_0x4b31('0x13'),_0x33c1df,_0x4b31('0x14'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x33c1df,'request\x20sent',JSON[_0x4b31('0x15')](_0x1beef9));if(_0x1beef9[_0x4b31('0x16')]){if(_0x1beef9['error'][_0x4b31('0x17')]===0x1f4){logger[_0x4b31('0x16')](_0x4b31('0x13'),_0x33c1df,_0x1beef9[_0x4b31('0x16')][_0x4b31('0x18')]);return _0x31733(_0x1beef9[_0x4b31('0x16')][_0x4b31('0x18')]);}logger[_0x4b31('0x16')](_0x4b31('0x13'),_0x33c1df,_0x1beef9[_0x4b31('0x16')][_0x4b31('0x18')]);return _0xb1e087(_0x1beef9['error'][_0x4b31('0x18')]);}else{logger['info'](_0x4b31('0x13'),_0x33c1df,_0x4b31('0x14'));_0xb1e087(_0x1beef9[_0x4b31('0x19')][_0x4b31('0x18')]);}})[_0x4b31('0x1a')](function(_0x4a381a){logger[_0x4b31('0x16')](_0x4b31('0x13'),_0x33c1df,_0x4a381a);_0x31733(_0x4a381a);});});}exports['CreateFaxMessage']=function(_0xd61e81){var _0x38edec=this;return new Promise(function(_0x5e5666,_0x4b1d2a){return db['FaxMessage'][_0x4b31('0x1b')](_0xd61e81[_0x4b31('0x1c')],{'raw':_0xd61e81['options']?_0xd61e81[_0x4b31('0x1d')][_0x4b31('0x1e')]===undefined?!![]:![]:!![]})[_0x4b31('0x11')](function(_0x5aeb8c){logger[_0x4b31('0x12')](_0x4b31('0x1f'),_0xd61e81);logger[_0x4b31('0x20')]('CreateFaxMessage',_0xd61e81,JSON[_0x4b31('0x15')](_0x5aeb8c));_0x5e5666(_0x5aeb8c);})[_0x4b31('0x1a')](function(_0x572f02){logger['error'](_0x4b31('0x1f'),_0x572f02['message'],_0xd61e81);_0x4b1d2a(_0x38edec[_0x4b31('0x16')](0x1f4,_0x572f02[_0x4b31('0x18')]));});});};exports[_0x4b31('0x21')]=function(_0x5470f1){var _0x6d6599=this;return new Promise(function(_0xa15bf6,_0x2a0e31){return db[_0x4b31('0x22')][_0x4b31('0x23')](_0x5470f1[_0x4b31('0x1c')],{'raw':_0x5470f1[_0x4b31('0x1d')]?_0x5470f1['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5470f1[_0x4b31('0x1d')]?_0x5470f1['options']['where']||null:null,'attributes':_0x5470f1['options']?_0x5470f1[_0x4b31('0x1d')][_0x4b31('0x24')]||null:null,'limit':_0x5470f1[_0x4b31('0x1d')]?_0x5470f1[_0x4b31('0x1d')]['limit']||null:null})[_0x4b31('0x11')](function(_0xe6be94){logger['info'](_0x4b31('0x21'),_0x5470f1);logger['debug'](_0x4b31('0x21'),_0x5470f1,JSON['stringify'](_0xe6be94));_0xa15bf6(_0xe6be94);})['catch'](function(_0x2e32ed){logger[_0x4b31('0x16')]('UpdateFaxMessage',_0x2e32ed['message'],_0x5470f1);_0x2a0e31(_0x6d6599['error'](0x1f4,_0x2e32ed[_0x4b31('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 2a21716..6e60763 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 1e414fd..908fc8a 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 _0xd93e=['path','Router','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','index','/describe','isAuthenticated','show','/:id/download','post','tracked','fax','faxmessage:create','update','put','/:id/accept','accept','/:id/reject','reject','delete','/:id','destroy','exports','multer','util'];(function(_0xf5aede,_0x5b2e7f){var _0x5c6890=function(_0x12db0f){while(--_0x12db0f){_0xf5aede['push'](_0xf5aede['shift']());}};_0x5c6890(++_0x5b2e7f);}(_0xd93e,0x15d));var _0xed93=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xd93e[_0xa148b7];return _0x51efd3;};'use strict';var multer=require(_0xed93('0x0'));var util=require(_0xed93('0x1'));var path=require(_0xed93('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xed93('0x3')]();var auth=require(_0xed93('0x4'));var interaction=require(_0xed93('0x5'));var config=require('../../config/environment');var controller=require(_0xed93('0x6'));router[_0xed93('0x7')]('/',auth['isAuthenticated'](),controller[_0xed93('0x8')]);router[_0xed93('0x7')](_0xed93('0x9'),auth[_0xed93('0xa')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xed93('0xb')]);router[_0xed93('0x7')](_0xed93('0xc'),auth[_0xed93('0xa')](),controller['download']);router[_0xed93('0xd')]('/',auth['isAuthenticated'](),interaction[_0xed93('0xe')](_0xed93('0xf'),_0xed93('0x10')),controller['create']);router['put']('/:id',auth[_0xed93('0xa')](),controller[_0xed93('0x11')]);router[_0xed93('0x12')](_0xed93('0x13'),auth['isAuthenticated'](),controller[_0xed93('0x14')]);router[_0xed93('0x12')](_0xed93('0x15'),auth[_0xed93('0xa')](),controller[_0xed93('0x16')]);router[_0xed93('0x17')](_0xed93('0x18'),auth[_0xed93('0xa')](),controller[_0xed93('0x19')]);module[_0xed93('0x1a')]=router; \ No newline at end of file +var _0x4759=['/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','post','tracked','fax','put','update','/:id/accept'];(function(_0x6f51dc,_0x2543ab){var _0x3ebd3c=function(_0x13bc87){while(--_0x13bc87){_0x6f51dc['push'](_0x6f51dc['shift']());}};_0x3ebd3c(++_0x2543ab);}(_0x4759,0x13c));var _0x9475=function(_0x17c483,_0xc69535){_0x17c483=_0x17c483-0x0;var _0x112bdb=_0x4759[_0x17c483];return _0x112bdb;};'use strict';var multer=require(_0x9475('0x0'));var util=require(_0x9475('0x1'));var path=require(_0x9475('0x2'));var timeout=require(_0x9475('0x3'));var express=require(_0x9475('0x4'));var router=express[_0x9475('0x5')]();var auth=require(_0x9475('0x6'));var interaction=require(_0x9475('0x7'));var config=require('../../config/environment');var controller=require('./faxMessage.controller');router[_0x9475('0x8')]('/',auth[_0x9475('0x9')](),controller[_0x9475('0xa')]);router[_0x9475('0x8')]('/describe',auth[_0x9475('0x9')](),controller[_0x9475('0xb')]);router[_0x9475('0x8')](_0x9475('0xc'),auth[_0x9475('0x9')](),controller[_0x9475('0xd')]);router['get'](_0x9475('0xe'),auth[_0x9475('0x9')](),controller[_0x9475('0xf')]);router[_0x9475('0x10')]('/',auth['isAuthenticated'](),interaction[_0x9475('0x11')](_0x9475('0x12'),'faxmessage:create'),controller['create']);router[_0x9475('0x13')](_0x9475('0xc'),auth[_0x9475('0x9')](),controller[_0x9475('0x14')]);router[_0x9475('0x13')](_0x9475('0x15'),auth[_0x9475('0x9')](),controller['accept']);router[_0x9475('0x13')](_0x9475('0x16'),auth[_0x9475('0x9')](),controller['reject']);router[_0x9475('0x17')](_0x9475('0xc'),auth[_0x9475('0x9')](),controller[_0x9475('0x18')]);module[_0x9475('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 18e651f..8737364 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 _0xaf5c=['STRING','name','ENUM','rrmemory','roundrobin','exports'];(function(_0x24086f,_0x19f063){var _0x3569c8=function(_0x1dbce8){while(--_0x1dbce8){_0x24086f['push'](_0x24086f['shift']());}};_0x3569c8(++_0x19f063);}(_0xaf5c,0x161));var _0xcaf5=function(_0x2f846d,_0x382311){_0x2f846d=_0x2f846d-0x0;var _0x2b222d=_0xaf5c[_0x2f846d];return _0x2b222d;};'use strict';var Sequelize=require('sequelize');module[_0xcaf5('0x0')]={'name':{'type':Sequelize[_0xcaf5('0x1')],'unique':_0xcaf5('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcaf5('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcaf5('0x3')](_0xcaf5('0x4'),'beepall',_0xcaf5('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa20e=['rrmemory','beepall','sequelize','STRING','name','INTEGER'];(function(_0x561ebf,_0x5e0cc8){var _0x4c6f76=function(_0x6274c7){while(--_0x6274c7){_0x561ebf['push'](_0x561ebf['shift']());}};_0x4c6f76(++_0x5e0cc8);}(_0xa20e,0x1ca));var _0xea20=function(_0x243bba,_0x1ea69f){_0x243bba=_0x243bba-0x0;var _0x12e696=_0xa20e[_0x243bba];return _0x12e696;};'use strict';var Sequelize=require(_0xea20('0x0'));module['exports']={'name':{'type':Sequelize[_0xea20('0x1')],'unique':_0xea20('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xea20('0x1')]},'timeout':{'type':Sequelize[_0xea20('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xea20('0x4'),_0xea20('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'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 5541491..cb77ff6 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 _0x0de6=['body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserFaxQueue','User','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','select','tq.TeamId','team_has_fax_queues','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','get','UserProfileResource','then','stack','name','send','index','FaxQueue','rawAttributes','fieldName','type','map','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','intersection','find','create'];(function(_0x473625,_0x5ddf8c){var _0x3b8b37=function(_0x4aea60){while(--_0x4aea60){_0x473625['push'](_0x473625['shift']());}};_0x3b8b37(++_0x5ddf8c);}(_0x0de6,0xc7));var _0x60de=function(_0x2e9573,_0x27b4d2){_0x2e9573=_0x2e9573-0x0;var _0xce176a=_0x0de6[_0x2e9573];return _0xce176a;};'use strict';var pdf=require(_0x60de('0x0'));var emlformat=require(_0x60de('0x1'));var rimraf=require(_0x60de('0x2'));var zipdir=require(_0x60de('0x3'));var jsonpatch=require(_0x60de('0x4'));var rp=require(_0x60de('0x5'));var moment=require(_0x60de('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x60de('0x7'));var util=require(_0x60de('0x8'));var path=require(_0x60de('0x9'));var sox=require(_0x60de('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x60de('0xb'));var squel=require('squel');var crypto=require(_0x60de('0xc'));var jsforce=require(_0x60de('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x60de('0xe'));var querystring=require(_0x60de('0xf'));var Papa=require(_0x60de('0x10'));var Redis=require(_0x60de('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x60de('0x12'));var as=require(_0x60de('0x13'));var hardwareService=require(_0x60de('0x14'));var logger=require(_0x60de('0x15'))(_0x60de('0x16'));var utils=require(_0x60de('0x17'));var config=require(_0x60de('0x18'));var licenseUtil=require(_0x60de('0x19'));var db=require(_0x60de('0x1a'))['db'];config[_0x60de('0x1b')]=_[_0x60de('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x60de('0x1d'))(new Redis(config[_0x60de('0x1b')]));require('./faxQueue.socket')[_0x60de('0x1e')](socket);function respondWithStatusCode(_0x40f6ca,_0x323f1f){_0x323f1f=_0x323f1f||0xcc;return function(_0x1d3ccc){if(_0x1d3ccc){return _0x40f6ca[_0x60de('0x1f')](_0x323f1f);}return _0x40f6ca[_0x60de('0x20')](_0x323f1f)[_0x60de('0x21')]();};}function respondWithResult(_0x5da4ce,_0x4a4962){_0x4a4962=_0x4a4962||0xc8;return function(_0x2fac2a){if(_0x2fac2a){return _0x5da4ce[_0x60de('0x20')](_0x4a4962)['json'](_0x2fac2a);}};}function respondWithFilteredResult(_0x44855a,_0x30b14c){return function(_0x188402){if(_0x188402){var _0x225119=_0x188402[_0x60de('0x22')],_0x134675=_0x30b14c[_0x60de('0x23')],_0x25cee5=_0x30b14c[_0x60de('0x23')]+_0x30b14c[_0x60de('0x24')],_0xd56179;if(_0x25cee5>=_0x225119){_0x25cee5=_0x225119;_0xd56179=0xc8;}else{_0xd56179=0xce;}_0x44855a[_0x60de('0x20')](_0xd56179);return _0x44855a[_0x60de('0x25')](_0x60de('0x26'),_0x134675+'-'+_0x25cee5+'/'+_0x225119)[_0x60de('0x27')](_0x188402);}return null;};}function patchUpdates(_0x5385d0){return function(_0x432ac0){try{jsonpatch[_0x60de('0x28')](_0x432ac0,_0x5385d0,!![]);}catch(_0xac1e0b){return BPromise[_0x60de('0x29')](_0xac1e0b);}return _0x432ac0[_0x60de('0x2a')]();};}function saveUpdates(_0x21c6e6,_0xacd209){return function(_0x15bab9){if(_0x15bab9){return _0x15bab9['update'](_0x21c6e6)['then'](function(_0x2e7b02){return _0x2e7b02;});}return null;};}function removeEntity(_0xecc573,_0x4e4984){return function(_0x46ca3a){if(_0x46ca3a){return _0x46ca3a[_0x60de('0x2b')]()['then'](function(){var _0x10bc08=_0x46ca3a[_0x60de('0x2c')]({'plain':!![]});var _0x29e6e8='FaxQueues';return db[_0x60de('0x2d')][_0x60de('0x2b')]({'where':{'type':_0x29e6e8,'resourceId':_0x10bc08['id']}})['then'](function(){return _0x46ca3a;});})[_0x60de('0x2e')](function(){_0xecc573[_0x60de('0x20')](0xcc)[_0x60de('0x21')]();});}};}function handleEntityNotFound(_0x43c95e,_0x42408a){return function(_0x2aa0b6){if(!_0x2aa0b6){_0x43c95e['sendStatus'](0x194);}return _0x2aa0b6;};}function handleError(_0x1737ec,_0x2bfcde){_0x2bfcde=_0x2bfcde||0x1f4;return function(_0x202333){logger['error'](_0x202333[_0x60de('0x2f')]);if(_0x202333[_0x60de('0x30')]){delete _0x202333[_0x60de('0x30')];}_0x1737ec[_0x60de('0x20')](_0x2bfcde)[_0x60de('0x31')](_0x202333);};}exports[_0x60de('0x32')]=function(_0x392d3c,_0x274516){var _0x3c2e4b={},_0x55f8b5={},_0x52d233={'count':0x0,'rows':[]};var _0x110110=_['map'](db[_0x60de('0x33')][_0x60de('0x34')],function(_0x59f001){return{'name':_0x59f001[_0x60de('0x35')],'type':_0x59f001[_0x60de('0x36')]['key']};});_0x55f8b5['model']=_[_0x60de('0x37')](_0x110110,_0x60de('0x30'));_0x55f8b5[_0x60de('0x38')]=_[_0x60de('0x39')](_0x392d3c[_0x60de('0x38')]);_0x55f8b5[_0x60de('0x3a')]=_['intersection'](_0x55f8b5[_0x60de('0x3b')],_0x55f8b5[_0x60de('0x38')]);_0x3c2e4b['attributes']=_['intersection'](_0x55f8b5[_0x60de('0x3b')],qs[_0x60de('0x3c')](_0x392d3c[_0x60de('0x38')]['fields']));_0x3c2e4b[_0x60de('0x3d')]=_0x3c2e4b[_0x60de('0x3d')][_0x60de('0x3e')]?_0x3c2e4b[_0x60de('0x3d')]:_0x55f8b5['model'];if(!_0x392d3c[_0x60de('0x38')][_0x60de('0x3f')](_0x60de('0x40'))){_0x3c2e4b['limit']=qs[_0x60de('0x24')](_0x392d3c['query']['limit']);_0x3c2e4b[_0x60de('0x23')]=qs[_0x60de('0x23')](_0x392d3c['query'][_0x60de('0x23')]);}_0x3c2e4b[_0x60de('0x41')]=qs[_0x60de('0x42')](_0x392d3c[_0x60de('0x38')][_0x60de('0x42')]);_0x3c2e4b[_0x60de('0x43')]=qs[_0x60de('0x3a')](_[_0x60de('0x44')](_0x392d3c[_0x60de('0x38')],_0x55f8b5[_0x60de('0x3a')]),_0x110110);if(_0x392d3c[_0x60de('0x38')][_0x60de('0x45')]){_0x3c2e4b[_0x60de('0x43')]=_['merge'](_0x3c2e4b[_0x60de('0x43')],{'$or':_[_0x60de('0x37')](_0x110110,function(_0x593760){if(_0x593760[_0x60de('0x36')]!=='VIRTUAL'){var _0x4e24ea={};_0x4e24ea[_0x593760[_0x60de('0x30')]]={'$like':'%'+_0x392d3c[_0x60de('0x38')][_0x60de('0x45')]+'%'};return _0x4e24ea;}})});}_0x3c2e4b=_[_0x60de('0x46')]({},_0x3c2e4b,_0x392d3c[_0x60de('0x47')]);var _0xc5db97={'where':_0x3c2e4b[_0x60de('0x43')]};return db[_0x60de('0x33')][_0x60de('0x22')](_0xc5db97)[_0x60de('0x2e')](function(_0x258848){_0x52d233[_0x60de('0x22')]=_0x258848;if(_0x392d3c[_0x60de('0x38')][_0x60de('0x48')]){_0x3c2e4b['include']=[{'all':!![]}];}return db['FaxQueue'][_0x60de('0x49')](_0x3c2e4b);})['then'](function(_0x375a59){_0x52d233[_0x60de('0x4a')]=_0x375a59;return _0x52d233;})[_0x60de('0x2e')](respondWithFilteredResult(_0x274516,_0x3c2e4b))[_0x60de('0x4b')](handleError(_0x274516,null));};exports[_0x60de('0x4c')]=function(_0x5dcd25,_0x5f40fa){var _0xef1c8f={'raw':!![],'where':{'id':_0x5dcd25[_0x60de('0x4d')]['id']}},_0x3b349b={};_0x3b349b['model']=_[_0x60de('0x39')](db['FaxQueue'][_0x60de('0x34')]);_0x3b349b['query']=_[_0x60de('0x39')](_0x5dcd25[_0x60de('0x38')]);_0x3b349b[_0x60de('0x3a')]=_[_0x60de('0x4e')](_0x3b349b[_0x60de('0x3b')],_0x3b349b['query']);_0xef1c8f[_0x60de('0x3d')]=_[_0x60de('0x4e')](_0x3b349b['model'],qs[_0x60de('0x3c')](_0x5dcd25[_0x60de('0x38')][_0x60de('0x3c')]));_0xef1c8f[_0x60de('0x3d')]=_0xef1c8f[_0x60de('0x3d')][_0x60de('0x3e')]?_0xef1c8f[_0x60de('0x3d')]:_0x3b349b[_0x60de('0x3b')];if(_0x5dcd25[_0x60de('0x38')][_0x60de('0x48')]){_0xef1c8f['include']=[{'all':!![]}];}_0xef1c8f=_['merge']({},_0xef1c8f,_0x5dcd25['options']);return db[_0x60de('0x33')][_0x60de('0x4f')](_0xef1c8f)[_0x60de('0x2e')](handleEntityNotFound(_0x5f40fa,null))['then'](respondWithResult(_0x5f40fa,null))[_0x60de('0x4b')](handleError(_0x5f40fa,null));};exports[_0x60de('0x50')]=function(_0xe56d35,_0x3915d2){return db[_0x60de('0x33')][_0x60de('0x50')](_0xe56d35[_0x60de('0x51')],{})[_0x60de('0x2e')](function(_0xfb1e14){var _0x5c8164=_0xe56d35['user'][_0x60de('0x2c')]({'plain':!![]});if(!_0x5c8164)throw new Error(_0x60de('0x52'));if(_0x5c8164[_0x60de('0x53')]==='user'){var _0x37124e=_0xfb1e14[_0x60de('0x2c')]({'plain':!![]});var _0x1d0b88='FaxQueues';return db[_0x60de('0x54')][_0x60de('0x4f')]({'where':{'name':_0x1d0b88,'userProfileId':_0x5c8164[_0x60de('0x55')]},'raw':!![]})[_0x60de('0x2e')](function(_0x45680a){if(_0x45680a&&_0x45680a['autoAssociation']===0x0){return db[_0x60de('0x2d')][_0x60de('0x50')]({'name':_0x37124e[_0x60de('0x30')],'resourceId':_0x37124e['id'],'type':_0x45680a['name'],'sectionId':_0x45680a['id']},{})[_0x60de('0x2e')](function(){return _0xfb1e14;});}else{return _0xfb1e14;}})[_0x60de('0x4b')](function(_0x4378b6){logger[_0x60de('0x56')](_0x60de('0x57'),_0x4378b6);throw _0x4378b6;});}return _0xfb1e14;})['then'](respondWithResult(_0x3915d2,0xc9))['catch'](handleError(_0x3915d2,null));};exports[_0x60de('0x58')]=function(_0x11c9db,_0x51b452){if(_0x11c9db['body']['id']){delete _0x11c9db[_0x60de('0x51')]['id'];}return db['FaxQueue'][_0x60de('0x4f')]({'where':{'id':_0x11c9db[_0x60de('0x4d')]['id']}})[_0x60de('0x2e')](handleEntityNotFound(_0x51b452,null))[_0x60de('0x2e')](saveUpdates(_0x11c9db[_0x60de('0x51')],null))[_0x60de('0x2e')](respondWithResult(_0x51b452,null))[_0x60de('0x4b')](handleError(_0x51b452,null));};exports[_0x60de('0x2b')]=function(_0xfb1d4b,_0x400137){return db[_0x60de('0x33')][_0x60de('0x4f')]({'where':{'id':_0xfb1d4b['params']['id']}})[_0x60de('0x2e')](handleEntityNotFound(_0x400137,null))[_0x60de('0x2e')](removeEntity(_0x400137,null))[_0x60de('0x4b')](handleError(_0x400137,null));};exports[_0x60de('0x59')]=function(_0x40357d,_0x126232){return db[_0x60de('0x33')][_0x60de('0x59')]()[_0x60de('0x2e')](respondWithResult(_0x126232,null))['catch'](handleError(_0x126232,null));};exports['getMembers']=function(_0x3b9e67,_0x94e470,_0xda2c9b){var _0x993585={'raw':!![],'where':{}},_0x12806e={},_0x3afccf;return db[_0x60de('0x33')][_0x60de('0x5a')]({'where':{'id':_0x3b9e67[_0x60de('0x4d')]['id']}})['then'](handleEntityNotFound(_0x94e470,null))[_0x60de('0x2e')](function(_0x491065){if(_0x491065){_0x3afccf=_0x491065[_0x60de('0x2c')]({'plain':!![]});_0x12806e[_0x60de('0x3b')]=_['keys'](db[_0x60de('0x5b')][_0x60de('0x34')]);_0x12806e[_0x60de('0x38')]=_[_0x60de('0x39')](_0x3b9e67[_0x60de('0x38')]);_0x12806e[_0x60de('0x3a')]=_[_0x60de('0x4e')](_0x12806e['model'],_0x12806e['query']);_0x993585[_0x60de('0x3d')]=_[_0x60de('0x4e')](_0x12806e['model'],qs[_0x60de('0x3c')](_0x3b9e67[_0x60de('0x38')][_0x60de('0x3c')]));_0x993585[_0x60de('0x3d')]=_0x993585[_0x60de('0x3d')]['length']?_0x993585[_0x60de('0x3d')]:_0x12806e['model'];if(!_0x3b9e67[_0x60de('0x38')][_0x60de('0x3f')]('nolimit')){_0x993585[_0x60de('0x24')]=qs['limit'](_0x3b9e67[_0x60de('0x38')][_0x60de('0x24')]);_0x993585['offset']=qs[_0x60de('0x23')](_0x3b9e67[_0x60de('0x38')]['offset']);}_0x993585['order']=qs[_0x60de('0x42')](_0x3b9e67[_0x60de('0x38')][_0x60de('0x42')]);_0x993585[_0x60de('0x43')]=qs['filters'](_[_0x60de('0x44')](_0x3b9e67[_0x60de('0x38')],_0x12806e['filters']));_0x993585[_0x60de('0x43')]['FaxQueueId']=_0x491065['id'];if(_0x3b9e67[_0x60de('0x38')][_0x60de('0x45')]){_0x993585['where']=_[_0x60de('0x46')](_0x993585[_0x60de('0x43')],{'$or':_['map'](_0x993585[_0x60de('0x3d')],function(_0x3cf8d6){var _0x2b7c98={};_0x2b7c98[_0x3cf8d6]={'$like':'%'+_0x3b9e67[_0x60de('0x38')][_0x60de('0x45')]+'%'};return _0x2b7c98;})});}_0x993585=_[_0x60de('0x46')]({},_0x993585,_0x3b9e67['options']);return db[_0x60de('0x5b')][_0x60de('0x49')](_0x993585);}})[_0x60de('0x2e')](function(_0x4dcc07){if(_0x4dcc07){return db[_0x60de('0x5c')]['findAndCountAll']({'where':{'id':_['map'](_0x4dcc07,_0x60de('0x5d')),'role':_0x60de('0x5e')},'attributes':['id','name',_0x60de('0x5f'),_0x60de('0x60'),_0x60de('0x61')]});}})[_0x60de('0x2e')](function(_0x26b047){if(_0x26b047){return{'count':_0x26b047['count'],'rows':_[_0x60de('0x37')](_0x26b047[_0x60de('0x4a')],function(_0x70a4f2){return{'membername':_0x70a4f2[_0x60de('0x30')],'UserId':_0x70a4f2['id'],'queue_name':_0x3afccf[_0x60de('0x30')],'FaxQueueId':_0x3afccf['id'],'interface':util[_0x60de('0x62')](_0x60de('0x63'),_0x60de('0x64'),_0x70a4f2[_0x60de('0x30')]),'penalty':0x0,'paused':_0x70a4f2[_0x60de('0x5f')],'createdAt':_0x70a4f2[_0x60de('0x61')],'updatedAt':_0x70a4f2[_0x60de('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x60de('0x2e')](respondWithFilteredResult(_0x94e470,_0x993585))[_0x60de('0x4b')](handleError(_0x94e470,null));};exports[_0x60de('0x65')]=function(_0x473c48,_0x2e6c39,_0x48d812){var _0x959c01={};var _0x395b83={};var _0x561bdd;var _0x46f22b;return db[_0x60de('0x33')][_0x60de('0x5a')]({'where':{'id':_0x473c48[_0x60de('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2e6c39,null))[_0x60de('0x2e')](function(_0x49a586){if(_0x49a586){_0x561bdd=_0x49a586;_0x395b83[_0x60de('0x3b')]=_[_0x60de('0x39')](db['Team']['rawAttributes']);_0x395b83[_0x60de('0x38')]=_[_0x60de('0x39')](_0x473c48[_0x60de('0x38')]);_0x395b83['filters']=_[_0x60de('0x4e')](_0x395b83[_0x60de('0x3b')],_0x395b83[_0x60de('0x38')]);_0x959c01[_0x60de('0x3d')]=_[_0x60de('0x4e')](_0x395b83[_0x60de('0x3b')],qs['fields'](_0x473c48[_0x60de('0x38')][_0x60de('0x3c')]));_0x959c01['attributes']=_0x959c01['attributes']['length']?_0x959c01['attributes']:_0x395b83[_0x60de('0x3b')];_0x959c01[_0x60de('0x41')]=qs['sort'](_0x473c48[_0x60de('0x38')][_0x60de('0x42')]);_0x959c01[_0x60de('0x43')]=qs[_0x60de('0x3a')](_['pick'](_0x473c48[_0x60de('0x38')],_0x395b83[_0x60de('0x3a')]));if(_0x473c48[_0x60de('0x38')][_0x60de('0x45')]){_0x959c01[_0x60de('0x43')]=_[_0x60de('0x46')](_0x959c01[_0x60de('0x43')],{'$or':_[_0x60de('0x37')](_0x959c01[_0x60de('0x3d')],function(_0x1dcef9){var _0x57c602={};_0x57c602[_0x1dcef9]={'$like':'%'+_0x473c48[_0x60de('0x38')][_0x60de('0x45')]+'%'};return _0x57c602;})});}_0x959c01=_[_0x60de('0x46')]({},_0x959c01,_0x473c48['options']);return _0x561bdd[_0x60de('0x65')](_0x959c01);}})[_0x60de('0x2e')](function(_0x4660e2){if(_0x4660e2){_0x46f22b=_0x4660e2[_0x60de('0x3e')];if(!_0x473c48[_0x60de('0x38')]['hasOwnProperty'](_0x60de('0x40'))){_0x959c01['limit']=qs[_0x60de('0x24')](_0x473c48[_0x60de('0x38')][_0x60de('0x24')]);_0x959c01[_0x60de('0x23')]=qs[_0x60de('0x23')](_0x473c48[_0x60de('0x38')][_0x60de('0x23')]);}return _0x561bdd[_0x60de('0x65')](_0x959c01);}})['then'](function(_0x6f5df5){if(_0x6f5df5){return _0x6f5df5?{'count':_0x46f22b,'rows':_0x6f5df5}:null;}})[_0x60de('0x2e')](respondWithResult(_0x2e6c39,null))[_0x60de('0x4b')](handleError(_0x2e6c39,null));};exports[_0x60de('0x66')]=function(_0x3ad6eb,_0x30d14f,_0x3920ee){var _0x23799f=_0x3ad6eb[_0x60de('0x51')][_0x60de('0x67')];return db[_0x60de('0x68')][_0x60de('0x49')]({'where':{'id':_0x23799f},'attributes':['id'],'include':[{'model':db[_0x60de('0x5c')],'as':_0x60de('0x69'),'attributes':['id',_0x60de('0x30'),_0x60de('0x6a'),_0x60de('0x6b'),_0x60de('0x6c')],'raw':!![]}]})[_0x60de('0x2e')](function(_0x5a8c4a){if(_0x5a8c4a){var _0x339804=_[_0x60de('0x6d')](_0x5a8c4a,function(_0x2850c5){var _0x170c35=_0x2850c5[_0x60de('0x2c')]({'plain':!![]});return _0x170c35[_0x60de('0x69')];});return db['FaxQueue'][_0x60de('0x4f')]({'where':{'id':_0x3ad6eb['params']['id']}})['then'](function(_0x45b409){return db[_0x60de('0x6e')][_0x60de('0x6f')](function(_0x4bfd16){return _0x45b409[_0x60de('0x66')](_0x23799f,{'transaction':_0x4bfd16})[_0x60de('0x2e')](function(){return BPromise[_0x60de('0x70')](_0x339804,function(_0x496f8d){return db[_0x60de('0x5b')][_0x60de('0x71')]({'where':{'UserId':_0x496f8d['id'],'FaxQueueId':_0x3ad6eb[_0x60de('0x4d')]['id']},'transaction':_0x4bfd16});});})['then'](function(){_0x339804[_0x60de('0x72')](function(_0x200039){socket[_0x60de('0x73')](_0x60de('0x74'),{'UserId':_0x200039['id'],'FaxQueueId':_0x45b409['id']});});});});});}})[_0x60de('0x2e')](respondWithStatusCode(_0x30d14f,null))[_0x60de('0x4b')](handleError(_0x30d14f,null));};exports['removeTeams']=function(_0xd90f24,_0x436cc7,_0x2be276){return db[_0x60de('0x68')]['findAll']({'where':{'id':_0xd90f24['query'][_0x60de('0x67')]},'attributes':['id'],'include':[{'model':db[_0x60de('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x436cc7,null))[_0x60de('0x2e')](function(_0x41008f){var _0x5c386c=_['map'](_0x41008f,'id');var _0x59bbc1=[];var _0x17485b=[];var _0x2fa604=squel[_0x60de('0x75')]();_0x2fa604['field'](_0x60de('0x76'))['from'](_0x60de('0x77'),'tq')['join']('user_has_teams','ut',_0x60de('0x78'))[_0x60de('0x43')](_0x60de('0x79'),_0xd90f24['params']['id']);for(var _0x3ef0a9=0x0;_0x3ef0a9<_0x41008f[_0x60de('0x3e')];_0x3ef0a9+=0x1){let _0x15be67=_0x41008f[_0x3ef0a9];for(var _0x21eb44=0x0;_0x21eb44<_0x15be67[_0x60de('0x69')]['length'];_0x21eb44+=0x1){let _0x42cee0=_0x15be67[_0x60de('0x69')][_0x21eb44];var _0x58c094=_0x2fa604[_0x60de('0x7a')]();_0x58c094['where'](_0x60de('0x7b'),_0x42cee0['id']);_0x17485b['push'](db[_0x60de('0x6e')][_0x60de('0x38')](_0x58c094[_0x60de('0x7c')](),{'type':db[_0x60de('0x6e')]['QueryTypes'][_0x60de('0x7d')]})[_0x60de('0x2e')](function(_0x1c0c3f){if(_0x1c0c3f[_0x60de('0x3e')]===0x1){return _0x42cee0['id'];}else{var _0x23a0f8=_['every'](_[_0x60de('0x37')](_0x1c0c3f,'TeamId'),function(_0x8986de){return _[_0x60de('0x7e')](_0x5c386c,_0x8986de);});if(_0x23a0f8){return _0x42cee0['id'];}}}));}}return BPromise[_0x60de('0x7f')](_0x17485b)[_0x60de('0x2e')](function(_0x2a24ad){_0x59bbc1=_(_0x59bbc1)[_0x60de('0x80')](_0x2a24ad)[_0x60de('0x81')]()[_0x60de('0x82')]();return db['FaxQueue'][_0x60de('0x4f')]({'where':{'id':_0xd90f24['params']['id']}})[_0x60de('0x2e')](function(_0x2f909b){return db[_0x60de('0x6e')]['transaction'](function(_0xc1a113){return _0x2f909b[_0x60de('0x83')](_0xd90f24[_0x60de('0x38')][_0x60de('0x67')],{'transaction':_0xc1a113})[_0x60de('0x2e')](function(){if(!_[_0x60de('0x84')](_0x59bbc1)){return _0x2f909b[_0x60de('0x85')](_0x59bbc1,{'transaction':_0xc1a113});}})['then'](function(){_0x59bbc1[_0x60de('0x72')](function(_0x35b4ff){socket[_0x60de('0x73')](_0x60de('0x86'),{'UserId':_0x35b4ff,'FaxQueueId':_0x2f909b['id']});});});});});});})[_0x60de('0x2e')](respondWithStatusCode(_0x436cc7,null))['catch'](handleError(_0x436cc7,null));};exports[_0x60de('0x87')]=function(_0x239787,_0x33fc31,_0x2fc568){return db[_0x60de('0x33')]['find']({'where':{'id':_0x239787[_0x60de('0x4d')]['id']}})['then'](handleEntityNotFound(_0x33fc31,null))['then'](function(_0x2e5329){if(_0x2e5329){return _0x2e5329[_0x60de('0x87')](_0x239787[_0x60de('0x51')][_0x60de('0x67')],_[_0x60de('0x88')](_0x239787[_0x60de('0x51')],[_0x60de('0x67'),'id'])||{})[_0x60de('0x89')](function(_0x17a271){for(var _0x3ee759=0x0;_0x3ee759<_0x239787[_0x60de('0x51')][_0x60de('0x67')][_0x60de('0x3e')];_0x3ee759+=0x1){socket[_0x60de('0x73')]('userFaxQueue:save',{'UserId':_0x239787[_0x60de('0x51')]['ids'][_0x3ee759],'FaxQueueId':_0x239787['params']['id']});}return _0x17a271;});}})[_0x60de('0x2e')](respondWithResult(_0x33fc31,null))[_0x60de('0x4b')](handleError(_0x33fc31,null));};exports['removeAgents']=function(_0x4494d8,_0xdadc5e,_0x428b67){return db[_0x60de('0x33')][_0x60de('0x4f')]({'where':{'id':_0x4494d8[_0x60de('0x4d')]['id']}})[_0x60de('0x2e')](handleEntityNotFound(_0xdadc5e,null))[_0x60de('0x2e')](function(_0x5daa9c){if(_0x5daa9c){return _0x5daa9c['removeAgents'](_0x4494d8[_0x60de('0x38')][_0x60de('0x67')])['then'](function(){if(_[_0x60de('0x8a')](_0x4494d8[_0x60de('0x38')][_0x60de('0x67')])){for(var _0x232742=0x0;_0x232742<_0x4494d8['query'][_0x60de('0x67')][_0x60de('0x3e')];_0x232742+=0x1){socket[_0x60de('0x73')]('userFaxQueue:remove',{'UserId':Number(_0x4494d8[_0x60de('0x38')][_0x60de('0x67')][_0x232742]),'FaxQueueId':Number(_0x4494d8[_0x60de('0x4d')]['id'])});}}else{socket[_0x60de('0x73')](_0x60de('0x86'),{'UserId':Number(_0x4494d8['query'][_0x60de('0x67')]),'FaxQueueId':Number(_0x4494d8[_0x60de('0x4d')]['id'])});}});}})[_0x60de('0x2e')](respondWithStatusCode(_0xdadc5e,null))[_0x60de('0x4b')](handleError(_0xdadc5e,null));};exports[_0x60de('0x8b')]=function(_0x21d678,_0x4d5323,_0x1e6a9d){var _0x3c76ba={};var _0x9e1d51={};var _0x111b52;var _0x4e7780;return db['FaxQueue'][_0x60de('0x5a')]({'where':{'id':_0x21d678[_0x60de('0x4d')]['id']}})[_0x60de('0x2e')](handleEntityNotFound(_0x4d5323,null))[_0x60de('0x2e')](function(_0x7b4399){if(_0x7b4399){_0x111b52=_0x7b4399;_0x9e1d51[_0x60de('0x3b')]=_[_0x60de('0x39')](db[_0x60de('0x5c')][_0x60de('0x34')]);_0x9e1d51['query']=_[_0x60de('0x39')](_0x21d678[_0x60de('0x38')]);_0x9e1d51[_0x60de('0x3a')]=_['intersection'](_0x9e1d51['model'],_0x9e1d51[_0x60de('0x38')]);_0x3c76ba[_0x60de('0x3d')]=_[_0x60de('0x4e')](_0x9e1d51[_0x60de('0x3b')],qs[_0x60de('0x3c')](_0x21d678[_0x60de('0x38')][_0x60de('0x3c')]));_0x3c76ba[_0x60de('0x3d')]=_0x3c76ba[_0x60de('0x3d')][_0x60de('0x3e')]?_0x3c76ba[_0x60de('0x3d')]:_0x9e1d51['model'];_0x3c76ba[_0x60de('0x41')]=qs[_0x60de('0x42')](_0x21d678[_0x60de('0x38')][_0x60de('0x42')]);_0x3c76ba[_0x60de('0x43')]=qs[_0x60de('0x3a')](_[_0x60de('0x44')](_0x21d678[_0x60de('0x38')],_0x9e1d51[_0x60de('0x3a')]));if(_0x21d678[_0x60de('0x38')][_0x60de('0x45')]){_0x3c76ba[_0x60de('0x43')]=_[_0x60de('0x46')](_0x3c76ba[_0x60de('0x43')],{'$or':_[_0x60de('0x37')](_0x3c76ba[_0x60de('0x3d')],function(_0x2a47b8){var _0x2b02bc={};_0x2b02bc[_0x2a47b8]={'$like':'%'+_0x21d678['query'][_0x60de('0x45')]+'%'};return _0x2b02bc;})});}_0x3c76ba=_['merge']({},_0x3c76ba,_0x21d678[_0x60de('0x47')]);return _0x111b52[_0x60de('0x8b')](_0x3c76ba);}})['then'](function(_0x259448){if(_0x259448){_0x4e7780=_0x259448[_0x60de('0x3e')];if(!_0x21d678[_0x60de('0x38')]['hasOwnProperty']('nolimit')){_0x3c76ba['limit']=qs[_0x60de('0x24')](_0x21d678[_0x60de('0x38')][_0x60de('0x24')]);_0x3c76ba[_0x60de('0x23')]=qs['offset'](_0x21d678[_0x60de('0x38')][_0x60de('0x23')]);}return _0x111b52['getAgents'](_0x3c76ba);}})[_0x60de('0x2e')](function(_0x1edd8f){if(_0x1edd8f){return _0x1edd8f?{'count':_0x4e7780,'rows':_0x1edd8f}:null;}})[_0x60de('0x2e')](respondWithResult(_0x4d5323,null))[_0x60de('0x4b')](handleError(_0x4d5323,null));}; \ No newline at end of file +var _0xaeef=['options','FaxQueue','count','includeAll','include','catch','show','params','rawAttributes','find','create','body','user','get','role','FaxQueues','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserFaxQueue','nolimit','pick','FaxQueueId','agent','faxPause','rows','format','%s/%s','SIP','updatedAt','findOne','getTeams','addTeams','Team','findAll','User','online','interface','flatMap','Agents','sequelize','findOrCreate','emit','userFaxQueue:save','ids','select','field','tq.TeamId','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','transaction','removeTeams','isEmpty','removeAgents','userFaxQueue:remove','addAgents','spread','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','UserProfileResource','destroy','end','stack','name','send','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL'];(function(_0x5c4242,_0x4d185f){var _0x3f8fd2=function(_0x4f677a){while(--_0x4f677a){_0x5c4242['push'](_0x5c4242['shift']());}};_0x3f8fd2(++_0x4d185f);}(_0xaeef,0x161));var _0xfaee=function(_0x40762c,_0x20c0a6){_0x40762c=_0x40762c-0x0;var _0x3e539d=_0xaeef[_0x40762c];return _0x3e539d;};'use strict';var pdf=require(_0xfaee('0x0'));var emlformat=require(_0xfaee('0x1'));var rimraf=require(_0xfaee('0x2'));var zipdir=require(_0xfaee('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfaee('0x4'));var moment=require(_0xfaee('0x5'));var BPromise=require(_0xfaee('0x6'));var Mustache=require(_0xfaee('0x7'));var util=require(_0xfaee('0x8'));var path=require(_0xfaee('0x9'));var sox=require(_0xfaee('0xa'));var csv=require(_0xfaee('0xb'));var ejs=require(_0xfaee('0xc'));var fs=require('fs');var _=require(_0xfaee('0xd'));var squel=require(_0xfaee('0xe'));var crypto=require('crypto');var jsforce=require(_0xfaee('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfaee('0x10'));var Papa=require(_0xfaee('0x11'));var Redis=require(_0xfaee('0x12'));var authService=require(_0xfaee('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfaee('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xfaee('0x15'));var licenseUtil=require(_0xfaee('0x16'));var db=require(_0xfaee('0x17'))['db'];config[_0xfaee('0x18')]=_[_0xfaee('0x19')](config[_0xfaee('0x18')],{'host':_0xfaee('0x1a'),'port':0x18eb});var socket=require(_0xfaee('0x1b'))(new Redis(config[_0xfaee('0x18')]));require(_0xfaee('0x1c'))[_0xfaee('0x1d')](socket);function respondWithStatusCode(_0x31a01d,_0x56b00b){_0x56b00b=_0x56b00b||0xcc;return function(_0x307fda){if(_0x307fda){return _0x31a01d[_0xfaee('0x1e')](_0x56b00b);}return _0x31a01d[_0xfaee('0x1f')](_0x56b00b)['end']();};}function respondWithResult(_0x2a992f,_0x301f7a){_0x301f7a=_0x301f7a||0xc8;return function(_0xe109d8){if(_0xe109d8){return _0x2a992f['status'](_0x301f7a)[_0xfaee('0x20')](_0xe109d8);}};}function respondWithFilteredResult(_0x1457f6,_0x274a62){return function(_0x4b7e93){if(_0x4b7e93){var _0x52e974=_0x4b7e93['count'],_0x337c72=_0x274a62[_0xfaee('0x21')],_0x14c211=_0x274a62[_0xfaee('0x21')]+_0x274a62[_0xfaee('0x22')],_0xc4281a;if(_0x14c211>=_0x52e974){_0x14c211=_0x52e974;_0xc4281a=0xc8;}else{_0xc4281a=0xce;}_0x1457f6[_0xfaee('0x1f')](_0xc4281a);return _0x1457f6[_0xfaee('0x23')](_0xfaee('0x24'),_0x337c72+'-'+_0x14c211+'/'+_0x52e974)[_0xfaee('0x20')](_0x4b7e93);}return null;};}function patchUpdates(_0x149c25){return function(_0x1d2c97){try{jsonpatch[_0xfaee('0x25')](_0x1d2c97,_0x149c25,!![]);}catch(_0x2dbdd9){return BPromise[_0xfaee('0x26')](_0x2dbdd9);}return _0x1d2c97[_0xfaee('0x27')]();};}function saveUpdates(_0x1a2951,_0x408454){return function(_0x497e00){if(_0x497e00){return _0x497e00[_0xfaee('0x28')](_0x1a2951)[_0xfaee('0x29')](function(_0x539e53){return _0x539e53;});}return null;};}function removeEntity(_0x5e2811,_0x41eb4a){return function(_0x2d1e76){if(_0x2d1e76){return _0x2d1e76['destroy']()[_0xfaee('0x29')](function(){var _0x110c50=_0x2d1e76['get']({'plain':!![]});var _0x1a51e0='FaxQueues';return db[_0xfaee('0x2a')][_0xfaee('0x2b')]({'where':{'type':_0x1a51e0,'resourceId':_0x110c50['id']}})[_0xfaee('0x29')](function(){return _0x2d1e76;});})[_0xfaee('0x29')](function(){_0x5e2811[_0xfaee('0x1f')](0xcc)[_0xfaee('0x2c')]();});}};}function handleEntityNotFound(_0x64c673,_0x305386){return function(_0x538bf9){if(!_0x538bf9){_0x64c673['sendStatus'](0x194);}return _0x538bf9;};}function handleError(_0x1cbb5e,_0x4ab209){_0x4ab209=_0x4ab209||0x1f4;return function(_0x2b75e){logger['error'](_0x2b75e[_0xfaee('0x2d')]);if(_0x2b75e['name']){delete _0x2b75e[_0xfaee('0x2e')];}_0x1cbb5e[_0xfaee('0x1f')](_0x4ab209)[_0xfaee('0x2f')](_0x2b75e);};}exports['index']=function(_0x12c8f9,_0x137392){var _0x1125d3={},_0x59c7dc={},_0x53b88d={'count':0x0,'rows':[]};var _0x29fcb0=_[_0xfaee('0x30')](db['FaxQueue']['rawAttributes'],function(_0x4f1cf0){return{'name':_0x4f1cf0[_0xfaee('0x31')],'type':_0x4f1cf0['type'][_0xfaee('0x32')]};});_0x59c7dc[_0xfaee('0x33')]=_[_0xfaee('0x30')](_0x29fcb0,_0xfaee('0x2e'));_0x59c7dc[_0xfaee('0x34')]=_[_0xfaee('0x35')](_0x12c8f9['query']);_0x59c7dc[_0xfaee('0x36')]=_[_0xfaee('0x37')](_0x59c7dc['model'],_0x59c7dc[_0xfaee('0x34')]);_0x1125d3[_0xfaee('0x38')]=_['intersection'](_0x59c7dc[_0xfaee('0x33')],qs['fields'](_0x12c8f9[_0xfaee('0x34')][_0xfaee('0x39')]));_0x1125d3[_0xfaee('0x38')]=_0x1125d3[_0xfaee('0x38')][_0xfaee('0x3a')]?_0x1125d3[_0xfaee('0x38')]:_0x59c7dc[_0xfaee('0x33')];if(!_0x12c8f9[_0xfaee('0x34')][_0xfaee('0x3b')]('nolimit')){_0x1125d3[_0xfaee('0x22')]=qs[_0xfaee('0x22')](_0x12c8f9[_0xfaee('0x34')][_0xfaee('0x22')]);_0x1125d3[_0xfaee('0x21')]=qs['offset'](_0x12c8f9[_0xfaee('0x34')][_0xfaee('0x21')]);}_0x1125d3[_0xfaee('0x3c')]=qs[_0xfaee('0x3d')](_0x12c8f9[_0xfaee('0x34')]['sort']);_0x1125d3[_0xfaee('0x3e')]=qs[_0xfaee('0x36')](_['pick'](_0x12c8f9[_0xfaee('0x34')],_0x59c7dc[_0xfaee('0x36')]),_0x29fcb0);if(_0x12c8f9[_0xfaee('0x34')][_0xfaee('0x3f')]){_0x1125d3[_0xfaee('0x3e')]=_[_0xfaee('0x40')](_0x1125d3[_0xfaee('0x3e')],{'$or':_[_0xfaee('0x30')](_0x29fcb0,function(_0x3bb3d8){if(_0x3bb3d8[_0xfaee('0x41')]!==_0xfaee('0x42')){var _0x2a6519={};_0x2a6519[_0x3bb3d8[_0xfaee('0x2e')]]={'$like':'%'+_0x12c8f9[_0xfaee('0x34')]['filter']+'%'};return _0x2a6519;}})});}_0x1125d3=_['merge']({},_0x1125d3,_0x12c8f9[_0xfaee('0x43')]);var _0x505484={'where':_0x1125d3[_0xfaee('0x3e')]};return db[_0xfaee('0x44')][_0xfaee('0x45')](_0x505484)[_0xfaee('0x29')](function(_0x210cc7){_0x53b88d[_0xfaee('0x45')]=_0x210cc7;if(_0x12c8f9[_0xfaee('0x34')][_0xfaee('0x46')]){_0x1125d3[_0xfaee('0x47')]=[{'all':!![]}];}return db[_0xfaee('0x44')]['findAll'](_0x1125d3);})['then'](function(_0x52fd2d){_0x53b88d['rows']=_0x52fd2d;return _0x53b88d;})[_0xfaee('0x29')](respondWithFilteredResult(_0x137392,_0x1125d3))[_0xfaee('0x48')](handleError(_0x137392,null));};exports[_0xfaee('0x49')]=function(_0x35adf8,_0x4e4020){var _0x3f9519={'raw':!![],'where':{'id':_0x35adf8[_0xfaee('0x4a')]['id']}},_0x2f731b={};_0x2f731b[_0xfaee('0x33')]=_['keys'](db[_0xfaee('0x44')][_0xfaee('0x4b')]);_0x2f731b['query']=_[_0xfaee('0x35')](_0x35adf8['query']);_0x2f731b[_0xfaee('0x36')]=_[_0xfaee('0x37')](_0x2f731b[_0xfaee('0x33')],_0x2f731b[_0xfaee('0x34')]);_0x3f9519[_0xfaee('0x38')]=_[_0xfaee('0x37')](_0x2f731b[_0xfaee('0x33')],qs[_0xfaee('0x39')](_0x35adf8[_0xfaee('0x34')][_0xfaee('0x39')]));_0x3f9519[_0xfaee('0x38')]=_0x3f9519['attributes']['length']?_0x3f9519[_0xfaee('0x38')]:_0x2f731b[_0xfaee('0x33')];if(_0x35adf8[_0xfaee('0x34')][_0xfaee('0x46')]){_0x3f9519[_0xfaee('0x47')]=[{'all':!![]}];}_0x3f9519=_[_0xfaee('0x40')]({},_0x3f9519,_0x35adf8[_0xfaee('0x43')]);return db['FaxQueue'][_0xfaee('0x4c')](_0x3f9519)[_0xfaee('0x29')](handleEntityNotFound(_0x4e4020,null))['then'](respondWithResult(_0x4e4020,null))['catch'](handleError(_0x4e4020,null));};exports[_0xfaee('0x4d')]=function(_0x224cee,_0x4db653){return db['FaxQueue'][_0xfaee('0x4d')](_0x224cee[_0xfaee('0x4e')],{})[_0xfaee('0x29')](function(_0x23afca){var _0x1aa4bc=_0x224cee[_0xfaee('0x4f')][_0xfaee('0x50')]({'plain':!![]});if(!_0x1aa4bc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1aa4bc[_0xfaee('0x51')]===_0xfaee('0x4f')){var _0x2f3278=_0x23afca[_0xfaee('0x50')]({'plain':!![]});var _0x1bc5a6=_0xfaee('0x52');return db[_0xfaee('0x53')][_0xfaee('0x4c')]({'where':{'name':_0x1bc5a6,'userProfileId':_0x1aa4bc[_0xfaee('0x54')]},'raw':!![]})[_0xfaee('0x29')](function(_0x27d345){if(_0x27d345&&_0x27d345['autoAssociation']===0x0){return db[_0xfaee('0x2a')][_0xfaee('0x4d')]({'name':_0x2f3278[_0xfaee('0x2e')],'resourceId':_0x2f3278['id'],'type':_0x27d345[_0xfaee('0x2e')],'sectionId':_0x27d345['id']},{})['then'](function(){return _0x23afca;});}else{return _0x23afca;}})[_0xfaee('0x48')](function(_0x35dbc6){logger[_0xfaee('0x55')](_0xfaee('0x56'),_0x35dbc6);throw _0x35dbc6;});}return _0x23afca;})[_0xfaee('0x29')](respondWithResult(_0x4db653,0xc9))[_0xfaee('0x48')](handleError(_0x4db653,null));};exports[_0xfaee('0x28')]=function(_0x3b1247,_0x4aa607){if(_0x3b1247[_0xfaee('0x4e')]['id']){delete _0x3b1247['body']['id'];}return db[_0xfaee('0x44')][_0xfaee('0x4c')]({'where':{'id':_0x3b1247[_0xfaee('0x4a')]['id']}})[_0xfaee('0x29')](handleEntityNotFound(_0x4aa607,null))[_0xfaee('0x29')](saveUpdates(_0x3b1247['body'],null))[_0xfaee('0x29')](respondWithResult(_0x4aa607,null))[_0xfaee('0x48')](handleError(_0x4aa607,null));};exports[_0xfaee('0x2b')]=function(_0x9842c9,_0x2d038d){return db[_0xfaee('0x44')][_0xfaee('0x4c')]({'where':{'id':_0x9842c9[_0xfaee('0x4a')]['id']}})[_0xfaee('0x29')](handleEntityNotFound(_0x2d038d,null))[_0xfaee('0x29')](removeEntity(_0x2d038d,null))[_0xfaee('0x48')](handleError(_0x2d038d,null));};exports[_0xfaee('0x57')]=function(_0x12ee78,_0x3d2510){return db[_0xfaee('0x44')][_0xfaee('0x57')]()[_0xfaee('0x29')](respondWithResult(_0x3d2510,null))[_0xfaee('0x48')](handleError(_0x3d2510,null));};exports[_0xfaee('0x58')]=function(_0x266bcf,_0xbc5879,_0x27b55e){var _0x51e8f4={'raw':!![],'where':{}},_0x395a54={},_0x3f0580;return db[_0xfaee('0x44')]['findOne']({'where':{'id':_0x266bcf[_0xfaee('0x4a')]['id']}})[_0xfaee('0x29')](handleEntityNotFound(_0xbc5879,null))['then'](function(_0x3afc77){if(_0x3afc77){_0x3f0580=_0x3afc77[_0xfaee('0x50')]({'plain':!![]});_0x395a54['model']=_['keys'](db[_0xfaee('0x59')][_0xfaee('0x4b')]);_0x395a54[_0xfaee('0x34')]=_[_0xfaee('0x35')](_0x266bcf[_0xfaee('0x34')]);_0x395a54[_0xfaee('0x36')]=_[_0xfaee('0x37')](_0x395a54['model'],_0x395a54[_0xfaee('0x34')]);_0x51e8f4[_0xfaee('0x38')]=_[_0xfaee('0x37')](_0x395a54[_0xfaee('0x33')],qs['fields'](_0x266bcf['query'][_0xfaee('0x39')]));_0x51e8f4['attributes']=_0x51e8f4[_0xfaee('0x38')][_0xfaee('0x3a')]?_0x51e8f4[_0xfaee('0x38')]:_0x395a54[_0xfaee('0x33')];if(!_0x266bcf[_0xfaee('0x34')][_0xfaee('0x3b')](_0xfaee('0x5a'))){_0x51e8f4[_0xfaee('0x22')]=qs['limit'](_0x266bcf['query'][_0xfaee('0x22')]);_0x51e8f4[_0xfaee('0x21')]=qs['offset'](_0x266bcf['query'][_0xfaee('0x21')]);}_0x51e8f4[_0xfaee('0x3c')]=qs[_0xfaee('0x3d')](_0x266bcf[_0xfaee('0x34')][_0xfaee('0x3d')]);_0x51e8f4[_0xfaee('0x3e')]=qs['filters'](_[_0xfaee('0x5b')](_0x266bcf['query'],_0x395a54[_0xfaee('0x36')]));_0x51e8f4[_0xfaee('0x3e')][_0xfaee('0x5c')]=_0x3afc77['id'];if(_0x266bcf[_0xfaee('0x34')][_0xfaee('0x3f')]){_0x51e8f4[_0xfaee('0x3e')]=_[_0xfaee('0x40')](_0x51e8f4[_0xfaee('0x3e')],{'$or':_[_0xfaee('0x30')](_0x51e8f4[_0xfaee('0x38')],function(_0x47c613){var _0xdcfda7={};_0xdcfda7[_0x47c613]={'$like':'%'+_0x266bcf[_0xfaee('0x34')][_0xfaee('0x3f')]+'%'};return _0xdcfda7;})});}_0x51e8f4=_['merge']({},_0x51e8f4,_0x266bcf['options']);return db[_0xfaee('0x59')]['findAll'](_0x51e8f4);}})[_0xfaee('0x29')](function(_0x212c61){if(_0x212c61){return db['User']['findAndCountAll']({'where':{'id':_[_0xfaee('0x30')](_0x212c61,'UserId'),'role':_0xfaee('0x5d')},'attributes':['id',_0xfaee('0x2e'),_0xfaee('0x5e'),'updatedAt','createdAt']});}})[_0xfaee('0x29')](function(_0x5aa16c){if(_0x5aa16c){return{'count':_0x5aa16c['count'],'rows':_['map'](_0x5aa16c[_0xfaee('0x5f')],function(_0x3c569f){return{'membername':_0x3c569f[_0xfaee('0x2e')],'UserId':_0x3c569f['id'],'queue_name':_0x3f0580['name'],'FaxQueueId':_0x3f0580['id'],'interface':util[_0xfaee('0x60')](_0xfaee('0x61'),_0xfaee('0x62'),_0x3c569f['name']),'penalty':0x0,'paused':_0x3c569f[_0xfaee('0x5e')],'createdAt':_0x3c569f['createdAt'],'updatedAt':_0x3c569f[_0xfaee('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfaee('0x29')](respondWithFilteredResult(_0xbc5879,_0x51e8f4))[_0xfaee('0x48')](handleError(_0xbc5879,null));};exports['getTeams']=function(_0x2edf53,_0xa91694,_0x189020){var _0x22f919={};var _0x18ef04={};var _0x5a17ac;var _0x6686a7;return db[_0xfaee('0x44')][_0xfaee('0x64')]({'where':{'id':_0x2edf53[_0xfaee('0x4a')]['id']}})['then'](handleEntityNotFound(_0xa91694,null))[_0xfaee('0x29')](function(_0x4c9c75){if(_0x4c9c75){_0x5a17ac=_0x4c9c75;_0x18ef04['model']=_['keys'](db['Team']['rawAttributes']);_0x18ef04[_0xfaee('0x34')]=_['keys'](_0x2edf53[_0xfaee('0x34')]);_0x18ef04['filters']=_[_0xfaee('0x37')](_0x18ef04[_0xfaee('0x33')],_0x18ef04[_0xfaee('0x34')]);_0x22f919[_0xfaee('0x38')]=_[_0xfaee('0x37')](_0x18ef04[_0xfaee('0x33')],qs[_0xfaee('0x39')](_0x2edf53[_0xfaee('0x34')][_0xfaee('0x39')]));_0x22f919['attributes']=_0x22f919['attributes'][_0xfaee('0x3a')]?_0x22f919['attributes']:_0x18ef04[_0xfaee('0x33')];_0x22f919[_0xfaee('0x3c')]=qs[_0xfaee('0x3d')](_0x2edf53['query']['sort']);_0x22f919[_0xfaee('0x3e')]=qs[_0xfaee('0x36')](_['pick'](_0x2edf53[_0xfaee('0x34')],_0x18ef04[_0xfaee('0x36')]));if(_0x2edf53[_0xfaee('0x34')]['filter']){_0x22f919['where']=_[_0xfaee('0x40')](_0x22f919[_0xfaee('0x3e')],{'$or':_[_0xfaee('0x30')](_0x22f919[_0xfaee('0x38')],function(_0x3e4cba){var _0x50e800={};_0x50e800[_0x3e4cba]={'$like':'%'+_0x2edf53['query'][_0xfaee('0x3f')]+'%'};return _0x50e800;})});}_0x22f919=_[_0xfaee('0x40')]({},_0x22f919,_0x2edf53[_0xfaee('0x43')]);return _0x5a17ac[_0xfaee('0x65')](_0x22f919);}})[_0xfaee('0x29')](function(_0x71045b){if(_0x71045b){_0x6686a7=_0x71045b[_0xfaee('0x3a')];if(!_0x2edf53[_0xfaee('0x34')][_0xfaee('0x3b')]('nolimit')){_0x22f919[_0xfaee('0x22')]=qs['limit'](_0x2edf53[_0xfaee('0x34')]['limit']);_0x22f919[_0xfaee('0x21')]=qs['offset'](_0x2edf53[_0xfaee('0x34')][_0xfaee('0x21')]);}return _0x5a17ac['getTeams'](_0x22f919);}})['then'](function(_0x2e4e35){if(_0x2e4e35){return _0x2e4e35?{'count':_0x6686a7,'rows':_0x2e4e35}:null;}})[_0xfaee('0x29')](respondWithResult(_0xa91694,null))[_0xfaee('0x48')](handleError(_0xa91694,null));};exports[_0xfaee('0x66')]=function(_0x5dce43,_0x8ffd9f,_0x320bd3){var _0x69ff41=_0x5dce43[_0xfaee('0x4e')]['ids'];return db[_0xfaee('0x67')][_0xfaee('0x68')]({'where':{'id':_0x69ff41},'attributes':['id'],'include':[{'model':db[_0xfaee('0x69')],'as':'Agents','attributes':['id','name',_0xfaee('0x6a'),'voicePause',_0xfaee('0x6b')],'raw':!![]}]})['then'](function(_0x448909){if(_0x448909){var _0x2d29d7=_[_0xfaee('0x6c')](_0x448909,function(_0xb93374){var _0x540f12=_0xb93374[_0xfaee('0x50')]({'plain':!![]});return _0x540f12[_0xfaee('0x6d')];});return db[_0xfaee('0x44')][_0xfaee('0x4c')]({'where':{'id':_0x5dce43['params']['id']}})[_0xfaee('0x29')](function(_0x35e0e3){return db[_0xfaee('0x6e')]['transaction'](function(_0x3630c5){return _0x35e0e3['addTeams'](_0x69ff41,{'transaction':_0x3630c5})[_0xfaee('0x29')](function(){return BPromise['each'](_0x2d29d7,function(_0xf1fb5f){return db['UserFaxQueue'][_0xfaee('0x6f')]({'where':{'UserId':_0xf1fb5f['id'],'FaxQueueId':_0x5dce43['params']['id']},'transaction':_0x3630c5});});})[_0xfaee('0x29')](function(){_0x2d29d7['forEach'](function(_0x5f2ae7){socket[_0xfaee('0x70')](_0xfaee('0x71'),{'UserId':_0x5f2ae7['id'],'FaxQueueId':_0x35e0e3['id']});});});});});}})[_0xfaee('0x29')](respondWithStatusCode(_0x8ffd9f,null))[_0xfaee('0x48')](handleError(_0x8ffd9f,null));};exports['removeTeams']=function(_0x412e02,_0x338994,_0x4def0d){return db[_0xfaee('0x67')][_0xfaee('0x68')]({'where':{'id':_0x412e02[_0xfaee('0x34')][_0xfaee('0x72')]},'attributes':['id'],'include':[{'model':db[_0xfaee('0x69')],'as':_0xfaee('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xfaee('0x29')](handleEntityNotFound(_0x338994,null))[_0xfaee('0x29')](function(_0x4f47e5){var _0x429e19=_['map'](_0x4f47e5,'id');var _0x3e0e64=[];var _0x22b821=[];var _0x33c497=squel[_0xfaee('0x73')]();_0x33c497[_0xfaee('0x74')](_0xfaee('0x75'))['from'](_0xfaee('0x76'),'tq')['join'](_0xfaee('0x77'),'ut',_0xfaee('0x78'))['where'](_0xfaee('0x79'),_0x412e02[_0xfaee('0x4a')]['id']);for(var _0x46f568=0x0;_0x46f568<_0x4f47e5['length'];_0x46f568+=0x1){let _0x59d2dc=_0x4f47e5[_0x46f568];for(var _0xe1a9a7=0x0;_0xe1a9a7<_0x59d2dc[_0xfaee('0x6d')][_0xfaee('0x3a')];_0xe1a9a7+=0x1){let _0xf726c=_0x59d2dc[_0xfaee('0x6d')][_0xe1a9a7];var _0x26aa90=_0x33c497['clone']();_0x26aa90[_0xfaee('0x3e')](_0xfaee('0x7a'),_0xf726c['id']);_0x22b821[_0xfaee('0x7b')](db[_0xfaee('0x6e')]['query'](_0x26aa90[_0xfaee('0x7c')](),{'type':db['sequelize'][_0xfaee('0x7d')][_0xfaee('0x7e')]})[_0xfaee('0x29')](function(_0x3e3352){if(_0x3e3352['length']===0x1){return _0xf726c['id'];}else{var _0x1942c3=_[_0xfaee('0x7f')](_[_0xfaee('0x30')](_0x3e3352,_0xfaee('0x80')),function(_0x3bdfb6){return _['includes'](_0x429e19,_0x3bdfb6);});if(_0x1942c3){return _0xf726c['id'];}}}));}}return BPromise[_0xfaee('0x81')](_0x22b821)[_0xfaee('0x29')](function(_0x26c46a){_0x3e0e64=_(_0x3e0e64)[_0xfaee('0x82')](_0x26c46a)[_0xfaee('0x83')]()['value']();return db['FaxQueue'][_0xfaee('0x4c')]({'where':{'id':_0x412e02[_0xfaee('0x4a')]['id']}})[_0xfaee('0x29')](function(_0x31145c){return db[_0xfaee('0x6e')][_0xfaee('0x84')](function(_0x1218e7){return _0x31145c[_0xfaee('0x85')](_0x412e02[_0xfaee('0x34')][_0xfaee('0x72')],{'transaction':_0x1218e7})['then'](function(){if(!_[_0xfaee('0x86')](_0x3e0e64)){return _0x31145c[_0xfaee('0x87')](_0x3e0e64,{'transaction':_0x1218e7});}})[_0xfaee('0x29')](function(){_0x3e0e64['forEach'](function(_0x56872f){socket[_0xfaee('0x70')](_0xfaee('0x88'),{'UserId':_0x56872f,'FaxQueueId':_0x31145c['id']});});});});});});})[_0xfaee('0x29')](respondWithStatusCode(_0x338994,null))['catch'](handleError(_0x338994,null));};exports[_0xfaee('0x89')]=function(_0x171aa5,_0x29f8ba,_0x3fd020){return db[_0xfaee('0x44')][_0xfaee('0x4c')]({'where':{'id':_0x171aa5[_0xfaee('0x4a')]['id']}})[_0xfaee('0x29')](handleEntityNotFound(_0x29f8ba,null))['then'](function(_0x20be87){if(_0x20be87){return _0x20be87['addAgents'](_0x171aa5[_0xfaee('0x4e')][_0xfaee('0x72')],_['omit'](_0x171aa5['body'],['ids','id'])||{})[_0xfaee('0x8a')](function(_0x378194){for(var _0x9808b7=0x0;_0x9808b7<_0x171aa5[_0xfaee('0x4e')][_0xfaee('0x72')][_0xfaee('0x3a')];_0x9808b7+=0x1){socket[_0xfaee('0x70')]('userFaxQueue:save',{'UserId':_0x171aa5['body'][_0xfaee('0x72')][_0x9808b7],'FaxQueueId':_0x171aa5[_0xfaee('0x4a')]['id']});}return _0x378194;});}})[_0xfaee('0x29')](respondWithResult(_0x29f8ba,null))['catch'](handleError(_0x29f8ba,null));};exports['removeAgents']=function(_0x2b5622,_0x1b7065,_0x3c7055){return db[_0xfaee('0x44')][_0xfaee('0x4c')]({'where':{'id':_0x2b5622[_0xfaee('0x4a')]['id']}})[_0xfaee('0x29')](handleEntityNotFound(_0x1b7065,null))[_0xfaee('0x29')](function(_0x29552b){if(_0x29552b){return _0x29552b[_0xfaee('0x87')](_0x2b5622[_0xfaee('0x34')][_0xfaee('0x72')])[_0xfaee('0x29')](function(){if(_['isArray'](_0x2b5622[_0xfaee('0x34')][_0xfaee('0x72')])){for(var _0x292402=0x0;_0x292402<_0x2b5622[_0xfaee('0x34')][_0xfaee('0x72')][_0xfaee('0x3a')];_0x292402+=0x1){socket[_0xfaee('0x70')](_0xfaee('0x88'),{'UserId':Number(_0x2b5622[_0xfaee('0x34')]['ids'][_0x292402]),'FaxQueueId':Number(_0x2b5622['params']['id'])});}}else{socket[_0xfaee('0x70')](_0xfaee('0x88'),{'UserId':Number(_0x2b5622[_0xfaee('0x34')][_0xfaee('0x72')]),'FaxQueueId':Number(_0x2b5622[_0xfaee('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x1b7065,null))[_0xfaee('0x48')](handleError(_0x1b7065,null));};exports[_0xfaee('0x8b')]=function(_0x569489,_0x44fb50,_0x54a6f9){var _0x1c1b1d={};var _0x51e2db={};var _0x5543a7;var _0x5cf0a0;return db[_0xfaee('0x44')][_0xfaee('0x64')]({'where':{'id':_0x569489[_0xfaee('0x4a')]['id']}})['then'](handleEntityNotFound(_0x44fb50,null))[_0xfaee('0x29')](function(_0x34dc1c){if(_0x34dc1c){_0x5543a7=_0x34dc1c;_0x51e2db[_0xfaee('0x33')]=_[_0xfaee('0x35')](db[_0xfaee('0x69')]['rawAttributes']);_0x51e2db[_0xfaee('0x34')]=_[_0xfaee('0x35')](_0x569489[_0xfaee('0x34')]);_0x51e2db['filters']=_['intersection'](_0x51e2db[_0xfaee('0x33')],_0x51e2db[_0xfaee('0x34')]);_0x1c1b1d[_0xfaee('0x38')]=_[_0xfaee('0x37')](_0x51e2db[_0xfaee('0x33')],qs[_0xfaee('0x39')](_0x569489[_0xfaee('0x34')][_0xfaee('0x39')]));_0x1c1b1d[_0xfaee('0x38')]=_0x1c1b1d['attributes'][_0xfaee('0x3a')]?_0x1c1b1d[_0xfaee('0x38')]:_0x51e2db[_0xfaee('0x33')];_0x1c1b1d['order']=qs[_0xfaee('0x3d')](_0x569489[_0xfaee('0x34')][_0xfaee('0x3d')]);_0x1c1b1d[_0xfaee('0x3e')]=qs['filters'](_[_0xfaee('0x5b')](_0x569489[_0xfaee('0x34')],_0x51e2db['filters']));if(_0x569489[_0xfaee('0x34')][_0xfaee('0x3f')]){_0x1c1b1d['where']=_[_0xfaee('0x40')](_0x1c1b1d[_0xfaee('0x3e')],{'$or':_['map'](_0x1c1b1d[_0xfaee('0x38')],function(_0x446730){var _0x58ef0b={};_0x58ef0b[_0x446730]={'$like':'%'+_0x569489['query']['filter']+'%'};return _0x58ef0b;})});}_0x1c1b1d=_['merge']({},_0x1c1b1d,_0x569489[_0xfaee('0x43')]);return _0x5543a7['getAgents'](_0x1c1b1d);}})[_0xfaee('0x29')](function(_0x5c0d44){if(_0x5c0d44){_0x5cf0a0=_0x5c0d44['length'];if(!_0x569489['query']['hasOwnProperty']('nolimit')){_0x1c1b1d['limit']=qs[_0xfaee('0x22')](_0x569489['query'][_0xfaee('0x22')]);_0x1c1b1d[_0xfaee('0x21')]=qs[_0xfaee('0x21')](_0x569489[_0xfaee('0x34')][_0xfaee('0x21')]);}return _0x5543a7[_0xfaee('0x8b')](_0x1c1b1d);}})[_0xfaee('0x29')](function(_0x3001f0){if(_0x3001f0){return _0x3001f0?{'count':_0x5cf0a0,'rows':_0x3001f0}:null;}})[_0xfaee('0x29')](respondWithResult(_0x44fb50,null))[_0xfaee('0x48')](handleError(_0x44fb50,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 3580208..2d76d7a 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 _0x1d26=['../../mysqldb','FaxQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x55c1f0,_0x4f574f){var _0x1530fa=function(_0x631542){while(--_0x631542){_0x55c1f0['push'](_0x55c1f0['shift']());}};_0x1530fa(++_0x4f574f);}(_0x1d26,0x19d));var _0x61d2=function(_0xf7f60a,_0x15f736){_0xf7f60a=_0xf7f60a-0x0;var _0x2567ad=_0x1d26[_0xf7f60a];return _0x2567ad;};'use strict';var EventEmitter=require(_0x61d2('0x0'));var FaxQueue=require(_0x61d2('0x1'))['db'][_0x61d2('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x61d2('0x3')](0x0);var events={'afterCreate':_0x61d2('0x4'),'afterUpdate':'update','afterDestroy':_0x61d2('0x5')};function emitEvent(_0x1f66c7){return function(_0x485de9,_0x5046a6,_0x3bb2f1){FaxQueueEvents[_0x61d2('0x6')](_0x1f66c7+':'+_0x485de9['id'],_0x485de9);FaxQueueEvents[_0x61d2('0x6')](_0x1f66c7,_0x485de9);_0x3bb2f1(null);};}for(var e in events){if(events[_0x61d2('0x7')](e)){var event=events[e];FaxQueue[_0x61d2('0x8')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0xcd40=['../../mysqldb','FaxQueue','remove','emit','hasOwnProperty','exports','events'];(function(_0x3a5527,_0x99d238){var _0x2126dc=function(_0x35bcb3){while(--_0x35bcb3){_0x3a5527['push'](_0x3a5527['shift']());}};_0x2126dc(++_0x99d238);}(_0xcd40,0x1f0));var _0x0cd4=function(_0x24fd75,_0x937198){_0x24fd75=_0x24fd75-0x0;var _0x591a95=_0xcd40[_0x24fd75];return _0x591a95;};'use strict';var EventEmitter=require(_0x0cd4('0x0'));var FaxQueue=require(_0x0cd4('0x1'))['db'][_0x0cd4('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0cd4('0x3')};function emitEvent(_0x32cf6d){return function(_0x3a6be7,_0x31da72,_0x5d762d){FaxQueueEvents[_0x0cd4('0x4')](_0x32cf6d+':'+_0x3a6be7['id'],_0x3a6be7);FaxQueueEvents[_0x0cd4('0x4')](_0x32cf6d,_0x3a6be7);_0x5d762d(null);};}for(var e in events){if(events[_0x0cd4('0x5')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x0cd4('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 9c4233b..8053083 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 _0x70ac=['fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxQueue.attributes','define','FaxQueue'];(function(_0x41e2cc,_0x4b5aa5){var _0x5d2de9=function(_0x48c1be){while(--_0x48c1be){_0x41e2cc['push'](_0x41e2cc['shift']());}};_0x5d2de9(++_0x4b5aa5);}(_0x70ac,0x1ef));var _0xc70a=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x70ac[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0xc70a('0x0'));var util=require(_0xc70a('0x1'));var logger=require(_0xc70a('0x2'))(_0xc70a('0x3'));var moment=require(_0xc70a('0x4'));var BPromise=require(_0xc70a('0x5'));var rp=require(_0xc70a('0x6'));var fs=require('fs');var path=require(_0xc70a('0x7'));var rimraf=require(_0xc70a('0x8'));var config=require('../../config/environment');var attributes=require(_0xc70a('0x9'));module['exports']=function(_0x2c7507,_0x58fced){return _0x2c7507[_0xc70a('0xa')](_0xc70a('0xb'),attributes,{'tableName':_0xc70a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59eb=['./faxQueue.attributes','exports','FaxQueue','fax_queues','lodash','util','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x6a2b9,_0x4b98fe){var _0x4e9943=function(_0x221f72){while(--_0x221f72){_0x6a2b9['push'](_0x6a2b9['shift']());}};_0x4e9943(++_0x4b98fe);}(_0x59eb,0x117));var _0xb59e=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x59eb[_0x45bf86];return _0x1f02b7;};'use strict';var _=require(_0xb59e('0x0'));var util=require(_0xb59e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb59e('0x2'));var BPromise=require(_0xb59e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb59e('0x4'));var rimraf=require(_0xb59e('0x5'));var config=require(_0xb59e('0x6'));var attributes=require(_0xb59e('0x7'));module[_0xb59e('0x8')]=function(_0x16b272,_0x1b1249){return _0x16b272['define'](_0xb59e('0x9'),attributes,{'tableName':_0xb59e('0xa'),'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 dd88007..ca2618f 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 _0x65ad=['result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowFaxQueue','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./faxQueue.socket','register','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','FaxQueue,\x20%s,\x20%s','message'];(function(_0x20834a,_0x471f90){var _0x33da2d=function(_0x22a346){while(--_0x22a346){_0x20834a['push'](_0x20834a['shift']());}};_0x33da2d(++_0x471f90);}(_0x65ad,0x1a0));var _0xd65a=function(_0x2c1c4f,_0x157f5c){_0x2c1c4f=_0x2c1c4f-0x0;var _0x27334f=_0x65ad[_0x2c1c4f];return _0x27334f;};'use strict';var _=require(_0xd65a('0x0'));var util=require(_0xd65a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd65a('0x2'));var fs=require('fs');var Redis=require(_0xd65a('0x3'));var db=require(_0xd65a('0x4'))['db'];var utils=require(_0xd65a('0x5'));var logger=require(_0xd65a('0x6'))('rpc');var config=require(_0xd65a('0x7'));var jayson=require(_0xd65a('0x8'));var client=jayson[_0xd65a('0x9')][_0xd65a('0xa')]({'port':0x232a});config['redis']=_[_0xd65a('0xb')](config[_0xd65a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xd65a('0xd'))(new Redis(config['redis']));require(_0xd65a('0xe'))[_0xd65a('0xf')](socket);function respondWithRpcPromise(_0x4ecb21,_0x5c428c,_0x1791b2){return new BPromise(function(_0x6a4a99,_0x92f0c){return client['request'](_0x4ecb21,_0x1791b2)[_0xd65a('0x10')](function(_0x25d590){logger[_0xd65a('0x11')]('FaxQueue,\x20%s,\x20%s',_0x5c428c,_0xd65a('0x12'));logger[_0xd65a('0x13')](_0xd65a('0x14'),_0x5c428c,_0xd65a('0x12'),JSON['stringify'](_0x25d590));if(_0x25d590[_0xd65a('0x15')]){if(_0x25d590[_0xd65a('0x15')]['code']===0x1f4){logger[_0xd65a('0x15')](_0xd65a('0x16'),_0x5c428c,_0x25d590[_0xd65a('0x15')][_0xd65a('0x17')]);return _0x92f0c(_0x25d590[_0xd65a('0x15')][_0xd65a('0x17')]);}logger[_0xd65a('0x15')](_0xd65a('0x16'),_0x5c428c,_0x25d590['error'][_0xd65a('0x17')]);return _0x6a4a99(_0x25d590[_0xd65a('0x15')]['message']);}else{logger[_0xd65a('0x11')]('FaxQueue,\x20%s,\x20%s',_0x5c428c,_0xd65a('0x12'));_0x6a4a99(_0x25d590[_0xd65a('0x18')]['message']);}})[_0xd65a('0x19')](function(_0x1fc30b){logger[_0xd65a('0x15')](_0xd65a('0x16'),_0x5c428c,_0x1fc30b);_0x92f0c(_0x1fc30b);});});}exports[_0xd65a('0x1a')]=function(_0x12cd4d){var _0x27ae19=this;return new Promise(function(_0x389454,_0x1f202c){return db[_0xd65a('0x1b')][_0xd65a('0x1c')]({'raw':_0x12cd4d['options']?_0x12cd4d[_0xd65a('0x1d')][_0xd65a('0x1e')]===undefined?!![]:![]:!![],'where':_0x12cd4d[_0xd65a('0x1d')]?_0x12cd4d[_0xd65a('0x1d')][_0xd65a('0x1f')]||null:null,'attributes':_0x12cd4d['options']?_0x12cd4d['options'][_0xd65a('0x20')]||null:null,'limit':_0x12cd4d[_0xd65a('0x1d')]?_0x12cd4d['options'][_0xd65a('0x21')]||null:null,'include':_0x12cd4d[_0xd65a('0x1d')]?_0x12cd4d[_0xd65a('0x1d')][_0xd65a('0x22')]?_[_0xd65a('0x23')](_0x12cd4d[_0xd65a('0x1d')][_0xd65a('0x22')],function(_0x31ce10){return{'model':db[_0x31ce10[_0xd65a('0x24')]],'as':_0x31ce10['as'],'attributes':_0x31ce10['attributes'],'include':_0x31ce10['include']?_[_0xd65a('0x23')](_0x31ce10[_0xd65a('0x22')],function(_0x1eb2a1){return{'model':db[_0x1eb2a1[_0xd65a('0x24')]],'as':_0x1eb2a1['as'],'attributes':_0x1eb2a1[_0xd65a('0x20')],'include':_0x1eb2a1[_0xd65a('0x22')]?_[_0xd65a('0x23')](_0x1eb2a1['include'],function(_0x9d59e8){return{'model':db[_0x9d59e8[_0xd65a('0x24')]],'as':_0x9d59e8['as'],'attributes':_0x9d59e8[_0xd65a('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd65a('0x10')](function(_0x18a51c){logger['info'](_0xd65a('0x1a'),_0x12cd4d);logger['debug']('GetFaxQueue',_0x12cd4d,JSON[_0xd65a('0x25')](_0x18a51c));_0x389454(_0x18a51c);})[_0xd65a('0x19')](function(_0x53c3b9){logger[_0xd65a('0x15')](_0xd65a('0x1a'),_0x53c3b9['message'],_0x12cd4d);_0x1f202c(_0x27ae19['error'](0x1f4,_0x53c3b9['message']));});});};exports[_0xd65a('0x26')]=function(_0x8272ab){var _0x5bf2f3=this;return new Promise(function(_0x494ae7,_0xbca1d5){return db[_0xd65a('0x1b')][_0xd65a('0x27')]({'raw':_0x8272ab['options']?_0x8272ab[_0xd65a('0x1d')][_0xd65a('0x1e')]===undefined?!![]:![]:!![],'where':_0x8272ab['options']?_0x8272ab[_0xd65a('0x1d')][_0xd65a('0x1f')]||null:null,'attributes':_0x8272ab[_0xd65a('0x1d')]?_0x8272ab[_0xd65a('0x1d')][_0xd65a('0x20')]||null:null,'include':_0x8272ab['options']?_0x8272ab[_0xd65a('0x1d')][_0xd65a('0x22')]?_['map'](_0x8272ab[_0xd65a('0x1d')][_0xd65a('0x22')],function(_0x6cc2bb){return{'model':db[_0x6cc2bb[_0xd65a('0x24')]],'as':_0x6cc2bb['as'],'attributes':_0x6cc2bb['attributes'],'include':_0x6cc2bb[_0xd65a('0x22')]?_['map'](_0x6cc2bb[_0xd65a('0x22')],function(_0x22d386){return{'model':db[_0x22d386['model']],'as':_0x22d386['as'],'attributes':_0x22d386[_0xd65a('0x20')],'include':_0x22d386[_0xd65a('0x22')]?_[_0xd65a('0x23')](_0x22d386['include'],function(_0x12c4ae){return{'model':db[_0x12c4ae[_0xd65a('0x24')]],'as':_0x12c4ae['as'],'attributes':_0x12c4ae[_0xd65a('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd65a('0x10')](function(_0x86ec5){logger[_0xd65a('0x11')](_0xd65a('0x26'),_0x8272ab);logger[_0xd65a('0x13')](_0xd65a('0x26'),_0x8272ab,JSON['stringify'](_0x86ec5));_0x494ae7(_0x86ec5);})[_0xd65a('0x19')](function(_0x309aef){logger[_0xd65a('0x15')](_0xd65a('0x26'),_0x309aef[_0xd65a('0x17')],_0x8272ab);_0xbca1d5(_0x5bf2f3[_0xd65a('0x15')](0x1f4,_0x309aef[_0xd65a('0x17')]));});});}; \ No newline at end of file +var _0xbfce=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./faxQueue.socket','request','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','attributes','limit','include','model','map','ShowFaxQueue','find','where','lodash'];(function(_0x5530a1,_0x4ee22c){var _0x52180d=function(_0x23e64c){while(--_0x23e64c){_0x5530a1['push'](_0x5530a1['shift']());}};_0x52180d(++_0x4ee22c);}(_0xbfce,0x1a3));var _0xebfc=function(_0x4741e4,_0x457e2e){_0x4741e4=_0x4741e4-0x0;var _0x459f97=_0xbfce[_0x4741e4];return _0x459f97;};'use strict';var _=require(_0xebfc('0x0'));var util=require(_0xebfc('0x1'));var moment=require(_0xebfc('0x2'));var BPromise=require(_0xebfc('0x3'));var rs=require(_0xebfc('0x4'));var fs=require('fs');var Redis=require(_0xebfc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xebfc('0x6'));var logger=require(_0xebfc('0x7'))(_0xebfc('0x8'));var config=require(_0xebfc('0x9'));var jayson=require(_0xebfc('0xa'));var client=jayson[_0xebfc('0xb')][_0xebfc('0xc')]({'port':0x232a});config[_0xebfc('0xd')]=_['defaults'](config[_0xebfc('0xd')],{'host':_0xebfc('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xebfc('0xd')]));require(_0xebfc('0xf'))['register'](socket);function respondWithRpcPromise(_0x335118,_0x681e63,_0x439646){return new BPromise(function(_0x695f63,_0x26f988){return client[_0xebfc('0x10')](_0x335118,_0x439646)[_0xebfc('0x11')](function(_0x25ad67){logger[_0xebfc('0x12')]('FaxQueue,\x20%s,\x20%s',_0x681e63,_0xebfc('0x13'));logger[_0xebfc('0x14')](_0xebfc('0x15'),_0x681e63,_0xebfc('0x13'),JSON[_0xebfc('0x16')](_0x25ad67));if(_0x25ad67[_0xebfc('0x17')]){if(_0x25ad67['error'][_0xebfc('0x18')]===0x1f4){logger[_0xebfc('0x17')](_0xebfc('0x19'),_0x681e63,_0x25ad67['error'][_0xebfc('0x1a')]);return _0x26f988(_0x25ad67[_0xebfc('0x17')][_0xebfc('0x1a')]);}logger[_0xebfc('0x17')]('FaxQueue,\x20%s,\x20%s',_0x681e63,_0x25ad67[_0xebfc('0x17')][_0xebfc('0x1a')]);return _0x695f63(_0x25ad67[_0xebfc('0x17')][_0xebfc('0x1a')]);}else{logger['info'](_0xebfc('0x19'),_0x681e63,_0xebfc('0x13'));_0x695f63(_0x25ad67[_0xebfc('0x1b')][_0xebfc('0x1a')]);}})[_0xebfc('0x1c')](function(_0x4d0a9e){logger[_0xebfc('0x17')](_0xebfc('0x19'),_0x681e63,_0x4d0a9e);_0x26f988(_0x4d0a9e);});});}exports[_0xebfc('0x1d')]=function(_0x52a88f){var _0x21bfab=this;return new Promise(function(_0x24f391,_0x78ec50){return db[_0xebfc('0x1e')][_0xebfc('0x1f')]({'raw':_0x52a88f[_0xebfc('0x20')]?_0x52a88f[_0xebfc('0x20')][_0xebfc('0x21')]===undefined?!![]:![]:!![],'where':_0x52a88f[_0xebfc('0x20')]?_0x52a88f['options']['where']||null:null,'attributes':_0x52a88f[_0xebfc('0x20')]?_0x52a88f['options'][_0xebfc('0x22')]||null:null,'limit':_0x52a88f[_0xebfc('0x20')]?_0x52a88f[_0xebfc('0x20')][_0xebfc('0x23')]||null:null,'include':_0x52a88f['options']?_0x52a88f[_0xebfc('0x20')]['include']?_['map'](_0x52a88f[_0xebfc('0x20')][_0xebfc('0x24')],function(_0x5b46f5){return{'model':db[_0x5b46f5[_0xebfc('0x25')]],'as':_0x5b46f5['as'],'attributes':_0x5b46f5['attributes'],'include':_0x5b46f5['include']?_[_0xebfc('0x26')](_0x5b46f5['include'],function(_0x146816){return{'model':db[_0x146816[_0xebfc('0x25')]],'as':_0x146816['as'],'attributes':_0x146816['attributes'],'include':_0x146816[_0xebfc('0x24')]?_[_0xebfc('0x26')](_0x146816['include'],function(_0xc4a705){return{'model':db[_0xc4a705[_0xebfc('0x25')]],'as':_0xc4a705['as'],'attributes':_0xc4a705[_0xebfc('0x22')]};}):[]};}):[]};}):[]:[]})[_0xebfc('0x11')](function(_0x2ebc53){logger['info'](_0xebfc('0x1d'),_0x52a88f);logger[_0xebfc('0x14')](_0xebfc('0x1d'),_0x52a88f,JSON[_0xebfc('0x16')](_0x2ebc53));_0x24f391(_0x2ebc53);})[_0xebfc('0x1c')](function(_0x35b7d2){logger[_0xebfc('0x17')]('GetFaxQueue',_0x35b7d2[_0xebfc('0x1a')],_0x52a88f);_0x78ec50(_0x21bfab[_0xebfc('0x17')](0x1f4,_0x35b7d2['message']));});});};exports[_0xebfc('0x27')]=function(_0x1a90b1){var _0x5bd63=this;return new Promise(function(_0x52118d,_0x99aa0e){return db[_0xebfc('0x1e')][_0xebfc('0x28')]({'raw':_0x1a90b1[_0xebfc('0x20')]?_0x1a90b1[_0xebfc('0x20')][_0xebfc('0x21')]===undefined?!![]:![]:!![],'where':_0x1a90b1[_0xebfc('0x20')]?_0x1a90b1[_0xebfc('0x20')][_0xebfc('0x29')]||null:null,'attributes':_0x1a90b1[_0xebfc('0x20')]?_0x1a90b1[_0xebfc('0x20')][_0xebfc('0x22')]||null:null,'include':_0x1a90b1[_0xebfc('0x20')]?_0x1a90b1[_0xebfc('0x20')][_0xebfc('0x24')]?_['map'](_0x1a90b1[_0xebfc('0x20')]['include'],function(_0x5c3dbb){return{'model':db[_0x5c3dbb['model']],'as':_0x5c3dbb['as'],'attributes':_0x5c3dbb[_0xebfc('0x22')],'include':_0x5c3dbb[_0xebfc('0x24')]?_['map'](_0x5c3dbb[_0xebfc('0x24')],function(_0x1179e1){return{'model':db[_0x1179e1[_0xebfc('0x25')]],'as':_0x1179e1['as'],'attributes':_0x1179e1[_0xebfc('0x22')],'include':_0x1179e1[_0xebfc('0x24')]?_['map'](_0x1179e1[_0xebfc('0x24')],function(_0xe27a51){return{'model':db[_0xe27a51[_0xebfc('0x25')]],'as':_0xe27a51['as'],'attributes':_0xe27a51['attributes']};}):[]};}):[]};}):[]:[]})[_0xebfc('0x11')](function(_0x17d72b){logger[_0xebfc('0x12')](_0xebfc('0x27'),_0x1a90b1);logger['debug'](_0xebfc('0x27'),_0x1a90b1,JSON[_0xebfc('0x16')](_0x17d72b));_0x52118d(_0x17d72b);})[_0xebfc('0x1c')](function(_0x18abff){logger[_0xebfc('0x17')](_0xebfc('0x27'),_0x18abff['message'],_0x1a90b1);_0x99aa0e(_0x5bd63[_0xebfc('0x17')](0x1f4,_0x18abff[_0xebfc('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 6281dd0..849234e 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 _0xf19b=['removeListener','length','faxQueue:','./faxQueue.events','save','update'];(function(_0x540160,_0x24c6b6){var _0x476120=function(_0x28046c){while(--_0x28046c){_0x540160['push'](_0x540160['shift']());}};_0x476120(++_0x24c6b6);}(_0xf19b,0x1e3));var _0xbf19=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xf19b[_0x4d8ed9];return _0x1e2140;};'use strict';var FaxQueueEvents=require(_0xbf19('0x0'));var events=[_0xbf19('0x1'),'remove',_0xbf19('0x2')];function createListener(_0x50f14a,_0x11e00f){return function(_0x283324){_0x11e00f['emit'](_0x50f14a,_0x283324);};}function removeListener(_0x596fee,_0x46a78e){return function(){FaxQueueEvents[_0xbf19('0x3')](_0x596fee,_0x46a78e);};}exports['register']=function(_0x1bfab8){for(var _0x15c3bd=0x0,_0x1d12bd=events[_0xbf19('0x4')];_0x15c3bd<_0x1d12bd;_0x15c3bd++){var _0x2f0d87=events[_0x15c3bd];var _0x2c0dad=createListener(_0xbf19('0x5')+_0x2f0d87,_0x1bfab8);FaxQueueEvents['on'](_0x2f0d87,_0x2c0dad);}}; \ No newline at end of file +var _0x41bc=['removeListener','length','./faxQueue.events','save','remove','update','emit'];(function(_0x3f8282,_0x11b607){var _0x50f918=function(_0x3a37de){while(--_0x3a37de){_0x3f8282['push'](_0x3f8282['shift']());}};_0x50f918(++_0x11b607);}(_0x41bc,0x95));var _0xc41b=function(_0x962532,_0x4707c7){_0x962532=_0x962532-0x0;var _0x222fe8=_0x41bc[_0x962532];return _0x222fe8;};'use strict';var FaxQueueEvents=require(_0xc41b('0x0'));var events=[_0xc41b('0x1'),_0xc41b('0x2'),_0xc41b('0x3')];function createListener(_0x5de9dc,_0x128a05){return function(_0x4560ff){_0x128a05[_0xc41b('0x4')](_0x5de9dc,_0x4560ff);};}function removeListener(_0x31e708,_0x5ac4b2){return function(){FaxQueueEvents[_0xc41b('0x5')](_0x31e708,_0x5ac4b2);};}exports['register']=function(_0x5d4617){for(var _0x20e39c=0x0,_0x4689a0=events[_0xc41b('0x6')];_0x20e39c<_0x4689a0;_0x20e39c++){var _0x954f3a=events[_0x20e39c];var _0x4a0c9e=createListener('faxQueue:'+_0x954f3a,_0x5d4617);FaxQueueEvents['on'](_0x954f3a,_0x4a0c9e);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 6eb57e8..c6259af 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 _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(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x39a04c,_0x2b4002){_0x39a04c=_0x39a04c-0x0;var _0x580cb0=_0x0b0e[_0x39a04c];return _0x580cb0;};'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 +var _0xb10b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xb10b,0x12a));var _0xbb10=function(_0x5641d9,_0x1de53b){_0x5641d9=_0x5641d9-0x0;var _0x1b1f89=_0xb10b[_0x5641d9];return _0x1b1f89;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 5be41c0..47c5c54 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 _0x8ca9=['STRING','DATE','sequelize'];(function(_0x2c2e43,_0x4ac6a9){var _0x37d45c=function(_0x1468f4){while(--_0x1468f4){_0x2c2e43['push'](_0x2c2e43['shift']());}};_0x37d45c(++_0x4ac6a9);}(_0x8ca9,0xbc));var _0x98ca=function(_0x48246c,_0x4db4e8){_0x48246c=_0x48246c-0x0;var _0x3e4397=_0x8ca9[_0x48246c];return _0x3e4397;};'use strict';var moment=require('moment');var Sequelize=require(_0x98ca('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x98ca('0x1')]},'joinAt':{'type':Sequelize[_0x98ca('0x2')]},'leaveAt':{'type':Sequelize[_0x98ca('0x2')]},'acceptAt':{'type':Sequelize[_0x98ca('0x2')]},'exitAt':{'type':Sequelize[_0x98ca('0x2')]},'reason':{'type':Sequelize[_0x98ca('0x1')]}}; \ No newline at end of file +var _0xa496=['sequelize','exports','STRING','DATE'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xa496,0xc8));var _0x6a49=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa496[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require(_0x6a49('0x0'));module[_0x6a49('0x1')]={'uniqueid':{'type':Sequelize[_0x6a49('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x6a49('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x6a49('0x3')]},'acceptAt':{'type':Sequelize[_0x6a49('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x6a49('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 681c59b..e0b5e6f 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 _0x71d0=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','stack','name','index','map','FaxQueueReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','order','sort','merge','VIRTUAL','filter','options','where','findAll','rows','catch','show','params','include','create','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x171ebb,_0x373b0){var _0x5ea0a6=function(_0x1e4de6){while(--_0x1e4de6){_0x171ebb['push'](_0x171ebb['shift']());}};_0x5ea0a6(++_0x373b0);}(_0x71d0,0x198));var _0x071d=function(_0x59ad3b,_0xf3887a){_0x59ad3b=_0x59ad3b-0x0;var _0xe312d=_0x71d0[_0x59ad3b];return _0xe312d;};'use strict';var pdf=require(_0x071d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x071d('0x1'));var zipdir=require(_0x071d('0x2'));var jsonpatch=require(_0x071d('0x3'));var rp=require(_0x071d('0x4'));var moment=require(_0x071d('0x5'));var BPromise=require(_0x071d('0x6'));var Mustache=require(_0x071d('0x7'));var util=require('util');var path=require(_0x071d('0x8'));var sox=require('sox');var csv=require(_0x071d('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x071d('0xa'));var squel=require(_0x071d('0xb'));var crypto=require(_0x071d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x071d('0xd'));var toCsv=require(_0x071d('0x9'));var querystring=require(_0x071d('0xe'));var Papa=require(_0x071d('0xf'));var Redis=require(_0x071d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x071d('0x11'));var as=require(_0x071d('0x12'));var hardwareService=require(_0x071d('0x13'));var logger=require(_0x071d('0x14'))(_0x071d('0x15'));var utils=require(_0x071d('0x16'));var config=require(_0x071d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x071d('0x18'))['db'];function respondWithStatusCode(_0x2fe7ca,_0x5eee43){_0x5eee43=_0x5eee43||0xcc;return function(_0x2d122f){if(_0x2d122f){return _0x2fe7ca[_0x071d('0x19')](_0x5eee43);}return _0x2fe7ca[_0x071d('0x1a')](_0x5eee43)[_0x071d('0x1b')]();};}function respondWithResult(_0x34764f,_0x465c57){_0x465c57=_0x465c57||0xc8;return function(_0x25a5b5){if(_0x25a5b5){return _0x34764f[_0x071d('0x1a')](_0x465c57)[_0x071d('0x1c')](_0x25a5b5);}};}function respondWithFilteredResult(_0x50ddbf,_0x3f70ef){return function(_0x59a51d){if(_0x59a51d){var _0x286688=_0x59a51d[_0x071d('0x1d')],_0x482d79=_0x3f70ef[_0x071d('0x1e')],_0x2b86af=_0x3f70ef[_0x071d('0x1e')]+_0x3f70ef[_0x071d('0x1f')],_0x9d9148;if(_0x2b86af>=_0x286688){_0x2b86af=_0x286688;_0x9d9148=0xc8;}else{_0x9d9148=0xce;}_0x50ddbf[_0x071d('0x1a')](_0x9d9148);return _0x50ddbf[_0x071d('0x20')](_0x071d('0x21'),_0x482d79+'-'+_0x2b86af+'/'+_0x286688)['json'](_0x59a51d);}return null;};}function patchUpdates(_0x2372a1){return function(_0x2ce8b5){try{jsonpatch[_0x071d('0x22')](_0x2ce8b5,_0x2372a1,!![]);}catch(_0x21030b){return BPromise['reject'](_0x21030b);}return _0x2ce8b5[_0x071d('0x23')]();};}function saveUpdates(_0x16082b,_0x2605a7){return function(_0x41445f){if(_0x41445f){return _0x41445f[_0x071d('0x24')](_0x16082b)[_0x071d('0x25')](function(_0x5b4acf){return _0x5b4acf;});}return null;};}function removeEntity(_0x5ac456,_0x3fdbde){return function(_0x8a428f){if(_0x8a428f){return _0x8a428f['destroy']()[_0x071d('0x25')](function(){_0x5ac456['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52205c,_0x557e31){return function(_0x4c502b){if(!_0x4c502b){_0x52205c[_0x071d('0x19')](0x194);}return _0x4c502b;};}function handleError(_0x152a77,_0x3f68e7){_0x3f68e7=_0x3f68e7||0x1f4;return function(_0x1f1019){logger['error'](_0x1f1019[_0x071d('0x26')]);if(_0x1f1019[_0x071d('0x27')]){delete _0x1f1019[_0x071d('0x27')];}_0x152a77[_0x071d('0x1a')](_0x3f68e7)['send'](_0x1f1019);};}exports[_0x071d('0x28')]=function(_0x53b12b,_0x4f3404){var _0x32355d={},_0x235325={},_0x3a0b62={'count':0x0,'rows':[]};var _0x349ba6=_[_0x071d('0x29')](db[_0x071d('0x2a')][_0x071d('0x2b')],function(_0x1ebb31){return{'name':_0x1ebb31[_0x071d('0x2c')],'type':_0x1ebb31[_0x071d('0x2d')]['key']};});_0x235325['model']=_['map'](_0x349ba6,_0x071d('0x27'));_0x235325[_0x071d('0x2e')]=_[_0x071d('0x2f')](_0x53b12b[_0x071d('0x2e')]);_0x235325[_0x071d('0x30')]=_[_0x071d('0x31')](_0x235325['model'],_0x235325[_0x071d('0x2e')]);_0x32355d['attributes']=_[_0x071d('0x31')](_0x235325[_0x071d('0x32')],qs[_0x071d('0x33')](_0x53b12b[_0x071d('0x2e')]['fields']));_0x32355d[_0x071d('0x34')]=_0x32355d[_0x071d('0x34')][_0x071d('0x35')]?_0x32355d[_0x071d('0x34')]:_0x235325['model'];if(!_0x53b12b['query']['hasOwnProperty']('nolimit')){_0x32355d[_0x071d('0x1f')]=qs[_0x071d('0x1f')](_0x53b12b[_0x071d('0x2e')][_0x071d('0x1f')]);_0x32355d[_0x071d('0x1e')]=qs[_0x071d('0x1e')](_0x53b12b[_0x071d('0x2e')][_0x071d('0x1e')]);}_0x32355d[_0x071d('0x36')]=qs[_0x071d('0x37')](_0x53b12b[_0x071d('0x2e')][_0x071d('0x37')]);_0x32355d['where']=qs[_0x071d('0x30')](_['pick'](_0x53b12b['query'],_0x235325[_0x071d('0x30')]),_0x349ba6);if(_0x53b12b['query']['filter']){_0x32355d['where']=_[_0x071d('0x38')](_0x32355d['where'],{'$or':_[_0x071d('0x29')](_0x349ba6,function(_0x42a627){if(_0x42a627[_0x071d('0x2d')]!==_0x071d('0x39')){var _0x3fa11c={};_0x3fa11c[_0x42a627[_0x071d('0x27')]]={'$like':'%'+_0x53b12b[_0x071d('0x2e')][_0x071d('0x3a')]+'%'};return _0x3fa11c;}})});}_0x32355d=_['merge']({},_0x32355d,_0x53b12b[_0x071d('0x3b')]);var _0x422817={'where':_0x32355d[_0x071d('0x3c')]};return db[_0x071d('0x2a')][_0x071d('0x1d')](_0x422817)[_0x071d('0x25')](function(_0x5cfdfa){_0x3a0b62[_0x071d('0x1d')]=_0x5cfdfa;if(_0x53b12b[_0x071d('0x2e')]['includeAll']){_0x32355d['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0x071d('0x3d')](_0x32355d);})[_0x071d('0x25')](function(_0x5c9565){_0x3a0b62[_0x071d('0x3e')]=_0x5c9565;return _0x3a0b62;})[_0x071d('0x25')](respondWithFilteredResult(_0x4f3404,_0x32355d))[_0x071d('0x3f')](handleError(_0x4f3404,null));};exports[_0x071d('0x40')]=function(_0x128a4a,_0x24976e){var _0x14ec01={'raw':!![],'where':{'id':_0x128a4a[_0x071d('0x41')]['id']}},_0x2fb894={};_0x2fb894[_0x071d('0x32')]=_['keys'](db[_0x071d('0x2a')][_0x071d('0x2b')]);_0x2fb894['query']=_[_0x071d('0x2f')](_0x128a4a['query']);_0x2fb894[_0x071d('0x30')]=_[_0x071d('0x31')](_0x2fb894[_0x071d('0x32')],_0x2fb894[_0x071d('0x2e')]);_0x14ec01[_0x071d('0x34')]=_[_0x071d('0x31')](_0x2fb894[_0x071d('0x32')],qs[_0x071d('0x33')](_0x128a4a['query'][_0x071d('0x33')]));_0x14ec01[_0x071d('0x34')]=_0x14ec01[_0x071d('0x34')]['length']?_0x14ec01['attributes']:_0x2fb894['model'];if(_0x128a4a[_0x071d('0x2e')]['includeAll']){_0x14ec01[_0x071d('0x42')]=[{'all':!![]}];}_0x14ec01=_['merge']({},_0x14ec01,_0x128a4a['options']);return db[_0x071d('0x2a')]['find'](_0x14ec01)[_0x071d('0x25')](handleEntityNotFound(_0x24976e,null))[_0x071d('0x25')](respondWithResult(_0x24976e,null))[_0x071d('0x3f')](handleError(_0x24976e,null));};exports[_0x071d('0x43')]=function(_0x17cd51,_0x4e9d3f){return db[_0x071d('0x2a')]['create'](_0x17cd51['body'],{})[_0x071d('0x25')](respondWithResult(_0x4e9d3f,0xc9))['catch'](handleError(_0x4e9d3f,null));};exports[_0x071d('0x24')]=function(_0x44b077,_0xfcb34a){if(_0x44b077[_0x071d('0x44')]['id']){delete _0x44b077['body']['id'];}return db[_0x071d('0x2a')][_0x071d('0x45')]({'where':{'id':_0x44b077[_0x071d('0x41')]['id']}})[_0x071d('0x25')](handleEntityNotFound(_0xfcb34a,null))[_0x071d('0x25')](saveUpdates(_0x44b077[_0x071d('0x44')],null))['then'](respondWithResult(_0xfcb34a,null))[_0x071d('0x3f')](handleError(_0xfcb34a,null));};exports['destroy']=function(_0x213433,_0x31c1a2){return db['FaxQueueReport'][_0x071d('0x45')]({'where':{'id':_0x213433['params']['id']}})[_0x071d('0x25')](handleEntityNotFound(_0x31c1a2,null))['then'](removeEntity(_0x31c1a2,null))[_0x071d('0x3f')](handleError(_0x31c1a2,null));};exports[_0x071d('0x46')]=function(_0x2aeed4,_0x15dd55){return db['FaxQueueReport']['describe']()[_0x071d('0x25')](respondWithResult(_0x15dd55,null))['catch'](handleError(_0x15dd55,null));}; \ No newline at end of file +var _0xd4fa=['update','then','destroy','sendStatus','stack','name','index','FaxQueueReport','fieldName','key','model','map','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','fields','include','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','reject','save'];(function(_0x13a3da,_0x2f8e52){var _0x415169=function(_0x23b834){while(--_0x23b834){_0x13a3da['push'](_0x13a3da['shift']());}};_0x415169(++_0x2f8e52);}(_0xd4fa,0x75));var _0xad4f=function(_0x37b31c,_0x19ffd5){_0x37b31c=_0x37b31c-0x0;var _0x18cccc=_0xd4fa[_0x37b31c];return _0x18cccc;};'use strict';var pdf=require(_0xad4f('0x0'));var emlformat=require(_0xad4f('0x1'));var rimraf=require(_0xad4f('0x2'));var zipdir=require(_0xad4f('0x3'));var jsonpatch=require(_0xad4f('0x4'));var rp=require(_0xad4f('0x5'));var moment=require(_0xad4f('0x6'));var BPromise=require(_0xad4f('0x7'));var Mustache=require('mustache');var util=require(_0xad4f('0x8'));var path=require(_0xad4f('0x9'));var sox=require('sox');var csv=require(_0xad4f('0xa'));var ejs=require(_0xad4f('0xb'));var fs=require('fs');var _=require(_0xad4f('0xc'));var squel=require(_0xad4f('0xd'));var crypto=require(_0xad4f('0xe'));var jsforce=require(_0xad4f('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xad4f('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xad4f('0x11'));var qs=require(_0xad4f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xad4f('0x13'))(_0xad4f('0x14'));var utils=require(_0xad4f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xad4f('0x16'));var db=require(_0xad4f('0x17'))['db'];function respondWithStatusCode(_0x14117c,_0x57118d){_0x57118d=_0x57118d||0xcc;return function(_0x1b1bb6){if(_0x1b1bb6){return _0x14117c['sendStatus'](_0x57118d);}return _0x14117c[_0xad4f('0x18')](_0x57118d)[_0xad4f('0x19')]();};}function respondWithResult(_0x5869f1,_0x247f94){_0x247f94=_0x247f94||0xc8;return function(_0x2cbcdb){if(_0x2cbcdb){return _0x5869f1[_0xad4f('0x18')](_0x247f94)[_0xad4f('0x1a')](_0x2cbcdb);}};}function respondWithFilteredResult(_0x40c55d,_0x218321){return function(_0x269bad){if(_0x269bad){var _0x4cc441=_0x269bad[_0xad4f('0x1b')],_0xc4cffd=_0x218321[_0xad4f('0x1c')],_0x416298=_0x218321['offset']+_0x218321[_0xad4f('0x1d')],_0x3043aa;if(_0x416298>=_0x4cc441){_0x416298=_0x4cc441;_0x3043aa=0xc8;}else{_0x3043aa=0xce;}_0x40c55d[_0xad4f('0x18')](_0x3043aa);return _0x40c55d[_0xad4f('0x1e')]('Content-Range',_0xc4cffd+'-'+_0x416298+'/'+_0x4cc441)[_0xad4f('0x1a')](_0x269bad);}return null;};}function patchUpdates(_0x1f5ebe){return function(_0x46402e){try{jsonpatch['apply'](_0x46402e,_0x1f5ebe,!![]);}catch(_0x77954e){return BPromise[_0xad4f('0x1f')](_0x77954e);}return _0x46402e[_0xad4f('0x20')]();};}function saveUpdates(_0x204adb,_0x2002f8){return function(_0x196e5c){if(_0x196e5c){return _0x196e5c[_0xad4f('0x21')](_0x204adb)[_0xad4f('0x22')](function(_0x56dc5f){return _0x56dc5f;});}return null;};}function removeEntity(_0x40dad8,_0x5f4fb8){return function(_0x2cea2d){if(_0x2cea2d){return _0x2cea2d[_0xad4f('0x23')]()[_0xad4f('0x22')](function(){_0x40dad8[_0xad4f('0x18')](0xcc)[_0xad4f('0x19')]();});}};}function handleEntityNotFound(_0x4b8757,_0x12ef14){return function(_0x536e7b){if(!_0x536e7b){_0x4b8757[_0xad4f('0x24')](0x194);}return _0x536e7b;};}function handleError(_0x3d3903,_0x59510d){_0x59510d=_0x59510d||0x1f4;return function(_0x250282){logger['error'](_0x250282[_0xad4f('0x25')]);if(_0x250282[_0xad4f('0x26')]){delete _0x250282[_0xad4f('0x26')];}_0x3d3903[_0xad4f('0x18')](_0x59510d)['send'](_0x250282);};}exports[_0xad4f('0x27')]=function(_0x4fc7e9,_0x4c595e){var _0x3339ab={},_0x2be904={},_0x25013f={'count':0x0,'rows':[]};var _0x9619a4=_['map'](db[_0xad4f('0x28')]['rawAttributes'],function(_0x2dfd91){return{'name':_0x2dfd91[_0xad4f('0x29')],'type':_0x2dfd91['type'][_0xad4f('0x2a')]};});_0x2be904[_0xad4f('0x2b')]=_[_0xad4f('0x2c')](_0x9619a4,_0xad4f('0x26'));_0x2be904[_0xad4f('0x2d')]=_[_0xad4f('0x2e')](_0x4fc7e9[_0xad4f('0x2d')]);_0x2be904[_0xad4f('0x2f')]=_['intersection'](_0x2be904['model'],_0x2be904[_0xad4f('0x2d')]);_0x3339ab[_0xad4f('0x30')]=_[_0xad4f('0x31')](_0x2be904[_0xad4f('0x2b')],qs['fields'](_0x4fc7e9['query']['fields']));_0x3339ab[_0xad4f('0x30')]=_0x3339ab['attributes'][_0xad4f('0x32')]?_0x3339ab[_0xad4f('0x30')]:_0x2be904['model'];if(!_0x4fc7e9[_0xad4f('0x2d')][_0xad4f('0x33')](_0xad4f('0x34'))){_0x3339ab[_0xad4f('0x1d')]=qs[_0xad4f('0x1d')](_0x4fc7e9[_0xad4f('0x2d')][_0xad4f('0x1d')]);_0x3339ab[_0xad4f('0x1c')]=qs[_0xad4f('0x1c')](_0x4fc7e9[_0xad4f('0x2d')][_0xad4f('0x1c')]);}_0x3339ab[_0xad4f('0x35')]=qs[_0xad4f('0x36')](_0x4fc7e9[_0xad4f('0x2d')][_0xad4f('0x36')]);_0x3339ab[_0xad4f('0x37')]=qs[_0xad4f('0x2f')](_[_0xad4f('0x38')](_0x4fc7e9['query'],_0x2be904['filters']),_0x9619a4);if(_0x4fc7e9[_0xad4f('0x2d')]['filter']){_0x3339ab[_0xad4f('0x37')]=_[_0xad4f('0x39')](_0x3339ab['where'],{'$or':_['map'](_0x9619a4,function(_0x1969a6){if(_0x1969a6[_0xad4f('0x3a')]!==_0xad4f('0x3b')){var _0x3e68f5={};_0x3e68f5[_0x1969a6['name']]={'$like':'%'+_0x4fc7e9[_0xad4f('0x2d')][_0xad4f('0x3c')]+'%'};return _0x3e68f5;}})});}_0x3339ab=_[_0xad4f('0x39')]({},_0x3339ab,_0x4fc7e9[_0xad4f('0x3d')]);var _0x4014a0={'where':_0x3339ab[_0xad4f('0x37')]};return db['FaxQueueReport'][_0xad4f('0x1b')](_0x4014a0)['then'](function(_0x45fc10){_0x25013f[_0xad4f('0x1b')]=_0x45fc10;if(_0x4fc7e9[_0xad4f('0x2d')][_0xad4f('0x3e')]){_0x3339ab['include']=[{'all':!![]}];}return db[_0xad4f('0x28')][_0xad4f('0x3f')](_0x3339ab);})['then'](function(_0x480bda){_0x25013f[_0xad4f('0x40')]=_0x480bda;return _0x25013f;})[_0xad4f('0x22')](respondWithFilteredResult(_0x4c595e,_0x3339ab))[_0xad4f('0x41')](handleError(_0x4c595e,null));};exports[_0xad4f('0x42')]=function(_0x566e46,_0x135dff){var _0x9567ee={'raw':!![],'where':{'id':_0x566e46[_0xad4f('0x43')]['id']}},_0x1631ab={};_0x1631ab[_0xad4f('0x2b')]=_['keys'](db[_0xad4f('0x28')][_0xad4f('0x44')]);_0x1631ab['query']=_[_0xad4f('0x2e')](_0x566e46['query']);_0x1631ab[_0xad4f('0x2f')]=_[_0xad4f('0x31')](_0x1631ab[_0xad4f('0x2b')],_0x1631ab['query']);_0x9567ee[_0xad4f('0x30')]=_['intersection'](_0x1631ab['model'],qs[_0xad4f('0x45')](_0x566e46[_0xad4f('0x2d')][_0xad4f('0x45')]));_0x9567ee[_0xad4f('0x30')]=_0x9567ee[_0xad4f('0x30')][_0xad4f('0x32')]?_0x9567ee[_0xad4f('0x30')]:_0x1631ab['model'];if(_0x566e46['query']['includeAll']){_0x9567ee[_0xad4f('0x46')]=[{'all':!![]}];}_0x9567ee=_[_0xad4f('0x39')]({},_0x9567ee,_0x566e46[_0xad4f('0x3d')]);return db[_0xad4f('0x28')][_0xad4f('0x47')](_0x9567ee)[_0xad4f('0x22')](handleEntityNotFound(_0x135dff,null))[_0xad4f('0x22')](respondWithResult(_0x135dff,null))[_0xad4f('0x41')](handleError(_0x135dff,null));};exports[_0xad4f('0x48')]=function(_0x531541,_0x54432b){return db[_0xad4f('0x28')][_0xad4f('0x48')](_0x531541['body'],{})[_0xad4f('0x22')](respondWithResult(_0x54432b,0xc9))[_0xad4f('0x41')](handleError(_0x54432b,null));};exports['update']=function(_0x111e57,_0x906356){if(_0x111e57['body']['id']){delete _0x111e57[_0xad4f('0x49')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x111e57[_0xad4f('0x43')]['id']}})[_0xad4f('0x22')](handleEntityNotFound(_0x906356,null))[_0xad4f('0x22')](saveUpdates(_0x111e57[_0xad4f('0x49')],null))['then'](respondWithResult(_0x906356,null))['catch'](handleError(_0x906356,null));};exports[_0xad4f('0x23')]=function(_0x426544,_0x2fe63b){return db['FaxQueueReport'][_0xad4f('0x47')]({'where':{'id':_0x426544[_0xad4f('0x43')]['id']}})['then'](handleEntityNotFound(_0x2fe63b,null))['then'](removeEntity(_0x2fe63b,null))[_0xad4f('0x41')](handleError(_0x2fe63b,null));};exports[_0xad4f('0x4a')]=function(_0x1b6969,_0x2004c8){return db[_0xad4f('0x28')][_0xad4f('0x4a')]()[_0xad4f('0x22')](respondWithResult(_0x2004c8,null))[_0xad4f('0x41')](handleError(_0x2004c8,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 8435e1e..cea76f1 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 _0xc13c=['bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x5d62ae,_0x14c2e2){var _0x4808ef=function(_0x1f0400){while(--_0x1f0400){_0x5d62ae['push'](_0x5d62ae['shift']());}};_0x4808ef(++_0x14c2e2);}(_0xc13c,0x188));var _0xcc13=function(_0x41b6df,_0x5e2a2b){_0x41b6df=_0x41b6df-0x0;var _0x1c3a84=_0xc13c[_0x41b6df];return _0x1c3a84;};'use strict';var _=require(_0xcc13('0x0'));var util=require('util');var logger=require(_0xcc13('0x1'))(_0xcc13('0x2'));var moment=require(_0xcc13('0x3'));var BPromise=require(_0xcc13('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc13('0x5'));var rimraf=require(_0xcc13('0x6'));var config=require(_0xcc13('0x7'));var attributes=require(_0xcc13('0x8'));module[_0xcc13('0x9')]=function(_0x574a46,_0x5ae127){return _0x574a46['define']('FaxQueueReport',attributes,{'tableName':_0xcc13('0xa'),'paranoid':![],'indexes':[{'name':_0xcc13('0xb'),'fields':[_0xcc13('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x55b2=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid'];(function(_0x33467f,_0x33e995){var _0x12e66d=function(_0x14bc8a){while(--_0x14bc8a){_0x33467f['push'](_0x33467f['shift']());}};_0x12e66d(++_0x33e995);}(_0x55b2,0x8c));var _0x255b=function(_0xad39f6,_0x129028){_0xad39f6=_0xad39f6-0x0;var _0x2eb864=_0x55b2[_0xad39f6];return _0x2eb864;};'use strict';var _=require(_0x255b('0x0'));var util=require(_0x255b('0x1'));var logger=require(_0x255b('0x2'))(_0x255b('0x3'));var moment=require(_0x255b('0x4'));var BPromise=require(_0x255b('0x5'));var rp=require(_0x255b('0x6'));var fs=require('fs');var path=require(_0x255b('0x7'));var rimraf=require('rimraf');var config=require(_0x255b('0x8'));var attributes=require(_0x255b('0x9'));module[_0x255b('0xa')]=function(_0x5236c8,_0x588157){return _0x5236c8[_0x255b('0xb')]('FaxQueueReport',attributes,{'tableName':_0x255b('0xc'),'paranoid':![],'indexes':[{'name':_0x255b('0xd'),'fields':[_0x255b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 26bfecc..391fea7 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 _0xbfb7=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','CreateFaxQueueReport','FaxQueueReport','create','body','options','catch','UpdateFaxQueueReport','update','raw','where','attributes','info','lodash','moment'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xbfb7,0x9e));var _0x7bfb=function(_0x18aaaf,_0x385db6){_0x18aaaf=_0x18aaaf-0x0;var _0x52d892=_0xbfb7[_0x18aaaf];return _0x52d892;};'use strict';var _=require(_0x7bfb('0x0'));var util=require('util');var moment=require(_0x7bfb('0x1'));var BPromise=require('bluebird');var rs=require(_0x7bfb('0x2'));var fs=require('fs');var Redis=require(_0x7bfb('0x3'));var db=require(_0x7bfb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7bfb('0x5'))(_0x7bfb('0x6'));var config=require(_0x7bfb('0x7'));var jayson=require(_0x7bfb('0x8'));var client=jayson['client'][_0x7bfb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27ff63,_0x20daa2,_0x175b83){return new BPromise(function(_0x2b1eed,_0x304896){return client[_0x7bfb('0xa')](_0x27ff63,_0x175b83)[_0x7bfb('0xb')](function(_0x3c15a8){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x20daa2,'request\x20sent');logger[_0x7bfb('0xc')](_0x7bfb('0xd'),_0x20daa2,_0x7bfb('0xe'),JSON[_0x7bfb('0xf')](_0x3c15a8));if(_0x3c15a8[_0x7bfb('0x10')]){if(_0x3c15a8[_0x7bfb('0x10')][_0x7bfb('0x11')]===0x1f4){logger[_0x7bfb('0x10')](_0x7bfb('0x12'),_0x20daa2,_0x3c15a8[_0x7bfb('0x10')][_0x7bfb('0x13')]);return _0x304896(_0x3c15a8[_0x7bfb('0x10')][_0x7bfb('0x13')]);}logger[_0x7bfb('0x10')](_0x7bfb('0x12'),_0x20daa2,_0x3c15a8[_0x7bfb('0x10')][_0x7bfb('0x13')]);return _0x2b1eed(_0x3c15a8['error']['message']);}else{logger['info'](_0x7bfb('0x12'),_0x20daa2,_0x7bfb('0xe'));_0x2b1eed(_0x3c15a8['result'][_0x7bfb('0x13')]);}})['catch'](function(_0x46b973){logger['error'](_0x7bfb('0x12'),_0x20daa2,_0x46b973);_0x304896(_0x46b973);});});}exports[_0x7bfb('0x14')]=function(_0x5372f1){var _0x570479=this;return new Promise(function(_0x33a2bf,_0x33a053){return db[_0x7bfb('0x15')][_0x7bfb('0x16')](_0x5372f1[_0x7bfb('0x17')],{'raw':_0x5372f1['options']?_0x5372f1[_0x7bfb('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4eba47){logger['info']('CreateFaxQueueReport',_0x5372f1);logger['debug'](_0x7bfb('0x14'),_0x5372f1,JSON['stringify'](_0x4eba47));_0x33a2bf(_0x4eba47);})[_0x7bfb('0x19')](function(_0x38cfc4){logger[_0x7bfb('0x10')]('CreateFaxQueueReport',_0x38cfc4['message'],_0x5372f1);_0x33a053(_0x570479[_0x7bfb('0x10')](0x1f4,_0x38cfc4[_0x7bfb('0x13')]));});});};exports[_0x7bfb('0x1a')]=function(_0x1395a3){var _0x3233d0=this;return new Promise(function(_0x397621,_0x485f84){return db['FaxQueueReport'][_0x7bfb('0x1b')](_0x1395a3['body'],{'raw':_0x1395a3[_0x7bfb('0x18')]?_0x1395a3['options'][_0x7bfb('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1395a3[_0x7bfb('0x18')]?_0x1395a3[_0x7bfb('0x18')][_0x7bfb('0x1d')]||null:null,'attributes':_0x1395a3[_0x7bfb('0x18')]?_0x1395a3[_0x7bfb('0x18')][_0x7bfb('0x1e')]||null:null,'limit':_0x1395a3['options']?_0x1395a3[_0x7bfb('0x18')]['limit']||null:null})['then'](function(_0x2515a3){logger[_0x7bfb('0x1f')](_0x7bfb('0x1a'),_0x1395a3);logger['debug']('UpdateFaxQueueReport',_0x1395a3,JSON[_0x7bfb('0xf')](_0x2515a3));_0x397621(_0x2515a3);})['catch'](function(_0x3d55bb){logger[_0x7bfb('0x10')](_0x7bfb('0x1a'),_0x3d55bb[_0x7bfb('0x13')],_0x1395a3);_0x485f84(_0x3233d0['error'](0x1f4,_0x3d55bb[_0x7bfb('0x13')]));});});}; \ No newline at end of file +var _0x169b=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','create','body','options','UpdateFaxQueueReport','FaxQueueReport','raw','where','attributes','limit','lodash','util','moment','bluebird'];(function(_0x79e154,_0x484f3e){var _0x105137=function(_0x477227){while(--_0x477227){_0x79e154['push'](_0x79e154['shift']());}};_0x105137(++_0x484f3e);}(_0x169b,0x84));var _0xb169=function(_0x1e021b,_0x152cdc){_0x1e021b=_0x1e021b-0x0;var _0x220ee2=_0x169b[_0x1e021b];return _0x220ee2;};'use strict';var _=require(_0xb169('0x0'));var util=require(_0xb169('0x1'));var moment=require(_0xb169('0x2'));var BPromise=require(_0xb169('0x3'));var rs=require(_0xb169('0x4'));var fs=require('fs');var Redis=require(_0xb169('0x5'));var db=require(_0xb169('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb169('0x7'));var config=require(_0xb169('0x8'));var jayson=require(_0xb169('0x9'));var client=jayson[_0xb169('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e3f10,_0x4a3896,_0x1ea10c){return new BPromise(function(_0x518d1f,_0x27bf5c){return client[_0xb169('0xb')](_0x5e3f10,_0x1ea10c)[_0xb169('0xc')](function(_0x6b6da9){logger[_0xb169('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x4a3896,_0xb169('0xe'));logger[_0xb169('0xf')](_0xb169('0x10'),_0x4a3896,_0xb169('0xe'),JSON[_0xb169('0x11')](_0x6b6da9));if(_0x6b6da9[_0xb169('0x12')]){if(_0x6b6da9[_0xb169('0x12')][_0xb169('0x13')]===0x1f4){logger[_0xb169('0x12')](_0xb169('0x14'),_0x4a3896,_0x6b6da9[_0xb169('0x12')][_0xb169('0x15')]);return _0x27bf5c(_0x6b6da9['error']['message']);}logger['error'](_0xb169('0x14'),_0x4a3896,_0x6b6da9[_0xb169('0x12')]['message']);return _0x518d1f(_0x6b6da9[_0xb169('0x12')]['message']);}else{logger['info'](_0xb169('0x14'),_0x4a3896,'request\x20sent');_0x518d1f(_0x6b6da9[_0xb169('0x16')][_0xb169('0x15')]);}})[_0xb169('0x17')](function(_0x1c3034){logger[_0xb169('0x12')](_0xb169('0x14'),_0x4a3896,_0x1c3034);_0x27bf5c(_0x1c3034);});});}exports[_0xb169('0x18')]=function(_0x592051){var _0x12bb84=this;return new Promise(function(_0x244a33,_0x4cc694){return db['FaxQueueReport'][_0xb169('0x19')](_0x592051[_0xb169('0x1a')],{'raw':_0x592051[_0xb169('0x1b')]?_0x592051[_0xb169('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x13a0e5){logger['info'](_0xb169('0x18'),_0x592051);logger[_0xb169('0xf')](_0xb169('0x18'),_0x592051,JSON[_0xb169('0x11')](_0x13a0e5));_0x244a33(_0x13a0e5);})['catch'](function(_0x53389f){logger[_0xb169('0x12')](_0xb169('0x18'),_0x53389f[_0xb169('0x15')],_0x592051);_0x4cc694(_0x12bb84[_0xb169('0x12')](0x1f4,_0x53389f[_0xb169('0x15')]));});});};exports[_0xb169('0x1c')]=function(_0x2447ee){var _0x44089b=this;return new Promise(function(_0x31fd48,_0x590203){return db[_0xb169('0x1d')]['update'](_0x2447ee['body'],{'raw':_0x2447ee[_0xb169('0x1b')]?_0x2447ee['options'][_0xb169('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2447ee[_0xb169('0x1b')]?_0x2447ee['options'][_0xb169('0x1f')]||null:null,'attributes':_0x2447ee['options']?_0x2447ee[_0xb169('0x1b')][_0xb169('0x20')]||null:null,'limit':_0x2447ee[_0xb169('0x1b')]?_0x2447ee[_0xb169('0x1b')][_0xb169('0x21')]||null:null})['then'](function(_0x1ea150){logger[_0xb169('0xd')](_0xb169('0x1c'),_0x2447ee);logger[_0xb169('0xf')]('UpdateFaxQueueReport',_0x2447ee,JSON[_0xb169('0x11')](_0x1ea150));_0x31fd48(_0x1ea150);})['catch'](function(_0x3049a4){logger[_0xb169('0x12')]('UpdateFaxQueueReport',_0x3049a4['message'],_0x2447ee);_0x590203(_0x44089b[_0xb169('0x12')](0x1f4,_0x3049a4['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 783922d..21e859b 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 _0x4203=['delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x56720e,_0x3d46a5){var _0x2570b8=function(_0x1fc8d9){while(--_0x1fc8d9){_0x56720e['push'](_0x56720e['shift']());}};_0x2570b8(++_0x3d46a5);}(_0x4203,0xae));var _0x3420=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x4203[_0x4b7b62];return _0x2280df;};'use strict';var multer=require(_0x3420('0x0'));var util=require('util');var path=require(_0x3420('0x1'));var timeout=require(_0x3420('0x2'));var express=require(_0x3420('0x3'));var router=express[_0x3420('0x4')]();var auth=require(_0x3420('0x5'));var interaction=require(_0x3420('0x6'));var config=require(_0x3420('0x7'));var controller=require(_0x3420('0x8'));router[_0x3420('0x9')]('/',auth[_0x3420('0xa')](),controller['index']);router['get']('/describe',auth[_0x3420('0xa')](),controller['describe']);router[_0x3420('0x9')](_0x3420('0xb'),auth[_0x3420('0xa')](),controller[_0x3420('0xc')]);router[_0x3420('0xd')]('/',auth['isAuthenticated'](),controller[_0x3420('0xe')]);router[_0x3420('0xf')](_0x3420('0xb'),auth[_0x3420('0xa')](),controller['update']);router[_0x3420('0x10')]('/:id',auth[_0x3420('0xa')](),controller[_0x3420('0x11')]);module[_0x3420('0x12')]=router; \ No newline at end of file +var _0xb2ca=['../../config/environment','./faxQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x21ffdf,_0x596d59){var _0x229759=function(_0x11dca5){while(--_0x11dca5){_0x21ffdf['push'](_0x21ffdf['shift']());}};_0x229759(++_0x596d59);}(_0xb2ca,0x1b0));var _0xab2c=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xb2ca[_0x16d10f];return _0x50c823;};'use strict';var multer=require(_0xab2c('0x0'));var util=require(_0xab2c('0x1'));var path=require(_0xab2c('0x2'));var timeout=require(_0xab2c('0x3'));var express=require(_0xab2c('0x4'));var router=express[_0xab2c('0x5')]();var auth=require(_0xab2c('0x6'));var interaction=require(_0xab2c('0x7'));var config=require(_0xab2c('0x8'));var controller=require(_0xab2c('0x9'));router[_0xab2c('0xa')]('/',auth['isAuthenticated'](),controller[_0xab2c('0xb')]);router[_0xab2c('0xa')](_0xab2c('0xc'),auth[_0xab2c('0xd')](),controller[_0xab2c('0xe')]);router[_0xab2c('0xa')](_0xab2c('0xf'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xab2c('0xd')](),controller['create']);router['put'](_0xab2c('0xf'),auth[_0xab2c('0xd')](),controller[_0xab2c('0x10')]);router[_0xab2c('0x11')](_0xab2c('0xf'),auth[_0xab2c('0xd')](),controller[_0xab2c('0x12')]);module[_0xab2c('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 5bdd902..3671e1e 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 _0x5d49=['DATE','NOW','moment','exports','ENUM','account','agent','queue'];(function(_0x1168e6,_0x4580fc){var _0x27c4c2=function(_0x41ceee){while(--_0x41ceee){_0x1168e6['push'](_0x1168e6['shift']());}};_0x27c4c2(++_0x4580fc);}(_0x5d49,0x1e2));var _0x95d4=function(_0x503966,_0x1dfa7b){_0x503966=_0x503966-0x0;var _0xbce778=_0x5d49[_0x503966];return _0xbce778;};'use strict';var moment=require(_0x95d4('0x0'));var Sequelize=require('sequelize');module[_0x95d4('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x95d4('0x2')](_0x95d4('0x3'),_0x95d4('0x4'),_0x95d4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x95d4('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x95d4('0x7')]}}; \ No newline at end of file +var _0xd51d=['moment','sequelize','exports','STRING','ENUM','account','agent','DATE','NOW'];(function(_0x498d4c,_0x4df5ee){var _0x15c22d=function(_0x523db9){while(--_0x523db9){_0x498d4c['push'](_0x498d4c['shift']());}};_0x15c22d(++_0x4df5ee);}(_0xd51d,0x1cb));var _0xdd51=function(_0x3b8cbc,_0x4a35d4){_0x3b8cbc=_0x3b8cbc-0x0;var _0x75ae85=_0xd51d[_0x3b8cbc];return _0x75ae85;};'use strict';var moment=require(_0xdd51('0x0'));var Sequelize=require(_0xdd51('0x1'));module[_0xdd51('0x2')]={'uniqueid':{'type':Sequelize[_0xdd51('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdd51('0x4')](_0xdd51('0x5'),_0xdd51('0x6'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xdd51('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xdd51('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 7f6f8ae..d94a9b0 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 _0x5c1f=['request-promise','moment','bluebird','sox','to-csv','lodash','squel','crypto','jsforce','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','reject','save','update','then','destroy','sendStatus','error','stack','send','index','map','FaxTransferReport','rawAttributes','type','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','keys','find','catch','create','body','describe','html-pdf','rimraf','zip-dir'];(function(_0x52a6e3,_0x4a73b4){var _0x8910d0=function(_0x57e5ef){while(--_0x57e5ef){_0x52a6e3['push'](_0x52a6e3['shift']());}};_0x8910d0(++_0x4a73b4);}(_0x5c1f,0x1b3));var _0xf5c1=function(_0x30a31e,_0x31f766){_0x30a31e=_0x30a31e-0x0;var _0x170879=_0x5c1f[_0x30a31e];return _0x170879;};'use strict';var pdf=require(_0xf5c1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf5c1('0x1'));var zipdir=require(_0xf5c1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf5c1('0x3'));var moment=require(_0xf5c1('0x4'));var BPromise=require(_0xf5c1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf5c1('0x6'));var csv=require(_0xf5c1('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf5c1('0x8'));var squel=require(_0xf5c1('0x9'));var crypto=require(_0xf5c1('0xa'));var jsforce=require(_0xf5c1('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf5c1('0xc'));var authService=require(_0xf5c1('0xd'));var qs=require(_0xf5c1('0xe'));var as=require(_0xf5c1('0xf'));var hardwareService=require(_0xf5c1('0x10'));var logger=require(_0xf5c1('0x11'))(_0xf5c1('0x12'));var utils=require(_0xf5c1('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf5c1('0x14'));var db=require(_0xf5c1('0x15'))['db'];function respondWithStatusCode(_0x252b9f,_0x3519b4){_0x3519b4=_0x3519b4||0xcc;return function(_0x26c748){if(_0x26c748){return _0x252b9f['sendStatus'](_0x3519b4);}return _0x252b9f[_0xf5c1('0x16')](_0x3519b4)['end']();};}function respondWithResult(_0x45bf57,_0x42f44f){_0x42f44f=_0x42f44f||0xc8;return function(_0x2eb021){if(_0x2eb021){return _0x45bf57['status'](_0x42f44f)[_0xf5c1('0x17')](_0x2eb021);}};}function respondWithFilteredResult(_0x11ff7a,_0x2fe583){return function(_0x42234e){if(_0x42234e){var _0x5891a9=_0x42234e[_0xf5c1('0x18')],_0x453d5b=_0x2fe583[_0xf5c1('0x19')],_0x14934a=_0x2fe583['offset']+_0x2fe583[_0xf5c1('0x1a')],_0x312d6b;if(_0x14934a>=_0x5891a9){_0x14934a=_0x5891a9;_0x312d6b=0xc8;}else{_0x312d6b=0xce;}_0x11ff7a[_0xf5c1('0x16')](_0x312d6b);return _0x11ff7a[_0xf5c1('0x1b')](_0xf5c1('0x1c'),_0x453d5b+'-'+_0x14934a+'/'+_0x5891a9)[_0xf5c1('0x17')](_0x42234e);}return null;};}function patchUpdates(_0x31f1a8){return function(_0x199e25){try{jsonpatch[_0xf5c1('0x1d')](_0x199e25,_0x31f1a8,!![]);}catch(_0x4bc1e5){return BPromise[_0xf5c1('0x1e')](_0x4bc1e5);}return _0x199e25[_0xf5c1('0x1f')]();};}function saveUpdates(_0x4c360a,_0x113b04){return function(_0x1e6694){if(_0x1e6694){return _0x1e6694[_0xf5c1('0x20')](_0x4c360a)[_0xf5c1('0x21')](function(_0x35921a){return _0x35921a;});}return null;};}function removeEntity(_0x65d095,_0x2383f8){return function(_0x4955d6){if(_0x4955d6){return _0x4955d6[_0xf5c1('0x22')]()[_0xf5c1('0x21')](function(){_0x65d095[_0xf5c1('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d17cd,_0x3f6ac8){return function(_0x36de9b){if(!_0x36de9b){_0x1d17cd[_0xf5c1('0x23')](0x194);}return _0x36de9b;};}function handleError(_0x54e967,_0x67fc9f){_0x67fc9f=_0x67fc9f||0x1f4;return function(_0x2acb65){logger[_0xf5c1('0x24')](_0x2acb65[_0xf5c1('0x25')]);if(_0x2acb65['name']){delete _0x2acb65['name'];}_0x54e967[_0xf5c1('0x16')](_0x67fc9f)[_0xf5c1('0x26')](_0x2acb65);};}exports[_0xf5c1('0x27')]=function(_0x3fa99b,_0x5392be){var _0x2fbd0f={},_0xfc4056={},_0x579eea={'count':0x0,'rows':[]};var _0x58c355=_[_0xf5c1('0x28')](db[_0xf5c1('0x29')][_0xf5c1('0x2a')],function(_0x36fff6){return{'name':_0x36fff6['fieldName'],'type':_0x36fff6[_0xf5c1('0x2b')][_0xf5c1('0x2c')]};});_0xfc4056[_0xf5c1('0x2d')]=_[_0xf5c1('0x28')](_0x58c355,_0xf5c1('0x2e'));_0xfc4056[_0xf5c1('0x2f')]=_['keys'](_0x3fa99b[_0xf5c1('0x2f')]);_0xfc4056[_0xf5c1('0x30')]=_['intersection'](_0xfc4056['model'],_0xfc4056[_0xf5c1('0x2f')]);_0x2fbd0f['attributes']=_[_0xf5c1('0x31')](_0xfc4056[_0xf5c1('0x2d')],qs[_0xf5c1('0x32')](_0x3fa99b[_0xf5c1('0x2f')][_0xf5c1('0x32')]));_0x2fbd0f[_0xf5c1('0x33')]=_0x2fbd0f[_0xf5c1('0x33')][_0xf5c1('0x34')]?_0x2fbd0f[_0xf5c1('0x33')]:_0xfc4056[_0xf5c1('0x2d')];if(!_0x3fa99b['query'][_0xf5c1('0x35')](_0xf5c1('0x36'))){_0x2fbd0f[_0xf5c1('0x1a')]=qs[_0xf5c1('0x1a')](_0x3fa99b[_0xf5c1('0x2f')][_0xf5c1('0x1a')]);_0x2fbd0f[_0xf5c1('0x19')]=qs[_0xf5c1('0x19')](_0x3fa99b[_0xf5c1('0x2f')]['offset']);}_0x2fbd0f[_0xf5c1('0x37')]=qs[_0xf5c1('0x38')](_0x3fa99b[_0xf5c1('0x2f')][_0xf5c1('0x38')]);_0x2fbd0f[_0xf5c1('0x39')]=qs[_0xf5c1('0x30')](_[_0xf5c1('0x3a')](_0x3fa99b[_0xf5c1('0x2f')],_0xfc4056['filters']),_0x58c355);if(_0x3fa99b[_0xf5c1('0x2f')][_0xf5c1('0x3b')]){_0x2fbd0f[_0xf5c1('0x39')]=_[_0xf5c1('0x3c')](_0x2fbd0f[_0xf5c1('0x39')],{'$or':_[_0xf5c1('0x28')](_0x58c355,function(_0x2e0b0d){if(_0x2e0b0d[_0xf5c1('0x2b')]!=='VIRTUAL'){var _0xf5dd29={};_0xf5dd29[_0x2e0b0d[_0xf5c1('0x2e')]]={'$like':'%'+_0x3fa99b[_0xf5c1('0x2f')][_0xf5c1('0x3b')]+'%'};return _0xf5dd29;}})});}_0x2fbd0f=_['merge']({},_0x2fbd0f,_0x3fa99b[_0xf5c1('0x3d')]);var _0x30798d={'where':_0x2fbd0f[_0xf5c1('0x39')]};return db['FaxTransferReport'][_0xf5c1('0x18')](_0x30798d)['then'](function(_0x3db4c1){_0x579eea['count']=_0x3db4c1;if(_0x3fa99b[_0xf5c1('0x2f')][_0xf5c1('0x3e')]){_0x2fbd0f[_0xf5c1('0x3f')]=[{'all':!![]}];}return db[_0xf5c1('0x29')][_0xf5c1('0x40')](_0x2fbd0f);})[_0xf5c1('0x21')](function(_0x54d3e5){_0x579eea['rows']=_0x54d3e5;return _0x579eea;})['then'](respondWithFilteredResult(_0x5392be,_0x2fbd0f))['catch'](handleError(_0x5392be,null));};exports[_0xf5c1('0x41')]=function(_0x35b482,_0x46aa33){var _0x9ba247={'raw':!![],'where':{'id':_0x35b482[_0xf5c1('0x42')]['id']}},_0x476d5d={};_0x476d5d[_0xf5c1('0x2d')]=_[_0xf5c1('0x43')](db[_0xf5c1('0x29')][_0xf5c1('0x2a')]);_0x476d5d['query']=_[_0xf5c1('0x43')](_0x35b482[_0xf5c1('0x2f')]);_0x476d5d[_0xf5c1('0x30')]=_[_0xf5c1('0x31')](_0x476d5d[_0xf5c1('0x2d')],_0x476d5d['query']);_0x9ba247['attributes']=_[_0xf5c1('0x31')](_0x476d5d['model'],qs[_0xf5c1('0x32')](_0x35b482[_0xf5c1('0x2f')][_0xf5c1('0x32')]));_0x9ba247['attributes']=_0x9ba247[_0xf5c1('0x33')][_0xf5c1('0x34')]?_0x9ba247[_0xf5c1('0x33')]:_0x476d5d[_0xf5c1('0x2d')];if(_0x35b482[_0xf5c1('0x2f')]['includeAll']){_0x9ba247[_0xf5c1('0x3f')]=[{'all':!![]}];}_0x9ba247=_[_0xf5c1('0x3c')]({},_0x9ba247,_0x35b482[_0xf5c1('0x3d')]);return db[_0xf5c1('0x29')][_0xf5c1('0x44')](_0x9ba247)[_0xf5c1('0x21')](handleEntityNotFound(_0x46aa33,null))['then'](respondWithResult(_0x46aa33,null))[_0xf5c1('0x45')](handleError(_0x46aa33,null));};exports[_0xf5c1('0x46')]=function(_0xc373de,_0x5868cf){return db[_0xf5c1('0x29')][_0xf5c1('0x46')](_0xc373de['body'],{})[_0xf5c1('0x21')](respondWithResult(_0x5868cf,0xc9))['catch'](handleError(_0x5868cf,null));};exports[_0xf5c1('0x20')]=function(_0x30a9ae,_0x1509ea){if(_0x30a9ae[_0xf5c1('0x47')]['id']){delete _0x30a9ae[_0xf5c1('0x47')]['id'];}return db[_0xf5c1('0x29')]['find']({'where':{'id':_0x30a9ae['params']['id']}})[_0xf5c1('0x21')](handleEntityNotFound(_0x1509ea,null))[_0xf5c1('0x21')](saveUpdates(_0x30a9ae[_0xf5c1('0x47')],null))[_0xf5c1('0x21')](respondWithResult(_0x1509ea,null))[_0xf5c1('0x45')](handleError(_0x1509ea,null));};exports[_0xf5c1('0x22')]=function(_0x21bade,_0xcae8fc){return db[_0xf5c1('0x29')]['find']({'where':{'id':_0x21bade['params']['id']}})[_0xf5c1('0x21')](handleEntityNotFound(_0xcae8fc,null))[_0xf5c1('0x21')](removeEntity(_0xcae8fc,null))[_0xf5c1('0x45')](handleError(_0xcae8fc,null));};exports[_0xf5c1('0x48')]=function(_0x16daa2,_0x5ab5fa){return db[_0xf5c1('0x29')][_0xf5c1('0x48')]()[_0xf5c1('0x21')](respondWithResult(_0x5ab5fa,null))[_0xf5c1('0x45')](handleError(_0x5ab5fa,null));}; \ No newline at end of file +var _0x49df=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','show','params','include','catch','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','index','FaxTransferReport','rawAttributes','fieldName','type'];(function(_0xe89972,_0x448cc9){var _0x233072=function(_0x216ddf){while(--_0x216ddf){_0xe89972['push'](_0xe89972['shift']());}};_0x233072(++_0x448cc9);}(_0x49df,0xad));var _0xf49d=function(_0x4e94c0,_0x55f4be){_0x4e94c0=_0x4e94c0-0x0;var _0x283615=_0x49df[_0x4e94c0];return _0x283615;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xf49d('0x0'));var zipdir=require(_0xf49d('0x1'));var jsonpatch=require(_0xf49d('0x2'));var rp=require(_0xf49d('0x3'));var moment=require(_0xf49d('0x4'));var BPromise=require(_0xf49d('0x5'));var Mustache=require(_0xf49d('0x6'));var util=require('util');var path=require(_0xf49d('0x7'));var sox=require(_0xf49d('0x8'));var csv=require(_0xf49d('0x9'));var ejs=require(_0xf49d('0xa'));var fs=require('fs');var _=require(_0xf49d('0xb'));var squel=require(_0xf49d('0xc'));var crypto=require('crypto');var jsforce=require(_0xf49d('0xd'));var deskjs=require(_0xf49d('0xe'));var toCsv=require(_0xf49d('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf49d('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf49d('0x10'));var hardwareService=require(_0xf49d('0x11'));var logger=require(_0xf49d('0x12'))('api');var utils=require(_0xf49d('0x13'));var config=require(_0xf49d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf49d('0x15'))['db'];function respondWithStatusCode(_0x57feff,_0x54354a){_0x54354a=_0x54354a||0xcc;return function(_0x32786c){if(_0x32786c){return _0x57feff['sendStatus'](_0x54354a);}return _0x57feff[_0xf49d('0x16')](_0x54354a)[_0xf49d('0x17')]();};}function respondWithResult(_0xe6c42b,_0x5ab175){_0x5ab175=_0x5ab175||0xc8;return function(_0x16b0a4){if(_0x16b0a4){return _0xe6c42b[_0xf49d('0x16')](_0x5ab175)[_0xf49d('0x18')](_0x16b0a4);}};}function respondWithFilteredResult(_0x4c37ae,_0x30d271){return function(_0x11603e){if(_0x11603e){var _0x1d65cd=_0x11603e[_0xf49d('0x19')],_0x3e0801=_0x30d271[_0xf49d('0x1a')],_0x5a7e5a=_0x30d271[_0xf49d('0x1a')]+_0x30d271[_0xf49d('0x1b')],_0x2927b9;if(_0x5a7e5a>=_0x1d65cd){_0x5a7e5a=_0x1d65cd;_0x2927b9=0xc8;}else{_0x2927b9=0xce;}_0x4c37ae[_0xf49d('0x16')](_0x2927b9);return _0x4c37ae[_0xf49d('0x1c')](_0xf49d('0x1d'),_0x3e0801+'-'+_0x5a7e5a+'/'+_0x1d65cd)['json'](_0x11603e);}return null;};}function patchUpdates(_0x1e16a0){return function(_0x4034fc){try{jsonpatch[_0xf49d('0x1e')](_0x4034fc,_0x1e16a0,!![]);}catch(_0x416a9f){return BPromise[_0xf49d('0x1f')](_0x416a9f);}return _0x4034fc[_0xf49d('0x20')]();};}function saveUpdates(_0x199f35,_0x3752e8){return function(_0x641aa2){if(_0x641aa2){return _0x641aa2[_0xf49d('0x21')](_0x199f35)[_0xf49d('0x22')](function(_0x522249){return _0x522249;});}return null;};}function removeEntity(_0x57aa50,_0x2cf806){return function(_0x15bdcb){if(_0x15bdcb){return _0x15bdcb['destroy']()['then'](function(){_0x57aa50[_0xf49d('0x16')](0xcc)[_0xf49d('0x17')]();});}};}function handleEntityNotFound(_0x5cce78,_0x58c1e7){return function(_0x9363f3){if(!_0x9363f3){_0x5cce78['sendStatus'](0x194);}return _0x9363f3;};}function handleError(_0x402097,_0x1285a0){_0x1285a0=_0x1285a0||0x1f4;return function(_0xb8dcf8){logger[_0xf49d('0x23')](_0xb8dcf8['stack']);if(_0xb8dcf8[_0xf49d('0x24')]){delete _0xb8dcf8[_0xf49d('0x24')];}_0x402097[_0xf49d('0x16')](_0x1285a0)[_0xf49d('0x25')](_0xb8dcf8);};}exports[_0xf49d('0x26')]=function(_0x325e60,_0x13a1e7){var _0x3f8892={},_0x475b3c={},_0x42e01f={'count':0x0,'rows':[]};var _0x5dab7b=_['map'](db[_0xf49d('0x27')][_0xf49d('0x28')],function(_0x1832cd){return{'name':_0x1832cd[_0xf49d('0x29')],'type':_0x1832cd[_0xf49d('0x2a')][_0xf49d('0x2b')]};});_0x475b3c[_0xf49d('0x2c')]=_['map'](_0x5dab7b,_0xf49d('0x24'));_0x475b3c[_0xf49d('0x2d')]=_[_0xf49d('0x2e')](_0x325e60[_0xf49d('0x2d')]);_0x475b3c[_0xf49d('0x2f')]=_[_0xf49d('0x30')](_0x475b3c[_0xf49d('0x2c')],_0x475b3c[_0xf49d('0x2d')]);_0x3f8892[_0xf49d('0x31')]=_[_0xf49d('0x30')](_0x475b3c['model'],qs['fields'](_0x325e60[_0xf49d('0x2d')][_0xf49d('0x32')]));_0x3f8892['attributes']=_0x3f8892[_0xf49d('0x31')][_0xf49d('0x33')]?_0x3f8892[_0xf49d('0x31')]:_0x475b3c['model'];if(!_0x325e60[_0xf49d('0x2d')][_0xf49d('0x34')](_0xf49d('0x35'))){_0x3f8892[_0xf49d('0x1b')]=qs[_0xf49d('0x1b')](_0x325e60[_0xf49d('0x2d')][_0xf49d('0x1b')]);_0x3f8892[_0xf49d('0x1a')]=qs['offset'](_0x325e60[_0xf49d('0x2d')][_0xf49d('0x1a')]);}_0x3f8892['order']=qs[_0xf49d('0x36')](_0x325e60[_0xf49d('0x2d')]['sort']);_0x3f8892[_0xf49d('0x37')]=qs[_0xf49d('0x2f')](_['pick'](_0x325e60[_0xf49d('0x2d')],_0x475b3c[_0xf49d('0x2f')]),_0x5dab7b);if(_0x325e60[_0xf49d('0x2d')][_0xf49d('0x38')]){_0x3f8892[_0xf49d('0x37')]=_[_0xf49d('0x39')](_0x3f8892['where'],{'$or':_[_0xf49d('0x3a')](_0x5dab7b,function(_0x3db67f){if(_0x3db67f[_0xf49d('0x2a')]!==_0xf49d('0x3b')){var _0x592608={};_0x592608[_0x3db67f[_0xf49d('0x24')]]={'$like':'%'+_0x325e60[_0xf49d('0x2d')]['filter']+'%'};return _0x592608;}})});}_0x3f8892=_[_0xf49d('0x39')]({},_0x3f8892,_0x325e60[_0xf49d('0x3c')]);var _0x17c3b3={'where':_0x3f8892['where']};return db[_0xf49d('0x27')][_0xf49d('0x19')](_0x17c3b3)['then'](function(_0x2a9f3f){_0x42e01f['count']=_0x2a9f3f;if(_0x325e60['query'][_0xf49d('0x3d')]){_0x3f8892['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0xf49d('0x3e')](_0x3f8892);})[_0xf49d('0x22')](function(_0x69c635){_0x42e01f[_0xf49d('0x3f')]=_0x69c635;return _0x42e01f;})['then'](respondWithFilteredResult(_0x13a1e7,_0x3f8892))['catch'](handleError(_0x13a1e7,null));};exports[_0xf49d('0x40')]=function(_0x1f07cd,_0x29505e){var _0x287d15={'raw':!![],'where':{'id':_0x1f07cd[_0xf49d('0x41')]['id']}},_0x28cf29={};_0x28cf29['model']=_[_0xf49d('0x2e')](db[_0xf49d('0x27')][_0xf49d('0x28')]);_0x28cf29[_0xf49d('0x2d')]=_[_0xf49d('0x2e')](_0x1f07cd[_0xf49d('0x2d')]);_0x28cf29[_0xf49d('0x2f')]=_[_0xf49d('0x30')](_0x28cf29['model'],_0x28cf29[_0xf49d('0x2d')]);_0x287d15[_0xf49d('0x31')]=_['intersection'](_0x28cf29[_0xf49d('0x2c')],qs['fields'](_0x1f07cd[_0xf49d('0x2d')][_0xf49d('0x32')]));_0x287d15['attributes']=_0x287d15[_0xf49d('0x31')][_0xf49d('0x33')]?_0x287d15[_0xf49d('0x31')]:_0x28cf29[_0xf49d('0x2c')];if(_0x1f07cd['query']['includeAll']){_0x287d15[_0xf49d('0x42')]=[{'all':!![]}];}_0x287d15=_[_0xf49d('0x39')]({},_0x287d15,_0x1f07cd[_0xf49d('0x3c')]);return db[_0xf49d('0x27')]['find'](_0x287d15)[_0xf49d('0x22')](handleEntityNotFound(_0x29505e,null))[_0xf49d('0x22')](respondWithResult(_0x29505e,null))[_0xf49d('0x43')](handleError(_0x29505e,null));};exports['create']=function(_0x5951c0,_0x1f8914){return db[_0xf49d('0x27')][_0xf49d('0x44')](_0x5951c0[_0xf49d('0x45')],{})['then'](respondWithResult(_0x1f8914,0xc9))[_0xf49d('0x43')](handleError(_0x1f8914,null));};exports[_0xf49d('0x21')]=function(_0x8002fb,_0x24d4d6){if(_0x8002fb[_0xf49d('0x45')]['id']){delete _0x8002fb[_0xf49d('0x45')]['id'];}return db[_0xf49d('0x27')][_0xf49d('0x46')]({'where':{'id':_0x8002fb[_0xf49d('0x41')]['id']}})[_0xf49d('0x22')](handleEntityNotFound(_0x24d4d6,null))[_0xf49d('0x22')](saveUpdates(_0x8002fb[_0xf49d('0x45')],null))[_0xf49d('0x22')](respondWithResult(_0x24d4d6,null))[_0xf49d('0x43')](handleError(_0x24d4d6,null));};exports['destroy']=function(_0x26f430,_0x45f2b0){return db[_0xf49d('0x27')][_0xf49d('0x46')]({'where':{'id':_0x26f430[_0xf49d('0x41')]['id']}})[_0xf49d('0x22')](handleEntityNotFound(_0x45f2b0,null))['then'](removeEntity(_0x45f2b0,null))[_0xf49d('0x43')](handleError(_0x45f2b0,null));};exports[_0xf49d('0x47')]=function(_0x599ccd,_0x273afb){return db[_0xf49d('0x27')]['describe']()[_0xf49d('0x22')](respondWithResult(_0x273afb,null))['catch'](handleError(_0x273afb,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index a9b393c..a402b84 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 _0xd72a=['rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','../../config/logger','api','moment','request-promise','path'];(function(_0x32fab5,_0x1c3ea6){var _0x1983ea=function(_0x2c2289){while(--_0x2c2289){_0x32fab5['push'](_0x32fab5['shift']());}};_0x1983ea(++_0x1c3ea6);}(_0xd72a,0x7f));var _0xad72=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xd72a[_0x1694f5];return _0x5b4321;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xad72('0x0'))(_0xad72('0x1'));var moment=require(_0xad72('0x2'));var BPromise=require('bluebird');var rp=require(_0xad72('0x3'));var fs=require('fs');var path=require(_0xad72('0x4'));var rimraf=require(_0xad72('0x5'));var config=require(_0xad72('0x6'));var attributes=require(_0xad72('0x7'));module[_0xad72('0x8')]=function(_0x536988,_0x5be9cd){return _0x536988[_0xad72('0x9')](_0xad72('0xa'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xad72('0xb'),'fields':[_0xad72('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x834f=['request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','lodash','api','moment','bluebird'];(function(_0x237f8b,_0xc5eddb){var _0x423f94=function(_0x1f18f9){while(--_0x1f18f9){_0x237f8b['push'](_0x237f8b['shift']());}};_0x423f94(++_0xc5eddb);}(_0x834f,0x1ea));var _0xf834=function(_0x25fc1c,_0x3c0d23){_0x25fc1c=_0x25fc1c-0x0;var _0x4deef7=_0x834f[_0x25fc1c];return _0x4deef7;};'use strict';var _=require(_0xf834('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf834('0x1'));var moment=require(_0xf834('0x2'));var BPromise=require(_0xf834('0x3'));var rp=require(_0xf834('0x4'));var fs=require('fs');var path=require(_0xf834('0x5'));var rimraf=require(_0xf834('0x6'));var config=require(_0xf834('0x7'));var attributes=require(_0xf834('0x8'));module[_0xf834('0x9')]=function(_0x15f9c3,_0x49e358){return _0x15f9c3[_0xf834('0xa')](_0xf834('0xb'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xf834('0xc'),'fields':[_0xf834('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index f9b9ff4..76b595d 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 _0x92ab=['code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0xfde968,_0x3f9dfc){var _0x4038bd=function(_0x3fac38){while(--_0x3fac38){_0xfde968['push'](_0xfde968['shift']());}};_0x4038bd(++_0x3f9dfc);}(_0x92ab,0x89));var _0xb92a=function(_0xa3bde4,_0x20568e){_0xa3bde4=_0xa3bde4-0x0;var _0x19214a=_0x92ab[_0xa3bde4];return _0x19214a;};'use strict';var _=require(_0xb92a('0x0'));var util=require('util');var moment=require(_0xb92a('0x1'));var BPromise=require('bluebird');var rs=require(_0xb92a('0x2'));var fs=require('fs');var Redis=require(_0xb92a('0x3'));var db=require(_0xb92a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb92a('0x5'))(_0xb92a('0x6'));var config=require(_0xb92a('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xcd2769,_0x3c77fa,_0x1d3a73){return new BPromise(function(_0x342bd2,_0x3ad1ca){return client[_0xb92a('0x8')](_0xcd2769,_0x1d3a73)[_0xb92a('0x9')](function(_0x107091){logger['info'](_0xb92a('0xa'),_0x3c77fa,_0xb92a('0xb'));logger[_0xb92a('0xc')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x3c77fa,_0xb92a('0xb'),JSON[_0xb92a('0xd')](_0x107091));if(_0x107091[_0xb92a('0xe')]){if(_0x107091[_0xb92a('0xe')][_0xb92a('0xf')]===0x1f4){logger['error'](_0xb92a('0xa'),_0x3c77fa,_0x107091[_0xb92a('0xe')][_0xb92a('0x10')]);return _0x3ad1ca(_0x107091[_0xb92a('0xe')][_0xb92a('0x10')]);}logger[_0xb92a('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x3c77fa,_0x107091['error'][_0xb92a('0x10')]);return _0x342bd2(_0x107091[_0xb92a('0xe')][_0xb92a('0x10')]);}else{logger['info'](_0xb92a('0xa'),_0x3c77fa,_0xb92a('0xb'));_0x342bd2(_0x107091[_0xb92a('0x11')][_0xb92a('0x10')]);}})[_0xb92a('0x12')](function(_0x3944d5){logger['error'](_0xb92a('0xa'),_0x3c77fa,_0x3944d5);_0x3ad1ca(_0x3944d5);});});} \ No newline at end of file +var _0x476a=['code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0xe76499,_0x300943){var _0x4617fb=function(_0x549695){while(--_0x549695){_0xe76499['push'](_0xe76499['shift']());}};_0x4617fb(++_0x300943);}(_0x476a,0x11b));var _0xa476=function(_0x3c1b24,_0x1eb1a8){_0x3c1b24=_0x3c1b24-0x0;var _0x5c338e=_0x476a[_0x3c1b24];return _0x5c338e;};'use strict';var _=require(_0xa476('0x0'));var util=require(_0xa476('0x1'));var moment=require(_0xa476('0x2'));var BPromise=require(_0xa476('0x3'));var rs=require(_0xa476('0x4'));var fs=require('fs');var Redis=require(_0xa476('0x5'));var db=require(_0xa476('0x6'))['db'];var utils=require(_0xa476('0x7'));var logger=require(_0xa476('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa476('0x9'));var client=jayson[_0xa476('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3399e2,_0x52babc,_0x5cac63){return new BPromise(function(_0x4408c6,_0x58bedc){return client['request'](_0x3399e2,_0x5cac63)[_0xa476('0xb')](function(_0x6f1a44){logger[_0xa476('0xc')](_0xa476('0xd'),_0x52babc,_0xa476('0xe'));logger[_0xa476('0xf')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x52babc,_0xa476('0xe'),JSON['stringify'](_0x6f1a44));if(_0x6f1a44['error']){if(_0x6f1a44[_0xa476('0x10')][_0xa476('0x11')]===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x52babc,_0x6f1a44[_0xa476('0x10')]['message']);return _0x58bedc(_0x6f1a44['error'][_0xa476('0x12')]);}logger['error'](_0xa476('0xd'),_0x52babc,_0x6f1a44[_0xa476('0x10')][_0xa476('0x12')]);return _0x4408c6(_0x6f1a44['error']['message']);}else{logger[_0xa476('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x52babc,_0xa476('0xe'));_0x4408c6(_0x6f1a44[_0xa476('0x13')][_0xa476('0x12')]);}})['catch'](function(_0x16414b){logger['error'](_0xa476('0xd'),_0x52babc,_0x16414b);_0x58bedc(_0x16414b);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index d7691f4..adcf5ba 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 _0x9bcf=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x2fac6e,_0x1815a1){var _0x55a27b=function(_0x1dfd16){while(--_0x1dfd16){_0x2fac6e['push'](_0x2fac6e['shift']());}};_0x55a27b(++_0x1815a1);}(_0x9bcf,0x198));var _0xf9bc=function(_0x427303,_0x5d9aae){_0x427303=_0x427303-0x0;var _0x115d69=_0x9bcf[_0x427303];return _0x115d69;};'use strict';var multer=require(_0xf9bc('0x0'));var util=require(_0xf9bc('0x1'));var path=require(_0xf9bc('0x2'));var timeout=require(_0xf9bc('0x3'));var express=require('express');var router=express[_0xf9bc('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf9bc('0x5'));var config=require(_0xf9bc('0x6'));var controller=require('./faxTransferReport.controller');router[_0xf9bc('0x7')]('/',auth[_0xf9bc('0x8')](),controller[_0xf9bc('0x9')]);router['get'](_0xf9bc('0xa'),auth['isAuthenticated'](),controller[_0xf9bc('0xb')]);router[_0xf9bc('0x7')](_0xf9bc('0xc'),auth[_0xf9bc('0x8')](),controller['show']);router['post']('/',auth[_0xf9bc('0x8')](),controller['create']);router[_0xf9bc('0xd')](_0xf9bc('0xc'),auth[_0xf9bc('0x8')](),controller[_0xf9bc('0xe')]);router[_0xf9bc('0xf')](_0xf9bc('0xc'),auth[_0xf9bc('0x8')](),controller[_0xf9bc('0x10')]);module[_0xf9bc('0x11')]=router; \ No newline at end of file +var _0x284f=['exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','show','put','/:id','update','delete','destroy'];(function(_0x422724,_0x1242d2){var _0x2e6f5f=function(_0x44246b){while(--_0x44246b){_0x422724['push'](_0x422724['shift']());}};_0x2e6f5f(++_0x1242d2);}(_0x284f,0x71));var _0xf284=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x284f[_0x172747];return _0x509692;};'use strict';var multer=require(_0xf284('0x0'));var util=require('util');var path=require(_0xf284('0x1'));var timeout=require('connect-timeout');var express=require(_0xf284('0x2'));var router=express['Router']();var auth=require(_0xf284('0x3'));var interaction=require(_0xf284('0x4'));var config=require(_0xf284('0x5'));var controller=require('./faxTransferReport.controller');router[_0xf284('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf284('0x6')]('/describe',auth[_0xf284('0x7')](),controller[_0xf284('0x8')]);router['get']('/:id',auth[_0xf284('0x7')](),controller[_0xf284('0x9')]);router['post']('/',auth[_0xf284('0x7')](),controller['create']);router[_0xf284('0xa')](_0xf284('0xb'),auth['isAuthenticated'](),controller[_0xf284('0xc')]);router[_0xf284('0xd')]('/:id',auth[_0xf284('0x7')](),controller[_0xf284('0xe')]);module[_0xf284('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index b5d03c9..9b3ab4e 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 _0x2954=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2954,0xc5));var _0x4295=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x2954[_0x2e4aa2];return _0x5e6092;};'use strict';var multer=require(_0x4295('0x0'));var util=require(_0x4295('0x1'));var path=require(_0x4295('0x2'));var timeout=require(_0x4295('0x3'));var express=require(_0x4295('0x4'));var router=express[_0x4295('0x5')]();var auth=require(_0x4295('0x6'));var interaction=require(_0x4295('0x7'));var config=require('../../config/environment');var controller=require(_0x4295('0x8'));router[_0x4295('0x9')]('/',auth[_0x4295('0xa')](),controller[_0x4295('0xb')]);router[_0x4295('0x9')](_0x4295('0xc'),auth['isAuthenticated'](),controller[_0x4295('0xd')]);router[_0x4295('0x9')](_0x4295('0xe'),auth[_0x4295('0xa')](),controller[_0x4295('0xf')]);router['get'](_0x4295('0x10'),auth['isAuthenticated'](),controller[_0x4295('0x11')]);router[_0x4295('0x12')]('/',auth['isAuthenticated'](),controller[_0x4295('0x13')]);router[_0x4295('0x12')](_0x4295('0xe'),auth[_0x4295('0xa')](),controller[_0x4295('0x14')]);router[_0x4295('0x15')](_0x4295('0xc'),auth[_0x4295('0xa')](),controller[_0x4295('0x16')]);router[_0x4295('0x17')](_0x4295('0xc'),auth[_0x4295('0xa')](),controller[_0x4295('0x18')]);module[_0x4295('0x19')]=router; \ No newline at end of file +var _0x7e26=['update','delete','destroy','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put'];(function(_0x768458,_0x3d0933){var _0x31385c=function(_0xf11dad){while(--_0xf11dad){_0x768458['push'](_0x768458['shift']());}};_0x31385c(++_0x3d0933);}(_0x7e26,0xe0));var _0x67e2=function(_0x4c5f36,_0x4f450b){_0x4c5f36=_0x4c5f36-0x0;var _0x48b16f=_0x7e26[_0x4c5f36];return _0x48b16f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x67e2('0x0'));var timeout=require('connect-timeout');var express=require(_0x67e2('0x1'));var router=express[_0x67e2('0x2')]();var auth=require(_0x67e2('0x3'));var interaction=require(_0x67e2('0x4'));var config=require(_0x67e2('0x5'));var controller=require('./intDeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x67e2('0x6')]);router['get'](_0x67e2('0x7'),auth[_0x67e2('0x8')](),controller[_0x67e2('0x9')]);router['get'](_0x67e2('0xa'),auth[_0x67e2('0x8')](),controller[_0x67e2('0xb')]);router['get'](_0x67e2('0xc'),auth[_0x67e2('0x8')](),controller[_0x67e2('0xd')]);router[_0x67e2('0xe')]('/',auth['isAuthenticated'](),controller[_0x67e2('0xf')]);router['post'](_0x67e2('0xa'),auth[_0x67e2('0x8')](),controller[_0x67e2('0x10')]);router[_0x67e2('0x11')](_0x67e2('0x7'),auth[_0x67e2('0x8')](),controller[_0x67e2('0x12')]);router[_0x67e2('0x13')](_0x67e2('0x7'),auth[_0x67e2('0x8')](),controller[_0x67e2('0x14')]);module[_0x67e2('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 965b8d8..5ea18ef 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 _0x0c6b=['sequelize','STRING','ENUM','basic','newTab','integrationTab'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c6b,0x1bc));var _0xb0c6=function(_0x4bcab7,_0x2f7717){_0x4bcab7=_0x4bcab7-0x0;var _0x2f81bd=_0x0c6b[_0x4bcab7];return _0x2f81bd;};'use strict';var Sequelize=require(_0xb0c6('0x0'));module['exports']={'name':{'type':Sequelize[_0xb0c6('0x1')]},'description':{'type':Sequelize[_0xb0c6('0x1')]},'username':{'type':Sequelize[_0xb0c6('0x1')]},'remoteUri':{'type':Sequelize[_0xb0c6('0x1')]},'authType':{'type':Sequelize[_0xb0c6('0x2')](_0xb0c6('0x3')),'defaultValue':_0xb0c6('0x3')},'password':{'type':Sequelize[_0xb0c6('0x1')]},'consumerKey':{'type':Sequelize[_0xb0c6('0x1')]},'consumerSecret':{'type':Sequelize[_0xb0c6('0x1')]},'token':{'type':Sequelize[_0xb0c6('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0xb0c6('0x4')),'defaultValue':_0xb0c6('0x5')}}; \ No newline at end of file +var _0x23a3=['integrationTab','STRING','ENUM','basic'];(function(_0x66c571,_0x8681e3){var _0x4c7b8e=function(_0x252256){while(--_0x252256){_0x66c571['push'](_0x66c571['shift']());}};_0x4c7b8e(++_0x8681e3);}(_0x23a3,0x131));var _0x323a=function(_0x5c80c1,_0x4f80ca){_0x5c80c1=_0x5c80c1-0x0;var _0xb74ac=_0x23a3[_0x5c80c1];return _0xb74ac;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x323a('0x0')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x323a('0x0')]},'authType':{'type':Sequelize[_0x323a('0x1')](_0x323a('0x2')),'defaultValue':_0x323a('0x2')},'password':{'type':Sequelize[_0x323a('0x0')]},'consumerKey':{'type':Sequelize[_0x323a('0x0')]},'consumerSecret':{'type':Sequelize[_0x323a('0x0')]},'token':{'type':Sequelize[_0x323a('0x0')]},'tokenSecret':{'type':Sequelize[_0x323a('0x0')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x323a('0x1')](_0x323a('0x3'),'newTab'),'defaultValue':_0x323a('0x3')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index bff191d..d85d007 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 _0x8d90=['query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','params','includeAll','find','create','body','getConfigurations','findOne','DeskConfiguration','rawAttributes','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','username','consumerSecret','token','tokenSecret','substring','GET','format','%s/custom_fields','application/json','authType','basic','headers','Authorization','Basic\x20%s','toString','base64','_embedded','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','DeskAccount','type','key'];(function(_0x482815,_0x3601b1){var _0x272d11=function(_0x414e63){while(--_0x414e63){_0x482815['push'](_0x482815['shift']());}};_0x272d11(++_0x3601b1);}(_0x8d90,0x1b3));var _0x08d9=function(_0x47cf44,_0x4bb1bb){_0x47cf44=_0x47cf44-0x0;var _0x266445=_0x8d90[_0x47cf44];return _0x266445;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x08d9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x08d9('0x1'));var jsonpatch=require(_0x08d9('0x2'));var rp=require(_0x08d9('0x3'));var moment=require(_0x08d9('0x4'));var BPromise=require(_0x08d9('0x5'));var Mustache=require(_0x08d9('0x6'));var util=require('util');var path=require(_0x08d9('0x7'));var sox=require(_0x08d9('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x08d9('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x08d9('0xa'));var toCsv=require(_0x08d9('0xb'));var querystring=require(_0x08d9('0xc'));var Papa=require(_0x08d9('0xd'));var Redis=require(_0x08d9('0xe'));var authService=require(_0x08d9('0xf'));var qs=require(_0x08d9('0x10'));var as=require(_0x08d9('0x11'));var hardwareService=require(_0x08d9('0x12'));var logger=require(_0x08d9('0x13'))('api');var utils=require(_0x08d9('0x14'));var config=require(_0x08d9('0x15'));var licenseUtil=require(_0x08d9('0x16'));var db=require(_0x08d9('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x08d9('0x18'));var client=jayson[_0x08d9('0x19')][_0x08d9('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x49f254,_0x3df8ec,_0x5b1f2e,_0x2e2e30){return new BPromise(function(_0x411c57,_0x2eb95b){var _0x228040=_0x2e2e30||client;return _0x228040[_0x08d9('0x1b')](_0x49f254,_0x5b1f2e)[_0x08d9('0x1c')](function(_0x3c37b2){logger['info'](_0x08d9('0x1d'),_0x3df8ec,_0x08d9('0x1e'));logger[_0x08d9('0x1f')](_0x08d9('0x20'),_0x3df8ec,'request\x20sent',JSON[_0x08d9('0x21')](_0x3c37b2));if(_0x3c37b2['error']){if(_0x3c37b2['error']['code']===0x1f4){logger[_0x08d9('0x22')](_0x08d9('0x1d'),_0x3df8ec,_0x3c37b2['error'][_0x08d9('0x23')]);return _0x2eb95b(_0x3c37b2[_0x08d9('0x22')][_0x08d9('0x23')]);}logger[_0x08d9('0x22')](_0x08d9('0x1d'),_0x3df8ec,_0x3c37b2[_0x08d9('0x22')][_0x08d9('0x23')]);return _0x411c57(_0x3c37b2['error'][_0x08d9('0x23')]);}else{logger['info'](_0x08d9('0x1d'),_0x3df8ec,_0x08d9('0x1e'));_0x411c57(_0x3c37b2[_0x08d9('0x24')]['message']);}})[_0x08d9('0x25')](function(_0x56f539){logger[_0x08d9('0x22')](_0x08d9('0x1d'),_0x3df8ec,_0x56f539);_0x2eb95b(_0x56f539);});});}function respondWithStatusCode(_0x5cb337,_0x4991b9){_0x4991b9=_0x4991b9||0xcc;return function(_0x41f9ad){if(_0x41f9ad){return _0x5cb337[_0x08d9('0x26')](_0x4991b9);}return _0x5cb337[_0x08d9('0x27')](_0x4991b9)[_0x08d9('0x28')]();};}function respondWithResult(_0x1bbbf9,_0x4a2251){_0x4a2251=_0x4a2251||0xc8;return function(_0x584640){if(_0x584640){return _0x1bbbf9['status'](_0x4a2251)[_0x08d9('0x29')](_0x584640);}};}function respondWithFilteredResult(_0x47492f,_0x57cfee){return function(_0x48a5c2){if(_0x48a5c2){var _0x3b3b48=_0x48a5c2['count'],_0xa84c=_0x57cfee[_0x08d9('0x2a')],_0x40d562=_0x57cfee[_0x08d9('0x2a')]+_0x57cfee['limit'],_0x29c550;if(_0x40d562>=_0x3b3b48){_0x40d562=_0x3b3b48;_0x29c550=0xc8;}else{_0x29c550=0xce;}_0x47492f[_0x08d9('0x27')](_0x29c550);return _0x47492f[_0x08d9('0x2b')](_0x08d9('0x2c'),_0xa84c+'-'+_0x40d562+'/'+_0x3b3b48)[_0x08d9('0x29')](_0x48a5c2);}return null;};}function patchUpdates(_0x5b4cf1){return function(_0x4e29b6){try{jsonpatch['apply'](_0x4e29b6,_0x5b4cf1,!![]);}catch(_0x92f575){return BPromise[_0x08d9('0x2d')](_0x92f575);}return _0x4e29b6[_0x08d9('0x2e')]();};}function saveUpdates(_0x2c891d,_0x3aaaa4){return function(_0xe567b7){if(_0xe567b7){return _0xe567b7[_0x08d9('0x2f')](_0x2c891d)[_0x08d9('0x1c')](function(_0x31ba8b){return _0x31ba8b;});}return null;};}function removeEntity(_0x3f4f29,_0x2572d8){return function(_0x235e8d){if(_0x235e8d){return _0x235e8d[_0x08d9('0x30')]()[_0x08d9('0x1c')](function(){_0x3f4f29['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12389c,_0x1143e9){return function(_0xd5e66b){if(!_0xd5e66b){_0x12389c[_0x08d9('0x26')](0x194);}return _0xd5e66b;};}function handleError(_0x3c25ef,_0x3f6f32){_0x3f6f32=_0x3f6f32||0x1f4;return function(_0x1d4e0b){logger[_0x08d9('0x22')](_0x1d4e0b[_0x08d9('0x31')]);if(_0x1d4e0b[_0x08d9('0x32')]){delete _0x1d4e0b[_0x08d9('0x32')];}_0x3c25ef[_0x08d9('0x27')](_0x3f6f32)[_0x08d9('0x33')](_0x1d4e0b);};}exports[_0x08d9('0x34')]=function(_0x1274b1,_0x257d48){var _0x466a98={},_0x565d5d={},_0x50ef12={'count':0x0,'rows':[]};var _0x4c80a6=_[_0x08d9('0x35')](db[_0x08d9('0x36')]['rawAttributes'],function(_0x13fb84){return{'name':_0x13fb84['fieldName'],'type':_0x13fb84[_0x08d9('0x37')][_0x08d9('0x38')]};});_0x565d5d['model']=_[_0x08d9('0x35')](_0x4c80a6,_0x08d9('0x32'));_0x565d5d[_0x08d9('0x39')]=_[_0x08d9('0x3a')](_0x1274b1['query']);_0x565d5d[_0x08d9('0x3b')]=_['intersection'](_0x565d5d[_0x08d9('0x3c')],_0x565d5d['query']);_0x466a98[_0x08d9('0x3d')]=_[_0x08d9('0x3e')](_0x565d5d[_0x08d9('0x3c')],qs[_0x08d9('0x3f')](_0x1274b1[_0x08d9('0x39')]['fields']));_0x466a98[_0x08d9('0x3d')]=_0x466a98[_0x08d9('0x3d')][_0x08d9('0x40')]?_0x466a98[_0x08d9('0x3d')]:_0x565d5d['model'];if(!_0x1274b1[_0x08d9('0x39')][_0x08d9('0x41')]('nolimit')){_0x466a98[_0x08d9('0x42')]=qs[_0x08d9('0x42')](_0x1274b1[_0x08d9('0x39')][_0x08d9('0x42')]);_0x466a98[_0x08d9('0x2a')]=qs['offset'](_0x1274b1['query']['offset']);}_0x466a98[_0x08d9('0x43')]=qs[_0x08d9('0x44')](_0x1274b1[_0x08d9('0x39')][_0x08d9('0x44')]);_0x466a98[_0x08d9('0x45')]=qs['filters'](_[_0x08d9('0x46')](_0x1274b1['query'],_0x565d5d[_0x08d9('0x3b')]),_0x4c80a6);if(_0x1274b1[_0x08d9('0x39')][_0x08d9('0x47')]){_0x466a98[_0x08d9('0x45')]=_[_0x08d9('0x48')](_0x466a98[_0x08d9('0x45')],{'$or':_['map'](_0x4c80a6,function(_0x39785e){if(_0x39785e[_0x08d9('0x37')]!==_0x08d9('0x49')){var _0x51f04f={};_0x51f04f[_0x39785e[_0x08d9('0x32')]]={'$like':'%'+_0x1274b1['query']['filter']+'%'};return _0x51f04f;}})});}_0x466a98=_['merge']({},_0x466a98,_0x1274b1[_0x08d9('0x4a')]);var _0x3600c2={'where':_0x466a98[_0x08d9('0x45')]};return db[_0x08d9('0x36')][_0x08d9('0x4b')](_0x3600c2)[_0x08d9('0x1c')](function(_0x532e31){_0x50ef12[_0x08d9('0x4b')]=_0x532e31;if(_0x1274b1[_0x08d9('0x39')]['includeAll']){_0x466a98[_0x08d9('0x4c')]=[{'all':!![]}];}return db[_0x08d9('0x36')][_0x08d9('0x4d')](_0x466a98);})[_0x08d9('0x1c')](function(_0x54e619){_0x50ef12[_0x08d9('0x4e')]=_0x54e619;return _0x50ef12;})[_0x08d9('0x1c')](respondWithFilteredResult(_0x257d48,_0x466a98))[_0x08d9('0x25')](handleError(_0x257d48,null));};exports['show']=function(_0x3eaeed,_0x2479b8){var _0x1233e5={'raw':![],'where':{'id':_0x3eaeed[_0x08d9('0x4f')]['id']}},_0xd6923e={};_0xd6923e[_0x08d9('0x3c')]=_[_0x08d9('0x3a')](db['DeskAccount']['rawAttributes']);_0xd6923e[_0x08d9('0x39')]=_[_0x08d9('0x3a')](_0x3eaeed[_0x08d9('0x39')]);_0xd6923e[_0x08d9('0x3b')]=_[_0x08d9('0x3e')](_0xd6923e[_0x08d9('0x3c')],_0xd6923e[_0x08d9('0x39')]);_0x1233e5[_0x08d9('0x3d')]=_[_0x08d9('0x3e')](_0xd6923e[_0x08d9('0x3c')],qs[_0x08d9('0x3f')](_0x3eaeed['query'][_0x08d9('0x3f')]));_0x1233e5[_0x08d9('0x3d')]=_0x1233e5[_0x08d9('0x3d')][_0x08d9('0x40')]?_0x1233e5[_0x08d9('0x3d')]:_0xd6923e[_0x08d9('0x3c')];if(_0x3eaeed['query'][_0x08d9('0x50')]){_0x1233e5[_0x08d9('0x4c')]=[{'all':!![]}];}_0x1233e5=_[_0x08d9('0x48')]({},_0x1233e5,_0x3eaeed[_0x08d9('0x4a')]);return db[_0x08d9('0x36')][_0x08d9('0x51')](_0x1233e5)[_0x08d9('0x1c')](handleEntityNotFound(_0x2479b8,null))[_0x08d9('0x1c')](respondWithResult(_0x2479b8,null))['catch'](handleError(_0x2479b8,null));};exports['create']=function(_0x543bcc,_0x54b04a){return db[_0x08d9('0x36')][_0x08d9('0x52')](_0x543bcc[_0x08d9('0x53')],{})[_0x08d9('0x1c')](respondWithResult(_0x54b04a,0xc9))[_0x08d9('0x25')](handleError(_0x54b04a,null));};exports[_0x08d9('0x2f')]=function(_0x1982ed,_0x8acefc){if(_0x1982ed[_0x08d9('0x53')]['id']){delete _0x1982ed['body']['id'];}return db[_0x08d9('0x36')][_0x08d9('0x51')]({'where':{'id':_0x1982ed['params']['id']}})[_0x08d9('0x1c')](handleEntityNotFound(_0x8acefc,null))[_0x08d9('0x1c')](saveUpdates(_0x1982ed[_0x08d9('0x53')],null))[_0x08d9('0x1c')](respondWithResult(_0x8acefc,null))[_0x08d9('0x25')](handleError(_0x8acefc,null));};exports[_0x08d9('0x30')]=function(_0x259a82,_0x32f877){return db[_0x08d9('0x36')]['find']({'where':{'id':_0x259a82[_0x08d9('0x4f')]['id']}})[_0x08d9('0x1c')](handleEntityNotFound(_0x32f877,null))[_0x08d9('0x1c')](removeEntity(_0x32f877,null))[_0x08d9('0x25')](handleError(_0x32f877,null));};exports[_0x08d9('0x54')]=function(_0x15332d,_0x5d1b49,_0x5d0a90){var _0x3a983f={};var _0x14cda3={};var _0x2aa36b;var _0xc5e32c;return db[_0x08d9('0x36')][_0x08d9('0x55')]({'where':{'id':_0x15332d[_0x08d9('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5d1b49,null))[_0x08d9('0x1c')](function(_0x36486b){if(_0x36486b){_0x2aa36b=_0x36486b;_0x14cda3[_0x08d9('0x3c')]=_['keys'](db[_0x08d9('0x56')][_0x08d9('0x57')]);_0x14cda3[_0x08d9('0x39')]=_[_0x08d9('0x3a')](_0x15332d[_0x08d9('0x39')]);_0x14cda3[_0x08d9('0x3b')]=_[_0x08d9('0x3e')](_0x14cda3[_0x08d9('0x3c')],_0x14cda3[_0x08d9('0x39')]);_0x3a983f['attributes']=_[_0x08d9('0x3e')](_0x14cda3[_0x08d9('0x3c')],qs['fields'](_0x15332d[_0x08d9('0x39')][_0x08d9('0x3f')]));_0x3a983f['attributes']=_0x3a983f[_0x08d9('0x3d')][_0x08d9('0x40')]?_0x3a983f[_0x08d9('0x3d')]:_0x14cda3['model'];_0x3a983f[_0x08d9('0x43')]=qs[_0x08d9('0x44')](_0x15332d['query'][_0x08d9('0x44')]);_0x3a983f[_0x08d9('0x45')]=qs['filters'](_[_0x08d9('0x46')](_0x15332d[_0x08d9('0x39')],_0x14cda3['filters']));if(_0x15332d['query'][_0x08d9('0x47')]){_0x3a983f['where']=_['merge'](_0x3a983f[_0x08d9('0x45')],{'$or':_[_0x08d9('0x35')](_0x3a983f[_0x08d9('0x3d')],function(_0x4911f2){var _0x50f167={};_0x50f167[_0x4911f2]={'$like':'%'+_0x15332d[_0x08d9('0x39')][_0x08d9('0x47')]+'%'};return _0x50f167;})});}_0x3a983f=_[_0x08d9('0x48')]({},_0x3a983f,_0x15332d['options']);return _0x2aa36b['getConfigurations'](_0x3a983f);}})[_0x08d9('0x1c')](function(_0x254b97){if(_0x254b97){_0xc5e32c=_0x254b97[_0x08d9('0x40')];if(!_0x15332d[_0x08d9('0x39')]['hasOwnProperty'](_0x08d9('0x58'))){_0x3a983f[_0x08d9('0x42')]=qs['limit'](_0x15332d['query']['limit']);_0x3a983f[_0x08d9('0x2a')]=qs[_0x08d9('0x2a')](_0x15332d[_0x08d9('0x39')][_0x08d9('0x2a')]);}return _0x2aa36b[_0x08d9('0x54')](_0x3a983f);}})[_0x08d9('0x1c')](function(_0x8fdbff){if(_0x8fdbff){return _0x8fdbff?{'count':_0xc5e32c,'rows':_0x8fdbff}:null;}})[_0x08d9('0x1c')](respondWithResult(_0x5d1b49,null))[_0x08d9('0x25')](handleError(_0x5d1b49,null));};exports[_0x08d9('0x59')]=function(_0xd6a108,_0xcf5d5d,_0x491334){if(_0xd6a108[_0x08d9('0x53')]['id']){delete _0xd6a108['body']['id'];}return db['DeskAccount'][_0x08d9('0x55')]({'where':{'id':_0xd6a108[_0x08d9('0x4f')]['id']}})[_0x08d9('0x1c')](handleEntityNotFound(_0xcf5d5d,null))[_0x08d9('0x1c')](function(_0x434b72){if(_0x434b72){_0xd6a108['body'][_0x08d9('0x5a')]=_0x434b72['id'];_0xd6a108[_0x08d9('0x53')][_0x08d9('0x5b')]=integrations[_0x08d9('0x5c')](_0xd6a108[_0x08d9('0x53')][_0x08d9('0x5d')],_0xd6a108[_0x08d9('0x53')]['type']);_0xd6a108[_0x08d9('0x53')][_0x08d9('0x5e')]=integrations[_0x08d9('0x5f')](_0xd6a108[_0x08d9('0x53')][_0x08d9('0x5d')],_0xd6a108[_0x08d9('0x53')]['type']);return db[_0x08d9('0x56')][_0x08d9('0x52')](_0xd6a108[_0x08d9('0x53')],{'include':[{'model':db[_0x08d9('0x60')],'as':_0x08d9('0x5b')},{'model':db[_0x08d9('0x60')],'as':_0x08d9('0x5e')}]});}return null;})[_0x08d9('0x1c')](respondWithResult(_0xcf5d5d,null))[_0x08d9('0x25')](handleError(_0xcf5d5d,null));};exports[_0x08d9('0x61')]=function(_0x3f1764,_0x10a207,_0x5d13be){var _0x5e1f9a=[{'name':_0x08d9('0x62'),'label':_0x08d9('0x62'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x5a20f5='';return db[_0x08d9('0x36')]['findOne']({'where':{'id':_0x3f1764['params']['id']},'attributes':['id',_0x08d9('0x63'),'authType',_0x08d9('0x64'),'password','consumerKey',_0x08d9('0x65'),_0x08d9('0x66'),_0x08d9('0x67')]})[_0x08d9('0x1c')](handleEntityNotFound(_0x10a207,null))[_0x08d9('0x1c')](function(_0x581fa0){if(_0x581fa0){_0x5a20f5=_0x581fa0[_0x08d9('0x63')];var _0x275c09=_0x5a20f5['slice'](-0x1);if(_0x275c09==='/'){_0x5a20f5=_0x5a20f5[_0x08d9('0x68')](0x0,_0x5a20f5['lastIndexOf'](_0x275c09));}var _0xafaa01={'method':_0x08d9('0x69'),'uri':util[_0x08d9('0x6a')](_0x08d9('0x6b'),_0x5a20f5),'headers':{'Content-Type':_0x08d9('0x6c'),'Accept':_0x08d9('0x6c')},'json':!![]};if(_0x581fa0[_0x08d9('0x6d')]===_0x08d9('0x6e')){_0xafaa01[_0x08d9('0x6f')][_0x08d9('0x70')]=util['format'](_0x08d9('0x71'),new Buffer(util[_0x08d9('0x6a')]('%s:%s',_0x581fa0[_0x08d9('0x64')],_0x581fa0['password']))[_0x08d9('0x72')](_0x08d9('0x73')));}return rp(_0xafaa01)[_0x08d9('0x1c')](function(_0x43963b){return _0x5e1f9a['concat'](_[_0x08d9('0x35')](_0x43963b[_0x08d9('0x74')][_0x08d9('0x75')],function(_0x261208){return{'id':_0x261208[_0x08d9('0x32')],'name':_0x261208[_0x08d9('0x32')],'type':_0x261208['type'],'active':_0x261208[_0x08d9('0x76')],'label':_0x261208[_0x08d9('0x77')],'custom':!![]};}));});}})[_0x08d9('0x1c')](function(_0x5bb0ea){return{'count':_0x5bb0ea[_0x08d9('0x40')],'rows':_0x5bb0ea};})[_0x08d9('0x1c')](respondWithResult(_0x10a207,null))[_0x08d9('0x25')](function(_0xc8d86){var _0x3101ef=_0x3f1764[_0x08d9('0x39')]['test']?0x1f4:_0xc8d86[_0x08d9('0x78')]||0x1f4;logger['error'](_0x08d9('0x79'),_0x08d9('0x61'),_0x3101ef,JSON[_0x08d9('0x21')](_0xc8d86));delete _0xc8d86[_0x08d9('0x32')];if(_0x3101ef===0x191){_0x3101ef=0x190;}_0x10a207[_0x08d9('0x27')](_0x3101ef)['send'](_0x3f1764[_0x08d9('0x39')][_0x08d9('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0xc8d86['statusCode']}:_0xc8d86);});}; \ No newline at end of file +var _0xdc2b=['getConfigurations','findOne','DeskConfiguration','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','base64','_embedded','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','ejs','lodash','squel','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','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','end','stack','name','send','index','map','DeskAccount','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','filters','filter','where','merge','VIRTUAL','count','includeAll','include','catch','show','options','find','create','body','params','destroy'];(function(_0x2e748c,_0x55ec8e){var _0x37e219=function(_0x38c784){while(--_0x38c784){_0x2e748c['push'](_0x2e748c['shift']());}};_0x37e219(++_0x55ec8e);}(_0xdc2b,0x1a0));var _0xbdc2=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xdc2b[_0xac151d];return _0x111dba;};'use strict';var pdf=require(_0xbdc2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbdc2('0x1'));var zipdir=require(_0xbdc2('0x2'));var jsonpatch=require(_0xbdc2('0x3'));var rp=require(_0xbdc2('0x4'));var moment=require(_0xbdc2('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbdc2('0x6'));var path=require(_0xbdc2('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbdc2('0x8'));var fs=require('fs');var _=require(_0xbdc2('0x9'));var squel=require(_0xbdc2('0xa'));var crypto=require(_0xbdc2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbdc2('0xc'));var toCsv=require('to-csv');var querystring=require(_0xbdc2('0xd'));var Papa=require(_0xbdc2('0xe'));var Redis=require(_0xbdc2('0xf'));var authService=require(_0xbdc2('0x10'));var qs=require(_0xbdc2('0x11'));var as=require(_0xbdc2('0x12'));var hardwareService=require(_0xbdc2('0x13'));var logger=require('../../config/logger')(_0xbdc2('0x14'));var utils=require(_0xbdc2('0x15'));var config=require(_0xbdc2('0x16'));var licenseUtil=require(_0xbdc2('0x17'));var db=require(_0xbdc2('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xbdc2('0x19'));var client=jayson[_0xbdc2('0x1a')][_0xbdc2('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2b7520,_0xf1188,_0x431214,_0x4a57a3){return new BPromise(function(_0x14dec6,_0xcc4332){var _0xce4317=_0x4a57a3||client;return _0xce4317[_0xbdc2('0x1c')](_0x2b7520,_0x431214)[_0xbdc2('0x1d')](function(_0x57182a){logger[_0xbdc2('0x1e')](_0xbdc2('0x1f'),_0xf1188,_0xbdc2('0x20'));logger['debug'](_0xbdc2('0x21'),_0xf1188,_0xbdc2('0x20'),JSON[_0xbdc2('0x22')](_0x57182a));if(_0x57182a[_0xbdc2('0x23')]){if(_0x57182a[_0xbdc2('0x23')][_0xbdc2('0x24')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0xf1188,_0x57182a[_0xbdc2('0x23')]['message']);return _0xcc4332(_0x57182a[_0xbdc2('0x23')][_0xbdc2('0x25')]);}logger[_0xbdc2('0x23')]('DeskAccount,\x20%s,\x20%s',_0xf1188,_0x57182a[_0xbdc2('0x23')][_0xbdc2('0x25')]);return _0x14dec6(_0x57182a[_0xbdc2('0x23')][_0xbdc2('0x25')]);}else{logger['info'](_0xbdc2('0x1f'),_0xf1188,'request\x20sent');_0x14dec6(_0x57182a['result'][_0xbdc2('0x25')]);}})['catch'](function(_0x15abc7){logger[_0xbdc2('0x23')](_0xbdc2('0x1f'),_0xf1188,_0x15abc7);_0xcc4332(_0x15abc7);});});}function respondWithStatusCode(_0x1913ff,_0x4d666e){_0x4d666e=_0x4d666e||0xcc;return function(_0xef3553){if(_0xef3553){return _0x1913ff[_0xbdc2('0x26')](_0x4d666e);}return _0x1913ff['status'](_0x4d666e)['end']();};}function respondWithResult(_0x30ba27,_0x241ccd){_0x241ccd=_0x241ccd||0xc8;return function(_0x1c098f){if(_0x1c098f){return _0x30ba27[_0xbdc2('0x27')](_0x241ccd)[_0xbdc2('0x28')](_0x1c098f);}};}function respondWithFilteredResult(_0xe04cab,_0x428cc6){return function(_0x438554){if(_0x438554){var _0x1b6bcd=_0x438554['count'],_0x181277=_0x428cc6[_0xbdc2('0x29')],_0x3676cb=_0x428cc6[_0xbdc2('0x29')]+_0x428cc6['limit'],_0x369ac8;if(_0x3676cb>=_0x1b6bcd){_0x3676cb=_0x1b6bcd;_0x369ac8=0xc8;}else{_0x369ac8=0xce;}_0xe04cab[_0xbdc2('0x27')](_0x369ac8);return _0xe04cab[_0xbdc2('0x2a')](_0xbdc2('0x2b'),_0x181277+'-'+_0x3676cb+'/'+_0x1b6bcd)[_0xbdc2('0x28')](_0x438554);}return null;};}function patchUpdates(_0x5a4983){return function(_0xbbe2e){try{jsonpatch[_0xbdc2('0x2c')](_0xbbe2e,_0x5a4983,!![]);}catch(_0xd6f4dc){return BPromise[_0xbdc2('0x2d')](_0xd6f4dc);}return _0xbbe2e[_0xbdc2('0x2e')]();};}function saveUpdates(_0x27c739,_0x1f9603){return function(_0x187dd2){if(_0x187dd2){return _0x187dd2[_0xbdc2('0x2f')](_0x27c739)[_0xbdc2('0x1d')](function(_0x28ded5){return _0x28ded5;});}return null;};}function removeEntity(_0x2c503b,_0x15e037){return function(_0x3b8b72){if(_0x3b8b72){return _0x3b8b72['destroy']()[_0xbdc2('0x1d')](function(){_0x2c503b['status'](0xcc)[_0xbdc2('0x30')]();});}};}function handleEntityNotFound(_0x384e79,_0x17ea7a){return function(_0x2a38d7){if(!_0x2a38d7){_0x384e79[_0xbdc2('0x26')](0x194);}return _0x2a38d7;};}function handleError(_0x2ff1f2,_0x43da2c){_0x43da2c=_0x43da2c||0x1f4;return function(_0x241dc8){logger[_0xbdc2('0x23')](_0x241dc8[_0xbdc2('0x31')]);if(_0x241dc8[_0xbdc2('0x32')]){delete _0x241dc8[_0xbdc2('0x32')];}_0x2ff1f2[_0xbdc2('0x27')](_0x43da2c)[_0xbdc2('0x33')](_0x241dc8);};}exports[_0xbdc2('0x34')]=function(_0x2c4c42,_0x59c1f9){var _0x4a4949={},_0x3d6547={},_0x1825e0={'count':0x0,'rows':[]};var _0x440d74=_[_0xbdc2('0x35')](db[_0xbdc2('0x36')][_0xbdc2('0x37')],function(_0x44e56f){return{'name':_0x44e56f['fieldName'],'type':_0x44e56f[_0xbdc2('0x38')]['key']};});_0x3d6547[_0xbdc2('0x39')]=_['map'](_0x440d74,_0xbdc2('0x32'));_0x3d6547[_0xbdc2('0x3a')]=_[_0xbdc2('0x3b')](_0x2c4c42['query']);_0x3d6547['filters']=_[_0xbdc2('0x3c')](_0x3d6547['model'],_0x3d6547['query']);_0x4a4949[_0xbdc2('0x3d')]=_[_0xbdc2('0x3c')](_0x3d6547[_0xbdc2('0x39')],qs[_0xbdc2('0x3e')](_0x2c4c42[_0xbdc2('0x3a')][_0xbdc2('0x3e')]));_0x4a4949[_0xbdc2('0x3d')]=_0x4a4949[_0xbdc2('0x3d')][_0xbdc2('0x3f')]?_0x4a4949['attributes']:_0x3d6547[_0xbdc2('0x39')];if(!_0x2c4c42[_0xbdc2('0x3a')]['hasOwnProperty'](_0xbdc2('0x40'))){_0x4a4949['limit']=qs[_0xbdc2('0x41')](_0x2c4c42['query']['limit']);_0x4a4949[_0xbdc2('0x29')]=qs[_0xbdc2('0x29')](_0x2c4c42[_0xbdc2('0x3a')]['offset']);}_0x4a4949[_0xbdc2('0x42')]=qs['sort'](_0x2c4c42[_0xbdc2('0x3a')][_0xbdc2('0x43')]);_0x4a4949['where']=qs[_0xbdc2('0x44')](_['pick'](_0x2c4c42[_0xbdc2('0x3a')],_0x3d6547[_0xbdc2('0x44')]),_0x440d74);if(_0x2c4c42[_0xbdc2('0x3a')][_0xbdc2('0x45')]){_0x4a4949[_0xbdc2('0x46')]=_[_0xbdc2('0x47')](_0x4a4949[_0xbdc2('0x46')],{'$or':_[_0xbdc2('0x35')](_0x440d74,function(_0xc25c11){if(_0xc25c11[_0xbdc2('0x38')]!==_0xbdc2('0x48')){var _0x99854d={};_0x99854d[_0xc25c11[_0xbdc2('0x32')]]={'$like':'%'+_0x2c4c42[_0xbdc2('0x3a')]['filter']+'%'};return _0x99854d;}})});}_0x4a4949=_['merge']({},_0x4a4949,_0x2c4c42['options']);var _0x356488={'where':_0x4a4949[_0xbdc2('0x46')]};return db['DeskAccount'][_0xbdc2('0x49')](_0x356488)['then'](function(_0x15631f){_0x1825e0[_0xbdc2('0x49')]=_0x15631f;if(_0x2c4c42[_0xbdc2('0x3a')][_0xbdc2('0x4a')]){_0x4a4949[_0xbdc2('0x4b')]=[{'all':!![]}];}return db[_0xbdc2('0x36')]['findAll'](_0x4a4949);})[_0xbdc2('0x1d')](function(_0x26c2a6){_0x1825e0['rows']=_0x26c2a6;return _0x1825e0;})[_0xbdc2('0x1d')](respondWithFilteredResult(_0x59c1f9,_0x4a4949))[_0xbdc2('0x4c')](handleError(_0x59c1f9,null));};exports[_0xbdc2('0x4d')]=function(_0x3a3376,_0x591b51){var _0x2c4a43={'raw':![],'where':{'id':_0x3a3376['params']['id']}},_0x3fe583={};_0x3fe583['model']=_['keys'](db['DeskAccount'][_0xbdc2('0x37')]);_0x3fe583['query']=_[_0xbdc2('0x3b')](_0x3a3376[_0xbdc2('0x3a')]);_0x3fe583['filters']=_[_0xbdc2('0x3c')](_0x3fe583[_0xbdc2('0x39')],_0x3fe583[_0xbdc2('0x3a')]);_0x2c4a43[_0xbdc2('0x3d')]=_[_0xbdc2('0x3c')](_0x3fe583[_0xbdc2('0x39')],qs['fields'](_0x3a3376[_0xbdc2('0x3a')][_0xbdc2('0x3e')]));_0x2c4a43[_0xbdc2('0x3d')]=_0x2c4a43[_0xbdc2('0x3d')]['length']?_0x2c4a43[_0xbdc2('0x3d')]:_0x3fe583[_0xbdc2('0x39')];if(_0x3a3376[_0xbdc2('0x3a')][_0xbdc2('0x4a')]){_0x2c4a43['include']=[{'all':!![]}];}_0x2c4a43=_[_0xbdc2('0x47')]({},_0x2c4a43,_0x3a3376[_0xbdc2('0x4e')]);return db[_0xbdc2('0x36')][_0xbdc2('0x4f')](_0x2c4a43)[_0xbdc2('0x1d')](handleEntityNotFound(_0x591b51,null))[_0xbdc2('0x1d')](respondWithResult(_0x591b51,null))[_0xbdc2('0x4c')](handleError(_0x591b51,null));};exports[_0xbdc2('0x50')]=function(_0x549942,_0x264de3){return db[_0xbdc2('0x36')][_0xbdc2('0x50')](_0x549942[_0xbdc2('0x51')],{})[_0xbdc2('0x1d')](respondWithResult(_0x264de3,0xc9))[_0xbdc2('0x4c')](handleError(_0x264de3,null));};exports[_0xbdc2('0x2f')]=function(_0x2cc4a8,_0x1bc938){if(_0x2cc4a8[_0xbdc2('0x51')]['id']){delete _0x2cc4a8[_0xbdc2('0x51')]['id'];}return db[_0xbdc2('0x36')][_0xbdc2('0x4f')]({'where':{'id':_0x2cc4a8[_0xbdc2('0x52')]['id']}})[_0xbdc2('0x1d')](handleEntityNotFound(_0x1bc938,null))[_0xbdc2('0x1d')](saveUpdates(_0x2cc4a8[_0xbdc2('0x51')],null))[_0xbdc2('0x1d')](respondWithResult(_0x1bc938,null))[_0xbdc2('0x4c')](handleError(_0x1bc938,null));};exports[_0xbdc2('0x53')]=function(_0x45f214,_0x37bf59){return db[_0xbdc2('0x36')][_0xbdc2('0x4f')]({'where':{'id':_0x45f214['params']['id']}})[_0xbdc2('0x1d')](handleEntityNotFound(_0x37bf59,null))[_0xbdc2('0x1d')](removeEntity(_0x37bf59,null))[_0xbdc2('0x4c')](handleError(_0x37bf59,null));};exports[_0xbdc2('0x54')]=function(_0xda903c,_0x5610af,_0x3d2fdb){var _0x23ebb6={};var _0x5331c1={};var _0x3eb29d;var _0x47b37f;return db[_0xbdc2('0x36')][_0xbdc2('0x55')]({'where':{'id':_0xda903c[_0xbdc2('0x52')]['id']}})[_0xbdc2('0x1d')](handleEntityNotFound(_0x5610af,null))[_0xbdc2('0x1d')](function(_0x11d768){if(_0x11d768){_0x3eb29d=_0x11d768;_0x5331c1[_0xbdc2('0x39')]=_[_0xbdc2('0x3b')](db[_0xbdc2('0x56')]['rawAttributes']);_0x5331c1['query']=_[_0xbdc2('0x3b')](_0xda903c[_0xbdc2('0x3a')]);_0x5331c1[_0xbdc2('0x44')]=_[_0xbdc2('0x3c')](_0x5331c1[_0xbdc2('0x39')],_0x5331c1[_0xbdc2('0x3a')]);_0x23ebb6[_0xbdc2('0x3d')]=_[_0xbdc2('0x3c')](_0x5331c1['model'],qs[_0xbdc2('0x3e')](_0xda903c[_0xbdc2('0x3a')][_0xbdc2('0x3e')]));_0x23ebb6[_0xbdc2('0x3d')]=_0x23ebb6[_0xbdc2('0x3d')][_0xbdc2('0x3f')]?_0x23ebb6[_0xbdc2('0x3d')]:_0x5331c1[_0xbdc2('0x39')];_0x23ebb6[_0xbdc2('0x42')]=qs['sort'](_0xda903c[_0xbdc2('0x3a')][_0xbdc2('0x43')]);_0x23ebb6[_0xbdc2('0x46')]=qs['filters'](_[_0xbdc2('0x57')](_0xda903c['query'],_0x5331c1[_0xbdc2('0x44')]));if(_0xda903c[_0xbdc2('0x3a')][_0xbdc2('0x45')]){_0x23ebb6['where']=_[_0xbdc2('0x47')](_0x23ebb6[_0xbdc2('0x46')],{'$or':_['map'](_0x23ebb6['attributes'],function(_0x538077){var _0x252977={};_0x252977[_0x538077]={'$like':'%'+_0xda903c['query'][_0xbdc2('0x45')]+'%'};return _0x252977;})});}_0x23ebb6=_['merge']({},_0x23ebb6,_0xda903c[_0xbdc2('0x4e')]);return _0x3eb29d[_0xbdc2('0x54')](_0x23ebb6);}})[_0xbdc2('0x1d')](function(_0xb39802){if(_0xb39802){_0x47b37f=_0xb39802[_0xbdc2('0x3f')];if(!_0xda903c[_0xbdc2('0x3a')][_0xbdc2('0x58')](_0xbdc2('0x40'))){_0x23ebb6[_0xbdc2('0x41')]=qs['limit'](_0xda903c[_0xbdc2('0x3a')][_0xbdc2('0x41')]);_0x23ebb6['offset']=qs[_0xbdc2('0x29')](_0xda903c['query'][_0xbdc2('0x29')]);}return _0x3eb29d[_0xbdc2('0x54')](_0x23ebb6);}})[_0xbdc2('0x1d')](function(_0x296f56){if(_0x296f56){return _0x296f56?{'count':_0x47b37f,'rows':_0x296f56}:null;}})[_0xbdc2('0x1d')](respondWithResult(_0x5610af,null))[_0xbdc2('0x4c')](handleError(_0x5610af,null));};exports[_0xbdc2('0x59')]=function(_0x2c7638,_0x120949,_0xfe4c86){if(_0x2c7638['body']['id']){delete _0x2c7638[_0xbdc2('0x51')]['id'];}return db[_0xbdc2('0x36')][_0xbdc2('0x55')]({'where':{'id':_0x2c7638['params']['id']}})[_0xbdc2('0x1d')](handleEntityNotFound(_0x120949,null))[_0xbdc2('0x1d')](function(_0x92a921){if(_0x92a921){_0x2c7638['body'][_0xbdc2('0x5a')]=_0x92a921['id'];_0x2c7638[_0xbdc2('0x51')][_0xbdc2('0x5b')]=integrations[_0xbdc2('0x5c')](_0x2c7638[_0xbdc2('0x51')][_0xbdc2('0x5d')],_0x2c7638[_0xbdc2('0x51')][_0xbdc2('0x38')]);_0x2c7638[_0xbdc2('0x51')][_0xbdc2('0x5e')]=integrations['getDescriptions'](_0x2c7638[_0xbdc2('0x51')][_0xbdc2('0x5d')],_0x2c7638[_0xbdc2('0x51')]['type']);return db[_0xbdc2('0x56')]['create'](_0x2c7638[_0xbdc2('0x51')],{'include':[{'model':db[_0xbdc2('0x5f')],'as':'Subjects'},{'model':db[_0xbdc2('0x5f')],'as':_0xbdc2('0x5e')}]});}return null;})['then'](respondWithResult(_0x120949,null))['catch'](handleError(_0x120949,null));};exports[_0xbdc2('0x60')]=function(_0x3c5c9f,_0x159655,_0x39ea5c){var _0x3beffa=[{'name':_0xbdc2('0x61'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x1a8abc='';return db['DeskAccount']['findOne']({'where':{'id':_0x3c5c9f['params']['id']},'attributes':['id',_0xbdc2('0x62'),_0xbdc2('0x63'),_0xbdc2('0x64'),_0xbdc2('0x65'),_0xbdc2('0x66'),_0xbdc2('0x67'),_0xbdc2('0x68'),_0xbdc2('0x69')]})['then'](handleEntityNotFound(_0x159655,null))['then'](function(_0xa17761){if(_0xa17761){_0x1a8abc=_0xa17761[_0xbdc2('0x62')];var _0x4b73c1=_0x1a8abc[_0xbdc2('0x6a')](-0x1);if(_0x4b73c1==='/'){_0x1a8abc=_0x1a8abc[_0xbdc2('0x6b')](0x0,_0x1a8abc['lastIndexOf'](_0x4b73c1));}var _0x3bc2fc={'method':_0xbdc2('0x6c'),'uri':util[_0xbdc2('0x6d')](_0xbdc2('0x6e'),_0x1a8abc),'headers':{'Content-Type':_0xbdc2('0x6f'),'Accept':_0xbdc2('0x6f')},'json':!![]};if(_0xa17761[_0xbdc2('0x63')]===_0xbdc2('0x70')){_0x3bc2fc[_0xbdc2('0x71')][_0xbdc2('0x72')]=util[_0xbdc2('0x6d')](_0xbdc2('0x73'),new Buffer(util[_0xbdc2('0x6d')]('%s:%s',_0xa17761[_0xbdc2('0x64')],_0xa17761[_0xbdc2('0x65')]))['toString'](_0xbdc2('0x74')));}return rp(_0x3bc2fc)[_0xbdc2('0x1d')](function(_0x2cf43f){return _0x3beffa['concat'](_[_0xbdc2('0x35')](_0x2cf43f[_0xbdc2('0x75')][_0xbdc2('0x76')],function(_0x458bf4){return{'id':_0x458bf4['name'],'name':_0x458bf4[_0xbdc2('0x32')],'type':_0x458bf4['type'],'active':_0x458bf4[_0xbdc2('0x77')],'label':_0x458bf4[_0xbdc2('0x78')],'custom':!![]};}));});}})[_0xbdc2('0x1d')](function(_0x5ae733){return{'count':_0x5ae733[_0xbdc2('0x3f')],'rows':_0x5ae733};})['then'](respondWithResult(_0x159655,null))[_0xbdc2('0x4c')](function(_0x302c2c){var _0x30aad7=_0x3c5c9f[_0xbdc2('0x3a')]['test']?0x1f4:_0x302c2c[_0xbdc2('0x79')]||0x1f4;logger[_0xbdc2('0x23')](_0xbdc2('0x7a'),_0xbdc2('0x60'),_0x30aad7,JSON[_0xbdc2('0x22')](_0x302c2c));delete _0x302c2c['name'];if(_0x30aad7===0x191){_0x30aad7=0x190;}_0x159655[_0xbdc2('0x27')](_0x30aad7)['send'](_0x3c5c9f[_0xbdc2('0x3a')][_0xbdc2('0x7b')]?{'message':_0xbdc2('0x7c'),'statusCode':_0x302c2c[_0xbdc2('0x79')]}:_0x302c2c);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 5cc7ae9..b4c8302 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 _0xe7ea=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x5b3c61,_0x3eb2aa){var _0x153389=function(_0x2a1a99){while(--_0x2a1a99){_0x5b3c61['push'](_0x5b3c61['shift']());}};_0x153389(++_0x3eb2aa);}(_0xe7ea,0x71));var _0xae7e=function(_0x1b862a,_0x3e03af){_0x1b862a=_0x1b862a-0x0;var _0x1725fb=_0xe7ea[_0x1b862a];return _0x1725fb;};'use strict';var _=require(_0xae7e('0x0'));var util=require(_0xae7e('0x1'));var logger=require(_0xae7e('0x2'))(_0xae7e('0x3'));var moment=require(_0xae7e('0x4'));var BPromise=require(_0xae7e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xae7e('0x6'));var config=require(_0xae7e('0x7'));var attributes=require(_0xae7e('0x8'));var integrations=require(_0xae7e('0x9'));module[_0xae7e('0xa')]=function(_0x400648,_0xe2f2d1){return _0x400648[_0xae7e('0xb')]('DeskAccount',attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa066=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','util'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa066,0xe0));var _0x6a06=function(_0x1c8c07,_0x2579af){_0x1c8c07=_0x1c8c07-0x0;var _0x4aa88f=_0xa066[_0x1c8c07];return _0x4aa88f;};'use strict';var _=require('lodash');var util=require(_0x6a06('0x0'));var logger=require(_0x6a06('0x1'))(_0x6a06('0x2'));var moment=require(_0x6a06('0x3'));var BPromise=require(_0x6a06('0x4'));var rp=require(_0x6a06('0x5'));var fs=require('fs');var path=require(_0x6a06('0x6'));var rimraf=require(_0x6a06('0x7'));var config=require(_0x6a06('0x8'));var attributes=require(_0x6a06('0x9'));var integrations=require(_0x6a06('0xa'));module[_0x6a06('0xb')]=function(_0x2b0cdd,_0x285caf){return _0x2b0cdd[_0x6a06('0xc')](_0x6a06('0xd'),attributes,{'tableName':_0x6a06('0xe'),'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 2b77c87..2111694 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 _0x05ef=['http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','raw','options','where','attributes','limit','map','include','model','ShowDeskAccount','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x3b87f4,_0x112243){var _0x63d16e=function(_0x3e7323){while(--_0x3e7323){_0x3b87f4['push'](_0x3b87f4['shift']());}};_0x63d16e(++_0x112243);}(_0x05ef,0x86));var _0xf05e=function(_0x43279f,_0x241e73){_0x43279f=_0x43279f-0x0;var _0x3e1093=_0x05ef[_0x43279f];return _0x3e1093;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf05e('0x0'));var BPromise=require(_0xf05e('0x1'));var rs=require(_0xf05e('0x2'));var fs=require('fs');var Redis=require(_0xf05e('0x3'));var db=require(_0xf05e('0x4'))['db'];var utils=require(_0xf05e('0x5'));var logger=require(_0xf05e('0x6'))('rpc');var config=require(_0xf05e('0x7'));var jayson=require(_0xf05e('0x8'));var client=jayson[_0xf05e('0x9')][_0xf05e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2eb73b,_0x333c72,_0x52bf5e){return new BPromise(function(_0x25fee6,_0x477102){return client[_0xf05e('0xb')](_0x2eb73b,_0x52bf5e)[_0xf05e('0xc')](function(_0x319152){logger[_0xf05e('0xd')](_0xf05e('0xe'),_0x333c72,_0xf05e('0xf'));logger[_0xf05e('0x10')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x333c72,_0xf05e('0xf'),JSON[_0xf05e('0x11')](_0x319152));if(_0x319152['error']){if(_0x319152[_0xf05e('0x12')][_0xf05e('0x13')]===0x1f4){logger[_0xf05e('0x12')](_0xf05e('0xe'),_0x333c72,_0x319152['error']['message']);return _0x477102(_0x319152['error'][_0xf05e('0x14')]);}logger[_0xf05e('0x12')](_0xf05e('0xe'),_0x333c72,_0x319152[_0xf05e('0x12')][_0xf05e('0x14')]);return _0x25fee6(_0x319152['error'][_0xf05e('0x14')]);}else{logger[_0xf05e('0xd')](_0xf05e('0xe'),_0x333c72,_0xf05e('0xf'));_0x25fee6(_0x319152[_0xf05e('0x15')][_0xf05e('0x14')]);}})[_0xf05e('0x16')](function(_0x554990){logger[_0xf05e('0x12')](_0xf05e('0xe'),_0x333c72,_0x554990);_0x477102(_0x554990);});});}exports[_0xf05e('0x17')]=function(_0x1701a3){var _0x49584e=this;return new Promise(function(_0x57b378,_0x1d0f42){return db[_0xf05e('0x18')][_0xf05e('0x19')]({'raw':_0x1701a3['options']?_0x1701a3['options'][_0xf05e('0x1a')]===undefined?!![]:![]:!![],'where':_0x1701a3[_0xf05e('0x1b')]?_0x1701a3[_0xf05e('0x1b')][_0xf05e('0x1c')]||null:null,'attributes':_0x1701a3[_0xf05e('0x1b')]?_0x1701a3['options'][_0xf05e('0x1d')]||null:null,'limit':_0x1701a3[_0xf05e('0x1b')]?_0x1701a3[_0xf05e('0x1b')][_0xf05e('0x1e')]||null:null,'include':_0x1701a3[_0xf05e('0x1b')]?_0x1701a3[_0xf05e('0x1b')]['include']?_[_0xf05e('0x1f')](_0x1701a3['options'][_0xf05e('0x20')],function(_0x4e450e){return{'model':db[_0x4e450e[_0xf05e('0x21')]],'as':_0x4e450e['as'],'attributes':_0x4e450e[_0xf05e('0x1d')],'include':_0x4e450e[_0xf05e('0x20')]?_[_0xf05e('0x1f')](_0x4e450e[_0xf05e('0x20')],function(_0x472977){return{'model':db[_0x472977[_0xf05e('0x21')]],'as':_0x472977['as'],'attributes':_0x472977[_0xf05e('0x1d')],'include':_0x472977[_0xf05e('0x20')]?_[_0xf05e('0x1f')](_0x472977[_0xf05e('0x20')],function(_0x5f413e){return{'model':db[_0x5f413e[_0xf05e('0x21')]],'as':_0x5f413e['as'],'attributes':_0x5f413e[_0xf05e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf05e('0xc')](function(_0x489af2){logger[_0xf05e('0xd')]('GetDeskAccount',_0x1701a3);logger[_0xf05e('0x10')](_0xf05e('0x17'),_0x1701a3,JSON[_0xf05e('0x11')](_0x489af2));_0x57b378(_0x489af2);})[_0xf05e('0x16')](function(_0x469376){logger[_0xf05e('0x12')](_0xf05e('0x17'),_0x469376[_0xf05e('0x14')],_0x1701a3);_0x1d0f42(_0x49584e[_0xf05e('0x12')](0x1f4,_0x469376[_0xf05e('0x14')]));});});};exports[_0xf05e('0x22')]=function(_0x247eac){var _0x2f72a7=this;return new Promise(function(_0x434c50,_0x10dc75){return db[_0xf05e('0x18')][_0xf05e('0x23')]({'raw':_0x247eac['options']?_0x247eac['options'][_0xf05e('0x1a')]===undefined?!![]:![]:!![],'where':_0x247eac[_0xf05e('0x1b')]?_0x247eac['options'][_0xf05e('0x1c')]||null:null,'attributes':_0x247eac[_0xf05e('0x1b')]?_0x247eac[_0xf05e('0x1b')][_0xf05e('0x1d')]||null:null,'include':_0x247eac[_0xf05e('0x1b')]?_0x247eac[_0xf05e('0x1b')][_0xf05e('0x20')]?_['map'](_0x247eac[_0xf05e('0x1b')][_0xf05e('0x20')],function(_0x9f9785){return{'model':db[_0x9f9785[_0xf05e('0x21')]],'as':_0x9f9785['as'],'attributes':_0x9f9785[_0xf05e('0x1d')],'include':_0x9f9785[_0xf05e('0x20')]?_[_0xf05e('0x1f')](_0x9f9785[_0xf05e('0x20')],function(_0x48d002){return{'model':db[_0x48d002[_0xf05e('0x21')]],'as':_0x48d002['as'],'attributes':_0x48d002[_0xf05e('0x1d')],'include':_0x48d002[_0xf05e('0x20')]?_['map'](_0x48d002[_0xf05e('0x20')],function(_0x202d5b){return{'model':db[_0x202d5b['model']],'as':_0x202d5b['as'],'attributes':_0x202d5b[_0xf05e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf05e('0xc')](function(_0x3498cb){logger[_0xf05e('0xd')](_0xf05e('0x22'),_0x247eac);logger['debug'](_0xf05e('0x22'),_0x247eac,JSON[_0xf05e('0x11')](_0x3498cb));_0x434c50(_0x3498cb);})['catch'](function(_0x328ec8){logger[_0xf05e('0x12')]('ShowDeskAccount',_0x328ec8[_0xf05e('0x14')],_0x247eac);_0x10dc75(_0x2f72a7[_0xf05e('0x12')](0x1f4,_0x328ec8[_0xf05e('0x14')]));});});}; \ No newline at end of file +var _0x8775=['../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetDeskAccount','options','raw','where','limit','map','model','attributes','include','ShowDeskAccount','DeskAccount','find','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x1aa1cf,_0x3744f8){var _0x12dcc3=function(_0xcbcde){while(--_0xcbcde){_0x1aa1cf['push'](_0x1aa1cf['shift']());}};_0x12dcc3(++_0x3744f8);}(_0x8775,0xa4));var _0x5877=function(_0x2cacef,_0xba1573){_0x2cacef=_0x2cacef-0x0;var _0x289ba6=_0x8775[_0x2cacef];return _0x289ba6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5877('0x0'));var BPromise=require(_0x5877('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5877('0x2'));var db=require(_0x5877('0x3'))['db'];var utils=require(_0x5877('0x4'));var logger=require('../../config/logger')(_0x5877('0x5'));var config=require(_0x5877('0x6'));var jayson=require(_0x5877('0x7'));var client=jayson[_0x5877('0x8')][_0x5877('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c0cc2,_0x3339fc,_0x430a68){return new BPromise(function(_0x335599,_0x5ee4b2){return client[_0x5877('0xa')](_0x5c0cc2,_0x430a68)[_0x5877('0xb')](function(_0xf3f516){logger[_0x5877('0xc')](_0x5877('0xd'),_0x3339fc,_0x5877('0xe'));logger[_0x5877('0xf')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x3339fc,'request\x20sent',JSON[_0x5877('0x10')](_0xf3f516));if(_0xf3f516[_0x5877('0x11')]){if(_0xf3f516[_0x5877('0x11')][_0x5877('0x12')]===0x1f4){logger[_0x5877('0x11')](_0x5877('0xd'),_0x3339fc,_0xf3f516['error']['message']);return _0x5ee4b2(_0xf3f516[_0x5877('0x11')][_0x5877('0x13')]);}logger[_0x5877('0x11')]('DeskAccount,\x20%s,\x20%s',_0x3339fc,_0xf3f516['error']['message']);return _0x335599(_0xf3f516[_0x5877('0x11')][_0x5877('0x13')]);}else{logger[_0x5877('0xc')](_0x5877('0xd'),_0x3339fc,_0x5877('0xe'));_0x335599(_0xf3f516[_0x5877('0x14')][_0x5877('0x13')]);}})[_0x5877('0x15')](function(_0x422bea){logger['error']('DeskAccount,\x20%s,\x20%s',_0x3339fc,_0x422bea);_0x5ee4b2(_0x422bea);});});}exports[_0x5877('0x16')]=function(_0x3314e5){var _0x5deb57=this;return new Promise(function(_0x4efb92,_0x44dc02){return db['DeskAccount']['findAll']({'raw':_0x3314e5[_0x5877('0x17')]?_0x3314e5['options'][_0x5877('0x18')]===undefined?!![]:![]:!![],'where':_0x3314e5['options']?_0x3314e5[_0x5877('0x17')][_0x5877('0x19')]||null:null,'attributes':_0x3314e5[_0x5877('0x17')]?_0x3314e5[_0x5877('0x17')]['attributes']||null:null,'limit':_0x3314e5['options']?_0x3314e5['options'][_0x5877('0x1a')]||null:null,'include':_0x3314e5[_0x5877('0x17')]?_0x3314e5[_0x5877('0x17')]['include']?_[_0x5877('0x1b')](_0x3314e5[_0x5877('0x17')]['include'],function(_0x501af9){return{'model':db[_0x501af9[_0x5877('0x1c')]],'as':_0x501af9['as'],'attributes':_0x501af9[_0x5877('0x1d')],'include':_0x501af9[_0x5877('0x1e')]?_['map'](_0x501af9['include'],function(_0x129f39){return{'model':db[_0x129f39[_0x5877('0x1c')]],'as':_0x129f39['as'],'attributes':_0x129f39[_0x5877('0x1d')],'include':_0x129f39[_0x5877('0x1e')]?_[_0x5877('0x1b')](_0x129f39['include'],function(_0x30f13e){return{'model':db[_0x30f13e[_0x5877('0x1c')]],'as':_0x30f13e['as'],'attributes':_0x30f13e['attributes']};}):[]};}):[]};}):[]:[]})[_0x5877('0xb')](function(_0x1dac8c){logger['info']('GetDeskAccount',_0x3314e5);logger[_0x5877('0xf')](_0x5877('0x16'),_0x3314e5,JSON[_0x5877('0x10')](_0x1dac8c));_0x4efb92(_0x1dac8c);})['catch'](function(_0x56be5a){logger[_0x5877('0x11')](_0x5877('0x16'),_0x56be5a['message'],_0x3314e5);_0x44dc02(_0x5deb57[_0x5877('0x11')](0x1f4,_0x56be5a[_0x5877('0x13')]));});});};exports[_0x5877('0x1f')]=function(_0x106d4c){var _0x29b830=this;return new Promise(function(_0x2a75ff,_0x297018){return db[_0x5877('0x20')][_0x5877('0x21')]({'raw':_0x106d4c[_0x5877('0x17')]?_0x106d4c['options']['raw']===undefined?!![]:![]:!![],'where':_0x106d4c[_0x5877('0x17')]?_0x106d4c[_0x5877('0x17')][_0x5877('0x19')]||null:null,'attributes':_0x106d4c[_0x5877('0x17')]?_0x106d4c[_0x5877('0x17')][_0x5877('0x1d')]||null:null,'include':_0x106d4c[_0x5877('0x17')]?_0x106d4c['options'][_0x5877('0x1e')]?_['map'](_0x106d4c[_0x5877('0x17')]['include'],function(_0x5ca429){return{'model':db[_0x5ca429[_0x5877('0x1c')]],'as':_0x5ca429['as'],'attributes':_0x5ca429[_0x5877('0x1d')],'include':_0x5ca429[_0x5877('0x1e')]?_['map'](_0x5ca429[_0x5877('0x1e')],function(_0x9d3daf){return{'model':db[_0x9d3daf[_0x5877('0x1c')]],'as':_0x9d3daf['as'],'attributes':_0x9d3daf['attributes'],'include':_0x9d3daf[_0x5877('0x1e')]?_[_0x5877('0x1b')](_0x9d3daf[_0x5877('0x1e')],function(_0xbe0ce6){return{'model':db[_0xbe0ce6['model']],'as':_0xbe0ce6['as'],'attributes':_0xbe0ce6[_0x5877('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5877('0xb')](function(_0x13eb57){logger[_0x5877('0xc')](_0x5877('0x1f'),_0x106d4c);logger[_0x5877('0xf')]('ShowDeskAccount',_0x106d4c,JSON[_0x5877('0x10')](_0x13eb57));_0x2a75ff(_0x13eb57);})[_0x5877('0x15')](function(_0x4d0b62){logger[_0x5877('0x11')](_0x5877('0x1f'),_0x4d0b62[_0x5877('0x13')],_0x106d4c);_0x297018(_0x29b830[_0x5877('0x11')](0x1f4,_0x4d0b62[_0x5877('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index a5333f6..2b530ce 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 _0xda81=['delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update'];(function(_0x91c951,_0x2988ba){var _0xc454d1=function(_0x1d86e8){while(--_0x1d86e8){_0x91c951['push'](_0x91c951['shift']());}};_0xc454d1(++_0x2988ba);}(_0xda81,0x1c3));var _0x1da8=function(_0x2fc973,_0x31d687){_0x2fc973=_0x2fc973-0x0;var _0x5b0a02=_0xda81[_0x2fc973];return _0x5b0a02;};'use strict';var multer=require(_0x1da8('0x0'));var util=require(_0x1da8('0x1'));var path=require(_0x1da8('0x2'));var timeout=require('connect-timeout');var express=require(_0x1da8('0x3'));var router=express[_0x1da8('0x4')]();var auth=require(_0x1da8('0x5'));var interaction=require(_0x1da8('0x6'));var config=require('../../config/environment');var controller=require(_0x1da8('0x7'));router[_0x1da8('0x8')]('/',auth['isAuthenticated'](),controller[_0x1da8('0x9')]);router['get'](_0x1da8('0xa'),auth[_0x1da8('0xb')](),controller[_0x1da8('0xc')]);router[_0x1da8('0x8')](_0x1da8('0xd'),auth[_0x1da8('0xb')](),controller[_0x1da8('0xe')]);router[_0x1da8('0x8')](_0x1da8('0xf'),auth['isAuthenticated'](),controller[_0x1da8('0x10')]);router[_0x1da8('0x8')](_0x1da8('0x11'),auth[_0x1da8('0xb')](),controller[_0x1da8('0x12')]);router['get'](_0x1da8('0x13'),auth['isAuthenticated'](),controller[_0x1da8('0x14')]);router[_0x1da8('0x15')]('/',auth[_0x1da8('0xb')](),controller[_0x1da8('0x16')]);router[_0x1da8('0x15')]('/:id/tags',auth[_0x1da8('0xb')](),controller['setTags']);router[_0x1da8('0x17')](_0x1da8('0xa'),auth[_0x1da8('0xb')](),controller[_0x1da8('0x18')]);router[_0x1da8('0x19')](_0x1da8('0xa'),auth['isAuthenticated'](),controller[_0x1da8('0x1a')]);module[_0x1da8('0x1b')]=router; \ No newline at end of file +var _0x287e=['getDescriptions','post','create','/:id/tags','setTags','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x287e,0x1e3));var _0xe287=function(_0x50d3f8,_0x86680f){_0x50d3f8=_0x50d3f8-0x0;var _0x451524=_0x287e[_0x50d3f8];return _0x451524;};'use strict';var multer=require(_0xe287('0x0'));var util=require(_0xe287('0x1'));var path=require(_0xe287('0x2'));var timeout=require(_0xe287('0x3'));var express=require(_0xe287('0x4'));var router=express[_0xe287('0x5')]();var auth=require(_0xe287('0x6'));var interaction=require(_0xe287('0x7'));var config=require(_0xe287('0x8'));var controller=require('./intDeskConfiguration.controller');router[_0xe287('0x9')]('/',auth[_0xe287('0xa')](),controller['index']);router['get'](_0xe287('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0xe287('0xc'),auth[_0xe287('0xa')](),controller[_0xe287('0xd')]);router[_0xe287('0x9')](_0xe287('0xe'),auth[_0xe287('0xa')](),controller[_0xe287('0xf')]);router[_0xe287('0x9')](_0xe287('0x10'),auth[_0xe287('0xa')](),controller[_0xe287('0x11')]);router[_0xe287('0x9')]('/:id/tags',auth[_0xe287('0xa')](),controller['getTags']);router[_0xe287('0x12')]('/',auth['isAuthenticated'](),controller[_0xe287('0x13')]);router['post'](_0xe287('0x14'),auth[_0xe287('0xa')](),controller[_0xe287('0x15')]);router[_0xe287('0x16')](_0xe287('0xb'),auth['isAuthenticated'](),controller[_0xe287('0x17')]);router['delete'](_0xe287('0xb'),auth[_0xe287('0xa')](),controller['destroy']);module[_0xe287('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index f3220ee..0bbff2a 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 _0x214f=['STRING','exports'];(function(_0x42499a,_0xd4b3e3){var _0x51e2b7=function(_0x4ccff2){while(--_0x4ccff2){_0x42499a['push'](_0x42499a['shift']());}};_0x51e2b7(++_0xd4b3e3);}(_0x214f,0xed));var _0xf214=function(_0x2cfd5f,_0x5d7d31){_0x2cfd5f=_0x2cfd5f-0x0;var _0x31b794=_0x214f[_0x2cfd5f];return _0x31b794;};'use strict';var Sequelize=require('sequelize');module[_0xf214('0x0')]={'name':{'type':Sequelize[_0xf214('0x1')]},'description':{'type':Sequelize[_0xf214('0x1')]}}; \ No newline at end of file +var _0x052e=['STRING','sequelize','exports'];(function(_0x1f895b,_0x4a5193){var _0x5e3da0=function(_0x24e8ee){while(--_0x24e8ee){_0x1f895b['push'](_0x1f895b['shift']());}};_0x5e3da0(++_0x4a5193);}(_0x052e,0xbb));var _0xe052=function(_0xc911b0,_0x4b667a){_0xc911b0=_0xc911b0-0x0;var _0x8c0c77=_0x052e[_0xc911b0];return _0x8c0c77;};'use strict';var Sequelize=require(_0xe052('0x0'));module[_0xe052('0x1')]={'name':{'type':Sequelize[_0xe052('0x2')]},'description':{'type':Sequelize[_0xe052('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 9e389a3..5fd1db6 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 _0x33f8=['debug','stringify','error','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','destroy','end','name','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','limit','order','sort','where','filters','filter','merge','VIRTUAL','include','findAll','show','params','length','includeAll','options','find','create','body','getFields','findOne','nolimit','DeskField','pick','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x2cc9ad,_0x2e47f9){var _0xcddc43=function(_0x3392d9){while(--_0x3392d9){_0x2cc9ad['push'](_0x2cc9ad['shift']());}};_0xcddc43(++_0x2e47f9);}(_0x33f8,0x15d));var _0x833f=function(_0x37d59f,_0x376c39){_0x37d59f=_0x37d59f-0x0;var _0x4d97f6=_0x33f8[_0x37d59f];return _0x4d97f6;};'use strict';var pdf=require(_0x833f('0x0'));var emlformat=require(_0x833f('0x1'));var rimraf=require(_0x833f('0x2'));var zipdir=require(_0x833f('0x3'));var jsonpatch=require(_0x833f('0x4'));var rp=require(_0x833f('0x5'));var moment=require(_0x833f('0x6'));var BPromise=require(_0x833f('0x7'));var Mustache=require('mustache');var util=require(_0x833f('0x8'));var path=require(_0x833f('0x9'));var sox=require(_0x833f('0xa'));var csv=require(_0x833f('0xb'));var ejs=require(_0x833f('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x833f('0xd'));var crypto=require('crypto');var jsforce=require(_0x833f('0xe'));var deskjs=require(_0x833f('0xf'));var toCsv=require(_0x833f('0xb'));var querystring=require(_0x833f('0x10'));var Papa=require(_0x833f('0x11'));var Redis=require(_0x833f('0x12'));var authService=require(_0x833f('0x13'));var qs=require(_0x833f('0x14'));var as=require(_0x833f('0x15'));var hardwareService=require(_0x833f('0x16'));var logger=require(_0x833f('0x17'))('api');var utils=require(_0x833f('0x18'));var config=require(_0x833f('0x19'));var licenseUtil=require(_0x833f('0x1a'));var db=require(_0x833f('0x1b'))['db'];var jayson=require(_0x833f('0x1c'));var client=jayson[_0x833f('0x1d')][_0x833f('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x7733d,_0x3a18c2,_0x12ae0c,_0x481005){return new BPromise(function(_0x39b92c,_0x586746){var _0x3cf60e=_0x481005||client;return _0x3cf60e['request'](_0x7733d,_0x12ae0c)[_0x833f('0x1f')](function(_0x4e3543){logger[_0x833f('0x20')](_0x833f('0x21'),_0x3a18c2,_0x833f('0x22'));logger[_0x833f('0x23')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3a18c2,_0x833f('0x22'),JSON[_0x833f('0x24')](_0x4e3543));if(_0x4e3543[_0x833f('0x25')]){if(_0x4e3543[_0x833f('0x25')]['code']===0x1f4){logger['error'](_0x833f('0x21'),_0x3a18c2,_0x4e3543['error']['message']);return _0x586746(_0x4e3543[_0x833f('0x25')][_0x833f('0x26')]);}logger[_0x833f('0x25')](_0x833f('0x21'),_0x3a18c2,_0x4e3543[_0x833f('0x25')][_0x833f('0x26')]);return _0x39b92c(_0x4e3543[_0x833f('0x25')]['message']);}else{logger['info'](_0x833f('0x21'),_0x3a18c2,'request\x20sent');_0x39b92c(_0x4e3543[_0x833f('0x27')][_0x833f('0x26')]);}})[_0x833f('0x28')](function(_0x5c4040){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x3a18c2,_0x5c4040);_0x586746(_0x5c4040);});});}function respondWithStatusCode(_0x83d341,_0x36d950){_0x36d950=_0x36d950||0xcc;return function(_0xd62846){if(_0xd62846){return _0x83d341[_0x833f('0x29')](_0x36d950);}return _0x83d341[_0x833f('0x2a')](_0x36d950)['end']();};}function respondWithResult(_0x443cf5,_0x1c317a){_0x1c317a=_0x1c317a||0xc8;return function(_0x5b2a25){if(_0x5b2a25){return _0x443cf5[_0x833f('0x2a')](_0x1c317a)[_0x833f('0x2b')](_0x5b2a25);}};}function respondWithFilteredResult(_0x4417be,_0x3b13ed){return function(_0x5ae60e){if(_0x5ae60e){var _0x1717f0=_0x5ae60e[_0x833f('0x2c')],_0x2f7977=_0x3b13ed['offset'],_0x2a88f6=_0x3b13ed[_0x833f('0x2d')]+_0x3b13ed['limit'],_0x228e4f;if(_0x2a88f6>=_0x1717f0){_0x2a88f6=_0x1717f0;_0x228e4f=0xc8;}else{_0x228e4f=0xce;}_0x4417be['status'](_0x228e4f);return _0x4417be[_0x833f('0x2e')](_0x833f('0x2f'),_0x2f7977+'-'+_0x2a88f6+'/'+_0x1717f0)[_0x833f('0x2b')](_0x5ae60e);}return null;};}function patchUpdates(_0x54718d){return function(_0x48682d){try{jsonpatch[_0x833f('0x30')](_0x48682d,_0x54718d,!![]);}catch(_0x267048){return BPromise[_0x833f('0x31')](_0x267048);}return _0x48682d[_0x833f('0x32')]();};}function saveUpdates(_0x1e03e2,_0x32f943){return function(_0x1df77f){if(_0x1df77f){return _0x1df77f['update'](_0x1e03e2)[_0x833f('0x1f')](function(_0x10c287){return _0x10c287;});}return null;};}function removeEntity(_0x2468ac,_0x289c27){return function(_0x2d8157){if(_0x2d8157){return _0x2d8157[_0x833f('0x33')]()['then'](function(){_0x2468ac[_0x833f('0x2a')](0xcc)[_0x833f('0x34')]();});}};}function handleEntityNotFound(_0x41792f,_0x49895a){return function(_0xdcd09b){if(!_0xdcd09b){_0x41792f['sendStatus'](0x194);}return _0xdcd09b;};}function handleError(_0x5e3bf5,_0x280fdb){_0x280fdb=_0x280fdb||0x1f4;return function(_0x200378){logger[_0x833f('0x25')](_0x200378['stack']);if(_0x200378[_0x833f('0x35')]){delete _0x200378['name'];}_0x5e3bf5[_0x833f('0x2a')](_0x280fdb)['send'](_0x200378);};}exports[_0x833f('0x36')]=function(_0x3eef4c,_0x49b869){var _0xe6c194={},_0x4d88b6={},_0x1992a5={'count':0x0,'rows':[]};var _0x5d3d3f=_[_0x833f('0x37')](db[_0x833f('0x38')][_0x833f('0x39')],function(_0x3a343e){return{'name':_0x3a343e[_0x833f('0x3a')],'type':_0x3a343e[_0x833f('0x3b')][_0x833f('0x3c')]};});_0x4d88b6[_0x833f('0x3d')]=_[_0x833f('0x37')](_0x5d3d3f,_0x833f('0x35'));_0x4d88b6[_0x833f('0x3e')]=_[_0x833f('0x3f')](_0x3eef4c[_0x833f('0x3e')]);_0x4d88b6['filters']=_[_0x833f('0x40')](_0x4d88b6[_0x833f('0x3d')],_0x4d88b6[_0x833f('0x3e')]);_0xe6c194['attributes']=_[_0x833f('0x40')](_0x4d88b6['model'],qs[_0x833f('0x41')](_0x3eef4c['query'][_0x833f('0x41')]));_0xe6c194['attributes']=_0xe6c194[_0x833f('0x42')]['length']?_0xe6c194[_0x833f('0x42')]:_0x4d88b6[_0x833f('0x3d')];if(!_0x3eef4c['query'][_0x833f('0x43')]('nolimit')){_0xe6c194[_0x833f('0x44')]=qs[_0x833f('0x44')](_0x3eef4c[_0x833f('0x3e')][_0x833f('0x44')]);_0xe6c194['offset']=qs['offset'](_0x3eef4c['query'][_0x833f('0x2d')]);}_0xe6c194[_0x833f('0x45')]=qs[_0x833f('0x46')](_0x3eef4c['query']['sort']);_0xe6c194[_0x833f('0x47')]=qs[_0x833f('0x48')](_['pick'](_0x3eef4c[_0x833f('0x3e')],_0x4d88b6[_0x833f('0x48')]),_0x5d3d3f);if(_0x3eef4c['query'][_0x833f('0x49')]){_0xe6c194[_0x833f('0x47')]=_[_0x833f('0x4a')](_0xe6c194[_0x833f('0x47')],{'$or':_[_0x833f('0x37')](_0x5d3d3f,function(_0x161182){if(_0x161182[_0x833f('0x3b')]!==_0x833f('0x4b')){var _0x54f290={};_0x54f290[_0x161182[_0x833f('0x35')]]={'$like':'%'+_0x3eef4c['query']['filter']+'%'};return _0x54f290;}})});}_0xe6c194=_[_0x833f('0x4a')]({},_0xe6c194,_0x3eef4c['options']);var _0xf74d10={'where':_0xe6c194[_0x833f('0x47')]};return db[_0x833f('0x38')][_0x833f('0x2c')](_0xf74d10)[_0x833f('0x1f')](function(_0x241ced){_0x1992a5[_0x833f('0x2c')]=_0x241ced;if(_0x3eef4c['query']['includeAll']){_0xe6c194[_0x833f('0x4c')]=[{'all':!![]}];}return db[_0x833f('0x38')][_0x833f('0x4d')](_0xe6c194);})[_0x833f('0x1f')](function(_0x27f883){_0x1992a5['rows']=_0x27f883;return _0x1992a5;})['then'](respondWithFilteredResult(_0x49b869,_0xe6c194))[_0x833f('0x28')](handleError(_0x49b869,null));};exports[_0x833f('0x4e')]=function(_0x20c2cd,_0x523990){var _0x157471={'raw':![],'where':{'id':_0x20c2cd[_0x833f('0x4f')]['id']}},_0x2eebcf={};_0x2eebcf[_0x833f('0x3d')]=_['keys'](db[_0x833f('0x38')][_0x833f('0x39')]);_0x2eebcf['query']=_[_0x833f('0x3f')](_0x20c2cd[_0x833f('0x3e')]);_0x2eebcf[_0x833f('0x48')]=_[_0x833f('0x40')](_0x2eebcf[_0x833f('0x3d')],_0x2eebcf[_0x833f('0x3e')]);_0x157471[_0x833f('0x42')]=_[_0x833f('0x40')](_0x2eebcf[_0x833f('0x3d')],qs['fields'](_0x20c2cd['query'][_0x833f('0x41')]));_0x157471[_0x833f('0x42')]=_0x157471[_0x833f('0x42')][_0x833f('0x50')]?_0x157471['attributes']:_0x2eebcf['model'];if(_0x20c2cd['query'][_0x833f('0x51')]){_0x157471[_0x833f('0x4c')]=[{'all':!![]}];}_0x157471=_['merge']({},_0x157471,_0x20c2cd[_0x833f('0x52')]);return db[_0x833f('0x38')][_0x833f('0x53')](_0x157471)[_0x833f('0x1f')](handleEntityNotFound(_0x523990,null))[_0x833f('0x1f')](respondWithResult(_0x523990,null))[_0x833f('0x28')](handleError(_0x523990,null));};exports[_0x833f('0x54')]=function(_0x1a80c0,_0x308c5c){return db[_0x833f('0x38')][_0x833f('0x54')](_0x1a80c0[_0x833f('0x55')],{})[_0x833f('0x1f')](respondWithResult(_0x308c5c,0xc9))[_0x833f('0x28')](handleError(_0x308c5c,null));};exports['update']=function(_0x286325,_0x51cfda){if(_0x286325['body']['id']){delete _0x286325[_0x833f('0x55')]['id'];}return db[_0x833f('0x38')][_0x833f('0x53')]({'where':{'id':_0x286325[_0x833f('0x4f')]['id']}})[_0x833f('0x1f')](handleEntityNotFound(_0x51cfda,null))[_0x833f('0x1f')](saveUpdates(_0x286325[_0x833f('0x55')],null))[_0x833f('0x1f')](respondWithResult(_0x51cfda,null))[_0x833f('0x28')](handleError(_0x51cfda,null));};exports['destroy']=function(_0x45bd8b,_0xd140ca){return db[_0x833f('0x38')][_0x833f('0x53')]({'where':{'id':_0x45bd8b[_0x833f('0x4f')]['id']}})[_0x833f('0x1f')](handleEntityNotFound(_0xd140ca,null))['then'](removeEntity(_0xd140ca,null))[_0x833f('0x28')](handleError(_0xd140ca,null));};exports[_0x833f('0x56')]=function(_0x32922b,_0x291509,_0x287ff3){var _0x516f3e={};var _0x51bb41={};var _0x55350e;var _0x38641e;return db[_0x833f('0x38')][_0x833f('0x57')]({'where':{'id':_0x32922b[_0x833f('0x4f')]['id']}})[_0x833f('0x1f')](handleEntityNotFound(_0x291509,null))[_0x833f('0x1f')](function(_0x889c47){if(_0x889c47){_0x55350e=_0x889c47;_0x51bb41[_0x833f('0x3d')]=_[_0x833f('0x3f')](db['DeskField'][_0x833f('0x39')]);_0x51bb41[_0x833f('0x3e')]=_['keys'](_0x32922b['query']);_0x51bb41[_0x833f('0x48')]=_[_0x833f('0x40')](_0x51bb41[_0x833f('0x3d')],_0x51bb41[_0x833f('0x3e')]);_0x516f3e['attributes']=_[_0x833f('0x40')](_0x51bb41['model'],qs['fields'](_0x32922b[_0x833f('0x3e')]['fields']));_0x516f3e[_0x833f('0x42')]=_0x516f3e['attributes'][_0x833f('0x50')]?_0x516f3e[_0x833f('0x42')]:_0x51bb41[_0x833f('0x3d')];_0x516f3e[_0x833f('0x45')]=qs[_0x833f('0x46')](_0x32922b['query'][_0x833f('0x46')]);_0x516f3e[_0x833f('0x47')]=qs[_0x833f('0x48')](_['pick'](_0x32922b['query'],_0x51bb41[_0x833f('0x48')]));if(_0x32922b[_0x833f('0x3e')]['filter']){_0x516f3e[_0x833f('0x47')]=_[_0x833f('0x4a')](_0x516f3e['where'],{'$or':_[_0x833f('0x37')](_0x516f3e[_0x833f('0x42')],function(_0x4206a4){var _0x2b51ed={};_0x2b51ed[_0x4206a4]={'$like':'%'+_0x32922b[_0x833f('0x3e')][_0x833f('0x49')]+'%'};return _0x2b51ed;})});}_0x516f3e=_[_0x833f('0x4a')]({},_0x516f3e,_0x32922b['options']);return _0x55350e[_0x833f('0x56')](_0x516f3e);}})[_0x833f('0x1f')](function(_0x4e5dc1){if(_0x4e5dc1){_0x38641e=_0x4e5dc1[_0x833f('0x50')];if(!_0x32922b['query'][_0x833f('0x43')](_0x833f('0x58'))){_0x516f3e[_0x833f('0x44')]=qs[_0x833f('0x44')](_0x32922b[_0x833f('0x3e')][_0x833f('0x44')]);_0x516f3e[_0x833f('0x2d')]=qs[_0x833f('0x2d')](_0x32922b[_0x833f('0x3e')]['offset']);}return _0x55350e['getFields'](_0x516f3e);}})[_0x833f('0x1f')](function(_0x224b1e){if(_0x224b1e){return _0x224b1e?{'count':_0x38641e,'rows':_0x224b1e}:null;}})['then'](respondWithResult(_0x291509,null))[_0x833f('0x28')](handleError(_0x291509,null));};exports['getSubjects']=function(_0x28ffba,_0x2dee3d,_0x300be2){var _0x9be24f={};var _0x34e293={};var _0x5383f0;var _0x41fe4c;return db[_0x833f('0x38')][_0x833f('0x57')]({'where':{'id':_0x28ffba['params']['id']}})[_0x833f('0x1f')](handleEntityNotFound(_0x2dee3d,null))['then'](function(_0x3e9e2d){if(_0x3e9e2d){_0x5383f0=_0x3e9e2d;_0x34e293[_0x833f('0x3d')]=_[_0x833f('0x3f')](db[_0x833f('0x59')][_0x833f('0x39')]);_0x34e293['query']=_[_0x833f('0x3f')](_0x28ffba[_0x833f('0x3e')]);_0x34e293[_0x833f('0x48')]=_[_0x833f('0x40')](_0x34e293[_0x833f('0x3d')],_0x34e293['query']);_0x9be24f[_0x833f('0x42')]=_[_0x833f('0x40')](_0x34e293[_0x833f('0x3d')],qs[_0x833f('0x41')](_0x28ffba[_0x833f('0x3e')][_0x833f('0x41')]));_0x9be24f[_0x833f('0x42')]=_0x9be24f['attributes'][_0x833f('0x50')]?_0x9be24f['attributes']:_0x34e293[_0x833f('0x3d')];_0x9be24f[_0x833f('0x45')]=qs[_0x833f('0x46')](_0x28ffba['query'][_0x833f('0x46')]);_0x9be24f[_0x833f('0x47')]=qs[_0x833f('0x48')](_[_0x833f('0x5a')](_0x28ffba[_0x833f('0x3e')],_0x34e293['filters']));if(_0x28ffba[_0x833f('0x3e')][_0x833f('0x49')]){_0x9be24f[_0x833f('0x47')]=_['merge'](_0x9be24f[_0x833f('0x47')],{'$or':_[_0x833f('0x37')](_0x9be24f[_0x833f('0x42')],function(_0x46bf00){var _0x34c9b8={};_0x34c9b8[_0x46bf00]={'$like':'%'+_0x28ffba['query'][_0x833f('0x49')]+'%'};return _0x34c9b8;})});}_0x9be24f=_[_0x833f('0x4a')]({},_0x9be24f,_0x28ffba['options']);return _0x5383f0[_0x833f('0x5b')](_0x9be24f);}})['then'](function(_0x22a77f){if(_0x22a77f){_0x41fe4c=_0x22a77f[_0x833f('0x50')];if(!_0x28ffba[_0x833f('0x3e')][_0x833f('0x43')]('nolimit')){_0x9be24f[_0x833f('0x44')]=qs[_0x833f('0x44')](_0x28ffba[_0x833f('0x3e')][_0x833f('0x44')]);_0x9be24f[_0x833f('0x2d')]=qs[_0x833f('0x2d')](_0x28ffba[_0x833f('0x3e')][_0x833f('0x2d')]);}return _0x5383f0[_0x833f('0x5b')](_0x9be24f);}})['then'](function(_0xc7a85a){if(_0xc7a85a){return _0xc7a85a?{'count':_0x41fe4c,'rows':_0xc7a85a}:null;}})['then'](respondWithResult(_0x2dee3d,null))['catch'](handleError(_0x2dee3d,null));};exports[_0x833f('0x5c')]=function(_0x23a029,_0xcd8814,_0x15a7bb){var _0x49a3d1={};var _0x59be62={};var _0x37d4a2;var _0x30ea7c;return db[_0x833f('0x38')][_0x833f('0x57')]({'where':{'id':_0x23a029['params']['id']}})[_0x833f('0x1f')](handleEntityNotFound(_0xcd8814,null))[_0x833f('0x1f')](function(_0x3624d1){if(_0x3624d1){_0x37d4a2=_0x3624d1;_0x59be62[_0x833f('0x3d')]=_[_0x833f('0x3f')](db[_0x833f('0x59')]['rawAttributes']);_0x59be62[_0x833f('0x3e')]=_[_0x833f('0x3f')](_0x23a029['query']);_0x59be62[_0x833f('0x48')]=_[_0x833f('0x40')](_0x59be62['model'],_0x59be62['query']);_0x49a3d1['attributes']=_['intersection'](_0x59be62[_0x833f('0x3d')],qs['fields'](_0x23a029[_0x833f('0x3e')][_0x833f('0x41')]));_0x49a3d1['attributes']=_0x49a3d1[_0x833f('0x42')][_0x833f('0x50')]?_0x49a3d1[_0x833f('0x42')]:_0x59be62[_0x833f('0x3d')];_0x49a3d1['order']=qs['sort'](_0x23a029[_0x833f('0x3e')][_0x833f('0x46')]);_0x49a3d1[_0x833f('0x47')]=qs['filters'](_['pick'](_0x23a029['query'],_0x59be62[_0x833f('0x48')]));if(_0x23a029['query'][_0x833f('0x49')]){_0x49a3d1[_0x833f('0x47')]=_[_0x833f('0x4a')](_0x49a3d1[_0x833f('0x47')],{'$or':_[_0x833f('0x37')](_0x49a3d1[_0x833f('0x42')],function(_0x34bee5){var _0x5009c0={};_0x5009c0[_0x34bee5]={'$like':'%'+_0x23a029[_0x833f('0x3e')]['filter']+'%'};return _0x5009c0;})});}_0x49a3d1=_[_0x833f('0x4a')]({},_0x49a3d1,_0x23a029[_0x833f('0x52')]);return _0x37d4a2[_0x833f('0x5c')](_0x49a3d1);}})[_0x833f('0x1f')](function(_0xff7eae){if(_0xff7eae){_0x30ea7c=_0xff7eae[_0x833f('0x50')];if(!_0x23a029[_0x833f('0x3e')][_0x833f('0x43')](_0x833f('0x58'))){_0x49a3d1['limit']=qs[_0x833f('0x44')](_0x23a029['query']['limit']);_0x49a3d1['offset']=qs[_0x833f('0x2d')](_0x23a029['query'][_0x833f('0x2d')]);}return _0x37d4a2['getDescriptions'](_0x49a3d1);}})[_0x833f('0x1f')](function(_0x1cb892){if(_0x1cb892){return _0x1cb892?{'count':_0x30ea7c,'rows':_0x1cb892}:null;}})[_0x833f('0x1f')](respondWithResult(_0xcd8814,null))[_0x833f('0x28')](handleError(_0xcd8814,null));};exports[_0x833f('0x5d')]=function(_0x219c1f,_0x1d2247,_0x68d0e5){var _0x27aa84={};var _0x1be5fd={};var _0x26a6c2;var _0x2aa32a;return db['DeskConfiguration'][_0x833f('0x57')]({'where':{'id':_0x219c1f[_0x833f('0x4f')]['id']}})[_0x833f('0x1f')](handleEntityNotFound(_0x1d2247,null))[_0x833f('0x1f')](function(_0x1b8b5f){if(_0x1b8b5f){_0x26a6c2=_0x1b8b5f;_0x1be5fd[_0x833f('0x3d')]=_[_0x833f('0x3f')](db['Tag'][_0x833f('0x39')]);_0x1be5fd['query']=_[_0x833f('0x3f')](_0x219c1f[_0x833f('0x3e')]);_0x1be5fd['filters']=_['intersection'](_0x1be5fd[_0x833f('0x3d')],_0x1be5fd[_0x833f('0x3e')]);_0x27aa84[_0x833f('0x42')]=_[_0x833f('0x40')](_0x1be5fd[_0x833f('0x3d')],qs[_0x833f('0x41')](_0x219c1f[_0x833f('0x3e')]['fields']));_0x27aa84[_0x833f('0x42')]=_0x27aa84[_0x833f('0x42')][_0x833f('0x50')]?_0x27aa84[_0x833f('0x42')]:_0x1be5fd['model'];_0x27aa84[_0x833f('0x45')]=qs['sort'](_0x219c1f['query'][_0x833f('0x46')]);_0x27aa84['where']=qs[_0x833f('0x48')](_[_0x833f('0x5a')](_0x219c1f[_0x833f('0x3e')],_0x1be5fd[_0x833f('0x48')]));if(_0x219c1f[_0x833f('0x3e')][_0x833f('0x49')]){_0x27aa84[_0x833f('0x47')]=_[_0x833f('0x4a')](_0x27aa84['where'],{'$or':_[_0x833f('0x37')](_0x27aa84[_0x833f('0x42')],function(_0xc83e26){var _0x590fc5={};_0x590fc5[_0xc83e26]={'$like':'%'+_0x219c1f[_0x833f('0x3e')][_0x833f('0x49')]+'%'};return _0x590fc5;})});}_0x27aa84=_[_0x833f('0x4a')]({},_0x27aa84,_0x219c1f[_0x833f('0x52')]);return _0x26a6c2[_0x833f('0x5d')](_0x27aa84);}})[_0x833f('0x1f')](function(_0x405ff7){if(_0x405ff7){_0x2aa32a=_0x405ff7['length'];if(!_0x219c1f[_0x833f('0x3e')][_0x833f('0x43')](_0x833f('0x58'))){_0x27aa84[_0x833f('0x44')]=qs[_0x833f('0x44')](_0x219c1f[_0x833f('0x3e')][_0x833f('0x44')]);_0x27aa84[_0x833f('0x2d')]=qs[_0x833f('0x2d')](_0x219c1f['query']['offset']);}return _0x26a6c2[_0x833f('0x5d')](_0x27aa84);}})[_0x833f('0x1f')](function(_0x3d36c6){if(_0x3d36c6){return _0x3d36c6?{'count':_0x2aa32a,'rows':_0x3d36c6}:null;}})[_0x833f('0x1f')](respondWithResult(_0x1d2247,null))['catch'](handleError(_0x1d2247,null));};exports[_0x833f('0x5e')]=function(_0x1d0118,_0x2cd195,_0xd18c7f){if(_0x1d0118[_0x833f('0x55')]['id']){delete _0x1d0118['body']['id'];}return db[_0x833f('0x38')][_0x833f('0x57')]({'where':{'id':_0x1d0118['params']['id']}})['then'](handleEntityNotFound(_0x2cd195,null))[_0x833f('0x1f')](function(_0x18a709){if(_0x18a709){return _0x18a709[_0x833f('0x5e')](_0x1d0118['body'][_0x833f('0x5f')]||[]);}return null;})[_0x833f('0x1f')](respondWithResult(_0x2cd195,null))[_0x833f('0x28')](handleError(_0x2cd195,null));}; \ No newline at end of file +var _0x50c3=['message','result','status','json','count','offset','set','Content-Range','reject','save','destroy','sendStatus','stack','send','map','DeskConfiguration','rawAttributes','fieldName','type','keys','query','intersection','model','attributes','fields','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','name','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getFields','findOne','DeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x4ea296,_0x362e09){var _0x487e64=function(_0x22e1dc){while(--_0x22e1dc){_0x4ea296['push'](_0x4ea296['shift']());}};_0x487e64(++_0x362e09);}(_0x50c3,0x94));var _0x350c=function(_0x55a828,_0x3ea046){_0x55a828=_0x55a828-0x0;var _0x390ab9=_0x50c3[_0x55a828];return _0x390ab9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x350c('0x0'));var rimraf=require(_0x350c('0x1'));var zipdir=require(_0x350c('0x2'));var jsonpatch=require(_0x350c('0x3'));var rp=require(_0x350c('0x4'));var moment=require(_0x350c('0x5'));var BPromise=require(_0x350c('0x6'));var Mustache=require(_0x350c('0x7'));var util=require(_0x350c('0x8'));var path=require(_0x350c('0x9'));var sox=require('sox');var csv=require(_0x350c('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x350c('0xb'));var squel=require('squel');var crypto=require(_0x350c('0xc'));var jsforce=require(_0x350c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x350c('0xa'));var querystring=require(_0x350c('0xe'));var Papa=require(_0x350c('0xf'));var Redis=require(_0x350c('0x10'));var authService=require(_0x350c('0x11'));var qs=require(_0x350c('0x12'));var as=require(_0x350c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x350c('0x14'))('api');var utils=require(_0x350c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x350c('0x16'));var db=require(_0x350c('0x17'))['db'];var jayson=require(_0x350c('0x18'));var client=jayson[_0x350c('0x19')][_0x350c('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x223798,_0x12d66b,_0x629ace,_0x561578){return new BPromise(function(_0x3b3a17,_0x3f043c){var _0x5d6976=_0x561578||client;return _0x5d6976[_0x350c('0x1b')](_0x223798,_0x629ace)[_0x350c('0x1c')](function(_0x246a24){logger[_0x350c('0x1d')](_0x350c('0x1e'),_0x12d66b,'request\x20sent');logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x12d66b,_0x350c('0x1f'),JSON['stringify'](_0x246a24));if(_0x246a24[_0x350c('0x20')]){if(_0x246a24['error'][_0x350c('0x21')]===0x1f4){logger[_0x350c('0x20')](_0x350c('0x1e'),_0x12d66b,_0x246a24[_0x350c('0x20')][_0x350c('0x22')]);return _0x3f043c(_0x246a24[_0x350c('0x20')][_0x350c('0x22')]);}logger[_0x350c('0x20')](_0x350c('0x1e'),_0x12d66b,_0x246a24[_0x350c('0x20')]['message']);return _0x3b3a17(_0x246a24[_0x350c('0x20')]['message']);}else{logger['info'](_0x350c('0x1e'),_0x12d66b,'request\x20sent');_0x3b3a17(_0x246a24[_0x350c('0x23')][_0x350c('0x22')]);}})['catch'](function(_0x3e8af2){logger[_0x350c('0x20')](_0x350c('0x1e'),_0x12d66b,_0x3e8af2);_0x3f043c(_0x3e8af2);});});}function respondWithStatusCode(_0x2fb394,_0x4e14bd){_0x4e14bd=_0x4e14bd||0xcc;return function(_0x24f2e5){if(_0x24f2e5){return _0x2fb394['sendStatus'](_0x4e14bd);}return _0x2fb394['status'](_0x4e14bd)['end']();};}function respondWithResult(_0x3be545,_0x1c5c4c){_0x1c5c4c=_0x1c5c4c||0xc8;return function(_0x2ff601){if(_0x2ff601){return _0x3be545[_0x350c('0x24')](_0x1c5c4c)[_0x350c('0x25')](_0x2ff601);}};}function respondWithFilteredResult(_0x2641b6,_0x129750){return function(_0x309a21){if(_0x309a21){var _0x43acee=_0x309a21[_0x350c('0x26')],_0x57a16d=_0x129750['offset'],_0x4cb10f=_0x129750[_0x350c('0x27')]+_0x129750['limit'],_0x4e19c4;if(_0x4cb10f>=_0x43acee){_0x4cb10f=_0x43acee;_0x4e19c4=0xc8;}else{_0x4e19c4=0xce;}_0x2641b6[_0x350c('0x24')](_0x4e19c4);return _0x2641b6[_0x350c('0x28')](_0x350c('0x29'),_0x57a16d+'-'+_0x4cb10f+'/'+_0x43acee)[_0x350c('0x25')](_0x309a21);}return null;};}function patchUpdates(_0x3544c7){return function(_0x74246f){try{jsonpatch['apply'](_0x74246f,_0x3544c7,!![]);}catch(_0x402331){return BPromise[_0x350c('0x2a')](_0x402331);}return _0x74246f[_0x350c('0x2b')]();};}function saveUpdates(_0x337ad3,_0x5dde09){return function(_0x537f11){if(_0x537f11){return _0x537f11['update'](_0x337ad3)['then'](function(_0x26201e){return _0x26201e;});}return null;};}function removeEntity(_0x28b474,_0x54376a){return function(_0xa3b0e1){if(_0xa3b0e1){return _0xa3b0e1[_0x350c('0x2c')]()[_0x350c('0x1c')](function(){_0x28b474[_0x350c('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1514c9,_0x233c30){return function(_0x400c1c){if(!_0x400c1c){_0x1514c9[_0x350c('0x2d')](0x194);}return _0x400c1c;};}function handleError(_0x4316b1,_0x58203f){_0x58203f=_0x58203f||0x1f4;return function(_0xbb65c1){logger[_0x350c('0x20')](_0xbb65c1[_0x350c('0x2e')]);if(_0xbb65c1['name']){delete _0xbb65c1['name'];}_0x4316b1[_0x350c('0x24')](_0x58203f)[_0x350c('0x2f')](_0xbb65c1);};}exports['index']=function(_0x37576b,_0x1bdc5b){var _0x47ec3e={},_0x1ba2e9={},_0x13888b={'count':0x0,'rows':[]};var _0x549a94=_[_0x350c('0x30')](db[_0x350c('0x31')][_0x350c('0x32')],function(_0x9a7d51){return{'name':_0x9a7d51[_0x350c('0x33')],'type':_0x9a7d51[_0x350c('0x34')]['key']};});_0x1ba2e9['model']=_[_0x350c('0x30')](_0x549a94,'name');_0x1ba2e9['query']=_[_0x350c('0x35')](_0x37576b[_0x350c('0x36')]);_0x1ba2e9['filters']=_[_0x350c('0x37')](_0x1ba2e9[_0x350c('0x38')],_0x1ba2e9['query']);_0x47ec3e[_0x350c('0x39')]=_[_0x350c('0x37')](_0x1ba2e9[_0x350c('0x38')],qs[_0x350c('0x3a')](_0x37576b['query'][_0x350c('0x3a')]));_0x47ec3e[_0x350c('0x39')]=_0x47ec3e[_0x350c('0x39')]['length']?_0x47ec3e[_0x350c('0x39')]:_0x1ba2e9['model'];if(!_0x37576b['query']['hasOwnProperty'](_0x350c('0x3b'))){_0x47ec3e[_0x350c('0x3c')]=qs['limit'](_0x37576b['query'][_0x350c('0x3c')]);_0x47ec3e[_0x350c('0x27')]=qs[_0x350c('0x27')](_0x37576b['query'][_0x350c('0x27')]);}_0x47ec3e[_0x350c('0x3d')]=qs[_0x350c('0x3e')](_0x37576b[_0x350c('0x36')][_0x350c('0x3e')]);_0x47ec3e[_0x350c('0x3f')]=qs[_0x350c('0x40')](_[_0x350c('0x41')](_0x37576b['query'],_0x1ba2e9[_0x350c('0x40')]),_0x549a94);if(_0x37576b[_0x350c('0x36')]['filter']){_0x47ec3e['where']=_[_0x350c('0x42')](_0x47ec3e[_0x350c('0x3f')],{'$or':_[_0x350c('0x30')](_0x549a94,function(_0x2b3f16){if(_0x2b3f16[_0x350c('0x34')]!==_0x350c('0x43')){var _0x1072b9={};_0x1072b9[_0x2b3f16[_0x350c('0x44')]]={'$like':'%'+_0x37576b[_0x350c('0x36')][_0x350c('0x45')]+'%'};return _0x1072b9;}})});}_0x47ec3e=_[_0x350c('0x42')]({},_0x47ec3e,_0x37576b[_0x350c('0x46')]);var _0x27751a={'where':_0x47ec3e[_0x350c('0x3f')]};return db['DeskConfiguration']['count'](_0x27751a)['then'](function(_0x345511){_0x13888b[_0x350c('0x26')]=_0x345511;if(_0x37576b['query'][_0x350c('0x47')]){_0x47ec3e[_0x350c('0x48')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x350c('0x49')](_0x47ec3e);})[_0x350c('0x1c')](function(_0x204b9a){_0x13888b[_0x350c('0x4a')]=_0x204b9a;return _0x13888b;})[_0x350c('0x1c')](respondWithFilteredResult(_0x1bdc5b,_0x47ec3e))[_0x350c('0x4b')](handleError(_0x1bdc5b,null));};exports[_0x350c('0x4c')]=function(_0x585d0d,_0x49c493){var _0x8dad4e={'raw':![],'where':{'id':_0x585d0d[_0x350c('0x4d')]['id']}},_0x1bb97b={};_0x1bb97b[_0x350c('0x38')]=_['keys'](db[_0x350c('0x31')][_0x350c('0x32')]);_0x1bb97b[_0x350c('0x36')]=_['keys'](_0x585d0d[_0x350c('0x36')]);_0x1bb97b['filters']=_[_0x350c('0x37')](_0x1bb97b[_0x350c('0x38')],_0x1bb97b[_0x350c('0x36')]);_0x8dad4e[_0x350c('0x39')]=_['intersection'](_0x1bb97b['model'],qs[_0x350c('0x3a')](_0x585d0d['query'][_0x350c('0x3a')]));_0x8dad4e[_0x350c('0x39')]=_0x8dad4e[_0x350c('0x39')][_0x350c('0x4e')]?_0x8dad4e['attributes']:_0x1bb97b[_0x350c('0x38')];if(_0x585d0d['query']['includeAll']){_0x8dad4e['include']=[{'all':!![]}];}_0x8dad4e=_[_0x350c('0x42')]({},_0x8dad4e,_0x585d0d[_0x350c('0x46')]);return db[_0x350c('0x31')][_0x350c('0x4f')](_0x8dad4e)[_0x350c('0x1c')](handleEntityNotFound(_0x49c493,null))[_0x350c('0x1c')](respondWithResult(_0x49c493,null))[_0x350c('0x4b')](handleError(_0x49c493,null));};exports[_0x350c('0x50')]=function(_0x1b46cf,_0x27da17){return db[_0x350c('0x31')][_0x350c('0x50')](_0x1b46cf[_0x350c('0x51')],{})[_0x350c('0x1c')](respondWithResult(_0x27da17,0xc9))['catch'](handleError(_0x27da17,null));};exports['update']=function(_0x4d5d01,_0x4bd2c3){if(_0x4d5d01[_0x350c('0x51')]['id']){delete _0x4d5d01['body']['id'];}return db[_0x350c('0x31')][_0x350c('0x4f')]({'where':{'id':_0x4d5d01[_0x350c('0x4d')]['id']}})[_0x350c('0x1c')](handleEntityNotFound(_0x4bd2c3,null))[_0x350c('0x1c')](saveUpdates(_0x4d5d01[_0x350c('0x51')],null))[_0x350c('0x1c')](respondWithResult(_0x4bd2c3,null))[_0x350c('0x4b')](handleError(_0x4bd2c3,null));};exports[_0x350c('0x2c')]=function(_0x148c10,_0x1d19b5){return db[_0x350c('0x31')]['find']({'where':{'id':_0x148c10[_0x350c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1d19b5,null))[_0x350c('0x1c')](removeEntity(_0x1d19b5,null))['catch'](handleError(_0x1d19b5,null));};exports[_0x350c('0x52')]=function(_0x3adb4a,_0x5c4312,_0x3dcea1){var _0x35db03={};var _0x1f4915={};var _0x3b8d2f;var _0x2c1844;return db['DeskConfiguration'][_0x350c('0x53')]({'where':{'id':_0x3adb4a[_0x350c('0x4d')]['id']}})[_0x350c('0x1c')](handleEntityNotFound(_0x5c4312,null))['then'](function(_0x372438){if(_0x372438){_0x3b8d2f=_0x372438;_0x1f4915[_0x350c('0x38')]=_[_0x350c('0x35')](db[_0x350c('0x54')][_0x350c('0x32')]);_0x1f4915['query']=_[_0x350c('0x35')](_0x3adb4a[_0x350c('0x36')]);_0x1f4915[_0x350c('0x40')]=_[_0x350c('0x37')](_0x1f4915[_0x350c('0x38')],_0x1f4915[_0x350c('0x36')]);_0x35db03[_0x350c('0x39')]=_[_0x350c('0x37')](_0x1f4915[_0x350c('0x38')],qs['fields'](_0x3adb4a['query'][_0x350c('0x3a')]));_0x35db03[_0x350c('0x39')]=_0x35db03[_0x350c('0x39')][_0x350c('0x4e')]?_0x35db03[_0x350c('0x39')]:_0x1f4915[_0x350c('0x38')];_0x35db03['order']=qs[_0x350c('0x3e')](_0x3adb4a[_0x350c('0x36')][_0x350c('0x3e')]);_0x35db03['where']=qs['filters'](_['pick'](_0x3adb4a['query'],_0x1f4915['filters']));if(_0x3adb4a[_0x350c('0x36')]['filter']){_0x35db03[_0x350c('0x3f')]=_[_0x350c('0x42')](_0x35db03[_0x350c('0x3f')],{'$or':_[_0x350c('0x30')](_0x35db03[_0x350c('0x39')],function(_0x2d8a7f){var _0xef28c9={};_0xef28c9[_0x2d8a7f]={'$like':'%'+_0x3adb4a[_0x350c('0x36')][_0x350c('0x45')]+'%'};return _0xef28c9;})});}_0x35db03=_[_0x350c('0x42')]({},_0x35db03,_0x3adb4a[_0x350c('0x46')]);return _0x3b8d2f[_0x350c('0x52')](_0x35db03);}})[_0x350c('0x1c')](function(_0x18aa54){if(_0x18aa54){_0x2c1844=_0x18aa54[_0x350c('0x4e')];if(!_0x3adb4a['query'][_0x350c('0x55')](_0x350c('0x3b'))){_0x35db03[_0x350c('0x3c')]=qs[_0x350c('0x3c')](_0x3adb4a[_0x350c('0x36')][_0x350c('0x3c')]);_0x35db03['offset']=qs[_0x350c('0x27')](_0x3adb4a[_0x350c('0x36')]['offset']);}return _0x3b8d2f[_0x350c('0x52')](_0x35db03);}})['then'](function(_0x110c4e){if(_0x110c4e){return _0x110c4e?{'count':_0x2c1844,'rows':_0x110c4e}:null;}})[_0x350c('0x1c')](respondWithResult(_0x5c4312,null))[_0x350c('0x4b')](handleError(_0x5c4312,null));};exports['getSubjects']=function(_0x15867a,_0x5c90d0,_0x5d1d93){var _0x5afda6={};var _0x23b48a={};var _0x16e8f8;var _0x21f888;return db[_0x350c('0x31')]['findOne']({'where':{'id':_0x15867a[_0x350c('0x4d')]['id']}})[_0x350c('0x1c')](handleEntityNotFound(_0x5c90d0,null))[_0x350c('0x1c')](function(_0x308182){if(_0x308182){_0x16e8f8=_0x308182;_0x23b48a[_0x350c('0x38')]=_[_0x350c('0x35')](db[_0x350c('0x54')][_0x350c('0x32')]);_0x23b48a['query']=_[_0x350c('0x35')](_0x15867a['query']);_0x23b48a['filters']=_['intersection'](_0x23b48a[_0x350c('0x38')],_0x23b48a[_0x350c('0x36')]);_0x5afda6[_0x350c('0x39')]=_[_0x350c('0x37')](_0x23b48a[_0x350c('0x38')],qs['fields'](_0x15867a[_0x350c('0x36')][_0x350c('0x3a')]));_0x5afda6[_0x350c('0x39')]=_0x5afda6[_0x350c('0x39')][_0x350c('0x4e')]?_0x5afda6[_0x350c('0x39')]:_0x23b48a[_0x350c('0x38')];_0x5afda6['order']=qs['sort'](_0x15867a[_0x350c('0x36')][_0x350c('0x3e')]);_0x5afda6['where']=qs[_0x350c('0x40')](_[_0x350c('0x41')](_0x15867a['query'],_0x23b48a[_0x350c('0x40')]));if(_0x15867a['query'][_0x350c('0x45')]){_0x5afda6[_0x350c('0x3f')]=_[_0x350c('0x42')](_0x5afda6[_0x350c('0x3f')],{'$or':_[_0x350c('0x30')](_0x5afda6[_0x350c('0x39')],function(_0x4920e5){var _0x337c52={};_0x337c52[_0x4920e5]={'$like':'%'+_0x15867a['query'][_0x350c('0x45')]+'%'};return _0x337c52;})});}_0x5afda6=_[_0x350c('0x42')]({},_0x5afda6,_0x15867a[_0x350c('0x46')]);return _0x16e8f8[_0x350c('0x56')](_0x5afda6);}})[_0x350c('0x1c')](function(_0x5909dd){if(_0x5909dd){_0x21f888=_0x5909dd['length'];if(!_0x15867a['query'][_0x350c('0x55')](_0x350c('0x3b'))){_0x5afda6['limit']=qs[_0x350c('0x3c')](_0x15867a[_0x350c('0x36')][_0x350c('0x3c')]);_0x5afda6[_0x350c('0x27')]=qs[_0x350c('0x27')](_0x15867a[_0x350c('0x36')]['offset']);}return _0x16e8f8['getSubjects'](_0x5afda6);}})[_0x350c('0x1c')](function(_0x366fae){if(_0x366fae){return _0x366fae?{'count':_0x21f888,'rows':_0x366fae}:null;}})['then'](respondWithResult(_0x5c90d0,null))[_0x350c('0x4b')](handleError(_0x5c90d0,null));};exports[_0x350c('0x57')]=function(_0x4525cc,_0xb9d8a1,_0x157b5a){var _0x749654={};var _0xb1ea7d={};var _0x28ea5d;var _0x2c03e4;return db['DeskConfiguration'][_0x350c('0x53')]({'where':{'id':_0x4525cc[_0x350c('0x4d')]['id']}})[_0x350c('0x1c')](handleEntityNotFound(_0xb9d8a1,null))[_0x350c('0x1c')](function(_0x389c69){if(_0x389c69){_0x28ea5d=_0x389c69;_0xb1ea7d[_0x350c('0x38')]=_[_0x350c('0x35')](db[_0x350c('0x54')]['rawAttributes']);_0xb1ea7d['query']=_['keys'](_0x4525cc[_0x350c('0x36')]);_0xb1ea7d[_0x350c('0x40')]=_['intersection'](_0xb1ea7d[_0x350c('0x38')],_0xb1ea7d[_0x350c('0x36')]);_0x749654['attributes']=_[_0x350c('0x37')](_0xb1ea7d['model'],qs[_0x350c('0x3a')](_0x4525cc[_0x350c('0x36')]['fields']));_0x749654[_0x350c('0x39')]=_0x749654[_0x350c('0x39')][_0x350c('0x4e')]?_0x749654[_0x350c('0x39')]:_0xb1ea7d[_0x350c('0x38')];_0x749654['order']=qs['sort'](_0x4525cc['query'][_0x350c('0x3e')]);_0x749654['where']=qs['filters'](_['pick'](_0x4525cc['query'],_0xb1ea7d[_0x350c('0x40')]));if(_0x4525cc[_0x350c('0x36')][_0x350c('0x45')]){_0x749654[_0x350c('0x3f')]=_[_0x350c('0x42')](_0x749654[_0x350c('0x3f')],{'$or':_[_0x350c('0x30')](_0x749654[_0x350c('0x39')],function(_0x275c78){var _0x3a32ac={};_0x3a32ac[_0x275c78]={'$like':'%'+_0x4525cc[_0x350c('0x36')][_0x350c('0x45')]+'%'};return _0x3a32ac;})});}_0x749654=_['merge']({},_0x749654,_0x4525cc['options']);return _0x28ea5d[_0x350c('0x57')](_0x749654);}})[_0x350c('0x1c')](function(_0x3a99ec){if(_0x3a99ec){_0x2c03e4=_0x3a99ec[_0x350c('0x4e')];if(!_0x4525cc['query'][_0x350c('0x55')]('nolimit')){_0x749654[_0x350c('0x3c')]=qs['limit'](_0x4525cc['query']['limit']);_0x749654[_0x350c('0x27')]=qs[_0x350c('0x27')](_0x4525cc[_0x350c('0x36')][_0x350c('0x27')]);}return _0x28ea5d[_0x350c('0x57')](_0x749654);}})[_0x350c('0x1c')](function(_0x9192eb){if(_0x9192eb){return _0x9192eb?{'count':_0x2c03e4,'rows':_0x9192eb}:null;}})[_0x350c('0x1c')](respondWithResult(_0xb9d8a1,null))[_0x350c('0x4b')](handleError(_0xb9d8a1,null));};exports[_0x350c('0x58')]=function(_0x159218,_0x2e6417,_0x2c9bc5){var _0x277f46={};var _0x1461a9={};var _0x370666;var _0x188c63;return db['DeskConfiguration'][_0x350c('0x53')]({'where':{'id':_0x159218[_0x350c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2e6417,null))[_0x350c('0x1c')](function(_0xefcb44){if(_0xefcb44){_0x370666=_0xefcb44;_0x1461a9[_0x350c('0x38')]=_['keys'](db[_0x350c('0x59')][_0x350c('0x32')]);_0x1461a9[_0x350c('0x36')]=_[_0x350c('0x35')](_0x159218[_0x350c('0x36')]);_0x1461a9[_0x350c('0x40')]=_[_0x350c('0x37')](_0x1461a9[_0x350c('0x38')],_0x1461a9[_0x350c('0x36')]);_0x277f46[_0x350c('0x39')]=_[_0x350c('0x37')](_0x1461a9['model'],qs[_0x350c('0x3a')](_0x159218[_0x350c('0x36')][_0x350c('0x3a')]));_0x277f46[_0x350c('0x39')]=_0x277f46['attributes'][_0x350c('0x4e')]?_0x277f46['attributes']:_0x1461a9[_0x350c('0x38')];_0x277f46[_0x350c('0x3d')]=qs[_0x350c('0x3e')](_0x159218['query'][_0x350c('0x3e')]);_0x277f46['where']=qs[_0x350c('0x40')](_['pick'](_0x159218[_0x350c('0x36')],_0x1461a9[_0x350c('0x40')]));if(_0x159218[_0x350c('0x36')][_0x350c('0x45')]){_0x277f46[_0x350c('0x3f')]=_['merge'](_0x277f46[_0x350c('0x3f')],{'$or':_['map'](_0x277f46[_0x350c('0x39')],function(_0x2fb113){var _0x3c8e07={};_0x3c8e07[_0x2fb113]={'$like':'%'+_0x159218[_0x350c('0x36')]['filter']+'%'};return _0x3c8e07;})});}_0x277f46=_[_0x350c('0x42')]({},_0x277f46,_0x159218['options']);return _0x370666[_0x350c('0x58')](_0x277f46);}})[_0x350c('0x1c')](function(_0x1f3cbe){if(_0x1f3cbe){_0x188c63=_0x1f3cbe[_0x350c('0x4e')];if(!_0x159218['query']['hasOwnProperty'](_0x350c('0x3b'))){_0x277f46[_0x350c('0x3c')]=qs[_0x350c('0x3c')](_0x159218[_0x350c('0x36')]['limit']);_0x277f46[_0x350c('0x27')]=qs[_0x350c('0x27')](_0x159218['query'][_0x350c('0x27')]);}return _0x370666[_0x350c('0x58')](_0x277f46);}})['then'](function(_0x5886a9){if(_0x5886a9){return _0x5886a9?{'count':_0x188c63,'rows':_0x5886a9}:null;}})[_0x350c('0x1c')](respondWithResult(_0x2e6417,null))[_0x350c('0x4b')](handleError(_0x2e6417,null));};exports['setTags']=function(_0xb5c191,_0x2839cf,_0xff302b){if(_0xb5c191['body']['id']){delete _0xb5c191[_0x350c('0x51')]['id'];}return db[_0x350c('0x31')][_0x350c('0x53')]({'where':{'id':_0xb5c191[_0x350c('0x4d')]['id']}})[_0x350c('0x1c')](handleEntityNotFound(_0x2839cf,null))[_0x350c('0x1c')](function(_0x4bc91f){if(_0x4bc91f){return _0x4bc91f['setTags'](_0xb5c191[_0x350c('0x51')][_0x350c('0x5a')]||[]);}return null;})[_0x350c('0x1c')](respondWithResult(_0x2839cf,null))['catch'](handleError(_0x2839cf,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 3a30c4e..81ce82f 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 _0x3abb=['request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','lodash','util','api','bluebird'];(function(_0x33bc5a,_0x3a048d){var _0x5826fd=function(_0x55f85e){while(--_0x55f85e){_0x33bc5a['push'](_0x33bc5a['shift']());}};_0x5826fd(++_0x3a048d);}(_0x3abb,0x130));var _0xb3ab=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x3abb[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xb3ab('0x0'));var util=require(_0xb3ab('0x1'));var logger=require('../../config/logger')(_0xb3ab('0x2'));var moment=require('moment');var BPromise=require(_0xb3ab('0x3'));var rp=require(_0xb3ab('0x4'));var fs=require('fs');var path=require(_0xb3ab('0x5'));var rimraf=require(_0xb3ab('0x6'));var config=require(_0xb3ab('0x7'));var attributes=require(_0xb3ab('0x8'));module[_0xb3ab('0x9')]=function(_0x16f9ea,_0x248c0a){return _0x16f9ea[_0xb3ab('0xa')]('DeskConfiguration',attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9dd2=['exports','DeskConfiguration','int_desk_configurations','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x1cd1b7,_0x1f68f7){var _0x15ef49=function(_0x308693){while(--_0x308693){_0x1cd1b7['push'](_0x1cd1b7['shift']());}};_0x15ef49(++_0x1f68f7);}(_0x9dd2,0x7b));var _0x29dd=function(_0x2f3ecd,_0x57976b){_0x2f3ecd=_0x2f3ecd-0x0;var _0xffdc44=_0x9dd2[_0x2f3ecd];return _0xffdc44;};'use strict';var _=require(_0x29dd('0x0'));var util=require('util');var logger=require(_0x29dd('0x1'))(_0x29dd('0x2'));var moment=require(_0x29dd('0x3'));var BPromise=require('bluebird');var rp=require(_0x29dd('0x4'));var fs=require('fs');var path=require(_0x29dd('0x5'));var rimraf=require(_0x29dd('0x6'));var config=require(_0x29dd('0x7'));var attributes=require(_0x29dd('0x8'));module[_0x29dd('0x9')]=function(_0x37d831,_0x17e493){return _0x37d831['define'](_0x29dd('0xa'),attributes,{'tableName':_0x29dd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 3742e15..4389b80 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 _0xd136=['request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','DeskConfiguration,\x20%s,\x20%s','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd136,0x94));var _0x6d13=function(_0x5a7c54,_0x362eda){_0x5a7c54=_0x5a7c54-0x0;var _0x26f8e1=_0xd136[_0x5a7c54];return _0x26f8e1;};'use strict';var _=require('lodash');var util=require(_0x6d13('0x0'));var moment=require(_0x6d13('0x1'));var BPromise=require('bluebird');var rs=require(_0x6d13('0x2'));var fs=require('fs');var Redis=require(_0x6d13('0x3'));var db=require(_0x6d13('0x4'))['db'];var utils=require(_0x6d13('0x5'));var logger=require(_0x6d13('0x6'))(_0x6d13('0x7'));var config=require(_0x6d13('0x8'));var jayson=require(_0x6d13('0x9'));var client=jayson[_0x6d13('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x335482,_0xdf6760,_0x4c563a){return new BPromise(function(_0x598021,_0x1af16f){return client[_0x6d13('0xb')](_0x335482,_0x4c563a)[_0x6d13('0xc')](function(_0x2216d7){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0xdf6760,_0x6d13('0xd'));logger[_0x6d13('0xe')](_0x6d13('0xf'),_0xdf6760,'request\x20sent',JSON['stringify'](_0x2216d7));if(_0x2216d7[_0x6d13('0x10')]){if(_0x2216d7[_0x6d13('0x10')][_0x6d13('0x11')]===0x1f4){logger['error'](_0x6d13('0x12'),_0xdf6760,_0x2216d7[_0x6d13('0x10')][_0x6d13('0x13')]);return _0x1af16f(_0x2216d7[_0x6d13('0x10')]['message']);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0xdf6760,_0x2216d7[_0x6d13('0x10')][_0x6d13('0x13')]);return _0x598021(_0x2216d7[_0x6d13('0x10')][_0x6d13('0x13')]);}else{logger[_0x6d13('0x14')]('DeskConfiguration,\x20%s,\x20%s',_0xdf6760,_0x6d13('0xd'));_0x598021(_0x2216d7[_0x6d13('0x15')][_0x6d13('0x13')]);}})[_0x6d13('0x16')](function(_0x348cab){logger[_0x6d13('0x10')](_0x6d13('0x12'),_0xdf6760,_0x348cab);_0x1af16f(_0x348cab);});});} \ No newline at end of file +var _0x30fe=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util'];(function(_0x1dbaf7,_0x3d05b3){var _0x593f05=function(_0x381936){while(--_0x381936){_0x1dbaf7['push'](_0x1dbaf7['shift']());}};_0x593f05(++_0x3d05b3);}(_0x30fe,0x149));var _0xe30f=function(_0x4bcb7b,_0x45c812){_0x4bcb7b=_0x4bcb7b-0x0;var _0x2e4c2a=_0x30fe[_0x4bcb7b];return _0x2e4c2a;};'use strict';var _=require('lodash');var util=require(_0xe30f('0x0'));var moment=require('moment');var BPromise=require(_0xe30f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe30f('0x2'));var db=require(_0xe30f('0x3'))['db'];var utils=require(_0xe30f('0x4'));var logger=require(_0xe30f('0x5'))(_0xe30f('0x6'));var config=require('../../config/environment');var jayson=require(_0xe30f('0x7'));var client=jayson[_0xe30f('0x8')][_0xe30f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x346a51,_0x442a51,_0x3af889){return new BPromise(function(_0x2f94d2,_0x2243f2){return client[_0xe30f('0xa')](_0x346a51,_0x3af889)[_0xe30f('0xb')](function(_0x5ab6b8){logger[_0xe30f('0xc')](_0xe30f('0xd'),_0x442a51,'request\x20sent');logger[_0xe30f('0xe')](_0xe30f('0xf'),_0x442a51,_0xe30f('0x10'),JSON[_0xe30f('0x11')](_0x5ab6b8));if(_0x5ab6b8['error']){if(_0x5ab6b8[_0xe30f('0x12')][_0xe30f('0x13')]===0x1f4){logger[_0xe30f('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x442a51,_0x5ab6b8[_0xe30f('0x12')][_0xe30f('0x14')]);return _0x2243f2(_0x5ab6b8[_0xe30f('0x12')]['message']);}logger[_0xe30f('0x12')](_0xe30f('0xd'),_0x442a51,_0x5ab6b8[_0xe30f('0x12')][_0xe30f('0x14')]);return _0x2f94d2(_0x5ab6b8['error']['message']);}else{logger['info'](_0xe30f('0xd'),_0x442a51,_0xe30f('0x10'));_0x2f94d2(_0x5ab6b8[_0xe30f('0x15')][_0xe30f('0x14')]);}})['catch'](function(_0x1f19bf){logger['error'](_0xe30f('0xd'),_0x442a51,_0x1f19bf);_0x2243f2(_0x1f19bf);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 05cd2e3..64f3b6f 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 _0xeae6=['../../config/environment','./intDeskField.controller','get','isAuthenticated','post','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0xcdbedd,_0x1571e1){var _0xa17e51=function(_0x1533fb){while(--_0x1533fb){_0xcdbedd['push'](_0xcdbedd['shift']());}};_0xa17e51(++_0x1571e1);}(_0xeae6,0x13b));var _0x6eae=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeae6[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x6eae('0x0'));var path=require(_0x6eae('0x1'));var timeout=require(_0x6eae('0x2'));var express=require(_0x6eae('0x3'));var router=express[_0x6eae('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6eae('0x5'));var controller=require(_0x6eae('0x6'));router[_0x6eae('0x7')]('/',auth[_0x6eae('0x8')](),controller['index']);router[_0x6eae('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6eae('0x9')]('/',auth[_0x6eae('0x8')](),controller['create']);router[_0x6eae('0xa')](_0x6eae('0xb'),auth['isAuthenticated'](),controller[_0x6eae('0xc')]);router[_0x6eae('0xd')]('/:id',auth[_0x6eae('0x8')](),controller[_0x6eae('0xe')]);module[_0x6eae('0xf')]=router; \ No newline at end of file +var _0xa049=['show','post','create','put','update','delete','destroy','exports','multer','util','path','express','../../components/interaction/service','./intDeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x5d66a9,_0x3ad3c8){var _0x7350f=function(_0x3dfee4){while(--_0x3dfee4){_0x5d66a9['push'](_0x5d66a9['shift']());}};_0x7350f(++_0x3ad3c8);}(_0xa049,0x116));var _0x9a04=function(_0x1655bb,_0x5a82ae){_0x1655bb=_0x1655bb-0x0;var _0x5e2020=_0xa049[_0x1655bb];return _0x5e2020;};'use strict';var multer=require(_0x9a04('0x0'));var util=require(_0x9a04('0x1'));var path=require(_0x9a04('0x2'));var timeout=require('connect-timeout');var express=require(_0x9a04('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x9a04('0x4'));var config=require('../../config/environment');var controller=require(_0x9a04('0x5'));router[_0x9a04('0x6')]('/',auth[_0x9a04('0x7')](),controller[_0x9a04('0x8')]);router[_0x9a04('0x6')](_0x9a04('0x9'),auth['isAuthenticated'](),controller[_0x9a04('0xa')]);router[_0x9a04('0xb')]('/',auth[_0x9a04('0x7')](),controller[_0x9a04('0xc')]);router[_0x9a04('0xd')](_0x9a04('0x9'),auth[_0x9a04('0x7')](),controller[_0x9a04('0xe')]);router[_0x9a04('0xf')](_0x9a04('0x9'),auth[_0x9a04('0x7')](),controller[_0x9a04('0x10')]);module[_0x9a04('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index a0a0194..d231abd 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 _0x055f=['sequelize','exports','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x256ccf,_0x53a69d){var _0x1ae9cc=function(_0x19d603){while(--_0x19d603){_0x256ccf['push'](_0x256ccf['shift']());}};_0x1ae9cc(++_0x53a69d);}(_0x055f,0x98));var _0xf055=function(_0x497588,_0x2df2d8){_0x497588=_0x497588-0x0;var _0x32107c=_0x055f[_0x497588];return _0x32107c;};'use strict';var Sequelize=require(_0xf055('0x0'));module[_0xf055('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf055('0x2'),_0xf055('0x3'),_0xf055('0x4'),_0xf055('0x5')),'defaultValue':_0xf055('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xf055('0x2'),'variable',_0xf055('0x4'))},'keyContent':{'type':Sequelize[_0xf055('0x6')]},'idField':{'type':Sequelize[_0xf055('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf055('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf055('0x6')]}}; \ No newline at end of file +var _0xd9df=['STRING','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0xd9df,0x10a));var _0xfd9d=function(_0x5d81ce,_0x5ca25c){_0x5d81ce=_0x5d81ce-0x0;var _0x379679=_0xd9df[_0x5d81ce];return _0x379679;};'use strict';var Sequelize=require(_0xfd9d('0x0'));module[_0xfd9d('0x1')]={'type':{'type':Sequelize[_0xfd9d('0x2')](_0xfd9d('0x3'),'variable',_0xfd9d('0x4'),_0xfd9d('0x5')),'defaultValue':_0xfd9d('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xfd9d('0x6')]},'keyType':{'type':Sequelize[_0xfd9d('0x2')](_0xfd9d('0x3'),'variable',_0xfd9d('0x4'))},'keyContent':{'type':Sequelize[_0xfd9d('0x6')]},'idField':{'type':Sequelize[_0xfd9d('0x6')]},'nameField':{'type':Sequelize[_0xfd9d('0x6')]},'customField':{'type':Sequelize[_0xfd9d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfd9d('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 329d818..bca6e5a 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 _0x0f6a=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','count','include','findAll','rows','catch','show','includeAll','find','create','body','destroy','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','reject','save','update','then','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x3681a4,_0x255a2e){var _0x1b7836=function(_0x24d81f){while(--_0x24d81f){_0x3681a4['push'](_0x3681a4['shift']());}};_0x1b7836(++_0x255a2e);}(_0x0f6a,0x1ae));var _0xa0f6=function(_0x165ab0,_0xa52cf6){_0x165ab0=_0x165ab0-0x0;var _0x2dfde5=_0x0f6a[_0x165ab0];return _0x2dfde5;};'use strict';var pdf=require(_0xa0f6('0x0'));var emlformat=require(_0xa0f6('0x1'));var rimraf=require(_0xa0f6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa0f6('0x3'));var moment=require('moment');var BPromise=require(_0xa0f6('0x4'));var Mustache=require(_0xa0f6('0x5'));var util=require(_0xa0f6('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa0f6('0x7'));var ejs=require(_0xa0f6('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa0f6('0x9'));var crypto=require(_0xa0f6('0xa'));var jsforce=require(_0xa0f6('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa0f6('0x7'));var querystring=require(_0xa0f6('0xc'));var Papa=require('papaparse');var Redis=require(_0xa0f6('0xd'));var authService=require(_0xa0f6('0xe'));var qs=require(_0xa0f6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa0f6('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa0f6('0x11'));var licenseUtil=require(_0xa0f6('0x12'));var db=require(_0xa0f6('0x13'))['db'];function respondWithStatusCode(_0x54df17,_0x2af27e){_0x2af27e=_0x2af27e||0xcc;return function(_0x54b4d0){if(_0x54b4d0){return _0x54df17[_0xa0f6('0x14')](_0x2af27e);}return _0x54df17['status'](_0x2af27e)[_0xa0f6('0x15')]();};}function respondWithResult(_0x34328f,_0x419ebe){_0x419ebe=_0x419ebe||0xc8;return function(_0x4abb02){if(_0x4abb02){return _0x34328f[_0xa0f6('0x16')](_0x419ebe)[_0xa0f6('0x17')](_0x4abb02);}};}function respondWithFilteredResult(_0x54dd02,_0x3397b6){return function(_0xec4335){if(_0xec4335){var _0x1652dd=_0xec4335['count'],_0x18204a=_0x3397b6['offset'],_0x19ad5d=_0x3397b6[_0xa0f6('0x18')]+_0x3397b6[_0xa0f6('0x19')],_0x48ae6b;if(_0x19ad5d>=_0x1652dd){_0x19ad5d=_0x1652dd;_0x48ae6b=0xc8;}else{_0x48ae6b=0xce;}_0x54dd02[_0xa0f6('0x16')](_0x48ae6b);return _0x54dd02['set']('Content-Range',_0x18204a+'-'+_0x19ad5d+'/'+_0x1652dd)[_0xa0f6('0x17')](_0xec4335);}return null;};}function patchUpdates(_0x402b8a){return function(_0x139067){try{jsonpatch['apply'](_0x139067,_0x402b8a,!![]);}catch(_0x55599c){return BPromise[_0xa0f6('0x1a')](_0x55599c);}return _0x139067[_0xa0f6('0x1b')]();};}function saveUpdates(_0x1c8ffd,_0x285926){return function(_0x48e8e7){if(_0x48e8e7){return _0x48e8e7[_0xa0f6('0x1c')](_0x1c8ffd)[_0xa0f6('0x1d')](function(_0x2b3358){return _0x2b3358;});}return null;};}function removeEntity(_0x1d93c1,_0x4c0217){return function(_0x1ed2be){if(_0x1ed2be){return _0x1ed2be['destroy']()['then'](function(){_0x1d93c1['status'](0xcc)[_0xa0f6('0x15')]();});}};}function handleEntityNotFound(_0x17c37b,_0x1a4895){return function(_0x4382cd){if(!_0x4382cd){_0x17c37b[_0xa0f6('0x14')](0x194);}return _0x4382cd;};}function handleError(_0x5b302f,_0x420343){_0x420343=_0x420343||0x1f4;return function(_0x1a6e2b){logger[_0xa0f6('0x1e')](_0x1a6e2b[_0xa0f6('0x1f')]);if(_0x1a6e2b[_0xa0f6('0x20')]){delete _0x1a6e2b[_0xa0f6('0x20')];}_0x5b302f['status'](_0x420343)[_0xa0f6('0x21')](_0x1a6e2b);};}exports[_0xa0f6('0x22')]=function(_0x40b7ca,_0x5d6435){var _0x9e7c5e={},_0x4d8224={},_0x207069={'count':0x0,'rows':[]};var _0x583c18=_[_0xa0f6('0x23')](db[_0xa0f6('0x24')][_0xa0f6('0x25')],function(_0x27ed74){return{'name':_0x27ed74[_0xa0f6('0x26')],'type':_0x27ed74[_0xa0f6('0x27')][_0xa0f6('0x28')]};});_0x4d8224[_0xa0f6('0x29')]=_[_0xa0f6('0x23')](_0x583c18,_0xa0f6('0x20'));_0x4d8224[_0xa0f6('0x2a')]=_[_0xa0f6('0x2b')](_0x40b7ca[_0xa0f6('0x2a')]);_0x4d8224[_0xa0f6('0x2c')]=_[_0xa0f6('0x2d')](_0x4d8224[_0xa0f6('0x29')],_0x4d8224[_0xa0f6('0x2a')]);_0x9e7c5e[_0xa0f6('0x2e')]=_[_0xa0f6('0x2d')](_0x4d8224[_0xa0f6('0x29')],qs[_0xa0f6('0x2f')](_0x40b7ca[_0xa0f6('0x2a')][_0xa0f6('0x2f')]));_0x9e7c5e[_0xa0f6('0x2e')]=_0x9e7c5e['attributes'][_0xa0f6('0x30')]?_0x9e7c5e['attributes']:_0x4d8224[_0xa0f6('0x29')];if(!_0x40b7ca[_0xa0f6('0x2a')][_0xa0f6('0x31')](_0xa0f6('0x32'))){_0x9e7c5e['limit']=qs[_0xa0f6('0x19')](_0x40b7ca[_0xa0f6('0x2a')]['limit']);_0x9e7c5e[_0xa0f6('0x18')]=qs[_0xa0f6('0x18')](_0x40b7ca['query'][_0xa0f6('0x18')]);}_0x9e7c5e['order']=qs[_0xa0f6('0x33')](_0x40b7ca['query']['sort']);_0x9e7c5e[_0xa0f6('0x34')]=qs[_0xa0f6('0x2c')](_[_0xa0f6('0x35')](_0x40b7ca[_0xa0f6('0x2a')],_0x4d8224[_0xa0f6('0x2c')]),_0x583c18);if(_0x40b7ca[_0xa0f6('0x2a')][_0xa0f6('0x36')]){_0x9e7c5e['where']=_[_0xa0f6('0x37')](_0x9e7c5e[_0xa0f6('0x34')],{'$or':_[_0xa0f6('0x23')](_0x583c18,function(_0x57eaaa){if(_0x57eaaa[_0xa0f6('0x27')]!=='VIRTUAL'){var _0x14dbde={};_0x14dbde[_0x57eaaa['name']]={'$like':'%'+_0x40b7ca[_0xa0f6('0x2a')]['filter']+'%'};return _0x14dbde;}})});}_0x9e7c5e=_['merge']({},_0x9e7c5e,_0x40b7ca[_0xa0f6('0x38')]);var _0x59d456={'where':_0x9e7c5e[_0xa0f6('0x34')]};return db[_0xa0f6('0x24')][_0xa0f6('0x39')](_0x59d456)[_0xa0f6('0x1d')](function(_0x403d6d){_0x207069['count']=_0x403d6d;if(_0x40b7ca['query']['includeAll']){_0x9e7c5e[_0xa0f6('0x3a')]=[{'all':!![]}];}return db[_0xa0f6('0x24')][_0xa0f6('0x3b')](_0x9e7c5e);})['then'](function(_0x253391){_0x207069[_0xa0f6('0x3c')]=_0x253391;return _0x207069;})['then'](respondWithFilteredResult(_0x5d6435,_0x9e7c5e))[_0xa0f6('0x3d')](handleError(_0x5d6435,null));};exports[_0xa0f6('0x3e')]=function(_0xec6aa9,_0x3b5a36){var _0x2d00c8={'raw':!![],'where':{'id':_0xec6aa9['params']['id']}},_0x15ea86={};_0x15ea86[_0xa0f6('0x29')]=_[_0xa0f6('0x2b')](db[_0xa0f6('0x24')][_0xa0f6('0x25')]);_0x15ea86[_0xa0f6('0x2a')]=_['keys'](_0xec6aa9[_0xa0f6('0x2a')]);_0x15ea86[_0xa0f6('0x2c')]=_[_0xa0f6('0x2d')](_0x15ea86[_0xa0f6('0x29')],_0x15ea86[_0xa0f6('0x2a')]);_0x2d00c8[_0xa0f6('0x2e')]=_[_0xa0f6('0x2d')](_0x15ea86[_0xa0f6('0x29')],qs['fields'](_0xec6aa9[_0xa0f6('0x2a')][_0xa0f6('0x2f')]));_0x2d00c8[_0xa0f6('0x2e')]=_0x2d00c8['attributes']['length']?_0x2d00c8[_0xa0f6('0x2e')]:_0x15ea86['model'];if(_0xec6aa9['query'][_0xa0f6('0x3f')]){_0x2d00c8[_0xa0f6('0x3a')]=[{'all':!![]}];}_0x2d00c8=_[_0xa0f6('0x37')]({},_0x2d00c8,_0xec6aa9['options']);return db[_0xa0f6('0x24')][_0xa0f6('0x40')](_0x2d00c8)[_0xa0f6('0x1d')](handleEntityNotFound(_0x3b5a36,null))[_0xa0f6('0x1d')](respondWithResult(_0x3b5a36,null))[_0xa0f6('0x3d')](handleError(_0x3b5a36,null));};exports[_0xa0f6('0x41')]=function(_0x3e0aa9,_0x5b375b){return db[_0xa0f6('0x24')][_0xa0f6('0x41')](_0x3e0aa9[_0xa0f6('0x42')],{})[_0xa0f6('0x1d')](respondWithResult(_0x5b375b,0xc9))['catch'](handleError(_0x5b375b,null));};exports[_0xa0f6('0x1c')]=function(_0x1b6ca3,_0x19be11){if(_0x1b6ca3[_0xa0f6('0x42')]['id']){delete _0x1b6ca3[_0xa0f6('0x42')]['id'];}return db[_0xa0f6('0x24')]['find']({'where':{'id':_0x1b6ca3['params']['id']}})[_0xa0f6('0x1d')](handleEntityNotFound(_0x19be11,null))[_0xa0f6('0x1d')](saveUpdates(_0x1b6ca3[_0xa0f6('0x42')],null))['then'](respondWithResult(_0x19be11,null))[_0xa0f6('0x3d')](handleError(_0x19be11,null));};exports[_0xa0f6('0x43')]=function(_0x1bd736,_0x283505){return db[_0xa0f6('0x24')]['find']({'where':{'id':_0x1bd736['params']['id']}})[_0xa0f6('0x1d')](handleEntityNotFound(_0x283505,null))[_0xa0f6('0x1d')](removeEntity(_0x283505,null))[_0xa0f6('0x3d')](handleError(_0x283505,null));}; \ No newline at end of file +var _0x91ee=['send','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name'];(function(_0x60337,_0x163a14){var _0x48e690=function(_0x570685){while(--_0x570685){_0x60337['push'](_0x60337['shift']());}};_0x48e690(++_0x163a14);}(_0x91ee,0x15e));var _0xe91e=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x91ee[_0x15bc81];return _0x59440e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe91e('0x0'));var rimraf=require(_0xe91e('0x1'));var zipdir=require(_0xe91e('0x2'));var jsonpatch=require(_0xe91e('0x3'));var rp=require(_0xe91e('0x4'));var moment=require(_0xe91e('0x5'));var BPromise=require(_0xe91e('0x6'));var Mustache=require(_0xe91e('0x7'));var util=require(_0xe91e('0x8'));var path=require(_0xe91e('0x9'));var sox=require(_0xe91e('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe91e('0xb'));var squel=require(_0xe91e('0xc'));var crypto=require(_0xe91e('0xd'));var jsforce=require(_0xe91e('0xe'));var deskjs=require(_0xe91e('0xf'));var toCsv=require(_0xe91e('0x10'));var querystring=require(_0xe91e('0x11'));var Papa=require(_0xe91e('0x12'));var Redis=require(_0xe91e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xe91e('0x14'));var as=require(_0xe91e('0x15'));var hardwareService=require(_0xe91e('0x16'));var logger=require(_0xe91e('0x17'))(_0xe91e('0x18'));var utils=require(_0xe91e('0x19'));var config=require(_0xe91e('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xe91e('0x1b'))['db'];function respondWithStatusCode(_0x25fb6e,_0x6232e7){_0x6232e7=_0x6232e7||0xcc;return function(_0x1b5df5){if(_0x1b5df5){return _0x25fb6e[_0xe91e('0x1c')](_0x6232e7);}return _0x25fb6e[_0xe91e('0x1d')](_0x6232e7)[_0xe91e('0x1e')]();};}function respondWithResult(_0x359a78,_0x5ebb12){_0x5ebb12=_0x5ebb12||0xc8;return function(_0x283d66){if(_0x283d66){return _0x359a78[_0xe91e('0x1d')](_0x5ebb12)[_0xe91e('0x1f')](_0x283d66);}};}function respondWithFilteredResult(_0x10fa83,_0x5443c4){return function(_0x4c3de9){if(_0x4c3de9){var _0x7f7e61=_0x4c3de9[_0xe91e('0x20')],_0x5ae54e=_0x5443c4['offset'],_0x33cb2c=_0x5443c4[_0xe91e('0x21')]+_0x5443c4[_0xe91e('0x22')],_0x424a3b;if(_0x33cb2c>=_0x7f7e61){_0x33cb2c=_0x7f7e61;_0x424a3b=0xc8;}else{_0x424a3b=0xce;}_0x10fa83[_0xe91e('0x1d')](_0x424a3b);return _0x10fa83[_0xe91e('0x23')](_0xe91e('0x24'),_0x5ae54e+'-'+_0x33cb2c+'/'+_0x7f7e61)['json'](_0x4c3de9);}return null;};}function patchUpdates(_0x336081){return function(_0x260858){try{jsonpatch[_0xe91e('0x25')](_0x260858,_0x336081,!![]);}catch(_0x16e570){return BPromise[_0xe91e('0x26')](_0x16e570);}return _0x260858[_0xe91e('0x27')]();};}function saveUpdates(_0x38f948,_0x5b057b){return function(_0x5cb3e0){if(_0x5cb3e0){return _0x5cb3e0[_0xe91e('0x28')](_0x38f948)[_0xe91e('0x29')](function(_0x13f57c){return _0x13f57c;});}return null;};}function removeEntity(_0x1b6bb2,_0x404798){return function(_0x280d0f){if(_0x280d0f){return _0x280d0f['destroy']()[_0xe91e('0x29')](function(){_0x1b6bb2[_0xe91e('0x1d')](0xcc)[_0xe91e('0x1e')]();});}};}function handleEntityNotFound(_0x24165d,_0x268543){return function(_0x4274c1){if(!_0x4274c1){_0x24165d[_0xe91e('0x1c')](0x194);}return _0x4274c1;};}function handleError(_0x32849f,_0x1fe6c5){_0x1fe6c5=_0x1fe6c5||0x1f4;return function(_0x420719){logger[_0xe91e('0x2a')](_0x420719[_0xe91e('0x2b')]);if(_0x420719[_0xe91e('0x2c')]){delete _0x420719[_0xe91e('0x2c')];}_0x32849f[_0xe91e('0x1d')](_0x1fe6c5)[_0xe91e('0x2d')](_0x420719);};}exports['index']=function(_0x30c420,_0x43d130){var _0x12124c={},_0x3591b4={},_0x47bb82={'count':0x0,'rows':[]};var _0x100ccb=_[_0xe91e('0x2e')](db[_0xe91e('0x2f')][_0xe91e('0x30')],function(_0x245810){return{'name':_0x245810[_0xe91e('0x31')],'type':_0x245810[_0xe91e('0x32')][_0xe91e('0x33')]};});_0x3591b4[_0xe91e('0x34')]=_[_0xe91e('0x2e')](_0x100ccb,_0xe91e('0x2c'));_0x3591b4[_0xe91e('0x35')]=_[_0xe91e('0x36')](_0x30c420[_0xe91e('0x35')]);_0x3591b4[_0xe91e('0x37')]=_['intersection'](_0x3591b4[_0xe91e('0x34')],_0x3591b4[_0xe91e('0x35')]);_0x12124c[_0xe91e('0x38')]=_['intersection'](_0x3591b4[_0xe91e('0x34')],qs[_0xe91e('0x39')](_0x30c420[_0xe91e('0x35')][_0xe91e('0x39')]));_0x12124c[_0xe91e('0x38')]=_0x12124c['attributes'][_0xe91e('0x3a')]?_0x12124c['attributes']:_0x3591b4[_0xe91e('0x34')];if(!_0x30c420[_0xe91e('0x35')]['hasOwnProperty'](_0xe91e('0x3b'))){_0x12124c['limit']=qs[_0xe91e('0x22')](_0x30c420[_0xe91e('0x35')][_0xe91e('0x22')]);_0x12124c[_0xe91e('0x21')]=qs['offset'](_0x30c420['query'][_0xe91e('0x21')]);}_0x12124c[_0xe91e('0x3c')]=qs[_0xe91e('0x3d')](_0x30c420[_0xe91e('0x35')]['sort']);_0x12124c['where']=qs[_0xe91e('0x37')](_['pick'](_0x30c420['query'],_0x3591b4[_0xe91e('0x37')]),_0x100ccb);if(_0x30c420[_0xe91e('0x35')][_0xe91e('0x3e')]){_0x12124c[_0xe91e('0x3f')]=_[_0xe91e('0x40')](_0x12124c[_0xe91e('0x3f')],{'$or':_[_0xe91e('0x2e')](_0x100ccb,function(_0x2ebaa2){if(_0x2ebaa2['type']!==_0xe91e('0x41')){var _0x25ad15={};_0x25ad15[_0x2ebaa2[_0xe91e('0x2c')]]={'$like':'%'+_0x30c420[_0xe91e('0x35')][_0xe91e('0x3e')]+'%'};return _0x25ad15;}})});}_0x12124c=_['merge']({},_0x12124c,_0x30c420[_0xe91e('0x42')]);var _0x5977be={'where':_0x12124c[_0xe91e('0x3f')]};return db['DeskField'][_0xe91e('0x20')](_0x5977be)['then'](function(_0x1d6a34){_0x47bb82[_0xe91e('0x20')]=_0x1d6a34;if(_0x30c420[_0xe91e('0x35')][_0xe91e('0x43')]){_0x12124c[_0xe91e('0x44')]=[{'all':!![]}];}return db[_0xe91e('0x2f')][_0xe91e('0x45')](_0x12124c);})['then'](function(_0xff7792){_0x47bb82[_0xe91e('0x46')]=_0xff7792;return _0x47bb82;})[_0xe91e('0x29')](respondWithFilteredResult(_0x43d130,_0x12124c))[_0xe91e('0x47')](handleError(_0x43d130,null));};exports[_0xe91e('0x48')]=function(_0x30fc8f,_0x116218){var _0x29cc1e={'raw':!![],'where':{'id':_0x30fc8f[_0xe91e('0x49')]['id']}},_0x22c475={};_0x22c475[_0xe91e('0x34')]=_[_0xe91e('0x36')](db[_0xe91e('0x2f')][_0xe91e('0x30')]);_0x22c475[_0xe91e('0x35')]=_[_0xe91e('0x36')](_0x30fc8f[_0xe91e('0x35')]);_0x22c475['filters']=_[_0xe91e('0x4a')](_0x22c475[_0xe91e('0x34')],_0x22c475['query']);_0x29cc1e[_0xe91e('0x38')]=_[_0xe91e('0x4a')](_0x22c475['model'],qs[_0xe91e('0x39')](_0x30fc8f[_0xe91e('0x35')]['fields']));_0x29cc1e[_0xe91e('0x38')]=_0x29cc1e[_0xe91e('0x38')][_0xe91e('0x3a')]?_0x29cc1e['attributes']:_0x22c475['model'];if(_0x30fc8f['query'][_0xe91e('0x43')]){_0x29cc1e[_0xe91e('0x44')]=[{'all':!![]}];}_0x29cc1e=_[_0xe91e('0x40')]({},_0x29cc1e,_0x30fc8f[_0xe91e('0x42')]);return db[_0xe91e('0x2f')][_0xe91e('0x4b')](_0x29cc1e)[_0xe91e('0x29')](handleEntityNotFound(_0x116218,null))['then'](respondWithResult(_0x116218,null))[_0xe91e('0x47')](handleError(_0x116218,null));};exports[_0xe91e('0x4c')]=function(_0x42733f,_0x204979){return db[_0xe91e('0x2f')]['create'](_0x42733f[_0xe91e('0x4d')],{})['then'](respondWithResult(_0x204979,0xc9))[_0xe91e('0x47')](handleError(_0x204979,null));};exports['update']=function(_0x108b50,_0x185555){if(_0x108b50[_0xe91e('0x4d')]['id']){delete _0x108b50[_0xe91e('0x4d')]['id'];}return db['DeskField'][_0xe91e('0x4b')]({'where':{'id':_0x108b50['params']['id']}})[_0xe91e('0x29')](handleEntityNotFound(_0x185555,null))['then'](saveUpdates(_0x108b50[_0xe91e('0x4d')],null))[_0xe91e('0x29')](respondWithResult(_0x185555,null))[_0xe91e('0x47')](handleError(_0x185555,null));};exports[_0xe91e('0x4e')]=function(_0x4f1223,_0x3b38bc){return db[_0xe91e('0x2f')][_0xe91e('0x4b')]({'where':{'id':_0x4f1223[_0xe91e('0x49')]['id']}})[_0xe91e('0x29')](handleEntityNotFound(_0x3b38bc,null))[_0xe91e('0x29')](removeEntity(_0x3b38bc,null))[_0xe91e('0x47')](handleError(_0x3b38bc,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 0b783f8..54daa69 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 _0x6790=['FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intDeskField.attributes','exports','define','int_desk_fields','desk_unique_index','idField'];(function(_0x521454,_0x6a8aec){var _0x37326a=function(_0x2e42e9){while(--_0x2e42e9){_0x521454['push'](_0x521454['shift']());}};_0x37326a(++_0x6a8aec);}(_0x6790,0xd3));var _0x0679=function(_0x3ad765,_0x2a4349){_0x3ad765=_0x3ad765-0x0;var _0x2124d4=_0x6790[_0x3ad765];return _0x2124d4;};'use strict';var _=require(_0x0679('0x0'));var util=require(_0x0679('0x1'));var logger=require(_0x0679('0x2'))('api');var moment=require(_0x0679('0x3'));var BPromise=require(_0x0679('0x4'));var rp=require(_0x0679('0x5'));var fs=require('fs');var path=require(_0x0679('0x6'));var rimraf=require(_0x0679('0x7'));var config=require('../../config/environment');var attributes=require(_0x0679('0x8'));module[_0x0679('0x9')]=function(_0xdf38d,_0x50f8d2){return _0xdf38d[_0x0679('0xa')]('DeskField',attributes,{'tableName':_0x0679('0xb'),'paranoid':![],'indexes':[{'name':_0x0679('0xc'),'fields':[_0x0679('0xd'),_0x0679('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2e8e=['desk_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields'];(function(_0x392e2e,_0x2a53ef){var _0x1b49b8=function(_0x3c6cc8){while(--_0x3c6cc8){_0x392e2e['push'](_0x392e2e['shift']());}};_0x1b49b8(++_0x2a53ef);}(_0x2e8e,0x197));var _0xe2e8=function(_0x3bf925,_0x4dd8e4){_0x3bf925=_0x3bf925-0x0;var _0x2128a1=_0x2e8e[_0x3bf925];return _0x2128a1;};'use strict';var _=require(_0xe2e8('0x0'));var util=require(_0xe2e8('0x1'));var logger=require(_0xe2e8('0x2'))(_0xe2e8('0x3'));var moment=require('moment');var BPromise=require(_0xe2e8('0x4'));var rp=require(_0xe2e8('0x5'));var fs=require('fs');var path=require(_0xe2e8('0x6'));var rimraf=require('rimraf');var config=require(_0xe2e8('0x7'));var attributes=require(_0xe2e8('0x8'));module[_0xe2e8('0x9')]=function(_0x25250b,_0x28d462){return _0x25250b[_0xe2e8('0xa')](_0xe2e8('0xb'),attributes,{'tableName':_0xe2e8('0xc'),'paranoid':![],'indexes':[{'name':_0xe2e8('0xd'),'fields':['idField',_0xe2e8('0xe')],'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 d2b163e..03eed97 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 _0x86ea=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x3c1a9d,_0x2c5d6b){var _0x563f8a=function(_0x1b778b){while(--_0x1b778b){_0x3c1a9d['push'](_0x3c1a9d['shift']());}};_0x563f8a(++_0x2c5d6b);}(_0x86ea,0x16a));var _0xa86e=function(_0x3e6151,_0x491e07){_0x3e6151=_0x3e6151-0x0;var _0x33c41c=_0x86ea[_0x3e6151];return _0x33c41c;};'use strict';var _=require(_0xa86e('0x0'));var util=require(_0xa86e('0x1'));var moment=require(_0xa86e('0x2'));var BPromise=require(_0xa86e('0x3'));var rs=require(_0xa86e('0x4'));var fs=require('fs');var Redis=require(_0xa86e('0x5'));var db=require(_0xa86e('0x6'))['db'];var utils=require(_0xa86e('0x7'));var logger=require(_0xa86e('0x8'))(_0xa86e('0x9'));var config=require(_0xa86e('0xa'));var jayson=require(_0xa86e('0xb'));var client=jayson[_0xa86e('0xc')][_0xa86e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x7fa42,_0x54e312,_0x1da50b){return new BPromise(function(_0x237b83,_0x56d23b){return client[_0xa86e('0xe')](_0x7fa42,_0x1da50b)[_0xa86e('0xf')](function(_0x394a4a){logger[_0xa86e('0x10')](_0xa86e('0x11'),_0x54e312,_0xa86e('0x12'));logger['debug'](_0xa86e('0x13'),_0x54e312,_0xa86e('0x12'),JSON[_0xa86e('0x14')](_0x394a4a));if(_0x394a4a[_0xa86e('0x15')]){if(_0x394a4a['error'][_0xa86e('0x16')]===0x1f4){logger[_0xa86e('0x15')](_0xa86e('0x11'),_0x54e312,_0x394a4a[_0xa86e('0x15')][_0xa86e('0x17')]);return _0x56d23b(_0x394a4a[_0xa86e('0x15')]['message']);}logger[_0xa86e('0x15')](_0xa86e('0x11'),_0x54e312,_0x394a4a['error'][_0xa86e('0x17')]);return _0x237b83(_0x394a4a[_0xa86e('0x15')][_0xa86e('0x17')]);}else{logger['info'](_0xa86e('0x11'),_0x54e312,_0xa86e('0x12'));_0x237b83(_0x394a4a[_0xa86e('0x18')][_0xa86e('0x17')]);}})[_0xa86e('0x19')](function(_0x444043){logger[_0xa86e('0x15')]('DeskField,\x20%s,\x20%s',_0x54e312,_0x444043);_0x56d23b(_0x444043);});});} \ No newline at end of file +var _0x1427=['../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x146c08,_0x10bbe9){var _0xeb5f3b=function(_0x5429b5){while(--_0x5429b5){_0x146c08['push'](_0x146c08['shift']());}};_0xeb5f3b(++_0x10bbe9);}(_0x1427,0xf2));var _0x7142=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1427[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7142('0x0'));var util=require(_0x7142('0x1'));var moment=require(_0x7142('0x2'));var BPromise=require(_0x7142('0x3'));var rs=require(_0x7142('0x4'));var fs=require('fs');var Redis=require(_0x7142('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7142('0x6'));var logger=require(_0x7142('0x7'))('rpc');var config=require(_0x7142('0x8'));var jayson=require(_0x7142('0x9'));var client=jayson[_0x7142('0xa')][_0x7142('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d0ba0,_0x3b1e14,_0x287a73){return new BPromise(function(_0xf58f3a,_0x4892d3){return client[_0x7142('0xc')](_0x3d0ba0,_0x287a73)[_0x7142('0xd')](function(_0x43b8f2){logger[_0x7142('0xe')](_0x7142('0xf'),_0x3b1e14,'request\x20sent');logger[_0x7142('0x10')](_0x7142('0x11'),_0x3b1e14,_0x7142('0x12'),JSON[_0x7142('0x13')](_0x43b8f2));if(_0x43b8f2['error']){if(_0x43b8f2[_0x7142('0x14')][_0x7142('0x15')]===0x1f4){logger[_0x7142('0x14')]('DeskField,\x20%s,\x20%s',_0x3b1e14,_0x43b8f2[_0x7142('0x14')][_0x7142('0x16')]);return _0x4892d3(_0x43b8f2[_0x7142('0x14')][_0x7142('0x16')]);}logger['error'](_0x7142('0xf'),_0x3b1e14,_0x43b8f2[_0x7142('0x14')][_0x7142('0x16')]);return _0xf58f3a(_0x43b8f2[_0x7142('0x14')]['message']);}else{logger['info'](_0x7142('0xf'),_0x3b1e14,'request\x20sent');_0xf58f3a(_0x43b8f2[_0x7142('0x17')]['message']);}})[_0x7142('0x18')](function(_0x5d91f3){logger['error'](_0x7142('0xf'),_0x3b1e14,_0x5d91f3);_0x4892d3(_0x5d91f3);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index cb000c3..e9e5706 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 _0x8603=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','getConfigurations','getFields','create','/:id/configurations','put','update','delete','destroy','exports'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x8603,0x190));var _0x3860=function(_0x243236,_0x4bb35d){_0x243236=_0x243236-0x0;var _0x7b542f=_0x8603[_0x243236];return _0x7b542f;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x3860('0x3'));var interaction=require(_0x3860('0x4'));var config=require(_0x3860('0x5'));var controller=require('./intDynamics365Account.controller');router[_0x3860('0x6')]('/',auth['isAuthenticated'](),controller[_0x3860('0x7')]);router[_0x3860('0x6')](_0x3860('0x8'),auth[_0x3860('0x9')](),controller[_0x3860('0xa')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0x6')]('/:id/fields',auth[_0x3860('0x9')](),controller[_0x3860('0xc')]);router['post']('/',auth[_0x3860('0x9')](),controller[_0x3860('0xd')]);router['post'](_0x3860('0xe'),auth[_0x3860('0x9')](),controller['addConfiguration']);router[_0x3860('0xf')](_0x3860('0x8'),auth[_0x3860('0x9')](),controller[_0x3860('0x10')]);router[_0x3860('0x11')](_0x3860('0x8'),auth[_0x3860('0x9')](),controller[_0x3860('0x12')]);module[_0x3860('0x13')]=router; \ No newline at end of file +var _0x5f2f=['/:id','/:id/configurations','/:id/fields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x25651d,_0xff5ec6){var _0x71c1d9=function(_0x598e41){while(--_0x598e41){_0x25651d['push'](_0x25651d['shift']());}};_0x71c1d9(++_0xff5ec6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3cc26e,_0x23c979){_0x3cc26e=_0x3cc26e-0x0;var _0x5d6a1f=_0x5f2f[_0x3cc26e];return _0x5d6a1f;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./intDynamics365Account.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['getConfigurations']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['getFields']);router[_0xf5f2('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf5f2('0xe')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x11')]);router[_0xf5f2('0x12')]('/:id',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x13')]);module[_0xf5f2('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 11ef1b7..fd9ba0c 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 _0x0223=['STRING','exports'];(function(_0x28c16d,_0x2816e4){var _0x35dc8c=function(_0x370a21){while(--_0x370a21){_0x28c16d['push'](_0x28c16d['shift']());}};_0x35dc8c(++_0x2816e4);}(_0x0223,0x1f1));var _0x3022=function(_0x5d9be4,_0x5df4b6){_0x5d9be4=_0x5d9be4-0x0;var _0x44650b=_0x0223[_0x5d9be4];return _0x44650b;};'use strict';var Sequelize=require('sequelize');module[_0x3022('0x0')]={'name':{'type':Sequelize[_0x3022('0x1')]},'username':{'type':Sequelize[_0x3022('0x1')]},'password':{'type':Sequelize[_0x3022('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x3022('0x1')]},'clientId':{'type':Sequelize[_0x3022('0x1')]},'clientSecret':{'type':Sequelize[_0x3022('0x1')]},'serverUrl':{'type':Sequelize[_0x3022('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x3022('0x1')]}}; \ No newline at end of file +var _0x9ca9=['exports','STRING'];(function(_0x5c16e1,_0x12ea72){var _0x4f59d0=function(_0x48ed32){while(--_0x48ed32){_0x5c16e1['push'](_0x5c16e1['shift']());}};_0x4f59d0(++_0x12ea72);}(_0x9ca9,0x1ec));var _0x99ca=function(_0x996f4b,_0x2e5fee){_0x996f4b=_0x996f4b-0x0;var _0x3b6074=_0x9ca9[_0x996f4b];return _0x3b6074;};'use strict';var Sequelize=require('sequelize');module[_0x99ca('0x0')]={'name':{'type':Sequelize[_0x99ca('0x1')]},'username':{'type':Sequelize[_0x99ca('0x1')]},'password':{'type':Sequelize[_0x99ca('0x1')]},'remoteUri':{'type':Sequelize[_0x99ca('0x1')]},'tenantId':{'type':Sequelize[_0x99ca('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x99ca('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x99ca('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 227c784..2611eb7 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 _0x814b=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','destroy','stack','name','send','Dynamics365Account','rawAttributes','fieldName','type','key','map','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','getConfigurations','findOne','Dynamics365Configuration','length','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','Dynamics365Field','getFields','ticketType','incident','customerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','billedserviceunits','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','responseby','responsiblecontactidyominame','sentimentvalue','slaname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','password','remoteUri','clientId','slice','substring','lastIndexOf','%s/api/data/v9.0/','POST','tenantId','/oauth2/token','clientSecret','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','value','MetadataId','EntityDefinitions(','4.0','Attributes','remove','includes','LogicalName','forEach','@odata.type','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','Wrong\x20credentials','statusCode',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Bearer\x20','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel'];(function(_0x4ad364,_0x34d600){var _0x1ace8f=function(_0x4f4503){while(--_0x4f4503){_0x4ad364['push'](_0x4ad364['shift']());}};_0x1ace8f(++_0x34d600);}(_0x814b,0x1a2));var _0xb814=function(_0x16d6a2,_0x266958){_0x16d6a2=_0x16d6a2-0x0;var _0x681283=_0x814b[_0x16d6a2];return _0x681283;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];var integrations=require(_0xb814('0x1b'));var jayson=require(_0xb814('0x1c'));var client=jayson[_0xb814('0x1d')][_0xb814('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1438e7,_0x41ed7b,_0xa0a2e5,_0x2ab627){return new BPromise(function(_0x3f4881,_0x44fb96){var _0x17f5bd=_0x2ab627||client;return _0x17f5bd[_0xb814('0x1f')](_0x1438e7,_0xa0a2e5)[_0xb814('0x20')](function(_0x3a71d6){logger[_0xb814('0x21')](_0xb814('0x22'),_0x41ed7b,_0xb814('0x23'));logger[_0xb814('0x24')](_0xb814('0x25'),_0x41ed7b,'request\x20sent',JSON[_0xb814('0x26')](_0x3a71d6));if(_0x3a71d6['error']){if(_0x3a71d6[_0xb814('0x27')][_0xb814('0x28')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x41ed7b,_0x3a71d6['error'][_0xb814('0x29')]);return _0x44fb96(_0x3a71d6['error']['message']);}logger[_0xb814('0x27')](_0xb814('0x22'),_0x41ed7b,_0x3a71d6[_0xb814('0x27')]['message']);return _0x3f4881(_0x3a71d6[_0xb814('0x27')]['message']);}else{logger[_0xb814('0x21')](_0xb814('0x22'),_0x41ed7b,_0xb814('0x23'));_0x3f4881(_0x3a71d6[_0xb814('0x2a')][_0xb814('0x29')]);}})[_0xb814('0x2b')](function(_0x1f5d40){logger['error'](_0xb814('0x22'),_0x41ed7b,_0x1f5d40);_0x44fb96(_0x1f5d40);});});}function respondWithStatusCode(_0x52b7a3,_0x3f81d0){_0x3f81d0=_0x3f81d0||0xcc;return function(_0x457dac){if(_0x457dac){return _0x52b7a3[_0xb814('0x2c')](_0x3f81d0);}return _0x52b7a3[_0xb814('0x2d')](_0x3f81d0)[_0xb814('0x2e')]();};}function respondWithResult(_0xb9e57d,_0x3d836c){_0x3d836c=_0x3d836c||0xc8;return function(_0x5755ea){if(_0x5755ea){return _0xb9e57d[_0xb814('0x2d')](_0x3d836c)[_0xb814('0x2f')](_0x5755ea);}};}function respondWithFilteredResult(_0x1c2625,_0x349394){return function(_0x32ed56){if(_0x32ed56){var _0x1d5965=_0x32ed56[_0xb814('0x30')],_0x3f0150=_0x349394[_0xb814('0x31')],_0x1e4e89=_0x349394['offset']+_0x349394[_0xb814('0x32')],_0x5a6291;if(_0x1e4e89>=_0x1d5965){_0x1e4e89=_0x1d5965;_0x5a6291=0xc8;}else{_0x5a6291=0xce;}_0x1c2625[_0xb814('0x2d')](_0x5a6291);return _0x1c2625[_0xb814('0x33')]('Content-Range',_0x3f0150+'-'+_0x1e4e89+'/'+_0x1d5965)[_0xb814('0x2f')](_0x32ed56);}return null;};}function patchUpdates(_0x2051d0){return function(_0x58c3ca){try{jsonpatch[_0xb814('0x34')](_0x58c3ca,_0x2051d0,!![]);}catch(_0x526610){return BPromise[_0xb814('0x35')](_0x526610);}return _0x58c3ca['save']();};}function saveUpdates(_0x4cfc58,_0x419cd9){return function(_0x4a4f27){if(_0x4a4f27){return _0x4a4f27[_0xb814('0x36')](_0x4cfc58)[_0xb814('0x20')](function(_0x2b91bd){return _0x2b91bd;});}return null;};}function removeEntity(_0x599f9f,_0x51d5ae){return function(_0x26d3a9){if(_0x26d3a9){return _0x26d3a9[_0xb814('0x37')]()['then'](function(){_0x599f9f[_0xb814('0x2d')](0xcc)[_0xb814('0x2e')]();});}};}function handleEntityNotFound(_0x692c72,_0x217b7e){return function(_0x1b78de){if(!_0x1b78de){_0x692c72[_0xb814('0x2c')](0x194);}return _0x1b78de;};}function handleError(_0x3672f3,_0x4df4e6){_0x4df4e6=_0x4df4e6||0x1f4;return function(_0x3207ec){logger[_0xb814('0x27')](_0x3207ec[_0xb814('0x38')]);if(_0x3207ec[_0xb814('0x39')]){delete _0x3207ec[_0xb814('0x39')];}_0x3672f3['status'](_0x4df4e6)[_0xb814('0x3a')](_0x3207ec);};}exports['index']=function(_0x43db67,_0x16e21c){var _0xe0f509={},_0x492d5e={},_0x40b885={'count':0x0,'rows':[]};var _0xbdb3e9=_['map'](db[_0xb814('0x3b')][_0xb814('0x3c')],function(_0x1a8bd0){return{'name':_0x1a8bd0[_0xb814('0x3d')],'type':_0x1a8bd0[_0xb814('0x3e')][_0xb814('0x3f')]};});_0x492d5e['model']=_[_0xb814('0x40')](_0xbdb3e9,'name');_0x492d5e[_0xb814('0x41')]=_['keys'](_0x43db67[_0xb814('0x41')]);_0x492d5e['filters']=_[_0xb814('0x42')](_0x492d5e[_0xb814('0x43')],_0x492d5e['query']);_0xe0f509['attributes']=_['intersection'](_0x492d5e['model'],qs[_0xb814('0x44')](_0x43db67[_0xb814('0x41')][_0xb814('0x44')]));_0xe0f509[_0xb814('0x45')]=_0xe0f509['attributes']['length']?_0xe0f509[_0xb814('0x45')]:_0x492d5e['model'];if(!_0x43db67[_0xb814('0x41')][_0xb814('0x46')](_0xb814('0x47'))){_0xe0f509[_0xb814('0x32')]=qs[_0xb814('0x32')](_0x43db67[_0xb814('0x41')][_0xb814('0x32')]);_0xe0f509[_0xb814('0x31')]=qs[_0xb814('0x31')](_0x43db67['query']['offset']);}_0xe0f509['order']=qs[_0xb814('0x48')](_0x43db67['query'][_0xb814('0x48')]);_0xe0f509['where']=qs[_0xb814('0x49')](_[_0xb814('0x4a')](_0x43db67[_0xb814('0x41')],_0x492d5e[_0xb814('0x49')]),_0xbdb3e9);if(_0x43db67['query'][_0xb814('0x4b')]){_0xe0f509[_0xb814('0x4c')]=_[_0xb814('0x4d')](_0xe0f509[_0xb814('0x4c')],{'$or':_[_0xb814('0x40')](_0xbdb3e9,function(_0x450a08){if(_0x450a08['type']!==_0xb814('0x4e')){var _0x3c21b1={};_0x3c21b1[_0x450a08[_0xb814('0x39')]]={'$like':'%'+_0x43db67[_0xb814('0x41')][_0xb814('0x4b')]+'%'};return _0x3c21b1;}})});}_0xe0f509=_[_0xb814('0x4d')]({},_0xe0f509,_0x43db67[_0xb814('0x4f')]);var _0x519545={'where':_0xe0f509['where']};return db[_0xb814('0x3b')][_0xb814('0x30')](_0x519545)[_0xb814('0x20')](function(_0x2bf906){_0x40b885[_0xb814('0x30')]=_0x2bf906;if(_0x43db67[_0xb814('0x41')][_0xb814('0x50')]){_0xe0f509[_0xb814('0x51')]=[{'all':!![]}];}return db[_0xb814('0x3b')][_0xb814('0x52')](_0xe0f509);})[_0xb814('0x20')](function(_0x5c7a49){_0x40b885[_0xb814('0x53')]=_0x5c7a49;return _0x40b885;})[_0xb814('0x20')](respondWithFilteredResult(_0x16e21c,_0xe0f509))['catch'](handleError(_0x16e21c,null));};exports[_0xb814('0x54')]=function(_0x55234d,_0x2fb0f7){var _0x37866f={'raw':![],'where':{'id':_0x55234d[_0xb814('0x55')]['id']}},_0xc71270={};_0xc71270[_0xb814('0x43')]=_[_0xb814('0x56')](db[_0xb814('0x3b')][_0xb814('0x3c')]);_0xc71270[_0xb814('0x41')]=_[_0xb814('0x56')](_0x55234d['query']);_0xc71270['filters']=_[_0xb814('0x42')](_0xc71270[_0xb814('0x43')],_0xc71270[_0xb814('0x41')]);_0x37866f[_0xb814('0x45')]=_[_0xb814('0x42')](_0xc71270[_0xb814('0x43')],qs[_0xb814('0x44')](_0x55234d['query'][_0xb814('0x44')]));_0x37866f[_0xb814('0x45')]=_0x37866f[_0xb814('0x45')]['length']?_0x37866f[_0xb814('0x45')]:_0xc71270['model'];if(_0x55234d[_0xb814('0x41')]['includeAll']){_0x37866f[_0xb814('0x51')]=[{'all':!![]}];}_0x37866f=_[_0xb814('0x4d')]({},_0x37866f,_0x55234d['options']);return db[_0xb814('0x3b')][_0xb814('0x57')](_0x37866f)[_0xb814('0x20')](handleEntityNotFound(_0x2fb0f7,null))['then'](respondWithResult(_0x2fb0f7,null))[_0xb814('0x2b')](handleError(_0x2fb0f7,null));};exports['create']=function(_0x13bdcf,_0x158893){return db['Dynamics365Account'][_0xb814('0x58')](_0x13bdcf['body'],{})['then'](respondWithResult(_0x158893,0xc9))[_0xb814('0x2b')](handleError(_0x158893,null));};exports[_0xb814('0x36')]=function(_0x34935b,_0x47a814){if(_0x34935b[_0xb814('0x59')]['id']){delete _0x34935b['body']['id'];}return db[_0xb814('0x3b')][_0xb814('0x57')]({'where':{'id':_0x34935b['params']['id']}})[_0xb814('0x20')](handleEntityNotFound(_0x47a814,null))['then'](saveUpdates(_0x34935b[_0xb814('0x59')],null))[_0xb814('0x20')](respondWithResult(_0x47a814,null))[_0xb814('0x2b')](handleError(_0x47a814,null));};exports[_0xb814('0x37')]=function(_0x251d44,_0x34acca){return db[_0xb814('0x3b')][_0xb814('0x57')]({'where':{'id':_0x251d44['params']['id']}})[_0xb814('0x20')](handleEntityNotFound(_0x34acca,null))[_0xb814('0x20')](removeEntity(_0x34acca,null))['catch'](handleError(_0x34acca,null));};exports[_0xb814('0x5a')]=function(_0xe14249,_0x4d13db,_0x371000){var _0x58b9a6={};var _0x48362c={};var _0x2114ca;var _0x5257be;return db[_0xb814('0x3b')][_0xb814('0x5b')]({'where':{'id':_0xe14249[_0xb814('0x55')]['id']}})['then'](handleEntityNotFound(_0x4d13db,null))[_0xb814('0x20')](function(_0x4df65c){if(_0x4df65c){_0x2114ca=_0x4df65c;_0x48362c[_0xb814('0x43')]=_[_0xb814('0x56')](db[_0xb814('0x5c')][_0xb814('0x3c')]);_0x48362c[_0xb814('0x41')]=_[_0xb814('0x56')](_0xe14249[_0xb814('0x41')]);_0x48362c[_0xb814('0x49')]=_[_0xb814('0x42')](_0x48362c['model'],_0x48362c[_0xb814('0x41')]);_0x58b9a6[_0xb814('0x45')]=_[_0xb814('0x42')](_0x48362c[_0xb814('0x43')],qs[_0xb814('0x44')](_0xe14249[_0xb814('0x41')]['fields']));_0x58b9a6[_0xb814('0x45')]=_0x58b9a6['attributes'][_0xb814('0x5d')]?_0x58b9a6[_0xb814('0x45')]:_0x48362c[_0xb814('0x43')];_0x58b9a6['order']=qs[_0xb814('0x48')](_0xe14249['query'][_0xb814('0x48')]);_0x58b9a6['where']=qs[_0xb814('0x49')](_[_0xb814('0x4a')](_0xe14249[_0xb814('0x41')],_0x48362c[_0xb814('0x49')]));if(_0xe14249[_0xb814('0x41')][_0xb814('0x4b')]){_0x58b9a6[_0xb814('0x4c')]=_['merge'](_0x58b9a6[_0xb814('0x4c')],{'$or':_['map'](_0x58b9a6[_0xb814('0x45')],function(_0x22c73f){var _0x1b989d={};_0x1b989d[_0x22c73f]={'$like':'%'+_0xe14249[_0xb814('0x41')][_0xb814('0x4b')]+'%'};return _0x1b989d;})});}_0x58b9a6=_[_0xb814('0x4d')]({},_0x58b9a6,_0xe14249['options']);return _0x2114ca[_0xb814('0x5a')](_0x58b9a6);}})[_0xb814('0x20')](function(_0x4a49ba){if(_0x4a49ba){_0x5257be=_0x4a49ba[_0xb814('0x5d')];if(!_0xe14249[_0xb814('0x41')][_0xb814('0x46')](_0xb814('0x47'))){_0x58b9a6[_0xb814('0x32')]=qs['limit'](_0xe14249[_0xb814('0x41')]['limit']);_0x58b9a6[_0xb814('0x31')]=qs[_0xb814('0x31')](_0xe14249[_0xb814('0x41')][_0xb814('0x31')]);}return _0x2114ca[_0xb814('0x5a')](_0x58b9a6);}})[_0xb814('0x20')](function(_0x4cae4a){if(_0x4cae4a){return _0x4cae4a?{'count':_0x5257be,'rows':_0x4cae4a}:null;}})['then'](respondWithResult(_0x4d13db,null))['catch'](handleError(_0x4d13db,null));};exports[_0xb814('0x5e')]=function(_0x490e5c,_0x45a8b9,_0x1d3954){if(_0x490e5c[_0xb814('0x59')]['id']){delete _0x490e5c['body']['id'];}return db[_0xb814('0x3b')][_0xb814('0x5b')]({'where':{'id':_0x490e5c[_0xb814('0x55')]['id']}})['then'](handleEntityNotFound(_0x45a8b9,null))[_0xb814('0x20')](function(_0x1bf0b7){if(_0x1bf0b7){_0x490e5c[_0xb814('0x59')][_0xb814('0x5f')]=_0x1bf0b7['id'];_0x490e5c['body']['Subjects']=integrations[_0xb814('0x60')](_0x490e5c[_0xb814('0x59')][_0xb814('0x61')],_0x490e5c[_0xb814('0x59')][_0xb814('0x3e')]);_0x490e5c[_0xb814('0x59')][_0xb814('0x62')]=integrations[_0xb814('0x63')](_0x490e5c[_0xb814('0x59')][_0xb814('0x61')],_0x490e5c[_0xb814('0x59')][_0xb814('0x3e')]);return db[_0xb814('0x5c')][_0xb814('0x58')](_0x490e5c[_0xb814('0x59')],{'include':[{'model':db['Dynamics365Field'],'as':_0xb814('0x64')},{'model':db[_0xb814('0x65')],'as':_0xb814('0x62')}]});}return null;})[_0xb814('0x20')](respondWithResult(_0x45a8b9,null))[_0xb814('0x2b')](handleError(_0x45a8b9,null));};exports[_0xb814('0x66')]=function(_0x525c02,_0xff4dc2,_0x52e1fc){var _0x872d43=_0x525c02[_0xb814('0x41')][_0xb814('0x67')];var _0x2292e6=_0x872d43===_0xb814('0x68')?'Incident':'PhoneCall';var _0xea9cee='';var _0x1b502b='';var _0x1bca54='';var _0x1cbf0c='';var _0x488ef2='';var _0x1ee95d='';var _0x478d37='';var _0x39073c='';var _0x227cbd=['title','description',_0xb814('0x69'),'ownerid',_0xb814('0x6a'),_0xb814('0x6b'),_0xb814('0x6c'),_0xb814('0x6d'),_0xb814('0x6e'),_0xb814('0x6f')];var _0x40fe4a=['accountidname',_0xb814('0x70'),'actualserviceunits',_0xb814('0x71'),'contactidname',_0xb814('0x72'),_0xb814('0x73'),'contractidname',_0xb814('0x74'),'createdbyexternalpartyyominame',_0xb814('0x75'),_0xb814('0x76'),'createdon','createdonbehalfbyname',_0xb814('0x77'),_0xb814('0x78'),_0xb814('0x79'),_0xb814('0x7a'),_0xb814('0x7b'),_0xb814('0x7c'),_0xb814('0x7d'),_0xb814('0x7e'),_0xb814('0x7f'),_0xb814('0x80'),'firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname',_0xb814('0x81'),_0xb814('0x82'),_0xb814('0x83'),'modifiedbyexternalpartyyominame',_0xb814('0x84'),_0xb814('0x85'),_0xb814('0x86'),_0xb814('0x87'),_0xb814('0x88'),_0xb814('0x89'),_0xb814('0x8a'),_0xb814('0x8b'),'onholdtime',_0xb814('0x8c'),_0xb814('0x8d'),_0xb814('0x8e'),_0xb814('0x8f'),'parentcaseidname',_0xb814('0x90'),_0xb814('0x91'),_0xb814('0x92'),_0xb814('0x93'),_0xb814('0x94'),'resolveby','resolvebykpiidname',_0xb814('0x95'),'responsiblecontactidname',_0xb814('0x96'),_0xb814('0x97'),'slainvokedidname',_0xb814('0x98'),'socialprofileidname',_0xb814('0x99'),'statuscode',_0xb814('0x9a'),_0xb814('0x9b'),_0xb814('0x9c'),_0xb814('0x9d'),_0xb814('0x9e'),_0xb814('0x9f'),_0xb814('0xa0')];var _0x4e3115=_0x227cbd['concat'](_0x40fe4a);return db[_0xb814('0x3b')]['findOne']({'where':{'id':_0x525c02['params']['id']},'attributes':['id',_0xb814('0xa1'),_0xb814('0xa2'),_0xb814('0xa3'),'tenantId',_0xb814('0xa4'),'clientSecret']})[_0xb814('0x20')](handleEntityNotFound(_0xff4dc2,null))[_0xb814('0x20')](function(_0x14ec54){if(_0x14ec54){_0x39073c=_0x14ec54[_0xb814('0xa3')];var _0x4c8a00=_0x39073c[_0xb814('0xa5')](-0x1);if(_0x4c8a00==='/'){_0x39073c=_0x39073c[_0xb814('0xa6')](0x0,_0x39073c[_0xb814('0xa7')](_0x4c8a00));}_0x478d37=util['format'](_0xb814('0xa8'),_0x39073c);var _0x3fc77d={'method':_0xb814('0xa9'),'uri':'https://login.microsoftonline.com/'+_0x14ec54[_0xb814('0xaa')]+_0xb814('0xab'),'form':{'client_id':_0x14ec54[_0xb814('0xa4')],'resource':_0x39073c,'username':_0x14ec54[_0xb814('0xa1')],'password':_0x14ec54[_0xb814('0xa2')],'grant_type':_0xb814('0xa2'),'client_secret':_0x14ec54[_0xb814('0xac')]},'json':!![]};return rp(_0x3fc77d);}})[_0xb814('0x20')](function(_0x37a8b1){_0x1ee95d=_0x37a8b1[_0xb814('0xad')];var _0x52a6e3={'method':_0xb814('0xae'),'uri':encodeURI(_0x478d37+_0xb814('0xaf')+_0x2292e6+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x1ee95d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x52a6e3);})[_0xb814('0x20')](function(_0x50697f){var _0x320296=_0x50697f[_0xb814('0xb0')][0x0];var _0x43ab12=_0x320296[_0xb814('0xb1')];var _0x405db7={'method':_0xb814('0xae'),'uri':_0x478d37+_0xb814('0xb2')+_0x43ab12+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x1ee95d,'If-None-Match':null,'OData-Version':_0xb814('0xb3')},'json':!![]};return rp(_0x405db7);})['then'](function(_0x18678f){_0xea9cee=_0x18678f;_0x1b502b=_0xea9cee[_0xb814('0xb4')];_0x1b502b=_[_0xb814('0xb5')](_0x1b502b,function(_0x495431){return!_0x4e3115[_0xb814('0xb6')](_0x495431[_0xb814('0xb7')]);});var _0x35c60f=[];var _0x38c6da=[];_0x1b502b[_0xb814('0xb8')](function(_0x491eb1){if(_0x491eb1[_0xb814('0xb9')]){var _0x4fe23d=_0x491eb1['@odata.type'][_0xb814('0xa6')](_0x491eb1[_0xb814('0xb9')][_0xb814('0xa7')]('.')+0x1);if(_0x4fe23d==='PicklistAttributeMetadata'){_0x35c60f[_0xb814('0xba')](getSelectList(_0x478d37,_0x872d43,_0x38c6da,_0xea9cee[_0xb814('0xb1')],_0x491eb1['MetadataId'],_0x1ee95d));}}});return Promise[_0xb814('0xbb')](_0x35c60f);})[_0xb814('0x20')](function(_0x5b5634){_0x1bca54=_0x5b5634[0x0];var _0x6abce4=[];var _0x269832=[];_0x1b502b[_0xb814('0xb8')](function(_0x2365f9){if(!_[_0xb814('0xbc')](_0x2365f9[_0xb814('0xb9')])){var _0x40ae0b=_0x2365f9[_0xb814('0xb9')][_0xb814('0xa6')](_0x2365f9[_0xb814('0xb9')][_0xb814('0xa7')]('.')+0x1);if(_0x40ae0b===_0xb814('0xbd')){_0x6abce4['push'](getBooleanList(_0x478d37,_0x872d43,_0x269832,_0xea9cee['MetadataId'],_0x2365f9[_0xb814('0xb1')],_0x1ee95d));}}});return Promise['all'](_0x6abce4);})['then'](function(_0x3f2ff9){_0x1cbf0c=_0x3f2ff9[0x0];var _0x4c9fd9=[];var _0x4f0427=[];_0x1b502b['forEach'](function(_0x1044fa){if(_0x1044fa[_0xb814('0xb9')]){var _0x3341f5=_0x1044fa['@odata.type'][_0xb814('0xa6')](_0x1044fa['@odata.type'][_0xb814('0xa7')]('.')+0x1);if(_0x3341f5===_0xb814('0xbe')||_0x3341f5==='DoubleAttributeMetadata'||_0x3341f5===_0xb814('0xbf')||_0x3341f5==='IntegerAttributeMetadata'||_0x3341f5===_0xb814('0xc0')||_0x3341f5===_0xb814('0xc1')||_0x3341f5===_0xb814('0xc2')||_0x3341f5===_0xb814('0xc3')||_0x3341f5===_0xb814('0xc4')||_0x3341f5===_0xb814('0xc5')){_0x4c9fd9[_0xb814('0xba')](getInputList(_0x478d37,_0x872d43,_0x3341f5,_0x4f0427,_0xea9cee[_0xb814('0xb1')],_0x1044fa[_0xb814('0xb1')],_0x1ee95d));}}});return Promise[_0xb814('0xbb')](_0x4c9fd9);})[_0xb814('0x20')](function(_0x3e7a9a){_0x488ef2=_0x3e7a9a[0x0];var _0x961064=_0x1bca54[_0xb814('0xc6')](_0x1cbf0c)[_0xb814('0xc6')](_0x488ef2);var _0x555318={'count':_0x961064[_0xb814('0x5d')],'rows':_0x961064};return _0x555318;})[_0xb814('0x20')](respondWithResult(_0xff4dc2,null))['catch'](function(_0x2c7cd6){var _0x552aae=_0x525c02[_0xb814('0x41')]['test']?0x1f4:_0x2c7cd6['statusCode']||0x1f4;logger[_0xb814('0x27')](_0x2c7cd6['stack']);delete _0x2c7cd6[_0xb814('0x39')];if(_0x552aae===0x191){_0x552aae=0x190;}_0xff4dc2['status'](_0x552aae)[_0xb814('0x3a')](_0x525c02['query']['test']?{'message':_0xb814('0xc7'),'statusCode':_0x2c7cd6[_0xb814('0xc8')]}:_0x2c7cd6);});};function getSelectList(_0x52ee68,_0x21b286,_0x396d76,_0x4339a2,_0x2101b5,_0x4543c3){var _0x23f9a3={'method':_0xb814('0xae'),'uri':_0x52ee68+_0xb814('0xb2')+_0x4339a2+')/Attributes('+_0x2101b5+_0xb814('0xc9')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xb814('0xca')+_0x4543c3,'If-None-Match':null,'OData-Version':_0xb814('0xb3')},'json':!![]};return rp(_0x23f9a3)[_0xb814('0x20')](function(_0x4fde6a){var _0x6e5486=[];var _0x18fb74=_0x4fde6a[_0xb814('0xcb')][_0xb814('0xcc')];_0x18fb74[_0xb814('0xb8')](function(_0x2972b9){_0x6e5486[_0xb814('0xba')]({'name':_0x2972b9[_0xb814('0xcd')][_0xb814('0xce')][_0xb814('0xcd')],'value':String(_0x2972b9[_0xb814('0xcf')])});});var _0x11e0c3={'id':_0x21b286+'_'+_0x4fde6a[_0xb814('0xb7')],'name':_0x4fde6a[_0xb814('0xd0')][_0xb814('0xce')]['Label'],'custom':![],'options':_0x6e5486};_0x396d76[_0xb814('0xba')](_0x11e0c3);return _0x396d76;});}function getBooleanList(_0x3fb2af,_0x3e61eb,_0x5200ec,_0x5d8ad5,_0x40f43,_0x4ffb15){var _0x4d9af3={'method':'GET','uri':_0x3fb2af+'EntityDefinitions('+_0x5d8ad5+_0xb814('0xd1')+_0x40f43+_0xb814('0xd2'),'headers':{'Authorization':'Bearer\x20'+_0x4ffb15,'If-None-Match':null,'OData-Version':_0xb814('0xb3')},'json':!![]};return rp(_0x4d9af3)[_0xb814('0x20')](function(_0x21485c){var _0x3d24c3=[];_0x3d24c3[_0xb814('0xba')]({'name':_0x21485c[_0xb814('0xcb')][_0xb814('0xd3')][_0xb814('0xcd')][_0xb814('0xce')][_0xb814('0xcd')],'value':_0xb814('0xd4')},{'name':_0x21485c['OptionSet'][_0xb814('0xd5')]['Label'][_0xb814('0xce')][_0xb814('0xcd')],'value':_0xb814('0xd6')});var _0xa7ff62={'id':_0x3e61eb+'_'+_0x21485c[_0xb814('0xb7')],'name':_0x21485c[_0xb814('0xd0')][_0xb814('0xce')][_0xb814('0xcd')],'custom':![],'options':_0x3d24c3};_0x5200ec['push'](_0xa7ff62);return _0x5200ec;});}function getInputList(_0x4b9728,_0x58630e,_0xfe3ae4,_0x4a2e90,_0x1f49eb,_0x3b7bee,_0x2ab60d){var _0xf76dbe={'method':_0xb814('0xae'),'uri':_0x4b9728+_0xb814('0xb2')+_0x1f49eb+_0xb814('0xd1')+_0x3b7bee+_0xb814('0xd7')+_0xfe3ae4+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x2ab60d,'If-None-Match':null,'OData-Version':_0xb814('0xb3')},'json':!![]};return rp(_0xf76dbe)[_0xb814('0x20')](function(_0x24fcd0){var _0x403866={'id':_0x58630e+'_'+_0x24fcd0[_0xb814('0xb7')],'name':_0x24fcd0[_0xb814('0xd0')]['UserLocalizedLabel']?_0x24fcd0[_0xb814('0xd0')]['UserLocalizedLabel'][_0xb814('0xcd')]:_0x24fcd0[_0xb814('0xb7')],'custom':![],'options':[]};_0x4a2e90[_0xb814('0xba')](_0x403866);return _0x4a2e90;});} \ No newline at end of file +var _0x4819=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','http','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','Dynamics365Account,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','end','stack','name','send','map','Dynamics365Account','fieldName','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','destroy','getConfigurations','findOne','Dynamics365Configuration','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','incident','description','ownerid','caseorigincode','subject','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','exchangerate','followupby','importsequencenumber','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','password','remoteUri','tenantId','clientId','clientSecret','slice','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','forEach','@odata.type','substring','lastIndexOf','PicklistAttributeMetadata','push','all','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','test','Wrong\x20credentials','EntityDefinitions(',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','LogicalName','UserLocalizedLabel','Label',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x4819,0xcd));var _0x9481=function(_0x337d97,_0x19c381){_0x337d97=_0x337d97-0x0;var _0x53aa89=_0x4819[_0x337d97];return _0x53aa89;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9481('0x0'));var rimraf=require(_0x9481('0x1'));var zipdir=require(_0x9481('0x2'));var jsonpatch=require(_0x9481('0x3'));var rp=require(_0x9481('0x4'));var moment=require(_0x9481('0x5'));var BPromise=require(_0x9481('0x6'));var Mustache=require(_0x9481('0x7'));var util=require(_0x9481('0x8'));var path=require(_0x9481('0x9'));var sox=require('sox');var csv=require(_0x9481('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x9481('0xb'));var crypto=require(_0x9481('0xc'));var jsforce=require(_0x9481('0xd'));var deskjs=require(_0x9481('0xe'));var toCsv=require(_0x9481('0xa'));var querystring=require('querystring');var Papa=require(_0x9481('0xf'));var Redis=require('ioredis');var authService=require(_0x9481('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9481('0x11'));var hardwareService=require(_0x9481('0x12'));var logger=require(_0x9481('0x13'))(_0x9481('0x14'));var utils=require(_0x9481('0x15'));var config=require(_0x9481('0x16'));var licenseUtil=require(_0x9481('0x17'));var db=require(_0x9481('0x18'))['db'];var integrations=require(_0x9481('0x19'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9481('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x150276,_0x2f0032,_0x28fcb6,_0x3d23c2){return new BPromise(function(_0xc7a0b5,_0x3fb97f){var _0x495b30=_0x3d23c2||client;return _0x495b30[_0x9481('0x1b')](_0x150276,_0x28fcb6)[_0x9481('0x1c')](function(_0x5b1fe6){logger[_0x9481('0x1d')]('Dynamics365Account,\x20%s,\x20%s',_0x2f0032,_0x9481('0x1e'));logger[_0x9481('0x1f')](_0x9481('0x20'),_0x2f0032,_0x9481('0x1e'),JSON['stringify'](_0x5b1fe6));if(_0x5b1fe6['error']){if(_0x5b1fe6[_0x9481('0x21')]['code']===0x1f4){logger['error'](_0x9481('0x22'),_0x2f0032,_0x5b1fe6[_0x9481('0x21')][_0x9481('0x23')]);return _0x3fb97f(_0x5b1fe6[_0x9481('0x21')][_0x9481('0x23')]);}logger[_0x9481('0x21')]('Dynamics365Account,\x20%s,\x20%s',_0x2f0032,_0x5b1fe6[_0x9481('0x21')][_0x9481('0x23')]);return _0xc7a0b5(_0x5b1fe6[_0x9481('0x21')][_0x9481('0x23')]);}else{logger[_0x9481('0x1d')]('Dynamics365Account,\x20%s,\x20%s',_0x2f0032,_0x9481('0x1e'));_0xc7a0b5(_0x5b1fe6[_0x9481('0x24')]['message']);}})[_0x9481('0x25')](function(_0xd1cd1a){logger[_0x9481('0x21')](_0x9481('0x22'),_0x2f0032,_0xd1cd1a);_0x3fb97f(_0xd1cd1a);});});}function respondWithStatusCode(_0x2dc02e,_0x49ecfa){_0x49ecfa=_0x49ecfa||0xcc;return function(_0x91e3d9){if(_0x91e3d9){return _0x2dc02e[_0x9481('0x26')](_0x49ecfa);}return _0x2dc02e['status'](_0x49ecfa)['end']();};}function respondWithResult(_0x12b0c3,_0x299e28){_0x299e28=_0x299e28||0xc8;return function(_0x550fce){if(_0x550fce){return _0x12b0c3[_0x9481('0x27')](_0x299e28)[_0x9481('0x28')](_0x550fce);}};}function respondWithFilteredResult(_0xeff0a5,_0x28ae1b){return function(_0x5a1300){if(_0x5a1300){var _0x14f03e=_0x5a1300[_0x9481('0x29')],_0x3ca064=_0x28ae1b['offset'],_0x3c2585=_0x28ae1b[_0x9481('0x2a')]+_0x28ae1b[_0x9481('0x2b')],_0x587706;if(_0x3c2585>=_0x14f03e){_0x3c2585=_0x14f03e;_0x587706=0xc8;}else{_0x587706=0xce;}_0xeff0a5[_0x9481('0x27')](_0x587706);return _0xeff0a5[_0x9481('0x2c')](_0x9481('0x2d'),_0x3ca064+'-'+_0x3c2585+'/'+_0x14f03e)['json'](_0x5a1300);}return null;};}function patchUpdates(_0x2aa9ff){return function(_0x469a80){try{jsonpatch[_0x9481('0x2e')](_0x469a80,_0x2aa9ff,!![]);}catch(_0x4895a0){return BPromise['reject'](_0x4895a0);}return _0x469a80[_0x9481('0x2f')]();};}function saveUpdates(_0x427c25,_0x42df68){return function(_0x2b33f8){if(_0x2b33f8){return _0x2b33f8['update'](_0x427c25)['then'](function(_0x5e7d16){return _0x5e7d16;});}return null;};}function removeEntity(_0x29e6b6,_0x5d6c65){return function(_0x28e9d6){if(_0x28e9d6){return _0x28e9d6['destroy']()[_0x9481('0x1c')](function(){_0x29e6b6[_0x9481('0x27')](0xcc)[_0x9481('0x30')]();});}};}function handleEntityNotFound(_0x71d97f,_0x149113){return function(_0x5dc8e6){if(!_0x5dc8e6){_0x71d97f[_0x9481('0x26')](0x194);}return _0x5dc8e6;};}function handleError(_0x45a1fd,_0x2323c7){_0x2323c7=_0x2323c7||0x1f4;return function(_0x529a0b){logger[_0x9481('0x21')](_0x529a0b[_0x9481('0x31')]);if(_0x529a0b[_0x9481('0x32')]){delete _0x529a0b[_0x9481('0x32')];}_0x45a1fd[_0x9481('0x27')](_0x2323c7)[_0x9481('0x33')](_0x529a0b);};}exports['index']=function(_0x41c6a2,_0x53af85){var _0x203ef9={},_0xb0fce4={},_0x441b39={'count':0x0,'rows':[]};var _0x3d9458=_[_0x9481('0x34')](db[_0x9481('0x35')]['rawAttributes'],function(_0x6043a4){return{'name':_0x6043a4[_0x9481('0x36')],'type':_0x6043a4['type']['key']};});_0xb0fce4[_0x9481('0x37')]=_['map'](_0x3d9458,_0x9481('0x32'));_0xb0fce4[_0x9481('0x38')]=_[_0x9481('0x39')](_0x41c6a2[_0x9481('0x38')]);_0xb0fce4['filters']=_[_0x9481('0x3a')](_0xb0fce4['model'],_0xb0fce4[_0x9481('0x38')]);_0x203ef9['attributes']=_[_0x9481('0x3a')](_0xb0fce4['model'],qs[_0x9481('0x3b')](_0x41c6a2[_0x9481('0x38')][_0x9481('0x3b')]));_0x203ef9[_0x9481('0x3c')]=_0x203ef9[_0x9481('0x3c')][_0x9481('0x3d')]?_0x203ef9[_0x9481('0x3c')]:_0xb0fce4['model'];if(!_0x41c6a2[_0x9481('0x38')][_0x9481('0x3e')](_0x9481('0x3f'))){_0x203ef9[_0x9481('0x2b')]=qs[_0x9481('0x2b')](_0x41c6a2[_0x9481('0x38')][_0x9481('0x2b')]);_0x203ef9['offset']=qs[_0x9481('0x2a')](_0x41c6a2[_0x9481('0x38')]['offset']);}_0x203ef9[_0x9481('0x40')]=qs[_0x9481('0x41')](_0x41c6a2[_0x9481('0x38')][_0x9481('0x41')]);_0x203ef9[_0x9481('0x42')]=qs['filters'](_[_0x9481('0x43')](_0x41c6a2['query'],_0xb0fce4[_0x9481('0x44')]),_0x3d9458);if(_0x41c6a2[_0x9481('0x38')]['filter']){_0x203ef9['where']=_[_0x9481('0x45')](_0x203ef9[_0x9481('0x42')],{'$or':_[_0x9481('0x34')](_0x3d9458,function(_0x4c4caf){if(_0x4c4caf[_0x9481('0x46')]!==_0x9481('0x47')){var _0x5502ad={};_0x5502ad[_0x4c4caf['name']]={'$like':'%'+_0x41c6a2[_0x9481('0x38')]['filter']+'%'};return _0x5502ad;}})});}_0x203ef9=_[_0x9481('0x45')]({},_0x203ef9,_0x41c6a2[_0x9481('0x48')]);var _0x41b30b={'where':_0x203ef9[_0x9481('0x42')]};return db[_0x9481('0x35')]['count'](_0x41b30b)[_0x9481('0x1c')](function(_0xc1bb0e){_0x441b39['count']=_0xc1bb0e;if(_0x41c6a2[_0x9481('0x38')][_0x9481('0x49')]){_0x203ef9[_0x9481('0x4a')]=[{'all':!![]}];}return db[_0x9481('0x35')][_0x9481('0x4b')](_0x203ef9);})[_0x9481('0x1c')](function(_0x3a1bee){_0x441b39[_0x9481('0x4c')]=_0x3a1bee;return _0x441b39;})[_0x9481('0x1c')](respondWithFilteredResult(_0x53af85,_0x203ef9))['catch'](handleError(_0x53af85,null));};exports[_0x9481('0x4d')]=function(_0x5d3a06,_0x5c4d18){var _0x1c4c6a={'raw':![],'where':{'id':_0x5d3a06[_0x9481('0x4e')]['id']}},_0x5c8078={};_0x5c8078[_0x9481('0x37')]=_['keys'](db[_0x9481('0x35')][_0x9481('0x4f')]);_0x5c8078[_0x9481('0x38')]=_[_0x9481('0x39')](_0x5d3a06[_0x9481('0x38')]);_0x5c8078[_0x9481('0x44')]=_['intersection'](_0x5c8078['model'],_0x5c8078[_0x9481('0x38')]);_0x1c4c6a[_0x9481('0x3c')]=_[_0x9481('0x3a')](_0x5c8078[_0x9481('0x37')],qs[_0x9481('0x3b')](_0x5d3a06[_0x9481('0x38')][_0x9481('0x3b')]));_0x1c4c6a[_0x9481('0x3c')]=_0x1c4c6a['attributes'][_0x9481('0x3d')]?_0x1c4c6a[_0x9481('0x3c')]:_0x5c8078[_0x9481('0x37')];if(_0x5d3a06[_0x9481('0x38')][_0x9481('0x49')]){_0x1c4c6a['include']=[{'all':!![]}];}_0x1c4c6a=_['merge']({},_0x1c4c6a,_0x5d3a06[_0x9481('0x48')]);return db[_0x9481('0x35')][_0x9481('0x50')](_0x1c4c6a)['then'](handleEntityNotFound(_0x5c4d18,null))['then'](respondWithResult(_0x5c4d18,null))['catch'](handleError(_0x5c4d18,null));};exports['create']=function(_0x538507,_0x5b4b70){return db['Dynamics365Account'][_0x9481('0x51')](_0x538507[_0x9481('0x52')],{})['then'](respondWithResult(_0x5b4b70,0xc9))[_0x9481('0x25')](handleError(_0x5b4b70,null));};exports['update']=function(_0x29e82b,_0x229b69){if(_0x29e82b[_0x9481('0x52')]['id']){delete _0x29e82b[_0x9481('0x52')]['id'];}return db[_0x9481('0x35')][_0x9481('0x50')]({'where':{'id':_0x29e82b[_0x9481('0x4e')]['id']}})['then'](handleEntityNotFound(_0x229b69,null))[_0x9481('0x1c')](saveUpdates(_0x29e82b[_0x9481('0x52')],null))['then'](respondWithResult(_0x229b69,null))[_0x9481('0x25')](handleError(_0x229b69,null));};exports[_0x9481('0x53')]=function(_0x21f706,_0x44c819){return db[_0x9481('0x35')]['find']({'where':{'id':_0x21f706[_0x9481('0x4e')]['id']}})[_0x9481('0x1c')](handleEntityNotFound(_0x44c819,null))[_0x9481('0x1c')](removeEntity(_0x44c819,null))[_0x9481('0x25')](handleError(_0x44c819,null));};exports[_0x9481('0x54')]=function(_0x3ac428,_0x2927f5,_0x3ce09a){var _0x2dfcb5={};var _0x4e3379={};var _0x5b9e49;var _0x5b4234;return db[_0x9481('0x35')][_0x9481('0x55')]({'where':{'id':_0x3ac428['params']['id']}})[_0x9481('0x1c')](handleEntityNotFound(_0x2927f5,null))[_0x9481('0x1c')](function(_0x36fd7d){if(_0x36fd7d){_0x5b9e49=_0x36fd7d;_0x4e3379[_0x9481('0x37')]=_[_0x9481('0x39')](db[_0x9481('0x56')]['rawAttributes']);_0x4e3379['query']=_[_0x9481('0x39')](_0x3ac428[_0x9481('0x38')]);_0x4e3379[_0x9481('0x44')]=_[_0x9481('0x3a')](_0x4e3379[_0x9481('0x37')],_0x4e3379[_0x9481('0x38')]);_0x2dfcb5['attributes']=_['intersection'](_0x4e3379[_0x9481('0x37')],qs['fields'](_0x3ac428[_0x9481('0x38')]['fields']));_0x2dfcb5[_0x9481('0x3c')]=_0x2dfcb5[_0x9481('0x3c')][_0x9481('0x3d')]?_0x2dfcb5['attributes']:_0x4e3379[_0x9481('0x37')];_0x2dfcb5[_0x9481('0x40')]=qs['sort'](_0x3ac428['query']['sort']);_0x2dfcb5['where']=qs[_0x9481('0x44')](_['pick'](_0x3ac428[_0x9481('0x38')],_0x4e3379[_0x9481('0x44')]));if(_0x3ac428[_0x9481('0x38')]['filter']){_0x2dfcb5[_0x9481('0x42')]=_['merge'](_0x2dfcb5[_0x9481('0x42')],{'$or':_[_0x9481('0x34')](_0x2dfcb5[_0x9481('0x3c')],function(_0x4f157d){var _0x2f20b4={};_0x2f20b4[_0x4f157d]={'$like':'%'+_0x3ac428[_0x9481('0x38')]['filter']+'%'};return _0x2f20b4;})});}_0x2dfcb5=_[_0x9481('0x45')]({},_0x2dfcb5,_0x3ac428[_0x9481('0x48')]);return _0x5b9e49[_0x9481('0x54')](_0x2dfcb5);}})[_0x9481('0x1c')](function(_0x4363f4){if(_0x4363f4){_0x5b4234=_0x4363f4[_0x9481('0x3d')];if(!_0x3ac428[_0x9481('0x38')][_0x9481('0x3e')](_0x9481('0x3f'))){_0x2dfcb5[_0x9481('0x2b')]=qs[_0x9481('0x2b')](_0x3ac428[_0x9481('0x38')][_0x9481('0x2b')]);_0x2dfcb5[_0x9481('0x2a')]=qs[_0x9481('0x2a')](_0x3ac428[_0x9481('0x38')][_0x9481('0x2a')]);}return _0x5b9e49['getConfigurations'](_0x2dfcb5);}})[_0x9481('0x1c')](function(_0x504875){if(_0x504875){return _0x504875?{'count':_0x5b4234,'rows':_0x504875}:null;}})['then'](respondWithResult(_0x2927f5,null))[_0x9481('0x25')](handleError(_0x2927f5,null));};exports['addConfiguration']=function(_0x51133a,_0x52b7af,_0x1b1967){if(_0x51133a[_0x9481('0x52')]['id']){delete _0x51133a[_0x9481('0x52')]['id'];}return db[_0x9481('0x35')]['findOne']({'where':{'id':_0x51133a[_0x9481('0x4e')]['id']}})[_0x9481('0x1c')](handleEntityNotFound(_0x52b7af,null))[_0x9481('0x1c')](function(_0x2a4517){if(_0x2a4517){_0x51133a['body']['AccountId']=_0x2a4517['id'];_0x51133a[_0x9481('0x52')][_0x9481('0x57')]=integrations[_0x9481('0x58')](_0x51133a[_0x9481('0x52')][_0x9481('0x59')],_0x51133a['body'][_0x9481('0x46')]);_0x51133a[_0x9481('0x52')][_0x9481('0x5a')]=integrations[_0x9481('0x5b')](_0x51133a[_0x9481('0x52')][_0x9481('0x59')],_0x51133a[_0x9481('0x52')][_0x9481('0x46')]);return db[_0x9481('0x56')][_0x9481('0x51')](_0x51133a[_0x9481('0x52')],{'include':[{'model':db[_0x9481('0x5c')],'as':_0x9481('0x57')},{'model':db[_0x9481('0x5c')],'as':_0x9481('0x5a')}]});}return null;})['then'](respondWithResult(_0x52b7af,null))[_0x9481('0x25')](handleError(_0x52b7af,null));};exports[_0x9481('0x5d')]=function(_0x3f51c5,_0x15a28a,_0x1b5c97){var _0x317a4e=_0x3f51c5[_0x9481('0x38')]['ticketType'];var _0x14070d=_0x317a4e===_0x9481('0x5e')?'Incident':'PhoneCall';var _0x84ff4f='';var _0x4e7bad='';var _0x556d9f='';var _0x3c262f='';var _0x5310dd='';var _0x37f4fd='';var _0xb98b14='';var _0x220825='';var _0x9c1b70=['title',_0x9481('0x5f'),'customerid',_0x9481('0x60'),_0x9481('0x61'),_0x9481('0x62'),'phonenumber','regardingobjectid','directioncode',_0x9481('0x63')];var _0x59921c=['accountidname',_0x9481('0x64'),_0x9481('0x65'),_0x9481('0x66'),'contactidname',_0x9481('0x67'),_0x9481('0x68'),'contractidname',_0x9481('0x69'),_0x9481('0x6a'),_0x9481('0x6b'),_0x9481('0x6c'),'createdon',_0x9481('0x6d'),'createdonbehalfbyyominame',_0x9481('0x6e'),_0x9481('0x6f'),'customeridyominame',_0x9481('0x70'),_0x9481('0x71'),_0x9481('0x72'),'entityimage_url','escalatedon',_0x9481('0x73'),'firstresponsebykpiidname',_0x9481('0x74'),_0x9481('0x75'),_0x9481('0x76'),'kbarticleidname',_0x9481('0x77'),_0x9481('0x78'),_0x9481('0x79'),'modifiedbyexternalpartyyominame',_0x9481('0x7a'),_0x9481('0x7b'),_0x9481('0x7c'),_0x9481('0x7d'),_0x9481('0x7e'),_0x9481('0x7f'),_0x9481('0x80'),_0x9481('0x81'),_0x9481('0x82'),_0x9481('0x83'),'owneridname',_0x9481('0x84'),'owneridyominame','parentcaseidname','primarycontactidname',_0x9481('0x85'),_0x9481('0x86'),_0x9481('0x87'),_0x9481('0x88'),_0x9481('0x89'),'resolvebykpiidname',_0x9481('0x8a'),_0x9481('0x8b'),_0x9481('0x8c'),_0x9481('0x8d'),_0x9481('0x8e'),_0x9481('0x8f'),_0x9481('0x90'),_0x9481('0x91'),_0x9481('0x92'),_0x9481('0x93'),'ticketnumber',_0x9481('0x94'),_0x9481('0x95'),_0x9481('0x96'),_0x9481('0x97'),_0x9481('0x98')];var _0x38eacc=_0x9c1b70[_0x9481('0x99')](_0x59921c);return db[_0x9481('0x35')][_0x9481('0x55')]({'where':{'id':_0x3f51c5[_0x9481('0x4e')]['id']},'attributes':['id','username',_0x9481('0x9a'),_0x9481('0x9b'),_0x9481('0x9c'),_0x9481('0x9d'),_0x9481('0x9e')]})[_0x9481('0x1c')](handleEntityNotFound(_0x15a28a,null))[_0x9481('0x1c')](function(_0x3ae3e2){if(_0x3ae3e2){_0x220825=_0x3ae3e2[_0x9481('0x9b')];var _0x538fe0=_0x220825[_0x9481('0x9f')](-0x1);if(_0x538fe0==='/'){_0x220825=_0x220825['substring'](0x0,_0x220825['lastIndexOf'](_0x538fe0));}_0xb98b14=util[_0x9481('0xa0')](_0x9481('0xa1'),_0x220825);var _0x18cb44={'method':_0x9481('0xa2'),'uri':_0x9481('0xa3')+_0x3ae3e2[_0x9481('0x9c')]+'/oauth2/token','form':{'client_id':_0x3ae3e2[_0x9481('0x9d')],'resource':_0x220825,'username':_0x3ae3e2['username'],'password':_0x3ae3e2[_0x9481('0x9a')],'grant_type':_0x9481('0x9a'),'client_secret':_0x3ae3e2[_0x9481('0x9e')]},'json':!![]};return rp(_0x18cb44);}})['then'](function(_0x5453b5){_0x37f4fd=_0x5453b5[_0x9481('0xa4')];var _0xfe59cb={'method':_0x9481('0xa5'),'uri':encodeURI(_0xb98b14+_0x9481('0xa6')+_0x14070d+'\x27'),'headers':{'Authorization':_0x9481('0xa7')+_0x37f4fd,'If-None-Match':null,'OData-Version':_0x9481('0xa8')},'json':!![]};return rp(_0xfe59cb);})[_0x9481('0x1c')](function(_0x2c8d0d){var _0x3fbedd=_0x2c8d0d['value'][0x0];var _0x3e18a4=_0x3fbedd[_0x9481('0xa9')];var _0x4e84b6={'method':_0x9481('0xa5'),'uri':_0xb98b14+'EntityDefinitions('+_0x3e18a4+_0x9481('0xaa'),'headers':{'Authorization':_0x9481('0xa7')+_0x37f4fd,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4e84b6);})[_0x9481('0x1c')](function(_0x15e194){_0x84ff4f=_0x15e194;_0x4e7bad=_0x84ff4f[_0x9481('0xab')];_0x4e7bad=_['remove'](_0x4e7bad,function(_0x393a0c){return!_0x38eacc[_0x9481('0xac')](_0x393a0c['LogicalName']);});var _0x3de4fa=[];var _0x5c7602=[];_0x4e7bad[_0x9481('0xad')](function(_0x3d34c4){if(_0x3d34c4[_0x9481('0xae')]){var _0x4fea1a=_0x3d34c4['@odata.type'][_0x9481('0xaf')](_0x3d34c4[_0x9481('0xae')][_0x9481('0xb0')]('.')+0x1);if(_0x4fea1a===_0x9481('0xb1')){_0x3de4fa[_0x9481('0xb2')](getSelectList(_0xb98b14,_0x317a4e,_0x5c7602,_0x84ff4f[_0x9481('0xa9')],_0x3d34c4['MetadataId'],_0x37f4fd));}}});return Promise[_0x9481('0xb3')](_0x3de4fa);})[_0x9481('0x1c')](function(_0x232b8c){_0x556d9f=_0x232b8c[0x0];var _0x38254c=[];var _0x467b1d=[];_0x4e7bad[_0x9481('0xad')](function(_0x2b4c2a){if(!_['isNil'](_0x2b4c2a[_0x9481('0xae')])){var _0x12e604=_0x2b4c2a[_0x9481('0xae')][_0x9481('0xaf')](_0x2b4c2a['@odata.type'][_0x9481('0xb0')]('.')+0x1);if(_0x12e604===_0x9481('0xb4')){_0x38254c[_0x9481('0xb2')](getBooleanList(_0xb98b14,_0x317a4e,_0x467b1d,_0x84ff4f[_0x9481('0xa9')],_0x2b4c2a['MetadataId'],_0x37f4fd));}}});return Promise[_0x9481('0xb3')](_0x38254c);})[_0x9481('0x1c')](function(_0x179ed2){_0x3c262f=_0x179ed2[0x0];var _0xa5524e=[];var _0x7d5f0=[];_0x4e7bad[_0x9481('0xad')](function(_0x10a43e){if(_0x10a43e[_0x9481('0xae')]){var _0x11da2a=_0x10a43e[_0x9481('0xae')][_0x9481('0xaf')](_0x10a43e['@odata.type'][_0x9481('0xb0')]('.')+0x1);if(_0x11da2a==='StringAttributeMetadata'||_0x11da2a===_0x9481('0xb5')||_0x11da2a===_0x9481('0xb6')||_0x11da2a===_0x9481('0xb7')||_0x11da2a===_0x9481('0xb8')||_0x11da2a===_0x9481('0xb9')||_0x11da2a==='StatusAttributeMetadata'||_0x11da2a===_0x9481('0xba')||_0x11da2a===_0x9481('0xbb')||_0x11da2a===_0x9481('0xbc')){_0xa5524e[_0x9481('0xb2')](getInputList(_0xb98b14,_0x317a4e,_0x11da2a,_0x7d5f0,_0x84ff4f[_0x9481('0xa9')],_0x10a43e[_0x9481('0xa9')],_0x37f4fd));}}});return Promise['all'](_0xa5524e);})[_0x9481('0x1c')](function(_0x34a871){_0x5310dd=_0x34a871[0x0];var _0x17b2df=_0x556d9f[_0x9481('0x99')](_0x3c262f)[_0x9481('0x99')](_0x5310dd);var _0x394dae={'count':_0x17b2df[_0x9481('0x3d')],'rows':_0x17b2df};return _0x394dae;})[_0x9481('0x1c')](respondWithResult(_0x15a28a,null))[_0x9481('0x25')](function(_0x26a666){var _0x403987=_0x3f51c5[_0x9481('0x38')]['test']?0x1f4:_0x26a666[_0x9481('0xbd')]||0x1f4;logger[_0x9481('0x21')](_0x26a666[_0x9481('0x31')]);delete _0x26a666[_0x9481('0x32')];if(_0x403987===0x191){_0x403987=0x190;}_0x15a28a[_0x9481('0x27')](_0x403987)[_0x9481('0x33')](_0x3f51c5[_0x9481('0x38')][_0x9481('0xbe')]?{'message':_0x9481('0xbf'),'statusCode':_0x26a666[_0x9481('0xbd')]}:_0x26a666);});};function getSelectList(_0x1a3fdb,_0x9d36db,_0x9acaf4,_0x4663e6,_0x3ae61b,_0xcf83d2){var _0x1710c1={'method':_0x9481('0xa5'),'uri':_0x1a3fdb+_0x9481('0xc0')+_0x4663e6+_0x9481('0xc1')+_0x3ae61b+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x9481('0xc2'),'headers':{'Authorization':_0x9481('0xa7')+_0xcf83d2,'If-None-Match':null,'OData-Version':_0x9481('0xa8')},'json':!![]};return rp(_0x1710c1)[_0x9481('0x1c')](function(_0x4553fc){var _0xda9780=[];var _0x55c4ab=_0x4553fc[_0x9481('0xc3')][_0x9481('0xc4')];_0x55c4ab[_0x9481('0xad')](function(_0x445e9){_0xda9780[_0x9481('0xb2')]({'name':_0x445e9['Label']['UserLocalizedLabel']['Label'],'value':String(_0x445e9['Value'])});});var _0x5792b1={'id':_0x9d36db+'_'+_0x4553fc[_0x9481('0xc5')],'name':_0x4553fc['DisplayName'][_0x9481('0xc6')][_0x9481('0xc7')],'custom':![],'options':_0xda9780};_0x9acaf4[_0x9481('0xb2')](_0x5792b1);return _0x9acaf4;});}function getBooleanList(_0x1efbc2,_0x55a65f,_0xc64fa,_0x3d9395,_0x749211,_0x3d2cff){var _0x39aa6c={'method':_0x9481('0xa5'),'uri':_0x1efbc2+_0x9481('0xc0')+_0x3d9395+_0x9481('0xc1')+_0x749211+_0x9481('0xc8'),'headers':{'Authorization':'Bearer\x20'+_0x3d2cff,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x39aa6c)[_0x9481('0x1c')](function(_0x585b27){var _0x1e83c6=[];_0x1e83c6[_0x9481('0xb2')]({'name':_0x585b27[_0x9481('0xc3')][_0x9481('0xc9')][_0x9481('0xc7')]['UserLocalizedLabel'][_0x9481('0xc7')],'value':_0x9481('0xca')},{'name':_0x585b27['OptionSet']['FalseOption'][_0x9481('0xc7')][_0x9481('0xc6')][_0x9481('0xc7')],'value':_0x9481('0xcb')});var _0x7ee854={'id':_0x55a65f+'_'+_0x585b27[_0x9481('0xc5')],'name':_0x585b27[_0x9481('0xcc')][_0x9481('0xc6')][_0x9481('0xc7')],'custom':![],'options':_0x1e83c6};_0xc64fa[_0x9481('0xb2')](_0x7ee854);return _0xc64fa;});}function getInputList(_0x50e51d,_0x386f6c,_0x43466e,_0x280dea,_0x30fc82,_0x11d02d,_0x56ff1f){var _0x9960d3={'method':_0x9481('0xa5'),'uri':_0x50e51d+'EntityDefinitions('+_0x30fc82+')/Attributes('+_0x11d02d+_0x9481('0xcd')+_0x43466e+_0x9481('0xce'),'headers':{'Authorization':'Bearer\x20'+_0x56ff1f,'If-None-Match':null,'OData-Version':_0x9481('0xa8')},'json':!![]};return rp(_0x9960d3)[_0x9481('0x1c')](function(_0x4b0e4b){var _0x36025f={'id':_0x386f6c+'_'+_0x4b0e4b[_0x9481('0xc5')],'name':_0x4b0e4b[_0x9481('0xcc')][_0x9481('0xc6')]?_0x4b0e4b['DisplayName'][_0x9481('0xc6')]['Label']:_0x4b0e4b[_0x9481('0xc5')],'custom':![],'options':[]};_0x280dea[_0x9481('0xb2')](_0x36025f);return _0x280dea;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 934edc9..6800674 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 _0x0623=['bluebird','path','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','int_dynamics365_accounts','util','api','moment'];(function(_0x28c4fe,_0xc408af){var _0x1a527d=function(_0x1486a6){while(--_0x1486a6){_0x28c4fe['push'](_0x28c4fe['shift']());}};_0x1a527d(++_0xc408af);}(_0x0623,0xad));var _0x3062=function(_0x28857f,_0xe64cac){_0x28857f=_0x28857f-0x0;var _0x4a65d0=_0x0623[_0x28857f];return _0x4a65d0;};'use strict';var _=require('lodash');var util=require(_0x3062('0x0'));var logger=require('../../config/logger')(_0x3062('0x1'));var moment=require(_0x3062('0x2'));var BPromise=require(_0x3062('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3062('0x4'));var rimraf=require('rimraf');var config=require(_0x3062('0x5'));var attributes=require(_0x3062('0x6'));var integrations=require(_0x3062('0x7'));module[_0x3062('0x8')]=function(_0x3b7e27,_0x9a41e0){return _0x3b7e27[_0x3062('0x9')]('Dynamics365Account',attributes,{'tableName':_0x3062('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e2f=['./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x5e2f,0x17f));var _0xf5e2=function(_0x3206f0,_0x4f0267){_0x3206f0=_0x3206f0-0x0;var _0x355a85=_0x5e2f[_0x3206f0];return _0x355a85;};'use strict';var _=require(_0xf5e2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf5e2('0x1'));var moment=require(_0xf5e2('0x2'));var BPromise=require(_0xf5e2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf5e2('0x4'));var rimraf=require(_0xf5e2('0x5'));var config=require(_0xf5e2('0x6'));var attributes=require(_0xf5e2('0x7'));var integrations=require(_0xf5e2('0x8'));module[_0xf5e2('0x9')]=function(_0x2fbf3e,_0x1b39fa){return _0x2fbf3e[_0xf5e2('0xa')](_0xf5e2('0xb'),attributes,{'tableName':_0xf5e2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index f6119c5..b1e8130 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 _0xaf0d=['request','request\x20sent','debug','stringify','error','Dynamics365Account,\x20%s,\x20%s','message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','map','include','model','then','ShowDynamics365Account','info','util','moment','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x1b0bdb,_0x41c282){var _0x9b2bc6=function(_0xa96e55){while(--_0xa96e55){_0x1b0bdb['push'](_0x1b0bdb['shift']());}};_0x9b2bc6(++_0x41c282);}(_0xaf0d,0x6d));var _0xdaf0=function(_0x3a77ff,_0x32a5da){_0x3a77ff=_0x3a77ff-0x0;var _0x1e94bc=_0xaf0d[_0x3a77ff];return _0x1e94bc;};'use strict';var _=require('lodash');var util=require(_0xdaf0('0x0'));var moment=require(_0xdaf0('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('../../config/utils');var logger=require(_0xdaf0('0x2'))(_0xdaf0('0x3'));var config=require(_0xdaf0('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xdaf0('0x5')][_0xdaf0('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x53aec7,_0x5ad050,_0x26bda3){return new BPromise(function(_0x1dc345,_0x16d746){return client[_0xdaf0('0x7')](_0x53aec7,_0x26bda3)['then'](function(_0x528d8a){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x5ad050,_0xdaf0('0x8'));logger[_0xdaf0('0x9')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x5ad050,_0xdaf0('0x8'),JSON[_0xdaf0('0xa')](_0x528d8a));if(_0x528d8a[_0xdaf0('0xb')]){if(_0x528d8a[_0xdaf0('0xb')]['code']===0x1f4){logger[_0xdaf0('0xb')](_0xdaf0('0xc'),_0x5ad050,_0x528d8a[_0xdaf0('0xb')]['message']);return _0x16d746(_0x528d8a[_0xdaf0('0xb')][_0xdaf0('0xd')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x5ad050,_0x528d8a['error']['message']);return _0x1dc345(_0x528d8a['error'][_0xdaf0('0xd')]);}else{logger['info'](_0xdaf0('0xc'),_0x5ad050,'request\x20sent');_0x1dc345(_0x528d8a['result'][_0xdaf0('0xd')]);}})[_0xdaf0('0xe')](function(_0x370345){logger['error'](_0xdaf0('0xc'),_0x5ad050,_0x370345);_0x16d746(_0x370345);});});}exports[_0xdaf0('0xf')]=function(_0x21db47){var _0x4b8588=this;return new Promise(function(_0x5a2180,_0xb6b5e2){return db[_0xdaf0('0x10')][_0xdaf0('0x11')]({'raw':_0x21db47[_0xdaf0('0x12')]?_0x21db47[_0xdaf0('0x12')][_0xdaf0('0x13')]===undefined?!![]:![]:!![],'where':_0x21db47[_0xdaf0('0x12')]?_0x21db47['options'][_0xdaf0('0x14')]||null:null,'attributes':_0x21db47[_0xdaf0('0x12')]?_0x21db47[_0xdaf0('0x12')][_0xdaf0('0x15')]||null:null,'limit':_0x21db47['options']?_0x21db47[_0xdaf0('0x12')][_0xdaf0('0x16')]||null:null,'include':_0x21db47[_0xdaf0('0x12')]?_0x21db47[_0xdaf0('0x12')]['include']?_[_0xdaf0('0x17')](_0x21db47[_0xdaf0('0x12')][_0xdaf0('0x18')],function(_0x13abfc){return{'model':db[_0x13abfc[_0xdaf0('0x19')]],'as':_0x13abfc['as'],'attributes':_0x13abfc[_0xdaf0('0x15')],'include':_0x13abfc[_0xdaf0('0x18')]?_['map'](_0x13abfc[_0xdaf0('0x18')],function(_0x33e5c2){return{'model':db[_0x33e5c2[_0xdaf0('0x19')]],'as':_0x33e5c2['as'],'attributes':_0x33e5c2[_0xdaf0('0x15')],'include':_0x33e5c2[_0xdaf0('0x18')]?_[_0xdaf0('0x17')](_0x33e5c2[_0xdaf0('0x18')],function(_0x4d3347){return{'model':db[_0x4d3347[_0xdaf0('0x19')]],'as':_0x4d3347['as'],'attributes':_0x4d3347['attributes']};}):[]};}):[]};}):[]:[]})[_0xdaf0('0x1a')](function(_0x740ff){logger['info'](_0xdaf0('0xf'),_0x21db47);logger['debug'](_0xdaf0('0xf'),_0x21db47,JSON[_0xdaf0('0xa')](_0x740ff));_0x5a2180(_0x740ff);})['catch'](function(_0xaf86cb){logger[_0xdaf0('0xb')](_0xdaf0('0xf'),_0xaf86cb[_0xdaf0('0xd')],_0x21db47);_0xb6b5e2(_0x4b8588[_0xdaf0('0xb')](0x1f4,_0xaf86cb['message']));});});};exports[_0xdaf0('0x1b')]=function(_0x16821a){var _0x3018b8=this;return new Promise(function(_0x570df5,_0x443cc7){return db[_0xdaf0('0x10')]['find']({'raw':_0x16821a[_0xdaf0('0x12')]?_0x16821a[_0xdaf0('0x12')]['raw']===undefined?!![]:![]:!![],'where':_0x16821a[_0xdaf0('0x12')]?_0x16821a[_0xdaf0('0x12')][_0xdaf0('0x14')]||null:null,'attributes':_0x16821a[_0xdaf0('0x12')]?_0x16821a[_0xdaf0('0x12')][_0xdaf0('0x15')]||null:null,'include':_0x16821a[_0xdaf0('0x12')]?_0x16821a[_0xdaf0('0x12')][_0xdaf0('0x18')]?_[_0xdaf0('0x17')](_0x16821a[_0xdaf0('0x12')]['include'],function(_0x5b955e){return{'model':db[_0x5b955e['model']],'as':_0x5b955e['as'],'attributes':_0x5b955e[_0xdaf0('0x15')],'include':_0x5b955e[_0xdaf0('0x18')]?_['map'](_0x5b955e[_0xdaf0('0x18')],function(_0x2128cc){return{'model':db[_0x2128cc[_0xdaf0('0x19')]],'as':_0x2128cc['as'],'attributes':_0x2128cc[_0xdaf0('0x15')],'include':_0x2128cc[_0xdaf0('0x18')]?_[_0xdaf0('0x17')](_0x2128cc[_0xdaf0('0x18')],function(_0x399116){return{'model':db[_0x399116[_0xdaf0('0x19')]],'as':_0x399116['as'],'attributes':_0x399116[_0xdaf0('0x15')]};}):[]};}):[]};}):[]:[]})[_0xdaf0('0x1a')](function(_0x1a9838){logger[_0xdaf0('0x1c')](_0xdaf0('0x1b'),_0x16821a);logger[_0xdaf0('0x9')](_0xdaf0('0x1b'),_0x16821a,JSON[_0xdaf0('0xa')](_0x1a9838));_0x570df5(_0x1a9838);})['catch'](function(_0xe61d26){logger[_0xdaf0('0xb')](_0xdaf0('0x1b'),_0xe61d26[_0xdaf0('0xd')],_0x16821a);_0x443cc7(_0x3018b8[_0xdaf0('0xb')](0x1f4,_0xe61d26[_0xdaf0('0xd')]));});});}; \ No newline at end of file +var _0xb5f3=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Account,\x20%s,\x20%s','message','result','GetDynamics365Account','Dynamics365Account','findAll','raw','options','where','attributes','limit','map','include','model','catch','ShowDynamics365Account','find','lodash','util','moment','randomstring'];(function(_0x503306,_0x356f2f){var _0x44a99d=function(_0x1a6ec4){while(--_0x1a6ec4){_0x503306['push'](_0x503306['shift']());}};_0x44a99d(++_0x356f2f);}(_0xb5f3,0x137));var _0x3b5f=function(_0x1bb812,_0x23eacc){_0x1bb812=_0x1bb812-0x0;var _0x372adb=_0xb5f3[_0x1bb812];return _0x372adb;};'use strict';var _=require(_0x3b5f('0x0'));var util=require(_0x3b5f('0x1'));var moment=require(_0x3b5f('0x2'));var BPromise=require('bluebird');var rs=require(_0x3b5f('0x3'));var fs=require('fs');var Redis=require(_0x3b5f('0x4'));var db=require(_0x3b5f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3b5f('0x6'));var config=require(_0x3b5f('0x7'));var jayson=require(_0x3b5f('0x8'));var client=jayson[_0x3b5f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2db4ad,_0x1b6d67,_0x4edb1a){return new BPromise(function(_0x2e213c,_0x48597e){return client[_0x3b5f('0xa')](_0x2db4ad,_0x4edb1a)[_0x3b5f('0xb')](function(_0x2c37f6){logger[_0x3b5f('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x1b6d67,_0x3b5f('0xd'));logger[_0x3b5f('0xe')](_0x3b5f('0xf'),_0x1b6d67,_0x3b5f('0xd'),JSON[_0x3b5f('0x10')](_0x2c37f6));if(_0x2c37f6['error']){if(_0x2c37f6['error']['code']===0x1f4){logger[_0x3b5f('0x11')](_0x3b5f('0x12'),_0x1b6d67,_0x2c37f6[_0x3b5f('0x11')][_0x3b5f('0x13')]);return _0x48597e(_0x2c37f6[_0x3b5f('0x11')][_0x3b5f('0x13')]);}logger[_0x3b5f('0x11')](_0x3b5f('0x12'),_0x1b6d67,_0x2c37f6['error'][_0x3b5f('0x13')]);return _0x2e213c(_0x2c37f6[_0x3b5f('0x11')][_0x3b5f('0x13')]);}else{logger['info'](_0x3b5f('0x12'),_0x1b6d67,'request\x20sent');_0x2e213c(_0x2c37f6[_0x3b5f('0x14')][_0x3b5f('0x13')]);}})['catch'](function(_0x28b6c1){logger[_0x3b5f('0x11')](_0x3b5f('0x12'),_0x1b6d67,_0x28b6c1);_0x48597e(_0x28b6c1);});});}exports[_0x3b5f('0x15')]=function(_0x5ed046){var _0x2db25f=this;return new Promise(function(_0x4933c8,_0x2d3848){return db[_0x3b5f('0x16')][_0x3b5f('0x17')]({'raw':_0x5ed046['options']?_0x5ed046['options'][_0x3b5f('0x18')]===undefined?!![]:![]:!![],'where':_0x5ed046[_0x3b5f('0x19')]?_0x5ed046[_0x3b5f('0x19')][_0x3b5f('0x1a')]||null:null,'attributes':_0x5ed046['options']?_0x5ed046[_0x3b5f('0x19')][_0x3b5f('0x1b')]||null:null,'limit':_0x5ed046[_0x3b5f('0x19')]?_0x5ed046[_0x3b5f('0x19')][_0x3b5f('0x1c')]||null:null,'include':_0x5ed046[_0x3b5f('0x19')]?_0x5ed046['options']['include']?_[_0x3b5f('0x1d')](_0x5ed046[_0x3b5f('0x19')][_0x3b5f('0x1e')],function(_0x25bcf6){return{'model':db[_0x25bcf6[_0x3b5f('0x1f')]],'as':_0x25bcf6['as'],'attributes':_0x25bcf6[_0x3b5f('0x1b')],'include':_0x25bcf6[_0x3b5f('0x1e')]?_[_0x3b5f('0x1d')](_0x25bcf6[_0x3b5f('0x1e')],function(_0x3267b8){return{'model':db[_0x3267b8['model']],'as':_0x3267b8['as'],'attributes':_0x3267b8['attributes'],'include':_0x3267b8[_0x3b5f('0x1e')]?_[_0x3b5f('0x1d')](_0x3267b8[_0x3b5f('0x1e')],function(_0x26c1e0){return{'model':db[_0x26c1e0[_0x3b5f('0x1f')]],'as':_0x26c1e0['as'],'attributes':_0x26c1e0['attributes']};}):[]};}):[]};}):[]:[]})[_0x3b5f('0xb')](function(_0x2d5ba1){logger[_0x3b5f('0xc')](_0x3b5f('0x15'),_0x5ed046);logger['debug']('GetDynamics365Account',_0x5ed046,JSON[_0x3b5f('0x10')](_0x2d5ba1));_0x4933c8(_0x2d5ba1);})[_0x3b5f('0x20')](function(_0x1533ea){logger['error']('GetDynamics365Account',_0x1533ea[_0x3b5f('0x13')],_0x5ed046);_0x2d3848(_0x2db25f[_0x3b5f('0x11')](0x1f4,_0x1533ea['message']));});});};exports[_0x3b5f('0x21')]=function(_0x562f95){var _0xa10ddb=this;return new Promise(function(_0xc266d0,_0x4be2e2){return db['Dynamics365Account'][_0x3b5f('0x22')]({'raw':_0x562f95[_0x3b5f('0x19')]?_0x562f95[_0x3b5f('0x19')][_0x3b5f('0x18')]===undefined?!![]:![]:!![],'where':_0x562f95[_0x3b5f('0x19')]?_0x562f95[_0x3b5f('0x19')][_0x3b5f('0x1a')]||null:null,'attributes':_0x562f95[_0x3b5f('0x19')]?_0x562f95['options'][_0x3b5f('0x1b')]||null:null,'include':_0x562f95[_0x3b5f('0x19')]?_0x562f95[_0x3b5f('0x19')]['include']?_[_0x3b5f('0x1d')](_0x562f95[_0x3b5f('0x19')][_0x3b5f('0x1e')],function(_0x214dee){return{'model':db[_0x214dee[_0x3b5f('0x1f')]],'as':_0x214dee['as'],'attributes':_0x214dee['attributes'],'include':_0x214dee['include']?_['map'](_0x214dee[_0x3b5f('0x1e')],function(_0x1f660a){return{'model':db[_0x1f660a[_0x3b5f('0x1f')]],'as':_0x1f660a['as'],'attributes':_0x1f660a[_0x3b5f('0x1b')],'include':_0x1f660a[_0x3b5f('0x1e')]?_[_0x3b5f('0x1d')](_0x1f660a['include'],function(_0x185afb){return{'model':db[_0x185afb[_0x3b5f('0x1f')]],'as':_0x185afb['as'],'attributes':_0x185afb[_0x3b5f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x511671){logger[_0x3b5f('0xc')]('ShowDynamics365Account',_0x562f95);logger['debug']('ShowDynamics365Account',_0x562f95,JSON[_0x3b5f('0x10')](_0x511671));_0xc266d0(_0x511671);})['catch'](function(_0x2a4356){logger[_0x3b5f('0x11')](_0x3b5f('0x21'),_0x2a4356['message'],_0x562f95);_0x4be2e2(_0xa10ddb[_0x3b5f('0x11')](0x1f4,_0x2a4356['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 2cd6c20..9c908f8 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 _0xf6ae=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','index','get','isAuthenticated','show','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','/:id','update','delete','destroy','exports','multer','connect-timeout','Router'];(function(_0x4ce01c,_0x48f585){var _0x2772df=function(_0x112d24){while(--_0x112d24){_0x4ce01c['push'](_0x4ce01c['shift']());}};_0x2772df(++_0x48f585);}(_0xf6ae,0x19f));var _0xef6a=function(_0x44205,_0x56088b){_0x44205=_0x44205-0x0;var _0x434b18=_0xf6ae[_0x44205];return _0x434b18;};'use strict';var multer=require(_0xef6a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xef6a('0x1'));var express=require('express');var router=express[_0xef6a('0x2')]();var auth=require(_0xef6a('0x3'));var interaction=require(_0xef6a('0x4'));var config=require(_0xef6a('0x5'));var controller=require(_0xef6a('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xef6a('0x7')]);router[_0xef6a('0x8')]('/:id',auth[_0xef6a('0x9')](),controller[_0xef6a('0xa')]);router[_0xef6a('0x8')]('/:id/fields',auth[_0xef6a('0x9')](),controller[_0xef6a('0xb')]);router['get'](_0xef6a('0xc'),auth['isAuthenticated'](),controller[_0xef6a('0xd')]);router[_0xef6a('0x8')]('/:id/descriptions',auth[_0xef6a('0x9')](),controller[_0xef6a('0xe')]);router[_0xef6a('0xf')]('/',auth[_0xef6a('0x9')](),controller['create']);router[_0xef6a('0x10')](_0xef6a('0x11'),auth['isAuthenticated'](),controller[_0xef6a('0x12')]);router[_0xef6a('0x13')]('/:id',auth[_0xef6a('0x9')](),controller[_0xef6a('0x14')]);module[_0xef6a('0x15')]=router; \ No newline at end of file +var _0x13e8=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','/:id','show','get','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','update','delete','exports','multer'];(function(_0x509556,_0x1d4bad){var _0x405e13=function(_0x414989){while(--_0x414989){_0x509556['push'](_0x509556['shift']());}};_0x405e13(++_0x1d4bad);}(_0x13e8,0x8b));var _0x813e=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x13e8[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x813e('0x0'));var util=require('util');var path=require(_0x813e('0x1'));var timeout=require(_0x813e('0x2'));var express=require('express');var router=express[_0x813e('0x3')]();var auth=require(_0x813e('0x4'));var interaction=require(_0x813e('0x5'));var config=require(_0x813e('0x6'));var controller=require(_0x813e('0x7'));router['get']('/',auth[_0x813e('0x8')](),controller['index']);router['get'](_0x813e('0x9'),auth[_0x813e('0x8')](),controller[_0x813e('0xa')]);router[_0x813e('0xb')](_0x813e('0xc'),auth[_0x813e('0x8')](),controller[_0x813e('0xd')]);router[_0x813e('0xb')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x813e('0xe'),auth['isAuthenticated'](),controller[_0x813e('0xf')]);router[_0x813e('0x10')]('/',auth[_0x813e('0x8')](),controller['create']);router['put']('/:id',auth[_0x813e('0x8')](),controller[_0x813e('0x11')]);router[_0x813e('0x12')](_0x813e('0x9'),auth[_0x813e('0x8')](),controller['destroy']);module[_0x813e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 4e18c26..0bffb77 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 _0xfd23=['phonecall','sequelize','exports','STRING','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd23,0x1e1));var _0x3fd2=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xfd23[_0x2235bf];return _0x4c3a64;};'use strict';var Sequelize=require(_0x3fd2('0x0'));module[_0x3fd2('0x1')]={'name':{'type':Sequelize[_0x3fd2('0x2')]},'description':{'type':Sequelize[_0x3fd2('0x2')]},'ticketType':{'type':Sequelize[_0x3fd2('0x3')]('incident',_0x3fd2('0x4')),'defaultValue':'incident'}}; \ No newline at end of file +var _0x30f9=['exports','STRING','incident','sequelize'];(function(_0xa08d7b,_0x250109){var _0x484507=function(_0x3efe9d){while(--_0x3efe9d){_0xa08d7b['push'](_0xa08d7b['shift']());}};_0x484507(++_0x250109);}(_0x30f9,0x6b));var _0x930f=function(_0x18d5d7,_0x19074b){_0x18d5d7=_0x18d5d7-0x0;var _0x30a9ea=_0x30f9[_0x18d5d7];return _0x30a9ea;};'use strict';var Sequelize=require(_0x930f('0x0'));module[_0x930f('0x1')]={'name':{'type':Sequelize[_0x930f('0x2')]},'description':{'type':Sequelize[_0x930f('0x2')]},'ticketType':{'type':Sequelize['ENUM']('incident','phonecall'),'defaultValue':_0x930f('0x3')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 3cc141b..8e21e18 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 _0x7a4d=['model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Dynamics365Configuration','findAll','rows','show','params','includeAll','include','find','create','body','getFields','findOne','Dynamics365Field','pick','getSubjects','getDescriptions','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/environment','../../mysqldb','client','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x7a4d,0x18d));var _0xd7a4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x7a4d[_0x273c39];return _0x46d6b5;};'use strict';var pdf=require(_0xd7a4('0x0'));var emlformat=require(_0xd7a4('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd7a4('0x2'));var rp=require(_0xd7a4('0x3'));var moment=require(_0xd7a4('0x4'));var BPromise=require(_0xd7a4('0x5'));var Mustache=require(_0xd7a4('0x6'));var util=require(_0xd7a4('0x7'));var path=require(_0xd7a4('0x8'));var sox=require('sox');var csv=require(_0xd7a4('0x9'));var ejs=require(_0xd7a4('0xa'));var fs=require('fs');var _=require(_0xd7a4('0xb'));var squel=require(_0xd7a4('0xc'));var crypto=require(_0xd7a4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd7a4('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd7a4('0xf'));var Papa=require(_0xd7a4('0x10'));var Redis=require(_0xd7a4('0x11'));var authService=require(_0xd7a4('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd7a4('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xd7a4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd7a4('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xd7a4('0x16')][_0xd7a4('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x46d6a7,_0x2ca575,_0x9ed6a,_0x1d33a6){return new BPromise(function(_0x439091,_0x5aba4d){var _0x4fea75=_0x1d33a6||client;return _0x4fea75['request'](_0x46d6a7,_0x9ed6a)[_0xd7a4('0x18')](function(_0x225bf1){logger[_0xd7a4('0x19')](_0xd7a4('0x1a'),_0x2ca575,_0xd7a4('0x1b'));logger[_0xd7a4('0x1c')](_0xd7a4('0x1d'),_0x2ca575,'request\x20sent',JSON[_0xd7a4('0x1e')](_0x225bf1));if(_0x225bf1[_0xd7a4('0x1f')]){if(_0x225bf1[_0xd7a4('0x1f')]['code']===0x1f4){logger[_0xd7a4('0x1f')](_0xd7a4('0x1a'),_0x2ca575,_0x225bf1[_0xd7a4('0x1f')][_0xd7a4('0x20')]);return _0x5aba4d(_0x225bf1[_0xd7a4('0x1f')][_0xd7a4('0x20')]);}logger[_0xd7a4('0x1f')](_0xd7a4('0x1a'),_0x2ca575,_0x225bf1['error'][_0xd7a4('0x20')]);return _0x439091(_0x225bf1['error'][_0xd7a4('0x20')]);}else{logger[_0xd7a4('0x19')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2ca575,_0xd7a4('0x1b'));_0x439091(_0x225bf1[_0xd7a4('0x21')][_0xd7a4('0x20')]);}})[_0xd7a4('0x22')](function(_0x50c809){logger[_0xd7a4('0x1f')](_0xd7a4('0x1a'),_0x2ca575,_0x50c809);_0x5aba4d(_0x50c809);});});}function respondWithStatusCode(_0x530158,_0x3f07c9){_0x3f07c9=_0x3f07c9||0xcc;return function(_0x506000){if(_0x506000){return _0x530158[_0xd7a4('0x23')](_0x3f07c9);}return _0x530158[_0xd7a4('0x24')](_0x3f07c9)[_0xd7a4('0x25')]();};}function respondWithResult(_0x5bf832,_0x1a6930){_0x1a6930=_0x1a6930||0xc8;return function(_0x5394ac){if(_0x5394ac){return _0x5bf832['status'](_0x1a6930)[_0xd7a4('0x26')](_0x5394ac);}};}function respondWithFilteredResult(_0x59dba6,_0x50292d){return function(_0x4de070){if(_0x4de070){var _0x4c4c80=_0x4de070[_0xd7a4('0x27')],_0x5d87b0=_0x50292d[_0xd7a4('0x28')],_0x3da8db=_0x50292d[_0xd7a4('0x28')]+_0x50292d[_0xd7a4('0x29')],_0xb01b37;if(_0x3da8db>=_0x4c4c80){_0x3da8db=_0x4c4c80;_0xb01b37=0xc8;}else{_0xb01b37=0xce;}_0x59dba6['status'](_0xb01b37);return _0x59dba6[_0xd7a4('0x2a')](_0xd7a4('0x2b'),_0x5d87b0+'-'+_0x3da8db+'/'+_0x4c4c80)[_0xd7a4('0x26')](_0x4de070);}return null;};}function patchUpdates(_0xe897e8){return function(_0xfbbb0b){try{jsonpatch[_0xd7a4('0x2c')](_0xfbbb0b,_0xe897e8,!![]);}catch(_0x36bd2b){return BPromise[_0xd7a4('0x2d')](_0x36bd2b);}return _0xfbbb0b[_0xd7a4('0x2e')]();};}function saveUpdates(_0x13ce9c,_0x4c264a){return function(_0x5e811b){if(_0x5e811b){return _0x5e811b[_0xd7a4('0x2f')](_0x13ce9c)[_0xd7a4('0x18')](function(_0x2c09fd){return _0x2c09fd;});}return null;};}function removeEntity(_0x3cadcf,_0x2b78a6){return function(_0x4b2c39){if(_0x4b2c39){return _0x4b2c39[_0xd7a4('0x30')]()[_0xd7a4('0x18')](function(){_0x3cadcf['status'](0xcc)[_0xd7a4('0x25')]();});}};}function handleEntityNotFound(_0x67b6c3,_0x4ebac6){return function(_0x260c30){if(!_0x260c30){_0x67b6c3[_0xd7a4('0x23')](0x194);}return _0x260c30;};}function handleError(_0x50dd57,_0x3a409d){_0x3a409d=_0x3a409d||0x1f4;return function(_0x54b797){logger['error'](_0x54b797[_0xd7a4('0x31')]);if(_0x54b797['name']){delete _0x54b797[_0xd7a4('0x32')];}_0x50dd57[_0xd7a4('0x24')](_0x3a409d)[_0xd7a4('0x33')](_0x54b797);};}exports[_0xd7a4('0x34')]=function(_0x215864,_0x4446a4){var _0x52d798={},_0x44a205={},_0x3d853c={'count':0x0,'rows':[]};var _0x41dc6f=_[_0xd7a4('0x35')](db['Dynamics365Configuration'][_0xd7a4('0x36')],function(_0x123397){return{'name':_0x123397[_0xd7a4('0x37')],'type':_0x123397[_0xd7a4('0x38')][_0xd7a4('0x39')]};});_0x44a205[_0xd7a4('0x3a')]=_[_0xd7a4('0x35')](_0x41dc6f,_0xd7a4('0x32'));_0x44a205[_0xd7a4('0x3b')]=_[_0xd7a4('0x3c')](_0x215864[_0xd7a4('0x3b')]);_0x44a205[_0xd7a4('0x3d')]=_['intersection'](_0x44a205[_0xd7a4('0x3a')],_0x44a205[_0xd7a4('0x3b')]);_0x52d798[_0xd7a4('0x3e')]=_[_0xd7a4('0x3f')](_0x44a205[_0xd7a4('0x3a')],qs[_0xd7a4('0x40')](_0x215864[_0xd7a4('0x3b')][_0xd7a4('0x40')]));_0x52d798[_0xd7a4('0x3e')]=_0x52d798[_0xd7a4('0x3e')][_0xd7a4('0x41')]?_0x52d798[_0xd7a4('0x3e')]:_0x44a205[_0xd7a4('0x3a')];if(!_0x215864[_0xd7a4('0x3b')][_0xd7a4('0x42')](_0xd7a4('0x43'))){_0x52d798['limit']=qs[_0xd7a4('0x29')](_0x215864['query']['limit']);_0x52d798[_0xd7a4('0x28')]=qs[_0xd7a4('0x28')](_0x215864[_0xd7a4('0x3b')][_0xd7a4('0x28')]);}_0x52d798[_0xd7a4('0x44')]=qs[_0xd7a4('0x45')](_0x215864['query'][_0xd7a4('0x45')]);_0x52d798[_0xd7a4('0x46')]=qs['filters'](_['pick'](_0x215864['query'],_0x44a205[_0xd7a4('0x3d')]),_0x41dc6f);if(_0x215864['query'][_0xd7a4('0x47')]){_0x52d798[_0xd7a4('0x46')]=_[_0xd7a4('0x48')](_0x52d798['where'],{'$or':_[_0xd7a4('0x35')](_0x41dc6f,function(_0x2973b6){if(_0x2973b6[_0xd7a4('0x38')]!==_0xd7a4('0x49')){var _0x5c1577={};_0x5c1577[_0x2973b6['name']]={'$like':'%'+_0x215864[_0xd7a4('0x3b')][_0xd7a4('0x47')]+'%'};return _0x5c1577;}})});}_0x52d798=_[_0xd7a4('0x48')]({},_0x52d798,_0x215864[_0xd7a4('0x4a')]);var _0x12434f={'where':_0x52d798[_0xd7a4('0x46')]};return db[_0xd7a4('0x4b')][_0xd7a4('0x27')](_0x12434f)[_0xd7a4('0x18')](function(_0x41ddc7){_0x3d853c[_0xd7a4('0x27')]=_0x41ddc7;if(_0x215864[_0xd7a4('0x3b')]['includeAll']){_0x52d798['include']=[{'all':!![]}];}return db[_0xd7a4('0x4b')][_0xd7a4('0x4c')](_0x52d798);})[_0xd7a4('0x18')](function(_0x1f75b5){_0x3d853c[_0xd7a4('0x4d')]=_0x1f75b5;return _0x3d853c;})[_0xd7a4('0x18')](respondWithFilteredResult(_0x4446a4,_0x52d798))[_0xd7a4('0x22')](handleError(_0x4446a4,null));};exports[_0xd7a4('0x4e')]=function(_0x47eb35,_0x30b132){var _0x3ab96f={'raw':![],'where':{'id':_0x47eb35[_0xd7a4('0x4f')]['id']}},_0x59e77f={};_0x59e77f[_0xd7a4('0x3a')]=_[_0xd7a4('0x3c')](db[_0xd7a4('0x4b')][_0xd7a4('0x36')]);_0x59e77f[_0xd7a4('0x3b')]=_[_0xd7a4('0x3c')](_0x47eb35['query']);_0x59e77f[_0xd7a4('0x3d')]=_[_0xd7a4('0x3f')](_0x59e77f[_0xd7a4('0x3a')],_0x59e77f['query']);_0x3ab96f[_0xd7a4('0x3e')]=_[_0xd7a4('0x3f')](_0x59e77f[_0xd7a4('0x3a')],qs[_0xd7a4('0x40')](_0x47eb35[_0xd7a4('0x3b')][_0xd7a4('0x40')]));_0x3ab96f['attributes']=_0x3ab96f[_0xd7a4('0x3e')][_0xd7a4('0x41')]?_0x3ab96f[_0xd7a4('0x3e')]:_0x59e77f[_0xd7a4('0x3a')];if(_0x47eb35[_0xd7a4('0x3b')][_0xd7a4('0x50')]){_0x3ab96f[_0xd7a4('0x51')]=[{'all':!![]}];}_0x3ab96f=_['merge']({},_0x3ab96f,_0x47eb35[_0xd7a4('0x4a')]);return db[_0xd7a4('0x4b')][_0xd7a4('0x52')](_0x3ab96f)[_0xd7a4('0x18')](handleEntityNotFound(_0x30b132,null))['then'](respondWithResult(_0x30b132,null))[_0xd7a4('0x22')](handleError(_0x30b132,null));};exports[_0xd7a4('0x53')]=function(_0xc80c3e,_0x1d64e5){return db[_0xd7a4('0x4b')][_0xd7a4('0x53')](_0xc80c3e[_0xd7a4('0x54')],{})['then'](respondWithResult(_0x1d64e5,0xc9))[_0xd7a4('0x22')](handleError(_0x1d64e5,null));};exports['update']=function(_0x1f7538,_0x4f0585){if(_0x1f7538['body']['id']){delete _0x1f7538[_0xd7a4('0x54')]['id'];}return db[_0xd7a4('0x4b')][_0xd7a4('0x52')]({'where':{'id':_0x1f7538[_0xd7a4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4f0585,null))['then'](saveUpdates(_0x1f7538[_0xd7a4('0x54')],null))[_0xd7a4('0x18')](respondWithResult(_0x4f0585,null))['catch'](handleError(_0x4f0585,null));};exports[_0xd7a4('0x30')]=function(_0x1da5fc,_0x21dcfc){return db[_0xd7a4('0x4b')][_0xd7a4('0x52')]({'where':{'id':_0x1da5fc[_0xd7a4('0x4f')]['id']}})[_0xd7a4('0x18')](handleEntityNotFound(_0x21dcfc,null))[_0xd7a4('0x18')](removeEntity(_0x21dcfc,null))[_0xd7a4('0x22')](handleError(_0x21dcfc,null));};exports[_0xd7a4('0x55')]=function(_0x834167,_0x2de64b,_0x106cdf){var _0x277335={};var _0x5c7b8f={};var _0x53ed26;var _0x641389;return db[_0xd7a4('0x4b')][_0xd7a4('0x56')]({'where':{'id':_0x834167[_0xd7a4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2de64b,null))[_0xd7a4('0x18')](function(_0x21674d){if(_0x21674d){_0x53ed26=_0x21674d;_0x5c7b8f[_0xd7a4('0x3a')]=_[_0xd7a4('0x3c')](db[_0xd7a4('0x57')][_0xd7a4('0x36')]);_0x5c7b8f[_0xd7a4('0x3b')]=_[_0xd7a4('0x3c')](_0x834167[_0xd7a4('0x3b')]);_0x5c7b8f['filters']=_[_0xd7a4('0x3f')](_0x5c7b8f[_0xd7a4('0x3a')],_0x5c7b8f[_0xd7a4('0x3b')]);_0x277335[_0xd7a4('0x3e')]=_['intersection'](_0x5c7b8f[_0xd7a4('0x3a')],qs[_0xd7a4('0x40')](_0x834167[_0xd7a4('0x3b')][_0xd7a4('0x40')]));_0x277335[_0xd7a4('0x3e')]=_0x277335[_0xd7a4('0x3e')][_0xd7a4('0x41')]?_0x277335[_0xd7a4('0x3e')]:_0x5c7b8f[_0xd7a4('0x3a')];_0x277335[_0xd7a4('0x44')]=qs[_0xd7a4('0x45')](_0x834167[_0xd7a4('0x3b')][_0xd7a4('0x45')]);_0x277335[_0xd7a4('0x46')]=qs[_0xd7a4('0x3d')](_[_0xd7a4('0x58')](_0x834167[_0xd7a4('0x3b')],_0x5c7b8f[_0xd7a4('0x3d')]));if(_0x834167[_0xd7a4('0x3b')][_0xd7a4('0x47')]){_0x277335[_0xd7a4('0x46')]=_[_0xd7a4('0x48')](_0x277335[_0xd7a4('0x46')],{'$or':_['map'](_0x277335[_0xd7a4('0x3e')],function(_0x109a13){var _0x5f148e={};_0x5f148e[_0x109a13]={'$like':'%'+_0x834167['query']['filter']+'%'};return _0x5f148e;})});}_0x277335=_[_0xd7a4('0x48')]({},_0x277335,_0x834167['options']);return _0x53ed26['getFields'](_0x277335);}})[_0xd7a4('0x18')](function(_0x3cf5f9){if(_0x3cf5f9){_0x641389=_0x3cf5f9[_0xd7a4('0x41')];if(!_0x834167[_0xd7a4('0x3b')][_0xd7a4('0x42')](_0xd7a4('0x43'))){_0x277335['limit']=qs[_0xd7a4('0x29')](_0x834167['query'][_0xd7a4('0x29')]);_0x277335[_0xd7a4('0x28')]=qs[_0xd7a4('0x28')](_0x834167[_0xd7a4('0x3b')]['offset']);}return _0x53ed26['getFields'](_0x277335);}})['then'](function(_0x4b1a7a){if(_0x4b1a7a){return _0x4b1a7a?{'count':_0x641389,'rows':_0x4b1a7a}:null;}})[_0xd7a4('0x18')](respondWithResult(_0x2de64b,null))['catch'](handleError(_0x2de64b,null));};exports[_0xd7a4('0x59')]=function(_0x191c45,_0x110baf,_0x17f981){var _0x54c3a5={};var _0x910bdf={};var _0xf11cc;var _0x38ce12;return db[_0xd7a4('0x4b')][_0xd7a4('0x56')]({'where':{'id':_0x191c45[_0xd7a4('0x4f')]['id']}})[_0xd7a4('0x18')](handleEntityNotFound(_0x110baf,null))[_0xd7a4('0x18')](function(_0x1c512d){if(_0x1c512d){_0xf11cc=_0x1c512d;_0x910bdf[_0xd7a4('0x3a')]=_[_0xd7a4('0x3c')](db['Dynamics365Field'][_0xd7a4('0x36')]);_0x910bdf[_0xd7a4('0x3b')]=_[_0xd7a4('0x3c')](_0x191c45['query']);_0x910bdf['filters']=_[_0xd7a4('0x3f')](_0x910bdf['model'],_0x910bdf[_0xd7a4('0x3b')]);_0x54c3a5[_0xd7a4('0x3e')]=_['intersection'](_0x910bdf['model'],qs[_0xd7a4('0x40')](_0x191c45[_0xd7a4('0x3b')][_0xd7a4('0x40')]));_0x54c3a5[_0xd7a4('0x3e')]=_0x54c3a5[_0xd7a4('0x3e')][_0xd7a4('0x41')]?_0x54c3a5[_0xd7a4('0x3e')]:_0x910bdf[_0xd7a4('0x3a')];_0x54c3a5[_0xd7a4('0x44')]=qs[_0xd7a4('0x45')](_0x191c45[_0xd7a4('0x3b')][_0xd7a4('0x45')]);_0x54c3a5[_0xd7a4('0x46')]=qs[_0xd7a4('0x3d')](_['pick'](_0x191c45['query'],_0x910bdf[_0xd7a4('0x3d')]));if(_0x191c45[_0xd7a4('0x3b')][_0xd7a4('0x47')]){_0x54c3a5[_0xd7a4('0x46')]=_[_0xd7a4('0x48')](_0x54c3a5[_0xd7a4('0x46')],{'$or':_['map'](_0x54c3a5[_0xd7a4('0x3e')],function(_0x451dad){var _0x93e806={};_0x93e806[_0x451dad]={'$like':'%'+_0x191c45[_0xd7a4('0x3b')][_0xd7a4('0x47')]+'%'};return _0x93e806;})});}_0x54c3a5=_[_0xd7a4('0x48')]({},_0x54c3a5,_0x191c45[_0xd7a4('0x4a')]);return _0xf11cc[_0xd7a4('0x59')](_0x54c3a5);}})[_0xd7a4('0x18')](function(_0x3f34d4){if(_0x3f34d4){_0x38ce12=_0x3f34d4[_0xd7a4('0x41')];if(!_0x191c45['query'][_0xd7a4('0x42')](_0xd7a4('0x43'))){_0x54c3a5[_0xd7a4('0x29')]=qs[_0xd7a4('0x29')](_0x191c45[_0xd7a4('0x3b')]['limit']);_0x54c3a5[_0xd7a4('0x28')]=qs[_0xd7a4('0x28')](_0x191c45[_0xd7a4('0x3b')][_0xd7a4('0x28')]);}return _0xf11cc[_0xd7a4('0x59')](_0x54c3a5);}})['then'](function(_0xedd4a5){if(_0xedd4a5){return _0xedd4a5?{'count':_0x38ce12,'rows':_0xedd4a5}:null;}})[_0xd7a4('0x18')](respondWithResult(_0x110baf,null))['catch'](handleError(_0x110baf,null));};exports[_0xd7a4('0x5a')]=function(_0x283016,_0x327f90,_0x2b72e4){var _0x2bac7f={};var _0x16b52c={};var _0x291a33;var _0x26bf45;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x283016[_0xd7a4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x327f90,null))[_0xd7a4('0x18')](function(_0x49d431){if(_0x49d431){_0x291a33=_0x49d431;_0x16b52c[_0xd7a4('0x3a')]=_[_0xd7a4('0x3c')](db[_0xd7a4('0x57')]['rawAttributes']);_0x16b52c[_0xd7a4('0x3b')]=_[_0xd7a4('0x3c')](_0x283016[_0xd7a4('0x3b')]);_0x16b52c['filters']=_[_0xd7a4('0x3f')](_0x16b52c[_0xd7a4('0x3a')],_0x16b52c[_0xd7a4('0x3b')]);_0x2bac7f[_0xd7a4('0x3e')]=_[_0xd7a4('0x3f')](_0x16b52c[_0xd7a4('0x3a')],qs[_0xd7a4('0x40')](_0x283016[_0xd7a4('0x3b')][_0xd7a4('0x40')]));_0x2bac7f[_0xd7a4('0x3e')]=_0x2bac7f[_0xd7a4('0x3e')][_0xd7a4('0x41')]?_0x2bac7f[_0xd7a4('0x3e')]:_0x16b52c['model'];_0x2bac7f[_0xd7a4('0x44')]=qs[_0xd7a4('0x45')](_0x283016['query'][_0xd7a4('0x45')]);_0x2bac7f[_0xd7a4('0x46')]=qs['filters'](_[_0xd7a4('0x58')](_0x283016[_0xd7a4('0x3b')],_0x16b52c['filters']));if(_0x283016['query'][_0xd7a4('0x47')]){_0x2bac7f[_0xd7a4('0x46')]=_[_0xd7a4('0x48')](_0x2bac7f[_0xd7a4('0x46')],{'$or':_['map'](_0x2bac7f['attributes'],function(_0x185efa){var _0x3144c9={};_0x3144c9[_0x185efa]={'$like':'%'+_0x283016[_0xd7a4('0x3b')][_0xd7a4('0x47')]+'%'};return _0x3144c9;})});}_0x2bac7f=_[_0xd7a4('0x48')]({},_0x2bac7f,_0x283016[_0xd7a4('0x4a')]);return _0x291a33[_0xd7a4('0x5a')](_0x2bac7f);}})[_0xd7a4('0x18')](function(_0x213e54){if(_0x213e54){_0x26bf45=_0x213e54[_0xd7a4('0x41')];if(!_0x283016['query'][_0xd7a4('0x42')](_0xd7a4('0x43'))){_0x2bac7f['limit']=qs[_0xd7a4('0x29')](_0x283016[_0xd7a4('0x3b')]['limit']);_0x2bac7f[_0xd7a4('0x28')]=qs[_0xd7a4('0x28')](_0x283016[_0xd7a4('0x3b')][_0xd7a4('0x28')]);}return _0x291a33[_0xd7a4('0x5a')](_0x2bac7f);}})[_0xd7a4('0x18')](function(_0x345bb7){if(_0x345bb7){return _0x345bb7?{'count':_0x26bf45,'rows':_0x345bb7}:null;}})[_0xd7a4('0x18')](respondWithResult(_0x327f90,null))['catch'](handleError(_0x327f90,null));}; \ No newline at end of file +var _0x9cba=['info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','destroy','stack','name','index','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','map','filters','query','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','show','keys','length','includeAll','find','create','body','update','getFields','findOne','params','Dynamics365Field','hasOwnProperty','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then'];(function(_0x5befd7,_0x449e35){var _0x14b798=function(_0x1e5447){while(--_0x1e5447){_0x5befd7['push'](_0x5befd7['shift']());}};_0x14b798(++_0x449e35);}(_0x9cba,0x10a));var _0xa9cb=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9cba[_0x543084];return _0x306a57;};'use strict';var pdf=require(_0xa9cb('0x0'));var emlformat=require(_0xa9cb('0x1'));var rimraf=require(_0xa9cb('0x2'));var zipdir=require(_0xa9cb('0x3'));var jsonpatch=require(_0xa9cb('0x4'));var rp=require(_0xa9cb('0x5'));var moment=require(_0xa9cb('0x6'));var BPromise=require(_0xa9cb('0x7'));var Mustache=require(_0xa9cb('0x8'));var util=require(_0xa9cb('0x9'));var path=require(_0xa9cb('0xa'));var sox=require('sox');var csv=require(_0xa9cb('0xb'));var ejs=require(_0xa9cb('0xc'));var fs=require('fs');var _=require(_0xa9cb('0xd'));var squel=require(_0xa9cb('0xe'));var crypto=require(_0xa9cb('0xf'));var jsforce=require(_0xa9cb('0x10'));var deskjs=require(_0xa9cb('0x11'));var toCsv=require(_0xa9cb('0xb'));var querystring=require(_0xa9cb('0x12'));var Papa=require('papaparse');var Redis=require(_0xa9cb('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xa9cb('0x14'));var as=require(_0xa9cb('0x15'));var hardwareService=require(_0xa9cb('0x16'));var logger=require(_0xa9cb('0x17'))(_0xa9cb('0x18'));var utils=require(_0xa9cb('0x19'));var config=require(_0xa9cb('0x1a'));var licenseUtil=require(_0xa9cb('0x1b'));var db=require(_0xa9cb('0x1c'))['db'];var jayson=require(_0xa9cb('0x1d'));var client=jayson[_0xa9cb('0x1e')][_0xa9cb('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x29b17c,_0x4f075c,_0xd23fc5,_0x57350d){return new BPromise(function(_0x5a997d,_0x31bb60){var _0x1bf9f3=_0x57350d||client;return _0x1bf9f3[_0xa9cb('0x20')](_0x29b17c,_0xd23fc5)[_0xa9cb('0x21')](function(_0x54f0f6){logger[_0xa9cb('0x22')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4f075c,_0xa9cb('0x23'));logger[_0xa9cb('0x24')](_0xa9cb('0x25'),_0x4f075c,_0xa9cb('0x23'),JSON[_0xa9cb('0x26')](_0x54f0f6));if(_0x54f0f6[_0xa9cb('0x27')]){if(_0x54f0f6[_0xa9cb('0x27')][_0xa9cb('0x28')]===0x1f4){logger[_0xa9cb('0x27')](_0xa9cb('0x29'),_0x4f075c,_0x54f0f6[_0xa9cb('0x27')]['message']);return _0x31bb60(_0x54f0f6[_0xa9cb('0x27')][_0xa9cb('0x2a')]);}logger[_0xa9cb('0x27')](_0xa9cb('0x29'),_0x4f075c,_0x54f0f6['error'][_0xa9cb('0x2a')]);return _0x5a997d(_0x54f0f6['error'][_0xa9cb('0x2a')]);}else{logger[_0xa9cb('0x22')](_0xa9cb('0x29'),_0x4f075c,_0xa9cb('0x23'));_0x5a997d(_0x54f0f6[_0xa9cb('0x2b')][_0xa9cb('0x2a')]);}})[_0xa9cb('0x2c')](function(_0x2f3e1b){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x4f075c,_0x2f3e1b);_0x31bb60(_0x2f3e1b);});});}function respondWithStatusCode(_0x2f1820,_0x21d723){_0x21d723=_0x21d723||0xcc;return function(_0x58ae9b){if(_0x58ae9b){return _0x2f1820[_0xa9cb('0x2d')](_0x21d723);}return _0x2f1820[_0xa9cb('0x2e')](_0x21d723)[_0xa9cb('0x2f')]();};}function respondWithResult(_0x985882,_0x21aa48){_0x21aa48=_0x21aa48||0xc8;return function(_0xd1dd7e){if(_0xd1dd7e){return _0x985882[_0xa9cb('0x2e')](_0x21aa48)[_0xa9cb('0x30')](_0xd1dd7e);}};}function respondWithFilteredResult(_0x463bbd,_0x3e146b){return function(_0x28d35c){if(_0x28d35c){var _0x2eb809=_0x28d35c['count'],_0x1b4f6b=_0x3e146b[_0xa9cb('0x31')],_0x6170eb=_0x3e146b['offset']+_0x3e146b[_0xa9cb('0x32')],_0x14ec5c;if(_0x6170eb>=_0x2eb809){_0x6170eb=_0x2eb809;_0x14ec5c=0xc8;}else{_0x14ec5c=0xce;}_0x463bbd['status'](_0x14ec5c);return _0x463bbd[_0xa9cb('0x33')](_0xa9cb('0x34'),_0x1b4f6b+'-'+_0x6170eb+'/'+_0x2eb809)[_0xa9cb('0x30')](_0x28d35c);}return null;};}function patchUpdates(_0x7969b6){return function(_0x35eadd){try{jsonpatch[_0xa9cb('0x35')](_0x35eadd,_0x7969b6,!![]);}catch(_0x4f9ce7){return BPromise[_0xa9cb('0x36')](_0x4f9ce7);}return _0x35eadd[_0xa9cb('0x37')]();};}function saveUpdates(_0x515b91,_0x149ca7){return function(_0x8fe48c){if(_0x8fe48c){return _0x8fe48c['update'](_0x515b91)['then'](function(_0x243a82){return _0x243a82;});}return null;};}function removeEntity(_0x2a828c,_0x16f9a6){return function(_0x1a7f35){if(_0x1a7f35){return _0x1a7f35[_0xa9cb('0x38')]()[_0xa9cb('0x21')](function(){_0x2a828c[_0xa9cb('0x2e')](0xcc)[_0xa9cb('0x2f')]();});}};}function handleEntityNotFound(_0x21111b,_0x49c6d6){return function(_0x46ba20){if(!_0x46ba20){_0x21111b[_0xa9cb('0x2d')](0x194);}return _0x46ba20;};}function handleError(_0x4efd02,_0x577f6a){_0x577f6a=_0x577f6a||0x1f4;return function(_0x464833){logger['error'](_0x464833[_0xa9cb('0x39')]);if(_0x464833[_0xa9cb('0x3a')]){delete _0x464833['name'];}_0x4efd02['status'](_0x577f6a)['send'](_0x464833);};}exports[_0xa9cb('0x3b')]=function(_0x20e5d8,_0x4e1e3f){var _0x1a4622={},_0xf4072e={},_0x425a9d={'count':0x0,'rows':[]};var _0x40bab5=_['map'](db[_0xa9cb('0x3c')][_0xa9cb('0x3d')],function(_0x3ec83c){return{'name':_0x3ec83c[_0xa9cb('0x3e')],'type':_0x3ec83c[_0xa9cb('0x3f')][_0xa9cb('0x40')]};});_0xf4072e[_0xa9cb('0x41')]=_[_0xa9cb('0x42')](_0x40bab5,_0xa9cb('0x3a'));_0xf4072e['query']=_['keys'](_0x20e5d8['query']);_0xf4072e[_0xa9cb('0x43')]=_['intersection'](_0xf4072e[_0xa9cb('0x41')],_0xf4072e[_0xa9cb('0x44')]);_0x1a4622[_0xa9cb('0x45')]=_[_0xa9cb('0x46')](_0xf4072e[_0xa9cb('0x41')],qs[_0xa9cb('0x47')](_0x20e5d8[_0xa9cb('0x44')]['fields']));_0x1a4622[_0xa9cb('0x45')]=_0x1a4622[_0xa9cb('0x45')]['length']?_0x1a4622[_0xa9cb('0x45')]:_0xf4072e[_0xa9cb('0x41')];if(!_0x20e5d8[_0xa9cb('0x44')]['hasOwnProperty'](_0xa9cb('0x48'))){_0x1a4622[_0xa9cb('0x32')]=qs[_0xa9cb('0x32')](_0x20e5d8['query'][_0xa9cb('0x32')]);_0x1a4622[_0xa9cb('0x31')]=qs['offset'](_0x20e5d8[_0xa9cb('0x44')][_0xa9cb('0x31')]);}_0x1a4622[_0xa9cb('0x49')]=qs['sort'](_0x20e5d8[_0xa9cb('0x44')][_0xa9cb('0x4a')]);_0x1a4622[_0xa9cb('0x4b')]=qs[_0xa9cb('0x43')](_[_0xa9cb('0x4c')](_0x20e5d8[_0xa9cb('0x44')],_0xf4072e[_0xa9cb('0x43')]),_0x40bab5);if(_0x20e5d8['query'][_0xa9cb('0x4d')]){_0x1a4622['where']=_[_0xa9cb('0x4e')](_0x1a4622[_0xa9cb('0x4b')],{'$or':_[_0xa9cb('0x42')](_0x40bab5,function(_0x3711bf){if(_0x3711bf['type']!==_0xa9cb('0x4f')){var _0x22abc7={};_0x22abc7[_0x3711bf[_0xa9cb('0x3a')]]={'$like':'%'+_0x20e5d8['query'][_0xa9cb('0x4d')]+'%'};return _0x22abc7;}})});}_0x1a4622=_[_0xa9cb('0x4e')]({},_0x1a4622,_0x20e5d8[_0xa9cb('0x50')]);var _0x3a9873={'where':_0x1a4622['where']};return db[_0xa9cb('0x3c')][_0xa9cb('0x51')](_0x3a9873)[_0xa9cb('0x21')](function(_0x4f707b){_0x425a9d[_0xa9cb('0x51')]=_0x4f707b;if(_0x20e5d8[_0xa9cb('0x44')]['includeAll']){_0x1a4622[_0xa9cb('0x52')]=[{'all':!![]}];}return db[_0xa9cb('0x3c')][_0xa9cb('0x53')](_0x1a4622);})[_0xa9cb('0x21')](function(_0x2682b7){_0x425a9d[_0xa9cb('0x54')]=_0x2682b7;return _0x425a9d;})[_0xa9cb('0x21')](respondWithFilteredResult(_0x4e1e3f,_0x1a4622))['catch'](handleError(_0x4e1e3f,null));};exports[_0xa9cb('0x55')]=function(_0x60c0d9,_0x41dd01){var _0xa09422={'raw':![],'where':{'id':_0x60c0d9['params']['id']}},_0x483f56={};_0x483f56[_0xa9cb('0x41')]=_[_0xa9cb('0x56')](db[_0xa9cb('0x3c')]['rawAttributes']);_0x483f56['query']=_['keys'](_0x60c0d9[_0xa9cb('0x44')]);_0x483f56[_0xa9cb('0x43')]=_[_0xa9cb('0x46')](_0x483f56[_0xa9cb('0x41')],_0x483f56[_0xa9cb('0x44')]);_0xa09422[_0xa9cb('0x45')]=_[_0xa9cb('0x46')](_0x483f56['model'],qs[_0xa9cb('0x47')](_0x60c0d9[_0xa9cb('0x44')]['fields']));_0xa09422['attributes']=_0xa09422[_0xa9cb('0x45')][_0xa9cb('0x57')]?_0xa09422[_0xa9cb('0x45')]:_0x483f56[_0xa9cb('0x41')];if(_0x60c0d9[_0xa9cb('0x44')][_0xa9cb('0x58')]){_0xa09422[_0xa9cb('0x52')]=[{'all':!![]}];}_0xa09422=_[_0xa9cb('0x4e')]({},_0xa09422,_0x60c0d9[_0xa9cb('0x50')]);return db[_0xa9cb('0x3c')][_0xa9cb('0x59')](_0xa09422)['then'](handleEntityNotFound(_0x41dd01,null))[_0xa9cb('0x21')](respondWithResult(_0x41dd01,null))[_0xa9cb('0x2c')](handleError(_0x41dd01,null));};exports[_0xa9cb('0x5a')]=function(_0x3e81b7,_0x2ac183){return db[_0xa9cb('0x3c')]['create'](_0x3e81b7[_0xa9cb('0x5b')],{})[_0xa9cb('0x21')](respondWithResult(_0x2ac183,0xc9))['catch'](handleError(_0x2ac183,null));};exports[_0xa9cb('0x5c')]=function(_0x68e917,_0x22c61c){if(_0x68e917[_0xa9cb('0x5b')]['id']){delete _0x68e917['body']['id'];}return db[_0xa9cb('0x3c')][_0xa9cb('0x59')]({'where':{'id':_0x68e917['params']['id']}})['then'](handleEntityNotFound(_0x22c61c,null))[_0xa9cb('0x21')](saveUpdates(_0x68e917[_0xa9cb('0x5b')],null))[_0xa9cb('0x21')](respondWithResult(_0x22c61c,null))['catch'](handleError(_0x22c61c,null));};exports['destroy']=function(_0x5db948,_0xef6798){return db['Dynamics365Configuration'][_0xa9cb('0x59')]({'where':{'id':_0x5db948['params']['id']}})[_0xa9cb('0x21')](handleEntityNotFound(_0xef6798,null))[_0xa9cb('0x21')](removeEntity(_0xef6798,null))[_0xa9cb('0x2c')](handleError(_0xef6798,null));};exports[_0xa9cb('0x5d')]=function(_0x5bab9f,_0x56161d,_0x38bf05){var _0x6f3461={};var _0x1849ed={};var _0x5caf52;var _0x183c7a;return db[_0xa9cb('0x3c')][_0xa9cb('0x5e')]({'where':{'id':_0x5bab9f[_0xa9cb('0x5f')]['id']}})[_0xa9cb('0x21')](handleEntityNotFound(_0x56161d,null))['then'](function(_0x2fccf6){if(_0x2fccf6){_0x5caf52=_0x2fccf6;_0x1849ed[_0xa9cb('0x41')]=_['keys'](db[_0xa9cb('0x60')][_0xa9cb('0x3d')]);_0x1849ed['query']=_['keys'](_0x5bab9f['query']);_0x1849ed[_0xa9cb('0x43')]=_['intersection'](_0x1849ed[_0xa9cb('0x41')],_0x1849ed[_0xa9cb('0x44')]);_0x6f3461['attributes']=_['intersection'](_0x1849ed[_0xa9cb('0x41')],qs[_0xa9cb('0x47')](_0x5bab9f[_0xa9cb('0x44')][_0xa9cb('0x47')]));_0x6f3461[_0xa9cb('0x45')]=_0x6f3461[_0xa9cb('0x45')]['length']?_0x6f3461['attributes']:_0x1849ed[_0xa9cb('0x41')];_0x6f3461['order']=qs[_0xa9cb('0x4a')](_0x5bab9f['query'][_0xa9cb('0x4a')]);_0x6f3461[_0xa9cb('0x4b')]=qs['filters'](_[_0xa9cb('0x4c')](_0x5bab9f[_0xa9cb('0x44')],_0x1849ed[_0xa9cb('0x43')]));if(_0x5bab9f[_0xa9cb('0x44')][_0xa9cb('0x4d')]){_0x6f3461[_0xa9cb('0x4b')]=_[_0xa9cb('0x4e')](_0x6f3461[_0xa9cb('0x4b')],{'$or':_[_0xa9cb('0x42')](_0x6f3461[_0xa9cb('0x45')],function(_0x269cb5){var _0x431ab5={};_0x431ab5[_0x269cb5]={'$like':'%'+_0x5bab9f[_0xa9cb('0x44')][_0xa9cb('0x4d')]+'%'};return _0x431ab5;})});}_0x6f3461=_[_0xa9cb('0x4e')]({},_0x6f3461,_0x5bab9f['options']);return _0x5caf52[_0xa9cb('0x5d')](_0x6f3461);}})['then'](function(_0x5c8265){if(_0x5c8265){_0x183c7a=_0x5c8265[_0xa9cb('0x57')];if(!_0x5bab9f[_0xa9cb('0x44')][_0xa9cb('0x61')](_0xa9cb('0x48'))){_0x6f3461[_0xa9cb('0x32')]=qs[_0xa9cb('0x32')](_0x5bab9f[_0xa9cb('0x44')][_0xa9cb('0x32')]);_0x6f3461[_0xa9cb('0x31')]=qs['offset'](_0x5bab9f['query'][_0xa9cb('0x31')]);}return _0x5caf52[_0xa9cb('0x5d')](_0x6f3461);}})['then'](function(_0x4f99a8){if(_0x4f99a8){return _0x4f99a8?{'count':_0x183c7a,'rows':_0x4f99a8}:null;}})[_0xa9cb('0x21')](respondWithResult(_0x56161d,null))[_0xa9cb('0x2c')](handleError(_0x56161d,null));};exports[_0xa9cb('0x62')]=function(_0x475d3f,_0x2a944e,_0x492c9e){var _0x15c509={};var _0x3ea6f4={};var _0x43f0ab;var _0x29cc0e;return db[_0xa9cb('0x3c')][_0xa9cb('0x5e')]({'where':{'id':_0x475d3f[_0xa9cb('0x5f')]['id']}})[_0xa9cb('0x21')](handleEntityNotFound(_0x2a944e,null))['then'](function(_0x44eb41){if(_0x44eb41){_0x43f0ab=_0x44eb41;_0x3ea6f4[_0xa9cb('0x41')]=_['keys'](db[_0xa9cb('0x60')][_0xa9cb('0x3d')]);_0x3ea6f4['query']=_[_0xa9cb('0x56')](_0x475d3f['query']);_0x3ea6f4[_0xa9cb('0x43')]=_[_0xa9cb('0x46')](_0x3ea6f4[_0xa9cb('0x41')],_0x3ea6f4[_0xa9cb('0x44')]);_0x15c509[_0xa9cb('0x45')]=_[_0xa9cb('0x46')](_0x3ea6f4[_0xa9cb('0x41')],qs[_0xa9cb('0x47')](_0x475d3f['query']['fields']));_0x15c509[_0xa9cb('0x45')]=_0x15c509[_0xa9cb('0x45')]['length']?_0x15c509[_0xa9cb('0x45')]:_0x3ea6f4[_0xa9cb('0x41')];_0x15c509[_0xa9cb('0x49')]=qs[_0xa9cb('0x4a')](_0x475d3f[_0xa9cb('0x44')][_0xa9cb('0x4a')]);_0x15c509[_0xa9cb('0x4b')]=qs[_0xa9cb('0x43')](_[_0xa9cb('0x4c')](_0x475d3f[_0xa9cb('0x44')],_0x3ea6f4[_0xa9cb('0x43')]));if(_0x475d3f[_0xa9cb('0x44')][_0xa9cb('0x4d')]){_0x15c509[_0xa9cb('0x4b')]=_[_0xa9cb('0x4e')](_0x15c509[_0xa9cb('0x4b')],{'$or':_[_0xa9cb('0x42')](_0x15c509[_0xa9cb('0x45')],function(_0x29c010){var _0x10d51a={};_0x10d51a[_0x29c010]={'$like':'%'+_0x475d3f['query'][_0xa9cb('0x4d')]+'%'};return _0x10d51a;})});}_0x15c509=_['merge']({},_0x15c509,_0x475d3f[_0xa9cb('0x50')]);return _0x43f0ab['getSubjects'](_0x15c509);}})['then'](function(_0xdf98bb){if(_0xdf98bb){_0x29cc0e=_0xdf98bb[_0xa9cb('0x57')];if(!_0x475d3f[_0xa9cb('0x44')][_0xa9cb('0x61')](_0xa9cb('0x48'))){_0x15c509[_0xa9cb('0x32')]=qs[_0xa9cb('0x32')](_0x475d3f['query'][_0xa9cb('0x32')]);_0x15c509[_0xa9cb('0x31')]=qs['offset'](_0x475d3f[_0xa9cb('0x44')][_0xa9cb('0x31')]);}return _0x43f0ab[_0xa9cb('0x62')](_0x15c509);}})[_0xa9cb('0x21')](function(_0x263b14){if(_0x263b14){return _0x263b14?{'count':_0x29cc0e,'rows':_0x263b14}:null;}})[_0xa9cb('0x21')](respondWithResult(_0x2a944e,null))[_0xa9cb('0x2c')](handleError(_0x2a944e,null));};exports[_0xa9cb('0x63')]=function(_0xa482bc,_0x3efff0,_0x5987c8){var _0xe27744={};var _0x3a90da={};var _0x57b48b;var _0x203930;return db[_0xa9cb('0x3c')][_0xa9cb('0x5e')]({'where':{'id':_0xa482bc[_0xa9cb('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3efff0,null))['then'](function(_0x5bbcea){if(_0x5bbcea){_0x57b48b=_0x5bbcea;_0x3a90da[_0xa9cb('0x41')]=_[_0xa9cb('0x56')](db['Dynamics365Field']['rawAttributes']);_0x3a90da[_0xa9cb('0x44')]=_[_0xa9cb('0x56')](_0xa482bc[_0xa9cb('0x44')]);_0x3a90da[_0xa9cb('0x43')]=_['intersection'](_0x3a90da[_0xa9cb('0x41')],_0x3a90da['query']);_0xe27744[_0xa9cb('0x45')]=_['intersection'](_0x3a90da[_0xa9cb('0x41')],qs[_0xa9cb('0x47')](_0xa482bc[_0xa9cb('0x44')]['fields']));_0xe27744['attributes']=_0xe27744[_0xa9cb('0x45')][_0xa9cb('0x57')]?_0xe27744[_0xa9cb('0x45')]:_0x3a90da[_0xa9cb('0x41')];_0xe27744[_0xa9cb('0x49')]=qs[_0xa9cb('0x4a')](_0xa482bc[_0xa9cb('0x44')][_0xa9cb('0x4a')]);_0xe27744[_0xa9cb('0x4b')]=qs[_0xa9cb('0x43')](_[_0xa9cb('0x4c')](_0xa482bc['query'],_0x3a90da['filters']));if(_0xa482bc[_0xa9cb('0x44')][_0xa9cb('0x4d')]){_0xe27744[_0xa9cb('0x4b')]=_[_0xa9cb('0x4e')](_0xe27744['where'],{'$or':_[_0xa9cb('0x42')](_0xe27744['attributes'],function(_0xccfb1c){var _0x48e64a={};_0x48e64a[_0xccfb1c]={'$like':'%'+_0xa482bc[_0xa9cb('0x44')]['filter']+'%'};return _0x48e64a;})});}_0xe27744=_[_0xa9cb('0x4e')]({},_0xe27744,_0xa482bc[_0xa9cb('0x50')]);return _0x57b48b[_0xa9cb('0x63')](_0xe27744);}})[_0xa9cb('0x21')](function(_0x444a16){if(_0x444a16){_0x203930=_0x444a16[_0xa9cb('0x57')];if(!_0xa482bc[_0xa9cb('0x44')][_0xa9cb('0x61')](_0xa9cb('0x48'))){_0xe27744[_0xa9cb('0x32')]=qs[_0xa9cb('0x32')](_0xa482bc[_0xa9cb('0x44')][_0xa9cb('0x32')]);_0xe27744[_0xa9cb('0x31')]=qs[_0xa9cb('0x31')](_0xa482bc[_0xa9cb('0x44')]['offset']);}return _0x57b48b[_0xa9cb('0x63')](_0xe27744);}})[_0xa9cb('0x21')](function(_0x1cad0b){if(_0x1cad0b){return _0x1cad0b?{'count':_0x203930,'rows':_0x1cad0b}:null;}})[_0xa9cb('0x21')](respondWithResult(_0x3efff0,null))[_0xa9cb('0x2c')](handleError(_0x3efff0,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index f88088b..eee7bb2 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 _0xf305=['api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util'];(function(_0x5473e7,_0xec03b7){var _0x3afd0d=function(_0x20c886){while(--_0x20c886){_0x5473e7['push'](_0x5473e7['shift']());}};_0x3afd0d(++_0xec03b7);}(_0xf305,0x1d2));var _0x5f30=function(_0x4409e7,_0x307f17){_0x4409e7=_0x4409e7-0x0;var _0x24c751=_0xf305[_0x4409e7];return _0x24c751;};'use strict';var _=require(_0x5f30('0x0'));var util=require(_0x5f30('0x1'));var logger=require('../../config/logger')(_0x5f30('0x2'));var moment=require(_0x5f30('0x3'));var BPromise=require('bluebird');var rp=require(_0x5f30('0x4'));var fs=require('fs');var path=require(_0x5f30('0x5'));var rimraf=require(_0x5f30('0x6'));var config=require(_0x5f30('0x7'));var attributes=require(_0x5f30('0x8'));module[_0x5f30('0x9')]=function(_0x174fc1,_0x27cb72){return _0x174fc1[_0x5f30('0xa')](_0x5f30('0xb'),attributes,{'tableName':_0x5f30('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9cfd=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9cfd,0x180));var _0xd9cf=function(_0x2ce16b,_0x51934f){_0x2ce16b=_0x2ce16b-0x0;var _0x17a9d2=_0x9cfd[_0x2ce16b];return _0x17a9d2;};'use strict';var _=require(_0xd9cf('0x0'));var util=require(_0xd9cf('0x1'));var logger=require(_0xd9cf('0x2'))(_0xd9cf('0x3'));var moment=require(_0xd9cf('0x4'));var BPromise=require(_0xd9cf('0x5'));var rp=require(_0xd9cf('0x6'));var fs=require('fs');var path=require(_0xd9cf('0x7'));var rimraf=require('rimraf');var config=require(_0xd9cf('0x8'));var attributes=require(_0xd9cf('0x9'));module[_0xd9cf('0xa')]=function(_0xf9fa75,_0x598117){return _0xf9fa75['define'](_0xd9cf('0xb'),attributes,{'tableName':_0xd9cf('0xc'),'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 de45b6c..f8ee4e3 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 _0x3660=['stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x26f3ee,_0x1500e0){var _0x447545=function(_0x132da9){while(--_0x132da9){_0x26f3ee['push'](_0x26f3ee['shift']());}};_0x447545(++_0x1500e0);}(_0x3660,0x19d));var _0x0366=function(_0x2c25b0,_0x41a941){_0x2c25b0=_0x2c25b0-0x0;var _0x12a6b0=_0x3660[_0x2c25b0];return _0x12a6b0;};'use strict';var _=require(_0x0366('0x0'));var util=require(_0x0366('0x1'));var moment=require(_0x0366('0x2'));var BPromise=require('bluebird');var rs=require(_0x0366('0x3'));var fs=require('fs');var Redis=require(_0x0366('0x4'));var db=require(_0x0366('0x5'))['db'];var utils=require(_0x0366('0x6'));var logger=require(_0x0366('0x7'))(_0x0366('0x8'));var config=require(_0x0366('0x9'));var jayson=require(_0x0366('0xa'));var client=jayson[_0x0366('0xb')][_0x0366('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x49608e,_0x2f87ef,_0x9a750c){return new BPromise(function(_0x57aae0,_0x42c1b8){return client[_0x0366('0xd')](_0x49608e,_0x9a750c)[_0x0366('0xe')](function(_0x545d1c){logger[_0x0366('0xf')](_0x0366('0x10'),_0x2f87ef,_0x0366('0x11'));logger[_0x0366('0x12')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x2f87ef,_0x0366('0x11'),JSON[_0x0366('0x13')](_0x545d1c));if(_0x545d1c['error']){if(_0x545d1c[_0x0366('0x14')][_0x0366('0x15')]===0x1f4){logger[_0x0366('0x14')](_0x0366('0x10'),_0x2f87ef,_0x545d1c[_0x0366('0x14')][_0x0366('0x16')]);return _0x42c1b8(_0x545d1c[_0x0366('0x14')]['message']);}logger[_0x0366('0x14')](_0x0366('0x10'),_0x2f87ef,_0x545d1c[_0x0366('0x14')][_0x0366('0x16')]);return _0x57aae0(_0x545d1c[_0x0366('0x14')][_0x0366('0x16')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x2f87ef,_0x0366('0x11'));_0x57aae0(_0x545d1c['result'][_0x0366('0x16')]);}})[_0x0366('0x17')](function(_0x42c038){logger[_0x0366('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2f87ef,_0x42c038);_0x42c1b8(_0x42c038);});});} \ No newline at end of file +var _0xa799=['message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x20b0fd,_0x1d6993){var _0x586764=function(_0x1297b6){while(--_0x1297b6){_0x20b0fd['push'](_0x20b0fd['shift']());}};_0x586764(++_0x1d6993);}(_0xa799,0x82));var _0x9a79=function(_0x4095b1,_0x2c3362){_0x4095b1=_0x4095b1-0x0;var _0x9dcdd8=_0xa799[_0x4095b1];return _0x9dcdd8;};'use strict';var _=require(_0x9a79('0x0'));var util=require(_0x9a79('0x1'));var moment=require(_0x9a79('0x2'));var BPromise=require('bluebird');var rs=require(_0x9a79('0x3'));var fs=require('fs');var Redis=require(_0x9a79('0x4'));var db=require(_0x9a79('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9a79('0x6'));var config=require('../../config/environment');var jayson=require(_0x9a79('0x7'));var client=jayson[_0x9a79('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x440bbd,_0x3ba0d7,_0xd4559f){return new BPromise(function(_0x4c19d4,_0x12dc43){return client['request'](_0x440bbd,_0xd4559f)[_0x9a79('0x9')](function(_0x179f35){logger['info'](_0x9a79('0xa'),_0x3ba0d7,_0x9a79('0xb'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x3ba0d7,_0x9a79('0xb'),JSON[_0x9a79('0xc')](_0x179f35));if(_0x179f35['error']){if(_0x179f35['error']['code']===0x1f4){logger[_0x9a79('0xd')](_0x9a79('0xa'),_0x3ba0d7,_0x179f35[_0x9a79('0xd')]['message']);return _0x12dc43(_0x179f35[_0x9a79('0xd')][_0x9a79('0xe')]);}logger[_0x9a79('0xd')](_0x9a79('0xa'),_0x3ba0d7,_0x179f35[_0x9a79('0xd')][_0x9a79('0xe')]);return _0x4c19d4(_0x179f35[_0x9a79('0xd')][_0x9a79('0xe')]);}else{logger['info'](_0x9a79('0xa'),_0x3ba0d7,_0x9a79('0xb'));_0x4c19d4(_0x179f35['result'][_0x9a79('0xe')]);}})[_0x9a79('0xf')](function(_0x584a2d){logger[_0x9a79('0xd')](_0x9a79('0xa'),_0x3ba0d7,_0x584a2d);_0x12dc43(_0x584a2d);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 63bef67..de72d9f 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 _0x04b8=['util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','/:id','post','put','update','delete','destroy','exports'];(function(_0x467cb0,_0x303070){var _0x2153f7=function(_0x51775a){while(--_0x51775a){_0x467cb0['push'](_0x467cb0['shift']());}};_0x2153f7(++_0x303070);}(_0x04b8,0x159));var _0x804b=function(_0x31435f,_0x34021b){_0x31435f=_0x31435f-0x0;var _0x3f73aa=_0x04b8[_0x31435f];return _0x3f73aa;};'use strict';var multer=require('multer');var util=require(_0x804b('0x0'));var path=require('path');var timeout=require(_0x804b('0x1'));var express=require(_0x804b('0x2'));var router=express['Router']();var auth=require(_0x804b('0x3'));var interaction=require(_0x804b('0x4'));var config=require('../../config/environment');var controller=require(_0x804b('0x5'));router[_0x804b('0x6')]('/',auth[_0x804b('0x7')](),controller['index']);router[_0x804b('0x6')](_0x804b('0x8'),auth[_0x804b('0x7')](),controller['show']);router[_0x804b('0x9')]('/',auth[_0x804b('0x7')](),controller['create']);router[_0x804b('0xa')](_0x804b('0x8'),auth[_0x804b('0x7')](),controller[_0x804b('0xb')]);router[_0x804b('0xc')]('/:id',auth[_0x804b('0x7')](),controller[_0x804b('0xd')]);module[_0x804b('0xe')]=router; \ No newline at end of file +var _0x7d98=['get','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x149ad5,_0x12b417){var _0x2566b7=function(_0x157f10){while(--_0x157f10){_0x149ad5['push'](_0x149ad5['shift']());}};_0x2566b7(++_0x12b417);}(_0x7d98,0xe7));var _0x87d9=function(_0x5090d4,_0x1950a7){_0x5090d4=_0x5090d4-0x0;var _0x56c310=_0x7d98[_0x5090d4];return _0x56c310;};'use strict';var multer=require(_0x87d9('0x0'));var util=require('util');var path=require(_0x87d9('0x1'));var timeout=require(_0x87d9('0x2'));var express=require(_0x87d9('0x3'));var router=express[_0x87d9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x87d9('0x5'));var config=require(_0x87d9('0x6'));var controller=require('./intDynamics365Field.controller');router[_0x87d9('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x87d9('0x8'),auth[_0x87d9('0x9')](),controller[_0x87d9('0xa')]);router['post']('/',auth[_0x87d9('0x9')](),controller[_0x87d9('0xb')]);router[_0x87d9('0xc')]('/:id',auth[_0x87d9('0x9')](),controller[_0x87d9('0xd')]);router[_0x87d9('0xe')](_0x87d9('0x8'),auth[_0x87d9('0x9')](),controller[_0x87d9('0xf')]);module[_0x87d9('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index d2e42dd..accc65e 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 _0xd0db=['string','customVariable','keyValue','STRING','BOOLEAN','exports','ENUM'];(function(_0x4b2a0d,_0x51c101){var _0x482e95=function(_0x2138e2){while(--_0x2138e2){_0x4b2a0d['push'](_0x4b2a0d['shift']());}};_0x482e95(++_0x51c101);}(_0xd0db,0x7c));var _0xbd0d=function(_0x4cbdf0,_0x58a62a){_0x4cbdf0=_0x4cbdf0-0x0;var _0x53a32c=_0xd0db[_0x4cbdf0];return _0x53a32c;};'use strict';var Sequelize=require('sequelize');module[_0xbd0d('0x0')]={'type':{'type':Sequelize[_0xbd0d('0x1')](_0xbd0d('0x2'),'variable',_0xbd0d('0x3'),_0xbd0d('0x4')),'defaultValue':_0xbd0d('0x2')},'content':{'type':Sequelize[_0xbd0d('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string','variable',_0xbd0d('0x3'))},'keyContent':{'type':Sequelize[_0xbd0d('0x5')]},'idField':{'type':Sequelize[_0xbd0d('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xbd0d('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbd0d('0x5')]}}; \ No newline at end of file +var _0x6b6d=['STRING','ENUM','string','customVariable','BOOLEAN','variable','keyValue'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x6b6d,0x1d3));var _0xd6b6=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0x6b6d[_0x519756];return _0x37047e;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM']('string',_0xd6b6('0x0'),'customVariable',_0xd6b6('0x1')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd6b6('0x2')]},'keyType':{'type':Sequelize[_0xd6b6('0x3')](_0xd6b6('0x4'),_0xd6b6('0x0'),_0xd6b6('0x5'))},'keyContent':{'type':Sequelize[_0xd6b6('0x2')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd6b6('0x2')]},'customField':{'type':Sequelize[_0xd6b6('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd6b6('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 7815f86..34c1963 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 _0xccc2=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','catch','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x55e413,_0x354fa2){var _0x47fa08=function(_0x4c0a04){while(--_0x4c0a04){_0x55e413['push'](_0x55e413['shift']());}};_0x47fa08(++_0x354fa2);}(_0xccc2,0x1da));var _0x2ccc=function(_0x3933b3,_0x3d6b90){_0x3933b3=_0x3933b3-0x0;var _0x241a71=_0xccc2[_0x3933b3];return _0x241a71;};'use strict';var pdf=require(_0x2ccc('0x0'));var emlformat=require(_0x2ccc('0x1'));var rimraf=require(_0x2ccc('0x2'));var zipdir=require(_0x2ccc('0x3'));var jsonpatch=require(_0x2ccc('0x4'));var rp=require(_0x2ccc('0x5'));var moment=require(_0x2ccc('0x6'));var BPromise=require(_0x2ccc('0x7'));var Mustache=require(_0x2ccc('0x8'));var util=require(_0x2ccc('0x9'));var path=require(_0x2ccc('0xa'));var sox=require(_0x2ccc('0xb'));var csv=require(_0x2ccc('0xc'));var ejs=require(_0x2ccc('0xd'));var fs=require('fs');var _=require(_0x2ccc('0xe'));var squel=require(_0x2ccc('0xf'));var crypto=require('crypto');var jsforce=require(_0x2ccc('0x10'));var deskjs=require(_0x2ccc('0x11'));var toCsv=require(_0x2ccc('0xc'));var querystring=require(_0x2ccc('0x12'));var Papa=require(_0x2ccc('0x13'));var Redis=require(_0x2ccc('0x14'));var authService=require(_0x2ccc('0x15'));var qs=require(_0x2ccc('0x16'));var as=require(_0x2ccc('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ccc('0x18'))(_0x2ccc('0x19'));var utils=require(_0x2ccc('0x1a'));var config=require(_0x2ccc('0x1b'));var licenseUtil=require(_0x2ccc('0x1c'));var db=require(_0x2ccc('0x1d'))['db'];function respondWithStatusCode(_0x4079fe,_0x19e8c7){_0x19e8c7=_0x19e8c7||0xcc;return function(_0x4f1157){if(_0x4f1157){return _0x4079fe[_0x2ccc('0x1e')](_0x19e8c7);}return _0x4079fe[_0x2ccc('0x1f')](_0x19e8c7)[_0x2ccc('0x20')]();};}function respondWithResult(_0x27d0dc,_0x468a3e){_0x468a3e=_0x468a3e||0xc8;return function(_0x14d16f){if(_0x14d16f){return _0x27d0dc[_0x2ccc('0x1f')](_0x468a3e)[_0x2ccc('0x21')](_0x14d16f);}};}function respondWithFilteredResult(_0x4f1a7b,_0x1e7c83){return function(_0x32fd43){if(_0x32fd43){var _0x38a042=_0x32fd43[_0x2ccc('0x22')],_0x3eeae7=_0x1e7c83[_0x2ccc('0x23')],_0x29cad6=_0x1e7c83['offset']+_0x1e7c83['limit'],_0x250b0d;if(_0x29cad6>=_0x38a042){_0x29cad6=_0x38a042;_0x250b0d=0xc8;}else{_0x250b0d=0xce;}_0x4f1a7b[_0x2ccc('0x1f')](_0x250b0d);return _0x4f1a7b[_0x2ccc('0x24')](_0x2ccc('0x25'),_0x3eeae7+'-'+_0x29cad6+'/'+_0x38a042)[_0x2ccc('0x21')](_0x32fd43);}return null;};}function patchUpdates(_0x35d609){return function(_0x20c2dd){try{jsonpatch[_0x2ccc('0x26')](_0x20c2dd,_0x35d609,!![]);}catch(_0x4511fe){return BPromise['reject'](_0x4511fe);}return _0x20c2dd[_0x2ccc('0x27')]();};}function saveUpdates(_0x1c356e,_0x1a748a){return function(_0x5192a1){if(_0x5192a1){return _0x5192a1[_0x2ccc('0x28')](_0x1c356e)[_0x2ccc('0x29')](function(_0x91fc10){return _0x91fc10;});}return null;};}function removeEntity(_0x1929e8,_0x876288){return function(_0x5e5187){if(_0x5e5187){return _0x5e5187['destroy']()[_0x2ccc('0x29')](function(){_0x1929e8[_0x2ccc('0x1f')](0xcc)[_0x2ccc('0x20')]();});}};}function handleEntityNotFound(_0x14254f,_0x292c65){return function(_0x2fc79c){if(!_0x2fc79c){_0x14254f['sendStatus'](0x194);}return _0x2fc79c;};}function handleError(_0xda4327,_0x1d2d39){_0x1d2d39=_0x1d2d39||0x1f4;return function(_0x1e576e){logger[_0x2ccc('0x2a')](_0x1e576e[_0x2ccc('0x2b')]);if(_0x1e576e['name']){delete _0x1e576e[_0x2ccc('0x2c')];}_0xda4327[_0x2ccc('0x1f')](_0x1d2d39)[_0x2ccc('0x2d')](_0x1e576e);};}exports[_0x2ccc('0x2e')]=function(_0x3e381c,_0x44a706){var _0xd8f346={},_0x5f5049={},_0xaf0b36={'count':0x0,'rows':[]};var _0x49a378=_[_0x2ccc('0x2f')](db[_0x2ccc('0x30')][_0x2ccc('0x31')],function(_0x3790f6){return{'name':_0x3790f6[_0x2ccc('0x32')],'type':_0x3790f6[_0x2ccc('0x33')][_0x2ccc('0x34')]};});_0x5f5049[_0x2ccc('0x35')]=_[_0x2ccc('0x2f')](_0x49a378,'name');_0x5f5049[_0x2ccc('0x36')]=_[_0x2ccc('0x37')](_0x3e381c[_0x2ccc('0x36')]);_0x5f5049[_0x2ccc('0x38')]=_['intersection'](_0x5f5049[_0x2ccc('0x35')],_0x5f5049['query']);_0xd8f346['attributes']=_[_0x2ccc('0x39')](_0x5f5049[_0x2ccc('0x35')],qs[_0x2ccc('0x3a')](_0x3e381c['query'][_0x2ccc('0x3a')]));_0xd8f346[_0x2ccc('0x3b')]=_0xd8f346[_0x2ccc('0x3b')][_0x2ccc('0x3c')]?_0xd8f346[_0x2ccc('0x3b')]:_0x5f5049[_0x2ccc('0x35')];if(!_0x3e381c[_0x2ccc('0x36')]['hasOwnProperty'](_0x2ccc('0x3d'))){_0xd8f346[_0x2ccc('0x3e')]=qs[_0x2ccc('0x3e')](_0x3e381c[_0x2ccc('0x36')][_0x2ccc('0x3e')]);_0xd8f346['offset']=qs['offset'](_0x3e381c[_0x2ccc('0x36')]['offset']);}_0xd8f346[_0x2ccc('0x3f')]=qs[_0x2ccc('0x40')](_0x3e381c[_0x2ccc('0x36')][_0x2ccc('0x40')]);_0xd8f346[_0x2ccc('0x41')]=qs['filters'](_['pick'](_0x3e381c[_0x2ccc('0x36')],_0x5f5049[_0x2ccc('0x38')]),_0x49a378);if(_0x3e381c[_0x2ccc('0x36')][_0x2ccc('0x42')]){_0xd8f346[_0x2ccc('0x41')]=_[_0x2ccc('0x43')](_0xd8f346[_0x2ccc('0x41')],{'$or':_[_0x2ccc('0x2f')](_0x49a378,function(_0x52bedd){if(_0x52bedd[_0x2ccc('0x33')]!==_0x2ccc('0x44')){var _0xad83cb={};_0xad83cb[_0x52bedd[_0x2ccc('0x2c')]]={'$like':'%'+_0x3e381c[_0x2ccc('0x36')][_0x2ccc('0x42')]+'%'};return _0xad83cb;}})});}_0xd8f346=_[_0x2ccc('0x43')]({},_0xd8f346,_0x3e381c['options']);var _0x90329c={'where':_0xd8f346[_0x2ccc('0x41')]};return db[_0x2ccc('0x30')][_0x2ccc('0x22')](_0x90329c)[_0x2ccc('0x29')](function(_0x2813e6){_0xaf0b36[_0x2ccc('0x22')]=_0x2813e6;if(_0x3e381c[_0x2ccc('0x36')][_0x2ccc('0x45')]){_0xd8f346[_0x2ccc('0x46')]=[{'all':!![]}];}return db[_0x2ccc('0x30')][_0x2ccc('0x47')](_0xd8f346);})['then'](function(_0x38eb5d){_0xaf0b36[_0x2ccc('0x48')]=_0x38eb5d;return _0xaf0b36;})[_0x2ccc('0x29')](respondWithFilteredResult(_0x44a706,_0xd8f346))['catch'](handleError(_0x44a706,null));};exports['show']=function(_0x293a,_0x34265a){var _0x520628={'raw':!![],'where':{'id':_0x293a[_0x2ccc('0x49')]['id']}},_0x4a1839={};_0x4a1839[_0x2ccc('0x35')]=_[_0x2ccc('0x37')](db[_0x2ccc('0x30')]['rawAttributes']);_0x4a1839[_0x2ccc('0x36')]=_[_0x2ccc('0x37')](_0x293a['query']);_0x4a1839['filters']=_[_0x2ccc('0x39')](_0x4a1839[_0x2ccc('0x35')],_0x4a1839[_0x2ccc('0x36')]);_0x520628[_0x2ccc('0x3b')]=_[_0x2ccc('0x39')](_0x4a1839[_0x2ccc('0x35')],qs[_0x2ccc('0x3a')](_0x293a[_0x2ccc('0x36')][_0x2ccc('0x3a')]));_0x520628[_0x2ccc('0x3b')]=_0x520628['attributes'][_0x2ccc('0x3c')]?_0x520628[_0x2ccc('0x3b')]:_0x4a1839[_0x2ccc('0x35')];if(_0x293a[_0x2ccc('0x36')][_0x2ccc('0x45')]){_0x520628[_0x2ccc('0x46')]=[{'all':!![]}];}_0x520628=_[_0x2ccc('0x43')]({},_0x520628,_0x293a[_0x2ccc('0x4a')]);return db[_0x2ccc('0x30')][_0x2ccc('0x4b')](_0x520628)[_0x2ccc('0x29')](handleEntityNotFound(_0x34265a,null))['then'](respondWithResult(_0x34265a,null))[_0x2ccc('0x4c')](handleError(_0x34265a,null));};exports['create']=function(_0xf9b644,_0x4df770){return db['Dynamics365Field'][_0x2ccc('0x4d')](_0xf9b644['body'],{})['then'](respondWithResult(_0x4df770,0xc9))[_0x2ccc('0x4c')](handleError(_0x4df770,null));};exports['update']=function(_0x39394c,_0x490d78){if(_0x39394c['body']['id']){delete _0x39394c[_0x2ccc('0x4e')]['id'];}return db[_0x2ccc('0x30')]['find']({'where':{'id':_0x39394c[_0x2ccc('0x49')]['id']}})[_0x2ccc('0x29')](handleEntityNotFound(_0x490d78,null))[_0x2ccc('0x29')](saveUpdates(_0x39394c['body'],null))[_0x2ccc('0x29')](respondWithResult(_0x490d78,null))['catch'](handleError(_0x490d78,null));};exports[_0x2ccc('0x4f')]=function(_0x22b923,_0x2b3551){return db[_0x2ccc('0x30')][_0x2ccc('0x4b')]({'where':{'id':_0x22b923['params']['id']}})[_0x2ccc('0x29')](handleEntityNotFound(_0x2b3551,null))[_0x2ccc('0x29')](removeEntity(_0x2b3551,null))[_0x2ccc('0x4c')](handleError(_0x2b3551,null));}; \ No newline at end of file +var _0x17bb=['filter','merge','VIRTUAL','options','where','count','include','findAll','catch','keys','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','status','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','Dynamics365Field','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','length','sort','filters'];(function(_0x115352,_0x2e3978){var _0xfb3af7=function(_0x2250ba){while(--_0x2250ba){_0x115352['push'](_0x115352['shift']());}};_0xfb3af7(++_0x2e3978);}(_0x17bb,0x1b8));var _0xb17b=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x17bb[_0xfae23b];return _0x200640;};'use strict';var pdf=require(_0xb17b('0x0'));var emlformat=require(_0xb17b('0x1'));var rimraf=require(_0xb17b('0x2'));var zipdir=require(_0xb17b('0x3'));var jsonpatch=require(_0xb17b('0x4'));var rp=require(_0xb17b('0x5'));var moment=require(_0xb17b('0x6'));var BPromise=require(_0xb17b('0x7'));var Mustache=require(_0xb17b('0x8'));var util=require(_0xb17b('0x9'));var path=require(_0xb17b('0xa'));var sox=require(_0xb17b('0xb'));var csv=require(_0xb17b('0xc'));var ejs=require(_0xb17b('0xd'));var fs=require('fs');var _=require(_0xb17b('0xe'));var squel=require(_0xb17b('0xf'));var crypto=require(_0xb17b('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xb17b('0x11'));var toCsv=require(_0xb17b('0xc'));var querystring=require(_0xb17b('0x12'));var Papa=require('papaparse');var Redis=require(_0xb17b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb17b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb17b('0x15'));var logger=require(_0xb17b('0x16'))(_0xb17b('0x17'));var utils=require(_0xb17b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb17b('0x19'));var db=require(_0xb17b('0x1a'))['db'];function respondWithStatusCode(_0x57b088,_0x1eb44f){_0x1eb44f=_0x1eb44f||0xcc;return function(_0x3f678f){if(_0x3f678f){return _0x57b088[_0xb17b('0x1b')](_0x1eb44f);}return _0x57b088['status'](_0x1eb44f)[_0xb17b('0x1c')]();};}function respondWithResult(_0x1738cd,_0x16d8b6){_0x16d8b6=_0x16d8b6||0xc8;return function(_0x3447a0){if(_0x3447a0){return _0x1738cd['status'](_0x16d8b6)[_0xb17b('0x1d')](_0x3447a0);}};}function respondWithFilteredResult(_0x1763bd,_0x2c455b){return function(_0x4f18c4){if(_0x4f18c4){var _0x4f8391=_0x4f18c4['count'],_0x4e80a7=_0x2c455b[_0xb17b('0x1e')],_0x34189c=_0x2c455b[_0xb17b('0x1e')]+_0x2c455b[_0xb17b('0x1f')],_0x1169e4;if(_0x34189c>=_0x4f8391){_0x34189c=_0x4f8391;_0x1169e4=0xc8;}else{_0x1169e4=0xce;}_0x1763bd[_0xb17b('0x20')](_0x1169e4);return _0x1763bd['set'](_0xb17b('0x21'),_0x4e80a7+'-'+_0x34189c+'/'+_0x4f8391)[_0xb17b('0x1d')](_0x4f18c4);}return null;};}function patchUpdates(_0x4a6686){return function(_0x23733f){try{jsonpatch[_0xb17b('0x22')](_0x23733f,_0x4a6686,!![]);}catch(_0x58ce5b){return BPromise[_0xb17b('0x23')](_0x58ce5b);}return _0x23733f[_0xb17b('0x24')]();};}function saveUpdates(_0x428959,_0x101daa){return function(_0x2c5d15){if(_0x2c5d15){return _0x2c5d15[_0xb17b('0x25')](_0x428959)[_0xb17b('0x26')](function(_0x547d26){return _0x547d26;});}return null;};}function removeEntity(_0x3ebbe7,_0x3c2389){return function(_0x4edc29){if(_0x4edc29){return _0x4edc29[_0xb17b('0x27')]()['then'](function(){_0x3ebbe7[_0xb17b('0x20')](0xcc)[_0xb17b('0x1c')]();});}};}function handleEntityNotFound(_0x21f8ec,_0x408013){return function(_0x8cbd09){if(!_0x8cbd09){_0x21f8ec[_0xb17b('0x1b')](0x194);}return _0x8cbd09;};}function handleError(_0x3d8e73,_0x1d4086){_0x1d4086=_0x1d4086||0x1f4;return function(_0x2a890a){logger[_0xb17b('0x28')](_0x2a890a[_0xb17b('0x29')]);if(_0x2a890a[_0xb17b('0x2a')]){delete _0x2a890a[_0xb17b('0x2a')];}_0x3d8e73[_0xb17b('0x20')](_0x1d4086)[_0xb17b('0x2b')](_0x2a890a);};}exports['index']=function(_0x1a1c46,_0x26f1a1){var _0x2c16fe={},_0x982f95={},_0x644dae={'count':0x0,'rows':[]};var _0x114728=_[_0xb17b('0x2c')](db[_0xb17b('0x2d')][_0xb17b('0x2e')],function(_0x2ee04e){return{'name':_0x2ee04e[_0xb17b('0x2f')],'type':_0x2ee04e[_0xb17b('0x30')]['key']};});_0x982f95[_0xb17b('0x31')]=_[_0xb17b('0x2c')](_0x114728,_0xb17b('0x2a'));_0x982f95[_0xb17b('0x32')]=_['keys'](_0x1a1c46[_0xb17b('0x32')]);_0x982f95['filters']=_['intersection'](_0x982f95[_0xb17b('0x31')],_0x982f95[_0xb17b('0x32')]);_0x2c16fe[_0xb17b('0x33')]=_[_0xb17b('0x34')](_0x982f95[_0xb17b('0x31')],qs[_0xb17b('0x35')](_0x1a1c46[_0xb17b('0x32')][_0xb17b('0x35')]));_0x2c16fe[_0xb17b('0x33')]=_0x2c16fe[_0xb17b('0x33')][_0xb17b('0x36')]?_0x2c16fe[_0xb17b('0x33')]:_0x982f95[_0xb17b('0x31')];if(!_0x1a1c46[_0xb17b('0x32')]['hasOwnProperty']('nolimit')){_0x2c16fe[_0xb17b('0x1f')]=qs[_0xb17b('0x1f')](_0x1a1c46[_0xb17b('0x32')]['limit']);_0x2c16fe[_0xb17b('0x1e')]=qs[_0xb17b('0x1e')](_0x1a1c46[_0xb17b('0x32')][_0xb17b('0x1e')]);}_0x2c16fe['order']=qs[_0xb17b('0x37')](_0x1a1c46['query'][_0xb17b('0x37')]);_0x2c16fe['where']=qs['filters'](_['pick'](_0x1a1c46[_0xb17b('0x32')],_0x982f95[_0xb17b('0x38')]),_0x114728);if(_0x1a1c46[_0xb17b('0x32')][_0xb17b('0x39')]){_0x2c16fe['where']=_[_0xb17b('0x3a')](_0x2c16fe['where'],{'$or':_[_0xb17b('0x2c')](_0x114728,function(_0x1e7c3e){if(_0x1e7c3e[_0xb17b('0x30')]!==_0xb17b('0x3b')){var _0x3ecd1b={};_0x3ecd1b[_0x1e7c3e['name']]={'$like':'%'+_0x1a1c46[_0xb17b('0x32')][_0xb17b('0x39')]+'%'};return _0x3ecd1b;}})});}_0x2c16fe=_[_0xb17b('0x3a')]({},_0x2c16fe,_0x1a1c46[_0xb17b('0x3c')]);var _0x39dded={'where':_0x2c16fe[_0xb17b('0x3d')]};return db[_0xb17b('0x2d')][_0xb17b('0x3e')](_0x39dded)[_0xb17b('0x26')](function(_0x4d813d){_0x644dae[_0xb17b('0x3e')]=_0x4d813d;if(_0x1a1c46[_0xb17b('0x32')]['includeAll']){_0x2c16fe[_0xb17b('0x3f')]=[{'all':!![]}];}return db['Dynamics365Field'][_0xb17b('0x40')](_0x2c16fe);})['then'](function(_0x227f4f){_0x644dae['rows']=_0x227f4f;return _0x644dae;})['then'](respondWithFilteredResult(_0x26f1a1,_0x2c16fe))[_0xb17b('0x41')](handleError(_0x26f1a1,null));};exports['show']=function(_0x343f05,_0x121ddf){var _0x539f68={'raw':!![],'where':{'id':_0x343f05['params']['id']}},_0x5aa662={};_0x5aa662[_0xb17b('0x31')]=_[_0xb17b('0x42')](db['Dynamics365Field'][_0xb17b('0x2e')]);_0x5aa662[_0xb17b('0x32')]=_['keys'](_0x343f05[_0xb17b('0x32')]);_0x5aa662[_0xb17b('0x38')]=_[_0xb17b('0x34')](_0x5aa662[_0xb17b('0x31')],_0x5aa662[_0xb17b('0x32')]);_0x539f68['attributes']=_[_0xb17b('0x34')](_0x5aa662[_0xb17b('0x31')],qs[_0xb17b('0x35')](_0x343f05[_0xb17b('0x32')][_0xb17b('0x35')]));_0x539f68[_0xb17b('0x33')]=_0x539f68['attributes']['length']?_0x539f68[_0xb17b('0x33')]:_0x5aa662['model'];if(_0x343f05[_0xb17b('0x32')]['includeAll']){_0x539f68[_0xb17b('0x3f')]=[{'all':!![]}];}_0x539f68=_['merge']({},_0x539f68,_0x343f05[_0xb17b('0x3c')]);return db[_0xb17b('0x2d')][_0xb17b('0x43')](_0x539f68)[_0xb17b('0x26')](handleEntityNotFound(_0x121ddf,null))[_0xb17b('0x26')](respondWithResult(_0x121ddf,null))['catch'](handleError(_0x121ddf,null));};exports[_0xb17b('0x44')]=function(_0x510e35,_0x5eaecf){return db['Dynamics365Field'][_0xb17b('0x44')](_0x510e35[_0xb17b('0x45')],{})['then'](respondWithResult(_0x5eaecf,0xc9))[_0xb17b('0x41')](handleError(_0x5eaecf,null));};exports[_0xb17b('0x25')]=function(_0x5513b2,_0x1b831e){if(_0x5513b2[_0xb17b('0x45')]['id']){delete _0x5513b2[_0xb17b('0x45')]['id'];}return db[_0xb17b('0x2d')][_0xb17b('0x43')]({'where':{'id':_0x5513b2[_0xb17b('0x46')]['id']}})[_0xb17b('0x26')](handleEntityNotFound(_0x1b831e,null))[_0xb17b('0x26')](saveUpdates(_0x5513b2[_0xb17b('0x45')],null))['then'](respondWithResult(_0x1b831e,null))[_0xb17b('0x41')](handleError(_0x1b831e,null));};exports[_0xb17b('0x27')]=function(_0x343333,_0x402491){return db[_0xb17b('0x2d')][_0xb17b('0x43')]({'where':{'id':_0x343333[_0xb17b('0x46')]['id']}})[_0xb17b('0x26')](handleEntityNotFound(_0x402491,null))[_0xb17b('0x26')](removeEntity(_0x402491,null))[_0xb17b('0x41')](handleError(_0x402491,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 03ec940..7648691 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 _0xd8c0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField'];(function(_0x2de740,_0x5bbd67){var _0xf2f74c=function(_0x25d677){while(--_0x25d677){_0x2de740['push'](_0x2de740['shift']());}};_0xf2f74c(++_0x5bbd67);}(_0xd8c0,0x1ad));var _0x0d8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd8c0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0d8c('0x0'))(_0x0d8c('0x1'));var moment=require(_0x0d8c('0x2'));var BPromise=require(_0x0d8c('0x3'));var rp=require(_0x0d8c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0d8c('0x5'));var config=require(_0x0d8c('0x6'));var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x190e90,_0x4aca2a){return _0x190e90['define'](_0x0d8c('0x7'),attributes,{'tableName':_0x0d8c('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8c('0x9'),'fields':[_0x0d8c('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4f4c=['api','moment','bluebird','request-promise','../../config/environment','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','../../config/logger'];(function(_0x2a9051,_0x23c875){var _0xf5fcf8=function(_0x1ef66f){while(--_0x1ef66f){_0x2a9051['push'](_0x2a9051['shift']());}};_0xf5fcf8(++_0x23c875);}(_0x4f4c,0x8a));var _0xc4f4=function(_0x4b9652,_0x1aadc0){_0x4b9652=_0x4b9652-0x0;var _0x321e2a=_0x4f4c[_0x4b9652];return _0x321e2a;};'use strict';var _=require(_0xc4f4('0x0'));var util=require('util');var logger=require(_0xc4f4('0x1'))(_0xc4f4('0x2'));var moment=require(_0xc4f4('0x3'));var BPromise=require(_0xc4f4('0x4'));var rp=require(_0xc4f4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc4f4('0x6'));var attributes=require('./intDynamics365Field.attributes');module[_0xc4f4('0x7')]=function(_0x5179ce,_0x5d0199){return _0x5179ce[_0xc4f4('0x8')](_0xc4f4('0x9'),attributes,{'tableName':_0xc4f4('0xa'),'paranoid':![],'indexes':[{'name':_0xc4f4('0xb'),'fields':[_0xc4f4('0xc'),_0xc4f4('0xd')],'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 213ab8d..fd1d423 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 _0x7a54=['info','Dynamics365Field,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x36f6df,_0x559959){_0x36f6df=_0x36f6df-0x0;var _0x542d66=_0x7a54[_0x36f6df];return _0x542d66;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9206=['randomstring','ioredis','../../config/logger','rpc','client','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9206,0x176));var _0x6920=function(_0x484339,_0xe822fe){_0x484339=_0x484339-0x0;var _0x1727af=_0x9206[_0x484339];return _0x1727af;};'use strict';var _=require(_0x6920('0x0'));var util=require(_0x6920('0x1'));var moment=require(_0x6920('0x2'));var BPromise=require(_0x6920('0x3'));var rs=require(_0x6920('0x4'));var fs=require('fs');var Redis=require(_0x6920('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6920('0x6'))(_0x6920('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6920('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21fb21,_0x31966d,_0x2aad51){return new BPromise(function(_0xef5d38,_0x56bb75){return client['request'](_0x21fb21,_0x2aad51)[_0x6920('0x9')](function(_0xc578c6){logger[_0x6920('0xa')](_0x6920('0xb'),_0x31966d,_0x6920('0xc'));logger[_0x6920('0xd')](_0x6920('0xe'),_0x31966d,_0x6920('0xc'),JSON[_0x6920('0xf')](_0xc578c6));if(_0xc578c6[_0x6920('0x10')]){if(_0xc578c6[_0x6920('0x10')][_0x6920('0x11')]===0x1f4){logger[_0x6920('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x31966d,_0xc578c6['error'][_0x6920('0x12')]);return _0x56bb75(_0xc578c6[_0x6920('0x10')]['message']);}logger[_0x6920('0x10')](_0x6920('0xb'),_0x31966d,_0xc578c6[_0x6920('0x10')][_0x6920('0x12')]);return _0xef5d38(_0xc578c6[_0x6920('0x10')]['message']);}else{logger[_0x6920('0xa')](_0x6920('0xb'),_0x31966d,_0x6920('0xc'));_0xef5d38(_0xc578c6[_0x6920('0x13')][_0x6920('0x12')]);}})[_0x6920('0x14')](function(_0x3452a4){logger[_0x6920('0x10')](_0x6920('0xb'),_0x31966d,_0x3452a4);_0x56bb75(_0x3452a4);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 697b566..14165a2 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 _0x548a=['exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','update'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x548a,0x1cf));var _0xa548=function(_0x3debe0,_0x5ee010){_0x3debe0=_0x3debe0-0x0;var _0x5167c9=_0x548a[_0x3debe0];return _0x5167c9;};'use strict';var multer=require(_0xa548('0x0'));var util=require('util');var path=require(_0xa548('0x1'));var timeout=require(_0xa548('0x2'));var express=require('express');var router=express[_0xa548('0x3')]();var auth=require(_0xa548('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa548('0x5'));var controller=require(_0xa548('0x6'));router[_0xa548('0x7')]('/',auth[_0xa548('0x8')](),controller[_0xa548('0x9')]);router[_0xa548('0x7')](_0xa548('0xa'),auth['isAuthenticated'](),controller[_0xa548('0xb')]);router[_0xa548('0x7')]('/:id/configurations',auth[_0xa548('0x8')](),controller[_0xa548('0xc')]);router['get'](_0xa548('0xd'),auth[_0xa548('0x8')](),controller[_0xa548('0xe')]);router[_0xa548('0xf')]('/',auth[_0xa548('0x8')](),controller[_0xa548('0x10')]);router['post'](_0xa548('0x11'),auth[_0xa548('0x8')](),controller['addConfiguration']);router[_0xa548('0x12')](_0xa548('0xa'),auth[_0xa548('0x8')](),controller[_0xa548('0x13')]);router['delete'](_0xa548('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xa548('0x14')]=router; \ No newline at end of file +var _0xff5d=['express','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','path'];(function(_0x1be16d,_0x2b3bbe){var _0x15f44b=function(_0x4213b7){while(--_0x4213b7){_0x1be16d['push'](_0x1be16d['shift']());}};_0x15f44b(++_0x2b3bbe);}(_0xff5d,0x18d));var _0xdff5=function(_0x346070,_0x4e6905){_0x346070=_0x346070-0x0;var _0x1c4c45=_0xff5d[_0x346070];return _0x1c4c45;};'use strict';var multer=require(_0xdff5('0x0'));var util=require('util');var path=require(_0xdff5('0x1'));var timeout=require('connect-timeout');var express=require(_0xdff5('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xdff5('0x3'));var config=require(_0xdff5('0x4'));var controller=require(_0xdff5('0x5'));router[_0xdff5('0x6')]('/',auth[_0xdff5('0x7')](),controller['index']);router['get'](_0xdff5('0x8'),auth[_0xdff5('0x7')](),controller[_0xdff5('0x9')]);router[_0xdff5('0x6')](_0xdff5('0xa'),auth[_0xdff5('0x7')](),controller[_0xdff5('0xb')]);router[_0xdff5('0x6')](_0xdff5('0xc'),auth[_0xdff5('0x7')](),controller['getFields']);router['post']('/',auth[_0xdff5('0x7')](),controller[_0xdff5('0xd')]);router[_0xdff5('0xe')](_0xdff5('0xa'),auth[_0xdff5('0x7')](),controller[_0xdff5('0xf')]);router[_0xdff5('0x10')](_0xdff5('0x8'),auth[_0xdff5('0x7')](),controller[_0xdff5('0x11')]);router[_0xdff5('0x12')](_0xdff5('0x8'),auth[_0xdff5('0x7')](),controller[_0xdff5('0x13')]);module[_0xdff5('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 27d9018..cd9a343 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 _0xdd13=['STRING','username'];(function(_0xa25b89,_0x91701c){var _0x1359ab=function(_0x3c2822){while(--_0x3c2822){_0xa25b89['push'](_0xa25b89['shift']());}};_0x1359ab(++_0x91701c);}(_0xdd13,0x19c));var _0x3dd1=function(_0x352545,_0x4847c5){_0x352545=_0x352545-0x0;var _0x5c7f0c=_0xdd13[_0x352545];return _0x5c7f0c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3dd1('0x0')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x3dd1('0x1')},'apiKey':{'type':Sequelize[_0x3dd1('0x0')]},'remoteUri':{'type':Sequelize[_0x3dd1('0x0')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x3dd1('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x1cbe=['STRING','username','remoteUri','exports'];(function(_0x2f55ff,_0x34e3b1){var _0x3f6f0e=function(_0x8d780c){while(--_0x8d780c){_0x2f55ff['push'](_0x2f55ff['shift']());}};_0x3f6f0e(++_0x34e3b1);}(_0x1cbe,0xaf));var _0xe1cb=function(_0x3e2316,_0x18d42d){_0x3e2316=_0x3e2316-0x0;var _0xb3ed9a=_0x1cbe[_0x3e2316];return _0xb3ed9a;};'use strict';var Sequelize=require('sequelize');module[_0xe1cb('0x0')]={'name':{'type':Sequelize[_0xe1cb('0x1')]},'description':{'type':Sequelize[_0xe1cb('0x1')]},'username':{'type':Sequelize[_0xe1cb('0x1')],'unique':_0xe1cb('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xe1cb('0x3')},'serverUrl':{'type':Sequelize[_0xe1cb('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 fb0c6bc..79886af 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 _0xf065=['sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','length','find','body','findOne','FreshdeskConfiguration','getConfigurations','getSubjects','Descriptions','getDescriptions','create','FreshdeskField','Subjects','remoteUri','slice','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','%s:X','apiKey','toString','subject','description','priority','source','ticket_type','group','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','test','html-pdf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','end','sendStatus','stack','name','send','index','FreshdeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x2bc752,_0x581f5e){var _0x4c1596=function(_0x15c3b4){while(--_0x15c3b4){_0x2bc752['push'](_0x2bc752['shift']());}};_0x4c1596(++_0x581f5e);}(_0xf065,0xad));var _0x5f06=function(_0x7f58af,_0x5787cc){_0x7f58af=_0x7f58af-0x0;var _0x47f99d=_0xf065[_0x7f58af];return _0x47f99d;};'use strict';var pdf=require(_0x5f06('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5f06('0x1'));var moment=require(_0x5f06('0x2'));var BPromise=require(_0x5f06('0x3'));var Mustache=require(_0x5f06('0x4'));var util=require(_0x5f06('0x5'));var path=require(_0x5f06('0x6'));var sox=require(_0x5f06('0x7'));var csv=require(_0x5f06('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5f06('0x9'));var crypto=require(_0x5f06('0xa'));var jsforce=require(_0x5f06('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5f06('0x8'));var querystring=require('querystring');var Papa=require(_0x5f06('0xc'));var Redis=require(_0x5f06('0xd'));var authService=require(_0x5f06('0xe'));var qs=require(_0x5f06('0xf'));var as=require(_0x5f06('0x10'));var hardwareService=require(_0x5f06('0x11'));var logger=require(_0x5f06('0x12'))(_0x5f06('0x13'));var utils=require(_0x5f06('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5f06('0x15'))['db'];var integrations=require(_0x5f06('0x16'));var jayson=require(_0x5f06('0x17'));var client=jayson[_0x5f06('0x18')][_0x5f06('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3b2f11,_0x3dec7b,_0x30a053,_0x314e4b){return new BPromise(function(_0x24c901,_0x276b16){var _0x291296=_0x314e4b||client;return _0x291296[_0x5f06('0x1a')](_0x3b2f11,_0x30a053)[_0x5f06('0x1b')](function(_0x1f13c4){logger[_0x5f06('0x1c')]('FreshdeskAccount,\x20%s,\x20%s',_0x3dec7b,'request\x20sent');logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x3dec7b,_0x5f06('0x1d'),JSON[_0x5f06('0x1e')](_0x1f13c4));if(_0x1f13c4[_0x5f06('0x1f')]){if(_0x1f13c4[_0x5f06('0x1f')][_0x5f06('0x20')]===0x1f4){logger[_0x5f06('0x1f')](_0x5f06('0x21'),_0x3dec7b,_0x1f13c4[_0x5f06('0x1f')]['message']);return _0x276b16(_0x1f13c4[_0x5f06('0x1f')][_0x5f06('0x22')]);}logger[_0x5f06('0x1f')](_0x5f06('0x21'),_0x3dec7b,_0x1f13c4[_0x5f06('0x1f')][_0x5f06('0x22')]);return _0x24c901(_0x1f13c4[_0x5f06('0x1f')][_0x5f06('0x22')]);}else{logger[_0x5f06('0x1c')](_0x5f06('0x21'),_0x3dec7b,'request\x20sent');_0x24c901(_0x1f13c4[_0x5f06('0x23')]['message']);}})[_0x5f06('0x24')](function(_0x2581da){logger[_0x5f06('0x1f')](_0x5f06('0x21'),_0x3dec7b,_0x2581da);_0x276b16(_0x2581da);});});}function respondWithStatusCode(_0x3da4c7,_0x338a27){_0x338a27=_0x338a27||0xcc;return function(_0x5a40ad){if(_0x5a40ad){return _0x3da4c7['sendStatus'](_0x338a27);}return _0x3da4c7['status'](_0x338a27)['end']();};}function respondWithResult(_0x21b04f,_0x3f6155){_0x3f6155=_0x3f6155||0xc8;return function(_0x52f01a){if(_0x52f01a){return _0x21b04f[_0x5f06('0x25')](_0x3f6155)[_0x5f06('0x26')](_0x52f01a);}};}function respondWithFilteredResult(_0x2f4eac,_0xf9af2c){return function(_0x2bd9f1){if(_0x2bd9f1){var _0x130f96=_0x2bd9f1[_0x5f06('0x27')],_0x3f156c=_0xf9af2c[_0x5f06('0x28')],_0x58f248=_0xf9af2c[_0x5f06('0x28')]+_0xf9af2c[_0x5f06('0x29')],_0xd43803;if(_0x58f248>=_0x130f96){_0x58f248=_0x130f96;_0xd43803=0xc8;}else{_0xd43803=0xce;}_0x2f4eac[_0x5f06('0x25')](_0xd43803);return _0x2f4eac[_0x5f06('0x2a')](_0x5f06('0x2b'),_0x3f156c+'-'+_0x58f248+'/'+_0x130f96)[_0x5f06('0x26')](_0x2bd9f1);}return null;};}function patchUpdates(_0x39adf2){return function(_0x459037){try{jsonpatch[_0x5f06('0x2c')](_0x459037,_0x39adf2,!![]);}catch(_0xe7e321){return BPromise['reject'](_0xe7e321);}return _0x459037[_0x5f06('0x2d')]();};}function saveUpdates(_0x1da3be,_0x563c9b){return function(_0x22183a){if(_0x22183a){return _0x22183a[_0x5f06('0x2e')](_0x1da3be)[_0x5f06('0x1b')](function(_0x5a36ad){return _0x5a36ad;});}return null;};}function removeEntity(_0x496eb1,_0x23c88b){return function(_0x38e195){if(_0x38e195){return _0x38e195[_0x5f06('0x2f')]()[_0x5f06('0x1b')](function(){_0x496eb1[_0x5f06('0x25')](0xcc)[_0x5f06('0x30')]();});}};}function handleEntityNotFound(_0x15dcd9,_0x360b3e){return function(_0x1bb94b){if(!_0x1bb94b){_0x15dcd9[_0x5f06('0x31')](0x194);}return _0x1bb94b;};}function handleError(_0x3078f2,_0x37f53a){_0x37f53a=_0x37f53a||0x1f4;return function(_0x596e13){logger[_0x5f06('0x1f')](_0x596e13[_0x5f06('0x32')]);if(_0x596e13[_0x5f06('0x33')]){delete _0x596e13['name'];}_0x3078f2[_0x5f06('0x25')](_0x37f53a)[_0x5f06('0x34')](_0x596e13);};}exports[_0x5f06('0x35')]=function(_0x6cf973,_0x859ac4){var _0x3f7f1d={},_0x49cbfd={},_0x3e4d68={'count':0x0,'rows':[]};var _0x4105c4=_['map'](db[_0x5f06('0x36')][_0x5f06('0x37')],function(_0x5879ea){return{'name':_0x5879ea[_0x5f06('0x38')],'type':_0x5879ea[_0x5f06('0x39')][_0x5f06('0x3a')]};});_0x49cbfd[_0x5f06('0x3b')]=_[_0x5f06('0x3c')](_0x4105c4,_0x5f06('0x33'));_0x49cbfd[_0x5f06('0x3d')]=_[_0x5f06('0x3e')](_0x6cf973[_0x5f06('0x3d')]);_0x49cbfd[_0x5f06('0x3f')]=_[_0x5f06('0x40')](_0x49cbfd[_0x5f06('0x3b')],_0x49cbfd[_0x5f06('0x3d')]);_0x3f7f1d[_0x5f06('0x41')]=_['intersection'](_0x49cbfd[_0x5f06('0x3b')],qs['fields'](_0x6cf973['query'][_0x5f06('0x42')]));_0x3f7f1d[_0x5f06('0x41')]=_0x3f7f1d[_0x5f06('0x41')]['length']?_0x3f7f1d[_0x5f06('0x41')]:_0x49cbfd[_0x5f06('0x3b')];if(!_0x6cf973['query'][_0x5f06('0x43')](_0x5f06('0x44'))){_0x3f7f1d[_0x5f06('0x29')]=qs['limit'](_0x6cf973['query'][_0x5f06('0x29')]);_0x3f7f1d['offset']=qs['offset'](_0x6cf973[_0x5f06('0x3d')][_0x5f06('0x28')]);}_0x3f7f1d['order']=qs[_0x5f06('0x45')](_0x6cf973[_0x5f06('0x3d')][_0x5f06('0x45')]);_0x3f7f1d[_0x5f06('0x46')]=qs['filters'](_['pick'](_0x6cf973[_0x5f06('0x3d')],_0x49cbfd[_0x5f06('0x3f')]),_0x4105c4);if(_0x6cf973['query'][_0x5f06('0x47')]){_0x3f7f1d[_0x5f06('0x46')]=_[_0x5f06('0x48')](_0x3f7f1d[_0x5f06('0x46')],{'$or':_[_0x5f06('0x3c')](_0x4105c4,function(_0x21b2db){if(_0x21b2db[_0x5f06('0x39')]!=='VIRTUAL'){var _0x68a502={};_0x68a502[_0x21b2db[_0x5f06('0x33')]]={'$like':'%'+_0x6cf973['query'][_0x5f06('0x47')]+'%'};return _0x68a502;}})});}_0x3f7f1d=_[_0x5f06('0x48')]({},_0x3f7f1d,_0x6cf973[_0x5f06('0x49')]);var _0x4b3df6={'where':_0x3f7f1d['where']};return db[_0x5f06('0x36')][_0x5f06('0x27')](_0x4b3df6)[_0x5f06('0x1b')](function(_0x1c316e){_0x3e4d68[_0x5f06('0x27')]=_0x1c316e;if(_0x6cf973[_0x5f06('0x3d')][_0x5f06('0x4a')]){_0x3f7f1d[_0x5f06('0x4b')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x5f06('0x4c')](_0x3f7f1d);})['then'](function(_0xc20888){_0x3e4d68[_0x5f06('0x4d')]=_0xc20888;return _0x3e4d68;})[_0x5f06('0x1b')](respondWithFilteredResult(_0x859ac4,_0x3f7f1d))[_0x5f06('0x24')](handleError(_0x859ac4,null));};exports[_0x5f06('0x4e')]=function(_0x550039,_0x43f09d){var _0xf97aba={'raw':![],'where':{'id':_0x550039[_0x5f06('0x4f')]['id']}},_0x3dcbde={};_0x3dcbde['model']=_['keys'](db['FreshdeskAccount'][_0x5f06('0x37')]);_0x3dcbde[_0x5f06('0x3d')]=_[_0x5f06('0x3e')](_0x550039[_0x5f06('0x3d')]);_0x3dcbde[_0x5f06('0x3f')]=_[_0x5f06('0x40')](_0x3dcbde['model'],_0x3dcbde[_0x5f06('0x3d')]);_0xf97aba[_0x5f06('0x41')]=_[_0x5f06('0x40')](_0x3dcbde[_0x5f06('0x3b')],qs[_0x5f06('0x42')](_0x550039[_0x5f06('0x3d')]['fields']));_0xf97aba[_0x5f06('0x41')]=_0xf97aba[_0x5f06('0x41')][_0x5f06('0x50')]?_0xf97aba[_0x5f06('0x41')]:_0x3dcbde[_0x5f06('0x3b')];if(_0x550039['query'][_0x5f06('0x4a')]){_0xf97aba[_0x5f06('0x4b')]=[{'all':!![]}];}_0xf97aba=_['merge']({},_0xf97aba,_0x550039[_0x5f06('0x49')]);return db['FreshdeskAccount'][_0x5f06('0x51')](_0xf97aba)[_0x5f06('0x1b')](handleEntityNotFound(_0x43f09d,null))[_0x5f06('0x1b')](respondWithResult(_0x43f09d,null))['catch'](handleError(_0x43f09d,null));};exports['create']=function(_0x3ce812,_0x5ded06){return db[_0x5f06('0x36')]['create'](_0x3ce812[_0x5f06('0x52')],{})[_0x5f06('0x1b')](respondWithResult(_0x5ded06,0xc9))[_0x5f06('0x24')](handleError(_0x5ded06,null));};exports[_0x5f06('0x2e')]=function(_0x3de262,_0x12abd4){if(_0x3de262[_0x5f06('0x52')]['id']){delete _0x3de262[_0x5f06('0x52')]['id'];}return db[_0x5f06('0x36')]['find']({'where':{'id':_0x3de262[_0x5f06('0x4f')]['id']}})[_0x5f06('0x1b')](handleEntityNotFound(_0x12abd4,null))[_0x5f06('0x1b')](saveUpdates(_0x3de262[_0x5f06('0x52')],null))[_0x5f06('0x1b')](respondWithResult(_0x12abd4,null))[_0x5f06('0x24')](handleError(_0x12abd4,null));};exports['destroy']=function(_0x2e2762,_0x38044c){return db[_0x5f06('0x36')][_0x5f06('0x51')]({'where':{'id':_0x2e2762[_0x5f06('0x4f')]['id']}})[_0x5f06('0x1b')](handleEntityNotFound(_0x38044c,null))[_0x5f06('0x1b')](removeEntity(_0x38044c,null))[_0x5f06('0x24')](handleError(_0x38044c,null));};exports['getConfigurations']=function(_0x25f451,_0x4fa53d,_0x4e9b33){var _0x2f8f2d={};var _0xe0323={};var _0x2b73f7;var _0x36fed3;return db['FreshdeskAccount'][_0x5f06('0x53')]({'where':{'id':_0x25f451['params']['id']}})[_0x5f06('0x1b')](handleEntityNotFound(_0x4fa53d,null))['then'](function(_0x2e39d8){if(_0x2e39d8){_0x2b73f7=_0x2e39d8;_0xe0323[_0x5f06('0x3b')]=_['keys'](db[_0x5f06('0x54')][_0x5f06('0x37')]);_0xe0323[_0x5f06('0x3d')]=_[_0x5f06('0x3e')](_0x25f451[_0x5f06('0x3d')]);_0xe0323['filters']=_['intersection'](_0xe0323[_0x5f06('0x3b')],_0xe0323[_0x5f06('0x3d')]);_0x2f8f2d[_0x5f06('0x41')]=_[_0x5f06('0x40')](_0xe0323[_0x5f06('0x3b')],qs['fields'](_0x25f451[_0x5f06('0x3d')][_0x5f06('0x42')]));_0x2f8f2d[_0x5f06('0x41')]=_0x2f8f2d['attributes'][_0x5f06('0x50')]?_0x2f8f2d['attributes']:_0xe0323[_0x5f06('0x3b')];_0x2f8f2d['order']=qs[_0x5f06('0x45')](_0x25f451[_0x5f06('0x3d')][_0x5f06('0x45')]);_0x2f8f2d[_0x5f06('0x46')]=qs[_0x5f06('0x3f')](_['pick'](_0x25f451['query'],_0xe0323['filters']));if(_0x25f451[_0x5f06('0x3d')][_0x5f06('0x47')]){_0x2f8f2d[_0x5f06('0x46')]=_['merge'](_0x2f8f2d['where'],{'$or':_[_0x5f06('0x3c')](_0x2f8f2d['attributes'],function(_0x3ade0a){var _0xef0272={};_0xef0272[_0x3ade0a]={'$like':'%'+_0x25f451[_0x5f06('0x3d')][_0x5f06('0x47')]+'%'};return _0xef0272;})});}_0x2f8f2d=_[_0x5f06('0x48')]({},_0x2f8f2d,_0x25f451[_0x5f06('0x49')]);return _0x2b73f7[_0x5f06('0x55')](_0x2f8f2d);}})[_0x5f06('0x1b')](function(_0x36db38){if(_0x36db38){_0x36fed3=_0x36db38[_0x5f06('0x50')];if(!_0x25f451[_0x5f06('0x3d')][_0x5f06('0x43')](_0x5f06('0x44'))){_0x2f8f2d[_0x5f06('0x29')]=qs[_0x5f06('0x29')](_0x25f451[_0x5f06('0x3d')][_0x5f06('0x29')]);_0x2f8f2d[_0x5f06('0x28')]=qs[_0x5f06('0x28')](_0x25f451[_0x5f06('0x3d')]['offset']);}return _0x2b73f7[_0x5f06('0x55')](_0x2f8f2d);}})['then'](function(_0x36872b){if(_0x36872b){return _0x36872b?{'count':_0x36fed3,'rows':_0x36872b}:null;}})[_0x5f06('0x1b')](respondWithResult(_0x4fa53d,null))[_0x5f06('0x24')](handleError(_0x4fa53d,null));};exports['addConfiguration']=function(_0x2b793f,_0x22f808,_0x3a18d6){if(_0x2b793f[_0x5f06('0x52')]['id']){delete _0x2b793f[_0x5f06('0x52')]['id'];}return db[_0x5f06('0x36')][_0x5f06('0x53')]({'where':{'id':_0x2b793f[_0x5f06('0x4f')]['id']}})[_0x5f06('0x1b')](handleEntityNotFound(_0x22f808,null))[_0x5f06('0x1b')](function(_0x589f61){if(_0x589f61){_0x2b793f['body']['AccountId']=_0x589f61['id'];_0x2b793f[_0x5f06('0x52')]['Subjects']=integrations[_0x5f06('0x56')](_0x2b793f[_0x5f06('0x52')]['channel'],_0x2b793f['body'][_0x5f06('0x39')]);_0x2b793f['body'][_0x5f06('0x57')]=integrations[_0x5f06('0x58')](_0x2b793f[_0x5f06('0x52')]['channel'],_0x2b793f[_0x5f06('0x52')][_0x5f06('0x39')]);return db[_0x5f06('0x54')][_0x5f06('0x59')](_0x2b793f['body'],{'include':[{'model':db[_0x5f06('0x5a')],'as':_0x5f06('0x5b')},{'model':db[_0x5f06('0x5a')],'as':_0x5f06('0x57')}]});}return null;})[_0x5f06('0x1b')](respondWithResult(_0x22f808,null))[_0x5f06('0x24')](handleError(_0x22f808,null));};exports['getFields']=function(_0x1beaeb,_0x30558b,_0x576abb){var _0x488cdd='';return db[_0x5f06('0x36')]['findOne']({'where':{'id':_0x1beaeb[_0x5f06('0x4f')]['id']},'attributes':['id',_0x5f06('0x5c'),'apiKey']})['then'](handleEntityNotFound(_0x30558b,null))[_0x5f06('0x1b')](function(_0x541b10){if(_0x541b10){_0x488cdd=_0x541b10['remoteUri'];var _0x2e3bfc=_0x488cdd[_0x5f06('0x5d')](-0x1);if(_0x2e3bfc==='/'){_0x488cdd=_0x488cdd[_0x5f06('0x5e')](0x0,_0x488cdd[_0x5f06('0x5f')](_0x2e3bfc));}return rp({'method':'GET','uri':util[_0x5f06('0x60')](_0x5f06('0x61'),_0x488cdd,_0x5f06('0x62')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0x5f06('0x63'),_0x541b10[_0x5f06('0x64')]))[_0x5f06('0x65')]('base64'))},'json':!![]});}})[_0x5f06('0x1b')](function(_0x4bfd70){if(_0x4bfd70){var _0x43e8d7=['requester',_0x5f06('0x66'),'agent',_0x5f06('0x67'),_0x5f06('0x25'),_0x5f06('0x68'),'group',_0x5f06('0x69'),_0x5f06('0x6a'),_0x5f06('0x6b'),_0x5f06('0x6c')];_[_0x5f06('0x6d')](_0x4bfd70,function(_0x50d4a3){return _0x43e8d7[_0x5f06('0x6e')](_0x50d4a3['name'])||!_0x50d4a3[_0x5f06('0x6f')]&&_0x50d4a3['type']!==_0x5f06('0x70')&&_0x50d4a3[_0x5f06('0x39')]!==_0x5f06('0x71');});return{'count':_0x4bfd70[_0x5f06('0x50')],'rows':_[_0x5f06('0x3c')](_0x4bfd70,function(_0x3d5c30){return{'id':_0x3d5c30[_0x5f06('0x33')],'name':_0x3d5c30[_0x5f06('0x72')],'custom':!_0x3d5c30[_0x5f06('0x6f')],'options':_0x3d5c30[_0x5f06('0x73')]?_[_0x5f06('0x3c')](_0x3d5c30[_0x5f06('0x73')],function(_0x2470f1){return{'name':_[_0x5f06('0x74')](_0x2470f1),'value':_0x2470f1};}):[]};})};}})[_0x5f06('0x1b')](respondWithResult(_0x30558b,null))[_0x5f06('0x24')](function(_0x574c3b){var _0xab957=_0x1beaeb['query']['test']?0x1f4:_0x574c3b[_0x5f06('0x75')]||0x1f4;logger[_0x5f06('0x1f')](_0x5f06('0x76'),_0x5f06('0x77'),_0xab957,JSON[_0x5f06('0x1e')](_0x574c3b));delete _0x574c3b[_0x5f06('0x33')];if(_0xab957===0x191){_0xab957=0x190;}_0x30558b[_0x5f06('0x25')](_0xab957)[_0x5f06('0x34')](_0x1beaeb['query'][_0x5f06('0x78')]?{'message':'Wrong\x20credentials','statusCode':_0x574c3b[_0x5f06('0x75')]}:_0x574c3b);});}; \ No newline at end of file +var _0x71f7=['count','offset','limit','reject','save','update','destroy','stack','name','index','FreshdeskAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','params','rawAttributes','find','create','body','findOne','FreshdeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','slice','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','base64','requester','agent','description','group','source','ticket_type','company','includes','default','custom_dropdown','label','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json'];(function(_0x4e1a49,_0x4da738){var _0x136aae=function(_0x3ffd93){while(--_0x3ffd93){_0x4e1a49['push'](_0x4e1a49['shift']());}};_0x136aae(++_0x4da738);}(_0x71f7,0x1b5));var _0x771f=function(_0xeede32,_0x31d674){_0xeede32=_0xeede32-0x0;var _0x39120d=_0x71f7[_0xeede32];return _0x39120d;};'use strict';var pdf=require(_0x771f('0x0'));var emlformat=require(_0x771f('0x1'));var rimraf=require(_0x771f('0x2'));var zipdir=require(_0x771f('0x3'));var jsonpatch=require(_0x771f('0x4'));var rp=require(_0x771f('0x5'));var moment=require(_0x771f('0x6'));var BPromise=require(_0x771f('0x7'));var Mustache=require(_0x771f('0x8'));var util=require('util');var path=require(_0x771f('0x9'));var sox=require(_0x771f('0xa'));var csv=require('to-csv');var ejs=require(_0x771f('0xb'));var fs=require('fs');var _=require(_0x771f('0xc'));var squel=require(_0x771f('0xd'));var crypto=require(_0x771f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x771f('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x771f('0x10'));var Redis=require('ioredis');var authService=require(_0x771f('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x771f('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x771f('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x771f('0x14'))['db'];var integrations=require(_0x771f('0x15'));var jayson=require(_0x771f('0x16'));var client=jayson['client'][_0x771f('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x322c08,_0x4767cc,_0x323571,_0x5c8dcc){return new BPromise(function(_0x5a3134,_0x33383d){var _0x2cd88b=_0x5c8dcc||client;return _0x2cd88b[_0x771f('0x18')](_0x322c08,_0x323571)[_0x771f('0x19')](function(_0xabf9df){logger[_0x771f('0x1a')](_0x771f('0x1b'),_0x4767cc,_0x771f('0x1c'));logger['debug'](_0x771f('0x1d'),_0x4767cc,_0x771f('0x1c'),JSON[_0x771f('0x1e')](_0xabf9df));if(_0xabf9df[_0x771f('0x1f')]){if(_0xabf9df[_0x771f('0x1f')]['code']===0x1f4){logger['error'](_0x771f('0x1b'),_0x4767cc,_0xabf9df[_0x771f('0x1f')]['message']);return _0x33383d(_0xabf9df[_0x771f('0x1f')][_0x771f('0x20')]);}logger['error'](_0x771f('0x1b'),_0x4767cc,_0xabf9df[_0x771f('0x1f')]['message']);return _0x5a3134(_0xabf9df[_0x771f('0x1f')][_0x771f('0x20')]);}else{logger['info'](_0x771f('0x1b'),_0x4767cc,_0x771f('0x1c'));_0x5a3134(_0xabf9df[_0x771f('0x21')][_0x771f('0x20')]);}})[_0x771f('0x22')](function(_0x10964e){logger['error'](_0x771f('0x1b'),_0x4767cc,_0x10964e);_0x33383d(_0x10964e);});});}function respondWithStatusCode(_0x25ab5e,_0x58bbbb){_0x58bbbb=_0x58bbbb||0xcc;return function(_0x3738ad){if(_0x3738ad){return _0x25ab5e[_0x771f('0x23')](_0x58bbbb);}return _0x25ab5e[_0x771f('0x24')](_0x58bbbb)[_0x771f('0x25')]();};}function respondWithResult(_0x556bb9,_0x29b2e6){_0x29b2e6=_0x29b2e6||0xc8;return function(_0x2b06aa){if(_0x2b06aa){return _0x556bb9['status'](_0x29b2e6)[_0x771f('0x26')](_0x2b06aa);}};}function respondWithFilteredResult(_0x3bd65f,_0x21f17c){return function(_0x30551a){if(_0x30551a){var _0x43f7ba=_0x30551a[_0x771f('0x27')],_0x1e5eeb=_0x21f17c[_0x771f('0x28')],_0x2f04fc=_0x21f17c[_0x771f('0x28')]+_0x21f17c[_0x771f('0x29')],_0x1e19c0;if(_0x2f04fc>=_0x43f7ba){_0x2f04fc=_0x43f7ba;_0x1e19c0=0xc8;}else{_0x1e19c0=0xce;}_0x3bd65f[_0x771f('0x24')](_0x1e19c0);return _0x3bd65f['set']('Content-Range',_0x1e5eeb+'-'+_0x2f04fc+'/'+_0x43f7ba)[_0x771f('0x26')](_0x30551a);}return null;};}function patchUpdates(_0x355a47){return function(_0x42b46f){try{jsonpatch['apply'](_0x42b46f,_0x355a47,!![]);}catch(_0x295d39){return BPromise[_0x771f('0x2a')](_0x295d39);}return _0x42b46f[_0x771f('0x2b')]();};}function saveUpdates(_0x305135,_0xb38265){return function(_0x1fa064){if(_0x1fa064){return _0x1fa064[_0x771f('0x2c')](_0x305135)['then'](function(_0x1af50c){return _0x1af50c;});}return null;};}function removeEntity(_0x48a868,_0x34ce48){return function(_0x37eb99){if(_0x37eb99){return _0x37eb99[_0x771f('0x2d')]()[_0x771f('0x19')](function(){_0x48a868['status'](0xcc)[_0x771f('0x25')]();});}};}function handleEntityNotFound(_0x4f6a44,_0x22c65b){return function(_0x1c584c){if(!_0x1c584c){_0x4f6a44[_0x771f('0x23')](0x194);}return _0x1c584c;};}function handleError(_0x1daffa,_0x478ed3){_0x478ed3=_0x478ed3||0x1f4;return function(_0x2b318d){logger[_0x771f('0x1f')](_0x2b318d[_0x771f('0x2e')]);if(_0x2b318d[_0x771f('0x2f')]){delete _0x2b318d[_0x771f('0x2f')];}_0x1daffa[_0x771f('0x24')](_0x478ed3)['send'](_0x2b318d);};}exports[_0x771f('0x30')]=function(_0xe2fd9c,_0x563053){var _0x52a976={},_0x5f0736={},_0x293117={'count':0x0,'rows':[]};var _0x4357e0=_['map'](db[_0x771f('0x31')]['rawAttributes'],function(_0x5a5eb3){return{'name':_0x5a5eb3[_0x771f('0x32')],'type':_0x5a5eb3[_0x771f('0x33')][_0x771f('0x34')]};});_0x5f0736[_0x771f('0x35')]=_[_0x771f('0x36')](_0x4357e0,_0x771f('0x2f'));_0x5f0736[_0x771f('0x37')]=_[_0x771f('0x38')](_0xe2fd9c[_0x771f('0x37')]);_0x5f0736[_0x771f('0x39')]=_[_0x771f('0x3a')](_0x5f0736[_0x771f('0x35')],_0x5f0736[_0x771f('0x37')]);_0x52a976[_0x771f('0x3b')]=_[_0x771f('0x3a')](_0x5f0736[_0x771f('0x35')],qs['fields'](_0xe2fd9c[_0x771f('0x37')][_0x771f('0x3c')]));_0x52a976[_0x771f('0x3b')]=_0x52a976[_0x771f('0x3b')][_0x771f('0x3d')]?_0x52a976[_0x771f('0x3b')]:_0x5f0736[_0x771f('0x35')];if(!_0xe2fd9c[_0x771f('0x37')][_0x771f('0x3e')](_0x771f('0x3f'))){_0x52a976[_0x771f('0x29')]=qs[_0x771f('0x29')](_0xe2fd9c[_0x771f('0x37')]['limit']);_0x52a976[_0x771f('0x28')]=qs[_0x771f('0x28')](_0xe2fd9c[_0x771f('0x37')][_0x771f('0x28')]);}_0x52a976[_0x771f('0x40')]=qs[_0x771f('0x41')](_0xe2fd9c[_0x771f('0x37')]['sort']);_0x52a976[_0x771f('0x42')]=qs[_0x771f('0x39')](_[_0x771f('0x43')](_0xe2fd9c[_0x771f('0x37')],_0x5f0736[_0x771f('0x39')]),_0x4357e0);if(_0xe2fd9c[_0x771f('0x37')]['filter']){_0x52a976[_0x771f('0x42')]=_[_0x771f('0x44')](_0x52a976[_0x771f('0x42')],{'$or':_[_0x771f('0x36')](_0x4357e0,function(_0x3e4215){if(_0x3e4215[_0x771f('0x33')]!==_0x771f('0x45')){var _0x43ce1d={};_0x43ce1d[_0x3e4215[_0x771f('0x2f')]]={'$like':'%'+_0xe2fd9c[_0x771f('0x37')][_0x771f('0x46')]+'%'};return _0x43ce1d;}})});}_0x52a976=_['merge']({},_0x52a976,_0xe2fd9c['options']);var _0x4fd1b4={'where':_0x52a976[_0x771f('0x42')]};return db['FreshdeskAccount'][_0x771f('0x27')](_0x4fd1b4)[_0x771f('0x19')](function(_0x57c110){_0x293117['count']=_0x57c110;if(_0xe2fd9c[_0x771f('0x37')][_0x771f('0x47')]){_0x52a976[_0x771f('0x48')]=[{'all':!![]}];}return db[_0x771f('0x31')]['findAll'](_0x52a976);})[_0x771f('0x19')](function(_0x5a70a9){_0x293117[_0x771f('0x49')]=_0x5a70a9;return _0x293117;})[_0x771f('0x19')](respondWithFilteredResult(_0x563053,_0x52a976))[_0x771f('0x22')](handleError(_0x563053,null));};exports['show']=function(_0x3ebc82,_0xda11ae){var _0xf1ef25={'raw':![],'where':{'id':_0x3ebc82[_0x771f('0x4a')]['id']}},_0x19e228={};_0x19e228['model']=_['keys'](db[_0x771f('0x31')][_0x771f('0x4b')]);_0x19e228[_0x771f('0x37')]=_[_0x771f('0x38')](_0x3ebc82[_0x771f('0x37')]);_0x19e228[_0x771f('0x39')]=_[_0x771f('0x3a')](_0x19e228[_0x771f('0x35')],_0x19e228['query']);_0xf1ef25[_0x771f('0x3b')]=_[_0x771f('0x3a')](_0x19e228[_0x771f('0x35')],qs[_0x771f('0x3c')](_0x3ebc82[_0x771f('0x37')][_0x771f('0x3c')]));_0xf1ef25[_0x771f('0x3b')]=_0xf1ef25['attributes'][_0x771f('0x3d')]?_0xf1ef25[_0x771f('0x3b')]:_0x19e228[_0x771f('0x35')];if(_0x3ebc82['query']['includeAll']){_0xf1ef25[_0x771f('0x48')]=[{'all':!![]}];}_0xf1ef25=_[_0x771f('0x44')]({},_0xf1ef25,_0x3ebc82['options']);return db['FreshdeskAccount'][_0x771f('0x4c')](_0xf1ef25)[_0x771f('0x19')](handleEntityNotFound(_0xda11ae,null))[_0x771f('0x19')](respondWithResult(_0xda11ae,null))[_0x771f('0x22')](handleError(_0xda11ae,null));};exports[_0x771f('0x4d')]=function(_0x586a0d,_0x174fb3){return db[_0x771f('0x31')]['create'](_0x586a0d[_0x771f('0x4e')],{})['then'](respondWithResult(_0x174fb3,0xc9))[_0x771f('0x22')](handleError(_0x174fb3,null));};exports[_0x771f('0x2c')]=function(_0x232abc,_0x1900f2){if(_0x232abc['body']['id']){delete _0x232abc[_0x771f('0x4e')]['id'];}return db['FreshdeskAccount'][_0x771f('0x4c')]({'where':{'id':_0x232abc[_0x771f('0x4a')]['id']}})[_0x771f('0x19')](handleEntityNotFound(_0x1900f2,null))['then'](saveUpdates(_0x232abc['body'],null))[_0x771f('0x19')](respondWithResult(_0x1900f2,null))[_0x771f('0x22')](handleError(_0x1900f2,null));};exports[_0x771f('0x2d')]=function(_0x38e717,_0x2a0c22){return db[_0x771f('0x31')][_0x771f('0x4c')]({'where':{'id':_0x38e717[_0x771f('0x4a')]['id']}})[_0x771f('0x19')](handleEntityNotFound(_0x2a0c22,null))['then'](removeEntity(_0x2a0c22,null))[_0x771f('0x22')](handleError(_0x2a0c22,null));};exports['getConfigurations']=function(_0xc4f13c,_0xbb13b9,_0x44e534){var _0x21c01f={};var _0x5e3312={};var _0x5a0c9e;var _0x5181f1;return db[_0x771f('0x31')][_0x771f('0x4f')]({'where':{'id':_0xc4f13c[_0x771f('0x4a')]['id']}})['then'](handleEntityNotFound(_0xbb13b9,null))[_0x771f('0x19')](function(_0x5df540){if(_0x5df540){_0x5a0c9e=_0x5df540;_0x5e3312[_0x771f('0x35')]=_[_0x771f('0x38')](db[_0x771f('0x50')][_0x771f('0x4b')]);_0x5e3312[_0x771f('0x37')]=_[_0x771f('0x38')](_0xc4f13c['query']);_0x5e3312[_0x771f('0x39')]=_['intersection'](_0x5e3312[_0x771f('0x35')],_0x5e3312['query']);_0x21c01f[_0x771f('0x3b')]=_[_0x771f('0x3a')](_0x5e3312[_0x771f('0x35')],qs['fields'](_0xc4f13c[_0x771f('0x37')][_0x771f('0x3c')]));_0x21c01f['attributes']=_0x21c01f['attributes'][_0x771f('0x3d')]?_0x21c01f[_0x771f('0x3b')]:_0x5e3312[_0x771f('0x35')];_0x21c01f[_0x771f('0x40')]=qs[_0x771f('0x41')](_0xc4f13c['query'][_0x771f('0x41')]);_0x21c01f['where']=qs['filters'](_[_0x771f('0x43')](_0xc4f13c[_0x771f('0x37')],_0x5e3312[_0x771f('0x39')]));if(_0xc4f13c[_0x771f('0x37')][_0x771f('0x46')]){_0x21c01f[_0x771f('0x42')]=_[_0x771f('0x44')](_0x21c01f[_0x771f('0x42')],{'$or':_[_0x771f('0x36')](_0x21c01f[_0x771f('0x3b')],function(_0x1198a6){var _0x1e8470={};_0x1e8470[_0x1198a6]={'$like':'%'+_0xc4f13c['query'][_0x771f('0x46')]+'%'};return _0x1e8470;})});}_0x21c01f=_[_0x771f('0x44')]({},_0x21c01f,_0xc4f13c['options']);return _0x5a0c9e['getConfigurations'](_0x21c01f);}})[_0x771f('0x19')](function(_0x5be016){if(_0x5be016){_0x5181f1=_0x5be016['length'];if(!_0xc4f13c['query'][_0x771f('0x3e')](_0x771f('0x3f'))){_0x21c01f[_0x771f('0x29')]=qs[_0x771f('0x29')](_0xc4f13c['query'][_0x771f('0x29')]);_0x21c01f['offset']=qs[_0x771f('0x28')](_0xc4f13c[_0x771f('0x37')][_0x771f('0x28')]);}return _0x5a0c9e[_0x771f('0x51')](_0x21c01f);}})['then'](function(_0x124275){if(_0x124275){return _0x124275?{'count':_0x5181f1,'rows':_0x124275}:null;}})[_0x771f('0x19')](respondWithResult(_0xbb13b9,null))[_0x771f('0x22')](handleError(_0xbb13b9,null));};exports[_0x771f('0x52')]=function(_0x3ae3a8,_0xff0827,_0x137b5e){if(_0x3ae3a8[_0x771f('0x4e')]['id']){delete _0x3ae3a8[_0x771f('0x4e')]['id'];}return db[_0x771f('0x31')][_0x771f('0x4f')]({'where':{'id':_0x3ae3a8[_0x771f('0x4a')]['id']}})[_0x771f('0x19')](handleEntityNotFound(_0xff0827,null))['then'](function(_0x44432c){if(_0x44432c){_0x3ae3a8['body'][_0x771f('0x53')]=_0x44432c['id'];_0x3ae3a8[_0x771f('0x4e')][_0x771f('0x54')]=integrations[_0x771f('0x55')](_0x3ae3a8[_0x771f('0x4e')][_0x771f('0x56')],_0x3ae3a8[_0x771f('0x4e')][_0x771f('0x33')]);_0x3ae3a8['body']['Descriptions']=integrations[_0x771f('0x57')](_0x3ae3a8[_0x771f('0x4e')][_0x771f('0x56')],_0x3ae3a8['body'][_0x771f('0x33')]);return db[_0x771f('0x50')][_0x771f('0x4d')](_0x3ae3a8[_0x771f('0x4e')],{'include':[{'model':db[_0x771f('0x58')],'as':_0x771f('0x54')},{'model':db['FreshdeskField'],'as':_0x771f('0x59')}]});}return null;})[_0x771f('0x19')](respondWithResult(_0xff0827,null))[_0x771f('0x22')](handleError(_0xff0827,null));};exports[_0x771f('0x5a')]=function(_0x26d374,_0x1ece92,_0x2992aa){var _0x5ca5ad='';return db[_0x771f('0x31')]['findOne']({'where':{'id':_0x26d374['params']['id']},'attributes':['id',_0x771f('0x5b'),'apiKey']})[_0x771f('0x19')](handleEntityNotFound(_0x1ece92,null))['then'](function(_0x274c26){if(_0x274c26){_0x5ca5ad=_0x274c26[_0x771f('0x5b')];var _0x2182ca=_0x5ca5ad[_0x771f('0x5c')](-0x1);if(_0x2182ca==='/'){_0x5ca5ad=_0x5ca5ad[_0x771f('0x5d')](0x0,_0x5ca5ad[_0x771f('0x5e')](_0x2182ca));}return rp({'method':'GET','uri':util[_0x771f('0x5f')](_0x771f('0x60'),_0x5ca5ad,_0x771f('0x61')),'headers':{'Authorization':util[_0x771f('0x5f')](_0x771f('0x62'),new Buffer(util[_0x771f('0x5f')](_0x771f('0x63'),_0x274c26[_0x771f('0x64')]))['toString'](_0x771f('0x65')))},'json':!![]});}})[_0x771f('0x19')](function(_0x3318bf){if(_0x3318bf){var _0x4ed18c=[_0x771f('0x66'),'subject',_0x771f('0x67'),_0x771f('0x68'),'status','priority',_0x771f('0x69'),_0x771f('0x6a'),_0x771f('0x6b'),'group',_0x771f('0x6c')];_['remove'](_0x3318bf,function(_0xa9b365){return _0x4ed18c[_0x771f('0x6d')](_0xa9b365[_0x771f('0x2f')])||!_0xa9b365[_0x771f('0x6e')]&&_0xa9b365['type']!=='custom_text'&&_0xa9b365[_0x771f('0x33')]!==_0x771f('0x6f');});return{'count':_0x3318bf[_0x771f('0x3d')],'rows':_[_0x771f('0x36')](_0x3318bf,function(_0x1d2f28){return{'id':_0x1d2f28[_0x771f('0x2f')],'name':_0x1d2f28[_0x771f('0x70')],'custom':!_0x1d2f28[_0x771f('0x6e')],'options':_0x1d2f28[_0x771f('0x71')]?_['map'](_0x1d2f28[_0x771f('0x71')],function(_0x6f8003){return{'name':_[_0x771f('0x72')](_0x6f8003),'value':_0x6f8003};}):[]};})};}})[_0x771f('0x19')](respondWithResult(_0x1ece92,null))[_0x771f('0x22')](function(_0x4bee17){var _0x2cf662=_0x26d374[_0x771f('0x37')][_0x771f('0x73')]?0x1f4:_0x4bee17['statusCode']||0x1f4;logger[_0x771f('0x1f')](_0x771f('0x74'),'getFields',_0x2cf662,JSON[_0x771f('0x1e')](_0x4bee17));delete _0x4bee17[_0x771f('0x2f')];if(_0x2cf662===0x191){_0x2cf662=0x190;}_0x1ece92[_0x771f('0x24')](_0x2cf662)[_0x771f('0x75')](_0x26d374[_0x771f('0x37')]['test']?{'message':_0x771f('0x76'),'statusCode':_0x4bee17['statusCode']}:_0x4bee17);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 5139032..2ec7136 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 _0xbcbe=['path','rimraf','../../components/integrations/configuration','FreshdeskAccount','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbcbe,0x194));var _0xebcb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbcbe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xebcb('0x0'));var util=require(_0xebcb('0x1'));var logger=require(_0xebcb('0x2'))('api');var moment=require(_0xebcb('0x3'));var BPromise=require(_0xebcb('0x4'));var rp=require(_0xebcb('0x5'));var fs=require('fs');var path=require(_0xebcb('0x6'));var rimraf=require(_0xebcb('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xebcb('0x8'));module['exports']=function(_0x370742,_0x3fcf1c){return _0x370742['define'](_0xebcb('0x9'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf1e=['../../config/environment','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xb9063d,_0x2cda45){var _0x5befef=function(_0x1cea9b){while(--_0x1cea9b){_0xb9063d['push'](_0xb9063d['shift']());}};_0x5befef(++_0x2cda45);}(_0xaf1e,0xd7));var _0xeaf1=function(_0x40586c,_0xd74853){_0x40586c=_0x40586c-0x0;var _0x2f8ee4=_0xaf1e[_0x40586c];return _0x2f8ee4;};'use strict';var _=require(_0xeaf1('0x0'));var util=require(_0xeaf1('0x1'));var logger=require(_0xeaf1('0x2'))(_0xeaf1('0x3'));var moment=require(_0xeaf1('0x4'));var BPromise=require(_0xeaf1('0x5'));var rp=require(_0xeaf1('0x6'));var fs=require('fs');var path=require(_0xeaf1('0x7'));var rimraf=require(_0xeaf1('0x8'));var config=require(_0xeaf1('0x9'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xeaf1('0xa'));module['exports']=function(_0x1724cb,_0x276572){return _0x1724cb[_0xeaf1('0xb')](_0xeaf1('0xc'),attributes,{'tableName':_0xeaf1('0xd'),'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 3ff4e0c..28fe981 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 _0x4ce9=['info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','find','stringify','moment','randomstring','ioredis','../../config/utils','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ce9,0x112));var _0x94ce=function(_0x37afb5,_0x197883){_0x37afb5=_0x37afb5-0x0;var _0x277782=_0x4ce9[_0x37afb5];return _0x277782;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x94ce('0x0'));var BPromise=require('bluebird');var rs=require(_0x94ce('0x1'));var fs=require('fs');var Redis=require(_0x94ce('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x94ce('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x58c18d,_0xe6799f,_0x1b48ea){return new BPromise(function(_0x587699,_0x2ba66a){return client[_0x94ce('0x4')](_0x58c18d,_0x1b48ea)[_0x94ce('0x5')](function(_0x12eae4){logger[_0x94ce('0x6')](_0x94ce('0x7'),_0xe6799f,_0x94ce('0x8'));logger[_0x94ce('0x9')](_0x94ce('0xa'),_0xe6799f,_0x94ce('0x8'),JSON['stringify'](_0x12eae4));if(_0x12eae4['error']){if(_0x12eae4['error']['code']===0x1f4){logger[_0x94ce('0xb')](_0x94ce('0x7'),_0xe6799f,_0x12eae4['error'][_0x94ce('0xc')]);return _0x2ba66a(_0x12eae4[_0x94ce('0xb')][_0x94ce('0xc')]);}logger[_0x94ce('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0xe6799f,_0x12eae4[_0x94ce('0xb')][_0x94ce('0xc')]);return _0x587699(_0x12eae4[_0x94ce('0xb')][_0x94ce('0xc')]);}else{logger['info'](_0x94ce('0x7'),_0xe6799f,_0x94ce('0x8'));_0x587699(_0x12eae4[_0x94ce('0xd')][_0x94ce('0xc')]);}})[_0x94ce('0xe')](function(_0x5e6f16){logger[_0x94ce('0xb')](_0x94ce('0x7'),_0xe6799f,_0x5e6f16);_0x2ba66a(_0x5e6f16);});});}exports[_0x94ce('0xf')]=function(_0x700de7){var _0x5d202a=this;return new Promise(function(_0x4d9dcf,_0x1520be){return db[_0x94ce('0x10')]['findAll']({'raw':_0x700de7['options']?_0x700de7[_0x94ce('0x11')][_0x94ce('0x12')]===undefined?!![]:![]:!![],'where':_0x700de7[_0x94ce('0x11')]?_0x700de7['options'][_0x94ce('0x13')]||null:null,'attributes':_0x700de7[_0x94ce('0x11')]?_0x700de7[_0x94ce('0x11')][_0x94ce('0x14')]||null:null,'limit':_0x700de7['options']?_0x700de7[_0x94ce('0x11')][_0x94ce('0x15')]||null:null,'include':_0x700de7[_0x94ce('0x11')]?_0x700de7[_0x94ce('0x11')][_0x94ce('0x16')]?_[_0x94ce('0x17')](_0x700de7[_0x94ce('0x11')][_0x94ce('0x16')],function(_0x5da400){return{'model':db[_0x5da400[_0x94ce('0x18')]],'as':_0x5da400['as'],'attributes':_0x5da400[_0x94ce('0x14')],'include':_0x5da400[_0x94ce('0x16')]?_[_0x94ce('0x17')](_0x5da400[_0x94ce('0x16')],function(_0x4d2c3c){return{'model':db[_0x4d2c3c['model']],'as':_0x4d2c3c['as'],'attributes':_0x4d2c3c[_0x94ce('0x14')],'include':_0x4d2c3c[_0x94ce('0x16')]?_[_0x94ce('0x17')](_0x4d2c3c['include'],function(_0x5bd309){return{'model':db[_0x5bd309['model']],'as':_0x5bd309['as'],'attributes':_0x5bd309['attributes']};}):[]};}):[]};}):[]:[]})[_0x94ce('0x5')](function(_0x4faef){logger[_0x94ce('0x6')](_0x94ce('0xf'),_0x700de7);logger['debug']('GetFreshdeskAccount',_0x700de7,JSON['stringify'](_0x4faef));_0x4d9dcf(_0x4faef);})['catch'](function(_0x3e72cf){logger[_0x94ce('0xb')]('GetFreshdeskAccount',_0x3e72cf[_0x94ce('0xc')],_0x700de7);_0x1520be(_0x5d202a[_0x94ce('0xb')](0x1f4,_0x3e72cf[_0x94ce('0xc')]));});});};exports[_0x94ce('0x19')]=function(_0x528c27){var _0x1318ef=this;return new Promise(function(_0x57a4aa,_0x3c9b17){return db[_0x94ce('0x10')][_0x94ce('0x1a')]({'raw':_0x528c27['options']?_0x528c27[_0x94ce('0x11')]['raw']===undefined?!![]:![]:!![],'where':_0x528c27[_0x94ce('0x11')]?_0x528c27[_0x94ce('0x11')][_0x94ce('0x13')]||null:null,'attributes':_0x528c27[_0x94ce('0x11')]?_0x528c27['options'][_0x94ce('0x14')]||null:null,'include':_0x528c27['options']?_0x528c27[_0x94ce('0x11')][_0x94ce('0x16')]?_[_0x94ce('0x17')](_0x528c27[_0x94ce('0x11')][_0x94ce('0x16')],function(_0x4febe7){return{'model':db[_0x4febe7[_0x94ce('0x18')]],'as':_0x4febe7['as'],'attributes':_0x4febe7['attributes'],'include':_0x4febe7[_0x94ce('0x16')]?_[_0x94ce('0x17')](_0x4febe7[_0x94ce('0x16')],function(_0x70f4e3){return{'model':db[_0x70f4e3[_0x94ce('0x18')]],'as':_0x70f4e3['as'],'attributes':_0x70f4e3[_0x94ce('0x14')],'include':_0x70f4e3['include']?_[_0x94ce('0x17')](_0x70f4e3[_0x94ce('0x16')],function(_0x7a8bbc){return{'model':db[_0x7a8bbc[_0x94ce('0x18')]],'as':_0x7a8bbc['as'],'attributes':_0x7a8bbc[_0x94ce('0x14')]};}):[]};}):[]};}):[]:[]})[_0x94ce('0x5')](function(_0x2e68ad){logger[_0x94ce('0x6')](_0x94ce('0x19'),_0x528c27);logger['debug'](_0x94ce('0x19'),_0x528c27,JSON[_0x94ce('0x1b')](_0x2e68ad));_0x57a4aa(_0x2e68ad);})[_0x94ce('0xe')](function(_0x3b68b5){logger[_0x94ce('0xb')](_0x94ce('0x19'),_0x3b68b5[_0x94ce('0xc')],_0x528c27);_0x3c9b17(_0x1318ef['error'](0x1f4,_0x3b68b5[_0x94ce('0xc')]));});});}; \ No newline at end of file +var _0x36e3=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','FreshdeskAccount','findAll','options','raw','attributes','limit','include','map','model','GetFreshdeskAccount','debug','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring'];(function(_0x20096c,_0xee06d3){var _0x47903c=function(_0x129c44){while(--_0x129c44){_0x20096c['push'](_0x20096c['shift']());}};_0x47903c(++_0xee06d3);}(_0x36e3,0x14f));var _0x336e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x36e3[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x336e('0x0'));var util=require(_0x336e('0x1'));var moment=require(_0x336e('0x2'));var BPromise=require(_0x336e('0x3'));var rs=require(_0x336e('0x4'));var fs=require('fs');var Redis=require(_0x336e('0x5'));var db=require(_0x336e('0x6'))['db'];var utils=require(_0x336e('0x7'));var logger=require(_0x336e('0x8'))(_0x336e('0x9'));var config=require(_0x336e('0xa'));var jayson=require(_0x336e('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x20f69c,_0x14b139,_0x52dd4e){return new BPromise(function(_0x56b5df,_0x187f55){return client[_0x336e('0xc')](_0x20f69c,_0x52dd4e)[_0x336e('0xd')](function(_0x47b958){logger[_0x336e('0xe')](_0x336e('0xf'),_0x14b139,_0x336e('0x10'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x14b139,_0x336e('0x10'),JSON[_0x336e('0x11')](_0x47b958));if(_0x47b958[_0x336e('0x12')]){if(_0x47b958[_0x336e('0x12')][_0x336e('0x13')]===0x1f4){logger[_0x336e('0x12')](_0x336e('0xf'),_0x14b139,_0x47b958['error'][_0x336e('0x14')]);return _0x187f55(_0x47b958['error'][_0x336e('0x14')]);}logger[_0x336e('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x14b139,_0x47b958[_0x336e('0x12')]['message']);return _0x56b5df(_0x47b958[_0x336e('0x12')]['message']);}else{logger[_0x336e('0xe')](_0x336e('0xf'),_0x14b139,'request\x20sent');_0x56b5df(_0x47b958['result'][_0x336e('0x14')]);}})[_0x336e('0x15')](function(_0x572f77){logger[_0x336e('0x12')](_0x336e('0xf'),_0x14b139,_0x572f77);_0x187f55(_0x572f77);});});}exports['GetFreshdeskAccount']=function(_0x237787){var _0x2b7129=this;return new Promise(function(_0x4401d3,_0x31f909){return db[_0x336e('0x16')][_0x336e('0x17')]({'raw':_0x237787[_0x336e('0x18')]?_0x237787[_0x336e('0x18')][_0x336e('0x19')]===undefined?!![]:![]:!![],'where':_0x237787['options']?_0x237787[_0x336e('0x18')]['where']||null:null,'attributes':_0x237787[_0x336e('0x18')]?_0x237787[_0x336e('0x18')][_0x336e('0x1a')]||null:null,'limit':_0x237787['options']?_0x237787[_0x336e('0x18')][_0x336e('0x1b')]||null:null,'include':_0x237787[_0x336e('0x18')]?_0x237787[_0x336e('0x18')][_0x336e('0x1c')]?_[_0x336e('0x1d')](_0x237787[_0x336e('0x18')][_0x336e('0x1c')],function(_0x58d94a){return{'model':db[_0x58d94a['model']],'as':_0x58d94a['as'],'attributes':_0x58d94a[_0x336e('0x1a')],'include':_0x58d94a[_0x336e('0x1c')]?_[_0x336e('0x1d')](_0x58d94a[_0x336e('0x1c')],function(_0x267ca2){return{'model':db[_0x267ca2[_0x336e('0x1e')]],'as':_0x267ca2['as'],'attributes':_0x267ca2[_0x336e('0x1a')],'include':_0x267ca2[_0x336e('0x1c')]?_[_0x336e('0x1d')](_0x267ca2[_0x336e('0x1c')],function(_0x2ea91c){return{'model':db[_0x2ea91c[_0x336e('0x1e')]],'as':_0x2ea91c['as'],'attributes':_0x2ea91c[_0x336e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x336e('0xd')](function(_0x56ff0b){logger[_0x336e('0xe')](_0x336e('0x1f'),_0x237787);logger[_0x336e('0x20')](_0x336e('0x1f'),_0x237787,JSON[_0x336e('0x11')](_0x56ff0b));_0x4401d3(_0x56ff0b);})[_0x336e('0x15')](function(_0x5ba3d9){logger['error'](_0x336e('0x1f'),_0x5ba3d9['message'],_0x237787);_0x31f909(_0x2b7129[_0x336e('0x12')](0x1f4,_0x5ba3d9[_0x336e('0x14')]));});});};exports[_0x336e('0x21')]=function(_0xfc3835){var _0x4f4c13=this;return new Promise(function(_0x18290b,_0x407ead){return db[_0x336e('0x16')]['find']({'raw':_0xfc3835[_0x336e('0x18')]?_0xfc3835[_0x336e('0x18')][_0x336e('0x19')]===undefined?!![]:![]:!![],'where':_0xfc3835[_0x336e('0x18')]?_0xfc3835[_0x336e('0x18')]['where']||null:null,'attributes':_0xfc3835[_0x336e('0x18')]?_0xfc3835['options']['attributes']||null:null,'include':_0xfc3835[_0x336e('0x18')]?_0xfc3835[_0x336e('0x18')][_0x336e('0x1c')]?_[_0x336e('0x1d')](_0xfc3835['options']['include'],function(_0xba64a2){return{'model':db[_0xba64a2[_0x336e('0x1e')]],'as':_0xba64a2['as'],'attributes':_0xba64a2[_0x336e('0x1a')],'include':_0xba64a2[_0x336e('0x1c')]?_[_0x336e('0x1d')](_0xba64a2[_0x336e('0x1c')],function(_0x40f4b1){return{'model':db[_0x40f4b1[_0x336e('0x1e')]],'as':_0x40f4b1['as'],'attributes':_0x40f4b1['attributes'],'include':_0x40f4b1[_0x336e('0x1c')]?_[_0x336e('0x1d')](_0x40f4b1[_0x336e('0x1c')],function(_0x5d804e){return{'model':db[_0x5d804e[_0x336e('0x1e')]],'as':_0x5d804e['as'],'attributes':_0x5d804e['attributes']};}):[]};}):[]};}):[]:[]})[_0x336e('0xd')](function(_0x393346){logger[_0x336e('0xe')](_0x336e('0x21'),_0xfc3835);logger[_0x336e('0x20')](_0x336e('0x21'),_0xfc3835,JSON[_0x336e('0x11')](_0x393346));_0x18290b(_0x393346);})[_0x336e('0x15')](function(_0x308cf7){logger[_0x336e('0x12')](_0x336e('0x21'),_0x308cf7['message'],_0xfc3835);_0x407ead(_0x4f4c13[_0x336e('0x12')](0x1f4,_0x308cf7['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index a882b1e..b40fe16 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 _0x7bb4=['../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','getTags','post','create','/:id/tags','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x7bb4,0x8c));var _0x47bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7bb4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x47bb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x47bb('0x1'));var express=require(_0x47bb('0x2'));var router=express[_0x47bb('0x3')]();var auth=require(_0x47bb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x47bb('0x5'));var controller=require(_0x47bb('0x6'));router[_0x47bb('0x7')]('/',auth[_0x47bb('0x8')](),controller[_0x47bb('0x9')]);router['get']('/:id',auth[_0x47bb('0x8')](),controller[_0x47bb('0xa')]);router[_0x47bb('0x7')](_0x47bb('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0x47bb('0x7')](_0x47bb('0xc'),auth[_0x47bb('0x8')](),controller[_0x47bb('0xd')]);router['get']('/:id/descriptions',auth[_0x47bb('0x8')](),controller[_0x47bb('0xe')]);router[_0x47bb('0x7')]('/:id/tags',auth[_0x47bb('0x8')](),controller[_0x47bb('0xf')]);router[_0x47bb('0x10')]('/',auth[_0x47bb('0x8')](),controller[_0x47bb('0x11')]);router['post'](_0x47bb('0x12'),auth[_0x47bb('0x8')](),controller['setTags']);router['put'](_0x47bb('0x13'),auth[_0x47bb('0x8')](),controller[_0x47bb('0x14')]);router[_0x47bb('0x15')]('/:id',auth[_0x47bb('0x8')](),controller[_0x47bb('0x16')]);module[_0x47bb('0x17')]=router; \ No newline at end of file +var _0x73b4=['index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x73b4,0x133));var _0x473b=function(_0x1e2080,_0x53283b){_0x1e2080=_0x1e2080-0x0;var _0x260111=_0x73b4[_0x1e2080];return _0x260111;};'use strict';var multer=require(_0x473b('0x0'));var util=require(_0x473b('0x1'));var path=require(_0x473b('0x2'));var timeout=require(_0x473b('0x3'));var express=require(_0x473b('0x4'));var router=express[_0x473b('0x5')]();var auth=require(_0x473b('0x6'));var interaction=require(_0x473b('0x7'));var config=require(_0x473b('0x8'));var controller=require(_0x473b('0x9'));router[_0x473b('0xa')]('/',auth[_0x473b('0xb')](),controller[_0x473b('0xc')]);router[_0x473b('0xa')](_0x473b('0xd'),auth['isAuthenticated'](),controller[_0x473b('0xe')]);router[_0x473b('0xa')](_0x473b('0xf'),auth[_0x473b('0xb')](),controller[_0x473b('0x10')]);router['get'](_0x473b('0x11'),auth[_0x473b('0xb')](),controller[_0x473b('0x12')]);router[_0x473b('0xa')](_0x473b('0x13'),auth[_0x473b('0xb')](),controller['getDescriptions']);router['get'](_0x473b('0x14'),auth[_0x473b('0xb')](),controller[_0x473b('0x15')]);router[_0x473b('0x16')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x473b('0x14'),auth[_0x473b('0xb')](),controller[_0x473b('0x17')]);router[_0x473b('0x18')]('/:id',auth[_0x473b('0xb')](),controller[_0x473b('0x19')]);router[_0x473b('0x1a')]('/:id',auth[_0x473b('0xb')](),controller[_0x473b('0x1b')]);module[_0x473b('0x1c')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 951785b..396bcfc 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 _0x835b=['STRING','sequelize','exports'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x835b,0x13f));var _0xb835=function(_0x51426f,_0xba8ad9){_0x51426f=_0x51426f-0x0;var _0xed6bbd=_0x835b[_0x51426f];return _0xed6bbd;};'use strict';var Sequelize=require(_0xb835('0x0'));module[_0xb835('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb835('0x2')]}}; \ No newline at end of file +var _0xab50=['exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab50,0x17a));var _0x0ab5=function(_0x3f0d07,_0x3d5cc4){_0x3f0d07=_0x3f0d07-0x0;var _0x3e3074=_0xab50[_0x3f0d07];return _0x3e3074;};'use strict';var Sequelize=require('sequelize');module[_0x0ab5('0x0')]={'name':{'type':Sequelize[_0x0ab5('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 340ab65..67ff1d2 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 _0x1b16=['bluebird','util','path','lodash','squel','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','jayson/promise','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','end','status','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','options','include','findAll','rows','includeAll','find','create','body','params','getFields','findOne','FreshdeskField','length','filter','getSubjects','getDescriptions','getTags','Tag','setTags','html-pdf','eml-format','rimraf','request-promise'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x1b16,0x16c));var _0x61b1=function(_0x5544db,_0x5219b2){_0x5544db=_0x5544db-0x0;var _0x153f11=_0x1b16[_0x5544db];return _0x153f11;};'use strict';var pdf=require(_0x61b1('0x0'));var emlformat=require(_0x61b1('0x1'));var rimraf=require(_0x61b1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x61b1('0x3'));var moment=require('moment');var BPromise=require(_0x61b1('0x4'));var Mustache=require('mustache');var util=require(_0x61b1('0x5'));var path=require(_0x61b1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x61b1('0x7'));var squel=require(_0x61b1('0x8'));var crypto=require('crypto');var jsforce=require(_0x61b1('0x9'));var deskjs=require(_0x61b1('0xa'));var toCsv=require(_0x61b1('0xb'));var querystring=require(_0x61b1('0xc'));var Papa=require(_0x61b1('0xd'));var Redis=require('ioredis');var authService=require(_0x61b1('0xe'));var qs=require(_0x61b1('0xf'));var as=require(_0x61b1('0x10'));var hardwareService=require(_0x61b1('0x11'));var logger=require(_0x61b1('0x12'))(_0x61b1('0x13'));var utils=require('../../config/utils');var config=require(_0x61b1('0x14'));var licenseUtil=require(_0x61b1('0x15'));var db=require(_0x61b1('0x16'))['db'];var jayson=require(_0x61b1('0x17'));var client=jayson[_0x61b1('0x18')][_0x61b1('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x31fdd3,_0x5cbaeb,_0x5429d2,_0x2ffe1e){return new BPromise(function(_0x29edc1,_0x45ef93){var _0xd2c34a=_0x2ffe1e||client;return _0xd2c34a[_0x61b1('0x1a')](_0x31fdd3,_0x5429d2)['then'](function(_0x49fdcd){logger[_0x61b1('0x1b')](_0x61b1('0x1c'),_0x5cbaeb,_0x61b1('0x1d'));logger[_0x61b1('0x1e')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5cbaeb,_0x61b1('0x1d'),JSON['stringify'](_0x49fdcd));if(_0x49fdcd[_0x61b1('0x1f')]){if(_0x49fdcd[_0x61b1('0x1f')][_0x61b1('0x20')]===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x5cbaeb,_0x49fdcd['error']['message']);return _0x45ef93(_0x49fdcd['error'][_0x61b1('0x21')]);}logger['error'](_0x61b1('0x1c'),_0x5cbaeb,_0x49fdcd[_0x61b1('0x1f')]['message']);return _0x29edc1(_0x49fdcd[_0x61b1('0x1f')][_0x61b1('0x21')]);}else{logger[_0x61b1('0x1b')](_0x61b1('0x1c'),_0x5cbaeb,_0x61b1('0x1d'));_0x29edc1(_0x49fdcd[_0x61b1('0x22')][_0x61b1('0x21')]);}})[_0x61b1('0x23')](function(_0x55624b){logger['error'](_0x61b1('0x1c'),_0x5cbaeb,_0x55624b);_0x45ef93(_0x55624b);});});}function respondWithStatusCode(_0x394393,_0x2e02d6){_0x2e02d6=_0x2e02d6||0xcc;return function(_0x1cbcf3){if(_0x1cbcf3){return _0x394393[_0x61b1('0x24')](_0x2e02d6);}return _0x394393['status'](_0x2e02d6)[_0x61b1('0x25')]();};}function respondWithResult(_0x1d5529,_0x215ba2){_0x215ba2=_0x215ba2||0xc8;return function(_0x2914cb){if(_0x2914cb){return _0x1d5529[_0x61b1('0x26')](_0x215ba2)['json'](_0x2914cb);}};}function respondWithFilteredResult(_0x37fee9,_0x2857fe){return function(_0x5c426a){if(_0x5c426a){var _0x269d3f=_0x5c426a[_0x61b1('0x27')],_0x252f04=_0x2857fe[_0x61b1('0x28')],_0x13105d=_0x2857fe[_0x61b1('0x28')]+_0x2857fe[_0x61b1('0x29')],_0x580ef3;if(_0x13105d>=_0x269d3f){_0x13105d=_0x269d3f;_0x580ef3=0xc8;}else{_0x580ef3=0xce;}_0x37fee9[_0x61b1('0x26')](_0x580ef3);return _0x37fee9[_0x61b1('0x2a')](_0x61b1('0x2b'),_0x252f04+'-'+_0x13105d+'/'+_0x269d3f)['json'](_0x5c426a);}return null;};}function patchUpdates(_0x437716){return function(_0x1496c5){try{jsonpatch[_0x61b1('0x2c')](_0x1496c5,_0x437716,!![]);}catch(_0x482139){return BPromise[_0x61b1('0x2d')](_0x482139);}return _0x1496c5[_0x61b1('0x2e')]();};}function saveUpdates(_0x5ccc8d,_0x32bd2b){return function(_0xe4d99){if(_0xe4d99){return _0xe4d99[_0x61b1('0x2f')](_0x5ccc8d)[_0x61b1('0x30')](function(_0x3a2822){return _0x3a2822;});}return null;};}function removeEntity(_0xe62a4,_0x2482c6){return function(_0x44d2a8){if(_0x44d2a8){return _0x44d2a8[_0x61b1('0x31')]()[_0x61b1('0x30')](function(){_0xe62a4[_0x61b1('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f246b,_0x12cf28){return function(_0x385d48){if(!_0x385d48){_0x5f246b[_0x61b1('0x24')](0x194);}return _0x385d48;};}function handleError(_0x502daf,_0xa15b6a){_0xa15b6a=_0xa15b6a||0x1f4;return function(_0x554db){logger[_0x61b1('0x1f')](_0x554db[_0x61b1('0x32')]);if(_0x554db[_0x61b1('0x33')]){delete _0x554db['name'];}_0x502daf[_0x61b1('0x26')](_0xa15b6a)[_0x61b1('0x34')](_0x554db);};}exports['index']=function(_0x3f7c22,_0x12ef1a){var _0x2e8f2d={},_0x367cca={},_0x557af8={'count':0x0,'rows':[]};var _0xb75a0=_[_0x61b1('0x35')](db[_0x61b1('0x36')][_0x61b1('0x37')],function(_0x442507){return{'name':_0x442507[_0x61b1('0x38')],'type':_0x442507[_0x61b1('0x39')][_0x61b1('0x3a')]};});_0x367cca[_0x61b1('0x3b')]=_['map'](_0xb75a0,_0x61b1('0x33'));_0x367cca[_0x61b1('0x3c')]=_[_0x61b1('0x3d')](_0x3f7c22[_0x61b1('0x3c')]);_0x367cca[_0x61b1('0x3e')]=_[_0x61b1('0x3f')](_0x367cca[_0x61b1('0x3b')],_0x367cca[_0x61b1('0x3c')]);_0x2e8f2d[_0x61b1('0x40')]=_[_0x61b1('0x3f')](_0x367cca['model'],qs[_0x61b1('0x41')](_0x3f7c22['query']['fields']));_0x2e8f2d[_0x61b1('0x40')]=_0x2e8f2d['attributes']['length']?_0x2e8f2d[_0x61b1('0x40')]:_0x367cca[_0x61b1('0x3b')];if(!_0x3f7c22[_0x61b1('0x3c')][_0x61b1('0x42')](_0x61b1('0x43'))){_0x2e8f2d[_0x61b1('0x29')]=qs[_0x61b1('0x29')](_0x3f7c22['query'][_0x61b1('0x29')]);_0x2e8f2d[_0x61b1('0x28')]=qs[_0x61b1('0x28')](_0x3f7c22[_0x61b1('0x3c')]['offset']);}_0x2e8f2d[_0x61b1('0x44')]=qs[_0x61b1('0x45')](_0x3f7c22[_0x61b1('0x3c')]['sort']);_0x2e8f2d['where']=qs[_0x61b1('0x3e')](_[_0x61b1('0x46')](_0x3f7c22[_0x61b1('0x3c')],_0x367cca[_0x61b1('0x3e')]),_0xb75a0);if(_0x3f7c22[_0x61b1('0x3c')]['filter']){_0x2e8f2d[_0x61b1('0x47')]=_[_0x61b1('0x48')](_0x2e8f2d[_0x61b1('0x47')],{'$or':_['map'](_0xb75a0,function(_0x17a790){if(_0x17a790[_0x61b1('0x39')]!=='VIRTUAL'){var _0x5b6033={};_0x5b6033[_0x17a790[_0x61b1('0x33')]]={'$like':'%'+_0x3f7c22[_0x61b1('0x3c')]['filter']+'%'};return _0x5b6033;}})});}_0x2e8f2d=_[_0x61b1('0x48')]({},_0x2e8f2d,_0x3f7c22[_0x61b1('0x49')]);var _0x1aa5ce={'where':_0x2e8f2d[_0x61b1('0x47')]};return db[_0x61b1('0x36')][_0x61b1('0x27')](_0x1aa5ce)[_0x61b1('0x30')](function(_0x1b654d){_0x557af8[_0x61b1('0x27')]=_0x1b654d;if(_0x3f7c22[_0x61b1('0x3c')]['includeAll']){_0x2e8f2d[_0x61b1('0x4a')]=[{'all':!![]}];}return db[_0x61b1('0x36')][_0x61b1('0x4b')](_0x2e8f2d);})[_0x61b1('0x30')](function(_0x35264e){_0x557af8[_0x61b1('0x4c')]=_0x35264e;return _0x557af8;})[_0x61b1('0x30')](respondWithFilteredResult(_0x12ef1a,_0x2e8f2d))[_0x61b1('0x23')](handleError(_0x12ef1a,null));};exports['show']=function(_0x239918,_0x76c40c){var _0x4a2ff4={'raw':![],'where':{'id':_0x239918['params']['id']}},_0x1f3c4e={};_0x1f3c4e[_0x61b1('0x3b')]=_[_0x61b1('0x3d')](db[_0x61b1('0x36')][_0x61b1('0x37')]);_0x1f3c4e[_0x61b1('0x3c')]=_[_0x61b1('0x3d')](_0x239918[_0x61b1('0x3c')]);_0x1f3c4e[_0x61b1('0x3e')]=_[_0x61b1('0x3f')](_0x1f3c4e[_0x61b1('0x3b')],_0x1f3c4e[_0x61b1('0x3c')]);_0x4a2ff4[_0x61b1('0x40')]=_[_0x61b1('0x3f')](_0x1f3c4e['model'],qs['fields'](_0x239918[_0x61b1('0x3c')][_0x61b1('0x41')]));_0x4a2ff4['attributes']=_0x4a2ff4['attributes']['length']?_0x4a2ff4[_0x61b1('0x40')]:_0x1f3c4e[_0x61b1('0x3b')];if(_0x239918['query'][_0x61b1('0x4d')]){_0x4a2ff4['include']=[{'all':!![]}];}_0x4a2ff4=_[_0x61b1('0x48')]({},_0x4a2ff4,_0x239918[_0x61b1('0x49')]);return db['FreshdeskConfiguration'][_0x61b1('0x4e')](_0x4a2ff4)[_0x61b1('0x30')](handleEntityNotFound(_0x76c40c,null))[_0x61b1('0x30')](respondWithResult(_0x76c40c,null))['catch'](handleError(_0x76c40c,null));};exports[_0x61b1('0x4f')]=function(_0x245566,_0x1b7b6c){return db[_0x61b1('0x36')]['create'](_0x245566[_0x61b1('0x50')],{})['then'](respondWithResult(_0x1b7b6c,0xc9))[_0x61b1('0x23')](handleError(_0x1b7b6c,null));};exports[_0x61b1('0x2f')]=function(_0x325ce5,_0x5615c0){if(_0x325ce5[_0x61b1('0x50')]['id']){delete _0x325ce5[_0x61b1('0x50')]['id'];}return db[_0x61b1('0x36')][_0x61b1('0x4e')]({'where':{'id':_0x325ce5[_0x61b1('0x51')]['id']}})[_0x61b1('0x30')](handleEntityNotFound(_0x5615c0,null))[_0x61b1('0x30')](saveUpdates(_0x325ce5[_0x61b1('0x50')],null))[_0x61b1('0x30')](respondWithResult(_0x5615c0,null))[_0x61b1('0x23')](handleError(_0x5615c0,null));};exports[_0x61b1('0x31')]=function(_0x3c6844,_0x217b54){return db[_0x61b1('0x36')]['find']({'where':{'id':_0x3c6844[_0x61b1('0x51')]['id']}})[_0x61b1('0x30')](handleEntityNotFound(_0x217b54,null))['then'](removeEntity(_0x217b54,null))[_0x61b1('0x23')](handleError(_0x217b54,null));};exports[_0x61b1('0x52')]=function(_0x3c3a29,_0x287db8,_0x207b90){var _0x35cdbc={};var _0x10b9f2={};var _0x589117;var _0x576104;return db[_0x61b1('0x36')][_0x61b1('0x53')]({'where':{'id':_0x3c3a29[_0x61b1('0x51')]['id']}})['then'](handleEntityNotFound(_0x287db8,null))[_0x61b1('0x30')](function(_0x40ed37){if(_0x40ed37){_0x589117=_0x40ed37;_0x10b9f2['model']=_[_0x61b1('0x3d')](db[_0x61b1('0x54')][_0x61b1('0x37')]);_0x10b9f2['query']=_[_0x61b1('0x3d')](_0x3c3a29[_0x61b1('0x3c')]);_0x10b9f2[_0x61b1('0x3e')]=_[_0x61b1('0x3f')](_0x10b9f2['model'],_0x10b9f2[_0x61b1('0x3c')]);_0x35cdbc[_0x61b1('0x40')]=_[_0x61b1('0x3f')](_0x10b9f2[_0x61b1('0x3b')],qs[_0x61b1('0x41')](_0x3c3a29[_0x61b1('0x3c')][_0x61b1('0x41')]));_0x35cdbc['attributes']=_0x35cdbc[_0x61b1('0x40')][_0x61b1('0x55')]?_0x35cdbc[_0x61b1('0x40')]:_0x10b9f2[_0x61b1('0x3b')];_0x35cdbc[_0x61b1('0x44')]=qs[_0x61b1('0x45')](_0x3c3a29[_0x61b1('0x3c')][_0x61b1('0x45')]);_0x35cdbc[_0x61b1('0x47')]=qs[_0x61b1('0x3e')](_[_0x61b1('0x46')](_0x3c3a29[_0x61b1('0x3c')],_0x10b9f2['filters']));if(_0x3c3a29[_0x61b1('0x3c')][_0x61b1('0x56')]){_0x35cdbc[_0x61b1('0x47')]=_[_0x61b1('0x48')](_0x35cdbc['where'],{'$or':_[_0x61b1('0x35')](_0x35cdbc[_0x61b1('0x40')],function(_0x13f65f){var _0x18b38a={};_0x18b38a[_0x13f65f]={'$like':'%'+_0x3c3a29[_0x61b1('0x3c')][_0x61b1('0x56')]+'%'};return _0x18b38a;})});}_0x35cdbc=_[_0x61b1('0x48')]({},_0x35cdbc,_0x3c3a29['options']);return _0x589117[_0x61b1('0x52')](_0x35cdbc);}})[_0x61b1('0x30')](function(_0x2c4788){if(_0x2c4788){_0x576104=_0x2c4788['length'];if(!_0x3c3a29['query'][_0x61b1('0x42')]('nolimit')){_0x35cdbc['limit']=qs['limit'](_0x3c3a29[_0x61b1('0x3c')][_0x61b1('0x29')]);_0x35cdbc[_0x61b1('0x28')]=qs[_0x61b1('0x28')](_0x3c3a29[_0x61b1('0x3c')]['offset']);}return _0x589117[_0x61b1('0x52')](_0x35cdbc);}})[_0x61b1('0x30')](function(_0x25ea59){if(_0x25ea59){return _0x25ea59?{'count':_0x576104,'rows':_0x25ea59}:null;}})[_0x61b1('0x30')](respondWithResult(_0x287db8,null))[_0x61b1('0x23')](handleError(_0x287db8,null));};exports[_0x61b1('0x57')]=function(_0x290a46,_0x179ebf,_0x5aa237){var _0x1c12da={};var _0x4eb3f9={};var _0x934bfd;var _0x558166;return db['FreshdeskConfiguration'][_0x61b1('0x53')]({'where':{'id':_0x290a46['params']['id']}})[_0x61b1('0x30')](handleEntityNotFound(_0x179ebf,null))[_0x61b1('0x30')](function(_0x55eee8){if(_0x55eee8){_0x934bfd=_0x55eee8;_0x4eb3f9[_0x61b1('0x3b')]=_[_0x61b1('0x3d')](db[_0x61b1('0x54')][_0x61b1('0x37')]);_0x4eb3f9[_0x61b1('0x3c')]=_[_0x61b1('0x3d')](_0x290a46[_0x61b1('0x3c')]);_0x4eb3f9[_0x61b1('0x3e')]=_[_0x61b1('0x3f')](_0x4eb3f9['model'],_0x4eb3f9[_0x61b1('0x3c')]);_0x1c12da[_0x61b1('0x40')]=_['intersection'](_0x4eb3f9[_0x61b1('0x3b')],qs[_0x61b1('0x41')](_0x290a46[_0x61b1('0x3c')]['fields']));_0x1c12da['attributes']=_0x1c12da[_0x61b1('0x40')][_0x61b1('0x55')]?_0x1c12da[_0x61b1('0x40')]:_0x4eb3f9[_0x61b1('0x3b')];_0x1c12da[_0x61b1('0x44')]=qs['sort'](_0x290a46[_0x61b1('0x3c')][_0x61b1('0x45')]);_0x1c12da[_0x61b1('0x47')]=qs[_0x61b1('0x3e')](_['pick'](_0x290a46['query'],_0x4eb3f9[_0x61b1('0x3e')]));if(_0x290a46['query'][_0x61b1('0x56')]){_0x1c12da[_0x61b1('0x47')]=_[_0x61b1('0x48')](_0x1c12da[_0x61b1('0x47')],{'$or':_[_0x61b1('0x35')](_0x1c12da[_0x61b1('0x40')],function(_0x4fc0ad){var _0x29d731={};_0x29d731[_0x4fc0ad]={'$like':'%'+_0x290a46[_0x61b1('0x3c')]['filter']+'%'};return _0x29d731;})});}_0x1c12da=_[_0x61b1('0x48')]({},_0x1c12da,_0x290a46[_0x61b1('0x49')]);return _0x934bfd[_0x61b1('0x57')](_0x1c12da);}})[_0x61b1('0x30')](function(_0x5a3b12){if(_0x5a3b12){_0x558166=_0x5a3b12['length'];if(!_0x290a46[_0x61b1('0x3c')][_0x61b1('0x42')](_0x61b1('0x43'))){_0x1c12da[_0x61b1('0x29')]=qs['limit'](_0x290a46['query'][_0x61b1('0x29')]);_0x1c12da[_0x61b1('0x28')]=qs[_0x61b1('0x28')](_0x290a46[_0x61b1('0x3c')]['offset']);}return _0x934bfd[_0x61b1('0x57')](_0x1c12da);}})['then'](function(_0x5b920e){if(_0x5b920e){return _0x5b920e?{'count':_0x558166,'rows':_0x5b920e}:null;}})[_0x61b1('0x30')](respondWithResult(_0x179ebf,null))[_0x61b1('0x23')](handleError(_0x179ebf,null));};exports[_0x61b1('0x58')]=function(_0x31cace,_0x266683,_0x4f5534){var _0x2adf85={};var _0x30c29b={};var _0x43aa57;var _0x15e167;return db[_0x61b1('0x36')][_0x61b1('0x53')]({'where':{'id':_0x31cace[_0x61b1('0x51')]['id']}})[_0x61b1('0x30')](handleEntityNotFound(_0x266683,null))['then'](function(_0x26ccb1){if(_0x26ccb1){_0x43aa57=_0x26ccb1;_0x30c29b[_0x61b1('0x3b')]=_[_0x61b1('0x3d')](db['FreshdeskField'][_0x61b1('0x37')]);_0x30c29b['query']=_[_0x61b1('0x3d')](_0x31cace[_0x61b1('0x3c')]);_0x30c29b['filters']=_['intersection'](_0x30c29b[_0x61b1('0x3b')],_0x30c29b['query']);_0x2adf85[_0x61b1('0x40')]=_[_0x61b1('0x3f')](_0x30c29b[_0x61b1('0x3b')],qs[_0x61b1('0x41')](_0x31cace[_0x61b1('0x3c')][_0x61b1('0x41')]));_0x2adf85[_0x61b1('0x40')]=_0x2adf85[_0x61b1('0x40')][_0x61b1('0x55')]?_0x2adf85[_0x61b1('0x40')]:_0x30c29b[_0x61b1('0x3b')];_0x2adf85[_0x61b1('0x44')]=qs[_0x61b1('0x45')](_0x31cace['query'][_0x61b1('0x45')]);_0x2adf85[_0x61b1('0x47')]=qs[_0x61b1('0x3e')](_['pick'](_0x31cace[_0x61b1('0x3c')],_0x30c29b[_0x61b1('0x3e')]));if(_0x31cace[_0x61b1('0x3c')][_0x61b1('0x56')]){_0x2adf85['where']=_[_0x61b1('0x48')](_0x2adf85[_0x61b1('0x47')],{'$or':_[_0x61b1('0x35')](_0x2adf85[_0x61b1('0x40')],function(_0x57b10a){var _0x3ae803={};_0x3ae803[_0x57b10a]={'$like':'%'+_0x31cace[_0x61b1('0x3c')]['filter']+'%'};return _0x3ae803;})});}_0x2adf85=_[_0x61b1('0x48')]({},_0x2adf85,_0x31cace[_0x61b1('0x49')]);return _0x43aa57['getDescriptions'](_0x2adf85);}})['then'](function(_0x387077){if(_0x387077){_0x15e167=_0x387077[_0x61b1('0x55')];if(!_0x31cace['query'][_0x61b1('0x42')](_0x61b1('0x43'))){_0x2adf85[_0x61b1('0x29')]=qs['limit'](_0x31cace[_0x61b1('0x3c')][_0x61b1('0x29')]);_0x2adf85[_0x61b1('0x28')]=qs[_0x61b1('0x28')](_0x31cace[_0x61b1('0x3c')][_0x61b1('0x28')]);}return _0x43aa57[_0x61b1('0x58')](_0x2adf85);}})[_0x61b1('0x30')](function(_0x540d22){if(_0x540d22){return _0x540d22?{'count':_0x15e167,'rows':_0x540d22}:null;}})[_0x61b1('0x30')](respondWithResult(_0x266683,null))[_0x61b1('0x23')](handleError(_0x266683,null));};exports[_0x61b1('0x59')]=function(_0x8886f8,_0x535120,_0x55ce24){var _0x426fef={};var _0x302c57={};var _0x1393b4;var _0x143125;return db[_0x61b1('0x36')][_0x61b1('0x53')]({'where':{'id':_0x8886f8[_0x61b1('0x51')]['id']}})[_0x61b1('0x30')](handleEntityNotFound(_0x535120,null))[_0x61b1('0x30')](function(_0x553696){if(_0x553696){_0x1393b4=_0x553696;_0x302c57[_0x61b1('0x3b')]=_[_0x61b1('0x3d')](db[_0x61b1('0x5a')]['rawAttributes']);_0x302c57['query']=_['keys'](_0x8886f8[_0x61b1('0x3c')]);_0x302c57['filters']=_[_0x61b1('0x3f')](_0x302c57[_0x61b1('0x3b')],_0x302c57[_0x61b1('0x3c')]);_0x426fef['attributes']=_['intersection'](_0x302c57[_0x61b1('0x3b')],qs['fields'](_0x8886f8['query'][_0x61b1('0x41')]));_0x426fef[_0x61b1('0x40')]=_0x426fef[_0x61b1('0x40')]['length']?_0x426fef[_0x61b1('0x40')]:_0x302c57[_0x61b1('0x3b')];_0x426fef[_0x61b1('0x44')]=qs[_0x61b1('0x45')](_0x8886f8[_0x61b1('0x3c')][_0x61b1('0x45')]);_0x426fef[_0x61b1('0x47')]=qs[_0x61b1('0x3e')](_[_0x61b1('0x46')](_0x8886f8[_0x61b1('0x3c')],_0x302c57[_0x61b1('0x3e')]));if(_0x8886f8[_0x61b1('0x3c')]['filter']){_0x426fef[_0x61b1('0x47')]=_[_0x61b1('0x48')](_0x426fef[_0x61b1('0x47')],{'$or':_[_0x61b1('0x35')](_0x426fef[_0x61b1('0x40')],function(_0x2b7d66){var _0xee3a1c={};_0xee3a1c[_0x2b7d66]={'$like':'%'+_0x8886f8[_0x61b1('0x3c')][_0x61b1('0x56')]+'%'};return _0xee3a1c;})});}_0x426fef=_['merge']({},_0x426fef,_0x8886f8['options']);return _0x1393b4['getTags'](_0x426fef);}})[_0x61b1('0x30')](function(_0x21f8f5){if(_0x21f8f5){_0x143125=_0x21f8f5[_0x61b1('0x55')];if(!_0x8886f8[_0x61b1('0x3c')]['hasOwnProperty']('nolimit')){_0x426fef['limit']=qs[_0x61b1('0x29')](_0x8886f8[_0x61b1('0x3c')][_0x61b1('0x29')]);_0x426fef[_0x61b1('0x28')]=qs[_0x61b1('0x28')](_0x8886f8[_0x61b1('0x3c')][_0x61b1('0x28')]);}return _0x1393b4[_0x61b1('0x59')](_0x426fef);}})[_0x61b1('0x30')](function(_0x44b809){if(_0x44b809){return _0x44b809?{'count':_0x143125,'rows':_0x44b809}:null;}})['then'](respondWithResult(_0x535120,null))[_0x61b1('0x23')](handleError(_0x535120,null));};exports['setTags']=function(_0x4e1d2b,_0x507d9f,_0x5553a4){if(_0x4e1d2b['body']['id']){delete _0x4e1d2b['body']['id'];}return db[_0x61b1('0x36')][_0x61b1('0x53')]({'where':{'id':_0x4e1d2b[_0x61b1('0x51')]['id']}})[_0x61b1('0x30')](handleEntityNotFound(_0x507d9f,null))[_0x61b1('0x30')](function(_0x749511){if(_0x749511){return _0x749511[_0x61b1('0x5b')](_0x4e1d2b[_0x61b1('0x50')]['ids']||[]);}return null;})[_0x61b1('0x30')](respondWithResult(_0x507d9f,null))[_0x61b1('0x23')](handleError(_0x507d9f,null));}; \ No newline at end of file +var _0x1484=['Content-Range','apply','reject','save','stack','name','send','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','pick','filters','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','body','update','find','destroy','getFields','findOne','FreshdeskField','sort','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','lodash','squel','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','count','offset'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x1484,0x1a5));var _0x4148=function(_0x298de3,_0x43e88d){_0x298de3=_0x298de3-0x0;var _0x2bcf0a=_0x1484[_0x298de3];return _0x2bcf0a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4148('0x0'));var rimraf=require(_0x4148('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4148('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4148('0x3'));var Mustache=require(_0x4148('0x4'));var util=require('util');var path=require('path');var sox=require(_0x4148('0x5'));var csv=require(_0x4148('0x6'));var ejs=require(_0x4148('0x7'));var fs=require('fs');var _=require(_0x4148('0x8'));var squel=require(_0x4148('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4148('0xa'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4148('0xb'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4148('0xc'))(_0x4148('0xd'));var utils=require(_0x4148('0xe'));var config=require(_0x4148('0xf'));var licenseUtil=require(_0x4148('0x10'));var db=require(_0x4148('0x11'))['db'];var jayson=require(_0x4148('0x12'));var client=jayson[_0x4148('0x13')][_0x4148('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x347b05,_0x10424f,_0x250e7e,_0x5359d8){return new BPromise(function(_0x34b38e,_0x24696b){var _0x1e7fa5=_0x5359d8||client;return _0x1e7fa5[_0x4148('0x15')](_0x347b05,_0x250e7e)[_0x4148('0x16')](function(_0x2c5e9a){logger[_0x4148('0x17')](_0x4148('0x18'),_0x10424f,_0x4148('0x19'));logger[_0x4148('0x1a')](_0x4148('0x1b'),_0x10424f,_0x4148('0x19'),JSON[_0x4148('0x1c')](_0x2c5e9a));if(_0x2c5e9a[_0x4148('0x1d')]){if(_0x2c5e9a[_0x4148('0x1d')][_0x4148('0x1e')]===0x1f4){logger[_0x4148('0x1d')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x10424f,_0x2c5e9a[_0x4148('0x1d')][_0x4148('0x1f')]);return _0x24696b(_0x2c5e9a[_0x4148('0x1d')][_0x4148('0x1f')]);}logger[_0x4148('0x1d')](_0x4148('0x18'),_0x10424f,_0x2c5e9a[_0x4148('0x1d')][_0x4148('0x1f')]);return _0x34b38e(_0x2c5e9a[_0x4148('0x1d')][_0x4148('0x1f')]);}else{logger[_0x4148('0x17')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x10424f,_0x4148('0x19'));_0x34b38e(_0x2c5e9a[_0x4148('0x20')]['message']);}})['catch'](function(_0xd3bd19){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x10424f,_0xd3bd19);_0x24696b(_0xd3bd19);});});}function respondWithStatusCode(_0x1372fb,_0x577ddd){_0x577ddd=_0x577ddd||0xcc;return function(_0xc42f7){if(_0xc42f7){return _0x1372fb[_0x4148('0x21')](_0x577ddd);}return _0x1372fb['status'](_0x577ddd)[_0x4148('0x22')]();};}function respondWithResult(_0x39128c,_0x75d705){_0x75d705=_0x75d705||0xc8;return function(_0x51e725){if(_0x51e725){return _0x39128c[_0x4148('0x23')](_0x75d705)[_0x4148('0x24')](_0x51e725);}};}function respondWithFilteredResult(_0x403986,_0x16ff9f){return function(_0x1f557a){if(_0x1f557a){var _0x21eec6=_0x1f557a[_0x4148('0x25')],_0x3ef868=_0x16ff9f[_0x4148('0x26')],_0x273827=_0x16ff9f[_0x4148('0x26')]+_0x16ff9f['limit'],_0x3429bf;if(_0x273827>=_0x21eec6){_0x273827=_0x21eec6;_0x3429bf=0xc8;}else{_0x3429bf=0xce;}_0x403986['status'](_0x3429bf);return _0x403986['set'](_0x4148('0x27'),_0x3ef868+'-'+_0x273827+'/'+_0x21eec6)[_0x4148('0x24')](_0x1f557a);}return null;};}function patchUpdates(_0x137c93){return function(_0x2b7707){try{jsonpatch[_0x4148('0x28')](_0x2b7707,_0x137c93,!![]);}catch(_0x465bc5){return BPromise[_0x4148('0x29')](_0x465bc5);}return _0x2b7707[_0x4148('0x2a')]();};}function saveUpdates(_0x412e11,_0x31ffdd){return function(_0x1071d2){if(_0x1071d2){return _0x1071d2['update'](_0x412e11)[_0x4148('0x16')](function(_0x38ae2e){return _0x38ae2e;});}return null;};}function removeEntity(_0x3ee411,_0x5bbc88){return function(_0xdb65d5){if(_0xdb65d5){return _0xdb65d5['destroy']()[_0x4148('0x16')](function(){_0x3ee411[_0x4148('0x23')](0xcc)[_0x4148('0x22')]();});}};}function handleEntityNotFound(_0x26d0e8,_0x4c5594){return function(_0x18e011){if(!_0x18e011){_0x26d0e8['sendStatus'](0x194);}return _0x18e011;};}function handleError(_0x3c3881,_0x1c21d6){_0x1c21d6=_0x1c21d6||0x1f4;return function(_0x1a0844){logger[_0x4148('0x1d')](_0x1a0844[_0x4148('0x2b')]);if(_0x1a0844[_0x4148('0x2c')]){delete _0x1a0844[_0x4148('0x2c')];}_0x3c3881[_0x4148('0x23')](_0x1c21d6)[_0x4148('0x2d')](_0x1a0844);};}exports[_0x4148('0x2e')]=function(_0x3ef774,_0x32400f){var _0x43e438={},_0x1b91f6={},_0x5d2ac7={'count':0x0,'rows':[]};var _0x424acd=_['map'](db[_0x4148('0x2f')][_0x4148('0x30')],function(_0x127643){return{'name':_0x127643[_0x4148('0x31')],'type':_0x127643[_0x4148('0x32')][_0x4148('0x33')]};});_0x1b91f6[_0x4148('0x34')]=_['map'](_0x424acd,_0x4148('0x2c'));_0x1b91f6[_0x4148('0x35')]=_[_0x4148('0x36')](_0x3ef774['query']);_0x1b91f6['filters']=_[_0x4148('0x37')](_0x1b91f6[_0x4148('0x34')],_0x1b91f6[_0x4148('0x35')]);_0x43e438[_0x4148('0x38')]=_[_0x4148('0x37')](_0x1b91f6['model'],qs['fields'](_0x3ef774[_0x4148('0x35')][_0x4148('0x39')]));_0x43e438['attributes']=_0x43e438[_0x4148('0x38')][_0x4148('0x3a')]?_0x43e438[_0x4148('0x38')]:_0x1b91f6[_0x4148('0x34')];if(!_0x3ef774[_0x4148('0x35')][_0x4148('0x3b')](_0x4148('0x3c'))){_0x43e438[_0x4148('0x3d')]=qs[_0x4148('0x3d')](_0x3ef774['query'][_0x4148('0x3d')]);_0x43e438['offset']=qs[_0x4148('0x26')](_0x3ef774[_0x4148('0x35')][_0x4148('0x26')]);}_0x43e438[_0x4148('0x3e')]=qs['sort'](_0x3ef774[_0x4148('0x35')]['sort']);_0x43e438['where']=qs['filters'](_[_0x4148('0x3f')](_0x3ef774[_0x4148('0x35')],_0x1b91f6[_0x4148('0x40')]),_0x424acd);if(_0x3ef774[_0x4148('0x35')][_0x4148('0x41')]){_0x43e438[_0x4148('0x42')]=_[_0x4148('0x43')](_0x43e438[_0x4148('0x42')],{'$or':_[_0x4148('0x44')](_0x424acd,function(_0x5c0fd6){if(_0x5c0fd6['type']!==_0x4148('0x45')){var _0x5408f9={};_0x5408f9[_0x5c0fd6['name']]={'$like':'%'+_0x3ef774[_0x4148('0x35')][_0x4148('0x41')]+'%'};return _0x5408f9;}})});}_0x43e438=_[_0x4148('0x43')]({},_0x43e438,_0x3ef774[_0x4148('0x46')]);var _0x3be03d={'where':_0x43e438[_0x4148('0x42')]};return db[_0x4148('0x2f')][_0x4148('0x25')](_0x3be03d)[_0x4148('0x16')](function(_0x40f5dd){_0x5d2ac7[_0x4148('0x25')]=_0x40f5dd;if(_0x3ef774['query'][_0x4148('0x47')]){_0x43e438[_0x4148('0x48')]=[{'all':!![]}];}return db[_0x4148('0x2f')][_0x4148('0x49')](_0x43e438);})[_0x4148('0x16')](function(_0x42e273){_0x5d2ac7[_0x4148('0x4a')]=_0x42e273;return _0x5d2ac7;})['then'](respondWithFilteredResult(_0x32400f,_0x43e438))['catch'](handleError(_0x32400f,null));};exports[_0x4148('0x4b')]=function(_0x48a249,_0x2246d9){var _0xe91464={'raw':![],'where':{'id':_0x48a249[_0x4148('0x4c')]['id']}},_0x480829={};_0x480829[_0x4148('0x34')]=_[_0x4148('0x36')](db[_0x4148('0x2f')][_0x4148('0x30')]);_0x480829['query']=_['keys'](_0x48a249['query']);_0x480829['filters']=_[_0x4148('0x37')](_0x480829[_0x4148('0x34')],_0x480829[_0x4148('0x35')]);_0xe91464[_0x4148('0x38')]=_['intersection'](_0x480829[_0x4148('0x34')],qs[_0x4148('0x39')](_0x48a249[_0x4148('0x35')][_0x4148('0x39')]));_0xe91464['attributes']=_0xe91464[_0x4148('0x38')][_0x4148('0x3a')]?_0xe91464[_0x4148('0x38')]:_0x480829['model'];if(_0x48a249[_0x4148('0x35')][_0x4148('0x47')]){_0xe91464['include']=[{'all':!![]}];}_0xe91464=_[_0x4148('0x43')]({},_0xe91464,_0x48a249[_0x4148('0x46')]);return db[_0x4148('0x2f')]['find'](_0xe91464)['then'](handleEntityNotFound(_0x2246d9,null))['then'](respondWithResult(_0x2246d9,null))[_0x4148('0x4d')](handleError(_0x2246d9,null));};exports[_0x4148('0x4e')]=function(_0x37380d,_0x5566f5){return db[_0x4148('0x2f')][_0x4148('0x4e')](_0x37380d[_0x4148('0x4f')],{})['then'](respondWithResult(_0x5566f5,0xc9))[_0x4148('0x4d')](handleError(_0x5566f5,null));};exports[_0x4148('0x50')]=function(_0x434c39,_0x538a68){if(_0x434c39[_0x4148('0x4f')]['id']){delete _0x434c39[_0x4148('0x4f')]['id'];}return db[_0x4148('0x2f')][_0x4148('0x51')]({'where':{'id':_0x434c39[_0x4148('0x4c')]['id']}})[_0x4148('0x16')](handleEntityNotFound(_0x538a68,null))[_0x4148('0x16')](saveUpdates(_0x434c39[_0x4148('0x4f')],null))['then'](respondWithResult(_0x538a68,null))[_0x4148('0x4d')](handleError(_0x538a68,null));};exports[_0x4148('0x52')]=function(_0x82fc68,_0xd88d70){return db['FreshdeskConfiguration'][_0x4148('0x51')]({'where':{'id':_0x82fc68[_0x4148('0x4c')]['id']}})[_0x4148('0x16')](handleEntityNotFound(_0xd88d70,null))[_0x4148('0x16')](removeEntity(_0xd88d70,null))[_0x4148('0x4d')](handleError(_0xd88d70,null));};exports[_0x4148('0x53')]=function(_0x28f67e,_0x824c92,_0x29ba79){var _0x5f1779={};var _0x31279f={};var _0x2bd8d0;var _0x5a9e3e;return db[_0x4148('0x2f')][_0x4148('0x54')]({'where':{'id':_0x28f67e[_0x4148('0x4c')]['id']}})[_0x4148('0x16')](handleEntityNotFound(_0x824c92,null))['then'](function(_0x387ec4){if(_0x387ec4){_0x2bd8d0=_0x387ec4;_0x31279f[_0x4148('0x34')]=_[_0x4148('0x36')](db[_0x4148('0x55')][_0x4148('0x30')]);_0x31279f['query']=_[_0x4148('0x36')](_0x28f67e[_0x4148('0x35')]);_0x31279f[_0x4148('0x40')]=_[_0x4148('0x37')](_0x31279f['model'],_0x31279f[_0x4148('0x35')]);_0x5f1779[_0x4148('0x38')]=_[_0x4148('0x37')](_0x31279f[_0x4148('0x34')],qs['fields'](_0x28f67e[_0x4148('0x35')][_0x4148('0x39')]));_0x5f1779[_0x4148('0x38')]=_0x5f1779[_0x4148('0x38')][_0x4148('0x3a')]?_0x5f1779[_0x4148('0x38')]:_0x31279f[_0x4148('0x34')];_0x5f1779[_0x4148('0x3e')]=qs[_0x4148('0x56')](_0x28f67e[_0x4148('0x35')][_0x4148('0x56')]);_0x5f1779[_0x4148('0x42')]=qs[_0x4148('0x40')](_[_0x4148('0x3f')](_0x28f67e[_0x4148('0x35')],_0x31279f[_0x4148('0x40')]));if(_0x28f67e[_0x4148('0x35')][_0x4148('0x41')]){_0x5f1779[_0x4148('0x42')]=_['merge'](_0x5f1779[_0x4148('0x42')],{'$or':_[_0x4148('0x44')](_0x5f1779[_0x4148('0x38')],function(_0x15a62b){var _0x5ce00b={};_0x5ce00b[_0x15a62b]={'$like':'%'+_0x28f67e[_0x4148('0x35')][_0x4148('0x41')]+'%'};return _0x5ce00b;})});}_0x5f1779=_[_0x4148('0x43')]({},_0x5f1779,_0x28f67e[_0x4148('0x46')]);return _0x2bd8d0[_0x4148('0x53')](_0x5f1779);}})[_0x4148('0x16')](function(_0x1d4066){if(_0x1d4066){_0x5a9e3e=_0x1d4066[_0x4148('0x3a')];if(!_0x28f67e[_0x4148('0x35')][_0x4148('0x3b')](_0x4148('0x3c'))){_0x5f1779[_0x4148('0x3d')]=qs[_0x4148('0x3d')](_0x28f67e[_0x4148('0x35')][_0x4148('0x3d')]);_0x5f1779['offset']=qs[_0x4148('0x26')](_0x28f67e['query'][_0x4148('0x26')]);}return _0x2bd8d0[_0x4148('0x53')](_0x5f1779);}})[_0x4148('0x16')](function(_0x15ff94){if(_0x15ff94){return _0x15ff94?{'count':_0x5a9e3e,'rows':_0x15ff94}:null;}})[_0x4148('0x16')](respondWithResult(_0x824c92,null))[_0x4148('0x4d')](handleError(_0x824c92,null));};exports['getSubjects']=function(_0x14e05c,_0xe28f61,_0x5501cf){var _0x43f504={};var _0x3b1d04={};var _0x2a532a;var _0x3cb8b6;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x14e05c['params']['id']}})[_0x4148('0x16')](handleEntityNotFound(_0xe28f61,null))[_0x4148('0x16')](function(_0x44ca90){if(_0x44ca90){_0x2a532a=_0x44ca90;_0x3b1d04[_0x4148('0x34')]=_[_0x4148('0x36')](db[_0x4148('0x55')][_0x4148('0x30')]);_0x3b1d04[_0x4148('0x35')]=_[_0x4148('0x36')](_0x14e05c[_0x4148('0x35')]);_0x3b1d04[_0x4148('0x40')]=_[_0x4148('0x37')](_0x3b1d04[_0x4148('0x34')],_0x3b1d04['query']);_0x43f504[_0x4148('0x38')]=_[_0x4148('0x37')](_0x3b1d04[_0x4148('0x34')],qs[_0x4148('0x39')](_0x14e05c[_0x4148('0x35')]['fields']));_0x43f504[_0x4148('0x38')]=_0x43f504[_0x4148('0x38')]['length']?_0x43f504[_0x4148('0x38')]:_0x3b1d04['model'];_0x43f504[_0x4148('0x3e')]=qs['sort'](_0x14e05c[_0x4148('0x35')][_0x4148('0x56')]);_0x43f504[_0x4148('0x42')]=qs[_0x4148('0x40')](_[_0x4148('0x3f')](_0x14e05c[_0x4148('0x35')],_0x3b1d04[_0x4148('0x40')]));if(_0x14e05c[_0x4148('0x35')][_0x4148('0x41')]){_0x43f504[_0x4148('0x42')]=_[_0x4148('0x43')](_0x43f504[_0x4148('0x42')],{'$or':_['map'](_0x43f504[_0x4148('0x38')],function(_0xdf1b67){var _0x556db8={};_0x556db8[_0xdf1b67]={'$like':'%'+_0x14e05c[_0x4148('0x35')][_0x4148('0x41')]+'%'};return _0x556db8;})});}_0x43f504=_[_0x4148('0x43')]({},_0x43f504,_0x14e05c[_0x4148('0x46')]);return _0x2a532a[_0x4148('0x57')](_0x43f504);}})[_0x4148('0x16')](function(_0x1d69a8){if(_0x1d69a8){_0x3cb8b6=_0x1d69a8[_0x4148('0x3a')];if(!_0x14e05c[_0x4148('0x35')][_0x4148('0x3b')](_0x4148('0x3c'))){_0x43f504['limit']=qs[_0x4148('0x3d')](_0x14e05c[_0x4148('0x35')][_0x4148('0x3d')]);_0x43f504[_0x4148('0x26')]=qs[_0x4148('0x26')](_0x14e05c[_0x4148('0x35')][_0x4148('0x26')]);}return _0x2a532a['getSubjects'](_0x43f504);}})[_0x4148('0x16')](function(_0x958fd6){if(_0x958fd6){return _0x958fd6?{'count':_0x3cb8b6,'rows':_0x958fd6}:null;}})[_0x4148('0x16')](respondWithResult(_0xe28f61,null))[_0x4148('0x4d')](handleError(_0xe28f61,null));};exports[_0x4148('0x58')]=function(_0x2efd2f,_0x2966e0,_0x24049f){var _0x8510b3={};var _0x46e783={};var _0x5975b0;var _0x423526;return db[_0x4148('0x2f')][_0x4148('0x54')]({'where':{'id':_0x2efd2f['params']['id']}})[_0x4148('0x16')](handleEntityNotFound(_0x2966e0,null))[_0x4148('0x16')](function(_0xf89d38){if(_0xf89d38){_0x5975b0=_0xf89d38;_0x46e783['model']=_['keys'](db[_0x4148('0x55')]['rawAttributes']);_0x46e783[_0x4148('0x35')]=_[_0x4148('0x36')](_0x2efd2f[_0x4148('0x35')]);_0x46e783[_0x4148('0x40')]=_[_0x4148('0x37')](_0x46e783['model'],_0x46e783[_0x4148('0x35')]);_0x8510b3['attributes']=_['intersection'](_0x46e783[_0x4148('0x34')],qs[_0x4148('0x39')](_0x2efd2f[_0x4148('0x35')][_0x4148('0x39')]));_0x8510b3[_0x4148('0x38')]=_0x8510b3[_0x4148('0x38')]['length']?_0x8510b3[_0x4148('0x38')]:_0x46e783[_0x4148('0x34')];_0x8510b3[_0x4148('0x3e')]=qs[_0x4148('0x56')](_0x2efd2f[_0x4148('0x35')][_0x4148('0x56')]);_0x8510b3[_0x4148('0x42')]=qs[_0x4148('0x40')](_[_0x4148('0x3f')](_0x2efd2f[_0x4148('0x35')],_0x46e783[_0x4148('0x40')]));if(_0x2efd2f[_0x4148('0x35')][_0x4148('0x41')]){_0x8510b3[_0x4148('0x42')]=_['merge'](_0x8510b3[_0x4148('0x42')],{'$or':_[_0x4148('0x44')](_0x8510b3[_0x4148('0x38')],function(_0x34eef2){var _0x12be20={};_0x12be20[_0x34eef2]={'$like':'%'+_0x2efd2f[_0x4148('0x35')]['filter']+'%'};return _0x12be20;})});}_0x8510b3=_[_0x4148('0x43')]({},_0x8510b3,_0x2efd2f[_0x4148('0x46')]);return _0x5975b0[_0x4148('0x58')](_0x8510b3);}})[_0x4148('0x16')](function(_0xacc21b){if(_0xacc21b){_0x423526=_0xacc21b[_0x4148('0x3a')];if(!_0x2efd2f[_0x4148('0x35')][_0x4148('0x3b')](_0x4148('0x3c'))){_0x8510b3[_0x4148('0x3d')]=qs[_0x4148('0x3d')](_0x2efd2f['query'][_0x4148('0x3d')]);_0x8510b3[_0x4148('0x26')]=qs[_0x4148('0x26')](_0x2efd2f['query']['offset']);}return _0x5975b0['getDescriptions'](_0x8510b3);}})['then'](function(_0x580593){if(_0x580593){return _0x580593?{'count':_0x423526,'rows':_0x580593}:null;}})[_0x4148('0x16')](respondWithResult(_0x2966e0,null))[_0x4148('0x4d')](handleError(_0x2966e0,null));};exports[_0x4148('0x59')]=function(_0x126f0f,_0x17d1f4,_0x5a8330){var _0x248fb0={};var _0x40874b={};var _0x240ec3;var _0x398571;return db[_0x4148('0x2f')][_0x4148('0x54')]({'where':{'id':_0x126f0f['params']['id']}})['then'](handleEntityNotFound(_0x17d1f4,null))[_0x4148('0x16')](function(_0x134a79){if(_0x134a79){_0x240ec3=_0x134a79;_0x40874b[_0x4148('0x34')]=_[_0x4148('0x36')](db['Tag'][_0x4148('0x30')]);_0x40874b[_0x4148('0x35')]=_['keys'](_0x126f0f[_0x4148('0x35')]);_0x40874b[_0x4148('0x40')]=_[_0x4148('0x37')](_0x40874b[_0x4148('0x34')],_0x40874b[_0x4148('0x35')]);_0x248fb0[_0x4148('0x38')]=_['intersection'](_0x40874b[_0x4148('0x34')],qs[_0x4148('0x39')](_0x126f0f['query'][_0x4148('0x39')]));_0x248fb0['attributes']=_0x248fb0[_0x4148('0x38')][_0x4148('0x3a')]?_0x248fb0[_0x4148('0x38')]:_0x40874b[_0x4148('0x34')];_0x248fb0[_0x4148('0x3e')]=qs[_0x4148('0x56')](_0x126f0f['query'][_0x4148('0x56')]);_0x248fb0[_0x4148('0x42')]=qs[_0x4148('0x40')](_['pick'](_0x126f0f[_0x4148('0x35')],_0x40874b['filters']));if(_0x126f0f[_0x4148('0x35')]['filter']){_0x248fb0['where']=_[_0x4148('0x43')](_0x248fb0[_0x4148('0x42')],{'$or':_[_0x4148('0x44')](_0x248fb0[_0x4148('0x38')],function(_0x2ca198){var _0x3ecaba={};_0x3ecaba[_0x2ca198]={'$like':'%'+_0x126f0f['query'][_0x4148('0x41')]+'%'};return _0x3ecaba;})});}_0x248fb0=_[_0x4148('0x43')]({},_0x248fb0,_0x126f0f['options']);return _0x240ec3[_0x4148('0x59')](_0x248fb0);}})['then'](function(_0x17050c){if(_0x17050c){_0x398571=_0x17050c[_0x4148('0x3a')];if(!_0x126f0f['query'][_0x4148('0x3b')]('nolimit')){_0x248fb0['limit']=qs[_0x4148('0x3d')](_0x126f0f[_0x4148('0x35')][_0x4148('0x3d')]);_0x248fb0[_0x4148('0x26')]=qs[_0x4148('0x26')](_0x126f0f[_0x4148('0x35')][_0x4148('0x26')]);}return _0x240ec3[_0x4148('0x59')](_0x248fb0);}})[_0x4148('0x16')](function(_0x51db57){if(_0x51db57){return _0x51db57?{'count':_0x398571,'rows':_0x51db57}:null;}})['then'](respondWithResult(_0x17d1f4,null))[_0x4148('0x4d')](handleError(_0x17d1f4,null));};exports[_0x4148('0x5a')]=function(_0xa55d60,_0xc27738,_0x21c862){if(_0xa55d60['body']['id']){delete _0xa55d60['body']['id'];}return db['FreshdeskConfiguration'][_0x4148('0x54')]({'where':{'id':_0xa55d60[_0x4148('0x4c')]['id']}})[_0x4148('0x16')](handleEntityNotFound(_0xc27738,null))[_0x4148('0x16')](function(_0x521791){if(_0x521791){return _0x521791[_0x4148('0x5a')](_0xa55d60[_0x4148('0x4f')][_0x4148('0x5b')]||[]);}return null;})[_0x4148('0x16')](respondWithResult(_0xc27738,null))[_0x4148('0x4d')](handleError(_0xc27738,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 56ceb8f..706bb73 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 _0xe748=['int_freshdesk_configurations','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe748,0xfe));var _0x8e74=function(_0x4a9b81,_0x618006){_0x4a9b81=_0x4a9b81-0x0;var _0x537749=_0xe748[_0x4a9b81];return _0x537749;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8e74('0x0'))(_0x8e74('0x1'));var moment=require(_0x8e74('0x2'));var BPromise=require(_0x8e74('0x3'));var rp=require(_0x8e74('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8e74('0x5'));var config=require(_0x8e74('0x6'));var attributes=require(_0x8e74('0x7'));module[_0x8e74('0x8')]=function(_0xa60638,_0x380345){return _0xa60638[_0x8e74('0x9')]('FreshdeskConfiguration',attributes,{'tableName':_0x8e74('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb90f=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','lodash'];(function(_0x435964,_0x9755b){var _0x3ae515=function(_0x5c01cb){while(--_0x5c01cb){_0x435964['push'](_0x435964['shift']());}};_0x3ae515(++_0x9755b);}(_0xb90f,0xdf));var _0xfb90=function(_0x570c58,_0x1212a2){_0x570c58=_0x570c58-0x0;var _0x417184=_0xb90f[_0x570c58];return _0x417184;};'use strict';var _=require(_0xfb90('0x0'));var util=require(_0xfb90('0x1'));var logger=require(_0xfb90('0x2'))(_0xfb90('0x3'));var moment=require(_0xfb90('0x4'));var BPromise=require(_0xfb90('0x5'));var rp=require(_0xfb90('0x6'));var fs=require('fs');var path=require(_0xfb90('0x7'));var rimraf=require(_0xfb90('0x8'));var config=require(_0xfb90('0x9'));var attributes=require(_0xfb90('0xa'));module[_0xfb90('0xb')]=function(_0x3da0ab,_0x3fc3cc){return _0x3da0ab[_0xfb90('0xc')](_0xfb90('0xd'),attributes,{'tableName':'int_freshdesk_configurations','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 07dd328..bc066be 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 _0x049a=['FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x178668,_0x1ec300){var _0x26107d=function(_0x4c0aa8){while(--_0x4c0aa8){_0x178668['push'](_0x178668['shift']());}};_0x26107d(++_0x1ec300);}(_0x049a,0x179));var _0xa049=function(_0x9d14e3,_0x5a6072){_0x9d14e3=_0x9d14e3-0x0;var _0x19bf32=_0x049a[_0x9d14e3];return _0x19bf32;};'use strict';var _=require(_0xa049('0x0'));var util=require(_0xa049('0x1'));var moment=require('moment');var BPromise=require(_0xa049('0x2'));var rs=require(_0xa049('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa049('0x4'))['db'];var utils=require(_0xa049('0x5'));var logger=require(_0xa049('0x6'))(_0xa049('0x7'));var config=require(_0xa049('0x8'));var jayson=require(_0xa049('0x9'));var client=jayson['client'][_0xa049('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16245d,_0x543c8b,_0x3074fa){return new BPromise(function(_0x34a1d0,_0x165b91){return client[_0xa049('0xb')](_0x16245d,_0x3074fa)[_0xa049('0xc')](function(_0x2febe9){logger['info'](_0xa049('0xd'),_0x543c8b,'request\x20sent');logger['debug'](_0xa049('0xe'),_0x543c8b,_0xa049('0xf'),JSON[_0xa049('0x10')](_0x2febe9));if(_0x2febe9[_0xa049('0x11')]){if(_0x2febe9['error'][_0xa049('0x12')]===0x1f4){logger[_0xa049('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x543c8b,_0x2febe9[_0xa049('0x11')][_0xa049('0x13')]);return _0x165b91(_0x2febe9[_0xa049('0x11')]['message']);}logger['error'](_0xa049('0xd'),_0x543c8b,_0x2febe9[_0xa049('0x11')]['message']);return _0x34a1d0(_0x2febe9['error'][_0xa049('0x13')]);}else{logger[_0xa049('0x14')](_0xa049('0xd'),_0x543c8b,_0xa049('0xf'));_0x34a1d0(_0x2febe9[_0xa049('0x15')]['message']);}})[_0xa049('0x16')](function(_0x5348e9){logger['error'](_0xa049('0xd'),_0x543c8b,_0x5348e9);_0x165b91(_0x5348e9);});});} \ No newline at end of file +var _0x34ea=['then','info','request\x20sent','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request'];(function(_0x1e1319,_0x4e40d1){var _0x591ef0=function(_0x265c16){while(--_0x265c16){_0x1e1319['push'](_0x1e1319['shift']());}};_0x591ef0(++_0x4e40d1);}(_0x34ea,0xa8));var _0xa34e=function(_0x5ce687,_0x54b157){_0x5ce687=_0x5ce687-0x0;var _0x23fc69=_0x34ea[_0x5ce687];return _0x23fc69;};'use strict';var _=require(_0xa34e('0x0'));var util=require(_0xa34e('0x1'));var moment=require(_0xa34e('0x2'));var BPromise=require(_0xa34e('0x3'));var rs=require(_0xa34e('0x4'));var fs=require('fs');var Redis=require(_0xa34e('0x5'));var db=require(_0xa34e('0x6'))['db'];var utils=require(_0xa34e('0x7'));var logger=require(_0xa34e('0x8'))(_0xa34e('0x9'));var config=require('../../config/environment');var jayson=require(_0xa34e('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x27dad6,_0x121529,_0x39a321){return new BPromise(function(_0x4b85eb,_0xe6fe7a){return client[_0xa34e('0xb')](_0x27dad6,_0x39a321)[_0xa34e('0xc')](function(_0xcf69be){logger[_0xa34e('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x121529,_0xa34e('0xe'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x121529,_0xa34e('0xe'),JSON['stringify'](_0xcf69be));if(_0xcf69be[_0xa34e('0xf')]){if(_0xcf69be[_0xa34e('0xf')][_0xa34e('0x10')]===0x1f4){logger[_0xa34e('0xf')](_0xa34e('0x11'),_0x121529,_0xcf69be['error'][_0xa34e('0x12')]);return _0xe6fe7a(_0xcf69be[_0xa34e('0xf')][_0xa34e('0x12')]);}logger[_0xa34e('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x121529,_0xcf69be['error'][_0xa34e('0x12')]);return _0x4b85eb(_0xcf69be['error'][_0xa34e('0x12')]);}else{logger[_0xa34e('0xd')](_0xa34e('0x11'),_0x121529,_0xa34e('0xe'));_0x4b85eb(_0xcf69be[_0xa34e('0x13')]['message']);}})['catch'](function(_0x8e75ad){logger[_0xa34e('0xf')](_0xa34e('0x11'),_0x121529,_0x8e75ad);_0xe6fe7a(_0x8e75ad);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 546f216..d8f858d 100644 --- a/server/api/intFreshdeskField/index.js +++ b/server/api/intFreshdeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['/:id','isAuthenticated','show','create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x3fa479,_0x222259){var _0x23feb5=function(_0x115e68){while(--_0x115e68){_0x3fa479['push'](_0x3fa479['shift']());}};_0x23feb5(++_0x222259);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['post']('/',auth[_0x49c4('0x9')](),controller[_0x49c4('0xb')]);router[_0x49c4('0xc')](_0x49c4('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x49c4('0xd')](_0x49c4('0x8'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file +var _0x70e0=['create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','post','isAuthenticated'];(function(_0x38aa04,_0x2c8039){var _0x39bb22=function(_0x5b4e9a){while(--_0x5b4e9a){_0x38aa04['push'](_0x38aa04['shift']());}};_0x39bb22(++_0x2c8039);}(_0x70e0,0x17b));var _0x070e=function(_0x55b547,_0x26d1aa){_0x55b547=_0x55b547-0x0;var _0x321dc0=_0x70e0[_0x55b547];return _0x321dc0;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./intFreshdeskField.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0xa')]('/',auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')](_0x070e('0xe'),auth[_0x070e('0xb')](),controller['update']);router['delete'](_0x070e('0xe'),auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);module[_0x070e('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 25a6baa..137965a 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 _0x3d5d=['exports','variable','customVariable','keyValue','STRING','ENUM','string','BOOLEAN','sequelize'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x3d5d,0x104));var _0xd3d5=function(_0x34b1b8,_0x54c9bf){_0x34b1b8=_0x34b1b8-0x0;var _0x542dd8=_0x3d5d[_0x34b1b8];return _0x542dd8;};'use strict';var Sequelize=require(_0xd3d5('0x0'));module[_0xd3d5('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xd3d5('0x2'),_0xd3d5('0x3'),_0xd3d5('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd3d5('0x5')]},'key':{'type':Sequelize[_0xd3d5('0x5')]},'keyType':{'type':Sequelize[_0xd3d5('0x6')](_0xd3d5('0x7'),'variable',_0xd3d5('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xd3d5('0x5')]},'nameField':{'type':Sequelize[_0xd3d5('0x5')]},'customField':{'type':Sequelize[_0xd3d5('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd3d5('0x5')]}}; \ No newline at end of file +var _0x5270=['STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable'];(function(_0x28d055,_0x278cc2){var _0x255120=function(_0x92a696){while(--_0x92a696){_0x28d055['push'](_0x28d055['shift']());}};_0x255120(++_0x278cc2);}(_0x5270,0xab));var _0x0527=function(_0x2b8603,_0x23e8cd){_0x2b8603=_0x2b8603-0x0;var _0x453e6b=_0x5270[_0x2b8603];return _0x453e6b;};'use strict';var Sequelize=require(_0x0527('0x0'));module[_0x0527('0x1')]={'type':{'type':Sequelize['ENUM'](_0x0527('0x2'),_0x0527('0x3'),_0x0527('0x4'),'keyValue'),'defaultValue':_0x0527('0x2')},'content':{'type':Sequelize[_0x0527('0x5')]},'key':{'type':Sequelize[_0x0527('0x5')]},'keyType':{'type':Sequelize[_0x0527('0x6')]('string',_0x0527('0x3'),_0x0527('0x4'))},'keyContent':{'type':Sequelize[_0x0527('0x5')]},'idField':{'type':Sequelize[_0x0527('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0527('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0527('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 05d828e..5e7c869 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 _0xc4b6=['keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','filters','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','Content-Range','json','apply','reject','save','update','then','end','stack','name','map','FreshdeskField','rawAttributes','key','model','query'];(function(_0x2b59f7,_0x5cf2af){var _0x7ffe2e=function(_0x25434c){while(--_0x25434c){_0x2b59f7['push'](_0x2b59f7['shift']());}};_0x7ffe2e(++_0x5cf2af);}(_0xc4b6,0x1b8));var _0x6c4b=function(_0x2cb237,_0x393e4a){_0x2cb237=_0x2cb237-0x0;var _0x1ce9c9=_0xc4b6[_0x2cb237];return _0x1ce9c9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6c4b('0x0'));var rimraf=require(_0x6c4b('0x1'));var zipdir=require(_0x6c4b('0x2'));var jsonpatch=require(_0x6c4b('0x3'));var rp=require('request-promise');var moment=require(_0x6c4b('0x4'));var BPromise=require(_0x6c4b('0x5'));var Mustache=require(_0x6c4b('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6c4b('0x7'));var csv=require(_0x6c4b('0x8'));var ejs=require(_0x6c4b('0x9'));var fs=require('fs');var _=require(_0x6c4b('0xa'));var squel=require(_0x6c4b('0xb'));var crypto=require(_0x6c4b('0xc'));var jsforce=require(_0x6c4b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6c4b('0x8'));var querystring=require(_0x6c4b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6c4b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6c4b('0x10'));var hardwareService=require(_0x6c4b('0x11'));var logger=require(_0x6c4b('0x12'))(_0x6c4b('0x13'));var utils=require(_0x6c4b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6c4b('0x15'));var db=require(_0x6c4b('0x16'))['db'];function respondWithStatusCode(_0x510419,_0x326113){_0x326113=_0x326113||0xcc;return function(_0x23559b){if(_0x23559b){return _0x510419[_0x6c4b('0x17')](_0x326113);}return _0x510419['status'](_0x326113)['end']();};}function respondWithResult(_0x56a684,_0x2142f3){_0x2142f3=_0x2142f3||0xc8;return function(_0x36797e){if(_0x36797e){return _0x56a684[_0x6c4b('0x18')](_0x2142f3)['json'](_0x36797e);}};}function respondWithFilteredResult(_0x4b9ecf,_0xa6fcf){return function(_0x1a10dc){if(_0x1a10dc){var _0x326583=_0x1a10dc[_0x6c4b('0x19')],_0x3f010e=_0xa6fcf[_0x6c4b('0x1a')],_0x58c1cb=_0xa6fcf['offset']+_0xa6fcf['limit'],_0x344db8;if(_0x58c1cb>=_0x326583){_0x58c1cb=_0x326583;_0x344db8=0xc8;}else{_0x344db8=0xce;}_0x4b9ecf['status'](_0x344db8);return _0x4b9ecf['set'](_0x6c4b('0x1b'),_0x3f010e+'-'+_0x58c1cb+'/'+_0x326583)[_0x6c4b('0x1c')](_0x1a10dc);}return null;};}function patchUpdates(_0x28ffbe){return function(_0x2af2b8){try{jsonpatch[_0x6c4b('0x1d')](_0x2af2b8,_0x28ffbe,!![]);}catch(_0x252448){return BPromise[_0x6c4b('0x1e')](_0x252448);}return _0x2af2b8[_0x6c4b('0x1f')]();};}function saveUpdates(_0x8c75c3,_0x538c44){return function(_0x317f1d){if(_0x317f1d){return _0x317f1d[_0x6c4b('0x20')](_0x8c75c3)[_0x6c4b('0x21')](function(_0x197f24){return _0x197f24;});}return null;};}function removeEntity(_0x396ef3,_0x4068af){return function(_0x42d4f2){if(_0x42d4f2){return _0x42d4f2['destroy']()[_0x6c4b('0x21')](function(){_0x396ef3['status'](0xcc)[_0x6c4b('0x22')]();});}};}function handleEntityNotFound(_0x536d5f,_0x1e3fd4){return function(_0x4d5297){if(!_0x4d5297){_0x536d5f[_0x6c4b('0x17')](0x194);}return _0x4d5297;};}function handleError(_0x432e3b,_0x46ab46){_0x46ab46=_0x46ab46||0x1f4;return function(_0x295c25){logger['error'](_0x295c25[_0x6c4b('0x23')]);if(_0x295c25[_0x6c4b('0x24')]){delete _0x295c25['name'];}_0x432e3b['status'](_0x46ab46)['send'](_0x295c25);};}exports['index']=function(_0x101885,_0x141f06){var _0x1dcf68={},_0x5d2ce5={},_0x5a2b36={'count':0x0,'rows':[]};var _0x43ad65=_[_0x6c4b('0x25')](db[_0x6c4b('0x26')][_0x6c4b('0x27')],function(_0x4f1394){return{'name':_0x4f1394['fieldName'],'type':_0x4f1394['type'][_0x6c4b('0x28')]};});_0x5d2ce5[_0x6c4b('0x29')]=_[_0x6c4b('0x25')](_0x43ad65,_0x6c4b('0x24'));_0x5d2ce5[_0x6c4b('0x2a')]=_[_0x6c4b('0x2b')](_0x101885[_0x6c4b('0x2a')]);_0x5d2ce5['filters']=_[_0x6c4b('0x2c')](_0x5d2ce5[_0x6c4b('0x29')],_0x5d2ce5[_0x6c4b('0x2a')]);_0x1dcf68[_0x6c4b('0x2d')]=_[_0x6c4b('0x2c')](_0x5d2ce5['model'],qs[_0x6c4b('0x2e')](_0x101885[_0x6c4b('0x2a')][_0x6c4b('0x2e')]));_0x1dcf68[_0x6c4b('0x2d')]=_0x1dcf68[_0x6c4b('0x2d')][_0x6c4b('0x2f')]?_0x1dcf68[_0x6c4b('0x2d')]:_0x5d2ce5['model'];if(!_0x101885[_0x6c4b('0x2a')][_0x6c4b('0x30')](_0x6c4b('0x31'))){_0x1dcf68[_0x6c4b('0x32')]=qs[_0x6c4b('0x32')](_0x101885[_0x6c4b('0x2a')][_0x6c4b('0x32')]);_0x1dcf68[_0x6c4b('0x1a')]=qs[_0x6c4b('0x1a')](_0x101885['query'][_0x6c4b('0x1a')]);}_0x1dcf68['order']=qs[_0x6c4b('0x33')](_0x101885['query'][_0x6c4b('0x33')]);_0x1dcf68['where']=qs[_0x6c4b('0x34')](_[_0x6c4b('0x35')](_0x101885[_0x6c4b('0x2a')],_0x5d2ce5[_0x6c4b('0x34')]),_0x43ad65);if(_0x101885[_0x6c4b('0x2a')][_0x6c4b('0x36')]){_0x1dcf68['where']=_[_0x6c4b('0x37')](_0x1dcf68[_0x6c4b('0x38')],{'$or':_[_0x6c4b('0x25')](_0x43ad65,function(_0x364a96){if(_0x364a96['type']!==_0x6c4b('0x39')){var _0x3acff4={};_0x3acff4[_0x364a96[_0x6c4b('0x24')]]={'$like':'%'+_0x101885['query'][_0x6c4b('0x36')]+'%'};return _0x3acff4;}})});}_0x1dcf68=_[_0x6c4b('0x37')]({},_0x1dcf68,_0x101885['options']);var _0x4b04c4={'where':_0x1dcf68[_0x6c4b('0x38')]};return db['FreshdeskField'][_0x6c4b('0x19')](_0x4b04c4)[_0x6c4b('0x21')](function(_0x2c56f0){_0x5a2b36['count']=_0x2c56f0;if(_0x101885['query'][_0x6c4b('0x3a')]){_0x1dcf68[_0x6c4b('0x3b')]=[{'all':!![]}];}return db['FreshdeskField'][_0x6c4b('0x3c')](_0x1dcf68);})[_0x6c4b('0x21')](function(_0x16c998){_0x5a2b36[_0x6c4b('0x3d')]=_0x16c998;return _0x5a2b36;})[_0x6c4b('0x21')](respondWithFilteredResult(_0x141f06,_0x1dcf68))[_0x6c4b('0x3e')](handleError(_0x141f06,null));};exports['show']=function(_0x1df574,_0x7be765){var _0x267535={'raw':!![],'where':{'id':_0x1df574[_0x6c4b('0x3f')]['id']}},_0x46c3ce={};_0x46c3ce[_0x6c4b('0x29')]=_[_0x6c4b('0x2b')](db['FreshdeskField']['rawAttributes']);_0x46c3ce[_0x6c4b('0x2a')]=_[_0x6c4b('0x2b')](_0x1df574[_0x6c4b('0x2a')]);_0x46c3ce['filters']=_[_0x6c4b('0x2c')](_0x46c3ce[_0x6c4b('0x29')],_0x46c3ce[_0x6c4b('0x2a')]);_0x267535[_0x6c4b('0x2d')]=_['intersection'](_0x46c3ce['model'],qs['fields'](_0x1df574[_0x6c4b('0x2a')]['fields']));_0x267535[_0x6c4b('0x2d')]=_0x267535[_0x6c4b('0x2d')][_0x6c4b('0x2f')]?_0x267535[_0x6c4b('0x2d')]:_0x46c3ce[_0x6c4b('0x29')];if(_0x1df574['query'][_0x6c4b('0x3a')]){_0x267535[_0x6c4b('0x3b')]=[{'all':!![]}];}_0x267535=_[_0x6c4b('0x37')]({},_0x267535,_0x1df574[_0x6c4b('0x40')]);return db[_0x6c4b('0x26')][_0x6c4b('0x41')](_0x267535)[_0x6c4b('0x21')](handleEntityNotFound(_0x7be765,null))[_0x6c4b('0x21')](respondWithResult(_0x7be765,null))[_0x6c4b('0x3e')](handleError(_0x7be765,null));};exports[_0x6c4b('0x42')]=function(_0xdaa595,_0x4ffcc4){return db[_0x6c4b('0x26')][_0x6c4b('0x42')](_0xdaa595[_0x6c4b('0x43')],{})[_0x6c4b('0x21')](respondWithResult(_0x4ffcc4,0xc9))[_0x6c4b('0x3e')](handleError(_0x4ffcc4,null));};exports[_0x6c4b('0x20')]=function(_0x462f64,_0x40829f){if(_0x462f64[_0x6c4b('0x43')]['id']){delete _0x462f64[_0x6c4b('0x43')]['id'];}return db['FreshdeskField'][_0x6c4b('0x41')]({'where':{'id':_0x462f64[_0x6c4b('0x3f')]['id']}})[_0x6c4b('0x21')](handleEntityNotFound(_0x40829f,null))[_0x6c4b('0x21')](saveUpdates(_0x462f64['body'],null))[_0x6c4b('0x21')](respondWithResult(_0x40829f,null))['catch'](handleError(_0x40829f,null));};exports[_0x6c4b('0x44')]=function(_0x58ac67,_0x1fec87){return db[_0x6c4b('0x26')][_0x6c4b('0x41')]({'where':{'id':_0x58ac67[_0x6c4b('0x3f')]['id']}})[_0x6c4b('0x21')](handleEntityNotFound(_0x1fec87,null))[_0x6c4b('0x21')](removeEntity(_0x1fec87,null))[_0x6c4b('0x3e')](handleError(_0x1fec87,null));}; \ No newline at end of file +var _0x1290=['fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','rows','catch','show','params','filters','include','find','create','body','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','FreshdeskField','rawAttributes','fieldName','query','keys','intersection','model','attributes'];(function(_0x2927bd,_0x584694){var _0x5834aa=function(_0x423909){while(--_0x423909){_0x2927bd['push'](_0x2927bd['shift']());}};_0x5834aa(++_0x584694);}(_0x1290,0x136));var _0x0129=function(_0x95d8e3,_0x4497e2){_0x95d8e3=_0x95d8e3-0x0;var _0xd452e2=_0x1290[_0x95d8e3];return _0xd452e2;};'use strict';var pdf=require(_0x0129('0x0'));var emlformat=require(_0x0129('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0129('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0129('0x3'));var moment=require('moment');var BPromise=require(_0x0129('0x4'));var Mustache=require(_0x0129('0x5'));var util=require(_0x0129('0x6'));var path=require(_0x0129('0x7'));var sox=require(_0x0129('0x8'));var csv=require(_0x0129('0x9'));var ejs=require(_0x0129('0xa'));var fs=require('fs');var _=require(_0x0129('0xb'));var squel=require(_0x0129('0xc'));var crypto=require(_0x0129('0xd'));var jsforce=require(_0x0129('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0129('0x9'));var querystring=require(_0x0129('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0129('0x10'));var as=require(_0x0129('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0129('0x12'));var utils=require(_0x0129('0x13'));var config=require(_0x0129('0x14'));var licenseUtil=require(_0x0129('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4dbc5d,_0x507cbf){_0x507cbf=_0x507cbf||0xcc;return function(_0x41c48c){if(_0x41c48c){return _0x4dbc5d[_0x0129('0x16')](_0x507cbf);}return _0x4dbc5d[_0x0129('0x17')](_0x507cbf)[_0x0129('0x18')]();};}function respondWithResult(_0x503250,_0x445b75){_0x445b75=_0x445b75||0xc8;return function(_0x27c53b){if(_0x27c53b){return _0x503250[_0x0129('0x17')](_0x445b75)['json'](_0x27c53b);}};}function respondWithFilteredResult(_0xb4d69c,_0x33444e){return function(_0x501868){if(_0x501868){var _0x234a68=_0x501868[_0x0129('0x19')],_0x1c3f7a=_0x33444e[_0x0129('0x1a')],_0x1402e1=_0x33444e[_0x0129('0x1a')]+_0x33444e[_0x0129('0x1b')],_0x1f0547;if(_0x1402e1>=_0x234a68){_0x1402e1=_0x234a68;_0x1f0547=0xc8;}else{_0x1f0547=0xce;}_0xb4d69c[_0x0129('0x17')](_0x1f0547);return _0xb4d69c[_0x0129('0x1c')](_0x0129('0x1d'),_0x1c3f7a+'-'+_0x1402e1+'/'+_0x234a68)[_0x0129('0x1e')](_0x501868);}return null;};}function patchUpdates(_0x3ca4ee){return function(_0x3bb0b1){try{jsonpatch[_0x0129('0x1f')](_0x3bb0b1,_0x3ca4ee,!![]);}catch(_0x1ab4d9){return BPromise[_0x0129('0x20')](_0x1ab4d9);}return _0x3bb0b1[_0x0129('0x21')]();};}function saveUpdates(_0x25e047,_0x25f9c4){return function(_0x81f82b){if(_0x81f82b){return _0x81f82b[_0x0129('0x22')](_0x25e047)[_0x0129('0x23')](function(_0x569a2a){return _0x569a2a;});}return null;};}function removeEntity(_0x44d4a2,_0x3ec02b){return function(_0x1c0c2e){if(_0x1c0c2e){return _0x1c0c2e[_0x0129('0x24')]()[_0x0129('0x23')](function(){_0x44d4a2[_0x0129('0x17')](0xcc)[_0x0129('0x18')]();});}};}function handleEntityNotFound(_0x1bf5ee,_0x45a0bf){return function(_0x5ab917){if(!_0x5ab917){_0x1bf5ee['sendStatus'](0x194);}return _0x5ab917;};}function handleError(_0x4b9df5,_0x446e23){_0x446e23=_0x446e23||0x1f4;return function(_0x87aeb3){logger[_0x0129('0x25')](_0x87aeb3[_0x0129('0x26')]);if(_0x87aeb3[_0x0129('0x27')]){delete _0x87aeb3['name'];}_0x4b9df5['status'](_0x446e23)[_0x0129('0x28')](_0x87aeb3);};}exports['index']=function(_0x1d67bd,_0x3bd337){var _0x3a1f8a={},_0x1f2860={},_0x5aedd9={'count':0x0,'rows':[]};var _0x54f5b6=_[_0x0129('0x29')](db[_0x0129('0x2a')][_0x0129('0x2b')],function(_0x1dd831){return{'name':_0x1dd831[_0x0129('0x2c')],'type':_0x1dd831['type']['key']};});_0x1f2860['model']=_[_0x0129('0x29')](_0x54f5b6,_0x0129('0x27'));_0x1f2860[_0x0129('0x2d')]=_[_0x0129('0x2e')](_0x1d67bd[_0x0129('0x2d')]);_0x1f2860['filters']=_[_0x0129('0x2f')](_0x1f2860[_0x0129('0x30')],_0x1f2860[_0x0129('0x2d')]);_0x3a1f8a[_0x0129('0x31')]=_[_0x0129('0x2f')](_0x1f2860[_0x0129('0x30')],qs[_0x0129('0x32')](_0x1d67bd[_0x0129('0x2d')]['fields']));_0x3a1f8a[_0x0129('0x31')]=_0x3a1f8a[_0x0129('0x31')][_0x0129('0x33')]?_0x3a1f8a[_0x0129('0x31')]:_0x1f2860['model'];if(!_0x1d67bd[_0x0129('0x2d')][_0x0129('0x34')](_0x0129('0x35'))){_0x3a1f8a[_0x0129('0x1b')]=qs[_0x0129('0x1b')](_0x1d67bd[_0x0129('0x2d')]['limit']);_0x3a1f8a[_0x0129('0x1a')]=qs[_0x0129('0x1a')](_0x1d67bd[_0x0129('0x2d')][_0x0129('0x1a')]);}_0x3a1f8a[_0x0129('0x36')]=qs['sort'](_0x1d67bd['query'][_0x0129('0x37')]);_0x3a1f8a[_0x0129('0x38')]=qs['filters'](_['pick'](_0x1d67bd['query'],_0x1f2860['filters']),_0x54f5b6);if(_0x1d67bd[_0x0129('0x2d')][_0x0129('0x39')]){_0x3a1f8a[_0x0129('0x38')]=_['merge'](_0x3a1f8a[_0x0129('0x38')],{'$or':_[_0x0129('0x29')](_0x54f5b6,function(_0x3d12cf){if(_0x3d12cf[_0x0129('0x3a')]!==_0x0129('0x3b')){var _0x5e5195={};_0x5e5195[_0x3d12cf[_0x0129('0x27')]]={'$like':'%'+_0x1d67bd['query'][_0x0129('0x39')]+'%'};return _0x5e5195;}})});}_0x3a1f8a=_[_0x0129('0x3c')]({},_0x3a1f8a,_0x1d67bd[_0x0129('0x3d')]);var _0x86e4ea={'where':_0x3a1f8a[_0x0129('0x38')]};return db['FreshdeskField'][_0x0129('0x19')](_0x86e4ea)[_0x0129('0x23')](function(_0x22dabe){_0x5aedd9[_0x0129('0x19')]=_0x22dabe;if(_0x1d67bd[_0x0129('0x2d')][_0x0129('0x3e')]){_0x3a1f8a['include']=[{'all':!![]}];}return db[_0x0129('0x2a')]['findAll'](_0x3a1f8a);})[_0x0129('0x23')](function(_0x437bc8){_0x5aedd9[_0x0129('0x3f')]=_0x437bc8;return _0x5aedd9;})[_0x0129('0x23')](respondWithFilteredResult(_0x3bd337,_0x3a1f8a))[_0x0129('0x40')](handleError(_0x3bd337,null));};exports[_0x0129('0x41')]=function(_0x1f308a,_0x3ef5f6){var _0x1de4aa={'raw':!![],'where':{'id':_0x1f308a[_0x0129('0x42')]['id']}},_0x54a4a9={};_0x54a4a9[_0x0129('0x30')]=_[_0x0129('0x2e')](db[_0x0129('0x2a')][_0x0129('0x2b')]);_0x54a4a9[_0x0129('0x2d')]=_[_0x0129('0x2e')](_0x1f308a['query']);_0x54a4a9[_0x0129('0x43')]=_[_0x0129('0x2f')](_0x54a4a9['model'],_0x54a4a9['query']);_0x1de4aa[_0x0129('0x31')]=_[_0x0129('0x2f')](_0x54a4a9[_0x0129('0x30')],qs['fields'](_0x1f308a[_0x0129('0x2d')][_0x0129('0x32')]));_0x1de4aa[_0x0129('0x31')]=_0x1de4aa['attributes']['length']?_0x1de4aa['attributes']:_0x54a4a9['model'];if(_0x1f308a[_0x0129('0x2d')][_0x0129('0x3e')]){_0x1de4aa[_0x0129('0x44')]=[{'all':!![]}];}_0x1de4aa=_[_0x0129('0x3c')]({},_0x1de4aa,_0x1f308a[_0x0129('0x3d')]);return db[_0x0129('0x2a')][_0x0129('0x45')](_0x1de4aa)[_0x0129('0x23')](handleEntityNotFound(_0x3ef5f6,null))[_0x0129('0x23')](respondWithResult(_0x3ef5f6,null))[_0x0129('0x40')](handleError(_0x3ef5f6,null));};exports['create']=function(_0x4f6c5e,_0x35fec2){return db[_0x0129('0x2a')][_0x0129('0x46')](_0x4f6c5e[_0x0129('0x47')],{})[_0x0129('0x23')](respondWithResult(_0x35fec2,0xc9))['catch'](handleError(_0x35fec2,null));};exports[_0x0129('0x22')]=function(_0x529a5a,_0x42b93a){if(_0x529a5a['body']['id']){delete _0x529a5a[_0x0129('0x47')]['id'];}return db[_0x0129('0x2a')][_0x0129('0x45')]({'where':{'id':_0x529a5a[_0x0129('0x42')]['id']}})[_0x0129('0x23')](handleEntityNotFound(_0x42b93a,null))['then'](saveUpdates(_0x529a5a[_0x0129('0x47')],null))[_0x0129('0x23')](respondWithResult(_0x42b93a,null))[_0x0129('0x40')](handleError(_0x42b93a,null));};exports[_0x0129('0x24')]=function(_0x255289,_0x44e0ca){return db['FreshdeskField']['find']({'where':{'id':_0x255289[_0x0129('0x42')]['id']}})[_0x0129('0x23')](handleEntityNotFound(_0x44e0ca,null))['then'](removeEntity(_0x44e0ca,null))[_0x0129('0x40')](handleError(_0x44e0ca,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index cc33c9e..65d1a57 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 _0x77a7=['util','../../config/logger','moment','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash'];(function(_0x2ac020,_0x17da44){var _0x246a7f=function(_0x7762d6){while(--_0x7762d6){_0x2ac020['push'](_0x2ac020['shift']());}};_0x246a7f(++_0x17da44);}(_0x77a7,0x178));var _0x777a=function(_0x175b9b,_0x17cd98){_0x175b9b=_0x175b9b-0x0;var _0x1dd19e=_0x77a7[_0x175b9b];return _0x1dd19e;};'use strict';var _=require(_0x777a('0x0'));var util=require(_0x777a('0x1'));var logger=require(_0x777a('0x2'))('api');var moment=require(_0x777a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x777a('0x4'));var config=require(_0x777a('0x5'));var attributes=require(_0x777a('0x6'));module[_0x777a('0x7')]=function(_0x1cd294,_0x556e6c){return _0x1cd294['define'](_0x777a('0x8'),attributes,{'tableName':_0x777a('0x9'),'paranoid':![],'indexes':[{'name':_0x777a('0xa'),'fields':[_0x777a('0xb'),_0x777a('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd71d=['../../config/environment','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x5048ee,_0x3bad45){var _0x476dd1=function(_0x2852d5){while(--_0x2852d5){_0x5048ee['push'](_0x5048ee['shift']());}};_0x476dd1(++_0x3bad45);}(_0xd71d,0x158));var _0xdd71=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0xd71d[_0x1d50f2];return _0x3769b8;};'use strict';var _=require(_0xdd71('0x0'));var util=require(_0xdd71('0x1'));var logger=require(_0xdd71('0x2'))(_0xdd71('0x3'));var moment=require(_0xdd71('0x4'));var BPromise=require(_0xdd71('0x5'));var rp=require(_0xdd71('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdd71('0x7'));var config=require(_0xdd71('0x8'));var attributes=require(_0xdd71('0x9'));module[_0xdd71('0xa')]=function(_0x3ed586,_0x304a94){return _0x3ed586[_0xdd71('0xb')]('FreshdeskField',attributes,{'tableName':_0xdd71('0xc'),'paranoid':![],'indexes':[{'name':_0xdd71('0xd'),'fields':[_0xdd71('0xe'),_0xdd71('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 33f0d92..67f75f5 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.rpc.js +++ b/server/api/intFreshdeskField/intFreshdeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x4de9ee,_0x2dc819){_0x4de9ee=_0x4de9ee-0x0;var _0x1d9e59=_0x7a54[_0x4de9ee];return _0x1d9e59;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x241d55,_0x52d01e){_0x241d55=_0x241d55-0x0;var _0x53057b=_0x7a54[_0x241d55];return _0x53057b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 28594b1..4acb458 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 _0xa687=['delete','destroy','multer','path','connect-timeout','Router','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update'];(function(_0x1c5eff,_0x217859){var _0x1a3ad2=function(_0x9c2f8a){while(--_0x9c2f8a){_0x1c5eff['push'](_0x1c5eff['shift']());}};_0x1a3ad2(++_0x217859);}(_0xa687,0x12e));var _0x7a68=function(_0x4936fb,_0x10fda9){_0x4936fb=_0x4936fb-0x0;var _0x4430ab=_0xa687[_0x4936fb];return _0x4430ab;};'use strict';var multer=require(_0x7a68('0x0'));var util=require('util');var path=require(_0x7a68('0x1'));var timeout=require(_0x7a68('0x2'));var express=require('express');var router=express[_0x7a68('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7a68('0x4'));var controller=require(_0x7a68('0x5'));router[_0x7a68('0x6')]('/',auth[_0x7a68('0x7')](),controller[_0x7a68('0x8')]);router[_0x7a68('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7a68('0x6')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x7a68('0x9')]);router['get'](_0x7a68('0xa'),auth[_0x7a68('0x7')](),controller[_0x7a68('0xb')]);router[_0x7a68('0xc')]('/',auth[_0x7a68('0x7')](),controller[_0x7a68('0xd')]);router[_0x7a68('0xc')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x7a68('0xe')]);router[_0x7a68('0xf')](_0x7a68('0x10'),auth[_0x7a68('0x7')](),controller[_0x7a68('0x11')]);router[_0x7a68('0x12')](_0x7a68('0x10'),auth[_0x7a68('0x7')](),controller[_0x7a68('0x13')]);module['exports']=router; \ No newline at end of file +var _0x6d98=['show','/:id/configurations','getConfigurations','post','create','addConfiguration','update','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id'];(function(_0x1ff841,_0x543346){var _0x3a6a80=function(_0x2bf2e6){while(--_0x2bf2e6){_0x1ff841['push'](_0x1ff841['shift']());}};_0x3a6a80(++_0x543346);}(_0x6d98,0x1a8));var _0x86d9=function(_0x4d1461,_0x3ea8a7){_0x4d1461=_0x4d1461-0x0;var _0x5d4907=_0x6d98[_0x4d1461];return _0x5d4907;};'use strict';var multer=require(_0x86d9('0x0'));var util=require('util');var path=require(_0x86d9('0x1'));var timeout=require(_0x86d9('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x86d9('0x3'));var interaction=require(_0x86d9('0x4'));var config=require('../../config/environment');var controller=require('./intFreshsalesAccount.controller');router['get']('/',auth[_0x86d9('0x5')](),controller['index']);router[_0x86d9('0x6')](_0x86d9('0x7'),auth[_0x86d9('0x5')](),controller[_0x86d9('0x8')]);router[_0x86d9('0x6')](_0x86d9('0x9'),auth[_0x86d9('0x5')](),controller[_0x86d9('0xa')]);router['get']('/:id/fields',auth[_0x86d9('0x5')](),controller['getFields']);router[_0x86d9('0xb')]('/',auth[_0x86d9('0x5')](),controller[_0x86d9('0xc')]);router['post'](_0x86d9('0x9'),auth[_0x86d9('0x5')](),controller[_0x86d9('0xd')]);router['put'](_0x86d9('0x7'),auth['isAuthenticated'](),controller[_0x86d9('0xe')]);router[_0x86d9('0xf')](_0x86d9('0x7'),auth[_0x86d9('0x5')](),controller[_0x86d9('0x10')]);module[_0x86d9('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 8604f8e..5fad3c9 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 _0x647e=['STRING','username','remoteUri','sequelize'];(function(_0x410671,_0x4a5900){var _0x39fae2=function(_0x57f346){while(--_0x57f346){_0x410671['push'](_0x410671['shift']());}};_0x39fae2(++_0x4a5900);}(_0x647e,0x18b));var _0xe647=function(_0x5cf58f,_0xe83a7c){_0x5cf58f=_0x5cf58f-0x0;var _0x1c06ba=_0x647e[_0x5cf58f];return _0x1c06ba;};'use strict';var Sequelize=require(_0xe647('0x0'));module['exports']={'name':{'type':Sequelize[_0xe647('0x1')]},'description':{'type':Sequelize[_0xe647('0x1')]},'username':{'type':Sequelize[_0xe647('0x1')],'unique':_0xe647('0x2')},'apiKey':{'type':Sequelize[_0xe647('0x1')]},'remoteUri':{'type':Sequelize[_0xe647('0x1')],'unique':_0xe647('0x3')},'serverUrl':{'type':Sequelize[_0xe647('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x8be1=['STRING','username','sequelize'];(function(_0x43ae86,_0xab03d4){var _0x576be0=function(_0x88d465){while(--_0x88d465){_0x43ae86['push'](_0x43ae86['shift']());}};_0x576be0(++_0xab03d4);}(_0x8be1,0x83));var _0x18be=function(_0x340ade,_0x5a0d28){_0x340ade=_0x340ade-0x0;var _0x599fe2=_0x8be1[_0x340ade];return _0x599fe2;};'use strict';var Sequelize=require(_0x18be('0x0'));module['exports']={'name':{'type':Sequelize[_0x18be('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x18be('0x1')],'unique':_0x18be('0x2')},'apiKey':{'type':Sequelize[_0x18be('0x1')]},'remoteUri':{'type':Sequelize[_0x18be('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x18be('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 a6efb23..570ec88 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 _0x91a7=['Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','test','getFields,\x20%s,\x20%s,\x20%s','statusCode','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','count','offset','limit','set','save','update','then','destroy','sendStatus','stack','name','send','map','FreshsalesAccount','rawAttributes','type','model','query','filters','attributes','intersection','fields','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','show','params','keys','length','create','body','find','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration'];(function(_0x1b6e8a,_0x2d4835){var _0x3d3ea4=function(_0x184840){while(--_0x184840){_0x1b6e8a['push'](_0x1b6e8a['shift']());}};_0x3d3ea4(++_0x2d4835);}(_0x91a7,0xe7));var _0x791a=function(_0x1356e9,_0x54bad7){_0x1356e9=_0x1356e9-0x0;var _0x52dfcc=_0x91a7[_0x1356e9];return _0x52dfcc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x791a('0x0'));var rimraf=require(_0x791a('0x1'));var zipdir=require(_0x791a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x791a('0x3'));var moment=require('moment');var BPromise=require(_0x791a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x791a('0x5'));var sox=require(_0x791a('0x6'));var csv=require('to-csv');var ejs=require(_0x791a('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x791a('0x8'));var crypto=require(_0x791a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x791a('0xa'));var toCsv=require(_0x791a('0xb'));var querystring=require(_0x791a('0xc'));var Papa=require(_0x791a('0xd'));var Redis=require(_0x791a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x791a('0xf'));var as=require(_0x791a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x791a('0x11'))(_0x791a('0x12'));var utils=require(_0x791a('0x13'));var config=require(_0x791a('0x14'));var licenseUtil=require(_0x791a('0x15'));var db=require(_0x791a('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x791a('0x17')][_0x791a('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x4c56f0,_0x346c44,_0x3a2ec6,_0x5d5b11){return new BPromise(function(_0x2887f0,_0x31b86d){var _0x2ef5c5=_0x5d5b11||client;return _0x2ef5c5[_0x791a('0x19')](_0x4c56f0,_0x3a2ec6)['then'](function(_0x2ce2e0){logger['info'](_0x791a('0x1a'),_0x346c44,_0x791a('0x1b'));logger['debug'](_0x791a('0x1c'),_0x346c44,'request\x20sent',JSON[_0x791a('0x1d')](_0x2ce2e0));if(_0x2ce2e0['error']){if(_0x2ce2e0['error']['code']===0x1f4){logger[_0x791a('0x1e')]('FreshsalesAccount,\x20%s,\x20%s',_0x346c44,_0x2ce2e0['error'][_0x791a('0x1f')]);return _0x31b86d(_0x2ce2e0[_0x791a('0x1e')][_0x791a('0x1f')]);}logger[_0x791a('0x1e')]('FreshsalesAccount,\x20%s,\x20%s',_0x346c44,_0x2ce2e0[_0x791a('0x1e')][_0x791a('0x1f')]);return _0x2887f0(_0x2ce2e0[_0x791a('0x1e')][_0x791a('0x1f')]);}else{logger['info'](_0x791a('0x1a'),_0x346c44,_0x791a('0x1b'));_0x2887f0(_0x2ce2e0[_0x791a('0x20')][_0x791a('0x1f')]);}})[_0x791a('0x21')](function(_0x1091af){logger[_0x791a('0x1e')](_0x791a('0x1a'),_0x346c44,_0x1091af);_0x31b86d(_0x1091af);});});}function respondWithStatusCode(_0x323c6a,_0xe8e452){_0xe8e452=_0xe8e452||0xcc;return function(_0x137992){if(_0x137992){return _0x323c6a['sendStatus'](_0xe8e452);}return _0x323c6a[_0x791a('0x22')](_0xe8e452)[_0x791a('0x23')]();};}function respondWithResult(_0x380329,_0x2966b8){_0x2966b8=_0x2966b8||0xc8;return function(_0x4d748a){if(_0x4d748a){return _0x380329[_0x791a('0x22')](_0x2966b8)[_0x791a('0x24')](_0x4d748a);}};}function respondWithFilteredResult(_0x51dcca,_0xdfa84f){return function(_0x1785f5){if(_0x1785f5){var _0x16dbaf=_0x1785f5[_0x791a('0x25')],_0x4c1626=_0xdfa84f[_0x791a('0x26')],_0x29194d=_0xdfa84f[_0x791a('0x26')]+_0xdfa84f[_0x791a('0x27')],_0x2b3327;if(_0x29194d>=_0x16dbaf){_0x29194d=_0x16dbaf;_0x2b3327=0xc8;}else{_0x2b3327=0xce;}_0x51dcca[_0x791a('0x22')](_0x2b3327);return _0x51dcca[_0x791a('0x28')]('Content-Range',_0x4c1626+'-'+_0x29194d+'/'+_0x16dbaf)[_0x791a('0x24')](_0x1785f5);}return null;};}function patchUpdates(_0x9e9332){return function(_0x1b10a7){try{jsonpatch['apply'](_0x1b10a7,_0x9e9332,!![]);}catch(_0x1cdda9){return BPromise['reject'](_0x1cdda9);}return _0x1b10a7[_0x791a('0x29')]();};}function saveUpdates(_0x2e4ec8,_0xcde862){return function(_0xe72e0c){if(_0xe72e0c){return _0xe72e0c[_0x791a('0x2a')](_0x2e4ec8)[_0x791a('0x2b')](function(_0x15ff6e){return _0x15ff6e;});}return null;};}function removeEntity(_0x4f5506,_0x3662c6){return function(_0x401069){if(_0x401069){return _0x401069[_0x791a('0x2c')]()[_0x791a('0x2b')](function(){_0x4f5506[_0x791a('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42d650,_0x8e7002){return function(_0x423a1e){if(!_0x423a1e){_0x42d650[_0x791a('0x2d')](0x194);}return _0x423a1e;};}function handleError(_0xb6e59b,_0x4ef825){_0x4ef825=_0x4ef825||0x1f4;return function(_0x305836){logger[_0x791a('0x1e')](_0x305836[_0x791a('0x2e')]);if(_0x305836[_0x791a('0x2f')]){delete _0x305836[_0x791a('0x2f')];}_0xb6e59b['status'](_0x4ef825)[_0x791a('0x30')](_0x305836);};}exports['index']=function(_0x1cf048,_0x4cd047){var _0x5edb88={},_0x425675={},_0x404530={'count':0x0,'rows':[]};var _0x75458d=_[_0x791a('0x31')](db[_0x791a('0x32')][_0x791a('0x33')],function(_0x29762d){return{'name':_0x29762d['fieldName'],'type':_0x29762d[_0x791a('0x34')]['key']};});_0x425675[_0x791a('0x35')]=_['map'](_0x75458d,_0x791a('0x2f'));_0x425675[_0x791a('0x36')]=_['keys'](_0x1cf048[_0x791a('0x36')]);_0x425675[_0x791a('0x37')]=_['intersection'](_0x425675[_0x791a('0x35')],_0x425675[_0x791a('0x36')]);_0x5edb88[_0x791a('0x38')]=_[_0x791a('0x39')](_0x425675[_0x791a('0x35')],qs[_0x791a('0x3a')](_0x1cf048[_0x791a('0x36')][_0x791a('0x3a')]));_0x5edb88[_0x791a('0x38')]=_0x5edb88[_0x791a('0x38')]['length']?_0x5edb88[_0x791a('0x38')]:_0x425675[_0x791a('0x35')];if(!_0x1cf048[_0x791a('0x36')]['hasOwnProperty'](_0x791a('0x3b'))){_0x5edb88['limit']=qs['limit'](_0x1cf048['query'][_0x791a('0x27')]);_0x5edb88[_0x791a('0x26')]=qs['offset'](_0x1cf048[_0x791a('0x36')][_0x791a('0x26')]);}_0x5edb88[_0x791a('0x3c')]=qs[_0x791a('0x3d')](_0x1cf048['query']['sort']);_0x5edb88['where']=qs[_0x791a('0x37')](_[_0x791a('0x3e')](_0x1cf048['query'],_0x425675[_0x791a('0x37')]),_0x75458d);if(_0x1cf048[_0x791a('0x36')][_0x791a('0x3f')]){_0x5edb88[_0x791a('0x40')]=_['merge'](_0x5edb88[_0x791a('0x40')],{'$or':_['map'](_0x75458d,function(_0x3682db){if(_0x3682db[_0x791a('0x34')]!==_0x791a('0x41')){var _0xfa245e={};_0xfa245e[_0x3682db[_0x791a('0x2f')]]={'$like':'%'+_0x1cf048['query'][_0x791a('0x3f')]+'%'};return _0xfa245e;}})});}_0x5edb88=_[_0x791a('0x42')]({},_0x5edb88,_0x1cf048[_0x791a('0x43')]);var _0x1a5cac={'where':_0x5edb88[_0x791a('0x40')]};return db['FreshsalesAccount'][_0x791a('0x25')](_0x1a5cac)[_0x791a('0x2b')](function(_0x4e379e){_0x404530['count']=_0x4e379e;if(_0x1cf048[_0x791a('0x36')][_0x791a('0x44')]){_0x5edb88[_0x791a('0x45')]=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x5edb88);})[_0x791a('0x2b')](function(_0x378cc2){_0x404530['rows']=_0x378cc2;return _0x404530;})[_0x791a('0x2b')](respondWithFilteredResult(_0x4cd047,_0x5edb88))[_0x791a('0x21')](handleError(_0x4cd047,null));};exports[_0x791a('0x46')]=function(_0x549980,_0x5a30a6){var _0x2446fb={'raw':![],'where':{'id':_0x549980[_0x791a('0x47')]['id']}},_0x17acda={};_0x17acda[_0x791a('0x35')]=_['keys'](db[_0x791a('0x32')][_0x791a('0x33')]);_0x17acda[_0x791a('0x36')]=_[_0x791a('0x48')](_0x549980['query']);_0x17acda[_0x791a('0x37')]=_[_0x791a('0x39')](_0x17acda[_0x791a('0x35')],_0x17acda[_0x791a('0x36')]);_0x2446fb[_0x791a('0x38')]=_[_0x791a('0x39')](_0x17acda[_0x791a('0x35')],qs['fields'](_0x549980[_0x791a('0x36')][_0x791a('0x3a')]));_0x2446fb['attributes']=_0x2446fb[_0x791a('0x38')][_0x791a('0x49')]?_0x2446fb['attributes']:_0x17acda[_0x791a('0x35')];if(_0x549980[_0x791a('0x36')][_0x791a('0x44')]){_0x2446fb[_0x791a('0x45')]=[{'all':!![]}];}_0x2446fb=_[_0x791a('0x42')]({},_0x2446fb,_0x549980['options']);return db['FreshsalesAccount']['find'](_0x2446fb)[_0x791a('0x2b')](handleEntityNotFound(_0x5a30a6,null))['then'](respondWithResult(_0x5a30a6,null))['catch'](handleError(_0x5a30a6,null));};exports[_0x791a('0x4a')]=function(_0x548a4b,_0x3e0b17){return db[_0x791a('0x32')]['create'](_0x548a4b['body'],{})[_0x791a('0x2b')](respondWithResult(_0x3e0b17,0xc9))['catch'](handleError(_0x3e0b17,null));};exports[_0x791a('0x2a')]=function(_0x4294fb,_0x383031){if(_0x4294fb['body']['id']){delete _0x4294fb[_0x791a('0x4b')]['id'];}return db[_0x791a('0x32')]['find']({'where':{'id':_0x4294fb[_0x791a('0x47')]['id']}})[_0x791a('0x2b')](handleEntityNotFound(_0x383031,null))[_0x791a('0x2b')](saveUpdates(_0x4294fb[_0x791a('0x4b')],null))[_0x791a('0x2b')](respondWithResult(_0x383031,null))[_0x791a('0x21')](handleError(_0x383031,null));};exports['destroy']=function(_0x4dfe1e,_0x35ccdf){return db['FreshsalesAccount'][_0x791a('0x4c')]({'where':{'id':_0x4dfe1e[_0x791a('0x47')]['id']}})[_0x791a('0x2b')](handleEntityNotFound(_0x35ccdf,null))[_0x791a('0x2b')](removeEntity(_0x35ccdf,null))[_0x791a('0x21')](handleError(_0x35ccdf,null));};exports[_0x791a('0x4d')]=function(_0x353170,_0x5a215d,_0x1ac6e1){var _0x4691d9={};var _0xc34c5b={};var _0x1a4376;var _0x2d671f;return db[_0x791a('0x32')][_0x791a('0x4e')]({'where':{'id':_0x353170['params']['id']}})[_0x791a('0x2b')](handleEntityNotFound(_0x5a215d,null))['then'](function(_0x4c4fc5){if(_0x4c4fc5){_0x1a4376=_0x4c4fc5;_0xc34c5b[_0x791a('0x35')]=_[_0x791a('0x48')](db[_0x791a('0x4f')][_0x791a('0x33')]);_0xc34c5b[_0x791a('0x36')]=_[_0x791a('0x48')](_0x353170[_0x791a('0x36')]);_0xc34c5b[_0x791a('0x37')]=_[_0x791a('0x39')](_0xc34c5b[_0x791a('0x35')],_0xc34c5b[_0x791a('0x36')]);_0x4691d9[_0x791a('0x38')]=_[_0x791a('0x39')](_0xc34c5b[_0x791a('0x35')],qs[_0x791a('0x3a')](_0x353170[_0x791a('0x36')][_0x791a('0x3a')]));_0x4691d9[_0x791a('0x38')]=_0x4691d9[_0x791a('0x38')][_0x791a('0x49')]?_0x4691d9['attributes']:_0xc34c5b[_0x791a('0x35')];_0x4691d9[_0x791a('0x3c')]=qs[_0x791a('0x3d')](_0x353170[_0x791a('0x36')][_0x791a('0x3d')]);_0x4691d9['where']=qs[_0x791a('0x37')](_[_0x791a('0x3e')](_0x353170[_0x791a('0x36')],_0xc34c5b[_0x791a('0x37')]));if(_0x353170['query'][_0x791a('0x3f')]){_0x4691d9['where']=_['merge'](_0x4691d9['where'],{'$or':_['map'](_0x4691d9[_0x791a('0x38')],function(_0x40207b){var _0x11c11f={};_0x11c11f[_0x40207b]={'$like':'%'+_0x353170[_0x791a('0x36')][_0x791a('0x3f')]+'%'};return _0x11c11f;})});}_0x4691d9=_[_0x791a('0x42')]({},_0x4691d9,_0x353170[_0x791a('0x43')]);return _0x1a4376['getConfigurations'](_0x4691d9);}})['then'](function(_0x3b22e2){if(_0x3b22e2){_0x2d671f=_0x3b22e2[_0x791a('0x49')];if(!_0x353170['query']['hasOwnProperty'](_0x791a('0x3b'))){_0x4691d9[_0x791a('0x27')]=qs['limit'](_0x353170[_0x791a('0x36')][_0x791a('0x27')]);_0x4691d9[_0x791a('0x26')]=qs[_0x791a('0x26')](_0x353170['query']['offset']);}return _0x1a4376[_0x791a('0x4d')](_0x4691d9);}})[_0x791a('0x2b')](function(_0x566f0a){if(_0x566f0a){return _0x566f0a?{'count':_0x2d671f,'rows':_0x566f0a}:null;}})[_0x791a('0x2b')](respondWithResult(_0x5a215d,null))[_0x791a('0x21')](handleError(_0x5a215d,null));};exports[_0x791a('0x50')]=function(_0x3838c4,_0x565c83,_0x24efc2){if(_0x3838c4[_0x791a('0x4b')]['id']){delete _0x3838c4[_0x791a('0x4b')]['id'];}return db[_0x791a('0x32')][_0x791a('0x4e')]({'where':{'id':_0x3838c4[_0x791a('0x47')]['id']}})[_0x791a('0x2b')](handleEntityNotFound(_0x565c83,null))[_0x791a('0x2b')](function(_0x5567d3){if(_0x5567d3){_0x3838c4['body']['AccountId']=_0x5567d3['id'];_0x3838c4[_0x791a('0x4b')][_0x791a('0x51')]=integrations[_0x791a('0x52')](_0x3838c4[_0x791a('0x4b')][_0x791a('0x53')],_0x3838c4[_0x791a('0x4b')][_0x791a('0x34')]);_0x3838c4[_0x791a('0x4b')][_0x791a('0x54')]=integrations[_0x791a('0x55')](_0x3838c4['body'][_0x791a('0x53')],_0x3838c4[_0x791a('0x4b')]['type']);return db[_0x791a('0x4f')][_0x791a('0x4a')](_0x3838c4['body'],{'include':[{'model':db['FreshsalesField'],'as':_0x791a('0x51')},{'model':db[_0x791a('0x56')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x565c83,null))[_0x791a('0x21')](handleError(_0x565c83,null));};exports[_0x791a('0x57')]=function(_0x46737e,_0x5da9b8,_0x1b23a1){var _0x4b27a7='';var _0x438b1d='';return db[_0x791a('0x32')][_0x791a('0x4e')]({'where':{'id':_0x46737e[_0x791a('0x47')]['id']},'attributes':['id',_0x791a('0x58'),_0x791a('0x59'),'apiKey']})[_0x791a('0x2b')](handleEntityNotFound(_0x5da9b8,null))[_0x791a('0x2b')](function(_0x41d1a5){if(_0x41d1a5){_0x438b1d=_0x41d1a5[_0x791a('0x58')];_0x4b27a7=_0x41d1a5[_0x791a('0x59')];var _0x3133fd=_0x41d1a5[_0x791a('0x59')][_0x791a('0x5a')](-0x1);if(_0x3133fd==='/'){_0x4b27a7=_0x4b27a7[_0x791a('0x5b')](0x0,_0x4b27a7[_0x791a('0x5c')](_0x3133fd));}return rp({'method':_0x791a('0x5d'),'uri':util[_0x791a('0x5e')](_0x791a('0x5f'),_0x4b27a7,_0x791a('0x60')),'headers':{'Authorization':_0x791a('0x61')+_0x41d1a5[_0x791a('0x62')]},'json':!![]});}})[_0x791a('0x2b')](function(_0x424970){if(_0x424970){var _0x5347e5=_0x424970[_0x791a('0x63')];var _0xbd35f8=![];var _0x3126f1=null;for(_0x3126f1=0x0;_0x3126f1<_0x5347e5[_0x791a('0x49')];_0x3126f1++){if(_0x5347e5[_0x3126f1][_0x791a('0x64')]===_0x438b1d){_0xbd35f8=!![];}}if(_0xbd35f8){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x791a('0x2b')](respondWithResult(_0x5da9b8,null))['catch'](function(_0x467d65){var _0x48b8dc=_0x46737e[_0x791a('0x36')][_0x791a('0x65')]?0x1f4:_0x467d65['statusCode']||0x1f4;logger[_0x791a('0x1e')](_0x791a('0x66'),_0x791a('0x57'),_0x48b8dc,JSON['stringify'](_0x467d65));delete _0x467d65[_0x791a('0x2f')];if(_0x48b8dc===0x191){_0x48b8dc=0x190;}_0x5da9b8['status'](_0x48b8dc)[_0x791a('0x30')](_0x46737e['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x467d65[_0x791a('0x67')]}:_0x467d65);});}; \ No newline at end of file +var _0x44a3=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','json','count','offset','limit','Content-Range','apply','update','destroy','stack','name','send','index','FreshsalesAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','apiKey','remoteUri','slice','substring','GET','format','%s%s','/api/selector/owners','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','desk.js','querystring'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x44a3,0x1a9));var _0x344a=function(_0x503641,_0x33a3cf){_0x503641=_0x503641-0x0;var _0x17757d=_0x44a3[_0x503641];return _0x17757d;};'use strict';var pdf=require(_0x344a('0x0'));var emlformat=require(_0x344a('0x1'));var rimraf=require(_0x344a('0x2'));var zipdir=require(_0x344a('0x3'));var jsonpatch=require(_0x344a('0x4'));var rp=require(_0x344a('0x5'));var moment=require(_0x344a('0x6'));var BPromise=require(_0x344a('0x7'));var Mustache=require('mustache');var util=require(_0x344a('0x8'));var path=require(_0x344a('0x9'));var sox=require(_0x344a('0xa'));var csv=require(_0x344a('0xb'));var ejs=require(_0x344a('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x344a('0xd'));var toCsv=require(_0x344a('0xb'));var querystring=require(_0x344a('0xe'));var Papa=require(_0x344a('0xf'));var Redis=require(_0x344a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x344a('0x11'));var as=require(_0x344a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x344a('0x13'))('api');var utils=require(_0x344a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x344a('0x15'));var db=require(_0x344a('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x344a('0x17')][_0x344a('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x3a974e,_0x3a854c,_0x5a0df6,_0x133ad4){return new BPromise(function(_0x4ee562,_0x4032d7){var _0x2360e9=_0x133ad4||client;return _0x2360e9[_0x344a('0x19')](_0x3a974e,_0x5a0df6)[_0x344a('0x1a')](function(_0x58c8cd){logger['info'](_0x344a('0x1b'),_0x3a854c,_0x344a('0x1c'));logger[_0x344a('0x1d')](_0x344a('0x1e'),_0x3a854c,'request\x20sent',JSON[_0x344a('0x1f')](_0x58c8cd));if(_0x58c8cd[_0x344a('0x20')]){if(_0x58c8cd['error'][_0x344a('0x21')]===0x1f4){logger[_0x344a('0x20')](_0x344a('0x1b'),_0x3a854c,_0x58c8cd[_0x344a('0x20')][_0x344a('0x22')]);return _0x4032d7(_0x58c8cd[_0x344a('0x20')][_0x344a('0x22')]);}logger[_0x344a('0x20')](_0x344a('0x1b'),_0x3a854c,_0x58c8cd[_0x344a('0x20')]['message']);return _0x4ee562(_0x58c8cd[_0x344a('0x20')][_0x344a('0x22')]);}else{logger[_0x344a('0x23')](_0x344a('0x1b'),_0x3a854c,_0x344a('0x1c'));_0x4ee562(_0x58c8cd[_0x344a('0x24')][_0x344a('0x22')]);}})[_0x344a('0x25')](function(_0x3a2c3c){logger[_0x344a('0x20')](_0x344a('0x1b'),_0x3a854c,_0x3a2c3c);_0x4032d7(_0x3a2c3c);});});}function respondWithStatusCode(_0x3b2ab9,_0x5ce9da){_0x5ce9da=_0x5ce9da||0xcc;return function(_0x266fce){if(_0x266fce){return _0x3b2ab9['sendStatus'](_0x5ce9da);}return _0x3b2ab9[_0x344a('0x26')](_0x5ce9da)['end']();};}function respondWithResult(_0x2a5e49,_0x484f97){_0x484f97=_0x484f97||0xc8;return function(_0x36c920){if(_0x36c920){return _0x2a5e49[_0x344a('0x26')](_0x484f97)[_0x344a('0x27')](_0x36c920);}};}function respondWithFilteredResult(_0x16d404,_0x26f059){return function(_0x28749b){if(_0x28749b){var _0x229ccd=_0x28749b[_0x344a('0x28')],_0x114637=_0x26f059[_0x344a('0x29')],_0x4f2499=_0x26f059[_0x344a('0x29')]+_0x26f059[_0x344a('0x2a')],_0x283f63;if(_0x4f2499>=_0x229ccd){_0x4f2499=_0x229ccd;_0x283f63=0xc8;}else{_0x283f63=0xce;}_0x16d404[_0x344a('0x26')](_0x283f63);return _0x16d404['set'](_0x344a('0x2b'),_0x114637+'-'+_0x4f2499+'/'+_0x229ccd)['json'](_0x28749b);}return null;};}function patchUpdates(_0x593cf6){return function(_0x24965d){try{jsonpatch[_0x344a('0x2c')](_0x24965d,_0x593cf6,!![]);}catch(_0x5a36bb){return BPromise['reject'](_0x5a36bb);}return _0x24965d['save']();};}function saveUpdates(_0x5cafd2,_0x16f490){return function(_0x23c484){if(_0x23c484){return _0x23c484[_0x344a('0x2d')](_0x5cafd2)['then'](function(_0x25b28d){return _0x25b28d;});}return null;};}function removeEntity(_0x32e78f,_0x71f3ec){return function(_0xc785bb){if(_0xc785bb){return _0xc785bb[_0x344a('0x2e')]()[_0x344a('0x1a')](function(){_0x32e78f[_0x344a('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25debe,_0x50363d){return function(_0x47d8c3){if(!_0x47d8c3){_0x25debe['sendStatus'](0x194);}return _0x47d8c3;};}function handleError(_0x413433,_0x279114){_0x279114=_0x279114||0x1f4;return function(_0x2b8e71){logger[_0x344a('0x20')](_0x2b8e71[_0x344a('0x2f')]);if(_0x2b8e71[_0x344a('0x30')]){delete _0x2b8e71['name'];}_0x413433[_0x344a('0x26')](_0x279114)[_0x344a('0x31')](_0x2b8e71);};}exports[_0x344a('0x32')]=function(_0x5ed2f9,_0x3698eb){var _0x183787={},_0x5054ca={},_0x487a9b={'count':0x0,'rows':[]};var _0x1b7c8c=_['map'](db[_0x344a('0x33')][_0x344a('0x34')],function(_0x150662){return{'name':_0x150662[_0x344a('0x35')],'type':_0x150662[_0x344a('0x36')]['key']};});_0x5054ca[_0x344a('0x37')]=_[_0x344a('0x38')](_0x1b7c8c,_0x344a('0x30'));_0x5054ca[_0x344a('0x39')]=_[_0x344a('0x3a')](_0x5ed2f9['query']);_0x5054ca[_0x344a('0x3b')]=_[_0x344a('0x3c')](_0x5054ca[_0x344a('0x37')],_0x5054ca[_0x344a('0x39')]);_0x183787[_0x344a('0x3d')]=_[_0x344a('0x3c')](_0x5054ca[_0x344a('0x37')],qs[_0x344a('0x3e')](_0x5ed2f9['query'][_0x344a('0x3e')]));_0x183787[_0x344a('0x3d')]=_0x183787[_0x344a('0x3d')][_0x344a('0x3f')]?_0x183787[_0x344a('0x3d')]:_0x5054ca['model'];if(!_0x5ed2f9[_0x344a('0x39')][_0x344a('0x40')](_0x344a('0x41'))){_0x183787[_0x344a('0x2a')]=qs[_0x344a('0x2a')](_0x5ed2f9[_0x344a('0x39')][_0x344a('0x2a')]);_0x183787[_0x344a('0x29')]=qs[_0x344a('0x29')](_0x5ed2f9['query'][_0x344a('0x29')]);}_0x183787[_0x344a('0x42')]=qs[_0x344a('0x43')](_0x5ed2f9[_0x344a('0x39')]['sort']);_0x183787[_0x344a('0x44')]=qs[_0x344a('0x3b')](_[_0x344a('0x45')](_0x5ed2f9[_0x344a('0x39')],_0x5054ca[_0x344a('0x3b')]),_0x1b7c8c);if(_0x5ed2f9[_0x344a('0x39')][_0x344a('0x46')]){_0x183787[_0x344a('0x44')]=_[_0x344a('0x47')](_0x183787[_0x344a('0x44')],{'$or':_[_0x344a('0x38')](_0x1b7c8c,function(_0x4cf8ef){if(_0x4cf8ef[_0x344a('0x36')]!==_0x344a('0x48')){var _0x5ed2f4={};_0x5ed2f4[_0x4cf8ef[_0x344a('0x30')]]={'$like':'%'+_0x5ed2f9[_0x344a('0x39')]['filter']+'%'};return _0x5ed2f4;}})});}_0x183787=_[_0x344a('0x47')]({},_0x183787,_0x5ed2f9[_0x344a('0x49')]);var _0x4986bc={'where':_0x183787[_0x344a('0x44')]};return db[_0x344a('0x33')][_0x344a('0x28')](_0x4986bc)['then'](function(_0x1157ed){_0x487a9b['count']=_0x1157ed;if(_0x5ed2f9[_0x344a('0x39')][_0x344a('0x4a')]){_0x183787[_0x344a('0x4b')]=[{'all':!![]}];}return db[_0x344a('0x33')]['findAll'](_0x183787);})['then'](function(_0x306f46){_0x487a9b[_0x344a('0x4c')]=_0x306f46;return _0x487a9b;})[_0x344a('0x1a')](respondWithFilteredResult(_0x3698eb,_0x183787))[_0x344a('0x25')](handleError(_0x3698eb,null));};exports[_0x344a('0x4d')]=function(_0xa3c8f0,_0x44962b){var _0x23c214={'raw':![],'where':{'id':_0xa3c8f0[_0x344a('0x4e')]['id']}},_0x2b629d={};_0x2b629d['model']=_[_0x344a('0x3a')](db[_0x344a('0x33')][_0x344a('0x34')]);_0x2b629d[_0x344a('0x39')]=_['keys'](_0xa3c8f0[_0x344a('0x39')]);_0x2b629d['filters']=_['intersection'](_0x2b629d[_0x344a('0x37')],_0x2b629d[_0x344a('0x39')]);_0x23c214['attributes']=_[_0x344a('0x3c')](_0x2b629d[_0x344a('0x37')],qs[_0x344a('0x3e')](_0xa3c8f0[_0x344a('0x39')]['fields']));_0x23c214[_0x344a('0x3d')]=_0x23c214[_0x344a('0x3d')][_0x344a('0x3f')]?_0x23c214[_0x344a('0x3d')]:_0x2b629d[_0x344a('0x37')];if(_0xa3c8f0[_0x344a('0x39')][_0x344a('0x4a')]){_0x23c214[_0x344a('0x4b')]=[{'all':!![]}];}_0x23c214=_[_0x344a('0x47')]({},_0x23c214,_0xa3c8f0[_0x344a('0x49')]);return db['FreshsalesAccount'][_0x344a('0x4f')](_0x23c214)['then'](handleEntityNotFound(_0x44962b,null))[_0x344a('0x1a')](respondWithResult(_0x44962b,null))[_0x344a('0x25')](handleError(_0x44962b,null));};exports[_0x344a('0x50')]=function(_0x531972,_0x3e1e83){return db[_0x344a('0x33')][_0x344a('0x50')](_0x531972[_0x344a('0x51')],{})[_0x344a('0x1a')](respondWithResult(_0x3e1e83,0xc9))[_0x344a('0x25')](handleError(_0x3e1e83,null));};exports[_0x344a('0x2d')]=function(_0x2252e9,_0x28e32a){if(_0x2252e9['body']['id']){delete _0x2252e9[_0x344a('0x51')]['id'];}return db[_0x344a('0x33')][_0x344a('0x4f')]({'where':{'id':_0x2252e9[_0x344a('0x4e')]['id']}})[_0x344a('0x1a')](handleEntityNotFound(_0x28e32a,null))['then'](saveUpdates(_0x2252e9[_0x344a('0x51')],null))[_0x344a('0x1a')](respondWithResult(_0x28e32a,null))[_0x344a('0x25')](handleError(_0x28e32a,null));};exports[_0x344a('0x2e')]=function(_0x493926,_0x1b981f){return db[_0x344a('0x33')]['find']({'where':{'id':_0x493926[_0x344a('0x4e')]['id']}})[_0x344a('0x1a')](handleEntityNotFound(_0x1b981f,null))[_0x344a('0x1a')](removeEntity(_0x1b981f,null))[_0x344a('0x25')](handleError(_0x1b981f,null));};exports[_0x344a('0x52')]=function(_0x40eb85,_0x9bcba0,_0x4b6eb2){var _0x553c17={};var _0x4d707b={};var _0x41dc89;var _0x450a64;return db[_0x344a('0x33')][_0x344a('0x53')]({'where':{'id':_0x40eb85['params']['id']}})[_0x344a('0x1a')](handleEntityNotFound(_0x9bcba0,null))['then'](function(_0x59e2cc){if(_0x59e2cc){_0x41dc89=_0x59e2cc;_0x4d707b['model']=_['keys'](db[_0x344a('0x54')][_0x344a('0x34')]);_0x4d707b[_0x344a('0x39')]=_[_0x344a('0x3a')](_0x40eb85['query']);_0x4d707b['filters']=_['intersection'](_0x4d707b[_0x344a('0x37')],_0x4d707b[_0x344a('0x39')]);_0x553c17[_0x344a('0x3d')]=_[_0x344a('0x3c')](_0x4d707b[_0x344a('0x37')],qs['fields'](_0x40eb85[_0x344a('0x39')][_0x344a('0x3e')]));_0x553c17[_0x344a('0x3d')]=_0x553c17['attributes'][_0x344a('0x3f')]?_0x553c17['attributes']:_0x4d707b['model'];_0x553c17[_0x344a('0x42')]=qs['sort'](_0x40eb85['query'][_0x344a('0x43')]);_0x553c17[_0x344a('0x44')]=qs['filters'](_[_0x344a('0x45')](_0x40eb85['query'],_0x4d707b[_0x344a('0x3b')]));if(_0x40eb85[_0x344a('0x39')][_0x344a('0x46')]){_0x553c17['where']=_['merge'](_0x553c17[_0x344a('0x44')],{'$or':_[_0x344a('0x38')](_0x553c17[_0x344a('0x3d')],function(_0x393ca2){var _0x5e300f={};_0x5e300f[_0x393ca2]={'$like':'%'+_0x40eb85['query'][_0x344a('0x46')]+'%'};return _0x5e300f;})});}_0x553c17=_[_0x344a('0x47')]({},_0x553c17,_0x40eb85[_0x344a('0x49')]);return _0x41dc89['getConfigurations'](_0x553c17);}})[_0x344a('0x1a')](function(_0xa154fc){if(_0xa154fc){_0x450a64=_0xa154fc['length'];if(!_0x40eb85[_0x344a('0x39')]['hasOwnProperty'](_0x344a('0x41'))){_0x553c17['limit']=qs['limit'](_0x40eb85['query'][_0x344a('0x2a')]);_0x553c17[_0x344a('0x29')]=qs[_0x344a('0x29')](_0x40eb85[_0x344a('0x39')][_0x344a('0x29')]);}return _0x41dc89[_0x344a('0x52')](_0x553c17);}})['then'](function(_0x2b5409){if(_0x2b5409){return _0x2b5409?{'count':_0x450a64,'rows':_0x2b5409}:null;}})[_0x344a('0x1a')](respondWithResult(_0x9bcba0,null))[_0x344a('0x25')](handleError(_0x9bcba0,null));};exports[_0x344a('0x55')]=function(_0x26688e,_0x523774,_0x23a761){if(_0x26688e[_0x344a('0x51')]['id']){delete _0x26688e['body']['id'];}return db[_0x344a('0x33')][_0x344a('0x53')]({'where':{'id':_0x26688e[_0x344a('0x4e')]['id']}})[_0x344a('0x1a')](handleEntityNotFound(_0x523774,null))['then'](function(_0x2fd357){if(_0x2fd357){_0x26688e[_0x344a('0x51')][_0x344a('0x56')]=_0x2fd357['id'];_0x26688e[_0x344a('0x51')][_0x344a('0x57')]=integrations[_0x344a('0x58')](_0x26688e[_0x344a('0x51')][_0x344a('0x59')],_0x26688e['body'][_0x344a('0x36')]);_0x26688e[_0x344a('0x51')][_0x344a('0x5a')]=integrations[_0x344a('0x5b')](_0x26688e[_0x344a('0x51')][_0x344a('0x59')],_0x26688e[_0x344a('0x51')][_0x344a('0x36')]);return db['FreshsalesConfiguration'][_0x344a('0x50')](_0x26688e[_0x344a('0x51')],{'include':[{'model':db[_0x344a('0x5c')],'as':_0x344a('0x57')},{'model':db['FreshsalesField'],'as':_0x344a('0x5a')}]});}return null;})[_0x344a('0x1a')](respondWithResult(_0x523774,null))[_0x344a('0x25')](handleError(_0x523774,null));};exports[_0x344a('0x5d')]=function(_0x233d75,_0x1e7b71,_0x444b4c){var _0xa7e884='';var _0x5ba1ab='';return db[_0x344a('0x33')][_0x344a('0x53')]({'where':{'id':_0x233d75[_0x344a('0x4e')]['id']},'attributes':['id',_0x344a('0x5e'),'remoteUri',_0x344a('0x5f')]})[_0x344a('0x1a')](handleEntityNotFound(_0x1e7b71,null))[_0x344a('0x1a')](function(_0x2ff11d){if(_0x2ff11d){_0x5ba1ab=_0x2ff11d[_0x344a('0x5e')];_0xa7e884=_0x2ff11d[_0x344a('0x60')];var _0x59f5f6=_0x2ff11d[_0x344a('0x60')][_0x344a('0x61')](-0x1);if(_0x59f5f6==='/'){_0xa7e884=_0xa7e884[_0x344a('0x62')](0x0,_0xa7e884['lastIndexOf'](_0x59f5f6));}return rp({'method':_0x344a('0x63'),'uri':util[_0x344a('0x64')](_0x344a('0x65'),_0xa7e884,_0x344a('0x66')),'headers':{'Authorization':_0x344a('0x67')+_0x2ff11d['apiKey']},'json':!![]});}})[_0x344a('0x1a')](function(_0x31a51c){if(_0x31a51c){var _0xd50f15=_0x31a51c['users'];var _0x182fa5=![];var _0x5928ca=null;for(_0x5928ca=0x0;_0x5928ca<_0xd50f15['length'];_0x5928ca++){if(_0xd50f15[_0x5928ca][_0x344a('0x68')]===_0x5ba1ab){_0x182fa5=!![];}}if(_0x182fa5){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x344a('0x69')});}}})[_0x344a('0x1a')](respondWithResult(_0x1e7b71,null))[_0x344a('0x25')](function(_0x375c34){var _0x5e8df4=_0x233d75[_0x344a('0x39')][_0x344a('0x6a')]?0x1f4:_0x375c34['statusCode']||0x1f4;logger[_0x344a('0x20')](_0x344a('0x6b'),'getFields',_0x5e8df4,JSON['stringify'](_0x375c34));delete _0x375c34[_0x344a('0x30')];if(_0x5e8df4===0x191){_0x5e8df4=0x190;}_0x1e7b71[_0x344a('0x26')](_0x5e8df4)[_0x344a('0x31')](_0x233d75[_0x344a('0x39')]['test']?{'message':_0x344a('0x6c'),'statusCode':_0x375c34[_0x344a('0x6d')]}:_0x375c34);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index b438248..3227689 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 _0xf898=['lodash','util','api','moment','bluebird','request-promise','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xf898,0x14d));var _0x8f89=function(_0x1ebe8e,_0x1b6fff){_0x1ebe8e=_0x1ebe8e-0x0;var _0xe5db43=_0xf898[_0x1ebe8e];return _0xe5db43;};'use strict';var _=require(_0x8f89('0x0'));var util=require(_0x8f89('0x1'));var logger=require('../../config/logger')(_0x8f89('0x2'));var moment=require(_0x8f89('0x3'));var BPromise=require(_0x8f89('0x4'));var rp=require(_0x8f89('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8f89('0x6'));var integrations=require(_0x8f89('0x7'));module[_0x8f89('0x8')]=function(_0x43f8ee,_0x473667){return _0x43f8ee['define']('FreshsalesAccount',attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a37=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','FreshsalesAccount','lodash','util'];(function(_0x412342,_0x180734){var _0x3e62cb=function(_0x501fc6){while(--_0x501fc6){_0x412342['push'](_0x412342['shift']());}};_0x3e62cb(++_0x180734);}(_0x1a37,0xb4));var _0x71a3=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x1a37[_0xd0b415];return _0x2bdf2c;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var logger=require(_0x71a3('0x2'))(_0x71a3('0x3'));var moment=require(_0x71a3('0x4'));var BPromise=require(_0x71a3('0x5'));var rp=require(_0x71a3('0x6'));var fs=require('fs');var path=require(_0x71a3('0x7'));var rimraf=require(_0x71a3('0x8'));var config=require(_0x71a3('0x9'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x71a3('0xa'));module['exports']=function(_0xd09f7,_0x45050a){return _0xd09f7[_0x71a3('0xb')](_0x71a3('0xc'),attributes,{'tableName':'int_freshsales_accounts','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 159b3cf..42e08f0 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 _0xc2c7=['FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','info','catch','find','ShowFreshsalesAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3e6261,_0x24a6c9){var _0x982ab=function(_0xd6021e){while(--_0xd6021e){_0x3e6261['push'](_0x3e6261['shift']());}};_0x982ab(++_0x24a6c9);}(_0xc2c7,0x134));var _0x7c2c=function(_0x238f14,_0x3f2744){_0x238f14=_0x238f14-0x0;var _0x3fda43=_0xc2c7[_0x238f14];return _0x3fda43;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});}exports[_0x7c2c('0x15')]=function(_0x14453f){var _0x2a9539=this;return new Promise(function(_0x17df4a,_0x26be0f){return db[_0x7c2c('0x16')][_0x7c2c('0x17')]({'raw':_0x14453f[_0x7c2c('0x18')]?_0x14453f[_0x7c2c('0x18')][_0x7c2c('0x19')]===undefined?!![]:![]:!![],'where':_0x14453f[_0x7c2c('0x18')]?_0x14453f['options'][_0x7c2c('0x1a')]||null:null,'attributes':_0x14453f['options']?_0x14453f['options'][_0x7c2c('0x1b')]||null:null,'limit':_0x14453f[_0x7c2c('0x18')]?_0x14453f[_0x7c2c('0x18')][_0x7c2c('0x1c')]||null:null,'include':_0x14453f[_0x7c2c('0x18')]?_0x14453f[_0x7c2c('0x18')][_0x7c2c('0x1d')]?_['map'](_0x14453f[_0x7c2c('0x18')]['include'],function(_0x302c93){return{'model':db[_0x302c93['model']],'as':_0x302c93['as'],'attributes':_0x302c93[_0x7c2c('0x1b')],'include':_0x302c93[_0x7c2c('0x1d')]?_[_0x7c2c('0x1e')](_0x302c93['include'],function(_0x4d6ec7){return{'model':db[_0x4d6ec7[_0x7c2c('0x1f')]],'as':_0x4d6ec7['as'],'attributes':_0x4d6ec7[_0x7c2c('0x1b')],'include':_0x4d6ec7[_0x7c2c('0x1d')]?_[_0x7c2c('0x1e')](_0x4d6ec7[_0x7c2c('0x1d')],function(_0xa8e145){return{'model':db[_0xa8e145[_0x7c2c('0x1f')]],'as':_0xa8e145['as'],'attributes':_0xa8e145['attributes']};}):[]};}):[]};}):[]:[]})[_0x7c2c('0xc')](function(_0xf39941){logger[_0x7c2c('0x20')](_0x7c2c('0x15'),_0x14453f);logger[_0x7c2c('0xf')](_0x7c2c('0x15'),_0x14453f,JSON[_0x7c2c('0x11')](_0xf39941));_0x17df4a(_0xf39941);})[_0x7c2c('0x21')](function(_0xa040ff){logger['error'](_0x7c2c('0x15'),_0xa040ff[_0x7c2c('0x14')],_0x14453f);_0x26be0f(_0x2a9539[_0x7c2c('0x12')](0x1f4,_0xa040ff[_0x7c2c('0x14')]));});});};exports['ShowFreshsalesAccount']=function(_0xcb98ba){var _0x30dd1c=this;return new Promise(function(_0x4192c8,_0x1ef88b){return db[_0x7c2c('0x16')][_0x7c2c('0x22')]({'raw':_0xcb98ba[_0x7c2c('0x18')]?_0xcb98ba['options'][_0x7c2c('0x19')]===undefined?!![]:![]:!![],'where':_0xcb98ba[_0x7c2c('0x18')]?_0xcb98ba[_0x7c2c('0x18')][_0x7c2c('0x1a')]||null:null,'attributes':_0xcb98ba[_0x7c2c('0x18')]?_0xcb98ba['options']['attributes']||null:null,'include':_0xcb98ba[_0x7c2c('0x18')]?_0xcb98ba['options']['include']?_[_0x7c2c('0x1e')](_0xcb98ba[_0x7c2c('0x18')][_0x7c2c('0x1d')],function(_0x156c03){return{'model':db[_0x156c03['model']],'as':_0x156c03['as'],'attributes':_0x156c03[_0x7c2c('0x1b')],'include':_0x156c03[_0x7c2c('0x1d')]?_[_0x7c2c('0x1e')](_0x156c03[_0x7c2c('0x1d')],function(_0x204968){return{'model':db[_0x204968[_0x7c2c('0x1f')]],'as':_0x204968['as'],'attributes':_0x204968[_0x7c2c('0x1b')],'include':_0x204968[_0x7c2c('0x1d')]?_[_0x7c2c('0x1e')](_0x204968[_0x7c2c('0x1d')],function(_0x3230a1){return{'model':db[_0x3230a1[_0x7c2c('0x1f')]],'as':_0x3230a1['as'],'attributes':_0x3230a1[_0x7c2c('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54cbb7){logger[_0x7c2c('0x20')]('ShowFreshsalesAccount',_0xcb98ba);logger['debug']('ShowFreshsalesAccount',_0xcb98ba,JSON[_0x7c2c('0x11')](_0x54cbb7));_0x4192c8(_0x54cbb7);})[_0x7c2c('0x21')](function(_0x129bf0){logger[_0x7c2c('0x12')](_0x7c2c('0x23'),_0x129bf0[_0x7c2c('0x14')],_0xcb98ba);_0x1ef88b(_0x30dd1c[_0x7c2c('0x12')](0x1f4,_0x129bf0[_0x7c2c('0x14')]));});});}; \ No newline at end of file +var _0x404d=['stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','model','map','then','find','debug','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x5333eb,_0x581bfc){var _0xcaecd0=function(_0x539d6d){while(--_0x539d6d){_0x5333eb['push'](_0x5333eb['shift']());}};_0xcaecd0(++_0x581bfc);}(_0x404d,0x1e9));var _0xd404=function(_0x37b456,_0xc6017c){_0x37b456=_0x37b456-0x0;var _0x5dbf32=_0x404d[_0x37b456];return _0x5dbf32;};'use strict';var _=require(_0xd404('0x0'));var util=require(_0xd404('0x1'));var moment=require(_0xd404('0x2'));var BPromise=require(_0xd404('0x3'));var rs=require(_0xd404('0x4'));var fs=require('fs');var Redis=require(_0xd404('0x5'));var db=require(_0xd404('0x6'))['db'];var utils=require(_0xd404('0x7'));var logger=require(_0xd404('0x8'))('rpc');var config=require(_0xd404('0x9'));var jayson=require(_0xd404('0xa'));var client=jayson['client'][_0xd404('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7faf39,_0x5da99f,_0x5c335f){return new BPromise(function(_0x10021a,_0x3d7e8a){return client['request'](_0x7faf39,_0x5c335f)['then'](function(_0x3096f0){logger[_0xd404('0xc')](_0xd404('0xd'),_0x5da99f,_0xd404('0xe'));logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x5da99f,_0xd404('0xe'),JSON[_0xd404('0xf')](_0x3096f0));if(_0x3096f0['error']){if(_0x3096f0[_0xd404('0x10')][_0xd404('0x11')]===0x1f4){logger[_0xd404('0x10')](_0xd404('0xd'),_0x5da99f,_0x3096f0[_0xd404('0x10')][_0xd404('0x12')]);return _0x3d7e8a(_0x3096f0[_0xd404('0x10')][_0xd404('0x12')]);}logger[_0xd404('0x10')](_0xd404('0xd'),_0x5da99f,_0x3096f0[_0xd404('0x10')][_0xd404('0x12')]);return _0x10021a(_0x3096f0[_0xd404('0x10')][_0xd404('0x12')]);}else{logger[_0xd404('0xc')](_0xd404('0xd'),_0x5da99f,_0xd404('0xe'));_0x10021a(_0x3096f0[_0xd404('0x13')][_0xd404('0x12')]);}})[_0xd404('0x14')](function(_0x155186){logger['error'](_0xd404('0xd'),_0x5da99f,_0x155186);_0x3d7e8a(_0x155186);});});}exports[_0xd404('0x15')]=function(_0x5e19e4){var _0x3a5a16=this;return new Promise(function(_0x149fa5,_0x5e15c0){return db[_0xd404('0x16')][_0xd404('0x17')]({'raw':_0x5e19e4[_0xd404('0x18')]?_0x5e19e4['options'][_0xd404('0x19')]===undefined?!![]:![]:!![],'where':_0x5e19e4[_0xd404('0x18')]?_0x5e19e4[_0xd404('0x18')][_0xd404('0x1a')]||null:null,'attributes':_0x5e19e4[_0xd404('0x18')]?_0x5e19e4[_0xd404('0x18')][_0xd404('0x1b')]||null:null,'limit':_0x5e19e4['options']?_0x5e19e4[_0xd404('0x18')][_0xd404('0x1c')]||null:null,'include':_0x5e19e4['options']?_0x5e19e4[_0xd404('0x18')]['include']?_['map'](_0x5e19e4[_0xd404('0x18')][_0xd404('0x1d')],function(_0x133232){return{'model':db[_0x133232[_0xd404('0x1e')]],'as':_0x133232['as'],'attributes':_0x133232['attributes'],'include':_0x133232[_0xd404('0x1d')]?_[_0xd404('0x1f')](_0x133232[_0xd404('0x1d')],function(_0x55cfde){return{'model':db[_0x55cfde['model']],'as':_0x55cfde['as'],'attributes':_0x55cfde[_0xd404('0x1b')],'include':_0x55cfde[_0xd404('0x1d')]?_[_0xd404('0x1f')](_0x55cfde[_0xd404('0x1d')],function(_0x1ddf0d){return{'model':db[_0x1ddf0d[_0xd404('0x1e')]],'as':_0x1ddf0d['as'],'attributes':_0x1ddf0d[_0xd404('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd404('0x20')](function(_0x586b97){logger['info'](_0xd404('0x15'),_0x5e19e4);logger['debug'](_0xd404('0x15'),_0x5e19e4,JSON['stringify'](_0x586b97));_0x149fa5(_0x586b97);})[_0xd404('0x14')](function(_0x1e6341){logger[_0xd404('0x10')](_0xd404('0x15'),_0x1e6341[_0xd404('0x12')],_0x5e19e4);_0x5e15c0(_0x3a5a16[_0xd404('0x10')](0x1f4,_0x1e6341[_0xd404('0x12')]));});});};exports['ShowFreshsalesAccount']=function(_0x585b67){var _0xc60d87=this;return new Promise(function(_0x541c78,_0x51663f){return db[_0xd404('0x16')][_0xd404('0x21')]({'raw':_0x585b67[_0xd404('0x18')]?_0x585b67['options'][_0xd404('0x19')]===undefined?!![]:![]:!![],'where':_0x585b67['options']?_0x585b67[_0xd404('0x18')][_0xd404('0x1a')]||null:null,'attributes':_0x585b67['options']?_0x585b67[_0xd404('0x18')][_0xd404('0x1b')]||null:null,'include':_0x585b67[_0xd404('0x18')]?_0x585b67[_0xd404('0x18')][_0xd404('0x1d')]?_['map'](_0x585b67[_0xd404('0x18')][_0xd404('0x1d')],function(_0x39a3d0){return{'model':db[_0x39a3d0['model']],'as':_0x39a3d0['as'],'attributes':_0x39a3d0[_0xd404('0x1b')],'include':_0x39a3d0[_0xd404('0x1d')]?_[_0xd404('0x1f')](_0x39a3d0[_0xd404('0x1d')],function(_0x5a6389){return{'model':db[_0x5a6389['model']],'as':_0x5a6389['as'],'attributes':_0x5a6389[_0xd404('0x1b')],'include':_0x5a6389[_0xd404('0x1d')]?_[_0xd404('0x1f')](_0x5a6389[_0xd404('0x1d')],function(_0x3ad796){return{'model':db[_0x3ad796[_0xd404('0x1e')]],'as':_0x3ad796['as'],'attributes':_0x3ad796['attributes']};}):[]};}):[]};}):[]:[]})[_0xd404('0x20')](function(_0xd143f3){logger[_0xd404('0xc')]('ShowFreshsalesAccount',_0x585b67);logger[_0xd404('0x22')](_0xd404('0x23'),_0x585b67,JSON[_0xd404('0xf')](_0xd143f3));_0x541c78(_0xd143f3);})['catch'](function(_0x32d376){logger[_0xd404('0x10')](_0xd404('0x23'),_0x32d376['message'],_0x585b67);_0x51663f(_0xc60d87[_0xd404('0x10')](0x1f4,_0x32d376[_0xd404('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index d4e7009..1f3f7be 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 _0xe1c5=['get','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','getFields','post','/:id','destroy','multer','util','path','connect-timeout','express','Router','./intFreshsalesConfiguration.controller','isAuthenticated','index','show'];(function(_0x5f0861,_0x42207e){var _0x1442dc=function(_0x565212){while(--_0x565212){_0x5f0861['push'](_0x5f0861['shift']());}};_0x1442dc(++_0x42207e);}(_0xe1c5,0x1e4));var _0x5e1c=function(_0x334b6f,_0x1feae7){_0x334b6f=_0x334b6f-0x0;var _0x3697b1=_0xe1c5[_0x334b6f];return _0x3697b1;};'use strict';var multer=require(_0x5e1c('0x0'));var util=require(_0x5e1c('0x1'));var path=require(_0x5e1c('0x2'));var timeout=require(_0x5e1c('0x3'));var express=require(_0x5e1c('0x4'));var router=express[_0x5e1c('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5e1c('0x6'));router['get']('/',auth[_0x5e1c('0x7')](),controller[_0x5e1c('0x8')]);router['get']('/:id',auth[_0x5e1c('0x7')](),controller[_0x5e1c('0x9')]);router[_0x5e1c('0xa')](_0x5e1c('0xb'),auth[_0x5e1c('0x7')](),controller[_0x5e1c('0xc')]);router[_0x5e1c('0xa')](_0x5e1c('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x5e1c('0xa')](_0x5e1c('0xe'),auth[_0x5e1c('0x7')](),controller[_0x5e1c('0xf')]);router[_0x5e1c('0x10')]('/',auth[_0x5e1c('0x7')](),controller['create']);router['put'](_0x5e1c('0x11'),auth[_0x5e1c('0x7')](),controller['update']);router['delete'](_0x5e1c('0x11'),auth[_0x5e1c('0x7')](),controller[_0x5e1c('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5360=['getFields','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','/:id','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x1d3f3a,_0x1cd240){var _0x268805=function(_0x53850c){while(--_0x53850c){_0x1d3f3a['push'](_0x1d3f3a['shift']());}};_0x268805(++_0x1cd240);}(_0x5360,0x157));var _0x0536=function(_0x3b086d,_0x5c6927){_0x3b086d=_0x3b086d-0x0;var _0x3e43aa=_0x5360[_0x3b086d];return _0x3e43aa;};'use strict';var multer=require(_0x0536('0x0'));var util=require(_0x0536('0x1'));var path=require(_0x0536('0x2'));var timeout=require(_0x0536('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x0536('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0536('0x5'));var controller=require(_0x0536('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0536('0x7')](_0x0536('0x8'),auth[_0x0536('0x9')](),controller[_0x0536('0xa')]);router['get'](_0x0536('0xb'),auth[_0x0536('0x9')](),controller[_0x0536('0xc')]);router['get'](_0x0536('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router['get']('/:id/fields',auth[_0x0536('0x9')](),controller[_0x0536('0xe')]);router[_0x0536('0xf')]('/',auth[_0x0536('0x9')](),controller[_0x0536('0x10')]);router[_0x0536('0x11')](_0x0536('0x8'),auth[_0x0536('0x9')](),controller[_0x0536('0x12')]);router[_0x0536('0x13')](_0x0536('0x8'),auth[_0x0536('0x9')](),controller[_0x0536('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 5c61de8..56cf2ce 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 _0x9687=['exports','STRING'];(function(_0x1f5b54,_0x52d371){var _0x3f3a56=function(_0x21ae98){while(--_0x21ae98){_0x1f5b54['push'](_0x1f5b54['shift']());}};_0x3f3a56(++_0x52d371);}(_0x9687,0x96));var _0x7968=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x9687[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require('sequelize');module[_0x7968('0x0')]={'name':{'type':Sequelize[_0x7968('0x1')]},'description':{'type':Sequelize[_0x7968('0x1')]}}; \ No newline at end of file +var _0x00a5=['STRING','sequelize','exports'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x00a5,0x6d));var _0x500a=function(_0x270917,_0x39e83a){_0x270917=_0x270917-0x0;var _0x4351be=_0x00a5[_0x270917];return _0x4351be;};'use strict';var Sequelize=require(_0x500a('0x0'));module[_0x500a('0x1')]={'name':{'type':Sequelize[_0x500a('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index c737e8c..2e96349 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 _0x7fbe=['model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','VIRTUAL','filter','merge','options','include','findAll','params','includeAll','find','catch','update','body','getSubjects','findOne','FreshsalesField','pick','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','end','status','json','count','offset','set','Content-Range','apply','save','then','destroy','stack','name','send','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key'];(function(_0x75f2c4,_0x4c3e0a){var _0x31093a=function(_0x3176a9){while(--_0x3176a9){_0x75f2c4['push'](_0x75f2c4['shift']());}};_0x31093a(++_0x4c3e0a);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x32f9cd,_0x4ffb36){_0x32f9cd=_0x32f9cd-0x0;var _0xe80ced=_0x7fbe[_0x32f9cd];return _0xe80ced;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe7fb('0x0'));var zipdir=require(_0xe7fb('0x1'));var jsonpatch=require(_0xe7fb('0x2'));var rp=require(_0xe7fb('0x3'));var moment=require(_0xe7fb('0x4'));var BPromise=require(_0xe7fb('0x5'));var Mustache=require(_0xe7fb('0x6'));var util=require(_0xe7fb('0x7'));var path=require(_0xe7fb('0x8'));var sox=require(_0xe7fb('0x9'));var csv=require(_0xe7fb('0xa'));var ejs=require(_0xe7fb('0xb'));var fs=require('fs');var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0xa'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];var jayson=require(_0xe7fb('0x1b'));var client=jayson[_0xe7fb('0x1c')][_0xe7fb('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x45fe75,_0x7fe4d3,_0x598729,_0x278b75){return new BPromise(function(_0x2225e5,_0x5573ab){var _0x30015a=_0x278b75||client;return _0x30015a[_0xe7fb('0x1e')](_0x45fe75,_0x598729)['then'](function(_0xa76acf){logger['info'](_0xe7fb('0x1f'),_0x7fe4d3,_0xe7fb('0x20'));logger[_0xe7fb('0x21')](_0xe7fb('0x22'),_0x7fe4d3,'request\x20sent',JSON[_0xe7fb('0x23')](_0xa76acf));if(_0xa76acf['error']){if(_0xa76acf[_0xe7fb('0x24')]['code']===0x1f4){logger[_0xe7fb('0x24')](_0xe7fb('0x1f'),_0x7fe4d3,_0xa76acf[_0xe7fb('0x24')][_0xe7fb('0x25')]);return _0x5573ab(_0xa76acf['error'][_0xe7fb('0x25')]);}logger['error'](_0xe7fb('0x1f'),_0x7fe4d3,_0xa76acf['error'][_0xe7fb('0x25')]);return _0x2225e5(_0xa76acf['error'][_0xe7fb('0x25')]);}else{logger[_0xe7fb('0x26')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x7fe4d3,_0xe7fb('0x20'));_0x2225e5(_0xa76acf[_0xe7fb('0x27')][_0xe7fb('0x25')]);}})['catch'](function(_0x469d50){logger[_0xe7fb('0x24')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x7fe4d3,_0x469d50);_0x5573ab(_0x469d50);});});}function respondWithStatusCode(_0x5bea27,_0x52f08b){_0x52f08b=_0x52f08b||0xcc;return function(_0x35e4db){if(_0x35e4db){return _0x5bea27['sendStatus'](_0x52f08b);}return _0x5bea27['status'](_0x52f08b)[_0xe7fb('0x28')]();};}function respondWithResult(_0x32e8b2,_0x2996ae){_0x2996ae=_0x2996ae||0xc8;return function(_0x4f6c73){if(_0x4f6c73){return _0x32e8b2[_0xe7fb('0x29')](_0x2996ae)[_0xe7fb('0x2a')](_0x4f6c73);}};}function respondWithFilteredResult(_0x390f32,_0x1ceed8){return function(_0x392d75){if(_0x392d75){var _0x16237a=_0x392d75[_0xe7fb('0x2b')],_0x380130=_0x1ceed8[_0xe7fb('0x2c')],_0x59e015=_0x1ceed8[_0xe7fb('0x2c')]+_0x1ceed8['limit'],_0x5df9f2;if(_0x59e015>=_0x16237a){_0x59e015=_0x16237a;_0x5df9f2=0xc8;}else{_0x5df9f2=0xce;}_0x390f32[_0xe7fb('0x29')](_0x5df9f2);return _0x390f32[_0xe7fb('0x2d')](_0xe7fb('0x2e'),_0x380130+'-'+_0x59e015+'/'+_0x16237a)[_0xe7fb('0x2a')](_0x392d75);}return null;};}function patchUpdates(_0x219554){return function(_0x1256d4){try{jsonpatch[_0xe7fb('0x2f')](_0x1256d4,_0x219554,!![]);}catch(_0x3dd0be){return BPromise['reject'](_0x3dd0be);}return _0x1256d4[_0xe7fb('0x30')]();};}function saveUpdates(_0x1742f3,_0x29d1ca){return function(_0x547a04){if(_0x547a04){return _0x547a04['update'](_0x1742f3)[_0xe7fb('0x31')](function(_0x4a9fea){return _0x4a9fea;});}return null;};}function removeEntity(_0xac56b4,_0x2f8774){return function(_0xe49053){if(_0xe49053){return _0xe49053[_0xe7fb('0x32')]()['then'](function(){_0xac56b4[_0xe7fb('0x29')](0xcc)[_0xe7fb('0x28')]();});}};}function handleEntityNotFound(_0x18ed83,_0x2f8818){return function(_0x2d650d){if(!_0x2d650d){_0x18ed83['sendStatus'](0x194);}return _0x2d650d;};}function handleError(_0x256694,_0x121d19){_0x121d19=_0x121d19||0x1f4;return function(_0x209eaa){logger[_0xe7fb('0x24')](_0x209eaa[_0xe7fb('0x33')]);if(_0x209eaa[_0xe7fb('0x34')]){delete _0x209eaa[_0xe7fb('0x34')];}_0x256694[_0xe7fb('0x29')](_0x121d19)[_0xe7fb('0x35')](_0x209eaa);};}exports['index']=function(_0x44d8cf,_0x29ef52){var _0x2593e3={},_0x56e17b={},_0x1de75a={'count':0x0,'rows':[]};var _0x3502dc=_[_0xe7fb('0x36')](db[_0xe7fb('0x37')][_0xe7fb('0x38')],function(_0x35b828){return{'name':_0x35b828[_0xe7fb('0x39')],'type':_0x35b828[_0xe7fb('0x3a')][_0xe7fb('0x3b')]};});_0x56e17b[_0xe7fb('0x3c')]=_[_0xe7fb('0x36')](_0x3502dc,_0xe7fb('0x34'));_0x56e17b[_0xe7fb('0x3d')]=_[_0xe7fb('0x3e')](_0x44d8cf[_0xe7fb('0x3d')]);_0x56e17b[_0xe7fb('0x3f')]=_[_0xe7fb('0x40')](_0x56e17b[_0xe7fb('0x3c')],_0x56e17b[_0xe7fb('0x3d')]);_0x2593e3['attributes']=_[_0xe7fb('0x40')](_0x56e17b[_0xe7fb('0x3c')],qs[_0xe7fb('0x41')](_0x44d8cf[_0xe7fb('0x3d')]['fields']));_0x2593e3[_0xe7fb('0x42')]=_0x2593e3[_0xe7fb('0x42')][_0xe7fb('0x43')]?_0x2593e3[_0xe7fb('0x42')]:_0x56e17b['model'];if(!_0x44d8cf[_0xe7fb('0x3d')][_0xe7fb('0x44')](_0xe7fb('0x45'))){_0x2593e3[_0xe7fb('0x46')]=qs[_0xe7fb('0x46')](_0x44d8cf[_0xe7fb('0x3d')]['limit']);_0x2593e3[_0xe7fb('0x2c')]=qs[_0xe7fb('0x2c')](_0x44d8cf[_0xe7fb('0x3d')]['offset']);}_0x2593e3[_0xe7fb('0x47')]=qs[_0xe7fb('0x48')](_0x44d8cf['query']['sort']);_0x2593e3['where']=qs['filters'](_['pick'](_0x44d8cf[_0xe7fb('0x3d')],_0x56e17b[_0xe7fb('0x3f')]),_0x3502dc);if(_0x44d8cf[_0xe7fb('0x3d')]['filter']){_0x2593e3[_0xe7fb('0x49')]=_['merge'](_0x2593e3[_0xe7fb('0x49')],{'$or':_[_0xe7fb('0x36')](_0x3502dc,function(_0x4d29d3){if(_0x4d29d3[_0xe7fb('0x3a')]!==_0xe7fb('0x4a')){var _0x240efa={};_0x240efa[_0x4d29d3[_0xe7fb('0x34')]]={'$like':'%'+_0x44d8cf['query'][_0xe7fb('0x4b')]+'%'};return _0x240efa;}})});}_0x2593e3=_[_0xe7fb('0x4c')]({},_0x2593e3,_0x44d8cf[_0xe7fb('0x4d')]);var _0x56a84f={'where':_0x2593e3[_0xe7fb('0x49')]};return db[_0xe7fb('0x37')][_0xe7fb('0x2b')](_0x56a84f)[_0xe7fb('0x31')](function(_0xc07c40){_0x1de75a['count']=_0xc07c40;if(_0x44d8cf[_0xe7fb('0x3d')]['includeAll']){_0x2593e3[_0xe7fb('0x4e')]=[{'all':!![]}];}return db[_0xe7fb('0x37')][_0xe7fb('0x4f')](_0x2593e3);})[_0xe7fb('0x31')](function(_0x15cec3){_0x1de75a['rows']=_0x15cec3;return _0x1de75a;})[_0xe7fb('0x31')](respondWithFilteredResult(_0x29ef52,_0x2593e3))['catch'](handleError(_0x29ef52,null));};exports['show']=function(_0x12c828,_0x3d740f){var _0x16327f={'raw':![],'where':{'id':_0x12c828[_0xe7fb('0x50')]['id']}},_0x589555={};_0x589555[_0xe7fb('0x3c')]=_['keys'](db['FreshsalesConfiguration'][_0xe7fb('0x38')]);_0x589555[_0xe7fb('0x3d')]=_[_0xe7fb('0x3e')](_0x12c828[_0xe7fb('0x3d')]);_0x589555[_0xe7fb('0x3f')]=_[_0xe7fb('0x40')](_0x589555[_0xe7fb('0x3c')],_0x589555[_0xe7fb('0x3d')]);_0x16327f['attributes']=_[_0xe7fb('0x40')](_0x589555['model'],qs[_0xe7fb('0x41')](_0x12c828[_0xe7fb('0x3d')]['fields']));_0x16327f[_0xe7fb('0x42')]=_0x16327f['attributes'][_0xe7fb('0x43')]?_0x16327f['attributes']:_0x589555[_0xe7fb('0x3c')];if(_0x12c828['query'][_0xe7fb('0x51')]){_0x16327f['include']=[{'all':!![]}];}_0x16327f=_[_0xe7fb('0x4c')]({},_0x16327f,_0x12c828[_0xe7fb('0x4d')]);return db[_0xe7fb('0x37')][_0xe7fb('0x52')](_0x16327f)[_0xe7fb('0x31')](handleEntityNotFound(_0x3d740f,null))[_0xe7fb('0x31')](respondWithResult(_0x3d740f,null))[_0xe7fb('0x53')](handleError(_0x3d740f,null));};exports['create']=function(_0x5d20dc,_0x20aa55){return db['FreshsalesConfiguration']['create'](_0x5d20dc['body'],{})['then'](respondWithResult(_0x20aa55,0xc9))['catch'](handleError(_0x20aa55,null));};exports[_0xe7fb('0x54')]=function(_0x34dd69,_0xd2fd76){if(_0x34dd69[_0xe7fb('0x55')]['id']){delete _0x34dd69['body']['id'];}return db[_0xe7fb('0x37')][_0xe7fb('0x52')]({'where':{'id':_0x34dd69[_0xe7fb('0x50')]['id']}})['then'](handleEntityNotFound(_0xd2fd76,null))['then'](saveUpdates(_0x34dd69[_0xe7fb('0x55')],null))[_0xe7fb('0x31')](respondWithResult(_0xd2fd76,null))[_0xe7fb('0x53')](handleError(_0xd2fd76,null));};exports['destroy']=function(_0x27f860,_0x3d946b){return db[_0xe7fb('0x37')][_0xe7fb('0x52')]({'where':{'id':_0x27f860['params']['id']}})['then'](handleEntityNotFound(_0x3d946b,null))[_0xe7fb('0x31')](removeEntity(_0x3d946b,null))[_0xe7fb('0x53')](handleError(_0x3d946b,null));};exports[_0xe7fb('0x56')]=function(_0x2f61b1,_0x3b0147,_0x5dd7c8){var _0x9c45a={};var _0x349a2a={};var _0x23755b;var _0x590d7a;return db['FreshsalesConfiguration'][_0xe7fb('0x57')]({'where':{'id':_0x2f61b1[_0xe7fb('0x50')]['id']}})[_0xe7fb('0x31')](handleEntityNotFound(_0x3b0147,null))[_0xe7fb('0x31')](function(_0x40f546){if(_0x40f546){_0x23755b=_0x40f546;_0x349a2a[_0xe7fb('0x3c')]=_['keys'](db[_0xe7fb('0x58')][_0xe7fb('0x38')]);_0x349a2a[_0xe7fb('0x3d')]=_[_0xe7fb('0x3e')](_0x2f61b1[_0xe7fb('0x3d')]);_0x349a2a[_0xe7fb('0x3f')]=_['intersection'](_0x349a2a[_0xe7fb('0x3c')],_0x349a2a['query']);_0x9c45a[_0xe7fb('0x42')]=_[_0xe7fb('0x40')](_0x349a2a[_0xe7fb('0x3c')],qs[_0xe7fb('0x41')](_0x2f61b1['query']['fields']));_0x9c45a[_0xe7fb('0x42')]=_0x9c45a[_0xe7fb('0x42')][_0xe7fb('0x43')]?_0x9c45a[_0xe7fb('0x42')]:_0x349a2a[_0xe7fb('0x3c')];_0x9c45a['order']=qs[_0xe7fb('0x48')](_0x2f61b1['query'][_0xe7fb('0x48')]);_0x9c45a['where']=qs['filters'](_[_0xe7fb('0x59')](_0x2f61b1[_0xe7fb('0x3d')],_0x349a2a[_0xe7fb('0x3f')]));if(_0x2f61b1['query'][_0xe7fb('0x4b')]){_0x9c45a[_0xe7fb('0x49')]=_[_0xe7fb('0x4c')](_0x9c45a[_0xe7fb('0x49')],{'$or':_[_0xe7fb('0x36')](_0x9c45a['attributes'],function(_0x404498){var _0x3c153a={};_0x3c153a[_0x404498]={'$like':'%'+_0x2f61b1['query'][_0xe7fb('0x4b')]+'%'};return _0x3c153a;})});}_0x9c45a=_[_0xe7fb('0x4c')]({},_0x9c45a,_0x2f61b1['options']);return _0x23755b[_0xe7fb('0x56')](_0x9c45a);}})['then'](function(_0x2705ef){if(_0x2705ef){_0x590d7a=_0x2705ef[_0xe7fb('0x43')];if(!_0x2f61b1[_0xe7fb('0x3d')]['hasOwnProperty'](_0xe7fb('0x45'))){_0x9c45a[_0xe7fb('0x46')]=qs[_0xe7fb('0x46')](_0x2f61b1[_0xe7fb('0x3d')][_0xe7fb('0x46')]);_0x9c45a[_0xe7fb('0x2c')]=qs[_0xe7fb('0x2c')](_0x2f61b1[_0xe7fb('0x3d')]['offset']);}return _0x23755b['getSubjects'](_0x9c45a);}})[_0xe7fb('0x31')](function(_0x3a674e){if(_0x3a674e){return _0x3a674e?{'count':_0x590d7a,'rows':_0x3a674e}:null;}})[_0xe7fb('0x31')](respondWithResult(_0x3b0147,null))['catch'](handleError(_0x3b0147,null));};exports['getDescriptions']=function(_0x1ac1fd,_0x2b071c,_0xad7c53){var _0x1df857={};var _0x2d558c={};var _0x336fd3;var _0x188e57;return db[_0xe7fb('0x37')][_0xe7fb('0x57')]({'where':{'id':_0x1ac1fd[_0xe7fb('0x50')]['id']}})[_0xe7fb('0x31')](handleEntityNotFound(_0x2b071c,null))[_0xe7fb('0x31')](function(_0x12b91f){if(_0x12b91f){_0x336fd3=_0x12b91f;_0x2d558c['model']=_['keys'](db[_0xe7fb('0x58')][_0xe7fb('0x38')]);_0x2d558c[_0xe7fb('0x3d')]=_[_0xe7fb('0x3e')](_0x1ac1fd[_0xe7fb('0x3d')]);_0x2d558c['filters']=_[_0xe7fb('0x40')](_0x2d558c[_0xe7fb('0x3c')],_0x2d558c[_0xe7fb('0x3d')]);_0x1df857[_0xe7fb('0x42')]=_[_0xe7fb('0x40')](_0x2d558c[_0xe7fb('0x3c')],qs[_0xe7fb('0x41')](_0x1ac1fd[_0xe7fb('0x3d')][_0xe7fb('0x41')]));_0x1df857['attributes']=_0x1df857[_0xe7fb('0x42')]['length']?_0x1df857[_0xe7fb('0x42')]:_0x2d558c[_0xe7fb('0x3c')];_0x1df857[_0xe7fb('0x47')]=qs[_0xe7fb('0x48')](_0x1ac1fd[_0xe7fb('0x3d')]['sort']);_0x1df857[_0xe7fb('0x49')]=qs[_0xe7fb('0x3f')](_[_0xe7fb('0x59')](_0x1ac1fd[_0xe7fb('0x3d')],_0x2d558c[_0xe7fb('0x3f')]));if(_0x1ac1fd[_0xe7fb('0x3d')][_0xe7fb('0x4b')]){_0x1df857[_0xe7fb('0x49')]=_[_0xe7fb('0x4c')](_0x1df857[_0xe7fb('0x49')],{'$or':_[_0xe7fb('0x36')](_0x1df857[_0xe7fb('0x42')],function(_0x3a68c0){var _0x300a7c={};_0x300a7c[_0x3a68c0]={'$like':'%'+_0x1ac1fd['query']['filter']+'%'};return _0x300a7c;})});}_0x1df857=_['merge']({},_0x1df857,_0x1ac1fd[_0xe7fb('0x4d')]);return _0x336fd3[_0xe7fb('0x5a')](_0x1df857);}})[_0xe7fb('0x31')](function(_0x2789f0){if(_0x2789f0){_0x188e57=_0x2789f0['length'];if(!_0x1ac1fd[_0xe7fb('0x3d')][_0xe7fb('0x44')](_0xe7fb('0x45'))){_0x1df857[_0xe7fb('0x46')]=qs['limit'](_0x1ac1fd[_0xe7fb('0x3d')]['limit']);_0x1df857[_0xe7fb('0x2c')]=qs[_0xe7fb('0x2c')](_0x1ac1fd[_0xe7fb('0x3d')][_0xe7fb('0x2c')]);}return _0x336fd3[_0xe7fb('0x5a')](_0x1df857);}})['then'](function(_0x3ffd6c){if(_0x3ffd6c){return _0x3ffd6c?{'count':_0x188e57,'rows':_0x3ffd6c}:null;}})['then'](respondWithResult(_0x2b071c,null))[_0xe7fb('0x53')](handleError(_0x2b071c,null));};exports['getFields']=function(_0x2aeeed,_0x38f52c,_0x4c37cd){var _0x2b6d69={};var _0x31642f={};var _0xb19e94;var _0x4181fd;return db['FreshsalesConfiguration'][_0xe7fb('0x57')]({'where':{'id':_0x2aeeed[_0xe7fb('0x50')]['id']}})[_0xe7fb('0x31')](handleEntityNotFound(_0x38f52c,null))['then'](function(_0x11d5b6){if(_0x11d5b6){_0xb19e94=_0x11d5b6;_0x31642f['model']=_['keys'](db['FreshsalesField'][_0xe7fb('0x38')]);_0x31642f[_0xe7fb('0x3d')]=_['keys'](_0x2aeeed[_0xe7fb('0x3d')]);_0x31642f[_0xe7fb('0x3f')]=_[_0xe7fb('0x40')](_0x31642f[_0xe7fb('0x3c')],_0x31642f[_0xe7fb('0x3d')]);_0x2b6d69[_0xe7fb('0x42')]=_[_0xe7fb('0x40')](_0x31642f[_0xe7fb('0x3c')],qs[_0xe7fb('0x41')](_0x2aeeed[_0xe7fb('0x3d')][_0xe7fb('0x41')]));_0x2b6d69[_0xe7fb('0x42')]=_0x2b6d69[_0xe7fb('0x42')][_0xe7fb('0x43')]?_0x2b6d69[_0xe7fb('0x42')]:_0x31642f[_0xe7fb('0x3c')];_0x2b6d69[_0xe7fb('0x47')]=qs[_0xe7fb('0x48')](_0x2aeeed[_0xe7fb('0x3d')][_0xe7fb('0x48')]);_0x2b6d69['where']=qs[_0xe7fb('0x3f')](_[_0xe7fb('0x59')](_0x2aeeed[_0xe7fb('0x3d')],_0x31642f[_0xe7fb('0x3f')]));if(_0x2aeeed[_0xe7fb('0x3d')][_0xe7fb('0x4b')]){_0x2b6d69[_0xe7fb('0x49')]=_['merge'](_0x2b6d69['where'],{'$or':_[_0xe7fb('0x36')](_0x2b6d69['attributes'],function(_0x2f486){var _0x496205={};_0x496205[_0x2f486]={'$like':'%'+_0x2aeeed['query'][_0xe7fb('0x4b')]+'%'};return _0x496205;})});}_0x2b6d69=_[_0xe7fb('0x4c')]({},_0x2b6d69,_0x2aeeed[_0xe7fb('0x4d')]);return _0xb19e94[_0xe7fb('0x5b')](_0x2b6d69);}})[_0xe7fb('0x31')](function(_0x38cc9e){if(_0x38cc9e){_0x4181fd=_0x38cc9e['length'];if(!_0x2aeeed[_0xe7fb('0x3d')][_0xe7fb('0x44')](_0xe7fb('0x45'))){_0x2b6d69[_0xe7fb('0x46')]=qs[_0xe7fb('0x46')](_0x2aeeed[_0xe7fb('0x3d')]['limit']);_0x2b6d69['offset']=qs['offset'](_0x2aeeed[_0xe7fb('0x3d')][_0xe7fb('0x2c')]);}return _0xb19e94[_0xe7fb('0x5b')](_0x2b6d69);}})['then'](function(_0xfa895b){if(_0xfa895b){return _0xfa895b?{'count':_0x4181fd,'rows':_0xfa895b}:null;}})['then'](respondWithResult(_0x38f52c,null))[_0xe7fb('0x53')](handleError(_0x38f52c,null));}; \ No newline at end of file +var _0x1261=['result','message','status','end','json','count','offset','limit','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','index','map','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','FreshsalesConfiguration','include','findAll','rows','show','keys','includeAll','find','catch','create','body','params','getSubjects','findOne','FreshsalesField','pick','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','FreshsalesConfiguration,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1261,0x144));var _0x1126=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x1261[_0x24f31b];return _0x488401;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1126('0x0'));var rimraf=require(_0x1126('0x1'));var zipdir=require(_0x1126('0x2'));var jsonpatch=require(_0x1126('0x3'));var rp=require(_0x1126('0x4'));var moment=require(_0x1126('0x5'));var BPromise=require(_0x1126('0x6'));var Mustache=require(_0x1126('0x7'));var util=require(_0x1126('0x8'));var path=require(_0x1126('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1126('0xa'));var fs=require('fs');var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];var jayson=require(_0x1126('0x18'));var client=jayson[_0x1126('0x19')][_0x1126('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3f10e9,_0xd8ca42,_0x2048ad,_0x43850b){return new BPromise(function(_0x53a8f0,_0x5de9a7){var _0x1af673=_0x43850b||client;return _0x1af673[_0x1126('0x1b')](_0x3f10e9,_0x2048ad)[_0x1126('0x1c')](function(_0x4be0c6){logger[_0x1126('0x1d')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xd8ca42,_0x1126('0x1e'));logger[_0x1126('0x1f')](_0x1126('0x20'),_0xd8ca42,'request\x20sent',JSON[_0x1126('0x21')](_0x4be0c6));if(_0x4be0c6[_0x1126('0x22')]){if(_0x4be0c6['error']['code']===0x1f4){logger[_0x1126('0x22')](_0x1126('0x23'),_0xd8ca42,_0x4be0c6['error']['message']);return _0x5de9a7(_0x4be0c6[_0x1126('0x22')]['message']);}logger[_0x1126('0x22')](_0x1126('0x23'),_0xd8ca42,_0x4be0c6[_0x1126('0x22')]['message']);return _0x53a8f0(_0x4be0c6[_0x1126('0x22')]['message']);}else{logger['info'](_0x1126('0x23'),_0xd8ca42,_0x1126('0x1e'));_0x53a8f0(_0x4be0c6[_0x1126('0x24')][_0x1126('0x25')]);}})['catch'](function(_0x29ab60){logger[_0x1126('0x22')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xd8ca42,_0x29ab60);_0x5de9a7(_0x29ab60);});});}function respondWithStatusCode(_0x2175fa,_0x59cd8e){_0x59cd8e=_0x59cd8e||0xcc;return function(_0x529dd9){if(_0x529dd9){return _0x2175fa['sendStatus'](_0x59cd8e);}return _0x2175fa[_0x1126('0x26')](_0x59cd8e)[_0x1126('0x27')]();};}function respondWithResult(_0x329914,_0x34bcf1){_0x34bcf1=_0x34bcf1||0xc8;return function(_0x566c09){if(_0x566c09){return _0x329914[_0x1126('0x26')](_0x34bcf1)[_0x1126('0x28')](_0x566c09);}};}function respondWithFilteredResult(_0x38119d,_0x589725){return function(_0x35eec3){if(_0x35eec3){var _0x375e59=_0x35eec3[_0x1126('0x29')],_0xa293f4=_0x589725[_0x1126('0x2a')],_0x5ddf63=_0x589725['offset']+_0x589725[_0x1126('0x2b')],_0x541bc9;if(_0x5ddf63>=_0x375e59){_0x5ddf63=_0x375e59;_0x541bc9=0xc8;}else{_0x541bc9=0xce;}_0x38119d[_0x1126('0x26')](_0x541bc9);return _0x38119d['set'](_0x1126('0x2c'),_0xa293f4+'-'+_0x5ddf63+'/'+_0x375e59)['json'](_0x35eec3);}return null;};}function patchUpdates(_0xc62460){return function(_0x4bd50b){try{jsonpatch[_0x1126('0x2d')](_0x4bd50b,_0xc62460,!![]);}catch(_0x583ce6){return BPromise[_0x1126('0x2e')](_0x583ce6);}return _0x4bd50b['save']();};}function saveUpdates(_0x5252e0,_0x4a53ab){return function(_0x17646e){if(_0x17646e){return _0x17646e[_0x1126('0x2f')](_0x5252e0)[_0x1126('0x1c')](function(_0x5b8bea){return _0x5b8bea;});}return null;};}function removeEntity(_0x2a3055,_0x226afb){return function(_0x56f7f8){if(_0x56f7f8){return _0x56f7f8[_0x1126('0x30')]()[_0x1126('0x1c')](function(){_0x2a3055[_0x1126('0x26')](0xcc)[_0x1126('0x27')]();});}};}function handleEntityNotFound(_0x5836a2,_0x5ecbc3){return function(_0x2a7edc){if(!_0x2a7edc){_0x5836a2[_0x1126('0x31')](0x194);}return _0x2a7edc;};}function handleError(_0x2d9bd2,_0x2c67eb){_0x2c67eb=_0x2c67eb||0x1f4;return function(_0x55244a){logger[_0x1126('0x22')](_0x55244a[_0x1126('0x32')]);if(_0x55244a[_0x1126('0x33')]){delete _0x55244a[_0x1126('0x33')];}_0x2d9bd2[_0x1126('0x26')](_0x2c67eb)['send'](_0x55244a);};}exports[_0x1126('0x34')]=function(_0x457efd,_0x1e8402){var _0x42e773={},_0x5c019d={},_0x4ca51c={'count':0x0,'rows':[]};var _0x22827a=_[_0x1126('0x35')](db['FreshsalesConfiguration'][_0x1126('0x36')],function(_0xf3c21b){return{'name':_0xf3c21b[_0x1126('0x37')],'type':_0xf3c21b['type']['key']};});_0x5c019d[_0x1126('0x38')]=_[_0x1126('0x35')](_0x22827a,_0x1126('0x33'));_0x5c019d[_0x1126('0x39')]=_['keys'](_0x457efd[_0x1126('0x39')]);_0x5c019d['filters']=_[_0x1126('0x3a')](_0x5c019d[_0x1126('0x38')],_0x5c019d[_0x1126('0x39')]);_0x42e773[_0x1126('0x3b')]=_[_0x1126('0x3a')](_0x5c019d['model'],qs[_0x1126('0x3c')](_0x457efd[_0x1126('0x39')][_0x1126('0x3c')]));_0x42e773[_0x1126('0x3b')]=_0x42e773[_0x1126('0x3b')][_0x1126('0x3d')]?_0x42e773[_0x1126('0x3b')]:_0x5c019d['model'];if(!_0x457efd[_0x1126('0x39')][_0x1126('0x3e')](_0x1126('0x3f'))){_0x42e773[_0x1126('0x2b')]=qs[_0x1126('0x2b')](_0x457efd['query']['limit']);_0x42e773[_0x1126('0x2a')]=qs[_0x1126('0x2a')](_0x457efd[_0x1126('0x39')][_0x1126('0x2a')]);}_0x42e773[_0x1126('0x40')]=qs[_0x1126('0x41')](_0x457efd['query']['sort']);_0x42e773['where']=qs[_0x1126('0x42')](_['pick'](_0x457efd[_0x1126('0x39')],_0x5c019d[_0x1126('0x42')]),_0x22827a);if(_0x457efd[_0x1126('0x39')][_0x1126('0x43')]){_0x42e773['where']=_['merge'](_0x42e773[_0x1126('0x44')],{'$or':_[_0x1126('0x35')](_0x22827a,function(_0x1d63b9){if(_0x1d63b9['type']!==_0x1126('0x45')){var _0x5f35fa={};_0x5f35fa[_0x1d63b9[_0x1126('0x33')]]={'$like':'%'+_0x457efd['query'][_0x1126('0x43')]+'%'};return _0x5f35fa;}})});}_0x42e773=_[_0x1126('0x46')]({},_0x42e773,_0x457efd[_0x1126('0x47')]);var _0x4cbe19={'where':_0x42e773[_0x1126('0x44')]};return db[_0x1126('0x48')][_0x1126('0x29')](_0x4cbe19)['then'](function(_0x58ff3a){_0x4ca51c['count']=_0x58ff3a;if(_0x457efd[_0x1126('0x39')]['includeAll']){_0x42e773[_0x1126('0x49')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x1126('0x4a')](_0x42e773);})[_0x1126('0x1c')](function(_0x146066){_0x4ca51c[_0x1126('0x4b')]=_0x146066;return _0x4ca51c;})[_0x1126('0x1c')](respondWithFilteredResult(_0x1e8402,_0x42e773))['catch'](handleError(_0x1e8402,null));};exports[_0x1126('0x4c')]=function(_0x512f60,_0x5111d3){var _0x1a15f8={'raw':![],'where':{'id':_0x512f60['params']['id']}},_0x13dc39={};_0x13dc39[_0x1126('0x38')]=_[_0x1126('0x4d')](db['FreshsalesConfiguration'][_0x1126('0x36')]);_0x13dc39[_0x1126('0x39')]=_[_0x1126('0x4d')](_0x512f60['query']);_0x13dc39[_0x1126('0x42')]=_[_0x1126('0x3a')](_0x13dc39[_0x1126('0x38')],_0x13dc39[_0x1126('0x39')]);_0x1a15f8[_0x1126('0x3b')]=_[_0x1126('0x3a')](_0x13dc39[_0x1126('0x38')],qs[_0x1126('0x3c')](_0x512f60['query'][_0x1126('0x3c')]));_0x1a15f8['attributes']=_0x1a15f8[_0x1126('0x3b')][_0x1126('0x3d')]?_0x1a15f8['attributes']:_0x13dc39['model'];if(_0x512f60[_0x1126('0x39')][_0x1126('0x4e')]){_0x1a15f8[_0x1126('0x49')]=[{'all':!![]}];}_0x1a15f8=_['merge']({},_0x1a15f8,_0x512f60[_0x1126('0x47')]);return db[_0x1126('0x48')][_0x1126('0x4f')](_0x1a15f8)[_0x1126('0x1c')](handleEntityNotFound(_0x5111d3,null))['then'](respondWithResult(_0x5111d3,null))[_0x1126('0x50')](handleError(_0x5111d3,null));};exports[_0x1126('0x51')]=function(_0x5c36b9,_0x4bcc08){return db['FreshsalesConfiguration']['create'](_0x5c36b9[_0x1126('0x52')],{})[_0x1126('0x1c')](respondWithResult(_0x4bcc08,0xc9))['catch'](handleError(_0x4bcc08,null));};exports[_0x1126('0x2f')]=function(_0x1c7a2b,_0x38093e){if(_0x1c7a2b[_0x1126('0x52')]['id']){delete _0x1c7a2b[_0x1126('0x52')]['id'];}return db['FreshsalesConfiguration'][_0x1126('0x4f')]({'where':{'id':_0x1c7a2b[_0x1126('0x53')]['id']}})['then'](handleEntityNotFound(_0x38093e,null))[_0x1126('0x1c')](saveUpdates(_0x1c7a2b[_0x1126('0x52')],null))[_0x1126('0x1c')](respondWithResult(_0x38093e,null))[_0x1126('0x50')](handleError(_0x38093e,null));};exports[_0x1126('0x30')]=function(_0x59c3d0,_0x673c09){return db['FreshsalesConfiguration'][_0x1126('0x4f')]({'where':{'id':_0x59c3d0[_0x1126('0x53')]['id']}})[_0x1126('0x1c')](handleEntityNotFound(_0x673c09,null))['then'](removeEntity(_0x673c09,null))[_0x1126('0x50')](handleError(_0x673c09,null));};exports[_0x1126('0x54')]=function(_0x5763b4,_0x30812d,_0x25038f){var _0x9bad53={};var _0x5a5340={};var _0x2fe6dc;var _0x3377db;return db[_0x1126('0x48')][_0x1126('0x55')]({'where':{'id':_0x5763b4[_0x1126('0x53')]['id']}})[_0x1126('0x1c')](handleEntityNotFound(_0x30812d,null))[_0x1126('0x1c')](function(_0x114be2){if(_0x114be2){_0x2fe6dc=_0x114be2;_0x5a5340['model']=_[_0x1126('0x4d')](db[_0x1126('0x56')][_0x1126('0x36')]);_0x5a5340[_0x1126('0x39')]=_[_0x1126('0x4d')](_0x5763b4['query']);_0x5a5340[_0x1126('0x42')]=_[_0x1126('0x3a')](_0x5a5340['model'],_0x5a5340[_0x1126('0x39')]);_0x9bad53['attributes']=_[_0x1126('0x3a')](_0x5a5340[_0x1126('0x38')],qs['fields'](_0x5763b4[_0x1126('0x39')][_0x1126('0x3c')]));_0x9bad53[_0x1126('0x3b')]=_0x9bad53['attributes'][_0x1126('0x3d')]?_0x9bad53['attributes']:_0x5a5340['model'];_0x9bad53[_0x1126('0x40')]=qs[_0x1126('0x41')](_0x5763b4[_0x1126('0x39')][_0x1126('0x41')]);_0x9bad53[_0x1126('0x44')]=qs[_0x1126('0x42')](_[_0x1126('0x57')](_0x5763b4['query'],_0x5a5340[_0x1126('0x42')]));if(_0x5763b4[_0x1126('0x39')][_0x1126('0x43')]){_0x9bad53[_0x1126('0x44')]=_[_0x1126('0x46')](_0x9bad53[_0x1126('0x44')],{'$or':_['map'](_0x9bad53['attributes'],function(_0x16a343){var _0x3921c2={};_0x3921c2[_0x16a343]={'$like':'%'+_0x5763b4['query']['filter']+'%'};return _0x3921c2;})});}_0x9bad53=_['merge']({},_0x9bad53,_0x5763b4['options']);return _0x2fe6dc[_0x1126('0x54')](_0x9bad53);}})[_0x1126('0x1c')](function(_0x3440c5){if(_0x3440c5){_0x3377db=_0x3440c5['length'];if(!_0x5763b4[_0x1126('0x39')][_0x1126('0x3e')](_0x1126('0x3f'))){_0x9bad53[_0x1126('0x2b')]=qs[_0x1126('0x2b')](_0x5763b4[_0x1126('0x39')][_0x1126('0x2b')]);_0x9bad53['offset']=qs[_0x1126('0x2a')](_0x5763b4[_0x1126('0x39')][_0x1126('0x2a')]);}return _0x2fe6dc[_0x1126('0x54')](_0x9bad53);}})[_0x1126('0x1c')](function(_0x56c003){if(_0x56c003){return _0x56c003?{'count':_0x3377db,'rows':_0x56c003}:null;}})['then'](respondWithResult(_0x30812d,null))[_0x1126('0x50')](handleError(_0x30812d,null));};exports[_0x1126('0x58')]=function(_0x4f1b61,_0x3bf25d,_0x1fb2f0){var _0x366675={};var _0x6a41c0={};var _0x2828d4;var _0x30d240;return db[_0x1126('0x48')][_0x1126('0x55')]({'where':{'id':_0x4f1b61[_0x1126('0x53')]['id']}})[_0x1126('0x1c')](handleEntityNotFound(_0x3bf25d,null))[_0x1126('0x1c')](function(_0x1228cf){if(_0x1228cf){_0x2828d4=_0x1228cf;_0x6a41c0[_0x1126('0x38')]=_['keys'](db[_0x1126('0x56')][_0x1126('0x36')]);_0x6a41c0[_0x1126('0x39')]=_['keys'](_0x4f1b61['query']);_0x6a41c0[_0x1126('0x42')]=_[_0x1126('0x3a')](_0x6a41c0[_0x1126('0x38')],_0x6a41c0[_0x1126('0x39')]);_0x366675['attributes']=_['intersection'](_0x6a41c0['model'],qs[_0x1126('0x3c')](_0x4f1b61[_0x1126('0x39')][_0x1126('0x3c')]));_0x366675[_0x1126('0x3b')]=_0x366675['attributes'][_0x1126('0x3d')]?_0x366675['attributes']:_0x6a41c0[_0x1126('0x38')];_0x366675[_0x1126('0x40')]=qs[_0x1126('0x41')](_0x4f1b61[_0x1126('0x39')][_0x1126('0x41')]);_0x366675[_0x1126('0x44')]=qs[_0x1126('0x42')](_['pick'](_0x4f1b61[_0x1126('0x39')],_0x6a41c0['filters']));if(_0x4f1b61[_0x1126('0x39')][_0x1126('0x43')]){_0x366675['where']=_[_0x1126('0x46')](_0x366675[_0x1126('0x44')],{'$or':_['map'](_0x366675[_0x1126('0x3b')],function(_0x1442ab){var _0x4b1d04={};_0x4b1d04[_0x1442ab]={'$like':'%'+_0x4f1b61['query'][_0x1126('0x43')]+'%'};return _0x4b1d04;})});}_0x366675=_[_0x1126('0x46')]({},_0x366675,_0x4f1b61[_0x1126('0x47')]);return _0x2828d4['getDescriptions'](_0x366675);}})['then'](function(_0x4b0fab){if(_0x4b0fab){_0x30d240=_0x4b0fab[_0x1126('0x3d')];if(!_0x4f1b61['query']['hasOwnProperty'](_0x1126('0x3f'))){_0x366675['limit']=qs[_0x1126('0x2b')](_0x4f1b61[_0x1126('0x39')]['limit']);_0x366675[_0x1126('0x2a')]=qs[_0x1126('0x2a')](_0x4f1b61[_0x1126('0x39')][_0x1126('0x2a')]);}return _0x2828d4[_0x1126('0x58')](_0x366675);}})['then'](function(_0xec8540){if(_0xec8540){return _0xec8540?{'count':_0x30d240,'rows':_0xec8540}:null;}})[_0x1126('0x1c')](respondWithResult(_0x3bf25d,null))['catch'](handleError(_0x3bf25d,null));};exports[_0x1126('0x59')]=function(_0x2d6fcf,_0x2c0908,_0x2af2d0){var _0x2598a7={};var _0x2cf3b9={};var _0x59512b;var _0x301118;return db[_0x1126('0x48')][_0x1126('0x55')]({'where':{'id':_0x2d6fcf[_0x1126('0x53')]['id']}})[_0x1126('0x1c')](handleEntityNotFound(_0x2c0908,null))[_0x1126('0x1c')](function(_0x3b5384){if(_0x3b5384){_0x59512b=_0x3b5384;_0x2cf3b9[_0x1126('0x38')]=_[_0x1126('0x4d')](db['FreshsalesField'][_0x1126('0x36')]);_0x2cf3b9[_0x1126('0x39')]=_[_0x1126('0x4d')](_0x2d6fcf[_0x1126('0x39')]);_0x2cf3b9[_0x1126('0x42')]=_['intersection'](_0x2cf3b9[_0x1126('0x38')],_0x2cf3b9['query']);_0x2598a7['attributes']=_[_0x1126('0x3a')](_0x2cf3b9[_0x1126('0x38')],qs['fields'](_0x2d6fcf['query'][_0x1126('0x3c')]));_0x2598a7[_0x1126('0x3b')]=_0x2598a7[_0x1126('0x3b')][_0x1126('0x3d')]?_0x2598a7[_0x1126('0x3b')]:_0x2cf3b9[_0x1126('0x38')];_0x2598a7[_0x1126('0x40')]=qs[_0x1126('0x41')](_0x2d6fcf[_0x1126('0x39')]['sort']);_0x2598a7[_0x1126('0x44')]=qs[_0x1126('0x42')](_[_0x1126('0x57')](_0x2d6fcf[_0x1126('0x39')],_0x2cf3b9[_0x1126('0x42')]));if(_0x2d6fcf[_0x1126('0x39')]['filter']){_0x2598a7[_0x1126('0x44')]=_[_0x1126('0x46')](_0x2598a7[_0x1126('0x44')],{'$or':_[_0x1126('0x35')](_0x2598a7[_0x1126('0x3b')],function(_0x1796eb){var _0x2418ca={};_0x2418ca[_0x1796eb]={'$like':'%'+_0x2d6fcf[_0x1126('0x39')][_0x1126('0x43')]+'%'};return _0x2418ca;})});}_0x2598a7=_[_0x1126('0x46')]({},_0x2598a7,_0x2d6fcf['options']);return _0x59512b['getFields'](_0x2598a7);}})[_0x1126('0x1c')](function(_0x55496f){if(_0x55496f){_0x301118=_0x55496f[_0x1126('0x3d')];if(!_0x2d6fcf['query'][_0x1126('0x3e')]('nolimit')){_0x2598a7[_0x1126('0x2b')]=qs['limit'](_0x2d6fcf['query']['limit']);_0x2598a7[_0x1126('0x2a')]=qs[_0x1126('0x2a')](_0x2d6fcf['query']['offset']);}return _0x59512b[_0x1126('0x59')](_0x2598a7);}})[_0x1126('0x1c')](function(_0x185fd6){if(_0x185fd6){return _0x185fd6?{'count':_0x301118,'rows':_0x185fd6}:null;}})['then'](respondWithResult(_0x2c0908,null))['catch'](handleError(_0x2c0908,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index dad5662..84653e6 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 _0xd2ce=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FreshsalesConfiguration','util','api','moment'];(function(_0xbe723e,_0x5f30d4){var _0x5855b3=function(_0xc011a8){while(--_0xc011a8){_0xbe723e['push'](_0xbe723e['shift']());}};_0x5855b3(++_0x5f30d4);}(_0xd2ce,0x13c));var _0xed2c=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xd2ce[_0x173d7e];return _0x2220d6;};'use strict';var _=require('lodash');var util=require(_0xed2c('0x0'));var logger=require('../../config/logger')(_0xed2c('0x1'));var moment=require(_0xed2c('0x2'));var BPromise=require(_0xed2c('0x3'));var rp=require(_0xed2c('0x4'));var fs=require('fs');var path=require(_0xed2c('0x5'));var rimraf=require(_0xed2c('0x6'));var config=require(_0xed2c('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0xed2c('0x8')]=function(_0x5b6ccb,_0x38aa25){return _0x5b6ccb[_0xed2c('0x9')](_0xed2c('0xa'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x409b=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','define','FreshsalesConfiguration','int_freshsales_configurations'];(function(_0x1a89ca,_0x27394b){var _0x29cbb2=function(_0x31e1f4){while(--_0x31e1f4){_0x1a89ca['push'](_0x1a89ca['shift']());}};_0x29cbb2(++_0x27394b);}(_0x409b,0x14a));var _0xb409=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x409b[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xb409('0x0'));var util=require(_0xb409('0x1'));var logger=require(_0xb409('0x2'))(_0xb409('0x3'));var moment=require(_0xb409('0x4'));var BPromise=require(_0xb409('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb409('0x6'));var rimraf=require(_0xb409('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0xf41723,_0x29cdcf){return _0xf41723[_0xb409('0x8')](_0xb409('0x9'),attributes,{'tableName':_0xb409('0xa'),'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 6e0d798..6c5948e 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 _0xe486=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','FreshsalesConfiguration,\x20%s,\x20%s','message','result'];(function(_0x5b319a,_0x3f6f34){var _0x395b01=function(_0x36aca4){while(--_0x36aca4){_0x5b319a['push'](_0x5b319a['shift']());}};_0x395b01(++_0x3f6f34);}(_0xe486,0x6a));var _0x6e48=function(_0x4858d6,_0x383e09){_0x4858d6=_0x4858d6-0x0;var _0x170bbe=_0xe486[_0x4858d6];return _0x170bbe;};'use strict';var _=require(_0x6e48('0x0'));var util=require(_0x6e48('0x1'));var moment=require(_0x6e48('0x2'));var BPromise=require(_0x6e48('0x3'));var rs=require(_0x6e48('0x4'));var fs=require('fs');var Redis=require(_0x6e48('0x5'));var db=require(_0x6e48('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6e48('0x7'));var config=require(_0x6e48('0x8'));var jayson=require(_0x6e48('0x9'));var client=jayson[_0x6e48('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ea941,_0x2dc190,_0x23d274){return new BPromise(function(_0x1aaa9e,_0x3d392e){return client['request'](_0x1ea941,_0x23d274)[_0x6e48('0xb')](function(_0x5d1b90){logger[_0x6e48('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2dc190,_0x6e48('0xd'));logger[_0x6e48('0xe')](_0x6e48('0xf'),_0x2dc190,_0x6e48('0xd'),JSON['stringify'](_0x5d1b90));if(_0x5d1b90[_0x6e48('0x10')]){if(_0x5d1b90['error']['code']===0x1f4){logger[_0x6e48('0x10')](_0x6e48('0x11'),_0x2dc190,_0x5d1b90[_0x6e48('0x10')][_0x6e48('0x12')]);return _0x3d392e(_0x5d1b90['error'][_0x6e48('0x12')]);}logger[_0x6e48('0x10')](_0x6e48('0x11'),_0x2dc190,_0x5d1b90[_0x6e48('0x10')][_0x6e48('0x12')]);return _0x1aaa9e(_0x5d1b90[_0x6e48('0x10')][_0x6e48('0x12')]);}else{logger[_0x6e48('0xc')](_0x6e48('0x11'),_0x2dc190,'request\x20sent');_0x1aaa9e(_0x5d1b90[_0x6e48('0x13')][_0x6e48('0x12')]);}})[_0x6e48('0x14')](function(_0x2ca234){logger['error'](_0x6e48('0x11'),_0x2dc190,_0x2ca234);_0x3d392e(_0x2ca234);});});} \ No newline at end of file +var _0xb79a=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash'];(function(_0x12ef8e,_0x1b6a5b){var _0x4b8dc3=function(_0x7a286b){while(--_0x7a286b){_0x12ef8e['push'](_0x12ef8e['shift']());}};_0x4b8dc3(++_0x1b6a5b);}(_0xb79a,0x18e));var _0xab79=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb79a[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xab79('0x0'));var util=require(_0xab79('0x1'));var moment=require('moment');var BPromise=require(_0xab79('0x2'));var rs=require(_0xab79('0x3'));var fs=require('fs');var Redis=require(_0xab79('0x4'));var db=require(_0xab79('0x5'))['db'];var utils=require(_0xab79('0x6'));var logger=require(_0xab79('0x7'))(_0xab79('0x8'));var config=require(_0xab79('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xab79('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe8ba5a,_0x10d402,_0x11ceb3){return new BPromise(function(_0x7eabd1,_0x4585fe){return client[_0xab79('0xb')](_0xe8ba5a,_0x11ceb3)[_0xab79('0xc')](function(_0x426cb9){logger[_0xab79('0xd')](_0xab79('0xe'),_0x10d402,_0xab79('0xf'));logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x10d402,_0xab79('0xf'),JSON[_0xab79('0x10')](_0x426cb9));if(_0x426cb9[_0xab79('0x11')]){if(_0x426cb9[_0xab79('0x11')][_0xab79('0x12')]===0x1f4){logger[_0xab79('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x10d402,_0x426cb9['error'][_0xab79('0x13')]);return _0x4585fe(_0x426cb9['error'][_0xab79('0x13')]);}logger[_0xab79('0x11')](_0xab79('0xe'),_0x10d402,_0x426cb9['error']['message']);return _0x7eabd1(_0x426cb9['error']['message']);}else{logger[_0xab79('0xd')](_0xab79('0xe'),_0x10d402,'request\x20sent');_0x7eabd1(_0x426cb9['result']['message']);}})[_0xab79('0x14')](function(_0xc9650d){logger['error'](_0xab79('0xe'),_0x10d402,_0xc9650d);_0x4585fe(_0xc9650d);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index f7e1275..b9ea3e3 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 _0x6be0=['express','Router','../../components/auth/service','get','isAuthenticated','index','show','post','/:id','delete','destroy','util','path','connect-timeout'];(function(_0x451bf8,_0x364f73){var _0x53cec7=function(_0x32f3c0){while(--_0x32f3c0){_0x451bf8['push'](_0x451bf8['shift']());}};_0x53cec7(++_0x364f73);}(_0x6be0,0x1a1));var _0x06be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6be0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x06be('0x0'));var path=require(_0x06be('0x1'));var timeout=require(_0x06be('0x2'));var express=require(_0x06be('0x3'));var router=express[_0x06be('0x4')]();var auth=require(_0x06be('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router[_0x06be('0x6')]('/',auth[_0x06be('0x7')](),controller[_0x06be('0x8')]);router[_0x06be('0x6')]('/:id',auth[_0x06be('0x7')](),controller[_0x06be('0x9')]);router[_0x06be('0xa')]('/',auth[_0x06be('0x7')](),controller['create']);router['put'](_0x06be('0xb'),auth[_0x06be('0x7')](),controller['update']);router[_0x06be('0xc')]('/:id',auth[_0x06be('0x7')](),controller[_0x06be('0xd')]);module['exports']=router; \ No newline at end of file +var _0x0a07=['express','Router','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','show','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3fcca6,_0x21bcee){var _0x15eea2=function(_0x5102f3){while(--_0x5102f3){_0x3fcca6['push'](_0x3fcca6['shift']());}};_0x15eea2(++_0x21bcee);}(_0x0a07,0x1d0));var _0x70a0=function(_0x3e0784,_0x5f30ee){_0x3e0784=_0x3e0784-0x0;var _0x4bfb0e=_0x0a07[_0x3e0784];return _0x4bfb0e;};'use strict';var multer=require(_0x70a0('0x0'));var util=require(_0x70a0('0x1'));var path=require(_0x70a0('0x2'));var timeout=require(_0x70a0('0x3'));var express=require(_0x70a0('0x4'));var router=express[_0x70a0('0x5')]();var auth=require(_0x70a0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x70a0('0x7'));var controller=require(_0x70a0('0x8'));router[_0x70a0('0x9')]('/',auth[_0x70a0('0xa')](),controller['index']);router[_0x70a0('0x9')]('/:id',auth[_0x70a0('0xa')](),controller[_0x70a0('0xb')]);router['post']('/',auth[_0x70a0('0xa')](),controller['create']);router[_0x70a0('0xc')]('/:id',auth[_0x70a0('0xa')](),controller[_0x70a0('0xd')]);router[_0x70a0('0xe')](_0x70a0('0xf'),auth[_0x70a0('0xa')](),controller[_0x70a0('0x10')]);module[_0x70a0('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 336650b..1ffb8b8 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 _0xac72=['keyValue','string','STRING','sequelize','exports','ENUM','variable','customVariable'];(function(_0x54c1fc,_0x441377){var _0x5bb64d=function(_0x1e3b35){while(--_0x1e3b35){_0x54c1fc['push'](_0x54c1fc['shift']());}};_0x5bb64d(++_0x441377);}(_0xac72,0x1eb));var _0x2ac7=function(_0xdbbaa3,_0x42bb79){_0xdbbaa3=_0xdbbaa3-0x0;var _0x37beee=_0xac72[_0xdbbaa3];return _0x37beee;};'use strict';var Sequelize=require(_0x2ac7('0x0'));module[_0x2ac7('0x1')]={'type':{'type':Sequelize[_0x2ac7('0x2')]('string',_0x2ac7('0x3'),_0x2ac7('0x4'),_0x2ac7('0x5')),'defaultValue':_0x2ac7('0x6')},'content':{'type':Sequelize[_0x2ac7('0x7')]},'key':{'type':Sequelize[_0x2ac7('0x7')]},'keyType':{'type':Sequelize[_0x2ac7('0x2')](_0x2ac7('0x6'),_0x2ac7('0x3'),_0x2ac7('0x4'))},'keyContent':{'type':Sequelize[_0x2ac7('0x7')]},'idField':{'type':Sequelize[_0x2ac7('0x7')]},'nameField':{'type':Sequelize[_0x2ac7('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2ac7('0x7')]}}; \ No newline at end of file +var _0x2772=['variable','customVariable','keyValue','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x5987de,_0x51048d){var _0x32b67a=function(_0x14c9fe){while(--_0x14c9fe){_0x5987de['push'](_0x5987de['shift']());}};_0x32b67a(++_0x51048d);}(_0x2772,0x1b5));var _0x2277=function(_0x26d6cc,_0x211420){_0x26d6cc=_0x26d6cc-0x0;var _0x3f7df9=_0x2772[_0x26d6cc];return _0x3f7df9;};'use strict';var Sequelize=require('sequelize');module[_0x2277('0x0')]={'type':{'type':Sequelize[_0x2277('0x1')](_0x2277('0x2'),_0x2277('0x3'),_0x2277('0x4'),_0x2277('0x5')),'defaultValue':_0x2277('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2277('0x6')]},'keyType':{'type':Sequelize[_0x2277('0x1')]('string',_0x2277('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x2277('0x6')]},'idField':{'type':Sequelize[_0x2277('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2277('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2277('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 918e0ea..d56fc96 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 _0x3672=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','limit','set','Content-Range','then','sendStatus','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','offset','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','catch','show','params','find','create','body','update','destroy','html-pdf','rimraf','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x474ced,_0x522193){var _0x59c3eb=function(_0x1327e5){while(--_0x1327e5){_0x474ced['push'](_0x474ced['shift']());}};_0x59c3eb(++_0x522193);}(_0x3672,0x13c));var _0x2367=function(_0x54c9dd,_0x233a86){_0x54c9dd=_0x54c9dd-0x0;var _0x855156=_0x3672[_0x54c9dd];return _0x855156;};'use strict';var pdf=require(_0x2367('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2367('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2367('0x2'));var moment=require(_0x2367('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2367('0x4'));var util=require('util');var path=require(_0x2367('0x5'));var sox=require(_0x2367('0x6'));var csv=require(_0x2367('0x7'));var ejs=require(_0x2367('0x8'));var fs=require('fs');var _=require(_0x2367('0x9'));var squel=require('squel');var crypto=require(_0x2367('0xa'));var jsforce=require(_0x2367('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2367('0xc'));var Papa=require(_0x2367('0xd'));var Redis=require('ioredis');var authService=require(_0x2367('0xe'));var qs=require(_0x2367('0xf'));var as=require(_0x2367('0x10'));var hardwareService=require(_0x2367('0x11'));var logger=require(_0x2367('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x2367('0x13'));var licenseUtil=require(_0x2367('0x14'));var db=require(_0x2367('0x15'))['db'];function respondWithStatusCode(_0xbdc08b,_0x370629){_0x370629=_0x370629||0xcc;return function(_0x5f1a1b){if(_0x5f1a1b){return _0xbdc08b['sendStatus'](_0x370629);}return _0xbdc08b[_0x2367('0x16')](_0x370629)[_0x2367('0x17')]();};}function respondWithResult(_0x43a2f9,_0x107932){_0x107932=_0x107932||0xc8;return function(_0x1e4baa){if(_0x1e4baa){return _0x43a2f9[_0x2367('0x16')](_0x107932)[_0x2367('0x18')](_0x1e4baa);}};}function respondWithFilteredResult(_0x13807c,_0x3a1e78){return function(_0x33d842){if(_0x33d842){var _0x2ed61b=_0x33d842[_0x2367('0x19')],_0x3dd9ab=_0x3a1e78['offset'],_0x165f91=_0x3a1e78['offset']+_0x3a1e78[_0x2367('0x1a')],_0x1f1608;if(_0x165f91>=_0x2ed61b){_0x165f91=_0x2ed61b;_0x1f1608=0xc8;}else{_0x1f1608=0xce;}_0x13807c[_0x2367('0x16')](_0x1f1608);return _0x13807c[_0x2367('0x1b')](_0x2367('0x1c'),_0x3dd9ab+'-'+_0x165f91+'/'+_0x2ed61b)[_0x2367('0x18')](_0x33d842);}return null;};}function patchUpdates(_0x49d502){return function(_0x56a1f5){try{jsonpatch['apply'](_0x56a1f5,_0x49d502,!![]);}catch(_0x499608){return BPromise['reject'](_0x499608);}return _0x56a1f5['save']();};}function saveUpdates(_0x2421e8,_0xc2c2dd){return function(_0x4aa4ac){if(_0x4aa4ac){return _0x4aa4ac['update'](_0x2421e8)[_0x2367('0x1d')](function(_0x5c2337){return _0x5c2337;});}return null;};}function removeEntity(_0x32963e,_0x2075a1){return function(_0x26a12b){if(_0x26a12b){return _0x26a12b['destroy']()[_0x2367('0x1d')](function(){_0x32963e[_0x2367('0x16')](0xcc)[_0x2367('0x17')]();});}};}function handleEntityNotFound(_0x276c79,_0x1815ad){return function(_0x6c6e57){if(!_0x6c6e57){_0x276c79[_0x2367('0x1e')](0x194);}return _0x6c6e57;};}function handleError(_0x44c699,_0x5823fb){_0x5823fb=_0x5823fb||0x1f4;return function(_0x32111d){logger[_0x2367('0x1f')](_0x32111d[_0x2367('0x20')]);if(_0x32111d['name']){delete _0x32111d[_0x2367('0x21')];}_0x44c699[_0x2367('0x16')](_0x5823fb)[_0x2367('0x22')](_0x32111d);};}exports[_0x2367('0x23')]=function(_0x274536,_0x1ddd95){var _0x283b4d={},_0x12cbb5={},_0x56432c={'count':0x0,'rows':[]};var _0x3f1c27=_[_0x2367('0x24')](db[_0x2367('0x25')][_0x2367('0x26')],function(_0x2b0363){return{'name':_0x2b0363[_0x2367('0x27')],'type':_0x2b0363[_0x2367('0x28')][_0x2367('0x29')]};});_0x12cbb5['model']=_['map'](_0x3f1c27,_0x2367('0x21'));_0x12cbb5['query']=_['keys'](_0x274536[_0x2367('0x2a')]);_0x12cbb5[_0x2367('0x2b')]=_[_0x2367('0x2c')](_0x12cbb5[_0x2367('0x2d')],_0x12cbb5['query']);_0x283b4d[_0x2367('0x2e')]=_['intersection'](_0x12cbb5[_0x2367('0x2d')],qs[_0x2367('0x2f')](_0x274536[_0x2367('0x2a')][_0x2367('0x2f')]));_0x283b4d['attributes']=_0x283b4d[_0x2367('0x2e')][_0x2367('0x30')]?_0x283b4d['attributes']:_0x12cbb5['model'];if(!_0x274536['query']['hasOwnProperty']('nolimit')){_0x283b4d[_0x2367('0x1a')]=qs[_0x2367('0x1a')](_0x274536[_0x2367('0x2a')][_0x2367('0x1a')]);_0x283b4d[_0x2367('0x31')]=qs['offset'](_0x274536[_0x2367('0x2a')][_0x2367('0x31')]);}_0x283b4d['order']=qs[_0x2367('0x32')](_0x274536[_0x2367('0x2a')][_0x2367('0x32')]);_0x283b4d['where']=qs[_0x2367('0x2b')](_[_0x2367('0x33')](_0x274536[_0x2367('0x2a')],_0x12cbb5['filters']),_0x3f1c27);if(_0x274536[_0x2367('0x2a')]['filter']){_0x283b4d['where']=_['merge'](_0x283b4d[_0x2367('0x34')],{'$or':_[_0x2367('0x24')](_0x3f1c27,function(_0x5ea9b8){if(_0x5ea9b8[_0x2367('0x28')]!==_0x2367('0x35')){var _0x2aaa8c={};_0x2aaa8c[_0x5ea9b8[_0x2367('0x21')]]={'$like':'%'+_0x274536[_0x2367('0x2a')][_0x2367('0x36')]+'%'};return _0x2aaa8c;}})});}_0x283b4d=_[_0x2367('0x37')]({},_0x283b4d,_0x274536[_0x2367('0x38')]);var _0x7622b1={'where':_0x283b4d[_0x2367('0x34')]};return db[_0x2367('0x25')][_0x2367('0x19')](_0x7622b1)[_0x2367('0x1d')](function(_0x207ff4){_0x56432c['count']=_0x207ff4;if(_0x274536[_0x2367('0x2a')][_0x2367('0x39')]){_0x283b4d[_0x2367('0x3a')]=[{'all':!![]}];}return db[_0x2367('0x25')]['findAll'](_0x283b4d);})[_0x2367('0x1d')](function(_0x4bcdb5){_0x56432c['rows']=_0x4bcdb5;return _0x56432c;})[_0x2367('0x1d')](respondWithFilteredResult(_0x1ddd95,_0x283b4d))[_0x2367('0x3b')](handleError(_0x1ddd95,null));};exports[_0x2367('0x3c')]=function(_0x4b42a1,_0x4c3fd0){var _0x1009d4={'raw':!![],'where':{'id':_0x4b42a1[_0x2367('0x3d')]['id']}},_0x2f2bf9={};_0x2f2bf9[_0x2367('0x2d')]=_['keys'](db[_0x2367('0x25')][_0x2367('0x26')]);_0x2f2bf9['query']=_['keys'](_0x4b42a1['query']);_0x2f2bf9['filters']=_['intersection'](_0x2f2bf9['model'],_0x2f2bf9[_0x2367('0x2a')]);_0x1009d4['attributes']=_[_0x2367('0x2c')](_0x2f2bf9[_0x2367('0x2d')],qs[_0x2367('0x2f')](_0x4b42a1[_0x2367('0x2a')]['fields']));_0x1009d4[_0x2367('0x2e')]=_0x1009d4[_0x2367('0x2e')][_0x2367('0x30')]?_0x1009d4[_0x2367('0x2e')]:_0x2f2bf9[_0x2367('0x2d')];if(_0x4b42a1['query'][_0x2367('0x39')]){_0x1009d4[_0x2367('0x3a')]=[{'all':!![]}];}_0x1009d4=_[_0x2367('0x37')]({},_0x1009d4,_0x4b42a1['options']);return db[_0x2367('0x25')][_0x2367('0x3e')](_0x1009d4)[_0x2367('0x1d')](handleEntityNotFound(_0x4c3fd0,null))[_0x2367('0x1d')](respondWithResult(_0x4c3fd0,null))[_0x2367('0x3b')](handleError(_0x4c3fd0,null));};exports[_0x2367('0x3f')]=function(_0x59f5a5,_0x114e74){return db[_0x2367('0x25')]['create'](_0x59f5a5[_0x2367('0x40')],{})[_0x2367('0x1d')](respondWithResult(_0x114e74,0xc9))[_0x2367('0x3b')](handleError(_0x114e74,null));};exports[_0x2367('0x41')]=function(_0x12520a,_0x119bf4){if(_0x12520a[_0x2367('0x40')]['id']){delete _0x12520a[_0x2367('0x40')]['id'];}return db[_0x2367('0x25')]['find']({'where':{'id':_0x12520a['params']['id']}})[_0x2367('0x1d')](handleEntityNotFound(_0x119bf4,null))[_0x2367('0x1d')](saveUpdates(_0x12520a['body'],null))['then'](respondWithResult(_0x119bf4,null))[_0x2367('0x3b')](handleError(_0x119bf4,null));};exports[_0x2367('0x42')]=function(_0x4b7ffb,_0x5a1998){return db[_0x2367('0x25')]['find']({'where':{'id':_0x4b7ffb[_0x2367('0x3d')]['id']}})[_0x2367('0x1d')](handleEntityNotFound(_0x5a1998,null))[_0x2367('0x1d')](removeEntity(_0x5a1998,null))[_0x2367('0x3b')](handleError(_0x5a1998,null));}; \ No newline at end of file +var _0xe64e=['../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','name','send','FreshsalesField','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment'];(function(_0x1573df,_0x2d3161){var _0x43cd09=function(_0x45a40b){while(--_0x45a40b){_0x1573df['push'](_0x1573df['shift']());}};_0x43cd09(++_0x2d3161);}(_0xe64e,0x18a));var _0xee64=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe64e[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xee64('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xee64('0x1'));var jsonpatch=require(_0xee64('0x2'));var rp=require(_0xee64('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xee64('0x4'));var path=require('path');var sox=require(_0xee64('0x5'));var csv=require(_0xee64('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xee64('0x7'));var crypto=require(_0xee64('0x8'));var jsforce=require(_0xee64('0x9'));var deskjs=require(_0xee64('0xa'));var toCsv=require(_0xee64('0x6'));var querystring=require(_0xee64('0xb'));var Papa=require(_0xee64('0xc'));var Redis=require(_0xee64('0xd'));var authService=require(_0xee64('0xe'));var qs=require(_0xee64('0xf'));var as=require(_0xee64('0x10'));var hardwareService=require(_0xee64('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xee64('0x12'));var config=require(_0xee64('0x13'));var licenseUtil=require(_0xee64('0x14'));var db=require(_0xee64('0x15'))['db'];function respondWithStatusCode(_0x395122,_0xc73119){_0xc73119=_0xc73119||0xcc;return function(_0x23ee0c){if(_0x23ee0c){return _0x395122[_0xee64('0x16')](_0xc73119);}return _0x395122[_0xee64('0x17')](_0xc73119)['end']();};}function respondWithResult(_0x57d570,_0x412ba9){_0x412ba9=_0x412ba9||0xc8;return function(_0x39d1b2){if(_0x39d1b2){return _0x57d570[_0xee64('0x17')](_0x412ba9)[_0xee64('0x18')](_0x39d1b2);}};}function respondWithFilteredResult(_0x4e3116,_0x4cfed1){return function(_0x542e2a){if(_0x542e2a){var _0x528fab=_0x542e2a[_0xee64('0x19')],_0x569ab6=_0x4cfed1['offset'],_0x540f7c=_0x4cfed1[_0xee64('0x1a')]+_0x4cfed1['limit'],_0x5089d3;if(_0x540f7c>=_0x528fab){_0x540f7c=_0x528fab;_0x5089d3=0xc8;}else{_0x5089d3=0xce;}_0x4e3116[_0xee64('0x17')](_0x5089d3);return _0x4e3116[_0xee64('0x1b')](_0xee64('0x1c'),_0x569ab6+'-'+_0x540f7c+'/'+_0x528fab)[_0xee64('0x18')](_0x542e2a);}return null;};}function patchUpdates(_0x4f08f1){return function(_0x39fd44){try{jsonpatch[_0xee64('0x1d')](_0x39fd44,_0x4f08f1,!![]);}catch(_0x2be3a1){return BPromise['reject'](_0x2be3a1);}return _0x39fd44[_0xee64('0x1e')]();};}function saveUpdates(_0x3803e6,_0x372fcf){return function(_0x1a728b){if(_0x1a728b){return _0x1a728b[_0xee64('0x1f')](_0x3803e6)[_0xee64('0x20')](function(_0x35b760){return _0x35b760;});}return null;};}function removeEntity(_0x2a5554,_0x242091){return function(_0x556b94){if(_0x556b94){return _0x556b94[_0xee64('0x21')]()[_0xee64('0x20')](function(){_0x2a5554[_0xee64('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cfe59,_0x200bbf){return function(_0x2c3e16){if(!_0x2c3e16){_0x1cfe59[_0xee64('0x16')](0x194);}return _0x2c3e16;};}function handleError(_0x48192d,_0x3eb7bc){_0x3eb7bc=_0x3eb7bc||0x1f4;return function(_0x5b60a5){logger[_0xee64('0x22')](_0x5b60a5['stack']);if(_0x5b60a5[_0xee64('0x23')]){delete _0x5b60a5['name'];}_0x48192d['status'](_0x3eb7bc)[_0xee64('0x24')](_0x5b60a5);};}exports['index']=function(_0x25e530,_0x4e6772){var _0x57c38c={},_0x184f2d={},_0x27aca0={'count':0x0,'rows':[]};var _0x3ffb3a=_['map'](db[_0xee64('0x25')][_0xee64('0x26')],function(_0xc260e9){return{'name':_0xc260e9['fieldName'],'type':_0xc260e9['type']['key']};});_0x184f2d[_0xee64('0x27')]=_['map'](_0x3ffb3a,_0xee64('0x23'));_0x184f2d[_0xee64('0x28')]=_[_0xee64('0x29')](_0x25e530[_0xee64('0x28')]);_0x184f2d[_0xee64('0x2a')]=_[_0xee64('0x2b')](_0x184f2d[_0xee64('0x27')],_0x184f2d[_0xee64('0x28')]);_0x57c38c[_0xee64('0x2c')]=_[_0xee64('0x2b')](_0x184f2d[_0xee64('0x27')],qs[_0xee64('0x2d')](_0x25e530[_0xee64('0x28')][_0xee64('0x2d')]));_0x57c38c[_0xee64('0x2c')]=_0x57c38c[_0xee64('0x2c')][_0xee64('0x2e')]?_0x57c38c[_0xee64('0x2c')]:_0x184f2d['model'];if(!_0x25e530[_0xee64('0x28')][_0xee64('0x2f')](_0xee64('0x30'))){_0x57c38c[_0xee64('0x31')]=qs[_0xee64('0x31')](_0x25e530['query']['limit']);_0x57c38c[_0xee64('0x1a')]=qs[_0xee64('0x1a')](_0x25e530[_0xee64('0x28')][_0xee64('0x1a')]);}_0x57c38c[_0xee64('0x32')]=qs[_0xee64('0x33')](_0x25e530['query'][_0xee64('0x33')]);_0x57c38c[_0xee64('0x34')]=qs[_0xee64('0x2a')](_[_0xee64('0x35')](_0x25e530[_0xee64('0x28')],_0x184f2d['filters']),_0x3ffb3a);if(_0x25e530[_0xee64('0x28')][_0xee64('0x36')]){_0x57c38c[_0xee64('0x34')]=_[_0xee64('0x37')](_0x57c38c[_0xee64('0x34')],{'$or':_[_0xee64('0x38')](_0x3ffb3a,function(_0x1fe9af){if(_0x1fe9af[_0xee64('0x39')]!==_0xee64('0x3a')){var _0x44c542={};_0x44c542[_0x1fe9af[_0xee64('0x23')]]={'$like':'%'+_0x25e530[_0xee64('0x28')][_0xee64('0x36')]+'%'};return _0x44c542;}})});}_0x57c38c=_[_0xee64('0x37')]({},_0x57c38c,_0x25e530[_0xee64('0x3b')]);var _0xd66d29={'where':_0x57c38c['where']};return db['FreshsalesField'][_0xee64('0x19')](_0xd66d29)[_0xee64('0x20')](function(_0x19963f){_0x27aca0[_0xee64('0x19')]=_0x19963f;if(_0x25e530['query'][_0xee64('0x3c')]){_0x57c38c[_0xee64('0x3d')]=[{'all':!![]}];}return db[_0xee64('0x25')]['findAll'](_0x57c38c);})[_0xee64('0x20')](function(_0x56947b){_0x27aca0[_0xee64('0x3e')]=_0x56947b;return _0x27aca0;})['then'](respondWithFilteredResult(_0x4e6772,_0x57c38c))[_0xee64('0x3f')](handleError(_0x4e6772,null));};exports[_0xee64('0x40')]=function(_0x43f25e,_0x4308aa){var _0x31bd1c={'raw':!![],'where':{'id':_0x43f25e[_0xee64('0x41')]['id']}},_0x42c09a={};_0x42c09a[_0xee64('0x27')]=_[_0xee64('0x29')](db[_0xee64('0x25')][_0xee64('0x26')]);_0x42c09a[_0xee64('0x28')]=_[_0xee64('0x29')](_0x43f25e[_0xee64('0x28')]);_0x42c09a['filters']=_['intersection'](_0x42c09a['model'],_0x42c09a['query']);_0x31bd1c[_0xee64('0x2c')]=_[_0xee64('0x2b')](_0x42c09a[_0xee64('0x27')],qs[_0xee64('0x2d')](_0x43f25e['query']['fields']));_0x31bd1c[_0xee64('0x2c')]=_0x31bd1c[_0xee64('0x2c')]['length']?_0x31bd1c['attributes']:_0x42c09a[_0xee64('0x27')];if(_0x43f25e[_0xee64('0x28')][_0xee64('0x3c')]){_0x31bd1c['include']=[{'all':!![]}];}_0x31bd1c=_[_0xee64('0x37')]({},_0x31bd1c,_0x43f25e[_0xee64('0x3b')]);return db[_0xee64('0x25')][_0xee64('0x42')](_0x31bd1c)['then'](handleEntityNotFound(_0x4308aa,null))[_0xee64('0x20')](respondWithResult(_0x4308aa,null))[_0xee64('0x3f')](handleError(_0x4308aa,null));};exports[_0xee64('0x43')]=function(_0x84467e,_0x5cfc28){return db[_0xee64('0x25')][_0xee64('0x43')](_0x84467e[_0xee64('0x44')],{})[_0xee64('0x20')](respondWithResult(_0x5cfc28,0xc9))['catch'](handleError(_0x5cfc28,null));};exports[_0xee64('0x1f')]=function(_0x50d666,_0x39ff02){if(_0x50d666['body']['id']){delete _0x50d666[_0xee64('0x44')]['id'];}return db['FreshsalesField']['find']({'where':{'id':_0x50d666[_0xee64('0x41')]['id']}})[_0xee64('0x20')](handleEntityNotFound(_0x39ff02,null))['then'](saveUpdates(_0x50d666['body'],null))[_0xee64('0x20')](respondWithResult(_0x39ff02,null))[_0xee64('0x3f')](handleError(_0x39ff02,null));};exports['destroy']=function(_0x821dab,_0x1949c8){return db[_0xee64('0x25')]['find']({'where':{'id':_0x821dab[_0xee64('0x41')]['id']}})[_0xee64('0x20')](handleEntityNotFound(_0x1949c8,null))[_0xee64('0x20')](removeEntity(_0x1949c8,null))[_0xee64('0x3f')](handleError(_0x1949c8,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 741d8b0..eb5f44b 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 _0xb658=['define','int_freshsales_fields','idField','FieldId','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes','exports'];(function(_0x96fa2a,_0x2c1cc0){var _0x5d9298=function(_0x1a4810){while(--_0x1a4810){_0x96fa2a['push'](_0x96fa2a['shift']());}};_0x5d9298(++_0x2c1cc0);}(_0xb658,0x122));var _0x8b65=function(_0x3add8e,_0x2b08b3){_0x3add8e=_0x3add8e-0x0;var _0x1a80f4=_0xb658[_0x3add8e];return _0x1a80f4;};'use strict';var _=require('lodash');var util=require(_0x8b65('0x0'));var logger=require(_0x8b65('0x1'))('api');var moment=require(_0x8b65('0x2'));var BPromise=require(_0x8b65('0x3'));var rp=require(_0x8b65('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b65('0x5'));var config=require(_0x8b65('0x6'));var attributes=require(_0x8b65('0x7'));module[_0x8b65('0x8')]=function(_0xe73de5,_0x2212b3){return _0xe73de5[_0x8b65('0x9')]('FreshsalesField',attributes,{'tableName':_0x8b65('0xa'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x8b65('0xb'),_0x8b65('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xec46=['../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x39f25b,_0x76530d){var _0x44f19f=function(_0x14a6a8){while(--_0x14a6a8){_0x39f25b['push'](_0x39f25b['shift']());}};_0x44f19f(++_0x76530d);}(_0xec46,0x19d));var _0x6ec4=function(_0x322f69,_0x5a194c){_0x322f69=_0x322f69-0x0;var _0x30bf48=_0xec46[_0x322f69];return _0x30bf48;};'use strict';var _=require(_0x6ec4('0x0'));var util=require(_0x6ec4('0x1'));var logger=require(_0x6ec4('0x2'))(_0x6ec4('0x3'));var moment=require(_0x6ec4('0x4'));var BPromise=require(_0x6ec4('0x5'));var rp=require(_0x6ec4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6ec4('0x7'));var attributes=require(_0x6ec4('0x8'));module['exports']=function(_0x2e847a,_0x34e5f6){return _0x2e847a[_0x6ec4('0x9')](_0x6ec4('0xa'),attributes,{'tableName':_0x6ec4('0xb'),'paranoid':![],'indexes':[{'name':_0x6ec4('0xc'),'fields':[_0x6ec4('0xd'),'FieldId'],'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 878cac5..2fd52f0 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 _0x8be0=['../../config/environment','jayson/promise','client','http','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x8be0,0x84));var _0x08be=function(_0x56f3db,_0x58d85c){_0x56f3db=_0x56f3db-0x0;var _0x5da295=_0x8be0[_0x56f3db];return _0x5da295;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x08be('0x0'));var rs=require(_0x08be('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x08be('0x2'));var logger=require(_0x08be('0x3'))('rpc');var config=require(_0x08be('0x4'));var jayson=require(_0x08be('0x5'));var client=jayson[_0x08be('0x6')][_0x08be('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5515a4,_0x1a2f35,_0x293194){return new BPromise(function(_0x2d67db,_0x5d1ffb){return client['request'](_0x5515a4,_0x293194)['then'](function(_0x7507ca){logger[_0x08be('0x8')](_0x08be('0x9'),_0x1a2f35,_0x08be('0xa'));logger[_0x08be('0xb')](_0x08be('0xc'),_0x1a2f35,'request\x20sent',JSON[_0x08be('0xd')](_0x7507ca));if(_0x7507ca[_0x08be('0xe')]){if(_0x7507ca['error']['code']===0x1f4){logger[_0x08be('0xe')](_0x08be('0x9'),_0x1a2f35,_0x7507ca[_0x08be('0xe')][_0x08be('0xf')]);return _0x5d1ffb(_0x7507ca[_0x08be('0xe')][_0x08be('0xf')]);}logger[_0x08be('0xe')](_0x08be('0x9'),_0x1a2f35,_0x7507ca[_0x08be('0xe')][_0x08be('0xf')]);return _0x2d67db(_0x7507ca[_0x08be('0xe')][_0x08be('0xf')]);}else{logger['info'](_0x08be('0x9'),_0x1a2f35,_0x08be('0xa'));_0x2d67db(_0x7507ca['result']['message']);}})[_0x08be('0x10')](function(_0x25c4ba){logger['error'](_0x08be('0x9'),_0x1a2f35,_0x25c4ba);_0x5d1ffb(_0x25c4ba);});});} \ No newline at end of file +var _0x945e=['request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s'];(function(_0x3cf930,_0x16b126){var _0xda4277=function(_0x556ae3){while(--_0x556ae3){_0x3cf930['push'](_0x3cf930['shift']());}};_0xda4277(++_0x16b126);}(_0x945e,0x14e));var _0xe945=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x945e[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0xe945('0x0'));var util=require(_0xe945('0x1'));var moment=require(_0xe945('0x2'));var BPromise=require(_0xe945('0x3'));var rs=require(_0xe945('0x4'));var fs=require('fs');var Redis=require(_0xe945('0x5'));var db=require(_0xe945('0x6'))['db'];var utils=require(_0xe945('0x7'));var logger=require(_0xe945('0x8'))('rpc');var config=require(_0xe945('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe945('0xa')][_0xe945('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7aba83,_0x606acf,_0x45b044){return new BPromise(function(_0x531756,_0x23c820){return client[_0xe945('0xc')](_0x7aba83,_0x45b044)[_0xe945('0xd')](function(_0x5cd960){logger[_0xe945('0xe')](_0xe945('0xf'),_0x606acf,_0xe945('0x10'));logger[_0xe945('0x11')](_0xe945('0x12'),_0x606acf,'request\x20sent',JSON[_0xe945('0x13')](_0x5cd960));if(_0x5cd960['error']){if(_0x5cd960[_0xe945('0x14')][_0xe945('0x15')]===0x1f4){logger[_0xe945('0x14')]('FreshsalesField,\x20%s,\x20%s',_0x606acf,_0x5cd960[_0xe945('0x14')]['message']);return _0x23c820(_0x5cd960['error'][_0xe945('0x16')]);}logger[_0xe945('0x14')]('FreshsalesField,\x20%s,\x20%s',_0x606acf,_0x5cd960[_0xe945('0x14')][_0xe945('0x16')]);return _0x531756(_0x5cd960[_0xe945('0x14')][_0xe945('0x16')]);}else{logger[_0xe945('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x606acf,'request\x20sent');_0x531756(_0x5cd960[_0xe945('0x17')][_0xe945('0x16')]);}})[_0xe945('0x18')](function(_0x2cbd29){logger[_0xe945('0x14')]('FreshsalesField,\x20%s,\x20%s',_0x606acf,_0x2cbd29);_0x23c820(_0x2cbd29);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index f8b6023..d0e8bcf 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 _0xa837=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','exports','util','path'];(function(_0x1687b0,_0x37e2e0){var _0x47d0c3=function(_0x4f0773){while(--_0x4f0773){_0x1687b0['push'](_0x1687b0['shift']());}};_0x47d0c3(++_0x37e2e0);}(_0xa837,0x1a0));var _0x7a83=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa837[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x7a83('0x0'));var path=require(_0x7a83('0x1'));var timeout=require(_0x7a83('0x2'));var express=require(_0x7a83('0x3'));var router=express[_0x7a83('0x4')]();var auth=require(_0x7a83('0x5'));var interaction=require(_0x7a83('0x6'));var config=require(_0x7a83('0x7'));var controller=require('./intSalesforceAccount.controller');router[_0x7a83('0x8')]('/',auth[_0x7a83('0x9')](),controller[_0x7a83('0xa')]);router[_0x7a83('0x8')](_0x7a83('0xb'),auth['isAuthenticated'](),controller[_0x7a83('0xc')]);router[_0x7a83('0x8')]('/:id/configurations',auth[_0x7a83('0x9')](),controller[_0x7a83('0xd')]);router[_0x7a83('0x8')](_0x7a83('0xe'),auth[_0x7a83('0x9')](),controller[_0x7a83('0xf')]);router[_0x7a83('0x10')]('/',auth[_0x7a83('0x9')](),controller[_0x7a83('0x11')]);router[_0x7a83('0x10')]('/:id/configurations',auth[_0x7a83('0x9')](),controller[_0x7a83('0x12')]);router[_0x7a83('0x13')](_0x7a83('0xb'),auth[_0x7a83('0x9')](),controller[_0x7a83('0x14')]);router['delete'](_0x7a83('0xb'),auth[_0x7a83('0x9')](),controller['destroy']);module[_0x7a83('0x15')]=router; \ No newline at end of file +var _0xed3e=['get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller'];(function(_0x458085,_0x4fde30){var _0x1020fd=function(_0x1f6d63){while(--_0x1f6d63){_0x458085['push'](_0x458085['shift']());}};_0x1020fd(++_0x4fde30);}(_0xed3e,0xcf));var _0xeed3=function(_0x25b183,_0x5d0abd){_0x25b183=_0x25b183-0x0;var _0x39e43a=_0xed3e[_0x25b183];return _0x39e43a;};'use strict';var multer=require(_0xeed3('0x0'));var util=require(_0xeed3('0x1'));var path=require(_0xeed3('0x2'));var timeout=require(_0xeed3('0x3'));var express=require(_0xeed3('0x4'));var router=express[_0xeed3('0x5')]();var auth=require(_0xeed3('0x6'));var interaction=require(_0xeed3('0x7'));var config=require('../../config/environment');var controller=require(_0xeed3('0x8'));router[_0xeed3('0x9')]('/',auth[_0xeed3('0xa')](),controller[_0xeed3('0xb')]);router['get'](_0xeed3('0xc'),auth[_0xeed3('0xa')](),controller[_0xeed3('0xd')]);router[_0xeed3('0x9')](_0xeed3('0xe'),auth['isAuthenticated'](),controller[_0xeed3('0xf')]);router[_0xeed3('0x9')](_0xeed3('0x10'),auth['isAuthenticated'](),controller[_0xeed3('0x11')]);router[_0xeed3('0x12')]('/',auth[_0xeed3('0xa')](),controller[_0xeed3('0x13')]);router[_0xeed3('0x12')](_0xeed3('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xeed3('0x14')](_0xeed3('0xc'),auth[_0xeed3('0xa')](),controller[_0xeed3('0x15')]);router[_0xeed3('0x16')](_0xeed3('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xeed3('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 3c332e3..4553b48 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 _0x7f06=['newTab','sequelize','exports','STRING','username','ENUM','integrationTab'];(function(_0x16c0bc,_0x3505ff){var _0x19360d=function(_0x4844cc){while(--_0x4844cc){_0x16c0bc['push'](_0x16c0bc['shift']());}};_0x19360d(++_0x3505ff);}(_0x7f06,0xe8));var _0x67f0=function(_0x4af829,_0x53ab70){_0x4af829=_0x4af829-0x0;var _0x52982c=_0x7f06[_0x4af829];return _0x52982c;};'use strict';var Sequelize=require(_0x67f0('0x0'));module[_0x67f0('0x1')]={'name':{'type':Sequelize[_0x67f0('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x67f0('0x2')],'unique':_0x67f0('0x3')},'remoteUri':{'type':Sequelize[_0x67f0('0x2')]},'password':{'type':Sequelize[_0x67f0('0x2')]},'clientId':{'type':Sequelize[_0x67f0('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x67f0('0x2')]},'serverUrl':{'type':Sequelize[_0x67f0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x67f0('0x4')](_0x67f0('0x5'),_0x67f0('0x6')),'defaultValue':_0x67f0('0x5')}}; \ No newline at end of file +var _0xbcfd=['newTab','sequelize','exports','STRING','username','ENUM','integrationTab'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0xbcfd,0xe8));var _0xdbcf=function(_0x1fcc48,_0x4eb2d9){_0x1fcc48=_0x1fcc48-0x0;var _0x438521=_0xbcfd[_0x1fcc48];return _0x438521;};'use strict';var Sequelize=require(_0xdbcf('0x0'));module[_0xdbcf('0x1')]={'name':{'type':Sequelize[_0xdbcf('0x2')]},'description':{'type':Sequelize[_0xdbcf('0x2')]},'username':{'type':Sequelize[_0xdbcf('0x2')],'unique':_0xdbcf('0x3')},'remoteUri':{'type':Sequelize[_0xdbcf('0x2')]},'password':{'type':Sequelize[_0xdbcf('0x2')]},'clientId':{'type':Sequelize[_0xdbcf('0x2')]},'clientSecret':{'type':Sequelize[_0xdbcf('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xdbcf('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xdbcf('0x4')](_0xdbcf('0x5'),_0xdbcf('0x6')),'defaultValue':_0xdbcf('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 6ca298b..a465202 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 _0x9b94=['includeAll','include','rows','show','params','create','body','find','SalesforceConfiguration','getConfigurations','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','Connection','login','isNil','sobject','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Description','int','boolean','email','textarea','remove','includes','custom','picklistValues','label','value','True','true','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','debug','request\x20sent','stringify','error','message','info','SalesforceAccount,\x20%s,\x20%s','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','SalesforceAccount'];(function(_0x48a64b,_0x50dca1){var _0x11888a=function(_0x2c7b3e){while(--_0x2c7b3e){_0x48a64b['push'](_0x48a64b['shift']());}};_0x11888a(++_0x50dca1);}(_0x9b94,0x135));var _0x49b9=function(_0x2c8dbb,_0x54a6de){_0x2c8dbb=_0x2c8dbb-0x0;var _0x4462a3=_0x9b94[_0x2c8dbb];return _0x4462a3;};'use strict';var pdf=require(_0x49b9('0x0'));var emlformat=require(_0x49b9('0x1'));var rimraf=require(_0x49b9('0x2'));var zipdir=require(_0x49b9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x49b9('0x4'));var moment=require('moment');var BPromise=require(_0x49b9('0x5'));var Mustache=require(_0x49b9('0x6'));var util=require(_0x49b9('0x7'));var path=require(_0x49b9('0x8'));var sox=require(_0x49b9('0x9'));var csv=require(_0x49b9('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x49b9('0xb'));var squel=require(_0x49b9('0xc'));var crypto=require(_0x49b9('0xd'));var jsforce=require(_0x49b9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x49b9('0xa'));var querystring=require(_0x49b9('0xf'));var Papa=require(_0x49b9('0x10'));var Redis=require(_0x49b9('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x49b9('0x12'));var hardwareService=require(_0x49b9('0x13'));var logger=require('../../config/logger')(_0x49b9('0x14'));var utils=require('../../config/utils');var config=require(_0x49b9('0x15'));var licenseUtil=require(_0x49b9('0x16'));var db=require(_0x49b9('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x49b9('0x18'));var client=jayson['client'][_0x49b9('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x13d6de,_0x24269e,_0x75381b,_0x1e8959){return new BPromise(function(_0x50d2ad,_0x14a941){var _0x542a0e=_0x1e8959||client;return _0x542a0e[_0x49b9('0x1a')](_0x13d6de,_0x75381b)['then'](function(_0xa98e64){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x24269e,'request\x20sent');logger[_0x49b9('0x1b')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x24269e,_0x49b9('0x1c'),JSON[_0x49b9('0x1d')](_0xa98e64));if(_0xa98e64[_0x49b9('0x1e')]){if(_0xa98e64[_0x49b9('0x1e')]['code']===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x24269e,_0xa98e64['error'][_0x49b9('0x1f')]);return _0x14a941(_0xa98e64[_0x49b9('0x1e')][_0x49b9('0x1f')]);}logger[_0x49b9('0x1e')]('SalesforceAccount,\x20%s,\x20%s',_0x24269e,_0xa98e64['error'][_0x49b9('0x1f')]);return _0x50d2ad(_0xa98e64[_0x49b9('0x1e')]['message']);}else{logger[_0x49b9('0x20')](_0x49b9('0x21'),_0x24269e,'request\x20sent');_0x50d2ad(_0xa98e64[_0x49b9('0x22')][_0x49b9('0x1f')]);}})[_0x49b9('0x23')](function(_0x47aae4){logger['error'](_0x49b9('0x21'),_0x24269e,_0x47aae4);_0x14a941(_0x47aae4);});});}function respondWithStatusCode(_0x556b3b,_0x4e03d1){_0x4e03d1=_0x4e03d1||0xcc;return function(_0x5be6bd){if(_0x5be6bd){return _0x556b3b[_0x49b9('0x24')](_0x4e03d1);}return _0x556b3b[_0x49b9('0x25')](_0x4e03d1)['end']();};}function respondWithResult(_0x1bf018,_0x2caa6b){_0x2caa6b=_0x2caa6b||0xc8;return function(_0x155edf){if(_0x155edf){return _0x1bf018['status'](_0x2caa6b)[_0x49b9('0x26')](_0x155edf);}};}function respondWithFilteredResult(_0x4fe462,_0x2df49f){return function(_0x5ebc7c){if(_0x5ebc7c){var _0xca0caa=_0x5ebc7c[_0x49b9('0x27')],_0x2c162f=_0x2df49f[_0x49b9('0x28')],_0x31ed76=_0x2df49f[_0x49b9('0x28')]+_0x2df49f[_0x49b9('0x29')],_0x2a5b4b;if(_0x31ed76>=_0xca0caa){_0x31ed76=_0xca0caa;_0x2a5b4b=0xc8;}else{_0x2a5b4b=0xce;}_0x4fe462[_0x49b9('0x25')](_0x2a5b4b);return _0x4fe462[_0x49b9('0x2a')](_0x49b9('0x2b'),_0x2c162f+'-'+_0x31ed76+'/'+_0xca0caa)[_0x49b9('0x26')](_0x5ebc7c);}return null;};}function patchUpdates(_0x566284){return function(_0x1469aa){try{jsonpatch['apply'](_0x1469aa,_0x566284,!![]);}catch(_0x46b1b9){return BPromise[_0x49b9('0x2c')](_0x46b1b9);}return _0x1469aa[_0x49b9('0x2d')]();};}function saveUpdates(_0x5585af,_0x5e72ff){return function(_0x3b7b1e){if(_0x3b7b1e){return _0x3b7b1e[_0x49b9('0x2e')](_0x5585af)[_0x49b9('0x2f')](function(_0x18575f){return _0x18575f;});}return null;};}function removeEntity(_0x5c1340,_0x4377ca){return function(_0x1893c2){if(_0x1893c2){return _0x1893c2[_0x49b9('0x30')]()[_0x49b9('0x2f')](function(){_0x5c1340[_0x49b9('0x25')](0xcc)[_0x49b9('0x31')]();});}};}function handleEntityNotFound(_0x18a33e,_0x3dad82){return function(_0x5b296){if(!_0x5b296){_0x18a33e[_0x49b9('0x24')](0x194);}return _0x5b296;};}function handleError(_0x5466f7,_0x4ada16){_0x4ada16=_0x4ada16||0x1f4;return function(_0x27430e){logger[_0x49b9('0x1e')](_0x27430e[_0x49b9('0x32')]);if(_0x27430e[_0x49b9('0x33')]){delete _0x27430e['name'];}_0x5466f7['status'](_0x4ada16)['send'](_0x27430e);};}exports['index']=function(_0x3fcdcb,_0x124fed){var _0x2ef004={},_0x251c24={},_0x5b5ed3={'count':0x0,'rows':[]};var _0x5bb994=_[_0x49b9('0x34')](db['SalesforceAccount'][_0x49b9('0x35')],function(_0xa29c3e){return{'name':_0xa29c3e[_0x49b9('0x36')],'type':_0xa29c3e[_0x49b9('0x37')][_0x49b9('0x38')]};});_0x251c24[_0x49b9('0x39')]=_[_0x49b9('0x34')](_0x5bb994,'name');_0x251c24[_0x49b9('0x3a')]=_[_0x49b9('0x3b')](_0x3fcdcb['query']);_0x251c24[_0x49b9('0x3c')]=_[_0x49b9('0x3d')](_0x251c24['model'],_0x251c24['query']);_0x2ef004[_0x49b9('0x3e')]=_['intersection'](_0x251c24[_0x49b9('0x39')],qs[_0x49b9('0x3f')](_0x3fcdcb[_0x49b9('0x3a')][_0x49b9('0x3f')]));_0x2ef004[_0x49b9('0x3e')]=_0x2ef004[_0x49b9('0x3e')][_0x49b9('0x40')]?_0x2ef004['attributes']:_0x251c24[_0x49b9('0x39')];if(!_0x3fcdcb['query'][_0x49b9('0x41')](_0x49b9('0x42'))){_0x2ef004[_0x49b9('0x29')]=qs[_0x49b9('0x29')](_0x3fcdcb['query'][_0x49b9('0x29')]);_0x2ef004[_0x49b9('0x28')]=qs['offset'](_0x3fcdcb[_0x49b9('0x3a')][_0x49b9('0x28')]);}_0x2ef004[_0x49b9('0x43')]=qs[_0x49b9('0x44')](_0x3fcdcb[_0x49b9('0x3a')][_0x49b9('0x44')]);_0x2ef004['where']=qs[_0x49b9('0x3c')](_[_0x49b9('0x45')](_0x3fcdcb[_0x49b9('0x3a')],_0x251c24[_0x49b9('0x3c')]),_0x5bb994);if(_0x3fcdcb[_0x49b9('0x3a')][_0x49b9('0x46')]){_0x2ef004['where']=_[_0x49b9('0x47')](_0x2ef004[_0x49b9('0x48')],{'$or':_['map'](_0x5bb994,function(_0x7f61b8){if(_0x7f61b8[_0x49b9('0x37')]!=='VIRTUAL'){var _0x352d3c={};_0x352d3c[_0x7f61b8[_0x49b9('0x33')]]={'$like':'%'+_0x3fcdcb[_0x49b9('0x3a')][_0x49b9('0x46')]+'%'};return _0x352d3c;}})});}_0x2ef004=_[_0x49b9('0x47')]({},_0x2ef004,_0x3fcdcb[_0x49b9('0x49')]);var _0x47d099={'where':_0x2ef004[_0x49b9('0x48')]};return db[_0x49b9('0x4a')]['count'](_0x47d099)[_0x49b9('0x2f')](function(_0x2f0791){_0x5b5ed3['count']=_0x2f0791;if(_0x3fcdcb[_0x49b9('0x3a')][_0x49b9('0x4b')]){_0x2ef004[_0x49b9('0x4c')]=[{'all':!![]}];}return db[_0x49b9('0x4a')]['findAll'](_0x2ef004);})['then'](function(_0x4f3fc2){_0x5b5ed3[_0x49b9('0x4d')]=_0x4f3fc2;return _0x5b5ed3;})['then'](respondWithFilteredResult(_0x124fed,_0x2ef004))[_0x49b9('0x23')](handleError(_0x124fed,null));};exports[_0x49b9('0x4e')]=function(_0x3d7d20,_0x201120){var _0x2ef72f={'raw':![],'where':{'id':_0x3d7d20[_0x49b9('0x4f')]['id']}},_0xa4e210={};_0xa4e210[_0x49b9('0x39')]=_[_0x49b9('0x3b')](db['SalesforceAccount'][_0x49b9('0x35')]);_0xa4e210[_0x49b9('0x3a')]=_['keys'](_0x3d7d20[_0x49b9('0x3a')]);_0xa4e210[_0x49b9('0x3c')]=_[_0x49b9('0x3d')](_0xa4e210[_0x49b9('0x39')],_0xa4e210[_0x49b9('0x3a')]);_0x2ef72f['attributes']=_[_0x49b9('0x3d')](_0xa4e210[_0x49b9('0x39')],qs[_0x49b9('0x3f')](_0x3d7d20[_0x49b9('0x3a')]['fields']));_0x2ef72f[_0x49b9('0x3e')]=_0x2ef72f[_0x49b9('0x3e')][_0x49b9('0x40')]?_0x2ef72f[_0x49b9('0x3e')]:_0xa4e210[_0x49b9('0x39')];if(_0x3d7d20[_0x49b9('0x3a')][_0x49b9('0x4b')]){_0x2ef72f[_0x49b9('0x4c')]=[{'all':!![]}];}_0x2ef72f=_[_0x49b9('0x47')]({},_0x2ef72f,_0x3d7d20[_0x49b9('0x49')]);return db[_0x49b9('0x4a')]['find'](_0x2ef72f)[_0x49b9('0x2f')](handleEntityNotFound(_0x201120,null))[_0x49b9('0x2f')](respondWithResult(_0x201120,null))[_0x49b9('0x23')](handleError(_0x201120,null));};exports[_0x49b9('0x50')]=function(_0x39353e,_0x31e29d){return db['SalesforceAccount'][_0x49b9('0x50')](_0x39353e['body'],{})['then'](respondWithResult(_0x31e29d,0xc9))[_0x49b9('0x23')](handleError(_0x31e29d,null));};exports[_0x49b9('0x2e')]=function(_0x31f8c3,_0x156d4){if(_0x31f8c3[_0x49b9('0x51')]['id']){delete _0x31f8c3['body']['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x31f8c3[_0x49b9('0x4f')]['id']}})[_0x49b9('0x2f')](handleEntityNotFound(_0x156d4,null))[_0x49b9('0x2f')](saveUpdates(_0x31f8c3[_0x49b9('0x51')],null))[_0x49b9('0x2f')](respondWithResult(_0x156d4,null))[_0x49b9('0x23')](handleError(_0x156d4,null));};exports[_0x49b9('0x30')]=function(_0x42409d,_0x1ee785){return db[_0x49b9('0x4a')][_0x49b9('0x52')]({'where':{'id':_0x42409d['params']['id']}})[_0x49b9('0x2f')](handleEntityNotFound(_0x1ee785,null))['then'](removeEntity(_0x1ee785,null))[_0x49b9('0x23')](handleError(_0x1ee785,null));};exports['getConfigurations']=function(_0x1c483c,_0x210434,_0x42c581){var _0x36ebb9={};var _0x39721c={};var _0x31080c;var _0x24d2c4;return db[_0x49b9('0x4a')]['findOne']({'where':{'id':_0x1c483c[_0x49b9('0x4f')]['id']}})[_0x49b9('0x2f')](handleEntityNotFound(_0x210434,null))[_0x49b9('0x2f')](function(_0x67a437){if(_0x67a437){_0x31080c=_0x67a437;_0x39721c[_0x49b9('0x39')]=_[_0x49b9('0x3b')](db[_0x49b9('0x53')]['rawAttributes']);_0x39721c['query']=_[_0x49b9('0x3b')](_0x1c483c[_0x49b9('0x3a')]);_0x39721c[_0x49b9('0x3c')]=_[_0x49b9('0x3d')](_0x39721c['model'],_0x39721c['query']);_0x36ebb9['attributes']=_[_0x49b9('0x3d')](_0x39721c['model'],qs['fields'](_0x1c483c[_0x49b9('0x3a')][_0x49b9('0x3f')]));_0x36ebb9[_0x49b9('0x3e')]=_0x36ebb9[_0x49b9('0x3e')][_0x49b9('0x40')]?_0x36ebb9[_0x49b9('0x3e')]:_0x39721c['model'];_0x36ebb9[_0x49b9('0x43')]=qs[_0x49b9('0x44')](_0x1c483c[_0x49b9('0x3a')][_0x49b9('0x44')]);_0x36ebb9[_0x49b9('0x48')]=qs[_0x49b9('0x3c')](_[_0x49b9('0x45')](_0x1c483c[_0x49b9('0x3a')],_0x39721c['filters']));if(_0x1c483c[_0x49b9('0x3a')][_0x49b9('0x46')]){_0x36ebb9[_0x49b9('0x48')]=_[_0x49b9('0x47')](_0x36ebb9['where'],{'$or':_[_0x49b9('0x34')](_0x36ebb9[_0x49b9('0x3e')],function(_0x5ddd6d){var _0x55a165={};_0x55a165[_0x5ddd6d]={'$like':'%'+_0x1c483c[_0x49b9('0x3a')][_0x49b9('0x46')]+'%'};return _0x55a165;})});}_0x36ebb9=_[_0x49b9('0x47')]({},_0x36ebb9,_0x1c483c[_0x49b9('0x49')]);return _0x31080c[_0x49b9('0x54')](_0x36ebb9);}})[_0x49b9('0x2f')](function(_0x2c3723){if(_0x2c3723){_0x24d2c4=_0x2c3723[_0x49b9('0x40')];if(!_0x1c483c['query'][_0x49b9('0x41')]('nolimit')){_0x36ebb9[_0x49b9('0x29')]=qs[_0x49b9('0x29')](_0x1c483c[_0x49b9('0x3a')][_0x49b9('0x29')]);_0x36ebb9['offset']=qs[_0x49b9('0x28')](_0x1c483c['query']['offset']);}return _0x31080c[_0x49b9('0x54')](_0x36ebb9);}})['then'](function(_0x6cc2e6){if(_0x6cc2e6){return _0x6cc2e6?{'count':_0x24d2c4,'rows':_0x6cc2e6}:null;}})[_0x49b9('0x2f')](respondWithResult(_0x210434,null))[_0x49b9('0x23')](handleError(_0x210434,null));};exports[_0x49b9('0x55')]=function(_0x5616a5,_0x19f639,_0x2cc1b5){if(_0x5616a5[_0x49b9('0x51')]['id']){delete _0x5616a5[_0x49b9('0x51')]['id'];}return db[_0x49b9('0x4a')][_0x49b9('0x56')]({'where':{'id':_0x5616a5['params']['id']}})['then'](handleEntityNotFound(_0x19f639,null))['then'](function(_0x829625){if(_0x829625){_0x5616a5[_0x49b9('0x51')][_0x49b9('0x57')]=_0x829625['id'];_0x5616a5[_0x49b9('0x51')][_0x49b9('0x58')]=integrations['getSubjects'](_0x5616a5[_0x49b9('0x51')][_0x49b9('0x59')],_0x5616a5[_0x49b9('0x51')][_0x49b9('0x37')]);_0x5616a5[_0x49b9('0x51')][_0x49b9('0x5a')]=integrations[_0x49b9('0x5b')](_0x5616a5[_0x49b9('0x51')]['channel'],_0x5616a5[_0x49b9('0x51')]['type']);return db[_0x49b9('0x53')]['create'](_0x5616a5[_0x49b9('0x51')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x49b9('0x5c')],'as':_0x49b9('0x5a')}]});}return null;})[_0x49b9('0x2f')](respondWithResult(_0x19f639,null))['catch'](handleError(_0x19f639,null));};exports[_0x49b9('0x5d')]=function(_0x2848cd,_0x308d45,_0x4593f1){var _0x913170;var _0x1373f1='';var _0x58f0b6='Task';return db['SalesforceAccount'][_0x49b9('0x56')]({'where':{'id':_0x2848cd[_0x49b9('0x4f')]['id']},'attributes':['id',_0x49b9('0x5e'),_0x49b9('0x5f'),_0x49b9('0x60'),_0x49b9('0x61'),_0x49b9('0x62'),_0x49b9('0x63')]})[_0x49b9('0x2f')](handleEntityNotFound(_0x308d45,null))['then'](function(_0x4fec7a){if(_0x4fec7a){_0x1373f1=_0x4fec7a[_0x49b9('0x5e')];var _0x74678f=_0x1373f1[_0x49b9('0x64')](-0x1);if(_0x74678f==='/'){_0x1373f1=_0x1373f1[_0x49b9('0x65')](0x0,_0x1373f1['lastIndexOf'](_0x74678f));}_0x913170=new jsforce[(_0x49b9('0x66'))]({'oauth2':{'loginUrl':_0x1373f1,'clientId':_0x4fec7a['clientId'],'clientSecret':_0x4fec7a[_0x49b9('0x60')]}});return _0x913170[_0x49b9('0x67')](_0x4fec7a[_0x49b9('0x61')],_0x4fec7a[_0x49b9('0x62')]['concat'](_0x4fec7a[_0x49b9('0x63')]));}})[_0x49b9('0x2f')](function(_0x635a68){if(_0x635a68){if(!_[_0x49b9('0x68')](_0x2848cd[_0x49b9('0x3a')]['ticketType'])){_0x58f0b6=_0x2848cd[_0x49b9('0x3a')]['ticketType'];}return _0x913170[_0x49b9('0x69')](_0x58f0b6)['describe']();}})[_0x49b9('0x2f')](function(_0x875637){var _0x22e245=[_0x49b9('0x6a'),_0x49b9('0x6b'),_0x49b9('0x6c'),_0x49b9('0x6d'),'Subject',_0x49b9('0x6e')];var _0x2a59aa=['string',_0x49b9('0x6f'),'picklist',_0x49b9('0x70'),_0x49b9('0x71'),_0x49b9('0x72'),'phone'];if(_0x875637){_[_0x49b9('0x73')](_0x875637[_0x49b9('0x3f')],function(_0x31c40f){return _0x22e245[_0x49b9('0x74')](_0x31c40f[_0x49b9('0x33')])||!_0x2a59aa[_0x49b9('0x74')](_0x31c40f[_0x49b9('0x37')]);});return{'count':_0x875637['fields'][_0x49b9('0x40')],'rows':_[_0x49b9('0x34')](_0x875637[_0x49b9('0x3f')],function(_0x2830c7){return{'id':_0x2830c7['name'],'name':_0x2830c7['label'],'custom':_0x2830c7[_0x49b9('0x75')],'options':_0x2830c7[_0x49b9('0x76')]['length']>0x0?_[_0x49b9('0x34')](_0x2830c7['picklistValues'],function(_0x5ae720){return{'name':_0x5ae720[_0x49b9('0x77')],'value':_0x5ae720[_0x49b9('0x78')]};}):_0x2830c7[_0x49b9('0x37')]==_0x49b9('0x70')?[{'name':_0x49b9('0x79'),'value':_0x49b9('0x7a')},{'name':'False','value':'false'}]:[]};})};}})[_0x49b9('0x2f')](respondWithResult(_0x308d45,null))[_0x49b9('0x23')](function(_0x155200){var _0x2e211f=_0x2848cd[_0x49b9('0x3a')][_0x49b9('0x7b')]?0x1f4:_0x155200[_0x49b9('0x7c')]||0x1f4;logger[_0x49b9('0x1e')](_0x49b9('0x7d'),'getFields',_0x2e211f,JSON[_0x49b9('0x1d')](_0x155200));delete _0x155200[_0x49b9('0x33')];if(_0x2e211f===0x191){_0x2e211f=0x190;}_0x308d45[_0x49b9('0x25')](_0x2e211f)[_0x49b9('0x7e')](_0x2848cd['query'][_0x49b9('0x7b')]?{'message':_0x49b9('0x7f'),'statusCode':_0x155200['statusCode']}:_0x155200);});}; \ No newline at end of file +var _0x7a52=['nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','username','securityToken','slice','lastIndexOf','clientId','clientSecret','login','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','int','boolean','phone','remove','includes','label','custom','picklistValues','true','false','test','getFields,\x20%s,\x20%s,\x20%s','statusCode','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','key','model','query','keys','intersection','fields','length','attributes','hasOwnProperty'];(function(_0x7c6da8,_0x49c124){var _0x4ed520=function(_0x47ca56){while(--_0x47ca56){_0x7c6da8['push'](_0x7c6da8['shift']());}};_0x4ed520(++_0x49c124);}(_0x7a52,0x1bd));var _0x27a5=function(_0x3d650f,_0x494f57){_0x3d650f=_0x3d650f-0x0;var _0x3f4e54=_0x7a52[_0x3d650f];return _0x3f4e54;};'use strict';var pdf=require(_0x27a5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x27a5('0x1'));var zipdir=require(_0x27a5('0x2'));var jsonpatch=require(_0x27a5('0x3'));var rp=require(_0x27a5('0x4'));var moment=require('moment');var BPromise=require(_0x27a5('0x5'));var Mustache=require(_0x27a5('0x6'));var util=require(_0x27a5('0x7'));var path=require(_0x27a5('0x8'));var sox=require(_0x27a5('0x9'));var csv=require(_0x27a5('0xa'));var ejs=require(_0x27a5('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x27a5('0xc'));var crypto=require(_0x27a5('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x27a5('0xa'));var querystring=require('querystring');var Papa=require(_0x27a5('0xe'));var Redis=require(_0x27a5('0xf'));var authService=require(_0x27a5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x27a5('0x11'));var hardwareService=require(_0x27a5('0x12'));var logger=require(_0x27a5('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x27a5('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x27a5('0x15'));var jayson=require(_0x27a5('0x16'));var client=jayson[_0x27a5('0x17')][_0x27a5('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x20337c,_0x30dbf1,_0xe5a2db,_0x515e51){return new BPromise(function(_0x447f2c,_0x368d9){var _0x14d262=_0x515e51||client;return _0x14d262['request'](_0x20337c,_0xe5a2db)['then'](function(_0x128307){logger[_0x27a5('0x19')](_0x27a5('0x1a'),_0x30dbf1,_0x27a5('0x1b'));logger[_0x27a5('0x1c')](_0x27a5('0x1d'),_0x30dbf1,_0x27a5('0x1b'),JSON[_0x27a5('0x1e')](_0x128307));if(_0x128307['error']){if(_0x128307[_0x27a5('0x1f')][_0x27a5('0x20')]===0x1f4){logger[_0x27a5('0x1f')](_0x27a5('0x1a'),_0x30dbf1,_0x128307[_0x27a5('0x1f')][_0x27a5('0x21')]);return _0x368d9(_0x128307[_0x27a5('0x1f')]['message']);}logger[_0x27a5('0x1f')](_0x27a5('0x1a'),_0x30dbf1,_0x128307['error'][_0x27a5('0x21')]);return _0x447f2c(_0x128307[_0x27a5('0x1f')][_0x27a5('0x21')]);}else{logger[_0x27a5('0x19')](_0x27a5('0x1a'),_0x30dbf1,'request\x20sent');_0x447f2c(_0x128307[_0x27a5('0x22')][_0x27a5('0x21')]);}})['catch'](function(_0x5ee7a1){logger[_0x27a5('0x1f')](_0x27a5('0x1a'),_0x30dbf1,_0x5ee7a1);_0x368d9(_0x5ee7a1);});});}function respondWithStatusCode(_0x355b0c,_0x304abb){_0x304abb=_0x304abb||0xcc;return function(_0x5b7313){if(_0x5b7313){return _0x355b0c[_0x27a5('0x23')](_0x304abb);}return _0x355b0c['status'](_0x304abb)[_0x27a5('0x24')]();};}function respondWithResult(_0x4cae30,_0x38075e){_0x38075e=_0x38075e||0xc8;return function(_0x2158b2){if(_0x2158b2){return _0x4cae30[_0x27a5('0x25')](_0x38075e)[_0x27a5('0x26')](_0x2158b2);}};}function respondWithFilteredResult(_0x5128f0,_0x5dd9d1){return function(_0x316265){if(_0x316265){var _0x5c3906=_0x316265[_0x27a5('0x27')],_0x25266d=_0x5dd9d1[_0x27a5('0x28')],_0x3b2ca2=_0x5dd9d1[_0x27a5('0x28')]+_0x5dd9d1[_0x27a5('0x29')],_0xe90f99;if(_0x3b2ca2>=_0x5c3906){_0x3b2ca2=_0x5c3906;_0xe90f99=0xc8;}else{_0xe90f99=0xce;}_0x5128f0[_0x27a5('0x25')](_0xe90f99);return _0x5128f0[_0x27a5('0x2a')](_0x27a5('0x2b'),_0x25266d+'-'+_0x3b2ca2+'/'+_0x5c3906)[_0x27a5('0x26')](_0x316265);}return null;};}function patchUpdates(_0x20cfc7){return function(_0x203a95){try{jsonpatch[_0x27a5('0x2c')](_0x203a95,_0x20cfc7,!![]);}catch(_0x40cbef){return BPromise[_0x27a5('0x2d')](_0x40cbef);}return _0x203a95[_0x27a5('0x2e')]();};}function saveUpdates(_0x438850,_0x567cdd){return function(_0x40e7ce){if(_0x40e7ce){return _0x40e7ce[_0x27a5('0x2f')](_0x438850)[_0x27a5('0x30')](function(_0x2e8801){return _0x2e8801;});}return null;};}function removeEntity(_0x98dde8,_0x2b87c1){return function(_0x13793c){if(_0x13793c){return _0x13793c[_0x27a5('0x31')]()[_0x27a5('0x30')](function(){_0x98dde8[_0x27a5('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0xea4e48,_0x3bb59f){return function(_0x57b7a6){if(!_0x57b7a6){_0xea4e48['sendStatus'](0x194);}return _0x57b7a6;};}function handleError(_0x2dcf19,_0x537da0){_0x537da0=_0x537da0||0x1f4;return function(_0xe22fc8){logger[_0x27a5('0x1f')](_0xe22fc8[_0x27a5('0x32')]);if(_0xe22fc8[_0x27a5('0x33')]){delete _0xe22fc8[_0x27a5('0x33')];}_0x2dcf19[_0x27a5('0x25')](_0x537da0)[_0x27a5('0x34')](_0xe22fc8);};}exports[_0x27a5('0x35')]=function(_0x25c42f,_0x40629c){var _0x97cb27={},_0x48f022={},_0x1ab750={'count':0x0,'rows':[]};var _0x5518b4=_[_0x27a5('0x36')](db[_0x27a5('0x37')][_0x27a5('0x38')],function(_0x4b2922){return{'name':_0x4b2922[_0x27a5('0x39')],'type':_0x4b2922['type'][_0x27a5('0x3a')]};});_0x48f022[_0x27a5('0x3b')]=_['map'](_0x5518b4,'name');_0x48f022[_0x27a5('0x3c')]=_[_0x27a5('0x3d')](_0x25c42f['query']);_0x48f022['filters']=_[_0x27a5('0x3e')](_0x48f022[_0x27a5('0x3b')],_0x48f022[_0x27a5('0x3c')]);_0x97cb27['attributes']=_[_0x27a5('0x3e')](_0x48f022[_0x27a5('0x3b')],qs[_0x27a5('0x3f')](_0x25c42f[_0x27a5('0x3c')][_0x27a5('0x3f')]));_0x97cb27['attributes']=_0x97cb27['attributes'][_0x27a5('0x40')]?_0x97cb27[_0x27a5('0x41')]:_0x48f022[_0x27a5('0x3b')];if(!_0x25c42f[_0x27a5('0x3c')][_0x27a5('0x42')](_0x27a5('0x43'))){_0x97cb27[_0x27a5('0x29')]=qs[_0x27a5('0x29')](_0x25c42f[_0x27a5('0x3c')][_0x27a5('0x29')]);_0x97cb27['offset']=qs[_0x27a5('0x28')](_0x25c42f[_0x27a5('0x3c')][_0x27a5('0x28')]);}_0x97cb27[_0x27a5('0x44')]=qs[_0x27a5('0x45')](_0x25c42f[_0x27a5('0x3c')]['sort']);_0x97cb27['where']=qs[_0x27a5('0x46')](_[_0x27a5('0x47')](_0x25c42f['query'],_0x48f022[_0x27a5('0x46')]),_0x5518b4);if(_0x25c42f[_0x27a5('0x3c')][_0x27a5('0x48')]){_0x97cb27[_0x27a5('0x49')]=_[_0x27a5('0x4a')](_0x97cb27[_0x27a5('0x49')],{'$or':_[_0x27a5('0x36')](_0x5518b4,function(_0x4761a7){if(_0x4761a7[_0x27a5('0x4b')]!==_0x27a5('0x4c')){var _0x5c11ab={};_0x5c11ab[_0x4761a7[_0x27a5('0x33')]]={'$like':'%'+_0x25c42f[_0x27a5('0x3c')][_0x27a5('0x48')]+'%'};return _0x5c11ab;}})});}_0x97cb27=_[_0x27a5('0x4a')]({},_0x97cb27,_0x25c42f[_0x27a5('0x4d')]);var _0x4662db={'where':_0x97cb27[_0x27a5('0x49')]};return db[_0x27a5('0x37')][_0x27a5('0x27')](_0x4662db)[_0x27a5('0x30')](function(_0x121c59){_0x1ab750['count']=_0x121c59;if(_0x25c42f[_0x27a5('0x3c')]['includeAll']){_0x97cb27[_0x27a5('0x4e')]=[{'all':!![]}];}return db[_0x27a5('0x37')][_0x27a5('0x4f')](_0x97cb27);})['then'](function(_0x5b6a7f){_0x1ab750[_0x27a5('0x50')]=_0x5b6a7f;return _0x1ab750;})['then'](respondWithFilteredResult(_0x40629c,_0x97cb27))[_0x27a5('0x51')](handleError(_0x40629c,null));};exports[_0x27a5('0x52')]=function(_0x3550dd,_0x1acc80){var _0x3732e0={'raw':![],'where':{'id':_0x3550dd[_0x27a5('0x53')]['id']}},_0x19a596={};_0x19a596[_0x27a5('0x3b')]=_[_0x27a5('0x3d')](db['SalesforceAccount'][_0x27a5('0x38')]);_0x19a596[_0x27a5('0x3c')]=_[_0x27a5('0x3d')](_0x3550dd[_0x27a5('0x3c')]);_0x19a596['filters']=_[_0x27a5('0x3e')](_0x19a596[_0x27a5('0x3b')],_0x19a596[_0x27a5('0x3c')]);_0x3732e0[_0x27a5('0x41')]=_[_0x27a5('0x3e')](_0x19a596[_0x27a5('0x3b')],qs[_0x27a5('0x3f')](_0x3550dd['query'][_0x27a5('0x3f')]));_0x3732e0[_0x27a5('0x41')]=_0x3732e0[_0x27a5('0x41')][_0x27a5('0x40')]?_0x3732e0[_0x27a5('0x41')]:_0x19a596['model'];if(_0x3550dd[_0x27a5('0x3c')]['includeAll']){_0x3732e0['include']=[{'all':!![]}];}_0x3732e0=_[_0x27a5('0x4a')]({},_0x3732e0,_0x3550dd[_0x27a5('0x4d')]);return db['SalesforceAccount'][_0x27a5('0x54')](_0x3732e0)[_0x27a5('0x30')](handleEntityNotFound(_0x1acc80,null))[_0x27a5('0x30')](respondWithResult(_0x1acc80,null))[_0x27a5('0x51')](handleError(_0x1acc80,null));};exports[_0x27a5('0x55')]=function(_0xb5a42f,_0x52d059){return db[_0x27a5('0x37')]['create'](_0xb5a42f['body'],{})['then'](respondWithResult(_0x52d059,0xc9))[_0x27a5('0x51')](handleError(_0x52d059,null));};exports[_0x27a5('0x2f')]=function(_0x3372c1,_0x32eb25){if(_0x3372c1[_0x27a5('0x56')]['id']){delete _0x3372c1[_0x27a5('0x56')]['id'];}return db[_0x27a5('0x37')][_0x27a5('0x54')]({'where':{'id':_0x3372c1[_0x27a5('0x53')]['id']}})[_0x27a5('0x30')](handleEntityNotFound(_0x32eb25,null))[_0x27a5('0x30')](saveUpdates(_0x3372c1[_0x27a5('0x56')],null))['then'](respondWithResult(_0x32eb25,null))[_0x27a5('0x51')](handleError(_0x32eb25,null));};exports[_0x27a5('0x31')]=function(_0x1b7f7d,_0x48d065){return db[_0x27a5('0x37')][_0x27a5('0x54')]({'where':{'id':_0x1b7f7d['params']['id']}})[_0x27a5('0x30')](handleEntityNotFound(_0x48d065,null))[_0x27a5('0x30')](removeEntity(_0x48d065,null))[_0x27a5('0x51')](handleError(_0x48d065,null));};exports[_0x27a5('0x57')]=function(_0x271cec,_0x3b58ad,_0x5b3c54){var _0x5a17e4={};var _0x321692={};var _0x9182d8;var _0x117909;return db['SalesforceAccount'][_0x27a5('0x58')]({'where':{'id':_0x271cec[_0x27a5('0x53')]['id']}})[_0x27a5('0x30')](handleEntityNotFound(_0x3b58ad,null))[_0x27a5('0x30')](function(_0x8f2f15){if(_0x8f2f15){_0x9182d8=_0x8f2f15;_0x321692[_0x27a5('0x3b')]=_[_0x27a5('0x3d')](db[_0x27a5('0x59')]['rawAttributes']);_0x321692[_0x27a5('0x3c')]=_[_0x27a5('0x3d')](_0x271cec[_0x27a5('0x3c')]);_0x321692['filters']=_['intersection'](_0x321692[_0x27a5('0x3b')],_0x321692['query']);_0x5a17e4[_0x27a5('0x41')]=_[_0x27a5('0x3e')](_0x321692[_0x27a5('0x3b')],qs['fields'](_0x271cec[_0x27a5('0x3c')][_0x27a5('0x3f')]));_0x5a17e4[_0x27a5('0x41')]=_0x5a17e4[_0x27a5('0x41')][_0x27a5('0x40')]?_0x5a17e4[_0x27a5('0x41')]:_0x321692['model'];_0x5a17e4[_0x27a5('0x44')]=qs[_0x27a5('0x45')](_0x271cec[_0x27a5('0x3c')][_0x27a5('0x45')]);_0x5a17e4['where']=qs['filters'](_[_0x27a5('0x47')](_0x271cec['query'],_0x321692[_0x27a5('0x46')]));if(_0x271cec[_0x27a5('0x3c')]['filter']){_0x5a17e4['where']=_[_0x27a5('0x4a')](_0x5a17e4[_0x27a5('0x49')],{'$or':_[_0x27a5('0x36')](_0x5a17e4[_0x27a5('0x41')],function(_0x220b87){var _0x2e355d={};_0x2e355d[_0x220b87]={'$like':'%'+_0x271cec[_0x27a5('0x3c')][_0x27a5('0x48')]+'%'};return _0x2e355d;})});}_0x5a17e4=_['merge']({},_0x5a17e4,_0x271cec[_0x27a5('0x4d')]);return _0x9182d8['getConfigurations'](_0x5a17e4);}})[_0x27a5('0x30')](function(_0x47f007){if(_0x47f007){_0x117909=_0x47f007[_0x27a5('0x40')];if(!_0x271cec[_0x27a5('0x3c')][_0x27a5('0x42')](_0x27a5('0x43'))){_0x5a17e4[_0x27a5('0x29')]=qs['limit'](_0x271cec['query']['limit']);_0x5a17e4['offset']=qs[_0x27a5('0x28')](_0x271cec[_0x27a5('0x3c')][_0x27a5('0x28')]);}return _0x9182d8[_0x27a5('0x57')](_0x5a17e4);}})[_0x27a5('0x30')](function(_0x4ad71c){if(_0x4ad71c){return _0x4ad71c?{'count':_0x117909,'rows':_0x4ad71c}:null;}})[_0x27a5('0x30')](respondWithResult(_0x3b58ad,null))[_0x27a5('0x51')](handleError(_0x3b58ad,null));};exports[_0x27a5('0x5a')]=function(_0x2c6fd8,_0x4671ab,_0x1e5502){if(_0x2c6fd8['body']['id']){delete _0x2c6fd8[_0x27a5('0x56')]['id'];}return db[_0x27a5('0x37')][_0x27a5('0x58')]({'where':{'id':_0x2c6fd8['params']['id']}})[_0x27a5('0x30')](handleEntityNotFound(_0x4671ab,null))[_0x27a5('0x30')](function(_0x2ebca7){if(_0x2ebca7){_0x2c6fd8[_0x27a5('0x56')][_0x27a5('0x5b')]=_0x2ebca7['id'];_0x2c6fd8[_0x27a5('0x56')][_0x27a5('0x5c')]=integrations['getSubjects'](_0x2c6fd8[_0x27a5('0x56')][_0x27a5('0x5d')],_0x2c6fd8[_0x27a5('0x56')]['type']);_0x2c6fd8[_0x27a5('0x56')][_0x27a5('0x5e')]=integrations[_0x27a5('0x5f')](_0x2c6fd8[_0x27a5('0x56')]['channel'],_0x2c6fd8[_0x27a5('0x56')][_0x27a5('0x4b')]);return db[_0x27a5('0x59')][_0x27a5('0x55')](_0x2c6fd8[_0x27a5('0x56')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x27a5('0x60')],'as':_0x27a5('0x5e')}]});}return null;})['then'](respondWithResult(_0x4671ab,null))[_0x27a5('0x51')](handleError(_0x4671ab,null));};exports[_0x27a5('0x61')]=function(_0x2d6666,_0x4dcd69,_0xd3a479){var _0x5ca695;var _0x32fb40='';var _0x38e196=_0x27a5('0x62');return db[_0x27a5('0x37')][_0x27a5('0x58')]({'where':{'id':_0x2d6666[_0x27a5('0x53')]['id']},'attributes':['id','remoteUri','clientId','clientSecret',_0x27a5('0x63'),'password',_0x27a5('0x64')]})['then'](handleEntityNotFound(_0x4dcd69,null))[_0x27a5('0x30')](function(_0x135c97){if(_0x135c97){_0x32fb40=_0x135c97['remoteUri'];var _0x3506b4=_0x32fb40[_0x27a5('0x65')](-0x1);if(_0x3506b4==='/'){_0x32fb40=_0x32fb40['substring'](0x0,_0x32fb40[_0x27a5('0x66')](_0x3506b4));}_0x5ca695=new jsforce['Connection']({'oauth2':{'loginUrl':_0x32fb40,'clientId':_0x135c97[_0x27a5('0x67')],'clientSecret':_0x135c97[_0x27a5('0x68')]}});return _0x5ca695[_0x27a5('0x69')](_0x135c97[_0x27a5('0x63')],_0x135c97['password']['concat'](_0x135c97[_0x27a5('0x64')]));}})[_0x27a5('0x30')](function(_0x56ad59){if(_0x56ad59){if(!_[_0x27a5('0x6a')](_0x2d6666[_0x27a5('0x3c')]['ticketType'])){_0x38e196=_0x2d6666['query'][_0x27a5('0x6b')];}return _0x5ca695[_0x27a5('0x6c')](_0x38e196)[_0x27a5('0x6d')]();}})[_0x27a5('0x30')](function(_0x10639e){var _0x476e7a=['OwnerId',_0x27a5('0x6e'),_0x27a5('0x6f'),_0x27a5('0x70'),_0x27a5('0x71'),_0x27a5('0x72')];var _0x4b2abb=['string',_0x27a5('0x73'),'picklist',_0x27a5('0x74'),'email','textarea',_0x27a5('0x75')];if(_0x10639e){_[_0x27a5('0x76')](_0x10639e[_0x27a5('0x3f')],function(_0x750093){return _0x476e7a[_0x27a5('0x77')](_0x750093[_0x27a5('0x33')])||!_0x4b2abb[_0x27a5('0x77')](_0x750093['type']);});return{'count':_0x10639e[_0x27a5('0x3f')][_0x27a5('0x40')],'rows':_['map'](_0x10639e[_0x27a5('0x3f')],function(_0x3286c7){return{'id':_0x3286c7[_0x27a5('0x33')],'name':_0x3286c7[_0x27a5('0x78')],'custom':_0x3286c7[_0x27a5('0x79')],'options':_0x3286c7['picklistValues'][_0x27a5('0x40')]>0x0?_[_0x27a5('0x36')](_0x3286c7[_0x27a5('0x7a')],function(_0x107597){return{'name':_0x107597[_0x27a5('0x78')],'value':_0x107597['value']};}):_0x3286c7['type']==_0x27a5('0x74')?[{'name':'True','value':_0x27a5('0x7b')},{'name':'False','value':_0x27a5('0x7c')}]:[]};})};}})[_0x27a5('0x30')](respondWithResult(_0x4dcd69,null))[_0x27a5('0x51')](function(_0x2b7f65){var _0x54fe7a=_0x2d6666['query'][_0x27a5('0x7d')]?0x1f4:_0x2b7f65['statusCode']||0x1f4;logger[_0x27a5('0x1f')](_0x27a5('0x7e'),_0x27a5('0x61'),_0x54fe7a,JSON[_0x27a5('0x1e')](_0x2b7f65));delete _0x2b7f65[_0x27a5('0x33')];if(_0x54fe7a===0x191){_0x54fe7a=0x190;}_0x4dcd69[_0x27a5('0x25')](_0x54fe7a)[_0x27a5('0x34')](_0x2d6666[_0x27a5('0x3c')][_0x27a5('0x7d')]?{'message':'Wrong\x20credentials','statusCode':_0x2b7f65[_0x27a5('0x7f')]}:_0x2b7f65);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 0295c01..7fefb7a 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 _0xa7e0=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','int_salesforce_accounts','util'];(function(_0x4653f7,_0x3d3ae3){var _0x5454da=function(_0x448f55){while(--_0x448f55){_0x4653f7['push'](_0x4653f7['shift']());}};_0x5454da(++_0x3d3ae3);}(_0xa7e0,0x6b));var _0x0a7e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa7e0[_0x56482c];return _0x5aae7a;};'use strict';var _=require('lodash');var util=require(_0x0a7e('0x0'));var logger=require('../../config/logger')(_0x0a7e('0x1'));var moment=require(_0x0a7e('0x2'));var BPromise=require(_0x0a7e('0x3'));var rp=require(_0x0a7e('0x4'));var fs=require('fs');var path=require(_0x0a7e('0x5'));var rimraf=require(_0x0a7e('0x6'));var config=require(_0x0a7e('0x7'));var attributes=require(_0x0a7e('0x8'));var integrations=require(_0x0a7e('0x9'));module['exports']=function(_0x3dbeae,_0x4bef04){return _0x3dbeae[_0x0a7e('0xa')]('SalesforceAccount',attributes,{'tableName':_0x0a7e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25a3=['rimraf','../../config/environment','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','request-promise','path'];(function(_0xf04c6d,_0xe98786){var _0x4a804e=function(_0x431a0a){while(--_0x431a0a){_0xf04c6d['push'](_0xf04c6d['shift']());}};_0x4a804e(++_0xe98786);}(_0x25a3,0x102));var _0x325a=function(_0x173c98,_0x38dc60){_0x173c98=_0x173c98-0x0;var _0x1303dc=_0x25a3[_0x173c98];return _0x1303dc;};'use strict';var _=require(_0x325a('0x0'));var util=require(_0x325a('0x1'));var logger=require(_0x325a('0x2'))(_0x325a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x325a('0x4'));var fs=require('fs');var path=require(_0x325a('0x5'));var rimraf=require(_0x325a('0x6'));var config=require(_0x325a('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x325a('0x8'));module['exports']=function(_0x41be14,_0x4a6d86){return _0x41be14[_0x325a('0x9')](_0x325a('0xa'),attributes,{'tableName':_0x325a('0xb'),'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 6113748..73028f8 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 _0x2dae=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SalesforceAccount','options','where','attributes','include','map','model','info','GetSalesforceAccount','ShowSalesforceAccount','find','lodash','moment','bluebird'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2dae,0xc3));var _0xe2da=function(_0x23be51,_0xc02a1b){_0x23be51=_0x23be51-0x0;var _0x47a26d=_0x2dae[_0x23be51];return _0x47a26d;};'use strict';var _=require(_0xe2da('0x0'));var util=require('util');var moment=require(_0xe2da('0x1'));var BPromise=require(_0xe2da('0x2'));var rs=require(_0xe2da('0x3'));var fs=require('fs');var Redis=require(_0xe2da('0x4'));var db=require(_0xe2da('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe2da('0x6'))(_0xe2da('0x7'));var config=require(_0xe2da('0x8'));var jayson=require(_0xe2da('0x9'));var client=jayson['client'][_0xe2da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x89c70b,_0x34cc98,_0x2efbd8){return new BPromise(function(_0x238da3,_0x1c71ea){return client[_0xe2da('0xb')](_0x89c70b,_0x2efbd8)[_0xe2da('0xc')](function(_0x68aa40){logger['info'](_0xe2da('0xd'),_0x34cc98,_0xe2da('0xe'));logger[_0xe2da('0xf')](_0xe2da('0x10'),_0x34cc98,_0xe2da('0xe'),JSON[_0xe2da('0x11')](_0x68aa40));if(_0x68aa40[_0xe2da('0x12')]){if(_0x68aa40[_0xe2da('0x12')]['code']===0x1f4){logger[_0xe2da('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x34cc98,_0x68aa40[_0xe2da('0x12')][_0xe2da('0x13')]);return _0x1c71ea(_0x68aa40[_0xe2da('0x12')][_0xe2da('0x13')]);}logger[_0xe2da('0x12')](_0xe2da('0xd'),_0x34cc98,_0x68aa40[_0xe2da('0x12')]['message']);return _0x238da3(_0x68aa40[_0xe2da('0x12')]['message']);}else{logger['info'](_0xe2da('0xd'),_0x34cc98,_0xe2da('0xe'));_0x238da3(_0x68aa40[_0xe2da('0x14')]['message']);}})[_0xe2da('0x15')](function(_0x2c0353){logger[_0xe2da('0x12')](_0xe2da('0xd'),_0x34cc98,_0x2c0353);_0x1c71ea(_0x2c0353);});});}exports['GetSalesforceAccount']=function(_0x45bb92){var _0x1f7d33=this;return new Promise(function(_0x417363,_0x2e5730){return db[_0xe2da('0x16')]['findAll']({'raw':_0x45bb92[_0xe2da('0x17')]?_0x45bb92[_0xe2da('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x45bb92[_0xe2da('0x17')]?_0x45bb92[_0xe2da('0x17')][_0xe2da('0x18')]||null:null,'attributes':_0x45bb92[_0xe2da('0x17')]?_0x45bb92[_0xe2da('0x17')][_0xe2da('0x19')]||null:null,'limit':_0x45bb92['options']?_0x45bb92[_0xe2da('0x17')]['limit']||null:null,'include':_0x45bb92[_0xe2da('0x17')]?_0x45bb92[_0xe2da('0x17')][_0xe2da('0x1a')]?_[_0xe2da('0x1b')](_0x45bb92[_0xe2da('0x17')][_0xe2da('0x1a')],function(_0x38f2c4){return{'model':db[_0x38f2c4[_0xe2da('0x1c')]],'as':_0x38f2c4['as'],'attributes':_0x38f2c4['attributes'],'include':_0x38f2c4[_0xe2da('0x1a')]?_[_0xe2da('0x1b')](_0x38f2c4[_0xe2da('0x1a')],function(_0x14704d){return{'model':db[_0x14704d[_0xe2da('0x1c')]],'as':_0x14704d['as'],'attributes':_0x14704d[_0xe2da('0x19')],'include':_0x14704d[_0xe2da('0x1a')]?_['map'](_0x14704d[_0xe2da('0x1a')],function(_0x3e23d7){return{'model':db[_0x3e23d7[_0xe2da('0x1c')]],'as':_0x3e23d7['as'],'attributes':_0x3e23d7[_0xe2da('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe2da('0xc')](function(_0x2b6c9e){logger[_0xe2da('0x1d')](_0xe2da('0x1e'),_0x45bb92);logger['debug']('GetSalesforceAccount',_0x45bb92,JSON['stringify'](_0x2b6c9e));_0x417363(_0x2b6c9e);})[_0xe2da('0x15')](function(_0x8c91db){logger[_0xe2da('0x12')](_0xe2da('0x1e'),_0x8c91db['message'],_0x45bb92);_0x2e5730(_0x1f7d33['error'](0x1f4,_0x8c91db[_0xe2da('0x13')]));});});};exports[_0xe2da('0x1f')]=function(_0x262d40){var _0x39f983=this;return new Promise(function(_0x7ab5ee,_0x15df33){return db[_0xe2da('0x16')][_0xe2da('0x20')]({'raw':_0x262d40[_0xe2da('0x17')]?_0x262d40['options']['raw']===undefined?!![]:![]:!![],'where':_0x262d40[_0xe2da('0x17')]?_0x262d40[_0xe2da('0x17')][_0xe2da('0x18')]||null:null,'attributes':_0x262d40[_0xe2da('0x17')]?_0x262d40[_0xe2da('0x17')][_0xe2da('0x19')]||null:null,'include':_0x262d40[_0xe2da('0x17')]?_0x262d40[_0xe2da('0x17')][_0xe2da('0x1a')]?_[_0xe2da('0x1b')](_0x262d40[_0xe2da('0x17')][_0xe2da('0x1a')],function(_0x4ef546){return{'model':db[_0x4ef546[_0xe2da('0x1c')]],'as':_0x4ef546['as'],'attributes':_0x4ef546[_0xe2da('0x19')],'include':_0x4ef546[_0xe2da('0x1a')]?_[_0xe2da('0x1b')](_0x4ef546[_0xe2da('0x1a')],function(_0x5a078e){return{'model':db[_0x5a078e[_0xe2da('0x1c')]],'as':_0x5a078e['as'],'attributes':_0x5a078e[_0xe2da('0x19')],'include':_0x5a078e[_0xe2da('0x1a')]?_['map'](_0x5a078e[_0xe2da('0x1a')],function(_0x10b8f5){return{'model':db[_0x10b8f5[_0xe2da('0x1c')]],'as':_0x10b8f5['as'],'attributes':_0x10b8f5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x156deb){logger[_0xe2da('0x1d')]('ShowSalesforceAccount',_0x262d40);logger[_0xe2da('0xf')](_0xe2da('0x1f'),_0x262d40,JSON[_0xe2da('0x11')](_0x156deb));_0x7ab5ee(_0x156deb);})[_0xe2da('0x15')](function(_0x3a6ca3){logger['error'](_0xe2da('0x1f'),_0x3a6ca3['message'],_0x262d40);_0x15df33(_0x39f983['error'](0x1f4,_0x3a6ca3[_0xe2da('0x13')]));});});}; \ No newline at end of file +var _0x5db8=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','model','stringify','ShowSalesforceAccount','find','map','lodash','util','moment','randomstring','ioredis'];(function(_0x5b4bee,_0x5eb2d8){var _0x35da08=function(_0x215e72){while(--_0x215e72){_0x5b4bee['push'](_0x5b4bee['shift']());}};_0x35da08(++_0x5eb2d8);}(_0x5db8,0xbb));var _0x85db=function(_0x13342f,_0x3d6303){_0x13342f=_0x13342f-0x0;var _0x2fc1fc=_0x5db8[_0x13342f];return _0x2fc1fc;};'use strict';var _=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var moment=require(_0x85db('0x2'));var BPromise=require('bluebird');var rs=require(_0x85db('0x3'));var fs=require('fs');var Redis=require(_0x85db('0x4'));var db=require(_0x85db('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x85db('0x6'));var config=require(_0x85db('0x7'));var jayson=require(_0x85db('0x8'));var client=jayson[_0x85db('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x489b13,_0x2b9f25,_0x3a10dd){return new BPromise(function(_0xc6fd00,_0x308988){return client['request'](_0x489b13,_0x3a10dd)[_0x85db('0xa')](function(_0x54f0c1){logger[_0x85db('0xb')](_0x85db('0xc'),_0x2b9f25,_0x85db('0xd'));logger[_0x85db('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x2b9f25,'request\x20sent',JSON['stringify'](_0x54f0c1));if(_0x54f0c1[_0x85db('0xf')]){if(_0x54f0c1[_0x85db('0xf')]['code']===0x1f4){logger[_0x85db('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x2b9f25,_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);return _0x308988(_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);}logger[_0x85db('0xf')](_0x85db('0xc'),_0x2b9f25,_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);return _0xc6fd00(_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);}else{logger[_0x85db('0xb')](_0x85db('0xc'),_0x2b9f25,_0x85db('0xd'));_0xc6fd00(_0x54f0c1['result'][_0x85db('0x10')]);}})[_0x85db('0x11')](function(_0x11e7da){logger[_0x85db('0xf')](_0x85db('0xc'),_0x2b9f25,_0x11e7da);_0x308988(_0x11e7da);});});}exports[_0x85db('0x12')]=function(_0x3209b3){var _0x56d3b2=this;return new Promise(function(_0x37ac04,_0xf89937){return db[_0x85db('0x13')][_0x85db('0x14')]({'raw':_0x3209b3[_0x85db('0x15')]?_0x3209b3[_0x85db('0x15')][_0x85db('0x16')]===undefined?!![]:![]:!![],'where':_0x3209b3[_0x85db('0x15')]?_0x3209b3[_0x85db('0x15')][_0x85db('0x17')]||null:null,'attributes':_0x3209b3['options']?_0x3209b3[_0x85db('0x15')][_0x85db('0x18')]||null:null,'limit':_0x3209b3[_0x85db('0x15')]?_0x3209b3[_0x85db('0x15')][_0x85db('0x19')]||null:null,'include':_0x3209b3[_0x85db('0x15')]?_0x3209b3[_0x85db('0x15')][_0x85db('0x1a')]?_['map'](_0x3209b3[_0x85db('0x15')][_0x85db('0x1a')],function(_0x57fe5b){return{'model':db[_0x57fe5b[_0x85db('0x1b')]],'as':_0x57fe5b['as'],'attributes':_0x57fe5b[_0x85db('0x18')],'include':_0x57fe5b[_0x85db('0x1a')]?_['map'](_0x57fe5b[_0x85db('0x1a')],function(_0x46f428){return{'model':db[_0x46f428[_0x85db('0x1b')]],'as':_0x46f428['as'],'attributes':_0x46f428['attributes'],'include':_0x46f428['include']?_['map'](_0x46f428[_0x85db('0x1a')],function(_0x105bb9){return{'model':db[_0x105bb9[_0x85db('0x1b')]],'as':_0x105bb9['as'],'attributes':_0x105bb9['attributes']};}):[]};}):[]};}):[]:[]})[_0x85db('0xa')](function(_0xc2abb8){logger[_0x85db('0xb')]('GetSalesforceAccount',_0x3209b3);logger['debug'](_0x85db('0x12'),_0x3209b3,JSON[_0x85db('0x1c')](_0xc2abb8));_0x37ac04(_0xc2abb8);})[_0x85db('0x11')](function(_0x226540){logger[_0x85db('0xf')](_0x85db('0x12'),_0x226540[_0x85db('0x10')],_0x3209b3);_0xf89937(_0x56d3b2[_0x85db('0xf')](0x1f4,_0x226540[_0x85db('0x10')]));});});};exports[_0x85db('0x1d')]=function(_0x580e90){var _0x4a15b9=this;return new Promise(function(_0x13ad98,_0x5e0e75){return db[_0x85db('0x13')][_0x85db('0x1e')]({'raw':_0x580e90['options']?_0x580e90[_0x85db('0x15')][_0x85db('0x16')]===undefined?!![]:![]:!![],'where':_0x580e90[_0x85db('0x15')]?_0x580e90[_0x85db('0x15')]['where']||null:null,'attributes':_0x580e90[_0x85db('0x15')]?_0x580e90[_0x85db('0x15')][_0x85db('0x18')]||null:null,'include':_0x580e90[_0x85db('0x15')]?_0x580e90[_0x85db('0x15')]['include']?_[_0x85db('0x1f')](_0x580e90[_0x85db('0x15')][_0x85db('0x1a')],function(_0xd0d27){return{'model':db[_0xd0d27['model']],'as':_0xd0d27['as'],'attributes':_0xd0d27[_0x85db('0x18')],'include':_0xd0d27[_0x85db('0x1a')]?_[_0x85db('0x1f')](_0xd0d27['include'],function(_0x550194){return{'model':db[_0x550194[_0x85db('0x1b')]],'as':_0x550194['as'],'attributes':_0x550194[_0x85db('0x18')],'include':_0x550194['include']?_[_0x85db('0x1f')](_0x550194[_0x85db('0x1a')],function(_0x20939b){return{'model':db[_0x20939b[_0x85db('0x1b')]],'as':_0x20939b['as'],'attributes':_0x20939b[_0x85db('0x18')]};}):[]};}):[]};}):[]:[]})[_0x85db('0xa')](function(_0x1791f3){logger[_0x85db('0xb')](_0x85db('0x1d'),_0x580e90);logger[_0x85db('0xe')](_0x85db('0x1d'),_0x580e90,JSON[_0x85db('0x1c')](_0x1791f3));_0x13ad98(_0x1791f3);})['catch'](function(_0x35e938){logger[_0x85db('0xf')](_0x85db('0x1d'),_0x35e938[_0x85db('0x10')],_0x580e90);_0x5e0e75(_0x4a15b9['error'](0x1f4,_0x35e938[_0x85db('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index b8d1ff5..ef54fbe 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 _0xe54c=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','index','isAuthenticated','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','/:id','delete','destroy','exports'];(function(_0x36621a,_0x5642a3){var _0x247a1f=function(_0x5d92a8){while(--_0x5d92a8){_0x36621a['push'](_0x36621a['shift']());}};_0x247a1f(++_0x5642a3);}(_0xe54c,0xe7));var _0xce54=function(_0x39a71e,_0x128d6c){_0x39a71e=_0x39a71e-0x0;var _0x1d62fb=_0xe54c[_0x39a71e];return _0x1d62fb;};'use strict';var multer=require(_0xce54('0x0'));var util=require(_0xce54('0x1'));var path=require(_0xce54('0x2'));var timeout=require('connect-timeout');var express=require(_0xce54('0x3'));var router=express[_0xce54('0x4')]();var auth=require(_0xce54('0x5'));var interaction=require(_0xce54('0x6'));var config=require('../../config/environment');var controller=require(_0xce54('0x7'));router[_0xce54('0x8')]('/',auth['isAuthenticated'](),controller[_0xce54('0x9')]);router[_0xce54('0x8')]('/:id',auth[_0xce54('0xa')](),controller[_0xce54('0xb')]);router[_0xce54('0x8')](_0xce54('0xc'),auth['isAuthenticated'](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xce54('0xd')]);router[_0xce54('0x8')](_0xce54('0xe'),auth['isAuthenticated'](),controller[_0xce54('0xf')]);router[_0xce54('0x10')]('/',auth[_0xce54('0xa')](),controller['create']);router['put'](_0xce54('0x11'),auth[_0xce54('0xa')](),controller['update']);router[_0xce54('0x12')](_0xce54('0x11'),auth['isAuthenticated'](),controller[_0xce54('0x13')]);module[_0xce54('0x14')]=router; \ No newline at end of file +var _0xb0b7=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy'];(function(_0x75b7b5,_0x552802){var _0x142dfe=function(_0x357174){while(--_0x357174){_0x75b7b5['push'](_0x75b7b5['shift']());}};_0x142dfe(++_0x552802);}(_0xb0b7,0x114));var _0x7b0b=function(_0x3d2f87,_0xa9f93a){_0x3d2f87=_0x3d2f87-0x0;var _0x45e78c=_0xb0b7[_0x3d2f87];return _0x45e78c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7b0b('0x0'));var timeout=require(_0x7b0b('0x1'));var express=require(_0x7b0b('0x2'));var router=express[_0x7b0b('0x3')]();var auth=require(_0x7b0b('0x4'));var interaction=require(_0x7b0b('0x5'));var config=require(_0x7b0b('0x6'));var controller=require(_0x7b0b('0x7'));router[_0x7b0b('0x8')]('/',auth[_0x7b0b('0x9')](),controller[_0x7b0b('0xa')]);router[_0x7b0b('0x8')]('/:id',auth[_0x7b0b('0x9')](),controller[_0x7b0b('0xb')]);router[_0x7b0b('0x8')](_0x7b0b('0xc'),auth[_0x7b0b('0x9')](),controller['getFields']);router[_0x7b0b('0x8')](_0x7b0b('0xd'),auth[_0x7b0b('0x9')](),controller[_0x7b0b('0xe')]);router[_0x7b0b('0x8')](_0x7b0b('0xf'),auth[_0x7b0b('0x9')](),controller[_0x7b0b('0x10')]);router[_0x7b0b('0x11')]('/',auth[_0x7b0b('0x9')](),controller[_0x7b0b('0x12')]);router[_0x7b0b('0x13')](_0x7b0b('0x14'),auth[_0x7b0b('0x9')](),controller[_0x7b0b('0x15')]);router[_0x7b0b('0x16')](_0x7b0b('0x14'),auth[_0x7b0b('0x9')](),controller[_0x7b0b('0x17')]);module[_0x7b0b('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index bd61565..9bff782 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 _0x9a22=['lead','nothing','contact','sequelize','STRING','ENUM','Case','Task','contact_lead'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0x9a22,0xc9));var _0x29a2=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x9a22[_0x4b7b62];return _0x2280df;};'use strict';var Sequelize=require(_0x29a2('0x0'));module['exports']={'name':{'type':Sequelize[_0x29a2('0x1')]},'description':{'type':Sequelize[_0x29a2('0x1')]},'ticketType':{'type':Sequelize[_0x29a2('0x2')]('Task',_0x29a2('0x3')),'defaultValue':_0x29a2('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x29a2('0x5'),'contact',_0x29a2('0x6')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x29a2('0x2')](_0x29a2('0x7'),_0x29a2('0x8'),_0x29a2('0x6')),'defaultValue':'lead'}}; \ No newline at end of file +var _0xe543=['contact_lead','nothing','sequelize','exports','STRING','ENUM','Task','Case','contact','lead'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xe543,0xca));var _0x3e54=function(_0x15bdc8,_0x4ee8e4){_0x15bdc8=_0x15bdc8-0x0;var _0x57f6b6=_0xe543[_0x15bdc8];return _0x57f6b6;};'use strict';var Sequelize=require(_0x3e54('0x0'));module[_0x3e54('0x1')]={'name':{'type':Sequelize[_0x3e54('0x2')]},'description':{'type':Sequelize[_0x3e54('0x2')]},'ticketType':{'type':Sequelize[_0x3e54('0x3')](_0x3e54('0x4'),_0x3e54('0x5')),'defaultValue':_0x3e54('0x4')},'moduleSearch':{'type':Sequelize[_0x3e54('0x3')]('contact_lead',_0x3e54('0x6'),_0x3e54('0x7')),'defaultValue':_0x3e54('0x8')},'moduleCreate':{'type':Sequelize[_0x3e54('0x3')](_0x3e54('0x9'),_0x3e54('0x6'),_0x3e54('0x7')),'defaultValue':'lead'}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 2db561e..7964339 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 _0xc8d1=['debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','sendStatus','stack','name','index','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','includeAll','SalesforceConfiguration','findAll','rows','show','rawAttributes','include','options','find','create','update','body','params','getFields','findOne','merge','nolimit','SalesforceField','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xc8d1,0x1c1));var _0x1c8d=function(_0x5dc0de,_0x25bba4){_0x5dc0de=_0x5dc0de-0x0;var _0x54ba0e=_0xc8d1[_0x5dc0de];return _0x54ba0e;};'use strict';var pdf=require(_0x1c8d('0x0'));var emlformat=require(_0x1c8d('0x1'));var rimraf=require(_0x1c8d('0x2'));var zipdir=require(_0x1c8d('0x3'));var jsonpatch=require(_0x1c8d('0x4'));var rp=require(_0x1c8d('0x5'));var moment=require(_0x1c8d('0x6'));var BPromise=require(_0x1c8d('0x7'));var Mustache=require(_0x1c8d('0x8'));var util=require(_0x1c8d('0x9'));var path=require(_0x1c8d('0xa'));var sox=require('sox');var csv=require(_0x1c8d('0xb'));var ejs=require(_0x1c8d('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1c8d('0xd'));var crypto=require(_0x1c8d('0xe'));var jsforce=require(_0x1c8d('0xf'));var deskjs=require(_0x1c8d('0x10'));var toCsv=require(_0x1c8d('0xb'));var querystring=require(_0x1c8d('0x11'));var Papa=require(_0x1c8d('0x12'));var Redis=require(_0x1c8d('0x13'));var authService=require(_0x1c8d('0x14'));var qs=require(_0x1c8d('0x15'));var as=require(_0x1c8d('0x16'));var hardwareService=require(_0x1c8d('0x17'));var logger=require(_0x1c8d('0x18'))(_0x1c8d('0x19'));var utils=require(_0x1c8d('0x1a'));var config=require(_0x1c8d('0x1b'));var licenseUtil=require(_0x1c8d('0x1c'));var db=require(_0x1c8d('0x1d'))['db'];var jayson=require(_0x1c8d('0x1e'));var client=jayson[_0x1c8d('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6f1880,_0x56e640,_0x495f62,_0xfd3242){return new BPromise(function(_0x2c40b1,_0x3c9084){var _0xb45041=_0xfd3242||client;return _0xb45041[_0x1c8d('0x20')](_0x6f1880,_0x495f62)[_0x1c8d('0x21')](function(_0x4382bc){logger['info'](_0x1c8d('0x22'),_0x56e640,_0x1c8d('0x23'));logger[_0x1c8d('0x24')](_0x1c8d('0x25'),_0x56e640,_0x1c8d('0x23'),JSON[_0x1c8d('0x26')](_0x4382bc));if(_0x4382bc['error']){if(_0x4382bc[_0x1c8d('0x27')][_0x1c8d('0x28')]===0x1f4){logger[_0x1c8d('0x27')]('SalesforceConfiguration,\x20%s,\x20%s',_0x56e640,_0x4382bc[_0x1c8d('0x27')][_0x1c8d('0x29')]);return _0x3c9084(_0x4382bc[_0x1c8d('0x27')][_0x1c8d('0x29')]);}logger[_0x1c8d('0x27')](_0x1c8d('0x22'),_0x56e640,_0x4382bc[_0x1c8d('0x27')]['message']);return _0x2c40b1(_0x4382bc['error'][_0x1c8d('0x29')]);}else{logger[_0x1c8d('0x2a')](_0x1c8d('0x22'),_0x56e640,'request\x20sent');_0x2c40b1(_0x4382bc['result'][_0x1c8d('0x29')]);}})[_0x1c8d('0x2b')](function(_0x35a2cc){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x56e640,_0x35a2cc);_0x3c9084(_0x35a2cc);});});}function respondWithStatusCode(_0x461616,_0x109027){_0x109027=_0x109027||0xcc;return function(_0x870682){if(_0x870682){return _0x461616['sendStatus'](_0x109027);}return _0x461616['status'](_0x109027)[_0x1c8d('0x2c')]();};}function respondWithResult(_0x20e553,_0x360c44){_0x360c44=_0x360c44||0xc8;return function(_0x323b72){if(_0x323b72){return _0x20e553[_0x1c8d('0x2d')](_0x360c44)['json'](_0x323b72);}};}function respondWithFilteredResult(_0x58640e,_0x1c84fd){return function(_0x520555){if(_0x520555){var _0x3a5168=_0x520555[_0x1c8d('0x2e')],_0x38863c=_0x1c84fd[_0x1c8d('0x2f')],_0x32e64d=_0x1c84fd[_0x1c8d('0x2f')]+_0x1c84fd[_0x1c8d('0x30')],_0x23ef5b;if(_0x32e64d>=_0x3a5168){_0x32e64d=_0x3a5168;_0x23ef5b=0xc8;}else{_0x23ef5b=0xce;}_0x58640e[_0x1c8d('0x2d')](_0x23ef5b);return _0x58640e[_0x1c8d('0x31')](_0x1c8d('0x32'),_0x38863c+'-'+_0x32e64d+'/'+_0x3a5168)[_0x1c8d('0x33')](_0x520555);}return null;};}function patchUpdates(_0xeba9ce){return function(_0x12c061){try{jsonpatch[_0x1c8d('0x34')](_0x12c061,_0xeba9ce,!![]);}catch(_0x53ba57){return BPromise[_0x1c8d('0x35')](_0x53ba57);}return _0x12c061[_0x1c8d('0x36')]();};}function saveUpdates(_0x51c431,_0x1573da){return function(_0x308990){if(_0x308990){return _0x308990['update'](_0x51c431)[_0x1c8d('0x21')](function(_0x4c00b3){return _0x4c00b3;});}return null;};}function removeEntity(_0x35ae3b,_0x20820d){return function(_0x198504){if(_0x198504){return _0x198504[_0x1c8d('0x37')]()['then'](function(){_0x35ae3b[_0x1c8d('0x2d')](0xcc)[_0x1c8d('0x2c')]();});}};}function handleEntityNotFound(_0x4fb7c9,_0x3b3757){return function(_0x8d43ac){if(!_0x8d43ac){_0x4fb7c9[_0x1c8d('0x38')](0x194);}return _0x8d43ac;};}function handleError(_0x4dbb28,_0x14ef7b){_0x14ef7b=_0x14ef7b||0x1f4;return function(_0x38b9e1){logger['error'](_0x38b9e1[_0x1c8d('0x39')]);if(_0x38b9e1[_0x1c8d('0x3a')]){delete _0x38b9e1['name'];}_0x4dbb28[_0x1c8d('0x2d')](_0x14ef7b)['send'](_0x38b9e1);};}exports[_0x1c8d('0x3b')]=function(_0x3d79a8,_0x559ea1){var _0x42c0d3={},_0x6f9b24={},_0x412006={'count':0x0,'rows':[]};var _0x9436f7=_['map'](db['SalesforceConfiguration']['rawAttributes'],function(_0x5a033b){return{'name':_0x5a033b['fieldName'],'type':_0x5a033b[_0x1c8d('0x3c')]['key']};});_0x6f9b24[_0x1c8d('0x3d')]=_[_0x1c8d('0x3e')](_0x9436f7,_0x1c8d('0x3a'));_0x6f9b24['query']=_[_0x1c8d('0x3f')](_0x3d79a8[_0x1c8d('0x40')]);_0x6f9b24[_0x1c8d('0x41')]=_[_0x1c8d('0x42')](_0x6f9b24[_0x1c8d('0x3d')],_0x6f9b24['query']);_0x42c0d3[_0x1c8d('0x43')]=_['intersection'](_0x6f9b24[_0x1c8d('0x3d')],qs[_0x1c8d('0x44')](_0x3d79a8['query'][_0x1c8d('0x44')]));_0x42c0d3[_0x1c8d('0x43')]=_0x42c0d3[_0x1c8d('0x43')][_0x1c8d('0x45')]?_0x42c0d3[_0x1c8d('0x43')]:_0x6f9b24[_0x1c8d('0x3d')];if(!_0x3d79a8[_0x1c8d('0x40')][_0x1c8d('0x46')]('nolimit')){_0x42c0d3[_0x1c8d('0x30')]=qs['limit'](_0x3d79a8[_0x1c8d('0x40')][_0x1c8d('0x30')]);_0x42c0d3[_0x1c8d('0x2f')]=qs[_0x1c8d('0x2f')](_0x3d79a8[_0x1c8d('0x40')][_0x1c8d('0x2f')]);}_0x42c0d3[_0x1c8d('0x47')]=qs[_0x1c8d('0x48')](_0x3d79a8[_0x1c8d('0x40')]['sort']);_0x42c0d3['where']=qs[_0x1c8d('0x41')](_[_0x1c8d('0x49')](_0x3d79a8[_0x1c8d('0x40')],_0x6f9b24[_0x1c8d('0x41')]),_0x9436f7);if(_0x3d79a8['query'][_0x1c8d('0x4a')]){_0x42c0d3[_0x1c8d('0x4b')]=_['merge'](_0x42c0d3[_0x1c8d('0x4b')],{'$or':_[_0x1c8d('0x3e')](_0x9436f7,function(_0x12efb4){if(_0x12efb4['type']!==_0x1c8d('0x4c')){var _0x374930={};_0x374930[_0x12efb4[_0x1c8d('0x3a')]]={'$like':'%'+_0x3d79a8['query'][_0x1c8d('0x4a')]+'%'};return _0x374930;}})});}_0x42c0d3=_['merge']({},_0x42c0d3,_0x3d79a8['options']);var _0x46e90f={'where':_0x42c0d3[_0x1c8d('0x4b')]};return db['SalesforceConfiguration'][_0x1c8d('0x2e')](_0x46e90f)[_0x1c8d('0x21')](function(_0x4d615f){_0x412006[_0x1c8d('0x2e')]=_0x4d615f;if(_0x3d79a8[_0x1c8d('0x40')][_0x1c8d('0x4d')]){_0x42c0d3['include']=[{'all':!![]}];}return db[_0x1c8d('0x4e')][_0x1c8d('0x4f')](_0x42c0d3);})[_0x1c8d('0x21')](function(_0x527bae){_0x412006[_0x1c8d('0x50')]=_0x527bae;return _0x412006;})['then'](respondWithFilteredResult(_0x559ea1,_0x42c0d3))['catch'](handleError(_0x559ea1,null));};exports[_0x1c8d('0x51')]=function(_0x23aea9,_0x1a5c12){var _0x31ca41={'raw':![],'where':{'id':_0x23aea9['params']['id']}},_0x3b981d={};_0x3b981d['model']=_[_0x1c8d('0x3f')](db[_0x1c8d('0x4e')][_0x1c8d('0x52')]);_0x3b981d['query']=_[_0x1c8d('0x3f')](_0x23aea9[_0x1c8d('0x40')]);_0x3b981d[_0x1c8d('0x41')]=_[_0x1c8d('0x42')](_0x3b981d['model'],_0x3b981d[_0x1c8d('0x40')]);_0x31ca41['attributes']=_[_0x1c8d('0x42')](_0x3b981d[_0x1c8d('0x3d')],qs[_0x1c8d('0x44')](_0x23aea9[_0x1c8d('0x40')][_0x1c8d('0x44')]));_0x31ca41['attributes']=_0x31ca41['attributes'][_0x1c8d('0x45')]?_0x31ca41[_0x1c8d('0x43')]:_0x3b981d[_0x1c8d('0x3d')];if(_0x23aea9[_0x1c8d('0x40')][_0x1c8d('0x4d')]){_0x31ca41[_0x1c8d('0x53')]=[{'all':!![]}];}_0x31ca41=_['merge']({},_0x31ca41,_0x23aea9[_0x1c8d('0x54')]);return db[_0x1c8d('0x4e')][_0x1c8d('0x55')](_0x31ca41)[_0x1c8d('0x21')](handleEntityNotFound(_0x1a5c12,null))[_0x1c8d('0x21')](respondWithResult(_0x1a5c12,null))['catch'](handleError(_0x1a5c12,null));};exports[_0x1c8d('0x56')]=function(_0x52836c,_0x11315f){return db[_0x1c8d('0x4e')][_0x1c8d('0x56')](_0x52836c['body'],{})[_0x1c8d('0x21')](respondWithResult(_0x11315f,0xc9))[_0x1c8d('0x2b')](handleError(_0x11315f,null));};exports[_0x1c8d('0x57')]=function(_0x23cd1f,_0x4e01c){if(_0x23cd1f[_0x1c8d('0x58')]['id']){delete _0x23cd1f[_0x1c8d('0x58')]['id'];}return db[_0x1c8d('0x4e')]['find']({'where':{'id':_0x23cd1f[_0x1c8d('0x59')]['id']}})[_0x1c8d('0x21')](handleEntityNotFound(_0x4e01c,null))[_0x1c8d('0x21')](saveUpdates(_0x23cd1f[_0x1c8d('0x58')],null))[_0x1c8d('0x21')](respondWithResult(_0x4e01c,null))[_0x1c8d('0x2b')](handleError(_0x4e01c,null));};exports[_0x1c8d('0x37')]=function(_0x5b1085,_0x4d155a){return db[_0x1c8d('0x4e')][_0x1c8d('0x55')]({'where':{'id':_0x5b1085[_0x1c8d('0x59')]['id']}})[_0x1c8d('0x21')](handleEntityNotFound(_0x4d155a,null))['then'](removeEntity(_0x4d155a,null))['catch'](handleError(_0x4d155a,null));};exports[_0x1c8d('0x5a')]=function(_0x23e691,_0x136989,_0x3f8a90){var _0x5f4ac1={};var _0x4ad685={};var _0x994344;var _0x55ce56;return db[_0x1c8d('0x4e')][_0x1c8d('0x5b')]({'where':{'id':_0x23e691[_0x1c8d('0x59')]['id']}})[_0x1c8d('0x21')](handleEntityNotFound(_0x136989,null))[_0x1c8d('0x21')](function(_0x4fdcf6){if(_0x4fdcf6){_0x994344=_0x4fdcf6;_0x4ad685[_0x1c8d('0x3d')]=_[_0x1c8d('0x3f')](db['SalesforceField']['rawAttributes']);_0x4ad685['query']=_['keys'](_0x23e691[_0x1c8d('0x40')]);_0x4ad685[_0x1c8d('0x41')]=_[_0x1c8d('0x42')](_0x4ad685[_0x1c8d('0x3d')],_0x4ad685['query']);_0x5f4ac1[_0x1c8d('0x43')]=_[_0x1c8d('0x42')](_0x4ad685[_0x1c8d('0x3d')],qs[_0x1c8d('0x44')](_0x23e691[_0x1c8d('0x40')][_0x1c8d('0x44')]));_0x5f4ac1[_0x1c8d('0x43')]=_0x5f4ac1['attributes'][_0x1c8d('0x45')]?_0x5f4ac1[_0x1c8d('0x43')]:_0x4ad685['model'];_0x5f4ac1[_0x1c8d('0x47')]=qs[_0x1c8d('0x48')](_0x23e691[_0x1c8d('0x40')][_0x1c8d('0x48')]);_0x5f4ac1[_0x1c8d('0x4b')]=qs[_0x1c8d('0x41')](_[_0x1c8d('0x49')](_0x23e691[_0x1c8d('0x40')],_0x4ad685[_0x1c8d('0x41')]));if(_0x23e691[_0x1c8d('0x40')][_0x1c8d('0x4a')]){_0x5f4ac1[_0x1c8d('0x4b')]=_[_0x1c8d('0x5c')](_0x5f4ac1[_0x1c8d('0x4b')],{'$or':_[_0x1c8d('0x3e')](_0x5f4ac1[_0x1c8d('0x43')],function(_0x31c6f7){var _0x4394e1={};_0x4394e1[_0x31c6f7]={'$like':'%'+_0x23e691['query']['filter']+'%'};return _0x4394e1;})});}_0x5f4ac1=_[_0x1c8d('0x5c')]({},_0x5f4ac1,_0x23e691[_0x1c8d('0x54')]);return _0x994344[_0x1c8d('0x5a')](_0x5f4ac1);}})['then'](function(_0x21a8ee){if(_0x21a8ee){_0x55ce56=_0x21a8ee[_0x1c8d('0x45')];if(!_0x23e691[_0x1c8d('0x40')]['hasOwnProperty'](_0x1c8d('0x5d'))){_0x5f4ac1['limit']=qs[_0x1c8d('0x30')](_0x23e691[_0x1c8d('0x40')][_0x1c8d('0x30')]);_0x5f4ac1[_0x1c8d('0x2f')]=qs[_0x1c8d('0x2f')](_0x23e691[_0x1c8d('0x40')][_0x1c8d('0x2f')]);}return _0x994344[_0x1c8d('0x5a')](_0x5f4ac1);}})[_0x1c8d('0x21')](function(_0x3b9a0c){if(_0x3b9a0c){return _0x3b9a0c?{'count':_0x55ce56,'rows':_0x3b9a0c}:null;}})[_0x1c8d('0x21')](respondWithResult(_0x136989,null))[_0x1c8d('0x2b')](handleError(_0x136989,null));};exports['getSubjects']=function(_0x9b430c,_0x3443c7,_0x50b335){var _0x1c6344={};var _0xd2361b={};var _0x23836d;var _0x49e207;return db[_0x1c8d('0x4e')]['findOne']({'where':{'id':_0x9b430c[_0x1c8d('0x59')]['id']}})[_0x1c8d('0x21')](handleEntityNotFound(_0x3443c7,null))[_0x1c8d('0x21')](function(_0x4f43cb){if(_0x4f43cb){_0x23836d=_0x4f43cb;_0xd2361b['model']=_[_0x1c8d('0x3f')](db[_0x1c8d('0x5e')][_0x1c8d('0x52')]);_0xd2361b[_0x1c8d('0x40')]=_['keys'](_0x9b430c[_0x1c8d('0x40')]);_0xd2361b['filters']=_[_0x1c8d('0x42')](_0xd2361b[_0x1c8d('0x3d')],_0xd2361b[_0x1c8d('0x40')]);_0x1c6344[_0x1c8d('0x43')]=_[_0x1c8d('0x42')](_0xd2361b[_0x1c8d('0x3d')],qs['fields'](_0x9b430c['query'][_0x1c8d('0x44')]));_0x1c6344[_0x1c8d('0x43')]=_0x1c6344[_0x1c8d('0x43')][_0x1c8d('0x45')]?_0x1c6344[_0x1c8d('0x43')]:_0xd2361b[_0x1c8d('0x3d')];_0x1c6344[_0x1c8d('0x47')]=qs[_0x1c8d('0x48')](_0x9b430c['query'][_0x1c8d('0x48')]);_0x1c6344[_0x1c8d('0x4b')]=qs['filters'](_['pick'](_0x9b430c[_0x1c8d('0x40')],_0xd2361b[_0x1c8d('0x41')]));if(_0x9b430c[_0x1c8d('0x40')][_0x1c8d('0x4a')]){_0x1c6344[_0x1c8d('0x4b')]=_[_0x1c8d('0x5c')](_0x1c6344[_0x1c8d('0x4b')],{'$or':_[_0x1c8d('0x3e')](_0x1c6344[_0x1c8d('0x43')],function(_0x40b9c8){var _0x386dcc={};_0x386dcc[_0x40b9c8]={'$like':'%'+_0x9b430c[_0x1c8d('0x40')][_0x1c8d('0x4a')]+'%'};return _0x386dcc;})});}_0x1c6344=_[_0x1c8d('0x5c')]({},_0x1c6344,_0x9b430c[_0x1c8d('0x54')]);return _0x23836d[_0x1c8d('0x5f')](_0x1c6344);}})[_0x1c8d('0x21')](function(_0x1a4ff3){if(_0x1a4ff3){_0x49e207=_0x1a4ff3['length'];if(!_0x9b430c['query'][_0x1c8d('0x46')]('nolimit')){_0x1c6344['limit']=qs[_0x1c8d('0x30')](_0x9b430c[_0x1c8d('0x40')]['limit']);_0x1c6344[_0x1c8d('0x2f')]=qs[_0x1c8d('0x2f')](_0x9b430c[_0x1c8d('0x40')]['offset']);}return _0x23836d[_0x1c8d('0x5f')](_0x1c6344);}})['then'](function(_0x3be5c3){if(_0x3be5c3){return _0x3be5c3?{'count':_0x49e207,'rows':_0x3be5c3}:null;}})['then'](respondWithResult(_0x3443c7,null))[_0x1c8d('0x2b')](handleError(_0x3443c7,null));};exports['getDescriptions']=function(_0x6ab534,_0x4486c7,_0x484898){var _0x1ff19b={};var _0x2e3754={};var _0x35c90f;var _0x2d7701;return db['SalesforceConfiguration'][_0x1c8d('0x5b')]({'where':{'id':_0x6ab534[_0x1c8d('0x59')]['id']}})[_0x1c8d('0x21')](handleEntityNotFound(_0x4486c7,null))[_0x1c8d('0x21')](function(_0x2975b5){if(_0x2975b5){_0x35c90f=_0x2975b5;_0x2e3754[_0x1c8d('0x3d')]=_[_0x1c8d('0x3f')](db[_0x1c8d('0x5e')][_0x1c8d('0x52')]);_0x2e3754[_0x1c8d('0x40')]=_['keys'](_0x6ab534[_0x1c8d('0x40')]);_0x2e3754[_0x1c8d('0x41')]=_[_0x1c8d('0x42')](_0x2e3754['model'],_0x2e3754[_0x1c8d('0x40')]);_0x1ff19b['attributes']=_['intersection'](_0x2e3754['model'],qs[_0x1c8d('0x44')](_0x6ab534[_0x1c8d('0x40')][_0x1c8d('0x44')]));_0x1ff19b[_0x1c8d('0x43')]=_0x1ff19b[_0x1c8d('0x43')][_0x1c8d('0x45')]?_0x1ff19b[_0x1c8d('0x43')]:_0x2e3754[_0x1c8d('0x3d')];_0x1ff19b[_0x1c8d('0x47')]=qs[_0x1c8d('0x48')](_0x6ab534[_0x1c8d('0x40')][_0x1c8d('0x48')]);_0x1ff19b[_0x1c8d('0x4b')]=qs[_0x1c8d('0x41')](_['pick'](_0x6ab534['query'],_0x2e3754[_0x1c8d('0x41')]));if(_0x6ab534[_0x1c8d('0x40')][_0x1c8d('0x4a')]){_0x1ff19b[_0x1c8d('0x4b')]=_[_0x1c8d('0x5c')](_0x1ff19b[_0x1c8d('0x4b')],{'$or':_[_0x1c8d('0x3e')](_0x1ff19b[_0x1c8d('0x43')],function(_0x25b327){var _0x4c5d61={};_0x4c5d61[_0x25b327]={'$like':'%'+_0x6ab534[_0x1c8d('0x40')][_0x1c8d('0x4a')]+'%'};return _0x4c5d61;})});}_0x1ff19b=_[_0x1c8d('0x5c')]({},_0x1ff19b,_0x6ab534[_0x1c8d('0x54')]);return _0x35c90f[_0x1c8d('0x60')](_0x1ff19b);}})['then'](function(_0x533bc0){if(_0x533bc0){_0x2d7701=_0x533bc0['length'];if(!_0x6ab534[_0x1c8d('0x40')][_0x1c8d('0x46')]('nolimit')){_0x1ff19b[_0x1c8d('0x30')]=qs[_0x1c8d('0x30')](_0x6ab534['query']['limit']);_0x1ff19b[_0x1c8d('0x2f')]=qs['offset'](_0x6ab534[_0x1c8d('0x40')]['offset']);}return _0x35c90f[_0x1c8d('0x60')](_0x1ff19b);}})[_0x1c8d('0x21')](function(_0x370184){if(_0x370184){return _0x370184?{'count':_0x2d7701,'rows':_0x370184}:null;}})['then'](respondWithResult(_0x4486c7,null))['catch'](handleError(_0x4486c7,null));}; \ No newline at end of file +var _0xd846=['stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','params','length','find','create','update','body','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','request','info','SalesforceConfiguration,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','sendStatus','status','end','count','set','Content-Range','json','then','destroy'];(function(_0x528575,_0x2e067d){var _0x3063b7=function(_0x1ee183){while(--_0x1ee183){_0x528575['push'](_0x528575['shift']());}};_0x3063b7(++_0x2e067d);}(_0xd846,0xd4));var _0x6d84=function(_0x16d105,_0x550407){_0x16d105=_0x16d105-0x0;var _0x5091e5=_0xd846[_0x16d105];return _0x5091e5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6d84('0x0'));var rimraf=require(_0x6d84('0x1'));var zipdir=require(_0x6d84('0x2'));var jsonpatch=require(_0x6d84('0x3'));var rp=require(_0x6d84('0x4'));var moment=require('moment');var BPromise=require(_0x6d84('0x5'));var Mustache=require(_0x6d84('0x6'));var util=require(_0x6d84('0x7'));var path=require(_0x6d84('0x8'));var sox=require('sox');var csv=require(_0x6d84('0x9'));var ejs=require(_0x6d84('0xa'));var fs=require('fs');var _=require(_0x6d84('0xb'));var squel=require(_0x6d84('0xc'));var crypto=require('crypto');var jsforce=require(_0x6d84('0xd'));var deskjs=require(_0x6d84('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6d84('0xf'));var Redis=require('ioredis');var authService=require(_0x6d84('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6d84('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6d84('0x12'))(_0x6d84('0x13'));var utils=require(_0x6d84('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6d84('0x15'));var db=require(_0x6d84('0x16'))['db'];var jayson=require(_0x6d84('0x17'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x54dc8a,_0x23762b,_0x2f1504,_0x5c01cd){return new BPromise(function(_0x1033f5,_0x9ed970){var _0x19bead=_0x5c01cd||client;return _0x19bead[_0x6d84('0x18')](_0x54dc8a,_0x2f1504)['then'](function(_0x2e7d06){logger[_0x6d84('0x19')](_0x6d84('0x1a'),_0x23762b,'request\x20sent');logger[_0x6d84('0x1b')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x23762b,'request\x20sent',JSON[_0x6d84('0x1c')](_0x2e7d06));if(_0x2e7d06['error']){if(_0x2e7d06[_0x6d84('0x1d')][_0x6d84('0x1e')]===0x1f4){logger['error'](_0x6d84('0x1a'),_0x23762b,_0x2e7d06[_0x6d84('0x1d')]['message']);return _0x9ed970(_0x2e7d06[_0x6d84('0x1d')][_0x6d84('0x1f')]);}logger[_0x6d84('0x1d')](_0x6d84('0x1a'),_0x23762b,_0x2e7d06[_0x6d84('0x1d')]['message']);return _0x1033f5(_0x2e7d06[_0x6d84('0x1d')][_0x6d84('0x1f')]);}else{logger['info'](_0x6d84('0x1a'),_0x23762b,'request\x20sent');_0x1033f5(_0x2e7d06[_0x6d84('0x20')][_0x6d84('0x1f')]);}})[_0x6d84('0x21')](function(_0x45faec){logger[_0x6d84('0x1d')]('SalesforceConfiguration,\x20%s,\x20%s',_0x23762b,_0x45faec);_0x9ed970(_0x45faec);});});}function respondWithStatusCode(_0x1a8b59,_0x213d1e){_0x213d1e=_0x213d1e||0xcc;return function(_0x45c408){if(_0x45c408){return _0x1a8b59[_0x6d84('0x22')](_0x213d1e);}return _0x1a8b59[_0x6d84('0x23')](_0x213d1e)[_0x6d84('0x24')]();};}function respondWithResult(_0x268669,_0x3a6f2a){_0x3a6f2a=_0x3a6f2a||0xc8;return function(_0x3864f5){if(_0x3864f5){return _0x268669[_0x6d84('0x23')](_0x3a6f2a)['json'](_0x3864f5);}};}function respondWithFilteredResult(_0x246fbb,_0x46461c){return function(_0x5c136d){if(_0x5c136d){var _0x5b2ab8=_0x5c136d[_0x6d84('0x25')],_0x44c8cb=_0x46461c['offset'],_0x5b312a=_0x46461c['offset']+_0x46461c['limit'],_0x5d4e9b;if(_0x5b312a>=_0x5b2ab8){_0x5b312a=_0x5b2ab8;_0x5d4e9b=0xc8;}else{_0x5d4e9b=0xce;}_0x246fbb[_0x6d84('0x23')](_0x5d4e9b);return _0x246fbb[_0x6d84('0x26')](_0x6d84('0x27'),_0x44c8cb+'-'+_0x5b312a+'/'+_0x5b2ab8)[_0x6d84('0x28')](_0x5c136d);}return null;};}function patchUpdates(_0xa16fb6){return function(_0x428d57){try{jsonpatch['apply'](_0x428d57,_0xa16fb6,!![]);}catch(_0x1af70a){return BPromise['reject'](_0x1af70a);}return _0x428d57['save']();};}function saveUpdates(_0x19359e,_0xe2fab){return function(_0xb871c3){if(_0xb871c3){return _0xb871c3['update'](_0x19359e)[_0x6d84('0x29')](function(_0x2bfee0){return _0x2bfee0;});}return null;};}function removeEntity(_0x5529e9,_0x873494){return function(_0x4213b9){if(_0x4213b9){return _0x4213b9[_0x6d84('0x2a')]()[_0x6d84('0x29')](function(){_0x5529e9['status'](0xcc)[_0x6d84('0x24')]();});}};}function handleEntityNotFound(_0x29f21b,_0x2b5f62){return function(_0x556a1b){if(!_0x556a1b){_0x29f21b['sendStatus'](0x194);}return _0x556a1b;};}function handleError(_0x53191c,_0x1a6449){_0x1a6449=_0x1a6449||0x1f4;return function(_0x4e9ca4){logger[_0x6d84('0x1d')](_0x4e9ca4[_0x6d84('0x2b')]);if(_0x4e9ca4[_0x6d84('0x2c')]){delete _0x4e9ca4[_0x6d84('0x2c')];}_0x53191c['status'](_0x1a6449)[_0x6d84('0x2d')](_0x4e9ca4);};}exports[_0x6d84('0x2e')]=function(_0x1effc3,_0x3643b2){var _0x162cf8={},_0x4340b2={},_0x352155={'count':0x0,'rows':[]};var _0x209d96=_[_0x6d84('0x2f')](db[_0x6d84('0x30')][_0x6d84('0x31')],function(_0x514e1f){return{'name':_0x514e1f[_0x6d84('0x32')],'type':_0x514e1f[_0x6d84('0x33')][_0x6d84('0x34')]};});_0x4340b2[_0x6d84('0x35')]=_['map'](_0x209d96,_0x6d84('0x2c'));_0x4340b2[_0x6d84('0x36')]=_[_0x6d84('0x37')](_0x1effc3[_0x6d84('0x36')]);_0x4340b2[_0x6d84('0x38')]=_[_0x6d84('0x39')](_0x4340b2['model'],_0x4340b2[_0x6d84('0x36')]);_0x162cf8[_0x6d84('0x3a')]=_[_0x6d84('0x39')](_0x4340b2[_0x6d84('0x35')],qs[_0x6d84('0x3b')](_0x1effc3['query'][_0x6d84('0x3b')]));_0x162cf8[_0x6d84('0x3a')]=_0x162cf8[_0x6d84('0x3a')]['length']?_0x162cf8[_0x6d84('0x3a')]:_0x4340b2['model'];if(!_0x1effc3[_0x6d84('0x36')][_0x6d84('0x3c')](_0x6d84('0x3d'))){_0x162cf8['limit']=qs[_0x6d84('0x3e')](_0x1effc3['query']['limit']);_0x162cf8[_0x6d84('0x3f')]=qs[_0x6d84('0x3f')](_0x1effc3[_0x6d84('0x36')][_0x6d84('0x3f')]);}_0x162cf8[_0x6d84('0x40')]=qs['sort'](_0x1effc3['query'][_0x6d84('0x41')]);_0x162cf8['where']=qs[_0x6d84('0x38')](_[_0x6d84('0x42')](_0x1effc3['query'],_0x4340b2[_0x6d84('0x38')]),_0x209d96);if(_0x1effc3[_0x6d84('0x36')][_0x6d84('0x43')]){_0x162cf8[_0x6d84('0x44')]=_[_0x6d84('0x45')](_0x162cf8[_0x6d84('0x44')],{'$or':_[_0x6d84('0x2f')](_0x209d96,function(_0x2e02a8){if(_0x2e02a8[_0x6d84('0x33')]!=='VIRTUAL'){var _0x172ebd={};_0x172ebd[_0x2e02a8[_0x6d84('0x2c')]]={'$like':'%'+_0x1effc3[_0x6d84('0x36')][_0x6d84('0x43')]+'%'};return _0x172ebd;}})});}_0x162cf8=_[_0x6d84('0x45')]({},_0x162cf8,_0x1effc3[_0x6d84('0x46')]);var _0x2b5036={'where':_0x162cf8[_0x6d84('0x44')]};return db[_0x6d84('0x30')][_0x6d84('0x25')](_0x2b5036)[_0x6d84('0x29')](function(_0x2bff0f){_0x352155[_0x6d84('0x25')]=_0x2bff0f;if(_0x1effc3['query'][_0x6d84('0x47')]){_0x162cf8[_0x6d84('0x48')]=[{'all':!![]}];}return db[_0x6d84('0x30')][_0x6d84('0x49')](_0x162cf8);})['then'](function(_0x3dc668){_0x352155[_0x6d84('0x4a')]=_0x3dc668;return _0x352155;})[_0x6d84('0x29')](respondWithFilteredResult(_0x3643b2,_0x162cf8))[_0x6d84('0x21')](handleError(_0x3643b2,null));};exports['show']=function(_0x3d83e7,_0x3bb12a){var _0x5df541={'raw':![],'where':{'id':_0x3d83e7[_0x6d84('0x4b')]['id']}},_0x526dc1={};_0x526dc1[_0x6d84('0x35')]=_[_0x6d84('0x37')](db[_0x6d84('0x30')][_0x6d84('0x31')]);_0x526dc1['query']=_[_0x6d84('0x37')](_0x3d83e7[_0x6d84('0x36')]);_0x526dc1[_0x6d84('0x38')]=_[_0x6d84('0x39')](_0x526dc1['model'],_0x526dc1[_0x6d84('0x36')]);_0x5df541['attributes']=_[_0x6d84('0x39')](_0x526dc1[_0x6d84('0x35')],qs[_0x6d84('0x3b')](_0x3d83e7['query'][_0x6d84('0x3b')]));_0x5df541[_0x6d84('0x3a')]=_0x5df541[_0x6d84('0x3a')][_0x6d84('0x4c')]?_0x5df541['attributes']:_0x526dc1[_0x6d84('0x35')];if(_0x3d83e7[_0x6d84('0x36')]['includeAll']){_0x5df541[_0x6d84('0x48')]=[{'all':!![]}];}_0x5df541=_['merge']({},_0x5df541,_0x3d83e7[_0x6d84('0x46')]);return db[_0x6d84('0x30')][_0x6d84('0x4d')](_0x5df541)[_0x6d84('0x29')](handleEntityNotFound(_0x3bb12a,null))['then'](respondWithResult(_0x3bb12a,null))[_0x6d84('0x21')](handleError(_0x3bb12a,null));};exports['create']=function(_0x1c3f1a,_0x6b0ab){return db[_0x6d84('0x30')][_0x6d84('0x4e')](_0x1c3f1a['body'],{})[_0x6d84('0x29')](respondWithResult(_0x6b0ab,0xc9))[_0x6d84('0x21')](handleError(_0x6b0ab,null));};exports[_0x6d84('0x4f')]=function(_0x46454e,_0x538199){if(_0x46454e[_0x6d84('0x50')]['id']){delete _0x46454e[_0x6d84('0x50')]['id'];}return db[_0x6d84('0x30')][_0x6d84('0x4d')]({'where':{'id':_0x46454e['params']['id']}})['then'](handleEntityNotFound(_0x538199,null))[_0x6d84('0x29')](saveUpdates(_0x46454e[_0x6d84('0x50')],null))[_0x6d84('0x29')](respondWithResult(_0x538199,null))[_0x6d84('0x21')](handleError(_0x538199,null));};exports[_0x6d84('0x2a')]=function(_0x190dca,_0x2b77f5){return db['SalesforceConfiguration'][_0x6d84('0x4d')]({'where':{'id':_0x190dca['params']['id']}})[_0x6d84('0x29')](handleEntityNotFound(_0x2b77f5,null))[_0x6d84('0x29')](removeEntity(_0x2b77f5,null))[_0x6d84('0x21')](handleError(_0x2b77f5,null));};exports['getFields']=function(_0x345230,_0x32226b,_0x3b3380){var _0x1a02d2={};var _0x20d5ba={};var _0xa1202a;var _0x14b365;return db['SalesforceConfiguration'][_0x6d84('0x51')]({'where':{'id':_0x345230[_0x6d84('0x4b')]['id']}})[_0x6d84('0x29')](handleEntityNotFound(_0x32226b,null))[_0x6d84('0x29')](function(_0x39ae54){if(_0x39ae54){_0xa1202a=_0x39ae54;_0x20d5ba[_0x6d84('0x35')]=_[_0x6d84('0x37')](db[_0x6d84('0x52')]['rawAttributes']);_0x20d5ba['query']=_[_0x6d84('0x37')](_0x345230[_0x6d84('0x36')]);_0x20d5ba[_0x6d84('0x38')]=_[_0x6d84('0x39')](_0x20d5ba[_0x6d84('0x35')],_0x20d5ba[_0x6d84('0x36')]);_0x1a02d2[_0x6d84('0x3a')]=_[_0x6d84('0x39')](_0x20d5ba[_0x6d84('0x35')],qs[_0x6d84('0x3b')](_0x345230['query'][_0x6d84('0x3b')]));_0x1a02d2[_0x6d84('0x3a')]=_0x1a02d2[_0x6d84('0x3a')][_0x6d84('0x4c')]?_0x1a02d2[_0x6d84('0x3a')]:_0x20d5ba[_0x6d84('0x35')];_0x1a02d2[_0x6d84('0x40')]=qs['sort'](_0x345230[_0x6d84('0x36')][_0x6d84('0x41')]);_0x1a02d2[_0x6d84('0x44')]=qs[_0x6d84('0x38')](_[_0x6d84('0x42')](_0x345230['query'],_0x20d5ba[_0x6d84('0x38')]));if(_0x345230[_0x6d84('0x36')]['filter']){_0x1a02d2[_0x6d84('0x44')]=_[_0x6d84('0x45')](_0x1a02d2['where'],{'$or':_[_0x6d84('0x2f')](_0x1a02d2[_0x6d84('0x3a')],function(_0x9b2e5b){var _0x490247={};_0x490247[_0x9b2e5b]={'$like':'%'+_0x345230[_0x6d84('0x36')]['filter']+'%'};return _0x490247;})});}_0x1a02d2=_[_0x6d84('0x45')]({},_0x1a02d2,_0x345230[_0x6d84('0x46')]);return _0xa1202a['getFields'](_0x1a02d2);}})[_0x6d84('0x29')](function(_0x11354){if(_0x11354){_0x14b365=_0x11354['length'];if(!_0x345230[_0x6d84('0x36')]['hasOwnProperty'](_0x6d84('0x3d'))){_0x1a02d2[_0x6d84('0x3e')]=qs[_0x6d84('0x3e')](_0x345230[_0x6d84('0x36')][_0x6d84('0x3e')]);_0x1a02d2['offset']=qs['offset'](_0x345230[_0x6d84('0x36')][_0x6d84('0x3f')]);}return _0xa1202a['getFields'](_0x1a02d2);}})[_0x6d84('0x29')](function(_0x4895af){if(_0x4895af){return _0x4895af?{'count':_0x14b365,'rows':_0x4895af}:null;}})[_0x6d84('0x29')](respondWithResult(_0x32226b,null))[_0x6d84('0x21')](handleError(_0x32226b,null));};exports[_0x6d84('0x53')]=function(_0x87627f,_0x565e7a,_0x507e47){var _0x39e890={};var _0x525f04={};var _0x16d134;var _0x380e2a;return db['SalesforceConfiguration'][_0x6d84('0x51')]({'where':{'id':_0x87627f[_0x6d84('0x4b')]['id']}})[_0x6d84('0x29')](handleEntityNotFound(_0x565e7a,null))[_0x6d84('0x29')](function(_0x1200f4){if(_0x1200f4){_0x16d134=_0x1200f4;_0x525f04[_0x6d84('0x35')]=_[_0x6d84('0x37')](db[_0x6d84('0x52')][_0x6d84('0x31')]);_0x525f04[_0x6d84('0x36')]=_['keys'](_0x87627f['query']);_0x525f04[_0x6d84('0x38')]=_[_0x6d84('0x39')](_0x525f04[_0x6d84('0x35')],_0x525f04[_0x6d84('0x36')]);_0x39e890[_0x6d84('0x3a')]=_[_0x6d84('0x39')](_0x525f04[_0x6d84('0x35')],qs['fields'](_0x87627f[_0x6d84('0x36')]['fields']));_0x39e890[_0x6d84('0x3a')]=_0x39e890['attributes'][_0x6d84('0x4c')]?_0x39e890[_0x6d84('0x3a')]:_0x525f04[_0x6d84('0x35')];_0x39e890['order']=qs['sort'](_0x87627f[_0x6d84('0x36')][_0x6d84('0x41')]);_0x39e890[_0x6d84('0x44')]=qs[_0x6d84('0x38')](_[_0x6d84('0x42')](_0x87627f['query'],_0x525f04[_0x6d84('0x38')]));if(_0x87627f[_0x6d84('0x36')][_0x6d84('0x43')]){_0x39e890['where']=_[_0x6d84('0x45')](_0x39e890[_0x6d84('0x44')],{'$or':_[_0x6d84('0x2f')](_0x39e890[_0x6d84('0x3a')],function(_0x14aee7){var _0xd2e8da={};_0xd2e8da[_0x14aee7]={'$like':'%'+_0x87627f['query']['filter']+'%'};return _0xd2e8da;})});}_0x39e890=_[_0x6d84('0x45')]({},_0x39e890,_0x87627f[_0x6d84('0x46')]);return _0x16d134[_0x6d84('0x53')](_0x39e890);}})[_0x6d84('0x29')](function(_0x2b2159){if(_0x2b2159){_0x380e2a=_0x2b2159[_0x6d84('0x4c')];if(!_0x87627f[_0x6d84('0x36')][_0x6d84('0x3c')]('nolimit')){_0x39e890[_0x6d84('0x3e')]=qs['limit'](_0x87627f[_0x6d84('0x36')][_0x6d84('0x3e')]);_0x39e890[_0x6d84('0x3f')]=qs[_0x6d84('0x3f')](_0x87627f[_0x6d84('0x36')][_0x6d84('0x3f')]);}return _0x16d134['getSubjects'](_0x39e890);}})[_0x6d84('0x29')](function(_0x8629e0){if(_0x8629e0){return _0x8629e0?{'count':_0x380e2a,'rows':_0x8629e0}:null;}})[_0x6d84('0x29')](respondWithResult(_0x565e7a,null))[_0x6d84('0x21')](handleError(_0x565e7a,null));};exports[_0x6d84('0x54')]=function(_0x4454da,_0x52dbbb,_0x2c8873){var _0xa5e44e={};var _0x4768a6={};var _0x2aa2c8;var _0x59d0fe;return db[_0x6d84('0x30')]['findOne']({'where':{'id':_0x4454da['params']['id']}})[_0x6d84('0x29')](handleEntityNotFound(_0x52dbbb,null))[_0x6d84('0x29')](function(_0x6468bd){if(_0x6468bd){_0x2aa2c8=_0x6468bd;_0x4768a6[_0x6d84('0x35')]=_['keys'](db['SalesforceField'][_0x6d84('0x31')]);_0x4768a6['query']=_[_0x6d84('0x37')](_0x4454da[_0x6d84('0x36')]);_0x4768a6[_0x6d84('0x38')]=_[_0x6d84('0x39')](_0x4768a6[_0x6d84('0x35')],_0x4768a6['query']);_0xa5e44e['attributes']=_[_0x6d84('0x39')](_0x4768a6[_0x6d84('0x35')],qs[_0x6d84('0x3b')](_0x4454da[_0x6d84('0x36')][_0x6d84('0x3b')]));_0xa5e44e['attributes']=_0xa5e44e['attributes']['length']?_0xa5e44e[_0x6d84('0x3a')]:_0x4768a6[_0x6d84('0x35')];_0xa5e44e[_0x6d84('0x40')]=qs[_0x6d84('0x41')](_0x4454da['query'][_0x6d84('0x41')]);_0xa5e44e[_0x6d84('0x44')]=qs[_0x6d84('0x38')](_[_0x6d84('0x42')](_0x4454da['query'],_0x4768a6[_0x6d84('0x38')]));if(_0x4454da[_0x6d84('0x36')][_0x6d84('0x43')]){_0xa5e44e[_0x6d84('0x44')]=_[_0x6d84('0x45')](_0xa5e44e[_0x6d84('0x44')],{'$or':_[_0x6d84('0x2f')](_0xa5e44e[_0x6d84('0x3a')],function(_0x10ca98){var _0x3927ed={};_0x3927ed[_0x10ca98]={'$like':'%'+_0x4454da['query'][_0x6d84('0x43')]+'%'};return _0x3927ed;})});}_0xa5e44e=_[_0x6d84('0x45')]({},_0xa5e44e,_0x4454da['options']);return _0x2aa2c8[_0x6d84('0x54')](_0xa5e44e);}})[_0x6d84('0x29')](function(_0x221082){if(_0x221082){_0x59d0fe=_0x221082['length'];if(!_0x4454da['query'][_0x6d84('0x3c')](_0x6d84('0x3d'))){_0xa5e44e[_0x6d84('0x3e')]=qs[_0x6d84('0x3e')](_0x4454da[_0x6d84('0x36')]['limit']);_0xa5e44e[_0x6d84('0x3f')]=qs['offset'](_0x4454da[_0x6d84('0x36')][_0x6d84('0x3f')]);}return _0x2aa2c8['getDescriptions'](_0xa5e44e);}})[_0x6d84('0x29')](function(_0x1d362e){if(_0x1d362e){return _0x1d362e?{'count':_0x59d0fe,'rows':_0x1d362e}:null;}})[_0x6d84('0x29')](respondWithResult(_0x52dbbb,null))[_0x6d84('0x21')](handleError(_0x52dbbb,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index a4cc954..ea0b1b4 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 _0x8586=['define','int_salesforce_configurations','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports'];(function(_0x572e14,_0x3618ce){var _0x4715d1=function(_0x4723dd){while(--_0x4723dd){_0x572e14['push'](_0x572e14['shift']());}};_0x4715d1(++_0x3618ce);}(_0x8586,0x124));var _0x6858=function(_0x41382c,_0xc3ffd1){_0x41382c=_0x41382c-0x0;var _0x4da35b=_0x8586[_0x41382c];return _0x4da35b;};'use strict';var _=require('lodash');var util=require(_0x6858('0x0'));var logger=require(_0x6858('0x1'))(_0x6858('0x2'));var moment=require(_0x6858('0x3'));var BPromise=require('bluebird');var rp=require(_0x6858('0x4'));var fs=require('fs');var path=require(_0x6858('0x5'));var rimraf=require('rimraf');var config=require(_0x6858('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x6858('0x7')]=function(_0x9640ed,_0x54ec31){return _0x9640ed[_0x6858('0x8')]('SalesforceConfiguration',attributes,{'tableName':_0x6858('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8dda=['exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes'];(function(_0x539b13,_0x3dd6cd){var _0x379788=function(_0x5b2d45){while(--_0x5b2d45){_0x539b13['push'](_0x539b13['shift']());}};_0x379788(++_0x3dd6cd);}(_0x8dda,0xba));var _0xa8dd=function(_0x5f1c59,_0x3fff4c){_0x5f1c59=_0x5f1c59-0x0;var _0xbfb242=_0x8dda[_0x5f1c59];return _0xbfb242;};'use strict';var _=require(_0xa8dd('0x0'));var util=require(_0xa8dd('0x1'));var logger=require(_0xa8dd('0x2'))(_0xa8dd('0x3'));var moment=require('moment');var BPromise=require(_0xa8dd('0x4'));var rp=require(_0xa8dd('0x5'));var fs=require('fs');var path=require(_0xa8dd('0x6'));var rimraf=require('rimraf');var config=require(_0xa8dd('0x7'));var attributes=require(_0xa8dd('0x8'));module[_0xa8dd('0x9')]=function(_0x454d92,_0x2bd5a5){return _0x454d92[_0xa8dd('0xa')](_0xa8dd('0xb'),attributes,{'tableName':_0xa8dd('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 15769f7..80ce551 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 _0x9c7a=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result'];(function(_0x322719,_0x16b381){var _0x30cb6f=function(_0x1e5698){while(--_0x1e5698){_0x322719['push'](_0x322719['shift']());}};_0x30cb6f(++_0x16b381);}(_0x9c7a,0x18c));var _0xa9c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c7a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa9c7('0x0'));var util=require(_0xa9c7('0x1'));var moment=require(_0xa9c7('0x2'));var BPromise=require('bluebird');var rs=require(_0xa9c7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa9c7('0x4'))['db'];var utils=require(_0xa9c7('0x5'));var logger=require(_0xa9c7('0x6'))(_0xa9c7('0x7'));var config=require(_0xa9c7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa9c7('0x9')][_0xa9c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc112af,_0x35b7f4,_0x4e0e25){return new BPromise(function(_0x11b0e1,_0x1af024){return client[_0xa9c7('0xb')](_0xc112af,_0x4e0e25)[_0xa9c7('0xc')](function(_0x1d633f){logger[_0xa9c7('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x35b7f4,'request\x20sent');logger[_0xa9c7('0xe')](_0xa9c7('0xf'),_0x35b7f4,_0xa9c7('0x10'),JSON['stringify'](_0x1d633f));if(_0x1d633f[_0xa9c7('0x11')]){if(_0x1d633f[_0xa9c7('0x11')][_0xa9c7('0x12')]===0x1f4){logger[_0xa9c7('0x11')](_0xa9c7('0x13'),_0x35b7f4,_0x1d633f[_0xa9c7('0x11')]['message']);return _0x1af024(_0x1d633f[_0xa9c7('0x11')][_0xa9c7('0x14')]);}logger['error'](_0xa9c7('0x13'),_0x35b7f4,_0x1d633f['error'][_0xa9c7('0x14')]);return _0x11b0e1(_0x1d633f[_0xa9c7('0x11')][_0xa9c7('0x14')]);}else{logger[_0xa9c7('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x35b7f4,'request\x20sent');_0x11b0e1(_0x1d633f[_0xa9c7('0x15')][_0xa9c7('0x14')]);}})['catch'](function(_0x4deabb){logger[_0xa9c7('0x11')](_0xa9c7('0x13'),_0x35b7f4,_0x4deabb);_0x1af024(_0x4deabb);});});} \ No newline at end of file +var _0xa7f2=['info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x2353ef,_0x4d4b48){var _0x2759cb=function(_0x35ed9e){while(--_0x35ed9e){_0x2353ef['push'](_0x2353ef['shift']());}};_0x2759cb(++_0x4d4b48);}(_0xa7f2,0xb1));var _0x2a7f=function(_0x5959c9,_0x2ed153){_0x5959c9=_0x5959c9-0x0;var _0x4ffcbc=_0xa7f2[_0x5959c9];return _0x4ffcbc;};'use strict';var _=require(_0x2a7f('0x0'));var util=require(_0x2a7f('0x1'));var moment=require(_0x2a7f('0x2'));var BPromise=require(_0x2a7f('0x3'));var rs=require(_0x2a7f('0x4'));var fs=require('fs');var Redis=require(_0x2a7f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2a7f('0x6'));var logger=require(_0x2a7f('0x7'))('rpc');var config=require(_0x2a7f('0x8'));var jayson=require(_0x2a7f('0x9'));var client=jayson[_0x2a7f('0xa')][_0x2a7f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3210d4,_0x4c842b,_0x3d99d0){return new BPromise(function(_0x114b06,_0xd9f23){return client['request'](_0x3210d4,_0x3d99d0)['then'](function(_0x51ef77){logger[_0x2a7f('0xc')](_0x2a7f('0xd'),_0x4c842b,_0x2a7f('0xe'));logger[_0x2a7f('0xf')](_0x2a7f('0x10'),_0x4c842b,'request\x20sent',JSON['stringify'](_0x51ef77));if(_0x51ef77['error']){if(_0x51ef77[_0x2a7f('0x11')][_0x2a7f('0x12')]===0x1f4){logger[_0x2a7f('0x11')](_0x2a7f('0xd'),_0x4c842b,_0x51ef77[_0x2a7f('0x11')][_0x2a7f('0x13')]);return _0xd9f23(_0x51ef77[_0x2a7f('0x11')][_0x2a7f('0x13')]);}logger[_0x2a7f('0x11')](_0x2a7f('0xd'),_0x4c842b,_0x51ef77[_0x2a7f('0x11')][_0x2a7f('0x13')]);return _0x114b06(_0x51ef77['error'][_0x2a7f('0x13')]);}else{logger[_0x2a7f('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4c842b,_0x2a7f('0xe'));_0x114b06(_0x51ef77[_0x2a7f('0x14')][_0x2a7f('0x13')]);}})['catch'](function(_0x5eb8af){logger[_0x2a7f('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4c842b,_0x5eb8af);_0xd9f23(_0x5eb8af);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 3b81ec2..cae2115 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 _0xa6b0=['../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x547fd7,_0x4a6c18){_0x547fd7=_0x547fd7-0x0;var _0x24bed7=_0xa6b0[_0x547fd7];return _0x24bed7;};'use strict';var multer=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a6b('0x2'));var router=express[_0x0a6b('0x3')]();var auth=require(_0x0a6b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0a6b('0x5'));var controller=require(_0x0a6b('0x6'));router[_0x0a6b('0x7')]('/',auth[_0x0a6b('0x8')](),controller[_0x0a6b('0x9')]);router[_0x0a6b('0x7')](_0x0a6b('0xa'),auth[_0x0a6b('0x8')](),controller[_0x0a6b('0xb')]);router[_0x0a6b('0xc')]('/',auth[_0x0a6b('0x8')](),controller[_0x0a6b('0xd')]);router['put']('/:id',auth[_0x0a6b('0x8')](),controller[_0x0a6b('0xe')]);router[_0x0a6b('0xf')](_0x0a6b('0xa'),auth[_0x0a6b('0x8')](),controller[_0x0a6b('0x10')]);module[_0x0a6b('0x11')]=router; \ No newline at end of file +var _0x81c6=['index','/:id','create','put','update','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated'];(function(_0x5cc3d4,_0xbcbf9b){var _0x17ca31=function(_0x5dbd6d){while(--_0x5dbd6d){_0x5cc3d4['push'](_0x5cc3d4['shift']());}};_0x17ca31(++_0xbcbf9b);}(_0x81c6,0x1d5));var _0x681c=function(_0x564dff,_0x32bdc5){_0x564dff=_0x564dff-0x0;var _0x283988=_0x81c6[_0x564dff];return _0x283988;};'use strict';var multer=require('multer');var util=require(_0x681c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x681c('0x1')]();var auth=require(_0x681c('0x2'));var interaction=require(_0x681c('0x3'));var config=require('../../config/environment');var controller=require(_0x681c('0x4'));router[_0x681c('0x5')]('/',auth[_0x681c('0x6')](),controller[_0x681c('0x7')]);router['get'](_0x681c('0x8'),auth[_0x681c('0x6')](),controller['show']);router['post']('/',auth[_0x681c('0x6')](),controller[_0x681c('0x9')]);router[_0x681c('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x681c('0xb')]);router['delete'](_0x681c('0x8'),auth[_0x681c('0x6')](),controller[_0x681c('0xc')]);module[_0x681c('0xd')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index e1f9afa..aa6f291 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 _0x7c3a=['ENUM','string','variable','keyValue','STRING','customVariable','sequelize','exports'];(function(_0x1eca3b,_0x2a648c){var _0x30d1af=function(_0x16a5aa){while(--_0x16a5aa){_0x1eca3b['push'](_0x1eca3b['shift']());}};_0x30d1af(++_0x2a648c);}(_0x7c3a,0x16e));var _0xa7c3=function(_0x292f93,_0x2c6e8e){_0x292f93=_0x292f93-0x0;var _0x5a94b1=_0x7c3a[_0x292f93];return _0x5a94b1;};'use strict';var Sequelize=require(_0xa7c3('0x0'));module[_0xa7c3('0x1')]={'type':{'type':Sequelize[_0xa7c3('0x2')](_0xa7c3('0x3'),_0xa7c3('0x4'),'customVariable',_0xa7c3('0x5')),'defaultValue':_0xa7c3('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa7c3('0x6')]},'keyType':{'type':Sequelize[_0xa7c3('0x2')](_0xa7c3('0x3'),_0xa7c3('0x4'),_0xa7c3('0x7'))},'keyContent':{'type':Sequelize[_0xa7c3('0x6')]},'idField':{'type':Sequelize[_0xa7c3('0x6')]},'variableName':{'type':Sequelize[_0xa7c3('0x6')]}}; \ No newline at end of file +var _0x3968=['ENUM','string','variable','customVariable','STRING','sequelize'];(function(_0x246148,_0x1358ee){var _0x453d94=function(_0x59920e){while(--_0x59920e){_0x246148['push'](_0x246148['shift']());}};_0x453d94(++_0x1358ee);}(_0x3968,0xdd));var _0x8396=function(_0x1a48a0,_0x3c95f5){_0x1a48a0=_0x1a48a0-0x0;var _0x269714=_0x3968[_0x1a48a0];return _0x269714;};'use strict';var Sequelize=require(_0x8396('0x0'));module['exports']={'type':{'type':Sequelize[_0x8396('0x1')](_0x8396('0x2'),_0x8396('0x3'),_0x8396('0x4'),'keyValue'),'defaultValue':_0x8396('0x2')},'content':{'type':Sequelize[_0x8396('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8396('0x1')](_0x8396('0x2'),_0x8396('0x3'),_0x8396('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x8396('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 8a24fed..08e3e9c 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 _0x7ac3=['show','keys','include','find','catch','create','body','params','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','Content-Range','apply','then','destroy','error','stack','name','SalesforceField','key','model','map','filters','query','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll'];(function(_0x25ceab,_0x4b9c34){var _0x360db6=function(_0x25c904){while(--_0x25c904){_0x25ceab['push'](_0x25ceab['shift']());}};_0x360db6(++_0x4b9c34);}(_0x7ac3,0x1cf));var _0x37ac=function(_0x1ace66,_0x46d682){_0x1ace66=_0x1ace66-0x0;var _0x262563=_0x7ac3[_0x1ace66];return _0x262563;};'use strict';var pdf=require(_0x37ac('0x0'));var emlformat=require(_0x37ac('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x37ac('0x2'));var rp=require(_0x37ac('0x3'));var moment=require(_0x37ac('0x4'));var BPromise=require(_0x37ac('0x5'));var Mustache=require('mustache');var util=require(_0x37ac('0x6'));var path=require(_0x37ac('0x7'));var sox=require(_0x37ac('0x8'));var csv=require(_0x37ac('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x37ac('0xa'));var squel=require('squel');var crypto=require(_0x37ac('0xb'));var jsforce=require(_0x37ac('0xc'));var deskjs=require(_0x37ac('0xd'));var toCsv=require(_0x37ac('0x9'));var querystring=require(_0x37ac('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x37ac('0xf'));var qs=require(_0x37ac('0x10'));var as=require(_0x37ac('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x37ac('0x12'));var utils=require(_0x37ac('0x13'));var config=require(_0x37ac('0x14'));var licenseUtil=require(_0x37ac('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe115c3,_0x427c32){_0x427c32=_0x427c32||0xcc;return function(_0x3e914c){if(_0x3e914c){return _0xe115c3[_0x37ac('0x16')](_0x427c32);}return _0xe115c3[_0x37ac('0x17')](_0x427c32)[_0x37ac('0x18')]();};}function respondWithResult(_0x4ab309,_0x397b85){_0x397b85=_0x397b85||0xc8;return function(_0x5cf50d){if(_0x5cf50d){return _0x4ab309[_0x37ac('0x17')](_0x397b85)[_0x37ac('0x19')](_0x5cf50d);}};}function respondWithFilteredResult(_0x450073,_0x5b88c3){return function(_0x411b8d){if(_0x411b8d){var _0x155bb4=_0x411b8d['count'],_0x1c9e3f=_0x5b88c3[_0x37ac('0x1a')],_0x58190c=_0x5b88c3[_0x37ac('0x1a')]+_0x5b88c3[_0x37ac('0x1b')],_0x5e4ab6;if(_0x58190c>=_0x155bb4){_0x58190c=_0x155bb4;_0x5e4ab6=0xc8;}else{_0x5e4ab6=0xce;}_0x450073[_0x37ac('0x17')](_0x5e4ab6);return _0x450073['set'](_0x37ac('0x1c'),_0x1c9e3f+'-'+_0x58190c+'/'+_0x155bb4)[_0x37ac('0x19')](_0x411b8d);}return null;};}function patchUpdates(_0x16fd6c){return function(_0x234af6){try{jsonpatch[_0x37ac('0x1d')](_0x234af6,_0x16fd6c,!![]);}catch(_0x228352){return BPromise['reject'](_0x228352);}return _0x234af6['save']();};}function saveUpdates(_0x3defa9,_0x5c6149){return function(_0x615e){if(_0x615e){return _0x615e['update'](_0x3defa9)[_0x37ac('0x1e')](function(_0x1210c4){return _0x1210c4;});}return null;};}function removeEntity(_0x3f5ef6,_0x198176){return function(_0x3ba195){if(_0x3ba195){return _0x3ba195[_0x37ac('0x1f')]()[_0x37ac('0x1e')](function(){_0x3f5ef6[_0x37ac('0x17')](0xcc)[_0x37ac('0x18')]();});}};}function handleEntityNotFound(_0x20a56c,_0x1cda60){return function(_0x3e5b95){if(!_0x3e5b95){_0x20a56c[_0x37ac('0x16')](0x194);}return _0x3e5b95;};}function handleError(_0x39812e,_0x26a7bc){_0x26a7bc=_0x26a7bc||0x1f4;return function(_0x4eb39c){logger[_0x37ac('0x20')](_0x4eb39c[_0x37ac('0x21')]);if(_0x4eb39c[_0x37ac('0x22')]){delete _0x4eb39c[_0x37ac('0x22')];}_0x39812e[_0x37ac('0x17')](_0x26a7bc)['send'](_0x4eb39c);};}exports['index']=function(_0x494754,_0x59a2d5){var _0x27adc1={},_0x238029={},_0x5913f6={'count':0x0,'rows':[]};var _0x32ce73=_['map'](db[_0x37ac('0x23')]['rawAttributes'],function(_0x1e658b){return{'name':_0x1e658b['fieldName'],'type':_0x1e658b['type'][_0x37ac('0x24')]};});_0x238029[_0x37ac('0x25')]=_[_0x37ac('0x26')](_0x32ce73,_0x37ac('0x22'));_0x238029['query']=_['keys'](_0x494754['query']);_0x238029[_0x37ac('0x27')]=_['intersection'](_0x238029['model'],_0x238029[_0x37ac('0x28')]);_0x27adc1[_0x37ac('0x29')]=_[_0x37ac('0x2a')](_0x238029[_0x37ac('0x25')],qs['fields'](_0x494754[_0x37ac('0x28')][_0x37ac('0x2b')]));_0x27adc1[_0x37ac('0x29')]=_0x27adc1[_0x37ac('0x29')][_0x37ac('0x2c')]?_0x27adc1[_0x37ac('0x29')]:_0x238029[_0x37ac('0x25')];if(!_0x494754['query']['hasOwnProperty'](_0x37ac('0x2d'))){_0x27adc1[_0x37ac('0x1b')]=qs[_0x37ac('0x1b')](_0x494754[_0x37ac('0x28')][_0x37ac('0x1b')]);_0x27adc1['offset']=qs[_0x37ac('0x1a')](_0x494754['query'][_0x37ac('0x1a')]);}_0x27adc1[_0x37ac('0x2e')]=qs[_0x37ac('0x2f')](_0x494754[_0x37ac('0x28')]['sort']);_0x27adc1[_0x37ac('0x30')]=qs[_0x37ac('0x27')](_[_0x37ac('0x31')](_0x494754[_0x37ac('0x28')],_0x238029[_0x37ac('0x27')]),_0x32ce73);if(_0x494754[_0x37ac('0x28')][_0x37ac('0x32')]){_0x27adc1['where']=_[_0x37ac('0x33')](_0x27adc1['where'],{'$or':_[_0x37ac('0x26')](_0x32ce73,function(_0xed8253){if(_0xed8253['type']!==_0x37ac('0x34')){var _0x25b31d={};_0x25b31d[_0xed8253[_0x37ac('0x22')]]={'$like':'%'+_0x494754[_0x37ac('0x28')]['filter']+'%'};return _0x25b31d;}})});}_0x27adc1=_[_0x37ac('0x33')]({},_0x27adc1,_0x494754[_0x37ac('0x35')]);var _0x33f1c0={'where':_0x27adc1[_0x37ac('0x30')]};return db[_0x37ac('0x23')]['count'](_0x33f1c0)[_0x37ac('0x1e')](function(_0x437f7b){_0x5913f6[_0x37ac('0x36')]=_0x437f7b;if(_0x494754['query'][_0x37ac('0x37')]){_0x27adc1['include']=[{'all':!![]}];}return db[_0x37ac('0x23')][_0x37ac('0x38')](_0x27adc1);})['then'](function(_0x18630b){_0x5913f6['rows']=_0x18630b;return _0x5913f6;})[_0x37ac('0x1e')](respondWithFilteredResult(_0x59a2d5,_0x27adc1))['catch'](handleError(_0x59a2d5,null));};exports[_0x37ac('0x39')]=function(_0x41c234,_0x18f11b){var _0x5e0b94={'raw':!![],'where':{'id':_0x41c234['params']['id']}},_0x10ffc2={};_0x10ffc2['model']=_[_0x37ac('0x3a')](db[_0x37ac('0x23')]['rawAttributes']);_0x10ffc2[_0x37ac('0x28')]=_['keys'](_0x41c234[_0x37ac('0x28')]);_0x10ffc2['filters']=_[_0x37ac('0x2a')](_0x10ffc2['model'],_0x10ffc2[_0x37ac('0x28')]);_0x5e0b94[_0x37ac('0x29')]=_[_0x37ac('0x2a')](_0x10ffc2['model'],qs[_0x37ac('0x2b')](_0x41c234[_0x37ac('0x28')]['fields']));_0x5e0b94[_0x37ac('0x29')]=_0x5e0b94[_0x37ac('0x29')][_0x37ac('0x2c')]?_0x5e0b94['attributes']:_0x10ffc2['model'];if(_0x41c234[_0x37ac('0x28')]['includeAll']){_0x5e0b94[_0x37ac('0x3b')]=[{'all':!![]}];}_0x5e0b94=_[_0x37ac('0x33')]({},_0x5e0b94,_0x41c234['options']);return db['SalesforceField'][_0x37ac('0x3c')](_0x5e0b94)[_0x37ac('0x1e')](handleEntityNotFound(_0x18f11b,null))[_0x37ac('0x1e')](respondWithResult(_0x18f11b,null))[_0x37ac('0x3d')](handleError(_0x18f11b,null));};exports[_0x37ac('0x3e')]=function(_0x326b4d,_0x4c3137){return db[_0x37ac('0x23')][_0x37ac('0x3e')](_0x326b4d[_0x37ac('0x3f')],{})[_0x37ac('0x1e')](respondWithResult(_0x4c3137,0xc9))['catch'](handleError(_0x4c3137,null));};exports['update']=function(_0x3e911e,_0x716929){if(_0x3e911e['body']['id']){delete _0x3e911e[_0x37ac('0x3f')]['id'];}return db[_0x37ac('0x23')][_0x37ac('0x3c')]({'where':{'id':_0x3e911e[_0x37ac('0x40')]['id']}})[_0x37ac('0x1e')](handleEntityNotFound(_0x716929,null))['then'](saveUpdates(_0x3e911e[_0x37ac('0x3f')],null))['then'](respondWithResult(_0x716929,null))[_0x37ac('0x3d')](handleError(_0x716929,null));};exports[_0x37ac('0x1f')]=function(_0x494472,_0x1b4f85){return db[_0x37ac('0x23')][_0x37ac('0x3c')]({'where':{'id':_0x494472[_0x37ac('0x40')]['id']}})[_0x37ac('0x1e')](handleEntityNotFound(_0x1b4f85,null))['then'](removeEntity(_0x1b4f85,null))[_0x37ac('0x3d')](handleError(_0x1b4f85,null));}; \ No newline at end of file +var _0x5963=['apply','reject','save','update','then','end','stack','name','index','map','SalesforceField','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','create','body','destroy','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range'];(function(_0x44669a,_0x3ed097){var _0x23c129=function(_0x516238){while(--_0x516238){_0x44669a['push'](_0x44669a['shift']());}};_0x23c129(++_0x3ed097);}(_0x5963,0xbc));var _0x3596=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5963[_0x19950b];return _0x3c6b41;};'use strict';var pdf=require(_0x3596('0x0'));var emlformat=require(_0x3596('0x1'));var rimraf=require(_0x3596('0x2'));var zipdir=require(_0x3596('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3596('0x4'));var moment=require(_0x3596('0x5'));var BPromise=require(_0x3596('0x6'));var Mustache=require(_0x3596('0x7'));var util=require('util');var path=require('path');var sox=require(_0x3596('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3596('0x9'));var squel=require(_0x3596('0xa'));var crypto=require(_0x3596('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3596('0xc'));var toCsv=require(_0x3596('0xd'));var querystring=require('querystring');var Papa=require(_0x3596('0xe'));var Redis=require(_0x3596('0xf'));var authService=require(_0x3596('0x10'));var qs=require(_0x3596('0x11'));var as=require(_0x3596('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3596('0x13'))(_0x3596('0x14'));var utils=require(_0x3596('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3596('0x16'));var db=require(_0x3596('0x17'))['db'];function respondWithStatusCode(_0x536269,_0x58234f){_0x58234f=_0x58234f||0xcc;return function(_0x2fe73b){if(_0x2fe73b){return _0x536269[_0x3596('0x18')](_0x58234f);}return _0x536269[_0x3596('0x19')](_0x58234f)['end']();};}function respondWithResult(_0x117f27,_0x357218){_0x357218=_0x357218||0xc8;return function(_0x3b74f5){if(_0x3b74f5){return _0x117f27[_0x3596('0x19')](_0x357218)['json'](_0x3b74f5);}};}function respondWithFilteredResult(_0x1bbe37,_0x153797){return function(_0x5d9db9){if(_0x5d9db9){var _0x435ff4=_0x5d9db9[_0x3596('0x1a')],_0x1b6bda=_0x153797[_0x3596('0x1b')],_0xd6947f=_0x153797[_0x3596('0x1b')]+_0x153797[_0x3596('0x1c')],_0xd62b8;if(_0xd6947f>=_0x435ff4){_0xd6947f=_0x435ff4;_0xd62b8=0xc8;}else{_0xd62b8=0xce;}_0x1bbe37[_0x3596('0x19')](_0xd62b8);return _0x1bbe37[_0x3596('0x1d')](_0x3596('0x1e'),_0x1b6bda+'-'+_0xd6947f+'/'+_0x435ff4)['json'](_0x5d9db9);}return null;};}function patchUpdates(_0x143b64){return function(_0x281568){try{jsonpatch[_0x3596('0x1f')](_0x281568,_0x143b64,!![]);}catch(_0x4a2ea2){return BPromise[_0x3596('0x20')](_0x4a2ea2);}return _0x281568[_0x3596('0x21')]();};}function saveUpdates(_0x1fa5ea,_0x4eb958){return function(_0x5b6464){if(_0x5b6464){return _0x5b6464[_0x3596('0x22')](_0x1fa5ea)[_0x3596('0x23')](function(_0x5ac382){return _0x5ac382;});}return null;};}function removeEntity(_0x3d6805,_0x19d360){return function(_0x5c3077){if(_0x5c3077){return _0x5c3077['destroy']()[_0x3596('0x23')](function(){_0x3d6805[_0x3596('0x19')](0xcc)[_0x3596('0x24')]();});}};}function handleEntityNotFound(_0xbea54a,_0xc83963){return function(_0x2a93b1){if(!_0x2a93b1){_0xbea54a[_0x3596('0x18')](0x194);}return _0x2a93b1;};}function handleError(_0x5ae694,_0x5a9d67){_0x5a9d67=_0x5a9d67||0x1f4;return function(_0x5574d6){logger['error'](_0x5574d6[_0x3596('0x25')]);if(_0x5574d6[_0x3596('0x26')]){delete _0x5574d6['name'];}_0x5ae694[_0x3596('0x19')](_0x5a9d67)['send'](_0x5574d6);};}exports[_0x3596('0x27')]=function(_0x74d358,_0x4d3b46){var _0x1789e3={},_0xb48907={},_0x56dcc4={'count':0x0,'rows':[]};var _0x3e91e1=_[_0x3596('0x28')](db[_0x3596('0x29')][_0x3596('0x2a')],function(_0x1c8096){return{'name':_0x1c8096[_0x3596('0x2b')],'type':_0x1c8096['type'][_0x3596('0x2c')]};});_0xb48907[_0x3596('0x2d')]=_[_0x3596('0x28')](_0x3e91e1,_0x3596('0x26'));_0xb48907[_0x3596('0x2e')]=_[_0x3596('0x2f')](_0x74d358[_0x3596('0x2e')]);_0xb48907[_0x3596('0x30')]=_['intersection'](_0xb48907[_0x3596('0x2d')],_0xb48907['query']);_0x1789e3[_0x3596('0x31')]=_[_0x3596('0x32')](_0xb48907[_0x3596('0x2d')],qs[_0x3596('0x33')](_0x74d358[_0x3596('0x2e')][_0x3596('0x33')]));_0x1789e3['attributes']=_0x1789e3[_0x3596('0x31')]['length']?_0x1789e3[_0x3596('0x31')]:_0xb48907[_0x3596('0x2d')];if(!_0x74d358[_0x3596('0x2e')][_0x3596('0x34')](_0x3596('0x35'))){_0x1789e3['limit']=qs['limit'](_0x74d358[_0x3596('0x2e')]['limit']);_0x1789e3[_0x3596('0x1b')]=qs[_0x3596('0x1b')](_0x74d358['query'][_0x3596('0x1b')]);}_0x1789e3[_0x3596('0x36')]=qs[_0x3596('0x37')](_0x74d358[_0x3596('0x2e')][_0x3596('0x37')]);_0x1789e3[_0x3596('0x38')]=qs[_0x3596('0x30')](_[_0x3596('0x39')](_0x74d358['query'],_0xb48907['filters']),_0x3e91e1);if(_0x74d358[_0x3596('0x2e')][_0x3596('0x3a')]){_0x1789e3['where']=_['merge'](_0x1789e3[_0x3596('0x38')],{'$or':_[_0x3596('0x28')](_0x3e91e1,function(_0x3a244f){if(_0x3a244f[_0x3596('0x3b')]!==_0x3596('0x3c')){var _0x4ddf96={};_0x4ddf96[_0x3a244f[_0x3596('0x26')]]={'$like':'%'+_0x74d358[_0x3596('0x2e')]['filter']+'%'};return _0x4ddf96;}})});}_0x1789e3=_[_0x3596('0x3d')]({},_0x1789e3,_0x74d358[_0x3596('0x3e')]);var _0x184fe6={'where':_0x1789e3[_0x3596('0x38')]};return db[_0x3596('0x29')][_0x3596('0x1a')](_0x184fe6)[_0x3596('0x23')](function(_0x41eaf7){_0x56dcc4[_0x3596('0x1a')]=_0x41eaf7;if(_0x74d358[_0x3596('0x2e')][_0x3596('0x3f')]){_0x1789e3[_0x3596('0x40')]=[{'all':!![]}];}return db[_0x3596('0x29')]['findAll'](_0x1789e3);})[_0x3596('0x23')](function(_0x3d974b){_0x56dcc4[_0x3596('0x41')]=_0x3d974b;return _0x56dcc4;})[_0x3596('0x23')](respondWithFilteredResult(_0x4d3b46,_0x1789e3))[_0x3596('0x42')](handleError(_0x4d3b46,null));};exports[_0x3596('0x43')]=function(_0xfe7b96,_0x41ee3f){var _0x288676={'raw':!![],'where':{'id':_0xfe7b96[_0x3596('0x44')]['id']}},_0x5f5623={};_0x5f5623[_0x3596('0x2d')]=_[_0x3596('0x2f')](db[_0x3596('0x29')][_0x3596('0x2a')]);_0x5f5623[_0x3596('0x2e')]=_['keys'](_0xfe7b96['query']);_0x5f5623[_0x3596('0x30')]=_[_0x3596('0x32')](_0x5f5623[_0x3596('0x2d')],_0x5f5623[_0x3596('0x2e')]);_0x288676[_0x3596('0x31')]=_[_0x3596('0x32')](_0x5f5623[_0x3596('0x2d')],qs[_0x3596('0x33')](_0xfe7b96[_0x3596('0x2e')]['fields']));_0x288676[_0x3596('0x31')]=_0x288676[_0x3596('0x31')]['length']?_0x288676[_0x3596('0x31')]:_0x5f5623[_0x3596('0x2d')];if(_0xfe7b96[_0x3596('0x2e')][_0x3596('0x3f')]){_0x288676[_0x3596('0x40')]=[{'all':!![]}];}_0x288676=_[_0x3596('0x3d')]({},_0x288676,_0xfe7b96[_0x3596('0x3e')]);return db[_0x3596('0x29')]['find'](_0x288676)['then'](handleEntityNotFound(_0x41ee3f,null))['then'](respondWithResult(_0x41ee3f,null))['catch'](handleError(_0x41ee3f,null));};exports[_0x3596('0x45')]=function(_0x17a3c2,_0x1646b4){return db[_0x3596('0x29')][_0x3596('0x45')](_0x17a3c2[_0x3596('0x46')],{})['then'](respondWithResult(_0x1646b4,0xc9))[_0x3596('0x42')](handleError(_0x1646b4,null));};exports[_0x3596('0x22')]=function(_0x554b28,_0x51315b){if(_0x554b28[_0x3596('0x46')]['id']){delete _0x554b28[_0x3596('0x46')]['id'];}return db[_0x3596('0x29')]['find']({'where':{'id':_0x554b28['params']['id']}})[_0x3596('0x23')](handleEntityNotFound(_0x51315b,null))[_0x3596('0x23')](saveUpdates(_0x554b28[_0x3596('0x46')],null))['then'](respondWithResult(_0x51315b,null))[_0x3596('0x42')](handleError(_0x51315b,null));};exports[_0x3596('0x47')]=function(_0x17218e,_0x21b499){return db[_0x3596('0x29')][_0x3596('0x48')]({'where':{'id':_0x17218e[_0x3596('0x44')]['id']}})['then'](handleEntityNotFound(_0x21b499,null))[_0x3596('0x23')](removeEntity(_0x21b499,null))[_0x3596('0x42')](handleError(_0x21b499,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index ec727b6..dabe520 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 _0xa28b=['bluebird','request-promise','../../config/environment','./intSalesforceField.attributes','exports','SalesforceField','salesforce_unique_index','FieldId','lodash','util','../../config/logger','api'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xa28b,0x1dc));var _0xba28=function(_0x38129f,_0x502c91){_0x38129f=_0x38129f-0x0;var _0x3f1890=_0xa28b[_0x38129f];return _0x3f1890;};'use strict';var _=require(_0xba28('0x0'));var util=require(_0xba28('0x1'));var logger=require(_0xba28('0x2'))(_0xba28('0x3'));var moment=require('moment');var BPromise=require(_0xba28('0x4'));var rp=require(_0xba28('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xba28('0x6'));var attributes=require(_0xba28('0x7'));module[_0xba28('0x8')]=function(_0xb907d1,_0x23d641){return _0xb907d1['define'](_0xba28('0x9'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xba28('0xa'),'fields':['idField',_0xba28('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x23a8=['../../config/environment','./intSalesforceField.attributes','exports','define','int_salesforce_fields','salesforce_unique_index','idField','FieldId','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x20845e,_0x211e78){var _0x28cf2b=function(_0x31d613){while(--_0x31d613){_0x20845e['push'](_0x20845e['shift']());}};_0x28cf2b(++_0x211e78);}(_0x23a8,0xd8));var _0x823a=function(_0x21284e,_0xcd22d7){_0x21284e=_0x21284e-0x0;var _0x4bef74=_0x23a8[_0x21284e];return _0x4bef74;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x823a('0x0'))(_0x823a('0x1'));var moment=require(_0x823a('0x2'));var BPromise=require('bluebird');var rp=require(_0x823a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x823a('0x4'));var config=require(_0x823a('0x5'));var attributes=require(_0x823a('0x6'));module[_0x823a('0x7')]=function(_0x4d4a43,_0x37dc78){return _0x4d4a43[_0x823a('0x8')]('SalesforceField',attributes,{'tableName':_0x823a('0x9'),'paranoid':![],'indexes':[{'name':_0x823a('0xa'),'fields':[_0x823a('0xb'),_0x823a('0xc')],'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 0d8dc8a..a43bc36 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 _0xb4e6=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4730bd,_0x1e9541){var _0x1b2849=function(_0x1fc5a8){while(--_0x1fc5a8){_0x4730bd['push'](_0x4730bd['shift']());}};_0x1b2849(++_0x1e9541);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x1fb4e1,_0x3d4ce6){_0x1fb4e1=_0x1fb4e1-0x0;var _0x22d1b0=_0xb4e6[_0x1fb4e1];return _0x22d1b0;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var moment=require(_0x6b4e('0x1'));var BPromise=require(_0x6b4e('0x2'));var rs=require(_0x6b4e('0x3'));var fs=require('fs');var Redis=require(_0x6b4e('0x4'));var db=require(_0x6b4e('0x5'))['db'];var utils=require(_0x6b4e('0x6'));var logger=require(_0x6b4e('0x7'))('rpc');var config=require(_0x6b4e('0x8'));var jayson=require(_0x6b4e('0x9'));var client=jayson[_0x6b4e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd3138f,_0x570346,_0x4f00be){return new BPromise(function(_0x2311d9,_0x48c870){return client['request'](_0xd3138f,_0x4f00be)[_0x6b4e('0xb')](function(_0x2bd576){logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));logger[_0x6b4e('0xf')](_0x6b4e('0x10'),_0x570346,'request\x20sent',JSON[_0x6b4e('0x11')](_0x2bd576));if(_0x2bd576[_0x6b4e('0x12')]){if(_0x2bd576['error'][_0x6b4e('0x13')]===0x1f4){logger[_0x6b4e('0x12')](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);return _0x48c870(_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);}logger['error'](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')]['message']);return _0x2311d9(_0x2bd576[_0x6b4e('0x12')]['message']);}else{logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));_0x2311d9(_0x2bd576[_0x6b4e('0x15')][_0x6b4e('0x14')]);}})[_0x6b4e('0x16')](function(_0x53a934){logger['error'](_0x6b4e('0xd'),_0x570346,_0x53a934);_0x48c870(_0x53a934);});});} \ No newline at end of file +var _0x91a7=['message','SalesforceField,\x20%s,\x20%s','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x5f1e6d,_0x570b50){var _0x52d4e3=function(_0x5b44e3){while(--_0x5b44e3){_0x5f1e6d['push'](_0x5f1e6d['shift']());}};_0x52d4e3(++_0x570b50);}(_0x91a7,0xe7));var _0x791a=function(_0x79369d,_0xd6f3c){_0x79369d=_0x79369d-0x0;var _0x9da19f=_0x91a7[_0x79369d];return _0x9da19f;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var moment=require(_0x791a('0x1'));var BPromise=require(_0x791a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x791a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x791a('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x791a('0x5'));var jayson=require(_0x791a('0x6'));var client=jayson['client'][_0x791a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5db6db,_0x33baac,_0x159e24){return new BPromise(function(_0x5aa10a,_0x1a32b4){return client[_0x791a('0x8')](_0x5db6db,_0x159e24)[_0x791a('0x9')](function(_0x80ff65){logger[_0x791a('0xa')]('SalesforceField,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));logger[_0x791a('0xc')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'),JSON[_0x791a('0xd')](_0x80ff65));if(_0x80ff65[_0x791a('0xe')]){if(_0x80ff65[_0x791a('0xe')][_0x791a('0xf')]===0x1f4){logger[_0x791a('0xe')]('SalesforceField,\x20%s,\x20%s',_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x1a32b4(_0x80ff65[_0x791a('0xe')]['message']);}logger[_0x791a('0xe')](_0x791a('0x11'),_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x5aa10a(_0x80ff65[_0x791a('0xe')][_0x791a('0x10')]);}else{logger[_0x791a('0xa')]('SalesforceField,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));_0x5aa10a(_0x80ff65['result'][_0x791a('0x10')]);}})[_0x791a('0x12')](function(_0x49ae3e){logger[_0x791a('0xe')]('SalesforceField,\x20%s,\x20%s',_0x33baac,_0x49ae3e);_0x1a32b4(_0x49ae3e);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index ab4da74..b6e052d 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 _0x5c96=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','delete','destroy','multer'];(function(_0x17543f,_0x34a3aa){var _0x479c57=function(_0x10207e){while(--_0x10207e){_0x17543f['push'](_0x17543f['shift']());}};_0x479c57(++_0x34a3aa);}(_0x5c96,0x133));var _0x65c9=function(_0x3b76b2,_0x5ae624){_0x3b76b2=_0x3b76b2-0x0;var _0x540f4f=_0x5c96[_0x3b76b2];return _0x540f4f;};'use strict';var multer=require(_0x65c9('0x0'));var util=require(_0x65c9('0x1'));var path=require(_0x65c9('0x2'));var timeout=require(_0x65c9('0x3'));var express=require('express');var router=express[_0x65c9('0x4')]();var auth=require(_0x65c9('0x5'));var interaction=require(_0x65c9('0x6'));var config=require(_0x65c9('0x7'));var controller=require(_0x65c9('0x8'));router[_0x65c9('0x9')]('/',auth[_0x65c9('0xa')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x65c9('0xb')]);router[_0x65c9('0x9')](_0x65c9('0xc'),auth['isAuthenticated'](),controller[_0x65c9('0xd')]);router[_0x65c9('0x9')](_0x65c9('0xe'),auth[_0x65c9('0xa')](),controller[_0x65c9('0xf')]);router[_0x65c9('0x10')]('/',auth[_0x65c9('0xa')](),controller['create']);router['post']('/:id/configurations',auth[_0x65c9('0xa')](),controller[_0x65c9('0x11')]);router[_0x65c9('0x12')](_0x65c9('0x13'),auth[_0x65c9('0xa')](),controller['update']);router[_0x65c9('0x14')](_0x65c9('0x13'),auth[_0x65c9('0xa')](),controller[_0x65c9('0x15')]);module['exports']=router; \ No newline at end of file +var _0x8603=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','getConfigurations','getFields','create','/:id/configurations','put','update','delete','destroy','exports'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x8603,0x190));var _0x3860=function(_0x5c2bef,_0x16806e){_0x5c2bef=_0x5c2bef-0x0;var _0xd60cc1=_0x8603[_0x5c2bef];return _0xd60cc1;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x3860('0x3'));var interaction=require(_0x3860('0x4'));var config=require(_0x3860('0x5'));var controller=require('./intServicenowAccount.controller');router[_0x3860('0x6')]('/',auth['isAuthenticated'](),controller[_0x3860('0x7')]);router[_0x3860('0x6')](_0x3860('0x8'),auth[_0x3860('0x9')](),controller[_0x3860('0xa')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0x6')]('/:id/fields',auth[_0x3860('0x9')](),controller[_0x3860('0xc')]);router['post']('/',auth[_0x3860('0x9')](),controller[_0x3860('0xd')]);router['post'](_0x3860('0xe'),auth[_0x3860('0x9')](),controller['addConfiguration']);router[_0x3860('0xf')](_0x3860('0x8'),auth[_0x3860('0x9')](),controller[_0x3860('0x10')]);router[_0x3860('0x11')](_0x3860('0x8'),auth[_0x3860('0x9')](),controller[_0x3860('0x12')]);module[_0x3860('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 6c9bae9..858d22c 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 _0x755a=['sequelize','STRING','remoteUri'];(function(_0x111692,_0x19f8a9){var _0x11836f=function(_0x2f2714){while(--_0x2f2714){_0x111692['push'](_0x111692['shift']());}};_0x11836f(++_0x19f8a9);}(_0x755a,0x78));var _0xa755=function(_0x1da571,_0x5383ae){_0x1da571=_0x1da571-0x0;var _0x25cf8e=_0x755a[_0x1da571];return _0x25cf8e;};'use strict';var Sequelize=require(_0xa755('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa755('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xa755('0x1')]},'email':{'type':Sequelize[_0xa755('0x1')]},'remoteUri':{'type':Sequelize[_0xa755('0x1')],'unique':_0xa755('0x2')},'serverUrl':{'type':Sequelize[_0xa755('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x0345=['exports','STRING','username','remoteUri','sequelize'];(function(_0x5919ff,_0xc808d){var _0x364614=function(_0x16ab3f){while(--_0x16ab3f){_0x5919ff['push'](_0x5919ff['shift']());}};_0x364614(++_0xc808d);}(_0x0345,0x180));var _0x5034=function(_0x25b758,_0x225b93){_0x25b758=_0x25b758-0x0;var _0x25ed60=_0x0345[_0x25b758];return _0x25ed60;};'use strict';var Sequelize=require(_0x5034('0x0'));module[_0x5034('0x1')]={'name':{'type':Sequelize[_0x5034('0x2')]},'description':{'type':Sequelize[_0x5034('0x2')]},'username':{'type':Sequelize[_0x5034('0x2')],'unique':_0x5034('0x3')},'password':{'type':Sequelize[_0x5034('0x2')]},'email':{'type':Sequelize[_0x5034('0x2')]},'remoteUri':{'type':Sequelize[_0x5034('0x2')],'unique':_0x5034('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 a46fff6..a4fa0b6 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 _0x773a=['fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','request','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','ServicenowAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','create','body','find','params','destroy','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','subcategory','close_code','notify','incident_state','severity','category','caused_by','watch_list','sys_updated_on','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','knowledge','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','caller_id','short_description','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','calendar_duration','close_notes','closed_by','follow_up','parent_incident','sys_id','urgency','problem_id','reassignment_count','activity_due','comments','approval','sys_mod_count','sys_tags','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','includes','forEach','internalType','label','push','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','statusCode','Wrong\x20credentials','boolean','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf'];(function(_0x39547c,_0x4d6794){var _0xd7ef29=function(_0x239cb9){while(--_0x239cb9){_0x39547c['push'](_0x39547c['shift']());}};_0xd7ef29(++_0x4d6794);}(_0x773a,0xbe));var _0xa773=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x773a[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa773('0x0'));var rimraf=require(_0xa773('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa773('0x2'));var rp=require('request-promise');var moment=require(_0xa773('0x3'));var BPromise=require(_0xa773('0x4'));var Mustache=require(_0xa773('0x5'));var util=require(_0xa773('0x6'));var path=require(_0xa773('0x7'));var sox=require(_0xa773('0x8'));var csv=require(_0xa773('0x9'));var ejs=require(_0xa773('0xa'));var fs=require('fs');var _=require(_0xa773('0xb'));var squel=require(_0xa773('0xc'));var crypto=require(_0xa773('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa773('0x9'));var querystring=require(_0xa773('0xe'));var Papa=require(_0xa773('0xf'));var Redis=require(_0xa773('0x10'));var authService=require(_0xa773('0x11'));var qs=require(_0xa773('0x12'));var as=require(_0xa773('0x13'));var hardwareService=require(_0xa773('0x14'));var logger=require(_0xa773('0x15'))(_0xa773('0x16'));var utils=require(_0xa773('0x17'));var config=require(_0xa773('0x18'));var licenseUtil=require(_0xa773('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa773('0x1a'));var jayson=require(_0xa773('0x1b'));var client=jayson[_0xa773('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x420450,_0x1a8eb3,_0x4ffa3a,_0x151386){return new BPromise(function(_0x3de3fa,_0x221f86){var _0x2c00c0=_0x151386||client;return _0x2c00c0[_0xa773('0x1d')](_0x420450,_0x4ffa3a)['then'](function(_0x453570){logger['info'](_0xa773('0x1e'),_0x1a8eb3,_0xa773('0x1f'));logger[_0xa773('0x20')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x1a8eb3,'request\x20sent',JSON[_0xa773('0x21')](_0x453570));if(_0x453570[_0xa773('0x22')]){if(_0x453570[_0xa773('0x22')][_0xa773('0x23')]===0x1f4){logger['error'](_0xa773('0x1e'),_0x1a8eb3,_0x453570['error'][_0xa773('0x24')]);return _0x221f86(_0x453570['error'][_0xa773('0x24')]);}logger[_0xa773('0x22')](_0xa773('0x1e'),_0x1a8eb3,_0x453570[_0xa773('0x22')][_0xa773('0x24')]);return _0x3de3fa(_0x453570[_0xa773('0x22')][_0xa773('0x24')]);}else{logger[_0xa773('0x25')]('ServicenowAccount,\x20%s,\x20%s',_0x1a8eb3,_0xa773('0x1f'));_0x3de3fa(_0x453570[_0xa773('0x26')]['message']);}})[_0xa773('0x27')](function(_0x3170b4){logger[_0xa773('0x22')]('ServicenowAccount,\x20%s,\x20%s',_0x1a8eb3,_0x3170b4);_0x221f86(_0x3170b4);});});}function respondWithStatusCode(_0x43d21a,_0x4ff351){_0x4ff351=_0x4ff351||0xcc;return function(_0xe91392){if(_0xe91392){return _0x43d21a['sendStatus'](_0x4ff351);}return _0x43d21a[_0xa773('0x28')](_0x4ff351)['end']();};}function respondWithResult(_0x5362aa,_0x33202e){_0x33202e=_0x33202e||0xc8;return function(_0x480b60){if(_0x480b60){return _0x5362aa[_0xa773('0x28')](_0x33202e)[_0xa773('0x29')](_0x480b60);}};}function respondWithFilteredResult(_0x4a45c8,_0x4e0710){return function(_0x2f8d08){if(_0x2f8d08){var _0x119637=_0x2f8d08[_0xa773('0x2a')],_0x1c8784=_0x4e0710[_0xa773('0x2b')],_0x5d7093=_0x4e0710[_0xa773('0x2b')]+_0x4e0710[_0xa773('0x2c')],_0x408998;if(_0x5d7093>=_0x119637){_0x5d7093=_0x119637;_0x408998=0xc8;}else{_0x408998=0xce;}_0x4a45c8[_0xa773('0x28')](_0x408998);return _0x4a45c8[_0xa773('0x2d')](_0xa773('0x2e'),_0x1c8784+'-'+_0x5d7093+'/'+_0x119637)[_0xa773('0x29')](_0x2f8d08);}return null;};}function patchUpdates(_0x21ae7b){return function(_0x4f647b){try{jsonpatch[_0xa773('0x2f')](_0x4f647b,_0x21ae7b,!![]);}catch(_0x28e9d2){return BPromise[_0xa773('0x30')](_0x28e9d2);}return _0x4f647b[_0xa773('0x31')]();};}function saveUpdates(_0x4263cc,_0x52a2ed){return function(_0x4de38a){if(_0x4de38a){return _0x4de38a[_0xa773('0x32')](_0x4263cc)[_0xa773('0x33')](function(_0x30c680){return _0x30c680;});}return null;};}function removeEntity(_0x318b02,_0xe5444e){return function(_0x421323){if(_0x421323){return _0x421323['destroy']()[_0xa773('0x33')](function(){_0x318b02[_0xa773('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1201f5,_0x3df512){return function(_0x5ec367){if(!_0x5ec367){_0x1201f5[_0xa773('0x34')](0x194);}return _0x5ec367;};}function handleError(_0x3923b0,_0x54ef59){_0x54ef59=_0x54ef59||0x1f4;return function(_0xc00932){logger[_0xa773('0x22')](_0xc00932[_0xa773('0x35')]);if(_0xc00932[_0xa773('0x36')]){delete _0xc00932[_0xa773('0x36')];}_0x3923b0[_0xa773('0x28')](_0x54ef59)[_0xa773('0x37')](_0xc00932);};}exports[_0xa773('0x38')]=function(_0x3d2ed5,_0x4b273e){var _0x5d0ed9={},_0x3ebace={},_0xd656e9={'count':0x0,'rows':[]};var _0x38948a=_['map'](db[_0xa773('0x39')][_0xa773('0x3a')],function(_0x3b589b){return{'name':_0x3b589b[_0xa773('0x3b')],'type':_0x3b589b[_0xa773('0x3c')][_0xa773('0x3d')]};});_0x3ebace[_0xa773('0x3e')]=_[_0xa773('0x3f')](_0x38948a,_0xa773('0x36'));_0x3ebace[_0xa773('0x40')]=_[_0xa773('0x41')](_0x3d2ed5[_0xa773('0x40')]);_0x3ebace[_0xa773('0x42')]=_[_0xa773('0x43')](_0x3ebace[_0xa773('0x3e')],_0x3ebace[_0xa773('0x40')]);_0x5d0ed9[_0xa773('0x44')]=_[_0xa773('0x43')](_0x3ebace[_0xa773('0x3e')],qs[_0xa773('0x45')](_0x3d2ed5['query']['fields']));_0x5d0ed9[_0xa773('0x44')]=_0x5d0ed9[_0xa773('0x44')][_0xa773('0x46')]?_0x5d0ed9[_0xa773('0x44')]:_0x3ebace[_0xa773('0x3e')];if(!_0x3d2ed5[_0xa773('0x40')][_0xa773('0x47')](_0xa773('0x48'))){_0x5d0ed9['limit']=qs[_0xa773('0x2c')](_0x3d2ed5[_0xa773('0x40')][_0xa773('0x2c')]);_0x5d0ed9[_0xa773('0x2b')]=qs[_0xa773('0x2b')](_0x3d2ed5[_0xa773('0x40')][_0xa773('0x2b')]);}_0x5d0ed9[_0xa773('0x49')]=qs[_0xa773('0x4a')](_0x3d2ed5[_0xa773('0x40')][_0xa773('0x4a')]);_0x5d0ed9[_0xa773('0x4b')]=qs['filters'](_[_0xa773('0x4c')](_0x3d2ed5['query'],_0x3ebace[_0xa773('0x42')]),_0x38948a);if(_0x3d2ed5['query']['filter']){_0x5d0ed9['where']=_[_0xa773('0x4d')](_0x5d0ed9['where'],{'$or':_[_0xa773('0x3f')](_0x38948a,function(_0x49f38a){if(_0x49f38a[_0xa773('0x3c')]!==_0xa773('0x4e')){var _0x1f9b66={};_0x1f9b66[_0x49f38a[_0xa773('0x36')]]={'$like':'%'+_0x3d2ed5[_0xa773('0x40')][_0xa773('0x4f')]+'%'};return _0x1f9b66;}})});}_0x5d0ed9=_[_0xa773('0x4d')]({},_0x5d0ed9,_0x3d2ed5[_0xa773('0x50')]);var _0x42d8e4={'where':_0x5d0ed9[_0xa773('0x4b')]};return db[_0xa773('0x39')][_0xa773('0x2a')](_0x42d8e4)[_0xa773('0x33')](function(_0x27dd05){_0xd656e9[_0xa773('0x2a')]=_0x27dd05;if(_0x3d2ed5[_0xa773('0x40')][_0xa773('0x51')]){_0x5d0ed9[_0xa773('0x52')]=[{'all':!![]}];}return db[_0xa773('0x39')][_0xa773('0x53')](_0x5d0ed9);})[_0xa773('0x33')](function(_0xf1959d){_0xd656e9['rows']=_0xf1959d;return _0xd656e9;})[_0xa773('0x33')](respondWithFilteredResult(_0x4b273e,_0x5d0ed9))[_0xa773('0x27')](handleError(_0x4b273e,null));};exports['show']=function(_0x29a4a8,_0x3d7c8d){var _0x1290fa={'raw':![],'where':{'id':_0x29a4a8['params']['id']}},_0x253c81={};_0x253c81[_0xa773('0x3e')]=_[_0xa773('0x41')](db[_0xa773('0x39')]['rawAttributes']);_0x253c81[_0xa773('0x40')]=_['keys'](_0x29a4a8[_0xa773('0x40')]);_0x253c81[_0xa773('0x42')]=_['intersection'](_0x253c81[_0xa773('0x3e')],_0x253c81['query']);_0x1290fa[_0xa773('0x44')]=_[_0xa773('0x43')](_0x253c81[_0xa773('0x3e')],qs[_0xa773('0x45')](_0x29a4a8[_0xa773('0x40')][_0xa773('0x45')]));_0x1290fa[_0xa773('0x44')]=_0x1290fa[_0xa773('0x44')][_0xa773('0x46')]?_0x1290fa[_0xa773('0x44')]:_0x253c81['model'];if(_0x29a4a8[_0xa773('0x40')][_0xa773('0x51')]){_0x1290fa[_0xa773('0x52')]=[{'all':!![]}];}_0x1290fa=_[_0xa773('0x4d')]({},_0x1290fa,_0x29a4a8['options']);return db[_0xa773('0x39')]['find'](_0x1290fa)['then'](handleEntityNotFound(_0x3d7c8d,null))[_0xa773('0x33')](respondWithResult(_0x3d7c8d,null))['catch'](handleError(_0x3d7c8d,null));};exports[_0xa773('0x54')]=function(_0x27b212,_0xa3de80){return db[_0xa773('0x39')][_0xa773('0x54')](_0x27b212['body'],{})['then'](respondWithResult(_0xa3de80,0xc9))['catch'](handleError(_0xa3de80,null));};exports[_0xa773('0x32')]=function(_0x570abb,_0x2ca930){if(_0x570abb[_0xa773('0x55')]['id']){delete _0x570abb['body']['id'];}return db[_0xa773('0x39')][_0xa773('0x56')]({'where':{'id':_0x570abb[_0xa773('0x57')]['id']}})[_0xa773('0x33')](handleEntityNotFound(_0x2ca930,null))[_0xa773('0x33')](saveUpdates(_0x570abb[_0xa773('0x55')],null))['then'](respondWithResult(_0x2ca930,null))[_0xa773('0x27')](handleError(_0x2ca930,null));};exports[_0xa773('0x58')]=function(_0x14fd21,_0x309dd9){return db[_0xa773('0x39')][_0xa773('0x56')]({'where':{'id':_0x14fd21[_0xa773('0x57')]['id']}})[_0xa773('0x33')](handleEntityNotFound(_0x309dd9,null))[_0xa773('0x33')](removeEntity(_0x309dd9,null))[_0xa773('0x27')](handleError(_0x309dd9,null));};exports[_0xa773('0x59')]=function(_0x4a3e58,_0x20f08a,_0x10291c){var _0x275c15={};var _0x2d64de={};var _0x798554;var _0x1fccc9;return db['ServicenowAccount'][_0xa773('0x5a')]({'where':{'id':_0x4a3e58['params']['id']}})['then'](handleEntityNotFound(_0x20f08a,null))[_0xa773('0x33')](function(_0x47c05b){if(_0x47c05b){_0x798554=_0x47c05b;_0x2d64de[_0xa773('0x3e')]=_[_0xa773('0x41')](db['ServicenowConfiguration'][_0xa773('0x3a')]);_0x2d64de[_0xa773('0x40')]=_[_0xa773('0x41')](_0x4a3e58[_0xa773('0x40')]);_0x2d64de[_0xa773('0x42')]=_[_0xa773('0x43')](_0x2d64de['model'],_0x2d64de[_0xa773('0x40')]);_0x275c15[_0xa773('0x44')]=_[_0xa773('0x43')](_0x2d64de['model'],qs[_0xa773('0x45')](_0x4a3e58[_0xa773('0x40')][_0xa773('0x45')]));_0x275c15['attributes']=_0x275c15[_0xa773('0x44')][_0xa773('0x46')]?_0x275c15[_0xa773('0x44')]:_0x2d64de[_0xa773('0x3e')];_0x275c15[_0xa773('0x49')]=qs[_0xa773('0x4a')](_0x4a3e58[_0xa773('0x40')][_0xa773('0x4a')]);_0x275c15['where']=qs[_0xa773('0x42')](_[_0xa773('0x4c')](_0x4a3e58['query'],_0x2d64de[_0xa773('0x42')]));if(_0x4a3e58['query']['filter']){_0x275c15['where']=_[_0xa773('0x4d')](_0x275c15[_0xa773('0x4b')],{'$or':_[_0xa773('0x3f')](_0x275c15[_0xa773('0x44')],function(_0x59a52c){var _0x109d0b={};_0x109d0b[_0x59a52c]={'$like':'%'+_0x4a3e58['query'][_0xa773('0x4f')]+'%'};return _0x109d0b;})});}_0x275c15=_[_0xa773('0x4d')]({},_0x275c15,_0x4a3e58['options']);return _0x798554['getConfigurations'](_0x275c15);}})['then'](function(_0x5c1803){if(_0x5c1803){_0x1fccc9=_0x5c1803[_0xa773('0x46')];if(!_0x4a3e58[_0xa773('0x40')][_0xa773('0x47')](_0xa773('0x48'))){_0x275c15['limit']=qs[_0xa773('0x2c')](_0x4a3e58[_0xa773('0x40')][_0xa773('0x2c')]);_0x275c15['offset']=qs[_0xa773('0x2b')](_0x4a3e58[_0xa773('0x40')]['offset']);}return _0x798554[_0xa773('0x59')](_0x275c15);}})[_0xa773('0x33')](function(_0x3fd390){if(_0x3fd390){return _0x3fd390?{'count':_0x1fccc9,'rows':_0x3fd390}:null;}})[_0xa773('0x33')](respondWithResult(_0x20f08a,null))[_0xa773('0x27')](handleError(_0x20f08a,null));};exports[_0xa773('0x5b')]=function(_0x4acbad,_0xc549e1,_0xe931e8){if(_0x4acbad[_0xa773('0x55')]['id']){delete _0x4acbad[_0xa773('0x55')]['id'];}return db[_0xa773('0x39')][_0xa773('0x5a')]({'where':{'id':_0x4acbad[_0xa773('0x57')]['id']}})[_0xa773('0x33')](handleEntityNotFound(_0xc549e1,null))[_0xa773('0x33')](function(_0x226491){if(_0x226491){_0x4acbad[_0xa773('0x55')][_0xa773('0x5c')]=_0x226491['id'];_0x4acbad[_0xa773('0x55')][_0xa773('0x5d')]=integrations[_0xa773('0x5e')](_0x4acbad['body']['channel'],_0x4acbad[_0xa773('0x55')]['type']);_0x4acbad[_0xa773('0x55')]['Descriptions']=integrations[_0xa773('0x5f')](_0x4acbad['body'][_0xa773('0x60')],_0x4acbad[_0xa773('0x55')]['type']);return db[_0xa773('0x61')][_0xa773('0x54')](_0x4acbad[_0xa773('0x55')],{'include':[{'model':db[_0xa773('0x62')],'as':_0xa773('0x5d')},{'model':db[_0xa773('0x62')],'as':'Descriptions'}]});}return null;})[_0xa773('0x33')](respondWithResult(_0xc549e1,null))[_0xa773('0x27')](handleError(_0xc549e1,null));};exports[_0xa773('0x63')]=function(_0x153e74,_0x3b0587,_0x34b22f){var _0xf2dd59=[_0xa773('0x64'),_0xa773('0x65'),'knowledge',_0xa773('0x66'),_0xa773('0x67'),_0xa773('0x68'),_0xa773('0x69'),_0xa773('0x6a'),_0xa773('0x6b')];var _0x308ecb=['parent',_0xa773('0x64'),_0xa773('0x6c'),_0xa773('0x6d'),'upon_reject',_0xa773('0x6e'),'child_incidents',_0xa773('0x65'),_0xa773('0x6f'),_0xa773('0x70'),_0xa773('0x71'),_0xa773('0x72'),_0xa773('0x73'),_0xa773('0x74'),_0xa773('0x75'),_0xa773('0x76'),_0xa773('0x77'),'sys_created_by',_0xa773('0x78'),'order','calendar_stc','closed_at','cmdb_ci',_0xa773('0x79'),_0xa773('0x7a'),_0xa773('0x7b'),_0xa773('0x7c'),_0xa773('0x7d'),_0xa773('0x7e'),_0xa773('0x7f'),_0xa773('0x80'),_0xa773('0x81'),_0xa773('0x82'),_0xa773('0x83'),_0xa773('0x84'),_0xa773('0x85'),_0xa773('0x86'),'reopened_time','resolved_at',_0xa773('0x87'),'approval_set',_0xa773('0x66'),'work_notes',_0xa773('0x88'),_0xa773('0x67'),_0xa773('0x89'),_0xa773('0x8a'),_0xa773('0x8b'),'assignment_group',_0xa773('0x8c'),_0xa773('0x8d'),'description',_0xa773('0x8e'),_0xa773('0x68'),'sys_class_name',_0xa773('0x8f'),_0xa773('0x90'),_0xa773('0x91'),_0xa773('0x92'),_0xa773('0x93'),'contact_type','reopened_by',_0xa773('0x69'),_0xa773('0x94'),_0xa773('0x95'),'company',_0xa773('0x96'),_0xa773('0x97'),'assigned_to',_0xa773('0x6a'),_0xa773('0x98'),'sla_due',_0xa773('0x99'),'comments_and_work_notes','due_date',_0xa773('0x9a'),'reopen_count',_0xa773('0x9b'),'escalation',_0xa773('0x9c'),_0xa773('0x9d'),_0xa773('0x9e'),'category'];var _0x4189b7='';var _0x1f8550='';var _0x59746e=[];var _0x38ee7b='';var _0x7cc97f='';var _0x3de55d=[];var _0x5284ce='';var _0x3f41cc='';var _0x5c75f0={};var _0x1d36c5='';return db[_0xa773('0x39')][_0xa773('0x5a')]({'where':{'id':_0x153e74[_0xa773('0x57')]['id']},'attributes':['id',_0xa773('0x9f'),_0xa773('0xa0'),_0xa773('0xa1'),_0xa773('0xa2'),_0xa773('0xa3')]})['then'](handleEntityNotFound(_0x3b0587,null))[_0xa773('0x33')](function(_0x2022d2){if(_0x2022d2){_0x1d36c5=_0x2022d2[_0xa773('0xa2')];var _0x50ea08=_0x1d36c5[_0xa773('0xa4')](-0x1);if(_0x50ea08==='/'){_0x1d36c5=_0x1d36c5[_0xa773('0xa5')](0x0,_0x1d36c5[_0xa773('0xa6')](_0x50ea08));}_0x3f41cc=util[_0xa773('0xa7')]('%s/api/now/doc/table/schema/',_0x1d36c5);_0x5284ce=util[_0xa773('0xa7')](_0xa773('0xa8'),_0x1d36c5);_0x5c75f0={'user':_0x2022d2['username'],'pass':_0x2022d2['password']};var _0x21328d={'method':_0xa773('0xa9'),'uri':_0x3f41cc+_0xa773('0xaa'),'auth':_0x5c75f0,'json':!![]};return rp(_0x21328d);}})[_0xa773('0x33')](function(_0x4de1ba){if(_0x4de1ba[_0xa773('0x26')][_0xa773('0x46')]>0x0){_0x4189b7=_0x4de1ba[_0xa773('0x26')];}console[_0xa773('0xab')](_0xa773('0xac'),_0x4189b7);_0x3de55d=[];_0x1f8550=Object[_0xa773('0xad')]([],_0x4189b7);_['remove'](_0x1f8550,function(_0x49c31d){return!_0xf2dd59[_0xa773('0xae')](_0x49c31d['name']);});_0x1f8550[_0xa773('0xaf')](function(_0x3fc313){var _0x553417=createFieldObject(_0x5284ce,_0x5c75f0,_0x3fc313[_0xa773('0xb0')],_0x3fc313[_0xa773('0x36')],_0x3fc313[_0xa773('0xb1')],![]);_0x3de55d[_0xa773('0xb2')](_0x553417);});return Promise['all'](_0x3de55d);})[_0xa773('0x33')](function(_0x35ffdf){_0x59746e=_0x35ffdf;_0x38ee7b=Object[_0xa773('0xad')]([],_0x4189b7);console['log'](_0xa773('0xb3'),_0x4189b7);_[_0xa773('0xb4')](_0x38ee7b,function(_0x1881a7){return _0x308ecb[_0xa773('0xae')](_0x1881a7[_0xa773('0x36')]);});console['log'](_0xa773('0xb5'),_0x38ee7b);_0x3de55d=[];_0x38ee7b[_0xa773('0xaf')](function(_0x12ee14){var _0x2eaf99=createFieldObject(_0x5284ce,_0x5c75f0,_0x12ee14[_0xa773('0xb0')],_0x12ee14['name'],_0x12ee14[_0xa773('0xb1')],!![]);_0x3de55d[_0xa773('0xb2')](_0x2eaf99);});return Promise['all'](_0x3de55d);})['then'](function(_0x5968e9){_0x7cc97f=_0x5968e9;var _0x4feef1=_0x59746e[_0xa773('0xb6')](_0x7cc97f);return{'count':_0x4feef1['length'],'rows':_0x4feef1};})[_0xa773('0x33')](respondWithResult(_0x3b0587,null))[_0xa773('0x27')](function(_0x5bd70b){console['log']('ServiceNow\x20error:\x20'+_0x5bd70b);var _0x1f29f1=_0x153e74[_0xa773('0x40')]['test']?0x1f4:_0x5bd70b[_0xa773('0xb7')]||0x1f4;logger[_0xa773('0x22')](_0x5bd70b[_0xa773('0x35')]);delete _0x5bd70b[_0xa773('0x36')];if(_0x1f29f1===0x191){_0x1f29f1=0x190;}_0x3b0587[_0xa773('0x28')](_0x1f29f1)[_0xa773('0x37')](_0x153e74[_0xa773('0x40')]['test']?{'message':_0xa773('0xb8'),'statusCode':_0x5bd70b['statusCode']}:_0x5bd70b);});};function createFieldObject(_0x5c8e3d,_0x97fed7,_0x3486eb,_0x3794e1,_0x19369f,_0x42d9c0){return new Promise(function(_0x57c255,_0x4f2e55){var _0x28dd05={'id':_0x3794e1,'name':_0x19369f,'custom':_0x42d9c0};if(_0x3486eb===_0xa773('0xb9')){_0x28dd05['options']=[{'name':'True','value':_0xa773('0xba')},{'name':_0xa773('0xbb'),'value':_0xa773('0xbc')}];_0x57c255(_0x28dd05);}else{var _0x1903e3={'method':_0xa773('0xa9'),'uri':_0x5c8e3d+_0xa773('0xbd')+_0x3794e1,'auth':_0x97fed7,'json':!![]};return rp(_0x1903e3)[_0xa773('0x33')](function(_0xa467d7){var _0x557454=[];if(_0xa467d7[_0xa773('0x26')][_0xa773('0x46')]>0x0){_0xa467d7[_0xa773('0x26')][_0xa773('0xaf')](function(_0x4029a3){if(_0x4029a3[_0xa773('0xbe')]==='false'){var _0x1bbfcf={'name':_0x4029a3[_0xa773('0xb1')],'value':_0x4029a3[_0xa773('0xbf')]};_0x557454[_0xa773('0xb2')](_0x1bbfcf);}});}_0x28dd05[_0xa773('0x50')]=_0x557454;if(_0x28dd05[_0xa773('0x50')][_0xa773('0x46')]>0x0){_0x57c255(_0x28dd05);}else{if(_0x42d9c0==![]){_0x57c255();}else{_0x57c255(_0x28dd05);}}});}});} \ No newline at end of file +var _0x2857=['body','destroy','getConfigurations','findOne','ServicenowConfiguration','rawAttributes','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','create','ServicenowField','getFields','hold_reason','knowledge','close_code','severity','category','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','cmdb_ci','impact','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','resolved_at','caller_id','approval_set','subcategory','work_notes','short_description','delivery_task','work_start','assignment_group','description','follow_up','parent_incident','sys_id','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','comments_and_work_notes','due_date','location','password','email','remoteUri','serverUrl','substring','lastIndexOf','%s/api/now/doc/table/schema/','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','includes','forEach','label','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','boolean','True','true','false','value','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','end','stack','name','send','index','map','ServicenowAccount','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','rows','show','params','keys','includeAll','find'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x2857,0x1ea));var _0x7285=function(_0x502600,_0x1ca38c){_0x502600=_0x502600-0x0;var _0x510a06=_0x2857[_0x502600];return _0x510a06;};'use strict';var pdf=require(_0x7285('0x0'));var emlformat=require(_0x7285('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7285('0x2'));var jsonpatch=require(_0x7285('0x3'));var rp=require(_0x7285('0x4'));var moment=require(_0x7285('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7285('0x6'));var util=require(_0x7285('0x7'));var path=require(_0x7285('0x8'));var sox=require(_0x7285('0x9'));var csv=require(_0x7285('0xa'));var ejs=require(_0x7285('0xb'));var fs=require('fs');var _=require(_0x7285('0xc'));var squel=require(_0x7285('0xd'));var crypto=require(_0x7285('0xe'));var jsforce=require(_0x7285('0xf'));var deskjs=require(_0x7285('0x10'));var toCsv=require(_0x7285('0xa'));var querystring=require(_0x7285('0x11'));var Papa=require('papaparse');var Redis=require(_0x7285('0x12'));var authService=require(_0x7285('0x13'));var qs=require(_0x7285('0x14'));var as=require(_0x7285('0x15'));var hardwareService=require(_0x7285('0x16'));var logger=require('../../config/logger')(_0x7285('0x17'));var utils=require(_0x7285('0x18'));var config=require(_0x7285('0x19'));var licenseUtil=require(_0x7285('0x1a'));var db=require(_0x7285('0x1b'))['db'];var integrations=require(_0x7285('0x1c'));var jayson=require(_0x7285('0x1d'));var client=jayson[_0x7285('0x1e')][_0x7285('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1117c0,_0x55e24c,_0x465210,_0x5c5ade){return new BPromise(function(_0x10f518,_0x5d665c){var _0x266247=_0x5c5ade||client;return _0x266247[_0x7285('0x20')](_0x1117c0,_0x465210)['then'](function(_0x5df77b){logger[_0x7285('0x21')](_0x7285('0x22'),_0x55e24c,'request\x20sent');logger[_0x7285('0x23')](_0x7285('0x24'),_0x55e24c,_0x7285('0x25'),JSON[_0x7285('0x26')](_0x5df77b));if(_0x5df77b[_0x7285('0x27')]){if(_0x5df77b[_0x7285('0x27')][_0x7285('0x28')]===0x1f4){logger[_0x7285('0x27')](_0x7285('0x22'),_0x55e24c,_0x5df77b[_0x7285('0x27')][_0x7285('0x29')]);return _0x5d665c(_0x5df77b[_0x7285('0x27')][_0x7285('0x29')]);}logger['error'](_0x7285('0x22'),_0x55e24c,_0x5df77b[_0x7285('0x27')][_0x7285('0x29')]);return _0x10f518(_0x5df77b[_0x7285('0x27')]['message']);}else{logger[_0x7285('0x21')](_0x7285('0x22'),_0x55e24c,'request\x20sent');_0x10f518(_0x5df77b[_0x7285('0x2a')][_0x7285('0x29')]);}})[_0x7285('0x2b')](function(_0x38db44){logger['error'](_0x7285('0x22'),_0x55e24c,_0x38db44);_0x5d665c(_0x38db44);});});}function respondWithStatusCode(_0x2e1045,_0x55130f){_0x55130f=_0x55130f||0xcc;return function(_0xe80a42){if(_0xe80a42){return _0x2e1045[_0x7285('0x2c')](_0x55130f);}return _0x2e1045['status'](_0x55130f)['end']();};}function respondWithResult(_0x551bd9,_0x1c6cec){_0x1c6cec=_0x1c6cec||0xc8;return function(_0x5b7bc1){if(_0x5b7bc1){return _0x551bd9[_0x7285('0x2d')](_0x1c6cec)[_0x7285('0x2e')](_0x5b7bc1);}};}function respondWithFilteredResult(_0x573002,_0x23fb69){return function(_0x5e16a9){if(_0x5e16a9){var _0x54cafa=_0x5e16a9[_0x7285('0x2f')],_0x215eca=_0x23fb69[_0x7285('0x30')],_0x5c7574=_0x23fb69[_0x7285('0x30')]+_0x23fb69[_0x7285('0x31')],_0x5a804e;if(_0x5c7574>=_0x54cafa){_0x5c7574=_0x54cafa;_0x5a804e=0xc8;}else{_0x5a804e=0xce;}_0x573002[_0x7285('0x2d')](_0x5a804e);return _0x573002[_0x7285('0x32')]('Content-Range',_0x215eca+'-'+_0x5c7574+'/'+_0x54cafa)['json'](_0x5e16a9);}return null;};}function patchUpdates(_0x367b3e){return function(_0xa4e8a){try{jsonpatch[_0x7285('0x33')](_0xa4e8a,_0x367b3e,!![]);}catch(_0xde67d9){return BPromise[_0x7285('0x34')](_0xde67d9);}return _0xa4e8a[_0x7285('0x35')]();};}function saveUpdates(_0x415eec,_0x19e27c){return function(_0x27912e){if(_0x27912e){return _0x27912e[_0x7285('0x36')](_0x415eec)[_0x7285('0x37')](function(_0x5f3255){return _0x5f3255;});}return null;};}function removeEntity(_0x4d3382,_0x220541){return function(_0x3c013c){if(_0x3c013c){return _0x3c013c['destroy']()[_0x7285('0x37')](function(){_0x4d3382[_0x7285('0x2d')](0xcc)[_0x7285('0x38')]();});}};}function handleEntityNotFound(_0x18f7fd,_0x30ff80){return function(_0x4fb48d){if(!_0x4fb48d){_0x18f7fd[_0x7285('0x2c')](0x194);}return _0x4fb48d;};}function handleError(_0x4db073,_0x3f4f56){_0x3f4f56=_0x3f4f56||0x1f4;return function(_0xda341c){logger[_0x7285('0x27')](_0xda341c[_0x7285('0x39')]);if(_0xda341c[_0x7285('0x3a')]){delete _0xda341c[_0x7285('0x3a')];}_0x4db073[_0x7285('0x2d')](_0x3f4f56)[_0x7285('0x3b')](_0xda341c);};}exports[_0x7285('0x3c')]=function(_0x48063f,_0x4a9f4f){var _0xf2e06e={},_0x4d7afd={},_0x4d06ef={'count':0x0,'rows':[]};var _0x7604e2=_[_0x7285('0x3d')](db[_0x7285('0x3e')]['rawAttributes'],function(_0x5b7026){return{'name':_0x5b7026[_0x7285('0x3f')],'type':_0x5b7026[_0x7285('0x40')][_0x7285('0x41')]};});_0x4d7afd[_0x7285('0x42')]=_['map'](_0x7604e2,_0x7285('0x3a'));_0x4d7afd[_0x7285('0x43')]=_['keys'](_0x48063f['query']);_0x4d7afd['filters']=_[_0x7285('0x44')](_0x4d7afd[_0x7285('0x42')],_0x4d7afd[_0x7285('0x43')]);_0xf2e06e[_0x7285('0x45')]=_['intersection'](_0x4d7afd[_0x7285('0x42')],qs[_0x7285('0x46')](_0x48063f[_0x7285('0x43')][_0x7285('0x46')]));_0xf2e06e['attributes']=_0xf2e06e['attributes'][_0x7285('0x47')]?_0xf2e06e[_0x7285('0x45')]:_0x4d7afd[_0x7285('0x42')];if(!_0x48063f['query'][_0x7285('0x48')]('nolimit')){_0xf2e06e[_0x7285('0x31')]=qs[_0x7285('0x31')](_0x48063f[_0x7285('0x43')][_0x7285('0x31')]);_0xf2e06e[_0x7285('0x30')]=qs[_0x7285('0x30')](_0x48063f['query'][_0x7285('0x30')]);}_0xf2e06e[_0x7285('0x49')]=qs[_0x7285('0x4a')](_0x48063f[_0x7285('0x43')]['sort']);_0xf2e06e[_0x7285('0x4b')]=qs[_0x7285('0x4c')](_[_0x7285('0x4d')](_0x48063f[_0x7285('0x43')],_0x4d7afd[_0x7285('0x4c')]),_0x7604e2);if(_0x48063f[_0x7285('0x43')]['filter']){_0xf2e06e[_0x7285('0x4b')]=_[_0x7285('0x4e')](_0xf2e06e[_0x7285('0x4b')],{'$or':_['map'](_0x7604e2,function(_0x3999b8){if(_0x3999b8['type']!==_0x7285('0x4f')){var _0x5b93c6={};_0x5b93c6[_0x3999b8[_0x7285('0x3a')]]={'$like':'%'+_0x48063f[_0x7285('0x43')][_0x7285('0x50')]+'%'};return _0x5b93c6;}})});}_0xf2e06e=_[_0x7285('0x4e')]({},_0xf2e06e,_0x48063f[_0x7285('0x51')]);var _0x56af2f={'where':_0xf2e06e['where']};return db[_0x7285('0x3e')][_0x7285('0x2f')](_0x56af2f)['then'](function(_0x1df65b){_0x4d06ef['count']=_0x1df65b;if(_0x48063f[_0x7285('0x43')]['includeAll']){_0xf2e06e[_0x7285('0x52')]=[{'all':!![]}];}return db[_0x7285('0x3e')]['findAll'](_0xf2e06e);})[_0x7285('0x37')](function(_0x545705){_0x4d06ef[_0x7285('0x53')]=_0x545705;return _0x4d06ef;})[_0x7285('0x37')](respondWithFilteredResult(_0x4a9f4f,_0xf2e06e))[_0x7285('0x2b')](handleError(_0x4a9f4f,null));};exports[_0x7285('0x54')]=function(_0x221038,_0x2819a8){var _0x80344c={'raw':![],'where':{'id':_0x221038[_0x7285('0x55')]['id']}},_0x2531ff={};_0x2531ff['model']=_['keys'](db['ServicenowAccount']['rawAttributes']);_0x2531ff[_0x7285('0x43')]=_[_0x7285('0x56')](_0x221038[_0x7285('0x43')]);_0x2531ff['filters']=_[_0x7285('0x44')](_0x2531ff[_0x7285('0x42')],_0x2531ff[_0x7285('0x43')]);_0x80344c[_0x7285('0x45')]=_[_0x7285('0x44')](_0x2531ff['model'],qs[_0x7285('0x46')](_0x221038['query'][_0x7285('0x46')]));_0x80344c[_0x7285('0x45')]=_0x80344c[_0x7285('0x45')][_0x7285('0x47')]?_0x80344c[_0x7285('0x45')]:_0x2531ff['model'];if(_0x221038['query'][_0x7285('0x57')]){_0x80344c[_0x7285('0x52')]=[{'all':!![]}];}_0x80344c=_[_0x7285('0x4e')]({},_0x80344c,_0x221038[_0x7285('0x51')]);return db[_0x7285('0x3e')][_0x7285('0x58')](_0x80344c)[_0x7285('0x37')](handleEntityNotFound(_0x2819a8,null))['then'](respondWithResult(_0x2819a8,null))[_0x7285('0x2b')](handleError(_0x2819a8,null));};exports['create']=function(_0x138ac9,_0x11c939){return db['ServicenowAccount']['create'](_0x138ac9[_0x7285('0x59')],{})[_0x7285('0x37')](respondWithResult(_0x11c939,0xc9))[_0x7285('0x2b')](handleError(_0x11c939,null));};exports[_0x7285('0x36')]=function(_0x55bd41,_0x310a65){if(_0x55bd41[_0x7285('0x59')]['id']){delete _0x55bd41[_0x7285('0x59')]['id'];}return db[_0x7285('0x3e')][_0x7285('0x58')]({'where':{'id':_0x55bd41[_0x7285('0x55')]['id']}})[_0x7285('0x37')](handleEntityNotFound(_0x310a65,null))['then'](saveUpdates(_0x55bd41[_0x7285('0x59')],null))[_0x7285('0x37')](respondWithResult(_0x310a65,null))[_0x7285('0x2b')](handleError(_0x310a65,null));};exports[_0x7285('0x5a')]=function(_0x4792e7,_0x3746a7){return db[_0x7285('0x3e')]['find']({'where':{'id':_0x4792e7[_0x7285('0x55')]['id']}})[_0x7285('0x37')](handleEntityNotFound(_0x3746a7,null))['then'](removeEntity(_0x3746a7,null))[_0x7285('0x2b')](handleError(_0x3746a7,null));};exports[_0x7285('0x5b')]=function(_0x323b4d,_0xbe415f,_0x5142d2){var _0x9ce600={};var _0x311acf={};var _0x5107f7;var _0x3b3579;return db[_0x7285('0x3e')][_0x7285('0x5c')]({'where':{'id':_0x323b4d[_0x7285('0x55')]['id']}})['then'](handleEntityNotFound(_0xbe415f,null))[_0x7285('0x37')](function(_0x285615){if(_0x285615){_0x5107f7=_0x285615;_0x311acf['model']=_[_0x7285('0x56')](db[_0x7285('0x5d')][_0x7285('0x5e')]);_0x311acf[_0x7285('0x43')]=_['keys'](_0x323b4d['query']);_0x311acf[_0x7285('0x4c')]=_[_0x7285('0x44')](_0x311acf[_0x7285('0x42')],_0x311acf['query']);_0x9ce600[_0x7285('0x45')]=_[_0x7285('0x44')](_0x311acf['model'],qs[_0x7285('0x46')](_0x323b4d['query']['fields']));_0x9ce600[_0x7285('0x45')]=_0x9ce600[_0x7285('0x45')][_0x7285('0x47')]?_0x9ce600[_0x7285('0x45')]:_0x311acf[_0x7285('0x42')];_0x9ce600[_0x7285('0x49')]=qs[_0x7285('0x4a')](_0x323b4d['query'][_0x7285('0x4a')]);_0x9ce600[_0x7285('0x4b')]=qs[_0x7285('0x4c')](_[_0x7285('0x4d')](_0x323b4d['query'],_0x311acf[_0x7285('0x4c')]));if(_0x323b4d[_0x7285('0x43')][_0x7285('0x50')]){_0x9ce600['where']=_[_0x7285('0x4e')](_0x9ce600['where'],{'$or':_[_0x7285('0x3d')](_0x9ce600[_0x7285('0x45')],function(_0x55a977){var _0x4efae8={};_0x4efae8[_0x55a977]={'$like':'%'+_0x323b4d['query'][_0x7285('0x50')]+'%'};return _0x4efae8;})});}_0x9ce600=_['merge']({},_0x9ce600,_0x323b4d[_0x7285('0x51')]);return _0x5107f7[_0x7285('0x5b')](_0x9ce600);}})[_0x7285('0x37')](function(_0x3d6f96){if(_0x3d6f96){_0x3b3579=_0x3d6f96[_0x7285('0x47')];if(!_0x323b4d[_0x7285('0x43')][_0x7285('0x48')](_0x7285('0x5f'))){_0x9ce600['limit']=qs[_0x7285('0x31')](_0x323b4d[_0x7285('0x43')]['limit']);_0x9ce600['offset']=qs[_0x7285('0x30')](_0x323b4d[_0x7285('0x43')]['offset']);}return _0x5107f7['getConfigurations'](_0x9ce600);}})[_0x7285('0x37')](function(_0x17b835){if(_0x17b835){return _0x17b835?{'count':_0x3b3579,'rows':_0x17b835}:null;}})[_0x7285('0x37')](respondWithResult(_0xbe415f,null))[_0x7285('0x2b')](handleError(_0xbe415f,null));};exports[_0x7285('0x60')]=function(_0x180852,_0x5ed0f4,_0x516e95){if(_0x180852[_0x7285('0x59')]['id']){delete _0x180852[_0x7285('0x59')]['id'];}return db[_0x7285('0x3e')][_0x7285('0x5c')]({'where':{'id':_0x180852[_0x7285('0x55')]['id']}})[_0x7285('0x37')](handleEntityNotFound(_0x5ed0f4,null))[_0x7285('0x37')](function(_0x241e59){if(_0x241e59){_0x180852[_0x7285('0x59')][_0x7285('0x61')]=_0x241e59['id'];_0x180852['body'][_0x7285('0x62')]=integrations['getSubjects'](_0x180852[_0x7285('0x59')][_0x7285('0x63')],_0x180852['body'][_0x7285('0x40')]);_0x180852[_0x7285('0x59')][_0x7285('0x64')]=integrations['getDescriptions'](_0x180852[_0x7285('0x59')][_0x7285('0x63')],_0x180852[_0x7285('0x59')][_0x7285('0x40')]);return db[_0x7285('0x5d')][_0x7285('0x65')](_0x180852[_0x7285('0x59')],{'include':[{'model':db[_0x7285('0x66')],'as':'Subjects'},{'model':db[_0x7285('0x66')],'as':_0x7285('0x64')}]});}return null;})[_0x7285('0x37')](respondWithResult(_0x5ed0f4,null))[_0x7285('0x2b')](handleError(_0x5ed0f4,null));};exports[_0x7285('0x67')]=function(_0x1167c3,_0x40bcc7,_0x1005ab){var _0x50b956=['made_sla',_0x7285('0x68'),_0x7285('0x69'),'subcategory',_0x7285('0x6a'),'notify','incident_state',_0x7285('0x6b'),_0x7285('0x6c')];var _0x46d209=['parent','made_sla',_0x7285('0x6d'),_0x7285('0x6e'),'upon_reject',_0x7285('0x6f'),_0x7285('0x70'),'hold_reason',_0x7285('0x71'),'number',_0x7285('0x72'),_0x7285('0x73'),_0x7285('0x74'),_0x7285('0x75'),_0x7285('0x76'),_0x7285('0x77'),'state',_0x7285('0x78'),_0x7285('0x69'),_0x7285('0x49'),_0x7285('0x79'),_0x7285('0x7a'),_0x7285('0x7b'),'delivery_plan',_0x7285('0x7c'),'active',_0x7285('0x7d'),_0x7285('0x7e'),_0x7285('0x7f'),_0x7285('0x80'),_0x7285('0x81'),_0x7285('0x82'),_0x7285('0x83'),_0x7285('0x84'),_0x7285('0x85'),_0x7285('0x86'),_0x7285('0x87'),'reopened_time',_0x7285('0x88'),_0x7285('0x89'),_0x7285('0x8a'),_0x7285('0x8b'),_0x7285('0x8c'),_0x7285('0x8d'),'close_code','correlation_display',_0x7285('0x8e'),_0x7285('0x8f'),_0x7285('0x90'),'business_stc','additional_assignee_list',_0x7285('0x91'),'calendar_duration','notify','sys_class_name','close_notes','closed_by',_0x7285('0x92'),_0x7285('0x93'),_0x7285('0x94'),'contact_type',_0x7285('0x95'),_0x7285('0x96'),_0x7285('0x97'),_0x7285('0x98'),_0x7285('0x99'),_0x7285('0x9a'),_0x7285('0x9b'),_0x7285('0x9c'),_0x7285('0x6b'),_0x7285('0x9d'),'sla_due','approval',_0x7285('0x9e'),_0x7285('0x9f'),'sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id',_0x7285('0xa0'),_0x7285('0x6c')];var _0x1e102d='';var _0xd713e3='';var _0xd1f724=[];var _0x4b82f2='';var _0x39d114='';var _0x77ccfc=[];var _0x2dd3dd='';var _0x4e7e56='';var _0x3fca08={};var _0x3ef4ce='';return db[_0x7285('0x3e')]['findOne']({'where':{'id':_0x1167c3[_0x7285('0x55')]['id']},'attributes':['id','username',_0x7285('0xa1'),_0x7285('0xa2'),_0x7285('0xa3'),_0x7285('0xa4')]})[_0x7285('0x37')](handleEntityNotFound(_0x40bcc7,null))[_0x7285('0x37')](function(_0x14bfea){if(_0x14bfea){_0x3ef4ce=_0x14bfea[_0x7285('0xa3')];var _0x27c236=_0x3ef4ce['slice'](-0x1);if(_0x27c236==='/'){_0x3ef4ce=_0x3ef4ce[_0x7285('0xa5')](0x0,_0x3ef4ce[_0x7285('0xa6')](_0x27c236));}_0x4e7e56=util['format'](_0x7285('0xa7'),_0x3ef4ce);_0x2dd3dd=util['format'](_0x7285('0xa8'),_0x3ef4ce);_0x3fca08={'user':_0x14bfea[_0x7285('0xa9')],'pass':_0x14bfea[_0x7285('0xa1')]};var _0x35d4da={'method':_0x7285('0xaa'),'uri':_0x4e7e56+_0x7285('0xab'),'auth':_0x3fca08,'json':!![]};return rp(_0x35d4da);}})['then'](function(_0x18f0a9){if(_0x18f0a9[_0x7285('0x2a')][_0x7285('0x47')]>0x0){_0x1e102d=_0x18f0a9[_0x7285('0x2a')];}console[_0x7285('0xac')](_0x7285('0xad'),_0x1e102d);_0x77ccfc=[];_0xd713e3=Object[_0x7285('0xae')]([],_0x1e102d);_[_0x7285('0xaf')](_0xd713e3,function(_0x2189ef){return!_0x50b956[_0x7285('0xb0')](_0x2189ef[_0x7285('0x3a')]);});_0xd713e3[_0x7285('0xb1')](function(_0x4490f0){var _0x1e979c=createFieldObject(_0x2dd3dd,_0x3fca08,_0x4490f0['internalType'],_0x4490f0['name'],_0x4490f0[_0x7285('0xb2')],![]);_0x77ccfc[_0x7285('0xb3')](_0x1e979c);});return Promise['all'](_0x77ccfc);})[_0x7285('0x37')](function(_0x5ce386){_0xd1f724=_0x5ce386;_0x4b82f2=Object[_0x7285('0xae')]([],_0x1e102d);console[_0x7285('0xac')](_0x7285('0xb4'),_0x1e102d);_[_0x7285('0xaf')](_0x4b82f2,function(_0x51c1cf){return _0x46d209[_0x7285('0xb0')](_0x51c1cf[_0x7285('0x3a')]);});console[_0x7285('0xac')](_0x7285('0xb5'),_0x4b82f2);_0x77ccfc=[];_0x4b82f2[_0x7285('0xb1')](function(_0x31a109){var _0x88c16b=createFieldObject(_0x2dd3dd,_0x3fca08,_0x31a109[_0x7285('0xb6')],_0x31a109['name'],_0x31a109[_0x7285('0xb2')],!![]);_0x77ccfc[_0x7285('0xb3')](_0x88c16b);});return Promise['all'](_0x77ccfc);})[_0x7285('0x37')](function(_0x1dc28b){_0x39d114=_0x1dc28b;var _0x49a525=_0xd1f724[_0x7285('0xb7')](_0x39d114);return{'count':_0x49a525[_0x7285('0x47')],'rows':_0x49a525};})[_0x7285('0x37')](respondWithResult(_0x40bcc7,null))[_0x7285('0x2b')](function(_0x474160){console[_0x7285('0xac')](_0x7285('0xb8')+_0x474160);var _0x2ac867=_0x1167c3[_0x7285('0x43')][_0x7285('0xb9')]?0x1f4:_0x474160['statusCode']||0x1f4;logger[_0x7285('0x27')](_0x474160[_0x7285('0x39')]);delete _0x474160[_0x7285('0x3a')];if(_0x2ac867===0x191){_0x2ac867=0x190;}_0x40bcc7[_0x7285('0x2d')](_0x2ac867)[_0x7285('0x3b')](_0x1167c3[_0x7285('0x43')]['test']?{'message':_0x7285('0xba'),'statusCode':_0x474160[_0x7285('0xbb')]}:_0x474160);});};function createFieldObject(_0x4f9e76,_0x3c3ea0,_0xfad380,_0x209daa,_0x3e24ed,_0x45cb22){return new Promise(function(_0x5a2c1a,_0x11f3f9){var _0x498d31={'id':_0x209daa,'name':_0x3e24ed,'custom':_0x45cb22};if(_0xfad380===_0x7285('0xbc')){_0x498d31[_0x7285('0x51')]=[{'name':_0x7285('0xbd'),'value':_0x7285('0xbe')},{'name':'False','value':_0x7285('0xbf')}];_0x5a2c1a(_0x498d31);}else{var _0x50c164={'method':'GET','uri':_0x4f9e76+'sys_choice?sysparm_query=name=incident^element='+_0x209daa,'auth':_0x3c3ea0,'json':!![]};return rp(_0x50c164)[_0x7285('0x37')](function(_0x4cb1af){var _0x5b9df2=[];if(_0x4cb1af['result'][_0x7285('0x47')]>0x0){_0x4cb1af[_0x7285('0x2a')][_0x7285('0xb1')](function(_0xdd447c){if(_0xdd447c['inactive']===_0x7285('0xbf')){var _0x4642d6={'name':_0xdd447c[_0x7285('0xb2')],'value':_0xdd447c[_0x7285('0xc0')]};_0x5b9df2[_0x7285('0xb3')](_0x4642d6);}});}_0x498d31[_0x7285('0x51')]=_0x5b9df2;if(_0x498d31[_0x7285('0x51')][_0x7285('0x47')]>0x0){_0x5a2c1a(_0x498d31);}else{if(_0x45cb22==![]){_0x5a2c1a();}else{_0x5a2c1a(_0x498d31);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 8bfe97a..c920db8 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 _0x032e=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x1b4002,_0x5b4094){var _0x1716f3=function(_0x47cfd1){while(--_0x47cfd1){_0x1b4002['push'](_0x1b4002['shift']());}};_0x1716f3(++_0x5b4094);}(_0x032e,0x124));var _0xe032=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x032e[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var logger=require(_0xe032('0x1'))(_0xe032('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe032('0x3'));var fs=require('fs');var path=require(_0xe032('0x4'));var rimraf=require(_0xe032('0x5'));var config=require(_0xe032('0x6'));var attributes=require(_0xe032('0x7'));var integrations=require(_0xe032('0x8'));module[_0xe032('0x9')]=function(_0x33ad0b,_0x37432f){return _0x33ad0b[_0xe032('0xa')](_0xe032('0xb'),attributes,{'tableName':_0xe032('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x723e=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','ServicenowAccount','int_servicenow_accounts','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x723e,0x179));var _0xe723=function(_0x5953d3,_0xebf3f3){_0x5953d3=_0x5953d3-0x0;var _0x3a4d54=_0x723e[_0x5953d3];return _0x3a4d54;};'use strict';var _=require('lodash');var util=require(_0xe723('0x0'));var logger=require(_0xe723('0x1'))(_0xe723('0x2'));var moment=require(_0xe723('0x3'));var BPromise=require(_0xe723('0x4'));var rp=require(_0xe723('0x5'));var fs=require('fs');var path=require(_0xe723('0x6'));var rimraf=require(_0xe723('0x7'));var config=require(_0xe723('0x8'));var attributes=require(_0xe723('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xe723('0xa')]=function(_0x20c13b,_0x1335cd){return _0x20c13b[_0xe723('0xb')](_0xe723('0xc'),attributes,{'tableName':_0xe723('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 7a67f91..2d04965 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 _0xc61c=['../../config/logger','rpc','../../config/environment','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ServicenowAccount','findAll','options','where','attributes','limit','include','map','model','GetServicenowAccount','stringify','find','ShowServicenowAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x2efc88,_0x514a6a){var _0x1e2532=function(_0x242da0){while(--_0x242da0){_0x2efc88['push'](_0x2efc88['shift']());}};_0x1e2532(++_0x514a6a);}(_0xc61c,0x1cd));var _0xcc61=function(_0x231fb1,_0x53a98a){_0x231fb1=_0x231fb1-0x0;var _0x2221a6=_0xc61c[_0x231fb1];return _0x2221a6;};'use strict';var _=require(_0xcc61('0x0'));var util=require(_0xcc61('0x1'));var moment=require(_0xcc61('0x2'));var BPromise=require(_0xcc61('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc61('0x4'));var db=require(_0xcc61('0x5'))['db'];var utils=require(_0xcc61('0x6'));var logger=require(_0xcc61('0x7'))(_0xcc61('0x8'));var config=require(_0xcc61('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcc61('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f0546,_0x145299,_0x4bd11d){return new BPromise(function(_0x74fb61,_0x205e3c){return client[_0xcc61('0xb')](_0x2f0546,_0x4bd11d)[_0xcc61('0xc')](function(_0x11630a){logger[_0xcc61('0xd')](_0xcc61('0xe'),_0x145299,'request\x20sent');logger[_0xcc61('0xf')](_0xcc61('0x10'),_0x145299,_0xcc61('0x11'),JSON['stringify'](_0x11630a));if(_0x11630a[_0xcc61('0x12')]){if(_0x11630a[_0xcc61('0x12')][_0xcc61('0x13')]===0x1f4){logger[_0xcc61('0x12')](_0xcc61('0xe'),_0x145299,_0x11630a[_0xcc61('0x12')][_0xcc61('0x14')]);return _0x205e3c(_0x11630a['error']['message']);}logger[_0xcc61('0x12')](_0xcc61('0xe'),_0x145299,_0x11630a[_0xcc61('0x12')]['message']);return _0x74fb61(_0x11630a['error'][_0xcc61('0x14')]);}else{logger[_0xcc61('0xd')](_0xcc61('0xe'),_0x145299,_0xcc61('0x11'));_0x74fb61(_0x11630a[_0xcc61('0x15')][_0xcc61('0x14')]);}})[_0xcc61('0x16')](function(_0x4c4d63){logger[_0xcc61('0x12')](_0xcc61('0xe'),_0x145299,_0x4c4d63);_0x205e3c(_0x4c4d63);});});}exports['GetServicenowAccount']=function(_0x4f6a42){var _0x3dd59b=this;return new Promise(function(_0x23bfd9,_0x1f5e02){return db[_0xcc61('0x17')][_0xcc61('0x18')]({'raw':_0x4f6a42[_0xcc61('0x19')]?_0x4f6a42[_0xcc61('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4f6a42[_0xcc61('0x19')]?_0x4f6a42[_0xcc61('0x19')][_0xcc61('0x1a')]||null:null,'attributes':_0x4f6a42[_0xcc61('0x19')]?_0x4f6a42[_0xcc61('0x19')][_0xcc61('0x1b')]||null:null,'limit':_0x4f6a42[_0xcc61('0x19')]?_0x4f6a42[_0xcc61('0x19')][_0xcc61('0x1c')]||null:null,'include':_0x4f6a42['options']?_0x4f6a42['options'][_0xcc61('0x1d')]?_[_0xcc61('0x1e')](_0x4f6a42[_0xcc61('0x19')][_0xcc61('0x1d')],function(_0x470c33){return{'model':db[_0x470c33['model']],'as':_0x470c33['as'],'attributes':_0x470c33[_0xcc61('0x1b')],'include':_0x470c33[_0xcc61('0x1d')]?_[_0xcc61('0x1e')](_0x470c33[_0xcc61('0x1d')],function(_0x33803b){return{'model':db[_0x33803b[_0xcc61('0x1f')]],'as':_0x33803b['as'],'attributes':_0x33803b[_0xcc61('0x1b')],'include':_0x33803b[_0xcc61('0x1d')]?_[_0xcc61('0x1e')](_0x33803b[_0xcc61('0x1d')],function(_0x501364){return{'model':db[_0x501364[_0xcc61('0x1f')]],'as':_0x501364['as'],'attributes':_0x501364[_0xcc61('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xcc61('0xc')](function(_0x20131d){logger[_0xcc61('0xd')](_0xcc61('0x20'),_0x4f6a42);logger['debug']('GetServicenowAccount',_0x4f6a42,JSON[_0xcc61('0x21')](_0x20131d));_0x23bfd9(_0x20131d);})[_0xcc61('0x16')](function(_0x1fc538){logger[_0xcc61('0x12')](_0xcc61('0x20'),_0x1fc538['message'],_0x4f6a42);_0x1f5e02(_0x3dd59b[_0xcc61('0x12')](0x1f4,_0x1fc538['message']));});});};exports['ShowServicenowAccount']=function(_0x42ebd1){var _0x23733b=this;return new Promise(function(_0x335a85,_0x5e8378){return db['ServicenowAccount'][_0xcc61('0x22')]({'raw':_0x42ebd1['options']?_0x42ebd1[_0xcc61('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x42ebd1[_0xcc61('0x19')]?_0x42ebd1[_0xcc61('0x19')][_0xcc61('0x1a')]||null:null,'attributes':_0x42ebd1[_0xcc61('0x19')]?_0x42ebd1[_0xcc61('0x19')][_0xcc61('0x1b')]||null:null,'include':_0x42ebd1[_0xcc61('0x19')]?_0x42ebd1[_0xcc61('0x19')][_0xcc61('0x1d')]?_[_0xcc61('0x1e')](_0x42ebd1['options'][_0xcc61('0x1d')],function(_0x395aee){return{'model':db[_0x395aee[_0xcc61('0x1f')]],'as':_0x395aee['as'],'attributes':_0x395aee[_0xcc61('0x1b')],'include':_0x395aee[_0xcc61('0x1d')]?_[_0xcc61('0x1e')](_0x395aee['include'],function(_0x4a5d43){return{'model':db[_0x4a5d43[_0xcc61('0x1f')]],'as':_0x4a5d43['as'],'attributes':_0x4a5d43[_0xcc61('0x1b')],'include':_0x4a5d43['include']?_['map'](_0x4a5d43[_0xcc61('0x1d')],function(_0x3377b3){return{'model':db[_0x3377b3[_0xcc61('0x1f')]],'as':_0x3377b3['as'],'attributes':_0x3377b3[_0xcc61('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xcc61('0xc')](function(_0xe4a625){logger[_0xcc61('0xd')](_0xcc61('0x23'),_0x42ebd1);logger[_0xcc61('0xf')](_0xcc61('0x23'),_0x42ebd1,JSON[_0xcc61('0x21')](_0xe4a625));_0x335a85(_0xe4a625);})['catch'](function(_0x588e91){logger['error'](_0xcc61('0x23'),_0x588e91['message'],_0x42ebd1);_0x5e8378(_0x23733b[_0xcc61('0x12')](0x1f4,_0x588e91[_0xcc61('0x14')]));});});}; \ No newline at end of file +var _0x6c39=['error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','map','include','model','find','info','ShowServicenowAccount','lodash','moment','randomstring','../../mysqldb','jayson/promise','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x14d082,_0x5dda85){var _0x72fec4=function(_0x4b8185){while(--_0x4b8185){_0x14d082['push'](_0x14d082['shift']());}};_0x72fec4(++_0x5dda85);}(_0x6c39,0x15c));var _0x96c3=function(_0x592e40,_0x2ed011){_0x592e40=_0x592e40-0x0;var _0x5d4288=_0x6c39[_0x592e40];return _0x5d4288;};'use strict';var _=require(_0x96c3('0x0'));var util=require('util');var moment=require(_0x96c3('0x1'));var BPromise=require('bluebird');var rs=require(_0x96c3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x96c3('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x96c3('0x4'));var client=jayson['client'][_0x96c3('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x2b0209,_0x19c933,_0x8b4b06){return new BPromise(function(_0x55439b,_0x470710){return client[_0x96c3('0x6')](_0x2b0209,_0x8b4b06)[_0x96c3('0x7')](function(_0x6bf1b1){logger['info'](_0x96c3('0x8'),_0x19c933,_0x96c3('0x9'));logger[_0x96c3('0xa')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x19c933,'request\x20sent',JSON[_0x96c3('0xb')](_0x6bf1b1));if(_0x6bf1b1[_0x96c3('0xc')]){if(_0x6bf1b1[_0x96c3('0xc')][_0x96c3('0xd')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x19c933,_0x6bf1b1['error'][_0x96c3('0xe')]);return _0x470710(_0x6bf1b1[_0x96c3('0xc')][_0x96c3('0xe')]);}logger[_0x96c3('0xc')](_0x96c3('0x8'),_0x19c933,_0x6bf1b1[_0x96c3('0xc')]['message']);return _0x55439b(_0x6bf1b1[_0x96c3('0xc')][_0x96c3('0xe')]);}else{logger['info'](_0x96c3('0x8'),_0x19c933,_0x96c3('0x9'));_0x55439b(_0x6bf1b1[_0x96c3('0xf')][_0x96c3('0xe')]);}})[_0x96c3('0x10')](function(_0x3f0ff5){logger[_0x96c3('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x19c933,_0x3f0ff5);_0x470710(_0x3f0ff5);});});}exports[_0x96c3('0x11')]=function(_0x392a70){var _0x4f16d2=this;return new Promise(function(_0xc3bf67,_0x1b7e32){return db[_0x96c3('0x12')][_0x96c3('0x13')]({'raw':_0x392a70[_0x96c3('0x14')]?_0x392a70['options'][_0x96c3('0x15')]===undefined?!![]:![]:!![],'where':_0x392a70['options']?_0x392a70[_0x96c3('0x14')][_0x96c3('0x16')]||null:null,'attributes':_0x392a70[_0x96c3('0x14')]?_0x392a70[_0x96c3('0x14')][_0x96c3('0x17')]||null:null,'limit':_0x392a70['options']?_0x392a70[_0x96c3('0x14')]['limit']||null:null,'include':_0x392a70['options']?_0x392a70[_0x96c3('0x14')]['include']?_[_0x96c3('0x18')](_0x392a70[_0x96c3('0x14')][_0x96c3('0x19')],function(_0x522592){return{'model':db[_0x522592[_0x96c3('0x1a')]],'as':_0x522592['as'],'attributes':_0x522592[_0x96c3('0x17')],'include':_0x522592[_0x96c3('0x19')]?_[_0x96c3('0x18')](_0x522592['include'],function(_0x25f05d){return{'model':db[_0x25f05d['model']],'as':_0x25f05d['as'],'attributes':_0x25f05d[_0x96c3('0x17')],'include':_0x25f05d[_0x96c3('0x19')]?_[_0x96c3('0x18')](_0x25f05d['include'],function(_0x280977){return{'model':db[_0x280977[_0x96c3('0x1a')]],'as':_0x280977['as'],'attributes':_0x280977[_0x96c3('0x17')]};}):[]};}):[]};}):[]:[]})[_0x96c3('0x7')](function(_0x373c77){logger['info'](_0x96c3('0x11'),_0x392a70);logger[_0x96c3('0xa')](_0x96c3('0x11'),_0x392a70,JSON[_0x96c3('0xb')](_0x373c77));_0xc3bf67(_0x373c77);})[_0x96c3('0x10')](function(_0x51724a){logger[_0x96c3('0xc')](_0x96c3('0x11'),_0x51724a[_0x96c3('0xe')],_0x392a70);_0x1b7e32(_0x4f16d2[_0x96c3('0xc')](0x1f4,_0x51724a['message']));});});};exports['ShowServicenowAccount']=function(_0x339da0){var _0x510c5e=this;return new Promise(function(_0x5c0f29,_0x50b0fb){return db[_0x96c3('0x12')][_0x96c3('0x1b')]({'raw':_0x339da0[_0x96c3('0x14')]?_0x339da0[_0x96c3('0x14')][_0x96c3('0x15')]===undefined?!![]:![]:!![],'where':_0x339da0[_0x96c3('0x14')]?_0x339da0[_0x96c3('0x14')]['where']||null:null,'attributes':_0x339da0['options']?_0x339da0[_0x96c3('0x14')][_0x96c3('0x17')]||null:null,'include':_0x339da0[_0x96c3('0x14')]?_0x339da0['options'][_0x96c3('0x19')]?_['map'](_0x339da0[_0x96c3('0x14')][_0x96c3('0x19')],function(_0x1744a2){return{'model':db[_0x1744a2[_0x96c3('0x1a')]],'as':_0x1744a2['as'],'attributes':_0x1744a2[_0x96c3('0x17')],'include':_0x1744a2[_0x96c3('0x19')]?_[_0x96c3('0x18')](_0x1744a2[_0x96c3('0x19')],function(_0x539fc8){return{'model':db[_0x539fc8['model']],'as':_0x539fc8['as'],'attributes':_0x539fc8['attributes'],'include':_0x539fc8[_0x96c3('0x19')]?_[_0x96c3('0x18')](_0x539fc8['include'],function(_0x5be05b){return{'model':db[_0x5be05b['model']],'as':_0x5be05b['as'],'attributes':_0x5be05b[_0x96c3('0x17')]};}):[]};}):[]};}):[]:[]})[_0x96c3('0x7')](function(_0x3d02c7){logger[_0x96c3('0x1c')](_0x96c3('0x1d'),_0x339da0);logger[_0x96c3('0xa')](_0x96c3('0x1d'),_0x339da0,JSON[_0x96c3('0xb')](_0x3d02c7));_0x5c0f29(_0x3d02c7);})[_0x96c3('0x10')](function(_0x298860){logger[_0x96c3('0xc')](_0x96c3('0x1d'),_0x298860['message'],_0x339da0);_0x50b0fb(_0x510c5e[_0x96c3('0xc')](0x1f4,_0x298860[_0x96c3('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 5baa686..3615c5c 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 _0x6dda=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','update','delete','destroy','util','path'];(function(_0x123375,_0x1f0596){var _0x1946c2=function(_0x1d1bf9){while(--_0x1d1bf9){_0x123375['push'](_0x123375['shift']());}};_0x1946c2(++_0x1f0596);}(_0x6dda,0x14e));var _0xa6dd=function(_0x37c509,_0x3c24bb){_0x37c509=_0x37c509-0x0;var _0x44ea39=_0x6dda[_0x37c509];return _0x44ea39;};'use strict';var multer=require('multer');var util=require(_0xa6dd('0x0'));var path=require(_0xa6dd('0x1'));var timeout=require(_0xa6dd('0x2'));var express=require(_0xa6dd('0x3'));var router=express[_0xa6dd('0x4')]();var auth=require(_0xa6dd('0x5'));var interaction=require(_0xa6dd('0x6'));var config=require(_0xa6dd('0x7'));var controller=require('./intServicenowConfiguration.controller');router[_0xa6dd('0x8')]('/',auth[_0xa6dd('0x9')](),controller[_0xa6dd('0xa')]);router[_0xa6dd('0x8')](_0xa6dd('0xb'),auth[_0xa6dd('0x9')](),controller['show']);router[_0xa6dd('0x8')](_0xa6dd('0xc'),auth['isAuthenticated'](),controller[_0xa6dd('0xd')]);router[_0xa6dd('0x8')](_0xa6dd('0xe'),auth[_0xa6dd('0x9')](),controller['getSubjects']);router[_0xa6dd('0x8')](_0xa6dd('0xf'),auth[_0xa6dd('0x9')](),controller[_0xa6dd('0x10')]);router[_0xa6dd('0x11')]('/',auth[_0xa6dd('0x9')](),controller['create']);router['put'](_0xa6dd('0xb'),auth[_0xa6dd('0x9')](),controller[_0xa6dd('0x12')]);router[_0xa6dd('0x13')](_0xa6dd('0xb'),auth['isAuthenticated'](),controller[_0xa6dd('0x14')]);module['exports']=router; \ No newline at end of file +var _0x0e5d=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0e5d,0x123));var _0xd0e5=function(_0x39ecf6,_0xa7b451){_0x39ecf6=_0x39ecf6-0x0;var _0x4edc88=_0x0e5d[_0x39ecf6];return _0x4edc88;};'use strict';var multer=require(_0xd0e5('0x0'));var util=require(_0xd0e5('0x1'));var path=require(_0xd0e5('0x2'));var timeout=require(_0xd0e5('0x3'));var express=require(_0xd0e5('0x4'));var router=express[_0xd0e5('0x5')]();var auth=require(_0xd0e5('0x6'));var interaction=require(_0xd0e5('0x7'));var config=require(_0xd0e5('0x8'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth[_0xd0e5('0x9')](),controller[_0xd0e5('0xa')]);router[_0xd0e5('0xb')](_0xd0e5('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xd0e5('0xb')](_0xd0e5('0xd'),auth['isAuthenticated'](),controller[_0xd0e5('0xe')]);router[_0xd0e5('0xb')](_0xd0e5('0xf'),auth[_0xd0e5('0x9')](),controller['getSubjects']);router[_0xd0e5('0xb')](_0xd0e5('0x10'),auth[_0xd0e5('0x9')](),controller[_0xd0e5('0x11')]);router['post']('/',auth[_0xd0e5('0x9')](),controller[_0xd0e5('0x12')]);router[_0xd0e5('0x13')](_0xd0e5('0xc'),auth[_0xd0e5('0x9')](),controller[_0xd0e5('0x14')]);router[_0xd0e5('0x15')](_0xd0e5('0xc'),auth[_0xd0e5('0x9')](),controller[_0xd0e5('0x16')]);module[_0xd0e5('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 53a1aa4..16d5e84 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 _0x4fd3=['sequelize','exports','STRING'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x4fd3,0x189));var _0x34fd=function(_0x4f5a3c,_0x50ac0f){_0x4f5a3c=_0x4f5a3c-0x0;var _0x3958d8=_0x4fd3[_0x4f5a3c];return _0x3958d8;};'use strict';var Sequelize=require(_0x34fd('0x0'));module[_0x34fd('0x1')]={'name':{'type':Sequelize[_0x34fd('0x2')]},'description':{'type':Sequelize[_0x34fd('0x2')]}}; \ No newline at end of file +var _0x44fe=['exports','STRING'];(function(_0x227b00,_0x28229a){var _0x48e1c2=function(_0x248619){while(--_0x248619){_0x227b00['push'](_0x227b00['shift']());}};_0x48e1c2(++_0x28229a);}(_0x44fe,0xb6));var _0xe44f=function(_0x599407,_0x579089){_0x599407=_0x599407-0x0;var _0x362abb=_0x44fe[_0x599407];return _0x362abb;};'use strict';var Sequelize=require('sequelize');module[_0xe44f('0x0')]={'name':{'type':Sequelize[_0xe44f('0x1')]},'description':{'type':Sequelize[_0xe44f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index ef1173c..b73ce9b 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 _0x1cd4=['end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','sendStatus','stack','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','key','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','length','find','create','body','findOne','ServicenowField','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','jayson/promise','client','request','then','info','debug','request\x20sent','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result'];(function(_0x32792d,_0x2f0aae){var _0x4e09aa=function(_0x133f75){while(--_0x133f75){_0x32792d['push'](_0x32792d['shift']());}};_0x4e09aa(++_0x2f0aae);}(_0x1cd4,0x91));var _0x41cd=function(_0x204d1d,_0x35aa3d){_0x204d1d=_0x204d1d-0x0;var _0x2ebcef=_0x1cd4[_0x204d1d];return _0x2ebcef;};'use strict';var pdf=require(_0x41cd('0x0'));var emlformat=require(_0x41cd('0x1'));var rimraf=require(_0x41cd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x41cd('0x3'));var rp=require(_0x41cd('0x4'));var moment=require(_0x41cd('0x5'));var BPromise=require(_0x41cd('0x6'));var Mustache=require(_0x41cd('0x7'));var util=require(_0x41cd('0x8'));var path=require(_0x41cd('0x9'));var sox=require(_0x41cd('0xa'));var csv=require(_0x41cd('0xb'));var ejs=require(_0x41cd('0xc'));var fs=require('fs');var _=require(_0x41cd('0xd'));var squel=require('squel');var crypto=require(_0x41cd('0xe'));var jsforce=require(_0x41cd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x41cd('0xb'));var querystring=require('querystring');var Papa=require(_0x41cd('0x10'));var Redis=require(_0x41cd('0x11'));var authService=require(_0x41cd('0x12'));var qs=require(_0x41cd('0x13'));var as=require(_0x41cd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x41cd('0x15'));var licenseUtil=require(_0x41cd('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x41cd('0x17'));var client=jayson[_0x41cd('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1322f7,_0x497021,_0x58a515,_0x135e92){return new BPromise(function(_0x4c6bab,_0x2ef4c9){var _0x54c7ee=_0x135e92||client;return _0x54c7ee[_0x41cd('0x19')](_0x1322f7,_0x58a515)[_0x41cd('0x1a')](function(_0x937ed3){logger[_0x41cd('0x1b')]('ServicenowConfiguration,\x20%s,\x20%s',_0x497021,'request\x20sent');logger[_0x41cd('0x1c')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x497021,_0x41cd('0x1d'),JSON['stringify'](_0x937ed3));if(_0x937ed3[_0x41cd('0x1e')]){if(_0x937ed3['error'][_0x41cd('0x1f')]===0x1f4){logger[_0x41cd('0x1e')](_0x41cd('0x20'),_0x497021,_0x937ed3[_0x41cd('0x1e')][_0x41cd('0x21')]);return _0x2ef4c9(_0x937ed3[_0x41cd('0x1e')][_0x41cd('0x21')]);}logger[_0x41cd('0x1e')]('ServicenowConfiguration,\x20%s,\x20%s',_0x497021,_0x937ed3[_0x41cd('0x1e')][_0x41cd('0x21')]);return _0x4c6bab(_0x937ed3[_0x41cd('0x1e')][_0x41cd('0x21')]);}else{logger[_0x41cd('0x1b')](_0x41cd('0x20'),_0x497021,_0x41cd('0x1d'));_0x4c6bab(_0x937ed3[_0x41cd('0x22')][_0x41cd('0x21')]);}})['catch'](function(_0x1afdaa){logger[_0x41cd('0x1e')](_0x41cd('0x20'),_0x497021,_0x1afdaa);_0x2ef4c9(_0x1afdaa);});});}function respondWithStatusCode(_0x2741fe,_0x25d060){_0x25d060=_0x25d060||0xcc;return function(_0x3e09fc){if(_0x3e09fc){return _0x2741fe['sendStatus'](_0x25d060);}return _0x2741fe['status'](_0x25d060)[_0x41cd('0x23')]();};}function respondWithResult(_0x527b00,_0x331d5b){_0x331d5b=_0x331d5b||0xc8;return function(_0x4a47dd){if(_0x4a47dd){return _0x527b00[_0x41cd('0x24')](_0x331d5b)[_0x41cd('0x25')](_0x4a47dd);}};}function respondWithFilteredResult(_0xb0b9c3,_0xb0f51c){return function(_0x2a0f39){if(_0x2a0f39){var _0xc06868=_0x2a0f39[_0x41cd('0x26')],_0x2e6895=_0xb0f51c[_0x41cd('0x27')],_0x1cbb0e=_0xb0f51c[_0x41cd('0x27')]+_0xb0f51c[_0x41cd('0x28')],_0x33046f;if(_0x1cbb0e>=_0xc06868){_0x1cbb0e=_0xc06868;_0x33046f=0xc8;}else{_0x33046f=0xce;}_0xb0b9c3['status'](_0x33046f);return _0xb0b9c3[_0x41cd('0x29')](_0x41cd('0x2a'),_0x2e6895+'-'+_0x1cbb0e+'/'+_0xc06868)['json'](_0x2a0f39);}return null;};}function patchUpdates(_0x28518e){return function(_0x36e17b){try{jsonpatch[_0x41cd('0x2b')](_0x36e17b,_0x28518e,!![]);}catch(_0x44c905){return BPromise[_0x41cd('0x2c')](_0x44c905);}return _0x36e17b[_0x41cd('0x2d')]();};}function saveUpdates(_0x32366d,_0x40b0b5){return function(_0x24bf4a){if(_0x24bf4a){return _0x24bf4a['update'](_0x32366d)['then'](function(_0x4a21e0){return _0x4a21e0;});}return null;};}function removeEntity(_0x5e27cf,_0x1c5925){return function(_0x26d357){if(_0x26d357){return _0x26d357[_0x41cd('0x2e')]()[_0x41cd('0x1a')](function(){_0x5e27cf[_0x41cd('0x24')](0xcc)[_0x41cd('0x23')]();});}};}function handleEntityNotFound(_0x537218,_0x14be4c){return function(_0x5111ef){if(!_0x5111ef){_0x537218[_0x41cd('0x2f')](0x194);}return _0x5111ef;};}function handleError(_0x44be61,_0x2ac96b){_0x2ac96b=_0x2ac96b||0x1f4;return function(_0xe12d87){logger[_0x41cd('0x1e')](_0xe12d87[_0x41cd('0x30')]);if(_0xe12d87[_0x41cd('0x31')]){delete _0xe12d87[_0x41cd('0x31')];}_0x44be61[_0x41cd('0x24')](_0x2ac96b)[_0x41cd('0x32')](_0xe12d87);};}exports[_0x41cd('0x33')]=function(_0x4798ff,_0x2eda02){var _0x347cf9={},_0x57b4df={},_0x14f557={'count':0x0,'rows':[]};var _0x4ff264=_['map'](db[_0x41cd('0x34')][_0x41cd('0x35')],function(_0x97255e){return{'name':_0x97255e[_0x41cd('0x36')],'type':_0x97255e['type'][_0x41cd('0x37')]};});_0x57b4df['model']=_['map'](_0x4ff264,_0x41cd('0x31'));_0x57b4df[_0x41cd('0x38')]=_[_0x41cd('0x39')](_0x4798ff[_0x41cd('0x38')]);_0x57b4df[_0x41cd('0x3a')]=_['intersection'](_0x57b4df[_0x41cd('0x3b')],_0x57b4df['query']);_0x347cf9['attributes']=_[_0x41cd('0x3c')](_0x57b4df[_0x41cd('0x3b')],qs[_0x41cd('0x3d')](_0x4798ff['query'][_0x41cd('0x3d')]));_0x347cf9['attributes']=_0x347cf9[_0x41cd('0x3e')]['length']?_0x347cf9[_0x41cd('0x3e')]:_0x57b4df[_0x41cd('0x3b')];if(!_0x4798ff['query'][_0x41cd('0x3f')](_0x41cd('0x40'))){_0x347cf9['limit']=qs[_0x41cd('0x28')](_0x4798ff['query'][_0x41cd('0x28')]);_0x347cf9[_0x41cd('0x27')]=qs[_0x41cd('0x27')](_0x4798ff['query']['offset']);}_0x347cf9[_0x41cd('0x41')]=qs[_0x41cd('0x42')](_0x4798ff[_0x41cd('0x38')][_0x41cd('0x42')]);_0x347cf9[_0x41cd('0x43')]=qs[_0x41cd('0x3a')](_[_0x41cd('0x44')](_0x4798ff[_0x41cd('0x38')],_0x57b4df[_0x41cd('0x3a')]),_0x4ff264);if(_0x4798ff[_0x41cd('0x38')][_0x41cd('0x45')]){_0x347cf9[_0x41cd('0x43')]=_['merge'](_0x347cf9[_0x41cd('0x43')],{'$or':_[_0x41cd('0x46')](_0x4ff264,function(_0x3d8a17){if(_0x3d8a17[_0x41cd('0x47')]!==_0x41cd('0x48')){var _0x51e7d9={};_0x51e7d9[_0x3d8a17['name']]={'$like':'%'+_0x4798ff[_0x41cd('0x38')][_0x41cd('0x45')]+'%'};return _0x51e7d9;}})});}_0x347cf9=_[_0x41cd('0x49')]({},_0x347cf9,_0x4798ff[_0x41cd('0x4a')]);var _0x4cac2a={'where':_0x347cf9[_0x41cd('0x43')]};return db['ServicenowConfiguration'][_0x41cd('0x26')](_0x4cac2a)['then'](function(_0x2ce157){_0x14f557['count']=_0x2ce157;if(_0x4798ff[_0x41cd('0x38')][_0x41cd('0x4b')]){_0x347cf9[_0x41cd('0x4c')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x41cd('0x4d')](_0x347cf9);})[_0x41cd('0x1a')](function(_0x1f232c){_0x14f557['rows']=_0x1f232c;return _0x14f557;})[_0x41cd('0x1a')](respondWithFilteredResult(_0x2eda02,_0x347cf9))[_0x41cd('0x4e')](handleError(_0x2eda02,null));};exports[_0x41cd('0x4f')]=function(_0x118005,_0x41aa65){var _0x23cabb={'raw':![],'where':{'id':_0x118005[_0x41cd('0x50')]['id']}},_0x64f1ae={};_0x64f1ae[_0x41cd('0x3b')]=_[_0x41cd('0x39')](db['ServicenowConfiguration'][_0x41cd('0x35')]);_0x64f1ae['query']=_[_0x41cd('0x39')](_0x118005[_0x41cd('0x38')]);_0x64f1ae[_0x41cd('0x3a')]=_[_0x41cd('0x3c')](_0x64f1ae[_0x41cd('0x3b')],_0x64f1ae[_0x41cd('0x38')]);_0x23cabb[_0x41cd('0x3e')]=_[_0x41cd('0x3c')](_0x64f1ae['model'],qs[_0x41cd('0x3d')](_0x118005['query'][_0x41cd('0x3d')]));_0x23cabb[_0x41cd('0x3e')]=_0x23cabb['attributes'][_0x41cd('0x51')]?_0x23cabb['attributes']:_0x64f1ae['model'];if(_0x118005[_0x41cd('0x38')]['includeAll']){_0x23cabb[_0x41cd('0x4c')]=[{'all':!![]}];}_0x23cabb=_['merge']({},_0x23cabb,_0x118005[_0x41cd('0x4a')]);return db['ServicenowConfiguration'][_0x41cd('0x52')](_0x23cabb)[_0x41cd('0x1a')](handleEntityNotFound(_0x41aa65,null))[_0x41cd('0x1a')](respondWithResult(_0x41aa65,null))[_0x41cd('0x4e')](handleError(_0x41aa65,null));};exports[_0x41cd('0x53')]=function(_0x14a273,_0x5b500b){return db['ServicenowConfiguration'][_0x41cd('0x53')](_0x14a273[_0x41cd('0x54')],{})[_0x41cd('0x1a')](respondWithResult(_0x5b500b,0xc9))[_0x41cd('0x4e')](handleError(_0x5b500b,null));};exports['update']=function(_0x5f588f,_0x374c14){if(_0x5f588f[_0x41cd('0x54')]['id']){delete _0x5f588f[_0x41cd('0x54')]['id'];}return db[_0x41cd('0x34')][_0x41cd('0x52')]({'where':{'id':_0x5f588f[_0x41cd('0x50')]['id']}})[_0x41cd('0x1a')](handleEntityNotFound(_0x374c14,null))['then'](saveUpdates(_0x5f588f[_0x41cd('0x54')],null))[_0x41cd('0x1a')](respondWithResult(_0x374c14,null))['catch'](handleError(_0x374c14,null));};exports['destroy']=function(_0x2286dc,_0x457929){return db[_0x41cd('0x34')]['find']({'where':{'id':_0x2286dc['params']['id']}})[_0x41cd('0x1a')](handleEntityNotFound(_0x457929,null))['then'](removeEntity(_0x457929,null))['catch'](handleError(_0x457929,null));};exports['getFields']=function(_0x2cad68,_0x2ebc2e,_0x1c4c67){var _0x412187={};var _0x4fced6={};var _0x555caa;var _0x1a0785;return db[_0x41cd('0x34')][_0x41cd('0x55')]({'where':{'id':_0x2cad68[_0x41cd('0x50')]['id']}})[_0x41cd('0x1a')](handleEntityNotFound(_0x2ebc2e,null))[_0x41cd('0x1a')](function(_0x291bdd){if(_0x291bdd){_0x555caa=_0x291bdd;_0x4fced6['model']=_[_0x41cd('0x39')](db[_0x41cd('0x56')][_0x41cd('0x35')]);_0x4fced6['query']=_[_0x41cd('0x39')](_0x2cad68[_0x41cd('0x38')]);_0x4fced6['filters']=_[_0x41cd('0x3c')](_0x4fced6[_0x41cd('0x3b')],_0x4fced6[_0x41cd('0x38')]);_0x412187[_0x41cd('0x3e')]=_['intersection'](_0x4fced6['model'],qs[_0x41cd('0x3d')](_0x2cad68['query'][_0x41cd('0x3d')]));_0x412187[_0x41cd('0x3e')]=_0x412187['attributes']['length']?_0x412187['attributes']:_0x4fced6['model'];_0x412187[_0x41cd('0x41')]=qs[_0x41cd('0x42')](_0x2cad68[_0x41cd('0x38')][_0x41cd('0x42')]);_0x412187[_0x41cd('0x43')]=qs['filters'](_[_0x41cd('0x44')](_0x2cad68['query'],_0x4fced6[_0x41cd('0x3a')]));if(_0x2cad68['query'][_0x41cd('0x45')]){_0x412187[_0x41cd('0x43')]=_['merge'](_0x412187['where'],{'$or':_[_0x41cd('0x46')](_0x412187['attributes'],function(_0x2545d0){var _0x244238={};_0x244238[_0x2545d0]={'$like':'%'+_0x2cad68[_0x41cd('0x38')][_0x41cd('0x45')]+'%'};return _0x244238;})});}_0x412187=_[_0x41cd('0x49')]({},_0x412187,_0x2cad68['options']);return _0x555caa[_0x41cd('0x57')](_0x412187);}})[_0x41cd('0x1a')](function(_0x366d4c){if(_0x366d4c){_0x1a0785=_0x366d4c[_0x41cd('0x51')];if(!_0x2cad68[_0x41cd('0x38')][_0x41cd('0x3f')](_0x41cd('0x40'))){_0x412187['limit']=qs[_0x41cd('0x28')](_0x2cad68[_0x41cd('0x38')][_0x41cd('0x28')]);_0x412187[_0x41cd('0x27')]=qs[_0x41cd('0x27')](_0x2cad68[_0x41cd('0x38')][_0x41cd('0x27')]);}return _0x555caa[_0x41cd('0x57')](_0x412187);}})['then'](function(_0x2ae4ed){if(_0x2ae4ed){return _0x2ae4ed?{'count':_0x1a0785,'rows':_0x2ae4ed}:null;}})[_0x41cd('0x1a')](respondWithResult(_0x2ebc2e,null))[_0x41cd('0x4e')](handleError(_0x2ebc2e,null));};exports[_0x41cd('0x58')]=function(_0x2bc896,_0x584c9e,_0x1db323){var _0x12e4ff={};var _0x43fa5f={};var _0x15e6b3;var _0x52b6b7;return db[_0x41cd('0x34')][_0x41cd('0x55')]({'where':{'id':_0x2bc896[_0x41cd('0x50')]['id']}})[_0x41cd('0x1a')](handleEntityNotFound(_0x584c9e,null))[_0x41cd('0x1a')](function(_0x66081c){if(_0x66081c){_0x15e6b3=_0x66081c;_0x43fa5f[_0x41cd('0x3b')]=_[_0x41cd('0x39')](db[_0x41cd('0x56')][_0x41cd('0x35')]);_0x43fa5f['query']=_[_0x41cd('0x39')](_0x2bc896['query']);_0x43fa5f[_0x41cd('0x3a')]=_[_0x41cd('0x3c')](_0x43fa5f['model'],_0x43fa5f[_0x41cd('0x38')]);_0x12e4ff['attributes']=_[_0x41cd('0x3c')](_0x43fa5f[_0x41cd('0x3b')],qs[_0x41cd('0x3d')](_0x2bc896['query'][_0x41cd('0x3d')]));_0x12e4ff['attributes']=_0x12e4ff[_0x41cd('0x3e')][_0x41cd('0x51')]?_0x12e4ff[_0x41cd('0x3e')]:_0x43fa5f[_0x41cd('0x3b')];_0x12e4ff[_0x41cd('0x41')]=qs[_0x41cd('0x42')](_0x2bc896['query'][_0x41cd('0x42')]);_0x12e4ff['where']=qs[_0x41cd('0x3a')](_[_0x41cd('0x44')](_0x2bc896[_0x41cd('0x38')],_0x43fa5f[_0x41cd('0x3a')]));if(_0x2bc896[_0x41cd('0x38')][_0x41cd('0x45')]){_0x12e4ff[_0x41cd('0x43')]=_[_0x41cd('0x49')](_0x12e4ff[_0x41cd('0x43')],{'$or':_['map'](_0x12e4ff['attributes'],function(_0x2b7e93){var _0x248439={};_0x248439[_0x2b7e93]={'$like':'%'+_0x2bc896['query']['filter']+'%'};return _0x248439;})});}_0x12e4ff=_[_0x41cd('0x49')]({},_0x12e4ff,_0x2bc896['options']);return _0x15e6b3[_0x41cd('0x58')](_0x12e4ff);}})[_0x41cd('0x1a')](function(_0x2decdf){if(_0x2decdf){_0x52b6b7=_0x2decdf['length'];if(!_0x2bc896['query'][_0x41cd('0x3f')](_0x41cd('0x40'))){_0x12e4ff[_0x41cd('0x28')]=qs[_0x41cd('0x28')](_0x2bc896[_0x41cd('0x38')][_0x41cd('0x28')]);_0x12e4ff[_0x41cd('0x27')]=qs[_0x41cd('0x27')](_0x2bc896[_0x41cd('0x38')]['offset']);}return _0x15e6b3[_0x41cd('0x58')](_0x12e4ff);}})[_0x41cd('0x1a')](function(_0xc4beab){if(_0xc4beab){return _0xc4beab?{'count':_0x52b6b7,'rows':_0xc4beab}:null;}})[_0x41cd('0x1a')](respondWithResult(_0x584c9e,null))[_0x41cd('0x4e')](handleError(_0x584c9e,null));};exports['getDescriptions']=function(_0x5a86bd,_0x5e9ca7,_0x96fa4d){var _0x1c4230={};var _0x2b9573={};var _0x1f576b;var _0x2b8b1a;return db[_0x41cd('0x34')]['findOne']({'where':{'id':_0x5a86bd[_0x41cd('0x50')]['id']}})[_0x41cd('0x1a')](handleEntityNotFound(_0x5e9ca7,null))[_0x41cd('0x1a')](function(_0x4acce6){if(_0x4acce6){_0x1f576b=_0x4acce6;_0x2b9573[_0x41cd('0x3b')]=_['keys'](db['ServicenowField'][_0x41cd('0x35')]);_0x2b9573[_0x41cd('0x38')]=_[_0x41cd('0x39')](_0x5a86bd[_0x41cd('0x38')]);_0x2b9573['filters']=_[_0x41cd('0x3c')](_0x2b9573[_0x41cd('0x3b')],_0x2b9573[_0x41cd('0x38')]);_0x1c4230['attributes']=_[_0x41cd('0x3c')](_0x2b9573[_0x41cd('0x3b')],qs['fields'](_0x5a86bd[_0x41cd('0x38')]['fields']));_0x1c4230[_0x41cd('0x3e')]=_0x1c4230[_0x41cd('0x3e')]['length']?_0x1c4230[_0x41cd('0x3e')]:_0x2b9573['model'];_0x1c4230[_0x41cd('0x41')]=qs[_0x41cd('0x42')](_0x5a86bd[_0x41cd('0x38')][_0x41cd('0x42')]);_0x1c4230['where']=qs[_0x41cd('0x3a')](_[_0x41cd('0x44')](_0x5a86bd[_0x41cd('0x38')],_0x2b9573[_0x41cd('0x3a')]));if(_0x5a86bd[_0x41cd('0x38')][_0x41cd('0x45')]){_0x1c4230[_0x41cd('0x43')]=_[_0x41cd('0x49')](_0x1c4230['where'],{'$or':_[_0x41cd('0x46')](_0x1c4230['attributes'],function(_0x2f8758){var _0x1fa0fe={};_0x1fa0fe[_0x2f8758]={'$like':'%'+_0x5a86bd['query'][_0x41cd('0x45')]+'%'};return _0x1fa0fe;})});}_0x1c4230=_['merge']({},_0x1c4230,_0x5a86bd[_0x41cd('0x4a')]);return _0x1f576b['getDescriptions'](_0x1c4230);}})['then'](function(_0x54b7dd){if(_0x54b7dd){_0x2b8b1a=_0x54b7dd[_0x41cd('0x51')];if(!_0x5a86bd['query']['hasOwnProperty'](_0x41cd('0x40'))){_0x1c4230['limit']=qs[_0x41cd('0x28')](_0x5a86bd[_0x41cd('0x38')][_0x41cd('0x28')]);_0x1c4230[_0x41cd('0x27')]=qs[_0x41cd('0x27')](_0x5a86bd[_0x41cd('0x38')][_0x41cd('0x27')]);}return _0x1f576b[_0x41cd('0x59')](_0x1c4230);}})[_0x41cd('0x1a')](function(_0x3465a6){if(_0x3465a6){return _0x3465a6?{'count':_0x2b8b1a,'rows':_0x3465a6}:null;}})['then'](respondWithResult(_0x5e9ca7,null))[_0x41cd('0x4e')](handleError(_0x5e9ca7,null));}; \ No newline at end of file +var _0x7e69=['intersection','model','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','length','includeAll','create','body','find','destroy','getFields','findOne','ServicenowField','pick','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','stack','name','send','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','attributes'];(function(_0x56cdf3,_0x454444){var _0x1c101f=function(_0x8af99f){while(--_0x8af99f){_0x56cdf3['push'](_0x56cdf3['shift']());}};_0x1c101f(++_0x454444);}(_0x7e69,0x79));var _0x97e6=function(_0x1bb49c,_0x510210){_0x1bb49c=_0x1bb49c-0x0;var _0x45db79=_0x7e69[_0x1bb49c];return _0x45db79;};'use strict';var pdf=require(_0x97e6('0x0'));var emlformat=require(_0x97e6('0x1'));var rimraf=require(_0x97e6('0x2'));var zipdir=require(_0x97e6('0x3'));var jsonpatch=require(_0x97e6('0x4'));var rp=require(_0x97e6('0x5'));var moment=require('moment');var BPromise=require(_0x97e6('0x6'));var Mustache=require(_0x97e6('0x7'));var util=require(_0x97e6('0x8'));var path=require('path');var sox=require(_0x97e6('0x9'));var csv=require(_0x97e6('0xa'));var ejs=require(_0x97e6('0xb'));var fs=require('fs');var _=require(_0x97e6('0xc'));var squel=require(_0x97e6('0xd'));var crypto=require('crypto');var jsforce=require(_0x97e6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x97e6('0xa'));var querystring=require(_0x97e6('0xf'));var Papa=require(_0x97e6('0x10'));var Redis=require(_0x97e6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x97e6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97e6('0x13'));var logger=require('../../config/logger')(_0x97e6('0x14'));var utils=require(_0x97e6('0x15'));var config=require(_0x97e6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x97e6('0x17'))['db'];var jayson=require(_0x97e6('0x18'));var client=jayson[_0x97e6('0x19')][_0x97e6('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x447978,_0x25c8f7,_0x380f0e,_0x2a25fe){return new BPromise(function(_0x59bda9,_0x5554c8){var _0x3fa358=_0x2a25fe||client;return _0x3fa358[_0x97e6('0x1b')](_0x447978,_0x380f0e)[_0x97e6('0x1c')](function(_0x505f29){logger[_0x97e6('0x1d')](_0x97e6('0x1e'),_0x25c8f7,_0x97e6('0x1f'));logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x25c8f7,'request\x20sent',JSON[_0x97e6('0x20')](_0x505f29));if(_0x505f29[_0x97e6('0x21')]){if(_0x505f29['error']['code']===0x1f4){logger['error'](_0x97e6('0x1e'),_0x25c8f7,_0x505f29['error'][_0x97e6('0x22')]);return _0x5554c8(_0x505f29[_0x97e6('0x21')]['message']);}logger['error'](_0x97e6('0x1e'),_0x25c8f7,_0x505f29['error'][_0x97e6('0x22')]);return _0x59bda9(_0x505f29[_0x97e6('0x21')][_0x97e6('0x22')]);}else{logger[_0x97e6('0x1d')]('ServicenowConfiguration,\x20%s,\x20%s',_0x25c8f7,_0x97e6('0x1f'));_0x59bda9(_0x505f29[_0x97e6('0x23')][_0x97e6('0x22')]);}})['catch'](function(_0x45a5c8){logger[_0x97e6('0x21')](_0x97e6('0x1e'),_0x25c8f7,_0x45a5c8);_0x5554c8(_0x45a5c8);});});}function respondWithStatusCode(_0x2bc7ca,_0x6b1f3f){_0x6b1f3f=_0x6b1f3f||0xcc;return function(_0x20b177){if(_0x20b177){return _0x2bc7ca[_0x97e6('0x24')](_0x6b1f3f);}return _0x2bc7ca[_0x97e6('0x25')](_0x6b1f3f)[_0x97e6('0x26')]();};}function respondWithResult(_0x302212,_0x545fe4){_0x545fe4=_0x545fe4||0xc8;return function(_0x5e9e44){if(_0x5e9e44){return _0x302212[_0x97e6('0x25')](_0x545fe4)[_0x97e6('0x27')](_0x5e9e44);}};}function respondWithFilteredResult(_0x541540,_0x3e0faa){return function(_0x4238da){if(_0x4238da){var _0x2fe312=_0x4238da[_0x97e6('0x28')],_0xb3afd3=_0x3e0faa[_0x97e6('0x29')],_0x42b033=_0x3e0faa[_0x97e6('0x29')]+_0x3e0faa[_0x97e6('0x2a')],_0x2d15b9;if(_0x42b033>=_0x2fe312){_0x42b033=_0x2fe312;_0x2d15b9=0xc8;}else{_0x2d15b9=0xce;}_0x541540['status'](_0x2d15b9);return _0x541540['set'](_0x97e6('0x2b'),_0xb3afd3+'-'+_0x42b033+'/'+_0x2fe312)['json'](_0x4238da);}return null;};}function patchUpdates(_0x42cc3b){return function(_0x18a21f){try{jsonpatch[_0x97e6('0x2c')](_0x18a21f,_0x42cc3b,!![]);}catch(_0x5f5b3b){return BPromise[_0x97e6('0x2d')](_0x5f5b3b);}return _0x18a21f[_0x97e6('0x2e')]();};}function saveUpdates(_0x178ad,_0x28b3a2){return function(_0x114295){if(_0x114295){return _0x114295[_0x97e6('0x2f')](_0x178ad)[_0x97e6('0x1c')](function(_0x2c5d6a){return _0x2c5d6a;});}return null;};}function removeEntity(_0x825722,_0x24961a){return function(_0x27baaa){if(_0x27baaa){return _0x27baaa['destroy']()[_0x97e6('0x1c')](function(){_0x825722['status'](0xcc)[_0x97e6('0x26')]();});}};}function handleEntityNotFound(_0xa347e1,_0x452b04){return function(_0x4a0f37){if(!_0x4a0f37){_0xa347e1[_0x97e6('0x24')](0x194);}return _0x4a0f37;};}function handleError(_0x5e083a,_0x32dbe1){_0x32dbe1=_0x32dbe1||0x1f4;return function(_0x34bcaf){logger[_0x97e6('0x21')](_0x34bcaf[_0x97e6('0x30')]);if(_0x34bcaf['name']){delete _0x34bcaf[_0x97e6('0x31')];}_0x5e083a['status'](_0x32dbe1)[_0x97e6('0x32')](_0x34bcaf);};}exports['index']=function(_0x1ae488,_0x59014a){var _0x43d06f={},_0xb4acd2={},_0xb05186={'count':0x0,'rows':[]};var _0x3411ef=_[_0x97e6('0x33')](db[_0x97e6('0x34')][_0x97e6('0x35')],function(_0x3c107f){return{'name':_0x3c107f[_0x97e6('0x36')],'type':_0x3c107f[_0x97e6('0x37')][_0x97e6('0x38')]};});_0xb4acd2['model']=_[_0x97e6('0x33')](_0x3411ef,'name');_0xb4acd2[_0x97e6('0x39')]=_[_0x97e6('0x3a')](_0x1ae488['query']);_0xb4acd2[_0x97e6('0x3b')]=_['intersection'](_0xb4acd2['model'],_0xb4acd2[_0x97e6('0x39')]);_0x43d06f[_0x97e6('0x3c')]=_[_0x97e6('0x3d')](_0xb4acd2[_0x97e6('0x3e')],qs[_0x97e6('0x3f')](_0x1ae488[_0x97e6('0x39')][_0x97e6('0x3f')]));_0x43d06f[_0x97e6('0x3c')]=_0x43d06f[_0x97e6('0x3c')]['length']?_0x43d06f[_0x97e6('0x3c')]:_0xb4acd2[_0x97e6('0x3e')];if(!_0x1ae488[_0x97e6('0x39')][_0x97e6('0x40')](_0x97e6('0x41'))){_0x43d06f[_0x97e6('0x2a')]=qs[_0x97e6('0x2a')](_0x1ae488[_0x97e6('0x39')][_0x97e6('0x2a')]);_0x43d06f['offset']=qs[_0x97e6('0x29')](_0x1ae488[_0x97e6('0x39')][_0x97e6('0x29')]);}_0x43d06f[_0x97e6('0x42')]=qs[_0x97e6('0x43')](_0x1ae488[_0x97e6('0x39')]['sort']);_0x43d06f[_0x97e6('0x44')]=qs[_0x97e6('0x3b')](_['pick'](_0x1ae488[_0x97e6('0x39')],_0xb4acd2[_0x97e6('0x3b')]),_0x3411ef);if(_0x1ae488['query']['filter']){_0x43d06f[_0x97e6('0x44')]=_[_0x97e6('0x45')](_0x43d06f['where'],{'$or':_[_0x97e6('0x33')](_0x3411ef,function(_0x219d9b){if(_0x219d9b[_0x97e6('0x37')]!==_0x97e6('0x46')){var _0x2df097={};_0x2df097[_0x219d9b[_0x97e6('0x31')]]={'$like':'%'+_0x1ae488['query'][_0x97e6('0x47')]+'%'};return _0x2df097;}})});}_0x43d06f=_[_0x97e6('0x45')]({},_0x43d06f,_0x1ae488[_0x97e6('0x48')]);var _0x133641={'where':_0x43d06f[_0x97e6('0x44')]};return db[_0x97e6('0x34')]['count'](_0x133641)[_0x97e6('0x1c')](function(_0x20c9ee){_0xb05186['count']=_0x20c9ee;if(_0x1ae488[_0x97e6('0x39')]['includeAll']){_0x43d06f[_0x97e6('0x49')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x97e6('0x4a')](_0x43d06f);})[_0x97e6('0x1c')](function(_0x3274b6){_0xb05186[_0x97e6('0x4b')]=_0x3274b6;return _0xb05186;})[_0x97e6('0x1c')](respondWithFilteredResult(_0x59014a,_0x43d06f))[_0x97e6('0x4c')](handleError(_0x59014a,null));};exports[_0x97e6('0x4d')]=function(_0x2f0a73,_0x3c7486){var _0x1c95e9={'raw':![],'where':{'id':_0x2f0a73[_0x97e6('0x4e')]['id']}},_0x103267={};_0x103267['model']=_[_0x97e6('0x3a')](db[_0x97e6('0x34')][_0x97e6('0x35')]);_0x103267['query']=_[_0x97e6('0x3a')](_0x2f0a73[_0x97e6('0x39')]);_0x103267[_0x97e6('0x3b')]=_['intersection'](_0x103267[_0x97e6('0x3e')],_0x103267[_0x97e6('0x39')]);_0x1c95e9[_0x97e6('0x3c')]=_['intersection'](_0x103267[_0x97e6('0x3e')],qs[_0x97e6('0x3f')](_0x2f0a73[_0x97e6('0x39')][_0x97e6('0x3f')]));_0x1c95e9[_0x97e6('0x3c')]=_0x1c95e9[_0x97e6('0x3c')][_0x97e6('0x4f')]?_0x1c95e9[_0x97e6('0x3c')]:_0x103267[_0x97e6('0x3e')];if(_0x2f0a73[_0x97e6('0x39')][_0x97e6('0x50')]){_0x1c95e9[_0x97e6('0x49')]=[{'all':!![]}];}_0x1c95e9=_[_0x97e6('0x45')]({},_0x1c95e9,_0x2f0a73[_0x97e6('0x48')]);return db['ServicenowConfiguration']['find'](_0x1c95e9)[_0x97e6('0x1c')](handleEntityNotFound(_0x3c7486,null))['then'](respondWithResult(_0x3c7486,null))[_0x97e6('0x4c')](handleError(_0x3c7486,null));};exports['create']=function(_0x29b557,_0x1d068d){return db[_0x97e6('0x34')][_0x97e6('0x51')](_0x29b557[_0x97e6('0x52')],{})[_0x97e6('0x1c')](respondWithResult(_0x1d068d,0xc9))[_0x97e6('0x4c')](handleError(_0x1d068d,null));};exports['update']=function(_0x8cc958,_0x4bb5b0){if(_0x8cc958[_0x97e6('0x52')]['id']){delete _0x8cc958[_0x97e6('0x52')]['id'];}return db['ServicenowConfiguration'][_0x97e6('0x53')]({'where':{'id':_0x8cc958[_0x97e6('0x4e')]['id']}})[_0x97e6('0x1c')](handleEntityNotFound(_0x4bb5b0,null))[_0x97e6('0x1c')](saveUpdates(_0x8cc958[_0x97e6('0x52')],null))['then'](respondWithResult(_0x4bb5b0,null))[_0x97e6('0x4c')](handleError(_0x4bb5b0,null));};exports[_0x97e6('0x54')]=function(_0x4e591e,_0x5cd72a){return db[_0x97e6('0x34')][_0x97e6('0x53')]({'where':{'id':_0x4e591e[_0x97e6('0x4e')]['id']}})[_0x97e6('0x1c')](handleEntityNotFound(_0x5cd72a,null))[_0x97e6('0x1c')](removeEntity(_0x5cd72a,null))[_0x97e6('0x4c')](handleError(_0x5cd72a,null));};exports[_0x97e6('0x55')]=function(_0x576220,_0x2702fa,_0x1d6dd5){var _0xaf4104={};var _0xefa949={};var _0xa70ad4;var _0x425227;return db[_0x97e6('0x34')][_0x97e6('0x56')]({'where':{'id':_0x576220[_0x97e6('0x4e')]['id']}})[_0x97e6('0x1c')](handleEntityNotFound(_0x2702fa,null))[_0x97e6('0x1c')](function(_0x461811){if(_0x461811){_0xa70ad4=_0x461811;_0xefa949['model']=_[_0x97e6('0x3a')](db[_0x97e6('0x57')][_0x97e6('0x35')]);_0xefa949[_0x97e6('0x39')]=_[_0x97e6('0x3a')](_0x576220['query']);_0xefa949[_0x97e6('0x3b')]=_[_0x97e6('0x3d')](_0xefa949[_0x97e6('0x3e')],_0xefa949[_0x97e6('0x39')]);_0xaf4104[_0x97e6('0x3c')]=_[_0x97e6('0x3d')](_0xefa949[_0x97e6('0x3e')],qs[_0x97e6('0x3f')](_0x576220[_0x97e6('0x39')][_0x97e6('0x3f')]));_0xaf4104[_0x97e6('0x3c')]=_0xaf4104['attributes'][_0x97e6('0x4f')]?_0xaf4104['attributes']:_0xefa949[_0x97e6('0x3e')];_0xaf4104[_0x97e6('0x42')]=qs[_0x97e6('0x43')](_0x576220['query']['sort']);_0xaf4104['where']=qs[_0x97e6('0x3b')](_[_0x97e6('0x58')](_0x576220['query'],_0xefa949[_0x97e6('0x3b')]));if(_0x576220['query'][_0x97e6('0x47')]){_0xaf4104[_0x97e6('0x44')]=_[_0x97e6('0x45')](_0xaf4104[_0x97e6('0x44')],{'$or':_['map'](_0xaf4104[_0x97e6('0x3c')],function(_0x4699bf){var _0x3bddc1={};_0x3bddc1[_0x4699bf]={'$like':'%'+_0x576220[_0x97e6('0x39')]['filter']+'%'};return _0x3bddc1;})});}_0xaf4104=_[_0x97e6('0x45')]({},_0xaf4104,_0x576220[_0x97e6('0x48')]);return _0xa70ad4[_0x97e6('0x55')](_0xaf4104);}})[_0x97e6('0x1c')](function(_0x339260){if(_0x339260){_0x425227=_0x339260[_0x97e6('0x4f')];if(!_0x576220[_0x97e6('0x39')]['hasOwnProperty'](_0x97e6('0x41'))){_0xaf4104[_0x97e6('0x2a')]=qs['limit'](_0x576220['query'][_0x97e6('0x2a')]);_0xaf4104['offset']=qs[_0x97e6('0x29')](_0x576220['query'][_0x97e6('0x29')]);}return _0xa70ad4[_0x97e6('0x55')](_0xaf4104);}})[_0x97e6('0x1c')](function(_0x4934d6){if(_0x4934d6){return _0x4934d6?{'count':_0x425227,'rows':_0x4934d6}:null;}})[_0x97e6('0x1c')](respondWithResult(_0x2702fa,null))[_0x97e6('0x4c')](handleError(_0x2702fa,null));};exports[_0x97e6('0x59')]=function(_0x4068fc,_0x1fdaec,_0x297429){var _0x593b8d={};var _0x2b689e={};var _0x160c93;var _0x43058c;return db['ServicenowConfiguration'][_0x97e6('0x56')]({'where':{'id':_0x4068fc['params']['id']}})[_0x97e6('0x1c')](handleEntityNotFound(_0x1fdaec,null))[_0x97e6('0x1c')](function(_0x1e4b9f){if(_0x1e4b9f){_0x160c93=_0x1e4b9f;_0x2b689e[_0x97e6('0x3e')]=_[_0x97e6('0x3a')](db[_0x97e6('0x57')][_0x97e6('0x35')]);_0x2b689e[_0x97e6('0x39')]=_['keys'](_0x4068fc[_0x97e6('0x39')]);_0x2b689e['filters']=_['intersection'](_0x2b689e[_0x97e6('0x3e')],_0x2b689e[_0x97e6('0x39')]);_0x593b8d['attributes']=_[_0x97e6('0x3d')](_0x2b689e[_0x97e6('0x3e')],qs[_0x97e6('0x3f')](_0x4068fc[_0x97e6('0x39')][_0x97e6('0x3f')]));_0x593b8d[_0x97e6('0x3c')]=_0x593b8d[_0x97e6('0x3c')][_0x97e6('0x4f')]?_0x593b8d[_0x97e6('0x3c')]:_0x2b689e[_0x97e6('0x3e')];_0x593b8d[_0x97e6('0x42')]=qs[_0x97e6('0x43')](_0x4068fc[_0x97e6('0x39')][_0x97e6('0x43')]);_0x593b8d[_0x97e6('0x44')]=qs[_0x97e6('0x3b')](_[_0x97e6('0x58')](_0x4068fc[_0x97e6('0x39')],_0x2b689e[_0x97e6('0x3b')]));if(_0x4068fc[_0x97e6('0x39')][_0x97e6('0x47')]){_0x593b8d[_0x97e6('0x44')]=_[_0x97e6('0x45')](_0x593b8d[_0x97e6('0x44')],{'$or':_[_0x97e6('0x33')](_0x593b8d[_0x97e6('0x3c')],function(_0x5cb307){var _0x457ff4={};_0x457ff4[_0x5cb307]={'$like':'%'+_0x4068fc[_0x97e6('0x39')]['filter']+'%'};return _0x457ff4;})});}_0x593b8d=_['merge']({},_0x593b8d,_0x4068fc[_0x97e6('0x48')]);return _0x160c93[_0x97e6('0x59')](_0x593b8d);}})[_0x97e6('0x1c')](function(_0x2b65ad){if(_0x2b65ad){_0x43058c=_0x2b65ad[_0x97e6('0x4f')];if(!_0x4068fc['query'][_0x97e6('0x40')](_0x97e6('0x41'))){_0x593b8d[_0x97e6('0x2a')]=qs[_0x97e6('0x2a')](_0x4068fc[_0x97e6('0x39')][_0x97e6('0x2a')]);_0x593b8d[_0x97e6('0x29')]=qs['offset'](_0x4068fc['query']['offset']);}return _0x160c93[_0x97e6('0x59')](_0x593b8d);}})[_0x97e6('0x1c')](function(_0x284252){if(_0x284252){return _0x284252?{'count':_0x43058c,'rows':_0x284252}:null;}})[_0x97e6('0x1c')](respondWithResult(_0x1fdaec,null))[_0x97e6('0x4c')](handleError(_0x1fdaec,null));};exports[_0x97e6('0x5a')]=function(_0x1fad74,_0xf4426e,_0x16500c){var _0x33c439={};var _0xe5314={};var _0x411161;var _0x4242c6;return db[_0x97e6('0x34')]['findOne']({'where':{'id':_0x1fad74['params']['id']}})[_0x97e6('0x1c')](handleEntityNotFound(_0xf4426e,null))['then'](function(_0x1ca4b7){if(_0x1ca4b7){_0x411161=_0x1ca4b7;_0xe5314['model']=_[_0x97e6('0x3a')](db[_0x97e6('0x57')]['rawAttributes']);_0xe5314[_0x97e6('0x39')]=_[_0x97e6('0x3a')](_0x1fad74[_0x97e6('0x39')]);_0xe5314[_0x97e6('0x3b')]=_[_0x97e6('0x3d')](_0xe5314[_0x97e6('0x3e')],_0xe5314[_0x97e6('0x39')]);_0x33c439['attributes']=_['intersection'](_0xe5314[_0x97e6('0x3e')],qs[_0x97e6('0x3f')](_0x1fad74[_0x97e6('0x39')][_0x97e6('0x3f')]));_0x33c439[_0x97e6('0x3c')]=_0x33c439[_0x97e6('0x3c')][_0x97e6('0x4f')]?_0x33c439[_0x97e6('0x3c')]:_0xe5314[_0x97e6('0x3e')];_0x33c439[_0x97e6('0x42')]=qs['sort'](_0x1fad74[_0x97e6('0x39')]['sort']);_0x33c439[_0x97e6('0x44')]=qs[_0x97e6('0x3b')](_[_0x97e6('0x58')](_0x1fad74[_0x97e6('0x39')],_0xe5314[_0x97e6('0x3b')]));if(_0x1fad74[_0x97e6('0x39')][_0x97e6('0x47')]){_0x33c439[_0x97e6('0x44')]=_[_0x97e6('0x45')](_0x33c439[_0x97e6('0x44')],{'$or':_[_0x97e6('0x33')](_0x33c439[_0x97e6('0x3c')],function(_0x252b9b){var _0x5e8d9e={};_0x5e8d9e[_0x252b9b]={'$like':'%'+_0x1fad74[_0x97e6('0x39')][_0x97e6('0x47')]+'%'};return _0x5e8d9e;})});}_0x33c439=_[_0x97e6('0x45')]({},_0x33c439,_0x1fad74[_0x97e6('0x48')]);return _0x411161['getDescriptions'](_0x33c439);}})['then'](function(_0x184f69){if(_0x184f69){_0x4242c6=_0x184f69[_0x97e6('0x4f')];if(!_0x1fad74[_0x97e6('0x39')][_0x97e6('0x40')](_0x97e6('0x41'))){_0x33c439[_0x97e6('0x2a')]=qs[_0x97e6('0x2a')](_0x1fad74[_0x97e6('0x39')][_0x97e6('0x2a')]);_0x33c439[_0x97e6('0x29')]=qs['offset'](_0x1fad74[_0x97e6('0x39')][_0x97e6('0x29')]);}return _0x411161['getDescriptions'](_0x33c439);}})[_0x97e6('0x1c')](function(_0x108733){if(_0x108733){return _0x108733?{'count':_0x4242c6,'rows':_0x108733}:null;}})[_0x97e6('0x1c')](respondWithResult(_0xf4426e,null))[_0x97e6('0x4c')](handleError(_0xf4426e,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 01c51ef..6699e1b 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 _0xaded=['int_servicenow_configurations','lodash','../../config/logger','moment','request-promise','path','./intServicenowConfiguration.attributes','define','ServicenowConfiguration'];(function(_0x178693,_0xb4ad94){var _0x3172f0=function(_0x230c2b){while(--_0x230c2b){_0x178693['push'](_0x178693['shift']());}};_0x3172f0(++_0xb4ad94);}(_0xaded,0x88));var _0xdade=function(_0x2fd05d,_0x22cb2e){_0x2fd05d=_0x2fd05d-0x0;var _0xe2bbef=_0xaded[_0x2fd05d];return _0xe2bbef;};'use strict';var _=require(_0xdade('0x0'));var util=require('util');var logger=require(_0xdade('0x1'))('api');var moment=require(_0xdade('0x2'));var BPromise=require('bluebird');var rp=require(_0xdade('0x3'));var fs=require('fs');var path=require(_0xdade('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdade('0x5'));module['exports']=function(_0x39197d,_0x5634dd){return _0x39197d[_0xdade('0x6')](_0xdade('0x7'),attributes,{'tableName':_0xdade('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6889=['exports','ServicenowConfiguration','int_servicenow_configurations','util','../../config/logger','api','bluebird','path','rimraf','./intServicenowConfiguration.attributes'];(function(_0x55def7,_0x3b3564){var _0x4a8c60=function(_0x3edb3b){while(--_0x3edb3b){_0x55def7['push'](_0x55def7['shift']());}};_0x4a8c60(++_0x3b3564);}(_0x6889,0xfd));var _0x9688=function(_0x5b328a,_0x5c48bc){_0x5b328a=_0x5b328a-0x0;var _0xfcf474=_0x6889[_0x5b328a];return _0xfcf474;};'use strict';var _=require('lodash');var util=require(_0x9688('0x0'));var logger=require(_0x9688('0x1'))(_0x9688('0x2'));var moment=require('moment');var BPromise=require(_0x9688('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9688('0x4'));var rimraf=require(_0x9688('0x5'));var config=require('../../config/environment');var attributes=require(_0x9688('0x6'));module[_0x9688('0x7')]=function(_0xaeccb3,_0xb7f037){return _0xaeccb3['define'](_0x9688('0x8'),attributes,{'tableName':_0x9688('0x9'),'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 571bc0a..077a19a 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 _0x1198=['error','code','message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5e2c54,_0x65d68e){var _0x71e591=function(_0x1f4468){while(--_0x1f4468){_0x5e2c54['push'](_0x5e2c54['shift']());}};_0x71e591(++_0x65d68e);}(_0x1198,0x9c));var _0x8119=function(_0x593bb5,_0x20506b){_0x593bb5=_0x593bb5-0x0;var _0x416968=_0x1198[_0x593bb5];return _0x416968;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8119('0x0'));var rs=require(_0x8119('0x1'));var fs=require('fs');var Redis=require(_0x8119('0x2'));var db=require(_0x8119('0x3'))['db'];var utils=require(_0x8119('0x4'));var logger=require(_0x8119('0x5'))(_0x8119('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8119('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x369643,_0x1430fe,_0x4c8fef){return new BPromise(function(_0x4fdf0e,_0x505a80){return client[_0x8119('0x8')](_0x369643,_0x4c8fef)[_0x8119('0x9')](function(_0x585db8){logger[_0x8119('0xa')](_0x8119('0xb'),_0x1430fe,'request\x20sent');logger['debug'](_0x8119('0xc'),_0x1430fe,_0x8119('0xd'),JSON[_0x8119('0xe')](_0x585db8));if(_0x585db8[_0x8119('0xf')]){if(_0x585db8['error'][_0x8119('0x10')]===0x1f4){logger[_0x8119('0xf')](_0x8119('0xb'),_0x1430fe,_0x585db8['error']['message']);return _0x505a80(_0x585db8[_0x8119('0xf')][_0x8119('0x11')]);}logger[_0x8119('0xf')](_0x8119('0xb'),_0x1430fe,_0x585db8[_0x8119('0xf')][_0x8119('0x11')]);return _0x4fdf0e(_0x585db8[_0x8119('0xf')][_0x8119('0x11')]);}else{logger[_0x8119('0xa')](_0x8119('0xb'),_0x1430fe,_0x8119('0xd'));_0x4fdf0e(_0x585db8[_0x8119('0x12')][_0x8119('0x11')]);}})['catch'](function(_0x379858){logger[_0x8119('0xf')](_0x8119('0xb'),_0x1430fe,_0x379858);_0x505a80(_0x379858);});});} \ No newline at end of file +var _0xe80a=['http','request','info','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowConfiguration,\x20%s,\x20%s','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x35e009,_0x2b4c6c){var _0xf1d31=function(_0x164bcf){while(--_0x164bcf){_0x35e009['push'](_0x35e009['shift']());}};_0xf1d31(++_0x2b4c6c);}(_0xe80a,0x1de));var _0xae80=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xe80a[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0xae80('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xae80('0x1'));var rs=require(_0xae80('0x2'));var fs=require('fs');var Redis=require(_0xae80('0x3'));var db=require(_0xae80('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xae80('0x5'))(_0xae80('0x6'));var config=require(_0xae80('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xae80('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x8a960d,_0x46d797,_0x24740d){return new BPromise(function(_0x3cc77a,_0xd5ae57){return client[_0xae80('0x9')](_0x8a960d,_0x24740d)['then'](function(_0x494025){logger[_0xae80('0xa')]('ServicenowConfiguration,\x20%s,\x20%s',_0x46d797,_0xae80('0xb'));logger['debug'](_0xae80('0xc'),_0x46d797,_0xae80('0xb'),JSON[_0xae80('0xd')](_0x494025));if(_0x494025[_0xae80('0xe')]){if(_0x494025[_0xae80('0xe')]['code']===0x1f4){logger[_0xae80('0xe')](_0xae80('0xf'),_0x46d797,_0x494025[_0xae80('0xe')][_0xae80('0x10')]);return _0xd5ae57(_0x494025[_0xae80('0xe')][_0xae80('0x10')]);}logger[_0xae80('0xe')](_0xae80('0xf'),_0x46d797,_0x494025['error'][_0xae80('0x10')]);return _0x3cc77a(_0x494025[_0xae80('0xe')][_0xae80('0x10')]);}else{logger[_0xae80('0xa')](_0xae80('0xf'),_0x46d797,'request\x20sent');_0x3cc77a(_0x494025[_0xae80('0x11')]['message']);}})['catch'](function(_0x1038cf){logger[_0xae80('0xe')](_0xae80('0xf'),_0x46d797,_0x1038cf);_0xd5ae57(_0x1038cf);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 55c0b0b..25e05c8 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 _0x2ddb=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','put','/:id','update','destroy','exports','multer','util','path','express','Router'];(function(_0x35007a,_0x58a0d4){var _0x574f68=function(_0xd1c129){while(--_0xd1c129){_0x35007a['push'](_0x35007a['shift']());}};_0x574f68(++_0x58a0d4);}(_0x2ddb,0x8b));var _0xb2dd=function(_0x1368cb,_0x39ec61){_0x1368cb=_0x1368cb-0x0;var _0xffca30=_0x2ddb[_0x1368cb];return _0xffca30;};'use strict';var multer=require(_0xb2dd('0x0'));var util=require(_0xb2dd('0x1'));var path=require(_0xb2dd('0x2'));var timeout=require('connect-timeout');var express=require(_0xb2dd('0x3'));var router=express[_0xb2dd('0x4')]();var auth=require(_0xb2dd('0x5'));var interaction=require(_0xb2dd('0x6'));var config=require(_0xb2dd('0x7'));var controller=require('./intServicenowField.controller');router[_0xb2dd('0x8')]('/',auth[_0xb2dd('0x9')](),controller[_0xb2dd('0xa')]);router[_0xb2dd('0x8')]('/:id',auth[_0xb2dd('0x9')](),controller[_0xb2dd('0xb')]);router[_0xb2dd('0xc')]('/',auth[_0xb2dd('0x9')](),controller['create']);router[_0xb2dd('0xd')](_0xb2dd('0xe'),auth[_0xb2dd('0x9')](),controller[_0xb2dd('0xf')]);router['delete'](_0xb2dd('0xe'),auth['isAuthenticated'](),controller[_0xb2dd('0x10')]);module[_0xb2dd('0x11')]=router; \ No newline at end of file +var _0x2a7e=['show','post','create','update','util','connect-timeout','express','Router','../../components/auth/service','isAuthenticated','index','/:id'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x2a7e,0x70));var _0xe2a7=function(_0x610007,_0x4d9930){_0x610007=_0x610007-0x0;var _0xfc06e9=_0x2a7e[_0x610007];return _0xfc06e9;};'use strict';var multer=require('multer');var util=require(_0xe2a7('0x0'));var path=require('path');var timeout=require(_0xe2a7('0x1'));var express=require(_0xe2a7('0x2'));var router=express[_0xe2a7('0x3')]();var auth=require(_0xe2a7('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router['get']('/',auth[_0xe2a7('0x5')](),controller[_0xe2a7('0x6')]);router['get'](_0xe2a7('0x7'),auth['isAuthenticated'](),controller[_0xe2a7('0x8')]);router[_0xe2a7('0x9')]('/',auth['isAuthenticated'](),controller[_0xe2a7('0xa')]);router['put'](_0xe2a7('0x7'),auth[_0xe2a7('0x5')](),controller[_0xe2a7('0xb')]);router['delete'](_0xe2a7('0x7'),auth[_0xe2a7('0x5')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 1d07950..b34322b 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 _0x976a=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','string','STRING'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x976a,0xf4));var _0xa976=function(_0x9d53fb,_0x4b898b){_0x9d53fb=_0x9d53fb-0x0;var _0x12f955=_0x976a[_0x9d53fb];return _0x12f955;};'use strict';var Sequelize=require(_0xa976('0x0'));module[_0xa976('0x1')]={'type':{'type':Sequelize[_0xa976('0x2')]('string',_0xa976('0x3'),_0xa976('0x4'),_0xa976('0x5')),'defaultValue':_0xa976('0x6')},'content':{'type':Sequelize[_0xa976('0x7')]},'key':{'type':Sequelize[_0xa976('0x7')]},'keyType':{'type':Sequelize[_0xa976('0x2')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xa976('0x7')]},'idField':{'type':Sequelize[_0xa976('0x7')]},'nameField':{'type':Sequelize[_0xa976('0x7')]},'customField':{'type':Sequelize[_0xa976('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa976('0x7')]}}; \ No newline at end of file +var _0x7846=['exports','ENUM','variable','string','STRING','customVariable','BOOLEAN','sequelize'];(function(_0x3644b9,_0x5cd3a6){var _0x4d196d=function(_0x2bb4ef){while(--_0x2bb4ef){_0x3644b9['push'](_0x3644b9['shift']());}};_0x4d196d(++_0x5cd3a6);}(_0x7846,0xbf));var _0x6784=function(_0x47a5bd,_0x508329){_0x47a5bd=_0x47a5bd-0x0;var _0x5c2184=_0x7846[_0x47a5bd];return _0x5c2184;};'use strict';var Sequelize=require(_0x6784('0x0'));module[_0x6784('0x1')]={'type':{'type':Sequelize[_0x6784('0x2')]('string',_0x6784('0x3'),'customVariable','keyValue'),'defaultValue':_0x6784('0x4')},'content':{'type':Sequelize[_0x6784('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6784('0x2')](_0x6784('0x4'),_0x6784('0x3'),_0x6784('0x6'))},'keyContent':{'type':Sequelize[_0x6784('0x5')]},'idField':{'type':Sequelize[_0x6784('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6784('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6784('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index aa5595f..e772553 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 _0x143a=['include','findAll','rows','catch','params','keys','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','save','update','destroy','error','stack','name','send','index','ServicenowField','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','length','attributes','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','then','includeAll'];(function(_0x410f5b,_0x1ced96){var _0x227ad9=function(_0x22fb17){while(--_0x22fb17){_0x410f5b['push'](_0x410f5b['shift']());}};_0x227ad9(++_0x1ced96);}(_0x143a,0x1b9));var _0xa143=function(_0x16ab75,_0x2143a6){_0x16ab75=_0x16ab75-0x0;var _0xb88c63=_0x143a[_0x16ab75];return _0xb88c63;};'use strict';var pdf=require(_0xa143('0x0'));var emlformat=require(_0xa143('0x1'));var rimraf=require(_0xa143('0x2'));var zipdir=require(_0xa143('0x3'));var jsonpatch=require(_0xa143('0x4'));var rp=require('request-promise');var moment=require(_0xa143('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa143('0x6'));var util=require('util');var path=require(_0xa143('0x7'));var sox=require(_0xa143('0x8'));var csv=require(_0xa143('0x9'));var ejs=require(_0xa143('0xa'));var fs=require('fs');var _=require(_0xa143('0xb'));var squel=require(_0xa143('0xc'));var crypto=require(_0xa143('0xd'));var jsforce=require(_0xa143('0xe'));var deskjs=require(_0xa143('0xf'));var toCsv=require(_0xa143('0x9'));var querystring=require(_0xa143('0x10'));var Papa=require(_0xa143('0x11'));var Redis=require('ioredis');var authService=require(_0xa143('0x12'));var qs=require(_0xa143('0x13'));var as=require(_0xa143('0x14'));var hardwareService=require(_0xa143('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xa143('0x16'));var config=require(_0xa143('0x17'));var licenseUtil=require(_0xa143('0x18'));var db=require(_0xa143('0x19'))['db'];function respondWithStatusCode(_0xc3cc21,_0x3a5c00){_0x3a5c00=_0x3a5c00||0xcc;return function(_0x226303){if(_0x226303){return _0xc3cc21[_0xa143('0x1a')](_0x3a5c00);}return _0xc3cc21[_0xa143('0x1b')](_0x3a5c00)[_0xa143('0x1c')]();};}function respondWithResult(_0x49807f,_0x1988fe){_0x1988fe=_0x1988fe||0xc8;return function(_0x29146e){if(_0x29146e){return _0x49807f[_0xa143('0x1b')](_0x1988fe)[_0xa143('0x1d')](_0x29146e);}};}function respondWithFilteredResult(_0x4318c1,_0x47d554){return function(_0x72f2c7){if(_0x72f2c7){var _0x3f2771=_0x72f2c7[_0xa143('0x1e')],_0x3e6572=_0x47d554[_0xa143('0x1f')],_0x5aab5f=_0x47d554['offset']+_0x47d554[_0xa143('0x20')],_0x4935ad;if(_0x5aab5f>=_0x3f2771){_0x5aab5f=_0x3f2771;_0x4935ad=0xc8;}else{_0x4935ad=0xce;}_0x4318c1[_0xa143('0x1b')](_0x4935ad);return _0x4318c1['set']('Content-Range',_0x3e6572+'-'+_0x5aab5f+'/'+_0x3f2771)[_0xa143('0x1d')](_0x72f2c7);}return null;};}function patchUpdates(_0x147a4d){return function(_0xae3471){try{jsonpatch['apply'](_0xae3471,_0x147a4d,!![]);}catch(_0x3d6453){return BPromise['reject'](_0x3d6453);}return _0xae3471[_0xa143('0x21')]();};}function saveUpdates(_0x25254a,_0x27d8a8){return function(_0xedb252){if(_0xedb252){return _0xedb252[_0xa143('0x22')](_0x25254a)['then'](function(_0x3170b2){return _0x3170b2;});}return null;};}function removeEntity(_0x3a1998,_0x51eb32){return function(_0x419024){if(_0x419024){return _0x419024[_0xa143('0x23')]()['then'](function(){_0x3a1998[_0xa143('0x1b')](0xcc)[_0xa143('0x1c')]();});}};}function handleEntityNotFound(_0x320f20,_0x317b5f){return function(_0x474000){if(!_0x474000){_0x320f20[_0xa143('0x1a')](0x194);}return _0x474000;};}function handleError(_0x26b7f1,_0x10def0){_0x10def0=_0x10def0||0x1f4;return function(_0x2467ac){logger[_0xa143('0x24')](_0x2467ac[_0xa143('0x25')]);if(_0x2467ac['name']){delete _0x2467ac[_0xa143('0x26')];}_0x26b7f1['status'](_0x10def0)[_0xa143('0x27')](_0x2467ac);};}exports[_0xa143('0x28')]=function(_0x422e04,_0x4fc21e){var _0x5b68e0={},_0x565580={},_0x533e13={'count':0x0,'rows':[]};var _0x1fc193=_['map'](db[_0xa143('0x29')][_0xa143('0x2a')],function(_0xb6144c){return{'name':_0xb6144c[_0xa143('0x2b')],'type':_0xb6144c[_0xa143('0x2c')]['key']};});_0x565580[_0xa143('0x2d')]=_[_0xa143('0x2e')](_0x1fc193,'name');_0x565580['query']=_['keys'](_0x422e04[_0xa143('0x2f')]);_0x565580[_0xa143('0x30')]=_[_0xa143('0x31')](_0x565580[_0xa143('0x2d')],_0x565580[_0xa143('0x2f')]);_0x5b68e0['attributes']=_[_0xa143('0x31')](_0x565580[_0xa143('0x2d')],qs[_0xa143('0x32')](_0x422e04[_0xa143('0x2f')][_0xa143('0x32')]));_0x5b68e0['attributes']=_0x5b68e0['attributes'][_0xa143('0x33')]?_0x5b68e0[_0xa143('0x34')]:_0x565580[_0xa143('0x2d')];if(!_0x422e04[_0xa143('0x2f')]['hasOwnProperty'](_0xa143('0x35'))){_0x5b68e0['limit']=qs[_0xa143('0x20')](_0x422e04[_0xa143('0x2f')][_0xa143('0x20')]);_0x5b68e0[_0xa143('0x1f')]=qs[_0xa143('0x1f')](_0x422e04[_0xa143('0x2f')]['offset']);}_0x5b68e0['order']=qs['sort'](_0x422e04['query'][_0xa143('0x36')]);_0x5b68e0[_0xa143('0x37')]=qs[_0xa143('0x30')](_[_0xa143('0x38')](_0x422e04[_0xa143('0x2f')],_0x565580[_0xa143('0x30')]),_0x1fc193);if(_0x422e04[_0xa143('0x2f')][_0xa143('0x39')]){_0x5b68e0[_0xa143('0x37')]=_['merge'](_0x5b68e0[_0xa143('0x37')],{'$or':_['map'](_0x1fc193,function(_0x26bc2f){if(_0x26bc2f[_0xa143('0x2c')]!==_0xa143('0x3a')){var _0x2ddc21={};_0x2ddc21[_0x26bc2f[_0xa143('0x26')]]={'$like':'%'+_0x422e04['query'][_0xa143('0x39')]+'%'};return _0x2ddc21;}})});}_0x5b68e0=_[_0xa143('0x3b')]({},_0x5b68e0,_0x422e04[_0xa143('0x3c')]);var _0x342eac={'where':_0x5b68e0[_0xa143('0x37')]};return db[_0xa143('0x29')]['count'](_0x342eac)[_0xa143('0x3d')](function(_0x4a6057){_0x533e13[_0xa143('0x1e')]=_0x4a6057;if(_0x422e04[_0xa143('0x2f')][_0xa143('0x3e')]){_0x5b68e0[_0xa143('0x3f')]=[{'all':!![]}];}return db['ServicenowField'][_0xa143('0x40')](_0x5b68e0);})['then'](function(_0x8a24c5){_0x533e13[_0xa143('0x41')]=_0x8a24c5;return _0x533e13;})[_0xa143('0x3d')](respondWithFilteredResult(_0x4fc21e,_0x5b68e0))[_0xa143('0x42')](handleError(_0x4fc21e,null));};exports['show']=function(_0x18a00e,_0x5e2f11){var _0x5218e5={'raw':!![],'where':{'id':_0x18a00e[_0xa143('0x43')]['id']}},_0x172f33={};_0x172f33[_0xa143('0x2d')]=_[_0xa143('0x44')](db[_0xa143('0x29')]['rawAttributes']);_0x172f33[_0xa143('0x2f')]=_[_0xa143('0x44')](_0x18a00e[_0xa143('0x2f')]);_0x172f33['filters']=_[_0xa143('0x31')](_0x172f33['model'],_0x172f33[_0xa143('0x2f')]);_0x5218e5[_0xa143('0x34')]=_[_0xa143('0x31')](_0x172f33[_0xa143('0x2d')],qs[_0xa143('0x32')](_0x18a00e[_0xa143('0x2f')]['fields']));_0x5218e5[_0xa143('0x34')]=_0x5218e5[_0xa143('0x34')][_0xa143('0x33')]?_0x5218e5['attributes']:_0x172f33[_0xa143('0x2d')];if(_0x18a00e['query'][_0xa143('0x3e')]){_0x5218e5[_0xa143('0x3f')]=[{'all':!![]}];}_0x5218e5=_[_0xa143('0x3b')]({},_0x5218e5,_0x18a00e[_0xa143('0x3c')]);return db[_0xa143('0x29')]['find'](_0x5218e5)[_0xa143('0x3d')](handleEntityNotFound(_0x5e2f11,null))['then'](respondWithResult(_0x5e2f11,null))[_0xa143('0x42')](handleError(_0x5e2f11,null));};exports['create']=function(_0x1d461d,_0x10fb5c){return db[_0xa143('0x29')][_0xa143('0x45')](_0x1d461d[_0xa143('0x46')],{})['then'](respondWithResult(_0x10fb5c,0xc9))[_0xa143('0x42')](handleError(_0x10fb5c,null));};exports[_0xa143('0x22')]=function(_0x16c60d,_0x1aef5){if(_0x16c60d[_0xa143('0x46')]['id']){delete _0x16c60d[_0xa143('0x46')]['id'];}return db['ServicenowField'][_0xa143('0x47')]({'where':{'id':_0x16c60d['params']['id']}})[_0xa143('0x3d')](handleEntityNotFound(_0x1aef5,null))[_0xa143('0x3d')](saveUpdates(_0x16c60d[_0xa143('0x46')],null))[_0xa143('0x3d')](respondWithResult(_0x1aef5,null))['catch'](handleError(_0x1aef5,null));};exports[_0xa143('0x23')]=function(_0x27369f,_0x2b8b4a){return db[_0xa143('0x29')][_0xa143('0x47')]({'where':{'id':_0x27369f['params']['id']}})['then'](handleEntityNotFound(_0x2b8b4a,null))[_0xa143('0x3d')](removeEntity(_0x2b8b4a,null))['catch'](handleError(_0x2b8b4a,null));}; \ No newline at end of file +var _0x4e52=['stack','name','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','includeAll','include','findAll','catch','params','keys','merge','options','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x19106c,_0x22da38){var _0xbe5a82=function(_0x45d112){while(--_0x45d112){_0x19106c['push'](_0x19106c['shift']());}};_0xbe5a82(++_0x22da38);}(_0x4e52,0x6e));var _0x24e5=function(_0x1fcab3,_0x2f682a){_0x1fcab3=_0x1fcab3-0x0;var _0x1faa56=_0x4e52[_0x1fcab3];return _0x1faa56;};'use strict';var pdf=require(_0x24e5('0x0'));var emlformat=require(_0x24e5('0x1'));var rimraf=require(_0x24e5('0x2'));var zipdir=require(_0x24e5('0x3'));var jsonpatch=require(_0x24e5('0x4'));var rp=require('request-promise');var moment=require(_0x24e5('0x5'));var BPromise=require(_0x24e5('0x6'));var Mustache=require(_0x24e5('0x7'));var util=require(_0x24e5('0x8'));var path=require('path');var sox=require(_0x24e5('0x9'));var csv=require(_0x24e5('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x24e5('0xb'));var squel=require(_0x24e5('0xc'));var crypto=require(_0x24e5('0xd'));var jsforce=require(_0x24e5('0xe'));var deskjs=require(_0x24e5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x24e5('0x10'));var Papa=require(_0x24e5('0x11'));var Redis=require(_0x24e5('0x12'));var authService=require(_0x24e5('0x13'));var qs=require(_0x24e5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x24e5('0x15'))(_0x24e5('0x16'));var utils=require(_0x24e5('0x17'));var config=require(_0x24e5('0x18'));var licenseUtil=require(_0x24e5('0x19'));var db=require(_0x24e5('0x1a'))['db'];function respondWithStatusCode(_0x42994c,_0xe6ac25){_0xe6ac25=_0xe6ac25||0xcc;return function(_0x5dc4c7){if(_0x5dc4c7){return _0x42994c[_0x24e5('0x1b')](_0xe6ac25);}return _0x42994c[_0x24e5('0x1c')](_0xe6ac25)[_0x24e5('0x1d')]();};}function respondWithResult(_0x5668bd,_0xcdb684){_0xcdb684=_0xcdb684||0xc8;return function(_0x5594de){if(_0x5594de){return _0x5668bd[_0x24e5('0x1c')](_0xcdb684)[_0x24e5('0x1e')](_0x5594de);}};}function respondWithFilteredResult(_0x33f0ee,_0x2c2717){return function(_0x1829de){if(_0x1829de){var _0x4d0a39=_0x1829de[_0x24e5('0x1f')],_0x480887=_0x2c2717[_0x24e5('0x20')],_0x1c1a6b=_0x2c2717['offset']+_0x2c2717[_0x24e5('0x21')],_0x508174;if(_0x1c1a6b>=_0x4d0a39){_0x1c1a6b=_0x4d0a39;_0x508174=0xc8;}else{_0x508174=0xce;}_0x33f0ee[_0x24e5('0x1c')](_0x508174);return _0x33f0ee[_0x24e5('0x22')](_0x24e5('0x23'),_0x480887+'-'+_0x1c1a6b+'/'+_0x4d0a39)[_0x24e5('0x1e')](_0x1829de);}return null;};}function patchUpdates(_0x31aaa6){return function(_0x20e483){try{jsonpatch[_0x24e5('0x24')](_0x20e483,_0x31aaa6,!![]);}catch(_0x569330){return BPromise[_0x24e5('0x25')](_0x569330);}return _0x20e483[_0x24e5('0x26')]();};}function saveUpdates(_0x461fb1,_0x20fdaa){return function(_0x67ee8){if(_0x67ee8){return _0x67ee8[_0x24e5('0x27')](_0x461fb1)[_0x24e5('0x28')](function(_0xce344e){return _0xce344e;});}return null;};}function removeEntity(_0x35ee3d,_0x102157){return function(_0x3625f7){if(_0x3625f7){return _0x3625f7[_0x24e5('0x29')]()[_0x24e5('0x28')](function(){_0x35ee3d[_0x24e5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dbb53,_0x22e3aa){return function(_0x4d567a){if(!_0x4d567a){_0x3dbb53[_0x24e5('0x1b')](0x194);}return _0x4d567a;};}function handleError(_0x48703f,_0x4ac163){_0x4ac163=_0x4ac163||0x1f4;return function(_0x50d72e){logger['error'](_0x50d72e[_0x24e5('0x2a')]);if(_0x50d72e[_0x24e5('0x2b')]){delete _0x50d72e[_0x24e5('0x2b')];}_0x48703f[_0x24e5('0x1c')](_0x4ac163)['send'](_0x50d72e);};}exports[_0x24e5('0x2c')]=function(_0x3d7e02,_0x55ddfb){var _0x18ac44={},_0x4beb71={},_0x295639={'count':0x0,'rows':[]};var _0x45ea8e=_[_0x24e5('0x2d')](db[_0x24e5('0x2e')][_0x24e5('0x2f')],function(_0x41e977){return{'name':_0x41e977[_0x24e5('0x30')],'type':_0x41e977[_0x24e5('0x31')][_0x24e5('0x32')]};});_0x4beb71[_0x24e5('0x33')]=_[_0x24e5('0x2d')](_0x45ea8e,_0x24e5('0x2b'));_0x4beb71[_0x24e5('0x34')]=_['keys'](_0x3d7e02[_0x24e5('0x34')]);_0x4beb71[_0x24e5('0x35')]=_['intersection'](_0x4beb71[_0x24e5('0x33')],_0x4beb71[_0x24e5('0x34')]);_0x18ac44['attributes']=_[_0x24e5('0x36')](_0x4beb71[_0x24e5('0x33')],qs[_0x24e5('0x37')](_0x3d7e02[_0x24e5('0x34')][_0x24e5('0x37')]));_0x18ac44['attributes']=_0x18ac44[_0x24e5('0x38')][_0x24e5('0x39')]?_0x18ac44[_0x24e5('0x38')]:_0x4beb71[_0x24e5('0x33')];if(!_0x3d7e02['query'][_0x24e5('0x3a')](_0x24e5('0x3b'))){_0x18ac44['limit']=qs[_0x24e5('0x21')](_0x3d7e02[_0x24e5('0x34')][_0x24e5('0x21')]);_0x18ac44[_0x24e5('0x20')]=qs[_0x24e5('0x20')](_0x3d7e02['query']['offset']);}_0x18ac44[_0x24e5('0x3c')]=qs[_0x24e5('0x3d')](_0x3d7e02['query']['sort']);_0x18ac44[_0x24e5('0x3e')]=qs[_0x24e5('0x35')](_[_0x24e5('0x3f')](_0x3d7e02[_0x24e5('0x34')],_0x4beb71[_0x24e5('0x35')]),_0x45ea8e);if(_0x3d7e02[_0x24e5('0x34')][_0x24e5('0x40')]){_0x18ac44[_0x24e5('0x3e')]=_['merge'](_0x18ac44['where'],{'$or':_[_0x24e5('0x2d')](_0x45ea8e,function(_0x3efa7b){if(_0x3efa7b['type']!=='VIRTUAL'){var _0x2a8ed7={};_0x2a8ed7[_0x3efa7b['name']]={'$like':'%'+_0x3d7e02['query'][_0x24e5('0x40')]+'%'};return _0x2a8ed7;}})});}_0x18ac44=_['merge']({},_0x18ac44,_0x3d7e02['options']);var _0x20793c={'where':_0x18ac44['where']};return db['ServicenowField'][_0x24e5('0x1f')](_0x20793c)['then'](function(_0xe07da2){_0x295639[_0x24e5('0x1f')]=_0xe07da2;if(_0x3d7e02[_0x24e5('0x34')][_0x24e5('0x41')]){_0x18ac44[_0x24e5('0x42')]=[{'all':!![]}];}return db[_0x24e5('0x2e')][_0x24e5('0x43')](_0x18ac44);})['then'](function(_0x260068){_0x295639['rows']=_0x260068;return _0x295639;})[_0x24e5('0x28')](respondWithFilteredResult(_0x55ddfb,_0x18ac44))[_0x24e5('0x44')](handleError(_0x55ddfb,null));};exports['show']=function(_0x870448,_0x32bbfd){var _0x56b675={'raw':!![],'where':{'id':_0x870448[_0x24e5('0x45')]['id']}},_0x487100={};_0x487100[_0x24e5('0x33')]=_['keys'](db[_0x24e5('0x2e')][_0x24e5('0x2f')]);_0x487100[_0x24e5('0x34')]=_[_0x24e5('0x46')](_0x870448[_0x24e5('0x34')]);_0x487100[_0x24e5('0x35')]=_['intersection'](_0x487100['model'],_0x487100['query']);_0x56b675[_0x24e5('0x38')]=_[_0x24e5('0x36')](_0x487100['model'],qs[_0x24e5('0x37')](_0x870448[_0x24e5('0x34')][_0x24e5('0x37')]));_0x56b675[_0x24e5('0x38')]=_0x56b675[_0x24e5('0x38')][_0x24e5('0x39')]?_0x56b675[_0x24e5('0x38')]:_0x487100[_0x24e5('0x33')];if(_0x870448[_0x24e5('0x34')][_0x24e5('0x41')]){_0x56b675[_0x24e5('0x42')]=[{'all':!![]}];}_0x56b675=_[_0x24e5('0x47')]({},_0x56b675,_0x870448[_0x24e5('0x48')]);return db[_0x24e5('0x2e')]['find'](_0x56b675)[_0x24e5('0x28')](handleEntityNotFound(_0x32bbfd,null))['then'](respondWithResult(_0x32bbfd,null))['catch'](handleError(_0x32bbfd,null));};exports[_0x24e5('0x49')]=function(_0x500785,_0x594f3e){return db[_0x24e5('0x2e')]['create'](_0x500785['body'],{})[_0x24e5('0x28')](respondWithResult(_0x594f3e,0xc9))[_0x24e5('0x44')](handleError(_0x594f3e,null));};exports['update']=function(_0x179fd5,_0x2f7a8b){if(_0x179fd5[_0x24e5('0x4a')]['id']){delete _0x179fd5[_0x24e5('0x4a')]['id'];}return db[_0x24e5('0x2e')]['find']({'where':{'id':_0x179fd5[_0x24e5('0x45')]['id']}})[_0x24e5('0x28')](handleEntityNotFound(_0x2f7a8b,null))[_0x24e5('0x28')](saveUpdates(_0x179fd5[_0x24e5('0x4a')],null))[_0x24e5('0x28')](respondWithResult(_0x2f7a8b,null))[_0x24e5('0x44')](handleError(_0x2f7a8b,null));};exports[_0x24e5('0x29')]=function(_0x238c8d,_0x108c77){return db[_0x24e5('0x2e')][_0x24e5('0x4b')]({'where':{'id':_0x238c8d[_0x24e5('0x45')]['id']}})['then'](handleEntityNotFound(_0x108c77,null))['then'](removeEntity(_0x108c77,null))[_0x24e5('0x44')](handleError(_0x108c77,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 4a8dfdc..66d5d53 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 _0x54ae=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','idField','FieldId','lodash'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0x54ae,0x1c1));var _0xe54a=function(_0x184759,_0x1cc38a){_0x184759=_0x184759-0x0;var _0xf26d5f=_0x54ae[_0x184759];return _0xf26d5f;};'use strict';var _=require(_0xe54a('0x0'));var util=require(_0xe54a('0x1'));var logger=require(_0xe54a('0x2'))(_0xe54a('0x3'));var moment=require('moment');var BPromise=require(_0xe54a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe54a('0x5'));var rimraf=require(_0xe54a('0x6'));var config=require(_0xe54a('0x7'));var attributes=require(_0xe54a('0x8'));module[_0xe54a('0x9')]=function(_0x1de682,_0x2eaa29){return _0x1de682[_0xe54a('0xa')](_0xe54a('0xb'),attributes,{'tableName':_0xe54a('0xc'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xe54a('0xd'),_0xe54a('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf5a8=['path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','FieldId','util','api','moment'];(function(_0x5c930b,_0x2bc82c){var _0x5a5952=function(_0x29b750){while(--_0x29b750){_0x5c930b['push'](_0x5c930b['shift']());}};_0x5a5952(++_0x2bc82c);}(_0xf5a8,0x17d));var _0x8f5a=function(_0x3b632f,_0x453380){_0x3b632f=_0x3b632f-0x0;var _0x10e788=_0xf5a8[_0x3b632f];return _0x10e788;};'use strict';var _=require('lodash');var util=require(_0x8f5a('0x0'));var logger=require('../../config/logger')(_0x8f5a('0x1'));var moment=require(_0x8f5a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8f5a('0x3'));var rimraf=require(_0x8f5a('0x4'));var config=require(_0x8f5a('0x5'));var attributes=require(_0x8f5a('0x6'));module[_0x8f5a('0x7')]=function(_0x5537c9,_0x15dc22){return _0x5537c9[_0x8f5a('0x8')](_0x8f5a('0x9'),attributes,{'tableName':_0x8f5a('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField',_0x8f5a('0xb')],'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 d44ae0b..bceff24 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 _0x8369=['debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','../../mysqldb','rpc','jayson/promise','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent'];(function(_0x273ae9,_0x91023d){var _0x3a0da6=function(_0xcf9cf5){while(--_0xcf9cf5){_0x273ae9['push'](_0x273ae9['shift']());}};_0x3a0da6(++_0x91023d);}(_0x8369,0x1f4));var _0x9836=function(_0x418b44,_0x457196){_0x418b44=_0x418b44-0x0;var _0x5c70ab=_0x8369[_0x418b44];return _0x5c70ab;};'use strict';var _=require(_0x9836('0x0'));var util=require(_0x9836('0x1'));var moment=require(_0x9836('0x2'));var BPromise=require('bluebird');var rs=require(_0x9836('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9836('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9836('0x5'));var config=require('../../config/environment');var jayson=require(_0x9836('0x6'));var client=jayson['client'][_0x9836('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x527c45,_0x173c44,_0x2c1243){return new BPromise(function(_0xc50d60,_0x4369b5){return client[_0x9836('0x8')](_0x527c45,_0x2c1243)[_0x9836('0x9')](function(_0x57da48){logger[_0x9836('0xa')](_0x9836('0xb'),_0x173c44,_0x9836('0xc'));logger[_0x9836('0xd')](_0x9836('0xe'),_0x173c44,_0x9836('0xc'),JSON[_0x9836('0xf')](_0x57da48));if(_0x57da48['error']){if(_0x57da48[_0x9836('0x10')][_0x9836('0x11')]===0x1f4){logger[_0x9836('0x10')](_0x9836('0xb'),_0x173c44,_0x57da48['error'][_0x9836('0x12')]);return _0x4369b5(_0x57da48[_0x9836('0x10')]['message']);}logger[_0x9836('0x10')](_0x9836('0xb'),_0x173c44,_0x57da48[_0x9836('0x10')]['message']);return _0xc50d60(_0x57da48[_0x9836('0x10')][_0x9836('0x12')]);}else{logger[_0x9836('0xa')](_0x9836('0xb'),_0x173c44,_0x9836('0xc'));_0xc50d60(_0x57da48['result'][_0x9836('0x12')]);}})['catch'](function(_0x182128){logger[_0x9836('0x10')](_0x9836('0xb'),_0x173c44,_0x182128);_0x4369b5(_0x182128);});});} \ No newline at end of file +var _0x655a=['http','request','then','info','request\x20sent','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x531909,_0x363da3){var _0x37a71b=function(_0x5734d1){while(--_0x5734d1){_0x531909['push'](_0x531909['shift']());}};_0x37a71b(++_0x363da3);}(_0x655a,0x99));var _0xa655=function(_0x368fe9,_0x2320f6){_0x368fe9=_0x368fe9-0x0;var _0x372b01=_0x655a[_0x368fe9];return _0x372b01;};'use strict';var _=require(_0xa655('0x0'));var util=require(_0xa655('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa655('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xa655('0x3'))(_0xa655('0x4'));var config=require(_0xa655('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xa655('0x6')][_0xa655('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x55cb98,_0x2298fe,_0x2efad8){return new BPromise(function(_0x1e0e1e,_0x42f3cb){return client[_0xa655('0x8')](_0x55cb98,_0x2efad8)[_0xa655('0x9')](function(_0x46bfdd){logger[_0xa655('0xa')]('ServicenowField,\x20%s,\x20%s',_0x2298fe,_0xa655('0xb'));logger['debug'](_0xa655('0xc'),_0x2298fe,_0xa655('0xb'),JSON[_0xa655('0xd')](_0x46bfdd));if(_0x46bfdd[_0xa655('0xe')]){if(_0x46bfdd[_0xa655('0xe')][_0xa655('0xf')]===0x1f4){logger['error'](_0xa655('0x10'),_0x2298fe,_0x46bfdd[_0xa655('0xe')]['message']);return _0x42f3cb(_0x46bfdd[_0xa655('0xe')]['message']);}logger[_0xa655('0xe')](_0xa655('0x10'),_0x2298fe,_0x46bfdd[_0xa655('0xe')][_0xa655('0x11')]);return _0x1e0e1e(_0x46bfdd[_0xa655('0xe')][_0xa655('0x11')]);}else{logger[_0xa655('0xa')](_0xa655('0x10'),_0x2298fe,_0xa655('0xb'));_0x1e0e1e(_0x46bfdd[_0xa655('0x12')]['message']);}})[_0xa655('0x13')](function(_0xe11ab3){logger[_0xa655('0xe')](_0xa655('0x10'),_0x2298fe,_0xe11ab3);_0x42f3cb(_0xe11ab3);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 3bf5ae8..0a284f3 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 _0xbaa9=['post','create','addConfiguration','put','update','delete','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x28734d,_0x4d9ce9){var _0x43bd5f=function(_0x3c114b){while(--_0x3c114b){_0x28734d['push'](_0x28734d['shift']());}};_0x43bd5f(++_0x4d9ce9);}(_0xbaa9,0x188));var _0x9baa=function(_0x43be88,_0x439614){_0x43be88=_0x43be88-0x0;var _0x3d4e6c=_0xbaa9[_0x43be88];return _0x3d4e6c;};'use strict';var multer=require(_0x9baa('0x0'));var util=require('util');var path=require(_0x9baa('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9baa('0x2')]();var auth=require(_0x9baa('0x3'));var interaction=require(_0x9baa('0x4'));var config=require(_0x9baa('0x5'));var controller=require(_0x9baa('0x6'));router[_0x9baa('0x7')]('/',auth['isAuthenticated'](),controller[_0x9baa('0x8')]);router['get'](_0x9baa('0x9'),auth[_0x9baa('0xa')](),controller[_0x9baa('0xb')]);router[_0x9baa('0x7')](_0x9baa('0xc'),auth['isAuthenticated'](),controller[_0x9baa('0xd')]);router[_0x9baa('0x7')](_0x9baa('0xe'),auth[_0x9baa('0xa')](),controller[_0x9baa('0xf')]);router[_0x9baa('0x10')]('/',auth[_0x9baa('0xa')](),controller[_0x9baa('0x11')]);router['post'](_0x9baa('0xc'),auth[_0x9baa('0xa')](),controller[_0x9baa('0x12')]);router[_0x9baa('0x13')](_0x9baa('0x9'),auth[_0x9baa('0xa')](),controller[_0x9baa('0x14')]);router[_0x9baa('0x15')](_0x9baa('0x9'),auth[_0x9baa('0xa')](),controller[_0x9baa('0x16')]);module[_0x9baa('0x17')]=router; \ No newline at end of file +var _0x585b=['util','express','../../components/auth/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','update','delete','destroy','multer'];(function(_0x517869,_0x1f383b){var _0x2e6dd7=function(_0x550e2e){while(--_0x550e2e){_0x517869['push'](_0x517869['shift']());}};_0x2e6dd7(++_0x1f383b);}(_0x585b,0x1af));var _0xb585=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x585b[_0x50007c];return _0x5c1ec7;};'use strict';var multer=require(_0xb585('0x0'));var util=require(_0xb585('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb585('0x2'));var router=express['Router']();var auth=require(_0xb585('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmAccount.controller');router[_0xb585('0x4')]('/',auth[_0xb585('0x5')](),controller[_0xb585('0x6')]);router[_0xb585('0x4')](_0xb585('0x7'),auth['isAuthenticated'](),controller[_0xb585('0x8')]);router['get'](_0xb585('0x9'),auth[_0xb585('0x5')](),controller[_0xb585('0xa')]);router[_0xb585('0x4')](_0xb585('0xb'),auth[_0xb585('0x5')](),controller['getFields']);router[_0xb585('0xc')]('/',auth[_0xb585('0x5')](),controller[_0xb585('0xd')]);router[_0xb585('0xc')](_0xb585('0x9'),auth['isAuthenticated'](),controller[_0xb585('0xe')]);router['put'](_0xb585('0x7'),auth['isAuthenticated'](),controller[_0xb585('0xf')]);router[_0xb585('0x10')](_0xb585('0x7'),auth[_0xb585('0x5')](),controller[_0xb585('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index f19342c..b2b4611 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 _0x0490=['STRING','username','remoteUri','exports'];(function(_0x29424b,_0x13c4d5){var _0x370548=function(_0x20dac0){while(--_0x20dac0){_0x29424b['push'](_0x29424b['shift']());}};_0x370548(++_0x13c4d5);}(_0x0490,0x137));var _0x0049=function(_0x27fd15,_0x553a8d){_0x27fd15=_0x27fd15-0x0;var _0x12b06c=_0x0490[_0x27fd15];return _0x12b06c;};'use strict';var Sequelize=require('sequelize');module[_0x0049('0x0')]={'name':{'type':Sequelize[_0x0049('0x1')]},'description':{'type':Sequelize[_0x0049('0x1')]},'username':{'type':Sequelize[_0x0049('0x1')],'unique':_0x0049('0x2')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0049('0x1')],'unique':_0x0049('0x3')},'serverUrl':{'type':Sequelize[_0x0049('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x2da7=['sequelize','exports','STRING','username','remoteUri'];(function(_0x2ff38b,_0x954968){var _0x306c49=function(_0x46230b){while(--_0x46230b){_0x2ff38b['push'](_0x2ff38b['shift']());}};_0x306c49(++_0x954968);}(_0x2da7,0x1cc));var _0x72da=function(_0x3036f1,_0x1801fa){_0x3036f1=_0x3036f1-0x0;var _0x28d2c7=_0x2da7[_0x3036f1];return _0x28d2c7;};'use strict';var Sequelize=require(_0x72da('0x0'));module[_0x72da('0x1')]={'name':{'type':Sequelize[_0x72da('0x2')]},'description':{'type':Sequelize[_0x72da('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x72da('0x3')},'password':{'type':Sequelize[_0x72da('0x2')]},'remoteUri':{'type':Sequelize[_0x72da('0x2')],'unique':_0x72da('0x4')},'serverUrl':{'type':Sequelize[_0x72da('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 0253b18..f01214a 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 _0x3f26=['addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','direction','username','password','slice','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','POST','get_module_fields','Calls','module_fields','remove','includes','label','endsWith','values','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','apply','destroy','end','name','send','SugarcrmAccount','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','update','getConfigurations','findOne','options'];(function(_0x27d0d6,_0xc29871){var _0x8c2773=function(_0x39db79){while(--_0x39db79){_0x27d0d6['push'](_0x27d0d6['shift']());}};_0x8c2773(++_0xc29871);}(_0x3f26,0x1a6));var _0x63f2=function(_0x5a4c25,_0x332e73){_0x5a4c25=_0x5a4c25-0x0;var _0xbd8c49=_0x3f26[_0x5a4c25];return _0xbd8c49;};'use strict';var pdf=require(_0x63f2('0x0'));var emlformat=require(_0x63f2('0x1'));var rimraf=require(_0x63f2('0x2'));var zipdir=require(_0x63f2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x63f2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x63f2('0x5'));var util=require(_0x63f2('0x6'));var path=require(_0x63f2('0x7'));var sox=require(_0x63f2('0x8'));var csv=require(_0x63f2('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x63f2('0xa'));var squel=require(_0x63f2('0xb'));var crypto=require(_0x63f2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x63f2('0xd'));var toCsv=require(_0x63f2('0x9'));var querystring=require(_0x63f2('0xe'));var Papa=require(_0x63f2('0xf'));var Redis=require(_0x63f2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x63f2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x63f2('0x12'));var logger=require(_0x63f2('0x13'))(_0x63f2('0x14'));var utils=require('../../config/utils');var config=require(_0x63f2('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x63f2('0x16'));var jayson=require(_0x63f2('0x17'));var client=jayson[_0x63f2('0x18')][_0x63f2('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x22eaf6,_0x3d526d,_0x3dab8f,_0x223332){return new BPromise(function(_0x3c59fa,_0xfe0054){var _0x2a5e20=_0x223332||client;return _0x2a5e20[_0x63f2('0x1a')](_0x22eaf6,_0x3dab8f)[_0x63f2('0x1b')](function(_0x103ea4){logger[_0x63f2('0x1c')](_0x63f2('0x1d'),_0x3d526d,'request\x20sent');logger[_0x63f2('0x1e')](_0x63f2('0x1f'),_0x3d526d,'request\x20sent',JSON['stringify'](_0x103ea4));if(_0x103ea4[_0x63f2('0x20')]){if(_0x103ea4['error']['code']===0x1f4){logger[_0x63f2('0x20')](_0x63f2('0x1d'),_0x3d526d,_0x103ea4['error'][_0x63f2('0x21')]);return _0xfe0054(_0x103ea4['error'][_0x63f2('0x21')]);}logger[_0x63f2('0x20')](_0x63f2('0x1d'),_0x3d526d,_0x103ea4[_0x63f2('0x20')][_0x63f2('0x21')]);return _0x3c59fa(_0x103ea4[_0x63f2('0x20')][_0x63f2('0x21')]);}else{logger[_0x63f2('0x1c')](_0x63f2('0x1d'),_0x3d526d,'request\x20sent');_0x3c59fa(_0x103ea4[_0x63f2('0x22')][_0x63f2('0x21')]);}})[_0x63f2('0x23')](function(_0x4abcf2){logger[_0x63f2('0x20')]('SugarcrmAccount,\x20%s,\x20%s',_0x3d526d,_0x4abcf2);_0xfe0054(_0x4abcf2);});});}function respondWithStatusCode(_0x29fc52,_0x2ce63f){_0x2ce63f=_0x2ce63f||0xcc;return function(_0x283c3c){if(_0x283c3c){return _0x29fc52[_0x63f2('0x24')](_0x2ce63f);}return _0x29fc52[_0x63f2('0x25')](_0x2ce63f)['end']();};}function respondWithResult(_0x4a2ded,_0x589e22){_0x589e22=_0x589e22||0xc8;return function(_0x58b260){if(_0x58b260){return _0x4a2ded[_0x63f2('0x25')](_0x589e22)['json'](_0x58b260);}};}function respondWithFilteredResult(_0x57739c,_0x57f27b){return function(_0x3237e3){if(_0x3237e3){var _0x46066e=_0x3237e3[_0x63f2('0x26')],_0x3da56c=_0x57f27b[_0x63f2('0x27')],_0x38b65a=_0x57f27b['offset']+_0x57f27b[_0x63f2('0x28')],_0x9a9cf8;if(_0x38b65a>=_0x46066e){_0x38b65a=_0x46066e;_0x9a9cf8=0xc8;}else{_0x9a9cf8=0xce;}_0x57739c[_0x63f2('0x25')](_0x9a9cf8);return _0x57739c[_0x63f2('0x29')](_0x63f2('0x2a'),_0x3da56c+'-'+_0x38b65a+'/'+_0x46066e)['json'](_0x3237e3);}return null;};}function patchUpdates(_0x589dd8){return function(_0x2a45eb){try{jsonpatch[_0x63f2('0x2b')](_0x2a45eb,_0x589dd8,!![]);}catch(_0x1a9bed){return BPromise['reject'](_0x1a9bed);}return _0x2a45eb['save']();};}function saveUpdates(_0x102f1e,_0x490313){return function(_0x490549){if(_0x490549){return _0x490549['update'](_0x102f1e)[_0x63f2('0x1b')](function(_0x4573e9){return _0x4573e9;});}return null;};}function removeEntity(_0x21b85b,_0x4c4a23){return function(_0x237663){if(_0x237663){return _0x237663[_0x63f2('0x2c')]()[_0x63f2('0x1b')](function(){_0x21b85b[_0x63f2('0x25')](0xcc)[_0x63f2('0x2d')]();});}};}function handleEntityNotFound(_0x365a19,_0x127760){return function(_0x5bfe2b){if(!_0x5bfe2b){_0x365a19['sendStatus'](0x194);}return _0x5bfe2b;};}function handleError(_0x197c9d,_0x454d8b){_0x454d8b=_0x454d8b||0x1f4;return function(_0x47af0a){logger[_0x63f2('0x20')](_0x47af0a['stack']);if(_0x47af0a[_0x63f2('0x2e')]){delete _0x47af0a[_0x63f2('0x2e')];}_0x197c9d[_0x63f2('0x25')](_0x454d8b)[_0x63f2('0x2f')](_0x47af0a);};}exports['index']=function(_0xc5cfc7,_0x4f6bb8){var _0x1dc66b={},_0x5b5b60={},_0x3ce130={'count':0x0,'rows':[]};var _0x61ff79=_['map'](db[_0x63f2('0x30')]['rawAttributes'],function(_0x2cdf12){return{'name':_0x2cdf12['fieldName'],'type':_0x2cdf12[_0x63f2('0x31')]['key']};});_0x5b5b60[_0x63f2('0x32')]=_[_0x63f2('0x33')](_0x61ff79,'name');_0x5b5b60[_0x63f2('0x34')]=_[_0x63f2('0x35')](_0xc5cfc7[_0x63f2('0x34')]);_0x5b5b60['filters']=_[_0x63f2('0x36')](_0x5b5b60[_0x63f2('0x32')],_0x5b5b60['query']);_0x1dc66b[_0x63f2('0x37')]=_[_0x63f2('0x36')](_0x5b5b60[_0x63f2('0x32')],qs[_0x63f2('0x38')](_0xc5cfc7[_0x63f2('0x34')][_0x63f2('0x38')]));_0x1dc66b[_0x63f2('0x37')]=_0x1dc66b['attributes'][_0x63f2('0x39')]?_0x1dc66b[_0x63f2('0x37')]:_0x5b5b60['model'];if(!_0xc5cfc7['query'][_0x63f2('0x3a')](_0x63f2('0x3b'))){_0x1dc66b[_0x63f2('0x28')]=qs['limit'](_0xc5cfc7[_0x63f2('0x34')]['limit']);_0x1dc66b[_0x63f2('0x27')]=qs[_0x63f2('0x27')](_0xc5cfc7[_0x63f2('0x34')]['offset']);}_0x1dc66b[_0x63f2('0x3c')]=qs[_0x63f2('0x3d')](_0xc5cfc7[_0x63f2('0x34')][_0x63f2('0x3d')]);_0x1dc66b[_0x63f2('0x3e')]=qs[_0x63f2('0x3f')](_[_0x63f2('0x40')](_0xc5cfc7['query'],_0x5b5b60['filters']),_0x61ff79);if(_0xc5cfc7[_0x63f2('0x34')]['filter']){_0x1dc66b[_0x63f2('0x3e')]=_['merge'](_0x1dc66b[_0x63f2('0x3e')],{'$or':_['map'](_0x61ff79,function(_0x20c381){if(_0x20c381[_0x63f2('0x31')]!==_0x63f2('0x41')){var _0x2cadde={};_0x2cadde[_0x20c381['name']]={'$like':'%'+_0xc5cfc7[_0x63f2('0x34')][_0x63f2('0x42')]+'%'};return _0x2cadde;}})});}_0x1dc66b=_[_0x63f2('0x43')]({},_0x1dc66b,_0xc5cfc7['options']);var _0x4d527f={'where':_0x1dc66b[_0x63f2('0x3e')]};return db[_0x63f2('0x30')][_0x63f2('0x26')](_0x4d527f)[_0x63f2('0x1b')](function(_0x33afee){_0x3ce130[_0x63f2('0x26')]=_0x33afee;if(_0xc5cfc7[_0x63f2('0x34')][_0x63f2('0x44')]){_0x1dc66b[_0x63f2('0x45')]=[{'all':!![]}];}return db[_0x63f2('0x30')][_0x63f2('0x46')](_0x1dc66b);})[_0x63f2('0x1b')](function(_0x3ac99e){_0x3ce130[_0x63f2('0x47')]=_0x3ac99e;return _0x3ce130;})[_0x63f2('0x1b')](respondWithFilteredResult(_0x4f6bb8,_0x1dc66b))[_0x63f2('0x23')](handleError(_0x4f6bb8,null));};exports[_0x63f2('0x48')]=function(_0x4ab637,_0x5a4c8d){var _0x58815c={'raw':![],'where':{'id':_0x4ab637[_0x63f2('0x49')]['id']}},_0x438129={};_0x438129['model']=_[_0x63f2('0x35')](db[_0x63f2('0x30')][_0x63f2('0x4a')]);_0x438129[_0x63f2('0x34')]=_[_0x63f2('0x35')](_0x4ab637[_0x63f2('0x34')]);_0x438129['filters']=_[_0x63f2('0x36')](_0x438129[_0x63f2('0x32')],_0x438129[_0x63f2('0x34')]);_0x58815c[_0x63f2('0x37')]=_[_0x63f2('0x36')](_0x438129[_0x63f2('0x32')],qs[_0x63f2('0x38')](_0x4ab637[_0x63f2('0x34')][_0x63f2('0x38')]));_0x58815c[_0x63f2('0x37')]=_0x58815c['attributes'][_0x63f2('0x39')]?_0x58815c[_0x63f2('0x37')]:_0x438129[_0x63f2('0x32')];if(_0x4ab637[_0x63f2('0x34')]['includeAll']){_0x58815c[_0x63f2('0x45')]=[{'all':!![]}];}_0x58815c=_['merge']({},_0x58815c,_0x4ab637['options']);return db[_0x63f2('0x30')][_0x63f2('0x4b')](_0x58815c)[_0x63f2('0x1b')](handleEntityNotFound(_0x5a4c8d,null))['then'](respondWithResult(_0x5a4c8d,null))[_0x63f2('0x23')](handleError(_0x5a4c8d,null));};exports[_0x63f2('0x4c')]=function(_0x46f33b,_0xc77149){return db[_0x63f2('0x30')]['create'](_0x46f33b[_0x63f2('0x4d')],{})[_0x63f2('0x1b')](respondWithResult(_0xc77149,0xc9))[_0x63f2('0x23')](handleError(_0xc77149,null));};exports[_0x63f2('0x4e')]=function(_0x33eeca,_0x1e4ceb){if(_0x33eeca[_0x63f2('0x4d')]['id']){delete _0x33eeca['body']['id'];}return db[_0x63f2('0x30')]['find']({'where':{'id':_0x33eeca[_0x63f2('0x49')]['id']}})['then'](handleEntityNotFound(_0x1e4ceb,null))[_0x63f2('0x1b')](saveUpdates(_0x33eeca['body'],null))[_0x63f2('0x1b')](respondWithResult(_0x1e4ceb,null))[_0x63f2('0x23')](handleError(_0x1e4ceb,null));};exports[_0x63f2('0x2c')]=function(_0x12c327,_0x10516a){return db[_0x63f2('0x30')][_0x63f2('0x4b')]({'where':{'id':_0x12c327['params']['id']}})['then'](handleEntityNotFound(_0x10516a,null))[_0x63f2('0x1b')](removeEntity(_0x10516a,null))['catch'](handleError(_0x10516a,null));};exports[_0x63f2('0x4f')]=function(_0xccb434,_0x454d5b,_0x1d33bc){var _0x10aebd={};var _0x124484={};var _0x31240a;var _0x535a82;return db[_0x63f2('0x30')][_0x63f2('0x50')]({'where':{'id':_0xccb434[_0x63f2('0x49')]['id']}})[_0x63f2('0x1b')](handleEntityNotFound(_0x454d5b,null))[_0x63f2('0x1b')](function(_0x2eea3c){if(_0x2eea3c){_0x31240a=_0x2eea3c;_0x124484[_0x63f2('0x32')]=_[_0x63f2('0x35')](db['SugarcrmConfiguration']['rawAttributes']);_0x124484[_0x63f2('0x34')]=_['keys'](_0xccb434[_0x63f2('0x34')]);_0x124484[_0x63f2('0x3f')]=_['intersection'](_0x124484[_0x63f2('0x32')],_0x124484[_0x63f2('0x34')]);_0x10aebd[_0x63f2('0x37')]=_['intersection'](_0x124484[_0x63f2('0x32')],qs['fields'](_0xccb434[_0x63f2('0x34')]['fields']));_0x10aebd[_0x63f2('0x37')]=_0x10aebd[_0x63f2('0x37')]['length']?_0x10aebd['attributes']:_0x124484[_0x63f2('0x32')];_0x10aebd['order']=qs['sort'](_0xccb434[_0x63f2('0x34')][_0x63f2('0x3d')]);_0x10aebd[_0x63f2('0x3e')]=qs[_0x63f2('0x3f')](_['pick'](_0xccb434[_0x63f2('0x34')],_0x124484[_0x63f2('0x3f')]));if(_0xccb434['query'][_0x63f2('0x42')]){_0x10aebd[_0x63f2('0x3e')]=_[_0x63f2('0x43')](_0x10aebd[_0x63f2('0x3e')],{'$or':_['map'](_0x10aebd[_0x63f2('0x37')],function(_0x3e3afd){var _0x12676e={};_0x12676e[_0x3e3afd]={'$like':'%'+_0xccb434[_0x63f2('0x34')][_0x63f2('0x42')]+'%'};return _0x12676e;})});}_0x10aebd=_['merge']({},_0x10aebd,_0xccb434[_0x63f2('0x51')]);return _0x31240a[_0x63f2('0x4f')](_0x10aebd);}})[_0x63f2('0x1b')](function(_0x2bd7ad){if(_0x2bd7ad){_0x535a82=_0x2bd7ad[_0x63f2('0x39')];if(!_0xccb434[_0x63f2('0x34')][_0x63f2('0x3a')]('nolimit')){_0x10aebd[_0x63f2('0x28')]=qs[_0x63f2('0x28')](_0xccb434[_0x63f2('0x34')][_0x63f2('0x28')]);_0x10aebd[_0x63f2('0x27')]=qs['offset'](_0xccb434['query'][_0x63f2('0x27')]);}return _0x31240a[_0x63f2('0x4f')](_0x10aebd);}})['then'](function(_0x4afc96){if(_0x4afc96){return _0x4afc96?{'count':_0x535a82,'rows':_0x4afc96}:null;}})[_0x63f2('0x1b')](respondWithResult(_0x454d5b,null))[_0x63f2('0x23')](handleError(_0x454d5b,null));};exports[_0x63f2('0x52')]=function(_0x1d4f2d,_0x46fe4e,_0x4cf4ef){if(_0x1d4f2d[_0x63f2('0x4d')]['id']){delete _0x1d4f2d[_0x63f2('0x4d')]['id'];}return db[_0x63f2('0x30')][_0x63f2('0x50')]({'where':{'id':_0x1d4f2d[_0x63f2('0x49')]['id']}})[_0x63f2('0x1b')](handleEntityNotFound(_0x46fe4e,null))[_0x63f2('0x1b')](function(_0x352c08){if(_0x352c08){_0x1d4f2d['body'][_0x63f2('0x53')]=_0x352c08['id'];_0x1d4f2d[_0x63f2('0x4d')][_0x63f2('0x54')]=integrations['getSubjects'](_0x1d4f2d['body']['channel'],_0x1d4f2d['body'][_0x63f2('0x31')]);_0x1d4f2d[_0x63f2('0x4d')][_0x63f2('0x55')]=integrations[_0x63f2('0x56')](_0x1d4f2d['body'][_0x63f2('0x57')],_0x1d4f2d[_0x63f2('0x4d')][_0x63f2('0x31')]);return db['SugarcrmConfiguration'][_0x63f2('0x4c')](_0x1d4f2d[_0x63f2('0x4d')],{'include':[{'model':db[_0x63f2('0x58')],'as':_0x63f2('0x54')},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0x63f2('0x1b')](respondWithResult(_0x46fe4e,null))[_0x63f2('0x23')](handleError(_0x46fe4e,null));};exports[_0x63f2('0x59')]=function(_0xa239b,_0x12b020,_0xafa1ad){var _0x25e1fb='';var _0x2baf76=['id',_0x63f2('0x2e'),_0x63f2('0x5a'),_0x63f2('0x5b'),_0x63f2('0x5c'),_0x63f2('0x5d'),_0x63f2('0x5e'),_0x63f2('0x5f'),_0x63f2('0x60'),_0x63f2('0x61'),'parent_name',_0x63f2('0x62')];return db[_0x63f2('0x30')][_0x63f2('0x50')]({'where':{'id':_0xa239b[_0x63f2('0x49')]['id']},'attributes':['id',_0x63f2('0x63'),_0x63f2('0x64'),'remoteUri']})[_0x63f2('0x1b')](handleEntityNotFound(_0x12b020,null))['then'](function(_0x72a6aa){if(_0x72a6aa){_0x25e1fb=_0x72a6aa['remoteUri'];var _0x26d0a5=_0x25e1fb[_0x63f2('0x65')](-0x1);if(_0x26d0a5==='/'){_0x25e1fb=_0x25e1fb[_0x63f2('0x66')](0x0,_0x25e1fb[_0x63f2('0x67')](_0x26d0a5));}return rp({'method':'POST','uri':util[_0x63f2('0x68')](_0x63f2('0x69'),_0x25e1fb,_0x63f2('0x6a')),'json':!![],'form':{'method':'login','input_type':_0x63f2('0x6b'),'response_type':_0x63f2('0x6b'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x72a6aa[_0x63f2('0x63')],'password':_0x72a6aa[_0x63f2('0x64')],'encryption':_0x63f2('0x6c')},'application':_0x63f2('0x6d')})}});}})['then'](function(_0x2a6ad1){if(_0x2a6ad1&&_0x2a6ad1[_0x63f2('0x2e')]!==_0x63f2('0x6e')&&_0x2a6ad1[_0x63f2('0x2e')]!=='Password\x20Expired'){return rp({'method':_0x63f2('0x6f'),'uri':util[_0x63f2('0x68')]('%s%s',_0x25e1fb,_0x63f2('0x6a')),'json':!![],'form':{'method':_0x63f2('0x70'),'input_type':_0x63f2('0x6b'),'response_type':_0x63f2('0x6b'),'rest_data':JSON['stringify']({'session':_0x2a6ad1['id'],'module_name':_0x63f2('0x71')})}})[_0x63f2('0x1b')](function(_0x4918a9){if(_0x4918a9){var _0x20c826=_['values'](_0x4918a9[_0x63f2('0x72')]);_[_0x63f2('0x73')](_0x20c826,function(_0x26b97f){return _0x2baf76[_0x63f2('0x74')](_0x26b97f[_0x63f2('0x2e')]);});return{'count':_0x20c826[_0x63f2('0x39')],'rows':_[_0x63f2('0x33')](_0x20c826,function(_0x11e68e){return{'id':_0x11e68e[_0x63f2('0x2e')],'name':_0x11e68e[_0x63f2('0x75')],'custom':_[_0x63f2('0x76')](_0x11e68e[_0x63f2('0x2e')],'_c')?!![]:![],'options':_0x11e68e[_0x63f2('0x51')]?_[_0x63f2('0x33')](_[_0x63f2('0x77')](_0x11e68e[_0x63f2('0x51')]),function(_0x408e9d){return{'name':_0x408e9d[_0x63f2('0x78')],'value':_0x408e9d[_0x63f2('0x2e')]};}):[]};})};}})[_0x63f2('0x1b')](respondWithResult(_0x12b020,null))[_0x63f2('0x23')](function(_0x42a130){var _0x3c1b75=_0xa239b[_0x63f2('0x34')][_0x63f2('0x79')]?0x1f4:_0x42a130[_0x63f2('0x7a')]||0x1f4;logger[_0x63f2('0x20')](_0x63f2('0x7b'),_0x63f2('0x59'),_0x3c1b75,JSON[_0x63f2('0x7c')](_0x42a130));delete _0x42a130['name'];if(_0x3c1b75===0x191){_0x3c1b75=0x190;}_0x12b020[_0x63f2('0x25')](_0x3c1b75)[_0x63f2('0x2f')](_0xa239b[_0x63f2('0x34')]['test']?{'message':_0x63f2('0x7d'),'statusCode':_0x42a130[_0x63f2('0x7a')]}:_0x42a130);});}else{var _0x4e9de7=0x1f4;_0x12b020[_0x63f2('0x25')](_0x4e9de7)[_0x63f2('0x2f')]({'message':_0x63f2('0x7d'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xc691=['jayson/promise','client','http','request','then','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','destroy','stack','name','send','index','map','SugarcrmAccount','type','key','model','keys','intersection','query','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','options','includeAll','include','findAll','show','rawAttributes','fields','find','create','body','params','getConfigurations','findOne','SugarcrmConfiguration','length','filter','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Descriptions','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_name','username','password','remoteUri','slice','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','Calls','module_fields','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','zip-dir','bluebird','mustache','util','sox','to-csv','squel','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration'];(function(_0x22d0b5,_0xa5cd5e){var _0x2ddffc=function(_0x455dc4){while(--_0x455dc4){_0x22d0b5['push'](_0x22d0b5['shift']());}};_0x2ddffc(++_0xa5cd5e);}(_0xc691,0x1e0));var _0x1c69=function(_0xa26624,_0x5ba8cd){_0xa26624=_0xa26624-0x0;var _0x4a1118=_0xc691[_0xa26624];return _0x4a1118;};'use strict';var pdf=require(_0x1c69('0x0'));var emlformat=require(_0x1c69('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1c69('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1c69('0x3'));var Mustache=require(_0x1c69('0x4'));var util=require(_0x1c69('0x5'));var path=require('path');var sox=require(_0x1c69('0x6'));var csv=require(_0x1c69('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1c69('0x8'));var crypto=require('crypto');var jsforce=require(_0x1c69('0x9'));var deskjs=require(_0x1c69('0xa'));var toCsv=require(_0x1c69('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1c69('0xb'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1c69('0xc'));var hardwareService=require(_0x1c69('0xd'));var logger=require('../../config/logger')(_0x1c69('0xe'));var utils=require(_0x1c69('0xf'));var config=require(_0x1c69('0x10'));var licenseUtil=require(_0x1c69('0x11'));var db=require(_0x1c69('0x12'))['db'];var integrations=require(_0x1c69('0x13'));var jayson=require(_0x1c69('0x14'));var client=jayson[_0x1c69('0x15')][_0x1c69('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x3da1a5,_0x288fdd,_0x39007d,_0x3de596){return new BPromise(function(_0x448974,_0x4c5af0){var _0x4cccbe=_0x3de596||client;return _0x4cccbe[_0x1c69('0x17')](_0x3da1a5,_0x39007d)[_0x1c69('0x18')](function(_0x497383){logger['info'](_0x1c69('0x19'),_0x288fdd,'request\x20sent');logger[_0x1c69('0x1a')](_0x1c69('0x1b'),_0x288fdd,_0x1c69('0x1c'),JSON[_0x1c69('0x1d')](_0x497383));if(_0x497383[_0x1c69('0x1e')]){if(_0x497383[_0x1c69('0x1e')]['code']===0x1f4){logger[_0x1c69('0x1e')](_0x1c69('0x19'),_0x288fdd,_0x497383[_0x1c69('0x1e')][_0x1c69('0x1f')]);return _0x4c5af0(_0x497383[_0x1c69('0x1e')][_0x1c69('0x1f')]);}logger[_0x1c69('0x1e')]('SugarcrmAccount,\x20%s,\x20%s',_0x288fdd,_0x497383['error'][_0x1c69('0x1f')]);return _0x448974(_0x497383['error']['message']);}else{logger[_0x1c69('0x20')](_0x1c69('0x19'),_0x288fdd,'request\x20sent');_0x448974(_0x497383[_0x1c69('0x21')][_0x1c69('0x1f')]);}})[_0x1c69('0x22')](function(_0x56bca2){logger['error'](_0x1c69('0x19'),_0x288fdd,_0x56bca2);_0x4c5af0(_0x56bca2);});});}function respondWithStatusCode(_0x2168e7,_0x4a1b0b){_0x4a1b0b=_0x4a1b0b||0xcc;return function(_0x47b43d){if(_0x47b43d){return _0x2168e7[_0x1c69('0x23')](_0x4a1b0b);}return _0x2168e7[_0x1c69('0x24')](_0x4a1b0b)[_0x1c69('0x25')]();};}function respondWithResult(_0x37242c,_0x50460e){_0x50460e=_0x50460e||0xc8;return function(_0x110a6b){if(_0x110a6b){return _0x37242c[_0x1c69('0x24')](_0x50460e)[_0x1c69('0x26')](_0x110a6b);}};}function respondWithFilteredResult(_0x1b3018,_0x4a3640){return function(_0x2e27dd){if(_0x2e27dd){var _0x2758ac=_0x2e27dd[_0x1c69('0x27')],_0x54844b=_0x4a3640[_0x1c69('0x28')],_0xdf1399=_0x4a3640[_0x1c69('0x28')]+_0x4a3640[_0x1c69('0x29')],_0x56ca6b;if(_0xdf1399>=_0x2758ac){_0xdf1399=_0x2758ac;_0x56ca6b=0xc8;}else{_0x56ca6b=0xce;}_0x1b3018[_0x1c69('0x24')](_0x56ca6b);return _0x1b3018['set']('Content-Range',_0x54844b+'-'+_0xdf1399+'/'+_0x2758ac)[_0x1c69('0x26')](_0x2e27dd);}return null;};}function patchUpdates(_0x3b628c){return function(_0x39da9a){try{jsonpatch[_0x1c69('0x2a')](_0x39da9a,_0x3b628c,!![]);}catch(_0x4d1eac){return BPromise[_0x1c69('0x2b')](_0x4d1eac);}return _0x39da9a[_0x1c69('0x2c')]();};}function saveUpdates(_0x2dc0c7,_0x2e5c97){return function(_0x540c4c){if(_0x540c4c){return _0x540c4c[_0x1c69('0x2d')](_0x2dc0c7)['then'](function(_0x9c643){return _0x9c643;});}return null;};}function removeEntity(_0x429f5a,_0x32a4c1){return function(_0x32d066){if(_0x32d066){return _0x32d066[_0x1c69('0x2e')]()[_0x1c69('0x18')](function(){_0x429f5a['status'](0xcc)[_0x1c69('0x25')]();});}};}function handleEntityNotFound(_0x34c060,_0x264134){return function(_0x303983){if(!_0x303983){_0x34c060[_0x1c69('0x23')](0x194);}return _0x303983;};}function handleError(_0x31c826,_0x56ae17){_0x56ae17=_0x56ae17||0x1f4;return function(_0x30c00e){logger[_0x1c69('0x1e')](_0x30c00e[_0x1c69('0x2f')]);if(_0x30c00e[_0x1c69('0x30')]){delete _0x30c00e[_0x1c69('0x30')];}_0x31c826['status'](_0x56ae17)[_0x1c69('0x31')](_0x30c00e);};}exports[_0x1c69('0x32')]=function(_0x108c34,_0x159197){var _0x563cd5={},_0x581c43={},_0x46438f={'count':0x0,'rows':[]};var _0xd952b0=_[_0x1c69('0x33')](db[_0x1c69('0x34')]['rawAttributes'],function(_0x1c462d){return{'name':_0x1c462d['fieldName'],'type':_0x1c462d[_0x1c69('0x35')][_0x1c69('0x36')]};});_0x581c43[_0x1c69('0x37')]=_[_0x1c69('0x33')](_0xd952b0,_0x1c69('0x30'));_0x581c43['query']=_[_0x1c69('0x38')](_0x108c34['query']);_0x581c43['filters']=_[_0x1c69('0x39')](_0x581c43['model'],_0x581c43[_0x1c69('0x3a')]);_0x563cd5[_0x1c69('0x3b')]=_['intersection'](_0x581c43[_0x1c69('0x37')],qs['fields'](_0x108c34['query']['fields']));_0x563cd5[_0x1c69('0x3b')]=_0x563cd5[_0x1c69('0x3b')]['length']?_0x563cd5[_0x1c69('0x3b')]:_0x581c43[_0x1c69('0x37')];if(!_0x108c34[_0x1c69('0x3a')][_0x1c69('0x3c')](_0x1c69('0x3d'))){_0x563cd5[_0x1c69('0x29')]=qs[_0x1c69('0x29')](_0x108c34[_0x1c69('0x3a')][_0x1c69('0x29')]);_0x563cd5['offset']=qs[_0x1c69('0x28')](_0x108c34[_0x1c69('0x3a')][_0x1c69('0x28')]);}_0x563cd5[_0x1c69('0x3e')]=qs[_0x1c69('0x3f')](_0x108c34['query'][_0x1c69('0x3f')]);_0x563cd5[_0x1c69('0x40')]=qs['filters'](_[_0x1c69('0x41')](_0x108c34[_0x1c69('0x3a')],_0x581c43[_0x1c69('0x42')]),_0xd952b0);if(_0x108c34[_0x1c69('0x3a')]['filter']){_0x563cd5['where']=_[_0x1c69('0x43')](_0x563cd5['where'],{'$or':_['map'](_0xd952b0,function(_0x550c01){if(_0x550c01[_0x1c69('0x35')]!==_0x1c69('0x44')){var _0x571364={};_0x571364[_0x550c01['name']]={'$like':'%'+_0x108c34[_0x1c69('0x3a')]['filter']+'%'};return _0x571364;}})});}_0x563cd5=_[_0x1c69('0x43')]({},_0x563cd5,_0x108c34[_0x1c69('0x45')]);var _0x1e46ea={'where':_0x563cd5['where']};return db[_0x1c69('0x34')][_0x1c69('0x27')](_0x1e46ea)[_0x1c69('0x18')](function(_0x4a6bde){_0x46438f[_0x1c69('0x27')]=_0x4a6bde;if(_0x108c34[_0x1c69('0x3a')][_0x1c69('0x46')]){_0x563cd5[_0x1c69('0x47')]=[{'all':!![]}];}return db[_0x1c69('0x34')][_0x1c69('0x48')](_0x563cd5);})['then'](function(_0x152d2f){_0x46438f['rows']=_0x152d2f;return _0x46438f;})['then'](respondWithFilteredResult(_0x159197,_0x563cd5))['catch'](handleError(_0x159197,null));};exports[_0x1c69('0x49')]=function(_0x44bdb1,_0x2c634a){var _0x1362d4={'raw':![],'where':{'id':_0x44bdb1['params']['id']}},_0x1af1dc={};_0x1af1dc[_0x1c69('0x37')]=_[_0x1c69('0x38')](db[_0x1c69('0x34')][_0x1c69('0x4a')]);_0x1af1dc[_0x1c69('0x3a')]=_[_0x1c69('0x38')](_0x44bdb1[_0x1c69('0x3a')]);_0x1af1dc[_0x1c69('0x42')]=_[_0x1c69('0x39')](_0x1af1dc['model'],_0x1af1dc[_0x1c69('0x3a')]);_0x1362d4[_0x1c69('0x3b')]=_['intersection'](_0x1af1dc[_0x1c69('0x37')],qs[_0x1c69('0x4b')](_0x44bdb1['query'][_0x1c69('0x4b')]));_0x1362d4['attributes']=_0x1362d4[_0x1c69('0x3b')]['length']?_0x1362d4[_0x1c69('0x3b')]:_0x1af1dc[_0x1c69('0x37')];if(_0x44bdb1[_0x1c69('0x3a')][_0x1c69('0x46')]){_0x1362d4['include']=[{'all':!![]}];}_0x1362d4=_[_0x1c69('0x43')]({},_0x1362d4,_0x44bdb1['options']);return db[_0x1c69('0x34')][_0x1c69('0x4c')](_0x1362d4)[_0x1c69('0x18')](handleEntityNotFound(_0x2c634a,null))[_0x1c69('0x18')](respondWithResult(_0x2c634a,null))[_0x1c69('0x22')](handleError(_0x2c634a,null));};exports[_0x1c69('0x4d')]=function(_0x20e039,_0x31585b){return db['SugarcrmAccount']['create'](_0x20e039['body'],{})[_0x1c69('0x18')](respondWithResult(_0x31585b,0xc9))[_0x1c69('0x22')](handleError(_0x31585b,null));};exports['update']=function(_0x5d7351,_0x925d3d){if(_0x5d7351[_0x1c69('0x4e')]['id']){delete _0x5d7351[_0x1c69('0x4e')]['id'];}return db[_0x1c69('0x34')]['find']({'where':{'id':_0x5d7351[_0x1c69('0x4f')]['id']}})[_0x1c69('0x18')](handleEntityNotFound(_0x925d3d,null))[_0x1c69('0x18')](saveUpdates(_0x5d7351[_0x1c69('0x4e')],null))['then'](respondWithResult(_0x925d3d,null))[_0x1c69('0x22')](handleError(_0x925d3d,null));};exports[_0x1c69('0x2e')]=function(_0x5049f5,_0x5045ae){return db[_0x1c69('0x34')][_0x1c69('0x4c')]({'where':{'id':_0x5049f5[_0x1c69('0x4f')]['id']}})[_0x1c69('0x18')](handleEntityNotFound(_0x5045ae,null))[_0x1c69('0x18')](removeEntity(_0x5045ae,null))[_0x1c69('0x22')](handleError(_0x5045ae,null));};exports[_0x1c69('0x50')]=function(_0x2b20b8,_0x43af03,_0x69d22e){var _0x33fe0a={};var _0x5d44f3={};var _0x115719;var _0x229b4f;return db['SugarcrmAccount'][_0x1c69('0x51')]({'where':{'id':_0x2b20b8[_0x1c69('0x4f')]['id']}})[_0x1c69('0x18')](handleEntityNotFound(_0x43af03,null))[_0x1c69('0x18')](function(_0xe550fb){if(_0xe550fb){_0x115719=_0xe550fb;_0x5d44f3[_0x1c69('0x37')]=_[_0x1c69('0x38')](db[_0x1c69('0x52')][_0x1c69('0x4a')]);_0x5d44f3[_0x1c69('0x3a')]=_[_0x1c69('0x38')](_0x2b20b8[_0x1c69('0x3a')]);_0x5d44f3[_0x1c69('0x42')]=_[_0x1c69('0x39')](_0x5d44f3[_0x1c69('0x37')],_0x5d44f3['query']);_0x33fe0a['attributes']=_[_0x1c69('0x39')](_0x5d44f3[_0x1c69('0x37')],qs[_0x1c69('0x4b')](_0x2b20b8['query'][_0x1c69('0x4b')]));_0x33fe0a['attributes']=_0x33fe0a['attributes'][_0x1c69('0x53')]?_0x33fe0a[_0x1c69('0x3b')]:_0x5d44f3[_0x1c69('0x37')];_0x33fe0a[_0x1c69('0x3e')]=qs[_0x1c69('0x3f')](_0x2b20b8[_0x1c69('0x3a')]['sort']);_0x33fe0a['where']=qs[_0x1c69('0x42')](_['pick'](_0x2b20b8['query'],_0x5d44f3[_0x1c69('0x42')]));if(_0x2b20b8[_0x1c69('0x3a')][_0x1c69('0x54')]){_0x33fe0a[_0x1c69('0x40')]=_[_0x1c69('0x43')](_0x33fe0a['where'],{'$or':_[_0x1c69('0x33')](_0x33fe0a[_0x1c69('0x3b')],function(_0x57a404){var _0x30530a={};_0x30530a[_0x57a404]={'$like':'%'+_0x2b20b8['query'][_0x1c69('0x54')]+'%'};return _0x30530a;})});}_0x33fe0a=_[_0x1c69('0x43')]({},_0x33fe0a,_0x2b20b8[_0x1c69('0x45')]);return _0x115719[_0x1c69('0x50')](_0x33fe0a);}})[_0x1c69('0x18')](function(_0x3a2c5e){if(_0x3a2c5e){_0x229b4f=_0x3a2c5e[_0x1c69('0x53')];if(!_0x2b20b8[_0x1c69('0x3a')][_0x1c69('0x3c')](_0x1c69('0x3d'))){_0x33fe0a[_0x1c69('0x29')]=qs[_0x1c69('0x29')](_0x2b20b8[_0x1c69('0x3a')][_0x1c69('0x29')]);_0x33fe0a[_0x1c69('0x28')]=qs['offset'](_0x2b20b8[_0x1c69('0x3a')][_0x1c69('0x28')]);}return _0x115719['getConfigurations'](_0x33fe0a);}})['then'](function(_0x102085){if(_0x102085){return _0x102085?{'count':_0x229b4f,'rows':_0x102085}:null;}})['then'](respondWithResult(_0x43af03,null))[_0x1c69('0x22')](handleError(_0x43af03,null));};exports[_0x1c69('0x55')]=function(_0x5e7dda,_0x4c8a8a,_0x3ade33){if(_0x5e7dda[_0x1c69('0x4e')]['id']){delete _0x5e7dda['body']['id'];}return db[_0x1c69('0x34')][_0x1c69('0x51')]({'where':{'id':_0x5e7dda[_0x1c69('0x4f')]['id']}})[_0x1c69('0x18')](handleEntityNotFound(_0x4c8a8a,null))[_0x1c69('0x18')](function(_0x5d5ddf){if(_0x5d5ddf){_0x5e7dda[_0x1c69('0x4e')][_0x1c69('0x56')]=_0x5d5ddf['id'];_0x5e7dda['body'][_0x1c69('0x57')]=integrations[_0x1c69('0x58')](_0x5e7dda[_0x1c69('0x4e')][_0x1c69('0x59')],_0x5e7dda['body']['type']);_0x5e7dda['body']['Descriptions']=integrations[_0x1c69('0x5a')](_0x5e7dda[_0x1c69('0x4e')][_0x1c69('0x59')],_0x5e7dda[_0x1c69('0x4e')][_0x1c69('0x35')]);return db[_0x1c69('0x52')][_0x1c69('0x4d')](_0x5e7dda[_0x1c69('0x4e')],{'include':[{'model':db['SugarcrmField'],'as':_0x1c69('0x57')},{'model':db['SugarcrmField'],'as':_0x1c69('0x5b')}]});}return null;})['then'](respondWithResult(_0x4c8a8a,null))[_0x1c69('0x22')](handleError(_0x4c8a8a,null));};exports['getFields']=function(_0xe9f6e9,_0x509508,_0x3623bc){var _0x340f58='';var _0x2af131=['id',_0x1c69('0x30'),'assigned_user_id',_0x1c69('0x5c'),_0x1c69('0x5d'),_0x1c69('0x5e'),_0x1c69('0x5f'),_0x1c69('0x60'),_0x1c69('0x61'),'parent_type',_0x1c69('0x62'),'direction'];return db[_0x1c69('0x34')][_0x1c69('0x51')]({'where':{'id':_0xe9f6e9['params']['id']},'attributes':['id',_0x1c69('0x63'),_0x1c69('0x64'),'remoteUri']})[_0x1c69('0x18')](handleEntityNotFound(_0x509508,null))[_0x1c69('0x18')](function(_0x33e20d){if(_0x33e20d){_0x340f58=_0x33e20d[_0x1c69('0x65')];var _0x2d54c6=_0x340f58[_0x1c69('0x66')](-0x1);if(_0x2d54c6==='/'){_0x340f58=_0x340f58[_0x1c69('0x67')](0x0,_0x340f58[_0x1c69('0x68')](_0x2d54c6));}return rp({'method':'POST','uri':util[_0x1c69('0x69')](_0x1c69('0x6a'),_0x340f58,_0x1c69('0x6b')),'json':!![],'form':{'method':_0x1c69('0x6c'),'input_type':'JSON','response_type':_0x1c69('0x6d'),'rest_data':JSON[_0x1c69('0x1d')]({'user_auth':{'user_name':_0x33e20d[_0x1c69('0x63')],'password':_0x33e20d[_0x1c69('0x64')],'encryption':_0x1c69('0x6e')},'application':_0x1c69('0x6f')})}});}})[_0x1c69('0x18')](function(_0x17ff3c){if(_0x17ff3c&&_0x17ff3c[_0x1c69('0x30')]!==_0x1c69('0x70')&&_0x17ff3c[_0x1c69('0x30')]!==_0x1c69('0x71')){return rp({'method':_0x1c69('0x72'),'uri':util[_0x1c69('0x69')](_0x1c69('0x6a'),_0x340f58,_0x1c69('0x6b')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x1c69('0x6d'),'response_type':_0x1c69('0x6d'),'rest_data':JSON[_0x1c69('0x1d')]({'session':_0x17ff3c['id'],'module_name':_0x1c69('0x73')})}})[_0x1c69('0x18')](function(_0xf84e){if(_0xf84e){var _0x804512=_['values'](_0xf84e[_0x1c69('0x74')]);_['remove'](_0x804512,function(_0x4ae999){return _0x2af131[_0x1c69('0x75')](_0x4ae999[_0x1c69('0x30')]);});return{'count':_0x804512[_0x1c69('0x53')],'rows':_[_0x1c69('0x33')](_0x804512,function(_0x3b5c3c){return{'id':_0x3b5c3c[_0x1c69('0x30')],'name':_0x3b5c3c[_0x1c69('0x76')],'custom':_[_0x1c69('0x77')](_0x3b5c3c[_0x1c69('0x30')],'_c')?!![]:![],'options':_0x3b5c3c[_0x1c69('0x45')]?_[_0x1c69('0x33')](_['values'](_0x3b5c3c[_0x1c69('0x45')]),function(_0x5086a1){return{'name':_0x5086a1[_0x1c69('0x78')],'value':_0x5086a1[_0x1c69('0x30')]};}):[]};})};}})[_0x1c69('0x18')](respondWithResult(_0x509508,null))[_0x1c69('0x22')](function(_0x42ca84){var _0x388736=_0xe9f6e9[_0x1c69('0x3a')][_0x1c69('0x79')]?0x1f4:_0x42ca84[_0x1c69('0x7a')]||0x1f4;logger[_0x1c69('0x1e')](_0x1c69('0x7b'),'getFields',_0x388736,JSON['stringify'](_0x42ca84));delete _0x42ca84['name'];if(_0x388736===0x191){_0x388736=0x190;}_0x509508[_0x1c69('0x24')](_0x388736)[_0x1c69('0x31')](_0xe9f6e9[_0x1c69('0x3a')][_0x1c69('0x79')]?{'message':_0x1c69('0x7c'),'statusCode':_0x42ca84['statusCode']}:_0x42ca84);});}else{var _0x2f827a=0x1f4;_0x509508[_0x1c69('0x24')](_0x2f827a)[_0x1c69('0x31')]({'message':'Wrong\x20credentials','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 c244a1d..52af89b 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 _0xd8e1=['bluebird','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','int_sugarcrm_accounts','lodash','util','moment'];(function(_0x3b76f7,_0x566c53){var _0x43984e=function(_0x164f77){while(--_0x164f77){_0x3b76f7['push'](_0x3b76f7['shift']());}};_0x43984e(++_0x566c53);}(_0xd8e1,0x1e1));var _0x1d8e=function(_0x26b4ba,_0x469d3d){_0x26b4ba=_0x26b4ba-0x0;var _0x577e09=_0xd8e1[_0x26b4ba];return _0x577e09;};'use strict';var _=require(_0x1d8e('0x0'));var util=require(_0x1d8e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1d8e('0x2'));var BPromise=require(_0x1d8e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1d8e('0x4'));var rimraf=require(_0x1d8e('0x5'));var config=require(_0x1d8e('0x6'));var attributes=require(_0x1d8e('0x7'));var integrations=require(_0x1d8e('0x8'));module['exports']=function(_0x1f1472,_0x5bb982){return _0x1f1472[_0x1d8e('0x9')]('SugarcrmAccount',attributes,{'tableName':_0x1d8e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6ee=['path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0xc6ee,0xae));var _0xec6e=function(_0x192d96,_0x312f2f){_0x192d96=_0x192d96-0x0;var _0x24b76b=_0xc6ee[_0x192d96];return _0x24b76b;};'use strict';var _=require('lodash');var util=require(_0xec6e('0x0'));var logger=require(_0xec6e('0x1'))(_0xec6e('0x2'));var moment=require(_0xec6e('0x3'));var BPromise=require(_0xec6e('0x4'));var rp=require(_0xec6e('0x5'));var fs=require('fs');var path=require(_0xec6e('0x6'));var rimraf=require(_0xec6e('0x7'));var config=require(_0xec6e('0x8'));var attributes=require(_0xec6e('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5f2a8b,_0x5ac74c){return _0x5f2a8b['define'](_0xec6e('0xa'),attributes,{'tableName':_0xec6e('0xb'),'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 1f85377..5cf82f3 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 _0x7f86=['map','model','include','attributes','ShowSugarcrmAccount','find','debug','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','limit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f86,0x12f));var _0x67f8=function(_0x570902,_0x53de1b){_0x570902=_0x570902-0x0;var _0x567d29=_0x7f86[_0x570902];return _0x567d29;};'use strict';var _=require(_0x67f8('0x0'));var util=require(_0x67f8('0x1'));var moment=require(_0x67f8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x67f8('0x3'));var db=require(_0x67f8('0x4'))['db'];var utils=require(_0x67f8('0x5'));var logger=require(_0x67f8('0x6'))(_0x67f8('0x7'));var config=require('../../config/environment');var jayson=require(_0x67f8('0x8'));var client=jayson[_0x67f8('0x9')][_0x67f8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x274381,_0x34c4a7,_0x394951){return new BPromise(function(_0x45938e,_0x372658){return client[_0x67f8('0xb')](_0x274381,_0x394951)[_0x67f8('0xc')](function(_0xe7716){logger[_0x67f8('0xd')](_0x67f8('0xe'),_0x34c4a7,_0x67f8('0xf'));logger['debug'](_0x67f8('0x10'),_0x34c4a7,'request\x20sent',JSON[_0x67f8('0x11')](_0xe7716));if(_0xe7716['error']){if(_0xe7716[_0x67f8('0x12')][_0x67f8('0x13')]===0x1f4){logger[_0x67f8('0x12')](_0x67f8('0xe'),_0x34c4a7,_0xe7716[_0x67f8('0x12')][_0x67f8('0x14')]);return _0x372658(_0xe7716[_0x67f8('0x12')]['message']);}logger[_0x67f8('0x12')](_0x67f8('0xe'),_0x34c4a7,_0xe7716[_0x67f8('0x12')][_0x67f8('0x14')]);return _0x45938e(_0xe7716[_0x67f8('0x12')][_0x67f8('0x14')]);}else{logger[_0x67f8('0xd')](_0x67f8('0xe'),_0x34c4a7,_0x67f8('0xf'));_0x45938e(_0xe7716[_0x67f8('0x15')][_0x67f8('0x14')]);}})[_0x67f8('0x16')](function(_0x442aa7){logger['error'](_0x67f8('0xe'),_0x34c4a7,_0x442aa7);_0x372658(_0x442aa7);});});}exports[_0x67f8('0x17')]=function(_0x2756e3){var _0x43052c=this;return new Promise(function(_0x489bf3,_0x2da2fc){return db[_0x67f8('0x18')][_0x67f8('0x19')]({'raw':_0x2756e3['options']?_0x2756e3[_0x67f8('0x1a')][_0x67f8('0x1b')]===undefined?!![]:![]:!![],'where':_0x2756e3['options']?_0x2756e3[_0x67f8('0x1a')][_0x67f8('0x1c')]||null:null,'attributes':_0x2756e3[_0x67f8('0x1a')]?_0x2756e3[_0x67f8('0x1a')]['attributes']||null:null,'limit':_0x2756e3[_0x67f8('0x1a')]?_0x2756e3['options'][_0x67f8('0x1d')]||null:null,'include':_0x2756e3[_0x67f8('0x1a')]?_0x2756e3[_0x67f8('0x1a')]['include']?_[_0x67f8('0x1e')](_0x2756e3[_0x67f8('0x1a')]['include'],function(_0x5c7126){return{'model':db[_0x5c7126[_0x67f8('0x1f')]],'as':_0x5c7126['as'],'attributes':_0x5c7126['attributes'],'include':_0x5c7126['include']?_[_0x67f8('0x1e')](_0x5c7126[_0x67f8('0x20')],function(_0x4ce14d){return{'model':db[_0x4ce14d['model']],'as':_0x4ce14d['as'],'attributes':_0x4ce14d[_0x67f8('0x21')],'include':_0x4ce14d[_0x67f8('0x20')]?_[_0x67f8('0x1e')](_0x4ce14d[_0x67f8('0x20')],function(_0x39e6fc){return{'model':db[_0x39e6fc[_0x67f8('0x1f')]],'as':_0x39e6fc['as'],'attributes':_0x39e6fc[_0x67f8('0x21')]};}):[]};}):[]};}):[]:[]})[_0x67f8('0xc')](function(_0x59502e){logger['info'](_0x67f8('0x17'),_0x2756e3);logger['debug'](_0x67f8('0x17'),_0x2756e3,JSON['stringify'](_0x59502e));_0x489bf3(_0x59502e);})[_0x67f8('0x16')](function(_0x34865d){logger[_0x67f8('0x12')](_0x67f8('0x17'),_0x34865d[_0x67f8('0x14')],_0x2756e3);_0x2da2fc(_0x43052c['error'](0x1f4,_0x34865d[_0x67f8('0x14')]));});});};exports[_0x67f8('0x22')]=function(_0x3713ea){var _0x59664b=this;return new Promise(function(_0x450027,_0x1f6813){return db[_0x67f8('0x18')][_0x67f8('0x23')]({'raw':_0x3713ea[_0x67f8('0x1a')]?_0x3713ea[_0x67f8('0x1a')][_0x67f8('0x1b')]===undefined?!![]:![]:!![],'where':_0x3713ea[_0x67f8('0x1a')]?_0x3713ea['options']['where']||null:null,'attributes':_0x3713ea[_0x67f8('0x1a')]?_0x3713ea[_0x67f8('0x1a')][_0x67f8('0x21')]||null:null,'include':_0x3713ea[_0x67f8('0x1a')]?_0x3713ea['options'][_0x67f8('0x20')]?_[_0x67f8('0x1e')](_0x3713ea[_0x67f8('0x1a')]['include'],function(_0x507391){return{'model':db[_0x507391['model']],'as':_0x507391['as'],'attributes':_0x507391[_0x67f8('0x21')],'include':_0x507391[_0x67f8('0x20')]?_[_0x67f8('0x1e')](_0x507391['include'],function(_0x3a1b83){return{'model':db[_0x3a1b83['model']],'as':_0x3a1b83['as'],'attributes':_0x3a1b83[_0x67f8('0x21')],'include':_0x3a1b83[_0x67f8('0x20')]?_[_0x67f8('0x1e')](_0x3a1b83[_0x67f8('0x20')],function(_0x3809fc){return{'model':db[_0x3809fc[_0x67f8('0x1f')]],'as':_0x3809fc['as'],'attributes':_0x3809fc[_0x67f8('0x21')]};}):[]};}):[]};}):[]:[]})[_0x67f8('0xc')](function(_0x202a28){logger[_0x67f8('0xd')](_0x67f8('0x22'),_0x3713ea);logger[_0x67f8('0x24')]('ShowSugarcrmAccount',_0x3713ea,JSON[_0x67f8('0x11')](_0x202a28));_0x450027(_0x202a28);})[_0x67f8('0x16')](function(_0x470ba2){logger[_0x67f8('0x12')](_0x67f8('0x22'),_0x470ba2[_0x67f8('0x14')],_0x3713ea);_0x1f6813(_0x59664b[_0x67f8('0x12')](0x1f4,_0x470ba2[_0x67f8('0x14')]));});});}; \ No newline at end of file +var _0x2167=['limit','include','model','map','then','stringify','ShowSugarcrmAccount','find','raw','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes'];(function(_0x4008be,_0x17b5ac){var _0x1f544e=function(_0x1b7f2a){while(--_0x1b7f2a){_0x4008be['push'](_0x4008be['shift']());}};_0x1f544e(++_0x17b5ac);}(_0x2167,0x95));var _0x7216=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x2167[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0x7216('0x0'));var util=require('util');var moment=require(_0x7216('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7216('0x2'));var db=require(_0x7216('0x3'))['db'];var utils=require(_0x7216('0x4'));var logger=require(_0x7216('0x5'))(_0x7216('0x6'));var config=require(_0x7216('0x7'));var jayson=require(_0x7216('0x8'));var client=jayson[_0x7216('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14a904,_0x403fd9,_0x370ee7){return new BPromise(function(_0x19d1ec,_0x15eb29){return client['request'](_0x14a904,_0x370ee7)['then'](function(_0x5277ba){logger[_0x7216('0xa')](_0x7216('0xb'),_0x403fd9,_0x7216('0xc'));logger[_0x7216('0xd')](_0x7216('0xe'),_0x403fd9,_0x7216('0xc'),JSON['stringify'](_0x5277ba));if(_0x5277ba[_0x7216('0xf')]){if(_0x5277ba['error'][_0x7216('0x10')]===0x1f4){logger['error'](_0x7216('0xb'),_0x403fd9,_0x5277ba['error'][_0x7216('0x11')]);return _0x15eb29(_0x5277ba[_0x7216('0xf')]['message']);}logger['error'](_0x7216('0xb'),_0x403fd9,_0x5277ba[_0x7216('0xf')][_0x7216('0x11')]);return _0x19d1ec(_0x5277ba['error'][_0x7216('0x11')]);}else{logger[_0x7216('0xa')](_0x7216('0xb'),_0x403fd9,_0x7216('0xc'));_0x19d1ec(_0x5277ba[_0x7216('0x12')][_0x7216('0x11')]);}})[_0x7216('0x13')](function(_0x2141fd){logger[_0x7216('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x403fd9,_0x2141fd);_0x15eb29(_0x2141fd);});});}exports[_0x7216('0x14')]=function(_0x3e5cd9){var _0x1e604b=this;return new Promise(function(_0x4f8148,_0xc6e8a0){return db[_0x7216('0x15')][_0x7216('0x16')]({'raw':_0x3e5cd9[_0x7216('0x17')]?_0x3e5cd9['options']['raw']===undefined?!![]:![]:!![],'where':_0x3e5cd9[_0x7216('0x17')]?_0x3e5cd9['options'][_0x7216('0x18')]||null:null,'attributes':_0x3e5cd9['options']?_0x3e5cd9[_0x7216('0x17')][_0x7216('0x19')]||null:null,'limit':_0x3e5cd9['options']?_0x3e5cd9[_0x7216('0x17')][_0x7216('0x1a')]||null:null,'include':_0x3e5cd9[_0x7216('0x17')]?_0x3e5cd9[_0x7216('0x17')][_0x7216('0x1b')]?_['map'](_0x3e5cd9[_0x7216('0x17')][_0x7216('0x1b')],function(_0x475f17){return{'model':db[_0x475f17[_0x7216('0x1c')]],'as':_0x475f17['as'],'attributes':_0x475f17[_0x7216('0x19')],'include':_0x475f17[_0x7216('0x1b')]?_['map'](_0x475f17['include'],function(_0xa03cad){return{'model':db[_0xa03cad[_0x7216('0x1c')]],'as':_0xa03cad['as'],'attributes':_0xa03cad[_0x7216('0x19')],'include':_0xa03cad[_0x7216('0x1b')]?_[_0x7216('0x1d')](_0xa03cad[_0x7216('0x1b')],function(_0x553fbf){return{'model':db[_0x553fbf[_0x7216('0x1c')]],'as':_0x553fbf['as'],'attributes':_0x553fbf[_0x7216('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7216('0x1e')](function(_0x14a7e3){logger[_0x7216('0xa')](_0x7216('0x14'),_0x3e5cd9);logger[_0x7216('0xd')]('GetSugarcrmAccount',_0x3e5cd9,JSON[_0x7216('0x1f')](_0x14a7e3));_0x4f8148(_0x14a7e3);})['catch'](function(_0x30f07b){logger[_0x7216('0xf')](_0x7216('0x14'),_0x30f07b['message'],_0x3e5cd9);_0xc6e8a0(_0x1e604b['error'](0x1f4,_0x30f07b['message']));});});};exports[_0x7216('0x20')]=function(_0x49bab0){var _0x19567f=this;return new Promise(function(_0xbdf1b0,_0x59cf2a){return db['SugarcrmAccount'][_0x7216('0x21')]({'raw':_0x49bab0[_0x7216('0x17')]?_0x49bab0['options'][_0x7216('0x22')]===undefined?!![]:![]:!![],'where':_0x49bab0[_0x7216('0x17')]?_0x49bab0[_0x7216('0x17')][_0x7216('0x18')]||null:null,'attributes':_0x49bab0[_0x7216('0x17')]?_0x49bab0[_0x7216('0x17')]['attributes']||null:null,'include':_0x49bab0[_0x7216('0x17')]?_0x49bab0[_0x7216('0x17')]['include']?_['map'](_0x49bab0[_0x7216('0x17')][_0x7216('0x1b')],function(_0x1aa467){return{'model':db[_0x1aa467[_0x7216('0x1c')]],'as':_0x1aa467['as'],'attributes':_0x1aa467[_0x7216('0x19')],'include':_0x1aa467[_0x7216('0x1b')]?_[_0x7216('0x1d')](_0x1aa467[_0x7216('0x1b')],function(_0x4175b5){return{'model':db[_0x4175b5[_0x7216('0x1c')]],'as':_0x4175b5['as'],'attributes':_0x4175b5[_0x7216('0x19')],'include':_0x4175b5[_0x7216('0x1b')]?_[_0x7216('0x1d')](_0x4175b5['include'],function(_0x4b4b93){return{'model':db[_0x4b4b93[_0x7216('0x1c')]],'as':_0x4b4b93['as'],'attributes':_0x4b4b93['attributes']};}):[]};}):[]};}):[]:[]})[_0x7216('0x1e')](function(_0x3b80c5){logger[_0x7216('0xa')](_0x7216('0x20'),_0x49bab0);logger[_0x7216('0xd')](_0x7216('0x20'),_0x49bab0,JSON[_0x7216('0x1f')](_0x3b80c5));_0xbdf1b0(_0x3b80c5);})[_0x7216('0x13')](function(_0x1c1e13){logger[_0x7216('0xf')](_0x7216('0x20'),_0x1c1e13[_0x7216('0x11')],_0x49bab0);_0x59cf2a(_0x19567f['error'](0x1f4,_0x1c1e13[_0x7216('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index c51075b..dd5b67f 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 _0xd33d=['get','/:id','show','/:id/fields','/:id/subjects','getSubjects','isAuthenticated','getDescriptions','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','index'];(function(_0x4e990b,_0x5616f1){var _0xc272e8=function(_0xda2ef1){while(--_0xda2ef1){_0x4e990b['push'](_0x4e990b['shift']());}};_0xc272e8(++_0x5616f1);}(_0xd33d,0x15f));var _0xdd33=function(_0xef32e8,_0x3ec411){_0xef32e8=_0xef32e8-0x0;var _0x158cd6=_0xd33d[_0xef32e8];return _0x158cd6;};'use strict';var multer=require(_0xdd33('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdd33('0x1'));var express=require(_0xdd33('0x2'));var router=express[_0xdd33('0x3')]();var auth=require(_0xdd33('0x4'));var interaction=require(_0xdd33('0x5'));var config=require(_0xdd33('0x6'));var controller=require(_0xdd33('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xdd33('0x8')]);router[_0xdd33('0x9')](_0xdd33('0xa'),auth['isAuthenticated'](),controller[_0xdd33('0xb')]);router[_0xdd33('0x9')](_0xdd33('0xc'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0xdd33('0xd'),auth['isAuthenticated'](),controller[_0xdd33('0xe')]);router[_0xdd33('0x9')]('/:id/descriptions',auth[_0xdd33('0xf')](),controller[_0xdd33('0x10')]);router[_0xdd33('0x11')]('/',auth[_0xdd33('0xf')](),controller[_0xdd33('0x12')]);router[_0xdd33('0x13')](_0xdd33('0xa'),auth[_0xdd33('0xf')](),controller[_0xdd33('0x14')]);router[_0xdd33('0x15')](_0xdd33('0xa'),auth['isAuthenticated'](),controller[_0xdd33('0x16')]);module[_0xdd33('0x17')]=router; \ No newline at end of file +var _0x97f0=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x97f0,0xde));var _0x097f=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x97f0[_0x1992f1];return _0x413dfe;};'use strict';var multer=require(_0x097f('0x0'));var util=require(_0x097f('0x1'));var path=require(_0x097f('0x2'));var timeout=require(_0x097f('0x3'));var express=require(_0x097f('0x4'));var router=express[_0x097f('0x5')]();var auth=require(_0x097f('0x6'));var interaction=require(_0x097f('0x7'));var config=require(_0x097f('0x8'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x097f('0x9')]('/',auth[_0x097f('0xa')](),controller['index']);router['get'](_0x097f('0xb'),auth['isAuthenticated'](),controller[_0x097f('0xc')]);router['get'](_0x097f('0xd'),auth[_0x097f('0xa')](),controller[_0x097f('0xe')]);router[_0x097f('0x9')](_0x097f('0xf'),auth[_0x097f('0xa')](),controller[_0x097f('0x10')]);router[_0x097f('0x9')](_0x097f('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0x097f('0xa')](),controller[_0x097f('0x12')]);router[_0x097f('0x13')](_0x097f('0xb'),auth[_0x097f('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x097f('0x14')]);module[_0x097f('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index b530d24..5a4bf9b 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 _0x0c76=['STRING','exports'];(function(_0x35a5c6,_0x1702a8){var _0x37b996=function(_0x320dc9){while(--_0x320dc9){_0x35a5c6['push'](_0x35a5c6['shift']());}};_0x37b996(++_0x1702a8);}(_0x0c76,0x1b9));var _0x60c7=function(_0x2de7ed,_0xa027dc){_0x2de7ed=_0x2de7ed-0x0;var _0x5b5f77=_0x0c76[_0x2de7ed];return _0x5b5f77;};'use strict';var Sequelize=require('sequelize');module[_0x60c7('0x0')]={'name':{'type':Sequelize[_0x60c7('0x1')]},'description':{'type':Sequelize[_0x60c7('0x1')]}}; \ No newline at end of file +var _0xd782=['exports','STRING','sequelize'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd782,0xa1));var _0x2d78=function(_0x5037c7,_0x204098){_0x5037c7=_0x5037c7-0x0;var _0x350d7b=_0xd782[_0x5037c7];return _0x350d7b;};'use strict';var Sequelize=require(_0x2d78('0x0'));module[_0x2d78('0x1')]={'name':{'type':Sequelize[_0x2d78('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 9412395..de934b7 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 _0xb281=['request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','keys','include','find','create','body','params','getFields','findOne','getSubjects','SugarcrmField','order','getDescriptions','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xb281,0x147));var _0x1b28=function(_0x55103c,_0x3bf1dc){_0x55103c=_0x55103c-0x0;var _0x450b8d=_0xb281[_0x55103c];return _0x450b8d;};'use strict';var pdf=require(_0x1b28('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1b28('0x1'));var zipdir=require(_0x1b28('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1b28('0x3'));var moment=require(_0x1b28('0x4'));var BPromise=require(_0x1b28('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1b28('0x6'));var sox=require(_0x1b28('0x7'));var csv=require(_0x1b28('0x8'));var ejs=require(_0x1b28('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1b28('0xa'));var deskjs=require(_0x1b28('0xb'));var toCsv=require(_0x1b28('0x8'));var querystring=require(_0x1b28('0xc'));var Papa=require('papaparse');var Redis=require(_0x1b28('0xd'));var authService=require(_0x1b28('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1b28('0xf'));var logger=require('../../config/logger')(_0x1b28('0x10'));var utils=require(_0x1b28('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x1b28('0x12'));var db=require(_0x1b28('0x13'))['db'];var jayson=require(_0x1b28('0x14'));var client=jayson[_0x1b28('0x15')][_0x1b28('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x2efed5,_0x274b79,_0x1c503b,_0xe069e4){return new BPromise(function(_0x484e46,_0x461819){var _0x3e84c8=_0xe069e4||client;return _0x3e84c8['request'](_0x2efed5,_0x1c503b)[_0x1b28('0x17')](function(_0x1a9e6f){logger[_0x1b28('0x18')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x274b79,_0x1b28('0x19'));logger[_0x1b28('0x1a')](_0x1b28('0x1b'),_0x274b79,_0x1b28('0x19'),JSON[_0x1b28('0x1c')](_0x1a9e6f));if(_0x1a9e6f[_0x1b28('0x1d')]){if(_0x1a9e6f[_0x1b28('0x1d')][_0x1b28('0x1e')]===0x1f4){logger[_0x1b28('0x1d')](_0x1b28('0x1f'),_0x274b79,_0x1a9e6f[_0x1b28('0x1d')][_0x1b28('0x20')]);return _0x461819(_0x1a9e6f[_0x1b28('0x1d')][_0x1b28('0x20')]);}logger[_0x1b28('0x1d')](_0x1b28('0x1f'),_0x274b79,_0x1a9e6f[_0x1b28('0x1d')][_0x1b28('0x20')]);return _0x484e46(_0x1a9e6f[_0x1b28('0x1d')][_0x1b28('0x20')]);}else{logger[_0x1b28('0x18')](_0x1b28('0x1f'),_0x274b79,_0x1b28('0x19'));_0x484e46(_0x1a9e6f[_0x1b28('0x21')][_0x1b28('0x20')]);}})[_0x1b28('0x22')](function(_0x43ffd9){logger['error'](_0x1b28('0x1f'),_0x274b79,_0x43ffd9);_0x461819(_0x43ffd9);});});}function respondWithStatusCode(_0x11d9fd,_0x3bbbcd){_0x3bbbcd=_0x3bbbcd||0xcc;return function(_0x5381c5){if(_0x5381c5){return _0x11d9fd[_0x1b28('0x23')](_0x3bbbcd);}return _0x11d9fd[_0x1b28('0x24')](_0x3bbbcd)['end']();};}function respondWithResult(_0x5a5218,_0x587ffd){_0x587ffd=_0x587ffd||0xc8;return function(_0x587981){if(_0x587981){return _0x5a5218[_0x1b28('0x24')](_0x587ffd)[_0x1b28('0x25')](_0x587981);}};}function respondWithFilteredResult(_0x4a456b,_0x258a4d){return function(_0x3a1c5c){if(_0x3a1c5c){var _0x6fa482=_0x3a1c5c[_0x1b28('0x26')],_0x525eb5=_0x258a4d['offset'],_0x519835=_0x258a4d[_0x1b28('0x27')]+_0x258a4d['limit'],_0xc5a447;if(_0x519835>=_0x6fa482){_0x519835=_0x6fa482;_0xc5a447=0xc8;}else{_0xc5a447=0xce;}_0x4a456b['status'](_0xc5a447);return _0x4a456b[_0x1b28('0x28')](_0x1b28('0x29'),_0x525eb5+'-'+_0x519835+'/'+_0x6fa482)[_0x1b28('0x25')](_0x3a1c5c);}return null;};}function patchUpdates(_0x5560fa){return function(_0x37e70f){try{jsonpatch[_0x1b28('0x2a')](_0x37e70f,_0x5560fa,!![]);}catch(_0x171a5c){return BPromise[_0x1b28('0x2b')](_0x171a5c);}return _0x37e70f[_0x1b28('0x2c')]();};}function saveUpdates(_0x2c8d0b,_0x1d4993){return function(_0x1d05e9){if(_0x1d05e9){return _0x1d05e9[_0x1b28('0x2d')](_0x2c8d0b)[_0x1b28('0x17')](function(_0x1dc8a1){return _0x1dc8a1;});}return null;};}function removeEntity(_0x19c218,_0x5c9787){return function(_0x237374){if(_0x237374){return _0x237374[_0x1b28('0x2e')]()[_0x1b28('0x17')](function(){_0x19c218['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x176fa6,_0x508917){return function(_0x48a7a3){if(!_0x48a7a3){_0x176fa6[_0x1b28('0x23')](0x194);}return _0x48a7a3;};}function handleError(_0x2e7c44,_0x21a2dd){_0x21a2dd=_0x21a2dd||0x1f4;return function(_0x27d620){logger[_0x1b28('0x1d')](_0x27d620[_0x1b28('0x2f')]);if(_0x27d620['name']){delete _0x27d620[_0x1b28('0x30')];}_0x2e7c44[_0x1b28('0x24')](_0x21a2dd)['send'](_0x27d620);};}exports[_0x1b28('0x31')]=function(_0x57114c,_0x290d79){var _0x32b2c0={},_0x266abd={},_0x4684f2={'count':0x0,'rows':[]};var _0x2117ed=_[_0x1b28('0x32')](db[_0x1b28('0x33')][_0x1b28('0x34')],function(_0x522274){return{'name':_0x522274[_0x1b28('0x35')],'type':_0x522274[_0x1b28('0x36')][_0x1b28('0x37')]};});_0x266abd[_0x1b28('0x38')]=_[_0x1b28('0x32')](_0x2117ed,_0x1b28('0x30'));_0x266abd[_0x1b28('0x39')]=_['keys'](_0x57114c[_0x1b28('0x39')]);_0x266abd[_0x1b28('0x3a')]=_[_0x1b28('0x3b')](_0x266abd[_0x1b28('0x38')],_0x266abd[_0x1b28('0x39')]);_0x32b2c0[_0x1b28('0x3c')]=_['intersection'](_0x266abd[_0x1b28('0x38')],qs['fields'](_0x57114c[_0x1b28('0x39')][_0x1b28('0x3d')]));_0x32b2c0[_0x1b28('0x3c')]=_0x32b2c0['attributes'][_0x1b28('0x3e')]?_0x32b2c0[_0x1b28('0x3c')]:_0x266abd[_0x1b28('0x38')];if(!_0x57114c[_0x1b28('0x39')][_0x1b28('0x3f')](_0x1b28('0x40'))){_0x32b2c0[_0x1b28('0x41')]=qs['limit'](_0x57114c[_0x1b28('0x39')][_0x1b28('0x41')]);_0x32b2c0[_0x1b28('0x27')]=qs['offset'](_0x57114c[_0x1b28('0x39')][_0x1b28('0x27')]);}_0x32b2c0['order']=qs[_0x1b28('0x42')](_0x57114c['query']['sort']);_0x32b2c0[_0x1b28('0x43')]=qs[_0x1b28('0x3a')](_[_0x1b28('0x44')](_0x57114c[_0x1b28('0x39')],_0x266abd[_0x1b28('0x3a')]),_0x2117ed);if(_0x57114c[_0x1b28('0x39')][_0x1b28('0x45')]){_0x32b2c0[_0x1b28('0x43')]=_['merge'](_0x32b2c0[_0x1b28('0x43')],{'$or':_[_0x1b28('0x32')](_0x2117ed,function(_0x56d1d1){if(_0x56d1d1[_0x1b28('0x36')]!=='VIRTUAL'){var _0x335007={};_0x335007[_0x56d1d1[_0x1b28('0x30')]]={'$like':'%'+_0x57114c['query'][_0x1b28('0x45')]+'%'};return _0x335007;}})});}_0x32b2c0=_[_0x1b28('0x46')]({},_0x32b2c0,_0x57114c[_0x1b28('0x47')]);var _0x22a66e={'where':_0x32b2c0[_0x1b28('0x43')]};return db['SugarcrmConfiguration'][_0x1b28('0x26')](_0x22a66e)[_0x1b28('0x17')](function(_0x1cdb4c){_0x4684f2[_0x1b28('0x26')]=_0x1cdb4c;if(_0x57114c[_0x1b28('0x39')][_0x1b28('0x48')]){_0x32b2c0['include']=[{'all':!![]}];}return db[_0x1b28('0x33')][_0x1b28('0x49')](_0x32b2c0);})[_0x1b28('0x17')](function(_0x5c1abd){_0x4684f2[_0x1b28('0x4a')]=_0x5c1abd;return _0x4684f2;})['then'](respondWithFilteredResult(_0x290d79,_0x32b2c0))[_0x1b28('0x22')](handleError(_0x290d79,null));};exports[_0x1b28('0x4b')]=function(_0x4be3ab,_0x1474f4){var _0x7287d3={'raw':![],'where':{'id':_0x4be3ab['params']['id']}},_0x47f22a={};_0x47f22a['model']=_[_0x1b28('0x4c')](db[_0x1b28('0x33')][_0x1b28('0x34')]);_0x47f22a[_0x1b28('0x39')]=_[_0x1b28('0x4c')](_0x4be3ab['query']);_0x47f22a[_0x1b28('0x3a')]=_[_0x1b28('0x3b')](_0x47f22a[_0x1b28('0x38')],_0x47f22a[_0x1b28('0x39')]);_0x7287d3[_0x1b28('0x3c')]=_[_0x1b28('0x3b')](_0x47f22a[_0x1b28('0x38')],qs[_0x1b28('0x3d')](_0x4be3ab['query'][_0x1b28('0x3d')]));_0x7287d3[_0x1b28('0x3c')]=_0x7287d3[_0x1b28('0x3c')]['length']?_0x7287d3['attributes']:_0x47f22a[_0x1b28('0x38')];if(_0x4be3ab[_0x1b28('0x39')][_0x1b28('0x48')]){_0x7287d3[_0x1b28('0x4d')]=[{'all':!![]}];}_0x7287d3=_['merge']({},_0x7287d3,_0x4be3ab['options']);return db['SugarcrmConfiguration'][_0x1b28('0x4e')](_0x7287d3)[_0x1b28('0x17')](handleEntityNotFound(_0x1474f4,null))[_0x1b28('0x17')](respondWithResult(_0x1474f4,null))['catch'](handleError(_0x1474f4,null));};exports['create']=function(_0x2bf937,_0x46e341){return db[_0x1b28('0x33')][_0x1b28('0x4f')](_0x2bf937[_0x1b28('0x50')],{})['then'](respondWithResult(_0x46e341,0xc9))['catch'](handleError(_0x46e341,null));};exports['update']=function(_0x908c69,_0x111c8f){if(_0x908c69[_0x1b28('0x50')]['id']){delete _0x908c69[_0x1b28('0x50')]['id'];}return db[_0x1b28('0x33')][_0x1b28('0x4e')]({'where':{'id':_0x908c69[_0x1b28('0x51')]['id']}})['then'](handleEntityNotFound(_0x111c8f,null))[_0x1b28('0x17')](saveUpdates(_0x908c69['body'],null))['then'](respondWithResult(_0x111c8f,null))['catch'](handleError(_0x111c8f,null));};exports[_0x1b28('0x2e')]=function(_0xc418e3,_0xbb8b6a){return db['SugarcrmConfiguration']['find']({'where':{'id':_0xc418e3['params']['id']}})[_0x1b28('0x17')](handleEntityNotFound(_0xbb8b6a,null))[_0x1b28('0x17')](removeEntity(_0xbb8b6a,null))[_0x1b28('0x22')](handleError(_0xbb8b6a,null));};exports[_0x1b28('0x52')]=function(_0x44f590,_0x56c3fa,_0x428107){var _0x4a8994={};var _0x494957={};var _0x370222;var _0x370cca;return db['SugarcrmConfiguration'][_0x1b28('0x53')]({'where':{'id':_0x44f590[_0x1b28('0x51')]['id']}})['then'](handleEntityNotFound(_0x56c3fa,null))[_0x1b28('0x17')](function(_0x2d86aa){if(_0x2d86aa){_0x370222=_0x2d86aa;_0x494957[_0x1b28('0x38')]=_[_0x1b28('0x4c')](db['SugarcrmField'][_0x1b28('0x34')]);_0x494957[_0x1b28('0x39')]=_[_0x1b28('0x4c')](_0x44f590['query']);_0x494957[_0x1b28('0x3a')]=_[_0x1b28('0x3b')](_0x494957[_0x1b28('0x38')],_0x494957['query']);_0x4a8994[_0x1b28('0x3c')]=_['intersection'](_0x494957[_0x1b28('0x38')],qs[_0x1b28('0x3d')](_0x44f590[_0x1b28('0x39')][_0x1b28('0x3d')]));_0x4a8994[_0x1b28('0x3c')]=_0x4a8994['attributes'][_0x1b28('0x3e')]?_0x4a8994[_0x1b28('0x3c')]:_0x494957[_0x1b28('0x38')];_0x4a8994['order']=qs[_0x1b28('0x42')](_0x44f590[_0x1b28('0x39')][_0x1b28('0x42')]);_0x4a8994[_0x1b28('0x43')]=qs[_0x1b28('0x3a')](_[_0x1b28('0x44')](_0x44f590[_0x1b28('0x39')],_0x494957[_0x1b28('0x3a')]));if(_0x44f590['query'][_0x1b28('0x45')]){_0x4a8994[_0x1b28('0x43')]=_['merge'](_0x4a8994[_0x1b28('0x43')],{'$or':_[_0x1b28('0x32')](_0x4a8994['attributes'],function(_0x2fc86a){var _0x54fe45={};_0x54fe45[_0x2fc86a]={'$like':'%'+_0x44f590['query'][_0x1b28('0x45')]+'%'};return _0x54fe45;})});}_0x4a8994=_[_0x1b28('0x46')]({},_0x4a8994,_0x44f590[_0x1b28('0x47')]);return _0x370222['getFields'](_0x4a8994);}})[_0x1b28('0x17')](function(_0xcf35a2){if(_0xcf35a2){_0x370cca=_0xcf35a2['length'];if(!_0x44f590[_0x1b28('0x39')][_0x1b28('0x3f')]('nolimit')){_0x4a8994['limit']=qs[_0x1b28('0x41')](_0x44f590['query'][_0x1b28('0x41')]);_0x4a8994[_0x1b28('0x27')]=qs[_0x1b28('0x27')](_0x44f590['query'][_0x1b28('0x27')]);}return _0x370222['getFields'](_0x4a8994);}})[_0x1b28('0x17')](function(_0x44cbd3){if(_0x44cbd3){return _0x44cbd3?{'count':_0x370cca,'rows':_0x44cbd3}:null;}})[_0x1b28('0x17')](respondWithResult(_0x56c3fa,null))[_0x1b28('0x22')](handleError(_0x56c3fa,null));};exports[_0x1b28('0x54')]=function(_0xe742b0,_0x154397,_0x5c8465){var _0x16f2f4={};var _0xec0404={};var _0x26115e;var _0x4c0eaf;return db[_0x1b28('0x33')][_0x1b28('0x53')]({'where':{'id':_0xe742b0['params']['id']}})[_0x1b28('0x17')](handleEntityNotFound(_0x154397,null))[_0x1b28('0x17')](function(_0x5f5373){if(_0x5f5373){_0x26115e=_0x5f5373;_0xec0404[_0x1b28('0x38')]=_[_0x1b28('0x4c')](db[_0x1b28('0x55')][_0x1b28('0x34')]);_0xec0404[_0x1b28('0x39')]=_[_0x1b28('0x4c')](_0xe742b0['query']);_0xec0404[_0x1b28('0x3a')]=_[_0x1b28('0x3b')](_0xec0404[_0x1b28('0x38')],_0xec0404[_0x1b28('0x39')]);_0x16f2f4[_0x1b28('0x3c')]=_['intersection'](_0xec0404[_0x1b28('0x38')],qs[_0x1b28('0x3d')](_0xe742b0[_0x1b28('0x39')][_0x1b28('0x3d')]));_0x16f2f4[_0x1b28('0x3c')]=_0x16f2f4['attributes'][_0x1b28('0x3e')]?_0x16f2f4['attributes']:_0xec0404['model'];_0x16f2f4[_0x1b28('0x56')]=qs[_0x1b28('0x42')](_0xe742b0[_0x1b28('0x39')]['sort']);_0x16f2f4[_0x1b28('0x43')]=qs[_0x1b28('0x3a')](_['pick'](_0xe742b0[_0x1b28('0x39')],_0xec0404['filters']));if(_0xe742b0[_0x1b28('0x39')][_0x1b28('0x45')]){_0x16f2f4['where']=_[_0x1b28('0x46')](_0x16f2f4[_0x1b28('0x43')],{'$or':_[_0x1b28('0x32')](_0x16f2f4[_0x1b28('0x3c')],function(_0x5f1e42){var _0x5d580c={};_0x5d580c[_0x5f1e42]={'$like':'%'+_0xe742b0[_0x1b28('0x39')][_0x1b28('0x45')]+'%'};return _0x5d580c;})});}_0x16f2f4=_[_0x1b28('0x46')]({},_0x16f2f4,_0xe742b0[_0x1b28('0x47')]);return _0x26115e[_0x1b28('0x54')](_0x16f2f4);}})[_0x1b28('0x17')](function(_0x19c9fc){if(_0x19c9fc){_0x4c0eaf=_0x19c9fc['length'];if(!_0xe742b0['query'][_0x1b28('0x3f')](_0x1b28('0x40'))){_0x16f2f4[_0x1b28('0x41')]=qs[_0x1b28('0x41')](_0xe742b0['query']['limit']);_0x16f2f4[_0x1b28('0x27')]=qs[_0x1b28('0x27')](_0xe742b0[_0x1b28('0x39')][_0x1b28('0x27')]);}return _0x26115e[_0x1b28('0x54')](_0x16f2f4);}})[_0x1b28('0x17')](function(_0x321134){if(_0x321134){return _0x321134?{'count':_0x4c0eaf,'rows':_0x321134}:null;}})[_0x1b28('0x17')](respondWithResult(_0x154397,null))['catch'](handleError(_0x154397,null));};exports[_0x1b28('0x57')]=function(_0x1f1ff5,_0x3552ef,_0x57fb4b){var _0x483dfa={};var _0x5918f4={};var _0x4e93c1;var _0x16687a;return db[_0x1b28('0x33')][_0x1b28('0x53')]({'where':{'id':_0x1f1ff5[_0x1b28('0x51')]['id']}})[_0x1b28('0x17')](handleEntityNotFound(_0x3552ef,null))[_0x1b28('0x17')](function(_0x3187f2){if(_0x3187f2){_0x4e93c1=_0x3187f2;_0x5918f4['model']=_[_0x1b28('0x4c')](db[_0x1b28('0x55')][_0x1b28('0x34')]);_0x5918f4[_0x1b28('0x39')]=_[_0x1b28('0x4c')](_0x1f1ff5[_0x1b28('0x39')]);_0x5918f4[_0x1b28('0x3a')]=_['intersection'](_0x5918f4[_0x1b28('0x38')],_0x5918f4['query']);_0x483dfa[_0x1b28('0x3c')]=_[_0x1b28('0x3b')](_0x5918f4[_0x1b28('0x38')],qs[_0x1b28('0x3d')](_0x1f1ff5[_0x1b28('0x39')][_0x1b28('0x3d')]));_0x483dfa[_0x1b28('0x3c')]=_0x483dfa[_0x1b28('0x3c')][_0x1b28('0x3e')]?_0x483dfa['attributes']:_0x5918f4[_0x1b28('0x38')];_0x483dfa['order']=qs['sort'](_0x1f1ff5[_0x1b28('0x39')][_0x1b28('0x42')]);_0x483dfa[_0x1b28('0x43')]=qs[_0x1b28('0x3a')](_[_0x1b28('0x44')](_0x1f1ff5[_0x1b28('0x39')],_0x5918f4['filters']));if(_0x1f1ff5[_0x1b28('0x39')][_0x1b28('0x45')]){_0x483dfa['where']=_[_0x1b28('0x46')](_0x483dfa[_0x1b28('0x43')],{'$or':_[_0x1b28('0x32')](_0x483dfa[_0x1b28('0x3c')],function(_0x5f3084){var _0x988844={};_0x988844[_0x5f3084]={'$like':'%'+_0x1f1ff5[_0x1b28('0x39')][_0x1b28('0x45')]+'%'};return _0x988844;})});}_0x483dfa=_['merge']({},_0x483dfa,_0x1f1ff5[_0x1b28('0x47')]);return _0x4e93c1[_0x1b28('0x57')](_0x483dfa);}})[_0x1b28('0x17')](function(_0x2054e9){if(_0x2054e9){_0x16687a=_0x2054e9['length'];if(!_0x1f1ff5['query'][_0x1b28('0x3f')](_0x1b28('0x40'))){_0x483dfa[_0x1b28('0x41')]=qs[_0x1b28('0x41')](_0x1f1ff5['query'][_0x1b28('0x41')]);_0x483dfa[_0x1b28('0x27')]=qs[_0x1b28('0x27')](_0x1f1ff5[_0x1b28('0x39')][_0x1b28('0x27')]);}return _0x4e93c1['getDescriptions'](_0x483dfa);}})[_0x1b28('0x17')](function(_0x13e20e){if(_0x13e20e){return _0x13e20e?{'count':_0x16687a,'rows':_0x13e20e}:null;}})[_0x1b28('0x17')](respondWithResult(_0x3552ef,null))[_0x1b28('0x22')](handleError(_0x3552ef,null));}; \ No newline at end of file +var _0xb753=['index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','type','VIRTUAL','merge','SugarcrmConfiguration','include','rows','params','includeAll','options','find','create','body','getFields','findOne','sort','getSubjects','SugarcrmField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','lodash','squel','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','name','send'];(function(_0x4362a2,_0x3ec5fc){var _0x19285c=function(_0x22d568){while(--_0x22d568){_0x4362a2['push'](_0x4362a2['shift']());}};_0x19285c(++_0x3ec5fc);}(_0xb753,0x80));var _0x3b75=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xb753[_0x543084];return _0x306a57;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3b75('0x0'));var rimraf=require(_0x3b75('0x1'));var zipdir=require(_0x3b75('0x2'));var jsonpatch=require(_0x3b75('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3b75('0x4'));var Mustache=require(_0x3b75('0x5'));var util=require(_0x3b75('0x6'));var path=require(_0x3b75('0x7'));var sox=require(_0x3b75('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3b75('0x9'));var squel=require(_0x3b75('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3b75('0xb'));var toCsv=require(_0x3b75('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3b75('0xd'));var authService=require(_0x3b75('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3b75('0xf'));var hardwareService=require(_0x3b75('0x10'));var logger=require(_0x3b75('0x11'))(_0x3b75('0x12'));var utils=require(_0x3b75('0x13'));var config=require(_0x3b75('0x14'));var licenseUtil=require(_0x3b75('0x15'));var db=require(_0x3b75('0x16'))['db'];var jayson=require(_0x3b75('0x17'));var client=jayson['client'][_0x3b75('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x418767,_0x4d416b,_0x244e0d,_0x3d5c20){return new BPromise(function(_0x538abc,_0x19bb91){var _0x22ef6f=_0x3d5c20||client;return _0x22ef6f[_0x3b75('0x19')](_0x418767,_0x244e0d)[_0x3b75('0x1a')](function(_0x32c96f){logger[_0x3b75('0x1b')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4d416b,_0x3b75('0x1c'));logger[_0x3b75('0x1d')](_0x3b75('0x1e'),_0x4d416b,_0x3b75('0x1c'),JSON[_0x3b75('0x1f')](_0x32c96f));if(_0x32c96f[_0x3b75('0x20')]){if(_0x32c96f[_0x3b75('0x20')][_0x3b75('0x21')]===0x1f4){logger[_0x3b75('0x20')](_0x3b75('0x22'),_0x4d416b,_0x32c96f[_0x3b75('0x20')][_0x3b75('0x23')]);return _0x19bb91(_0x32c96f[_0x3b75('0x20')][_0x3b75('0x23')]);}logger[_0x3b75('0x20')](_0x3b75('0x22'),_0x4d416b,_0x32c96f[_0x3b75('0x20')][_0x3b75('0x23')]);return _0x538abc(_0x32c96f[_0x3b75('0x20')][_0x3b75('0x23')]);}else{logger['info'](_0x3b75('0x22'),_0x4d416b,_0x3b75('0x1c'));_0x538abc(_0x32c96f[_0x3b75('0x24')][_0x3b75('0x23')]);}})[_0x3b75('0x25')](function(_0x3bacb2){logger[_0x3b75('0x20')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4d416b,_0x3bacb2);_0x19bb91(_0x3bacb2);});});}function respondWithStatusCode(_0x520eb9,_0x448ad8){_0x448ad8=_0x448ad8||0xcc;return function(_0x457f37){if(_0x457f37){return _0x520eb9['sendStatus'](_0x448ad8);}return _0x520eb9[_0x3b75('0x26')](_0x448ad8)[_0x3b75('0x27')]();};}function respondWithResult(_0x1b635c,_0x4ca75a){_0x4ca75a=_0x4ca75a||0xc8;return function(_0x8ab5ad){if(_0x8ab5ad){return _0x1b635c[_0x3b75('0x26')](_0x4ca75a)[_0x3b75('0x28')](_0x8ab5ad);}};}function respondWithFilteredResult(_0x5ac890,_0x568d41){return function(_0x19448e){if(_0x19448e){var _0x14568d=_0x19448e[_0x3b75('0x29')],_0x59439b=_0x568d41[_0x3b75('0x2a')],_0x1f85e7=_0x568d41[_0x3b75('0x2a')]+_0x568d41[_0x3b75('0x2b')],_0x3a959d;if(_0x1f85e7>=_0x14568d){_0x1f85e7=_0x14568d;_0x3a959d=0xc8;}else{_0x3a959d=0xce;}_0x5ac890[_0x3b75('0x26')](_0x3a959d);return _0x5ac890[_0x3b75('0x2c')](_0x3b75('0x2d'),_0x59439b+'-'+_0x1f85e7+'/'+_0x14568d)['json'](_0x19448e);}return null;};}function patchUpdates(_0x141b2b){return function(_0x1141d7){try{jsonpatch[_0x3b75('0x2e')](_0x1141d7,_0x141b2b,!![]);}catch(_0x188889){return BPromise[_0x3b75('0x2f')](_0x188889);}return _0x1141d7[_0x3b75('0x30')]();};}function saveUpdates(_0xc6fef7,_0x32c668){return function(_0x4c1539){if(_0x4c1539){return _0x4c1539[_0x3b75('0x31')](_0xc6fef7)[_0x3b75('0x1a')](function(_0x97b88f){return _0x97b88f;});}return null;};}function removeEntity(_0x93621f,_0x309b0e){return function(_0x438550){if(_0x438550){return _0x438550[_0x3b75('0x32')]()[_0x3b75('0x1a')](function(){_0x93621f[_0x3b75('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4803c7,_0x39780f){return function(_0x283d84){if(!_0x283d84){_0x4803c7[_0x3b75('0x33')](0x194);}return _0x283d84;};}function handleError(_0x4fbdfc,_0x12c6bb){_0x12c6bb=_0x12c6bb||0x1f4;return function(_0x1fcf36){logger[_0x3b75('0x20')](_0x1fcf36['stack']);if(_0x1fcf36[_0x3b75('0x34')]){delete _0x1fcf36[_0x3b75('0x34')];}_0x4fbdfc[_0x3b75('0x26')](_0x12c6bb)[_0x3b75('0x35')](_0x1fcf36);};}exports[_0x3b75('0x36')]=function(_0x4141eb,_0x22741b){var _0x536624={},_0x39ca3c={},_0x3fe44e={'count':0x0,'rows':[]};var _0x146e64=_[_0x3b75('0x37')](db['SugarcrmConfiguration'][_0x3b75('0x38')],function(_0x3ad1b9){return{'name':_0x3ad1b9[_0x3b75('0x39')],'type':_0x3ad1b9['type'][_0x3b75('0x3a')]};});_0x39ca3c[_0x3b75('0x3b')]=_[_0x3b75('0x37')](_0x146e64,_0x3b75('0x34'));_0x39ca3c[_0x3b75('0x3c')]=_[_0x3b75('0x3d')](_0x4141eb[_0x3b75('0x3c')]);_0x39ca3c[_0x3b75('0x3e')]=_['intersection'](_0x39ca3c[_0x3b75('0x3b')],_0x39ca3c['query']);_0x536624[_0x3b75('0x3f')]=_[_0x3b75('0x40')](_0x39ca3c[_0x3b75('0x3b')],qs[_0x3b75('0x41')](_0x4141eb[_0x3b75('0x3c')][_0x3b75('0x41')]));_0x536624[_0x3b75('0x3f')]=_0x536624[_0x3b75('0x3f')][_0x3b75('0x42')]?_0x536624['attributes']:_0x39ca3c['model'];if(!_0x4141eb[_0x3b75('0x3c')][_0x3b75('0x43')](_0x3b75('0x44'))){_0x536624['limit']=qs['limit'](_0x4141eb['query']['limit']);_0x536624[_0x3b75('0x2a')]=qs[_0x3b75('0x2a')](_0x4141eb[_0x3b75('0x3c')][_0x3b75('0x2a')]);}_0x536624[_0x3b75('0x45')]=qs['sort'](_0x4141eb[_0x3b75('0x3c')]['sort']);_0x536624[_0x3b75('0x46')]=qs['filters'](_[_0x3b75('0x47')](_0x4141eb[_0x3b75('0x3c')],_0x39ca3c[_0x3b75('0x3e')]),_0x146e64);if(_0x4141eb[_0x3b75('0x3c')][_0x3b75('0x48')]){_0x536624[_0x3b75('0x46')]=_['merge'](_0x536624['where'],{'$or':_[_0x3b75('0x37')](_0x146e64,function(_0x2be078){if(_0x2be078[_0x3b75('0x49')]!==_0x3b75('0x4a')){var _0x16c0cd={};_0x16c0cd[_0x2be078[_0x3b75('0x34')]]={'$like':'%'+_0x4141eb[_0x3b75('0x3c')][_0x3b75('0x48')]+'%'};return _0x16c0cd;}})});}_0x536624=_[_0x3b75('0x4b')]({},_0x536624,_0x4141eb['options']);var _0x1ee4ff={'where':_0x536624[_0x3b75('0x46')]};return db[_0x3b75('0x4c')][_0x3b75('0x29')](_0x1ee4ff)[_0x3b75('0x1a')](function(_0x51742c){_0x3fe44e[_0x3b75('0x29')]=_0x51742c;if(_0x4141eb[_0x3b75('0x3c')]['includeAll']){_0x536624[_0x3b75('0x4d')]=[{'all':!![]}];}return db[_0x3b75('0x4c')]['findAll'](_0x536624);})[_0x3b75('0x1a')](function(_0x28722a){_0x3fe44e[_0x3b75('0x4e')]=_0x28722a;return _0x3fe44e;})[_0x3b75('0x1a')](respondWithFilteredResult(_0x22741b,_0x536624))['catch'](handleError(_0x22741b,null));};exports['show']=function(_0x3e6ead,_0x4e7f40){var _0x2e9e73={'raw':![],'where':{'id':_0x3e6ead[_0x3b75('0x4f')]['id']}},_0x1c00fb={};_0x1c00fb[_0x3b75('0x3b')]=_[_0x3b75('0x3d')](db['SugarcrmConfiguration'][_0x3b75('0x38')]);_0x1c00fb[_0x3b75('0x3c')]=_['keys'](_0x3e6ead['query']);_0x1c00fb[_0x3b75('0x3e')]=_[_0x3b75('0x40')](_0x1c00fb[_0x3b75('0x3b')],_0x1c00fb['query']);_0x2e9e73[_0x3b75('0x3f')]=_[_0x3b75('0x40')](_0x1c00fb[_0x3b75('0x3b')],qs[_0x3b75('0x41')](_0x3e6ead[_0x3b75('0x3c')][_0x3b75('0x41')]));_0x2e9e73[_0x3b75('0x3f')]=_0x2e9e73[_0x3b75('0x3f')][_0x3b75('0x42')]?_0x2e9e73[_0x3b75('0x3f')]:_0x1c00fb[_0x3b75('0x3b')];if(_0x3e6ead[_0x3b75('0x3c')][_0x3b75('0x50')]){_0x2e9e73[_0x3b75('0x4d')]=[{'all':!![]}];}_0x2e9e73=_[_0x3b75('0x4b')]({},_0x2e9e73,_0x3e6ead[_0x3b75('0x51')]);return db[_0x3b75('0x4c')][_0x3b75('0x52')](_0x2e9e73)['then'](handleEntityNotFound(_0x4e7f40,null))[_0x3b75('0x1a')](respondWithResult(_0x4e7f40,null))[_0x3b75('0x25')](handleError(_0x4e7f40,null));};exports['create']=function(_0x373414,_0x1cfe5c){return db[_0x3b75('0x4c')][_0x3b75('0x53')](_0x373414['body'],{})[_0x3b75('0x1a')](respondWithResult(_0x1cfe5c,0xc9))[_0x3b75('0x25')](handleError(_0x1cfe5c,null));};exports[_0x3b75('0x31')]=function(_0x1a1da3,_0x2c3a1d){if(_0x1a1da3[_0x3b75('0x54')]['id']){delete _0x1a1da3['body']['id'];}return db[_0x3b75('0x4c')][_0x3b75('0x52')]({'where':{'id':_0x1a1da3[_0x3b75('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2c3a1d,null))[_0x3b75('0x1a')](saveUpdates(_0x1a1da3[_0x3b75('0x54')],null))[_0x3b75('0x1a')](respondWithResult(_0x2c3a1d,null))[_0x3b75('0x25')](handleError(_0x2c3a1d,null));};exports['destroy']=function(_0x1b0067,_0x4c7962){return db['SugarcrmConfiguration'][_0x3b75('0x52')]({'where':{'id':_0x1b0067['params']['id']}})['then'](handleEntityNotFound(_0x4c7962,null))[_0x3b75('0x1a')](removeEntity(_0x4c7962,null))[_0x3b75('0x25')](handleError(_0x4c7962,null));};exports[_0x3b75('0x55')]=function(_0x1092ae,_0xcf45,_0xa26e8b){var _0x331313={};var _0x54c732={};var _0x20ea91;var _0x37e40f;return db[_0x3b75('0x4c')][_0x3b75('0x56')]({'where':{'id':_0x1092ae[_0x3b75('0x4f')]['id']}})[_0x3b75('0x1a')](handleEntityNotFound(_0xcf45,null))['then'](function(_0x74d7fc){if(_0x74d7fc){_0x20ea91=_0x74d7fc;_0x54c732[_0x3b75('0x3b')]=_[_0x3b75('0x3d')](db['SugarcrmField'][_0x3b75('0x38')]);_0x54c732[_0x3b75('0x3c')]=_['keys'](_0x1092ae[_0x3b75('0x3c')]);_0x54c732[_0x3b75('0x3e')]=_[_0x3b75('0x40')](_0x54c732[_0x3b75('0x3b')],_0x54c732['query']);_0x331313['attributes']=_[_0x3b75('0x40')](_0x54c732[_0x3b75('0x3b')],qs[_0x3b75('0x41')](_0x1092ae[_0x3b75('0x3c')][_0x3b75('0x41')]));_0x331313[_0x3b75('0x3f')]=_0x331313[_0x3b75('0x3f')][_0x3b75('0x42')]?_0x331313[_0x3b75('0x3f')]:_0x54c732[_0x3b75('0x3b')];_0x331313['order']=qs[_0x3b75('0x57')](_0x1092ae[_0x3b75('0x3c')][_0x3b75('0x57')]);_0x331313[_0x3b75('0x46')]=qs[_0x3b75('0x3e')](_[_0x3b75('0x47')](_0x1092ae['query'],_0x54c732[_0x3b75('0x3e')]));if(_0x1092ae[_0x3b75('0x3c')][_0x3b75('0x48')]){_0x331313['where']=_[_0x3b75('0x4b')](_0x331313[_0x3b75('0x46')],{'$or':_['map'](_0x331313[_0x3b75('0x3f')],function(_0x34d739){var _0x667409={};_0x667409[_0x34d739]={'$like':'%'+_0x1092ae[_0x3b75('0x3c')][_0x3b75('0x48')]+'%'};return _0x667409;})});}_0x331313=_[_0x3b75('0x4b')]({},_0x331313,_0x1092ae[_0x3b75('0x51')]);return _0x20ea91[_0x3b75('0x55')](_0x331313);}})[_0x3b75('0x1a')](function(_0x390d3c){if(_0x390d3c){_0x37e40f=_0x390d3c[_0x3b75('0x42')];if(!_0x1092ae[_0x3b75('0x3c')][_0x3b75('0x43')](_0x3b75('0x44'))){_0x331313['limit']=qs[_0x3b75('0x2b')](_0x1092ae['query'][_0x3b75('0x2b')]);_0x331313['offset']=qs[_0x3b75('0x2a')](_0x1092ae[_0x3b75('0x3c')][_0x3b75('0x2a')]);}return _0x20ea91['getFields'](_0x331313);}})[_0x3b75('0x1a')](function(_0x35d9c7){if(_0x35d9c7){return _0x35d9c7?{'count':_0x37e40f,'rows':_0x35d9c7}:null;}})[_0x3b75('0x1a')](respondWithResult(_0xcf45,null))['catch'](handleError(_0xcf45,null));};exports[_0x3b75('0x58')]=function(_0x4c1dd7,_0x19a854,_0x4038a0){var _0x248e34={};var _0x56dac6={};var _0x4ed96b;var _0x335409;return db['SugarcrmConfiguration'][_0x3b75('0x56')]({'where':{'id':_0x4c1dd7[_0x3b75('0x4f')]['id']}})[_0x3b75('0x1a')](handleEntityNotFound(_0x19a854,null))[_0x3b75('0x1a')](function(_0x1058ea){if(_0x1058ea){_0x4ed96b=_0x1058ea;_0x56dac6[_0x3b75('0x3b')]=_[_0x3b75('0x3d')](db['SugarcrmField'][_0x3b75('0x38')]);_0x56dac6[_0x3b75('0x3c')]=_['keys'](_0x4c1dd7[_0x3b75('0x3c')]);_0x56dac6[_0x3b75('0x3e')]=_[_0x3b75('0x40')](_0x56dac6[_0x3b75('0x3b')],_0x56dac6[_0x3b75('0x3c')]);_0x248e34[_0x3b75('0x3f')]=_['intersection'](_0x56dac6[_0x3b75('0x3b')],qs[_0x3b75('0x41')](_0x4c1dd7['query'][_0x3b75('0x41')]));_0x248e34['attributes']=_0x248e34['attributes'][_0x3b75('0x42')]?_0x248e34['attributes']:_0x56dac6[_0x3b75('0x3b')];_0x248e34[_0x3b75('0x45')]=qs[_0x3b75('0x57')](_0x4c1dd7['query']['sort']);_0x248e34[_0x3b75('0x46')]=qs[_0x3b75('0x3e')](_['pick'](_0x4c1dd7['query'],_0x56dac6[_0x3b75('0x3e')]));if(_0x4c1dd7[_0x3b75('0x3c')][_0x3b75('0x48')]){_0x248e34[_0x3b75('0x46')]=_[_0x3b75('0x4b')](_0x248e34[_0x3b75('0x46')],{'$or':_['map'](_0x248e34[_0x3b75('0x3f')],function(_0x30fa89){var _0x32ff1c={};_0x32ff1c[_0x30fa89]={'$like':'%'+_0x4c1dd7[_0x3b75('0x3c')][_0x3b75('0x48')]+'%'};return _0x32ff1c;})});}_0x248e34=_[_0x3b75('0x4b')]({},_0x248e34,_0x4c1dd7[_0x3b75('0x51')]);return _0x4ed96b[_0x3b75('0x58')](_0x248e34);}})[_0x3b75('0x1a')](function(_0x1459d2){if(_0x1459d2){_0x335409=_0x1459d2[_0x3b75('0x42')];if(!_0x4c1dd7[_0x3b75('0x3c')][_0x3b75('0x43')](_0x3b75('0x44'))){_0x248e34['limit']=qs[_0x3b75('0x2b')](_0x4c1dd7[_0x3b75('0x3c')][_0x3b75('0x2b')]);_0x248e34[_0x3b75('0x2a')]=qs[_0x3b75('0x2a')](_0x4c1dd7['query'][_0x3b75('0x2a')]);}return _0x4ed96b[_0x3b75('0x58')](_0x248e34);}})[_0x3b75('0x1a')](function(_0x5ec795){if(_0x5ec795){return _0x5ec795?{'count':_0x335409,'rows':_0x5ec795}:null;}})[_0x3b75('0x1a')](respondWithResult(_0x19a854,null))[_0x3b75('0x25')](handleError(_0x19a854,null));};exports['getDescriptions']=function(_0x14c448,_0x25bb1a,_0x38f21b){var _0x53eed9={};var _0x5b3676={};var _0x528a8e;var _0x420f86;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x14c448[_0x3b75('0x4f')]['id']}})[_0x3b75('0x1a')](handleEntityNotFound(_0x25bb1a,null))[_0x3b75('0x1a')](function(_0x4277de){if(_0x4277de){_0x528a8e=_0x4277de;_0x5b3676['model']=_[_0x3b75('0x3d')](db[_0x3b75('0x59')][_0x3b75('0x38')]);_0x5b3676[_0x3b75('0x3c')]=_[_0x3b75('0x3d')](_0x14c448[_0x3b75('0x3c')]);_0x5b3676[_0x3b75('0x3e')]=_[_0x3b75('0x40')](_0x5b3676['model'],_0x5b3676[_0x3b75('0x3c')]);_0x53eed9[_0x3b75('0x3f')]=_[_0x3b75('0x40')](_0x5b3676[_0x3b75('0x3b')],qs[_0x3b75('0x41')](_0x14c448[_0x3b75('0x3c')][_0x3b75('0x41')]));_0x53eed9[_0x3b75('0x3f')]=_0x53eed9[_0x3b75('0x3f')]['length']?_0x53eed9[_0x3b75('0x3f')]:_0x5b3676[_0x3b75('0x3b')];_0x53eed9[_0x3b75('0x45')]=qs['sort'](_0x14c448[_0x3b75('0x3c')]['sort']);_0x53eed9[_0x3b75('0x46')]=qs[_0x3b75('0x3e')](_[_0x3b75('0x47')](_0x14c448[_0x3b75('0x3c')],_0x5b3676[_0x3b75('0x3e')]));if(_0x14c448[_0x3b75('0x3c')][_0x3b75('0x48')]){_0x53eed9[_0x3b75('0x46')]=_['merge'](_0x53eed9['where'],{'$or':_[_0x3b75('0x37')](_0x53eed9[_0x3b75('0x3f')],function(_0x23e0c1){var _0x4548c7={};_0x4548c7[_0x23e0c1]={'$like':'%'+_0x14c448[_0x3b75('0x3c')][_0x3b75('0x48')]+'%'};return _0x4548c7;})});}_0x53eed9=_[_0x3b75('0x4b')]({},_0x53eed9,_0x14c448['options']);return _0x528a8e[_0x3b75('0x5a')](_0x53eed9);}})[_0x3b75('0x1a')](function(_0x30b67f){if(_0x30b67f){_0x420f86=_0x30b67f[_0x3b75('0x42')];if(!_0x14c448['query'][_0x3b75('0x43')](_0x3b75('0x44'))){_0x53eed9[_0x3b75('0x2b')]=qs[_0x3b75('0x2b')](_0x14c448[_0x3b75('0x3c')]['limit']);_0x53eed9[_0x3b75('0x2a')]=qs[_0x3b75('0x2a')](_0x14c448[_0x3b75('0x3c')]['offset']);}return _0x528a8e['getDescriptions'](_0x53eed9);}})[_0x3b75('0x1a')](function(_0x2bcc41){if(_0x2bcc41){return _0x2bcc41?{'count':_0x420f86,'rows':_0x2bcc41}:null;}})[_0x3b75('0x1a')](respondWithResult(_0x25bb1a,null))['catch'](handleError(_0x25bb1a,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 573183f..5446484 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 _0x378a=['request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x10ccae,_0x48508c){var _0x34a8cf=function(_0x3ad775){while(--_0x3ad775){_0x10ccae['push'](_0x10ccae['shift']());}};_0x34a8cf(++_0x48508c);}(_0x378a,0x12e));var _0xa378=function(_0x560a48,_0x29f9ae){_0x560a48=_0x560a48-0x0;var _0x600970=_0x378a[_0x560a48];return _0x600970;};'use strict';var _=require(_0xa378('0x0'));var util=require(_0xa378('0x1'));var logger=require(_0xa378('0x2'))(_0xa378('0x3'));var moment=require(_0xa378('0x4'));var BPromise=require(_0xa378('0x5'));var rp=require(_0xa378('0x6'));var fs=require('fs');var path=require(_0xa378('0x7'));var rimraf=require(_0xa378('0x8'));var config=require(_0xa378('0x9'));var attributes=require(_0xa378('0xa'));module[_0xa378('0xb')]=function(_0x1bbe27,_0x4c0da7){return _0x1bbe27[_0xa378('0xc')](_0xa378('0xd'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d16=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','SugarcrmConfiguration','int_sugarcrm_configurations'];(function(_0x1404e0,_0x5c38f4){var _0x407bcb=function(_0x2421bf){while(--_0x2421bf){_0x1404e0['push'](_0x1404e0['shift']());}};_0x407bcb(++_0x5c38f4);}(_0x7d16,0x1a4));var _0x67d1=function(_0x876a5,_0x5b0bc0){_0x876a5=_0x876a5-0x0;var _0xcf4eb6=_0x7d16[_0x876a5];return _0xcf4eb6;};'use strict';var _=require(_0x67d1('0x0'));var util=require(_0x67d1('0x1'));var logger=require(_0x67d1('0x2'))(_0x67d1('0x3'));var moment=require(_0x67d1('0x4'));var BPromise=require(_0x67d1('0x5'));var rp=require(_0x67d1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x67d1('0x7'));var config=require(_0x67d1('0x8'));var attributes=require(_0x67d1('0x9'));module['exports']=function(_0xfa2fdf,_0x401a65){return _0xfa2fdf['define'](_0x67d1('0xa'),attributes,{'tableName':_0x67d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 91d6537..ff8f60f 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 _0x1881=['request\x20sent','debug','stringify','error','code','message','SugarcrmConfiguration,\x20%s,\x20%s','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x40957b,_0x3c579d){var _0x35ed3f=function(_0x4fa74c){while(--_0x4fa74c){_0x40957b['push'](_0x40957b['shift']());}};_0x35ed3f(++_0x3c579d);}(_0x1881,0x171));var _0x1188=function(_0x385669,_0x43d386){_0x385669=_0x385669-0x0;var _0x11e2d2=_0x1881[_0x385669];return _0x11e2d2;};'use strict';var _=require(_0x1188('0x0'));var util=require(_0x1188('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1188('0x2'));var fs=require('fs');var Redis=require(_0x1188('0x3'));var db=require(_0x1188('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1188('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1188('0x6'));var client=jayson[_0x1188('0x7')][_0x1188('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb9d851,_0x3c5800,_0x25b260){return new BPromise(function(_0x11a4cc,_0x4abeec){return client[_0x1188('0x9')](_0xb9d851,_0x25b260)[_0x1188('0xa')](function(_0xacd61d){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x3c5800,_0x1188('0xb'));logger[_0x1188('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x3c5800,_0x1188('0xb'),JSON[_0x1188('0xd')](_0xacd61d));if(_0xacd61d[_0x1188('0xe')]){if(_0xacd61d[_0x1188('0xe')][_0x1188('0xf')]===0x1f4){logger[_0x1188('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3c5800,_0xacd61d[_0x1188('0xe')][_0x1188('0x10')]);return _0x4abeec(_0xacd61d[_0x1188('0xe')]['message']);}logger[_0x1188('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3c5800,_0xacd61d[_0x1188('0xe')][_0x1188('0x10')]);return _0x11a4cc(_0xacd61d[_0x1188('0xe')][_0x1188('0x10')]);}else{logger['info'](_0x1188('0x11'),_0x3c5800,_0x1188('0xb'));_0x11a4cc(_0xacd61d[_0x1188('0x12')][_0x1188('0x10')]);}})[_0x1188('0x13')](function(_0x40cba7){logger[_0x1188('0xe')](_0x1188('0x11'),_0x3c5800,_0x40cba7);_0x4abeec(_0x40cba7);});});} \ No newline at end of file +var _0x88f3=['request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x23e8b0,_0x39f946){var _0x407799=function(_0x4638f7){while(--_0x4638f7){_0x23e8b0['push'](_0x23e8b0['shift']());}};_0x407799(++_0x39f946);}(_0x88f3,0x69));var _0x388f=function(_0x29c668,_0x5b0ce7){_0x29c668=_0x29c668-0x0;var _0x4c0ec1=_0x88f3[_0x29c668];return _0x4c0ec1;};'use strict';var _=require('lodash');var util=require(_0x388f('0x0'));var moment=require(_0x388f('0x1'));var BPromise=require(_0x388f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x388f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x388f('0x4'));var config=require(_0x388f('0x5'));var jayson=require(_0x388f('0x6'));var client=jayson[_0x388f('0x7')][_0x388f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b8318,_0x31aaf7,_0x33230e){return new BPromise(function(_0xed2269,_0x3b0247){return client[_0x388f('0x9')](_0x1b8318,_0x33230e)[_0x388f('0xa')](function(_0x407b46){logger[_0x388f('0xb')](_0x388f('0xc'),_0x31aaf7,'request\x20sent');logger['debug'](_0x388f('0xd'),_0x31aaf7,'request\x20sent',JSON[_0x388f('0xe')](_0x407b46));if(_0x407b46[_0x388f('0xf')]){if(_0x407b46[_0x388f('0xf')]['code']===0x1f4){logger[_0x388f('0xf')](_0x388f('0xc'),_0x31aaf7,_0x407b46[_0x388f('0xf')]['message']);return _0x3b0247(_0x407b46[_0x388f('0xf')]['message']);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x31aaf7,_0x407b46[_0x388f('0xf')][_0x388f('0x10')]);return _0xed2269(_0x407b46['error'][_0x388f('0x10')]);}else{logger[_0x388f('0xb')](_0x388f('0xc'),_0x31aaf7,'request\x20sent');_0xed2269(_0x407b46[_0x388f('0x11')][_0x388f('0x10')]);}})[_0x388f('0x12')](function(_0x212274){logger[_0x388f('0xf')](_0x388f('0xc'),_0x31aaf7,_0x212274);_0x3b0247(_0x212274);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index dfe2ab5..01419a8 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 _0x1410=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','index','/:id','show','isAuthenticated'];(function(_0x18c458,_0xb5b67a){var _0x445566=function(_0x24c937){while(--_0x24c937){_0x18c458['push'](_0x18c458['shift']());}};_0x445566(++_0xb5b67a);}(_0x1410,0x17e));var _0x0141=function(_0x57f329,_0x1dd4cc){_0x57f329=_0x57f329-0x0;var _0x105312=_0x1410[_0x57f329];return _0x105312;};'use strict';var multer=require(_0x0141('0x0'));var util=require('util');var path=require(_0x0141('0x1'));var timeout=require(_0x0141('0x2'));var express=require(_0x0141('0x3'));var router=express[_0x0141('0x4')]();var auth=require(_0x0141('0x5'));var interaction=require(_0x0141('0x6'));var config=require(_0x0141('0x7'));var controller=require(_0x0141('0x8'));router[_0x0141('0x9')]('/',auth['isAuthenticated'](),controller[_0x0141('0xa')]);router[_0x0141('0x9')](_0x0141('0xb'),auth['isAuthenticated'](),controller[_0x0141('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x0141('0xb'),auth[_0x0141('0xd')](),controller[_0x0141('0xe')]);router[_0x0141('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x0141('0x10')]);module[_0x0141('0x11')]=router; \ No newline at end of file +var _0x6da7=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','isAuthenticated','index','get','/:id','show','create','put','delete'];(function(_0x1afb33,_0x422c20){var _0x4548d9=function(_0x144acf){while(--_0x144acf){_0x1afb33['push'](_0x1afb33['shift']());}};_0x4548d9(++_0x422c20);}(_0x6da7,0xfe));var _0x76da=function(_0xde2fad,_0x16ed78){_0xde2fad=_0xde2fad-0x0;var _0x2a6456=_0x6da7[_0xde2fad];return _0x2a6456;};'use strict';var multer=require(_0x76da('0x0'));var util=require(_0x76da('0x1'));var path=require(_0x76da('0x2'));var timeout=require('connect-timeout');var express=require(_0x76da('0x3'));var router=express[_0x76da('0x4')]();var auth=require(_0x76da('0x5'));var interaction=require(_0x76da('0x6'));var config=require('../../config/environment');var controller=require(_0x76da('0x7'));router['get']('/',auth[_0x76da('0x8')](),controller[_0x76da('0x9')]);router[_0x76da('0xa')](_0x76da('0xb'),auth[_0x76da('0x8')](),controller[_0x76da('0xc')]);router['post']('/',auth[_0x76da('0x8')](),controller[_0x76da('0xd')]);router[_0x76da('0xe')](_0x76da('0xb'),auth[_0x76da('0x8')](),controller['update']);router[_0x76da('0xf')](_0x76da('0xb'),auth[_0x76da('0x8')](),controller[_0x76da('0x10')]);module[_0x76da('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index cbb3f5b..07aaa7a 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 _0x649b=['BOOLEAN','ENUM','string','keyValue','STRING','variable','customVariable'];(function(_0x13187a,_0x2fcec4){var _0x65b85f=function(_0x33bf1f){while(--_0x33bf1f){_0x13187a['push'](_0x13187a['shift']());}};_0x65b85f(++_0x2fcec4);}(_0x649b,0x166));var _0xb649=function(_0x303f7f,_0xdf2610){_0x303f7f=_0x303f7f-0x0;var _0x44cc80=_0x649b[_0x303f7f];return _0x44cc80;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xb649('0x0')](_0xb649('0x1'),'variable','customVariable',_0xb649('0x2')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb649('0x3')]},'key':{'type':Sequelize[_0xb649('0x3')]},'keyType':{'type':Sequelize[_0xb649('0x0')]('string',_0xb649('0x4'),_0xb649('0x5'))},'keyContent':{'type':Sequelize[_0xb649('0x3')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb649('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x692c=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0xfaf19d,_0x57304b){var _0x14a9d9=function(_0x5337fc){while(--_0x5337fc){_0xfaf19d['push'](_0xfaf19d['shift']());}};_0x14a9d9(++_0x57304b);}(_0x692c,0x6a));var _0xc692=function(_0x4bdb31,_0x5612be){_0x4bdb31=_0x4bdb31-0x0;var _0x525be2=_0x692c[_0x4bdb31];return _0x525be2;};'use strict';var Sequelize=require(_0xc692('0x0'));module[_0xc692('0x1')]={'type':{'type':Sequelize[_0xc692('0x2')](_0xc692('0x3'),_0xc692('0x4'),_0xc692('0x5'),'keyValue'),'defaultValue':_0xc692('0x3')},'content':{'type':Sequelize[_0xc692('0x6')]},'key':{'type':Sequelize[_0xc692('0x6')]},'keyType':{'type':Sequelize[_0xc692('0x2')](_0xc692('0x3'),_0xc692('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xc692('0x6')]},'nameField':{'type':Sequelize[_0xc692('0x6')]},'customField':{'type':Sequelize[_0xc692('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc692('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 3ba5e90..821e020 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 _0x5162=['sendStatus','status','end','json','count','offset','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','SugarcrmField','includeAll','include','findAll','rows','catch','params','fields','find','create','body','html-pdf','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x454918,_0x1dbc64){var _0x3a814b=function(_0x3d1c39){while(--_0x3d1c39){_0x454918['push'](_0x454918['shift']());}};_0x3a814b(++_0x1dbc64);}(_0x5162,0x103));var _0x2516=function(_0x2418e0,_0x7215b0){_0x2418e0=_0x2418e0-0x0;var _0x55ffbf=_0x5162[_0x2418e0];return _0x55ffbf;};'use strict';var pdf=require(_0x2516('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2516('0x1'));var moment=require(_0x2516('0x2'));var BPromise=require(_0x2516('0x3'));var Mustache=require(_0x2516('0x4'));var util=require(_0x2516('0x5'));var path=require(_0x2516('0x6'));var sox=require(_0x2516('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x2516('0x8'));var crypto=require(_0x2516('0x9'));var jsforce=require(_0x2516('0xa'));var deskjs=require(_0x2516('0xb'));var toCsv=require(_0x2516('0xc'));var querystring=require(_0x2516('0xd'));var Papa=require(_0x2516('0xe'));var Redis=require('ioredis');var authService=require(_0x2516('0xf'));var qs=require(_0x2516('0x10'));var as=require(_0x2516('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2516('0x12'));var licenseUtil=require(_0x2516('0x13'));var db=require(_0x2516('0x14'))['db'];function respondWithStatusCode(_0x3ef6ff,_0x56c69c){_0x56c69c=_0x56c69c||0xcc;return function(_0x33496b){if(_0x33496b){return _0x3ef6ff[_0x2516('0x15')](_0x56c69c);}return _0x3ef6ff[_0x2516('0x16')](_0x56c69c)[_0x2516('0x17')]();};}function respondWithResult(_0x42c771,_0x558d20){_0x558d20=_0x558d20||0xc8;return function(_0x3e5e0f){if(_0x3e5e0f){return _0x42c771[_0x2516('0x16')](_0x558d20)[_0x2516('0x18')](_0x3e5e0f);}};}function respondWithFilteredResult(_0x181a28,_0x2637e8){return function(_0x2ec31f){if(_0x2ec31f){var _0x19aacb=_0x2ec31f[_0x2516('0x19')],_0x5dee15=_0x2637e8[_0x2516('0x1a')],_0x3543d=_0x2637e8[_0x2516('0x1a')]+_0x2637e8['limit'],_0x5623be;if(_0x3543d>=_0x19aacb){_0x3543d=_0x19aacb;_0x5623be=0xc8;}else{_0x5623be=0xce;}_0x181a28[_0x2516('0x16')](_0x5623be);return _0x181a28['set']('Content-Range',_0x5dee15+'-'+_0x3543d+'/'+_0x19aacb)[_0x2516('0x18')](_0x2ec31f);}return null;};}function patchUpdates(_0x3583cf){return function(_0x151168){try{jsonpatch[_0x2516('0x1b')](_0x151168,_0x3583cf,!![]);}catch(_0x198b93){return BPromise[_0x2516('0x1c')](_0x198b93);}return _0x151168[_0x2516('0x1d')]();};}function saveUpdates(_0x113616,_0x248c5a){return function(_0x37485b){if(_0x37485b){return _0x37485b[_0x2516('0x1e')](_0x113616)[_0x2516('0x1f')](function(_0x1b0831){return _0x1b0831;});}return null;};}function removeEntity(_0x4fb7d9,_0x559a3e){return function(_0x12db4d){if(_0x12db4d){return _0x12db4d[_0x2516('0x20')]()[_0x2516('0x1f')](function(){_0x4fb7d9[_0x2516('0x16')](0xcc)[_0x2516('0x17')]();});}};}function handleEntityNotFound(_0x32de7a,_0x3d906d){return function(_0x950477){if(!_0x950477){_0x32de7a['sendStatus'](0x194);}return _0x950477;};}function handleError(_0xa4538d,_0x39c63f){_0x39c63f=_0x39c63f||0x1f4;return function(_0x774b60){logger[_0x2516('0x21')](_0x774b60['stack']);if(_0x774b60[_0x2516('0x22')]){delete _0x774b60[_0x2516('0x22')];}_0xa4538d[_0x2516('0x16')](_0x39c63f)[_0x2516('0x23')](_0x774b60);};}exports[_0x2516('0x24')]=function(_0x4a3dc8,_0x3c5c3c){var _0x1750e7={},_0x935035={},_0x2cb847={'count':0x0,'rows':[]};var _0x38ec50=_[_0x2516('0x25')](db['SugarcrmField'][_0x2516('0x26')],function(_0x20dc9f){return{'name':_0x20dc9f['fieldName'],'type':_0x20dc9f[_0x2516('0x27')][_0x2516('0x28')]};});_0x935035[_0x2516('0x29')]=_[_0x2516('0x25')](_0x38ec50,_0x2516('0x22'));_0x935035[_0x2516('0x2a')]=_[_0x2516('0x2b')](_0x4a3dc8[_0x2516('0x2a')]);_0x935035[_0x2516('0x2c')]=_[_0x2516('0x2d')](_0x935035[_0x2516('0x29')],_0x935035[_0x2516('0x2a')]);_0x1750e7[_0x2516('0x2e')]=_[_0x2516('0x2d')](_0x935035[_0x2516('0x29')],qs['fields'](_0x4a3dc8[_0x2516('0x2a')]['fields']));_0x1750e7[_0x2516('0x2e')]=_0x1750e7['attributes'][_0x2516('0x2f')]?_0x1750e7['attributes']:_0x935035[_0x2516('0x29')];if(!_0x4a3dc8[_0x2516('0x2a')][_0x2516('0x30')](_0x2516('0x31'))){_0x1750e7[_0x2516('0x32')]=qs[_0x2516('0x32')](_0x4a3dc8[_0x2516('0x2a')][_0x2516('0x32')]);_0x1750e7[_0x2516('0x1a')]=qs['offset'](_0x4a3dc8[_0x2516('0x2a')][_0x2516('0x1a')]);}_0x1750e7[_0x2516('0x33')]=qs[_0x2516('0x34')](_0x4a3dc8['query']['sort']);_0x1750e7[_0x2516('0x35')]=qs[_0x2516('0x2c')](_[_0x2516('0x36')](_0x4a3dc8[_0x2516('0x2a')],_0x935035[_0x2516('0x2c')]),_0x38ec50);if(_0x4a3dc8[_0x2516('0x2a')][_0x2516('0x37')]){_0x1750e7[_0x2516('0x35')]=_[_0x2516('0x38')](_0x1750e7[_0x2516('0x35')],{'$or':_['map'](_0x38ec50,function(_0x4844a1){if(_0x4844a1[_0x2516('0x27')]!==_0x2516('0x39')){var _0x494b51={};_0x494b51[_0x4844a1['name']]={'$like':'%'+_0x4a3dc8[_0x2516('0x2a')][_0x2516('0x37')]+'%'};return _0x494b51;}})});}_0x1750e7=_['merge']({},_0x1750e7,_0x4a3dc8[_0x2516('0x3a')]);var _0x52ef6b={'where':_0x1750e7[_0x2516('0x35')]};return db[_0x2516('0x3b')]['count'](_0x52ef6b)[_0x2516('0x1f')](function(_0x23629d){_0x2cb847[_0x2516('0x19')]=_0x23629d;if(_0x4a3dc8[_0x2516('0x2a')][_0x2516('0x3c')]){_0x1750e7[_0x2516('0x3d')]=[{'all':!![]}];}return db[_0x2516('0x3b')][_0x2516('0x3e')](_0x1750e7);})[_0x2516('0x1f')](function(_0xc1c0fb){_0x2cb847[_0x2516('0x3f')]=_0xc1c0fb;return _0x2cb847;})[_0x2516('0x1f')](respondWithFilteredResult(_0x3c5c3c,_0x1750e7))[_0x2516('0x40')](handleError(_0x3c5c3c,null));};exports['show']=function(_0x1b72cd,_0x1bc0e){var _0x5debf2={'raw':!![],'where':{'id':_0x1b72cd[_0x2516('0x41')]['id']}},_0xfd6236={};_0xfd6236[_0x2516('0x29')]=_[_0x2516('0x2b')](db[_0x2516('0x3b')]['rawAttributes']);_0xfd6236[_0x2516('0x2a')]=_[_0x2516('0x2b')](_0x1b72cd[_0x2516('0x2a')]);_0xfd6236[_0x2516('0x2c')]=_[_0x2516('0x2d')](_0xfd6236[_0x2516('0x29')],_0xfd6236['query']);_0x5debf2[_0x2516('0x2e')]=_[_0x2516('0x2d')](_0xfd6236[_0x2516('0x29')],qs[_0x2516('0x42')](_0x1b72cd[_0x2516('0x2a')][_0x2516('0x42')]));_0x5debf2[_0x2516('0x2e')]=_0x5debf2['attributes'][_0x2516('0x2f')]?_0x5debf2['attributes']:_0xfd6236[_0x2516('0x29')];if(_0x1b72cd['query'][_0x2516('0x3c')]){_0x5debf2[_0x2516('0x3d')]=[{'all':!![]}];}_0x5debf2=_[_0x2516('0x38')]({},_0x5debf2,_0x1b72cd['options']);return db['SugarcrmField'][_0x2516('0x43')](_0x5debf2)[_0x2516('0x1f')](handleEntityNotFound(_0x1bc0e,null))['then'](respondWithResult(_0x1bc0e,null))['catch'](handleError(_0x1bc0e,null));};exports[_0x2516('0x44')]=function(_0x147e05,_0x34f3d5){return db['SugarcrmField'][_0x2516('0x44')](_0x147e05['body'],{})[_0x2516('0x1f')](respondWithResult(_0x34f3d5,0xc9))[_0x2516('0x40')](handleError(_0x34f3d5,null));};exports[_0x2516('0x1e')]=function(_0x3af4c9,_0x579371){if(_0x3af4c9[_0x2516('0x45')]['id']){delete _0x3af4c9[_0x2516('0x45')]['id'];}return db[_0x2516('0x3b')][_0x2516('0x43')]({'where':{'id':_0x3af4c9[_0x2516('0x41')]['id']}})['then'](handleEntityNotFound(_0x579371,null))[_0x2516('0x1f')](saveUpdates(_0x3af4c9[_0x2516('0x45')],null))[_0x2516('0x1f')](respondWithResult(_0x579371,null))[_0x2516('0x40')](handleError(_0x579371,null));};exports['destroy']=function(_0x45e179,_0x35c1a5){return db[_0x2516('0x3b')][_0x2516('0x43')]({'where':{'id':_0x45e179[_0x2516('0x41')]['id']}})['then'](handleEntityNotFound(_0x35c1a5,null))[_0x2516('0x1f')](removeEntity(_0x35c1a5,null))[_0x2516('0x40')](handleError(_0x35c1a5,null));}; \ No newline at end of file +var _0xcca7=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','count','offset','limit','set','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','SugarcrmField','findAll','catch','show','params','find','create','update','body','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x146214,_0x13482f){var _0x2c2acb=function(_0xb0ad23){while(--_0xb0ad23){_0x146214['push'](_0x146214['shift']());}};_0x2c2acb(++_0x13482f);}(_0xcca7,0x1aa));var _0x7cca=function(_0x1a7c92,_0x42d377){_0x1a7c92=_0x1a7c92-0x0;var _0x5bdcf6=_0xcca7[_0x1a7c92];return _0x5bdcf6;};'use strict';var pdf=require(_0x7cca('0x0'));var emlformat=require(_0x7cca('0x1'));var rimraf=require(_0x7cca('0x2'));var zipdir=require(_0x7cca('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7cca('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7cca('0x5'));var util=require(_0x7cca('0x6'));var path=require(_0x7cca('0x7'));var sox=require(_0x7cca('0x8'));var csv=require(_0x7cca('0x9'));var ejs=require(_0x7cca('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7cca('0xb'));var jsforce=require(_0x7cca('0xc'));var deskjs=require(_0x7cca('0xd'));var toCsv=require(_0x7cca('0x9'));var querystring=require(_0x7cca('0xe'));var Papa=require(_0x7cca('0xf'));var Redis=require(_0x7cca('0x10'));var authService=require(_0x7cca('0x11'));var qs=require(_0x7cca('0x12'));var as=require(_0x7cca('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7cca('0x14'))(_0x7cca('0x15'));var utils=require(_0x7cca('0x16'));var config=require(_0x7cca('0x17'));var licenseUtil=require(_0x7cca('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a14cc,_0x41e0a2){_0x41e0a2=_0x41e0a2||0xcc;return function(_0x2854c7){if(_0x2854c7){return _0x2a14cc['sendStatus'](_0x41e0a2);}return _0x2a14cc['status'](_0x41e0a2)[_0x7cca('0x19')]();};}function respondWithResult(_0x20c1b2,_0x27d671){_0x27d671=_0x27d671||0xc8;return function(_0x847cce){if(_0x847cce){return _0x20c1b2[_0x7cca('0x1a')](_0x27d671)[_0x7cca('0x1b')](_0x847cce);}};}function respondWithFilteredResult(_0x45143d,_0x5a357d){return function(_0x216d4b){if(_0x216d4b){var _0x533608=_0x216d4b[_0x7cca('0x1c')],_0x5cd551=_0x5a357d[_0x7cca('0x1d')],_0x4eb7fa=_0x5a357d[_0x7cca('0x1d')]+_0x5a357d[_0x7cca('0x1e')],_0x33a466;if(_0x4eb7fa>=_0x533608){_0x4eb7fa=_0x533608;_0x33a466=0xc8;}else{_0x33a466=0xce;}_0x45143d['status'](_0x33a466);return _0x45143d[_0x7cca('0x1f')]('Content-Range',_0x5cd551+'-'+_0x4eb7fa+'/'+_0x533608)['json'](_0x216d4b);}return null;};}function patchUpdates(_0x5d7ac6){return function(_0x370469){try{jsonpatch[_0x7cca('0x20')](_0x370469,_0x5d7ac6,!![]);}catch(_0x2beb6c){return BPromise[_0x7cca('0x21')](_0x2beb6c);}return _0x370469[_0x7cca('0x22')]();};}function saveUpdates(_0x45db2f,_0x2e023c){return function(_0x1e183f){if(_0x1e183f){return _0x1e183f['update'](_0x45db2f)[_0x7cca('0x23')](function(_0x3154b0){return _0x3154b0;});}return null;};}function removeEntity(_0x165d13,_0x4343a3){return function(_0x55b689){if(_0x55b689){return _0x55b689[_0x7cca('0x24')]()[_0x7cca('0x23')](function(){_0x165d13[_0x7cca('0x1a')](0xcc)[_0x7cca('0x19')]();});}};}function handleEntityNotFound(_0x823d7d,_0x3fc157){return function(_0x1bf169){if(!_0x1bf169){_0x823d7d[_0x7cca('0x25')](0x194);}return _0x1bf169;};}function handleError(_0x4b99b6,_0xfe121c){_0xfe121c=_0xfe121c||0x1f4;return function(_0x1dd3b3){logger[_0x7cca('0x26')](_0x1dd3b3[_0x7cca('0x27')]);if(_0x1dd3b3[_0x7cca('0x28')]){delete _0x1dd3b3[_0x7cca('0x28')];}_0x4b99b6[_0x7cca('0x1a')](_0xfe121c)[_0x7cca('0x29')](_0x1dd3b3);};}exports['index']=function(_0x2cafe1,_0x5c8410){var _0xc86c1b={},_0x201fbb={},_0x5a87d6={'count':0x0,'rows':[]};var _0x17b137=_[_0x7cca('0x2a')](db['SugarcrmField'][_0x7cca('0x2b')],function(_0x1cd53a){return{'name':_0x1cd53a[_0x7cca('0x2c')],'type':_0x1cd53a['type']['key']};});_0x201fbb[_0x7cca('0x2d')]=_[_0x7cca('0x2a')](_0x17b137,_0x7cca('0x28'));_0x201fbb[_0x7cca('0x2e')]=_[_0x7cca('0x2f')](_0x2cafe1[_0x7cca('0x2e')]);_0x201fbb[_0x7cca('0x30')]=_['intersection'](_0x201fbb['model'],_0x201fbb[_0x7cca('0x2e')]);_0xc86c1b[_0x7cca('0x31')]=_[_0x7cca('0x32')](_0x201fbb['model'],qs[_0x7cca('0x33')](_0x2cafe1['query'][_0x7cca('0x33')]));_0xc86c1b[_0x7cca('0x31')]=_0xc86c1b[_0x7cca('0x31')][_0x7cca('0x34')]?_0xc86c1b['attributes']:_0x201fbb[_0x7cca('0x2d')];if(!_0x2cafe1[_0x7cca('0x2e')][_0x7cca('0x35')]('nolimit')){_0xc86c1b['limit']=qs['limit'](_0x2cafe1[_0x7cca('0x2e')][_0x7cca('0x1e')]);_0xc86c1b['offset']=qs[_0x7cca('0x1d')](_0x2cafe1[_0x7cca('0x2e')][_0x7cca('0x1d')]);}_0xc86c1b[_0x7cca('0x36')]=qs[_0x7cca('0x37')](_0x2cafe1[_0x7cca('0x2e')][_0x7cca('0x37')]);_0xc86c1b['where']=qs[_0x7cca('0x30')](_[_0x7cca('0x38')](_0x2cafe1[_0x7cca('0x2e')],_0x201fbb[_0x7cca('0x30')]),_0x17b137);if(_0x2cafe1['query'][_0x7cca('0x39')]){_0xc86c1b[_0x7cca('0x3a')]=_[_0x7cca('0x3b')](_0xc86c1b['where'],{'$or':_[_0x7cca('0x2a')](_0x17b137,function(_0x4bc7a7){if(_0x4bc7a7[_0x7cca('0x3c')]!==_0x7cca('0x3d')){var _0x442725={};_0x442725[_0x4bc7a7[_0x7cca('0x28')]]={'$like':'%'+_0x2cafe1[_0x7cca('0x2e')][_0x7cca('0x39')]+'%'};return _0x442725;}})});}_0xc86c1b=_[_0x7cca('0x3b')]({},_0xc86c1b,_0x2cafe1[_0x7cca('0x3e')]);var _0x3617b8={'where':_0xc86c1b['where']};return db['SugarcrmField'][_0x7cca('0x1c')](_0x3617b8)[_0x7cca('0x23')](function(_0x5cb715){_0x5a87d6['count']=_0x5cb715;if(_0x2cafe1[_0x7cca('0x2e')][_0x7cca('0x3f')]){_0xc86c1b[_0x7cca('0x40')]=[{'all':!![]}];}return db[_0x7cca('0x41')][_0x7cca('0x42')](_0xc86c1b);})['then'](function(_0x117bd7){_0x5a87d6['rows']=_0x117bd7;return _0x5a87d6;})['then'](respondWithFilteredResult(_0x5c8410,_0xc86c1b))[_0x7cca('0x43')](handleError(_0x5c8410,null));};exports[_0x7cca('0x44')]=function(_0x4c27de,_0x3b120b){var _0x5d1a4a={'raw':!![],'where':{'id':_0x4c27de[_0x7cca('0x45')]['id']}},_0x1303e0={};_0x1303e0[_0x7cca('0x2d')]=_['keys'](db[_0x7cca('0x41')][_0x7cca('0x2b')]);_0x1303e0[_0x7cca('0x2e')]=_[_0x7cca('0x2f')](_0x4c27de['query']);_0x1303e0[_0x7cca('0x30')]=_[_0x7cca('0x32')](_0x1303e0[_0x7cca('0x2d')],_0x1303e0[_0x7cca('0x2e')]);_0x5d1a4a[_0x7cca('0x31')]=_[_0x7cca('0x32')](_0x1303e0['model'],qs['fields'](_0x4c27de['query']['fields']));_0x5d1a4a[_0x7cca('0x31')]=_0x5d1a4a['attributes']['length']?_0x5d1a4a[_0x7cca('0x31')]:_0x1303e0[_0x7cca('0x2d')];if(_0x4c27de[_0x7cca('0x2e')][_0x7cca('0x3f')]){_0x5d1a4a[_0x7cca('0x40')]=[{'all':!![]}];}_0x5d1a4a=_['merge']({},_0x5d1a4a,_0x4c27de[_0x7cca('0x3e')]);return db[_0x7cca('0x41')][_0x7cca('0x46')](_0x5d1a4a)[_0x7cca('0x23')](handleEntityNotFound(_0x3b120b,null))[_0x7cca('0x23')](respondWithResult(_0x3b120b,null))[_0x7cca('0x43')](handleError(_0x3b120b,null));};exports[_0x7cca('0x47')]=function(_0x71f1d0,_0x20458d){return db[_0x7cca('0x41')][_0x7cca('0x47')](_0x71f1d0['body'],{})['then'](respondWithResult(_0x20458d,0xc9))[_0x7cca('0x43')](handleError(_0x20458d,null));};exports[_0x7cca('0x48')]=function(_0x40eb40,_0x41296d){if(_0x40eb40[_0x7cca('0x49')]['id']){delete _0x40eb40[_0x7cca('0x49')]['id'];}return db[_0x7cca('0x41')][_0x7cca('0x46')]({'where':{'id':_0x40eb40[_0x7cca('0x45')]['id']}})[_0x7cca('0x23')](handleEntityNotFound(_0x41296d,null))[_0x7cca('0x23')](saveUpdates(_0x40eb40[_0x7cca('0x49')],null))['then'](respondWithResult(_0x41296d,null))[_0x7cca('0x43')](handleError(_0x41296d,null));};exports[_0x7cca('0x24')]=function(_0x12565f,_0x74d4b3){return db[_0x7cca('0x41')][_0x7cca('0x46')]({'where':{'id':_0x12565f[_0x7cca('0x45')]['id']}})[_0x7cca('0x23')](handleEntityNotFound(_0x74d4b3,null))[_0x7cca('0x23')](removeEntity(_0x74d4b3,null))[_0x7cca('0x43')](handleError(_0x74d4b3,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 4342328..9f6f647 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 _0x7496=['rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x5138e0,_0x24fbbc){var _0x18e57b=function(_0x5eda17){while(--_0x5eda17){_0x5138e0['push'](_0x5138e0['shift']());}};_0x18e57b(++_0x24fbbc);}(_0x7496,0x149));var _0x6749=function(_0x6da7ba,_0x3b0caa){_0x6da7ba=_0x6da7ba-0x0;var _0x5393ff=_0x7496[_0x6da7ba];return _0x5393ff;};'use strict';var _=require(_0x6749('0x0'));var util=require(_0x6749('0x1'));var logger=require(_0x6749('0x2'))('api');var moment=require(_0x6749('0x3'));var BPromise=require(_0x6749('0x4'));var rp=require(_0x6749('0x5'));var fs=require('fs');var path=require(_0x6749('0x6'));var rimraf=require(_0x6749('0x7'));var config=require(_0x6749('0x8'));var attributes=require(_0x6749('0x9'));module[_0x6749('0xa')]=function(_0x2e5a4e,_0x507c57){return _0x2e5a4e[_0x6749('0xb')](_0x6749('0xc'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x6749('0xd'),'fields':[_0x6749('0xe'),_0x6749('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x95a7=['define','SugarcrmField','int_sugarcrm_fields','idField','util','../../config/logger','moment','../../config/environment','./intSugarcrmField.attributes','exports'];(function(_0x55edc6,_0x18485c){var _0xd2d02c=function(_0x5699f6){while(--_0x5699f6){_0x55edc6['push'](_0x55edc6['shift']());}};_0xd2d02c(++_0x18485c);}(_0x95a7,0x86));var _0x795a=function(_0x4c2069,_0x32b34d){_0x4c2069=_0x4c2069-0x0;var _0x1d350e=_0x95a7[_0x4c2069];return _0x1d350e;};'use strict';var _=require('lodash');var util=require(_0x795a('0x0'));var logger=require(_0x795a('0x1'))('api');var moment=require(_0x795a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x795a('0x3'));var attributes=require(_0x795a('0x4'));module[_0x795a('0x5')]=function(_0x2dc1a5,_0x494f8f){return _0x2dc1a5[_0x795a('0x6')](_0x795a('0x7'),attributes,{'tableName':_0x795a('0x8'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x795a('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index ed985ef..3f26ff6 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(_0x307c2e,_0x508f11){var _0xf7f8ed=function(_0x238d47){while(--_0x238d47){_0x307c2e['push'](_0x307c2e['shift']());}};_0xf7f8ed(++_0x508f11);}(_0x5eb8,0xb0));var _0x85eb=function(_0x58803c,_0x4a34df){_0x58803c=_0x58803c-0x0;var _0xf95b9b=_0x5eb8[_0x58803c];return _0xf95b9b;};'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 _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment'];(function(_0x4fe416,_0x5a310a){var _0x252725=function(_0x1d67db){while(--_0x1d67db){_0x4fe416['push'](_0x4fe416['shift']());}};_0x252725(++_0x5a310a);}(_0xda2d,0x102));var _0xdda2=function(_0x452fcc,_0x9791ea){_0x452fcc=_0x452fcc-0x0;var _0x3edb1e=_0xda2d[_0x452fcc];return _0x3edb1e;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 157c540..a427776 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 _0x4145=['util','connect-timeout','express','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','post','addConfiguration','put','destroy','exports'];(function(_0x5d7d98,_0x3a7b6f){var _0xa764e6=function(_0x473a90){while(--_0x473a90){_0x5d7d98['push'](_0x5d7d98['shift']());}};_0xa764e6(++_0x3a7b6f);}(_0x4145,0x77));var _0x5414=function(_0x154abf,_0x159b0a){_0x154abf=_0x154abf-0x0;var _0xf53fb5=_0x4145[_0x154abf];return _0xf53fb5;};'use strict';var multer=require('multer');var util=require(_0x5414('0x0'));var path=require('path');var timeout=require(_0x5414('0x1'));var express=require(_0x5414('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5414('0x3'));var config=require(_0x5414('0x4'));var controller=require(_0x5414('0x5'));router[_0x5414('0x6')]('/',auth[_0x5414('0x7')](),controller[_0x5414('0x8')]);router[_0x5414('0x6')](_0x5414('0x9'),auth[_0x5414('0x7')](),controller[_0x5414('0xa')]);router['get']('/:id/configurations',auth[_0x5414('0x7')](),controller['getConfigurations']);router[_0x5414('0x6')](_0x5414('0xb'),auth[_0x5414('0x7')](),controller['getFields']);router['post']('/',auth[_0x5414('0x7')](),controller['create']);router[_0x5414('0xc')]('/:id/configurations',auth[_0x5414('0x7')](),controller[_0x5414('0xd')]);router[_0x5414('0xe')]('/:id',auth[_0x5414('0x7')](),controller['update']);router['delete'](_0x5414('0x9'),auth[_0x5414('0x7')](),controller[_0x5414('0xf')]);module[_0x5414('0x10')]=router; \ No newline at end of file +var _0xca4c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','create','addConfiguration','put','update','delete','destroy','exports','path','connect-timeout','express','Router'];(function(_0x2d3154,_0x4a3b00){var _0x5d93e9=function(_0x53eb31){while(--_0x53eb31){_0x2d3154['push'](_0x2d3154['shift']());}};_0x5d93e9(++_0x4a3b00);}(_0xca4c,0x19e));var _0xcca4=function(_0xc1af5b,_0x396ee0){_0xc1af5b=_0xc1af5b-0x0;var _0x2a5d00=_0xca4c[_0xc1af5b];return _0x2a5d00;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcca4('0x0'));var timeout=require(_0xcca4('0x1'));var express=require(_0xcca4('0x2'));var router=express[_0xcca4('0x3')]();var auth=require(_0xcca4('0x4'));var interaction=require(_0xcca4('0x5'));var config=require(_0xcca4('0x6'));var controller=require(_0xcca4('0x7'));router[_0xcca4('0x8')]('/',auth[_0xcca4('0x9')](),controller[_0xcca4('0xa')]);router[_0xcca4('0x8')](_0xcca4('0xb'),auth[_0xcca4('0x9')](),controller['show']);router[_0xcca4('0x8')](_0xcca4('0xc'),auth[_0xcca4('0x9')](),controller[_0xcca4('0xd')]);router[_0xcca4('0x8')]('/:id/fields',auth[_0xcca4('0x9')](),controller[_0xcca4('0xe')]);router['post']('/',auth[_0xcca4('0x9')](),controller[_0xcca4('0xf')]);router['post']('/:id/configurations',auth[_0xcca4('0x9')](),controller[_0xcca4('0x10')]);router[_0xcca4('0x11')]('/:id',auth[_0xcca4('0x9')](),controller[_0xcca4('0x12')]);router[_0xcca4('0x13')](_0xcca4('0xb'),auth[_0xcca4('0x9')](),controller[_0xcca4('0x14')]);module[_0xcca4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index cf6422f..ee6b7a1 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 _0xdb26=['sequelize','STRING','HelpDesk'];(function(_0x1dc8d0,_0x2f78eb){var _0x2aa453=function(_0x198475){while(--_0x198475){_0x1dc8d0['push'](_0x1dc8d0['shift']());}};_0x2aa453(++_0x2f78eb);}(_0xdb26,0xb7));var _0x6db2=function(_0x456ce8,_0x336e87){_0x456ce8=_0x456ce8-0x0;var _0x4086ff=_0xdb26[_0x456ce8];return _0x4086ff;};'use strict';var Sequelize=require(_0x6db2('0x0'));module['exports']={'name':{'type':Sequelize[_0x6db2('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6db2('0x1')]},'username':{'type':Sequelize[_0x6db2('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x6db2('0x1')],'allowNull':![],'defaultValue':_0x6db2('0x2')},'remoteUri':{'type':Sequelize[_0x6db2('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x6db2('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x6db2('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x2f93=['exports','STRING','HelpDesk','sequelize'];(function(_0x809081,_0x59ee0d){var _0x3eaf6f=function(_0x4469af){while(--_0x4469af){_0x809081['push'](_0x809081['shift']());}};_0x3eaf6f(++_0x59ee0d);}(_0x2f93,0x14f));var _0x32f9=function(_0x4c7337,_0x13146e){_0x4c7337=_0x4c7337-0x0;var _0x337711=_0x2f93[_0x4c7337];return _0x337711;};'use strict';var Sequelize=require(_0x32f9('0x0'));module[_0x32f9('0x1')]={'name':{'type':Sequelize[_0x32f9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x32f9('0x2')]},'username':{'type':Sequelize[_0x32f9('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x32f9('0x2')],'allowNull':![],'defaultValue':_0x32f9('0x3')},'remoteUri':{'type':Sequelize[_0x32f9('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x32f9('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 b6ed6a0..1526378 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 _0xbf25=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','destroy','stack','name','send','map','VtigerAccount','rawAttributes','model','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','findAll','params','include','options','find','create','body','getConfigurations','keys','VtigerConfiguration','addConfiguration','findOne','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','moduleName','remoteUri','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','token','sessionName','autogenerated','reference','owner','remove','label','startsWith','cf_','picklistValues','log','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xbf25,0x15e));var _0x5bf2=function(_0x45e278,_0x2eef7a){_0x45e278=_0x45e278-0x0;var _0x419382=_0xbf25[_0x45e278];return _0x419382;};'use strict';var pdf=require(_0x5bf2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5bf2('0x1'));var zipdir=require(_0x5bf2('0x2'));var jsonpatch=require(_0x5bf2('0x3'));var rp=require(_0x5bf2('0x4'));var moment=require(_0x5bf2('0x5'));var BPromise=require(_0x5bf2('0x6'));var Mustache=require('mustache');var util=require(_0x5bf2('0x7'));var path=require('path');var sox=require(_0x5bf2('0x8'));var csv=require(_0x5bf2('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5bf2('0xa'));var squel=require(_0x5bf2('0xb'));var crypto=require(_0x5bf2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5bf2('0xd'));var toCsv=require(_0x5bf2('0x9'));var querystring=require(_0x5bf2('0xe'));var Papa=require('papaparse');var Redis=require(_0x5bf2('0xf'));var authService=require(_0x5bf2('0x10'));var qs=require(_0x5bf2('0x11'));var as=require(_0x5bf2('0x12'));var hardwareService=require(_0x5bf2('0x13'));var logger=require(_0x5bf2('0x14'))(_0x5bf2('0x15'));var utils=require(_0x5bf2('0x16'));var config=require(_0x5bf2('0x17'));var licenseUtil=require(_0x5bf2('0x18'));var db=require(_0x5bf2('0x19'))['db'];var integrations=require(_0x5bf2('0x1a'));var jayson=require(_0x5bf2('0x1b'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b2e52,_0x370f33,_0x5d3cb6,_0x10c8a1){return new BPromise(function(_0x43a83b,_0x1bdb56){var _0x21a3a1=_0x10c8a1||client;return _0x21a3a1[_0x5bf2('0x1c')](_0x2b2e52,_0x5d3cb6)[_0x5bf2('0x1d')](function(_0x3083cd){logger[_0x5bf2('0x1e')](_0x5bf2('0x1f'),_0x370f33,_0x5bf2('0x20'));logger[_0x5bf2('0x21')](_0x5bf2('0x22'),_0x370f33,'request\x20sent',JSON['stringify'](_0x3083cd));if(_0x3083cd[_0x5bf2('0x23')]){if(_0x3083cd['error'][_0x5bf2('0x24')]===0x1f4){logger[_0x5bf2('0x23')]('VtigerAccount,\x20%s,\x20%s',_0x370f33,_0x3083cd['error'][_0x5bf2('0x25')]);return _0x1bdb56(_0x3083cd[_0x5bf2('0x23')][_0x5bf2('0x25')]);}logger[_0x5bf2('0x23')](_0x5bf2('0x1f'),_0x370f33,_0x3083cd[_0x5bf2('0x23')][_0x5bf2('0x25')]);return _0x43a83b(_0x3083cd[_0x5bf2('0x23')][_0x5bf2('0x25')]);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x370f33,_0x5bf2('0x20'));_0x43a83b(_0x3083cd[_0x5bf2('0x26')][_0x5bf2('0x25')]);}})[_0x5bf2('0x27')](function(_0x18caac){logger[_0x5bf2('0x23')](_0x5bf2('0x1f'),_0x370f33,_0x18caac);_0x1bdb56(_0x18caac);});});}function respondWithStatusCode(_0x2eea63,_0x239206){_0x239206=_0x239206||0xcc;return function(_0x2825c7){if(_0x2825c7){return _0x2eea63[_0x5bf2('0x28')](_0x239206);}return _0x2eea63[_0x5bf2('0x29')](_0x239206)[_0x5bf2('0x2a')]();};}function respondWithResult(_0x5ae161,_0x1a90e7){_0x1a90e7=_0x1a90e7||0xc8;return function(_0x4d3067){if(_0x4d3067){return _0x5ae161[_0x5bf2('0x29')](_0x1a90e7)[_0x5bf2('0x2b')](_0x4d3067);}};}function respondWithFilteredResult(_0x569d26,_0xc028a0){return function(_0x427e7f){if(_0x427e7f){var _0x5cefb3=_0x427e7f[_0x5bf2('0x2c')],_0x5426f9=_0xc028a0[_0x5bf2('0x2d')],_0x8c54cd=_0xc028a0['offset']+_0xc028a0[_0x5bf2('0x2e')],_0x2ec339;if(_0x8c54cd>=_0x5cefb3){_0x8c54cd=_0x5cefb3;_0x2ec339=0xc8;}else{_0x2ec339=0xce;}_0x569d26[_0x5bf2('0x29')](_0x2ec339);return _0x569d26[_0x5bf2('0x2f')](_0x5bf2('0x30'),_0x5426f9+'-'+_0x8c54cd+'/'+_0x5cefb3)[_0x5bf2('0x2b')](_0x427e7f);}return null;};}function patchUpdates(_0x1dbb36){return function(_0x5a68bc){try{jsonpatch[_0x5bf2('0x31')](_0x5a68bc,_0x1dbb36,!![]);}catch(_0x2ea937){return BPromise[_0x5bf2('0x32')](_0x2ea937);}return _0x5a68bc['save']();};}function saveUpdates(_0x7023ae,_0x432de6){return function(_0x39b78c){if(_0x39b78c){return _0x39b78c['update'](_0x7023ae)['then'](function(_0x5284fe){return _0x5284fe;});}return null;};}function removeEntity(_0x3d1840,_0x19f46e){return function(_0x313c03){if(_0x313c03){return _0x313c03[_0x5bf2('0x33')]()[_0x5bf2('0x1d')](function(){_0x3d1840['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x19a3ef,_0x4d4080){return function(_0x8904f0){if(!_0x8904f0){_0x19a3ef[_0x5bf2('0x28')](0x194);}return _0x8904f0;};}function handleError(_0x3245ae,_0x1128f8){_0x1128f8=_0x1128f8||0x1f4;return function(_0x3f2546){logger[_0x5bf2('0x23')](_0x3f2546[_0x5bf2('0x34')]);if(_0x3f2546[_0x5bf2('0x35')]){delete _0x3f2546[_0x5bf2('0x35')];}_0x3245ae[_0x5bf2('0x29')](_0x1128f8)[_0x5bf2('0x36')](_0x3f2546);};}exports['index']=function(_0x47152b,_0x510340){var _0x537e3b={},_0x5dbee1={},_0x5e472c={'count':0x0,'rows':[]};var _0x15caaf=_[_0x5bf2('0x37')](db[_0x5bf2('0x38')][_0x5bf2('0x39')],function(_0x122e64){return{'name':_0x122e64['fieldName'],'type':_0x122e64['type']['key']};});_0x5dbee1[_0x5bf2('0x3a')]=_[_0x5bf2('0x37')](_0x15caaf,'name');_0x5dbee1['query']=_['keys'](_0x47152b['query']);_0x5dbee1[_0x5bf2('0x3b')]=_['intersection'](_0x5dbee1[_0x5bf2('0x3a')],_0x5dbee1[_0x5bf2('0x3c')]);_0x537e3b[_0x5bf2('0x3d')]=_[_0x5bf2('0x3e')](_0x5dbee1[_0x5bf2('0x3a')],qs['fields'](_0x47152b['query'][_0x5bf2('0x3f')]));_0x537e3b[_0x5bf2('0x3d')]=_0x537e3b[_0x5bf2('0x3d')][_0x5bf2('0x40')]?_0x537e3b['attributes']:_0x5dbee1['model'];if(!_0x47152b[_0x5bf2('0x3c')][_0x5bf2('0x41')](_0x5bf2('0x42'))){_0x537e3b['limit']=qs[_0x5bf2('0x2e')](_0x47152b['query'][_0x5bf2('0x2e')]);_0x537e3b['offset']=qs[_0x5bf2('0x2d')](_0x47152b[_0x5bf2('0x3c')][_0x5bf2('0x2d')]);}_0x537e3b[_0x5bf2('0x43')]=qs[_0x5bf2('0x44')](_0x47152b[_0x5bf2('0x3c')][_0x5bf2('0x44')]);_0x537e3b['where']=qs['filters'](_[_0x5bf2('0x45')](_0x47152b['query'],_0x5dbee1['filters']),_0x15caaf);if(_0x47152b[_0x5bf2('0x3c')][_0x5bf2('0x46')]){_0x537e3b[_0x5bf2('0x47')]=_[_0x5bf2('0x48')](_0x537e3b[_0x5bf2('0x47')],{'$or':_['map'](_0x15caaf,function(_0x16703f){if(_0x16703f[_0x5bf2('0x49')]!==_0x5bf2('0x4a')){var _0x55acb6={};_0x55acb6[_0x16703f[_0x5bf2('0x35')]]={'$like':'%'+_0x47152b['query'][_0x5bf2('0x46')]+'%'};return _0x55acb6;}})});}_0x537e3b=_[_0x5bf2('0x48')]({},_0x537e3b,_0x47152b['options']);var _0x1cac50={'where':_0x537e3b['where']};return db['VtigerAccount'][_0x5bf2('0x2c')](_0x1cac50)['then'](function(_0x5e3abd){_0x5e472c['count']=_0x5e3abd;if(_0x47152b[_0x5bf2('0x3c')][_0x5bf2('0x4b')]){_0x537e3b['include']=[{'all':!![]}];}return db[_0x5bf2('0x38')][_0x5bf2('0x4c')](_0x537e3b);})[_0x5bf2('0x1d')](function(_0xe99fd9){_0x5e472c['rows']=_0xe99fd9;return _0x5e472c;})[_0x5bf2('0x1d')](respondWithFilteredResult(_0x510340,_0x537e3b))[_0x5bf2('0x27')](handleError(_0x510340,null));};exports['show']=function(_0x5b09c7,_0x1d7ea2){var _0x4f5d18={'raw':![],'where':{'id':_0x5b09c7[_0x5bf2('0x4d')]['id']}},_0x278e21={};_0x278e21['model']=_['keys'](db[_0x5bf2('0x38')]['rawAttributes']);_0x278e21[_0x5bf2('0x3c')]=_['keys'](_0x5b09c7['query']);_0x278e21[_0x5bf2('0x3b')]=_[_0x5bf2('0x3e')](_0x278e21[_0x5bf2('0x3a')],_0x278e21['query']);_0x4f5d18[_0x5bf2('0x3d')]=_[_0x5bf2('0x3e')](_0x278e21['model'],qs['fields'](_0x5b09c7[_0x5bf2('0x3c')]['fields']));_0x4f5d18[_0x5bf2('0x3d')]=_0x4f5d18[_0x5bf2('0x3d')]['length']?_0x4f5d18['attributes']:_0x278e21[_0x5bf2('0x3a')];if(_0x5b09c7[_0x5bf2('0x3c')][_0x5bf2('0x4b')]){_0x4f5d18[_0x5bf2('0x4e')]=[{'all':!![]}];}_0x4f5d18=_[_0x5bf2('0x48')]({},_0x4f5d18,_0x5b09c7[_0x5bf2('0x4f')]);return db[_0x5bf2('0x38')][_0x5bf2('0x50')](_0x4f5d18)[_0x5bf2('0x1d')](handleEntityNotFound(_0x1d7ea2,null))['then'](respondWithResult(_0x1d7ea2,null))['catch'](handleError(_0x1d7ea2,null));};exports[_0x5bf2('0x51')]=function(_0x27e7e2,_0x208bfa){return db['VtigerAccount']['create'](_0x27e7e2['body'],{})['then'](respondWithResult(_0x208bfa,0xc9))[_0x5bf2('0x27')](handleError(_0x208bfa,null));};exports['update']=function(_0x3bc117,_0x1283da){if(_0x3bc117['body']['id']){delete _0x3bc117[_0x5bf2('0x52')]['id'];}return db[_0x5bf2('0x38')][_0x5bf2('0x50')]({'where':{'id':_0x3bc117['params']['id']}})[_0x5bf2('0x1d')](handleEntityNotFound(_0x1283da,null))[_0x5bf2('0x1d')](saveUpdates(_0x3bc117[_0x5bf2('0x52')],null))['then'](respondWithResult(_0x1283da,null))[_0x5bf2('0x27')](handleError(_0x1283da,null));};exports[_0x5bf2('0x33')]=function(_0x304937,_0x3f9b08){return db['VtigerAccount'][_0x5bf2('0x50')]({'where':{'id':_0x304937['params']['id']}})['then'](handleEntityNotFound(_0x3f9b08,null))[_0x5bf2('0x1d')](removeEntity(_0x3f9b08,null))[_0x5bf2('0x27')](handleError(_0x3f9b08,null));};exports[_0x5bf2('0x53')]=function(_0x5a375f,_0x109754,_0x4f2e7c){var _0x5428a7={};var _0x4452f6={};var _0x11a6ce;var _0x687931;return db[_0x5bf2('0x38')]['findOne']({'where':{'id':_0x5a375f[_0x5bf2('0x4d')]['id']}})[_0x5bf2('0x1d')](handleEntityNotFound(_0x109754,null))[_0x5bf2('0x1d')](function(_0x1342c2){if(_0x1342c2){_0x11a6ce=_0x1342c2;_0x4452f6[_0x5bf2('0x3a')]=_[_0x5bf2('0x54')](db[_0x5bf2('0x55')][_0x5bf2('0x39')]);_0x4452f6[_0x5bf2('0x3c')]=_[_0x5bf2('0x54')](_0x5a375f[_0x5bf2('0x3c')]);_0x4452f6[_0x5bf2('0x3b')]=_[_0x5bf2('0x3e')](_0x4452f6[_0x5bf2('0x3a')],_0x4452f6[_0x5bf2('0x3c')]);_0x5428a7[_0x5bf2('0x3d')]=_[_0x5bf2('0x3e')](_0x4452f6[_0x5bf2('0x3a')],qs[_0x5bf2('0x3f')](_0x5a375f[_0x5bf2('0x3c')][_0x5bf2('0x3f')]));_0x5428a7[_0x5bf2('0x3d')]=_0x5428a7[_0x5bf2('0x3d')]['length']?_0x5428a7[_0x5bf2('0x3d')]:_0x4452f6['model'];_0x5428a7[_0x5bf2('0x43')]=qs[_0x5bf2('0x44')](_0x5a375f[_0x5bf2('0x3c')]['sort']);_0x5428a7[_0x5bf2('0x47')]=qs[_0x5bf2('0x3b')](_[_0x5bf2('0x45')](_0x5a375f[_0x5bf2('0x3c')],_0x4452f6[_0x5bf2('0x3b')]));if(_0x5a375f[_0x5bf2('0x3c')][_0x5bf2('0x46')]){_0x5428a7[_0x5bf2('0x47')]=_[_0x5bf2('0x48')](_0x5428a7[_0x5bf2('0x47')],{'$or':_[_0x5bf2('0x37')](_0x5428a7[_0x5bf2('0x3d')],function(_0x27a46d){var _0x552f31={};_0x552f31[_0x27a46d]={'$like':'%'+_0x5a375f['query'][_0x5bf2('0x46')]+'%'};return _0x552f31;})});}_0x5428a7=_[_0x5bf2('0x48')]({},_0x5428a7,_0x5a375f[_0x5bf2('0x4f')]);return _0x11a6ce[_0x5bf2('0x53')](_0x5428a7);}})['then'](function(_0x3615ff){if(_0x3615ff){_0x687931=_0x3615ff[_0x5bf2('0x40')];if(!_0x5a375f[_0x5bf2('0x3c')][_0x5bf2('0x41')]('nolimit')){_0x5428a7[_0x5bf2('0x2e')]=qs[_0x5bf2('0x2e')](_0x5a375f['query'][_0x5bf2('0x2e')]);_0x5428a7['offset']=qs[_0x5bf2('0x2d')](_0x5a375f['query'][_0x5bf2('0x2d')]);}return _0x11a6ce[_0x5bf2('0x53')](_0x5428a7);}})['then'](function(_0x408a96){if(_0x408a96){return _0x408a96?{'count':_0x687931,'rows':_0x408a96}:null;}})[_0x5bf2('0x1d')](respondWithResult(_0x109754,null))[_0x5bf2('0x27')](handleError(_0x109754,null));};exports[_0x5bf2('0x56')]=function(_0x35cdb9,_0x5ba65c,_0x11b9c6){if(_0x35cdb9[_0x5bf2('0x52')]['id']){delete _0x35cdb9['body']['id'];}return db[_0x5bf2('0x38')][_0x5bf2('0x57')]({'where':{'id':_0x35cdb9[_0x5bf2('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5ba65c,null))['then'](function(_0xe363eb){if(_0xe363eb){_0x35cdb9[_0x5bf2('0x52')]['AccountId']=_0xe363eb['id'];_0x35cdb9[_0x5bf2('0x52')]['Subjects']=integrations[_0x5bf2('0x58')](_0x35cdb9['body'][_0x5bf2('0x59')],_0x35cdb9[_0x5bf2('0x52')][_0x5bf2('0x49')]);_0x35cdb9[_0x5bf2('0x52')][_0x5bf2('0x5a')]=integrations[_0x5bf2('0x5b')](_0x35cdb9[_0x5bf2('0x52')]['channel'],_0x35cdb9[_0x5bf2('0x52')][_0x5bf2('0x49')]);return db[_0x5bf2('0x55')][_0x5bf2('0x51')](_0x35cdb9['body'],{'include':[{'model':db[_0x5bf2('0x5c')],'as':'Subjects'},{'model':db[_0x5bf2('0x5c')],'as':_0x5bf2('0x5a')}]});}return null;})[_0x5bf2('0x1d')](respondWithResult(_0x5ba65c,null))['catch'](handleError(_0x5ba65c,null));};var md5=require(_0x5bf2('0x5d'));exports[_0x5bf2('0x5e')]=function(_0x2b9671,_0xddac84,_0x127e9e){var _0x1ab4f4=null;var _0x2a4ec5=null;var _0x533824=null;var _0x6bb884=null;var _0x33eeb5='';return db['VtigerAccount'][_0x5bf2('0x57')]({'where':{'id':_0x2b9671[_0x5bf2('0x4d')]['id']},'attributes':['id',_0x5bf2('0x35'),_0x5bf2('0x5f'),'description',_0x5bf2('0x60'),_0x5bf2('0x61'),'serverUrl','accessKey']})[_0x5bf2('0x1d')](handleEntityNotFound(_0xddac84,null))['then'](function(_0xff3bdb){if(_0xff3bdb){_0x1ab4f4=_0xff3bdb['username'];_0x2a4ec5=_0xff3bdb[_0x5bf2('0x62')];_0x533824=_0xff3bdb[_0x5bf2('0x60')];_0x33eeb5=_0xff3bdb['remoteUri'];var _0x3d23cb=_0x33eeb5[_0x5bf2('0x63')](-0x1);if(_0x3d23cb==='/'){_0x33eeb5=_0x33eeb5[_0x5bf2('0x64')](0x0,_0x33eeb5[_0x5bf2('0x65')](_0x3d23cb));}_0x6bb884=util[_0x5bf2('0x66')](_0x5bf2('0x67'),_0x33eeb5);var _0x5f0d18={'method':_0x5bf2('0x68'),'uri':_0x6bb884,'qs':{'operation':_0x5bf2('0x69'),'username':_0xff3bdb[_0x5bf2('0x5f')]},'json':!![]};return rp(_0x5f0d18);}})['then'](function(_0x12a4bf){if(_0x12a4bf[_0x5bf2('0x6a')]){var _0x4d3bfa={'method':_0x5bf2('0x6b'),'uri':_0x6bb884,'form':{'operation':_0x5bf2('0x6c'),'username':_0x1ab4f4,'accessKey':md5(_0x12a4bf[_0x5bf2('0x26')][_0x5bf2('0x6d')]+_0x2a4ec5)},'json':!![]};return rp(_0x4d3bfa);}})[_0x5bf2('0x1d')](function(_0x48e5c1){if(_0x48e5c1[_0x5bf2('0x6a')]){var _0x41d8d7={'method':'GET','uri':_0x6bb884,'qs':{'operation':'describe','username':_0x1ab4f4,'sessionName':_0x48e5c1[_0x5bf2('0x26')][_0x5bf2('0x6e')],'elementType':_0x533824},'json':!![]};return rp(_0x41d8d7);}})[_0x5bf2('0x1d')](function(_0x468df9){if(_0x468df9[_0x5bf2('0x6a')]){var _0x137cf8=[_0x5bf2('0x6f'),_0x5bf2('0x70'),_0x5bf2('0x71')];_[_0x5bf2('0x72')](_0x468df9['result'][_0x5bf2('0x3f')],function(_0x501604){return _0x137cf8['includes'](_0x501604['type'][_0x5bf2('0x35')]);});_[_0x5bf2('0x72')](_0x468df9[_0x5bf2('0x26')]['fields'],function(_0x2aae71){return _0x2aae71['editable']==='false';});return{'count':_0x468df9[_0x5bf2('0x26')][_0x5bf2('0x3f')][_0x5bf2('0x40')],'rows':_[_0x5bf2('0x37')](_0x468df9[_0x5bf2('0x26')][_0x5bf2('0x3f')],function(_0x1ad8cc){return{'id':_0x1ad8cc[_0x5bf2('0x35')],'name':_0x1ad8cc[_0x5bf2('0x73')],'custom':_[_0x5bf2('0x74')](_0x1ad8cc[_0x5bf2('0x35')],_0x5bf2('0x75'))?!![]:![],'options':_0x1ad8cc[_0x5bf2('0x49')][_0x5bf2('0x35')]==='picklist'&&_0x1ad8cc[_0x5bf2('0x49')][_0x5bf2('0x76')][_0x5bf2('0x40')]>0x0?_[_0x5bf2('0x37')](_0x1ad8cc[_0x5bf2('0x49')][_0x5bf2('0x76')],function(_0x525a89){return{'name':_0x525a89[_0x5bf2('0x73')],'value':_0x525a89['value']};}):[]};})};}})[_0x5bf2('0x1d')](respondWithResult(_0xddac84,null))['catch'](function(_0x2501ff){console[_0x5bf2('0x77')]('vTiger\x20error:\x20'+_0x2501ff);var _0x4ab74d=_0x2b9671['query']['test']?0x1f4:_0x2501ff[_0x5bf2('0x78')]||0x1f4;logger['error'](_0x5bf2('0x79'),_0x5bf2('0x5e'),_0x4ab74d,JSON[_0x5bf2('0x7a')](_0x2501ff));delete _0x2501ff[_0x5bf2('0x35')];if(_0x4ab74d===0x191){_0x4ab74d=0x190;}_0xddac84[_0x5bf2('0x29')](_0x4ab74d)['send'](_0x2b9671[_0x5bf2('0x3c')][_0x5bf2('0x7b')]?{'message':'Wrong\x20credentials','statusCode':_0x2501ff[_0x5bf2('0x78')]}:_0x2501ff);});}; \ No newline at end of file +var _0xf1c6=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','client','http','request','then','info','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','limit','Content-Range','reject','end','stack','name','send','map','VtigerAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','findAll','show','params','includeAll','find','body','update','destroy','VtigerConfiguration','options','getConfigurations','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','create','VtigerField','md5','getFields','username','moduleName','serverUrl','accessKey','slice','lastIndexOf','format','%s/webservice.php','GET','getchallenge','login','token','success','describe','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode'];(function(_0x1b6621,_0x105c12){var _0x12cad9=function(_0x523cf2){while(--_0x523cf2){_0x1b6621['push'](_0x1b6621['shift']());}};_0x12cad9(++_0x105c12);}(_0xf1c6,0xf4));var _0x6f1c=function(_0x1f3383,_0x636d61){_0x1f3383=_0x1f3383-0x0;var _0x511827=_0xf1c6[_0x1f3383];return _0x511827;};'use strict';var pdf=require(_0x6f1c('0x0'));var emlformat=require(_0x6f1c('0x1'));var rimraf=require(_0x6f1c('0x2'));var zipdir=require(_0x6f1c('0x3'));var jsonpatch=require(_0x6f1c('0x4'));var rp=require(_0x6f1c('0x5'));var moment=require(_0x6f1c('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x6f1c('0x7'));var util=require(_0x6f1c('0x8'));var path=require(_0x6f1c('0x9'));var sox=require(_0x6f1c('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6f1c('0xb'));var squel=require(_0x6f1c('0xc'));var crypto=require(_0x6f1c('0xd'));var jsforce=require(_0x6f1c('0xe'));var deskjs=require(_0x6f1c('0xf'));var toCsv=require(_0x6f1c('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6f1c('0x11'));var authService=require(_0x6f1c('0x12'));var qs=require(_0x6f1c('0x13'));var as=require(_0x6f1c('0x14'));var hardwareService=require(_0x6f1c('0x15'));var logger=require(_0x6f1c('0x16'))('api');var utils=require(_0x6f1c('0x17'));var config=require(_0x6f1c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6f1c('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x6f1c('0x1a')][_0x6f1c('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x52d50f,_0x523066,_0x4026a5,_0x526f9e){return new BPromise(function(_0x206ed5,_0xb36b41){var _0x14c412=_0x526f9e||client;return _0x14c412[_0x6f1c('0x1c')](_0x52d50f,_0x4026a5)[_0x6f1c('0x1d')](function(_0x229e31){logger[_0x6f1c('0x1e')]('VtigerAccount,\x20%s,\x20%s',_0x523066,_0x6f1c('0x1f'));logger['debug'](_0x6f1c('0x20'),_0x523066,'request\x20sent',JSON[_0x6f1c('0x21')](_0x229e31));if(_0x229e31[_0x6f1c('0x22')]){if(_0x229e31['error']['code']===0x1f4){logger[_0x6f1c('0x22')](_0x6f1c('0x23'),_0x523066,_0x229e31[_0x6f1c('0x22')]['message']);return _0xb36b41(_0x229e31[_0x6f1c('0x22')][_0x6f1c('0x24')]);}logger[_0x6f1c('0x22')]('VtigerAccount,\x20%s,\x20%s',_0x523066,_0x229e31[_0x6f1c('0x22')][_0x6f1c('0x24')]);return _0x206ed5(_0x229e31[_0x6f1c('0x22')]['message']);}else{logger[_0x6f1c('0x1e')](_0x6f1c('0x23'),_0x523066,'request\x20sent');_0x206ed5(_0x229e31[_0x6f1c('0x25')][_0x6f1c('0x24')]);}})[_0x6f1c('0x26')](function(_0x25e460){logger['error'](_0x6f1c('0x23'),_0x523066,_0x25e460);_0xb36b41(_0x25e460);});});}function respondWithStatusCode(_0xd19a62,_0x235773){_0x235773=_0x235773||0xcc;return function(_0x241ee7){if(_0x241ee7){return _0xd19a62[_0x6f1c('0x27')](_0x235773);}return _0xd19a62[_0x6f1c('0x28')](_0x235773)['end']();};}function respondWithResult(_0x1ac41,_0x461958){_0x461958=_0x461958||0xc8;return function(_0x2d4236){if(_0x2d4236){return _0x1ac41[_0x6f1c('0x28')](_0x461958)[_0x6f1c('0x29')](_0x2d4236);}};}function respondWithFilteredResult(_0x4fd4a2,_0x2c6da4){return function(_0x43cfb4){if(_0x43cfb4){var _0x2185a7=_0x43cfb4['count'],_0x1faa4a=_0x2c6da4['offset'],_0x31e829=_0x2c6da4[_0x6f1c('0x2a')]+_0x2c6da4[_0x6f1c('0x2b')],_0x145ae9;if(_0x31e829>=_0x2185a7){_0x31e829=_0x2185a7;_0x145ae9=0xc8;}else{_0x145ae9=0xce;}_0x4fd4a2[_0x6f1c('0x28')](_0x145ae9);return _0x4fd4a2['set'](_0x6f1c('0x2c'),_0x1faa4a+'-'+_0x31e829+'/'+_0x2185a7)[_0x6f1c('0x29')](_0x43cfb4);}return null;};}function patchUpdates(_0x36e825){return function(_0x68aeda){try{jsonpatch['apply'](_0x68aeda,_0x36e825,!![]);}catch(_0x127b90){return BPromise[_0x6f1c('0x2d')](_0x127b90);}return _0x68aeda['save']();};}function saveUpdates(_0x11ac4b,_0x346c4a){return function(_0x182f99){if(_0x182f99){return _0x182f99['update'](_0x11ac4b)[_0x6f1c('0x1d')](function(_0x5970f3){return _0x5970f3;});}return null;};}function removeEntity(_0x41adda,_0x2ee3e7){return function(_0x35231b){if(_0x35231b){return _0x35231b['destroy']()['then'](function(){_0x41adda[_0x6f1c('0x28')](0xcc)[_0x6f1c('0x2e')]();});}};}function handleEntityNotFound(_0x3041ce,_0x19fac4){return function(_0x239547){if(!_0x239547){_0x3041ce[_0x6f1c('0x27')](0x194);}return _0x239547;};}function handleError(_0x215e8e,_0x2a146e){_0x2a146e=_0x2a146e||0x1f4;return function(_0x3a50e8){logger[_0x6f1c('0x22')](_0x3a50e8[_0x6f1c('0x2f')]);if(_0x3a50e8[_0x6f1c('0x30')]){delete _0x3a50e8[_0x6f1c('0x30')];}_0x215e8e[_0x6f1c('0x28')](_0x2a146e)[_0x6f1c('0x31')](_0x3a50e8);};}exports['index']=function(_0x81791d,_0x1a4dbc){var _0x151a8a={},_0x333126={},_0x500982={'count':0x0,'rows':[]};var _0x2fb07d=_[_0x6f1c('0x32')](db[_0x6f1c('0x33')][_0x6f1c('0x34')],function(_0x214842){return{'name':_0x214842[_0x6f1c('0x35')],'type':_0x214842[_0x6f1c('0x36')]['key']};});_0x333126[_0x6f1c('0x37')]=_[_0x6f1c('0x32')](_0x2fb07d,_0x6f1c('0x30'));_0x333126[_0x6f1c('0x38')]=_[_0x6f1c('0x39')](_0x81791d[_0x6f1c('0x38')]);_0x333126[_0x6f1c('0x3a')]=_[_0x6f1c('0x3b')](_0x333126[_0x6f1c('0x37')],_0x333126[_0x6f1c('0x38')]);_0x151a8a['attributes']=_[_0x6f1c('0x3b')](_0x333126[_0x6f1c('0x37')],qs[_0x6f1c('0x3c')](_0x81791d[_0x6f1c('0x38')][_0x6f1c('0x3c')]));_0x151a8a[_0x6f1c('0x3d')]=_0x151a8a[_0x6f1c('0x3d')][_0x6f1c('0x3e')]?_0x151a8a[_0x6f1c('0x3d')]:_0x333126[_0x6f1c('0x37')];if(!_0x81791d[_0x6f1c('0x38')]['hasOwnProperty'](_0x6f1c('0x3f'))){_0x151a8a[_0x6f1c('0x2b')]=qs[_0x6f1c('0x2b')](_0x81791d['query']['limit']);_0x151a8a[_0x6f1c('0x2a')]=qs['offset'](_0x81791d['query'][_0x6f1c('0x2a')]);}_0x151a8a[_0x6f1c('0x40')]=qs[_0x6f1c('0x41')](_0x81791d['query'][_0x6f1c('0x41')]);_0x151a8a[_0x6f1c('0x42')]=qs[_0x6f1c('0x3a')](_[_0x6f1c('0x43')](_0x81791d[_0x6f1c('0x38')],_0x333126[_0x6f1c('0x3a')]),_0x2fb07d);if(_0x81791d['query'][_0x6f1c('0x44')]){_0x151a8a[_0x6f1c('0x42')]=_[_0x6f1c('0x45')](_0x151a8a[_0x6f1c('0x42')],{'$or':_[_0x6f1c('0x32')](_0x2fb07d,function(_0x307e7e){if(_0x307e7e[_0x6f1c('0x36')]!==_0x6f1c('0x46')){var _0x14341a={};_0x14341a[_0x307e7e[_0x6f1c('0x30')]]={'$like':'%'+_0x81791d[_0x6f1c('0x38')][_0x6f1c('0x44')]+'%'};return _0x14341a;}})});}_0x151a8a=_['merge']({},_0x151a8a,_0x81791d['options']);var _0x346415={'where':_0x151a8a['where']};return db[_0x6f1c('0x33')][_0x6f1c('0x47')](_0x346415)['then'](function(_0x324f3c){_0x500982[_0x6f1c('0x47')]=_0x324f3c;if(_0x81791d[_0x6f1c('0x38')]['includeAll']){_0x151a8a['include']=[{'all':!![]}];}return db[_0x6f1c('0x33')][_0x6f1c('0x48')](_0x151a8a);})[_0x6f1c('0x1d')](function(_0xed0e9f){_0x500982['rows']=_0xed0e9f;return _0x500982;})[_0x6f1c('0x1d')](respondWithFilteredResult(_0x1a4dbc,_0x151a8a))[_0x6f1c('0x26')](handleError(_0x1a4dbc,null));};exports[_0x6f1c('0x49')]=function(_0x31ee86,_0x248568){var _0x3bb54d={'raw':![],'where':{'id':_0x31ee86[_0x6f1c('0x4a')]['id']}},_0x5311f9={};_0x5311f9['model']=_['keys'](db[_0x6f1c('0x33')]['rawAttributes']);_0x5311f9[_0x6f1c('0x38')]=_[_0x6f1c('0x39')](_0x31ee86[_0x6f1c('0x38')]);_0x5311f9[_0x6f1c('0x3a')]=_[_0x6f1c('0x3b')](_0x5311f9[_0x6f1c('0x37')],_0x5311f9[_0x6f1c('0x38')]);_0x3bb54d[_0x6f1c('0x3d')]=_[_0x6f1c('0x3b')](_0x5311f9[_0x6f1c('0x37')],qs['fields'](_0x31ee86['query'][_0x6f1c('0x3c')]));_0x3bb54d[_0x6f1c('0x3d')]=_0x3bb54d[_0x6f1c('0x3d')][_0x6f1c('0x3e')]?_0x3bb54d[_0x6f1c('0x3d')]:_0x5311f9[_0x6f1c('0x37')];if(_0x31ee86[_0x6f1c('0x38')][_0x6f1c('0x4b')]){_0x3bb54d['include']=[{'all':!![]}];}_0x3bb54d=_[_0x6f1c('0x45')]({},_0x3bb54d,_0x31ee86['options']);return db['VtigerAccount'][_0x6f1c('0x4c')](_0x3bb54d)[_0x6f1c('0x1d')](handleEntityNotFound(_0x248568,null))['then'](respondWithResult(_0x248568,null))[_0x6f1c('0x26')](handleError(_0x248568,null));};exports['create']=function(_0xfd8e59,_0x545ce2){return db[_0x6f1c('0x33')]['create'](_0xfd8e59[_0x6f1c('0x4d')],{})[_0x6f1c('0x1d')](respondWithResult(_0x545ce2,0xc9))[_0x6f1c('0x26')](handleError(_0x545ce2,null));};exports[_0x6f1c('0x4e')]=function(_0x8c058,_0xd9a4aa){if(_0x8c058[_0x6f1c('0x4d')]['id']){delete _0x8c058[_0x6f1c('0x4d')]['id'];}return db[_0x6f1c('0x33')][_0x6f1c('0x4c')]({'where':{'id':_0x8c058[_0x6f1c('0x4a')]['id']}})[_0x6f1c('0x1d')](handleEntityNotFound(_0xd9a4aa,null))[_0x6f1c('0x1d')](saveUpdates(_0x8c058['body'],null))[_0x6f1c('0x1d')](respondWithResult(_0xd9a4aa,null))[_0x6f1c('0x26')](handleError(_0xd9a4aa,null));};exports[_0x6f1c('0x4f')]=function(_0x1790c6,_0x4cd245){return db[_0x6f1c('0x33')]['find']({'where':{'id':_0x1790c6[_0x6f1c('0x4a')]['id']}})[_0x6f1c('0x1d')](handleEntityNotFound(_0x4cd245,null))['then'](removeEntity(_0x4cd245,null))[_0x6f1c('0x26')](handleError(_0x4cd245,null));};exports['getConfigurations']=function(_0xd9e2a2,_0x43b6c1,_0x5ce94a){var _0x12d3c9={};var _0x5d9dfe={};var _0x3b9011;var _0x230b61;return db[_0x6f1c('0x33')]['findOne']({'where':{'id':_0xd9e2a2[_0x6f1c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x43b6c1,null))[_0x6f1c('0x1d')](function(_0x559666){if(_0x559666){_0x3b9011=_0x559666;_0x5d9dfe[_0x6f1c('0x37')]=_[_0x6f1c('0x39')](db[_0x6f1c('0x50')][_0x6f1c('0x34')]);_0x5d9dfe[_0x6f1c('0x38')]=_[_0x6f1c('0x39')](_0xd9e2a2['query']);_0x5d9dfe[_0x6f1c('0x3a')]=_['intersection'](_0x5d9dfe[_0x6f1c('0x37')],_0x5d9dfe[_0x6f1c('0x38')]);_0x12d3c9[_0x6f1c('0x3d')]=_[_0x6f1c('0x3b')](_0x5d9dfe[_0x6f1c('0x37')],qs[_0x6f1c('0x3c')](_0xd9e2a2[_0x6f1c('0x38')][_0x6f1c('0x3c')]));_0x12d3c9['attributes']=_0x12d3c9[_0x6f1c('0x3d')][_0x6f1c('0x3e')]?_0x12d3c9[_0x6f1c('0x3d')]:_0x5d9dfe[_0x6f1c('0x37')];_0x12d3c9[_0x6f1c('0x40')]=qs[_0x6f1c('0x41')](_0xd9e2a2[_0x6f1c('0x38')][_0x6f1c('0x41')]);_0x12d3c9[_0x6f1c('0x42')]=qs[_0x6f1c('0x3a')](_['pick'](_0xd9e2a2['query'],_0x5d9dfe[_0x6f1c('0x3a')]));if(_0xd9e2a2[_0x6f1c('0x38')][_0x6f1c('0x44')]){_0x12d3c9[_0x6f1c('0x42')]=_['merge'](_0x12d3c9['where'],{'$or':_[_0x6f1c('0x32')](_0x12d3c9['attributes'],function(_0x29d835){var _0x22c1ba={};_0x22c1ba[_0x29d835]={'$like':'%'+_0xd9e2a2[_0x6f1c('0x38')]['filter']+'%'};return _0x22c1ba;})});}_0x12d3c9=_[_0x6f1c('0x45')]({},_0x12d3c9,_0xd9e2a2[_0x6f1c('0x51')]);return _0x3b9011[_0x6f1c('0x52')](_0x12d3c9);}})['then'](function(_0x50a5e8){if(_0x50a5e8){_0x230b61=_0x50a5e8[_0x6f1c('0x3e')];if(!_0xd9e2a2[_0x6f1c('0x38')]['hasOwnProperty'](_0x6f1c('0x3f'))){_0x12d3c9[_0x6f1c('0x2b')]=qs['limit'](_0xd9e2a2['query'][_0x6f1c('0x2b')]);_0x12d3c9[_0x6f1c('0x2a')]=qs[_0x6f1c('0x2a')](_0xd9e2a2[_0x6f1c('0x38')][_0x6f1c('0x2a')]);}return _0x3b9011[_0x6f1c('0x52')](_0x12d3c9);}})[_0x6f1c('0x1d')](function(_0x2c6752){if(_0x2c6752){return _0x2c6752?{'count':_0x230b61,'rows':_0x2c6752}:null;}})[_0x6f1c('0x1d')](respondWithResult(_0x43b6c1,null))[_0x6f1c('0x26')](handleError(_0x43b6c1,null));};exports[_0x6f1c('0x53')]=function(_0x1cef8f,_0x5b5227,_0x213ea8){if(_0x1cef8f['body']['id']){delete _0x1cef8f[_0x6f1c('0x4d')]['id'];}return db[_0x6f1c('0x33')][_0x6f1c('0x54')]({'where':{'id':_0x1cef8f[_0x6f1c('0x4a')]['id']}})[_0x6f1c('0x1d')](handleEntityNotFound(_0x5b5227,null))['then'](function(_0x1a3b2d){if(_0x1a3b2d){_0x1cef8f[_0x6f1c('0x4d')][_0x6f1c('0x55')]=_0x1a3b2d['id'];_0x1cef8f[_0x6f1c('0x4d')][_0x6f1c('0x56')]=integrations['getSubjects'](_0x1cef8f['body'][_0x6f1c('0x57')],_0x1cef8f[_0x6f1c('0x4d')][_0x6f1c('0x36')]);_0x1cef8f[_0x6f1c('0x4d')][_0x6f1c('0x58')]=integrations['getDescriptions'](_0x1cef8f[_0x6f1c('0x4d')][_0x6f1c('0x57')],_0x1cef8f[_0x6f1c('0x4d')][_0x6f1c('0x36')]);return db['VtigerConfiguration'][_0x6f1c('0x59')](_0x1cef8f[_0x6f1c('0x4d')],{'include':[{'model':db[_0x6f1c('0x5a')],'as':_0x6f1c('0x56')},{'model':db[_0x6f1c('0x5a')],'as':'Descriptions'}]});}return null;})[_0x6f1c('0x1d')](respondWithResult(_0x5b5227,null))[_0x6f1c('0x26')](handleError(_0x5b5227,null));};var md5=require(_0x6f1c('0x5b'));exports[_0x6f1c('0x5c')]=function(_0x5c01e8,_0x565708,_0xf82c2f){var _0x55cb08=null;var _0xe3c27a=null;var _0x1d7fd2=null;var _0x4beb69=null;var _0x59a945='';return db[_0x6f1c('0x33')][_0x6f1c('0x54')]({'where':{'id':_0x5c01e8[_0x6f1c('0x4a')]['id']},'attributes':['id',_0x6f1c('0x30'),_0x6f1c('0x5d'),'description',_0x6f1c('0x5e'),'remoteUri',_0x6f1c('0x5f'),'accessKey']})['then'](handleEntityNotFound(_0x565708,null))[_0x6f1c('0x1d')](function(_0x39c4a0){if(_0x39c4a0){_0x55cb08=_0x39c4a0['username'];_0xe3c27a=_0x39c4a0[_0x6f1c('0x60')];_0x1d7fd2=_0x39c4a0['moduleName'];_0x59a945=_0x39c4a0['remoteUri'];var _0x57329c=_0x59a945[_0x6f1c('0x61')](-0x1);if(_0x57329c==='/'){_0x59a945=_0x59a945['substring'](0x0,_0x59a945[_0x6f1c('0x62')](_0x57329c));}_0x4beb69=util[_0x6f1c('0x63')](_0x6f1c('0x64'),_0x59a945);var _0x6cd245={'method':_0x6f1c('0x65'),'uri':_0x4beb69,'qs':{'operation':_0x6f1c('0x66'),'username':_0x39c4a0['username']},'json':!![]};return rp(_0x6cd245);}})[_0x6f1c('0x1d')](function(_0x94958d){if(_0x94958d['success']){var _0x511c6={'method':'POST','uri':_0x4beb69,'form':{'operation':_0x6f1c('0x67'),'username':_0x55cb08,'accessKey':md5(_0x94958d[_0x6f1c('0x25')][_0x6f1c('0x68')]+_0xe3c27a)},'json':!![]};return rp(_0x511c6);}})[_0x6f1c('0x1d')](function(_0x18c872){if(_0x18c872[_0x6f1c('0x69')]){var _0x1c315d={'method':_0x6f1c('0x65'),'uri':_0x4beb69,'qs':{'operation':_0x6f1c('0x6a'),'username':_0x55cb08,'sessionName':_0x18c872[_0x6f1c('0x25')]['sessionName'],'elementType':_0x1d7fd2},'json':!![]};return rp(_0x1c315d);}})['then'](function(_0x12f48b){if(_0x12f48b['success']){var _0x5adc50=['autogenerated',_0x6f1c('0x6b'),_0x6f1c('0x6c')];_[_0x6f1c('0x6d')](_0x12f48b[_0x6f1c('0x25')]['fields'],function(_0x8a9895){return _0x5adc50[_0x6f1c('0x6e')](_0x8a9895['type'][_0x6f1c('0x30')]);});_[_0x6f1c('0x6d')](_0x12f48b[_0x6f1c('0x25')][_0x6f1c('0x3c')],function(_0x1ea63d){return _0x1ea63d[_0x6f1c('0x6f')]===_0x6f1c('0x70');});return{'count':_0x12f48b[_0x6f1c('0x25')][_0x6f1c('0x3c')]['length'],'rows':_[_0x6f1c('0x32')](_0x12f48b['result']['fields'],function(_0x43f0d6){return{'id':_0x43f0d6[_0x6f1c('0x30')],'name':_0x43f0d6[_0x6f1c('0x71')],'custom':_[_0x6f1c('0x72')](_0x43f0d6[_0x6f1c('0x30')],_0x6f1c('0x73'))?!![]:![],'options':_0x43f0d6[_0x6f1c('0x36')]['name']==='picklist'&&_0x43f0d6[_0x6f1c('0x36')][_0x6f1c('0x74')][_0x6f1c('0x3e')]>0x0?_[_0x6f1c('0x32')](_0x43f0d6['type'][_0x6f1c('0x74')],function(_0x2e08c0){return{'name':_0x2e08c0[_0x6f1c('0x71')],'value':_0x2e08c0[_0x6f1c('0x75')]};}):[]};})};}})['then'](respondWithResult(_0x565708,null))['catch'](function(_0x271646){console[_0x6f1c('0x76')](_0x6f1c('0x77')+_0x271646);var _0x3e57e4=_0x5c01e8['query'][_0x6f1c('0x78')]?0x1f4:_0x271646[_0x6f1c('0x79')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x6f1c('0x5c'),_0x3e57e4,JSON[_0x6f1c('0x21')](_0x271646));delete _0x271646[_0x6f1c('0x30')];if(_0x3e57e4===0x191){_0x3e57e4=0x190;}_0x565708[_0x6f1c('0x28')](_0x3e57e4)[_0x6f1c('0x31')](_0x5c01e8['query'][_0x6f1c('0x78')]?{'message':'Wrong\x20credentials','statusCode':_0x271646['statusCode']}:_0x271646);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 528e417..23b8257 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 _0x655a=['bluebird','request-promise','../../components/integrations/configuration','define','lodash','util','../../config/logger','api'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x655a,0x6c));var _0xa655=function(_0x3bdfb8,_0x27c0d5){_0x3bdfb8=_0x3bdfb8-0x0;var _0x34d285=_0x655a[_0x3bdfb8];return _0x34d285;};'use strict';var _=require(_0xa655('0x0'));var util=require(_0xa655('0x1'));var logger=require(_0xa655('0x2'))(_0xa655('0x3'));var moment=require('moment');var BPromise=require(_0xa655('0x4'));var rp=require(_0xa655('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xa655('0x6'));module['exports']=function(_0x1d7d99,_0x3202fe){return _0x1d7d99[_0xa655('0x7')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba1c=['int_vtiger_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount'];(function(_0x352551,_0x1c6a80){var _0x1712b1=function(_0x22b0f8){while(--_0x22b0f8){_0x352551['push'](_0x352551['shift']());}};_0x1712b1(++_0x1c6a80);}(_0xba1c,0x79));var _0xcba1=function(_0x30df82,_0x12d8af){_0x30df82=_0x30df82-0x0;var _0x1bdd79=_0xba1c[_0x30df82];return _0x1bdd79;};'use strict';var _=require(_0xcba1('0x0'));var util=require(_0xcba1('0x1'));var logger=require('../../config/logger')(_0xcba1('0x2'));var moment=require(_0xcba1('0x3'));var BPromise=require(_0xcba1('0x4'));var rp=require(_0xcba1('0x5'));var fs=require('fs');var path=require(_0xcba1('0x6'));var rimraf=require(_0xcba1('0x7'));var config=require(_0xcba1('0x8'));var attributes=require(_0xcba1('0x9'));var integrations=require(_0xcba1('0xa'));module[_0xcba1('0xb')]=function(_0x3cd5be,_0x4a1dbc){return _0x3cd5be[_0xcba1('0xc')](_0xcba1('0xd'),attributes,{'tableName':_0xcba1('0xe'),'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 4edd43b..3c9717e 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 _0x9fae=['debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVtigerAccount','findAll','options','map','include','model','attributes','catch','ShowVtigerAccount','VtigerAccount','find','raw','where','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x29a390,_0x599343){var _0x83c7e0=function(_0x599fd5){while(--_0x599fd5){_0x29a390['push'](_0x29a390['shift']());}};_0x83c7e0(++_0x599343);}(_0x9fae,0x194));var _0xe9fa=function(_0x43626b,_0x1d5c35){_0x43626b=_0x43626b-0x0;var _0xbe72d3=_0x9fae[_0x43626b];return _0xbe72d3;};'use strict';var _=require(_0xe9fa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe9fa('0x1'));var rs=require(_0xe9fa('0x2'));var fs=require('fs');var Redis=require(_0xe9fa('0x3'));var db=require(_0xe9fa('0x4'))['db'];var utils=require(_0xe9fa('0x5'));var logger=require(_0xe9fa('0x6'))('rpc');var config=require(_0xe9fa('0x7'));var jayson=require(_0xe9fa('0x8'));var client=jayson[_0xe9fa('0x9')][_0xe9fa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8b655c,_0x5a0a00,_0x8a2467){return new BPromise(function(_0x126407,_0x189852){return client[_0xe9fa('0xb')](_0x8b655c,_0x8a2467)[_0xe9fa('0xc')](function(_0x392333){logger[_0xe9fa('0xd')](_0xe9fa('0xe'),_0x5a0a00,_0xe9fa('0xf'));logger[_0xe9fa('0x10')](_0xe9fa('0x11'),_0x5a0a00,_0xe9fa('0xf'),JSON[_0xe9fa('0x12')](_0x392333));if(_0x392333[_0xe9fa('0x13')]){if(_0x392333[_0xe9fa('0x13')]['code']===0x1f4){logger[_0xe9fa('0x13')](_0xe9fa('0xe'),_0x5a0a00,_0x392333['error'][_0xe9fa('0x14')]);return _0x189852(_0x392333[_0xe9fa('0x13')][_0xe9fa('0x14')]);}logger[_0xe9fa('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x5a0a00,_0x392333[_0xe9fa('0x13')][_0xe9fa('0x14')]);return _0x126407(_0x392333['error'][_0xe9fa('0x14')]);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x5a0a00,_0xe9fa('0xf'));_0x126407(_0x392333[_0xe9fa('0x15')][_0xe9fa('0x14')]);}})['catch'](function(_0x4349b3){logger[_0xe9fa('0x13')](_0xe9fa('0xe'),_0x5a0a00,_0x4349b3);_0x189852(_0x4349b3);});});}exports[_0xe9fa('0x16')]=function(_0x6b165){var _0x1ce427=this;return new Promise(function(_0x331776,_0x566c80){return db['VtigerAccount'][_0xe9fa('0x17')]({'raw':_0x6b165['options']?_0x6b165[_0xe9fa('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x6b165[_0xe9fa('0x18')]?_0x6b165[_0xe9fa('0x18')]['where']||null:null,'attributes':_0x6b165['options']?_0x6b165[_0xe9fa('0x18')]['attributes']||null:null,'limit':_0x6b165[_0xe9fa('0x18')]?_0x6b165[_0xe9fa('0x18')]['limit']||null:null,'include':_0x6b165[_0xe9fa('0x18')]?_0x6b165[_0xe9fa('0x18')]['include']?_[_0xe9fa('0x19')](_0x6b165[_0xe9fa('0x18')][_0xe9fa('0x1a')],function(_0x2e454e){return{'model':db[_0x2e454e[_0xe9fa('0x1b')]],'as':_0x2e454e['as'],'attributes':_0x2e454e[_0xe9fa('0x1c')],'include':_0x2e454e['include']?_['map'](_0x2e454e[_0xe9fa('0x1a')],function(_0xd5fcd){return{'model':db[_0xd5fcd['model']],'as':_0xd5fcd['as'],'attributes':_0xd5fcd[_0xe9fa('0x1c')],'include':_0xd5fcd[_0xe9fa('0x1a')]?_['map'](_0xd5fcd['include'],function(_0x2e2cbb){return{'model':db[_0x2e2cbb[_0xe9fa('0x1b')]],'as':_0x2e2cbb['as'],'attributes':_0x2e2cbb[_0xe9fa('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe9fa('0xc')](function(_0x363209){logger[_0xe9fa('0xd')](_0xe9fa('0x16'),_0x6b165);logger[_0xe9fa('0x10')](_0xe9fa('0x16'),_0x6b165,JSON['stringify'](_0x363209));_0x331776(_0x363209);})[_0xe9fa('0x1d')](function(_0xbc8688){logger[_0xe9fa('0x13')](_0xe9fa('0x16'),_0xbc8688[_0xe9fa('0x14')],_0x6b165);_0x566c80(_0x1ce427['error'](0x1f4,_0xbc8688[_0xe9fa('0x14')]));});});};exports[_0xe9fa('0x1e')]=function(_0x2af5f7){var _0x46eb67=this;return new Promise(function(_0x446fae,_0x14c415){return db[_0xe9fa('0x1f')][_0xe9fa('0x20')]({'raw':_0x2af5f7[_0xe9fa('0x18')]?_0x2af5f7[_0xe9fa('0x18')][_0xe9fa('0x21')]===undefined?!![]:![]:!![],'where':_0x2af5f7['options']?_0x2af5f7['options'][_0xe9fa('0x22')]||null:null,'attributes':_0x2af5f7['options']?_0x2af5f7[_0xe9fa('0x18')][_0xe9fa('0x1c')]||null:null,'include':_0x2af5f7[_0xe9fa('0x18')]?_0x2af5f7[_0xe9fa('0x18')][_0xe9fa('0x1a')]?_[_0xe9fa('0x19')](_0x2af5f7[_0xe9fa('0x18')][_0xe9fa('0x1a')],function(_0x1341fa){return{'model':db[_0x1341fa['model']],'as':_0x1341fa['as'],'attributes':_0x1341fa[_0xe9fa('0x1c')],'include':_0x1341fa[_0xe9fa('0x1a')]?_[_0xe9fa('0x19')](_0x1341fa[_0xe9fa('0x1a')],function(_0x36571a){return{'model':db[_0x36571a[_0xe9fa('0x1b')]],'as':_0x36571a['as'],'attributes':_0x36571a[_0xe9fa('0x1c')],'include':_0x36571a[_0xe9fa('0x1a')]?_[_0xe9fa('0x19')](_0x36571a['include'],function(_0x4ccf3e){return{'model':db[_0x4ccf3e[_0xe9fa('0x1b')]],'as':_0x4ccf3e['as'],'attributes':_0x4ccf3e[_0xe9fa('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe9fa('0xc')](function(_0x2b556f){logger[_0xe9fa('0xd')](_0xe9fa('0x1e'),_0x2af5f7);logger[_0xe9fa('0x10')](_0xe9fa('0x1e'),_0x2af5f7,JSON[_0xe9fa('0x12')](_0x2b556f));_0x446fae(_0x2b556f);})[_0xe9fa('0x1d')](function(_0x200e4f){logger[_0xe9fa('0x13')]('ShowVtigerAccount',_0x200e4f[_0xe9fa('0x14')],_0x2af5f7);_0x14c415(_0x46eb67['error'](0x1f4,_0x200e4f[_0xe9fa('0x14')]));});});}; \ No newline at end of file +var _0x0b6c=['raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetVtigerAccount','findAll','options','where','attributes','limit','include','map','model','then','ShowVtigerAccount','VtigerAccount','find'];(function(_0x52156d,_0x164227){var _0x354442=function(_0x5de3f1){while(--_0x5de3f1){_0x52156d['push'](_0x52156d['shift']());}};_0x354442(++_0x164227);}(_0x0b6c,0x1c9));var _0xc0b6=function(_0x4636cb,_0x5eddbf){_0x4636cb=_0x4636cb-0x0;var _0x478cb0=_0x0b6c[_0x4636cb];return _0x478cb0;};'use strict';var _=require(_0xc0b6('0x0'));var util=require('util');var moment=require(_0xc0b6('0x1'));var BPromise=require(_0xc0b6('0x2'));var rs=require(_0xc0b6('0x3'));var fs=require('fs');var Redis=require(_0xc0b6('0x4'));var db=require(_0xc0b6('0x5'))['db'];var utils=require(_0xc0b6('0x6'));var logger=require(_0xc0b6('0x7'))(_0xc0b6('0x8'));var config=require(_0xc0b6('0x9'));var jayson=require(_0xc0b6('0xa'));var client=jayson[_0xc0b6('0xb')][_0xc0b6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x57eb23,_0x8d625e,_0x1bdba5){return new BPromise(function(_0x507f1e,_0x4e4bc8){return client[_0xc0b6('0xd')](_0x57eb23,_0x1bdba5)['then'](function(_0x387872){logger[_0xc0b6('0xe')](_0xc0b6('0xf'),_0x8d625e,'request\x20sent');logger[_0xc0b6('0x10')](_0xc0b6('0x11'),_0x8d625e,_0xc0b6('0x12'),JSON['stringify'](_0x387872));if(_0x387872[_0xc0b6('0x13')]){if(_0x387872[_0xc0b6('0x13')][_0xc0b6('0x14')]===0x1f4){logger[_0xc0b6('0x13')](_0xc0b6('0xf'),_0x8d625e,_0x387872[_0xc0b6('0x13')][_0xc0b6('0x15')]);return _0x4e4bc8(_0x387872[_0xc0b6('0x13')][_0xc0b6('0x15')]);}logger[_0xc0b6('0x13')](_0xc0b6('0xf'),_0x8d625e,_0x387872[_0xc0b6('0x13')]['message']);return _0x507f1e(_0x387872[_0xc0b6('0x13')][_0xc0b6('0x15')]);}else{logger[_0xc0b6('0xe')](_0xc0b6('0xf'),_0x8d625e,_0xc0b6('0x12'));_0x507f1e(_0x387872[_0xc0b6('0x16')]['message']);}})[_0xc0b6('0x17')](function(_0x36ba2e){logger[_0xc0b6('0x13')](_0xc0b6('0xf'),_0x8d625e,_0x36ba2e);_0x4e4bc8(_0x36ba2e);});});}exports[_0xc0b6('0x18')]=function(_0x1d051c){var _0x477c2=this;return new Promise(function(_0x100a95,_0x1c86ea){return db['VtigerAccount'][_0xc0b6('0x19')]({'raw':_0x1d051c[_0xc0b6('0x1a')]?_0x1d051c[_0xc0b6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1d051c[_0xc0b6('0x1a')]?_0x1d051c[_0xc0b6('0x1a')][_0xc0b6('0x1b')]||null:null,'attributes':_0x1d051c['options']?_0x1d051c[_0xc0b6('0x1a')][_0xc0b6('0x1c')]||null:null,'limit':_0x1d051c[_0xc0b6('0x1a')]?_0x1d051c[_0xc0b6('0x1a')][_0xc0b6('0x1d')]||null:null,'include':_0x1d051c[_0xc0b6('0x1a')]?_0x1d051c[_0xc0b6('0x1a')][_0xc0b6('0x1e')]?_[_0xc0b6('0x1f')](_0x1d051c['options'][_0xc0b6('0x1e')],function(_0x15b21f){return{'model':db[_0x15b21f[_0xc0b6('0x20')]],'as':_0x15b21f['as'],'attributes':_0x15b21f[_0xc0b6('0x1c')],'include':_0x15b21f[_0xc0b6('0x1e')]?_['map'](_0x15b21f[_0xc0b6('0x1e')],function(_0x3ef1b8){return{'model':db[_0x3ef1b8['model']],'as':_0x3ef1b8['as'],'attributes':_0x3ef1b8['attributes'],'include':_0x3ef1b8['include']?_[_0xc0b6('0x1f')](_0x3ef1b8[_0xc0b6('0x1e')],function(_0x353ac5){return{'model':db[_0x353ac5[_0xc0b6('0x20')]],'as':_0x353ac5['as'],'attributes':_0x353ac5[_0xc0b6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc0b6('0x21')](function(_0x1142ab){logger['info'](_0xc0b6('0x18'),_0x1d051c);logger['debug']('GetVtigerAccount',_0x1d051c,JSON['stringify'](_0x1142ab));_0x100a95(_0x1142ab);})[_0xc0b6('0x17')](function(_0x8bd0cb){logger[_0xc0b6('0x13')]('GetVtigerAccount',_0x8bd0cb[_0xc0b6('0x15')],_0x1d051c);_0x1c86ea(_0x477c2[_0xc0b6('0x13')](0x1f4,_0x8bd0cb[_0xc0b6('0x15')]));});});};exports[_0xc0b6('0x22')]=function(_0x16a423){var _0x1768a7=this;return new Promise(function(_0x4b642a,_0xe34b1d){return db[_0xc0b6('0x23')][_0xc0b6('0x24')]({'raw':_0x16a423[_0xc0b6('0x1a')]?_0x16a423['options'][_0xc0b6('0x25')]===undefined?!![]:![]:!![],'where':_0x16a423[_0xc0b6('0x1a')]?_0x16a423[_0xc0b6('0x1a')][_0xc0b6('0x1b')]||null:null,'attributes':_0x16a423[_0xc0b6('0x1a')]?_0x16a423[_0xc0b6('0x1a')][_0xc0b6('0x1c')]||null:null,'include':_0x16a423['options']?_0x16a423[_0xc0b6('0x1a')][_0xc0b6('0x1e')]?_[_0xc0b6('0x1f')](_0x16a423[_0xc0b6('0x1a')][_0xc0b6('0x1e')],function(_0x3148e9){return{'model':db[_0x3148e9[_0xc0b6('0x20')]],'as':_0x3148e9['as'],'attributes':_0x3148e9[_0xc0b6('0x1c')],'include':_0x3148e9[_0xc0b6('0x1e')]?_['map'](_0x3148e9[_0xc0b6('0x1e')],function(_0x12aed0){return{'model':db[_0x12aed0[_0xc0b6('0x20')]],'as':_0x12aed0['as'],'attributes':_0x12aed0[_0xc0b6('0x1c')],'include':_0x12aed0[_0xc0b6('0x1e')]?_[_0xc0b6('0x1f')](_0x12aed0[_0xc0b6('0x1e')],function(_0x3dc410){return{'model':db[_0x3dc410['model']],'as':_0x3dc410['as'],'attributes':_0x3dc410[_0xc0b6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc0b6('0x21')](function(_0x3f91cf){logger['info']('ShowVtigerAccount',_0x16a423);logger[_0xc0b6('0x10')]('ShowVtigerAccount',_0x16a423,JSON['stringify'](_0x3f91cf));_0x4b642a(_0x3f91cf);})[_0xc0b6('0x17')](function(_0x35738b){logger[_0xc0b6('0x13')](_0xc0b6('0x22'),_0x35738b[_0xc0b6('0x15')],_0x16a423);_0xe34b1d(_0x1768a7[_0xc0b6('0x13')](0x1f4,_0x35738b['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 069db88..dcaa8b1 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 _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(_0x50e7e0,_0x5affce){var _0x1a0307=function(_0x32d343){while(--_0x32d343){_0x50e7e0['push'](_0x50e7e0['shift']());}};_0x1a0307(++_0x5affce);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var 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 +var _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x7205c9,_0x2f39a5){var _0x50e01b=function(_0x2ff066){while(--_0x2ff066){_0x7205c9['push'](_0x7205c9['shift']());}};_0x50e01b(++_0x2f39a5);}(_0xb10b,0x12a));var _0xbb10=function(_0x1c7889,_0x24cd26){_0x1c7889=_0x1c7889-0x0;var _0x2f14e5=_0xb10b[_0x1c7889];return _0x2f14e5;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 809559a..1935cc4 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 _0x0c6a=['exports','STRING','sequelize'];(function(_0x4235f8,_0x2aecd1){var _0x5c527a=function(_0x1699d9){while(--_0x1699d9){_0x4235f8['push'](_0x4235f8['shift']());}};_0x5c527a(++_0x2aecd1);}(_0x0c6a,0xd7));var _0xa0c6=function(_0x4caade,_0x549ce1){_0x4caade=_0x4caade-0x0;var _0x2041ff=_0x0c6a[_0x4caade];return _0x2041ff;};'use strict';var Sequelize=require(_0xa0c6('0x0'));module[_0xa0c6('0x1')]={'name':{'type':Sequelize[_0xa0c6('0x2')]},'description':{'type':Sequelize[_0xa0c6('0x2')]}}; \ No newline at end of file +var _0xb8f0=['STRING'];(function(_0x38e645,_0x2bcfc6){var _0x481e5d=function(_0x524dd4){while(--_0x524dd4){_0x38e645['push'](_0x38e645['shift']());}};_0x481e5d(++_0x2bcfc6);}(_0xb8f0,0x14e));var _0x0b8f=function(_0x553840,_0x39322a){_0x553840=_0x553840-0x0;var _0x5610a4=_0xb8f0[_0x553840];return _0x5610a4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0b8f('0x0')]},'description':{'type':Sequelize[_0x0b8f('0x0')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index bab2871..53c33cf 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 _0x1ae3=['rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','show','params','options','find','create','body','VtigerField','length','getFields','getSubjects','findOne','getDescriptions','html-pdf','eml-format','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','api','../../config/utils','../../config/license/util','jayson/promise','client','http','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','VtigerConfiguration'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x1ae3,0x139));var _0x31ae=function(_0x30f251,_0x4428fe){_0x30f251=_0x30f251-0x0;var _0x51a94d=_0x1ae3[_0x30f251];return _0x51a94d;};'use strict';var pdf=require(_0x31ae('0x0'));var emlformat=require(_0x31ae('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x31ae('0x2'));var jsonpatch=require(_0x31ae('0x3'));var rp=require(_0x31ae('0x4'));var moment=require(_0x31ae('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x31ae('0x6'));var util=require(_0x31ae('0x7'));var path=require(_0x31ae('0x8'));var sox=require(_0x31ae('0x9'));var csv=require(_0x31ae('0xa'));var ejs=require(_0x31ae('0xb'));var fs=require('fs');var _=require(_0x31ae('0xc'));var squel=require(_0x31ae('0xd'));var crypto=require(_0x31ae('0xe'));var jsforce=require(_0x31ae('0xf'));var deskjs=require(_0x31ae('0x10'));var toCsv=require(_0x31ae('0xa'));var querystring=require(_0x31ae('0x11'));var Papa=require(_0x31ae('0x12'));var Redis=require(_0x31ae('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x31ae('0x14'));var as=require(_0x31ae('0x15'));var hardwareService=require(_0x31ae('0x16'));var logger=require('../../config/logger')(_0x31ae('0x17'));var utils=require(_0x31ae('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x31ae('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x31ae('0x1a'));var client=jayson[_0x31ae('0x1b')][_0x31ae('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5a4a21,_0x4142ff,_0x2837c9,_0x201e43){return new BPromise(function(_0x3ba04a,_0x2b1fc2){var _0x273c94=_0x201e43||client;return _0x273c94['request'](_0x5a4a21,_0x2837c9)[_0x31ae('0x1d')](function(_0x11abd4){logger[_0x31ae('0x1e')](_0x31ae('0x1f'),_0x4142ff,_0x31ae('0x20'));logger[_0x31ae('0x21')](_0x31ae('0x22'),_0x4142ff,_0x31ae('0x20'),JSON['stringify'](_0x11abd4));if(_0x11abd4[_0x31ae('0x23')]){if(_0x11abd4['error'][_0x31ae('0x24')]===0x1f4){logger[_0x31ae('0x23')](_0x31ae('0x1f'),_0x4142ff,_0x11abd4[_0x31ae('0x23')][_0x31ae('0x25')]);return _0x2b1fc2(_0x11abd4[_0x31ae('0x23')][_0x31ae('0x25')]);}logger[_0x31ae('0x23')](_0x31ae('0x1f'),_0x4142ff,_0x11abd4[_0x31ae('0x23')][_0x31ae('0x25')]);return _0x3ba04a(_0x11abd4[_0x31ae('0x23')]['message']);}else{logger[_0x31ae('0x1e')](_0x31ae('0x1f'),_0x4142ff,_0x31ae('0x20'));_0x3ba04a(_0x11abd4[_0x31ae('0x26')]['message']);}})[_0x31ae('0x27')](function(_0x1828b1){logger['error'](_0x31ae('0x1f'),_0x4142ff,_0x1828b1);_0x2b1fc2(_0x1828b1);});});}function respondWithStatusCode(_0x4969e3,_0xd24bd5){_0xd24bd5=_0xd24bd5||0xcc;return function(_0x56f9c4){if(_0x56f9c4){return _0x4969e3['sendStatus'](_0xd24bd5);}return _0x4969e3[_0x31ae('0x28')](_0xd24bd5)[_0x31ae('0x29')]();};}function respondWithResult(_0x2a9bf6,_0x4c86ba){_0x4c86ba=_0x4c86ba||0xc8;return function(_0x4d18c0){if(_0x4d18c0){return _0x2a9bf6['status'](_0x4c86ba)[_0x31ae('0x2a')](_0x4d18c0);}};}function respondWithFilteredResult(_0x579cbe,_0x43ca3d){return function(_0x2b5230){if(_0x2b5230){var _0xf49658=_0x2b5230[_0x31ae('0x2b')],_0xb99935=_0x43ca3d[_0x31ae('0x2c')],_0x3bb96a=_0x43ca3d['offset']+_0x43ca3d[_0x31ae('0x2d')],_0x2e4222;if(_0x3bb96a>=_0xf49658){_0x3bb96a=_0xf49658;_0x2e4222=0xc8;}else{_0x2e4222=0xce;}_0x579cbe[_0x31ae('0x28')](_0x2e4222);return _0x579cbe[_0x31ae('0x2e')](_0x31ae('0x2f'),_0xb99935+'-'+_0x3bb96a+'/'+_0xf49658)['json'](_0x2b5230);}return null;};}function patchUpdates(_0x14f472){return function(_0x418d59){try{jsonpatch[_0x31ae('0x30')](_0x418d59,_0x14f472,!![]);}catch(_0x2c278b){return BPromise[_0x31ae('0x31')](_0x2c278b);}return _0x418d59[_0x31ae('0x32')]();};}function saveUpdates(_0x47b1ba,_0x4d2172){return function(_0x508f3c){if(_0x508f3c){return _0x508f3c[_0x31ae('0x33')](_0x47b1ba)['then'](function(_0x36baec){return _0x36baec;});}return null;};}function removeEntity(_0x3d7e2e,_0x523e4e){return function(_0x2008a5){if(_0x2008a5){return _0x2008a5[_0x31ae('0x34')]()[_0x31ae('0x1d')](function(){_0x3d7e2e[_0x31ae('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21466d,_0x130ee9){return function(_0x4d22cf){if(!_0x4d22cf){_0x21466d['sendStatus'](0x194);}return _0x4d22cf;};}function handleError(_0x50b12e,_0x46ffb1){_0x46ffb1=_0x46ffb1||0x1f4;return function(_0x3553e0){logger[_0x31ae('0x23')](_0x3553e0[_0x31ae('0x35')]);if(_0x3553e0[_0x31ae('0x36')]){delete _0x3553e0['name'];}_0x50b12e[_0x31ae('0x28')](_0x46ffb1)[_0x31ae('0x37')](_0x3553e0);};}exports[_0x31ae('0x38')]=function(_0x3506e0,_0x3cf048){var _0x3d6c3c={},_0x358e99={},_0x39c3b6={'count':0x0,'rows':[]};var _0x13626b=_[_0x31ae('0x39')](db[_0x31ae('0x3a')][_0x31ae('0x3b')],function(_0x50bc0c){return{'name':_0x50bc0c[_0x31ae('0x3c')],'type':_0x50bc0c[_0x31ae('0x3d')]['key']};});_0x358e99[_0x31ae('0x3e')]=_[_0x31ae('0x39')](_0x13626b,_0x31ae('0x36'));_0x358e99[_0x31ae('0x3f')]=_[_0x31ae('0x40')](_0x3506e0['query']);_0x358e99[_0x31ae('0x41')]=_['intersection'](_0x358e99['model'],_0x358e99[_0x31ae('0x3f')]);_0x3d6c3c['attributes']=_[_0x31ae('0x42')](_0x358e99['model'],qs['fields'](_0x3506e0[_0x31ae('0x3f')][_0x31ae('0x43')]));_0x3d6c3c[_0x31ae('0x44')]=_0x3d6c3c[_0x31ae('0x44')]['length']?_0x3d6c3c[_0x31ae('0x44')]:_0x358e99[_0x31ae('0x3e')];if(!_0x3506e0[_0x31ae('0x3f')][_0x31ae('0x45')](_0x31ae('0x46'))){_0x3d6c3c[_0x31ae('0x2d')]=qs['limit'](_0x3506e0['query'][_0x31ae('0x2d')]);_0x3d6c3c[_0x31ae('0x2c')]=qs['offset'](_0x3506e0[_0x31ae('0x3f')][_0x31ae('0x2c')]);}_0x3d6c3c[_0x31ae('0x47')]=qs[_0x31ae('0x48')](_0x3506e0[_0x31ae('0x3f')][_0x31ae('0x48')]);_0x3d6c3c['where']=qs[_0x31ae('0x41')](_[_0x31ae('0x49')](_0x3506e0[_0x31ae('0x3f')],_0x358e99['filters']),_0x13626b);if(_0x3506e0[_0x31ae('0x3f')][_0x31ae('0x4a')]){_0x3d6c3c['where']=_[_0x31ae('0x4b')](_0x3d6c3c[_0x31ae('0x4c')],{'$or':_[_0x31ae('0x39')](_0x13626b,function(_0x5bbe16){if(_0x5bbe16[_0x31ae('0x3d')]!==_0x31ae('0x4d')){var _0x2bd751={};_0x2bd751[_0x5bbe16['name']]={'$like':'%'+_0x3506e0[_0x31ae('0x3f')][_0x31ae('0x4a')]+'%'};return _0x2bd751;}})});}_0x3d6c3c=_[_0x31ae('0x4b')]({},_0x3d6c3c,_0x3506e0['options']);var _0x2995c7={'where':_0x3d6c3c[_0x31ae('0x4c')]};return db['VtigerConfiguration'][_0x31ae('0x2b')](_0x2995c7)[_0x31ae('0x1d')](function(_0x20f33a){_0x39c3b6[_0x31ae('0x2b')]=_0x20f33a;if(_0x3506e0[_0x31ae('0x3f')][_0x31ae('0x4e')]){_0x3d6c3c[_0x31ae('0x4f')]=[{'all':!![]}];}return db[_0x31ae('0x3a')][_0x31ae('0x50')](_0x3d6c3c);})[_0x31ae('0x1d')](function(_0x3eba5d){_0x39c3b6['rows']=_0x3eba5d;return _0x39c3b6;})[_0x31ae('0x1d')](respondWithFilteredResult(_0x3cf048,_0x3d6c3c))['catch'](handleError(_0x3cf048,null));};exports[_0x31ae('0x51')]=function(_0x44546a,_0x20980d){var _0x23ebcb={'raw':![],'where':{'id':_0x44546a[_0x31ae('0x52')]['id']}},_0x381f2a={};_0x381f2a[_0x31ae('0x3e')]=_[_0x31ae('0x40')](db[_0x31ae('0x3a')][_0x31ae('0x3b')]);_0x381f2a[_0x31ae('0x3f')]=_[_0x31ae('0x40')](_0x44546a['query']);_0x381f2a[_0x31ae('0x41')]=_[_0x31ae('0x42')](_0x381f2a[_0x31ae('0x3e')],_0x381f2a[_0x31ae('0x3f')]);_0x23ebcb[_0x31ae('0x44')]=_[_0x31ae('0x42')](_0x381f2a[_0x31ae('0x3e')],qs[_0x31ae('0x43')](_0x44546a[_0x31ae('0x3f')][_0x31ae('0x43')]));_0x23ebcb['attributes']=_0x23ebcb[_0x31ae('0x44')]['length']?_0x23ebcb[_0x31ae('0x44')]:_0x381f2a['model'];if(_0x44546a[_0x31ae('0x3f')]['includeAll']){_0x23ebcb[_0x31ae('0x4f')]=[{'all':!![]}];}_0x23ebcb=_[_0x31ae('0x4b')]({},_0x23ebcb,_0x44546a[_0x31ae('0x53')]);return db[_0x31ae('0x3a')][_0x31ae('0x54')](_0x23ebcb)[_0x31ae('0x1d')](handleEntityNotFound(_0x20980d,null))[_0x31ae('0x1d')](respondWithResult(_0x20980d,null))[_0x31ae('0x27')](handleError(_0x20980d,null));};exports['create']=function(_0x2e1b23,_0x2c3963){return db[_0x31ae('0x3a')][_0x31ae('0x55')](_0x2e1b23[_0x31ae('0x56')],{})[_0x31ae('0x1d')](respondWithResult(_0x2c3963,0xc9))[_0x31ae('0x27')](handleError(_0x2c3963,null));};exports[_0x31ae('0x33')]=function(_0x780eae,_0x442cb9){if(_0x780eae['body']['id']){delete _0x780eae['body']['id'];}return db[_0x31ae('0x3a')][_0x31ae('0x54')]({'where':{'id':_0x780eae[_0x31ae('0x52')]['id']}})['then'](handleEntityNotFound(_0x442cb9,null))[_0x31ae('0x1d')](saveUpdates(_0x780eae[_0x31ae('0x56')],null))[_0x31ae('0x1d')](respondWithResult(_0x442cb9,null))[_0x31ae('0x27')](handleError(_0x442cb9,null));};exports[_0x31ae('0x34')]=function(_0xdc9162,_0xb2f63a){return db[_0x31ae('0x3a')]['find']({'where':{'id':_0xdc9162['params']['id']}})['then'](handleEntityNotFound(_0xb2f63a,null))['then'](removeEntity(_0xb2f63a,null))[_0x31ae('0x27')](handleError(_0xb2f63a,null));};exports['getFields']=function(_0x1f9a46,_0x45ee34,_0x21930d){var _0x497a47={};var _0x1d2bcd={};var _0x171c79;var _0x3cb502;return db[_0x31ae('0x3a')]['findOne']({'where':{'id':_0x1f9a46['params']['id']}})[_0x31ae('0x1d')](handleEntityNotFound(_0x45ee34,null))['then'](function(_0x5d3903){if(_0x5d3903){_0x171c79=_0x5d3903;_0x1d2bcd[_0x31ae('0x3e')]=_['keys'](db[_0x31ae('0x57')][_0x31ae('0x3b')]);_0x1d2bcd[_0x31ae('0x3f')]=_[_0x31ae('0x40')](_0x1f9a46[_0x31ae('0x3f')]);_0x1d2bcd[_0x31ae('0x41')]=_[_0x31ae('0x42')](_0x1d2bcd[_0x31ae('0x3e')],_0x1d2bcd['query']);_0x497a47[_0x31ae('0x44')]=_[_0x31ae('0x42')](_0x1d2bcd[_0x31ae('0x3e')],qs[_0x31ae('0x43')](_0x1f9a46[_0x31ae('0x3f')][_0x31ae('0x43')]));_0x497a47['attributes']=_0x497a47[_0x31ae('0x44')][_0x31ae('0x58')]?_0x497a47[_0x31ae('0x44')]:_0x1d2bcd[_0x31ae('0x3e')];_0x497a47[_0x31ae('0x47')]=qs['sort'](_0x1f9a46[_0x31ae('0x3f')][_0x31ae('0x48')]);_0x497a47[_0x31ae('0x4c')]=qs[_0x31ae('0x41')](_['pick'](_0x1f9a46['query'],_0x1d2bcd[_0x31ae('0x41')]));if(_0x1f9a46[_0x31ae('0x3f')][_0x31ae('0x4a')]){_0x497a47[_0x31ae('0x4c')]=_[_0x31ae('0x4b')](_0x497a47[_0x31ae('0x4c')],{'$or':_[_0x31ae('0x39')](_0x497a47[_0x31ae('0x44')],function(_0x2295c0){var _0xb3bba1={};_0xb3bba1[_0x2295c0]={'$like':'%'+_0x1f9a46['query'][_0x31ae('0x4a')]+'%'};return _0xb3bba1;})});}_0x497a47=_[_0x31ae('0x4b')]({},_0x497a47,_0x1f9a46[_0x31ae('0x53')]);return _0x171c79[_0x31ae('0x59')](_0x497a47);}})[_0x31ae('0x1d')](function(_0x531056){if(_0x531056){_0x3cb502=_0x531056[_0x31ae('0x58')];if(!_0x1f9a46[_0x31ae('0x3f')]['hasOwnProperty'](_0x31ae('0x46'))){_0x497a47[_0x31ae('0x2d')]=qs['limit'](_0x1f9a46['query'][_0x31ae('0x2d')]);_0x497a47[_0x31ae('0x2c')]=qs[_0x31ae('0x2c')](_0x1f9a46['query'][_0x31ae('0x2c')]);}return _0x171c79[_0x31ae('0x59')](_0x497a47);}})[_0x31ae('0x1d')](function(_0x12ac4e){if(_0x12ac4e){return _0x12ac4e?{'count':_0x3cb502,'rows':_0x12ac4e}:null;}})[_0x31ae('0x1d')](respondWithResult(_0x45ee34,null))[_0x31ae('0x27')](handleError(_0x45ee34,null));};exports[_0x31ae('0x5a')]=function(_0x124a6a,_0x4dfe04,_0x4f0e7c){var _0x5be3d4={};var _0x369d73={};var _0x1b5df9;var _0x1eafa1;return db[_0x31ae('0x3a')][_0x31ae('0x5b')]({'where':{'id':_0x124a6a['params']['id']}})[_0x31ae('0x1d')](handleEntityNotFound(_0x4dfe04,null))[_0x31ae('0x1d')](function(_0x58805d){if(_0x58805d){_0x1b5df9=_0x58805d;_0x369d73[_0x31ae('0x3e')]=_['keys'](db[_0x31ae('0x57')][_0x31ae('0x3b')]);_0x369d73[_0x31ae('0x3f')]=_[_0x31ae('0x40')](_0x124a6a[_0x31ae('0x3f')]);_0x369d73['filters']=_[_0x31ae('0x42')](_0x369d73[_0x31ae('0x3e')],_0x369d73[_0x31ae('0x3f')]);_0x5be3d4[_0x31ae('0x44')]=_[_0x31ae('0x42')](_0x369d73[_0x31ae('0x3e')],qs[_0x31ae('0x43')](_0x124a6a[_0x31ae('0x3f')][_0x31ae('0x43')]));_0x5be3d4[_0x31ae('0x44')]=_0x5be3d4[_0x31ae('0x44')][_0x31ae('0x58')]?_0x5be3d4[_0x31ae('0x44')]:_0x369d73['model'];_0x5be3d4[_0x31ae('0x47')]=qs[_0x31ae('0x48')](_0x124a6a[_0x31ae('0x3f')]['sort']);_0x5be3d4[_0x31ae('0x4c')]=qs[_0x31ae('0x41')](_[_0x31ae('0x49')](_0x124a6a['query'],_0x369d73[_0x31ae('0x41')]));if(_0x124a6a[_0x31ae('0x3f')]['filter']){_0x5be3d4[_0x31ae('0x4c')]=_[_0x31ae('0x4b')](_0x5be3d4[_0x31ae('0x4c')],{'$or':_[_0x31ae('0x39')](_0x5be3d4[_0x31ae('0x44')],function(_0x2aa5c2){var _0x225af5={};_0x225af5[_0x2aa5c2]={'$like':'%'+_0x124a6a['query'][_0x31ae('0x4a')]+'%'};return _0x225af5;})});}_0x5be3d4=_[_0x31ae('0x4b')]({},_0x5be3d4,_0x124a6a[_0x31ae('0x53')]);return _0x1b5df9['getSubjects'](_0x5be3d4);}})[_0x31ae('0x1d')](function(_0x2c9e6a){if(_0x2c9e6a){_0x1eafa1=_0x2c9e6a[_0x31ae('0x58')];if(!_0x124a6a[_0x31ae('0x3f')][_0x31ae('0x45')](_0x31ae('0x46'))){_0x5be3d4[_0x31ae('0x2d')]=qs['limit'](_0x124a6a[_0x31ae('0x3f')][_0x31ae('0x2d')]);_0x5be3d4[_0x31ae('0x2c')]=qs[_0x31ae('0x2c')](_0x124a6a[_0x31ae('0x3f')][_0x31ae('0x2c')]);}return _0x1b5df9['getSubjects'](_0x5be3d4);}})['then'](function(_0x3932cd){if(_0x3932cd){return _0x3932cd?{'count':_0x1eafa1,'rows':_0x3932cd}:null;}})[_0x31ae('0x1d')](respondWithResult(_0x4dfe04,null))[_0x31ae('0x27')](handleError(_0x4dfe04,null));};exports[_0x31ae('0x5c')]=function(_0x154012,_0x5ecb70,_0x22d231){var _0xd3449={};var _0x40d9ce={};var _0x17dcb1;var _0x426121;return db[_0x31ae('0x3a')][_0x31ae('0x5b')]({'where':{'id':_0x154012[_0x31ae('0x52')]['id']}})[_0x31ae('0x1d')](handleEntityNotFound(_0x5ecb70,null))['then'](function(_0xdbcb2e){if(_0xdbcb2e){_0x17dcb1=_0xdbcb2e;_0x40d9ce[_0x31ae('0x3e')]=_[_0x31ae('0x40')](db['VtigerField'][_0x31ae('0x3b')]);_0x40d9ce[_0x31ae('0x3f')]=_[_0x31ae('0x40')](_0x154012[_0x31ae('0x3f')]);_0x40d9ce[_0x31ae('0x41')]=_['intersection'](_0x40d9ce[_0x31ae('0x3e')],_0x40d9ce['query']);_0xd3449['attributes']=_['intersection'](_0x40d9ce[_0x31ae('0x3e')],qs[_0x31ae('0x43')](_0x154012[_0x31ae('0x3f')][_0x31ae('0x43')]));_0xd3449[_0x31ae('0x44')]=_0xd3449['attributes']['length']?_0xd3449[_0x31ae('0x44')]:_0x40d9ce[_0x31ae('0x3e')];_0xd3449[_0x31ae('0x47')]=qs[_0x31ae('0x48')](_0x154012[_0x31ae('0x3f')][_0x31ae('0x48')]);_0xd3449[_0x31ae('0x4c')]=qs[_0x31ae('0x41')](_[_0x31ae('0x49')](_0x154012['query'],_0x40d9ce[_0x31ae('0x41')]));if(_0x154012['query'][_0x31ae('0x4a')]){_0xd3449['where']=_[_0x31ae('0x4b')](_0xd3449[_0x31ae('0x4c')],{'$or':_[_0x31ae('0x39')](_0xd3449[_0x31ae('0x44')],function(_0x18eeee){var _0xb99ee7={};_0xb99ee7[_0x18eeee]={'$like':'%'+_0x154012[_0x31ae('0x3f')][_0x31ae('0x4a')]+'%'};return _0xb99ee7;})});}_0xd3449=_['merge']({},_0xd3449,_0x154012[_0x31ae('0x53')]);return _0x17dcb1[_0x31ae('0x5c')](_0xd3449);}})[_0x31ae('0x1d')](function(_0x1f3134){if(_0x1f3134){_0x426121=_0x1f3134['length'];if(!_0x154012[_0x31ae('0x3f')]['hasOwnProperty'](_0x31ae('0x46'))){_0xd3449[_0x31ae('0x2d')]=qs[_0x31ae('0x2d')](_0x154012[_0x31ae('0x3f')][_0x31ae('0x2d')]);_0xd3449[_0x31ae('0x2c')]=qs['offset'](_0x154012[_0x31ae('0x3f')][_0x31ae('0x2c')]);}return _0x17dcb1['getDescriptions'](_0xd3449);}})[_0x31ae('0x1d')](function(_0x375346){if(_0x375346){return _0x375346?{'count':_0x426121,'rows':_0x375346}:null;}})[_0x31ae('0x1d')](respondWithResult(_0x5ecb70,null))['catch'](handleError(_0x5ecb70,null));}; \ No newline at end of file +var _0xbbb8=['type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','rows','show','find','create','body','params','getFields','findOne','VtigerField','order','filter','getSubjects','getDescriptions','nolimit','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','offset','limit','json','apply','reject','update','destroy','sendStatus','stack','send','index','map','VtigerConfiguration','rawAttributes','fieldName'];(function(_0xa9a245,_0x2a0387){var _0x2d0eaa=function(_0x2bba86){while(--_0x2bba86){_0xa9a245['push'](_0xa9a245['shift']());}};_0x2d0eaa(++_0x2a0387);}(_0xbbb8,0x7d));var _0x8bbb=function(_0x51303a,_0x46fc44){_0x51303a=_0x51303a-0x0;var _0x2887a8=_0xbbb8[_0x51303a];return _0x2887a8;};'use strict';var pdf=require(_0x8bbb('0x0'));var emlformat=require(_0x8bbb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8bbb('0x2'));var jsonpatch=require(_0x8bbb('0x3'));var rp=require('request-promise');var moment=require(_0x8bbb('0x4'));var BPromise=require(_0x8bbb('0x5'));var Mustache=require(_0x8bbb('0x6'));var util=require(_0x8bbb('0x7'));var path=require(_0x8bbb('0x8'));var sox=require(_0x8bbb('0x9'));var csv=require(_0x8bbb('0xa'));var ejs=require(_0x8bbb('0xb'));var fs=require('fs');var _=require(_0x8bbb('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8bbb('0xd'));var toCsv=require(_0x8bbb('0xa'));var querystring=require(_0x8bbb('0xe'));var Papa=require(_0x8bbb('0xf'));var Redis=require(_0x8bbb('0x10'));var authService=require(_0x8bbb('0x11'));var qs=require(_0x8bbb('0x12'));var as=require(_0x8bbb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8bbb('0x14'))(_0x8bbb('0x15'));var utils=require(_0x8bbb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8bbb('0x17'));var db=require(_0x8bbb('0x18'))['db'];var jayson=require(_0x8bbb('0x19'));var client=jayson['client'][_0x8bbb('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1c72e7,_0x10460f,_0x3c2529,_0x5e08e4){return new BPromise(function(_0x405ca8,_0xde885a){var _0x5bcba6=_0x5e08e4||client;return _0x5bcba6[_0x8bbb('0x1b')](_0x1c72e7,_0x3c2529)[_0x8bbb('0x1c')](function(_0x3ac726){logger[_0x8bbb('0x1d')](_0x8bbb('0x1e'),_0x10460f,_0x8bbb('0x1f'));logger[_0x8bbb('0x20')](_0x8bbb('0x21'),_0x10460f,_0x8bbb('0x1f'),JSON[_0x8bbb('0x22')](_0x3ac726));if(_0x3ac726[_0x8bbb('0x23')]){if(_0x3ac726[_0x8bbb('0x23')][_0x8bbb('0x24')]===0x1f4){logger['error'](_0x8bbb('0x1e'),_0x10460f,_0x3ac726[_0x8bbb('0x23')][_0x8bbb('0x25')]);return _0xde885a(_0x3ac726[_0x8bbb('0x23')][_0x8bbb('0x25')]);}logger['error'](_0x8bbb('0x1e'),_0x10460f,_0x3ac726['error']['message']);return _0x405ca8(_0x3ac726[_0x8bbb('0x23')]['message']);}else{logger[_0x8bbb('0x1d')]('VtigerConfiguration,\x20%s,\x20%s',_0x10460f,_0x8bbb('0x1f'));_0x405ca8(_0x3ac726[_0x8bbb('0x26')]['message']);}})[_0x8bbb('0x27')](function(_0x15086e){logger['error'](_0x8bbb('0x1e'),_0x10460f,_0x15086e);_0xde885a(_0x15086e);});});}function respondWithStatusCode(_0x168f72,_0x4b2ba6){_0x4b2ba6=_0x4b2ba6||0xcc;return function(_0x3b4491){if(_0x3b4491){return _0x168f72['sendStatus'](_0x4b2ba6);}return _0x168f72[_0x8bbb('0x28')](_0x4b2ba6)[_0x8bbb('0x29')]();};}function respondWithResult(_0x211c6a,_0x2fff2e){_0x2fff2e=_0x2fff2e||0xc8;return function(_0x4ac4ba){if(_0x4ac4ba){return _0x211c6a[_0x8bbb('0x28')](_0x2fff2e)['json'](_0x4ac4ba);}};}function respondWithFilteredResult(_0x85a8b3,_0x4b4bc1){return function(_0x22a074){if(_0x22a074){var _0x3ab8b3=_0x22a074['count'],_0x1309e6=_0x4b4bc1[_0x8bbb('0x2a')],_0x529949=_0x4b4bc1[_0x8bbb('0x2a')]+_0x4b4bc1[_0x8bbb('0x2b')],_0x1375a9;if(_0x529949>=_0x3ab8b3){_0x529949=_0x3ab8b3;_0x1375a9=0xc8;}else{_0x1375a9=0xce;}_0x85a8b3[_0x8bbb('0x28')](_0x1375a9);return _0x85a8b3['set']('Content-Range',_0x1309e6+'-'+_0x529949+'/'+_0x3ab8b3)[_0x8bbb('0x2c')](_0x22a074);}return null;};}function patchUpdates(_0x4ca88d){return function(_0x19d2f2){try{jsonpatch[_0x8bbb('0x2d')](_0x19d2f2,_0x4ca88d,!![]);}catch(_0x540783){return BPromise[_0x8bbb('0x2e')](_0x540783);}return _0x19d2f2['save']();};}function saveUpdates(_0x2a4b70,_0x24b547){return function(_0x14b452){if(_0x14b452){return _0x14b452[_0x8bbb('0x2f')](_0x2a4b70)[_0x8bbb('0x1c')](function(_0x18214f){return _0x18214f;});}return null;};}function removeEntity(_0x10666c,_0x5259dd){return function(_0x26ce59){if(_0x26ce59){return _0x26ce59[_0x8bbb('0x30')]()[_0x8bbb('0x1c')](function(){_0x10666c[_0x8bbb('0x28')](0xcc)[_0x8bbb('0x29')]();});}};}function handleEntityNotFound(_0x4ff748,_0x313e15){return function(_0x48f0a8){if(!_0x48f0a8){_0x4ff748[_0x8bbb('0x31')](0x194);}return _0x48f0a8;};}function handleError(_0x18019b,_0x28428e){_0x28428e=_0x28428e||0x1f4;return function(_0x47e857){logger['error'](_0x47e857[_0x8bbb('0x32')]);if(_0x47e857['name']){delete _0x47e857['name'];}_0x18019b['status'](_0x28428e)[_0x8bbb('0x33')](_0x47e857);};}exports[_0x8bbb('0x34')]=function(_0xa8234c,_0x9838bb){var _0x48e68b={},_0x1e7c8e={},_0x17c9aa={'count':0x0,'rows':[]};var _0x27f607=_[_0x8bbb('0x35')](db[_0x8bbb('0x36')][_0x8bbb('0x37')],function(_0x100413){return{'name':_0x100413[_0x8bbb('0x38')],'type':_0x100413[_0x8bbb('0x39')][_0x8bbb('0x3a')]};});_0x1e7c8e[_0x8bbb('0x3b')]=_['map'](_0x27f607,'name');_0x1e7c8e[_0x8bbb('0x3c')]=_[_0x8bbb('0x3d')](_0xa8234c[_0x8bbb('0x3c')]);_0x1e7c8e[_0x8bbb('0x3e')]=_[_0x8bbb('0x3f')](_0x1e7c8e[_0x8bbb('0x3b')],_0x1e7c8e[_0x8bbb('0x3c')]);_0x48e68b['attributes']=_[_0x8bbb('0x3f')](_0x1e7c8e[_0x8bbb('0x3b')],qs[_0x8bbb('0x40')](_0xa8234c[_0x8bbb('0x3c')][_0x8bbb('0x40')]));_0x48e68b[_0x8bbb('0x41')]=_0x48e68b[_0x8bbb('0x41')][_0x8bbb('0x42')]?_0x48e68b['attributes']:_0x1e7c8e[_0x8bbb('0x3b')];if(!_0xa8234c[_0x8bbb('0x3c')][_0x8bbb('0x43')]('nolimit')){_0x48e68b[_0x8bbb('0x2b')]=qs[_0x8bbb('0x2b')](_0xa8234c['query'][_0x8bbb('0x2b')]);_0x48e68b['offset']=qs[_0x8bbb('0x2a')](_0xa8234c[_0x8bbb('0x3c')]['offset']);}_0x48e68b['order']=qs[_0x8bbb('0x44')](_0xa8234c['query'][_0x8bbb('0x44')]);_0x48e68b[_0x8bbb('0x45')]=qs[_0x8bbb('0x3e')](_[_0x8bbb('0x46')](_0xa8234c[_0x8bbb('0x3c')],_0x1e7c8e['filters']),_0x27f607);if(_0xa8234c[_0x8bbb('0x3c')]['filter']){_0x48e68b[_0x8bbb('0x45')]=_[_0x8bbb('0x47')](_0x48e68b[_0x8bbb('0x45')],{'$or':_[_0x8bbb('0x35')](_0x27f607,function(_0x210619){if(_0x210619[_0x8bbb('0x39')]!==_0x8bbb('0x48')){var _0x29ec29={};_0x29ec29[_0x210619['name']]={'$like':'%'+_0xa8234c[_0x8bbb('0x3c')]['filter']+'%'};return _0x29ec29;}})});}_0x48e68b=_[_0x8bbb('0x47')]({},_0x48e68b,_0xa8234c[_0x8bbb('0x49')]);var _0x361af8={'where':_0x48e68b[_0x8bbb('0x45')]};return db['VtigerConfiguration'][_0x8bbb('0x4a')](_0x361af8)[_0x8bbb('0x1c')](function(_0x29b064){_0x17c9aa['count']=_0x29b064;if(_0xa8234c['query'][_0x8bbb('0x4b')]){_0x48e68b[_0x8bbb('0x4c')]=[{'all':!![]}];}return db[_0x8bbb('0x36')]['findAll'](_0x48e68b);})[_0x8bbb('0x1c')](function(_0x47e652){_0x17c9aa[_0x8bbb('0x4d')]=_0x47e652;return _0x17c9aa;})[_0x8bbb('0x1c')](respondWithFilteredResult(_0x9838bb,_0x48e68b))['catch'](handleError(_0x9838bb,null));};exports[_0x8bbb('0x4e')]=function(_0x21cb24,_0x353123){var _0x187f69={'raw':![],'where':{'id':_0x21cb24['params']['id']}},_0x61e91a={};_0x61e91a[_0x8bbb('0x3b')]=_['keys'](db[_0x8bbb('0x36')]['rawAttributes']);_0x61e91a[_0x8bbb('0x3c')]=_[_0x8bbb('0x3d')](_0x21cb24[_0x8bbb('0x3c')]);_0x61e91a['filters']=_[_0x8bbb('0x3f')](_0x61e91a['model'],_0x61e91a['query']);_0x187f69[_0x8bbb('0x41')]=_['intersection'](_0x61e91a[_0x8bbb('0x3b')],qs[_0x8bbb('0x40')](_0x21cb24[_0x8bbb('0x3c')][_0x8bbb('0x40')]));_0x187f69[_0x8bbb('0x41')]=_0x187f69['attributes'][_0x8bbb('0x42')]?_0x187f69[_0x8bbb('0x41')]:_0x61e91a[_0x8bbb('0x3b')];if(_0x21cb24[_0x8bbb('0x3c')][_0x8bbb('0x4b')]){_0x187f69[_0x8bbb('0x4c')]=[{'all':!![]}];}_0x187f69=_['merge']({},_0x187f69,_0x21cb24[_0x8bbb('0x49')]);return db[_0x8bbb('0x36')][_0x8bbb('0x4f')](_0x187f69)[_0x8bbb('0x1c')](handleEntityNotFound(_0x353123,null))[_0x8bbb('0x1c')](respondWithResult(_0x353123,null))[_0x8bbb('0x27')](handleError(_0x353123,null));};exports[_0x8bbb('0x50')]=function(_0x1a3ef7,_0x2bf26a){return db[_0x8bbb('0x36')][_0x8bbb('0x50')](_0x1a3ef7[_0x8bbb('0x51')],{})[_0x8bbb('0x1c')](respondWithResult(_0x2bf26a,0xc9))[_0x8bbb('0x27')](handleError(_0x2bf26a,null));};exports[_0x8bbb('0x2f')]=function(_0x5c03b0,_0x4590d2){if(_0x5c03b0[_0x8bbb('0x51')]['id']){delete _0x5c03b0['body']['id'];}return db[_0x8bbb('0x36')][_0x8bbb('0x4f')]({'where':{'id':_0x5c03b0[_0x8bbb('0x52')]['id']}})[_0x8bbb('0x1c')](handleEntityNotFound(_0x4590d2,null))[_0x8bbb('0x1c')](saveUpdates(_0x5c03b0[_0x8bbb('0x51')],null))['then'](respondWithResult(_0x4590d2,null))[_0x8bbb('0x27')](handleError(_0x4590d2,null));};exports[_0x8bbb('0x30')]=function(_0xb9ac1d,_0x4d0b7b){return db[_0x8bbb('0x36')][_0x8bbb('0x4f')]({'where':{'id':_0xb9ac1d[_0x8bbb('0x52')]['id']}})[_0x8bbb('0x1c')](handleEntityNotFound(_0x4d0b7b,null))[_0x8bbb('0x1c')](removeEntity(_0x4d0b7b,null))[_0x8bbb('0x27')](handleError(_0x4d0b7b,null));};exports[_0x8bbb('0x53')]=function(_0x52dae9,_0x2c28aa,_0x2d4712){var _0x3b89c1={};var _0x3e62bb={};var _0x5704a5;var _0x41e76b;return db['VtigerConfiguration'][_0x8bbb('0x54')]({'where':{'id':_0x52dae9[_0x8bbb('0x52')]['id']}})[_0x8bbb('0x1c')](handleEntityNotFound(_0x2c28aa,null))['then'](function(_0x167e1e){if(_0x167e1e){_0x5704a5=_0x167e1e;_0x3e62bb['model']=_[_0x8bbb('0x3d')](db[_0x8bbb('0x55')]['rawAttributes']);_0x3e62bb['query']=_['keys'](_0x52dae9['query']);_0x3e62bb[_0x8bbb('0x3e')]=_[_0x8bbb('0x3f')](_0x3e62bb[_0x8bbb('0x3b')],_0x3e62bb[_0x8bbb('0x3c')]);_0x3b89c1['attributes']=_[_0x8bbb('0x3f')](_0x3e62bb[_0x8bbb('0x3b')],qs[_0x8bbb('0x40')](_0x52dae9[_0x8bbb('0x3c')][_0x8bbb('0x40')]));_0x3b89c1[_0x8bbb('0x41')]=_0x3b89c1[_0x8bbb('0x41')]['length']?_0x3b89c1[_0x8bbb('0x41')]:_0x3e62bb[_0x8bbb('0x3b')];_0x3b89c1[_0x8bbb('0x56')]=qs[_0x8bbb('0x44')](_0x52dae9[_0x8bbb('0x3c')]['sort']);_0x3b89c1[_0x8bbb('0x45')]=qs[_0x8bbb('0x3e')](_['pick'](_0x52dae9[_0x8bbb('0x3c')],_0x3e62bb[_0x8bbb('0x3e')]));if(_0x52dae9[_0x8bbb('0x3c')][_0x8bbb('0x57')]){_0x3b89c1['where']=_[_0x8bbb('0x47')](_0x3b89c1['where'],{'$or':_[_0x8bbb('0x35')](_0x3b89c1[_0x8bbb('0x41')],function(_0x4dc02c){var _0x4ad8d7={};_0x4ad8d7[_0x4dc02c]={'$like':'%'+_0x52dae9[_0x8bbb('0x3c')][_0x8bbb('0x57')]+'%'};return _0x4ad8d7;})});}_0x3b89c1=_[_0x8bbb('0x47')]({},_0x3b89c1,_0x52dae9[_0x8bbb('0x49')]);return _0x5704a5[_0x8bbb('0x53')](_0x3b89c1);}})['then'](function(_0x14ebe3){if(_0x14ebe3){_0x41e76b=_0x14ebe3[_0x8bbb('0x42')];if(!_0x52dae9['query'][_0x8bbb('0x43')]('nolimit')){_0x3b89c1[_0x8bbb('0x2b')]=qs[_0x8bbb('0x2b')](_0x52dae9[_0x8bbb('0x3c')][_0x8bbb('0x2b')]);_0x3b89c1[_0x8bbb('0x2a')]=qs[_0x8bbb('0x2a')](_0x52dae9['query'][_0x8bbb('0x2a')]);}return _0x5704a5[_0x8bbb('0x53')](_0x3b89c1);}})[_0x8bbb('0x1c')](function(_0xc41eaf){if(_0xc41eaf){return _0xc41eaf?{'count':_0x41e76b,'rows':_0xc41eaf}:null;}})[_0x8bbb('0x1c')](respondWithResult(_0x2c28aa,null))[_0x8bbb('0x27')](handleError(_0x2c28aa,null));};exports['getSubjects']=function(_0x36460a,_0x494f5a,_0x40f68d){var _0x5ca39d={};var _0x4ca549={};var _0x6f79b5;var _0x21fc83;return db[_0x8bbb('0x36')]['findOne']({'where':{'id':_0x36460a[_0x8bbb('0x52')]['id']}})[_0x8bbb('0x1c')](handleEntityNotFound(_0x494f5a,null))['then'](function(_0x3e11fc){if(_0x3e11fc){_0x6f79b5=_0x3e11fc;_0x4ca549[_0x8bbb('0x3b')]=_[_0x8bbb('0x3d')](db[_0x8bbb('0x55')]['rawAttributes']);_0x4ca549[_0x8bbb('0x3c')]=_[_0x8bbb('0x3d')](_0x36460a[_0x8bbb('0x3c')]);_0x4ca549[_0x8bbb('0x3e')]=_[_0x8bbb('0x3f')](_0x4ca549[_0x8bbb('0x3b')],_0x4ca549['query']);_0x5ca39d[_0x8bbb('0x41')]=_[_0x8bbb('0x3f')](_0x4ca549[_0x8bbb('0x3b')],qs[_0x8bbb('0x40')](_0x36460a[_0x8bbb('0x3c')][_0x8bbb('0x40')]));_0x5ca39d['attributes']=_0x5ca39d[_0x8bbb('0x41')]['length']?_0x5ca39d[_0x8bbb('0x41')]:_0x4ca549[_0x8bbb('0x3b')];_0x5ca39d[_0x8bbb('0x56')]=qs[_0x8bbb('0x44')](_0x36460a[_0x8bbb('0x3c')][_0x8bbb('0x44')]);_0x5ca39d['where']=qs[_0x8bbb('0x3e')](_[_0x8bbb('0x46')](_0x36460a['query'],_0x4ca549[_0x8bbb('0x3e')]));if(_0x36460a['query']['filter']){_0x5ca39d[_0x8bbb('0x45')]=_[_0x8bbb('0x47')](_0x5ca39d['where'],{'$or':_['map'](_0x5ca39d[_0x8bbb('0x41')],function(_0x2a9bd9){var _0x20478c={};_0x20478c[_0x2a9bd9]={'$like':'%'+_0x36460a['query'][_0x8bbb('0x57')]+'%'};return _0x20478c;})});}_0x5ca39d=_[_0x8bbb('0x47')]({},_0x5ca39d,_0x36460a[_0x8bbb('0x49')]);return _0x6f79b5['getSubjects'](_0x5ca39d);}})[_0x8bbb('0x1c')](function(_0xfe4246){if(_0xfe4246){_0x21fc83=_0xfe4246[_0x8bbb('0x42')];if(!_0x36460a['query'][_0x8bbb('0x43')]('nolimit')){_0x5ca39d['limit']=qs[_0x8bbb('0x2b')](_0x36460a['query'][_0x8bbb('0x2b')]);_0x5ca39d[_0x8bbb('0x2a')]=qs[_0x8bbb('0x2a')](_0x36460a['query']['offset']);}return _0x6f79b5[_0x8bbb('0x58')](_0x5ca39d);}})['then'](function(_0x41bd4c){if(_0x41bd4c){return _0x41bd4c?{'count':_0x21fc83,'rows':_0x41bd4c}:null;}})[_0x8bbb('0x1c')](respondWithResult(_0x494f5a,null))['catch'](handleError(_0x494f5a,null));};exports[_0x8bbb('0x59')]=function(_0x190261,_0x2b4684,_0x1bae2a){var _0x4ea27a={};var _0x565340={};var _0x5c3da9;var _0x3a5553;return db[_0x8bbb('0x36')][_0x8bbb('0x54')]({'where':{'id':_0x190261[_0x8bbb('0x52')]['id']}})[_0x8bbb('0x1c')](handleEntityNotFound(_0x2b4684,null))[_0x8bbb('0x1c')](function(_0x2ac562){if(_0x2ac562){_0x5c3da9=_0x2ac562;_0x565340[_0x8bbb('0x3b')]=_[_0x8bbb('0x3d')](db[_0x8bbb('0x55')][_0x8bbb('0x37')]);_0x565340['query']=_[_0x8bbb('0x3d')](_0x190261[_0x8bbb('0x3c')]);_0x565340['filters']=_[_0x8bbb('0x3f')](_0x565340[_0x8bbb('0x3b')],_0x565340[_0x8bbb('0x3c')]);_0x4ea27a[_0x8bbb('0x41')]=_[_0x8bbb('0x3f')](_0x565340[_0x8bbb('0x3b')],qs[_0x8bbb('0x40')](_0x190261[_0x8bbb('0x3c')][_0x8bbb('0x40')]));_0x4ea27a[_0x8bbb('0x41')]=_0x4ea27a[_0x8bbb('0x41')]['length']?_0x4ea27a[_0x8bbb('0x41')]:_0x565340[_0x8bbb('0x3b')];_0x4ea27a[_0x8bbb('0x56')]=qs[_0x8bbb('0x44')](_0x190261[_0x8bbb('0x3c')][_0x8bbb('0x44')]);_0x4ea27a[_0x8bbb('0x45')]=qs[_0x8bbb('0x3e')](_[_0x8bbb('0x46')](_0x190261[_0x8bbb('0x3c')],_0x565340[_0x8bbb('0x3e')]));if(_0x190261[_0x8bbb('0x3c')][_0x8bbb('0x57')]){_0x4ea27a[_0x8bbb('0x45')]=_['merge'](_0x4ea27a['where'],{'$or':_[_0x8bbb('0x35')](_0x4ea27a['attributes'],function(_0x5549b9){var _0x24b97d={};_0x24b97d[_0x5549b9]={'$like':'%'+_0x190261['query'][_0x8bbb('0x57')]+'%'};return _0x24b97d;})});}_0x4ea27a=_['merge']({},_0x4ea27a,_0x190261[_0x8bbb('0x49')]);return _0x5c3da9[_0x8bbb('0x59')](_0x4ea27a);}})['then'](function(_0x28da5c){if(_0x28da5c){_0x3a5553=_0x28da5c[_0x8bbb('0x42')];if(!_0x190261[_0x8bbb('0x3c')][_0x8bbb('0x43')](_0x8bbb('0x5a'))){_0x4ea27a['limit']=qs[_0x8bbb('0x2b')](_0x190261['query']['limit']);_0x4ea27a['offset']=qs[_0x8bbb('0x2a')](_0x190261[_0x8bbb('0x3c')][_0x8bbb('0x2a')]);}return _0x5c3da9['getDescriptions'](_0x4ea27a);}})['then'](function(_0x21b4a1){if(_0x21b4a1){return _0x21b4a1?{'count':_0x3a5553,'rows':_0x21b4a1}:null;}})[_0x8bbb('0x1c')](respondWithResult(_0x2b4684,null))[_0x8bbb('0x27')](handleError(_0x2b4684,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 92f4c2e..0dcd331 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 _0xa09f=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intVtigerConfiguration.attributes','define','int_vtiger_configurations','lodash'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xa09f,0xc5));var _0xfa09=function(_0x48adf2,_0x12c0c7){_0x48adf2=_0x48adf2-0x0;var _0x16d022=_0xa09f[_0x48adf2];return _0x16d022;};'use strict';var _=require(_0xfa09('0x0'));var util=require(_0xfa09('0x1'));var logger=require(_0xfa09('0x2'))('api');var moment=require(_0xfa09('0x3'));var BPromise=require(_0xfa09('0x4'));var rp=require(_0xfa09('0x5'));var fs=require('fs');var path=require(_0xfa09('0x6'));var rimraf=require(_0xfa09('0x7'));var config=require('../../config/environment');var attributes=require(_0xfa09('0x8'));module['exports']=function(_0x6fd741,_0x222a17){return _0x6fd741[_0xfa09('0x9')]('VtigerConfiguration',attributes,{'tableName':_0xfa09('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b33=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes','int_vtiger_configurations'];(function(_0x19bab6,_0x12f04){var _0x5d021a=function(_0x1e2edd){while(--_0x1e2edd){_0x19bab6['push'](_0x19bab6['shift']());}};_0x5d021a(++_0x12f04);}(_0x9b33,0x15e));var _0x39b3=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x9b33[_0x1cb18a];return _0x22442e;};'use strict';var _=require(_0x39b3('0x0'));var util=require(_0x39b3('0x1'));var logger=require(_0x39b3('0x2'))('api');var moment=require(_0x39b3('0x3'));var BPromise=require(_0x39b3('0x4'));var rp=require(_0x39b3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x39b3('0x6'));var config=require(_0x39b3('0x7'));var attributes=require(_0x39b3('0x8'));module['exports']=function(_0x3d517c,_0x40212a){return _0x3d517c['define']('VtigerConfiguration',attributes,{'tableName':_0x39b3('0x9'),'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 3761eae..d052d06 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 _0x5128=['result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x5128,0xd1));var _0x8512=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x5128[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0x8512('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8512('0x1'));var rs=require(_0x8512('0x2'));var fs=require('fs');var Redis=require(_0x8512('0x3'));var db=require(_0x8512('0x4'))['db'];var utils=require(_0x8512('0x5'));var logger=require(_0x8512('0x6'))(_0x8512('0x7'));var config=require(_0x8512('0x8'));var jayson=require(_0x8512('0x9'));var client=jayson[_0x8512('0xa')][_0x8512('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x212d5d,_0x222e94,_0x71ab53){return new BPromise(function(_0xa32977,_0x166a3f){return client[_0x8512('0xc')](_0x212d5d,_0x71ab53)['then'](function(_0xb07c61){logger[_0x8512('0xd')](_0x8512('0xe'),_0x222e94,_0x8512('0xf'));logger[_0x8512('0x10')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x222e94,_0x8512('0xf'),JSON[_0x8512('0x11')](_0xb07c61));if(_0xb07c61[_0x8512('0x12')]){if(_0xb07c61[_0x8512('0x12')][_0x8512('0x13')]===0x1f4){logger[_0x8512('0x12')](_0x8512('0xe'),_0x222e94,_0xb07c61[_0x8512('0x12')][_0x8512('0x14')]);return _0x166a3f(_0xb07c61[_0x8512('0x12')][_0x8512('0x14')]);}logger['error'](_0x8512('0xe'),_0x222e94,_0xb07c61[_0x8512('0x12')]['message']);return _0xa32977(_0xb07c61['error'][_0x8512('0x14')]);}else{logger[_0x8512('0xd')](_0x8512('0xe'),_0x222e94,_0x8512('0xf'));_0xa32977(_0xb07c61[_0x8512('0x15')]['message']);}})[_0x8512('0x16')](function(_0x5cbaac){logger[_0x8512('0x12')](_0x8512('0xe'),_0x222e94,_0x5cbaac);_0x166a3f(_0x5cbaac);});});} \ No newline at end of file +var _0x3833=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','catch','lodash','bluebird'];(function(_0xb8e9b9,_0x1bc1f6){var _0x579845=function(_0x486596){while(--_0x486596){_0xb8e9b9['push'](_0xb8e9b9['shift']());}};_0x579845(++_0x1bc1f6);}(_0x3833,0x19c));var _0x3383=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x3833[_0x42f009];return _0x22a1e0;};'use strict';var _=require(_0x3383('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3383('0x1'));var rs=require(_0x3383('0x2'));var fs=require('fs');var Redis=require(_0x3383('0x3'));var db=require(_0x3383('0x4'))['db'];var utils=require(_0x3383('0x5'));var logger=require(_0x3383('0x6'))(_0x3383('0x7'));var config=require(_0x3383('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3383('0x9')][_0x3383('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9266de,_0x3e6339,_0x4ec821){return new BPromise(function(_0x482057,_0x71121){return client[_0x3383('0xb')](_0x9266de,_0x4ec821)[_0x3383('0xc')](function(_0x9476f3){logger[_0x3383('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x3e6339,_0x3383('0xe'));logger[_0x3383('0xf')](_0x3383('0x10'),_0x3e6339,_0x3383('0xe'),JSON[_0x3383('0x11')](_0x9476f3));if(_0x9476f3[_0x3383('0x12')]){if(_0x9476f3[_0x3383('0x12')][_0x3383('0x13')]===0x1f4){logger[_0x3383('0x12')](_0x3383('0x14'),_0x3e6339,_0x9476f3[_0x3383('0x12')][_0x3383('0x15')]);return _0x71121(_0x9476f3['error']['message']);}logger['error'](_0x3383('0x14'),_0x3e6339,_0x9476f3[_0x3383('0x12')][_0x3383('0x15')]);return _0x482057(_0x9476f3[_0x3383('0x12')][_0x3383('0x15')]);}else{logger['info'](_0x3383('0x14'),_0x3e6339,_0x3383('0xe'));_0x482057(_0x9476f3['result'][_0x3383('0x15')]);}})[_0x3383('0x16')](function(_0x103782){logger[_0x3383('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x3e6339,_0x103782);_0x71121(_0x103782);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 87bb784..8385472 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 _0x3562=['show','post','put','update','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x456032,_0x1a799d){var _0x1a53cd=function(_0x162cc8){while(--_0x162cc8){_0x456032['push'](_0x456032['shift']());}};_0x1a53cd(++_0x1a799d);}(_0x3562,0xc9));var _0x2356=function(_0x13a219,_0x25acd3){_0x13a219=_0x13a219-0x0;var _0x50e371=_0x3562[_0x13a219];return _0x50e371;};'use strict';var multer=require(_0x2356('0x0'));var util=require('util');var path=require(_0x2356('0x1'));var timeout=require(_0x2356('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x2356('0x3'));var interaction=require(_0x2356('0x4'));var config=require(_0x2356('0x5'));var controller=require('./intVtigerField.controller');router[_0x2356('0x6')]('/',auth[_0x2356('0x7')](),controller['index']);router[_0x2356('0x6')](_0x2356('0x8'),auth[_0x2356('0x7')](),controller[_0x2356('0x9')]);router[_0x2356('0xa')]('/',auth[_0x2356('0x7')](),controller['create']);router[_0x2356('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x2356('0xc')]);router['delete'](_0x2356('0x8'),auth[_0x2356('0x7')](),controller[_0x2356('0xd')]);module[_0x2356('0xe')]=router; \ No newline at end of file +var _0x2c89=['get','/:id','put','update','delete','destroy','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','isAuthenticated','index'];(function(_0x4307f4,_0x30cb53){var _0x12df9a=function(_0xebe0bc){while(--_0xebe0bc){_0x4307f4['push'](_0x4307f4['shift']());}};_0x12df9a(++_0x30cb53);}(_0x2c89,0x103));var _0x92c8=function(_0x28bb55,_0x472261){_0x28bb55=_0x28bb55-0x0;var _0xbfb4f5=_0x2c89[_0x28bb55];return _0xbfb4f5;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x92c8('0x0'));var express=require('express');var router=express[_0x92c8('0x1')]();var auth=require(_0x92c8('0x2'));var interaction=require(_0x92c8('0x3'));var config=require('../../config/environment');var controller=require(_0x92c8('0x4'));router['get']('/',auth[_0x92c8('0x5')](),controller[_0x92c8('0x6')]);router[_0x92c8('0x7')](_0x92c8('0x8'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x92c8('0x5')](),controller['create']);router[_0x92c8('0x9')](_0x92c8('0x8'),auth[_0x92c8('0x5')](),controller[_0x92c8('0xa')]);router[_0x92c8('0xb')](_0x92c8('0x8'),auth[_0x92c8('0x5')](),controller[_0x92c8('0xc')]);module[_0x92c8('0xd')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 6eb2a30..d87d4c6 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 _0xdbad=['string','variable','keyValue','customVariable','STRING','sequelize','exports','ENUM'];(function(_0x4815dd,_0x4b4f03){var _0x36b9b5=function(_0x495657){while(--_0x495657){_0x4815dd['push'](_0x4815dd['shift']());}};_0x36b9b5(++_0x4b4f03);}(_0xdbad,0x8d));var _0xddba=function(_0x1a85bc,_0x1eabcd){_0x1a85bc=_0x1a85bc-0x0;var _0x4d53d3=_0xdbad[_0x1a85bc];return _0x4d53d3;};'use strict';var Sequelize=require(_0xddba('0x0'));module[_0xddba('0x1')]={'type':{'type':Sequelize[_0xddba('0x2')](_0xddba('0x3'),_0xddba('0x4'),'customVariable',_0xddba('0x5')),'defaultValue':_0xddba('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xddba('0x2')](_0xddba('0x3'),'variable',_0xddba('0x6'))},'keyContent':{'type':Sequelize[_0xddba('0x7')]},'idField':{'type':Sequelize[_0xddba('0x7')]},'nameField':{'type':Sequelize[_0xddba('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8323=['STRING','customVariable','BOOLEAN','sequelize','variable','keyValue','string'];(function(_0x1e9637,_0x4366ce){var _0x1f49c9=function(_0x43c316){while(--_0x43c316){_0x1e9637['push'](_0x1e9637['shift']());}};_0x1f49c9(++_0x4366ce);}(_0x8323,0x8f));var _0x3832=function(_0x2bfe2c,_0x244cc5){_0x2bfe2c=_0x2bfe2c-0x0;var _0x311713=_0x8323[_0x2bfe2c];return _0x311713;};'use strict';var Sequelize=require(_0x3832('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x3832('0x1'),'customVariable',_0x3832('0x2')),'defaultValue':_0x3832('0x3')},'content':{'type':Sequelize[_0x3832('0x4')]},'key':{'type':Sequelize[_0x3832('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x3832('0x3'),_0x3832('0x1'),_0x3832('0x5'))},'keyContent':{'type':Sequelize[_0x3832('0x4')]},'idField':{'type':Sequelize[_0x3832('0x4')]},'nameField':{'type':Sequelize[_0x3832('0x4')]},'customField':{'type':Sequelize[_0x3832('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3832('0x4')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index b9b90d7..5af5905 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 _0x06ae=['query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','limit','set','apply','reject','update','then','destroy','sendStatus','error','name','send','map','VtigerField','rawAttributes','fieldName','type','key','model'];(function(_0x20b29c,_0xe22528){var _0x20d81b=function(_0xd63a71){while(--_0xd63a71){_0x20b29c['push'](_0x20b29c['shift']());}};_0x20d81b(++_0xe22528);}(_0x06ae,0x16e));var _0xe06a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x06ae[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe06a('0x0'));var rimraf=require(_0xe06a('0x1'));var zipdir=require(_0xe06a('0x2'));var jsonpatch=require(_0xe06a('0x3'));var rp=require(_0xe06a('0x4'));var moment=require(_0xe06a('0x5'));var BPromise=require(_0xe06a('0x6'));var Mustache=require(_0xe06a('0x7'));var util=require(_0xe06a('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe06a('0x9'));var fs=require('fs');var _=require(_0xe06a('0xa'));var squel=require(_0xe06a('0xb'));var crypto=require(_0xe06a('0xc'));var jsforce=require(_0xe06a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe06a('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe06a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe06a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe06a('0x11'))(_0xe06a('0x12'));var utils=require('../../config/utils');var config=require(_0xe06a('0x13'));var licenseUtil=require(_0xe06a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb402c7,_0x87ff63){_0x87ff63=_0x87ff63||0xcc;return function(_0x3aaf53){if(_0x3aaf53){return _0xb402c7['sendStatus'](_0x87ff63);}return _0xb402c7[_0xe06a('0x15')](_0x87ff63)[_0xe06a('0x16')]();};}function respondWithResult(_0x359273,_0xf8a9a7){_0xf8a9a7=_0xf8a9a7||0xc8;return function(_0x335c0d){if(_0x335c0d){return _0x359273['status'](_0xf8a9a7)[_0xe06a('0x17')](_0x335c0d);}};}function respondWithFilteredResult(_0x1080da,_0x171b77){return function(_0xe471a9){if(_0xe471a9){var _0x4d0e41=_0xe471a9['count'],_0x403a92=_0x171b77['offset'],_0x57b590=_0x171b77['offset']+_0x171b77[_0xe06a('0x18')],_0xa9b1af;if(_0x57b590>=_0x4d0e41){_0x57b590=_0x4d0e41;_0xa9b1af=0xc8;}else{_0xa9b1af=0xce;}_0x1080da[_0xe06a('0x15')](_0xa9b1af);return _0x1080da[_0xe06a('0x19')]('Content-Range',_0x403a92+'-'+_0x57b590+'/'+_0x4d0e41)[_0xe06a('0x17')](_0xe471a9);}return null;};}function patchUpdates(_0x6483d4){return function(_0x5806b6){try{jsonpatch[_0xe06a('0x1a')](_0x5806b6,_0x6483d4,!![]);}catch(_0x5382a6){return BPromise[_0xe06a('0x1b')](_0x5382a6);}return _0x5806b6['save']();};}function saveUpdates(_0x550ff8,_0x70d702){return function(_0x99dcd5){if(_0x99dcd5){return _0x99dcd5[_0xe06a('0x1c')](_0x550ff8)[_0xe06a('0x1d')](function(_0xf8921e){return _0xf8921e;});}return null;};}function removeEntity(_0xd2adcd,_0x2ab25f){return function(_0x2c30c7){if(_0x2c30c7){return _0x2c30c7[_0xe06a('0x1e')]()[_0xe06a('0x1d')](function(){_0xd2adcd['status'](0xcc)[_0xe06a('0x16')]();});}};}function handleEntityNotFound(_0x31c2cb,_0xf13325){return function(_0x82ba72){if(!_0x82ba72){_0x31c2cb[_0xe06a('0x1f')](0x194);}return _0x82ba72;};}function handleError(_0x2c96bd,_0x3f468e){_0x3f468e=_0x3f468e||0x1f4;return function(_0x19a7e0){logger[_0xe06a('0x20')](_0x19a7e0['stack']);if(_0x19a7e0['name']){delete _0x19a7e0[_0xe06a('0x21')];}_0x2c96bd['status'](_0x3f468e)[_0xe06a('0x22')](_0x19a7e0);};}exports['index']=function(_0x4afa75,_0x5e0b56){var _0x37ff49={},_0x4316bb={},_0x58525a={'count':0x0,'rows':[]};var _0x217f24=_[_0xe06a('0x23')](db[_0xe06a('0x24')][_0xe06a('0x25')],function(_0x15cf61){return{'name':_0x15cf61[_0xe06a('0x26')],'type':_0x15cf61[_0xe06a('0x27')][_0xe06a('0x28')]};});_0x4316bb[_0xe06a('0x29')]=_['map'](_0x217f24,'name');_0x4316bb[_0xe06a('0x2a')]=_[_0xe06a('0x2b')](_0x4afa75[_0xe06a('0x2a')]);_0x4316bb[_0xe06a('0x2c')]=_['intersection'](_0x4316bb[_0xe06a('0x29')],_0x4316bb['query']);_0x37ff49[_0xe06a('0x2d')]=_[_0xe06a('0x2e')](_0x4316bb[_0xe06a('0x29')],qs[_0xe06a('0x2f')](_0x4afa75['query'][_0xe06a('0x2f')]));_0x37ff49[_0xe06a('0x2d')]=_0x37ff49[_0xe06a('0x2d')][_0xe06a('0x30')]?_0x37ff49['attributes']:_0x4316bb['model'];if(!_0x4afa75[_0xe06a('0x2a')][_0xe06a('0x31')](_0xe06a('0x32'))){_0x37ff49[_0xe06a('0x18')]=qs[_0xe06a('0x18')](_0x4afa75[_0xe06a('0x2a')]['limit']);_0x37ff49['offset']=qs[_0xe06a('0x33')](_0x4afa75['query'][_0xe06a('0x33')]);}_0x37ff49['order']=qs[_0xe06a('0x34')](_0x4afa75[_0xe06a('0x2a')][_0xe06a('0x34')]);_0x37ff49['where']=qs['filters'](_[_0xe06a('0x35')](_0x4afa75[_0xe06a('0x2a')],_0x4316bb[_0xe06a('0x2c')]),_0x217f24);if(_0x4afa75[_0xe06a('0x2a')][_0xe06a('0x36')]){_0x37ff49[_0xe06a('0x37')]=_['merge'](_0x37ff49['where'],{'$or':_['map'](_0x217f24,function(_0x598caf){if(_0x598caf[_0xe06a('0x27')]!==_0xe06a('0x38')){var _0x33499a={};_0x33499a[_0x598caf[_0xe06a('0x21')]]={'$like':'%'+_0x4afa75[_0xe06a('0x2a')]['filter']+'%'};return _0x33499a;}})});}_0x37ff49=_[_0xe06a('0x39')]({},_0x37ff49,_0x4afa75[_0xe06a('0x3a')]);var _0x9c0671={'where':_0x37ff49['where']};return db[_0xe06a('0x24')][_0xe06a('0x3b')](_0x9c0671)[_0xe06a('0x1d')](function(_0x27f6cb){_0x58525a[_0xe06a('0x3b')]=_0x27f6cb;if(_0x4afa75[_0xe06a('0x2a')][_0xe06a('0x3c')]){_0x37ff49[_0xe06a('0x3d')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x37ff49);})[_0xe06a('0x1d')](function(_0x5730f7){_0x58525a['rows']=_0x5730f7;return _0x58525a;})[_0xe06a('0x1d')](respondWithFilteredResult(_0x5e0b56,_0x37ff49))[_0xe06a('0x3e')](handleError(_0x5e0b56,null));};exports[_0xe06a('0x3f')]=function(_0x54da2b,_0x57c990){var _0x13ac63={'raw':!![],'where':{'id':_0x54da2b[_0xe06a('0x40')]['id']}},_0x353349={};_0x353349[_0xe06a('0x29')]=_['keys'](db[_0xe06a('0x24')]['rawAttributes']);_0x353349[_0xe06a('0x2a')]=_[_0xe06a('0x2b')](_0x54da2b['query']);_0x353349[_0xe06a('0x2c')]=_[_0xe06a('0x2e')](_0x353349['model'],_0x353349['query']);_0x13ac63['attributes']=_['intersection'](_0x353349[_0xe06a('0x29')],qs['fields'](_0x54da2b['query']['fields']));_0x13ac63['attributes']=_0x13ac63[_0xe06a('0x2d')][_0xe06a('0x30')]?_0x13ac63[_0xe06a('0x2d')]:_0x353349[_0xe06a('0x29')];if(_0x54da2b[_0xe06a('0x2a')][_0xe06a('0x3c')]){_0x13ac63['include']=[{'all':!![]}];}_0x13ac63=_[_0xe06a('0x39')]({},_0x13ac63,_0x54da2b[_0xe06a('0x3a')]);return db[_0xe06a('0x24')][_0xe06a('0x41')](_0x13ac63)[_0xe06a('0x1d')](handleEntityNotFound(_0x57c990,null))['then'](respondWithResult(_0x57c990,null))['catch'](handleError(_0x57c990,null));};exports[_0xe06a('0x42')]=function(_0x1030ba,_0x459faf){return db[_0xe06a('0x24')]['create'](_0x1030ba[_0xe06a('0x43')],{})[_0xe06a('0x1d')](respondWithResult(_0x459faf,0xc9))[_0xe06a('0x3e')](handleError(_0x459faf,null));};exports['update']=function(_0x590271,_0x5c533b){if(_0x590271[_0xe06a('0x43')]['id']){delete _0x590271[_0xe06a('0x43')]['id'];}return db[_0xe06a('0x24')][_0xe06a('0x41')]({'where':{'id':_0x590271['params']['id']}})[_0xe06a('0x1d')](handleEntityNotFound(_0x5c533b,null))[_0xe06a('0x1d')](saveUpdates(_0x590271[_0xe06a('0x43')],null))[_0xe06a('0x1d')](respondWithResult(_0x5c533b,null))[_0xe06a('0x3e')](handleError(_0x5c533b,null));};exports['destroy']=function(_0xa37eaa,_0x19ff97){return db[_0xe06a('0x24')][_0xe06a('0x41')]({'where':{'id':_0xa37eaa['params']['id']}})['then'](handleEntityNotFound(_0x19ff97,null))[_0xe06a('0x1d')](removeEntity(_0x19ff97,null))[_0xe06a('0x3e')](handleError(_0x19ff97,null));}; \ No newline at end of file +var _0xcaaf=['destroy','error','stack','name','send','index','map','rawAttributes','type','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','options','VtigerField','includeAll','include','findAll','rows','show','catch','body','find','params','html-pdf','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xcaaf,0x66));var _0xfcaa=function(_0x6982f8,_0x41d8ee){_0x6982f8=_0x6982f8-0x0;var _0x33082a=_0xcaaf[_0x6982f8];return _0x33082a;};'use strict';var pdf=require(_0xfcaa('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfcaa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfcaa('0x2'));var moment=require(_0xfcaa('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfcaa('0x4'));var util=require('util');var path=require('path');var sox=require(_0xfcaa('0x5'));var csv=require(_0xfcaa('0x6'));var ejs=require(_0xfcaa('0x7'));var fs=require('fs');var _=require(_0xfcaa('0x8'));var squel=require(_0xfcaa('0x9'));var crypto=require(_0xfcaa('0xa'));var jsforce=require(_0xfcaa('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfcaa('0x6'));var querystring=require('querystring');var Papa=require(_0xfcaa('0xc'));var Redis=require('ioredis');var authService=require(_0xfcaa('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfcaa('0xe'));var logger=require('../../config/logger')(_0xfcaa('0xf'));var utils=require(_0xfcaa('0x10'));var config=require(_0xfcaa('0x11'));var licenseUtil=require(_0xfcaa('0x12'));var db=require(_0xfcaa('0x13'))['db'];function respondWithStatusCode(_0x33664f,_0x1f26e3){_0x1f26e3=_0x1f26e3||0xcc;return function(_0xc03e64){if(_0xc03e64){return _0x33664f['sendStatus'](_0x1f26e3);}return _0x33664f[_0xfcaa('0x14')](_0x1f26e3)[_0xfcaa('0x15')]();};}function respondWithResult(_0x129b69,_0x46181e){_0x46181e=_0x46181e||0xc8;return function(_0x521fff){if(_0x521fff){return _0x129b69[_0xfcaa('0x14')](_0x46181e)[_0xfcaa('0x16')](_0x521fff);}};}function respondWithFilteredResult(_0x27ab5c,_0xf49a9b){return function(_0x54f7f5){if(_0x54f7f5){var _0x10e7e7=_0x54f7f5[_0xfcaa('0x17')],_0x2dbc14=_0xf49a9b[_0xfcaa('0x18')],_0x218c64=_0xf49a9b['offset']+_0xf49a9b[_0xfcaa('0x19')],_0x580335;if(_0x218c64>=_0x10e7e7){_0x218c64=_0x10e7e7;_0x580335=0xc8;}else{_0x580335=0xce;}_0x27ab5c['status'](_0x580335);return _0x27ab5c['set'](_0xfcaa('0x1a'),_0x2dbc14+'-'+_0x218c64+'/'+_0x10e7e7)[_0xfcaa('0x16')](_0x54f7f5);}return null;};}function patchUpdates(_0x416132){return function(_0xa4df1){try{jsonpatch[_0xfcaa('0x1b')](_0xa4df1,_0x416132,!![]);}catch(_0x4566e1){return BPromise[_0xfcaa('0x1c')](_0x4566e1);}return _0xa4df1[_0xfcaa('0x1d')]();};}function saveUpdates(_0x1a975f,_0x7aa3eb){return function(_0x55ec08){if(_0x55ec08){return _0x55ec08[_0xfcaa('0x1e')](_0x1a975f)[_0xfcaa('0x1f')](function(_0x233a73){return _0x233a73;});}return null;};}function removeEntity(_0xc7622,_0xcc1c83){return function(_0x4416ed){if(_0x4416ed){return _0x4416ed[_0xfcaa('0x20')]()[_0xfcaa('0x1f')](function(){_0xc7622[_0xfcaa('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x415bce,_0x1526d9){return function(_0x43da7f){if(!_0x43da7f){_0x415bce['sendStatus'](0x194);}return _0x43da7f;};}function handleError(_0x1d8e09,_0x59c206){_0x59c206=_0x59c206||0x1f4;return function(_0x4642bb){logger[_0xfcaa('0x21')](_0x4642bb[_0xfcaa('0x22')]);if(_0x4642bb[_0xfcaa('0x23')]){delete _0x4642bb[_0xfcaa('0x23')];}_0x1d8e09[_0xfcaa('0x14')](_0x59c206)[_0xfcaa('0x24')](_0x4642bb);};}exports[_0xfcaa('0x25')]=function(_0x3ba17e,_0x55e09a){var _0x55f9c9={},_0x513223={},_0x489390={'count':0x0,'rows':[]};var _0x51171d=_[_0xfcaa('0x26')](db['VtigerField'][_0xfcaa('0x27')],function(_0x4605b5){return{'name':_0x4605b5['fieldName'],'type':_0x4605b5[_0xfcaa('0x28')]['key']};});_0x513223['model']=_[_0xfcaa('0x26')](_0x51171d,_0xfcaa('0x23'));_0x513223[_0xfcaa('0x29')]=_[_0xfcaa('0x2a')](_0x3ba17e['query']);_0x513223[_0xfcaa('0x2b')]=_[_0xfcaa('0x2c')](_0x513223['model'],_0x513223[_0xfcaa('0x29')]);_0x55f9c9[_0xfcaa('0x2d')]=_[_0xfcaa('0x2c')](_0x513223[_0xfcaa('0x2e')],qs[_0xfcaa('0x2f')](_0x3ba17e[_0xfcaa('0x29')]['fields']));_0x55f9c9[_0xfcaa('0x2d')]=_0x55f9c9[_0xfcaa('0x2d')][_0xfcaa('0x30')]?_0x55f9c9[_0xfcaa('0x2d')]:_0x513223['model'];if(!_0x3ba17e[_0xfcaa('0x29')]['hasOwnProperty'](_0xfcaa('0x31'))){_0x55f9c9['limit']=qs[_0xfcaa('0x19')](_0x3ba17e[_0xfcaa('0x29')][_0xfcaa('0x19')]);_0x55f9c9[_0xfcaa('0x18')]=qs[_0xfcaa('0x18')](_0x3ba17e[_0xfcaa('0x29')]['offset']);}_0x55f9c9[_0xfcaa('0x32')]=qs[_0xfcaa('0x33')](_0x3ba17e[_0xfcaa('0x29')][_0xfcaa('0x33')]);_0x55f9c9[_0xfcaa('0x34')]=qs[_0xfcaa('0x2b')](_[_0xfcaa('0x35')](_0x3ba17e[_0xfcaa('0x29')],_0x513223[_0xfcaa('0x2b')]),_0x51171d);if(_0x3ba17e[_0xfcaa('0x29')][_0xfcaa('0x36')]){_0x55f9c9[_0xfcaa('0x34')]=_[_0xfcaa('0x37')](_0x55f9c9[_0xfcaa('0x34')],{'$or':_['map'](_0x51171d,function(_0x515255){if(_0x515255[_0xfcaa('0x28')]!=='VIRTUAL'){var _0x126763={};_0x126763[_0x515255['name']]={'$like':'%'+_0x3ba17e[_0xfcaa('0x29')]['filter']+'%'};return _0x126763;}})});}_0x55f9c9=_[_0xfcaa('0x37')]({},_0x55f9c9,_0x3ba17e[_0xfcaa('0x38')]);var _0x1d8495={'where':_0x55f9c9[_0xfcaa('0x34')]};return db[_0xfcaa('0x39')][_0xfcaa('0x17')](_0x1d8495)[_0xfcaa('0x1f')](function(_0x2c5abf){_0x489390['count']=_0x2c5abf;if(_0x3ba17e[_0xfcaa('0x29')][_0xfcaa('0x3a')]){_0x55f9c9[_0xfcaa('0x3b')]=[{'all':!![]}];}return db['VtigerField'][_0xfcaa('0x3c')](_0x55f9c9);})[_0xfcaa('0x1f')](function(_0x3720d5){_0x489390[_0xfcaa('0x3d')]=_0x3720d5;return _0x489390;})[_0xfcaa('0x1f')](respondWithFilteredResult(_0x55e09a,_0x55f9c9))['catch'](handleError(_0x55e09a,null));};exports[_0xfcaa('0x3e')]=function(_0x29a5a1,_0x45f336){var _0x3c7424={'raw':!![],'where':{'id':_0x29a5a1['params']['id']}},_0x171b7d={};_0x171b7d['model']=_[_0xfcaa('0x2a')](db[_0xfcaa('0x39')]['rawAttributes']);_0x171b7d[_0xfcaa('0x29')]=_[_0xfcaa('0x2a')](_0x29a5a1['query']);_0x171b7d[_0xfcaa('0x2b')]=_[_0xfcaa('0x2c')](_0x171b7d[_0xfcaa('0x2e')],_0x171b7d[_0xfcaa('0x29')]);_0x3c7424['attributes']=_[_0xfcaa('0x2c')](_0x171b7d[_0xfcaa('0x2e')],qs['fields'](_0x29a5a1[_0xfcaa('0x29')][_0xfcaa('0x2f')]));_0x3c7424[_0xfcaa('0x2d')]=_0x3c7424[_0xfcaa('0x2d')][_0xfcaa('0x30')]?_0x3c7424['attributes']:_0x171b7d[_0xfcaa('0x2e')];if(_0x29a5a1[_0xfcaa('0x29')][_0xfcaa('0x3a')]){_0x3c7424[_0xfcaa('0x3b')]=[{'all':!![]}];}_0x3c7424=_[_0xfcaa('0x37')]({},_0x3c7424,_0x29a5a1[_0xfcaa('0x38')]);return db[_0xfcaa('0x39')]['find'](_0x3c7424)[_0xfcaa('0x1f')](handleEntityNotFound(_0x45f336,null))['then'](respondWithResult(_0x45f336,null))[_0xfcaa('0x3f')](handleError(_0x45f336,null));};exports['create']=function(_0x45d310,_0x4fa001){return db[_0xfcaa('0x39')]['create'](_0x45d310[_0xfcaa('0x40')],{})[_0xfcaa('0x1f')](respondWithResult(_0x4fa001,0xc9))['catch'](handleError(_0x4fa001,null));};exports[_0xfcaa('0x1e')]=function(_0x2ef883,_0x368f8d){if(_0x2ef883[_0xfcaa('0x40')]['id']){delete _0x2ef883[_0xfcaa('0x40')]['id'];}return db['VtigerField'][_0xfcaa('0x41')]({'where':{'id':_0x2ef883[_0xfcaa('0x42')]['id']}})[_0xfcaa('0x1f')](handleEntityNotFound(_0x368f8d,null))[_0xfcaa('0x1f')](saveUpdates(_0x2ef883[_0xfcaa('0x40')],null))[_0xfcaa('0x1f')](respondWithResult(_0x368f8d,null))[_0xfcaa('0x3f')](handleError(_0x368f8d,null));};exports[_0xfcaa('0x20')]=function(_0x47f0c7,_0x551524){return db['VtigerField'][_0xfcaa('0x41')]({'where':{'id':_0x47f0c7['params']['id']}})[_0xfcaa('0x1f')](handleEntityNotFound(_0x551524,null))[_0xfcaa('0x1f')](removeEntity(_0x551524,null))[_0xfcaa('0x3f')](handleError(_0x551524,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 9096e28..c69c300 100644 --- a/server/api/intVtigerField/intVtigerField.model.js +++ b/server/api/intVtigerField/intVtigerField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x37b5dd,_0xa89c8){var _0x16d6b9=function(_0xb197fc){while(--_0xb197fc){_0x37b5dd['push'](_0x37b5dd['shift']());}};_0x16d6b9(++_0xa89c8);}(_0x7a54,0x106));var _0x47a5=function(_0x320cb4,_0xec38e6){_0x320cb4=_0x320cb4-0x0;var _0x5ebb74=_0x7a54[_0x320cb4];return _0x5ebb74;};'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 47f3b8f..ad4019c 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 _0xe6e4=['VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info'];(function(_0x384b7b,_0x5a54ef){var _0x414ce0=function(_0x516bff){while(--_0x516bff){_0x384b7b['push'](_0x384b7b['shift']());}};_0x414ce0(++_0x5a54ef);}(_0xe6e4,0xc1));var _0x4e6e=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0xe6e4[_0x454018];return _0x24697d;};'use strict';var _=require(_0x4e6e('0x0'));var util=require(_0x4e6e('0x1'));var moment=require(_0x4e6e('0x2'));var BPromise=require(_0x4e6e('0x3'));var rs=require(_0x4e6e('0x4'));var fs=require('fs');var Redis=require(_0x4e6e('0x5'));var db=require(_0x4e6e('0x6'))['db'];var utils=require(_0x4e6e('0x7'));var logger=require(_0x4e6e('0x8'))('rpc');var config=require(_0x4e6e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4e6e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x474042,_0x491cdc,_0x19d9e9){return new BPromise(function(_0x324547,_0x35523c){return client[_0x4e6e('0xb')](_0x474042,_0x19d9e9)[_0x4e6e('0xc')](function(_0x48ac3f){logger[_0x4e6e('0xd')](_0x4e6e('0xe'),_0x491cdc,_0x4e6e('0xf'));logger[_0x4e6e('0x10')](_0x4e6e('0x11'),_0x491cdc,'request\x20sent',JSON[_0x4e6e('0x12')](_0x48ac3f));if(_0x48ac3f[_0x4e6e('0x13')]){if(_0x48ac3f['error'][_0x4e6e('0x14')]===0x1f4){logger[_0x4e6e('0x13')](_0x4e6e('0xe'),_0x491cdc,_0x48ac3f[_0x4e6e('0x13')][_0x4e6e('0x15')]);return _0x35523c(_0x48ac3f[_0x4e6e('0x13')][_0x4e6e('0x15')]);}logger['error'](_0x4e6e('0xe'),_0x491cdc,_0x48ac3f[_0x4e6e('0x13')][_0x4e6e('0x15')]);return _0x324547(_0x48ac3f[_0x4e6e('0x13')][_0x4e6e('0x15')]);}else{logger[_0x4e6e('0xd')]('VtigerField,\x20%s,\x20%s',_0x491cdc,'request\x20sent');_0x324547(_0x48ac3f[_0x4e6e('0x16')][_0x4e6e('0x15')]);}})['catch'](function(_0x48a899){logger[_0x4e6e('0x13')](_0x4e6e('0xe'),_0x491cdc,_0x48a899);_0x35523c(_0x48a899);});});} \ No newline at end of file +var _0x20df=['debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','VtigerField,\x20%s,\x20%s'];(function(_0x2f3e03,_0x505530){var _0x5a0a1f=function(_0x3f344a){while(--_0x3f344a){_0x2f3e03['push'](_0x2f3e03['shift']());}};_0x5a0a1f(++_0x505530);}(_0x20df,0x7c));var _0xf20d=function(_0x33593e,_0x22ddd3){_0x33593e=_0x33593e-0x0;var _0x53db1a=_0x20df[_0x33593e];return _0x53db1a;};'use strict';var _=require(_0xf20d('0x0'));var util=require(_0xf20d('0x1'));var moment=require(_0xf20d('0x2'));var BPromise=require(_0xf20d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf20d('0x4'));var db=require(_0xf20d('0x5'))['db'];var utils=require(_0xf20d('0x6'));var logger=require(_0xf20d('0x7'))(_0xf20d('0x8'));var config=require('../../config/environment');var jayson=require(_0xf20d('0x9'));var client=jayson['client'][_0xf20d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41d0da,_0x53a7b5,_0x184c8d){return new BPromise(function(_0x5f0353,_0x4f36d1){return client['request'](_0x41d0da,_0x184c8d)[_0xf20d('0xb')](function(_0x22b427){logger[_0xf20d('0xc')](_0xf20d('0xd'),_0x53a7b5,'request\x20sent');logger[_0xf20d('0xe')](_0xf20d('0xf'),_0x53a7b5,_0xf20d('0x10'),JSON[_0xf20d('0x11')](_0x22b427));if(_0x22b427[_0xf20d('0x12')]){if(_0x22b427[_0xf20d('0x12')][_0xf20d('0x13')]===0x1f4){logger[_0xf20d('0x12')]('VtigerField,\x20%s,\x20%s',_0x53a7b5,_0x22b427[_0xf20d('0x12')]['message']);return _0x4f36d1(_0x22b427[_0xf20d('0x12')][_0xf20d('0x14')]);}logger['error'](_0xf20d('0xd'),_0x53a7b5,_0x22b427[_0xf20d('0x12')][_0xf20d('0x14')]);return _0x5f0353(_0x22b427[_0xf20d('0x12')][_0xf20d('0x14')]);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x53a7b5,_0xf20d('0x10'));_0x5f0353(_0x22b427[_0xf20d('0x15')][_0xf20d('0x14')]);}})[_0xf20d('0x16')](function(_0x53c164){logger[_0xf20d('0x12')]('VtigerField,\x20%s,\x20%s',_0x53a7b5,_0x53c164);_0x4f36d1(_0x53c164);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index ed8bed9..6ecbd51 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 _0xc44d=['/:id/fields','getFields','create','post','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated','get','/:id/configurations','getConfigurations'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc44d,0xc6));var _0xdc44=function(_0x1ba06b,_0x58a0d3){_0x1ba06b=_0x1ba06b-0x0;var _0x590a4e=_0xc44d[_0x1ba06b];return _0x590a4e;};'use strict';var multer=require(_0xdc44('0x0'));var util=require('util');var path=require(_0xdc44('0x1'));var timeout=require(_0xdc44('0x2'));var express=require(_0xdc44('0x3'));var router=express['Router']();var auth=require(_0xdc44('0x4'));var interaction=require(_0xdc44('0x5'));var config=require(_0xdc44('0x6'));var controller=require(_0xdc44('0x7'));router['get']('/',auth[_0xdc44('0x8')](),controller['index']);router[_0xdc44('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0xdc44('0xa'),auth['isAuthenticated'](),controller[_0xdc44('0xb')]);router['get'](_0xdc44('0xc'),auth['isAuthenticated'](),controller[_0xdc44('0xd')]);router['post']('/',auth[_0xdc44('0x8')](),controller[_0xdc44('0xe')]);router[_0xdc44('0xf')](_0xdc44('0xa'),auth[_0xdc44('0x8')](),controller['addConfiguration']);router[_0xdc44('0x10')](_0xdc44('0x11'),auth[_0xdc44('0x8')](),controller['update']);router[_0xdc44('0x12')]('/:id',auth[_0xdc44('0x8')](),controller[_0xdc44('0x13')]);module[_0xdc44('0x14')]=router; \ No newline at end of file +var _0x4133=['express','Router','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','addConfiguration','put','destroy','exports','multer','connect-timeout'];(function(_0x41a457,_0x4a8e30){var _0x84b15f=function(_0x11868b){while(--_0x11868b){_0x41a457['push'](_0x41a457['shift']());}};_0x84b15f(++_0x4a8e30);}(_0x4133,0x17a));var _0x3413=function(_0x16ae1a,_0x59beed){_0x16ae1a=_0x16ae1a-0x0;var _0x4e8ba0=_0x4133[_0x16ae1a];return _0x4e8ba0;};'use strict';var multer=require(_0x3413('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3413('0x1'));var express=require(_0x3413('0x2'));var router=express[_0x3413('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3413('0x4'));var config=require(_0x3413('0x5'));var controller=require(_0x3413('0x6'));router[_0x3413('0x7')]('/',auth[_0x3413('0x8')](),controller[_0x3413('0x9')]);router[_0x3413('0x7')](_0x3413('0xa'),auth[_0x3413('0x8')](),controller[_0x3413('0xb')]);router[_0x3413('0x7')](_0x3413('0xc'),auth[_0x3413('0x8')](),controller[_0x3413('0xd')]);router[_0x3413('0x7')](_0x3413('0xe'),auth[_0x3413('0x8')](),controller[_0x3413('0xf')]);router['post']('/',auth[_0x3413('0x8')](),controller['create']);router['post']('/:id/configurations',auth[_0x3413('0x8')](),controller[_0x3413('0x10')]);router[_0x3413('0x11')](_0x3413('0xa'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x3413('0x8')](),controller[_0x3413('0x12')]);module[_0x3413('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 b6450d3..12ab1fe 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 _0x703f=['username','password','token','integrationTab','sequelize','exports','STRING'];(function(_0x580b15,_0x28afa4){var _0x1adb1b=function(_0x47a01f){while(--_0x47a01f){_0x580b15['push'](_0x580b15['shift']());}};_0x1adb1b(++_0x28afa4);}(_0x703f,0x1bd));var _0xf703=function(_0x9122f7,_0x5c3560){_0x9122f7=_0x9122f7-0x0;var _0x58af82=_0x703f[_0x9122f7];return _0x58af82;};'use strict';var Sequelize=require(_0xf703('0x0'));module[_0xf703('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf703('0x2')],'unique':_0xf703('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xf703('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM'](_0xf703('0x4'),_0xf703('0x5')),'defaultValue':_0xf703('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xf703('0x6'),'newTab'),'defaultValue':_0xf703('0x6')}}; \ No newline at end of file +var _0xe190=['sequelize','STRING','username','ENUM','token','password','integrationTab','newTab'];(function(_0x49d280,_0x33d68f){var _0x25274a=function(_0x8ace90){while(--_0x8ace90){_0x49d280['push'](_0x49d280['shift']());}};_0x25274a(++_0x33d68f);}(_0xe190,0x140));var _0x0e19=function(_0x11939a,_0xfde31c){_0x11939a=_0x11939a-0x0;var _0x27ec68=_0xe190[_0x11939a];return _0x27ec68;};'use strict';var Sequelize=require(_0x0e19('0x0'));module['exports']={'name':{'type':Sequelize[_0x0e19('0x1')]},'description':{'type':Sequelize[_0x0e19('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x0e19('0x2')},'password':{'type':Sequelize[_0x0e19('0x1')]},'token':{'type':Sequelize[_0x0e19('0x1')]},'remoteUri':{'type':Sequelize[_0x0e19('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x0e19('0x3')]('password',_0x0e19('0x4')),'defaultValue':_0x0e19('0x5')},'serverUrl':{'type':Sequelize[_0x0e19('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0e19('0x6'),_0x0e19('0x7')),'defaultValue':_0x0e19('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 7a59c49..c278125 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 _0xe58a=['ZendeskConfiguration','ZendeskField','password','remoteUri','slice','substring','lastIndexOf','format','%s/%s','ticket_fields','authType','Basic\x20%s','%s:%s','username','token','headers','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','path','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','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','ZendeskAccount','rawAttributes','type','key','map','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','sort','where','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','params','include','find','create','body','getConfigurations','findOne','filters','order','pick','AccountId','Subjects','getSubjects','channel','Descriptions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe58a,0x9f));var _0xae58=function(_0x479688,_0x3279c1){_0x479688=_0x479688-0x0;var _0x79be1f=_0xe58a[_0x479688];return _0x79be1f;};'use strict';var pdf=require(_0xae58('0x0'));var emlformat=require(_0xae58('0x1'));var rimraf=require(_0xae58('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xae58('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xae58('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xae58('0x5'));var sox=require('sox');var csv=require(_0xae58('0x6'));var ejs=require(_0xae58('0x7'));var fs=require('fs');var _=require(_0xae58('0x8'));var squel=require(_0xae58('0x9'));var crypto=require(_0xae58('0xa'));var jsforce=require(_0xae58('0xb'));var deskjs=require(_0xae58('0xc'));var toCsv=require(_0xae58('0x6'));var querystring=require(_0xae58('0xd'));var Papa=require(_0xae58('0xe'));var Redis=require('ioredis');var authService=require(_0xae58('0xf'));var qs=require(_0xae58('0x10'));var as=require(_0xae58('0x11'));var hardwareService=require(_0xae58('0x12'));var logger=require(_0xae58('0x13'))('api');var utils=require(_0xae58('0x14'));var config=require(_0xae58('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xae58('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xae58('0x17'));var client=jayson[_0xae58('0x18')][_0xae58('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x1f84ec,_0x537715,_0x36ee75,_0x52503a){return new BPromise(function(_0x54f59c,_0x2aca09){var _0x26a637=_0x52503a||client;return _0x26a637[_0xae58('0x1a')](_0x1f84ec,_0x36ee75)[_0xae58('0x1b')](function(_0x4c57b9){logger[_0xae58('0x1c')](_0xae58('0x1d'),_0x537715,_0xae58('0x1e'));logger[_0xae58('0x1f')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x537715,'request\x20sent',JSON[_0xae58('0x20')](_0x4c57b9));if(_0x4c57b9[_0xae58('0x21')]){if(_0x4c57b9[_0xae58('0x21')][_0xae58('0x22')]===0x1f4){logger[_0xae58('0x21')]('ZendeskAccount,\x20%s,\x20%s',_0x537715,_0x4c57b9[_0xae58('0x21')][_0xae58('0x23')]);return _0x2aca09(_0x4c57b9[_0xae58('0x21')][_0xae58('0x23')]);}logger[_0xae58('0x21')](_0xae58('0x1d'),_0x537715,_0x4c57b9[_0xae58('0x21')][_0xae58('0x23')]);return _0x54f59c(_0x4c57b9[_0xae58('0x21')]['message']);}else{logger['info'](_0xae58('0x1d'),_0x537715,'request\x20sent');_0x54f59c(_0x4c57b9[_0xae58('0x24')]['message']);}})[_0xae58('0x25')](function(_0x2a1e1a){logger[_0xae58('0x21')](_0xae58('0x1d'),_0x537715,_0x2a1e1a);_0x2aca09(_0x2a1e1a);});});}function respondWithStatusCode(_0x41d2f2,_0x569f07){_0x569f07=_0x569f07||0xcc;return function(_0xb6b66b){if(_0xb6b66b){return _0x41d2f2[_0xae58('0x26')](_0x569f07);}return _0x41d2f2[_0xae58('0x27')](_0x569f07)[_0xae58('0x28')]();};}function respondWithResult(_0x557b6e,_0x2fdc7a){_0x2fdc7a=_0x2fdc7a||0xc8;return function(_0x567c8b){if(_0x567c8b){return _0x557b6e['status'](_0x2fdc7a)[_0xae58('0x29')](_0x567c8b);}};}function respondWithFilteredResult(_0x4e5bd5,_0x2c3876){return function(_0x51ceba){if(_0x51ceba){var _0x2d4a4d=_0x51ceba['count'],_0x39443e=_0x2c3876['offset'],_0x4474e8=_0x2c3876['offset']+_0x2c3876[_0xae58('0x2a')],_0x54c4ed;if(_0x4474e8>=_0x2d4a4d){_0x4474e8=_0x2d4a4d;_0x54c4ed=0xc8;}else{_0x54c4ed=0xce;}_0x4e5bd5['status'](_0x54c4ed);return _0x4e5bd5['set'](_0xae58('0x2b'),_0x39443e+'-'+_0x4474e8+'/'+_0x2d4a4d)[_0xae58('0x29')](_0x51ceba);}return null;};}function patchUpdates(_0xa1dcfe){return function(_0xcd1d7c){try{jsonpatch[_0xae58('0x2c')](_0xcd1d7c,_0xa1dcfe,!![]);}catch(_0x5eaea4){return BPromise[_0xae58('0x2d')](_0x5eaea4);}return _0xcd1d7c[_0xae58('0x2e')]();};}function saveUpdates(_0x2d1c86,_0x373df1){return function(_0x2ba351){if(_0x2ba351){return _0x2ba351[_0xae58('0x2f')](_0x2d1c86)[_0xae58('0x1b')](function(_0x42b252){return _0x42b252;});}return null;};}function removeEntity(_0x3c6a21,_0x296e46){return function(_0x2e67f5){if(_0x2e67f5){return _0x2e67f5[_0xae58('0x30')]()['then'](function(){_0x3c6a21[_0xae58('0x27')](0xcc)[_0xae58('0x28')]();});}};}function handleEntityNotFound(_0xdc554e,_0x21ab4d){return function(_0x16a1fd){if(!_0x16a1fd){_0xdc554e['sendStatus'](0x194);}return _0x16a1fd;};}function handleError(_0x3a49b6,_0x2160d2){_0x2160d2=_0x2160d2||0x1f4;return function(_0x59278e){logger[_0xae58('0x21')](_0x59278e[_0xae58('0x31')]);if(_0x59278e[_0xae58('0x32')]){delete _0x59278e[_0xae58('0x32')];}_0x3a49b6['status'](_0x2160d2)[_0xae58('0x33')](_0x59278e);};}exports['index']=function(_0xd5332b,_0xce2880){var _0x9b1f83={},_0x324158={},_0x487308={'count':0x0,'rows':[]};var _0x13c558=_['map'](db[_0xae58('0x34')][_0xae58('0x35')],function(_0x4c37ea){return{'name':_0x4c37ea['fieldName'],'type':_0x4c37ea[_0xae58('0x36')][_0xae58('0x37')]};});_0x324158['model']=_[_0xae58('0x38')](_0x13c558,_0xae58('0x32'));_0x324158[_0xae58('0x39')]=_[_0xae58('0x3a')](_0xd5332b[_0xae58('0x39')]);_0x324158['filters']=_[_0xae58('0x3b')](_0x324158['model'],_0x324158[_0xae58('0x39')]);_0x9b1f83[_0xae58('0x3c')]=_[_0xae58('0x3b')](_0x324158[_0xae58('0x3d')],qs[_0xae58('0x3e')](_0xd5332b[_0xae58('0x39')][_0xae58('0x3e')]));_0x9b1f83[_0xae58('0x3c')]=_0x9b1f83[_0xae58('0x3c')][_0xae58('0x3f')]?_0x9b1f83[_0xae58('0x3c')]:_0x324158[_0xae58('0x3d')];if(!_0xd5332b[_0xae58('0x39')][_0xae58('0x40')](_0xae58('0x41'))){_0x9b1f83[_0xae58('0x2a')]=qs[_0xae58('0x2a')](_0xd5332b[_0xae58('0x39')]['limit']);_0x9b1f83[_0xae58('0x42')]=qs['offset'](_0xd5332b[_0xae58('0x39')][_0xae58('0x42')]);}_0x9b1f83['order']=qs[_0xae58('0x43')](_0xd5332b[_0xae58('0x39')][_0xae58('0x43')]);_0x9b1f83[_0xae58('0x44')]=qs['filters'](_['pick'](_0xd5332b['query'],_0x324158['filters']),_0x13c558);if(_0xd5332b[_0xae58('0x39')][_0xae58('0x45')]){_0x9b1f83['where']=_[_0xae58('0x46')](_0x9b1f83['where'],{'$or':_[_0xae58('0x38')](_0x13c558,function(_0x95ffa7){if(_0x95ffa7[_0xae58('0x36')]!==_0xae58('0x47')){var _0x526162={};_0x526162[_0x95ffa7['name']]={'$like':'%'+_0xd5332b[_0xae58('0x39')]['filter']+'%'};return _0x526162;}})});}_0x9b1f83=_[_0xae58('0x46')]({},_0x9b1f83,_0xd5332b[_0xae58('0x48')]);var _0x4b93cd={'where':_0x9b1f83[_0xae58('0x44')]};return db[_0xae58('0x34')][_0xae58('0x49')](_0x4b93cd)[_0xae58('0x1b')](function(_0x23dd7d){_0x487308[_0xae58('0x49')]=_0x23dd7d;if(_0xd5332b[_0xae58('0x39')][_0xae58('0x4a')]){_0x9b1f83['include']=[{'all':!![]}];}return db[_0xae58('0x34')][_0xae58('0x4b')](_0x9b1f83);})[_0xae58('0x1b')](function(_0xb319b4){_0x487308[_0xae58('0x4c')]=_0xb319b4;return _0x487308;})[_0xae58('0x1b')](respondWithFilteredResult(_0xce2880,_0x9b1f83))[_0xae58('0x25')](handleError(_0xce2880,null));};exports[_0xae58('0x4d')]=function(_0x3a44e1,_0x368ad0){var _0x467dcf={'raw':![],'where':{'id':_0x3a44e1[_0xae58('0x4e')]['id']}},_0x20b030={};_0x20b030[_0xae58('0x3d')]=_[_0xae58('0x3a')](db['ZendeskAccount'][_0xae58('0x35')]);_0x20b030['query']=_[_0xae58('0x3a')](_0x3a44e1['query']);_0x20b030['filters']=_['intersection'](_0x20b030[_0xae58('0x3d')],_0x20b030[_0xae58('0x39')]);_0x467dcf['attributes']=_['intersection'](_0x20b030['model'],qs[_0xae58('0x3e')](_0x3a44e1[_0xae58('0x39')][_0xae58('0x3e')]));_0x467dcf[_0xae58('0x3c')]=_0x467dcf['attributes'][_0xae58('0x3f')]?_0x467dcf[_0xae58('0x3c')]:_0x20b030[_0xae58('0x3d')];if(_0x3a44e1[_0xae58('0x39')][_0xae58('0x4a')]){_0x467dcf[_0xae58('0x4f')]=[{'all':!![]}];}_0x467dcf=_[_0xae58('0x46')]({},_0x467dcf,_0x3a44e1[_0xae58('0x48')]);return db[_0xae58('0x34')][_0xae58('0x50')](_0x467dcf)[_0xae58('0x1b')](handleEntityNotFound(_0x368ad0,null))['then'](respondWithResult(_0x368ad0,null))[_0xae58('0x25')](handleError(_0x368ad0,null));};exports[_0xae58('0x51')]=function(_0x346089,_0x1c4baa){return db[_0xae58('0x34')][_0xae58('0x51')](_0x346089['body'],{})['then'](respondWithResult(_0x1c4baa,0xc9))[_0xae58('0x25')](handleError(_0x1c4baa,null));};exports[_0xae58('0x2f')]=function(_0x48e51a,_0x4fcc4f){if(_0x48e51a[_0xae58('0x52')]['id']){delete _0x48e51a['body']['id'];}return db[_0xae58('0x34')][_0xae58('0x50')]({'where':{'id':_0x48e51a['params']['id']}})[_0xae58('0x1b')](handleEntityNotFound(_0x4fcc4f,null))['then'](saveUpdates(_0x48e51a[_0xae58('0x52')],null))['then'](respondWithResult(_0x4fcc4f,null))[_0xae58('0x25')](handleError(_0x4fcc4f,null));};exports['destroy']=function(_0x1c89f8,_0xf2dbbe){return db[_0xae58('0x34')][_0xae58('0x50')]({'where':{'id':_0x1c89f8['params']['id']}})['then'](handleEntityNotFound(_0xf2dbbe,null))[_0xae58('0x1b')](removeEntity(_0xf2dbbe,null))[_0xae58('0x25')](handleError(_0xf2dbbe,null));};exports[_0xae58('0x53')]=function(_0x4f8e9c,_0x2feeaa,_0x166031){var _0x435887={};var _0x36f1ec={};var _0x24e9de;var _0x31d989;return db[_0xae58('0x34')][_0xae58('0x54')]({'where':{'id':_0x4f8e9c[_0xae58('0x4e')]['id']}})[_0xae58('0x1b')](handleEntityNotFound(_0x2feeaa,null))[_0xae58('0x1b')](function(_0xdee514){if(_0xdee514){_0x24e9de=_0xdee514;_0x36f1ec[_0xae58('0x3d')]=_[_0xae58('0x3a')](db['ZendeskConfiguration']['rawAttributes']);_0x36f1ec[_0xae58('0x39')]=_[_0xae58('0x3a')](_0x4f8e9c[_0xae58('0x39')]);_0x36f1ec[_0xae58('0x55')]=_['intersection'](_0x36f1ec[_0xae58('0x3d')],_0x36f1ec[_0xae58('0x39')]);_0x435887[_0xae58('0x3c')]=_[_0xae58('0x3b')](_0x36f1ec[_0xae58('0x3d')],qs[_0xae58('0x3e')](_0x4f8e9c[_0xae58('0x39')][_0xae58('0x3e')]));_0x435887[_0xae58('0x3c')]=_0x435887[_0xae58('0x3c')]['length']?_0x435887['attributes']:_0x36f1ec[_0xae58('0x3d')];_0x435887[_0xae58('0x56')]=qs[_0xae58('0x43')](_0x4f8e9c[_0xae58('0x39')][_0xae58('0x43')]);_0x435887[_0xae58('0x44')]=qs['filters'](_[_0xae58('0x57')](_0x4f8e9c[_0xae58('0x39')],_0x36f1ec[_0xae58('0x55')]));if(_0x4f8e9c[_0xae58('0x39')][_0xae58('0x45')]){_0x435887['where']=_[_0xae58('0x46')](_0x435887[_0xae58('0x44')],{'$or':_[_0xae58('0x38')](_0x435887[_0xae58('0x3c')],function(_0x4fb630){var _0x3261f6={};_0x3261f6[_0x4fb630]={'$like':'%'+_0x4f8e9c[_0xae58('0x39')]['filter']+'%'};return _0x3261f6;})});}_0x435887=_[_0xae58('0x46')]({},_0x435887,_0x4f8e9c['options']);return _0x24e9de[_0xae58('0x53')](_0x435887);}})[_0xae58('0x1b')](function(_0x33170e){if(_0x33170e){_0x31d989=_0x33170e[_0xae58('0x3f')];if(!_0x4f8e9c[_0xae58('0x39')][_0xae58('0x40')](_0xae58('0x41'))){_0x435887[_0xae58('0x2a')]=qs[_0xae58('0x2a')](_0x4f8e9c[_0xae58('0x39')]['limit']);_0x435887['offset']=qs[_0xae58('0x42')](_0x4f8e9c[_0xae58('0x39')][_0xae58('0x42')]);}return _0x24e9de['getConfigurations'](_0x435887);}})[_0xae58('0x1b')](function(_0x58887c){if(_0x58887c){return _0x58887c?{'count':_0x31d989,'rows':_0x58887c}:null;}})[_0xae58('0x1b')](respondWithResult(_0x2feeaa,null))[_0xae58('0x25')](handleError(_0x2feeaa,null));};exports['addConfiguration']=function(_0x5b8b3c,_0x56ba72,_0x1dc5cf){if(_0x5b8b3c[_0xae58('0x52')]['id']){delete _0x5b8b3c[_0xae58('0x52')]['id'];}return db[_0xae58('0x34')][_0xae58('0x54')]({'where':{'id':_0x5b8b3c[_0xae58('0x4e')]['id']}})[_0xae58('0x1b')](handleEntityNotFound(_0x56ba72,null))['then'](function(_0x3731fa){if(_0x3731fa){_0x5b8b3c[_0xae58('0x52')][_0xae58('0x58')]=_0x3731fa['id'];_0x5b8b3c[_0xae58('0x52')][_0xae58('0x59')]=integrations[_0xae58('0x5a')](_0x5b8b3c[_0xae58('0x52')][_0xae58('0x5b')],_0x5b8b3c[_0xae58('0x52')][_0xae58('0x36')]);_0x5b8b3c[_0xae58('0x52')][_0xae58('0x5c')]=integrations['getDescriptions'](_0x5b8b3c[_0xae58('0x52')]['channel'],_0x5b8b3c['body'][_0xae58('0x36')]);return db[_0xae58('0x5d')]['create'](_0x5b8b3c['body'],{'include':[{'model':db[_0xae58('0x5e')],'as':'Subjects'},{'model':db[_0xae58('0x5e')],'as':_0xae58('0x5c')}]});}return null;})[_0xae58('0x1b')](respondWithResult(_0x56ba72,null))[_0xae58('0x25')](handleError(_0x56ba72,null));};exports['getFields']=function(_0x5427b8,_0xec36cd,_0x4f4156){var _0x2d1be1='';return db[_0xae58('0x34')][_0xae58('0x54')]({'where':{'id':_0x5427b8[_0xae58('0x4e')]['id']},'attributes':['id','username',_0xae58('0x5f'),'token','authType',_0xae58('0x60')]})['then'](handleEntityNotFound(_0xec36cd,null))['then'](function(_0x11b204){if(_0x11b204){_0x2d1be1=_0x11b204[_0xae58('0x60')];var _0x285fb6=_0x2d1be1[_0xae58('0x61')](-0x1);if(_0x285fb6==='/'){_0x2d1be1=_0x2d1be1[_0xae58('0x62')](0x0,_0x2d1be1[_0xae58('0x63')](_0x285fb6));}var _0x1bb22a={'method':'GET','uri':util[_0xae58('0x64')](_0xae58('0x65'),_0x2d1be1,_0xae58('0x66')),'json':!![]};switch(_0x11b204[_0xae58('0x67')]){case _0xae58('0x5f'):_0x1bb22a['headers']={'Authorization':util[_0xae58('0x64')](_0xae58('0x68'),new Buffer(util[_0xae58('0x64')](_0xae58('0x69'),_0x11b204[_0xae58('0x6a')],_0x11b204[_0xae58('0x5f')]))['toString']('base64'))};break;case _0xae58('0x6b'):_0x1bb22a[_0xae58('0x6c')]={'Authorization':util[_0xae58('0x64')](_0xae58('0x68'),new Buffer(util[_0xae58('0x64')](_0xae58('0x6d'),_0x11b204[_0xae58('0x6a')],_0x11b204[_0xae58('0x6b')]))['toString']('base64'))};break;default:throw new db[(_0xae58('0x6e'))][(_0xae58('0x6f'))](_0xae58('0x70'));}return rp(_0x1bb22a);}})[_0xae58('0x1b')](function(_0x37d5d8){if(_0x37d5d8){var _0x3a28df=[_0xae58('0x71'),'description',_0xae58('0x72'),_0xae58('0x73')];_[_0xae58('0x74')](_0x37d5d8[_0xae58('0x66')],function(_0x4712ef){return _0x3a28df[_0xae58('0x75')](_0x4712ef[_0xae58('0x36')]);});return{'count':_0x37d5d8[_0xae58('0x66')]['length'],'rows':_[_0xae58('0x38')](_0x37d5d8[_0xae58('0x66')],function(_0x2bce32){return{'id':_0x2bce32['id'],'name':_0x2bce32[_0xae58('0x76')]>0x7?_0x2bce32[_0xae58('0x77')]:_0x2bce32[_0xae58('0x36')],'custom':_0x2bce32[_0xae58('0x76')]>0x7?!![]:![],'options':_0x2bce32['system_field_options']?_0x2bce32[_0xae58('0x78')]:_0x2bce32[_0xae58('0x79')]?_0x2bce32[_0xae58('0x79')]:[]};})};}})[_0xae58('0x1b')](respondWithResult(_0xec36cd,null))[_0xae58('0x25')](function(_0x4dbc3f){var _0xd9ac0a=_0x5427b8[_0xae58('0x39')][_0xae58('0x7a')]?0x1f4:_0x4dbc3f[_0xae58('0x7b')]||0x1f4;logger[_0xae58('0x21')](_0xae58('0x7c'),'getFields',_0xd9ac0a,JSON['stringify'](_0x4dbc3f));delete _0x4dbc3f[_0xae58('0x32')];if(_0xd9ac0a===0x191){_0xd9ac0a=0x190;}_0xec36cd[_0xae58('0x27')](_0xd9ac0a)[_0xae58('0x33')](_0x5427b8[_0xae58('0x39')][_0xae58('0x7a')]?{'message':_0xae58('0x7d'),'statusCode':_0x4dbc3f[_0xae58('0x7b')]}:_0x4dbc3f);});}; \ No newline at end of file +var _0x5397=['remove','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','ZendeskAccount','fieldName','key','model','map','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','show','params','rawAttributes','keys','include','create','body','find','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','authType','slice','substring','lastIndexOf','%s/%s','ticket_fields','headers','format','Basic\x20%s','%s:%s','toString','token','%s/token:%s','base64','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee'];(function(_0x5c2cc6,_0x334fe0){var _0x5062ca=function(_0x267533){while(--_0x267533){_0x5c2cc6['push'](_0x5c2cc6['shift']());}};_0x5062ca(++_0x334fe0);}(_0x5397,0x105));var _0x7539=function(_0x896aff,_0x26c219){_0x896aff=_0x896aff-0x0;var _0x287aa4=_0x5397[_0x896aff];return _0x287aa4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7539('0x0'));var rimraf=require(_0x7539('0x1'));var zipdir=require(_0x7539('0x2'));var jsonpatch=require(_0x7539('0x3'));var rp=require(_0x7539('0x4'));var moment=require(_0x7539('0x5'));var BPromise=require(_0x7539('0x6'));var Mustache=require(_0x7539('0x7'));var util=require(_0x7539('0x8'));var path=require('path');var sox=require(_0x7539('0x9'));var csv=require(_0x7539('0xa'));var ejs=require(_0x7539('0xb'));var fs=require('fs');var _=require(_0x7539('0xc'));var squel=require(_0x7539('0xd'));var crypto=require('crypto');var jsforce=require(_0x7539('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7539('0xa'));var querystring=require(_0x7539('0xf'));var Papa=require(_0x7539('0x10'));var Redis=require(_0x7539('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7539('0x12'));var hardwareService=require(_0x7539('0x13'));var logger=require(_0x7539('0x14'))(_0x7539('0x15'));var utils=require(_0x7539('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7539('0x17'));var db=require(_0x7539('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x7539('0x19'));var client=jayson[_0x7539('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35ba19,_0x37cfbf,_0x551f43,_0x131d5e){return new BPromise(function(_0x193e1a,_0x3c97ff){var _0x21f741=_0x131d5e||client;return _0x21f741[_0x7539('0x1b')](_0x35ba19,_0x551f43)['then'](function(_0x2ca9cf){logger[_0x7539('0x1c')](_0x7539('0x1d'),_0x37cfbf,_0x7539('0x1e'));logger['debug'](_0x7539('0x1f'),_0x37cfbf,_0x7539('0x1e'),JSON[_0x7539('0x20')](_0x2ca9cf));if(_0x2ca9cf[_0x7539('0x21')]){if(_0x2ca9cf[_0x7539('0x21')][_0x7539('0x22')]===0x1f4){logger[_0x7539('0x21')](_0x7539('0x1d'),_0x37cfbf,_0x2ca9cf['error'][_0x7539('0x23')]);return _0x3c97ff(_0x2ca9cf[_0x7539('0x21')]['message']);}logger[_0x7539('0x21')](_0x7539('0x1d'),_0x37cfbf,_0x2ca9cf[_0x7539('0x21')][_0x7539('0x23')]);return _0x193e1a(_0x2ca9cf[_0x7539('0x21')][_0x7539('0x23')]);}else{logger[_0x7539('0x1c')](_0x7539('0x1d'),_0x37cfbf,_0x7539('0x1e'));_0x193e1a(_0x2ca9cf[_0x7539('0x24')][_0x7539('0x23')]);}})[_0x7539('0x25')](function(_0x12d5fc){logger[_0x7539('0x21')](_0x7539('0x1d'),_0x37cfbf,_0x12d5fc);_0x3c97ff(_0x12d5fc);});});}function respondWithStatusCode(_0x25127c,_0x2c70f7){_0x2c70f7=_0x2c70f7||0xcc;return function(_0x30a9e4){if(_0x30a9e4){return _0x25127c['sendStatus'](_0x2c70f7);}return _0x25127c[_0x7539('0x26')](_0x2c70f7)[_0x7539('0x27')]();};}function respondWithResult(_0x3c31ba,_0x253de0){_0x253de0=_0x253de0||0xc8;return function(_0x4b1d60){if(_0x4b1d60){return _0x3c31ba[_0x7539('0x26')](_0x253de0)[_0x7539('0x28')](_0x4b1d60);}};}function respondWithFilteredResult(_0x50cb37,_0x1bb019){return function(_0x1c0c07){if(_0x1c0c07){var _0x2b4357=_0x1c0c07[_0x7539('0x29')],_0x39502a=_0x1bb019['offset'],_0x41abd6=_0x1bb019[_0x7539('0x2a')]+_0x1bb019[_0x7539('0x2b')],_0x7d28dd;if(_0x41abd6>=_0x2b4357){_0x41abd6=_0x2b4357;_0x7d28dd=0xc8;}else{_0x7d28dd=0xce;}_0x50cb37[_0x7539('0x26')](_0x7d28dd);return _0x50cb37['set'](_0x7539('0x2c'),_0x39502a+'-'+_0x41abd6+'/'+_0x2b4357)[_0x7539('0x28')](_0x1c0c07);}return null;};}function patchUpdates(_0x52e905){return function(_0x1e9963){try{jsonpatch[_0x7539('0x2d')](_0x1e9963,_0x52e905,!![]);}catch(_0x4642a5){return BPromise[_0x7539('0x2e')](_0x4642a5);}return _0x1e9963[_0x7539('0x2f')]();};}function saveUpdates(_0x107c8c,_0x41056e){return function(_0x3d765e){if(_0x3d765e){return _0x3d765e[_0x7539('0x30')](_0x107c8c)[_0x7539('0x31')](function(_0x228b48){return _0x228b48;});}return null;};}function removeEntity(_0x9d2bad,_0x498c01){return function(_0x3eac22){if(_0x3eac22){return _0x3eac22[_0x7539('0x32')]()[_0x7539('0x31')](function(){_0x9d2bad['status'](0xcc)[_0x7539('0x27')]();});}};}function handleEntityNotFound(_0x5b9636,_0x12a662){return function(_0x5cbb86){if(!_0x5cbb86){_0x5b9636[_0x7539('0x33')](0x194);}return _0x5cbb86;};}function handleError(_0x2b1f3e,_0x27bf2d){_0x27bf2d=_0x27bf2d||0x1f4;return function(_0xbeb4ec){logger[_0x7539('0x21')](_0xbeb4ec[_0x7539('0x34')]);if(_0xbeb4ec[_0x7539('0x35')]){delete _0xbeb4ec[_0x7539('0x35')];}_0x2b1f3e[_0x7539('0x26')](_0x27bf2d)[_0x7539('0x36')](_0xbeb4ec);};}exports['index']=function(_0x2d2491,_0x2b7634){var _0x382688={},_0x2ad294={},_0xbd2c69={'count':0x0,'rows':[]};var _0x3ce3fe=_['map'](db[_0x7539('0x37')]['rawAttributes'],function(_0x3e1e1e){return{'name':_0x3e1e1e[_0x7539('0x38')],'type':_0x3e1e1e['type'][_0x7539('0x39')]};});_0x2ad294[_0x7539('0x3a')]=_[_0x7539('0x3b')](_0x3ce3fe,_0x7539('0x35'));_0x2ad294[_0x7539('0x3c')]=_['keys'](_0x2d2491[_0x7539('0x3c')]);_0x2ad294[_0x7539('0x3d')]=_[_0x7539('0x3e')](_0x2ad294[_0x7539('0x3a')],_0x2ad294[_0x7539('0x3c')]);_0x382688['attributes']=_[_0x7539('0x3e')](_0x2ad294[_0x7539('0x3a')],qs[_0x7539('0x3f')](_0x2d2491[_0x7539('0x3c')]['fields']));_0x382688['attributes']=_0x382688['attributes'][_0x7539('0x40')]?_0x382688[_0x7539('0x41')]:_0x2ad294[_0x7539('0x3a')];if(!_0x2d2491[_0x7539('0x3c')][_0x7539('0x42')](_0x7539('0x43'))){_0x382688['limit']=qs[_0x7539('0x2b')](_0x2d2491[_0x7539('0x3c')][_0x7539('0x2b')]);_0x382688[_0x7539('0x2a')]=qs['offset'](_0x2d2491[_0x7539('0x3c')][_0x7539('0x2a')]);}_0x382688[_0x7539('0x44')]=qs[_0x7539('0x45')](_0x2d2491[_0x7539('0x3c')][_0x7539('0x45')]);_0x382688[_0x7539('0x46')]=qs[_0x7539('0x3d')](_[_0x7539('0x47')](_0x2d2491[_0x7539('0x3c')],_0x2ad294[_0x7539('0x3d')]),_0x3ce3fe);if(_0x2d2491['query'][_0x7539('0x48')]){_0x382688[_0x7539('0x46')]=_['merge'](_0x382688['where'],{'$or':_[_0x7539('0x3b')](_0x3ce3fe,function(_0x315461){if(_0x315461[_0x7539('0x49')]!==_0x7539('0x4a')){var _0x45925b={};_0x45925b[_0x315461['name']]={'$like':'%'+_0x2d2491[_0x7539('0x3c')]['filter']+'%'};return _0x45925b;}})});}_0x382688=_[_0x7539('0x4b')]({},_0x382688,_0x2d2491[_0x7539('0x4c')]);var _0x41cd34={'where':_0x382688[_0x7539('0x46')]};return db[_0x7539('0x37')]['count'](_0x41cd34)[_0x7539('0x31')](function(_0x3eabd9){_0xbd2c69[_0x7539('0x29')]=_0x3eabd9;if(_0x2d2491['query'][_0x7539('0x4d')]){_0x382688['include']=[{'all':!![]}];}return db[_0x7539('0x37')]['findAll'](_0x382688);})[_0x7539('0x31')](function(_0x37d5ba){_0xbd2c69['rows']=_0x37d5ba;return _0xbd2c69;})[_0x7539('0x31')](respondWithFilteredResult(_0x2b7634,_0x382688))[_0x7539('0x25')](handleError(_0x2b7634,null));};exports[_0x7539('0x4e')]=function(_0x17db57,_0x53c727){var _0x26306d={'raw':![],'where':{'id':_0x17db57[_0x7539('0x4f')]['id']}},_0xedc3da={};_0xedc3da['model']=_['keys'](db[_0x7539('0x37')][_0x7539('0x50')]);_0xedc3da[_0x7539('0x3c')]=_[_0x7539('0x51')](_0x17db57[_0x7539('0x3c')]);_0xedc3da[_0x7539('0x3d')]=_[_0x7539('0x3e')](_0xedc3da[_0x7539('0x3a')],_0xedc3da[_0x7539('0x3c')]);_0x26306d['attributes']=_[_0x7539('0x3e')](_0xedc3da['model'],qs[_0x7539('0x3f')](_0x17db57[_0x7539('0x3c')]['fields']));_0x26306d[_0x7539('0x41')]=_0x26306d['attributes'][_0x7539('0x40')]?_0x26306d[_0x7539('0x41')]:_0xedc3da['model'];if(_0x17db57[_0x7539('0x3c')][_0x7539('0x4d')]){_0x26306d[_0x7539('0x52')]=[{'all':!![]}];}_0x26306d=_[_0x7539('0x4b')]({},_0x26306d,_0x17db57[_0x7539('0x4c')]);return db[_0x7539('0x37')]['find'](_0x26306d)[_0x7539('0x31')](handleEntityNotFound(_0x53c727,null))['then'](respondWithResult(_0x53c727,null))[_0x7539('0x25')](handleError(_0x53c727,null));};exports['create']=function(_0x1b327b,_0xb9f529){return db[_0x7539('0x37')][_0x7539('0x53')](_0x1b327b['body'],{})['then'](respondWithResult(_0xb9f529,0xc9))[_0x7539('0x25')](handleError(_0xb9f529,null));};exports[_0x7539('0x30')]=function(_0x1294d4,_0x230aed){if(_0x1294d4['body']['id']){delete _0x1294d4[_0x7539('0x54')]['id'];}return db[_0x7539('0x37')][_0x7539('0x55')]({'where':{'id':_0x1294d4[_0x7539('0x4f')]['id']}})[_0x7539('0x31')](handleEntityNotFound(_0x230aed,null))[_0x7539('0x31')](saveUpdates(_0x1294d4[_0x7539('0x54')],null))[_0x7539('0x31')](respondWithResult(_0x230aed,null))['catch'](handleError(_0x230aed,null));};exports[_0x7539('0x32')]=function(_0x2dd2d1,_0x5827dd){return db[_0x7539('0x37')][_0x7539('0x55')]({'where':{'id':_0x2dd2d1[_0x7539('0x4f')]['id']}})[_0x7539('0x31')](handleEntityNotFound(_0x5827dd,null))[_0x7539('0x31')](removeEntity(_0x5827dd,null))[_0x7539('0x25')](handleError(_0x5827dd,null));};exports[_0x7539('0x56')]=function(_0x41d56b,_0xcf8ecc,_0x2a4bc7){var _0x2a216a={};var _0x1607c2={};var _0x42cc4f;var _0xe70420;return db[_0x7539('0x37')][_0x7539('0x57')]({'where':{'id':_0x41d56b[_0x7539('0x4f')]['id']}})['then'](handleEntityNotFound(_0xcf8ecc,null))[_0x7539('0x31')](function(_0x581bff){if(_0x581bff){_0x42cc4f=_0x581bff;_0x1607c2['model']=_[_0x7539('0x51')](db[_0x7539('0x58')]['rawAttributes']);_0x1607c2[_0x7539('0x3c')]=_['keys'](_0x41d56b[_0x7539('0x3c')]);_0x1607c2[_0x7539('0x3d')]=_[_0x7539('0x3e')](_0x1607c2[_0x7539('0x3a')],_0x1607c2[_0x7539('0x3c')]);_0x2a216a[_0x7539('0x41')]=_['intersection'](_0x1607c2['model'],qs['fields'](_0x41d56b['query'][_0x7539('0x3f')]));_0x2a216a[_0x7539('0x41')]=_0x2a216a[_0x7539('0x41')][_0x7539('0x40')]?_0x2a216a[_0x7539('0x41')]:_0x1607c2['model'];_0x2a216a[_0x7539('0x44')]=qs[_0x7539('0x45')](_0x41d56b[_0x7539('0x3c')][_0x7539('0x45')]);_0x2a216a[_0x7539('0x46')]=qs[_0x7539('0x3d')](_[_0x7539('0x47')](_0x41d56b[_0x7539('0x3c')],_0x1607c2['filters']));if(_0x41d56b['query'][_0x7539('0x48')]){_0x2a216a[_0x7539('0x46')]=_['merge'](_0x2a216a[_0x7539('0x46')],{'$or':_[_0x7539('0x3b')](_0x2a216a[_0x7539('0x41')],function(_0x4fc710){var _0x38a93f={};_0x38a93f[_0x4fc710]={'$like':'%'+_0x41d56b['query'][_0x7539('0x48')]+'%'};return _0x38a93f;})});}_0x2a216a=_[_0x7539('0x4b')]({},_0x2a216a,_0x41d56b[_0x7539('0x4c')]);return _0x42cc4f[_0x7539('0x56')](_0x2a216a);}})['then'](function(_0x9bcbfb){if(_0x9bcbfb){_0xe70420=_0x9bcbfb[_0x7539('0x40')];if(!_0x41d56b[_0x7539('0x3c')][_0x7539('0x42')]('nolimit')){_0x2a216a[_0x7539('0x2b')]=qs['limit'](_0x41d56b[_0x7539('0x3c')]['limit']);_0x2a216a[_0x7539('0x2a')]=qs[_0x7539('0x2a')](_0x41d56b[_0x7539('0x3c')][_0x7539('0x2a')]);}return _0x42cc4f[_0x7539('0x56')](_0x2a216a);}})[_0x7539('0x31')](function(_0x468dc0){if(_0x468dc0){return _0x468dc0?{'count':_0xe70420,'rows':_0x468dc0}:null;}})[_0x7539('0x31')](respondWithResult(_0xcf8ecc,null))[_0x7539('0x25')](handleError(_0xcf8ecc,null));};exports[_0x7539('0x59')]=function(_0x3bd82e,_0x3cf05e,_0x1e7ee9){if(_0x3bd82e[_0x7539('0x54')]['id']){delete _0x3bd82e[_0x7539('0x54')]['id'];}return db[_0x7539('0x37')][_0x7539('0x57')]({'where':{'id':_0x3bd82e[_0x7539('0x4f')]['id']}})[_0x7539('0x31')](handleEntityNotFound(_0x3cf05e,null))[_0x7539('0x31')](function(_0x3e9e6b){if(_0x3e9e6b){_0x3bd82e[_0x7539('0x54')][_0x7539('0x5a')]=_0x3e9e6b['id'];_0x3bd82e[_0x7539('0x54')][_0x7539('0x5b')]=integrations[_0x7539('0x5c')](_0x3bd82e[_0x7539('0x54')][_0x7539('0x5d')],_0x3bd82e[_0x7539('0x54')]['type']);_0x3bd82e[_0x7539('0x54')][_0x7539('0x5e')]=integrations[_0x7539('0x5f')](_0x3bd82e['body'][_0x7539('0x5d')],_0x3bd82e['body'][_0x7539('0x49')]);return db[_0x7539('0x58')]['create'](_0x3bd82e[_0x7539('0x54')],{'include':[{'model':db[_0x7539('0x60')],'as':_0x7539('0x5b')},{'model':db[_0x7539('0x60')],'as':_0x7539('0x5e')}]});}return null;})['then'](respondWithResult(_0x3cf05e,null))[_0x7539('0x25')](handleError(_0x3cf05e,null));};exports[_0x7539('0x61')]=function(_0x266d93,_0x5802c3,_0x1e94ba){var _0x2ce938='';return db[_0x7539('0x37')]['findOne']({'where':{'id':_0x266d93[_0x7539('0x4f')]['id']},'attributes':['id',_0x7539('0x62'),_0x7539('0x63'),'token',_0x7539('0x64'),'remoteUri']})['then'](handleEntityNotFound(_0x5802c3,null))[_0x7539('0x31')](function(_0x1fc3dc){if(_0x1fc3dc){_0x2ce938=_0x1fc3dc['remoteUri'];var _0x5be58b=_0x2ce938[_0x7539('0x65')](-0x1);if(_0x5be58b==='/'){_0x2ce938=_0x2ce938[_0x7539('0x66')](0x0,_0x2ce938[_0x7539('0x67')](_0x5be58b));}var _0x3e9137={'method':'GET','uri':util['format'](_0x7539('0x68'),_0x2ce938,_0x7539('0x69')),'json':!![]};switch(_0x1fc3dc[_0x7539('0x64')]){case _0x7539('0x63'):_0x3e9137[_0x7539('0x6a')]={'Authorization':util[_0x7539('0x6b')](_0x7539('0x6c'),new Buffer(util[_0x7539('0x6b')](_0x7539('0x6d'),_0x1fc3dc['username'],_0x1fc3dc[_0x7539('0x63')]))[_0x7539('0x6e')]('base64'))};break;case _0x7539('0x6f'):_0x3e9137['headers']={'Authorization':util[_0x7539('0x6b')](_0x7539('0x6c'),new Buffer(util['format'](_0x7539('0x70'),_0x1fc3dc[_0x7539('0x62')],_0x1fc3dc[_0x7539('0x6f')]))[_0x7539('0x6e')](_0x7539('0x71')))};break;default:throw new db['Sequelize'][(_0x7539('0x72'))](_0x7539('0x73'));}return rp(_0x3e9137);}})[_0x7539('0x31')](function(_0x3a8568){if(_0x3a8568){var _0x4efc49=[_0x7539('0x74'),_0x7539('0x75'),_0x7539('0x76'),_0x7539('0x77')];_[_0x7539('0x78')](_0x3a8568[_0x7539('0x69')],function(_0x4e5bcb){return _0x4efc49['includes'](_0x4e5bcb[_0x7539('0x49')]);});return{'count':_0x3a8568[_0x7539('0x69')][_0x7539('0x40')],'rows':_['map'](_0x3a8568['ticket_fields'],function(_0xfa36d9){return{'id':_0xfa36d9['id'],'name':_0xfa36d9[_0x7539('0x79')]>0x7?_0xfa36d9['title']:_0xfa36d9[_0x7539('0x49')],'custom':_0xfa36d9['position']>0x7?!![]:![],'options':_0xfa36d9[_0x7539('0x7a')]?_0xfa36d9[_0x7539('0x7a')]:_0xfa36d9['custom_field_options']?_0xfa36d9[_0x7539('0x7b')]:[]};})};}})[_0x7539('0x31')](respondWithResult(_0x5802c3,null))[_0x7539('0x25')](function(_0x262d38){var _0x289c05=_0x266d93[_0x7539('0x3c')][_0x7539('0x7c')]?0x1f4:_0x262d38[_0x7539('0x7d')]||0x1f4;logger[_0x7539('0x21')](_0x7539('0x7e'),'getFields',_0x289c05,JSON[_0x7539('0x20')](_0x262d38));delete _0x262d38[_0x7539('0x35')];if(_0x289c05===0x191){_0x289c05=0x190;}_0x5802c3[_0x7539('0x26')](_0x289c05)[_0x7539('0x36')](_0x266d93[_0x7539('0x3c')][_0x7539('0x7c')]?{'message':'Wrong\x20credentials','statusCode':_0x262d38['statusCode']}:_0x262d38);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 380fff6..bf20838 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 _0xfd01=['../../components/integrations/configuration','define','int_zendesk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes'];(function(_0x294a0d,_0x4ccad7){var _0x49ce49=function(_0x1f4671){while(--_0x1f4671){_0x294a0d['push'](_0x294a0d['shift']());}};_0x49ce49(++_0x4ccad7);}(_0xfd01,0xab));var _0x1fd0=function(_0x16f91b,_0x42a22f){_0x16f91b=_0x16f91b-0x0;var _0x2f488f=_0xfd01[_0x16f91b];return _0x2f488f;};'use strict';var _=require(_0x1fd0('0x0'));var util=require(_0x1fd0('0x1'));var logger=require(_0x1fd0('0x2'))('api');var moment=require(_0x1fd0('0x3'));var BPromise=require(_0x1fd0('0x4'));var rp=require(_0x1fd0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1fd0('0x6'));var config=require(_0x1fd0('0x7'));var attributes=require(_0x1fd0('0x8'));var integrations=require(_0x1fd0('0x9'));module['exports']=function(_0x14660d,_0xa4a3f6){return _0x14660d[_0x1fd0('0xa')]('ZendeskAccount',attributes,{'tableName':_0x1fd0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x52c4=['int_zendesk_accounts','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','exports','define','ZendeskAccount'];(function(_0x4ea1c1,_0x39a1b1){var _0x4dc1dc=function(_0x554b1b){while(--_0x554b1b){_0x4ea1c1['push'](_0x4ea1c1['shift']());}};_0x4dc1dc(++_0x39a1b1);}(_0x52c4,0xe8));var _0x452c=function(_0x4b287f,_0x4bc091){_0x4b287f=_0x4b287f-0x0;var _0x26bf92=_0x52c4[_0x4b287f];return _0x26bf92;};'use strict';var _=require(_0x452c('0x0'));var util=require(_0x452c('0x1'));var logger=require(_0x452c('0x2'))('api');var moment=require(_0x452c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x452c('0x4'));var rimraf=require(_0x452c('0x5'));var config=require(_0x452c('0x6'));var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x452c('0x7')]=function(_0x15d8c9,_0x289ed5){return _0x15d8c9[_0x452c('0x8')](_0x452c('0x9'),attributes,{'tableName':_0x452c('0xa'),'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 858bfc7..721942b 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 _0x0713=['findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount'];(function(_0x30b64c,_0x2ff8fc){var _0x3b03c1=function(_0x5438b6){while(--_0x5438b6){_0x30b64c['push'](_0x30b64c['shift']());}};_0x3b03c1(++_0x2ff8fc);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});}exports[_0x3071('0x18')]=function(_0x17dbda){var _0x1068d9=this;return new Promise(function(_0x108a83,_0x3acf0e){return db[_0x3071('0x19')][_0x3071('0x1a')]({'raw':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')]['where']||null:null,'attributes':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1d')]||null:null,'limit':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1e')]||null:null,'include':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x17dbda['options']['include'],function(_0x2ce48a){return{'model':db[_0x2ce48a[_0x3071('0x21')]],'as':_0x2ce48a['as'],'attributes':_0x2ce48a[_0x3071('0x1d')],'include':_0x2ce48a[_0x3071('0x1f')]?_[_0x3071('0x20')](_0x2ce48a[_0x3071('0x1f')],function(_0x7a4cb4){return{'model':db[_0x7a4cb4[_0x3071('0x21')]],'as':_0x7a4cb4['as'],'attributes':_0x7a4cb4[_0x3071('0x1d')],'include':_0x7a4cb4['include']?_[_0x3071('0x20')](_0x7a4cb4[_0x3071('0x1f')],function(_0x177138){return{'model':db[_0x177138['model']],'as':_0x177138['as'],'attributes':_0x177138[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x163604){logger[_0x3071('0xd')](_0x3071('0x18'),_0x17dbda);logger[_0x3071('0x10')](_0x3071('0x18'),_0x17dbda,JSON[_0x3071('0x12')](_0x163604));_0x108a83(_0x163604);})[_0x3071('0x17')](function(_0x292205){logger[_0x3071('0x13')]('GetZendeskAccount',_0x292205['message'],_0x17dbda);_0x3acf0e(_0x1068d9[_0x3071('0x13')](0x1f4,_0x292205[_0x3071('0x15')]));});});};exports[_0x3071('0x22')]=function(_0x40be95){var _0x3f6d90=this;return new Promise(function(_0x29538c,_0x32b6b1){return db[_0x3071('0x19')]['find']({'raw':_0x40be95['options']?_0x40be95['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x40be95[_0x3071('0x1b')]?_0x40be95['options'][_0x3071('0x23')]||null:null,'attributes':_0x40be95[_0x3071('0x1b')]?_0x40be95[_0x3071('0x1b')][_0x3071('0x1d')]||null:null,'include':_0x40be95['options']?_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')],function(_0x2068ce){return{'model':db[_0x2068ce[_0x3071('0x21')]],'as':_0x2068ce['as'],'attributes':_0x2068ce[_0x3071('0x1d')],'include':_0x2068ce['include']?_[_0x3071('0x20')](_0x2068ce['include'],function(_0x4fb1ec){return{'model':db[_0x4fb1ec[_0x3071('0x21')]],'as':_0x4fb1ec['as'],'attributes':_0x4fb1ec[_0x3071('0x1d')],'include':_0x4fb1ec['include']?_[_0x3071('0x20')](_0x4fb1ec[_0x3071('0x1f')],function(_0x265d76){return{'model':db[_0x265d76[_0x3071('0x21')]],'as':_0x265d76['as'],'attributes':_0x265d76[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x5610ab){logger[_0x3071('0xd')](_0x3071('0x22'),_0x40be95);logger['debug'](_0x3071('0x22'),_0x40be95,JSON['stringify'](_0x5610ab));_0x29538c(_0x5610ab);})[_0x3071('0x17')](function(_0x43133a){logger['error']('ShowZendeskAccount',_0x43133a[_0x3071('0x15')],_0x40be95);_0x32b6b1(_0x3f6d90[_0x3071('0x13')](0x1f4,_0x43133a[_0x3071('0x15')]));});});}; \ No newline at end of file +var _0xe706=['options','raw','where','attributes','limit','include','map','model','stringify','ShowZendeskAccount','ZendeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZendeskAccount','findAll'];(function(_0x344a92,_0x586f5e){var _0x966d72=function(_0x277604){while(--_0x277604){_0x344a92['push'](_0x344a92['shift']());}};_0x966d72(++_0x586f5e);}(_0xe706,0xa3));var _0x6e70=function(_0x3f5522,_0x28e324){_0x3f5522=_0x3f5522-0x0;var _0x4731f1=_0xe706[_0x3f5522];return _0x4731f1;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});}exports[_0x6e70('0x19')]=function(_0x5ea7a5){var _0x28a21f=this;return new Promise(function(_0x173afe,_0x53acdc){return db['ZendeskAccount'][_0x6e70('0x1a')]({'raw':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'limit':_0x5ea7a5['options']?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1f')]||null:null,'include':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5['options'][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x5ea7a5[_0x6e70('0x1b')]['include'],function(_0x10fc91){return{'model':db[_0x10fc91['model']],'as':_0x10fc91['as'],'attributes':_0x10fc91['attributes'],'include':_0x10fc91['include']?_[_0x6e70('0x21')](_0x10fc91[_0x6e70('0x20')],function(_0x51d292){return{'model':db[_0x51d292[_0x6e70('0x22')]],'as':_0x51d292['as'],'attributes':_0x51d292[_0x6e70('0x1e')],'include':_0x51d292['include']?_[_0x6e70('0x21')](_0x51d292[_0x6e70('0x20')],function(_0x2bb231){return{'model':db[_0x2bb231['model']],'as':_0x2bb231['as'],'attributes':_0x2bb231['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x3af17f){logger[_0x6e70('0xf')](_0x6e70('0x19'),_0x5ea7a5);logger[_0x6e70('0x12')]('GetZendeskAccount',_0x5ea7a5,JSON[_0x6e70('0x23')](_0x3af17f));_0x173afe(_0x3af17f);})[_0x6e70('0x18')](function(_0xecf336){logger[_0x6e70('0x14')](_0x6e70('0x19'),_0xecf336[_0x6e70('0x16')],_0x5ea7a5);_0x53acdc(_0x28a21f[_0x6e70('0x14')](0x1f4,_0xecf336[_0x6e70('0x16')]));});});};exports[_0x6e70('0x24')]=function(_0x3a5d30){var _0x4b1229=this;return new Promise(function(_0x1b27d8,_0x50d60b){return db[_0x6e70('0x25')]['find']({'raw':_0x3a5d30[_0x6e70('0x1b')]?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'include':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')],function(_0x1e3e76){return{'model':db[_0x1e3e76[_0x6e70('0x22')]],'as':_0x1e3e76['as'],'attributes':_0x1e3e76[_0x6e70('0x1e')],'include':_0x1e3e76[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x1e3e76['include'],function(_0x3b9c06){return{'model':db[_0x3b9c06['model']],'as':_0x3b9c06['as'],'attributes':_0x3b9c06[_0x6e70('0x1e')],'include':_0x3b9c06[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3b9c06[_0x6e70('0x20')],function(_0x233a83){return{'model':db[_0x233a83[_0x6e70('0x22')]],'as':_0x233a83['as'],'attributes':_0x233a83[_0x6e70('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x80bebb){logger[_0x6e70('0xf')](_0x6e70('0x24'),_0x3a5d30);logger[_0x6e70('0x12')](_0x6e70('0x24'),_0x3a5d30,JSON['stringify'](_0x80bebb));_0x1b27d8(_0x80bebb);})['catch'](function(_0x5424eb){logger[_0x6e70('0x14')](_0x6e70('0x24'),_0x5424eb[_0x6e70('0x16')],_0x3a5d30);_0x50d60b(_0x4b1229[_0x6e70('0x14')](0x1f4,_0x5424eb[_0x6e70('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index f7c7f09..b770494 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 _0x229b=['isAuthenticated','index','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','delete','/:id','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x5cb00e,_0x4c9d16){var _0x13454d=function(_0x4ff920){while(--_0x4ff920){_0x5cb00e['push'](_0x5cb00e['shift']());}};_0x13454d(++_0x4c9d16);}(_0x229b,0xad));var _0xb229=function(_0x260736,_0x4cf70f){_0x260736=_0x260736-0x0;var _0xfc0af6=_0x229b[_0x260736];return _0xfc0af6;};'use strict';var multer=require(_0xb229('0x0'));var util=require(_0xb229('0x1'));var path=require(_0xb229('0x2'));var timeout=require('connect-timeout');var express=require(_0xb229('0x3'));var router=express[_0xb229('0x4')]();var auth=require(_0xb229('0x5'));var interaction=require(_0xb229('0x6'));var config=require(_0xb229('0x7'));var controller=require('./intZendeskConfiguration.controller');router[_0xb229('0x8')]('/',auth[_0xb229('0x9')](),controller[_0xb229('0xa')]);router[_0xb229('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xb229('0xb')]);router[_0xb229('0x8')](_0xb229('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0xb229('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xb229('0xd')]);router[_0xb229('0x8')](_0xb229('0xe'),auth[_0xb229('0x9')](),controller[_0xb229('0xf')]);router['get'](_0xb229('0x10'),auth[_0xb229('0x9')](),controller[_0xb229('0x11')]);router[_0xb229('0x12')]('/',auth[_0xb229('0x9')](),controller[_0xb229('0x13')]);router[_0xb229('0x12')](_0xb229('0x10'),auth['isAuthenticated'](),controller[_0xb229('0x14')]);router[_0xb229('0x15')]('/:id',auth[_0xb229('0x9')](),controller['update']);router[_0xb229('0x16')](_0xb229('0x17'),auth[_0xb229('0x9')](),controller[_0xb229('0x18')]);module[_0xb229('0x19')]=router; \ No newline at end of file +var _0x4664=['get','getFields','getSubjects','getDescriptions','/:id/tags','getTags','post','update','multer','connect-timeout','Router','../../components/interaction/service','./intZendeskConfiguration.controller','isAuthenticated','index','/:id','show'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x4664,0x16d));var _0x4466=function(_0x3a7db0,_0xe93c50){_0x3a7db0=_0x3a7db0-0x0;var _0x17cbba=_0x4664[_0x3a7db0];return _0x17cbba;};'use strict';var multer=require(_0x4466('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4466('0x1'));var express=require('express');var router=express[_0x4466('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x4466('0x3'));var config=require('../../config/environment');var controller=require(_0x4466('0x4'));router['get']('/',auth[_0x4466('0x5')](),controller[_0x4466('0x6')]);router['get'](_0x4466('0x7'),auth[_0x4466('0x5')](),controller[_0x4466('0x8')]);router[_0x4466('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x4466('0xa')]);router[_0x4466('0x9')]('/:id/subjects',auth[_0x4466('0x5')](),controller[_0x4466('0xb')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x4466('0xc')]);router['get'](_0x4466('0xd'),auth['isAuthenticated'](),controller[_0x4466('0xe')]);router['post']('/',auth[_0x4466('0x5')](),controller['create']);router[_0x4466('0xf')](_0x4466('0xd'),auth[_0x4466('0x5')](),controller['setTags']);router['put']('/:id',auth[_0x4466('0x5')](),controller[_0x4466('0x10')]);router['delete'](_0x4466('0x7'),auth[_0x4466('0x5')](),controller['destroy']);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 01d078b..e8dee8a 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 _0x32a5=['sequelize','exports','STRING'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x32a5,0x123));var _0x532a=function(_0x5dd412,_0x16a29e){_0x5dd412=_0x5dd412-0x0;var _0x1ce41a=_0x32a5[_0x5dd412];return _0x1ce41a;};'use strict';var Sequelize=require(_0x532a('0x0'));module[_0x532a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x532a('0x2')]}}; \ No newline at end of file +var _0x8b3b=['sequelize','STRING'];(function(_0x597484,_0x199340){var _0x218e64=function(_0x390d55){while(--_0x390d55){_0x597484['push'](_0x597484['shift']());}};_0x218e64(++_0x199340);}(_0x8b3b,0xec));var _0xb8b3=function(_0x403ca6,_0x24e284){_0x403ca6=_0x403ca6-0x0;var _0x4e0e05=_0x8b3b[_0x403ca6];return _0x4e0e05;};'use strict';var Sequelize=require(_0xb8b3('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb8b3('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 3ebf9ac..3470850 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 _0xf501=['sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','stack','name','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','rows','show','params','keys','include','find','catch','create','body','update','destroy','getFields','findOne','ZendeskField','getSubjects','map','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path'];(function(_0xa6c203,_0x11d2d0){var _0x5aaf3f=function(_0x446617){while(--_0x446617){_0xa6c203['push'](_0xa6c203['shift']());}};_0x5aaf3f(++_0x11d2d0);}(_0xf501,0x1d6));var _0x1f50=function(_0xa53407,_0x5ccc27){_0xa53407=_0xa53407-0x0;var _0x312b22=_0xf501[_0xa53407];return _0x312b22;};'use strict';var pdf=require(_0x1f50('0x0'));var emlformat=require(_0x1f50('0x1'));var rimraf=require(_0x1f50('0x2'));var zipdir=require(_0x1f50('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1f50('0x4'));var moment=require(_0x1f50('0x5'));var BPromise=require(_0x1f50('0x6'));var Mustache=require(_0x1f50('0x7'));var util=require(_0x1f50('0x8'));var path=require(_0x1f50('0x9'));var sox=require(_0x1f50('0xa'));var csv=require(_0x1f50('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1f50('0xc'));var squel=require('squel');var crypto=require(_0x1f50('0xd'));var jsforce=require(_0x1f50('0xe'));var deskjs=require(_0x1f50('0xf'));var toCsv=require(_0x1f50('0xb'));var querystring=require(_0x1f50('0x10'));var Papa=require(_0x1f50('0x11'));var Redis=require(_0x1f50('0x12'));var authService=require(_0x1f50('0x13'));var qs=require(_0x1f50('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1f50('0x15'));var logger=require(_0x1f50('0x16'))(_0x1f50('0x17'));var utils=require('../../config/utils');var config=require(_0x1f50('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1f50('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x1f50('0x1a')][_0x1f50('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x1f070a,_0x3e533d,_0x2a6c67,_0x122b34){return new BPromise(function(_0x1e7976,_0x780d85){var _0x21e6f5=_0x122b34||client;return _0x21e6f5['request'](_0x1f070a,_0x2a6c67)[_0x1f50('0x1c')](function(_0x1aac60){logger[_0x1f50('0x1d')](_0x1f50('0x1e'),_0x3e533d,_0x1f50('0x1f'));logger[_0x1f50('0x20')](_0x1f50('0x21'),_0x3e533d,'request\x20sent',JSON[_0x1f50('0x22')](_0x1aac60));if(_0x1aac60[_0x1f50('0x23')]){if(_0x1aac60[_0x1f50('0x23')]['code']===0x1f4){logger['error'](_0x1f50('0x1e'),_0x3e533d,_0x1aac60[_0x1f50('0x23')]['message']);return _0x780d85(_0x1aac60[_0x1f50('0x23')][_0x1f50('0x24')]);}logger[_0x1f50('0x23')](_0x1f50('0x1e'),_0x3e533d,_0x1aac60[_0x1f50('0x23')][_0x1f50('0x24')]);return _0x1e7976(_0x1aac60[_0x1f50('0x23')][_0x1f50('0x24')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x3e533d,_0x1f50('0x1f'));_0x1e7976(_0x1aac60[_0x1f50('0x25')]['message']);}})['catch'](function(_0x4a06ef){logger[_0x1f50('0x23')](_0x1f50('0x1e'),_0x3e533d,_0x4a06ef);_0x780d85(_0x4a06ef);});});}function respondWithStatusCode(_0x818689,_0x17a415){_0x17a415=_0x17a415||0xcc;return function(_0x33d309){if(_0x33d309){return _0x818689[_0x1f50('0x26')](_0x17a415);}return _0x818689['status'](_0x17a415)[_0x1f50('0x27')]();};}function respondWithResult(_0x18a4d6,_0x37991b){_0x37991b=_0x37991b||0xc8;return function(_0x342778){if(_0x342778){return _0x18a4d6[_0x1f50('0x28')](_0x37991b)[_0x1f50('0x29')](_0x342778);}};}function respondWithFilteredResult(_0x877334,_0x402064){return function(_0x2b3f63){if(_0x2b3f63){var _0x5b40f8=_0x2b3f63[_0x1f50('0x2a')],_0x33dbc5=_0x402064[_0x1f50('0x2b')],_0x23c1ca=_0x402064[_0x1f50('0x2b')]+_0x402064[_0x1f50('0x2c')],_0x4145fa;if(_0x23c1ca>=_0x5b40f8){_0x23c1ca=_0x5b40f8;_0x4145fa=0xc8;}else{_0x4145fa=0xce;}_0x877334['status'](_0x4145fa);return _0x877334[_0x1f50('0x2d')](_0x1f50('0x2e'),_0x33dbc5+'-'+_0x23c1ca+'/'+_0x5b40f8)[_0x1f50('0x29')](_0x2b3f63);}return null;};}function patchUpdates(_0x9d17af){return function(_0xc29bae){try{jsonpatch[_0x1f50('0x2f')](_0xc29bae,_0x9d17af,!![]);}catch(_0x15aa5c){return BPromise[_0x1f50('0x30')](_0x15aa5c);}return _0xc29bae[_0x1f50('0x31')]();};}function saveUpdates(_0x38952d,_0x3314c5){return function(_0x479d81){if(_0x479d81){return _0x479d81['update'](_0x38952d)[_0x1f50('0x1c')](function(_0x4c80a2){return _0x4c80a2;});}return null;};}function removeEntity(_0x65a39f,_0x88e734){return function(_0x2b07c9){if(_0x2b07c9){return _0x2b07c9['destroy']()[_0x1f50('0x1c')](function(){_0x65a39f[_0x1f50('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ab1c9,_0x4ff6d5){return function(_0x2940c6){if(!_0x2940c6){_0x2ab1c9[_0x1f50('0x26')](0x194);}return _0x2940c6;};}function handleError(_0x5da12b,_0x178e82){_0x178e82=_0x178e82||0x1f4;return function(_0xcf4666){logger[_0x1f50('0x23')](_0xcf4666[_0x1f50('0x32')]);if(_0xcf4666['name']){delete _0xcf4666[_0x1f50('0x33')];}_0x5da12b[_0x1f50('0x28')](_0x178e82)['send'](_0xcf4666);};}exports['index']=function(_0x1d1eaa,_0x564eb4){var _0x42c0b4={},_0x57022d={},_0x482ff6={'count':0x0,'rows':[]};var _0x4d4e9b=_['map'](db[_0x1f50('0x34')][_0x1f50('0x35')],function(_0x3bb3b4){return{'name':_0x3bb3b4[_0x1f50('0x36')],'type':_0x3bb3b4[_0x1f50('0x37')][_0x1f50('0x38')]};});_0x57022d[_0x1f50('0x39')]=_['map'](_0x4d4e9b,_0x1f50('0x33'));_0x57022d['query']=_['keys'](_0x1d1eaa[_0x1f50('0x3a')]);_0x57022d['filters']=_[_0x1f50('0x3b')](_0x57022d[_0x1f50('0x39')],_0x57022d['query']);_0x42c0b4[_0x1f50('0x3c')]=_[_0x1f50('0x3b')](_0x57022d[_0x1f50('0x39')],qs[_0x1f50('0x3d')](_0x1d1eaa['query'][_0x1f50('0x3d')]));_0x42c0b4['attributes']=_0x42c0b4['attributes'][_0x1f50('0x3e')]?_0x42c0b4[_0x1f50('0x3c')]:_0x57022d[_0x1f50('0x39')];if(!_0x1d1eaa[_0x1f50('0x3a')][_0x1f50('0x3f')](_0x1f50('0x40'))){_0x42c0b4[_0x1f50('0x2c')]=qs[_0x1f50('0x2c')](_0x1d1eaa['query']['limit']);_0x42c0b4[_0x1f50('0x2b')]=qs[_0x1f50('0x2b')](_0x1d1eaa['query']['offset']);}_0x42c0b4[_0x1f50('0x41')]=qs[_0x1f50('0x42')](_0x1d1eaa[_0x1f50('0x3a')][_0x1f50('0x42')]);_0x42c0b4[_0x1f50('0x43')]=qs[_0x1f50('0x44')](_[_0x1f50('0x45')](_0x1d1eaa[_0x1f50('0x3a')],_0x57022d[_0x1f50('0x44')]),_0x4d4e9b);if(_0x1d1eaa['query'][_0x1f50('0x46')]){_0x42c0b4[_0x1f50('0x43')]=_['merge'](_0x42c0b4[_0x1f50('0x43')],{'$or':_['map'](_0x4d4e9b,function(_0x485ca8){if(_0x485ca8[_0x1f50('0x37')]!==_0x1f50('0x47')){var _0x4c62e7={};_0x4c62e7[_0x485ca8['name']]={'$like':'%'+_0x1d1eaa[_0x1f50('0x3a')][_0x1f50('0x46')]+'%'};return _0x4c62e7;}})});}_0x42c0b4=_[_0x1f50('0x48')]({},_0x42c0b4,_0x1d1eaa[_0x1f50('0x49')]);var _0x331af8={'where':_0x42c0b4[_0x1f50('0x43')]};return db[_0x1f50('0x34')]['count'](_0x331af8)[_0x1f50('0x1c')](function(_0x18fd47){_0x482ff6[_0x1f50('0x2a')]=_0x18fd47;if(_0x1d1eaa['query'][_0x1f50('0x4a')]){_0x42c0b4['include']=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x42c0b4);})[_0x1f50('0x1c')](function(_0x363af1){_0x482ff6[_0x1f50('0x4b')]=_0x363af1;return _0x482ff6;})[_0x1f50('0x1c')](respondWithFilteredResult(_0x564eb4,_0x42c0b4))['catch'](handleError(_0x564eb4,null));};exports[_0x1f50('0x4c')]=function(_0x4b8697,_0x5c7d8c){var _0x25cd8c={'raw':![],'where':{'id':_0x4b8697[_0x1f50('0x4d')]['id']}},_0x568a93={};_0x568a93['model']=_[_0x1f50('0x4e')](db['ZendeskConfiguration'][_0x1f50('0x35')]);_0x568a93[_0x1f50('0x3a')]=_[_0x1f50('0x4e')](_0x4b8697[_0x1f50('0x3a')]);_0x568a93[_0x1f50('0x44')]=_[_0x1f50('0x3b')](_0x568a93[_0x1f50('0x39')],_0x568a93['query']);_0x25cd8c[_0x1f50('0x3c')]=_[_0x1f50('0x3b')](_0x568a93[_0x1f50('0x39')],qs[_0x1f50('0x3d')](_0x4b8697[_0x1f50('0x3a')][_0x1f50('0x3d')]));_0x25cd8c[_0x1f50('0x3c')]=_0x25cd8c[_0x1f50('0x3c')][_0x1f50('0x3e')]?_0x25cd8c[_0x1f50('0x3c')]:_0x568a93[_0x1f50('0x39')];if(_0x4b8697[_0x1f50('0x3a')]['includeAll']){_0x25cd8c[_0x1f50('0x4f')]=[{'all':!![]}];}_0x25cd8c=_['merge']({},_0x25cd8c,_0x4b8697[_0x1f50('0x49')]);return db[_0x1f50('0x34')][_0x1f50('0x50')](_0x25cd8c)[_0x1f50('0x1c')](handleEntityNotFound(_0x5c7d8c,null))[_0x1f50('0x1c')](respondWithResult(_0x5c7d8c,null))[_0x1f50('0x51')](handleError(_0x5c7d8c,null));};exports[_0x1f50('0x52')]=function(_0x115384,_0x1c8e68){return db[_0x1f50('0x34')]['create'](_0x115384[_0x1f50('0x53')],{})[_0x1f50('0x1c')](respondWithResult(_0x1c8e68,0xc9))['catch'](handleError(_0x1c8e68,null));};exports[_0x1f50('0x54')]=function(_0x6f3f00,_0x46dbf8){if(_0x6f3f00[_0x1f50('0x53')]['id']){delete _0x6f3f00[_0x1f50('0x53')]['id'];}return db[_0x1f50('0x34')][_0x1f50('0x50')]({'where':{'id':_0x6f3f00[_0x1f50('0x4d')]['id']}})[_0x1f50('0x1c')](handleEntityNotFound(_0x46dbf8,null))[_0x1f50('0x1c')](saveUpdates(_0x6f3f00['body'],null))[_0x1f50('0x1c')](respondWithResult(_0x46dbf8,null))['catch'](handleError(_0x46dbf8,null));};exports[_0x1f50('0x55')]=function(_0x388983,_0x1ad207){return db[_0x1f50('0x34')][_0x1f50('0x50')]({'where':{'id':_0x388983[_0x1f50('0x4d')]['id']}})[_0x1f50('0x1c')](handleEntityNotFound(_0x1ad207,null))[_0x1f50('0x1c')](removeEntity(_0x1ad207,null))[_0x1f50('0x51')](handleError(_0x1ad207,null));};exports[_0x1f50('0x56')]=function(_0x25ba93,_0x431855,_0x3845f3){var _0x184fcd={};var _0x1463a2={};var _0x583fe6;var _0x56fa7c;return db[_0x1f50('0x34')][_0x1f50('0x57')]({'where':{'id':_0x25ba93[_0x1f50('0x4d')]['id']}})[_0x1f50('0x1c')](handleEntityNotFound(_0x431855,null))['then'](function(_0xebd442){if(_0xebd442){_0x583fe6=_0xebd442;_0x1463a2[_0x1f50('0x39')]=_[_0x1f50('0x4e')](db[_0x1f50('0x58')][_0x1f50('0x35')]);_0x1463a2['query']=_[_0x1f50('0x4e')](_0x25ba93['query']);_0x1463a2[_0x1f50('0x44')]=_[_0x1f50('0x3b')](_0x1463a2[_0x1f50('0x39')],_0x1463a2['query']);_0x184fcd['attributes']=_[_0x1f50('0x3b')](_0x1463a2['model'],qs[_0x1f50('0x3d')](_0x25ba93['query'][_0x1f50('0x3d')]));_0x184fcd[_0x1f50('0x3c')]=_0x184fcd[_0x1f50('0x3c')][_0x1f50('0x3e')]?_0x184fcd[_0x1f50('0x3c')]:_0x1463a2[_0x1f50('0x39')];_0x184fcd[_0x1f50('0x41')]=qs[_0x1f50('0x42')](_0x25ba93['query'][_0x1f50('0x42')]);_0x184fcd[_0x1f50('0x43')]=qs[_0x1f50('0x44')](_[_0x1f50('0x45')](_0x25ba93[_0x1f50('0x3a')],_0x1463a2[_0x1f50('0x44')]));if(_0x25ba93[_0x1f50('0x3a')][_0x1f50('0x46')]){_0x184fcd[_0x1f50('0x43')]=_[_0x1f50('0x48')](_0x184fcd[_0x1f50('0x43')],{'$or':_['map'](_0x184fcd[_0x1f50('0x3c')],function(_0x16fe69){var _0x216eed={};_0x216eed[_0x16fe69]={'$like':'%'+_0x25ba93[_0x1f50('0x3a')]['filter']+'%'};return _0x216eed;})});}_0x184fcd=_[_0x1f50('0x48')]({},_0x184fcd,_0x25ba93[_0x1f50('0x49')]);return _0x583fe6[_0x1f50('0x56')](_0x184fcd);}})[_0x1f50('0x1c')](function(_0x3ee60d){if(_0x3ee60d){_0x56fa7c=_0x3ee60d[_0x1f50('0x3e')];if(!_0x25ba93[_0x1f50('0x3a')][_0x1f50('0x3f')](_0x1f50('0x40'))){_0x184fcd[_0x1f50('0x2c')]=qs[_0x1f50('0x2c')](_0x25ba93[_0x1f50('0x3a')]['limit']);_0x184fcd[_0x1f50('0x2b')]=qs[_0x1f50('0x2b')](_0x25ba93['query']['offset']);}return _0x583fe6[_0x1f50('0x56')](_0x184fcd);}})['then'](function(_0x5e1ee5){if(_0x5e1ee5){return _0x5e1ee5?{'count':_0x56fa7c,'rows':_0x5e1ee5}:null;}})[_0x1f50('0x1c')](respondWithResult(_0x431855,null))[_0x1f50('0x51')](handleError(_0x431855,null));};exports[_0x1f50('0x59')]=function(_0x3b5ece,_0x3e966d,_0x5db784){var _0x76c768={};var _0x47a503={};var _0x1a4741;var _0x1a8238;return db[_0x1f50('0x34')][_0x1f50('0x57')]({'where':{'id':_0x3b5ece[_0x1f50('0x4d')]['id']}})[_0x1f50('0x1c')](handleEntityNotFound(_0x3e966d,null))[_0x1f50('0x1c')](function(_0x33d471){if(_0x33d471){_0x1a4741=_0x33d471;_0x47a503[_0x1f50('0x39')]=_['keys'](db[_0x1f50('0x58')][_0x1f50('0x35')]);_0x47a503[_0x1f50('0x3a')]=_[_0x1f50('0x4e')](_0x3b5ece[_0x1f50('0x3a')]);_0x47a503['filters']=_['intersection'](_0x47a503[_0x1f50('0x39')],_0x47a503[_0x1f50('0x3a')]);_0x76c768[_0x1f50('0x3c')]=_[_0x1f50('0x3b')](_0x47a503['model'],qs[_0x1f50('0x3d')](_0x3b5ece[_0x1f50('0x3a')][_0x1f50('0x3d')]));_0x76c768[_0x1f50('0x3c')]=_0x76c768[_0x1f50('0x3c')][_0x1f50('0x3e')]?_0x76c768[_0x1f50('0x3c')]:_0x47a503['model'];_0x76c768[_0x1f50('0x41')]=qs[_0x1f50('0x42')](_0x3b5ece[_0x1f50('0x3a')][_0x1f50('0x42')]);_0x76c768[_0x1f50('0x43')]=qs[_0x1f50('0x44')](_[_0x1f50('0x45')](_0x3b5ece[_0x1f50('0x3a')],_0x47a503[_0x1f50('0x44')]));if(_0x3b5ece[_0x1f50('0x3a')]['filter']){_0x76c768[_0x1f50('0x43')]=_['merge'](_0x76c768['where'],{'$or':_[_0x1f50('0x5a')](_0x76c768['attributes'],function(_0x291352){var _0x319de8={};_0x319de8[_0x291352]={'$like':'%'+_0x3b5ece['query'][_0x1f50('0x46')]+'%'};return _0x319de8;})});}_0x76c768=_[_0x1f50('0x48')]({},_0x76c768,_0x3b5ece['options']);return _0x1a4741[_0x1f50('0x59')](_0x76c768);}})[_0x1f50('0x1c')](function(_0x1504dd){if(_0x1504dd){_0x1a8238=_0x1504dd[_0x1f50('0x3e')];if(!_0x3b5ece[_0x1f50('0x3a')][_0x1f50('0x3f')](_0x1f50('0x40'))){_0x76c768[_0x1f50('0x2c')]=qs[_0x1f50('0x2c')](_0x3b5ece[_0x1f50('0x3a')][_0x1f50('0x2c')]);_0x76c768[_0x1f50('0x2b')]=qs[_0x1f50('0x2b')](_0x3b5ece[_0x1f50('0x3a')][_0x1f50('0x2b')]);}return _0x1a4741[_0x1f50('0x59')](_0x76c768);}})[_0x1f50('0x1c')](function(_0x40a03f){if(_0x40a03f){return _0x40a03f?{'count':_0x1a8238,'rows':_0x40a03f}:null;}})[_0x1f50('0x1c')](respondWithResult(_0x3e966d,null))[_0x1f50('0x51')](handleError(_0x3e966d,null));};exports[_0x1f50('0x5b')]=function(_0x2fb8ce,_0xfd9700,_0x19b2b5){var _0x4024ab={};var _0x1ea1fb={};var _0x52ce88;var _0x2c1f91;return db['ZendeskConfiguration'][_0x1f50('0x57')]({'where':{'id':_0x2fb8ce[_0x1f50('0x4d')]['id']}})[_0x1f50('0x1c')](handleEntityNotFound(_0xfd9700,null))[_0x1f50('0x1c')](function(_0x77bbe){if(_0x77bbe){_0x52ce88=_0x77bbe;_0x1ea1fb[_0x1f50('0x39')]=_['keys'](db['ZendeskField'][_0x1f50('0x35')]);_0x1ea1fb[_0x1f50('0x3a')]=_[_0x1f50('0x4e')](_0x2fb8ce[_0x1f50('0x3a')]);_0x1ea1fb[_0x1f50('0x44')]=_[_0x1f50('0x3b')](_0x1ea1fb['model'],_0x1ea1fb['query']);_0x4024ab[_0x1f50('0x3c')]=_[_0x1f50('0x3b')](_0x1ea1fb[_0x1f50('0x39')],qs['fields'](_0x2fb8ce['query'][_0x1f50('0x3d')]));_0x4024ab['attributes']=_0x4024ab[_0x1f50('0x3c')][_0x1f50('0x3e')]?_0x4024ab[_0x1f50('0x3c')]:_0x1ea1fb['model'];_0x4024ab[_0x1f50('0x41')]=qs[_0x1f50('0x42')](_0x2fb8ce[_0x1f50('0x3a')][_0x1f50('0x42')]);_0x4024ab[_0x1f50('0x43')]=qs[_0x1f50('0x44')](_['pick'](_0x2fb8ce[_0x1f50('0x3a')],_0x1ea1fb[_0x1f50('0x44')]));if(_0x2fb8ce['query']['filter']){_0x4024ab[_0x1f50('0x43')]=_[_0x1f50('0x48')](_0x4024ab['where'],{'$or':_['map'](_0x4024ab['attributes'],function(_0x1a34ed){var _0x4f6083={};_0x4f6083[_0x1a34ed]={'$like':'%'+_0x2fb8ce[_0x1f50('0x3a')][_0x1f50('0x46')]+'%'};return _0x4f6083;})});}_0x4024ab=_['merge']({},_0x4024ab,_0x2fb8ce[_0x1f50('0x49')]);return _0x52ce88[_0x1f50('0x5b')](_0x4024ab);}})['then'](function(_0x4946b5){if(_0x4946b5){_0x2c1f91=_0x4946b5[_0x1f50('0x3e')];if(!_0x2fb8ce[_0x1f50('0x3a')][_0x1f50('0x3f')](_0x1f50('0x40'))){_0x4024ab[_0x1f50('0x2c')]=qs[_0x1f50('0x2c')](_0x2fb8ce[_0x1f50('0x3a')]['limit']);_0x4024ab[_0x1f50('0x2b')]=qs['offset'](_0x2fb8ce[_0x1f50('0x3a')][_0x1f50('0x2b')]);}return _0x52ce88[_0x1f50('0x5b')](_0x4024ab);}})['then'](function(_0x1e8a48){if(_0x1e8a48){return _0x1e8a48?{'count':_0x2c1f91,'rows':_0x1e8a48}:null;}})[_0x1f50('0x1c')](respondWithResult(_0xfd9700,null))[_0x1f50('0x51')](handleError(_0xfd9700,null));};exports[_0x1f50('0x5c')]=function(_0x4efcb3,_0x297c3d,_0x1cc7d4){var _0x45dfb3={};var _0x47daf9={};var _0x35e025;var _0x2f560e;return db['ZendeskConfiguration'][_0x1f50('0x57')]({'where':{'id':_0x4efcb3[_0x1f50('0x4d')]['id']}})['then'](handleEntityNotFound(_0x297c3d,null))[_0x1f50('0x1c')](function(_0x18976f){if(_0x18976f){_0x35e025=_0x18976f;_0x47daf9[_0x1f50('0x39')]=_[_0x1f50('0x4e')](db[_0x1f50('0x5d')][_0x1f50('0x35')]);_0x47daf9[_0x1f50('0x3a')]=_['keys'](_0x4efcb3['query']);_0x47daf9[_0x1f50('0x44')]=_[_0x1f50('0x3b')](_0x47daf9[_0x1f50('0x39')],_0x47daf9[_0x1f50('0x3a')]);_0x45dfb3[_0x1f50('0x3c')]=_[_0x1f50('0x3b')](_0x47daf9['model'],qs['fields'](_0x4efcb3[_0x1f50('0x3a')][_0x1f50('0x3d')]));_0x45dfb3['attributes']=_0x45dfb3[_0x1f50('0x3c')]['length']?_0x45dfb3[_0x1f50('0x3c')]:_0x47daf9[_0x1f50('0x39')];_0x45dfb3[_0x1f50('0x41')]=qs['sort'](_0x4efcb3[_0x1f50('0x3a')][_0x1f50('0x42')]);_0x45dfb3[_0x1f50('0x43')]=qs['filters'](_['pick'](_0x4efcb3[_0x1f50('0x3a')],_0x47daf9[_0x1f50('0x44')]));if(_0x4efcb3[_0x1f50('0x3a')]['filter']){_0x45dfb3[_0x1f50('0x43')]=_[_0x1f50('0x48')](_0x45dfb3[_0x1f50('0x43')],{'$or':_[_0x1f50('0x5a')](_0x45dfb3[_0x1f50('0x3c')],function(_0x2307ae){var _0x2f1832={};_0x2f1832[_0x2307ae]={'$like':'%'+_0x4efcb3['query'][_0x1f50('0x46')]+'%'};return _0x2f1832;})});}_0x45dfb3=_[_0x1f50('0x48')]({},_0x45dfb3,_0x4efcb3[_0x1f50('0x49')]);return _0x35e025[_0x1f50('0x5c')](_0x45dfb3);}})['then'](function(_0x524105){if(_0x524105){_0x2f560e=_0x524105['length'];if(!_0x4efcb3[_0x1f50('0x3a')][_0x1f50('0x3f')](_0x1f50('0x40'))){_0x45dfb3['limit']=qs[_0x1f50('0x2c')](_0x4efcb3['query'][_0x1f50('0x2c')]);_0x45dfb3['offset']=qs[_0x1f50('0x2b')](_0x4efcb3[_0x1f50('0x3a')][_0x1f50('0x2b')]);}return _0x35e025[_0x1f50('0x5c')](_0x45dfb3);}})[_0x1f50('0x1c')](function(_0x34734d){if(_0x34734d){return _0x34734d?{'count':_0x2f560e,'rows':_0x34734d}:null;}})['then'](respondWithResult(_0x297c3d,null))[_0x1f50('0x51')](handleError(_0x297c3d,null));};exports[_0x1f50('0x5e')]=function(_0x1f4050,_0x19b157,_0x522c31){if(_0x1f4050['body']['id']){delete _0x1f4050['body']['id'];}return db[_0x1f50('0x34')][_0x1f50('0x57')]({'where':{'id':_0x1f4050['params']['id']}})[_0x1f50('0x1c')](handleEntityNotFound(_0x19b157,null))['then'](function(_0x2911ea){if(_0x2911ea){return _0x2911ea[_0x1f50('0x5e')](_0x1f4050['body'][_0x1f50('0x5f')]||[]);}return null;})[_0x1f50('0x1c')](respondWithResult(_0x19b157,null))['catch'](handleError(_0x19b157,null));}; \ No newline at end of file +var _0x3654=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','debug','stringify','error','ZendeskConfiguration,\x20%s,\x20%s','message','request\x20sent','catch','status','end','offset','limit','Content-Range','json','reject','update','sendStatus','stack','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','keys','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','params','find','create','body','destroy','getFields','getSubjects','findOne','ZendeskField','getDescriptions','getTags','Tag','setTags','html-pdf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce'];(function(_0x46ee7c,_0x192e31){var _0x184520=function(_0x552f60){while(--_0x552f60){_0x46ee7c['push'](_0x46ee7c['shift']());}};_0x184520(++_0x192e31);}(_0x3654,0x100));var _0x4365=function(_0x254aed,_0x21b90c){_0x254aed=_0x254aed-0x0;var _0x1dc757=_0x3654[_0x254aed];return _0x1dc757;};'use strict';var pdf=require(_0x4365('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4365('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4365('0x2'));var BPromise=require(_0x4365('0x3'));var Mustache=require(_0x4365('0x4'));var util=require('util');var path=require(_0x4365('0x5'));var sox=require(_0x4365('0x6'));var csv=require(_0x4365('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4365('0x8'));var squel=require(_0x4365('0x9'));var crypto=require('crypto');var jsforce=require(_0x4365('0xa'));var deskjs=require(_0x4365('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4365('0xc'));var Papa=require(_0x4365('0xd'));var Redis=require('ioredis');var authService=require(_0x4365('0xe'));var qs=require(_0x4365('0xf'));var as=require(_0x4365('0x10'));var hardwareService=require(_0x4365('0x11'));var logger=require(_0x4365('0x12'))('api');var utils=require(_0x4365('0x13'));var config=require(_0x4365('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4365('0x15'))['db'];var jayson=require(_0x4365('0x16'));var client=jayson[_0x4365('0x17')][_0x4365('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x47eb62,_0x5b65de,_0x1cae10,_0x115421){return new BPromise(function(_0xd28fad,_0x227daa){var _0x400e27=_0x115421||client;return _0x400e27[_0x4365('0x19')](_0x47eb62,_0x1cae10)[_0x4365('0x1a')](function(_0x425be6){logger[_0x4365('0x1b')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5b65de,'request\x20sent');logger[_0x4365('0x1c')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5b65de,'request\x20sent',JSON[_0x4365('0x1d')](_0x425be6));if(_0x425be6[_0x4365('0x1e')]){if(_0x425be6[_0x4365('0x1e')]['code']===0x1f4){logger['error'](_0x4365('0x1f'),_0x5b65de,_0x425be6[_0x4365('0x1e')][_0x4365('0x20')]);return _0x227daa(_0x425be6['error']['message']);}logger[_0x4365('0x1e')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5b65de,_0x425be6['error'][_0x4365('0x20')]);return _0xd28fad(_0x425be6[_0x4365('0x1e')][_0x4365('0x20')]);}else{logger[_0x4365('0x1b')](_0x4365('0x1f'),_0x5b65de,_0x4365('0x21'));_0xd28fad(_0x425be6['result'][_0x4365('0x20')]);}})[_0x4365('0x22')](function(_0x10f9a9){logger[_0x4365('0x1e')](_0x4365('0x1f'),_0x5b65de,_0x10f9a9);_0x227daa(_0x10f9a9);});});}function respondWithStatusCode(_0x301d87,_0xac1dd8){_0xac1dd8=_0xac1dd8||0xcc;return function(_0x5c7170){if(_0x5c7170){return _0x301d87['sendStatus'](_0xac1dd8);}return _0x301d87[_0x4365('0x23')](_0xac1dd8)[_0x4365('0x24')]();};}function respondWithResult(_0x2ef8dc,_0x4bc9a7){_0x4bc9a7=_0x4bc9a7||0xc8;return function(_0x3a2f3d){if(_0x3a2f3d){return _0x2ef8dc[_0x4365('0x23')](_0x4bc9a7)['json'](_0x3a2f3d);}};}function respondWithFilteredResult(_0x199548,_0x536178){return function(_0x143a70){if(_0x143a70){var _0x40c740=_0x143a70['count'],_0x1ac2b0=_0x536178[_0x4365('0x25')],_0xca464e=_0x536178['offset']+_0x536178[_0x4365('0x26')],_0x18f61c;if(_0xca464e>=_0x40c740){_0xca464e=_0x40c740;_0x18f61c=0xc8;}else{_0x18f61c=0xce;}_0x199548[_0x4365('0x23')](_0x18f61c);return _0x199548['set'](_0x4365('0x27'),_0x1ac2b0+'-'+_0xca464e+'/'+_0x40c740)[_0x4365('0x28')](_0x143a70);}return null;};}function patchUpdates(_0x3cef4b){return function(_0x2f65b7){try{jsonpatch['apply'](_0x2f65b7,_0x3cef4b,!![]);}catch(_0x2dc39b){return BPromise[_0x4365('0x29')](_0x2dc39b);}return _0x2f65b7['save']();};}function saveUpdates(_0x387aa3,_0x5b00d2){return function(_0x3848ba){if(_0x3848ba){return _0x3848ba[_0x4365('0x2a')](_0x387aa3)['then'](function(_0x38cfcd){return _0x38cfcd;});}return null;};}function removeEntity(_0x2e5841,_0x3c7fb6){return function(_0x1950eb){if(_0x1950eb){return _0x1950eb['destroy']()[_0x4365('0x1a')](function(){_0x2e5841[_0x4365('0x23')](0xcc)[_0x4365('0x24')]();});}};}function handleEntityNotFound(_0x4aef6d,_0x116539){return function(_0x5d6634){if(!_0x5d6634){_0x4aef6d[_0x4365('0x2b')](0x194);}return _0x5d6634;};}function handleError(_0x1fcd04,_0x315530){_0x315530=_0x315530||0x1f4;return function(_0x467ac2){logger[_0x4365('0x1e')](_0x467ac2[_0x4365('0x2c')]);if(_0x467ac2[_0x4365('0x2d')]){delete _0x467ac2['name'];}_0x1fcd04[_0x4365('0x23')](_0x315530)[_0x4365('0x2e')](_0x467ac2);};}exports['index']=function(_0x10ff79,_0x31fe53){var _0x67380f={},_0x49fac2={},_0x234706={'count':0x0,'rows':[]};var _0x36256d=_[_0x4365('0x2f')](db[_0x4365('0x30')][_0x4365('0x31')],function(_0xac734d){return{'name':_0xac734d[_0x4365('0x32')],'type':_0xac734d[_0x4365('0x33')][_0x4365('0x34')]};});_0x49fac2[_0x4365('0x35')]=_[_0x4365('0x2f')](_0x36256d,_0x4365('0x2d'));_0x49fac2['query']=_[_0x4365('0x36')](_0x10ff79['query']);_0x49fac2['filters']=_[_0x4365('0x37')](_0x49fac2[_0x4365('0x35')],_0x49fac2['query']);_0x67380f[_0x4365('0x38')]=_[_0x4365('0x37')](_0x49fac2['model'],qs['fields'](_0x10ff79['query'][_0x4365('0x39')]));_0x67380f[_0x4365('0x38')]=_0x67380f[_0x4365('0x38')][_0x4365('0x3a')]?_0x67380f[_0x4365('0x38')]:_0x49fac2[_0x4365('0x35')];if(!_0x10ff79[_0x4365('0x3b')][_0x4365('0x3c')](_0x4365('0x3d'))){_0x67380f['limit']=qs[_0x4365('0x26')](_0x10ff79[_0x4365('0x3b')][_0x4365('0x26')]);_0x67380f[_0x4365('0x25')]=qs[_0x4365('0x25')](_0x10ff79[_0x4365('0x3b')][_0x4365('0x25')]);}_0x67380f[_0x4365('0x3e')]=qs[_0x4365('0x3f')](_0x10ff79[_0x4365('0x3b')][_0x4365('0x3f')]);_0x67380f[_0x4365('0x40')]=qs[_0x4365('0x41')](_[_0x4365('0x42')](_0x10ff79[_0x4365('0x3b')],_0x49fac2[_0x4365('0x41')]),_0x36256d);if(_0x10ff79[_0x4365('0x3b')][_0x4365('0x43')]){_0x67380f[_0x4365('0x40')]=_[_0x4365('0x44')](_0x67380f[_0x4365('0x40')],{'$or':_['map'](_0x36256d,function(_0x48a5ce){if(_0x48a5ce['type']!==_0x4365('0x45')){var _0xffc7f9={};_0xffc7f9[_0x48a5ce[_0x4365('0x2d')]]={'$like':'%'+_0x10ff79[_0x4365('0x3b')][_0x4365('0x43')]+'%'};return _0xffc7f9;}})});}_0x67380f=_[_0x4365('0x44')]({},_0x67380f,_0x10ff79[_0x4365('0x46')]);var _0x23f57f={'where':_0x67380f[_0x4365('0x40')]};return db['ZendeskConfiguration'][_0x4365('0x47')](_0x23f57f)[_0x4365('0x1a')](function(_0x27481b){_0x234706[_0x4365('0x47')]=_0x27481b;if(_0x10ff79[_0x4365('0x3b')][_0x4365('0x48')]){_0x67380f[_0x4365('0x49')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x4365('0x4a')](_0x67380f);})['then'](function(_0x4b5cc6){_0x234706[_0x4365('0x4b')]=_0x4b5cc6;return _0x234706;})['then'](respondWithFilteredResult(_0x31fe53,_0x67380f))[_0x4365('0x22')](handleError(_0x31fe53,null));};exports['show']=function(_0xeabed,_0x373887){var _0x1bc0d1={'raw':![],'where':{'id':_0xeabed[_0x4365('0x4c')]['id']}},_0x3f2777={};_0x3f2777[_0x4365('0x35')]=_[_0x4365('0x36')](db['ZendeskConfiguration'][_0x4365('0x31')]);_0x3f2777[_0x4365('0x3b')]=_['keys'](_0xeabed['query']);_0x3f2777[_0x4365('0x41')]=_['intersection'](_0x3f2777[_0x4365('0x35')],_0x3f2777['query']);_0x1bc0d1[_0x4365('0x38')]=_[_0x4365('0x37')](_0x3f2777[_0x4365('0x35')],qs[_0x4365('0x39')](_0xeabed['query'][_0x4365('0x39')]));_0x1bc0d1[_0x4365('0x38')]=_0x1bc0d1['attributes']['length']?_0x1bc0d1[_0x4365('0x38')]:_0x3f2777[_0x4365('0x35')];if(_0xeabed[_0x4365('0x3b')]['includeAll']){_0x1bc0d1['include']=[{'all':!![]}];}_0x1bc0d1=_[_0x4365('0x44')]({},_0x1bc0d1,_0xeabed[_0x4365('0x46')]);return db['ZendeskConfiguration'][_0x4365('0x4d')](_0x1bc0d1)[_0x4365('0x1a')](handleEntityNotFound(_0x373887,null))['then'](respondWithResult(_0x373887,null))[_0x4365('0x22')](handleError(_0x373887,null));};exports['create']=function(_0x2b521a,_0x16b779){return db[_0x4365('0x30')][_0x4365('0x4e')](_0x2b521a[_0x4365('0x4f')],{})[_0x4365('0x1a')](respondWithResult(_0x16b779,0xc9))[_0x4365('0x22')](handleError(_0x16b779,null));};exports[_0x4365('0x2a')]=function(_0x581ad9,_0x5da5b8){if(_0x581ad9[_0x4365('0x4f')]['id']){delete _0x581ad9[_0x4365('0x4f')]['id'];}return db[_0x4365('0x30')][_0x4365('0x4d')]({'where':{'id':_0x581ad9[_0x4365('0x4c')]['id']}})[_0x4365('0x1a')](handleEntityNotFound(_0x5da5b8,null))[_0x4365('0x1a')](saveUpdates(_0x581ad9[_0x4365('0x4f')],null))[_0x4365('0x1a')](respondWithResult(_0x5da5b8,null))[_0x4365('0x22')](handleError(_0x5da5b8,null));};exports[_0x4365('0x50')]=function(_0x358bbe,_0x427c5a){return db[_0x4365('0x30')][_0x4365('0x4d')]({'where':{'id':_0x358bbe[_0x4365('0x4c')]['id']}})['then'](handleEntityNotFound(_0x427c5a,null))[_0x4365('0x1a')](removeEntity(_0x427c5a,null))['catch'](handleError(_0x427c5a,null));};exports['getFields']=function(_0x14d596,_0x2b2cc6,_0xffb904){var _0x5f0146={};var _0x11d1cb={};var _0x17395f;var _0x57118e;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x14d596[_0x4365('0x4c')]['id']}})[_0x4365('0x1a')](handleEntityNotFound(_0x2b2cc6,null))[_0x4365('0x1a')](function(_0x468778){if(_0x468778){_0x17395f=_0x468778;_0x11d1cb[_0x4365('0x35')]=_['keys'](db['ZendeskField']['rawAttributes']);_0x11d1cb[_0x4365('0x3b')]=_['keys'](_0x14d596['query']);_0x11d1cb['filters']=_[_0x4365('0x37')](_0x11d1cb[_0x4365('0x35')],_0x11d1cb['query']);_0x5f0146[_0x4365('0x38')]=_['intersection'](_0x11d1cb[_0x4365('0x35')],qs[_0x4365('0x39')](_0x14d596['query'][_0x4365('0x39')]));_0x5f0146[_0x4365('0x38')]=_0x5f0146['attributes'][_0x4365('0x3a')]?_0x5f0146[_0x4365('0x38')]:_0x11d1cb[_0x4365('0x35')];_0x5f0146[_0x4365('0x3e')]=qs[_0x4365('0x3f')](_0x14d596[_0x4365('0x3b')][_0x4365('0x3f')]);_0x5f0146['where']=qs[_0x4365('0x41')](_[_0x4365('0x42')](_0x14d596[_0x4365('0x3b')],_0x11d1cb['filters']));if(_0x14d596[_0x4365('0x3b')][_0x4365('0x43')]){_0x5f0146[_0x4365('0x40')]=_[_0x4365('0x44')](_0x5f0146[_0x4365('0x40')],{'$or':_[_0x4365('0x2f')](_0x5f0146[_0x4365('0x38')],function(_0xb9b91a){var _0x880d6d={};_0x880d6d[_0xb9b91a]={'$like':'%'+_0x14d596[_0x4365('0x3b')][_0x4365('0x43')]+'%'};return _0x880d6d;})});}_0x5f0146=_['merge']({},_0x5f0146,_0x14d596[_0x4365('0x46')]);return _0x17395f[_0x4365('0x51')](_0x5f0146);}})[_0x4365('0x1a')](function(_0x530942){if(_0x530942){_0x57118e=_0x530942[_0x4365('0x3a')];if(!_0x14d596[_0x4365('0x3b')]['hasOwnProperty']('nolimit')){_0x5f0146['limit']=qs[_0x4365('0x26')](_0x14d596['query'][_0x4365('0x26')]);_0x5f0146['offset']=qs['offset'](_0x14d596[_0x4365('0x3b')][_0x4365('0x25')]);}return _0x17395f[_0x4365('0x51')](_0x5f0146);}})['then'](function(_0x4d3d56){if(_0x4d3d56){return _0x4d3d56?{'count':_0x57118e,'rows':_0x4d3d56}:null;}})['then'](respondWithResult(_0x2b2cc6,null))[_0x4365('0x22')](handleError(_0x2b2cc6,null));};exports[_0x4365('0x52')]=function(_0x22e388,_0x58cd8c,_0x38b577){var _0x5dc7d1={};var _0x56eedc={};var _0x8eef99;var _0x517a15;return db[_0x4365('0x30')][_0x4365('0x53')]({'where':{'id':_0x22e388[_0x4365('0x4c')]['id']}})[_0x4365('0x1a')](handleEntityNotFound(_0x58cd8c,null))[_0x4365('0x1a')](function(_0x628c93){if(_0x628c93){_0x8eef99=_0x628c93;_0x56eedc[_0x4365('0x35')]=_[_0x4365('0x36')](db[_0x4365('0x54')][_0x4365('0x31')]);_0x56eedc[_0x4365('0x3b')]=_[_0x4365('0x36')](_0x22e388[_0x4365('0x3b')]);_0x56eedc[_0x4365('0x41')]=_[_0x4365('0x37')](_0x56eedc['model'],_0x56eedc[_0x4365('0x3b')]);_0x5dc7d1[_0x4365('0x38')]=_[_0x4365('0x37')](_0x56eedc[_0x4365('0x35')],qs['fields'](_0x22e388[_0x4365('0x3b')]['fields']));_0x5dc7d1[_0x4365('0x38')]=_0x5dc7d1[_0x4365('0x38')][_0x4365('0x3a')]?_0x5dc7d1[_0x4365('0x38')]:_0x56eedc[_0x4365('0x35')];_0x5dc7d1[_0x4365('0x3e')]=qs[_0x4365('0x3f')](_0x22e388[_0x4365('0x3b')][_0x4365('0x3f')]);_0x5dc7d1['where']=qs['filters'](_[_0x4365('0x42')](_0x22e388['query'],_0x56eedc[_0x4365('0x41')]));if(_0x22e388['query'][_0x4365('0x43')]){_0x5dc7d1[_0x4365('0x40')]=_[_0x4365('0x44')](_0x5dc7d1[_0x4365('0x40')],{'$or':_['map'](_0x5dc7d1[_0x4365('0x38')],function(_0x237962){var _0x4e019d={};_0x4e019d[_0x237962]={'$like':'%'+_0x22e388[_0x4365('0x3b')][_0x4365('0x43')]+'%'};return _0x4e019d;})});}_0x5dc7d1=_['merge']({},_0x5dc7d1,_0x22e388[_0x4365('0x46')]);return _0x8eef99[_0x4365('0x52')](_0x5dc7d1);}})['then'](function(_0x3878b6){if(_0x3878b6){_0x517a15=_0x3878b6[_0x4365('0x3a')];if(!_0x22e388[_0x4365('0x3b')][_0x4365('0x3c')](_0x4365('0x3d'))){_0x5dc7d1['limit']=qs[_0x4365('0x26')](_0x22e388[_0x4365('0x3b')]['limit']);_0x5dc7d1[_0x4365('0x25')]=qs[_0x4365('0x25')](_0x22e388[_0x4365('0x3b')][_0x4365('0x25')]);}return _0x8eef99['getSubjects'](_0x5dc7d1);}})[_0x4365('0x1a')](function(_0x24add0){if(_0x24add0){return _0x24add0?{'count':_0x517a15,'rows':_0x24add0}:null;}})['then'](respondWithResult(_0x58cd8c,null))[_0x4365('0x22')](handleError(_0x58cd8c,null));};exports[_0x4365('0x55')]=function(_0x2dc31d,_0x33f57e,_0x1d0348){var _0x44224={};var _0x53e6ff={};var _0x2ad91e;var _0x3088d7;return db['ZendeskConfiguration'][_0x4365('0x53')]({'where':{'id':_0x2dc31d[_0x4365('0x4c')]['id']}})[_0x4365('0x1a')](handleEntityNotFound(_0x33f57e,null))[_0x4365('0x1a')](function(_0x5cfdb7){if(_0x5cfdb7){_0x2ad91e=_0x5cfdb7;_0x53e6ff[_0x4365('0x35')]=_['keys'](db['ZendeskField'][_0x4365('0x31')]);_0x53e6ff[_0x4365('0x3b')]=_[_0x4365('0x36')](_0x2dc31d[_0x4365('0x3b')]);_0x53e6ff[_0x4365('0x41')]=_['intersection'](_0x53e6ff[_0x4365('0x35')],_0x53e6ff[_0x4365('0x3b')]);_0x44224['attributes']=_['intersection'](_0x53e6ff[_0x4365('0x35')],qs[_0x4365('0x39')](_0x2dc31d['query'][_0x4365('0x39')]));_0x44224[_0x4365('0x38')]=_0x44224[_0x4365('0x38')][_0x4365('0x3a')]?_0x44224[_0x4365('0x38')]:_0x53e6ff[_0x4365('0x35')];_0x44224[_0x4365('0x3e')]=qs[_0x4365('0x3f')](_0x2dc31d[_0x4365('0x3b')][_0x4365('0x3f')]);_0x44224[_0x4365('0x40')]=qs[_0x4365('0x41')](_['pick'](_0x2dc31d['query'],_0x53e6ff[_0x4365('0x41')]));if(_0x2dc31d[_0x4365('0x3b')][_0x4365('0x43')]){_0x44224[_0x4365('0x40')]=_[_0x4365('0x44')](_0x44224[_0x4365('0x40')],{'$or':_['map'](_0x44224[_0x4365('0x38')],function(_0x1d68d2){var _0x13675a={};_0x13675a[_0x1d68d2]={'$like':'%'+_0x2dc31d['query'][_0x4365('0x43')]+'%'};return _0x13675a;})});}_0x44224=_[_0x4365('0x44')]({},_0x44224,_0x2dc31d[_0x4365('0x46')]);return _0x2ad91e[_0x4365('0x55')](_0x44224);}})[_0x4365('0x1a')](function(_0x5ab67a){if(_0x5ab67a){_0x3088d7=_0x5ab67a['length'];if(!_0x2dc31d[_0x4365('0x3b')][_0x4365('0x3c')](_0x4365('0x3d'))){_0x44224[_0x4365('0x26')]=qs[_0x4365('0x26')](_0x2dc31d['query'][_0x4365('0x26')]);_0x44224[_0x4365('0x25')]=qs['offset'](_0x2dc31d[_0x4365('0x3b')][_0x4365('0x25')]);}return _0x2ad91e[_0x4365('0x55')](_0x44224);}})['then'](function(_0x4a9636){if(_0x4a9636){return _0x4a9636?{'count':_0x3088d7,'rows':_0x4a9636}:null;}})[_0x4365('0x1a')](respondWithResult(_0x33f57e,null))[_0x4365('0x22')](handleError(_0x33f57e,null));};exports[_0x4365('0x56')]=function(_0x341943,_0x1d4161,_0x2385a4){var _0x12e893={};var _0x129111={};var _0x7c8e81;var _0x30c0cc;return db['ZendeskConfiguration'][_0x4365('0x53')]({'where':{'id':_0x341943[_0x4365('0x4c')]['id']}})[_0x4365('0x1a')](handleEntityNotFound(_0x1d4161,null))[_0x4365('0x1a')](function(_0x159d74){if(_0x159d74){_0x7c8e81=_0x159d74;_0x129111['model']=_[_0x4365('0x36')](db[_0x4365('0x57')][_0x4365('0x31')]);_0x129111[_0x4365('0x3b')]=_[_0x4365('0x36')](_0x341943[_0x4365('0x3b')]);_0x129111[_0x4365('0x41')]=_[_0x4365('0x37')](_0x129111['model'],_0x129111['query']);_0x12e893[_0x4365('0x38')]=_['intersection'](_0x129111[_0x4365('0x35')],qs['fields'](_0x341943[_0x4365('0x3b')][_0x4365('0x39')]));_0x12e893[_0x4365('0x38')]=_0x12e893[_0x4365('0x38')][_0x4365('0x3a')]?_0x12e893['attributes']:_0x129111[_0x4365('0x35')];_0x12e893[_0x4365('0x3e')]=qs['sort'](_0x341943[_0x4365('0x3b')][_0x4365('0x3f')]);_0x12e893['where']=qs[_0x4365('0x41')](_[_0x4365('0x42')](_0x341943[_0x4365('0x3b')],_0x129111['filters']));if(_0x341943[_0x4365('0x3b')]['filter']){_0x12e893[_0x4365('0x40')]=_[_0x4365('0x44')](_0x12e893[_0x4365('0x40')],{'$or':_['map'](_0x12e893['attributes'],function(_0x6380a){var _0x4deb62={};_0x4deb62[_0x6380a]={'$like':'%'+_0x341943[_0x4365('0x3b')]['filter']+'%'};return _0x4deb62;})});}_0x12e893=_[_0x4365('0x44')]({},_0x12e893,_0x341943[_0x4365('0x46')]);return _0x7c8e81['getTags'](_0x12e893);}})[_0x4365('0x1a')](function(_0x25ac89){if(_0x25ac89){_0x30c0cc=_0x25ac89['length'];if(!_0x341943['query'][_0x4365('0x3c')]('nolimit')){_0x12e893[_0x4365('0x26')]=qs[_0x4365('0x26')](_0x341943[_0x4365('0x3b')]['limit']);_0x12e893['offset']=qs['offset'](_0x341943[_0x4365('0x3b')][_0x4365('0x25')]);}return _0x7c8e81[_0x4365('0x56')](_0x12e893);}})[_0x4365('0x1a')](function(_0x198119){if(_0x198119){return _0x198119?{'count':_0x30c0cc,'rows':_0x198119}:null;}})[_0x4365('0x1a')](respondWithResult(_0x1d4161,null))[_0x4365('0x22')](handleError(_0x1d4161,null));};exports[_0x4365('0x58')]=function(_0x4fc9af,_0x22e44f,_0x4310a9){if(_0x4fc9af[_0x4365('0x4f')]['id']){delete _0x4fc9af[_0x4365('0x4f')]['id'];}return db['ZendeskConfiguration'][_0x4365('0x53')]({'where':{'id':_0x4fc9af[_0x4365('0x4c')]['id']}})['then'](handleEntityNotFound(_0x22e44f,null))['then'](function(_0x84b1b1){if(_0x84b1b1){return _0x84b1b1[_0x4365('0x58')](_0x4fc9af[_0x4365('0x4f')]['ids']||[]);}return null;})[_0x4365('0x1a')](respondWithResult(_0x22e44f,null))[_0x4365('0x22')](handleError(_0x22e44f,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index ab137d6..59cc723 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 _0xe093=['path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','lodash','api','moment','request-promise'];(function(_0x1e9db7,_0x19c432){var _0x219fb4=function(_0x259311){while(--_0x259311){_0x1e9db7['push'](_0x1e9db7['shift']());}};_0x219fb4(++_0x19c432);}(_0xe093,0x80));var _0x3e09=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xe093[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0x3e09('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3e09('0x1'));var moment=require(_0x3e09('0x2'));var BPromise=require('bluebird');var rp=require(_0x3e09('0x3'));var fs=require('fs');var path=require(_0x3e09('0x4'));var rimraf=require(_0x3e09('0x5'));var config=require(_0x3e09('0x6'));var attributes=require(_0x3e09('0x7'));module[_0x3e09('0x8')]=function(_0x2d508d,_0x1e449d){return _0x2d508d[_0x3e09('0x9')](_0x3e09('0xa'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2646=['path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','bluebird'];(function(_0x32ffeb,_0x416485){var _0x507531=function(_0x42ab3f){while(--_0x42ab3f){_0x32ffeb['push'](_0x32ffeb['shift']());}};_0x507531(++_0x416485);}(_0x2646,0x15c));var _0x6264=function(_0x57944f,_0x4f975f){_0x57944f=_0x57944f-0x0;var _0x44d4d7=_0x2646[_0x57944f];return _0x44d4d7;};'use strict';var _=require(_0x6264('0x0'));var util=require(_0x6264('0x1'));var logger=require('../../config/logger')(_0x6264('0x2'));var moment=require('moment');var BPromise=require(_0x6264('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6264('0x4'));var rimraf=require(_0x6264('0x5'));var config=require(_0x6264('0x6'));var attributes=require(_0x6264('0x7'));module['exports']=function(_0x61fa08,_0x1cf9dc){return _0x61fa08[_0x6264('0x8')](_0x6264('0x9'),attributes,{'tableName':_0x6264('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 2d415a7..452e0bd 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 _0x8a9c=['request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','http','request','info','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x1e2c67,_0x20db26){var _0x142720=function(_0x41e529){while(--_0x41e529){_0x1e2c67['push'](_0x1e2c67['shift']());}};_0x142720(++_0x20db26);}(_0x8a9c,0x16f));var _0xc8a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc8a9('0x0'));var util=require('util');var moment=require(_0xc8a9('0x1'));var BPromise=require(_0xc8a9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc8a9('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc8a9('0x4'))(_0xc8a9('0x5'));var config=require(_0xc8a9('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc8a9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2db10e,_0x4ee6c1,_0x1a503f){return new BPromise(function(_0x39e0c2,_0x16f680){return client[_0xc8a9('0x8')](_0x2db10e,_0x1a503f)['then'](function(_0x4070d4){logger[_0xc8a9('0x9')](_0xc8a9('0xa'),_0x4ee6c1,_0xc8a9('0xb'));logger[_0xc8a9('0xc')](_0xc8a9('0xd'),_0x4ee6c1,'request\x20sent',JSON[_0xc8a9('0xe')](_0x4070d4));if(_0x4070d4['error']){if(_0x4070d4[_0xc8a9('0xf')][_0xc8a9('0x10')]===0x1f4){logger[_0xc8a9('0xf')](_0xc8a9('0xa'),_0x4ee6c1,_0x4070d4[_0xc8a9('0xf')]['message']);return _0x16f680(_0x4070d4[_0xc8a9('0xf')][_0xc8a9('0x11')]);}logger[_0xc8a9('0xf')](_0xc8a9('0xa'),_0x4ee6c1,_0x4070d4['error']['message']);return _0x39e0c2(_0x4070d4[_0xc8a9('0xf')][_0xc8a9('0x11')]);}else{logger['info'](_0xc8a9('0xa'),_0x4ee6c1,'request\x20sent');_0x39e0c2(_0x4070d4['result'][_0xc8a9('0x11')]);}})['catch'](function(_0x123230){logger[_0xc8a9('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4ee6c1,_0x123230);_0x16f680(_0x123230);});});} \ No newline at end of file +var _0x7f71=['../../config/environment','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','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x442d31,_0x590815){var _0x4d2967=function(_0x56066c){while(--_0x56066c){_0x442d31['push'](_0x442d31['shift']());}};_0x4d2967(++_0x590815);}(_0x7f71,0x178));var _0x17f7=function(_0x517601,_0x173b35){_0x517601=_0x517601-0x0;var _0x1d470a=_0x7f71[_0x517601];return _0x1d470a;};'use strict';var _=require(_0x17f7('0x0'));var util=require(_0x17f7('0x1'));var moment=require('moment');var BPromise=require(_0x17f7('0x2'));var rs=require(_0x17f7('0x3'));var fs=require('fs');var Redis=require(_0x17f7('0x4'));var db=require(_0x17f7('0x5'))['db'];var utils=require(_0x17f7('0x6'));var logger=require(_0x17f7('0x7'))('rpc');var config=require(_0x17f7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x17f7('0x9')][_0x17f7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43b5bd,_0x5021ce,_0x5a25ed){return new BPromise(function(_0x3ff4b3,_0x13bde1){return client[_0x17f7('0xb')](_0x43b5bd,_0x5a25ed)[_0x17f7('0xc')](function(_0x516f80){logger[_0x17f7('0xd')](_0x17f7('0xe'),_0x5021ce,'request\x20sent');logger[_0x17f7('0xf')](_0x17f7('0x10'),_0x5021ce,_0x17f7('0x11'),JSON[_0x17f7('0x12')](_0x516f80));if(_0x516f80[_0x17f7('0x13')]){if(_0x516f80[_0x17f7('0x13')][_0x17f7('0x14')]===0x1f4){logger['error'](_0x17f7('0xe'),_0x5021ce,_0x516f80[_0x17f7('0x13')][_0x17f7('0x15')]);return _0x13bde1(_0x516f80['error'][_0x17f7('0x15')]);}logger[_0x17f7('0x13')](_0x17f7('0xe'),_0x5021ce,_0x516f80['error']['message']);return _0x3ff4b3(_0x516f80[_0x17f7('0x13')][_0x17f7('0x15')]);}else{logger[_0x17f7('0xd')](_0x17f7('0xe'),_0x5021ce,_0x17f7('0x11'));_0x3ff4b3(_0x516f80[_0x17f7('0x16')][_0x17f7('0x15')]);}})[_0x17f7('0x17')](function(_0x5f324a){logger[_0x17f7('0x13')](_0x17f7('0xe'),_0x5021ce,_0x5f324a);_0x13bde1(_0x5f324a);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 0d23174..83549bc 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 _0x28ff=['show','post','create','put','update','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated'];(function(_0x126b18,_0x383603){var _0xe166c2=function(_0xede5ea){while(--_0xede5ea){_0x126b18['push'](_0x126b18['shift']());}};_0xe166c2(++_0x383603);}(_0x28ff,0x138));var _0xf28f=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x28ff[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require(_0xf28f('0x0'));var path=require(_0xf28f('0x1'));var timeout=require(_0xf28f('0x2'));var express=require(_0xf28f('0x3'));var router=express[_0xf28f('0x4')]();var auth=require(_0xf28f('0x5'));var interaction=require(_0xf28f('0x6'));var config=require(_0xf28f('0x7'));var controller=require('./intZendeskField.controller');router[_0xf28f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf28f('0x8')](_0xf28f('0x9'),auth[_0xf28f('0xa')](),controller[_0xf28f('0xb')]);router[_0xf28f('0xc')]('/',auth[_0xf28f('0xa')](),controller[_0xf28f('0xd')]);router[_0xf28f('0xe')](_0xf28f('0x9'),auth[_0xf28f('0xa')](),controller[_0xf28f('0xf')]);router['delete']('/:id',auth[_0xf28f('0xa')](),controller[_0xf28f('0x10')]);module['exports']=router; \ No newline at end of file +var _0x59f1=['./intZendeskField.controller','get','isAuthenticated','index','show','create','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x429370,_0x46ff4c){var _0x41a3ad=function(_0x47d51e){while(--_0x47d51e){_0x429370['push'](_0x429370['shift']());}};_0x41a3ad(++_0x46ff4c);}(_0x59f1,0x199));var _0x159f=function(_0x5be336,_0x531004){_0x5be336=_0x5be336-0x0;var _0x2366e1=_0x59f1[_0x5be336];return _0x2366e1;};'use strict';var multer=require('multer');var util=require(_0x159f('0x0'));var path=require('path');var timeout=require(_0x159f('0x1'));var express=require(_0x159f('0x2'));var router=express[_0x159f('0x3')]();var auth=require(_0x159f('0x4'));var interaction=require(_0x159f('0x5'));var config=require(_0x159f('0x6'));var controller=require(_0x159f('0x7'));router[_0x159f('0x8')]('/',auth[_0x159f('0x9')](),controller[_0x159f('0xa')]);router[_0x159f('0x8')]('/:id',auth[_0x159f('0x9')](),controller[_0x159f('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x159f('0xc')]);router['put']('/:id',auth[_0x159f('0x9')](),controller['update']);router[_0x159f('0xd')]('/:id',auth[_0x159f('0x9')](),controller[_0x159f('0xe')]);module[_0x159f('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 0abe0fe..1a3884a 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 _0x83c8=['customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','string'];(function(_0x49f096,_0xfc45e){var _0x515854=function(_0x3ad888){while(--_0x3ad888){_0x49f096['push'](_0x49f096['shift']());}};_0x515854(++_0xfc45e);}(_0x83c8,0x8a));var _0x883c=function(_0x11c1a1,_0x17ba8c){_0x11c1a1=_0x11c1a1-0x0;var _0x483746=_0x83c8[_0x11c1a1];return _0x483746;};'use strict';var Sequelize=require(_0x883c('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x883c('0x1'),'variable',_0x883c('0x2'),_0x883c('0x3')),'defaultValue':_0x883c('0x1')},'content':{'type':Sequelize[_0x883c('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x883c('0x5'),_0x883c('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x883c('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3fec=['BOOLEAN','sequelize','string','variable','keyValue','STRING','customVariable'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x3fec,0x1ba));var _0xc3fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3fec[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xc3fe('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xc3fe('0x1'),_0xc3fe('0x2'),'customVariable',_0xc3fe('0x3')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc3fe('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0xc3fe('0x1'),_0xc3fe('0x2'),_0xc3fe('0x5'))},'keyContent':{'type':Sequelize[_0xc3fe('0x4')]},'idField':{'type':Sequelize[_0xc3fe('0x4')]},'nameField':{'type':Sequelize[_0xc3fe('0x4')]},'customField':{'type':Sequelize[_0xc3fe('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc3fe('0x4')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 500924e..ae065c0 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 _0x0295=['error','name','send','ZendeskField','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','fields','length','find','create','body','update','html-pdf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','save','destroy','then'];(function(_0x574106,_0x3d8900){var _0x599274=function(_0x2e821c){while(--_0x2e821c){_0x574106['push'](_0x574106['shift']());}};_0x599274(++_0x3d8900);}(_0x0295,0x1f0));var _0x5029=function(_0x3cc8b9,_0x5c95f9){_0x3cc8b9=_0x3cc8b9-0x0;var _0x44d63f=_0x0295[_0x3cc8b9];return _0x44d63f;};'use strict';var pdf=require(_0x5029('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5029('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5029('0x2'));var BPromise=require(_0x5029('0x3'));var Mustache=require(_0x5029('0x4'));var util=require(_0x5029('0x5'));var path=require(_0x5029('0x6'));var sox=require(_0x5029('0x7'));var csv=require(_0x5029('0x8'));var ejs=require(_0x5029('0x9'));var fs=require('fs');var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=_0x10bf55[_0x5029('0x18')],_0x457c73=_0x317c20[_0x5029('0x19')],_0x353cba=_0x317c20['offset']+_0x317c20[_0x5029('0x1a')],_0x3786b5;if(_0x353cba>=_0x326923){_0x353cba=_0x326923;_0x3786b5=0xc8;}else{_0x3786b5=0xce;}_0xe278b7[_0x5029('0x16')](_0x3786b5);return _0xe278b7[_0x5029('0x1b')](_0x5029('0x1c'),_0x457c73+'-'+_0x353cba+'/'+_0x326923)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x5e115f){return function(_0xaba461){try{jsonpatch['apply'](_0xaba461,_0x5e115f,!![]);}catch(_0x226a5c){return BPromise['reject'](_0x226a5c);}return _0xaba461[_0x5029('0x1d')]();};}function saveUpdates(_0x8a414c,_0x2710aa){return function(_0x3cf0fb){if(_0x3cf0fb){return _0x3cf0fb['update'](_0x8a414c)['then'](function(_0x4c9184){return _0x4c9184;});}return null;};}function removeEntity(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1e')]()[_0x5029('0x1f')](function(){_0x4a49b6[_0x5029('0x16')](0xcc)[_0x5029('0x15')]();});}};}function handleEntityNotFound(_0x125c26,_0x356dac){return function(_0x3e857d){if(!_0x3e857d){_0x125c26['sendStatus'](0x194);}return _0x3e857d;};}function handleError(_0x564866,_0x49f347){_0x49f347=_0x49f347||0x1f4;return function(_0x588d90){logger[_0x5029('0x20')](_0x588d90['stack']);if(_0x588d90['name']){delete _0x588d90[_0x5029('0x21')];}_0x564866[_0x5029('0x16')](_0x49f347)[_0x5029('0x22')](_0x588d90);};}exports['index']=function(_0x2c501f,_0xb14bc){var _0x5e45c4={},_0x2b6d99={},_0x31f0a0={'count':0x0,'rows':[]};var _0x16ad8b=_['map'](db[_0x5029('0x23')][_0x5029('0x24')],function(_0xe5313e){return{'name':_0xe5313e['fieldName'],'type':_0xe5313e[_0x5029('0x25')][_0x5029('0x26')]};});_0x2b6d99['model']=_[_0x5029('0x27')](_0x16ad8b,_0x5029('0x21'));_0x2b6d99[_0x5029('0x28')]=_[_0x5029('0x29')](_0x2c501f[_0x5029('0x28')]);_0x2b6d99[_0x5029('0x2a')]=_[_0x5029('0x2b')](_0x2b6d99[_0x5029('0x2c')],_0x2b6d99[_0x5029('0x28')]);_0x5e45c4[_0x5029('0x2d')]=_[_0x5029('0x2b')](_0x2b6d99[_0x5029('0x2c')],qs['fields'](_0x2c501f[_0x5029('0x28')]['fields']));_0x5e45c4[_0x5029('0x2d')]=_0x5e45c4['attributes']['length']?_0x5e45c4[_0x5029('0x2d')]:_0x2b6d99[_0x5029('0x2c')];if(!_0x2c501f[_0x5029('0x28')]['hasOwnProperty'](_0x5029('0x2e'))){_0x5e45c4[_0x5029('0x1a')]=qs[_0x5029('0x1a')](_0x2c501f[_0x5029('0x28')][_0x5029('0x1a')]);_0x5e45c4[_0x5029('0x19')]=qs[_0x5029('0x19')](_0x2c501f[_0x5029('0x28')][_0x5029('0x19')]);}_0x5e45c4['order']=qs[_0x5029('0x2f')](_0x2c501f[_0x5029('0x28')][_0x5029('0x2f')]);_0x5e45c4[_0x5029('0x30')]=qs['filters'](_[_0x5029('0x31')](_0x2c501f[_0x5029('0x28')],_0x2b6d99[_0x5029('0x2a')]),_0x16ad8b);if(_0x2c501f['query']['filter']){_0x5e45c4[_0x5029('0x30')]=_[_0x5029('0x32')](_0x5e45c4['where'],{'$or':_['map'](_0x16ad8b,function(_0x9656f2){if(_0x9656f2[_0x5029('0x25')]!==_0x5029('0x33')){var _0x3210cb={};_0x3210cb[_0x9656f2[_0x5029('0x21')]]={'$like':'%'+_0x2c501f[_0x5029('0x28')][_0x5029('0x34')]+'%'};return _0x3210cb;}})});}_0x5e45c4=_[_0x5029('0x32')]({},_0x5e45c4,_0x2c501f[_0x5029('0x35')]);var _0x3effa4={'where':_0x5e45c4[_0x5029('0x30')]};return db[_0x5029('0x23')][_0x5029('0x18')](_0x3effa4)[_0x5029('0x1f')](function(_0x5c547e){_0x31f0a0['count']=_0x5c547e;if(_0x2c501f[_0x5029('0x28')][_0x5029('0x36')]){_0x5e45c4[_0x5029('0x37')]=[{'all':!![]}];}return db['ZendeskField'][_0x5029('0x38')](_0x5e45c4);})[_0x5029('0x1f')](function(_0x52572a){_0x31f0a0[_0x5029('0x39')]=_0x52572a;return _0x31f0a0;})['then'](respondWithFilteredResult(_0xb14bc,_0x5e45c4))[_0x5029('0x3a')](handleError(_0xb14bc,null));};exports['show']=function(_0x2a6286,_0x359838){var _0x24a18d={'raw':!![],'where':{'id':_0x2a6286[_0x5029('0x3b')]['id']}},_0x78768={};_0x78768[_0x5029('0x2c')]=_[_0x5029('0x29')](db[_0x5029('0x23')][_0x5029('0x24')]);_0x78768['query']=_[_0x5029('0x29')](_0x2a6286[_0x5029('0x28')]);_0x78768[_0x5029('0x2a')]=_[_0x5029('0x2b')](_0x78768[_0x5029('0x2c')],_0x78768[_0x5029('0x28')]);_0x24a18d['attributes']=_[_0x5029('0x2b')](_0x78768[_0x5029('0x2c')],qs[_0x5029('0x3c')](_0x2a6286[_0x5029('0x28')][_0x5029('0x3c')]));_0x24a18d['attributes']=_0x24a18d[_0x5029('0x2d')][_0x5029('0x3d')]?_0x24a18d[_0x5029('0x2d')]:_0x78768[_0x5029('0x2c')];if(_0x2a6286[_0x5029('0x28')][_0x5029('0x36')]){_0x24a18d[_0x5029('0x37')]=[{'all':!![]}];}_0x24a18d=_[_0x5029('0x32')]({},_0x24a18d,_0x2a6286[_0x5029('0x35')]);return db['ZendeskField'][_0x5029('0x3e')](_0x24a18d)[_0x5029('0x1f')](handleEntityNotFound(_0x359838,null))[_0x5029('0x1f')](respondWithResult(_0x359838,null))[_0x5029('0x3a')](handleError(_0x359838,null));};exports['create']=function(_0x50d7c2,_0x17a515){return db[_0x5029('0x23')][_0x5029('0x3f')](_0x50d7c2[_0x5029('0x40')],{})[_0x5029('0x1f')](respondWithResult(_0x17a515,0xc9))[_0x5029('0x3a')](handleError(_0x17a515,null));};exports[_0x5029('0x41')]=function(_0x19a6ca,_0x1257a4){if(_0x19a6ca[_0x5029('0x40')]['id']){delete _0x19a6ca[_0x5029('0x40')]['id'];}return db[_0x5029('0x23')][_0x5029('0x3e')]({'where':{'id':_0x19a6ca[_0x5029('0x3b')]['id']}})[_0x5029('0x1f')](handleEntityNotFound(_0x1257a4,null))[_0x5029('0x1f')](saveUpdates(_0x19a6ca[_0x5029('0x40')],null))[_0x5029('0x1f')](respondWithResult(_0x1257a4,null))[_0x5029('0x3a')](handleError(_0x1257a4,null));};exports[_0x5029('0x1e')]=function(_0x1d0a38,_0x489457){return db[_0x5029('0x23')]['find']({'where':{'id':_0x1d0a38[_0x5029('0x3b')]['id']}})[_0x5029('0x1f')](handleEntityNotFound(_0x489457,null))['then'](removeEntity(_0x489457,null))['catch'](handleError(_0x489457,null));}; \ No newline at end of file +var _0x1a37=['name','index','map','ZendeskField','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','count','offset','set','apply','reject','update','then','destroy','stack'];(function(_0x424fa8,_0x5e5056){var _0x15c5fe=function(_0x4dfa3e){while(--_0x4dfa3e){_0x424fa8['push'](_0x424fa8['shift']());}};_0x15c5fe(++_0x5e5056);}(_0x1a37,0xb4));var _0x71a3=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x1a37[_0x334841];return _0x5beb4b;};'use strict';var pdf=require(_0x71a3('0x0'));var emlformat=require(_0x71a3('0x1'));var rimraf=require(_0x71a3('0x2'));var zipdir=require(_0x71a3('0x3'));var jsonpatch=require(_0x71a3('0x4'));var rp=require(_0x71a3('0x5'));var moment=require(_0x71a3('0x6'));var BPromise=require(_0x71a3('0x7'));var Mustache=require(_0x71a3('0x8'));var util=require(_0x71a3('0x9'));var path=require('path');var sox=require(_0x71a3('0xa'));var csv=require('to-csv');var ejs=require(_0x71a3('0xb'));var fs=require('fs');var _=require(_0x71a3('0xc'));var squel=require(_0x71a3('0xd'));var crypto=require(_0x71a3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71a3('0xf'));var Redis=require(_0x71a3('0x10'));var authService=require(_0x71a3('0x11'));var qs=require(_0x71a3('0x12'));var as=require(_0x71a3('0x13'));var hardwareService=require(_0x71a3('0x14'));var logger=require(_0x71a3('0x15'))(_0x71a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x71a3('0x17'))['db'];function respondWithStatusCode(_0x3830cb,_0x27e46d){_0x27e46d=_0x27e46d||0xcc;return function(_0x229134){if(_0x229134){return _0x3830cb[_0x71a3('0x18')](_0x27e46d);}return _0x3830cb[_0x71a3('0x19')](_0x27e46d)[_0x71a3('0x1a')]();};}function respondWithResult(_0x3b256c,_0x4dc4ed){_0x4dc4ed=_0x4dc4ed||0xc8;return function(_0x203ee1){if(_0x203ee1){return _0x3b256c[_0x71a3('0x19')](_0x4dc4ed)['json'](_0x203ee1);}};}function respondWithFilteredResult(_0x1743d7,_0x32591a){return function(_0x59021f){if(_0x59021f){var _0x4aa918=_0x59021f[_0x71a3('0x1b')],_0x41fe1c=_0x32591a[_0x71a3('0x1c')],_0x3a1c81=_0x32591a[_0x71a3('0x1c')]+_0x32591a['limit'],_0xee797f;if(_0x3a1c81>=_0x4aa918){_0x3a1c81=_0x4aa918;_0xee797f=0xc8;}else{_0xee797f=0xce;}_0x1743d7[_0x71a3('0x19')](_0xee797f);return _0x1743d7[_0x71a3('0x1d')]('Content-Range',_0x41fe1c+'-'+_0x3a1c81+'/'+_0x4aa918)['json'](_0x59021f);}return null;};}function patchUpdates(_0x410a65){return function(_0x250db3){try{jsonpatch[_0x71a3('0x1e')](_0x250db3,_0x410a65,!![]);}catch(_0x1c4ec2){return BPromise[_0x71a3('0x1f')](_0x1c4ec2);}return _0x250db3['save']();};}function saveUpdates(_0x1ab947,_0x4156e1){return function(_0x28535b){if(_0x28535b){return _0x28535b[_0x71a3('0x20')](_0x1ab947)[_0x71a3('0x21')](function(_0x50ab3a){return _0x50ab3a;});}return null;};}function removeEntity(_0x1af24b,_0x5bbaee){return function(_0x3bf78e){if(_0x3bf78e){return _0x3bf78e[_0x71a3('0x22')]()[_0x71a3('0x21')](function(){_0x1af24b[_0x71a3('0x19')](0xcc)[_0x71a3('0x1a')]();});}};}function handleEntityNotFound(_0x2847b4,_0x5f33c5){return function(_0x26e6e7){if(!_0x26e6e7){_0x2847b4[_0x71a3('0x18')](0x194);}return _0x26e6e7;};}function handleError(_0xb9c195,_0x427518){_0x427518=_0x427518||0x1f4;return function(_0xb0f3aa){logger['error'](_0xb0f3aa[_0x71a3('0x23')]);if(_0xb0f3aa[_0x71a3('0x24')]){delete _0xb0f3aa['name'];}_0xb9c195[_0x71a3('0x19')](_0x427518)['send'](_0xb0f3aa);};}exports[_0x71a3('0x25')]=function(_0x2fd3b6,_0x211ea8){var _0x35b5c7={},_0x25f351={},_0x314439={'count':0x0,'rows':[]};var _0x2317ec=_[_0x71a3('0x26')](db[_0x71a3('0x27')][_0x71a3('0x28')],function(_0x3ea7aa){return{'name':_0x3ea7aa[_0x71a3('0x29')],'type':_0x3ea7aa['type'][_0x71a3('0x2a')]};});_0x25f351[_0x71a3('0x2b')]=_[_0x71a3('0x26')](_0x2317ec,_0x71a3('0x24'));_0x25f351['query']=_[_0x71a3('0x2c')](_0x2fd3b6[_0x71a3('0x2d')]);_0x25f351[_0x71a3('0x2e')]=_[_0x71a3('0x2f')](_0x25f351[_0x71a3('0x2b')],_0x25f351[_0x71a3('0x2d')]);_0x35b5c7[_0x71a3('0x30')]=_['intersection'](_0x25f351[_0x71a3('0x2b')],qs[_0x71a3('0x31')](_0x2fd3b6[_0x71a3('0x2d')][_0x71a3('0x31')]));_0x35b5c7[_0x71a3('0x30')]=_0x35b5c7[_0x71a3('0x30')][_0x71a3('0x32')]?_0x35b5c7[_0x71a3('0x30')]:_0x25f351[_0x71a3('0x2b')];if(!_0x2fd3b6[_0x71a3('0x2d')][_0x71a3('0x33')](_0x71a3('0x34'))){_0x35b5c7[_0x71a3('0x35')]=qs['limit'](_0x2fd3b6['query'][_0x71a3('0x35')]);_0x35b5c7[_0x71a3('0x1c')]=qs['offset'](_0x2fd3b6[_0x71a3('0x2d')][_0x71a3('0x1c')]);}_0x35b5c7['order']=qs[_0x71a3('0x36')](_0x2fd3b6[_0x71a3('0x2d')][_0x71a3('0x36')]);_0x35b5c7[_0x71a3('0x37')]=qs[_0x71a3('0x2e')](_[_0x71a3('0x38')](_0x2fd3b6[_0x71a3('0x2d')],_0x25f351['filters']),_0x2317ec);if(_0x2fd3b6[_0x71a3('0x2d')][_0x71a3('0x39')]){_0x35b5c7[_0x71a3('0x37')]=_['merge'](_0x35b5c7[_0x71a3('0x37')],{'$or':_[_0x71a3('0x26')](_0x2317ec,function(_0x3dc1de){if(_0x3dc1de[_0x71a3('0x3a')]!==_0x71a3('0x3b')){var _0x54d03b={};_0x54d03b[_0x3dc1de['name']]={'$like':'%'+_0x2fd3b6[_0x71a3('0x2d')][_0x71a3('0x39')]+'%'};return _0x54d03b;}})});}_0x35b5c7=_[_0x71a3('0x3c')]({},_0x35b5c7,_0x2fd3b6[_0x71a3('0x3d')]);var _0x36ed2e={'where':_0x35b5c7['where']};return db[_0x71a3('0x27')][_0x71a3('0x1b')](_0x36ed2e)[_0x71a3('0x21')](function(_0x58b833){_0x314439[_0x71a3('0x1b')]=_0x58b833;if(_0x2fd3b6['query'][_0x71a3('0x3e')]){_0x35b5c7[_0x71a3('0x3f')]=[{'all':!![]}];}return db[_0x71a3('0x27')][_0x71a3('0x40')](_0x35b5c7);})[_0x71a3('0x21')](function(_0x38912c){_0x314439[_0x71a3('0x41')]=_0x38912c;return _0x314439;})[_0x71a3('0x21')](respondWithFilteredResult(_0x211ea8,_0x35b5c7))[_0x71a3('0x42')](handleError(_0x211ea8,null));};exports[_0x71a3('0x43')]=function(_0x4bc5c8,_0xa49846){var _0x49affd={'raw':!![],'where':{'id':_0x4bc5c8[_0x71a3('0x44')]['id']}},_0x4472dd={};_0x4472dd[_0x71a3('0x2b')]=_[_0x71a3('0x2c')](db['ZendeskField'][_0x71a3('0x28')]);_0x4472dd[_0x71a3('0x2d')]=_['keys'](_0x4bc5c8[_0x71a3('0x2d')]);_0x4472dd[_0x71a3('0x2e')]=_[_0x71a3('0x2f')](_0x4472dd[_0x71a3('0x2b')],_0x4472dd['query']);_0x49affd[_0x71a3('0x30')]=_[_0x71a3('0x2f')](_0x4472dd[_0x71a3('0x2b')],qs[_0x71a3('0x31')](_0x4bc5c8[_0x71a3('0x2d')][_0x71a3('0x31')]));_0x49affd[_0x71a3('0x30')]=_0x49affd[_0x71a3('0x30')][_0x71a3('0x32')]?_0x49affd[_0x71a3('0x30')]:_0x4472dd[_0x71a3('0x2b')];if(_0x4bc5c8[_0x71a3('0x2d')][_0x71a3('0x3e')]){_0x49affd[_0x71a3('0x3f')]=[{'all':!![]}];}_0x49affd=_[_0x71a3('0x3c')]({},_0x49affd,_0x4bc5c8[_0x71a3('0x3d')]);return db['ZendeskField'][_0x71a3('0x45')](_0x49affd)[_0x71a3('0x21')](handleEntityNotFound(_0xa49846,null))['then'](respondWithResult(_0xa49846,null))[_0x71a3('0x42')](handleError(_0xa49846,null));};exports[_0x71a3('0x46')]=function(_0x45d642,_0x19e597){return db[_0x71a3('0x27')]['create'](_0x45d642['body'],{})[_0x71a3('0x21')](respondWithResult(_0x19e597,0xc9))[_0x71a3('0x42')](handleError(_0x19e597,null));};exports['update']=function(_0x389090,_0x29710e){if(_0x389090[_0x71a3('0x47')]['id']){delete _0x389090[_0x71a3('0x47')]['id'];}return db[_0x71a3('0x27')][_0x71a3('0x45')]({'where':{'id':_0x389090['params']['id']}})[_0x71a3('0x21')](handleEntityNotFound(_0x29710e,null))['then'](saveUpdates(_0x389090[_0x71a3('0x47')],null))[_0x71a3('0x21')](respondWithResult(_0x29710e,null))[_0x71a3('0x42')](handleError(_0x29710e,null));};exports[_0x71a3('0x22')]=function(_0x32e313,_0x48fcd7){return db[_0x71a3('0x27')][_0x71a3('0x45')]({'where':{'id':_0x32e313[_0x71a3('0x44')]['id']}})['then'](handleEntityNotFound(_0x48fcd7,null))[_0x71a3('0x21')](removeEntity(_0x48fcd7,null))['catch'](handleError(_0x48fcd7,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 5536843..e2a1c85 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 _0xf17f=['util','../../config/logger','moment','path','rimraf','../../config/environment','./intZendeskField.attributes','ZendeskField','int_zendesk_fields','idField','FieldId','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf17f,0x113));var _0xff17=function(_0x4d578c,_0x4d2ed2){_0x4d578c=_0x4d578c-0x0;var _0xf41cac=_0xf17f[_0x4d578c];return _0xf41cac;};'use strict';var _=require(_0xff17('0x0'));var util=require(_0xff17('0x1'));var logger=require(_0xff17('0x2'))('api');var moment=require(_0xff17('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xff17('0x4'));var rimraf=require(_0xff17('0x5'));var config=require(_0xff17('0x6'));var attributes=require(_0xff17('0x7'));module['exports']=function(_0x1d3d31,_0xb22fe2){return _0x1d3d31['define'](_0xff17('0x8'),attributes,{'tableName':_0xff17('0x9'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xff17('0xa'),_0xff17('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8a9a=['path','./intZendeskField.attributes','exports','define','zendesk_unique_index','idField','FieldId','../../config/logger','api','moment','request-promise'];(function(_0x1793de,_0x4d7233){var _0x4f0309=function(_0x229ee7){while(--_0x229ee7){_0x1793de['push'](_0x1793de['shift']());}};_0x4f0309(++_0x4d7233);}(_0x8a9a,0x193));var _0xa8a9=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x8a9a[_0x5f09c5];return _0x426ad9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa8a9('0x0'))(_0xa8a9('0x1'));var moment=require(_0xa8a9('0x2'));var BPromise=require('bluebird');var rp=require(_0xa8a9('0x3'));var fs=require('fs');var path=require(_0xa8a9('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa8a9('0x5'));module[_0xa8a9('0x6')]=function(_0x16b086,_0x39d1db){return _0x16b086[_0xa8a9('0x7')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xa8a9('0x8'),'fields':[_0xa8a9('0x9'),_0xa8a9('0xa')],'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 59b7e4a..9c10589 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 _0xf617=['ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x4e723a,_0x5e9b46){var _0x25542c=function(_0x43f84c){while(--_0x43f84c){_0x4e723a['push'](_0x4e723a['shift']());}};_0x25542c(++_0x5e9b46);}(_0xf617,0x1e8));var _0x7f61=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf617[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7f61('0x0'));var util=require(_0x7f61('0x1'));var moment=require('moment');var BPromise=require(_0x7f61('0x2'));var rs=require(_0x7f61('0x3'));var fs=require('fs');var Redis=require(_0x7f61('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7f61('0x5'))('rpc');var config=require(_0x7f61('0x6'));var jayson=require(_0x7f61('0x7'));var client=jayson[_0x7f61('0x8')][_0x7f61('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40d6da,_0x156b44,_0x550a41){return new BPromise(function(_0xdc08e9,_0x1ca5ad){return client['request'](_0x40d6da,_0x550a41)[_0x7f61('0xa')](function(_0xdd2cd2){logger[_0x7f61('0xb')](_0x7f61('0xc'),_0x156b44,_0x7f61('0xd'));logger[_0x7f61('0xe')](_0x7f61('0xf'),_0x156b44,_0x7f61('0xd'),JSON['stringify'](_0xdd2cd2));if(_0xdd2cd2[_0x7f61('0x10')]){if(_0xdd2cd2['error'][_0x7f61('0x11')]===0x1f4){logger[_0x7f61('0x10')]('ZendeskField,\x20%s,\x20%s',_0x156b44,_0xdd2cd2[_0x7f61('0x10')]['message']);return _0x1ca5ad(_0xdd2cd2[_0x7f61('0x10')][_0x7f61('0x12')]);}logger[_0x7f61('0x10')]('ZendeskField,\x20%s,\x20%s',_0x156b44,_0xdd2cd2[_0x7f61('0x10')][_0x7f61('0x12')]);return _0xdc08e9(_0xdd2cd2[_0x7f61('0x10')]['message']);}else{logger['info'](_0x7f61('0xc'),_0x156b44,'request\x20sent');_0xdc08e9(_0xdd2cd2[_0x7f61('0x13')]['message']);}})['catch'](function(_0x53a744){logger[_0x7f61('0x10')](_0x7f61('0xc'),_0x156b44,_0x53a744);_0x1ca5ad(_0x53a744);});});} \ No newline at end of file +var _0x4f9a=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x4f9a,0x17f));var _0xa4f9=function(_0x4856bd,_0x3a74fb){_0x4856bd=_0x4856bd-0x0;var _0x1d047e=_0x4f9a[_0x4856bd];return _0x1d047e;};'use strict';var _=require(_0xa4f9('0x0'));var util=require(_0xa4f9('0x1'));var moment=require(_0xa4f9('0x2'));var BPromise=require(_0xa4f9('0x3'));var rs=require(_0xa4f9('0x4'));var fs=require('fs');var Redis=require(_0xa4f9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa4f9('0x6'));var logger=require(_0xa4f9('0x7'))('rpc');var config=require(_0xa4f9('0x8'));var jayson=require(_0xa4f9('0x9'));var client=jayson[_0xa4f9('0xa')][_0xa4f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x418d83,_0x264e15,_0x676fd7){return new BPromise(function(_0x2f673e,_0x3e46bf){return client[_0xa4f9('0xc')](_0x418d83,_0x676fd7)[_0xa4f9('0xd')](function(_0x418d03){logger['info'](_0xa4f9('0xe'),_0x264e15,_0xa4f9('0xf'));logger[_0xa4f9('0x10')](_0xa4f9('0x11'),_0x264e15,_0xa4f9('0xf'),JSON[_0xa4f9('0x12')](_0x418d03));if(_0x418d03[_0xa4f9('0x13')]){if(_0x418d03['error'][_0xa4f9('0x14')]===0x1f4){logger[_0xa4f9('0x13')](_0xa4f9('0xe'),_0x264e15,_0x418d03[_0xa4f9('0x13')][_0xa4f9('0x15')]);return _0x3e46bf(_0x418d03[_0xa4f9('0x13')][_0xa4f9('0x15')]);}logger[_0xa4f9('0x13')](_0xa4f9('0xe'),_0x264e15,_0x418d03[_0xa4f9('0x13')][_0xa4f9('0x15')]);return _0x2f673e(_0x418d03[_0xa4f9('0x13')]['message']);}else{logger[_0xa4f9('0x16')]('ZendeskField,\x20%s,\x20%s',_0x264e15,_0xa4f9('0xf'));_0x2f673e(_0x418d03[_0xa4f9('0x17')]['message']);}})['catch'](function(_0x184eb1){logger[_0xa4f9('0x13')](_0xa4f9('0xe'),_0x264e15,_0x184eb1);_0x3e46bf(_0x184eb1);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 13da1bd..35c051f 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(_0x5987d9,_0x56e3e4){var _0x573cc4=function(_0x48f0e8){while(--_0x48f0e8){_0x5987d9['push'](_0x5987d9['shift']());}};_0x573cc4(++_0x56e3e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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(_0x4c104a,_0x19d48a){var _0x190054=function(_0x5c3fac){while(--_0x5c3fac){_0x4c104a['push'](_0x4c104a['shift']());}};_0x190054(++_0x19d48a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 7209e1c..d4fa7c5 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 _0x016f=['sequelize','exports','STRING'];(function(_0x1284ec,_0x2dc1f9){var _0x18cca5=function(_0x32e73f){while(--_0x32e73f){_0x1284ec['push'](_0x1284ec['shift']());}};_0x18cca5(++_0x2dc1f9);}(_0x016f,0xc0));var _0xf016=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x016f[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0xf016('0x0'));module[_0xf016('0x1')]={'name':{'type':Sequelize[_0xf016('0x2')]},'description':{'type':Sequelize[_0xf016('0x2')]},'host':{'type':Sequelize[_0xf016('0x2')]},'zone':{'type':Sequelize[_0xf016('0x2')]},'clientId':{'type':Sequelize[_0xf016('0x2')]},'clientSecret':{'type':Sequelize[_0xf016('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xf016('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x527c=['exports','STRING','sequelize'];(function(_0x5b9458,_0x184cc5){var _0x1134d4=function(_0x1dae3d){while(--_0x1dae3d){_0x5b9458['push'](_0x5b9458['shift']());}};_0x1134d4(++_0x184cc5);}(_0x527c,0xb3));var _0xc527=function(_0x355141,_0x4ce3bd){_0x355141=_0x355141-0x0;var _0x328382=_0x527c[_0x355141];return _0x328382;};'use strict';var Sequelize=require(_0xc527('0x0'));module[_0xc527('0x1')]={'name':{'type':Sequelize[_0xc527('0x2')]},'description':{'type':Sequelize[_0xc527('0x2')]},'host':{'type':Sequelize[_0xc527('0x2')]},'zone':{'type':Sequelize[_0xc527('0x2')]},'clientId':{'type':Sequelize[_0xc527('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xc527('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xc527('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index a5a2c5a..11e72c1 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 _0xb94c=['json','reject','update','destroy','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','where','merge','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','getConfigurations','filter','nolimit','findOne','AccountId','Subjects','getSubjects','Descriptions','channel','ZohoConfiguration','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','clientSecret','serverUrl','code','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','display_label','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','sendStatus','status','end','count','offset','set','Content-Range'];(function(_0x5f3905,_0x43a651){var _0x2923b1=function(_0x3c72d8){while(--_0x3c72d8){_0x5f3905['push'](_0x5f3905['shift']());}};_0x2923b1(++_0x43a651);}(_0xb94c,0x176));var _0xcb94=function(_0x4aca1b,_0x5741eb){_0x4aca1b=_0x4aca1b-0x0;var _0x6bdc98=_0xb94c[_0x4aca1b];return _0x6bdc98;};'use strict';var pdf=require(_0xcb94('0x0'));var emlformat=require(_0xcb94('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcb94('0x2'));var jsonpatch=require(_0xcb94('0x3'));var rp=require('request-promise');var moment=require(_0xcb94('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcb94('0x5'));var util=require(_0xcb94('0x6'));var path=require(_0xcb94('0x7'));var sox=require(_0xcb94('0x8'));var csv=require(_0xcb94('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcb94('0xa'));var squel=require(_0xcb94('0xb'));var crypto=require(_0xcb94('0xc'));var jsforce=require(_0xcb94('0xd'));var deskjs=require(_0xcb94('0xe'));var toCsv=require('to-csv');var querystring=require(_0xcb94('0xf'));var Papa=require(_0xcb94('0x10'));var Redis=require(_0xcb94('0x11'));var authService=require(_0xcb94('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xcb94('0x13'));var hardwareService=require(_0xcb94('0x14'));var logger=require(_0xcb94('0x15'))(_0xcb94('0x16'));var utils=require(_0xcb94('0x17'));var config=require(_0xcb94('0x18'));var licenseUtil=require(_0xcb94('0x19'));var db=require(_0xcb94('0x1a'))['db'];var integrations=require(_0xcb94('0x1b'));var jayson=require(_0xcb94('0x1c'));var client=jayson['client'][_0xcb94('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2c4e8e,_0x534271,_0x5c63c9,_0x481618){return new BPromise(function(_0x4bea1b,_0x167878){var _0x1e8d23=_0x481618||client;return _0x1e8d23[_0xcb94('0x1e')](_0x2c4e8e,_0x5c63c9)['then'](function(_0x27cd73){logger['info'](_0xcb94('0x1f'),_0x534271,_0xcb94('0x20'));logger[_0xcb94('0x21')](_0xcb94('0x22'),_0x534271,_0xcb94('0x20'),JSON['stringify'](_0x27cd73));if(_0x27cd73[_0xcb94('0x23')]){if(_0x27cd73['error']['code']===0x1f4){logger[_0xcb94('0x23')](_0xcb94('0x1f'),_0x534271,_0x27cd73[_0xcb94('0x23')][_0xcb94('0x24')]);return _0x167878(_0x27cd73[_0xcb94('0x23')][_0xcb94('0x24')]);}logger[_0xcb94('0x23')](_0xcb94('0x1f'),_0x534271,_0x27cd73[_0xcb94('0x23')][_0xcb94('0x24')]);return _0x4bea1b(_0x27cd73[_0xcb94('0x23')]['message']);}else{logger[_0xcb94('0x25')]('ZohoAccount,\x20%s,\x20%s',_0x534271,_0xcb94('0x20'));_0x4bea1b(_0x27cd73[_0xcb94('0x26')][_0xcb94('0x24')]);}})['catch'](function(_0x144711){logger[_0xcb94('0x23')](_0xcb94('0x1f'),_0x534271,_0x144711);_0x167878(_0x144711);});});}function respondWithStatusCode(_0x212ada,_0x494b01){_0x494b01=_0x494b01||0xcc;return function(_0x1fad6f){if(_0x1fad6f){return _0x212ada[_0xcb94('0x27')](_0x494b01);}return _0x212ada[_0xcb94('0x28')](_0x494b01)[_0xcb94('0x29')]();};}function respondWithResult(_0x58df93,_0x45a4f8){_0x45a4f8=_0x45a4f8||0xc8;return function(_0x2ff850){if(_0x2ff850){return _0x58df93[_0xcb94('0x28')](_0x45a4f8)['json'](_0x2ff850);}};}function respondWithFilteredResult(_0x4ecfa2,_0x24a06d){return function(_0x1f50d7){if(_0x1f50d7){var _0x4152fd=_0x1f50d7[_0xcb94('0x2a')],_0x165f7e=_0x24a06d[_0xcb94('0x2b')],_0x786768=_0x24a06d[_0xcb94('0x2b')]+_0x24a06d['limit'],_0x418be0;if(_0x786768>=_0x4152fd){_0x786768=_0x4152fd;_0x418be0=0xc8;}else{_0x418be0=0xce;}_0x4ecfa2[_0xcb94('0x28')](_0x418be0);return _0x4ecfa2[_0xcb94('0x2c')](_0xcb94('0x2d'),_0x165f7e+'-'+_0x786768+'/'+_0x4152fd)[_0xcb94('0x2e')](_0x1f50d7);}return null;};}function patchUpdates(_0x5c5be8){return function(_0xb25c24){try{jsonpatch['apply'](_0xb25c24,_0x5c5be8,!![]);}catch(_0x1c1c25){return BPromise[_0xcb94('0x2f')](_0x1c1c25);}return _0xb25c24['save']();};}function saveUpdates(_0x4bf816,_0x2f52f2){return function(_0xacb307){if(_0xacb307){return _0xacb307[_0xcb94('0x30')](_0x4bf816)['then'](function(_0x3b6c55){return _0x3b6c55;});}return null;};}function removeEntity(_0x960d93,_0x312b76){return function(_0x22b412){if(_0x22b412){return _0x22b412[_0xcb94('0x31')]()['then'](function(){_0x960d93[_0xcb94('0x28')](0xcc)[_0xcb94('0x29')]();});}};}function handleEntityNotFound(_0x777eee,_0x290ae0){return function(_0x2ce46e){if(!_0x2ce46e){_0x777eee[_0xcb94('0x27')](0x194);}return _0x2ce46e;};}function handleError(_0x3b3dcb,_0x5eeee7){_0x5eeee7=_0x5eeee7||0x1f4;return function(_0xfef3b4){logger[_0xcb94('0x23')](_0xfef3b4[_0xcb94('0x32')]);if(_0xfef3b4[_0xcb94('0x33')]){delete _0xfef3b4['name'];}_0x3b3dcb['status'](_0x5eeee7)[_0xcb94('0x34')](_0xfef3b4);};}exports[_0xcb94('0x35')]=function(_0x4e5083,_0x3ebb7b){var _0xd6e704={},_0x1a9927={},_0xb30e10={'count':0x0,'rows':[]};var _0x2af145=_[_0xcb94('0x36')](db[_0xcb94('0x37')][_0xcb94('0x38')],function(_0x5cf8a1){return{'name':_0x5cf8a1[_0xcb94('0x39')],'type':_0x5cf8a1[_0xcb94('0x3a')][_0xcb94('0x3b')]};});_0x1a9927[_0xcb94('0x3c')]=_['map'](_0x2af145,_0xcb94('0x33'));_0x1a9927[_0xcb94('0x3d')]=_['keys'](_0x4e5083['query']);_0x1a9927[_0xcb94('0x3e')]=_[_0xcb94('0x3f')](_0x1a9927[_0xcb94('0x3c')],_0x1a9927[_0xcb94('0x3d')]);_0xd6e704[_0xcb94('0x40')]=_[_0xcb94('0x3f')](_0x1a9927['model'],qs[_0xcb94('0x41')](_0x4e5083['query'][_0xcb94('0x41')]));_0xd6e704[_0xcb94('0x40')]=_0xd6e704[_0xcb94('0x40')][_0xcb94('0x42')]?_0xd6e704[_0xcb94('0x40')]:_0x1a9927[_0xcb94('0x3c')];if(!_0x4e5083[_0xcb94('0x3d')][_0xcb94('0x43')]('nolimit')){_0xd6e704[_0xcb94('0x44')]=qs[_0xcb94('0x44')](_0x4e5083[_0xcb94('0x3d')][_0xcb94('0x44')]);_0xd6e704[_0xcb94('0x2b')]=qs[_0xcb94('0x2b')](_0x4e5083[_0xcb94('0x3d')]['offset']);}_0xd6e704[_0xcb94('0x45')]=qs[_0xcb94('0x46')](_0x4e5083[_0xcb94('0x3d')]['sort']);_0xd6e704['where']=qs[_0xcb94('0x3e')](_[_0xcb94('0x47')](_0x4e5083[_0xcb94('0x3d')],_0x1a9927[_0xcb94('0x3e')]),_0x2af145);if(_0x4e5083[_0xcb94('0x3d')]['filter']){_0xd6e704[_0xcb94('0x48')]=_['merge'](_0xd6e704[_0xcb94('0x48')],{'$or':_[_0xcb94('0x36')](_0x2af145,function(_0x453822){if(_0x453822[_0xcb94('0x3a')]!=='VIRTUAL'){var _0x2e314c={};_0x2e314c[_0x453822['name']]={'$like':'%'+_0x4e5083['query']['filter']+'%'};return _0x2e314c;}})});}_0xd6e704=_[_0xcb94('0x49')]({},_0xd6e704,_0x4e5083['options']);var _0x2f1520={'where':_0xd6e704[_0xcb94('0x48')]};return db[_0xcb94('0x37')][_0xcb94('0x2a')](_0x2f1520)[_0xcb94('0x4a')](function(_0x430030){_0xb30e10[_0xcb94('0x2a')]=_0x430030;if(_0x4e5083[_0xcb94('0x3d')][_0xcb94('0x4b')]){_0xd6e704[_0xcb94('0x4c')]=[{'all':!![]}];}return db[_0xcb94('0x37')][_0xcb94('0x4d')](_0xd6e704);})[_0xcb94('0x4a')](function(_0x3d9024){_0xb30e10['rows']=_0x3d9024;return _0xb30e10;})['then'](respondWithFilteredResult(_0x3ebb7b,_0xd6e704))[_0xcb94('0x4e')](handleError(_0x3ebb7b,null));};exports[_0xcb94('0x4f')]=function(_0x34159c,_0x8018e6){var _0x3cbccc={'raw':![],'where':{'id':_0x34159c[_0xcb94('0x50')]['id']}},_0x110ceb={};_0x110ceb['model']=_['keys'](db[_0xcb94('0x37')][_0xcb94('0x38')]);_0x110ceb['query']=_[_0xcb94('0x51')](_0x34159c[_0xcb94('0x3d')]);_0x110ceb['filters']=_[_0xcb94('0x3f')](_0x110ceb['model'],_0x110ceb[_0xcb94('0x3d')]);_0x3cbccc[_0xcb94('0x40')]=_[_0xcb94('0x3f')](_0x110ceb['model'],qs[_0xcb94('0x41')](_0x34159c[_0xcb94('0x3d')][_0xcb94('0x41')]));_0x3cbccc[_0xcb94('0x40')]=_0x3cbccc['attributes'][_0xcb94('0x42')]?_0x3cbccc['attributes']:_0x110ceb[_0xcb94('0x3c')];if(_0x34159c[_0xcb94('0x3d')]['includeAll']){_0x3cbccc[_0xcb94('0x4c')]=[{'all':!![]}];}_0x3cbccc=_[_0xcb94('0x49')]({},_0x3cbccc,_0x34159c['options']);return db['ZohoAccount']['find'](_0x3cbccc)[_0xcb94('0x4a')](handleEntityNotFound(_0x8018e6,null))[_0xcb94('0x4a')](respondWithResult(_0x8018e6,null))[_0xcb94('0x4e')](handleError(_0x8018e6,null));};exports[_0xcb94('0x52')]=function(_0x42aed1,_0x272121){return db['ZohoAccount']['create'](_0x42aed1[_0xcb94('0x53')],{})[_0xcb94('0x4a')](respondWithResult(_0x272121,0xc9))['catch'](handleError(_0x272121,null));};exports['update']=function(_0x2cb0ee,_0x17c532){if(_0x2cb0ee[_0xcb94('0x53')]['id']){delete _0x2cb0ee[_0xcb94('0x53')]['id'];}return db['ZohoAccount'][_0xcb94('0x54')]({'where':{'id':_0x2cb0ee[_0xcb94('0x50')]['id']}})[_0xcb94('0x4a')](handleEntityNotFound(_0x17c532,null))[_0xcb94('0x4a')](saveUpdates(_0x2cb0ee['body'],null))[_0xcb94('0x4a')](respondWithResult(_0x17c532,null))[_0xcb94('0x4e')](handleError(_0x17c532,null));};exports[_0xcb94('0x31')]=function(_0x2d53a0,_0x14b200){return db[_0xcb94('0x37')]['find']({'where':{'id':_0x2d53a0['params']['id']}})[_0xcb94('0x4a')](handleEntityNotFound(_0x14b200,null))[_0xcb94('0x4a')](removeEntity(_0x14b200,null))[_0xcb94('0x4e')](handleError(_0x14b200,null));};exports[_0xcb94('0x55')]=function(_0x5f1274,_0x129094,_0x4b840c){var _0x523ede={};var _0x81a015={};var _0x279f7a;var _0x206970;return db[_0xcb94('0x37')]['findOne']({'where':{'id':_0x5f1274[_0xcb94('0x50')]['id']}})['then'](handleEntityNotFound(_0x129094,null))[_0xcb94('0x4a')](function(_0xdaf9a3){if(_0xdaf9a3){_0x279f7a=_0xdaf9a3;_0x81a015[_0xcb94('0x3c')]=_['keys'](db['ZohoConfiguration'][_0xcb94('0x38')]);_0x81a015[_0xcb94('0x3d')]=_[_0xcb94('0x51')](_0x5f1274['query']);_0x81a015[_0xcb94('0x3e')]=_[_0xcb94('0x3f')](_0x81a015[_0xcb94('0x3c')],_0x81a015['query']);_0x523ede[_0xcb94('0x40')]=_[_0xcb94('0x3f')](_0x81a015[_0xcb94('0x3c')],qs['fields'](_0x5f1274['query'][_0xcb94('0x41')]));_0x523ede[_0xcb94('0x40')]=_0x523ede['attributes'][_0xcb94('0x42')]?_0x523ede[_0xcb94('0x40')]:_0x81a015[_0xcb94('0x3c')];_0x523ede[_0xcb94('0x45')]=qs[_0xcb94('0x46')](_0x5f1274['query'][_0xcb94('0x46')]);_0x523ede[_0xcb94('0x48')]=qs[_0xcb94('0x3e')](_[_0xcb94('0x47')](_0x5f1274[_0xcb94('0x3d')],_0x81a015['filters']));if(_0x5f1274['query']['filter']){_0x523ede[_0xcb94('0x48')]=_[_0xcb94('0x49')](_0x523ede['where'],{'$or':_[_0xcb94('0x36')](_0x523ede[_0xcb94('0x40')],function(_0x561d5f){var _0x7c60be={};_0x7c60be[_0x561d5f]={'$like':'%'+_0x5f1274['query'][_0xcb94('0x56')]+'%'};return _0x7c60be;})});}_0x523ede=_['merge']({},_0x523ede,_0x5f1274['options']);return _0x279f7a[_0xcb94('0x55')](_0x523ede);}})['then'](function(_0x578f20){if(_0x578f20){_0x206970=_0x578f20[_0xcb94('0x42')];if(!_0x5f1274['query'][_0xcb94('0x43')](_0xcb94('0x57'))){_0x523ede[_0xcb94('0x44')]=qs['limit'](_0x5f1274['query'][_0xcb94('0x44')]);_0x523ede[_0xcb94('0x2b')]=qs[_0xcb94('0x2b')](_0x5f1274['query']['offset']);}return _0x279f7a[_0xcb94('0x55')](_0x523ede);}})['then'](function(_0x57b52d){if(_0x57b52d){return _0x57b52d?{'count':_0x206970,'rows':_0x57b52d}:null;}})[_0xcb94('0x4a')](respondWithResult(_0x129094,null))['catch'](handleError(_0x129094,null));};exports['addConfiguration']=function(_0xa55d1,_0x1921d6,_0x358f02){if(_0xa55d1[_0xcb94('0x53')]['id']){delete _0xa55d1['body']['id'];}return db['ZohoAccount'][_0xcb94('0x58')]({'where':{'id':_0xa55d1[_0xcb94('0x50')]['id']}})['then'](handleEntityNotFound(_0x1921d6,null))[_0xcb94('0x4a')](function(_0x4abf4e){if(_0x4abf4e){_0xa55d1[_0xcb94('0x53')][_0xcb94('0x59')]=_0x4abf4e['id'];_0xa55d1[_0xcb94('0x53')][_0xcb94('0x5a')]=integrations[_0xcb94('0x5b')](_0xa55d1['body']['channel'],_0xa55d1[_0xcb94('0x53')]['type']);_0xa55d1[_0xcb94('0x53')][_0xcb94('0x5c')]=integrations['getDescriptions'](_0xa55d1[_0xcb94('0x53')][_0xcb94('0x5d')],_0xa55d1['body'][_0xcb94('0x3a')]);return db[_0xcb94('0x5e')]['create'](_0xa55d1[_0xcb94('0x53')],{'include':[{'model':db[_0xcb94('0x5f')],'as':_0xcb94('0x5a')},{'model':db['ZohoField'],'as':_0xcb94('0x5c')}]});}return null;})[_0xcb94('0x4a')](respondWithResult(_0x1921d6,null))['catch'](handleError(_0x1921d6,null));};function getAccessToken(_0x2c80f5){return new Promise(function(_0x4d73ab,_0x21cb9a){var _0x46113c;switch(_0x2c80f5['zone']){case'US':_0x46113c=_0xcb94('0x60');break;case'AU':_0x46113c=_0xcb94('0x61');break;case'EU':_0x46113c='https://accounts.zoho.eu';break;case'IN':_0x46113c=_0xcb94('0x62');break;case'CN':_0x46113c=_0xcb94('0x63');break;default:_0x46113c='https://accounts.zoho.eu';break;}var _0x36a5fc={'method':'POST','uri':_0x46113c+_0xcb94('0x64'),'qs':{'refresh_token':_0x2c80f5[_0xcb94('0x65')],'client_id':_0x2c80f5['clientId'],'client_secret':_0x2c80f5['clientSecret'],'grant_type':_0xcb94('0x66')},'json':!![]};return rp(_0x36a5fc)[_0xcb94('0x4a')](function(_0x2328d1){if(_0x2328d1[_0xcb94('0x67')]){_0x4d73ab(_0x2328d1[_0xcb94('0x67')]);}else{_0x21cb9a(_0xcb94('0x68'));}})[_0xcb94('0x4e')](function(_0x354774){_0x21cb9a(_0x354774);});});}exports[_0xcb94('0x69')]=function(_0x3a78e3,_0x5063e7,_0x3a281d){var _0x3a8e65,_0x22a9d1,_0x38d956,_0x27513a,_0x538420;return db[_0xcb94('0x37')][_0xcb94('0x58')]({'where':{'id':_0x3a78e3['params']['id']},'attributes':['id',_0xcb94('0x6a'),_0xcb94('0x6b'),'clientId',_0xcb94('0x6c'),_0xcb94('0x6d'),_0xcb94('0x6e'),_0xcb94('0x65')]})['then'](handleEntityNotFound(_0x5063e7,null))[_0xcb94('0x4a')](function(_0x98ba7e){_0x538420=_0x98ba7e;_0x3a8e65=_0x538420['host'];_0x22a9d1=_0x3a8e65===_0xcb94('0x6f')?'eu':_0xcb94('0x70');_0x38d956=_0x538420['serverUrl'];var _0x4b350f=_0x38d956[_0xcb94('0x71')](-0x1);if(_0x4b350f==='/'||_0x4b350f==='\x5c'||_0x4b350f===':'){_0x38d956=_0x38d956['substring'](0x0,_0x38d956[_0xcb94('0x72')](_0x4b350f));}if(!_0x538420[_0xcb94('0x65')]){throw new Error(_0xcb94('0x73'));}return getAccessToken(_0x538420);})['then'](function(_0x94a248){if(_0x94a248){return rp({'method':_0xcb94('0x74'),'uri':util[_0xcb94('0x75')](_0xcb94('0x76'),_0x22a9d1),'qs':{'module':_0xcb94('0x77')},'headers':{'Authorization':_0xcb94('0x78')+_0x94a248},'json':!![]});}})[_0xcb94('0x4a')](function(_0x16fade){if(_0x16fade){if(_0x16fade[_0xcb94('0x79')]&&_0x16fade[_0xcb94('0x79')][_0xcb94('0x23')]){throw new Error(_0x16fade[_0xcb94('0x79')][_0xcb94('0x23')][_0xcb94('0x24')]);}var _0x529202=[];var _0x21de7e=[];var _0x4438f5=[_0xcb94('0x7a'),_0xcb94('0x7b'),_0xcb94('0x7c'),_0xcb94('0x7d'),_0xcb94('0x7e'),_0xcb94('0x7f'),_0xcb94('0x80'),_0xcb94('0x81')];_0x21de7e=_[_0xcb94('0x82')](_0x16fade[_0xcb94('0x41')],function(_0x379ab3){return _0x4438f5[_0xcb94('0x83')](_0x379ab3['api_name']);});for(var _0x324f01=0x0;_0x324f01<_0x21de7e['length'];_0x324f01++){if(_0x21de7e[_0x324f01]['system_mandatory']===![]){_0x529202['push']({'id':_0x21de7e[_0x324f01]['id'],'name':_0x21de7e[_0x324f01][_0xcb94('0x84')],'custom':_0x21de7e[_0x324f01]['custom_field'],'options':_0x21de7e[_0x324f01]['data_type']===_0xcb94('0x85')&&_0x21de7e[_0x324f01][_0xcb94('0x86')][_0xcb94('0x42')]>-0x1?_[_0xcb94('0x36')](_0x21de7e[_0x324f01][_0xcb94('0x86')],function(_0x152c24){return{'name':_0x152c24,'value':_0x152c24};}):[]});}}return{'count':_0x529202[_0xcb94('0x42')],'rows':_0x529202};}else{return{'count':0x0,'rows':[]};}})[_0xcb94('0x4a')](respondWithResult(_0x5063e7,null))[_0xcb94('0x4e')](function(_0x222f43){var _0x21d14d=_0x3a78e3['query']['test']?0x1f4:_0x222f43[_0xcb94('0x87')]||0x1f4;logger[_0xcb94('0x23')](_0xcb94('0x88'),'getFields',_0x21d14d,JSON[_0xcb94('0x89')](_0x222f43));delete _0x222f43[_0xcb94('0x33')];if(_0x21d14d===0x191){_0x21d14d=0x190;}_0x5063e7['status'](_0x21d14d)['send'](_0x3a78e3['query'][_0xcb94('0x8a')]?{'message':_0xcb94('0x8b'),'statusCode':_0x222f43[_0xcb94('0x87')]}:_0x222f43);});}; \ No newline at end of file +var _0x8ff9=['Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','system_mandatory','push','data_type','pick_list_values','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../components/integrations/configuration','jayson/promise','client','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','getConfigurations','findOne','ZohoConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','clientSecret','serverUrl','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Subject'];(function(_0x1d5557,_0x515aba){var _0x18c8d0=function(_0x675abe){while(--_0x675abe){_0x1d5557['push'](_0x1d5557['shift']());}};_0x18c8d0(++_0x515aba);}(_0x8ff9,0x1a6));var _0x98ff=function(_0x4b1136,_0x3fb19e){_0x4b1136=_0x4b1136-0x0;var _0x1faa45=_0x8ff9[_0x4b1136];return _0x1faa45;};'use strict';var pdf=require(_0x98ff('0x0'));var emlformat=require(_0x98ff('0x1'));var rimraf=require(_0x98ff('0x2'));var zipdir=require(_0x98ff('0x3'));var jsonpatch=require(_0x98ff('0x4'));var rp=require(_0x98ff('0x5'));var moment=require(_0x98ff('0x6'));var BPromise=require(_0x98ff('0x7'));var Mustache=require(_0x98ff('0x8'));var util=require(_0x98ff('0x9'));var path=require(_0x98ff('0xa'));var sox=require('sox');var csv=require(_0x98ff('0xb'));var ejs=require(_0x98ff('0xc'));var fs=require('fs');var _=require(_0x98ff('0xd'));var squel=require(_0x98ff('0xe'));var crypto=require(_0x98ff('0xf'));var jsforce=require(_0x98ff('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x98ff('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x98ff('0x11'));var authService=require(_0x98ff('0x12'));var qs=require(_0x98ff('0x13'));var as=require(_0x98ff('0x14'));var hardwareService=require(_0x98ff('0x15'));var logger=require('../../config/logger')(_0x98ff('0x16'));var utils=require('../../config/utils');var config=require(_0x98ff('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x98ff('0x18'));var jayson=require(_0x98ff('0x19'));var client=jayson[_0x98ff('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd359c2,_0x5b0080,_0x7af35,_0x373e14){return new BPromise(function(_0x2c4e4d,_0x3a7e21){var _0x2aae4d=_0x373e14||client;return _0x2aae4d[_0x98ff('0x1b')](_0xd359c2,_0x7af35)['then'](function(_0x3573a4){logger[_0x98ff('0x1c')](_0x98ff('0x1d'),_0x5b0080,_0x98ff('0x1e'));logger[_0x98ff('0x1f')](_0x98ff('0x20'),_0x5b0080,_0x98ff('0x1e'),JSON[_0x98ff('0x21')](_0x3573a4));if(_0x3573a4[_0x98ff('0x22')]){if(_0x3573a4[_0x98ff('0x22')][_0x98ff('0x23')]===0x1f4){logger[_0x98ff('0x22')](_0x98ff('0x1d'),_0x5b0080,_0x3573a4[_0x98ff('0x22')]['message']);return _0x3a7e21(_0x3573a4[_0x98ff('0x22')][_0x98ff('0x24')]);}logger[_0x98ff('0x22')](_0x98ff('0x1d'),_0x5b0080,_0x3573a4[_0x98ff('0x22')][_0x98ff('0x24')]);return _0x2c4e4d(_0x3573a4[_0x98ff('0x22')][_0x98ff('0x24')]);}else{logger[_0x98ff('0x1c')](_0x98ff('0x1d'),_0x5b0080,_0x98ff('0x1e'));_0x2c4e4d(_0x3573a4[_0x98ff('0x25')][_0x98ff('0x24')]);}})['catch'](function(_0x5155bf){logger['error'](_0x98ff('0x1d'),_0x5b0080,_0x5155bf);_0x3a7e21(_0x5155bf);});});}function respondWithStatusCode(_0x3ee01b,_0x547fab){_0x547fab=_0x547fab||0xcc;return function(_0xd0293e){if(_0xd0293e){return _0x3ee01b['sendStatus'](_0x547fab);}return _0x3ee01b[_0x98ff('0x26')](_0x547fab)[_0x98ff('0x27')]();};}function respondWithResult(_0x308efd,_0x2b3ee9){_0x2b3ee9=_0x2b3ee9||0xc8;return function(_0x4003de){if(_0x4003de){return _0x308efd['status'](_0x2b3ee9)['json'](_0x4003de);}};}function respondWithFilteredResult(_0xf53ff7,_0x1a4ebd){return function(_0x17f6aa){if(_0x17f6aa){var _0x6ccf21=_0x17f6aa[_0x98ff('0x28')],_0x8b7939=_0x1a4ebd[_0x98ff('0x29')],_0x231e00=_0x1a4ebd[_0x98ff('0x29')]+_0x1a4ebd['limit'],_0x1c7fdb;if(_0x231e00>=_0x6ccf21){_0x231e00=_0x6ccf21;_0x1c7fdb=0xc8;}else{_0x1c7fdb=0xce;}_0xf53ff7[_0x98ff('0x26')](_0x1c7fdb);return _0xf53ff7[_0x98ff('0x2a')](_0x98ff('0x2b'),_0x8b7939+'-'+_0x231e00+'/'+_0x6ccf21)[_0x98ff('0x2c')](_0x17f6aa);}return null;};}function patchUpdates(_0x31eeab){return function(_0x3ff688){try{jsonpatch[_0x98ff('0x2d')](_0x3ff688,_0x31eeab,!![]);}catch(_0x41c093){return BPromise[_0x98ff('0x2e')](_0x41c093);}return _0x3ff688[_0x98ff('0x2f')]();};}function saveUpdates(_0x3fa70c,_0x1472cb){return function(_0x257722){if(_0x257722){return _0x257722[_0x98ff('0x30')](_0x3fa70c)[_0x98ff('0x31')](function(_0x81e918){return _0x81e918;});}return null;};}function removeEntity(_0x249807,_0x12d6cc){return function(_0x2c466e){if(_0x2c466e){return _0x2c466e[_0x98ff('0x32')]()[_0x98ff('0x31')](function(){_0x249807['status'](0xcc)[_0x98ff('0x27')]();});}};}function handleEntityNotFound(_0x415432,_0x3bb8cf){return function(_0x1986e3){if(!_0x1986e3){_0x415432[_0x98ff('0x33')](0x194);}return _0x1986e3;};}function handleError(_0x5181f8,_0x22060f){_0x22060f=_0x22060f||0x1f4;return function(_0x56b676){logger[_0x98ff('0x22')](_0x56b676[_0x98ff('0x34')]);if(_0x56b676[_0x98ff('0x35')]){delete _0x56b676[_0x98ff('0x35')];}_0x5181f8[_0x98ff('0x26')](_0x22060f)[_0x98ff('0x36')](_0x56b676);};}exports[_0x98ff('0x37')]=function(_0x4419a7,_0x2f708e){var _0x4640d9={},_0x56cda6={},_0x20c907={'count':0x0,'rows':[]};var _0x322bc2=_[_0x98ff('0x38')](db[_0x98ff('0x39')][_0x98ff('0x3a')],function(_0x6e2f29){return{'name':_0x6e2f29[_0x98ff('0x3b')],'type':_0x6e2f29[_0x98ff('0x3c')]['key']};});_0x56cda6[_0x98ff('0x3d')]=_['map'](_0x322bc2,_0x98ff('0x35'));_0x56cda6[_0x98ff('0x3e')]=_[_0x98ff('0x3f')](_0x4419a7[_0x98ff('0x3e')]);_0x56cda6[_0x98ff('0x40')]=_['intersection'](_0x56cda6['model'],_0x56cda6[_0x98ff('0x3e')]);_0x4640d9[_0x98ff('0x41')]=_[_0x98ff('0x42')](_0x56cda6[_0x98ff('0x3d')],qs[_0x98ff('0x43')](_0x4419a7[_0x98ff('0x3e')][_0x98ff('0x43')]));_0x4640d9['attributes']=_0x4640d9[_0x98ff('0x41')][_0x98ff('0x44')]?_0x4640d9[_0x98ff('0x41')]:_0x56cda6[_0x98ff('0x3d')];if(!_0x4419a7[_0x98ff('0x3e')][_0x98ff('0x45')](_0x98ff('0x46'))){_0x4640d9['limit']=qs[_0x98ff('0x47')](_0x4419a7[_0x98ff('0x3e')][_0x98ff('0x47')]);_0x4640d9[_0x98ff('0x29')]=qs[_0x98ff('0x29')](_0x4419a7['query']['offset']);}_0x4640d9[_0x98ff('0x48')]=qs['sort'](_0x4419a7[_0x98ff('0x3e')][_0x98ff('0x49')]);_0x4640d9[_0x98ff('0x4a')]=qs[_0x98ff('0x40')](_[_0x98ff('0x4b')](_0x4419a7[_0x98ff('0x3e')],_0x56cda6['filters']),_0x322bc2);if(_0x4419a7['query'][_0x98ff('0x4c')]){_0x4640d9['where']=_[_0x98ff('0x4d')](_0x4640d9[_0x98ff('0x4a')],{'$or':_[_0x98ff('0x38')](_0x322bc2,function(_0x1be690){if(_0x1be690[_0x98ff('0x3c')]!==_0x98ff('0x4e')){var _0x5b8f25={};_0x5b8f25[_0x1be690[_0x98ff('0x35')]]={'$like':'%'+_0x4419a7[_0x98ff('0x3e')][_0x98ff('0x4c')]+'%'};return _0x5b8f25;}})});}_0x4640d9=_['merge']({},_0x4640d9,_0x4419a7[_0x98ff('0x4f')]);var _0x454add={'where':_0x4640d9[_0x98ff('0x4a')]};return db[_0x98ff('0x39')][_0x98ff('0x28')](_0x454add)[_0x98ff('0x31')](function(_0x3006f3){_0x20c907[_0x98ff('0x28')]=_0x3006f3;if(_0x4419a7[_0x98ff('0x3e')][_0x98ff('0x50')]){_0x4640d9[_0x98ff('0x51')]=[{'all':!![]}];}return db[_0x98ff('0x39')][_0x98ff('0x52')](_0x4640d9);})[_0x98ff('0x31')](function(_0x44aedb){_0x20c907[_0x98ff('0x53')]=_0x44aedb;return _0x20c907;})['then'](respondWithFilteredResult(_0x2f708e,_0x4640d9))['catch'](handleError(_0x2f708e,null));};exports[_0x98ff('0x54')]=function(_0x4c2b0e,_0x462b54){var _0x8fbd2e={'raw':![],'where':{'id':_0x4c2b0e[_0x98ff('0x55')]['id']}},_0x414152={};_0x414152[_0x98ff('0x3d')]=_[_0x98ff('0x3f')](db[_0x98ff('0x39')][_0x98ff('0x3a')]);_0x414152[_0x98ff('0x3e')]=_['keys'](_0x4c2b0e[_0x98ff('0x3e')]);_0x414152['filters']=_[_0x98ff('0x42')](_0x414152[_0x98ff('0x3d')],_0x414152['query']);_0x8fbd2e[_0x98ff('0x41')]=_[_0x98ff('0x42')](_0x414152['model'],qs[_0x98ff('0x43')](_0x4c2b0e[_0x98ff('0x3e')]['fields']));_0x8fbd2e[_0x98ff('0x41')]=_0x8fbd2e[_0x98ff('0x41')][_0x98ff('0x44')]?_0x8fbd2e[_0x98ff('0x41')]:_0x414152[_0x98ff('0x3d')];if(_0x4c2b0e[_0x98ff('0x3e')]['includeAll']){_0x8fbd2e[_0x98ff('0x51')]=[{'all':!![]}];}_0x8fbd2e=_[_0x98ff('0x4d')]({},_0x8fbd2e,_0x4c2b0e[_0x98ff('0x4f')]);return db[_0x98ff('0x39')][_0x98ff('0x56')](_0x8fbd2e)[_0x98ff('0x31')](handleEntityNotFound(_0x462b54,null))[_0x98ff('0x31')](respondWithResult(_0x462b54,null))[_0x98ff('0x57')](handleError(_0x462b54,null));};exports[_0x98ff('0x58')]=function(_0x2ef341,_0x1d30ea){return db['ZohoAccount']['create'](_0x2ef341[_0x98ff('0x59')],{})[_0x98ff('0x31')](respondWithResult(_0x1d30ea,0xc9))[_0x98ff('0x57')](handleError(_0x1d30ea,null));};exports[_0x98ff('0x30')]=function(_0x39c854,_0xb97b48){if(_0x39c854[_0x98ff('0x59')]['id']){delete _0x39c854[_0x98ff('0x59')]['id'];}return db[_0x98ff('0x39')]['find']({'where':{'id':_0x39c854[_0x98ff('0x55')]['id']}})[_0x98ff('0x31')](handleEntityNotFound(_0xb97b48,null))[_0x98ff('0x31')](saveUpdates(_0x39c854[_0x98ff('0x59')],null))[_0x98ff('0x31')](respondWithResult(_0xb97b48,null))[_0x98ff('0x57')](handleError(_0xb97b48,null));};exports[_0x98ff('0x32')]=function(_0x40f88f,_0x2e0406){return db[_0x98ff('0x39')]['find']({'where':{'id':_0x40f88f['params']['id']}})[_0x98ff('0x31')](handleEntityNotFound(_0x2e0406,null))[_0x98ff('0x31')](removeEntity(_0x2e0406,null))['catch'](handleError(_0x2e0406,null));};exports[_0x98ff('0x5a')]=function(_0x4d290c,_0x4b9ae1,_0x1f4f06){var _0x44a0a0={};var _0x5e3f71={};var _0x4f97c9;var _0x432081;return db[_0x98ff('0x39')][_0x98ff('0x5b')]({'where':{'id':_0x4d290c[_0x98ff('0x55')]['id']}})[_0x98ff('0x31')](handleEntityNotFound(_0x4b9ae1,null))['then'](function(_0x124922){if(_0x124922){_0x4f97c9=_0x124922;_0x5e3f71[_0x98ff('0x3d')]=_[_0x98ff('0x3f')](db[_0x98ff('0x5c')][_0x98ff('0x3a')]);_0x5e3f71[_0x98ff('0x3e')]=_['keys'](_0x4d290c['query']);_0x5e3f71[_0x98ff('0x40')]=_[_0x98ff('0x42')](_0x5e3f71[_0x98ff('0x3d')],_0x5e3f71['query']);_0x44a0a0[_0x98ff('0x41')]=_[_0x98ff('0x42')](_0x5e3f71[_0x98ff('0x3d')],qs[_0x98ff('0x43')](_0x4d290c[_0x98ff('0x3e')][_0x98ff('0x43')]));_0x44a0a0[_0x98ff('0x41')]=_0x44a0a0[_0x98ff('0x41')]['length']?_0x44a0a0[_0x98ff('0x41')]:_0x5e3f71[_0x98ff('0x3d')];_0x44a0a0['order']=qs[_0x98ff('0x49')](_0x4d290c[_0x98ff('0x3e')][_0x98ff('0x49')]);_0x44a0a0[_0x98ff('0x4a')]=qs['filters'](_[_0x98ff('0x4b')](_0x4d290c['query'],_0x5e3f71['filters']));if(_0x4d290c[_0x98ff('0x3e')][_0x98ff('0x4c')]){_0x44a0a0[_0x98ff('0x4a')]=_[_0x98ff('0x4d')](_0x44a0a0[_0x98ff('0x4a')],{'$or':_[_0x98ff('0x38')](_0x44a0a0[_0x98ff('0x41')],function(_0x12bbb){var _0x4880d2={};_0x4880d2[_0x12bbb]={'$like':'%'+_0x4d290c[_0x98ff('0x3e')][_0x98ff('0x4c')]+'%'};return _0x4880d2;})});}_0x44a0a0=_['merge']({},_0x44a0a0,_0x4d290c['options']);return _0x4f97c9['getConfigurations'](_0x44a0a0);}})[_0x98ff('0x31')](function(_0x58c4ab){if(_0x58c4ab){_0x432081=_0x58c4ab[_0x98ff('0x44')];if(!_0x4d290c[_0x98ff('0x3e')][_0x98ff('0x45')](_0x98ff('0x46'))){_0x44a0a0[_0x98ff('0x47')]=qs[_0x98ff('0x47')](_0x4d290c[_0x98ff('0x3e')][_0x98ff('0x47')]);_0x44a0a0[_0x98ff('0x29')]=qs[_0x98ff('0x29')](_0x4d290c[_0x98ff('0x3e')][_0x98ff('0x29')]);}return _0x4f97c9[_0x98ff('0x5a')](_0x44a0a0);}})['then'](function(_0x1fe438){if(_0x1fe438){return _0x1fe438?{'count':_0x432081,'rows':_0x1fe438}:null;}})['then'](respondWithResult(_0x4b9ae1,null))[_0x98ff('0x57')](handleError(_0x4b9ae1,null));};exports['addConfiguration']=function(_0x5ad0ae,_0x50ec35,_0x35f31e){if(_0x5ad0ae[_0x98ff('0x59')]['id']){delete _0x5ad0ae[_0x98ff('0x59')]['id'];}return db[_0x98ff('0x39')]['findOne']({'where':{'id':_0x5ad0ae[_0x98ff('0x55')]['id']}})[_0x98ff('0x31')](handleEntityNotFound(_0x50ec35,null))[_0x98ff('0x31')](function(_0x2595ac){if(_0x2595ac){_0x5ad0ae['body']['AccountId']=_0x2595ac['id'];_0x5ad0ae['body'][_0x98ff('0x5d')]=integrations[_0x98ff('0x5e')](_0x5ad0ae[_0x98ff('0x59')][_0x98ff('0x5f')],_0x5ad0ae[_0x98ff('0x59')]['type']);_0x5ad0ae[_0x98ff('0x59')][_0x98ff('0x60')]=integrations[_0x98ff('0x61')](_0x5ad0ae[_0x98ff('0x59')][_0x98ff('0x5f')],_0x5ad0ae['body'][_0x98ff('0x3c')]);return db['ZohoConfiguration']['create'](_0x5ad0ae[_0x98ff('0x59')],{'include':[{'model':db[_0x98ff('0x62')],'as':_0x98ff('0x5d')},{'model':db[_0x98ff('0x62')],'as':_0x98ff('0x60')}]});}return null;})['then'](respondWithResult(_0x50ec35,null))[_0x98ff('0x57')](handleError(_0x50ec35,null));};function getAccessToken(_0x5f197d){return new Promise(function(_0x5302ac,_0x321f61){var _0x26c80e;switch(_0x5f197d[_0x98ff('0x63')]){case'US':_0x26c80e='https://accounts.zoho.com';break;case'AU':_0x26c80e=_0x98ff('0x64');break;case'EU':_0x26c80e=_0x98ff('0x65');break;case'IN':_0x26c80e=_0x98ff('0x66');break;case'CN':_0x26c80e=_0x98ff('0x67');break;default:_0x26c80e=_0x98ff('0x65');break;}var _0xcf6d0={'method':_0x98ff('0x68'),'uri':_0x26c80e+'/oauth/v2/token','qs':{'refresh_token':_0x5f197d[_0x98ff('0x69')],'client_id':_0x5f197d['clientId'],'client_secret':_0x5f197d['clientSecret'],'grant_type':_0x98ff('0x6a')},'json':!![]};return rp(_0xcf6d0)[_0x98ff('0x31')](function(_0x460bed){if(_0x460bed[_0x98ff('0x6b')]){_0x5302ac(_0x460bed[_0x98ff('0x6b')]);}else{_0x321f61(_0x98ff('0x6c'));}})[_0x98ff('0x57')](function(_0x33acd3){_0x321f61(_0x33acd3);});});}exports[_0x98ff('0x6d')]=function(_0x406949,_0x5efbdc,_0x27dcfe){var _0xf01703,_0x118c84,_0x5274e7,_0x25672b,_0x379d50;return db[_0x98ff('0x39')]['findOne']({'where':{'id':_0x406949[_0x98ff('0x55')]['id']},'attributes':['id',_0x98ff('0x6e'),_0x98ff('0x63'),_0x98ff('0x6f'),_0x98ff('0x70'),_0x98ff('0x71'),_0x98ff('0x23'),_0x98ff('0x69')]})['then'](handleEntityNotFound(_0x5efbdc,null))[_0x98ff('0x31')](function(_0x1b37f2){_0x379d50=_0x1b37f2;_0xf01703=_0x379d50[_0x98ff('0x6e')];_0x118c84=_0xf01703==='zoho.eu'?'eu':'com';_0x5274e7=_0x379d50['serverUrl'];var _0x48dcb5=_0x5274e7['slice'](-0x1);if(_0x48dcb5==='/'||_0x48dcb5==='\x5c'||_0x48dcb5===':'){_0x5274e7=_0x5274e7[_0x98ff('0x72')](0x0,_0x5274e7[_0x98ff('0x73')](_0x48dcb5));}if(!_0x379d50[_0x98ff('0x69')]){throw new Error(_0x98ff('0x74'));}return getAccessToken(_0x379d50);})[_0x98ff('0x31')](function(_0x2a9458){if(_0x2a9458){return rp({'method':'GET','uri':util[_0x98ff('0x75')](_0x98ff('0x76'),_0x118c84),'qs':{'module':_0x98ff('0x77')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2a9458},'json':!![]});}})['then'](function(_0x591239){if(_0x591239){if(_0x591239[_0x98ff('0x78')]&&_0x591239['response'][_0x98ff('0x22')]){throw new Error(_0x591239[_0x98ff('0x78')][_0x98ff('0x22')][_0x98ff('0x24')]);}var _0x52e8af=[];var _0x5279de=[];var _0x4b7100=['Owner',_0x98ff('0x79'),_0x98ff('0x7a'),_0x98ff('0x7b'),_0x98ff('0x7c'),_0x98ff('0x7d'),_0x98ff('0x7e'),_0x98ff('0x7f')];_0x5279de=_['remove'](_0x591239[_0x98ff('0x43')],function(_0x4ba137){return _0x4b7100[_0x98ff('0x80')](_0x4ba137['api_name']);});for(var _0x486e91=0x0;_0x486e91<_0x5279de['length'];_0x486e91++){if(_0x5279de[_0x486e91][_0x98ff('0x81')]===![]){_0x52e8af[_0x98ff('0x82')]({'id':_0x5279de[_0x486e91]['id'],'name':_0x5279de[_0x486e91]['display_label'],'custom':_0x5279de[_0x486e91]['custom_field'],'options':_0x5279de[_0x486e91][_0x98ff('0x83')]==='picklist'&&_0x5279de[_0x486e91][_0x98ff('0x84')][_0x98ff('0x44')]>-0x1?_[_0x98ff('0x38')](_0x5279de[_0x486e91][_0x98ff('0x84')],function(_0x1087aa){return{'name':_0x1087aa,'value':_0x1087aa};}):[]});}}return{'count':_0x52e8af[_0x98ff('0x44')],'rows':_0x52e8af};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x5efbdc,null))['catch'](function(_0x61dcdf){var _0x2321fd=_0x406949[_0x98ff('0x3e')][_0x98ff('0x85')]?0x1f4:_0x61dcdf[_0x98ff('0x86')]||0x1f4;logger[_0x98ff('0x22')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x2321fd,JSON[_0x98ff('0x21')](_0x61dcdf));delete _0x61dcdf[_0x98ff('0x35')];if(_0x2321fd===0x191){_0x2321fd=0x190;}_0x5efbdc[_0x98ff('0x26')](_0x2321fd)[_0x98ff('0x36')](_0x406949[_0x98ff('0x3e')][_0x98ff('0x85')]?{'message':_0x98ff('0x87'),'statusCode':_0x61dcdf[_0x98ff('0x86')]}:_0x61dcdf);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index ca93986..a0b0a74 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 _0x03b3=['catch','error','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','../../config/logger','moment','bluebird','path','rimraf','./intZohoAccount.attributes','define','int_zoho_accounts','changed','zone','clientId','clientSecret','host','serverUrl','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect'];(function(_0x38d405,_0x285127){var _0xb357f7=function(_0x391b95){while(--_0x391b95){_0x38d405['push'](_0x38d405['shift']());}};_0xb357f7(++_0x285127);}(_0x03b3,0x118));var _0x303b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03b3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x303b('0x0'));var util=require('util');var logger=require(_0x303b('0x1'))('api');var moment=require(_0x303b('0x2'));var BPromise=require(_0x303b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x303b('0x4'));var rimraf=require(_0x303b('0x5'));var config=require('../../config/environment');var attributes=require(_0x303b('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x12e499,_0x4e7bf1){return _0x12e499[_0x303b('0x7')]('ZohoAccount',attributes,{'tableName':_0x303b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x49ea3f,_0x4eb50b,_0x4a05d4){if(_0x49ea3f[_0x303b('0x9')](_0x303b('0xa'))||_0x49ea3f[_0x303b('0x9')]('serverUrl')||_0x49ea3f[_0x303b('0x9')](_0x303b('0xb'))||_0x49ea3f[_0x303b('0x9')](_0x303b('0xc'))||_0x49ea3f[_0x303b('0x9')]('code')||_0x49ea3f[_0x303b('0x9')](_0x303b('0xd'))){var _0xe3635f,_0x4bfa61;_0xe3635f=_0x49ea3f[_0x303b('0xe')];var _0x13504b=_0xe3635f[_0x303b('0xf')](-0x1);if(_0x13504b==='/'||_0x13504b==='\x5c'||_0x13504b===':'){_0xe3635f=_0xe3635f['substring'](0x0,_0xe3635f[_0x303b('0x10')](_0x13504b));}switch(_0x49ea3f[_0x303b('0xa')]){case'US':_0x4bfa61=_0x303b('0x11');break;case'AU':_0x4bfa61='https://accounts.zoho.com.au';break;case'IN':_0x4bfa61='https://accounts.zoho.in';break;case'CN':_0x4bfa61='https://accounts.zoho.com.cn';break;default:_0x4bfa61=_0x303b('0x12');break;}var _0x26812d={'method':'POST','uri':_0x4bfa61+_0x303b('0x13'),'form':{'grant_type':_0x303b('0x14'),'client_id':_0x49ea3f[_0x303b('0xb')],'client_secret':_0x49ea3f[_0x303b('0xc')],'redirect_uri':_0x49ea3f[_0x303b('0xe')],'code':_0x49ea3f[_0x303b('0x15')]},'headers':{'Content-Type':_0x303b('0x16')}};return rp(_0x26812d)[_0x303b('0x17')](function(_0x541ba5){var _0x2c1bba=JSON[_0x303b('0x18')](_0x541ba5);if(_0x2c1bba[_0x303b('0x19')]){_0x49ea3f[_0x303b('0x1a')]=_0x2c1bba[_0x303b('0x19')];logger[_0x303b('0x1b')](util[_0x303b('0x1c')](_0x303b('0x1d'),_0x49ea3f['name'],_0x49ea3f['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x49ea3f[_0x303b('0x1e')],_0x49ea3f['id']),util[_0x303b('0x1f')](_0x2c1bba,{'showHidden':![],'depth':null}));}return _0x4a05d4(null,_0x4eb50b);})[_0x303b('0x20')](function(_0x5bd050){logger[_0x303b('0x21')](util[_0x303b('0x1c')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x49ea3f['name'],_0x49ea3f['id']),util[_0x303b('0x1f')](parsedResult,{'showHidden':![],'depth':null}));return _0x4a05d4(_0x5bd050);});}else{return _0x4a05d4(null,_0x4eb50b);}},'beforeUpdate':function(_0x438935,_0x40add7,_0x2e06b1){if(_0x438935[_0x303b('0x9')](_0x303b('0xa'))||_0x438935[_0x303b('0x9')](_0x303b('0xe'))||_0x438935[_0x303b('0x9')]('clientId')||_0x438935[_0x303b('0x9')]('clientSecret')||_0x438935[_0x303b('0x9')](_0x303b('0x15'))||_0x438935[_0x303b('0x9')](_0x303b('0xd'))){var _0x1a6e38,_0x5acfd2;_0x1a6e38=_0x438935[_0x303b('0xe')];var _0x34e00f=_0x1a6e38[_0x303b('0xf')](-0x1);if(_0x34e00f==='/'||_0x34e00f==='\x5c'||_0x34e00f===':'){_0x1a6e38=_0x1a6e38['substring'](0x0,_0x1a6e38['lastIndexOf'](_0x34e00f));}switch(_0x438935[_0x303b('0xa')]){case'US':_0x5acfd2=_0x303b('0x11');break;case'AU':_0x5acfd2=_0x303b('0x22');break;case'IN':_0x5acfd2=_0x303b('0x23');break;case'CN':_0x5acfd2=_0x303b('0x24');break;default:_0x5acfd2='https://accounts.zoho.eu';break;}var _0x353f15={'method':_0x303b('0x25'),'uri':_0x5acfd2+_0x303b('0x13'),'form':{'grant_type':'authorization_code','client_id':_0x438935[_0x303b('0xb')],'client_secret':_0x438935['clientSecret'],'redirect_uri':_0x438935[_0x303b('0xe')],'code':_0x438935[_0x303b('0x15')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x353f15)[_0x303b('0x17')](function(_0x4daa20){var _0x1af595=JSON[_0x303b('0x18')](_0x4daa20);if(_0x1af595[_0x303b('0x19')]){_0x438935[_0x303b('0x1a')]=_0x1af595[_0x303b('0x19')];logger[_0x303b('0x1b')](util[_0x303b('0x1c')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x438935[_0x303b('0x1e')],_0x438935['id']));}else{logger['error'](util['format'](_0x303b('0x26'),_0x438935[_0x303b('0x1e')],_0x438935['id']),util[_0x303b('0x1f')](_0x1af595,{'showHidden':![],'depth':null}));}return _0x2e06b1(null,_0x40add7);})['catch'](function(_0x21574c){logger['error'](util[_0x303b('0x1c')](_0x303b('0x26'),_0x438935['name'],_0x438935['id']),util[_0x303b('0x1f')](parsedResult,{'showHidden':![],'depth':null}));return _0x2e06b1(_0x21574c);});}else{return _0x2e06b1(null,_0x40add7);}}}});}; \ No newline at end of file +var _0x829b=['serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','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','catch','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','int_zoho_accounts','changed','zone'];(function(_0x449255,_0x4a1c64){var _0x92cd9f=function(_0x1f70c1){while(--_0x1f70c1){_0x449255['push'](_0x449255['shift']());}};_0x92cd9f(++_0x4a1c64);}(_0x829b,0x70));var _0xb829=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x829b[_0x36ed3c];return _0x52a2e0;};'use strict';var _=require('lodash');var util=require(_0xb829('0x0'));var logger=require(_0xb829('0x1'))(_0xb829('0x2'));var moment=require(_0xb829('0x3'));var BPromise=require(_0xb829('0x4'));var rp=require(_0xb829('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb829('0x6'));var config=require('../../config/environment');var attributes=require(_0xb829('0x7'));var integrations=require(_0xb829('0x8'));module[_0xb829('0x9')]=function(_0x1937e5,_0x778744){return _0x1937e5[_0xb829('0xa')]('ZohoAccount',attributes,{'tableName':_0xb829('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x46a8d7,_0x40ea2a,_0x4d073e){if(_0x46a8d7[_0xb829('0xc')](_0xb829('0xd'))||_0x46a8d7[_0xb829('0xc')](_0xb829('0xe'))||_0x46a8d7[_0xb829('0xc')](_0xb829('0xf'))||_0x46a8d7[_0xb829('0xc')](_0xb829('0x10'))||_0x46a8d7[_0xb829('0xc')](_0xb829('0x11'))||_0x46a8d7[_0xb829('0xc')](_0xb829('0x12'))){var _0x41ed3a,_0x13591b;_0x41ed3a=_0x46a8d7['serverUrl'];var _0x3dd7d1=_0x41ed3a[_0xb829('0x13')](-0x1);if(_0x3dd7d1==='/'||_0x3dd7d1==='\x5c'||_0x3dd7d1===':'){_0x41ed3a=_0x41ed3a[_0xb829('0x14')](0x0,_0x41ed3a[_0xb829('0x15')](_0x3dd7d1));}switch(_0x46a8d7[_0xb829('0xd')]){case'US':_0x13591b=_0xb829('0x16');break;case'AU':_0x13591b=_0xb829('0x17');break;case'IN':_0x13591b=_0xb829('0x18');break;case'CN':_0x13591b=_0xb829('0x19');break;default:_0x13591b='https://accounts.zoho.eu';break;}var _0x4e1f67={'method':'POST','uri':_0x13591b+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x46a8d7[_0xb829('0xf')],'client_secret':_0x46a8d7['clientSecret'],'redirect_uri':_0x46a8d7[_0xb829('0xe')],'code':_0x46a8d7[_0xb829('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x4e1f67)[_0xb829('0x1a')](function(_0x566fdf){var _0x4d7d6d=JSON[_0xb829('0x1b')](_0x566fdf);if(_0x4d7d6d[_0xb829('0x1c')]){_0x46a8d7[_0xb829('0x1d')]=_0x4d7d6d[_0xb829('0x1c')];logger[_0xb829('0x1e')](util[_0xb829('0x1f')](_0xb829('0x20'),_0x46a8d7[_0xb829('0x21')],_0x46a8d7['id']));}else{logger[_0xb829('0x22')](util[_0xb829('0x1f')](_0xb829('0x23'),_0x46a8d7['name'],_0x46a8d7['id']),util[_0xb829('0x24')](_0x4d7d6d,{'showHidden':![],'depth':null}));}return _0x4d073e(null,_0x40ea2a);})[_0xb829('0x25')](function(_0xb28189){logger[_0xb829('0x22')](util['format'](_0xb829('0x23'),_0x46a8d7['name'],_0x46a8d7['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x4d073e(_0xb28189);});}else{return _0x4d073e(null,_0x40ea2a);}},'beforeUpdate':function(_0x1e2a64,_0x1b21ba,_0x405cbc){if(_0x1e2a64[_0xb829('0xc')](_0xb829('0xd'))||_0x1e2a64['changed'](_0xb829('0xe'))||_0x1e2a64[_0xb829('0xc')](_0xb829('0xf'))||_0x1e2a64[_0xb829('0xc')]('clientSecret')||_0x1e2a64[_0xb829('0xc')]('code')||_0x1e2a64[_0xb829('0xc')]('host')){var _0x17bc4b,_0x4e479c;_0x17bc4b=_0x1e2a64[_0xb829('0xe')];var _0xfcef5e=_0x17bc4b['slice'](-0x1);if(_0xfcef5e==='/'||_0xfcef5e==='\x5c'||_0xfcef5e===':'){_0x17bc4b=_0x17bc4b[_0xb829('0x14')](0x0,_0x17bc4b['lastIndexOf'](_0xfcef5e));}switch(_0x1e2a64[_0xb829('0xd')]){case'US':_0x4e479c=_0xb829('0x16');break;case'AU':_0x4e479c='https://accounts.zoho.com.au';break;case'IN':_0x4e479c=_0xb829('0x18');break;case'CN':_0x4e479c=_0xb829('0x19');break;default:_0x4e479c='https://accounts.zoho.eu';break;}var _0x192ceb={'method':_0xb829('0x26'),'uri':_0x4e479c+_0xb829('0x27'),'form':{'grant_type':_0xb829('0x28'),'client_id':_0x1e2a64['clientId'],'client_secret':_0x1e2a64[_0xb829('0x10')],'redirect_uri':_0x1e2a64[_0xb829('0xe')],'code':_0x1e2a64['code']},'headers':{'Content-Type':_0xb829('0x29')}};return rp(_0x192ceb)['then'](function(_0x224523){var _0x588d68=JSON[_0xb829('0x1b')](_0x224523);if(_0x588d68[_0xb829('0x1c')]){_0x1e2a64[_0xb829('0x1d')]=_0x588d68[_0xb829('0x1c')];logger[_0xb829('0x1e')](util[_0xb829('0x1f')](_0xb829('0x20'),_0x1e2a64[_0xb829('0x21')],_0x1e2a64['id']));}else{logger[_0xb829('0x22')](util[_0xb829('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1e2a64['name'],_0x1e2a64['id']),util[_0xb829('0x24')](_0x588d68,{'showHidden':![],'depth':null}));}return _0x405cbc(null,_0x1b21ba);})[_0xb829('0x25')](function(_0x1ecc0b){logger[_0xb829('0x22')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1e2a64['name'],_0x1e2a64['id']),util[_0xb829('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x405cbc(_0x1ecc0b);});}else{return _0x405cbc(null,_0x1b21ba);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 1db5fc9..6410b34 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 _0x4cbd=['ZohoAccount,\x20%s,\x20%s','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetZohoAccount','ZohoAccount','findAll','options','where','attributes','limit','include','map','model','stringify','ShowZohoAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x30c92a,_0x28c148){var _0x3fbc6d=function(_0x3e3079){while(--_0x3e3079){_0x30c92a['push'](_0x30c92a['shift']());}};_0x3fbc6d(++_0x28c148);}(_0x4cbd,0xa9));var _0xd4cb=function(_0xdc0397,_0x20d1f1){_0xdc0397=_0xdc0397-0x0;var _0x553d02=_0x4cbd[_0xdc0397];return _0x553d02;};'use strict';var _=require(_0xd4cb('0x0'));var util=require(_0xd4cb('0x1'));var moment=require(_0xd4cb('0x2'));var BPromise=require(_0xd4cb('0x3'));var rs=require(_0xd4cb('0x4'));var fs=require('fs');var Redis=require(_0xd4cb('0x5'));var db=require(_0xd4cb('0x6'))['db'];var utils=require(_0xd4cb('0x7'));var logger=require(_0xd4cb('0x8'))(_0xd4cb('0x9'));var config=require('../../config/environment');var jayson=require(_0xd4cb('0xa'));var client=jayson[_0xd4cb('0xb')][_0xd4cb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf84e6c,_0x22747d,_0x323bfa){return new BPromise(function(_0x29ab66,_0x127a13){return client[_0xd4cb('0xd')](_0xf84e6c,_0x323bfa)[_0xd4cb('0xe')](function(_0x14fba9){logger[_0xd4cb('0xf')](_0xd4cb('0x10'),_0x22747d,'request\x20sent');logger['debug'](_0xd4cb('0x11'),_0x22747d,_0xd4cb('0x12'),JSON['stringify'](_0x14fba9));if(_0x14fba9[_0xd4cb('0x13')]){if(_0x14fba9['error'][_0xd4cb('0x14')]===0x1f4){logger[_0xd4cb('0x13')](_0xd4cb('0x10'),_0x22747d,_0x14fba9[_0xd4cb('0x13')][_0xd4cb('0x15')]);return _0x127a13(_0x14fba9[_0xd4cb('0x13')][_0xd4cb('0x15')]);}logger[_0xd4cb('0x13')](_0xd4cb('0x10'),_0x22747d,_0x14fba9['error']['message']);return _0x29ab66(_0x14fba9[_0xd4cb('0x13')]['message']);}else{logger[_0xd4cb('0xf')](_0xd4cb('0x10'),_0x22747d,_0xd4cb('0x12'));_0x29ab66(_0x14fba9['result'][_0xd4cb('0x15')]);}})[_0xd4cb('0x16')](function(_0x200cb9){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x22747d,_0x200cb9);_0x127a13(_0x200cb9);});});}exports[_0xd4cb('0x17')]=function(_0x1a7ca3){var _0x109880=this;return new Promise(function(_0x3c2d65,_0x2eb10d){return db[_0xd4cb('0x18')][_0xd4cb('0x19')]({'raw':_0x1a7ca3[_0xd4cb('0x1a')]?_0x1a7ca3[_0xd4cb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1a7ca3[_0xd4cb('0x1a')]?_0x1a7ca3[_0xd4cb('0x1a')][_0xd4cb('0x1b')]||null:null,'attributes':_0x1a7ca3[_0xd4cb('0x1a')]?_0x1a7ca3[_0xd4cb('0x1a')][_0xd4cb('0x1c')]||null:null,'limit':_0x1a7ca3[_0xd4cb('0x1a')]?_0x1a7ca3[_0xd4cb('0x1a')][_0xd4cb('0x1d')]||null:null,'include':_0x1a7ca3['options']?_0x1a7ca3[_0xd4cb('0x1a')][_0xd4cb('0x1e')]?_[_0xd4cb('0x1f')](_0x1a7ca3[_0xd4cb('0x1a')][_0xd4cb('0x1e')],function(_0x3fe3e5){return{'model':db[_0x3fe3e5[_0xd4cb('0x20')]],'as':_0x3fe3e5['as'],'attributes':_0x3fe3e5[_0xd4cb('0x1c')],'include':_0x3fe3e5[_0xd4cb('0x1e')]?_[_0xd4cb('0x1f')](_0x3fe3e5[_0xd4cb('0x1e')],function(_0x2942c3){return{'model':db[_0x2942c3[_0xd4cb('0x20')]],'as':_0x2942c3['as'],'attributes':_0x2942c3[_0xd4cb('0x1c')],'include':_0x2942c3['include']?_[_0xd4cb('0x1f')](_0x2942c3['include'],function(_0x1e21d2){return{'model':db[_0x1e21d2['model']],'as':_0x1e21d2['as'],'attributes':_0x1e21d2[_0xd4cb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd4cb('0xe')](function(_0x858271){logger[_0xd4cb('0xf')](_0xd4cb('0x17'),_0x1a7ca3);logger['debug'](_0xd4cb('0x17'),_0x1a7ca3,JSON[_0xd4cb('0x21')](_0x858271));_0x3c2d65(_0x858271);})[_0xd4cb('0x16')](function(_0x5b42cb){logger['error'](_0xd4cb('0x17'),_0x5b42cb[_0xd4cb('0x15')],_0x1a7ca3);_0x2eb10d(_0x109880[_0xd4cb('0x13')](0x1f4,_0x5b42cb['message']));});});};exports[_0xd4cb('0x22')]=function(_0x5ef103){var _0xc6fa26=this;return new Promise(function(_0x4cb7aa,_0x44c34a){return db['ZohoAccount'][_0xd4cb('0x23')]({'raw':_0x5ef103[_0xd4cb('0x1a')]?_0x5ef103[_0xd4cb('0x1a')][_0xd4cb('0x24')]===undefined?!![]:![]:!![],'where':_0x5ef103['options']?_0x5ef103[_0xd4cb('0x1a')][_0xd4cb('0x1b')]||null:null,'attributes':_0x5ef103[_0xd4cb('0x1a')]?_0x5ef103[_0xd4cb('0x1a')][_0xd4cb('0x1c')]||null:null,'include':_0x5ef103[_0xd4cb('0x1a')]?_0x5ef103[_0xd4cb('0x1a')][_0xd4cb('0x1e')]?_['map'](_0x5ef103[_0xd4cb('0x1a')][_0xd4cb('0x1e')],function(_0x58f59b){return{'model':db[_0x58f59b[_0xd4cb('0x20')]],'as':_0x58f59b['as'],'attributes':_0x58f59b['attributes'],'include':_0x58f59b['include']?_[_0xd4cb('0x1f')](_0x58f59b[_0xd4cb('0x1e')],function(_0xfd3983){return{'model':db[_0xfd3983[_0xd4cb('0x20')]],'as':_0xfd3983['as'],'attributes':_0xfd3983['attributes'],'include':_0xfd3983[_0xd4cb('0x1e')]?_[_0xd4cb('0x1f')](_0xfd3983['include'],function(_0x33ab4c){return{'model':db[_0x33ab4c[_0xd4cb('0x20')]],'as':_0x33ab4c['as'],'attributes':_0x33ab4c[_0xd4cb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd4cb('0xe')](function(_0x22e06e){logger[_0xd4cb('0xf')](_0xd4cb('0x22'),_0x5ef103);logger['debug']('ShowZohoAccount',_0x5ef103,JSON[_0xd4cb('0x21')](_0x22e06e));_0x4cb7aa(_0x22e06e);})[_0xd4cb('0x16')](function(_0xd3f12d){logger[_0xd4cb('0x13')](_0xd4cb('0x22'),_0xd3f12d[_0xd4cb('0x15')],_0x5ef103);_0x44c34a(_0xc6fa26[_0xd4cb('0x13')](0x1f4,_0xd3f12d[_0xd4cb('0x15')]));});});}; \ No newline at end of file +var _0xb0ca=['http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','ShowZohoAccount','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0xf98e2,_0x278b2c){var _0x4af687=function(_0x1885d2){while(--_0x1885d2){_0xf98e2['push'](_0xf98e2['shift']());}};_0x4af687(++_0x278b2c);}(_0xb0ca,0x1b2));var _0xab0c=function(_0x53830a,_0x3bf2dd){_0x53830a=_0x53830a-0x0;var _0x332a14=_0xb0ca[_0x53830a];return _0x332a14;};'use strict';var _=require('lodash');var util=require(_0xab0c('0x0'));var moment=require('moment');var BPromise=require(_0xab0c('0x1'));var rs=require(_0xab0c('0x2'));var fs=require('fs');var Redis=require(_0xab0c('0x3'));var db=require(_0xab0c('0x4'))['db'];var utils=require(_0xab0c('0x5'));var logger=require(_0xab0c('0x6'))(_0xab0c('0x7'));var config=require('../../config/environment');var jayson=require(_0xab0c('0x8'));var client=jayson[_0xab0c('0x9')][_0xab0c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x871446,_0x4902a7,_0xbe11d1){return new BPromise(function(_0x50d3de,_0x22ebb5){return client[_0xab0c('0xb')](_0x871446,_0xbe11d1)['then'](function(_0x5172cd){logger[_0xab0c('0xc')](_0xab0c('0xd'),_0x4902a7,_0xab0c('0xe'));logger[_0xab0c('0xf')](_0xab0c('0x10'),_0x4902a7,'request\x20sent',JSON[_0xab0c('0x11')](_0x5172cd));if(_0x5172cd['error']){if(_0x5172cd[_0xab0c('0x12')][_0xab0c('0x13')]===0x1f4){logger[_0xab0c('0x12')](_0xab0c('0xd'),_0x4902a7,_0x5172cd[_0xab0c('0x12')][_0xab0c('0x14')]);return _0x22ebb5(_0x5172cd[_0xab0c('0x12')][_0xab0c('0x14')]);}logger[_0xab0c('0x12')](_0xab0c('0xd'),_0x4902a7,_0x5172cd['error']['message']);return _0x50d3de(_0x5172cd[_0xab0c('0x12')][_0xab0c('0x14')]);}else{logger[_0xab0c('0xc')](_0xab0c('0xd'),_0x4902a7,_0xab0c('0xe'));_0x50d3de(_0x5172cd[_0xab0c('0x15')][_0xab0c('0x14')]);}})[_0xab0c('0x16')](function(_0x3b80db){logger[_0xab0c('0x12')](_0xab0c('0xd'),_0x4902a7,_0x3b80db);_0x22ebb5(_0x3b80db);});});}exports[_0xab0c('0x17')]=function(_0x32931b){var _0x13d657=this;return new Promise(function(_0x3c8e62,_0x433777){return db[_0xab0c('0x18')][_0xab0c('0x19')]({'raw':_0x32931b[_0xab0c('0x1a')]?_0x32931b['options'][_0xab0c('0x1b')]===undefined?!![]:![]:!![],'where':_0x32931b['options']?_0x32931b[_0xab0c('0x1a')][_0xab0c('0x1c')]||null:null,'attributes':_0x32931b[_0xab0c('0x1a')]?_0x32931b[_0xab0c('0x1a')][_0xab0c('0x1d')]||null:null,'limit':_0x32931b[_0xab0c('0x1a')]?_0x32931b['options'][_0xab0c('0x1e')]||null:null,'include':_0x32931b[_0xab0c('0x1a')]?_0x32931b[_0xab0c('0x1a')]['include']?_[_0xab0c('0x1f')](_0x32931b['options'][_0xab0c('0x20')],function(_0x1cc6c4){return{'model':db[_0x1cc6c4[_0xab0c('0x21')]],'as':_0x1cc6c4['as'],'attributes':_0x1cc6c4['attributes'],'include':_0x1cc6c4[_0xab0c('0x20')]?_[_0xab0c('0x1f')](_0x1cc6c4['include'],function(_0x25479a){return{'model':db[_0x25479a[_0xab0c('0x21')]],'as':_0x25479a['as'],'attributes':_0x25479a[_0xab0c('0x1d')],'include':_0x25479a[_0xab0c('0x20')]?_[_0xab0c('0x1f')](_0x25479a[_0xab0c('0x20')],function(_0x3f12d4){return{'model':db[_0x3f12d4[_0xab0c('0x21')]],'as':_0x3f12d4['as'],'attributes':_0x3f12d4[_0xab0c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xab0c('0x22')](function(_0x8b2234){logger[_0xab0c('0xc')](_0xab0c('0x17'),_0x32931b);logger['debug'](_0xab0c('0x17'),_0x32931b,JSON[_0xab0c('0x11')](_0x8b2234));_0x3c8e62(_0x8b2234);})[_0xab0c('0x16')](function(_0x233e48){logger['error']('GetZohoAccount',_0x233e48['message'],_0x32931b);_0x433777(_0x13d657['error'](0x1f4,_0x233e48[_0xab0c('0x14')]));});});};exports[_0xab0c('0x23')]=function(_0x3d1207){var _0x3e6b6e=this;return new Promise(function(_0xc34b9a,_0x4c441e){return db['ZohoAccount'][_0xab0c('0x24')]({'raw':_0x3d1207[_0xab0c('0x1a')]?_0x3d1207[_0xab0c('0x1a')][_0xab0c('0x1b')]===undefined?!![]:![]:!![],'where':_0x3d1207[_0xab0c('0x1a')]?_0x3d1207['options']['where']||null:null,'attributes':_0x3d1207['options']?_0x3d1207[_0xab0c('0x1a')][_0xab0c('0x1d')]||null:null,'include':_0x3d1207[_0xab0c('0x1a')]?_0x3d1207[_0xab0c('0x1a')][_0xab0c('0x20')]?_[_0xab0c('0x1f')](_0x3d1207[_0xab0c('0x1a')][_0xab0c('0x20')],function(_0x4eb32e){return{'model':db[_0x4eb32e[_0xab0c('0x21')]],'as':_0x4eb32e['as'],'attributes':_0x4eb32e[_0xab0c('0x1d')],'include':_0x4eb32e[_0xab0c('0x20')]?_[_0xab0c('0x1f')](_0x4eb32e['include'],function(_0x211e08){return{'model':db[_0x211e08[_0xab0c('0x21')]],'as':_0x211e08['as'],'attributes':_0x211e08[_0xab0c('0x1d')],'include':_0x211e08[_0xab0c('0x20')]?_[_0xab0c('0x1f')](_0x211e08['include'],function(_0x5d5633){return{'model':db[_0x5d5633['model']],'as':_0x5d5633['as'],'attributes':_0x5d5633['attributes']};}):[]};}):[]};}):[]:[]})[_0xab0c('0x22')](function(_0x51fe47){logger['info'](_0xab0c('0x23'),_0x3d1207);logger[_0xab0c('0xf')](_0xab0c('0x23'),_0x3d1207,JSON[_0xab0c('0x11')](_0x51fe47));_0xc34b9a(_0x51fe47);})['catch'](function(_0x2db79e){logger[_0xab0c('0x12')](_0xab0c('0x23'),_0x2db79e[_0xab0c('0x14')],_0x3d1207);_0x4c441e(_0x3e6b6e['error'](0x1f4,_0x2db79e[_0xab0c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index d4b0d90..ab64797 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 _0x91a7=['update','delete','destroy','util','path','connect-timeout','Router','../../components/interaction/service','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put'];(function(_0x324e14,_0x1d648b){var _0x1528cb=function(_0x4820c2){while(--_0x4820c2){_0x324e14['push'](_0x324e14['shift']());}};_0x1528cb(++_0x1d648b);}(_0x91a7,0xe7));var _0x791a=function(_0x1ca385,_0x168653){_0x1ca385=_0x1ca385-0x0;var _0x1ea84e=_0x91a7[_0x1ca385];return _0x1ea84e;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x791a('0x4'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0x791a('0x5')]('/',auth[_0x791a('0x6')](),controller['index']);router[_0x791a('0x5')]('/:id',auth[_0x791a('0x6')](),controller[_0x791a('0x7')]);router['get'](_0x791a('0x8'),auth[_0x791a('0x6')](),controller[_0x791a('0x9')]);router[_0x791a('0x5')](_0x791a('0xa'),auth['isAuthenticated'](),controller[_0x791a('0xb')]);router[_0x791a('0x5')]('/:id/descriptions',auth[_0x791a('0x6')](),controller[_0x791a('0xc')]);router[_0x791a('0xd')]('/',auth[_0x791a('0x6')](),controller[_0x791a('0xe')]);router[_0x791a('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x791a('0x10')]);router[_0x791a('0x11')]('/:id',auth[_0x791a('0x6')](),controller[_0x791a('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0713=['post','create','put','update','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x4bcee1,_0x38a21f){var _0x437fc3=function(_0x57a39d){while(--_0x57a39d){_0x4bcee1['push'](_0x4bcee1['shift']());}};_0x437fc3(++_0x38a21f);}(_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('0x12')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x13')]);router[_0x3071('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x3071('0x15')]);router['delete'](_0x3071('0xa'),auth[_0x3071('0x8')](),controller['destroy']);module[_0x3071('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 90564aa..c06abb6 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 _0xc2e6=['exports','STRING','ENUM','lead','contact','contact_lead','sequelize'];(function(_0x25d298,_0x456ccc){var _0x2a5700=function(_0x59689c){while(--_0x59689c){_0x25d298['push'](_0x25d298['shift']());}};_0x2a5700(++_0x456ccc);}(_0xc2e6,0xdf));var _0x6c2e=function(_0x18ba26,_0x4c142c){_0x18ba26=_0x18ba26-0x0;var _0x58ad0c=_0xc2e6[_0x18ba26];return _0x58ad0c;};'use strict';var Sequelize=require(_0x6c2e('0x0'));module[_0x6c2e('0x1')]={'name':{'type':Sequelize[_0x6c2e('0x2')]},'moduleCreate':{'type':Sequelize[_0x6c2e('0x3')](_0x6c2e('0x4'),_0x6c2e('0x5'),'nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x6c2e('0x3')](_0x6c2e('0x6'),_0x6c2e('0x5'),_0x6c2e('0x4')),'defaultValue':_0x6c2e('0x6')},'description':{'type':Sequelize[_0x6c2e('0x2')]}}; \ No newline at end of file +var _0xdf06=['contact','sequelize','STRING','ENUM','lead','nothing','contact_lead'];(function(_0x414e22,_0x2bd0ac){var _0x39d323=function(_0x35a2f8){while(--_0x35a2f8){_0x414e22['push'](_0x414e22['shift']());}};_0x39d323(++_0x2bd0ac);}(_0xdf06,0x8d));var _0x6df0=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xdf06[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0x6df0('0x0'));module['exports']={'name':{'type':Sequelize[_0x6df0('0x1')]},'moduleCreate':{'type':Sequelize[_0x6df0('0x2')](_0x6df0('0x3'),'contact',_0x6df0('0x4')),'defaultValue':_0x6df0('0x3')},'moduleSearch':{'type':Sequelize[_0x6df0('0x2')](_0x6df0('0x5'),_0x6df0('0x6'),_0x6df0('0x3')),'defaultValue':_0x6df0('0x5')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 02ab78c..cc58ea6 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(_0x374ccf,_0xa945c4){var _0x443cde=function(_0x27ff10){while(--_0x27ff10){_0x374ccf['push'](_0x374ccf['shift']());}};_0x443cde(++_0xa945c4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];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(_0x5c811c,_0x313b25){var _0x5df3af=function(_0x3460de){while(--_0x3460de){_0x5c811c['push'](_0x5c811c['shift']());}};_0x5df3af(++_0x313b25);}(_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 diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index eeb5dc3..ecb86d0 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 _0xbf25=['api','moment','bluebird','request-promise','path','rimraf','exports','int_zoho_configurations','lodash','util','../../config/logger'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xbf25,0x17e));var _0x5bf2=function(_0x1e7d51,_0xc3c519){_0x1e7d51=_0x1e7d51-0x0;var _0x28d842=_0xbf25[_0x1e7d51];return _0x28d842;};'use strict';var _=require(_0x5bf2('0x0'));var util=require(_0x5bf2('0x1'));var logger=require(_0x5bf2('0x2'))(_0x5bf2('0x3'));var moment=require(_0x5bf2('0x4'));var BPromise=require(_0x5bf2('0x5'));var rp=require(_0x5bf2('0x6'));var fs=require('fs');var path=require(_0x5bf2('0x7'));var rimraf=require(_0x5bf2('0x8'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0x5bf2('0x9')]=function(_0x37f448,_0x597d17){return _0x37f448['define']('ZohoConfiguration',attributes,{'tableName':_0x5bf2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0596=['int_zoho_configurations','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x0596,0x79));var _0x6059=function(_0x56e969,_0x2ed835){_0x56e969=_0x56e969-0x0;var _0x6577af=_0x0596[_0x56e969];return _0x6577af;};'use strict';var _=require(_0x6059('0x0'));var util=require('util');var logger=require(_0x6059('0x1'))(_0x6059('0x2'));var moment=require(_0x6059('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6059('0x4'));var rimraf=require(_0x6059('0x5'));var config=require(_0x6059('0x6'));var attributes=require(_0x6059('0x7'));module[_0x6059('0x8')]=function(_0x73b022,_0x237ce9){return _0x73b022[_0x6059('0x9')](_0x6059('0xa'),attributes,{'tableName':_0x6059('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 71d1595..cdc7cae 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 _0x453c=['client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4a69b2,_0x17fee7){var _0x32699d=function(_0x31f94a){while(--_0x31f94a){_0x4a69b2['push'](_0x4a69b2['shift']());}};_0x32699d(++_0x17fee7);}(_0x453c,0x15d));var _0xc453=function(_0x305c31,_0x466b17){_0x305c31=_0x305c31-0x0;var _0x17f39f=_0x453c[_0x305c31];return _0x17f39f;};'use strict';var _=require(_0xc453('0x0'));var util=require('util');var moment=require(_0xc453('0x1'));var BPromise=require('bluebird');var rs=require(_0xc453('0x2'));var fs=require('fs');var Redis=require(_0xc453('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc453('0x4'))(_0xc453('0x5'));var config=require(_0xc453('0x6'));var jayson=require(_0xc453('0x7'));var client=jayson[_0xc453('0x8')][_0xc453('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15cdda,_0x386d3f,_0x3a2492){return new BPromise(function(_0x2b36c2,_0x59b5de){return client['request'](_0x15cdda,_0x3a2492)[_0xc453('0xa')](function(_0xd1f15f){logger[_0xc453('0xb')](_0xc453('0xc'),_0x386d3f,_0xc453('0xd'));logger[_0xc453('0xe')](_0xc453('0xf'),_0x386d3f,_0xc453('0xd'),JSON[_0xc453('0x10')](_0xd1f15f));if(_0xd1f15f[_0xc453('0x11')]){if(_0xd1f15f[_0xc453('0x11')][_0xc453('0x12')]===0x1f4){logger['error'](_0xc453('0xc'),_0x386d3f,_0xd1f15f['error'][_0xc453('0x13')]);return _0x59b5de(_0xd1f15f[_0xc453('0x11')][_0xc453('0x13')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x386d3f,_0xd1f15f[_0xc453('0x11')][_0xc453('0x13')]);return _0x2b36c2(_0xd1f15f[_0xc453('0x11')][_0xc453('0x13')]);}else{logger['info'](_0xc453('0xc'),_0x386d3f,'request\x20sent');_0x2b36c2(_0xd1f15f['result']['message']);}})[_0xc453('0x14')](function(_0x1eba5c){logger[_0xc453('0x11')](_0xc453('0xc'),_0x386d3f,_0x1eba5c);_0x59b5de(_0x1eba5c);});});} \ No newline at end of file +var _0x39f1=['result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x55f72a,_0x37f652){var _0x33400a=function(_0x277cba){while(--_0x277cba){_0x55f72a['push'](_0x55f72a['shift']());}};_0x33400a(++_0x37f652);}(_0x39f1,0x1a4));var _0x139f=function(_0x1f4d6d,_0x5d75cb){_0x1f4d6d=_0x1f4d6d-0x0;var _0x3316a8=_0x39f1[_0x1f4d6d];return _0x3316a8;};'use strict';var _=require('lodash');var util=require(_0x139f('0x0'));var moment=require(_0x139f('0x1'));var BPromise=require(_0x139f('0x2'));var rs=require(_0x139f('0x3'));var fs=require('fs');var Redis=require(_0x139f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x139f('0x5'));var logger=require(_0x139f('0x6'))(_0x139f('0x7'));var config=require(_0x139f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x139f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c9d61,_0x43fb3c,_0x3778f3){return new BPromise(function(_0x4a3e4a,_0x29308f){return client[_0x139f('0xa')](_0x1c9d61,_0x3778f3)[_0x139f('0xb')](function(_0x17b25b){logger[_0x139f('0xc')](_0x139f('0xd'),_0x43fb3c,'request\x20sent');logger[_0x139f('0xe')](_0x139f('0xf'),_0x43fb3c,_0x139f('0x10'),JSON['stringify'](_0x17b25b));if(_0x17b25b['error']){if(_0x17b25b[_0x139f('0x11')][_0x139f('0x12')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x43fb3c,_0x17b25b[_0x139f('0x11')][_0x139f('0x13')]);return _0x29308f(_0x17b25b[_0x139f('0x11')][_0x139f('0x13')]);}logger[_0x139f('0x11')](_0x139f('0xd'),_0x43fb3c,_0x17b25b[_0x139f('0x11')][_0x139f('0x13')]);return _0x4a3e4a(_0x17b25b[_0x139f('0x11')][_0x139f('0x13')]);}else{logger[_0x139f('0xc')](_0x139f('0xd'),_0x43fb3c,_0x139f('0x10'));_0x4a3e4a(_0x17b25b[_0x139f('0x14')]['message']);}})[_0x139f('0x15')](function(_0x529fed){logger[_0x139f('0x11')](_0x139f('0xd'),_0x43fb3c,_0x529fed);_0x29308f(_0x529fed);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 6ce5e3c..1a5b5be 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 _0x5f2f=['create','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','post'];(function(_0x220afa,_0xf5f6cc){var _0x1b79d1=function(_0x178a39){while(--_0x178a39){_0x220afa['push'](_0x220afa['shift']());}};_0x1b79d1(++_0xf5f6cc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5ac1d5,_0x18cc79){_0x5ac1d5=_0x5ac1d5-0x0;var _0x528835=_0x5f2f[_0x5ac1d5];return _0x528835;};'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('./intZohoField.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xc')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xd')]);router['put'](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['delete'](_0xf5f2('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xf5f2('0xf')]=router; \ No newline at end of file +var _0x4b17=['exports','multer','path','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','create','put','delete','destroy'];(function(_0xa78d3e,_0x34bfc1){var _0x174ce0=function(_0x5f1d85){while(--_0x5f1d85){_0xa78d3e['push'](_0xa78d3e['shift']());}};_0x174ce0(++_0x34bfc1);}(_0x4b17,0x10f));var _0x74b1=function(_0x1857d0,_0x6eade0){_0x1857d0=_0x1857d0-0x0;var _0x3e3c46=_0x4b17[_0x1857d0];return _0x3e3c46;};'use strict';var multer=require(_0x74b1('0x0'));var util=require('util');var path=require(_0x74b1('0x1'));var timeout=require('connect-timeout');var express=require(_0x74b1('0x2'));var router=express[_0x74b1('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x74b1('0x4'));var config=require('../../config/environment');var controller=require('./intZohoField.controller');router[_0x74b1('0x5')]('/',auth[_0x74b1('0x6')](),controller[_0x74b1('0x7')]);router[_0x74b1('0x5')](_0x74b1('0x8'),auth[_0x74b1('0x6')](),controller[_0x74b1('0x9')]);router['post']('/',auth[_0x74b1('0x6')](),controller[_0x74b1('0xa')]);router[_0x74b1('0xb')](_0x74b1('0x8'),auth[_0x74b1('0x6')](),controller['update']);router[_0x74b1('0xc')](_0x74b1('0x8'),auth['isAuthenticated'](),controller[_0x74b1('0xd')]);module[_0x74b1('0xe')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index a4414ea..495dd67 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 _0x61a1=['ENUM','string','variable','keyValue','STRING','customVariable','BOOLEAN','sequelize','exports'];(function(_0x54dbd0,_0x409d9c){var _0x4c3cd7=function(_0x5583c6){while(--_0x5583c6){_0x54dbd0['push'](_0x54dbd0['shift']());}};_0x4c3cd7(++_0x409d9c);}(_0x61a1,0x127));var _0x161a=function(_0x3598bb,_0x24befa){_0x3598bb=_0x3598bb-0x0;var _0x13c837=_0x61a1[_0x3598bb];return _0x13c837;};'use strict';var Sequelize=require(_0x161a('0x0'));module[_0x161a('0x1')]={'type':{'type':Sequelize[_0x161a('0x2')](_0x161a('0x3'),_0x161a('0x4'),'customVariable',_0x161a('0x5')),'defaultValue':_0x161a('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x161a('0x6')]},'keyType':{'type':Sequelize[_0x161a('0x2')](_0x161a('0x3'),_0x161a('0x4'),_0x161a('0x7'))},'keyContent':{'type':Sequelize[_0x161a('0x6')]},'idField':{'type':Sequelize[_0x161a('0x6')]},'nameField':{'type':Sequelize[_0x161a('0x6')]},'customField':{'type':Sequelize[_0x161a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x161a('0x6')]}}; \ No newline at end of file +var _0x0207=['ENUM','BOOLEAN','exports','variable','customVariable','keyValue','string','STRING'];(function(_0x5444ad,_0x1eb3ea){var _0x3f4470=function(_0x13380f){while(--_0x13380f){_0x5444ad['push'](_0x5444ad['shift']());}};_0x3f4470(++_0x1eb3ea);}(_0x0207,0x162));var _0x7020=function(_0x488fa6,_0x567d40){_0x488fa6=_0x488fa6-0x0;var _0x2d3045=_0x0207[_0x488fa6];return _0x2d3045;};'use strict';var Sequelize=require('sequelize');module[_0x7020('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0x7020('0x1'),_0x7020('0x2'),_0x7020('0x3')),'defaultValue':_0x7020('0x4')},'content':{'type':Sequelize[_0x7020('0x5')]},'key':{'type':Sequelize[_0x7020('0x5')]},'keyType':{'type':Sequelize[_0x7020('0x6')]('string','variable',_0x7020('0x2'))},'keyContent':{'type':Sequelize[_0x7020('0x5')]},'idField':{'type':Sequelize[_0x7020('0x5')]},'nameField':{'type':Sequelize[_0x7020('0x5')]},'customField':{'type':Sequelize[_0x7020('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7020('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index af476ca..7a03ae7 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 _0x12c6=['body','catch','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','destroy','then','stack','name','send','index','map','ZohoField','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','findAll','show','params','rawAttributes','include','find','create'];(function(_0x54c4f2,_0x2e40cb){var _0x29e671=function(_0x14effa){while(--_0x14effa){_0x54c4f2['push'](_0x54c4f2['shift']());}};_0x29e671(++_0x2e40cb);}(_0x12c6,0x112));var _0x612c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x12c6[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x612c('0x0'));var rimraf=require(_0x612c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x612c('0x2'));var rp=require(_0x612c('0x3'));var moment=require('moment');var BPromise=require(_0x612c('0x4'));var Mustache=require(_0x612c('0x5'));var util=require('util');var path=require('path');var sox=require(_0x612c('0x6'));var csv=require(_0x612c('0x7'));var ejs=require(_0x612c('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x612c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x612c('0xa'));var toCsv=require('to-csv');var querystring=require(_0x612c('0xb'));var Papa=require(_0x612c('0xc'));var Redis=require(_0x612c('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x612c('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x612c('0xf'));var logger=require(_0x612c('0x10'))(_0x612c('0x11'));var utils=require('../../config/utils');var config=require(_0x612c('0x12'));var licenseUtil=require(_0x612c('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x521fe6,_0x563034){_0x563034=_0x563034||0xcc;return function(_0x5ab7df){if(_0x5ab7df){return _0x521fe6[_0x612c('0x14')](_0x563034);}return _0x521fe6[_0x612c('0x15')](_0x563034)[_0x612c('0x16')]();};}function respondWithResult(_0x76231e,_0x604577){_0x604577=_0x604577||0xc8;return function(_0x5ec45a){if(_0x5ec45a){return _0x76231e[_0x612c('0x15')](_0x604577)[_0x612c('0x17')](_0x5ec45a);}};}function respondWithFilteredResult(_0x3c08be,_0x58d501){return function(_0x256109){if(_0x256109){var _0x2ac4eb=_0x256109['count'],_0x5caae7=_0x58d501['offset'],_0x1aaf3d=_0x58d501[_0x612c('0x18')]+_0x58d501[_0x612c('0x19')],_0x340628;if(_0x1aaf3d>=_0x2ac4eb){_0x1aaf3d=_0x2ac4eb;_0x340628=0xc8;}else{_0x340628=0xce;}_0x3c08be[_0x612c('0x15')](_0x340628);return _0x3c08be[_0x612c('0x1a')](_0x612c('0x1b'),_0x5caae7+'-'+_0x1aaf3d+'/'+_0x2ac4eb)[_0x612c('0x17')](_0x256109);}return null;};}function patchUpdates(_0x35f31b){return function(_0x360f8b){try{jsonpatch[_0x612c('0x1c')](_0x360f8b,_0x35f31b,!![]);}catch(_0x46b6f3){return BPromise['reject'](_0x46b6f3);}return _0x360f8b[_0x612c('0x1d')]();};}function saveUpdates(_0x4f75d2,_0x12fae5){return function(_0x5f2458){if(_0x5f2458){return _0x5f2458['update'](_0x4f75d2)['then'](function(_0x17f0da){return _0x17f0da;});}return null;};}function removeEntity(_0x90720b,_0x3762fb){return function(_0x5acfea){if(_0x5acfea){return _0x5acfea[_0x612c('0x1e')]()[_0x612c('0x1f')](function(){_0x90720b[_0x612c('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x318e6a,_0x265f07){return function(_0x4c14d4){if(!_0x4c14d4){_0x318e6a[_0x612c('0x14')](0x194);}return _0x4c14d4;};}function handleError(_0x4a385d,_0x26372f){_0x26372f=_0x26372f||0x1f4;return function(_0x22e816){logger['error'](_0x22e816[_0x612c('0x20')]);if(_0x22e816[_0x612c('0x21')]){delete _0x22e816[_0x612c('0x21')];}_0x4a385d[_0x612c('0x15')](_0x26372f)[_0x612c('0x22')](_0x22e816);};}exports[_0x612c('0x23')]=function(_0x15ed8b,_0x55c3f7){var _0x5c4c4b={},_0x36fe87={},_0x2f8362={'count':0x0,'rows':[]};var _0x1e3d32=_[_0x612c('0x24')](db[_0x612c('0x25')]['rawAttributes'],function(_0x56532f){return{'name':_0x56532f['fieldName'],'type':_0x56532f[_0x612c('0x26')][_0x612c('0x27')]};});_0x36fe87[_0x612c('0x28')]=_[_0x612c('0x24')](_0x1e3d32,_0x612c('0x21'));_0x36fe87[_0x612c('0x29')]=_[_0x612c('0x2a')](_0x15ed8b[_0x612c('0x29')]);_0x36fe87[_0x612c('0x2b')]=_[_0x612c('0x2c')](_0x36fe87['model'],_0x36fe87['query']);_0x5c4c4b['attributes']=_['intersection'](_0x36fe87[_0x612c('0x28')],qs[_0x612c('0x2d')](_0x15ed8b[_0x612c('0x29')][_0x612c('0x2d')]));_0x5c4c4b[_0x612c('0x2e')]=_0x5c4c4b[_0x612c('0x2e')][_0x612c('0x2f')]?_0x5c4c4b[_0x612c('0x2e')]:_0x36fe87[_0x612c('0x28')];if(!_0x15ed8b['query'][_0x612c('0x30')](_0x612c('0x31'))){_0x5c4c4b[_0x612c('0x19')]=qs[_0x612c('0x19')](_0x15ed8b[_0x612c('0x29')][_0x612c('0x19')]);_0x5c4c4b[_0x612c('0x18')]=qs[_0x612c('0x18')](_0x15ed8b[_0x612c('0x29')][_0x612c('0x18')]);}_0x5c4c4b[_0x612c('0x32')]=qs[_0x612c('0x33')](_0x15ed8b[_0x612c('0x29')]['sort']);_0x5c4c4b[_0x612c('0x34')]=qs[_0x612c('0x2b')](_[_0x612c('0x35')](_0x15ed8b[_0x612c('0x29')],_0x36fe87[_0x612c('0x2b')]),_0x1e3d32);if(_0x15ed8b[_0x612c('0x29')][_0x612c('0x36')]){_0x5c4c4b[_0x612c('0x34')]=_[_0x612c('0x37')](_0x5c4c4b[_0x612c('0x34')],{'$or':_['map'](_0x1e3d32,function(_0x246da3){if(_0x246da3[_0x612c('0x26')]!=='VIRTUAL'){var _0x394da4={};_0x394da4[_0x246da3[_0x612c('0x21')]]={'$like':'%'+_0x15ed8b[_0x612c('0x29')]['filter']+'%'};return _0x394da4;}})});}_0x5c4c4b=_[_0x612c('0x37')]({},_0x5c4c4b,_0x15ed8b[_0x612c('0x38')]);var _0x4ae021={'where':_0x5c4c4b[_0x612c('0x34')]};return db[_0x612c('0x25')][_0x612c('0x39')](_0x4ae021)[_0x612c('0x1f')](function(_0x5a242c){_0x2f8362[_0x612c('0x39')]=_0x5a242c;if(_0x15ed8b[_0x612c('0x29')][_0x612c('0x3a')]){_0x5c4c4b['include']=[{'all':!![]}];}return db['ZohoField'][_0x612c('0x3b')](_0x5c4c4b);})[_0x612c('0x1f')](function(_0x5329f0){_0x2f8362['rows']=_0x5329f0;return _0x2f8362;})[_0x612c('0x1f')](respondWithFilteredResult(_0x55c3f7,_0x5c4c4b))['catch'](handleError(_0x55c3f7,null));};exports[_0x612c('0x3c')]=function(_0x303eea,_0x473960){var _0x32a03e={'raw':!![],'where':{'id':_0x303eea[_0x612c('0x3d')]['id']}},_0x462360={};_0x462360[_0x612c('0x28')]=_[_0x612c('0x2a')](db[_0x612c('0x25')][_0x612c('0x3e')]);_0x462360[_0x612c('0x29')]=_[_0x612c('0x2a')](_0x303eea[_0x612c('0x29')]);_0x462360[_0x612c('0x2b')]=_['intersection'](_0x462360[_0x612c('0x28')],_0x462360[_0x612c('0x29')]);_0x32a03e[_0x612c('0x2e')]=_[_0x612c('0x2c')](_0x462360[_0x612c('0x28')],qs[_0x612c('0x2d')](_0x303eea[_0x612c('0x29')]['fields']));_0x32a03e[_0x612c('0x2e')]=_0x32a03e[_0x612c('0x2e')]['length']?_0x32a03e[_0x612c('0x2e')]:_0x462360[_0x612c('0x28')];if(_0x303eea['query'][_0x612c('0x3a')]){_0x32a03e[_0x612c('0x3f')]=[{'all':!![]}];}_0x32a03e=_[_0x612c('0x37')]({},_0x32a03e,_0x303eea[_0x612c('0x38')]);return db[_0x612c('0x25')][_0x612c('0x40')](_0x32a03e)[_0x612c('0x1f')](handleEntityNotFound(_0x473960,null))['then'](respondWithResult(_0x473960,null))['catch'](handleError(_0x473960,null));};exports[_0x612c('0x41')]=function(_0x14cd0c,_0x3cf5e1){return db['ZohoField']['create'](_0x14cd0c['body'],{})[_0x612c('0x1f')](respondWithResult(_0x3cf5e1,0xc9))['catch'](handleError(_0x3cf5e1,null));};exports['update']=function(_0x44e955,_0x268ba0){if(_0x44e955['body']['id']){delete _0x44e955['body']['id'];}return db[_0x612c('0x25')][_0x612c('0x40')]({'where':{'id':_0x44e955[_0x612c('0x3d')]['id']}})[_0x612c('0x1f')](handleEntityNotFound(_0x268ba0,null))[_0x612c('0x1f')](saveUpdates(_0x44e955[_0x612c('0x42')],null))[_0x612c('0x1f')](respondWithResult(_0x268ba0,null))[_0x612c('0x43')](handleError(_0x268ba0,null));};exports[_0x612c('0x1e')]=function(_0x19263f,_0x3b10e8){return db[_0x612c('0x25')][_0x612c('0x40')]({'where':{'id':_0x19263f['params']['id']}})[_0x612c('0x1f')](handleEntityNotFound(_0x3b10e8,null))[_0x612c('0x1f')](removeEntity(_0x3b10e8,null))[_0x612c('0x43')](handleError(_0x3b10e8,null));}; \ No newline at end of file +var _0xae31=['error','stack','name','send','map','ZohoField','rawAttributes','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','params','keys','find','create','update','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xae31,0x19f));var _0x1ae3=function(_0x32bdbf,_0x11689b){_0x32bdbf=_0x32bdbf-0x0;var _0x4bc887=_0xae31[_0x32bdbf];return _0x4bc887;};'use strict';var pdf=require(_0x1ae3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1ae3('0x1'));var zipdir=require(_0x1ae3('0x2'));var jsonpatch=require(_0x1ae3('0x3'));var rp=require(_0x1ae3('0x4'));var moment=require(_0x1ae3('0x5'));var BPromise=require(_0x1ae3('0x6'));var Mustache=require('mustache');var util=require(_0x1ae3('0x7'));var path=require('path');var sox=require(_0x1ae3('0x8'));var csv=require(_0x1ae3('0x9'));var ejs=require(_0x1ae3('0xa'));var fs=require('fs');var _=require(_0x1ae3('0xb'));var squel=require(_0x1ae3('0xc'));var crypto=require(_0x1ae3('0xd'));var jsforce=require(_0x1ae3('0xe'));var deskjs=require(_0x1ae3('0xf'));var toCsv=require(_0x1ae3('0x9'));var querystring=require(_0x1ae3('0x10'));var Papa=require(_0x1ae3('0x11'));var Redis=require('ioredis');var authService=require(_0x1ae3('0x12'));var qs=require(_0x1ae3('0x13'));var as=require(_0x1ae3('0x14'));var hardwareService=require(_0x1ae3('0x15'));var logger=require(_0x1ae3('0x16'))(_0x1ae3('0x17'));var utils=require(_0x1ae3('0x18'));var config=require(_0x1ae3('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x1ae3('0x1a'))['db'];function respondWithStatusCode(_0x41242c,_0x2efe81){_0x2efe81=_0x2efe81||0xcc;return function(_0x4e0d4d){if(_0x4e0d4d){return _0x41242c[_0x1ae3('0x1b')](_0x2efe81);}return _0x41242c[_0x1ae3('0x1c')](_0x2efe81)[_0x1ae3('0x1d')]();};}function respondWithResult(_0x79e6c7,_0x5936a7){_0x5936a7=_0x5936a7||0xc8;return function(_0x209849){if(_0x209849){return _0x79e6c7[_0x1ae3('0x1c')](_0x5936a7)[_0x1ae3('0x1e')](_0x209849);}};}function respondWithFilteredResult(_0x24fa78,_0x2574e6){return function(_0xf63c35){if(_0xf63c35){var _0x532728=_0xf63c35[_0x1ae3('0x1f')],_0x21ac21=_0x2574e6['offset'],_0x25ce53=_0x2574e6[_0x1ae3('0x20')]+_0x2574e6[_0x1ae3('0x21')],_0x56dac6;if(_0x25ce53>=_0x532728){_0x25ce53=_0x532728;_0x56dac6=0xc8;}else{_0x56dac6=0xce;}_0x24fa78[_0x1ae3('0x1c')](_0x56dac6);return _0x24fa78[_0x1ae3('0x22')](_0x1ae3('0x23'),_0x21ac21+'-'+_0x25ce53+'/'+_0x532728)[_0x1ae3('0x1e')](_0xf63c35);}return null;};}function patchUpdates(_0x4d9386){return function(_0x5ef8fc){try{jsonpatch[_0x1ae3('0x24')](_0x5ef8fc,_0x4d9386,!![]);}catch(_0x391af4){return BPromise[_0x1ae3('0x25')](_0x391af4);}return _0x5ef8fc[_0x1ae3('0x26')]();};}function saveUpdates(_0x184596,_0x298581){return function(_0x13d66d){if(_0x13d66d){return _0x13d66d['update'](_0x184596)[_0x1ae3('0x27')](function(_0x2e8912){return _0x2e8912;});}return null;};}function removeEntity(_0x1945b7,_0x384973){return function(_0x252e40){if(_0x252e40){return _0x252e40[_0x1ae3('0x28')]()['then'](function(){_0x1945b7[_0x1ae3('0x1c')](0xcc)[_0x1ae3('0x1d')]();});}};}function handleEntityNotFound(_0xc81eb0,_0x57b8ae){return function(_0x460d88){if(!_0x460d88){_0xc81eb0[_0x1ae3('0x1b')](0x194);}return _0x460d88;};}function handleError(_0x12eebb,_0xa1fd7d){_0xa1fd7d=_0xa1fd7d||0x1f4;return function(_0x1f9ff8){logger[_0x1ae3('0x29')](_0x1f9ff8[_0x1ae3('0x2a')]);if(_0x1f9ff8[_0x1ae3('0x2b')]){delete _0x1f9ff8[_0x1ae3('0x2b')];}_0x12eebb[_0x1ae3('0x1c')](_0xa1fd7d)[_0x1ae3('0x2c')](_0x1f9ff8);};}exports['index']=function(_0x63fdfd,_0x490f83){var _0x3975f5={},_0x70161d={},_0x7d2d7f={'count':0x0,'rows':[]};var _0x234885=_[_0x1ae3('0x2d')](db[_0x1ae3('0x2e')][_0x1ae3('0x2f')],function(_0x1efccc){return{'name':_0x1efccc['fieldName'],'type':_0x1efccc['type'][_0x1ae3('0x30')]};});_0x70161d['model']=_[_0x1ae3('0x2d')](_0x234885,_0x1ae3('0x2b'));_0x70161d[_0x1ae3('0x31')]=_['keys'](_0x63fdfd[_0x1ae3('0x31')]);_0x70161d[_0x1ae3('0x32')]=_[_0x1ae3('0x33')](_0x70161d[_0x1ae3('0x34')],_0x70161d['query']);_0x3975f5[_0x1ae3('0x35')]=_[_0x1ae3('0x33')](_0x70161d['model'],qs['fields'](_0x63fdfd[_0x1ae3('0x31')][_0x1ae3('0x36')]));_0x3975f5[_0x1ae3('0x35')]=_0x3975f5['attributes'][_0x1ae3('0x37')]?_0x3975f5[_0x1ae3('0x35')]:_0x70161d['model'];if(!_0x63fdfd[_0x1ae3('0x31')][_0x1ae3('0x38')](_0x1ae3('0x39'))){_0x3975f5['limit']=qs[_0x1ae3('0x21')](_0x63fdfd[_0x1ae3('0x31')]['limit']);_0x3975f5['offset']=qs[_0x1ae3('0x20')](_0x63fdfd['query'][_0x1ae3('0x20')]);}_0x3975f5[_0x1ae3('0x3a')]=qs[_0x1ae3('0x3b')](_0x63fdfd[_0x1ae3('0x31')][_0x1ae3('0x3b')]);_0x3975f5[_0x1ae3('0x3c')]=qs[_0x1ae3('0x32')](_[_0x1ae3('0x3d')](_0x63fdfd['query'],_0x70161d[_0x1ae3('0x32')]),_0x234885);if(_0x63fdfd['query']['filter']){_0x3975f5[_0x1ae3('0x3c')]=_['merge'](_0x3975f5['where'],{'$or':_[_0x1ae3('0x2d')](_0x234885,function(_0x23ab4d){if(_0x23ab4d[_0x1ae3('0x3e')]!==_0x1ae3('0x3f')){var _0x8263b3={};_0x8263b3[_0x23ab4d['name']]={'$like':'%'+_0x63fdfd[_0x1ae3('0x31')][_0x1ae3('0x40')]+'%'};return _0x8263b3;}})});}_0x3975f5=_[_0x1ae3('0x41')]({},_0x3975f5,_0x63fdfd[_0x1ae3('0x42')]);var _0x96c37b={'where':_0x3975f5[_0x1ae3('0x3c')]};return db['ZohoField'][_0x1ae3('0x1f')](_0x96c37b)[_0x1ae3('0x27')](function(_0x15e95c){_0x7d2d7f[_0x1ae3('0x1f')]=_0x15e95c;if(_0x63fdfd[_0x1ae3('0x31')][_0x1ae3('0x43')]){_0x3975f5[_0x1ae3('0x44')]=[{'all':!![]}];}return db['ZohoField'][_0x1ae3('0x45')](_0x3975f5);})['then'](function(_0x2061ad){_0x7d2d7f['rows']=_0x2061ad;return _0x7d2d7f;})['then'](respondWithFilteredResult(_0x490f83,_0x3975f5))[_0x1ae3('0x46')](handleError(_0x490f83,null));};exports['show']=function(_0x116c98,_0x16e7a6){var _0x7b4782={'raw':!![],'where':{'id':_0x116c98[_0x1ae3('0x47')]['id']}},_0x41ebda={};_0x41ebda[_0x1ae3('0x34')]=_[_0x1ae3('0x48')](db[_0x1ae3('0x2e')][_0x1ae3('0x2f')]);_0x41ebda[_0x1ae3('0x31')]=_['keys'](_0x116c98[_0x1ae3('0x31')]);_0x41ebda[_0x1ae3('0x32')]=_[_0x1ae3('0x33')](_0x41ebda[_0x1ae3('0x34')],_0x41ebda['query']);_0x7b4782['attributes']=_['intersection'](_0x41ebda['model'],qs[_0x1ae3('0x36')](_0x116c98[_0x1ae3('0x31')][_0x1ae3('0x36')]));_0x7b4782[_0x1ae3('0x35')]=_0x7b4782['attributes'][_0x1ae3('0x37')]?_0x7b4782[_0x1ae3('0x35')]:_0x41ebda[_0x1ae3('0x34')];if(_0x116c98['query'][_0x1ae3('0x43')]){_0x7b4782[_0x1ae3('0x44')]=[{'all':!![]}];}_0x7b4782=_[_0x1ae3('0x41')]({},_0x7b4782,_0x116c98[_0x1ae3('0x42')]);return db[_0x1ae3('0x2e')][_0x1ae3('0x49')](_0x7b4782)[_0x1ae3('0x27')](handleEntityNotFound(_0x16e7a6,null))[_0x1ae3('0x27')](respondWithResult(_0x16e7a6,null))[_0x1ae3('0x46')](handleError(_0x16e7a6,null));};exports[_0x1ae3('0x4a')]=function(_0xcb61a1,_0x1a4b8a){return db[_0x1ae3('0x2e')][_0x1ae3('0x4a')](_0xcb61a1['body'],{})['then'](respondWithResult(_0x1a4b8a,0xc9))['catch'](handleError(_0x1a4b8a,null));};exports[_0x1ae3('0x4b')]=function(_0x44d530,_0xbf487d){if(_0x44d530['body']['id']){delete _0x44d530['body']['id'];}return db[_0x1ae3('0x2e')][_0x1ae3('0x49')]({'where':{'id':_0x44d530[_0x1ae3('0x47')]['id']}})[_0x1ae3('0x27')](handleEntityNotFound(_0xbf487d,null))[_0x1ae3('0x27')](saveUpdates(_0x44d530['body'],null))[_0x1ae3('0x27')](respondWithResult(_0xbf487d,null))[_0x1ae3('0x46')](handleError(_0xbf487d,null));};exports[_0x1ae3('0x28')]=function(_0x38ab8f,_0x5d8d31){return db[_0x1ae3('0x2e')]['find']({'where':{'id':_0x38ab8f[_0x1ae3('0x47')]['id']}})[_0x1ae3('0x27')](handleEntityNotFound(_0x5d8d31,null))[_0x1ae3('0x27')](removeEntity(_0x5d8d31,null))[_0x1ae3('0x46')](handleError(_0x5d8d31,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index ec5935c..f648e4d 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 _0x8f97=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','idField','FieldId','lodash','util','../../config/logger'];(function(_0x387f41,_0x3e868c){var _0x1a45aa=function(_0x2b1b50){while(--_0x2b1b50){_0x387f41['push'](_0x387f41['shift']());}};_0x1a45aa(++_0x3e868c);}(_0x8f97,0x195));var _0x78f9=function(_0x185f00,_0x1f9754){_0x185f00=_0x185f00-0x0;var _0x2ef08e=_0x8f97[_0x185f00];return _0x2ef08e;};'use strict';var _=require(_0x78f9('0x0'));var util=require(_0x78f9('0x1'));var logger=require(_0x78f9('0x2'))(_0x78f9('0x3'));var moment=require(_0x78f9('0x4'));var BPromise=require(_0x78f9('0x5'));var rp=require(_0x78f9('0x6'));var fs=require('fs');var path=require(_0x78f9('0x7'));var rimraf=require(_0x78f9('0x8'));var config=require(_0x78f9('0x9'));var attributes=require(_0x78f9('0xa'));module[_0x78f9('0xb')]=function(_0x46619e,_0x381632){return _0x46619e[_0x78f9('0xc')](_0x78f9('0xd'),attributes,{'tableName':_0x78f9('0xe'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x78f9('0xf'),_0x78f9('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd283=['define','int_zoho_fields','zoho_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird','path','../../config/environment','./intZohoField.attributes'];(function(_0xc640a0,_0x465a64){var _0x1c0c4d=function(_0x3f7fba){while(--_0x3f7fba){_0xc640a0['push'](_0xc640a0['shift']());}};_0x1c0c4d(++_0x465a64);}(_0xd283,0xe9));var _0x3d28=function(_0x4568ef,_0x2f90a7){_0x4568ef=_0x4568ef-0x0;var _0xa03dde=_0xd283[_0x4568ef];return _0xa03dde;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3d28('0x0'))(_0x3d28('0x1'));var moment=require(_0x3d28('0x2'));var BPromise=require(_0x3d28('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3d28('0x4'));var rimraf=require('rimraf');var config=require(_0x3d28('0x5'));var attributes=require(_0x3d28('0x6'));module['exports']=function(_0x3eed23,_0x5ec6e4){return _0x3eed23[_0x3d28('0x7')]('ZohoField',attributes,{'tableName':_0x3d28('0x8'),'paranoid':![],'indexes':[{'name':_0x3d28('0x9'),'fields':[_0x3d28('0xa'),_0x3d28('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 f87762b..85b25ef 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 _0xe5b3=['request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ZohoField,\x20%s,\x20%s'];(function(_0x361078,_0x283dcb){var _0x22d9e8=function(_0x140b4b){while(--_0x140b4b){_0x361078['push'](_0x361078['shift']());}};_0x22d9e8(++_0x283dcb);}(_0xe5b3,0x133));var _0x3e5b=function(_0x3400fa,_0x4c9236){_0x3400fa=_0x3400fa-0x0;var _0x449dbc=_0xe5b3[_0x3400fa];return _0x449dbc;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var moment=require(_0x3e5b('0x1'));var BPromise=require(_0x3e5b('0x2'));var rs=require(_0x3e5b('0x3'));var fs=require('fs');var Redis=require(_0x3e5b('0x4'));var db=require(_0x3e5b('0x5'))['db'];var utils=require(_0x3e5b('0x6'));var logger=require(_0x3e5b('0x7'))(_0x3e5b('0x8'));var config=require(_0x3e5b('0x9'));var jayson=require(_0x3e5b('0xa'));var client=jayson['client'][_0x3e5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dcf55,_0x534e7d,_0x41d46f){return new BPromise(function(_0x3901c2,_0x3c7c2e){return client[_0x3e5b('0xc')](_0x5dcf55,_0x41d46f)['then'](function(_0x4ed6bc){logger[_0x3e5b('0xd')](_0x3e5b('0xe'),_0x534e7d,_0x3e5b('0xf'));logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x534e7d,'request\x20sent',JSON[_0x3e5b('0x12')](_0x4ed6bc));if(_0x4ed6bc['error']){if(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x14')]===0x1f4){logger[_0x3e5b('0x13')](_0x3e5b('0xe'),_0x534e7d,_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);return _0x3c7c2e(_0x4ed6bc[_0x3e5b('0x13')]['message']);}logger[_0x3e5b('0x13')]('ZohoField,\x20%s,\x20%s',_0x534e7d,_0x4ed6bc['error']['message']);return _0x3901c2(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);}else{logger[_0x3e5b('0xd')]('ZohoField,\x20%s,\x20%s',_0x534e7d,_0x3e5b('0xf'));_0x3901c2(_0x4ed6bc['result']['message']);}})[_0x3e5b('0x16')](function(_0x11b41b){logger['error'](_0x3e5b('0xe'),_0x534e7d,_0x11b41b);_0x3c7c2e(_0x11b41b);});});} \ No newline at end of file +var _0x9a19=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x48a836,_0xa1d010){var _0x249dc8=function(_0x2a95a0){while(--_0x2a95a0){_0x48a836['push'](_0x48a836['shift']());}};_0x249dc8(++_0xa1d010);}(_0x9a19,0x114));var _0x99a1=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0x9a19[_0x49d41c];return _0xb64c5f;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var moment=require(_0x99a1('0x2'));var BPromise=require('bluebird');var rs=require(_0x99a1('0x3'));var fs=require('fs');var Redis=require(_0x99a1('0x4'));var db=require(_0x99a1('0x5'))['db'];var utils=require(_0x99a1('0x6'));var logger=require(_0x99a1('0x7'))(_0x99a1('0x8'));var config=require(_0x99a1('0x9'));var jayson=require(_0x99a1('0xa'));var client=jayson[_0x99a1('0xb')][_0x99a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x65045d,_0x523b9e,_0x4d2a5c){return new BPromise(function(_0x5aa6c2,_0x56f50){return client[_0x99a1('0xd')](_0x65045d,_0x4d2a5c)['then'](function(_0x5874fc){logger[_0x99a1('0xe')](_0x99a1('0xf'),_0x523b9e,_0x99a1('0x10'));logger[_0x99a1('0x11')](_0x99a1('0x12'),_0x523b9e,'request\x20sent',JSON[_0x99a1('0x13')](_0x5874fc));if(_0x5874fc[_0x99a1('0x14')]){if(_0x5874fc[_0x99a1('0x14')][_0x99a1('0x15')]===0x1f4){logger[_0x99a1('0x14')](_0x99a1('0xf'),_0x523b9e,_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);return _0x56f50(_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);}logger[_0x99a1('0x14')](_0x99a1('0xf'),_0x523b9e,_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);return _0x5aa6c2(_0x5874fc[_0x99a1('0x14')]['message']);}else{logger[_0x99a1('0xe')](_0x99a1('0xf'),_0x523b9e,_0x99a1('0x10'));_0x5aa6c2(_0x5874fc[_0x99a1('0x17')][_0x99a1('0x16')]);}})[_0x99a1('0x18')](function(_0x1ca878){logger['error']('ZohoField,\x20%s,\x20%s',_0x523b9e,_0x1ca878);_0x56f50(_0x1ca878);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index bf5d541..f07dd12 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 _0xd993=['path','express','Router','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x48e23c,_0x16f7dd){var _0xf42eb9=function(_0x27da18){while(--_0x27da18){_0x48e23c['push'](_0x48e23c['shift']());}};_0xf42eb9(++_0x16f7dd);}(_0xd993,0x1c6));var _0x3d99=function(_0x23179d,_0x20b4c7){_0x23179d=_0x23179d-0x0;var _0x402977=_0xd993[_0x23179d];return _0x402977;};'use strict';var multer=require(_0x3d99('0x0'));var util=require(_0x3d99('0x1'));var path=require(_0x3d99('0x2'));var timeout=require('connect-timeout');var express=require(_0x3d99('0x3'));var router=express[_0x3d99('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3d99('0x5'));var config=require(_0x3d99('0x6'));module[_0x3d99('0x7')]=router; \ No newline at end of file +var _0x9d90=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3b1f14,_0x4f65fb){var _0x3526ac=function(_0x1b3795){while(--_0x1b3795){_0x3b1f14['push'](_0x3b1f14['shift']());}};_0x3526ac(++_0x4f65fb);}(_0x9d90,0x1d0));var _0x09d9=function(_0x3ad8ec,_0x4b6447){_0x3ad8ec=_0x3ad8ec-0x0;var _0x1a5467=_0x9d90[_0x3ad8ec];return _0x1a5467;};'use strict';var multer=require(_0x09d9('0x0'));var util=require(_0x09d9('0x1'));var path=require(_0x09d9('0x2'));var timeout=require(_0x09d9('0x3'));var express=require(_0x09d9('0x4'));var router=express[_0x09d9('0x5')]();var auth=require(_0x09d9('0x6'));var interaction=require(_0x09d9('0x7'));var config=require(_0x09d9('0x8'));module[_0x09d9('0x9')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 4b9c0a8..c895f0d 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 _0x1752=['INTEGER','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x5de285,_0x58b242){var _0x36555a=function(_0x243b4e){while(--_0x243b4e){_0x5de285['push'](_0x5de285['shift']());}};_0x36555a(++_0x58b242);}(_0x1752,0xaa));var _0x2175=function(_0x3d692e,_0xfad1d3){_0x3d692e=_0x3d692e-0x0;var _0x861136=_0x1752[_0x3d692e];return _0x861136;};'use strict';var Sequelize=require(_0x2175('0x0'));module[_0x2175('0x1')]={'name':{'type':Sequelize[_0x2175('0x2')],'allowNull':![],'unique':_0x2175('0x3')},'version':{'type':Sequelize[_0x2175('0x2')],'allowNull':![],'unique':_0x2175('0x3')},'main':{'type':Sequelize[_0x2175('0x2')],'defaultValue':_0x2175('0x4')},'filename':{'type':Sequelize[_0x2175('0x2')]},'path':{'type':Sequelize[_0x2175('0x2')]},'type':{'type':Sequelize[_0x2175('0x2')]},'size':{'type':Sequelize[_0x2175('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x2175('0x2')]},'logo':{'type':Sequelize[_0x2175('0x2')]},'state':{'type':Sequelize[_0x2175('0x2')],'unique':_0x2175('0x6')},'description':{'type':Sequelize[_0x2175('0x2')]},'title':{'type':Sequelize[_0x2175('0x2')]},'remoteUri':{'type':Sequelize[_0x2175('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x2869=['exports','STRING','unique_name_and_version','app.js','BOOLEAN','state'];(function(_0x32c9d2,_0x2a3399){var _0x4c754c=function(_0x5099d2){while(--_0x5099d2){_0x32c9d2['push'](_0x32c9d2['shift']());}};_0x4c754c(++_0x2a3399);}(_0x2869,0x192));var _0x9286=function(_0x51dee1,_0x48fe07){_0x51dee1=_0x51dee1-0x0;var _0x439046=_0x2869[_0x51dee1];return _0x439046;};'use strict';var Sequelize=require('sequelize');module[_0x9286('0x0')]={'name':{'type':Sequelize[_0x9286('0x1')],'allowNull':![],'unique':_0x9286('0x2')},'version':{'type':Sequelize[_0x9286('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x9286('0x1')],'defaultValue':_0x9286('0x3')},'filename':{'type':Sequelize[_0x9286('0x1')]},'path':{'type':Sequelize[_0x9286('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x9286('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x9286('0x1')]},'logo':{'type':Sequelize[_0x9286('0x1')]},'state':{'type':Sequelize[_0x9286('0x1')],'unique':_0x9286('0x5')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x9286('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index d6bfaf2..847a7a7 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 _0x5755=['util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','then','destroy','stack','name','send','index','map','Integration','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','find','create','update','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x5ebad6,_0x4495a6){var _0x5ea13b=function(_0x4a6127){while(--_0x4a6127){_0x5ebad6['push'](_0x5ebad6['shift']());}};_0x5ea13b(++_0x4495a6);}(_0x5755,0x8f));var _0x5575=function(_0x3ca829,_0xc55f17){_0x3ca829=_0x3ca829-0x0;var _0x3b416b=_0x5755[_0x3ca829];return _0x3b416b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5575('0x0'));var rimraf=require(_0x5575('0x1'));var zipdir=require(_0x5575('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5575('0x3'));var moment=require(_0x5575('0x4'));var BPromise=require(_0x5575('0x5'));var Mustache=require(_0x5575('0x6'));var util=require(_0x5575('0x7'));var path=require(_0x5575('0x8'));var sox=require(_0x5575('0x9'));var csv=require(_0x5575('0xa'));var ejs=require(_0x5575('0xb'));var fs=require('fs');var _=require(_0x5575('0xc'));var squel=require(_0x5575('0xd'));var crypto=require(_0x5575('0xe'));var jsforce=require(_0x5575('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5575('0x10'));var Papa=require(_0x5575('0x11'));var Redis=require(_0x5575('0x12'));var authService=require(_0x5575('0x13'));var qs=require(_0x5575('0x14'));var as=require(_0x5575('0x15'));var hardwareService=require(_0x5575('0x16'));var logger=require(_0x5575('0x17'))('api');var utils=require(_0x5575('0x18'));var config=require(_0x5575('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5657a3,_0x5c9e4a){_0x5c9e4a=_0x5c9e4a||0xcc;return function(_0x1f0db1){if(_0x1f0db1){return _0x5657a3[_0x5575('0x1a')](_0x5c9e4a);}return _0x5657a3[_0x5575('0x1b')](_0x5c9e4a)[_0x5575('0x1c')]();};}function respondWithResult(_0x544d55,_0x51d48e){_0x51d48e=_0x51d48e||0xc8;return function(_0x5d9f49){if(_0x5d9f49){return _0x544d55[_0x5575('0x1b')](_0x51d48e)['json'](_0x5d9f49);}};}function respondWithFilteredResult(_0x53e5a7,_0x50fbc5){return function(_0x2b8dca){if(_0x2b8dca){var _0x2e7711=_0x2b8dca['count'],_0x42e238=_0x50fbc5[_0x5575('0x1d')],_0x2c21bd=_0x50fbc5[_0x5575('0x1d')]+_0x50fbc5[_0x5575('0x1e')],_0x55c668;if(_0x2c21bd>=_0x2e7711){_0x2c21bd=_0x2e7711;_0x55c668=0xc8;}else{_0x55c668=0xce;}_0x53e5a7[_0x5575('0x1b')](_0x55c668);return _0x53e5a7[_0x5575('0x1f')](_0x5575('0x20'),_0x42e238+'-'+_0x2c21bd+'/'+_0x2e7711)[_0x5575('0x21')](_0x2b8dca);}return null;};}function patchUpdates(_0x331faa){return function(_0x4f5d0a){try{jsonpatch[_0x5575('0x22')](_0x4f5d0a,_0x331faa,!![]);}catch(_0x26f4ed){return BPromise[_0x5575('0x23')](_0x26f4ed);}return _0x4f5d0a['save']();};}function saveUpdates(_0x48d631,_0x4c2869){return function(_0x529304){if(_0x529304){return _0x529304['update'](_0x48d631)[_0x5575('0x24')](function(_0x3cc0b2){return _0x3cc0b2;});}return null;};}function removeEntity(_0x373939,_0x3380e7){return function(_0x58d5a8){if(_0x58d5a8){return _0x58d5a8[_0x5575('0x25')]()[_0x5575('0x24')](function(){_0x373939[_0x5575('0x1b')](0xcc)[_0x5575('0x1c')]();});}};}function handleEntityNotFound(_0x39d6ff,_0x195c20){return function(_0x4e989a){if(!_0x4e989a){_0x39d6ff['sendStatus'](0x194);}return _0x4e989a;};}function handleError(_0x579a46,_0x46aebe){_0x46aebe=_0x46aebe||0x1f4;return function(_0x1bcc86){logger['error'](_0x1bcc86[_0x5575('0x26')]);if(_0x1bcc86[_0x5575('0x27')]){delete _0x1bcc86[_0x5575('0x27')];}_0x579a46['status'](_0x46aebe)[_0x5575('0x28')](_0x1bcc86);};}exports[_0x5575('0x29')]=function(_0x4f7505,_0x233e03){var _0x54894b={},_0xcb47c9={},_0x551ba3={'count':0x0,'rows':[]};var _0x551a92=_[_0x5575('0x2a')](db[_0x5575('0x2b')][_0x5575('0x2c')],function(_0x2fabdc){return{'name':_0x2fabdc['fieldName'],'type':_0x2fabdc[_0x5575('0x2d')][_0x5575('0x2e')]};});_0xcb47c9[_0x5575('0x2f')]=_[_0x5575('0x2a')](_0x551a92,_0x5575('0x27'));_0xcb47c9['query']=_[_0x5575('0x30')](_0x4f7505[_0x5575('0x31')]);_0xcb47c9[_0x5575('0x32')]=_[_0x5575('0x33')](_0xcb47c9['model'],_0xcb47c9['query']);_0x54894b[_0x5575('0x34')]=_[_0x5575('0x33')](_0xcb47c9[_0x5575('0x2f')],qs[_0x5575('0x35')](_0x4f7505['query'][_0x5575('0x35')]));_0x54894b[_0x5575('0x34')]=_0x54894b[_0x5575('0x34')][_0x5575('0x36')]?_0x54894b[_0x5575('0x34')]:_0xcb47c9['model'];if(!_0x4f7505[_0x5575('0x31')]['hasOwnProperty'](_0x5575('0x37'))){_0x54894b['limit']=qs[_0x5575('0x1e')](_0x4f7505[_0x5575('0x31')][_0x5575('0x1e')]);_0x54894b[_0x5575('0x1d')]=qs[_0x5575('0x1d')](_0x4f7505[_0x5575('0x31')]['offset']);}_0x54894b[_0x5575('0x38')]=qs[_0x5575('0x39')](_0x4f7505['query'][_0x5575('0x39')]);_0x54894b['where']=qs[_0x5575('0x32')](_[_0x5575('0x3a')](_0x4f7505[_0x5575('0x31')],_0xcb47c9[_0x5575('0x32')]),_0x551a92);if(_0x4f7505['query'][_0x5575('0x3b')]){_0x54894b[_0x5575('0x3c')]=_[_0x5575('0x3d')](_0x54894b['where'],{'$or':_[_0x5575('0x2a')](_0x551a92,function(_0x714bc0){if(_0x714bc0[_0x5575('0x2d')]!==_0x5575('0x3e')){var _0x18c464={};_0x18c464[_0x714bc0[_0x5575('0x27')]]={'$like':'%'+_0x4f7505[_0x5575('0x31')][_0x5575('0x3b')]+'%'};return _0x18c464;}})});}_0x54894b=_[_0x5575('0x3d')]({},_0x54894b,_0x4f7505[_0x5575('0x3f')]);var _0x40363b={'where':_0x54894b[_0x5575('0x3c')]};return db[_0x5575('0x2b')][_0x5575('0x40')](_0x40363b)[_0x5575('0x24')](function(_0x503f65){_0x551ba3['count']=_0x503f65;if(_0x4f7505[_0x5575('0x31')][_0x5575('0x41')]){_0x54894b[_0x5575('0x42')]=[{'all':!![]}];}return db[_0x5575('0x2b')][_0x5575('0x43')](_0x54894b);})[_0x5575('0x24')](function(_0x573768){_0x551ba3['rows']=_0x573768;return _0x551ba3;})[_0x5575('0x24')](respondWithFilteredResult(_0x233e03,_0x54894b))[_0x5575('0x44')](handleError(_0x233e03,null));};exports[_0x5575('0x45')]=function(_0x274a8b,_0x10a8f0){var _0x5e246f={'raw':![],'where':{'id':_0x274a8b[_0x5575('0x46')]['id']}},_0x3e1328={};_0x3e1328['model']=_['keys'](db[_0x5575('0x2b')][_0x5575('0x2c')]);_0x3e1328[_0x5575('0x31')]=_[_0x5575('0x30')](_0x274a8b[_0x5575('0x31')]);_0x3e1328['filters']=_['intersection'](_0x3e1328[_0x5575('0x2f')],_0x3e1328[_0x5575('0x31')]);_0x5e246f['attributes']=_[_0x5575('0x33')](_0x3e1328[_0x5575('0x2f')],qs[_0x5575('0x35')](_0x274a8b[_0x5575('0x31')][_0x5575('0x35')]));_0x5e246f[_0x5575('0x34')]=_0x5e246f[_0x5575('0x34')][_0x5575('0x36')]?_0x5e246f[_0x5575('0x34')]:_0x3e1328[_0x5575('0x2f')];if(_0x274a8b[_0x5575('0x31')][_0x5575('0x41')]){_0x5e246f[_0x5575('0x42')]=[{'all':!![]}];}_0x5e246f=_[_0x5575('0x3d')]({},_0x5e246f,_0x274a8b[_0x5575('0x3f')]);return db[_0x5575('0x2b')][_0x5575('0x47')](_0x5e246f)['then'](handleEntityNotFound(_0x10a8f0,null))[_0x5575('0x24')](respondWithResult(_0x10a8f0,null))['catch'](handleError(_0x10a8f0,null));};exports[_0x5575('0x48')]=function(_0x36f18d,_0x161c98){return db[_0x5575('0x2b')][_0x5575('0x48')](_0x36f18d['body'],{})['then'](respondWithResult(_0x161c98,0xc9))[_0x5575('0x44')](handleError(_0x161c98,null));};exports[_0x5575('0x49')]=function(_0x595bdc,_0x4846ce){if(_0x595bdc['body']['id']){delete _0x595bdc['body']['id'];}return db[_0x5575('0x2b')][_0x5575('0x47')]({'where':{'id':_0x595bdc[_0x5575('0x46')]['id']}})[_0x5575('0x24')](handleEntityNotFound(_0x4846ce,null))[_0x5575('0x24')](saveUpdates(_0x595bdc[_0x5575('0x4a')],null))[_0x5575('0x24')](respondWithResult(_0x4846ce,null))[_0x5575('0x44')](handleError(_0x4846ce,null));};exports[_0x5575('0x25')]=function(_0x40f3df,_0x58e893){return db[_0x5575('0x2b')]['find']({'where':{'id':_0x40f3df['params']['id']}})[_0x5575('0x24')](handleEntityNotFound(_0x58e893,null))['then'](removeEntity(_0x58e893,null))[_0x5575('0x44')](handleError(_0x58e893,null));}; \ No newline at end of file +var _0xe82c=['../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','save','update','then','destroy','error','stack','name','index','map','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','merge','VIRTUAL','options','where','Integration','include','findAll','params','rawAttributes','includeAll','find','catch','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x16b1ce,_0x22db65){var _0x13a1bb=function(_0x2aadcb){while(--_0x2aadcb){_0x16b1ce['push'](_0x16b1ce['shift']());}};_0x13a1bb(++_0x22db65);}(_0xe82c,0x1dd));var _0xce82=function(_0x1fb076,_0x176f9c){_0x1fb076=_0x1fb076-0x0;var _0x336ba5=_0xe82c[_0x1fb076];return _0x336ba5;};'use strict';var pdf=require(_0xce82('0x0'));var emlformat=require(_0xce82('0x1'));var rimraf=require(_0xce82('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xce82('0x3'));var rp=require(_0xce82('0x4'));var moment=require(_0xce82('0x5'));var BPromise=require(_0xce82('0x6'));var Mustache=require(_0xce82('0x7'));var util=require('util');var path=require(_0xce82('0x8'));var sox=require(_0xce82('0x9'));var csv=require(_0xce82('0xa'));var ejs=require(_0xce82('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xce82('0xc'));var crypto=require(_0xce82('0xd'));var jsforce=require(_0xce82('0xe'));var deskjs=require(_0xce82('0xf'));var toCsv=require(_0xce82('0xa'));var querystring=require('querystring');var Papa=require(_0xce82('0x10'));var Redis=require(_0xce82('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xce82('0x12'));var as=require(_0xce82('0x13'));var hardwareService=require(_0xce82('0x14'));var logger=require('../../config/logger')(_0xce82('0x15'));var utils=require('../../config/utils');var config=require(_0xce82('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xce82('0x17'))['db'];function respondWithStatusCode(_0x4cc588,_0x1dd3ec){_0x1dd3ec=_0x1dd3ec||0xcc;return function(_0x1c84b1){if(_0x1c84b1){return _0x4cc588[_0xce82('0x18')](_0x1dd3ec);}return _0x4cc588[_0xce82('0x19')](_0x1dd3ec)[_0xce82('0x1a')]();};}function respondWithResult(_0x4a8307,_0xf2ba9){_0xf2ba9=_0xf2ba9||0xc8;return function(_0x5d309e){if(_0x5d309e){return _0x4a8307[_0xce82('0x19')](_0xf2ba9)['json'](_0x5d309e);}};}function respondWithFilteredResult(_0x22e5aa,_0x4d38cf){return function(_0x18d52f){if(_0x18d52f){var _0x362e63=_0x18d52f[_0xce82('0x1b')],_0x2b69b2=_0x4d38cf[_0xce82('0x1c')],_0x1dfa58=_0x4d38cf[_0xce82('0x1c')]+_0x4d38cf[_0xce82('0x1d')],_0x2c8f40;if(_0x1dfa58>=_0x362e63){_0x1dfa58=_0x362e63;_0x2c8f40=0xc8;}else{_0x2c8f40=0xce;}_0x22e5aa[_0xce82('0x19')](_0x2c8f40);return _0x22e5aa[_0xce82('0x1e')]('Content-Range',_0x2b69b2+'-'+_0x1dfa58+'/'+_0x362e63)[_0xce82('0x1f')](_0x18d52f);}return null;};}function patchUpdates(_0x9ef1c5){return function(_0x1c0a59){try{jsonpatch['apply'](_0x1c0a59,_0x9ef1c5,!![]);}catch(_0x50b632){return BPromise['reject'](_0x50b632);}return _0x1c0a59[_0xce82('0x20')]();};}function saveUpdates(_0x4730c8,_0x4405a1){return function(_0x18c041){if(_0x18c041){return _0x18c041[_0xce82('0x21')](_0x4730c8)[_0xce82('0x22')](function(_0x3959f8){return _0x3959f8;});}return null;};}function removeEntity(_0x1b95f7,_0x1b3f96){return function(_0x4181c4){if(_0x4181c4){return _0x4181c4[_0xce82('0x23')]()[_0xce82('0x22')](function(){_0x1b95f7[_0xce82('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4752c3,_0x22bfc0){return function(_0x59a376){if(!_0x59a376){_0x4752c3[_0xce82('0x18')](0x194);}return _0x59a376;};}function handleError(_0x207d3e,_0x5a7bcd){_0x5a7bcd=_0x5a7bcd||0x1f4;return function(_0x53172b){logger[_0xce82('0x24')](_0x53172b[_0xce82('0x25')]);if(_0x53172b[_0xce82('0x26')]){delete _0x53172b[_0xce82('0x26')];}_0x207d3e[_0xce82('0x19')](_0x5a7bcd)['send'](_0x53172b);};}exports[_0xce82('0x27')]=function(_0x484390,_0x74ec9e){var _0x1ecbea={},_0xf1915f={},_0x57e904={'count':0x0,'rows':[]};var _0x5119d0=_[_0xce82('0x28')](db['Integration']['rawAttributes'],function(_0x2e3e6a){return{'name':_0x2e3e6a[_0xce82('0x29')],'type':_0x2e3e6a[_0xce82('0x2a')][_0xce82('0x2b')]};});_0xf1915f[_0xce82('0x2c')]=_['map'](_0x5119d0,'name');_0xf1915f['query']=_[_0xce82('0x2d')](_0x484390[_0xce82('0x2e')]);_0xf1915f[_0xce82('0x2f')]=_['intersection'](_0xf1915f[_0xce82('0x2c')],_0xf1915f[_0xce82('0x2e')]);_0x1ecbea[_0xce82('0x30')]=_[_0xce82('0x31')](_0xf1915f[_0xce82('0x2c')],qs[_0xce82('0x32')](_0x484390[_0xce82('0x2e')][_0xce82('0x32')]));_0x1ecbea[_0xce82('0x30')]=_0x1ecbea[_0xce82('0x30')][_0xce82('0x33')]?_0x1ecbea[_0xce82('0x30')]:_0xf1915f[_0xce82('0x2c')];if(!_0x484390[_0xce82('0x2e')][_0xce82('0x34')]('nolimit')){_0x1ecbea[_0xce82('0x1d')]=qs['limit'](_0x484390[_0xce82('0x2e')][_0xce82('0x1d')]);_0x1ecbea[_0xce82('0x1c')]=qs[_0xce82('0x1c')](_0x484390[_0xce82('0x2e')]['offset']);}_0x1ecbea[_0xce82('0x35')]=qs[_0xce82('0x36')](_0x484390[_0xce82('0x2e')][_0xce82('0x36')]);_0x1ecbea['where']=qs['filters'](_[_0xce82('0x37')](_0x484390[_0xce82('0x2e')],_0xf1915f['filters']),_0x5119d0);if(_0x484390[_0xce82('0x2e')][_0xce82('0x38')]){_0x1ecbea['where']=_[_0xce82('0x39')](_0x1ecbea['where'],{'$or':_['map'](_0x5119d0,function(_0x561839){if(_0x561839['type']!==_0xce82('0x3a')){var _0x355446={};_0x355446[_0x561839[_0xce82('0x26')]]={'$like':'%'+_0x484390[_0xce82('0x2e')][_0xce82('0x38')]+'%'};return _0x355446;}})});}_0x1ecbea=_['merge']({},_0x1ecbea,_0x484390[_0xce82('0x3b')]);var _0x259f7d={'where':_0x1ecbea[_0xce82('0x3c')]};return db[_0xce82('0x3d')][_0xce82('0x1b')](_0x259f7d)[_0xce82('0x22')](function(_0x84631e){_0x57e904[_0xce82('0x1b')]=_0x84631e;if(_0x484390['query']['includeAll']){_0x1ecbea[_0xce82('0x3e')]=[{'all':!![]}];}return db['Integration'][_0xce82('0x3f')](_0x1ecbea);})[_0xce82('0x22')](function(_0x343658){_0x57e904['rows']=_0x343658;return _0x57e904;})['then'](respondWithFilteredResult(_0x74ec9e,_0x1ecbea))['catch'](handleError(_0x74ec9e,null));};exports['show']=function(_0x12bb93,_0x225819){var _0x25c43d={'raw':![],'where':{'id':_0x12bb93[_0xce82('0x40')]['id']}},_0x1762da={};_0x1762da[_0xce82('0x2c')]=_[_0xce82('0x2d')](db[_0xce82('0x3d')][_0xce82('0x41')]);_0x1762da['query']=_['keys'](_0x12bb93[_0xce82('0x2e')]);_0x1762da['filters']=_['intersection'](_0x1762da[_0xce82('0x2c')],_0x1762da['query']);_0x25c43d['attributes']=_['intersection'](_0x1762da[_0xce82('0x2c')],qs[_0xce82('0x32')](_0x12bb93[_0xce82('0x2e')]['fields']));_0x25c43d[_0xce82('0x30')]=_0x25c43d[_0xce82('0x30')]['length']?_0x25c43d[_0xce82('0x30')]:_0x1762da[_0xce82('0x2c')];if(_0x12bb93[_0xce82('0x2e')][_0xce82('0x42')]){_0x25c43d[_0xce82('0x3e')]=[{'all':!![]}];}_0x25c43d=_[_0xce82('0x39')]({},_0x25c43d,_0x12bb93[_0xce82('0x3b')]);return db['Integration'][_0xce82('0x43')](_0x25c43d)[_0xce82('0x22')](handleEntityNotFound(_0x225819,null))[_0xce82('0x22')](respondWithResult(_0x225819,null))[_0xce82('0x44')](handleError(_0x225819,null));};exports[_0xce82('0x45')]=function(_0x5b72be,_0x3c48da){return db[_0xce82('0x3d')][_0xce82('0x45')](_0x5b72be[_0xce82('0x46')],{})[_0xce82('0x22')](respondWithResult(_0x3c48da,0xc9))[_0xce82('0x44')](handleError(_0x3c48da,null));};exports[_0xce82('0x21')]=function(_0x5a57d8,_0x595894){if(_0x5a57d8[_0xce82('0x46')]['id']){delete _0x5a57d8[_0xce82('0x46')]['id'];}return db[_0xce82('0x3d')][_0xce82('0x43')]({'where':{'id':_0x5a57d8['params']['id']}})['then'](handleEntityNotFound(_0x595894,null))['then'](saveUpdates(_0x5a57d8[_0xce82('0x46')],null))[_0xce82('0x22')](respondWithResult(_0x595894,null))[_0xce82('0x44')](handleError(_0x595894,null));};exports[_0xce82('0x23')]=function(_0x504b72,_0x508b45){return db['Integration']['find']({'where':{'id':_0x504b72[_0xce82('0x40')]['id']}})[_0xce82('0x22')](handleEntityNotFound(_0x508b45,null))[_0xce82('0x22')](removeEntity(_0x508b45,null))['catch'](handleError(_0x508b45,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index f440cd9..a7ff603 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 _0xca74=['./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1d6af2,_0x3db4f3){var _0x2987a5=function(_0x4e5fcd){while(--_0x4e5fcd){_0x1d6af2['push'](_0x1d6af2['shift']());}};_0x2987a5(++_0x3db4f3);}(_0xca74,0x123));var _0x4ca7=function(_0x3d0e12,_0x41e165){_0x3d0e12=_0x3d0e12-0x0;var _0x22da51=_0xca74[_0x3d0e12];return _0x22da51;};'use strict';var _=require(_0x4ca7('0x0'));var util=require(_0x4ca7('0x1'));var logger=require(_0x4ca7('0x2'))(_0x4ca7('0x3'));var moment=require('moment');var BPromise=require(_0x4ca7('0x4'));var rp=require(_0x4ca7('0x5'));var fs=require('fs');var path=require(_0x4ca7('0x6'));var rimraf=require(_0x4ca7('0x7'));var config=require('../../config/environment');var attributes=require(_0x4ca7('0x8'));module[_0x4ca7('0x9')]=function(_0x135a76,_0x15c634){return _0x135a76[_0x4ca7('0xa')](_0x4ca7('0xb'),attributes,{'tableName':_0x4ca7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61b3=['Integration','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x61b3,0x140));var _0x361b=function(_0x26eb18,_0x15ef10){_0x26eb18=_0x26eb18-0x0;var _0x49ef07=_0x61b3[_0x26eb18];return _0x49ef07;};'use strict';var _=require(_0x361b('0x0'));var util=require(_0x361b('0x1'));var logger=require(_0x361b('0x2'))(_0x361b('0x3'));var moment=require(_0x361b('0x4'));var BPromise=require(_0x361b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x361b('0x6'));var rimraf=require('rimraf');var config=require(_0x361b('0x7'));var attributes=require('./integration.attributes');module[_0x361b('0x8')]=function(_0x22e8b9,_0x5a0f23){return _0x22e8b9[_0x361b('0x9')](_0x361b('0xa'),attributes,{'tableName':'integrations','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 bdd167e..1a0f18d 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 _0xb87c=['Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0xb87c,0x1d7));var _0xcb87=function(_0x31e94f,_0x2446c8){_0x31e94f=_0x31e94f-0x0;var _0x4946fd=_0xb87c[_0x31e94f];return _0x4946fd;};'use strict';var _=require('lodash');var util=require(_0xcb87('0x0'));var moment=require(_0xcb87('0x1'));var BPromise=require(_0xcb87('0x2'));var rs=require(_0xcb87('0x3'));var fs=require('fs');var Redis=require(_0xcb87('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb87('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xcb87('0x6'));var jayson=require(_0xcb87('0x7'));var client=jayson[_0xcb87('0x8')][_0xcb87('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17404c,_0x145bae,_0x5f2085){return new BPromise(function(_0x177270,_0x1395d6){return client[_0xcb87('0xa')](_0x17404c,_0x5f2085)[_0xcb87('0xb')](function(_0x1ff79a){logger['info'](_0xcb87('0xc'),_0x145bae,_0xcb87('0xd'));logger[_0xcb87('0xe')](_0xcb87('0xf'),_0x145bae,_0xcb87('0xd'),JSON[_0xcb87('0x10')](_0x1ff79a));if(_0x1ff79a['error']){if(_0x1ff79a[_0xcb87('0x11')][_0xcb87('0x12')]===0x1f4){logger[_0xcb87('0x11')](_0xcb87('0xc'),_0x145bae,_0x1ff79a['error'][_0xcb87('0x13')]);return _0x1395d6(_0x1ff79a[_0xcb87('0x11')]['message']);}logger[_0xcb87('0x11')]('Integration,\x20%s,\x20%s',_0x145bae,_0x1ff79a[_0xcb87('0x11')]['message']);return _0x177270(_0x1ff79a[_0xcb87('0x11')]['message']);}else{logger['info'](_0xcb87('0xc'),_0x145bae,'request\x20sent');_0x177270(_0x1ff79a[_0xcb87('0x14')][_0xcb87('0x13')]);}})['catch'](function(_0x2b7ee5){logger[_0xcb87('0x11')](_0xcb87('0xc'),_0x145bae,_0x2b7ee5);_0x1395d6(_0x2b7ee5);});});} \ No newline at end of file +var _0x7579=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2d015c,_0x31bb7e){var _0x403093=function(_0x2dc795){while(--_0x2dc795){_0x2d015c['push'](_0x2d015c['shift']());}};_0x403093(++_0x31bb7e);}(_0x7579,0x1e2));var _0x9757=function(_0xad25b3,_0x42dc67){_0xad25b3=_0xad25b3-0x0;var _0x330c7b=_0x7579[_0xad25b3];return _0x330c7b;};'use strict';var _=require(_0x9757('0x0'));var util=require(_0x9757('0x1'));var moment=require(_0x9757('0x2'));var BPromise=require(_0x9757('0x3'));var rs=require(_0x9757('0x4'));var fs=require('fs');var Redis=require(_0x9757('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9757('0x6'));var logger=require(_0x9757('0x7'))(_0x9757('0x8'));var config=require(_0x9757('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9757('0xa')][_0x9757('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4757e9,_0x4b5446,_0x28a14a){return new BPromise(function(_0x51a1c8,_0x2d65dd){return client[_0x9757('0xc')](_0x4757e9,_0x28a14a)[_0x9757('0xd')](function(_0x5b5749){logger[_0x9757('0xe')](_0x9757('0xf'),_0x4b5446,_0x9757('0x10'));logger[_0x9757('0x11')](_0x9757('0x12'),_0x4b5446,_0x9757('0x10'),JSON[_0x9757('0x13')](_0x5b5749));if(_0x5b5749[_0x9757('0x14')]){if(_0x5b5749[_0x9757('0x14')][_0x9757('0x15')]===0x1f4){logger[_0x9757('0x14')]('Integration,\x20%s,\x20%s',_0x4b5446,_0x5b5749[_0x9757('0x14')][_0x9757('0x16')]);return _0x2d65dd(_0x5b5749[_0x9757('0x14')]['message']);}logger[_0x9757('0x14')](_0x9757('0xf'),_0x4b5446,_0x5b5749[_0x9757('0x14')][_0x9757('0x16')]);return _0x51a1c8(_0x5b5749[_0x9757('0x14')][_0x9757('0x16')]);}else{logger[_0x9757('0xe')]('Integration,\x20%s,\x20%s',_0x4b5446,_0x9757('0x10'));_0x51a1c8(_0x5b5749['result'][_0x9757('0x16')]);}})[_0x9757('0x17')](function(_0xad2a22){logger[_0x9757('0x14')](_0x9757('0xf'),_0x4b5446,_0xad2a22);_0x2d65dd(_0xad2a22);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 61e61d0..0747506 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 _0x96ee=['get','isAuthenticated','/describe','/:id','show','post','create','put','destroy','exports','util','path','../../components/interaction/service'];(function(_0x152220,_0x38a858){var _0xcb20e2=function(_0x49cfdc){while(--_0x49cfdc){_0x152220['push'](_0x152220['shift']());}};_0xcb20e2(++_0x38a858);}(_0x96ee,0x72));var _0xe96e=function(_0x5b6a86,_0x59489c){_0x5b6a86=_0x5b6a86-0x0;var _0x425888=_0x96ee[_0x5b6a86];return _0x425888;};'use strict';var multer=require('multer');var util=require(_0xe96e('0x0'));var path=require(_0xe96e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe96e('0x2'));var config=require('../../config/environment');var controller=require('./integrationReport.controller');router[_0xe96e('0x3')]('/',auth[_0xe96e('0x4')](),controller['index']);router[_0xe96e('0x3')](_0xe96e('0x5'),auth[_0xe96e('0x4')](),controller['describe']);router[_0xe96e('0x3')](_0xe96e('0x6'),auth[_0xe96e('0x4')](),controller[_0xe96e('0x7')]);router[_0xe96e('0x8')]('/',auth[_0xe96e('0x4')](),controller[_0xe96e('0x9')]);router[_0xe96e('0xa')](_0xe96e('0x6'),auth[_0xe96e('0x4')](),controller['update']);router['delete'](_0xe96e('0x6'),auth[_0xe96e('0x4')](),controller[_0xe96e('0xb')]);module[_0xe96e('0xc')]=router; \ No newline at end of file +var _0x6741=['/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index'];(function(_0x5182f9,_0x4acf0c){var _0x4c9fad=function(_0x453b0e){while(--_0x453b0e){_0x5182f9['push'](_0x5182f9['shift']());}};_0x4c9fad(++_0x4acf0c);}(_0x6741,0x1d6));var _0x1674=function(_0x95c64d,_0x5dd720){_0x95c64d=_0x95c64d-0x0;var _0x28bf4f=_0x6741[_0x95c64d];return _0x28bf4f;};'use strict';var multer=require(_0x1674('0x0'));var util=require(_0x1674('0x1'));var path=require(_0x1674('0x2'));var timeout=require(_0x1674('0x3'));var express=require(_0x1674('0x4'));var router=express[_0x1674('0x5')]();var auth=require(_0x1674('0x6'));var interaction=require(_0x1674('0x7'));var config=require(_0x1674('0x8'));var controller=require(_0x1674('0x9'));router[_0x1674('0xa')]('/',auth[_0x1674('0xb')](),controller[_0x1674('0xc')]);router[_0x1674('0xa')](_0x1674('0xd'),auth[_0x1674('0xb')](),controller[_0x1674('0xe')]);router['get'](_0x1674('0xf'),auth[_0x1674('0xb')](),controller[_0x1674('0x10')]);router[_0x1674('0x11')]('/',auth['isAuthenticated'](),controller[_0x1674('0x12')]);router[_0x1674('0x13')](_0x1674('0xf'),auth[_0x1674('0xb')](),controller[_0x1674('0x14')]);router[_0x1674('0x15')]('/:id',auth[_0x1674('0xb')](),controller[_0x1674('0x16')]);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 b284f77..418d68a 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 _0x92cf=['TEXT','ENUM','SENT','SENDING','RECEIVED','sequelize','STRING','INTEGER','DATE','BOOLEAN'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x92cf,0x87));var _0xf92c=function(_0x19258d,_0x5f2768){_0x19258d=_0x19258d-0x0;var _0x2239d7=_0x92cf[_0x19258d];return _0x2239d7;};'use strict';var Sequelize=require(_0xf92c('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xf92c('0x1')]},'integrationId':{'type':Sequelize[_0xf92c('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf92c('0x1')]},'calleridname':{'type':Sequelize[_0xf92c('0x1')]},'queue':{'type':Sequelize[_0xf92c('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xf92c('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xf92c('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xf92c('0x2')]},'agentacw':{'type':Sequelize[_0xf92c('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf92c('0x2')]},'reason':{'type':Sequelize[_0xf92c('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xf92c('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xf92c('0x3')]},'agentdump':{'type':Sequelize[_0xf92c('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xf92c('0x3')]},'lastevent':{'type':Sequelize[_0xf92c('0x1')]},'channel':{'type':Sequelize[_0xf92c('0x1')]},'channelstate':{'type':Sequelize[_0xf92c('0x2')]},'channelstatedesc':{'type':Sequelize[_0xf92c('0x1')]},'connectedlinenum':{'type':Sequelize[_0xf92c('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf92c('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf92c('0x1')]},'exten':{'type':Sequelize[_0xf92c('0x1')]},'priority':{'type':Sequelize[_0xf92c('0x1')]},'destchannel':{'type':Sequelize[_0xf92c('0x1')]},'destchannelstate':{'type':Sequelize[_0xf92c('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xf92c('0x1')]},'destcalleridnum':{'type':Sequelize[_0xf92c('0x1')]},'destcalleridname':{'type':Sequelize[_0xf92c('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xf92c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xf92c('0x1')]},'destlanguage':{'type':Sequelize[_0xf92c('0x1')]},'destaccountcode':{'type':Sequelize[_0xf92c('0x1')]},'destcontext':{'type':Sequelize[_0xf92c('0x1')]},'destexten':{'type':Sequelize[_0xf92c('0x1')]},'destpriority':{'type':Sequelize[_0xf92c('0x1')]},'destuniqueid':{'type':Sequelize[_0xf92c('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xf92c('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xf92c('0x1')]},'to':{'type':Sequelize[_0xf92c('0x1')]},'cc':{'type':Sequelize[_0xf92c('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xf92c('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xf92c('0x6')](_0xf92c('0x7'),_0xf92c('0x8'),_0xf92c('0x9'),'FAILED')},'url':{'type':Sequelize[_0xf92c('0x1')]},'app':{'type':Sequelize[_0xf92c('0x1')]},'appdata':{'type':Sequelize[_0xf92c('0x1')]},'projectId':{'type':Sequelize[_0xf92c('0x2')]}}; \ No newline at end of file +var _0x2924=['FAILED','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','TEXT','SENDING','RECEIVED'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x2924,0xa1));var _0x4292=function(_0x666eb9,_0x5a9e90){_0x666eb9=_0x666eb9-0x0;var _0x3fc80b=_0x2924[_0x666eb9];return _0x3fc80b;};'use strict';var Sequelize=require(_0x4292('0x0'));module[_0x4292('0x1')]={'integration':{'type':Sequelize[_0x4292('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x4292('0x2')]},'ticketId':{'type':Sequelize[_0x4292('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x4292('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x4292('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x4292('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x4292('0x4')]},'talktime':{'type':Sequelize[_0x4292('0x5')]},'agentacw':{'type':Sequelize[_0x4292('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x4292('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x4292('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x4292('0x4')]},'agentdump':{'type':Sequelize[_0x4292('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x4292('0x4')]},'lastevent':{'type':Sequelize[_0x4292('0x2')]},'channel':{'type':Sequelize[_0x4292('0x2')]},'channelstate':{'type':Sequelize[_0x4292('0x5')]},'channelstatedesc':{'type':Sequelize[_0x4292('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x4292('0x2')]},'language':{'type':Sequelize[_0x4292('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x4292('0x2')]},'destchannel':{'type':Sequelize[_0x4292('0x2')]},'destchannelstate':{'type':Sequelize[_0x4292('0x5')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x4292('0x2')]},'destcalleridname':{'type':Sequelize[_0x4292('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x4292('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4292('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x4292('0x2')]},'destcontext':{'type':Sequelize[_0x4292('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x4292('0x2')]},'destuniqueid':{'type':Sequelize[_0x4292('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x4292('0x2')]},'from':{'type':Sequelize[_0x4292('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x4292('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x4292('0x6')]},'status':{'type':Sequelize['ENUM']('SENT',_0x4292('0x7'),_0x4292('0x8'),_0x4292('0x9'))},'url':{'type':Sequelize[_0x4292('0x2')]},'app':{'type':Sequelize[_0x4292('0x2')]},'appdata':{'type':Sequelize[_0x4292('0x2')]},'projectId':{'type':Sequelize[_0x4292('0x5')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 6e5f238..87e6fb1 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 _0x1b3a=['limit','sort','where','pick','filter','VIRTUAL','merge','options','then','include','findAll','rows','catch','params','fields','includeAll','find','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','count','offset','set','Content-Range','apply','update','end','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit'];(function(_0x465c45,_0x491323){var _0x11ed91=function(_0xfda3d){while(--_0xfda3d){_0x465c45['push'](_0x465c45['shift']());}};_0x11ed91(++_0x491323);}(_0x1b3a,0x16d));var _0xa1b3=function(_0x3049c8,_0x1ac2df){_0x3049c8=_0x3049c8-0x0;var _0x5616bb=_0x1b3a[_0x3049c8];return _0x5616bb;};'use strict';var pdf=require(_0xa1b3('0x0'));var emlformat=require(_0xa1b3('0x1'));var rimraf=require(_0xa1b3('0x2'));var zipdir=require(_0xa1b3('0x3'));var jsonpatch=require(_0xa1b3('0x4'));var rp=require(_0xa1b3('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa1b3('0x6'));var path=require('path');var sox=require(_0xa1b3('0x7'));var csv=require('to-csv');var ejs=require(_0xa1b3('0x8'));var fs=require('fs');var _=require(_0xa1b3('0x9'));var squel=require(_0xa1b3('0xa'));var crypto=require(_0xa1b3('0xb'));var jsforce=require(_0xa1b3('0xc'));var deskjs=require(_0xa1b3('0xd'));var toCsv=require(_0xa1b3('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa1b3('0xf'));var as=require(_0xa1b3('0x10'));var hardwareService=require(_0xa1b3('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xa1b3('0x12'));var config=require(_0xa1b3('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22bfbe,_0xf3d333){_0xf3d333=_0xf3d333||0xcc;return function(_0x2bba22){if(_0x2bba22){return _0x22bfbe[_0xa1b3('0x14')](_0xf3d333);}return _0x22bfbe[_0xa1b3('0x15')](_0xf3d333)['end']();};}function respondWithResult(_0x37a708,_0x20d6cc){_0x20d6cc=_0x20d6cc||0xc8;return function(_0x542a50){if(_0x542a50){return _0x37a708[_0xa1b3('0x15')](_0x20d6cc)['json'](_0x542a50);}};}function respondWithFilteredResult(_0x41005c,_0x272bcb){return function(_0x166bb3){if(_0x166bb3){var _0x241a89=_0x166bb3[_0xa1b3('0x16')],_0x19e892=_0x272bcb[_0xa1b3('0x17')],_0x228ae4=_0x272bcb[_0xa1b3('0x17')]+_0x272bcb['limit'],_0xedd674;if(_0x228ae4>=_0x241a89){_0x228ae4=_0x241a89;_0xedd674=0xc8;}else{_0xedd674=0xce;}_0x41005c[_0xa1b3('0x15')](_0xedd674);return _0x41005c[_0xa1b3('0x18')](_0xa1b3('0x19'),_0x19e892+'-'+_0x228ae4+'/'+_0x241a89)['json'](_0x166bb3);}return null;};}function patchUpdates(_0x523d78){return function(_0x4f4a2f){try{jsonpatch[_0xa1b3('0x1a')](_0x4f4a2f,_0x523d78,!![]);}catch(_0x53c4ca){return BPromise['reject'](_0x53c4ca);}return _0x4f4a2f['save']();};}function saveUpdates(_0x5887b3,_0x22171f){return function(_0xf16e88){if(_0xf16e88){return _0xf16e88[_0xa1b3('0x1b')](_0x5887b3)['then'](function(_0x5f60ff){return _0x5f60ff;});}return null;};}function removeEntity(_0x3fea65,_0x11d183){return function(_0x7a3a24){if(_0x7a3a24){return _0x7a3a24['destroy']()['then'](function(){_0x3fea65[_0xa1b3('0x15')](0xcc)[_0xa1b3('0x1c')]();});}};}function handleEntityNotFound(_0x38019d,_0x5470ef){return function(_0x4e4745){if(!_0x4e4745){_0x38019d['sendStatus'](0x194);}return _0x4e4745;};}function handleError(_0x1b9a73,_0x27ecf9){_0x27ecf9=_0x27ecf9||0x1f4;return function(_0xc68b11){logger[_0xa1b3('0x1d')](_0xc68b11[_0xa1b3('0x1e')]);if(_0xc68b11[_0xa1b3('0x1f')]){delete _0xc68b11[_0xa1b3('0x1f')];}_0x1b9a73['status'](_0x27ecf9)[_0xa1b3('0x20')](_0xc68b11);};}exports[_0xa1b3('0x21')]=function(_0x26febb,_0x33ec83){var _0x169d2={},_0x54e09d={},_0x3d1dc6={'count':0x0,'rows':[]};var _0x3a5a70=_[_0xa1b3('0x22')](db[_0xa1b3('0x23')][_0xa1b3('0x24')],function(_0x2cfa42){return{'name':_0x2cfa42[_0xa1b3('0x25')],'type':_0x2cfa42[_0xa1b3('0x26')][_0xa1b3('0x27')]};});_0x54e09d[_0xa1b3('0x28')]=_[_0xa1b3('0x22')](_0x3a5a70,_0xa1b3('0x1f'));_0x54e09d[_0xa1b3('0x29')]=_[_0xa1b3('0x2a')](_0x26febb[_0xa1b3('0x29')]);_0x54e09d[_0xa1b3('0x2b')]=_[_0xa1b3('0x2c')](_0x54e09d[_0xa1b3('0x28')],_0x54e09d[_0xa1b3('0x29')]);_0x169d2[_0xa1b3('0x2d')]=_[_0xa1b3('0x2c')](_0x54e09d[_0xa1b3('0x28')],qs['fields'](_0x26febb[_0xa1b3('0x29')]['fields']));_0x169d2[_0xa1b3('0x2d')]=_0x169d2['attributes'][_0xa1b3('0x2e')]?_0x169d2[_0xa1b3('0x2d')]:_0x54e09d['model'];if(!_0x26febb['query'][_0xa1b3('0x2f')](_0xa1b3('0x30'))){_0x169d2[_0xa1b3('0x31')]=qs[_0xa1b3('0x31')](_0x26febb[_0xa1b3('0x29')][_0xa1b3('0x31')]);_0x169d2[_0xa1b3('0x17')]=qs[_0xa1b3('0x17')](_0x26febb[_0xa1b3('0x29')][_0xa1b3('0x17')]);}_0x169d2['order']=qs[_0xa1b3('0x32')](_0x26febb['query'][_0xa1b3('0x32')]);_0x169d2[_0xa1b3('0x33')]=qs[_0xa1b3('0x2b')](_[_0xa1b3('0x34')](_0x26febb[_0xa1b3('0x29')],_0x54e09d[_0xa1b3('0x2b')]),_0x3a5a70);if(_0x26febb['query'][_0xa1b3('0x35')]){_0x169d2[_0xa1b3('0x33')]=_['merge'](_0x169d2[_0xa1b3('0x33')],{'$or':_['map'](_0x3a5a70,function(_0x424a8d){if(_0x424a8d[_0xa1b3('0x26')]!==_0xa1b3('0x36')){var _0x274d41={};_0x274d41[_0x424a8d[_0xa1b3('0x1f')]]={'$like':'%'+_0x26febb[_0xa1b3('0x29')][_0xa1b3('0x35')]+'%'};return _0x274d41;}})});}_0x169d2=_[_0xa1b3('0x37')]({},_0x169d2,_0x26febb[_0xa1b3('0x38')]);var _0x2b7628={'where':_0x169d2[_0xa1b3('0x33')]};return db[_0xa1b3('0x23')][_0xa1b3('0x16')](_0x2b7628)[_0xa1b3('0x39')](function(_0x4e3e36){_0x3d1dc6[_0xa1b3('0x16')]=_0x4e3e36;if(_0x26febb[_0xa1b3('0x29')]['includeAll']){_0x169d2[_0xa1b3('0x3a')]=[{'all':!![]}];}return db[_0xa1b3('0x23')][_0xa1b3('0x3b')](_0x169d2);})[_0xa1b3('0x39')](function(_0x52ebf3){_0x3d1dc6[_0xa1b3('0x3c')]=_0x52ebf3;return _0x3d1dc6;})['then'](respondWithFilteredResult(_0x33ec83,_0x169d2))[_0xa1b3('0x3d')](handleError(_0x33ec83,null));};exports['show']=function(_0x12cd99,_0x4bdfca){var _0x435ade={'raw':![],'where':{'id':_0x12cd99[_0xa1b3('0x3e')]['id']}},_0x513808={};_0x513808[_0xa1b3('0x28')]=_[_0xa1b3('0x2a')](db[_0xa1b3('0x23')]['rawAttributes']);_0x513808[_0xa1b3('0x29')]=_[_0xa1b3('0x2a')](_0x12cd99[_0xa1b3('0x29')]);_0x513808['filters']=_[_0xa1b3('0x2c')](_0x513808[_0xa1b3('0x28')],_0x513808['query']);_0x435ade[_0xa1b3('0x2d')]=_[_0xa1b3('0x2c')](_0x513808[_0xa1b3('0x28')],qs[_0xa1b3('0x3f')](_0x12cd99[_0xa1b3('0x29')][_0xa1b3('0x3f')]));_0x435ade[_0xa1b3('0x2d')]=_0x435ade[_0xa1b3('0x2d')][_0xa1b3('0x2e')]?_0x435ade[_0xa1b3('0x2d')]:_0x513808['model'];if(_0x12cd99[_0xa1b3('0x29')][_0xa1b3('0x40')]){_0x435ade['include']=[{'all':!![]}];}_0x435ade=_[_0xa1b3('0x37')]({},_0x435ade,_0x12cd99['options']);return db[_0xa1b3('0x23')][_0xa1b3('0x41')](_0x435ade)[_0xa1b3('0x39')](handleEntityNotFound(_0x4bdfca,null))[_0xa1b3('0x39')](respondWithResult(_0x4bdfca,null))['catch'](handleError(_0x4bdfca,null));};exports['create']=function(_0x2f9a15,_0x3a2362){return db['IntegrationReport']['create'](_0x2f9a15['body'],{})[_0xa1b3('0x39')](respondWithResult(_0x3a2362,0xc9))[_0xa1b3('0x3d')](handleError(_0x3a2362,null));};exports[_0xa1b3('0x1b')]=function(_0x5cd627,_0x1fb608){if(_0x5cd627[_0xa1b3('0x42')]['id']){delete _0x5cd627[_0xa1b3('0x42')]['id'];}return db[_0xa1b3('0x23')][_0xa1b3('0x41')]({'where':{'id':_0x5cd627['params']['id']}})[_0xa1b3('0x39')](handleEntityNotFound(_0x1fb608,null))['then'](saveUpdates(_0x5cd627[_0xa1b3('0x42')],null))['then'](respondWithResult(_0x1fb608,null))['catch'](handleError(_0x1fb608,null));};exports[_0xa1b3('0x43')]=function(_0x40f02b,_0x4b1017){return db['IntegrationReport'][_0xa1b3('0x41')]({'where':{'id':_0x40f02b[_0xa1b3('0x3e')]['id']}})[_0xa1b3('0x39')](handleEntityNotFound(_0x4b1017,null))[_0xa1b3('0x39')](removeEntity(_0x4b1017,null))[_0xa1b3('0x3d')](handleError(_0x4b1017,null));};exports[_0xa1b3('0x44')]=function(_0x583c3e,_0x53bbd7){return db[_0xa1b3('0x23')][_0xa1b3('0x44')]()['then'](respondWithResult(_0x53bbd7,null))[_0xa1b3('0x3d')](handleError(_0x53bbd7,null));}; \ No newline at end of file +var _0x7b23=['show','params','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','IntegrationReport','count','includeAll','include','findAll','catch'];(function(_0x3d5300,_0x3f748e){var _0x2c4a47=function(_0x10d22b){while(--_0x10d22b){_0x3d5300['push'](_0x3d5300['shift']());}};_0x2c4a47(++_0x3f748e);}(_0x7b23,0x1c8));var _0x37b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7b23[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x37b2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x37b2('0x1'));var zipdir=require(_0x37b2('0x2'));var jsonpatch=require(_0x37b2('0x3'));var rp=require('request-promise');var moment=require(_0x37b2('0x4'));var BPromise=require(_0x37b2('0x5'));var Mustache=require(_0x37b2('0x6'));var util=require(_0x37b2('0x7'));var path=require(_0x37b2('0x8'));var sox=require('sox');var csv=require(_0x37b2('0x9'));var ejs=require(_0x37b2('0xa'));var fs=require('fs');var _=require(_0x37b2('0xb'));var squel=require(_0x37b2('0xc'));var crypto=require(_0x37b2('0xd'));var jsforce=require(_0x37b2('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x37b2('0xf'));var Papa=require(_0x37b2('0x10'));var Redis=require(_0x37b2('0x11'));var authService=require(_0x37b2('0x12'));var qs=require(_0x37b2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x37b2('0x14'));var logger=require('../../config/logger')(_0x37b2('0x15'));var utils=require(_0x37b2('0x16'));var config=require(_0x37b2('0x17'));var licenseUtil=require(_0x37b2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c66dc,_0x55e26e){_0x55e26e=_0x55e26e||0xcc;return function(_0x5510e2){if(_0x5510e2){return _0x3c66dc[_0x37b2('0x19')](_0x55e26e);}return _0x3c66dc[_0x37b2('0x1a')](_0x55e26e)['end']();};}function respondWithResult(_0x214999,_0x25f7c8){_0x25f7c8=_0x25f7c8||0xc8;return function(_0xd18918){if(_0xd18918){return _0x214999[_0x37b2('0x1a')](_0x25f7c8)[_0x37b2('0x1b')](_0xd18918);}};}function respondWithFilteredResult(_0x22963f,_0x2abddf){return function(_0xcca6ec){if(_0xcca6ec){var _0x32bb1d=_0xcca6ec['count'],_0x522874=_0x2abddf[_0x37b2('0x1c')],_0x467034=_0x2abddf['offset']+_0x2abddf[_0x37b2('0x1d')],_0x16c4f1;if(_0x467034>=_0x32bb1d){_0x467034=_0x32bb1d;_0x16c4f1=0xc8;}else{_0x16c4f1=0xce;}_0x22963f[_0x37b2('0x1a')](_0x16c4f1);return _0x22963f['set'](_0x37b2('0x1e'),_0x522874+'-'+_0x467034+'/'+_0x32bb1d)[_0x37b2('0x1b')](_0xcca6ec);}return null;};}function patchUpdates(_0x2d7b65){return function(_0x264a47){try{jsonpatch[_0x37b2('0x1f')](_0x264a47,_0x2d7b65,!![]);}catch(_0x3da4a6){return BPromise[_0x37b2('0x20')](_0x3da4a6);}return _0x264a47[_0x37b2('0x21')]();};}function saveUpdates(_0x474c20,_0x533990){return function(_0x52d768){if(_0x52d768){return _0x52d768[_0x37b2('0x22')](_0x474c20)[_0x37b2('0x23')](function(_0x379f48){return _0x379f48;});}return null;};}function removeEntity(_0x4e89ea,_0xa3714f){return function(_0x37bc25){if(_0x37bc25){return _0x37bc25[_0x37b2('0x24')]()['then'](function(){_0x4e89ea[_0x37b2('0x1a')](0xcc)[_0x37b2('0x25')]();});}};}function handleEntityNotFound(_0x1aa5db,_0x517a25){return function(_0x511d31){if(!_0x511d31){_0x1aa5db['sendStatus'](0x194);}return _0x511d31;};}function handleError(_0x1f0e18,_0x578af6){_0x578af6=_0x578af6||0x1f4;return function(_0x1aac74){logger[_0x37b2('0x26')](_0x1aac74['stack']);if(_0x1aac74[_0x37b2('0x27')]){delete _0x1aac74[_0x37b2('0x27')];}_0x1f0e18[_0x37b2('0x1a')](_0x578af6)[_0x37b2('0x28')](_0x1aac74);};}exports[_0x37b2('0x29')]=function(_0x3b0bdf,_0x4a6bc6){var _0x390786={},_0x2faab2={},_0x3a93d6={'count':0x0,'rows':[]};var _0x46c6a6=_['map'](db['IntegrationReport'][_0x37b2('0x2a')],function(_0x402f1f){return{'name':_0x402f1f[_0x37b2('0x2b')],'type':_0x402f1f[_0x37b2('0x2c')][_0x37b2('0x2d')]};});_0x2faab2[_0x37b2('0x2e')]=_[_0x37b2('0x2f')](_0x46c6a6,'name');_0x2faab2[_0x37b2('0x30')]=_[_0x37b2('0x31')](_0x3b0bdf[_0x37b2('0x30')]);_0x2faab2[_0x37b2('0x32')]=_[_0x37b2('0x33')](_0x2faab2[_0x37b2('0x2e')],_0x2faab2['query']);_0x390786[_0x37b2('0x34')]=_[_0x37b2('0x33')](_0x2faab2[_0x37b2('0x2e')],qs[_0x37b2('0x35')](_0x3b0bdf['query']['fields']));_0x390786[_0x37b2('0x34')]=_0x390786[_0x37b2('0x34')][_0x37b2('0x36')]?_0x390786[_0x37b2('0x34')]:_0x2faab2[_0x37b2('0x2e')];if(!_0x3b0bdf['query'][_0x37b2('0x37')](_0x37b2('0x38'))){_0x390786[_0x37b2('0x1d')]=qs[_0x37b2('0x1d')](_0x3b0bdf['query'][_0x37b2('0x1d')]);_0x390786[_0x37b2('0x1c')]=qs[_0x37b2('0x1c')](_0x3b0bdf['query']['offset']);}_0x390786['order']=qs[_0x37b2('0x39')](_0x3b0bdf[_0x37b2('0x30')][_0x37b2('0x39')]);_0x390786['where']=qs[_0x37b2('0x32')](_['pick'](_0x3b0bdf['query'],_0x2faab2[_0x37b2('0x32')]),_0x46c6a6);if(_0x3b0bdf['query'][_0x37b2('0x3a')]){_0x390786[_0x37b2('0x3b')]=_[_0x37b2('0x3c')](_0x390786[_0x37b2('0x3b')],{'$or':_['map'](_0x46c6a6,function(_0x2dd356){if(_0x2dd356[_0x37b2('0x2c')]!==_0x37b2('0x3d')){var _0x474d96={};_0x474d96[_0x2dd356['name']]={'$like':'%'+_0x3b0bdf[_0x37b2('0x30')][_0x37b2('0x3a')]+'%'};return _0x474d96;}})});}_0x390786=_[_0x37b2('0x3c')]({},_0x390786,_0x3b0bdf[_0x37b2('0x3e')]);var _0x27da91={'where':_0x390786[_0x37b2('0x3b')]};return db[_0x37b2('0x3f')][_0x37b2('0x40')](_0x27da91)[_0x37b2('0x23')](function(_0x552b08){_0x3a93d6[_0x37b2('0x40')]=_0x552b08;if(_0x3b0bdf[_0x37b2('0x30')][_0x37b2('0x41')]){_0x390786[_0x37b2('0x42')]=[{'all':!![]}];}return db[_0x37b2('0x3f')][_0x37b2('0x43')](_0x390786);})[_0x37b2('0x23')](function(_0x299c79){_0x3a93d6['rows']=_0x299c79;return _0x3a93d6;})[_0x37b2('0x23')](respondWithFilteredResult(_0x4a6bc6,_0x390786))[_0x37b2('0x44')](handleError(_0x4a6bc6,null));};exports[_0x37b2('0x45')]=function(_0x58a152,_0x1c8e03){var _0x6ff43c={'raw':![],'where':{'id':_0x58a152[_0x37b2('0x46')]['id']}},_0x358169={};_0x358169[_0x37b2('0x2e')]=_[_0x37b2('0x31')](db[_0x37b2('0x3f')][_0x37b2('0x2a')]);_0x358169[_0x37b2('0x30')]=_[_0x37b2('0x31')](_0x58a152['query']);_0x358169[_0x37b2('0x32')]=_[_0x37b2('0x33')](_0x358169[_0x37b2('0x2e')],_0x358169[_0x37b2('0x30')]);_0x6ff43c[_0x37b2('0x34')]=_['intersection'](_0x358169[_0x37b2('0x2e')],qs[_0x37b2('0x35')](_0x58a152['query'][_0x37b2('0x35')]));_0x6ff43c['attributes']=_0x6ff43c[_0x37b2('0x34')]['length']?_0x6ff43c[_0x37b2('0x34')]:_0x358169[_0x37b2('0x2e')];if(_0x58a152[_0x37b2('0x30')][_0x37b2('0x41')]){_0x6ff43c[_0x37b2('0x42')]=[{'all':!![]}];}_0x6ff43c=_['merge']({},_0x6ff43c,_0x58a152[_0x37b2('0x3e')]);return db[_0x37b2('0x3f')][_0x37b2('0x47')](_0x6ff43c)[_0x37b2('0x23')](handleEntityNotFound(_0x1c8e03,null))[_0x37b2('0x23')](respondWithResult(_0x1c8e03,null))[_0x37b2('0x44')](handleError(_0x1c8e03,null));};exports[_0x37b2('0x48')]=function(_0x50e010,_0x2d3986){return db['IntegrationReport'][_0x37b2('0x48')](_0x50e010[_0x37b2('0x49')],{})[_0x37b2('0x23')](respondWithResult(_0x2d3986,0xc9))[_0x37b2('0x44')](handleError(_0x2d3986,null));};exports[_0x37b2('0x22')]=function(_0x200337,_0x2aeead){if(_0x200337[_0x37b2('0x49')]['id']){delete _0x200337[_0x37b2('0x49')]['id'];}return db[_0x37b2('0x3f')][_0x37b2('0x47')]({'where':{'id':_0x200337[_0x37b2('0x46')]['id']}})[_0x37b2('0x23')](handleEntityNotFound(_0x2aeead,null))[_0x37b2('0x23')](saveUpdates(_0x200337['body'],null))[_0x37b2('0x23')](respondWithResult(_0x2aeead,null))[_0x37b2('0x44')](handleError(_0x2aeead,null));};exports[_0x37b2('0x24')]=function(_0x35c03d,_0x5a876a){return db[_0x37b2('0x3f')][_0x37b2('0x47')]({'where':{'id':_0x35c03d['params']['id']}})[_0x37b2('0x23')](handleEntityNotFound(_0x5a876a,null))['then'](removeEntity(_0x5a876a,null))['catch'](handleError(_0x5a876a,null));};exports[_0x37b2('0x4a')]=function(_0x5d69d2,_0x368dcb){return db[_0x37b2('0x3f')][_0x37b2('0x4a')]()['then'](respondWithResult(_0x368dcb,null))['catch'](handleError(_0x368dcb,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 72fe13a..4a72760 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 _0x79d9=['rimraf','../../config/environment','./integrationReport.attributes','exports','report_integration','lodash','util','api','moment','request-promise','path'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x79d9,0x118));var _0x979d=function(_0xd9052e,_0xa54fea){_0xd9052e=_0xd9052e-0x0;var _0x3b23be=_0x79d9[_0xd9052e];return _0x3b23be;};'use strict';var _=require(_0x979d('0x0'));var util=require(_0x979d('0x1'));var logger=require('../../config/logger')(_0x979d('0x2'));var moment=require(_0x979d('0x3'));var BPromise=require('bluebird');var rp=require(_0x979d('0x4'));var fs=require('fs');var path=require(_0x979d('0x5'));var rimraf=require(_0x979d('0x6'));var config=require(_0x979d('0x7'));var attributes=require(_0x979d('0x8'));module[_0x979d('0x9')]=function(_0x1e17a6,_0x2b573e){return _0x1e17a6['define']('IntegrationReport',attributes,{'tableName':_0x979d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa752=['bluebird','request-promise','rimraf','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','api','moment'];(function(_0x10b8f4,_0x285dca){var _0x1dc12c=function(_0x5a83df){while(--_0x5a83df){_0x10b8f4['push'](_0x10b8f4['shift']());}};_0x1dc12c(++_0x285dca);}(_0xa752,0xbc));var _0x2a75=function(_0x56027b,_0x28d00f){_0x56027b=_0x56027b-0x0;var _0x240bbb=_0xa752[_0x56027b];return _0x240bbb;};'use strict';var _=require(_0x2a75('0x0'));var util=require(_0x2a75('0x1'));var logger=require('../../config/logger')(_0x2a75('0x2'));var moment=require(_0x2a75('0x3'));var BPromise=require(_0x2a75('0x4'));var rp=require(_0x2a75('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2a75('0x6'));var config=require('../../config/environment');var attributes=require(_0x2a75('0x7'));module[_0x2a75('0x8')]=function(_0x157ae3,_0xc77cc){return _0x157ae3[_0x2a75('0x9')](_0x2a75('0xa'),attributes,{'tableName':_0x2a75('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index b8d96ec..d274529 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fc2=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x3a78a0,_0x44985f){var _0x48e917=function(_0x1e428c){while(--_0x1e428c){_0x3a78a0['push'](_0x3a78a0['shift']());}};_0x48e917(++_0x44985f);}(_0x4fc2,0x111));var _0x24fc=function(_0x2a1465,_0x8bf785){_0x2a1465=_0x2a1465-0x0;var _0x128933=_0x4fc2[_0x2a1465];return _0x128933;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4889f4,_0x115851,_0x22a0c8){return new BPromise(function(_0x220f9a,_0x123eff){return client[_0x24fc('0xb')](_0x4889f4,_0x22a0c8)[_0x24fc('0xc')](function(_0x5afdf1){logger[_0x24fc('0xd')](_0x24fc('0xe'),_0x115851,_0x24fc('0xf'));logger[_0x24fc('0x10')](_0x24fc('0x11'),_0x115851,_0x24fc('0xf'),JSON[_0x24fc('0x12')](_0x5afdf1));if(_0x5afdf1[_0x24fc('0x13')]){if(_0x5afdf1['error'][_0x24fc('0x14')]===0x1f4){logger[_0x24fc('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x115851,_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);return _0x123eff(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x5afdf1['error'][_0x24fc('0x15')]);return _0x220f9a(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}else{logger[_0x24fc('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x115851,_0x24fc('0xf'));_0x220f9a(_0x5afdf1['result'][_0x24fc('0x15')]);}})[_0x24fc('0x16')](function(_0x218fb6){logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x218fb6);_0x123eff(_0x218fb6);});});} \ No newline at end of file +var _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment'];(function(_0x416326,_0xd2abb0){var _0xa70bf5=function(_0x2a2d1b){while(--_0x2a2d1b){_0x416326['push'](_0x416326['shift']());}};_0xa70bf5(++_0xd2abb0);}(_0xda2d,0x102));var _0xdda2=function(_0x5c4213,_0xba1d23){_0x5c4213=_0x5c4213-0x0;var _0x1f4524=_0xda2d[_0x5c4213];return _0x1f4524;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('IntegrationReport,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 3097839..7b99da4 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 _0x9c44=['../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','addInterval','addIntervals','put','update','destroy','exports','path','connect-timeout','express','Router'];(function(_0x29a1ba,_0x27f65a){var _0x1eaf80=function(_0xa1346a){while(--_0xa1346a){_0x29a1ba['push'](_0x29a1ba['shift']());}};_0x1eaf80(++_0x27f65a);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['get'](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xc')]);router[_0x49c4('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x49c4('0xd')](_0x49c4('0xb'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);router[_0x49c4('0xd')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth[_0x49c4('0x9')](),controller[_0x49c4('0x11')]);router['delete'](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0x12')]);module[_0x49c4('0x13')]=router; \ No newline at end of file +var _0x008c=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','exports','multer','util','path','connect-timeout'];(function(_0x51fa1c,_0x1d214b){var _0x290a73=function(_0x4b656f){while(--_0x4b656f){_0x51fa1c['push'](_0x51fa1c['shift']());}};_0x290a73(++_0x1d214b);}(_0x008c,0x188));var _0xc008=function(_0x4a1353,_0x2fbe86){_0x4a1353=_0x4a1353-0x0;var _0x3805cc=_0x008c[_0x4a1353];return _0x3805cc;};'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['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['getIntervals']);router[_0xc008('0xf')]('/',auth[_0xc008('0xa')](),controller['create']);router['post']('/:id/sub_intervals',auth[_0xc008('0xa')](),controller[_0xc008('0x10')]);router['post'](_0xc008('0x11'),auth[_0xc008('0xa')](),controller[_0xc008('0x12')]);router[_0xc008('0x13')](_0xc008('0xc'),auth[_0xc008('0xa')](),controller[_0xc008('0x14')]);router['delete']('/:id',auth[_0xc008('0xa')](),controller['destroy']);module[_0xc008('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 13ff9f4..720d1f7 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 _0xb22f=['STRING','sequelize','exports'];(function(_0xeae8ff,_0x3c1cbf){var _0x18369f=function(_0x30fc9f){while(--_0x30fc9f){_0xeae8ff['push'](_0xeae8ff['shift']());}};_0x18369f(++_0x3c1cbf);}(_0xb22f,0xfa));var _0xfb22=function(_0x348091,_0x2d3e35){_0x348091=_0x348091-0x0;var _0x151d69=_0xb22f[_0x348091];return _0x151d69;};'use strict';var Sequelize=require(_0xfb22('0x0'));module[_0xfb22('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xfb22('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xec73=['STRING','exports'];(function(_0x1cf099,_0x1060a8){var _0x726512=function(_0x159ca2){while(--_0x159ca2){_0x1cf099['push'](_0x1cf099['shift']());}};_0x726512(++_0x1060a8);}(_0xec73,0x17b));var _0x3ec7=function(_0x35091c,_0x3f676b){_0x35091c=_0x35091c-0x0;var _0x21c9a9=_0xec73[_0x35091c];return _0x21c9a9;};'use strict';var Sequelize=require('sequelize');module[_0x3ec7('0x0')]={'name':{'type':Sequelize[_0x3ec7('0x1')]},'description':{'type':Sequelize[_0x3ec7('0x1')]},'interval':{'type':Sequelize[_0x3ec7('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 baf9dde..4218c6e 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 _0x2138=['model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','show','keys','intersection','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addInterval','getIntervals','findOne','order','addIntervals','sequelize','IntervalId','bulkCreate','findAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','json','count','offset','status','set','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x2138,0x19d));var _0x8213=function(_0x28cde9,_0x4c30c2){_0x28cde9=_0x28cde9-0x0;var _0x3667e5=_0x2138[_0x28cde9];return _0x3667e5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8213('0x0'));var rimraf=require(_0x8213('0x1'));var zipdir=require(_0x8213('0x2'));var jsonpatch=require(_0x8213('0x3'));var rp=require('request-promise');var moment=require(_0x8213('0x4'));var BPromise=require(_0x8213('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8213('0x6'));var sox=require(_0x8213('0x7'));var csv=require(_0x8213('0x8'));var ejs=require(_0x8213('0x9'));var fs=require('fs');var _=require(_0x8213('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8213('0xb'));var deskjs=require(_0x8213('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8213('0xd'));var authService=require(_0x8213('0xe'));var qs=require(_0x8213('0xf'));var as=require(_0x8213('0x10'));var hardwareService=require(_0x8213('0x11'));var logger=require(_0x8213('0x12'))(_0x8213('0x13'));var utils=require(_0x8213('0x14'));var config=require(_0x8213('0x15'));var licenseUtil=require(_0x8213('0x16'));var db=require(_0x8213('0x17'))['db'];var extensions=require(_0x8213('0x18'));function respondWithStatusCode(_0x570d57,_0x33813b){_0x33813b=_0x33813b||0xcc;return function(_0x37215b){if(_0x37215b){return _0x570d57[_0x8213('0x19')](_0x33813b);}return _0x570d57['status'](_0x33813b)[_0x8213('0x1a')]();};}function respondWithResult(_0x575d90,_0x487ad6){_0x487ad6=_0x487ad6||0xc8;return function(_0x1146d2){if(_0x1146d2){return _0x575d90['status'](_0x487ad6)[_0x8213('0x1b')](_0x1146d2);}};}function respondWithFilteredResult(_0x2c47d5,_0x2304bf){return function(_0x185ca0){if(_0x185ca0){var _0x52547c=_0x185ca0[_0x8213('0x1c')],_0x4af8a7=_0x2304bf[_0x8213('0x1d')],_0x46b764=_0x2304bf[_0x8213('0x1d')]+_0x2304bf['limit'],_0x4aff2d;if(_0x46b764>=_0x52547c){_0x46b764=_0x52547c;_0x4aff2d=0xc8;}else{_0x4aff2d=0xce;}_0x2c47d5[_0x8213('0x1e')](_0x4aff2d);return _0x2c47d5[_0x8213('0x1f')]('Content-Range',_0x4af8a7+'-'+_0x46b764+'/'+_0x52547c)['json'](_0x185ca0);}return null;};}function patchUpdates(_0x525b14){return function(_0x75199e){try{jsonpatch[_0x8213('0x20')](_0x75199e,_0x525b14,!![]);}catch(_0x4776ef){return BPromise[_0x8213('0x21')](_0x4776ef);}return _0x75199e[_0x8213('0x22')]();};}function saveUpdates(_0x3125ae,_0x32540f){return function(_0x1758c1){if(_0x1758c1){return _0x1758c1[_0x8213('0x23')](_0x3125ae)[_0x8213('0x24')](function(_0x59ccbb){return _0x59ccbb;});}return null;};}function removeEntity(_0x5c8b17,_0x4ca7c6){return function(_0x16c89d){if(_0x16c89d){return _0x16c89d[_0x8213('0x25')]()['then'](function(){var _0x219d9b=_0x16c89d[_0x8213('0x26')]({'plain':!![]});var _0x228fce=_0x8213('0x27');return db[_0x8213('0x28')][_0x8213('0x25')]({'where':{'type':_0x228fce,'resourceId':_0x219d9b['id']}})['then'](function(){return _0x16c89d;});})[_0x8213('0x24')](function(){_0x5c8b17[_0x8213('0x1e')](0xcc)[_0x8213('0x1a')]();});}};}function handleEntityNotFound(_0x197bc6,_0x8187f5){return function(_0x65b521){if(!_0x65b521){_0x197bc6[_0x8213('0x19')](0x194);}return _0x65b521;};}function handleError(_0x44befd,_0x5ea854){_0x5ea854=_0x5ea854||0x1f4;return function(_0x2eea97){logger[_0x8213('0x29')](_0x2eea97[_0x8213('0x2a')]);if(_0x2eea97['name']){delete _0x2eea97[_0x8213('0x2b')];}_0x44befd['status'](_0x5ea854)[_0x8213('0x2c')](_0x2eea97);};}exports[_0x8213('0x2d')]=function(_0x271768,_0x2dc071){var _0x2524ea={},_0x1b0813={},_0x189448={'count':0x0,'rows':[]};var _0x5d10bf=_[_0x8213('0x2e')](db[_0x8213('0x2f')][_0x8213('0x30')],function(_0x43baf0){return{'name':_0x43baf0[_0x8213('0x31')],'type':_0x43baf0[_0x8213('0x32')][_0x8213('0x33')]};});_0x1b0813[_0x8213('0x34')]=_[_0x8213('0x2e')](_0x5d10bf,_0x8213('0x2b'));_0x1b0813[_0x8213('0x35')]=_['keys'](_0x271768[_0x8213('0x35')]);_0x1b0813[_0x8213('0x36')]=_['intersection'](_0x1b0813[_0x8213('0x34')],_0x1b0813[_0x8213('0x35')]);_0x2524ea[_0x8213('0x37')]=_['intersection'](_0x1b0813[_0x8213('0x34')],qs[_0x8213('0x38')](_0x271768['query'][_0x8213('0x38')]));_0x2524ea['attributes']=_0x2524ea[_0x8213('0x37')][_0x8213('0x39')]?_0x2524ea[_0x8213('0x37')]:_0x1b0813['model'];if(!_0x271768[_0x8213('0x35')][_0x8213('0x3a')](_0x8213('0x3b'))){_0x2524ea[_0x8213('0x3c')]=qs['limit'](_0x271768[_0x8213('0x35')][_0x8213('0x3c')]);_0x2524ea[_0x8213('0x1d')]=qs[_0x8213('0x1d')](_0x271768[_0x8213('0x35')][_0x8213('0x1d')]);}_0x2524ea['order']=qs[_0x8213('0x3d')](_0x271768[_0x8213('0x35')][_0x8213('0x3d')]);_0x2524ea[_0x8213('0x3e')]=qs[_0x8213('0x36')](_[_0x8213('0x3f')](_0x271768[_0x8213('0x35')],_0x1b0813[_0x8213('0x36')]),_0x5d10bf);if(_0x271768['query'][_0x8213('0x40')]){_0x2524ea[_0x8213('0x3e')]=_[_0x8213('0x41')](_0x2524ea[_0x8213('0x3e')],{'$or':_['map'](_0x5d10bf,function(_0x1b8b49){if(_0x1b8b49[_0x8213('0x32')]!==_0x8213('0x42')){var _0x43a54c={};_0x43a54c[_0x1b8b49['name']]={'$like':'%'+_0x271768[_0x8213('0x35')][_0x8213('0x40')]+'%'};return _0x43a54c;}})});}_0x2524ea=_['merge']({},_0x2524ea,_0x271768[_0x8213('0x43')]);var _0xcfe219={'where':_0x2524ea['where']};return db[_0x8213('0x2f')][_0x8213('0x1c')](_0xcfe219)[_0x8213('0x24')](function(_0x1f83e7){_0x189448[_0x8213('0x1c')]=_0x1f83e7;if(_0x271768[_0x8213('0x35')]['includeAll']){_0x2524ea['include']=[{'all':!![]}];}return db[_0x8213('0x2f')]['findAll'](_0x2524ea);})[_0x8213('0x24')](function(_0x432f9a){_0x189448[_0x8213('0x44')]=_0x432f9a;return _0x189448;})[_0x8213('0x24')](respondWithFilteredResult(_0x2dc071,_0x2524ea))[_0x8213('0x45')](handleError(_0x2dc071,null));};exports[_0x8213('0x46')]=function(_0x2f8de3,_0x558bb6){var _0x27291c={'raw':!![],'where':{'id':_0x2f8de3['params']['id']}},_0x1a057c={};_0x1a057c[_0x8213('0x34')]=_['keys'](db[_0x8213('0x2f')]['rawAttributes']);_0x1a057c[_0x8213('0x35')]=_[_0x8213('0x47')](_0x2f8de3[_0x8213('0x35')]);_0x1a057c[_0x8213('0x36')]=_['intersection'](_0x1a057c[_0x8213('0x34')],_0x1a057c['query']);_0x27291c[_0x8213('0x37')]=_[_0x8213('0x48')](_0x1a057c[_0x8213('0x34')],qs[_0x8213('0x38')](_0x2f8de3[_0x8213('0x35')]['fields']));_0x27291c['attributes']=_0x27291c[_0x8213('0x37')][_0x8213('0x39')]?_0x27291c[_0x8213('0x37')]:_0x1a057c[_0x8213('0x34')];if(_0x2f8de3[_0x8213('0x35')][_0x8213('0x49')]){_0x27291c['include']=[{'all':!![]}];}_0x27291c=_[_0x8213('0x41')]({},_0x27291c,_0x2f8de3['options']);return db[_0x8213('0x2f')][_0x8213('0x4a')](_0x27291c)[_0x8213('0x24')](handleEntityNotFound(_0x558bb6,null))[_0x8213('0x24')](respondWithResult(_0x558bb6,null))[_0x8213('0x45')](handleError(_0x558bb6,null));};exports[_0x8213('0x4b')]=function(_0x2428d2,_0x27df78){return db['Interval']['create'](_0x2428d2['body'],{})[_0x8213('0x24')](function(_0x4acb84){var _0xc26f97=_0x2428d2[_0x8213('0x4c')][_0x8213('0x26')]({'plain':!![]});if(!_0xc26f97)throw new Error(_0x8213('0x4d'));if(_0xc26f97[_0x8213('0x4e')]===_0x8213('0x4c')){var _0x58f04f=_0x4acb84['get']({'plain':!![]});var _0x5f45c1=_0x8213('0x27');return db[_0x8213('0x4f')][_0x8213('0x4a')]({'where':{'name':_0x5f45c1,'userProfileId':_0xc26f97[_0x8213('0x50')]},'raw':!![]})['then'](function(_0x30cea2){if(_0x30cea2&&_0x30cea2['autoAssociation']===0x0){return db[_0x8213('0x28')][_0x8213('0x4b')]({'name':_0x58f04f[_0x8213('0x2b')],'resourceId':_0x58f04f['id'],'type':_0x30cea2[_0x8213('0x2b')],'sectionId':_0x30cea2['id']},{})[_0x8213('0x24')](function(){return _0x4acb84;});}else{return _0x4acb84;}})['catch'](function(_0x2f38c1){logger[_0x8213('0x29')](_0x8213('0x51'),_0x2f38c1);throw _0x2f38c1;});}return _0x4acb84;})[_0x8213('0x24')](respondWithResult(_0x27df78,0xc9))[_0x8213('0x45')](handleError(_0x27df78,null));};exports[_0x8213('0x23')]=function(_0x38ad14,_0x4e6f75){if(_0x38ad14[_0x8213('0x52')]['id']){delete _0x38ad14['body']['id'];}return db['Interval'][_0x8213('0x4a')]({'where':{'id':_0x38ad14[_0x8213('0x53')]['id']}})[_0x8213('0x24')](handleEntityNotFound(_0x4e6f75,null))[_0x8213('0x24')](saveUpdates(_0x38ad14[_0x8213('0x52')],null))[_0x8213('0x24')](respondWithResult(_0x4e6f75,null))[_0x8213('0x45')](handleError(_0x4e6f75,null));};exports[_0x8213('0x25')]=function(_0x46b430,_0x3b4485){return db[_0x8213('0x2f')][_0x8213('0x4a')]({'where':{'id':_0x46b430[_0x8213('0x53')]['id']}})['then'](handleEntityNotFound(_0x3b4485,null))[_0x8213('0x24')](removeEntity(_0x3b4485,null))['catch'](handleError(_0x3b4485,null));};exports[_0x8213('0x54')]=function(_0x52327d,_0x5460b7,_0x111cb0){if(_0x52327d[_0x8213('0x52')]['id']){delete _0x52327d['body']['id'];}return db['Interval'][_0x8213('0x4a')]({'where':{'id':_0x52327d['params']['id']}})['then'](handleEntityNotFound(_0x5460b7,null))['then'](function(_0x3812a8){if(_0x3812a8){_0x52327d[_0x8213('0x52')]['IntervalId']=_0x3812a8['id'];return db['Interval'][_0x8213('0x4b')](_0x52327d[_0x8213('0x52')]);}})[_0x8213('0x24')](respondWithResult(_0x5460b7,null))[_0x8213('0x45')](handleError(_0x5460b7,null));};exports[_0x8213('0x55')]=function(_0x2dc26c,_0x2df129,_0x1ba66c){var _0x4b2d79={};var _0xc58595={};var _0x515628;var _0x69c11d;return db[_0x8213('0x2f')][_0x8213('0x56')]({'where':{'id':_0x2dc26c['params']['id']}})[_0x8213('0x24')](handleEntityNotFound(_0x2df129,null))[_0x8213('0x24')](function(_0x245e40){if(_0x245e40){_0x515628=_0x245e40;_0xc58595['model']=_[_0x8213('0x47')](db[_0x8213('0x2f')][_0x8213('0x30')]);_0xc58595[_0x8213('0x35')]=_[_0x8213('0x47')](_0x2dc26c[_0x8213('0x35')]);_0xc58595[_0x8213('0x36')]=_[_0x8213('0x48')](_0xc58595['model'],_0xc58595[_0x8213('0x35')]);_0x4b2d79[_0x8213('0x37')]=_['intersection'](_0xc58595['model'],qs[_0x8213('0x38')](_0x2dc26c[_0x8213('0x35')][_0x8213('0x38')]));_0x4b2d79[_0x8213('0x37')]=_0x4b2d79[_0x8213('0x37')][_0x8213('0x39')]?_0x4b2d79[_0x8213('0x37')]:_0xc58595[_0x8213('0x34')];_0x4b2d79[_0x8213('0x57')]=qs['sort'](_0x2dc26c[_0x8213('0x35')][_0x8213('0x3d')]);_0x4b2d79['where']=qs[_0x8213('0x36')](_[_0x8213('0x3f')](_0x2dc26c[_0x8213('0x35')],_0xc58595[_0x8213('0x36')]));if(_0x2dc26c['query']['filter']){_0x4b2d79[_0x8213('0x3e')]=_[_0x8213('0x41')](_0x4b2d79['where'],{'$or':_[_0x8213('0x2e')](_0x4b2d79[_0x8213('0x37')],function(_0x4d1f16){var _0x39d0f4={};_0x39d0f4[_0x4d1f16]={'$like':'%'+_0x2dc26c[_0x8213('0x35')]['filter']+'%'};return _0x39d0f4;})});}_0x4b2d79=_[_0x8213('0x41')]({},_0x4b2d79,_0x2dc26c[_0x8213('0x43')]);return _0x515628[_0x8213('0x55')](_0x4b2d79);}})[_0x8213('0x24')](function(_0x2fe552){if(_0x2fe552){_0x69c11d=_0x2fe552[_0x8213('0x39')];if(!_0x2dc26c[_0x8213('0x35')]['hasOwnProperty'](_0x8213('0x3b'))){_0x4b2d79[_0x8213('0x3c')]=qs[_0x8213('0x3c')](_0x2dc26c['query'][_0x8213('0x3c')]);_0x4b2d79[_0x8213('0x1d')]=qs[_0x8213('0x1d')](_0x2dc26c['query'][_0x8213('0x1d')]);}return _0x515628[_0x8213('0x55')](_0x4b2d79);}})[_0x8213('0x24')](function(_0x159e40){if(_0x159e40){return _0x159e40?{'count':_0x69c11d,'rows':_0x159e40}:null;}})[_0x8213('0x24')](respondWithResult(_0x2df129,null))[_0x8213('0x45')](handleError(_0x2df129,null));};exports[_0x8213('0x58')]=function(_0x1822ac,_0x94980e,_0x5ea215){return db[_0x8213('0x2f')][_0x8213('0x56')]({'where':{'id':_0x1822ac[_0x8213('0x53')]['id']}})['then'](handleEntityNotFound(_0x94980e,null))[_0x8213('0x24')](function(_0x234ab2){if(_0x234ab2){return db[_0x8213('0x59')]['transaction'](function(_0x212f01){return db[_0x8213('0x2f')][_0x8213('0x25')]({'where':{'IntervalId':_0x1822ac[_0x8213('0x53')]['id']},'transaction':_0x212f01})[_0x8213('0x24')](function(_0x4445e4){var _0x4f3b1f=_[_0x8213('0x2e')](_0x1822ac[_0x8213('0x52')],function(_0x28cb50){delete _0x28cb50['id'];_0x28cb50[_0x8213('0x5a')]=_0x1822ac[_0x8213('0x53')]['id'];return _0x28cb50;});return db[_0x8213('0x2f')][_0x8213('0x5b')](_0x4f3b1f,{'transaction':_0x212f01});});})[_0x8213('0x24')](function(){return db['Interval'][_0x8213('0x5c')]({'where':{'IntervalId':_0x1822ac[_0x8213('0x53')]['id']}});});}})[_0x8213('0x24')](respondWithResult(_0x94980e,null))[_0x8213('0x45')](handleError(_0x94980e,null));}; \ No newline at end of file +var _0x313d=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','findOne','getIntervals','addIntervals','transaction','bulkCreate','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','stack','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Interval','includeAll','include','findAll','rows','show','params','keys','find'];(function(_0x230ea1,_0x469821){var _0x1f55ae=function(_0x4b0fda){while(--_0x4b0fda){_0x230ea1['push'](_0x230ea1['shift']());}};_0x1f55ae(++_0x469821);}(_0x313d,0x11f));var _0xd313=function(_0x25ae8d,_0x33f8fa){_0x25ae8d=_0x25ae8d-0x0;var _0x597427=_0x313d[_0x25ae8d];return _0x597427;};'use strict';var pdf=require(_0xd313('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd313('0x1'));var zipdir=require(_0xd313('0x2'));var jsonpatch=require(_0xd313('0x3'));var rp=require(_0xd313('0x4'));var moment=require(_0xd313('0x5'));var BPromise=require(_0xd313('0x6'));var Mustache=require(_0xd313('0x7'));var util=require(_0xd313('0x8'));var path=require(_0xd313('0x9'));var sox=require(_0xd313('0xa'));var csv=require('to-csv');var ejs=require(_0xd313('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd313('0xc'));var crypto=require(_0xd313('0xd'));var jsforce=require(_0xd313('0xe'));var deskjs=require(_0xd313('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd313('0x10'));var Papa=require(_0xd313('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd313('0x12'));var as=require(_0xd313('0x13'));var hardwareService=require(_0xd313('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd313('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd313('0x16'))['db'];var extensions=require(_0xd313('0x17'));function respondWithStatusCode(_0x419bd9,_0x20f470){_0x20f470=_0x20f470||0xcc;return function(_0x15a6db){if(_0x15a6db){return _0x419bd9[_0xd313('0x18')](_0x20f470);}return _0x419bd9[_0xd313('0x19')](_0x20f470)[_0xd313('0x1a')]();};}function respondWithResult(_0x5c9117,_0x231799){_0x231799=_0x231799||0xc8;return function(_0x33db64){if(_0x33db64){return _0x5c9117[_0xd313('0x19')](_0x231799)[_0xd313('0x1b')](_0x33db64);}};}function respondWithFilteredResult(_0x1ad857,_0x30da0e){return function(_0xa4deab){if(_0xa4deab){var _0x4be901=_0xa4deab[_0xd313('0x1c')],_0x5cfd24=_0x30da0e[_0xd313('0x1d')],_0x4a684e=_0x30da0e[_0xd313('0x1d')]+_0x30da0e[_0xd313('0x1e')],_0x5049df;if(_0x4a684e>=_0x4be901){_0x4a684e=_0x4be901;_0x5049df=0xc8;}else{_0x5049df=0xce;}_0x1ad857[_0xd313('0x19')](_0x5049df);return _0x1ad857[_0xd313('0x1f')](_0xd313('0x20'),_0x5cfd24+'-'+_0x4a684e+'/'+_0x4be901)[_0xd313('0x1b')](_0xa4deab);}return null;};}function patchUpdates(_0x468638){return function(_0x2c7e96){try{jsonpatch[_0xd313('0x21')](_0x2c7e96,_0x468638,!![]);}catch(_0x56126a){return BPromise[_0xd313('0x22')](_0x56126a);}return _0x2c7e96[_0xd313('0x23')]();};}function saveUpdates(_0x10d939,_0x4693df){return function(_0x391be3){if(_0x391be3){return _0x391be3[_0xd313('0x24')](_0x10d939)[_0xd313('0x25')](function(_0x1d3476){return _0x1d3476;});}return null;};}function removeEntity(_0xe4c610,_0x5af892){return function(_0x52c986){if(_0x52c986){return _0x52c986[_0xd313('0x26')]()[_0xd313('0x25')](function(){var _0xb43d14=_0x52c986[_0xd313('0x27')]({'plain':!![]});var _0x52cb0d=_0xd313('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x52cb0d,'resourceId':_0xb43d14['id']}})[_0xd313('0x25')](function(){return _0x52c986;});})['then'](function(){_0xe4c610['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x156bc8,_0xab3f33){return function(_0x4d37fb){if(!_0x4d37fb){_0x156bc8[_0xd313('0x18')](0x194);}return _0x4d37fb;};}function handleError(_0xe000e6,_0x408179){_0x408179=_0x408179||0x1f4;return function(_0xa04e9d){logger['error'](_0xa04e9d[_0xd313('0x29')]);if(_0xa04e9d['name']){delete _0xa04e9d[_0xd313('0x2a')];}_0xe000e6[_0xd313('0x19')](_0x408179)['send'](_0xa04e9d);};}exports[_0xd313('0x2b')]=function(_0x147149,_0x4d7f96){var _0x578054={},_0x25c3fa={},_0x389b94={'count':0x0,'rows':[]};var _0x2d17d4=_[_0xd313('0x2c')](db['Interval'][_0xd313('0x2d')],function(_0x41d89e){return{'name':_0x41d89e[_0xd313('0x2e')],'type':_0x41d89e['type'][_0xd313('0x2f')]};});_0x25c3fa[_0xd313('0x30')]=_[_0xd313('0x2c')](_0x2d17d4,'name');_0x25c3fa[_0xd313('0x31')]=_['keys'](_0x147149[_0xd313('0x31')]);_0x25c3fa[_0xd313('0x32')]=_[_0xd313('0x33')](_0x25c3fa[_0xd313('0x30')],_0x25c3fa[_0xd313('0x31')]);_0x578054[_0xd313('0x34')]=_[_0xd313('0x33')](_0x25c3fa[_0xd313('0x30')],qs[_0xd313('0x35')](_0x147149[_0xd313('0x31')][_0xd313('0x35')]));_0x578054['attributes']=_0x578054[_0xd313('0x34')][_0xd313('0x36')]?_0x578054['attributes']:_0x25c3fa[_0xd313('0x30')];if(!_0x147149[_0xd313('0x31')][_0xd313('0x37')](_0xd313('0x38'))){_0x578054[_0xd313('0x1e')]=qs[_0xd313('0x1e')](_0x147149[_0xd313('0x31')][_0xd313('0x1e')]);_0x578054[_0xd313('0x1d')]=qs[_0xd313('0x1d')](_0x147149[_0xd313('0x31')][_0xd313('0x1d')]);}_0x578054[_0xd313('0x39')]=qs[_0xd313('0x3a')](_0x147149[_0xd313('0x31')]['sort']);_0x578054[_0xd313('0x3b')]=qs[_0xd313('0x32')](_['pick'](_0x147149[_0xd313('0x31')],_0x25c3fa['filters']),_0x2d17d4);if(_0x147149['query'][_0xd313('0x3c')]){_0x578054[_0xd313('0x3b')]=_[_0xd313('0x3d')](_0x578054['where'],{'$or':_[_0xd313('0x2c')](_0x2d17d4,function(_0x595ac9){if(_0x595ac9['type']!==_0xd313('0x3e')){var _0x3dbf0b={};_0x3dbf0b[_0x595ac9[_0xd313('0x2a')]]={'$like':'%'+_0x147149['query'][_0xd313('0x3c')]+'%'};return _0x3dbf0b;}})});}_0x578054=_[_0xd313('0x3d')]({},_0x578054,_0x147149[_0xd313('0x3f')]);var _0x60b530={'where':_0x578054[_0xd313('0x3b')]};return db[_0xd313('0x40')][_0xd313('0x1c')](_0x60b530)['then'](function(_0x4ae477){_0x389b94[_0xd313('0x1c')]=_0x4ae477;if(_0x147149[_0xd313('0x31')][_0xd313('0x41')]){_0x578054[_0xd313('0x42')]=[{'all':!![]}];}return db[_0xd313('0x40')][_0xd313('0x43')](_0x578054);})[_0xd313('0x25')](function(_0x35fc61){_0x389b94[_0xd313('0x44')]=_0x35fc61;return _0x389b94;})[_0xd313('0x25')](respondWithFilteredResult(_0x4d7f96,_0x578054))['catch'](handleError(_0x4d7f96,null));};exports[_0xd313('0x45')]=function(_0x281ef6,_0x4b351){var _0x53ac0a={'raw':!![],'where':{'id':_0x281ef6[_0xd313('0x46')]['id']}},_0xd9a9ac={};_0xd9a9ac[_0xd313('0x30')]=_[_0xd313('0x47')](db['Interval'][_0xd313('0x2d')]);_0xd9a9ac[_0xd313('0x31')]=_[_0xd313('0x47')](_0x281ef6[_0xd313('0x31')]);_0xd9a9ac[_0xd313('0x32')]=_['intersection'](_0xd9a9ac[_0xd313('0x30')],_0xd9a9ac[_0xd313('0x31')]);_0x53ac0a['attributes']=_['intersection'](_0xd9a9ac[_0xd313('0x30')],qs[_0xd313('0x35')](_0x281ef6[_0xd313('0x31')]['fields']));_0x53ac0a['attributes']=_0x53ac0a[_0xd313('0x34')][_0xd313('0x36')]?_0x53ac0a[_0xd313('0x34')]:_0xd9a9ac['model'];if(_0x281ef6[_0xd313('0x31')]['includeAll']){_0x53ac0a[_0xd313('0x42')]=[{'all':!![]}];}_0x53ac0a=_[_0xd313('0x3d')]({},_0x53ac0a,_0x281ef6[_0xd313('0x3f')]);return db['Interval'][_0xd313('0x48')](_0x53ac0a)[_0xd313('0x25')](handleEntityNotFound(_0x4b351,null))[_0xd313('0x25')](respondWithResult(_0x4b351,null))['catch'](handleError(_0x4b351,null));};exports[_0xd313('0x49')]=function(_0x5c5851,_0x1c7557){return db[_0xd313('0x40')][_0xd313('0x49')](_0x5c5851[_0xd313('0x4a')],{})[_0xd313('0x25')](function(_0x28e90f){var _0x3420e2=_0x5c5851[_0xd313('0x4b')][_0xd313('0x27')]({'plain':!![]});if(!_0x3420e2)throw new Error(_0xd313('0x4c'));if(_0x3420e2[_0xd313('0x4d')]===_0xd313('0x4b')){var _0x58dbfb=_0x28e90f['get']({'plain':!![]});var _0x28ac5a=_0xd313('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x28ac5a,'userProfileId':_0x3420e2[_0xd313('0x4e')]},'raw':!![]})['then'](function(_0x2454a4){if(_0x2454a4&&_0x2454a4[_0xd313('0x4f')]===0x0){return db[_0xd313('0x50')][_0xd313('0x49')]({'name':_0x58dbfb[_0xd313('0x2a')],'resourceId':_0x58dbfb['id'],'type':_0x2454a4['name'],'sectionId':_0x2454a4['id']},{})['then'](function(){return _0x28e90f;});}else{return _0x28e90f;}})[_0xd313('0x51')](function(_0x422451){logger[_0xd313('0x52')](_0xd313('0x53'),_0x422451);throw _0x422451;});}return _0x28e90f;})[_0xd313('0x25')](respondWithResult(_0x1c7557,0xc9))[_0xd313('0x51')](handleError(_0x1c7557,null));};exports[_0xd313('0x24')]=function(_0x2ba8d7,_0x371d93){if(_0x2ba8d7[_0xd313('0x4a')]['id']){delete _0x2ba8d7[_0xd313('0x4a')]['id'];}return db[_0xd313('0x40')][_0xd313('0x48')]({'where':{'id':_0x2ba8d7['params']['id']}})['then'](handleEntityNotFound(_0x371d93,null))[_0xd313('0x25')](saveUpdates(_0x2ba8d7[_0xd313('0x4a')],null))[_0xd313('0x25')](respondWithResult(_0x371d93,null))[_0xd313('0x51')](handleError(_0x371d93,null));};exports['destroy']=function(_0x327983,_0xd1b926){return db[_0xd313('0x40')]['find']({'where':{'id':_0x327983[_0xd313('0x46')]['id']}})[_0xd313('0x25')](handleEntityNotFound(_0xd1b926,null))[_0xd313('0x25')](removeEntity(_0xd1b926,null))['catch'](handleError(_0xd1b926,null));};exports[_0xd313('0x54')]=function(_0xefee46,_0x40e955,_0x34d84b){if(_0xefee46['body']['id']){delete _0xefee46[_0xd313('0x4a')]['id'];}return db['Interval'][_0xd313('0x48')]({'where':{'id':_0xefee46['params']['id']}})[_0xd313('0x25')](handleEntityNotFound(_0x40e955,null))[_0xd313('0x25')](function(_0xf51680){if(_0xf51680){_0xefee46['body']['IntervalId']=_0xf51680['id'];return db['Interval']['create'](_0xefee46[_0xd313('0x4a')]);}})[_0xd313('0x25')](respondWithResult(_0x40e955,null))['catch'](handleError(_0x40e955,null));};exports['getIntervals']=function(_0x669a04,_0xdc5937,_0x354002){var _0xaadba3={};var _0xfed716={};var _0x5a4e22;var _0x14d41a;return db[_0xd313('0x40')][_0xd313('0x55')]({'where':{'id':_0x669a04[_0xd313('0x46')]['id']}})['then'](handleEntityNotFound(_0xdc5937,null))['then'](function(_0x30016e){if(_0x30016e){_0x5a4e22=_0x30016e;_0xfed716[_0xd313('0x30')]=_[_0xd313('0x47')](db[_0xd313('0x40')][_0xd313('0x2d')]);_0xfed716['query']=_['keys'](_0x669a04[_0xd313('0x31')]);_0xfed716['filters']=_['intersection'](_0xfed716[_0xd313('0x30')],_0xfed716['query']);_0xaadba3[_0xd313('0x34')]=_[_0xd313('0x33')](_0xfed716[_0xd313('0x30')],qs[_0xd313('0x35')](_0x669a04[_0xd313('0x31')]['fields']));_0xaadba3['attributes']=_0xaadba3[_0xd313('0x34')]['length']?_0xaadba3[_0xd313('0x34')]:_0xfed716[_0xd313('0x30')];_0xaadba3['order']=qs[_0xd313('0x3a')](_0x669a04[_0xd313('0x31')][_0xd313('0x3a')]);_0xaadba3[_0xd313('0x3b')]=qs[_0xd313('0x32')](_['pick'](_0x669a04[_0xd313('0x31')],_0xfed716[_0xd313('0x32')]));if(_0x669a04['query'][_0xd313('0x3c')]){_0xaadba3[_0xd313('0x3b')]=_['merge'](_0xaadba3[_0xd313('0x3b')],{'$or':_['map'](_0xaadba3['attributes'],function(_0x14c40d){var _0x16c366={};_0x16c366[_0x14c40d]={'$like':'%'+_0x669a04[_0xd313('0x31')][_0xd313('0x3c')]+'%'};return _0x16c366;})});}_0xaadba3=_[_0xd313('0x3d')]({},_0xaadba3,_0x669a04[_0xd313('0x3f')]);return _0x5a4e22[_0xd313('0x56')](_0xaadba3);}})[_0xd313('0x25')](function(_0x213d2f){if(_0x213d2f){_0x14d41a=_0x213d2f[_0xd313('0x36')];if(!_0x669a04[_0xd313('0x31')][_0xd313('0x37')](_0xd313('0x38'))){_0xaadba3[_0xd313('0x1e')]=qs[_0xd313('0x1e')](_0x669a04[_0xd313('0x31')]['limit']);_0xaadba3['offset']=qs[_0xd313('0x1d')](_0x669a04[_0xd313('0x31')]['offset']);}return _0x5a4e22[_0xd313('0x56')](_0xaadba3);}})[_0xd313('0x25')](function(_0xc009b7){if(_0xc009b7){return _0xc009b7?{'count':_0x14d41a,'rows':_0xc009b7}:null;}})[_0xd313('0x25')](respondWithResult(_0xdc5937,null))[_0xd313('0x51')](handleError(_0xdc5937,null));};exports[_0xd313('0x57')]=function(_0x78d9c9,_0x26ddb8,_0x7dd5e){return db[_0xd313('0x40')][_0xd313('0x55')]({'where':{'id':_0x78d9c9['params']['id']}})[_0xd313('0x25')](handleEntityNotFound(_0x26ddb8,null))[_0xd313('0x25')](function(_0x4199a7){if(_0x4199a7){return db['sequelize'][_0xd313('0x58')](function(_0x49a2a3){return db[_0xd313('0x40')]['destroy']({'where':{'IntervalId':_0x78d9c9['params']['id']},'transaction':_0x49a2a3})[_0xd313('0x25')](function(_0x3a8798){var _0x5465ad=_['map'](_0x78d9c9['body'],function(_0x2d86be){delete _0x2d86be['id'];_0x2d86be['IntervalId']=_0x78d9c9[_0xd313('0x46')]['id'];return _0x2d86be;});return db[_0xd313('0x40')][_0xd313('0x59')](_0x5465ad,{'transaction':_0x49a2a3});});})[_0xd313('0x25')](function(){return db['Interval'][_0xd313('0x43')]({'where':{'IntervalId':_0x78d9c9[_0xd313('0x46')]['id']}});});}})[_0xd313('0x25')](respondWithResult(_0x26ddb8,null))[_0xd313('0x51')](handleError(_0x26ddb8,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 41a7ec2..7335726 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 _0x9c54=['request-promise','rimraf','../../config/environment','./interval.attributes','define','Interval','tools_intervals','rewrite','lodash','bluebird'];(function(_0x4647df,_0x135de1){var _0x5c1e9d=function(_0x1b3a09){while(--_0x1b3a09){_0x4647df['push'](_0x4647df['shift']());}};_0x5c1e9d(++_0x135de1);}(_0x9c54,0x120));var _0x49c5=function(_0x25dfdd,_0x26dac7){_0x25dfdd=_0x25dfdd-0x0;var _0x474fba=_0x9c54[_0x25dfdd];return _0x474fba;};'use strict';var _=require(_0x49c5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x49c5('0x1'));var rp=require(_0x49c5('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x49c5('0x3'));var config=require(_0x49c5('0x4'));var attributes=require(_0x49c5('0x5'));var extensions=require('../../components/extensions/rewrite');module['exports']=function(_0x30798b,_0x12795e){return _0x30798b[_0x49c5('0x6')](_0x49c5('0x7'),attributes,{'tableName':_0x49c5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2f24e2,_0x4eb7fc){extensions[_0x49c5('0x9')](_0x30798b,_0x2f24e2);},'afterBulkCreate':function(_0x301dae,_0x41c99c,_0x494ff0){_0x494ff0();extensions['rewrite'](_0x30798b,_0x301dae[0x0]);},'afterUpdate':function(_0x2dcce5,_0x49d5c7){extensions[_0x49c5('0x9')](_0x30798b,_0x2dcce5);},'afterDestroy':function(_0x39584f,_0x1ac9af){extensions[_0x49c5('0x9')](_0x30798b,_0x39584f);}}});}; \ No newline at end of file +var _0x6268=['path','rimraf','./interval.attributes','../../components/extensions/rewrite','exports','tools_intervals','rewrite','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x6aaa69,_0x4457b5){var _0x25359f=function(_0x1ab0be){while(--_0x1ab0be){_0x6aaa69['push'](_0x6aaa69['shift']());}};_0x25359f(++_0x4457b5);}(_0x6268,0x193));var _0x8626=function(_0x1a7212,_0x26bf20){_0x1a7212=_0x1a7212-0x0;var _0x15087a=_0x6268[_0x1a7212];return _0x15087a;};'use strict';var _=require(_0x8626('0x0'));var util=require('util');var logger=require(_0x8626('0x1'))('api');var moment=require(_0x8626('0x2'));var BPromise=require(_0x8626('0x3'));var rp=require(_0x8626('0x4'));var fs=require('fs');var path=require(_0x8626('0x5'));var rimraf=require(_0x8626('0x6'));var config=require('../../config/environment');var attributes=require(_0x8626('0x7'));var extensions=require(_0x8626('0x8'));module[_0x8626('0x9')]=function(_0x259e54,_0x38e89b){return _0x259e54['define']('Interval',attributes,{'tableName':_0x8626('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2eba77,_0x424256){extensions[_0x8626('0xb')](_0x259e54,_0x2eba77);},'afterBulkCreate':function(_0x96ff2,_0x2b0705,_0x572aa2){_0x572aa2();extensions[_0x8626('0xb')](_0x259e54,_0x96ff2[0x0]);},'afterUpdate':function(_0xb5a3f4,_0x3dd751){extensions['rewrite'](_0x259e54,_0xb5a3f4);},'afterDestroy':function(_0x15d91b,_0x422700){extensions['rewrite'](_0x259e54,_0x15d91b);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 1ec0e99..da532e0 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 _0x78ce=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','Interval,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetInterval','Interval','options','raw','where','attributes','include','map','model','debug','stringify','ShowInterval','find','lodash','moment','randomstring'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x78ce,0x1cb));var _0xe78c=function(_0x4c0ebb,_0x1e7eae){_0x4c0ebb=_0x4c0ebb-0x0;var _0xfc4dc1=_0x78ce[_0x4c0ebb];return _0xfc4dc1;};'use strict';var _=require(_0xe78c('0x0'));var util=require('util');var moment=require(_0xe78c('0x1'));var BPromise=require('bluebird');var rs=require(_0xe78c('0x2'));var fs=require('fs');var Redis=require(_0xe78c('0x3'));var db=require(_0xe78c('0x4'))['db'];var utils=require(_0xe78c('0x5'));var logger=require('../../config/logger')(_0xe78c('0x6'));var config=require(_0xe78c('0x7'));var jayson=require(_0xe78c('0x8'));var client=jayson['client'][_0xe78c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x271d53,_0x89d66e,_0x34d6fc){return new BPromise(function(_0x496285,_0x4cfd41){return client[_0xe78c('0xa')](_0x271d53,_0x34d6fc)[_0xe78c('0xb')](function(_0x3efc85){logger[_0xe78c('0xc')](_0xe78c('0xd'),_0x89d66e,_0xe78c('0xe'));logger['debug'](_0xe78c('0xf'),_0x89d66e,_0xe78c('0xe'),JSON['stringify'](_0x3efc85));if(_0x3efc85[_0xe78c('0x10')]){if(_0x3efc85[_0xe78c('0x10')][_0xe78c('0x11')]===0x1f4){logger['error']('Interval,\x20%s,\x20%s',_0x89d66e,_0x3efc85[_0xe78c('0x10')]['message']);return _0x4cfd41(_0x3efc85[_0xe78c('0x10')][_0xe78c('0x12')]);}logger['error'](_0xe78c('0xd'),_0x89d66e,_0x3efc85[_0xe78c('0x10')][_0xe78c('0x12')]);return _0x496285(_0x3efc85[_0xe78c('0x10')]['message']);}else{logger[_0xe78c('0xc')]('Interval,\x20%s,\x20%s',_0x89d66e,'request\x20sent');_0x496285(_0x3efc85['result']['message']);}})[_0xe78c('0x13')](function(_0x493594){logger[_0xe78c('0x10')](_0xe78c('0xd'),_0x89d66e,_0x493594);_0x4cfd41(_0x493594);});});}exports[_0xe78c('0x14')]=function(_0x2993fc){var _0x42f07f=this;return new Promise(function(_0x35915d,_0x1a3a6a){return db[_0xe78c('0x15')]['findAll']({'raw':_0x2993fc['options']?_0x2993fc[_0xe78c('0x16')][_0xe78c('0x17')]===undefined?!![]:![]:!![],'where':_0x2993fc['options']?_0x2993fc[_0xe78c('0x16')][_0xe78c('0x18')]||null:null,'attributes':_0x2993fc[_0xe78c('0x16')]?_0x2993fc[_0xe78c('0x16')][_0xe78c('0x19')]||null:null,'limit':_0x2993fc[_0xe78c('0x16')]?_0x2993fc[_0xe78c('0x16')]['limit']||null:null,'include':_0x2993fc[_0xe78c('0x16')]?_0x2993fc['options'][_0xe78c('0x1a')]?_[_0xe78c('0x1b')](_0x2993fc[_0xe78c('0x16')][_0xe78c('0x1a')],function(_0x378b26){return{'model':db[_0x378b26[_0xe78c('0x1c')]],'as':_0x378b26['as'],'attributes':_0x378b26[_0xe78c('0x19')],'include':_0x378b26[_0xe78c('0x1a')]?_[_0xe78c('0x1b')](_0x378b26['include'],function(_0x36d8ee){return{'model':db[_0x36d8ee[_0xe78c('0x1c')]],'as':_0x36d8ee['as'],'attributes':_0x36d8ee['attributes'],'include':_0x36d8ee[_0xe78c('0x1a')]?_[_0xe78c('0x1b')](_0x36d8ee[_0xe78c('0x1a')],function(_0xa80f08){return{'model':db[_0xa80f08[_0xe78c('0x1c')]],'as':_0xa80f08['as'],'attributes':_0xa80f08[_0xe78c('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe78c('0xb')](function(_0x5b7ff7){logger['info'](_0xe78c('0x14'),_0x2993fc);logger[_0xe78c('0x1d')](_0xe78c('0x14'),_0x2993fc,JSON[_0xe78c('0x1e')](_0x5b7ff7));_0x35915d(_0x5b7ff7);})[_0xe78c('0x13')](function(_0x2e6994){logger[_0xe78c('0x10')]('GetInterval',_0x2e6994[_0xe78c('0x12')],_0x2993fc);_0x1a3a6a(_0x42f07f[_0xe78c('0x10')](0x1f4,_0x2e6994['message']));});});};exports[_0xe78c('0x1f')]=function(_0x5133df){var _0x4ad5de=this;return new Promise(function(_0x31a19d,_0x4f912a){return db[_0xe78c('0x15')][_0xe78c('0x20')]({'raw':_0x5133df['options']?_0x5133df[_0xe78c('0x16')][_0xe78c('0x17')]===undefined?!![]:![]:!![],'where':_0x5133df[_0xe78c('0x16')]?_0x5133df[_0xe78c('0x16')][_0xe78c('0x18')]||null:null,'attributes':_0x5133df[_0xe78c('0x16')]?_0x5133df['options']['attributes']||null:null,'include':_0x5133df['options']?_0x5133df[_0xe78c('0x16')][_0xe78c('0x1a')]?_['map'](_0x5133df[_0xe78c('0x16')][_0xe78c('0x1a')],function(_0x3deb17){return{'model':db[_0x3deb17[_0xe78c('0x1c')]],'as':_0x3deb17['as'],'attributes':_0x3deb17[_0xe78c('0x19')],'include':_0x3deb17['include']?_[_0xe78c('0x1b')](_0x3deb17[_0xe78c('0x1a')],function(_0x3ecd3e){return{'model':db[_0x3ecd3e[_0xe78c('0x1c')]],'as':_0x3ecd3e['as'],'attributes':_0x3ecd3e[_0xe78c('0x19')],'include':_0x3ecd3e['include']?_['map'](_0x3ecd3e[_0xe78c('0x1a')],function(_0x1a3532){return{'model':db[_0x1a3532[_0xe78c('0x1c')]],'as':_0x1a3532['as'],'attributes':_0x1a3532['attributes']};}):[]};}):[]};}):[]:[]})[_0xe78c('0xb')](function(_0x5e5e16){logger[_0xe78c('0xc')]('ShowInterval',_0x5133df);logger[_0xe78c('0x1d')](_0xe78c('0x1f'),_0x5133df,JSON[_0xe78c('0x1e')](_0x5e5e16));_0x31a19d(_0x5e5e16);})['catch'](function(_0x3e5145){logger[_0xe78c('0x10')](_0xe78c('0x1f'),_0x3e5145[_0xe78c('0x12')],_0x5133df);_0x4f912a(_0x4ad5de['error'](0x1f4,_0x3e5145[_0xe78c('0x12')]));});});}; \ No newline at end of file +var _0x20ef=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetInterval','Interval','findAll','options','where','attributes','limit','include','map','model','ShowInterval','find','raw','util','moment','bluebird','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x20ef,0x1a0));var _0xf20e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20ef[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf20e('0x0'));var moment=require(_0xf20e('0x1'));var BPromise=require(_0xf20e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf20e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf20e('0x4'));var logger=require(_0xf20e('0x5'))(_0xf20e('0x6'));var config=require(_0xf20e('0x7'));var jayson=require(_0xf20e('0x8'));var client=jayson['client'][_0xf20e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9e7ec9,_0x600c01,_0x583bbb){return new BPromise(function(_0x5e0240,_0x58b86d){return client[_0xf20e('0xa')](_0x9e7ec9,_0x583bbb)[_0xf20e('0xb')](function(_0x21648c){logger[_0xf20e('0xc')](_0xf20e('0xd'),_0x600c01,_0xf20e('0xe'));logger[_0xf20e('0xf')](_0xf20e('0x10'),_0x600c01,'request\x20sent',JSON[_0xf20e('0x11')](_0x21648c));if(_0x21648c[_0xf20e('0x12')]){if(_0x21648c[_0xf20e('0x12')]['code']===0x1f4){logger[_0xf20e('0x12')](_0xf20e('0xd'),_0x600c01,_0x21648c['error'][_0xf20e('0x13')]);return _0x58b86d(_0x21648c[_0xf20e('0x12')][_0xf20e('0x13')]);}logger[_0xf20e('0x12')]('Interval,\x20%s,\x20%s',_0x600c01,_0x21648c['error'][_0xf20e('0x13')]);return _0x5e0240(_0x21648c[_0xf20e('0x12')][_0xf20e('0x13')]);}else{logger[_0xf20e('0xc')](_0xf20e('0xd'),_0x600c01,_0xf20e('0xe'));_0x5e0240(_0x21648c[_0xf20e('0x14')]['message']);}})[_0xf20e('0x15')](function(_0xce0079){logger[_0xf20e('0x12')]('Interval,\x20%s,\x20%s',_0x600c01,_0xce0079);_0x58b86d(_0xce0079);});});}exports[_0xf20e('0x16')]=function(_0x8b57db){var _0x3c5716=this;return new Promise(function(_0x2551e0,_0x3d4e5b){return db[_0xf20e('0x17')][_0xf20e('0x18')]({'raw':_0x8b57db[_0xf20e('0x19')]?_0x8b57db['options']['raw']===undefined?!![]:![]:!![],'where':_0x8b57db[_0xf20e('0x19')]?_0x8b57db[_0xf20e('0x19')][_0xf20e('0x1a')]||null:null,'attributes':_0x8b57db[_0xf20e('0x19')]?_0x8b57db[_0xf20e('0x19')][_0xf20e('0x1b')]||null:null,'limit':_0x8b57db['options']?_0x8b57db[_0xf20e('0x19')][_0xf20e('0x1c')]||null:null,'include':_0x8b57db[_0xf20e('0x19')]?_0x8b57db[_0xf20e('0x19')][_0xf20e('0x1d')]?_[_0xf20e('0x1e')](_0x8b57db[_0xf20e('0x19')][_0xf20e('0x1d')],function(_0x537414){return{'model':db[_0x537414['model']],'as':_0x537414['as'],'attributes':_0x537414[_0xf20e('0x1b')],'include':_0x537414[_0xf20e('0x1d')]?_[_0xf20e('0x1e')](_0x537414[_0xf20e('0x1d')],function(_0x26437f){return{'model':db[_0x26437f[_0xf20e('0x1f')]],'as':_0x26437f['as'],'attributes':_0x26437f[_0xf20e('0x1b')],'include':_0x26437f['include']?_['map'](_0x26437f['include'],function(_0x44256d){return{'model':db[_0x44256d[_0xf20e('0x1f')]],'as':_0x44256d['as'],'attributes':_0x44256d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e171b){logger[_0xf20e('0xc')](_0xf20e('0x16'),_0x8b57db);logger[_0xf20e('0xf')]('GetInterval',_0x8b57db,JSON[_0xf20e('0x11')](_0x4e171b));_0x2551e0(_0x4e171b);})[_0xf20e('0x15')](function(_0x36279b){logger[_0xf20e('0x12')](_0xf20e('0x16'),_0x36279b[_0xf20e('0x13')],_0x8b57db);_0x3d4e5b(_0x3c5716[_0xf20e('0x12')](0x1f4,_0x36279b[_0xf20e('0x13')]));});});};exports[_0xf20e('0x20')]=function(_0x11809b){var _0x2953d6=this;return new Promise(function(_0x311498,_0x1c2c71){return db[_0xf20e('0x17')][_0xf20e('0x21')]({'raw':_0x11809b['options']?_0x11809b['options'][_0xf20e('0x22')]===undefined?!![]:![]:!![],'where':_0x11809b['options']?_0x11809b['options'][_0xf20e('0x1a')]||null:null,'attributes':_0x11809b[_0xf20e('0x19')]?_0x11809b[_0xf20e('0x19')]['attributes']||null:null,'include':_0x11809b['options']?_0x11809b[_0xf20e('0x19')][_0xf20e('0x1d')]?_['map'](_0x11809b[_0xf20e('0x19')]['include'],function(_0x203fc3){return{'model':db[_0x203fc3[_0xf20e('0x1f')]],'as':_0x203fc3['as'],'attributes':_0x203fc3[_0xf20e('0x1b')],'include':_0x203fc3[_0xf20e('0x1d')]?_[_0xf20e('0x1e')](_0x203fc3[_0xf20e('0x1d')],function(_0x3561b4){return{'model':db[_0x3561b4[_0xf20e('0x1f')]],'as':_0x3561b4['as'],'attributes':_0x3561b4['attributes'],'include':_0x3561b4[_0xf20e('0x1d')]?_[_0xf20e('0x1e')](_0x3561b4['include'],function(_0x2fa3ba){return{'model':db[_0x2fa3ba[_0xf20e('0x1f')]],'as':_0x2fa3ba['as'],'attributes':_0x2fa3ba[_0xf20e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf20e('0xb')](function(_0x2de203){logger[_0xf20e('0xc')](_0xf20e('0x20'),_0x11809b);logger[_0xf20e('0xf')](_0xf20e('0x20'),_0x11809b,JSON[_0xf20e('0x11')](_0x2de203));_0x311498(_0x2de203);})[_0xf20e('0x15')](function(_0x35f6d8){logger[_0xf20e('0x12')](_0xf20e('0x20'),_0x35f6d8[_0xf20e('0x13')],_0x11809b);_0x1c2c71(_0x2953d6[_0xf20e('0x12')](0x1f4,_0x35f6d8[_0xf20e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index f2a99bb..5b93237 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 _0x6c14=['../../components/auth/service','./jira.controller','post','send','Router'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0x6c14,0x1ad));var _0x46c1=function(_0x1d6b5e,_0x28203d){_0x1d6b5e=_0x1d6b5e-0x0;var _0x29adbc=_0x6c14[_0x1d6b5e];return _0x29adbc;};'use strict';var express=require('express');var router=express[_0x46c1('0x0')]();var auth=require(_0x46c1('0x1'));var controller=require(_0x46c1('0x2'));router[_0x46c1('0x3')]('/',auth['isAuthenticated'](),controller[_0x46c1('0x4')]);module['exports']=router; \ No newline at end of file +var _0x37ba=['../../components/auth/service','post','send','express'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x37ba,0x113));var _0xa37b=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x37ba[_0x59c301];return _0x3866b9;};'use strict';var express=require(_0xa37b('0x0'));var router=express['Router']();var auth=require(_0xa37b('0x1'));var controller=require('./jira.controller');router[_0xa37b('0x2')]('/',auth['isAuthenticated'](),controller[_0xa37b('0x3')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 5a39afd..0572772 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 _0x43c2=['write','openIssue','send','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','support','3eAmWpBVP0','key','summary','Report','stringify','issuetype','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira'];(function(_0x5011f5,_0x92181b){var _0x2b0e3f=function(_0x47393c){while(--_0x47393c){_0x5011f5['push'](_0x5011f5['shift']());}};_0x2b0e3f(++_0x92181b);}(_0x43c2,0x65));var _0x243c=function(_0x325484,_0x4efa87){_0x325484=_0x325484-0x0;var _0x34b37a=_0x43c2[_0x325484];return _0x34b37a;};'use strict';var BPromise=require(_0x243c('0x0'));var https=require(_0x243c('0x1'));var logger=require('../../config/logger')('api');var USERNAME=_0x243c('0x2');var PASSWORD=_0x243c('0x3');function openIssue(_0x274bb6,_0x2d538a){var _0xce71eb={'fields':{'project':{'key':_0x274bb6[_0x243c('0x4')]||'MOTGUI'},'summary':(_0x274bb6[_0x243c('0x5')]||_0x243c('0x6'))+'\x20from\x20'+_0x274bb6['ip'],'description':_0x274bb6['description']||JSON[_0x243c('0x7')](_0x274bb6),'issuetype':{'name':_0x274bb6[_0x243c('0x8')]||'Bug'}}};_0xce71eb[_0x243c('0x9')][_0x243c('0xa')]=_0x274bb6[_0x243c('0xb')];_0xce71eb['fields'][_0x243c('0xc')]=_0x274bb6[_0x243c('0xd')];_0xce71eb[_0x243c('0x9')][_0x243c('0xe')]=_0x274bb6[_0x243c('0xf')];_0xce71eb[_0x243c('0x9')][_0x243c('0x10')]=_0x274bb6['name'];_0xce71eb[_0x243c('0x9')][_0x243c('0x11')]=_0x274bb6[_0x243c('0x12')];_0xce71eb[_0x243c('0x9')][_0x243c('0x13')]=_0x274bb6['ip'];var _0x2dc3cb={'host':_0x243c('0x14'),'port':0x1bb,'path':_0x243c('0x15'),'method':_0x243c('0x16'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x243c('0x17')](_0x243c('0x18'))}};var _0x28ccdf=JSON[_0x243c('0x7')](_0xce71eb);var _0x2e8e00=https[_0x243c('0x19')](_0x2dc3cb,function(_0x47cf5c){_0x47cf5c[_0x243c('0x1a')](_0x243c('0x1b'));var _0x55230b='';_0x47cf5c['on'](_0x243c('0x1c'),function(_0x22aa59){_0x55230b+=_0x22aa59;});_0x47cf5c['on'](_0x243c('0x1d'),function(){if(_0x2d538a){return _0x2d538a[_0x243c('0x1e')](_0x47cf5c[_0x243c('0x1f')])[_0x243c('0x20')](JSON[_0x243c('0x21')](_0x55230b));}});});_0x2e8e00['on'](_0x243c('0x22'),function(_0x26a505){if(_0x2d538a){return _0x2d538a[_0x243c('0x1e')](0x1f4)[_0x243c('0x20')]({'errors':[{'message':_0x243c('0x23'),'type':_0x243c('0x24')}]});}});_0x2e8e00[_0x243c('0x25')](_0x28ccdf);_0x2e8e00[_0x243c('0x1d')]();}exports[_0x243c('0x26')]=openIssue;exports[_0x243c('0x27')]=function(_0x5d7dfc,_0x51ada1){_0x5d7dfc[_0x243c('0x28')]['ip']=_0x5d7dfc[_0x243c('0x29')][_0x243c('0x2a')]||_0x5d7dfc[_0x243c('0x2b')]['remoteAddress']||_0x5d7dfc[_0x243c('0x2c')]['remoteAddress']||_0x5d7dfc[_0x243c('0x2b')][_0x243c('0x2c')][_0x243c('0x2d')];return openIssue(_0x5d7dfc[_0x243c('0x28')],_0x51ada1);}; \ No newline at end of file +var _0xfaf0=['customfield_11502','newToken','customfield_11503','name','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','stringify','request','setEncoding','utf8','data','end','status','statusCode','json','parse','api.jira','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','api','support','3eAmWpBVP0','key','MOTGUI','Report','description','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken'];(function(_0x1f7d53,_0x386a7b){var _0x562684=function(_0x57ea0c){while(--_0x57ea0c){_0x1f7d53['push'](_0x1f7d53['shift']());}};_0x562684(++_0x386a7b);}(_0xfaf0,0x1e1));var _0x0faf=function(_0x3084bc,_0x2982c8){_0x3084bc=_0x3084bc-0x0;var _0x22fcf2=_0xfaf0[_0x3084bc];return _0x22fcf2;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require('../../config/logger')(_0x0faf('0x0'));var USERNAME=_0x0faf('0x1');var PASSWORD=_0x0faf('0x2');function openIssue(_0x447bdf,_0x1e169c){var _0x50e331={'fields':{'project':{'key':_0x447bdf[_0x0faf('0x3')]||_0x0faf('0x4')},'summary':(_0x447bdf['summary']||_0x0faf('0x5'))+'\x20from\x20'+_0x447bdf['ip'],'description':_0x447bdf[_0x0faf('0x6')]||JSON['stringify'](_0x447bdf),'issuetype':{'name':_0x447bdf[_0x0faf('0x7')]||_0x0faf('0x8')}}};_0x50e331[_0x0faf('0x9')][_0x0faf('0xa')]=_0x447bdf[_0x0faf('0xb')];_0x50e331['fields'][_0x0faf('0xc')]=_0x447bdf[_0x0faf('0xd')];_0x50e331[_0x0faf('0x9')][_0x0faf('0xe')]=_0x447bdf[_0x0faf('0xf')];_0x50e331[_0x0faf('0x9')][_0x0faf('0x10')]=_0x447bdf[_0x0faf('0x11')];_0x50e331[_0x0faf('0x9')]['customfield_11504']=_0x447bdf['reason'];_0x50e331['fields'][_0x0faf('0x12')]=_0x447bdf['ip'];var _0x4227be={'host':_0x0faf('0x13'),'port':0x1bb,'path':_0x0faf('0x14'),'method':_0x0faf('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x0faf('0x16'),'Authorization':_0x0faf('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0x0faf('0x18')](_0x0faf('0x19'))}};var _0x5d7857=JSON[_0x0faf('0x1a')](_0x50e331);var _0x3a99c3=https[_0x0faf('0x1b')](_0x4227be,function(_0x5e7b71){_0x5e7b71[_0x0faf('0x1c')](_0x0faf('0x1d'));var _0x456a0f='';_0x5e7b71['on'](_0x0faf('0x1e'),function(_0x181195){_0x456a0f+=_0x181195;});_0x5e7b71['on'](_0x0faf('0x1f'),function(){if(_0x1e169c){return _0x1e169c[_0x0faf('0x20')](_0x5e7b71[_0x0faf('0x21')])[_0x0faf('0x22')](JSON[_0x0faf('0x23')](_0x456a0f));}});});_0x3a99c3['on']('error',function(_0x58d3c4){if(_0x1e169c){return _0x1e169c['status'](0x1f4)[_0x0faf('0x22')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x0faf('0x24')}]});}});_0x3a99c3['write'](_0x5d7857);_0x3a99c3[_0x0faf('0x1f')]();}exports[_0x0faf('0x25')]=openIssue;exports[_0x0faf('0x26')]=function(_0x19b509,_0x22f3a6){_0x19b509[_0x0faf('0x27')]['ip']=_0x19b509[_0x0faf('0x28')][_0x0faf('0x29')]||_0x19b509[_0x0faf('0x2a')][_0x0faf('0x2b')]||_0x19b509[_0x0faf('0x2c')]['remoteAddress']||_0x19b509[_0x0faf('0x2a')][_0x0faf('0x2c')][_0x0faf('0x2b')];return openIssue(_0x19b509[_0x0faf('0x27')],_0x22f3a6);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 58d8b56..1ae9606 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 _0x2393=['get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2393,0x116));var _0x3239=function(_0x4489f2,_0x1f9128){_0x4489f2=_0x4489f2-0x0;var _0x5cc527=_0x2393[_0x4489f2];return _0x5cc527;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3239('0x0'));var timeout=require(_0x3239('0x1'));var express=require(_0x3239('0x2'));var router=express['Router']();var auth=require(_0x3239('0x3'));var interaction=require(_0x3239('0x4'));var config=require(_0x3239('0x5'));var controller=require(_0x3239('0x6'));router[_0x3239('0x7')]('/',auth[_0x3239('0x8')](),controller[_0x3239('0x9')]);router[_0x3239('0x7')](_0x3239('0xa'),auth[_0x3239('0x8')](),controller[_0x3239('0xb')]);router[_0x3239('0x7')](_0x3239('0xc'),auth['isAuthenticated'](),controller[_0x3239('0xd')]);router[_0x3239('0xe')]('/',auth[_0x3239('0x8')](),controller['create']);router[_0x3239('0xf')](_0x3239('0xc'),auth[_0x3239('0x8')](),controller[_0x3239('0x10')]);router[_0x3239('0x11')](_0x3239('0xc'),auth[_0x3239('0x8')](),controller[_0x3239('0x12')]);module['exports']=router; \ No newline at end of file +var _0x2516=['../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x13843f,_0x50422d){var _0x1063ae=function(_0x12fd6b){while(--_0x12fd6b){_0x13843f['push'](_0x13843f['shift']());}};_0x1063ae(++_0x50422d);}(_0x2516,0xdf));var _0x6251=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x2516[_0x92c450];return _0x2a9599;};'use strict';var multer=require(_0x6251('0x0'));var util=require(_0x6251('0x1'));var path=require(_0x6251('0x2'));var timeout=require(_0x6251('0x3'));var express=require(_0x6251('0x4'));var router=express[_0x6251('0x5')]();var auth=require(_0x6251('0x6'));var interaction=require(_0x6251('0x7'));var config=require(_0x6251('0x8'));var controller=require(_0x6251('0x9'));router['get']('/',auth[_0x6251('0xa')](),controller[_0x6251('0xb')]);router[_0x6251('0xc')](_0x6251('0xd'),auth[_0x6251('0xa')](),controller[_0x6251('0xe')]);router[_0x6251('0xc')](_0x6251('0xf'),auth[_0x6251('0xa')](),controller[_0x6251('0x10')]);router[_0x6251('0x11')]('/',auth[_0x6251('0xa')](),controller[_0x6251('0x12')]);router[_0x6251('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x6251('0x14')]);router['delete'](_0x6251('0xf'),auth[_0x6251('0xa')](),controller[_0x6251('0x15')]);module[_0x6251('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index ba346d4..2883f35 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 _0x1ba2=['sequelize','TEXT','long','STRING'];(function(_0x53b9ef,_0x296c4c){var _0x2114c0=function(_0x54de6b){while(--_0x54de6b){_0x53b9ef['push'](_0x53b9ef['shift']());}};_0x2114c0(++_0x296c4c);}(_0x1ba2,0xb4));var _0x21ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1ba2[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x21ba('0x0'));module['exports']={'question':{'type':Sequelize[_0x21ba('0x1')]},'answer':{'type':Sequelize['TEXT'](_0x21ba('0x2'))},'membername':{'type':Sequelize[_0x21ba('0x3')]},'projectname':{'type':Sequelize[_0x21ba('0x3')]},'queue':{'type':Sequelize[_0x21ba('0x3')]},'uniqueid':{'type':Sequelize[_0x21ba('0x3')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x21ba('0x3')]},'questionId':{'type':Sequelize[_0x21ba('0x3')]}}; \ No newline at end of file +var _0x6324=['TEXT','STRING','sequelize','exports'];(function(_0x561cc5,_0x343790){var _0x54f058=function(_0x300804){while(--_0x300804){_0x561cc5['push'](_0x561cc5['shift']());}};_0x54f058(++_0x343790);}(_0x6324,0x142));var _0x4632=function(_0x200703,_0x4cccfd){_0x200703=_0x200703-0x0;var _0x5a32dc=_0x6324[_0x200703];return _0x5a32dc;};'use strict';var Sequelize=require(_0x4632('0x0'));module[_0x4632('0x1')]={'question':{'type':Sequelize[_0x4632('0x2')]},'answer':{'type':Sequelize[_0x4632('0x2')]('long')},'membername':{'type':Sequelize[_0x4632('0x3')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x4632('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4632('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x4632('0x3')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 05b975a..6cb5141 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 _0x2c73=['include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','mustache','sox','ejs','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','set','Content-Range','json','apply','reject','update','then','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll'];(function(_0x232448,_0x345d3c){var _0xd3fe66=function(_0x3cc930){while(--_0x3cc930){_0x232448['push'](_0x232448['shift']());}};_0xd3fe66(++_0x345d3c);}(_0x2c73,0xdf));var _0x32c7=function(_0x104f61,_0x407853){_0x104f61=_0x104f61-0x0;var _0x3fad72=_0x2c73[_0x104f61];return _0x3fad72;};'use strict';var pdf=require(_0x32c7('0x0'));var emlformat=require(_0x32c7('0x1'));var rimraf=require(_0x32c7('0x2'));var zipdir=require(_0x32c7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x32c7('0x4'));var util=require('util');var path=require('path');var sox=require(_0x32c7('0x5'));var csv=require('to-csv');var ejs=require(_0x32c7('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x32c7('0x7'));var crypto=require(_0x32c7('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x32c7('0x9'));var toCsv=require(_0x32c7('0xa'));var querystring=require(_0x32c7('0xb'));var Papa=require('papaparse');var Redis=require(_0x32c7('0xc'));var authService=require(_0x32c7('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32c7('0xe'));var logger=require(_0x32c7('0xf'))(_0x32c7('0x10'));var utils=require(_0x32c7('0x11'));var config=require(_0x32c7('0x12'));var licenseUtil=require(_0x32c7('0x13'));var db=require(_0x32c7('0x14'))['db'];function respondWithStatusCode(_0x33d1ae,_0x149715){_0x149715=_0x149715||0xcc;return function(_0x2cf160){if(_0x2cf160){return _0x33d1ae['sendStatus'](_0x149715);}return _0x33d1ae[_0x32c7('0x15')](_0x149715)[_0x32c7('0x16')]();};}function respondWithResult(_0x4c2f18,_0x1e8453){_0x1e8453=_0x1e8453||0xc8;return function(_0x706b60){if(_0x706b60){return _0x4c2f18[_0x32c7('0x15')](_0x1e8453)['json'](_0x706b60);}};}function respondWithFilteredResult(_0x1d1cc7,_0xa160a1){return function(_0x20e898){if(_0x20e898){var _0x3a4737=_0x20e898['count'],_0x18556c=_0xa160a1[_0x32c7('0x17')],_0x1ccf23=_0xa160a1[_0x32c7('0x17')]+_0xa160a1[_0x32c7('0x18')],_0x10a0a3;if(_0x1ccf23>=_0x3a4737){_0x1ccf23=_0x3a4737;_0x10a0a3=0xc8;}else{_0x10a0a3=0xce;}_0x1d1cc7[_0x32c7('0x15')](_0x10a0a3);return _0x1d1cc7[_0x32c7('0x19')](_0x32c7('0x1a'),_0x18556c+'-'+_0x1ccf23+'/'+_0x3a4737)[_0x32c7('0x1b')](_0x20e898);}return null;};}function patchUpdates(_0x366ce0){return function(_0x51f5d9){try{jsonpatch[_0x32c7('0x1c')](_0x51f5d9,_0x366ce0,!![]);}catch(_0x46fcf5){return BPromise[_0x32c7('0x1d')](_0x46fcf5);}return _0x51f5d9['save']();};}function saveUpdates(_0x49a819,_0x2602fa){return function(_0x574ee9){if(_0x574ee9){return _0x574ee9[_0x32c7('0x1e')](_0x49a819)[_0x32c7('0x1f')](function(_0x1a6ebe){return _0x1a6ebe;});}return null;};}function removeEntity(_0x412edf,_0x1b00d0){return function(_0x3ec545){if(_0x3ec545){return _0x3ec545['destroy']()['then'](function(){_0x412edf[_0x32c7('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44248d,_0x2d2acf){return function(_0x5d64c9){if(!_0x5d64c9){_0x44248d['sendStatus'](0x194);}return _0x5d64c9;};}function handleError(_0x532cad,_0x2077e0){_0x2077e0=_0x2077e0||0x1f4;return function(_0x37880d){logger[_0x32c7('0x20')](_0x37880d[_0x32c7('0x21')]);if(_0x37880d[_0x32c7('0x22')]){delete _0x37880d['name'];}_0x532cad[_0x32c7('0x15')](_0x2077e0)[_0x32c7('0x23')](_0x37880d);};}exports[_0x32c7('0x24')]=function(_0x5c5a2a,_0x334eec){var _0xc39fe2={},_0x5eefe7={},_0x2a4b1f={'count':0x0,'rows':[]};var _0xe2e0e6=_[_0x32c7('0x25')](db[_0x32c7('0x26')][_0x32c7('0x27')],function(_0x23423b){return{'name':_0x23423b[_0x32c7('0x28')],'type':_0x23423b[_0x32c7('0x29')][_0x32c7('0x2a')]};});_0x5eefe7[_0x32c7('0x2b')]=_['map'](_0xe2e0e6,'name');_0x5eefe7[_0x32c7('0x2c')]=_[_0x32c7('0x2d')](_0x5c5a2a[_0x32c7('0x2c')]);_0x5eefe7[_0x32c7('0x2e')]=_[_0x32c7('0x2f')](_0x5eefe7[_0x32c7('0x2b')],_0x5eefe7[_0x32c7('0x2c')]);_0xc39fe2['attributes']=_[_0x32c7('0x2f')](_0x5eefe7['model'],qs[_0x32c7('0x30')](_0x5c5a2a[_0x32c7('0x2c')][_0x32c7('0x30')]));_0xc39fe2[_0x32c7('0x31')]=_0xc39fe2[_0x32c7('0x31')][_0x32c7('0x32')]?_0xc39fe2[_0x32c7('0x31')]:_0x5eefe7[_0x32c7('0x2b')];if(!_0x5c5a2a['query']['hasOwnProperty'](_0x32c7('0x33'))){_0xc39fe2[_0x32c7('0x18')]=qs[_0x32c7('0x18')](_0x5c5a2a['query'][_0x32c7('0x18')]);_0xc39fe2[_0x32c7('0x17')]=qs['offset'](_0x5c5a2a[_0x32c7('0x2c')][_0x32c7('0x17')]);}_0xc39fe2[_0x32c7('0x34')]=qs['sort'](_0x5c5a2a[_0x32c7('0x2c')][_0x32c7('0x35')]);_0xc39fe2[_0x32c7('0x36')]=qs[_0x32c7('0x2e')](_['pick'](_0x5c5a2a[_0x32c7('0x2c')],_0x5eefe7[_0x32c7('0x2e')]),_0xe2e0e6);if(_0x5c5a2a[_0x32c7('0x2c')][_0x32c7('0x37')]){_0xc39fe2[_0x32c7('0x36')]=_[_0x32c7('0x38')](_0xc39fe2[_0x32c7('0x36')],{'$or':_[_0x32c7('0x25')](_0xe2e0e6,function(_0x184b69){if(_0x184b69[_0x32c7('0x29')]!==_0x32c7('0x39')){var _0x337e65={};_0x337e65[_0x184b69['name']]={'$like':'%'+_0x5c5a2a[_0x32c7('0x2c')][_0x32c7('0x37')]+'%'};return _0x337e65;}})});}_0xc39fe2=_[_0x32c7('0x38')]({},_0xc39fe2,_0x5c5a2a[_0x32c7('0x3a')]);var _0x203248={'where':_0xc39fe2[_0x32c7('0x36')]};return db['JscriptyAnswerReport'][_0x32c7('0x3b')](_0x203248)['then'](function(_0x256b36){_0x2a4b1f[_0x32c7('0x3b')]=_0x256b36;if(_0x5c5a2a['query'][_0x32c7('0x3c')]){_0xc39fe2[_0x32c7('0x3d')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x32c7('0x3e')](_0xc39fe2);})['then'](function(_0x5c1447){_0x2a4b1f[_0x32c7('0x3f')]=_0x5c1447;return _0x2a4b1f;})[_0x32c7('0x1f')](respondWithFilteredResult(_0x334eec,_0xc39fe2))[_0x32c7('0x40')](handleError(_0x334eec,null));};exports[_0x32c7('0x41')]=function(_0x466a8a,_0x484d05){var _0x3b3cd5={'raw':!![],'where':{'id':_0x466a8a[_0x32c7('0x42')]['id']}},_0x1deef4={};_0x1deef4[_0x32c7('0x2b')]=_[_0x32c7('0x2d')](db[_0x32c7('0x26')]['rawAttributes']);_0x1deef4[_0x32c7('0x2c')]=_[_0x32c7('0x2d')](_0x466a8a[_0x32c7('0x2c')]);_0x1deef4[_0x32c7('0x2e')]=_[_0x32c7('0x2f')](_0x1deef4[_0x32c7('0x2b')],_0x1deef4[_0x32c7('0x2c')]);_0x3b3cd5[_0x32c7('0x31')]=_[_0x32c7('0x2f')](_0x1deef4['model'],qs[_0x32c7('0x30')](_0x466a8a[_0x32c7('0x2c')][_0x32c7('0x30')]));_0x3b3cd5[_0x32c7('0x31')]=_0x3b3cd5['attributes']['length']?_0x3b3cd5[_0x32c7('0x31')]:_0x1deef4[_0x32c7('0x2b')];if(_0x466a8a[_0x32c7('0x2c')][_0x32c7('0x3c')]){_0x3b3cd5[_0x32c7('0x3d')]=[{'all':!![]}];}_0x3b3cd5=_[_0x32c7('0x38')]({},_0x3b3cd5,_0x466a8a[_0x32c7('0x3a')]);return db[_0x32c7('0x26')][_0x32c7('0x43')](_0x3b3cd5)['then'](handleEntityNotFound(_0x484d05,null))['then'](respondWithResult(_0x484d05,null))[_0x32c7('0x40')](handleError(_0x484d05,null));};exports['create']=function(_0x13e952,_0x5d720d){return db[_0x32c7('0x26')][_0x32c7('0x44')](_0x13e952[_0x32c7('0x45')],{})['then'](respondWithResult(_0x5d720d,0xc9))[_0x32c7('0x40')](handleError(_0x5d720d,null));};exports[_0x32c7('0x1e')]=function(_0x4c8cc3,_0x4803bf){if(_0x4c8cc3[_0x32c7('0x45')]['id']){delete _0x4c8cc3['body']['id'];}return db[_0x32c7('0x26')]['find']({'where':{'id':_0x4c8cc3[_0x32c7('0x42')]['id']}})[_0x32c7('0x1f')](handleEntityNotFound(_0x4803bf,null))[_0x32c7('0x1f')](saveUpdates(_0x4c8cc3[_0x32c7('0x45')],null))[_0x32c7('0x1f')](respondWithResult(_0x4803bf,null))[_0x32c7('0x40')](handleError(_0x4803bf,null));};exports['destroy']=function(_0x2bde82,_0x3008d3){return db[_0x32c7('0x26')][_0x32c7('0x43')]({'where':{'id':_0x2bde82[_0x32c7('0x42')]['id']}})[_0x32c7('0x1f')](handleEntityNotFound(_0x3008d3,null))[_0x32c7('0x1f')](removeEntity(_0x3008d3,null))[_0x32c7('0x40')](handleError(_0x3008d3,null));};exports[_0x32c7('0x46')]=function(_0x49f03d,_0xac8557){return db[_0x32c7('0x26')][_0x32c7('0x46')]()[_0x32c7('0x1f')](respondWithResult(_0xac8557,null))[_0x32c7('0x40')](handleError(_0xac8557,null));}; \ No newline at end of file +var _0xc409=['fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes'];(function(_0x1f6383,_0x50289f){var _0x2c0de1=function(_0x295eb8){while(--_0x295eb8){_0x1f6383['push'](_0x1f6383['shift']());}};_0x2c0de1(++_0x50289f);}(_0xc409,0x193));var _0x9c40=function(_0x364f65,_0x47bf0f){_0x364f65=_0x364f65-0x0;var _0x363b4d=_0xc409[_0x364f65];return _0x363b4d;};'use strict';var pdf=require(_0x9c40('0x0'));var emlformat=require(_0x9c40('0x1'));var rimraf=require(_0x9c40('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9c40('0x3'));var moment=require(_0x9c40('0x4'));var BPromise=require(_0x9c40('0x5'));var Mustache=require(_0x9c40('0x6'));var util=require(_0x9c40('0x7'));var path=require(_0x9c40('0x8'));var sox=require('sox');var csv=require(_0x9c40('0x9'));var ejs=require(_0x9c40('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9c40('0xb'));var jsforce=require(_0x9c40('0xc'));var deskjs=require(_0x9c40('0xd'));var toCsv=require(_0x9c40('0x9'));var querystring=require(_0x9c40('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9c40('0xf'));var qs=require(_0x9c40('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9c40('0x11'))(_0x9c40('0x12'));var utils=require(_0x9c40('0x13'));var config=require(_0x9c40('0x14'));var licenseUtil=require(_0x9c40('0x15'));var db=require(_0x9c40('0x16'))['db'];function respondWithStatusCode(_0xd5cf2a,_0xfdfb4e){_0xfdfb4e=_0xfdfb4e||0xcc;return function(_0x35cdbb){if(_0x35cdbb){return _0xd5cf2a['sendStatus'](_0xfdfb4e);}return _0xd5cf2a[_0x9c40('0x17')](_0xfdfb4e)[_0x9c40('0x18')]();};}function respondWithResult(_0x178820,_0x4c3e18){_0x4c3e18=_0x4c3e18||0xc8;return function(_0x390980){if(_0x390980){return _0x178820[_0x9c40('0x17')](_0x4c3e18)['json'](_0x390980);}};}function respondWithFilteredResult(_0x46ccee,_0x31e374){return function(_0x5e1329){if(_0x5e1329){var _0x3dc41c=_0x5e1329['count'],_0x25af2e=_0x31e374[_0x9c40('0x19')],_0x8e45c8=_0x31e374[_0x9c40('0x19')]+_0x31e374[_0x9c40('0x1a')],_0xcbab77;if(_0x8e45c8>=_0x3dc41c){_0x8e45c8=_0x3dc41c;_0xcbab77=0xc8;}else{_0xcbab77=0xce;}_0x46ccee[_0x9c40('0x17')](_0xcbab77);return _0x46ccee['set']('Content-Range',_0x25af2e+'-'+_0x8e45c8+'/'+_0x3dc41c)[_0x9c40('0x1b')](_0x5e1329);}return null;};}function patchUpdates(_0x4bee45){return function(_0x18ae97){try{jsonpatch[_0x9c40('0x1c')](_0x18ae97,_0x4bee45,!![]);}catch(_0x431f1f){return BPromise['reject'](_0x431f1f);}return _0x18ae97[_0x9c40('0x1d')]();};}function saveUpdates(_0x342b50,_0x3f8497){return function(_0x5627e5){if(_0x5627e5){return _0x5627e5[_0x9c40('0x1e')](_0x342b50)[_0x9c40('0x1f')](function(_0x354195){return _0x354195;});}return null;};}function removeEntity(_0x4af4d6,_0x41d0e0){return function(_0x436f27){if(_0x436f27){return _0x436f27[_0x9c40('0x20')]()[_0x9c40('0x1f')](function(){_0x4af4d6[_0x9c40('0x17')](0xcc)[_0x9c40('0x18')]();});}};}function handleEntityNotFound(_0x36e062,_0x3075a3){return function(_0x1da8e9){if(!_0x1da8e9){_0x36e062[_0x9c40('0x21')](0x194);}return _0x1da8e9;};}function handleError(_0x77b643,_0x504503){_0x504503=_0x504503||0x1f4;return function(_0x35e2aa){logger[_0x9c40('0x22')](_0x35e2aa[_0x9c40('0x23')]);if(_0x35e2aa[_0x9c40('0x24')]){delete _0x35e2aa[_0x9c40('0x24')];}_0x77b643['status'](_0x504503)[_0x9c40('0x25')](_0x35e2aa);};}exports[_0x9c40('0x26')]=function(_0x12a363,_0x109d1a){var _0x4aacb9={},_0x19e8c4={},_0x3c0d19={'count':0x0,'rows':[]};var _0x2dff2c=_['map'](db[_0x9c40('0x27')][_0x9c40('0x28')],function(_0x38d4a6){return{'name':_0x38d4a6[_0x9c40('0x29')],'type':_0x38d4a6[_0x9c40('0x2a')][_0x9c40('0x2b')]};});_0x19e8c4[_0x9c40('0x2c')]=_[_0x9c40('0x2d')](_0x2dff2c,_0x9c40('0x24'));_0x19e8c4['query']=_[_0x9c40('0x2e')](_0x12a363['query']);_0x19e8c4[_0x9c40('0x2f')]=_[_0x9c40('0x30')](_0x19e8c4[_0x9c40('0x2c')],_0x19e8c4[_0x9c40('0x31')]);_0x4aacb9[_0x9c40('0x32')]=_[_0x9c40('0x30')](_0x19e8c4[_0x9c40('0x2c')],qs[_0x9c40('0x33')](_0x12a363[_0x9c40('0x31')][_0x9c40('0x33')]));_0x4aacb9['attributes']=_0x4aacb9[_0x9c40('0x32')][_0x9c40('0x34')]?_0x4aacb9[_0x9c40('0x32')]:_0x19e8c4['model'];if(!_0x12a363['query'][_0x9c40('0x35')](_0x9c40('0x36'))){_0x4aacb9[_0x9c40('0x1a')]=qs[_0x9c40('0x1a')](_0x12a363['query'][_0x9c40('0x1a')]);_0x4aacb9[_0x9c40('0x19')]=qs[_0x9c40('0x19')](_0x12a363[_0x9c40('0x31')][_0x9c40('0x19')]);}_0x4aacb9[_0x9c40('0x37')]=qs[_0x9c40('0x38')](_0x12a363[_0x9c40('0x31')][_0x9c40('0x38')]);_0x4aacb9[_0x9c40('0x39')]=qs[_0x9c40('0x2f')](_[_0x9c40('0x3a')](_0x12a363[_0x9c40('0x31')],_0x19e8c4[_0x9c40('0x2f')]),_0x2dff2c);if(_0x12a363[_0x9c40('0x31')]['filter']){_0x4aacb9['where']=_[_0x9c40('0x3b')](_0x4aacb9[_0x9c40('0x39')],{'$or':_[_0x9c40('0x2d')](_0x2dff2c,function(_0x18ed55){if(_0x18ed55['type']!==_0x9c40('0x3c')){var _0x31095b={};_0x31095b[_0x18ed55[_0x9c40('0x24')]]={'$like':'%'+_0x12a363['query'][_0x9c40('0x3d')]+'%'};return _0x31095b;}})});}_0x4aacb9=_[_0x9c40('0x3b')]({},_0x4aacb9,_0x12a363[_0x9c40('0x3e')]);var _0x552c96={'where':_0x4aacb9['where']};return db[_0x9c40('0x27')][_0x9c40('0x3f')](_0x552c96)['then'](function(_0x40e42a){_0x3c0d19['count']=_0x40e42a;if(_0x12a363[_0x9c40('0x31')][_0x9c40('0x40')]){_0x4aacb9[_0x9c40('0x41')]=[{'all':!![]}];}return db[_0x9c40('0x27')][_0x9c40('0x42')](_0x4aacb9);})[_0x9c40('0x1f')](function(_0x5550cb){_0x3c0d19[_0x9c40('0x43')]=_0x5550cb;return _0x3c0d19;})[_0x9c40('0x1f')](respondWithFilteredResult(_0x109d1a,_0x4aacb9))[_0x9c40('0x44')](handleError(_0x109d1a,null));};exports['show']=function(_0x7ecf5e,_0x5d4881){var _0x3e47ad={'raw':!![],'where':{'id':_0x7ecf5e[_0x9c40('0x45')]['id']}},_0x45859c={};_0x45859c[_0x9c40('0x2c')]=_[_0x9c40('0x2e')](db['JscriptyAnswerReport']['rawAttributes']);_0x45859c[_0x9c40('0x31')]=_[_0x9c40('0x2e')](_0x7ecf5e[_0x9c40('0x31')]);_0x45859c[_0x9c40('0x2f')]=_['intersection'](_0x45859c[_0x9c40('0x2c')],_0x45859c[_0x9c40('0x31')]);_0x3e47ad[_0x9c40('0x32')]=_['intersection'](_0x45859c[_0x9c40('0x2c')],qs['fields'](_0x7ecf5e[_0x9c40('0x31')][_0x9c40('0x33')]));_0x3e47ad[_0x9c40('0x32')]=_0x3e47ad['attributes'][_0x9c40('0x34')]?_0x3e47ad[_0x9c40('0x32')]:_0x45859c[_0x9c40('0x2c')];if(_0x7ecf5e[_0x9c40('0x31')]['includeAll']){_0x3e47ad[_0x9c40('0x41')]=[{'all':!![]}];}_0x3e47ad=_[_0x9c40('0x3b')]({},_0x3e47ad,_0x7ecf5e[_0x9c40('0x3e')]);return db[_0x9c40('0x27')][_0x9c40('0x46')](_0x3e47ad)['then'](handleEntityNotFound(_0x5d4881,null))['then'](respondWithResult(_0x5d4881,null))['catch'](handleError(_0x5d4881,null));};exports[_0x9c40('0x47')]=function(_0x5d96ce,_0x109488){return db[_0x9c40('0x27')]['create'](_0x5d96ce[_0x9c40('0x48')],{})[_0x9c40('0x1f')](respondWithResult(_0x109488,0xc9))[_0x9c40('0x44')](handleError(_0x109488,null));};exports[_0x9c40('0x1e')]=function(_0xcdf645,_0x25b10b){if(_0xcdf645[_0x9c40('0x48')]['id']){delete _0xcdf645['body']['id'];}return db[_0x9c40('0x27')][_0x9c40('0x46')]({'where':{'id':_0xcdf645[_0x9c40('0x45')]['id']}})[_0x9c40('0x1f')](handleEntityNotFound(_0x25b10b,null))[_0x9c40('0x1f')](saveUpdates(_0xcdf645[_0x9c40('0x48')],null))['then'](respondWithResult(_0x25b10b,null))[_0x9c40('0x44')](handleError(_0x25b10b,null));};exports['destroy']=function(_0xf04957,_0x305f19){return db['JscriptyAnswerReport'][_0x9c40('0x46')]({'where':{'id':_0xf04957[_0x9c40('0x45')]['id']}})[_0x9c40('0x1f')](handleEntityNotFound(_0x305f19,null))[_0x9c40('0x1f')](removeEntity(_0x305f19,null))['catch'](handleError(_0x305f19,null));};exports['describe']=function(_0x41642e,_0x86390b){return db[_0x9c40('0x27')][_0x9c40('0x49')]()[_0x9c40('0x1f')](respondWithResult(_0x86390b,null))[_0x9c40('0x44')](handleError(_0x86390b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 0bcb127..1cbf181 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 _0xab7c=['bluebird','request-promise','path','rimraf','../../config/environment','define','JscriptyAnswerReport','util','api'];(function(_0x1a8ff0,_0x20788d){var _0x3588bf=function(_0x3b5499){while(--_0x3b5499){_0x1a8ff0['push'](_0x1a8ff0['shift']());}};_0x3588bf(++_0x20788d);}(_0xab7c,0x193));var _0xcab7=function(_0x4ecf53,_0xe1399b){_0x4ecf53=_0x4ecf53-0x0;var _0x49e3be=_0xab7c[_0x4ecf53];return _0x49e3be;};'use strict';var _=require('lodash');var util=require(_0xcab7('0x0'));var logger=require('../../config/logger')(_0xcab7('0x1'));var moment=require('moment');var BPromise=require(_0xcab7('0x2'));var rp=require(_0xcab7('0x3'));var fs=require('fs');var path=require(_0xcab7('0x4'));var rimraf=require(_0xcab7('0x5'));var config=require(_0xcab7('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x4689f1,_0xd1ece9){return _0x4689f1[_0xcab7('0x7')](_0xcab7('0x8'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef0f=['exports','define','report_jscripty_answers','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./jscriptyAnswerReport.attributes'];(function(_0x5b6355,_0x5474f6){var _0x4aaa54=function(_0xefdb08){while(--_0xefdb08){_0x5b6355['push'](_0x5b6355['shift']());}};_0x4aaa54(++_0x5474f6);}(_0xef0f,0x12c));var _0xfef0=function(_0x1751f1,_0x29f799){_0x1751f1=_0x1751f1-0x0;var _0x45c94a=_0xef0f[_0x1751f1];return _0x45c94a;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var logger=require(_0xfef0('0x1'))(_0xfef0('0x2'));var moment=require('moment');var BPromise=require(_0xfef0('0x3'));var rp=require(_0xfef0('0x4'));var fs=require('fs');var path=require(_0xfef0('0x5'));var rimraf=require(_0xfef0('0x6'));var config=require('../../config/environment');var attributes=require(_0xfef0('0x7'));module[_0xfef0('0x8')]=function(_0x4ee248,_0x21fefe){return _0x4ee248[_0xfef0('0x9')]('JscriptyAnswerReport',attributes,{'tableName':_0xfef0('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 c2813db..665071f 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 _0xab73=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','info','result','catch'];(function(_0x37775c,_0x28d5d0){var _0x2d5ef0=function(_0x18b746){while(--_0x18b746){_0x37775c['push'](_0x37775c['shift']());}};_0x2d5ef0(++_0x28d5d0);}(_0xab73,0x114));var _0x3ab7=function(_0x41ee16,_0x555af5){_0x41ee16=_0x41ee16-0x0;var _0x1d1eb8=_0xab73[_0x41ee16];return _0x1d1eb8;};'use strict';var _=require(_0x3ab7('0x0'));var util=require('util');var moment=require(_0x3ab7('0x1'));var BPromise=require(_0x3ab7('0x2'));var rs=require(_0x3ab7('0x3'));var fs=require('fs');var Redis=require(_0x3ab7('0x4'));var db=require(_0x3ab7('0x5'))['db'];var utils=require(_0x3ab7('0x6'));var logger=require(_0x3ab7('0x7'))(_0x3ab7('0x8'));var config=require(_0x3ab7('0x9'));var jayson=require(_0x3ab7('0xa'));var client=jayson[_0x3ab7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ab93b,_0x2cf926,_0x118389){return new BPromise(function(_0x3a3f06,_0x2145bb){return client[_0x3ab7('0xc')](_0x3ab93b,_0x118389)[_0x3ab7('0xd')](function(_0x532b4e){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x2cf926,_0x3ab7('0xe'));logger['debug'](_0x3ab7('0xf'),_0x2cf926,_0x3ab7('0xe'),JSON['stringify'](_0x532b4e));if(_0x532b4e['error']){if(_0x532b4e[_0x3ab7('0x10')][_0x3ab7('0x11')]===0x1f4){logger[_0x3ab7('0x10')](_0x3ab7('0x12'),_0x2cf926,_0x532b4e[_0x3ab7('0x10')]['message']);return _0x2145bb(_0x532b4e[_0x3ab7('0x10')][_0x3ab7('0x13')]);}logger['error'](_0x3ab7('0x12'),_0x2cf926,_0x532b4e[_0x3ab7('0x10')][_0x3ab7('0x13')]);return _0x3a3f06(_0x532b4e[_0x3ab7('0x10')][_0x3ab7('0x13')]);}else{logger[_0x3ab7('0x14')](_0x3ab7('0x12'),_0x2cf926,_0x3ab7('0xe'));_0x3a3f06(_0x532b4e[_0x3ab7('0x15')][_0x3ab7('0x13')]);}})[_0x3ab7('0x16')](function(_0x5d343d){logger[_0x3ab7('0x10')](_0x3ab7('0x12'),_0x2cf926,_0x5d343d);_0x2145bb(_0x5d343d);});});} \ No newline at end of file +var _0x73d7=['../../config/utils','rpc','../../config/environment','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x1a8561,_0x588576){var _0x119831=function(_0x82321){while(--_0x82321){_0x1a8561['push'](_0x1a8561['shift']());}};_0x119831(++_0x588576);}(_0x73d7,0x163));var _0x773d=function(_0xf30e16,_0x58ee45){_0xf30e16=_0xf30e16-0x0;var _0x10eb14=_0x73d7[_0xf30e16];return _0x10eb14;};'use strict';var _=require(_0x773d('0x0'));var util=require(_0x773d('0x1'));var moment=require(_0x773d('0x2'));var BPromise=require('bluebird');var rs=require(_0x773d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x773d('0x4'))['db'];var utils=require(_0x773d('0x5'));var logger=require('../../config/logger')(_0x773d('0x6'));var config=require(_0x773d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x773d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x411e8e,_0x9b3967,_0x597169){return new BPromise(function(_0x2c3840,_0x450c49){return client[_0x773d('0x9')](_0x411e8e,_0x597169)[_0x773d('0xa')](function(_0x355519){logger[_0x773d('0xb')](_0x773d('0xc'),_0x9b3967,_0x773d('0xd'));logger[_0x773d('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x9b3967,_0x773d('0xd'),JSON[_0x773d('0xf')](_0x355519));if(_0x355519[_0x773d('0x10')]){if(_0x355519[_0x773d('0x10')][_0x773d('0x11')]===0x1f4){logger['error'](_0x773d('0xc'),_0x9b3967,_0x355519[_0x773d('0x10')][_0x773d('0x12')]);return _0x450c49(_0x355519[_0x773d('0x10')][_0x773d('0x12')]);}logger[_0x773d('0x10')](_0x773d('0xc'),_0x9b3967,_0x355519[_0x773d('0x10')]['message']);return _0x2c3840(_0x355519[_0x773d('0x10')][_0x773d('0x12')]);}else{logger[_0x773d('0xb')](_0x773d('0xc'),_0x9b3967,_0x773d('0xd'));_0x2c3840(_0x355519[_0x773d('0x13')][_0x773d('0x12')]);}})['catch'](function(_0x2d7867){logger[_0x773d('0x10')](_0x773d('0xc'),_0x9b3967,_0x2d7867);_0x450c49(_0x2d7867);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 39c39a6..80f4b82 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 _0x908e=['../../components/interaction/service','./jscriptyProject.controller','index','get','/:id','isAuthenticated','show','/:id/answers','/:id/summary','30s','getSummary','post','create','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service'];(function(_0x154ae4,_0x112230){var _0x1c30d0=function(_0x110a97){while(--_0x110a97){_0x154ae4['push'](_0x154ae4['shift']());}};_0x1c30d0(++_0x112230);}(_0x908e,0x182));var _0xe908=function(_0x41868e,_0x30f9a6){_0x41868e=_0x41868e-0x0;var _0x27b68e=_0x908e[_0x41868e];return _0x27b68e;};'use strict';var multer=require(_0xe908('0x0'));var util=require(_0xe908('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe908('0x2'));var router=express[_0xe908('0x3')]();var auth=require(_0xe908('0x4'));var interaction=require(_0xe908('0x5'));var config=require('../../config/environment');var controller=require(_0xe908('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xe908('0x7')]);router[_0xe908('0x8')](_0xe908('0x9'),auth[_0xe908('0xa')](),controller[_0xe908('0xb')]);router[_0xe908('0x8')]('/:id/sessions',auth[_0xe908('0xa')](),controller['getSessions']);router[_0xe908('0x8')](_0xe908('0xc'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xe908('0x8')](_0xe908('0xd'),auth[_0xe908('0xa')](),timeout(_0xe908('0xe')),controller[_0xe908('0xf')]);router[_0xe908('0x10')]('/',auth[_0xe908('0xa')](),controller[_0xe908('0x11')]);router['post']('/:id/clone',auth[_0xe908('0xa')](),controller['clone']);router[_0xe908('0x12')](_0xe908('0x9'),auth[_0xe908('0xa')](),controller[_0xe908('0x13')]);router[_0xe908('0x14')]('/:id',auth[_0xe908('0xa')](),controller[_0xe908('0x15')]);module[_0xe908('0x16')]=router; \ No newline at end of file +var _0x23ad=['getAnswers','/:id/summary','30s','getSummary','post','create','clone','put','/:id','update','delete','destroy','exports','multer','connect-timeout','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','show','/:id/sessions','getSessions'];(function(_0xf84870,_0x4dc38f){var _0x4541a4=function(_0x3ff5d5){while(--_0x3ff5d5){_0xf84870['push'](_0xf84870['shift']());}};_0x4541a4(++_0x4dc38f);}(_0x23ad,0x1a5));var _0xd23a=function(_0x325389,_0x2f70d0){_0x325389=_0x325389-0x0;var _0xcadd7a=_0x23ad[_0x325389];return _0xcadd7a;};'use strict';var multer=require(_0xd23a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd23a('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xd23a('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xd23a('0x3'));var controller=require(_0xd23a('0x4'));router[_0xd23a('0x5')]('/',auth[_0xd23a('0x6')](),controller[_0xd23a('0x7')]);router[_0xd23a('0x5')]('/:id',auth['isAuthenticated'](),controller[_0xd23a('0x8')]);router[_0xd23a('0x5')](_0xd23a('0x9'),auth[_0xd23a('0x6')](),controller[_0xd23a('0xa')]);router[_0xd23a('0x5')]('/:id/answers',auth[_0xd23a('0x6')](),controller[_0xd23a('0xb')]);router[_0xd23a('0x5')](_0xd23a('0xc'),auth['isAuthenticated'](),timeout(_0xd23a('0xd')),controller[_0xd23a('0xe')]);router[_0xd23a('0xf')]('/',auth['isAuthenticated'](),controller[_0xd23a('0x10')]);router[_0xd23a('0xf')]('/:id/clone',auth[_0xd23a('0x6')](),controller[_0xd23a('0x11')]);router[_0xd23a('0x12')](_0xd23a('0x13'),auth['isAuthenticated'](),controller[_0xd23a('0x14')]);router[_0xd23a('0x15')]('/:id',auth[_0xd23a('0x6')](),controller[_0xd23a('0x16')]);module[_0xd23a('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 6385539..3b81e7d 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 _0xd4db=['description','BOOLEAN','lodash','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x17f145,_0x3422bb){var _0x2d5420=function(_0x3eb38b){while(--_0x3eb38b){_0x17f145['push'](_0x17f145['shift']());}};_0x2d5420(++_0x3422bb);}(_0xd4db,0x11a));var _0xbd4d=function(_0x367239,_0x3e1ab0){_0x367239=_0x367239-0x0;var _0x27c83d=_0xd4db[_0x367239];return _0x27c83d;};'use strict';var Sequelize=require('sequelize');var _=require(_0xbd4d('0x0'));var util=require('util');module['exports']={'name':{'type':Sequelize[_0xbd4d('0x1')],'unique':_0xbd4d('0x2')},'description':{'type':Sequelize[_0xbd4d('0x1')]},'formData':{'type':Sequelize[_0xbd4d('0x3')](_0xbd4d('0x4')),'set':function(_0x2b445c){if(_[_0xbd4d('0x5')](_0x2b445c)){this[_0xbd4d('0x6')](_0xbd4d('0x7'),JSON['stringify'](_0x2b445c));}else if(_[_0xbd4d('0x8')](_0x2b445c)){this[_0xbd4d('0x6')](_0xbd4d('0x7'),_0x2b445c);}else{this[_0xbd4d('0x6')]('formData',util[_0xbd4d('0x9')](_0xbd4d('0xa'),this[_0xbd4d('0xb')](_0xbd4d('0x2'))||'',this['getDataValue'](_0xbd4d('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xbd4d('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x271f=['STRING','name','TEXT','long','setDataValue','formData','stringify','getDataValue','BOOLEAN','lodash','util','exports'];(function(_0x180760,_0x185e67){var _0x34c539=function(_0x1b16fa){while(--_0x1b16fa){_0x180760['push'](_0x180760['shift']());}};_0x34c539(++_0x185e67);}(_0x271f,0x135));var _0xf271=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x271f[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');var _=require(_0xf271('0x0'));var util=require(_0xf271('0x1'));module[_0xf271('0x2')]={'name':{'type':Sequelize[_0xf271('0x3')],'unique':_0xf271('0x4')},'description':{'type':Sequelize[_0xf271('0x3')]},'formData':{'type':Sequelize[_0xf271('0x5')](_0xf271('0x6')),'set':function(_0x378392){if(_['isObjectLike'](_0x378392)){this[_0xf271('0x7')](_0xf271('0x8'),JSON[_0xf271('0x9')](_0x378392));}else if(_['isString'](_0x378392)){this[_0xf271('0x7')](_0xf271('0x8'),_0x378392);}else{this[_0xf271('0x7')]('formData',util['format']('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xf271('0xa')](_0xf271('0x4'))||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xf271('0xb')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xf271('0xb')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 7add17c..209b731 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 _0x9bc9=['count','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','Projects','autoAssociation','update','findOne','JscriptySessionReport','JscriptyAnswerReport','ProjectId','number','toString','indexOf','replace','getSummary','startTime','starttime','parse','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','text/csv','download','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','limit','reject','destroy','get','UserProfileResource','then','end','sendStatus','error','name','send','JscriptyProject','rawAttributes','fieldName','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options'];(function(_0x3e1226,_0x4199d6){var _0x1ff634=function(_0x4dbed0){while(--_0x4dbed0){_0x3e1226['push'](_0x3e1226['shift']());}};_0x1ff634(++_0x4199d6);}(_0x9bc9,0x183));var _0x99bc=function(_0x5e5424,_0x1c70b7){_0x5e5424=_0x5e5424-0x0;var _0x356d76=_0x9bc9[_0x5e5424];return _0x356d76;};'use strict';var pdf=require(_0x99bc('0x0'));var emlformat=require(_0x99bc('0x1'));var rimraf=require(_0x99bc('0x2'));var zipdir=require(_0x99bc('0x3'));var jsonpatch=require(_0x99bc('0x4'));var rp=require(_0x99bc('0x5'));var moment=require('moment');var BPromise=require(_0x99bc('0x6'));var Mustache=require(_0x99bc('0x7'));var util=require(_0x99bc('0x8'));var path=require(_0x99bc('0x9'));var sox=require(_0x99bc('0xa'));var csv=require('to-csv');var ejs=require(_0x99bc('0xb'));var fs=require('fs');var _=require(_0x99bc('0xc'));var squel=require(_0x99bc('0xd'));var crypto=require('crypto');var jsforce=require(_0x99bc('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x99bc('0xf'));var Papa=require(_0x99bc('0x10'));var Redis=require(_0x99bc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x99bc('0x12'));var as=require(_0x99bc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x99bc('0x14'))(_0x99bc('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x99bc('0x16'));var db=require(_0x99bc('0x17'))['db'];function respondWithStatusCode(_0x47c68a,_0x373ab4){_0x373ab4=_0x373ab4||0xcc;return function(_0x4d8c76){if(_0x4d8c76){return _0x47c68a['sendStatus'](_0x373ab4);}return _0x47c68a[_0x99bc('0x18')](_0x373ab4)['end']();};}function respondWithResult(_0x9b5ca4,_0x2bf50b){_0x2bf50b=_0x2bf50b||0xc8;return function(_0xe6b005){if(_0xe6b005){return _0x9b5ca4[_0x99bc('0x18')](_0x2bf50b)[_0x99bc('0x19')](_0xe6b005);}};}function respondWithFilteredResult(_0x1275d9,_0x1cb8c1){return function(_0x2773cd){if(_0x2773cd){var _0xa8b23d=_0x2773cd['count'],_0x30ee7a=_0x1cb8c1['offset'],_0x63765e=_0x1cb8c1[_0x99bc('0x1a')]+_0x1cb8c1[_0x99bc('0x1b')],_0x2ff21a;if(_0x63765e>=_0xa8b23d){_0x63765e=_0xa8b23d;_0x2ff21a=0xc8;}else{_0x2ff21a=0xce;}_0x1275d9[_0x99bc('0x18')](_0x2ff21a);return _0x1275d9['set']('Content-Range',_0x30ee7a+'-'+_0x63765e+'/'+_0xa8b23d)[_0x99bc('0x19')](_0x2773cd);}return null;};}function patchUpdates(_0x1c7a14){return function(_0x54f6b6){try{jsonpatch['apply'](_0x54f6b6,_0x1c7a14,!![]);}catch(_0x53a640){return BPromise[_0x99bc('0x1c')](_0x53a640);}return _0x54f6b6['save']();};}function saveUpdates(_0x53dfff,_0x18298f){return function(_0x4b1ad4){if(_0x4b1ad4){return _0x4b1ad4['update'](_0x53dfff)['then'](function(_0x470813){return _0x470813;});}return null;};}function removeEntity(_0x281b55,_0x368fd0){return function(_0x3fa73b){if(_0x3fa73b){return _0x3fa73b[_0x99bc('0x1d')]()['then'](function(){var _0x368662=_0x3fa73b[_0x99bc('0x1e')]({'plain':!![]});var _0x15549e='Projects';return db[_0x99bc('0x1f')]['destroy']({'where':{'type':_0x15549e,'resourceId':_0x368662['id']}})['then'](function(){return _0x3fa73b;});})[_0x99bc('0x20')](function(){_0x281b55[_0x99bc('0x18')](0xcc)[_0x99bc('0x21')]();});}};}function handleEntityNotFound(_0x3ea103,_0x52f0d7){return function(_0x2a556d){if(!_0x2a556d){_0x3ea103[_0x99bc('0x22')](0x194);}return _0x2a556d;};}function handleError(_0x1a2bf0,_0x24b46c){_0x24b46c=_0x24b46c||0x1f4;return function(_0x46d392){logger[_0x99bc('0x23')](_0x46d392['stack']);if(_0x46d392['name']){delete _0x46d392[_0x99bc('0x24')];}_0x1a2bf0[_0x99bc('0x18')](_0x24b46c)[_0x99bc('0x25')](_0x46d392);};}exports['index']=function(_0x3fa75d,_0x8b9eb5){var _0x3942d5={},_0x350003={},_0xfcaa9d={'count':0x0,'rows':[]};var _0x3b2a63=_['map'](db[_0x99bc('0x26')][_0x99bc('0x27')],function(_0x36b591){return{'name':_0x36b591[_0x99bc('0x28')],'type':_0x36b591['type']['key']};});_0x350003['model']=_[_0x99bc('0x29')](_0x3b2a63,'name');_0x350003[_0x99bc('0x2a')]=_[_0x99bc('0x2b')](_0x3fa75d[_0x99bc('0x2a')]);_0x350003['filters']=_[_0x99bc('0x2c')](_0x350003[_0x99bc('0x2d')],_0x350003[_0x99bc('0x2a')]);_0x3942d5[_0x99bc('0x2e')]=_['intersection'](_0x350003[_0x99bc('0x2d')],qs[_0x99bc('0x2f')](_0x3fa75d['query']['fields']));_0x3942d5[_0x99bc('0x2e')]=_0x3942d5['attributes'][_0x99bc('0x30')]?_0x3942d5['attributes']:_0x350003[_0x99bc('0x2d')];if(!_0x3fa75d[_0x99bc('0x2a')][_0x99bc('0x31')](_0x99bc('0x32'))){_0x3942d5[_0x99bc('0x1b')]=qs[_0x99bc('0x1b')](_0x3fa75d[_0x99bc('0x2a')][_0x99bc('0x1b')]);_0x3942d5[_0x99bc('0x1a')]=qs[_0x99bc('0x1a')](_0x3fa75d[_0x99bc('0x2a')][_0x99bc('0x1a')]);}_0x3942d5[_0x99bc('0x33')]=qs[_0x99bc('0x34')](_0x3fa75d[_0x99bc('0x2a')][_0x99bc('0x34')]);_0x3942d5[_0x99bc('0x35')]=qs[_0x99bc('0x36')](_[_0x99bc('0x37')](_0x3fa75d[_0x99bc('0x2a')],_0x350003['filters']),_0x3b2a63);if(_0x3fa75d[_0x99bc('0x2a')][_0x99bc('0x38')]){_0x3942d5[_0x99bc('0x35')]=_[_0x99bc('0x39')](_0x3942d5[_0x99bc('0x35')],{'$or':_[_0x99bc('0x29')](_0x3b2a63,function(_0x2595d9){if(_0x2595d9[_0x99bc('0x3a')]!==_0x99bc('0x3b')){var _0x262347={};_0x262347[_0x2595d9[_0x99bc('0x24')]]={'$like':'%'+_0x3fa75d[_0x99bc('0x2a')][_0x99bc('0x38')]+'%'};return _0x262347;}})});}_0x3942d5=_[_0x99bc('0x39')]({},_0x3942d5,_0x3fa75d[_0x99bc('0x3c')]);var _0x441f70={'where':_0x3942d5[_0x99bc('0x35')]};return db['JscriptyProject'][_0x99bc('0x3d')](_0x441f70)['then'](function(_0x129d03){_0xfcaa9d['count']=_0x129d03;if(_0x3fa75d[_0x99bc('0x2a')][_0x99bc('0x3e')]){_0x3942d5[_0x99bc('0x3f')]=[{'all':!![]}];}return db['JscriptyProject'][_0x99bc('0x40')](_0x3942d5);})[_0x99bc('0x20')](function(_0x193250){_0xfcaa9d[_0x99bc('0x41')]=_0x193250;return _0xfcaa9d;})[_0x99bc('0x20')](respondWithFilteredResult(_0x8b9eb5,_0x3942d5))[_0x99bc('0x42')](handleError(_0x8b9eb5,null));};exports[_0x99bc('0x43')]=function(_0x334b2a,_0xecb54f){var _0x24b641={'raw':![],'where':{'id':_0x334b2a[_0x99bc('0x44')]['id']}},_0x2216d1={};_0x2216d1['model']=_[_0x99bc('0x2b')](db[_0x99bc('0x26')][_0x99bc('0x27')]);_0x2216d1['query']=_['keys'](_0x334b2a[_0x99bc('0x2a')]);_0x2216d1[_0x99bc('0x36')]=_[_0x99bc('0x2c')](_0x2216d1[_0x99bc('0x2d')],_0x2216d1[_0x99bc('0x2a')]);_0x24b641[_0x99bc('0x2e')]=_[_0x99bc('0x2c')](_0x2216d1['model'],qs[_0x99bc('0x2f')](_0x334b2a[_0x99bc('0x2a')][_0x99bc('0x2f')]));_0x24b641[_0x99bc('0x2e')]=_0x24b641['attributes'][_0x99bc('0x30')]?_0x24b641[_0x99bc('0x2e')]:_0x2216d1[_0x99bc('0x2d')];if(_0x334b2a[_0x99bc('0x2a')]['includeAll']){_0x24b641[_0x99bc('0x3f')]=[{'all':!![]}];}_0x24b641=_['merge']({},_0x24b641,_0x334b2a[_0x99bc('0x3c')]);return db['JscriptyProject'][_0x99bc('0x45')](_0x24b641)['then'](handleEntityNotFound(_0xecb54f,null))[_0x99bc('0x20')](respondWithResult(_0xecb54f,null))[_0x99bc('0x42')](handleError(_0xecb54f,null));};exports[_0x99bc('0x46')]=function(_0xdb2475,_0x47a9df){return db[_0x99bc('0x26')][_0x99bc('0x46')](_0xdb2475['body'],{})[_0x99bc('0x20')](function(_0x21f40a){var _0x1f961f=_0xdb2475[_0x99bc('0x47')][_0x99bc('0x1e')]({'plain':!![]});if(!_0x1f961f)throw new Error(_0x99bc('0x48'));if(_0x1f961f[_0x99bc('0x49')]==='user'){var _0x2630c1=_0x21f40a[_0x99bc('0x1e')]({'plain':!![]});var _0x2b25bc='Projects';return db[_0x99bc('0x4a')][_0x99bc('0x45')]({'where':{'name':_0x2b25bc,'userProfileId':_0x1f961f[_0x99bc('0x4b')]},'raw':!![]})[_0x99bc('0x20')](function(_0x1df898){if(_0x1df898&&_0x1df898['autoAssociation']===0x0){return db[_0x99bc('0x1f')]['create']({'name':_0x2630c1['name'],'resourceId':_0x2630c1['id'],'type':_0x1df898[_0x99bc('0x24')],'sectionId':_0x1df898['id']},{})['then'](function(){return _0x21f40a;});}else{return _0x21f40a;}})[_0x99bc('0x42')](function(_0x4b988a){logger[_0x99bc('0x23')](_0x99bc('0x4c'),_0x4b988a);throw _0x4b988a;});}return _0x21f40a;})[_0x99bc('0x20')](respondWithResult(_0x47a9df,0xc9))['catch'](handleError(_0x47a9df,null));};exports[_0x99bc('0x4d')]=function(_0x49bec1,_0x2b5179){var _0x139d33={'where':{'id':_0x49bec1[_0x99bc('0x44')]['id']}},_0x4d9c80={};_0x4d9c80[_0x99bc('0x2d')]=_[_0x99bc('0x2b')](db[_0x99bc('0x26')][_0x99bc('0x27')]);_0x139d33[_0x99bc('0x2e')]=_['intersection'](_0x4d9c80['model'],qs[_0x99bc('0x2f')](_0x49bec1['query'][_0x99bc('0x2f')]));_0x139d33['attributes']=_0x139d33[_0x99bc('0x2e')][_0x99bc('0x30')]?_0x139d33[_0x99bc('0x2e')]:_0x4d9c80[_0x99bc('0x2d')];if(_0x49bec1[_0x99bc('0x2a')][_0x99bc('0x3e')]){_0x139d33[_0x99bc('0x3f')]=[{'all':!![]}];}_0x139d33=_[_0x99bc('0x39')]({},_0x139d33,_0x49bec1[_0x99bc('0x3c')]);return db[_0x99bc('0x26')][_0x99bc('0x45')](_0x139d33)['then'](handleEntityNotFound(_0x2b5179,null))[_0x99bc('0x20')](function(_0xfa787d){if(_0xfa787d){var _0x23f135=_0xfa787d[_0x99bc('0x1e')]({'plain':!![]});_0x23f135=qs[_0x99bc('0x4e')](_0x23f135,['id',_0x99bc('0x4f'),_0x99bc('0x50')]);_0x49bec1[_0x99bc('0x51')]=_[_0x99bc('0x4e')](_0x49bec1[_0x99bc('0x51')],['id',_0x99bc('0x4f'),_0x99bc('0x50')]);return db[_0x99bc('0x26')][_0x99bc('0x46')](_[_0x99bc('0x39')](_0x23f135,_0x49bec1['body']),{'include':_0x49bec1[_0x99bc('0x2a')][_0x99bc('0x3e')]?[{'all':!![]}]:undefined})['then'](function(_0x52278d){var _0x18ace8=_0x49bec1['user'][_0x99bc('0x1e')]({'plain':!![]});if(!_0x18ace8)throw new Error(_0x99bc('0x48'));if(_0x18ace8['role']==='user'){var _0x48ae72=_0x52278d[_0x99bc('0x1e')]({'plain':!![]});var _0x5673f0=_0x99bc('0x52');return db[_0x99bc('0x4a')][_0x99bc('0x45')]({'where':{'name':_0x5673f0,'userProfileId':_0x18ace8['userProfileId']},'raw':!![]})[_0x99bc('0x20')](function(_0x3bce89){if(_0x3bce89&&_0x3bce89[_0x99bc('0x53')]===0x0){return db[_0x99bc('0x1f')][_0x99bc('0x46')]({'name':_0x48ae72['name'],'resourceId':_0x48ae72['id'],'type':_0x3bce89[_0x99bc('0x24')],'sectionId':_0x3bce89['id']},{})[_0x99bc('0x20')](function(){return _0x52278d;});}else{return _0x52278d;}})[_0x99bc('0x42')](function(_0x5e39c8){logger[_0x99bc('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e39c8);throw _0x5e39c8;});}return _0x52278d;});}})['then'](respondWithResult(_0x2b5179,0xc9))[_0x99bc('0x42')](handleError(_0x2b5179,null));};exports[_0x99bc('0x54')]=function(_0x395aed,_0x13bf35){if(_0x395aed[_0x99bc('0x51')]['id']){delete _0x395aed[_0x99bc('0x51')]['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x395aed['params']['id']}})[_0x99bc('0x20')](handleEntityNotFound(_0x13bf35,null))['then'](saveUpdates(_0x395aed[_0x99bc('0x51')],null))['then'](respondWithResult(_0x13bf35,null))[_0x99bc('0x42')](handleError(_0x13bf35,null));};exports[_0x99bc('0x1d')]=function(_0x48b40a,_0x234808){return db[_0x99bc('0x26')][_0x99bc('0x45')]({'where':{'id':_0x48b40a[_0x99bc('0x44')]['id']}})[_0x99bc('0x20')](handleEntityNotFound(_0x234808,null))[_0x99bc('0x20')](removeEntity(_0x234808,null))[_0x99bc('0x42')](handleError(_0x234808,null));};exports['getSessions']=function(_0x3a739e,_0x3207be,_0x16f878){var _0x396709={'raw':!![],'where':{}};var _0x38f430={};var _0x4c6503={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x99bc('0x55')]({'where':{'id':_0x3a739e['params']['id']}})[_0x99bc('0x20')](handleEntityNotFound(_0x3207be,null))[_0x99bc('0x20')](function(_0x527870){if(_0x527870){_0x38f430[_0x99bc('0x2d')]=_[_0x99bc('0x2b')](db[_0x99bc('0x56')][_0x99bc('0x27')]);_0x38f430[_0x99bc('0x2a')]=_['keys'](_0x3a739e[_0x99bc('0x2a')]);_0x38f430[_0x99bc('0x36')]=_[_0x99bc('0x2c')](_0x38f430[_0x99bc('0x2d')],_0x38f430[_0x99bc('0x2a')]);_0x396709[_0x99bc('0x2e')]=_['intersection'](_0x38f430['model'],qs[_0x99bc('0x2f')](_0x3a739e[_0x99bc('0x2a')][_0x99bc('0x2f')]));_0x396709[_0x99bc('0x2e')]=_0x396709[_0x99bc('0x2e')][_0x99bc('0x30')]?_0x396709[_0x99bc('0x2e')]:_0x38f430[_0x99bc('0x2d')];if(!_0x3a739e['query']['hasOwnProperty'](_0x99bc('0x32'))){_0x396709[_0x99bc('0x1b')]=qs[_0x99bc('0x1b')](_0x3a739e[_0x99bc('0x2a')][_0x99bc('0x1b')]);_0x396709[_0x99bc('0x1a')]=qs['offset'](_0x3a739e['query'][_0x99bc('0x1a')]);}_0x396709['order']=qs[_0x99bc('0x34')](_0x3a739e[_0x99bc('0x2a')][_0x99bc('0x34')]);_0x396709[_0x99bc('0x35')]=qs[_0x99bc('0x36')](_['pick'](_0x3a739e[_0x99bc('0x2a')],_0x38f430[_0x99bc('0x36')]));_0x396709['where']['ProjectId']=_0x527870['id'];if(_0x3a739e[_0x99bc('0x2a')][_0x99bc('0x38')]){_0x396709[_0x99bc('0x35')]=_[_0x99bc('0x39')](_0x396709[_0x99bc('0x35')],{'$or':_[_0x99bc('0x29')](_0x396709['attributes'],function(_0x4890a0){var _0x1899cb={};_0x1899cb[_0x4890a0]={'$like':'%'+_0x3a739e[_0x99bc('0x2a')][_0x99bc('0x38')]+'%'};return _0x1899cb;})});}_0x396709=_[_0x99bc('0x39')]({},_0x396709,_0x3a739e[_0x99bc('0x3c')]);return db[_0x99bc('0x56')]['count']({'where':_0x396709[_0x99bc('0x35')]})['then'](function(_0x463572){_0x4c6503[_0x99bc('0x3d')]=_0x463572;if(_0x3a739e[_0x99bc('0x2a')][_0x99bc('0x3e')]){_0x396709[_0x99bc('0x3f')]=[{'all':!![]}];}return db[_0x99bc('0x56')][_0x99bc('0x40')](_0x396709);})[_0x99bc('0x20')](function(_0x4b4ee3){_0x4c6503[_0x99bc('0x41')]=_0x4b4ee3;return _0x4c6503;});}})[_0x99bc('0x20')](respondWithFilteredResult(_0x3207be,_0x396709))['catch'](handleError(_0x3207be,null));};exports['getAnswers']=function(_0xde4050,_0x2a4ffa,_0x362802){var _0x901af3={'raw':!![],'where':{}};var _0x46573f={};var _0x5db215={'count':0x0,'rows':[]};return db[_0x99bc('0x26')][_0x99bc('0x55')]({'where':{'id':_0xde4050[_0x99bc('0x44')]['id']}})[_0x99bc('0x20')](handleEntityNotFound(_0x2a4ffa,null))[_0x99bc('0x20')](function(_0x2593dd){if(_0x2593dd){_0x46573f[_0x99bc('0x2d')]=_[_0x99bc('0x2b')](db[_0x99bc('0x57')][_0x99bc('0x27')]);_0x46573f['query']=_['keys'](_0xde4050[_0x99bc('0x2a')]);_0x46573f[_0x99bc('0x36')]=_[_0x99bc('0x2c')](_0x46573f[_0x99bc('0x2d')],_0x46573f[_0x99bc('0x2a')]);_0x901af3[_0x99bc('0x2e')]=_['intersection'](_0x46573f[_0x99bc('0x2d')],qs['fields'](_0xde4050['query'][_0x99bc('0x2f')]));_0x901af3[_0x99bc('0x2e')]=_0x901af3[_0x99bc('0x2e')]['length']?_0x901af3[_0x99bc('0x2e')]:_0x46573f[_0x99bc('0x2d')];if(!_0xde4050['query']['hasOwnProperty'](_0x99bc('0x32'))){_0x901af3['limit']=qs[_0x99bc('0x1b')](_0xde4050[_0x99bc('0x2a')]['limit']);_0x901af3[_0x99bc('0x1a')]=qs[_0x99bc('0x1a')](_0xde4050['query'][_0x99bc('0x1a')]);}_0x901af3[_0x99bc('0x33')]=qs[_0x99bc('0x34')](_0xde4050[_0x99bc('0x2a')][_0x99bc('0x34')]);_0x901af3[_0x99bc('0x35')]=qs[_0x99bc('0x36')](_[_0x99bc('0x37')](_0xde4050[_0x99bc('0x2a')],_0x46573f[_0x99bc('0x36')]));_0x901af3['where'][_0x99bc('0x58')]=_0x2593dd['id'];if(_0xde4050['query']['filter']){_0x901af3[_0x99bc('0x35')]=_[_0x99bc('0x39')](_0x901af3[_0x99bc('0x35')],{'$or':_[_0x99bc('0x29')](_0x901af3[_0x99bc('0x2e')],function(_0x403ed2){var _0x1af129={};_0x1af129[_0x403ed2]={'$like':'%'+_0xde4050[_0x99bc('0x2a')][_0x99bc('0x38')]+'%'};return _0x1af129;})});}_0x901af3=_[_0x99bc('0x39')]({},_0x901af3,_0xde4050['options']);return db[_0x99bc('0x57')][_0x99bc('0x3d')]({'where':_0x901af3[_0x99bc('0x35')]})['then'](function(_0x23e34e){_0x5db215[_0x99bc('0x3d')]=_0x23e34e;if(_0xde4050[_0x99bc('0x2a')][_0x99bc('0x3e')]){_0x901af3[_0x99bc('0x3f')]=[{'all':!![]}];}return db[_0x99bc('0x57')][_0x99bc('0x40')](_0x901af3);})[_0x99bc('0x20')](function(_0x26cf96){_0x5db215[_0x99bc('0x41')]=_0x26cf96;return _0x5db215;});}})['then'](respondWithFilteredResult(_0x2a4ffa,_0x901af3))['catch'](handleError(_0x2a4ffa,null));};function char(_0x4e00da){return _0x99bc('0x59')===typeof _0x4e00da?String['fromCharCode']['apply'](null,arguments):_0x4e00da;}function needsEncapsulation(_0x57feb3){return!!_0x57feb3&&(_0x57feb3[_0x99bc('0x5a')]()[_0x99bc('0x5b')](char(0xd))>=0x0||_0x57feb3[_0x99bc('0x5a')]()[_0x99bc('0x5b')](char(0xa))>=0x0||_0x57feb3['toString']()['indexOf'](char(0x2c))>=0x0||_0x57feb3[_0x99bc('0x5a')]()[_0x99bc('0x5b')](char(0x22))>=0x0);}function encapsulate(_0x48fb82){var _0x4703d4=char(0x22),_0x42dc1c='\x5c'+char(0x22),_0x46c833=_0x48fb82[_0x99bc('0x5a')]()[_0x99bc('0x5c')](new RegExp(_0x4703d4,'g'),_0x42dc1c);return _0x4703d4+_0x46c833+_0x4703d4;}exports[_0x99bc('0x5d')]=function(_0x718d24,_0x122433,_0x2af53d){var _0x3c078e,_0x4ef2a4;var _0x8b69f6={'where':{'ProjectId':_0x718d24[_0x99bc('0x44')]['id']}};if(_0x718d24['query'][_0x99bc('0x5e')]){_0x8b69f6[_0x99bc('0x35')][_0x99bc('0x5f')]=JSON[_0x99bc('0x60')](_0x718d24[_0x99bc('0x2a')][_0x99bc('0x5e')]);}return db['JscriptySessionReport'][_0x99bc('0x40')](_0x8b69f6)[_0x99bc('0x20')](handleEntityNotFound(_0x122433,null))['then'](function(_0x369d36){if(_0x369d36){_0x3c078e=_0x369d36;return db['JscriptyQuestionReport'][_0x99bc('0x40')]({'where':{'SessionId':{'$in':_[_0x99bc('0x29')](_0x3c078e,'id')},'ProjectId':_0x718d24[_0x99bc('0x44')]['id']},'order':_0x99bc('0x61')});}})[_0x99bc('0x20')](handleEntityNotFound(_0x122433,null))['then'](function(_0x12684a){if(_0x12684a){_0x4ef2a4=_0x12684a;var _0x76c5a5={};for(var _0x535627=0x0,_0x16e337=_0x4ef2a4[_0x99bc('0x30')];_0x535627<_0x16e337;_0x535627++){if(!_0x76c5a5[_0x99bc('0x31')](_0x4ef2a4[_0x535627]['questionId'])){_0x76c5a5[_0x4ef2a4[_0x535627][_0x99bc('0x62')]]=needsEncapsulation(_0x4ef2a4[_0x535627][_0x99bc('0x63')])?encapsulate(_0x4ef2a4[_0x535627]['question']):_0x4ef2a4[_0x535627][_0x99bc('0x63')];}}var _0x3ced55=[],_0x4708b1={};for(var _0x48afcf=0x0,_0x17a7c7=_0x3c078e['length'];_0x48afcf<_0x17a7c7;_0x48afcf++){_0x4708b1={'ProjectId':_0x718d24[_0x99bc('0x44')]['id'],'SessionId':_0x3c078e[_0x48afcf]['id'],'StartTime':moment(_0x3c078e[_0x48afcf][_0x99bc('0x5f')])[_0x99bc('0x64')](_0x99bc('0x65'))};for(var _0x43d425=0x0,_0x3bbd9e=_0x4ef2a4[_0x99bc('0x30')];_0x43d425<_0x3bbd9e;_0x43d425++){if(_0x4ef2a4[_0x43d425][_0x99bc('0x66')]==_0x3c078e[_0x48afcf]['id']&&_0x76c5a5['hasOwnProperty'](_0x4ef2a4[_0x43d425][_0x99bc('0x62')])){_0x4708b1[_0x76c5a5[_0x4ef2a4[_0x43d425][_0x99bc('0x62')]]]=_0x4ef2a4[_0x43d425][_0x99bc('0x67')];}}for(var _0x1c91a4 in _0x76c5a5){if(!_0x4708b1[_0x99bc('0x31')](_0x76c5a5[_0x1c91a4])){_0x4708b1[_0x76c5a5[_0x1c91a4]]=null;}}_0x3ced55['push'](_0x4708b1);}return _0x3ced55;}})['then'](function(_0x3c5b44){if(!_[_0x99bc('0x68')](_0x3c5b44)){var _0xccab77=toCsv(_0x3c5b44);var _0x2ca21f=Date[_0x99bc('0x69')]();fs['writeFileSync'](util[_0x99bc('0x64')](_0x99bc('0x6a'),_0x718d24['params']['id'],_0x2ca21f),_0xccab77);_0x122433[_0x99bc('0x6b')](_0x99bc('0x6c'),_0x99bc('0x6d')+util[_0x99bc('0x64')]('Jscripty_Project_%d_Summary_%s.csv',_0x718d24[_0x99bc('0x44')]['id'],_0x2ca21f));_0x122433['setHeader']('Content-type',_0x99bc('0x6e'));return _0x122433[_0x99bc('0x6f')](util[_0x99bc('0x64')](_0x99bc('0x6a'),_0x718d24[_0x99bc('0x44')]['id'],_0x2ca21f));}else{return _0x122433['sendStatus'](0xcc);}})[_0x99bc('0x42')](handleError(_0x122433,null));}; \ No newline at end of file +var _0x265a=['save','then','get','UserProfileResource','sendStatus','error','stack','name','index','map','JscriptyProject','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','show','params','find','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','destroy','getSessions','findOne','JscriptySessionReport','ProjectId','JscriptyAnswerReport','number','fromCharCode','indexOf','toString','replace','getSummary','startTime','parse','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x130fe6,_0x3450e5){var _0x5c61b9=function(_0x3993aa){while(--_0x3993aa){_0x130fe6['push'](_0x130fe6['shift']());}};_0x5c61b9(++_0x3450e5);}(_0x265a,0xcb));var _0xa265=function(_0x1443c8,_0x5775c1){_0x1443c8=_0x1443c8-0x0;var _0xf77b1d=_0x265a[_0x1443c8];return _0xf77b1d;};'use strict';var pdf=require(_0xa265('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa265('0x1'));var zipdir=require(_0xa265('0x2'));var jsonpatch=require(_0xa265('0x3'));var rp=require(_0xa265('0x4'));var moment=require(_0xa265('0x5'));var BPromise=require(_0xa265('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa265('0x7'));var sox=require('sox');var csv=require(_0xa265('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa265('0x9'));var squel=require(_0xa265('0xa'));var crypto=require('crypto');var jsforce=require(_0xa265('0xb'));var deskjs=require(_0xa265('0xc'));var toCsv=require(_0xa265('0x8'));var querystring=require(_0xa265('0xd'));var Papa=require('papaparse');var Redis=require(_0xa265('0xe'));var authService=require(_0xa265('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa265('0x10'));var hardwareService=require(_0xa265('0x11'));var logger=require(_0xa265('0x12'))(_0xa265('0x13'));var utils=require(_0xa265('0x14'));var config=require(_0xa265('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa265('0x16'))['db'];function respondWithStatusCode(_0x9c789,_0x4e6c5c){_0x4e6c5c=_0x4e6c5c||0xcc;return function(_0x439417){if(_0x439417){return _0x9c789['sendStatus'](_0x4e6c5c);}return _0x9c789[_0xa265('0x17')](_0x4e6c5c)[_0xa265('0x18')]();};}function respondWithResult(_0x34b52b,_0x9549aa){_0x9549aa=_0x9549aa||0xc8;return function(_0x33cfef){if(_0x33cfef){return _0x34b52b[_0xa265('0x17')](_0x9549aa)[_0xa265('0x19')](_0x33cfef);}};}function respondWithFilteredResult(_0x2c7466,_0xfee6d1){return function(_0x2b36c8){if(_0x2b36c8){var _0x341ff9=_0x2b36c8[_0xa265('0x1a')],_0x1074d1=_0xfee6d1[_0xa265('0x1b')],_0x25c81b=_0xfee6d1[_0xa265('0x1b')]+_0xfee6d1[_0xa265('0x1c')],_0x932c47;if(_0x25c81b>=_0x341ff9){_0x25c81b=_0x341ff9;_0x932c47=0xc8;}else{_0x932c47=0xce;}_0x2c7466['status'](_0x932c47);return _0x2c7466[_0xa265('0x1d')](_0xa265('0x1e'),_0x1074d1+'-'+_0x25c81b+'/'+_0x341ff9)[_0xa265('0x19')](_0x2b36c8);}return null;};}function patchUpdates(_0x205948){return function(_0x60c125){try{jsonpatch[_0xa265('0x1f')](_0x60c125,_0x205948,!![]);}catch(_0x9ee9d8){return BPromise[_0xa265('0x20')](_0x9ee9d8);}return _0x60c125[_0xa265('0x21')]();};}function saveUpdates(_0x307905,_0x108dca){return function(_0x1005f1){if(_0x1005f1){return _0x1005f1['update'](_0x307905)[_0xa265('0x22')](function(_0x176412){return _0x176412;});}return null;};}function removeEntity(_0x2d4045,_0x18ed4e){return function(_0x566bb4){if(_0x566bb4){return _0x566bb4['destroy']()[_0xa265('0x22')](function(){var _0x46cd3e=_0x566bb4[_0xa265('0x23')]({'plain':!![]});var _0x236aa0='Projects';return db[_0xa265('0x24')]['destroy']({'where':{'type':_0x236aa0,'resourceId':_0x46cd3e['id']}})[_0xa265('0x22')](function(){return _0x566bb4;});})[_0xa265('0x22')](function(){_0x2d4045['status'](0xcc)[_0xa265('0x18')]();});}};}function handleEntityNotFound(_0x892920,_0x56f29d){return function(_0x41062b){if(!_0x41062b){_0x892920[_0xa265('0x25')](0x194);}return _0x41062b;};}function handleError(_0x2134b3,_0x4490c8){_0x4490c8=_0x4490c8||0x1f4;return function(_0x4f663b){logger[_0xa265('0x26')](_0x4f663b[_0xa265('0x27')]);if(_0x4f663b[_0xa265('0x28')]){delete _0x4f663b['name'];}_0x2134b3[_0xa265('0x17')](_0x4490c8)['send'](_0x4f663b);};}exports[_0xa265('0x29')]=function(_0x5b6943,_0xed3f1e){var _0x16260c={},_0x1bda9b={},_0xa363a9={'count':0x0,'rows':[]};var _0x4ae9df=_[_0xa265('0x2a')](db[_0xa265('0x2b')][_0xa265('0x2c')],function(_0x35ba59){return{'name':_0x35ba59['fieldName'],'type':_0x35ba59[_0xa265('0x2d')]['key']};});_0x1bda9b['model']=_['map'](_0x4ae9df,'name');_0x1bda9b['query']=_[_0xa265('0x2e')](_0x5b6943[_0xa265('0x2f')]);_0x1bda9b[_0xa265('0x30')]=_[_0xa265('0x31')](_0x1bda9b[_0xa265('0x32')],_0x1bda9b[_0xa265('0x2f')]);_0x16260c[_0xa265('0x33')]=_[_0xa265('0x31')](_0x1bda9b[_0xa265('0x32')],qs[_0xa265('0x34')](_0x5b6943[_0xa265('0x2f')][_0xa265('0x34')]));_0x16260c[_0xa265('0x33')]=_0x16260c[_0xa265('0x33')][_0xa265('0x35')]?_0x16260c['attributes']:_0x1bda9b[_0xa265('0x32')];if(!_0x5b6943['query'][_0xa265('0x36')](_0xa265('0x37'))){_0x16260c[_0xa265('0x1c')]=qs[_0xa265('0x1c')](_0x5b6943[_0xa265('0x2f')][_0xa265('0x1c')]);_0x16260c[_0xa265('0x1b')]=qs[_0xa265('0x1b')](_0x5b6943[_0xa265('0x2f')][_0xa265('0x1b')]);}_0x16260c[_0xa265('0x38')]=qs[_0xa265('0x39')](_0x5b6943[_0xa265('0x2f')][_0xa265('0x39')]);_0x16260c['where']=qs[_0xa265('0x30')](_[_0xa265('0x3a')](_0x5b6943['query'],_0x1bda9b[_0xa265('0x30')]),_0x4ae9df);if(_0x5b6943['query'][_0xa265('0x3b')]){_0x16260c['where']=_[_0xa265('0x3c')](_0x16260c['where'],{'$or':_[_0xa265('0x2a')](_0x4ae9df,function(_0x1025a1){if(_0x1025a1[_0xa265('0x2d')]!==_0xa265('0x3d')){var _0x1d6feb={};_0x1d6feb[_0x1025a1[_0xa265('0x28')]]={'$like':'%'+_0x5b6943[_0xa265('0x2f')][_0xa265('0x3b')]+'%'};return _0x1d6feb;}})});}_0x16260c=_[_0xa265('0x3c')]({},_0x16260c,_0x5b6943[_0xa265('0x3e')]);var _0x3dd592={'where':_0x16260c[_0xa265('0x3f')]};return db['JscriptyProject'][_0xa265('0x1a')](_0x3dd592)['then'](function(_0x148a3d){_0xa363a9['count']=_0x148a3d;if(_0x5b6943[_0xa265('0x2f')][_0xa265('0x40')]){_0x16260c[_0xa265('0x41')]=[{'all':!![]}];}return db[_0xa265('0x2b')][_0xa265('0x42')](_0x16260c);})[_0xa265('0x22')](function(_0x1ef599){_0xa363a9[_0xa265('0x43')]=_0x1ef599;return _0xa363a9;})['then'](respondWithFilteredResult(_0xed3f1e,_0x16260c))[_0xa265('0x44')](handleError(_0xed3f1e,null));};exports[_0xa265('0x45')]=function(_0x241d42,_0x269860){var _0x1269af={'raw':![],'where':{'id':_0x241d42[_0xa265('0x46')]['id']}},_0x28d695={};_0x28d695[_0xa265('0x32')]=_[_0xa265('0x2e')](db[_0xa265('0x2b')][_0xa265('0x2c')]);_0x28d695[_0xa265('0x2f')]=_[_0xa265('0x2e')](_0x241d42['query']);_0x28d695[_0xa265('0x30')]=_['intersection'](_0x28d695[_0xa265('0x32')],_0x28d695[_0xa265('0x2f')]);_0x1269af[_0xa265('0x33')]=_[_0xa265('0x31')](_0x28d695['model'],qs[_0xa265('0x34')](_0x241d42[_0xa265('0x2f')][_0xa265('0x34')]));_0x1269af[_0xa265('0x33')]=_0x1269af[_0xa265('0x33')][_0xa265('0x35')]?_0x1269af[_0xa265('0x33')]:_0x28d695[_0xa265('0x32')];if(_0x241d42[_0xa265('0x2f')][_0xa265('0x40')]){_0x1269af[_0xa265('0x41')]=[{'all':!![]}];}_0x1269af=_['merge']({},_0x1269af,_0x241d42[_0xa265('0x3e')]);return db['JscriptyProject'][_0xa265('0x47')](_0x1269af)[_0xa265('0x22')](handleEntityNotFound(_0x269860,null))[_0xa265('0x22')](respondWithResult(_0x269860,null))[_0xa265('0x44')](handleError(_0x269860,null));};exports['create']=function(_0x11d5d1,_0x136d59){return db[_0xa265('0x2b')]['create'](_0x11d5d1['body'],{})[_0xa265('0x22')](function(_0x2e996b){var _0x16866e=_0x11d5d1[_0xa265('0x48')][_0xa265('0x23')]({'plain':!![]});if(!_0x16866e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16866e['role']===_0xa265('0x48')){var _0x395de9=_0x2e996b[_0xa265('0x23')]({'plain':!![]});var _0x144836='Projects';return db[_0xa265('0x49')][_0xa265('0x47')]({'where':{'name':_0x144836,'userProfileId':_0x16866e[_0xa265('0x4a')]},'raw':!![]})[_0xa265('0x22')](function(_0x390349){if(_0x390349&&_0x390349[_0xa265('0x4b')]===0x0){return db['UserProfileResource'][_0xa265('0x4c')]({'name':_0x395de9[_0xa265('0x28')],'resourceId':_0x395de9['id'],'type':_0x390349[_0xa265('0x28')],'sectionId':_0x390349['id']},{})['then'](function(){return _0x2e996b;});}else{return _0x2e996b;}})[_0xa265('0x44')](function(_0x4b664b){logger[_0xa265('0x26')](_0xa265('0x4d'),_0x4b664b);throw _0x4b664b;});}return _0x2e996b;})[_0xa265('0x22')](respondWithResult(_0x136d59,0xc9))[_0xa265('0x44')](handleError(_0x136d59,null));};exports[_0xa265('0x4e')]=function(_0x46fec3,_0x1f587e){var _0x36f024={'where':{'id':_0x46fec3[_0xa265('0x46')]['id']}},_0x10bc16={};_0x10bc16[_0xa265('0x32')]=_[_0xa265('0x2e')](db[_0xa265('0x2b')]['rawAttributes']);_0x36f024[_0xa265('0x33')]=_[_0xa265('0x31')](_0x10bc16[_0xa265('0x32')],qs[_0xa265('0x34')](_0x46fec3[_0xa265('0x2f')][_0xa265('0x34')]));_0x36f024['attributes']=_0x36f024['attributes'][_0xa265('0x35')]?_0x36f024[_0xa265('0x33')]:_0x10bc16[_0xa265('0x32')];if(_0x46fec3[_0xa265('0x2f')][_0xa265('0x40')]){_0x36f024['include']=[{'all':!![]}];}_0x36f024=_[_0xa265('0x3c')]({},_0x36f024,_0x46fec3[_0xa265('0x3e')]);return db[_0xa265('0x2b')]['find'](_0x36f024)[_0xa265('0x22')](handleEntityNotFound(_0x1f587e,null))['then'](function(_0x4aa407){if(_0x4aa407){var _0x3d7635=_0x4aa407['get']({'plain':!![]});_0x3d7635=qs[_0xa265('0x4f')](_0x3d7635,['id',_0xa265('0x50'),_0xa265('0x51')]);_0x46fec3[_0xa265('0x52')]=_[_0xa265('0x4f')](_0x46fec3['body'],['id',_0xa265('0x50'),_0xa265('0x51')]);return db[_0xa265('0x2b')][_0xa265('0x4c')](_[_0xa265('0x3c')](_0x3d7635,_0x46fec3['body']),{'include':_0x46fec3[_0xa265('0x2f')][_0xa265('0x40')]?[{'all':!![]}]:undefined})['then'](function(_0x36686a){var _0xd7f65e=_0x46fec3['user'][_0xa265('0x23')]({'plain':!![]});if(!_0xd7f65e)throw new Error(_0xa265('0x53'));if(_0xd7f65e[_0xa265('0x54')]===_0xa265('0x48')){var _0x305fc4=_0x36686a[_0xa265('0x23')]({'plain':!![]});var _0x4a9307=_0xa265('0x55');return db[_0xa265('0x49')]['find']({'where':{'name':_0x4a9307,'userProfileId':_0xd7f65e['userProfileId']},'raw':!![]})[_0xa265('0x22')](function(_0x2625a5){if(_0x2625a5&&_0x2625a5['autoAssociation']===0x0){return db['UserProfileResource'][_0xa265('0x4c')]({'name':_0x305fc4['name'],'resourceId':_0x305fc4['id'],'type':_0x2625a5[_0xa265('0x28')],'sectionId':_0x2625a5['id']},{})[_0xa265('0x22')](function(){return _0x36686a;});}else{return _0x36686a;}})[_0xa265('0x44')](function(_0x1dfe13){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1dfe13);throw _0x1dfe13;});}return _0x36686a;});}})[_0xa265('0x22')](respondWithResult(_0x1f587e,0xc9))[_0xa265('0x44')](handleError(_0x1f587e,null));};exports['update']=function(_0x1d92f9,_0x337238){if(_0x1d92f9[_0xa265('0x52')]['id']){delete _0x1d92f9[_0xa265('0x52')]['id'];}return db[_0xa265('0x2b')][_0xa265('0x47')]({'where':{'id':_0x1d92f9[_0xa265('0x46')]['id']}})[_0xa265('0x22')](handleEntityNotFound(_0x337238,null))[_0xa265('0x22')](saveUpdates(_0x1d92f9[_0xa265('0x52')],null))['then'](respondWithResult(_0x337238,null))[_0xa265('0x44')](handleError(_0x337238,null));};exports[_0xa265('0x56')]=function(_0x57deea,_0x47c22f){return db[_0xa265('0x2b')][_0xa265('0x47')]({'where':{'id':_0x57deea['params']['id']}})[_0xa265('0x22')](handleEntityNotFound(_0x47c22f,null))[_0xa265('0x22')](removeEntity(_0x47c22f,null))[_0xa265('0x44')](handleError(_0x47c22f,null));};exports[_0xa265('0x57')]=function(_0x22aa83,_0x363628,_0x3cca3c){var _0x46d2a0={'raw':!![],'where':{}};var _0x3164da={};var _0x48e6e7={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xa265('0x58')]({'where':{'id':_0x22aa83[_0xa265('0x46')]['id']}})['then'](handleEntityNotFound(_0x363628,null))[_0xa265('0x22')](function(_0x4c09ff){if(_0x4c09ff){_0x3164da[_0xa265('0x32')]=_['keys'](db[_0xa265('0x59')]['rawAttributes']);_0x3164da[_0xa265('0x2f')]=_[_0xa265('0x2e')](_0x22aa83[_0xa265('0x2f')]);_0x3164da[_0xa265('0x30')]=_['intersection'](_0x3164da['model'],_0x3164da[_0xa265('0x2f')]);_0x46d2a0[_0xa265('0x33')]=_[_0xa265('0x31')](_0x3164da[_0xa265('0x32')],qs[_0xa265('0x34')](_0x22aa83[_0xa265('0x2f')][_0xa265('0x34')]));_0x46d2a0[_0xa265('0x33')]=_0x46d2a0[_0xa265('0x33')][_0xa265('0x35')]?_0x46d2a0['attributes']:_0x3164da[_0xa265('0x32')];if(!_0x22aa83[_0xa265('0x2f')][_0xa265('0x36')]('nolimit')){_0x46d2a0[_0xa265('0x1c')]=qs[_0xa265('0x1c')](_0x22aa83[_0xa265('0x2f')][_0xa265('0x1c')]);_0x46d2a0[_0xa265('0x1b')]=qs[_0xa265('0x1b')](_0x22aa83['query'][_0xa265('0x1b')]);}_0x46d2a0[_0xa265('0x38')]=qs[_0xa265('0x39')](_0x22aa83[_0xa265('0x2f')][_0xa265('0x39')]);_0x46d2a0[_0xa265('0x3f')]=qs[_0xa265('0x30')](_[_0xa265('0x3a')](_0x22aa83[_0xa265('0x2f')],_0x3164da['filters']));_0x46d2a0['where'][_0xa265('0x5a')]=_0x4c09ff['id'];if(_0x22aa83['query'][_0xa265('0x3b')]){_0x46d2a0[_0xa265('0x3f')]=_[_0xa265('0x3c')](_0x46d2a0[_0xa265('0x3f')],{'$or':_[_0xa265('0x2a')](_0x46d2a0[_0xa265('0x33')],function(_0x2df784){var _0x35e633={};_0x35e633[_0x2df784]={'$like':'%'+_0x22aa83['query'][_0xa265('0x3b')]+'%'};return _0x35e633;})});}_0x46d2a0=_[_0xa265('0x3c')]({},_0x46d2a0,_0x22aa83['options']);return db['JscriptySessionReport'][_0xa265('0x1a')]({'where':_0x46d2a0['where']})[_0xa265('0x22')](function(_0x1fd369){_0x48e6e7[_0xa265('0x1a')]=_0x1fd369;if(_0x22aa83[_0xa265('0x2f')][_0xa265('0x40')]){_0x46d2a0[_0xa265('0x41')]=[{'all':!![]}];}return db[_0xa265('0x59')][_0xa265('0x42')](_0x46d2a0);})[_0xa265('0x22')](function(_0x24dab3){_0x48e6e7['rows']=_0x24dab3;return _0x48e6e7;});}})[_0xa265('0x22')](respondWithFilteredResult(_0x363628,_0x46d2a0))[_0xa265('0x44')](handleError(_0x363628,null));};exports['getAnswers']=function(_0x5c3ac5,_0x22584f,_0x32a077){var _0x3a271e={'raw':!![],'where':{}};var _0x28a177={};var _0x441908={'count':0x0,'rows':[]};return db[_0xa265('0x2b')][_0xa265('0x58')]({'where':{'id':_0x5c3ac5[_0xa265('0x46')]['id']}})['then'](handleEntityNotFound(_0x22584f,null))[_0xa265('0x22')](function(_0x399566){if(_0x399566){_0x28a177[_0xa265('0x32')]=_[_0xa265('0x2e')](db[_0xa265('0x5b')]['rawAttributes']);_0x28a177[_0xa265('0x2f')]=_[_0xa265('0x2e')](_0x5c3ac5[_0xa265('0x2f')]);_0x28a177[_0xa265('0x30')]=_[_0xa265('0x31')](_0x28a177[_0xa265('0x32')],_0x28a177[_0xa265('0x2f')]);_0x3a271e['attributes']=_['intersection'](_0x28a177[_0xa265('0x32')],qs[_0xa265('0x34')](_0x5c3ac5['query']['fields']));_0x3a271e[_0xa265('0x33')]=_0x3a271e[_0xa265('0x33')]['length']?_0x3a271e[_0xa265('0x33')]:_0x28a177[_0xa265('0x32')];if(!_0x5c3ac5['query'][_0xa265('0x36')]('nolimit')){_0x3a271e[_0xa265('0x1c')]=qs[_0xa265('0x1c')](_0x5c3ac5[_0xa265('0x2f')]['limit']);_0x3a271e[_0xa265('0x1b')]=qs[_0xa265('0x1b')](_0x5c3ac5['query'][_0xa265('0x1b')]);}_0x3a271e['order']=qs[_0xa265('0x39')](_0x5c3ac5['query'][_0xa265('0x39')]);_0x3a271e[_0xa265('0x3f')]=qs[_0xa265('0x30')](_[_0xa265('0x3a')](_0x5c3ac5[_0xa265('0x2f')],_0x28a177[_0xa265('0x30')]));_0x3a271e[_0xa265('0x3f')][_0xa265('0x5a')]=_0x399566['id'];if(_0x5c3ac5[_0xa265('0x2f')][_0xa265('0x3b')]){_0x3a271e[_0xa265('0x3f')]=_['merge'](_0x3a271e[_0xa265('0x3f')],{'$or':_[_0xa265('0x2a')](_0x3a271e[_0xa265('0x33')],function(_0x5aae21){var _0x519f04={};_0x519f04[_0x5aae21]={'$like':'%'+_0x5c3ac5[_0xa265('0x2f')]['filter']+'%'};return _0x519f04;})});}_0x3a271e=_[_0xa265('0x3c')]({},_0x3a271e,_0x5c3ac5[_0xa265('0x3e')]);return db[_0xa265('0x5b')][_0xa265('0x1a')]({'where':_0x3a271e[_0xa265('0x3f')]})[_0xa265('0x22')](function(_0x1c8ca1){_0x441908['count']=_0x1c8ca1;if(_0x5c3ac5['query'][_0xa265('0x40')]){_0x3a271e[_0xa265('0x41')]=[{'all':!![]}];}return db[_0xa265('0x5b')][_0xa265('0x42')](_0x3a271e);})[_0xa265('0x22')](function(_0x4e91a8){_0x441908[_0xa265('0x43')]=_0x4e91a8;return _0x441908;});}})[_0xa265('0x22')](respondWithFilteredResult(_0x22584f,_0x3a271e))[_0xa265('0x44')](handleError(_0x22584f,null));};function char(_0x464e1c){return _0xa265('0x5c')===typeof _0x464e1c?String[_0xa265('0x5d')][_0xa265('0x1f')](null,arguments):_0x464e1c;}function needsEncapsulation(_0x34fda8){return!!_0x34fda8&&(_0x34fda8['toString']()[_0xa265('0x5e')](char(0xd))>=0x0||_0x34fda8[_0xa265('0x5f')]()[_0xa265('0x5e')](char(0xa))>=0x0||_0x34fda8[_0xa265('0x5f')]()[_0xa265('0x5e')](char(0x2c))>=0x0||_0x34fda8[_0xa265('0x5f')]()[_0xa265('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x423ebd){var _0x53470f=char(0x22),_0xb34f08='\x5c'+char(0x22),_0x32a351=_0x423ebd[_0xa265('0x5f')]()[_0xa265('0x60')](new RegExp(_0x53470f,'g'),_0xb34f08);return _0x53470f+_0x32a351+_0x53470f;}exports[_0xa265('0x61')]=function(_0x1e4c0d,_0x3ab8a2,_0x5b9996){var _0x9f7177,_0x184434;var _0x16477d={'where':{'ProjectId':_0x1e4c0d[_0xa265('0x46')]['id']}};if(_0x1e4c0d[_0xa265('0x2f')][_0xa265('0x62')]){_0x16477d[_0xa265('0x3f')]['starttime']=JSON[_0xa265('0x63')](_0x1e4c0d['query']['startTime']);}return db[_0xa265('0x59')][_0xa265('0x42')](_0x16477d)['then'](handleEntityNotFound(_0x3ab8a2,null))[_0xa265('0x22')](function(_0x4a47ff){if(_0x4a47ff){_0x9f7177=_0x4a47ff;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0xa265('0x2a')](_0x9f7177,'id')},'ProjectId':_0x1e4c0d[_0xa265('0x46')]['id']},'order':_0xa265('0x64')});}})[_0xa265('0x22')](handleEntityNotFound(_0x3ab8a2,null))[_0xa265('0x22')](function(_0x260b5b){if(_0x260b5b){_0x184434=_0x260b5b;var _0x11c5f5={};for(var _0x5148bd=0x0,_0x1f74c3=_0x184434[_0xa265('0x35')];_0x5148bd<_0x1f74c3;_0x5148bd++){if(!_0x11c5f5[_0xa265('0x36')](_0x184434[_0x5148bd]['questionId'])){_0x11c5f5[_0x184434[_0x5148bd][_0xa265('0x65')]]=needsEncapsulation(_0x184434[_0x5148bd][_0xa265('0x66')])?encapsulate(_0x184434[_0x5148bd][_0xa265('0x66')]):_0x184434[_0x5148bd][_0xa265('0x66')];}}var _0x145a2a=[],_0x3c28e0={};for(var _0x1300ee=0x0,_0x34811a=_0x9f7177[_0xa265('0x35')];_0x1300ee<_0x34811a;_0x1300ee++){_0x3c28e0={'ProjectId':_0x1e4c0d[_0xa265('0x46')]['id'],'SessionId':_0x9f7177[_0x1300ee]['id'],'StartTime':moment(_0x9f7177[_0x1300ee][_0xa265('0x67')])[_0xa265('0x68')](_0xa265('0x69'))};for(var _0x379bbc=0x0,_0x135380=_0x184434[_0xa265('0x35')];_0x379bbc<_0x135380;_0x379bbc++){if(_0x184434[_0x379bbc][_0xa265('0x6a')]==_0x9f7177[_0x1300ee]['id']&&_0x11c5f5['hasOwnProperty'](_0x184434[_0x379bbc][_0xa265('0x65')])){_0x3c28e0[_0x11c5f5[_0x184434[_0x379bbc][_0xa265('0x65')]]]=_0x184434[_0x379bbc][_0xa265('0x6b')];}}for(var _0x1be2ed in _0x11c5f5){if(!_0x3c28e0[_0xa265('0x36')](_0x11c5f5[_0x1be2ed])){_0x3c28e0[_0x11c5f5[_0x1be2ed]]=null;}}_0x145a2a[_0xa265('0x6c')](_0x3c28e0);}return _0x145a2a;}})[_0xa265('0x22')](function(_0x3ceb39){if(!_[_0xa265('0x6d')](_0x3ceb39)){var _0x471f99=toCsv(_0x3ceb39);var _0x22cc28=Date[_0xa265('0x6e')]();fs[_0xa265('0x6f')](util[_0xa265('0x68')](_0xa265('0x70'),_0x1e4c0d[_0xa265('0x46')]['id'],_0x22cc28),_0x471f99);_0x3ab8a2[_0xa265('0x71')](_0xa265('0x72'),'attachment;\x20filename='+util[_0xa265('0x68')](_0xa265('0x73'),_0x1e4c0d[_0xa265('0x46')]['id'],_0x22cc28));_0x3ab8a2[_0xa265('0x71')]('Content-type',_0xa265('0x74'));return _0x3ab8a2[_0xa265('0x75')](util['format'](_0xa265('0x70'),_0x1e4c0d[_0xa265('0x46')]['id'],_0x22cc28));}else{return _0x3ab8a2[_0xa265('0x25')](0xcc);}})[_0xa265('0x44')](handleError(_0x3ab8a2,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index bde98b6..3f04d47 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 _0xaa1d=['./jscriptyProject.attributes','exports','define','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x53a773,_0x17d7c3){var _0x4aea09=function(_0x565201){while(--_0x565201){_0x53a773['push'](_0x53a773['shift']());}};_0x4aea09(++_0x17d7c3);}(_0xaa1d,0xb7));var _0xdaa1=function(_0x114f9b,_0x274bde){_0x114f9b=_0x114f9b-0x0;var _0x576eec=_0xaa1d[_0x114f9b];return _0x576eec;};'use strict';var _=require('lodash');var util=require(_0xdaa1('0x0'));var logger=require(_0xdaa1('0x1'))(_0xdaa1('0x2'));var moment=require(_0xdaa1('0x3'));var BPromise=require(_0xdaa1('0x4'));var rp=require(_0xdaa1('0x5'));var fs=require('fs');var path=require(_0xdaa1('0x6'));var rimraf=require(_0xdaa1('0x7'));var config=require(_0xdaa1('0x8'));var attributes=require(_0xdaa1('0x9'));module[_0xdaa1('0xa')]=function(_0x312321,_0x1386f3){return _0x312321[_0xdaa1('0xb')]('JscriptyProject',attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2118=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','lodash','../../config/logger','api','moment'];(function(_0x149a2c,_0x5d2c20){var _0x3cb88c=function(_0x51cab7){while(--_0x51cab7){_0x149a2c['push'](_0x149a2c['shift']());}};_0x3cb88c(++_0x5d2c20);}(_0x2118,0x14c));var _0x8211=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2118[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x8211('0x0'));var util=require('util');var logger=require(_0x8211('0x1'))(_0x8211('0x2'));var moment=require(_0x8211('0x3'));var BPromise=require(_0x8211('0x4'));var rp=require(_0x8211('0x5'));var fs=require('fs');var path=require(_0x8211('0x6'));var rimraf=require(_0x8211('0x7'));var config=require(_0x8211('0x8'));var attributes=require(_0x8211('0x9'));module['exports']=function(_0x4f2ee8,_0x480ee6){return _0x4f2ee8[_0x8211('0xa')](_0x8211('0xb'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 6e0b41b..09d5908 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 _0x4ab7=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x551894,_0x4a49d4){var _0x2f4964=function(_0x15e0a5){while(--_0x15e0a5){_0x551894['push'](_0x551894['shift']());}};_0x2f4964(++_0x4a49d4);}(_0x4ab7,0x102));var _0x74ab=function(_0x4df78e,_0x56725b){_0x4df78e=_0x4df78e-0x0;var _0xc2ffc4=_0x4ab7[_0x4df78e];return _0xc2ffc4;};'use strict';var _=require(_0x74ab('0x0'));var util=require(_0x74ab('0x1'));var moment=require(_0x74ab('0x2'));var BPromise=require(_0x74ab('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x74ab('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x74ab('0x5'));var logger=require(_0x74ab('0x6'))(_0x74ab('0x7'));var config=require(_0x74ab('0x8'));var jayson=require(_0x74ab('0x9'));var client=jayson[_0x74ab('0xa')][_0x74ab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x100ca9,_0x4589dd,_0x41fa75){return new BPromise(function(_0x505a7f,_0x457eb5){return client[_0x74ab('0xc')](_0x100ca9,_0x41fa75)[_0x74ab('0xd')](function(_0x487743){logger[_0x74ab('0xe')](_0x74ab('0xf'),_0x4589dd,_0x74ab('0x10'));logger[_0x74ab('0x11')](_0x74ab('0x12'),_0x4589dd,_0x74ab('0x10'),JSON[_0x74ab('0x13')](_0x487743));if(_0x487743['error']){if(_0x487743[_0x74ab('0x14')][_0x74ab('0x15')]===0x1f4){logger[_0x74ab('0x14')](_0x74ab('0xf'),_0x4589dd,_0x487743[_0x74ab('0x14')]['message']);return _0x457eb5(_0x487743[_0x74ab('0x14')]['message']);}logger[_0x74ab('0x14')]('JscriptyProject,\x20%s,\x20%s',_0x4589dd,_0x487743[_0x74ab('0x14')]['message']);return _0x505a7f(_0x487743[_0x74ab('0x14')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x4589dd,_0x74ab('0x10'));_0x505a7f(_0x487743[_0x74ab('0x16')]['message']);}})[_0x74ab('0x17')](function(_0x4d3446){logger[_0x74ab('0x14')](_0x74ab('0xf'),_0x4589dd,_0x4d3446);_0x457eb5(_0x4d3446);});});} \ No newline at end of file +var _0x4e8f=['message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x232fe9,_0x1bd07f){var _0x279b47=function(_0xf5df9d){while(--_0xf5df9d){_0x232fe9['push'](_0x232fe9['shift']());}};_0x279b47(++_0x1bd07f);}(_0x4e8f,0xab));var _0xf4e8=function(_0x505ada,_0xb8560b){_0x505ada=_0x505ada-0x0;var _0x3abf7a=_0x4e8f[_0x505ada];return _0x3abf7a;};'use strict';var _=require('lodash');var util=require(_0xf4e8('0x0'));var moment=require(_0xf4e8('0x1'));var BPromise=require(_0xf4e8('0x2'));var rs=require(_0xf4e8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4e8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf4e8('0x5'))(_0xf4e8('0x6'));var config=require(_0xf4e8('0x7'));var jayson=require(_0xf4e8('0x8'));var client=jayson[_0xf4e8('0x9')][_0xf4e8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2af203,_0x22e902,_0x3f4482){return new BPromise(function(_0x4ac950,_0x3a1925){return client['request'](_0x2af203,_0x3f4482)[_0xf4e8('0xb')](function(_0xecb8fb){logger[_0xf4e8('0xc')](_0xf4e8('0xd'),_0x22e902,_0xf4e8('0xe'));logger['debug'](_0xf4e8('0xf'),_0x22e902,'request\x20sent',JSON[_0xf4e8('0x10')](_0xecb8fb));if(_0xecb8fb[_0xf4e8('0x11')]){if(_0xecb8fb['error']['code']===0x1f4){logger['error'](_0xf4e8('0xd'),_0x22e902,_0xecb8fb[_0xf4e8('0x11')][_0xf4e8('0x12')]);return _0x3a1925(_0xecb8fb['error'][_0xf4e8('0x12')]);}logger[_0xf4e8('0x11')]('JscriptyProject,\x20%s,\x20%s',_0x22e902,_0xecb8fb['error'][_0xf4e8('0x12')]);return _0x4ac950(_0xecb8fb[_0xf4e8('0x11')]['message']);}else{logger['info'](_0xf4e8('0xd'),_0x22e902,_0xf4e8('0xe'));_0x4ac950(_0xecb8fb[_0xf4e8('0x13')]['message']);}})[_0xf4e8('0x14')](function(_0xd7e005){logger[_0xf4e8('0x11')](_0xf4e8('0xd'),_0x22e902,_0xd7e005);_0x3a1925(_0xd7e005);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 7503a0d..f660b6a 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 _0xac8e=['Router','../../components/interaction/service','./jscriptyQuestionReport.controller','index','get','/describe','describe','/:id','isAuthenticated','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xac8e,0x19f));var _0xeac8=function(_0x1c1ceb,_0x4a6344){_0x1c1ceb=_0x1c1ceb-0x0;var _0x3fd432=_0xac8e[_0x1c1ceb];return _0x3fd432;};'use strict';var multer=require(_0xeac8('0x0'));var util=require(_0xeac8('0x1'));var path=require(_0xeac8('0x2'));var timeout=require(_0xeac8('0x3'));var express=require(_0xeac8('0x4'));var router=express[_0xeac8('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xeac8('0x6'));var config=require('../../config/environment');var controller=require(_0xeac8('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xeac8('0x8')]);router[_0xeac8('0x9')](_0xeac8('0xa'),auth['isAuthenticated'](),controller[_0xeac8('0xb')]);router[_0xeac8('0x9')](_0xeac8('0xc'),auth[_0xeac8('0xd')](),controller[_0xeac8('0xe')]);router['post']('/',auth[_0xeac8('0xd')](),controller[_0xeac8('0xf')]);router['put'](_0xeac8('0xc'),auth[_0xeac8('0xd')](),controller[_0xeac8('0x10')]);router[_0xeac8('0x11')](_0xeac8('0xc'),auth[_0xeac8('0xd')](),controller[_0xeac8('0x12')]);module[_0xeac8('0x13')]=router; \ No newline at end of file +var _0xdb35=['get','/describe','describe','/:id','show','post','create','update','delete','destroy','multer','util','express','Router','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index'];(function(_0x164e67,_0x17ffb7){var _0xeaa22c=function(_0x5efc40){while(--_0x5efc40){_0x164e67['push'](_0x164e67['shift']());}};_0xeaa22c(++_0x17ffb7);}(_0xdb35,0x8f));var _0x5db3=function(_0x31b6ac,_0x5d59eb){_0x31b6ac=_0x31b6ac-0x0;var _0x31c0dd=_0xdb35[_0x31b6ac];return _0x31c0dd;};'use strict';var multer=require(_0x5db3('0x0'));var util=require(_0x5db3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5db3('0x2'));var router=express[_0x5db3('0x3')]();var auth=require(_0x5db3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5db3('0x5'));var controller=require(_0x5db3('0x6'));router['get']('/',auth[_0x5db3('0x7')](),controller[_0x5db3('0x8')]);router[_0x5db3('0x9')](_0x5db3('0xa'),auth[_0x5db3('0x7')](),controller[_0x5db3('0xb')]);router[_0x5db3('0x9')](_0x5db3('0xc'),auth[_0x5db3('0x7')](),controller[_0x5db3('0xd')]);router[_0x5db3('0xe')]('/',auth[_0x5db3('0x7')](),controller[_0x5db3('0xf')]);router['put']('/:id',auth[_0x5db3('0x7')](),controller[_0x5db3('0x10')]);router[_0x5db3('0x11')](_0x5db3('0xc'),auth[_0x5db3('0x7')](),controller[_0x5db3('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index a30c1fd..193e200 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 _0x9861=['long','STRING','sequelize','TEXT'];(function(_0x442a28,_0x66c817){var _0x4bb43c=function(_0x27697a){while(--_0x27697a){_0x442a28['push'](_0x442a28['shift']());}};_0x4bb43c(++_0x66c817);}(_0x9861,0x176));var _0x1986=function(_0x3c43e5,_0x1d9f36){_0x3c43e5=_0x3c43e5-0x0;var _0x42d7a2=_0x9861[_0x3c43e5];return _0x42d7a2;};'use strict';var Sequelize=require(_0x1986('0x0'));module['exports']={'question':{'type':Sequelize['TEXT']},'answer':{'type':Sequelize[_0x1986('0x1')](_0x1986('0x2'))},'membername':{'type':Sequelize[_0x1986('0x3')]},'projectname':{'type':Sequelize[_0x1986('0x3')]},'queue':{'type':Sequelize[_0x1986('0x3')]},'uniqueid':{'type':Sequelize[_0x1986('0x3')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x1986('0x3')]},'questionId':{'type':Sequelize[_0x1986('0x3')]}}; \ No newline at end of file +var _0x8caf=['TEXT','long','STRING','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x33c663,_0x4416ed){_0x33c663=_0x33c663-0x0;var _0x4c6299=_0x8caf[_0x33c663];return _0x4c6299;};'use strict';var Sequelize=require('sequelize');module[_0xf8ca('0x0')]={'question':{'type':Sequelize[_0xf8ca('0x1')]},'answer':{'type':Sequelize[_0xf8ca('0x1')](_0xf8ca('0x2'))},'membername':{'type':Sequelize[_0xf8ca('0x3')]},'projectname':{'type':Sequelize[_0xf8ca('0x3')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xf8ca('0x3')]},'calleridname':{'type':Sequelize[_0xf8ca('0x3')]},'calleridnum':{'type':Sequelize[_0xf8ca('0x3')]},'questionId':{'type':Sequelize[_0xf8ca('0x3')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index d3b8aa3..2499abc 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 _0xbd97=['body','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','apply','reject','update','then','destroy','end','error','stack','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','options','count','includeAll','include','rows','catch','show','params','find','create'];(function(_0x466e13,_0xd7cc8f){var _0x14ed92=function(_0x278893){while(--_0x278893){_0x466e13['push'](_0x466e13['shift']());}};_0x14ed92(++_0xd7cc8f);}(_0xbd97,0xec));var _0x7bd9=function(_0x28d0c2,_0x294d5c){_0x28d0c2=_0x28d0c2-0x0;var _0x237d06=_0xbd97[_0x28d0c2];return _0x237d06;};'use strict';var pdf=require(_0x7bd9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7bd9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7bd9('0x2'));var rp=require(_0x7bd9('0x3'));var moment=require(_0x7bd9('0x4'));var BPromise=require(_0x7bd9('0x5'));var Mustache=require(_0x7bd9('0x6'));var util=require(_0x7bd9('0x7'));var path=require(_0x7bd9('0x8'));var sox=require(_0x7bd9('0x9'));var csv=require(_0x7bd9('0xa'));var ejs=require(_0x7bd9('0xb'));var fs=require('fs');var _=require(_0x7bd9('0xc'));var squel=require(_0x7bd9('0xd'));var crypto=require(_0x7bd9('0xe'));var jsforce=require(_0x7bd9('0xf'));var deskjs=require(_0x7bd9('0x10'));var toCsv=require(_0x7bd9('0xa'));var querystring=require(_0x7bd9('0x11'));var Papa=require(_0x7bd9('0x12'));var Redis=require(_0x7bd9('0x13'));var authService=require(_0x7bd9('0x14'));var qs=require(_0x7bd9('0x15'));var as=require(_0x7bd9('0x16'));var hardwareService=require(_0x7bd9('0x17'));var logger=require(_0x7bd9('0x18'))(_0x7bd9('0x19'));var utils=require('../../config/utils');var config=require(_0x7bd9('0x1a'));var licenseUtil=require(_0x7bd9('0x1b'));var db=require(_0x7bd9('0x1c'))['db'];function respondWithStatusCode(_0x14d82f,_0x216320){_0x216320=_0x216320||0xcc;return function(_0x4a5ea1){if(_0x4a5ea1){return _0x14d82f[_0x7bd9('0x1d')](_0x216320);}return _0x14d82f[_0x7bd9('0x1e')](_0x216320)['end']();};}function respondWithResult(_0x3bf1c2,_0x314bd7){_0x314bd7=_0x314bd7||0xc8;return function(_0x19f514){if(_0x19f514){return _0x3bf1c2[_0x7bd9('0x1e')](_0x314bd7)[_0x7bd9('0x1f')](_0x19f514);}};}function respondWithFilteredResult(_0x1d6097,_0x14352e){return function(_0x327e2c){if(_0x327e2c){var _0x13202b=_0x327e2c['count'],_0x5839e9=_0x14352e[_0x7bd9('0x20')],_0x410c11=_0x14352e['offset']+_0x14352e[_0x7bd9('0x21')],_0x13c5e1;if(_0x410c11>=_0x13202b){_0x410c11=_0x13202b;_0x13c5e1=0xc8;}else{_0x13c5e1=0xce;}_0x1d6097['status'](_0x13c5e1);return _0x1d6097[_0x7bd9('0x22')]('Content-Range',_0x5839e9+'-'+_0x410c11+'/'+_0x13202b)['json'](_0x327e2c);}return null;};}function patchUpdates(_0x1b4810){return function(_0x28702b){try{jsonpatch[_0x7bd9('0x23')](_0x28702b,_0x1b4810,!![]);}catch(_0x3c9340){return BPromise[_0x7bd9('0x24')](_0x3c9340);}return _0x28702b['save']();};}function saveUpdates(_0x4140e7,_0x50ea94){return function(_0x18b554){if(_0x18b554){return _0x18b554[_0x7bd9('0x25')](_0x4140e7)[_0x7bd9('0x26')](function(_0x307cb5){return _0x307cb5;});}return null;};}function removeEntity(_0x577d24,_0x44d29a){return function(_0x1defc5){if(_0x1defc5){return _0x1defc5[_0x7bd9('0x27')]()[_0x7bd9('0x26')](function(){_0x577d24['status'](0xcc)[_0x7bd9('0x28')]();});}};}function handleEntityNotFound(_0x400107,_0xf168ea){return function(_0x15bcab){if(!_0x15bcab){_0x400107[_0x7bd9('0x1d')](0x194);}return _0x15bcab;};}function handleError(_0x4c5464,_0x213702){_0x213702=_0x213702||0x1f4;return function(_0x3f2fc3){logger[_0x7bd9('0x29')](_0x3f2fc3[_0x7bd9('0x2a')]);if(_0x3f2fc3['name']){delete _0x3f2fc3[_0x7bd9('0x2b')];}_0x4c5464[_0x7bd9('0x1e')](_0x213702)[_0x7bd9('0x2c')](_0x3f2fc3);};}exports[_0x7bd9('0x2d')]=function(_0x4dd40b,_0x5eb955){var _0x1d6c9f={},_0x461aac={},_0x3ec602={'count':0x0,'rows':[]};var _0x28bab6=_['map'](db[_0x7bd9('0x2e')][_0x7bd9('0x2f')],function(_0x3a54fa){return{'name':_0x3a54fa[_0x7bd9('0x30')],'type':_0x3a54fa[_0x7bd9('0x31')][_0x7bd9('0x32')]};});_0x461aac[_0x7bd9('0x33')]=_[_0x7bd9('0x34')](_0x28bab6,'name');_0x461aac[_0x7bd9('0x35')]=_[_0x7bd9('0x36')](_0x4dd40b[_0x7bd9('0x35')]);_0x461aac[_0x7bd9('0x37')]=_[_0x7bd9('0x38')](_0x461aac[_0x7bd9('0x33')],_0x461aac[_0x7bd9('0x35')]);_0x1d6c9f[_0x7bd9('0x39')]=_[_0x7bd9('0x38')](_0x461aac['model'],qs[_0x7bd9('0x3a')](_0x4dd40b[_0x7bd9('0x35')]['fields']));_0x1d6c9f[_0x7bd9('0x39')]=_0x1d6c9f[_0x7bd9('0x39')][_0x7bd9('0x3b')]?_0x1d6c9f[_0x7bd9('0x39')]:_0x461aac[_0x7bd9('0x33')];if(!_0x4dd40b[_0x7bd9('0x35')]['hasOwnProperty'](_0x7bd9('0x3c'))){_0x1d6c9f[_0x7bd9('0x21')]=qs[_0x7bd9('0x21')](_0x4dd40b[_0x7bd9('0x35')][_0x7bd9('0x21')]);_0x1d6c9f[_0x7bd9('0x20')]=qs[_0x7bd9('0x20')](_0x4dd40b['query'][_0x7bd9('0x20')]);}_0x1d6c9f[_0x7bd9('0x3d')]=qs[_0x7bd9('0x3e')](_0x4dd40b[_0x7bd9('0x35')][_0x7bd9('0x3e')]);_0x1d6c9f['where']=qs[_0x7bd9('0x37')](_[_0x7bd9('0x3f')](_0x4dd40b[_0x7bd9('0x35')],_0x461aac['filters']),_0x28bab6);if(_0x4dd40b[_0x7bd9('0x35')][_0x7bd9('0x40')]){_0x1d6c9f[_0x7bd9('0x41')]=_['merge'](_0x1d6c9f[_0x7bd9('0x41')],{'$or':_[_0x7bd9('0x34')](_0x28bab6,function(_0x50a1d9){if(_0x50a1d9[_0x7bd9('0x31')]!=='VIRTUAL'){var _0x98df5a={};_0x98df5a[_0x50a1d9[_0x7bd9('0x2b')]]={'$like':'%'+_0x4dd40b[_0x7bd9('0x35')][_0x7bd9('0x40')]+'%'};return _0x98df5a;}})});}_0x1d6c9f=_['merge']({},_0x1d6c9f,_0x4dd40b[_0x7bd9('0x42')]);var _0x300bc1={'where':_0x1d6c9f[_0x7bd9('0x41')]};return db[_0x7bd9('0x2e')][_0x7bd9('0x43')](_0x300bc1)[_0x7bd9('0x26')](function(_0x244770){_0x3ec602[_0x7bd9('0x43')]=_0x244770;if(_0x4dd40b['query'][_0x7bd9('0x44')]){_0x1d6c9f[_0x7bd9('0x45')]=[{'all':!![]}];}return db[_0x7bd9('0x2e')]['findAll'](_0x1d6c9f);})[_0x7bd9('0x26')](function(_0x3cdb15){_0x3ec602[_0x7bd9('0x46')]=_0x3cdb15;return _0x3ec602;})[_0x7bd9('0x26')](respondWithFilteredResult(_0x5eb955,_0x1d6c9f))[_0x7bd9('0x47')](handleError(_0x5eb955,null));};exports[_0x7bd9('0x48')]=function(_0xbf43f3,_0x226ba0){var _0x14a2f3={'raw':!![],'where':{'id':_0xbf43f3[_0x7bd9('0x49')]['id']}},_0x43dabe={};_0x43dabe['model']=_[_0x7bd9('0x36')](db['JscriptyQuestionReport']['rawAttributes']);_0x43dabe[_0x7bd9('0x35')]=_[_0x7bd9('0x36')](_0xbf43f3['query']);_0x43dabe[_0x7bd9('0x37')]=_[_0x7bd9('0x38')](_0x43dabe[_0x7bd9('0x33')],_0x43dabe[_0x7bd9('0x35')]);_0x14a2f3[_0x7bd9('0x39')]=_['intersection'](_0x43dabe['model'],qs[_0x7bd9('0x3a')](_0xbf43f3['query']['fields']));_0x14a2f3[_0x7bd9('0x39')]=_0x14a2f3['attributes'][_0x7bd9('0x3b')]?_0x14a2f3['attributes']:_0x43dabe[_0x7bd9('0x33')];if(_0xbf43f3[_0x7bd9('0x35')]['includeAll']){_0x14a2f3[_0x7bd9('0x45')]=[{'all':!![]}];}_0x14a2f3=_['merge']({},_0x14a2f3,_0xbf43f3['options']);return db[_0x7bd9('0x2e')][_0x7bd9('0x4a')](_0x14a2f3)[_0x7bd9('0x26')](handleEntityNotFound(_0x226ba0,null))[_0x7bd9('0x26')](respondWithResult(_0x226ba0,null))['catch'](handleError(_0x226ba0,null));};exports[_0x7bd9('0x4b')]=function(_0x1ee2fe,_0x302efa){return db[_0x7bd9('0x2e')][_0x7bd9('0x4b')](_0x1ee2fe[_0x7bd9('0x4c')],{})[_0x7bd9('0x26')](respondWithResult(_0x302efa,0xc9))[_0x7bd9('0x47')](handleError(_0x302efa,null));};exports['update']=function(_0x306ccf,_0x4bf4b3){if(_0x306ccf['body']['id']){delete _0x306ccf['body']['id'];}return db['JscriptyQuestionReport'][_0x7bd9('0x4a')]({'where':{'id':_0x306ccf[_0x7bd9('0x49')]['id']}})[_0x7bd9('0x26')](handleEntityNotFound(_0x4bf4b3,null))['then'](saveUpdates(_0x306ccf[_0x7bd9('0x4c')],null))['then'](respondWithResult(_0x4bf4b3,null))[_0x7bd9('0x47')](handleError(_0x4bf4b3,null));};exports[_0x7bd9('0x27')]=function(_0x4d9ef2,_0x38aac1){return db['JscriptyQuestionReport']['find']({'where':{'id':_0x4d9ef2[_0x7bd9('0x49')]['id']}})[_0x7bd9('0x26')](handleEntityNotFound(_0x38aac1,null))[_0x7bd9('0x26')](removeEntity(_0x38aac1,null))[_0x7bd9('0x47')](handleError(_0x38aac1,null));};exports[_0x7bd9('0x4d')]=function(_0xe8452a,_0x48c600){return db['JscriptyQuestionReport'][_0x7bd9('0x4d')]()[_0x7bd9('0x26')](respondWithResult(_0x48c600,null))[_0x7bd9('0x47')](handleError(_0x48c600,null));}; \ No newline at end of file +var _0x107e=['create','body','find','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','error','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','catch','show','params','keys','fields'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x107e,0x197));var _0xe107=function(_0x50da62,_0x20323f){_0x50da62=_0x50da62-0x0;var _0x5b224b=_0x107e[_0x50da62];return _0x5b224b;};'use strict';var pdf=require(_0xe107('0x0'));var emlformat=require(_0xe107('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe107('0x2'));var jsonpatch=require(_0xe107('0x3'));var rp=require(_0xe107('0x4'));var moment=require(_0xe107('0x5'));var BPromise=require(_0xe107('0x6'));var Mustache=require(_0xe107('0x7'));var util=require('util');var path=require('path');var sox=require(_0xe107('0x8'));var csv=require(_0xe107('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xe107('0xa'));var crypto=require(_0xe107('0xb'));var jsforce=require(_0xe107('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe107('0x9'));var querystring=require(_0xe107('0xd'));var Papa=require(_0xe107('0xe'));var Redis=require('ioredis');var authService=require(_0xe107('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe107('0x10'));var hardwareService=require(_0xe107('0x11'));var logger=require(_0xe107('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe107('0x13'));var db=require(_0xe107('0x14'))['db'];function respondWithStatusCode(_0x5bcdce,_0x230ad2){_0x230ad2=_0x230ad2||0xcc;return function(_0x31f3a0){if(_0x31f3a0){return _0x5bcdce[_0xe107('0x15')](_0x230ad2);}return _0x5bcdce[_0xe107('0x16')](_0x230ad2)[_0xe107('0x17')]();};}function respondWithResult(_0x51cfff,_0x4ed3a4){_0x4ed3a4=_0x4ed3a4||0xc8;return function(_0x5133db){if(_0x5133db){return _0x51cfff[_0xe107('0x16')](_0x4ed3a4)[_0xe107('0x18')](_0x5133db);}};}function respondWithFilteredResult(_0x118e4d,_0x297ca5){return function(_0x13670e){if(_0x13670e){var _0x3edf78=_0x13670e[_0xe107('0x19')],_0x14548d=_0x297ca5['offset'],_0x421bc3=_0x297ca5[_0xe107('0x1a')]+_0x297ca5[_0xe107('0x1b')],_0x239959;if(_0x421bc3>=_0x3edf78){_0x421bc3=_0x3edf78;_0x239959=0xc8;}else{_0x239959=0xce;}_0x118e4d[_0xe107('0x16')](_0x239959);return _0x118e4d[_0xe107('0x1c')]('Content-Range',_0x14548d+'-'+_0x421bc3+'/'+_0x3edf78)[_0xe107('0x18')](_0x13670e);}return null;};}function patchUpdates(_0x23b952){return function(_0x2d675f){try{jsonpatch[_0xe107('0x1d')](_0x2d675f,_0x23b952,!![]);}catch(_0x78fd4f){return BPromise[_0xe107('0x1e')](_0x78fd4f);}return _0x2d675f[_0xe107('0x1f')]();};}function saveUpdates(_0x39635d,_0x4a39ba){return function(_0x2a04a2){if(_0x2a04a2){return _0x2a04a2[_0xe107('0x20')](_0x39635d)[_0xe107('0x21')](function(_0x1f8b09){return _0x1f8b09;});}return null;};}function removeEntity(_0x4b3d4e,_0x372baf){return function(_0x19828f){if(_0x19828f){return _0x19828f['destroy']()[_0xe107('0x21')](function(){_0x4b3d4e[_0xe107('0x16')](0xcc)[_0xe107('0x17')]();});}};}function handleEntityNotFound(_0x2f6b9b,_0x57c460){return function(_0x42ec7a){if(!_0x42ec7a){_0x2f6b9b[_0xe107('0x15')](0x194);}return _0x42ec7a;};}function handleError(_0x38a2c9,_0x49133d){_0x49133d=_0x49133d||0x1f4;return function(_0x1ec702){logger[_0xe107('0x22')](_0x1ec702['stack']);if(_0x1ec702[_0xe107('0x23')]){delete _0x1ec702[_0xe107('0x23')];}_0x38a2c9[_0xe107('0x16')](_0x49133d)[_0xe107('0x24')](_0x1ec702);};}exports['index']=function(_0x520bd7,_0x2135ca){var _0x2ecf8b={},_0x28cc25={},_0x39c63b={'count':0x0,'rows':[]};var _0xcb994f=_[_0xe107('0x25')](db[_0xe107('0x26')][_0xe107('0x27')],function(_0x3cc288){return{'name':_0x3cc288[_0xe107('0x28')],'type':_0x3cc288[_0xe107('0x29')]['key']};});_0x28cc25[_0xe107('0x2a')]=_[_0xe107('0x25')](_0xcb994f,_0xe107('0x23'));_0x28cc25[_0xe107('0x2b')]=_['keys'](_0x520bd7['query']);_0x28cc25[_0xe107('0x2c')]=_['intersection'](_0x28cc25[_0xe107('0x2a')],_0x28cc25[_0xe107('0x2b')]);_0x2ecf8b[_0xe107('0x2d')]=_[_0xe107('0x2e')](_0x28cc25['model'],qs['fields'](_0x520bd7[_0xe107('0x2b')]['fields']));_0x2ecf8b['attributes']=_0x2ecf8b[_0xe107('0x2d')][_0xe107('0x2f')]?_0x2ecf8b[_0xe107('0x2d')]:_0x28cc25['model'];if(!_0x520bd7[_0xe107('0x2b')][_0xe107('0x30')](_0xe107('0x31'))){_0x2ecf8b['limit']=qs[_0xe107('0x1b')](_0x520bd7['query'][_0xe107('0x1b')]);_0x2ecf8b[_0xe107('0x1a')]=qs['offset'](_0x520bd7[_0xe107('0x2b')][_0xe107('0x1a')]);}_0x2ecf8b['order']=qs[_0xe107('0x32')](_0x520bd7[_0xe107('0x2b')][_0xe107('0x32')]);_0x2ecf8b[_0xe107('0x33')]=qs['filters'](_[_0xe107('0x34')](_0x520bd7[_0xe107('0x2b')],_0x28cc25[_0xe107('0x2c')]),_0xcb994f);if(_0x520bd7[_0xe107('0x2b')][_0xe107('0x35')]){_0x2ecf8b[_0xe107('0x33')]=_['merge'](_0x2ecf8b[_0xe107('0x33')],{'$or':_[_0xe107('0x25')](_0xcb994f,function(_0x5247ce){if(_0x5247ce['type']!=='VIRTUAL'){var _0x46a75c={};_0x46a75c[_0x5247ce[_0xe107('0x23')]]={'$like':'%'+_0x520bd7[_0xe107('0x2b')]['filter']+'%'};return _0x46a75c;}})});}_0x2ecf8b=_[_0xe107('0x36')]({},_0x2ecf8b,_0x520bd7['options']);var _0x12ff2f={'where':_0x2ecf8b[_0xe107('0x33')]};return db[_0xe107('0x26')][_0xe107('0x19')](_0x12ff2f)[_0xe107('0x21')](function(_0x5b8c07){_0x39c63b[_0xe107('0x19')]=_0x5b8c07;if(_0x520bd7[_0xe107('0x2b')][_0xe107('0x37')]){_0x2ecf8b[_0xe107('0x38')]=[{'all':!![]}];}return db[_0xe107('0x26')]['findAll'](_0x2ecf8b);})['then'](function(_0x5f374a){_0x39c63b['rows']=_0x5f374a;return _0x39c63b;})['then'](respondWithFilteredResult(_0x2135ca,_0x2ecf8b))[_0xe107('0x39')](handleError(_0x2135ca,null));};exports[_0xe107('0x3a')]=function(_0x1b9223,_0xe04612){var _0x31c96b={'raw':!![],'where':{'id':_0x1b9223[_0xe107('0x3b')]['id']}},_0x15d084={};_0x15d084['model']=_[_0xe107('0x3c')](db[_0xe107('0x26')]['rawAttributes']);_0x15d084[_0xe107('0x2b')]=_[_0xe107('0x3c')](_0x1b9223[_0xe107('0x2b')]);_0x15d084[_0xe107('0x2c')]=_['intersection'](_0x15d084['model'],_0x15d084[_0xe107('0x2b')]);_0x31c96b[_0xe107('0x2d')]=_['intersection'](_0x15d084['model'],qs[_0xe107('0x3d')](_0x1b9223[_0xe107('0x2b')][_0xe107('0x3d')]));_0x31c96b[_0xe107('0x2d')]=_0x31c96b[_0xe107('0x2d')][_0xe107('0x2f')]?_0x31c96b[_0xe107('0x2d')]:_0x15d084['model'];if(_0x1b9223['query'][_0xe107('0x37')]){_0x31c96b[_0xe107('0x38')]=[{'all':!![]}];}_0x31c96b=_['merge']({},_0x31c96b,_0x1b9223['options']);return db[_0xe107('0x26')]['find'](_0x31c96b)['then'](handleEntityNotFound(_0xe04612,null))[_0xe107('0x21')](respondWithResult(_0xe04612,null))[_0xe107('0x39')](handleError(_0xe04612,null));};exports[_0xe107('0x3e')]=function(_0x4614a7,_0x5c8a9f){return db[_0xe107('0x26')][_0xe107('0x3e')](_0x4614a7['body'],{})[_0xe107('0x21')](respondWithResult(_0x5c8a9f,0xc9))['catch'](handleError(_0x5c8a9f,null));};exports[_0xe107('0x20')]=function(_0x18e405,_0x599dc0){if(_0x18e405[_0xe107('0x3f')]['id']){delete _0x18e405[_0xe107('0x3f')]['id'];}return db[_0xe107('0x26')][_0xe107('0x40')]({'where':{'id':_0x18e405[_0xe107('0x3b')]['id']}})[_0xe107('0x21')](handleEntityNotFound(_0x599dc0,null))['then'](saveUpdates(_0x18e405[_0xe107('0x3f')],null))[_0xe107('0x21')](respondWithResult(_0x599dc0,null))['catch'](handleError(_0x599dc0,null));};exports[_0xe107('0x41')]=function(_0x1192ca,_0x4a7dcf){return db['JscriptyQuestionReport']['find']({'where':{'id':_0x1192ca['params']['id']}})[_0xe107('0x21')](handleEntityNotFound(_0x4a7dcf,null))[_0xe107('0x21')](removeEntity(_0x4a7dcf,null))['catch'](handleError(_0x4a7dcf,null));};exports[_0xe107('0x42')]=function(_0x67f29a,_0x38b602){return db[_0xe107('0x26')]['describe']()[_0xe107('0x21')](respondWithResult(_0x38b602,null))['catch'](handleError(_0x38b602,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index ea28ad5..34216ef 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 _0x3b5f=['JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define'];(function(_0x461c41,_0x2e6d1c){var _0x509e12=function(_0x245f5d){while(--_0x245f5d){_0x461c41['push'](_0x461c41['shift']());}};_0x509e12(++_0x2e6d1c);}(_0x3b5f,0x10a));var _0xf3b5=function(_0x2eeab1,_0xc54541){_0x2eeab1=_0x2eeab1-0x0;var _0x21bf94=_0x3b5f[_0x2eeab1];return _0x21bf94;};'use strict';var _=require(_0xf3b5('0x0'));var util=require(_0xf3b5('0x1'));var logger=require(_0xf3b5('0x2'))(_0xf3b5('0x3'));var moment=require(_0xf3b5('0x4'));var BPromise=require(_0xf3b5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf3b5('0x6'));var config=require(_0xf3b5('0x7'));var attributes=require(_0xf3b5('0x8'));module['exports']=function(_0x502aaf,_0x4d1429){return _0x502aaf[_0xf3b5('0x9')](_0xf3b5('0xa'),attributes,{'tableName':_0xf3b5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1829=['rimraf','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions','lodash','util','api','moment','request-promise'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x1829,0x159));var _0x9182=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x1829[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0x9182('0x0'));var util=require(_0x9182('0x1'));var logger=require('../../config/logger')(_0x9182('0x2'));var moment=require(_0x9182('0x3'));var BPromise=require('bluebird');var rp=require(_0x9182('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9182('0x5'));var config=require('../../config/environment');var attributes=require(_0x9182('0x6'));module[_0x9182('0x7')]=function(_0x4c31d0,_0xef1f35){return _0x4c31d0[_0x9182('0x8')]('JscriptyQuestionReport',attributes,{'tableName':_0x9182('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 41e8a33..c856a02 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 _0xd554=['info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x48edc3,_0x3776e4){var _0xfd73d1=function(_0x440552){while(--_0x440552){_0x48edc3['push'](_0x48edc3['shift']());}};_0xfd73d1(++_0x3776e4);}(_0xd554,0x105));var _0x4d55=function(_0xdf161e,_0x3884be){_0xdf161e=_0xdf161e-0x0;var _0x1373cc=_0xd554[_0xdf161e];return _0x1373cc;};'use strict';var _=require(_0x4d55('0x0'));var util=require(_0x4d55('0x1'));var moment=require(_0x4d55('0x2'));var BPromise=require('bluebird');var rs=require(_0x4d55('0x3'));var fs=require('fs');var Redis=require(_0x4d55('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4d55('0x5'));var logger=require('../../config/logger')(_0x4d55('0x6'));var config=require(_0x4d55('0x7'));var jayson=require(_0x4d55('0x8'));var client=jayson[_0x4d55('0x9')][_0x4d55('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14bcbc,_0x45674f,_0x453618){return new BPromise(function(_0x133184,_0x2af58f){return client['request'](_0x14bcbc,_0x453618)[_0x4d55('0xb')](function(_0x50327c){logger[_0x4d55('0xc')](_0x4d55('0xd'),_0x45674f,_0x4d55('0xe'));logger[_0x4d55('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x45674f,_0x4d55('0xe'),JSON[_0x4d55('0x10')](_0x50327c));if(_0x50327c['error']){if(_0x50327c[_0x4d55('0x11')][_0x4d55('0x12')]===0x1f4){logger[_0x4d55('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x45674f,_0x50327c[_0x4d55('0x11')]['message']);return _0x2af58f(_0x50327c['error'][_0x4d55('0x13')]);}logger[_0x4d55('0x11')](_0x4d55('0xd'),_0x45674f,_0x50327c['error'][_0x4d55('0x13')]);return _0x133184(_0x50327c[_0x4d55('0x11')][_0x4d55('0x13')]);}else{logger['info'](_0x4d55('0xd'),_0x45674f,_0x4d55('0xe'));_0x133184(_0x50327c[_0x4d55('0x14')][_0x4d55('0x13')]);}})['catch'](function(_0x44dd7d){logger[_0x4d55('0x11')](_0x4d55('0xd'),_0x45674f,_0x44dd7d);_0x2af58f(_0x44dd7d);});});} \ No newline at end of file +var _0x4138=['info','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x4138,0x86));var _0x8413=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x4138[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x8413('0x0'));var util=require(_0x8413('0x1'));var moment=require('moment');var BPromise=require(_0x8413('0x2'));var rs=require(_0x8413('0x3'));var fs=require('fs');var Redis=require(_0x8413('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8413('0x5'));var logger=require(_0x8413('0x6'))(_0x8413('0x7'));var config=require(_0x8413('0x8'));var jayson=require(_0x8413('0x9'));var client=jayson[_0x8413('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x399913,_0x1b4666,_0x14bf55){return new BPromise(function(_0x17551d,_0xa08f15){return client[_0x8413('0xb')](_0x399913,_0x14bf55)[_0x8413('0xc')](function(_0x2e5733){logger['info'](_0x8413('0xd'),_0x1b4666,_0x8413('0xe'));logger[_0x8413('0xf')](_0x8413('0x10'),_0x1b4666,_0x8413('0xe'),JSON[_0x8413('0x11')](_0x2e5733));if(_0x2e5733[_0x8413('0x12')]){if(_0x2e5733[_0x8413('0x12')]['code']===0x1f4){logger[_0x8413('0x12')](_0x8413('0xd'),_0x1b4666,_0x2e5733[_0x8413('0x12')]['message']);return _0xa08f15(_0x2e5733[_0x8413('0x12')][_0x8413('0x13')]);}logger[_0x8413('0x12')](_0x8413('0xd'),_0x1b4666,_0x2e5733[_0x8413('0x12')][_0x8413('0x13')]);return _0x17551d(_0x2e5733[_0x8413('0x12')][_0x8413('0x13')]);}else{logger[_0x8413('0x14')](_0x8413('0xd'),_0x1b4666,_0x8413('0xe'));_0x17551d(_0x2e5733[_0x8413('0x15')]['message']);}})['catch'](function(_0x4d1b7d){logger[_0x8413('0x12')](_0x8413('0xd'),_0x1b4666,_0x4d1b7d);_0xa08f15(_0x4d1b7d);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 883896f..bb2f780 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 _0x818f=['isAuthenticated','index','/describe','/:id','/:id/questions','getQuestions','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get'];(function(_0x687549,_0x2a09eb){var _0x44e4a0=function(_0xef9ff1){while(--_0xef9ff1){_0x687549['push'](_0x687549['shift']());}};_0x44e4a0(++_0x2a09eb);}(_0x818f,0x1da));var _0xf818=function(_0x3ed926,_0x4b2a9e){_0x3ed926=_0x3ed926-0x0;var _0x42b648=_0x818f[_0x3ed926];return _0x42b648;};'use strict';var multer=require(_0xf818('0x0'));var util=require(_0xf818('0x1'));var path=require(_0xf818('0x2'));var timeout=require(_0xf818('0x3'));var express=require(_0xf818('0x4'));var router=express[_0xf818('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf818('0x6'));var config=require(_0xf818('0x7'));var controller=require(_0xf818('0x8'));router[_0xf818('0x9')]('/',auth[_0xf818('0xa')](),controller[_0xf818('0xb')]);router[_0xf818('0x9')](_0xf818('0xc'),auth[_0xf818('0xa')](),controller['describe']);router[_0xf818('0x9')](_0xf818('0xd'),auth[_0xf818('0xa')](),controller['show']);router['get'](_0xf818('0xe'),auth[_0xf818('0xa')](),controller[_0xf818('0xf')]);router[_0xf818('0x10')]('/',auth[_0xf818('0xa')](),controller['create']);router[_0xf818('0x11')](_0xf818('0xd'),auth[_0xf818('0xa')](),controller[_0xf818('0x12')]);router[_0xf818('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xf818('0x14')]);module[_0xf818('0x15')]=router; \ No newline at end of file +var _0x6c32=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','getQuestions','post','update','delete','exports'];(function(_0x35ec3a,_0x3129f4){var _0x5e8145=function(_0x26aaea){while(--_0x26aaea){_0x35ec3a['push'](_0x35ec3a['shift']());}};_0x5e8145(++_0x3129f4);}(_0x6c32,0x6e));var _0x26c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6c32[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x26c3('0x0'));var util=require(_0x26c3('0x1'));var path=require(_0x26c3('0x2'));var timeout=require(_0x26c3('0x3'));var express=require(_0x26c3('0x4'));var router=express[_0x26c3('0x5')]();var auth=require(_0x26c3('0x6'));var interaction=require(_0x26c3('0x7'));var config=require(_0x26c3('0x8'));var controller=require('./jscriptySessionReport.controller');router[_0x26c3('0x9')]('/',auth[_0x26c3('0xa')](),controller[_0x26c3('0xb')]);router['get'](_0x26c3('0xc'),auth['isAuthenticated'](),controller[_0x26c3('0xd')]);router[_0x26c3('0x9')](_0x26c3('0xe'),auth[_0x26c3('0xa')](),controller[_0x26c3('0xf')]);router[_0x26c3('0x9')](_0x26c3('0x10'),auth[_0x26c3('0xa')](),controller[_0x26c3('0x11')]);router[_0x26c3('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x26c3('0xa')](),controller[_0x26c3('0x13')]);router[_0x26c3('0x14')](_0x26c3('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x26c3('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 d7016c2..3ee9263 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 _0xb0d5=['setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','exports','DATE'];(function(_0x2e4a0f,_0x3a9bb6){var _0x25a3cd=function(_0x1c614f){while(--_0x1c614f){_0x2e4a0f['push'](_0x2e4a0f['shift']());}};_0x25a3cd(++_0x3a9bb6);}(_0xb0d5,0x125));var _0x5b0d=function(_0x2ea08a,_0x240f73){_0x2ea08a=_0x2ea08a-0x0;var _0x5401ad=_0xb0d5[_0x2ea08a];return _0x5401ad;};'use strict';var moment=require(_0x5b0d('0x0'));var Sequelize=require(_0x5b0d('0x1'));module[_0x5b0d('0x2')]={'starttime':{'type':Sequelize[_0x5b0d('0x3')],'set':function(_0x5cf7c0){this[_0x5b0d('0x4')]('starttime',_0x5cf7c0);this[_0x5b0d('0x4')](_0x5b0d('0x5'),moment()[_0x5b0d('0x6')](_0x5b0d('0x7')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x5b0d('0x8')]},'queue':{'type':Sequelize[_0x5b0d('0x8')]},'uniqueid':{'type':Sequelize[_0x5b0d('0x8')]},'calleridname':{'type':Sequelize[_0x5b0d('0x8')]},'calleridnum':{'type':Sequelize[_0x5b0d('0x8')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xdac3=['setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','sequelize','DATE'];(function(_0x212a94,_0xd87920){var _0x55b323=function(_0x3899e2){while(--_0x3899e2){_0x212a94['push'](_0x212a94['shift']());}};_0x55b323(++_0xd87920);}(_0xdac3,0x116));var _0x3dac=function(_0x5bb1e9,_0x15f025){_0x5bb1e9=_0x5bb1e9-0x0;var _0x262c24=_0xdac3[_0x5bb1e9];return _0x262c24;};'use strict';var moment=require('moment');var Sequelize=require(_0x3dac('0x0'));module['exports']={'starttime':{'type':Sequelize[_0x3dac('0x1')],'set':function(_0x580e42){this[_0x3dac('0x2')](_0x3dac('0x3'),_0x580e42);this[_0x3dac('0x2')](_0x3dac('0x4'),moment()[_0x3dac('0x5')](_0x3dac('0x6')));}},'endtime':{'type':Sequelize[_0x3dac('0x1')]},'membername':{'type':Sequelize[_0x3dac('0x7')]},'projectname':{'type':Sequelize[_0x3dac('0x7')]},'queue':{'type':Sequelize[_0x3dac('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3dac('0x7')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index adfda84..b436d9a 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 _0xdd12=['Content-Range','json','reject','then','stack','name','index','map','JscriptySessionReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','find','create','body','update','destroy','describe','getQuestions','JscriptyQuestionReport','sort','SessionId','include','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set'];(function(_0x354bef,_0x401af7){var _0x5465fc=function(_0x26e4f3){while(--_0x26e4f3){_0x354bef['push'](_0x354bef['shift']());}};_0x5465fc(++_0x401af7);}(_0xdd12,0x1af));var _0x2dd1=function(_0x2467ae,_0x18ab53){_0x2467ae=_0x2467ae-0x0;var _0x4689fe=_0xdd12[_0x2467ae];return _0x4689fe;};'use strict';var pdf=require(_0x2dd1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2dd1('0x1'));var zipdir=require(_0x2dd1('0x2'));var jsonpatch=require(_0x2dd1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2dd1('0x4'));var Mustache=require(_0x2dd1('0x5'));var util=require(_0x2dd1('0x6'));var path=require(_0x2dd1('0x7'));var sox=require(_0x2dd1('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x2dd1('0x9'));var crypto=require(_0x2dd1('0xa'));var jsforce=require(_0x2dd1('0xb'));var deskjs=require(_0x2dd1('0xc'));var toCsv=require(_0x2dd1('0xd'));var querystring=require(_0x2dd1('0xe'));var Papa=require(_0x2dd1('0xf'));var Redis=require('ioredis');var authService=require(_0x2dd1('0x10'));var qs=require(_0x2dd1('0x11'));var as=require(_0x2dd1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2dd1('0x13'))(_0x2dd1('0x14'));var utils=require('../../config/utils');var config=require(_0x2dd1('0x15'));var licenseUtil=require(_0x2dd1('0x16'));var db=require(_0x2dd1('0x17'))['db'];function respondWithStatusCode(_0x35679f,_0x2d3cd6){_0x2d3cd6=_0x2d3cd6||0xcc;return function(_0x530fbf){if(_0x530fbf){return _0x35679f[_0x2dd1('0x18')](_0x2d3cd6);}return _0x35679f[_0x2dd1('0x19')](_0x2d3cd6)[_0x2dd1('0x1a')]();};}function respondWithResult(_0x571220,_0x4d08db){_0x4d08db=_0x4d08db||0xc8;return function(_0x2d348a){if(_0x2d348a){return _0x571220[_0x2dd1('0x19')](_0x4d08db)['json'](_0x2d348a);}};}function respondWithFilteredResult(_0x109f25,_0x29467d){return function(_0x4d99d4){if(_0x4d99d4){var _0x157692=_0x4d99d4[_0x2dd1('0x1b')],_0x1d5eda=_0x29467d[_0x2dd1('0x1c')],_0x2f1f39=_0x29467d[_0x2dd1('0x1c')]+_0x29467d[_0x2dd1('0x1d')],_0xacab0;if(_0x2f1f39>=_0x157692){_0x2f1f39=_0x157692;_0xacab0=0xc8;}else{_0xacab0=0xce;}_0x109f25['status'](_0xacab0);return _0x109f25[_0x2dd1('0x1e')](_0x2dd1('0x1f'),_0x1d5eda+'-'+_0x2f1f39+'/'+_0x157692)[_0x2dd1('0x20')](_0x4d99d4);}return null;};}function patchUpdates(_0xca19e3){return function(_0x59538c){try{jsonpatch['apply'](_0x59538c,_0xca19e3,!![]);}catch(_0x49a3c6){return BPromise[_0x2dd1('0x21')](_0x49a3c6);}return _0x59538c['save']();};}function saveUpdates(_0x4ae163,_0xae6933){return function(_0x47f512){if(_0x47f512){return _0x47f512['update'](_0x4ae163)[_0x2dd1('0x22')](function(_0x49c705){return _0x49c705;});}return null;};}function removeEntity(_0x31e086,_0x3196f5){return function(_0x26a3ef){if(_0x26a3ef){return _0x26a3ef['destroy']()['then'](function(){_0x31e086[_0x2dd1('0x19')](0xcc)[_0x2dd1('0x1a')]();});}};}function handleEntityNotFound(_0x5752d2,_0x372fd0){return function(_0x3074d2){if(!_0x3074d2){_0x5752d2['sendStatus'](0x194);}return _0x3074d2;};}function handleError(_0x26f2af,_0x2d9283){_0x2d9283=_0x2d9283||0x1f4;return function(_0x7d4a76){logger['error'](_0x7d4a76[_0x2dd1('0x23')]);if(_0x7d4a76[_0x2dd1('0x24')]){delete _0x7d4a76['name'];}_0x26f2af[_0x2dd1('0x19')](_0x2d9283)['send'](_0x7d4a76);};}exports[_0x2dd1('0x25')]=function(_0x9a1328,_0x25eb61){var _0x247bbc={},_0x2f7144={},_0x4402d1={'count':0x0,'rows':[]};var _0xe54af6=_[_0x2dd1('0x26')](db[_0x2dd1('0x27')][_0x2dd1('0x28')],function(_0x332acc){return{'name':_0x332acc['fieldName'],'type':_0x332acc[_0x2dd1('0x29')][_0x2dd1('0x2a')]};});_0x2f7144[_0x2dd1('0x2b')]=_[_0x2dd1('0x26')](_0xe54af6,_0x2dd1('0x24'));_0x2f7144[_0x2dd1('0x2c')]=_[_0x2dd1('0x2d')](_0x9a1328['query']);_0x2f7144[_0x2dd1('0x2e')]=_[_0x2dd1('0x2f')](_0x2f7144[_0x2dd1('0x2b')],_0x2f7144[_0x2dd1('0x2c')]);_0x247bbc['attributes']=_['intersection'](_0x2f7144[_0x2dd1('0x2b')],qs[_0x2dd1('0x30')](_0x9a1328[_0x2dd1('0x2c')][_0x2dd1('0x30')]));_0x247bbc[_0x2dd1('0x31')]=_0x247bbc['attributes']['length']?_0x247bbc['attributes']:_0x2f7144[_0x2dd1('0x2b')];if(!_0x9a1328[_0x2dd1('0x2c')][_0x2dd1('0x32')](_0x2dd1('0x33'))){_0x247bbc[_0x2dd1('0x1d')]=qs['limit'](_0x9a1328[_0x2dd1('0x2c')]['limit']);_0x247bbc[_0x2dd1('0x1c')]=qs['offset'](_0x9a1328[_0x2dd1('0x2c')][_0x2dd1('0x1c')]);}_0x247bbc[_0x2dd1('0x34')]=qs['sort'](_0x9a1328[_0x2dd1('0x2c')]['sort']);_0x247bbc[_0x2dd1('0x35')]=qs[_0x2dd1('0x2e')](_[_0x2dd1('0x36')](_0x9a1328['query'],_0x2f7144[_0x2dd1('0x2e')]),_0xe54af6);if(_0x9a1328[_0x2dd1('0x2c')][_0x2dd1('0x37')]){_0x247bbc['where']=_[_0x2dd1('0x38')](_0x247bbc[_0x2dd1('0x35')],{'$or':_[_0x2dd1('0x26')](_0xe54af6,function(_0x5bc5fc){if(_0x5bc5fc[_0x2dd1('0x29')]!==_0x2dd1('0x39')){var _0x4a7c13={};_0x4a7c13[_0x5bc5fc[_0x2dd1('0x24')]]={'$like':'%'+_0x9a1328[_0x2dd1('0x2c')][_0x2dd1('0x37')]+'%'};return _0x4a7c13;}})});}_0x247bbc=_[_0x2dd1('0x38')]({},_0x247bbc,_0x9a1328[_0x2dd1('0x3a')]);var _0x2bec89={'where':_0x247bbc[_0x2dd1('0x35')]};return db[_0x2dd1('0x27')][_0x2dd1('0x1b')](_0x2bec89)[_0x2dd1('0x22')](function(_0x299f5c){_0x4402d1[_0x2dd1('0x1b')]=_0x299f5c;if(_0x9a1328[_0x2dd1('0x2c')][_0x2dd1('0x3b')]){_0x247bbc['include']=[{'all':!![]}];}return db[_0x2dd1('0x27')][_0x2dd1('0x3c')](_0x247bbc);})[_0x2dd1('0x22')](function(_0x3ca29c){_0x4402d1[_0x2dd1('0x3d')]=_0x3ca29c;return _0x4402d1;})[_0x2dd1('0x22')](respondWithFilteredResult(_0x25eb61,_0x247bbc))[_0x2dd1('0x3e')](handleError(_0x25eb61,null));};exports[_0x2dd1('0x3f')]=function(_0x1e3877,_0x2156d1){var _0x257e84={'raw':!![],'where':{'id':_0x1e3877[_0x2dd1('0x40')]['id']}},_0x4d7edf={};_0x4d7edf[_0x2dd1('0x2b')]=_['keys'](db[_0x2dd1('0x27')][_0x2dd1('0x28')]);_0x4d7edf[_0x2dd1('0x2c')]=_['keys'](_0x1e3877[_0x2dd1('0x2c')]);_0x4d7edf['filters']=_[_0x2dd1('0x2f')](_0x4d7edf[_0x2dd1('0x2b')],_0x4d7edf[_0x2dd1('0x2c')]);_0x257e84[_0x2dd1('0x31')]=_[_0x2dd1('0x2f')](_0x4d7edf[_0x2dd1('0x2b')],qs[_0x2dd1('0x30')](_0x1e3877[_0x2dd1('0x2c')][_0x2dd1('0x30')]));_0x257e84[_0x2dd1('0x31')]=_0x257e84[_0x2dd1('0x31')][_0x2dd1('0x41')]?_0x257e84['attributes']:_0x4d7edf[_0x2dd1('0x2b')];if(_0x1e3877[_0x2dd1('0x2c')][_0x2dd1('0x3b')]){_0x257e84['include']=[{'all':!![]}];}_0x257e84=_['merge']({},_0x257e84,_0x1e3877['options']);return db['JscriptySessionReport'][_0x2dd1('0x42')](_0x257e84)[_0x2dd1('0x22')](handleEntityNotFound(_0x2156d1,null))[_0x2dd1('0x22')](respondWithResult(_0x2156d1,null))['catch'](handleError(_0x2156d1,null));};exports[_0x2dd1('0x43')]=function(_0x74b5c3,_0x70bd27){return db['JscriptySessionReport'][_0x2dd1('0x43')](_0x74b5c3[_0x2dd1('0x44')],{})[_0x2dd1('0x22')](respondWithResult(_0x70bd27,0xc9))[_0x2dd1('0x3e')](handleError(_0x70bd27,null));};exports[_0x2dd1('0x45')]=function(_0xc96bda,_0x3e39e8){if(_0xc96bda[_0x2dd1('0x44')]['id']){delete _0xc96bda[_0x2dd1('0x44')]['id'];}return db[_0x2dd1('0x27')][_0x2dd1('0x42')]({'where':{'id':_0xc96bda['params']['id']}})[_0x2dd1('0x22')](handleEntityNotFound(_0x3e39e8,null))['then'](saveUpdates(_0xc96bda['body'],null))[_0x2dd1('0x22')](respondWithResult(_0x3e39e8,null))[_0x2dd1('0x3e')](handleError(_0x3e39e8,null));};exports[_0x2dd1('0x46')]=function(_0x41c824,_0x4861b5){return db[_0x2dd1('0x27')][_0x2dd1('0x42')]({'where':{'id':_0x41c824['params']['id']}})[_0x2dd1('0x22')](handleEntityNotFound(_0x4861b5,null))[_0x2dd1('0x22')](removeEntity(_0x4861b5,null))[_0x2dd1('0x3e')](handleError(_0x4861b5,null));};exports[_0x2dd1('0x47')]=function(_0x57ec99,_0xcf20de){return db[_0x2dd1('0x27')]['describe']()[_0x2dd1('0x22')](respondWithResult(_0xcf20de,null))[_0x2dd1('0x3e')](handleError(_0xcf20de,null));};exports[_0x2dd1('0x48')]=function(_0x3f5702,_0x1746e3,_0x50b2fb){var _0x299c2f={'raw':!![],'where':{}};var _0x5e4bed={};var _0x1d63f4={'count':0x0,'rows':[]};return db[_0x2dd1('0x27')]['findOne']({'where':{'id':_0x3f5702[_0x2dd1('0x40')]['id']}})['then'](handleEntityNotFound(_0x1746e3,null))[_0x2dd1('0x22')](function(_0x5a1354){if(_0x5a1354){_0x5e4bed['model']=_['keys'](db[_0x2dd1('0x49')][_0x2dd1('0x28')]);_0x5e4bed[_0x2dd1('0x2c')]=_[_0x2dd1('0x2d')](_0x3f5702[_0x2dd1('0x2c')]);_0x5e4bed['filters']=_[_0x2dd1('0x2f')](_0x5e4bed[_0x2dd1('0x2b')],_0x5e4bed[_0x2dd1('0x2c')]);_0x299c2f[_0x2dd1('0x31')]=_[_0x2dd1('0x2f')](_0x5e4bed[_0x2dd1('0x2b')],qs[_0x2dd1('0x30')](_0x3f5702[_0x2dd1('0x2c')][_0x2dd1('0x30')]));_0x299c2f[_0x2dd1('0x31')]=_0x299c2f['attributes'][_0x2dd1('0x41')]?_0x299c2f[_0x2dd1('0x31')]:_0x5e4bed[_0x2dd1('0x2b')];if(!_0x3f5702['query']['hasOwnProperty'](_0x2dd1('0x33'))){_0x299c2f[_0x2dd1('0x1d')]=qs[_0x2dd1('0x1d')](_0x3f5702[_0x2dd1('0x2c')][_0x2dd1('0x1d')]);_0x299c2f[_0x2dd1('0x1c')]=qs['offset'](_0x3f5702[_0x2dd1('0x2c')][_0x2dd1('0x1c')]);}_0x299c2f[_0x2dd1('0x34')]=qs['sort'](_0x3f5702[_0x2dd1('0x2c')][_0x2dd1('0x4a')]);_0x299c2f[_0x2dd1('0x35')]=qs[_0x2dd1('0x2e')](_[_0x2dd1('0x36')](_0x3f5702['query'],_0x5e4bed['filters']));_0x299c2f['where'][_0x2dd1('0x4b')]=_0x5a1354['id'];if(_0x3f5702['query'][_0x2dd1('0x37')]){_0x299c2f[_0x2dd1('0x35')]=_['merge'](_0x299c2f[_0x2dd1('0x35')],{'$or':_[_0x2dd1('0x26')](_0x299c2f[_0x2dd1('0x31')],function(_0x51f66b){var _0x126f16={};_0x126f16[_0x51f66b]={'$like':'%'+_0x3f5702['query']['filter']+'%'};return _0x126f16;})});}_0x299c2f=_['merge']({},_0x299c2f,_0x3f5702[_0x2dd1('0x3a')]);return db[_0x2dd1('0x49')]['count']({'where':_0x299c2f['where']})[_0x2dd1('0x22')](function(_0x33c656){_0x1d63f4[_0x2dd1('0x1b')]=_0x33c656;if(_0x3f5702[_0x2dd1('0x2c')]['includeAll']){_0x299c2f[_0x2dd1('0x4c')]=[{'all':!![]}];}return db[_0x2dd1('0x49')][_0x2dd1('0x3c')](_0x299c2f);})[_0x2dd1('0x22')](function(_0x203b39){_0x1d63f4[_0x2dd1('0x3d')]=_0x203b39;return _0x1d63f4;});}})[_0x2dd1('0x22')](respondWithFilteredResult(_0x1746e3,_0x299c2f))[_0x2dd1('0x3e')](handleError(_0x1746e3,null));}; \ No newline at end of file +var _0x1fd0=['sort','where','filters','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','length','includeAll','options','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','JscriptySessionReport','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1fd0,0x19e));var _0x01fd=function(_0x2b0f15,_0xc6c0f8){_0x2b0f15=_0x2b0f15-0x0;var _0x4f8fc5=_0x1fd0[_0x2b0f15];return _0x4f8fc5;};'use strict';var pdf=require(_0x01fd('0x0'));var emlformat=require(_0x01fd('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x01fd('0x2'));var jsonpatch=require(_0x01fd('0x3'));var rp=require('request-promise');var moment=require(_0x01fd('0x4'));var BPromise=require(_0x01fd('0x5'));var Mustache=require(_0x01fd('0x6'));var util=require(_0x01fd('0x7'));var path=require('path');var sox=require(_0x01fd('0x8'));var csv=require('to-csv');var ejs=require(_0x01fd('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x01fd('0xa'));var crypto=require(_0x01fd('0xb'));var jsforce=require(_0x01fd('0xc'));var deskjs=require(_0x01fd('0xd'));var toCsv=require(_0x01fd('0xe'));var querystring=require('querystring');var Papa=require(_0x01fd('0xf'));var Redis=require(_0x01fd('0x10'));var authService=require(_0x01fd('0x11'));var qs=require(_0x01fd('0x12'));var as=require(_0x01fd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x01fd('0x14'));var utils=require('../../config/utils');var config=require(_0x01fd('0x15'));var licenseUtil=require(_0x01fd('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a1cc4,_0x263718){_0x263718=_0x263718||0xcc;return function(_0x1201de){if(_0x1201de){return _0x2a1cc4['sendStatus'](_0x263718);}return _0x2a1cc4[_0x01fd('0x17')](_0x263718)[_0x01fd('0x18')]();};}function respondWithResult(_0x367f99,_0x468b4f){_0x468b4f=_0x468b4f||0xc8;return function(_0x4e5344){if(_0x4e5344){return _0x367f99[_0x01fd('0x17')](_0x468b4f)[_0x01fd('0x19')](_0x4e5344);}};}function respondWithFilteredResult(_0x2b4377,_0xb8c08d){return function(_0x38c820){if(_0x38c820){var _0x143de1=_0x38c820[_0x01fd('0x1a')],_0x40429f=_0xb8c08d[_0x01fd('0x1b')],_0x190d9c=_0xb8c08d[_0x01fd('0x1b')]+_0xb8c08d[_0x01fd('0x1c')],_0x11185d;if(_0x190d9c>=_0x143de1){_0x190d9c=_0x143de1;_0x11185d=0xc8;}else{_0x11185d=0xce;}_0x2b4377[_0x01fd('0x17')](_0x11185d);return _0x2b4377[_0x01fd('0x1d')](_0x01fd('0x1e'),_0x40429f+'-'+_0x190d9c+'/'+_0x143de1)[_0x01fd('0x19')](_0x38c820);}return null;};}function patchUpdates(_0x11f002){return function(_0x4d92c3){try{jsonpatch[_0x01fd('0x1f')](_0x4d92c3,_0x11f002,!![]);}catch(_0x186692){return BPromise[_0x01fd('0x20')](_0x186692);}return _0x4d92c3[_0x01fd('0x21')]();};}function saveUpdates(_0x2f32a9,_0x199cc3){return function(_0x16352f){if(_0x16352f){return _0x16352f[_0x01fd('0x22')](_0x2f32a9)[_0x01fd('0x23')](function(_0x215f63){return _0x215f63;});}return null;};}function removeEntity(_0x43ac0e,_0x31ac9f){return function(_0x3ab947){if(_0x3ab947){return _0x3ab947['destroy']()[_0x01fd('0x23')](function(){_0x43ac0e[_0x01fd('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x558b01,_0x433552){return function(_0x8c5b2e){if(!_0x8c5b2e){_0x558b01[_0x01fd('0x24')](0x194);}return _0x8c5b2e;};}function handleError(_0x56b618,_0x48fd92){_0x48fd92=_0x48fd92||0x1f4;return function(_0x564d14){logger[_0x01fd('0x25')](_0x564d14[_0x01fd('0x26')]);if(_0x564d14[_0x01fd('0x27')]){delete _0x564d14[_0x01fd('0x27')];}_0x56b618[_0x01fd('0x17')](_0x48fd92)[_0x01fd('0x28')](_0x564d14);};}exports[_0x01fd('0x29')]=function(_0x4061a4,_0x571aba){var _0x306e4c={},_0x456f92={},_0x4fa1fb={'count':0x0,'rows':[]};var _0x310333=_[_0x01fd('0x2a')](db[_0x01fd('0x2b')]['rawAttributes'],function(_0xc379b5){return{'name':_0xc379b5['fieldName'],'type':_0xc379b5[_0x01fd('0x2c')]['key']};});_0x456f92[_0x01fd('0x2d')]=_[_0x01fd('0x2a')](_0x310333,_0x01fd('0x27'));_0x456f92[_0x01fd('0x2e')]=_[_0x01fd('0x2f')](_0x4061a4[_0x01fd('0x2e')]);_0x456f92['filters']=_[_0x01fd('0x30')](_0x456f92[_0x01fd('0x2d')],_0x456f92[_0x01fd('0x2e')]);_0x306e4c[_0x01fd('0x31')]=_[_0x01fd('0x30')](_0x456f92[_0x01fd('0x2d')],qs['fields'](_0x4061a4[_0x01fd('0x2e')][_0x01fd('0x32')]));_0x306e4c[_0x01fd('0x31')]=_0x306e4c['attributes']['length']?_0x306e4c['attributes']:_0x456f92[_0x01fd('0x2d')];if(!_0x4061a4['query'][_0x01fd('0x33')](_0x01fd('0x34'))){_0x306e4c[_0x01fd('0x1c')]=qs[_0x01fd('0x1c')](_0x4061a4['query'][_0x01fd('0x1c')]);_0x306e4c['offset']=qs[_0x01fd('0x1b')](_0x4061a4[_0x01fd('0x2e')][_0x01fd('0x1b')]);}_0x306e4c[_0x01fd('0x35')]=qs[_0x01fd('0x36')](_0x4061a4[_0x01fd('0x2e')][_0x01fd('0x36')]);_0x306e4c[_0x01fd('0x37')]=qs[_0x01fd('0x38')](_[_0x01fd('0x39')](_0x4061a4[_0x01fd('0x2e')],_0x456f92[_0x01fd('0x38')]),_0x310333);if(_0x4061a4[_0x01fd('0x2e')][_0x01fd('0x3a')]){_0x306e4c['where']=_['merge'](_0x306e4c['where'],{'$or':_['map'](_0x310333,function(_0x3ed9de){if(_0x3ed9de[_0x01fd('0x2c')]!==_0x01fd('0x3b')){var _0x5ce853={};_0x5ce853[_0x3ed9de[_0x01fd('0x27')]]={'$like':'%'+_0x4061a4[_0x01fd('0x2e')][_0x01fd('0x3a')]+'%'};return _0x5ce853;}})});}_0x306e4c=_[_0x01fd('0x3c')]({},_0x306e4c,_0x4061a4['options']);var _0xba8dd6={'where':_0x306e4c['where']};return db['JscriptySessionReport'][_0x01fd('0x1a')](_0xba8dd6)[_0x01fd('0x23')](function(_0x1e1544){_0x4fa1fb[_0x01fd('0x1a')]=_0x1e1544;if(_0x4061a4[_0x01fd('0x2e')]['includeAll']){_0x306e4c[_0x01fd('0x3d')]=[{'all':!![]}];}return db[_0x01fd('0x2b')][_0x01fd('0x3e')](_0x306e4c);})[_0x01fd('0x23')](function(_0x3bbf4c){_0x4fa1fb[_0x01fd('0x3f')]=_0x3bbf4c;return _0x4fa1fb;})[_0x01fd('0x23')](respondWithFilteredResult(_0x571aba,_0x306e4c))[_0x01fd('0x40')](handleError(_0x571aba,null));};exports[_0x01fd('0x41')]=function(_0x2b5b19,_0x2cd8f5){var _0x3cb331={'raw':!![],'where':{'id':_0x2b5b19[_0x01fd('0x42')]['id']}},_0x14b279={};_0x14b279['model']=_[_0x01fd('0x2f')](db[_0x01fd('0x2b')]['rawAttributes']);_0x14b279[_0x01fd('0x2e')]=_[_0x01fd('0x2f')](_0x2b5b19['query']);_0x14b279[_0x01fd('0x38')]=_[_0x01fd('0x30')](_0x14b279[_0x01fd('0x2d')],_0x14b279[_0x01fd('0x2e')]);_0x3cb331[_0x01fd('0x31')]=_['intersection'](_0x14b279[_0x01fd('0x2d')],qs[_0x01fd('0x32')](_0x2b5b19['query']['fields']));_0x3cb331['attributes']=_0x3cb331[_0x01fd('0x31')][_0x01fd('0x43')]?_0x3cb331[_0x01fd('0x31')]:_0x14b279[_0x01fd('0x2d')];if(_0x2b5b19[_0x01fd('0x2e')][_0x01fd('0x44')]){_0x3cb331['include']=[{'all':!![]}];}_0x3cb331=_[_0x01fd('0x3c')]({},_0x3cb331,_0x2b5b19[_0x01fd('0x45')]);return db['JscriptySessionReport'][_0x01fd('0x46')](_0x3cb331)[_0x01fd('0x23')](handleEntityNotFound(_0x2cd8f5,null))['then'](respondWithResult(_0x2cd8f5,null))['catch'](handleError(_0x2cd8f5,null));};exports[_0x01fd('0x47')]=function(_0x4f8bc6,_0x1f534a){return db[_0x01fd('0x2b')][_0x01fd('0x47')](_0x4f8bc6[_0x01fd('0x48')],{})[_0x01fd('0x23')](respondWithResult(_0x1f534a,0xc9))[_0x01fd('0x40')](handleError(_0x1f534a,null));};exports['update']=function(_0x4a2bff,_0x52ccb4){if(_0x4a2bff[_0x01fd('0x48')]['id']){delete _0x4a2bff[_0x01fd('0x48')]['id'];}return db[_0x01fd('0x2b')][_0x01fd('0x46')]({'where':{'id':_0x4a2bff['params']['id']}})[_0x01fd('0x23')](handleEntityNotFound(_0x52ccb4,null))[_0x01fd('0x23')](saveUpdates(_0x4a2bff['body'],null))[_0x01fd('0x23')](respondWithResult(_0x52ccb4,null))[_0x01fd('0x40')](handleError(_0x52ccb4,null));};exports['destroy']=function(_0x2899cc,_0x36d852){return db[_0x01fd('0x2b')][_0x01fd('0x46')]({'where':{'id':_0x2899cc['params']['id']}})['then'](handleEntityNotFound(_0x36d852,null))['then'](removeEntity(_0x36d852,null))[_0x01fd('0x40')](handleError(_0x36d852,null));};exports[_0x01fd('0x49')]=function(_0x555b98,_0x426969){return db['JscriptySessionReport'][_0x01fd('0x49')]()[_0x01fd('0x23')](respondWithResult(_0x426969,null))[_0x01fd('0x40')](handleError(_0x426969,null));};exports[_0x01fd('0x4a')]=function(_0x851cf9,_0x4175ad,_0x2d7f2e){var _0x1bcfcb={'raw':!![],'where':{}};var _0x5379fa={};var _0x2437d0={'count':0x0,'rows':[]};return db[_0x01fd('0x2b')][_0x01fd('0x4b')]({'where':{'id':_0x851cf9[_0x01fd('0x42')]['id']}})[_0x01fd('0x23')](handleEntityNotFound(_0x4175ad,null))[_0x01fd('0x23')](function(_0x30d222){if(_0x30d222){_0x5379fa['model']=_['keys'](db[_0x01fd('0x4c')]['rawAttributes']);_0x5379fa['query']=_[_0x01fd('0x2f')](_0x851cf9[_0x01fd('0x2e')]);_0x5379fa[_0x01fd('0x38')]=_[_0x01fd('0x30')](_0x5379fa[_0x01fd('0x2d')],_0x5379fa[_0x01fd('0x2e')]);_0x1bcfcb[_0x01fd('0x31')]=_['intersection'](_0x5379fa[_0x01fd('0x2d')],qs['fields'](_0x851cf9[_0x01fd('0x2e')]['fields']));_0x1bcfcb[_0x01fd('0x31')]=_0x1bcfcb[_0x01fd('0x31')][_0x01fd('0x43')]?_0x1bcfcb[_0x01fd('0x31')]:_0x5379fa[_0x01fd('0x2d')];if(!_0x851cf9[_0x01fd('0x2e')][_0x01fd('0x33')](_0x01fd('0x34'))){_0x1bcfcb[_0x01fd('0x1c')]=qs['limit'](_0x851cf9[_0x01fd('0x2e')][_0x01fd('0x1c')]);_0x1bcfcb['offset']=qs[_0x01fd('0x1b')](_0x851cf9[_0x01fd('0x2e')][_0x01fd('0x1b')]);}_0x1bcfcb[_0x01fd('0x35')]=qs[_0x01fd('0x36')](_0x851cf9[_0x01fd('0x2e')][_0x01fd('0x36')]);_0x1bcfcb[_0x01fd('0x37')]=qs['filters'](_[_0x01fd('0x39')](_0x851cf9[_0x01fd('0x2e')],_0x5379fa[_0x01fd('0x38')]));_0x1bcfcb[_0x01fd('0x37')][_0x01fd('0x4d')]=_0x30d222['id'];if(_0x851cf9[_0x01fd('0x2e')][_0x01fd('0x3a')]){_0x1bcfcb[_0x01fd('0x37')]=_[_0x01fd('0x3c')](_0x1bcfcb[_0x01fd('0x37')],{'$or':_[_0x01fd('0x2a')](_0x1bcfcb[_0x01fd('0x31')],function(_0x456b6f){var _0x32ec61={};_0x32ec61[_0x456b6f]={'$like':'%'+_0x851cf9[_0x01fd('0x2e')][_0x01fd('0x3a')]+'%'};return _0x32ec61;})});}_0x1bcfcb=_[_0x01fd('0x3c')]({},_0x1bcfcb,_0x851cf9['options']);return db[_0x01fd('0x4c')][_0x01fd('0x1a')]({'where':_0x1bcfcb[_0x01fd('0x37')]})[_0x01fd('0x23')](function(_0x5039d8){_0x2437d0['count']=_0x5039d8;if(_0x851cf9[_0x01fd('0x2e')][_0x01fd('0x44')]){_0x1bcfcb[_0x01fd('0x3d')]=[{'all':!![]}];}return db[_0x01fd('0x4c')][_0x01fd('0x3e')](_0x1bcfcb);})[_0x01fd('0x23')](function(_0x445cb6){_0x2437d0[_0x01fd('0x3f')]=_0x445cb6;return _0x2437d0;});}})['then'](respondWithFilteredResult(_0x4175ad,_0x1bcfcb))[_0x01fd('0x40')](handleError(_0x4175ad,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index e040ada..35a43ff 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 _0x7b53=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash'];(function(_0x486d7c,_0x25f99d){var _0x2bc318=function(_0x494474){while(--_0x494474){_0x486d7c['push'](_0x486d7c['shift']());}};_0x2bc318(++_0x25f99d);}(_0x7b53,0x1d3));var _0x37b5=function(_0x18a612,_0x3d59a3){_0x18a612=_0x18a612-0x0;var _0x3aa221=_0x7b53[_0x18a612];return _0x3aa221;};'use strict';var _=require(_0x37b5('0x0'));var util=require(_0x37b5('0x1'));var logger=require(_0x37b5('0x2'))('api');var moment=require(_0x37b5('0x3'));var BPromise=require(_0x37b5('0x4'));var rp=require(_0x37b5('0x5'));var fs=require('fs');var path=require(_0x37b5('0x6'));var rimraf=require('rimraf');var config=require(_0x37b5('0x7'));var attributes=require(_0x37b5('0x8'));module[_0x37b5('0x9')]=function(_0x11ceb4,_0x22c3b0){return _0x11ceb4[_0x37b5('0xa')](_0x37b5('0xb'),attributes,{'tableName':_0x37b5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4a6=['../../config/environment','exports','define','JscriptySessionReport','report_jscripty_sessions','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x213273,_0x38d0cc){var _0x4400d9=function(_0x7fed1f){while(--_0x7fed1f){_0x213273['push'](_0x213273['shift']());}};_0x4400d9(++_0x38d0cc);}(_0xb4a6,0xad));var _0x6b4a=function(_0x1eda08,_0x38d31a){_0x1eda08=_0x1eda08-0x0;var _0x100b9e=_0xb4a6[_0x1eda08];return _0x100b9e;};'use strict';var _=require('lodash');var util=require(_0x6b4a('0x0'));var logger=require(_0x6b4a('0x1'))('api');var moment=require(_0x6b4a('0x2'));var BPromise=require(_0x6b4a('0x3'));var rp=require(_0x6b4a('0x4'));var fs=require('fs');var path=require(_0x6b4a('0x5'));var rimraf=require(_0x6b4a('0x6'));var config=require(_0x6b4a('0x7'));var attributes=require('./jscriptySessionReport.attributes');module[_0x6b4a('0x8')]=function(_0x580163,_0xec93c5){return _0x580163[_0x6b4a('0x9')](_0x6b4a('0xa'),attributes,{'tableName':_0x6b4a('0xb'),'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 ddfc004..8ae1f91 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 _0xe0d7=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptySessionReport,\x20%s,\x20%s','message','catch','lodash','bluebird','randomstring'];(function(_0x501ff0,_0xb0d7b2){var _0x573765=function(_0xb1cce6){while(--_0xb1cce6){_0x501ff0['push'](_0x501ff0['shift']());}};_0x573765(++_0xb0d7b2);}(_0xe0d7,0xba));var _0x7e0d=function(_0x150fb8,_0x2e80b9){_0x150fb8=_0x150fb8-0x0;var _0x4cf4fe=_0xe0d7[_0x150fb8];return _0x4cf4fe;};'use strict';var _=require(_0x7e0d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7e0d('0x1'));var rs=require(_0x7e0d('0x2'));var fs=require('fs');var Redis=require(_0x7e0d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e0d('0x4'));var logger=require(_0x7e0d('0x5'))(_0x7e0d('0x6'));var config=require(_0x7e0d('0x7'));var jayson=require(_0x7e0d('0x8'));var client=jayson[_0x7e0d('0x9')][_0x7e0d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a20a3,_0x2a6aa0,_0x174be9){return new BPromise(function(_0x48617b,_0x488796){return client['request'](_0x3a20a3,_0x174be9)[_0x7e0d('0xb')](function(_0x22cfbb){logger[_0x7e0d('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x2a6aa0,_0x7e0d('0xd'));logger[_0x7e0d('0xe')](_0x7e0d('0xf'),_0x2a6aa0,'request\x20sent',JSON['stringify'](_0x22cfbb));if(_0x22cfbb[_0x7e0d('0x10')]){if(_0x22cfbb[_0x7e0d('0x10')][_0x7e0d('0x11')]===0x1f4){logger[_0x7e0d('0x10')](_0x7e0d('0x12'),_0x2a6aa0,_0x22cfbb[_0x7e0d('0x10')]['message']);return _0x488796(_0x22cfbb[_0x7e0d('0x10')]['message']);}logger[_0x7e0d('0x10')](_0x7e0d('0x12'),_0x2a6aa0,_0x22cfbb['error'][_0x7e0d('0x13')]);return _0x48617b(_0x22cfbb[_0x7e0d('0x10')][_0x7e0d('0x13')]);}else{logger[_0x7e0d('0xc')](_0x7e0d('0x12'),_0x2a6aa0,'request\x20sent');_0x48617b(_0x22cfbb['result'][_0x7e0d('0x13')]);}})[_0x7e0d('0x14')](function(_0x16d4e3){logger[_0x7e0d('0x10')](_0x7e0d('0x12'),_0x2a6aa0,_0x16d4e3);_0x488796(_0x16d4e3);});});} \ No newline at end of file +var _0xbb6b=['result','catch','util','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x155af3,_0x4b7f9a){var _0x15a675=function(_0xec0188){while(--_0xec0188){_0x155af3['push'](_0x155af3['shift']());}};_0x15a675(++_0x4b7f9a);}(_0xbb6b,0x17e));var _0xbbb6=function(_0x1606eb,_0x28d213){_0x1606eb=_0x1606eb-0x0;var _0x2ebed7=_0xbb6b[_0x1606eb];return _0x2ebed7;};'use strict';var _=require('lodash');var util=require(_0xbbb6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbbb6('0x1'));var db=require(_0xbbb6('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xbbb6('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbbb6('0x4'));var client=jayson[_0xbbb6('0x5')][_0xbbb6('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x77be32,_0x5bb1b5,_0x49b89c){return new BPromise(function(_0x553a59,_0x3d2160){return client[_0xbbb6('0x7')](_0x77be32,_0x49b89c)[_0xbbb6('0x8')](function(_0x3db836){logger[_0xbbb6('0x9')](_0xbbb6('0xa'),_0x5bb1b5,_0xbbb6('0xb'));logger[_0xbbb6('0xc')](_0xbbb6('0xd'),_0x5bb1b5,_0xbbb6('0xb'),JSON[_0xbbb6('0xe')](_0x3db836));if(_0x3db836[_0xbbb6('0xf')]){if(_0x3db836[_0xbbb6('0xf')][_0xbbb6('0x10')]===0x1f4){logger[_0xbbb6('0xf')](_0xbbb6('0xa'),_0x5bb1b5,_0x3db836[_0xbbb6('0xf')]['message']);return _0x3d2160(_0x3db836[_0xbbb6('0xf')][_0xbbb6('0x11')]);}logger[_0xbbb6('0xf')](_0xbbb6('0xa'),_0x5bb1b5,_0x3db836[_0xbbb6('0xf')][_0xbbb6('0x11')]);return _0x553a59(_0x3db836[_0xbbb6('0xf')][_0xbbb6('0x11')]);}else{logger[_0xbbb6('0x9')](_0xbbb6('0xa'),_0x5bb1b5,'request\x20sent');_0x553a59(_0x3db836[_0xbbb6('0x12')][_0xbbb6('0x11')]);}})[_0xbbb6('0x13')](function(_0x5b069e){logger[_0xbbb6('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x5bb1b5,_0x5b069e);_0x3d2160(_0x5b069e);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index b6ce2bf..57fa47e 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 _0xd9df=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','index','put','isAuthenticated','update','multer','util','path','connect-timeout'];(function(_0x2357f4,_0x233d9c){var _0x3fa9f0=function(_0x2178ed){while(--_0x2178ed){_0x2357f4['push'](_0x2357f4['shift']());}};_0x3fa9f0(++_0x233d9c);}(_0xd9df,0x1b6));var _0xfd9d=function(_0x433828,_0x11f959){_0x433828=_0x433828-0x0;var _0x3ee135=_0xd9df[_0x433828];return _0x3ee135;};'use strict';var multer=require(_0xfd9d('0x0'));var util=require(_0xfd9d('0x1'));var path=require(_0xfd9d('0x2'));var timeout=require(_0xfd9d('0x3'));var express=require(_0xfd9d('0x4'));var router=express['Router']();var auth=require(_0xfd9d('0x5'));var interaction=require(_0xfd9d('0x6'));var config=require(_0xfd9d('0x7'));var controller=require(_0xfd9d('0x8'));router['get']('/',controller[_0xfd9d('0x9')]);router[_0xfd9d('0xa')]('/:id',auth[_0xfd9d('0xb')](),controller[_0xfd9d('0xc')]);module['exports']=router; \ No newline at end of file +var _0xd201=['express','../../components/interaction/service','../../config/environment','./license.controller','put','/:id','update','exports','multer','util','path','connect-timeout'];(function(_0x147bd4,_0x341e6d){var _0x54126c=function(_0x273bfd){while(--_0x273bfd){_0x147bd4['push'](_0x147bd4['shift']());}};_0x54126c(++_0x341e6d);}(_0xd201,0x11c));var _0x1d20=function(_0x3d4a2b,_0xca71a8){_0x3d4a2b=_0x3d4a2b-0x0;var _0x5c55c6=_0xd201[_0x3d4a2b];return _0x5c55c6;};'use strict';var multer=require(_0x1d20('0x0'));var util=require(_0x1d20('0x1'));var path=require(_0x1d20('0x2'));var timeout=require(_0x1d20('0x3'));var express=require(_0x1d20('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x1d20('0x5'));var config=require(_0x1d20('0x6'));var controller=require(_0x1d20('0x7'));router['get']('/',controller['index']);router[_0x1d20('0x8')](_0x1d20('0x9'),auth['isAuthenticated'](),controller[_0x1d20('0xa')]);module[_0x1d20('0xb')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index a64b4ed..bb9846b 100644 --- a/server/api/license/license.attributes.js +++ b/server/api/license/license.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x46ed=['sequelize','exports','STRING','INTEGER'];(function(_0x4e0026,_0x2b52b6){var _0x3f8ee7=function(_0x31d891){while(--_0x31d891){_0x4e0026['push'](_0x4e0026['shift']());}};_0x3f8ee7(++_0x2b52b6);}(_0x46ed,0x168));var _0xd46e=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x46ed[_0x1928c9];return _0x51b5fb;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xd46e('0x2')]},'data2':{'type':Sequelize[_0xd46e('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xd46e('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdbf5=['exports','STRING','INTEGER'];(function(_0x59947d,_0x27ad58){var _0x4b59e0=function(_0x3f996a){while(--_0x3f996a){_0x59947d['push'](_0x59947d['shift']());}};_0x4b59e0(++_0x27ad58);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x44276f,_0x408265){_0x44276f=_0x44276f-0x0;var _0x93fec4=_0xdbf5[_0x44276f];return _0x93fec4;};'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 diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 6276ff9..8341559 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 _0x304b=['body','find','params','get','checkLicense','key','demo','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','limit','set','Content-Range','reject','update','then','destroy','sendStatus','error','name','../../config/license/util','index','model','keys','License','rawAttributes','query','filters','fields','attributes','merge','options','getLicense','catch'];(function(_0x34533,_0x531aeb){var _0x5810ff=function(_0x478ff1){while(--_0x478ff1){_0x34533['push'](_0x34533['shift']());}};_0x5810ff(++_0x531aeb);}(_0x304b,0xfb));var _0xb304=function(_0x39d679,_0x480358){_0x39d679=_0x39d679-0x0;var _0x2e1439=_0x304b[_0x39d679];return _0x2e1439;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb304('0x0'));var rimraf=require(_0xb304('0x1'));var zipdir=require(_0xb304('0x2'));var jsonpatch=require(_0xb304('0x3'));var rp=require(_0xb304('0x4'));var moment=require(_0xb304('0x5'));var BPromise=require(_0xb304('0x6'));var Mustache=require(_0xb304('0x7'));var util=require('util');var path=require('path');var sox=require(_0xb304('0x8'));var csv=require(_0xb304('0x9'));var ejs=require(_0xb304('0xa'));var fs=require('fs');var _=require(_0xb304('0xb'));var squel=require(_0xb304('0xc'));var crypto=require(_0xb304('0xd'));var jsforce=require(_0xb304('0xe'));var deskjs=require(_0xb304('0xf'));var toCsv=require(_0xb304('0x9'));var querystring=require('querystring');var Papa=require(_0xb304('0x10'));var Redis=require(_0xb304('0x11'));var authService=require(_0xb304('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb304('0x13'));var hardwareService=require(_0xb304('0x14'));var logger=require(_0xb304('0x15'))(_0xb304('0x16'));var utils=require(_0xb304('0x17'));var config=require(_0xb304('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb304('0x19'))['db'];function respondWithStatusCode(_0x1f4ddb,_0x2f8cae){_0x2f8cae=_0x2f8cae||0xcc;return function(_0x743f7d){if(_0x743f7d){return _0x1f4ddb['sendStatus'](_0x2f8cae);}return _0x1f4ddb[_0xb304('0x1a')](_0x2f8cae)[_0xb304('0x1b')]();};}function respondWithResult(_0x733030,_0x44b7a7){_0x44b7a7=_0x44b7a7||0xc8;return function(_0x1ba608){if(_0x1ba608){return _0x733030[_0xb304('0x1a')](_0x44b7a7)[_0xb304('0x1c')](_0x1ba608);}};}function respondWithFilteredResult(_0x1a15c9,_0x218d92){return function(_0x22ac4b){if(_0x22ac4b){var _0x3d20b5=_0x22ac4b[_0xb304('0x1d')],_0x3be8cb=_0x218d92['offset'],_0x1252cb=_0x218d92['offset']+_0x218d92[_0xb304('0x1e')],_0x5867c0;if(_0x1252cb>=_0x3d20b5){_0x1252cb=_0x3d20b5;_0x5867c0=0xc8;}else{_0x5867c0=0xce;}_0x1a15c9[_0xb304('0x1a')](_0x5867c0);return _0x1a15c9[_0xb304('0x1f')](_0xb304('0x20'),_0x3be8cb+'-'+_0x1252cb+'/'+_0x3d20b5)[_0xb304('0x1c')](_0x22ac4b);}return null;};}function patchUpdates(_0x57fe0e){return function(_0x272b37){try{jsonpatch['apply'](_0x272b37,_0x57fe0e,!![]);}catch(_0x4318b3){return BPromise[_0xb304('0x21')](_0x4318b3);}return _0x272b37['save']();};}function saveUpdates(_0x49d49e,_0x586394){return function(_0x30c5ec){if(_0x30c5ec){return _0x30c5ec[_0xb304('0x22')](_0x49d49e)[_0xb304('0x23')](function(_0x3eb360){return _0x3eb360;});}return null;};}function removeEntity(_0x5cf81a,_0x218b9d){return function(_0x3694c4){if(_0x3694c4){return _0x3694c4[_0xb304('0x24')]()[_0xb304('0x23')](function(){_0x5cf81a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ab7ed,_0x2fd41b){return function(_0x4a16eb){if(!_0x4a16eb){_0x4ab7ed[_0xb304('0x25')](0x194);}return _0x4a16eb;};}function handleError(_0x5e2e5b,_0x19347f){_0x19347f=_0x19347f||0x1f4;return function(_0x148f48){logger[_0xb304('0x26')](_0x148f48['stack']);if(_0x148f48[_0xb304('0x27')]){delete _0x148f48['name'];}_0x5e2e5b[_0xb304('0x1a')](_0x19347f)['send'](_0x148f48);};}var utilLicense=require(_0xb304('0x28'));exports[_0xb304('0x29')]=function(_0x58971a,_0x57d706){var _0x368a0d={'raw':!![],'where':{'id':0x1}},_0x25e77b={};_0x25e77b[_0xb304('0x2a')]=_[_0xb304('0x2b')](db[_0xb304('0x2c')][_0xb304('0x2d')]);_0x25e77b[_0xb304('0x2e')]=_[_0xb304('0x2b')](_0x58971a[_0xb304('0x2e')]);_0x25e77b[_0xb304('0x2f')]=_['intersection'](_0x25e77b[_0xb304('0x2a')],_0x25e77b[_0xb304('0x2e')]);_0x368a0d['attributes']=_['intersection'](_0x25e77b[_0xb304('0x2a')],qs[_0xb304('0x30')](_0x58971a[_0xb304('0x2e')]['fields']));_0x368a0d[_0xb304('0x31')]=_0x368a0d[_0xb304('0x31')]['length']?_0x368a0d[_0xb304('0x31')]:_0x25e77b[_0xb304('0x2a')];_0x368a0d=_[_0xb304('0x32')]({},_0x368a0d,_0x58971a[_0xb304('0x33')]);return utilLicense[_0xb304('0x34')](_0x368a0d)['then'](respondWithResult(_0x57d706,null))[_0xb304('0x35')](handleError(_0x57d706,null));};exports[_0xb304('0x22')]=function(_0x457396,_0x2d3c8a){if(_0x457396[_0xb304('0x36')]['id']){delete _0x457396[_0xb304('0x36')]['id'];}return db[_0xb304('0x2c')][_0xb304('0x37')]({'where':{'id':_0x457396[_0xb304('0x38')]['id']}})[_0xb304('0x23')](handleEntityNotFound(_0x2d3c8a,null))[_0xb304('0x23')](function(_0x224285){var _0x8652ac=_0x224285[_0xb304('0x39')]({'plain':!![]});return utilLicense[_0xb304('0x3a')](_0x8652ac,_0x457396[_0xb304('0x36')][_0xb304('0x3b')]);})[_0xb304('0x23')](function(_0x5eec08){if(!_0x5eec08[_0xb304('0x3c')]){return saveUpdates(_0x457396[_0xb304('0x36')],null);}return _0x5eec08;})['then'](respondWithResult(_0x2d3c8a,null))[_0xb304('0x35')](handleError(_0x2d3c8a,null));}; \ No newline at end of file +var _0xbeea=['to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','end','sendStatus','error','stack','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','fields','attributes','length','getLicense','then','catch','body','find','params','get','checkLicense','key','demo','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xbeea,0xb1));var _0xabee=function(_0x211b01,_0x4f0e5d){_0x211b01=_0x211b01-0x0;var _0x36250f=_0xbeea[_0x211b01];return _0x36250f;};'use strict';var pdf=require(_0xabee('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xabee('0x1'));var zipdir=require(_0xabee('0x2'));var jsonpatch=require(_0xabee('0x3'));var rp=require('request-promise');var moment=require(_0xabee('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xabee('0x5'));var util=require(_0xabee('0x6'));var path=require(_0xabee('0x7'));var sox=require(_0xabee('0x8'));var csv=require(_0xabee('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xabee('0xa'));var crypto=require(_0xabee('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xabee('0xc'));var toCsv=require('to-csv');var querystring=require(_0xabee('0xd'));var Papa=require(_0xabee('0xe'));var Redis=require(_0xabee('0xf'));var authService=require(_0xabee('0x10'));var qs=require(_0xabee('0x11'));var as=require(_0xabee('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xabee('0x13'))(_0xabee('0x14'));var utils=require(_0xabee('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xabee('0x16'));var db=require(_0xabee('0x17'))['db'];function respondWithStatusCode(_0x16d6a5,_0x49fb73){_0x49fb73=_0x49fb73||0xcc;return function(_0x5915a1){if(_0x5915a1){return _0x16d6a5['sendStatus'](_0x49fb73);}return _0x16d6a5['status'](_0x49fb73)['end']();};}function respondWithResult(_0x113c5c,_0x370a4e){_0x370a4e=_0x370a4e||0xc8;return function(_0x38ba29){if(_0x38ba29){return _0x113c5c[_0xabee('0x18')](_0x370a4e)[_0xabee('0x19')](_0x38ba29);}};}function respondWithFilteredResult(_0x5e94ff,_0x177670){return function(_0x2d85a4){if(_0x2d85a4){var _0x2f1107=_0x2d85a4[_0xabee('0x1a')],_0x22b765=_0x177670['offset'],_0x1a3d27=_0x177670[_0xabee('0x1b')]+_0x177670[_0xabee('0x1c')],_0x2d6e69;if(_0x1a3d27>=_0x2f1107){_0x1a3d27=_0x2f1107;_0x2d6e69=0xc8;}else{_0x2d6e69=0xce;}_0x5e94ff[_0xabee('0x18')](_0x2d6e69);return _0x5e94ff[_0xabee('0x1d')](_0xabee('0x1e'),_0x22b765+'-'+_0x1a3d27+'/'+_0x2f1107)[_0xabee('0x19')](_0x2d85a4);}return null;};}function patchUpdates(_0x4797e9){return function(_0x47fa3f){try{jsonpatch[_0xabee('0x1f')](_0x47fa3f,_0x4797e9,!![]);}catch(_0x593923){return BPromise['reject'](_0x593923);}return _0x47fa3f[_0xabee('0x20')]();};}function saveUpdates(_0x443301,_0x3dd1ff){return function(_0x21ff03){if(_0x21ff03){return _0x21ff03[_0xabee('0x21')](_0x443301)['then'](function(_0x37d2bf){return _0x37d2bf;});}return null;};}function removeEntity(_0x54014d,_0x4f5501){return function(_0x4926d7){if(_0x4926d7){return _0x4926d7[_0xabee('0x22')]()['then'](function(){_0x54014d[_0xabee('0x18')](0xcc)[_0xabee('0x23')]();});}};}function handleEntityNotFound(_0x520bc,_0x15a36c){return function(_0x94b3cf){if(!_0x94b3cf){_0x520bc[_0xabee('0x24')](0x194);}return _0x94b3cf;};}function handleError(_0x11a1d5,_0x519f28){_0x519f28=_0x519f28||0x1f4;return function(_0xdbbf57){logger[_0xabee('0x25')](_0xdbbf57[_0xabee('0x26')]);if(_0xdbbf57[_0xabee('0x27')]){delete _0xdbbf57['name'];}_0x11a1d5[_0xabee('0x18')](_0x519f28)[_0xabee('0x28')](_0xdbbf57);};}var utilLicense=require('../../config/license/util');exports[_0xabee('0x29')]=function(_0x232144,_0x7237a9){var _0x26a5d1={'raw':!![],'where':{'id':0x1}},_0x596f23={};_0x596f23[_0xabee('0x2a')]=_[_0xabee('0x2b')](db[_0xabee('0x2c')][_0xabee('0x2d')]);_0x596f23[_0xabee('0x2e')]=_[_0xabee('0x2b')](_0x232144[_0xabee('0x2e')]);_0x596f23[_0xabee('0x2f')]=_[_0xabee('0x30')](_0x596f23['model'],_0x596f23[_0xabee('0x2e')]);_0x26a5d1['attributes']=_[_0xabee('0x30')](_0x596f23[_0xabee('0x2a')],qs[_0xabee('0x31')](_0x232144[_0xabee('0x2e')]['fields']));_0x26a5d1[_0xabee('0x32')]=_0x26a5d1['attributes'][_0xabee('0x33')]?_0x26a5d1['attributes']:_0x596f23[_0xabee('0x2a')];_0x26a5d1=_['merge']({},_0x26a5d1,_0x232144['options']);return utilLicense[_0xabee('0x34')](_0x26a5d1)[_0xabee('0x35')](respondWithResult(_0x7237a9,null))[_0xabee('0x36')](handleError(_0x7237a9,null));};exports[_0xabee('0x21')]=function(_0x42e434,_0xaefbc3){if(_0x42e434[_0xabee('0x37')]['id']){delete _0x42e434[_0xabee('0x37')]['id'];}return db['License'][_0xabee('0x38')]({'where':{'id':_0x42e434[_0xabee('0x39')]['id']}})[_0xabee('0x35')](handleEntityNotFound(_0xaefbc3,null))[_0xabee('0x35')](function(_0x146ae9){var _0x77c942=_0x146ae9[_0xabee('0x3a')]({'plain':!![]});return utilLicense[_0xabee('0x3b')](_0x77c942,_0x42e434[_0xabee('0x37')][_0xabee('0x3c')]);})[_0xabee('0x35')](function(_0x3112fd){if(!_0x3112fd[_0xabee('0x3d')]){return saveUpdates(_0x42e434[_0xabee('0x37')],null);}return _0x3112fd;})[_0xabee('0x35')](respondWithResult(_0xaefbc3,null))[_0xabee('0x36')](handleError(_0xaefbc3,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index ae7df29..700b4d8 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 _0xcfe5=['license','lodash','util','request-promise','rimraf','../../config/environment','./license.attributes','define'];(function(_0x59f1f5,_0x439d77){var _0x448ea4=function(_0x241715){while(--_0x241715){_0x59f1f5['push'](_0x59f1f5['shift']());}};_0x448ea4(++_0x439d77);}(_0xcfe5,0x1c9));var _0x5cfe=function(_0x345ac8,_0x2daa49){_0x345ac8=_0x345ac8-0x0;var _0x552f86=_0xcfe5[_0x345ac8];return _0x552f86;};'use strict';var _=require(_0x5cfe('0x0'));var util=require(_0x5cfe('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5cfe('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5cfe('0x3'));var config=require(_0x5cfe('0x4'));var attributes=require(_0x5cfe('0x5'));module['exports']=function(_0x26bdda,_0x4a33f0){return _0x26bdda[_0x5cfe('0x6')]('License',attributes,{'tableName':_0x5cfe('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb68=['request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','util','../../config/logger','api','moment'];(function(_0x2c1841,_0x505204){var _0x28d148=function(_0x5be79f){while(--_0x5be79f){_0x2c1841['push'](_0x2c1841['shift']());}};_0x28d148(++_0x505204);}(_0xcb68,0x104));var _0x8cb6=function(_0x303e70,_0x5ac7ad){_0x303e70=_0x303e70-0x0;var _0x22dcea=_0xcb68[_0x303e70];return _0x22dcea;};'use strict';var _=require('lodash');var util=require(_0x8cb6('0x0'));var logger=require(_0x8cb6('0x1'))(_0x8cb6('0x2'));var moment=require(_0x8cb6('0x3'));var BPromise=require('bluebird');var rp=require(_0x8cb6('0x4'));var fs=require('fs');var path=require(_0x8cb6('0x5'));var rimraf=require(_0x8cb6('0x6'));var config=require(_0x8cb6('0x7'));var attributes=require(_0x8cb6('0x8'));module[_0x8cb6('0x9')]=function(_0x39a3ed,_0x19ca09){return _0x39a3ed[_0x8cb6('0xa')]('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 2b324b1..c1532a5 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 _0xfd6f=['../../config/logger','rpc','jayson/promise','client','http','then','info','License,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x5d3056,_0x33058e){var _0x3e599a=function(_0x4e3f9c){while(--_0x4e3f9c){_0x5d3056['push'](_0x5d3056['shift']());}};_0x3e599a(++_0x33058e);}(_0xfd6f,0x19d));var _0xffd6=function(_0x1a3a77,_0x39137e){_0x1a3a77=_0x1a3a77-0x0;var _0x5bac4e=_0xfd6f[_0x1a3a77];return _0x5bac4e;};'use strict';var _=require(_0xffd6('0x0'));var util=require(_0xffd6('0x1'));var moment=require(_0xffd6('0x2'));var BPromise=require(_0xffd6('0x3'));var rs=require(_0xffd6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xffd6('0x5'))['db'];var utils=require(_0xffd6('0x6'));var logger=require(_0xffd6('0x7'))(_0xffd6('0x8'));var config=require('../../config/environment');var jayson=require(_0xffd6('0x9'));var client=jayson[_0xffd6('0xa')][_0xffd6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10b335,_0x5c19ee,_0x3f9538){return new BPromise(function(_0x534a1b,_0x54d793){return client['request'](_0x10b335,_0x3f9538)[_0xffd6('0xc')](function(_0x4267fc){logger[_0xffd6('0xd')](_0xffd6('0xe'),_0x5c19ee,'request\x20sent');logger[_0xffd6('0xf')]('License,\x20%s,\x20%s,\x20%s',_0x5c19ee,'request\x20sent',JSON[_0xffd6('0x10')](_0x4267fc));if(_0x4267fc[_0xffd6('0x11')]){if(_0x4267fc[_0xffd6('0x11')]['code']===0x1f4){logger[_0xffd6('0x11')](_0xffd6('0xe'),_0x5c19ee,_0x4267fc['error'][_0xffd6('0x12')]);return _0x54d793(_0x4267fc[_0xffd6('0x11')][_0xffd6('0x12')]);}logger[_0xffd6('0x11')]('License,\x20%s,\x20%s',_0x5c19ee,_0x4267fc['error'][_0xffd6('0x12')]);return _0x534a1b(_0x4267fc[_0xffd6('0x11')][_0xffd6('0x12')]);}else{logger['info'](_0xffd6('0xe'),_0x5c19ee,_0xffd6('0x13'));_0x534a1b(_0x4267fc['result'][_0xffd6('0x12')]);}})['catch'](function(_0x1881a1){logger[_0xffd6('0x11')](_0xffd6('0xe'),_0x5c19ee,_0x1881a1);_0x54d793(_0x1881a1);});});} \ No newline at end of file +var _0x7b37=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird'];(function(_0x3add10,_0x457d16){var _0x2da348=function(_0x1fcaa9){while(--_0x1fcaa9){_0x3add10['push'](_0x3add10['shift']());}};_0x2da348(++_0x457d16);}(_0x7b37,0xd9));var _0x77b3=function(_0x2ea725,_0x429ede){_0x2ea725=_0x2ea725-0x0;var _0x33fb61=_0x7b37[_0x2ea725];return _0x33fb61;};'use strict';var _=require(_0x77b3('0x0'));var util=require(_0x77b3('0x1'));var moment=require('moment');var BPromise=require(_0x77b3('0x2'));var rs=require(_0x77b3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x77b3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x77b3('0x5'))(_0x77b3('0x6'));var config=require(_0x77b3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x77b3('0x8')][_0x77b3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x515f06,_0x49aded,_0x2f896b){return new BPromise(function(_0x5b3fb4,_0x35becb){return client[_0x77b3('0xa')](_0x515f06,_0x2f896b)['then'](function(_0x46dc45){logger[_0x77b3('0xb')](_0x77b3('0xc'),_0x49aded,_0x77b3('0xd'));logger[_0x77b3('0xe')](_0x77b3('0xf'),_0x49aded,_0x77b3('0xd'),JSON[_0x77b3('0x10')](_0x46dc45));if(_0x46dc45[_0x77b3('0x11')]){if(_0x46dc45[_0x77b3('0x11')]['code']===0x1f4){logger[_0x77b3('0x11')](_0x77b3('0xc'),_0x49aded,_0x46dc45[_0x77b3('0x11')][_0x77b3('0x12')]);return _0x35becb(_0x46dc45[_0x77b3('0x11')][_0x77b3('0x12')]);}logger[_0x77b3('0x11')](_0x77b3('0xc'),_0x49aded,_0x46dc45[_0x77b3('0x11')][_0x77b3('0x12')]);return _0x5b3fb4(_0x46dc45[_0x77b3('0x11')][_0x77b3('0x12')]);}else{logger['info'](_0x77b3('0xc'),_0x49aded,_0x77b3('0xd'));_0x5b3fb4(_0x46dc45[_0x77b3('0x13')][_0x77b3('0x12')]);}})['catch'](function(_0x224303){logger['error']('License,\x20%s,\x20%s',_0x49aded,_0x224303);_0x35becb(_0x224303);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 8de14bc..e1dc46a 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 _0x0a1c=['getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','/:id/applications','addApplications','send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','removeAgents','exports','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0a1c,0xd2));var _0xc0a1=function(_0x34bc6c,_0x10d089){_0x34bc6c=_0x34bc6c-0x0;var _0x168820=_0x0a1c[_0x34bc6c];return _0x168820;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc0a1('0x0'));var timeout=require(_0xc0a1('0x1'));var express=require(_0xc0a1('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc0a1('0x3'));var config=require(_0xc0a1('0x4'));var controller=require(_0xc0a1('0x5'));router[_0xc0a1('0x6')]('/',auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x8')]);router[_0xc0a1('0x6')](_0xc0a1('0x9'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0xa')]);router[_0xc0a1('0x6')](_0xc0a1('0xb'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0xc')]);router[_0xc0a1('0x6')](_0xc0a1('0xd'),auth[_0xc0a1('0x7')](),controller['getDispositions']);router[_0xc0a1('0x6')](_0xc0a1('0xe'),auth[_0xc0a1('0x7')](),controller['getAnswers']);router[_0xc0a1('0x6')](_0xc0a1('0xf'),auth[_0xc0a1('0x7')](),controller['getImap']);router[_0xc0a1('0x6')](_0xc0a1('0x10'),auth['isAuthenticated'](),controller[_0xc0a1('0x11')]);router[_0xc0a1('0x6')](_0xc0a1('0x12'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x13')]);router['get']('/:id/applications',auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x14')]);router['get']('/:id/messages',auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x15')]);router['get'](_0xc0a1('0x16'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x17')]);router[_0xc0a1('0x6')](_0xc0a1('0x18'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x19')]);router[_0xc0a1('0x1a')](_0xc0a1('0xd'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x1b')]);router[_0xc0a1('0x1a')](_0xc0a1('0xe'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x1c')]);router[_0xc0a1('0x1a')]('/',auth['isAuthenticated'](),controller[_0xc0a1('0x1d')]);router['post'](_0xc0a1('0xf'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x1e')]);router[_0xc0a1('0x1a')](_0xc0a1('0x10'),auth['isAuthenticated'](),controller[_0xc0a1('0x1f')]);router[_0xc0a1('0x1a')](_0xc0a1('0x12'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x20')]);router[_0xc0a1('0x1a')](_0xc0a1('0x21'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x22')]);router[_0xc0a1('0x1a')]('/:id/send',auth['isAuthenticated'](),controller[_0xc0a1('0x23')]);router[_0xc0a1('0x1a')]('/:id/users',auth['isAuthenticated'](),controller[_0xc0a1('0x24')]);router[_0xc0a1('0x25')]('/:id',auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x26')]);router[_0xc0a1('0x27')](_0xc0a1('0xd'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x28')]);router[_0xc0a1('0x27')](_0xc0a1('0xe'),auth['isAuthenticated'](),controller[_0xc0a1('0x29')]);router[_0xc0a1('0x27')](_0xc0a1('0xf'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x2a')]);router[_0xc0a1('0x27')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0xc0a1('0x2b')]);router[_0xc0a1('0x27')]('/:id',auth[_0xc0a1('0x7')](),controller['destroy']);router[_0xc0a1('0x27')]('/:id/users',auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x2c')]);module[_0xc0a1('0x2d')]=router; \ No newline at end of file +var _0x31b9=['/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions','/:id/applications','verifySmtp','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','send','/:id/users','addAgents','update','removeDispositions','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x23d51a,_0x55b7c0){var _0x2e114a=function(_0x590275){while(--_0x590275){_0x23d51a['push'](_0x23d51a['shift']());}};_0x2e114a(++_0x55b7c0);}(_0x31b9,0x7c));var _0x931b=function(_0x1a5d03,_0x41bbe0){_0x1a5d03=_0x1a5d03-0x0;var _0x360e52=_0x31b9[_0x1a5d03];return _0x360e52;};'use strict';var multer=require(_0x931b('0x0'));var util=require(_0x931b('0x1'));var path=require('path');var timeout=require(_0x931b('0x2'));var express=require(_0x931b('0x3'));var router=express[_0x931b('0x4')]();var auth=require(_0x931b('0x5'));var interaction=require(_0x931b('0x6'));var config=require(_0x931b('0x7'));var controller=require('./mailAccount.controller');router[_0x931b('0x8')]('/',auth[_0x931b('0x9')](),controller[_0x931b('0xa')]);router[_0x931b('0x8')](_0x931b('0xb'),auth[_0x931b('0x9')](),controller[_0x931b('0xc')]);router['get'](_0x931b('0xd'),auth[_0x931b('0x9')](),controller[_0x931b('0xe')]);router[_0x931b('0x8')](_0x931b('0xf'),auth[_0x931b('0x9')](),controller[_0x931b('0x10')]);router[_0x931b('0x8')](_0x931b('0x11'),auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x931b('0x12'),auth[_0x931b('0x9')](),controller[_0x931b('0x13')]);router[_0x931b('0x8')](_0x931b('0x14'),auth[_0x931b('0x9')](),controller['getSmtp']);router[_0x931b('0x8')](_0x931b('0x15'),auth['isAuthenticated'](),controller[_0x931b('0x16')]);router[_0x931b('0x8')](_0x931b('0x17'),auth['isAuthenticated'](),controller['getApplications']);router['get']('/:id/messages',auth[_0x931b('0x9')](),controller['getMessages']);router['get']('/:id/verify',auth[_0x931b('0x9')](),controller[_0x931b('0x18')]);router[_0x931b('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x931b('0x19')]);router[_0x931b('0x1a')]('/:id/dispositions',auth[_0x931b('0x9')](),controller[_0x931b('0x1b')]);router[_0x931b('0x1a')](_0x931b('0x11'),auth[_0x931b('0x9')](),controller[_0x931b('0x1c')]);router[_0x931b('0x1a')]('/',auth['isAuthenticated'](),controller[_0x931b('0x1d')]);router['post'](_0x931b('0x12'),auth[_0x931b('0x9')](),controller[_0x931b('0x1e')]);router['post'](_0x931b('0x14'),auth[_0x931b('0x9')](),controller[_0x931b('0x1f')]);router[_0x931b('0x1a')](_0x931b('0x15'),auth['isAuthenticated'](),controller[_0x931b('0x20')]);router[_0x931b('0x1a')](_0x931b('0x17'),auth[_0x931b('0x9')](),controller[_0x931b('0x21')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x931b('0x22')]);router[_0x931b('0x1a')](_0x931b('0x23'),auth[_0x931b('0x9')](),controller[_0x931b('0x24')]);router['put']('/:id',auth[_0x931b('0x9')](),controller[_0x931b('0x25')]);router['delete']('/:id/dispositions',auth[_0x931b('0x9')](),controller[_0x931b('0x26')]);router[_0x931b('0x27')](_0x931b('0x11'),auth[_0x931b('0x9')](),controller[_0x931b('0x28')]);router[_0x931b('0x27')](_0x931b('0x12'),auth[_0x931b('0x9')](),controller[_0x931b('0x29')]);router[_0x931b('0x27')]('/:id/out_servers',auth[_0x931b('0x9')](),controller[_0x931b('0x2a')]);router['delete'](_0x931b('0xd'),auth[_0x931b('0x9')](),controller[_0x931b('0x2b')]);router[_0x931b('0x27')]('/:id/users',auth[_0x931b('0x9')](),controller[_0x931b('0x2c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index bc9d395..f23b69a 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 _0xbad2=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x292f93,_0x2c6e8e){var _0x5a94b1=function(_0x25735e){while(--_0x25735e){_0x292f93['push'](_0x292f93['shift']());}};_0x5a94b1(++_0x2c6e8e);}(_0xbad2,0x12e));var _0x2bad=function(_0x55d5fd,_0x2b1d70){_0x55d5fd=_0x55d5fd-0x0;var _0x429289=_0xbad2[_0x55d5fd];return _0x429289;};'use strict';var Sequelize=require(_0x2bad('0x0'));module[_0x2bad('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x2bad('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x2bad('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x2bad('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x2bad('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x2bad('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x2bad('0x2')],'allowNull':![],'defaultValue':_0x2bad('0x4')},'fontSize':{'type':Sequelize[_0x2bad('0x5')](0x2)[_0x2bad('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x2bad('0x7')],'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['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2bad('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2bad('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2bad('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2bad('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2bad('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2bad('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x2bad('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x2bad('0x3')],'defaultValue':![],'comment':_0x2bad('0x9'),'set':function(_0x1dc1a4){if(!_0x1dc1a4)this[_0x2bad('0xa')](_0x2bad('0xb'),null);this[_0x2bad('0xa')](_0x2bad('0xc'),_0x1dc1a4);}}}; \ No newline at end of file +var _0xdaf4=['setDataValue','sequelize','exports','STRING','BOOLEAN','TEXT','INTEGER','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'];(function(_0x4476d8,_0x15a5c4){var _0xb57275=function(_0x16b964){while(--_0x16b964){_0x4476d8['push'](_0x4476d8['shift']());}};_0xb57275(++_0x15a5c4);}(_0xdaf4,0x6f));var _0x4daf=function(_0x4fdcc0,_0x560a01){_0x4fdcc0=_0x4fdcc0-0x0;var _0xc0ce94=_0xdaf4[_0x4fdcc0];return _0xc0ce94;};'use strict';var Sequelize=require(_0x4daf('0x0'));module[_0x4daf('0x1')]={'description':{'type':Sequelize[_0x4daf('0x2')]},'name':{'type':Sequelize[_0x4daf('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x4daf('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x4daf('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x4daf('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x4daf('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x4daf('0x4')]},'markAsUnread':{'type':Sequelize[_0x4daf('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x4daf('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x4daf('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x4daf('0x6');}},'notificationSound':{'type':Sequelize[_0x4daf('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4daf('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4daf('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4daf('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4daf('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4daf('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x4daf('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x4daf('0x3')],'defaultValue':![],'comment':_0x4daf('0x8'),'set':function(_0x163ca6){if(!_0x163ca6)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x4daf('0x9')]('mandatoryDisposition',_0x163ca6);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index ce62313..0b93c92 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 _0x55a2=['request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','limit','Content-Range','json','apply','reject','update','get','UserProfileResource','stack','name','send','index','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filter','merge','options','includeAll','findAll','params','MailServerIn','include','find','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','order','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','key','email','ListId','isNil','cauthentication','user','cuser','password','pass','authentication','host','port','service','cservice','cpassword','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailAccounts','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','MailInteraction','CmContact','Contact','Owner','fullname','internal','Tag','color','tag','addApplications','transaction','destroy','MailApplication','bulkCreate','findAndCountAll','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','updatedAt','DESC','from','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List','Contacts','List\x20not\x20found','messageId','subject','out','Messages','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','User','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','defaults','redis','localhost','./mailAccount.socket','client','http'];(function(_0x2d873a,_0x4656a0){var _0x4e45b9=function(_0x4b331a){while(--_0x4b331a){_0x2d873a['push'](_0x2d873a['shift']());}};_0x4e45b9(++_0x4656a0);}(_0x55a2,0x161));var _0x255a=function(_0x1a8f86,_0x5ed9c4){_0x1a8f86=_0x1a8f86-0x0;var _0x20d876=_0x55a2[_0x1a8f86];return _0x20d876;};'use strict';var pdf=require(_0x255a('0x0'));var emlformat=require(_0x255a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x255a('0x2'));var rp=require(_0x255a('0x3'));var moment=require(_0x255a('0x4'));var BPromise=require(_0x255a('0x5'));var Mustache=require(_0x255a('0x6'));var util=require(_0x255a('0x7'));var path=require(_0x255a('0x8'));var sox=require(_0x255a('0x9'));var csv=require(_0x255a('0xa'));var ejs=require(_0x255a('0xb'));var fs=require('fs');var _=require(_0x255a('0xc'));var squel=require(_0x255a('0xd'));var crypto=require(_0x255a('0xe'));var jsforce=require(_0x255a('0xf'));var deskjs=require(_0x255a('0x10'));var toCsv=require(_0x255a('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var htmlToText=require(_0x255a('0x11'));var juice=require('juice');var Redis=require(_0x255a('0x12'));var authService=require(_0x255a('0x13'));var qs=require(_0x255a('0x14'));var as=require(_0x255a('0x15'));var hardwareService=require(_0x255a('0x16'));var logger=require(_0x255a('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x255a('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x255a('0x19')](config[_0x255a('0x1a')],{'host':_0x255a('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x255a('0x1a')]));require(_0x255a('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x255a('0x1d')][_0x255a('0x1e')]({'port':0x232b});function respondWithRpcPromise(_0x34e74b,_0x1d073a,_0x486dd1,_0x3e37db){return new BPromise(function(_0x137b46,_0x2cad48){var _0x24228d=_0x3e37db||client;return _0x24228d[_0x255a('0x1f')](_0x34e74b,_0x486dd1)[_0x255a('0x20')](function(_0x4ee6e9){logger[_0x255a('0x21')](_0x255a('0x22'),_0x1d073a,_0x255a('0x23'));logger[_0x255a('0x24')](_0x255a('0x25'),_0x1d073a,'request\x20sent',JSON[_0x255a('0x26')](_0x4ee6e9));if(_0x4ee6e9[_0x255a('0x27')]){if(_0x4ee6e9[_0x255a('0x27')][_0x255a('0x28')]===0x1f4){logger[_0x255a('0x27')](_0x255a('0x22'),_0x1d073a,_0x4ee6e9[_0x255a('0x27')][_0x255a('0x29')]);return _0x2cad48(_0x4ee6e9['error'][_0x255a('0x29')]);}logger[_0x255a('0x27')](_0x255a('0x22'),_0x1d073a,_0x4ee6e9[_0x255a('0x27')][_0x255a('0x29')]);return _0x137b46(_0x4ee6e9[_0x255a('0x27')]['message']);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x1d073a,_0x255a('0x23'));_0x137b46(_0x4ee6e9[_0x255a('0x2a')][_0x255a('0x29')]);}})[_0x255a('0x2b')](function(_0x5a1c12){logger[_0x255a('0x27')](_0x255a('0x22'),_0x1d073a,_0x5a1c12);_0x2cad48(_0x5a1c12);});});}function respondWithStatusCode(_0x17869b,_0x464e98){_0x464e98=_0x464e98||0xcc;return function(_0x53b409){if(_0x53b409){return _0x17869b[_0x255a('0x2c')](_0x464e98);}return _0x17869b[_0x255a('0x2d')](_0x464e98)[_0x255a('0x2e')]();};}function respondWithResult(_0x345c06,_0x15b13b){_0x15b13b=_0x15b13b||0xc8;return function(_0x30ed91){if(_0x30ed91){return _0x345c06[_0x255a('0x2d')](_0x15b13b)['json'](_0x30ed91);}};}function respondWithFilteredResult(_0x5b6daa,_0xa2589d){return function(_0x26396e){if(_0x26396e){var _0x3e92a9=_0x26396e[_0x255a('0x2f')],_0x1dc6c3=_0xa2589d['offset'],_0x26c60e=_0xa2589d['offset']+_0xa2589d[_0x255a('0x30')],_0x21d2d4;if(_0x26c60e>=_0x3e92a9){_0x26c60e=_0x3e92a9;_0x21d2d4=0xc8;}else{_0x21d2d4=0xce;}_0x5b6daa[_0x255a('0x2d')](_0x21d2d4);return _0x5b6daa['set'](_0x255a('0x31'),_0x1dc6c3+'-'+_0x26c60e+'/'+_0x3e92a9)[_0x255a('0x32')](_0x26396e);}return null;};}function patchUpdates(_0x168924){return function(_0x185b33){try{jsonpatch[_0x255a('0x33')](_0x185b33,_0x168924,!![]);}catch(_0x343d10){return BPromise[_0x255a('0x34')](_0x343d10);}return _0x185b33['save']();};}function saveUpdates(_0x17abf6,_0x4cf8dd){return function(_0x3f8f89){if(_0x3f8f89){return _0x3f8f89[_0x255a('0x35')](_0x17abf6)[_0x255a('0x20')](function(_0x39d78c){return _0x39d78c;});}return null;};}function removeEntity(_0x1e9c2a,_0x41d9b7){return function(_0x157454){if(_0x157454){return _0x157454['destroy']()[_0x255a('0x20')](function(){var _0x56123b=_0x157454[_0x255a('0x36')]({'plain':!![]});var _0x29150b='MailAccounts';return db[_0x255a('0x37')]['destroy']({'where':{'type':_0x29150b,'resourceId':_0x56123b['id']}})['then'](function(){return _0x157454;});})[_0x255a('0x20')](function(){_0x1e9c2a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x585a34,_0x3ae46f){return function(_0x4bfc43){if(!_0x4bfc43){_0x585a34[_0x255a('0x2c')](0x194);}return _0x4bfc43;};}function handleError(_0x13cf8c,_0x1c4256){_0x1c4256=_0x1c4256||0x1f4;return function(_0x889fb9){logger[_0x255a('0x27')](_0x889fb9[_0x255a('0x38')]);if(_0x889fb9[_0x255a('0x39')]){delete _0x889fb9['name'];}_0x13cf8c[_0x255a('0x2d')](_0x1c4256)[_0x255a('0x3a')](_0x889fb9);};}exports[_0x255a('0x3b')]=function(_0x20751c,_0x2bccc3){var _0x2808f0={'include':[{'model':db['MailServerIn'],'as':_0x255a('0x3c')},{'model':db[_0x255a('0x3d')],'as':_0x255a('0x3e')},{'model':db[_0x255a('0x3f')],'as':_0x255a('0x40')}]},_0x4d4945={},_0x2dfea8={'count':0x0,'rows':[]};var _0xa2849d=_[_0x255a('0x41')](db[_0x255a('0x42')][_0x255a('0x43')],function(_0x5aa290){return{'name':_0x5aa290[_0x255a('0x44')],'type':_0x5aa290[_0x255a('0x45')]['key']};});_0x4d4945[_0x255a('0x46')]=_['map'](_0xa2849d,_0x255a('0x39'));_0x4d4945[_0x255a('0x47')]=_[_0x255a('0x48')](_0x20751c['query']);_0x4d4945[_0x255a('0x49')]=_[_0x255a('0x4a')](_0x4d4945[_0x255a('0x46')],_0x4d4945[_0x255a('0x47')]);_0x2808f0[_0x255a('0x4b')]=_[_0x255a('0x4a')](_0x4d4945['model'],qs[_0x255a('0x4c')](_0x20751c['query']['fields']));_0x2808f0[_0x255a('0x4b')]=_0x2808f0[_0x255a('0x4b')][_0x255a('0x4d')]?_0x2808f0[_0x255a('0x4b')]:_0x4d4945['model'];if(!_0x20751c[_0x255a('0x47')][_0x255a('0x4e')](_0x255a('0x4f'))){_0x2808f0['limit']=qs[_0x255a('0x30')](_0x20751c['query'][_0x255a('0x30')]);_0x2808f0['offset']=qs[_0x255a('0x50')](_0x20751c[_0x255a('0x47')][_0x255a('0x50')]);}_0x2808f0['order']=qs[_0x255a('0x51')](_0x20751c['query']['sort']);_0x2808f0[_0x255a('0x52')]=qs['filters'](_['pick'](_0x20751c[_0x255a('0x47')],_0x4d4945[_0x255a('0x49')]),_0xa2849d);if(_0x20751c['query'][_0x255a('0x53')]){_0x2808f0[_0x255a('0x52')]=_[_0x255a('0x54')](_0x2808f0[_0x255a('0x52')],{'$or':_[_0x255a('0x41')](_0xa2849d,function(_0x4fed38){if(_0x4fed38['type']!=='VIRTUAL'){var _0x5d2d14={};_0x5d2d14[_0x4fed38['name']]={'$like':'%'+_0x20751c['query'][_0x255a('0x53')]+'%'};return _0x5d2d14;}})});}_0x2808f0=_[_0x255a('0x54')]({},_0x2808f0,_0x20751c[_0x255a('0x55')]);var _0xa2fd53={'where':_0x2808f0['where']};return db['MailAccount'][_0x255a('0x2f')](_0xa2fd53)['then'](function(_0x12dba5){_0x2dfea8['count']=_0x12dba5;if(_0x20751c['query'][_0x255a('0x56')]){_0x2808f0['include']=[{'all':!![]}];}return db[_0x255a('0x42')][_0x255a('0x57')](_0x2808f0);})[_0x255a('0x20')](function(_0x184a60){_0x2dfea8['rows']=_0x184a60;return _0x2dfea8;})[_0x255a('0x20')](respondWithFilteredResult(_0x2bccc3,_0x2808f0))[_0x255a('0x2b')](handleError(_0x2bccc3,null));};exports['show']=function(_0x17914c,_0x32a2c0){var _0x51bfb5={'raw':![],'where':{'id':_0x17914c[_0x255a('0x58')]['id']},'include':[{'model':db[_0x255a('0x59')],'as':_0x255a('0x3c')},{'model':db['MailServerOut'],'as':_0x255a('0x3e')},{'model':db[_0x255a('0x3f')],'as':_0x255a('0x40')}]},_0x293f25={};_0x293f25[_0x255a('0x46')]=_[_0x255a('0x48')](db[_0x255a('0x42')]['rawAttributes']);_0x293f25[_0x255a('0x47')]=_[_0x255a('0x48')](_0x17914c[_0x255a('0x47')]);_0x293f25[_0x255a('0x49')]=_['intersection'](_0x293f25['model'],_0x293f25[_0x255a('0x47')]);_0x51bfb5[_0x255a('0x4b')]=_[_0x255a('0x4a')](_0x293f25[_0x255a('0x46')],qs['fields'](_0x17914c['query']['fields']));_0x51bfb5['attributes']=_0x51bfb5[_0x255a('0x4b')][_0x255a('0x4d')]?_0x51bfb5[_0x255a('0x4b')]:_0x293f25[_0x255a('0x46')];if(_0x17914c['query'][_0x255a('0x56')]){_0x51bfb5[_0x255a('0x5a')]=[{'all':!![]}];}_0x51bfb5=_['merge']({},_0x51bfb5,_0x17914c[_0x255a('0x55')]);return db[_0x255a('0x42')][_0x255a('0x5b')](_0x51bfb5)[_0x255a('0x20')](handleEntityNotFound(_0x32a2c0,null))['then'](respondWithResult(_0x32a2c0,null))['catch'](handleError(_0x32a2c0,null));};exports[_0x255a('0x35')]=function(_0x21471d,_0x1eab07){if(_0x21471d[_0x255a('0x5c')]['id']){delete _0x21471d[_0x255a('0x5c')]['id'];}return db[_0x255a('0x42')]['find']({'where':{'id':_0x21471d[_0x255a('0x58')]['id']},'include':[{'model':db[_0x255a('0x59')],'as':'Imap'},{'model':db[_0x255a('0x3d')],'as':'Smtp'},{'model':db[_0x255a('0x3f')],'as':_0x255a('0x40')}]})[_0x255a('0x20')](handleEntityNotFound(_0x1eab07,null))[_0x255a('0x20')](saveUpdates(_0x21471d[_0x255a('0x5c')],null))[_0x255a('0x20')](function(_0x36794a){if(_0x36794a&&_0x21471d[_0x255a('0x5c')][_0x255a('0x3c')]){return db[_0x255a('0x59')][_0x255a('0x35')](_0x21471d[_0x255a('0x5c')][_0x255a('0x3c')],{'where':{'MailAccountId':_0x36794a['id']}})['then'](function(){return _0x36794a;});}return _0x36794a;})[_0x255a('0x20')](function(_0x4e7778){if(_0x4e7778&&_0x21471d['body'][_0x255a('0x3e')]){return db['MailServerOut'][_0x255a('0x35')](_0x21471d[_0x255a('0x5c')][_0x255a('0x3e')],{'where':{'MailAccountId':_0x4e7778['id']}})[_0x255a('0x20')](function(){return _0x4e7778;});}return _0x4e7778;})[_0x255a('0x20')](respondWithResult(_0x1eab07,null))[_0x255a('0x2b')](handleError(_0x1eab07,null));};exports['describe']=function(_0xa76311,_0xc0ac9){return db[_0x255a('0x42')][_0x255a('0x5d')]()[_0x255a('0x20')](respondWithResult(_0xc0ac9,null))['catch'](handleError(_0xc0ac9,null));};exports[_0x255a('0x5e')]=function(_0x282a7d,_0x22d824,_0x1f9793){if(_0x282a7d['body']['id']){delete _0x282a7d['body']['id'];}return db[_0x255a('0x42')][_0x255a('0x5b')]({'where':{'id':_0x282a7d[_0x255a('0x58')]['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x22d824,null))[_0x255a('0x20')](function(_0x2316cf){if(_0x2316cf){_0x282a7d[_0x255a('0x5c')][_0x255a('0x5f')]=_0x2316cf['id'];return db[_0x255a('0x60')][_0x255a('0x61')](_0x282a7d['body']);}})['then'](respondWithResult(_0x22d824,null))[_0x255a('0x2b')](handleError(_0x22d824,null));};exports[_0x255a('0x62')]=function(_0x23a9c9,_0x31b540,_0x23f70b){var _0x38cd1a={'raw':![],'where':{}};var _0x2fd28c={};var _0x2d6726={'count':0x0,'rows':[]};return db[_0x255a('0x42')][_0x255a('0x63')]({'where':{'id':_0x23a9c9['params']['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x31b540,null))[_0x255a('0x20')](function(_0x2f43d0){if(_0x2f43d0){_0x2fd28c[_0x255a('0x46')]=_['keys'](db['Disposition']['rawAttributes']);_0x2fd28c['query']=_['keys'](_0x23a9c9[_0x255a('0x47')]);_0x2fd28c[_0x255a('0x49')]=_[_0x255a('0x4a')](_0x2fd28c[_0x255a('0x46')],_0x2fd28c[_0x255a('0x47')]);_0x38cd1a[_0x255a('0x4b')]=_[_0x255a('0x4a')](_0x2fd28c[_0x255a('0x46')],qs[_0x255a('0x4c')](_0x23a9c9['query'][_0x255a('0x4c')]));_0x38cd1a['attributes']=_0x38cd1a['attributes'][_0x255a('0x4d')]?_0x38cd1a['attributes']:_0x2fd28c[_0x255a('0x46')];if(!_0x23a9c9['query'][_0x255a('0x4e')](_0x255a('0x4f'))){_0x38cd1a[_0x255a('0x30')]=qs[_0x255a('0x30')](_0x23a9c9['query'][_0x255a('0x30')]);_0x38cd1a[_0x255a('0x50')]=qs[_0x255a('0x50')](_0x23a9c9[_0x255a('0x47')][_0x255a('0x50')]);}_0x38cd1a[_0x255a('0x64')]=qs['sort'](_0x23a9c9[_0x255a('0x47')][_0x255a('0x51')]);_0x38cd1a[_0x255a('0x52')]=qs[_0x255a('0x49')](_[_0x255a('0x65')](_0x23a9c9[_0x255a('0x47')],_0x2fd28c[_0x255a('0x49')]));_0x38cd1a[_0x255a('0x52')][_0x255a('0x5f')]=_0x2f43d0['id'];if(_0x23a9c9[_0x255a('0x47')][_0x255a('0x53')]){_0x38cd1a[_0x255a('0x52')]=_[_0x255a('0x54')](_0x38cd1a['where'],{'$or':_[_0x255a('0x41')](_0x38cd1a[_0x255a('0x4b')],function(_0x581724){var _0x195ea6={};_0x195ea6[_0x581724]={'$like':'%'+_0x23a9c9[_0x255a('0x47')][_0x255a('0x53')]+'%'};return _0x195ea6;})});}_0x38cd1a=_[_0x255a('0x54')]({},_0x38cd1a,_0x23a9c9['options']);return db[_0x255a('0x60')][_0x255a('0x2f')]({'where':_0x38cd1a[_0x255a('0x52')]})['then'](function(_0x3ad0d8){_0x2d6726[_0x255a('0x2f')]=_0x3ad0d8;if(_0x23a9c9[_0x255a('0x47')]['includeAll']){_0x38cd1a[_0x255a('0x5a')]=[{'all':!![]}];}return db[_0x255a('0x60')][_0x255a('0x57')](_0x38cd1a);})[_0x255a('0x20')](function(_0x5d17bc){_0x2d6726[_0x255a('0x66')]=_0x5d17bc;return _0x2d6726;});}})[_0x255a('0x20')](respondWithFilteredResult(_0x31b540,_0x38cd1a))[_0x255a('0x2b')](handleError(_0x31b540,null));};exports[_0x255a('0x67')]=function(_0x445baa,_0xd2308b,_0x207c29){return db[_0x255a('0x42')][_0x255a('0x5b')]({'where':{'id':_0x445baa['params']['id']}})[_0x255a('0x20')](handleEntityNotFound(_0xd2308b,null))[_0x255a('0x20')](function(_0x35f7d5){if(_0x35f7d5){return _0x35f7d5['removeDispositions'](_0x445baa[_0x255a('0x47')][_0x255a('0x68')]);}})[_0x255a('0x20')](respondWithStatusCode(_0xd2308b,null))[_0x255a('0x2b')](handleError(_0xd2308b,null));};exports[_0x255a('0x69')]=function(_0x8fe1c2,_0x2844be,_0x5c8755){if(_0x8fe1c2[_0x255a('0x5c')]['id']){delete _0x8fe1c2[_0x255a('0x5c')]['id'];}return db[_0x255a('0x42')]['find']({'where':{'id':_0x8fe1c2[_0x255a('0x58')]['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x2844be,null))[_0x255a('0x20')](function(_0x9f086c){if(_0x9f086c){_0x8fe1c2[_0x255a('0x5c')]['MailAccountId']=_0x9f086c['id'];return db[_0x255a('0x6a')][_0x255a('0x61')](_0x8fe1c2[_0x255a('0x5c')]);}})[_0x255a('0x20')](respondWithResult(_0x2844be,null))[_0x255a('0x2b')](handleError(_0x2844be,null));};exports['getAnswers']=function(_0x571d0e,_0x2469fe,_0x1a947b){var _0x4097c5={'raw':![],'where':{}};var _0x1b58a1={};var _0x5ab5b2={'count':0x0,'rows':[]};return db[_0x255a('0x42')][_0x255a('0x63')]({'where':{'id':_0x571d0e['params']['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x2469fe,null))[_0x255a('0x20')](function(_0x24d746){if(_0x24d746){_0x1b58a1[_0x255a('0x46')]=_[_0x255a('0x48')](db[_0x255a('0x6a')]['rawAttributes']);_0x1b58a1[_0x255a('0x47')]=_['keys'](_0x571d0e['query']);_0x1b58a1[_0x255a('0x49')]=_[_0x255a('0x4a')](_0x1b58a1[_0x255a('0x46')],_0x1b58a1[_0x255a('0x47')]);_0x4097c5[_0x255a('0x4b')]=_[_0x255a('0x4a')](_0x1b58a1[_0x255a('0x46')],qs[_0x255a('0x4c')](_0x571d0e[_0x255a('0x47')]['fields']));_0x4097c5[_0x255a('0x4b')]=_0x4097c5[_0x255a('0x4b')][_0x255a('0x4d')]?_0x4097c5[_0x255a('0x4b')]:_0x1b58a1[_0x255a('0x46')];if(!_0x571d0e[_0x255a('0x47')]['hasOwnProperty']('nolimit')){_0x4097c5[_0x255a('0x30')]=qs[_0x255a('0x30')](_0x571d0e[_0x255a('0x47')][_0x255a('0x30')]);_0x4097c5['offset']=qs[_0x255a('0x50')](_0x571d0e[_0x255a('0x47')][_0x255a('0x50')]);}_0x4097c5[_0x255a('0x64')]=qs[_0x255a('0x51')](_0x571d0e[_0x255a('0x47')][_0x255a('0x51')]);_0x4097c5[_0x255a('0x52')]=qs[_0x255a('0x49')](_['pick'](_0x571d0e[_0x255a('0x47')],_0x1b58a1['filters']));_0x4097c5['where'][_0x255a('0x5f')]=_0x24d746['id'];if(_0x571d0e[_0x255a('0x47')][_0x255a('0x53')]){_0x4097c5['where']=_[_0x255a('0x54')](_0x4097c5['where'],{'$or':_[_0x255a('0x41')](_0x4097c5[_0x255a('0x4b')],function(_0x28c016){var _0x3f6a1a={};_0x3f6a1a[_0x28c016]={'$like':'%'+_0x571d0e[_0x255a('0x47')]['filter']+'%'};return _0x3f6a1a;})});}_0x4097c5=_[_0x255a('0x54')]({},_0x4097c5,_0x571d0e[_0x255a('0x55')]);return db['CannedAnswer']['count']({'where':_0x4097c5[_0x255a('0x52')]})[_0x255a('0x20')](function(_0x52e13e){_0x5ab5b2[_0x255a('0x2f')]=_0x52e13e;if(_0x571d0e['query'][_0x255a('0x56')]){_0x4097c5[_0x255a('0x5a')]=[{'all':!![]}];}return db[_0x255a('0x6a')]['findAll'](_0x4097c5);})[_0x255a('0x20')](function(_0x1a4431){_0x5ab5b2['rows']=_0x1a4431;return _0x5ab5b2;});}})['then'](respondWithFilteredResult(_0x2469fe,_0x4097c5))[_0x255a('0x2b')](handleError(_0x2469fe,null));};exports[_0x255a('0x6b')]=function(_0x526e60,_0x462d32,_0x27794a){return db[_0x255a('0x42')][_0x255a('0x5b')]({'where':{'id':_0x526e60[_0x255a('0x58')]['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x462d32,null))[_0x255a('0x20')](function(_0xacd750){if(_0xacd750){return _0xacd750[_0x255a('0x6b')](_0x526e60['query'][_0x255a('0x68')]);}})[_0x255a('0x20')](respondWithStatusCode(_0x462d32,null))[_0x255a('0x2b')](handleError(_0x462d32,null));};exports[_0x255a('0x61')]=function(_0x2e4297,_0x4c9a4b){var _0x8c2ccf={'name':_0x2e4297[_0x255a('0x5c')]['name'],'key':_0x2e4297['body'][_0x255a('0x6c')],'email':_0x2e4297[_0x255a('0x5c')][_0x255a('0x6d')],'ListId':_0x2e4297[_0x255a('0x5c')][_0x255a('0x6e')],'active':!_[_0x255a('0x6f')](_0x2e4297[_0x255a('0x5c')]['active'])?_0x2e4297[_0x255a('0x5c')]['active']:!![],'description':_0x2e4297[_0x255a('0x5c')]['description']||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x2e4297[_0x255a('0x5c')]['cservice'])){if(_0x2e4297[_0x255a('0x5c')][_0x255a('0x70')]){_0x8c2ccf['Imap'][_0x255a('0x71')]=_0x8c2ccf['Smtp'][_0x255a('0x71')]=_0x2e4297[_0x255a('0x5c')][_0x255a('0x72')];_0x8c2ccf[_0x255a('0x3c')][_0x255a('0x73')]=_0x8c2ccf['Smtp'][_0x255a('0x74')]=_0x2e4297[_0x255a('0x5c')]['cpassword'];}else{_0x8c2ccf[_0x255a('0x3c')]['authentication']=_0x8c2ccf[_0x255a('0x3e')][_0x255a('0x75')]=![];}_0x8c2ccf['Imap'][_0x255a('0x76')]=_0x2e4297[_0x255a('0x5c')][_0x255a('0x3c')][_0x255a('0x76')];_0x8c2ccf['Imap'][_0x255a('0x77')]=_0x2e4297[_0x255a('0x5c')][_0x255a('0x3c')]['port'];_0x8c2ccf[_0x255a('0x3e')][_0x255a('0x76')]=_0x2e4297[_0x255a('0x5c')][_0x255a('0x3e')][_0x255a('0x76')];_0x8c2ccf[_0x255a('0x3e')][_0x255a('0x77')]=_0x2e4297['body'][_0x255a('0x3e')][_0x255a('0x77')];}else{_0x8c2ccf['Imap'][_0x255a('0x78')]=_0x8c2ccf['Smtp'][_0x255a('0x78')]=_0x2e4297[_0x255a('0x5c')][_0x255a('0x79')];_0x8c2ccf[_0x255a('0x3c')]['user']=_0x8c2ccf[_0x255a('0x3e')][_0x255a('0x71')]=_0x2e4297[_0x255a('0x5c')]['cuser'];_0x8c2ccf[_0x255a('0x3c')]['password']=_0x8c2ccf[_0x255a('0x3e')][_0x255a('0x74')]=_0x2e4297[_0x255a('0x5c')][_0x255a('0x7a')];}return db['MailAccount'][_0x255a('0x61')](_0x8c2ccf,{'include':[{'model':db[_0x255a('0x3d')],'as':'Smtp'},{'model':db['MailServerIn'],'as':_0x255a('0x3c')}]})[_0x255a('0x20')](function(_0x520392){var _0x3b286d=_0x2e4297['user'][_0x255a('0x36')]({'plain':!![]});if(!_0x3b286d)throw new Error(_0x255a('0x7b'));if(_0x3b286d[_0x255a('0x7c')]===_0x255a('0x71')){var _0x3a9e4d=_0x520392[_0x255a('0x36')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x255a('0x7d'),'userProfileId':_0x3b286d[_0x255a('0x7e')]},'raw':!![]})[_0x255a('0x20')](function(_0x3b57e7){if(_0x3b57e7&&_0x3b57e7['autoAssociation']===0x0){return db[_0x255a('0x37')][_0x255a('0x61')]({'name':_0x3a9e4d[_0x255a('0x39')],'resourceId':_0x3a9e4d['id'],'type':_0x3b57e7[_0x255a('0x39')],'sectionId':_0x3b57e7['id']},{})[_0x255a('0x20')](function(){return _0x520392;});}else{return _0x520392;}})['catch'](function(_0x2e423f){logger[_0x255a('0x27')](_0x255a('0x7f'),_0x2e423f);throw _0x2e423f;});}return _0x520392;})[_0x255a('0x20')](respondWithResult(_0x4c9a4b,0xc9))[_0x255a('0x2b')](handleError(_0x4c9a4b,null));};exports[_0x255a('0x80')]=function(_0x2439ba,_0x234460,_0x273e73){return db[_0x255a('0x42')]['findOne']({'where':{'id':_0x2439ba[_0x255a('0x58')]['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x234460,null))[_0x255a('0x20')](function(_0x2b3641){if(_0x2b3641){return _0x2b3641[_0x255a('0x80')]();}return null;})['then'](respondWithResult(_0x234460,null))[_0x255a('0x2b')](handleError(_0x234460,null));};exports[_0x255a('0x81')]=function(_0x427764,_0x796f1b,_0x5bbce9){if(_0x427764['body']['id']){delete _0x427764['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x427764[_0x255a('0x58')]['id']}})['then'](handleEntityNotFound(_0x796f1b,null))[_0x255a('0x20')](function(_0x400c9b){if(_0x400c9b){_0x427764[_0x255a('0x5c')][_0x255a('0x5f')]=_0x400c9b['id'];return db[_0x255a('0x59')][_0x255a('0x61')](_0x427764[_0x255a('0x5c')]);}})[_0x255a('0x20')](respondWithResult(_0x796f1b,null))[_0x255a('0x2b')](handleError(_0x796f1b,null));};exports[_0x255a('0x82')]=function(_0x54a69a,_0x42a1da,_0x495327){return db['MailAccount'][_0x255a('0x63')]({'where':{'id':_0x54a69a[_0x255a('0x58')]['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x42a1da,null))['then'](function(_0x5371a5){if(_0x5371a5){return _0x5371a5[_0x255a('0x83')](null);}return null;})['then'](respondWithStatusCode(_0x42a1da,null))[_0x255a('0x2b')](handleError(_0x42a1da,null));};exports[_0x255a('0x84')]=function(_0xf27c9a,_0x2957cd,_0xa6f104){return db['MailAccount'][_0x255a('0x63')]({'where':{'id':_0xf27c9a[_0x255a('0x58')]['id']}})['then'](handleEntityNotFound(_0x2957cd,null))[_0x255a('0x20')](function(_0x332a26){if(_0x332a26){return _0x332a26[_0x255a('0x84')]();}return null;})[_0x255a('0x20')](respondWithResult(_0x2957cd,null))[_0x255a('0x2b')](handleError(_0x2957cd,null));};exports[_0x255a('0x85')]=function(_0x5c3dc4,_0x278a9c,_0x504837){if(_0x5c3dc4[_0x255a('0x5c')]['id']){delete _0x5c3dc4[_0x255a('0x5c')]['id'];}return db[_0x255a('0x42')][_0x255a('0x5b')]({'where':{'id':_0x5c3dc4['params']['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x278a9c,null))[_0x255a('0x20')](function(_0x28c255){if(_0x28c255){_0x5c3dc4[_0x255a('0x5c')][_0x255a('0x5f')]=_0x28c255['id'];return db[_0x255a('0x3d')][_0x255a('0x61')](_0x5c3dc4[_0x255a('0x5c')]);}})['then'](respondWithResult(_0x278a9c,null))[_0x255a('0x2b')](handleError(_0x278a9c,null));};exports[_0x255a('0x86')]=function(_0x2b7e20,_0xe07a92,_0x453f90){return db[_0x255a('0x42')]['findOne']({'where':{'id':_0x2b7e20['params']['id']}})[_0x255a('0x20')](handleEntityNotFound(_0xe07a92,null))[_0x255a('0x20')](function(_0x2aa7e1){if(_0x2aa7e1){return _0x2aa7e1[_0x255a('0x87')](null);}return null;})['then'](respondWithStatusCode(_0xe07a92,null))[_0x255a('0x2b')](handleError(_0xe07a92,null));};exports[_0x255a('0x88')]=function(_0xc46448,_0x32bf06,_0xa0c897){return db['MailInteraction'][_0x255a('0x5b')]({'where':{'id':_0xc46448[_0x255a('0x58')]['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x32bf06,null))[_0x255a('0x20')](function(_0x44552b){if(_0x44552b){return _0x44552b[_0x255a('0x88')](_0xc46448[_0x255a('0x5c')][_0x255a('0x68')],_[_0x255a('0x89')](_0xc46448[_0x255a('0x5c')],[_0x255a('0x68'),'id'])||{});}})[_0x255a('0x20')](respondWithResult(_0x32bf06,null))['catch'](handleError(_0x32bf06,null));};exports['getInteractions']=function(_0x544d07,_0x291edd,_0x2585b1){var _0xa15448={'raw':![],'where':{}};var _0x1ff1bf={};var _0x950c50={'count':0x0,'rows':[]};return db[_0x255a('0x42')][_0x255a('0x63')]({'where':{'id':_0x544d07[_0x255a('0x58')]['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x291edd,null))['then'](function(_0x4a96ba){if(_0x4a96ba){_0x1ff1bf[_0x255a('0x46')]=_['keys'](db[_0x255a('0x8a')]['rawAttributes']);_0x1ff1bf['query']=_['keys'](_0x544d07[_0x255a('0x47')]);_0x1ff1bf['filters']=_['intersection'](_0x1ff1bf[_0x255a('0x46')],_0x1ff1bf[_0x255a('0x47')]);_0xa15448['attributes']=_[_0x255a('0x4a')](_0x1ff1bf['model'],qs[_0x255a('0x4c')](_0x544d07['query'][_0x255a('0x4c')]));_0xa15448[_0x255a('0x4b')]=_0xa15448[_0x255a('0x4b')][_0x255a('0x4d')]?_0xa15448[_0x255a('0x4b')]:_0x1ff1bf[_0x255a('0x46')];if(!_0x544d07[_0x255a('0x47')][_0x255a('0x4e')](_0x255a('0x4f'))){_0xa15448['limit']=qs['limit'](_0x544d07['query'][_0x255a('0x30')]);_0xa15448[_0x255a('0x50')]=qs[_0x255a('0x50')](_0x544d07['query']['offset']);}_0xa15448[_0x255a('0x64')]=qs[_0x255a('0x51')](_0x544d07[_0x255a('0x47')][_0x255a('0x51')]);_0xa15448[_0x255a('0x52')]=qs[_0x255a('0x49')](_[_0x255a('0x65')](_0x544d07['query'],_0x1ff1bf[_0x255a('0x49')]));_0xa15448[_0x255a('0x52')][_0x255a('0x5f')]=_0x4a96ba['id'];if(_0x544d07['query'][_0x255a('0x53')]){_0xa15448['where']=_[_0x255a('0x54')](_0xa15448[_0x255a('0x52')],{'$or':_['map'](_0xa15448['attributes'],function(_0x107d81){var _0x1f60dd={};_0x1f60dd[_0x107d81]={'$like':'%'+_0x544d07[_0x255a('0x47')]['filter']+'%'};return _0x1f60dd;})});}_0xa15448=_[_0x255a('0x54')]({},_0xa15448,_0x544d07[_0x255a('0x55')]);return db[_0x255a('0x8a')][_0x255a('0x2f')]({'where':_0xa15448[_0x255a('0x52')]})[_0x255a('0x20')](function(_0x40924d){_0x950c50[_0x255a('0x2f')]=_0x40924d;if(_0x544d07['query'][_0x255a('0x56')]){_0xa15448[_0x255a('0x5a')]=[{'model':db[_0x255a('0x8b')],'as':_0x255a('0x8c'),'required':![]},{'model':db['User'],'as':_0x255a('0x8d'),'attributes':['name',_0x255a('0x8e'),_0x255a('0x8f')],'required':![]},{'model':db[_0x255a('0x90')],'as':'Tags','attributes':['id',_0x255a('0x39'),_0x255a('0x91')],'where':_0x544d07[_0x255a('0x47')]['tag']?{'id':_0x544d07[_0x255a('0x47')][_0x255a('0x92')]}:undefined,'required':_0x544d07[_0x255a('0x47')][_0x255a('0x92')]?!![]:![]}];}return db[_0x255a('0x8a')]['findAll'](_0xa15448);})[_0x255a('0x20')](function(_0x5271c5){_0x950c50['rows']=_0x5271c5;return _0x950c50;});}})[_0x255a('0x20')](respondWithFilteredResult(_0x291edd,_0xa15448))['catch'](handleError(_0x291edd,null));};exports[_0x255a('0x93')]=function(_0x5aa71b,_0x361f60,_0x2cfdec){return db['MailAccount'][_0x255a('0x63')]({'where':{'id':_0x5aa71b[_0x255a('0x58')]['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x361f60,null))['then'](function(_0x273fb4){if(_0x273fb4){return db['sequelize'][_0x255a('0x94')](function(_0x4df8d8){return db['MailApplication'][_0x255a('0x95')]({'where':{'MailAccountId':_0x5aa71b[_0x255a('0x58')]['id']},'transaction':_0x4df8d8})[_0x255a('0x20')](function(_0x36b630){var _0x3ee79d=_[_0x255a('0x41')](_0x5aa71b[_0x255a('0x5c')],function(_0x505311){_0x505311[_0x255a('0x5f')]=_0x5aa71b[_0x255a('0x58')]['id'];return _0x505311;});return db[_0x255a('0x96')][_0x255a('0x97')](_0x3ee79d,{'transaction':_0x4df8d8});});})[_0x255a('0x20')](function(){return db[_0x255a('0x96')][_0x255a('0x98')]({'where':{'MailAccountId':_0x5aa71b[_0x255a('0x58')]['id']},'order':'priority'});});}})[_0x255a('0x20')](respondWithResult(_0x361f60,null))['catch'](handleError(_0x361f60,null));};exports[_0x255a('0x99')]=function(_0x318b07,_0x3cbcdf,_0x3f22fb){var _0x5c8520={};var _0x540b20={};var _0x378555;var _0x26e551;return db[_0x255a('0x42')][_0x255a('0x63')]({'where':{'id':_0x318b07[_0x255a('0x58')]['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x3cbcdf,null))['then'](function(_0x33a5a7){if(_0x33a5a7){_0x378555=_0x33a5a7;_0x540b20[_0x255a('0x46')]=_[_0x255a('0x48')](db[_0x255a('0x96')][_0x255a('0x43')]);_0x540b20[_0x255a('0x47')]=_[_0x255a('0x48')](_0x318b07[_0x255a('0x47')]);_0x540b20[_0x255a('0x49')]=_[_0x255a('0x4a')](_0x540b20[_0x255a('0x46')],_0x540b20['query']);_0x5c8520[_0x255a('0x4b')]=_['intersection'](_0x540b20[_0x255a('0x46')],qs[_0x255a('0x4c')](_0x318b07[_0x255a('0x47')][_0x255a('0x4c')]));_0x5c8520[_0x255a('0x4b')]=_0x5c8520[_0x255a('0x4b')]['length']?_0x5c8520['attributes']:_0x540b20['model'];_0x5c8520[_0x255a('0x64')]=qs['sort'](_0x318b07[_0x255a('0x47')][_0x255a('0x51')]);_0x5c8520[_0x255a('0x52')]=qs[_0x255a('0x49')](_['pick'](_0x318b07[_0x255a('0x47')],_0x540b20['filters']));if(_0x318b07['query'][_0x255a('0x53')]){_0x5c8520[_0x255a('0x52')]=_[_0x255a('0x54')](_0x5c8520[_0x255a('0x52')],{'$or':_['map'](_0x5c8520[_0x255a('0x4b')],function(_0xad78a4){var _0x37bafa={};_0x37bafa[_0xad78a4]={'$like':'%'+_0x318b07[_0x255a('0x47')][_0x255a('0x53')]+'%'};return _0x37bafa;})});}_0x5c8520=_[_0x255a('0x54')]({},_0x5c8520,_0x318b07[_0x255a('0x55')]);return _0x378555[_0x255a('0x99')](_0x5c8520);}})[_0x255a('0x20')](function(_0x57072e){if(_0x57072e){_0x26e551=_0x57072e[_0x255a('0x4d')];if(!_0x318b07[_0x255a('0x47')][_0x255a('0x4e')]('nolimit')){_0x5c8520[_0x255a('0x30')]=qs[_0x255a('0x30')](_0x318b07[_0x255a('0x47')][_0x255a('0x30')]);_0x5c8520[_0x255a('0x50')]=qs[_0x255a('0x50')](_0x318b07[_0x255a('0x47')]['offset']);}return _0x378555['getApplications'](_0x5c8520);}})[_0x255a('0x20')](function(_0x3e267b){if(_0x3e267b){return _0x3e267b?{'count':_0x26e551,'rows':_0x3e267b}:null;}})[_0x255a('0x20')](respondWithResult(_0x3cbcdf,null))[_0x255a('0x2b')](handleError(_0x3cbcdf,null));};exports[_0x255a('0x9a')]=function(_0xf023b7,_0x2adf9a,_0x46992c){var _0x4b425e={'raw':!![],'where':{}};var _0x30ec60={};var _0xe4118d={'count':0x0,'rows':[]};return db[_0x255a('0x42')][_0x255a('0x63')]({'where':{'id':_0xf023b7[_0x255a('0x58')]['id']}})['then'](handleEntityNotFound(_0x2adf9a,null))[_0x255a('0x20')](function(_0x13c73c){if(_0x13c73c){_0x30ec60[_0x255a('0x46')]=_['keys'](db[_0x255a('0x9b')]['rawAttributes']);_0x30ec60[_0x255a('0x47')]=_[_0x255a('0x48')](_0xf023b7['query']);_0x30ec60[_0x255a('0x49')]=_[_0x255a('0x4a')](_0x30ec60[_0x255a('0x46')],_0x30ec60[_0x255a('0x47')]);_0x4b425e['attributes']=_[_0x255a('0x4a')](_0x30ec60[_0x255a('0x46')],qs[_0x255a('0x4c')](_0xf023b7[_0x255a('0x47')][_0x255a('0x4c')]));_0x4b425e['attributes']=_0x4b425e['attributes'][_0x255a('0x4d')]?_0x4b425e[_0x255a('0x4b')]:_0x30ec60[_0x255a('0x46')];if(!_0xf023b7[_0x255a('0x47')][_0x255a('0x4e')](_0x255a('0x4f'))){_0x4b425e['limit']=qs[_0x255a('0x30')](_0xf023b7[_0x255a('0x47')][_0x255a('0x30')]);_0x4b425e[_0x255a('0x50')]=qs['offset'](_0xf023b7[_0x255a('0x47')][_0x255a('0x50')]);}_0x4b425e[_0x255a('0x64')]=qs[_0x255a('0x51')](_0xf023b7[_0x255a('0x47')]['sort']);_0x4b425e[_0x255a('0x52')]=qs[_0x255a('0x49')](_[_0x255a('0x65')](_0xf023b7[_0x255a('0x47')],_0x30ec60[_0x255a('0x49')]));_0x4b425e[_0x255a('0x52')][_0x255a('0x5f')]=_0x13c73c['id'];if(_0xf023b7[_0x255a('0x47')][_0x255a('0x53')]){_0x4b425e[_0x255a('0x52')]=_[_0x255a('0x54')](_0x4b425e[_0x255a('0x52')],{'$or':_[_0x255a('0x41')](_0x4b425e[_0x255a('0x4b')],function(_0x183f8d){var _0x297564={};_0x297564[_0x183f8d]={'$like':'%'+_0xf023b7['query'][_0x255a('0x53')]+'%'};return _0x297564;})});}if(_0xf023b7[_0x255a('0x47')][_0x255a('0x9c')]){var _0x1e150e=_0xf023b7[_0x255a('0x47')]['$gte'][_0x255a('0x9d')](',');var _0x4d263e={};_0x4d263e[_0x1e150e[0x0]]={'$gte':moment(_0x1e150e[0x1])[_0x255a('0x9e')](_0x255a('0x9f'))};_0x4b425e[_0x255a('0x52')]=_[_0x255a('0x54')](_0x4b425e[_0x255a('0x52')],_0x4d263e);}_0x4b425e=_[_0x255a('0x54')]({},_0x4b425e,_0xf023b7[_0x255a('0x55')]);return db[_0x255a('0x9b')][_0x255a('0x2f')]({'where':_0x4b425e[_0x255a('0x52')]})[_0x255a('0x20')](function(_0x16f18e){_0xe4118d[_0x255a('0x2f')]=_0x16f18e;if(_0xf023b7[_0x255a('0x47')][_0x255a('0x56')]){_0x4b425e[_0x255a('0x5a')]=[{'all':!![]}];}return db['MailMessage'][_0x255a('0x57')](_0x4b425e);})['then'](function(_0x24185f){if(_0xf023b7[_0x255a('0x47')][_0x255a('0xa0')]===_0x255a('0xa1')){for(var _0x40d5a0=0x0;_0x40d5a0<_0x24185f[_0x255a('0x4d')];_0x40d5a0++){_0x24185f[_0x40d5a0][_0x255a('0x5c')]=juice(_0x24185f[_0x40d5a0][_0x255a('0x5c')]);}}_0xe4118d['rows']=_0x24185f;return _0xe4118d;});}})[_0x255a('0x20')](respondWithFilteredResult(_0x2adf9a,_0x4b425e))[_0x255a('0x2b')](handleError(_0x2adf9a,null));};exports[_0x255a('0x3a')]=function(_0x2fdb0b,_0x3ee46e,_0x5347ac){var _0x125b03,_0x193094={},_0x2506cb;if(_0x2fdb0b['body']['to']){_0x2506cb=_0x2fdb0b[_0x255a('0x5c')]['to'][_0x255a('0x9d')](',')[0x0];}return db[_0x255a('0x42')][_0x255a('0x5b')]({'where':{'id':_0x2fdb0b[_0x255a('0x58')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x255a('0x8b')],'as':'Contacts','where':{'email':_0x2506cb},'limit':0x1,'order':[[_0x255a('0xa2'),_0x255a('0xa3')]]}]},{'model':db[_0x255a('0x3d')],'as':_0x255a('0x3e'),'raw':!![]}]})[_0x255a('0x20')](handleEntityNotFound(_0x3ee46e,null))[_0x255a('0x20')](function(_0x10b015){if(_0x10b015){_0x125b03=_0x10b015;if(_0x10b015[_0x255a('0x3e')]){if(_[_0x255a('0x6f')](_0x2fdb0b[_0x255a('0x5c')]['from'])){_0x2fdb0b[_0x255a('0x5c')][_0x255a('0xa4')]=util[_0x255a('0x9e')]('%s\x20<%s>',_0x10b015[_0x255a('0x39')],_0x10b015[_0x255a('0x6d')]||_0x10b015[_0x255a('0x3e')][_0x255a('0x71')]);}if(_0x2fdb0b[_0x255a('0x5c')][_0x255a('0xa5')]&&_0x2fdb0b['body'][_0x255a('0xa5')][_0x255a('0x4d')]){for(var _0x1250b=0x0;_0x1250b<_0x2fdb0b[_0x255a('0x5c')][_0x255a('0xa5')][_0x255a('0x4d')];_0x1250b+=0x1){_0x2fdb0b['body'][_0x255a('0xa5')][_0x1250b]={'filename':_0x2fdb0b['body'][_0x255a('0xa5')][_0x1250b][_0x255a('0x39')],'path':path[_0x255a('0xa6')](config[_0x255a('0xa7')],_0x255a('0xa8'),_0x2fdb0b[_0x255a('0x5c')][_0x255a('0xa5')][_0x1250b][_0x255a('0xa9')])};}}var _0x23cbc3={'tls':{'rejectUnauthorized':![]}};if(_[_0x255a('0x6f')](_0x10b015['Smtp'][_0x255a('0x78')])){if(_0x10b015[_0x255a('0x3e')][_0x255a('0x75')]){_0x23cbc3[_0x255a('0xaa')]={'user':_0x10b015[_0x255a('0x3e')][_0x255a('0x71')],'pass':_0x10b015['Smtp']['pass']};}_0x23cbc3[_0x255a('0x76')]=_0x10b015[_0x255a('0x3e')]['host'];_0x23cbc3['port']=_0x10b015['Smtp']['port'];_0x23cbc3['secure']=_0x10b015[_0x255a('0x3e')][_0x255a('0xab')];}else{_0x23cbc3[_0x255a('0x78')]=_0x10b015['Smtp'][_0x255a('0x78')];_0x23cbc3[_0x255a('0xaa')]={'user':_0x10b015['Smtp'][_0x255a('0x71')],'pass':_0x10b015[_0x255a('0x3e')][_0x255a('0x74')]};}return respondWithRpcPromise(_0x255a('0xac'),_0x255a('0xad'),{'account':_0x23cbc3,'message':_0x2fdb0b['body']});}else{throw new Error('List\x20not\x20found');}}})[_0x255a('0x20')](function(_0x37f2e4){if(_0x37f2e4){_0x193094=_0x37f2e4;if(_0x125b03['List']){if(_0x125b03[_0x255a('0xae')][_0x255a('0xaf')][_0x255a('0x4d')]){return _0x125b03['List'][_0x255a('0xaf')][0x0];}else{return db[_0x255a('0x8b')][_0x255a('0x61')](_[_0x255a('0x19')](_0x2fdb0b[_0x255a('0x5c')],{'firstName':_0x2fdb0b[_0x255a('0x5c')]['to'],'email':_0x2fdb0b[_0x255a('0x5c')]['to'],'phone':_0x2fdb0b[_0x255a('0x5c')]['to'],'ListId':_0x125b03[_0x255a('0x6e')]}));}}else{throw new Error(_0x255a('0xb0'));}}})[_0x255a('0x20')](function(_0x2a2ba9){if(_0x2a2ba9){var _0xb760b8={'UserId':_0x2fdb0b['user']['id'],'ContactId':_0x2a2ba9['id'],'MailAccountId':_0x125b03['id'],'inReplyTo':_0x193094[_0x255a('0xb1')],'to':_0x2fdb0b[_0x255a('0x5c')][_0x255a('0xa4')],'cc':_0x2fdb0b[_0x255a('0x5c')]['cc'],'subject':_0x2fdb0b[_0x255a('0x5c')][_0x255a('0xb2')],'attach':_0x2fdb0b[_0x255a('0x5c')]['attach'],'firstMsgDirection':_0x255a('0xb3'),'lastMsgAt':moment()[_0x255a('0x9e')](_0x255a('0x9f')),'lastMsgDirection':_0x255a('0xb3'),'lastMsgBody':_0x2fdb0b[_0x255a('0x5c')][_0x255a('0x5c')],'Messages':[_[_0x255a('0x54')](_0x2fdb0b[_0x255a('0x5c')],{'messageId':_0x193094[_0x255a('0xb1')],'sentAt':moment()[_0x255a('0x9e')](_0x255a('0x9f')),'read':!![],'MailAccountId':_0x125b03['id'],'UserId':_0x2fdb0b['user']['id'],'ContactId':_0x2a2ba9['id']})]};if(_0x2fdb0b[_0x255a('0x5c')]['Interaction']){_0xb760b8=_['merge'](_0xb760b8,_0x2fdb0b[_0x255a('0x5c')]['Interaction']);}return db[_0x255a('0x8a')]['create'](_0xb760b8,{'include':[{'model':db[_0x255a('0x9b')],'as':_0x255a('0xb4')}]});}})[_0x255a('0x20')](respondWithResult(_0x3ee46e,null))[_0x255a('0x2b')](handleError(_0x3ee46e,null));};exports[_0x255a('0xb5')]=function(_0x2f165e,_0x3b4a6d,_0x453aef){return db[_0x255a('0x42')][_0x255a('0x5b')]({'where':{'id':_0x2f165e[_0x255a('0x58')]['id']},'include':[{'model':db[_0x255a('0x3d')],'as':_0x255a('0x3e'),'raw':!![]}]})[_0x255a('0x20')](handleEntityNotFound(_0x3b4a6d,null))['then'](function(_0x41b7be){if(_0x41b7be&&_0x41b7be[_0x255a('0x3e')]){var _0x28d354={'id':_0x41b7be['id'],'tls':{'rejectUnauthorized':![]}};if(_0x41b7be['Smtp'][_0x255a('0x78')]){_0x28d354['service']=_0x41b7be['Smtp']['service'];}else{_0x28d354[_0x255a('0x76')]=_0x41b7be[_0x255a('0x3e')][_0x255a('0x76')];_0x28d354[_0x255a('0x77')]=_0x41b7be[_0x255a('0x3e')]['port'];_0x28d354['secure']=_0x41b7be[_0x255a('0x3e')][_0x255a('0xab')];}if(_0x41b7be[_0x255a('0x3e')][_0x255a('0x75')]){_0x28d354[_0x255a('0xaa')]={'user':_0x41b7be['Smtp'][_0x255a('0x71')],'pass':_0x41b7be[_0x255a('0x3e')][_0x255a('0x74')]};}return respondWithRpcPromise('VerifySmtp',_0x255a('0xb5'),{'account':_0x28d354});}})[_0x255a('0x20')](respondWithResult(_0x3b4a6d,null))[_0x255a('0x2b')](handleError(_0x3b4a6d,null));};exports['destroy']=function(_0x70d38,_0x9e8664){return db[_0x255a('0x42')]['find']({'where':{'id':_0x70d38[_0x255a('0x58')]['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x9e8664,null))[_0x255a('0x20')](function(_0x279f48){if(_0x279f48&&_0x279f48[_0x255a('0x78')]){throw new db['Sequelize'][(_0x255a('0xb6'))](_0x255a('0xb7'));}return _0x279f48;})[_0x255a('0x20')](removeEntity(_0x9e8664,null))[_0x255a('0x2b')](handleError(_0x9e8664,null));};exports[_0x255a('0xb8')]=function(_0x27ada3,_0x58380c,_0x35af8b){return db['MailAccount']['find']({'where':{'id':_0x27ada3[_0x255a('0x58')]['id']}})['then'](handleEntityNotFound(_0x58380c,null))[_0x255a('0x20')](function(_0x579d27){if(_0x579d27){return _0x579d27[_0x255a('0xb8')](_0x27ada3[_0x255a('0x5c')][_0x255a('0x68')],_['omit'](_0x27ada3[_0x255a('0x5c')],[_0x255a('0x68'),'id'])||{})['spread'](function(_0x888e8e){for(var _0x161814=0x0;_0x161814<_0x27ada3[_0x255a('0x5c')][_0x255a('0x68')]['length'];_0x161814+=0x1){socket['emit'](_0x255a('0xb9'),{'UserId':_0x27ada3[_0x255a('0x5c')]['ids'][_0x161814],'MailAccountId':_0x27ada3[_0x255a('0x58')]['id']});}return _0x888e8e;});}})[_0x255a('0x20')](respondWithResult(_0x58380c,null))[_0x255a('0x2b')](handleError(_0x58380c,null));};exports[_0x255a('0xba')]=function(_0x1035e2,_0x4ab6c1,_0x37377b){return db[_0x255a('0x42')]['find']({'where':{'id':_0x1035e2['params']['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x4ab6c1,null))[_0x255a('0x20')](function(_0x12225b){if(_0x12225b){return _0x12225b[_0x255a('0xba')](_0x1035e2[_0x255a('0x47')][_0x255a('0x68')])['then'](function(){if(_[_0x255a('0xbb')](_0x1035e2[_0x255a('0x47')][_0x255a('0x68')])){for(var _0xf7f9b6=0x0;_0xf7f9b6<_0x1035e2[_0x255a('0x47')]['ids'][_0x255a('0x4d')];_0xf7f9b6+=0x1){socket[_0x255a('0xbc')](_0x255a('0xbd'),{'UserId':Number(_0x1035e2[_0x255a('0x47')][_0x255a('0x68')][_0xf7f9b6]),'MailAccountId':Number(_0x1035e2[_0x255a('0x58')]['id'])});}}else{socket[_0x255a('0xbc')](_0x255a('0xbd'),{'UserId':Number(_0x1035e2[_0x255a('0x47')][_0x255a('0x68')]),'MailAccountId':Number(_0x1035e2[_0x255a('0x58')]['id'])});}});}})[_0x255a('0x20')](respondWithStatusCode(_0x4ab6c1,null))[_0x255a('0x2b')](handleError(_0x4ab6c1,null));};exports[_0x255a('0xbe')]=function(_0x396b59,_0x2a3cc3,_0x585c29){var _0x31339b={};var _0x2c8d99={};var _0x1107d9;var _0x7d4b3b;return db[_0x255a('0x42')][_0x255a('0x63')]({'where':{'id':_0x396b59[_0x255a('0x58')]['id']}})[_0x255a('0x20')](handleEntityNotFound(_0x2a3cc3,null))[_0x255a('0x20')](function(_0x52ca88){if(_0x52ca88){_0x1107d9=_0x52ca88;_0x2c8d99[_0x255a('0x46')]=_['keys'](db[_0x255a('0xbf')][_0x255a('0x43')]);_0x2c8d99[_0x255a('0x47')]=_[_0x255a('0x48')](_0x396b59[_0x255a('0x47')]);_0x2c8d99[_0x255a('0x49')]=_[_0x255a('0x4a')](_0x2c8d99[_0x255a('0x46')],_0x2c8d99[_0x255a('0x47')]);_0x31339b[_0x255a('0x4b')]=_[_0x255a('0x4a')](_0x2c8d99[_0x255a('0x46')],qs[_0x255a('0x4c')](_0x396b59[_0x255a('0x47')][_0x255a('0x4c')]));_0x31339b[_0x255a('0x4b')]=_0x31339b['attributes']['length']?_0x31339b[_0x255a('0x4b')]:_0x2c8d99['model'];_0x31339b['order']=qs['sort'](_0x396b59[_0x255a('0x47')][_0x255a('0x51')]);_0x31339b[_0x255a('0x52')]=qs['filters'](_[_0x255a('0x65')](_0x396b59['query'],_0x2c8d99[_0x255a('0x49')]));if(_0x396b59[_0x255a('0x47')]['filter']){_0x31339b[_0x255a('0x52')]=_['merge'](_0x31339b[_0x255a('0x52')],{'$or':_[_0x255a('0x41')](_0x31339b[_0x255a('0x4b')],function(_0x214418){var _0x3482d0={};_0x3482d0[_0x214418]={'$like':'%'+_0x396b59[_0x255a('0x47')][_0x255a('0x53')]+'%'};return _0x3482d0;})});}_0x31339b=_[_0x255a('0x54')]({},_0x31339b,_0x396b59[_0x255a('0x55')]);return _0x1107d9[_0x255a('0xbe')](_0x31339b);}})['then'](function(_0x444372){if(_0x444372){_0x7d4b3b=_0x444372['length'];if(!_0x396b59['query'][_0x255a('0x4e')](_0x255a('0x4f'))){_0x31339b[_0x255a('0x30')]=qs[_0x255a('0x30')](_0x396b59[_0x255a('0x47')][_0x255a('0x30')]);_0x31339b[_0x255a('0x50')]=qs[_0x255a('0x50')](_0x396b59[_0x255a('0x47')][_0x255a('0x50')]);}return _0x1107d9['getAgents'](_0x31339b);}})[_0x255a('0x20')](function(_0x35c9bd){if(_0x35c9bd){return _0x35c9bd?{'count':_0x7d4b3b,'rows':_0x35c9bd}:null;}})['then'](respondWithResult(_0x2a3cc3,null))[_0x255a('0x2b')](handleError(_0x2a3cc3,null));}; \ No newline at end of file +var _0xf578=['Interaction','Messages','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','html-to-text','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','http','request','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','limit','set','apply','reject','save','then','MailAccounts','UserProfileResource','destroy','name','send','index','Imap','MailServerOut','Smtp','map','MailAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','params','MailServerIn','Pause','mandatoryDispositionPause','find','update','body','describe','addDisposition','Disposition','create','getDispositions','findOne','hasOwnProperty','pick','MailAccountId','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','key','email','ListId','isNil','active','cservice','user','pass','authentication','host','port','service','cpassword','get','role','UserProfileSection','userProfileId','autoAssociation','getImap','addImap','removeImap','setImap','addSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','fullname','Tag','Tags','color','tag','sequelize','transaction','bulkCreate','MailApplication','priority','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','true','CmList','Contacts','DESC','%s\x20<%s>','attachments','root','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','List','subject','attach','out','messageId'];(function(_0x56102a,_0x513e52){var _0x31bdbf=function(_0x218d9d){while(--_0x218d9d){_0x56102a['push'](_0x56102a['shift']());}};_0x31bdbf(++_0x513e52);}(_0xf578,0xbf));var _0x8f57=function(_0x53b8e0,_0x55d46e){_0x53b8e0=_0x53b8e0-0x0;var _0x10630c=_0xf578[_0x53b8e0];return _0x10630c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8f57('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8f57('0x1'));var rp=require(_0x8f57('0x2'));var moment=require(_0x8f57('0x3'));var BPromise=require(_0x8f57('0x4'));var Mustache=require(_0x8f57('0x5'));var util=require('util');var path=require(_0x8f57('0x6'));var sox=require(_0x8f57('0x7'));var csv=require(_0x8f57('0x8'));var ejs=require(_0x8f57('0x9'));var fs=require('fs');var _=require(_0x8f57('0xa'));var squel=require(_0x8f57('0xb'));var crypto=require(_0x8f57('0xc'));var jsforce=require(_0x8f57('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8f57('0xe'));var htmlToText=require(_0x8f57('0xf'));var juice=require('juice');var Redis=require(_0x8f57('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8f57('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8f57('0x12'))(_0x8f57('0x13'));var utils=require(_0x8f57('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8f57('0x15')]=_[_0x8f57('0x16')](config['redis'],{'host':_0x8f57('0x17'),'port':0x18eb});var socket=require(_0x8f57('0x18'))(new Redis(config[_0x8f57('0x15')]));require(_0x8f57('0x19'))[_0x8f57('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x8f57('0x1b')]({'port':0x232b});function respondWithRpcPromise(_0x4bd52d,_0x527a63,_0x509423,_0x58f7ff){return new BPromise(function(_0x312705,_0x5454a8){var _0x294726=_0x58f7ff||client;return _0x294726[_0x8f57('0x1c')](_0x4bd52d,_0x509423)['then'](function(_0x1c2ee2){logger[_0x8f57('0x1d')]('MailAccount,\x20%s,\x20%s',_0x527a63,_0x8f57('0x1e'));logger[_0x8f57('0x1f')](_0x8f57('0x20'),_0x527a63,'request\x20sent',JSON['stringify'](_0x1c2ee2));if(_0x1c2ee2[_0x8f57('0x21')]){if(_0x1c2ee2[_0x8f57('0x21')][_0x8f57('0x22')]===0x1f4){logger[_0x8f57('0x21')](_0x8f57('0x23'),_0x527a63,_0x1c2ee2[_0x8f57('0x21')][_0x8f57('0x24')]);return _0x5454a8(_0x1c2ee2['error'][_0x8f57('0x24')]);}logger['error'](_0x8f57('0x23'),_0x527a63,_0x1c2ee2[_0x8f57('0x21')][_0x8f57('0x24')]);return _0x312705(_0x1c2ee2['error'][_0x8f57('0x24')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x527a63,_0x8f57('0x1e'));_0x312705(_0x1c2ee2['result']['message']);}})[_0x8f57('0x25')](function(_0x2d862f){logger[_0x8f57('0x21')](_0x8f57('0x23'),_0x527a63,_0x2d862f);_0x5454a8(_0x2d862f);});});}function respondWithStatusCode(_0x526fa6,_0x1f1e65){_0x1f1e65=_0x1f1e65||0xcc;return function(_0x424a1d){if(_0x424a1d){return _0x526fa6[_0x8f57('0x26')](_0x1f1e65);}return _0x526fa6[_0x8f57('0x27')](_0x1f1e65)[_0x8f57('0x28')]();};}function respondWithResult(_0x57dee6,_0x2a3150){_0x2a3150=_0x2a3150||0xc8;return function(_0x597c29){if(_0x597c29){return _0x57dee6[_0x8f57('0x27')](_0x2a3150)[_0x8f57('0x29')](_0x597c29);}};}function respondWithFilteredResult(_0x331725,_0x209ff5){return function(_0x46bc32){if(_0x46bc32){var _0x58bbf2=_0x46bc32['count'],_0x1cccf3=_0x209ff5[_0x8f57('0x2a')],_0x36b703=_0x209ff5[_0x8f57('0x2a')]+_0x209ff5[_0x8f57('0x2b')],_0x134e46;if(_0x36b703>=_0x58bbf2){_0x36b703=_0x58bbf2;_0x134e46=0xc8;}else{_0x134e46=0xce;}_0x331725['status'](_0x134e46);return _0x331725[_0x8f57('0x2c')]('Content-Range',_0x1cccf3+'-'+_0x36b703+'/'+_0x58bbf2)[_0x8f57('0x29')](_0x46bc32);}return null;};}function patchUpdates(_0x344d5e){return function(_0x100b1e){try{jsonpatch[_0x8f57('0x2d')](_0x100b1e,_0x344d5e,!![]);}catch(_0x31ceb4){return BPromise[_0x8f57('0x2e')](_0x31ceb4);}return _0x100b1e[_0x8f57('0x2f')]();};}function saveUpdates(_0x2f159a,_0x57dc86){return function(_0x7f5884){if(_0x7f5884){return _0x7f5884['update'](_0x2f159a)[_0x8f57('0x30')](function(_0x57f256){return _0x57f256;});}return null;};}function removeEntity(_0x2f3c30,_0x2984cd){return function(_0x5ed8a2){if(_0x5ed8a2){return _0x5ed8a2['destroy']()[_0x8f57('0x30')](function(){var _0x347984=_0x5ed8a2['get']({'plain':!![]});var _0x39eae1=_0x8f57('0x31');return db[_0x8f57('0x32')][_0x8f57('0x33')]({'where':{'type':_0x39eae1,'resourceId':_0x347984['id']}})[_0x8f57('0x30')](function(){return _0x5ed8a2;});})[_0x8f57('0x30')](function(){_0x2f3c30['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x35917a,_0x23b828){return function(_0x77f0be){if(!_0x77f0be){_0x35917a[_0x8f57('0x26')](0x194);}return _0x77f0be;};}function handleError(_0x4cc3aa,_0x2496d0){_0x2496d0=_0x2496d0||0x1f4;return function(_0x55b8af){logger[_0x8f57('0x21')](_0x55b8af['stack']);if(_0x55b8af[_0x8f57('0x34')]){delete _0x55b8af[_0x8f57('0x34')];}_0x4cc3aa[_0x8f57('0x27')](_0x2496d0)[_0x8f57('0x35')](_0x55b8af);};}exports[_0x8f57('0x36')]=function(_0x3ac641,_0x4df56e){var _0x4c2aaa={'include':[{'model':db['MailServerIn'],'as':_0x8f57('0x37')},{'model':db[_0x8f57('0x38')],'as':_0x8f57('0x39')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x17f657={},_0x12a81b={'count':0x0,'rows':[]};var _0x3e7be2=_[_0x8f57('0x3a')](db[_0x8f57('0x3b')][_0x8f57('0x3c')],function(_0x11233e){return{'name':_0x11233e[_0x8f57('0x3d')],'type':_0x11233e[_0x8f57('0x3e')]['key']};});_0x17f657['model']=_[_0x8f57('0x3a')](_0x3e7be2,_0x8f57('0x34'));_0x17f657[_0x8f57('0x3f')]=_[_0x8f57('0x40')](_0x3ac641[_0x8f57('0x3f')]);_0x17f657[_0x8f57('0x41')]=_[_0x8f57('0x42')](_0x17f657[_0x8f57('0x43')],_0x17f657[_0x8f57('0x3f')]);_0x4c2aaa[_0x8f57('0x44')]=_[_0x8f57('0x42')](_0x17f657['model'],qs[_0x8f57('0x45')](_0x3ac641[_0x8f57('0x3f')][_0x8f57('0x45')]));_0x4c2aaa[_0x8f57('0x44')]=_0x4c2aaa[_0x8f57('0x44')][_0x8f57('0x46')]?_0x4c2aaa['attributes']:_0x17f657[_0x8f57('0x43')];if(!_0x3ac641[_0x8f57('0x3f')]['hasOwnProperty'](_0x8f57('0x47'))){_0x4c2aaa[_0x8f57('0x2b')]=qs['limit'](_0x3ac641['query'][_0x8f57('0x2b')]);_0x4c2aaa[_0x8f57('0x2a')]=qs['offset'](_0x3ac641[_0x8f57('0x3f')][_0x8f57('0x2a')]);}_0x4c2aaa[_0x8f57('0x48')]=qs[_0x8f57('0x49')](_0x3ac641[_0x8f57('0x3f')][_0x8f57('0x49')]);_0x4c2aaa[_0x8f57('0x4a')]=qs[_0x8f57('0x41')](_['pick'](_0x3ac641[_0x8f57('0x3f')],_0x17f657[_0x8f57('0x41')]),_0x3e7be2);if(_0x3ac641[_0x8f57('0x3f')][_0x8f57('0x4b')]){_0x4c2aaa[_0x8f57('0x4a')]=_[_0x8f57('0x4c')](_0x4c2aaa[_0x8f57('0x4a')],{'$or':_[_0x8f57('0x3a')](_0x3e7be2,function(_0x31c638){if(_0x31c638[_0x8f57('0x3e')]!==_0x8f57('0x4d')){var _0x34be96={};_0x34be96[_0x31c638['name']]={'$like':'%'+_0x3ac641[_0x8f57('0x3f')][_0x8f57('0x4b')]+'%'};return _0x34be96;}})});}_0x4c2aaa=_[_0x8f57('0x4c')]({},_0x4c2aaa,_0x3ac641[_0x8f57('0x4e')]);var _0x20b914={'where':_0x4c2aaa['where']};return db[_0x8f57('0x3b')][_0x8f57('0x4f')](_0x20b914)['then'](function(_0x30d00a){_0x12a81b[_0x8f57('0x4f')]=_0x30d00a;if(_0x3ac641['query'][_0x8f57('0x50')]){_0x4c2aaa[_0x8f57('0x51')]=[{'all':!![]}];}return db[_0x8f57('0x3b')]['findAll'](_0x4c2aaa);})[_0x8f57('0x30')](function(_0x2653cd){_0x12a81b[_0x8f57('0x52')]=_0x2653cd;return _0x12a81b;})[_0x8f57('0x30')](respondWithFilteredResult(_0x4df56e,_0x4c2aaa))['catch'](handleError(_0x4df56e,null));};exports[_0x8f57('0x53')]=function(_0x24156a,_0x832d67){var _0x84104d={'raw':![],'where':{'id':_0x24156a[_0x8f57('0x54')]['id']},'include':[{'model':db[_0x8f57('0x55')],'as':_0x8f57('0x37')},{'model':db['MailServerOut'],'as':_0x8f57('0x39')},{'model':db[_0x8f57('0x56')],'as':_0x8f57('0x57')}]},_0x32ab69={};_0x32ab69[_0x8f57('0x43')]=_[_0x8f57('0x40')](db[_0x8f57('0x3b')][_0x8f57('0x3c')]);_0x32ab69[_0x8f57('0x3f')]=_[_0x8f57('0x40')](_0x24156a['query']);_0x32ab69[_0x8f57('0x41')]=_[_0x8f57('0x42')](_0x32ab69[_0x8f57('0x43')],_0x32ab69['query']);_0x84104d[_0x8f57('0x44')]=_[_0x8f57('0x42')](_0x32ab69[_0x8f57('0x43')],qs['fields'](_0x24156a[_0x8f57('0x3f')][_0x8f57('0x45')]));_0x84104d[_0x8f57('0x44')]=_0x84104d['attributes'][_0x8f57('0x46')]?_0x84104d[_0x8f57('0x44')]:_0x32ab69['model'];if(_0x24156a[_0x8f57('0x3f')][_0x8f57('0x50')]){_0x84104d['include']=[{'all':!![]}];}_0x84104d=_['merge']({},_0x84104d,_0x24156a[_0x8f57('0x4e')]);return db[_0x8f57('0x3b')][_0x8f57('0x58')](_0x84104d)[_0x8f57('0x30')](handleEntityNotFound(_0x832d67,null))['then'](respondWithResult(_0x832d67,null))[_0x8f57('0x25')](handleError(_0x832d67,null));};exports[_0x8f57('0x59')]=function(_0xed1454,_0x59e49f){if(_0xed1454[_0x8f57('0x5a')]['id']){delete _0xed1454[_0x8f57('0x5a')]['id'];}return db[_0x8f57('0x3b')][_0x8f57('0x58')]({'where':{'id':_0xed1454[_0x8f57('0x54')]['id']},'include':[{'model':db[_0x8f57('0x55')],'as':_0x8f57('0x37')},{'model':db['MailServerOut'],'as':_0x8f57('0x39')},{'model':db['Pause'],'as':_0x8f57('0x57')}]})['then'](handleEntityNotFound(_0x59e49f,null))[_0x8f57('0x30')](saveUpdates(_0xed1454[_0x8f57('0x5a')],null))[_0x8f57('0x30')](function(_0x3ae11d){if(_0x3ae11d&&_0xed1454[_0x8f57('0x5a')]['Imap']){return db[_0x8f57('0x55')]['update'](_0xed1454['body'][_0x8f57('0x37')],{'where':{'MailAccountId':_0x3ae11d['id']}})[_0x8f57('0x30')](function(){return _0x3ae11d;});}return _0x3ae11d;})[_0x8f57('0x30')](function(_0x3a3e0e){if(_0x3a3e0e&&_0xed1454[_0x8f57('0x5a')][_0x8f57('0x39')]){return db[_0x8f57('0x38')][_0x8f57('0x59')](_0xed1454[_0x8f57('0x5a')][_0x8f57('0x39')],{'where':{'MailAccountId':_0x3a3e0e['id']}})[_0x8f57('0x30')](function(){return _0x3a3e0e;});}return _0x3a3e0e;})['then'](respondWithResult(_0x59e49f,null))['catch'](handleError(_0x59e49f,null));};exports[_0x8f57('0x5b')]=function(_0x2b6269,_0x43172b){return db['MailAccount'][_0x8f57('0x5b')]()[_0x8f57('0x30')](respondWithResult(_0x43172b,null))[_0x8f57('0x25')](handleError(_0x43172b,null));};exports[_0x8f57('0x5c')]=function(_0x509395,_0xc852d1,_0xca9d7b){if(_0x509395[_0x8f57('0x5a')]['id']){delete _0x509395[_0x8f57('0x5a')]['id'];}return db[_0x8f57('0x3b')][_0x8f57('0x58')]({'where':{'id':_0x509395[_0x8f57('0x54')]['id']}})['then'](handleEntityNotFound(_0xc852d1,null))['then'](function(_0x54af54){if(_0x54af54){_0x509395[_0x8f57('0x5a')]['MailAccountId']=_0x54af54['id'];return db[_0x8f57('0x5d')][_0x8f57('0x5e')](_0x509395[_0x8f57('0x5a')]);}})['then'](respondWithResult(_0xc852d1,null))[_0x8f57('0x25')](handleError(_0xc852d1,null));};exports[_0x8f57('0x5f')]=function(_0x291423,_0x4c8d76,_0x4e38e8){var _0x5b56f6={'raw':![],'where':{}};var _0x3a33f4={};var _0x42e0a9={'count':0x0,'rows':[]};return db[_0x8f57('0x3b')][_0x8f57('0x60')]({'where':{'id':_0x291423[_0x8f57('0x54')]['id']}})[_0x8f57('0x30')](handleEntityNotFound(_0x4c8d76,null))[_0x8f57('0x30')](function(_0x29d843){if(_0x29d843){_0x3a33f4[_0x8f57('0x43')]=_['keys'](db['Disposition']['rawAttributes']);_0x3a33f4[_0x8f57('0x3f')]=_[_0x8f57('0x40')](_0x291423[_0x8f57('0x3f')]);_0x3a33f4[_0x8f57('0x41')]=_[_0x8f57('0x42')](_0x3a33f4[_0x8f57('0x43')],_0x3a33f4[_0x8f57('0x3f')]);_0x5b56f6[_0x8f57('0x44')]=_['intersection'](_0x3a33f4[_0x8f57('0x43')],qs['fields'](_0x291423[_0x8f57('0x3f')][_0x8f57('0x45')]));_0x5b56f6[_0x8f57('0x44')]=_0x5b56f6['attributes']['length']?_0x5b56f6[_0x8f57('0x44')]:_0x3a33f4[_0x8f57('0x43')];if(!_0x291423[_0x8f57('0x3f')][_0x8f57('0x61')](_0x8f57('0x47'))){_0x5b56f6[_0x8f57('0x2b')]=qs[_0x8f57('0x2b')](_0x291423['query']['limit']);_0x5b56f6[_0x8f57('0x2a')]=qs[_0x8f57('0x2a')](_0x291423[_0x8f57('0x3f')][_0x8f57('0x2a')]);}_0x5b56f6[_0x8f57('0x48')]=qs[_0x8f57('0x49')](_0x291423[_0x8f57('0x3f')]['sort']);_0x5b56f6[_0x8f57('0x4a')]=qs[_0x8f57('0x41')](_[_0x8f57('0x62')](_0x291423[_0x8f57('0x3f')],_0x3a33f4[_0x8f57('0x41')]));_0x5b56f6[_0x8f57('0x4a')][_0x8f57('0x63')]=_0x29d843['id'];if(_0x291423[_0x8f57('0x3f')]['filter']){_0x5b56f6[_0x8f57('0x4a')]=_['merge'](_0x5b56f6[_0x8f57('0x4a')],{'$or':_[_0x8f57('0x3a')](_0x5b56f6[_0x8f57('0x44')],function(_0x3c0356){var _0x271908={};_0x271908[_0x3c0356]={'$like':'%'+_0x291423[_0x8f57('0x3f')][_0x8f57('0x4b')]+'%'};return _0x271908;})});}_0x5b56f6=_['merge']({},_0x5b56f6,_0x291423[_0x8f57('0x4e')]);return db[_0x8f57('0x5d')]['count']({'where':_0x5b56f6['where']})['then'](function(_0x5d60b6){_0x42e0a9[_0x8f57('0x4f')]=_0x5d60b6;if(_0x291423['query'][_0x8f57('0x50')]){_0x5b56f6[_0x8f57('0x51')]=[{'all':!![]}];}return db[_0x8f57('0x5d')][_0x8f57('0x64')](_0x5b56f6);})['then'](function(_0x337b17){_0x42e0a9[_0x8f57('0x52')]=_0x337b17;return _0x42e0a9;});}})[_0x8f57('0x30')](respondWithFilteredResult(_0x4c8d76,_0x5b56f6))[_0x8f57('0x25')](handleError(_0x4c8d76,null));};exports[_0x8f57('0x65')]=function(_0x436863,_0x4341a3,_0x5d63ea){return db[_0x8f57('0x3b')][_0x8f57('0x58')]({'where':{'id':_0x436863[_0x8f57('0x54')]['id']}})['then'](handleEntityNotFound(_0x4341a3,null))[_0x8f57('0x30')](function(_0xecd76){if(_0xecd76){return _0xecd76[_0x8f57('0x65')](_0x436863[_0x8f57('0x3f')][_0x8f57('0x66')]);}})[_0x8f57('0x30')](respondWithStatusCode(_0x4341a3,null))['catch'](handleError(_0x4341a3,null));};exports[_0x8f57('0x67')]=function(_0x36c020,_0x5677ba,_0x416bf9){if(_0x36c020[_0x8f57('0x5a')]['id']){delete _0x36c020[_0x8f57('0x5a')]['id'];}return db[_0x8f57('0x3b')][_0x8f57('0x58')]({'where':{'id':_0x36c020[_0x8f57('0x54')]['id']}})['then'](handleEntityNotFound(_0x5677ba,null))['then'](function(_0x552a82){if(_0x552a82){_0x36c020[_0x8f57('0x5a')][_0x8f57('0x63')]=_0x552a82['id'];return db['CannedAnswer'][_0x8f57('0x5e')](_0x36c020[_0x8f57('0x5a')]);}})[_0x8f57('0x30')](respondWithResult(_0x5677ba,null))[_0x8f57('0x25')](handleError(_0x5677ba,null));};exports[_0x8f57('0x68')]=function(_0x4eb5fd,_0x2b11e3,_0x14bac5){var _0x2f040e={'raw':![],'where':{}};var _0x3cfa97={};var _0x57aeec={'count':0x0,'rows':[]};return db[_0x8f57('0x3b')]['findOne']({'where':{'id':_0x4eb5fd[_0x8f57('0x54')]['id']}})['then'](handleEntityNotFound(_0x2b11e3,null))[_0x8f57('0x30')](function(_0x1103bc){if(_0x1103bc){_0x3cfa97[_0x8f57('0x43')]=_['keys'](db[_0x8f57('0x69')]['rawAttributes']);_0x3cfa97[_0x8f57('0x3f')]=_['keys'](_0x4eb5fd[_0x8f57('0x3f')]);_0x3cfa97[_0x8f57('0x41')]=_['intersection'](_0x3cfa97[_0x8f57('0x43')],_0x3cfa97['query']);_0x2f040e[_0x8f57('0x44')]=_[_0x8f57('0x42')](_0x3cfa97['model'],qs[_0x8f57('0x45')](_0x4eb5fd[_0x8f57('0x3f')][_0x8f57('0x45')]));_0x2f040e[_0x8f57('0x44')]=_0x2f040e['attributes'][_0x8f57('0x46')]?_0x2f040e[_0x8f57('0x44')]:_0x3cfa97['model'];if(!_0x4eb5fd[_0x8f57('0x3f')][_0x8f57('0x61')]('nolimit')){_0x2f040e[_0x8f57('0x2b')]=qs['limit'](_0x4eb5fd[_0x8f57('0x3f')][_0x8f57('0x2b')]);_0x2f040e['offset']=qs[_0x8f57('0x2a')](_0x4eb5fd[_0x8f57('0x3f')][_0x8f57('0x2a')]);}_0x2f040e['order']=qs[_0x8f57('0x49')](_0x4eb5fd[_0x8f57('0x3f')][_0x8f57('0x49')]);_0x2f040e['where']=qs[_0x8f57('0x41')](_[_0x8f57('0x62')](_0x4eb5fd[_0x8f57('0x3f')],_0x3cfa97[_0x8f57('0x41')]));_0x2f040e['where']['MailAccountId']=_0x1103bc['id'];if(_0x4eb5fd['query'][_0x8f57('0x4b')]){_0x2f040e[_0x8f57('0x4a')]=_[_0x8f57('0x4c')](_0x2f040e[_0x8f57('0x4a')],{'$or':_[_0x8f57('0x3a')](_0x2f040e['attributes'],function(_0x5a1bd1){var _0x3cebd3={};_0x3cebd3[_0x5a1bd1]={'$like':'%'+_0x4eb5fd[_0x8f57('0x3f')][_0x8f57('0x4b')]+'%'};return _0x3cebd3;})});}_0x2f040e=_[_0x8f57('0x4c')]({},_0x2f040e,_0x4eb5fd[_0x8f57('0x4e')]);return db[_0x8f57('0x69')][_0x8f57('0x4f')]({'where':_0x2f040e['where']})[_0x8f57('0x30')](function(_0x47bdfe){_0x57aeec[_0x8f57('0x4f')]=_0x47bdfe;if(_0x4eb5fd[_0x8f57('0x3f')][_0x8f57('0x50')]){_0x2f040e[_0x8f57('0x51')]=[{'all':!![]}];}return db[_0x8f57('0x69')][_0x8f57('0x64')](_0x2f040e);})[_0x8f57('0x30')](function(_0x409d83){_0x57aeec[_0x8f57('0x52')]=_0x409d83;return _0x57aeec;});}})[_0x8f57('0x30')](respondWithFilteredResult(_0x2b11e3,_0x2f040e))[_0x8f57('0x25')](handleError(_0x2b11e3,null));};exports[_0x8f57('0x6a')]=function(_0x108d42,_0x4c0caa,_0x51a827){return db[_0x8f57('0x3b')]['find']({'where':{'id':_0x108d42[_0x8f57('0x54')]['id']}})[_0x8f57('0x30')](handleEntityNotFound(_0x4c0caa,null))['then'](function(_0x3c27a0){if(_0x3c27a0){return _0x3c27a0['removeAnswers'](_0x108d42[_0x8f57('0x3f')][_0x8f57('0x66')]);}})[_0x8f57('0x30')](respondWithStatusCode(_0x4c0caa,null))['catch'](handleError(_0x4c0caa,null));};exports[_0x8f57('0x5e')]=function(_0x53cd79,_0x33e5ee){var _0x34cd7f={'name':_0x53cd79[_0x8f57('0x5a')][_0x8f57('0x34')],'key':_0x53cd79[_0x8f57('0x5a')][_0x8f57('0x6b')],'email':_0x53cd79[_0x8f57('0x5a')][_0x8f57('0x6c')],'ListId':_0x53cd79['body'][_0x8f57('0x6d')],'active':!_[_0x8f57('0x6e')](_0x53cd79[_0x8f57('0x5a')][_0x8f57('0x6f')])?_0x53cd79[_0x8f57('0x5a')][_0x8f57('0x6f')]:!![],'description':_0x53cd79[_0x8f57('0x5a')]['description']||null,'Imap':{},'Smtp':{}};if(_[_0x8f57('0x6e')](_0x53cd79[_0x8f57('0x5a')][_0x8f57('0x70')])){if(_0x53cd79[_0x8f57('0x5a')]['cauthentication']){_0x34cd7f['Imap'][_0x8f57('0x71')]=_0x34cd7f[_0x8f57('0x39')][_0x8f57('0x71')]=_0x53cd79['body']['cuser'];_0x34cd7f[_0x8f57('0x37')]['password']=_0x34cd7f[_0x8f57('0x39')][_0x8f57('0x72')]=_0x53cd79['body']['cpassword'];}else{_0x34cd7f[_0x8f57('0x37')][_0x8f57('0x73')]=_0x34cd7f[_0x8f57('0x39')][_0x8f57('0x73')]=![];}_0x34cd7f[_0x8f57('0x37')][_0x8f57('0x74')]=_0x53cd79[_0x8f57('0x5a')][_0x8f57('0x37')][_0x8f57('0x74')];_0x34cd7f['Imap']['port']=_0x53cd79['body']['Imap'][_0x8f57('0x75')];_0x34cd7f['Smtp']['host']=_0x53cd79['body'][_0x8f57('0x39')][_0x8f57('0x74')];_0x34cd7f['Smtp']['port']=_0x53cd79[_0x8f57('0x5a')][_0x8f57('0x39')][_0x8f57('0x75')];}else{_0x34cd7f['Imap'][_0x8f57('0x76')]=_0x34cd7f[_0x8f57('0x39')][_0x8f57('0x76')]=_0x53cd79[_0x8f57('0x5a')][_0x8f57('0x70')];_0x34cd7f[_0x8f57('0x37')]['user']=_0x34cd7f['Smtp']['user']=_0x53cd79[_0x8f57('0x5a')]['cuser'];_0x34cd7f[_0x8f57('0x37')]['password']=_0x34cd7f['Smtp']['pass']=_0x53cd79[_0x8f57('0x5a')][_0x8f57('0x77')];}return db['MailAccount'][_0x8f57('0x5e')](_0x34cd7f,{'include':[{'model':db[_0x8f57('0x38')],'as':_0x8f57('0x39')},{'model':db[_0x8f57('0x55')],'as':_0x8f57('0x37')}]})['then'](function(_0x4b8834){var _0x4c569a=_0x53cd79[_0x8f57('0x71')][_0x8f57('0x78')]({'plain':!![]});if(!_0x4c569a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c569a[_0x8f57('0x79')]===_0x8f57('0x71')){var _0x4f0c2a=_0x4b8834['get']({'plain':!![]});return db[_0x8f57('0x7a')][_0x8f57('0x58')]({'where':{'name':_0x8f57('0x31'),'userProfileId':_0x4c569a[_0x8f57('0x7b')]},'raw':!![]})['then'](function(_0x2ffebf){if(_0x2ffebf&&_0x2ffebf[_0x8f57('0x7c')]===0x0){return db['UserProfileResource'][_0x8f57('0x5e')]({'name':_0x4f0c2a['name'],'resourceId':_0x4f0c2a['id'],'type':_0x2ffebf[_0x8f57('0x34')],'sectionId':_0x2ffebf['id']},{})[_0x8f57('0x30')](function(){return _0x4b8834;});}else{return _0x4b8834;}})[_0x8f57('0x25')](function(_0x175b31){logger[_0x8f57('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x175b31);throw _0x175b31;});}return _0x4b8834;})[_0x8f57('0x30')](respondWithResult(_0x33e5ee,0xc9))[_0x8f57('0x25')](handleError(_0x33e5ee,null));};exports[_0x8f57('0x7d')]=function(_0x3b1d46,_0x1d275e,_0x1b2fe1){return db['MailAccount'][_0x8f57('0x60')]({'where':{'id':_0x3b1d46[_0x8f57('0x54')]['id']}})[_0x8f57('0x30')](handleEntityNotFound(_0x1d275e,null))[_0x8f57('0x30')](function(_0xfdb767){if(_0xfdb767){return _0xfdb767[_0x8f57('0x7d')]();}return null;})[_0x8f57('0x30')](respondWithResult(_0x1d275e,null))[_0x8f57('0x25')](handleError(_0x1d275e,null));};exports[_0x8f57('0x7e')]=function(_0x40c090,_0x16d8b0,_0xa44e21){if(_0x40c090[_0x8f57('0x5a')]['id']){delete _0x40c090[_0x8f57('0x5a')]['id'];}return db['MailAccount'][_0x8f57('0x58')]({'where':{'id':_0x40c090[_0x8f57('0x54')]['id']}})[_0x8f57('0x30')](handleEntityNotFound(_0x16d8b0,null))[_0x8f57('0x30')](function(_0x31ec7e){if(_0x31ec7e){_0x40c090[_0x8f57('0x5a')][_0x8f57('0x63')]=_0x31ec7e['id'];return db[_0x8f57('0x55')][_0x8f57('0x5e')](_0x40c090[_0x8f57('0x5a')]);}})[_0x8f57('0x30')](respondWithResult(_0x16d8b0,null))[_0x8f57('0x25')](handleError(_0x16d8b0,null));};exports[_0x8f57('0x7f')]=function(_0x56f89a,_0x539720,_0x2195c8){return db['MailAccount'][_0x8f57('0x60')]({'where':{'id':_0x56f89a[_0x8f57('0x54')]['id']}})[_0x8f57('0x30')](handleEntityNotFound(_0x539720,null))[_0x8f57('0x30')](function(_0x2ca71b){if(_0x2ca71b){return _0x2ca71b[_0x8f57('0x80')](null);}return null;})[_0x8f57('0x30')](respondWithStatusCode(_0x539720,null))[_0x8f57('0x25')](handleError(_0x539720,null));};exports['getSmtp']=function(_0xcbbd73,_0x101eb6,_0x3d6916){return db[_0x8f57('0x3b')][_0x8f57('0x60')]({'where':{'id':_0xcbbd73[_0x8f57('0x54')]['id']}})['then'](handleEntityNotFound(_0x101eb6,null))[_0x8f57('0x30')](function(_0xd8b94e){if(_0xd8b94e){return _0xd8b94e['getSmtp']();}return null;})[_0x8f57('0x30')](respondWithResult(_0x101eb6,null))['catch'](handleError(_0x101eb6,null));};exports[_0x8f57('0x81')]=function(_0x508a12,_0xa3f951,_0x386ae6){if(_0x508a12['body']['id']){delete _0x508a12[_0x8f57('0x5a')]['id'];}return db[_0x8f57('0x3b')][_0x8f57('0x58')]({'where':{'id':_0x508a12['params']['id']}})[_0x8f57('0x30')](handleEntityNotFound(_0xa3f951,null))[_0x8f57('0x30')](function(_0x76d016){if(_0x76d016){_0x508a12[_0x8f57('0x5a')][_0x8f57('0x63')]=_0x76d016['id'];return db[_0x8f57('0x38')][_0x8f57('0x5e')](_0x508a12[_0x8f57('0x5a')]);}})[_0x8f57('0x30')](respondWithResult(_0xa3f951,null))['catch'](handleError(_0xa3f951,null));};exports['removeSmtp']=function(_0x4ea460,_0xeabe0a,_0x4b3190){return db[_0x8f57('0x3b')]['findOne']({'where':{'id':_0x4ea460[_0x8f57('0x54')]['id']}})[_0x8f57('0x30')](handleEntityNotFound(_0xeabe0a,null))[_0x8f57('0x30')](function(_0xe79ef){if(_0xe79ef){return _0xe79ef['setSmtp'](null);}return null;})[_0x8f57('0x30')](respondWithStatusCode(_0xeabe0a,null))['catch'](handleError(_0xeabe0a,null));};exports[_0x8f57('0x82')]=function(_0x417bf4,_0x4990bb,_0x42a08c){return db[_0x8f57('0x83')]['find']({'where':{'id':_0x417bf4['params']['id']}})['then'](handleEntityNotFound(_0x4990bb,null))[_0x8f57('0x30')](function(_0x146040){if(_0x146040){return _0x146040[_0x8f57('0x82')](_0x417bf4['body'][_0x8f57('0x66')],_[_0x8f57('0x84')](_0x417bf4[_0x8f57('0x5a')],[_0x8f57('0x66'),'id'])||{});}})['then'](respondWithResult(_0x4990bb,null))[_0x8f57('0x25')](handleError(_0x4990bb,null));};exports['getInteractions']=function(_0x76224d,_0x44ee6a,_0x20778d){var _0x149439={'raw':![],'where':{}};var _0x42bf9b={};var _0x3e213e={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x76224d[_0x8f57('0x54')]['id']}})[_0x8f57('0x30')](handleEntityNotFound(_0x44ee6a,null))[_0x8f57('0x30')](function(_0x4d37e0){if(_0x4d37e0){_0x42bf9b[_0x8f57('0x43')]=_[_0x8f57('0x40')](db[_0x8f57('0x83')][_0x8f57('0x3c')]);_0x42bf9b[_0x8f57('0x3f')]=_[_0x8f57('0x40')](_0x76224d['query']);_0x42bf9b[_0x8f57('0x41')]=_[_0x8f57('0x42')](_0x42bf9b['model'],_0x42bf9b[_0x8f57('0x3f')]);_0x149439['attributes']=_[_0x8f57('0x42')](_0x42bf9b[_0x8f57('0x43')],qs['fields'](_0x76224d[_0x8f57('0x3f')]['fields']));_0x149439['attributes']=_0x149439[_0x8f57('0x44')]['length']?_0x149439[_0x8f57('0x44')]:_0x42bf9b[_0x8f57('0x43')];if(!_0x76224d[_0x8f57('0x3f')]['hasOwnProperty']('nolimit')){_0x149439[_0x8f57('0x2b')]=qs[_0x8f57('0x2b')](_0x76224d[_0x8f57('0x3f')][_0x8f57('0x2b')]);_0x149439[_0x8f57('0x2a')]=qs[_0x8f57('0x2a')](_0x76224d[_0x8f57('0x3f')][_0x8f57('0x2a')]);}_0x149439['order']=qs['sort'](_0x76224d[_0x8f57('0x3f')]['sort']);_0x149439[_0x8f57('0x4a')]=qs[_0x8f57('0x41')](_[_0x8f57('0x62')](_0x76224d[_0x8f57('0x3f')],_0x42bf9b[_0x8f57('0x41')]));_0x149439[_0x8f57('0x4a')][_0x8f57('0x63')]=_0x4d37e0['id'];if(_0x76224d[_0x8f57('0x3f')]['filter']){_0x149439['where']=_['merge'](_0x149439[_0x8f57('0x4a')],{'$or':_[_0x8f57('0x3a')](_0x149439[_0x8f57('0x44')],function(_0x3b88bd){var _0x2ff577={};_0x2ff577[_0x3b88bd]={'$like':'%'+_0x76224d[_0x8f57('0x3f')][_0x8f57('0x4b')]+'%'};return _0x2ff577;})});}_0x149439=_[_0x8f57('0x4c')]({},_0x149439,_0x76224d[_0x8f57('0x4e')]);return db[_0x8f57('0x83')][_0x8f57('0x4f')]({'where':_0x149439[_0x8f57('0x4a')]})[_0x8f57('0x30')](function(_0x545c63){_0x3e213e[_0x8f57('0x4f')]=_0x545c63;if(_0x76224d['query']['includeAll']){_0x149439[_0x8f57('0x51')]=[{'model':db[_0x8f57('0x85')],'as':_0x8f57('0x86'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x8f57('0x34'),_0x8f57('0x87'),'internal'],'required':![]},{'model':db[_0x8f57('0x88')],'as':_0x8f57('0x89'),'attributes':['id',_0x8f57('0x34'),_0x8f57('0x8a')],'where':_0x76224d[_0x8f57('0x3f')]['tag']?{'id':_0x76224d[_0x8f57('0x3f')][_0x8f57('0x8b')]}:undefined,'required':_0x76224d['query'][_0x8f57('0x8b')]?!![]:![]}];}return db[_0x8f57('0x83')]['findAll'](_0x149439);})[_0x8f57('0x30')](function(_0x32f7b3){_0x3e213e[_0x8f57('0x52')]=_0x32f7b3;return _0x3e213e;});}})['then'](respondWithFilteredResult(_0x44ee6a,_0x149439))[_0x8f57('0x25')](handleError(_0x44ee6a,null));};exports['addApplications']=function(_0x2251d8,_0x262582,_0x3ba67a){return db[_0x8f57('0x3b')][_0x8f57('0x60')]({'where':{'id':_0x2251d8[_0x8f57('0x54')]['id']}})[_0x8f57('0x30')](handleEntityNotFound(_0x262582,null))[_0x8f57('0x30')](function(_0x35c299){if(_0x35c299){return db[_0x8f57('0x8c')][_0x8f57('0x8d')](function(_0x4b7553){return db['MailApplication'][_0x8f57('0x33')]({'where':{'MailAccountId':_0x2251d8[_0x8f57('0x54')]['id']},'transaction':_0x4b7553})[_0x8f57('0x30')](function(_0x1ce9c5){var _0x114169=_[_0x8f57('0x3a')](_0x2251d8[_0x8f57('0x5a')],function(_0x1517ad){_0x1517ad[_0x8f57('0x63')]=_0x2251d8['params']['id'];return _0x1517ad;});return db['MailApplication'][_0x8f57('0x8e')](_0x114169,{'transaction':_0x4b7553});});})[_0x8f57('0x30')](function(){return db[_0x8f57('0x8f')]['findAndCountAll']({'where':{'MailAccountId':_0x2251d8[_0x8f57('0x54')]['id']},'order':_0x8f57('0x90')});});}})[_0x8f57('0x30')](respondWithResult(_0x262582,null))[_0x8f57('0x25')](handleError(_0x262582,null));};exports[_0x8f57('0x91')]=function(_0x926e96,_0x2ec192,_0x26f5bb){var _0x3460ba={};var _0x26a2b4={};var _0x2b85ef;var _0x1b2d72;return db[_0x8f57('0x3b')][_0x8f57('0x60')]({'where':{'id':_0x926e96[_0x8f57('0x54')]['id']}})[_0x8f57('0x30')](handleEntityNotFound(_0x2ec192,null))[_0x8f57('0x30')](function(_0x12df09){if(_0x12df09){_0x2b85ef=_0x12df09;_0x26a2b4['model']=_[_0x8f57('0x40')](db[_0x8f57('0x8f')][_0x8f57('0x3c')]);_0x26a2b4[_0x8f57('0x3f')]=_[_0x8f57('0x40')](_0x926e96[_0x8f57('0x3f')]);_0x26a2b4[_0x8f57('0x41')]=_['intersection'](_0x26a2b4[_0x8f57('0x43')],_0x26a2b4['query']);_0x3460ba['attributes']=_[_0x8f57('0x42')](_0x26a2b4[_0x8f57('0x43')],qs[_0x8f57('0x45')](_0x926e96[_0x8f57('0x3f')][_0x8f57('0x45')]));_0x3460ba[_0x8f57('0x44')]=_0x3460ba[_0x8f57('0x44')][_0x8f57('0x46')]?_0x3460ba[_0x8f57('0x44')]:_0x26a2b4[_0x8f57('0x43')];_0x3460ba[_0x8f57('0x48')]=qs[_0x8f57('0x49')](_0x926e96[_0x8f57('0x3f')][_0x8f57('0x49')]);_0x3460ba[_0x8f57('0x4a')]=qs[_0x8f57('0x41')](_[_0x8f57('0x62')](_0x926e96['query'],_0x26a2b4['filters']));if(_0x926e96['query'][_0x8f57('0x4b')]){_0x3460ba['where']=_[_0x8f57('0x4c')](_0x3460ba[_0x8f57('0x4a')],{'$or':_['map'](_0x3460ba['attributes'],function(_0x5106a2){var _0x4e080d={};_0x4e080d[_0x5106a2]={'$like':'%'+_0x926e96[_0x8f57('0x3f')][_0x8f57('0x4b')]+'%'};return _0x4e080d;})});}_0x3460ba=_[_0x8f57('0x4c')]({},_0x3460ba,_0x926e96['options']);return _0x2b85ef[_0x8f57('0x91')](_0x3460ba);}})[_0x8f57('0x30')](function(_0x7bdf49){if(_0x7bdf49){_0x1b2d72=_0x7bdf49[_0x8f57('0x46')];if(!_0x926e96[_0x8f57('0x3f')]['hasOwnProperty'](_0x8f57('0x47'))){_0x3460ba['limit']=qs[_0x8f57('0x2b')](_0x926e96[_0x8f57('0x3f')][_0x8f57('0x2b')]);_0x3460ba[_0x8f57('0x2a')]=qs[_0x8f57('0x2a')](_0x926e96[_0x8f57('0x3f')][_0x8f57('0x2a')]);}return _0x2b85ef[_0x8f57('0x91')](_0x3460ba);}})['then'](function(_0x196b86){if(_0x196b86){return _0x196b86?{'count':_0x1b2d72,'rows':_0x196b86}:null;}})[_0x8f57('0x30')](respondWithResult(_0x2ec192,null))[_0x8f57('0x25')](handleError(_0x2ec192,null));};exports[_0x8f57('0x92')]=function(_0x2780f6,_0x1e5cd4,_0x33ec31){var _0x474d3f={'raw':!![],'where':{}};var _0xa0f5a1={};var _0x352577={'count':0x0,'rows':[]};return db[_0x8f57('0x3b')][_0x8f57('0x60')]({'where':{'id':_0x2780f6['params']['id']}})['then'](handleEntityNotFound(_0x1e5cd4,null))[_0x8f57('0x30')](function(_0x86ccf7){if(_0x86ccf7){_0xa0f5a1['model']=_[_0x8f57('0x40')](db[_0x8f57('0x93')][_0x8f57('0x3c')]);_0xa0f5a1['query']=_[_0x8f57('0x40')](_0x2780f6['query']);_0xa0f5a1[_0x8f57('0x41')]=_[_0x8f57('0x42')](_0xa0f5a1[_0x8f57('0x43')],_0xa0f5a1[_0x8f57('0x3f')]);_0x474d3f[_0x8f57('0x44')]=_[_0x8f57('0x42')](_0xa0f5a1[_0x8f57('0x43')],qs[_0x8f57('0x45')](_0x2780f6['query']['fields']));_0x474d3f[_0x8f57('0x44')]=_0x474d3f['attributes'][_0x8f57('0x46')]?_0x474d3f['attributes']:_0xa0f5a1[_0x8f57('0x43')];if(!_0x2780f6['query'][_0x8f57('0x61')]('nolimit')){_0x474d3f[_0x8f57('0x2b')]=qs[_0x8f57('0x2b')](_0x2780f6[_0x8f57('0x3f')]['limit']);_0x474d3f[_0x8f57('0x2a')]=qs[_0x8f57('0x2a')](_0x2780f6[_0x8f57('0x3f')][_0x8f57('0x2a')]);}_0x474d3f[_0x8f57('0x48')]=qs['sort'](_0x2780f6[_0x8f57('0x3f')][_0x8f57('0x49')]);_0x474d3f['where']=qs[_0x8f57('0x41')](_['pick'](_0x2780f6[_0x8f57('0x3f')],_0xa0f5a1[_0x8f57('0x41')]));_0x474d3f[_0x8f57('0x4a')][_0x8f57('0x63')]=_0x86ccf7['id'];if(_0x2780f6['query'][_0x8f57('0x4b')]){_0x474d3f[_0x8f57('0x4a')]=_[_0x8f57('0x4c')](_0x474d3f[_0x8f57('0x4a')],{'$or':_[_0x8f57('0x3a')](_0x474d3f['attributes'],function(_0x17b520){var _0x44601f={};_0x44601f[_0x17b520]={'$like':'%'+_0x2780f6['query']['filter']+'%'};return _0x44601f;})});}if(_0x2780f6[_0x8f57('0x3f')][_0x8f57('0x94')]){var _0xbdeb21=_0x2780f6[_0x8f57('0x3f')][_0x8f57('0x94')]['split'](',');var _0x2c9d57={};_0x2c9d57[_0xbdeb21[0x0]]={'$gte':moment(_0xbdeb21[0x1])[_0x8f57('0x95')](_0x8f57('0x96'))};_0x474d3f[_0x8f57('0x4a')]=_[_0x8f57('0x4c')](_0x474d3f[_0x8f57('0x4a')],_0x2c9d57);}_0x474d3f=_['merge']({},_0x474d3f,_0x2780f6[_0x8f57('0x4e')]);return db[_0x8f57('0x93')]['count']({'where':_0x474d3f[_0x8f57('0x4a')]})[_0x8f57('0x30')](function(_0x3c4f9c){_0x352577['count']=_0x3c4f9c;if(_0x2780f6[_0x8f57('0x3f')]['includeAll']){_0x474d3f[_0x8f57('0x51')]=[{'all':!![]}];}return db[_0x8f57('0x93')][_0x8f57('0x64')](_0x474d3f);})['then'](function(_0x1ecb26){if(_0x2780f6['query']['inlineCss']===_0x8f57('0x97')){for(var _0x12a09e=0x0;_0x12a09e<_0x1ecb26['length'];_0x12a09e++){_0x1ecb26[_0x12a09e][_0x8f57('0x5a')]=juice(_0x1ecb26[_0x12a09e][_0x8f57('0x5a')]);}}_0x352577[_0x8f57('0x52')]=_0x1ecb26;return _0x352577;});}})[_0x8f57('0x30')](respondWithFilteredResult(_0x1e5cd4,_0x474d3f))[_0x8f57('0x25')](handleError(_0x1e5cd4,null));};exports['send']=function(_0x2946f4,_0x5e3276,_0x39fa02){var _0x4c6684,_0x13cebc={},_0x20dfbd;if(_0x2946f4['body']['to']){_0x20dfbd=_0x2946f4['body']['to']['split'](',')[0x0];}return db[_0x8f57('0x3b')][_0x8f57('0x58')]({'where':{'id':_0x2946f4[_0x8f57('0x54')]['id']},'include':[{'model':db[_0x8f57('0x98')],'as':'List','include':[{'model':db['CmContact'],'as':_0x8f57('0x99'),'where':{'email':_0x20dfbd},'limit':0x1,'order':[['updatedAt',_0x8f57('0x9a')]]}]},{'model':db[_0x8f57('0x38')],'as':_0x8f57('0x39'),'raw':!![]}]})['then'](handleEntityNotFound(_0x5e3276,null))[_0x8f57('0x30')](function(_0x545c64){if(_0x545c64){_0x4c6684=_0x545c64;if(_0x545c64['Smtp']){if(_[_0x8f57('0x6e')](_0x2946f4[_0x8f57('0x5a')]['from'])){_0x2946f4[_0x8f57('0x5a')]['from']=util['format'](_0x8f57('0x9b'),_0x545c64[_0x8f57('0x34')],_0x545c64['email']||_0x545c64[_0x8f57('0x39')][_0x8f57('0x71')]);}if(_0x2946f4[_0x8f57('0x5a')]['attachments']&&_0x2946f4[_0x8f57('0x5a')]['attachments']['length']){for(var _0x1badf8=0x0;_0x1badf8<_0x2946f4[_0x8f57('0x5a')][_0x8f57('0x9c')][_0x8f57('0x46')];_0x1badf8+=0x1){_0x2946f4['body'][_0x8f57('0x9c')][_0x1badf8]={'filename':_0x2946f4[_0x8f57('0x5a')][_0x8f57('0x9c')][_0x1badf8]['name'],'path':path['join'](config[_0x8f57('0x9d')],'server/files/attachments',_0x2946f4['body'][_0x8f57('0x9c')][_0x1badf8][_0x8f57('0x9e')])};}}var _0x39576b={'tls':{'rejectUnauthorized':![]}};if(_[_0x8f57('0x6e')](_0x545c64[_0x8f57('0x39')]['service'])){if(_0x545c64['Smtp'][_0x8f57('0x73')]){_0x39576b[_0x8f57('0x9f')]={'user':_0x545c64[_0x8f57('0x39')][_0x8f57('0x71')],'pass':_0x545c64[_0x8f57('0x39')][_0x8f57('0x72')]};}_0x39576b[_0x8f57('0x74')]=_0x545c64['Smtp']['host'];_0x39576b['port']=_0x545c64[_0x8f57('0x39')][_0x8f57('0x75')];_0x39576b[_0x8f57('0xa0')]=_0x545c64[_0x8f57('0x39')][_0x8f57('0xa0')];}else{_0x39576b[_0x8f57('0x76')]=_0x545c64[_0x8f57('0x39')][_0x8f57('0x76')];_0x39576b[_0x8f57('0x9f')]={'user':_0x545c64[_0x8f57('0x39')][_0x8f57('0x71')],'pass':_0x545c64[_0x8f57('0x39')][_0x8f57('0x72')]};}return respondWithRpcPromise(_0x8f57('0xa1'),_0x8f57('0xa2'),{'account':_0x39576b,'message':_0x2946f4['body']});}else{throw new Error(_0x8f57('0xa3'));}}})[_0x8f57('0x30')](function(_0xf1ec1b){if(_0xf1ec1b){_0x13cebc=_0xf1ec1b;if(_0x4c6684[_0x8f57('0xa4')]){if(_0x4c6684[_0x8f57('0xa4')][_0x8f57('0x99')]['length']){return _0x4c6684[_0x8f57('0xa4')][_0x8f57('0x99')][0x0];}else{return db[_0x8f57('0x85')][_0x8f57('0x5e')](_[_0x8f57('0x16')](_0x2946f4[_0x8f57('0x5a')],{'firstName':_0x2946f4[_0x8f57('0x5a')]['to'],'email':_0x2946f4['body']['to'],'phone':_0x2946f4['body']['to'],'ListId':_0x4c6684[_0x8f57('0x6d')]}));}}else{throw new Error('List\x20not\x20found');}}})['then'](function(_0x2667d8){if(_0x2667d8){var _0x19d994={'UserId':_0x2946f4[_0x8f57('0x71')]['id'],'ContactId':_0x2667d8['id'],'MailAccountId':_0x4c6684['id'],'inReplyTo':_0x13cebc['messageId'],'to':_0x2946f4['body']['from'],'cc':_0x2946f4[_0x8f57('0x5a')]['cc'],'subject':_0x2946f4['body'][_0x8f57('0xa5')],'attach':_0x2946f4[_0x8f57('0x5a')][_0x8f57('0xa6')],'firstMsgDirection':_0x8f57('0xa7'),'lastMsgAt':moment()[_0x8f57('0x95')](_0x8f57('0x96')),'lastMsgDirection':_0x8f57('0xa7'),'lastMsgBody':_0x2946f4['body'][_0x8f57('0x5a')],'Messages':[_[_0x8f57('0x4c')](_0x2946f4['body'],{'messageId':_0x13cebc[_0x8f57('0xa8')],'sentAt':moment()[_0x8f57('0x95')](_0x8f57('0x96')),'read':!![],'MailAccountId':_0x4c6684['id'],'UserId':_0x2946f4[_0x8f57('0x71')]['id'],'ContactId':_0x2667d8['id']})]};if(_0x2946f4[_0x8f57('0x5a')][_0x8f57('0xa9')]){_0x19d994=_[_0x8f57('0x4c')](_0x19d994,_0x2946f4[_0x8f57('0x5a')][_0x8f57('0xa9')]);}return db['MailInteraction'][_0x8f57('0x5e')](_0x19d994,{'include':[{'model':db[_0x8f57('0x93')],'as':_0x8f57('0xaa')}]});}})[_0x8f57('0x30')](respondWithResult(_0x5e3276,null))['catch'](handleError(_0x5e3276,null));};exports[_0x8f57('0xab')]=function(_0x1142f0,_0x3fd625,_0x87901a){return db[_0x8f57('0x3b')][_0x8f57('0x58')]({'where':{'id':_0x1142f0[_0x8f57('0x54')]['id']},'include':[{'model':db[_0x8f57('0x38')],'as':_0x8f57('0x39'),'raw':!![]}]})[_0x8f57('0x30')](handleEntityNotFound(_0x3fd625,null))['then'](function(_0x21bb6a){if(_0x21bb6a&&_0x21bb6a[_0x8f57('0x39')]){var _0x5170ad={'id':_0x21bb6a['id'],'tls':{'rejectUnauthorized':![]}};if(_0x21bb6a['Smtp'][_0x8f57('0x76')]){_0x5170ad[_0x8f57('0x76')]=_0x21bb6a[_0x8f57('0x39')][_0x8f57('0x76')];}else{_0x5170ad[_0x8f57('0x74')]=_0x21bb6a[_0x8f57('0x39')][_0x8f57('0x74')];_0x5170ad['port']=_0x21bb6a[_0x8f57('0x39')]['port'];_0x5170ad[_0x8f57('0xa0')]=_0x21bb6a[_0x8f57('0x39')]['secure'];}if(_0x21bb6a[_0x8f57('0x39')][_0x8f57('0x73')]){_0x5170ad[_0x8f57('0x9f')]={'user':_0x21bb6a[_0x8f57('0x39')][_0x8f57('0x71')],'pass':_0x21bb6a['Smtp'][_0x8f57('0x72')]};}return respondWithRpcPromise('VerifySmtp',_0x8f57('0xab'),{'account':_0x5170ad});}})[_0x8f57('0x30')](respondWithResult(_0x3fd625,null))[_0x8f57('0x25')](handleError(_0x3fd625,null));};exports['destroy']=function(_0xf226f8,_0x1e642b){return db['MailAccount'][_0x8f57('0x58')]({'where':{'id':_0xf226f8[_0x8f57('0x54')]['id']}})[_0x8f57('0x30')](handleEntityNotFound(_0x1e642b,null))['then'](function(_0x2f71fb){if(_0x2f71fb&&_0x2f71fb[_0x8f57('0x76')]){throw new db[(_0x8f57('0xac'))][(_0x8f57('0xad'))](_0x8f57('0xae'));}return _0x2f71fb;})['then'](removeEntity(_0x1e642b,null))[_0x8f57('0x25')](handleError(_0x1e642b,null));};exports[_0x8f57('0xaf')]=function(_0x5b286b,_0x38db85,_0xc7134e){return db[_0x8f57('0x3b')][_0x8f57('0x58')]({'where':{'id':_0x5b286b[_0x8f57('0x54')]['id']}})[_0x8f57('0x30')](handleEntityNotFound(_0x38db85,null))['then'](function(_0x4a6ac1){if(_0x4a6ac1){return _0x4a6ac1[_0x8f57('0xaf')](_0x5b286b[_0x8f57('0x5a')][_0x8f57('0x66')],_[_0x8f57('0x84')](_0x5b286b[_0x8f57('0x5a')],[_0x8f57('0x66'),'id'])||{})[_0x8f57('0xb0')](function(_0x44f443){for(var _0x5df8aa=0x0;_0x5df8aa<_0x5b286b[_0x8f57('0x5a')][_0x8f57('0x66')][_0x8f57('0x46')];_0x5df8aa+=0x1){socket[_0x8f57('0xb1')]('userMailAccount:save',{'UserId':_0x5b286b[_0x8f57('0x5a')]['ids'][_0x5df8aa],'MailAccountId':_0x5b286b[_0x8f57('0x54')]['id']});}return _0x44f443;});}})['then'](respondWithResult(_0x38db85,null))[_0x8f57('0x25')](handleError(_0x38db85,null));};exports[_0x8f57('0xb2')]=function(_0xfc2e63,_0x4aeae3,_0x2a05af){return db[_0x8f57('0x3b')][_0x8f57('0x58')]({'where':{'id':_0xfc2e63['params']['id']}})['then'](handleEntityNotFound(_0x4aeae3,null))[_0x8f57('0x30')](function(_0x5af841){if(_0x5af841){return _0x5af841[_0x8f57('0xb2')](_0xfc2e63[_0x8f57('0x3f')][_0x8f57('0x66')])[_0x8f57('0x30')](function(){if(_['isArray'](_0xfc2e63[_0x8f57('0x3f')]['ids'])){for(var _0x20085a=0x0;_0x20085a<_0xfc2e63[_0x8f57('0x3f')][_0x8f57('0x66')]['length'];_0x20085a+=0x1){socket[_0x8f57('0xb1')]('userMailAccount:remove',{'UserId':Number(_0xfc2e63[_0x8f57('0x3f')][_0x8f57('0x66')][_0x20085a]),'MailAccountId':Number(_0xfc2e63[_0x8f57('0x54')]['id'])});}}else{socket[_0x8f57('0xb1')]('userMailAccount:remove',{'UserId':Number(_0xfc2e63[_0x8f57('0x3f')]['ids']),'MailAccountId':Number(_0xfc2e63['params']['id'])});}});}})[_0x8f57('0x30')](respondWithStatusCode(_0x4aeae3,null))[_0x8f57('0x25')](handleError(_0x4aeae3,null));};exports['getAgents']=function(_0x4ee243,_0x653152,_0x10985e){var _0x582bcf={};var _0xde21ca={};var _0x3371f2;var _0x351d37;return db[_0x8f57('0x3b')]['findOne']({'where':{'id':_0x4ee243[_0x8f57('0x54')]['id']}})['then'](handleEntityNotFound(_0x653152,null))[_0x8f57('0x30')](function(_0x46703e){if(_0x46703e){_0x3371f2=_0x46703e;_0xde21ca['model']=_[_0x8f57('0x40')](db['User'][_0x8f57('0x3c')]);_0xde21ca['query']=_['keys'](_0x4ee243[_0x8f57('0x3f')]);_0xde21ca[_0x8f57('0x41')]=_[_0x8f57('0x42')](_0xde21ca[_0x8f57('0x43')],_0xde21ca[_0x8f57('0x3f')]);_0x582bcf[_0x8f57('0x44')]=_[_0x8f57('0x42')](_0xde21ca['model'],qs['fields'](_0x4ee243[_0x8f57('0x3f')][_0x8f57('0x45')]));_0x582bcf[_0x8f57('0x44')]=_0x582bcf[_0x8f57('0x44')][_0x8f57('0x46')]?_0x582bcf['attributes']:_0xde21ca['model'];_0x582bcf[_0x8f57('0x48')]=qs[_0x8f57('0x49')](_0x4ee243['query'][_0x8f57('0x49')]);_0x582bcf[_0x8f57('0x4a')]=qs['filters'](_[_0x8f57('0x62')](_0x4ee243[_0x8f57('0x3f')],_0xde21ca[_0x8f57('0x41')]));if(_0x4ee243[_0x8f57('0x3f')][_0x8f57('0x4b')]){_0x582bcf[_0x8f57('0x4a')]=_['merge'](_0x582bcf['where'],{'$or':_['map'](_0x582bcf[_0x8f57('0x44')],function(_0x52e239){var _0x3815f1={};_0x3815f1[_0x52e239]={'$like':'%'+_0x4ee243[_0x8f57('0x3f')]['filter']+'%'};return _0x3815f1;})});}_0x582bcf=_['merge']({},_0x582bcf,_0x4ee243[_0x8f57('0x4e')]);return _0x3371f2[_0x8f57('0xb3')](_0x582bcf);}})[_0x8f57('0x30')](function(_0x2bdfdc){if(_0x2bdfdc){_0x351d37=_0x2bdfdc[_0x8f57('0x46')];if(!_0x4ee243['query']['hasOwnProperty'](_0x8f57('0x47'))){_0x582bcf[_0x8f57('0x2b')]=qs[_0x8f57('0x2b')](_0x4ee243[_0x8f57('0x3f')][_0x8f57('0x2b')]);_0x582bcf[_0x8f57('0x2a')]=qs[_0x8f57('0x2a')](_0x4ee243['query']['offset']);}return _0x3371f2[_0x8f57('0xb3')](_0x582bcf);}})[_0x8f57('0x30')](function(_0x444ea5){if(_0x444ea5){return _0x444ea5?{'count':_0x351d37,'rows':_0x444ea5}:null;}})[_0x8f57('0x30')](respondWithResult(_0x653152,null))[_0x8f57('0x25')](handleError(_0x653152,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 52e3ce2..bb012bf 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 _0x4744=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0x47d33a,_0x392080){var _0x5f22a8=function(_0x42ed8c){while(--_0x42ed8c){_0x47d33a['push'](_0x47d33a['shift']());}};_0x5f22a8(++_0x392080);}(_0x4744,0x107));var _0x4474=function(_0x1088df,_0x5851a6){_0x1088df=_0x1088df-0x0;var _0x4c4859=_0x4744[_0x1088df];return _0x4c4859;};'use strict';var EventEmitter=require(_0x4474('0x0'));var MailAccount=require(_0x4474('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x4474('0x2')](0x0);var events={'afterCreate':_0x4474('0x3'),'afterUpdate':_0x4474('0x4'),'afterDestroy':_0x4474('0x5')};function emitEvent(_0xbb4a32){return function(_0x3337f4,_0x395f6d,_0x37c996){MailAccountEvents['emit'](_0xbb4a32+':'+_0x3337f4['id'],_0x3337f4);MailAccountEvents['emit'](_0xbb4a32,_0x3337f4);_0x37c996(null);};}for(var e in events){if(events[_0x4474('0x6')](e)){var event=events[e];MailAccount[_0x4474('0x7')](e,emitEvent(event));}}module[_0x4474('0x8')]=MailAccountEvents; \ No newline at end of file +var _0xc551=['hook','events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit'];(function(_0x33b16e,_0x611ec0){var _0x5c7eb2=function(_0x2ef863){while(--_0x2ef863){_0x33b16e['push'](_0x33b16e['shift']());}};_0x5c7eb2(++_0x611ec0);}(_0xc551,0x145));var _0x1c55=function(_0x288d3e,_0x420c58){_0x288d3e=_0x288d3e-0x0;var _0x4746c0=_0xc551[_0x288d3e];return _0x4746c0;};'use strict';var EventEmitter=require(_0x1c55('0x0'));var MailAccount=require(_0x1c55('0x1'))['db'][_0x1c55('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x1c55('0x3')](0x0);var events={'afterCreate':_0x1c55('0x4'),'afterUpdate':_0x1c55('0x5'),'afterDestroy':_0x1c55('0x6')};function emitEvent(_0xf0db26){return function(_0xb0e9d9,_0x28e4d7,_0x563840){MailAccountEvents[_0x1c55('0x7')](_0xf0db26+':'+_0xb0e9d9['id'],_0xb0e9d9);MailAccountEvents[_0x1c55('0x7')](_0xf0db26,_0xb0e9d9);_0x563840(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x1c55('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 13b8ca4..aa997d1 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 _0xcb6a=['MailAccount','mail_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./mailAccount.attributes','define'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0xcb6a,0x16a));var _0xacb6=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xcb6a[_0x62c958];return _0x57ec61;};'use strict';var _=require(_0xacb6('0x0'));var util=require(_0xacb6('0x1'));var logger=require(_0xacb6('0x2'))(_0xacb6('0x3'));var moment=require('moment');var BPromise=require(_0xacb6('0x4'));var rp=require(_0xacb6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xacb6('0x6'));var config=require(_0xacb6('0x7'));var attributes=require(_0xacb6('0x8'));module['exports']=function(_0x20bbf6,_0x4e2ad5){return _0x20bbf6[_0xacb6('0x9')](_0xacb6('0xa'),attributes,{'tableName':_0xacb6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa246=['MailAccount','mail_accounts','util','moment','request-promise','path','rimraf','./mailAccount.attributes','exports','define'];(function(_0x3ac51d,_0x2a4ec5){var _0x24e67b=function(_0x243594){while(--_0x243594){_0x3ac51d['push'](_0x3ac51d['shift']());}};_0x24e67b(++_0x2a4ec5);}(_0xa246,0xfc));var _0x6a24=function(_0x1ea28d,_0x112c9b){_0x1ea28d=_0x1ea28d-0x0;var _0x2e4205=_0xa246[_0x1ea28d];return _0x2e4205;};'use strict';var _=require('lodash');var util=require(_0x6a24('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x6a24('0x1'));var BPromise=require('bluebird');var rp=require(_0x6a24('0x2'));var fs=require('fs');var path=require(_0x6a24('0x3'));var rimraf=require(_0x6a24('0x4'));var config=require('../../config/environment');var attributes=require(_0x6a24('0x5'));module[_0x6a24('0x6')]=function(_0x58482d,_0x1cacd5){return _0x58482d[_0x6a24('0x7')](_0x6a24('0x8'),attributes,{'tableName':_0x6a24('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index d1be18b..92f8968 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 _0x4f6f=['priority','asc','autoclose','push','length','close','Contacts','defaults','ListId','contact','messageId','generate','subject','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','create','spread','update','YYYY-MM-DD\x20HH:mm:ss','interaction','created','originTo','originCc','bcc','Attachment','Attachments','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','include','model','map','attributes','stringify','ShowMailAccount','find','NotifyMailAccount','body','mail','difference','keys','CmContact','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','DESC','Applications','MailServerOut','Smtp','List','get','omit','applications','orderBy'];(function(_0x19138c,_0x5b4831){var _0x30e93c=function(_0x340e05){while(--_0x340e05){_0x19138c['push'](_0x19138c['shift']());}};_0x30e93c(++_0x5b4831);}(_0x4f6f,0x157));var _0xf4f6=function(_0xfb0cfd,_0x500179){_0xfb0cfd=_0xfb0cfd-0x0;var _0x2fd8aa=_0x4f6f[_0xfb0cfd];return _0x2fd8aa;};'use strict';var _=require(_0xf4f6('0x0'));var util=require(_0xf4f6('0x1'));var moment=require(_0xf4f6('0x2'));var BPromise=require('bluebird');var rs=require(_0xf4f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4f6('0x4'))['db'];var utils=require(_0xf4f6('0x5'));var logger=require('../../config/logger')(_0xf4f6('0x6'));var config=require(_0xf4f6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf4f6('0x8')][_0xf4f6('0x9')]({'port':0x232c});config[_0xf4f6('0xa')]=_['defaults'](config[_0xf4f6('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf4f6('0xa')]));require(_0xf4f6('0xb'))[_0xf4f6('0xc')](socket);function respondWithRpcPromise(_0x51df26,_0x28608e,_0x37d0ee){return new BPromise(function(_0x5ee85d,_0x40e26e){return client[_0xf4f6('0xd')](_0x51df26,_0x37d0ee)[_0xf4f6('0xe')](function(_0x340e93){logger[_0xf4f6('0xf')](_0xf4f6('0x10'),_0x28608e,'request\x20sent');logger[_0xf4f6('0x11')](_0xf4f6('0x12'),_0x28608e,'request\x20sent',JSON['stringify'](_0x340e93));if(_0x340e93[_0xf4f6('0x13')]){if(_0x340e93[_0xf4f6('0x13')][_0xf4f6('0x14')]===0x1f4){logger['error'](_0xf4f6('0x10'),_0x28608e,_0x340e93[_0xf4f6('0x13')][_0xf4f6('0x15')]);return _0x40e26e(_0x340e93['error'][_0xf4f6('0x15')]);}logger['error'](_0xf4f6('0x10'),_0x28608e,_0x340e93[_0xf4f6('0x13')][_0xf4f6('0x15')]);return _0x5ee85d(_0x340e93['error'][_0xf4f6('0x15')]);}else{logger[_0xf4f6('0xf')](_0xf4f6('0x10'),_0x28608e,'request\x20sent');_0x5ee85d(_0x340e93[_0xf4f6('0x16')]['message']);}})[_0xf4f6('0x17')](function(_0xb7adff){logger[_0xf4f6('0x13')]('MailAccount,\x20%s,\x20%s',_0x28608e,_0xb7adff);_0x40e26e(_0xb7adff);});});}exports[_0xf4f6('0x18')]=function(_0x8f6ada){var _0x1dacff=this;return new Promise(function(_0x391e03,_0x112918){return db[_0xf4f6('0x19')][_0xf4f6('0x1a')]({'raw':_0x8f6ada[_0xf4f6('0x1b')]?_0x8f6ada[_0xf4f6('0x1b')][_0xf4f6('0x1c')]===undefined?!![]:![]:!![],'where':_0x8f6ada[_0xf4f6('0x1b')]?_0x8f6ada['options'][_0xf4f6('0x1d')]||null:null,'attributes':_0x8f6ada[_0xf4f6('0x1b')]?_0x8f6ada[_0xf4f6('0x1b')]['attributes']||null:null,'limit':_0x8f6ada[_0xf4f6('0x1b')]?_0x8f6ada[_0xf4f6('0x1b')]['limit']||null:null,'include':_0x8f6ada[_0xf4f6('0x1b')]?_0x8f6ada[_0xf4f6('0x1b')][_0xf4f6('0x1e')]?_['map'](_0x8f6ada[_0xf4f6('0x1b')][_0xf4f6('0x1e')],function(_0x464be1){return{'model':db[_0x464be1[_0xf4f6('0x1f')]],'as':_0x464be1['as'],'attributes':_0x464be1['attributes'],'include':_0x464be1[_0xf4f6('0x1e')]?_[_0xf4f6('0x20')](_0x464be1[_0xf4f6('0x1e')],function(_0x2344fb){return{'model':db[_0x2344fb[_0xf4f6('0x1f')]],'as':_0x2344fb['as'],'attributes':_0x2344fb[_0xf4f6('0x21')],'include':_0x2344fb[_0xf4f6('0x1e')]?_[_0xf4f6('0x20')](_0x2344fb['include'],function(_0x43604d){return{'model':db[_0x43604d[_0xf4f6('0x1f')]],'as':_0x43604d['as'],'attributes':_0x43604d[_0xf4f6('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3269ac){logger[_0xf4f6('0xf')](_0xf4f6('0x18'),_0x8f6ada);logger[_0xf4f6('0x11')](_0xf4f6('0x18'),_0x8f6ada,JSON[_0xf4f6('0x22')](_0x3269ac));_0x391e03(_0x3269ac);})[_0xf4f6('0x17')](function(_0x162781){logger[_0xf4f6('0x13')]('GetMailAccount',_0x162781['message'],_0x8f6ada);_0x112918(_0x1dacff[_0xf4f6('0x13')](0x1f4,_0x162781[_0xf4f6('0x15')]));});});};exports[_0xf4f6('0x23')]=function(_0x31d99a){var _0x26e89a=this;return new Promise(function(_0x2f3f27,_0xa92c98){return db[_0xf4f6('0x19')][_0xf4f6('0x24')]({'raw':_0x31d99a['options']?_0x31d99a[_0xf4f6('0x1b')][_0xf4f6('0x1c')]===undefined?!![]:![]:!![],'where':_0x31d99a[_0xf4f6('0x1b')]?_0x31d99a['options'][_0xf4f6('0x1d')]||null:null,'attributes':_0x31d99a[_0xf4f6('0x1b')]?_0x31d99a[_0xf4f6('0x1b')][_0xf4f6('0x21')]||null:null,'include':_0x31d99a[_0xf4f6('0x1b')]?_0x31d99a['options'][_0xf4f6('0x1e')]?_[_0xf4f6('0x20')](_0x31d99a['options'][_0xf4f6('0x1e')],function(_0x384436){return{'model':db[_0x384436[_0xf4f6('0x1f')]],'as':_0x384436['as'],'attributes':_0x384436[_0xf4f6('0x21')],'include':_0x384436['include']?_[_0xf4f6('0x20')](_0x384436['include'],function(_0xd944cc){return{'model':db[_0xd944cc[_0xf4f6('0x1f')]],'as':_0xd944cc['as'],'attributes':_0xd944cc[_0xf4f6('0x21')],'include':_0xd944cc['include']?_[_0xf4f6('0x20')](_0xd944cc[_0xf4f6('0x1e')],function(_0x46f9b9){return{'model':db[_0x46f9b9[_0xf4f6('0x1f')]],'as':_0x46f9b9['as'],'attributes':_0x46f9b9['attributes']};}):[]};}):[]};}):[]:[]})[_0xf4f6('0xe')](function(_0x1df876){logger[_0xf4f6('0xf')]('ShowMailAccount',_0x31d99a);logger[_0xf4f6('0x11')]('ShowMailAccount',_0x31d99a,JSON[_0xf4f6('0x22')](_0x1df876));_0x2f3f27(_0x1df876);})[_0xf4f6('0x17')](function(_0x290c27){logger['error'](_0xf4f6('0x23'),_0x290c27[_0xf4f6('0x15')],_0x31d99a);_0xa92c98(_0x26e89a['error'](0x1f4,_0x290c27['message']));});});};exports[_0xf4f6('0x25')]=function(_0x205fcb){var _0x10c1bc=this;return new Promise(function(_0xa7f347,_0x418eae){var _0x1ba592={'body':_0x205fcb[_0xf4f6('0x26')],'channel':_0xf4f6('0x27')};var _0x5b8cb5=_[_0xf4f6('0x28')](_[_0xf4f6('0x29')](db[_0xf4f6('0x2a')]['rawAttributes']),[_0xf4f6('0x2b'),_0xf4f6('0x2c'),_0xf4f6('0x2d'),'ListId']);var _0x44fbc0=![];if(_0x205fcb[_0xf4f6('0x26')]['id']){delete _0x205fcb['body']['id'];}if(_[_0xf4f6('0x2e')](_0x205fcb['body'][_0xf4f6('0x2f')])){return _0x418eae(_0x10c1bc['error'](0x1f4,_0xf4f6('0x30')));}if(_[_0xf4f6('0x2e')](_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x26')])||_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x26')]===''){return _0x418eae(_0x10c1bc[_0xf4f6('0x13')](0x1f4,_0xf4f6('0x31')));}if(_[_0xf4f6('0x2e')](_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x32')])){return _0x418eae(_0x10c1bc[_0xf4f6('0x13')](0x1f4,_0xf4f6('0x33')+_0x5b8cb5));}if(!_[_0xf4f6('0x34')](_0x5b8cb5,_0x205fcb['body']['mapKey'])){return _0x418eae(_0x10c1bc['error'](0x1f4,_0xf4f6('0x35')+_0x5b8cb5));}var _0x3eac72={};_0x3eac72[_0x205fcb['body'][_0xf4f6('0x32')]]=_0x205fcb['body'][_0xf4f6('0x2f')];return db[_0xf4f6('0x19')][_0xf4f6('0x24')]({'where':{'id':_0x205fcb[_0xf4f6('0x36')]['id']},'include':[{'model':db[_0xf4f6('0x37')],'as':'List','include':[{'model':db[_0xf4f6('0x2a')],'as':'Contacts','where':_0x3eac72,'limit':0x1,'order':[[_0xf4f6('0x2c'),_0xf4f6('0x38')]]}]},{'model':db['MailApplication'],'as':_0xf4f6('0x39')},{'model':db[_0xf4f6('0x3a')],'as':_0xf4f6('0x3b')}]})[_0xf4f6('0xe')](function(_0x5a582a){if(_0x5a582a&&_0x5a582a[_0xf4f6('0x3c')]){var _0x5af319=_0x5a582a[_0xf4f6('0x3d')]({'plain':!![]});_0x1ba592[_0xf4f6('0x36')]=_[_0xf4f6('0x3e')](_0x5af319,['Applications','List']);_0x1ba592[_0xf4f6('0x3f')]=_0x5af319[_0xf4f6('0x39')];_0x1ba592['list']=_0x5af319[_0xf4f6('0x3c')];_0x1ba592['applications']=_[_0xf4f6('0x40')](_0x1ba592[_0xf4f6('0x3f')],[_0xf4f6('0x41')],[_0xf4f6('0x42')]);if(_0x1ba592[_0xf4f6('0x36')]&&_0x1ba592[_0xf4f6('0x36')][_0xf4f6('0x43')]){_0x1ba592[_0xf4f6('0x3f')][_0xf4f6('0x44')]({'id':0x0,'priority':_0x1ba592['applications'][_0xf4f6('0x45')]+0x1,'app':_0xf4f6('0x46'),'appdata':'autoclose','interval':'*,*,*,*'});}if(_0x1ba592[_0xf4f6('0x36')][_0xf4f6('0x39')]){delete _0x1ba592['account']['Applications'];}if(_0x1ba592['account'][_0xf4f6('0x3c')]){delete _0x1ba592[_0xf4f6('0x36')]['List'];}if(_0x5af319['List'][_0xf4f6('0x47')][_0xf4f6('0x45')]){return _0x5af319[_0xf4f6('0x3c')]['Contacts'][0x0];}var _0x59b89d=_[_0xf4f6('0x48')](_0x205fcb[_0xf4f6('0x26')],{'firstName':_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x2f')],'ListId':_0x5af319[_0xf4f6('0x49')]});_0x59b89d[_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x32')]]=_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x2f')];return db[_0xf4f6('0x2a')]['create'](_0x59b89d);}else{throw new Error('List\x20not\x20found');}})[_0xf4f6('0xe')](function(_0xd51621){_0x1ba592[_0xf4f6('0x4a')]=_0xd51621;if(_0xd51621){if(!_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x15')]['messageId']){_0x205fcb[_0xf4f6('0x26')]['message'][_0xf4f6('0x4b')]=rs[_0xf4f6('0x4c')]()+'\x20'+_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x15')][_0xf4f6('0x2f')];}var _0x1f5e62={'ContactId':_0xd51621['id'],'MailAccountId':_0x205fcb[_0xf4f6('0x36')]['id'],'inReplyTo':_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x15')][_0xf4f6('0x4b')],'to':_0x205fcb['body'][_0xf4f6('0x15')][_0xf4f6('0x2f')],'cc':_0x205fcb[_0xf4f6('0x26')]['message']['cc'],'subject':_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x15')][_0xf4f6('0x4d')],'attach':_0x205fcb[_0xf4f6('0x26')]['message'][_0xf4f6('0x4e')],'lastMsgAt':moment()[_0xf4f6('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x205fcb[_0xf4f6('0x26')]['body']};return db[_0xf4f6('0x50')][_0xf4f6('0x24')]({'where':{'closed':![],'MailAccountId':_0x205fcb[_0xf4f6('0x36')]['id']},'include':[{'model':db[_0xf4f6('0x51')],'as':_0xf4f6('0x52'),'attributes':[_0xf4f6('0x4b')],'where':{'messageId':_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x15')][_0xf4f6('0x53')]}}]})['then'](function(_0x5b319c){if(_0x5b319c){return[_0x5b319c,![]];}return db[_0xf4f6('0x50')][_0xf4f6('0x54')](_0x1f5e62)[_0xf4f6('0xe')](function(_0x1a64eb){return[_0x1a64eb,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xf4f6('0x55')](function(_0x16f31a,_0xc2b2af){if(_0x16f31a){_0x44fbc0=_0xc2b2af;if(!_0xc2b2af){return _0x16f31a[_0xf4f6('0x56')]({'inReplyTo':_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x15')][_0xf4f6('0x4b')],'to':_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x15')][_0xf4f6('0x2f')],'cc':_0x205fcb['body'][_0xf4f6('0x15')]['cc'],'subject':_0x205fcb['body'][_0xf4f6('0x15')][_0xf4f6('0x4d')],'attach':_0x16f31a[_0xf4f6('0x4e')]?_0x16f31a[_0xf4f6('0x4e')]:_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x15')][_0xf4f6('0x4e')],'substatus':null,'substatusAt':moment()[_0xf4f6('0x4f')](_0xf4f6('0x57')),'lastMsgAt':moment()[_0xf4f6('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x205fcb[_0xf4f6('0x26')]['body']});}else{return _0x16f31a;}}})[_0xf4f6('0xe')](function(_0x1156cc){_0x1ba592['interaction']=_0x1156cc[_0xf4f6('0x3d')]({'plain':!![]});_0x1ba592[_0xf4f6('0x58')][_0xf4f6('0x59')]=_0x44fbc0;return db[_0xf4f6('0x51')][_0xf4f6('0x54')]({'body':_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x26')],'MailAccountId':_0x205fcb['account']['id'],'MailInteractionId':_0x1156cc['id'],'direction':'in','ContactId':_0x1ba592['contact']['id'],'messageId':_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x15')][_0xf4f6('0x4b')],'from':_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x15')][_0xf4f6('0x2f')],'to':_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x15')]['to'],'cc':_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x15')]['cc'],'subject':_0x205fcb[_0xf4f6('0x26')]['message'][_0xf4f6('0x4d')],'attach':_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x15')][_0xf4f6('0x4e')],'Attachments':_0x205fcb[_0xf4f6('0x26')][_0xf4f6('0x15')]['attachments'],'originTo':_0x205fcb['body'][_0xf4f6('0x15')][_0xf4f6('0x5a')],'originCc':_0x205fcb['body'][_0xf4f6('0x15')][_0xf4f6('0x5b')],'bcc':_0x205fcb['body'][_0xf4f6('0x15')][_0xf4f6('0x5c')]},{'include':[{'model':db[_0xf4f6('0x5d')],'as':_0xf4f6('0x5e')}]});})[_0xf4f6('0xe')](function(_0x394a90){_0x1ba592[_0xf4f6('0x15')]=_0x394a90;if(_0x1ba592[_0xf4f6('0x58')][_0xf4f6('0x5f')]){return db[_0xf4f6('0x60')][_0xf4f6('0x24')]({'attributes':['id','name'],'where':{'id':_0x1ba592[_0xf4f6('0x58')]['UserId']}})['then'](function(_0x127ba6){if(_0x127ba6){_0x1ba592['applications'][_0xf4f6('0x61')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x127ba6['name']+','+(_0x1ba592[_0xf4f6('0x36')][_0xf4f6('0x62')]||0xa),'interval':_0xf4f6('0x63')});}return respondWithRpcPromise(_0xf4f6('0x64'),_0xf4f6('0x65'),_0x1ba592);});}return respondWithRpcPromise(_0xf4f6('0x64'),_0xf4f6('0x65'),_0x1ba592);})[_0xf4f6('0xe')](function(_0x3a51e9){_0xa7f347(_0x3a51e9);})[_0xf4f6('0x17')](function(_0x3d1e37){_0x418eae(_0x10c1bc[_0xf4f6('0x13')](0x1f4,_0x3d1e37[_0xf4f6('0x15')]));});});}; \ No newline at end of file +var _0x3750=['request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetMailAccount','MailAccount','options','raw','attributes','limit','map','include','model','ShowMailAccount','find','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC','MailApplication','MailServerOut','Smtp','get','omit','Applications','applications','list','orderBy','priority','asc','length','close','autoclose','*,*,*,*','Contacts','defaults','create','List\x20not\x20found','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','MailInteraction','Contact\x20not\x20found','spread','format','interaction','created','attachments','originTo','bcc','Attachments','User','name','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register'];(function(_0x3bfe12,_0x2e0958){var _0x54dff5=function(_0x4db5fa){while(--_0x4db5fa){_0x3bfe12['push'](_0x3bfe12['shift']());}};_0x54dff5(++_0x2e0958);}(_0x3750,0xbb));var _0x0375=function(_0x2cd1e4,_0x23d906){_0x2cd1e4=_0x2cd1e4-0x0;var _0x167374=_0x3750[_0x2cd1e4];return _0x167374;};'use strict';var _=require(_0x0375('0x0'));var util=require(_0x0375('0x1'));var moment=require(_0x0375('0x2'));var BPromise=require(_0x0375('0x3'));var rs=require(_0x0375('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0375('0x5'))['db'];var utils=require(_0x0375('0x6'));var logger=require('../../config/logger')(_0x0375('0x7'));var config=require(_0x0375('0x8'));var jayson=require(_0x0375('0x9'));var client=jayson[_0x0375('0xa')][_0x0375('0xb')]({'port':0x232c});config[_0x0375('0xc')]=_['defaults'](config[_0x0375('0xc')],{'host':_0x0375('0xd'),'port':0x18eb});var socket=require(_0x0375('0xe'))(new Redis(config[_0x0375('0xc')]));require(_0x0375('0xf'))[_0x0375('0x10')](socket);function respondWithRpcPromise(_0x57c040,_0x7d6563,_0x2b667c){return new BPromise(function(_0x257974,_0x91f5fb){return client[_0x0375('0x11')](_0x57c040,_0x2b667c)[_0x0375('0x12')](function(_0x36e0f0){logger[_0x0375('0x13')](_0x0375('0x14'),_0x7d6563,_0x0375('0x15'));logger[_0x0375('0x16')](_0x0375('0x17'),_0x7d6563,'request\x20sent',JSON[_0x0375('0x18')](_0x36e0f0));if(_0x36e0f0['error']){if(_0x36e0f0[_0x0375('0x19')]['code']===0x1f4){logger[_0x0375('0x19')]('MailAccount,\x20%s,\x20%s',_0x7d6563,_0x36e0f0[_0x0375('0x19')][_0x0375('0x1a')]);return _0x91f5fb(_0x36e0f0[_0x0375('0x19')][_0x0375('0x1a')]);}logger[_0x0375('0x19')](_0x0375('0x14'),_0x7d6563,_0x36e0f0[_0x0375('0x19')][_0x0375('0x1a')]);return _0x257974(_0x36e0f0[_0x0375('0x19')]['message']);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x7d6563,_0x0375('0x15'));_0x257974(_0x36e0f0['result']['message']);}})[_0x0375('0x1b')](function(_0x12771d){logger[_0x0375('0x19')]('MailAccount,\x20%s,\x20%s',_0x7d6563,_0x12771d);_0x91f5fb(_0x12771d);});});}exports[_0x0375('0x1c')]=function(_0x2d14b6){var _0x4f0830=this;return new Promise(function(_0x4a9331,_0x5ee87e){return db[_0x0375('0x1d')]['findAll']({'raw':_0x2d14b6[_0x0375('0x1e')]?_0x2d14b6[_0x0375('0x1e')][_0x0375('0x1f')]===undefined?!![]:![]:!![],'where':_0x2d14b6[_0x0375('0x1e')]?_0x2d14b6[_0x0375('0x1e')]['where']||null:null,'attributes':_0x2d14b6[_0x0375('0x1e')]?_0x2d14b6[_0x0375('0x1e')][_0x0375('0x20')]||null:null,'limit':_0x2d14b6['options']?_0x2d14b6[_0x0375('0x1e')][_0x0375('0x21')]||null:null,'include':_0x2d14b6[_0x0375('0x1e')]?_0x2d14b6[_0x0375('0x1e')]['include']?_[_0x0375('0x22')](_0x2d14b6[_0x0375('0x1e')]['include'],function(_0x4c2285){return{'model':db[_0x4c2285['model']],'as':_0x4c2285['as'],'attributes':_0x4c2285['attributes'],'include':_0x4c2285[_0x0375('0x23')]?_[_0x0375('0x22')](_0x4c2285[_0x0375('0x23')],function(_0x527204){return{'model':db[_0x527204[_0x0375('0x24')]],'as':_0x527204['as'],'attributes':_0x527204['attributes'],'include':_0x527204[_0x0375('0x23')]?_[_0x0375('0x22')](_0x527204[_0x0375('0x23')],function(_0x43273c){return{'model':db[_0x43273c[_0x0375('0x24')]],'as':_0x43273c['as'],'attributes':_0x43273c[_0x0375('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0375('0x12')](function(_0x4fe547){logger[_0x0375('0x13')](_0x0375('0x1c'),_0x2d14b6);logger['debug'](_0x0375('0x1c'),_0x2d14b6,JSON['stringify'](_0x4fe547));_0x4a9331(_0x4fe547);})[_0x0375('0x1b')](function(_0x129416){logger['error'](_0x0375('0x1c'),_0x129416[_0x0375('0x1a')],_0x2d14b6);_0x5ee87e(_0x4f0830['error'](0x1f4,_0x129416['message']));});});};exports[_0x0375('0x25')]=function(_0x3379ed){var _0x18b054=this;return new Promise(function(_0x5f15a5,_0x4d24be){return db[_0x0375('0x1d')][_0x0375('0x26')]({'raw':_0x3379ed[_0x0375('0x1e')]?_0x3379ed[_0x0375('0x1e')][_0x0375('0x1f')]===undefined?!![]:![]:!![],'where':_0x3379ed['options']?_0x3379ed['options']['where']||null:null,'attributes':_0x3379ed['options']?_0x3379ed['options'][_0x0375('0x20')]||null:null,'include':_0x3379ed[_0x0375('0x1e')]?_0x3379ed[_0x0375('0x1e')][_0x0375('0x23')]?_[_0x0375('0x22')](_0x3379ed['options'][_0x0375('0x23')],function(_0x11804f){return{'model':db[_0x11804f['model']],'as':_0x11804f['as'],'attributes':_0x11804f[_0x0375('0x20')],'include':_0x11804f[_0x0375('0x23')]?_[_0x0375('0x22')](_0x11804f[_0x0375('0x23')],function(_0x13e6a4){return{'model':db[_0x13e6a4[_0x0375('0x24')]],'as':_0x13e6a4['as'],'attributes':_0x13e6a4[_0x0375('0x20')],'include':_0x13e6a4[_0x0375('0x23')]?_['map'](_0x13e6a4[_0x0375('0x23')],function(_0x44d566){return{'model':db[_0x44d566[_0x0375('0x24')]],'as':_0x44d566['as'],'attributes':_0x44d566[_0x0375('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0375('0x12')](function(_0xcdb334){logger['info'](_0x0375('0x25'),_0x3379ed);logger['debug']('ShowMailAccount',_0x3379ed,JSON[_0x0375('0x18')](_0xcdb334));_0x5f15a5(_0xcdb334);})['catch'](function(_0xbd491d){logger['error'](_0x0375('0x25'),_0xbd491d[_0x0375('0x1a')],_0x3379ed);_0x4d24be(_0x18b054['error'](0x1f4,_0xbd491d['message']));});});};exports[_0x0375('0x27')]=function(_0x2e60be){var _0x1f2065=this;return new Promise(function(_0x963231,_0xc6a86c){var _0x49878f={'body':_0x2e60be[_0x0375('0x28')],'channel':_0x0375('0x29')};var _0x3f1532=_[_0x0375('0x2a')](_[_0x0375('0x2b')](db[_0x0375('0x2c')][_0x0375('0x2d')]),['createdAt',_0x0375('0x2e'),_0x0375('0x2f'),_0x0375('0x30')]);var _0x5de35e=![];if(_0x2e60be[_0x0375('0x28')]['id']){delete _0x2e60be['body']['id'];}if(_[_0x0375('0x31')](_0x2e60be[_0x0375('0x28')][_0x0375('0x32')])){return _0xc6a86c(_0x1f2065['error'](0x1f4,_0x0375('0x33')));}if(_[_0x0375('0x31')](_0x2e60be[_0x0375('0x28')]['body'])||_0x2e60be[_0x0375('0x28')][_0x0375('0x28')]===''){return _0xc6a86c(_0x1f2065[_0x0375('0x19')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x0375('0x31')](_0x2e60be['body'][_0x0375('0x34')])){return _0xc6a86c(_0x1f2065[_0x0375('0x19')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3f1532));}if(!_['includes'](_0x3f1532,_0x2e60be['body'][_0x0375('0x34')])){return _0xc6a86c(_0x1f2065[_0x0375('0x19')](0x1f4,_0x0375('0x35')+_0x3f1532));}var _0x49a9a9={};_0x49a9a9[_0x2e60be[_0x0375('0x28')]['mapKey']]=_0x2e60be['body'][_0x0375('0x32')];return db['MailAccount'][_0x0375('0x26')]({'where':{'id':_0x2e60be[_0x0375('0x36')]['id']},'include':[{'model':db[_0x0375('0x37')],'as':_0x0375('0x38'),'include':[{'model':db[_0x0375('0x2c')],'as':'Contacts','where':_0x49a9a9,'limit':0x1,'order':[[_0x0375('0x2e'),_0x0375('0x39')]]}]},{'model':db[_0x0375('0x3a')],'as':'Applications'},{'model':db[_0x0375('0x3b')],'as':_0x0375('0x3c')}]})[_0x0375('0x12')](function(_0x50fad9){if(_0x50fad9&&_0x50fad9['List']){var _0x1ebcce=_0x50fad9[_0x0375('0x3d')]({'plain':!![]});_0x49878f[_0x0375('0x36')]=_[_0x0375('0x3e')](_0x1ebcce,[_0x0375('0x3f'),_0x0375('0x38')]);_0x49878f[_0x0375('0x40')]=_0x1ebcce[_0x0375('0x3f')];_0x49878f[_0x0375('0x41')]=_0x1ebcce['List'];_0x49878f[_0x0375('0x40')]=_[_0x0375('0x42')](_0x49878f[_0x0375('0x40')],[_0x0375('0x43')],[_0x0375('0x44')]);if(_0x49878f[_0x0375('0x36')]&&_0x49878f[_0x0375('0x36')]['autoclose']){_0x49878f[_0x0375('0x40')]['push']({'id':0x0,'priority':_0x49878f[_0x0375('0x40')][_0x0375('0x45')]+0x1,'app':_0x0375('0x46'),'appdata':_0x0375('0x47'),'interval':_0x0375('0x48')});}if(_0x49878f[_0x0375('0x36')]['Applications']){delete _0x49878f['account'][_0x0375('0x3f')];}if(_0x49878f[_0x0375('0x36')][_0x0375('0x38')]){delete _0x49878f[_0x0375('0x36')][_0x0375('0x38')];}if(_0x1ebcce[_0x0375('0x38')][_0x0375('0x49')]['length']){return _0x1ebcce[_0x0375('0x38')][_0x0375('0x49')][0x0];}var _0x43e9ca=_[_0x0375('0x4a')](_0x2e60be[_0x0375('0x28')],{'firstName':_0x2e60be[_0x0375('0x28')][_0x0375('0x32')],'ListId':_0x1ebcce[_0x0375('0x30')]});_0x43e9ca[_0x2e60be[_0x0375('0x28')][_0x0375('0x34')]]=_0x2e60be['body']['from'];return db['CmContact'][_0x0375('0x4b')](_0x43e9ca);}else{throw new Error(_0x0375('0x4c'));}})[_0x0375('0x12')](function(_0x4c0799){_0x49878f['contact']=_0x4c0799;if(_0x4c0799){if(!_0x2e60be[_0x0375('0x28')][_0x0375('0x1a')][_0x0375('0x4d')]){_0x2e60be[_0x0375('0x28')][_0x0375('0x1a')]['messageId']=rs[_0x0375('0x4e')]()+'\x20'+_0x2e60be[_0x0375('0x28')][_0x0375('0x1a')]['from'];}var _0x5ecb91={'ContactId':_0x4c0799['id'],'MailAccountId':_0x2e60be[_0x0375('0x36')]['id'],'inReplyTo':_0x2e60be[_0x0375('0x28')][_0x0375('0x1a')][_0x0375('0x4d')],'to':_0x2e60be[_0x0375('0x28')]['message'][_0x0375('0x32')],'cc':_0x2e60be[_0x0375('0x28')]['message']['cc'],'subject':_0x2e60be[_0x0375('0x28')]['message'][_0x0375('0x4f')],'attach':_0x2e60be[_0x0375('0x28')][_0x0375('0x1a')][_0x0375('0x50')],'lastMsgAt':moment()['format'](_0x0375('0x51')),'lastMsgDirection':'in','lastMsgBody':_0x2e60be[_0x0375('0x28')][_0x0375('0x28')]};return db['MailInteraction'][_0x0375('0x26')]({'where':{'closed':![],'MailAccountId':_0x2e60be['account']['id']},'include':[{'model':db[_0x0375('0x52')],'as':_0x0375('0x53'),'attributes':[_0x0375('0x4d')],'where':{'messageId':_0x2e60be[_0x0375('0x28')][_0x0375('0x1a')]['inReplyTo']}}]})['then'](function(_0x527a24){if(_0x527a24){return[_0x527a24,![]];}return db[_0x0375('0x54')][_0x0375('0x4b')](_0x5ecb91)[_0x0375('0x12')](function(_0x435dd9){return[_0x435dd9,!![]];});});}else{throw new Error(_0x0375('0x55'));}})[_0x0375('0x56')](function(_0x588667,_0x32a706){if(_0x588667){_0x5de35e=_0x32a706;if(!_0x32a706){return _0x588667['update']({'inReplyTo':_0x2e60be['body'][_0x0375('0x1a')][_0x0375('0x4d')],'to':_0x2e60be[_0x0375('0x28')]['message']['from'],'cc':_0x2e60be[_0x0375('0x28')][_0x0375('0x1a')]['cc'],'subject':_0x2e60be[_0x0375('0x28')]['message'][_0x0375('0x4f')],'attach':_0x588667['attach']?_0x588667[_0x0375('0x50')]:_0x2e60be[_0x0375('0x28')][_0x0375('0x1a')][_0x0375('0x50')],'substatus':null,'substatusAt':moment()[_0x0375('0x57')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x0375('0x57')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x2e60be[_0x0375('0x28')][_0x0375('0x28')]});}else{return _0x588667;}}})[_0x0375('0x12')](function(_0x2a119a){_0x49878f[_0x0375('0x58')]=_0x2a119a[_0x0375('0x3d')]({'plain':!![]});_0x49878f[_0x0375('0x58')][_0x0375('0x59')]=_0x5de35e;return db[_0x0375('0x52')][_0x0375('0x4b')]({'body':_0x2e60be[_0x0375('0x28')][_0x0375('0x28')],'MailAccountId':_0x2e60be['account']['id'],'MailInteractionId':_0x2a119a['id'],'direction':'in','ContactId':_0x49878f['contact']['id'],'messageId':_0x2e60be[_0x0375('0x28')][_0x0375('0x1a')][_0x0375('0x4d')],'from':_0x2e60be[_0x0375('0x28')]['message'][_0x0375('0x32')],'to':_0x2e60be['body'][_0x0375('0x1a')]['to'],'cc':_0x2e60be[_0x0375('0x28')]['message']['cc'],'subject':_0x2e60be[_0x0375('0x28')][_0x0375('0x1a')][_0x0375('0x4f')],'attach':_0x2e60be[_0x0375('0x28')]['message'][_0x0375('0x50')],'Attachments':_0x2e60be[_0x0375('0x28')][_0x0375('0x1a')][_0x0375('0x5a')],'originTo':_0x2e60be[_0x0375('0x28')][_0x0375('0x1a')][_0x0375('0x5b')],'originCc':_0x2e60be[_0x0375('0x28')][_0x0375('0x1a')]['originCc'],'bcc':_0x2e60be[_0x0375('0x28')][_0x0375('0x1a')][_0x0375('0x5c')]},{'include':[{'model':db['Attachment'],'as':_0x0375('0x5d')}]});})[_0x0375('0x12')](function(_0x1d4229){_0x49878f[_0x0375('0x1a')]=_0x1d4229;if(_0x49878f['interaction']['UserId']){return db[_0x0375('0x5e')][_0x0375('0x26')]({'attributes':['id',_0x0375('0x5f')],'where':{'id':_0x49878f[_0x0375('0x58')][_0x0375('0x60')]}})['then'](function(_0x13cce5){if(_0x13cce5){_0x49878f[_0x0375('0x40')][_0x0375('0x61')]({'id':0x0,'priority':0x0,'app':_0x0375('0x62'),'appdata':_0x13cce5[_0x0375('0x5f')]+','+(_0x49878f['account'][_0x0375('0x63')]||0xa),'interval':_0x0375('0x48')});}return respondWithRpcPromise(_0x0375('0x64'),'startRouting',_0x49878f);});}return respondWithRpcPromise(_0x0375('0x64'),_0x0375('0x65'),_0x49878f);})[_0x0375('0x12')](function(_0x50a368){_0x963231(_0x50a368);})[_0x0375('0x1b')](function(_0xf2eed8){_0xc6a86c(_0x1f2065[_0x0375('0x19')](0x1f4,_0xf2eed8[_0x0375('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 5b3311e..9986a15 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 _0xdbbe=['update','removeListener','register','save','remove'];(function(_0x1fd6b0,_0x5a40a0){var _0x202a08=function(_0x3a0674){while(--_0x3a0674){_0x1fd6b0['push'](_0x1fd6b0['shift']());}};_0x202a08(++_0x5a40a0);}(_0xdbbe,0x148));var _0xedbb=function(_0x484c03,_0x13c1d2){_0x484c03=_0x484c03-0x0;var _0x294127=_0xdbbe[_0x484c03];return _0x294127;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xedbb('0x0'),_0xedbb('0x1'),_0xedbb('0x2')];function createListener(_0x348cfa,_0xaeb19a){return function(_0x13d00d){_0xaeb19a['emit'](_0x348cfa,_0x13d00d);};}function removeListener(_0x282712,_0x9c1af2){return function(){MailAccountEvents[_0xedbb('0x3')](_0x282712,_0x9c1af2);};}exports[_0xedbb('0x4')]=function(_0x8022ef){for(var _0x87ee1e=0x0,_0x2bb3dd=events['length'];_0x87ee1e<_0x2bb3dd;_0x87ee1e++){var _0xd9cf8c=events[_0x87ee1e];var _0x1ba82a=createListener('mailAccount:'+_0xd9cf8c,_0x8022ef);MailAccountEvents['on'](_0xd9cf8c,_0x1ba82a);}}; \ No newline at end of file +var _0x8a28=['mailAccount:','./mailAccount.events','save','remove','update','emit','removeListener','register','length'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x8a28,0xfd));var _0x88a2=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x8a28[_0x3054be];return _0x3df150;};'use strict';var MailAccountEvents=require(_0x88a2('0x0'));var events=[_0x88a2('0x1'),_0x88a2('0x2'),_0x88a2('0x3')];function createListener(_0x27b1c1,_0x29e6d8){return function(_0x26138e){_0x29e6d8[_0x88a2('0x4')](_0x27b1c1,_0x26138e);};}function removeListener(_0x5d5b92,_0x2f482e){return function(){MailAccountEvents[_0x88a2('0x5')](_0x5d5b92,_0x2f482e);};}exports[_0x88a2('0x6')]=function(_0x438e32){for(var _0x29ce92=0x0,_0x5cb591=events[_0x88a2('0x7')];_0x29ce92<_0x5cb591;_0x29ce92++){var _0x5406ed=events[_0x29ce92];var _0x1cdf6b=createListener(_0x88a2('0x8')+_0x5406ed,_0x438e32);MailAccountEvents['on'](_0x5406ed,_0x1cdf6b);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 670175f..2d46f00 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 _0xd87e=['util','connect-timeout','express','Router','../../components/interaction/service','./mailApplication.controller','get','isAuthenticated','/:id','update','delete','destroy','exports','multer'];(function(_0x578ddc,_0x304458){var _0x1cd053=function(_0x541982){while(--_0x541982){_0x578ddc['push'](_0x578ddc['shift']());}};_0x1cd053(++_0x304458);}(_0xd87e,0x1bf));var _0xed87=function(_0x59591b,_0x354045){_0x59591b=_0x59591b-0x0;var _0x576642=_0xd87e[_0x59591b];return _0x576642;};'use strict';var multer=require(_0xed87('0x0'));var util=require(_0xed87('0x1'));var path=require('path');var timeout=require(_0xed87('0x2'));var express=require(_0xed87('0x3'));var router=express[_0xed87('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xed87('0x5'));var config=require('../../config/environment');var controller=require(_0xed87('0x6'));router[_0xed87('0x7')]('/:id',auth[_0xed87('0x8')](),controller['show']);router['put'](_0xed87('0x9'),auth[_0xed87('0x8')](),controller[_0xed87('0xa')]);router[_0xed87('0xb')]('/:id',auth[_0xed87('0x8')](),controller[_0xed87('0xc')]);module[_0xed87('0xd')]=router; \ No newline at end of file +var _0x7072=['put','update','delete','exports','util','path','connect-timeout','express','Router','../../config/environment','get','/:id','isAuthenticated','show'];(function(_0x3e6637,_0x2db7b1){var _0x591d2b=function(_0x248962){while(--_0x248962){_0x3e6637['push'](_0x3e6637['shift']());}};_0x591d2b(++_0x2db7b1);}(_0x7072,0x138));var _0x2707=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x7072[_0x2df507];return _0x1f7167;};'use strict';var multer=require('multer');var util=require(_0x2707('0x0'));var path=require(_0x2707('0x1'));var timeout=require(_0x2707('0x2'));var express=require(_0x2707('0x3'));var router=express[_0x2707('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2707('0x5'));var controller=require('./mailApplication.controller');router[_0x2707('0x6')](_0x2707('0x7'),auth[_0x2707('0x8')](),controller[_0x2707('0x9')]);router[_0x2707('0xa')](_0x2707('0x7'),auth[_0x2707('0x8')](),controller[_0x2707('0xb')]);router[_0x2707('0xc')](_0x2707('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0x2707('0xd')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index d533763..7dec3c6 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 _0x33f0=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x3b128e,_0x26ec45){var _0x27d4fc=function(_0x4aa020){while(--_0x4aa020){_0x3b128e['push'](_0x3b128e['shift']());}};_0x27d4fc(++_0x26ec45);}(_0x33f0,0x108));var _0x033f=function(_0x3c4822,_0x599ad8){_0x3c4822=_0x3c4822-0x0;var _0x2e16f6=_0x33f0[_0x3c4822];return _0x2e16f6;};'use strict';var Sequelize=require(_0x033f('0x0'));module[_0x033f('0x1')]={'priority':{'type':Sequelize[_0x033f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x033f('0x3')],'allowNull':![],'defaultValue':_0x033f('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x033f('0x3')]},'interval':{'type':Sequelize[_0x033f('0x3')],'defaultValue':_0x033f('0x5')}}; \ No newline at end of file +var _0x07e7=['noop','TEXT','STRING','exports','INTEGER'];(function(_0x5a7d41,_0x4447e2){var _0x98d8fa=function(_0x2ce1cf){while(--_0x2ce1cf){_0x5a7d41['push'](_0x5a7d41['shift']());}};_0x98d8fa(++_0x4447e2);}(_0x07e7,0x1f2));var _0x707e=function(_0x52a489,_0x4a2979){_0x52a489=_0x52a489-0x0;var _0xc67089=_0x07e7[_0x52a489];return _0xc67089;};'use strict';var Sequelize=require('sequelize');module[_0x707e('0x0')]={'priority':{'type':Sequelize[_0x707e('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x707e('0x2')},'appdata':{'type':Sequelize[_0x707e('0x3')]()},'description':{'type':Sequelize[_0x707e('0x4')]},'interval':{'type':Sequelize[_0x707e('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 01086e5..e969d9f 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 _0xeba1=['sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','status','end','json','offset','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','body','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x2dbab4,_0x1f6a5e){var _0x83c54f=function(_0x2fb793){while(--_0x2fb793){_0x2dbab4['push'](_0x2dbab4['shift']());}};_0x83c54f(++_0x1f6a5e);}(_0xeba1,0x98));var _0x1eba=function(_0x256827,_0xc5c033){_0x256827=_0x256827-0x0;var _0x41efa8=_0xeba1[_0x256827];return _0x41efa8;};'use strict';var pdf=require(_0x1eba('0x0'));var emlformat=require(_0x1eba('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1eba('0x2'));var rp=require(_0x1eba('0x3'));var moment=require('moment');var BPromise=require(_0x1eba('0x4'));var Mustache=require(_0x1eba('0x5'));var util=require(_0x1eba('0x6'));var path=require('path');var sox=require(_0x1eba('0x7'));var csv=require(_0x1eba('0x8'));var ejs=require(_0x1eba('0x9'));var fs=require('fs');var _=require(_0x1eba('0xa'));var squel=require(_0x1eba('0xb'));var crypto=require(_0x1eba('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1eba('0xd'));var toCsv=require(_0x1eba('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1eba('0xe'));var authService=require(_0x1eba('0xf'));var qs=require(_0x1eba('0x10'));var as=require(_0x1eba('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1eba('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1eba('0x13'))['db'];function respondWithStatusCode(_0x50b8eb,_0x24ec4e){_0x24ec4e=_0x24ec4e||0xcc;return function(_0x3982ca){if(_0x3982ca){return _0x50b8eb['sendStatus'](_0x24ec4e);}return _0x50b8eb[_0x1eba('0x14')](_0x24ec4e)[_0x1eba('0x15')]();};}function respondWithResult(_0x7a469,_0x4105d5){_0x4105d5=_0x4105d5||0xc8;return function(_0x3292cb){if(_0x3292cb){return _0x7a469[_0x1eba('0x14')](_0x4105d5)[_0x1eba('0x16')](_0x3292cb);}};}function respondWithFilteredResult(_0x4c3937,_0xe4c992){return function(_0xc5d14e){if(_0xc5d14e){var _0x12026a=_0xc5d14e['count'],_0x35e9c6=_0xe4c992[_0x1eba('0x17')],_0x443cab=_0xe4c992[_0x1eba('0x17')]+_0xe4c992['limit'],_0x15e402;if(_0x443cab>=_0x12026a){_0x443cab=_0x12026a;_0x15e402=0xc8;}else{_0x15e402=0xce;}_0x4c3937[_0x1eba('0x14')](_0x15e402);return _0x4c3937['set'](_0x1eba('0x18'),_0x35e9c6+'-'+_0x443cab+'/'+_0x12026a)[_0x1eba('0x16')](_0xc5d14e);}return null;};}function patchUpdates(_0x2b59a8){return function(_0x121154){try{jsonpatch[_0x1eba('0x19')](_0x121154,_0x2b59a8,!![]);}catch(_0x1afd70){return BPromise['reject'](_0x1afd70);}return _0x121154[_0x1eba('0x1a')]();};}function saveUpdates(_0x4ce2eb,_0x51d971){return function(_0x3bd6c4){if(_0x3bd6c4){return _0x3bd6c4[_0x1eba('0x1b')](_0x4ce2eb)[_0x1eba('0x1c')](function(_0x214e4f){return _0x214e4f;});}return null;};}function removeEntity(_0x5ee4e8,_0x3fc7d7){return function(_0x3c5b63){if(_0x3c5b63){return _0x3c5b63[_0x1eba('0x1d')]()['then'](function(){_0x5ee4e8['status'](0xcc)[_0x1eba('0x15')]();});}};}function handleEntityNotFound(_0x165aa1,_0x49e415){return function(_0x8f6221){if(!_0x8f6221){_0x165aa1[_0x1eba('0x1e')](0x194);}return _0x8f6221;};}function handleError(_0x2000e2,_0x4148b7){_0x4148b7=_0x4148b7||0x1f4;return function(_0x33f188){logger[_0x1eba('0x1f')](_0x33f188[_0x1eba('0x20')]);if(_0x33f188['name']){delete _0x33f188['name'];}_0x2000e2[_0x1eba('0x14')](_0x4148b7)[_0x1eba('0x21')](_0x33f188);};}exports[_0x1eba('0x22')]=function(_0x28d3af,_0x2421ac){var _0x15b210={'raw':!![],'where':{'id':_0x28d3af[_0x1eba('0x23')]['id']}},_0xc5179f={};_0xc5179f[_0x1eba('0x24')]=_[_0x1eba('0x25')](db[_0x1eba('0x26')][_0x1eba('0x27')]);_0xc5179f[_0x1eba('0x28')]=_[_0x1eba('0x25')](_0x28d3af['query']);_0xc5179f[_0x1eba('0x29')]=_[_0x1eba('0x2a')](_0xc5179f[_0x1eba('0x24')],_0xc5179f[_0x1eba('0x28')]);_0x15b210[_0x1eba('0x2b')]=_[_0x1eba('0x2a')](_0xc5179f[_0x1eba('0x24')],qs['fields'](_0x28d3af[_0x1eba('0x28')][_0x1eba('0x2c')]));_0x15b210[_0x1eba('0x2b')]=_0x15b210[_0x1eba('0x2b')][_0x1eba('0x2d')]?_0x15b210[_0x1eba('0x2b')]:_0xc5179f[_0x1eba('0x24')];if(_0x28d3af['query'][_0x1eba('0x2e')]){_0x15b210[_0x1eba('0x2f')]=[{'all':!![]}];}_0x15b210=_[_0x1eba('0x30')]({},_0x15b210,_0x28d3af[_0x1eba('0x31')]);return db[_0x1eba('0x26')][_0x1eba('0x32')](_0x15b210)[_0x1eba('0x1c')](handleEntityNotFound(_0x2421ac,null))[_0x1eba('0x1c')](respondWithResult(_0x2421ac,null))[_0x1eba('0x33')](handleError(_0x2421ac,null));};exports[_0x1eba('0x1b')]=function(_0x3b2b2e,_0x2cb0c8){if(_0x3b2b2e[_0x1eba('0x34')]['id']){delete _0x3b2b2e['body']['id'];}return db[_0x1eba('0x26')]['find']({'where':{'id':_0x3b2b2e[_0x1eba('0x23')]['id']}})[_0x1eba('0x1c')](handleEntityNotFound(_0x2cb0c8,null))['then'](saveUpdates(_0x3b2b2e[_0x1eba('0x34')],null))[_0x1eba('0x1c')](respondWithResult(_0x2cb0c8,null))[_0x1eba('0x33')](handleError(_0x2cb0c8,null));};exports[_0x1eba('0x1d')]=function(_0x307679,_0x4ac942){return db['MailApplication'][_0x1eba('0x32')]({'where':{'id':_0x307679[_0x1eba('0x23')]['id']}})[_0x1eba('0x1c')](handleEntityNotFound(_0x4ac942,null))[_0x1eba('0x1c')](removeEntity(_0x4ac942,null))[_0x1eba('0x33')](handleError(_0x4ac942,null));}; \ No newline at end of file +var _0xd53d=['merge','options','find','body','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include'];(function(_0x1ca9e9,_0x1c4391){var _0x309f3c=function(_0x5ab318){while(--_0x5ab318){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x309f3c(++_0x1c4391);}(_0xd53d,0x14f));var _0xdd53=function(_0x308582,_0x304836){_0x308582=_0x308582-0x0;var _0x1ee2d3=_0xd53d[_0x308582];return _0x1ee2d3;};'use strict';var pdf=require(_0xdd53('0x0'));var emlformat=require(_0xdd53('0x1'));var rimraf=require(_0xdd53('0x2'));var zipdir=require(_0xdd53('0x3'));var jsonpatch=require(_0xdd53('0x4'));var rp=require(_0xdd53('0x5'));var moment=require(_0xdd53('0x6'));var BPromise=require(_0xdd53('0x7'));var Mustache=require(_0xdd53('0x8'));var util=require(_0xdd53('0x9'));var path=require(_0xdd53('0xa'));var sox=require(_0xdd53('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xdd53('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdd53('0xd'));var deskjs=require(_0xdd53('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdd53('0xf'));var as=require(_0xdd53('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd53('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xdd53('0x12'));var licenseUtil=require(_0xdd53('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cac6e,_0x18a039){_0x18a039=_0x18a039||0xcc;return function(_0x4ab847){if(_0x4ab847){return _0x3cac6e[_0xdd53('0x14')](_0x18a039);}return _0x3cac6e['status'](_0x18a039)[_0xdd53('0x15')]();};}function respondWithResult(_0x825694,_0x3c804c){_0x3c804c=_0x3c804c||0xc8;return function(_0x1094da){if(_0x1094da){return _0x825694[_0xdd53('0x16')](_0x3c804c)[_0xdd53('0x17')](_0x1094da);}};}function respondWithFilteredResult(_0x3a509f,_0x2f899d){return function(_0x56204d){if(_0x56204d){var _0x281b8b=_0x56204d[_0xdd53('0x18')],_0x55ef27=_0x2f899d['offset'],_0x584383=_0x2f899d['offset']+_0x2f899d[_0xdd53('0x19')],_0x57e6cf;if(_0x584383>=_0x281b8b){_0x584383=_0x281b8b;_0x57e6cf=0xc8;}else{_0x57e6cf=0xce;}_0x3a509f[_0xdd53('0x16')](_0x57e6cf);return _0x3a509f['set'](_0xdd53('0x1a'),_0x55ef27+'-'+_0x584383+'/'+_0x281b8b)[_0xdd53('0x17')](_0x56204d);}return null;};}function patchUpdates(_0x5deef2){return function(_0x51cf6e){try{jsonpatch[_0xdd53('0x1b')](_0x51cf6e,_0x5deef2,!![]);}catch(_0xb74b6e){return BPromise[_0xdd53('0x1c')](_0xb74b6e);}return _0x51cf6e[_0xdd53('0x1d')]();};}function saveUpdates(_0x1ec79e,_0x49a3de){return function(_0x1db976){if(_0x1db976){return _0x1db976[_0xdd53('0x1e')](_0x1ec79e)[_0xdd53('0x1f')](function(_0x31191a){return _0x31191a;});}return null;};}function removeEntity(_0x539620,_0x1b65d0){return function(_0x3eab0a){if(_0x3eab0a){return _0x3eab0a[_0xdd53('0x20')]()[_0xdd53('0x1f')](function(){_0x539620[_0xdd53('0x16')](0xcc)[_0xdd53('0x15')]();});}};}function handleEntityNotFound(_0x3e43d3,_0x9376d7){return function(_0x10e963){if(!_0x10e963){_0x3e43d3[_0xdd53('0x14')](0x194);}return _0x10e963;};}function handleError(_0x3e7cb1,_0x4f882e){_0x4f882e=_0x4f882e||0x1f4;return function(_0x691f3f){logger[_0xdd53('0x21')](_0x691f3f[_0xdd53('0x22')]);if(_0x691f3f[_0xdd53('0x23')]){delete _0x691f3f['name'];}_0x3e7cb1[_0xdd53('0x16')](_0x4f882e)[_0xdd53('0x24')](_0x691f3f);};}exports[_0xdd53('0x25')]=function(_0x13357a,_0x122307){var _0x10d046={'raw':!![],'where':{'id':_0x13357a[_0xdd53('0x26')]['id']}},_0x3e989c={};_0x3e989c[_0xdd53('0x27')]=_[_0xdd53('0x28')](db[_0xdd53('0x29')][_0xdd53('0x2a')]);_0x3e989c[_0xdd53('0x2b')]=_['keys'](_0x13357a[_0xdd53('0x2b')]);_0x3e989c[_0xdd53('0x2c')]=_[_0xdd53('0x2d')](_0x3e989c[_0xdd53('0x27')],_0x3e989c[_0xdd53('0x2b')]);_0x10d046[_0xdd53('0x2e')]=_[_0xdd53('0x2d')](_0x3e989c[_0xdd53('0x27')],qs[_0xdd53('0x2f')](_0x13357a[_0xdd53('0x2b')][_0xdd53('0x2f')]));_0x10d046[_0xdd53('0x2e')]=_0x10d046[_0xdd53('0x2e')]['length']?_0x10d046['attributes']:_0x3e989c[_0xdd53('0x27')];if(_0x13357a['query'][_0xdd53('0x30')]){_0x10d046[_0xdd53('0x31')]=[{'all':!![]}];}_0x10d046=_[_0xdd53('0x32')]({},_0x10d046,_0x13357a[_0xdd53('0x33')]);return db[_0xdd53('0x29')][_0xdd53('0x34')](_0x10d046)['then'](handleEntityNotFound(_0x122307,null))[_0xdd53('0x1f')](respondWithResult(_0x122307,null))['catch'](handleError(_0x122307,null));};exports[_0xdd53('0x1e')]=function(_0x4cbed9,_0x497bea){if(_0x4cbed9['body']['id']){delete _0x4cbed9[_0xdd53('0x35')]['id'];}return db['MailApplication'][_0xdd53('0x34')]({'where':{'id':_0x4cbed9['params']['id']}})[_0xdd53('0x1f')](handleEntityNotFound(_0x497bea,null))[_0xdd53('0x1f')](saveUpdates(_0x4cbed9['body'],null))[_0xdd53('0x1f')](respondWithResult(_0x497bea,null))['catch'](handleError(_0x497bea,null));};exports['destroy']=function(_0x289acc,_0x1c001b){return db['MailApplication'][_0xdd53('0x34')]({'where':{'id':_0x289acc['params']['id']}})['then'](handleEntityNotFound(_0x1c001b,null))[_0xdd53('0x1f')](removeEntity(_0x1c001b,null))[_0xdd53('0x36')](handleError(_0x1c001b,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 7a3e805..c9e137e 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 _0xd08d=['bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','define','MailApplication','mail_applications','utf8mb4_unicode_ci','util','../../config/logger','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd08d,0x81));var _0xdd08=function(_0x3afe18,_0x26922c){_0x3afe18=_0x3afe18-0x0;var _0x19ed1f=_0xd08d[_0x3afe18];return _0x19ed1f;};'use strict';var _=require('lodash');var util=require(_0xdd08('0x0'));var logger=require(_0xdd08('0x1'))('api');var moment=require(_0xdd08('0x2'));var BPromise=require(_0xdd08('0x3'));var rp=require(_0xdd08('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdd08('0x5'));var config=require(_0xdd08('0x6'));var attributes=require(_0xdd08('0x7'));module['exports']=function(_0x37c67a,_0x1587df){return _0x37c67a[_0xdd08('0x8')](_0xdd08('0x9'),attributes,{'tableName':_0xdd08('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xdd08('0xb')});}; \ No newline at end of file +var _0x1219=['define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports'];(function(_0xdaab62,_0x2728ab){var _0x13d767=function(_0x14bf14){while(--_0x14bf14){_0xdaab62['push'](_0xdaab62['shift']());}};_0x13d767(++_0x2728ab);}(_0x1219,0x17c));var _0x9121=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1219[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x9121('0x0'));var util=require(_0x9121('0x1'));var logger=require(_0x9121('0x2'))(_0x9121('0x3'));var moment=require(_0x9121('0x4'));var BPromise=require('bluebird');var rp=require(_0x9121('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9121('0x6'));var config=require(_0x9121('0x7'));var attributes=require(_0x9121('0x8'));module[_0x9121('0x9')]=function(_0x420b62,_0x430583){return _0x420b62[_0x9121('0xa')](_0x9121('0xb'),attributes,{'tableName':_0x9121('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9121('0xd'),'collate':_0x9121('0xe')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index ac949e6..cac71d0 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 _0xb7ae=['http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','body','options','raw','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x17f630,_0x282ece){var _0x575c81=function(_0x3fc382){while(--_0x3fc382){_0x17f630['push'](_0x17f630['shift']());}};_0x575c81(++_0x282ece);}(_0xb7ae,0x19a));var _0xeb7a=function(_0xe4f0a0,_0x1e51ea){_0xe4f0a0=_0xe4f0a0-0x0;var _0x390425=_0xb7ae[_0xe4f0a0];return _0x390425;};'use strict';var _=require(_0xeb7a('0x0'));var util=require(_0xeb7a('0x1'));var moment=require(_0xeb7a('0x2'));var BPromise=require(_0xeb7a('0x3'));var rs=require(_0xeb7a('0x4'));var fs=require('fs');var Redis=require(_0xeb7a('0x5'));var db=require(_0xeb7a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xeb7a('0x7'))(_0xeb7a('0x8'));var config=require('../../config/environment');var jayson=require(_0xeb7a('0x9'));var client=jayson['client'][_0xeb7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x226cf2,_0xe90b4c,_0x524700){return new BPromise(function(_0x5aeff1,_0x330493){return client[_0xeb7a('0xb')](_0x226cf2,_0x524700)[_0xeb7a('0xc')](function(_0x44abf8){logger[_0xeb7a('0xd')](_0xeb7a('0xe'),_0xe90b4c,_0xeb7a('0xf'));logger[_0xeb7a('0x10')](_0xeb7a('0x11'),_0xe90b4c,_0xeb7a('0xf'),JSON[_0xeb7a('0x12')](_0x44abf8));if(_0x44abf8[_0xeb7a('0x13')]){if(_0x44abf8[_0xeb7a('0x13')][_0xeb7a('0x14')]===0x1f4){logger[_0xeb7a('0x13')](_0xeb7a('0xe'),_0xe90b4c,_0x44abf8[_0xeb7a('0x13')][_0xeb7a('0x15')]);return _0x330493(_0x44abf8[_0xeb7a('0x13')]['message']);}logger[_0xeb7a('0x13')]('MailApplication,\x20%s,\x20%s',_0xe90b4c,_0x44abf8['error']['message']);return _0x5aeff1(_0x44abf8[_0xeb7a('0x13')][_0xeb7a('0x15')]);}else{logger[_0xeb7a('0xd')](_0xeb7a('0xe'),_0xe90b4c,_0xeb7a('0xf'));_0x5aeff1(_0x44abf8[_0xeb7a('0x16')][_0xeb7a('0x15')]);}})[_0xeb7a('0x17')](function(_0x775cdc){logger[_0xeb7a('0x13')]('MailApplication,\x20%s,\x20%s',_0xe90b4c,_0x775cdc);_0x330493(_0x775cdc);});});}exports[_0xeb7a('0x18')]=function(_0xa11b69){var _0x4e447f=this;return new Promise(function(_0x190389,_0x2f4b62){return db[_0xeb7a('0x19')]['update'](_0xa11b69[_0xeb7a('0x1a')],{'raw':_0xa11b69[_0xeb7a('0x1b')]?_0xa11b69[_0xeb7a('0x1b')][_0xeb7a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa11b69['options']?_0xa11b69['options']['where']||null:null,'attributes':_0xa11b69['options']?_0xa11b69[_0xeb7a('0x1b')][_0xeb7a('0x1d')]||null:null,'limit':_0xa11b69[_0xeb7a('0x1b')]?_0xa11b69[_0xeb7a('0x1b')]['limit']||null:null})[_0xeb7a('0xc')](function(_0x12d9bb){logger[_0xeb7a('0xd')](_0xeb7a('0x18'),_0xa11b69);logger[_0xeb7a('0x10')]('UpdateMailApplication',_0xa11b69,JSON[_0xeb7a('0x12')](_0x12d9bb));_0x190389(_0x12d9bb);})['catch'](function(_0x514e10){logger[_0xeb7a('0x13')](_0xeb7a('0x18'),_0x514e10[_0xeb7a('0x15')],_0xa11b69);_0x2f4b62(_0x4e447f[_0xeb7a('0x13')](0x1f4,_0x514e10[_0xeb7a('0x15')]));});});}; \ No newline at end of file +var _0x05cb=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','MailApplication,\x20%s,\x20%s','message','info','result','catch','UpdateMailApplication','MailApplication','body','options','raw','limit','then','util'];(function(_0x38390d,_0x484541){var _0x12e8f5=function(_0x42999c){while(--_0x42999c){_0x38390d['push'](_0x38390d['shift']());}};_0x12e8f5(++_0x484541);}(_0x05cb,0x15b));var _0xb05c=function(_0x320fcc,_0x103c3a){_0x320fcc=_0x320fcc-0x0;var _0x16c97c=_0x05cb[_0x320fcc];return _0x16c97c;};'use strict';var _=require('lodash');var util=require(_0xb05c('0x0'));var moment=require(_0xb05c('0x1'));var BPromise=require('bluebird');var rs=require(_0xb05c('0x2'));var fs=require('fs');var Redis=require(_0xb05c('0x3'));var db=require(_0xb05c('0x4'))['db'];var utils=require(_0xb05c('0x5'));var logger=require(_0xb05c('0x6'))(_0xb05c('0x7'));var config=require('../../config/environment');var jayson=require(_0xb05c('0x8'));var client=jayson[_0xb05c('0x9')][_0xb05c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5884e9,_0xb0100a,_0x5c4f70){return new BPromise(function(_0x2e3fd5,_0xa6935){return client[_0xb05c('0xb')](_0x5884e9,_0x5c4f70)['then'](function(_0x16e229){logger['info']('MailApplication,\x20%s,\x20%s',_0xb0100a,_0xb05c('0xc'));logger[_0xb05c('0xd')](_0xb05c('0xe'),_0xb0100a,'request\x20sent',JSON[_0xb05c('0xf')](_0x16e229));if(_0x16e229[_0xb05c('0x10')]){if(_0x16e229['error']['code']===0x1f4){logger['error'](_0xb05c('0x11'),_0xb0100a,_0x16e229[_0xb05c('0x10')]['message']);return _0xa6935(_0x16e229['error'][_0xb05c('0x12')]);}logger[_0xb05c('0x10')](_0xb05c('0x11'),_0xb0100a,_0x16e229[_0xb05c('0x10')][_0xb05c('0x12')]);return _0x2e3fd5(_0x16e229[_0xb05c('0x10')][_0xb05c('0x12')]);}else{logger[_0xb05c('0x13')](_0xb05c('0x11'),_0xb0100a,'request\x20sent');_0x2e3fd5(_0x16e229[_0xb05c('0x14')]['message']);}})[_0xb05c('0x15')](function(_0x492b5b){logger['error'](_0xb05c('0x11'),_0xb0100a,_0x492b5b);_0xa6935(_0x492b5b);});});}exports[_0xb05c('0x16')]=function(_0x1f65ed){var _0x81cf2=this;return new Promise(function(_0x5d7858,_0x5e96d1){return db[_0xb05c('0x17')]['update'](_0x1f65ed[_0xb05c('0x18')],{'raw':_0x1f65ed[_0xb05c('0x19')]?_0x1f65ed[_0xb05c('0x19')][_0xb05c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f65ed[_0xb05c('0x19')]?_0x1f65ed[_0xb05c('0x19')]['where']||null:null,'attributes':_0x1f65ed['options']?_0x1f65ed[_0xb05c('0x19')]['attributes']||null:null,'limit':_0x1f65ed[_0xb05c('0x19')]?_0x1f65ed[_0xb05c('0x19')][_0xb05c('0x1b')]||null:null})[_0xb05c('0x1c')](function(_0x50a6ed){logger['info'](_0xb05c('0x16'),_0x1f65ed);logger[_0xb05c('0xd')](_0xb05c('0x16'),_0x1f65ed,JSON[_0xb05c('0xf')](_0x50a6ed));_0x5d7858(_0x50a6ed);})[_0xb05c('0x15')](function(_0x63d638){logger[_0xb05c('0x10')](_0xb05c('0x16'),_0x63d638[_0xb05c('0x12')],_0x1f65ed);_0x5e96d1(_0x81cf2[_0xb05c('0x10')](0x1f4,_0x63d638[_0xb05c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 284d16a..c11cc1d 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 _0x1738=['../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','/:id/download','download','post','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','tracked','update','delete','mailinteraction:destroy','destroy','removeTags','exports','multer','util','express','Router'];(function(_0x40e288,_0x142b91){var _0x67e58e=function(_0x3a014e){while(--_0x3a014e){_0x40e288['push'](_0x40e288['shift']());}};_0x67e58e(++_0x142b91);}(_0x1738,0x1bc));var _0x8173=function(_0x309c03,_0x52e73d){_0x309c03=_0x309c03-0x0;var _0xbe032f=_0x1738[_0x309c03];return _0xbe032f;};'use strict';var multer=require(_0x8173('0x0'));var util=require(_0x8173('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8173('0x2'));var router=express[_0x8173('0x3')]();var auth=require(_0x8173('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8173('0x5'));router[_0x8173('0x6')]('/',auth[_0x8173('0x7')](),controller[_0x8173('0x8')]);router[_0x8173('0x6')](_0x8173('0x9'),auth[_0x8173('0x7')](),controller[_0x8173('0xa')]);router[_0x8173('0x6')](_0x8173('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x8173('0x6')](_0x8173('0xc'),auth[_0x8173('0x7')](),controller['getMessages']);router['get'](_0x8173('0xd'),auth[_0x8173('0x7')](),controller[_0x8173('0xe')]);router[_0x8173('0xf')]('/',auth[_0x8173('0x7')](),controller['create']);router[_0x8173('0xf')]('/:id/messages',auth[_0x8173('0x7')](),controller[_0x8173('0x10')]);router[_0x8173('0xf')](_0x8173('0x11'),auth[_0x8173('0x7')](),interaction['tracked'](_0x8173('0x12'),_0x8173('0x13')),controller[_0x8173('0x14')]);router['put']('/:id',auth[_0x8173('0x7')](),interaction[_0x8173('0x15')](_0x8173('0x12'),'mailinteraction:update'),controller[_0x8173('0x16')]);router[_0x8173('0x17')]('/:id',auth[_0x8173('0x7')](),interaction[_0x8173('0x15')](_0x8173('0x12'),_0x8173('0x18')),controller[_0x8173('0x19')]);router['delete'](_0x8173('0x11'),auth[_0x8173('0x7')](),controller[_0x8173('0x1a')]);module[_0x8173('0x1b')]=router; \ No newline at end of file +var _0xbdfd=['tracked','mail','mailinteraction:addtags','put','update','delete','mailinteraction:destroy','destroy','removeTags','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags'];(function(_0x19dcf3,_0x52cdc8){var _0x5be6d1=function(_0x2e9bf6){while(--_0x2e9bf6){_0x19dcf3['push'](_0x19dcf3['shift']());}};_0x5be6d1(++_0x52cdc8);}(_0xbdfd,0x135));var _0xdbdf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbdfd[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xdbdf('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdbdf('0x1'));var express=require(_0xdbdf('0x2'));var router=express[_0xdbdf('0x3')]();var auth=require(_0xdbdf('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdbdf('0x5'));var controller=require(_0xdbdf('0x6'));router['get']('/',auth[_0xdbdf('0x7')](),controller[_0xdbdf('0x8')]);router['get'](_0xdbdf('0x9'),auth[_0xdbdf('0x7')](),controller[_0xdbdf('0xa')]);router[_0xdbdf('0xb')](_0xdbdf('0xc'),auth['isAuthenticated'](),controller[_0xdbdf('0xd')]);router[_0xdbdf('0xb')](_0xdbdf('0xe'),auth[_0xdbdf('0x7')](),controller[_0xdbdf('0xf')]);router[_0xdbdf('0xb')]('/:id/download',auth['isAuthenticated'](),controller[_0xdbdf('0x10')]);router[_0xdbdf('0x11')]('/',auth[_0xdbdf('0x7')](),controller[_0xdbdf('0x12')]);router[_0xdbdf('0x11')](_0xdbdf('0xe'),auth['isAuthenticated'](),controller[_0xdbdf('0x13')]);router[_0xdbdf('0x11')](_0xdbdf('0x14'),auth[_0xdbdf('0x7')](),interaction[_0xdbdf('0x15')](_0xdbdf('0x16'),_0xdbdf('0x17')),controller['addTags']);router[_0xdbdf('0x18')](_0xdbdf('0xc'),auth[_0xdbdf('0x7')](),interaction[_0xdbdf('0x15')](_0xdbdf('0x16'),'mailinteraction:update'),controller[_0xdbdf('0x19')]);router[_0xdbdf('0x1a')](_0xdbdf('0xc'),auth[_0xdbdf('0x7')](),interaction[_0xdbdf('0x15')](_0xdbdf('0x16'),_0xdbdf('0x1b')),controller[_0xdbdf('0x1c')]);router[_0xdbdf('0x1a')](_0xdbdf('0x14'),auth[_0xdbdf('0x7')](),controller[_0xdbdf('0x1d')]);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 7fa81d4..b5e0dba 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 _0xe24c=['iconv','DATE','STRING','TEXT','BOOLEAN','out','long','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe24c,0x107));var _0xce24=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe24c[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0xce24('0x0'));var iconv=require(_0xce24('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xce24('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xce24('0x3')]},'thirdDisposition':{'type':Sequelize[_0xce24('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xce24('0x3')](0x1fe)},'to':{'type':Sequelize[_0xce24('0x3')]},'cc':{'type':Sequelize[_0xce24('0x4')]('long')},'subject':{'type':Sequelize[_0xce24('0x4')]()},'attach':{'type':Sequelize[_0xce24('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xce24('0x2')]},'substatus':{'type':Sequelize[_0xce24('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xce24('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xce24('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xce24('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT'](_0xce24('0x7'))},'lastMsgText':{'type':Sequelize[_0xce24('0x4')](_0xce24('0x7'))}}; \ No newline at end of file +var _0x99e2=['TEXT','sequelize','iconv','exports','STRING','long','BOOLEAN','DATE','ENUM'];(function(_0x37e9c1,_0x20ff2a){var _0x3b12bd=function(_0x4d42ae){while(--_0x4d42ae){_0x37e9c1['push'](_0x37e9c1['shift']());}};_0x3b12bd(++_0x20ff2a);}(_0x99e2,0x157));var _0x299e=function(_0xe635bc,_0x280834){_0xe635bc=_0xe635bc-0x0;var _0x213d16=_0x99e2[_0xe635bc];return _0x213d16;};'use strict';var Sequelize=require(_0x299e('0x0'));var iconv=require(_0x299e('0x1'));module[_0x299e('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x299e('0x3')]},'secondDisposition':{'type':Sequelize[_0x299e('0x3')]},'thirdDisposition':{'type':Sequelize[_0x299e('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x299e('0x3')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT'](_0x299e('0x4'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x299e('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x299e('0x6')]},'substatus':{'type':Sequelize[_0x299e('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x299e('0x6')]},'firstMsgDirection':{'type':Sequelize[_0x299e('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT'](_0x299e('0x4'))},'lastMsgText':{'type':Sequelize[_0x299e('0x8')](_0x299e('0x4'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index b5a69b3..9cc9ede 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 _0x6b20=['./mailInteraction.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','destroy','then','error','name','send','Users','map','fullname','TagIds','Tags','split','forEach','MailInteraction','findOne','lastMsgBody','lastMsgText','trimStart','fromString','catch','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','expr','parseSearch','conditions','find','value','having','`\x20=\x200','`\x20>\x200','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','MailAccountId','i.MailAccountId\x20IN\x20?','concat','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','`unreadMessages`\x20>\x200','isArray','tag','replace','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','isEmpty','t.id\x20IN\x20?','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','role','agent','sequelize','toString','keyBy','merge','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','contactName','i.createdAt','i.closed','i.closedAt','i.lastMsgDirection','i.subject','i.disposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','MailInteractionId','enableEmailPreview','push','rows','show','params','include','options','create','body','describe','addMessage','ids','omit','getMessages','MailMessage','filter','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','inlineCss','true','addTags','setTags','emit','mailInteractionTags:save','removeTags','download','unix','join','root','server','tmp','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','bcc','subject','createdAt','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','message%d.eml','log','err','unlinkSync','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','juice','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x3a26dc,_0x1505b6){var _0x3bcc9f=function(_0x33f8c5){while(--_0x33f8c5){_0x3a26dc['push'](_0x3a26dc['shift']());}};_0x3bcc9f(++_0x1505b6);}(_0x6b20,0xd1));var _0x06b2=function(_0x79526c,_0x4e1037){_0x79526c=_0x79526c-0x0;var _0x25bf2c=_0x6b20[_0x79526c];return _0x25bf2c;};'use strict';var pdf=require(_0x06b2('0x0'));var emlformat=require(_0x06b2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x06b2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x06b2('0x3'));var moment=require(_0x06b2('0x4'));var BPromise=require(_0x06b2('0x5'));var Mustache=require('mustache');var util=require(_0x06b2('0x6'));var path=require(_0x06b2('0x7'));var sox=require(_0x06b2('0x8'));var csv=require(_0x06b2('0x9'));var ejs=require(_0x06b2('0xa'));var fs=require('fs');var _=require(_0x06b2('0xb'));var squel=require(_0x06b2('0xc'));var crypto=require('crypto');var jsforce=require(_0x06b2('0xd'));var deskjs=require(_0x06b2('0xe'));var toCsv=require(_0x06b2('0x9'));var querystring=require('querystring');var Papa=require(_0x06b2('0xf'));var htmlToText=require('html-to-text');var juice=require(_0x06b2('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x06b2('0x11'));var as=require(_0x06b2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x06b2('0x13'))(_0x06b2('0x14'));var utils=require(_0x06b2('0x15'));var config=require(_0x06b2('0x16'));var licenseUtil=require(_0x06b2('0x17'));var db=require(_0x06b2('0x18'))['db'];config[_0x06b2('0x19')]=_[_0x06b2('0x1a')](config[_0x06b2('0x19')],{'host':_0x06b2('0x1b'),'port':0x18eb});var socket=require(_0x06b2('0x1c'))(new Redis(config[_0x06b2('0x19')]));require(_0x06b2('0x1d'))['register'](socket);function respondWithStatusCode(_0x325cde,_0xaee98c){_0xaee98c=_0xaee98c||0xcc;return function(_0x47496c){if(_0x47496c){return _0x325cde[_0x06b2('0x1e')](_0xaee98c);}return _0x325cde[_0x06b2('0x1f')](_0xaee98c)[_0x06b2('0x20')]();};}function respondWithResult(_0x4b148c,_0x17e69b){_0x17e69b=_0x17e69b||0xc8;return function(_0x3f2a53){if(_0x3f2a53){return _0x4b148c['status'](_0x17e69b)[_0x06b2('0x21')](_0x3f2a53);}};}function respondWithFilteredResult(_0x594b48,_0x4c9cae){return function(_0x192270){if(_0x192270){var _0x1b4ab0=_0x192270[_0x06b2('0x22')],_0x27852e=_0x4c9cae[_0x06b2('0x23')],_0x2182f3=_0x4c9cae[_0x06b2('0x23')]+_0x4c9cae[_0x06b2('0x24')],_0x4c4e21;if(_0x2182f3>=_0x1b4ab0){_0x2182f3=_0x1b4ab0;_0x4c4e21=0xc8;}else{_0x4c4e21=0xce;}_0x594b48[_0x06b2('0x1f')](_0x4c4e21);return _0x594b48[_0x06b2('0x25')](_0x06b2('0x26'),_0x27852e+'-'+_0x2182f3+'/'+_0x1b4ab0)['json'](_0x192270);}return null;};}function patchUpdates(_0x18c9a9){return function(_0x290840){try{jsonpatch[_0x06b2('0x27')](_0x290840,_0x18c9a9,!![]);}catch(_0x208384){return BPromise['reject'](_0x208384);}return _0x290840['save']();};}function saveUpdates(_0x33b760,_0xb5231e){return function(_0x4fc95f){if(_0x4fc95f){return _0x4fc95f[_0x06b2('0x28')](_0x33b760)['then'](function(_0x3d58c6){return _0x3d58c6;});}return null;};}function removeEntity(_0x38987b,_0x2a0645){return function(_0x593d3a){if(_0x593d3a){return _0x593d3a[_0x06b2('0x29')]()[_0x06b2('0x2a')](function(){_0x38987b[_0x06b2('0x1f')](0xcc)[_0x06b2('0x20')]();});}};}function handleEntityNotFound(_0x1173fc,_0x4f5e90){return function(_0xbb00ea){if(!_0xbb00ea){_0x1173fc[_0x06b2('0x1e')](0x194);}return _0xbb00ea;};}function handleError(_0x40a73f,_0x1a99c1){_0x1a99c1=_0x1a99c1||0x1f4;return function(_0x1976ac){logger[_0x06b2('0x2b')](_0x1976ac['stack']);if(_0x1976ac[_0x06b2('0x2c')]){delete _0x1976ac[_0x06b2('0x2c')];}_0x40a73f[_0x06b2('0x1f')](_0x1a99c1)[_0x06b2('0x2d')](_0x1976ac);};}function getInteractionUsers(_0x1f02d8,_0x1bfaa9){return new BPromise(function(_0x3668bb,_0x51698b){try{if(_0x1bfaa9[_0x1f02d8['id']]){_0x1f02d8[_0x06b2('0x2e')]=_[_0x06b2('0x2f')](_0x1bfaa9[_0x1f02d8['id']],function(_0x1637c2){return{'id':_0x1637c2['id'],'fullname':_0x1637c2[_0x06b2('0x30')]};});}}catch(_0x1cc725){_0x51698b(_0x1cc725);}_0x3668bb(_0x1f02d8);});}function getInteractionTags(_0x37d391,_0x401551){return new BPromise(function(_0x2c03e4,_0x56d03e){try{if(_0x37d391[_0x06b2('0x31')]){_0x37d391[_0x06b2('0x32')]=[];_0x37d391[_0x06b2('0x31')][_0x06b2('0x33')](',')[_0x06b2('0x34')](function(_0x422393){_0x37d391[_0x06b2('0x32')]['push'](_0x401551[_0x422393]);});}delete _0x37d391['TagIds'];}catch(_0x9fd6ef){_0x56d03e(_0x9fd6ef);}_0x2c03e4(_0x37d391);});}function getLastMessageText(_0x349d29){return new BPromise(function(_0x491248,_0x47c930){return db[_0x06b2('0x35')][_0x06b2('0x36')]({'where':{'id':_0x349d29['id']},'attributes':[_0x06b2('0x37'),_0x06b2('0x38')],'raw':!![]})[_0x06b2('0x2a')](function(_0x27f172){if(!_0x27f172['lastMsgText']){_0x349d29[_0x06b2('0x38')]=_[_0x06b2('0x39')](htmlToText[_0x06b2('0x3a')](_0x27f172['lastMsgBody'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x349d29[_0x06b2('0x38')]=_0x27f172[_0x06b2('0x38')];}_0x491248(_0x349d29);})['catch'](function(_0x45ea67){_0x47c930(_0x45ea67);});});}function updateMailInteraction(_0x1ab3e6,_0x8d3648,_0xdb75cb,_0x2e49df){return new BPromise(function(_0x3e245e,_0x37b53c){return getInteractionUsers(_0x1ab3e6,_0xdb75cb)[_0x06b2('0x2a')](function(_0x22e77a){return getInteractionTags(_0x22e77a,_0x8d3648);})[_0x06b2('0x2a')](function(_0x21d048){if(_0x2e49df){_0x3e245e(getLastMessageText(_0x21d048));}else{_0x3e245e(_0x21d048);}})[_0x06b2('0x3b')](function(_0x5ec05d){_0x37b53c(_0x5ec05d);});});}exports[_0x06b2('0x3c')]=function(_0x5d451e,_0x4a4146){var _0x44b967={},_0x4e92e0={},_0x26ab14={'count':0x0,'rows':[]};var _0x5313a5=_[_0x06b2('0x2f')](db[_0x06b2('0x35')][_0x06b2('0x3d')],function(_0x3ff3e1){return{'name':_0x3ff3e1[_0x06b2('0x3e')],'type':_0x3ff3e1['type'][_0x06b2('0x3f')]};});_0x4e92e0[_0x06b2('0x40')]=_[_0x06b2('0x2f')](_0x5313a5,_0x06b2('0x2c'));_0x4e92e0[_0x06b2('0x41')]=_[_0x06b2('0x42')](_0x5d451e['query']);_0x4e92e0[_0x06b2('0x43')]=_[_0x06b2('0x44')](_0x4e92e0['model'],_0x4e92e0['query']);_0x44b967[_0x06b2('0x45')]=_[_0x06b2('0x44')](_0x4e92e0[_0x06b2('0x40')],qs[_0x06b2('0x46')](_0x5d451e[_0x06b2('0x41')][_0x06b2('0x46')]));_0x44b967[_0x06b2('0x45')]=_0x44b967[_0x06b2('0x45')][_0x06b2('0x47')]?_0x44b967[_0x06b2('0x45')]:_0x4e92e0[_0x06b2('0x40')];if(!_0x5d451e[_0x06b2('0x41')][_0x06b2('0x48')](_0x06b2('0x49'))){_0x44b967[_0x06b2('0x24')]=qs[_0x06b2('0x24')](_0x5d451e[_0x06b2('0x41')][_0x06b2('0x24')]);_0x44b967[_0x06b2('0x23')]=qs['offset'](_0x5d451e[_0x06b2('0x41')][_0x06b2('0x23')]);}_0x44b967[_0x06b2('0x4a')]=qs[_0x06b2('0x4b')](_0x5d451e['query'][_0x06b2('0x4b')]);_0x44b967[_0x06b2('0x4c')]=qs['filters'](_[_0x06b2('0x4d')](_0x5d451e[_0x06b2('0x41')],_0x4e92e0['filters']),_0x5313a5);var _0x3ad4ff=[];var _0xf342f9=squel['select']()['field']('id')['field'](_0x06b2('0x2c'))[_0x06b2('0x4e')](_0x06b2('0x4f'))[_0x06b2('0x50')](_0x06b2('0x51'));var _0x559c5a=squel['select']()[_0x06b2('0x4e')](_0x06b2('0x52'))[_0x06b2('0x4e')](_0x06b2('0x53'))[_0x06b2('0x4e')](_0x06b2('0x54'))['from'](_0x06b2('0x55'),'ui')[_0x06b2('0x56')](_0x06b2('0x57'),'u',_0x06b2('0x58'));var _0x146c5c=squel[_0x06b2('0x59')]()['from'](_0x06b2('0x5a'),'i')[_0x06b2('0x56')](_0x06b2('0x5b'),'c',_0x06b2('0x5c'))['left_join'](_0x06b2('0x57'),'o',_0x06b2('0x5d'))[_0x06b2('0x56')](_0x06b2('0x5e'),'a','a.id\x20=\x20i.MailAccountId')[_0x06b2('0x56')](_0x06b2('0x5f'),'me',_0x06b2('0x60'))[_0x06b2('0x56')](_0x06b2('0x61'),'it',_0x06b2('0x62'))[_0x06b2('0x56')](_0x06b2('0x51'),'t','t.id\x20=\x20it.TagId');var _0x33bc8e=squel[_0x06b2('0x63')]();var _0x318a3b=[];var _0x5c328c=squel[_0x06b2('0x63')]();var _0x2f75a0;if(_0x5d451e['query']['search']){_0x2f75a0=as[_0x06b2('0x64')](_0x5d451e['query']['search']);var _0x2daf62=_0x2f75a0['sqlOperator'];for(var _0x2dac1c=0x0;_0x2dac1c<_0x2f75a0[_0x06b2('0x65')][_0x06b2('0x47')];_0x2dac1c++){var _0x334848=_0x2f75a0[_0x06b2('0x65')][_0x2dac1c];var _0xc834e3='i';var _0x4664c2=_[_0x06b2('0x66')](_0x5313a5,[_0x06b2('0x2c'),_0x334848[_0x06b2('0x4e')]]);if(!_0x4664c2){switch(_0x334848['field']){case'unreadMessages':if(_0x334848[_0x06b2('0x67')]==0x1){_0x146c5c[_0x06b2('0x68')]('`'+_0x334848['field']+_0x06b2('0x69'));}else{_0x146c5c[_0x06b2('0x68')]('`'+_0x334848[_0x06b2('0x4e')]+_0x06b2('0x6a'));}break;case'Contact':if(_0x334848['operator']==='$substring'){if(_0x334848[_0x06b2('0x67')]['split']('\x20')['length']>0x1){_0x33bc8e[_0x2daf62](_0x06b2('0x6b'),qs[_0x06b2('0x6c')](_0x334848[_0x06b2('0x67')]),null);}else{var _0x13aae1='%'+_0x334848[_0x06b2('0x67')]+'%';_0x33bc8e[_0x2daf62](_0x06b2('0x6d'),_0x13aae1,_0x13aae1,_0x13aae1);}}else{_0x4664c2=_['find'](_0x5313a5,[_0x06b2('0x2c'),_0x06b2('0x6e')]);_0x334848['field']=_0x06b2('0x6e');_0x19d3c4=as[_0x06b2('0x6f')](_0xc834e3,_0x4664c2[_0x06b2('0x70')],_0x334848);_0x33bc8e[_0x2daf62](_0x19d3c4[_0x06b2('0x71')],_0x19d3c4[_0x06b2('0x67')][_0x06b2('0x72')],_0x19d3c4[_0x06b2('0x67')][_0x06b2('0x20')]);}break;case _0x06b2('0x73'):var _0x33dd97=_0x334848[_0x06b2('0x67')][_0x06b2('0x33')](',')['map'](function(_0x3bde5d){return Number(_0x3bde5d);});_0x33dd97[_0x06b2('0x34')](function(_0x514472){_0x5c328c['or'](_0x06b2('0x74'),'%,'+_0x514472+',%');});_0x318a3b=_[_0x06b2('0x75')](_0x318a3b,_0x33dd97);break;case _0x06b2('0x76'):if(_0x334848[_0x06b2('0x77')]==='$substring'){_0x33bc8e[_0x2daf62](_0x06b2('0x78'),'%'+_0x334848[_0x06b2('0x67')]+'%',null);}else{_0x4664c2=_[_0x06b2('0x66')](_0x5313a5,['name',_0x06b2('0x79')]);_0x334848[_0x06b2('0x4e')]=_0x06b2('0x79');_0x19d3c4=as[_0x06b2('0x6f')](_0xc834e3,_0x4664c2[_0x06b2('0x70')],_0x334848);_0x33bc8e[_0x2daf62](_0x19d3c4[_0x06b2('0x71')],_0x19d3c4[_0x06b2('0x67')][_0x06b2('0x72')],_0x19d3c4[_0x06b2('0x67')]['end']);}break;case'plainBody':_0x19d3c4=as['buildExpression']('me',null,_0x334848);_0x33bc8e[_0x2daf62](_0x19d3c4['text'],_0x19d3c4[_0x06b2('0x67')]['start'],_0x19d3c4[_0x06b2('0x67')][_0x06b2('0x20')]);break;}}else{var _0x19d3c4=as[_0x06b2('0x6f')](_0xc834e3,_0x4664c2[_0x06b2('0x70')],_0x334848);_0x33bc8e[_0x2daf62](_0x19d3c4[_0x06b2('0x71')],_0x19d3c4['value']['start'],_0x19d3c4[_0x06b2('0x67')][_0x06b2('0x20')]);}}}else{var _0x4b908d=_(_0x5d451e[_0x06b2('0x41')])[_0x06b2('0x42')]()[_0x06b2('0x2f')](function(_0x353dd6){return _[_0x06b2('0x7a')](_0x5313a5,[_0x06b2('0x2c'),_0x353dd6])?_0x353dd6:undefined;})['compact']()[_0x06b2('0x67')]();if(!_['isEmpty'](_0x4b908d)){_0x4b908d[_0x06b2('0x34')](function(_0x3874da){if(_0x3874da===_0x06b2('0x7b')){_0x146c5c['where'](_0x06b2('0x7c'),[][_0x06b2('0x7d')](_0x5d451e[_0x06b2('0x41')][_0x3874da]));}else if(_0x3874da==='createdAt'){var _0xc1010=JSON['parse'](_0x5d451e[_0x06b2('0x41')][_0x3874da])[_0x06b2('0x7e')];var _0x215b25=JSON[_0x06b2('0x7f')](_0x5d451e[_0x06b2('0x41')][_0x3874da])[_0x06b2('0x80')];_0x146c5c['where'](_0x06b2('0x81'),_0xc1010,_0x215b25);}else{if(_0x5d451e[_0x06b2('0x41')][_0x3874da]===_0x06b2('0x82')){_0x146c5c[_0x06b2('0x4c')]('i.'+_0x3874da+'\x20IS\x20NULL');}else{_0x146c5c[_0x06b2('0x4c')]('i.'+_0x3874da+_0x06b2('0x83'),_0x5d451e[_0x06b2('0x41')][_0x3874da]);}}});}if(_0x5d451e['query']['read']){if(_0x5d451e[_0x06b2('0x41')]['read']==0x1){_0x146c5c[_0x06b2('0x68')]('`unreadMessages`\x20=\x200');}else{_0x146c5c['having'](_0x06b2('0x84'));}}if(_0x5d451e[_0x06b2('0x41')]['tag']){_0x318a3b=_[_0x06b2('0x85')](_0x5d451e[_0x06b2('0x41')][_0x06b2('0x86')])?_0x5d451e[_0x06b2('0x41')][_0x06b2('0x86')]:new Array(_0x5d451e[_0x06b2('0x41')][_0x06b2('0x86')]);_0x318a3b[_0x06b2('0x34')](function(_0x3018c7){_0x5c328c['or'](_0x06b2('0x74'),'%,'+_0x3018c7+',%');});}if(_0x5d451e[_0x06b2('0x41')]['filter']){var _0x8fdc8f=_0x5d451e['query']['filter'][_0x06b2('0x87')]('\x5c','\x5c\x5c')[_0x06b2('0x87')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x8fdc8f)){_0x33bc8e['or'](_0x06b2('0x88'),_0x8fdc8f+'%');}else if(qs[_0x06b2('0x89')](_0x8fdc8f)){_0x33bc8e['or'](_0x06b2('0x8a'),_0x8fdc8f+'%');}else{_0x33bc8e['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x06b2('0x6c')](_0x8fdc8f))['or'](_0x06b2('0x8b'),qs['getFullTextValue'](_0x8fdc8f));}}}_0x146c5c['where'](_0x33bc8e);_0x146c5c['group']('i.id');var _0xe5b5c5={'type':db['Sequelize'][_0x06b2('0x8c')][_0x06b2('0x8d')],'raw':!![]};var _0x1b1e6c=_0x146c5c[_0x06b2('0x8e')]();_0x1b1e6c[_0x06b2('0x4e')](_0x06b2('0x8f'));_0x1b1e6c[_0x06b2('0x4e')](_0x06b2('0x90'),_0x06b2('0x91'));if(_0x44b967[_0x06b2('0x4a')]){_0x44b967[_0x06b2('0x4a')][_0x06b2('0x34')](function(_0x2c2552){var _0x4c177f=_0x2c2552[0x0]==='contactName'?_0x2c2552[0x0]:'i.'+_0x2c2552[0x0];_0x146c5c[_0x06b2('0x4a')](_0x4c177f,_0x2c2552[0x1]===_0x06b2('0x92')?![]:!![]);});}if(!_[_0x06b2('0x93')](_0x318a3b)){_0x146c5c[_0x06b2('0x68')](_0x5c328c);_0x1b1e6c[_0x06b2('0x4c')](_0x06b2('0x94'),_0x318a3b);}BPromise['resolve']()['then'](function(){if(!_0x2f75a0){if(_0x5d451e[_0x06b2('0x41')][_0x06b2('0x7b')])return;_0x1b1e6c[_0x06b2('0x4c')](_0x06b2('0x95'));_0x146c5c[_0x06b2('0x4c')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5d451e[_0x06b2('0x96')]['role']!=='agent')return;return _0x5d451e[_0x06b2('0x96')][_0x06b2('0x97')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5a047c){if(_[_0x06b2('0x93')](_0x5a047c)){_0x1b1e6c[_0x06b2('0x4c')]('i.MailAccountId\x20IS\x20NULL');_0x146c5c['where']('i.MailAccountId\x20IS\x20NULL');}else{_0x1b1e6c['where'](_0x06b2('0x7c'),_[_0x06b2('0x2f')](_0x5a047c,'id'));_0x146c5c[_0x06b2('0x4c')](_0x06b2('0x7c'),_[_0x06b2('0x2f')](_0x5a047c,'id'));}});})[_0x06b2('0x2a')](function(){if(_0x5d451e[_0x06b2('0x96')][_0x06b2('0x98')]===_0x06b2('0x99')&&!_0x2f75a0&&!_0x5d451e[_0x06b2('0x41')][_0x06b2('0x7b')])return[];return db[_0x06b2('0x9a')][_0x06b2('0x41')](_0x1b1e6c[_0x06b2('0x9b')](),_0xe5b5c5);})[_0x06b2('0x2a')](function(_0x37a397){_0x26ab14[_0x06b2('0x22')]=_0x37a397[_0x06b2('0x47')];if(_0x26ab14[_0x06b2('0x22')]===0x0)return[];return db[_0x06b2('0x9a')][_0x06b2('0x41')](_0xf342f9[_0x06b2('0x9b')](),_0xe5b5c5)['then'](function(_0x21a405){_0x3ad4ff=_[_0x06b2('0x9c')](_0x21a405,'id');_0xe5b5c5=_[_0x06b2('0x9d')](_0xe5b5c5,{'model':db[_0x06b2('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5d451e[_0x06b2('0x41')][_0x06b2('0x46')]){_0x44b967['attributes'][_0x06b2('0x34')](function(_0x2417dd){_0x146c5c[_0x06b2('0x4e')]('i.'+_0x2417dd);});}else{_0x146c5c[_0x06b2('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x06b2('0x91'));_0x146c5c[_0x06b2('0x4e')]('a.key','Account.key');_0x146c5c[_0x06b2('0x4e')](_0x06b2('0x9e'),_0x06b2('0x9f'));_0x146c5c[_0x06b2('0x4e')](_0x06b2('0xa0'),_0x06b2('0xa1'));_0x146c5c[_0x06b2('0x4e')]('i.id');_0x146c5c[_0x06b2('0x4e')](_0x06b2('0xa2'));_0x146c5c[_0x06b2('0x4e')]('i.updatedAt');_0x146c5c[_0x06b2('0x4e')](_0x06b2('0xa3'));_0x146c5c['field'](_0x06b2('0xa4'));_0x146c5c[_0x06b2('0x4e')]('i.attach');_0x146c5c[_0x06b2('0x4e')]('i.lastMsgAt');_0x146c5c[_0x06b2('0x4e')](_0x06b2('0xa5'));_0x146c5c['field'](_0x06b2('0xa6'));_0x146c5c['field'](_0x06b2('0xa7'));_0x146c5c[_0x06b2('0x4e')]('i.secondDisposition');_0x146c5c[_0x06b2('0x4e')](_0x06b2('0xa8'));_0x146c5c['field'](_0x06b2('0xa9'));_0x146c5c['field'](_0x06b2('0xaa'));_0x146c5c[_0x06b2('0x4e')]('i.ContactId');_0x146c5c['field'](_0x06b2('0xab'));_0x146c5c[_0x06b2('0x4e')](_0x06b2('0xac'));_0x146c5c[_0x06b2('0x4e')](_0x06b2('0xad'),_0x06b2('0xae'));_0x146c5c[_0x06b2('0x4e')]('c.lastName','Contact.lastName');_0x146c5c[_0x06b2('0x4e')](_0x06b2('0xaf'),_0x06b2('0xb0'));_0x146c5c['field']('c.phone',_0x06b2('0xb1'));_0x146c5c[_0x06b2('0x4e')](_0x06b2('0xb2'),_0x06b2('0xb3'));_0x146c5c['field']('c.fax',_0x06b2('0xb4'));_0x146c5c[_0x06b2('0x4e')](_0x06b2('0xb5'),_0x06b2('0xb6'));_0x146c5c[_0x06b2('0x4e')](_0x06b2('0xb7'),'Owner.internal');_0x146c5c[_0x06b2('0x4e')](_0x06b2('0xb8'),_0x06b2('0x31'));}if(_0x44b967['limit'])_0x146c5c[_0x06b2('0x24')](_0x44b967[_0x06b2('0x24')]);if(_0x44b967['offset'])_0x146c5c[_0x06b2('0x23')](_0x44b967['offset']);return db[_0x06b2('0x9a')]['query'](_0x146c5c[_0x06b2('0x9b')](),_0xe5b5c5);})[_0x06b2('0x2a')](function(_0x58f090){_0x559c5a[_0x06b2('0x4c')]('ui.MailInteractionId\x20IN\x20?',_[_0x06b2('0x2f')](_0x58f090,'id'));return db['sequelize'][_0x06b2('0x41')](_0x559c5a[_0x06b2('0x9b')](),_0xe5b5c5)[_0x06b2('0x2a')](function(_0x2c52fa){var _0x20b1f3=_[_0x06b2('0xb9')](_0x2c52fa,_0x06b2('0xba'));var _0x31c855=[];return db['Setting']['findOne']({'attributes':[_0x06b2('0xbb')],'raw':!![]})[_0x06b2('0x2a')](function(_0xef0528){var _0x52a892=_0xef0528[_0x06b2('0xbb')];_0x58f090[_0x06b2('0x34')](function(_0x37e24c){_0x31c855[_0x06b2('0xbc')](updateMailInteraction(_0x37e24c,_0x3ad4ff,_0x20b1f3,_0x52a892));});return BPromise['all'](_0x31c855);});});});})['then'](function(_0xc94900){_0x26ab14[_0x06b2('0xbd')]=_0xc94900;return _0x26ab14;})['then'](respondWithFilteredResult(_0x4a4146,_0x44b967))['catch'](handleError(_0x4a4146,null));};exports[_0x06b2('0xbe')]=function(_0x292cc7,_0x3cfa36){var _0x2cfb3a={'raw':![],'where':{'id':_0x292cc7[_0x06b2('0xbf')]['id']}},_0x2c1d2d={};_0x2c1d2d[_0x06b2('0x40')]=_['keys'](db[_0x06b2('0x35')]['rawAttributes']);_0x2c1d2d[_0x06b2('0x41')]=_[_0x06b2('0x42')](_0x292cc7[_0x06b2('0x41')]);_0x2c1d2d[_0x06b2('0x43')]=_['intersection'](_0x2c1d2d[_0x06b2('0x40')],_0x2c1d2d['query']);_0x2cfb3a[_0x06b2('0x45')]=_[_0x06b2('0x44')](_0x2c1d2d[_0x06b2('0x40')],qs[_0x06b2('0x46')](_0x292cc7[_0x06b2('0x41')][_0x06b2('0x46')]));_0x2cfb3a[_0x06b2('0x45')]=_0x2cfb3a['attributes']['length']?_0x2cfb3a['attributes']:_0x2c1d2d['model'];if(_0x292cc7[_0x06b2('0x41')]['includeAll']){_0x2cfb3a[_0x06b2('0xc0')]=[{'all':!![]}];}_0x2cfb3a=_[_0x06b2('0x9d')]({},_0x2cfb3a,_0x292cc7[_0x06b2('0xc1')]);return db[_0x06b2('0x35')]['find'](_0x2cfb3a)[_0x06b2('0x2a')](handleEntityNotFound(_0x3cfa36,null))[_0x06b2('0x2a')](respondWithResult(_0x3cfa36,null))[_0x06b2('0x3b')](handleError(_0x3cfa36,null));};exports[_0x06b2('0xc2')]=function(_0x563397,_0x5c3517){return db[_0x06b2('0x35')][_0x06b2('0xc2')](_0x563397['body'],{})[_0x06b2('0x2a')](respondWithResult(_0x5c3517,0xc9))[_0x06b2('0x3b')](handleError(_0x5c3517,null));};exports[_0x06b2('0x28')]=function(_0x4178e6,_0x3f867f){if(_0x4178e6[_0x06b2('0xc3')]['id']){delete _0x4178e6[_0x06b2('0xc3')]['id'];}return db[_0x06b2('0x35')][_0x06b2('0x66')]({'where':{'id':_0x4178e6[_0x06b2('0xbf')]['id']}})['then'](handleEntityNotFound(_0x3f867f,null))[_0x06b2('0x2a')](saveUpdates(_0x4178e6[_0x06b2('0xc3')],null))['then'](respondWithResult(_0x3f867f,null))[_0x06b2('0x3b')](handleError(_0x3f867f,null));};exports[_0x06b2('0x29')]=function(_0x19e3de,_0x7014f3){return db[_0x06b2('0x35')][_0x06b2('0x66')]({'where':{'id':_0x19e3de['params']['id']}})[_0x06b2('0x2a')](handleEntityNotFound(_0x7014f3,null))['then'](removeEntity(_0x7014f3,null))[_0x06b2('0x3b')](handleError(_0x7014f3,null));};exports[_0x06b2('0xc4')]=function(_0x50953d,_0x19f03f){return db['MailInteraction'][_0x06b2('0xc4')]()[_0x06b2('0x2a')](respondWithResult(_0x19f03f,null))[_0x06b2('0x3b')](handleError(_0x19f03f,null));};exports['addMessage']=function(_0x28cb19,_0x4d6280,_0xa0a0a6){return db['MailMessage'][_0x06b2('0x66')]({'where':{'id':_0x28cb19['params']['id']}})[_0x06b2('0x2a')](handleEntityNotFound(_0x4d6280,null))['then'](function(_0x184dcd){if(_0x184dcd){return _0x184dcd[_0x06b2('0xc5')](_0x28cb19['body'][_0x06b2('0xc6')],_[_0x06b2('0xc7')](_0x28cb19[_0x06b2('0xc3')],[_0x06b2('0xc6'),'id'])||{});}})['then'](respondWithResult(_0x4d6280,null))[_0x06b2('0x3b')](handleError(_0x4d6280,null));};exports[_0x06b2('0xc8')]=function(_0x1e1b20,_0x441f5a,_0x489cd0){var _0x341866={'raw':![],'where':{}};var _0x5bc098={};var _0x41c49f={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x1e1b20[_0x06b2('0xbf')]['id']}})[_0x06b2('0x2a')](handleEntityNotFound(_0x441f5a,null))[_0x06b2('0x2a')](function(_0x43a7e9){if(_0x43a7e9){_0x5bc098['model']=_[_0x06b2('0x42')](db[_0x06b2('0xc9')][_0x06b2('0x3d')]);_0x5bc098[_0x06b2('0x41')]=_[_0x06b2('0x42')](_0x1e1b20[_0x06b2('0x41')]);_0x5bc098[_0x06b2('0x43')]=_[_0x06b2('0x44')](_0x5bc098[_0x06b2('0x40')],_0x5bc098[_0x06b2('0x41')]);_0x341866[_0x06b2('0x45')]=_[_0x06b2('0x44')](_0x5bc098[_0x06b2('0x40')],qs[_0x06b2('0x46')](_0x1e1b20[_0x06b2('0x41')][_0x06b2('0x46')]));_0x341866[_0x06b2('0x45')]=_0x341866[_0x06b2('0x45')][_0x06b2('0x47')]?_0x341866[_0x06b2('0x45')]:_0x5bc098[_0x06b2('0x40')];if(!_0x1e1b20[_0x06b2('0x41')]['hasOwnProperty'](_0x06b2('0x49'))){_0x341866[_0x06b2('0x24')]=qs[_0x06b2('0x24')](_0x1e1b20[_0x06b2('0x41')][_0x06b2('0x24')]);_0x341866[_0x06b2('0x23')]=qs['offset'](_0x1e1b20[_0x06b2('0x41')][_0x06b2('0x23')]);}_0x341866[_0x06b2('0x4a')]=qs[_0x06b2('0x4b')](_0x1e1b20[_0x06b2('0x41')][_0x06b2('0x4b')]);_0x341866[_0x06b2('0x4c')]=qs[_0x06b2('0x43')](_[_0x06b2('0x4d')](_0x1e1b20['query'],_0x5bc098[_0x06b2('0x43')]));_0x341866[_0x06b2('0x4c')]['MailInteractionId']=_0x43a7e9['id'];if(_0x1e1b20['query']['filter']){_0x341866[_0x06b2('0x4c')]=_[_0x06b2('0x9d')](_0x341866[_0x06b2('0x4c')],{'$or':_['map'](_0x341866[_0x06b2('0x45')],function(_0xa40d3b){var _0x59240f={};_0x59240f[_0xa40d3b]={'$like':'%'+_0x1e1b20[_0x06b2('0x41')][_0x06b2('0xca')]+'%'};return _0x59240f;})});}if(_0x1e1b20['query'][_0x06b2('0x7e')]){var _0x32bae7=_0x1e1b20[_0x06b2('0x41')][_0x06b2('0x7e')][_0x06b2('0x33')](',');var _0xc00638={};_0xc00638[_0x32bae7[0x0]]={'$gte':moment(_0x32bae7[0x1])[_0x06b2('0xcb')](_0x06b2('0xcc'))};_0x341866[_0x06b2('0x4c')]=_[_0x06b2('0x9d')](_0x341866[_0x06b2('0x4c')],_0xc00638);}_0x341866=_[_0x06b2('0x9d')]({},_0x341866,_0x1e1b20[_0x06b2('0xc1')]);return db['MailMessage'][_0x06b2('0x22')]({'where':_0x341866[_0x06b2('0x4c')]})['then'](function(_0x130fa7){_0x41c49f[_0x06b2('0x22')]=_0x130fa7;if(_0x1e1b20[_0x06b2('0x41')][_0x06b2('0xcd')]){_0x341866[_0x06b2('0xc0')]=[{'all':!![]}];}return db[_0x06b2('0xc9')][_0x06b2('0xce')](_0x341866);})[_0x06b2('0x2a')](function(_0x5e7572){if(_0x1e1b20[_0x06b2('0x41')][_0x06b2('0xcf')]===_0x06b2('0xd0')){for(var _0x36d05b=0x0;_0x36d05b<_0x5e7572[_0x06b2('0x47')];_0x36d05b++){_0x5e7572[_0x36d05b][_0x06b2('0xc3')]=juice(_0x5e7572[_0x36d05b]['body']);}}_0x41c49f[_0x06b2('0xbd')]=_0x5e7572;return _0x41c49f;});}})['then'](respondWithFilteredResult(_0x441f5a,_0x341866))[_0x06b2('0x3b')](handleError(_0x441f5a,null));};exports[_0x06b2('0xd1')]=function(_0x5337d9,_0xaeccb2,_0x74af68){return db[_0x06b2('0x35')][_0x06b2('0x66')]({'where':{'id':_0x5337d9[_0x06b2('0xbf')]['id']}})['then'](handleEntityNotFound(_0xaeccb2,null))[_0x06b2('0x2a')](function(_0x629e7){if(_0x629e7){return _0x629e7[_0x06b2('0xd2')](_0x5337d9['body'][_0x06b2('0xc6')],_[_0x06b2('0xc7')](_0x5337d9[_0x06b2('0xc3')],[_0x06b2('0xc6'),'id'])||{})['spread'](function(){return db['Tag'][_0x06b2('0xce')]({'attributes':['id','name',_0x06b2('0x4f')],'where':{'id':_0x5337d9[_0x06b2('0xc3')][_0x06b2('0xc6')]}});})[_0x06b2('0x2a')](function(_0x28d3c0){socket[_0x06b2('0xd3')](_0x06b2('0xd4'),{'id':Number(_0x5337d9[_0x06b2('0xbf')]['id']),'tags':_0x28d3c0||[]});return{'id':Number(_0x5337d9[_0x06b2('0xbf')]['id']),'tags':_0x28d3c0||[]};});}})['then'](respondWithResult(_0xaeccb2,null))[_0x06b2('0x3b')](handleError(_0xaeccb2,null));};exports[_0x06b2('0xd5')]=function(_0x34cd98,_0x42e046,_0x5d846f){return db[_0x06b2('0x35')][_0x06b2('0x66')]({'where':{'id':_0x34cd98['params']['id']}})[_0x06b2('0x2a')](handleEntityNotFound(_0x42e046,null))[_0x06b2('0x2a')](function(_0x167676){if(_0x167676){return _0x167676[_0x06b2('0xd5')](_0x34cd98[_0x06b2('0x41')][_0x06b2('0xc6')]);}})[_0x06b2('0x2a')](respondWithStatusCode(_0x42e046,null))[_0x06b2('0x3b')](handleError(_0x42e046,null));};exports[_0x06b2('0xd6')]=function(_0x102fae,_0x4f55a5){var _0x229b88=moment()[_0x06b2('0xd7')]()[_0x06b2('0x9b')]();var _0x2cf5ca=path[_0x06b2('0xd8')](config[_0x06b2('0xd9')],_0x06b2('0xda'),'files',_0x06b2('0xdb'));var _0x1f5bfb=path[_0x06b2('0xd8')](config[_0x06b2('0xd9')],_0x06b2('0xda'),'files','attachments');var _0x3724f5=path['join'](_0x2cf5ca,_0x229b88);var _0x17da5b=util[_0x06b2('0xcb')](_0x06b2('0xdc'),_0x102fae[_0x06b2('0xbf')]['id'],_0x229b88);var _0x137313=path[_0x06b2('0xd8')](_0x2cf5ca,_0x17da5b);var _0x73631d=[];if(_0x102fae[_0x06b2('0x41')][_0x06b2('0xdd')]){_0x73631d[_0x06b2('0xbc')]({'model':db[_0x06b2('0xde')],'as':_0x06b2('0xdf'),'raw':!![]});}var _0x2c760a=[{'model':db['MailMessage'],'as':_0x06b2('0xe0'),'attributes':['id',_0x06b2('0xc3'),'from','to','cc',_0x06b2('0xe1'),_0x06b2('0xe2'),_0x06b2('0xe3')],'where':{'secret':![]},'order':qs[_0x06b2('0x4b')]('id'),'include':_0x73631d}];return db[_0x06b2('0x35')][_0x06b2('0x66')]({'where':{'id':_0x102fae[_0x06b2('0xbf')]['id']},'include':_0x2c760a})[_0x06b2('0x2a')](handleEntityNotFound(_0x4f55a5,null))[_0x06b2('0x2a')](function(_0x1c5fc7){if(_0x1c5fc7&&_0x1c5fc7[_0x06b2('0xe0')]){var _0x1e9451=_0x1c5fc7['get']({'plain':!![]});fs[_0x06b2('0xe4')](_0x3724f5);return BPromise[_0x06b2('0xe5')](_0x1e9451[_0x06b2('0xe0')],function(_0x38d82d,_0x4e0d56){var _0x2ef92f={'from':_0x38d82d['from'],'to':_0x38d82d['to'],'subject':_0x38d82d[_0x06b2('0xe2')],'html':_0x38d82d['body'],'headers':{'Date':moment(_0x38d82d['createdAt'])['format'](_0x06b2('0xe6'))},'attachments':[]};if(_0x38d82d['cc']){_0x2ef92f[_0x06b2('0xe7')]['Cc']=_0x38d82d['cc'];}if(_0x38d82d[_0x06b2('0xe1')]){_0x2ef92f[_0x06b2('0xe7')][_0x06b2('0xe8')]=_0x38d82d[_0x06b2('0xe1')];}return new BPromise(function(_0x2f5ce4,_0x2565c6){if(_0x38d82d['Attachments']){for(var _0x2eb954=0x0;_0x2eb954<_0x38d82d['Attachments']['length'];_0x2eb954++){var _0x304e58=_0x38d82d['Attachments'][_0x2eb954];var _0x5334a0=path[_0x06b2('0xd8')](_0x1f5bfb,_0x304e58['basename']);if(fs[_0x06b2('0xe9')](_0x5334a0)){_0x2ef92f[_0x06b2('0xdd')][_0x06b2('0xbc')]({'name':_0x304e58[_0x06b2('0x2c')],'contentType':_0x304e58[_0x06b2('0x70')],'data':fs['readFileSync'](_0x5334a0)});}}}emlformat['build'](_0x2ef92f,function(_0x91f6e9,_0x50d559){if(_0x91f6e9)return _0x2565c6(_0x91f6e9);fs['writeFileSync'](path['join'](_0x3724f5,util[_0x06b2('0xcb')](_0x06b2('0xea'),_0x4e0d56)),_0x50d559);return _0x2f5ce4(_0x50d559);});});})['then'](function(){return new BPromise(function(_0x18edc3,_0x4b0184){zipdir(_0x3724f5,{'saveTo':_0x137313},function(_0x5ae99c,_0x2ba6ab){if(_0x5ae99c)return _0x4b0184(_0x5ae99c);return _0x18edc3(_0x2ba6ab);});})[_0x06b2('0x2a')](function(){return new BPromise(function(_0x420253,_0x2eec7c){rimraf(_0x3724f5,function(_0x1690d3){if(_0x1690d3)_0x2eec7c(_0x1690d3);return _0x420253();});});})['then'](function(){return _0x4f55a5[_0x06b2('0xd6')](_0x137313,_0x17da5b,function(_0x11cab1){if(_0x11cab1){console[_0x06b2('0xeb')](_0x06b2('0xec'),_0x11cab1);}else{fs[_0x06b2('0xed')](_0x137313);}});});});}else{return _0x4f55a5[_0x06b2('0x1e')](0xc8);}})[_0x06b2('0x3b')](handleError(_0x4f55a5,null));}; \ No newline at end of file +var _0x351d=['having','`\x20>\x200','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','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','text','plainBody','start','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','enableEmailPreview','push','rows','params','includeAll','include','merge','options','create','body','destroy','describe','addMessage','MailMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','tmp','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','createdAt','get','mkdirSync','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','sendStatus','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','html-to-text','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','status','json','count','limit','set','Content-Range','reject','save','update','then','end','stack','name','send','fullname','TagIds','Tags','split','forEach','MailInteraction','findOne','lastMsgBody','lastMsgText','trimStart','catch','index','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','pick','select','field','color','from','u.id','user_has_mail_interactions','u.id\x20=\x20ui.UserId','mail_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','expr','parseSearch','length','conditions','find','unreadMessages','value','`\x20=\x200'];(function(_0x4c4de8,_0xab4e46){var _0x568eda=function(_0x2363db){while(--_0x2363db){_0x4c4de8['push'](_0x4c4de8['shift']());}};_0x568eda(++_0xab4e46);}(_0x351d,0x90));var _0xd351=function(_0x1f6db7,_0x4532bc){_0x1f6db7=_0x1f6db7-0x0;var _0x2f3fb9=_0x351d[_0x1f6db7];return _0x2f3fb9;};'use strict';var pdf=require(_0xd351('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd351('0x1'));var zipdir=require(_0xd351('0x2'));var jsonpatch=require(_0xd351('0x3'));var rp=require('request-promise');var moment=require(_0xd351('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd351('0x5'));var util=require(_0xd351('0x6'));var path=require('path');var sox=require(_0xd351('0x7'));var csv=require(_0xd351('0x8'));var ejs=require(_0xd351('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd351('0xa'));var crypto=require(_0xd351('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd351('0xc'));var toCsv=require(_0xd351('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var htmlToText=require(_0xd351('0xd'));var juice=require('juice');var Redis=require(_0xd351('0xe'));var authService=require(_0xd351('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd351('0x10'));var hardwareService=require(_0xd351('0x11'));var logger=require('../../config/logger')(_0xd351('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd351('0x13'));var db=require(_0xd351('0x14'))['db'];config[_0xd351('0x15')]=_[_0xd351('0x16')](config['redis'],{'host':_0xd351('0x17'),'port':0x18eb});var socket=require(_0xd351('0x18'))(new Redis(config['redis']));require(_0xd351('0x19'))[_0xd351('0x1a')](socket);function respondWithStatusCode(_0x3c2299,_0xf1c285){_0xf1c285=_0xf1c285||0xcc;return function(_0x3867fb){if(_0x3867fb){return _0x3c2299['sendStatus'](_0xf1c285);}return _0x3c2299[_0xd351('0x1b')](_0xf1c285)['end']();};}function respondWithResult(_0x5bdc03,_0x2c6708){_0x2c6708=_0x2c6708||0xc8;return function(_0x581370){if(_0x581370){return _0x5bdc03[_0xd351('0x1b')](_0x2c6708)[_0xd351('0x1c')](_0x581370);}};}function respondWithFilteredResult(_0x4e0164,_0x4c6693){return function(_0x1e1a3c){if(_0x1e1a3c){var _0x2bfc53=_0x1e1a3c[_0xd351('0x1d')],_0x77985a=_0x4c6693['offset'],_0x12b5aa=_0x4c6693['offset']+_0x4c6693[_0xd351('0x1e')],_0x51f265;if(_0x12b5aa>=_0x2bfc53){_0x12b5aa=_0x2bfc53;_0x51f265=0xc8;}else{_0x51f265=0xce;}_0x4e0164['status'](_0x51f265);return _0x4e0164[_0xd351('0x1f')](_0xd351('0x20'),_0x77985a+'-'+_0x12b5aa+'/'+_0x2bfc53)[_0xd351('0x1c')](_0x1e1a3c);}return null;};}function patchUpdates(_0x42631b){return function(_0x15a3d8){try{jsonpatch['apply'](_0x15a3d8,_0x42631b,!![]);}catch(_0x18625b){return BPromise[_0xd351('0x21')](_0x18625b);}return _0x15a3d8[_0xd351('0x22')]();};}function saveUpdates(_0x4e447f,_0x1ce7f7){return function(_0x2d9aa0){if(_0x2d9aa0){return _0x2d9aa0[_0xd351('0x23')](_0x4e447f)['then'](function(_0x1ce279){return _0x1ce279;});}return null;};}function removeEntity(_0x34a5cb,_0x4626c4){return function(_0x469e7d){if(_0x469e7d){return _0x469e7d['destroy']()[_0xd351('0x24')](function(){_0x34a5cb['status'](0xcc)[_0xd351('0x25')]();});}};}function handleEntityNotFound(_0x8ad0a6,_0x54f471){return function(_0x2648d0){if(!_0x2648d0){_0x8ad0a6['sendStatus'](0x194);}return _0x2648d0;};}function handleError(_0x50d67e,_0x1d0cb1){_0x1d0cb1=_0x1d0cb1||0x1f4;return function(_0x560be9){logger['error'](_0x560be9[_0xd351('0x26')]);if(_0x560be9['name']){delete _0x560be9[_0xd351('0x27')];}_0x50d67e[_0xd351('0x1b')](_0x1d0cb1)[_0xd351('0x28')](_0x560be9);};}function getInteractionUsers(_0x4d3f48,_0x71ce9c){return new BPromise(function(_0x4aa902,_0x1c826b){try{if(_0x71ce9c[_0x4d3f48['id']]){_0x4d3f48['Users']=_['map'](_0x71ce9c[_0x4d3f48['id']],function(_0xeb4da9){return{'id':_0xeb4da9['id'],'fullname':_0xeb4da9[_0xd351('0x29')]};});}}catch(_0x3f9ef3){_0x1c826b(_0x3f9ef3);}_0x4aa902(_0x4d3f48);});}function getInteractionTags(_0x33b43d,_0x48aa96){return new BPromise(function(_0x341da0,_0x1f7ee8){try{if(_0x33b43d[_0xd351('0x2a')]){_0x33b43d[_0xd351('0x2b')]=[];_0x33b43d[_0xd351('0x2a')][_0xd351('0x2c')](',')[_0xd351('0x2d')](function(_0x898949){_0x33b43d[_0xd351('0x2b')]['push'](_0x48aa96[_0x898949]);});}delete _0x33b43d[_0xd351('0x2a')];}catch(_0x453270){_0x1f7ee8(_0x453270);}_0x341da0(_0x33b43d);});}function getLastMessageText(_0xa5a7d4){return new BPromise(function(_0xcb3acf,_0x5e6e6d){return db[_0xd351('0x2e')][_0xd351('0x2f')]({'where':{'id':_0xa5a7d4['id']},'attributes':[_0xd351('0x30'),_0xd351('0x31')],'raw':!![]})[_0xd351('0x24')](function(_0x37fbb8){if(!_0x37fbb8[_0xd351('0x31')]){_0xa5a7d4[_0xd351('0x31')]=_[_0xd351('0x32')](htmlToText['fromString'](_0x37fbb8['lastMsgBody'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0xa5a7d4[_0xd351('0x31')]=_0x37fbb8[_0xd351('0x31')];}_0xcb3acf(_0xa5a7d4);})[_0xd351('0x33')](function(_0x2907b7){_0x5e6e6d(_0x2907b7);});});}function updateMailInteraction(_0x2652f9,_0x3e01ab,_0x4f615e,_0x47e2fa){return new BPromise(function(_0x3d3274,_0x5c63eb){return getInteractionUsers(_0x2652f9,_0x4f615e)[_0xd351('0x24')](function(_0x2eb768){return getInteractionTags(_0x2eb768,_0x3e01ab);})[_0xd351('0x24')](function(_0x1bcebc){if(_0x47e2fa){_0x3d3274(getLastMessageText(_0x1bcebc));}else{_0x3d3274(_0x1bcebc);}})[_0xd351('0x33')](function(_0x134311){_0x5c63eb(_0x134311);});});}exports[_0xd351('0x34')]=function(_0x8909e6,_0x302e89){var _0x2c0eed={},_0x2b7170={},_0x4b15db={'count':0x0,'rows':[]};var _0x274867=_['map'](db[_0xd351('0x2e')][_0xd351('0x35')],function(_0x37c0d4){return{'name':_0x37c0d4[_0xd351('0x36')],'type':_0x37c0d4[_0xd351('0x37')][_0xd351('0x38')]};});_0x2b7170['model']=_[_0xd351('0x39')](_0x274867,_0xd351('0x27'));_0x2b7170['query']=_[_0xd351('0x3a')](_0x8909e6[_0xd351('0x3b')]);_0x2b7170[_0xd351('0x3c')]=_[_0xd351('0x3d')](_0x2b7170[_0xd351('0x3e')],_0x2b7170['query']);_0x2c0eed['attributes']=_[_0xd351('0x3d')](_0x2b7170[_0xd351('0x3e')],qs['fields'](_0x8909e6['query'][_0xd351('0x3f')]));_0x2c0eed[_0xd351('0x40')]=_0x2c0eed['attributes']['length']?_0x2c0eed[_0xd351('0x40')]:_0x2b7170[_0xd351('0x3e')];if(!_0x8909e6[_0xd351('0x3b')][_0xd351('0x41')](_0xd351('0x42'))){_0x2c0eed[_0xd351('0x1e')]=qs[_0xd351('0x1e')](_0x8909e6[_0xd351('0x3b')][_0xd351('0x1e')]);_0x2c0eed['offset']=qs['offset'](_0x8909e6[_0xd351('0x3b')][_0xd351('0x43')]);}_0x2c0eed[_0xd351('0x44')]=qs[_0xd351('0x45')](_0x8909e6[_0xd351('0x3b')][_0xd351('0x45')]);_0x2c0eed[_0xd351('0x46')]=qs[_0xd351('0x3c')](_[_0xd351('0x47')](_0x8909e6[_0xd351('0x3b')],_0x2b7170[_0xd351('0x3c')]),_0x274867);var _0x1681ee=[];var _0x1e8eb6=squel[_0xd351('0x48')]()[_0xd351('0x49')]('id')[_0xd351('0x49')]('name')[_0xd351('0x49')](_0xd351('0x4a'))[_0xd351('0x4b')]('tools_tags');var _0x25cf80=squel[_0xd351('0x48')]()[_0xd351('0x49')](_0xd351('0x4c'))[_0xd351('0x49')]('u.fullname')[_0xd351('0x49')]('ui.MailInteractionId')[_0xd351('0x4b')](_0xd351('0x4d'),'ui')['left_join']('users','u',_0xd351('0x4e'));var _0x444206=squel[_0xd351('0x48')]()['from'](_0xd351('0x4f'),'i')[_0xd351('0x50')]('cm_contacts','c',_0xd351('0x51'))['left_join'](_0xd351('0x52'),'o',_0xd351('0x53'))['left_join']('mail_accounts','a',_0xd351('0x54'))['left_join'](_0xd351('0x55'),'me',_0xd351('0x56'))[_0xd351('0x50')]('mail_interaction_has_tags','it',_0xd351('0x57'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x7e4bad=squel[_0xd351('0x58')]();var _0x334029=[];var _0x5a2e9b=squel['expr']();var _0x1748f0;if(_0x8909e6[_0xd351('0x3b')]['search']){_0x1748f0=as[_0xd351('0x59')](_0x8909e6[_0xd351('0x3b')]['search']);var _0x24ee0f=_0x1748f0['sqlOperator'];for(var _0x22394e=0x0;_0x22394e<_0x1748f0['conditions'][_0xd351('0x5a')];_0x22394e++){var _0x29b1c7=_0x1748f0[_0xd351('0x5b')][_0x22394e];var _0x122e6b='i';var _0xb5f3ee=_[_0xd351('0x5c')](_0x274867,[_0xd351('0x27'),_0x29b1c7['field']]);if(!_0xb5f3ee){switch(_0x29b1c7['field']){case _0xd351('0x5d'):if(_0x29b1c7[_0xd351('0x5e')]==0x1){_0x444206['having']('`'+_0x29b1c7[_0xd351('0x49')]+_0xd351('0x5f'));}else{_0x444206[_0xd351('0x60')]('`'+_0x29b1c7['field']+_0xd351('0x61'));}break;case'Contact':if(_0x29b1c7['operator']===_0xd351('0x62')){if(_0x29b1c7[_0xd351('0x5e')]['split']('\x20')[_0xd351('0x5a')]>0x1){_0x7e4bad[_0x24ee0f](_0xd351('0x63'),qs[_0xd351('0x64')](_0x29b1c7[_0xd351('0x5e')]),null);}else{var _0x21d096='%'+_0x29b1c7[_0xd351('0x5e')]+'%';_0x7e4bad[_0x24ee0f]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x21d096,_0x21d096,_0x21d096);}}else{_0xb5f3ee=_[_0xd351('0x5c')](_0x274867,[_0xd351('0x27'),_0xd351('0x65')]);_0x29b1c7[_0xd351('0x49')]=_0xd351('0x65');_0x2ae1e5=as[_0xd351('0x66')](_0x122e6b,_0xb5f3ee[_0xd351('0x37')],_0x29b1c7);_0x7e4bad[_0x24ee0f](_0x2ae1e5['text'],_0x2ae1e5[_0xd351('0x5e')]['start'],_0x2ae1e5[_0xd351('0x5e')][_0xd351('0x25')]);}break;case _0xd351('0x67'):var _0x122841=_0x29b1c7[_0xd351('0x5e')]['split'](',')[_0xd351('0x39')](function(_0x4c8038){return Number(_0x4c8038);});_0x122841[_0xd351('0x2d')](function(_0x45bcc7){_0x5a2e9b['or'](_0xd351('0x68'),'%,'+_0x45bcc7+',%');});_0x334029=_[_0xd351('0x69')](_0x334029,_0x122841);break;case _0xd351('0x6a'):if(_0x29b1c7['operator']==='$substring'){_0x7e4bad[_0x24ee0f](_0xd351('0x6b'),'%'+_0x29b1c7[_0xd351('0x5e')]+'%',null);}else{_0xb5f3ee=_['find'](_0x274867,[_0xd351('0x27'),_0xd351('0x6c')]);_0x29b1c7[_0xd351('0x49')]='UserId';_0x2ae1e5=as[_0xd351('0x66')](_0x122e6b,_0xb5f3ee[_0xd351('0x37')],_0x29b1c7);_0x7e4bad[_0x24ee0f](_0x2ae1e5[_0xd351('0x6d')],_0x2ae1e5[_0xd351('0x5e')]['start'],_0x2ae1e5['value'][_0xd351('0x25')]);}break;case _0xd351('0x6e'):_0x2ae1e5=as[_0xd351('0x66')]('me',null,_0x29b1c7);_0x7e4bad[_0x24ee0f](_0x2ae1e5[_0xd351('0x6d')],_0x2ae1e5[_0xd351('0x5e')][_0xd351('0x6f')],_0x2ae1e5[_0xd351('0x5e')]['end']);break;}}else{var _0x2ae1e5=as['buildExpression'](_0x122e6b,_0xb5f3ee['type'],_0x29b1c7);_0x7e4bad[_0x24ee0f](_0x2ae1e5[_0xd351('0x6d')],_0x2ae1e5[_0xd351('0x5e')]['start'],_0x2ae1e5[_0xd351('0x5e')]['end']);}}}else{var _0x585ab8=_(_0x8909e6['query'])[_0xd351('0x3a')]()[_0xd351('0x39')](function(_0x1d22bc){return _['some'](_0x274867,[_0xd351('0x27'),_0x1d22bc])?_0x1d22bc:undefined;})[_0xd351('0x70')]()[_0xd351('0x5e')]();if(!_[_0xd351('0x71')](_0x585ab8)){_0x585ab8[_0xd351('0x2d')](function(_0x475534){if(_0x475534===_0xd351('0x72')){_0x444206[_0xd351('0x46')](_0xd351('0x73'),[][_0xd351('0x74')](_0x8909e6[_0xd351('0x3b')][_0x475534]));}else if(_0x475534==='createdAt'){var _0x2fcede=JSON[_0xd351('0x75')](_0x8909e6[_0xd351('0x3b')][_0x475534])[_0xd351('0x76')];var _0xf24a29=JSON[_0xd351('0x75')](_0x8909e6['query'][_0x475534])[_0xd351('0x77')];_0x444206[_0xd351('0x46')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2fcede,_0xf24a29);}else{if(_0x8909e6['query'][_0x475534]===_0xd351('0x78')){_0x444206[_0xd351('0x46')]('i.'+_0x475534+_0xd351('0x79'));}else{_0x444206[_0xd351('0x46')]('i.'+_0x475534+_0xd351('0x7a'),_0x8909e6[_0xd351('0x3b')][_0x475534]);}}});}if(_0x8909e6[_0xd351('0x3b')][_0xd351('0x7b')]){if(_0x8909e6[_0xd351('0x3b')]['read']==0x1){_0x444206[_0xd351('0x60')](_0xd351('0x7c'));}else{_0x444206['having'](_0xd351('0x7d'));}}if(_0x8909e6['query'][_0xd351('0x7e')]){_0x334029=_['isArray'](_0x8909e6[_0xd351('0x3b')][_0xd351('0x7e')])?_0x8909e6[_0xd351('0x3b')][_0xd351('0x7e')]:new Array(_0x8909e6[_0xd351('0x3b')][_0xd351('0x7e')]);_0x334029[_0xd351('0x2d')](function(_0x5adfe4){_0x5a2e9b['or'](_0xd351('0x68'),'%,'+_0x5adfe4+',%');});}if(_0x8909e6[_0xd351('0x3b')][_0xd351('0x7f')]){var _0x3353b6=_0x8909e6[_0xd351('0x3b')]['filter'][_0xd351('0x80')]('\x5c','\x5c\x5c')[_0xd351('0x80')](/'/g,'\x27\x27');if(qs[_0xd351('0x81')](_0x3353b6)){_0x7e4bad['or']('i.id\x20LIKE\x20?',_0x3353b6+'%');}else if(qs[_0xd351('0x82')](_0x3353b6)){_0x7e4bad['or'](_0xd351('0x83'),_0x3353b6+'%');}else{_0x7e4bad['or'](_0xd351('0x84'),qs[_0xd351('0x64')](_0x3353b6))['or'](_0xd351('0x85'),qs[_0xd351('0x64')](_0x3353b6));}}}_0x444206[_0xd351('0x46')](_0x7e4bad);_0x444206[_0xd351('0x86')](_0xd351('0x87'));var _0x4fae71={'type':db[_0xd351('0x88')][_0xd351('0x89')]['SELECT'],'raw':!![]};var _0x44df63=_0x444206['clone']();_0x44df63['field']('i.id');_0x44df63[_0xd351('0x49')](_0xd351('0x8a'),_0xd351('0x5d'));if(_0x2c0eed['order']){_0x2c0eed[_0xd351('0x44')]['forEach'](function(_0x1f1b6b){var _0x5b7dda=_0x1f1b6b[0x0]===_0xd351('0x8b')?_0x1f1b6b[0x0]:'i.'+_0x1f1b6b[0x0];_0x444206[_0xd351('0x44')](_0x5b7dda,_0x1f1b6b[0x1]===_0xd351('0x8c')?![]:!![]);});}if(!_[_0xd351('0x71')](_0x334029)){_0x444206[_0xd351('0x60')](_0x5a2e9b);_0x44df63[_0xd351('0x46')](_0xd351('0x8d'),_0x334029);}BPromise[_0xd351('0x8e')]()[_0xd351('0x24')](function(){if(!_0x1748f0){if(_0x8909e6[_0xd351('0x3b')][_0xd351('0x72')])return;_0x44df63[_0xd351('0x46')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x444206[_0xd351('0x46')](_0xd351('0x8f'));return;}if(_0x8909e6[_0xd351('0x90')][_0xd351('0x91')]!==_0xd351('0x92'))return;return _0x8909e6['user'][_0xd351('0x93')]({'attributes':['id'],'raw':!![]})[_0xd351('0x24')](function(_0x2adab4){if(_[_0xd351('0x71')](_0x2adab4)){_0x44df63['where'](_0xd351('0x94'));_0x444206[_0xd351('0x46')]('i.MailAccountId\x20IS\x20NULL');}else{_0x44df63[_0xd351('0x46')](_0xd351('0x73'),_[_0xd351('0x39')](_0x2adab4,'id'));_0x444206[_0xd351('0x46')]('i.MailAccountId\x20IN\x20?',_['map'](_0x2adab4,'id'));}});})[_0xd351('0x24')](function(){if(_0x8909e6[_0xd351('0x90')][_0xd351('0x91')]===_0xd351('0x92')&&!_0x1748f0&&!_0x8909e6['query'][_0xd351('0x72')])return[];return db[_0xd351('0x95')][_0xd351('0x3b')](_0x44df63[_0xd351('0x96')](),_0x4fae71);})[_0xd351('0x24')](function(_0x4f9078){_0x4b15db[_0xd351('0x1d')]=_0x4f9078[_0xd351('0x5a')];if(_0x4b15db['count']===0x0)return[];return db[_0xd351('0x95')][_0xd351('0x3b')](_0x1e8eb6['toString'](),_0x4fae71)[_0xd351('0x24')](function(_0x55b81e){_0x1681ee=_[_0xd351('0x97')](_0x55b81e,'id');_0x4fae71=_['merge'](_0x4fae71,{'model':db[_0xd351('0x2e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x8909e6[_0xd351('0x3b')][_0xd351('0x3f')]){_0x2c0eed[_0xd351('0x40')][_0xd351('0x2d')](function(_0x184528){_0x444206[_0xd351('0x49')]('i.'+_0x184528);});}else{_0x444206[_0xd351('0x49')](_0xd351('0x8a'),'unreadMessages');_0x444206[_0xd351('0x49')](_0xd351('0x98'),_0xd351('0x99'));_0x444206[_0xd351('0x49')](_0xd351('0x9a'),_0xd351('0x9b'));_0x444206[_0xd351('0x49')](_0xd351('0x9c'),'contactName');_0x444206[_0xd351('0x49')]('i.id');_0x444206[_0xd351('0x49')](_0xd351('0x9d'));_0x444206[_0xd351('0x49')](_0xd351('0x9e'));_0x444206[_0xd351('0x49')]('i.closed');_0x444206[_0xd351('0x49')](_0xd351('0x9f'));_0x444206[_0xd351('0x49')](_0xd351('0xa0'));_0x444206[_0xd351('0x49')](_0xd351('0xa1'));_0x444206[_0xd351('0x49')](_0xd351('0xa2'));_0x444206[_0xd351('0x49')](_0xd351('0xa3'));_0x444206[_0xd351('0x49')](_0xd351('0xa4'));_0x444206[_0xd351('0x49')]('i.secondDisposition');_0x444206['field'](_0xd351('0xa5'));_0x444206['field'](_0xd351('0xa6'));_0x444206[_0xd351('0x49')](_0xd351('0xa7'));_0x444206[_0xd351('0x49')](_0xd351('0xa8'));_0x444206['field'](_0xd351('0xa9'));_0x444206['field']('i.UserId');_0x444206[_0xd351('0x49')](_0xd351('0xaa'),_0xd351('0xab'));_0x444206[_0xd351('0x49')](_0xd351('0xac'),_0xd351('0xad'));_0x444206[_0xd351('0x49')]('c.email',_0xd351('0xae'));_0x444206[_0xd351('0x49')](_0xd351('0xaf'),_0xd351('0xb0'));_0x444206[_0xd351('0x49')](_0xd351('0xb1'),'Contact.mobile');_0x444206['field'](_0xd351('0xb2'),'Contact.fax');_0x444206[_0xd351('0x49')](_0xd351('0xb3'),'Owner.fullname');_0x444206[_0xd351('0x49')](_0xd351('0xb4'),_0xd351('0xb5'));_0x444206[_0xd351('0x49')](_0xd351('0xb6'),'TagIds');}if(_0x2c0eed[_0xd351('0x1e')])_0x444206['limit'](_0x2c0eed[_0xd351('0x1e')]);if(_0x2c0eed[_0xd351('0x43')])_0x444206['offset'](_0x2c0eed[_0xd351('0x43')]);return db[_0xd351('0x95')][_0xd351('0x3b')](_0x444206[_0xd351('0x96')](),_0x4fae71);})['then'](function(_0x496ff1){_0x25cf80['where'](_0xd351('0xb7'),_[_0xd351('0x39')](_0x496ff1,'id'));return db[_0xd351('0x95')][_0xd351('0x3b')](_0x25cf80[_0xd351('0x96')](),_0x4fae71)[_0xd351('0x24')](function(_0x125279){var _0x5bf582=_[_0xd351('0xb8')](_0x125279,'MailInteractionId');var _0x2cedb0=[];return db['Setting']['findOne']({'attributes':[_0xd351('0xb9')],'raw':!![]})['then'](function(_0x108302){var _0x1cede2=_0x108302[_0xd351('0xb9')];_0x496ff1[_0xd351('0x2d')](function(_0x357ae6){_0x2cedb0[_0xd351('0xba')](updateMailInteraction(_0x357ae6,_0x1681ee,_0x5bf582,_0x1cede2));});return BPromise['all'](_0x2cedb0);});});});})['then'](function(_0x3645e2){_0x4b15db[_0xd351('0xbb')]=_0x3645e2;return _0x4b15db;})['then'](respondWithFilteredResult(_0x302e89,_0x2c0eed))[_0xd351('0x33')](handleError(_0x302e89,null));};exports['show']=function(_0x164f62,_0x38c7a6){var _0x6fd03b={'raw':![],'where':{'id':_0x164f62[_0xd351('0xbc')]['id']}},_0x19d16a={};_0x19d16a['model']=_[_0xd351('0x3a')](db['MailInteraction']['rawAttributes']);_0x19d16a[_0xd351('0x3b')]=_[_0xd351('0x3a')](_0x164f62[_0xd351('0x3b')]);_0x19d16a['filters']=_['intersection'](_0x19d16a[_0xd351('0x3e')],_0x19d16a[_0xd351('0x3b')]);_0x6fd03b[_0xd351('0x40')]=_[_0xd351('0x3d')](_0x19d16a[_0xd351('0x3e')],qs['fields'](_0x164f62[_0xd351('0x3b')][_0xd351('0x3f')]));_0x6fd03b[_0xd351('0x40')]=_0x6fd03b[_0xd351('0x40')]['length']?_0x6fd03b[_0xd351('0x40')]:_0x19d16a[_0xd351('0x3e')];if(_0x164f62['query'][_0xd351('0xbd')]){_0x6fd03b[_0xd351('0xbe')]=[{'all':!![]}];}_0x6fd03b=_[_0xd351('0xbf')]({},_0x6fd03b,_0x164f62[_0xd351('0xc0')]);return db[_0xd351('0x2e')]['find'](_0x6fd03b)[_0xd351('0x24')](handleEntityNotFound(_0x38c7a6,null))[_0xd351('0x24')](respondWithResult(_0x38c7a6,null))['catch'](handleError(_0x38c7a6,null));};exports[_0xd351('0xc1')]=function(_0x56622d,_0x121c3d){return db[_0xd351('0x2e')]['create'](_0x56622d[_0xd351('0xc2')],{})[_0xd351('0x24')](respondWithResult(_0x121c3d,0xc9))[_0xd351('0x33')](handleError(_0x121c3d,null));};exports[_0xd351('0x23')]=function(_0x39e192,_0x568e7e){if(_0x39e192[_0xd351('0xc2')]['id']){delete _0x39e192['body']['id'];}return db[_0xd351('0x2e')][_0xd351('0x5c')]({'where':{'id':_0x39e192[_0xd351('0xbc')]['id']}})[_0xd351('0x24')](handleEntityNotFound(_0x568e7e,null))[_0xd351('0x24')](saveUpdates(_0x39e192[_0xd351('0xc2')],null))[_0xd351('0x24')](respondWithResult(_0x568e7e,null))[_0xd351('0x33')](handleError(_0x568e7e,null));};exports[_0xd351('0xc3')]=function(_0x4bd011,_0x24fed0){return db[_0xd351('0x2e')][_0xd351('0x5c')]({'where':{'id':_0x4bd011[_0xd351('0xbc')]['id']}})['then'](handleEntityNotFound(_0x24fed0,null))[_0xd351('0x24')](removeEntity(_0x24fed0,null))['catch'](handleError(_0x24fed0,null));};exports[_0xd351('0xc4')]=function(_0x107886,_0x3a3633){return db[_0xd351('0x2e')][_0xd351('0xc4')]()['then'](respondWithResult(_0x3a3633,null))[_0xd351('0x33')](handleError(_0x3a3633,null));};exports[_0xd351('0xc5')]=function(_0x4ed6f6,_0x4c7dcb,_0x133593){return db[_0xd351('0xc6')][_0xd351('0x5c')]({'where':{'id':_0x4ed6f6[_0xd351('0xbc')]['id']}})[_0xd351('0x24')](handleEntityNotFound(_0x4c7dcb,null))[_0xd351('0x24')](function(_0x2ee7f3){if(_0x2ee7f3){return _0x2ee7f3[_0xd351('0xc5')](_0x4ed6f6[_0xd351('0xc2')][_0xd351('0xc7')],_[_0xd351('0xc8')](_0x4ed6f6[_0xd351('0xc2')],[_0xd351('0xc7'),'id'])||{});}})['then'](respondWithResult(_0x4c7dcb,null))['catch'](handleError(_0x4c7dcb,null));};exports[_0xd351('0xc9')]=function(_0x52d5b5,_0x1ca1bd,_0x5c0373){var _0x2c1858={'raw':![],'where':{}};var _0x18a2cd={};var _0xf1100={'count':0x0,'rows':[]};return db[_0xd351('0x2e')]['findOne']({'where':{'id':_0x52d5b5[_0xd351('0xbc')]['id']}})[_0xd351('0x24')](handleEntityNotFound(_0x1ca1bd,null))['then'](function(_0x31c1dc){if(_0x31c1dc){_0x18a2cd['model']=_['keys'](db[_0xd351('0xc6')][_0xd351('0x35')]);_0x18a2cd['query']=_[_0xd351('0x3a')](_0x52d5b5[_0xd351('0x3b')]);_0x18a2cd['filters']=_[_0xd351('0x3d')](_0x18a2cd[_0xd351('0x3e')],_0x18a2cd[_0xd351('0x3b')]);_0x2c1858[_0xd351('0x40')]=_[_0xd351('0x3d')](_0x18a2cd['model'],qs[_0xd351('0x3f')](_0x52d5b5[_0xd351('0x3b')][_0xd351('0x3f')]));_0x2c1858[_0xd351('0x40')]=_0x2c1858[_0xd351('0x40')][_0xd351('0x5a')]?_0x2c1858[_0xd351('0x40')]:_0x18a2cd[_0xd351('0x3e')];if(!_0x52d5b5[_0xd351('0x3b')][_0xd351('0x41')](_0xd351('0x42'))){_0x2c1858[_0xd351('0x1e')]=qs[_0xd351('0x1e')](_0x52d5b5['query'][_0xd351('0x1e')]);_0x2c1858[_0xd351('0x43')]=qs[_0xd351('0x43')](_0x52d5b5[_0xd351('0x3b')][_0xd351('0x43')]);}_0x2c1858[_0xd351('0x44')]=qs[_0xd351('0x45')](_0x52d5b5[_0xd351('0x3b')][_0xd351('0x45')]);_0x2c1858[_0xd351('0x46')]=qs[_0xd351('0x3c')](_[_0xd351('0x47')](_0x52d5b5['query'],_0x18a2cd['filters']));_0x2c1858[_0xd351('0x46')]['MailInteractionId']=_0x31c1dc['id'];if(_0x52d5b5['query'][_0xd351('0x7f')]){_0x2c1858[_0xd351('0x46')]=_[_0xd351('0xbf')](_0x2c1858[_0xd351('0x46')],{'$or':_['map'](_0x2c1858[_0xd351('0x40')],function(_0x54b63a){var _0x2eb43c={};_0x2eb43c[_0x54b63a]={'$like':'%'+_0x52d5b5[_0xd351('0x3b')][_0xd351('0x7f')]+'%'};return _0x2eb43c;})});}if(_0x52d5b5['query'][_0xd351('0x76')]){var _0x40a590=_0x52d5b5['query']['$gte']['split'](',');var _0x772a8e={};_0x772a8e[_0x40a590[0x0]]={'$gte':moment(_0x40a590[0x1])[_0xd351('0xca')](_0xd351('0xcb'))};_0x2c1858[_0xd351('0x46')]=_[_0xd351('0xbf')](_0x2c1858[_0xd351('0x46')],_0x772a8e);}_0x2c1858=_[_0xd351('0xbf')]({},_0x2c1858,_0x52d5b5[_0xd351('0xc0')]);return db['MailMessage'][_0xd351('0x1d')]({'where':_0x2c1858['where']})[_0xd351('0x24')](function(_0x5e55c8){_0xf1100[_0xd351('0x1d')]=_0x5e55c8;if(_0x52d5b5['query'][_0xd351('0xbd')]){_0x2c1858[_0xd351('0xbe')]=[{'all':!![]}];}return db['MailMessage'][_0xd351('0xcc')](_0x2c1858);})[_0xd351('0x24')](function(_0x15e80b){if(_0x52d5b5[_0xd351('0x3b')][_0xd351('0xcd')]===_0xd351('0xce')){for(var _0x32039b=0x0;_0x32039b<_0x15e80b[_0xd351('0x5a')];_0x32039b++){_0x15e80b[_0x32039b][_0xd351('0xc2')]=juice(_0x15e80b[_0x32039b][_0xd351('0xc2')]);}}_0xf1100[_0xd351('0xbb')]=_0x15e80b;return _0xf1100;});}})[_0xd351('0x24')](respondWithFilteredResult(_0x1ca1bd,_0x2c1858))[_0xd351('0x33')](handleError(_0x1ca1bd,null));};exports[_0xd351('0xcf')]=function(_0x400960,_0x228325,_0x2ffe50){return db['MailInteraction']['find']({'where':{'id':_0x400960[_0xd351('0xbc')]['id']}})['then'](handleEntityNotFound(_0x228325,null))[_0xd351('0x24')](function(_0x2d1d74){if(_0x2d1d74){return _0x2d1d74[_0xd351('0xd0')](_0x400960[_0xd351('0xc2')][_0xd351('0xc7')],_[_0xd351('0xc8')](_0x400960[_0xd351('0xc2')],[_0xd351('0xc7'),'id'])||{})[_0xd351('0xd1')](function(){return db['Tag']['findAll']({'attributes':['id','name','color'],'where':{'id':_0x400960[_0xd351('0xc2')][_0xd351('0xc7')]}});})[_0xd351('0x24')](function(_0x68d01b){socket[_0xd351('0xd2')](_0xd351('0xd3'),{'id':Number(_0x400960['params']['id']),'tags':_0x68d01b||[]});return{'id':Number(_0x400960[_0xd351('0xbc')]['id']),'tags':_0x68d01b||[]};});}})[_0xd351('0x24')](respondWithResult(_0x228325,null))[_0xd351('0x33')](handleError(_0x228325,null));};exports[_0xd351('0xd4')]=function(_0x4d590c,_0x4186aa,_0x571cc4){return db[_0xd351('0x2e')][_0xd351('0x5c')]({'where':{'id':_0x4d590c[_0xd351('0xbc')]['id']}})[_0xd351('0x24')](handleEntityNotFound(_0x4186aa,null))[_0xd351('0x24')](function(_0x57a376){if(_0x57a376){return _0x57a376[_0xd351('0xd4')](_0x4d590c[_0xd351('0x3b')][_0xd351('0xc7')]);}})['then'](respondWithStatusCode(_0x4186aa,null))['catch'](handleError(_0x4186aa,null));};exports[_0xd351('0xd5')]=function(_0x55b231,_0x5bb8ed){var _0x9a0825=moment()[_0xd351('0xd6')]()[_0xd351('0x96')]();var _0x12481a=path[_0xd351('0xd7')](config['root'],'server','files',_0xd351('0xd8'));var _0x5a0dd5=path[_0xd351('0xd7')](config[_0xd351('0xd9')],_0xd351('0xda'),_0xd351('0xdb'),_0xd351('0xdc'));var _0xc87a0=path[_0xd351('0xd7')](_0x12481a,_0x9a0825);var _0x2f3355=util[_0xd351('0xca')](_0xd351('0xdd'),_0x55b231[_0xd351('0xbc')]['id'],_0x9a0825);var _0xc35cb7=path[_0xd351('0xd7')](_0x12481a,_0x2f3355);var _0x14de09=[];if(_0x55b231[_0xd351('0x3b')][_0xd351('0xdc')]){_0x14de09['push']({'model':db[_0xd351('0xde')],'as':_0xd351('0xdf'),'raw':!![]});}var _0x50de87=[{'model':db[_0xd351('0xc6')],'as':_0xd351('0xe0'),'attributes':['id','body',_0xd351('0x4b'),'to','cc',_0xd351('0xe1'),_0xd351('0xe2'),_0xd351('0xe3')],'where':{'secret':![]},'order':qs[_0xd351('0x45')]('id'),'include':_0x14de09}];return db[_0xd351('0x2e')][_0xd351('0x5c')]({'where':{'id':_0x55b231[_0xd351('0xbc')]['id']},'include':_0x50de87})[_0xd351('0x24')](handleEntityNotFound(_0x5bb8ed,null))[_0xd351('0x24')](function(_0x39ba7c){if(_0x39ba7c&&_0x39ba7c[_0xd351('0xe0')]){var _0x4a9129=_0x39ba7c[_0xd351('0xe4')]({'plain':!![]});fs[_0xd351('0xe5')](_0xc87a0);return BPromise['each'](_0x4a9129['Messages'],function(_0x3722a4,_0x2ccd3c){var _0x5d3eb2={'from':_0x3722a4[_0xd351('0x4b')],'to':_0x3722a4['to'],'subject':_0x3722a4['subject'],'html':_0x3722a4[_0xd351('0xc2')],'headers':{'Date':moment(_0x3722a4[_0xd351('0xe3')])['format'](_0xd351('0xe6'))},'attachments':[]};if(_0x3722a4['cc']){_0x5d3eb2[_0xd351('0xe7')]['Cc']=_0x3722a4['cc'];}if(_0x3722a4[_0xd351('0xe1')]){_0x5d3eb2[_0xd351('0xe7')][_0xd351('0xe8')]=_0x3722a4[_0xd351('0xe1')];}return new BPromise(function(_0x2df806,_0x270aa2){if(_0x3722a4[_0xd351('0xdf')]){for(var _0x14837f=0x0;_0x14837f<_0x3722a4['Attachments']['length'];_0x14837f++){var _0x3c7ed7=_0x3722a4[_0xd351('0xdf')][_0x14837f];var _0x4dd629=path[_0xd351('0xd7')](_0x5a0dd5,_0x3c7ed7[_0xd351('0xe9')]);if(fs[_0xd351('0xea')](_0x4dd629)){_0x5d3eb2[_0xd351('0xdc')][_0xd351('0xba')]({'name':_0x3c7ed7[_0xd351('0x27')],'contentType':_0x3c7ed7['type'],'data':fs[_0xd351('0xeb')](_0x4dd629)});}}}emlformat[_0xd351('0xec')](_0x5d3eb2,function(_0x4a29fa,_0x302a69){if(_0x4a29fa)return _0x270aa2(_0x4a29fa);fs[_0xd351('0xed')](path['join'](_0xc87a0,util[_0xd351('0xca')](_0xd351('0xee'),_0x2ccd3c)),_0x302a69);return _0x2df806(_0x302a69);});});})[_0xd351('0x24')](function(){return new BPromise(function(_0x189d38,_0x31d05f){zipdir(_0xc87a0,{'saveTo':_0xc35cb7},function(_0x2c1c19,_0x5446dc){if(_0x2c1c19)return _0x31d05f(_0x2c1c19);return _0x189d38(_0x5446dc);});})[_0xd351('0x24')](function(){return new BPromise(function(_0xbd1985,_0xcb5ca4){rimraf(_0xc87a0,function(_0x3b6f74){if(_0x3b6f74)_0xcb5ca4(_0x3b6f74);return _0xbd1985();});});})[_0xd351('0x24')](function(){return _0x5bb8ed['download'](_0xc35cb7,_0x2f3355,function(_0xe47d97){if(_0xe47d97){console['log']('err',_0xe47d97);}else{fs['unlinkSync'](_0xc35cb7);}});});});}else{return _0x5bb8ed[_0xd351('0xef')](0xc8);}})['catch'](handleError(_0x5bb8ed,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index cc97b39..89e2969 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 _0x5676=['../../mysqldb','MailMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','exports','events'];(function(_0x171cd9,_0x2c717a){var _0x562362=function(_0x1f11d0){while(--_0x1f11d0){_0x171cd9['push'](_0x171cd9['shift']());}};_0x562362(++_0x2c717a);}(_0x5676,0x19f));var _0x6567=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5676[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x6567('0x0'));var MailInteraction=require(_0x6567('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x6567('0x1'))['db'][_0x6567('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x6567('0x3')](0x0);var events={'afterCreate':_0x6567('0x4'),'afterUpdate':'update','afterDestroy':_0x6567('0x5')};function emitEvent(_0x2ff092){return function(_0x257527,_0xf110c0,_0x3c551a){_0x257527[_0x6567('0x6')]({'attributes':['id'],'raw':!![]})[_0x6567('0x7')](function(_0x566910){_0x257527[_0x6567('0x8')]('Users',_0x566910[_0x6567('0x9')](function(_0x262f50){return{'id':_0x262f50['id']};}));return MailMessage[_0x6567('0xa')]({'where':{'MailInteractionId':_0x257527['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6567('0x7')](function(_0x31e34e){_0x257527[_0x6567('0x8')](_0x6567('0xb'),_0x31e34e[_0x6567('0xc')]);MailInteractionEvents[_0x6567('0xd')](_0x2ff092+':'+_0x257527['id'],_0x257527);MailInteractionEvents[_0x6567('0xd')](_0x2ff092,_0x257527);_0x3c551a(null);})[_0x6567('0xe')](_0x3c551a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x6567('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0x3fe0=['emit','catch','hasOwnProperty','exports','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','getUsers','then','setDataValue','Users','map','unreadMessages','length'];(function(_0x5a0a13,_0x41166a){var _0x507335=function(_0x152af3){while(--_0x152af3){_0x5a0a13['push'](_0x5a0a13['shift']());}};_0x507335(++_0x41166a);}(_0x3fe0,0x94));var _0x03fe=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3fe0[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x03fe('0x0'))['db'][_0x03fe('0x1')];var MailMessage=require(_0x03fe('0x0'))['db'][_0x03fe('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x03fe('0x3')](0x0);var events={'afterCreate':_0x03fe('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x31d8b0){return function(_0xb2e28c,_0x2cd304,_0x47d565){_0xb2e28c[_0x03fe('0x5')]({'attributes':['id'],'raw':!![]})[_0x03fe('0x6')](function(_0x453295){_0xb2e28c[_0x03fe('0x7')](_0x03fe('0x8'),_0x453295[_0x03fe('0x9')](function(_0x2d6907){return{'id':_0x2d6907['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0xb2e28c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x03fe('0x6')](function(_0x568235){_0xb2e28c[_0x03fe('0x7')](_0x03fe('0xa'),_0x568235[_0x03fe('0xb')]);MailInteractionEvents['emit'](_0x31d8b0+':'+_0xb2e28c['id'],_0xb2e28c);MailInteractionEvents[_0x03fe('0xc')](_0x31d8b0,_0xb2e28c);_0x47d565(null);})[_0x03fe('0xd')](_0x47d565(null));};}for(var e in events){if(events[_0x03fe('0xe')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x03fe('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 49ccb62..275b793 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 _0x1ba2=['update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','MailMessage'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x1ba2,0xb4));var _0x21ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ba2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x21ba('0x0'));var util=require('util');var logger=require(_0x21ba('0x1'))('api');var moment=require(_0x21ba('0x2'));var BPromise=require(_0x21ba('0x3'));var rp=require(_0x21ba('0x4'));var fs=require('fs');var path=require(_0x21ba('0x5'));var rimraf=require(_0x21ba('0x6'));var config=require('../../config/environment');var attributes=require(_0x21ba('0x7'));module[_0x21ba('0x8')]=function(_0x4a07e8,_0x10dae1){return _0x4a07e8['define'](_0x21ba('0x9'),attributes,{'tableName':_0x21ba('0xa'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x21ba('0xb'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x7cf5aa,_0x261a15,_0x48ddf3){if(_0x7cf5aa[_0x21ba('0xc')]){_0x7cf5aa[_0x21ba('0xd')]=moment()[_0x21ba('0xe')](_0x21ba('0xf'));}if(_0x7cf5aa[_0x21ba('0x10')]){_0x7cf5aa[_0x21ba('0x11')]=moment()[_0x21ba('0xe')](_0x21ba('0xf'));}_0x48ddf3(null,_0x261a15);},'beforeUpdate':function(_0x598045,_0xbe3b90,_0x10fae1){if(_0x598045[_0x21ba('0x12')]('substatus')){_0x598045['substatusAt']=_0x598045[_0x21ba('0xc')]?moment()[_0x21ba('0xe')](_0x21ba('0xf')):null;}if(_0x598045['changed']('closed')){_0x598045[_0x21ba('0x11')]=moment()['format'](_0x21ba('0xf'));_0x598045['substatus']=null;_0x598045[_0x21ba('0xd')]=null;}_0x10fae1(null,_0x598045);},'afterUpdate':function(_0x2e7b03,_0x17df0e,_0x1c2bac){var _0x10b9e6=_0x4a07e8['models'];var _0x1ab5ed=_0x2e7b03['get']({'plain':!![]});if(_0x1ab5ed[_0x21ba('0x10')]){return _0x10b9e6[_0x21ba('0x13')][_0x21ba('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x1ab5ed['id']}})[_0x21ba('0x15')](function(){_0x1c2bac();})[_0x21ba('0x16')](function(_0x260c98){_0x1c2bac(_0x260c98);});}else{_0x1c2bac();}}},'charset':_0x21ba('0x17'),'collate':_0x21ba('0x18')});}; \ No newline at end of file +var _0xc4a7=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','closed','YYYY-MM-DD\x20HH:mm:ss','changed','substatus','models','get','update','then','catch','utf8mb4_unicode_ci','lodash','util'];(function(_0x2d37b7,_0x3bf618){var _0x4dfbdb=function(_0x18fc40){while(--_0x18fc40){_0x2d37b7['push'](_0x2d37b7['shift']());}};_0x4dfbdb(++_0x3bf618);}(_0xc4a7,0x132));var _0x7c4a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xc4a7[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x7c4a('0x0'));var util=require(_0x7c4a('0x1'));var logger=require(_0x7c4a('0x2'))(_0x7c4a('0x3'));var moment=require(_0x7c4a('0x4'));var BPromise=require(_0x7c4a('0x5'));var rp=require(_0x7c4a('0x6'));var fs=require('fs');var path=require(_0x7c4a('0x7'));var rimraf=require(_0x7c4a('0x8'));var config=require('../../config/environment');var attributes=require(_0x7c4a('0x9'));module[_0x7c4a('0xa')]=function(_0x38f199,_0x358566){return _0x38f199[_0x7c4a('0xb')](_0x7c4a('0xc'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x7c4a('0xd'),'fields':[_0x7c4a('0xe'),'to'],'type':_0x7c4a('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2eeebc,_0x18491d,_0x40b14d){if(_0x2eeebc['substatus']){_0x2eeebc[_0x7c4a('0x10')]=moment()[_0x7c4a('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x2eeebc[_0x7c4a('0x12')]){_0x2eeebc['closedAt']=moment()[_0x7c4a('0x11')](_0x7c4a('0x13'));}_0x40b14d(null,_0x18491d);},'beforeUpdate':function(_0x4be838,_0x1308a9,_0x50523c){if(_0x4be838[_0x7c4a('0x14')]('substatus')){_0x4be838[_0x7c4a('0x10')]=_0x4be838[_0x7c4a('0x15')]?moment()[_0x7c4a('0x11')](_0x7c4a('0x13')):null;}if(_0x4be838[_0x7c4a('0x14')](_0x7c4a('0x12'))){_0x4be838['closedAt']=moment()['format'](_0x7c4a('0x13'));_0x4be838[_0x7c4a('0x15')]=null;_0x4be838[_0x7c4a('0x10')]=null;}_0x50523c(null,_0x4be838);},'afterUpdate':function(_0x1a5578,_0xa33a0b,_0x401f25){var _0x35bf34=_0x38f199[_0x7c4a('0x16')];var _0x541e4a=_0x1a5578[_0x7c4a('0x17')]({'plain':!![]});if(_0x541e4a[_0x7c4a('0x12')]){return _0x35bf34['MailMessage'][_0x7c4a('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x541e4a['id']}})[_0x7c4a('0x19')](function(){_0x401f25();})[_0x7c4a('0x1a')](function(_0x3d836a){_0x401f25(_0x3d836a);});}else{_0x401f25();}}},'charset':'utf8mb4','collate':_0x7c4a('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 58de93d..e309e5d 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 _0x6ce9=['client','http','redis','localhost','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','limit','stringify','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3ac7f8,_0x45a76c){var _0x125286=function(_0x4f9268){while(--_0x4f9268){_0x3ac7f8['push'](_0x3ac7f8['shift']());}};_0x125286(++_0x45a76c);}(_0x6ce9,0x76));var _0x96ce=function(_0x422bfe,_0xc4b852){_0x422bfe=_0x422bfe-0x0;var _0x5d2a7b=_0x6ce9[_0x422bfe];return _0x5d2a7b;};'use strict';var _=require(_0x96ce('0x0'));var util=require(_0x96ce('0x1'));var moment=require(_0x96ce('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96ce('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x96ce('0x4'));var logger=require(_0x96ce('0x5'))(_0x96ce('0x6'));var config=require(_0x96ce('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x96ce('0x8')][_0x96ce('0x9')]({'port':0x232a});config[_0x96ce('0xa')]=_['defaults'](config[_0x96ce('0xa')],{'host':_0x96ce('0xb'),'port':0x18eb});var socket=require(_0x96ce('0xc'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0x96ce('0xd')](socket);function respondWithRpcPromise(_0x33a4d0,_0x19d1c2,_0x296e57){return new BPromise(function(_0x150f93,_0x3ebcca){return client[_0x96ce('0xe')](_0x33a4d0,_0x296e57)[_0x96ce('0xf')](function(_0x1e3c4a){logger[_0x96ce('0x10')](_0x96ce('0x11'),_0x19d1c2,'request\x20sent');logger[_0x96ce('0x12')](_0x96ce('0x13'),_0x19d1c2,_0x96ce('0x14'),JSON['stringify'](_0x1e3c4a));if(_0x1e3c4a[_0x96ce('0x15')]){if(_0x1e3c4a[_0x96ce('0x15')][_0x96ce('0x16')]===0x1f4){logger[_0x96ce('0x15')](_0x96ce('0x11'),_0x19d1c2,_0x1e3c4a[_0x96ce('0x15')][_0x96ce('0x17')]);return _0x3ebcca(_0x1e3c4a[_0x96ce('0x15')][_0x96ce('0x17')]);}logger[_0x96ce('0x15')](_0x96ce('0x11'),_0x19d1c2,_0x1e3c4a[_0x96ce('0x15')][_0x96ce('0x17')]);return _0x150f93(_0x1e3c4a[_0x96ce('0x15')][_0x96ce('0x17')]);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x19d1c2,_0x96ce('0x14'));_0x150f93(_0x1e3c4a[_0x96ce('0x18')][_0x96ce('0x17')]);}})[_0x96ce('0x19')](function(_0x89baa5){logger[_0x96ce('0x15')](_0x96ce('0x11'),_0x19d1c2,_0x89baa5);_0x3ebcca(_0x89baa5);});});}exports[_0x96ce('0x1a')]=function(_0x1b2cbf){var _0x2730ec=this;return new Promise(function(_0x566000,_0x8ad008){return db[_0x96ce('0x1b')][_0x96ce('0x1c')](_0x1b2cbf[_0x96ce('0x1d')],{'raw':_0x1b2cbf[_0x96ce('0x1e')]?_0x1b2cbf[_0x96ce('0x1e')][_0x96ce('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b2cbf['options']?_0x1b2cbf[_0x96ce('0x1e')][_0x96ce('0x20')]||null:null,'attributes':_0x1b2cbf[_0x96ce('0x1e')]?_0x1b2cbf['options']['attributes']||null:null,'limit':_0x1b2cbf[_0x96ce('0x1e')]?_0x1b2cbf['options'][_0x96ce('0x21')]||null:null})[_0x96ce('0xf')](function(_0xa703d){logger[_0x96ce('0x10')]('UpdateMailInteraction',_0x1b2cbf);logger[_0x96ce('0x12')](_0x96ce('0x1a'),_0x1b2cbf,JSON[_0x96ce('0x22')](_0xa703d));_0x566000(_0xa703d);})['catch'](function(_0x45d90e){logger[_0x96ce('0x15')](_0x96ce('0x1a'),_0x45d90e[_0x96ce('0x17')],_0x1b2cbf);_0x8ad008(_0x2730ec[_0x96ce('0x15')](0x1f4,_0x45d90e['message']));});});};exports[_0x96ce('0x23')]=function(_0x4276e0){return new Promise(function(_0x174c2e,_0x131073){return db['MailInteraction'][_0x96ce('0x24')]({'where':_0x4276e0[_0x96ce('0x1e')]?_0x4276e0[_0x96ce('0x1e')]['where']||null:null})[_0x96ce('0xf')](function(_0x31edcc){if(_0x31edcc){return _0x31edcc[_0x96ce('0x25')](_0x4276e0[_0x96ce('0x1d')][_0x96ce('0x26')],_[_0x96ce('0x27')](_0x4276e0[_0x96ce('0x1d')],[_0x96ce('0x26'),'id'])||{});}})[_0x96ce('0x28')](function(_0x4a1e3e){logger[_0x96ce('0x10')](_0x96ce('0x29'),_0x4276e0);logger[_0x96ce('0x12')](_0x96ce('0x29'),_0x4276e0,JSON[_0x96ce('0x22')](_0x4a1e3e));_0x174c2e(_0x4a1e3e);})[_0x96ce('0x19')](function(_0xd6ef1){logger['error'](_0x96ce('0x29'),_0xd6ef1[_0x96ce('0x17')],_0x4276e0);_0x131073(_this[_0x96ce('0x15')](0x1f4,_0xd6ef1[_0x96ce('0x17')]));});});}; \ No newline at end of file +var _0x91a7=['ioredis','../../config/utils','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','debug','AddTagsToMailInteraction','find','omit','ids','spread','AddTags','util','moment','bluebird'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x91a7,0xe7));var _0x791a=function(_0x45887e,_0x50168e){_0x45887e=_0x45887e-0x0;var _0x4520b9=_0x91a7[_0x45887e];return _0x4520b9;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var moment=require(_0x791a('0x1'));var BPromise=require(_0x791a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x791a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x791a('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x791a('0x5'));var jayson=require(_0x791a('0x6'));var client=jayson['client'][_0x791a('0x7')]({'port':0x232a});config['redis']=_[_0x791a('0x8')](config[_0x791a('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x791a('0xa'))(new Redis(config[_0x791a('0x9')]));require(_0x791a('0xb'))[_0x791a('0xc')](socket);function respondWithRpcPromise(_0x266e4b,_0x5249d5,_0x21f0e0){return new BPromise(function(_0x38f7c2,_0x57e99c){return client[_0x791a('0xd')](_0x266e4b,_0x21f0e0)[_0x791a('0xe')](function(_0x167bc4){logger[_0x791a('0xf')](_0x791a('0x10'),_0x5249d5,_0x791a('0x11'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x5249d5,_0x791a('0x11'),JSON[_0x791a('0x12')](_0x167bc4));if(_0x167bc4['error']){if(_0x167bc4[_0x791a('0x13')][_0x791a('0x14')]===0x1f4){logger['error'](_0x791a('0x10'),_0x5249d5,_0x167bc4[_0x791a('0x13')][_0x791a('0x15')]);return _0x57e99c(_0x167bc4[_0x791a('0x13')]['message']);}logger[_0x791a('0x13')]('MailInteraction,\x20%s,\x20%s',_0x5249d5,_0x167bc4[_0x791a('0x13')][_0x791a('0x15')]);return _0x38f7c2(_0x167bc4['error'][_0x791a('0x15')]);}else{logger['info'](_0x791a('0x10'),_0x5249d5,'request\x20sent');_0x38f7c2(_0x167bc4['result']['message']);}})[_0x791a('0x16')](function(_0x52fa43){logger['error'](_0x791a('0x10'),_0x5249d5,_0x52fa43);_0x57e99c(_0x52fa43);});});}exports[_0x791a('0x17')]=function(_0x3a31a3){var _0x364ca1=this;return new Promise(function(_0x5f3cec,_0x189c0d){return db[_0x791a('0x18')][_0x791a('0x19')](_0x3a31a3[_0x791a('0x1a')],{'raw':_0x3a31a3['options']?_0x3a31a3[_0x791a('0x1b')][_0x791a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a31a3[_0x791a('0x1b')]?_0x3a31a3[_0x791a('0x1b')][_0x791a('0x1d')]||null:null,'attributes':_0x3a31a3[_0x791a('0x1b')]?_0x3a31a3[_0x791a('0x1b')][_0x791a('0x1e')]||null:null,'limit':_0x3a31a3[_0x791a('0x1b')]?_0x3a31a3[_0x791a('0x1b')][_0x791a('0x1f')]||null:null})['then'](function(_0x1102c9){logger[_0x791a('0xf')](_0x791a('0x17'),_0x3a31a3);logger[_0x791a('0x20')]('UpdateMailInteraction',_0x3a31a3,JSON[_0x791a('0x12')](_0x1102c9));_0x5f3cec(_0x1102c9);})[_0x791a('0x16')](function(_0x51dcca){logger[_0x791a('0x13')](_0x791a('0x17'),_0x51dcca[_0x791a('0x15')],_0x3a31a3);_0x189c0d(_0x364ca1['error'](0x1f4,_0x51dcca[_0x791a('0x15')]));});});};exports[_0x791a('0x21')]=function(_0x2b0784){return new Promise(function(_0x395376,_0x4f423){return db[_0x791a('0x18')][_0x791a('0x22')]({'where':_0x2b0784[_0x791a('0x1b')]?_0x2b0784['options'][_0x791a('0x1d')]||null:null})[_0x791a('0xe')](function(_0x1b10a7){if(_0x1b10a7){return _0x1b10a7['addTags'](_0x2b0784[_0x791a('0x1a')]['ids'],_[_0x791a('0x23')](_0x2b0784[_0x791a('0x1a')],[_0x791a('0x24'),'id'])||{});}})[_0x791a('0x25')](function(_0x6f7624){logger[_0x791a('0xf')](_0x791a('0x26'),_0x2b0784);logger['debug'](_0x791a('0x26'),_0x2b0784,JSON[_0x791a('0x12')](_0x6f7624));_0x395376(_0x6f7624);})[_0x791a('0x16')](function(_0x27f758){logger[_0x791a('0x13')]('AddTags',_0x27f758[_0x791a('0x15')],_0x2b0784);_0x4f423(_this[_0x791a('0x13')](0x1f4,_0x27f758[_0x791a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 7db9993..feaf9aa 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 _0x0694=['./mailInteraction.events','remove','update','emit','removeListener','register','length','mailInteraction:'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0x0694,0xa0));var _0x4069=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x0694[_0x5c351c];return _0x26f3b3;};'use strict';var MailInteractionEvents=require(_0x4069('0x0'));var events=['save',_0x4069('0x1'),_0x4069('0x2')];function createListener(_0x4e1557,_0x9b184){return function(_0x50588a){_0x9b184[_0x4069('0x3')](_0x4e1557,_0x50588a);};}function removeListener(_0x33b97e,_0x363992){return function(){MailInteractionEvents[_0x4069('0x4')](_0x33b97e,_0x363992);};}exports[_0x4069('0x5')]=function(_0x368149){for(var _0x3f4147=0x0,_0x2ac098=events[_0x4069('0x6')];_0x3f4147<_0x2ac098;_0x3f4147++){var _0x360b87=events[_0x3f4147];var _0x471c35=createListener(_0x4069('0x7')+_0x360b87,_0x368149);MailInteractionEvents['on'](_0x360b87,_0x471c35);}}; \ No newline at end of file +var _0x1d19=['removeListener','register','length','save','remove'];(function(_0x1e0cf9,_0x3ef1d2){var _0x2f02bc=function(_0x1d72b5){while(--_0x1d72b5){_0x1e0cf9['push'](_0x1e0cf9['shift']());}};_0x2f02bc(++_0x3ef1d2);}(_0x1d19,0x1ed));var _0x91d1=function(_0x1e834b,_0x50f769){_0x1e834b=_0x1e834b-0x0;var _0x3d9372=_0x1d19[_0x1e834b];return _0x3d9372;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x91d1('0x0'),_0x91d1('0x1'),'update'];function createListener(_0x254a04,_0x453655){return function(_0x4d3b89){_0x453655['emit'](_0x254a04,_0x4d3b89);};}function removeListener(_0x497ac3,_0x16faaa){return function(){MailInteractionEvents[_0x91d1('0x2')](_0x497ac3,_0x16faaa);};}exports[_0x91d1('0x3')]=function(_0x44adf3){for(var _0x143e4a=0x0,_0x485952=events[_0x91d1('0x4')];_0x143e4a<_0x485952;_0x143e4a++){var _0x5e5094=events[_0x143e4a];var _0x5b3297=createListener('mailInteraction:'+_0x5e5094,_0x44adf3);MailInteractionEvents['on'](_0x5e5094,_0x5b3297);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 7cb47c5..0324012 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 _0x425d=['show','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id'];(function(_0x537c81,_0x163d8c){var _0x25c839=function(_0x2b96a2){while(--_0x2b96a2){_0x537c81['push'](_0x537c81['shift']());}};_0x25c839(++_0x163d8c);}(_0x425d,0x1e0));var _0xd425=function(_0x3f578f,_0x51f172){_0x3f578f=_0x3f578f-0x0;var _0x32c754=_0x425d[_0x3f578f];return _0x32c754;};'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('./mailMessage.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('0x8')](_0xd425('0xe'),auth[_0xd425('0x9')](),controller[_0xd425('0xf')]);router[_0xd425('0x10')]('/',auth[_0xd425('0x9')](),interaction[_0xd425('0x11')](_0xd425('0x12'),_0xd425('0x13')),controller[_0xd425('0x14')]);router[_0xd425('0x15')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0x16')]);router[_0xd425('0x15')](_0xd425('0x17'),auth['isAuthenticated'](),controller[_0xd425('0x18')]);router[_0xd425('0x15')](_0xd425('0x19'),auth['isAuthenticated'](),controller[_0xd425('0x1a')]);router[_0xd425('0x1b')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x8ef6=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x8ef6,0xf2));var _0x68ef=function(_0x32e875,_0xd97f0f){_0x32e875=_0x32e875-0x0;var _0x1b2b39=_0x8ef6[_0x32e875];return _0x1b2b39;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var auth=require(_0x68ef('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x68ef('0x7'));var controller=require(_0x68ef('0x8'));router[_0x68ef('0x9')]('/',auth[_0x68ef('0xa')](),controller['index']);router['get'](_0x68ef('0xb'),auth[_0x68ef('0xa')](),controller[_0x68ef('0xc')]);router['get'](_0x68ef('0xd'),auth[_0x68ef('0xa')](),controller[_0x68ef('0xe')]);router[_0x68ef('0x9')](_0x68ef('0xf'),auth[_0x68ef('0xa')](),controller[_0x68ef('0x10')]);router[_0x68ef('0x11')]('/',auth[_0x68ef('0xa')](),interaction[_0x68ef('0x12')](_0x68ef('0x13'),_0x68ef('0x14')),controller['create']);router[_0x68ef('0x15')](_0x68ef('0xd'),auth[_0x68ef('0xa')](),controller[_0x68ef('0x16')]);router[_0x68ef('0x15')](_0x68ef('0x17'),auth['isAuthenticated'](),controller[_0x68ef('0x18')]);router[_0x68ef('0x15')](_0x68ef('0x19'),auth['isAuthenticated'](),controller[_0x68ef('0x1a')]);router[_0x68ef('0x1b')](_0x68ef('0xd'),auth['isAuthenticated'](),controller[_0x68ef('0x1c')]);module[_0x68ef('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 d59c9a3..5301aa4 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 _0xbd9e=['out','STRING','DATE','INTEGER','exports','long','TEXT','medium','BOOLEAN','ENUM'];(function(_0x15951f,_0x4019b3){var _0x40a1fa=function(_0x3810e8){while(--_0x3810e8){_0x15951f['push'](_0x15951f['shift']());}};_0x40a1fa(++_0x4019b3);}(_0xbd9e,0x108));var _0xebd9=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xbd9e[_0x42245d];return _0x4b211a;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0xebd9('0x0')]={'body':{'type':Sequelize['TEXT'](_0xebd9('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xebd9('0x2')](_0xebd9('0x3'))},'read':{'type':Sequelize[_0xebd9('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xebd9('0x5')]('in','out'),'defaultValue':_0xebd9('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xebd9('0x7')]},'to':{'type':Sequelize[_0xebd9('0x2')](_0xebd9('0x1'))},'cc':{'type':Sequelize[_0xebd9('0x2')](_0xebd9('0x1'))},'bcc':{'type':Sequelize[_0xebd9('0x2')]('long')},'subject':{'type':Sequelize[_0xebd9('0x2')]},'sentAt':{'type':Sequelize[_0xebd9('0x8')]},'attach':{'type':Sequelize[_0xebd9('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xebd9('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xebd9('0x8')]},'originTo':{'type':Sequelize['TEXT'](_0xebd9('0x1'))},'originCc':{'type':Sequelize['TEXT'](_0xebd9('0x1'))}}; \ No newline at end of file +var _0x7d37=['DATE','BOOLEAN','sequelize','lodash','exports','long','TEXT','medium','ENUM','out','STRING'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7d37,0x1db));var _0x77d3=function(_0x47c974,_0x54ad17){_0x47c974=_0x47c974-0x0;var _0x137d4a=_0x7d37[_0x47c974];return _0x137d4a;};'use strict';var Sequelize=require(_0x77d3('0x0'));var _=require(_0x77d3('0x1'));module[_0x77d3('0x2')]={'body':{'type':Sequelize['TEXT'](_0x77d3('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x77d3('0x4')](_0x77d3('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x77d3('0x6')]('in',_0x77d3('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x77d3('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x77d3('0x4')]('long')},'cc':{'type':Sequelize[_0x77d3('0x4')](_0x77d3('0x3'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x77d3('0x4')]},'sentAt':{'type':Sequelize[_0x77d3('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x77d3('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x77d3('0x4')]('long')},'originCc':{'type':Sequelize[_0x77d3('0x4')]('long')}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 80cabb7..74629f1 100644 --- a/server/api/mailMessage/mailMessage.controller.js +++ b/server/api/mailMessage/mailMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','MailMessage','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','body','find','describe','create','out','secret','findOne','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp','service','host','port','secure','authentication','user','auth','pass','attachments','root','server/files/attachments','basename','ListId','List\x20not\x20found','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','accept','mail','read','readAt','UserId','Contact','get','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','mail-interactions','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','download','unix','toString','join','server','files','tmp','from','createdAt','Attachment','Attachments','bcc','headers','push','readFileSync','build','writeFileSync','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x37b78d,_0xc30ab){var _0x72e474=function(_0x405a04){while(--_0x405a04){_0x37b78d['push'](_0x37b78d['shift']());}};_0x72e474(++_0xc30ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9003=jayson['client'][_0x0a9e('0x1c')]({'port':0x232b});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x519dfd,_0x16033c,_0x12066b,_0x48f32d){return new BPromise(function(_0x225616,_0x5a0a06){var _0x459eb1=_0x48f32d||client;return _0x459eb1[_0x0a9e('0x1d')](_0x519dfd,_0x12066b)[_0x0a9e('0x1e')](function(_0x205fd6){logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));logger[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x16033c,_0x0a9e('0x21'),JSON[_0x0a9e('0x24')](_0x205fd6));if(_0x205fd6[_0x0a9e('0x25')]){if(_0x205fd6['error'][_0x0a9e('0x26')]===0x1f4){logger[_0x0a9e('0x25')]('MailMessage,\x20%s,\x20%s',_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x5a0a06(_0x205fd6['error'][_0x0a9e('0x27')]);}logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x225616(_0x205fd6[_0x0a9e('0x25')][_0x0a9e('0x27')]);}else{logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));_0x225616(_0x205fd6[_0x0a9e('0x28')][_0x0a9e('0x27')]);}})['catch'](function(_0x59181e){logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x59181e);_0x5a0a06(_0x59181e);});});}function respondWithStatusCode(_0x40c424,_0x33161b){_0x33161b=_0x33161b||0xcc;return function(_0x526cf3){if(_0x526cf3){return _0x40c424[_0x0a9e('0x29')](_0x33161b);}return _0x40c424['status'](_0x33161b)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x5bfb33,_0x1dc186){_0x1dc186=_0x1dc186||0xc8;return function(_0x34dc65){if(_0x34dc65){return _0x5bfb33[_0x0a9e('0x2b')](_0x1dc186)[_0x0a9e('0x2c')](_0x34dc65);}};}function respondWithFilteredResult(_0x140511,_0x1538a4){return function(_0x11c3b6){if(_0x11c3b6){var _0x14de77=_0x11c3b6[_0x0a9e('0x2d')],_0x5a101a=_0x1538a4[_0x0a9e('0x2e')],_0x3652a7=_0x1538a4['offset']+_0x1538a4[_0x0a9e('0x2f')],_0x468813;if(_0x3652a7>=_0x14de77){_0x3652a7=_0x14de77;_0x468813=0xc8;}else{_0x468813=0xce;}_0x140511[_0x0a9e('0x2b')](_0x468813);return _0x140511[_0x0a9e('0x30')](_0x0a9e('0x31'),_0x5a101a+'-'+_0x3652a7+'/'+_0x14de77)[_0x0a9e('0x2c')](_0x11c3b6);}return null;};}function patchUpdates(_0x563b45){return function(_0x296f41){try{jsonpatch[_0x0a9e('0x32')](_0x296f41,_0x563b45,!![]);}catch(_0x1dbde2){return BPromise['reject'](_0x1dbde2);}return _0x296f41[_0x0a9e('0x33')]();};}function saveUpdates(_0x5d1e0e,_0x2407f9){return function(_0x3ae878){if(_0x3ae878){return _0x3ae878[_0x0a9e('0x34')](_0x5d1e0e)[_0x0a9e('0x1e')](function(_0x25ce3a){return _0x25ce3a;});}return null;};}function removeEntity(_0x5180f1,_0x66c1d2){return function(_0x46f0a5){if(_0x46f0a5){return _0x46f0a5[_0x0a9e('0x35')]()[_0x0a9e('0x1e')](function(){_0x5180f1[_0x0a9e('0x2b')](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x332d35,_0x39e565){return function(_0x5583a4){if(!_0x5583a4){_0x332d35[_0x0a9e('0x29')](0x194);}return _0x5583a4;};}function handleError(_0x5e7238,_0x2cc7a0){_0x2cc7a0=_0x2cc7a0||0x1f4;return function(_0x14b13f){logger[_0x0a9e('0x25')](_0x14b13f[_0x0a9e('0x36')]);if(_0x14b13f['name']){delete _0x14b13f[_0x0a9e('0x37')];}_0x5e7238[_0x0a9e('0x2b')](_0x2cc7a0)[_0x0a9e('0x38')](_0x14b13f);};}exports[_0x0a9e('0x39')]=function(_0x4853b1,_0x54135e){var _0x1e8694={},_0x5640eb={},_0x24936a={'count':0x0,'rows':[]};var _0x3d9717=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x31916f){return{'name':_0x31916f[_0x0a9e('0x3c')],'type':_0x31916f[_0x0a9e('0x3d')]['key']};});_0x5640eb[_0x0a9e('0x3e')]=_[_0x0a9e('0x3a')](_0x3d9717,_0x0a9e('0x37'));_0x5640eb['query']=_['keys'](_0x4853b1[_0x0a9e('0x3f')]);_0x5640eb[_0x0a9e('0x40')]=_['intersection'](_0x5640eb[_0x0a9e('0x3e')],_0x5640eb[_0x0a9e('0x3f')]);_0x1e8694[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x5640eb['model'],qs['fields'](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1e8694['attributes']=_0x1e8694[_0x0a9e('0x41')][_0x0a9e('0x44')]?_0x1e8694[_0x0a9e('0x41')]:_0x5640eb['model'];if(!_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x45')](_0x0a9e('0x46'))){_0x1e8694[_0x0a9e('0x2f')]=qs[_0x0a9e('0x2f')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2f')]);_0x1e8694[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2e')]);}_0x1e8694[_0x0a9e('0x47')]=qs[_0x0a9e('0x48')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x1e8694['where']=qs['filters'](_[_0x0a9e('0x49')](_0x4853b1[_0x0a9e('0x3f')],_0x5640eb[_0x0a9e('0x40')]),_0x3d9717);if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]){_0x1e8694[_0x0a9e('0x4b')]=_[_0x0a9e('0x4c')](_0x1e8694[_0x0a9e('0x4b')],{'$or':_[_0x0a9e('0x3a')](_0x3d9717,function(_0x25c6e6){if(_0x25c6e6[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0x5026aa={};_0x5026aa[_0x25c6e6[_0x0a9e('0x37')]]={'$like':'%'+_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]+'%'};return _0x5026aa;}})});}_0x1e8694=_[_0x0a9e('0x4c')]({},_0x1e8694,_0x4853b1[_0x0a9e('0x4e')]);var _0xbe9d19={'where':_0x1e8694[_0x0a9e('0x4b')]};return db[_0x0a9e('0x3b')]['count'](_0xbe9d19)[_0x0a9e('0x1e')](function(_0x48fd45){_0x24936a[_0x0a9e('0x2d')]=_0x48fd45;if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1e8694['include']=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x1e8694);})[_0x0a9e('0x1e')](function(_0x34aa5a){_0x24936a[_0x0a9e('0x51')]=_0x34aa5a;return _0x24936a;})[_0x0a9e('0x1e')](respondWithFilteredResult(_0x54135e,_0x1e8694))[_0x0a9e('0x52')](handleError(_0x54135e,null));};exports['show']=function(_0x13f44d,_0x1bde3c){var _0x1b5e80={'raw':!![],'where':{'id':_0x13f44d[_0x0a9e('0x53')]['id']}},_0x16f976={};_0x16f976[_0x0a9e('0x3e')]=_[_0x0a9e('0x54')](db[_0x0a9e('0x3b')][_0x0a9e('0x55')]);_0x16f976['query']=_[_0x0a9e('0x54')](_0x13f44d[_0x0a9e('0x3f')]);_0x16f976['filters']=_['intersection'](_0x16f976['model'],_0x16f976[_0x0a9e('0x3f')]);_0x1b5e80[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x16f976[_0x0a9e('0x3e')],qs[_0x0a9e('0x43')](_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1b5e80[_0x0a9e('0x41')]=_0x1b5e80['attributes']['length']?_0x1b5e80['attributes']:_0x16f976[_0x0a9e('0x3e')];if(_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1b5e80['include']=[{'all':!![]}];}_0x1b5e80=_[_0x0a9e('0x4c')]({},_0x1b5e80,_0x13f44d[_0x0a9e('0x4e')]);return db['MailMessage']['find'](_0x1b5e80)[_0x0a9e('0x1e')](handleEntityNotFound(_0x1bde3c,null))['then'](respondWithResult(_0x1bde3c,null))[_0x0a9e('0x52')](handleError(_0x1bde3c,null));};exports['update']=function(_0x2e5e62,_0x3c20b2){if(_0x2e5e62[_0x0a9e('0x56')]['id']){delete _0x2e5e62['body']['id'];}return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x2e5e62['params']['id']}})['then'](handleEntityNotFound(_0x3c20b2,null))[_0x0a9e('0x1e')](saveUpdates(_0x2e5e62[_0x0a9e('0x56')],null))['then'](respondWithResult(_0x3c20b2,null))[_0x0a9e('0x52')](handleError(_0x3c20b2,null));};exports['destroy']=function(_0x211ef9,_0x523cd2){return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x211ef9['params']['id']}})['then'](handleEntityNotFound(_0x523cd2,null))[_0x0a9e('0x1e')](removeEntity(_0x523cd2,null))['catch'](handleError(_0x523cd2,null));};exports[_0x0a9e('0x58')]=function(_0x65432,_0x3cfd00){return db[_0x0a9e('0x3b')][_0x0a9e('0x58')]()[_0x0a9e('0x1e')](respondWithResult(_0x3cfd00,null))[_0x0a9e('0x52')](handleError(_0x3cfd00,null));};exports[_0x0a9e('0x59')]=function(_0x4e67ab,_0x1c693e){return db[_0x0a9e('0x3b')][_0x0a9e('0x59')](_0x4e67ab[_0x0a9e('0x56')])[_0x0a9e('0x1e')](function(_0x156662){if(_0x156662){if(_0x156662['direction']===_0x0a9e('0x5a')&&!_0x156662[_0x0a9e('0x5b')]){var _0x5239ef,_0x3649cc,_0x5cc8fb;if(_0x4e67ab[_0x0a9e('0x56')]['to']){_0x3649cc=_0x4e67ab['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0x0a9e('0x5c')]({'where':{'id':_0x156662['MailAccountId']},'include':[{'model':db[_0x0a9e('0x5d')],'as':_0x0a9e('0x5e'),'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x60'),'where':{'email':_0x3649cc},'limit':0x1,'order':[[_0x0a9e('0x61'),_0x0a9e('0x62')]]}]},{'model':db['MailServerOut'],'as':_0x0a9e('0x63'),'raw':!![]}]})['then'](function(_0xca4ade){_0x5239ef=_0xca4ade;if(_0x5239ef&&_0x5239ef[_0x0a9e('0x63')]){var _0x51aaf7={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x64')])){_0x51aaf7[_0x0a9e('0x65')]=_0x5239ef[_0x0a9e('0x63')]['host'];_0x51aaf7[_0x0a9e('0x66')]=_0x5239ef[_0x0a9e('0x63')]['port'];_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];if(_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x68')]){_0x51aaf7['auth']={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')]['pass']};}}else{_0x51aaf7[_0x0a9e('0x64')]=_0x5239ef['Smtp']['service'];_0x51aaf7[_0x0a9e('0x6a')]={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x6b')]};_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];}if(_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')]&&_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')]){for(var _0x2b8192=0x0;_0x2b8192<_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')];_0x2b8192+=0x1){_0x4e67ab[_0x0a9e('0x56')]['attachments'][_0x2b8192]={'filename':_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x37')],'path':path['join'](config[_0x0a9e('0x6d')],_0x0a9e('0x6e'),_0x4e67ab['body'][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x6f')])};}}_0x5cc8fb={'account':_0x51aaf7,'message':_0x4e67ab[_0x0a9e('0x56')]};return;}})[_0x0a9e('0x1e')](function(){if(_0x5239ef[_0x0a9e('0x5e')]){if(_0x5239ef['List']['Contacts']['length']){return _0x5239ef[_0x0a9e('0x5e')][_0x0a9e('0x60')][0x0];}else{return db[_0x0a9e('0x5f')][_0x0a9e('0x59')](_[_0x0a9e('0x16')](_0x4e67ab[_0x0a9e('0x56')],{'firstName':_0x4e67ab[_0x0a9e('0x56')]['to'],'email':_0x4e67ab[_0x0a9e('0x56')]['to'],'phone':_0x4e67ab['body']['to'],'ListId':_0x5239ef[_0x0a9e('0x70')]}));}}else{throw new Error(_0x0a9e('0x71'));}})[_0x0a9e('0x1e')](function(){if(_0x5cc8fb){return respondWithRpcPromise('SendMail',_0x0a9e('0x72'),_0x5cc8fb,client9003)['then'](function(_0x4437ff){return _0x156662[_0x0a9e('0x34')]({'read':!![],'messageId':_0x4437ff['messageId'],'sentAt':moment()[_0x0a9e('0x73')](_0x0a9e('0x74'))});})[_0x0a9e('0x52')](function(_0x317c0c){logger['error']('%s',JSON[_0x0a9e('0x24')](_0x317c0c));return _0x156662;});}return _0x156662;});}return _0x156662;}})[_0x0a9e('0x1e')](respondWithResult(_0x1c693e,0xc9))[_0x0a9e('0x52')](handleError(_0x1c693e,null));};var interaction_log=require(_0x0a9e('0x75'))('mail-interactions');exports[_0x0a9e('0x76')]=function(_0x3d91db,_0x2d5506,_0x361b21){var _0x4abc8f={'agent':{},'channel':_0x0a9e('0x77')};if(_0x3d91db[_0x0a9e('0x56')]['id']){delete _0x3d91db[_0x0a9e('0x56')]['id'];}_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x78')]=!![];_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x79')]=moment()[_0x0a9e('0x73')](_0x0a9e('0x74'));_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]||_0x3d91db[_0x0a9e('0x69')]['id'];_0x4abc8f['agent']['id']=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x3d91db[_0x0a9e('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x7b')}]})[_0x0a9e('0x1e')](handleEntityNotFound(_0x2d5506,null))['then'](saveUpdates(_0x3d91db['body'],null))[_0x0a9e('0x1e')](function(_0x2bbdb5){if(_0x2bbdb5){_0x4abc8f['message']=_0x2bbdb5[_0x0a9e('0x7c')]({'plain':!![]});return db['MailInteraction'][_0x0a9e('0x57')]({'where':{'id':_0x2bbdb5[_0x0a9e('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x2d5506,null))[_0x0a9e('0x1e')](function(_0x41cf12){if(_0x41cf12){return _0x41cf12[_0x0a9e('0x34')]({'UserId':_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')],'read1stAt':_[_0x0a9e('0x7e')](_0x41cf12[_0x0a9e('0x7f')])?moment()['format'](_0x0a9e('0x74')):undefined});}return null;})[_0x0a9e('0x1e')](function(_0x45c109){if(_0x45c109){_0x4abc8f[_0x0a9e('0x80')]=_0x45c109['get']({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x81'),_0x3d91db['user']['id'],_0x3d91db[_0x0a9e('0x69')]['name'],_0x3d91db[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x4abc8f[_0x0a9e('0x80')]['id'],_0x3d91db[_0x0a9e('0x56')]?JSON['stringify'](_0x3d91db['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x84'),_0x0a9e('0x85'),_0x4abc8f);}return null;})['then'](function(_0x3b4a9f){if(_0x3b4a9f){if(_0x3d91db[_0x0a9e('0x56')]['manual']){_0x4abc8f['message'][_0x0a9e('0x86')]=util['format']('SIP/%s',_0x3d91db['user'][_0x0a9e('0x37')]);_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x4abc8f[_0x0a9e('0x87')];_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x88')]='accept';return respondWithRpcPromise(_0x0a9e('0x89'),'EventManager',{'event':_0x0a9e('0x8a'),'message':_0x4abc8f[_0x0a9e('0x27')]},client9002)[_0x0a9e('0x1e')](function(){return _0x4abc8f;});}return _0x4abc8f;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0x2d5506,null))['catch'](handleError(_0x2d5506,null));};var interaction_log=require(_0x0a9e('0x75'))(_0x0a9e('0x8b'));exports[_0x0a9e('0x8c')]=function(_0x5b74c3,_0xb6e411,_0x21e592){var _0x2a563d={'agent':{},'channel':_0x0a9e('0x77')};if(_0x5b74c3[_0x0a9e('0x56')]['id']){delete _0x5b74c3[_0x0a9e('0x56')]['id'];}_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x5b74c3['body'][_0x0a9e('0x7a')]||_0x5b74c3[_0x0a9e('0x69')]['id'];_0x2a563d['agent']['id']=_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5b74c3[_0x0a9e('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xb6e411,null))[_0x0a9e('0x1e')](function(_0x2b5148){if(_0x2b5148){_0x2a563d[_0x0a9e('0x27')]=_0x2b5148[_0x0a9e('0x7c')]({'plain':!![]});return db[_0x0a9e('0x8d')][_0x0a9e('0x57')]({'where':{'id':_0x2b5148[_0x0a9e('0x7d')]}});}return null;})[_0x0a9e('0x1e')](handleEntityNotFound(_0xb6e411,null))['then'](function(_0x329d88){if(_0x329d88){_0x2a563d[_0x0a9e('0x80')]=_0x329d88[_0x0a9e('0x7c')]({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x8e'),_0x5b74c3[_0x0a9e('0x69')]['id'],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x37')],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x2a563d[_0x0a9e('0x80')]['id'],_0x5b74c3[_0x0a9e('0x56')]?JSON[_0x0a9e('0x24')](_0x5b74c3['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x8f'),_0x0a9e('0x90'),_0x2a563d);}return null;})[_0x0a9e('0x1e')](function(_0xb0599a){if(_0xb0599a){_0xb0599a['message'][_0x0a9e('0x86')]=util[_0x0a9e('0x73')]('SIP/%s',_0x5b74c3[_0x0a9e('0x69')]['name']);_0xb0599a[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x2a563d[_0x0a9e('0x87')];_0xb0599a[_0x0a9e('0x27')]['event']=_0x0a9e('0x8c');respondWithRpcPromise('EventManager',_0x0a9e('0x89'),{'event':_0x0a9e('0x91'),'message':_0xb0599a['message']},client9002);return _0x2a563d;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0xb6e411,null))[_0x0a9e('0x52')](handleError(_0xb6e411,null));};exports[_0x0a9e('0x92')]=function(_0x4ab276,_0x4c788f){var _0x1b82b7=moment()[_0x0a9e('0x93')]()[_0x0a9e('0x94')]();var _0x413190=path[_0x0a9e('0x95')](config[_0x0a9e('0x6d')],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x98'));var _0x586510=path[_0x0a9e('0x95')](config['root'],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x6c'));var _0x28ce92=util[_0x0a9e('0x73')]('message-%s.eml',_0x1b82b7);return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x4ab276[_0x0a9e('0x53')]['id']},'attributes':['id',_0x0a9e('0x56'),_0x0a9e('0x99'),'to','cc','bcc','subject',_0x0a9e('0x9a')],'include':_0x4ab276['query'][_0x0a9e('0x6c')]?[{'model':db[_0x0a9e('0x9b')],'as':_0x0a9e('0x9c')}]:undefined})[_0x0a9e('0x1e')](handleEntityNotFound(_0x4c788f,null))[_0x0a9e('0x1e')](function(_0x213e5d){if(_0x213e5d){var _0x596312=_0x213e5d;var _0x4db918={'from':_0x596312[_0x0a9e('0x99')],'to':_0x596312['to'],'subject':_0x596312['subject'],'html':_0x596312[_0x0a9e('0x56')],'headers':{'Date':moment(_0x596312['createdAt'])[_0x0a9e('0x73')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x213e5d['cc']){_0x4db918['headers']['Cc']=_0x213e5d['cc'];}if(_0x213e5d[_0x0a9e('0x9d')]){_0x4db918[_0x0a9e('0x9e')]['Bcc']=_0x213e5d[_0x0a9e('0x9d')];}return new BPromise(function(_0x17cb30,_0x15c6b9){if(_0x213e5d[_0x0a9e('0x9c')]){for(var _0x2eb028=0x0;_0x2eb028<_0x213e5d['Attachments']['length'];_0x2eb028++){var _0x16449b=_0x213e5d[_0x0a9e('0x9c')][_0x2eb028];var _0x41c8cd=path[_0x0a9e('0x95')](_0x586510,_0x16449b[_0x0a9e('0x6f')]);if(fs['existsSync'](_0x41c8cd)){_0x4db918[_0x0a9e('0x6c')][_0x0a9e('0x9f')]({'name':_0x16449b['name'],'contentType':_0x16449b[_0x0a9e('0x3d')],'data':fs[_0x0a9e('0xa0')](_0x41c8cd)});}}}emlformat[_0x0a9e('0xa1')](_0x4db918,function(_0x2427d5,_0x23b25b){if(_0x2427d5)return _0x15c6b9(_0x2427d5);fs[_0x0a9e('0xa2')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92),_0x23b25b);return _0x17cb30(_0x23b25b);});});}})[_0x0a9e('0x1e')](function(_0x40dd2a){if(_0x40dd2a){return _0x4c788f[_0x0a9e('0x92')](path['join'](_0x413190,_0x28ce92),_0x28ce92,function(_0x1065a7){if(_0x1065a7){console[_0x0a9e('0xa3')](_0x0a9e('0xa4'),_0x1065a7);}else{fs[_0x0a9e('0xa5')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92));}});}})['catch'](handleError(_0x4c788f,null));}; \ No newline at end of file +var _0xa9e0=['sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','MailMessage','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','body','find','describe','create','out','secret','findOne','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp','service','host','port','secure','authentication','user','auth','pass','attachments','root','server/files/attachments','basename','ListId','List\x20not\x20found','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','accept','mail','read','readAt','UserId','Contact','get','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','mail-interactions','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','download','unix','toString','join','server','files','tmp','from','createdAt','Attachment','Attachments','bcc','headers','push','readFileSync','build','writeFileSync','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xd2a6f,_0x1825ac){var _0x3741f7=function(_0x1c0770){while(--_0x1c0770){_0xd2a6f['push'](_0xd2a6f['shift']());}};_0x3741f7(++_0x1825ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9003=jayson['client'][_0x0a9e('0x1c')]({'port':0x232b});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x519dfd,_0x16033c,_0x12066b,_0x48f32d){return new BPromise(function(_0x225616,_0x5a0a06){var _0x459eb1=_0x48f32d||client;return _0x459eb1[_0x0a9e('0x1d')](_0x519dfd,_0x12066b)[_0x0a9e('0x1e')](function(_0x205fd6){logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));logger[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x16033c,_0x0a9e('0x21'),JSON[_0x0a9e('0x24')](_0x205fd6));if(_0x205fd6[_0x0a9e('0x25')]){if(_0x205fd6['error'][_0x0a9e('0x26')]===0x1f4){logger[_0x0a9e('0x25')]('MailMessage,\x20%s,\x20%s',_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x5a0a06(_0x205fd6['error'][_0x0a9e('0x27')]);}logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x225616(_0x205fd6[_0x0a9e('0x25')][_0x0a9e('0x27')]);}else{logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));_0x225616(_0x205fd6[_0x0a9e('0x28')][_0x0a9e('0x27')]);}})['catch'](function(_0x59181e){logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x59181e);_0x5a0a06(_0x59181e);});});}function respondWithStatusCode(_0x40c424,_0x33161b){_0x33161b=_0x33161b||0xcc;return function(_0x526cf3){if(_0x526cf3){return _0x40c424[_0x0a9e('0x29')](_0x33161b);}return _0x40c424['status'](_0x33161b)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x5bfb33,_0x1dc186){_0x1dc186=_0x1dc186||0xc8;return function(_0x34dc65){if(_0x34dc65){return _0x5bfb33[_0x0a9e('0x2b')](_0x1dc186)[_0x0a9e('0x2c')](_0x34dc65);}};}function respondWithFilteredResult(_0x140511,_0x1538a4){return function(_0x11c3b6){if(_0x11c3b6){var _0x14de77=_0x11c3b6[_0x0a9e('0x2d')],_0x5a101a=_0x1538a4[_0x0a9e('0x2e')],_0x3652a7=_0x1538a4['offset']+_0x1538a4[_0x0a9e('0x2f')],_0x468813;if(_0x3652a7>=_0x14de77){_0x3652a7=_0x14de77;_0x468813=0xc8;}else{_0x468813=0xce;}_0x140511[_0x0a9e('0x2b')](_0x468813);return _0x140511[_0x0a9e('0x30')](_0x0a9e('0x31'),_0x5a101a+'-'+_0x3652a7+'/'+_0x14de77)[_0x0a9e('0x2c')](_0x11c3b6);}return null;};}function patchUpdates(_0x563b45){return function(_0x296f41){try{jsonpatch[_0x0a9e('0x32')](_0x296f41,_0x563b45,!![]);}catch(_0x1dbde2){return BPromise['reject'](_0x1dbde2);}return _0x296f41[_0x0a9e('0x33')]();};}function saveUpdates(_0x5d1e0e,_0x2407f9){return function(_0x3ae878){if(_0x3ae878){return _0x3ae878[_0x0a9e('0x34')](_0x5d1e0e)[_0x0a9e('0x1e')](function(_0x25ce3a){return _0x25ce3a;});}return null;};}function removeEntity(_0x5180f1,_0x66c1d2){return function(_0x46f0a5){if(_0x46f0a5){return _0x46f0a5[_0x0a9e('0x35')]()[_0x0a9e('0x1e')](function(){_0x5180f1[_0x0a9e('0x2b')](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x332d35,_0x39e565){return function(_0x5583a4){if(!_0x5583a4){_0x332d35[_0x0a9e('0x29')](0x194);}return _0x5583a4;};}function handleError(_0x5e7238,_0x2cc7a0){_0x2cc7a0=_0x2cc7a0||0x1f4;return function(_0x14b13f){logger[_0x0a9e('0x25')](_0x14b13f[_0x0a9e('0x36')]);if(_0x14b13f['name']){delete _0x14b13f[_0x0a9e('0x37')];}_0x5e7238[_0x0a9e('0x2b')](_0x2cc7a0)[_0x0a9e('0x38')](_0x14b13f);};}exports[_0x0a9e('0x39')]=function(_0x4853b1,_0x54135e){var _0x1e8694={},_0x5640eb={},_0x24936a={'count':0x0,'rows':[]};var _0x3d9717=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x31916f){return{'name':_0x31916f[_0x0a9e('0x3c')],'type':_0x31916f[_0x0a9e('0x3d')]['key']};});_0x5640eb[_0x0a9e('0x3e')]=_[_0x0a9e('0x3a')](_0x3d9717,_0x0a9e('0x37'));_0x5640eb['query']=_['keys'](_0x4853b1[_0x0a9e('0x3f')]);_0x5640eb[_0x0a9e('0x40')]=_['intersection'](_0x5640eb[_0x0a9e('0x3e')],_0x5640eb[_0x0a9e('0x3f')]);_0x1e8694[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x5640eb['model'],qs['fields'](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1e8694['attributes']=_0x1e8694[_0x0a9e('0x41')][_0x0a9e('0x44')]?_0x1e8694[_0x0a9e('0x41')]:_0x5640eb['model'];if(!_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x45')](_0x0a9e('0x46'))){_0x1e8694[_0x0a9e('0x2f')]=qs[_0x0a9e('0x2f')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2f')]);_0x1e8694[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2e')]);}_0x1e8694[_0x0a9e('0x47')]=qs[_0x0a9e('0x48')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x1e8694['where']=qs['filters'](_[_0x0a9e('0x49')](_0x4853b1[_0x0a9e('0x3f')],_0x5640eb[_0x0a9e('0x40')]),_0x3d9717);if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]){_0x1e8694[_0x0a9e('0x4b')]=_[_0x0a9e('0x4c')](_0x1e8694[_0x0a9e('0x4b')],{'$or':_[_0x0a9e('0x3a')](_0x3d9717,function(_0x25c6e6){if(_0x25c6e6[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0x5026aa={};_0x5026aa[_0x25c6e6[_0x0a9e('0x37')]]={'$like':'%'+_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]+'%'};return _0x5026aa;}})});}_0x1e8694=_[_0x0a9e('0x4c')]({},_0x1e8694,_0x4853b1[_0x0a9e('0x4e')]);var _0xbe9d19={'where':_0x1e8694[_0x0a9e('0x4b')]};return db[_0x0a9e('0x3b')]['count'](_0xbe9d19)[_0x0a9e('0x1e')](function(_0x48fd45){_0x24936a[_0x0a9e('0x2d')]=_0x48fd45;if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1e8694['include']=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x1e8694);})[_0x0a9e('0x1e')](function(_0x34aa5a){_0x24936a[_0x0a9e('0x51')]=_0x34aa5a;return _0x24936a;})[_0x0a9e('0x1e')](respondWithFilteredResult(_0x54135e,_0x1e8694))[_0x0a9e('0x52')](handleError(_0x54135e,null));};exports['show']=function(_0x13f44d,_0x1bde3c){var _0x1b5e80={'raw':!![],'where':{'id':_0x13f44d[_0x0a9e('0x53')]['id']}},_0x16f976={};_0x16f976[_0x0a9e('0x3e')]=_[_0x0a9e('0x54')](db[_0x0a9e('0x3b')][_0x0a9e('0x55')]);_0x16f976['query']=_[_0x0a9e('0x54')](_0x13f44d[_0x0a9e('0x3f')]);_0x16f976['filters']=_['intersection'](_0x16f976['model'],_0x16f976[_0x0a9e('0x3f')]);_0x1b5e80[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x16f976[_0x0a9e('0x3e')],qs[_0x0a9e('0x43')](_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1b5e80[_0x0a9e('0x41')]=_0x1b5e80['attributes']['length']?_0x1b5e80['attributes']:_0x16f976[_0x0a9e('0x3e')];if(_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1b5e80['include']=[{'all':!![]}];}_0x1b5e80=_[_0x0a9e('0x4c')]({},_0x1b5e80,_0x13f44d[_0x0a9e('0x4e')]);return db['MailMessage']['find'](_0x1b5e80)[_0x0a9e('0x1e')](handleEntityNotFound(_0x1bde3c,null))['then'](respondWithResult(_0x1bde3c,null))[_0x0a9e('0x52')](handleError(_0x1bde3c,null));};exports['update']=function(_0x2e5e62,_0x3c20b2){if(_0x2e5e62[_0x0a9e('0x56')]['id']){delete _0x2e5e62['body']['id'];}return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x2e5e62['params']['id']}})['then'](handleEntityNotFound(_0x3c20b2,null))[_0x0a9e('0x1e')](saveUpdates(_0x2e5e62[_0x0a9e('0x56')],null))['then'](respondWithResult(_0x3c20b2,null))[_0x0a9e('0x52')](handleError(_0x3c20b2,null));};exports['destroy']=function(_0x211ef9,_0x523cd2){return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x211ef9['params']['id']}})['then'](handleEntityNotFound(_0x523cd2,null))[_0x0a9e('0x1e')](removeEntity(_0x523cd2,null))['catch'](handleError(_0x523cd2,null));};exports[_0x0a9e('0x58')]=function(_0x65432,_0x3cfd00){return db[_0x0a9e('0x3b')][_0x0a9e('0x58')]()[_0x0a9e('0x1e')](respondWithResult(_0x3cfd00,null))[_0x0a9e('0x52')](handleError(_0x3cfd00,null));};exports[_0x0a9e('0x59')]=function(_0x4e67ab,_0x1c693e){return db[_0x0a9e('0x3b')][_0x0a9e('0x59')](_0x4e67ab[_0x0a9e('0x56')])[_0x0a9e('0x1e')](function(_0x156662){if(_0x156662){if(_0x156662['direction']===_0x0a9e('0x5a')&&!_0x156662[_0x0a9e('0x5b')]){var _0x5239ef,_0x3649cc,_0x5cc8fb;if(_0x4e67ab[_0x0a9e('0x56')]['to']){_0x3649cc=_0x4e67ab['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0x0a9e('0x5c')]({'where':{'id':_0x156662['MailAccountId']},'include':[{'model':db[_0x0a9e('0x5d')],'as':_0x0a9e('0x5e'),'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x60'),'where':{'email':_0x3649cc},'limit':0x1,'order':[[_0x0a9e('0x61'),_0x0a9e('0x62')]]}]},{'model':db['MailServerOut'],'as':_0x0a9e('0x63'),'raw':!![]}]})['then'](function(_0xca4ade){_0x5239ef=_0xca4ade;if(_0x5239ef&&_0x5239ef[_0x0a9e('0x63')]){var _0x51aaf7={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x64')])){_0x51aaf7[_0x0a9e('0x65')]=_0x5239ef[_0x0a9e('0x63')]['host'];_0x51aaf7[_0x0a9e('0x66')]=_0x5239ef[_0x0a9e('0x63')]['port'];_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];if(_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x68')]){_0x51aaf7['auth']={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')]['pass']};}}else{_0x51aaf7[_0x0a9e('0x64')]=_0x5239ef['Smtp']['service'];_0x51aaf7[_0x0a9e('0x6a')]={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x6b')]};_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];}if(_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')]&&_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')]){for(var _0x2b8192=0x0;_0x2b8192<_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')];_0x2b8192+=0x1){_0x4e67ab[_0x0a9e('0x56')]['attachments'][_0x2b8192]={'filename':_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x37')],'path':path['join'](config[_0x0a9e('0x6d')],_0x0a9e('0x6e'),_0x4e67ab['body'][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x6f')])};}}_0x5cc8fb={'account':_0x51aaf7,'message':_0x4e67ab[_0x0a9e('0x56')]};return;}})[_0x0a9e('0x1e')](function(){if(_0x5239ef[_0x0a9e('0x5e')]){if(_0x5239ef['List']['Contacts']['length']){return _0x5239ef[_0x0a9e('0x5e')][_0x0a9e('0x60')][0x0];}else{return db[_0x0a9e('0x5f')][_0x0a9e('0x59')](_[_0x0a9e('0x16')](_0x4e67ab[_0x0a9e('0x56')],{'firstName':_0x4e67ab[_0x0a9e('0x56')]['to'],'email':_0x4e67ab[_0x0a9e('0x56')]['to'],'phone':_0x4e67ab['body']['to'],'ListId':_0x5239ef[_0x0a9e('0x70')]}));}}else{throw new Error(_0x0a9e('0x71'));}})[_0x0a9e('0x1e')](function(){if(_0x5cc8fb){return respondWithRpcPromise('SendMail',_0x0a9e('0x72'),_0x5cc8fb,client9003)['then'](function(_0x4437ff){return _0x156662[_0x0a9e('0x34')]({'read':!![],'messageId':_0x4437ff['messageId'],'sentAt':moment()[_0x0a9e('0x73')](_0x0a9e('0x74'))});})[_0x0a9e('0x52')](function(_0x317c0c){logger['error']('%s',JSON[_0x0a9e('0x24')](_0x317c0c));return _0x156662;});}return _0x156662;});}return _0x156662;}})[_0x0a9e('0x1e')](respondWithResult(_0x1c693e,0xc9))[_0x0a9e('0x52')](handleError(_0x1c693e,null));};var interaction_log=require(_0x0a9e('0x75'))('mail-interactions');exports[_0x0a9e('0x76')]=function(_0x3d91db,_0x2d5506,_0x361b21){var _0x4abc8f={'agent':{},'channel':_0x0a9e('0x77')};if(_0x3d91db[_0x0a9e('0x56')]['id']){delete _0x3d91db[_0x0a9e('0x56')]['id'];}_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x78')]=!![];_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x79')]=moment()[_0x0a9e('0x73')](_0x0a9e('0x74'));_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]||_0x3d91db[_0x0a9e('0x69')]['id'];_0x4abc8f['agent']['id']=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x3d91db[_0x0a9e('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x7b')}]})[_0x0a9e('0x1e')](handleEntityNotFound(_0x2d5506,null))['then'](saveUpdates(_0x3d91db['body'],null))[_0x0a9e('0x1e')](function(_0x2bbdb5){if(_0x2bbdb5){_0x4abc8f['message']=_0x2bbdb5[_0x0a9e('0x7c')]({'plain':!![]});return db['MailInteraction'][_0x0a9e('0x57')]({'where':{'id':_0x2bbdb5[_0x0a9e('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x2d5506,null))[_0x0a9e('0x1e')](function(_0x41cf12){if(_0x41cf12){return _0x41cf12[_0x0a9e('0x34')]({'UserId':_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')],'read1stAt':_[_0x0a9e('0x7e')](_0x41cf12[_0x0a9e('0x7f')])?moment()['format'](_0x0a9e('0x74')):undefined});}return null;})[_0x0a9e('0x1e')](function(_0x45c109){if(_0x45c109){_0x4abc8f[_0x0a9e('0x80')]=_0x45c109['get']({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x81'),_0x3d91db['user']['id'],_0x3d91db[_0x0a9e('0x69')]['name'],_0x3d91db[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x4abc8f[_0x0a9e('0x80')]['id'],_0x3d91db[_0x0a9e('0x56')]?JSON['stringify'](_0x3d91db['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x84'),_0x0a9e('0x85'),_0x4abc8f);}return null;})['then'](function(_0x3b4a9f){if(_0x3b4a9f){if(_0x3d91db[_0x0a9e('0x56')]['manual']){_0x4abc8f['message'][_0x0a9e('0x86')]=util['format']('SIP/%s',_0x3d91db['user'][_0x0a9e('0x37')]);_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x4abc8f[_0x0a9e('0x87')];_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x88')]='accept';return respondWithRpcPromise(_0x0a9e('0x89'),'EventManager',{'event':_0x0a9e('0x8a'),'message':_0x4abc8f[_0x0a9e('0x27')]},client9002)[_0x0a9e('0x1e')](function(){return _0x4abc8f;});}return _0x4abc8f;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0x2d5506,null))['catch'](handleError(_0x2d5506,null));};var interaction_log=require(_0x0a9e('0x75'))(_0x0a9e('0x8b'));exports[_0x0a9e('0x8c')]=function(_0x5b74c3,_0xb6e411,_0x21e592){var _0x2a563d={'agent':{},'channel':_0x0a9e('0x77')};if(_0x5b74c3[_0x0a9e('0x56')]['id']){delete _0x5b74c3[_0x0a9e('0x56')]['id'];}_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x5b74c3['body'][_0x0a9e('0x7a')]||_0x5b74c3[_0x0a9e('0x69')]['id'];_0x2a563d['agent']['id']=_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5b74c3[_0x0a9e('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xb6e411,null))[_0x0a9e('0x1e')](function(_0x2b5148){if(_0x2b5148){_0x2a563d[_0x0a9e('0x27')]=_0x2b5148[_0x0a9e('0x7c')]({'plain':!![]});return db[_0x0a9e('0x8d')][_0x0a9e('0x57')]({'where':{'id':_0x2b5148[_0x0a9e('0x7d')]}});}return null;})[_0x0a9e('0x1e')](handleEntityNotFound(_0xb6e411,null))['then'](function(_0x329d88){if(_0x329d88){_0x2a563d[_0x0a9e('0x80')]=_0x329d88[_0x0a9e('0x7c')]({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x8e'),_0x5b74c3[_0x0a9e('0x69')]['id'],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x37')],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x2a563d[_0x0a9e('0x80')]['id'],_0x5b74c3[_0x0a9e('0x56')]?JSON[_0x0a9e('0x24')](_0x5b74c3['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x8f'),_0x0a9e('0x90'),_0x2a563d);}return null;})[_0x0a9e('0x1e')](function(_0xb0599a){if(_0xb0599a){_0xb0599a['message'][_0x0a9e('0x86')]=util[_0x0a9e('0x73')]('SIP/%s',_0x5b74c3[_0x0a9e('0x69')]['name']);_0xb0599a[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x2a563d[_0x0a9e('0x87')];_0xb0599a[_0x0a9e('0x27')]['event']=_0x0a9e('0x8c');respondWithRpcPromise('EventManager',_0x0a9e('0x89'),{'event':_0x0a9e('0x91'),'message':_0xb0599a['message']},client9002);return _0x2a563d;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0xb6e411,null))[_0x0a9e('0x52')](handleError(_0xb6e411,null));};exports[_0x0a9e('0x92')]=function(_0x4ab276,_0x4c788f){var _0x1b82b7=moment()[_0x0a9e('0x93')]()[_0x0a9e('0x94')]();var _0x413190=path[_0x0a9e('0x95')](config[_0x0a9e('0x6d')],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x98'));var _0x586510=path[_0x0a9e('0x95')](config['root'],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x6c'));var _0x28ce92=util[_0x0a9e('0x73')]('message-%s.eml',_0x1b82b7);return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x4ab276[_0x0a9e('0x53')]['id']},'attributes':['id',_0x0a9e('0x56'),_0x0a9e('0x99'),'to','cc','bcc','subject',_0x0a9e('0x9a')],'include':_0x4ab276['query'][_0x0a9e('0x6c')]?[{'model':db[_0x0a9e('0x9b')],'as':_0x0a9e('0x9c')}]:undefined})[_0x0a9e('0x1e')](handleEntityNotFound(_0x4c788f,null))[_0x0a9e('0x1e')](function(_0x213e5d){if(_0x213e5d){var _0x596312=_0x213e5d;var _0x4db918={'from':_0x596312[_0x0a9e('0x99')],'to':_0x596312['to'],'subject':_0x596312['subject'],'html':_0x596312[_0x0a9e('0x56')],'headers':{'Date':moment(_0x596312['createdAt'])[_0x0a9e('0x73')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x213e5d['cc']){_0x4db918['headers']['Cc']=_0x213e5d['cc'];}if(_0x213e5d[_0x0a9e('0x9d')]){_0x4db918[_0x0a9e('0x9e')]['Bcc']=_0x213e5d[_0x0a9e('0x9d')];}return new BPromise(function(_0x17cb30,_0x15c6b9){if(_0x213e5d[_0x0a9e('0x9c')]){for(var _0x2eb028=0x0;_0x2eb028<_0x213e5d['Attachments']['length'];_0x2eb028++){var _0x16449b=_0x213e5d[_0x0a9e('0x9c')][_0x2eb028];var _0x41c8cd=path[_0x0a9e('0x95')](_0x586510,_0x16449b[_0x0a9e('0x6f')]);if(fs['existsSync'](_0x41c8cd)){_0x4db918[_0x0a9e('0x6c')][_0x0a9e('0x9f')]({'name':_0x16449b['name'],'contentType':_0x16449b[_0x0a9e('0x3d')],'data':fs[_0x0a9e('0xa0')](_0x41c8cd)});}}}emlformat[_0x0a9e('0xa1')](_0x4db918,function(_0x2427d5,_0x23b25b){if(_0x2427d5)return _0x15c6b9(_0x2427d5);fs[_0x0a9e('0xa2')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92),_0x23b25b);return _0x17cb30(_0x23b25b);});});}})[_0x0a9e('0x1e')](function(_0x40dd2a){if(_0x40dd2a){return _0x4c788f[_0x0a9e('0x92')](path['join'](_0x413190,_0x28ce92),_0x28ce92,function(_0x1065a7){if(_0x1065a7){console[_0x0a9e('0xa3')](_0x0a9e('0xa4'),_0x1065a7);}else{fs[_0x0a9e('0xa5')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92));}});}})['catch'](handleError(_0x4c788f,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 6a5d757..fec6f90 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 _0x8bc3=['save','remove','emit','hook','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x2cef86,_0xbae0a6){var _0x46dfd6=function(_0x52e464){while(--_0x52e464){_0x2cef86['push'](_0x2cef86['shift']());}};_0x46dfd6(++_0xbae0a6);}(_0x8bc3,0x89));var _0x38bc=function(_0x36ca7f,_0x337025){_0x36ca7f=_0x36ca7f-0x0;var _0x1dedcd=_0x8bc3[_0x36ca7f];return _0x1dedcd;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x38bc('0x0'))['db'][_0x38bc('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x38bc('0x2')](0x0);var events={'afterCreate':_0x38bc('0x3'),'afterUpdate':'update','afterDestroy':_0x38bc('0x4')};function emitEvent(_0x422ca3){return function(_0x499505,_0x31988a,_0x452215){MailMessageEvents[_0x38bc('0x5')](_0x422ca3+':'+_0x499505['id'],_0x499505);MailMessageEvents[_0x38bc('0x5')](_0x422ca3,_0x499505);_0x452215(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x38bc('0x6')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x85ad=['../../mysqldb','MailMessage','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x1aa154,_0x44a627){var _0x1c7c25=function(_0x2a8b75){while(--_0x2a8b75){_0x1aa154['push'](_0x1aa154['shift']());}};_0x1c7c25(++_0x44a627);}(_0x85ad,0xd8));var _0xd85a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x85ad[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xd85a('0x0'))['db'][_0xd85a('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xd85a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd85a('0x3'),'afterDestroy':_0xd85a('0x4')};function emitEvent(_0xea5f99){return function(_0x3ae996,_0x3d55e4,_0x27b99d){MailMessageEvents[_0xd85a('0x5')](_0xea5f99+':'+_0x3ae996['id'],_0x3ae996);MailMessageEvents['emit'](_0xea5f99,_0x3ae996);_0x27b99d(null);};}for(var e in events){if(events[_0xd85a('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xd85a('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 2989f06..a798e61 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 _0xd33d=['fti_mail_messages','plainBody','subject','FULLTEXT','body','get','direction','toLowerCase','secret','UserId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','moment','bluebird','request-promise','html-to-text','path','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId'];(function(_0x2d25e5,_0x5d1e52){var _0x8385c8=function(_0x2dd203){while(--_0x2dd203){_0x2d25e5['push'](_0x2d25e5['shift']());}};_0x8385c8(++_0x5d1e52);}(_0xd33d,0x144));var _0xdd33=function(_0x6e2ff8,_0x290cd1){_0x6e2ff8=_0x6e2ff8-0x0;var _0x1988bb=_0xd33d[_0x6e2ff8];return _0x1988bb;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xdd33('0x0'));var BPromise=require(_0xdd33('0x1'));var rp=require(_0xdd33('0x2'));var htmlToText=require(_0xdd33('0x3'));var fs=require('fs');var path=require(_0xdd33('0x4'));var rimraf=require('rimraf');var config=require(_0xdd33('0x5'));var attributes=require(_0xdd33('0x6'));module[_0xdd33('0x7')]=function(_0x1dfd70,_0x1742f7){return _0x1dfd70[_0xdd33('0x8')](_0xdd33('0x9'),attributes,{'tableName':_0xdd33('0xa'),'paranoid':![],'indexes':[{'name':_0xdd33('0xb'),'fields':[_0xdd33('0xb')]},{'name':_0xdd33('0xc'),'fields':[_0xdd33('0xd'),_0xdd33('0xe')],'type':_0xdd33('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xb31e80,_0x4aa432,_0x4b8eaa){if(_0xb31e80[_0xdd33('0x10')]){_0xb31e80[_0xdd33('0xd')]=htmlToText['fromString'](_0xb31e80[_0xdd33('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4b8eaa(null,_0x4aa432);},'afterCreate':function(_0x45d540,_0x5b5d7f,_0x26b3dc){var _0x158e32=_0x1dfd70['models'];var _0x478974=_0x45d540[_0xdd33('0x11')]({'plain':!![]});if(_0x478974[_0xdd33('0x12')][_0xdd33('0x13')]()==='in'||_0x478974[_0xdd33('0x12')][_0xdd33('0x13')]()==='out'&&!_0x478974[_0xdd33('0x14')]&&!_['isNil'](_0x478974[_0xdd33('0x15')])){_0x158e32['MailInteraction']['findOne']({'where':{'id':_0x478974['MailInteractionId']}})['then'](function(_0x68c276){if(_0x68c276){_0x68c276[_0xdd33('0x16')]({'lastMsgAt':_0x478974[_0xdd33('0x17')],'lastMsgDirection':_0x478974['direction']['toLowerCase'](),'lastMsgBody':_0x478974['body']});}})[_0xdd33('0x18')](function(_0x5dd826){console[_0xdd33('0x19')](_0x5dd826);});}_0x26b3dc();}},'charset':_0xdd33('0x1a'),'collate':_0xdd33('0x1b')});}; \ No newline at end of file +var _0x0054=['api','moment','bluebird','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','mail_messages','messageId','fti_mail_messages','plainBody','subject','body','fromString','models','get','toLowerCase','out','secret','isNil','MailInteraction','MailInteractionId','update','createdAt','direction','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x51616f,_0x13b59a){var _0x9eae7f=function(_0x4faa4f){while(--_0x4faa4f){_0x51616f['push'](_0x51616f['shift']());}};_0x9eae7f(++_0x13b59a);}(_0x0054,0x1ec));var _0x4005=function(_0x118246,_0x57e2f1){_0x118246=_0x118246-0x0;var _0x30b537=_0x0054[_0x118246];return _0x30b537;};'use strict';var _=require(_0x4005('0x0'));var util=require(_0x4005('0x1'));var logger=require(_0x4005('0x2'))(_0x4005('0x3'));var moment=require(_0x4005('0x4'));var BPromise=require(_0x4005('0x5'));var rp=require('request-promise');var htmlToText=require(_0x4005('0x6'));var fs=require('fs');var path=require(_0x4005('0x7'));var rimraf=require(_0x4005('0x8'));var config=require(_0x4005('0x9'));var attributes=require(_0x4005('0xa'));module[_0x4005('0xb')]=function(_0x10ec82,_0x5a5a60){return _0x10ec82['define']('MailMessage',attributes,{'tableName':_0x4005('0xc'),'paranoid':![],'indexes':[{'name':_0x4005('0xd'),'fields':[_0x4005('0xd')]},{'name':_0x4005('0xe'),'fields':[_0x4005('0xf'),_0x4005('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x121e9a,_0xf73205,_0x3c171f){if(_0x121e9a[_0x4005('0x11')]){_0x121e9a[_0x4005('0xf')]=htmlToText[_0x4005('0x12')](_0x121e9a[_0x4005('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3c171f(null,_0xf73205);},'afterCreate':function(_0x2137f6,_0x13db9a,_0x4fb405){var _0x5936f9=_0x10ec82[_0x4005('0x13')];var _0x2accd4=_0x2137f6[_0x4005('0x14')]({'plain':!![]});if(_0x2accd4['direction'][_0x4005('0x15')]()==='in'||_0x2accd4['direction']['toLowerCase']()===_0x4005('0x16')&&!_0x2accd4[_0x4005('0x17')]&&!_[_0x4005('0x18')](_0x2accd4['UserId'])){_0x5936f9[_0x4005('0x19')]['findOne']({'where':{'id':_0x2accd4[_0x4005('0x1a')]}})['then'](function(_0x2b38ee){if(_0x2b38ee){_0x2b38ee[_0x4005('0x1b')]({'lastMsgAt':_0x2accd4[_0x4005('0x1c')],'lastMsgDirection':_0x2accd4[_0x4005('0x1d')][_0x4005('0x15')](),'lastMsgBody':_0x2accd4[_0x4005('0x11')]});}})[_0x4005('0x1e')](function(_0x5e511c){console[_0x4005('0x1f')](_0x5e511c);});}_0x4fb405();}},'charset':'utf8mb4','collate':_0x4005('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 6b6c63d..33b529d 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 _0xc770=['stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./mailMessage.socket','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateMailMessage','body','options','raw','info'];(function(_0x5d5ff8,_0x5a4489){var _0x53b4b6=function(_0x5dca03){while(--_0x5dca03){_0x5d5ff8['push'](_0x5d5ff8['shift']());}};_0x53b4b6(++_0x5a4489);}(_0xc770,0xd3));var _0x0c77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc770[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0c77('0x0'));var util=require(_0x0c77('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0c77('0x2'));var fs=require('fs');var Redis=require(_0x0c77('0x3'));var db=require(_0x0c77('0x4'))['db'];var utils=require(_0x0c77('0x5'));var logger=require(_0x0c77('0x6'))(_0x0c77('0x7'));var config=require(_0x0c77('0x8'));var jayson=require(_0x0c77('0x9'));var client=jayson['client'][_0x0c77('0xa')]({'port':0x232a});config[_0x0c77('0xb')]=_['defaults'](config[_0x0c77('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x0c77('0xc'))(new Redis(config[_0x0c77('0xb')]));require(_0x0c77('0xd'))['register'](socket);function respondWithRpcPromise(_0xdb6e5d,_0x194f36,_0x4b47f0){return new BPromise(function(_0x58c6d5,_0x2784dd){return client['request'](_0xdb6e5d,_0x4b47f0)[_0x0c77('0xe')](function(_0x831896){logger['info'](_0x0c77('0xf'),_0x194f36,_0x0c77('0x10'));logger[_0x0c77('0x11')](_0x0c77('0x12'),_0x194f36,'request\x20sent',JSON['stringify'](_0x831896));if(_0x831896['error']){if(_0x831896[_0x0c77('0x13')][_0x0c77('0x14')]===0x1f4){logger[_0x0c77('0x13')](_0x0c77('0xf'),_0x194f36,_0x831896['error'][_0x0c77('0x15')]);return _0x2784dd(_0x831896[_0x0c77('0x13')]['message']);}logger[_0x0c77('0x13')](_0x0c77('0xf'),_0x194f36,_0x831896['error']['message']);return _0x58c6d5(_0x831896[_0x0c77('0x13')][_0x0c77('0x15')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x194f36,_0x0c77('0x10'));_0x58c6d5(_0x831896[_0x0c77('0x16')][_0x0c77('0x15')]);}})[_0x0c77('0x17')](function(_0x4c5d2a){logger[_0x0c77('0x13')](_0x0c77('0xf'),_0x194f36,_0x4c5d2a);_0x2784dd(_0x4c5d2a);});});}exports[_0x0c77('0x18')]=function(_0x4b8520){var _0x226c37=this;return new Promise(function(_0x2519d3,_0x4c7e25){return db['MailMessage']['create'](_0x4b8520[_0x0c77('0x19')],{'raw':_0x4b8520[_0x0c77('0x1a')]?_0x4b8520[_0x0c77('0x1a')][_0x0c77('0x1b')]===undefined?!![]:![]:!![]})[_0x0c77('0xe')](function(_0x147ff1){logger[_0x0c77('0x1c')]('CreateMailMessage',_0x4b8520);logger[_0x0c77('0x11')]('CreateMailMessage',_0x4b8520,JSON[_0x0c77('0x1d')](_0x147ff1));_0x2519d3(_0x147ff1);})[_0x0c77('0x17')](function(_0x1278dc){logger[_0x0c77('0x13')](_0x0c77('0x18'),_0x1278dc[_0x0c77('0x15')],_0x4b8520);_0x4c7e25(_0x226c37[_0x0c77('0x13')](0x1f4,_0x1278dc['message']));});});}; \ No newline at end of file +var _0xd8b2=['body','options','raw','then','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','message','error','catch','CreateMailMessage','MailMessage','create'];(function(_0x5080b8,_0x4794aa){var _0x449ed9=function(_0x1e010b){while(--_0x1e010b){_0x5080b8['push'](_0x5080b8['shift']());}};_0x449ed9(++_0x4794aa);}(_0xd8b2,0x145));var _0x2d8b=function(_0xc84c24,_0x1f9214){_0xc84c24=_0xc84c24-0x0;var _0x35a66f=_0xd8b2[_0xc84c24];return _0x35a66f;};'use strict';var _=require('lodash');var util=require(_0x2d8b('0x0'));var moment=require(_0x2d8b('0x1'));var BPromise=require('bluebird');var rs=require(_0x2d8b('0x2'));var fs=require('fs');var Redis=require(_0x2d8b('0x3'));var db=require(_0x2d8b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2d8b('0x5'))('rpc');var config=require(_0x2d8b('0x6'));var jayson=require(_0x2d8b('0x7'));var client=jayson[_0x2d8b('0x8')][_0x2d8b('0x9')]({'port':0x232a});config[_0x2d8b('0xa')]=_[_0x2d8b('0xb')](config[_0x2d8b('0xa')],{'host':_0x2d8b('0xc'),'port':0x18eb});var socket=require(_0x2d8b('0xd'))(new Redis(config[_0x2d8b('0xa')]));require('./mailMessage.socket')[_0x2d8b('0xe')](socket);function respondWithRpcPromise(_0x34dda3,_0x4fd90b,_0x5b7f84){return new BPromise(function(_0x156aa6,_0x40fd15){return client[_0x2d8b('0xf')](_0x34dda3,_0x5b7f84)['then'](function(_0x1f6485){logger[_0x2d8b('0x10')](_0x2d8b('0x11'),_0x4fd90b,_0x2d8b('0x12'));logger[_0x2d8b('0x13')](_0x2d8b('0x14'),_0x4fd90b,_0x2d8b('0x12'),JSON['stringify'](_0x1f6485));if(_0x1f6485['error']){if(_0x1f6485['error']['code']===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x4fd90b,_0x1f6485['error'][_0x2d8b('0x15')]);return _0x40fd15(_0x1f6485[_0x2d8b('0x16')][_0x2d8b('0x15')]);}logger[_0x2d8b('0x16')](_0x2d8b('0x11'),_0x4fd90b,_0x1f6485[_0x2d8b('0x16')][_0x2d8b('0x15')]);return _0x156aa6(_0x1f6485[_0x2d8b('0x16')][_0x2d8b('0x15')]);}else{logger[_0x2d8b('0x10')](_0x2d8b('0x11'),_0x4fd90b,_0x2d8b('0x12'));_0x156aa6(_0x1f6485['result'][_0x2d8b('0x15')]);}})[_0x2d8b('0x17')](function(_0x21fd13){logger[_0x2d8b('0x16')](_0x2d8b('0x11'),_0x4fd90b,_0x21fd13);_0x40fd15(_0x21fd13);});});}exports[_0x2d8b('0x18')]=function(_0x24d5e6){var _0x522411=this;return new Promise(function(_0x2b86ca,_0x518d7b){return db[_0x2d8b('0x19')][_0x2d8b('0x1a')](_0x24d5e6[_0x2d8b('0x1b')],{'raw':_0x24d5e6[_0x2d8b('0x1c')]?_0x24d5e6[_0x2d8b('0x1c')][_0x2d8b('0x1d')]===undefined?!![]:![]:!![]})[_0x2d8b('0x1e')](function(_0x4d6256){logger[_0x2d8b('0x10')](_0x2d8b('0x18'),_0x24d5e6);logger[_0x2d8b('0x13')](_0x2d8b('0x18'),_0x24d5e6,JSON[_0x2d8b('0x1f')](_0x4d6256));_0x2b86ca(_0x4d6256);})[_0x2d8b('0x17')](function(_0x4ff93a){logger[_0x2d8b('0x16')](_0x2d8b('0x18'),_0x4ff93a['message'],_0x24d5e6);_0x518d7b(_0x522411[_0x2d8b('0x16')](0x1f4,_0x4ff93a[_0x2d8b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index c7299ba..b4b795b 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 _0x2e85=['register','length','mailMessage:','./mailMessage.events','save','remove'];(function(_0x128a51,_0x52e0c7){var _0x4d7ebe=function(_0x155216){while(--_0x155216){_0x128a51['push'](_0x128a51['shift']());}};_0x4d7ebe(++_0x52e0c7);}(_0x2e85,0x165));var _0x52e8=function(_0x27c662,_0x2123f5){_0x27c662=_0x27c662-0x0;var _0x41271f=_0x2e85[_0x27c662];return _0x41271f;};'use strict';var MailMessageEvents=require(_0x52e8('0x0'));var events=[_0x52e8('0x1'),_0x52e8('0x2'),'update'];function createListener(_0x4caf72,_0x5253b4){return function(_0x468d68){_0x5253b4['emit'](_0x4caf72,_0x468d68);};}function removeListener(_0x109dcc,_0x4a2a20){return function(){MailMessageEvents['removeListener'](_0x109dcc,_0x4a2a20);};}exports[_0x52e8('0x3')]=function(_0x1713eb){for(var _0x324709=0x0,_0x366d87=events[_0x52e8('0x4')];_0x324709<_0x366d87;_0x324709++){var _0x1c9e1a=events[_0x324709];var _0x3a25d5=createListener(_0x52e8('0x5')+_0x1c9e1a,_0x1713eb);MailMessageEvents['on'](_0x1c9e1a,_0x3a25d5);}}; \ No newline at end of file +var _0xccbe=['remove','update','register','mailMessage:'];(function(_0x36aea6,_0x144f37){var _0x3895dc=function(_0x28a9f0){while(--_0x28a9f0){_0x36aea6['push'](_0x36aea6['shift']());}};_0x3895dc(++_0x144f37);}(_0xccbe,0xa4));var _0xeccb=function(_0xf34109,_0x380779){_0xf34109=_0xf34109-0x0;var _0x570bfc=_0xccbe[_0xf34109];return _0x570bfc;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=['save',_0xeccb('0x0'),_0xeccb('0x1')];function createListener(_0x4d4a0a,_0x46f76a){return function(_0x3ffc79){_0x46f76a['emit'](_0x4d4a0a,_0x3ffc79);};}function removeListener(_0x109350,_0x6d2e64){return function(){MailMessageEvents['removeListener'](_0x109350,_0x6d2e64);};}exports[_0xeccb('0x2')]=function(_0x170b6c){for(var _0x319099=0x0,_0x47b71a=events['length'];_0x319099<_0x47b71a;_0x319099++){var _0x379f09=events[_0x319099];var _0x51596a=createListener(_0xeccb('0x3')+_0x379f09,_0x170b6c);MailMessageEvents['on'](_0x379f09,_0x51596a);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 22911e8..c310883 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 _0x4b5d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','/:id/users','getAgents','post','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x675817,_0x250b83){var _0x332c9e=function(_0x28f649){while(--_0x28f649){_0x675817['push'](_0x675817['shift']());}};_0x332c9e(++_0x250b83);}(_0x4b5d,0x180));var _0xd4b5=function(_0x206338,_0x2d800b){_0x206338=_0x206338-0x0;var _0x2b87f2=_0x4b5d[_0x206338];return _0x2b87f2;};'use strict';var multer=require(_0xd4b5('0x0'));var util=require(_0xd4b5('0x1'));var path=require(_0xd4b5('0x2'));var timeout=require(_0xd4b5('0x3'));var express=require(_0xd4b5('0x4'));var router=express[_0xd4b5('0x5')]();var auth=require(_0xd4b5('0x6'));var interaction=require(_0xd4b5('0x7'));var config=require(_0xd4b5('0x8'));var controller=require(_0xd4b5('0x9'));router[_0xd4b5('0xa')]('/',auth[_0xd4b5('0xb')](),controller[_0xd4b5('0xc')]);router[_0xd4b5('0xa')](_0xd4b5('0xd'),auth[_0xd4b5('0xb')](),controller[_0xd4b5('0xe')]);router['get'](_0xd4b5('0xf'),auth[_0xd4b5('0xb')](),controller[_0xd4b5('0x10')]);router[_0xd4b5('0xa')]('/:id/members',auth['isAuthenticated'](),controller[_0xd4b5('0x11')]);router[_0xd4b5('0xa')](_0xd4b5('0x12'),auth[_0xd4b5('0xb')](),controller['getTeams']);router['get'](_0xd4b5('0x13'),auth[_0xd4b5('0xb')](),controller[_0xd4b5('0x14')]);router[_0xd4b5('0x15')]('/',auth[_0xd4b5('0xb')](),controller['create']);router[_0xd4b5('0x15')](_0xd4b5('0x12'),auth['isAuthenticated'](),controller['addTeams']);router[_0xd4b5('0x15')]('/:id/users',auth[_0xd4b5('0xb')](),controller[_0xd4b5('0x16')]);router[_0xd4b5('0x17')](_0xd4b5('0xf'),auth[_0xd4b5('0xb')](),controller[_0xd4b5('0x18')]);router[_0xd4b5('0x19')](_0xd4b5('0xf'),auth[_0xd4b5('0xb')](),controller[_0xd4b5('0x1a')]);router[_0xd4b5('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xd4b5('0x1b')]);router[_0xd4b5('0x19')](_0xd4b5('0x13'),auth['isAuthenticated'](),controller[_0xd4b5('0x1c')]);module[_0xd4b5('0x1d')]=router; \ No newline at end of file +var _0xc2bd=['/describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc2bd,0x150));var _0xdc2b=function(_0x57bd8f,_0x2d0955){_0x57bd8f=_0x57bd8f-0x0;var _0x463227=_0xc2bd[_0x57bd8f];return _0x463227;};'use strict';var multer=require(_0xdc2b('0x0'));var util=require(_0xdc2b('0x1'));var path=require(_0xdc2b('0x2'));var timeout=require(_0xdc2b('0x3'));var express=require(_0xdc2b('0x4'));var router=express[_0xdc2b('0x5')]();var auth=require(_0xdc2b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdc2b('0x7'));var controller=require(_0xdc2b('0x8'));router[_0xdc2b('0x9')]('/',auth[_0xdc2b('0xa')](),controller[_0xdc2b('0xb')]);router['get'](_0xdc2b('0xc'),auth[_0xdc2b('0xa')](),controller['describe']);router[_0xdc2b('0x9')](_0xdc2b('0xd'),auth[_0xdc2b('0xa')](),controller['show']);router[_0xdc2b('0x9')](_0xdc2b('0xe'),auth[_0xdc2b('0xa')](),controller[_0xdc2b('0xf')]);router[_0xdc2b('0x9')](_0xdc2b('0x10'),auth[_0xdc2b('0xa')](),controller[_0xdc2b('0x11')]);router[_0xdc2b('0x9')](_0xdc2b('0x12'),auth[_0xdc2b('0xa')](),controller['getAgents']);router[_0xdc2b('0x13')]('/',auth[_0xdc2b('0xa')](),controller['create']);router['post'](_0xdc2b('0x10'),auth[_0xdc2b('0xa')](),controller[_0xdc2b('0x14')]);router['post'](_0xdc2b('0x12'),auth['isAuthenticated'](),controller[_0xdc2b('0x15')]);router[_0xdc2b('0x16')](_0xdc2b('0xd'),auth[_0xdc2b('0xa')](),controller[_0xdc2b('0x17')]);router[_0xdc2b('0x18')](_0xdc2b('0xd'),auth[_0xdc2b('0xa')](),controller[_0xdc2b('0x19')]);router[_0xdc2b('0x18')](_0xdc2b('0x10'),auth[_0xdc2b('0xa')](),controller[_0xdc2b('0x1a')]);router[_0xdc2b('0x18')](_0xdc2b('0x12'),auth[_0xdc2b('0xa')](),controller[_0xdc2b('0x1b')]);module[_0xdc2b('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 33392cb..7931a98 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 _0x9df5=['rrmemory','beepall','exports','STRING','INTEGER'];(function(_0x3ef5bb,_0x27e3ac){var _0x59d620=function(_0x46cd45){while(--_0x46cd45){_0x3ef5bb['push'](_0x3ef5bb['shift']());}};_0x59d620(++_0x27e3ac);}(_0x9df5,0x165));var _0x59df=function(_0x18292d,_0x551c5a){_0x18292d=_0x18292d-0x0;var _0x329b69=_0x9df5[_0x18292d];return _0x329b69;};'use strict';var Sequelize=require('sequelize');module[_0x59df('0x0')]={'name':{'type':Sequelize[_0x59df('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x59df('0x1')]},'timeout':{'type':Sequelize[_0x59df('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x59df('0x3'),_0x59df('0x4'),'roundrobin')}}; \ No newline at end of file +var _0x4dcb=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports','STRING'];(function(_0xc813f,_0x25cf26){var _0xb902fd=function(_0x230bf9){while(--_0x230bf9){_0xc813f['push'](_0xc813f['shift']());}};_0xb902fd(++_0x25cf26);}(_0x4dcb,0x186));var _0xb4dc=function(_0x411d62,_0x342efe){_0x411d62=_0x411d62-0x0;var _0x5813ea=_0x4dcb[_0x411d62];return _0x5813ea;};'use strict';var Sequelize=require('sequelize');module[_0xb4dc('0x0')]={'name':{'type':Sequelize[_0xb4dc('0x1')],'unique':_0xb4dc('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb4dc('0x1')]},'timeout':{'type':Sequelize[_0xb4dc('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb4dc('0x4')](_0xb4dc('0x5'),_0xb4dc('0x6'),_0xb4dc('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 53442e9..f1a60fd 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 _0x39d0=['%s/%s','createdAt','getTeams','Team','hasOwnProperty','addTeams','online','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','ids','select','field','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','all','union','compact','value','isEmpty','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','then','get','MailQueues','UserProfileResource','destroy','error','stack','name','send','index','MailQueue','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','limit','sort','where','pick','merge','options','findAll','rows','catch','show','keys','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','update','params','describe','findOne','UserMailQueue','rawAttributes','order','MailQueueId','filter','findAndCountAll','UserId','agent','mailPause','updatedAt'];(function(_0x426d68,_0x2ceedf){var _0x3ca28b=function(_0x1a9083){while(--_0x1a9083){_0x426d68['push'](_0x426d68['shift']());}};_0x3ca28b(++_0x2ceedf);}(_0x39d0,0x144));var _0x039d=function(_0x415382,_0x2ffb0c){_0x415382=_0x415382-0x0;var _0x13050d=_0x39d0[_0x415382];return _0x13050d;};'use strict';var pdf=require(_0x039d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x039d('0x1'));var jsonpatch=require(_0x039d('0x2'));var rp=require(_0x039d('0x3'));var moment=require(_0x039d('0x4'));var BPromise=require(_0x039d('0x5'));var Mustache=require('mustache');var util=require(_0x039d('0x6'));var path=require(_0x039d('0x7'));var sox=require(_0x039d('0x8'));var csv=require(_0x039d('0x9'));var ejs=require(_0x039d('0xa'));var fs=require('fs');var _=require(_0x039d('0xb'));var squel=require(_0x039d('0xc'));var crypto=require(_0x039d('0xd'));var jsforce=require(_0x039d('0xe'));var deskjs=require(_0x039d('0xf'));var toCsv=require(_0x039d('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x039d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x039d('0x11'));var as=require(_0x039d('0x12'));var hardwareService=require(_0x039d('0x13'));var logger=require(_0x039d('0x14'))('api');var utils=require(_0x039d('0x15'));var config=require(_0x039d('0x16'));var licenseUtil=require(_0x039d('0x17'));var db=require('../../mysqldb')['db'];config[_0x039d('0x18')]=_[_0x039d('0x19')](config[_0x039d('0x18')],{'host':_0x039d('0x1a'),'port':0x18eb});var socket=require(_0x039d('0x1b'))(new Redis(config[_0x039d('0x18')]));require(_0x039d('0x1c'))['register'](socket);function respondWithStatusCode(_0x4dc3a4,_0x2fb61c){_0x2fb61c=_0x2fb61c||0xcc;return function(_0x375c60){if(_0x375c60){return _0x4dc3a4[_0x039d('0x1d')](_0x2fb61c);}return _0x4dc3a4[_0x039d('0x1e')](_0x2fb61c)[_0x039d('0x1f')]();};}function respondWithResult(_0x330966,_0x525c0f){_0x525c0f=_0x525c0f||0xc8;return function(_0x1dc31d){if(_0x1dc31d){return _0x330966[_0x039d('0x1e')](_0x525c0f)[_0x039d('0x20')](_0x1dc31d);}};}function respondWithFilteredResult(_0x4dfc0c,_0x5c0506){return function(_0xaedb24){if(_0xaedb24){var _0xb01eb1=_0xaedb24[_0x039d('0x21')],_0x360233=_0x5c0506[_0x039d('0x22')],_0x4fad10=_0x5c0506['offset']+_0x5c0506['limit'],_0x4ae129;if(_0x4fad10>=_0xb01eb1){_0x4fad10=_0xb01eb1;_0x4ae129=0xc8;}else{_0x4ae129=0xce;}_0x4dfc0c[_0x039d('0x1e')](_0x4ae129);return _0x4dfc0c['set'](_0x039d('0x23'),_0x360233+'-'+_0x4fad10+'/'+_0xb01eb1)[_0x039d('0x20')](_0xaedb24);}return null;};}function patchUpdates(_0x54742c){return function(_0x2e33e1){try{jsonpatch[_0x039d('0x24')](_0x2e33e1,_0x54742c,!![]);}catch(_0x482be8){return BPromise[_0x039d('0x25')](_0x482be8);}return _0x2e33e1[_0x039d('0x26')]();};}function saveUpdates(_0xd5c776,_0x460f4b){return function(_0x2d4221){if(_0x2d4221){return _0x2d4221['update'](_0xd5c776)[_0x039d('0x27')](function(_0x7e230f){return _0x7e230f;});}return null;};}function removeEntity(_0x15b103,_0x4d3983){return function(_0x7fc307){if(_0x7fc307){return _0x7fc307['destroy']()[_0x039d('0x27')](function(){var _0x109b2b=_0x7fc307[_0x039d('0x28')]({'plain':!![]});var _0x4fe5dd=_0x039d('0x29');return db[_0x039d('0x2a')][_0x039d('0x2b')]({'where':{'type':_0x4fe5dd,'resourceId':_0x109b2b['id']}})[_0x039d('0x27')](function(){return _0x7fc307;});})[_0x039d('0x27')](function(){_0x15b103[_0x039d('0x1e')](0xcc)[_0x039d('0x1f')]();});}};}function handleEntityNotFound(_0x170e34,_0xc6b469){return function(_0x9da588){if(!_0x9da588){_0x170e34[_0x039d('0x1d')](0x194);}return _0x9da588;};}function handleError(_0x38ff1e,_0x3d3a40){_0x3d3a40=_0x3d3a40||0x1f4;return function(_0x28b594){logger[_0x039d('0x2c')](_0x28b594[_0x039d('0x2d')]);if(_0x28b594[_0x039d('0x2e')]){delete _0x28b594[_0x039d('0x2e')];}_0x38ff1e[_0x039d('0x1e')](_0x3d3a40)[_0x039d('0x2f')](_0x28b594);};}exports[_0x039d('0x30')]=function(_0xf074d8,_0xf32a01){var _0x2eef2b={},_0x1babe4={},_0x15e999={'count':0x0,'rows':[]};var _0x4e293d=_['map'](db[_0x039d('0x31')]['rawAttributes'],function(_0x54fdf1){return{'name':_0x54fdf1[_0x039d('0x32')],'type':_0x54fdf1[_0x039d('0x33')][_0x039d('0x34')]};});_0x1babe4[_0x039d('0x35')]=_[_0x039d('0x36')](_0x4e293d,_0x039d('0x2e'));_0x1babe4['query']=_['keys'](_0xf074d8[_0x039d('0x37')]);_0x1babe4[_0x039d('0x38')]=_['intersection'](_0x1babe4[_0x039d('0x35')],_0x1babe4[_0x039d('0x37')]);_0x2eef2b['attributes']=_[_0x039d('0x39')](_0x1babe4[_0x039d('0x35')],qs[_0x039d('0x3a')](_0xf074d8[_0x039d('0x37')]['fields']));_0x2eef2b['attributes']=_0x2eef2b[_0x039d('0x3b')][_0x039d('0x3c')]?_0x2eef2b[_0x039d('0x3b')]:_0x1babe4[_0x039d('0x35')];if(!_0xf074d8[_0x039d('0x37')]['hasOwnProperty'](_0x039d('0x3d'))){_0x2eef2b[_0x039d('0x3e')]=qs[_0x039d('0x3e')](_0xf074d8[_0x039d('0x37')][_0x039d('0x3e')]);_0x2eef2b['offset']=qs[_0x039d('0x22')](_0xf074d8[_0x039d('0x37')][_0x039d('0x22')]);}_0x2eef2b['order']=qs[_0x039d('0x3f')](_0xf074d8[_0x039d('0x37')][_0x039d('0x3f')]);_0x2eef2b[_0x039d('0x40')]=qs['filters'](_[_0x039d('0x41')](_0xf074d8[_0x039d('0x37')],_0x1babe4[_0x039d('0x38')]),_0x4e293d);if(_0xf074d8[_0x039d('0x37')]['filter']){_0x2eef2b['where']=_[_0x039d('0x42')](_0x2eef2b[_0x039d('0x40')],{'$or':_[_0x039d('0x36')](_0x4e293d,function(_0x971481){if(_0x971481[_0x039d('0x33')]!=='VIRTUAL'){var _0x3a4d6c={};_0x3a4d6c[_0x971481['name']]={'$like':'%'+_0xf074d8[_0x039d('0x37')]['filter']+'%'};return _0x3a4d6c;}})});}_0x2eef2b=_[_0x039d('0x42')]({},_0x2eef2b,_0xf074d8[_0x039d('0x43')]);var _0x269072={'where':_0x2eef2b[_0x039d('0x40')]};return db['MailQueue'][_0x039d('0x21')](_0x269072)[_0x039d('0x27')](function(_0x48954a){_0x15e999[_0x039d('0x21')]=_0x48954a;if(_0xf074d8[_0x039d('0x37')]['includeAll']){_0x2eef2b['include']=[{'all':!![]}];}return db[_0x039d('0x31')][_0x039d('0x44')](_0x2eef2b);})['then'](function(_0xdba4df){_0x15e999[_0x039d('0x45')]=_0xdba4df;return _0x15e999;})[_0x039d('0x27')](respondWithFilteredResult(_0xf32a01,_0x2eef2b))[_0x039d('0x46')](handleError(_0xf32a01,null));};exports[_0x039d('0x47')]=function(_0x35da4d,_0x18f09e){var _0x470b7c={'raw':!![],'where':{'id':_0x35da4d['params']['id']}},_0x56bd16={};_0x56bd16['model']=_[_0x039d('0x48')](db[_0x039d('0x31')]['rawAttributes']);_0x56bd16[_0x039d('0x37')]=_[_0x039d('0x48')](_0x35da4d[_0x039d('0x37')]);_0x56bd16[_0x039d('0x38')]=_[_0x039d('0x39')](_0x56bd16['model'],_0x56bd16[_0x039d('0x37')]);_0x470b7c[_0x039d('0x3b')]=_[_0x039d('0x39')](_0x56bd16[_0x039d('0x35')],qs['fields'](_0x35da4d[_0x039d('0x37')][_0x039d('0x3a')]));_0x470b7c['attributes']=_0x470b7c['attributes']['length']?_0x470b7c[_0x039d('0x3b')]:_0x56bd16['model'];if(_0x35da4d[_0x039d('0x37')][_0x039d('0x49')]){_0x470b7c[_0x039d('0x4a')]=[{'all':!![]}];}_0x470b7c=_[_0x039d('0x42')]({},_0x470b7c,_0x35da4d['options']);return db[_0x039d('0x31')][_0x039d('0x4b')](_0x470b7c)[_0x039d('0x27')](handleEntityNotFound(_0x18f09e,null))['then'](respondWithResult(_0x18f09e,null))[_0x039d('0x46')](handleError(_0x18f09e,null));};exports[_0x039d('0x4c')]=function(_0xcfb6bc,_0x32e9fa){return db[_0x039d('0x31')][_0x039d('0x4c')](_0xcfb6bc[_0x039d('0x4d')],{})[_0x039d('0x27')](function(_0x2dfb00){var _0x5cdc60=_0xcfb6bc[_0x039d('0x4e')][_0x039d('0x28')]({'plain':!![]});if(!_0x5cdc60)throw new Error(_0x039d('0x4f'));if(_0x5cdc60[_0x039d('0x50')]===_0x039d('0x4e')){var _0x43c3f5=_0x2dfb00[_0x039d('0x28')]({'plain':!![]});var _0x2eab5d=_0x039d('0x29');return db['UserProfileSection'][_0x039d('0x4b')]({'where':{'name':_0x2eab5d,'userProfileId':_0x5cdc60['userProfileId']},'raw':!![]})[_0x039d('0x27')](function(_0x4b41c6){if(_0x4b41c6&&_0x4b41c6[_0x039d('0x51')]===0x0){return db[_0x039d('0x2a')]['create']({'name':_0x43c3f5['name'],'resourceId':_0x43c3f5['id'],'type':_0x4b41c6[_0x039d('0x2e')],'sectionId':_0x4b41c6['id']},{})[_0x039d('0x27')](function(){return _0x2dfb00;});}else{return _0x2dfb00;}})[_0x039d('0x46')](function(_0x74f510){logger[_0x039d('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x74f510);throw _0x74f510;});}return _0x2dfb00;})['then'](respondWithResult(_0x32e9fa,0xc9))['catch'](handleError(_0x32e9fa,null));};exports[_0x039d('0x52')]=function(_0x56834c,_0x45cd5b){if(_0x56834c['body']['id']){delete _0x56834c[_0x039d('0x4d')]['id'];}return db[_0x039d('0x31')]['find']({'where':{'id':_0x56834c[_0x039d('0x53')]['id']}})[_0x039d('0x27')](handleEntityNotFound(_0x45cd5b,null))['then'](saveUpdates(_0x56834c[_0x039d('0x4d')],null))[_0x039d('0x27')](respondWithResult(_0x45cd5b,null))[_0x039d('0x46')](handleError(_0x45cd5b,null));};exports[_0x039d('0x2b')]=function(_0x21eaea,_0x34db4d){return db[_0x039d('0x31')][_0x039d('0x4b')]({'where':{'id':_0x21eaea[_0x039d('0x53')]['id']}})[_0x039d('0x27')](handleEntityNotFound(_0x34db4d,null))[_0x039d('0x27')](removeEntity(_0x34db4d,null))[_0x039d('0x46')](handleError(_0x34db4d,null));};exports['describe']=function(_0x2998c9,_0x34f6c7){return db[_0x039d('0x31')][_0x039d('0x54')]()[_0x039d('0x27')](respondWithResult(_0x34f6c7,null))['catch'](handleError(_0x34f6c7,null));};exports['getMembers']=function(_0x4774e9,_0x552bd1,_0x4f4430){var _0x42bbf6={'raw':!![],'where':{}},_0x2d49c4={},_0x5a9223;return db[_0x039d('0x31')][_0x039d('0x55')]({'where':{'id':_0x4774e9['params']['id']}})[_0x039d('0x27')](handleEntityNotFound(_0x552bd1,null))[_0x039d('0x27')](function(_0x4139d5){if(_0x4139d5){_0x5a9223=_0x4139d5['get']({'plain':!![]});_0x2d49c4[_0x039d('0x35')]=_[_0x039d('0x48')](db[_0x039d('0x56')][_0x039d('0x57')]);_0x2d49c4['query']=_['keys'](_0x4774e9[_0x039d('0x37')]);_0x2d49c4[_0x039d('0x38')]=_[_0x039d('0x39')](_0x2d49c4[_0x039d('0x35')],_0x2d49c4[_0x039d('0x37')]);_0x42bbf6[_0x039d('0x3b')]=_['intersection'](_0x2d49c4[_0x039d('0x35')],qs[_0x039d('0x3a')](_0x4774e9[_0x039d('0x37')]['fields']));_0x42bbf6[_0x039d('0x3b')]=_0x42bbf6[_0x039d('0x3b')][_0x039d('0x3c')]?_0x42bbf6[_0x039d('0x3b')]:_0x2d49c4[_0x039d('0x35')];if(!_0x4774e9[_0x039d('0x37')]['hasOwnProperty'](_0x039d('0x3d'))){_0x42bbf6['limit']=qs['limit'](_0x4774e9[_0x039d('0x37')]['limit']);_0x42bbf6[_0x039d('0x22')]=qs[_0x039d('0x22')](_0x4774e9['query'][_0x039d('0x22')]);}_0x42bbf6[_0x039d('0x58')]=qs['sort'](_0x4774e9[_0x039d('0x37')]['sort']);_0x42bbf6[_0x039d('0x40')]=qs[_0x039d('0x38')](_[_0x039d('0x41')](_0x4774e9[_0x039d('0x37')],_0x2d49c4[_0x039d('0x38')]));_0x42bbf6[_0x039d('0x40')][_0x039d('0x59')]=_0x4139d5['id'];if(_0x4774e9[_0x039d('0x37')][_0x039d('0x5a')]){_0x42bbf6[_0x039d('0x40')]=_['merge'](_0x42bbf6[_0x039d('0x40')],{'$or':_[_0x039d('0x36')](_0x42bbf6['attributes'],function(_0x726115){var _0x159c8b={};_0x159c8b[_0x726115]={'$like':'%'+_0x4774e9[_0x039d('0x37')][_0x039d('0x5a')]+'%'};return _0x159c8b;})});}_0x42bbf6=_[_0x039d('0x42')]({},_0x42bbf6,_0x4774e9[_0x039d('0x43')]);return db[_0x039d('0x56')][_0x039d('0x44')](_0x42bbf6);}})[_0x039d('0x27')](function(_0x44b76c){if(_0x44b76c){return db['User'][_0x039d('0x5b')]({'where':{'id':_[_0x039d('0x36')](_0x44b76c,_0x039d('0x5c')),'role':_0x039d('0x5d')},'attributes':['id',_0x039d('0x2e'),_0x039d('0x5e'),_0x039d('0x5f'),'createdAt']});}})[_0x039d('0x27')](function(_0x54895e){if(_0x54895e){return{'count':_0x54895e[_0x039d('0x21')],'rows':_['map'](_0x54895e['rows'],function(_0x46c92e){return{'membername':_0x46c92e[_0x039d('0x2e')],'UserId':_0x46c92e['id'],'queue_name':_0x5a9223[_0x039d('0x2e')],'MailQueueId':_0x5a9223['id'],'interface':util['format'](_0x039d('0x60'),'SIP',_0x46c92e['name']),'penalty':0x0,'paused':_0x46c92e[_0x039d('0x5e')],'createdAt':_0x46c92e[_0x039d('0x61')],'updatedAt':_0x46c92e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x039d('0x27')](respondWithFilteredResult(_0x552bd1,_0x42bbf6))['catch'](handleError(_0x552bd1,null));};exports[_0x039d('0x62')]=function(_0xcb22dc,_0x5e24ec,_0x2929ad){var _0x7ca845={};var _0x4a7718={};var _0x357202;var _0x20fad2;return db['MailQueue'][_0x039d('0x55')]({'where':{'id':_0xcb22dc[_0x039d('0x53')]['id']}})[_0x039d('0x27')](handleEntityNotFound(_0x5e24ec,null))['then'](function(_0x5a462e){if(_0x5a462e){_0x357202=_0x5a462e;_0x4a7718[_0x039d('0x35')]=_[_0x039d('0x48')](db[_0x039d('0x63')][_0x039d('0x57')]);_0x4a7718[_0x039d('0x37')]=_[_0x039d('0x48')](_0xcb22dc[_0x039d('0x37')]);_0x4a7718[_0x039d('0x38')]=_[_0x039d('0x39')](_0x4a7718[_0x039d('0x35')],_0x4a7718['query']);_0x7ca845[_0x039d('0x3b')]=_[_0x039d('0x39')](_0x4a7718['model'],qs['fields'](_0xcb22dc[_0x039d('0x37')][_0x039d('0x3a')]));_0x7ca845[_0x039d('0x3b')]=_0x7ca845[_0x039d('0x3b')][_0x039d('0x3c')]?_0x7ca845[_0x039d('0x3b')]:_0x4a7718[_0x039d('0x35')];_0x7ca845[_0x039d('0x58')]=qs[_0x039d('0x3f')](_0xcb22dc[_0x039d('0x37')][_0x039d('0x3f')]);_0x7ca845[_0x039d('0x40')]=qs[_0x039d('0x38')](_['pick'](_0xcb22dc['query'],_0x4a7718[_0x039d('0x38')]));if(_0xcb22dc[_0x039d('0x37')]['filter']){_0x7ca845[_0x039d('0x40')]=_['merge'](_0x7ca845[_0x039d('0x40')],{'$or':_[_0x039d('0x36')](_0x7ca845[_0x039d('0x3b')],function(_0x5b52a2){var _0x4bbefe={};_0x4bbefe[_0x5b52a2]={'$like':'%'+_0xcb22dc[_0x039d('0x37')]['filter']+'%'};return _0x4bbefe;})});}_0x7ca845=_[_0x039d('0x42')]({},_0x7ca845,_0xcb22dc['options']);return _0x357202[_0x039d('0x62')](_0x7ca845);}})[_0x039d('0x27')](function(_0x4a7bc2){if(_0x4a7bc2){_0x20fad2=_0x4a7bc2[_0x039d('0x3c')];if(!_0xcb22dc[_0x039d('0x37')][_0x039d('0x64')](_0x039d('0x3d'))){_0x7ca845['limit']=qs[_0x039d('0x3e')](_0xcb22dc[_0x039d('0x37')][_0x039d('0x3e')]);_0x7ca845[_0x039d('0x22')]=qs[_0x039d('0x22')](_0xcb22dc[_0x039d('0x37')][_0x039d('0x22')]);}return _0x357202[_0x039d('0x62')](_0x7ca845);}})[_0x039d('0x27')](function(_0x25fb12){if(_0x25fb12){return _0x25fb12?{'count':_0x20fad2,'rows':_0x25fb12}:null;}})[_0x039d('0x27')](respondWithResult(_0x5e24ec,null))['catch'](handleError(_0x5e24ec,null));};exports[_0x039d('0x65')]=function(_0x468b8b,_0x6dbf3a,_0x288c52){var _0x8e2a96=_0x468b8b[_0x039d('0x4d')]['ids'];return db[_0x039d('0x63')]['findAll']({'where':{'id':_0x8e2a96},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x039d('0x2e'),_0x039d('0x66'),_0x039d('0x67'),_0x039d('0x68')],'raw':!![]}]})[_0x039d('0x27')](function(_0x2aed6e){if(_0x2aed6e){var _0x45c55f=_['flatMap'](_0x2aed6e,function(_0x1b7f3a){var _0x1f97ba=_0x1b7f3a['get']({'plain':!![]});return _0x1f97ba[_0x039d('0x69')];});return db[_0x039d('0x31')][_0x039d('0x4b')]({'where':{'id':_0x468b8b['params']['id']}})['then'](function(_0x152a91){return db[_0x039d('0x6a')][_0x039d('0x6b')](function(_0x513f9b){return _0x152a91[_0x039d('0x65')](_0x8e2a96,{'transaction':_0x513f9b})[_0x039d('0x27')](function(){return BPromise[_0x039d('0x6c')](_0x45c55f,function(_0x4e0f4d){return db[_0x039d('0x56')][_0x039d('0x6d')]({'where':{'UserId':_0x4e0f4d['id'],'MailQueueId':_0x468b8b[_0x039d('0x53')]['id']},'transaction':_0x513f9b});});})[_0x039d('0x27')](function(){_0x45c55f[_0x039d('0x6e')](function(_0x300f62){socket[_0x039d('0x6f')](_0x039d('0x70'),{'UserId':_0x300f62['id'],'MailQueueId':_0x152a91['id']});});});});});}})[_0x039d('0x27')](respondWithStatusCode(_0x6dbf3a,null))[_0x039d('0x46')](handleError(_0x6dbf3a,null));};exports[_0x039d('0x71')]=function(_0x43e742,_0x38d067,_0x2d7e97){return db[_0x039d('0x63')][_0x039d('0x44')]({'where':{'id':_0x43e742[_0x039d('0x37')][_0x039d('0x72')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x039d('0x69'),'attributes':['id'],'raw':!![]}]})[_0x039d('0x27')](handleEntityNotFound(_0x38d067,null))[_0x039d('0x27')](function(_0x56939f){var _0x21c508=_[_0x039d('0x36')](_0x56939f,'id');var _0xcfcf5b=[];var _0x52666f=[];var _0x107679=squel[_0x039d('0x73')]();_0x107679[_0x039d('0x74')]('tq.TeamId')[_0x039d('0x75')](_0x039d('0x76'),'tq')['join'](_0x039d('0x77'),'ut',_0x039d('0x78'))[_0x039d('0x40')](_0x039d('0x79'),_0x43e742[_0x039d('0x53')]['id']);for(var _0xa3095b=0x0;_0xa3095b<_0x56939f[_0x039d('0x3c')];_0xa3095b+=0x1){let _0x55f43d=_0x56939f[_0xa3095b];for(var _0x22d415=0x0;_0x22d415<_0x55f43d['Agents'][_0x039d('0x3c')];_0x22d415+=0x1){let _0x330ea2=_0x55f43d['Agents'][_0x22d415];var _0xb7f1c2=_0x107679['clone']();_0xb7f1c2[_0x039d('0x40')](_0x039d('0x7a'),_0x330ea2['id']);_0x52666f[_0x039d('0x7b')](db['sequelize'][_0x039d('0x37')](_0xb7f1c2[_0x039d('0x7c')](),{'type':db['sequelize'][_0x039d('0x7d')]['SELECT']})[_0x039d('0x27')](function(_0x280477){if(_0x280477[_0x039d('0x3c')]===0x1){return _0x330ea2['id'];}else{var _0xedb59a=_['every'](_[_0x039d('0x36')](_0x280477,_0x039d('0x7e')),function(_0xcfc98){return _[_0x039d('0x7f')](_0x21c508,_0xcfc98);});if(_0xedb59a){return _0x330ea2['id'];}}}));}}return BPromise[_0x039d('0x80')](_0x52666f)[_0x039d('0x27')](function(_0x4e7544){_0xcfcf5b=_(_0xcfcf5b)[_0x039d('0x81')](_0x4e7544)[_0x039d('0x82')]()[_0x039d('0x83')]();return db[_0x039d('0x31')][_0x039d('0x4b')]({'where':{'id':_0x43e742[_0x039d('0x53')]['id']}})[_0x039d('0x27')](function(_0x82281e){return db[_0x039d('0x6a')][_0x039d('0x6b')](function(_0x183d13){return _0x82281e[_0x039d('0x71')](_0x43e742[_0x039d('0x37')][_0x039d('0x72')],{'transaction':_0x183d13})[_0x039d('0x27')](function(){if(!_[_0x039d('0x84')](_0xcfcf5b)){return _0x82281e['removeAgents'](_0xcfcf5b,{'transaction':_0x183d13});}})[_0x039d('0x27')](function(){_0xcfcf5b['forEach'](function(_0x1e4942){socket[_0x039d('0x6f')](_0x039d('0x85'),{'UserId':_0x1e4942,'MailQueueId':_0x82281e['id']});});});});});});})[_0x039d('0x27')](respondWithStatusCode(_0x38d067,null))[_0x039d('0x46')](handleError(_0x38d067,null));};exports[_0x039d('0x86')]=function(_0x5f2c68,_0x1debc3,_0x3208ad){return db[_0x039d('0x31')][_0x039d('0x4b')]({'where':{'id':_0x5f2c68[_0x039d('0x53')]['id']}})[_0x039d('0x27')](handleEntityNotFound(_0x1debc3,null))[_0x039d('0x27')](function(_0x1afcb9){if(_0x1afcb9){return _0x1afcb9[_0x039d('0x86')](_0x5f2c68[_0x039d('0x4d')][_0x039d('0x72')],_[_0x039d('0x87')](_0x5f2c68['body'],[_0x039d('0x72'),'id'])||{})[_0x039d('0x88')](function(_0x527b91){for(var _0x3f8cc3=0x0;_0x3f8cc3<_0x5f2c68['body']['ids'][_0x039d('0x3c')];_0x3f8cc3+=0x1){socket[_0x039d('0x6f')](_0x039d('0x70'),{'UserId':_0x5f2c68[_0x039d('0x4d')][_0x039d('0x72')][_0x3f8cc3],'MailQueueId':_0x5f2c68[_0x039d('0x53')]['id']});}return _0x527b91;});}})[_0x039d('0x27')](respondWithResult(_0x1debc3,null))[_0x039d('0x46')](handleError(_0x1debc3,null));};exports[_0x039d('0x89')]=function(_0x11c6ff,_0x4888a2,_0x3dc2d5){return db[_0x039d('0x31')][_0x039d('0x4b')]({'where':{'id':_0x11c6ff[_0x039d('0x53')]['id']}})[_0x039d('0x27')](handleEntityNotFound(_0x4888a2,null))[_0x039d('0x27')](function(_0x401b43){if(_0x401b43){return _0x401b43[_0x039d('0x89')](_0x11c6ff[_0x039d('0x37')][_0x039d('0x72')])[_0x039d('0x27')](function(){if(_[_0x039d('0x8a')](_0x11c6ff[_0x039d('0x37')][_0x039d('0x72')])){for(var _0x1adebe=0x0;_0x1adebe<_0x11c6ff[_0x039d('0x37')]['ids']['length'];_0x1adebe+=0x1){socket[_0x039d('0x6f')](_0x039d('0x85'),{'UserId':Number(_0x11c6ff[_0x039d('0x37')][_0x039d('0x72')][_0x1adebe]),'MailQueueId':Number(_0x11c6ff[_0x039d('0x53')]['id'])});}}else{socket[_0x039d('0x6f')](_0x039d('0x85'),{'UserId':Number(_0x11c6ff[_0x039d('0x37')][_0x039d('0x72')]),'MailQueueId':Number(_0x11c6ff[_0x039d('0x53')]['id'])});}});}})[_0x039d('0x27')](respondWithStatusCode(_0x4888a2,null))[_0x039d('0x46')](handleError(_0x4888a2,null));};exports[_0x039d('0x8b')]=function(_0x1f2266,_0x225506,_0xd379b7){var _0x7aa0a9={};var _0x270846={};var _0x500891;var _0xa95456;return db[_0x039d('0x31')]['findOne']({'where':{'id':_0x1f2266[_0x039d('0x53')]['id']}})['then'](handleEntityNotFound(_0x225506,null))[_0x039d('0x27')](function(_0x43a8a0){if(_0x43a8a0){_0x500891=_0x43a8a0;_0x270846[_0x039d('0x35')]=_[_0x039d('0x48')](db['User']['rawAttributes']);_0x270846[_0x039d('0x37')]=_[_0x039d('0x48')](_0x1f2266['query']);_0x270846[_0x039d('0x38')]=_[_0x039d('0x39')](_0x270846[_0x039d('0x35')],_0x270846[_0x039d('0x37')]);_0x7aa0a9[_0x039d('0x3b')]=_[_0x039d('0x39')](_0x270846['model'],qs[_0x039d('0x3a')](_0x1f2266[_0x039d('0x37')][_0x039d('0x3a')]));_0x7aa0a9[_0x039d('0x3b')]=_0x7aa0a9[_0x039d('0x3b')][_0x039d('0x3c')]?_0x7aa0a9[_0x039d('0x3b')]:_0x270846['model'];_0x7aa0a9['order']=qs[_0x039d('0x3f')](_0x1f2266[_0x039d('0x37')][_0x039d('0x3f')]);_0x7aa0a9['where']=qs[_0x039d('0x38')](_[_0x039d('0x41')](_0x1f2266[_0x039d('0x37')],_0x270846[_0x039d('0x38')]));if(_0x1f2266[_0x039d('0x37')][_0x039d('0x5a')]){_0x7aa0a9['where']=_[_0x039d('0x42')](_0x7aa0a9['where'],{'$or':_['map'](_0x7aa0a9['attributes'],function(_0x13fed4){var _0x3ce269={};_0x3ce269[_0x13fed4]={'$like':'%'+_0x1f2266[_0x039d('0x37')]['filter']+'%'};return _0x3ce269;})});}_0x7aa0a9=_[_0x039d('0x42')]({},_0x7aa0a9,_0x1f2266[_0x039d('0x43')]);return _0x500891[_0x039d('0x8b')](_0x7aa0a9);}})['then'](function(_0x5321ec){if(_0x5321ec){_0xa95456=_0x5321ec[_0x039d('0x3c')];if(!_0x1f2266[_0x039d('0x37')][_0x039d('0x64')](_0x039d('0x3d'))){_0x7aa0a9[_0x039d('0x3e')]=qs[_0x039d('0x3e')](_0x1f2266[_0x039d('0x37')][_0x039d('0x3e')]);_0x7aa0a9[_0x039d('0x22')]=qs[_0x039d('0x22')](_0x1f2266[_0x039d('0x37')][_0x039d('0x22')]);}return _0x500891['getAgents'](_0x7aa0a9);}})[_0x039d('0x27')](function(_0x5510a6){if(_0x5510a6){return _0x5510a6?{'count':_0xa95456,'rows':_0x5510a6}:null;}})[_0x039d('0x27')](respondWithResult(_0x225506,null))['catch'](handleError(_0x225506,null));}; \ No newline at end of file +var _0xf69c=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserMailQueue','nolimit','MailQueueId','filter','User','findAndCountAll','UserId','agent','mailPause','updatedAt','rows','%s/%s','SIP','createdAt','getTeams','Team','addTeams','Agents','online','voicePause','interface','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','ids','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','TeamId','includes','all','union','compact','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','MailQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','create','body','user','get','role','userProfileId'];(function(_0x25f5f8,_0x733858){var _0x4beffa=function(_0x5f1ff0){while(--_0x5f1ff0){_0x25f5f8['push'](_0x25f5f8['shift']());}};_0x4beffa(++_0x733858);}(_0xf69c,0x1e2));var _0xcf69=function(_0x190dbd,_0x24a507){_0x190dbd=_0x190dbd-0x0;var _0x868d27=_0xf69c[_0x190dbd];return _0x868d27;};'use strict';var pdf=require(_0xcf69('0x0'));var emlformat=require(_0xcf69('0x1'));var rimraf=require(_0xcf69('0x2'));var zipdir=require(_0xcf69('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcf69('0x4'));var moment=require(_0xcf69('0x5'));var BPromise=require(_0xcf69('0x6'));var Mustache=require('mustache');var util=require(_0xcf69('0x7'));var path=require(_0xcf69('0x8'));var sox=require(_0xcf69('0x9'));var csv=require(_0xcf69('0xa'));var ejs=require(_0xcf69('0xb'));var fs=require('fs');var _=require(_0xcf69('0xc'));var squel=require(_0xcf69('0xd'));var crypto=require('crypto');var jsforce=require(_0xcf69('0xe'));var deskjs=require(_0xcf69('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcf69('0x10'));var Papa=require(_0xcf69('0x11'));var Redis=require(_0xcf69('0x12'));var authService=require(_0xcf69('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xcf69('0x14'));var hardwareService=require(_0xcf69('0x15'));var logger=require(_0xcf69('0x16'))('api');var utils=require(_0xcf69('0x17'));var config=require(_0xcf69('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xcf69('0x19'))['db'];config[_0xcf69('0x1a')]=_[_0xcf69('0x1b')](config[_0xcf69('0x1a')],{'host':_0xcf69('0x1c'),'port':0x18eb});var socket=require(_0xcf69('0x1d'))(new Redis(config[_0xcf69('0x1a')]));require(_0xcf69('0x1e'))['register'](socket);function respondWithStatusCode(_0x32d71f,_0x513478){_0x513478=_0x513478||0xcc;return function(_0x3a7706){if(_0x3a7706){return _0x32d71f['sendStatus'](_0x513478);}return _0x32d71f[_0xcf69('0x1f')](_0x513478)[_0xcf69('0x20')]();};}function respondWithResult(_0x5e01be,_0x512a9b){_0x512a9b=_0x512a9b||0xc8;return function(_0x10c389){if(_0x10c389){return _0x5e01be['status'](_0x512a9b)[_0xcf69('0x21')](_0x10c389);}};}function respondWithFilteredResult(_0x561ce4,_0x2db0d5){return function(_0x50b557){if(_0x50b557){var _0x3feb0a=_0x50b557[_0xcf69('0x22')],_0x5ea276=_0x2db0d5['offset'],_0x24b972=_0x2db0d5[_0xcf69('0x23')]+_0x2db0d5[_0xcf69('0x24')],_0x344238;if(_0x24b972>=_0x3feb0a){_0x24b972=_0x3feb0a;_0x344238=0xc8;}else{_0x344238=0xce;}_0x561ce4[_0xcf69('0x1f')](_0x344238);return _0x561ce4[_0xcf69('0x25')](_0xcf69('0x26'),_0x5ea276+'-'+_0x24b972+'/'+_0x3feb0a)[_0xcf69('0x21')](_0x50b557);}return null;};}function patchUpdates(_0x3eafa9){return function(_0x4a7409){try{jsonpatch[_0xcf69('0x27')](_0x4a7409,_0x3eafa9,!![]);}catch(_0x1c8816){return BPromise[_0xcf69('0x28')](_0x1c8816);}return _0x4a7409[_0xcf69('0x29')]();};}function saveUpdates(_0xa2031d,_0x4cd8d3){return function(_0x1d2a5c){if(_0x1d2a5c){return _0x1d2a5c['update'](_0xa2031d)[_0xcf69('0x2a')](function(_0xe28ca){return _0xe28ca;});}return null;};}function removeEntity(_0x48a1be,_0x213889){return function(_0x4c9771){if(_0x4c9771){return _0x4c9771[_0xcf69('0x2b')]()[_0xcf69('0x2a')](function(){var _0x597275=_0x4c9771['get']({'plain':!![]});var _0x28e837=_0xcf69('0x2c');return db[_0xcf69('0x2d')][_0xcf69('0x2b')]({'where':{'type':_0x28e837,'resourceId':_0x597275['id']}})['then'](function(){return _0x4c9771;});})[_0xcf69('0x2a')](function(){_0x48a1be[_0xcf69('0x1f')](0xcc)[_0xcf69('0x20')]();});}};}function handleEntityNotFound(_0x2c97be,_0x37d4b4){return function(_0x5e2374){if(!_0x5e2374){_0x2c97be[_0xcf69('0x2e')](0x194);}return _0x5e2374;};}function handleError(_0x1e7e77,_0x10862e){_0x10862e=_0x10862e||0x1f4;return function(_0x332afd){logger[_0xcf69('0x2f')](_0x332afd[_0xcf69('0x30')]);if(_0x332afd[_0xcf69('0x31')]){delete _0x332afd[_0xcf69('0x31')];}_0x1e7e77['status'](_0x10862e)[_0xcf69('0x32')](_0x332afd);};}exports[_0xcf69('0x33')]=function(_0x3562c1,_0x1991c5){var _0x3a423b={},_0x270b63={},_0x2fa40e={'count':0x0,'rows':[]};var _0x393d7e=_[_0xcf69('0x34')](db[_0xcf69('0x35')][_0xcf69('0x36')],function(_0x68b465){return{'name':_0x68b465[_0xcf69('0x37')],'type':_0x68b465['type']['key']};});_0x270b63[_0xcf69('0x38')]=_[_0xcf69('0x34')](_0x393d7e,_0xcf69('0x31'));_0x270b63[_0xcf69('0x39')]=_[_0xcf69('0x3a')](_0x3562c1[_0xcf69('0x39')]);_0x270b63[_0xcf69('0x3b')]=_[_0xcf69('0x3c')](_0x270b63[_0xcf69('0x38')],_0x270b63[_0xcf69('0x39')]);_0x3a423b[_0xcf69('0x3d')]=_[_0xcf69('0x3c')](_0x270b63['model'],qs[_0xcf69('0x3e')](_0x3562c1[_0xcf69('0x39')][_0xcf69('0x3e')]));_0x3a423b['attributes']=_0x3a423b[_0xcf69('0x3d')]['length']?_0x3a423b[_0xcf69('0x3d')]:_0x270b63['model'];if(!_0x3562c1[_0xcf69('0x39')][_0xcf69('0x3f')]('nolimit')){_0x3a423b['limit']=qs['limit'](_0x3562c1[_0xcf69('0x39')][_0xcf69('0x24')]);_0x3a423b[_0xcf69('0x23')]=qs['offset'](_0x3562c1[_0xcf69('0x39')][_0xcf69('0x23')]);}_0x3a423b[_0xcf69('0x40')]=qs[_0xcf69('0x41')](_0x3562c1[_0xcf69('0x39')][_0xcf69('0x41')]);_0x3a423b[_0xcf69('0x42')]=qs[_0xcf69('0x3b')](_[_0xcf69('0x43')](_0x3562c1[_0xcf69('0x39')],_0x270b63[_0xcf69('0x3b')]),_0x393d7e);if(_0x3562c1[_0xcf69('0x39')]['filter']){_0x3a423b[_0xcf69('0x42')]=_[_0xcf69('0x44')](_0x3a423b['where'],{'$or':_[_0xcf69('0x34')](_0x393d7e,function(_0x36aae9){if(_0x36aae9[_0xcf69('0x45')]!==_0xcf69('0x46')){var _0x3cb502={};_0x3cb502[_0x36aae9[_0xcf69('0x31')]]={'$like':'%'+_0x3562c1[_0xcf69('0x39')]['filter']+'%'};return _0x3cb502;}})});}_0x3a423b=_[_0xcf69('0x44')]({},_0x3a423b,_0x3562c1[_0xcf69('0x47')]);var _0x4697da={'where':_0x3a423b[_0xcf69('0x42')]};return db[_0xcf69('0x35')][_0xcf69('0x22')](_0x4697da)['then'](function(_0x41ad3a){_0x2fa40e[_0xcf69('0x22')]=_0x41ad3a;if(_0x3562c1[_0xcf69('0x39')][_0xcf69('0x48')]){_0x3a423b[_0xcf69('0x49')]=[{'all':!![]}];}return db[_0xcf69('0x35')][_0xcf69('0x4a')](_0x3a423b);})[_0xcf69('0x2a')](function(_0x2c6177){_0x2fa40e['rows']=_0x2c6177;return _0x2fa40e;})[_0xcf69('0x2a')](respondWithFilteredResult(_0x1991c5,_0x3a423b))[_0xcf69('0x4b')](handleError(_0x1991c5,null));};exports[_0xcf69('0x4c')]=function(_0x1b671f,_0x39c879){var _0x36e971={'raw':!![],'where':{'id':_0x1b671f[_0xcf69('0x4d')]['id']}},_0x104e82={};_0x104e82['model']=_[_0xcf69('0x3a')](db[_0xcf69('0x35')][_0xcf69('0x36')]);_0x104e82[_0xcf69('0x39')]=_[_0xcf69('0x3a')](_0x1b671f[_0xcf69('0x39')]);_0x104e82[_0xcf69('0x3b')]=_[_0xcf69('0x3c')](_0x104e82[_0xcf69('0x38')],_0x104e82[_0xcf69('0x39')]);_0x36e971[_0xcf69('0x3d')]=_[_0xcf69('0x3c')](_0x104e82['model'],qs[_0xcf69('0x3e')](_0x1b671f['query']['fields']));_0x36e971[_0xcf69('0x3d')]=_0x36e971[_0xcf69('0x3d')][_0xcf69('0x4e')]?_0x36e971[_0xcf69('0x3d')]:_0x104e82[_0xcf69('0x38')];if(_0x1b671f[_0xcf69('0x39')][_0xcf69('0x48')]){_0x36e971[_0xcf69('0x49')]=[{'all':!![]}];}_0x36e971=_[_0xcf69('0x44')]({},_0x36e971,_0x1b671f[_0xcf69('0x47')]);return db[_0xcf69('0x35')][_0xcf69('0x4f')](_0x36e971)[_0xcf69('0x2a')](handleEntityNotFound(_0x39c879,null))[_0xcf69('0x2a')](respondWithResult(_0x39c879,null))[_0xcf69('0x4b')](handleError(_0x39c879,null));};exports['create']=function(_0x30b5a8,_0x120816){return db['MailQueue'][_0xcf69('0x50')](_0x30b5a8[_0xcf69('0x51')],{})[_0xcf69('0x2a')](function(_0x2673eb){var _0x567384=_0x30b5a8[_0xcf69('0x52')][_0xcf69('0x53')]({'plain':!![]});if(!_0x567384)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x567384[_0xcf69('0x54')]===_0xcf69('0x52')){var _0x57e2c3=_0x2673eb[_0xcf69('0x53')]({'plain':!![]});var _0x3ede3b=_0xcf69('0x2c');return db['UserProfileSection'][_0xcf69('0x4f')]({'where':{'name':_0x3ede3b,'userProfileId':_0x567384[_0xcf69('0x55')]},'raw':!![]})['then'](function(_0x146c50){if(_0x146c50&&_0x146c50['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x57e2c3[_0xcf69('0x31')],'resourceId':_0x57e2c3['id'],'type':_0x146c50[_0xcf69('0x31')],'sectionId':_0x146c50['id']},{})[_0xcf69('0x2a')](function(){return _0x2673eb;});}else{return _0x2673eb;}})[_0xcf69('0x4b')](function(_0x2041a2){logger[_0xcf69('0x2f')](_0xcf69('0x56'),_0x2041a2);throw _0x2041a2;});}return _0x2673eb;})[_0xcf69('0x2a')](respondWithResult(_0x120816,0xc9))[_0xcf69('0x4b')](handleError(_0x120816,null));};exports['update']=function(_0x182b70,_0x3ace61){if(_0x182b70[_0xcf69('0x51')]['id']){delete _0x182b70[_0xcf69('0x51')]['id'];}return db[_0xcf69('0x35')]['find']({'where':{'id':_0x182b70[_0xcf69('0x4d')]['id']}})[_0xcf69('0x2a')](handleEntityNotFound(_0x3ace61,null))['then'](saveUpdates(_0x182b70[_0xcf69('0x51')],null))[_0xcf69('0x2a')](respondWithResult(_0x3ace61,null))['catch'](handleError(_0x3ace61,null));};exports[_0xcf69('0x2b')]=function(_0x42b193,_0x400a5e){return db[_0xcf69('0x35')][_0xcf69('0x4f')]({'where':{'id':_0x42b193['params']['id']}})[_0xcf69('0x2a')](handleEntityNotFound(_0x400a5e,null))[_0xcf69('0x2a')](removeEntity(_0x400a5e,null))[_0xcf69('0x4b')](handleError(_0x400a5e,null));};exports['describe']=function(_0x56b67c,_0x27b64b){return db[_0xcf69('0x35')][_0xcf69('0x57')]()[_0xcf69('0x2a')](respondWithResult(_0x27b64b,null))[_0xcf69('0x4b')](handleError(_0x27b64b,null));};exports['getMembers']=function(_0x3cd857,_0x4f803f,_0x1d16bb){var _0x3b1746={'raw':!![],'where':{}},_0x5d47ea={},_0xb84f9b;return db[_0xcf69('0x35')][_0xcf69('0x58')]({'where':{'id':_0x3cd857[_0xcf69('0x4d')]['id']}})[_0xcf69('0x2a')](handleEntityNotFound(_0x4f803f,null))[_0xcf69('0x2a')](function(_0x4490c1){if(_0x4490c1){_0xb84f9b=_0x4490c1[_0xcf69('0x53')]({'plain':!![]});_0x5d47ea[_0xcf69('0x38')]=_['keys'](db[_0xcf69('0x59')][_0xcf69('0x36')]);_0x5d47ea[_0xcf69('0x39')]=_[_0xcf69('0x3a')](_0x3cd857['query']);_0x5d47ea[_0xcf69('0x3b')]=_['intersection'](_0x5d47ea['model'],_0x5d47ea[_0xcf69('0x39')]);_0x3b1746[_0xcf69('0x3d')]=_[_0xcf69('0x3c')](_0x5d47ea[_0xcf69('0x38')],qs['fields'](_0x3cd857[_0xcf69('0x39')][_0xcf69('0x3e')]));_0x3b1746[_0xcf69('0x3d')]=_0x3b1746[_0xcf69('0x3d')][_0xcf69('0x4e')]?_0x3b1746[_0xcf69('0x3d')]:_0x5d47ea[_0xcf69('0x38')];if(!_0x3cd857['query'][_0xcf69('0x3f')](_0xcf69('0x5a'))){_0x3b1746[_0xcf69('0x24')]=qs[_0xcf69('0x24')](_0x3cd857[_0xcf69('0x39')][_0xcf69('0x24')]);_0x3b1746[_0xcf69('0x23')]=qs['offset'](_0x3cd857['query'][_0xcf69('0x23')]);}_0x3b1746[_0xcf69('0x40')]=qs[_0xcf69('0x41')](_0x3cd857['query'][_0xcf69('0x41')]);_0x3b1746['where']=qs['filters'](_[_0xcf69('0x43')](_0x3cd857[_0xcf69('0x39')],_0x5d47ea[_0xcf69('0x3b')]));_0x3b1746[_0xcf69('0x42')][_0xcf69('0x5b')]=_0x4490c1['id'];if(_0x3cd857[_0xcf69('0x39')][_0xcf69('0x5c')]){_0x3b1746[_0xcf69('0x42')]=_[_0xcf69('0x44')](_0x3b1746['where'],{'$or':_['map'](_0x3b1746['attributes'],function(_0x44736f){var _0xf76175={};_0xf76175[_0x44736f]={'$like':'%'+_0x3cd857[_0xcf69('0x39')][_0xcf69('0x5c')]+'%'};return _0xf76175;})});}_0x3b1746=_[_0xcf69('0x44')]({},_0x3b1746,_0x3cd857[_0xcf69('0x47')]);return db[_0xcf69('0x59')][_0xcf69('0x4a')](_0x3b1746);}})[_0xcf69('0x2a')](function(_0x165d8f){if(_0x165d8f){return db[_0xcf69('0x5d')][_0xcf69('0x5e')]({'where':{'id':_['map'](_0x165d8f,_0xcf69('0x5f')),'role':_0xcf69('0x60')},'attributes':['id',_0xcf69('0x31'),_0xcf69('0x61'),_0xcf69('0x62'),'createdAt']});}})[_0xcf69('0x2a')](function(_0x422d16){if(_0x422d16){return{'count':_0x422d16['count'],'rows':_[_0xcf69('0x34')](_0x422d16[_0xcf69('0x63')],function(_0x234637){return{'membername':_0x234637[_0xcf69('0x31')],'UserId':_0x234637['id'],'queue_name':_0xb84f9b[_0xcf69('0x31')],'MailQueueId':_0xb84f9b['id'],'interface':util['format'](_0xcf69('0x64'),_0xcf69('0x65'),_0x234637['name']),'penalty':0x0,'paused':_0x234637['mailPause'],'createdAt':_0x234637[_0xcf69('0x66')],'updatedAt':_0x234637[_0xcf69('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4f803f,_0x3b1746))[_0xcf69('0x4b')](handleError(_0x4f803f,null));};exports[_0xcf69('0x67')]=function(_0x129e26,_0x2b003f,_0x15bff1){var _0x42ca3f={};var _0x3d7aa3={};var _0x5d45c1;var _0x2fee79;return db[_0xcf69('0x35')][_0xcf69('0x58')]({'where':{'id':_0x129e26['params']['id']}})['then'](handleEntityNotFound(_0x2b003f,null))[_0xcf69('0x2a')](function(_0x1ba592){if(_0x1ba592){_0x5d45c1=_0x1ba592;_0x3d7aa3[_0xcf69('0x38')]=_['keys'](db[_0xcf69('0x68')]['rawAttributes']);_0x3d7aa3[_0xcf69('0x39')]=_[_0xcf69('0x3a')](_0x129e26[_0xcf69('0x39')]);_0x3d7aa3['filters']=_[_0xcf69('0x3c')](_0x3d7aa3['model'],_0x3d7aa3[_0xcf69('0x39')]);_0x42ca3f['attributes']=_[_0xcf69('0x3c')](_0x3d7aa3[_0xcf69('0x38')],qs[_0xcf69('0x3e')](_0x129e26[_0xcf69('0x39')][_0xcf69('0x3e')]));_0x42ca3f[_0xcf69('0x3d')]=_0x42ca3f[_0xcf69('0x3d')][_0xcf69('0x4e')]?_0x42ca3f[_0xcf69('0x3d')]:_0x3d7aa3['model'];_0x42ca3f[_0xcf69('0x40')]=qs['sort'](_0x129e26['query'][_0xcf69('0x41')]);_0x42ca3f[_0xcf69('0x42')]=qs[_0xcf69('0x3b')](_[_0xcf69('0x43')](_0x129e26[_0xcf69('0x39')],_0x3d7aa3[_0xcf69('0x3b')]));if(_0x129e26[_0xcf69('0x39')][_0xcf69('0x5c')]){_0x42ca3f['where']=_[_0xcf69('0x44')](_0x42ca3f[_0xcf69('0x42')],{'$or':_[_0xcf69('0x34')](_0x42ca3f[_0xcf69('0x3d')],function(_0x2f357a){var _0x53b43c={};_0x53b43c[_0x2f357a]={'$like':'%'+_0x129e26[_0xcf69('0x39')][_0xcf69('0x5c')]+'%'};return _0x53b43c;})});}_0x42ca3f=_[_0xcf69('0x44')]({},_0x42ca3f,_0x129e26[_0xcf69('0x47')]);return _0x5d45c1[_0xcf69('0x67')](_0x42ca3f);}})['then'](function(_0x15f49c){if(_0x15f49c){_0x2fee79=_0x15f49c[_0xcf69('0x4e')];if(!_0x129e26[_0xcf69('0x39')][_0xcf69('0x3f')](_0xcf69('0x5a'))){_0x42ca3f['limit']=qs['limit'](_0x129e26[_0xcf69('0x39')]['limit']);_0x42ca3f[_0xcf69('0x23')]=qs[_0xcf69('0x23')](_0x129e26['query'][_0xcf69('0x23')]);}return _0x5d45c1[_0xcf69('0x67')](_0x42ca3f);}})['then'](function(_0x365d10){if(_0x365d10){return _0x365d10?{'count':_0x2fee79,'rows':_0x365d10}:null;}})[_0xcf69('0x2a')](respondWithResult(_0x2b003f,null))[_0xcf69('0x4b')](handleError(_0x2b003f,null));};exports[_0xcf69('0x69')]=function(_0x5bfa9e,_0x3ca59b,_0x491346){var _0x4570cf=_0x5bfa9e[_0xcf69('0x51')]['ids'];return db[_0xcf69('0x68')][_0xcf69('0x4a')]({'where':{'id':_0x4570cf},'attributes':['id'],'include':[{'model':db[_0xcf69('0x5d')],'as':_0xcf69('0x6a'),'attributes':['id',_0xcf69('0x31'),_0xcf69('0x6b'),_0xcf69('0x6c'),_0xcf69('0x6d')],'raw':!![]}]})[_0xcf69('0x2a')](function(_0x387c5a){if(_0x387c5a){var _0x172f43=_['flatMap'](_0x387c5a,function(_0x41faf0){var _0x172829=_0x41faf0[_0xcf69('0x53')]({'plain':!![]});return _0x172829[_0xcf69('0x6a')];});return db[_0xcf69('0x35')]['find']({'where':{'id':_0x5bfa9e['params']['id']}})[_0xcf69('0x2a')](function(_0x4e1b5e){return db['sequelize']['transaction'](function(_0xe578c3){return _0x4e1b5e['addTeams'](_0x4570cf,{'transaction':_0xe578c3})['then'](function(){return BPromise['each'](_0x172f43,function(_0x14fbb1){return db[_0xcf69('0x59')][_0xcf69('0x6e')]({'where':{'UserId':_0x14fbb1['id'],'MailQueueId':_0x5bfa9e[_0xcf69('0x4d')]['id']},'transaction':_0xe578c3});});})[_0xcf69('0x2a')](function(){_0x172f43[_0xcf69('0x6f')](function(_0x4d0455){socket[_0xcf69('0x70')](_0xcf69('0x71'),{'UserId':_0x4d0455['id'],'MailQueueId':_0x4e1b5e['id']});});});});});}})[_0xcf69('0x2a')](respondWithStatusCode(_0x3ca59b,null))[_0xcf69('0x4b')](handleError(_0x3ca59b,null));};exports[_0xcf69('0x72')]=function(_0x3a1a85,_0x558339,_0x18f320){return db[_0xcf69('0x68')][_0xcf69('0x4a')]({'where':{'id':_0x3a1a85['query'][_0xcf69('0x73')]},'attributes':['id'],'include':[{'model':db[_0xcf69('0x5d')],'as':_0xcf69('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xcf69('0x2a')](handleEntityNotFound(_0x558339,null))[_0xcf69('0x2a')](function(_0x470f83){var _0x443d3b=_['map'](_0x470f83,'id');var _0x11cfdf=[];var _0x489dec=[];var _0x30f402=squel[_0xcf69('0x74')]();_0x30f402['field'](_0xcf69('0x75'))[_0xcf69('0x76')]('team_has_mail_queues','tq')[_0xcf69('0x77')](_0xcf69('0x78'),'ut',_0xcf69('0x79'))[_0xcf69('0x42')](_0xcf69('0x7a'),_0x3a1a85['params']['id']);for(var _0x15045d=0x0;_0x15045d<_0x470f83[_0xcf69('0x4e')];_0x15045d+=0x1){let _0x34715a=_0x470f83[_0x15045d];for(var _0x22b8d1=0x0;_0x22b8d1<_0x34715a[_0xcf69('0x6a')][_0xcf69('0x4e')];_0x22b8d1+=0x1){let _0x57cd92=_0x34715a[_0xcf69('0x6a')][_0x22b8d1];var _0x545e2b=_0x30f402[_0xcf69('0x7b')]();_0x545e2b[_0xcf69('0x42')](_0xcf69('0x7c'),_0x57cd92['id']);_0x489dec[_0xcf69('0x7d')](db[_0xcf69('0x7e')][_0xcf69('0x39')](_0x545e2b[_0xcf69('0x7f')](),{'type':db[_0xcf69('0x7e')][_0xcf69('0x80')]['SELECT']})[_0xcf69('0x2a')](function(_0x380132){if(_0x380132[_0xcf69('0x4e')]===0x1){return _0x57cd92['id'];}else{var _0x9372a2=_[_0xcf69('0x81')](_[_0xcf69('0x34')](_0x380132,_0xcf69('0x82')),function(_0x4b1b52){return _[_0xcf69('0x83')](_0x443d3b,_0x4b1b52);});if(_0x9372a2){return _0x57cd92['id'];}}}));}}return BPromise[_0xcf69('0x84')](_0x489dec)['then'](function(_0x30dc9f){_0x11cfdf=_(_0x11cfdf)[_0xcf69('0x85')](_0x30dc9f)[_0xcf69('0x86')]()['value']();return db[_0xcf69('0x35')][_0xcf69('0x4f')]({'where':{'id':_0x3a1a85[_0xcf69('0x4d')]['id']}})[_0xcf69('0x2a')](function(_0x425edb){return db['sequelize']['transaction'](function(_0x44d549){return _0x425edb[_0xcf69('0x72')](_0x3a1a85[_0xcf69('0x39')][_0xcf69('0x73')],{'transaction':_0x44d549})[_0xcf69('0x2a')](function(){if(!_['isEmpty'](_0x11cfdf)){return _0x425edb['removeAgents'](_0x11cfdf,{'transaction':_0x44d549});}})[_0xcf69('0x2a')](function(){_0x11cfdf[_0xcf69('0x6f')](function(_0x51398a){socket[_0xcf69('0x70')](_0xcf69('0x87'),{'UserId':_0x51398a,'MailQueueId':_0x425edb['id']});});});});});});})[_0xcf69('0x2a')](respondWithStatusCode(_0x558339,null))[_0xcf69('0x4b')](handleError(_0x558339,null));};exports[_0xcf69('0x88')]=function(_0x5d5da2,_0x5c87b0,_0x323174){return db[_0xcf69('0x35')]['find']({'where':{'id':_0x5d5da2['params']['id']}})[_0xcf69('0x2a')](handleEntityNotFound(_0x5c87b0,null))[_0xcf69('0x2a')](function(_0x1d945c){if(_0x1d945c){return _0x1d945c[_0xcf69('0x88')](_0x5d5da2[_0xcf69('0x51')][_0xcf69('0x73')],_[_0xcf69('0x89')](_0x5d5da2[_0xcf69('0x51')],[_0xcf69('0x73'),'id'])||{})[_0xcf69('0x8a')](function(_0x49a51d){for(var _0x4e6c96=0x0;_0x4e6c96<_0x5d5da2[_0xcf69('0x51')][_0xcf69('0x73')][_0xcf69('0x4e')];_0x4e6c96+=0x1){socket[_0xcf69('0x70')]('userMailQueue:save',{'UserId':_0x5d5da2[_0xcf69('0x51')][_0xcf69('0x73')][_0x4e6c96],'MailQueueId':_0x5d5da2['params']['id']});}return _0x49a51d;});}})['then'](respondWithResult(_0x5c87b0,null))[_0xcf69('0x4b')](handleError(_0x5c87b0,null));};exports[_0xcf69('0x8b')]=function(_0x15474d,_0x3a17f0,_0x2020d6){return db[_0xcf69('0x35')][_0xcf69('0x4f')]({'where':{'id':_0x15474d['params']['id']}})[_0xcf69('0x2a')](handleEntityNotFound(_0x3a17f0,null))[_0xcf69('0x2a')](function(_0x53ebf6){if(_0x53ebf6){return _0x53ebf6['removeAgents'](_0x15474d[_0xcf69('0x39')][_0xcf69('0x73')])['then'](function(){if(_[_0xcf69('0x8c')](_0x15474d[_0xcf69('0x39')]['ids'])){for(var _0x281995=0x0;_0x281995<_0x15474d[_0xcf69('0x39')][_0xcf69('0x73')][_0xcf69('0x4e')];_0x281995+=0x1){socket[_0xcf69('0x70')](_0xcf69('0x87'),{'UserId':Number(_0x15474d[_0xcf69('0x39')][_0xcf69('0x73')][_0x281995]),'MailQueueId':Number(_0x15474d[_0xcf69('0x4d')]['id'])});}}else{socket[_0xcf69('0x70')](_0xcf69('0x87'),{'UserId':Number(_0x15474d[_0xcf69('0x39')][_0xcf69('0x73')]),'MailQueueId':Number(_0x15474d[_0xcf69('0x4d')]['id'])});}});}})[_0xcf69('0x2a')](respondWithStatusCode(_0x3a17f0,null))['catch'](handleError(_0x3a17f0,null));};exports[_0xcf69('0x8d')]=function(_0x4b74b3,_0x1c5467,_0x1a67d1){var _0x416fcf={};var _0x4a55cd={};var _0x59ba0e;var _0x34a336;return db[_0xcf69('0x35')][_0xcf69('0x58')]({'where':{'id':_0x4b74b3[_0xcf69('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1c5467,null))[_0xcf69('0x2a')](function(_0x44ba17){if(_0x44ba17){_0x59ba0e=_0x44ba17;_0x4a55cd[_0xcf69('0x38')]=_[_0xcf69('0x3a')](db[_0xcf69('0x5d')][_0xcf69('0x36')]);_0x4a55cd[_0xcf69('0x39')]=_['keys'](_0x4b74b3[_0xcf69('0x39')]);_0x4a55cd[_0xcf69('0x3b')]=_[_0xcf69('0x3c')](_0x4a55cd['model'],_0x4a55cd[_0xcf69('0x39')]);_0x416fcf[_0xcf69('0x3d')]=_[_0xcf69('0x3c')](_0x4a55cd['model'],qs[_0xcf69('0x3e')](_0x4b74b3[_0xcf69('0x39')][_0xcf69('0x3e')]));_0x416fcf[_0xcf69('0x3d')]=_0x416fcf[_0xcf69('0x3d')][_0xcf69('0x4e')]?_0x416fcf[_0xcf69('0x3d')]:_0x4a55cd[_0xcf69('0x38')];_0x416fcf[_0xcf69('0x40')]=qs['sort'](_0x4b74b3['query'][_0xcf69('0x41')]);_0x416fcf[_0xcf69('0x42')]=qs[_0xcf69('0x3b')](_[_0xcf69('0x43')](_0x4b74b3[_0xcf69('0x39')],_0x4a55cd[_0xcf69('0x3b')]));if(_0x4b74b3[_0xcf69('0x39')][_0xcf69('0x5c')]){_0x416fcf[_0xcf69('0x42')]=_['merge'](_0x416fcf[_0xcf69('0x42')],{'$or':_[_0xcf69('0x34')](_0x416fcf['attributes'],function(_0x2e7f05){var _0x1f07b7={};_0x1f07b7[_0x2e7f05]={'$like':'%'+_0x4b74b3[_0xcf69('0x39')][_0xcf69('0x5c')]+'%'};return _0x1f07b7;})});}_0x416fcf=_[_0xcf69('0x44')]({},_0x416fcf,_0x4b74b3['options']);return _0x59ba0e[_0xcf69('0x8d')](_0x416fcf);}})['then'](function(_0x4c31ca){if(_0x4c31ca){_0x34a336=_0x4c31ca['length'];if(!_0x4b74b3[_0xcf69('0x39')][_0xcf69('0x3f')](_0xcf69('0x5a'))){_0x416fcf['limit']=qs[_0xcf69('0x24')](_0x4b74b3[_0xcf69('0x39')][_0xcf69('0x24')]);_0x416fcf[_0xcf69('0x23')]=qs[_0xcf69('0x23')](_0x4b74b3['query'][_0xcf69('0x23')]);}return _0x59ba0e[_0xcf69('0x8d')](_0x416fcf);}})[_0xcf69('0x2a')](function(_0x4c1b9c){if(_0x4c1b9c){return _0x4c1b9c?{'count':_0x34a336,'rows':_0x4c1b9c}:null;}})[_0xcf69('0x2a')](respondWithResult(_0x1c5467,null))['catch'](handleError(_0x1c5467,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index e6a622c..4013d9a 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 _0xcce4=['hook','exports','events','MailQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x58319a,_0x145060){var _0x4cf654=function(_0x314238){while(--_0x314238){_0x58319a['push'](_0x58319a['shift']());}};_0x4cf654(++_0x145060);}(_0xcce4,0x65));var _0x4cce=function(_0x561771,_0x554760){_0x561771=_0x561771-0x0;var _0x54d16e=_0xcce4[_0x561771];return _0x54d16e;};'use strict';var EventEmitter=require(_0x4cce('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x4cce('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x4cce('0x2')](0x0);var events={'afterCreate':_0x4cce('0x3'),'afterUpdate':_0x4cce('0x4'),'afterDestroy':'remove'};function emitEvent(_0x21724f){return function(_0x3f8e2a,_0x49d99c,_0x4b1de3){MailQueueEvents[_0x4cce('0x5')](_0x21724f+':'+_0x3f8e2a['id'],_0x3f8e2a);MailQueueEvents[_0x4cce('0x5')](_0x21724f,_0x3f8e2a);_0x4b1de3(null);};}for(var e in events){if(events[_0x4cce('0x6')](e)){var event=events[e];MailQueue[_0x4cce('0x7')](e,emitEvent(event));}}module[_0x4cce('0x8')]=MailQueueEvents; \ No newline at end of file +var _0xeeda=['hook','events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x37862a,_0x2bc98e){var _0x5b0104=function(_0x391413){while(--_0x391413){_0x37862a['push'](_0x37862a['shift']());}};_0x5b0104(++_0x2bc98e);}(_0xeeda,0x12d));var _0xaeed=function(_0x1caf3f,_0x37ecb0){_0x1caf3f=_0x1caf3f-0x0;var _0x389df3=_0xeeda[_0x1caf3f];return _0x389df3;};'use strict';var EventEmitter=require(_0xaeed('0x0'));var MailQueue=require(_0xaeed('0x1'))['db'][_0xaeed('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xaeed('0x3')](0x0);var events={'afterCreate':_0xaeed('0x4'),'afterUpdate':_0xaeed('0x5'),'afterDestroy':_0xaeed('0x6')};function emitEvent(_0x5ea03b){return function(_0x561ceb,_0x34da9a,_0x217cbd){MailQueueEvents['emit'](_0x5ea03b+':'+_0x561ceb['id'],_0x561ceb);MailQueueEvents[_0xaeed('0x7')](_0x5ea03b,_0x561ceb);_0x217cbd(null);};}for(var e in events){if(events[_0xaeed('0x8')](e)){var event=events[e];MailQueue[_0xaeed('0x9')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index f06d3b4..8c6b51a 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 _0xe2da=['util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','mail_queues','lodash'];(function(_0x4354b9,_0xc27dd7){var _0x2a63a6=function(_0x55ba89){while(--_0x55ba89){_0x4354b9['push'](_0x4354b9['shift']());}};_0x2a63a6(++_0xc27dd7);}(_0xe2da,0x196));var _0xae2d=function(_0x5be0e1,_0x45ba15){_0x5be0e1=_0x5be0e1-0x0;var _0x1dabb6=_0xe2da[_0x5be0e1];return _0x1dabb6;};'use strict';var _=require(_0xae2d('0x0'));var util=require(_0xae2d('0x1'));var logger=require('../../config/logger')(_0xae2d('0x2'));var moment=require(_0xae2d('0x3'));var BPromise=require('bluebird');var rp=require(_0xae2d('0x4'));var fs=require('fs');var path=require(_0xae2d('0x5'));var rimraf=require(_0xae2d('0x6'));var config=require(_0xae2d('0x7'));var attributes=require('./mailQueue.attributes');module[_0xae2d('0x8')]=function(_0x14b534,_0x453c08){return _0x14b534[_0xae2d('0x9')]('MailQueue',attributes,{'tableName':_0xae2d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb906=['mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue'];(function(_0x5e09a2,_0x37ffa3){var _0x32276f=function(_0x1e2a00){while(--_0x1e2a00){_0x5e09a2['push'](_0x5e09a2['shift']());}};_0x32276f(++_0x37ffa3);}(_0xb906,0x71));var _0x6b90=function(_0x1cb276,_0x401cc2){_0x1cb276=_0x1cb276-0x0;var _0x559fa9=_0xb906[_0x1cb276];return _0x559fa9;};'use strict';var _=require(_0x6b90('0x0'));var util=require(_0x6b90('0x1'));var logger=require(_0x6b90('0x2'))(_0x6b90('0x3'));var moment=require(_0x6b90('0x4'));var BPromise=require(_0x6b90('0x5'));var rp=require(_0x6b90('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6b90('0x7'));var config=require(_0x6b90('0x8'));var attributes=require(_0x6b90('0x9'));module[_0x6b90('0xa')]=function(_0x5466a7,_0x433588){return _0x5466a7[_0x6b90('0xb')](_0x6b90('0xc'),attributes,{'tableName':_0x6b90('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 8581df2..1b12e26 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 _0x647d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','MailQueue,\x20%s,\x20%s','message','result','catch','GetMailQueue','MailQueue','findAll','options','where','limit','include','map','model','attributes','stringify','find','raw','ShowMailQueue','lodash','util','moment','randomstring'];(function(_0x45685b,_0x367382){var _0x4c7b06=function(_0x3d4231){while(--_0x3d4231){_0x45685b['push'](_0x45685b['shift']());}};_0x4c7b06(++_0x367382);}(_0x647d,0xec));var _0xd647=function(_0x204ebb,_0x1d696a){_0x204ebb=_0x204ebb-0x0;var _0x2c2221=_0x647d[_0x204ebb];return _0x2c2221;};'use strict';var _=require(_0xd647('0x0'));var util=require(_0xd647('0x1'));var moment=require(_0xd647('0x2'));var BPromise=require('bluebird');var rs=require(_0xd647('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd647('0x4'))['db'];var utils=require(_0xd647('0x5'));var logger=require(_0xd647('0x6'))(_0xd647('0x7'));var config=require(_0xd647('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xd647('0x9')]=_[_0xd647('0xa')](config[_0xd647('0x9')],{'host':_0xd647('0xb'),'port':0x18eb});var socket=require(_0xd647('0xc'))(new Redis(config[_0xd647('0x9')]));require('./mailQueue.socket')[_0xd647('0xd')](socket);function respondWithRpcPromise(_0x30b388,_0xc9ee9e,_0xc486e8){return new BPromise(function(_0x186a6c,_0x241b6e){return client[_0xd647('0xe')](_0x30b388,_0xc486e8)[_0xd647('0xf')](function(_0xc1b142){logger[_0xd647('0x10')]('MailQueue,\x20%s,\x20%s',_0xc9ee9e,_0xd647('0x11'));logger[_0xd647('0x12')](_0xd647('0x13'),_0xc9ee9e,_0xd647('0x11'),JSON['stringify'](_0xc1b142));if(_0xc1b142[_0xd647('0x14')]){if(_0xc1b142['error'][_0xd647('0x15')]===0x1f4){logger[_0xd647('0x14')](_0xd647('0x16'),_0xc9ee9e,_0xc1b142['error'][_0xd647('0x17')]);return _0x241b6e(_0xc1b142[_0xd647('0x14')][_0xd647('0x17')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0xc9ee9e,_0xc1b142[_0xd647('0x14')][_0xd647('0x17')]);return _0x186a6c(_0xc1b142[_0xd647('0x14')]['message']);}else{logger[_0xd647('0x10')](_0xd647('0x16'),_0xc9ee9e,_0xd647('0x11'));_0x186a6c(_0xc1b142[_0xd647('0x18')]['message']);}})[_0xd647('0x19')](function(_0xd1b6b4){logger['error'](_0xd647('0x16'),_0xc9ee9e,_0xd1b6b4);_0x241b6e(_0xd1b6b4);});});}exports[_0xd647('0x1a')]=function(_0x1c8d3d){var _0x3d4be5=this;return new Promise(function(_0x32b473,_0x3e2773){return db[_0xd647('0x1b')][_0xd647('0x1c')]({'raw':_0x1c8d3d['options']?_0x1c8d3d[_0xd647('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1c8d3d[_0xd647('0x1d')]?_0x1c8d3d[_0xd647('0x1d')][_0xd647('0x1e')]||null:null,'attributes':_0x1c8d3d[_0xd647('0x1d')]?_0x1c8d3d[_0xd647('0x1d')]['attributes']||null:null,'limit':_0x1c8d3d[_0xd647('0x1d')]?_0x1c8d3d['options'][_0xd647('0x1f')]||null:null,'include':_0x1c8d3d[_0xd647('0x1d')]?_0x1c8d3d[_0xd647('0x1d')][_0xd647('0x20')]?_[_0xd647('0x21')](_0x1c8d3d[_0xd647('0x1d')][_0xd647('0x20')],function(_0x4e2527){return{'model':db[_0x4e2527[_0xd647('0x22')]],'as':_0x4e2527['as'],'attributes':_0x4e2527[_0xd647('0x23')],'include':_0x4e2527['include']?_['map'](_0x4e2527[_0xd647('0x20')],function(_0x4f45fe){return{'model':db[_0x4f45fe['model']],'as':_0x4f45fe['as'],'attributes':_0x4f45fe[_0xd647('0x23')],'include':_0x4f45fe[_0xd647('0x20')]?_[_0xd647('0x21')](_0x4f45fe['include'],function(_0x1dbe1d){return{'model':db[_0x1dbe1d[_0xd647('0x22')]],'as':_0x1dbe1d['as'],'attributes':_0x1dbe1d[_0xd647('0x23')]};}):[]};}):[]};}):[]:[]})[_0xd647('0xf')](function(_0x55c713){logger['info'](_0xd647('0x1a'),_0x1c8d3d);logger[_0xd647('0x12')](_0xd647('0x1a'),_0x1c8d3d,JSON[_0xd647('0x24')](_0x55c713));_0x32b473(_0x55c713);})['catch'](function(_0x2ad9f2){logger[_0xd647('0x14')](_0xd647('0x1a'),_0x2ad9f2[_0xd647('0x17')],_0x1c8d3d);_0x3e2773(_0x3d4be5[_0xd647('0x14')](0x1f4,_0x2ad9f2['message']));});});};exports['ShowMailQueue']=function(_0x1dfd0f){var _0x316a1e=this;return new Promise(function(_0xa84dc0,_0x34bbd9){return db['MailQueue'][_0xd647('0x25')]({'raw':_0x1dfd0f[_0xd647('0x1d')]?_0x1dfd0f[_0xd647('0x1d')][_0xd647('0x26')]===undefined?!![]:![]:!![],'where':_0x1dfd0f[_0xd647('0x1d')]?_0x1dfd0f['options']['where']||null:null,'attributes':_0x1dfd0f['options']?_0x1dfd0f['options'][_0xd647('0x23')]||null:null,'include':_0x1dfd0f[_0xd647('0x1d')]?_0x1dfd0f['options'][_0xd647('0x20')]?_[_0xd647('0x21')](_0x1dfd0f[_0xd647('0x1d')][_0xd647('0x20')],function(_0x5a5a47){return{'model':db[_0x5a5a47['model']],'as':_0x5a5a47['as'],'attributes':_0x5a5a47[_0xd647('0x23')],'include':_0x5a5a47[_0xd647('0x20')]?_[_0xd647('0x21')](_0x5a5a47['include'],function(_0x15aac9){return{'model':db[_0x15aac9[_0xd647('0x22')]],'as':_0x15aac9['as'],'attributes':_0x15aac9[_0xd647('0x23')],'include':_0x15aac9[_0xd647('0x20')]?_[_0xd647('0x21')](_0x15aac9[_0xd647('0x20')],function(_0x1a0f54){return{'model':db[_0x1a0f54[_0xd647('0x22')]],'as':_0x1a0f54['as'],'attributes':_0x1a0f54[_0xd647('0x23')]};}):[]};}):[]};}):[]:[]})[_0xd647('0xf')](function(_0x4fa4c2){logger[_0xd647('0x10')](_0xd647('0x27'),_0x1dfd0f);logger[_0xd647('0x12')](_0xd647('0x27'),_0x1dfd0f,JSON[_0xd647('0x24')](_0x4fa4c2));_0xa84dc0(_0x4fa4c2);})[_0xd647('0x19')](function(_0xba0df7){logger[_0xd647('0x14')](_0xd647('0x27'),_0xba0df7[_0xd647('0x17')],_0x1dfd0f);_0x34bbd9(_0x316a1e['error'](0x1f4,_0xba0df7[_0xd647('0x17')]));});});}; \ No newline at end of file +var _0xf9e4=['result','catch','GetMailQueue','findAll','options','raw','where','attributes','limit','include','model','map','debug','MailQueue','ShowMailQueue','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0xa7e4e8,_0x510bb5){var _0x593f85=function(_0x20fe7e){while(--_0x20fe7e){_0xa7e4e8['push'](_0xa7e4e8['shift']());}};_0x593f85(++_0x510bb5);}(_0xf9e4,0xd7));var _0x4f9e=function(_0x2de739,_0x5ed8b0){_0x2de739=_0x2de739-0x0;var _0x12d126=_0xf9e4[_0x2de739];return _0x12d126;};'use strict';var _=require(_0x4f9e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4f9e('0x1'));var rs=require(_0x4f9e('0x2'));var fs=require('fs');var Redis=require(_0x4f9e('0x3'));var db=require(_0x4f9e('0x4'))['db'];var utils=require(_0x4f9e('0x5'));var logger=require(_0x4f9e('0x6'))(_0x4f9e('0x7'));var config=require(_0x4f9e('0x8'));var jayson=require(_0x4f9e('0x9'));var client=jayson[_0x4f9e('0xa')][_0x4f9e('0xb')]({'port':0x232a});config[_0x4f9e('0xc')]=_[_0x4f9e('0xd')](config['redis'],{'host':_0x4f9e('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4f9e('0xc')]));require(_0x4f9e('0xf'))[_0x4f9e('0x10')](socket);function respondWithRpcPromise(_0x37938e,_0x4ae97d,_0x2d5537){return new BPromise(function(_0x2afea3,_0x1eb696){return client[_0x4f9e('0x11')](_0x37938e,_0x2d5537)[_0x4f9e('0x12')](function(_0xe1cbbf){logger[_0x4f9e('0x13')](_0x4f9e('0x14'),_0x4ae97d,_0x4f9e('0x15'));logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0x4ae97d,_0x4f9e('0x15'),JSON[_0x4f9e('0x16')](_0xe1cbbf));if(_0xe1cbbf['error']){if(_0xe1cbbf['error']['code']===0x1f4){logger[_0x4f9e('0x17')](_0x4f9e('0x14'),_0x4ae97d,_0xe1cbbf[_0x4f9e('0x17')][_0x4f9e('0x18')]);return _0x1eb696(_0xe1cbbf['error']['message']);}logger['error'](_0x4f9e('0x14'),_0x4ae97d,_0xe1cbbf[_0x4f9e('0x17')][_0x4f9e('0x18')]);return _0x2afea3(_0xe1cbbf[_0x4f9e('0x17')]['message']);}else{logger[_0x4f9e('0x13')]('MailQueue,\x20%s,\x20%s',_0x4ae97d,_0x4f9e('0x15'));_0x2afea3(_0xe1cbbf[_0x4f9e('0x19')][_0x4f9e('0x18')]);}})[_0x4f9e('0x1a')](function(_0x42ac06){logger[_0x4f9e('0x17')](_0x4f9e('0x14'),_0x4ae97d,_0x42ac06);_0x1eb696(_0x42ac06);});});}exports[_0x4f9e('0x1b')]=function(_0x37d24a){var _0x368fb5=this;return new Promise(function(_0x45b4fb,_0x170460){return db['MailQueue'][_0x4f9e('0x1c')]({'raw':_0x37d24a[_0x4f9e('0x1d')]?_0x37d24a[_0x4f9e('0x1d')][_0x4f9e('0x1e')]===undefined?!![]:![]:!![],'where':_0x37d24a[_0x4f9e('0x1d')]?_0x37d24a[_0x4f9e('0x1d')][_0x4f9e('0x1f')]||null:null,'attributes':_0x37d24a[_0x4f9e('0x1d')]?_0x37d24a[_0x4f9e('0x1d')][_0x4f9e('0x20')]||null:null,'limit':_0x37d24a[_0x4f9e('0x1d')]?_0x37d24a['options'][_0x4f9e('0x21')]||null:null,'include':_0x37d24a[_0x4f9e('0x1d')]?_0x37d24a['options'][_0x4f9e('0x22')]?_['map'](_0x37d24a[_0x4f9e('0x1d')][_0x4f9e('0x22')],function(_0x206b0d){return{'model':db[_0x206b0d[_0x4f9e('0x23')]],'as':_0x206b0d['as'],'attributes':_0x206b0d[_0x4f9e('0x20')],'include':_0x206b0d[_0x4f9e('0x22')]?_[_0x4f9e('0x24')](_0x206b0d[_0x4f9e('0x22')],function(_0xff4f9d){return{'model':db[_0xff4f9d[_0x4f9e('0x23')]],'as':_0xff4f9d['as'],'attributes':_0xff4f9d['attributes'],'include':_0xff4f9d['include']?_[_0x4f9e('0x24')](_0xff4f9d[_0x4f9e('0x22')],function(_0x2d7292){return{'model':db[_0x2d7292['model']],'as':_0x2d7292['as'],'attributes':_0x2d7292[_0x4f9e('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4f9e('0x12')](function(_0x42bfc1){logger[_0x4f9e('0x13')](_0x4f9e('0x1b'),_0x37d24a);logger[_0x4f9e('0x25')](_0x4f9e('0x1b'),_0x37d24a,JSON[_0x4f9e('0x16')](_0x42bfc1));_0x45b4fb(_0x42bfc1);})[_0x4f9e('0x1a')](function(_0x25aace){logger[_0x4f9e('0x17')](_0x4f9e('0x1b'),_0x25aace[_0x4f9e('0x18')],_0x37d24a);_0x170460(_0x368fb5[_0x4f9e('0x17')](0x1f4,_0x25aace[_0x4f9e('0x18')]));});});};exports['ShowMailQueue']=function(_0x221e9e){var _0x3553cb=this;return new Promise(function(_0x552927,_0x2cac9c){return db[_0x4f9e('0x26')]['find']({'raw':_0x221e9e[_0x4f9e('0x1d')]?_0x221e9e[_0x4f9e('0x1d')][_0x4f9e('0x1e')]===undefined?!![]:![]:!![],'where':_0x221e9e[_0x4f9e('0x1d')]?_0x221e9e[_0x4f9e('0x1d')]['where']||null:null,'attributes':_0x221e9e[_0x4f9e('0x1d')]?_0x221e9e[_0x4f9e('0x1d')][_0x4f9e('0x20')]||null:null,'include':_0x221e9e[_0x4f9e('0x1d')]?_0x221e9e[_0x4f9e('0x1d')]['include']?_[_0x4f9e('0x24')](_0x221e9e[_0x4f9e('0x1d')][_0x4f9e('0x22')],function(_0x2c5bd8){return{'model':db[_0x2c5bd8['model']],'as':_0x2c5bd8['as'],'attributes':_0x2c5bd8[_0x4f9e('0x20')],'include':_0x2c5bd8[_0x4f9e('0x22')]?_[_0x4f9e('0x24')](_0x2c5bd8['include'],function(_0x61f2cf){return{'model':db[_0x61f2cf['model']],'as':_0x61f2cf['as'],'attributes':_0x61f2cf[_0x4f9e('0x20')],'include':_0x61f2cf['include']?_[_0x4f9e('0x24')](_0x61f2cf[_0x4f9e('0x22')],function(_0x49be3b){return{'model':db[_0x49be3b['model']],'as':_0x49be3b['as'],'attributes':_0x49be3b['attributes']};}):[]};}):[]};}):[]:[]})[_0x4f9e('0x12')](function(_0x5ba08c){logger['info'](_0x4f9e('0x27'),_0x221e9e);logger[_0x4f9e('0x25')](_0x4f9e('0x27'),_0x221e9e,JSON[_0x4f9e('0x16')](_0x5ba08c));_0x552927(_0x5ba08c);})[_0x4f9e('0x1a')](function(_0x1b29b3){logger[_0x4f9e('0x17')](_0x4f9e('0x27'),_0x1b29b3[_0x4f9e('0x18')],_0x221e9e);_0x2cac9c(_0x3553cb['error'](0x1f4,_0x1b29b3[_0x4f9e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index a75f323..a81eabc 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 _0xdcf8=['./mailQueue.events','save','remove','emit','removeListener','register','length','mailQueue:'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0xdcf8,0x1c8));var _0x8dcf=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xdcf8[_0x502c7d];return _0x30b7ed;};'use strict';var MailQueueEvents=require(_0x8dcf('0x0'));var events=[_0x8dcf('0x1'),_0x8dcf('0x2'),'update'];function createListener(_0x355b75,_0x5297ef){return function(_0x1f86a7){_0x5297ef[_0x8dcf('0x3')](_0x355b75,_0x1f86a7);};}function removeListener(_0x4d7edd,_0x42f86a){return function(){MailQueueEvents[_0x8dcf('0x4')](_0x4d7edd,_0x42f86a);};}exports[_0x8dcf('0x5')]=function(_0x211535){for(var _0x41e5a3=0x0,_0x267932=events[_0x8dcf('0x6')];_0x41e5a3<_0x267932;_0x41e5a3++){var _0x153eed=events[_0x41e5a3];var _0x1a207e=createListener(_0x8dcf('0x7')+_0x153eed,_0x211535);MailQueueEvents['on'](_0x153eed,_0x1a207e);}}; \ No newline at end of file +var _0xc920=['mailQueue:','./mailQueue.events','save','remove','emit','removeListener','register','length'];(function(_0x2efebd,_0x4e5501){var _0x5593fb=function(_0x5730ef){while(--_0x5730ef){_0x2efebd['push'](_0x2efebd['shift']());}};_0x5593fb(++_0x4e5501);}(_0xc920,0x181));var _0x0c92=function(_0x397d61,_0x1f2002){_0x397d61=_0x397d61-0x0;var _0x270833=_0xc920[_0x397d61];return _0x270833;};'use strict';var MailQueueEvents=require(_0x0c92('0x0'));var events=[_0x0c92('0x1'),_0x0c92('0x2'),'update'];function createListener(_0x362193,_0x5800c2){return function(_0x37d339){_0x5800c2[_0x0c92('0x3')](_0x362193,_0x37d339);};}function removeListener(_0x49aa5a,_0x581b8a){return function(){MailQueueEvents[_0x0c92('0x4')](_0x49aa5a,_0x581b8a);};}exports[_0x0c92('0x5')]=function(_0x5a0560){for(var _0x15c09f=0x0,_0x57e997=events[_0x0c92('0x6')];_0x15c09f<_0x57e997;_0x15c09f++){var _0x4aabc5=events[_0x15c09f];var _0x14cd0c=createListener(_0x0c92('0x7')+_0x4aabc5,_0x5a0560);MailQueueEvents['on'](_0x4aabc5,_0x14cd0c);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index d06f090..06b4bc2 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 _0x4f79=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','put'];(function(_0x4ac61e,_0x54e95a){var _0xe926a5=function(_0x310bb){while(--_0x310bb){_0x4ac61e['push'](_0x4ac61e['shift']());}};_0xe926a5(++_0x54e95a);}(_0x4f79,0x156));var _0x94f7=function(_0x264711,_0x131665){_0x264711=_0x264711-0x0;var _0x56ffb9=_0x4f79[_0x264711];return _0x56ffb9;};'use strict';var multer=require(_0x94f7('0x0'));var util=require(_0x94f7('0x1'));var path=require(_0x94f7('0x2'));var timeout=require(_0x94f7('0x3'));var express=require(_0x94f7('0x4'));var router=express[_0x94f7('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x94f7('0x6'));var config=require(_0x94f7('0x7'));var controller=require(_0x94f7('0x8'));router['get']('/',auth[_0x94f7('0x9')](),controller['index']);router[_0x94f7('0xa')](_0x94f7('0xb'),auth[_0x94f7('0x9')](),controller[_0x94f7('0xc')]);router['get'](_0x94f7('0xd'),auth[_0x94f7('0x9')](),controller['show']);router['post']('/',auth[_0x94f7('0x9')](),controller['create']);router[_0x94f7('0xe')]('/:id',auth[_0x94f7('0x9')](),controller['update']);router['delete'](_0x94f7('0xd'),auth[_0x94f7('0x9')](),controller[_0x94f7('0xf')]);module[_0x94f7('0x10')]=router; \ No newline at end of file +var _0xd4c3=['update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','post','create','put'];(function(_0x394236,_0x301505){var _0x441817=function(_0x447cac){while(--_0x447cac){_0x394236['push'](_0x394236['shift']());}};_0x441817(++_0x301505);}(_0xd4c3,0x180));var _0x3d4c=function(_0x3eb4a9,_0x359d73){_0x3eb4a9=_0x3eb4a9-0x0;var _0x48dbad=_0xd4c3[_0x3eb4a9];return _0x48dbad;};'use strict';var multer=require(_0x3d4c('0x0'));var util=require(_0x3d4c('0x1'));var path=require('path');var timeout=require(_0x3d4c('0x2'));var express=require(_0x3d4c('0x3'));var router=express['Router']();var auth=require(_0x3d4c('0x4'));var interaction=require(_0x3d4c('0x5'));var config=require(_0x3d4c('0x6'));var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0x3d4c('0x7')](),controller[_0x3d4c('0x8')]);router[_0x3d4c('0x9')](_0x3d4c('0xa'),auth[_0x3d4c('0x7')](),controller[_0x3d4c('0xb')]);router[_0x3d4c('0x9')](_0x3d4c('0xc'),auth[_0x3d4c('0x7')](),controller['show']);router[_0x3d4c('0xd')]('/',auth[_0x3d4c('0x7')](),controller[_0x3d4c('0xe')]);router[_0x3d4c('0xf')](_0x3d4c('0xc'),auth[_0x3d4c('0x7')](),controller[_0x3d4c('0x10')]);router[_0x3d4c('0x11')](_0x3d4c('0xc'),auth[_0x3d4c('0x7')](),controller[_0x3d4c('0x12')]);module[_0x3d4c('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 06b5a03..d7ad7be 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 _0x8a5e=['STRING','DATE','exports'];(function(_0x28d225,_0x43be18){var _0x1f79e1=function(_0x362c23){while(--_0x362c23){_0x28d225['push'](_0x28d225['shift']());}};_0x1f79e1(++_0x43be18);}(_0x8a5e,0x74));var _0xe8a5=function(_0x56ff5e,_0x1189d7){_0x56ff5e=_0x56ff5e-0x0;var _0x373fa9=_0x8a5e[_0x56ff5e];return _0x373fa9;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xe8a5('0x0')]={'uniqueid':{'type':Sequelize[_0xe8a5('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xe8a5('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xe8a5('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe8a5('0x2')]},'reason':{'type':Sequelize[_0xe8a5('0x1')]}}; \ No newline at end of file +var _0x594a=['STRING','DATE','moment','sequelize'];(function(_0x3a0c4f,_0x5dd1a3){var _0x247049=function(_0x144695){while(--_0x144695){_0x3a0c4f['push'](_0x3a0c4f['shift']());}};_0x247049(++_0x5dd1a3);}(_0x594a,0x1e6));var _0xa594=function(_0x26189b,_0x174f72){_0x26189b=_0x26189b-0x0;var _0x11de3c=_0x594a[_0x26189b];return _0x11de3c;};'use strict';var moment=require(_0xa594('0x0'));var Sequelize=require(_0xa594('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xa594('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa594('0x2')]},'joinAt':{'type':Sequelize[_0xa594('0x3')]},'leaveAt':{'type':Sequelize[_0xa594('0x3')]},'acceptAt':{'type':Sequelize[_0xa594('0x3')]},'exitAt':{'type':Sequelize[_0xa594('0x3')]},'reason':{'type':Sequelize[_0xa594('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index a29c167..c5f8445 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 _0x9a05=['query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','catch','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','type','key','model','map','filters','intersection'];(function(_0x4bbe00,_0x1d2f14){var _0x3999d2=function(_0x4390fa){while(--_0x4390fa){_0x4bbe00['push'](_0x4bbe00['shift']());}};_0x3999d2(++_0x1d2f14);}(_0x9a05,0x1a3));var _0x59a0=function(_0xc04716,_0x30cfd6){_0xc04716=_0xc04716-0x0;var _0x7ee9da=_0x9a05[_0xc04716];return _0x7ee9da;};'use strict';var pdf=require(_0x59a0('0x0'));var emlformat=require(_0x59a0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x59a0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x59a0('0x3'));var moment=require(_0x59a0('0x4'));var BPromise=require(_0x59a0('0x5'));var Mustache=require(_0x59a0('0x6'));var util=require(_0x59a0('0x7'));var path=require('path');var sox=require(_0x59a0('0x8'));var csv=require(_0x59a0('0x9'));var ejs=require(_0x59a0('0xa'));var fs=require('fs');var _=require(_0x59a0('0xb'));var squel=require(_0x59a0('0xc'));var crypto=require(_0x59a0('0xd'));var jsforce=require(_0x59a0('0xe'));var deskjs=require(_0x59a0('0xf'));var toCsv=require(_0x59a0('0x9'));var querystring=require(_0x59a0('0x10'));var Papa=require(_0x59a0('0x11'));var Redis=require(_0x59a0('0x12'));var authService=require(_0x59a0('0x13'));var qs=require(_0x59a0('0x14'));var as=require(_0x59a0('0x15'));var hardwareService=require(_0x59a0('0x16'));var logger=require(_0x59a0('0x17'))(_0x59a0('0x18'));var utils=require('../../config/utils');var config=require(_0x59a0('0x19'));var licenseUtil=require(_0x59a0('0x1a'));var db=require(_0x59a0('0x1b'))['db'];function respondWithStatusCode(_0x258b10,_0x319b90){_0x319b90=_0x319b90||0xcc;return function(_0xfc8a17){if(_0xfc8a17){return _0x258b10[_0x59a0('0x1c')](_0x319b90);}return _0x258b10[_0x59a0('0x1d')](_0x319b90)[_0x59a0('0x1e')]();};}function respondWithResult(_0x11d28f,_0x136155){_0x136155=_0x136155||0xc8;return function(_0x4d35ce){if(_0x4d35ce){return _0x11d28f[_0x59a0('0x1d')](_0x136155)['json'](_0x4d35ce);}};}function respondWithFilteredResult(_0x144333,_0x5e36ab){return function(_0x21d384){if(_0x21d384){var _0x45fa78=_0x21d384[_0x59a0('0x1f')],_0x498a6b=_0x5e36ab[_0x59a0('0x20')],_0x58125f=_0x5e36ab[_0x59a0('0x20')]+_0x5e36ab[_0x59a0('0x21')],_0x8a1f87;if(_0x58125f>=_0x45fa78){_0x58125f=_0x45fa78;_0x8a1f87=0xc8;}else{_0x8a1f87=0xce;}_0x144333[_0x59a0('0x1d')](_0x8a1f87);return _0x144333['set'](_0x59a0('0x22'),_0x498a6b+'-'+_0x58125f+'/'+_0x45fa78)[_0x59a0('0x23')](_0x21d384);}return null;};}function patchUpdates(_0x26a763){return function(_0x47b6b6){try{jsonpatch['apply'](_0x47b6b6,_0x26a763,!![]);}catch(_0x56b6ea){return BPromise[_0x59a0('0x24')](_0x56b6ea);}return _0x47b6b6[_0x59a0('0x25')]();};}function saveUpdates(_0x35f611,_0x33a7e7){return function(_0xa8769c){if(_0xa8769c){return _0xa8769c[_0x59a0('0x26')](_0x35f611)[_0x59a0('0x27')](function(_0x3a2616){return _0x3a2616;});}return null;};}function removeEntity(_0x3d74ab,_0x45461c){return function(_0x3becdd){if(_0x3becdd){return _0x3becdd[_0x59a0('0x28')]()[_0x59a0('0x27')](function(){_0x3d74ab['status'](0xcc)[_0x59a0('0x1e')]();});}};}function handleEntityNotFound(_0x3b6bac,_0xd7d2cc){return function(_0x3034d0){if(!_0x3034d0){_0x3b6bac[_0x59a0('0x1c')](0x194);}return _0x3034d0;};}function handleError(_0x435401,_0x220153){_0x220153=_0x220153||0x1f4;return function(_0x5da300){logger[_0x59a0('0x29')](_0x5da300[_0x59a0('0x2a')]);if(_0x5da300[_0x59a0('0x2b')]){delete _0x5da300[_0x59a0('0x2b')];}_0x435401['status'](_0x220153)[_0x59a0('0x2c')](_0x5da300);};}exports[_0x59a0('0x2d')]=function(_0x35dea0,_0x42e44a){var _0x183731={},_0x12ffc6={},_0x29cdcb={'count':0x0,'rows':[]};var _0x2f7356=_['map'](db[_0x59a0('0x2e')][_0x59a0('0x2f')],function(_0xa564ef){return{'name':_0xa564ef[_0x59a0('0x30')],'type':_0xa564ef[_0x59a0('0x31')][_0x59a0('0x32')]};});_0x12ffc6[_0x59a0('0x33')]=_[_0x59a0('0x34')](_0x2f7356,_0x59a0('0x2b'));_0x12ffc6['query']=_['keys'](_0x35dea0['query']);_0x12ffc6[_0x59a0('0x35')]=_[_0x59a0('0x36')](_0x12ffc6[_0x59a0('0x33')],_0x12ffc6[_0x59a0('0x37')]);_0x183731['attributes']=_[_0x59a0('0x36')](_0x12ffc6['model'],qs[_0x59a0('0x38')](_0x35dea0[_0x59a0('0x37')]['fields']));_0x183731[_0x59a0('0x39')]=_0x183731[_0x59a0('0x39')][_0x59a0('0x3a')]?_0x183731['attributes']:_0x12ffc6[_0x59a0('0x33')];if(!_0x35dea0[_0x59a0('0x37')][_0x59a0('0x3b')](_0x59a0('0x3c'))){_0x183731['limit']=qs['limit'](_0x35dea0[_0x59a0('0x37')][_0x59a0('0x21')]);_0x183731[_0x59a0('0x20')]=qs[_0x59a0('0x20')](_0x35dea0[_0x59a0('0x37')][_0x59a0('0x20')]);}_0x183731['order']=qs[_0x59a0('0x3d')](_0x35dea0[_0x59a0('0x37')][_0x59a0('0x3d')]);_0x183731[_0x59a0('0x3e')]=qs[_0x59a0('0x35')](_['pick'](_0x35dea0[_0x59a0('0x37')],_0x12ffc6[_0x59a0('0x35')]),_0x2f7356);if(_0x35dea0['query']['filter']){_0x183731['where']=_[_0x59a0('0x3f')](_0x183731[_0x59a0('0x3e')],{'$or':_[_0x59a0('0x34')](_0x2f7356,function(_0x3101c2){if(_0x3101c2[_0x59a0('0x31')]!==_0x59a0('0x40')){var _0x5ba5f1={};_0x5ba5f1[_0x3101c2['name']]={'$like':'%'+_0x35dea0[_0x59a0('0x37')][_0x59a0('0x41')]+'%'};return _0x5ba5f1;}})});}_0x183731=_[_0x59a0('0x3f')]({},_0x183731,_0x35dea0['options']);var _0x3996bc={'where':_0x183731[_0x59a0('0x3e')]};return db[_0x59a0('0x2e')][_0x59a0('0x1f')](_0x3996bc)['then'](function(_0x44a3ac){_0x29cdcb[_0x59a0('0x1f')]=_0x44a3ac;if(_0x35dea0[_0x59a0('0x37')][_0x59a0('0x42')]){_0x183731[_0x59a0('0x43')]=[{'all':!![]}];}return db[_0x59a0('0x2e')][_0x59a0('0x44')](_0x183731);})[_0x59a0('0x27')](function(_0x300da5){_0x29cdcb[_0x59a0('0x45')]=_0x300da5;return _0x29cdcb;})[_0x59a0('0x27')](respondWithFilteredResult(_0x42e44a,_0x183731))['catch'](handleError(_0x42e44a,null));};exports[_0x59a0('0x46')]=function(_0x4e37ac,_0x10312f){var _0x82679b={'raw':!![],'where':{'id':_0x4e37ac[_0x59a0('0x47')]['id']}},_0x136c7a={};_0x136c7a[_0x59a0('0x33')]=_[_0x59a0('0x48')](db[_0x59a0('0x2e')][_0x59a0('0x2f')]);_0x136c7a[_0x59a0('0x37')]=_[_0x59a0('0x48')](_0x4e37ac['query']);_0x136c7a['filters']=_[_0x59a0('0x36')](_0x136c7a['model'],_0x136c7a[_0x59a0('0x37')]);_0x82679b[_0x59a0('0x39')]=_[_0x59a0('0x36')](_0x136c7a[_0x59a0('0x33')],qs[_0x59a0('0x38')](_0x4e37ac[_0x59a0('0x37')]['fields']));_0x82679b[_0x59a0('0x39')]=_0x82679b[_0x59a0('0x39')][_0x59a0('0x3a')]?_0x82679b[_0x59a0('0x39')]:_0x136c7a[_0x59a0('0x33')];if(_0x4e37ac[_0x59a0('0x37')]['includeAll']){_0x82679b[_0x59a0('0x43')]=[{'all':!![]}];}_0x82679b=_[_0x59a0('0x3f')]({},_0x82679b,_0x4e37ac[_0x59a0('0x49')]);return db[_0x59a0('0x2e')][_0x59a0('0x4a')](_0x82679b)['then'](handleEntityNotFound(_0x10312f,null))['then'](respondWithResult(_0x10312f,null))['catch'](handleError(_0x10312f,null));};exports['create']=function(_0x179145,_0x334b42){return db[_0x59a0('0x2e')][_0x59a0('0x4b')](_0x179145[_0x59a0('0x4c')],{})[_0x59a0('0x27')](respondWithResult(_0x334b42,0xc9))[_0x59a0('0x4d')](handleError(_0x334b42,null));};exports['update']=function(_0x204b54,_0x654561){if(_0x204b54[_0x59a0('0x4c')]['id']){delete _0x204b54['body']['id'];}return db[_0x59a0('0x2e')][_0x59a0('0x4a')]({'where':{'id':_0x204b54[_0x59a0('0x47')]['id']}})[_0x59a0('0x27')](handleEntityNotFound(_0x654561,null))['then'](saveUpdates(_0x204b54[_0x59a0('0x4c')],null))['then'](respondWithResult(_0x654561,null))[_0x59a0('0x4d')](handleError(_0x654561,null));};exports[_0x59a0('0x28')]=function(_0x2f36b9,_0x3eab8e){return db[_0x59a0('0x2e')]['find']({'where':{'id':_0x2f36b9[_0x59a0('0x47')]['id']}})[_0x59a0('0x27')](handleEntityNotFound(_0x3eab8e,null))[_0x59a0('0x27')](removeEntity(_0x3eab8e,null))[_0x59a0('0x4d')](handleError(_0x3eab8e,null));};exports['describe']=function(_0x8c12c1,_0x4c3918){return db[_0x59a0('0x2e')][_0x59a0('0x4e')]()['then'](respondWithResult(_0x4c3918,null))['catch'](handleError(_0x4c3918,null));}; \ No newline at end of file +var _0xcf29=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','limit','set','json','save','update','then','error','stack','name','index','map','MailQueueReport','fieldName','type','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','catch','show','params','length','include','find','create','body','destroy','describe','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xe9cf3,_0x140571){var _0xc2a65d=function(_0x4e1549){while(--_0x4e1549){_0xe9cf3['push'](_0xe9cf3['shift']());}};_0xc2a65d(++_0x140571);}(_0xcf29,0x108));var _0x9cf2=function(_0x55d8c5,_0x10287a){_0x55d8c5=_0x55d8c5-0x0;var _0x225ae5=_0xcf29[_0x55d8c5];return _0x225ae5;};'use strict';var pdf=require(_0x9cf2('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9cf2('0x1'));var jsonpatch=require(_0x9cf2('0x2'));var rp=require('request-promise');var moment=require(_0x9cf2('0x3'));var BPromise=require(_0x9cf2('0x4'));var Mustache=require(_0x9cf2('0x5'));var util=require(_0x9cf2('0x6'));var path=require(_0x9cf2('0x7'));var sox=require(_0x9cf2('0x8'));var csv=require(_0x9cf2('0x9'));var ejs=require(_0x9cf2('0xa'));var fs=require('fs');var _=require(_0x9cf2('0xb'));var squel=require(_0x9cf2('0xc'));var crypto=require(_0x9cf2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9cf2('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9cf2('0xf'));var Redis=require(_0x9cf2('0x10'));var authService=require(_0x9cf2('0x11'));var qs=require(_0x9cf2('0x12'));var as=require(_0x9cf2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9cf2('0x14'))('api');var utils=require(_0x9cf2('0x15'));var config=require(_0x9cf2('0x16'));var licenseUtil=require(_0x9cf2('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x587431,_0xef36b3){_0xef36b3=_0xef36b3||0xcc;return function(_0x3af204){if(_0x3af204){return _0x587431[_0x9cf2('0x18')](_0xef36b3);}return _0x587431[_0x9cf2('0x19')](_0xef36b3)[_0x9cf2('0x1a')]();};}function respondWithResult(_0x2dca10,_0x54e46f){_0x54e46f=_0x54e46f||0xc8;return function(_0x287842){if(_0x287842){return _0x2dca10[_0x9cf2('0x19')](_0x54e46f)['json'](_0x287842);}};}function respondWithFilteredResult(_0x5c1bbf,_0x25e256){return function(_0xb33d0c){if(_0xb33d0c){var _0x1617e4=_0xb33d0c[_0x9cf2('0x1b')],_0x459c54=_0x25e256[_0x9cf2('0x1c')],_0x1f6aff=_0x25e256['offset']+_0x25e256[_0x9cf2('0x1d')],_0x4e2a09;if(_0x1f6aff>=_0x1617e4){_0x1f6aff=_0x1617e4;_0x4e2a09=0xc8;}else{_0x4e2a09=0xce;}_0x5c1bbf[_0x9cf2('0x19')](_0x4e2a09);return _0x5c1bbf[_0x9cf2('0x1e')]('Content-Range',_0x459c54+'-'+_0x1f6aff+'/'+_0x1617e4)[_0x9cf2('0x1f')](_0xb33d0c);}return null;};}function patchUpdates(_0xb245bd){return function(_0x1d1661){try{jsonpatch['apply'](_0x1d1661,_0xb245bd,!![]);}catch(_0x546900){return BPromise['reject'](_0x546900);}return _0x1d1661[_0x9cf2('0x20')]();};}function saveUpdates(_0x13fa38,_0x245a55){return function(_0x399be4){if(_0x399be4){return _0x399be4[_0x9cf2('0x21')](_0x13fa38)[_0x9cf2('0x22')](function(_0x210254){return _0x210254;});}return null;};}function removeEntity(_0x3973a0,_0x15900c){return function(_0x1acf4d){if(_0x1acf4d){return _0x1acf4d['destroy']()[_0x9cf2('0x22')](function(){_0x3973a0[_0x9cf2('0x19')](0xcc)[_0x9cf2('0x1a')]();});}};}function handleEntityNotFound(_0x3ec842,_0xa5445a){return function(_0x2624ab){if(!_0x2624ab){_0x3ec842[_0x9cf2('0x18')](0x194);}return _0x2624ab;};}function handleError(_0x1a0a6f,_0x281104){_0x281104=_0x281104||0x1f4;return function(_0x5ecb6f){logger[_0x9cf2('0x23')](_0x5ecb6f[_0x9cf2('0x24')]);if(_0x5ecb6f[_0x9cf2('0x25')]){delete _0x5ecb6f['name'];}_0x1a0a6f[_0x9cf2('0x19')](_0x281104)['send'](_0x5ecb6f);};}exports[_0x9cf2('0x26')]=function(_0x2b5382,_0x506321){var _0x2a7b1f={},_0x2fecf1={},_0x58c8f8={'count':0x0,'rows':[]};var _0xb68746=_[_0x9cf2('0x27')](db[_0x9cf2('0x28')]['rawAttributes'],function(_0x41bbc3){return{'name':_0x41bbc3[_0x9cf2('0x29')],'type':_0x41bbc3[_0x9cf2('0x2a')]['key']};});_0x2fecf1['model']=_['map'](_0xb68746,_0x9cf2('0x25'));_0x2fecf1['query']=_[_0x9cf2('0x2b')](_0x2b5382[_0x9cf2('0x2c')]);_0x2fecf1['filters']=_[_0x9cf2('0x2d')](_0x2fecf1[_0x9cf2('0x2e')],_0x2fecf1[_0x9cf2('0x2c')]);_0x2a7b1f[_0x9cf2('0x2f')]=_[_0x9cf2('0x2d')](_0x2fecf1[_0x9cf2('0x2e')],qs[_0x9cf2('0x30')](_0x2b5382[_0x9cf2('0x2c')][_0x9cf2('0x30')]));_0x2a7b1f['attributes']=_0x2a7b1f[_0x9cf2('0x2f')]['length']?_0x2a7b1f['attributes']:_0x2fecf1[_0x9cf2('0x2e')];if(!_0x2b5382[_0x9cf2('0x2c')][_0x9cf2('0x31')](_0x9cf2('0x32'))){_0x2a7b1f[_0x9cf2('0x1d')]=qs['limit'](_0x2b5382['query'][_0x9cf2('0x1d')]);_0x2a7b1f['offset']=qs[_0x9cf2('0x1c')](_0x2b5382[_0x9cf2('0x2c')][_0x9cf2('0x1c')]);}_0x2a7b1f[_0x9cf2('0x33')]=qs[_0x9cf2('0x34')](_0x2b5382[_0x9cf2('0x2c')][_0x9cf2('0x34')]);_0x2a7b1f[_0x9cf2('0x35')]=qs['filters'](_[_0x9cf2('0x36')](_0x2b5382[_0x9cf2('0x2c')],_0x2fecf1[_0x9cf2('0x37')]),_0xb68746);if(_0x2b5382[_0x9cf2('0x2c')][_0x9cf2('0x38')]){_0x2a7b1f[_0x9cf2('0x35')]=_['merge'](_0x2a7b1f[_0x9cf2('0x35')],{'$or':_[_0x9cf2('0x27')](_0xb68746,function(_0x5d4a04){if(_0x5d4a04[_0x9cf2('0x2a')]!==_0x9cf2('0x39')){var _0x25c742={};_0x25c742[_0x5d4a04[_0x9cf2('0x25')]]={'$like':'%'+_0x2b5382[_0x9cf2('0x2c')][_0x9cf2('0x38')]+'%'};return _0x25c742;}})});}_0x2a7b1f=_[_0x9cf2('0x3a')]({},_0x2a7b1f,_0x2b5382[_0x9cf2('0x3b')]);var _0x3ff488={'where':_0x2a7b1f['where']};return db[_0x9cf2('0x28')][_0x9cf2('0x1b')](_0x3ff488)[_0x9cf2('0x22')](function(_0x3835b3){_0x58c8f8[_0x9cf2('0x1b')]=_0x3835b3;if(_0x2b5382[_0x9cf2('0x2c')][_0x9cf2('0x3c')]){_0x2a7b1f['include']=[{'all':!![]}];}return db[_0x9cf2('0x28')]['findAll'](_0x2a7b1f);})['then'](function(_0x2c3ece){_0x58c8f8['rows']=_0x2c3ece;return _0x58c8f8;})[_0x9cf2('0x22')](respondWithFilteredResult(_0x506321,_0x2a7b1f))[_0x9cf2('0x3d')](handleError(_0x506321,null));};exports[_0x9cf2('0x3e')]=function(_0x1db3eb,_0x45f7ef){var _0x407d51={'raw':!![],'where':{'id':_0x1db3eb[_0x9cf2('0x3f')]['id']}},_0x68e05d={};_0x68e05d[_0x9cf2('0x2e')]=_[_0x9cf2('0x2b')](db['MailQueueReport']['rawAttributes']);_0x68e05d[_0x9cf2('0x2c')]=_['keys'](_0x1db3eb[_0x9cf2('0x2c')]);_0x68e05d['filters']=_[_0x9cf2('0x2d')](_0x68e05d[_0x9cf2('0x2e')],_0x68e05d[_0x9cf2('0x2c')]);_0x407d51[_0x9cf2('0x2f')]=_[_0x9cf2('0x2d')](_0x68e05d[_0x9cf2('0x2e')],qs['fields'](_0x1db3eb[_0x9cf2('0x2c')][_0x9cf2('0x30')]));_0x407d51[_0x9cf2('0x2f')]=_0x407d51[_0x9cf2('0x2f')][_0x9cf2('0x40')]?_0x407d51[_0x9cf2('0x2f')]:_0x68e05d[_0x9cf2('0x2e')];if(_0x1db3eb[_0x9cf2('0x2c')]['includeAll']){_0x407d51[_0x9cf2('0x41')]=[{'all':!![]}];}_0x407d51=_[_0x9cf2('0x3a')]({},_0x407d51,_0x1db3eb[_0x9cf2('0x3b')]);return db[_0x9cf2('0x28')][_0x9cf2('0x42')](_0x407d51)[_0x9cf2('0x22')](handleEntityNotFound(_0x45f7ef,null))[_0x9cf2('0x22')](respondWithResult(_0x45f7ef,null))[_0x9cf2('0x3d')](handleError(_0x45f7ef,null));};exports['create']=function(_0xe00322,_0x1d3ee4){return db[_0x9cf2('0x28')][_0x9cf2('0x43')](_0xe00322['body'],{})[_0x9cf2('0x22')](respondWithResult(_0x1d3ee4,0xc9))[_0x9cf2('0x3d')](handleError(_0x1d3ee4,null));};exports[_0x9cf2('0x21')]=function(_0x53cb9b,_0x5aff5c){if(_0x53cb9b['body']['id']){delete _0x53cb9b[_0x9cf2('0x44')]['id'];}return db['MailQueueReport'][_0x9cf2('0x42')]({'where':{'id':_0x53cb9b[_0x9cf2('0x3f')]['id']}})[_0x9cf2('0x22')](handleEntityNotFound(_0x5aff5c,null))[_0x9cf2('0x22')](saveUpdates(_0x53cb9b[_0x9cf2('0x44')],null))[_0x9cf2('0x22')](respondWithResult(_0x5aff5c,null))[_0x9cf2('0x3d')](handleError(_0x5aff5c,null));};exports[_0x9cf2('0x45')]=function(_0x3cdd8f,_0x6b6f9a){return db[_0x9cf2('0x28')][_0x9cf2('0x42')]({'where':{'id':_0x3cdd8f[_0x9cf2('0x3f')]['id']}})[_0x9cf2('0x22')](handleEntityNotFound(_0x6b6f9a,null))[_0x9cf2('0x22')](removeEntity(_0x6b6f9a,null))[_0x9cf2('0x3d')](handleError(_0x6b6f9a,null));};exports[_0x9cf2('0x46')]=function(_0xc9fb33,_0x12053c){return db['MailQueueReport'][_0x9cf2('0x46')]()['then'](respondWithResult(_0x12053c,null))[_0x9cf2('0x3d')](handleError(_0x12053c,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 2d669fb..c64e447 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 _0x6dc9=['moment','bluebird','rimraf','../../config/environment','exports','define','MailQueueReport','uniqueid','lodash','util','api'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0x6dc9,0x1ec));var _0x96dc=function(_0x1f040a,_0x314f9e){_0x1f040a=_0x1f040a-0x0;var _0x575c11=_0x6dc9[_0x1f040a];return _0x575c11;};'use strict';var _=require(_0x96dc('0x0'));var util=require(_0x96dc('0x1'));var logger=require('../../config/logger')(_0x96dc('0x2'));var moment=require(_0x96dc('0x3'));var BPromise=require(_0x96dc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x96dc('0x5'));var config=require(_0x96dc('0x6'));var attributes=require('./mailQueueReport.attributes');module[_0x96dc('0x7')]=function(_0x59c5e8,_0x2e955d){return _0x59c5e8[_0x96dc('0x8')](_0x96dc('0x9'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x96dc('0xa'),'fields':[_0x96dc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x94c8=['uniqueid','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue'];(function(_0x38dc93,_0xc9908){var _0x34e669=function(_0x5f116b){while(--_0x5f116b){_0x38dc93['push'](_0x38dc93['shift']());}};_0x34e669(++_0xc9908);}(_0x94c8,0x12a));var _0x894c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x94c8[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x894c('0x0'));var logger=require(_0x894c('0x1'))('api');var moment=require('moment');var BPromise=require(_0x894c('0x2'));var rp=require(_0x894c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x894c('0x4'));var config=require(_0x894c('0x5'));var attributes=require(_0x894c('0x6'));module['exports']=function(_0x53948f,_0x754974){return _0x53948f[_0x894c('0x7')](_0x894c('0x8'),attributes,{'tableName':_0x894c('0x9'),'paranoid':![],'indexes':[{'name':_0x894c('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 3787777..ad35ee8 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 _0x3539=['update','raw','where','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','MailQueueReport','create','body','options','CreateMailQueueReport','UpdateMailQueueReport'];(function(_0x4d9bb2,_0x3db50d){var _0x3179fe=function(_0x5272f3){while(--_0x5272f3){_0x4d9bb2['push'](_0x4d9bb2['shift']());}};_0x3179fe(++_0x3db50d);}(_0x3539,0x67));var _0x9353=function(_0x176783,_0x395a26){_0x176783=_0x176783-0x0;var _0x7770a2=_0x3539[_0x176783];return _0x7770a2;};'use strict';var _=require('lodash');var util=require(_0x9353('0x0'));var moment=require(_0x9353('0x1'));var BPromise=require(_0x9353('0x2'));var rs=require(_0x9353('0x3'));var fs=require('fs');var Redis=require(_0x9353('0x4'));var db=require(_0x9353('0x5'))['db'];var utils=require(_0x9353('0x6'));var logger=require(_0x9353('0x7'))(_0x9353('0x8'));var config=require(_0x9353('0x9'));var jayson=require(_0x9353('0xa'));var client=jayson['client'][_0x9353('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x63b55f,_0x4f46d0,_0x39f7f9){return new BPromise(function(_0x2f6e34,_0x19bf85){return client[_0x9353('0xc')](_0x63b55f,_0x39f7f9)[_0x9353('0xd')](function(_0x77a7bc){logger[_0x9353('0xe')](_0x9353('0xf'),_0x4f46d0,_0x9353('0x10'));logger[_0x9353('0x11')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x4f46d0,_0x9353('0x10'),JSON[_0x9353('0x12')](_0x77a7bc));if(_0x77a7bc['error']){if(_0x77a7bc[_0x9353('0x13')]['code']===0x1f4){logger[_0x9353('0x13')](_0x9353('0xf'),_0x4f46d0,_0x77a7bc['error'][_0x9353('0x14')]);return _0x19bf85(_0x77a7bc[_0x9353('0x13')][_0x9353('0x14')]);}logger[_0x9353('0x13')](_0x9353('0xf'),_0x4f46d0,_0x77a7bc['error']['message']);return _0x2f6e34(_0x77a7bc[_0x9353('0x13')]['message']);}else{logger[_0x9353('0xe')](_0x9353('0xf'),_0x4f46d0,'request\x20sent');_0x2f6e34(_0x77a7bc[_0x9353('0x15')][_0x9353('0x14')]);}})[_0x9353('0x16')](function(_0x19dfdc){logger[_0x9353('0x13')](_0x9353('0xf'),_0x4f46d0,_0x19dfdc);_0x19bf85(_0x19dfdc);});});}exports['CreateMailQueueReport']=function(_0x28ebf5){var _0xfe8ba9=this;return new Promise(function(_0x163a5d,_0x4a9655){return db[_0x9353('0x17')][_0x9353('0x18')](_0x28ebf5[_0x9353('0x19')],{'raw':_0x28ebf5['options']?_0x28ebf5[_0x9353('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x9353('0xd')](function(_0x2c0cac){logger[_0x9353('0xe')](_0x9353('0x1b'),_0x28ebf5);logger[_0x9353('0x11')](_0x9353('0x1b'),_0x28ebf5,JSON[_0x9353('0x12')](_0x2c0cac));_0x163a5d(_0x2c0cac);})[_0x9353('0x16')](function(_0x5a21d9){logger[_0x9353('0x13')](_0x9353('0x1b'),_0x5a21d9[_0x9353('0x14')],_0x28ebf5);_0x4a9655(_0xfe8ba9[_0x9353('0x13')](0x1f4,_0x5a21d9[_0x9353('0x14')]));});});};exports[_0x9353('0x1c')]=function(_0x1ef609){var _0xa70aad=this;return new Promise(function(_0x5eb15a,_0x3fba54){return db[_0x9353('0x17')][_0x9353('0x1d')](_0x1ef609[_0x9353('0x19')],{'raw':_0x1ef609[_0x9353('0x1a')]?_0x1ef609[_0x9353('0x1a')][_0x9353('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ef609['options']?_0x1ef609[_0x9353('0x1a')][_0x9353('0x1f')]||null:null,'attributes':_0x1ef609[_0x9353('0x1a')]?_0x1ef609[_0x9353('0x1a')]['attributes']||null:null,'limit':_0x1ef609[_0x9353('0x1a')]?_0x1ef609[_0x9353('0x1a')][_0x9353('0x20')]||null:null})[_0x9353('0xd')](function(_0x3e88f5){logger['info'](_0x9353('0x1c'),_0x1ef609);logger[_0x9353('0x11')]('UpdateMailQueueReport',_0x1ef609,JSON['stringify'](_0x3e88f5));_0x5eb15a(_0x3e88f5);})[_0x9353('0x16')](function(_0x5b4a16){logger[_0x9353('0x13')](_0x9353('0x1c'),_0x5b4a16[_0x9353('0x14')],_0x1ef609);_0x3fba54(_0xa70aad['error'](0x1f4,_0x5b4a16[_0x9353('0x14')]));});});}; \ No newline at end of file +var _0x96dc=['client','http','request','then','MailQueueReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','CreateMailQueueReport','MailQueueReport','create','options','raw','info','stringify','UpdateMailQueueReport','update','body','where','attributes','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x25ff14,_0x384501){var _0x1eef4d=function(_0x6df658){while(--_0x6df658){_0x25ff14['push'](_0x25ff14['shift']());}};_0x1eef4d(++_0x384501);}(_0x96dc,0x176));var _0xc96d=function(_0x3d4652,_0x36d3aa){_0x3d4652=_0x3d4652-0x0;var _0x5319a0=_0x96dc[_0x3d4652];return _0x5319a0;};'use strict';var _=require(_0xc96d('0x0'));var util=require(_0xc96d('0x1'));var moment=require(_0xc96d('0x2'));var BPromise=require(_0xc96d('0x3'));var rs=require(_0xc96d('0x4'));var fs=require('fs');var Redis=require(_0xc96d('0x5'));var db=require(_0xc96d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc96d('0x7'))(_0xc96d('0x8'));var config=require(_0xc96d('0x9'));var jayson=require(_0xc96d('0xa'));var client=jayson[_0xc96d('0xb')][_0xc96d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b3b62,_0x1df51a,_0x4335fa){return new BPromise(function(_0x53ee86,_0x181e68){return client[_0xc96d('0xd')](_0x1b3b62,_0x4335fa)[_0xc96d('0xe')](function(_0x563638){logger['info'](_0xc96d('0xf'),_0x1df51a,'request\x20sent');logger[_0xc96d('0x10')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x1df51a,_0xc96d('0x11'),JSON['stringify'](_0x563638));if(_0x563638[_0xc96d('0x12')]){if(_0x563638[_0xc96d('0x12')][_0xc96d('0x13')]===0x1f4){logger[_0xc96d('0x12')]('MailQueueReport,\x20%s,\x20%s',_0x1df51a,_0x563638[_0xc96d('0x12')][_0xc96d('0x14')]);return _0x181e68(_0x563638[_0xc96d('0x12')][_0xc96d('0x14')]);}logger[_0xc96d('0x12')](_0xc96d('0xf'),_0x1df51a,_0x563638[_0xc96d('0x12')][_0xc96d('0x14')]);return _0x53ee86(_0x563638['error'][_0xc96d('0x14')]);}else{logger['info']('MailQueueReport,\x20%s,\x20%s',_0x1df51a,_0xc96d('0x11'));_0x53ee86(_0x563638[_0xc96d('0x15')][_0xc96d('0x14')]);}})['catch'](function(_0x48ca9f){logger[_0xc96d('0x12')](_0xc96d('0xf'),_0x1df51a,_0x48ca9f);_0x181e68(_0x48ca9f);});});}exports[_0xc96d('0x16')]=function(_0xf66a0c){var _0x3f6d20=this;return new Promise(function(_0x1c51fd,_0x57f0b8){return db[_0xc96d('0x17')][_0xc96d('0x18')](_0xf66a0c['body'],{'raw':_0xf66a0c[_0xc96d('0x19')]?_0xf66a0c[_0xc96d('0x19')][_0xc96d('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x39b37b){logger[_0xc96d('0x1b')](_0xc96d('0x16'),_0xf66a0c);logger['debug'](_0xc96d('0x16'),_0xf66a0c,JSON[_0xc96d('0x1c')](_0x39b37b));_0x1c51fd(_0x39b37b);})['catch'](function(_0x15a36a){logger[_0xc96d('0x12')]('CreateMailQueueReport',_0x15a36a[_0xc96d('0x14')],_0xf66a0c);_0x57f0b8(_0x3f6d20['error'](0x1f4,_0x15a36a[_0xc96d('0x14')]));});});};exports[_0xc96d('0x1d')]=function(_0x10916d){var _0x26933a=this;return new Promise(function(_0xcbda41,_0x5c4ddf){return db[_0xc96d('0x17')][_0xc96d('0x1e')](_0x10916d[_0xc96d('0x1f')],{'raw':_0x10916d[_0xc96d('0x19')]?_0x10916d[_0xc96d('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10916d[_0xc96d('0x19')]?_0x10916d[_0xc96d('0x19')][_0xc96d('0x20')]||null:null,'attributes':_0x10916d[_0xc96d('0x19')]?_0x10916d[_0xc96d('0x19')][_0xc96d('0x21')]||null:null,'limit':_0x10916d[_0xc96d('0x19')]?_0x10916d['options']['limit']||null:null})[_0xc96d('0xe')](function(_0x401a6e){logger['info'](_0xc96d('0x1d'),_0x10916d);logger[_0xc96d('0x10')](_0xc96d('0x1d'),_0x10916d,JSON[_0xc96d('0x1c')](_0x401a6e));_0xcbda41(_0x401a6e);})[_0xc96d('0x22')](function(_0x152dfb){logger['error']('UpdateMailQueueReport',_0x152dfb['message'],_0x10916d);_0x5c4ddf(_0x26933a[_0xc96d('0x12')](0x1f4,_0x152dfb[_0xc96d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index d8b94c3..d9f92f8 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 _0x9ce5=['express','Router','../../components/interaction/service','../../config/environment','exports','multer','connect-timeout'];(function(_0x4189a2,_0x4fd289){var _0x1611c5=function(_0xf4749b){while(--_0xf4749b){_0x4189a2['push'](_0x4189a2['shift']());}};_0x1611c5(++_0x4fd289);}(_0x9ce5,0x108));var _0x59ce=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x9ce5[_0x9dfc10];return _0x4f938a;};'use strict';var multer=require(_0x59ce('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x59ce('0x1'));var express=require(_0x59ce('0x2'));var router=express[_0x59ce('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x59ce('0x4'));var config=require(_0x59ce('0x5'));module[_0x59ce('0x6')]=router; \ No newline at end of file +var _0x4ce9=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x160015,_0x2c823b){var _0x431f99=function(_0x85f1c3){while(--_0x85f1c3){_0x160015['push'](_0x160015['shift']());}};_0x431f99(++_0x2c823b);}(_0x4ce9,0x197));var _0x94ce=function(_0x5d8eb6,_0x1840a3){_0x5d8eb6=_0x5d8eb6-0x0;var _0x516134=_0x4ce9[_0x5d8eb6];return _0x516134;};'use strict';var multer=require(_0x94ce('0x0'));var util=require('util');var path=require(_0x94ce('0x1'));var timeout=require(_0x94ce('0x2'));var express=require(_0x94ce('0x3'));var router=express[_0x94ce('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x94ce('0x5'));var config=require(_0x94ce('0x6'));module[_0x94ce('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index e50b5b2..3b2eef4 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 _0x658b=['sequelize','exports','STRING','BOOLEAN','username','INTEGER'];(function(_0x2eea9a,_0x368daf){var _0x1ec61e=function(_0x1fc2fc){while(--_0x1fc2fc){_0x2eea9a['push'](_0x2eea9a['shift']());}};_0x1ec61e(++_0x368daf);}(_0x658b,0x156));var _0xb658=function(_0x129a3c,_0x27c4ff){_0x129a3c=_0x129a3c-0x0;var _0x3a100e=_0x658b[_0x129a3c];return _0x3a100e;};'use strict';var Sequelize=require(_0xb658('0x0'));module[_0xb658('0x1')]={'description':{'type':Sequelize[_0xb658('0x2')]},'host':{'type':Sequelize[_0xb658('0x2')]},'authentication':{'type':Sequelize[_0xb658('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xb658('0x2')],'unique':_0xb658('0x4')},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xb658('0x5')]},'tls':{'type':Sequelize[_0xb658('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xb658('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xb658('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xb658('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0xb658('0x2')]}}; \ No newline at end of file +var _0xd803=['exports','STRING','INTEGER','BOOLEAN','INBOX','sequelize'];(function(_0x20dbbe,_0x2d93cb){var _0x34fa5e=function(_0x340192){while(--_0x340192){_0x20dbbe['push'](_0x20dbbe['shift']());}};_0x34fa5e(++_0x2d93cb);}(_0xd803,0xd1));var _0x3d80=function(_0x46a134,_0x5272ac){_0x46a134=_0x46a134-0x0;var _0x1c0108=_0xd803[_0x46a134];return _0x1c0108;};'use strict';var Sequelize=require(_0x3d80('0x0'));module[_0x3d80('0x1')]={'description':{'type':Sequelize[_0x3d80('0x2')]},'host':{'type':Sequelize[_0x3d80('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x3d80('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x3d80('0x2')]},'port':{'type':Sequelize[_0x3d80('0x3')]},'tls':{'type':Sequelize[_0x3d80('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x3d80('0x2')],'defaultValue':_0x3d80('0x5')},'connTimeout':{'type':Sequelize[_0x3d80('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x3d80('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 712530d..4a98876 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 _0x087b=['../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','moment','request-promise','path','rimraf'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x087b,0x11a));var _0xb087=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x087b[_0x4a3898];return _0x25ceb0;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb087('0x2'));var BPromise=require('bluebird');var rp=require(_0xb087('0x3'));var fs=require('fs');var path=require(_0xb087('0x4'));var rimraf=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var attributes=require(_0xb087('0x7'));module[_0xb087('0x8')]=function(_0x40156d,_0x17d6e8){return _0x40156d[_0xb087('0x9')](_0xb087('0xa'),attributes,{'tableName':_0xb087('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bc6=['request-promise','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2a1110,_0x269e2d){var _0x5efbb0=function(_0x5272d4){while(--_0x5272d4){_0x2a1110['push'](_0x2a1110['shift']());}};_0x5efbb0(++_0x269e2d);}(_0x1bc6,0x94));var _0x61bc=function(_0x44ef27,_0xfe257a){_0x44ef27=_0x44ef27-0x0;var _0x2cb640=_0x1bc6[_0x44ef27];return _0x2cb640;};'use strict';var _=require(_0x61bc('0x0'));var util=require(_0x61bc('0x1'));var logger=require(_0x61bc('0x2'))(_0x61bc('0x3'));var moment=require(_0x61bc('0x4'));var BPromise=require(_0x61bc('0x5'));var rp=require(_0x61bc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x61bc('0x7'));var config=require(_0x61bc('0x8'));var attributes=require(_0x61bc('0x9'));module[_0x61bc('0xa')]=function(_0x362ebb,_0x1af9bc){return _0x362ebb[_0x61bc('0xb')](_0x61bc('0xc'),attributes,{'tableName':_0x61bc('0xd'),'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 0d840ce..69cf004 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 _0x22cc=['randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','message','error','result','catch','GetMailServerIn','MailServerIn','findAll','options','where','attributes','limit','map','include','model','lodash','moment','bluebird'];(function(_0x265a5,_0x57fea9){var _0x3e681a=function(_0x4abee4){while(--_0x4abee4){_0x265a5['push'](_0x265a5['shift']());}};_0x3e681a(++_0x57fea9);}(_0x22cc,0x15d));var _0xc22c=function(_0x260e4b,_0x54668d){_0x260e4b=_0x260e4b-0x0;var _0x18dfba=_0x22cc[_0x260e4b];return _0x18dfba;};'use strict';var _=require(_0xc22c('0x0'));var util=require('util');var moment=require(_0xc22c('0x1'));var BPromise=require(_0xc22c('0x2'));var rs=require(_0xc22c('0x3'));var fs=require('fs');var Redis=require(_0xc22c('0x4'));var db=require(_0xc22c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc22c('0x6'));var jayson=require(_0xc22c('0x7'));var client=jayson[_0xc22c('0x8')][_0xc22c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23ba4a,_0x2bf8ba,_0xb0a17a){return new BPromise(function(_0x2b2893,_0x36c3e8){return client[_0xc22c('0xa')](_0x23ba4a,_0xb0a17a)[_0xc22c('0xb')](function(_0x31c9ab){logger[_0xc22c('0xc')](_0xc22c('0xd'),_0x2bf8ba,_0xc22c('0xe'));logger[_0xc22c('0xf')](_0xc22c('0x10'),_0x2bf8ba,'request\x20sent',JSON[_0xc22c('0x11')](_0x31c9ab));if(_0x31c9ab['error']){if(_0x31c9ab['error']['code']===0x1f4){logger['error'](_0xc22c('0xd'),_0x2bf8ba,_0x31c9ab['error']['message']);return _0x36c3e8(_0x31c9ab['error'][_0xc22c('0x12')]);}logger[_0xc22c('0x13')](_0xc22c('0xd'),_0x2bf8ba,_0x31c9ab['error']['message']);return _0x2b2893(_0x31c9ab['error'][_0xc22c('0x12')]);}else{logger[_0xc22c('0xc')](_0xc22c('0xd'),_0x2bf8ba,_0xc22c('0xe'));_0x2b2893(_0x31c9ab[_0xc22c('0x14')][_0xc22c('0x12')]);}})[_0xc22c('0x15')](function(_0x4f4e9f){logger['error'](_0xc22c('0xd'),_0x2bf8ba,_0x4f4e9f);_0x36c3e8(_0x4f4e9f);});});}exports[_0xc22c('0x16')]=function(_0x27bd6){var _0x4b21e0=this;return new Promise(function(_0x27ea13,_0x508b3a){return db[_0xc22c('0x17')][_0xc22c('0x18')]({'raw':_0x27bd6[_0xc22c('0x19')]?_0x27bd6[_0xc22c('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x27bd6[_0xc22c('0x19')]?_0x27bd6[_0xc22c('0x19')][_0xc22c('0x1a')]||null:null,'attributes':_0x27bd6['options']?_0x27bd6[_0xc22c('0x19')][_0xc22c('0x1b')]||null:null,'limit':_0x27bd6[_0xc22c('0x19')]?_0x27bd6[_0xc22c('0x19')][_0xc22c('0x1c')]||null:null,'include':_0x27bd6['options']?_0x27bd6[_0xc22c('0x19')]['include']?_[_0xc22c('0x1d')](_0x27bd6['options'][_0xc22c('0x1e')],function(_0x208fd2){return{'model':db[_0x208fd2[_0xc22c('0x1f')]],'as':_0x208fd2['as'],'attributes':_0x208fd2[_0xc22c('0x1b')],'include':_0x208fd2[_0xc22c('0x1e')]?_['map'](_0x208fd2['include'],function(_0x221cd1){return{'model':db[_0x221cd1[_0xc22c('0x1f')]],'as':_0x221cd1['as'],'attributes':_0x221cd1[_0xc22c('0x1b')],'include':_0x221cd1['include']?_[_0xc22c('0x1d')](_0x221cd1[_0xc22c('0x1e')],function(_0xc5dedf){return{'model':db[_0xc5dedf[_0xc22c('0x1f')]],'as':_0xc5dedf['as'],'attributes':_0xc5dedf['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x27edcd){logger[_0xc22c('0xc')](_0xc22c('0x16'),_0x27bd6);logger['debug'](_0xc22c('0x16'),_0x27bd6,JSON[_0xc22c('0x11')](_0x27edcd));_0x27ea13(_0x27edcd);})['catch'](function(_0x3485d5){logger[_0xc22c('0x13')]('GetMailServerIn',_0x3485d5[_0xc22c('0x12')],_0x27bd6);_0x508b3a(_0x4b21e0['error'](0x1f4,_0x3485d5[_0xc22c('0x12')]));});});}; \ No newline at end of file +var _0x541d=['catch','GetMailServerIn','MailServerIn','findAll','options','where','limit','map','include','model','attributes','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x13398f,_0x1d2f28){var _0xa6b507=function(_0x2545b4){while(--_0x2545b4){_0x13398f['push'](_0x13398f['shift']());}};_0xa6b507(++_0x1d2f28);}(_0x541d,0xcb));var _0xd541=function(_0xfb318e,_0x2dd346){_0xfb318e=_0xfb318e-0x0;var _0x58bf96=_0x541d[_0xfb318e];return _0x58bf96;};'use strict';var _=require(_0xd541('0x0'));var util=require(_0xd541('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd541('0x2'));var fs=require('fs');var Redis=require(_0xd541('0x3'));var db=require(_0xd541('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd541('0x5'))('rpc');var config=require(_0xd541('0x6'));var jayson=require(_0xd541('0x7'));var client=jayson[_0xd541('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53d047,_0x3e3c44,_0x53c2f9){return new BPromise(function(_0x3e6613,_0x1117b1){return client[_0xd541('0x9')](_0x53d047,_0x53c2f9)[_0xd541('0xa')](function(_0x260089){logger[_0xd541('0xb')](_0xd541('0xc'),_0x3e3c44,_0xd541('0xd'));logger[_0xd541('0xe')](_0xd541('0xf'),_0x3e3c44,_0xd541('0xd'),JSON[_0xd541('0x10')](_0x260089));if(_0x260089[_0xd541('0x11')]){if(_0x260089[_0xd541('0x11')][_0xd541('0x12')]===0x1f4){logger[_0xd541('0x11')]('MailServerIn,\x20%s,\x20%s',_0x3e3c44,_0x260089[_0xd541('0x11')][_0xd541('0x13')]);return _0x1117b1(_0x260089[_0xd541('0x11')][_0xd541('0x13')]);}logger[_0xd541('0x11')]('MailServerIn,\x20%s,\x20%s',_0x3e3c44,_0x260089[_0xd541('0x11')][_0xd541('0x13')]);return _0x3e6613(_0x260089[_0xd541('0x11')][_0xd541('0x13')]);}else{logger[_0xd541('0xb')](_0xd541('0xc'),_0x3e3c44,_0xd541('0xd'));_0x3e6613(_0x260089[_0xd541('0x14')][_0xd541('0x13')]);}})[_0xd541('0x15')](function(_0x7e3345){logger[_0xd541('0x11')](_0xd541('0xc'),_0x3e3c44,_0x7e3345);_0x1117b1(_0x7e3345);});});}exports[_0xd541('0x16')]=function(_0xd7dd40){var _0x2183f9=this;return new Promise(function(_0x37a667,_0x52c57d){return db[_0xd541('0x17')][_0xd541('0x18')]({'raw':_0xd7dd40['options']?_0xd7dd40['options']['raw']===undefined?!![]:![]:!![],'where':_0xd7dd40[_0xd541('0x19')]?_0xd7dd40[_0xd541('0x19')][_0xd541('0x1a')]||null:null,'attributes':_0xd7dd40['options']?_0xd7dd40['options']['attributes']||null:null,'limit':_0xd7dd40[_0xd541('0x19')]?_0xd7dd40[_0xd541('0x19')][_0xd541('0x1b')]||null:null,'include':_0xd7dd40['options']?_0xd7dd40['options']['include']?_[_0xd541('0x1c')](_0xd7dd40[_0xd541('0x19')][_0xd541('0x1d')],function(_0x3a8305){return{'model':db[_0x3a8305[_0xd541('0x1e')]],'as':_0x3a8305['as'],'attributes':_0x3a8305[_0xd541('0x1f')],'include':_0x3a8305[_0xd541('0x1d')]?_[_0xd541('0x1c')](_0x3a8305['include'],function(_0x441c4a){return{'model':db[_0x441c4a[_0xd541('0x1e')]],'as':_0x441c4a['as'],'attributes':_0x441c4a[_0xd541('0x1f')],'include':_0x441c4a[_0xd541('0x1d')]?_['map'](_0x441c4a[_0xd541('0x1d')],function(_0x2e79e9){return{'model':db[_0x2e79e9['model']],'as':_0x2e79e9['as'],'attributes':_0x2e79e9[_0xd541('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd541('0xa')](function(_0x381a6c){logger[_0xd541('0xb')](_0xd541('0x16'),_0xd7dd40);logger[_0xd541('0xe')](_0xd541('0x16'),_0xd7dd40,JSON[_0xd541('0x10')](_0x381a6c));_0x37a667(_0x381a6c);})[_0xd541('0x15')](function(_0x45aa27){logger['error']('GetMailServerIn',_0x45aa27[_0xd541('0x13')],_0xd7dd40);_0x52c57d(_0x2183f9[_0xd541('0x11')](0x1f4,_0x45aa27[_0xd541('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 2cfb8ab..62f35ef 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 _0x67ae=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','index','/:id','show','post','isAuthenticated','create','put','update','delete','multer','util','path'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x67ae,0x101));var _0xe67a=function(_0x43b21a,_0x7a37ab){_0x43b21a=_0x43b21a-0x0;var _0x39dbc7=_0x67ae[_0x43b21a];return _0x39dbc7;};'use strict';var multer=require(_0xe67a('0x0'));var util=require(_0xe67a('0x1'));var path=require(_0xe67a('0x2'));var timeout=require(_0xe67a('0x3'));var express=require(_0xe67a('0x4'));var router=express[_0xe67a('0x5')]();var auth=require(_0xe67a('0x6'));var interaction=require(_0xe67a('0x7'));var config=require(_0xe67a('0x8'));var controller=require(_0xe67a('0x9'));router[_0xe67a('0xa')]('/',auth['isAuthenticated'](),controller[_0xe67a('0xb')]);router[_0xe67a('0xa')](_0xe67a('0xc'),auth['isAuthenticated'](),controller[_0xe67a('0xd')]);router[_0xe67a('0xe')]('/',auth[_0xe67a('0xf')](),controller[_0xe67a('0x10')]);router[_0xe67a('0x11')]('/:id',auth[_0xe67a('0xf')](),controller[_0xe67a('0x12')]);router[_0xe67a('0x13')](_0xe67a('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4696=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','destroy','exports','multer'];(function(_0x5f2e1f,_0x4e460e){var _0x18808b=function(_0x23ae20){while(--_0x23ae20){_0x5f2e1f['push'](_0x5f2e1f['shift']());}};_0x18808b(++_0x4e460e);}(_0x4696,0xc5));var _0x6469=function(_0x587e49,_0x11faeb){_0x587e49=_0x587e49-0x0;var _0x3fa102=_0x4696[_0x587e49];return _0x3fa102;};'use strict';var multer=require(_0x6469('0x0'));var util=require(_0x6469('0x1'));var path=require(_0x6469('0x2'));var timeout=require(_0x6469('0x3'));var express=require(_0x6469('0x4'));var router=express['Router']();var auth=require(_0x6469('0x5'));var interaction=require(_0x6469('0x6'));var config=require(_0x6469('0x7'));var controller=require(_0x6469('0x8'));router[_0x6469('0x9')]('/',auth[_0x6469('0xa')](),controller[_0x6469('0xb')]);router[_0x6469('0x9')](_0x6469('0xc'),auth['isAuthenticated'](),controller[_0x6469('0xd')]);router[_0x6469('0xe')]('/',auth[_0x6469('0xa')](),controller[_0x6469('0xf')]);router['put'](_0x6469('0xc'),auth[_0x6469('0xa')](),controller['update']);router['delete'](_0x6469('0xc'),auth[_0x6469('0xa')](),controller[_0x6469('0x10')]);module[_0x6469('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 2665640..8f77119 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 _0x8f9d=['STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x35e9cf,_0x1c29b7){var _0x33a998=function(_0x2b96dd){while(--_0x2b96dd){_0x35e9cf['push'](_0x35e9cf['shift']());}};_0x33a998(++_0x1c29b7);}(_0x8f9d,0x93));var _0xd8f9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8f9d[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xd8f9('0x0'));module['exports']={'description':{'type':Sequelize[_0xd8f9('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xd8f9('0x1')]},'pass':{'type':Sequelize[_0xd8f9('0x1')]},'port':{'type':Sequelize[_0xd8f9('0x2')]},'secure':{'type':Sequelize[_0xd8f9('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xd8f9('0x1')]},'authentication':{'type':Sequelize[_0xd8f9('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8f9d=['STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x3ec24a,_0x1e1f65){var _0x3778cd=function(_0x4d6453){while(--_0x4d6453){_0x3ec24a['push'](_0x3ec24a['shift']());}};_0x3778cd(++_0x1e1f65);}(_0x8f9d,0x93));var _0xd8f9=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8f9d[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xd8f9('0x0'));module['exports']={'description':{'type':Sequelize[_0xd8f9('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xd8f9('0x1')]},'pass':{'type':Sequelize[_0xd8f9('0x1')]},'port':{'type':Sequelize[_0xd8f9('0x2')]},'secure':{'type':Sequelize[_0xd8f9('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xd8f9('0x1')]},'authentication':{'type':Sequelize[_0xd8f9('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index c5a49eb..c33dbee 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 _0x59db=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','model','filters','intersection','query','fields','attributes','length','nolimit','order','sort','where','pick','merge','type','filter','options','include','findAll','rows','params','keys','includeAll','catch','create','body','find','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x59db,0x18f));var _0xb59d=function(_0x85b47d,_0x1208e1){_0x85b47d=_0x85b47d-0x0;var _0x24f4d3=_0x59db[_0x85b47d];return _0x24f4d3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb59d('0x0'));var jsonpatch=require(_0xb59d('0x1'));var rp=require(_0xb59d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb59d('0x3'));var util=require(_0xb59d('0x4'));var path=require('path');var sox=require(_0xb59d('0x5'));var csv=require(_0xb59d('0x6'));var ejs=require(_0xb59d('0x7'));var fs=require('fs');var _=require(_0xb59d('0x8'));var squel=require('squel');var crypto=require(_0xb59d('0x9'));var jsforce=require(_0xb59d('0xa'));var deskjs=require(_0xb59d('0xb'));var toCsv=require(_0xb59d('0x6'));var querystring=require('querystring');var Papa=require(_0xb59d('0xc'));var Redis=require(_0xb59d('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb59d('0xe'));var hardwareService=require(_0xb59d('0xf'));var logger=require(_0xb59d('0x10'))(_0xb59d('0x11'));var utils=require(_0xb59d('0x12'));var config=require(_0xb59d('0x13'));var licenseUtil=require(_0xb59d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ea953,_0x3dcb8c){_0x3dcb8c=_0x3dcb8c||0xcc;return function(_0x2bc9b3){if(_0x2bc9b3){return _0x2ea953[_0xb59d('0x15')](_0x3dcb8c);}return _0x2ea953[_0xb59d('0x16')](_0x3dcb8c)[_0xb59d('0x17')]();};}function respondWithResult(_0xb5c2b6,_0x394cca){_0x394cca=_0x394cca||0xc8;return function(_0x20c11f){if(_0x20c11f){return _0xb5c2b6[_0xb59d('0x16')](_0x394cca)[_0xb59d('0x18')](_0x20c11f);}};}function respondWithFilteredResult(_0x4b1145,_0x5af827){return function(_0x1e097a){if(_0x1e097a){var _0x20d7ad=_0x1e097a[_0xb59d('0x19')],_0x151300=_0x5af827[_0xb59d('0x1a')],_0x3b478e=_0x5af827[_0xb59d('0x1a')]+_0x5af827[_0xb59d('0x1b')],_0x26d28c;if(_0x3b478e>=_0x20d7ad){_0x3b478e=_0x20d7ad;_0x26d28c=0xc8;}else{_0x26d28c=0xce;}_0x4b1145['status'](_0x26d28c);return _0x4b1145[_0xb59d('0x1c')](_0xb59d('0x1d'),_0x151300+'-'+_0x3b478e+'/'+_0x20d7ad)['json'](_0x1e097a);}return null;};}function patchUpdates(_0x5b9471){return function(_0x11bfdc){try{jsonpatch[_0xb59d('0x1e')](_0x11bfdc,_0x5b9471,!![]);}catch(_0x206d68){return BPromise['reject'](_0x206d68);}return _0x11bfdc[_0xb59d('0x1f')]();};}function saveUpdates(_0x1857ac,_0x238584){return function(_0x4daa3b){if(_0x4daa3b){return _0x4daa3b[_0xb59d('0x20')](_0x1857ac)[_0xb59d('0x21')](function(_0x343b09){return _0x343b09;});}return null;};}function removeEntity(_0x3aa22b,_0x212dcb){return function(_0x2256ad){if(_0x2256ad){return _0x2256ad[_0xb59d('0x22')]()[_0xb59d('0x21')](function(){_0x3aa22b[_0xb59d('0x16')](0xcc)[_0xb59d('0x17')]();});}};}function handleEntityNotFound(_0xb6ab10,_0x14df31){return function(_0x47f252){if(!_0x47f252){_0xb6ab10[_0xb59d('0x15')](0x194);}return _0x47f252;};}function handleError(_0x3f87be,_0x3036f7){_0x3036f7=_0x3036f7||0x1f4;return function(_0x51be4a){logger[_0xb59d('0x23')](_0x51be4a[_0xb59d('0x24')]);if(_0x51be4a[_0xb59d('0x25')]){delete _0x51be4a[_0xb59d('0x25')];}_0x3f87be[_0xb59d('0x16')](_0x3036f7)[_0xb59d('0x26')](_0x51be4a);};}exports[_0xb59d('0x27')]=function(_0x441af3,_0x53b184){var _0x7cf9be={},_0x3edc29={},_0x5e2869={'count':0x0,'rows':[]};var _0x4451b7=_[_0xb59d('0x28')](db[_0xb59d('0x29')][_0xb59d('0x2a')],function(_0x2bb8c3){return{'name':_0x2bb8c3['fieldName'],'type':_0x2bb8c3['type']['key']};});_0x3edc29[_0xb59d('0x2b')]=_['map'](_0x4451b7,_0xb59d('0x25'));_0x3edc29['query']=_['keys'](_0x441af3['query']);_0x3edc29[_0xb59d('0x2c')]=_[_0xb59d('0x2d')](_0x3edc29[_0xb59d('0x2b')],_0x3edc29[_0xb59d('0x2e')]);_0x7cf9be['attributes']=_[_0xb59d('0x2d')](_0x3edc29[_0xb59d('0x2b')],qs[_0xb59d('0x2f')](_0x441af3[_0xb59d('0x2e')][_0xb59d('0x2f')]));_0x7cf9be['attributes']=_0x7cf9be[_0xb59d('0x30')][_0xb59d('0x31')]?_0x7cf9be['attributes']:_0x3edc29['model'];if(!_0x441af3[_0xb59d('0x2e')]['hasOwnProperty'](_0xb59d('0x32'))){_0x7cf9be[_0xb59d('0x1b')]=qs[_0xb59d('0x1b')](_0x441af3['query'][_0xb59d('0x1b')]);_0x7cf9be[_0xb59d('0x1a')]=qs[_0xb59d('0x1a')](_0x441af3['query'][_0xb59d('0x1a')]);}_0x7cf9be[_0xb59d('0x33')]=qs[_0xb59d('0x34')](_0x441af3['query'][_0xb59d('0x34')]);_0x7cf9be[_0xb59d('0x35')]=qs[_0xb59d('0x2c')](_[_0xb59d('0x36')](_0x441af3[_0xb59d('0x2e')],_0x3edc29['filters']),_0x4451b7);if(_0x441af3[_0xb59d('0x2e')]['filter']){_0x7cf9be[_0xb59d('0x35')]=_[_0xb59d('0x37')](_0x7cf9be['where'],{'$or':_[_0xb59d('0x28')](_0x4451b7,function(_0x1c2e46){if(_0x1c2e46[_0xb59d('0x38')]!=='VIRTUAL'){var _0x5dc453={};_0x5dc453[_0x1c2e46[_0xb59d('0x25')]]={'$like':'%'+_0x441af3[_0xb59d('0x2e')][_0xb59d('0x39')]+'%'};return _0x5dc453;}})});}_0x7cf9be=_[_0xb59d('0x37')]({},_0x7cf9be,_0x441af3[_0xb59d('0x3a')]);var _0x5eadb9={'where':_0x7cf9be['where']};return db[_0xb59d('0x29')][_0xb59d('0x19')](_0x5eadb9)[_0xb59d('0x21')](function(_0x59ba16){_0x5e2869['count']=_0x59ba16;if(_0x441af3[_0xb59d('0x2e')]['includeAll']){_0x7cf9be[_0xb59d('0x3b')]=[{'all':!![]}];}return db[_0xb59d('0x29')][_0xb59d('0x3c')](_0x7cf9be);})['then'](function(_0xa88014){_0x5e2869[_0xb59d('0x3d')]=_0xa88014;return _0x5e2869;})[_0xb59d('0x21')](respondWithFilteredResult(_0x53b184,_0x7cf9be))['catch'](handleError(_0x53b184,null));};exports['show']=function(_0x20e236,_0x296512){var _0x2b53e8={'raw':!![],'where':{'id':_0x20e236[_0xb59d('0x3e')]['id']}},_0x2abd1c={};_0x2abd1c[_0xb59d('0x2b')]=_[_0xb59d('0x3f')](db[_0xb59d('0x29')][_0xb59d('0x2a')]);_0x2abd1c[_0xb59d('0x2e')]=_['keys'](_0x20e236['query']);_0x2abd1c[_0xb59d('0x2c')]=_[_0xb59d('0x2d')](_0x2abd1c[_0xb59d('0x2b')],_0x2abd1c[_0xb59d('0x2e')]);_0x2b53e8['attributes']=_[_0xb59d('0x2d')](_0x2abd1c[_0xb59d('0x2b')],qs[_0xb59d('0x2f')](_0x20e236[_0xb59d('0x2e')][_0xb59d('0x2f')]));_0x2b53e8['attributes']=_0x2b53e8[_0xb59d('0x30')][_0xb59d('0x31')]?_0x2b53e8[_0xb59d('0x30')]:_0x2abd1c['model'];if(_0x20e236[_0xb59d('0x2e')][_0xb59d('0x40')]){_0x2b53e8['include']=[{'all':!![]}];}_0x2b53e8=_[_0xb59d('0x37')]({},_0x2b53e8,_0x20e236['options']);return db['MailServerOut']['find'](_0x2b53e8)['then'](handleEntityNotFound(_0x296512,null))[_0xb59d('0x21')](respondWithResult(_0x296512,null))[_0xb59d('0x41')](handleError(_0x296512,null));};exports[_0xb59d('0x42')]=function(_0x2eaacf,_0x33140d){return db[_0xb59d('0x29')][_0xb59d('0x42')](_0x2eaacf[_0xb59d('0x43')],{})['then'](respondWithResult(_0x33140d,0xc9))['catch'](handleError(_0x33140d,null));};exports[_0xb59d('0x20')]=function(_0x5900ae,_0x2b731e){if(_0x5900ae[_0xb59d('0x43')]['id']){delete _0x5900ae[_0xb59d('0x43')]['id'];}return db[_0xb59d('0x29')][_0xb59d('0x44')]({'where':{'id':_0x5900ae['params']['id']}})[_0xb59d('0x21')](handleEntityNotFound(_0x2b731e,null))[_0xb59d('0x21')](saveUpdates(_0x5900ae[_0xb59d('0x43')],null))[_0xb59d('0x21')](respondWithResult(_0x2b731e,null))[_0xb59d('0x41')](handleError(_0x2b731e,null));};exports[_0xb59d('0x22')]=function(_0x39fdf4,_0x19e186){return db[_0xb59d('0x29')][_0xb59d('0x44')]({'where':{'id':_0x39fdf4[_0xb59d('0x3e')]['id']}})[_0xb59d('0x21')](handleEntityNotFound(_0x19e186,null))['then'](removeEntity(_0x19e186,null))[_0xb59d('0x41')](handleError(_0x19e186,null));}; \ No newline at end of file +var _0x76a2=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','MailServerOut','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','params','keys','find','catch','create','body','html-pdf'];(function(_0x4914ad,_0x551a18){var _0x3cd61f=function(_0x2a773e){while(--_0x2a773e){_0x4914ad['push'](_0x4914ad['shift']());}};_0x3cd61f(++_0x551a18);}(_0x76a2,0x95));var _0x276a=function(_0x197185,_0x251145){_0x197185=_0x197185-0x0;var _0x2c8af1=_0x76a2[_0x197185];return _0x2c8af1;};'use strict';var pdf=require(_0x276a('0x0'));var emlformat=require(_0x276a('0x1'));var rimraf=require(_0x276a('0x2'));var zipdir=require(_0x276a('0x3'));var jsonpatch=require(_0x276a('0x4'));var rp=require(_0x276a('0x5'));var moment=require(_0x276a('0x6'));var BPromise=require(_0x276a('0x7'));var Mustache=require(_0x276a('0x8'));var util=require('util');var path=require('path');var sox=require(_0x276a('0x9'));var csv=require(_0x276a('0xa'));var ejs=require(_0x276a('0xb'));var fs=require('fs');var _=require(_0x276a('0xc'));var squel=require(_0x276a('0xd'));var crypto=require(_0x276a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x276a('0xf'));var toCsv=require(_0x276a('0xa'));var querystring=require(_0x276a('0x10'));var Papa=require(_0x276a('0x11'));var Redis=require(_0x276a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x276a('0x13'));var as=require(_0x276a('0x14'));var hardwareService=require(_0x276a('0x15'));var logger=require('../../config/logger')(_0x276a('0x16'));var utils=require(_0x276a('0x17'));var config=require(_0x276a('0x18'));var licenseUtil=require(_0x276a('0x19'));var db=require(_0x276a('0x1a'))['db'];function respondWithStatusCode(_0x290f7d,_0x1bb7ea){_0x1bb7ea=_0x1bb7ea||0xcc;return function(_0x2c2758){if(_0x2c2758){return _0x290f7d[_0x276a('0x1b')](_0x1bb7ea);}return _0x290f7d[_0x276a('0x1c')](_0x1bb7ea)[_0x276a('0x1d')]();};}function respondWithResult(_0x55ccf0,_0x347932){_0x347932=_0x347932||0xc8;return function(_0x2a9dd9){if(_0x2a9dd9){return _0x55ccf0[_0x276a('0x1c')](_0x347932)['json'](_0x2a9dd9);}};}function respondWithFilteredResult(_0x4b319b,_0x446aee){return function(_0x33a000){if(_0x33a000){var _0x293ae0=_0x33a000[_0x276a('0x1e')],_0x4b3d76=_0x446aee[_0x276a('0x1f')],_0x1ded50=_0x446aee[_0x276a('0x1f')]+_0x446aee['limit'],_0x34906f;if(_0x1ded50>=_0x293ae0){_0x1ded50=_0x293ae0;_0x34906f=0xc8;}else{_0x34906f=0xce;}_0x4b319b[_0x276a('0x1c')](_0x34906f);return _0x4b319b[_0x276a('0x20')](_0x276a('0x21'),_0x4b3d76+'-'+_0x1ded50+'/'+_0x293ae0)[_0x276a('0x22')](_0x33a000);}return null;};}function patchUpdates(_0x300ac7){return function(_0x513ab8){try{jsonpatch[_0x276a('0x23')](_0x513ab8,_0x300ac7,!![]);}catch(_0x3105ef){return BPromise[_0x276a('0x24')](_0x3105ef);}return _0x513ab8[_0x276a('0x25')]();};}function saveUpdates(_0x1076b1,_0x446df2){return function(_0x149889){if(_0x149889){return _0x149889[_0x276a('0x26')](_0x1076b1)[_0x276a('0x27')](function(_0x5e7eab){return _0x5e7eab;});}return null;};}function removeEntity(_0x32b0cc,_0x26860d){return function(_0x211db8){if(_0x211db8){return _0x211db8[_0x276a('0x28')]()['then'](function(){_0x32b0cc[_0x276a('0x1c')](0xcc)[_0x276a('0x1d')]();});}};}function handleEntityNotFound(_0x4c047e,_0x57bef3){return function(_0x3aa109){if(!_0x3aa109){_0x4c047e[_0x276a('0x1b')](0x194);}return _0x3aa109;};}function handleError(_0x5a28d4,_0xa456f9){_0xa456f9=_0xa456f9||0x1f4;return function(_0x5b0b5d){logger[_0x276a('0x29')](_0x5b0b5d[_0x276a('0x2a')]);if(_0x5b0b5d[_0x276a('0x2b')]){delete _0x5b0b5d[_0x276a('0x2b')];}_0x5a28d4[_0x276a('0x1c')](_0xa456f9)['send'](_0x5b0b5d);};}exports['index']=function(_0x138a6d,_0x3043df){var _0x1e96bc={},_0x3fa301={},_0x1b4cc={'count':0x0,'rows':[]};var _0x154770=_['map'](db[_0x276a('0x2c')][_0x276a('0x2d')],function(_0x4285c3){return{'name':_0x4285c3[_0x276a('0x2e')],'type':_0x4285c3[_0x276a('0x2f')][_0x276a('0x30')]};});_0x3fa301[_0x276a('0x31')]=_[_0x276a('0x32')](_0x154770,_0x276a('0x2b'));_0x3fa301[_0x276a('0x33')]=_['keys'](_0x138a6d[_0x276a('0x33')]);_0x3fa301[_0x276a('0x34')]=_[_0x276a('0x35')](_0x3fa301[_0x276a('0x31')],_0x3fa301[_0x276a('0x33')]);_0x1e96bc[_0x276a('0x36')]=_[_0x276a('0x35')](_0x3fa301[_0x276a('0x31')],qs['fields'](_0x138a6d[_0x276a('0x33')][_0x276a('0x37')]));_0x1e96bc['attributes']=_0x1e96bc[_0x276a('0x36')][_0x276a('0x38')]?_0x1e96bc[_0x276a('0x36')]:_0x3fa301[_0x276a('0x31')];if(!_0x138a6d[_0x276a('0x33')]['hasOwnProperty'](_0x276a('0x39'))){_0x1e96bc['limit']=qs[_0x276a('0x3a')](_0x138a6d[_0x276a('0x33')]['limit']);_0x1e96bc[_0x276a('0x1f')]=qs[_0x276a('0x1f')](_0x138a6d[_0x276a('0x33')][_0x276a('0x1f')]);}_0x1e96bc['order']=qs[_0x276a('0x3b')](_0x138a6d[_0x276a('0x33')][_0x276a('0x3b')]);_0x1e96bc[_0x276a('0x3c')]=qs[_0x276a('0x34')](_[_0x276a('0x3d')](_0x138a6d[_0x276a('0x33')],_0x3fa301[_0x276a('0x34')]),_0x154770);if(_0x138a6d['query']['filter']){_0x1e96bc['where']=_['merge'](_0x1e96bc['where'],{'$or':_[_0x276a('0x32')](_0x154770,function(_0x503804){if(_0x503804[_0x276a('0x2f')]!==_0x276a('0x3e')){var _0x4557b4={};_0x4557b4[_0x503804[_0x276a('0x2b')]]={'$like':'%'+_0x138a6d[_0x276a('0x33')][_0x276a('0x3f')]+'%'};return _0x4557b4;}})});}_0x1e96bc=_[_0x276a('0x40')]({},_0x1e96bc,_0x138a6d[_0x276a('0x41')]);var _0xbad4de={'where':_0x1e96bc[_0x276a('0x3c')]};return db[_0x276a('0x2c')]['count'](_0xbad4de)[_0x276a('0x27')](function(_0x3e14c9){_0x1b4cc[_0x276a('0x1e')]=_0x3e14c9;if(_0x138a6d[_0x276a('0x33')][_0x276a('0x42')]){_0x1e96bc[_0x276a('0x43')]=[{'all':!![]}];}return db[_0x276a('0x2c')]['findAll'](_0x1e96bc);})[_0x276a('0x27')](function(_0x32903f){_0x1b4cc[_0x276a('0x44')]=_0x32903f;return _0x1b4cc;})[_0x276a('0x27')](respondWithFilteredResult(_0x3043df,_0x1e96bc))['catch'](handleError(_0x3043df,null));};exports['show']=function(_0x1a2f35,_0x5e246a){var _0x5a4827={'raw':!![],'where':{'id':_0x1a2f35[_0x276a('0x45')]['id']}},_0x1d73ed={};_0x1d73ed['model']=_[_0x276a('0x46')](db[_0x276a('0x2c')][_0x276a('0x2d')]);_0x1d73ed[_0x276a('0x33')]=_[_0x276a('0x46')](_0x1a2f35['query']);_0x1d73ed[_0x276a('0x34')]=_['intersection'](_0x1d73ed['model'],_0x1d73ed[_0x276a('0x33')]);_0x5a4827[_0x276a('0x36')]=_['intersection'](_0x1d73ed[_0x276a('0x31')],qs[_0x276a('0x37')](_0x1a2f35[_0x276a('0x33')][_0x276a('0x37')]));_0x5a4827['attributes']=_0x5a4827['attributes'][_0x276a('0x38')]?_0x5a4827[_0x276a('0x36')]:_0x1d73ed[_0x276a('0x31')];if(_0x1a2f35[_0x276a('0x33')][_0x276a('0x42')]){_0x5a4827[_0x276a('0x43')]=[{'all':!![]}];}_0x5a4827=_['merge']({},_0x5a4827,_0x1a2f35['options']);return db[_0x276a('0x2c')][_0x276a('0x47')](_0x5a4827)[_0x276a('0x27')](handleEntityNotFound(_0x5e246a,null))['then'](respondWithResult(_0x5e246a,null))[_0x276a('0x48')](handleError(_0x5e246a,null));};exports[_0x276a('0x49')]=function(_0x439542,_0x2a64bc){return db[_0x276a('0x2c')][_0x276a('0x49')](_0x439542['body'],{})[_0x276a('0x27')](respondWithResult(_0x2a64bc,0xc9))[_0x276a('0x48')](handleError(_0x2a64bc,null));};exports[_0x276a('0x26')]=function(_0x30d9f7,_0x111ac9){if(_0x30d9f7[_0x276a('0x4a')]['id']){delete _0x30d9f7[_0x276a('0x4a')]['id'];}return db[_0x276a('0x2c')][_0x276a('0x47')]({'where':{'id':_0x30d9f7[_0x276a('0x45')]['id']}})[_0x276a('0x27')](handleEntityNotFound(_0x111ac9,null))['then'](saveUpdates(_0x30d9f7['body'],null))[_0x276a('0x27')](respondWithResult(_0x111ac9,null))[_0x276a('0x48')](handleError(_0x111ac9,null));};exports[_0x276a('0x28')]=function(_0x1d8584,_0x355355){return db[_0x276a('0x2c')][_0x276a('0x47')]({'where':{'id':_0x1d8584['params']['id']}})[_0x276a('0x27')](handleEntityNotFound(_0x355355,null))[_0x276a('0x27')](removeEntity(_0x355355,null))[_0x276a('0x48')](handleError(_0x355355,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 0ddda6a..0636009 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 _0x5fab=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','MailServerOut','mail_servers_out','lodash','util'];(function(_0x1dda07,_0x5db499){var _0x9fce6f=function(_0x288314){while(--_0x288314){_0x1dda07['push'](_0x1dda07['shift']());}};_0x9fce6f(++_0x5db499);}(_0x5fab,0x177));var _0xb5fa=function(_0x494986,_0x4debb8){_0x494986=_0x494986-0x0;var _0x1c805b=_0x5fab[_0x494986];return _0x1c805b;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','moment'];(function(_0xb68baf,_0x1f7e19){var _0x285586=function(_0x4cec20){while(--_0x4cec20){_0xb68baf['push'](_0xb68baf['shift']());}};_0x285586(++_0x1f7e19);}(_0xe14b,0x93));var _0xbe14=function(_0x1d6a9d,_0x15fb52){_0x1d6a9d=_0x1d6a9d-0x0;var _0x3ea6b7=_0xe14b[_0x1d6a9d];return _0x3ea6b7;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 3ffca51..0342916 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 _0x1af4=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','MailServerOut,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x49dd53,_0x120b38){var _0x5d0898=function(_0x33ec5a){while(--_0x33ec5a){_0x49dd53['push'](_0x49dd53['shift']());}};_0x5d0898(++_0x120b38);}(_0x1af4,0xf6));var _0x41af=function(_0x23e79e,_0x5c740a){_0x23e79e=_0x23e79e-0x0;var _0x3f8723=_0x1af4[_0x23e79e];return _0x3f8723;};'use strict';var _=require(_0x41af('0x0'));var util=require(_0x41af('0x1'));var moment=require(_0x41af('0x2'));var BPromise=require(_0x41af('0x3'));var rs=require(_0x41af('0x4'));var fs=require('fs');var Redis=require(_0x41af('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x41af('0x6'));var logger=require(_0x41af('0x7'))(_0x41af('0x8'));var config=require('../../config/environment');var jayson=require(_0x41af('0x9'));var client=jayson[_0x41af('0xa')][_0x41af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x595aec,_0x374105,_0x235bef){return new BPromise(function(_0x1e5d2a,_0x151c24){return client[_0x41af('0xc')](_0x595aec,_0x235bef)[_0x41af('0xd')](function(_0x3467d7){logger[_0x41af('0xe')]('MailServerOut,\x20%s,\x20%s',_0x374105,'request\x20sent');logger[_0x41af('0xf')](_0x41af('0x10'),_0x374105,'request\x20sent',JSON['stringify'](_0x3467d7));if(_0x3467d7[_0x41af('0x11')]){if(_0x3467d7[_0x41af('0x11')][_0x41af('0x12')]===0x1f4){logger['error']('MailServerOut,\x20%s,\x20%s',_0x374105,_0x3467d7[_0x41af('0x11')][_0x41af('0x13')]);return _0x151c24(_0x3467d7[_0x41af('0x11')][_0x41af('0x13')]);}logger['error'](_0x41af('0x14'),_0x374105,_0x3467d7['error'][_0x41af('0x13')]);return _0x1e5d2a(_0x3467d7[_0x41af('0x11')][_0x41af('0x13')]);}else{logger['info'](_0x41af('0x14'),_0x374105,'request\x20sent');_0x1e5d2a(_0x3467d7[_0x41af('0x15')][_0x41af('0x13')]);}})[_0x41af('0x16')](function(_0x16dd22){logger['error'](_0x41af('0x14'),_0x374105,_0x16dd22);_0x151c24(_0x16dd22);});});} \ No newline at end of file +var _0x9af2=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9af2,0x11e));var _0x29af=function(_0x234676,_0x1eb01f){_0x234676=_0x234676-0x0;var _0x5d3eaa=_0x9af2[_0x234676];return _0x5d3eaa;};'use strict';var _=require(_0x29af('0x0'));var util=require(_0x29af('0x1'));var moment=require(_0x29af('0x2'));var BPromise=require('bluebird');var rs=require(_0x29af('0x3'));var fs=require('fs');var Redis=require(_0x29af('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x29af('0x5'));var logger=require(_0x29af('0x6'))(_0x29af('0x7'));var config=require(_0x29af('0x8'));var jayson=require(_0x29af('0x9'));var client=jayson[_0x29af('0xa')][_0x29af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b271e,_0x434982,_0x39551e){return new BPromise(function(_0x266849,_0x549907){return client[_0x29af('0xc')](_0x3b271e,_0x39551e)[_0x29af('0xd')](function(_0x285bca){logger[_0x29af('0xe')](_0x29af('0xf'),_0x434982,_0x29af('0x10'));logger['debug'](_0x29af('0x11'),_0x434982,'request\x20sent',JSON[_0x29af('0x12')](_0x285bca));if(_0x285bca[_0x29af('0x13')]){if(_0x285bca['error'][_0x29af('0x14')]===0x1f4){logger[_0x29af('0x13')]('MailServerOut,\x20%s,\x20%s',_0x434982,_0x285bca[_0x29af('0x13')][_0x29af('0x15')]);return _0x549907(_0x285bca[_0x29af('0x13')]['message']);}logger[_0x29af('0x13')](_0x29af('0xf'),_0x434982,_0x285bca['error'][_0x29af('0x15')]);return _0x266849(_0x285bca[_0x29af('0x13')][_0x29af('0x15')]);}else{logger[_0x29af('0xe')]('MailServerOut,\x20%s,\x20%s',_0x434982,_0x29af('0x10'));_0x266849(_0x285bca[_0x29af('0x16')][_0x29af('0x15')]);}})[_0x29af('0x17')](function(_0x14e265){logger[_0x29af('0x13')](_0x29af('0xf'),_0x434982,_0x14e265);_0x549907(_0x14e265);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 9c76aff..7b2c441 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 _0xee9a=['express','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','util','path','connect-timeout'];(function(_0xb81379,_0x3c6d34){var _0x520a1e=function(_0x2cb0e3){while(--_0x2cb0e3){_0xb81379['push'](_0xb81379['shift']());}};_0x520a1e(++_0x3c6d34);}(_0xee9a,0xc9));var _0xaee9=function(_0x4a6322,_0x1dac50){_0x4a6322=_0x4a6322-0x0;var _0x4c4f0d=_0xee9a[_0x4a6322];return _0x4c4f0d;};'use strict';var multer=require('multer');var util=require(_0xaee9('0x0'));var path=require(_0xaee9('0x1'));var timeout=require(_0xaee9('0x2'));var express=require(_0xaee9('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xaee9('0x4'));router[_0xaee9('0x5')]('/',auth[_0xaee9('0x6')](),controller[_0xaee9('0x7')]);router[_0xaee9('0x5')](_0xaee9('0x8'),auth[_0xaee9('0x6')](),controller[_0xaee9('0x9')]);router[_0xaee9('0x5')](_0xaee9('0xa'),auth[_0xaee9('0x6')](),controller[_0xaee9('0xb')]);router['post']('/',auth[_0xaee9('0x6')](),controller[_0xaee9('0xc')]);router[_0xaee9('0xd')](_0xaee9('0xa'),auth[_0xaee9('0x6')](),controller[_0xaee9('0xe')]);router[_0xaee9('0xf')]('/:id',auth[_0xaee9('0x6')](),controller[_0xaee9('0x10')]);module['exports']=router; \ No newline at end of file +var _0x703d=['update','delete','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put'];(function(_0x4b4e8d,_0x514651){var _0x5a87ac=function(_0x18cc50){while(--_0x18cc50){_0x4b4e8d['push'](_0x4b4e8d['shift']());}};_0x5a87ac(++_0x514651);}(_0x703d,0x8f));var _0xd703=function(_0x577457,_0x15f059){_0x577457=_0x577457-0x0;var _0x328856=_0x703d[_0x577457];return _0x328856;};'use strict';var multer=require(_0xd703('0x0'));var util=require(_0xd703('0x1'));var path=require(_0xd703('0x2'));var timeout=require(_0xd703('0x3'));var express=require(_0xd703('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xd703('0x5'));var config=require(_0xd703('0x6'));var controller=require(_0xd703('0x7'));router[_0xd703('0x8')]('/',auth[_0xd703('0x9')](),controller['index']);router[_0xd703('0x8')](_0xd703('0xa'),auth[_0xd703('0x9')](),controller[_0xd703('0xb')]);router[_0xd703('0x8')](_0xd703('0xc'),auth[_0xd703('0x9')](),controller[_0xd703('0xd')]);router[_0xd703('0xe')]('/',auth[_0xd703('0x9')](),controller[_0xd703('0xf')]);router[_0xd703('0x10')]('/:id',auth[_0xd703('0x9')](),controller[_0xd703('0x11')]);router[_0xd703('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd703('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index e2e327b..a7d332b 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 _0x23bb=['STRING','sequelize','name'];(function(_0x2012f5,_0x41f107){var _0x3c2f46=function(_0x28f3cd){while(--_0x28f3cd){_0x2012f5['push'](_0x2012f5['shift']());}};_0x3c2f46(++_0x41f107);}(_0x23bb,0x79));var _0xb23b=function(_0x4552ea,_0x5c6323){_0x4552ea=_0x4552ea-0x0;var _0x45499a=_0x23bb[_0x4552ea];return _0x45499a;};'use strict';var Sequelize=require(_0xb23b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb23b('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb23b('0x2')]}}; \ No newline at end of file +var _0x5f2f=['exports','STRING','name','sequelize'];(function(_0x1ad557,_0x5b4159){var _0x54d556=function(_0x51ed71){while(--_0x51ed71){_0x1ad557['push'](_0x1ad557['shift']());}};_0x54d556(++_0x5b4159);}(_0x5f2f,0x73));var _0xf5f2=function(_0x33cca3,_0x1e954d){_0x33cca3=_0x33cca3-0x0;var _0x30f6fd=_0x5f2f[_0x33cca3];return _0x30f6fd;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'name':{'type':Sequelize[_0xf5f2('0x2')],'unique':_0xf5f2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf5f2('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index b798186..3c80046 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 _0xbe42=['where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','keys','options','create','body','destroy','find','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','end','error','stack','name','send','index','MailSubstatus','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort'];(function(_0x5d9613,_0x11eead){var _0x3d96f4=function(_0x1947f9){while(--_0x1947f9){_0x5d9613['push'](_0x5d9613['shift']());}};_0x3d96f4(++_0x11eead);}(_0xbe42,0x1d4));var _0x2be4=function(_0x31dde9,_0x12e816){_0x31dde9=_0x31dde9-0x0;var _0x1fbf2d=_0xbe42[_0x31dde9];return _0x1fbf2d;};'use strict';var pdf=require(_0x2be4('0x0'));var emlformat=require(_0x2be4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2be4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2be4('0x3'));var moment=require(_0x2be4('0x4'));var BPromise=require(_0x2be4('0x5'));var Mustache=require(_0x2be4('0x6'));var util=require(_0x2be4('0x7'));var path=require(_0x2be4('0x8'));var sox=require(_0x2be4('0x9'));var csv=require(_0x2be4('0xa'));var ejs=require(_0x2be4('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2be4('0xc'));var crypto=require(_0x2be4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2be4('0xe'));var toCsv=require(_0x2be4('0xa'));var querystring=require(_0x2be4('0xf'));var Papa=require(_0x2be4('0x10'));var Redis=require(_0x2be4('0x11'));var authService=require(_0x2be4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2be4('0x13'));var hardwareService=require(_0x2be4('0x14'));var logger=require(_0x2be4('0x15'))(_0x2be4('0x16'));var utils=require('../../config/utils');var config=require(_0x2be4('0x17'));var licenseUtil=require(_0x2be4('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e01f6,_0x251e8a){_0x251e8a=_0x251e8a||0xcc;return function(_0x219717){if(_0x219717){return _0x3e01f6['sendStatus'](_0x251e8a);}return _0x3e01f6[_0x2be4('0x19')](_0x251e8a)['end']();};}function respondWithResult(_0x5ac741,_0x46ec98){_0x46ec98=_0x46ec98||0xc8;return function(_0x54160d){if(_0x54160d){return _0x5ac741[_0x2be4('0x19')](_0x46ec98)[_0x2be4('0x1a')](_0x54160d);}};}function respondWithFilteredResult(_0x3a5358,_0x5b2be9){return function(_0x5f22e6){if(_0x5f22e6){var _0x55fea1=_0x5f22e6[_0x2be4('0x1b')],_0x420ee9=_0x5b2be9['offset'],_0x20501b=_0x5b2be9[_0x2be4('0x1c')]+_0x5b2be9[_0x2be4('0x1d')],_0x2f4f74;if(_0x20501b>=_0x55fea1){_0x20501b=_0x55fea1;_0x2f4f74=0xc8;}else{_0x2f4f74=0xce;}_0x3a5358[_0x2be4('0x19')](_0x2f4f74);return _0x3a5358[_0x2be4('0x1e')](_0x2be4('0x1f'),_0x420ee9+'-'+_0x20501b+'/'+_0x55fea1)['json'](_0x5f22e6);}return null;};}function patchUpdates(_0x22ec30){return function(_0xff484f){try{jsonpatch[_0x2be4('0x20')](_0xff484f,_0x22ec30,!![]);}catch(_0x33c58f){return BPromise['reject'](_0x33c58f);}return _0xff484f[_0x2be4('0x21')]();};}function saveUpdates(_0x5271e8,_0x1a40ac){return function(_0x162938){if(_0x162938){return _0x162938[_0x2be4('0x22')](_0x5271e8)['then'](function(_0x54fdf9){return _0x54fdf9;});}return null;};}function removeEntity(_0x389dd4,_0x29247a){return function(_0x3ee718){if(_0x3ee718){return _0x3ee718['destroy']()[_0x2be4('0x23')](function(){_0x389dd4['status'](0xcc)[_0x2be4('0x24')]();});}};}function handleEntityNotFound(_0x3052af,_0x5d1f2e){return function(_0x8ae6b2){if(!_0x8ae6b2){_0x3052af['sendStatus'](0x194);}return _0x8ae6b2;};}function handleError(_0x4c114a,_0x37f47a){_0x37f47a=_0x37f47a||0x1f4;return function(_0x178a93){logger[_0x2be4('0x25')](_0x178a93[_0x2be4('0x26')]);if(_0x178a93['name']){delete _0x178a93[_0x2be4('0x27')];}_0x4c114a[_0x2be4('0x19')](_0x37f47a)[_0x2be4('0x28')](_0x178a93);};}exports[_0x2be4('0x29')]=function(_0x500f5f,_0x56fd72){var _0x40fc9f={},_0x1ac923={},_0x529fa0={'count':0x0,'rows':[]};var _0x390d3d=_['map'](db[_0x2be4('0x2a')][_0x2be4('0x2b')],function(_0x470281){return{'name':_0x470281[_0x2be4('0x2c')],'type':_0x470281['type'][_0x2be4('0x2d')]};});_0x1ac923[_0x2be4('0x2e')]=_[_0x2be4('0x2f')](_0x390d3d,_0x2be4('0x27'));_0x1ac923[_0x2be4('0x30')]=_['keys'](_0x500f5f['query']);_0x1ac923[_0x2be4('0x31')]=_[_0x2be4('0x32')](_0x1ac923['model'],_0x1ac923[_0x2be4('0x30')]);_0x40fc9f[_0x2be4('0x33')]=_[_0x2be4('0x32')](_0x1ac923[_0x2be4('0x2e')],qs[_0x2be4('0x34')](_0x500f5f[_0x2be4('0x30')][_0x2be4('0x34')]));_0x40fc9f[_0x2be4('0x33')]=_0x40fc9f['attributes'][_0x2be4('0x35')]?_0x40fc9f[_0x2be4('0x33')]:_0x1ac923[_0x2be4('0x2e')];if(!_0x500f5f['query']['hasOwnProperty'](_0x2be4('0x36'))){_0x40fc9f[_0x2be4('0x1d')]=qs['limit'](_0x500f5f[_0x2be4('0x30')][_0x2be4('0x1d')]);_0x40fc9f[_0x2be4('0x1c')]=qs[_0x2be4('0x1c')](_0x500f5f[_0x2be4('0x30')][_0x2be4('0x1c')]);}_0x40fc9f[_0x2be4('0x37')]=qs[_0x2be4('0x38')](_0x500f5f[_0x2be4('0x30')][_0x2be4('0x38')]);_0x40fc9f[_0x2be4('0x39')]=qs[_0x2be4('0x31')](_[_0x2be4('0x3a')](_0x500f5f[_0x2be4('0x30')],_0x1ac923[_0x2be4('0x31')]),_0x390d3d);if(_0x500f5f['query'][_0x2be4('0x3b')]){_0x40fc9f['where']=_[_0x2be4('0x3c')](_0x40fc9f[_0x2be4('0x39')],{'$or':_[_0x2be4('0x2f')](_0x390d3d,function(_0x205354){if(_0x205354['type']!==_0x2be4('0x3d')){var _0x20cb16={};_0x20cb16[_0x205354['name']]={'$like':'%'+_0x500f5f[_0x2be4('0x30')][_0x2be4('0x3b')]+'%'};return _0x20cb16;}})});}_0x40fc9f=_[_0x2be4('0x3c')]({},_0x40fc9f,_0x500f5f['options']);var _0x1cfb94={'where':_0x40fc9f[_0x2be4('0x39')]};return db[_0x2be4('0x2a')][_0x2be4('0x1b')](_0x1cfb94)[_0x2be4('0x23')](function(_0x2fa433){_0x529fa0[_0x2be4('0x1b')]=_0x2fa433;if(_0x500f5f[_0x2be4('0x30')][_0x2be4('0x3e')]){_0x40fc9f[_0x2be4('0x3f')]=[{'all':!![]}];}return db[_0x2be4('0x2a')]['findAll'](_0x40fc9f);})[_0x2be4('0x23')](function(_0x6b6b48){_0x529fa0[_0x2be4('0x40')]=_0x6b6b48;return _0x529fa0;})[_0x2be4('0x23')](respondWithFilteredResult(_0x56fd72,_0x40fc9f))[_0x2be4('0x41')](handleError(_0x56fd72,null));};exports[_0x2be4('0x42')]=function(_0x66887c,_0x3d987e){var _0x1d7d0a={'raw':!![],'where':{'id':_0x66887c[_0x2be4('0x43')]['id']}},_0x22ebbd={};_0x22ebbd[_0x2be4('0x2e')]=_[_0x2be4('0x44')](db[_0x2be4('0x2a')][_0x2be4('0x2b')]);_0x22ebbd[_0x2be4('0x30')]=_[_0x2be4('0x44')](_0x66887c[_0x2be4('0x30')]);_0x22ebbd['filters']=_[_0x2be4('0x32')](_0x22ebbd[_0x2be4('0x2e')],_0x22ebbd[_0x2be4('0x30')]);_0x1d7d0a['attributes']=_[_0x2be4('0x32')](_0x22ebbd['model'],qs[_0x2be4('0x34')](_0x66887c[_0x2be4('0x30')][_0x2be4('0x34')]));_0x1d7d0a[_0x2be4('0x33')]=_0x1d7d0a['attributes']['length']?_0x1d7d0a[_0x2be4('0x33')]:_0x22ebbd[_0x2be4('0x2e')];if(_0x66887c[_0x2be4('0x30')][_0x2be4('0x3e')]){_0x1d7d0a[_0x2be4('0x3f')]=[{'all':!![]}];}_0x1d7d0a=_[_0x2be4('0x3c')]({},_0x1d7d0a,_0x66887c[_0x2be4('0x45')]);return db[_0x2be4('0x2a')]['find'](_0x1d7d0a)['then'](handleEntityNotFound(_0x3d987e,null))[_0x2be4('0x23')](respondWithResult(_0x3d987e,null))[_0x2be4('0x41')](handleError(_0x3d987e,null));};exports['create']=function(_0x4239b3,_0x67f488){return db[_0x2be4('0x2a')][_0x2be4('0x46')](_0x4239b3[_0x2be4('0x47')],{})['then'](respondWithResult(_0x67f488,0xc9))[_0x2be4('0x41')](handleError(_0x67f488,null));};exports[_0x2be4('0x22')]=function(_0x5c8df6,_0x2fcaf3){if(_0x5c8df6[_0x2be4('0x47')]['id']){delete _0x5c8df6[_0x2be4('0x47')]['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x5c8df6[_0x2be4('0x43')]['id']}})[_0x2be4('0x23')](handleEntityNotFound(_0x2fcaf3,null))[_0x2be4('0x23')](saveUpdates(_0x5c8df6['body'],null))[_0x2be4('0x23')](respondWithResult(_0x2fcaf3,null))['catch'](handleError(_0x2fcaf3,null));};exports[_0x2be4('0x48')]=function(_0x2caa7b,_0x49848f){return db[_0x2be4('0x2a')][_0x2be4('0x49')]({'where':{'id':_0x2caa7b[_0x2be4('0x43')]['id']}})[_0x2be4('0x23')](handleEntityNotFound(_0x49848f,null))['then'](removeEntity(_0x49848f,null))[_0x2be4('0x41')](handleError(_0x49848f,null));};exports[_0x2be4('0x4a')]=function(_0x489f51,_0x321a7c){return db[_0x2be4('0x2a')][_0x2be4('0x4a')]()[_0x2be4('0x23')](respondWithResult(_0x321a7c,null))['catch'](handleError(_0x321a7c,null));}; \ No newline at end of file +var _0xac47=['destroy','describe','eml-format','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','save','update','then','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','limit','sort','where','merge','VIRTUAL','filter','options','MailSubstatus','includeAll','include','rows','catch','show','params','find','create','body'];(function(_0x30f639,_0x2b81e1){var _0x552677=function(_0x59149f){while(--_0x59149f){_0x30f639['push'](_0x30f639['shift']());}};_0x552677(++_0x2b81e1);}(_0xac47,0x151));var _0x7ac4=function(_0x46aebd,_0x488973){_0x46aebd=_0x46aebd-0x0;var _0x549577=_0xac47[_0x46aebd];return _0x549577;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7ac4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7ac4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7ac4('0x2'));var BPromise=require(_0x7ac4('0x3'));var Mustache=require(_0x7ac4('0x4'));var util=require('util');var path=require('path');var sox=require(_0x7ac4('0x5'));var csv=require(_0x7ac4('0x6'));var ejs=require(_0x7ac4('0x7'));var fs=require('fs');var _=require(_0x7ac4('0x8'));var squel=require(_0x7ac4('0x9'));var crypto=require(_0x7ac4('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7ac4('0x6'));var querystring=require(_0x7ac4('0xb'));var Papa=require(_0x7ac4('0xc'));var Redis=require(_0x7ac4('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x7ac4('0xe'));var as=require(_0x7ac4('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7ac4('0x10'))(_0x7ac4('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7ac4('0x12'))['db'];function respondWithStatusCode(_0x41ab55,_0x3711a2){_0x3711a2=_0x3711a2||0xcc;return function(_0x126a0d){if(_0x126a0d){return _0x41ab55[_0x7ac4('0x13')](_0x3711a2);}return _0x41ab55[_0x7ac4('0x14')](_0x3711a2)[_0x7ac4('0x15')]();};}function respondWithResult(_0x2a6ca5,_0x3f4f16){_0x3f4f16=_0x3f4f16||0xc8;return function(_0x4308c6){if(_0x4308c6){return _0x2a6ca5[_0x7ac4('0x14')](_0x3f4f16)['json'](_0x4308c6);}};}function respondWithFilteredResult(_0x40273b,_0x646e56){return function(_0x582818){if(_0x582818){var _0x3fcb22=_0x582818[_0x7ac4('0x16')],_0x9dda4f=_0x646e56['offset'],_0x5ac411=_0x646e56[_0x7ac4('0x17')]+_0x646e56['limit'],_0x364b97;if(_0x5ac411>=_0x3fcb22){_0x5ac411=_0x3fcb22;_0x364b97=0xc8;}else{_0x364b97=0xce;}_0x40273b['status'](_0x364b97);return _0x40273b[_0x7ac4('0x18')](_0x7ac4('0x19'),_0x9dda4f+'-'+_0x5ac411+'/'+_0x3fcb22)[_0x7ac4('0x1a')](_0x582818);}return null;};}function patchUpdates(_0x389f66){return function(_0x27f5a7){try{jsonpatch[_0x7ac4('0x1b')](_0x27f5a7,_0x389f66,!![]);}catch(_0x2324e6){return BPromise['reject'](_0x2324e6);}return _0x27f5a7[_0x7ac4('0x1c')]();};}function saveUpdates(_0x131809,_0x5c85ca){return function(_0x2fb4f0){if(_0x2fb4f0){return _0x2fb4f0[_0x7ac4('0x1d')](_0x131809)['then'](function(_0x27486c){return _0x27486c;});}return null;};}function removeEntity(_0x1bde4a,_0x14b0f4){return function(_0xeca2dd){if(_0xeca2dd){return _0xeca2dd['destroy']()[_0x7ac4('0x1e')](function(){_0x1bde4a[_0x7ac4('0x14')](0xcc)[_0x7ac4('0x15')]();});}};}function handleEntityNotFound(_0x3c3f9c,_0x18cce3){return function(_0x54c82f){if(!_0x54c82f){_0x3c3f9c['sendStatus'](0x194);}return _0x54c82f;};}function handleError(_0x194f50,_0x2e1fb4){_0x2e1fb4=_0x2e1fb4||0x1f4;return function(_0x16747f){logger[_0x7ac4('0x1f')](_0x16747f[_0x7ac4('0x20')]);if(_0x16747f['name']){delete _0x16747f[_0x7ac4('0x21')];}_0x194f50[_0x7ac4('0x14')](_0x2e1fb4)['send'](_0x16747f);};}exports[_0x7ac4('0x22')]=function(_0x4d4f01,_0x6b85b3){var _0x2b30be={},_0x5bd02b={},_0x6364fb={'count':0x0,'rows':[]};var _0x39a96a=_['map'](db['MailSubstatus'][_0x7ac4('0x23')],function(_0x307a41){return{'name':_0x307a41[_0x7ac4('0x24')],'type':_0x307a41[_0x7ac4('0x25')][_0x7ac4('0x26')]};});_0x5bd02b[_0x7ac4('0x27')]=_[_0x7ac4('0x28')](_0x39a96a,_0x7ac4('0x21'));_0x5bd02b[_0x7ac4('0x29')]=_[_0x7ac4('0x2a')](_0x4d4f01['query']);_0x5bd02b[_0x7ac4('0x2b')]=_[_0x7ac4('0x2c')](_0x5bd02b['model'],_0x5bd02b[_0x7ac4('0x29')]);_0x2b30be['attributes']=_['intersection'](_0x5bd02b['model'],qs['fields'](_0x4d4f01['query'][_0x7ac4('0x2d')]));_0x2b30be[_0x7ac4('0x2e')]=_0x2b30be[_0x7ac4('0x2e')][_0x7ac4('0x2f')]?_0x2b30be[_0x7ac4('0x2e')]:_0x5bd02b[_0x7ac4('0x27')];if(!_0x4d4f01['query']['hasOwnProperty']('nolimit')){_0x2b30be['limit']=qs[_0x7ac4('0x30')](_0x4d4f01['query'][_0x7ac4('0x30')]);_0x2b30be[_0x7ac4('0x17')]=qs[_0x7ac4('0x17')](_0x4d4f01[_0x7ac4('0x29')][_0x7ac4('0x17')]);}_0x2b30be['order']=qs[_0x7ac4('0x31')](_0x4d4f01[_0x7ac4('0x29')][_0x7ac4('0x31')]);_0x2b30be[_0x7ac4('0x32')]=qs[_0x7ac4('0x2b')](_['pick'](_0x4d4f01[_0x7ac4('0x29')],_0x5bd02b[_0x7ac4('0x2b')]),_0x39a96a);if(_0x4d4f01[_0x7ac4('0x29')]['filter']){_0x2b30be['where']=_[_0x7ac4('0x33')](_0x2b30be[_0x7ac4('0x32')],{'$or':_[_0x7ac4('0x28')](_0x39a96a,function(_0x199d3f){if(_0x199d3f[_0x7ac4('0x25')]!==_0x7ac4('0x34')){var _0x2d5e94={};_0x2d5e94[_0x199d3f['name']]={'$like':'%'+_0x4d4f01[_0x7ac4('0x29')][_0x7ac4('0x35')]+'%'};return _0x2d5e94;}})});}_0x2b30be=_['merge']({},_0x2b30be,_0x4d4f01[_0x7ac4('0x36')]);var _0x3515d9={'where':_0x2b30be[_0x7ac4('0x32')]};return db[_0x7ac4('0x37')][_0x7ac4('0x16')](_0x3515d9)['then'](function(_0x31f5e4){_0x6364fb['count']=_0x31f5e4;if(_0x4d4f01['query'][_0x7ac4('0x38')]){_0x2b30be[_0x7ac4('0x39')]=[{'all':!![]}];}return db[_0x7ac4('0x37')]['findAll'](_0x2b30be);})[_0x7ac4('0x1e')](function(_0x5d6eb1){_0x6364fb[_0x7ac4('0x3a')]=_0x5d6eb1;return _0x6364fb;})[_0x7ac4('0x1e')](respondWithFilteredResult(_0x6b85b3,_0x2b30be))[_0x7ac4('0x3b')](handleError(_0x6b85b3,null));};exports[_0x7ac4('0x3c')]=function(_0x25b9ae,_0x108a2c){var _0x113ce6={'raw':!![],'where':{'id':_0x25b9ae[_0x7ac4('0x3d')]['id']}},_0x45ad50={};_0x45ad50['model']=_[_0x7ac4('0x2a')](db['MailSubstatus'][_0x7ac4('0x23')]);_0x45ad50['query']=_['keys'](_0x25b9ae[_0x7ac4('0x29')]);_0x45ad50[_0x7ac4('0x2b')]=_[_0x7ac4('0x2c')](_0x45ad50[_0x7ac4('0x27')],_0x45ad50['query']);_0x113ce6[_0x7ac4('0x2e')]=_['intersection'](_0x45ad50[_0x7ac4('0x27')],qs[_0x7ac4('0x2d')](_0x25b9ae[_0x7ac4('0x29')][_0x7ac4('0x2d')]));_0x113ce6[_0x7ac4('0x2e')]=_0x113ce6[_0x7ac4('0x2e')]['length']?_0x113ce6[_0x7ac4('0x2e')]:_0x45ad50[_0x7ac4('0x27')];if(_0x25b9ae[_0x7ac4('0x29')]['includeAll']){_0x113ce6['include']=[{'all':!![]}];}_0x113ce6=_[_0x7ac4('0x33')]({},_0x113ce6,_0x25b9ae[_0x7ac4('0x36')]);return db[_0x7ac4('0x37')][_0x7ac4('0x3e')](_0x113ce6)['then'](handleEntityNotFound(_0x108a2c,null))[_0x7ac4('0x1e')](respondWithResult(_0x108a2c,null))['catch'](handleError(_0x108a2c,null));};exports[_0x7ac4('0x3f')]=function(_0x1c953c,_0x102551){return db[_0x7ac4('0x37')][_0x7ac4('0x3f')](_0x1c953c[_0x7ac4('0x40')],{})[_0x7ac4('0x1e')](respondWithResult(_0x102551,0xc9))['catch'](handleError(_0x102551,null));};exports[_0x7ac4('0x1d')]=function(_0x100d96,_0x4a1a79){if(_0x100d96[_0x7ac4('0x40')]['id']){delete _0x100d96[_0x7ac4('0x40')]['id'];}return db[_0x7ac4('0x37')][_0x7ac4('0x3e')]({'where':{'id':_0x100d96[_0x7ac4('0x3d')]['id']}})[_0x7ac4('0x1e')](handleEntityNotFound(_0x4a1a79,null))[_0x7ac4('0x1e')](saveUpdates(_0x100d96['body'],null))['then'](respondWithResult(_0x4a1a79,null))[_0x7ac4('0x3b')](handleError(_0x4a1a79,null));};exports[_0x7ac4('0x41')]=function(_0x3331b0,_0x11ecc){return db[_0x7ac4('0x37')][_0x7ac4('0x3e')]({'where':{'id':_0x3331b0[_0x7ac4('0x3d')]['id']}})[_0x7ac4('0x1e')](handleEntityNotFound(_0x11ecc,null))[_0x7ac4('0x1e')](removeEntity(_0x11ecc,null))[_0x7ac4('0x3b')](handleError(_0x11ecc,null));};exports[_0x7ac4('0x42')]=function(_0x4ccd5c,_0x5276c1){return db[_0x7ac4('0x37')]['describe']()[_0x7ac4('0x1e')](respondWithResult(_0x5276c1,null))[_0x7ac4('0x3b')](handleError(_0x5276c1,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index b84478c..a2e413a 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 _0x28f2=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','mail_substatuses'];(function(_0x1f0138,_0x3254e9){var _0x52f9e0=function(_0x4e72e6){while(--_0x4e72e6){_0x1f0138['push'](_0x1f0138['shift']());}};_0x52f9e0(++_0x3254e9);}(_0x28f2,0x193));var _0x228f=function(_0x337e5f,_0x519eb3){_0x337e5f=_0x337e5f-0x0;var _0x5789fc=_0x28f2[_0x337e5f];return _0x5789fc;};'use strict';var _=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var logger=require(_0x228f('0x2'))(_0x228f('0x3'));var moment=require(_0x228f('0x4'));var BPromise=require('bluebird');var rp=require(_0x228f('0x5'));var fs=require('fs');var path=require(_0x228f('0x6'));var rimraf=require(_0x228f('0x7'));var config=require(_0x228f('0x8'));var attributes=require(_0x228f('0x9'));module[_0x228f('0xa')]=function(_0x32c5c3,_0x485423){return _0x32c5c3[_0x228f('0xb')]('MailSubstatus',attributes,{'tableName':_0x228f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9264=['mail_substatuses','lodash','util','../../config/logger','api','request-promise','../../config/environment','define'];(function(_0x23e194,_0x2a024c){var _0x341621=function(_0x235417){while(--_0x235417){_0x23e194['push'](_0x23e194['shift']());}};_0x341621(++_0x2a024c);}(_0x9264,0xb1));var _0x4926=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9264[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4926('0x0'));var util=require(_0x4926('0x1'));var logger=require(_0x4926('0x2'))(_0x4926('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4926('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4926('0x5'));var attributes=require('./mailSubstatus.attributes');module['exports']=function(_0x54e5ea,_0x3ee7b4){return _0x54e5ea[_0x4926('0x6')]('MailSubstatus',attributes,{'tableName':_0x4926('0x7'),'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 340030e..7bd030e 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 _0xb4e6=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x44b585,_0x120e48){var _0x38dd43=function(_0x2c6be7){while(--_0x2c6be7){_0x44b585['push'](_0x44b585['shift']());}};_0x38dd43(++_0x120e48);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0xe3e0af,_0x4564ed){_0xe3e0af=_0xe3e0af-0x0;var _0x4828e9=_0xb4e6[_0xe3e0af];return _0x4828e9;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var moment=require(_0x6b4e('0x1'));var BPromise=require(_0x6b4e('0x2'));var rs=require(_0x6b4e('0x3'));var fs=require('fs');var Redis=require(_0x6b4e('0x4'));var db=require(_0x6b4e('0x5'))['db'];var utils=require(_0x6b4e('0x6'));var logger=require(_0x6b4e('0x7'))('rpc');var config=require(_0x6b4e('0x8'));var jayson=require(_0x6b4e('0x9'));var client=jayson[_0x6b4e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd3138f,_0x570346,_0x4f00be){return new BPromise(function(_0x2311d9,_0x48c870){return client['request'](_0xd3138f,_0x4f00be)[_0x6b4e('0xb')](function(_0x2bd576){logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));logger[_0x6b4e('0xf')](_0x6b4e('0x10'),_0x570346,'request\x20sent',JSON[_0x6b4e('0x11')](_0x2bd576));if(_0x2bd576[_0x6b4e('0x12')]){if(_0x2bd576['error'][_0x6b4e('0x13')]===0x1f4){logger[_0x6b4e('0x12')](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);return _0x48c870(_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);}logger['error'](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')]['message']);return _0x2311d9(_0x2bd576[_0x6b4e('0x12')]['message']);}else{logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));_0x2311d9(_0x2bd576[_0x6b4e('0x15')][_0x6b4e('0x14')]);}})[_0x6b4e('0x16')](function(_0x53a934){logger['error'](_0x6b4e('0xd'),_0x570346,_0x53a934);_0x48c870(_0x53a934);});});} \ No newline at end of file +var _0x0713=['MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1d0aa9,_0x572e9d){var _0x485a98=function(_0x54c170){while(--_0x54c170){_0x1d0aa9['push'](_0x1d0aa9['shift']());}};_0x485a98(++_0x572e9d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index e8b503a..d369b26 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 _0x9efe=['/describe','describe','/:id','show','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index'];(function(_0x2dd4cd,_0x2c7c19){var _0x20558c=function(_0x9fdc2c){while(--_0x9fdc2c){_0x2dd4cd['push'](_0x2dd4cd['shift']());}};_0x20558c(++_0x2c7c19);}(_0x9efe,0xf9));var _0xe9ef=function(_0x28433a,_0x2b479a){_0x28433a=_0x28433a-0x0;var _0x1b9156=_0x9efe[_0x28433a];return _0x1b9156;};'use strict';var multer=require(_0xe9ef('0x0'));var util=require(_0xe9ef('0x1'));var path=require(_0xe9ef('0x2'));var timeout=require(_0xe9ef('0x3'));var express=require(_0xe9ef('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe9ef('0x5'));var config=require(_0xe9ef('0x6'));var controller=require(_0xe9ef('0x7'));router[_0xe9ef('0x8')]('/',auth[_0xe9ef('0x9')](),controller[_0xe9ef('0xa')]);router[_0xe9ef('0x8')](_0xe9ef('0xb'),auth['isAuthenticated'](),controller[_0xe9ef('0xc')]);router['get'](_0xe9ef('0xd'),auth[_0xe9ef('0x9')](),controller[_0xe9ef('0xe')]);router[_0xe9ef('0xf')]('/',auth['isAuthenticated'](),controller[_0xe9ef('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xe9ef('0x11')]);router['delete']('/:id',auth[_0xe9ef('0x9')](),controller[_0xe9ef('0x12')]);module[_0xe9ef('0x13')]=router; \ No newline at end of file +var _0xf728=['post','create','/:id','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','describe','show'];(function(_0x3e9925,_0x3bb69e){var _0x268498=function(_0x52a3f6){while(--_0x52a3f6){_0x3e9925['push'](_0x3e9925['shift']());}};_0x268498(++_0x3bb69e);}(_0xf728,0xe3));var _0x8f72=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xf728[_0x373dee];return _0x46798f;};'use strict';var multer=require(_0x8f72('0x0'));var util=require('util');var path=require(_0x8f72('0x1'));var timeout=require('connect-timeout');var express=require(_0x8f72('0x2'));var router=express[_0x8f72('0x3')]();var auth=require(_0x8f72('0x4'));var interaction=require(_0x8f72('0x5'));var config=require(_0x8f72('0x6'));var controller=require(_0x8f72('0x7'));router[_0x8f72('0x8')]('/',auth[_0x8f72('0x9')](),controller[_0x8f72('0xa')]);router[_0x8f72('0x8')]('/describe',auth[_0x8f72('0x9')](),controller[_0x8f72('0xb')]);router[_0x8f72('0x8')]('/:id',auth[_0x8f72('0x9')](),controller[_0x8f72('0xc')]);router[_0x8f72('0xd')]('/',auth[_0x8f72('0x9')](),controller[_0x8f72('0xe')]);router['put'](_0x8f72('0xf'),auth[_0x8f72('0x9')](),controller[_0x8f72('0x10')]);router[_0x8f72('0x11')](_0x8f72('0xf'),auth[_0x8f72('0x9')](),controller[_0x8f72('0x12')]);module[_0x8f72('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 477e1c9..ddad796 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 _0x61ee=['exports','ENUM','agent','queue','DATE','moment','sequelize'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x61ee,0xd0));var _0xe61e=function(_0x3181cc,_0x28447f){_0x3181cc=_0x3181cc-0x0;var _0x547a4a=_0x61ee[_0x3181cc];return _0x547a4a;};'use strict';var moment=require(_0xe61e('0x0'));var Sequelize=require(_0xe61e('0x1'));module[_0xe61e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xe61e('0x3')]('account',_0xe61e('0x4'),_0xe61e('0x5')),'allowNull':![],'defaultValue':_0xe61e('0x5')},'transferredAt':{'type':Sequelize[_0xe61e('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x5211=['account','agent','queue','DATE','moment','sequelize','ENUM'];(function(_0x449013,_0x3dbd7d){var _0x4c9386=function(_0x73b0c9){while(--_0x73b0c9){_0x449013['push'](_0x449013['shift']());}};_0x4c9386(++_0x3dbd7d);}(_0x5211,0x90));var _0x1521=function(_0x264965,_0x156b5b){_0x264965=_0x264965-0x0;var _0x3a79b2=_0x5211[_0x264965];return _0x3a79b2;};'use strict';var moment=require(_0x1521('0x0'));var Sequelize=require(_0x1521('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x1521('0x2')](_0x1521('0x3'),_0x1521('0x4'),_0x1521('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x1521('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 845866c..87a702c 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 _0x7980=['type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','merge','filter','count','includeAll','include','findAll','rows','catch','show','keys','length','options','create','body','find','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','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','status','end','offset','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','MailTransferReport','rawAttributes'];(function(_0x5c64d1,_0x1920fd){var _0x29646f=function(_0x24d01c){while(--_0x24d01c){_0x5c64d1['push'](_0x5c64d1['shift']());}};_0x29646f(++_0x1920fd);}(_0x7980,0x1a6));var _0x0798=function(_0x100209,_0x3b7819){_0x100209=_0x100209-0x0;var _0x3a3fda=_0x7980[_0x100209];return _0x3a3fda;};'use strict';var pdf=require(_0x0798('0x0'));var emlformat=require(_0x0798('0x1'));var rimraf=require(_0x0798('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0798('0x3'));var rp=require(_0x0798('0x4'));var moment=require('moment');var BPromise=require(_0x0798('0x5'));var Mustache=require(_0x0798('0x6'));var util=require(_0x0798('0x7'));var path=require(_0x0798('0x8'));var sox=require(_0x0798('0x9'));var csv=require(_0x0798('0xa'));var ejs=require(_0x0798('0xb'));var fs=require('fs');var _=require(_0x0798('0xc'));var squel=require(_0x0798('0xd'));var crypto=require('crypto');var jsforce=require(_0x0798('0xe'));var deskjs=require(_0x0798('0xf'));var toCsv=require(_0x0798('0xa'));var querystring=require(_0x0798('0x10'));var Papa=require(_0x0798('0x11'));var Redis=require(_0x0798('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0798('0x13'));var as=require(_0x0798('0x14'));var hardwareService=require(_0x0798('0x15'));var logger=require(_0x0798('0x16'))(_0x0798('0x17'));var utils=require(_0x0798('0x18'));var config=require(_0x0798('0x19'));var licenseUtil=require(_0x0798('0x1a'));var db=require(_0x0798('0x1b'))['db'];function respondWithStatusCode(_0x278630,_0x11fb0b){_0x11fb0b=_0x11fb0b||0xcc;return function(_0x576008){if(_0x576008){return _0x278630['sendStatus'](_0x11fb0b);}return _0x278630[_0x0798('0x1c')](_0x11fb0b)[_0x0798('0x1d')]();};}function respondWithResult(_0x2457dd,_0x224136){_0x224136=_0x224136||0xc8;return function(_0x46a6e9){if(_0x46a6e9){return _0x2457dd[_0x0798('0x1c')](_0x224136)['json'](_0x46a6e9);}};}function respondWithFilteredResult(_0x577f39,_0x58bb11){return function(_0x2da8ea){if(_0x2da8ea){var _0xafd274=_0x2da8ea['count'],_0x247df4=_0x58bb11[_0x0798('0x1e')],_0x54accc=_0x58bb11['offset']+_0x58bb11['limit'],_0x574fb3;if(_0x54accc>=_0xafd274){_0x54accc=_0xafd274;_0x574fb3=0xc8;}else{_0x574fb3=0xce;}_0x577f39[_0x0798('0x1c')](_0x574fb3);return _0x577f39['set'](_0x0798('0x1f'),_0x247df4+'-'+_0x54accc+'/'+_0xafd274)[_0x0798('0x20')](_0x2da8ea);}return null;};}function patchUpdates(_0x496ea7){return function(_0x189971){try{jsonpatch[_0x0798('0x21')](_0x189971,_0x496ea7,!![]);}catch(_0x3eb63b){return BPromise[_0x0798('0x22')](_0x3eb63b);}return _0x189971[_0x0798('0x23')]();};}function saveUpdates(_0x38aaea,_0x288bc6){return function(_0x45e56a){if(_0x45e56a){return _0x45e56a[_0x0798('0x24')](_0x38aaea)[_0x0798('0x25')](function(_0x73f449){return _0x73f449;});}return null;};}function removeEntity(_0x9f1b98,_0x41f6c3){return function(_0x2b0f91){if(_0x2b0f91){return _0x2b0f91[_0x0798('0x26')]()[_0x0798('0x25')](function(){_0x9f1b98[_0x0798('0x1c')](0xcc)[_0x0798('0x1d')]();});}};}function handleEntityNotFound(_0x19946c,_0x444570){return function(_0x1064b4){if(!_0x1064b4){_0x19946c['sendStatus'](0x194);}return _0x1064b4;};}function handleError(_0x8df36e,_0x122f73){_0x122f73=_0x122f73||0x1f4;return function(_0x3c9da9){logger[_0x0798('0x27')](_0x3c9da9[_0x0798('0x28')]);if(_0x3c9da9[_0x0798('0x29')]){delete _0x3c9da9[_0x0798('0x29')];}_0x8df36e['status'](_0x122f73)[_0x0798('0x2a')](_0x3c9da9);};}exports[_0x0798('0x2b')]=function(_0x306e90,_0x264596){var _0x29091f={},_0x2a6eab={},_0xf26bc8={'count':0x0,'rows':[]};var _0x52a2d3=_['map'](db[_0x0798('0x2c')][_0x0798('0x2d')],function(_0x1834a1){return{'name':_0x1834a1['fieldName'],'type':_0x1834a1[_0x0798('0x2e')][_0x0798('0x2f')]};});_0x2a6eab[_0x0798('0x30')]=_[_0x0798('0x31')](_0x52a2d3,_0x0798('0x29'));_0x2a6eab[_0x0798('0x32')]=_['keys'](_0x306e90[_0x0798('0x32')]);_0x2a6eab[_0x0798('0x33')]=_[_0x0798('0x34')](_0x2a6eab[_0x0798('0x30')],_0x2a6eab['query']);_0x29091f[_0x0798('0x35')]=_[_0x0798('0x34')](_0x2a6eab['model'],qs['fields'](_0x306e90['query'][_0x0798('0x36')]));_0x29091f[_0x0798('0x35')]=_0x29091f[_0x0798('0x35')]['length']?_0x29091f['attributes']:_0x2a6eab[_0x0798('0x30')];if(!_0x306e90[_0x0798('0x32')][_0x0798('0x37')]('nolimit')){_0x29091f[_0x0798('0x38')]=qs[_0x0798('0x38')](_0x306e90[_0x0798('0x32')]['limit']);_0x29091f[_0x0798('0x1e')]=qs[_0x0798('0x1e')](_0x306e90[_0x0798('0x32')][_0x0798('0x1e')]);}_0x29091f[_0x0798('0x39')]=qs[_0x0798('0x3a')](_0x306e90[_0x0798('0x32')][_0x0798('0x3a')]);_0x29091f[_0x0798('0x3b')]=qs[_0x0798('0x33')](_[_0x0798('0x3c')](_0x306e90[_0x0798('0x32')],_0x2a6eab[_0x0798('0x33')]),_0x52a2d3);if(_0x306e90['query']['filter']){_0x29091f[_0x0798('0x3b')]=_[_0x0798('0x3d')](_0x29091f['where'],{'$or':_[_0x0798('0x31')](_0x52a2d3,function(_0x5ef881){if(_0x5ef881[_0x0798('0x2e')]!=='VIRTUAL'){var _0xa40ee7={};_0xa40ee7[_0x5ef881[_0x0798('0x29')]]={'$like':'%'+_0x306e90[_0x0798('0x32')][_0x0798('0x3e')]+'%'};return _0xa40ee7;}})});}_0x29091f=_[_0x0798('0x3d')]({},_0x29091f,_0x306e90['options']);var _0x88fab4={'where':_0x29091f[_0x0798('0x3b')]};return db['MailTransferReport'][_0x0798('0x3f')](_0x88fab4)['then'](function(_0x4d5f79){_0xf26bc8[_0x0798('0x3f')]=_0x4d5f79;if(_0x306e90[_0x0798('0x32')][_0x0798('0x40')]){_0x29091f[_0x0798('0x41')]=[{'all':!![]}];}return db[_0x0798('0x2c')][_0x0798('0x42')](_0x29091f);})[_0x0798('0x25')](function(_0x111944){_0xf26bc8[_0x0798('0x43')]=_0x111944;return _0xf26bc8;})[_0x0798('0x25')](respondWithFilteredResult(_0x264596,_0x29091f))[_0x0798('0x44')](handleError(_0x264596,null));};exports[_0x0798('0x45')]=function(_0x5a32ee,_0x37f8ca){var _0x311e75={'raw':!![],'where':{'id':_0x5a32ee['params']['id']}},_0x51a77a={};_0x51a77a[_0x0798('0x30')]=_[_0x0798('0x46')](db[_0x0798('0x2c')]['rawAttributes']);_0x51a77a[_0x0798('0x32')]=_[_0x0798('0x46')](_0x5a32ee[_0x0798('0x32')]);_0x51a77a[_0x0798('0x33')]=_['intersection'](_0x51a77a[_0x0798('0x30')],_0x51a77a[_0x0798('0x32')]);_0x311e75[_0x0798('0x35')]=_[_0x0798('0x34')](_0x51a77a[_0x0798('0x30')],qs[_0x0798('0x36')](_0x5a32ee[_0x0798('0x32')][_0x0798('0x36')]));_0x311e75[_0x0798('0x35')]=_0x311e75['attributes'][_0x0798('0x47')]?_0x311e75[_0x0798('0x35')]:_0x51a77a[_0x0798('0x30')];if(_0x5a32ee[_0x0798('0x32')]['includeAll']){_0x311e75['include']=[{'all':!![]}];}_0x311e75=_[_0x0798('0x3d')]({},_0x311e75,_0x5a32ee[_0x0798('0x48')]);return db['MailTransferReport']['find'](_0x311e75)[_0x0798('0x25')](handleEntityNotFound(_0x37f8ca,null))[_0x0798('0x25')](respondWithResult(_0x37f8ca,null))[_0x0798('0x44')](handleError(_0x37f8ca,null));};exports[_0x0798('0x49')]=function(_0x50417a,_0x19debd){return db[_0x0798('0x2c')][_0x0798('0x49')](_0x50417a[_0x0798('0x4a')],{})[_0x0798('0x25')](respondWithResult(_0x19debd,0xc9))[_0x0798('0x44')](handleError(_0x19debd,null));};exports[_0x0798('0x24')]=function(_0x53aa8d,_0x472d5f){if(_0x53aa8d[_0x0798('0x4a')]['id']){delete _0x53aa8d['body']['id'];}return db['MailTransferReport'][_0x0798('0x4b')]({'where':{'id':_0x53aa8d['params']['id']}})[_0x0798('0x25')](handleEntityNotFound(_0x472d5f,null))[_0x0798('0x25')](saveUpdates(_0x53aa8d[_0x0798('0x4a')],null))[_0x0798('0x25')](respondWithResult(_0x472d5f,null))[_0x0798('0x44')](handleError(_0x472d5f,null));};exports[_0x0798('0x26')]=function(_0x4ec713,_0x5e4261){return db[_0x0798('0x2c')][_0x0798('0x4b')]({'where':{'id':_0x4ec713[_0x0798('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5e4261,null))['then'](removeEntity(_0x5e4261,null))[_0x0798('0x44')](handleError(_0x5e4261,null));};exports[_0x0798('0x4d')]=function(_0x1baf0d,_0x3cadce){return db[_0x0798('0x2c')]['describe']()[_0x0798('0x25')](respondWithResult(_0x3cadce,null))[_0x0798('0x44')](handleError(_0x3cadce,null));}; \ No newline at end of file +var _0x3cdc=['error','stack','name','send','index','MailTransferReport','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','nolimit','sort','where','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','options','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy'];(function(_0x3f7c7e,_0x1a023c){var _0x313e0d=function(_0x527225){while(--_0x527225){_0x3f7c7e['push'](_0x3f7c7e['shift']());}};_0x313e0d(++_0x1a023c);}(_0x3cdc,0x10c));var _0xc3cd=function(_0x21205e,_0x7eb8e7){_0x21205e=_0x21205e-0x0;var _0x136ebb=_0x3cdc[_0x21205e];return _0x136ebb;};'use strict';var pdf=require(_0xc3cd('0x0'));var emlformat=require(_0xc3cd('0x1'));var rimraf=require(_0xc3cd('0x2'));var zipdir=require(_0xc3cd('0x3'));var jsonpatch=require(_0xc3cd('0x4'));var rp=require(_0xc3cd('0x5'));var moment=require('moment');var BPromise=require(_0xc3cd('0x6'));var Mustache=require(_0xc3cd('0x7'));var util=require(_0xc3cd('0x8'));var path=require(_0xc3cd('0x9'));var sox=require(_0xc3cd('0xa'));var csv=require('to-csv');var ejs=require(_0xc3cd('0xb'));var fs=require('fs');var _=require(_0xc3cd('0xc'));var squel=require(_0xc3cd('0xd'));var crypto=require('crypto');var jsforce=require(_0xc3cd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc3cd('0xf'));var querystring=require(_0xc3cd('0x10'));var Papa=require(_0xc3cd('0x11'));var Redis=require(_0xc3cd('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc3cd('0x13'));var as=require(_0xc3cd('0x14'));var hardwareService=require(_0xc3cd('0x15'));var logger=require(_0xc3cd('0x16'))(_0xc3cd('0x17'));var utils=require(_0xc3cd('0x18'));var config=require(_0xc3cd('0x19'));var licenseUtil=require(_0xc3cd('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b1553,_0x33e8f0){_0x33e8f0=_0x33e8f0||0xcc;return function(_0x2da8b4){if(_0x2da8b4){return _0x2b1553[_0xc3cd('0x1b')](_0x33e8f0);}return _0x2b1553[_0xc3cd('0x1c')](_0x33e8f0)['end']();};}function respondWithResult(_0x583858,_0x31fae1){_0x31fae1=_0x31fae1||0xc8;return function(_0x34e6fd){if(_0x34e6fd){return _0x583858[_0xc3cd('0x1c')](_0x31fae1)[_0xc3cd('0x1d')](_0x34e6fd);}};}function respondWithFilteredResult(_0x3721e7,_0xa46ccf){return function(_0x4625ce){if(_0x4625ce){var _0x1e6ba3=_0x4625ce[_0xc3cd('0x1e')],_0x29d1b2=_0xa46ccf[_0xc3cd('0x1f')],_0x295e86=_0xa46ccf['offset']+_0xa46ccf[_0xc3cd('0x20')],_0x17b549;if(_0x295e86>=_0x1e6ba3){_0x295e86=_0x1e6ba3;_0x17b549=0xc8;}else{_0x17b549=0xce;}_0x3721e7[_0xc3cd('0x1c')](_0x17b549);return _0x3721e7[_0xc3cd('0x21')](_0xc3cd('0x22'),_0x29d1b2+'-'+_0x295e86+'/'+_0x1e6ba3)[_0xc3cd('0x1d')](_0x4625ce);}return null;};}function patchUpdates(_0x2a5a8b){return function(_0x179392){try{jsonpatch[_0xc3cd('0x23')](_0x179392,_0x2a5a8b,!![]);}catch(_0x38e9ac){return BPromise[_0xc3cd('0x24')](_0x38e9ac);}return _0x179392[_0xc3cd('0x25')]();};}function saveUpdates(_0x38ac3a,_0x3adaa8){return function(_0xdaadb3){if(_0xdaadb3){return _0xdaadb3['update'](_0x38ac3a)[_0xc3cd('0x26')](function(_0x5a30d8){return _0x5a30d8;});}return null;};}function removeEntity(_0x190d77,_0x388b6d){return function(_0x41b5c2){if(_0x41b5c2){return _0x41b5c2[_0xc3cd('0x27')]()[_0xc3cd('0x26')](function(){_0x190d77[_0xc3cd('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ae5cb,_0x242963){return function(_0x36f62b){if(!_0x36f62b){_0x3ae5cb[_0xc3cd('0x1b')](0x194);}return _0x36f62b;};}function handleError(_0xed076a,_0x2941cc){_0x2941cc=_0x2941cc||0x1f4;return function(_0xa06a5){logger[_0xc3cd('0x28')](_0xa06a5[_0xc3cd('0x29')]);if(_0xa06a5[_0xc3cd('0x2a')]){delete _0xa06a5[_0xc3cd('0x2a')];}_0xed076a[_0xc3cd('0x1c')](_0x2941cc)[_0xc3cd('0x2b')](_0xa06a5);};}exports[_0xc3cd('0x2c')]=function(_0x113c07,_0x1a5499){var _0x563a2f={},_0x376a8e={},_0x4a4c25={'count':0x0,'rows':[]};var _0x85716a=_['map'](db[_0xc3cd('0x2d')][_0xc3cd('0x2e')],function(_0x43ccbb){return{'name':_0x43ccbb[_0xc3cd('0x2f')],'type':_0x43ccbb[_0xc3cd('0x30')][_0xc3cd('0x31')]};});_0x376a8e[_0xc3cd('0x32')]=_[_0xc3cd('0x33')](_0x85716a,_0xc3cd('0x2a'));_0x376a8e['query']=_[_0xc3cd('0x34')](_0x113c07['query']);_0x376a8e[_0xc3cd('0x35')]=_[_0xc3cd('0x36')](_0x376a8e[_0xc3cd('0x32')],_0x376a8e[_0xc3cd('0x37')]);_0x563a2f[_0xc3cd('0x38')]=_[_0xc3cd('0x36')](_0x376a8e[_0xc3cd('0x32')],qs[_0xc3cd('0x39')](_0x113c07[_0xc3cd('0x37')][_0xc3cd('0x39')]));_0x563a2f[_0xc3cd('0x38')]=_0x563a2f['attributes'][_0xc3cd('0x3a')]?_0x563a2f[_0xc3cd('0x38')]:_0x376a8e['model'];if(!_0x113c07[_0xc3cd('0x37')]['hasOwnProperty'](_0xc3cd('0x3b'))){_0x563a2f['limit']=qs['limit'](_0x113c07[_0xc3cd('0x37')][_0xc3cd('0x20')]);_0x563a2f['offset']=qs[_0xc3cd('0x1f')](_0x113c07['query'][_0xc3cd('0x1f')]);}_0x563a2f['order']=qs[_0xc3cd('0x3c')](_0x113c07[_0xc3cd('0x37')][_0xc3cd('0x3c')]);_0x563a2f['where']=qs[_0xc3cd('0x35')](_['pick'](_0x113c07[_0xc3cd('0x37')],_0x376a8e[_0xc3cd('0x35')]),_0x85716a);if(_0x113c07[_0xc3cd('0x37')]['filter']){_0x563a2f[_0xc3cd('0x3d')]=_[_0xc3cd('0x3e')](_0x563a2f[_0xc3cd('0x3d')],{'$or':_[_0xc3cd('0x33')](_0x85716a,function(_0x53cfa6){if(_0x53cfa6[_0xc3cd('0x30')]!==_0xc3cd('0x3f')){var _0x21ab40={};_0x21ab40[_0x53cfa6['name']]={'$like':'%'+_0x113c07['query'][_0xc3cd('0x40')]+'%'};return _0x21ab40;}})});}_0x563a2f=_[_0xc3cd('0x3e')]({},_0x563a2f,_0x113c07['options']);var _0x56faeb={'where':_0x563a2f[_0xc3cd('0x3d')]};return db[_0xc3cd('0x2d')]['count'](_0x56faeb)[_0xc3cd('0x26')](function(_0x1488db){_0x4a4c25['count']=_0x1488db;if(_0x113c07[_0xc3cd('0x37')][_0xc3cd('0x41')]){_0x563a2f[_0xc3cd('0x42')]=[{'all':!![]}];}return db[_0xc3cd('0x2d')]['findAll'](_0x563a2f);})[_0xc3cd('0x26')](function(_0x464298){_0x4a4c25[_0xc3cd('0x43')]=_0x464298;return _0x4a4c25;})[_0xc3cd('0x26')](respondWithFilteredResult(_0x1a5499,_0x563a2f))[_0xc3cd('0x44')](handleError(_0x1a5499,null));};exports[_0xc3cd('0x45')]=function(_0x3530f6,_0xf70a7a){var _0x1abbd3={'raw':!![],'where':{'id':_0x3530f6[_0xc3cd('0x46')]['id']}},_0x183007={};_0x183007['model']=_['keys'](db['MailTransferReport'][_0xc3cd('0x2e')]);_0x183007['query']=_[_0xc3cd('0x34')](_0x3530f6[_0xc3cd('0x37')]);_0x183007[_0xc3cd('0x35')]=_['intersection'](_0x183007['model'],_0x183007[_0xc3cd('0x37')]);_0x1abbd3[_0xc3cd('0x38')]=_[_0xc3cd('0x36')](_0x183007[_0xc3cd('0x32')],qs[_0xc3cd('0x39')](_0x3530f6['query'][_0xc3cd('0x39')]));_0x1abbd3[_0xc3cd('0x38')]=_0x1abbd3[_0xc3cd('0x38')][_0xc3cd('0x3a')]?_0x1abbd3[_0xc3cd('0x38')]:_0x183007[_0xc3cd('0x32')];if(_0x3530f6[_0xc3cd('0x37')][_0xc3cd('0x41')]){_0x1abbd3[_0xc3cd('0x42')]=[{'all':!![]}];}_0x1abbd3=_[_0xc3cd('0x3e')]({},_0x1abbd3,_0x3530f6[_0xc3cd('0x47')]);return db['MailTransferReport'][_0xc3cd('0x48')](_0x1abbd3)[_0xc3cd('0x26')](handleEntityNotFound(_0xf70a7a,null))['then'](respondWithResult(_0xf70a7a,null))[_0xc3cd('0x44')](handleError(_0xf70a7a,null));};exports[_0xc3cd('0x49')]=function(_0x3a4ef4,_0x4cd32a){return db[_0xc3cd('0x2d')][_0xc3cd('0x49')](_0x3a4ef4[_0xc3cd('0x4a')],{})[_0xc3cd('0x26')](respondWithResult(_0x4cd32a,0xc9))[_0xc3cd('0x44')](handleError(_0x4cd32a,null));};exports[_0xc3cd('0x4b')]=function(_0x1df177,_0x2e7759){if(_0x1df177[_0xc3cd('0x4a')]['id']){delete _0x1df177[_0xc3cd('0x4a')]['id'];}return db['MailTransferReport'][_0xc3cd('0x48')]({'where':{'id':_0x1df177[_0xc3cd('0x46')]['id']}})[_0xc3cd('0x26')](handleEntityNotFound(_0x2e7759,null))['then'](saveUpdates(_0x1df177[_0xc3cd('0x4a')],null))[_0xc3cd('0x26')](respondWithResult(_0x2e7759,null))[_0xc3cd('0x44')](handleError(_0x2e7759,null));};exports[_0xc3cd('0x27')]=function(_0x42d58d,_0x472c07){return db[_0xc3cd('0x2d')][_0xc3cd('0x48')]({'where':{'id':_0x42d58d[_0xc3cd('0x46')]['id']}})['then'](handleEntityNotFound(_0x472c07,null))[_0xc3cd('0x26')](removeEntity(_0x472c07,null))[_0xc3cd('0x44')](handleError(_0x472c07,null));};exports[_0xc3cd('0x4c')]=function(_0x3ec6f4,_0x409765){return db['MailTransferReport'][_0xc3cd('0x4c')]()[_0xc3cd('0x26')](respondWithResult(_0x409765,null))[_0xc3cd('0x44')](handleError(_0x409765,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 156d20e..8578f54 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 _0xe95a=['lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0x14eb15,_0x5df0a8){var _0x460dab=function(_0x107e8d){while(--_0x107e8d){_0x14eb15['push'](_0x14eb15['shift']());}};_0x460dab(++_0x5df0a8);}(_0xe95a,0x168));var _0xae95=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xe95a[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0xae95('0x0'));var util=require(_0xae95('0x1'));var logger=require(_0xae95('0x2'))('api');var moment=require('moment');var BPromise=require(_0xae95('0x3'));var rp=require(_0xae95('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xae95('0x5'));var attributes=require(_0xae95('0x6'));module[_0xae95('0x7')]=function(_0x3dd349,_0x26bf7b){return _0x3dd349[_0xae95('0x8')](_0xae95('0x9'),attributes,{'tableName':_0xae95('0xa'),'paranoid':![],'indexes':[{'name':_0xae95('0xb'),'fields':[_0xae95('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x41ac=['bluebird','request-promise','path','rimraf','./mailTransferReport.attributes','exports','define','MailTransferReport','uniqueid','lodash','util','api','moment'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x41ac,0x168));var _0xc41a=function(_0x2e181a,_0x3710ff){_0x2e181a=_0x2e181a-0x0;var _0x40140e=_0x41ac[_0x2e181a];return _0x40140e;};'use strict';var _=require(_0xc41a('0x0'));var util=require(_0xc41a('0x1'));var logger=require('../../config/logger')(_0xc41a('0x2'));var moment=require(_0xc41a('0x3'));var BPromise=require(_0xc41a('0x4'));var rp=require(_0xc41a('0x5'));var fs=require('fs');var path=require(_0xc41a('0x6'));var rimraf=require(_0xc41a('0x7'));var config=require('../../config/environment');var attributes=require(_0xc41a('0x8'));module[_0xc41a('0x9')]=function(_0x2726e4,_0xc5bb7e){return _0x2726e4[_0xc41a('0xa')](_0xc41a('0xb'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xc41a('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 29a7e16..872e8c8 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 _0x1cb4=['bluebird','ioredis','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','MailTransferReport,\x20%s,\x20%s','message','result','catch','util','moment'];(function(_0x1457ba,_0x4952c2){var _0x3839e2=function(_0x44179b){while(--_0x44179b){_0x1457ba['push'](_0x1457ba['shift']());}};_0x3839e2(++_0x4952c2);}(_0x1cb4,0x1a0));var _0x41cb=function(_0x4a078f,_0x10f969){_0x4a078f=_0x4a078f-0x0;var _0x50f45f=_0x1cb4[_0x4a078f];return _0x50f45f;};'use strict';var _=require('lodash');var util=require(_0x41cb('0x0'));var moment=require(_0x41cb('0x1'));var BPromise=require(_0x41cb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41cb('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x41cb('0x4'));var config=require('../../config/environment');var jayson=require(_0x41cb('0x5'));var client=jayson[_0x41cb('0x6')][_0x41cb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5d8430,_0x5785cd,_0x508faf){return new BPromise(function(_0xb5003a,_0x1fc9bb){return client[_0x41cb('0x8')](_0x5d8430,_0x508faf)[_0x41cb('0x9')](function(_0x228ab0){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x5785cd,_0x41cb('0xa'));logger[_0x41cb('0xb')](_0x41cb('0xc'),_0x5785cd,'request\x20sent',JSON[_0x41cb('0xd')](_0x228ab0));if(_0x228ab0['error']){if(_0x228ab0['error']['code']===0x1f4){logger[_0x41cb('0xe')](_0x41cb('0xf'),_0x5785cd,_0x228ab0[_0x41cb('0xe')][_0x41cb('0x10')]);return _0x1fc9bb(_0x228ab0['error'][_0x41cb('0x10')]);}logger[_0x41cb('0xe')](_0x41cb('0xf'),_0x5785cd,_0x228ab0[_0x41cb('0xe')][_0x41cb('0x10')]);return _0xb5003a(_0x228ab0[_0x41cb('0xe')]['message']);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x5785cd,'request\x20sent');_0xb5003a(_0x228ab0[_0x41cb('0x11')][_0x41cb('0x10')]);}})[_0x41cb('0x12')](function(_0x19917f){logger[_0x41cb('0xe')](_0x41cb('0xf'),_0x5785cd,_0x19917f);_0x1fc9bb(_0x19917f);});});} \ No newline at end of file +var _0x9bf7=['../../config/logger','rpc','client','http','request','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x56d569,_0xf52eb7){var _0x3ed656=function(_0x242531){while(--_0x242531){_0x56d569['push'](_0x56d569['shift']());}};_0x3ed656(++_0xf52eb7);}(_0x9bf7,0x1de));var _0x79bf=function(_0x165837,_0x40e5d0){_0x165837=_0x165837-0x0;var _0x47ceac=_0x9bf7[_0x165837];return _0x47ceac;};'use strict';var _=require('lodash');var util=require(_0x79bf('0x0'));var moment=require(_0x79bf('0x1'));var BPromise=require('bluebird');var rs=require(_0x79bf('0x2'));var fs=require('fs');var Redis=require(_0x79bf('0x3'));var db=require(_0x79bf('0x4'))['db'];var utils=require(_0x79bf('0x5'));var logger=require(_0x79bf('0x6'))(_0x79bf('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x79bf('0x8')][_0x79bf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57c87a,_0x163141,_0x15bc01){return new BPromise(function(_0x4889ba,_0x3eab9a){return client[_0x79bf('0xa')](_0x57c87a,_0x15bc01)[_0x79bf('0xb')](function(_0x95dea6){logger['info'](_0x79bf('0xc'),_0x163141,_0x79bf('0xd'));logger[_0x79bf('0xe')](_0x79bf('0xf'),_0x163141,_0x79bf('0xd'),JSON['stringify'](_0x95dea6));if(_0x95dea6[_0x79bf('0x10')]){if(_0x95dea6['error'][_0x79bf('0x11')]===0x1f4){logger[_0x79bf('0x10')](_0x79bf('0xc'),_0x163141,_0x95dea6[_0x79bf('0x10')][_0x79bf('0x12')]);return _0x3eab9a(_0x95dea6['error'][_0x79bf('0x12')]);}logger[_0x79bf('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x163141,_0x95dea6[_0x79bf('0x10')][_0x79bf('0x12')]);return _0x4889ba(_0x95dea6[_0x79bf('0x10')]['message']);}else{logger[_0x79bf('0x13')](_0x79bf('0xc'),_0x163141,_0x79bf('0xd'));_0x4889ba(_0x95dea6[_0x79bf('0x14')][_0x79bf('0x12')]);}})[_0x79bf('0x15')](function(_0x4916fd){logger[_0x79bf('0x10')](_0x79bf('0xc'),_0x163141,_0x4916fd);_0x3eab9a(_0x4916fd);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index bf3e982..afe328e 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 _0x2bdf=['put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./memberReport.controller','isAuthenticated','index','/describe','get','show','post'];(function(_0x11d695,_0x377b72){var _0x52fc15=function(_0x1a3e5b){while(--_0x1a3e5b){_0x11d695['push'](_0x11d695['shift']());}};_0x52fc15(++_0x377b72);}(_0x2bdf,0x123));var _0xf2bd=function(_0x1ad9a1,_0x5e99ed){_0x1ad9a1=_0x1ad9a1-0x0;var _0x262d00=_0x2bdf[_0x1ad9a1];return _0x262d00;};'use strict';var multer=require('multer');var util=require(_0xf2bd('0x0'));var path=require(_0xf2bd('0x1'));var timeout=require(_0xf2bd('0x2'));var express=require(_0xf2bd('0x3'));var router=express['Router']();var auth=require(_0xf2bd('0x4'));var interaction=require(_0xf2bd('0x5'));var config=require('../../config/environment');var controller=require(_0xf2bd('0x6'));router['get']('/',auth[_0xf2bd('0x7')](),controller[_0xf2bd('0x8')]);router['get'](_0xf2bd('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xf2bd('0xa')]('/:id',auth[_0xf2bd('0x7')](),controller[_0xf2bd('0xb')]);router[_0xf2bd('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf2bd('0xd')](_0xf2bd('0xe'),auth[_0xf2bd('0x7')](),controller[_0xf2bd('0xf')]);router[_0xf2bd('0x10')](_0xf2bd('0xe'),auth['isAuthenticated'](),controller[_0xf2bd('0x11')]);module[_0xf2bd('0x12')]=router; \ No newline at end of file +var _0x44e9=['/:id','post','create','put','update','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x53b74e,_0x304e8a){var _0x1120aa=function(_0x467094){while(--_0x467094){_0x53b74e['push'](_0x53b74e['shift']());}};_0x1120aa(++_0x304e8a);}(_0x44e9,0x138));var _0x944e=function(_0x1844b1,_0x4ffd38){_0x1844b1=_0x1844b1-0x0;var _0x1cdcd5=_0x44e9[_0x1844b1];return _0x1cdcd5;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x944e('0x0'));var express=require(_0x944e('0x1'));var router=express[_0x944e('0x2')]();var auth=require(_0x944e('0x3'));var interaction=require(_0x944e('0x4'));var config=require(_0x944e('0x5'));var controller=require('./memberReport.controller');router[_0x944e('0x6')]('/',auth[_0x944e('0x7')](),controller[_0x944e('0x8')]);router[_0x944e('0x6')](_0x944e('0x9'),auth['isAuthenticated'](),controller[_0x944e('0xa')]);router[_0x944e('0x6')](_0x944e('0xb'),auth[_0x944e('0x7')](),controller['show']);router[_0x944e('0xc')]('/',auth['isAuthenticated'](),controller[_0x944e('0xd')]);router[_0x944e('0xe')](_0x944e('0xb'),auth[_0x944e('0x7')](),controller[_0x944e('0xf')]);router[_0x944e('0x10')](_0x944e('0xb'),auth[_0x944e('0x7')](),controller[_0x944e('0x11')]);module[_0x944e('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 00956f9..ac64fda 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 _0xa044=['STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','diff','seconds','exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa044,0xeb));var _0x4a04=function(_0x3569d5,_0x46185c){_0x3569d5=_0x3569d5-0x0;var _0x584ba5=_0xa044[_0x3569d5];return _0x584ba5;};'use strict';var Sequelize=require(_0x4a04('0x0'));var moment=require(_0x4a04('0x1'));module[_0x4a04('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x4a04('0x3')]},'interface':{'type':Sequelize[_0x4a04('0x3')]},'type':{'type':Sequelize[_0x4a04('0x3')],'defaultValue':_0x4a04('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x4a04('0x5')]},'enterAt':{'type':Sequelize[_0x4a04('0x6')]},'exitAt':{'type':Sequelize[_0x4a04('0x6')],'set':function(_0x1bac27){var _0x56d35f=moment(_0x1bac27);var _0x383a1a=moment(this[_0x4a04('0x7')]('enterAt'));var _0x2a3aae=_0x56d35f[_0x4a04('0x8')](_0x383a1a,_0x4a04('0x9'));this['setDataValue'](_0x4a04('0xa'),_0x1bac27);this[_0x4a04('0xb')](_0x4a04('0xc'),_0x2a3aae||null);}},'data1':{'type':Sequelize[_0x4a04('0x3')],'comment':_0x4a04('0xd')},'data2':{'type':Sequelize[_0x4a04('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x4a04('0x3')],'comment':_0x4a04('0xe')},'data4':{'type':Sequelize[_0x4a04('0x3')],'comment':_0x4a04('0xf')},'data5':{'type':Sequelize[_0x4a04('0x3')],'comment':_0x4a04('0x10')},'role':{'type':Sequelize[_0x4a04('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x4a04('0x3')]}}; \ No newline at end of file +var _0xd823=['duration','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','exitAt','setDataValue'];(function(_0x58f133,_0x3602f7){var _0xe348ad=function(_0x53f964){while(--_0x53f964){_0x58f133['push'](_0x58f133['shift']());}};_0xe348ad(++_0x3602f7);}(_0xd823,0x8c));var _0x3d82=function(_0x438578,_0xeccb24){_0x438578=_0x438578-0x0;var _0x55f90b=_0xd823[_0x438578];return _0x55f90b;};'use strict';var Sequelize=require(_0x3d82('0x0'));var moment=require(_0x3d82('0x1'));module[_0x3d82('0x2')]={'channel':{'type':Sequelize[_0x3d82('0x3')]},'membername':{'type':Sequelize[_0x3d82('0x3')]},'interface':{'type':Sequelize[_0x3d82('0x3')]},'type':{'type':Sequelize[_0x3d82('0x3')],'defaultValue':_0x3d82('0x4'),'comment':_0x3d82('0x5')},'duration':{'type':Sequelize[_0x3d82('0x6')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x3d82('0x7')],'set':function(_0x3752a9){var _0x359e00=moment(_0x3752a9);var _0x7f1dd7=moment(this[_0x3d82('0x8')](_0x3d82('0x9')));var _0x1b62d1=_0x359e00[_0x3d82('0xa')](_0x7f1dd7,'seconds');this['setDataValue'](_0x3d82('0xb'),_0x3752a9);this[_0x3d82('0xc')](_0x3d82('0xd'),_0x1b62d1||null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize['STRING'],'comment':_0x3d82('0xe')},'data4':{'type':Sequelize[_0x3d82('0x3')],'comment':_0x3d82('0xf')},'data5':{'type':Sequelize[_0x3d82('0x3')],'comment':_0x3d82('0x10')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x3d82('0x6')]},'uniqueid':{'type':Sequelize[_0x3d82('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 7c1a8f1..12e6f0c 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 _0xed9c=['type','key','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','error','send','index','map','MemberReport','rawAttributes','fieldName'];(function(_0x5bb4e8,_0x44b756){var _0x2a86f2=function(_0x279ab2){while(--_0x279ab2){_0x5bb4e8['push'](_0x5bb4e8['shift']());}};_0x2a86f2(++_0x44b756);}(_0xed9c,0x19b));var _0xced9=function(_0x388e16,_0x44bef5){_0x388e16=_0x388e16-0x0;var _0x1896aa=_0xed9c[_0x388e16];return _0x1896aa;};'use strict';var pdf=require(_0xced9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xced9('0x1'));var zipdir=require(_0xced9('0x2'));var jsonpatch=require(_0xced9('0x3'));var rp=require(_0xced9('0x4'));var moment=require('moment');var BPromise=require(_0xced9('0x5'));var Mustache=require('mustache');var util=require(_0xced9('0x6'));var path=require(_0xced9('0x7'));var sox=require('sox');var csv=require(_0xced9('0x8'));var ejs=require(_0xced9('0x9'));var fs=require('fs');var _=require(_0xced9('0xa'));var squel=require('squel');var crypto=require(_0xced9('0xb'));var jsforce=require(_0xced9('0xc'));var deskjs=require(_0xced9('0xd'));var toCsv=require(_0xced9('0x8'));var querystring=require(_0xced9('0xe'));var Papa=require(_0xced9('0xf'));var Redis=require(_0xced9('0x10'));var authService=require(_0xced9('0x11'));var qs=require(_0xced9('0x12'));var as=require(_0xced9('0x13'));var hardwareService=require(_0xced9('0x14'));var logger=require(_0xced9('0x15'))(_0xced9('0x16'));var utils=require('../../config/utils');var config=require(_0xced9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xced9('0x18'))['db'];function respondWithStatusCode(_0x206c0e,_0x782599){_0x782599=_0x782599||0xcc;return function(_0x13c016){if(_0x13c016){return _0x206c0e[_0xced9('0x19')](_0x782599);}return _0x206c0e[_0xced9('0x1a')](_0x782599)[_0xced9('0x1b')]();};}function respondWithResult(_0xf96c88,_0x3572d9){_0x3572d9=_0x3572d9||0xc8;return function(_0x4f58c3){if(_0x4f58c3){return _0xf96c88[_0xced9('0x1a')](_0x3572d9)[_0xced9('0x1c')](_0x4f58c3);}};}function respondWithFilteredResult(_0x50b4cc,_0x52ecd1){return function(_0x13bffd){if(_0x13bffd){var _0x26bfde=_0x13bffd[_0xced9('0x1d')],_0x64be=_0x52ecd1[_0xced9('0x1e')],_0x4cae19=_0x52ecd1['offset']+_0x52ecd1[_0xced9('0x1f')],_0x3ef1b1;if(_0x4cae19>=_0x26bfde){_0x4cae19=_0x26bfde;_0x3ef1b1=0xc8;}else{_0x3ef1b1=0xce;}_0x50b4cc[_0xced9('0x1a')](_0x3ef1b1);return _0x50b4cc[_0xced9('0x20')]('Content-Range',_0x64be+'-'+_0x4cae19+'/'+_0x26bfde)[_0xced9('0x1c')](_0x13bffd);}return null;};}function patchUpdates(_0x8d2735){return function(_0x5959da){try{jsonpatch[_0xced9('0x21')](_0x5959da,_0x8d2735,!![]);}catch(_0x1610c1){return BPromise[_0xced9('0x22')](_0x1610c1);}return _0x5959da[_0xced9('0x23')]();};}function saveUpdates(_0x855afb,_0x28211a){return function(_0x248b26){if(_0x248b26){return _0x248b26['update'](_0x855afb)[_0xced9('0x24')](function(_0x53d6fc){return _0x53d6fc;});}return null;};}function removeEntity(_0x4b6c24,_0x1c6663){return function(_0x4bdbc3){if(_0x4bdbc3){return _0x4bdbc3[_0xced9('0x25')]()['then'](function(){_0x4b6c24['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x11a0f0,_0x21751d){return function(_0x109094){if(!_0x109094){_0x11a0f0['sendStatus'](0x194);}return _0x109094;};}function handleError(_0x4291e6,_0x2e7779){_0x2e7779=_0x2e7779||0x1f4;return function(_0x31ac2b){logger[_0xced9('0x26')](_0x31ac2b['stack']);if(_0x31ac2b['name']){delete _0x31ac2b['name'];}_0x4291e6[_0xced9('0x1a')](_0x2e7779)[_0xced9('0x27')](_0x31ac2b);};}exports[_0xced9('0x28')]=function(_0x5a4451,_0x4e5d3c){var _0x3d58c0={},_0x1751fd={},_0x2be809={'count':0x0,'rows':[]};var _0x482b40=_[_0xced9('0x29')](db[_0xced9('0x2a')][_0xced9('0x2b')],function(_0x5d36d9){return{'name':_0x5d36d9[_0xced9('0x2c')],'type':_0x5d36d9[_0xced9('0x2d')][_0xced9('0x2e')]};});_0x1751fd['model']=_[_0xced9('0x29')](_0x482b40,_0xced9('0x2f'));_0x1751fd[_0xced9('0x30')]=_[_0xced9('0x31')](_0x5a4451[_0xced9('0x30')]);_0x1751fd[_0xced9('0x32')]=_[_0xced9('0x33')](_0x1751fd[_0xced9('0x34')],_0x1751fd[_0xced9('0x30')]);_0x3d58c0['attributes']=_['intersection'](_0x1751fd[_0xced9('0x34')],qs[_0xced9('0x35')](_0x5a4451[_0xced9('0x30')][_0xced9('0x35')]));_0x3d58c0[_0xced9('0x36')]=_0x3d58c0[_0xced9('0x36')][_0xced9('0x37')]?_0x3d58c0[_0xced9('0x36')]:_0x1751fd['model'];if(!_0x5a4451[_0xced9('0x30')][_0xced9('0x38')](_0xced9('0x39'))){_0x3d58c0[_0xced9('0x1f')]=qs['limit'](_0x5a4451[_0xced9('0x30')][_0xced9('0x1f')]);_0x3d58c0[_0xced9('0x1e')]=qs[_0xced9('0x1e')](_0x5a4451[_0xced9('0x30')][_0xced9('0x1e')]);}_0x3d58c0[_0xced9('0x3a')]=qs[_0xced9('0x3b')](_0x5a4451[_0xced9('0x30')]['sort']);_0x3d58c0[_0xced9('0x3c')]=qs['filters'](_[_0xced9('0x3d')](_0x5a4451[_0xced9('0x30')],_0x1751fd['filters']),_0x482b40);if(_0x5a4451[_0xced9('0x30')][_0xced9('0x3e')]){_0x3d58c0[_0xced9('0x3c')]=_[_0xced9('0x3f')](_0x3d58c0[_0xced9('0x3c')],{'$or':_['map'](_0x482b40,function(_0x40bcd9){if(_0x40bcd9[_0xced9('0x2d')]!==_0xced9('0x40')){var _0x703957={};_0x703957[_0x40bcd9[_0xced9('0x2f')]]={'$like':'%'+_0x5a4451[_0xced9('0x30')][_0xced9('0x3e')]+'%'};return _0x703957;}})});}_0x3d58c0=_[_0xced9('0x3f')]({},_0x3d58c0,_0x5a4451[_0xced9('0x41')]);var _0x110d83={'where':_0x3d58c0[_0xced9('0x3c')]};return db[_0xced9('0x2a')][_0xced9('0x1d')](_0x110d83)[_0xced9('0x24')](function(_0x3bc47e){_0x2be809[_0xced9('0x1d')]=_0x3bc47e;if(_0x5a4451[_0xced9('0x30')][_0xced9('0x42')]){_0x3d58c0[_0xced9('0x43')]=[{'all':!![]}];}return db[_0xced9('0x2a')]['findAll'](_0x3d58c0);})['then'](function(_0x59469f){_0x2be809[_0xced9('0x44')]=_0x59469f;return _0x2be809;})[_0xced9('0x24')](respondWithFilteredResult(_0x4e5d3c,_0x3d58c0))[_0xced9('0x45')](handleError(_0x4e5d3c,null));};exports[_0xced9('0x46')]=function(_0x3656e5,_0x3628a1){var _0x4933c7={'raw':!![],'where':{'id':_0x3656e5['params']['id']}},_0x3b15f1={};_0x3b15f1[_0xced9('0x34')]=_[_0xced9('0x31')](db[_0xced9('0x2a')][_0xced9('0x2b')]);_0x3b15f1[_0xced9('0x30')]=_[_0xced9('0x31')](_0x3656e5[_0xced9('0x30')]);_0x3b15f1[_0xced9('0x32')]=_[_0xced9('0x33')](_0x3b15f1[_0xced9('0x34')],_0x3b15f1[_0xced9('0x30')]);_0x4933c7[_0xced9('0x36')]=_[_0xced9('0x33')](_0x3b15f1['model'],qs['fields'](_0x3656e5[_0xced9('0x30')][_0xced9('0x35')]));_0x4933c7['attributes']=_0x4933c7['attributes'][_0xced9('0x37')]?_0x4933c7[_0xced9('0x36')]:_0x3b15f1[_0xced9('0x34')];if(_0x3656e5[_0xced9('0x30')][_0xced9('0x42')]){_0x4933c7[_0xced9('0x43')]=[{'all':!![]}];}_0x4933c7=_[_0xced9('0x3f')]({},_0x4933c7,_0x3656e5[_0xced9('0x41')]);return db[_0xced9('0x2a')][_0xced9('0x47')](_0x4933c7)[_0xced9('0x24')](handleEntityNotFound(_0x3628a1,null))[_0xced9('0x24')](respondWithResult(_0x3628a1,null))['catch'](handleError(_0x3628a1,null));};exports['create']=function(_0x51b5c5,_0x3f95b8){return db['MemberReport'][_0xced9('0x48')](_0x51b5c5['body'],{})[_0xced9('0x24')](respondWithResult(_0x3f95b8,0xc9))[_0xced9('0x45')](handleError(_0x3f95b8,null));};exports['update']=function(_0x2be023,_0x1593aa){if(_0x2be023[_0xced9('0x49')]['id']){delete _0x2be023[_0xced9('0x49')]['id'];}return db[_0xced9('0x2a')][_0xced9('0x47')]({'where':{'id':_0x2be023[_0xced9('0x4a')]['id']}})[_0xced9('0x24')](handleEntityNotFound(_0x1593aa,null))[_0xced9('0x24')](saveUpdates(_0x2be023[_0xced9('0x49')],null))[_0xced9('0x24')](respondWithResult(_0x1593aa,null))[_0xced9('0x45')](handleError(_0x1593aa,null));};exports[_0xced9('0x25')]=function(_0x445637,_0x227507){return db['MemberReport']['find']({'where':{'id':_0x445637[_0xced9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x227507,null))[_0xced9('0x24')](removeEntity(_0x227507,null))['catch'](handleError(_0x227507,null));};exports['describe']=function(_0x1c7ef6,_0x5d28fd){return db[_0xced9('0x2a')][_0xced9('0x4b')]()[_0xced9('0x24')](respondWithResult(_0x5d28fd,null))[_0xced9('0x45')](handleError(_0x5d28fd,null));}; \ No newline at end of file +var _0x0c62=['show','params','keys','find','create','body','update','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','count','limit','status','set','Content-Range','apply','save','then','destroy','end','stack','name','index','map','MemberReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','pick','filter','merge','where','options','includeAll','include','findAll','rows','catch'];(function(_0xe533b9,_0xd8a6de){var _0xd0c5cf=function(_0x4837bd){while(--_0x4837bd){_0xe533b9['push'](_0xe533b9['shift']());}};_0xd0c5cf(++_0xd8a6de);}(_0x0c62,0x1f2));var _0x20c6=function(_0x2b07cb,_0x8520c){_0x2b07cb=_0x2b07cb-0x0;var _0x43e050=_0x0c62[_0x2b07cb];return _0x43e050;};'use strict';var pdf=require(_0x20c6('0x0'));var emlformat=require(_0x20c6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x20c6('0x2'));var jsonpatch=require(_0x20c6('0x3'));var rp=require(_0x20c6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x20c6('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x20c6('0x6'));var ejs=require(_0x20c6('0x7'));var fs=require('fs');var _=require(_0x20c6('0x8'));var squel=require('squel');var crypto=require(_0x20c6('0x9'));var jsforce=require(_0x20c6('0xa'));var deskjs=require(_0x20c6('0xb'));var toCsv=require('to-csv');var querystring=require(_0x20c6('0xc'));var Papa=require(_0x20c6('0xd'));var Redis=require(_0x20c6('0xe'));var authService=require(_0x20c6('0xf'));var qs=require(_0x20c6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x20c6('0x11'))(_0x20c6('0x12'));var utils=require(_0x20c6('0x13'));var config=require(_0x20c6('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x20c6('0x15'))['db'];function respondWithStatusCode(_0x26a96d,_0x3d9469){_0x3d9469=_0x3d9469||0xcc;return function(_0x50f792){if(_0x50f792){return _0x26a96d[_0x20c6('0x16')](_0x3d9469);}return _0x26a96d['status'](_0x3d9469)['end']();};}function respondWithResult(_0x1abef4,_0x3ab18a){_0x3ab18a=_0x3ab18a||0xc8;return function(_0x4bf97b){if(_0x4bf97b){return _0x1abef4['status'](_0x3ab18a)[_0x20c6('0x17')](_0x4bf97b);}};}function respondWithFilteredResult(_0x2ce80f,_0x89f49e){return function(_0xe4f604){if(_0xe4f604){var _0x22b42a=_0xe4f604[_0x20c6('0x18')],_0x56e6c2=_0x89f49e['offset'],_0x3cbf7f=_0x89f49e['offset']+_0x89f49e[_0x20c6('0x19')],_0x253abe;if(_0x3cbf7f>=_0x22b42a){_0x3cbf7f=_0x22b42a;_0x253abe=0xc8;}else{_0x253abe=0xce;}_0x2ce80f[_0x20c6('0x1a')](_0x253abe);return _0x2ce80f[_0x20c6('0x1b')](_0x20c6('0x1c'),_0x56e6c2+'-'+_0x3cbf7f+'/'+_0x22b42a)['json'](_0xe4f604);}return null;};}function patchUpdates(_0x555ca6){return function(_0x77d7df){try{jsonpatch[_0x20c6('0x1d')](_0x77d7df,_0x555ca6,!![]);}catch(_0x28def6){return BPromise['reject'](_0x28def6);}return _0x77d7df[_0x20c6('0x1e')]();};}function saveUpdates(_0xc96be4,_0x65976b){return function(_0x1e31d7){if(_0x1e31d7){return _0x1e31d7['update'](_0xc96be4)[_0x20c6('0x1f')](function(_0x477830){return _0x477830;});}return null;};}function removeEntity(_0x4aef26,_0x1e3383){return function(_0xa2f705){if(_0xa2f705){return _0xa2f705[_0x20c6('0x20')]()[_0x20c6('0x1f')](function(){_0x4aef26[_0x20c6('0x1a')](0xcc)[_0x20c6('0x21')]();});}};}function handleEntityNotFound(_0xd27b37,_0x2292bd){return function(_0x37a78d){if(!_0x37a78d){_0xd27b37[_0x20c6('0x16')](0x194);}return _0x37a78d;};}function handleError(_0x44136a,_0x5956a8){_0x5956a8=_0x5956a8||0x1f4;return function(_0x116dc5){logger['error'](_0x116dc5[_0x20c6('0x22')]);if(_0x116dc5[_0x20c6('0x23')]){delete _0x116dc5['name'];}_0x44136a['status'](_0x5956a8)['send'](_0x116dc5);};}exports[_0x20c6('0x24')]=function(_0x3fcf62,_0x375765){var _0x2d09aa={},_0x40e412={},_0x591eee={'count':0x0,'rows':[]};var _0x2e39ee=_[_0x20c6('0x25')](db[_0x20c6('0x26')][_0x20c6('0x27')],function(_0x4dec70){return{'name':_0x4dec70['fieldName'],'type':_0x4dec70['type'][_0x20c6('0x28')]};});_0x40e412[_0x20c6('0x29')]=_[_0x20c6('0x25')](_0x2e39ee,_0x20c6('0x23'));_0x40e412[_0x20c6('0x2a')]=_['keys'](_0x3fcf62[_0x20c6('0x2a')]);_0x40e412[_0x20c6('0x2b')]=_[_0x20c6('0x2c')](_0x40e412[_0x20c6('0x29')],_0x40e412['query']);_0x2d09aa[_0x20c6('0x2d')]=_[_0x20c6('0x2c')](_0x40e412['model'],qs[_0x20c6('0x2e')](_0x3fcf62[_0x20c6('0x2a')][_0x20c6('0x2e')]));_0x2d09aa['attributes']=_0x2d09aa[_0x20c6('0x2d')][_0x20c6('0x2f')]?_0x2d09aa['attributes']:_0x40e412[_0x20c6('0x29')];if(!_0x3fcf62[_0x20c6('0x2a')]['hasOwnProperty'](_0x20c6('0x30'))){_0x2d09aa['limit']=qs['limit'](_0x3fcf62[_0x20c6('0x2a')][_0x20c6('0x19')]);_0x2d09aa[_0x20c6('0x31')]=qs[_0x20c6('0x31')](_0x3fcf62[_0x20c6('0x2a')][_0x20c6('0x31')]);}_0x2d09aa[_0x20c6('0x32')]=qs[_0x20c6('0x33')](_0x3fcf62[_0x20c6('0x2a')]['sort']);_0x2d09aa['where']=qs[_0x20c6('0x2b')](_[_0x20c6('0x34')](_0x3fcf62[_0x20c6('0x2a')],_0x40e412['filters']),_0x2e39ee);if(_0x3fcf62['query'][_0x20c6('0x35')]){_0x2d09aa['where']=_[_0x20c6('0x36')](_0x2d09aa[_0x20c6('0x37')],{'$or':_[_0x20c6('0x25')](_0x2e39ee,function(_0x527857){if(_0x527857['type']!=='VIRTUAL'){var _0x1f5440={};_0x1f5440[_0x527857[_0x20c6('0x23')]]={'$like':'%'+_0x3fcf62[_0x20c6('0x2a')]['filter']+'%'};return _0x1f5440;}})});}_0x2d09aa=_[_0x20c6('0x36')]({},_0x2d09aa,_0x3fcf62[_0x20c6('0x38')]);var _0x34c26f={'where':_0x2d09aa[_0x20c6('0x37')]};return db[_0x20c6('0x26')][_0x20c6('0x18')](_0x34c26f)['then'](function(_0x27270f){_0x591eee[_0x20c6('0x18')]=_0x27270f;if(_0x3fcf62[_0x20c6('0x2a')][_0x20c6('0x39')]){_0x2d09aa[_0x20c6('0x3a')]=[{'all':!![]}];}return db['MemberReport'][_0x20c6('0x3b')](_0x2d09aa);})['then'](function(_0x2d54a3){_0x591eee[_0x20c6('0x3c')]=_0x2d54a3;return _0x591eee;})[_0x20c6('0x1f')](respondWithFilteredResult(_0x375765,_0x2d09aa))[_0x20c6('0x3d')](handleError(_0x375765,null));};exports[_0x20c6('0x3e')]=function(_0x1218e2,_0x4dbd1d){var _0x5dbe4f={'raw':!![],'where':{'id':_0x1218e2[_0x20c6('0x3f')]['id']}},_0x5080aa={};_0x5080aa[_0x20c6('0x29')]=_['keys'](db[_0x20c6('0x26')][_0x20c6('0x27')]);_0x5080aa[_0x20c6('0x2a')]=_[_0x20c6('0x40')](_0x1218e2[_0x20c6('0x2a')]);_0x5080aa[_0x20c6('0x2b')]=_[_0x20c6('0x2c')](_0x5080aa[_0x20c6('0x29')],_0x5080aa[_0x20c6('0x2a')]);_0x5dbe4f[_0x20c6('0x2d')]=_[_0x20c6('0x2c')](_0x5080aa[_0x20c6('0x29')],qs[_0x20c6('0x2e')](_0x1218e2['query'][_0x20c6('0x2e')]));_0x5dbe4f['attributes']=_0x5dbe4f['attributes'][_0x20c6('0x2f')]?_0x5dbe4f[_0x20c6('0x2d')]:_0x5080aa[_0x20c6('0x29')];if(_0x1218e2[_0x20c6('0x2a')][_0x20c6('0x39')]){_0x5dbe4f[_0x20c6('0x3a')]=[{'all':!![]}];}_0x5dbe4f=_['merge']({},_0x5dbe4f,_0x1218e2[_0x20c6('0x38')]);return db[_0x20c6('0x26')][_0x20c6('0x41')](_0x5dbe4f)['then'](handleEntityNotFound(_0x4dbd1d,null))[_0x20c6('0x1f')](respondWithResult(_0x4dbd1d,null))[_0x20c6('0x3d')](handleError(_0x4dbd1d,null));};exports[_0x20c6('0x42')]=function(_0x101ae9,_0x23ebb2){return db[_0x20c6('0x26')]['create'](_0x101ae9[_0x20c6('0x43')],{})[_0x20c6('0x1f')](respondWithResult(_0x23ebb2,0xc9))[_0x20c6('0x3d')](handleError(_0x23ebb2,null));};exports[_0x20c6('0x44')]=function(_0x43b776,_0x2525f6){if(_0x43b776[_0x20c6('0x43')]['id']){delete _0x43b776['body']['id'];}return db[_0x20c6('0x26')]['find']({'where':{'id':_0x43b776['params']['id']}})[_0x20c6('0x1f')](handleEntityNotFound(_0x2525f6,null))[_0x20c6('0x1f')](saveUpdates(_0x43b776['body'],null))[_0x20c6('0x1f')](respondWithResult(_0x2525f6,null))[_0x20c6('0x3d')](handleError(_0x2525f6,null));};exports[_0x20c6('0x20')]=function(_0x3d251a,_0x214258){return db[_0x20c6('0x26')][_0x20c6('0x41')]({'where':{'id':_0x3d251a[_0x20c6('0x3f')]['id']}})[_0x20c6('0x1f')](handleEntityNotFound(_0x214258,null))[_0x20c6('0x1f')](removeEntity(_0x214258,null))['catch'](handleError(_0x214258,null));};exports['describe']=function(_0x3f9de8,_0x4e4a5f){return db[_0x20c6('0x26')][_0x20c6('0x45')]()[_0x20c6('0x1f')](respondWithResult(_0x4e4a5f,null))[_0x20c6('0x3d')](handleError(_0x4e4a5f,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 7ca194b..1e6b516 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 _0x188d=['define','membername_interface','membername','interface','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x25dff6,_0x534025){var _0x49dfd1=function(_0x452c74){while(--_0x452c74){_0x25dff6['push'](_0x25dff6['shift']());}};_0x49dfd1(++_0x534025);}(_0x188d,0x6c));var _0xd188=function(_0x305486,_0x24acd4){_0x305486=_0x305486-0x0;var _0xa04940=_0x188d[_0x305486];return _0xa04940;};'use strict';var _=require('lodash');var util=require(_0xd188('0x0'));var logger=require(_0xd188('0x1'))(_0xd188('0x2'));var moment=require(_0xd188('0x3'));var BPromise=require(_0xd188('0x4'));var rp=require(_0xd188('0x5'));var fs=require('fs');var path=require(_0xd188('0x6'));var rimraf=require(_0xd188('0x7'));var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module[_0xd188('0x8')]=function(_0x7f5ea1,_0x395a27){return _0x7f5ea1[_0xd188('0x9')]('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xd188('0xa'),'fields':[_0xd188('0xb'),_0xd188('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x226f=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','lodash'];(function(_0x17eaa2,_0x16ec32){var _0x34e4cd=function(_0xd7bfe2){while(--_0xd7bfe2){_0x17eaa2['push'](_0x17eaa2['shift']());}};_0x34e4cd(++_0x16ec32);}(_0x226f,0x167));var _0xf226=function(_0x42cef0,_0x11a7b5){_0x42cef0=_0x42cef0-0x0;var _0x59fff0=_0x226f[_0x42cef0];return _0x59fff0;};'use strict';var _=require(_0xf226('0x0'));var util=require(_0xf226('0x1'));var logger=require('../../config/logger')(_0xf226('0x2'));var moment=require('moment');var BPromise=require(_0xf226('0x3'));var rp=require(_0xf226('0x4'));var fs=require('fs');var path=require(_0xf226('0x5'));var rimraf=require(_0xf226('0x6'));var config=require(_0xf226('0x7'));var attributes=require(_0xf226('0x8'));module[_0xf226('0x9')]=function(_0x47b5b1,_0x58ea06){return _0x47b5b1[_0xf226('0xa')](_0xf226('0xb'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','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 102b98c..46d1a52 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 _0xf680=['limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','MemberReport','findAll','options','raw','attributes','include','map','model','GetMemberReport','stringify','CreateMemberReport','create','body','UpdateMemberReport','update','where'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xf680,0xa9));var _0x0f68=function(_0x5249f4,_0x4af9a0){_0x5249f4=_0x5249f4-0x0;var _0x554114=_0xf680[_0x5249f4];return _0x554114;};'use strict';var _=require(_0x0f68('0x0'));var util=require(_0x0f68('0x1'));var moment=require(_0x0f68('0x2'));var BPromise=require(_0x0f68('0x3'));var rs=require(_0x0f68('0x4'));var fs=require('fs');var Redis=require(_0x0f68('0x5'));var db=require(_0x0f68('0x6'))['db'];var utils=require(_0x0f68('0x7'));var logger=require(_0x0f68('0x8'))('rpc');var config=require(_0x0f68('0x9'));var jayson=require(_0x0f68('0xa'));var client=jayson[_0x0f68('0xb')][_0x0f68('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21510d,_0x46ac83,_0x20e465){return new BPromise(function(_0x46706f,_0x329523){return client[_0x0f68('0xd')](_0x21510d,_0x20e465)[_0x0f68('0xe')](function(_0x5f6032){logger[_0x0f68('0xf')](_0x0f68('0x10'),_0x46ac83,_0x0f68('0x11'));logger[_0x0f68('0x12')](_0x0f68('0x13'),_0x46ac83,_0x0f68('0x11'),JSON['stringify'](_0x5f6032));if(_0x5f6032[_0x0f68('0x14')]){if(_0x5f6032['error'][_0x0f68('0x15')]===0x1f4){logger[_0x0f68('0x14')]('MemberReport,\x20%s,\x20%s',_0x46ac83,_0x5f6032['error']['message']);return _0x329523(_0x5f6032[_0x0f68('0x14')][_0x0f68('0x16')]);}logger[_0x0f68('0x14')](_0x0f68('0x10'),_0x46ac83,_0x5f6032[_0x0f68('0x14')][_0x0f68('0x16')]);return _0x46706f(_0x5f6032['error'][_0x0f68('0x16')]);}else{logger[_0x0f68('0xf')](_0x0f68('0x10'),_0x46ac83,_0x0f68('0x11'));_0x46706f(_0x5f6032[_0x0f68('0x17')][_0x0f68('0x16')]);}})[_0x0f68('0x18')](function(_0x515299){logger[_0x0f68('0x14')](_0x0f68('0x10'),_0x46ac83,_0x515299);_0x329523(_0x515299);});});}exports['GetMemberReport']=function(_0x2f01a1){var _0x3e0853=this;return new Promise(function(_0x4477ca,_0x3ebb8c){return db[_0x0f68('0x19')][_0x0f68('0x1a')]({'raw':_0x2f01a1[_0x0f68('0x1b')]?_0x2f01a1['options'][_0x0f68('0x1c')]===undefined?!![]:![]:!![],'where':_0x2f01a1[_0x0f68('0x1b')]?_0x2f01a1[_0x0f68('0x1b')]['where']||null:null,'attributes':_0x2f01a1['options']?_0x2f01a1[_0x0f68('0x1b')][_0x0f68('0x1d')]||null:null,'limit':_0x2f01a1[_0x0f68('0x1b')]?_0x2f01a1[_0x0f68('0x1b')]['limit']||null:null,'include':_0x2f01a1['options']?_0x2f01a1[_0x0f68('0x1b')][_0x0f68('0x1e')]?_[_0x0f68('0x1f')](_0x2f01a1['options']['include'],function(_0x24c63d){return{'model':db[_0x24c63d[_0x0f68('0x20')]],'as':_0x24c63d['as'],'attributes':_0x24c63d[_0x0f68('0x1d')],'include':_0x24c63d['include']?_[_0x0f68('0x1f')](_0x24c63d[_0x0f68('0x1e')],function(_0x2abfbe){return{'model':db[_0x2abfbe[_0x0f68('0x20')]],'as':_0x2abfbe['as'],'attributes':_0x2abfbe[_0x0f68('0x1d')],'include':_0x2abfbe['include']?_[_0x0f68('0x1f')](_0x2abfbe[_0x0f68('0x1e')],function(_0x3bd44c){return{'model':db[_0x3bd44c[_0x0f68('0x20')]],'as':_0x3bd44c['as'],'attributes':_0x3bd44c['attributes']};}):[]};}):[]};}):[]:[]})[_0x0f68('0xe')](function(_0x93cf98){logger[_0x0f68('0xf')](_0x0f68('0x21'),_0x2f01a1);logger[_0x0f68('0x12')](_0x0f68('0x21'),_0x2f01a1,JSON[_0x0f68('0x22')](_0x93cf98));_0x4477ca(_0x93cf98);})['catch'](function(_0x4390ee){logger[_0x0f68('0x14')]('GetMemberReport',_0x4390ee['message'],_0x2f01a1);_0x3ebb8c(_0x3e0853[_0x0f68('0x14')](0x1f4,_0x4390ee[_0x0f68('0x16')]));});});};exports[_0x0f68('0x23')]=function(_0x9b3b){var _0x305e1c=this;return new Promise(function(_0x587526,_0x11e897){return db[_0x0f68('0x19')][_0x0f68('0x24')](_0x9b3b[_0x0f68('0x25')],{'raw':_0x9b3b[_0x0f68('0x1b')]?_0x9b3b[_0x0f68('0x1b')][_0x0f68('0x1c')]===undefined?!![]:![]:!![]})[_0x0f68('0xe')](function(_0x2c6549){logger[_0x0f68('0xf')](_0x0f68('0x23'),_0x9b3b);logger['debug'](_0x0f68('0x23'),_0x9b3b,JSON['stringify'](_0x2c6549));_0x587526(_0x2c6549);})[_0x0f68('0x18')](function(_0x5d7179){logger[_0x0f68('0x14')](_0x0f68('0x23'),_0x5d7179[_0x0f68('0x16')],_0x9b3b);_0x11e897(_0x305e1c[_0x0f68('0x14')](0x1f4,_0x5d7179[_0x0f68('0x16')]));});});};exports[_0x0f68('0x26')]=function(_0x966bf4){var _0xf19f27=this;return new Promise(function(_0x4b37d0,_0x5ee6bc){return db[_0x0f68('0x19')][_0x0f68('0x27')](_0x966bf4[_0x0f68('0x25')],{'raw':_0x966bf4[_0x0f68('0x1b')]?_0x966bf4[_0x0f68('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x966bf4[_0x0f68('0x1b')]?_0x966bf4['options'][_0x0f68('0x28')]||null:null,'attributes':_0x966bf4[_0x0f68('0x1b')]?_0x966bf4['options'][_0x0f68('0x1d')]||null:null,'limit':_0x966bf4[_0x0f68('0x1b')]?_0x966bf4['options'][_0x0f68('0x29')]||null:null})[_0x0f68('0xe')](function(_0x2710d8){logger[_0x0f68('0xf')](_0x0f68('0x26'),_0x966bf4);logger[_0x0f68('0x12')](_0x0f68('0x26'),_0x966bf4,JSON['stringify'](_0x2710d8));_0x4b37d0(_0x2710d8);})[_0x0f68('0x18')](function(_0x46ec4f){logger[_0x0f68('0x14')](_0x0f68('0x26'),_0x46ec4f[_0x0f68('0x16')],_0x966bf4);_0x5ee6bc(_0xf19f27['error'](0x1f4,_0x46ec4f[_0x0f68('0x16')]));});});}; \ No newline at end of file +var _0x1ba1=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','model','map','catch','body','CreateMemberReport','UpdateMemberReport','update','util','moment','bluebird','randomstring','ioredis'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x1ba1,0x1b3));var _0x11ba=function(_0x205852,_0x184d90){_0x205852=_0x205852-0x0;var _0x491d8d=_0x1ba1[_0x205852];return _0x491d8d;};'use strict';var _=require('lodash');var util=require(_0x11ba('0x0'));var moment=require(_0x11ba('0x1'));var BPromise=require(_0x11ba('0x2'));var rs=require(_0x11ba('0x3'));var fs=require('fs');var Redis=require(_0x11ba('0x4'));var db=require(_0x11ba('0x5'))['db'];var utils=require(_0x11ba('0x6'));var logger=require(_0x11ba('0x7'))(_0x11ba('0x8'));var config=require(_0x11ba('0x9'));var jayson=require(_0x11ba('0xa'));var client=jayson[_0x11ba('0xb')][_0x11ba('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x47a5f2,_0x3db11b,_0x166f32){return new BPromise(function(_0x41c7fe,_0x37ae8a){return client[_0x11ba('0xd')](_0x47a5f2,_0x166f32)[_0x11ba('0xe')](function(_0x55e70b){logger[_0x11ba('0xf')]('MemberReport,\x20%s,\x20%s',_0x3db11b,'request\x20sent');logger[_0x11ba('0x10')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x3db11b,_0x11ba('0x11'),JSON[_0x11ba('0x12')](_0x55e70b));if(_0x55e70b[_0x11ba('0x13')]){if(_0x55e70b[_0x11ba('0x13')][_0x11ba('0x14')]===0x1f4){logger['error'](_0x11ba('0x15'),_0x3db11b,_0x55e70b[_0x11ba('0x13')][_0x11ba('0x16')]);return _0x37ae8a(_0x55e70b[_0x11ba('0x13')]['message']);}logger[_0x11ba('0x13')](_0x11ba('0x15'),_0x3db11b,_0x55e70b[_0x11ba('0x13')][_0x11ba('0x16')]);return _0x41c7fe(_0x55e70b[_0x11ba('0x13')][_0x11ba('0x16')]);}else{logger[_0x11ba('0xf')](_0x11ba('0x15'),_0x3db11b,'request\x20sent');_0x41c7fe(_0x55e70b[_0x11ba('0x17')][_0x11ba('0x16')]);}})['catch'](function(_0x362182){logger[_0x11ba('0x13')](_0x11ba('0x15'),_0x3db11b,_0x362182);_0x37ae8a(_0x362182);});});}exports[_0x11ba('0x18')]=function(_0x15effe){var _0x115f30=this;return new Promise(function(_0x15ef44,_0x5b7bc0){return db[_0x11ba('0x19')][_0x11ba('0x1a')]({'raw':_0x15effe[_0x11ba('0x1b')]?_0x15effe[_0x11ba('0x1b')][_0x11ba('0x1c')]===undefined?!![]:![]:!![],'where':_0x15effe[_0x11ba('0x1b')]?_0x15effe[_0x11ba('0x1b')][_0x11ba('0x1d')]||null:null,'attributes':_0x15effe[_0x11ba('0x1b')]?_0x15effe[_0x11ba('0x1b')][_0x11ba('0x1e')]||null:null,'limit':_0x15effe[_0x11ba('0x1b')]?_0x15effe[_0x11ba('0x1b')][_0x11ba('0x1f')]||null:null,'include':_0x15effe['options']?_0x15effe[_0x11ba('0x1b')][_0x11ba('0x20')]?_['map'](_0x15effe[_0x11ba('0x1b')][_0x11ba('0x20')],function(_0xc68a94){return{'model':db[_0xc68a94[_0x11ba('0x21')]],'as':_0xc68a94['as'],'attributes':_0xc68a94[_0x11ba('0x1e')],'include':_0xc68a94[_0x11ba('0x20')]?_[_0x11ba('0x22')](_0xc68a94[_0x11ba('0x20')],function(_0x32daff){return{'model':db[_0x32daff['model']],'as':_0x32daff['as'],'attributes':_0x32daff[_0x11ba('0x1e')],'include':_0x32daff[_0x11ba('0x20')]?_['map'](_0x32daff[_0x11ba('0x20')],function(_0x359e90){return{'model':db[_0x359e90[_0x11ba('0x21')]],'as':_0x359e90['as'],'attributes':_0x359e90[_0x11ba('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x11ba('0xe')](function(_0x128290){logger[_0x11ba('0xf')]('GetMemberReport',_0x15effe);logger[_0x11ba('0x10')](_0x11ba('0x18'),_0x15effe,JSON[_0x11ba('0x12')](_0x128290));_0x15ef44(_0x128290);})[_0x11ba('0x23')](function(_0x2198b9){logger['error']('GetMemberReport',_0x2198b9[_0x11ba('0x16')],_0x15effe);_0x5b7bc0(_0x115f30['error'](0x1f4,_0x2198b9[_0x11ba('0x16')]));});});};exports['CreateMemberReport']=function(_0x7d4de2){var _0x3b8216=this;return new Promise(function(_0x34f02e,_0x58ca2c){return db[_0x11ba('0x19')]['create'](_0x7d4de2[_0x11ba('0x24')],{'raw':_0x7d4de2[_0x11ba('0x1b')]?_0x7d4de2[_0x11ba('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x11ba('0xe')](function(_0x47a178){logger[_0x11ba('0xf')](_0x11ba('0x25'),_0x7d4de2);logger[_0x11ba('0x10')]('CreateMemberReport',_0x7d4de2,JSON['stringify'](_0x47a178));_0x34f02e(_0x47a178);})[_0x11ba('0x23')](function(_0xed9645){logger[_0x11ba('0x13')]('CreateMemberReport',_0xed9645['message'],_0x7d4de2);_0x58ca2c(_0x3b8216[_0x11ba('0x13')](0x1f4,_0xed9645[_0x11ba('0x16')]));});});};exports[_0x11ba('0x26')]=function(_0x40e2db){var _0x4c2b09=this;return new Promise(function(_0x4d8776,_0x54c60b){return db[_0x11ba('0x19')][_0x11ba('0x27')](_0x40e2db[_0x11ba('0x24')],{'raw':_0x40e2db[_0x11ba('0x1b')]?_0x40e2db[_0x11ba('0x1b')][_0x11ba('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40e2db['options']?_0x40e2db[_0x11ba('0x1b')][_0x11ba('0x1d')]||null:null,'attributes':_0x40e2db[_0x11ba('0x1b')]?_0x40e2db[_0x11ba('0x1b')][_0x11ba('0x1e')]||null:null,'limit':_0x40e2db[_0x11ba('0x1b')]?_0x40e2db[_0x11ba('0x1b')][_0x11ba('0x1f')]||null:null})[_0x11ba('0xe')](function(_0x4b5fbb){logger['info'](_0x11ba('0x26'),_0x40e2db);logger[_0x11ba('0x10')](_0x11ba('0x26'),_0x40e2db,JSON[_0x11ba('0x12')](_0x4b5fbb));_0x4d8776(_0x4b5fbb);})[_0x11ba('0x23')](function(_0x42e822){logger['error'](_0x11ba('0x26'),_0x42e822[_0x11ba('0x16')],_0x40e2db);_0x54c60b(_0x4c2b09[_0x11ba('0x13')](0x1f4,_0x42e822[_0x11ba('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index b9d4bf8..fc19ca1 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 _0xe5b5=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x31b31b,_0x5f044e){_0x31b31b=_0x31b31b-0x0;var _0x2c8fc2=_0xe5b5[_0x31b31b];return _0x2c8fc2;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var auth=require(_0x5e5b('0x6'));var interaction=require(_0x5e5b('0x7'));var config=require(_0x5e5b('0x8'));var controller=require(_0x5e5b('0x9'));router[_0x5e5b('0xa')]('/',controller[_0x5e5b('0xb')]);module[_0x5e5b('0xc')]=router; \ No newline at end of file +var _0x34b7=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x4c653a,_0x16a7f0){var _0x743415=function(_0x54aaf7){while(--_0x54aaf7){_0x4c653a['push'](_0x4c653a['shift']());}};_0x743415(++_0x16a7f0);}(_0x34b7,0x196));var _0x734b=function(_0x235326,_0x251051){_0x235326=_0x235326-0x0;var _0x43a1d7=_0x34b7[_0x235326];return _0x43a1d7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x734b('0x0'));var timeout=require(_0x734b('0x1'));var express=require(_0x734b('0x2'));var router=express[_0x734b('0x3')]();var auth=require(_0x734b('0x4'));var interaction=require(_0x734b('0x5'));var config=require('../../config/environment');var controller=require('./migration.controller');router[_0x734b('0x6')]('/',controller[_0x734b('0x7')]);module[_0x734b('0x8')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 8c53cbf..1287a2e 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 _0x17e7=['sequelize','exports','STRING','version'];(function(_0x1cfe60,_0xfdc00c){var _0x3f9bf6=function(_0x276522){while(--_0x276522){_0x1cfe60['push'](_0x1cfe60['shift']());}};_0x3f9bf6(++_0xfdc00c);}(_0x17e7,0x180));var _0x717e=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0x17e7[_0x49c057];return _0xd8f0e6;};'use strict';var Sequelize=require(_0x717e('0x0'));module[_0x717e('0x1')]={'version':{'type':Sequelize[_0x717e('0x2')],'unique':_0x717e('0x3')}}; \ No newline at end of file +var _0xcf17=['STRING','sequelize'];(function(_0x2c9951,_0x45ff4d){var _0x44f7ba=function(_0x2c9adc){while(--_0x2c9adc){_0x2c9951['push'](_0x2c9951['shift']());}};_0x44f7ba(++_0x45ff4d);}(_0xcf17,0x1a3));var _0x7cf1=function(_0x1f47f8,_0x36e2b3){_0x1f47f8=_0x1f47f8-0x0;var _0x4c58ee=_0xcf17[_0x1f47f8];return _0x4c58ee;};'use strict';var Sequelize=require(_0x7cf1('0x0'));module['exports']={'version':{'type':Sequelize[_0x7cf1('0x1')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index a128469..39d7107 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 _0xc87c=['type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','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','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','json','apply','reject','then','error','stack','name','send','index','Migration','rawAttributes','fieldName'];(function(_0x3370ea,_0x4c5e63){var _0x471118=function(_0xf3290c){while(--_0xf3290c){_0x3370ea['push'](_0x3370ea['shift']());}};_0x471118(++_0x4c5e63);}(_0xc87c,0x155));var _0xcc87=function(_0x1adaa9,_0x386aa8){_0x1adaa9=_0x1adaa9-0x0;var _0x4ad6f4=_0xc87c[_0x1adaa9];return _0x4ad6f4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcc87('0x0'));var rimraf=require(_0xcc87('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcc87('0x2'));var moment=require(_0xcc87('0x3'));var BPromise=require(_0xcc87('0x4'));var Mustache=require(_0xcc87('0x5'));var util=require(_0xcc87('0x6'));var path=require(_0xcc87('0x7'));var sox=require(_0xcc87('0x8'));var csv=require(_0xcc87('0x9'));var ejs=require(_0xcc87('0xa'));var fs=require('fs');var _=require(_0xcc87('0xb'));var squel=require(_0xcc87('0xc'));var crypto=require(_0xcc87('0xd'));var jsforce=require(_0xcc87('0xe'));var deskjs=require(_0xcc87('0xf'));var toCsv=require(_0xcc87('0x9'));var querystring=require(_0xcc87('0x10'));var Papa=require(_0xcc87('0x11'));var Redis=require(_0xcc87('0x12'));var authService=require(_0xcc87('0x13'));var qs=require(_0xcc87('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc87('0x15'))('api');var utils=require(_0xcc87('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcc87('0x17'));var db=require(_0xcc87('0x18'))['db'];function respondWithStatusCode(_0xf4a0fb,_0x3bccb8){_0x3bccb8=_0x3bccb8||0xcc;return function(_0x206631){if(_0x206631){return _0xf4a0fb['sendStatus'](_0x3bccb8);}return _0xf4a0fb[_0xcc87('0x19')](_0x3bccb8)[_0xcc87('0x1a')]();};}function respondWithResult(_0x1094bf,_0x1c753c){_0x1c753c=_0x1c753c||0xc8;return function(_0x55e6b4){if(_0x55e6b4){return _0x1094bf[_0xcc87('0x19')](_0x1c753c)['json'](_0x55e6b4);}};}function respondWithFilteredResult(_0x4e224c,_0x34e4f1){return function(_0x27935b){if(_0x27935b){var _0x49fcb0=_0x27935b[_0xcc87('0x1b')],_0x274139=_0x34e4f1[_0xcc87('0x1c')],_0x288b6a=_0x34e4f1[_0xcc87('0x1c')]+_0x34e4f1[_0xcc87('0x1d')],_0x5dc6cb;if(_0x288b6a>=_0x49fcb0){_0x288b6a=_0x49fcb0;_0x5dc6cb=0xc8;}else{_0x5dc6cb=0xce;}_0x4e224c[_0xcc87('0x19')](_0x5dc6cb);return _0x4e224c[_0xcc87('0x1e')]('Content-Range',_0x274139+'-'+_0x288b6a+'/'+_0x49fcb0)[_0xcc87('0x1f')](_0x27935b);}return null;};}function patchUpdates(_0x45f705){return function(_0x1dfb5e){try{jsonpatch[_0xcc87('0x20')](_0x1dfb5e,_0x45f705,!![]);}catch(_0x25aa05){return BPromise[_0xcc87('0x21')](_0x25aa05);}return _0x1dfb5e['save']();};}function saveUpdates(_0x57b19c,_0x2722b1){return function(_0x1750a9){if(_0x1750a9){return _0x1750a9['update'](_0x57b19c)[_0xcc87('0x22')](function(_0x68babf){return _0x68babf;});}return null;};}function removeEntity(_0x200cdd,_0x4b66e1){return function(_0x23ec47){if(_0x23ec47){return _0x23ec47['destroy']()[_0xcc87('0x22')](function(){_0x200cdd['status'](0xcc)[_0xcc87('0x1a')]();});}};}function handleEntityNotFound(_0x40cc81,_0x1929c7){return function(_0xd7ebb4){if(!_0xd7ebb4){_0x40cc81['sendStatus'](0x194);}return _0xd7ebb4;};}function handleError(_0x28cc15,_0x862462){_0x862462=_0x862462||0x1f4;return function(_0x3e8e43){logger[_0xcc87('0x23')](_0x3e8e43[_0xcc87('0x24')]);if(_0x3e8e43[_0xcc87('0x25')]){delete _0x3e8e43[_0xcc87('0x25')];}_0x28cc15[_0xcc87('0x19')](_0x862462)[_0xcc87('0x26')](_0x3e8e43);};}exports[_0xcc87('0x27')]=function(_0x2a0f93,_0x1d79bb){var _0x3399df={},_0x21a991={},_0x3c76a4={'count':0x0,'rows':[]};var _0x5961f5=_['map'](db[_0xcc87('0x28')][_0xcc87('0x29')],function(_0x4d8dd6){return{'name':_0x4d8dd6[_0xcc87('0x2a')],'type':_0x4d8dd6[_0xcc87('0x2b')]['key']};});_0x21a991[_0xcc87('0x2c')]=_['map'](_0x5961f5,_0xcc87('0x25'));_0x21a991[_0xcc87('0x2d')]=_[_0xcc87('0x2e')](_0x2a0f93[_0xcc87('0x2d')]);_0x21a991[_0xcc87('0x2f')]=_[_0xcc87('0x30')](_0x21a991[_0xcc87('0x2c')],_0x21a991[_0xcc87('0x2d')]);_0x3399df[_0xcc87('0x31')]=_[_0xcc87('0x30')](_0x21a991[_0xcc87('0x2c')],qs['fields'](_0x2a0f93['query']['fields']));_0x3399df[_0xcc87('0x31')]=_0x3399df['attributes'][_0xcc87('0x32')]?_0x3399df[_0xcc87('0x31')]:_0x21a991[_0xcc87('0x2c')];if(!_0x2a0f93[_0xcc87('0x2d')][_0xcc87('0x33')](_0xcc87('0x34'))){_0x3399df['limit']=qs[_0xcc87('0x1d')](_0x2a0f93['query']['limit']);_0x3399df[_0xcc87('0x1c')]=qs[_0xcc87('0x1c')](_0x2a0f93[_0xcc87('0x2d')][_0xcc87('0x1c')]);}_0x3399df[_0xcc87('0x35')]=qs[_0xcc87('0x36')](_0x2a0f93['query']['sort']);_0x3399df[_0xcc87('0x37')]=qs[_0xcc87('0x2f')](_[_0xcc87('0x38')](_0x2a0f93[_0xcc87('0x2d')],_0x21a991['filters']),_0x5961f5);if(_0x2a0f93[_0xcc87('0x2d')][_0xcc87('0x39')]){_0x3399df['where']=_[_0xcc87('0x3a')](_0x3399df[_0xcc87('0x37')],{'$or':_['map'](_0x5961f5,function(_0x15fac9){if(_0x15fac9['type']!==_0xcc87('0x3b')){var _0x30a916={};_0x30a916[_0x15fac9['name']]={'$like':'%'+_0x2a0f93[_0xcc87('0x2d')][_0xcc87('0x39')]+'%'};return _0x30a916;}})});}_0x3399df=_[_0xcc87('0x3a')]({},_0x3399df,_0x2a0f93[_0xcc87('0x3c')]);var _0xd7bc18={'where':_0x3399df[_0xcc87('0x37')]};return db[_0xcc87('0x28')][_0xcc87('0x1b')](_0xd7bc18)[_0xcc87('0x22')](function(_0x9bd57c){_0x3c76a4[_0xcc87('0x1b')]=_0x9bd57c;if(_0x2a0f93[_0xcc87('0x2d')][_0xcc87('0x3d')]){_0x3399df[_0xcc87('0x3e')]=[{'all':!![]}];}return db[_0xcc87('0x28')][_0xcc87('0x3f')](_0x3399df);})[_0xcc87('0x22')](function(_0xe17767){_0x3c76a4['rows']=_0xe17767;return _0x3c76a4;})[_0xcc87('0x22')](respondWithFilteredResult(_0x1d79bb,_0x3399df))['catch'](handleError(_0x1d79bb,null));}; \ No newline at end of file +var _0x2402=['zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','count','offset','limit','set','Content-Range','save','then','destroy','stack','name','index','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','html-pdf','eml-format','rimraf'];(function(_0xb7dce7,_0x247483){var _0x331bc4=function(_0x4a06b2){while(--_0x4a06b2){_0xb7dce7['push'](_0xb7dce7['shift']());}};_0x331bc4(++_0x247483);}(_0x2402,0xc9));var _0x2240=function(_0x146101,_0xc522d4){_0x146101=_0x146101-0x0;var _0x4b291d=_0x2402[_0x146101];return _0x4b291d;};'use strict';var pdf=require(_0x2240('0x0'));var emlformat=require(_0x2240('0x1'));var rimraf=require(_0x2240('0x2'));var zipdir=require(_0x2240('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2240('0x4'));var moment=require(_0x2240('0x5'));var BPromise=require(_0x2240('0x6'));var Mustache=require(_0x2240('0x7'));var util=require(_0x2240('0x8'));var path=require(_0x2240('0x9'));var sox=require(_0x2240('0xa'));var csv=require(_0x2240('0xb'));var ejs=require(_0x2240('0xc'));var fs=require('fs');var _=require(_0x2240('0xd'));var squel=require(_0x2240('0xe'));var crypto=require(_0x2240('0xf'));var jsforce=require(_0x2240('0x10'));var deskjs=require(_0x2240('0x11'));var toCsv=require(_0x2240('0xb'));var querystring=require(_0x2240('0x12'));var Papa=require(_0x2240('0x13'));var Redis=require('ioredis');var authService=require(_0x2240('0x14'));var qs=require(_0x2240('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2240('0x16'));var logger=require(_0x2240('0x17'))(_0x2240('0x18'));var utils=require(_0x2240('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x2240('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2cfaae,_0x5e2499){_0x5e2499=_0x5e2499||0xcc;return function(_0x263eee){if(_0x263eee){return _0x2cfaae['sendStatus'](_0x5e2499);}return _0x2cfaae[_0x2240('0x1b')](_0x5e2499)[_0x2240('0x1c')]();};}function respondWithResult(_0x10a971,_0x2ffd61){_0x2ffd61=_0x2ffd61||0xc8;return function(_0x45716d){if(_0x45716d){return _0x10a971[_0x2240('0x1b')](_0x2ffd61)[_0x2240('0x1d')](_0x45716d);}};}function respondWithFilteredResult(_0x4ffe25,_0x34b640){return function(_0x28c1d2){if(_0x28c1d2){var _0x5b4d73=_0x28c1d2[_0x2240('0x1e')],_0x29cbaa=_0x34b640['offset'],_0x8af2e4=_0x34b640[_0x2240('0x1f')]+_0x34b640[_0x2240('0x20')],_0x50d667;if(_0x8af2e4>=_0x5b4d73){_0x8af2e4=_0x5b4d73;_0x50d667=0xc8;}else{_0x50d667=0xce;}_0x4ffe25['status'](_0x50d667);return _0x4ffe25[_0x2240('0x21')](_0x2240('0x22'),_0x29cbaa+'-'+_0x8af2e4+'/'+_0x5b4d73)[_0x2240('0x1d')](_0x28c1d2);}return null;};}function patchUpdates(_0x319983){return function(_0x78a6c1){try{jsonpatch['apply'](_0x78a6c1,_0x319983,!![]);}catch(_0x441f9f){return BPromise['reject'](_0x441f9f);}return _0x78a6c1[_0x2240('0x23')]();};}function saveUpdates(_0x147ae0,_0x522bca){return function(_0x59bb2d){if(_0x59bb2d){return _0x59bb2d['update'](_0x147ae0)[_0x2240('0x24')](function(_0x50e7ea){return _0x50e7ea;});}return null;};}function removeEntity(_0x27854d,_0x81b254){return function(_0xd47d85){if(_0xd47d85){return _0xd47d85[_0x2240('0x25')]()[_0x2240('0x24')](function(){_0x27854d[_0x2240('0x1b')](0xcc)[_0x2240('0x1c')]();});}};}function handleEntityNotFound(_0x7c3a90,_0x3bff6b){return function(_0x56da34){if(!_0x56da34){_0x7c3a90['sendStatus'](0x194);}return _0x56da34;};}function handleError(_0x4706c3,_0x125b23){_0x125b23=_0x125b23||0x1f4;return function(_0x974d2f){logger['error'](_0x974d2f[_0x2240('0x26')]);if(_0x974d2f[_0x2240('0x27')]){delete _0x974d2f[_0x2240('0x27')];}_0x4706c3[_0x2240('0x1b')](_0x125b23)['send'](_0x974d2f);};}exports[_0x2240('0x28')]=function(_0x2b64e2,_0x5f02c6){var _0x39decd={},_0x4b7ff9={},_0x32da67={'count':0x0,'rows':[]};var _0x2598c7=_[_0x2240('0x29')](db[_0x2240('0x2a')][_0x2240('0x2b')],function(_0xc61089){return{'name':_0xc61089[_0x2240('0x2c')],'type':_0xc61089[_0x2240('0x2d')][_0x2240('0x2e')]};});_0x4b7ff9[_0x2240('0x2f')]=_[_0x2240('0x29')](_0x2598c7,_0x2240('0x27'));_0x4b7ff9[_0x2240('0x30')]=_[_0x2240('0x31')](_0x2b64e2[_0x2240('0x30')]);_0x4b7ff9[_0x2240('0x32')]=_['intersection'](_0x4b7ff9[_0x2240('0x2f')],_0x4b7ff9[_0x2240('0x30')]);_0x39decd[_0x2240('0x33')]=_[_0x2240('0x34')](_0x4b7ff9[_0x2240('0x2f')],qs[_0x2240('0x35')](_0x2b64e2[_0x2240('0x30')][_0x2240('0x35')]));_0x39decd[_0x2240('0x33')]=_0x39decd[_0x2240('0x33')][_0x2240('0x36')]?_0x39decd[_0x2240('0x33')]:_0x4b7ff9['model'];if(!_0x2b64e2[_0x2240('0x30')][_0x2240('0x37')](_0x2240('0x38'))){_0x39decd[_0x2240('0x20')]=qs[_0x2240('0x20')](_0x2b64e2[_0x2240('0x30')][_0x2240('0x20')]);_0x39decd['offset']=qs[_0x2240('0x1f')](_0x2b64e2[_0x2240('0x30')][_0x2240('0x1f')]);}_0x39decd['order']=qs[_0x2240('0x39')](_0x2b64e2[_0x2240('0x30')][_0x2240('0x39')]);_0x39decd['where']=qs[_0x2240('0x32')](_[_0x2240('0x3a')](_0x2b64e2[_0x2240('0x30')],_0x4b7ff9['filters']),_0x2598c7);if(_0x2b64e2[_0x2240('0x30')][_0x2240('0x3b')]){_0x39decd[_0x2240('0x3c')]=_[_0x2240('0x3d')](_0x39decd['where'],{'$or':_[_0x2240('0x29')](_0x2598c7,function(_0x5bd2dd){if(_0x5bd2dd[_0x2240('0x2d')]!==_0x2240('0x3e')){var _0x2daa22={};_0x2daa22[_0x5bd2dd[_0x2240('0x27')]]={'$like':'%'+_0x2b64e2['query'][_0x2240('0x3b')]+'%'};return _0x2daa22;}})});}_0x39decd=_[_0x2240('0x3d')]({},_0x39decd,_0x2b64e2[_0x2240('0x3f')]);var _0x5b5b6d={'where':_0x39decd[_0x2240('0x3c')]};return db['Migration'][_0x2240('0x1e')](_0x5b5b6d)[_0x2240('0x24')](function(_0x326d81){_0x32da67['count']=_0x326d81;if(_0x2b64e2[_0x2240('0x30')][_0x2240('0x40')]){_0x39decd[_0x2240('0x41')]=[{'all':!![]}];}return db[_0x2240('0x2a')][_0x2240('0x42')](_0x39decd);})[_0x2240('0x24')](function(_0x14d819){_0x32da67['rows']=_0x14d819;return _0x32da67;})['then'](respondWithFilteredResult(_0x5f02c6,_0x39decd))[_0x2240('0x43')](handleError(_0x5f02c6,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 550656c..69427a6 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 _0xfe91=['Migration','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./migration.attributes','exports','define'];(function(_0x54a6ca,_0x12bef6){var _0x1e7a1b=function(_0x21967c){while(--_0x21967c){_0x54a6ca['push'](_0x54a6ca['shift']());}};_0x1e7a1b(++_0x12bef6);}(_0xfe91,0x175));var _0x1fe9=function(_0x25662e,_0x4cec68){_0x25662e=_0x25662e-0x0;var _0x59b7bc=_0xfe91[_0x25662e];return _0x59b7bc;};'use strict';var _=require(_0x1fe9('0x0'));var util=require(_0x1fe9('0x1'));var logger=require(_0x1fe9('0x2'))(_0x1fe9('0x3'));var moment=require(_0x1fe9('0x4'));var BPromise=require('bluebird');var rp=require(_0x1fe9('0x5'));var fs=require('fs');var path=require(_0x1fe9('0x6'));var rimraf=require(_0x1fe9('0x7'));var config=require('../../config/environment');var attributes=require(_0x1fe9('0x8'));module[_0x1fe9('0x9')]=function(_0x1c3c1d,_0x4bbcd1){return _0x1c3c1d[_0x1fe9('0xa')](_0x1fe9('0xb'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x893e=['define','Migration','migrations','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports'];(function(_0x5e79f1,_0xcb3d2d){var _0x14bae1=function(_0x237141){while(--_0x237141){_0x5e79f1['push'](_0x5e79f1['shift']());}};_0x14bae1(++_0xcb3d2d);}(_0x893e,0x1b0));var _0xe893=function(_0x384fc4,_0x1740d6){_0x384fc4=_0x384fc4-0x0;var _0x292817=_0x893e[_0x384fc4];return _0x292817;};'use strict';var _=require('lodash');var util=require(_0xe893('0x0'));var logger=require(_0xe893('0x1'))(_0xe893('0x2'));var moment=require(_0xe893('0x3'));var BPromise=require('bluebird');var rp=require(_0xe893('0x4'));var fs=require('fs');var path=require(_0xe893('0x5'));var rimraf=require(_0xe893('0x6'));var config=require(_0xe893('0x7'));var attributes=require(_0xe893('0x8'));module[_0xe893('0x9')]=function(_0x2e0636,_0x4f1d4a){return _0x2e0636[_0xe893('0xa')](_0xe893('0xb'),attributes,{'tableName':_0xe893('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index b3c14d3..005231a 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 _0xfdf1=['stringify','error','code','message','request\x20sent','result','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s'];(function(_0x518642,_0x1092c8){var _0x5c3c46=function(_0x3f5864){while(--_0x3f5864){_0x518642['push'](_0x518642['shift']());}};_0x5c3c46(++_0x1092c8);}(_0xfdf1,0xba));var _0x1fdf=function(_0x328a21,_0x4d5d05){_0x328a21=_0x328a21-0x0;var _0x5ec30f=_0xfdf1[_0x328a21];return _0x5ec30f;};'use strict';var _=require('lodash');var util=require(_0x1fdf('0x0'));var moment=require('moment');var BPromise=require(_0x1fdf('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fdf('0x2'));var db=require(_0x1fdf('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1fdf('0x4'))(_0x1fdf('0x5'));var config=require(_0x1fdf('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1fdf('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13e6ac,_0x1aaeb0,_0x14864b){return new BPromise(function(_0x2c919e,_0x36f60a){return client['request'](_0x13e6ac,_0x14864b)['then'](function(_0x1367fc){logger[_0x1fdf('0x8')](_0x1fdf('0x9'),_0x1aaeb0,'request\x20sent');logger[_0x1fdf('0xa')](_0x1fdf('0xb'),_0x1aaeb0,'request\x20sent',JSON[_0x1fdf('0xc')](_0x1367fc));if(_0x1367fc[_0x1fdf('0xd')]){if(_0x1367fc[_0x1fdf('0xd')][_0x1fdf('0xe')]===0x1f4){logger[_0x1fdf('0xd')](_0x1fdf('0x9'),_0x1aaeb0,_0x1367fc[_0x1fdf('0xd')][_0x1fdf('0xf')]);return _0x36f60a(_0x1367fc[_0x1fdf('0xd')][_0x1fdf('0xf')]);}logger['error'](_0x1fdf('0x9'),_0x1aaeb0,_0x1367fc[_0x1fdf('0xd')][_0x1fdf('0xf')]);return _0x2c919e(_0x1367fc[_0x1fdf('0xd')][_0x1fdf('0xf')]);}else{logger[_0x1fdf('0x8')](_0x1fdf('0x9'),_0x1aaeb0,_0x1fdf('0x10'));_0x2c919e(_0x1367fc[_0x1fdf('0x11')][_0x1fdf('0xf')]);}})['catch'](function(_0xc4673){logger['error'](_0x1fdf('0x9'),_0x1aaeb0,_0xc4673);_0x36f60a(_0xc4673);});});} \ No newline at end of file +var _0x1611=['then','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','Migration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request'];(function(_0xec034,_0x16c358){var _0x2c5a19=function(_0xec401c){while(--_0xec401c){_0xec034['push'](_0xec034['shift']());}};_0x2c5a19(++_0x16c358);}(_0x1611,0xb9));var _0x1161=function(_0x22ab54,_0xd94598){_0x22ab54=_0x22ab54-0x0;var _0x578915=_0x1611[_0x22ab54];return _0x578915;};'use strict';var _=require(_0x1161('0x0'));var util=require(_0x1161('0x1'));var moment=require(_0x1161('0x2'));var BPromise=require(_0x1161('0x3'));var rs=require(_0x1161('0x4'));var fs=require('fs');var Redis=require(_0x1161('0x5'));var db=require(_0x1161('0x6'))['db'];var utils=require(_0x1161('0x7'));var logger=require(_0x1161('0x8'))(_0x1161('0x9'));var config=require('../../config/environment');var jayson=require(_0x1161('0xa'));var client=jayson['client'][_0x1161('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf5f3ee,_0x12fb93,_0x532ca2){return new BPromise(function(_0x45c385,_0xd8b329){return client[_0x1161('0xc')](_0xf5f3ee,_0x532ca2)[_0x1161('0xd')](function(_0x5a9fb9){logger['info']('Migration,\x20%s,\x20%s',_0x12fb93,_0x1161('0xe'));logger[_0x1161('0xf')](_0x1161('0x10'),_0x12fb93,_0x1161('0xe'),JSON['stringify'](_0x5a9fb9));if(_0x5a9fb9[_0x1161('0x11')]){if(_0x5a9fb9['error'][_0x1161('0x12')]===0x1f4){logger['error'](_0x1161('0x13'),_0x12fb93,_0x5a9fb9[_0x1161('0x11')]['message']);return _0xd8b329(_0x5a9fb9[_0x1161('0x11')][_0x1161('0x14')]);}logger[_0x1161('0x11')]('Migration,\x20%s,\x20%s',_0x12fb93,_0x5a9fb9[_0x1161('0x11')][_0x1161('0x14')]);return _0x45c385(_0x5a9fb9[_0x1161('0x11')]['message']);}else{logger['info']('Migration,\x20%s,\x20%s',_0x12fb93,'request\x20sent');_0x45c385(_0x5a9fb9['result'][_0x1161('0x14')]);}})[_0x1161('0x15')](function(_0x3c9cff){logger[_0x1161('0x11')](_0x1161('0x13'),_0x12fb93,_0x3c9cff);_0xd8b329(_0x3c9cff);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index a8fc4b9..2e37a17 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 _0x8e9b=['show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x35adc2,_0x1b6d71){var _0x4606fd=function(_0x5a7a72){while(--_0x5a7a72){_0x35adc2['push'](_0x35adc2['shift']());}};_0x4606fd(++_0x1b6d71);}(_0x8e9b,0x138));var _0xb8e9=function(_0x5c98cc,_0x58190a){_0x5c98cc=_0x5c98cc-0x0;var _0x164644=_0x8e9b[_0x5c98cc];return _0x164644;};'use strict';var multer=require(_0xb8e9('0x0'));var util=require(_0xb8e9('0x1'));var path=require(_0xb8e9('0x2'));var timeout=require(_0xb8e9('0x3'));var express=require(_0xb8e9('0x4'));var router=express[_0xb8e9('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb8e9('0x6'));var controller=require('./network.controller');router[_0xb8e9('0x7')]('/',auth[_0xb8e9('0x8')](),controller[_0xb8e9('0x9')]);router[_0xb8e9('0x7')](_0xb8e9('0xa'),auth['isAuthenticated'](),controller[_0xb8e9('0xb')]);router[_0xb8e9('0xc')]('/',auth[_0xb8e9('0x8')](),controller[_0xb8e9('0xd')]);router['put'](_0xb8e9('0xa'),auth['isAuthenticated'](),controller[_0xb8e9('0xe')]);router[_0xb8e9('0xf')](_0xb8e9('0xa'),auth[_0xb8e9('0x8')](),controller['destroy']);module[_0xb8e9('0x10')]=router; \ No newline at end of file +var _0xfb72=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','update','destroy','util','path','connect-timeout','express'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xfb72,0x12c));var _0x2fb7=function(_0x9307ea,_0x38968a){_0x9307ea=_0x9307ea-0x0;var _0x295554=_0xfb72[_0x9307ea];return _0x295554;};'use strict';var multer=require('multer');var util=require(_0x2fb7('0x0'));var path=require(_0x2fb7('0x1'));var timeout=require(_0x2fb7('0x2'));var express=require(_0x2fb7('0x3'));var router=express[_0x2fb7('0x4')]();var auth=require(_0x2fb7('0x5'));var interaction=require(_0x2fb7('0x6'));var config=require(_0x2fb7('0x7'));var controller=require(_0x2fb7('0x8'));router[_0x2fb7('0x9')]('/',auth[_0x2fb7('0xa')](),controller[_0x2fb7('0xb')]);router[_0x2fb7('0x9')](_0x2fb7('0xc'),auth[_0x2fb7('0xa')](),controller[_0x2fb7('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x2fb7('0xc'),auth[_0x2fb7('0xa')](),controller[_0x2fb7('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2fb7('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 47293d1..b103539 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(_0xce0f13,_0x2d200c){var _0x1c80f1=function(_0x2ec598){while(--_0x2ec598){_0xce0f13['push'](_0xce0f13['shift']());}};_0x1c80f1(++_0x2d200c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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(_0x1f868e,_0x47326e){var _0x599db8=function(_0x292cbe){while(--_0x292cbe){_0x1f868e['push'](_0x1f868e['shift']());}};_0x599db8(++_0x47326e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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 1128409..2026710 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 _0xe791=['jayson/promise','client','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','json','count','offset','limit','Content-Range','apply','save','destroy','then','end','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','Network','includeAll','include','findAll','rows','show','params','catch','create','sequelize','transaction','body','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','find','STUN','/etc/asterisk/stun_xcally.conf','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x2bb0c1,_0x1d5686){var _0x11f95e=function(_0x18efe7){while(--_0x18efe7){_0x2bb0c1['push'](_0x2bb0c1['shift']());}};_0x11f95e(++_0x1d5686);}(_0xe791,0x126));var _0x1e79=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xe791[_0x18ab2a];return _0x16dcee;};'use strict';var pdf=require(_0x1e79('0x0'));var emlformat=require(_0x1e79('0x1'));var rimraf=require(_0x1e79('0x2'));var zipdir=require(_0x1e79('0x3'));var jsonpatch=require(_0x1e79('0x4'));var rp=require('request-promise');var moment=require(_0x1e79('0x5'));var BPromise=require(_0x1e79('0x6'));var Mustache=require(_0x1e79('0x7'));var util=require(_0x1e79('0x8'));var path=require(_0x1e79('0x9'));var sox=require('sox');var csv=require(_0x1e79('0xa'));var ejs=require(_0x1e79('0xb'));var fs=require('fs');var _=require(_0x1e79('0xc'));var squel=require(_0x1e79('0xd'));var crypto=require(_0x1e79('0xe'));var jsforce=require(_0x1e79('0xf'));var deskjs=require(_0x1e79('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1e79('0x11'));var Papa=require(_0x1e79('0x12'));var Redis=require(_0x1e79('0x13'));var authService=require(_0x1e79('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1e79('0x15'));var logger=require(_0x1e79('0x16'))(_0x1e79('0x17'));var utils=require(_0x1e79('0x18'));var config=require(_0x1e79('0x19'));var licenseUtil=require(_0x1e79('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0x1e79('0x1b'));var client=jayson[_0x1e79('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33009,_0x2c02ff,_0x5c85e0,_0x125dbc){return new BPromise(function(_0x599ea9,_0x2dbc31){var _0x4cc90f=_0x125dbc||client;return _0x4cc90f['request'](_0x33009,_0x5c85e0)['then'](function(_0x31c28a){logger[_0x1e79('0x1d')](_0x1e79('0x1e'),_0x2c02ff,_0x1e79('0x1f'));logger['debug'](_0x1e79('0x20'),_0x2c02ff,_0x1e79('0x1f'),JSON['stringify'](_0x31c28a));if(_0x31c28a[_0x1e79('0x21')]){if(_0x31c28a[_0x1e79('0x21')][_0x1e79('0x22')]===0x1f4){logger[_0x1e79('0x21')]('Network,\x20%s,\x20%s',_0x2c02ff,_0x31c28a[_0x1e79('0x21')][_0x1e79('0x23')]);return _0x2dbc31(_0x31c28a[_0x1e79('0x21')][_0x1e79('0x23')]);}logger[_0x1e79('0x21')](_0x1e79('0x1e'),_0x2c02ff,_0x31c28a['error'][_0x1e79('0x23')]);return _0x599ea9(_0x31c28a['error']['message']);}else{logger['info'](_0x1e79('0x1e'),_0x2c02ff,_0x1e79('0x1f'));_0x599ea9(_0x31c28a[_0x1e79('0x24')]['message']);}})['catch'](function(_0x58e1e7){logger['error'](_0x1e79('0x1e'),_0x2c02ff,_0x58e1e7);_0x2dbc31(_0x58e1e7);});});}function respondWithStatusCode(_0x1a2590,_0x3d95a9){_0x3d95a9=_0x3d95a9||0xcc;return function(_0x1030fe){if(_0x1030fe){return _0x1a2590[_0x1e79('0x25')](_0x3d95a9);}return _0x1a2590[_0x1e79('0x26')](_0x3d95a9)['end']();};}function respondWithResult(_0x1ec2cd,_0x3930f0){_0x3930f0=_0x3930f0||0xc8;return function(_0x22e1db){if(_0x22e1db){return _0x1ec2cd[_0x1e79('0x26')](_0x3930f0)[_0x1e79('0x27')](_0x22e1db);}};}function respondWithFilteredResult(_0x45f2df,_0x57875e){return function(_0x576474){if(_0x576474){var _0x43c274=_0x576474[_0x1e79('0x28')],_0x3bdaa3=_0x57875e[_0x1e79('0x29')],_0x5e01fb=_0x57875e[_0x1e79('0x29')]+_0x57875e[_0x1e79('0x2a')],_0x2d833f;if(_0x5e01fb>=_0x43c274){_0x5e01fb=_0x43c274;_0x2d833f=0xc8;}else{_0x2d833f=0xce;}_0x45f2df[_0x1e79('0x26')](_0x2d833f);return _0x45f2df['set'](_0x1e79('0x2b'),_0x3bdaa3+'-'+_0x5e01fb+'/'+_0x43c274)[_0x1e79('0x27')](_0x576474);}return null;};}function patchUpdates(_0x565dd1){return function(_0x4db088){try{jsonpatch[_0x1e79('0x2c')](_0x4db088,_0x565dd1,!![]);}catch(_0x8ce8c9){return BPromise['reject'](_0x8ce8c9);}return _0x4db088[_0x1e79('0x2d')]();};}function saveUpdates(_0x1f0c3f,_0x434e7d){return function(_0x546b4e){if(_0x546b4e){return _0x546b4e['update'](_0x1f0c3f)['then'](function(_0x42cb57){return _0x42cb57;});}return null;};}function removeEntity(_0x474058,_0x43eeff){return function(_0x562237){if(_0x562237){return _0x562237[_0x1e79('0x2e')]()[_0x1e79('0x2f')](function(){_0x474058[_0x1e79('0x26')](0xcc)[_0x1e79('0x30')]();});}};}function handleEntityNotFound(_0x57702f,_0xf4fd26){return function(_0x4accc4){if(!_0x4accc4){_0x57702f[_0x1e79('0x25')](0x194);}return _0x4accc4;};}function handleError(_0x888d84,_0x4eb59e){_0x4eb59e=_0x4eb59e||0x1f4;return function(_0xf16c9b){logger[_0x1e79('0x21')](_0xf16c9b[_0x1e79('0x31')]);if(_0xf16c9b[_0x1e79('0x32')]){delete _0xf16c9b[_0x1e79('0x32')];}_0x888d84[_0x1e79('0x26')](_0x4eb59e)[_0x1e79('0x33')](_0xf16c9b);};}exports[_0x1e79('0x34')]=function(_0x55296,_0x302c33){var _0x452918={},_0xca3806={},_0x5c0871={'count':0x0,'rows':[]};var _0x8853ad=_[_0x1e79('0x35')](db['Network'][_0x1e79('0x36')],function(_0xe370ad){return{'name':_0xe370ad[_0x1e79('0x37')],'type':_0xe370ad[_0x1e79('0x38')]['key']};});_0xca3806[_0x1e79('0x39')]=_[_0x1e79('0x35')](_0x8853ad,'name');_0xca3806[_0x1e79('0x3a')]=_[_0x1e79('0x3b')](_0x55296[_0x1e79('0x3a')]);_0xca3806['filters']=_[_0x1e79('0x3c')](_0xca3806[_0x1e79('0x39')],_0xca3806[_0x1e79('0x3a')]);_0x452918['attributes']=_['intersection'](_0xca3806[_0x1e79('0x39')],qs[_0x1e79('0x3d')](_0x55296[_0x1e79('0x3a')][_0x1e79('0x3d')]));_0x452918[_0x1e79('0x3e')]=_0x452918[_0x1e79('0x3e')][_0x1e79('0x3f')]?_0x452918[_0x1e79('0x3e')]:_0xca3806[_0x1e79('0x39')];if(!_0x55296['query']['hasOwnProperty']('nolimit')){_0x452918['limit']=qs[_0x1e79('0x2a')](_0x55296[_0x1e79('0x3a')][_0x1e79('0x2a')]);_0x452918[_0x1e79('0x29')]=qs['offset'](_0x55296[_0x1e79('0x3a')][_0x1e79('0x29')]);}_0x452918[_0x1e79('0x40')]=qs[_0x1e79('0x41')](_0x55296[_0x1e79('0x3a')][_0x1e79('0x41')]);_0x452918[_0x1e79('0x42')]=qs[_0x1e79('0x43')](_[_0x1e79('0x44')](_0x55296[_0x1e79('0x3a')],_0xca3806[_0x1e79('0x43')]),_0x8853ad);if(_0x55296[_0x1e79('0x3a')]['filter']){_0x452918[_0x1e79('0x42')]=_[_0x1e79('0x45')](_0x452918[_0x1e79('0x42')],{'$or':_[_0x1e79('0x35')](_0x8853ad,function(_0x1e4a01){if(_0x1e4a01[_0x1e79('0x38')]!==_0x1e79('0x46')){var _0x2fc165={};_0x2fc165[_0x1e4a01[_0x1e79('0x32')]]={'$like':'%'+_0x55296[_0x1e79('0x3a')][_0x1e79('0x47')]+'%'};return _0x2fc165;}})});}_0x452918=_[_0x1e79('0x45')]({},_0x452918,_0x55296[_0x1e79('0x48')]);var _0x519902={'where':_0x452918[_0x1e79('0x42')]};return db[_0x1e79('0x49')]['count'](_0x519902)[_0x1e79('0x2f')](function(_0x118c03){_0x5c0871[_0x1e79('0x28')]=_0x118c03;if(_0x55296[_0x1e79('0x3a')][_0x1e79('0x4a')]){_0x452918[_0x1e79('0x4b')]=[{'all':!![]}];}return db[_0x1e79('0x49')][_0x1e79('0x4c')](_0x452918);})['then'](function(_0x336ce2){_0x5c0871[_0x1e79('0x4d')]=_0x336ce2;return _0x5c0871;})[_0x1e79('0x2f')](respondWithFilteredResult(_0x302c33,_0x452918))['catch'](handleError(_0x302c33,null));};exports[_0x1e79('0x4e')]=function(_0x1315bc,_0x4e3d52){var _0x22369b={'raw':!![],'where':{'id':_0x1315bc[_0x1e79('0x4f')]['id']}},_0x44478a={};_0x44478a[_0x1e79('0x39')]=_[_0x1e79('0x3b')](db[_0x1e79('0x49')][_0x1e79('0x36')]);_0x44478a[_0x1e79('0x3a')]=_[_0x1e79('0x3b')](_0x1315bc['query']);_0x44478a['filters']=_[_0x1e79('0x3c')](_0x44478a[_0x1e79('0x39')],_0x44478a['query']);_0x22369b[_0x1e79('0x3e')]=_[_0x1e79('0x3c')](_0x44478a[_0x1e79('0x39')],qs[_0x1e79('0x3d')](_0x1315bc['query'][_0x1e79('0x3d')]));_0x22369b['attributes']=_0x22369b['attributes']['length']?_0x22369b['attributes']:_0x44478a[_0x1e79('0x39')];if(_0x1315bc[_0x1e79('0x3a')][_0x1e79('0x4a')]){_0x22369b[_0x1e79('0x4b')]=[{'all':!![]}];}_0x22369b=_['merge']({},_0x22369b,_0x1315bc[_0x1e79('0x48')]);return db['Network']['find'](_0x22369b)[_0x1e79('0x2f')](handleEntityNotFound(_0x4e3d52,null))[_0x1e79('0x2f')](respondWithResult(_0x4e3d52,null))[_0x1e79('0x50')](handleError(_0x4e3d52,null));};exports[_0x1e79('0x51')]=function(_0x4fd59c,_0x58debf,_0x4abf25){var _0x225c20;return db[_0x1e79('0x52')][_0x1e79('0x53')](function(_0x2c3b97){return db['Network'][_0x1e79('0x51')](_0x4fd59c[_0x1e79('0x54')],{'raw':!![]})['then'](function(_0x11e37d){_0x225c20=_0x11e37d;return db[_0x1e79('0x49')][_0x1e79('0x4c')]({'where':{'type':_0x4fd59c[_0x1e79('0x54')][_0x1e79('0x38')]},'raw':!![]});})[_0x1e79('0x2f')](function(_0x5ab988){if(_0x225c20[_0x1e79('0x38')][_0x1e79('0x55')]()=='STUN'){var _0x197947=fs[_0x1e79('0x56')](path[_0x1e79('0x57')](config[_0x1e79('0x58')],_0x1e79('0x59')),_0x1e79('0x5a'));var _0xd55bdc=ejs[_0x1e79('0x5b')](_0x197947,{'networks':_0x5ab988||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0xd55bdc);return respondWithRpcPromise(_0x1e79('0x5c'),_0x1e79('0x51'),{'module':_0x1e79('0x5d')});}else if(_0x225c20['type']['toUpperCase']()==_0x1e79('0x5e')){var _0x2a7c4a=fs['readFileSync'](path['join'](config[_0x1e79('0x58')],_0x1e79('0x5f')),_0x1e79('0x5a'));var _0x17be53=ejs[_0x1e79('0x5b')](_0x2a7c4a,{'networks':_0x5ab988||[]});fs[_0x1e79('0x60')](_0x1e79('0x61'),_0x17be53);return respondWithRpcPromise(_0x1e79('0x5c'),_0x1e79('0x51'),{'module':_0x1e79('0x5d')});}else{var _0x19b8fc=fs[_0x1e79('0x56')](path[_0x1e79('0x57')](config[_0x1e79('0x58')],_0x1e79('0x62')),_0x1e79('0x5a'));var _0x4ea524=ejs[_0x1e79('0x5b')](_0x19b8fc,{'networks':_0x5ab988||[]});fs[_0x1e79('0x60')](util[_0x1e79('0x63')](_0x1e79('0x64'),_0x4fd59c[_0x1e79('0x54')][_0x1e79('0x38')][_0x1e79('0x65')]()),_0x4ea524);return respondWithRpcPromise(_0x1e79('0x5c'),'create',{'module':_0x1e79('0x66')});}return null;})[_0x1e79('0x2f')](function(){return _0x225c20;});})[_0x1e79('0x2f')](respondWithResult(_0x58debf,0xc9))[_0x1e79('0x50')](handleError(_0x58debf,null));};exports[_0x1e79('0x67')]=function(_0x1673ac,_0x402da0,_0x5b5004){var _0x2d11d0;return db[_0x1e79('0x52')][_0x1e79('0x53')](function(_0x34c757){return db[_0x1e79('0x49')][_0x1e79('0x68')]({'where':{'id':_0x1673ac['params']['id']}})[_0x1e79('0x2f')](handleEntityNotFound(_0x402da0,null))['then'](saveUpdates(_0x1673ac[_0x1e79('0x54')],null))[_0x1e79('0x2f')](function(_0xf71b27){if(_0xf71b27){_0x2d11d0=_0xf71b27;return db['Network'][_0x1e79('0x4c')]({'where':{'type':_0x2d11d0[_0x1e79('0x38')]},'raw':!![]});}return null;})[_0x1e79('0x2f')](function(_0x46af80){if(_0x2d11d0[_0x1e79('0x38')][_0x1e79('0x55')]()==_0x1e79('0x69')){var _0x1ce35c=fs[_0x1e79('0x56')](path[_0x1e79('0x57')](config[_0x1e79('0x58')],_0x1e79('0x59')),_0x1e79('0x5a'));var _0x109728=ejs[_0x1e79('0x5b')](_0x1ce35c,{'networks':_0x46af80||[]});fs[_0x1e79('0x60')]('/etc/asterisk/stun_xcally.conf',_0x109728);return respondWithRpcPromise(_0x1e79('0x5c'),'update',{'module':_0x1e79('0x5d')});}else if(_0x2d11d0[_0x1e79('0x38')][_0x1e79('0x55')]()==_0x1e79('0x5e')){var _0x107be9=fs['readFileSync'](path[_0x1e79('0x57')](config[_0x1e79('0x58')],'server/files/templates/turn_multiple.ejs'),_0x1e79('0x5a'));var _0x3635f2=ejs[_0x1e79('0x5b')](_0x107be9,{'networks':_0x46af80||[]});fs[_0x1e79('0x60')](_0x1e79('0x61'),_0x3635f2);return respondWithRpcPromise(_0x1e79('0x5c'),_0x1e79('0x67'),{'module':_0x1e79('0x5d')});}else{var _0x1443e2=fs[_0x1e79('0x56')](path[_0x1e79('0x57')](config[_0x1e79('0x58')],'server/files/templates/network.ejs'),_0x1e79('0x5a'));var _0x4d2a68=ejs[_0x1e79('0x5b')](_0x1443e2,{'networks':_0x46af80||[]});fs['writeFileSync'](util[_0x1e79('0x63')]('/etc/asterisk/sip_xcally_%s.conf',_0x1673ac[_0x1e79('0x54')]['type']['toLowerCase']()),_0x4d2a68);return respondWithRpcPromise(_0x1e79('0x5c'),_0x1e79('0x67'),{'module':_0x1e79('0x66')});}return null;})['then'](function(_0x15f804){if(_0x15f804){return _0x2d11d0;}return null;});})['then'](respondWithResult(_0x402da0,null))[_0x1e79('0x50')](handleError(_0x402da0,null));};exports[_0x1e79('0x2e')]=function(_0xc5de57,_0xa5ce89,_0x28ceb4){var _0x322f99;return db[_0x1e79('0x49')]['find']({'where':{'id':_0xc5de57[_0x1e79('0x4f')]['id']}})[_0x1e79('0x2f')](function(_0x57824d){_0x322f99=_0x57824d;return _0x57824d;})[_0x1e79('0x2f')](handleEntityNotFound(_0xa5ce89,null))[_0x1e79('0x2f')](removeEntity(_0xa5ce89,null))[_0x1e79('0x2f')](function(){if(_0x322f99){return db[_0x1e79('0x49')][_0x1e79('0x4c')]({'where':{'type':_0x322f99[_0x1e79('0x38')]},'raw':!![]});}})['then'](function(_0x25a982){if(_0x322f99[_0x1e79('0x38')][_0x1e79('0x55')]()==_0x1e79('0x69')){var _0xa3efb1=fs[_0x1e79('0x56')](path[_0x1e79('0x57')](config['root'],_0x1e79('0x59')),_0x1e79('0x5a'));var _0x543a0a=ejs[_0x1e79('0x5b')](_0xa3efb1,{'networks':_0x25a982||[]});fs[_0x1e79('0x60')](_0x1e79('0x6a'),_0x543a0a);return respondWithRpcPromise(_0x1e79('0x5c'),_0x1e79('0x2e'),{'module':_0x1e79('0x5d')});}else if(_0x322f99[_0x1e79('0x38')][_0x1e79('0x55')]()==_0x1e79('0x5e')){var _0x4e4b1c=fs['readFileSync'](path['join'](config[_0x1e79('0x58')],_0x1e79('0x5f')),_0x1e79('0x5a'));var _0x295c71=ejs[_0x1e79('0x5b')](_0x4e4b1c,{'networks':_0x25a982||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x295c71);return respondWithRpcPromise(_0x1e79('0x5c'),_0x1e79('0x2e'),{'module':_0x1e79('0x5d')});}else{var _0x1cf337=fs[_0x1e79('0x56')](path[_0x1e79('0x57')](config['root'],'server/files/templates/network.ejs'),_0x1e79('0x5a'));var _0x37fbd9=ejs[_0x1e79('0x5b')](_0x1cf337,{'networks':_0x25a982||[]});fs[_0x1e79('0x60')](util[_0x1e79('0x63')]('/etc/asterisk/sip_xcally_%s.conf',_0xc5de57[_0x1e79('0x54')]['type'][_0x1e79('0x65')]()),_0x37fbd9);return respondWithRpcPromise(_0x1e79('0x5c'),_0x1e79('0x2e'),{'module':_0x1e79('0x66')});}return null;})[_0x1e79('0x50')](handleError(_0xa5ce89,null));}; \ No newline at end of file +var _0x8add=['../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','request','then','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','set','json','reject','save','update','destroy','end','stack','name','send','map','Network','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','filter','merge','where','options','include','findAll','show','keys','length','find','sequelize','create','body','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','toUpperCase','server/files/templates/turn_multiple.ejs','writeFileSync','res_stun_monitor.so','server/files/templates/network.ejs','chan_sip.so','transaction','STUN','TURN','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','params','/etc/asterisk/turn_xcally.conf','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x5f1cf8,_0x5e0923){var _0x27d0fa=function(_0x3f1171){while(--_0x3f1171){_0x5f1cf8['push'](_0x5f1cf8['shift']());}};_0x27d0fa(++_0x5e0923);}(_0x8add,0x188));var _0xd8ad=function(_0x1dde39,_0x5ee2b4){_0x1dde39=_0x1dde39-0x0;var _0xe110d5=_0x8add[_0x1dde39];return _0xe110d5;};'use strict';var pdf=require(_0xd8ad('0x0'));var emlformat=require(_0xd8ad('0x1'));var rimraf=require(_0xd8ad('0x2'));var zipdir=require(_0xd8ad('0x3'));var jsonpatch=require(_0xd8ad('0x4'));var rp=require(_0xd8ad('0x5'));var moment=require(_0xd8ad('0x6'));var BPromise=require(_0xd8ad('0x7'));var Mustache=require(_0xd8ad('0x8'));var util=require('util');var path=require(_0xd8ad('0x9'));var sox=require(_0xd8ad('0xa'));var csv=require(_0xd8ad('0xb'));var ejs=require(_0xd8ad('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd8ad('0xd'));var jsforce=require(_0xd8ad('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd8ad('0xb'));var querystring=require(_0xd8ad('0xf'));var Papa=require(_0xd8ad('0x10'));var Redis=require(_0xd8ad('0x11'));var authService=require(_0xd8ad('0x12'));var qs=require(_0xd8ad('0x13'));var as=require(_0xd8ad('0x14'));var hardwareService=require(_0xd8ad('0x15'));var logger=require(_0xd8ad('0x16'))(_0xd8ad('0x17'));var utils=require(_0xd8ad('0x18'));var config=require(_0xd8ad('0x19'));var licenseUtil=require(_0xd8ad('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd8ad('0x1b'));var client=jayson[_0xd8ad('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3839cd,_0x4f8e69,_0x80016a,_0x10bced){return new BPromise(function(_0x15f9c3,_0x41268a){var _0x570ba7=_0x10bced||client;return _0x570ba7[_0xd8ad('0x1d')](_0x3839cd,_0x80016a)[_0xd8ad('0x1e')](function(_0x420491){logger['info'](_0xd8ad('0x1f'),_0x4f8e69,_0xd8ad('0x20'));logger['debug'](_0xd8ad('0x21'),_0x4f8e69,_0xd8ad('0x20'),JSON[_0xd8ad('0x22')](_0x420491));if(_0x420491['error']){if(_0x420491[_0xd8ad('0x23')][_0xd8ad('0x24')]===0x1f4){logger['error'](_0xd8ad('0x1f'),_0x4f8e69,_0x420491['error'][_0xd8ad('0x25')]);return _0x41268a(_0x420491[_0xd8ad('0x23')][_0xd8ad('0x25')]);}logger['error'](_0xd8ad('0x1f'),_0x4f8e69,_0x420491[_0xd8ad('0x23')][_0xd8ad('0x25')]);return _0x15f9c3(_0x420491['error'][_0xd8ad('0x25')]);}else{logger['info'](_0xd8ad('0x1f'),_0x4f8e69,'request\x20sent');_0x15f9c3(_0x420491[_0xd8ad('0x26')][_0xd8ad('0x25')]);}})[_0xd8ad('0x27')](function(_0x17d5ff){logger[_0xd8ad('0x23')]('Network,\x20%s,\x20%s',_0x4f8e69,_0x17d5ff);_0x41268a(_0x17d5ff);});});}function respondWithStatusCode(_0x47a8ce,_0x4c68f6){_0x4c68f6=_0x4c68f6||0xcc;return function(_0x5dcc17){if(_0x5dcc17){return _0x47a8ce[_0xd8ad('0x28')](_0x4c68f6);}return _0x47a8ce[_0xd8ad('0x29')](_0x4c68f6)['end']();};}function respondWithResult(_0x44b814,_0x4a1df3){_0x4a1df3=_0x4a1df3||0xc8;return function(_0x4e0ef2){if(_0x4e0ef2){return _0x44b814['status'](_0x4a1df3)['json'](_0x4e0ef2);}};}function respondWithFilteredResult(_0x558611,_0x527b6e){return function(_0x3b51e7){if(_0x3b51e7){var _0x11604b=_0x3b51e7['count'],_0x4c53df=_0x527b6e['offset'],_0x1992c3=_0x527b6e[_0xd8ad('0x2a')]+_0x527b6e['limit'],_0x35f2fc;if(_0x1992c3>=_0x11604b){_0x1992c3=_0x11604b;_0x35f2fc=0xc8;}else{_0x35f2fc=0xce;}_0x558611[_0xd8ad('0x29')](_0x35f2fc);return _0x558611[_0xd8ad('0x2b')]('Content-Range',_0x4c53df+'-'+_0x1992c3+'/'+_0x11604b)[_0xd8ad('0x2c')](_0x3b51e7);}return null;};}function patchUpdates(_0x297c79){return function(_0x129e80){try{jsonpatch['apply'](_0x129e80,_0x297c79,!![]);}catch(_0x594c46){return BPromise[_0xd8ad('0x2d')](_0x594c46);}return _0x129e80[_0xd8ad('0x2e')]();};}function saveUpdates(_0x2d188f,_0xcf618d){return function(_0x3e00d2){if(_0x3e00d2){return _0x3e00d2[_0xd8ad('0x2f')](_0x2d188f)[_0xd8ad('0x1e')](function(_0x411393){return _0x411393;});}return null;};}function removeEntity(_0x20e973,_0x3e1734){return function(_0x27d779){if(_0x27d779){return _0x27d779[_0xd8ad('0x30')]()['then'](function(){_0x20e973[_0xd8ad('0x29')](0xcc)[_0xd8ad('0x31')]();});}};}function handleEntityNotFound(_0x34444b,_0x463038){return function(_0x2da1d1){if(!_0x2da1d1){_0x34444b['sendStatus'](0x194);}return _0x2da1d1;};}function handleError(_0x285242,_0x3a5281){_0x3a5281=_0x3a5281||0x1f4;return function(_0x5a8754){logger[_0xd8ad('0x23')](_0x5a8754[_0xd8ad('0x32')]);if(_0x5a8754[_0xd8ad('0x33')]){delete _0x5a8754[_0xd8ad('0x33')];}_0x285242[_0xd8ad('0x29')](_0x3a5281)[_0xd8ad('0x34')](_0x5a8754);};}exports['index']=function(_0x32063a,_0x27d64e){var _0x450b82={},_0xf9160a={},_0x2e0ecc={'count':0x0,'rows':[]};var _0xdc1c81=_[_0xd8ad('0x35')](db[_0xd8ad('0x36')][_0xd8ad('0x37')],function(_0x4dd1e9){return{'name':_0x4dd1e9[_0xd8ad('0x38')],'type':_0x4dd1e9[_0xd8ad('0x39')][_0xd8ad('0x3a')]};});_0xf9160a[_0xd8ad('0x3b')]=_[_0xd8ad('0x35')](_0xdc1c81,_0xd8ad('0x33'));_0xf9160a[_0xd8ad('0x3c')]=_['keys'](_0x32063a[_0xd8ad('0x3c')]);_0xf9160a[_0xd8ad('0x3d')]=_[_0xd8ad('0x3e')](_0xf9160a[_0xd8ad('0x3b')],_0xf9160a[_0xd8ad('0x3c')]);_0x450b82['attributes']=_[_0xd8ad('0x3e')](_0xf9160a['model'],qs[_0xd8ad('0x3f')](_0x32063a[_0xd8ad('0x3c')][_0xd8ad('0x3f')]));_0x450b82['attributes']=_0x450b82[_0xd8ad('0x40')]['length']?_0x450b82[_0xd8ad('0x40')]:_0xf9160a['model'];if(!_0x32063a[_0xd8ad('0x3c')][_0xd8ad('0x41')](_0xd8ad('0x42'))){_0x450b82[_0xd8ad('0x43')]=qs[_0xd8ad('0x43')](_0x32063a[_0xd8ad('0x3c')][_0xd8ad('0x43')]);_0x450b82[_0xd8ad('0x2a')]=qs[_0xd8ad('0x2a')](_0x32063a[_0xd8ad('0x3c')][_0xd8ad('0x2a')]);}_0x450b82[_0xd8ad('0x44')]=qs['sort'](_0x32063a[_0xd8ad('0x3c')]['sort']);_0x450b82['where']=qs[_0xd8ad('0x3d')](_['pick'](_0x32063a['query'],_0xf9160a[_0xd8ad('0x3d')]),_0xdc1c81);if(_0x32063a['query'][_0xd8ad('0x45')]){_0x450b82['where']=_[_0xd8ad('0x46')](_0x450b82[_0xd8ad('0x47')],{'$or':_['map'](_0xdc1c81,function(_0x31c911){if(_0x31c911[_0xd8ad('0x39')]!=='VIRTUAL'){var _0x548645={};_0x548645[_0x31c911[_0xd8ad('0x33')]]={'$like':'%'+_0x32063a[_0xd8ad('0x3c')][_0xd8ad('0x45')]+'%'};return _0x548645;}})});}_0x450b82=_[_0xd8ad('0x46')]({},_0x450b82,_0x32063a[_0xd8ad('0x48')]);var _0x262b57={'where':_0x450b82[_0xd8ad('0x47')]};return db[_0xd8ad('0x36')]['count'](_0x262b57)[_0xd8ad('0x1e')](function(_0x4d3193){_0x2e0ecc['count']=_0x4d3193;if(_0x32063a[_0xd8ad('0x3c')]['includeAll']){_0x450b82[_0xd8ad('0x49')]=[{'all':!![]}];}return db[_0xd8ad('0x36')][_0xd8ad('0x4a')](_0x450b82);})[_0xd8ad('0x1e')](function(_0x4d57f1){_0x2e0ecc['rows']=_0x4d57f1;return _0x2e0ecc;})[_0xd8ad('0x1e')](respondWithFilteredResult(_0x27d64e,_0x450b82))[_0xd8ad('0x27')](handleError(_0x27d64e,null));};exports[_0xd8ad('0x4b')]=function(_0x57a2e9,_0x3b79e9){var _0x5a1278={'raw':!![],'where':{'id':_0x57a2e9['params']['id']}},_0x56deb4={};_0x56deb4[_0xd8ad('0x3b')]=_[_0xd8ad('0x4c')](db[_0xd8ad('0x36')][_0xd8ad('0x37')]);_0x56deb4[_0xd8ad('0x3c')]=_[_0xd8ad('0x4c')](_0x57a2e9[_0xd8ad('0x3c')]);_0x56deb4[_0xd8ad('0x3d')]=_['intersection'](_0x56deb4[_0xd8ad('0x3b')],_0x56deb4[_0xd8ad('0x3c')]);_0x5a1278[_0xd8ad('0x40')]=_[_0xd8ad('0x3e')](_0x56deb4['model'],qs[_0xd8ad('0x3f')](_0x57a2e9['query'][_0xd8ad('0x3f')]));_0x5a1278['attributes']=_0x5a1278['attributes'][_0xd8ad('0x4d')]?_0x5a1278[_0xd8ad('0x40')]:_0x56deb4['model'];if(_0x57a2e9[_0xd8ad('0x3c')]['includeAll']){_0x5a1278[_0xd8ad('0x49')]=[{'all':!![]}];}_0x5a1278=_[_0xd8ad('0x46')]({},_0x5a1278,_0x57a2e9['options']);return db[_0xd8ad('0x36')][_0xd8ad('0x4e')](_0x5a1278)[_0xd8ad('0x1e')](handleEntityNotFound(_0x3b79e9,null))['then'](respondWithResult(_0x3b79e9,null))[_0xd8ad('0x27')](handleError(_0x3b79e9,null));};exports['create']=function(_0x2232b3,_0x42958d,_0x5b0d){var _0x564069;return db[_0xd8ad('0x4f')]['transaction'](function(_0x173e7){return db[_0xd8ad('0x36')][_0xd8ad('0x50')](_0x2232b3[_0xd8ad('0x51')],{'raw':!![]})[_0xd8ad('0x1e')](function(_0x34c309){_0x564069=_0x34c309;return db[_0xd8ad('0x36')][_0xd8ad('0x4a')]({'where':{'type':_0x2232b3[_0xd8ad('0x51')]['type']},'raw':!![]});})[_0xd8ad('0x1e')](function(_0x66e402){if(_0x564069[_0xd8ad('0x39')]['toUpperCase']()=='STUN'){var _0x4e036d=fs[_0xd8ad('0x52')](path[_0xd8ad('0x53')](config[_0xd8ad('0x54')],_0xd8ad('0x55')),_0xd8ad('0x56'));var _0x216a73=ejs[_0xd8ad('0x57')](_0x4e036d,{'networks':_0x66e402||[]});fs['writeFileSync'](_0xd8ad('0x58'),_0x216a73);return respondWithRpcPromise(_0xd8ad('0x59'),_0xd8ad('0x50'),{'module':'res_stun_monitor.so'});}else if(_0x564069[_0xd8ad('0x39')][_0xd8ad('0x5a')]()=='TURN'){var _0x5db7c3=fs['readFileSync'](path['join'](config[_0xd8ad('0x54')],_0xd8ad('0x5b')),_0xd8ad('0x56'));var _0x35db00=ejs[_0xd8ad('0x57')](_0x5db7c3,{'networks':_0x66e402||[]});fs[_0xd8ad('0x5c')]('/etc/asterisk/turn_xcally.conf',_0x35db00);return respondWithRpcPromise('Reload',_0xd8ad('0x50'),{'module':_0xd8ad('0x5d')});}else{var _0x448741=fs[_0xd8ad('0x52')](path[_0xd8ad('0x53')](config[_0xd8ad('0x54')],_0xd8ad('0x5e')),_0xd8ad('0x56'));var _0x8f0483=ejs[_0xd8ad('0x57')](_0x448741,{'networks':_0x66e402||[]});fs['writeFileSync'](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x2232b3[_0xd8ad('0x51')]['type']['toLowerCase']()),_0x8f0483);return respondWithRpcPromise('Reload',_0xd8ad('0x50'),{'module':_0xd8ad('0x5f')});}return null;})['then'](function(){return _0x564069;});})['then'](respondWithResult(_0x42958d,0xc9))[_0xd8ad('0x27')](handleError(_0x42958d,null));};exports[_0xd8ad('0x2f')]=function(_0x30856c,_0x36e878,_0x4744ad){var _0x3ff817;return db['sequelize'][_0xd8ad('0x60')](function(_0x4c25e5){return db['Network'][_0xd8ad('0x4e')]({'where':{'id':_0x30856c['params']['id']}})[_0xd8ad('0x1e')](handleEntityNotFound(_0x36e878,null))['then'](saveUpdates(_0x30856c[_0xd8ad('0x51')],null))[_0xd8ad('0x1e')](function(_0x50c9c0){if(_0x50c9c0){_0x3ff817=_0x50c9c0;return db[_0xd8ad('0x36')][_0xd8ad('0x4a')]({'where':{'type':_0x3ff817[_0xd8ad('0x39')]},'raw':!![]});}return null;})[_0xd8ad('0x1e')](function(_0x2f7d68){if(_0x3ff817[_0xd8ad('0x39')]['toUpperCase']()==_0xd8ad('0x61')){var _0x450cd6=fs['readFileSync'](path[_0xd8ad('0x53')](config[_0xd8ad('0x54')],'server/files/templates/stun_multiple.ejs'),_0xd8ad('0x56'));var _0x5804e1=ejs[_0xd8ad('0x57')](_0x450cd6,{'networks':_0x2f7d68||[]});fs[_0xd8ad('0x5c')](_0xd8ad('0x58'),_0x5804e1);return respondWithRpcPromise(_0xd8ad('0x59'),_0xd8ad('0x2f'),{'module':'res_stun_monitor.so'});}else if(_0x3ff817[_0xd8ad('0x39')][_0xd8ad('0x5a')]()==_0xd8ad('0x62')){var _0x869cc9=fs[_0xd8ad('0x52')](path[_0xd8ad('0x53')](config['root'],_0xd8ad('0x5b')),_0xd8ad('0x56'));var _0x51b407=ejs[_0xd8ad('0x57')](_0x869cc9,{'networks':_0x2f7d68||[]});fs[_0xd8ad('0x5c')]('/etc/asterisk/turn_xcally.conf',_0x51b407);return respondWithRpcPromise('Reload',_0xd8ad('0x2f'),{'module':'res_stun_monitor.so'});}else{var _0x44de51=fs[_0xd8ad('0x52')](path[_0xd8ad('0x53')](config[_0xd8ad('0x54')],_0xd8ad('0x5e')),_0xd8ad('0x56'));var _0x5bfc54=ejs['render'](_0x44de51,{'networks':_0x2f7d68||[]});fs[_0xd8ad('0x5c')](util[_0xd8ad('0x63')](_0xd8ad('0x64'),_0x30856c[_0xd8ad('0x51')]['type'][_0xd8ad('0x65')]()),_0x5bfc54);return respondWithRpcPromise('Reload',_0xd8ad('0x2f'),{'module':_0xd8ad('0x5f')});}return null;})['then'](function(_0x6fda6){if(_0x6fda6){return _0x3ff817;}return null;});})[_0xd8ad('0x1e')](respondWithResult(_0x36e878,null))[_0xd8ad('0x27')](handleError(_0x36e878,null));};exports[_0xd8ad('0x30')]=function(_0x13c87e,_0x30c699,_0x31f66a){var _0x2afb61;return db[_0xd8ad('0x36')][_0xd8ad('0x4e')]({'where':{'id':_0x13c87e[_0xd8ad('0x66')]['id']}})['then'](function(_0x451992){_0x2afb61=_0x451992;return _0x451992;})['then'](handleEntityNotFound(_0x30c699,null))[_0xd8ad('0x1e')](removeEntity(_0x30c699,null))[_0xd8ad('0x1e')](function(){if(_0x2afb61){return db[_0xd8ad('0x36')][_0xd8ad('0x4a')]({'where':{'type':_0x2afb61[_0xd8ad('0x39')]},'raw':!![]});}})['then'](function(_0x5b4855){if(_0x2afb61['type'][_0xd8ad('0x5a')]()==_0xd8ad('0x61')){var _0x3f471e=fs[_0xd8ad('0x52')](path[_0xd8ad('0x53')](config[_0xd8ad('0x54')],_0xd8ad('0x55')),_0xd8ad('0x56'));var _0x4f989a=ejs['render'](_0x3f471e,{'networks':_0x5b4855||[]});fs['writeFileSync'](_0xd8ad('0x58'),_0x4f989a);return respondWithRpcPromise('Reload',_0xd8ad('0x30'),{'module':_0xd8ad('0x5d')});}else if(_0x2afb61['type'][_0xd8ad('0x5a')]()==_0xd8ad('0x62')){var _0x29e267=fs[_0xd8ad('0x52')](path[_0xd8ad('0x53')](config[_0xd8ad('0x54')],'server/files/templates/turn_multiple.ejs'),_0xd8ad('0x56'));var _0x5d2d9a=ejs[_0xd8ad('0x57')](_0x29e267,{'networks':_0x5b4855||[]});fs['writeFileSync'](_0xd8ad('0x67'),_0x5d2d9a);return respondWithRpcPromise(_0xd8ad('0x59'),'destroy',{'module':_0xd8ad('0x5d')});}else{var _0x3c632e=fs[_0xd8ad('0x52')](path['join'](config[_0xd8ad('0x54')],_0xd8ad('0x5e')),_0xd8ad('0x56'));var _0xc31cdc=ejs[_0xd8ad('0x57')](_0x3c632e,{'networks':_0x5b4855||[]});fs['writeFileSync'](util[_0xd8ad('0x63')](_0xd8ad('0x64'),_0x13c87e['body'][_0xd8ad('0x39')][_0xd8ad('0x65')]()),_0xc31cdc);return respondWithRpcPromise(_0xd8ad('0x59'),_0xd8ad('0x30'),{'module':_0xd8ad('0x5f')});}return null;})['catch'](handleError(_0x30c699,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 48a4b84..424f508 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 _0x77a8=['../../config/environment','./network.attributes','exports','define','network','lodash','util','api','bluebird','request-promise'];(function(_0x526efe,_0x481229){var _0x384c77=function(_0x477808){while(--_0x477808){_0x526efe['push'](_0x526efe['shift']());}};_0x384c77(++_0x481229);}(_0x77a8,0x127));var _0x877a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x77a8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x877a('0x0'));var util=require(_0x877a('0x1'));var logger=require('../../config/logger')(_0x877a('0x2'));var moment=require('moment');var BPromise=require(_0x877a('0x3'));var rp=require(_0x877a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x877a('0x5'));var attributes=require(_0x877a('0x6'));module[_0x877a('0x7')]=function(_0x185cf0,_0x1778e1){return _0x185cf0[_0x877a('0x8')]('Network',attributes,{'tableName':_0x877a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9869=['bluebird','request-promise','rimraf','./network.attributes','define','lodash','util','../../config/logger','api','moment'];(function(_0x52fd8d,_0x54b354){var _0x4df6ec=function(_0x5232db){while(--_0x5232db){_0x52fd8d['push'](_0x52fd8d['shift']());}};_0x4df6ec(++_0x54b354);}(_0x9869,0xf5));var _0x9986=function(_0xcced33,_0x38aae8){_0xcced33=_0xcced33-0x0;var _0x7272fc=_0x9869[_0xcced33];return _0x7272fc;};'use strict';var _=require(_0x9986('0x0'));var util=require(_0x9986('0x1'));var logger=require(_0x9986('0x2'))(_0x9986('0x3'));var moment=require(_0x9986('0x4'));var BPromise=require(_0x9986('0x5'));var rp=require(_0x9986('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9986('0x7'));var config=require('../../config/environment');var attributes=require(_0x9986('0x8'));module['exports']=function(_0x1e9249,_0x1a2485){return _0x1e9249[_0x9986('0x9')]('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index bdd4f6e..3def7c9 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 _0xf861=['request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s'];(function(_0x5524fe,_0x225c46){var _0x477ea2=function(_0x2f479c){while(--_0x2f479c){_0x5524fe['push'](_0x5524fe['shift']());}};_0x477ea2(++_0x225c46);}(_0xf861,0x125));var _0x1f86=function(_0x2d8ead,_0x3f0825){_0x2d8ead=_0x2d8ead-0x0;var _0xef6c2e=_0xf861[_0x2d8ead];return _0xef6c2e;};'use strict';var _=require(_0x1f86('0x0'));var util=require(_0x1f86('0x1'));var moment=require(_0x1f86('0x2'));var BPromise=require(_0x1f86('0x3'));var rs=require(_0x1f86('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f86('0x5'))['db'];var utils=require(_0x1f86('0x6'));var logger=require('../../config/logger')(_0x1f86('0x7'));var config=require(_0x1f86('0x8'));var jayson=require(_0x1f86('0x9'));var client=jayson[_0x1f86('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2afce9,_0x371e8c,_0x205610){return new BPromise(function(_0x3dd5ef,_0x50885f){return client[_0x1f86('0xb')](_0x2afce9,_0x205610)[_0x1f86('0xc')](function(_0x3ccd62){logger[_0x1f86('0xd')](_0x1f86('0xe'),_0x371e8c,_0x1f86('0xf'));logger[_0x1f86('0x10')]('Network,\x20%s,\x20%s,\x20%s',_0x371e8c,_0x1f86('0xf'),JSON[_0x1f86('0x11')](_0x3ccd62));if(_0x3ccd62[_0x1f86('0x12')]){if(_0x3ccd62[_0x1f86('0x12')][_0x1f86('0x13')]===0x1f4){logger[_0x1f86('0x12')](_0x1f86('0xe'),_0x371e8c,_0x3ccd62[_0x1f86('0x12')][_0x1f86('0x14')]);return _0x50885f(_0x3ccd62[_0x1f86('0x12')][_0x1f86('0x14')]);}logger[_0x1f86('0x12')](_0x1f86('0xe'),_0x371e8c,_0x3ccd62[_0x1f86('0x12')][_0x1f86('0x14')]);return _0x3dd5ef(_0x3ccd62[_0x1f86('0x12')][_0x1f86('0x14')]);}else{logger[_0x1f86('0xd')](_0x1f86('0xe'),_0x371e8c,_0x1f86('0xf'));_0x3dd5ef(_0x3ccd62[_0x1f86('0x15')][_0x1f86('0x14')]);}})['catch'](function(_0x43ee52){logger[_0x1f86('0x12')](_0x1f86('0xe'),_0x371e8c,_0x43ee52);_0x50885f(_0x43ee52);});});} \ No newline at end of file +var _0x1827=['request','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','Network,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2a7eca,_0x5667e2){var _0x2eec3d=function(_0x356782){while(--_0x356782){_0x2a7eca['push'](_0x2a7eca['shift']());}};_0x2eec3d(++_0x5667e2);}(_0x1827,0x1b4));var _0x7182=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x1827[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0x7182('0x0'));var util=require(_0x7182('0x1'));var moment=require(_0x7182('0x2'));var BPromise=require(_0x7182('0x3'));var rs=require(_0x7182('0x4'));var fs=require('fs');var Redis=require(_0x7182('0x5'));var db=require(_0x7182('0x6'))['db'];var utils=require(_0x7182('0x7'));var logger=require(_0x7182('0x8'))(_0x7182('0x9'));var config=require(_0x7182('0xa'));var jayson=require(_0x7182('0xb'));var client=jayson[_0x7182('0xc')][_0x7182('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x21a160,_0x3d2647,_0x5191cf){return new BPromise(function(_0x420fa0,_0x170697){return client[_0x7182('0xe')](_0x21a160,_0x5191cf)[_0x7182('0xf')](function(_0x1491a3){logger[_0x7182('0x10')]('Network,\x20%s,\x20%s',_0x3d2647,_0x7182('0x11'));logger[_0x7182('0x12')](_0x7182('0x13'),_0x3d2647,_0x7182('0x11'),JSON['stringify'](_0x1491a3));if(_0x1491a3[_0x7182('0x14')]){if(_0x1491a3[_0x7182('0x14')][_0x7182('0x15')]===0x1f4){logger[_0x7182('0x14')](_0x7182('0x16'),_0x3d2647,_0x1491a3[_0x7182('0x14')][_0x7182('0x17')]);return _0x170697(_0x1491a3[_0x7182('0x14')][_0x7182('0x17')]);}logger[_0x7182('0x14')]('Network,\x20%s,\x20%s',_0x3d2647,_0x1491a3['error'][_0x7182('0x17')]);return _0x420fa0(_0x1491a3['error']['message']);}else{logger[_0x7182('0x10')](_0x7182('0x16'),_0x3d2647,_0x7182('0x11'));_0x420fa0(_0x1491a3['result'][_0x7182('0x17')]);}})[_0x7182('0x18')](function(_0x3badf7){logger[_0x7182('0x14')]('Network,\x20%s,\x20%s',_0x3d2647,_0x3badf7);_0x170697(_0x3badf7);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index b29da83..2137f10 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 _0x9823=['../../config/environment','./notification.controller','post','isAuthenticated','sendNotification','multer','util','path','express','Router','../../components/interaction/service'];(function(_0x2350dd,_0x53e293){var _0x5ca2db=function(_0x5dacc7){while(--_0x5dacc7){_0x2350dd['push'](_0x2350dd['shift']());}};_0x5ca2db(++_0x53e293);}(_0x9823,0x1bd));var _0x3982=function(_0x48f537,_0x5ba858){_0x48f537=_0x48f537-0x0;var _0x22169b=_0x9823[_0x48f537];return _0x22169b;};'use strict';var multer=require(_0x3982('0x0'));var util=require(_0x3982('0x1'));var path=require(_0x3982('0x2'));var timeout=require('connect-timeout');var express=require(_0x3982('0x3'));var router=express[_0x3982('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3982('0x5'));var config=require(_0x3982('0x6'));var controller=require(_0x3982('0x7'));router[_0x3982('0x8')]('/',auth[_0x3982('0x9')](),controller[_0x3982('0xa')]);module['exports']=router; \ No newline at end of file +var _0x8e76=['multer','util','../../components/interaction/service','../../config/environment','post','sendNotification','exports'];(function(_0xaaa1aa,_0x53a879){var _0xfb55c0=function(_0xb1625d){while(--_0xb1625d){_0xaaa1aa['push'](_0xaaa1aa['shift']());}};_0xfb55c0(++_0x53a879);}(_0x8e76,0x165));var _0x68e7=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x8e76[_0x278e3c];return _0x3e2d9b;};'use strict';var multer=require(_0x68e7('0x0'));var util=require(_0x68e7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x68e7('0x2'));var config=require(_0x68e7('0x3'));var controller=require('./notification.controller');router[_0x68e7('0x4')]('/',auth['isAuthenticated'](),controller[_0x68e7('0x5')]);module[_0x68e7('0x6')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index b64638a..9333ea6 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 _0xa03f=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa03f,0xe6));var _0xfa03=function(_0x1c420f,_0x16bbed){_0x1c420f=_0x1c420f-0x0;var _0x135a3e=_0xa03f[_0x1c420f];return _0x135a3e;};'use strict';var Sequelize=require(_0xfa03('0x0'));module[_0xfa03('0x1')]={'body':{'type':Sequelize[_0xfa03('0x2')]},'senderName':{'type':Sequelize[_0xfa03('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xfa03('0x4')]}}; \ No newline at end of file +var _0xf222=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x263065,_0x48c6de){var _0x1f7aaa=function(_0x5f27ce){while(--_0x5f27ce){_0x263065['push'](_0x263065['shift']());}};_0x1f7aaa(++_0x48c6de);}(_0xf222,0xc9));var _0x2f22=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xf222[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x2f22('0x0'));module[_0x2f22('0x1')]={'body':{'type':Sequelize[_0x2f22('0x2')]},'senderName':{'type':Sequelize[_0x2f22('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x2f22('0x3')]},'beep':{'type':Sequelize[_0x2f22('0x4')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 84ba69f..d7b6416 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 _0xffae=['then','destroy','end','error','name','send','sendNotification','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','team','some','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','isEmpty','beep','join','sequelize','transaction','Notification','create','forEach','recipient','emit','notification:send','catch','text','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','html','startCase','model','User','union','ids','includes','queue','replace','Queue','all','flatten','getAgents','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','save','update'];(function(_0x5de214,_0x107e9d){var _0x4df627=function(_0x4199e1){while(--_0x4199e1){_0x5de214['push'](_0x5de214['shift']());}};_0x4df627(++_0x107e9d);}(_0xffae,0x175));var _0xeffa=function(_0x31dab2,_0xb9f9c){_0x31dab2=_0x31dab2-0x0;var _0x2bbae6=_0xffae[_0x31dab2];return _0x2bbae6;};'use strict';var pdf=require(_0xeffa('0x0'));var emlformat=require(_0xeffa('0x1'));var rimraf=require(_0xeffa('0x2'));var zipdir=require(_0xeffa('0x3'));var jsonpatch=require(_0xeffa('0x4'));var rp=require(_0xeffa('0x5'));var moment=require(_0xeffa('0x6'));var BPromise=require(_0xeffa('0x7'));var Mustache=require('mustache');var util=require(_0xeffa('0x8'));var path=require(_0xeffa('0x9'));var sox=require(_0xeffa('0xa'));var csv=require(_0xeffa('0xb'));var ejs=require(_0xeffa('0xc'));var fs=require('fs');var _=require(_0xeffa('0xd'));var squel=require('squel');var crypto=require(_0xeffa('0xe'));var jsforce=require(_0xeffa('0xf'));var deskjs=require(_0xeffa('0x10'));var toCsv=require(_0xeffa('0xb'));var querystring=require(_0xeffa('0x11'));var Papa=require(_0xeffa('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xeffa('0x13'));var as=require(_0xeffa('0x14'));var hardwareService=require(_0xeffa('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xeffa('0x16'));var config=require(_0xeffa('0x17'));var licenseUtil=require(_0xeffa('0x18'));var db=require(_0xeffa('0x19'))['db'];config[_0xeffa('0x1a')]=_[_0xeffa('0x1b')](config[_0xeffa('0x1a')],{'host':_0xeffa('0x1c'),'port':0x18eb});var socket=require(_0xeffa('0x1d'))(new Redis(config[_0xeffa('0x1a')]));require(_0xeffa('0x1e'))[_0xeffa('0x1f')](socket);function respondWithStatusCode(_0x5e9951,_0x53e245){_0x53e245=_0x53e245||0xcc;return function(_0x16dc6d){if(_0x16dc6d){return _0x5e9951[_0xeffa('0x20')](_0x53e245);}return _0x5e9951[_0xeffa('0x21')](_0x53e245)['end']();};}function respondWithResult(_0x138682,_0x2630bb){_0x2630bb=_0x2630bb||0xc8;return function(_0x2a4b38){if(_0x2a4b38){return _0x138682['status'](_0x2630bb)['json'](_0x2a4b38);}};}function respondWithFilteredResult(_0x46c4f4,_0x661688){return function(_0x231e89){if(_0x231e89){var _0x2cc67c=_0x231e89[_0xeffa('0x22')],_0x9f1689=_0x661688[_0xeffa('0x23')],_0x54602e=_0x661688[_0xeffa('0x23')]+_0x661688['limit'],_0x2875ff;if(_0x54602e>=_0x2cc67c){_0x54602e=_0x2cc67c;_0x2875ff=0xc8;}else{_0x2875ff=0xce;}_0x46c4f4[_0xeffa('0x21')](_0x2875ff);return _0x46c4f4[_0xeffa('0x24')](_0xeffa('0x25'),_0x9f1689+'-'+_0x54602e+'/'+_0x2cc67c)[_0xeffa('0x26')](_0x231e89);}return null;};}function patchUpdates(_0x3424a6){return function(_0x54ae43){try{jsonpatch[_0xeffa('0x27')](_0x54ae43,_0x3424a6,!![]);}catch(_0x41c57b){return BPromise[_0xeffa('0x28')](_0x41c57b);}return _0x54ae43[_0xeffa('0x29')]();};}function saveUpdates(_0xb65ace,_0x585d56){return function(_0x3f9abf){if(_0x3f9abf){return _0x3f9abf[_0xeffa('0x2a')](_0xb65ace)[_0xeffa('0x2b')](function(_0x386358){return _0x386358;});}return null;};}function removeEntity(_0x4749ca,_0xa7055){return function(_0x5f3ade){if(_0x5f3ade){return _0x5f3ade[_0xeffa('0x2c')]()['then'](function(){_0x4749ca['status'](0xcc)[_0xeffa('0x2d')]();});}};}function handleEntityNotFound(_0x1d028a,_0x3aa418){return function(_0x18281c){if(!_0x18281c){_0x1d028a[_0xeffa('0x20')](0x194);}return _0x18281c;};}function handleError(_0x3217fa,_0x3c2099){_0x3c2099=_0x3c2099||0x1f4;return function(_0x2bc278){logger[_0xeffa('0x2e')](_0x2bc278['stack']);if(_0x2bc278[_0xeffa('0x2f')]){delete _0x2bc278[_0xeffa('0x2f')];}_0x3217fa[_0xeffa('0x21')](_0x3c2099)[_0xeffa('0x30')](_0x2bc278);};}exports[_0xeffa('0x31')]=function(_0x2374c4,_0x450225,_0x5670d5){if(!_0x2374c4[_0xeffa('0x32')]['hasOwnProperty']('text')&&!_0x2374c4[_0xeffa('0x32')][_0xeffa('0x33')](_0xeffa('0x34'))){throw new db[(_0xeffa('0x35'))][(_0xeffa('0x36'))](_0xeffa('0x37'));}else{if(_0x2374c4[_0xeffa('0x32')][_0xeffa('0x33')](_0xeffa('0x34'))&&!_0x2374c4['body']['hasOwnProperty'](_0xeffa('0x38'))){throw new db[(_0xeffa('0x35'))][(_0xeffa('0x36'))](_0xeffa('0x39'));}if(!_0x2374c4[_0xeffa('0x32')][_0xeffa('0x33')](_0xeffa('0x3a'))){throw new db[(_0xeffa('0x35'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x33a904=JSON[_0xeffa('0x3b')](_0x2374c4[_0xeffa('0x32')][_0xeffa('0x3a')]);}catch(_0x1fbf40){logger[_0xeffa('0x2e')](_0x1fbf40);throw new db[(_0xeffa('0x35'))][(_0xeffa('0x36'))]('Invalid\x20\x27recipients\x27\x20object');}var _0xd7911a=[_0xeffa('0x3c'),_0xeffa('0x3d'),_0xeffa('0x3e'),_0xeffa('0x3f'),_0xeffa('0x40'),'voicequeue',_0xeffa('0x41'),_0xeffa('0x42'),'user'];if(_[_0xeffa('0x43')](_0x33a904,function(_0x8b6415){return!_['includes'](_0xd7911a,_0x8b6415['model'][_0xeffa('0x44')]());})){throw new db[(_0xeffa('0x35'))][(_0xeffa('0x36'))](_0xeffa('0x45'));}}}var _0x3e72cf={};_0x3e72cf[_0xeffa('0x46')]=_0x2374c4[_0xeffa('0x32')][_0xeffa('0x33')]('senderName')?_0x2374c4[_0xeffa('0x32')][_0xeffa('0x46')]:_0x2374c4[_0xeffa('0x47')][_0xeffa('0x48')];_0x3e72cf[_0xeffa('0x49')]=_[_0xeffa('0x4a')](_0x2374c4[_0xeffa('0x32')][_0xeffa('0x49')])?null:_0x2374c4[_0xeffa('0x32')][_0xeffa('0x49')];_0x3e72cf['beep']=_0x2374c4[_0xeffa('0x32')][_0xeffa('0x4b')]||![];_0x3e72cf['SenderId']=_0x2374c4[_0xeffa('0x47')]['id'];return getContent(_0x2374c4[_0xeffa('0x32')])[_0xeffa('0x2b')](function(_0x202601){_0x3e72cf[_0xeffa('0x32')]=_0x202601;return getRecipients(_0x33a904);})[_0xeffa('0x2b')](function(_0x333283){_0x3e72cf['recipientsId']=_['sortBy'](_0x333283)[_0xeffa('0x4c')](',');return db[_0xeffa('0x4d')][_0xeffa('0x4e')](function(_0xff03cf){return db[_0xeffa('0x4f')][_0xeffa('0x50')](_0x3e72cf,{'raw':!![],'transaction':_0xff03cf})[_0xeffa('0x2b')](function(_0x76982a){var _0x16ad7b={'sender':_0x3e72cf['senderName'],'description':_0x3e72cf[_0xeffa('0x49')],'content':_0x3e72cf[_0xeffa('0x32')],'beep':_0x3e72cf[_0xeffa('0x4b')]};_0x333283[_0xeffa('0x51')](function(_0x3f21f4){_0x16ad7b[_0xeffa('0x52')]=_0x3f21f4;socket[_0xeffa('0x53')](_0xeffa('0x54'),_0x16ad7b);});return _0x76982a;});});})['then'](respondWithResult(_0x450225,0xc9))[_0xeffa('0x55')](handleError(_0x450225,null));};function getContent(_0x47b8b7){return new BPromise(function(_0x461551,_0x4453b7){if(_0x47b8b7[_0xeffa('0x56')]){_0x461551(_0x47b8b7['text']);return;}return db[_0xeffa('0x57')][_0xeffa('0x58')]({'attributes':['html'],'where':{'id':_0x47b8b7[_0xeffa('0x34')]},'raw':!![]})['then'](function(_0x44c9fb){if(!_0x44c9fb)throw new db[(_0xeffa('0x35'))][(_0xeffa('0x36'))](_0xeffa('0x59'));var _0x43d080=Mustache['render'](_0x44c9fb[_0xeffa('0x5a')],_0x47b8b7[_0xeffa('0x38')]);_0x461551(_0x43d080);})['catch'](function(_0x25b181){_0x4453b7(_0x25b181);});});}function getRecipients(_0x433e8a){return new BPromise(function(_0x5c4c8c,_0x5bef8b){var _0x5bcaef=[];var _0xadba57=[];_0x433e8a['forEach'](function(_0x2e6fec){var _0x2a6cee=_[_0xeffa('0x5b')](_0x2e6fec[_0xeffa('0x5c')]['toLowerCase']());if(_0x2a6cee===_0xeffa('0x5d')){_0x5bcaef=_[_0xeffa('0x5e')](_0x5bcaef,_0x2e6fec[_0xeffa('0x5f')]);}else{if(_[_0xeffa('0x60')](_0x2a6cee,_0xeffa('0x61')))_0x2a6cee=_0x2a6cee[_0xeffa('0x62')]('queue',_0xeffa('0x63'));_0x2e6fec[_0xeffa('0x5f')][_0xeffa('0x51')](function(_0x14af5a){_0xadba57['push'](getAgents(_0x2a6cee,_0x14af5a));});}});return BPromise[_0xeffa('0x64')](_0xadba57)[_0xeffa('0x2b')](function(_0xcbceba){_0x5bcaef=_[_0xeffa('0x5e')](_0x5bcaef,_[_0xeffa('0x65')](_0xcbceba));_0x5c4c8c(_0x5bcaef);})['catch'](function(_0x30a159){_0x5bef8b(_0x30a159);});});}function getAgents(_0x498100,_0xe5da67){return new BPromise(function(_0x80ddbd,_0x42cde4){return db[_0x498100]['findOne']({'where':{'id':_0xe5da67}})[_0xeffa('0x2b')](function(_0x5760b3){return _0x5760b3[_0xeffa('0x66')]({'attributes':['id'],'raw':!![]})[_0xeffa('0x2b')](function(_0x55bc17){var _0xc619dd=_[_0xeffa('0x67')](_0x55bc17,'id');_0x80ddbd(_0xc619dd);});})[_0xeffa('0x55')](function(_0xf6c11a){_0x42cde4(_0xf6c11a);});});} \ No newline at end of file +var _0x8df8=['desk.js','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./notification.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','destroy','then','stack','name','send','sendNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','Sequelize','parse','recipients','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','Notification','create','recipient','emit','notification:send','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','html','forEach','toLowerCase','union','ids','replace','queue','Queue','push','all','flatten','getAgents','map','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce'];(function(_0x23a4df,_0x3b8781){var _0x506e67=function(_0x1e3468){while(--_0x1e3468){_0x23a4df['push'](_0x23a4df['shift']());}};_0x506e67(++_0x3b8781);}(_0x8df8,0x16f));var _0x88df=function(_0x12dc71,_0x2781b1){_0x12dc71=_0x12dc71-0x0;var _0x54705e=_0x8df8[_0x12dc71];return _0x54705e;};'use strict';var pdf=require(_0x88df('0x0'));var emlformat=require(_0x88df('0x1'));var rimraf=require(_0x88df('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x88df('0x3'));var moment=require(_0x88df('0x4'));var BPromise=require(_0x88df('0x5'));var Mustache=require(_0x88df('0x6'));var util=require('util');var path=require('path');var sox=require(_0x88df('0x7'));var csv=require(_0x88df('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x88df('0x9'));var squel=require(_0x88df('0xa'));var crypto=require(_0x88df('0xb'));var jsforce=require(_0x88df('0xc'));var deskjs=require(_0x88df('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x88df('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x88df('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x88df('0x10'));var utils=require('../../config/utils');var config=require(_0x88df('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x88df('0x12'))['db'];config[_0x88df('0x13')]=_['defaults'](config[_0x88df('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x88df('0x14'))(new Redis(config[_0x88df('0x13')]));require(_0x88df('0x15'))[_0x88df('0x16')](socket);function respondWithStatusCode(_0x48a31d,_0x395069){_0x395069=_0x395069||0xcc;return function(_0x4cb113){if(_0x4cb113){return _0x48a31d[_0x88df('0x17')](_0x395069);}return _0x48a31d[_0x88df('0x18')](_0x395069)[_0x88df('0x19')]();};}function respondWithResult(_0x1be093,_0xc636c7){_0xc636c7=_0xc636c7||0xc8;return function(_0x3315b2){if(_0x3315b2){return _0x1be093['status'](_0xc636c7)[_0x88df('0x1a')](_0x3315b2);}};}function respondWithFilteredResult(_0x578a17,_0x598628){return function(_0x5e5616){if(_0x5e5616){var _0x266779=_0x5e5616[_0x88df('0x1b')],_0xc374cb=_0x598628[_0x88df('0x1c')],_0x395610=_0x598628['offset']+_0x598628[_0x88df('0x1d')],_0x10ebe4;if(_0x395610>=_0x266779){_0x395610=_0x266779;_0x10ebe4=0xc8;}else{_0x10ebe4=0xce;}_0x578a17[_0x88df('0x18')](_0x10ebe4);return _0x578a17[_0x88df('0x1e')](_0x88df('0x1f'),_0xc374cb+'-'+_0x395610+'/'+_0x266779)[_0x88df('0x1a')](_0x5e5616);}return null;};}function patchUpdates(_0x30a2f2){return function(_0x213d99){try{jsonpatch['apply'](_0x213d99,_0x30a2f2,!![]);}catch(_0x5c8b7b){return BPromise['reject'](_0x5c8b7b);}return _0x213d99['save']();};}function saveUpdates(_0x4e3b5d,_0x344d8e){return function(_0x4f687c){if(_0x4f687c){return _0x4f687c['update'](_0x4e3b5d)['then'](function(_0x35d021){return _0x35d021;});}return null;};}function removeEntity(_0x37dcf6,_0x396b74){return function(_0x46b729){if(_0x46b729){return _0x46b729[_0x88df('0x20')]()[_0x88df('0x21')](function(){_0x37dcf6[_0x88df('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51dc13,_0x2ca96b){return function(_0x624750){if(!_0x624750){_0x51dc13[_0x88df('0x17')](0x194);}return _0x624750;};}function handleError(_0x182ee5,_0x3987fe){_0x3987fe=_0x3987fe||0x1f4;return function(_0x13e10e){logger['error'](_0x13e10e[_0x88df('0x22')]);if(_0x13e10e[_0x88df('0x23')]){delete _0x13e10e[_0x88df('0x23')];}_0x182ee5['status'](_0x3987fe)[_0x88df('0x24')](_0x13e10e);};}exports[_0x88df('0x25')]=function(_0x37ac07,_0x55d3dc,_0x149097){if(!_0x37ac07[_0x88df('0x26')][_0x88df('0x27')](_0x88df('0x28'))&&!_0x37ac07['body'][_0x88df('0x27')](_0x88df('0x29'))){throw new db['Sequelize'][(_0x88df('0x2a'))](_0x88df('0x2b'));}else{if(_0x37ac07[_0x88df('0x26')][_0x88df('0x27')]('TemplateId')&&!_0x37ac07[_0x88df('0x26')][_0x88df('0x27')](_0x88df('0x2c'))){throw new db['Sequelize'][(_0x88df('0x2a'))](_0x88df('0x2d'));}if(!_0x37ac07[_0x88df('0x26')][_0x88df('0x27')]('recipients')){throw new db[(_0x88df('0x2e'))][(_0x88df('0x2a'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x5764a8=JSON[_0x88df('0x2f')](_0x37ac07['body'][_0x88df('0x30')]);}catch(_0x5b1ce5){logger[_0x88df('0x31')](_0x5b1ce5);throw new db[(_0x88df('0x2e'))][(_0x88df('0x2a'))](_0x88df('0x32'));}var _0x4a4b59=[_0x88df('0x33'),_0x88df('0x34'),_0x88df('0x35'),_0x88df('0x36'),'smsqueue',_0x88df('0x37'),_0x88df('0x38'),_0x88df('0x39'),_0x88df('0x3a')];if(_[_0x88df('0x3b')](_0x5764a8,function(_0x4e96e0){return!_[_0x88df('0x3c')](_0x4a4b59,_0x4e96e0[_0x88df('0x3d')]['toLowerCase']());})){throw new db[(_0x88df('0x2e'))][(_0x88df('0x2a'))](_0x88df('0x3e'));}}}var _0x226126={};_0x226126[_0x88df('0x3f')]=_0x37ac07[_0x88df('0x26')][_0x88df('0x27')](_0x88df('0x3f'))?_0x37ac07[_0x88df('0x26')]['senderName']:_0x37ac07[_0x88df('0x3a')][_0x88df('0x40')];_0x226126[_0x88df('0x41')]=_[_0x88df('0x42')](_0x37ac07[_0x88df('0x26')][_0x88df('0x41')])?null:_0x37ac07['body'][_0x88df('0x41')];_0x226126[_0x88df('0x43')]=_0x37ac07['body'][_0x88df('0x43')]||![];_0x226126[_0x88df('0x44')]=_0x37ac07[_0x88df('0x3a')]['id'];return getContent(_0x37ac07['body'])[_0x88df('0x21')](function(_0x5294c8){_0x226126[_0x88df('0x26')]=_0x5294c8;return getRecipients(_0x5764a8);})['then'](function(_0x29c418){_0x226126[_0x88df('0x45')]=_[_0x88df('0x46')](_0x29c418)[_0x88df('0x47')](',');return db[_0x88df('0x48')]['transaction'](function(_0x322ed9){return db[_0x88df('0x49')][_0x88df('0x4a')](_0x226126,{'raw':!![],'transaction':_0x322ed9})[_0x88df('0x21')](function(_0x39fb96){var _0x142f6f={'sender':_0x226126[_0x88df('0x3f')],'description':_0x226126[_0x88df('0x41')],'content':_0x226126[_0x88df('0x26')],'beep':_0x226126[_0x88df('0x43')]};_0x29c418['forEach'](function(_0x5cd4c9){_0x142f6f[_0x88df('0x4b')]=_0x5cd4c9;socket[_0x88df('0x4c')](_0x88df('0x4d'),_0x142f6f);});return _0x39fb96;});});})[_0x88df('0x21')](respondWithResult(_0x55d3dc,0xc9))[_0x88df('0x4e')](handleError(_0x55d3dc,null));};function getContent(_0x592eb8){return new BPromise(function(_0x563dfd,_0x23ca06){if(_0x592eb8[_0x88df('0x28')]){_0x563dfd(_0x592eb8['text']);return;}return db[_0x88df('0x4f')][_0x88df('0x50')]({'attributes':['html'],'where':{'id':_0x592eb8[_0x88df('0x29')]},'raw':!![]})[_0x88df('0x21')](function(_0x7833aa){if(!_0x7833aa)throw new db['Sequelize'][(_0x88df('0x2a'))](_0x88df('0x51'));var _0x590b72=Mustache['render'](_0x7833aa[_0x88df('0x52')],_0x592eb8['view']);_0x563dfd(_0x590b72);})[_0x88df('0x4e')](function(_0x21d0c2){_0x23ca06(_0x21d0c2);});});}function getRecipients(_0x20476a){return new BPromise(function(_0xf9eaef,_0xef4300){var _0x4fbe55=[];var _0x1d1637=[];_0x20476a[_0x88df('0x53')](function(_0x379140){var _0x4bf4ad=_['startCase'](_0x379140[_0x88df('0x3d')][_0x88df('0x54')]());if(_0x4bf4ad==='User'){_0x4fbe55=_[_0x88df('0x55')](_0x4fbe55,_0x379140[_0x88df('0x56')]);}else{if(_[_0x88df('0x3c')](_0x4bf4ad,'queue'))_0x4bf4ad=_0x4bf4ad[_0x88df('0x57')](_0x88df('0x58'),_0x88df('0x59'));_0x379140['ids'][_0x88df('0x53')](function(_0x3ecc5a){_0x1d1637[_0x88df('0x5a')](getAgents(_0x4bf4ad,_0x3ecc5a));});}});return BPromise[_0x88df('0x5b')](_0x1d1637)['then'](function(_0x22e33e){_0x4fbe55=_['union'](_0x4fbe55,_[_0x88df('0x5c')](_0x22e33e));_0xf9eaef(_0x4fbe55);})[_0x88df('0x4e')](function(_0x3e85cd){_0xef4300(_0x3e85cd);});});}function getAgents(_0x5ce235,_0x502fbd){return new BPromise(function(_0x36fc82,_0x53f712){return db[_0x5ce235][_0x88df('0x50')]({'where':{'id':_0x502fbd}})[_0x88df('0x21')](function(_0xb0d588){return _0xb0d588[_0x88df('0x5d')]({'attributes':['id'],'raw':!![]})[_0x88df('0x21')](function(_0x5bd919){var _0x58beed=_[_0x88df('0x5e')](_0x5bd919,'id');_0x36fc82(_0x58beed);});})['catch'](function(_0x5a6c87){_0x53f712(_0x5a6c87);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index e91d364..8d4c5e7 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 _0xb10b=['hasOwnProperty','hook','events','Notification','setMaxListeners','save','remove','emit'];(function(_0x2e7c26,_0x23f10d){var _0x16f118=function(_0x19b1d2){while(--_0x19b1d2){_0x2e7c26['push'](_0x2e7c26['shift']());}};_0x16f118(++_0x23f10d);}(_0xb10b,0x12a));var _0xbb10=function(_0x1a3cc7,_0x2900e3){_0x1a3cc7=_0x1a3cc7-0x0;var _0x338438=_0xb10b[_0x1a3cc7];return _0x338438;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var Notification=require('../../mysqldb')['db'][_0xbb10('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){NotificationEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);NotificationEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];Notification[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file +var _0x2032=['exports','../../mysqldb','Notification','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x2032,0xd9));var _0x2203=function(_0x20f07d,_0x44d341){_0x20f07d=_0x20f07d-0x0;var _0x7687e9=_0x2032[_0x20f07d];return _0x7687e9;};'use strict';var EventEmitter=require('events');var Notification=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){NotificationEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);NotificationEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];Notification[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index 8c5dc71..f0d4d5c 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 _0x0794=['bluebird','path','../../config/environment','./notification.attributes','exports','Notification','notifications','utf8mb4','api','moment'];(function(_0x2dea94,_0x3990c0){var _0x35ad07=function(_0x21b486){while(--_0x21b486){_0x2dea94['push'](_0x2dea94['shift']());}};_0x35ad07(++_0x3990c0);}(_0x0794,0x120));var _0x4079=function(_0x36a46e,_0x112dae){_0x36a46e=_0x36a46e-0x0;var _0x1e9e8c=_0x0794[_0x36a46e];return _0x1e9e8c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x4079('0x0'));var moment=require(_0x4079('0x1'));var BPromise=require(_0x4079('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4079('0x3'));var rimraf=require('rimraf');var config=require(_0x4079('0x4'));var attributes=require(_0x4079('0x5'));module[_0x4079('0x6')]=function(_0x1089aa,_0x52ade6){return _0x1089aa['define'](_0x4079('0x7'),attributes,{'tableName':_0x4079('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4079('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xad63=['define','Notification','notifications','util','api','moment','rimraf','exports'];(function(_0xbc9a33,_0x16562b){var _0x5cd410=function(_0x2688e8){while(--_0x2688e8){_0xbc9a33['push'](_0xbc9a33['shift']());}};_0x5cd410(++_0x16562b);}(_0xad63,0x163));var _0x3ad6=function(_0x4afc93,_0x5a382e){_0x4afc93=_0x4afc93-0x0;var _0x46c7e9=_0xad63[_0x4afc93];return _0x46c7e9;};'use strict';var _=require('lodash');var util=require(_0x3ad6('0x0'));var logger=require('../../config/logger')(_0x3ad6('0x1'));var moment=require(_0x3ad6('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3ad6('0x3'));var config=require('../../config/environment');var attributes=require('./notification.attributes');module[_0x3ad6('0x4')]=function(_0x2d29f0,_0x385137){return _0x2d29f0[_0x3ad6('0x5')](_0x3ad6('0x6'),attributes,{'tableName':_0x3ad6('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 4f34d2a..8485173 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 _0x2973=['Notification,\x20%s,\x20%s,\x20%s','stringify','error','code','Notification,\x20%s,\x20%s','message','result','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','./notification.socket','register','request','info','request\x20sent','debug'];(function(_0x2bc160,_0x17d80b){var _0x229cb9=function(_0x191c58){while(--_0x191c58){_0x2bc160['push'](_0x2bc160['shift']());}};_0x229cb9(++_0x17d80b);}(_0x2973,0x84));var _0x3297=function(_0x37d36f,_0x736947){_0x37d36f=_0x37d36f-0x0;var _0x285016=_0x2973[_0x37d36f];return _0x285016;};'use strict';var _=require(_0x3297('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3297('0x1'));var rs=require(_0x3297('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3297('0x3'))['db'];var utils=require(_0x3297('0x4'));var logger=require(_0x3297('0x5'))(_0x3297('0x6'));var config=require(_0x3297('0x7'));var jayson=require(_0x3297('0x8'));var client=jayson[_0x3297('0x9')][_0x3297('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x3297('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3297('0xc'))[_0x3297('0xd')](socket);function respondWithRpcPromise(_0x16cafd,_0x2f66bc,_0x421604){return new BPromise(function(_0x2bdad5,_0x138760){return client[_0x3297('0xe')](_0x16cafd,_0x421604)['then'](function(_0x518427){logger[_0x3297('0xf')]('Notification,\x20%s,\x20%s',_0x2f66bc,_0x3297('0x10'));logger[_0x3297('0x11')](_0x3297('0x12'),_0x2f66bc,'request\x20sent',JSON[_0x3297('0x13')](_0x518427));if(_0x518427['error']){if(_0x518427[_0x3297('0x14')][_0x3297('0x15')]===0x1f4){logger['error'](_0x3297('0x16'),_0x2f66bc,_0x518427['error'][_0x3297('0x17')]);return _0x138760(_0x518427[_0x3297('0x14')]['message']);}logger[_0x3297('0x14')](_0x3297('0x16'),_0x2f66bc,_0x518427[_0x3297('0x14')][_0x3297('0x17')]);return _0x2bdad5(_0x518427['error']['message']);}else{logger['info']('Notification,\x20%s,\x20%s',_0x2f66bc,_0x3297('0x10'));_0x2bdad5(_0x518427[_0x3297('0x18')][_0x3297('0x17')]);}})['catch'](function(_0x4d62d1){logger[_0x3297('0x14')](_0x3297('0x16'),_0x2f66bc,_0x4d62d1);_0x138760(_0x4d62d1);});});} \ No newline at end of file +var _0x7a39=['redis','defaults','localhost','./notification.socket','request','then','info','Notification,\x20%s,\x20%s','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http'];(function(_0x5a0f0d,_0x510fec){var _0x1c041e=function(_0x40c570){while(--_0x40c570){_0x5a0f0d['push'](_0x5a0f0d['shift']());}};_0x1c041e(++_0x510fec);}(_0x7a39,0xe8));var _0x97a3=function(_0x78cb2,_0x372a63){_0x78cb2=_0x78cb2-0x0;var _0x26ad34=_0x7a39[_0x78cb2];return _0x26ad34;};'use strict';var _=require(_0x97a3('0x0'));var util=require(_0x97a3('0x1'));var moment=require(_0x97a3('0x2'));var BPromise=require(_0x97a3('0x3'));var rs=require(_0x97a3('0x4'));var fs=require('fs');var Redis=require(_0x97a3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x97a3('0x6'));var logger=require(_0x97a3('0x7'))(_0x97a3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x97a3('0x9')][_0x97a3('0xa')]({'port':0x232a});config[_0x97a3('0xb')]=_[_0x97a3('0xc')](config[_0x97a3('0xb')],{'host':_0x97a3('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x97a3('0xe'))['register'](socket);function respondWithRpcPromise(_0x1088cd,_0x114b2a,_0x582ff6){return new BPromise(function(_0x5ba6f5,_0x18e7fc){return client[_0x97a3('0xf')](_0x1088cd,_0x582ff6)[_0x97a3('0x10')](function(_0x5874b0){logger[_0x97a3('0x11')](_0x97a3('0x12'),_0x114b2a,_0x97a3('0x13'));logger[_0x97a3('0x14')](_0x97a3('0x15'),_0x114b2a,_0x97a3('0x13'),JSON[_0x97a3('0x16')](_0x5874b0));if(_0x5874b0['error']){if(_0x5874b0['error'][_0x97a3('0x17')]===0x1f4){logger[_0x97a3('0x18')]('Notification,\x20%s,\x20%s',_0x114b2a,_0x5874b0['error'][_0x97a3('0x19')]);return _0x18e7fc(_0x5874b0['error'][_0x97a3('0x19')]);}logger['error'](_0x97a3('0x12'),_0x114b2a,_0x5874b0[_0x97a3('0x18')]['message']);return _0x5ba6f5(_0x5874b0[_0x97a3('0x18')][_0x97a3('0x19')]);}else{logger[_0x97a3('0x11')](_0x97a3('0x12'),_0x114b2a,_0x97a3('0x13'));_0x5ba6f5(_0x5874b0['result'][_0x97a3('0x19')]);}})[_0x97a3('0x1a')](function(_0x55a7cb){logger[_0x97a3('0x18')]('Notification,\x20%s,\x20%s',_0x114b2a,_0x55a7cb);_0x18e7fc(_0x55a7cb);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 3423e49..7e150c1 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 _0x7e60=['save','remove','update','emit','removeListener','length','notification:'];(function(_0x2c9509,_0x159071){var _0x7125e7=function(_0x3d101f){while(--_0x3d101f){_0x2c9509['push'](_0x2c9509['shift']());}};_0x7125e7(++_0x159071);}(_0x7e60,0x85));var _0x07e6=function(_0x21642c,_0x4a4fed){_0x21642c=_0x21642c-0x0;var _0x20ec18=_0x7e60[_0x21642c];return _0x20ec18;};'use strict';var NotificationEvents=require('./notification.events');var events=[_0x07e6('0x0'),_0x07e6('0x1'),_0x07e6('0x2')];function createListener(_0x5fc764,_0x520880){return function(_0x475352){_0x520880[_0x07e6('0x3')](_0x5fc764,_0x475352);};}function removeListener(_0x313ffe,_0x4b9ac3){return function(){NotificationEvents[_0x07e6('0x4')](_0x313ffe,_0x4b9ac3);};}exports['register']=function(_0x92e5fa){for(var _0x2cc695=0x0,_0x4a501c=events[_0x07e6('0x5')];_0x2cc695<_0x4a501c;_0x2cc695++){var _0x22b1cf=events[_0x2cc695];var _0x13cd46=createListener(_0x07e6('0x6')+_0x22b1cf,_0x92e5fa);NotificationEvents['on'](_0x22b1cf,_0x13cd46);}}; \ No newline at end of file +var _0x2077=['notification:','./notification.events','save','emit','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2077,0x104));var _0x7207=function(_0x791bc4,_0x2caca3){_0x791bc4=_0x791bc4-0x0;var _0x430175=_0x2077[_0x791bc4];return _0x430175;};'use strict';var NotificationEvents=require(_0x7207('0x0'));var events=[_0x7207('0x1'),'remove','update'];function createListener(_0x161949,_0x2d5b60){return function(_0x57882b){_0x2d5b60[_0x7207('0x2')](_0x161949,_0x57882b);};}function removeListener(_0x4e910c,_0x7d2199){return function(){NotificationEvents[_0x7207('0x3')](_0x4e910c,_0x7d2199);};}exports[_0x7207('0x4')]=function(_0x16d1f8){for(var _0x35f72e=0x0,_0x4d1370=events[_0x7207('0x5')];_0x35f72e<_0x4d1370;_0x35f72e++){var _0x22c8dd=events[_0x35f72e];var _0x94aa51=createListener(_0x7207('0x6')+_0x22c8dd,_0x16d1f8);NotificationEvents['on'](_0x22c8dd,_0x94aa51);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index cec783f..3694fa2 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 _0xad29=['express','Router','../../config/environment','get','isAuthenticated','/describe','describe','/:id','getDispositions','/:id/canned_answers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update','delete','/:id/dispositions','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x1bc9b8,_0x379fc7){var _0x1a9a13=function(_0x3a73ea){while(--_0x3a73ea){_0x1bc9b8['push'](_0x1bc9b8['shift']());}};_0x1a9a13(++_0x379fc7);}(_0xad29,0xf1));var _0x9ad2=function(_0xd5fd5c,_0x3e2a66){_0xd5fd5c=_0xd5fd5c-0x0;var _0x3b0663=_0xad29[_0xd5fd5c];return _0x3b0663;};'use strict';var multer=require(_0x9ad2('0x0'));var util=require(_0x9ad2('0x1'));var path=require(_0x9ad2('0x2'));var timeout=require(_0x9ad2('0x3'));var express=require(_0x9ad2('0x4'));var router=express[_0x9ad2('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9ad2('0x6'));var controller=require('./openchannelAccount.controller');router[_0x9ad2('0x7')]('/',auth[_0x9ad2('0x8')](),controller['index']);router['get'](_0x9ad2('0x9'),auth[_0x9ad2('0x8')](),controller[_0x9ad2('0xa')]);router[_0x9ad2('0x7')](_0x9ad2('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x9ad2('0x7')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x9ad2('0xc')]);router[_0x9ad2('0x7')](_0x9ad2('0xd'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x9ad2('0x7')]('/:id/applications',auth[_0x9ad2('0x8')](),controller[_0x9ad2('0xe')]);router[_0x9ad2('0x7')](_0x9ad2('0xf'),auth[_0x9ad2('0x8')](),controller[_0x9ad2('0x10')]);router['get'](_0x9ad2('0x11'),auth[_0x9ad2('0x8')](),controller[_0x9ad2('0x12')]);router[_0x9ad2('0x13')]('/',auth['isAuthenticated'](),controller[_0x9ad2('0x14')]);router['post']('/:id/dispositions',auth[_0x9ad2('0x8')](),controller[_0x9ad2('0x15')]);router[_0x9ad2('0x13')](_0x9ad2('0xd'),auth[_0x9ad2('0x8')](),controller[_0x9ad2('0x16')]);router[_0x9ad2('0x13')](_0x9ad2('0x17'),controller[_0x9ad2('0x18')]);router[_0x9ad2('0x13')]('/:id/applications',auth[_0x9ad2('0x8')](),controller[_0x9ad2('0x19')]);router[_0x9ad2('0x13')](_0x9ad2('0x11'),auth[_0x9ad2('0x8')](),controller[_0x9ad2('0x1a')]);router[_0x9ad2('0x13')](_0x9ad2('0x1b'),auth[_0x9ad2('0x8')](),controller[_0x9ad2('0x1c')]);router[_0x9ad2('0x1d')](_0x9ad2('0xb'),auth[_0x9ad2('0x8')](),controller[_0x9ad2('0x1e')]);router[_0x9ad2('0x1f')]('/:id',auth[_0x9ad2('0x8')](),controller['destroy']);router[_0x9ad2('0x1f')](_0x9ad2('0x20'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x9ad2('0x1f')](_0x9ad2('0xd'),auth['isAuthenticated'](),controller['removeAnswers']);router['delete'](_0x9ad2('0x11'),auth['isAuthenticated'](),controller[_0x9ad2('0x21')]);module[_0x9ad2('0x22')]=router; \ No newline at end of file +var _0xd61b=['get','isAuthenticated','index','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','/:id/notify','/:id/send','put','delete','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller'];(function(_0x11b942,_0x2fda67){var _0x2d2560=function(_0x8a93ce){while(--_0x8a93ce){_0x11b942['push'](_0x11b942['shift']());}};_0x2d2560(++_0x2fda67);}(_0xd61b,0xbd));var _0xbd61=function(_0x3f9819,_0x4c2e0b){_0x3f9819=_0x3f9819-0x0;var _0x2700c2=_0xd61b[_0x3f9819];return _0x2700c2;};'use strict';var multer=require(_0xbd61('0x0'));var util=require(_0xbd61('0x1'));var path=require('path');var timeout=require(_0xbd61('0x2'));var express=require(_0xbd61('0x3'));var router=express[_0xbd61('0x4')]();var auth=require(_0xbd61('0x5'));var interaction=require(_0xbd61('0x6'));var config=require(_0xbd61('0x7'));var controller=require(_0xbd61('0x8'));router[_0xbd61('0x9')]('/',auth[_0xbd61('0xa')](),controller[_0xbd61('0xb')]);router[_0xbd61('0x9')]('/describe',auth[_0xbd61('0xa')](),controller[_0xbd61('0xc')]);router['get'](_0xbd61('0xd'),auth['isAuthenticated'](),controller[_0xbd61('0xe')]);router[_0xbd61('0x9')]('/:id/dispositions',auth[_0xbd61('0xa')](),controller[_0xbd61('0xf')]);router[_0xbd61('0x9')](_0xbd61('0x10'),auth[_0xbd61('0xa')](),controller[_0xbd61('0x11')]);router[_0xbd61('0x9')](_0xbd61('0x12'),auth[_0xbd61('0xa')](),controller[_0xbd61('0x13')]);router[_0xbd61('0x9')]('/:id/interactions',auth['isAuthenticated'](),controller['getInteractions']);router[_0xbd61('0x9')](_0xbd61('0x14'),auth['isAuthenticated'](),controller[_0xbd61('0x15')]);router[_0xbd61('0x16')]('/',auth[_0xbd61('0xa')](),controller['create']);router[_0xbd61('0x16')](_0xbd61('0x17'),auth[_0xbd61('0xa')](),controller[_0xbd61('0x18')]);router[_0xbd61('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xbd61('0x19')]);router[_0xbd61('0x16')](_0xbd61('0x1a'),controller['notify']);router[_0xbd61('0x16')](_0xbd61('0x12'),auth['isAuthenticated'](),controller['addApplications']);router[_0xbd61('0x16')](_0xbd61('0x14'),auth[_0xbd61('0xa')](),controller['addAgents']);router['post'](_0xbd61('0x1b'),auth[_0xbd61('0xa')](),controller['send']);router[_0xbd61('0x1c')](_0xbd61('0xd'),auth[_0xbd61('0xa')](),controller['update']);router[_0xbd61('0x1d')](_0xbd61('0xd'),auth[_0xbd61('0xa')](),controller['destroy']);router['delete'](_0xbd61('0x17'),auth[_0xbd61('0xa')](),controller['removeDispositions']);router[_0xbd61('0x1d')](_0xbd61('0x10'),auth[_0xbd61('0xa')](),controller[_0xbd61('0x1e')]);router[_0xbd61('0x1d')](_0xbd61('0x14'),auth[_0xbd61('0xa')](),controller[_0xbd61('0x1f')]);module[_0xbd61('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index f1c5d5a..0d3b774 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 _0xe24c=['name','STRING','generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','sequelize','randomstring','exports'];(function(_0x5eb868,_0x3edfb0){var _0x278458=function(_0x266273){while(--_0x266273){_0x5eb868['push'](_0x5eb868['shift']());}};_0x278458(++_0x3edfb0);}(_0xe24c,0xad));var _0xce24=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xe24c[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0xce24('0x0'));var rs=require(_0xce24('0x1'));module[_0xce24('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xce24('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xce24('0x4')]},'token':{'type':Sequelize[_0xce24('0x4')],'defaultValue':function(){return rs[_0xce24('0x5')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xce24('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xce24('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xce24('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xce24('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xce24('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xce24('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xce24('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xce24('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xce24('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x213801){if(!_0x213801)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0xce24('0xa'),_0x213801);}}}; \ No newline at end of file +var _0x173e=['mandatoryDisposition','randomstring','exports','STRING','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x12249f,_0x1e5fb3){var _0x3e2803=function(_0x387d65){while(--_0x387d65){_0x12249f['push'](_0x12249f['shift']());}};_0x3e2803(++_0x1e5fb3);}(_0x173e,0xcd));var _0xe173=function(_0x5be705,_0x9c4da1){_0x5be705=_0x5be705-0x0;var _0x10865f=_0x173e[_0x5be705];return _0x10865f;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xe173('0x0'));module[_0xe173('0x1')]={'name':{'type':Sequelize[_0xe173('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xe173('0x2')]},'token':{'type':Sequelize[_0xe173('0x2')],'defaultValue':function(){return rs[_0xe173('0x3')]();}},'replyUri':{'type':Sequelize[_0xe173('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xe173('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xe173('0x4');}},'notificationSound':{'type':Sequelize[_0xe173('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe173('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe173('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xe173('0x2')]},'queueTransfer':{'type':Sequelize[_0xe173('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe173('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe173('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe173('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xe173('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xe173('0x5')],'defaultValue':![],'comment':_0xe173('0x8'),'set':function(_0x25ec2b){if(!_0x25ec2b)this[_0xe173('0x9')](_0xe173('0xa'),null);this[_0xe173('0x9')](_0xe173('0xb'),_0x25ec2b);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index aef94a6..cba4481 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 _0x6841=['isArray','userOpenchannelAccount:remove','getAgents','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','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','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','destroy','OpenchannelAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','user','get','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','getDispositions','findOne','pick','removeDispositions','ids','addAnswer','OpenchannelAccountId','CannedAnswer','removeAnswers','notify','openchannel','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','updatedAt','Applications','account','applications','list','orderBy','asc','from','firstName','threadId','OpenchannelInteraction','externalUrl','spread','contact','lastName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','Start','startRouting','EventManager','sequelize','transaction','OpenchannelApplication','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Owner','fullname','Tag','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents'];(function(_0x560408,_0x45c914){var _0x3fd4da=function(_0x47e9a9){while(--_0x47e9a9){_0x560408['push'](_0x560408['shift']());}};_0x3fd4da(++_0x45c914);}(_0x6841,0xc6));var _0x1684=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x6841[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require(_0x1684('0x0'));var emlformat=require(_0x1684('0x1'));var rimraf=require(_0x1684('0x2'));var zipdir=require(_0x1684('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1684('0x4'));var moment=require(_0x1684('0x5'));var BPromise=require(_0x1684('0x6'));var Mustache=require(_0x1684('0x7'));var util=require(_0x1684('0x8'));var path=require(_0x1684('0x9'));var sox=require('sox');var csv=require(_0x1684('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1684('0xb'));var squel=require(_0x1684('0xc'));var crypto=require('crypto');var jsforce=require(_0x1684('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1684('0xa'));var querystring=require('querystring');var Papa=require(_0x1684('0xe'));var Redis=require(_0x1684('0xf'));var authService=require(_0x1684('0x10'));var qs=require(_0x1684('0x11'));var as=require(_0x1684('0x12'));var hardwareService=require(_0x1684('0x13'));var logger=require(_0x1684('0x14'))(_0x1684('0x15'));var utils=require(_0x1684('0x16'));var config=require(_0x1684('0x17'));var licenseUtil=require(_0x1684('0x18'));var db=require(_0x1684('0x19'))['db'];config[_0x1684('0x1a')]=_['defaults'](config[_0x1684('0x1a')],{'host':_0x1684('0x1b'),'port':0x18eb});var socket=require(_0x1684('0x1c'))(new Redis(config[_0x1684('0x1a')]));require(_0x1684('0x1d'))[_0x1684('0x1e')](socket);var jayson=require(_0x1684('0x1f'));var client=jayson[_0x1684('0x20')][_0x1684('0x21')]({'port':0x232c});var client9002=jayson[_0x1684('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d2d8e,_0x4bf5a7,_0x1f08c7,_0x207a94){return new BPromise(function(_0x114d9c,_0x47ecd2){var _0x40a012=_0x207a94||client;return _0x40a012[_0x1684('0x22')](_0x3d2d8e,_0x1f08c7)[_0x1684('0x23')](function(_0xa58e46){logger[_0x1684('0x24')](_0x1684('0x25'),_0x4bf5a7,_0x1684('0x26'));logger[_0x1684('0x27')](_0x1684('0x28'),_0x4bf5a7,_0x1684('0x26'),JSON[_0x1684('0x29')](_0xa58e46));if(_0xa58e46[_0x1684('0x2a')]){if(_0xa58e46[_0x1684('0x2a')]['code']===0x1f4){logger[_0x1684('0x2a')]('OpenchannelAccount,\x20%s,\x20%s',_0x4bf5a7,_0xa58e46['error'][_0x1684('0x2b')]);return _0x47ecd2(_0xa58e46[_0x1684('0x2a')]['message']);}logger[_0x1684('0x2a')](_0x1684('0x25'),_0x4bf5a7,_0xa58e46[_0x1684('0x2a')][_0x1684('0x2b')]);return _0x114d9c(_0xa58e46[_0x1684('0x2a')][_0x1684('0x2b')]);}else{logger['info'](_0x1684('0x25'),_0x4bf5a7,_0x1684('0x26'));_0x114d9c(_0xa58e46[_0x1684('0x2c')][_0x1684('0x2b')]);}})[_0x1684('0x2d')](function(_0x2f47c4){logger[_0x1684('0x2a')](_0x1684('0x25'),_0x4bf5a7,_0x2f47c4);_0x47ecd2(_0x2f47c4);});});}function respondWithStatusCode(_0xeccb17,_0x4e6d05){_0x4e6d05=_0x4e6d05||0xcc;return function(_0x1bcf11){if(_0x1bcf11){return _0xeccb17[_0x1684('0x2e')](_0x4e6d05);}return _0xeccb17[_0x1684('0x2f')](_0x4e6d05)[_0x1684('0x30')]();};}function respondWithResult(_0x4c7435,_0x347f36){_0x347f36=_0x347f36||0xc8;return function(_0x3a455a){if(_0x3a455a){return _0x4c7435[_0x1684('0x2f')](_0x347f36)['json'](_0x3a455a);}};}function respondWithFilteredResult(_0x3d3631,_0x3d511d){return function(_0x6f3b5b){if(_0x6f3b5b){var _0x3f2950=_0x6f3b5b[_0x1684('0x31')],_0x1ced91=_0x3d511d[_0x1684('0x32')],_0x14ad0a=_0x3d511d[_0x1684('0x32')]+_0x3d511d[_0x1684('0x33')],_0x37e592;if(_0x14ad0a>=_0x3f2950){_0x14ad0a=_0x3f2950;_0x37e592=0xc8;}else{_0x37e592=0xce;}_0x3d3631['status'](_0x37e592);return _0x3d3631[_0x1684('0x34')]('Content-Range',_0x1ced91+'-'+_0x14ad0a+'/'+_0x3f2950)[_0x1684('0x35')](_0x6f3b5b);}return null;};}function patchUpdates(_0x2f30b7){return function(_0x3ec84f){try{jsonpatch[_0x1684('0x36')](_0x3ec84f,_0x2f30b7,!![]);}catch(_0x5b7be1){return BPromise[_0x1684('0x37')](_0x5b7be1);}return _0x3ec84f[_0x1684('0x38')]();};}function saveUpdates(_0x2a2853,_0xaff76){return function(_0x406baa){if(_0x406baa){return _0x406baa[_0x1684('0x39')](_0x2a2853)[_0x1684('0x23')](function(_0x49b9ac){return _0x49b9ac;});}return null;};}function removeEntity(_0x1ec5cc,_0x5cdc6e){return function(_0x925eb1){if(_0x925eb1){return _0x925eb1[_0x1684('0x3a')]()['then'](function(){var _0x592180=_0x925eb1['get']({'plain':!![]});var _0x97bc12=_0x1684('0x3b');return db['UserProfileResource'][_0x1684('0x3a')]({'where':{'type':_0x97bc12,'resourceId':_0x592180['id']}})[_0x1684('0x23')](function(){return _0x925eb1;});})['then'](function(){_0x1ec5cc[_0x1684('0x2f')](0xcc)[_0x1684('0x30')]();});}};}function handleEntityNotFound(_0x1f9a31,_0x170fa2){return function(_0x84af15){if(!_0x84af15){_0x1f9a31[_0x1684('0x2e')](0x194);}return _0x84af15;};}function handleError(_0x83df73,_0x210f30){_0x210f30=_0x210f30||0x1f4;return function(_0x3cda34){logger['error'](_0x3cda34[_0x1684('0x3c')]);if(_0x3cda34[_0x1684('0x3d')]){delete _0x3cda34[_0x1684('0x3d')];}_0x83df73[_0x1684('0x2f')](_0x210f30)[_0x1684('0x3e')](_0x3cda34);};}exports[_0x1684('0x3f')]=function(_0x15c447,_0x24917b){var _0x477eb9={'include':[{'model':db[_0x1684('0x40')],'as':_0x1684('0x41')}]},_0x6f8397={},_0x43239b={'count':0x0,'rows':[]};var _0x19bb0c=_['map'](db[_0x1684('0x42')][_0x1684('0x43')],function(_0x2b40a2){return{'name':_0x2b40a2[_0x1684('0x44')],'type':_0x2b40a2[_0x1684('0x45')][_0x1684('0x46')]};});_0x6f8397[_0x1684('0x47')]=_[_0x1684('0x48')](_0x19bb0c,'name');_0x6f8397['query']=_[_0x1684('0x49')](_0x15c447[_0x1684('0x4a')]);_0x6f8397[_0x1684('0x4b')]=_[_0x1684('0x4c')](_0x6f8397['model'],_0x6f8397[_0x1684('0x4a')]);_0x477eb9[_0x1684('0x4d')]=_['intersection'](_0x6f8397['model'],qs[_0x1684('0x4e')](_0x15c447[_0x1684('0x4a')][_0x1684('0x4e')]));_0x477eb9[_0x1684('0x4d')]=_0x477eb9[_0x1684('0x4d')][_0x1684('0x4f')]?_0x477eb9['attributes']:_0x6f8397[_0x1684('0x47')];if(!_0x15c447['query'][_0x1684('0x50')](_0x1684('0x51'))){_0x477eb9[_0x1684('0x33')]=qs[_0x1684('0x33')](_0x15c447[_0x1684('0x4a')]['limit']);_0x477eb9[_0x1684('0x32')]=qs['offset'](_0x15c447['query'][_0x1684('0x32')]);}_0x477eb9[_0x1684('0x52')]=qs[_0x1684('0x53')](_0x15c447[_0x1684('0x4a')][_0x1684('0x53')]);_0x477eb9[_0x1684('0x54')]=qs['filters'](_['pick'](_0x15c447['query'],_0x6f8397[_0x1684('0x4b')]),_0x19bb0c);if(_0x15c447['query'][_0x1684('0x55')]){_0x477eb9[_0x1684('0x54')]=_[_0x1684('0x56')](_0x477eb9[_0x1684('0x54')],{'$or':_[_0x1684('0x48')](_0x19bb0c,function(_0x577ec6){if(_0x577ec6[_0x1684('0x45')]!==_0x1684('0x57')){var _0x4d2def={};_0x4d2def[_0x577ec6[_0x1684('0x3d')]]={'$like':'%'+_0x15c447['query']['filter']+'%'};return _0x4d2def;}})});}_0x477eb9=_[_0x1684('0x56')]({},_0x477eb9,_0x15c447['options']);var _0x4c1a07={'where':_0x477eb9[_0x1684('0x54')]};return db[_0x1684('0x42')]['count'](_0x4c1a07)[_0x1684('0x23')](function(_0x3e5178){_0x43239b[_0x1684('0x31')]=_0x3e5178;if(_0x15c447['query'][_0x1684('0x58')]){_0x477eb9[_0x1684('0x59')]=[{'all':!![]}];}return db[_0x1684('0x42')][_0x1684('0x5a')](_0x477eb9);})[_0x1684('0x23')](function(_0xc18011){_0x43239b[_0x1684('0x5b')]=_0xc18011;return _0x43239b;})[_0x1684('0x23')](respondWithFilteredResult(_0x24917b,_0x477eb9))['catch'](handleError(_0x24917b,null));};exports[_0x1684('0x5c')]=function(_0x383478,_0x5a8331){var _0x331052={'raw':![],'where':{'id':_0x383478[_0x1684('0x5d')]['id']},'include':[{'model':db[_0x1684('0x40')],'as':'mandatoryDispositionPause'}]},_0x595ebe={};_0x595ebe[_0x1684('0x47')]=_['keys'](db[_0x1684('0x42')][_0x1684('0x43')]);_0x595ebe['query']=_[_0x1684('0x49')](_0x383478[_0x1684('0x4a')]);_0x595ebe[_0x1684('0x4b')]=_[_0x1684('0x4c')](_0x595ebe['model'],_0x595ebe[_0x1684('0x4a')]);_0x331052[_0x1684('0x4d')]=_[_0x1684('0x4c')](_0x595ebe['model'],qs[_0x1684('0x4e')](_0x383478['query'][_0x1684('0x4e')]));_0x331052[_0x1684('0x4d')]=_0x331052[_0x1684('0x4d')][_0x1684('0x4f')]?_0x331052['attributes']:_0x595ebe['model'];if(_0x383478[_0x1684('0x4a')][_0x1684('0x58')]){_0x331052['include']=[{'all':!![]}];}_0x331052=_[_0x1684('0x56')]({},_0x331052,_0x383478[_0x1684('0x5e')]);return db[_0x1684('0x42')][_0x1684('0x5f')](_0x331052)[_0x1684('0x23')](handleEntityNotFound(_0x5a8331,null))[_0x1684('0x23')](respondWithResult(_0x5a8331,null))['catch'](handleError(_0x5a8331,null));};exports[_0x1684('0x60')]=function(_0x4a961a,_0x2d65bb){return db[_0x1684('0x42')][_0x1684('0x60')](_0x4a961a['body'],{})[_0x1684('0x23')](function(_0x1c3cd3){var _0x489e20=_0x4a961a[_0x1684('0x61')][_0x1684('0x62')]({'plain':!![]});if(!_0x489e20)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x489e20[_0x1684('0x63')]===_0x1684('0x61')){var _0x4365d6=_0x1c3cd3[_0x1684('0x62')]({'plain':!![]});var _0x31eadc=_0x1684('0x3b');return db[_0x1684('0x64')]['find']({'where':{'name':_0x31eadc,'userProfileId':_0x489e20['userProfileId']},'raw':!![]})[_0x1684('0x23')](function(_0x462e49){if(_0x462e49&&_0x462e49[_0x1684('0x65')]===0x0){return db[_0x1684('0x66')][_0x1684('0x60')]({'name':_0x4365d6['name'],'resourceId':_0x4365d6['id'],'type':_0x462e49[_0x1684('0x3d')],'sectionId':_0x462e49['id']},{})[_0x1684('0x23')](function(){return _0x1c3cd3;});}else{return _0x1c3cd3;}})[_0x1684('0x2d')](function(_0x43ee25){logger['error'](_0x1684('0x67'),_0x43ee25);throw _0x43ee25;});}return _0x1c3cd3;})[_0x1684('0x23')](respondWithResult(_0x2d65bb,0xc9))[_0x1684('0x2d')](handleError(_0x2d65bb,null));};exports[_0x1684('0x39')]=function(_0x1e40a6,_0x3e0658){if(_0x1e40a6['body']['id']){delete _0x1e40a6['body']['id'];}return db[_0x1684('0x42')]['find']({'where':{'id':_0x1e40a6['params']['id']},'include':[{'model':db[_0x1684('0x40')],'as':'mandatoryDispositionPause'}]})[_0x1684('0x23')](handleEntityNotFound(_0x3e0658,null))[_0x1684('0x23')](saveUpdates(_0x1e40a6[_0x1684('0x68')],null))[_0x1684('0x23')](respondWithResult(_0x3e0658,null))[_0x1684('0x2d')](handleError(_0x3e0658,null));};exports[_0x1684('0x3a')]=function(_0x3e6cac,_0x320654){return db[_0x1684('0x42')][_0x1684('0x5f')]({'where':{'id':_0x3e6cac[_0x1684('0x5d')]['id']}})['then'](handleEntityNotFound(_0x320654,null))['then'](removeEntity(_0x320654,null))[_0x1684('0x2d')](handleError(_0x320654,null));};exports['describe']=function(_0x24cd7e,_0x31b5b8){return db[_0x1684('0x42')][_0x1684('0x69')]()[_0x1684('0x23')](respondWithResult(_0x31b5b8,null))['catch'](handleError(_0x31b5b8,null));};exports[_0x1684('0x6a')]=function(_0x12ac8d,_0x511c92,_0x31be9c){if(_0x12ac8d[_0x1684('0x68')]['id']){delete _0x12ac8d[_0x1684('0x68')]['id'];}return db[_0x1684('0x42')][_0x1684('0x5f')]({'where':{'id':_0x12ac8d[_0x1684('0x5d')]['id']}})['then'](handleEntityNotFound(_0x511c92,null))[_0x1684('0x23')](function(_0xdee80c){if(_0xdee80c){_0x12ac8d[_0x1684('0x68')]['OpenchannelAccountId']=_0xdee80c['id'];return db[_0x1684('0x6b')][_0x1684('0x60')](_0x12ac8d[_0x1684('0x68')]);}})[_0x1684('0x23')](respondWithResult(_0x511c92,null))[_0x1684('0x2d')](handleError(_0x511c92,null));};exports[_0x1684('0x6c')]=function(_0x553276,_0x11a751,_0x45a92c){var _0x4a1071={'raw':![],'where':{}};var _0x39206b={};var _0x537b12={'count':0x0,'rows':[]};return db[_0x1684('0x42')][_0x1684('0x6d')]({'where':{'id':_0x553276['params']['id']}})[_0x1684('0x23')](handleEntityNotFound(_0x11a751,null))[_0x1684('0x23')](function(_0x2ee7a1){if(_0x2ee7a1){_0x39206b[_0x1684('0x47')]=_['keys'](db['Disposition']['rawAttributes']);_0x39206b[_0x1684('0x4a')]=_[_0x1684('0x49')](_0x553276[_0x1684('0x4a')]);_0x39206b['filters']=_[_0x1684('0x4c')](_0x39206b['model'],_0x39206b[_0x1684('0x4a')]);_0x4a1071[_0x1684('0x4d')]=_['intersection'](_0x39206b[_0x1684('0x47')],qs[_0x1684('0x4e')](_0x553276[_0x1684('0x4a')][_0x1684('0x4e')]));_0x4a1071[_0x1684('0x4d')]=_0x4a1071['attributes'][_0x1684('0x4f')]?_0x4a1071['attributes']:_0x39206b['model'];if(!_0x553276['query'][_0x1684('0x50')](_0x1684('0x51'))){_0x4a1071[_0x1684('0x33')]=qs[_0x1684('0x33')](_0x553276[_0x1684('0x4a')][_0x1684('0x33')]);_0x4a1071['offset']=qs[_0x1684('0x32')](_0x553276[_0x1684('0x4a')][_0x1684('0x32')]);}_0x4a1071['order']=qs[_0x1684('0x53')](_0x553276[_0x1684('0x4a')][_0x1684('0x53')]);_0x4a1071[_0x1684('0x54')]=qs[_0x1684('0x4b')](_[_0x1684('0x6e')](_0x553276[_0x1684('0x4a')],_0x39206b['filters']));_0x4a1071[_0x1684('0x54')]['OpenchannelAccountId']=_0x2ee7a1['id'];if(_0x553276[_0x1684('0x4a')]['filter']){_0x4a1071[_0x1684('0x54')]=_[_0x1684('0x56')](_0x4a1071[_0x1684('0x54')],{'$or':_['map'](_0x4a1071[_0x1684('0x4d')],function(_0x469219){var _0x53361a={};_0x53361a[_0x469219]={'$like':'%'+_0x553276[_0x1684('0x4a')][_0x1684('0x55')]+'%'};return _0x53361a;})});}_0x4a1071=_[_0x1684('0x56')]({},_0x4a1071,_0x553276[_0x1684('0x5e')]);return db[_0x1684('0x6b')][_0x1684('0x31')]({'where':_0x4a1071[_0x1684('0x54')]})[_0x1684('0x23')](function(_0x23dc17){_0x537b12[_0x1684('0x31')]=_0x23dc17;if(_0x553276[_0x1684('0x4a')][_0x1684('0x58')]){_0x4a1071[_0x1684('0x59')]=[{'all':!![]}];}return db[_0x1684('0x6b')][_0x1684('0x5a')](_0x4a1071);})[_0x1684('0x23')](function(_0x551dde){_0x537b12[_0x1684('0x5b')]=_0x551dde;return _0x537b12;});}})[_0x1684('0x23')](respondWithFilteredResult(_0x11a751,_0x4a1071))[_0x1684('0x2d')](handleError(_0x11a751,null));};exports[_0x1684('0x6f')]=function(_0xb591a9,_0xd2d32f,_0x15e021){return db['OpenchannelAccount'][_0x1684('0x5f')]({'where':{'id':_0xb591a9[_0x1684('0x5d')]['id']}})['then'](handleEntityNotFound(_0xd2d32f,null))[_0x1684('0x23')](function(_0x3de41b){if(_0x3de41b){return _0x3de41b['removeDispositions'](_0xb591a9[_0x1684('0x4a')][_0x1684('0x70')]);}})[_0x1684('0x23')](respondWithStatusCode(_0xd2d32f,null))['catch'](handleError(_0xd2d32f,null));};exports[_0x1684('0x71')]=function(_0x4e0308,_0x4907f3,_0x422db2){if(_0x4e0308['body']['id']){delete _0x4e0308[_0x1684('0x68')]['id'];}return db[_0x1684('0x42')][_0x1684('0x5f')]({'where':{'id':_0x4e0308[_0x1684('0x5d')]['id']}})[_0x1684('0x23')](handleEntityNotFound(_0x4907f3,null))[_0x1684('0x23')](function(_0x2cb9e7){if(_0x2cb9e7){_0x4e0308[_0x1684('0x68')][_0x1684('0x72')]=_0x2cb9e7['id'];return db[_0x1684('0x73')][_0x1684('0x60')](_0x4e0308[_0x1684('0x68')]);}})[_0x1684('0x23')](respondWithResult(_0x4907f3,null))['catch'](handleError(_0x4907f3,null));};exports['getAnswers']=function(_0xf06d1a,_0x1a8b84,_0x3a5867){var _0x295b6e={'raw':![],'where':{}};var _0x20587a={};var _0x43a312={'count':0x0,'rows':[]};return db[_0x1684('0x42')][_0x1684('0x6d')]({'where':{'id':_0xf06d1a[_0x1684('0x5d')]['id']}})[_0x1684('0x23')](handleEntityNotFound(_0x1a8b84,null))[_0x1684('0x23')](function(_0x44ac48){if(_0x44ac48){_0x20587a['model']=_[_0x1684('0x49')](db[_0x1684('0x73')]['rawAttributes']);_0x20587a[_0x1684('0x4a')]=_[_0x1684('0x49')](_0xf06d1a[_0x1684('0x4a')]);_0x20587a[_0x1684('0x4b')]=_['intersection'](_0x20587a['model'],_0x20587a['query']);_0x295b6e[_0x1684('0x4d')]=_[_0x1684('0x4c')](_0x20587a[_0x1684('0x47')],qs[_0x1684('0x4e')](_0xf06d1a[_0x1684('0x4a')]['fields']));_0x295b6e[_0x1684('0x4d')]=_0x295b6e[_0x1684('0x4d')][_0x1684('0x4f')]?_0x295b6e[_0x1684('0x4d')]:_0x20587a[_0x1684('0x47')];if(!_0xf06d1a[_0x1684('0x4a')][_0x1684('0x50')]('nolimit')){_0x295b6e[_0x1684('0x33')]=qs['limit'](_0xf06d1a[_0x1684('0x4a')]['limit']);_0x295b6e['offset']=qs['offset'](_0xf06d1a['query']['offset']);}_0x295b6e[_0x1684('0x52')]=qs['sort'](_0xf06d1a['query'][_0x1684('0x53')]);_0x295b6e[_0x1684('0x54')]=qs[_0x1684('0x4b')](_[_0x1684('0x6e')](_0xf06d1a['query'],_0x20587a['filters']));_0x295b6e[_0x1684('0x54')][_0x1684('0x72')]=_0x44ac48['id'];if(_0xf06d1a[_0x1684('0x4a')][_0x1684('0x55')]){_0x295b6e['where']=_[_0x1684('0x56')](_0x295b6e[_0x1684('0x54')],{'$or':_[_0x1684('0x48')](_0x295b6e['attributes'],function(_0x1f070e){var _0x55f122={};_0x55f122[_0x1f070e]={'$like':'%'+_0xf06d1a['query'][_0x1684('0x55')]+'%'};return _0x55f122;})});}_0x295b6e=_['merge']({},_0x295b6e,_0xf06d1a[_0x1684('0x5e')]);return db['CannedAnswer'][_0x1684('0x31')]({'where':_0x295b6e['where']})['then'](function(_0x449449){_0x43a312[_0x1684('0x31')]=_0x449449;if(_0xf06d1a[_0x1684('0x4a')][_0x1684('0x58')]){_0x295b6e[_0x1684('0x59')]=[{'all':!![]}];}return db[_0x1684('0x73')][_0x1684('0x5a')](_0x295b6e);})[_0x1684('0x23')](function(_0xe48e4b){_0x43a312[_0x1684('0x5b')]=_0xe48e4b;return _0x43a312;});}})[_0x1684('0x23')](respondWithFilteredResult(_0x1a8b84,_0x295b6e))[_0x1684('0x2d')](handleError(_0x1a8b84,null));};exports[_0x1684('0x74')]=function(_0x2570c9,_0x3f020b,_0x1a90d3){return db[_0x1684('0x42')]['find']({'where':{'id':_0x2570c9[_0x1684('0x5d')]['id']}})[_0x1684('0x23')](handleEntityNotFound(_0x3f020b,null))[_0x1684('0x23')](function(_0x1b9a49){if(_0x1b9a49){return _0x1b9a49[_0x1684('0x74')](_0x2570c9['query'][_0x1684('0x70')]);}})[_0x1684('0x23')](respondWithStatusCode(_0x3f020b,null))[_0x1684('0x2d')](handleError(_0x3f020b,null));};exports[_0x1684('0x75')]=function(_0x6d6304,_0x46e538,_0x336a4b){var _0xdebd7b={'body':_0x6d6304['body'],'channel':_0x1684('0x76')};var _0x485ebb=[];var _0xf83ebd=[];var _0x167d45={};var _0x3f79d4=![];return db[_0x1684('0x77')]['describe']()['then'](function(_0x47ca6a){if(!_0x47ca6a){throw new db['Sequelize'][(_0x1684('0x78'))](_0x1684('0x79'));}_0x485ebb=_[_0x1684('0x7a')](_[_0x1684('0x49')](_0x47ca6a),[_0x1684('0x7b'),'updatedAt']);_0xf83ebd=_['difference'](_[_0x1684('0x49')](_0x47ca6a),['createdAt','updatedAt',_0x1684('0x7c'),_0x1684('0x7d')]);if(_0x6d6304['body']['id']){delete _0x6d6304['body']['id'];}if(_[_0x1684('0x7e')](_0x6d6304[_0x1684('0x68')]['from'])){throw new db[(_0x1684('0x7f'))][(_0x1684('0x78'))](_0x1684('0x80'));}if(_[_0x1684('0x7e')](_0x6d6304[_0x1684('0x68')][_0x1684('0x68')])||_0x6d6304[_0x1684('0x68')]['body']===''){throw new db[(_0x1684('0x7f'))][(_0x1684('0x78'))](_0x1684('0x81'));}if(_[_0x1684('0x7e')](_0x6d6304[_0x1684('0x68')][_0x1684('0x82')])){throw new db[(_0x1684('0x7f'))][(_0x1684('0x78'))](_0x1684('0x83')+_0xf83ebd);}if(!_[_0x1684('0x84')](_0xf83ebd,_0x6d6304['body'][_0x1684('0x82')])){throw new db['Sequelize'][(_0x1684('0x78'))](_0x1684('0x85')+_0xf83ebd);}_0x167d45[_0x6d6304['body'][_0x1684('0x82')]]=_0x6d6304[_0x1684('0x68')]['from'];})[_0x1684('0x23')](function(){return db['OpenchannelAccount'][_0x1684('0x5f')]({'where':{'id':_0x6d6304[_0x1684('0x5d')]['id']},'include':[{'model':db[_0x1684('0x86')],'as':_0x1684('0x87'),'include':[{'model':db[_0x1684('0x77')],'as':_0x1684('0x88'),'where':_0x167d45,'limit':0x1,'order':[[_0x1684('0x89'),'DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0x1684('0x8a')}]});})[_0x1684('0x23')](handleEntityNotFound(_0x46e538,null))['then'](function(_0x1bdc7c){if(_0x1bdc7c&&_0x1bdc7c['List']){_0xdebd7b[_0x1684('0x8b')]=_0x1bdc7c;_0xdebd7b[_0x1684('0x8c')]=_0x1bdc7c[_0x1684('0x8a')];_0xdebd7b[_0x1684('0x8d')]=_0x1bdc7c[_0x1684('0x87')];_0xdebd7b['applications']=_[_0x1684('0x8e')](_0xdebd7b['applications'],['priority'],[_0x1684('0x8f')]);if(_0xdebd7b[_0x1684('0x8b')]['Applications']){delete _0xdebd7b[_0x1684('0x8b')][_0x1684('0x8a')];}if(_0xdebd7b['account'][_0x1684('0x87')]&&_0xdebd7b[_0x1684('0x8b')][_0x1684('0x87')][_0x1684('0x88')][_0x1684('0x4f')]){return _0xdebd7b['account']['List']['Contacts'][0x0];}var _0x59cafd=_['defaults'](_0x6d6304[_0x1684('0x68')],{'firstName':_0x6d6304['body']['from'],'ListId':_0x1bdc7c[_0x1684('0x7d')]});_0x59cafd[_0x6d6304[_0x1684('0x68')][_0x1684('0x82')]]=_0x6d6304[_0x1684('0x68')][_0x1684('0x90')];return db[_0x1684('0x77')][_0x1684('0x60')](_0x59cafd,{'fields':_0x485ebb,'raw':!![]});}})['then'](handleEntityNotFound(_0x46e538,null))[_0x1684('0x23')](function(_0x11d44c){_0xdebd7b['contact']=_0x11d44c;if(_0x11d44c){var _0x32c129={'ContactId':_0x11d44c['id'],'OpenchannelAccountId':_0x6d6304[_0x1684('0x5d')]['id'],'from':(_0x11d44c[_0x1684('0x91')]||'')+'\x20'+(_0x11d44c['lastName']||'')};var _0x5a6944={'OpenchannelAccountId':_0x6d6304[_0x1684('0x5d')]['id'],'closed':![]};if(_0x6d6304[_0x1684('0x68')][_0x1684('0x92')]){_0x5a6944['threadId']=_0x6d6304[_0x1684('0x68')][_0x1684('0x92')];return db[_0x1684('0x93')][_0x1684('0x5f')]({'where':_0x5a6944})['then'](function(_0x18251e){if(_0x18251e){return[_0x18251e,![]];}_0x32c129[_0x1684('0x92')]=_0x6d6304[_0x1684('0x68')][_0x1684('0x92')];_0x32c129[_0x1684('0x94')]=_0x6d6304[_0x1684('0x68')][_0x1684('0x94')];return db['OpenchannelInteraction'][_0x1684('0x60')](_0x32c129)[_0x1684('0x23')](function(_0x3782e4){return[_0x3782e4,!![]];});});}else{_0x5a6944[_0x1684('0x92')]=null;}_0x5a6944['ContactId']=_0x11d44c['id'];return db[_0x1684('0x93')][_0x1684('0x5f')]({'where':_0x5a6944})[_0x1684('0x23')](function(_0x297826){if(_0x297826){return[_0x297826,![]];}return db[_0x1684('0x93')][_0x1684('0x60')](_0x32c129)[_0x1684('0x23')](function(_0x51a211){return[_0x51a211,!![]];});});}})[_0x1684('0x95')](function(_0x4d0e7a,_0x5a7016){if(_0x4d0e7a){_0x3f79d4=_0x5a7016;if(!_0x5a7016){var _0x1c7bbf={'from':(_0xdebd7b[_0x1684('0x96')][_0x1684('0x91')]||'')+'\x20'+(_0xdebd7b['contact'][_0x1684('0x97')]||'')};if(_0x6d6304[_0x1684('0x68')][_0x1684('0x92')]&&_0x6d6304[_0x1684('0x68')][_0x1684('0x98')]&&_0x6d6304[_0x1684('0x68')]['threadId']!=_0x6d6304[_0x1684('0x68')]['messageId']){_0x1c7bbf[_0x1684('0x92')]=_0x6d6304[_0x1684('0x68')][_0x1684('0x98')];}return _0x4d0e7a['update'](_0x1c7bbf);}else{return _0x4d0e7a;}}})[_0x1684('0x23')](function(_0x1c3071){_0xdebd7b['interaction']=_0x1c3071[_0x1684('0x62')]({'plain':!![]});_0xdebd7b[_0x1684('0x99')][_0x1684('0x9a')]=_0x3f79d4;if(_0xdebd7b[_0x1684('0x99')]['created']){if(_0xdebd7b[_0x1684('0x8b')][_0x1684('0x9b')]){_0xdebd7b['applications'][_0x1684('0x9c')]({'id':0x0,'priority':_0xdebd7b['applications'][_0x1684('0x4f')]+0x1,'app':_0x1684('0x9d'),'appdata':_0x1684('0x9e'),'interval':_0x1684('0x9f')});}}return db[_0x1684('0xa0')][_0x1684('0x60')]({'body':_0x6d6304['body'][_0x1684('0x68')],'OpenchannelAccountId':_0x6d6304[_0x1684('0x5d')]['id'],'OpenchannelInteractionId':_0x1c3071['id'],'direction':'in','ContactId':_0xdebd7b[_0x1684('0x96')]['id'],'AttachmentId':_0x6d6304[_0x1684('0x68')][_0x1684('0xa1')]});})[_0x1684('0x23')](function(_0x2b7b98){_0xdebd7b['message']=_0x2b7b98;if(_0xdebd7b[_0x1684('0x99')][_0x1684('0xa2')]){return db[_0x1684('0xa3')]['find']({'attributes':['id',_0x1684('0x3d')],'where':{'id':_0xdebd7b[_0x1684('0x99')][_0x1684('0xa2')]}})[_0x1684('0x23')](function(_0x3393cd){if(_0x3393cd){_0xdebd7b[_0x1684('0x8c')][_0x1684('0xa4')]({'id':0x0,'priority':0x0,'app':_0x1684('0xa5'),'appdata':_0x3393cd['name']+','+(_0xdebd7b['account']['waitForTheAssignedAgent']||0xa),'interval':_0x1684('0x9f')});_0xdebd7b[_0x1684('0xa6')]=![];}return respondWithRpcPromise(_0x1684('0xa7'),'startRouting',_0xdebd7b);});}return respondWithRpcPromise(_0x1684('0xa7'),_0x1684('0xa8'),_0xdebd7b);})[_0x1684('0x23')](function(_0x383de8){respondWithRpcPromise('EventManager',_0x1684('0xa9'),{'event':_0x1684('0x75'),'message':_0x383de8},client9002);return _0x383de8;})[_0x1684('0x23')](respondWithResult(_0x46e538,null))[_0x1684('0x2d')](handleError(_0x46e538,null));};exports['addApplications']=function(_0x3599ae,_0x269d7e,_0x20ccfe){return db['OpenchannelAccount'][_0x1684('0x6d')]({'where':{'id':_0x3599ae[_0x1684('0x5d')]['id']}})[_0x1684('0x23')](handleEntityNotFound(_0x269d7e,null))[_0x1684('0x23')](function(_0x320bbc){if(_0x320bbc){return db[_0x1684('0xaa')][_0x1684('0xab')](function(_0x4a813a){return db[_0x1684('0xac')]['destroy']({'where':{'OpenchannelAccountId':_0x3599ae[_0x1684('0x5d')]['id']},'transaction':_0x4a813a})[_0x1684('0x23')](function(_0x330801){var _0x4d8c43=_[_0x1684('0x48')](_0x3599ae['body'],function(_0x1140dc){_0x1140dc[_0x1684('0x72')]=_0x3599ae['params']['id'];return _0x1140dc;});return db[_0x1684('0xac')][_0x1684('0xad')](_0x4d8c43,{'transaction':_0x4a813a});});})['then'](function(){return db['OpenchannelApplication'][_0x1684('0xae')]({'where':{'OpenchannelAccountId':_0x3599ae[_0x1684('0x5d')]['id']},'order':_0x1684('0xaf')});});}})[_0x1684('0x23')](respondWithResult(_0x269d7e,null))[_0x1684('0x2d')](handleError(_0x269d7e,null));};exports[_0x1684('0xb0')]=function(_0x3df921,_0x4dfbf0,_0x495e6b){var _0x46c786={};var _0x1ab9a3={};var _0x5823db;var _0x5b82a9;return db[_0x1684('0x42')][_0x1684('0x6d')]({'where':{'id':_0x3df921['params']['id']}})[_0x1684('0x23')](handleEntityNotFound(_0x4dfbf0,null))[_0x1684('0x23')](function(_0x4d4747){if(_0x4d4747){_0x5823db=_0x4d4747;_0x1ab9a3[_0x1684('0x47')]=_[_0x1684('0x49')](db['OpenchannelApplication'][_0x1684('0x43')]);_0x1ab9a3[_0x1684('0x4a')]=_[_0x1684('0x49')](_0x3df921[_0x1684('0x4a')]);_0x1ab9a3[_0x1684('0x4b')]=_['intersection'](_0x1ab9a3[_0x1684('0x47')],_0x1ab9a3[_0x1684('0x4a')]);_0x46c786['attributes']=_[_0x1684('0x4c')](_0x1ab9a3[_0x1684('0x47')],qs[_0x1684('0x4e')](_0x3df921['query'][_0x1684('0x4e')]));_0x46c786['attributes']=_0x46c786[_0x1684('0x4d')][_0x1684('0x4f')]?_0x46c786[_0x1684('0x4d')]:_0x1ab9a3['model'];_0x46c786[_0x1684('0x52')]=qs[_0x1684('0x53')](_0x3df921[_0x1684('0x4a')]['sort']);_0x46c786[_0x1684('0x54')]=qs[_0x1684('0x4b')](_[_0x1684('0x6e')](_0x3df921[_0x1684('0x4a')],_0x1ab9a3['filters']));if(_0x3df921[_0x1684('0x4a')][_0x1684('0x55')]){_0x46c786[_0x1684('0x54')]=_['merge'](_0x46c786[_0x1684('0x54')],{'$or':_[_0x1684('0x48')](_0x46c786[_0x1684('0x4d')],function(_0x4527e2){var _0x1f436b={};_0x1f436b[_0x4527e2]={'$like':'%'+_0x3df921[_0x1684('0x4a')][_0x1684('0x55')]+'%'};return _0x1f436b;})});}_0x46c786=_[_0x1684('0x56')]({},_0x46c786,_0x3df921['options']);return _0x5823db[_0x1684('0xb0')](_0x46c786);}})[_0x1684('0x23')](function(_0x541a07){if(_0x541a07){_0x5b82a9=_0x541a07['length'];if(!_0x3df921[_0x1684('0x4a')][_0x1684('0x50')]('nolimit')){_0x46c786['limit']=qs['limit'](_0x3df921[_0x1684('0x4a')][_0x1684('0x33')]);_0x46c786['offset']=qs[_0x1684('0x32')](_0x3df921[_0x1684('0x4a')][_0x1684('0x32')]);}return _0x5823db[_0x1684('0xb0')](_0x46c786);}})[_0x1684('0x23')](function(_0x2be538){if(_0x2be538){return _0x2be538?{'count':_0x5b82a9,'rows':_0x2be538}:null;}})['then'](respondWithResult(_0x4dfbf0,null))[_0x1684('0x2d')](handleError(_0x4dfbf0,null));};exports[_0x1684('0xb1')]=function(_0xe5784d,_0x3a50be,_0x46f38c){var _0x52fc77={'raw':![],'where':{}};var _0xfc48ca={};var _0x19f6ad={'count':0x0,'rows':[]};return db[_0x1684('0x42')][_0x1684('0x6d')]({'where':{'id':_0xe5784d[_0x1684('0x5d')]['id']}})[_0x1684('0x23')](handleEntityNotFound(_0x3a50be,null))[_0x1684('0x23')](function(_0x26ee88){if(_0x26ee88){_0xfc48ca[_0x1684('0x47')]=_[_0x1684('0x49')](db[_0x1684('0x93')][_0x1684('0x43')]);_0xfc48ca['query']=_[_0x1684('0x49')](_0xe5784d[_0x1684('0x4a')]);_0xfc48ca[_0x1684('0x4b')]=_['intersection'](_0xfc48ca[_0x1684('0x47')],_0xfc48ca[_0x1684('0x4a')]);_0x52fc77[_0x1684('0x4d')]=_[_0x1684('0x4c')](_0xfc48ca['model'],qs[_0x1684('0x4e')](_0xe5784d[_0x1684('0x4a')]['fields']));_0x52fc77[_0x1684('0x4d')]=_0x52fc77[_0x1684('0x4d')][_0x1684('0x4f')]?_0x52fc77[_0x1684('0x4d')]:_0xfc48ca[_0x1684('0x47')];if(!_0xe5784d[_0x1684('0x4a')][_0x1684('0x50')](_0x1684('0x51'))){_0x52fc77[_0x1684('0x33')]=qs['limit'](_0xe5784d[_0x1684('0x4a')]['limit']);_0x52fc77['offset']=qs[_0x1684('0x32')](_0xe5784d[_0x1684('0x4a')][_0x1684('0x32')]);}_0x52fc77[_0x1684('0x52')]=qs[_0x1684('0x53')](_0xe5784d[_0x1684('0x4a')][_0x1684('0x53')]);_0x52fc77[_0x1684('0x54')]=qs[_0x1684('0x4b')](_['pick'](_0xe5784d[_0x1684('0x4a')],_0xfc48ca[_0x1684('0x4b')]));_0x52fc77[_0x1684('0x54')][_0x1684('0x72')]=_0x26ee88['id'];if(_0xe5784d[_0x1684('0x4a')]['filter']){_0x52fc77['where']=_['merge'](_0x52fc77[_0x1684('0x54')],{'$or':_[_0x1684('0x48')](_0x52fc77[_0x1684('0x4d')],function(_0xf76270){var _0x2fa2e0={};_0x2fa2e0[_0xf76270]={'$like':'%'+_0xe5784d[_0x1684('0x4a')][_0x1684('0x55')]+'%'};return _0x2fa2e0;})});}_0x52fc77=_[_0x1684('0x56')]({},_0x52fc77,_0xe5784d[_0x1684('0x5e')]);return db[_0x1684('0x93')][_0x1684('0x31')]({'where':_0x52fc77[_0x1684('0x54')]})['then'](function(_0x5bf814){_0x19f6ad[_0x1684('0x31')]=_0x5bf814;if(_0xe5784d['query'][_0x1684('0x58')]){_0x52fc77[_0x1684('0x59')]=[{'model':db[_0x1684('0x77')],'as':'Contact','required':![]},{'model':db[_0x1684('0xa3')],'as':_0x1684('0xb2'),'attributes':['name',_0x1684('0xb3'),'internal'],'required':![]},{'model':db[_0x1684('0xb4')],'as':_0x1684('0xb5'),'attributes':['id',_0x1684('0x3d'),_0x1684('0xb6')],'where':_0xe5784d[_0x1684('0x4a')][_0x1684('0xb7')]?{'id':_0xe5784d[_0x1684('0x4a')][_0x1684('0xb7')]}:undefined,'required':_0xe5784d['query'][_0x1684('0xb7')]?!![]:![]}];}return db[_0x1684('0x93')][_0x1684('0x5a')](_0x52fc77);})[_0x1684('0x23')](function(_0x7ee7b8){_0x19f6ad['rows']=_0x7ee7b8;return _0x19f6ad;});}})['then'](respondWithFilteredResult(_0x3a50be,_0x52fc77))[_0x1684('0x2d')](handleError(_0x3a50be,null));};exports[_0x1684('0xb8')]=function(_0x4d8784,_0x51f0db,_0x4156c8){return db[_0x1684('0x42')][_0x1684('0x5f')]({'where':{'id':_0x4d8784[_0x1684('0x5d')]['id']}})[_0x1684('0x23')](handleEntityNotFound(_0x51f0db,null))[_0x1684('0x23')](function(_0x3fadb6){if(_0x3fadb6){return _0x3fadb6[_0x1684('0xb8')](_0x4d8784[_0x1684('0x68')][_0x1684('0x70')],_['omit'](_0x4d8784[_0x1684('0x68')],[_0x1684('0x70'),'id'])||{})['spread'](function(_0x19962b){for(var _0x499312=0x0;_0x499312<_0x4d8784[_0x1684('0x68')]['ids'][_0x1684('0x4f')];_0x499312+=0x1){socket[_0x1684('0xb9')](_0x1684('0xba'),{'UserId':_0x4d8784[_0x1684('0x68')][_0x1684('0x70')][_0x499312],'OpenchannelAccountId':_0x4d8784[_0x1684('0x5d')]['id']});}return _0x19962b;});}})['then'](respondWithResult(_0x51f0db,null))[_0x1684('0x2d')](handleError(_0x51f0db,null));};exports[_0x1684('0xbb')]=function(_0x434a9f,_0x5d0e3a,_0x7c3dde){return db[_0x1684('0x42')]['find']({'where':{'id':_0x434a9f['params']['id']}})[_0x1684('0x23')](handleEntityNotFound(_0x5d0e3a,null))[_0x1684('0x23')](function(_0x4e3ee5){if(_0x4e3ee5){return _0x4e3ee5['removeAgents'](_0x434a9f[_0x1684('0x4a')][_0x1684('0x70')])[_0x1684('0x23')](function(){if(_[_0x1684('0xbc')](_0x434a9f['query'][_0x1684('0x70')])){for(var _0x2b3a3e=0x0;_0x2b3a3e<_0x434a9f['query'][_0x1684('0x70')]['length'];_0x2b3a3e+=0x1){socket[_0x1684('0xb9')](_0x1684('0xbd'),{'UserId':Number(_0x434a9f[_0x1684('0x4a')][_0x1684('0x70')][_0x2b3a3e]),'OpenchannelAccountId':Number(_0x434a9f[_0x1684('0x5d')]['id'])});}}else{socket[_0x1684('0xb9')]('userOpenchannelAccount:remove',{'UserId':Number(_0x434a9f[_0x1684('0x4a')][_0x1684('0x70')]),'OpenchannelAccountId':Number(_0x434a9f[_0x1684('0x5d')]['id'])});}});}})[_0x1684('0x23')](respondWithStatusCode(_0x5d0e3a,null))[_0x1684('0x2d')](handleError(_0x5d0e3a,null));};exports['getAgents']=function(_0xbec258,_0x52d315,_0x2a28bc){var _0x194a03={};var _0x283a03={};var _0x14082a;var _0x8c6c8a;return db[_0x1684('0x42')][_0x1684('0x6d')]({'where':{'id':_0xbec258['params']['id']}})['then'](handleEntityNotFound(_0x52d315,null))[_0x1684('0x23')](function(_0x16ab59){if(_0x16ab59){_0x14082a=_0x16ab59;_0x283a03[_0x1684('0x47')]=_[_0x1684('0x49')](db[_0x1684('0xa3')][_0x1684('0x43')]);_0x283a03['query']=_[_0x1684('0x49')](_0xbec258['query']);_0x283a03['filters']=_[_0x1684('0x4c')](_0x283a03[_0x1684('0x47')],_0x283a03[_0x1684('0x4a')]);_0x194a03[_0x1684('0x4d')]=_['intersection'](_0x283a03[_0x1684('0x47')],qs[_0x1684('0x4e')](_0xbec258['query']['fields']));_0x194a03[_0x1684('0x4d')]=_0x194a03[_0x1684('0x4d')]['length']?_0x194a03[_0x1684('0x4d')]:_0x283a03['model'];_0x194a03[_0x1684('0x52')]=qs[_0x1684('0x53')](_0xbec258['query'][_0x1684('0x53')]);_0x194a03[_0x1684('0x54')]=qs[_0x1684('0x4b')](_[_0x1684('0x6e')](_0xbec258[_0x1684('0x4a')],_0x283a03[_0x1684('0x4b')]));if(_0xbec258[_0x1684('0x4a')][_0x1684('0x55')]){_0x194a03[_0x1684('0x54')]=_[_0x1684('0x56')](_0x194a03[_0x1684('0x54')],{'$or':_[_0x1684('0x48')](_0x194a03[_0x1684('0x4d')],function(_0x39078d){var _0x163b7d={};_0x163b7d[_0x39078d]={'$like':'%'+_0xbec258[_0x1684('0x4a')][_0x1684('0x55')]+'%'};return _0x163b7d;})});}_0x194a03=_[_0x1684('0x56')]({},_0x194a03,_0xbec258[_0x1684('0x5e')]);return _0x14082a['getAgents'](_0x194a03);}})[_0x1684('0x23')](function(_0x30b481){if(_0x30b481){_0x8c6c8a=_0x30b481[_0x1684('0x4f')];if(!_0xbec258[_0x1684('0x4a')][_0x1684('0x50')](_0x1684('0x51'))){_0x194a03[_0x1684('0x33')]=qs[_0x1684('0x33')](_0xbec258[_0x1684('0x4a')]['limit']);_0x194a03[_0x1684('0x32')]=qs[_0x1684('0x32')](_0xbec258[_0x1684('0x4a')][_0x1684('0x32')]);}return _0x14082a[_0x1684('0xbe')](_0x194a03);}})[_0x1684('0x23')](function(_0x4fd790){if(_0x4fd790){return _0x4fd790?{'count':_0x8c6c8a,'rows':_0x4fd790}:null;}})['then'](respondWithResult(_0x52d315,null))[_0x1684('0x2d')](handleError(_0x52d315,null));};exports[_0x1684('0x3e')]=function(_0x1a652a,_0x550d03,_0x451fd9){var _0x54dd71,_0x36b53b,_0x3166cf;if(_[_0x1684('0x7e')](_0x1a652a['body'][_0x1684('0x68')])||_0x1a652a['body'][_0x1684('0x68')]===''){throw new db[(_0x1684('0x7f'))][(_0x1684('0x78'))](_0x1684('0x81'));}if(_[_0x1684('0x7e')](_0x1a652a[_0x1684('0x68')]['to'])){}_0x54dd71=_0x1a652a[_0x1684('0x68')]['to'];return db[_0x1684('0x42')][_0x1684('0x6d')]({'where':{'id':_0x1a652a[_0x1684('0x5d')]['id']}})[_0x1684('0x23')](handleEntityNotFound(_0x550d03,null))[_0x1684('0x23')](function(_0x5da043){if(_0x5da043){return db['OpenchannelAccount'][_0x1684('0x5f')]({'where':{'id':_0x5da043['id']},'include':[{'model':db[_0x1684('0x86')],'as':_0x1684('0x87'),'include':[{'model':db['CmContact'],'as':_0x1684('0x88'),'where':{[_0x5da043[_0x1684('0x82')]]:_0x54dd71},'limit':0x1,'order':[[_0x1684('0x89'),'DESC']]}]}]})[_0x1684('0x23')](handleEntityNotFound(_0x550d03,null))['then'](function(_0x47c12f){if(_0x47c12f&&_0x47c12f[_0x1684('0x87')]){_0x36b53b=_0x47c12f[_0x1684('0x62')]({'plain':!![]});if(_0x36b53b['List']&&_0x36b53b['List'][_0x1684('0x88')][_0x1684('0x4f')]){return _0x36b53b[_0x1684('0x87')][_0x1684('0x88')][0x0];}return db[_0x1684('0x77')][_0x1684('0x60')](_['defaults'](_0x1a652a[_0x1684('0x68')],{'firstName':_0x54dd71,[_0x47c12f[_0x1684('0x82')]]:_0x54dd71,'phone':_0x54dd71,'ListId':_0x36b53b[_0x1684('0x7d')]}));}})['then'](handleEntityNotFound(_0x550d03,null))[_0x1684('0x23')](function(_0x21e553){if(_0x21e553){_0x3166cf=_0x21e553;return db[_0x1684('0x93')][_0x1684('0x5f')]({'where':{'ContactId':_0x3166cf['id'],'closed':![],'OpenchannelAccountId':_0x36b53b['id']}})[_0x1684('0x23')](function(_0x9c53ff){if(_0x9c53ff){return[_0x9c53ff,![]];}return db[_0x1684('0x93')][_0x1684('0x60')]({'UserId':_0x1a652a[_0x1684('0x61')]['id'],'ContactId':_0x3166cf['id'],'OpenchannelAccountId':_0x36b53b['id'],'lastMsgDirection':'out','Messages':[_['merge'](_0x1a652a[_0x1684('0x68')],{'read':![],'body':_0x1a652a[_0x1684('0x68')][_0x1684('0x68')],'OpenchannelAccountId':_0x36b53b['id'],'UserId':_0x1a652a['user']['id'],'ContactId':_0x3166cf['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x1684('0xbf')}]})[_0x1684('0x23')](function(_0x5653a4){return[_0x5653a4,!![]];});});}})[_0x1684('0x95')](function(_0x5100f1,_0x459555){if(_0x459555){return _0x5100f1;}return db[_0x1684('0xa0')][_0x1684('0x60')](_[_0x1684('0x56')](_0x1a652a[_0x1684('0x68')],{'read':![],'body':_0x1a652a[_0x1684('0x68')][_0x1684('0x68')],'OpenchannelAccountId':_0x36b53b['id'],'OpenchannelInteractionId':_0x5100f1['id'],'UserId':_0x1a652a[_0x1684('0x61')]['id'],'ContactId':_0x3166cf['id']}))[_0x1684('0x23')](function(_0x1471cc){_0x5100f1[_0x1684('0xc0')][_0x1684('0xbf')]=[];_0x5100f1[_0x1684('0xc0')][_0x1684('0xbf')]['push'](_0x1471cc['dataValues']);return _0x5100f1;});});}})[_0x1684('0x23')](respondWithResult(_0x550d03,null))[_0x1684('0x2d')](handleError(_0x550d03,null));}; \ No newline at end of file +var _0x89a2=['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','update','describe','addDisposition','Disposition','getDispositions','sort','pick','OpenchannelAccountId','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','openchannel','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','applications','Applications','list','orderBy','priority','asc','account','mapKey','CmContact','contact','firstName','lastName','threadId','OpenchannelInteraction','spread','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','Start','startRouting','EventManager','addApplications','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','color','addAgents','ids','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','push','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','message','error','catch','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','get','OpenchannelAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','show'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x89a2,0x127));var _0x289a=function(_0x35e92e,_0x21581b){_0x35e92e=_0x35e92e-0x0;var _0x1205a8=_0x89a2[_0x35e92e];return _0x1205a8;};'use strict';var pdf=require(_0x289a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x289a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x289a('0x2'));var rp=require(_0x289a('0x3'));var moment=require(_0x289a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x289a('0x5'));var util=require(_0x289a('0x6'));var path=require(_0x289a('0x7'));var sox=require('sox');var csv=require(_0x289a('0x8'));var ejs=require(_0x289a('0x9'));var fs=require('fs');var _=require(_0x289a('0xa'));var squel=require(_0x289a('0xb'));var crypto=require(_0x289a('0xc'));var jsforce=require(_0x289a('0xd'));var deskjs=require(_0x289a('0xe'));var toCsv=require(_0x289a('0x8'));var querystring=require(_0x289a('0xf'));var Papa=require('papaparse');var Redis=require(_0x289a('0x10'));var authService=require(_0x289a('0x11'));var qs=require(_0x289a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x289a('0x13'));var logger=require(_0x289a('0x14'))(_0x289a('0x15'));var utils=require(_0x289a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x289a('0x17'));var db=require(_0x289a('0x18'))['db'];config[_0x289a('0x19')]=_[_0x289a('0x1a')](config[_0x289a('0x19')],{'host':_0x289a('0x1b'),'port':0x18eb});var socket=require(_0x289a('0x1c'))(new Redis(config['redis']));require(_0x289a('0x1d'))[_0x289a('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x289a('0x1f')][_0x289a('0x20')]({'port':0x232c});var client9002=jayson[_0x289a('0x1f')][_0x289a('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x37719c,_0x5e60fb,_0x22daf5,_0x16e76c){return new BPromise(function(_0x26d77e,_0x62cffb){var _0x27d940=_0x16e76c||client;return _0x27d940[_0x289a('0x21')](_0x37719c,_0x22daf5)[_0x289a('0x22')](function(_0x29e59d){logger[_0x289a('0x23')](_0x289a('0x24'),_0x5e60fb,_0x289a('0x25'));logger[_0x289a('0x26')](_0x289a('0x27'),_0x5e60fb,'request\x20sent',JSON[_0x289a('0x28')](_0x29e59d));if(_0x29e59d['error']){if(_0x29e59d['error'][_0x289a('0x29')]===0x1f4){logger['error'](_0x289a('0x24'),_0x5e60fb,_0x29e59d['error'][_0x289a('0x2a')]);return _0x62cffb(_0x29e59d[_0x289a('0x2b')]['message']);}logger['error'](_0x289a('0x24'),_0x5e60fb,_0x29e59d[_0x289a('0x2b')][_0x289a('0x2a')]);return _0x26d77e(_0x29e59d['error'][_0x289a('0x2a')]);}else{logger[_0x289a('0x23')](_0x289a('0x24'),_0x5e60fb,_0x289a('0x25'));_0x26d77e(_0x29e59d['result'][_0x289a('0x2a')]);}})[_0x289a('0x2c')](function(_0x2b1606){logger[_0x289a('0x2b')]('OpenchannelAccount,\x20%s,\x20%s',_0x5e60fb,_0x2b1606);_0x62cffb(_0x2b1606);});});}function respondWithStatusCode(_0x5b8bdf,_0x2be831){_0x2be831=_0x2be831||0xcc;return function(_0x1cbb60){if(_0x1cbb60){return _0x5b8bdf[_0x289a('0x2d')](_0x2be831);}return _0x5b8bdf[_0x289a('0x2e')](_0x2be831)[_0x289a('0x2f')]();};}function respondWithResult(_0x5c1af9,_0x389671){_0x389671=_0x389671||0xc8;return function(_0x4935c7){if(_0x4935c7){return _0x5c1af9[_0x289a('0x2e')](_0x389671)[_0x289a('0x30')](_0x4935c7);}};}function respondWithFilteredResult(_0x2b164f,_0xf3b58c){return function(_0x3a7a2f){if(_0x3a7a2f){var _0x1fedcc=_0x3a7a2f[_0x289a('0x31')],_0x5671b1=_0xf3b58c[_0x289a('0x32')],_0x2b1ede=_0xf3b58c[_0x289a('0x32')]+_0xf3b58c['limit'],_0x3df199;if(_0x2b1ede>=_0x1fedcc){_0x2b1ede=_0x1fedcc;_0x3df199=0xc8;}else{_0x3df199=0xce;}_0x2b164f[_0x289a('0x2e')](_0x3df199);return _0x2b164f[_0x289a('0x33')](_0x289a('0x34'),_0x5671b1+'-'+_0x2b1ede+'/'+_0x1fedcc)['json'](_0x3a7a2f);}return null;};}function patchUpdates(_0x5b61b4){return function(_0x3a9dc5){try{jsonpatch['apply'](_0x3a9dc5,_0x5b61b4,!![]);}catch(_0x9d9ca6){return BPromise[_0x289a('0x35')](_0x9d9ca6);}return _0x3a9dc5[_0x289a('0x36')]();};}function saveUpdates(_0x5a9f36,_0x3b5fc1){return function(_0x1c2187){if(_0x1c2187){return _0x1c2187['update'](_0x5a9f36)[_0x289a('0x22')](function(_0x3d75c9){return _0x3d75c9;});}return null;};}function removeEntity(_0x91dc3f,_0x554429){return function(_0xbe1e1f){if(_0xbe1e1f){return _0xbe1e1f['destroy']()[_0x289a('0x22')](function(){var _0x364575=_0xbe1e1f[_0x289a('0x37')]({'plain':!![]});var _0x2d24ed=_0x289a('0x38');return db[_0x289a('0x39')][_0x289a('0x3a')]({'where':{'type':_0x2d24ed,'resourceId':_0x364575['id']}})[_0x289a('0x22')](function(){return _0xbe1e1f;});})[_0x289a('0x22')](function(){_0x91dc3f[_0x289a('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55bf31,_0x49ab45){return function(_0x3d92e8){if(!_0x3d92e8){_0x55bf31[_0x289a('0x2d')](0x194);}return _0x3d92e8;};}function handleError(_0x2f942e,_0x3e1b86){_0x3e1b86=_0x3e1b86||0x1f4;return function(_0x1a158a){logger[_0x289a('0x2b')](_0x1a158a[_0x289a('0x3b')]);if(_0x1a158a[_0x289a('0x3c')]){delete _0x1a158a[_0x289a('0x3c')];}_0x2f942e[_0x289a('0x2e')](_0x3e1b86)[_0x289a('0x3d')](_0x1a158a);};}exports[_0x289a('0x3e')]=function(_0x4f1efe,_0x407d9d){var _0xaf6619={'include':[{'model':db[_0x289a('0x3f')],'as':_0x289a('0x40')}]},_0x3fcec5={},_0x5cedb6={'count':0x0,'rows':[]};var _0x308eb1=_[_0x289a('0x41')](db[_0x289a('0x42')][_0x289a('0x43')],function(_0x42271c){return{'name':_0x42271c[_0x289a('0x44')],'type':_0x42271c[_0x289a('0x45')]['key']};});_0x3fcec5[_0x289a('0x46')]=_[_0x289a('0x41')](_0x308eb1,_0x289a('0x3c'));_0x3fcec5['query']=_[_0x289a('0x47')](_0x4f1efe[_0x289a('0x48')]);_0x3fcec5[_0x289a('0x49')]=_[_0x289a('0x4a')](_0x3fcec5['model'],_0x3fcec5[_0x289a('0x48')]);_0xaf6619['attributes']=_[_0x289a('0x4a')](_0x3fcec5[_0x289a('0x46')],qs[_0x289a('0x4b')](_0x4f1efe[_0x289a('0x48')][_0x289a('0x4b')]));_0xaf6619[_0x289a('0x4c')]=_0xaf6619['attributes'][_0x289a('0x4d')]?_0xaf6619[_0x289a('0x4c')]:_0x3fcec5[_0x289a('0x46')];if(!_0x4f1efe['query'][_0x289a('0x4e')](_0x289a('0x4f'))){_0xaf6619['limit']=qs[_0x289a('0x50')](_0x4f1efe[_0x289a('0x48')][_0x289a('0x50')]);_0xaf6619[_0x289a('0x32')]=qs[_0x289a('0x32')](_0x4f1efe['query'][_0x289a('0x32')]);}_0xaf6619[_0x289a('0x51')]=qs['sort'](_0x4f1efe['query']['sort']);_0xaf6619['where']=qs[_0x289a('0x49')](_['pick'](_0x4f1efe[_0x289a('0x48')],_0x3fcec5[_0x289a('0x49')]),_0x308eb1);if(_0x4f1efe[_0x289a('0x48')]['filter']){_0xaf6619['where']=_[_0x289a('0x52')](_0xaf6619[_0x289a('0x53')],{'$or':_['map'](_0x308eb1,function(_0x1f55d4){if(_0x1f55d4['type']!==_0x289a('0x54')){var _0x2bacb4={};_0x2bacb4[_0x1f55d4[_0x289a('0x3c')]]={'$like':'%'+_0x4f1efe[_0x289a('0x48')][_0x289a('0x55')]+'%'};return _0x2bacb4;}})});}_0xaf6619=_[_0x289a('0x52')]({},_0xaf6619,_0x4f1efe[_0x289a('0x56')]);var _0x4d38fb={'where':_0xaf6619['where']};return db['OpenchannelAccount'][_0x289a('0x31')](_0x4d38fb)[_0x289a('0x22')](function(_0x4f67be){_0x5cedb6[_0x289a('0x31')]=_0x4f67be;if(_0x4f1efe['query'][_0x289a('0x57')]){_0xaf6619[_0x289a('0x58')]=[{'all':!![]}];}return db[_0x289a('0x42')][_0x289a('0x59')](_0xaf6619);})[_0x289a('0x22')](function(_0x436990){_0x5cedb6['rows']=_0x436990;return _0x5cedb6;})['then'](respondWithFilteredResult(_0x407d9d,_0xaf6619))['catch'](handleError(_0x407d9d,null));};exports[_0x289a('0x5a')]=function(_0x348981,_0x392491){var _0x31a68f={'raw':![],'where':{'id':_0x348981[_0x289a('0x5b')]['id']},'include':[{'model':db[_0x289a('0x3f')],'as':_0x289a('0x40')}]},_0x1a8d53={};_0x1a8d53['model']=_['keys'](db[_0x289a('0x42')][_0x289a('0x43')]);_0x1a8d53[_0x289a('0x48')]=_[_0x289a('0x47')](_0x348981[_0x289a('0x48')]);_0x1a8d53[_0x289a('0x49')]=_[_0x289a('0x4a')](_0x1a8d53[_0x289a('0x46')],_0x1a8d53['query']);_0x31a68f[_0x289a('0x4c')]=_[_0x289a('0x4a')](_0x1a8d53[_0x289a('0x46')],qs[_0x289a('0x4b')](_0x348981['query'][_0x289a('0x4b')]));_0x31a68f[_0x289a('0x4c')]=_0x31a68f[_0x289a('0x4c')][_0x289a('0x4d')]?_0x31a68f[_0x289a('0x4c')]:_0x1a8d53[_0x289a('0x46')];if(_0x348981[_0x289a('0x48')][_0x289a('0x57')]){_0x31a68f[_0x289a('0x58')]=[{'all':!![]}];}_0x31a68f=_['merge']({},_0x31a68f,_0x348981[_0x289a('0x56')]);return db[_0x289a('0x42')][_0x289a('0x5c')](_0x31a68f)[_0x289a('0x22')](handleEntityNotFound(_0x392491,null))[_0x289a('0x22')](respondWithResult(_0x392491,null))[_0x289a('0x2c')](handleError(_0x392491,null));};exports['create']=function(_0x497757,_0x2b1142){return db['OpenchannelAccount'][_0x289a('0x5d')](_0x497757[_0x289a('0x5e')],{})[_0x289a('0x22')](function(_0x2d19cd){var _0x3cbd94=_0x497757[_0x289a('0x5f')][_0x289a('0x37')]({'plain':!![]});if(!_0x3cbd94)throw new Error(_0x289a('0x60'));if(_0x3cbd94['role']==='user'){var _0x1981c0=_0x2d19cd[_0x289a('0x37')]({'plain':!![]});var _0x15939a='OpenchannelAccounts';return db[_0x289a('0x61')][_0x289a('0x5c')]({'where':{'name':_0x15939a,'userProfileId':_0x3cbd94[_0x289a('0x62')]},'raw':!![]})[_0x289a('0x22')](function(_0x5652b3){if(_0x5652b3&&_0x5652b3[_0x289a('0x63')]===0x0){return db['UserProfileResource']['create']({'name':_0x1981c0[_0x289a('0x3c')],'resourceId':_0x1981c0['id'],'type':_0x5652b3[_0x289a('0x3c')],'sectionId':_0x5652b3['id']},{})[_0x289a('0x22')](function(){return _0x2d19cd;});}else{return _0x2d19cd;}})[_0x289a('0x2c')](function(_0x350eb3){logger[_0x289a('0x2b')](_0x289a('0x64'),_0x350eb3);throw _0x350eb3;});}return _0x2d19cd;})[_0x289a('0x22')](respondWithResult(_0x2b1142,0xc9))[_0x289a('0x2c')](handleError(_0x2b1142,null));};exports[_0x289a('0x65')]=function(_0x5669c2,_0x1680ea){if(_0x5669c2[_0x289a('0x5e')]['id']){delete _0x5669c2[_0x289a('0x5e')]['id'];}return db[_0x289a('0x42')]['find']({'where':{'id':_0x5669c2[_0x289a('0x5b')]['id']},'include':[{'model':db[_0x289a('0x3f')],'as':_0x289a('0x40')}]})[_0x289a('0x22')](handleEntityNotFound(_0x1680ea,null))[_0x289a('0x22')](saveUpdates(_0x5669c2['body'],null))['then'](respondWithResult(_0x1680ea,null))[_0x289a('0x2c')](handleError(_0x1680ea,null));};exports['destroy']=function(_0x4329d9,_0x22b82f){return db['OpenchannelAccount'][_0x289a('0x5c')]({'where':{'id':_0x4329d9['params']['id']}})[_0x289a('0x22')](handleEntityNotFound(_0x22b82f,null))['then'](removeEntity(_0x22b82f,null))[_0x289a('0x2c')](handleError(_0x22b82f,null));};exports[_0x289a('0x66')]=function(_0x3e7612,_0x5e04bb){return db[_0x289a('0x42')][_0x289a('0x66')]()[_0x289a('0x22')](respondWithResult(_0x5e04bb,null))[_0x289a('0x2c')](handleError(_0x5e04bb,null));};exports[_0x289a('0x67')]=function(_0x9f050b,_0x550c97,_0x46b81a){if(_0x9f050b['body']['id']){delete _0x9f050b['body']['id'];}return db[_0x289a('0x42')][_0x289a('0x5c')]({'where':{'id':_0x9f050b[_0x289a('0x5b')]['id']}})[_0x289a('0x22')](handleEntityNotFound(_0x550c97,null))[_0x289a('0x22')](function(_0x51b203){if(_0x51b203){_0x9f050b['body']['OpenchannelAccountId']=_0x51b203['id'];return db[_0x289a('0x68')][_0x289a('0x5d')](_0x9f050b['body']);}})[_0x289a('0x22')](respondWithResult(_0x550c97,null))[_0x289a('0x2c')](handleError(_0x550c97,null));};exports[_0x289a('0x69')]=function(_0x4b64e9,_0x13e582,_0x2aa654){var _0x591d00={'raw':![],'where':{}};var _0x37b915={};var _0x2a1283={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x4b64e9['params']['id']}})['then'](handleEntityNotFound(_0x13e582,null))[_0x289a('0x22')](function(_0x8319b0){if(_0x8319b0){_0x37b915[_0x289a('0x46')]=_[_0x289a('0x47')](db[_0x289a('0x68')][_0x289a('0x43')]);_0x37b915[_0x289a('0x48')]=_[_0x289a('0x47')](_0x4b64e9[_0x289a('0x48')]);_0x37b915[_0x289a('0x49')]=_[_0x289a('0x4a')](_0x37b915['model'],_0x37b915['query']);_0x591d00[_0x289a('0x4c')]=_['intersection'](_0x37b915[_0x289a('0x46')],qs[_0x289a('0x4b')](_0x4b64e9[_0x289a('0x48')][_0x289a('0x4b')]));_0x591d00[_0x289a('0x4c')]=_0x591d00[_0x289a('0x4c')]['length']?_0x591d00[_0x289a('0x4c')]:_0x37b915[_0x289a('0x46')];if(!_0x4b64e9[_0x289a('0x48')][_0x289a('0x4e')](_0x289a('0x4f'))){_0x591d00[_0x289a('0x50')]=qs[_0x289a('0x50')](_0x4b64e9[_0x289a('0x48')][_0x289a('0x50')]);_0x591d00[_0x289a('0x32')]=qs[_0x289a('0x32')](_0x4b64e9[_0x289a('0x48')][_0x289a('0x32')]);}_0x591d00[_0x289a('0x51')]=qs[_0x289a('0x6a')](_0x4b64e9[_0x289a('0x48')][_0x289a('0x6a')]);_0x591d00[_0x289a('0x53')]=qs[_0x289a('0x49')](_[_0x289a('0x6b')](_0x4b64e9[_0x289a('0x48')],_0x37b915[_0x289a('0x49')]));_0x591d00[_0x289a('0x53')][_0x289a('0x6c')]=_0x8319b0['id'];if(_0x4b64e9['query'][_0x289a('0x55')]){_0x591d00[_0x289a('0x53')]=_['merge'](_0x591d00[_0x289a('0x53')],{'$or':_['map'](_0x591d00[_0x289a('0x4c')],function(_0xd5a4fc){var _0x4d0645={};_0x4d0645[_0xd5a4fc]={'$like':'%'+_0x4b64e9['query']['filter']+'%'};return _0x4d0645;})});}_0x591d00=_[_0x289a('0x52')]({},_0x591d00,_0x4b64e9[_0x289a('0x56')]);return db[_0x289a('0x68')][_0x289a('0x31')]({'where':_0x591d00[_0x289a('0x53')]})[_0x289a('0x22')](function(_0xaf130b){_0x2a1283[_0x289a('0x31')]=_0xaf130b;if(_0x4b64e9[_0x289a('0x48')]['includeAll']){_0x591d00[_0x289a('0x58')]=[{'all':!![]}];}return db[_0x289a('0x68')]['findAll'](_0x591d00);})[_0x289a('0x22')](function(_0x1c7b71){_0x2a1283[_0x289a('0x6d')]=_0x1c7b71;return _0x2a1283;});}})[_0x289a('0x22')](respondWithFilteredResult(_0x13e582,_0x591d00))[_0x289a('0x2c')](handleError(_0x13e582,null));};exports['removeDispositions']=function(_0x3ba141,_0x55cf62,_0x1e605a){return db['OpenchannelAccount'][_0x289a('0x5c')]({'where':{'id':_0x3ba141[_0x289a('0x5b')]['id']}})[_0x289a('0x22')](handleEntityNotFound(_0x55cf62,null))[_0x289a('0x22')](function(_0x5da4f6){if(_0x5da4f6){return _0x5da4f6[_0x289a('0x6e')](_0x3ba141[_0x289a('0x48')]['ids']);}})[_0x289a('0x22')](respondWithStatusCode(_0x55cf62,null))[_0x289a('0x2c')](handleError(_0x55cf62,null));};exports[_0x289a('0x6f')]=function(_0x376cdb,_0x1192ec,_0xda03b0){if(_0x376cdb[_0x289a('0x5e')]['id']){delete _0x376cdb[_0x289a('0x5e')]['id'];}return db[_0x289a('0x42')][_0x289a('0x5c')]({'where':{'id':_0x376cdb[_0x289a('0x5b')]['id']}})[_0x289a('0x22')](handleEntityNotFound(_0x1192ec,null))[_0x289a('0x22')](function(_0x20e047){if(_0x20e047){_0x376cdb[_0x289a('0x5e')][_0x289a('0x6c')]=_0x20e047['id'];return db[_0x289a('0x70')][_0x289a('0x5d')](_0x376cdb[_0x289a('0x5e')]);}})[_0x289a('0x22')](respondWithResult(_0x1192ec,null))['catch'](handleError(_0x1192ec,null));};exports[_0x289a('0x71')]=function(_0x685b8b,_0x4e7a3a,_0x219e41){var _0x380940={'raw':![],'where':{}};var _0x444cc4={};var _0x156010={'count':0x0,'rows':[]};return db[_0x289a('0x42')][_0x289a('0x72')]({'where':{'id':_0x685b8b[_0x289a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4e7a3a,null))[_0x289a('0x22')](function(_0x25e3e3){if(_0x25e3e3){_0x444cc4['model']=_[_0x289a('0x47')](db['CannedAnswer'][_0x289a('0x43')]);_0x444cc4[_0x289a('0x48')]=_[_0x289a('0x47')](_0x685b8b[_0x289a('0x48')]);_0x444cc4[_0x289a('0x49')]=_[_0x289a('0x4a')](_0x444cc4['model'],_0x444cc4[_0x289a('0x48')]);_0x380940[_0x289a('0x4c')]=_[_0x289a('0x4a')](_0x444cc4['model'],qs[_0x289a('0x4b')](_0x685b8b['query'][_0x289a('0x4b')]));_0x380940[_0x289a('0x4c')]=_0x380940[_0x289a('0x4c')][_0x289a('0x4d')]?_0x380940[_0x289a('0x4c')]:_0x444cc4[_0x289a('0x46')];if(!_0x685b8b[_0x289a('0x48')]['hasOwnProperty'](_0x289a('0x4f'))){_0x380940[_0x289a('0x50')]=qs[_0x289a('0x50')](_0x685b8b[_0x289a('0x48')][_0x289a('0x50')]);_0x380940[_0x289a('0x32')]=qs['offset'](_0x685b8b['query'][_0x289a('0x32')]);}_0x380940[_0x289a('0x51')]=qs[_0x289a('0x6a')](_0x685b8b[_0x289a('0x48')]['sort']);_0x380940[_0x289a('0x53')]=qs[_0x289a('0x49')](_['pick'](_0x685b8b['query'],_0x444cc4[_0x289a('0x49')]));_0x380940[_0x289a('0x53')]['OpenchannelAccountId']=_0x25e3e3['id'];if(_0x685b8b['query'][_0x289a('0x55')]){_0x380940[_0x289a('0x53')]=_[_0x289a('0x52')](_0x380940[_0x289a('0x53')],{'$or':_['map'](_0x380940['attributes'],function(_0x1c6bcf){var _0x217ba0={};_0x217ba0[_0x1c6bcf]={'$like':'%'+_0x685b8b['query'][_0x289a('0x55')]+'%'};return _0x217ba0;})});}_0x380940=_[_0x289a('0x52')]({},_0x380940,_0x685b8b[_0x289a('0x56')]);return db['CannedAnswer'][_0x289a('0x31')]({'where':_0x380940[_0x289a('0x53')]})[_0x289a('0x22')](function(_0xe5453c){_0x156010[_0x289a('0x31')]=_0xe5453c;if(_0x685b8b['query'][_0x289a('0x57')]){_0x380940[_0x289a('0x58')]=[{'all':!![]}];}return db[_0x289a('0x70')]['findAll'](_0x380940);})[_0x289a('0x22')](function(_0x1a0a80){_0x156010[_0x289a('0x6d')]=_0x1a0a80;return _0x156010;});}})['then'](respondWithFilteredResult(_0x4e7a3a,_0x380940))['catch'](handleError(_0x4e7a3a,null));};exports['removeAnswers']=function(_0x440528,_0x5d47cb,_0x4d26cf){return db[_0x289a('0x42')][_0x289a('0x5c')]({'where':{'id':_0x440528[_0x289a('0x5b')]['id']}})[_0x289a('0x22')](handleEntityNotFound(_0x5d47cb,null))[_0x289a('0x22')](function(_0x3f12cc){if(_0x3f12cc){return _0x3f12cc[_0x289a('0x73')](_0x440528[_0x289a('0x48')]['ids']);}})[_0x289a('0x22')](respondWithStatusCode(_0x5d47cb,null))[_0x289a('0x2c')](handleError(_0x5d47cb,null));};exports[_0x289a('0x74')]=function(_0x156a62,_0x203b85,_0x53799d){var _0x2e732f={'body':_0x156a62[_0x289a('0x5e')],'channel':_0x289a('0x75')};var _0x28a080=[];var _0x56f94a=[];var _0x19a28a={};var _0x5949ee=![];return db['CmContact'][_0x289a('0x66')]()[_0x289a('0x22')](function(_0x41aefe){if(!_0x41aefe){throw new db[(_0x289a('0x76'))]['ValidationError'](_0x289a('0x77'));}_0x28a080=_['difference'](_['keys'](_0x41aefe),[_0x289a('0x78'),_0x289a('0x79')]);_0x56f94a=_[_0x289a('0x7a')](_[_0x289a('0x47')](_0x41aefe),[_0x289a('0x78'),_0x289a('0x79'),'CompanyId',_0x289a('0x7b')]);if(_0x156a62[_0x289a('0x5e')]['id']){delete _0x156a62['body']['id'];}if(_[_0x289a('0x7c')](_0x156a62[_0x289a('0x5e')][_0x289a('0x7d')])){throw new db['Sequelize'][(_0x289a('0x7e'))](_0x289a('0x7f'));}if(_[_0x289a('0x7c')](_0x156a62['body'][_0x289a('0x5e')])||_0x156a62[_0x289a('0x5e')]['body']===''){throw new db['Sequelize'][(_0x289a('0x7e'))](_0x289a('0x80'));}if(_[_0x289a('0x7c')](_0x156a62[_0x289a('0x5e')]['mapKey'])){throw new db[(_0x289a('0x76'))][(_0x289a('0x7e'))](_0x289a('0x81')+_0x56f94a);}if(!_[_0x289a('0x82')](_0x56f94a,_0x156a62['body']['mapKey'])){throw new db['Sequelize'][(_0x289a('0x7e'))](_0x289a('0x83')+_0x56f94a);}_0x19a28a[_0x156a62['body']['mapKey']]=_0x156a62[_0x289a('0x5e')][_0x289a('0x7d')];})[_0x289a('0x22')](function(){return db[_0x289a('0x42')][_0x289a('0x5c')]({'where':{'id':_0x156a62[_0x289a('0x5b')]['id']},'include':[{'model':db[_0x289a('0x84')],'as':_0x289a('0x85'),'include':[{'model':db['CmContact'],'as':_0x289a('0x86'),'where':_0x19a28a,'limit':0x1,'order':[[_0x289a('0x79'),_0x289a('0x87')]]}]},{'model':db[_0x289a('0x88')],'as':'Applications'}]});})[_0x289a('0x22')](handleEntityNotFound(_0x203b85,null))[_0x289a('0x22')](function(_0x920314){if(_0x920314&&_0x920314[_0x289a('0x85')]){_0x2e732f['account']=_0x920314;_0x2e732f[_0x289a('0x89')]=_0x920314[_0x289a('0x8a')];_0x2e732f[_0x289a('0x8b')]=_0x920314[_0x289a('0x85')];_0x2e732f['applications']=_[_0x289a('0x8c')](_0x2e732f[_0x289a('0x89')],[_0x289a('0x8d')],[_0x289a('0x8e')]);if(_0x2e732f[_0x289a('0x8f')][_0x289a('0x8a')]){delete _0x2e732f['account']['Applications'];}if(_0x2e732f[_0x289a('0x8f')]['List']&&_0x2e732f['account'][_0x289a('0x85')][_0x289a('0x86')]['length']){return _0x2e732f[_0x289a('0x8f')][_0x289a('0x85')][_0x289a('0x86')][0x0];}var _0x4fe8b=_[_0x289a('0x1a')](_0x156a62[_0x289a('0x5e')],{'firstName':_0x156a62['body'][_0x289a('0x7d')],'ListId':_0x920314[_0x289a('0x7b')]});_0x4fe8b[_0x156a62[_0x289a('0x5e')][_0x289a('0x90')]]=_0x156a62[_0x289a('0x5e')][_0x289a('0x7d')];return db[_0x289a('0x91')][_0x289a('0x5d')](_0x4fe8b,{'fields':_0x28a080,'raw':!![]});}})[_0x289a('0x22')](handleEntityNotFound(_0x203b85,null))[_0x289a('0x22')](function(_0x31cc3c){_0x2e732f[_0x289a('0x92')]=_0x31cc3c;if(_0x31cc3c){var _0x31d7ad={'ContactId':_0x31cc3c['id'],'OpenchannelAccountId':_0x156a62[_0x289a('0x5b')]['id'],'from':(_0x31cc3c[_0x289a('0x93')]||'')+'\x20'+(_0x31cc3c[_0x289a('0x94')]||'')};var _0x43c8fb={'OpenchannelAccountId':_0x156a62[_0x289a('0x5b')]['id'],'closed':![]};if(_0x156a62[_0x289a('0x5e')][_0x289a('0x95')]){_0x43c8fb[_0x289a('0x95')]=_0x156a62[_0x289a('0x5e')]['threadId'];return db[_0x289a('0x96')][_0x289a('0x5c')]({'where':_0x43c8fb})[_0x289a('0x22')](function(_0x44387b){if(_0x44387b){return[_0x44387b,![]];}_0x31d7ad[_0x289a('0x95')]=_0x156a62[_0x289a('0x5e')][_0x289a('0x95')];_0x31d7ad['externalUrl']=_0x156a62['body']['externalUrl'];return db[_0x289a('0x96')][_0x289a('0x5d')](_0x31d7ad)[_0x289a('0x22')](function(_0x48b8ce){return[_0x48b8ce,!![]];});});}else{_0x43c8fb['threadId']=null;}_0x43c8fb['ContactId']=_0x31cc3c['id'];return db[_0x289a('0x96')][_0x289a('0x5c')]({'where':_0x43c8fb})[_0x289a('0x22')](function(_0x5af924){if(_0x5af924){return[_0x5af924,![]];}return db[_0x289a('0x96')]['create'](_0x31d7ad)['then'](function(_0x55832b){return[_0x55832b,!![]];});});}})[_0x289a('0x97')](function(_0x39df61,_0x51f168){if(_0x39df61){_0x5949ee=_0x51f168;if(!_0x51f168){var _0xc86c80={'from':(_0x2e732f['contact'][_0x289a('0x93')]||'')+'\x20'+(_0x2e732f['contact']['lastName']||'')};if(_0x156a62[_0x289a('0x5e')][_0x289a('0x95')]&&_0x156a62[_0x289a('0x5e')][_0x289a('0x98')]&&_0x156a62['body'][_0x289a('0x95')]!=_0x156a62[_0x289a('0x5e')]['messageId']){_0xc86c80['threadId']=_0x156a62['body'][_0x289a('0x98')];}return _0x39df61[_0x289a('0x65')](_0xc86c80);}else{return _0x39df61;}}})[_0x289a('0x22')](function(_0x571c8e){_0x2e732f['interaction']=_0x571c8e[_0x289a('0x37')]({'plain':!![]});_0x2e732f[_0x289a('0x99')][_0x289a('0x9a')]=_0x5949ee;if(_0x2e732f[_0x289a('0x99')][_0x289a('0x9a')]){if(_0x2e732f[_0x289a('0x8f')][_0x289a('0x9b')]){_0x2e732f[_0x289a('0x89')]['push']({'id':0x0,'priority':_0x2e732f[_0x289a('0x89')][_0x289a('0x4d')]+0x1,'app':_0x289a('0x9c'),'appdata':_0x289a('0x9d'),'interval':_0x289a('0x9e')});}}return db['OpenchannelMessage'][_0x289a('0x5d')]({'body':_0x156a62['body'][_0x289a('0x5e')],'OpenchannelAccountId':_0x156a62['params']['id'],'OpenchannelInteractionId':_0x571c8e['id'],'direction':'in','ContactId':_0x2e732f[_0x289a('0x92')]['id'],'AttachmentId':_0x156a62['body'][_0x289a('0x9f')]});})[_0x289a('0x22')](function(_0x529bae){_0x2e732f[_0x289a('0x2a')]=_0x529bae;if(_0x2e732f[_0x289a('0x99')][_0x289a('0xa0')]){return db[_0x289a('0xa1')][_0x289a('0x5c')]({'attributes':['id','name'],'where':{'id':_0x2e732f[_0x289a('0x99')][_0x289a('0xa0')]}})[_0x289a('0x22')](function(_0x4106a3){if(_0x4106a3){_0x2e732f['applications'][_0x289a('0xa2')]({'id':0x0,'priority':0x0,'app':_0x289a('0xa3'),'appdata':_0x4106a3['name']+','+(_0x2e732f['account']['waitForTheAssignedAgent']||0xa),'interval':_0x289a('0x9e')});_0x2e732f['forcedOwnership']=![];}return respondWithRpcPromise(_0x289a('0xa4'),'startRouting',_0x2e732f);});}return respondWithRpcPromise(_0x289a('0xa4'),_0x289a('0xa5'),_0x2e732f);})['then'](function(_0x21eff3){respondWithRpcPromise(_0x289a('0xa6'),_0x289a('0xa6'),{'event':_0x289a('0x74'),'message':_0x21eff3},client9002);return _0x21eff3;})[_0x289a('0x22')](respondWithResult(_0x203b85,null))[_0x289a('0x2c')](handleError(_0x203b85,null));};exports[_0x289a('0xa7')]=function(_0x4e7e3f,_0x262bfc,_0x1e8c5d){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x4e7e3f[_0x289a('0x5b')]['id']}})[_0x289a('0x22')](handleEntityNotFound(_0x262bfc,null))['then'](function(_0x218007){if(_0x218007){return db['sequelize'][_0x289a('0xa8')](function(_0x2896e1){return db[_0x289a('0x88')][_0x289a('0x3a')]({'where':{'OpenchannelAccountId':_0x4e7e3f[_0x289a('0x5b')]['id']},'transaction':_0x2896e1})[_0x289a('0x22')](function(_0x3378a8){var _0x3801fa=_[_0x289a('0x41')](_0x4e7e3f[_0x289a('0x5e')],function(_0x2d30dc){_0x2d30dc[_0x289a('0x6c')]=_0x4e7e3f['params']['id'];return _0x2d30dc;});return db['OpenchannelApplication'][_0x289a('0xa9')](_0x3801fa,{'transaction':_0x2896e1});});})[_0x289a('0x22')](function(){return db['OpenchannelApplication'][_0x289a('0xaa')]({'where':{'OpenchannelAccountId':_0x4e7e3f[_0x289a('0x5b')]['id']},'order':_0x289a('0x8d')});});}})['then'](respondWithResult(_0x262bfc,null))['catch'](handleError(_0x262bfc,null));};exports[_0x289a('0xab')]=function(_0x286fa7,_0x55ee6c,_0x143345){var _0xe87d52={};var _0x5968de={};var _0x161a57;var _0x38d484;return db['OpenchannelAccount'][_0x289a('0x72')]({'where':{'id':_0x286fa7[_0x289a('0x5b')]['id']}})[_0x289a('0x22')](handleEntityNotFound(_0x55ee6c,null))['then'](function(_0x181a29){if(_0x181a29){_0x161a57=_0x181a29;_0x5968de[_0x289a('0x46')]=_[_0x289a('0x47')](db[_0x289a('0x88')][_0x289a('0x43')]);_0x5968de[_0x289a('0x48')]=_[_0x289a('0x47')](_0x286fa7[_0x289a('0x48')]);_0x5968de[_0x289a('0x49')]=_[_0x289a('0x4a')](_0x5968de[_0x289a('0x46')],_0x5968de[_0x289a('0x48')]);_0xe87d52[_0x289a('0x4c')]=_[_0x289a('0x4a')](_0x5968de[_0x289a('0x46')],qs[_0x289a('0x4b')](_0x286fa7['query'][_0x289a('0x4b')]));_0xe87d52[_0x289a('0x4c')]=_0xe87d52[_0x289a('0x4c')][_0x289a('0x4d')]?_0xe87d52[_0x289a('0x4c')]:_0x5968de[_0x289a('0x46')];_0xe87d52['order']=qs[_0x289a('0x6a')](_0x286fa7['query'][_0x289a('0x6a')]);_0xe87d52[_0x289a('0x53')]=qs[_0x289a('0x49')](_['pick'](_0x286fa7[_0x289a('0x48')],_0x5968de[_0x289a('0x49')]));if(_0x286fa7[_0x289a('0x48')][_0x289a('0x55')]){_0xe87d52['where']=_[_0x289a('0x52')](_0xe87d52['where'],{'$or':_[_0x289a('0x41')](_0xe87d52[_0x289a('0x4c')],function(_0x1b7ae5){var _0x22d9b1={};_0x22d9b1[_0x1b7ae5]={'$like':'%'+_0x286fa7[_0x289a('0x48')][_0x289a('0x55')]+'%'};return _0x22d9b1;})});}_0xe87d52=_[_0x289a('0x52')]({},_0xe87d52,_0x286fa7[_0x289a('0x56')]);return _0x161a57[_0x289a('0xab')](_0xe87d52);}})['then'](function(_0x2cb481){if(_0x2cb481){_0x38d484=_0x2cb481[_0x289a('0x4d')];if(!_0x286fa7[_0x289a('0x48')][_0x289a('0x4e')](_0x289a('0x4f'))){_0xe87d52[_0x289a('0x50')]=qs[_0x289a('0x50')](_0x286fa7[_0x289a('0x48')][_0x289a('0x50')]);_0xe87d52[_0x289a('0x32')]=qs[_0x289a('0x32')](_0x286fa7[_0x289a('0x48')][_0x289a('0x32')]);}return _0x161a57[_0x289a('0xab')](_0xe87d52);}})['then'](function(_0x3fc747){if(_0x3fc747){return _0x3fc747?{'count':_0x38d484,'rows':_0x3fc747}:null;}})[_0x289a('0x22')](respondWithResult(_0x55ee6c,null))[_0x289a('0x2c')](handleError(_0x55ee6c,null));};exports[_0x289a('0xac')]=function(_0x5c528d,_0x26c661,_0x20d193){var _0x44fb4f={'raw':![],'where':{}};var _0x41cf27={};var _0x4eac73={'count':0x0,'rows':[]};return db[_0x289a('0x42')]['findOne']({'where':{'id':_0x5c528d[_0x289a('0x5b')]['id']}})[_0x289a('0x22')](handleEntityNotFound(_0x26c661,null))[_0x289a('0x22')](function(_0x416453){if(_0x416453){_0x41cf27[_0x289a('0x46')]=_['keys'](db[_0x289a('0x96')][_0x289a('0x43')]);_0x41cf27['query']=_[_0x289a('0x47')](_0x5c528d[_0x289a('0x48')]);_0x41cf27[_0x289a('0x49')]=_['intersection'](_0x41cf27[_0x289a('0x46')],_0x41cf27[_0x289a('0x48')]);_0x44fb4f[_0x289a('0x4c')]=_[_0x289a('0x4a')](_0x41cf27['model'],qs[_0x289a('0x4b')](_0x5c528d[_0x289a('0x48')][_0x289a('0x4b')]));_0x44fb4f[_0x289a('0x4c')]=_0x44fb4f[_0x289a('0x4c')][_0x289a('0x4d')]?_0x44fb4f[_0x289a('0x4c')]:_0x41cf27[_0x289a('0x46')];if(!_0x5c528d[_0x289a('0x48')]['hasOwnProperty'](_0x289a('0x4f'))){_0x44fb4f[_0x289a('0x50')]=qs[_0x289a('0x50')](_0x5c528d['query']['limit']);_0x44fb4f[_0x289a('0x32')]=qs[_0x289a('0x32')](_0x5c528d['query']['offset']);}_0x44fb4f[_0x289a('0x51')]=qs[_0x289a('0x6a')](_0x5c528d['query']['sort']);_0x44fb4f[_0x289a('0x53')]=qs[_0x289a('0x49')](_[_0x289a('0x6b')](_0x5c528d[_0x289a('0x48')],_0x41cf27[_0x289a('0x49')]));_0x44fb4f['where'][_0x289a('0x6c')]=_0x416453['id'];if(_0x5c528d[_0x289a('0x48')]['filter']){_0x44fb4f['where']=_[_0x289a('0x52')](_0x44fb4f[_0x289a('0x53')],{'$or':_['map'](_0x44fb4f[_0x289a('0x4c')],function(_0x1dbe81){var _0x29e4f4={};_0x29e4f4[_0x1dbe81]={'$like':'%'+_0x5c528d[_0x289a('0x48')][_0x289a('0x55')]+'%'};return _0x29e4f4;})});}_0x44fb4f=_[_0x289a('0x52')]({},_0x44fb4f,_0x5c528d[_0x289a('0x56')]);return db[_0x289a('0x96')]['count']({'where':_0x44fb4f['where']})[_0x289a('0x22')](function(_0x3011a7){_0x4eac73[_0x289a('0x31')]=_0x3011a7;if(_0x5c528d[_0x289a('0x48')][_0x289a('0x57')]){_0x44fb4f[_0x289a('0x58')]=[{'model':db[_0x289a('0x91')],'as':_0x289a('0xad'),'required':![]},{'model':db[_0x289a('0xa1')],'as':_0x289a('0xae'),'attributes':['name','fullname',_0x289a('0xaf')],'required':![]},{'model':db[_0x289a('0xb0')],'as':_0x289a('0xb1'),'attributes':['id',_0x289a('0x3c'),_0x289a('0xb2')],'where':_0x5c528d[_0x289a('0x48')]['tag']?{'id':_0x5c528d[_0x289a('0x48')]['tag']}:undefined,'required':_0x5c528d[_0x289a('0x48')]['tag']?!![]:![]}];}return db[_0x289a('0x96')]['findAll'](_0x44fb4f);})[_0x289a('0x22')](function(_0x49e2d2){_0x4eac73[_0x289a('0x6d')]=_0x49e2d2;return _0x4eac73;});}})[_0x289a('0x22')](respondWithFilteredResult(_0x26c661,_0x44fb4f))[_0x289a('0x2c')](handleError(_0x26c661,null));};exports[_0x289a('0xb3')]=function(_0x222d28,_0x546c0a,_0x5ee218){return db[_0x289a('0x42')][_0x289a('0x5c')]({'where':{'id':_0x222d28[_0x289a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x546c0a,null))[_0x289a('0x22')](function(_0x2b5336){if(_0x2b5336){return _0x2b5336[_0x289a('0xb3')](_0x222d28[_0x289a('0x5e')][_0x289a('0xb4')],_[_0x289a('0xb5')](_0x222d28['body'],['ids','id'])||{})[_0x289a('0x97')](function(_0x47ac33){for(var _0xc6f040=0x0;_0xc6f040<_0x222d28['body'][_0x289a('0xb4')][_0x289a('0x4d')];_0xc6f040+=0x1){socket['emit'](_0x289a('0xb6'),{'UserId':_0x222d28[_0x289a('0x5e')][_0x289a('0xb4')][_0xc6f040],'OpenchannelAccountId':_0x222d28[_0x289a('0x5b')]['id']});}return _0x47ac33;});}})[_0x289a('0x22')](respondWithResult(_0x546c0a,null))[_0x289a('0x2c')](handleError(_0x546c0a,null));};exports[_0x289a('0xb7')]=function(_0x53dfd3,_0x11f661,_0x117349){return db[_0x289a('0x42')][_0x289a('0x5c')]({'where':{'id':_0x53dfd3[_0x289a('0x5b')]['id']}})[_0x289a('0x22')](handleEntityNotFound(_0x11f661,null))['then'](function(_0x53ebce){if(_0x53ebce){return _0x53ebce['removeAgents'](_0x53dfd3['query'][_0x289a('0xb4')])[_0x289a('0x22')](function(){if(_[_0x289a('0xb8')](_0x53dfd3[_0x289a('0x48')][_0x289a('0xb4')])){for(var _0x2348dd=0x0;_0x2348dd<_0x53dfd3[_0x289a('0x48')][_0x289a('0xb4')][_0x289a('0x4d')];_0x2348dd+=0x1){socket[_0x289a('0xb9')]('userOpenchannelAccount:remove',{'UserId':Number(_0x53dfd3[_0x289a('0x48')]['ids'][_0x2348dd]),'OpenchannelAccountId':Number(_0x53dfd3['params']['id'])});}}else{socket['emit'](_0x289a('0xba'),{'UserId':Number(_0x53dfd3[_0x289a('0x48')]['ids']),'OpenchannelAccountId':Number(_0x53dfd3['params']['id'])});}});}})['then'](respondWithStatusCode(_0x11f661,null))['catch'](handleError(_0x11f661,null));};exports[_0x289a('0xbb')]=function(_0x46c59f,_0x174baa,_0x5c8044){var _0x409927={};var _0x506c13={};var _0xf0db97;var _0x17904f;return db[_0x289a('0x42')][_0x289a('0x72')]({'where':{'id':_0x46c59f[_0x289a('0x5b')]['id']}})[_0x289a('0x22')](handleEntityNotFound(_0x174baa,null))[_0x289a('0x22')](function(_0x32fe60){if(_0x32fe60){_0xf0db97=_0x32fe60;_0x506c13['model']=_[_0x289a('0x47')](db[_0x289a('0xa1')]['rawAttributes']);_0x506c13[_0x289a('0x48')]=_['keys'](_0x46c59f[_0x289a('0x48')]);_0x506c13['filters']=_['intersection'](_0x506c13[_0x289a('0x46')],_0x506c13['query']);_0x409927['attributes']=_[_0x289a('0x4a')](_0x506c13[_0x289a('0x46')],qs[_0x289a('0x4b')](_0x46c59f[_0x289a('0x48')]['fields']));_0x409927['attributes']=_0x409927[_0x289a('0x4c')][_0x289a('0x4d')]?_0x409927[_0x289a('0x4c')]:_0x506c13[_0x289a('0x46')];_0x409927[_0x289a('0x51')]=qs[_0x289a('0x6a')](_0x46c59f[_0x289a('0x48')][_0x289a('0x6a')]);_0x409927['where']=qs['filters'](_['pick'](_0x46c59f['query'],_0x506c13['filters']));if(_0x46c59f[_0x289a('0x48')][_0x289a('0x55')]){_0x409927['where']=_[_0x289a('0x52')](_0x409927[_0x289a('0x53')],{'$or':_[_0x289a('0x41')](_0x409927['attributes'],function(_0x4b9384){var _0x546f53={};_0x546f53[_0x4b9384]={'$like':'%'+_0x46c59f[_0x289a('0x48')][_0x289a('0x55')]+'%'};return _0x546f53;})});}_0x409927=_[_0x289a('0x52')]({},_0x409927,_0x46c59f[_0x289a('0x56')]);return _0xf0db97['getAgents'](_0x409927);}})['then'](function(_0x24eda4){if(_0x24eda4){_0x17904f=_0x24eda4[_0x289a('0x4d')];if(!_0x46c59f[_0x289a('0x48')][_0x289a('0x4e')](_0x289a('0x4f'))){_0x409927[_0x289a('0x50')]=qs[_0x289a('0x50')](_0x46c59f[_0x289a('0x48')][_0x289a('0x50')]);_0x409927[_0x289a('0x32')]=qs[_0x289a('0x32')](_0x46c59f[_0x289a('0x48')][_0x289a('0x32')]);}return _0xf0db97['getAgents'](_0x409927);}})[_0x289a('0x22')](function(_0x5d8201){if(_0x5d8201){return _0x5d8201?{'count':_0x17904f,'rows':_0x5d8201}:null;}})['then'](respondWithResult(_0x174baa,null))[_0x289a('0x2c')](handleError(_0x174baa,null));};exports[_0x289a('0x3d')]=function(_0x43610a,_0x56f363,_0x202a39){var _0x4d7a49,_0x507925,_0x574a48;if(_['isNil'](_0x43610a['body'][_0x289a('0x5e')])||_0x43610a['body'][_0x289a('0x5e')]===''){throw new db[(_0x289a('0x76'))][(_0x289a('0x7e'))](_0x289a('0x80'));}if(_[_0x289a('0x7c')](_0x43610a[_0x289a('0x5e')]['to'])){}_0x4d7a49=_0x43610a[_0x289a('0x5e')]['to'];return db['OpenchannelAccount'][_0x289a('0x72')]({'where':{'id':_0x43610a['params']['id']}})[_0x289a('0x22')](handleEntityNotFound(_0x56f363,null))['then'](function(_0x5cebff){if(_0x5cebff){return db['OpenchannelAccount'][_0x289a('0x5c')]({'where':{'id':_0x5cebff['id']},'include':[{'model':db['CmList'],'as':_0x289a('0x85'),'include':[{'model':db[_0x289a('0x91')],'as':_0x289a('0x86'),'where':{[_0x5cebff[_0x289a('0x90')]]:_0x4d7a49},'limit':0x1,'order':[[_0x289a('0x79'),'DESC']]}]}]})[_0x289a('0x22')](handleEntityNotFound(_0x56f363,null))['then'](function(_0x1d3bbf){if(_0x1d3bbf&&_0x1d3bbf['List']){_0x507925=_0x1d3bbf['get']({'plain':!![]});if(_0x507925[_0x289a('0x85')]&&_0x507925[_0x289a('0x85')][_0x289a('0x86')][_0x289a('0x4d')]){return _0x507925[_0x289a('0x85')]['Contacts'][0x0];}return db[_0x289a('0x91')][_0x289a('0x5d')](_['defaults'](_0x43610a[_0x289a('0x5e')],{'firstName':_0x4d7a49,[_0x1d3bbf[_0x289a('0x90')]]:_0x4d7a49,'phone':_0x4d7a49,'ListId':_0x507925[_0x289a('0x7b')]}));}})['then'](handleEntityNotFound(_0x56f363,null))[_0x289a('0x22')](function(_0x4040a4){if(_0x4040a4){_0x574a48=_0x4040a4;return db['OpenchannelInteraction'][_0x289a('0x5c')]({'where':{'ContactId':_0x574a48['id'],'closed':![],'OpenchannelAccountId':_0x507925['id']}})[_0x289a('0x22')](function(_0x7d10b0){if(_0x7d10b0){return[_0x7d10b0,![]];}return db[_0x289a('0x96')][_0x289a('0x5d')]({'UserId':_0x43610a['user']['id'],'ContactId':_0x574a48['id'],'OpenchannelAccountId':_0x507925['id'],'lastMsgDirection':_0x289a('0xbc'),'Messages':[_[_0x289a('0x52')](_0x43610a[_0x289a('0x5e')],{'read':![],'body':_0x43610a[_0x289a('0x5e')][_0x289a('0x5e')],'OpenchannelAccountId':_0x507925['id'],'UserId':_0x43610a['user']['id'],'ContactId':_0x574a48['id']})]},{'include':[{'model':db[_0x289a('0xbd')],'as':_0x289a('0xbe')}]})[_0x289a('0x22')](function(_0x242523){return[_0x242523,!![]];});});}})[_0x289a('0x97')](function(_0x3ddf43,_0x3b6352){if(_0x3b6352){return _0x3ddf43;}return db['OpenchannelMessage'][_0x289a('0x5d')](_[_0x289a('0x52')](_0x43610a['body'],{'read':![],'body':_0x43610a[_0x289a('0x5e')]['body'],'OpenchannelAccountId':_0x507925['id'],'OpenchannelInteractionId':_0x3ddf43['id'],'UserId':_0x43610a[_0x289a('0x5f')]['id'],'ContactId':_0x574a48['id']}))[_0x289a('0x22')](function(_0x521630){_0x3ddf43['dataValues']['Messages']=[];_0x3ddf43[_0x289a('0xbf')][_0x289a('0xbe')][_0x289a('0xc0')](_0x521630[_0x289a('0xbf')]);return _0x3ddf43;});});}})[_0x289a('0x22')](respondWithResult(_0x56f363,null))['catch'](handleError(_0x56f363,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 23f7c30..0b01fcf 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 _0xc49f=['emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelAccount','save','update','remove'];(function(_0x4912ca,_0x1345b0){var _0x1b8006=function(_0x232d71){while(--_0x232d71){_0x4912ca['push'](_0x4912ca['shift']());}};_0x1b8006(++_0x1345b0);}(_0xc49f,0x150));var _0xfc49=function(_0x230daa,_0x2d4dd0){_0x230daa=_0x230daa-0x0;var _0x210dc5=_0xc49f[_0x230daa];return _0x210dc5;};'use strict';var EventEmitter=require(_0xfc49('0x0'));var OpenchannelAccount=require(_0xfc49('0x1'))['db'][_0xfc49('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfc49('0x3'),'afterUpdate':_0xfc49('0x4'),'afterDestroy':_0xfc49('0x5')};function emitEvent(_0x44a170){return function(_0x23bc10,_0x431148,_0x9b27c3){OpenchannelAccountEvents[_0xfc49('0x6')](_0x44a170+':'+_0x23bc10['id'],_0x23bc10);OpenchannelAccountEvents[_0xfc49('0x6')](_0x44a170,_0x23bc10);_0x9b27c3(null);};}for(var e in events){if(events[_0xfc49('0x7')](e)){var event=events[e];OpenchannelAccount[_0xfc49('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x93e2=['hook','exports','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4ddc44,_0x3602e9){var _0x410018=function(_0x514ca9){while(--_0x514ca9){_0x4ddc44['push'](_0x4ddc44['shift']());}};_0x410018(++_0x3602e9);}(_0x93e2,0xda));var _0x293e=function(_0x1ee5f3,_0x4ba4ad){_0x1ee5f3=_0x1ee5f3-0x0;var _0x11464b=_0x93e2[_0x1ee5f3];return _0x11464b;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x293e('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x293e('0x1')](0x0);var events={'afterCreate':_0x293e('0x2'),'afterUpdate':_0x293e('0x3'),'afterDestroy':_0x293e('0x4')};function emitEvent(_0x534262){return function(_0x17d9cf,_0x258ab3,_0x504e5f){OpenchannelAccountEvents[_0x293e('0x5')](_0x534262+':'+_0x17d9cf['id'],_0x17d9cf);OpenchannelAccountEvents[_0x293e('0x5')](_0x534262,_0x17d9cf);_0x504e5f(null);};}for(var e in events){if(events[_0x293e('0x6')](e)){var event=events[e];OpenchannelAccount[_0x293e('0x7')](e,emitEvent(event));}}module[_0x293e('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 46e9f34..26d34d1 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 _0xc288=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelAccount.attributes','exports','openchannel_accounts','lodash'];(function(_0x15b7e9,_0x3f2d24){var _0xdbda57=function(_0x4b5af7){while(--_0x4b5af7){_0x15b7e9['push'](_0x15b7e9['shift']());}};_0xdbda57(++_0x3f2d24);}(_0xc288,0x18b));var _0x8c28=function(_0x573a1a,_0x4042a7){_0x573a1a=_0x573a1a-0x0;var _0x31d31b=_0xc288[_0x573a1a];return _0x31d31b;};'use strict';var _=require(_0x8c28('0x0'));var util=require('util');var logger=require(_0x8c28('0x1'))(_0x8c28('0x2'));var moment=require(_0x8c28('0x3'));var BPromise=require(_0x8c28('0x4'));var rp=require(_0x8c28('0x5'));var fs=require('fs');var path=require(_0x8c28('0x6'));var rimraf=require(_0x8c28('0x7'));var config=require(_0x8c28('0x8'));var attributes=require(_0x8c28('0x9'));module[_0x8c28('0xa')]=function(_0x572d7b,_0x3d5973){return _0x572d7b['define']('OpenchannelAccount',attributes,{'tableName':_0x8c28('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb88b=['bluebird','request-promise','rimraf','exports','define','OpenchannelAccount','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb88b,0x1c8));var _0xbb88=function(_0x35aa11,_0x3ae14d){_0x35aa11=_0x35aa11-0x0;var _0x2e2dca=_0xb88b[_0x35aa11];return _0x2e2dca;};'use strict';var _=require('lodash');var util=require(_0xbb88('0x0'));var logger=require(_0xbb88('0x1'))(_0xbb88('0x2'));var moment=require('moment');var BPromise=require(_0xbb88('0x3'));var rp=require(_0xbb88('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb88('0x5'));var config=require('../../config/environment');var attributes=require('./openchannelAccount.attributes');module[_0xbb88('0x6')]=function(_0x1779ba,_0x37c149){return _0x1779ba[_0xbb88('0x7')](_0xbb88('0x8'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index 4e48b71..8c4a440 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 _0xd4ef=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash'];(function(_0x217ae8,_0x38d263){var _0xc7f25a=function(_0x529399){while(--_0x529399){_0x217ae8['push'](_0x217ae8['shift']());}};_0xc7f25a(++_0x38d263);}(_0xd4ef,0xfb));var _0xfd4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4ef[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfd4e('0x0'));var util=require(_0xfd4e('0x1'));var moment=require(_0xfd4e('0x2'));var BPromise=require(_0xfd4e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd4e('0x4'));var db=require(_0xfd4e('0x5'))['db'];var utils=require(_0xfd4e('0x6'));var logger=require(_0xfd4e('0x7'))(_0xfd4e('0x8'));var config=require(_0xfd4e('0x9'));var jayson=require(_0xfd4e('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xfd4e('0xb')]=_[_0xfd4e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfd4e('0xd'))(new Redis(config['redis']));require(_0xfd4e('0xe'))[_0xfd4e('0xf')](socket);function respondWithRpcPromise(_0x4cd99e,_0x194c5e,_0x3a95e7){return new BPromise(function(_0x393ae3,_0x178111){return client[_0xfd4e('0x10')](_0x4cd99e,_0x3a95e7)[_0xfd4e('0x11')](function(_0x2b0f83){logger[_0xfd4e('0x12')](_0xfd4e('0x13'),_0x194c5e,_0xfd4e('0x14'));logger['debug'](_0xfd4e('0x15'),_0x194c5e,_0xfd4e('0x14'),JSON[_0xfd4e('0x16')](_0x2b0f83));if(_0x2b0f83['error']){if(_0x2b0f83['error'][_0xfd4e('0x17')]===0x1f4){logger[_0xfd4e('0x18')](_0xfd4e('0x13'),_0x194c5e,_0x2b0f83[_0xfd4e('0x18')][_0xfd4e('0x19')]);return _0x178111(_0x2b0f83[_0xfd4e('0x18')][_0xfd4e('0x19')]);}logger[_0xfd4e('0x18')](_0xfd4e('0x13'),_0x194c5e,_0x2b0f83[_0xfd4e('0x18')][_0xfd4e('0x19')]);return _0x393ae3(_0x2b0f83[_0xfd4e('0x18')]['message']);}else{logger[_0xfd4e('0x12')](_0xfd4e('0x13'),_0x194c5e,_0xfd4e('0x14'));_0x393ae3(_0x2b0f83[_0xfd4e('0x1a')][_0xfd4e('0x19')]);}})[_0xfd4e('0x1b')](function(_0x532ab6){logger['error'](_0xfd4e('0x13'),_0x194c5e,_0x532ab6);_0x178111(_0x532ab6);});});} \ No newline at end of file +var _0x0199=['result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x439814,_0x56a621){var _0x3c6bf5=function(_0xb7c39a){while(--_0xb7c39a){_0x439814['push'](_0x439814['shift']());}};_0x3c6bf5(++_0x56a621);}(_0x0199,0xaa));var _0x9019=function(_0x5a618d,_0x305384){_0x5a618d=_0x5a618d-0x0;var _0xe0298f=_0x0199[_0x5a618d];return _0xe0298f;};'use strict';var _=require(_0x9019('0x0'));var util=require(_0x9019('0x1'));var moment=require('moment');var BPromise=require(_0x9019('0x2'));var rs=require(_0x9019('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9019('0x4'))['db'];var utils=require(_0x9019('0x5'));var logger=require('../../config/logger')(_0x9019('0x6'));var config=require('../../config/environment');var jayson=require(_0x9019('0x7'));var client=jayson[_0x9019('0x8')][_0x9019('0x9')]({'port':0x232a});config[_0x9019('0xa')]=_[_0x9019('0xb')](config[_0x9019('0xa')],{'host':_0x9019('0xc'),'port':0x18eb});var socket=require(_0x9019('0xd'))(new Redis(config[_0x9019('0xa')]));require('./openchannelAccount.socket')[_0x9019('0xe')](socket);function respondWithRpcPromise(_0x1506d3,_0x375ce4,_0x3bb697){return new BPromise(function(_0x4584b6,_0x1be347){return client[_0x9019('0xf')](_0x1506d3,_0x3bb697)['then'](function(_0x373fce){logger[_0x9019('0x10')](_0x9019('0x11'),_0x375ce4,_0x9019('0x12'));logger['debug'](_0x9019('0x13'),_0x375ce4,_0x9019('0x12'),JSON['stringify'](_0x373fce));if(_0x373fce[_0x9019('0x14')]){if(_0x373fce['error']['code']===0x1f4){logger[_0x9019('0x14')](_0x9019('0x11'),_0x375ce4,_0x373fce[_0x9019('0x14')][_0x9019('0x15')]);return _0x1be347(_0x373fce['error'][_0x9019('0x15')]);}logger[_0x9019('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x375ce4,_0x373fce[_0x9019('0x14')][_0x9019('0x15')]);return _0x4584b6(_0x373fce[_0x9019('0x14')][_0x9019('0x15')]);}else{logger[_0x9019('0x10')](_0x9019('0x11'),_0x375ce4,_0x9019('0x12'));_0x4584b6(_0x373fce[_0x9019('0x16')][_0x9019('0x15')]);}})[_0x9019('0x17')](function(_0x4a1758){logger[_0x9019('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x375ce4,_0x4a1758);_0x1be347(_0x4a1758);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 7c31a4d..f98b3ff 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 _0x670a=['remove','update','removeListener','register','length','openchannelAccount:'];(function(_0x490ecf,_0x3e8df4){var _0x157f7c=function(_0xbaf021){while(--_0xbaf021){_0x490ecf['push'](_0x490ecf['shift']());}};_0x157f7c(++_0x3e8df4);}(_0x670a,0x186));var _0xa670=function(_0x25d0af,_0x2a614e){_0x25d0af=_0x25d0af-0x0;var _0x28ae43=_0x670a[_0x25d0af];return _0x28ae43;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0xa670('0x0'),_0xa670('0x1')];function createListener(_0x39dc7a,_0x41ff65){return function(_0x5ef4da){_0x41ff65['emit'](_0x39dc7a,_0x5ef4da);};}function removeListener(_0x196fa8,_0x491a73){return function(){OpenchannelAccountEvents[_0xa670('0x2')](_0x196fa8,_0x491a73);};}exports[_0xa670('0x3')]=function(_0x2a3fda){for(var _0x3cab7=0x0,_0x82be19=events[_0xa670('0x4')];_0x3cab7<_0x82be19;_0x3cab7++){var _0x5c27cf=events[_0x3cab7];var _0x3863eb=createListener(_0xa670('0x5')+_0x5c27cf,_0x2a3fda);OpenchannelAccountEvents['on'](_0x5c27cf,_0x3863eb);}}; \ No newline at end of file +var _0xcf60=['removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save','update','emit'];(function(_0x100894,_0x416617){var _0x522185=function(_0x4fe879){while(--_0x4fe879){_0x100894['push'](_0x100894['shift']());}};_0x522185(++_0x416617);}(_0xcf60,0x15c));var _0x0cf6=function(_0x3e74cc,_0xfd29a4){_0x3e74cc=_0x3e74cc-0x0;var _0x4f327a=_0xcf60[_0x3e74cc];return _0x4f327a;};'use strict';var OpenchannelAccountEvents=require(_0x0cf6('0x0'));var events=[_0x0cf6('0x1'),'remove',_0x0cf6('0x2')];function createListener(_0x59e1da,_0x1834aa){return function(_0x5604b8){_0x1834aa[_0x0cf6('0x3')](_0x59e1da,_0x5604b8);};}function removeListener(_0x2ef43f,_0x5b68e5){return function(){OpenchannelAccountEvents[_0x0cf6('0x4')](_0x2ef43f,_0x5b68e5);};}exports[_0x0cf6('0x5')]=function(_0xaf94e0){for(var _0x4d725b=0x0,_0x316365=events[_0x0cf6('0x6')];_0x4d725b<_0x316365;_0x4d725b++){var _0x38b064=events[_0x4d725b];var _0x42692c=createListener(_0x0cf6('0x7')+_0x38b064,_0xaf94e0);OpenchannelAccountEvents['on'](_0x38b064,_0x42692c);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index f0cdcbc..ec0c769 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 _0x46e3=['update','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0x402453,_0x27cca6){var _0x11b0d8=function(_0x1b395d){while(--_0x1b395d){_0x402453['push'](_0x402453['shift']());}};_0x11b0d8(++_0x27cca6);}(_0x46e3,0x88));var _0x346e=function(_0x2ff550,_0x2e9776){_0x2ff550=_0x2ff550-0x0;var _0x42fe44=_0x46e3[_0x2ff550];return _0x42fe44;};'use strict';var multer=require(_0x346e('0x0'));var util=require(_0x346e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x346e('0x2'));var router=express[_0x346e('0x3')]();var auth=require(_0x346e('0x4'));var interaction=require(_0x346e('0x5'));var config=require(_0x346e('0x6'));var controller=require(_0x346e('0x7'));router[_0x346e('0x8')]('/',auth[_0x346e('0x9')](),controller[_0x346e('0xa')]);router[_0x346e('0x8')]('/:id',auth[_0x346e('0x9')](),controller[_0x346e('0xb')]);router[_0x346e('0xc')]('/',auth[_0x346e('0x9')](),controller[_0x346e('0xd')]);router[_0x346e('0xe')](_0x346e('0xf'),auth[_0x346e('0x9')](),controller[_0x346e('0x10')]);router['delete']('/:id',auth[_0x346e('0x9')](),controller[_0x346e('0x11')]);module[_0x346e('0x12')]=router; \ No newline at end of file +var _0x7364=['../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','post','create','put','/:id','update','delete','destroy','multer','express','Router','../../components/auth/service'];(function(_0x37d8cc,_0x54da30){var _0x394775=function(_0x3cfdcf){while(--_0x3cfdcf){_0x37d8cc['push'](_0x37d8cc['shift']());}};_0x394775(++_0x54da30);}(_0x7364,0x173));var _0x4736=function(_0x50a1b8,_0x296145){_0x50a1b8=_0x50a1b8-0x0;var _0x312f64=_0x7364[_0x50a1b8];return _0x312f64;};'use strict';var multer=require(_0x4736('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4736('0x1'));var router=express[_0x4736('0x2')]();var auth=require(_0x4736('0x3'));var interaction=require(_0x4736('0x4'));var config=require('../../config/environment');var controller=require(_0x4736('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4736('0x6')]('/:id',auth[_0x4736('0x7')](),controller['show']);router[_0x4736('0x8')]('/',auth[_0x4736('0x7')](),controller[_0x4736('0x9')]);router[_0x4736('0xa')](_0x4736('0xb'),auth[_0x4736('0x7')](),controller[_0x4736('0xc')]);router[_0x4736('0xd')](_0x4736('0xb'),auth[_0x4736('0x7')](),controller[_0x4736('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index edabb8f..0c5049b 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 _0x350f=['TEXT','*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x350f,0xe0));var _0xf350=function(_0x389832,_0x10a4a9){_0x389832=_0x389832-0x0;var _0x59429e=_0x350f[_0x389832];return _0x59429e;};'use strict';var Sequelize=require(_0xf350('0x0'));module[_0xf350('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf350('0x2')],'allowNull':![],'defaultValue':_0xf350('0x3')},'appdata':{'type':Sequelize[_0xf350('0x4')]()},'description':{'type':Sequelize[_0xf350('0x2')]},'interval':{'type':Sequelize[_0xf350('0x2')],'defaultValue':_0xf350('0x5')}}; \ No newline at end of file +var _0x12d4=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x115401,_0x551e31){var _0xaed85=function(_0x49dc7b){while(--_0x49dc7b){_0x115401['push'](_0x115401['shift']());}};_0xaed85(++_0x551e31);}(_0x12d4,0x164));var _0x412d=function(_0x57975f,_0x388556){_0x57975f=_0x57975f-0x0;var _0x4793b8=_0x12d4[_0x57975f];return _0x4793b8;};'use strict';var Sequelize=require(_0x412d('0x0'));module[_0x412d('0x1')]={'priority':{'type':Sequelize[_0x412d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x412d('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x412d('0x4')]()},'description':{'type':Sequelize[_0x412d('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x412d('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index a5a2701..025a5bd 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 _0x7e16=['desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','count','offset','limit','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','name','index','map','OpenchannelApplication','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','where','merge','VIRTUAL','filter','findAll','catch','show','include','options','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x16b19e,_0x59877d){var _0x49a970=function(_0x5106c0){while(--_0x5106c0){_0x16b19e['push'](_0x16b19e['shift']());}};_0x49a970(++_0x59877d);}(_0x7e16,0x78));var _0x67e1=function(_0x1ec4a0,_0x1c2001){_0x1ec4a0=_0x1ec4a0-0x0;var _0x40ca58=_0x7e16[_0x1ec4a0];return _0x40ca58;};'use strict';var pdf=require(_0x67e1('0x0'));var emlformat=require(_0x67e1('0x1'));var rimraf=require(_0x67e1('0x2'));var zipdir=require(_0x67e1('0x3'));var jsonpatch=require(_0x67e1('0x4'));var rp=require(_0x67e1('0x5'));var moment=require(_0x67e1('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x67e1('0x7'));var path=require('path');var sox=require(_0x67e1('0x8'));var csv=require(_0x67e1('0x9'));var ejs=require(_0x67e1('0xa'));var fs=require('fs');var _=require(_0x67e1('0xb'));var squel=require(_0x67e1('0xc'));var crypto=require(_0x67e1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x67e1('0xe'));var toCsv=require(_0x67e1('0x9'));var querystring=require('querystring');var Papa=require(_0x67e1('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x67e1('0x10'));var as=require(_0x67e1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x67e1('0x12'));var utils=require(_0x67e1('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x67e1('0x14'));var db=require(_0x67e1('0x15'))['db'];function respondWithStatusCode(_0x54a489,_0x9cc724){_0x9cc724=_0x9cc724||0xcc;return function(_0x5db7d2){if(_0x5db7d2){return _0x54a489['sendStatus'](_0x9cc724);}return _0x54a489['status'](_0x9cc724)[_0x67e1('0x16')]();};}function respondWithResult(_0x45e0d5,_0x48656b){_0x48656b=_0x48656b||0xc8;return function(_0x41e850){if(_0x41e850){return _0x45e0d5[_0x67e1('0x17')](_0x48656b)['json'](_0x41e850);}};}function respondWithFilteredResult(_0x3834f3,_0xa9b47c){return function(_0x282903){if(_0x282903){var _0x5e4fe9=_0x282903[_0x67e1('0x18')],_0x5e9973=_0xa9b47c[_0x67e1('0x19')],_0x39caee=_0xa9b47c[_0x67e1('0x19')]+_0xa9b47c[_0x67e1('0x1a')],_0x2b7b6b;if(_0x39caee>=_0x5e4fe9){_0x39caee=_0x5e4fe9;_0x2b7b6b=0xc8;}else{_0x2b7b6b=0xce;}_0x3834f3[_0x67e1('0x17')](_0x2b7b6b);return _0x3834f3['set'](_0x67e1('0x1b'),_0x5e9973+'-'+_0x39caee+'/'+_0x5e4fe9)[_0x67e1('0x1c')](_0x282903);}return null;};}function patchUpdates(_0x34edbf){return function(_0x135065){try{jsonpatch[_0x67e1('0x1d')](_0x135065,_0x34edbf,!![]);}catch(_0x308687){return BPromise['reject'](_0x308687);}return _0x135065[_0x67e1('0x1e')]();};}function saveUpdates(_0x1843f4,_0x563127){return function(_0x55cb2c){if(_0x55cb2c){return _0x55cb2c[_0x67e1('0x1f')](_0x1843f4)[_0x67e1('0x20')](function(_0x23d779){return _0x23d779;});}return null;};}function removeEntity(_0x288602,_0x27cec0){return function(_0x104cb2){if(_0x104cb2){return _0x104cb2[_0x67e1('0x21')]()[_0x67e1('0x20')](function(){_0x288602[_0x67e1('0x17')](0xcc)[_0x67e1('0x16')]();});}};}function handleEntityNotFound(_0x4cca63,_0x177d79){return function(_0x5dbe58){if(!_0x5dbe58){_0x4cca63[_0x67e1('0x22')](0x194);}return _0x5dbe58;};}function handleError(_0x54fa5b,_0x34e398){_0x34e398=_0x34e398||0x1f4;return function(_0x299904){logger[_0x67e1('0x23')](_0x299904['stack']);if(_0x299904['name']){delete _0x299904[_0x67e1('0x24')];}_0x54fa5b[_0x67e1('0x17')](_0x34e398)['send'](_0x299904);};}exports[_0x67e1('0x25')]=function(_0x4a2c9d,_0x3a56c8){var _0x23bf3d={},_0x370223={},_0x3259d0={'count':0x0,'rows':[]};var _0x58c796=_[_0x67e1('0x26')](db[_0x67e1('0x27')][_0x67e1('0x28')],function(_0x462c66){return{'name':_0x462c66[_0x67e1('0x29')],'type':_0x462c66['type'][_0x67e1('0x2a')]};});_0x370223[_0x67e1('0x2b')]=_['map'](_0x58c796,_0x67e1('0x24'));_0x370223['query']=_[_0x67e1('0x2c')](_0x4a2c9d[_0x67e1('0x2d')]);_0x370223[_0x67e1('0x2e')]=_[_0x67e1('0x2f')](_0x370223[_0x67e1('0x2b')],_0x370223['query']);_0x23bf3d[_0x67e1('0x30')]=_[_0x67e1('0x2f')](_0x370223['model'],qs[_0x67e1('0x31')](_0x4a2c9d[_0x67e1('0x2d')]['fields']));_0x23bf3d[_0x67e1('0x30')]=_0x23bf3d[_0x67e1('0x30')][_0x67e1('0x32')]?_0x23bf3d[_0x67e1('0x30')]:_0x370223[_0x67e1('0x2b')];if(!_0x4a2c9d[_0x67e1('0x2d')][_0x67e1('0x33')]('nolimit')){_0x23bf3d[_0x67e1('0x1a')]=qs[_0x67e1('0x1a')](_0x4a2c9d[_0x67e1('0x2d')][_0x67e1('0x1a')]);_0x23bf3d[_0x67e1('0x19')]=qs[_0x67e1('0x19')](_0x4a2c9d[_0x67e1('0x2d')][_0x67e1('0x19')]);}_0x23bf3d['order']=qs[_0x67e1('0x34')](_0x4a2c9d['query']['sort']);_0x23bf3d['where']=qs[_0x67e1('0x2e')](_[_0x67e1('0x35')](_0x4a2c9d[_0x67e1('0x2d')],_0x370223[_0x67e1('0x2e')]),_0x58c796);if(_0x4a2c9d['query']['filter']){_0x23bf3d[_0x67e1('0x36')]=_[_0x67e1('0x37')](_0x23bf3d['where'],{'$or':_['map'](_0x58c796,function(_0x25b90f){if(_0x25b90f['type']!==_0x67e1('0x38')){var _0x1b4ed2={};_0x1b4ed2[_0x25b90f['name']]={'$like':'%'+_0x4a2c9d[_0x67e1('0x2d')][_0x67e1('0x39')]+'%'};return _0x1b4ed2;}})});}_0x23bf3d=_[_0x67e1('0x37')]({},_0x23bf3d,_0x4a2c9d['options']);var _0x1f03dc={'where':_0x23bf3d[_0x67e1('0x36')]};return db[_0x67e1('0x27')]['count'](_0x1f03dc)[_0x67e1('0x20')](function(_0x5d893b){_0x3259d0[_0x67e1('0x18')]=_0x5d893b;if(_0x4a2c9d[_0x67e1('0x2d')]['includeAll']){_0x23bf3d['include']=[{'all':!![]}];}return db[_0x67e1('0x27')][_0x67e1('0x3a')](_0x23bf3d);})[_0x67e1('0x20')](function(_0xa4b391){_0x3259d0['rows']=_0xa4b391;return _0x3259d0;})[_0x67e1('0x20')](respondWithFilteredResult(_0x3a56c8,_0x23bf3d))[_0x67e1('0x3b')](handleError(_0x3a56c8,null));};exports[_0x67e1('0x3c')]=function(_0x49119e,_0xa5d1fa){var _0x769a92={'raw':!![],'where':{'id':_0x49119e['params']['id']}},_0x1bd34b={};_0x1bd34b['model']=_[_0x67e1('0x2c')](db[_0x67e1('0x27')][_0x67e1('0x28')]);_0x1bd34b['query']=_[_0x67e1('0x2c')](_0x49119e[_0x67e1('0x2d')]);_0x1bd34b[_0x67e1('0x2e')]=_[_0x67e1('0x2f')](_0x1bd34b[_0x67e1('0x2b')],_0x1bd34b['query']);_0x769a92[_0x67e1('0x30')]=_[_0x67e1('0x2f')](_0x1bd34b[_0x67e1('0x2b')],qs[_0x67e1('0x31')](_0x49119e[_0x67e1('0x2d')]['fields']));_0x769a92[_0x67e1('0x30')]=_0x769a92[_0x67e1('0x30')]['length']?_0x769a92['attributes']:_0x1bd34b[_0x67e1('0x2b')];if(_0x49119e[_0x67e1('0x2d')]['includeAll']){_0x769a92[_0x67e1('0x3d')]=[{'all':!![]}];}_0x769a92=_[_0x67e1('0x37')]({},_0x769a92,_0x49119e[_0x67e1('0x3e')]);return db['OpenchannelApplication'][_0x67e1('0x3f')](_0x769a92)[_0x67e1('0x20')](handleEntityNotFound(_0xa5d1fa,null))[_0x67e1('0x20')](respondWithResult(_0xa5d1fa,null))[_0x67e1('0x3b')](handleError(_0xa5d1fa,null));};exports[_0x67e1('0x40')]=function(_0x5b783f,_0x4885f9){return db[_0x67e1('0x27')][_0x67e1('0x40')](_0x5b783f[_0x67e1('0x41')],{})[_0x67e1('0x20')](respondWithResult(_0x4885f9,0xc9))[_0x67e1('0x3b')](handleError(_0x4885f9,null));};exports[_0x67e1('0x1f')]=function(_0x475f01,_0x3685ec){if(_0x475f01['body']['id']){delete _0x475f01[_0x67e1('0x41')]['id'];}return db[_0x67e1('0x27')]['find']({'where':{'id':_0x475f01[_0x67e1('0x42')]['id']}})[_0x67e1('0x20')](handleEntityNotFound(_0x3685ec,null))[_0x67e1('0x20')](saveUpdates(_0x475f01[_0x67e1('0x41')],null))[_0x67e1('0x20')](respondWithResult(_0x3685ec,null))[_0x67e1('0x3b')](handleError(_0x3685ec,null));};exports[_0x67e1('0x21')]=function(_0x47a574,_0x383f34){return db[_0x67e1('0x27')]['find']({'where':{'id':_0x47a574['params']['id']}})['then'](handleEntityNotFound(_0x383f34,null))['then'](removeEntity(_0x383f34,null))['catch'](handleError(_0x383f34,null));}; \ No newline at end of file +var _0x486a=['offset','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','index','map','OpenchannelApplication','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','rawAttributes','length','find','create','body','update','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','end'];(function(_0x42fcbf,_0x18ad3a){var _0x124536=function(_0x3c5461){while(--_0x3c5461){_0x42fcbf['push'](_0x42fcbf['shift']());}};_0x124536(++_0x18ad3a);}(_0x486a,0x79));var _0xa486=function(_0x3f70cd,_0x6bf4ed){_0x3f70cd=_0x3f70cd-0x0;var _0x3feb93=_0x486a[_0x3f70cd];return _0x3feb93;};'use strict';var pdf=require(_0xa486('0x0'));var emlformat=require(_0xa486('0x1'));var rimraf=require(_0xa486('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa486('0x3'));var rp=require(_0xa486('0x4'));var moment=require('moment');var BPromise=require(_0xa486('0x5'));var Mustache=require(_0xa486('0x6'));var util=require(_0xa486('0x7'));var path=require(_0xa486('0x8'));var sox=require(_0xa486('0x9'));var csv=require('to-csv');var ejs=require(_0xa486('0xa'));var fs=require('fs');var _=require(_0xa486('0xb'));var squel=require(_0xa486('0xc'));var crypto=require(_0xa486('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa486('0xe'));var toCsv=require(_0xa486('0xf'));var querystring=require(_0xa486('0x10'));var Papa=require(_0xa486('0x11'));var Redis=require(_0xa486('0x12'));var authService=require(_0xa486('0x13'));var qs=require(_0xa486('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa486('0x15'))(_0xa486('0x16'));var utils=require(_0xa486('0x17'));var config=require(_0xa486('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cf65c,_0x505226){_0x505226=_0x505226||0xcc;return function(_0x25dbbb){if(_0x25dbbb){return _0x5cf65c['sendStatus'](_0x505226);}return _0x5cf65c[_0xa486('0x19')](_0x505226)[_0xa486('0x1a')]();};}function respondWithResult(_0x5a5b8e,_0x3ecb92){_0x3ecb92=_0x3ecb92||0xc8;return function(_0x1a9f38){if(_0x1a9f38){return _0x5a5b8e['status'](_0x3ecb92)['json'](_0x1a9f38);}};}function respondWithFilteredResult(_0x565b4a,_0x1ef508){return function(_0x176127){if(_0x176127){var _0x6a2697=_0x176127['count'],_0x689d3a=_0x1ef508['offset'],_0x3e2df2=_0x1ef508[_0xa486('0x1b')]+_0x1ef508[_0xa486('0x1c')],_0x3c2c81;if(_0x3e2df2>=_0x6a2697){_0x3e2df2=_0x6a2697;_0x3c2c81=0xc8;}else{_0x3c2c81=0xce;}_0x565b4a[_0xa486('0x19')](_0x3c2c81);return _0x565b4a[_0xa486('0x1d')](_0xa486('0x1e'),_0x689d3a+'-'+_0x3e2df2+'/'+_0x6a2697)['json'](_0x176127);}return null;};}function patchUpdates(_0x295bc3){return function(_0x299353){try{jsonpatch[_0xa486('0x1f')](_0x299353,_0x295bc3,!![]);}catch(_0x4a7e75){return BPromise[_0xa486('0x20')](_0x4a7e75);}return _0x299353[_0xa486('0x21')]();};}function saveUpdates(_0x1108d7,_0x2d1cc0){return function(_0x3b8466){if(_0x3b8466){return _0x3b8466['update'](_0x1108d7)[_0xa486('0x22')](function(_0x3dd30a){return _0x3dd30a;});}return null;};}function removeEntity(_0x34ce1e,_0x499fe3){return function(_0x2491b1){if(_0x2491b1){return _0x2491b1[_0xa486('0x23')]()[_0xa486('0x22')](function(){_0x34ce1e[_0xa486('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c8cc8,_0x1784f5){return function(_0xb0bd4c){if(!_0xb0bd4c){_0x2c8cc8[_0xa486('0x24')](0x194);}return _0xb0bd4c;};}function handleError(_0x44b42f,_0x49f4ac){_0x49f4ac=_0x49f4ac||0x1f4;return function(_0x3b35a4){logger[_0xa486('0x25')](_0x3b35a4['stack']);if(_0x3b35a4[_0xa486('0x26')]){delete _0x3b35a4[_0xa486('0x26')];}_0x44b42f[_0xa486('0x19')](_0x49f4ac)[_0xa486('0x27')](_0x3b35a4);};}exports[_0xa486('0x28')]=function(_0x3ad91d,_0x59ddf3){var _0x289ef3={},_0x14d71d={},_0xe7d5a5={'count':0x0,'rows':[]};var _0x2eb364=_[_0xa486('0x29')](db[_0xa486('0x2a')]['rawAttributes'],function(_0x2071cf){return{'name':_0x2071cf['fieldName'],'type':_0x2071cf[_0xa486('0x2b')][_0xa486('0x2c')]};});_0x14d71d[_0xa486('0x2d')]=_[_0xa486('0x29')](_0x2eb364,_0xa486('0x26'));_0x14d71d[_0xa486('0x2e')]=_[_0xa486('0x2f')](_0x3ad91d[_0xa486('0x2e')]);_0x14d71d[_0xa486('0x30')]=_[_0xa486('0x31')](_0x14d71d[_0xa486('0x2d')],_0x14d71d[_0xa486('0x2e')]);_0x289ef3[_0xa486('0x32')]=_[_0xa486('0x31')](_0x14d71d['model'],qs[_0xa486('0x33')](_0x3ad91d[_0xa486('0x2e')]['fields']));_0x289ef3[_0xa486('0x32')]=_0x289ef3['attributes']['length']?_0x289ef3[_0xa486('0x32')]:_0x14d71d[_0xa486('0x2d')];if(!_0x3ad91d['query'][_0xa486('0x34')](_0xa486('0x35'))){_0x289ef3[_0xa486('0x1c')]=qs[_0xa486('0x1c')](_0x3ad91d['query']['limit']);_0x289ef3[_0xa486('0x1b')]=qs[_0xa486('0x1b')](_0x3ad91d[_0xa486('0x2e')][_0xa486('0x1b')]);}_0x289ef3['order']=qs[_0xa486('0x36')](_0x3ad91d['query'][_0xa486('0x36')]);_0x289ef3[_0xa486('0x37')]=qs[_0xa486('0x30')](_[_0xa486('0x38')](_0x3ad91d[_0xa486('0x2e')],_0x14d71d[_0xa486('0x30')]),_0x2eb364);if(_0x3ad91d[_0xa486('0x2e')][_0xa486('0x39')]){_0x289ef3['where']=_[_0xa486('0x3a')](_0x289ef3[_0xa486('0x37')],{'$or':_[_0xa486('0x29')](_0x2eb364,function(_0x4608b2){if(_0x4608b2[_0xa486('0x2b')]!==_0xa486('0x3b')){var _0x2e4b69={};_0x2e4b69[_0x4608b2[_0xa486('0x26')]]={'$like':'%'+_0x3ad91d['query'][_0xa486('0x39')]+'%'};return _0x2e4b69;}})});}_0x289ef3=_[_0xa486('0x3a')]({},_0x289ef3,_0x3ad91d['options']);var _0x5cb577={'where':_0x289ef3[_0xa486('0x37')]};return db[_0xa486('0x2a')][_0xa486('0x3c')](_0x5cb577)[_0xa486('0x22')](function(_0x581d9c){_0xe7d5a5[_0xa486('0x3c')]=_0x581d9c;if(_0x3ad91d[_0xa486('0x2e')][_0xa486('0x3d')]){_0x289ef3[_0xa486('0x3e')]=[{'all':!![]}];}return db[_0xa486('0x2a')][_0xa486('0x3f')](_0x289ef3);})[_0xa486('0x22')](function(_0xd0931a){_0xe7d5a5[_0xa486('0x40')]=_0xd0931a;return _0xe7d5a5;})[_0xa486('0x22')](respondWithFilteredResult(_0x59ddf3,_0x289ef3))[_0xa486('0x41')](handleError(_0x59ddf3,null));};exports[_0xa486('0x42')]=function(_0x10769f,_0x326942){var _0x26e0e0={'raw':!![],'where':{'id':_0x10769f['params']['id']}},_0x2748fa={};_0x2748fa[_0xa486('0x2d')]=_[_0xa486('0x2f')](db['OpenchannelApplication'][_0xa486('0x43')]);_0x2748fa[_0xa486('0x2e')]=_['keys'](_0x10769f[_0xa486('0x2e')]);_0x2748fa[_0xa486('0x30')]=_[_0xa486('0x31')](_0x2748fa['model'],_0x2748fa[_0xa486('0x2e')]);_0x26e0e0[_0xa486('0x32')]=_[_0xa486('0x31')](_0x2748fa[_0xa486('0x2d')],qs[_0xa486('0x33')](_0x10769f['query'][_0xa486('0x33')]));_0x26e0e0['attributes']=_0x26e0e0[_0xa486('0x32')][_0xa486('0x44')]?_0x26e0e0[_0xa486('0x32')]:_0x2748fa[_0xa486('0x2d')];if(_0x10769f[_0xa486('0x2e')][_0xa486('0x3d')]){_0x26e0e0[_0xa486('0x3e')]=[{'all':!![]}];}_0x26e0e0=_[_0xa486('0x3a')]({},_0x26e0e0,_0x10769f['options']);return db[_0xa486('0x2a')][_0xa486('0x45')](_0x26e0e0)[_0xa486('0x22')](handleEntityNotFound(_0x326942,null))['then'](respondWithResult(_0x326942,null))[_0xa486('0x41')](handleError(_0x326942,null));};exports[_0xa486('0x46')]=function(_0x2f8ee4,_0x3f3dec){return db[_0xa486('0x2a')][_0xa486('0x46')](_0x2f8ee4[_0xa486('0x47')],{})[_0xa486('0x22')](respondWithResult(_0x3f3dec,0xc9))['catch'](handleError(_0x3f3dec,null));};exports[_0xa486('0x48')]=function(_0x5e0bbd,_0x14d2fb){if(_0x5e0bbd[_0xa486('0x47')]['id']){delete _0x5e0bbd['body']['id'];}return db[_0xa486('0x2a')][_0xa486('0x45')]({'where':{'id':_0x5e0bbd[_0xa486('0x49')]['id']}})[_0xa486('0x22')](handleEntityNotFound(_0x14d2fb,null))['then'](saveUpdates(_0x5e0bbd[_0xa486('0x47')],null))[_0xa486('0x22')](respondWithResult(_0x14d2fb,null))[_0xa486('0x41')](handleError(_0x14d2fb,null));};exports['destroy']=function(_0x2ce638,_0x177696){return db[_0xa486('0x2a')]['find']({'where':{'id':_0x2ce638[_0xa486('0x49')]['id']}})[_0xa486('0x22')](handleEntityNotFound(_0x177696,null))[_0xa486('0x22')](removeEntity(_0x177696,null))[_0xa486('0x41')](handleError(_0x177696,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 3f65bac..3451f8b 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 _0xf921=['./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x358dd8,_0xb20f80){var _0x56e53c=function(_0x4a78b9){while(--_0x4a78b9){_0x358dd8['push'](_0x358dd8['shift']());}};_0x56e53c(++_0xb20f80);}(_0xf921,0x199));var _0x1f92=function(_0x31e5cb,_0x2f5adf){_0x31e5cb=_0x31e5cb-0x0;var _0x4170df=_0xf921[_0x31e5cb];return _0x4170df;};'use strict';var _=require(_0x1f92('0x0'));var util=require(_0x1f92('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x1f92('0x2'));var rp=require(_0x1f92('0x3'));var fs=require('fs');var path=require(_0x1f92('0x4'));var rimraf=require(_0x1f92('0x5'));var config=require(_0x1f92('0x6'));var attributes=require(_0x1f92('0x7'));module[_0x1f92('0x8')]=function(_0x4b04a5,_0x3171ad){return _0x4b04a5[_0x1f92('0x9')]('OpenchannelApplication',attributes,{'tableName':_0x1f92('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1f92('0xb'),'collate':_0x1f92('0xc')});}; \ No newline at end of file +var _0x6751=['./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x6751,0xbc));var _0x1675=function(_0x1ee62e,_0x159bb2){_0x1ee62e=_0x1ee62e-0x0;var _0x27c6c8=_0x6751[_0x1ee62e];return _0x27c6c8;};'use strict';var _=require(_0x1675('0x0'));var util=require(_0x1675('0x1'));var logger=require(_0x1675('0x2'))(_0x1675('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1675('0x4'));var rimraf=require(_0x1675('0x5'));var config=require(_0x1675('0x6'));var attributes=require(_0x1675('0x7'));module[_0x1675('0x8')]=function(_0xf2be07,_0x3ad5c3){return _0xf2be07[_0x1675('0x9')]('OpenchannelApplication',attributes,{'tableName':_0x1675('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1675('0xb'),'collate':_0x1675('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 0dc939e..52c85b5 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(_0x5a103e,_0x2f3d20){var _0x57700a=function(_0x3b389b){while(--_0x3b389b){_0x5a103e['push'](_0x5a103e['shift']());}};_0x57700a(++_0x2f3d20);}(_0xb10b,0x12a));var _0xbb10=function(_0x55d7c2,_0x4ce6fb){_0x55d7c2=_0x55d7c2-0x0;var _0x1755ef=_0xb10b[_0x55d7c2];return _0x1755ef;};'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(_0x53fe34,_0x2a6e2b){var _0x5d124a=function(_0x438b29){while(--_0x438b29){_0x53fe34['push'](_0x53fe34['shift']());}};_0x5d124a(++_0x2a6e2b);}(_0xb10b,0x12a));var _0xbb10=function(_0x368c85,_0x586b0a){_0x368c85=_0x368c85-0x0;var _0x3477c2=_0xb10b[_0x368c85];return _0x3477c2;};'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 58c6f69..7d677ad 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 _0x35fb=['/:id','openchannelinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','show','getMessages','download','post','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannel','openchannelinteraction:update','update','delete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x35fb,0x9f));var _0xb35f=function(_0xed4881,_0x45771c){_0xed4881=_0xed4881-0x0;var _0x7fcbd5=_0x35fb[_0xed4881];return _0x7fcbd5;};'use strict';var multer=require(_0xb35f('0x0'));var util=require(_0xb35f('0x1'));var path=require(_0xb35f('0x2'));var timeout=require(_0xb35f('0x3'));var express=require(_0xb35f('0x4'));var router=express[_0xb35f('0x5')]();var auth=require(_0xb35f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb35f('0x7'));var controller=require(_0xb35f('0x8'));router[_0xb35f('0x9')]('/',auth[_0xb35f('0xa')](),controller[_0xb35f('0xb')]);router[_0xb35f('0x9')](_0xb35f('0xc'),auth[_0xb35f('0xa')](),controller[_0xb35f('0xd')]);router[_0xb35f('0x9')]('/:id',auth[_0xb35f('0xa')](),controller[_0xb35f('0xe')]);router[_0xb35f('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0xb35f('0xf')]);router[_0xb35f('0x9')]('/:id/download',auth[_0xb35f('0xa')](),controller[_0xb35f('0x10')]);router['post']('/',auth[_0xb35f('0xa')](),controller['create']);router[_0xb35f('0x11')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0xb35f('0x11')](_0xb35f('0x12'),auth[_0xb35f('0xa')](),interaction[_0xb35f('0x13')]('openchannel',_0xb35f('0x14')),controller[_0xb35f('0x15')]);router[_0xb35f('0x16')]('/:id',auth[_0xb35f('0xa')](),interaction[_0xb35f('0x13')](_0xb35f('0x17'),_0xb35f('0x18')),controller[_0xb35f('0x19')]);router[_0xb35f('0x1a')](_0xb35f('0x1b'),auth[_0xb35f('0xa')](),interaction['tracked'](_0xb35f('0x17'),_0xb35f('0x1c')),controller['destroy']);router['delete'](_0xb35f('0x12'),auth['isAuthenticated'](),controller[_0xb35f('0x1d')]);module[_0xb35f('0x1e')]=router; \ No newline at end of file +var _0x75f0=['/:id','show','/:id/messages','download','post','create','addMessage','/:id/tags','tracked','openchannel','addTags','put','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','/describe','isAuthenticated'];(function(_0x291fea,_0x14e2f2){var _0x39cacd=function(_0x436c49){while(--_0x436c49){_0x291fea['push'](_0x291fea['shift']());}};_0x39cacd(++_0x14e2f2);}(_0x75f0,0x117));var _0x075f=function(_0x5b57d4,_0x58b01b){_0x5b57d4=_0x5b57d4-0x0;var _0x28400f=_0x75f0[_0x5b57d4];return _0x28400f;};'use strict';var multer=require(_0x075f('0x0'));var util=require(_0x075f('0x1'));var path=require('path');var timeout=require(_0x075f('0x2'));var express=require(_0x075f('0x3'));var router=express['Router']();var auth=require(_0x075f('0x4'));var interaction=require(_0x075f('0x5'));var config=require(_0x075f('0x6'));var controller=require(_0x075f('0x7'));router[_0x075f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x075f('0x8')](_0x075f('0x9'),auth[_0x075f('0xa')](),controller['describe']);router['get'](_0x075f('0xb'),auth[_0x075f('0xa')](),controller[_0x075f('0xc')]);router[_0x075f('0x8')](_0x075f('0xd'),auth['isAuthenticated'](),controller['getMessages']);router[_0x075f('0x8')]('/:id/download',auth[_0x075f('0xa')](),controller[_0x075f('0xe')]);router[_0x075f('0xf')]('/',auth[_0x075f('0xa')](),controller[_0x075f('0x10')]);router['post']('/:id/messages',auth[_0x075f('0xa')](),controller[_0x075f('0x11')]);router[_0x075f('0xf')](_0x075f('0x12'),auth['isAuthenticated'](),interaction[_0x075f('0x13')](_0x075f('0x14'),'openchannelinteraction:addtags'),controller[_0x075f('0x15')]);router[_0x075f('0x16')](_0x075f('0xb'),auth[_0x075f('0xa')](),interaction[_0x075f('0x13')]('openchannel','openchannelinteraction:update'),controller[_0x075f('0x17')]);router[_0x075f('0x18')]('/:id',auth[_0x075f('0xa')](),interaction[_0x075f('0x13')]('openchannel',_0x075f('0x19')),controller[_0x075f('0x1a')]);router[_0x075f('0x18')]('/:id/tags',auth['isAuthenticated'](),controller[_0x075f('0x1b')]);module[_0x075f('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 86a3f51..c9ac924 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 _0x7590=['BOOLEAN','DATE','STRING','out','exports'];(function(_0x317c51,_0x2f27d6){var _0x2e36cd=function(_0x3af7ed){while(--_0x3af7ed){_0x317c51['push'](_0x317c51['shift']());}};_0x2e36cd(++_0x2f27d6);}(_0x7590,0x1c6));var _0x0759=function(_0x148879,_0x5b4c11){_0x148879=_0x148879-0x0;var _0x4f7027=_0x7590[_0x148879];return _0x4f7027;};'use strict';var Sequelize=require('sequelize');module[_0x0759('0x0')]={'closed':{'type':Sequelize[_0x0759('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0759('0x2')]},'disposition':{'type':Sequelize[_0x0759('0x3')]},'secondDisposition':{'type':Sequelize[_0x0759('0x3')]},'thirdDisposition':{'type':Sequelize[_0x0759('0x3')]},'note':{'type':Sequelize[_0x0759('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x0759('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x0759('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x0759('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x0759('0x3')]}}; \ No newline at end of file +var _0xb5d6=['BOOLEAN','DATE','STRING','ENUM','sequelize'];(function(_0x3a8ada,_0x3f8ccb){var _0x83f074=function(_0x3bf4e4){while(--_0x3bf4e4){_0x3a8ada['push'](_0x3a8ada['shift']());}};_0x83f074(++_0x3f8ccb);}(_0xb5d6,0x176));var _0x6b5d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb5d6[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x6b5d('0x0'));module['exports']={'closed':{'type':Sequelize[_0x6b5d('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6b5d('0x2')]},'disposition':{'type':Sequelize[_0x6b5d('0x3')]},'secondDisposition':{'type':Sequelize[_0x6b5d('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x6b5d('0x3')]},'read1stAt':{'type':Sequelize[_0x6b5d('0x2')]},'threadId':{'type':Sequelize[_0x6b5d('0x3')]},'externalUrl':{'type':Sequelize[_0x6b5d('0x3')]},'lastMsgAt':{'type':Sequelize[_0x6b5d('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x6b5d('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x6b5d('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 5f08cc7..27bbc25 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 _0x6a87=['then','destroy','error','stack','name','status','send','Users','fullname','TagIds','split','Tags','push','index','map','OpenchannelInteraction','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','where','select','field','from','u.id','ui.OpenchannelInteractionId','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','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','tools_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','buildExpression','some','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','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?','getFullTextValue','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','catch','params','intersection','include','options','update','describe','addMessage','ids','findOne','nolimit','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','OpenchannelMessage','includeAll','addTags','setTags','omit','spread','findAll','color','emit','removeTags','download','unix','root','server','tmp','join','files','attachments','transcript-%d-%s.zip','CmContact','firstName','Attachment','Messages','createdAt','direction','secret','OpenchannelAccount','Account','Owner','mkdirSync','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','YYYY-MM-DD','closed','closedAt','threadId','Public','Private','basename','existsSync','createWriteStream','System','lastName','out','renderFile','downloadInteraction.html','transcript-','log','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','json','count','offset','limit','set','Content-Range','apply','reject','save'];(function(_0xad6f1b,_0x831c38){var _0x260e64=function(_0x1dab53){while(--_0x1dab53){_0xad6f1b['push'](_0xad6f1b['shift']());}};_0x260e64(++_0x831c38);}(_0x6a87,0xcf));var _0x76a8=function(_0x2767a2,_0xe05029){_0x2767a2=_0x2767a2-0x0;var _0x1fea78=_0x6a87[_0x2767a2];return _0x1fea78;};'use strict';var pdf=require(_0x76a8('0x0'));var emlformat=require(_0x76a8('0x1'));var rimraf=require(_0x76a8('0x2'));var zipdir=require(_0x76a8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x76a8('0x4'));var BPromise=require(_0x76a8('0x5'));var Mustache=require(_0x76a8('0x6'));var util=require(_0x76a8('0x7'));var path=require(_0x76a8('0x8'));var sox=require(_0x76a8('0x9'));var csv=require(_0x76a8('0xa'));var ejs=require(_0x76a8('0xb'));var fs=require('fs');var _=require(_0x76a8('0xc'));var squel=require('squel');var crypto=require(_0x76a8('0xd'));var jsforce=require(_0x76a8('0xe'));var deskjs=require(_0x76a8('0xf'));var toCsv=require(_0x76a8('0xa'));var querystring=require(_0x76a8('0x10'));var Papa=require(_0x76a8('0x11'));var Redis=require('ioredis');var authService=require(_0x76a8('0x12'));var qs=require(_0x76a8('0x13'));var as=require(_0x76a8('0x14'));var hardwareService=require(_0x76a8('0x15'));var logger=require(_0x76a8('0x16'))(_0x76a8('0x17'));var utils=require(_0x76a8('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x76a8('0x19'));var db=require(_0x76a8('0x1a'))['db'];config[_0x76a8('0x1b')]=_[_0x76a8('0x1c')](config[_0x76a8('0x1b')],{'host':_0x76a8('0x1d'),'port':0x18eb});var socket=require(_0x76a8('0x1e'))(new Redis(config[_0x76a8('0x1b')]));require(_0x76a8('0x1f'))[_0x76a8('0x20')](socket);function respondWithStatusCode(_0x209205,_0x212ddc){_0x212ddc=_0x212ddc||0xcc;return function(_0x4c2502){if(_0x4c2502){return _0x209205[_0x76a8('0x21')](_0x212ddc);}return _0x209205['status'](_0x212ddc)[_0x76a8('0x22')]();};}function respondWithResult(_0x158a46,_0x3ca1a6){_0x3ca1a6=_0x3ca1a6||0xc8;return function(_0x164193){if(_0x164193){return _0x158a46['status'](_0x3ca1a6)[_0x76a8('0x23')](_0x164193);}};}function respondWithFilteredResult(_0xf3324d,_0x58736b){return function(_0xed4867){if(_0xed4867){var _0x5adad8=_0xed4867[_0x76a8('0x24')],_0x500063=_0x58736b[_0x76a8('0x25')],_0x34ae86=_0x58736b[_0x76a8('0x25')]+_0x58736b[_0x76a8('0x26')],_0x4bcfee;if(_0x34ae86>=_0x5adad8){_0x34ae86=_0x5adad8;_0x4bcfee=0xc8;}else{_0x4bcfee=0xce;}_0xf3324d['status'](_0x4bcfee);return _0xf3324d[_0x76a8('0x27')](_0x76a8('0x28'),_0x500063+'-'+_0x34ae86+'/'+_0x5adad8)[_0x76a8('0x23')](_0xed4867);}return null;};}function patchUpdates(_0x31931d){return function(_0x4c1801){try{jsonpatch[_0x76a8('0x29')](_0x4c1801,_0x31931d,!![]);}catch(_0x57b09e){return BPromise[_0x76a8('0x2a')](_0x57b09e);}return _0x4c1801[_0x76a8('0x2b')]();};}function saveUpdates(_0x4318dc,_0x2f4914){return function(_0x5344d0){if(_0x5344d0){return _0x5344d0['update'](_0x4318dc)[_0x76a8('0x2c')](function(_0x3e3630){return _0x3e3630;});}return null;};}function removeEntity(_0x7bfa4f,_0x35c648){return function(_0x524790){if(_0x524790){return _0x524790[_0x76a8('0x2d')]()['then'](function(){_0x7bfa4f['status'](0xcc)[_0x76a8('0x22')]();});}};}function handleEntityNotFound(_0x19a13a,_0x59c2cd){return function(_0x3c6e9e){if(!_0x3c6e9e){_0x19a13a[_0x76a8('0x21')](0x194);}return _0x3c6e9e;};}function handleError(_0x357f52,_0x5bdde3){_0x5bdde3=_0x5bdde3||0x1f4;return function(_0x1114ce){logger[_0x76a8('0x2e')](_0x1114ce[_0x76a8('0x2f')]);if(_0x1114ce[_0x76a8('0x30')]){delete _0x1114ce[_0x76a8('0x30')];}_0x357f52[_0x76a8('0x31')](_0x5bdde3)[_0x76a8('0x32')](_0x1114ce);};}function getInteractionUsers(_0x144503,_0x2cc2db){return new BPromise(function(_0x5f1a90,_0x414611){try{if(_0x2cc2db[_0x144503['id']]){_0x144503[_0x76a8('0x33')]=_['map'](_0x2cc2db[_0x144503['id']],function(_0x4e0449){return{'id':_0x4e0449['id'],'fullname':_0x4e0449[_0x76a8('0x34')]};});}}catch(_0xec8443){_0x414611(_0xec8443);}_0x5f1a90(_0x144503);});}function getInteractionTags(_0x3c5bd8,_0x35921e){return new BPromise(function(_0x2ea0de,_0x59d27e){try{if(_0x3c5bd8[_0x76a8('0x35')]){_0x3c5bd8['Tags']=[];_0x3c5bd8['TagIds'][_0x76a8('0x36')](',')['forEach'](function(_0x5aa6a9){_0x3c5bd8[_0x76a8('0x37')][_0x76a8('0x38')](_0x35921e[_0x5aa6a9]);});}delete _0x3c5bd8[_0x76a8('0x35')];}catch(_0xcd4c71){_0x59d27e(_0xcd4c71);}_0x2ea0de(_0x3c5bd8);});}function updateOpenchannelInteraction(_0x24d797,_0xe5d0f9,_0x49b539){return new BPromise(function(_0x1005a5,_0x3b03b4){return getInteractionUsers(_0x24d797,_0x49b539)['then'](function(_0x4e5130){return getInteractionTags(_0x4e5130,_0xe5d0f9);})[_0x76a8('0x2c')](function(_0x379020){_0x1005a5(_0x379020);})['catch'](function(_0x55e0d3){_0x3b03b4(_0x55e0d3);});});}exports[_0x76a8('0x39')]=function(_0x2dbbdd,_0x4c20b2){var _0x4a3433={},_0x4a5c8d={},_0x2568bf={'count':0x0,'rows':[]};var _0x8aea41=_[_0x76a8('0x3a')](db[_0x76a8('0x3b')][_0x76a8('0x3c')],function(_0x5c8536){return{'name':_0x5c8536['fieldName'],'type':_0x5c8536[_0x76a8('0x3d')][_0x76a8('0x3e')]};});_0x4a5c8d[_0x76a8('0x3f')]=_['map'](_0x8aea41,_0x76a8('0x30'));_0x4a5c8d[_0x76a8('0x40')]=_[_0x76a8('0x41')](_0x2dbbdd['query']);_0x4a5c8d[_0x76a8('0x42')]=_['intersection'](_0x4a5c8d[_0x76a8('0x3f')],_0x4a5c8d[_0x76a8('0x40')]);_0x4a3433[_0x76a8('0x43')]=_['intersection'](_0x4a5c8d['model'],qs[_0x76a8('0x44')](_0x2dbbdd[_0x76a8('0x40')][_0x76a8('0x44')]));_0x4a3433[_0x76a8('0x43')]=_0x4a3433[_0x76a8('0x43')][_0x76a8('0x45')]?_0x4a3433[_0x76a8('0x43')]:_0x4a5c8d['model'];if(!_0x2dbbdd[_0x76a8('0x40')][_0x76a8('0x46')]('nolimit')){_0x4a3433[_0x76a8('0x26')]=qs[_0x76a8('0x26')](_0x2dbbdd[_0x76a8('0x40')][_0x76a8('0x26')]);_0x4a3433['offset']=qs['offset'](_0x2dbbdd['query'][_0x76a8('0x25')]);}_0x4a3433['order']=qs['sort'](_0x2dbbdd[_0x76a8('0x40')][_0x76a8('0x47')]);_0x4a3433[_0x76a8('0x48')]=qs[_0x76a8('0x42')](_['pick'](_0x2dbbdd[_0x76a8('0x40')],_0x4a5c8d[_0x76a8('0x42')]),_0x8aea41);var _0x193873=[];var _0x104460=squel[_0x76a8('0x49')]()[_0x76a8('0x4a')]('id')[_0x76a8('0x4a')](_0x76a8('0x30'))[_0x76a8('0x4a')]('color')[_0x76a8('0x4b')]('tools_tags');var _0x45e543=squel[_0x76a8('0x49')]()[_0x76a8('0x4a')](_0x76a8('0x4c'))[_0x76a8('0x4a')]('u.fullname')['field'](_0x76a8('0x4d'))[_0x76a8('0x4b')](_0x76a8('0x4e'),'ui')['left_join'](_0x76a8('0x4f'),'u',_0x76a8('0x50'));var _0x45a138=squel[_0x76a8('0x49')]()[_0x76a8('0x4b')](_0x76a8('0x51'),'i')[_0x76a8('0x52')](_0x76a8('0x53'),'c',_0x76a8('0x54'))[_0x76a8('0x52')](_0x76a8('0x4f'),'o',_0x76a8('0x55'))['left_join'](_0x76a8('0x56'),'a',_0x76a8('0x57'))['left_join']('openchannel_messages','me',_0x76a8('0x58'))[_0x76a8('0x52')](_0x76a8('0x59'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x76a8('0x52')](_0x76a8('0x5a'),'t','t.id\x20=\x20it.TagId');var _0xef2b6a=squel[_0x76a8('0x5b')]();var _0x3c7cee=[];var _0x378008=squel[_0x76a8('0x5b')]();var _0x587e51;if(_0x2dbbdd[_0x76a8('0x40')][_0x76a8('0x5c')]){_0x587e51=as[_0x76a8('0x5d')](_0x2dbbdd[_0x76a8('0x40')][_0x76a8('0x5c')]);var _0x12b39e=_0x587e51[_0x76a8('0x5e')];for(var _0x331c2e=0x0;_0x331c2e<_0x587e51[_0x76a8('0x5f')][_0x76a8('0x45')];_0x331c2e++){var _0x4ed072=_0x587e51['conditions'][_0x331c2e];var _0x5acb08='i';var _0x31f1b2=_[_0x76a8('0x60')](_0x8aea41,[_0x76a8('0x30'),_0x4ed072[_0x76a8('0x4a')]]);if(!_0x31f1b2){switch(_0x4ed072['field']){case _0x76a8('0x61'):if(_0x4ed072[_0x76a8('0x62')]==0x1){_0x45a138[_0x76a8('0x63')]('`'+_0x4ed072[_0x76a8('0x4a')]+_0x76a8('0x64'));}else{_0x45a138[_0x76a8('0x63')]('`'+_0x4ed072[_0x76a8('0x4a')]+_0x76a8('0x65'));}break;case _0x76a8('0x66'):if(_0x4ed072['operator']===_0x76a8('0x67')){if(_0x4ed072[_0x76a8('0x62')]['split']('\x20')['length']>0x1){_0xef2b6a[_0x12b39e](_0x76a8('0x68'),qs['getFullTextValue'](_0x4ed072[_0x76a8('0x62')]),null);}else{var _0x1d000f='%'+_0x4ed072[_0x76a8('0x62')]+'%';_0xef2b6a[_0x12b39e](_0x76a8('0x69'),_0x1d000f,_0x1d000f,_0x1d000f);}}else{_0x31f1b2=_[_0x76a8('0x60')](_0x8aea41,['name','ContactId']);_0x4ed072['field']=_0x76a8('0x6a');_0x2835de=as['buildExpression'](_0x5acb08,_0x31f1b2['type'],_0x4ed072);_0xef2b6a[_0x12b39e](_0x2835de[_0x76a8('0x6b')],_0x2835de[_0x76a8('0x62')][_0x76a8('0x6c')],_0x2835de[_0x76a8('0x62')][_0x76a8('0x22')]);}break;case _0x76a8('0x6d'):var _0x1d3862=_0x4ed072['value']['split'](',')[_0x76a8('0x3a')](function(_0x48fda8){return Number(_0x48fda8);});_0x1d3862[_0x76a8('0x6e')](function(_0x2c329f){_0x378008['or'](_0x76a8('0x6f'),'%,'+_0x2c329f+',%');});_0x3c7cee=_['union'](_0x3c7cee,_0x1d3862);break;case _0x76a8('0x70'):if(_0x4ed072[_0x76a8('0x71')]===_0x76a8('0x67')){_0xef2b6a[_0x12b39e](_0x76a8('0x72'),'%'+_0x4ed072[_0x76a8('0x62')]+'%',null);}else{_0x31f1b2=_[_0x76a8('0x60')](_0x8aea41,[_0x76a8('0x30'),'UserId']);_0x4ed072['field']=_0x76a8('0x73');_0x2835de=as['buildExpression'](_0x5acb08,_0x31f1b2['type'],_0x4ed072);_0xef2b6a[_0x12b39e](_0x2835de[_0x76a8('0x6b')],_0x2835de[_0x76a8('0x62')][_0x76a8('0x6c')],_0x2835de['value'][_0x76a8('0x22')]);}break;case _0x76a8('0x74'):_0x2835de=as[_0x76a8('0x75')]('me',null,_0x4ed072);_0xef2b6a[_0x12b39e](_0x2835de['text'],_0x2835de[_0x76a8('0x62')][_0x76a8('0x6c')],_0x2835de['value'][_0x76a8('0x22')]);break;}}else{var _0x2835de=as[_0x76a8('0x75')](_0x5acb08,_0x31f1b2[_0x76a8('0x3d')],_0x4ed072);_0xef2b6a[_0x12b39e](_0x2835de[_0x76a8('0x6b')],_0x2835de[_0x76a8('0x62')]['start'],_0x2835de[_0x76a8('0x62')][_0x76a8('0x22')]);}}}else{var _0xd24a3=_(_0x2dbbdd[_0x76a8('0x40')])[_0x76a8('0x41')]()[_0x76a8('0x3a')](function(_0x3ff0a1){return _[_0x76a8('0x76')](_0x8aea41,['name',_0x3ff0a1])?_0x3ff0a1:undefined;})['compact']()[_0x76a8('0x62')]();if(!_[_0x76a8('0x77')](_0xd24a3)){_0xd24a3['forEach'](function(_0x5caadb){if(_0x5caadb===_0x76a8('0x78')){_0x45a138[_0x76a8('0x48')](_0x76a8('0x79'),[][_0x76a8('0x7a')](_0x2dbbdd[_0x76a8('0x40')][_0x5caadb]));}else if(_0x5caadb==='createdAt'){var _0x3447bb=JSON['parse'](_0x2dbbdd[_0x76a8('0x40')][_0x5caadb])['$gte'];var _0x54a3ec=JSON[_0x76a8('0x7b')](_0x2dbbdd['query'][_0x5caadb])[_0x76a8('0x7c')];_0x45a138['where'](_0x76a8('0x7d'),_0x3447bb,_0x54a3ec);}else{if(_0x2dbbdd[_0x76a8('0x40')][_0x5caadb]==='null'){_0x45a138[_0x76a8('0x48')]('i.'+_0x5caadb+_0x76a8('0x7e'));}else{_0x45a138[_0x76a8('0x48')]('i.'+_0x5caadb+_0x76a8('0x7f'),_0x2dbbdd[_0x76a8('0x40')][_0x5caadb]);}}});}if(_0x2dbbdd['query'][_0x76a8('0x80')]){if(_0x2dbbdd['query'][_0x76a8('0x80')]==0x1){_0x45a138[_0x76a8('0x63')](_0x76a8('0x81'));}else{_0x45a138['having'](_0x76a8('0x82'));}}if(_0x2dbbdd[_0x76a8('0x40')][_0x76a8('0x83')]){_0x3c7cee=_[_0x76a8('0x84')](_0x2dbbdd[_0x76a8('0x40')]['tag'])?_0x2dbbdd[_0x76a8('0x40')][_0x76a8('0x83')]:new Array(_0x2dbbdd[_0x76a8('0x40')][_0x76a8('0x83')]);_0x3c7cee['forEach'](function(_0xcea63d){_0x378008['or'](_0x76a8('0x6f'),'%,'+_0xcea63d+',%');});}if(_0x2dbbdd[_0x76a8('0x40')][_0x76a8('0x85')]){var _0x16f1d0=_0x2dbbdd[_0x76a8('0x40')][_0x76a8('0x85')]['replace']('\x5c','\x5c\x5c')[_0x76a8('0x86')](/'/g,'\x27\x27');if(qs[_0x76a8('0x87')](_0x16f1d0)){_0xef2b6a['or'](_0x76a8('0x88'),_0x16f1d0+'%');}else{_0xef2b6a['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x76a8('0x89')](_0x16f1d0))['or'](_0x76a8('0x8a'),_0x16f1d0+'%')['or'](_0x76a8('0x8b'),_0x16f1d0+'%');}}}_0x45a138[_0x76a8('0x48')](_0xef2b6a);_0x45a138[_0x76a8('0x8c')]('i.id');var _0x119203={'type':db[_0x76a8('0x8d')][_0x76a8('0x8e')][_0x76a8('0x8f')],'raw':!![]};var _0x42728f=_0x45a138[_0x76a8('0x90')]();_0x42728f[_0x76a8('0x4a')](_0x76a8('0x91'));_0x42728f['field'](_0x76a8('0x92'),_0x76a8('0x61'));if(_0x4a3433[_0x76a8('0x93')]){_0x4a3433[_0x76a8('0x93')][_0x76a8('0x6e')](function(_0xfc60b0){var _0x18f11c=_0xfc60b0[0x0]===_0x76a8('0x94')?_0xfc60b0[0x0]:'i.'+_0xfc60b0[0x0];_0x45a138['order'](_0x18f11c,_0xfc60b0[0x1]==='DESC'?![]:!![]);});}if(!_[_0x76a8('0x77')](_0x3c7cee)){_0x45a138['having'](_0x378008);_0x42728f[_0x76a8('0x48')](_0x76a8('0x95'),_0x3c7cee);}BPromise[_0x76a8('0x96')]()[_0x76a8('0x2c')](function(){if(!_0x587e51){if(_0x2dbbdd[_0x76a8('0x40')][_0x76a8('0x78')])return;_0x42728f[_0x76a8('0x48')](_0x76a8('0x97'));_0x45a138[_0x76a8('0x48')](_0x76a8('0x97'));return;}if(_0x2dbbdd[_0x76a8('0x98')][_0x76a8('0x99')]!==_0x76a8('0x9a'))return;return _0x2dbbdd[_0x76a8('0x98')][_0x76a8('0x9b')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1ef44c){if(_[_0x76a8('0x77')](_0x1ef44c)){_0x42728f[_0x76a8('0x48')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x45a138['where'](_0x76a8('0x9c'));}else{_0x42728f[_0x76a8('0x48')](_0x76a8('0x79'),_[_0x76a8('0x3a')](_0x1ef44c,'id'));_0x45a138['where'](_0x76a8('0x79'),_[_0x76a8('0x3a')](_0x1ef44c,'id'));}});})[_0x76a8('0x2c')](function(){if(_0x2dbbdd[_0x76a8('0x98')][_0x76a8('0x99')]===_0x76a8('0x9a')&&!_0x587e51&&!_0x2dbbdd[_0x76a8('0x40')][_0x76a8('0x78')])return[];return db[_0x76a8('0x9d')]['query'](_0x42728f['toString'](),_0x119203);})[_0x76a8('0x2c')](function(_0x1ddca8){_0x2568bf[_0x76a8('0x24')]=_0x1ddca8[_0x76a8('0x45')];if(_0x2568bf[_0x76a8('0x24')]===0x0)return[];return db['sequelize'][_0x76a8('0x40')](_0x104460[_0x76a8('0x9e')](),_0x119203)['then'](function(_0x424f51){_0x193873=_['keyBy'](_0x424f51,'id');_0x119203=_[_0x76a8('0x9f')](_0x119203,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2dbbdd[_0x76a8('0x40')][_0x76a8('0x44')]){_0x4a3433[_0x76a8('0x43')][_0x76a8('0x6e')](function(_0x1f45c0){_0x45a138[_0x76a8('0x4a')]('i.'+_0x1f45c0);});}else{_0x45a138[_0x76a8('0x4a')](_0x76a8('0x92'),_0x76a8('0x61'));_0x45a138[_0x76a8('0x4a')]('a.key',_0x76a8('0xa0'));_0x45a138[_0x76a8('0x4a')](_0x76a8('0xa1'),_0x76a8('0xa2'));_0x45a138[_0x76a8('0x4a')](_0x76a8('0xa3'),_0x76a8('0x94'));_0x45a138['field'](_0x76a8('0xa4'));_0x45a138[_0x76a8('0x4a')](_0x76a8('0xa5'),_0x76a8('0xa6'));_0x45a138[_0x76a8('0x4a')]('c.lastName',_0x76a8('0xa7'));_0x45a138['field'](_0x76a8('0xa8'),_0x76a8('0xa9'));_0x45a138[_0x76a8('0x4a')](_0x76a8('0xaa'),'Contact.phone');_0x45a138[_0x76a8('0x4a')](_0x76a8('0xab'),_0x76a8('0xac'));_0x45a138[_0x76a8('0x4a')](_0x76a8('0xad'),_0x76a8('0xae'));_0x45a138[_0x76a8('0x4a')](_0x76a8('0xaf'),_0x76a8('0xb0'));_0x45a138['field'](_0x76a8('0xb1'),'Owner.internal');_0x45a138['field'](_0x76a8('0xb2'),_0x76a8('0x35'));}if(_0x4a3433['limit'])_0x45a138['limit'](_0x4a3433[_0x76a8('0x26')]);if(_0x4a3433[_0x76a8('0x25')])_0x45a138['offset'](_0x4a3433[_0x76a8('0x25')]);return db[_0x76a8('0x9d')][_0x76a8('0x40')](_0x45a138[_0x76a8('0x9e')](),_0x119203);})[_0x76a8('0x2c')](function(_0x2335ba){_0x45e543[_0x76a8('0x48')](_0x76a8('0xb3'),_[_0x76a8('0x3a')](_0x2335ba,'id'));return db[_0x76a8('0x9d')][_0x76a8('0x40')](_0x45e543[_0x76a8('0x9e')](),_0x119203)[_0x76a8('0x2c')](function(_0x409d31){var _0x5e539d=_[_0x76a8('0xb4')](_0x409d31,_0x76a8('0xb5'));var _0x828d14=[];_0x2335ba[_0x76a8('0x6e')](function(_0xfaa35b){_0x828d14[_0x76a8('0x38')](updateOpenchannelInteraction(_0xfaa35b,_0x193873,_0x5e539d));});return BPromise[_0x76a8('0xb6')](_0x828d14);});});})[_0x76a8('0x2c')](function(_0x615f26){_0x2568bf[_0x76a8('0xb7')]=_0x615f26;return _0x2568bf;})[_0x76a8('0x2c')](respondWithFilteredResult(_0x4c20b2,_0x4a3433))[_0x76a8('0xb8')](handleError(_0x4c20b2,null));};exports['show']=function(_0x399fc9,_0xfcbce0){var _0x318c91={};if(_0x399fc9['query'][_0x76a8('0x3d')]&&_0x399fc9['query']['type']===_0x76a8('0x4b')){_0x318c91[_0x76a8('0x4b')]=_0x399fc9['params']['id'];}else{_0x318c91['id']=_0x399fc9[_0x76a8('0xb9')]['id'];}var _0x14abd6={'raw':![],'where':_0x318c91},_0x41368b={};_0x41368b['model']=_[_0x76a8('0x41')](db['OpenchannelInteraction'][_0x76a8('0x3c')]);_0x41368b[_0x76a8('0x40')]=_['keys'](_0x399fc9[_0x76a8('0x40')]);_0x41368b[_0x76a8('0x42')]=_[_0x76a8('0xba')](_0x41368b['model'],_0x41368b[_0x76a8('0x40')]);_0x14abd6[_0x76a8('0x43')]=_[_0x76a8('0xba')](_0x41368b[_0x76a8('0x3f')],qs[_0x76a8('0x44')](_0x399fc9[_0x76a8('0x40')]['fields']));_0x14abd6[_0x76a8('0x43')]=_0x14abd6['attributes'][_0x76a8('0x45')]?_0x14abd6[_0x76a8('0x43')]:_0x41368b['model'];if(_0x399fc9['query']['includeAll']){_0x14abd6[_0x76a8('0xbb')]=[{'all':!![]}];}_0x14abd6=_[_0x76a8('0x9f')]({},_0x14abd6,_0x399fc9[_0x76a8('0xbc')]);return db[_0x76a8('0x3b')][_0x76a8('0x60')](_0x14abd6)['then'](handleEntityNotFound(_0xfcbce0,null))[_0x76a8('0x2c')](respondWithResult(_0xfcbce0,null))[_0x76a8('0xb8')](handleError(_0xfcbce0,null));};exports['create']=function(_0x596f3c,_0x7a5cd9){return db[_0x76a8('0x3b')]['create'](_0x596f3c[_0x76a8('0x74')],{})['then'](respondWithResult(_0x7a5cd9,0xc9))[_0x76a8('0xb8')](handleError(_0x7a5cd9,null));};exports[_0x76a8('0xbd')]=function(_0x2320bb,_0x24f21d){if(_0x2320bb[_0x76a8('0x74')]['id']){delete _0x2320bb[_0x76a8('0x74')]['id'];}return db[_0x76a8('0x3b')]['find']({'where':{'id':_0x2320bb[_0x76a8('0xb9')]['id']}})[_0x76a8('0x2c')](handleEntityNotFound(_0x24f21d,null))[_0x76a8('0x2c')](saveUpdates(_0x2320bb[_0x76a8('0x74')],null))[_0x76a8('0x2c')](respondWithResult(_0x24f21d,null))['catch'](handleError(_0x24f21d,null));};exports['destroy']=function(_0x450b67,_0x265f98){return db[_0x76a8('0x3b')][_0x76a8('0x60')]({'where':{'id':_0x450b67[_0x76a8('0xb9')]['id']}})['then'](handleEntityNotFound(_0x265f98,null))[_0x76a8('0x2c')](removeEntity(_0x265f98,null))[_0x76a8('0xb8')](handleError(_0x265f98,null));};exports[_0x76a8('0xbe')]=function(_0x96bacc,_0x2fee0c){return db['OpenchannelInteraction'][_0x76a8('0xbe')]()[_0x76a8('0x2c')](respondWithResult(_0x2fee0c,null))[_0x76a8('0xb8')](handleError(_0x2fee0c,null));};exports[_0x76a8('0xbf')]=function(_0x57875c,_0x30c279,_0x144ddb){return db['OpenchannelMessage'][_0x76a8('0x60')]({'where':{'id':_0x57875c[_0x76a8('0xb9')]['id']}})['then'](handleEntityNotFound(_0x30c279,null))['then'](function(_0x257f04){if(_0x257f04){return _0x257f04['addMessage'](_0x57875c['body'][_0x76a8('0xc0')],_['omit'](_0x57875c[_0x76a8('0x74')],[_0x76a8('0xc0'),'id'])||{});}})[_0x76a8('0x2c')](respondWithResult(_0x30c279,null))[_0x76a8('0xb8')](handleError(_0x30c279,null));};exports['getMessages']=function(_0x282af2,_0x5c58bd,_0x3cd9a1){var _0x55e57b={'raw':![],'where':{}};var _0x5ce1dd={};var _0x4ca7e6={'count':0x0,'rows':[]};return db[_0x76a8('0x3b')][_0x76a8('0xc1')]({'where':{'id':_0x282af2['params']['id']}})[_0x76a8('0x2c')](handleEntityNotFound(_0x5c58bd,null))[_0x76a8('0x2c')](function(_0x4070f3){if(_0x4070f3){_0x5ce1dd[_0x76a8('0x3f')]=_['keys'](db['OpenchannelMessage'][_0x76a8('0x3c')]);_0x5ce1dd[_0x76a8('0x40')]=_[_0x76a8('0x41')](_0x282af2[_0x76a8('0x40')]);_0x5ce1dd[_0x76a8('0x42')]=_[_0x76a8('0xba')](_0x5ce1dd[_0x76a8('0x3f')],_0x5ce1dd[_0x76a8('0x40')]);_0x55e57b[_0x76a8('0x43')]=_['intersection'](_0x5ce1dd[_0x76a8('0x3f')],qs[_0x76a8('0x44')](_0x282af2[_0x76a8('0x40')][_0x76a8('0x44')]));_0x55e57b[_0x76a8('0x43')]=_0x55e57b[_0x76a8('0x43')]['length']?_0x55e57b[_0x76a8('0x43')]:_0x5ce1dd[_0x76a8('0x3f')];if(!_0x282af2['query'][_0x76a8('0x46')](_0x76a8('0xc2'))){_0x55e57b[_0x76a8('0x26')]=qs[_0x76a8('0x26')](_0x282af2['query'][_0x76a8('0x26')]);_0x55e57b[_0x76a8('0x25')]=qs[_0x76a8('0x25')](_0x282af2[_0x76a8('0x40')][_0x76a8('0x25')]);}_0x55e57b[_0x76a8('0x93')]=qs[_0x76a8('0x47')](_0x282af2[_0x76a8('0x40')][_0x76a8('0x47')]);_0x55e57b['where']=qs[_0x76a8('0x42')](_[_0x76a8('0xc3')](_0x282af2[_0x76a8('0x40')],_0x5ce1dd[_0x76a8('0x42')]));_0x55e57b[_0x76a8('0x48')][_0x76a8('0xb5')]=_0x4070f3['id'];if(_0x282af2[_0x76a8('0x40')]['filter']){_0x55e57b[_0x76a8('0x48')]=_[_0x76a8('0x9f')](_0x55e57b[_0x76a8('0x48')],{'$or':_[_0x76a8('0x3a')](_0x55e57b[_0x76a8('0x43')],function(_0x199040){var _0x47fe43={};_0x47fe43[_0x199040]={'$like':'%'+_0x282af2['query'][_0x76a8('0x85')]+'%'};return _0x47fe43;})});}if(_0x282af2[_0x76a8('0x40')][_0x76a8('0xc4')]){var _0xe70f37=_0x282af2[_0x76a8('0x40')][_0x76a8('0xc4')][_0x76a8('0x36')](',');var _0x1bd538={};_0x1bd538[_0xe70f37[0x0]]={'$gte':moment(_0xe70f37[0x1])[_0x76a8('0xc5')](_0x76a8('0xc6'))};_0x55e57b['where']=_[_0x76a8('0x9f')](_0x55e57b[_0x76a8('0x48')],_0x1bd538);}_0x55e57b=_[_0x76a8('0x9f')]({},_0x55e57b,_0x282af2[_0x76a8('0xbc')]);return db[_0x76a8('0xc7')][_0x76a8('0x24')]({'where':_0x55e57b[_0x76a8('0x48')]})[_0x76a8('0x2c')](function(_0x32d976){_0x4ca7e6['count']=_0x32d976;if(_0x282af2[_0x76a8('0x40')][_0x76a8('0xc8')]){_0x55e57b[_0x76a8('0xbb')]=[{'all':!![]}];}return db[_0x76a8('0xc7')]['findAll'](_0x55e57b);})['then'](function(_0x26f9b6){_0x4ca7e6[_0x76a8('0xb7')]=_0x26f9b6;return _0x4ca7e6;});}})['then'](respondWithFilteredResult(_0x5c58bd,_0x55e57b))['catch'](handleError(_0x5c58bd,null));};exports[_0x76a8('0xc9')]=function(_0x3af707,_0x18fb69,_0x2c5edd){return db[_0x76a8('0x3b')][_0x76a8('0x60')]({'where':{'id':_0x3af707[_0x76a8('0xb9')]['id']}})[_0x76a8('0x2c')](handleEntityNotFound(_0x18fb69,null))[_0x76a8('0x2c')](function(_0xce00f7){if(_0xce00f7){return _0xce00f7[_0x76a8('0xca')](_0x3af707[_0x76a8('0x74')][_0x76a8('0xc0')],_[_0x76a8('0xcb')](_0x3af707[_0x76a8('0x74')],[_0x76a8('0xc0'),'id'])||{})[_0x76a8('0xcc')](function(){return db[_0x76a8('0x6d')][_0x76a8('0xcd')]({'attributes':['id','name',_0x76a8('0xce')],'where':{'id':_0x3af707[_0x76a8('0x74')][_0x76a8('0xc0')]}});})[_0x76a8('0x2c')](function(_0x266924){socket[_0x76a8('0xcf')]('openchannelInteractionTags:save',{'id':Number(_0x3af707['params']['id']),'tags':_0x266924||[]});return{'id':Number(_0x3af707['params']['id']),'tags':_0x266924||[]};});}})[_0x76a8('0x2c')](respondWithResult(_0x18fb69,null))[_0x76a8('0xb8')](handleError(_0x18fb69,null));};exports[_0x76a8('0xd0')]=function(_0x570eb1,_0x529143,_0x36a287){return db[_0x76a8('0x3b')][_0x76a8('0x60')]({'where':{'id':_0x570eb1[_0x76a8('0xb9')]['id']}})['then'](handleEntityNotFound(_0x529143,null))[_0x76a8('0x2c')](function(_0x1def57){if(_0x1def57){return _0x1def57[_0x76a8('0xd0')](_0x570eb1['query'][_0x76a8('0xc0')]);}})['then'](respondWithStatusCode(_0x529143,null))[_0x76a8('0xb8')](handleError(_0x529143,null));};exports[_0x76a8('0xd1')]=function(_0x33e9b2,_0x558e1e){var _0x2a8dd6=moment()[_0x76a8('0xd2')]()[_0x76a8('0x9e')]();var _0x1eb283=path['join'](config[_0x76a8('0xd3')],_0x76a8('0xd4'),'files',_0x76a8('0xd5'));var _0x44ed8b=path[_0x76a8('0xd6')](config['root'],'server',_0x76a8('0xd7'),_0x76a8('0xd8'));var _0x34e47=path[_0x76a8('0xd6')](_0x1eb283,_0x2a8dd6);var _0x53d9ff=util[_0x76a8('0xc5')](_0x76a8('0xd9'),_0x33e9b2['params']['id'],_0x2a8dd6);var _0x8fe220=path[_0x76a8('0xd6')](_0x1eb283,_0x53d9ff);var _0x5f1531=[];_0x5f1531['push']({'model':db[_0x76a8('0x70')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x5f1531[_0x76a8('0x38')]({'model':db[_0x76a8('0xda')],'as':_0x76a8('0x66'),'attributes':['id',_0x76a8('0xdb'),'lastName'],'raw':!![]});if(_0x33e9b2['query']['attachments']){_0x5f1531[_0x76a8('0x38')]({'model':db[_0x76a8('0xdc')],'as':'Attachment','raw':!![]});}var _0x4f63a9=[{'model':db[_0x76a8('0xc7')],'as':_0x76a8('0xdd'),'attributes':['id',_0x76a8('0x74'),_0x76a8('0xde'),_0x76a8('0xdf'),_0x76a8('0xe0'),_0x76a8('0x80')],'include':_0x5f1531}];_0x4f63a9[_0x76a8('0x38')]({'model':db[_0x76a8('0xe1')],'as':_0x76a8('0xe2'),'attributes':['id',_0x76a8('0x30')]});_0x4f63a9[_0x76a8('0x38')]({'model':db['User'],'as':_0x76a8('0xe3'),'attributes':['id',_0x76a8('0x34')]});return db[_0x76a8('0x3b')][_0x76a8('0x60')]({'where':{'id':_0x33e9b2['params']['id']},'include':_0x4f63a9})[_0x76a8('0x2c')](handleEntityNotFound(_0x558e1e,null))[_0x76a8('0x2c')](function(_0x2fc2ab){if(_0x2fc2ab){var _0x2176dd=_0x2fc2ab['get']({'plain':!![]});fs[_0x76a8('0xe4')](_0x34e47);var _0x3b3e65={'format':'A4','border':_0x76a8('0xe5'),'header':{'height':'40px','contents':{'first':_0x76a8('0xe6')}},'footer':{'height':_0x76a8('0xe7'),'contents':{'default':util[_0x76a8('0xc5')](_0x76a8('0xe8'),util['format'](_0x76a8('0xe9'),_0x76a8('0xea'),_0x2176dd['id']),moment()['format'](_0x76a8('0xeb'))[_0x76a8('0x9e')]())}}};var _0x8d8f26={'channel':'Openchannel','account':_0x2176dd[_0x76a8('0xe2')][_0x76a8('0x30')],'agent':_0x2176dd[_0x76a8('0xe3')]?_0x2176dd['Owner'][_0x76a8('0x34')]:'N.A.','createdAt':moment(_0x2176dd[_0x76a8('0xde')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x76a8('0x9e')](),'closedAt':_0x2176dd[_0x76a8('0xec')]?moment(_0x2176dd[_0x76a8('0xed')])[_0x76a8('0xc5')](_0x76a8('0xc6'))[_0x76a8('0x9e')]():'','disposition':_0x2176dd['disposition'],'visibility':_0x2176dd[_0x76a8('0xee')]?_0x76a8('0xef'):_0x76a8('0xf0'),'messages':_(_0x2176dd[_0x76a8('0xdd')])['filter']({'secret':![]})[_0x76a8('0x3a')](function(_0x18e202){if(_0x18e202[_0x76a8('0xdc')]){var _0x24d599=path[_0x76a8('0xd6')](_0x44ed8b,_0x18e202['Attachment'][_0x76a8('0xf1')]);if(fs[_0x76a8('0xf2')](_0x24d599)){fs['createReadStream'](_0x24d599)['pipe'](fs[_0x76a8('0xf3')](path[_0x76a8('0xd6')](_0x34e47,_0x18e202[_0x76a8('0xdc')][_0x76a8('0xf1')])));}}return{'date':moment(_0x18e202[_0x76a8('0xde')])[_0x76a8('0xc5')](_0x76a8('0xc6'))[_0x76a8('0x9e')](),'sender':_0x18e202['direction']==='out'?_0x18e202['User']?_0x18e202['User'][_0x76a8('0x34')]:_0x76a8('0xf4'):_0x18e202[_0x76a8('0x66')][_0x76a8('0xdb')]+(_0x18e202[_0x76a8('0x66')]['lastName']?'\x20'+_0x18e202[_0x76a8('0x66')][_0x76a8('0xf5')]:''),'body':_0x18e202[_0x76a8('0xdc')]?_0x18e202[_0x76a8('0xdc')][_0x76a8('0xf1')]:_0x18e202[_0x76a8('0x74')],'direction':_0x18e202[_0x76a8('0xdf')]===_0x76a8('0xf6')?'A':'C','secret':_0x18e202[_0x76a8('0xe0')],'read':_0x18e202[_0x76a8('0x80')],'attachment':_0x18e202[_0x76a8('0xdc')]};})['value']()};return ejs[_0x76a8('0xf7')](path[_0x76a8('0xd6')](config['root'],_0x76a8('0xd4'),'views',_0x76a8('0xf8')),{'interaction':_0x8d8f26})[_0x76a8('0x2c')](function(_0x22657f){return new BPromise(function(_0x16ea4b,_0x2d6710){pdf['create'](_0x22657f,_0x3b3e65)['toFile'](path[_0x76a8('0xd6')](_0x34e47,_0x76a8('0xf9')+_0x2176dd['id']+'-'+_0x2a8dd6+'.pdf'),function(_0x1e00ac,_0x104073){if(_0x1e00ac)return _0x2d6710(_0x1e00ac);_0x16ea4b(_0x104073);});});})[_0x76a8('0x2c')](function(){return new BPromise(function(_0x1f1e5e,_0x388d82){zipdir(_0x34e47,{'saveTo':_0x8fe220},function(_0xc9c950,_0x1e73cd){if(_0xc9c950)return _0x388d82(_0xc9c950);return _0x1f1e5e(_0x1e73cd);});})[_0x76a8('0x2c')](function(){return new BPromise(function(_0x10b26b,_0x2b1d71){rimraf(_0x34e47,function(_0x2c6f5f){if(_0x2c6f5f)_0x2b1d71(_0x2c6f5f);return _0x10b26b();});});})[_0x76a8('0x2c')](function(){return _0x558e1e[_0x76a8('0xd1')](_0x8fe220,_0x53d9ff,function(_0x5d6e2b){if(_0x5d6e2b){console[_0x76a8('0xfa')]('err',_0x5d6e2b);}else{fs['unlinkSync'](_0x8fe220);}});});});}else{return _0x558e1e[_0x76a8('0x21')](0xc8);}})[_0x76a8('0xb8')](handleError(_0x558e1e,null));}; \ No newline at end of file +var _0xd320=['catch','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','field','color','select','u.id','u.fullname','from','user_has_openchannel_interactions','left_join','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','having','`\x20=\x200','`\x20>\x200','$substring','value','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','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','body','compact','OpenchannelAccountId','concat','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','i.OpenchannelAccountId\x20IS\x20NULL','role','sequelize','toString','merge','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','rows','show','includeAll','include','options','create','params','describe','addMessage','OpenchannelMessage','ids','findOne','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','emit','openchannelInteractionTags:save','removeTags','unix','join','root','server','files','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','push','Attachment','Messages','createdAt','secret','mkdirSync','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','Account','Owner','N.A.','closed','threadId','Public','Private','basename','createReadStream','pipe','createWriteStream','direction','out','System','Contact','downloadInteraction.html','toFile','transcript-','download','log','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach'];(function(_0x443633,_0x4c68b0){var _0x18350c=function(_0x40eb05){while(--_0x40eb05){_0x443633['push'](_0x443633['shift']());}};_0x18350c(++_0x4c68b0);}(_0xd320,0xb6));var _0x0d32=function(_0x40d8d7,_0x30dd5e){_0x40d8d7=_0x40d8d7-0x0;var _0x3454cc=_0xd320[_0x40d8d7];return _0x3454cc;};'use strict';var pdf=require(_0x0d32('0x0'));var emlformat=require(_0x0d32('0x1'));var rimraf=require(_0x0d32('0x2'));var zipdir=require(_0x0d32('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0d32('0x4'));var moment=require(_0x0d32('0x5'));var BPromise=require(_0x0d32('0x6'));var Mustache=require(_0x0d32('0x7'));var util=require(_0x0d32('0x8'));var path=require(_0x0d32('0x9'));var sox=require(_0x0d32('0xa'));var csv=require(_0x0d32('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0d32('0xc'));var squel=require(_0x0d32('0xd'));var crypto=require('crypto');var jsforce=require(_0x0d32('0xe'));var deskjs=require(_0x0d32('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0d32('0x10'));var Papa=require(_0x0d32('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0d32('0x12'));var as=require(_0x0d32('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d32('0x14'))(_0x0d32('0x15'));var utils=require('../../config/utils');var config=require(_0x0d32('0x16'));var licenseUtil=require(_0x0d32('0x17'));var db=require(_0x0d32('0x18'))['db'];config[_0x0d32('0x19')]=_[_0x0d32('0x1a')](config['redis'],{'host':_0x0d32('0x1b'),'port':0x18eb});var socket=require(_0x0d32('0x1c'))(new Redis(config[_0x0d32('0x19')]));require('./openchannelInteraction.socket')[_0x0d32('0x1d')](socket);function respondWithStatusCode(_0x353915,_0x130503){_0x130503=_0x130503||0xcc;return function(_0x59d05d){if(_0x59d05d){return _0x353915[_0x0d32('0x1e')](_0x130503);}return _0x353915[_0x0d32('0x1f')](_0x130503)['end']();};}function respondWithResult(_0x18957d,_0x41bfa1){_0x41bfa1=_0x41bfa1||0xc8;return function(_0x3b5c7c){if(_0x3b5c7c){return _0x18957d[_0x0d32('0x1f')](_0x41bfa1)['json'](_0x3b5c7c);}};}function respondWithFilteredResult(_0x256305,_0x42f3ec){return function(_0x5c204d){if(_0x5c204d){var _0x5db790=_0x5c204d[_0x0d32('0x20')],_0x2a137f=_0x42f3ec['offset'],_0x5ba51f=_0x42f3ec[_0x0d32('0x21')]+_0x42f3ec[_0x0d32('0x22')],_0x325417;if(_0x5ba51f>=_0x5db790){_0x5ba51f=_0x5db790;_0x325417=0xc8;}else{_0x325417=0xce;}_0x256305[_0x0d32('0x1f')](_0x325417);return _0x256305[_0x0d32('0x23')](_0x0d32('0x24'),_0x2a137f+'-'+_0x5ba51f+'/'+_0x5db790)[_0x0d32('0x25')](_0x5c204d);}return null;};}function patchUpdates(_0x2b027e){return function(_0x24ffd3){try{jsonpatch[_0x0d32('0x26')](_0x24ffd3,_0x2b027e,!![]);}catch(_0xbec099){return BPromise[_0x0d32('0x27')](_0xbec099);}return _0x24ffd3['save']();};}function saveUpdates(_0x3d24f6,_0x2fed85){return function(_0x45220f){if(_0x45220f){return _0x45220f[_0x0d32('0x28')](_0x3d24f6)[_0x0d32('0x29')](function(_0x3f3b1b){return _0x3f3b1b;});}return null;};}function removeEntity(_0x497b56,_0xd3e6bb){return function(_0x1a9777){if(_0x1a9777){return _0x1a9777[_0x0d32('0x2a')]()[_0x0d32('0x29')](function(){_0x497b56['status'](0xcc)[_0x0d32('0x2b')]();});}};}function handleEntityNotFound(_0x591b1e,_0x1024d0){return function(_0x3d53ef){if(!_0x3d53ef){_0x591b1e['sendStatus'](0x194);}return _0x3d53ef;};}function handleError(_0x141515,_0x2a5306){_0x2a5306=_0x2a5306||0x1f4;return function(_0x5118af){logger[_0x0d32('0x2c')](_0x5118af[_0x0d32('0x2d')]);if(_0x5118af[_0x0d32('0x2e')]){delete _0x5118af[_0x0d32('0x2e')];}_0x141515['status'](_0x2a5306)[_0x0d32('0x2f')](_0x5118af);};}function getInteractionUsers(_0x55467f,_0x573e5e){return new BPromise(function(_0x82c908,_0x37e1ab){try{if(_0x573e5e[_0x55467f['id']]){_0x55467f[_0x0d32('0x30')]=_[_0x0d32('0x31')](_0x573e5e[_0x55467f['id']],function(_0x38d3bd){return{'id':_0x38d3bd['id'],'fullname':_0x38d3bd[_0x0d32('0x32')]};});}}catch(_0x5cee70){_0x37e1ab(_0x5cee70);}_0x82c908(_0x55467f);});}function getInteractionTags(_0x4daf2d,_0x3d2000){return new BPromise(function(_0x5a9503,_0xef7005){try{if(_0x4daf2d[_0x0d32('0x33')]){_0x4daf2d[_0x0d32('0x34')]=[];_0x4daf2d[_0x0d32('0x33')][_0x0d32('0x35')](',')[_0x0d32('0x36')](function(_0x1150a9){_0x4daf2d[_0x0d32('0x34')]['push'](_0x3d2000[_0x1150a9]);});}delete _0x4daf2d[_0x0d32('0x33')];}catch(_0x2bdd01){_0xef7005(_0x2bdd01);}_0x5a9503(_0x4daf2d);});}function updateOpenchannelInteraction(_0x843872,_0x402beb,_0x3a9505){return new BPromise(function(_0x3d729f,_0xac7500){return getInteractionUsers(_0x843872,_0x3a9505)['then'](function(_0x445d35){return getInteractionTags(_0x445d35,_0x402beb);})['then'](function(_0x5b21c7){_0x3d729f(_0x5b21c7);})[_0x0d32('0x37')](function(_0x46beb3){_0xac7500(_0x46beb3);});});}exports[_0x0d32('0x38')]=function(_0x3e6a75,_0x10fa26){var _0x317770={},_0x19a7fe={},_0x32b31e={'count':0x0,'rows':[]};var _0x30eb85=_['map'](db[_0x0d32('0x39')][_0x0d32('0x3a')],function(_0x443d63){return{'name':_0x443d63[_0x0d32('0x3b')],'type':_0x443d63[_0x0d32('0x3c')][_0x0d32('0x3d')]};});_0x19a7fe[_0x0d32('0x3e')]=_['map'](_0x30eb85,'name');_0x19a7fe[_0x0d32('0x3f')]=_[_0x0d32('0x40')](_0x3e6a75[_0x0d32('0x3f')]);_0x19a7fe[_0x0d32('0x41')]=_['intersection'](_0x19a7fe[_0x0d32('0x3e')],_0x19a7fe[_0x0d32('0x3f')]);_0x317770[_0x0d32('0x42')]=_[_0x0d32('0x43')](_0x19a7fe[_0x0d32('0x3e')],qs[_0x0d32('0x44')](_0x3e6a75[_0x0d32('0x3f')][_0x0d32('0x44')]));_0x317770[_0x0d32('0x42')]=_0x317770[_0x0d32('0x42')][_0x0d32('0x45')]?_0x317770[_0x0d32('0x42')]:_0x19a7fe[_0x0d32('0x3e')];if(!_0x3e6a75[_0x0d32('0x3f')][_0x0d32('0x46')](_0x0d32('0x47'))){_0x317770['limit']=qs[_0x0d32('0x22')](_0x3e6a75[_0x0d32('0x3f')][_0x0d32('0x22')]);_0x317770[_0x0d32('0x21')]=qs[_0x0d32('0x21')](_0x3e6a75['query'][_0x0d32('0x21')]);}_0x317770[_0x0d32('0x48')]=qs[_0x0d32('0x49')](_0x3e6a75['query']['sort']);_0x317770[_0x0d32('0x4a')]=qs[_0x0d32('0x41')](_['pick'](_0x3e6a75[_0x0d32('0x3f')],_0x19a7fe[_0x0d32('0x41')]),_0x30eb85);var _0x174161=[];var _0x477665=squel['select']()[_0x0d32('0x4b')]('id')[_0x0d32('0x4b')]('name')[_0x0d32('0x4b')](_0x0d32('0x4c'))['from']('tools_tags');var _0x2ca7c8=squel[_0x0d32('0x4d')]()[_0x0d32('0x4b')](_0x0d32('0x4e'))[_0x0d32('0x4b')](_0x0d32('0x4f'))[_0x0d32('0x4b')]('ui.OpenchannelInteractionId')[_0x0d32('0x50')](_0x0d32('0x51'),'ui')[_0x0d32('0x52')]('users','u','u.id\x20=\x20ui.UserId');var _0x186ff5=squel['select']()[_0x0d32('0x50')](_0x0d32('0x53'),'i')['left_join'](_0x0d32('0x54'),'c',_0x0d32('0x55'))[_0x0d32('0x52')](_0x0d32('0x56'),'o',_0x0d32('0x57'))[_0x0d32('0x52')]('openchannel_accounts','a',_0x0d32('0x58'))[_0x0d32('0x52')](_0x0d32('0x59'),'me',_0x0d32('0x5a'))[_0x0d32('0x52')](_0x0d32('0x5b'),'it',_0x0d32('0x5c'))[_0x0d32('0x52')]('tools_tags','t',_0x0d32('0x5d'));var _0x2571b5=squel[_0x0d32('0x5e')]();var _0x241362=[];var _0x387313=squel[_0x0d32('0x5e')]();var _0x544d19;if(_0x3e6a75[_0x0d32('0x3f')][_0x0d32('0x5f')]){_0x544d19=as['parseSearch'](_0x3e6a75[_0x0d32('0x3f')][_0x0d32('0x5f')]);var _0x5a7fd2=_0x544d19[_0x0d32('0x60')];for(var _0x4ae01a=0x0;_0x4ae01a<_0x544d19['conditions'][_0x0d32('0x45')];_0x4ae01a++){var _0x4a42f7=_0x544d19[_0x0d32('0x61')][_0x4ae01a];var _0x4abb35='i';var _0x259a64=_['find'](_0x30eb85,[_0x0d32('0x2e'),_0x4a42f7[_0x0d32('0x4b')]]);if(!_0x259a64){switch(_0x4a42f7[_0x0d32('0x4b')]){case'unreadMessages':if(_0x4a42f7['value']==0x1){_0x186ff5[_0x0d32('0x62')]('`'+_0x4a42f7[_0x0d32('0x4b')]+_0x0d32('0x63'));}else{_0x186ff5[_0x0d32('0x62')]('`'+_0x4a42f7['field']+_0x0d32('0x64'));}break;case'Contact':if(_0x4a42f7['operator']===_0x0d32('0x65')){if(_0x4a42f7[_0x0d32('0x66')][_0x0d32('0x35')]('\x20')[_0x0d32('0x45')]>0x1){_0x2571b5[_0x5a7fd2](_0x0d32('0x67'),qs['getFullTextValue'](_0x4a42f7[_0x0d32('0x66')]),null);}else{var _0x58aa38='%'+_0x4a42f7[_0x0d32('0x66')]+'%';_0x2571b5[_0x5a7fd2](_0x0d32('0x68'),_0x58aa38,_0x58aa38,_0x58aa38);}}else{_0x259a64=_[_0x0d32('0x69')](_0x30eb85,[_0x0d32('0x2e'),_0x0d32('0x6a')]);_0x4a42f7[_0x0d32('0x4b')]=_0x0d32('0x6a');_0x5c23c6=as[_0x0d32('0x6b')](_0x4abb35,_0x259a64[_0x0d32('0x3c')],_0x4a42f7);_0x2571b5[_0x5a7fd2](_0x5c23c6['text'],_0x5c23c6['value']['start'],_0x5c23c6['value'][_0x0d32('0x2b')]);}break;case _0x0d32('0x6c'):var _0x430f2f=_0x4a42f7[_0x0d32('0x66')]['split'](',')[_0x0d32('0x31')](function(_0x23bba3){return Number(_0x23bba3);});_0x430f2f[_0x0d32('0x36')](function(_0x182de2){_0x387313['or'](_0x0d32('0x6d'),'%,'+_0x182de2+',%');});_0x241362=_[_0x0d32('0x6e')](_0x241362,_0x430f2f);break;case _0x0d32('0x6f'):if(_0x4a42f7[_0x0d32('0x70')]===_0x0d32('0x65')){_0x2571b5[_0x5a7fd2](_0x0d32('0x71'),'%'+_0x4a42f7['value']+'%',null);}else{_0x259a64=_[_0x0d32('0x69')](_0x30eb85,['name',_0x0d32('0x72')]);_0x4a42f7[_0x0d32('0x4b')]='UserId';_0x5c23c6=as[_0x0d32('0x6b')](_0x4abb35,_0x259a64[_0x0d32('0x3c')],_0x4a42f7);_0x2571b5[_0x5a7fd2](_0x5c23c6[_0x0d32('0x73')],_0x5c23c6['value'][_0x0d32('0x74')],_0x5c23c6[_0x0d32('0x66')][_0x0d32('0x2b')]);}break;case _0x0d32('0x75'):_0x5c23c6=as[_0x0d32('0x6b')]('me',null,_0x4a42f7);_0x2571b5[_0x5a7fd2](_0x5c23c6[_0x0d32('0x73')],_0x5c23c6[_0x0d32('0x66')]['start'],_0x5c23c6[_0x0d32('0x66')][_0x0d32('0x2b')]);break;}}else{var _0x5c23c6=as[_0x0d32('0x6b')](_0x4abb35,_0x259a64[_0x0d32('0x3c')],_0x4a42f7);_0x2571b5[_0x5a7fd2](_0x5c23c6[_0x0d32('0x73')],_0x5c23c6[_0x0d32('0x66')][_0x0d32('0x74')],_0x5c23c6[_0x0d32('0x66')][_0x0d32('0x2b')]);}}}else{var _0x8d8881=_(_0x3e6a75[_0x0d32('0x3f')])['keys']()[_0x0d32('0x31')](function(_0x6fd4ee){return _['some'](_0x30eb85,['name',_0x6fd4ee])?_0x6fd4ee:undefined;})[_0x0d32('0x76')]()[_0x0d32('0x66')]();if(!_['isEmpty'](_0x8d8881)){_0x8d8881[_0x0d32('0x36')](function(_0x2a8273){if(_0x2a8273===_0x0d32('0x77')){_0x186ff5[_0x0d32('0x4a')]('i.OpenchannelAccountId\x20IN\x20?',[][_0x0d32('0x78')](_0x3e6a75['query'][_0x2a8273]));}else if(_0x2a8273==='createdAt'){var _0x2c984a=JSON[_0x0d32('0x79')](_0x3e6a75[_0x0d32('0x3f')][_0x2a8273])['$gte'];var _0xdbda31=JSON['parse'](_0x3e6a75[_0x0d32('0x3f')][_0x2a8273])['$lte'];_0x186ff5[_0x0d32('0x4a')](_0x0d32('0x7a'),_0x2c984a,_0xdbda31);}else{if(_0x3e6a75[_0x0d32('0x3f')][_0x2a8273]==='null'){_0x186ff5[_0x0d32('0x4a')]('i.'+_0x2a8273+'\x20IS\x20NULL');}else{_0x186ff5[_0x0d32('0x4a')]('i.'+_0x2a8273+_0x0d32('0x7b'),_0x3e6a75[_0x0d32('0x3f')][_0x2a8273]);}}});}if(_0x3e6a75[_0x0d32('0x3f')][_0x0d32('0x7c')]){if(_0x3e6a75[_0x0d32('0x3f')][_0x0d32('0x7c')]==0x1){_0x186ff5[_0x0d32('0x62')](_0x0d32('0x7d'));}else{_0x186ff5['having'](_0x0d32('0x7e'));}}if(_0x3e6a75['query'][_0x0d32('0x7f')]){_0x241362=_[_0x0d32('0x80')](_0x3e6a75[_0x0d32('0x3f')][_0x0d32('0x7f')])?_0x3e6a75[_0x0d32('0x3f')]['tag']:new Array(_0x3e6a75[_0x0d32('0x3f')][_0x0d32('0x7f')]);_0x241362[_0x0d32('0x36')](function(_0x29a764){_0x387313['or'](_0x0d32('0x6d'),'%,'+_0x29a764+',%');});}if(_0x3e6a75[_0x0d32('0x3f')][_0x0d32('0x81')]){var _0x3efe84=_0x3e6a75[_0x0d32('0x3f')][_0x0d32('0x81')][_0x0d32('0x82')]('\x5c','\x5c\x5c')[_0x0d32('0x82')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x3efe84)){_0x2571b5['or'](_0x0d32('0x83'),_0x3efe84+'%');}else{_0x2571b5['or'](_0x0d32('0x84'),qs[_0x0d32('0x85')](_0x3efe84))['or']('i.from\x20LIKE\x20?',_0x3efe84+'%')['or'](_0x0d32('0x86'),_0x3efe84+'%');}}}_0x186ff5[_0x0d32('0x4a')](_0x2571b5);_0x186ff5[_0x0d32('0x87')](_0x0d32('0x88'));var _0x12c605={'type':db[_0x0d32('0x89')][_0x0d32('0x8a')]['SELECT'],'raw':!![]};var _0x430e77=_0x186ff5[_0x0d32('0x8b')]();_0x430e77[_0x0d32('0x4b')]('i.id');_0x430e77['field'](_0x0d32('0x8c'),_0x0d32('0x8d'));if(_0x317770[_0x0d32('0x48')]){_0x317770[_0x0d32('0x48')][_0x0d32('0x36')](function(_0x2e0981){var _0x7ea851=_0x2e0981[0x0]===_0x0d32('0x8e')?_0x2e0981[0x0]:'i.'+_0x2e0981[0x0];_0x186ff5[_0x0d32('0x48')](_0x7ea851,_0x2e0981[0x1]===_0x0d32('0x8f')?![]:!![]);});}if(!_[_0x0d32('0x90')](_0x241362)){_0x186ff5['having'](_0x387313);_0x430e77[_0x0d32('0x4a')](_0x0d32('0x91'),_0x241362);}BPromise[_0x0d32('0x92')]()[_0x0d32('0x29')](function(){if(!_0x544d19){if(_0x3e6a75[_0x0d32('0x3f')][_0x0d32('0x77')])return;_0x430e77[_0x0d32('0x4a')](_0x0d32('0x93'));_0x186ff5[_0x0d32('0x4a')](_0x0d32('0x93'));return;}if(_0x3e6a75[_0x0d32('0x94')]['role']!==_0x0d32('0x95'))return;return _0x3e6a75[_0x0d32('0x94')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x0d32('0x29')](function(_0x5f21b3){if(_[_0x0d32('0x90')](_0x5f21b3)){_0x430e77[_0x0d32('0x4a')](_0x0d32('0x96'));_0x186ff5[_0x0d32('0x4a')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x430e77[_0x0d32('0x4a')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x0d32('0x31')](_0x5f21b3,'id'));_0x186ff5[_0x0d32('0x4a')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x0d32('0x31')](_0x5f21b3,'id'));}});})[_0x0d32('0x29')](function(){if(_0x3e6a75[_0x0d32('0x94')][_0x0d32('0x97')]===_0x0d32('0x95')&&!_0x544d19&&!_0x3e6a75[_0x0d32('0x3f')][_0x0d32('0x77')])return[];return db[_0x0d32('0x98')]['query'](_0x430e77[_0x0d32('0x99')](),_0x12c605);})[_0x0d32('0x29')](function(_0x831222){_0x32b31e[_0x0d32('0x20')]=_0x831222[_0x0d32('0x45')];if(_0x32b31e['count']===0x0)return[];return db[_0x0d32('0x98')][_0x0d32('0x3f')](_0x477665[_0x0d32('0x99')](),_0x12c605)[_0x0d32('0x29')](function(_0xb87a8c){_0x174161=_['keyBy'](_0xb87a8c,'id');_0x12c605=_[_0x0d32('0x9a')](_0x12c605,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3e6a75['query']['fields']){_0x317770[_0x0d32('0x42')]['forEach'](function(_0x5eef7d){_0x186ff5[_0x0d32('0x4b')]('i.'+_0x5eef7d);});}else{_0x186ff5['field'](_0x0d32('0x8c'),'unreadMessages');_0x186ff5[_0x0d32('0x4b')]('a.key',_0x0d32('0x9b'));_0x186ff5[_0x0d32('0x4b')]('a.mandatoryDisposition',_0x0d32('0x9c'));_0x186ff5[_0x0d32('0x4b')](_0x0d32('0x9d'),_0x0d32('0x8e'));_0x186ff5['field'](_0x0d32('0x9e'));_0x186ff5[_0x0d32('0x4b')](_0x0d32('0x9f'),_0x0d32('0xa0'));_0x186ff5[_0x0d32('0x4b')](_0x0d32('0xa1'),_0x0d32('0xa2'));_0x186ff5['field'](_0x0d32('0xa3'),_0x0d32('0xa4'));_0x186ff5['field']('c.phone',_0x0d32('0xa5'));_0x186ff5[_0x0d32('0x4b')]('c.mobile',_0x0d32('0xa6'));_0x186ff5['field']('c.fax',_0x0d32('0xa7'));_0x186ff5[_0x0d32('0x4b')](_0x0d32('0xa8'),_0x0d32('0xa9'));_0x186ff5[_0x0d32('0x4b')](_0x0d32('0xaa'),'Owner.internal');_0x186ff5['field'](_0x0d32('0xab'),_0x0d32('0x33'));}if(_0x317770['limit'])_0x186ff5['limit'](_0x317770[_0x0d32('0x22')]);if(_0x317770['offset'])_0x186ff5[_0x0d32('0x21')](_0x317770[_0x0d32('0x21')]);return db[_0x0d32('0x98')]['query'](_0x186ff5[_0x0d32('0x99')](),_0x12c605);})[_0x0d32('0x29')](function(_0x25a293){_0x2ca7c8['where'](_0x0d32('0xac'),_[_0x0d32('0x31')](_0x25a293,'id'));return db['sequelize'][_0x0d32('0x3f')](_0x2ca7c8['toString'](),_0x12c605)[_0x0d32('0x29')](function(_0x284c97){var _0x1d18cb=_[_0x0d32('0xad')](_0x284c97,'OpenchannelInteractionId');var _0x546574=[];_0x25a293[_0x0d32('0x36')](function(_0x592a26){_0x546574['push'](updateOpenchannelInteraction(_0x592a26,_0x174161,_0x1d18cb));});return BPromise['all'](_0x546574);});});})['then'](function(_0x53e1ac){_0x32b31e[_0x0d32('0xae')]=_0x53e1ac;return _0x32b31e;})['then'](respondWithFilteredResult(_0x10fa26,_0x317770))[_0x0d32('0x37')](handleError(_0x10fa26,null));};exports[_0x0d32('0xaf')]=function(_0x36e7fb,_0x25f4f2){var _0x2b8f4b={};if(_0x36e7fb['query'][_0x0d32('0x3c')]&&_0x36e7fb[_0x0d32('0x3f')][_0x0d32('0x3c')]==='from'){_0x2b8f4b[_0x0d32('0x50')]=_0x36e7fb['params']['id'];}else{_0x2b8f4b['id']=_0x36e7fb['params']['id'];}var _0x1bc990={'raw':![],'where':_0x2b8f4b},_0x40cf41={};_0x40cf41[_0x0d32('0x3e')]=_['keys'](db['OpenchannelInteraction'][_0x0d32('0x3a')]);_0x40cf41[_0x0d32('0x3f')]=_['keys'](_0x36e7fb['query']);_0x40cf41[_0x0d32('0x41')]=_[_0x0d32('0x43')](_0x40cf41[_0x0d32('0x3e')],_0x40cf41[_0x0d32('0x3f')]);_0x1bc990[_0x0d32('0x42')]=_[_0x0d32('0x43')](_0x40cf41[_0x0d32('0x3e')],qs[_0x0d32('0x44')](_0x36e7fb['query'][_0x0d32('0x44')]));_0x1bc990[_0x0d32('0x42')]=_0x1bc990[_0x0d32('0x42')][_0x0d32('0x45')]?_0x1bc990[_0x0d32('0x42')]:_0x40cf41[_0x0d32('0x3e')];if(_0x36e7fb[_0x0d32('0x3f')][_0x0d32('0xb0')]){_0x1bc990[_0x0d32('0xb1')]=[{'all':!![]}];}_0x1bc990=_[_0x0d32('0x9a')]({},_0x1bc990,_0x36e7fb[_0x0d32('0xb2')]);return db[_0x0d32('0x39')][_0x0d32('0x69')](_0x1bc990)[_0x0d32('0x29')](handleEntityNotFound(_0x25f4f2,null))[_0x0d32('0x29')](respondWithResult(_0x25f4f2,null))[_0x0d32('0x37')](handleError(_0x25f4f2,null));};exports[_0x0d32('0xb3')]=function(_0x1dfb5e,_0x15159d){return db['OpenchannelInteraction'][_0x0d32('0xb3')](_0x1dfb5e[_0x0d32('0x75')],{})[_0x0d32('0x29')](respondWithResult(_0x15159d,0xc9))['catch'](handleError(_0x15159d,null));};exports[_0x0d32('0x28')]=function(_0x2d5572,_0x2c180b){if(_0x2d5572['body']['id']){delete _0x2d5572[_0x0d32('0x75')]['id'];}return db[_0x0d32('0x39')][_0x0d32('0x69')]({'where':{'id':_0x2d5572[_0x0d32('0xb4')]['id']}})[_0x0d32('0x29')](handleEntityNotFound(_0x2c180b,null))[_0x0d32('0x29')](saveUpdates(_0x2d5572[_0x0d32('0x75')],null))[_0x0d32('0x29')](respondWithResult(_0x2c180b,null))[_0x0d32('0x37')](handleError(_0x2c180b,null));};exports[_0x0d32('0x2a')]=function(_0x1c7970,_0x5f40ee){return db['OpenchannelInteraction'][_0x0d32('0x69')]({'where':{'id':_0x1c7970[_0x0d32('0xb4')]['id']}})[_0x0d32('0x29')](handleEntityNotFound(_0x5f40ee,null))[_0x0d32('0x29')](removeEntity(_0x5f40ee,null))[_0x0d32('0x37')](handleError(_0x5f40ee,null));};exports['describe']=function(_0x5248b4,_0x36cc4d){return db[_0x0d32('0x39')][_0x0d32('0xb5')]()[_0x0d32('0x29')](respondWithResult(_0x36cc4d,null))[_0x0d32('0x37')](handleError(_0x36cc4d,null));};exports[_0x0d32('0xb6')]=function(_0x25e551,_0x7c5131,_0x458846){return db[_0x0d32('0xb7')][_0x0d32('0x69')]({'where':{'id':_0x25e551[_0x0d32('0xb4')]['id']}})[_0x0d32('0x29')](handleEntityNotFound(_0x7c5131,null))[_0x0d32('0x29')](function(_0x1f02c6){if(_0x1f02c6){return _0x1f02c6[_0x0d32('0xb6')](_0x25e551[_0x0d32('0x75')][_0x0d32('0xb8')],_['omit'](_0x25e551[_0x0d32('0x75')],[_0x0d32('0xb8'),'id'])||{});}})['then'](respondWithResult(_0x7c5131,null))[_0x0d32('0x37')](handleError(_0x7c5131,null));};exports['getMessages']=function(_0x4999cd,_0x5d78bc,_0xe8c34d){var _0x69e341={'raw':![],'where':{}};var _0x538b5f={};var _0x3969e4={'count':0x0,'rows':[]};return db[_0x0d32('0x39')][_0x0d32('0xb9')]({'where':{'id':_0x4999cd['params']['id']}})[_0x0d32('0x29')](handleEntityNotFound(_0x5d78bc,null))[_0x0d32('0x29')](function(_0x277c0d){if(_0x277c0d){_0x538b5f[_0x0d32('0x3e')]=_[_0x0d32('0x40')](db[_0x0d32('0xb7')][_0x0d32('0x3a')]);_0x538b5f[_0x0d32('0x3f')]=_[_0x0d32('0x40')](_0x4999cd[_0x0d32('0x3f')]);_0x538b5f['filters']=_['intersection'](_0x538b5f[_0x0d32('0x3e')],_0x538b5f[_0x0d32('0x3f')]);_0x69e341[_0x0d32('0x42')]=_[_0x0d32('0x43')](_0x538b5f[_0x0d32('0x3e')],qs[_0x0d32('0x44')](_0x4999cd[_0x0d32('0x3f')][_0x0d32('0x44')]));_0x69e341[_0x0d32('0x42')]=_0x69e341[_0x0d32('0x42')][_0x0d32('0x45')]?_0x69e341['attributes']:_0x538b5f[_0x0d32('0x3e')];if(!_0x4999cd[_0x0d32('0x3f')][_0x0d32('0x46')]('nolimit')){_0x69e341[_0x0d32('0x22')]=qs[_0x0d32('0x22')](_0x4999cd[_0x0d32('0x3f')][_0x0d32('0x22')]);_0x69e341['offset']=qs[_0x0d32('0x21')](_0x4999cd[_0x0d32('0x3f')][_0x0d32('0x21')]);}_0x69e341[_0x0d32('0x48')]=qs[_0x0d32('0x49')](_0x4999cd[_0x0d32('0x3f')]['sort']);_0x69e341[_0x0d32('0x4a')]=qs[_0x0d32('0x41')](_[_0x0d32('0xba')](_0x4999cd[_0x0d32('0x3f')],_0x538b5f[_0x0d32('0x41')]));_0x69e341['where']['OpenchannelInteractionId']=_0x277c0d['id'];if(_0x4999cd['query'][_0x0d32('0x81')]){_0x69e341[_0x0d32('0x4a')]=_[_0x0d32('0x9a')](_0x69e341[_0x0d32('0x4a')],{'$or':_[_0x0d32('0x31')](_0x69e341[_0x0d32('0x42')],function(_0x1522de){var _0x593477={};_0x593477[_0x1522de]={'$like':'%'+_0x4999cd[_0x0d32('0x3f')][_0x0d32('0x81')]+'%'};return _0x593477;})});}if(_0x4999cd['query'][_0x0d32('0xbb')]){var _0xfd8ef8=_0x4999cd[_0x0d32('0x3f')]['$gte'][_0x0d32('0x35')](',');var _0x3d4c91={};_0x3d4c91[_0xfd8ef8[0x0]]={'$gte':moment(_0xfd8ef8[0x1])[_0x0d32('0xbc')](_0x0d32('0xbd'))};_0x69e341[_0x0d32('0x4a')]=_[_0x0d32('0x9a')](_0x69e341['where'],_0x3d4c91);}_0x69e341=_['merge']({},_0x69e341,_0x4999cd['options']);return db['OpenchannelMessage'][_0x0d32('0x20')]({'where':_0x69e341[_0x0d32('0x4a')]})[_0x0d32('0x29')](function(_0x465823){_0x3969e4[_0x0d32('0x20')]=_0x465823;if(_0x4999cd[_0x0d32('0x3f')]['includeAll']){_0x69e341[_0x0d32('0xb1')]=[{'all':!![]}];}return db[_0x0d32('0xb7')][_0x0d32('0xbe')](_0x69e341);})[_0x0d32('0x29')](function(_0x49af23){_0x3969e4[_0x0d32('0xae')]=_0x49af23;return _0x3969e4;});}})[_0x0d32('0x29')](respondWithFilteredResult(_0x5d78bc,_0x69e341))['catch'](handleError(_0x5d78bc,null));};exports[_0x0d32('0xbf')]=function(_0x3031a2,_0x14079f,_0xb36ced){return db[_0x0d32('0x39')][_0x0d32('0x69')]({'where':{'id':_0x3031a2[_0x0d32('0xb4')]['id']}})[_0x0d32('0x29')](handleEntityNotFound(_0x14079f,null))[_0x0d32('0x29')](function(_0x134355){if(_0x134355){return _0x134355[_0x0d32('0xc0')](_0x3031a2[_0x0d32('0x75')]['ids'],_['omit'](_0x3031a2[_0x0d32('0x75')],[_0x0d32('0xb8'),'id'])||{})['spread'](function(){return db[_0x0d32('0x6c')]['findAll']({'attributes':['id','name',_0x0d32('0x4c')],'where':{'id':_0x3031a2[_0x0d32('0x75')][_0x0d32('0xb8')]}});})[_0x0d32('0x29')](function(_0x396a52){socket[_0x0d32('0xc1')](_0x0d32('0xc2'),{'id':Number(_0x3031a2['params']['id']),'tags':_0x396a52||[]});return{'id':Number(_0x3031a2[_0x0d32('0xb4')]['id']),'tags':_0x396a52||[]};});}})[_0x0d32('0x29')](respondWithResult(_0x14079f,null))[_0x0d32('0x37')](handleError(_0x14079f,null));};exports[_0x0d32('0xc3')]=function(_0x140a39,_0x5cbad1,_0x5b9825){return db[_0x0d32('0x39')][_0x0d32('0x69')]({'where':{'id':_0x140a39[_0x0d32('0xb4')]['id']}})[_0x0d32('0x29')](handleEntityNotFound(_0x5cbad1,null))[_0x0d32('0x29')](function(_0x332cf6){if(_0x332cf6){return _0x332cf6[_0x0d32('0xc3')](_0x140a39['query']['ids']);}})['then'](respondWithStatusCode(_0x5cbad1,null))[_0x0d32('0x37')](handleError(_0x5cbad1,null));};exports['download']=function(_0x28c88a,_0x3b39a7){var _0x1717c8=moment()[_0x0d32('0xc4')]()[_0x0d32('0x99')]();var _0x36bf5e=path[_0x0d32('0xc5')](config[_0x0d32('0xc6')],_0x0d32('0xc7'),_0x0d32('0xc8'),'tmp');var _0x124bc1=path['join'](config['root'],_0x0d32('0xc7'),_0x0d32('0xc8'),_0x0d32('0xc9'));var _0x1c5dcb=path[_0x0d32('0xc5')](_0x36bf5e,_0x1717c8);var _0x456db4=util[_0x0d32('0xbc')](_0x0d32('0xca'),_0x28c88a[_0x0d32('0xb4')]['id'],_0x1717c8);var _0x1afdb3=path[_0x0d32('0xc5')](_0x36bf5e,_0x456db4);var _0x9bbaf6=[];_0x9bbaf6['push']({'model':db[_0x0d32('0x6f')],'as':_0x0d32('0x6f'),'attributes':['id',_0x0d32('0x32')],'raw':!![]});_0x9bbaf6['push']({'model':db[_0x0d32('0xcb')],'as':'Contact','attributes':['id',_0x0d32('0xcc'),_0x0d32('0xcd')],'raw':!![]});if(_0x28c88a['query']['attachments']){_0x9bbaf6[_0x0d32('0xce')]({'model':db[_0x0d32('0xcf')],'as':_0x0d32('0xcf'),'raw':!![]});}var _0x3b6fb5=[{'model':db['OpenchannelMessage'],'as':_0x0d32('0xd0'),'attributes':['id',_0x0d32('0x75'),_0x0d32('0xd1'),'direction',_0x0d32('0xd2'),_0x0d32('0x7c')],'include':_0x9bbaf6}];_0x3b6fb5[_0x0d32('0xce')]({'model':db['OpenchannelAccount'],'as':'Account','attributes':['id',_0x0d32('0x2e')]});_0x3b6fb5[_0x0d32('0xce')]({'model':db[_0x0d32('0x6f')],'as':'Owner','attributes':['id',_0x0d32('0x32')]});return db[_0x0d32('0x39')][_0x0d32('0x69')]({'where':{'id':_0x28c88a[_0x0d32('0xb4')]['id']},'include':_0x3b6fb5})['then'](handleEntityNotFound(_0x3b39a7,null))['then'](function(_0x1cb0f5){if(_0x1cb0f5){var _0x3f4bf2=_0x1cb0f5['get']({'plain':!![]});fs[_0x0d32('0xd3')](_0x1c5dcb);var _0x4b197e={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':_0x0d32('0xd4')}},'footer':{'height':_0x0d32('0xd5'),'contents':{'default':util[_0x0d32('0xbc')](_0x0d32('0xd6'),util['format'](_0x0d32('0xd7'),_0x0d32('0xd8'),_0x3f4bf2['id']),moment()['format']('YYYY-MM-DD')['toString']())}}};var _0x113f0d={'channel':'Openchannel','account':_0x3f4bf2[_0x0d32('0xd9')][_0x0d32('0x2e')],'agent':_0x3f4bf2[_0x0d32('0xda')]?_0x3f4bf2['Owner']['fullname']:_0x0d32('0xdb'),'createdAt':moment(_0x3f4bf2[_0x0d32('0xd1')])[_0x0d32('0xbc')](_0x0d32('0xbd'))[_0x0d32('0x99')](),'closedAt':_0x3f4bf2[_0x0d32('0xdc')]?moment(_0x3f4bf2['closedAt'])[_0x0d32('0xbc')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0d32('0x99')]():'','disposition':_0x3f4bf2['disposition'],'visibility':_0x3f4bf2[_0x0d32('0xdd')]?_0x0d32('0xde'):_0x0d32('0xdf'),'messages':_(_0x3f4bf2[_0x0d32('0xd0')])[_0x0d32('0x81')]({'secret':![]})['map'](function(_0x5202f6){if(_0x5202f6['Attachment']){var _0xc9f648=path['join'](_0x124bc1,_0x5202f6[_0x0d32('0xcf')][_0x0d32('0xe0')]);if(fs['existsSync'](_0xc9f648)){fs[_0x0d32('0xe1')](_0xc9f648)[_0x0d32('0xe2')](fs[_0x0d32('0xe3')](path['join'](_0x1c5dcb,_0x5202f6[_0x0d32('0xcf')]['basename'])));}}return{'date':moment(_0x5202f6['createdAt'])['format'](_0x0d32('0xbd'))[_0x0d32('0x99')](),'sender':_0x5202f6[_0x0d32('0xe4')]===_0x0d32('0xe5')?_0x5202f6[_0x0d32('0x6f')]?_0x5202f6['User']['fullname']:_0x0d32('0xe6'):_0x5202f6[_0x0d32('0xe7')][_0x0d32('0xcc')]+(_0x5202f6['Contact'][_0x0d32('0xcd')]?'\x20'+_0x5202f6[_0x0d32('0xe7')]['lastName']:''),'body':_0x5202f6['Attachment']?_0x5202f6[_0x0d32('0xcf')]['basename']:_0x5202f6[_0x0d32('0x75')],'direction':_0x5202f6[_0x0d32('0xe4')]===_0x0d32('0xe5')?'A':'C','secret':_0x5202f6['secret'],'read':_0x5202f6[_0x0d32('0x7c')],'attachment':_0x5202f6['Attachment']};})['value']()};return ejs['renderFile'](path[_0x0d32('0xc5')](config[_0x0d32('0xc6')],_0x0d32('0xc7'),'views',_0x0d32('0xe8')),{'interaction':_0x113f0d})['then'](function(_0x34ba66){return new BPromise(function(_0x131b63,_0x3d5fb0){pdf[_0x0d32('0xb3')](_0x34ba66,_0x4b197e)[_0x0d32('0xe9')](path['join'](_0x1c5dcb,_0x0d32('0xea')+_0x3f4bf2['id']+'-'+_0x1717c8+'.pdf'),function(_0x2f2834,_0x9cd92a){if(_0x2f2834)return _0x3d5fb0(_0x2f2834);_0x131b63(_0x9cd92a);});});})[_0x0d32('0x29')](function(){return new BPromise(function(_0x43c0e1,_0x1993f0){zipdir(_0x1c5dcb,{'saveTo':_0x1afdb3},function(_0x1ca43d,_0x416ec4){if(_0x1ca43d)return _0x1993f0(_0x1ca43d);return _0x43c0e1(_0x416ec4);});})[_0x0d32('0x29')](function(){return new BPromise(function(_0x61dc64,_0x11dcbc){rimraf(_0x1c5dcb,function(_0x2e1084){if(_0x2e1084)_0x11dcbc(_0x2e1084);return _0x61dc64();});});})[_0x0d32('0x29')](function(){return _0x3b39a7[_0x0d32('0xeb')](_0x1afdb3,_0x456db4,function(_0x4ff7fe){if(_0x4ff7fe){console[_0x0d32('0xec')]('err',_0x4ff7fe);}else{fs['unlinkSync'](_0x1afdb3);}});});});}else{return _0x3b39a7[_0x0d32('0x1e')](0xc8);}})['catch'](handleError(_0x3b39a7,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index ef15e7c..6bd5487 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 _0x9b71=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hook'];(function(_0x383875,_0x45b02b){var _0x128fc2=function(_0x247f99){while(--_0x247f99){_0x383875['push'](_0x383875['shift']());}};_0x128fc2(++_0x45b02b);}(_0x9b71,0x1aa));var _0x19b7=function(_0x51b25d,_0x4035cf){_0x51b25d=_0x51b25d-0x0;var _0x5351de=_0x9b71[_0x51b25d];return _0x5351de;};'use strict';var EventEmitter=require(_0x19b7('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x19b7('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x19b7('0x2')](0x0);var events={'afterCreate':_0x19b7('0x3'),'afterUpdate':_0x19b7('0x4'),'afterDestroy':_0x19b7('0x5')};function emitEvent(_0x2b140b){return function(_0x5df642,_0x5f4f75,_0x13e522){_0x5df642[_0x19b7('0x6')]({'attributes':['id'],'raw':!![]})[_0x19b7('0x7')](function(_0xf852e0){_0x5df642[_0x19b7('0x8')](_0x19b7('0x9'),_0xf852e0[_0x19b7('0xa')](function(_0x2b1e32){return{'id':_0x2b1e32['id']};}));return OpenchannelMessage[_0x19b7('0xb')]({'where':{'OpenchannelInteractionId':_0x5df642['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1ada88){_0x5df642[_0x19b7('0x8')]('unreadMessages',_0x1ada88[_0x19b7('0xc')]);OpenchannelInteractionEvents[_0x19b7('0xd')](_0x2b140b+':'+_0x5df642['id'],_0x5df642);OpenchannelInteractionEvents[_0x19b7('0xd')](_0x2b140b,_0x5df642);_0x13e522(null);})[_0x19b7('0xe')](_0x13e522(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x19b7('0xf')](e,emitEvent(event));}}module[_0x19b7('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xb496=['emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','setDataValue','Users','map','findAll','unreadMessages','length'];(function(_0x1abd00,_0x45e4c6){var _0x4bd89d=function(_0xe44110){while(--_0xe44110){_0x1abd00['push'](_0x1abd00['shift']());}};_0x4bd89d(++_0x45e4c6);}(_0xb496,0x143));var _0x6b49=function(_0x818dfc,_0x1b8b1b){_0x818dfc=_0x818dfc-0x0;var _0x5a3be9=_0xb496[_0x818dfc];return _0x5a3be9;};'use strict';var EventEmitter=require(_0x6b49('0x0'));var OpenchannelInteraction=require(_0x6b49('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x6b49('0x1'))['db'][_0x6b49('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x6b49('0x3')](0x0);var events={'afterCreate':_0x6b49('0x4'),'afterUpdate':_0x6b49('0x5'),'afterDestroy':_0x6b49('0x6')};function emitEvent(_0x37f2c8){return function(_0x590fc0,_0x4b848c,_0x34aa9b){_0x590fc0['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x1b8dce){_0x590fc0[_0x6b49('0x7')](_0x6b49('0x8'),_0x1b8dce[_0x6b49('0x9')](function(_0x3573ee){return{'id':_0x3573ee['id']};}));return OpenchannelMessage[_0x6b49('0xa')]({'where':{'OpenchannelInteractionId':_0x590fc0['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x484ed4){_0x590fc0[_0x6b49('0x7')](_0x6b49('0xb'),_0x484ed4[_0x6b49('0xc')]);OpenchannelInteractionEvents[_0x6b49('0xd')](_0x37f2c8+':'+_0x590fc0['id'],_0x590fc0);OpenchannelInteractionEvents[_0x6b49('0xd')](_0x37f2c8,_0x590fc0);_0x34aa9b(null);})['catch'](_0x34aa9b(null));};}for(var e in events){if(events[_0x6b49('0xe')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x6b49('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index d1f0c2e..f176b67 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 _0x8f9d=['../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','openchannel_interactions','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x4c4f8a,_0x4efb9f){var _0x55b208=function(_0x17fe7d){while(--_0x17fe7d){_0x4c4f8a['push'](_0x4c4f8a['shift']());}};_0x55b208(++_0x4efb9f);}(_0x8f9d,0x93));var _0xd8f9=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8f9d[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xd8f9('0x0'));var util=require('util');var logger=require(_0xd8f9('0x1'))('api');var moment=require(_0xd8f9('0x2'));var BPromise=require(_0xd8f9('0x3'));var rp=require(_0xd8f9('0x4'));var fs=require('fs');var path=require(_0xd8f9('0x5'));var rimraf=require(_0xd8f9('0x6'));var config=require(_0xd8f9('0x7'));var attributes=require(_0xd8f9('0x8'));module['exports']=function(_0x1c37be,_0x24dd1e){return _0x1c37be[_0xd8f9('0x9')](_0xd8f9('0xa'),attributes,{'tableName':_0xd8f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5c410f,_0x46babd,_0x6691e){if(_0x5c410f['changed'](_0xd8f9('0xc'))){_0x5c410f['closedAt']=moment()['format'](_0xd8f9('0xd'));}_0x6691e(null,_0x5c410f);}}});}; \ No newline at end of file +var _0xe5d5=['openchannel_interactions','changed','closed','format','../../config/logger','moment','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction'];(function(_0x2e1750,_0x1d52d0){var _0x536d5a=function(_0x295ff3){while(--_0x295ff3){_0x2e1750['push'](_0x2e1750['shift']());}};_0x536d5a(++_0x1d52d0);}(_0xe5d5,0x156));var _0x5e5d=function(_0x3277b7,_0x2c5769){_0x3277b7=_0x3277b7-0x0;var _0x58270a=_0xe5d5[_0x3277b7];return _0x58270a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5e5d('0x0'))('api');var moment=require(_0x5e5d('0x1'));var BPromise=require('bluebird');var rp=require(_0x5e5d('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5e5d('0x3'));var config=require(_0x5e5d('0x4'));var attributes=require(_0x5e5d('0x5'));module[_0x5e5d('0x6')]=function(_0x13bcb7,_0x39077f){return _0x13bcb7[_0x5e5d('0x7')](_0x5e5d('0x8'),attributes,{'tableName':_0x5e5d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x131a59,_0x11973c,_0x1fdb77){if(_0x131a59[_0x5e5d('0xa')](_0x5e5d('0xb'))){_0x131a59['closedAt']=moment()[_0x5e5d('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1fdb77(null,_0x131a59);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 9c267a4..ebe0bd6 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 _0x5699=['where','attributes','limit','AddTagsToOpenchannelInteraction','find','then','addTags','ids','spread','AddTags','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x5699,0xaf));var _0x9569=function(_0x3514ae,_0x3a6ffa){_0x3514ae=_0x3514ae-0x0;var _0x1f168c=_0x5699[_0x3514ae];return _0x1f168c;};'use strict';var _=require(_0x9569('0x0'));var util=require(_0x9569('0x1'));var moment=require(_0x9569('0x2'));var BPromise=require('bluebird');var rs=require(_0x9569('0x3'));var fs=require('fs');var Redis=require(_0x9569('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9569('0x5'));var logger=require(_0x9569('0x6'))('rpc');var config=require(_0x9569('0x7'));var jayson=require(_0x9569('0x8'));var client=jayson[_0x9569('0x9')][_0x9569('0xa')]({'port':0x232a});config['redis']=_[_0x9569('0xb')](config['redis'],{'host':_0x9569('0xc'),'port':0x18eb});var socket=require(_0x9569('0xd'))(new Redis(config['redis']));require(_0x9569('0xe'))[_0x9569('0xf')](socket);function respondWithRpcPromise(_0x2077d0,_0x467e1a,_0x37a32a){return new BPromise(function(_0x5c799b,_0x4708ca){return client['request'](_0x2077d0,_0x37a32a)['then'](function(_0x454867){logger['info'](_0x9569('0x10'),_0x467e1a,_0x9569('0x11'));logger[_0x9569('0x12')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x467e1a,'request\x20sent',JSON[_0x9569('0x13')](_0x454867));if(_0x454867['error']){if(_0x454867['error'][_0x9569('0x14')]===0x1f4){logger[_0x9569('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x467e1a,_0x454867['error'][_0x9569('0x16')]);return _0x4708ca(_0x454867[_0x9569('0x15')][_0x9569('0x16')]);}logger[_0x9569('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x467e1a,_0x454867['error'][_0x9569('0x16')]);return _0x5c799b(_0x454867['error'][_0x9569('0x16')]);}else{logger[_0x9569('0x17')](_0x9569('0x10'),_0x467e1a,_0x9569('0x11'));_0x5c799b(_0x454867['result'][_0x9569('0x16')]);}})['catch'](function(_0x2d393b){logger[_0x9569('0x15')](_0x9569('0x10'),_0x467e1a,_0x2d393b);_0x4708ca(_0x2d393b);});});}exports[_0x9569('0x18')]=function(_0x308b9e){var _0x54acf8=this;return new Promise(function(_0x1da65d,_0xfc0d24){return db[_0x9569('0x19')][_0x9569('0x1a')](_0x308b9e[_0x9569('0x1b')],{'raw':_0x308b9e[_0x9569('0x1c')]?_0x308b9e[_0x9569('0x1c')][_0x9569('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x308b9e[_0x9569('0x1c')]?_0x308b9e['options'][_0x9569('0x1e')]||null:null,'attributes':_0x308b9e['options']?_0x308b9e[_0x9569('0x1c')][_0x9569('0x1f')]||null:null,'limit':_0x308b9e[_0x9569('0x1c')]?_0x308b9e[_0x9569('0x1c')][_0x9569('0x20')]||null:null})['then'](function(_0x12476c){logger[_0x9569('0x17')](_0x9569('0x18'),_0x308b9e);logger[_0x9569('0x12')](_0x9569('0x18'),_0x308b9e,JSON[_0x9569('0x13')](_0x12476c));_0x1da65d(_0x12476c);})['catch'](function(_0x41f47b){logger['error']('UpdateOpenchannelInteraction',_0x41f47b[_0x9569('0x16')],_0x308b9e);_0xfc0d24(_0x54acf8['error'](0x1f4,_0x41f47b[_0x9569('0x16')]));});});};exports[_0x9569('0x21')]=function(_0x18ce3d){return new Promise(function(_0x43e505,_0x25cc38){return db[_0x9569('0x19')][_0x9569('0x22')]({'where':_0x18ce3d[_0x9569('0x1c')]?_0x18ce3d[_0x9569('0x1c')][_0x9569('0x1e')]||null:null})[_0x9569('0x23')](function(_0x2b3e1d){if(_0x2b3e1d){return _0x2b3e1d[_0x9569('0x24')](_0x18ce3d['body'][_0x9569('0x25')],_['omit'](_0x18ce3d[_0x9569('0x1b')],[_0x9569('0x25'),'id'])||{});}})[_0x9569('0x26')](function(_0x58178f){logger[_0x9569('0x17')](_0x9569('0x27'),_0x18ce3d);logger['debug'](_0x9569('0x27'),_0x18ce3d,JSON['stringify'](_0x58178f));_0x43e505(_0x58178f);})[_0x9569('0x28')](function(_0x2bc6d1){logger[_0x9569('0x15')](_0x9569('0x27'),_0x2bc6d1[_0x9569('0x16')],_0x18ce3d);_0x25cc38(_this[_0x9569('0x15')](0x1f4,_0x2bc6d1['message']));});});}; \ No newline at end of file +var _0xcd88=['request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','attributes','limit','then','debug','AddTagsToOpenchannelInteraction','find','where','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','defaults','redis','register'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xcd88,0x1ee));var _0x8cd8=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xcd88[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0x8cd8('0x0'));var util=require(_0x8cd8('0x1'));var moment=require(_0x8cd8('0x2'));var BPromise=require(_0x8cd8('0x3'));var rs=require(_0x8cd8('0x4'));var fs=require('fs');var Redis=require(_0x8cd8('0x5'));var db=require(_0x8cd8('0x6'))['db'];var utils=require(_0x8cd8('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x8cd8('0x8'));var jayson=require(_0x8cd8('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x8cd8('0xa')](config[_0x8cd8('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8cd8('0xb')]));require('./openchannelInteraction.socket')[_0x8cd8('0xc')](socket);function respondWithRpcPromise(_0x54a1a6,_0x2a34a0,_0x5abd9e){return new BPromise(function(_0x2bb91c,_0x5ce390){return client[_0x8cd8('0xd')](_0x54a1a6,_0x5abd9e)['then'](function(_0xcb2d07){logger[_0x8cd8('0xe')](_0x8cd8('0xf'),_0x2a34a0,_0x8cd8('0x10'));logger['debug'](_0x8cd8('0x11'),_0x2a34a0,_0x8cd8('0x10'),JSON[_0x8cd8('0x12')](_0xcb2d07));if(_0xcb2d07['error']){if(_0xcb2d07['error']['code']===0x1f4){logger[_0x8cd8('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2a34a0,_0xcb2d07['error']['message']);return _0x5ce390(_0xcb2d07['error'][_0x8cd8('0x14')]);}logger[_0x8cd8('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2a34a0,_0xcb2d07[_0x8cd8('0x13')][_0x8cd8('0x14')]);return _0x2bb91c(_0xcb2d07[_0x8cd8('0x13')]['message']);}else{logger[_0x8cd8('0xe')](_0x8cd8('0xf'),_0x2a34a0,'request\x20sent');_0x2bb91c(_0xcb2d07[_0x8cd8('0x15')]['message']);}})[_0x8cd8('0x16')](function(_0x393759){logger[_0x8cd8('0x13')](_0x8cd8('0xf'),_0x2a34a0,_0x393759);_0x5ce390(_0x393759);});});}exports[_0x8cd8('0x17')]=function(_0x542acb){var _0x4b1fd6=this;return new Promise(function(_0x2e23aa,_0x208477){return db[_0x8cd8('0x18')][_0x8cd8('0x19')](_0x542acb[_0x8cd8('0x1a')],{'raw':_0x542acb['options']?_0x542acb[_0x8cd8('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x542acb[_0x8cd8('0x1b')]?_0x542acb[_0x8cd8('0x1b')]['where']||null:null,'attributes':_0x542acb[_0x8cd8('0x1b')]?_0x542acb[_0x8cd8('0x1b')][_0x8cd8('0x1c')]||null:null,'limit':_0x542acb['options']?_0x542acb[_0x8cd8('0x1b')][_0x8cd8('0x1d')]||null:null})[_0x8cd8('0x1e')](function(_0x2d9e5b){logger[_0x8cd8('0xe')](_0x8cd8('0x17'),_0x542acb);logger[_0x8cd8('0x1f')]('UpdateOpenchannelInteraction',_0x542acb,JSON[_0x8cd8('0x12')](_0x2d9e5b));_0x2e23aa(_0x2d9e5b);})[_0x8cd8('0x16')](function(_0x40f3fa){logger[_0x8cd8('0x13')](_0x8cd8('0x17'),_0x40f3fa[_0x8cd8('0x14')],_0x542acb);_0x208477(_0x4b1fd6[_0x8cd8('0x13')](0x1f4,_0x40f3fa[_0x8cd8('0x14')]));});});};exports[_0x8cd8('0x20')]=function(_0x4353){return new Promise(function(_0x5445d8,_0x11d7ef){return db['OpenchannelInteraction'][_0x8cd8('0x21')]({'where':_0x4353[_0x8cd8('0x1b')]?_0x4353[_0x8cd8('0x1b')][_0x8cd8('0x22')]||null:null})['then'](function(_0x3f5f76){if(_0x3f5f76){return _0x3f5f76[_0x8cd8('0x23')](_0x4353['body'][_0x8cd8('0x24')],_['omit'](_0x4353[_0x8cd8('0x1a')],[_0x8cd8('0x24'),'id'])||{});}})[_0x8cd8('0x25')](function(_0x2fd1b4){logger[_0x8cd8('0xe')]('AddTags',_0x4353);logger[_0x8cd8('0x1f')](_0x8cd8('0x26'),_0x4353,JSON['stringify'](_0x2fd1b4));_0x5445d8(_0x2fd1b4);})[_0x8cd8('0x16')](function(_0x4cf302){logger[_0x8cd8('0x13')](_0x8cd8('0x26'),_0x4cf302[_0x8cd8('0x14')],_0x4353);_0x11d7ef(_this[_0x8cd8('0x13')](0x1f4,_0x4cf302['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index de55cd7..6ea4777 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 _0xb34b=['remove','register','length','./openchannelInteraction.events','save'];(function(_0x41ee3f,_0x177fef){var _0xdffe9f=function(_0x427568){while(--_0x427568){_0x41ee3f['push'](_0x41ee3f['shift']());}};_0xdffe9f(++_0x177fef);}(_0xb34b,0x14d));var _0xbb34=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb34b[_0x57b54c];return _0x59cc19;};'use strict';var OpenchannelInteractionEvents=require(_0xbb34('0x0'));var events=[_0xbb34('0x1'),_0xbb34('0x2'),'update'];function createListener(_0x3b6119,_0x26a5d2){return function(_0x3c407d){_0x26a5d2['emit'](_0x3b6119,_0x3c407d);};}function removeListener(_0x39aadc,_0x5aa699){return function(){OpenchannelInteractionEvents['removeListener'](_0x39aadc,_0x5aa699);};}exports[_0xbb34('0x3')]=function(_0x414768){for(var _0x54cee1=0x0,_0x2e204e=events[_0xbb34('0x4')];_0x54cee1<_0x2e204e;_0x54cee1++){var _0x3928b9=events[_0x54cee1];var _0x42b138=createListener('openchannelInteraction:'+_0x3928b9,_0x414768);OpenchannelInteractionEvents['on'](_0x3928b9,_0x42b138);}}; \ No newline at end of file +var _0xb9c1=['save','remove','emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x1cd895,_0x312feb){var _0x4c5308=function(_0x392e0e){while(--_0x392e0e){_0x1cd895['push'](_0x1cd895['shift']());}};_0x4c5308(++_0x312feb);}(_0xb9c1,0x1e7));var _0x1b9c=function(_0x3e6f92,_0x366fb4){_0x3e6f92=_0x3e6f92-0x0;var _0x218403=_0xb9c1[_0x3e6f92];return _0x218403;};'use strict';var OpenchannelInteractionEvents=require(_0x1b9c('0x0'));var events=[_0x1b9c('0x1'),_0x1b9c('0x2'),'update'];function createListener(_0x5027f8,_0x4d39b4){return function(_0x470568){_0x4d39b4[_0x1b9c('0x3')](_0x5027f8,_0x470568);};}function removeListener(_0x1cf6e9,_0x432779){return function(){OpenchannelInteractionEvents[_0x1b9c('0x4')](_0x1cf6e9,_0x432779);};}exports[_0x1b9c('0x5')]=function(_0x40100d){for(var _0x511ea6=0x0,_0x323e6a=events[_0x1b9c('0x6')];_0x511ea6<_0x323e6a;_0x511ea6++){var _0x35e771=events[_0x511ea6];var _0x9e426b=createListener(_0x1b9c('0x7')+_0x35e771,_0x40100d);OpenchannelInteractionEvents['on'](_0x35e771,_0x9e426b);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 29248ea..abf16af 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 _0x076e=['delete','destroy','exports','multer','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','put','update','accept','/:id/reject','reject'];(function(_0x562621,_0x1c7d90){var _0x410de6=function(_0x430f15){while(--_0x430f15){_0x562621['push'](_0x562621['shift']());}};_0x410de6(++_0x1c7d90);}(_0x076e,0x153));var _0xe076=function(_0x33d519,_0x5235e3){_0x33d519=_0x33d519-0x0;var _0x2f83ef=_0x076e[_0x33d519];return _0x2f83ef;};'use strict';var multer=require(_0xe076('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe076('0x1')]();var auth=require(_0xe076('0x2'));var interaction=require(_0xe076('0x3'));var config=require(_0xe076('0x4'));var controller=require('./openchannelMessage.controller');router[_0xe076('0x5')]('/',auth[_0xe076('0x6')](),controller[_0xe076('0x7')]);router[_0xe076('0x5')]('/describe',auth[_0xe076('0x6')](),controller[_0xe076('0x8')]);router[_0xe076('0x5')](_0xe076('0x9'),auth[_0xe076('0x6')](),controller[_0xe076('0xa')]);router[_0xe076('0xb')]('/',auth[_0xe076('0x6')](),interaction[_0xe076('0xc')](_0xe076('0xd'),_0xe076('0xe')),controller[_0xe076('0xf')]);router[_0xe076('0x10')](_0xe076('0x9'),auth[_0xe076('0x6')](),controller[_0xe076('0x11')]);router[_0xe076('0x10')]('/:id/accept',auth[_0xe076('0x6')](),controller[_0xe076('0x12')]);router['put'](_0xe076('0x13'),auth[_0xe076('0x6')](),controller[_0xe076('0x14')]);router[_0xe076('0x15')](_0xe076('0x9'),auth[_0xe076('0x6')](),controller[_0xe076('0x16')]);module[_0xe076('0x17')]=router; \ No newline at end of file +var _0x7e55=['/describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','isAuthenticated','index','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e55,0x138));var _0x57e5=function(_0x121886,_0x8cd8e5){_0x121886=_0x121886-0x0;var _0x20ca01=_0x7e55[_0x121886];return _0x20ca01;};'use strict';var multer=require(_0x57e5('0x0'));var util=require(_0x57e5('0x1'));var path=require(_0x57e5('0x2'));var timeout=require(_0x57e5('0x3'));var express=require('express');var router=express[_0x57e5('0x4')]();var auth=require(_0x57e5('0x5'));var interaction=require(_0x57e5('0x6'));var config=require(_0x57e5('0x7'));var controller=require(_0x57e5('0x8'));router['get']('/',auth[_0x57e5('0x9')](),controller[_0x57e5('0xa')]);router[_0x57e5('0xb')](_0x57e5('0xc'),auth[_0x57e5('0x9')](),controller['describe']);router[_0x57e5('0xb')](_0x57e5('0xd'),auth[_0x57e5('0x9')](),controller[_0x57e5('0xe')]);router[_0x57e5('0xf')]('/',auth[_0x57e5('0x9')](),interaction[_0x57e5('0x10')](_0x57e5('0x11'),_0x57e5('0x12')),controller['create']);router[_0x57e5('0x13')]('/:id',auth[_0x57e5('0x9')](),controller[_0x57e5('0x14')]);router['put'](_0x57e5('0x15'),auth['isAuthenticated'](),controller['accept']);router[_0x57e5('0x13')](_0x57e5('0x16'),auth['isAuthenticated'](),controller[_0x57e5('0x17')]);router[_0x57e5('0x18')](_0x57e5('0xd'),auth[_0x57e5('0x9')](),controller[_0x57e5('0x19')]);module[_0x57e5('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index ba395fa..7e110ef 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 _0x45aa=['medium','BOOLEAN','out','STRING','exports','TEXT'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x45aa,0x154));var _0xa45a=function(_0x318372,_0x56ae1e){_0x318372=_0x318372-0x0;var _0x518e04=_0x45aa[_0x318372];return _0x518e04;};'use strict';var Sequelize=require('sequelize');module[_0xa45a('0x0')]={'body':{'type':Sequelize[_0xa45a('0x1')](_0xa45a('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xa45a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa45a('0x4')),'defaultValue':_0xa45a('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xa45a('0x5')]},'providerResponse':{'type':Sequelize[_0xa45a('0x1')]}}; \ No newline at end of file +var _0xe1e0=['DATE','STRING','sequelize','BOOLEAN','out'];(function(_0x456cbb,_0x547275){var _0x9c3a70=function(_0x1c8686){while(--_0x1c8686){_0x456cbb['push'](_0x456cbb['shift']());}};_0x9c3a70(++_0x547275);}(_0xe1e0,0x115));var _0x0e1e=function(_0x282539,_0xb68f19){_0x282539=_0x282539-0x0;var _0x4d09c0=_0xe1e0[_0x282539];return _0x4d09c0;};'use strict';var Sequelize=require(_0x0e1e('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x0e1e('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0x0e1e('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x0e1e('0x2')),'defaultValue':_0x0e1e('0x2'),'allowNull':![]},'readAt':{'type':Sequelize[_0x0e1e('0x3')]},'providerName':{'type':Sequelize[_0x0e1e('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 135e532..6a200a1 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 _0x05dc=['length','create','body','find','describe','openchannel-interactions','accept','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','CmContact','Contact','OpenchannelInteraction','isNil','read1stAt','interaction','get','info','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','SIP/%s','event','EventManager','acceptmessage','UserId','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','channel','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','http','client','request','debug','request\x20sent','stringify','code','error','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params'];(function(_0x483e3a,_0x568361){var _0x43fca9=function(_0x273d7e){while(--_0x273d7e){_0x483e3a['push'](_0x483e3a['shift']());}};_0x43fca9(++_0x568361);}(_0x05dc,0x19c));var _0xc05d=function(_0x7430b4,_0x3526ec){_0x7430b4=_0x7430b4-0x0;var _0x44bbd5=_0x05dc[_0x7430b4];return _0x44bbd5;};'use strict';var pdf=require(_0xc05d('0x0'));var emlformat=require(_0xc05d('0x1'));var rimraf=require(_0xc05d('0x2'));var zipdir=require(_0xc05d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc05d('0x4'));var moment=require(_0xc05d('0x5'));var BPromise=require(_0xc05d('0x6'));var Mustache=require(_0xc05d('0x7'));var util=require(_0xc05d('0x8'));var path=require(_0xc05d('0x9'));var sox=require(_0xc05d('0xa'));var csv=require(_0xc05d('0xb'));var ejs=require(_0xc05d('0xc'));var fs=require('fs');var _=require(_0xc05d('0xd'));var squel=require(_0xc05d('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc05d('0xf'));var toCsv=require(_0xc05d('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc05d('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc05d('0x11'));var hardwareService=require(_0xc05d('0x12'));var logger=require(_0xc05d('0x13'))(_0xc05d('0x14'));var utils=require(_0xc05d('0x15'));var config=require(_0xc05d('0x16'));var licenseUtil=require(_0xc05d('0x17'));var db=require(_0xc05d('0x18'))['db'];config[_0xc05d('0x19')]=_[_0xc05d('0x1a')](config['redis'],{'host':_0xc05d('0x1b'),'port':0x18eb});var socket=require(_0xc05d('0x1c'))(new Redis(config['redis']));require(_0xc05d('0x1d'))[_0xc05d('0x1e')](socket);var jayson=require(_0xc05d('0x1f'));var client=jayson['client'][_0xc05d('0x20')]({'port':0x232c});var client9002=jayson[_0xc05d('0x21')][_0xc05d('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x33082a,_0x4f6e3f,_0x21b722,_0x4b8e3e){return new BPromise(function(_0xcb0012,_0x206b08){var _0x33bdc8=_0x4b8e3e||client;return _0x33bdc8[_0xc05d('0x22')](_0x33082a,_0x21b722)['then'](function(_0x36a35f){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x4f6e3f,'request\x20sent');logger[_0xc05d('0x23')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x4f6e3f,_0xc05d('0x24'),JSON[_0xc05d('0x25')](_0x36a35f));if(_0x36a35f['error']){if(_0x36a35f['error'][_0xc05d('0x26')]===0x1f4){logger[_0xc05d('0x27')](_0xc05d('0x28'),_0x4f6e3f,_0x36a35f['error'][_0xc05d('0x29')]);return _0x206b08(_0x36a35f[_0xc05d('0x27')]['message']);}logger[_0xc05d('0x27')](_0xc05d('0x28'),_0x4f6e3f,_0x36a35f[_0xc05d('0x27')][_0xc05d('0x29')]);return _0xcb0012(_0x36a35f['error'][_0xc05d('0x29')]);}else{logger['info'](_0xc05d('0x28'),_0x4f6e3f,_0xc05d('0x24'));_0xcb0012(_0x36a35f[_0xc05d('0x2a')][_0xc05d('0x29')]);}})[_0xc05d('0x2b')](function(_0x21e1cc){logger[_0xc05d('0x27')](_0xc05d('0x28'),_0x4f6e3f,_0x21e1cc);_0x206b08(_0x21e1cc);});});}function respondWithStatusCode(_0x268419,_0x5cdefd){_0x5cdefd=_0x5cdefd||0xcc;return function(_0x5091bd){if(_0x5091bd){return _0x268419['sendStatus'](_0x5cdefd);}return _0x268419[_0xc05d('0x2c')](_0x5cdefd)['end']();};}function respondWithResult(_0x3c5a8b,_0x5c5ca2){_0x5c5ca2=_0x5c5ca2||0xc8;return function(_0x2a8743){if(_0x2a8743){return _0x3c5a8b[_0xc05d('0x2c')](_0x5c5ca2)[_0xc05d('0x2d')](_0x2a8743);}};}function respondWithFilteredResult(_0x376718,_0x151871){return function(_0x146d2a){if(_0x146d2a){var _0xea6de1=_0x146d2a[_0xc05d('0x2e')],_0x3a9357=_0x151871['offset'],_0x54cc96=_0x151871[_0xc05d('0x2f')]+_0x151871[_0xc05d('0x30')],_0x52031c;if(_0x54cc96>=_0xea6de1){_0x54cc96=_0xea6de1;_0x52031c=0xc8;}else{_0x52031c=0xce;}_0x376718[_0xc05d('0x2c')](_0x52031c);return _0x376718[_0xc05d('0x31')](_0xc05d('0x32'),_0x3a9357+'-'+_0x54cc96+'/'+_0xea6de1)['json'](_0x146d2a);}return null;};}function patchUpdates(_0x3996e9){return function(_0x3b3c4e){try{jsonpatch[_0xc05d('0x33')](_0x3b3c4e,_0x3996e9,!![]);}catch(_0x7a4aaf){return BPromise[_0xc05d('0x34')](_0x7a4aaf);}return _0x3b3c4e[_0xc05d('0x35')]();};}function saveUpdates(_0x1bfe59,_0x599877){return function(_0x2c142f){if(_0x2c142f){return _0x2c142f[_0xc05d('0x36')](_0x1bfe59)[_0xc05d('0x37')](function(_0x1243a8){return _0x1243a8;});}return null;};}function removeEntity(_0x50757b,_0x481067){return function(_0x3529cd){if(_0x3529cd){return _0x3529cd[_0xc05d('0x38')]()[_0xc05d('0x37')](function(){_0x50757b[_0xc05d('0x2c')](0xcc)[_0xc05d('0x39')]();});}};}function handleEntityNotFound(_0x382f9c,_0x5974eb){return function(_0x3e541b){if(!_0x3e541b){_0x382f9c[_0xc05d('0x3a')](0x194);}return _0x3e541b;};}function handleError(_0x511db8,_0x43a3b0){_0x43a3b0=_0x43a3b0||0x1f4;return function(_0xa3bb44){logger[_0xc05d('0x27')](_0xa3bb44[_0xc05d('0x3b')]);if(_0xa3bb44[_0xc05d('0x3c')]){delete _0xa3bb44['name'];}_0x511db8['status'](_0x43a3b0)[_0xc05d('0x3d')](_0xa3bb44);};}exports[_0xc05d('0x3e')]=function(_0x23ef6a,_0x57833b){var _0x57987d={},_0xcd9fa9={},_0xa6de91={'count':0x0,'rows':[]};var _0x50e233=_['map'](db[_0xc05d('0x3f')][_0xc05d('0x40')],function(_0x1ea5fa){return{'name':_0x1ea5fa[_0xc05d('0x41')],'type':_0x1ea5fa[_0xc05d('0x42')]['key']};});_0xcd9fa9[_0xc05d('0x43')]=_[_0xc05d('0x44')](_0x50e233,'name');_0xcd9fa9['query']=_[_0xc05d('0x45')](_0x23ef6a[_0xc05d('0x46')]);_0xcd9fa9[_0xc05d('0x47')]=_['intersection'](_0xcd9fa9['model'],_0xcd9fa9[_0xc05d('0x46')]);_0x57987d['attributes']=_[_0xc05d('0x48')](_0xcd9fa9[_0xc05d('0x43')],qs['fields'](_0x23ef6a[_0xc05d('0x46')][_0xc05d('0x49')]));_0x57987d['attributes']=_0x57987d[_0xc05d('0x4a')]['length']?_0x57987d[_0xc05d('0x4a')]:_0xcd9fa9['model'];if(!_0x23ef6a[_0xc05d('0x46')][_0xc05d('0x4b')]('nolimit')){_0x57987d[_0xc05d('0x30')]=qs[_0xc05d('0x30')](_0x23ef6a['query'][_0xc05d('0x30')]);_0x57987d[_0xc05d('0x2f')]=qs[_0xc05d('0x2f')](_0x23ef6a['query'][_0xc05d('0x2f')]);}_0x57987d[_0xc05d('0x4c')]=qs[_0xc05d('0x4d')](_0x23ef6a['query'][_0xc05d('0x4d')]);_0x57987d[_0xc05d('0x4e')]=qs[_0xc05d('0x47')](_[_0xc05d('0x4f')](_0x23ef6a[_0xc05d('0x46')],_0xcd9fa9[_0xc05d('0x47')]),_0x50e233);if(_0x23ef6a[_0xc05d('0x46')][_0xc05d('0x50')]){_0x57987d['where']=_['merge'](_0x57987d[_0xc05d('0x4e')],{'$or':_['map'](_0x50e233,function(_0x374032){if(_0x374032[_0xc05d('0x42')]!=='VIRTUAL'){var _0x57d577={};_0x57d577[_0x374032['name']]={'$like':'%'+_0x23ef6a[_0xc05d('0x46')][_0xc05d('0x50')]+'%'};return _0x57d577;}})});}_0x57987d=_[_0xc05d('0x51')]({},_0x57987d,_0x23ef6a[_0xc05d('0x52')]);var _0x8a870b={'where':_0x57987d[_0xc05d('0x4e')]};return db[_0xc05d('0x3f')]['count'](_0x8a870b)[_0xc05d('0x37')](function(_0x3dcc2f){_0xa6de91[_0xc05d('0x2e')]=_0x3dcc2f;if(_0x23ef6a[_0xc05d('0x46')][_0xc05d('0x53')]){_0x57987d[_0xc05d('0x54')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xc05d('0x55')](_0x57987d);})[_0xc05d('0x37')](function(_0x64a2b0){_0xa6de91['rows']=_0x64a2b0;return _0xa6de91;})[_0xc05d('0x37')](respondWithFilteredResult(_0x57833b,_0x57987d))[_0xc05d('0x2b')](handleError(_0x57833b,null));};exports[_0xc05d('0x56')]=function(_0x2375bd,_0x4ab4bc){var _0x1b7066={'raw':!![],'where':{'id':_0x2375bd[_0xc05d('0x57')]['id']}},_0x4c9309={};_0x4c9309[_0xc05d('0x43')]=_[_0xc05d('0x45')](db['OpenchannelMessage'][_0xc05d('0x40')]);_0x4c9309['query']=_[_0xc05d('0x45')](_0x2375bd[_0xc05d('0x46')]);_0x4c9309['filters']=_[_0xc05d('0x48')](_0x4c9309[_0xc05d('0x43')],_0x4c9309['query']);_0x1b7066['attributes']=_['intersection'](_0x4c9309[_0xc05d('0x43')],qs[_0xc05d('0x49')](_0x2375bd['query'][_0xc05d('0x49')]));_0x1b7066[_0xc05d('0x4a')]=_0x1b7066[_0xc05d('0x4a')][_0xc05d('0x58')]?_0x1b7066['attributes']:_0x4c9309['model'];if(_0x2375bd[_0xc05d('0x46')][_0xc05d('0x53')]){_0x1b7066[_0xc05d('0x54')]=[{'all':!![]}];}_0x1b7066=_['merge']({},_0x1b7066,_0x2375bd[_0xc05d('0x52')]);return db[_0xc05d('0x3f')]['find'](_0x1b7066)[_0xc05d('0x37')](handleEntityNotFound(_0x4ab4bc,null))['then'](respondWithResult(_0x4ab4bc,null))[_0xc05d('0x2b')](handleError(_0x4ab4bc,null));};exports[_0xc05d('0x59')]=function(_0x48579d,_0x6f9f21){return db['OpenchannelMessage'][_0xc05d('0x59')](_0x48579d[_0xc05d('0x5a')],{})[_0xc05d('0x37')](respondWithResult(_0x6f9f21,0xc9))['catch'](handleError(_0x6f9f21,null));};exports['update']=function(_0x524cd3,_0x106fa3){if(_0x524cd3[_0xc05d('0x5a')]['id']){delete _0x524cd3[_0xc05d('0x5a')]['id'];}return db[_0xc05d('0x3f')][_0xc05d('0x5b')]({'where':{'id':_0x524cd3[_0xc05d('0x57')]['id']}})[_0xc05d('0x37')](handleEntityNotFound(_0x106fa3,null))[_0xc05d('0x37')](saveUpdates(_0x524cd3[_0xc05d('0x5a')],null))[_0xc05d('0x37')](respondWithResult(_0x106fa3,null))[_0xc05d('0x2b')](handleError(_0x106fa3,null));};exports[_0xc05d('0x38')]=function(_0x346bdf,_0xe27095){return db[_0xc05d('0x3f')][_0xc05d('0x5b')]({'where':{'id':_0x346bdf[_0xc05d('0x57')]['id']}})[_0xc05d('0x37')](handleEntityNotFound(_0xe27095,null))[_0xc05d('0x37')](removeEntity(_0xe27095,null))[_0xc05d('0x2b')](handleError(_0xe27095,null));};exports['describe']=function(_0x842e00,_0x124598){return db[_0xc05d('0x3f')][_0xc05d('0x5c')]()[_0xc05d('0x37')](respondWithResult(_0x124598,null))['catch'](handleError(_0x124598,null));};var interaction_log=require(_0xc05d('0x13'))(_0xc05d('0x5d'));exports[_0xc05d('0x5e')]=function(_0x5508ed,_0x47daaf,_0x26de24){var _0x30ea6e={'agent':{},'channel':_0xc05d('0x5f')};if(_0x5508ed[_0xc05d('0x5a')]['id']){delete _0x5508ed[_0xc05d('0x5a')]['id'];}_0x5508ed[_0xc05d('0x5a')][_0xc05d('0x60')]=!![];_0x5508ed[_0xc05d('0x5a')]['readAt']=moment()[_0xc05d('0x61')](_0xc05d('0x62'));_0x5508ed[_0xc05d('0x5a')]['UserId']=_0x5508ed[_0xc05d('0x5a')]['UserId']||_0x5508ed[_0xc05d('0x63')]['id'];_0x30ea6e[_0xc05d('0x64')]['id']=_0x5508ed[_0xc05d('0x5a')]['UserId'];return db[_0xc05d('0x3f')][_0xc05d('0x5b')]({'where':{'id':_0x5508ed[_0xc05d('0x57')]['id'],'UserId':null},'include':[{'model':db[_0xc05d('0x65')],'as':_0xc05d('0x66')}]})[_0xc05d('0x37')](handleEntityNotFound(_0x47daaf,null))[_0xc05d('0x37')](saveUpdates(_0x5508ed['body'],null))['then'](function(_0x14a82){if(_0x14a82){_0x30ea6e[_0xc05d('0x29')]=_0x14a82['get']({'plain':!![]});return db[_0xc05d('0x67')][_0xc05d('0x5b')]({'where':{'id':_0x14a82['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x47daaf,null))[_0xc05d('0x37')](function(_0x2075bb){if(_0x2075bb){return _0x2075bb[_0xc05d('0x36')]({'UserId':_0x5508ed[_0xc05d('0x5a')]['UserId'],'read1stAt':_[_0xc05d('0x68')](_0x2075bb[_0xc05d('0x69')])?moment()[_0xc05d('0x61')](_0xc05d('0x62')):undefined});}return null;})['then'](function(_0x1d596f){if(_0x1d596f){_0x30ea6e[_0xc05d('0x6a')]=_0x1d596f[_0xc05d('0x6b')]({'plain':!![]});interaction_log[_0xc05d('0x6c')](_0xc05d('0x6d'),_0x5508ed[_0xc05d('0x63')]['id'],_0x5508ed['user'][_0xc05d('0x3c')],_0x5508ed[_0xc05d('0x63')][_0xc05d('0x6e')],_0x30ea6e[_0xc05d('0x6a')]['id'],_0x5508ed[_0xc05d('0x5a')]?JSON[_0xc05d('0x25')](_0x5508ed['body']):_0xc05d('0x6f'));return respondWithRpcPromise(_0xc05d('0x70'),'acceptMessage',_0x30ea6e);}return null;})[_0xc05d('0x37')](function(_0x152941){if(_0x152941){if(_0x5508ed[_0xc05d('0x5a')][_0xc05d('0x71')]){_0x30ea6e[_0xc05d('0x29')][_0xc05d('0x72')]=util[_0xc05d('0x61')](_0xc05d('0x73'),_0x5508ed[_0xc05d('0x63')]['name']);_0x30ea6e[_0xc05d('0x29')]['channel']=_0x30ea6e['channel'];_0x30ea6e[_0xc05d('0x29')][_0xc05d('0x74')]='accept';return respondWithRpcPromise(_0xc05d('0x75'),'EventManager',{'event':_0xc05d('0x76'),'message':_0x30ea6e['message']},client9002)[_0xc05d('0x37')](function(){return _0x30ea6e;});}return _0x30ea6e;}return null;})['then'](respondWithResult(_0x47daaf,null))[_0xc05d('0x2b')](handleError(_0x47daaf,null));};var interaction_log=require(_0xc05d('0x13'))('openchannel-interactions');exports[_0xc05d('0x34')]=function(_0x3c24e1,_0x50227f,_0x5ae240){var _0x5ed956={'agent':{},'channel':'openchannel'};if(_0x3c24e1[_0xc05d('0x5a')]['id']){delete _0x3c24e1[_0xc05d('0x5a')]['id'];}_0x3c24e1[_0xc05d('0x5a')][_0xc05d('0x77')]=_0x3c24e1['body'][_0xc05d('0x77')]||_0x3c24e1[_0xc05d('0x63')]['id'];_0x5ed956[_0xc05d('0x64')]['id']=_0x3c24e1[_0xc05d('0x5a')]['UserId'];return db[_0xc05d('0x3f')][_0xc05d('0x5b')]({'where':{'id':_0x3c24e1[_0xc05d('0x57')]['id'],'UserId':null}})[_0xc05d('0x37')](handleEntityNotFound(_0x50227f,null))['then'](function(_0x24eb63){if(_0x24eb63){_0x5ed956['message']=_0x24eb63['get']({'plain':!![]});return db[_0xc05d('0x67')][_0xc05d('0x5b')]({'where':{'id':_0x24eb63[_0xc05d('0x78')]}});}return null;})[_0xc05d('0x37')](handleEntityNotFound(_0x50227f,null))[_0xc05d('0x37')](function(_0x2f2e6b){if(_0x2f2e6b){_0x5ed956[_0xc05d('0x6a')]=_0x2f2e6b[_0xc05d('0x6b')]({'plain':!![]});interaction_log['info'](_0xc05d('0x79'),_0x3c24e1[_0xc05d('0x63')]['id'],_0x3c24e1[_0xc05d('0x63')]['name'],_0x3c24e1[_0xc05d('0x63')][_0xc05d('0x6e')],_0x5ed956[_0xc05d('0x6a')]['id'],_0x3c24e1[_0xc05d('0x5a')]?JSON[_0xc05d('0x25')](_0x3c24e1['body']):_0xc05d('0x6f'));return respondWithRpcPromise(_0xc05d('0x7a'),'rejectMessage',_0x5ed956);}return null;})[_0xc05d('0x37')](function(_0x5a275d){if(_0x5a275d){_0x5a275d[_0xc05d('0x29')][_0xc05d('0x72')]=util[_0xc05d('0x61')](_0xc05d('0x73'),_0x3c24e1[_0xc05d('0x63')][_0xc05d('0x3c')]);_0x5a275d[_0xc05d('0x29')][_0xc05d('0x7b')]=_0x5ed956[_0xc05d('0x7b')];_0x5a275d['message'][_0xc05d('0x74')]=_0xc05d('0x34');respondWithRpcPromise('EventManager',_0xc05d('0x75'),{'event':_0xc05d('0x7c'),'message':_0x5a275d[_0xc05d('0x29')]},client9002);return _0x5ed956;}return null;})['then'](respondWithResult(_0x50227f,null))[_0xc05d('0x2b')](handleError(_0x50227f,null));}; \ No newline at end of file +var _0x896e=['show','params','keys','length','options','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','Contact','get','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','manual','SIP/%s','channel','event','EventManager','acceptmessage','reject','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','http','client','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','error','message','result','catch','status','end','json','count','offset','limit','Content-Range','save','update','destroy','sendStatus','stack','send','map','rawAttributes','fieldName','key','model','name','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','OpenchannelMessage','includeAll','include','findAll','rows'];(function(_0x13cbc5,_0x570a6a){var _0x1e421c=function(_0x20207c){while(--_0x20207c){_0x13cbc5['push'](_0x13cbc5['shift']());}};_0x1e421c(++_0x570a6a);}(_0x896e,0x182));var _0xe896=function(_0x29fe7a,_0x51d5ee){_0x29fe7a=_0x29fe7a-0x0;var _0xb1bec0=_0x896e[_0x29fe7a];return _0xb1bec0;};'use strict';var pdf=require(_0xe896('0x0'));var emlformat=require(_0xe896('0x1'));var rimraf=require(_0xe896('0x2'));var zipdir=require(_0xe896('0x3'));var jsonpatch=require(_0xe896('0x4'));var rp=require(_0xe896('0x5'));var moment=require(_0xe896('0x6'));var BPromise=require(_0xe896('0x7'));var Mustache=require(_0xe896('0x8'));var util=require('util');var path=require(_0xe896('0x9'));var sox=require(_0xe896('0xa'));var csv=require(_0xe896('0xb'));var ejs=require(_0xe896('0xc'));var fs=require('fs');var _=require(_0xe896('0xd'));var squel=require(_0xe896('0xe'));var crypto=require(_0xe896('0xf'));var jsforce=require(_0xe896('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe896('0xb'));var querystring=require('querystring');var Papa=require(_0xe896('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe896('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe896('0x13'));var logger=require(_0xe896('0x14'))(_0xe896('0x15'));var utils=require('../../config/utils');var config=require(_0xe896('0x16'));var licenseUtil=require(_0xe896('0x17'));var db=require(_0xe896('0x18'))['db'];config[_0xe896('0x19')]=_[_0xe896('0x1a')](config[_0xe896('0x19')],{'host':_0xe896('0x1b'),'port':0x18eb});var socket=require(_0xe896('0x1c'))(new Redis(config[_0xe896('0x19')]));require(_0xe896('0x1d'))[_0xe896('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xe896('0x1f')]({'port':0x232c});var client9002=jayson[_0xe896('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bedfb,_0x5f3851,_0x1c561b,_0xce226b){return new BPromise(function(_0x170c91,_0x35e428){var _0x4baf73=_0xce226b||client;return _0x4baf73['request'](_0x4bedfb,_0x1c561b)[_0xe896('0x21')](function(_0x4e17e6){logger[_0xe896('0x22')](_0xe896('0x23'),_0x5f3851,_0xe896('0x24'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x5f3851,_0xe896('0x24'),JSON['stringify'](_0x4e17e6));if(_0x4e17e6['error']){if(_0x4e17e6['error']['code']===0x1f4){logger[_0xe896('0x25')](_0xe896('0x23'),_0x5f3851,_0x4e17e6[_0xe896('0x25')][_0xe896('0x26')]);return _0x35e428(_0x4e17e6[_0xe896('0x25')][_0xe896('0x26')]);}logger['error'](_0xe896('0x23'),_0x5f3851,_0x4e17e6['error'][_0xe896('0x26')]);return _0x170c91(_0x4e17e6['error'][_0xe896('0x26')]);}else{logger[_0xe896('0x22')](_0xe896('0x23'),_0x5f3851,_0xe896('0x24'));_0x170c91(_0x4e17e6[_0xe896('0x27')][_0xe896('0x26')]);}})[_0xe896('0x28')](function(_0x49bffe){logger[_0xe896('0x25')](_0xe896('0x23'),_0x5f3851,_0x49bffe);_0x35e428(_0x49bffe);});});}function respondWithStatusCode(_0x342503,_0x4c5408){_0x4c5408=_0x4c5408||0xcc;return function(_0x2eb4b1){if(_0x2eb4b1){return _0x342503['sendStatus'](_0x4c5408);}return _0x342503[_0xe896('0x29')](_0x4c5408)[_0xe896('0x2a')]();};}function respondWithResult(_0x29a2e8,_0x306dbf){_0x306dbf=_0x306dbf||0xc8;return function(_0x32b9f7){if(_0x32b9f7){return _0x29a2e8['status'](_0x306dbf)[_0xe896('0x2b')](_0x32b9f7);}};}function respondWithFilteredResult(_0x126e84,_0x567bd5){return function(_0x4db81d){if(_0x4db81d){var _0x3d8a28=_0x4db81d[_0xe896('0x2c')],_0x3ffa73=_0x567bd5[_0xe896('0x2d')],_0x2ae309=_0x567bd5[_0xe896('0x2d')]+_0x567bd5[_0xe896('0x2e')],_0x258a75;if(_0x2ae309>=_0x3d8a28){_0x2ae309=_0x3d8a28;_0x258a75=0xc8;}else{_0x258a75=0xce;}_0x126e84['status'](_0x258a75);return _0x126e84['set'](_0xe896('0x2f'),_0x3ffa73+'-'+_0x2ae309+'/'+_0x3d8a28)[_0xe896('0x2b')](_0x4db81d);}return null;};}function patchUpdates(_0x2e852d){return function(_0x54ba11){try{jsonpatch['apply'](_0x54ba11,_0x2e852d,!![]);}catch(_0x998c33){return BPromise['reject'](_0x998c33);}return _0x54ba11[_0xe896('0x30')]();};}function saveUpdates(_0xe98f17,_0x3ac539){return function(_0x1a4fa8){if(_0x1a4fa8){return _0x1a4fa8[_0xe896('0x31')](_0xe98f17)[_0xe896('0x21')](function(_0x471bd6){return _0x471bd6;});}return null;};}function removeEntity(_0xc43d61,_0x443d68){return function(_0x492ecc){if(_0x492ecc){return _0x492ecc[_0xe896('0x32')]()[_0xe896('0x21')](function(){_0xc43d61[_0xe896('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a31af,_0x2de8e0){return function(_0x57c313){if(!_0x57c313){_0x5a31af[_0xe896('0x33')](0x194);}return _0x57c313;};}function handleError(_0x483fba,_0x5abf4f){_0x5abf4f=_0x5abf4f||0x1f4;return function(_0x4b02f3){logger[_0xe896('0x25')](_0x4b02f3[_0xe896('0x34')]);if(_0x4b02f3['name']){delete _0x4b02f3['name'];}_0x483fba[_0xe896('0x29')](_0x5abf4f)[_0xe896('0x35')](_0x4b02f3);};}exports['index']=function(_0x44b409,_0x5796cf){var _0x599343={},_0x108c9b={},_0x45ec03={'count':0x0,'rows':[]};var _0x54676e=_[_0xe896('0x36')](db['OpenchannelMessage'][_0xe896('0x37')],function(_0xdef72b){return{'name':_0xdef72b[_0xe896('0x38')],'type':_0xdef72b['type'][_0xe896('0x39')]};});_0x108c9b[_0xe896('0x3a')]=_[_0xe896('0x36')](_0x54676e,_0xe896('0x3b'));_0x108c9b[_0xe896('0x3c')]=_['keys'](_0x44b409[_0xe896('0x3c')]);_0x108c9b['filters']=_[_0xe896('0x3d')](_0x108c9b['model'],_0x108c9b[_0xe896('0x3c')]);_0x599343['attributes']=_[_0xe896('0x3d')](_0x108c9b[_0xe896('0x3a')],qs[_0xe896('0x3e')](_0x44b409[_0xe896('0x3c')]['fields']));_0x599343[_0xe896('0x3f')]=_0x599343[_0xe896('0x3f')]['length']?_0x599343['attributes']:_0x108c9b['model'];if(!_0x44b409[_0xe896('0x3c')][_0xe896('0x40')](_0xe896('0x41'))){_0x599343[_0xe896('0x2e')]=qs[_0xe896('0x2e')](_0x44b409[_0xe896('0x3c')][_0xe896('0x2e')]);_0x599343[_0xe896('0x2d')]=qs[_0xe896('0x2d')](_0x44b409[_0xe896('0x3c')][_0xe896('0x2d')]);}_0x599343['order']=qs[_0xe896('0x42')](_0x44b409['query'][_0xe896('0x42')]);_0x599343[_0xe896('0x43')]=qs[_0xe896('0x44')](_[_0xe896('0x45')](_0x44b409[_0xe896('0x3c')],_0x108c9b[_0xe896('0x44')]),_0x54676e);if(_0x44b409[_0xe896('0x3c')][_0xe896('0x46')]){_0x599343[_0xe896('0x43')]=_[_0xe896('0x47')](_0x599343['where'],{'$or':_[_0xe896('0x36')](_0x54676e,function(_0x20d6d4){if(_0x20d6d4['type']!==_0xe896('0x48')){var _0x1c7c7e={};_0x1c7c7e[_0x20d6d4[_0xe896('0x3b')]]={'$like':'%'+_0x44b409[_0xe896('0x3c')][_0xe896('0x46')]+'%'};return _0x1c7c7e;}})});}_0x599343=_[_0xe896('0x47')]({},_0x599343,_0x44b409['options']);var _0x5ef4c5={'where':_0x599343[_0xe896('0x43')]};return db[_0xe896('0x49')][_0xe896('0x2c')](_0x5ef4c5)[_0xe896('0x21')](function(_0x47cba1){_0x45ec03[_0xe896('0x2c')]=_0x47cba1;if(_0x44b409[_0xe896('0x3c')][_0xe896('0x4a')]){_0x599343[_0xe896('0x4b')]=[{'all':!![]}];}return db[_0xe896('0x49')][_0xe896('0x4c')](_0x599343);})['then'](function(_0x23e029){_0x45ec03[_0xe896('0x4d')]=_0x23e029;return _0x45ec03;})[_0xe896('0x21')](respondWithFilteredResult(_0x5796cf,_0x599343))['catch'](handleError(_0x5796cf,null));};exports[_0xe896('0x4e')]=function(_0x3924ad,_0x555aaf){var _0x36b3d6={'raw':!![],'where':{'id':_0x3924ad[_0xe896('0x4f')]['id']}},_0x20da9a={};_0x20da9a[_0xe896('0x3a')]=_[_0xe896('0x50')](db[_0xe896('0x49')][_0xe896('0x37')]);_0x20da9a[_0xe896('0x3c')]=_['keys'](_0x3924ad[_0xe896('0x3c')]);_0x20da9a[_0xe896('0x44')]=_['intersection'](_0x20da9a[_0xe896('0x3a')],_0x20da9a[_0xe896('0x3c')]);_0x36b3d6[_0xe896('0x3f')]=_[_0xe896('0x3d')](_0x20da9a['model'],qs[_0xe896('0x3e')](_0x3924ad[_0xe896('0x3c')][_0xe896('0x3e')]));_0x36b3d6[_0xe896('0x3f')]=_0x36b3d6['attributes'][_0xe896('0x51')]?_0x36b3d6['attributes']:_0x20da9a[_0xe896('0x3a')];if(_0x3924ad['query']['includeAll']){_0x36b3d6['include']=[{'all':!![]}];}_0x36b3d6=_['merge']({},_0x36b3d6,_0x3924ad[_0xe896('0x52')]);return db[_0xe896('0x49')][_0xe896('0x53')](_0x36b3d6)['then'](handleEntityNotFound(_0x555aaf,null))[_0xe896('0x21')](respondWithResult(_0x555aaf,null))['catch'](handleError(_0x555aaf,null));};exports['create']=function(_0x1abc96,_0x26bd2b){return db[_0xe896('0x49')][_0xe896('0x54')](_0x1abc96[_0xe896('0x55')],{})[_0xe896('0x21')](respondWithResult(_0x26bd2b,0xc9))[_0xe896('0x28')](handleError(_0x26bd2b,null));};exports[_0xe896('0x31')]=function(_0x1ba8f8,_0x4214f0){if(_0x1ba8f8[_0xe896('0x55')]['id']){delete _0x1ba8f8[_0xe896('0x55')]['id'];}return db[_0xe896('0x49')][_0xe896('0x53')]({'where':{'id':_0x1ba8f8[_0xe896('0x4f')]['id']}})[_0xe896('0x21')](handleEntityNotFound(_0x4214f0,null))[_0xe896('0x21')](saveUpdates(_0x1ba8f8[_0xe896('0x55')],null))['then'](respondWithResult(_0x4214f0,null))['catch'](handleError(_0x4214f0,null));};exports['destroy']=function(_0xc09e02,_0x1e645b){return db[_0xe896('0x49')]['find']({'where':{'id':_0xc09e02['params']['id']}})[_0xe896('0x21')](handleEntityNotFound(_0x1e645b,null))['then'](removeEntity(_0x1e645b,null))['catch'](handleError(_0x1e645b,null));};exports[_0xe896('0x56')]=function(_0x288b7a,_0x2ab361){return db[_0xe896('0x49')][_0xe896('0x56')]()[_0xe896('0x21')](respondWithResult(_0x2ab361,null))[_0xe896('0x28')](handleError(_0x2ab361,null));};var interaction_log=require(_0xe896('0x14'))(_0xe896('0x57'));exports[_0xe896('0x58')]=function(_0x23daba,_0x443e07,_0x18e928){var _0x5d48e2={'agent':{},'channel':_0xe896('0x59')};if(_0x23daba[_0xe896('0x55')]['id']){delete _0x23daba[_0xe896('0x55')]['id'];}_0x23daba[_0xe896('0x55')][_0xe896('0x5a')]=!![];_0x23daba[_0xe896('0x55')][_0xe896('0x5b')]=moment()[_0xe896('0x5c')](_0xe896('0x5d'));_0x23daba[_0xe896('0x55')][_0xe896('0x5e')]=_0x23daba[_0xe896('0x55')][_0xe896('0x5e')]||_0x23daba[_0xe896('0x5f')]['id'];_0x5d48e2[_0xe896('0x60')]['id']=_0x23daba[_0xe896('0x55')][_0xe896('0x5e')];return db[_0xe896('0x49')][_0xe896('0x53')]({'where':{'id':_0x23daba[_0xe896('0x4f')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xe896('0x61')}]})[_0xe896('0x21')](handleEntityNotFound(_0x443e07,null))[_0xe896('0x21')](saveUpdates(_0x23daba[_0xe896('0x55')],null))['then'](function(_0xf37b9e){if(_0xf37b9e){_0x5d48e2['message']=_0xf37b9e[_0xe896('0x62')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0xf37b9e['OpenchannelInteractionId']}});}return null;})[_0xe896('0x21')](handleEntityNotFound(_0x443e07,null))[_0xe896('0x21')](function(_0x444940){if(_0x444940){return _0x444940[_0xe896('0x31')]({'UserId':_0x23daba[_0xe896('0x55')]['UserId'],'read1stAt':_['isNil'](_0x444940[_0xe896('0x63')])?moment()['format'](_0xe896('0x5d')):undefined});}return null;})[_0xe896('0x21')](function(_0x400b30){if(_0x400b30){_0x5d48e2[_0xe896('0x64')]=_0x400b30[_0xe896('0x62')]({'plain':!![]});interaction_log[_0xe896('0x22')](_0xe896('0x65'),_0x23daba['user']['id'],_0x23daba['user'][_0xe896('0x3b')],_0x23daba['user'][_0xe896('0x66')],_0x5d48e2[_0xe896('0x64')]['id'],_0x23daba[_0xe896('0x55')]?JSON[_0xe896('0x67')](_0x23daba['body']):_0xe896('0x68'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x5d48e2);}return null;})['then'](function(_0x92d314){if(_0x92d314){if(_0x23daba['body'][_0xe896('0x69')]){_0x5d48e2[_0xe896('0x26')]['interface']=util[_0xe896('0x5c')](_0xe896('0x6a'),_0x23daba[_0xe896('0x5f')]['name']);_0x5d48e2[_0xe896('0x26')][_0xe896('0x6b')]=_0x5d48e2[_0xe896('0x6b')];_0x5d48e2[_0xe896('0x26')][_0xe896('0x6c')]=_0xe896('0x58');return respondWithRpcPromise(_0xe896('0x6d'),_0xe896('0x6d'),{'event':_0xe896('0x6e'),'message':_0x5d48e2[_0xe896('0x26')]},client9002)[_0xe896('0x21')](function(){return _0x5d48e2;});}return _0x5d48e2;}return null;})[_0xe896('0x21')](respondWithResult(_0x443e07,null))[_0xe896('0x28')](handleError(_0x443e07,null));};var interaction_log=require(_0xe896('0x14'))(_0xe896('0x57'));exports[_0xe896('0x6f')]=function(_0xac668f,_0x4cc683,_0x13e7cd){var _0x45f302={'agent':{},'channel':_0xe896('0x59')};if(_0xac668f['body']['id']){delete _0xac668f['body']['id'];}_0xac668f[_0xe896('0x55')][_0xe896('0x5e')]=_0xac668f['body'][_0xe896('0x5e')]||_0xac668f[_0xe896('0x5f')]['id'];_0x45f302[_0xe896('0x60')]['id']=_0xac668f[_0xe896('0x55')][_0xe896('0x5e')];return db[_0xe896('0x49')][_0xe896('0x53')]({'where':{'id':_0xac668f[_0xe896('0x4f')]['id'],'UserId':null}})[_0xe896('0x21')](handleEntityNotFound(_0x4cc683,null))[_0xe896('0x21')](function(_0x33bd5a){if(_0x33bd5a){_0x45f302[_0xe896('0x26')]=_0x33bd5a['get']({'plain':!![]});return db[_0xe896('0x70')][_0xe896('0x53')]({'where':{'id':_0x33bd5a['OpenchannelInteractionId']}});}return null;})[_0xe896('0x21')](handleEntityNotFound(_0x4cc683,null))[_0xe896('0x21')](function(_0x52e6f0){if(_0x52e6f0){_0x45f302['interaction']=_0x52e6f0['get']({'plain':!![]});interaction_log[_0xe896('0x22')](_0xe896('0x71'),_0xac668f[_0xe896('0x5f')]['id'],_0xac668f[_0xe896('0x5f')][_0xe896('0x3b')],_0xac668f[_0xe896('0x5f')][_0xe896('0x66')],_0x45f302[_0xe896('0x64')]['id'],_0xac668f[_0xe896('0x55')]?JSON['stringify'](_0xac668f[_0xe896('0x55')]):'null');return respondWithRpcPromise(_0xe896('0x72'),'rejectMessage',_0x45f302);}return null;})[_0xe896('0x21')](function(_0x2622a9){if(_0x2622a9){_0x2622a9['message']['interface']=util[_0xe896('0x5c')](_0xe896('0x6a'),_0xac668f[_0xe896('0x5f')]['name']);_0x2622a9[_0xe896('0x26')][_0xe896('0x6b')]=_0x45f302['channel'];_0x2622a9[_0xe896('0x26')][_0xe896('0x6c')]=_0xe896('0x6f');respondWithRpcPromise(_0xe896('0x6d'),'EventManager',{'event':_0xe896('0x73'),'message':_0x2622a9[_0xe896('0x26')]},client9002);return _0x45f302;}return null;})[_0xe896('0x21')](respondWithResult(_0x4cc683,null))['catch'](handleError(_0x4cc683,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 43cbe69..20beaf1 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 _0xf933=['setMaxListeners','update','remove','emit','hook','events','../../mysqldb','OpenchannelMessage'];(function(_0x2de5d9,_0x3c8beb){var _0x18b1b0=function(_0x4d4811){while(--_0x4d4811){_0x2de5d9['push'](_0x2de5d9['shift']());}};_0x18b1b0(++_0x3c8beb);}(_0xf933,0x175));var _0x3f93=function(_0x5400a1,_0x2275aa){_0x5400a1=_0x5400a1-0x0;var _0x4006c7=_0xf933[_0x5400a1];return _0x4006c7;};'use strict';var EventEmitter=require(_0x3f93('0x0'));var OpenchannelMessage=require(_0x3f93('0x1'))['db'][_0x3f93('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x3f93('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3f93('0x4'),'afterDestroy':_0x3f93('0x5')};function emitEvent(_0x1c3302){return function(_0x165384,_0x3e2bf2,_0x1f2434){OpenchannelMessageEvents['emit'](_0x1c3302+':'+_0x165384['id'],_0x165384);OpenchannelMessageEvents[_0x3f93('0x6')](_0x1c3302,_0x165384);_0x1f2434(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x3f93('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xd65a=['save','update','emit','hasOwnProperty','hook','exports','events','OpenchannelMessage','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd65a,0x180));var _0xad65=function(_0x4160b2,_0x1f4039){_0x4160b2=_0x4160b2-0x0;var _0x4f877a=_0xd65a[_0x4160b2];return _0x4f877a;};'use strict';var EventEmitter=require(_0xad65('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xad65('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xad65('0x2')](0x0);var events={'afterCreate':_0xad65('0x3'),'afterUpdate':_0xad65('0x4'),'afterDestroy':'remove'};function emitEvent(_0x460f7e){return function(_0xe07f72,_0x1b2cc0,_0x18322b){OpenchannelMessageEvents['emit'](_0x460f7e+':'+_0xe07f72['id'],_0xe07f72);OpenchannelMessageEvents[_0xad65('0x5')](_0x460f7e,_0xe07f72);_0x18322b(null);};}for(var e in events){if(events[_0xad65('0x6')](e)){var event=events[e];OpenchannelMessage[_0xad65('0x7')](e,emitEvent(event));}}module[_0xad65('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 5454ab7..c527946 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 _0x6462=['method','GET','POST','format','threadId','Interaction','inspect','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','OpenchannelInteraction','findOne','then','update','createdAt','catch','error','CmContact','OpenchannelAccount','find','Interactions','OpenchannelInteractionId','Contact','keys','get','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','length','omit'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x6462,0x160));var _0x2646=function(_0x351782,_0x183c66){_0x351782=_0x351782-0x0;var _0x520c8b=_0x6462[_0x351782];return _0x520c8b;};'use strict';var _=require(_0x2646('0x0'));var util=require(_0x2646('0x1'));var logger=require(_0x2646('0x2'))(_0x2646('0x3'));var moment=require('moment');var BPromise=require(_0x2646('0x4'));var rp=require(_0x2646('0x5'));var fs=require('fs');var path=require(_0x2646('0x6'));var rimraf=require('rimraf');var config=require(_0x2646('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0x2646('0x8')]=function(_0x4ea91c,_0x466e44){return _0x4ea91c[_0x2646('0x9')](_0x2646('0xa'),attributes,{'tableName':_0x2646('0xb'),'paranoid':![],'indexes':[{'name':_0x2646('0xc'),'fields':[_0x2646('0xd')],'type':_0x2646('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x23f83b,_0x44fe38,_0x5a4e3d){var _0x3c38da=_0x4ea91c[_0x2646('0xf')];var _0x3c95cb=_0x23f83b['get']({'plain':!![]});if(_0x3c95cb[_0x2646('0x10')][_0x2646('0x11')]()==='in'||_0x3c95cb[_0x2646('0x10')][_0x2646('0x11')]()===_0x2646('0x12')&&!_0x3c95cb[_0x2646('0x13')]&&!_['isNil'](_0x3c95cb['UserId'])){_0x3c38da[_0x2646('0x14')][_0x2646('0x15')]({'where':{'id':_0x3c95cb['OpenchannelInteractionId']}})[_0x2646('0x16')](function(_0x5b00a6){if(_0x5b00a6){_0x5b00a6[_0x2646('0x17')]({'lastMsgAt':_0x3c95cb[_0x2646('0x18')],'lastMsgDirection':_0x3c95cb[_0x2646('0x10')][_0x2646('0x11')]()});}})[_0x2646('0x19')](function(_0x2c55f5){console[_0x2646('0x1a')](_0x2c55f5);});}if(_0x3c95cb[_0x2646('0x10')]===_0x2646('0x12')&&!_0x3c95cb['secret']){var _0x58a29c;_0x3c38da[_0x2646('0x1b')]['describe']()['then'](function(_0x43e007){return _0x3c38da[_0x2646('0x1c')][_0x2646('0x1d')]({'where':{'id':_0x3c95cb['OpenchannelAccountId']},'include':[{'model':_0x3c38da[_0x2646('0x14')],'as':_0x2646('0x1e'),'where':{'id':_0x3c95cb[_0x2646('0x1f')]},'limit':0x1,'include':[{'model':_0x3c38da['CmContact'],'as':_0x2646('0x20'),'attributes':_[_0x2646('0x21')](_0x43e007)}]}]});})[_0x2646('0x16')](function(_0x25d946){_0x58a29c=_0x25d946[_0x2646('0x22')]({'plain':!![]});if(_0x58a29c&&_0x58a29c['replyUri']){logger[_0x2646('0x23')](_0x2646('0x24'),_0x2646('0x25'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0x3c95cb['id'],_0x58a29c['replyUri']));if(_0x58a29c[_0x2646('0x1e')]&&_0x58a29c['Interactions'][_0x2646('0x26')]){_0x3c95cb['Interaction']=_[_0x2646('0x27')](_0x58a29c[_0x2646('0x1e')][0x0],_0x2646('0x20'));_0x3c95cb['Contact']=_0x58a29c['Interactions'][0x0][_0x2646('0x20')];}var _0x44fe38={'method':'POST','uri':encodeURI(_0x58a29c['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x44fe38[_0x2646('0x28')]){case _0x2646('0x29'):_0x44fe38['qs']=_0x3c95cb;break;case _0x2646('0x2a'):_0x44fe38[_0x2646('0xd')]=_0x3c95cb;break;}return rp(_0x44fe38)['then'](function(_0x2b2955){logger[_0x2646('0x23')](_0x2646('0x24'),'afterCreate',util[_0x2646('0x2b')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x3c95cb['id'],_0x58a29c['replyUri']));if(_0x2b2955[_0x2646('0xd')][_0x2646('0x2c')]&&_0x2b2955[_0x2646('0xd')][_0x2646('0x2c')]!=_0x3c95cb[_0x2646('0x2d')][_0x2646('0x2c')]){return _0x3c38da[_0x2646('0x14')]['update']({'threadId':_0x2b2955[_0x2646('0xd')]['threadId']},{'logging':!![],'where':{'id':_0x3c95cb['Interaction']['id']}});}else{return;}})[_0x2646('0x16')](function(){return _0x23f83b[_0x2646('0x17')]({'read':!![]});})['catch'](function(_0x5378c6){logger[_0x2646('0x1a')]('OpenchannelMessage,\x20%s,\x20%s',_0x2646('0x25'),util[_0x2646('0x2e')](_0x5378c6,{'showHidden':![],'depth':null}));_0x5a4e3d();});}else{_0x5a4e3d();}})[_0x2646('0x2f')](function(){_0x5a4e3d();});}else{_0x5a4e3d();}}},'charset':'utf8mb4','collate':_0x2646('0x30')});}; \ No newline at end of file +var _0xfc44=['OpenchannelInteractionId','then','update','direction','catch','CmContact','describe','OpenchannelAccountId','Interactions','keys','get','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','omit','Contact','POST','GET','threadId','Interaction','error','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xfc44,0xb9));var _0x4fc4=function(_0x2d6cbd,_0x401929){_0x2d6cbd=_0x2d6cbd-0x0;var _0x38f957=_0xfc44[_0x2d6cbd];return _0x38f957;};'use strict';var _=require(_0x4fc4('0x0'));var util=require('util');var logger=require(_0x4fc4('0x1'))(_0x4fc4('0x2'));var moment=require(_0x4fc4('0x3'));var BPromise=require(_0x4fc4('0x4'));var rp=require(_0x4fc4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4fc4('0x6'));var config=require(_0x4fc4('0x7'));var attributes=require(_0x4fc4('0x8'));module[_0x4fc4('0x9')]=function(_0x3d8f8d,_0x5738aa){return _0x3d8f8d['define'](_0x4fc4('0xa'),attributes,{'tableName':_0x4fc4('0xb'),'paranoid':![],'indexes':[{'name':_0x4fc4('0xc'),'fields':[_0x4fc4('0xd')],'type':_0x4fc4('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x433f0e,_0x1b9a64,_0x256dbd){var _0x1a4442=_0x3d8f8d[_0x4fc4('0xf')];var _0x39c383=_0x433f0e['get']({'plain':!![]});if(_0x39c383['direction']['toLowerCase']()==='in'||_0x39c383['direction'][_0x4fc4('0x10')]()===_0x4fc4('0x11')&&!_0x39c383[_0x4fc4('0x12')]&&!_[_0x4fc4('0x13')](_0x39c383[_0x4fc4('0x14')])){_0x1a4442[_0x4fc4('0x15')][_0x4fc4('0x16')]({'where':{'id':_0x39c383[_0x4fc4('0x17')]}})[_0x4fc4('0x18')](function(_0x222c81){if(_0x222c81){_0x222c81[_0x4fc4('0x19')]({'lastMsgAt':_0x39c383['createdAt'],'lastMsgDirection':_0x39c383[_0x4fc4('0x1a')][_0x4fc4('0x10')]()});}})[_0x4fc4('0x1b')](function(_0x1730d7){console['error'](_0x1730d7);});}if(_0x39c383[_0x4fc4('0x1a')]==='out'&&!_0x39c383[_0x4fc4('0x12')]){var _0x22f27c;_0x1a4442[_0x4fc4('0x1c')][_0x4fc4('0x1d')]()['then'](function(_0x44d48a){return _0x1a4442['OpenchannelAccount']['find']({'where':{'id':_0x39c383[_0x4fc4('0x1e')]},'include':[{'model':_0x1a4442['OpenchannelInteraction'],'as':_0x4fc4('0x1f'),'where':{'id':_0x39c383[_0x4fc4('0x17')]},'limit':0x1,'include':[{'model':_0x1a4442['CmContact'],'as':'Contact','attributes':_[_0x4fc4('0x20')](_0x44d48a)}]}]});})[_0x4fc4('0x18')](function(_0x2f2447){_0x22f27c=_0x2f2447[_0x4fc4('0x21')]({'plain':!![]});if(_0x22f27c&&_0x22f27c['replyUri']){logger[_0x4fc4('0x22')](_0x4fc4('0x23'),_0x4fc4('0x24'),util[_0x4fc4('0x25')](_0x4fc4('0x26'),_0x39c383['id'],_0x22f27c[_0x4fc4('0x27')]));if(_0x22f27c[_0x4fc4('0x1f')]&&_0x22f27c[_0x4fc4('0x1f')][_0x4fc4('0x28')]){_0x39c383['Interaction']=_[_0x4fc4('0x29')](_0x22f27c[_0x4fc4('0x1f')][0x0],_0x4fc4('0x2a'));_0x39c383[_0x4fc4('0x2a')]=_0x22f27c[_0x4fc4('0x1f')][0x0]['Contact'];}var _0x1b9a64={'method':_0x4fc4('0x2b'),'uri':encodeURI(_0x22f27c['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1b9a64['method']){case _0x4fc4('0x2c'):_0x1b9a64['qs']=_0x39c383;break;case _0x4fc4('0x2b'):_0x1b9a64[_0x4fc4('0xd')]=_0x39c383;break;}return rp(_0x1b9a64)['then'](function(_0x28d1b2){logger['info'](_0x4fc4('0x23'),_0x4fc4('0x24'),util[_0x4fc4('0x25')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x39c383['id'],_0x22f27c[_0x4fc4('0x27')]));if(_0x28d1b2['body'][_0x4fc4('0x2d')]&&_0x28d1b2[_0x4fc4('0xd')][_0x4fc4('0x2d')]!=_0x39c383[_0x4fc4('0x2e')]['threadId']){return _0x1a4442['OpenchannelInteraction']['update']({'threadId':_0x28d1b2[_0x4fc4('0xd')][_0x4fc4('0x2d')]},{'logging':!![],'where':{'id':_0x39c383[_0x4fc4('0x2e')]['id']}});}else{return;}})['then'](function(){return _0x433f0e[_0x4fc4('0x19')]({'read':!![]});})[_0x4fc4('0x1b')](function(_0x1cfb1c){logger[_0x4fc4('0x2f')](_0x4fc4('0x23'),_0x4fc4('0x24'),util[_0x4fc4('0x30')](_0x1cfb1c,{'showHidden':![],'depth':null}));_0x256dbd();});}else{_0x256dbd();}})[_0x4fc4('0x31')](function(){_0x256dbd();});}else{_0x256dbd();}}},'charset':_0x4fc4('0x32'),'collate':_0x4fc4('0x33')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 24bd589..7b6934c 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 _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x372b1d,_0x4ef413){var _0x357963=function(_0x3ed5d6){while(--_0x3ed5d6){_0x372b1d['push'](_0x372b1d['shift']());}};_0x357963(++_0x4ef413);}(_0x5f2f,0x73));var _0xf5f2=function(_0x211b7a,_0x864ee2){_0x211b7a=_0x211b7a-0x0;var _0x22d5f5=_0x5f2f[_0x211b7a];return _0x22d5f5;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0xd8b0=['util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','./openchannelMessage.socket','register','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','create','options','lodash'];(function(_0x44abf3,_0x5eb3ac){var _0x125c91=function(_0x51a459){while(--_0x51a459){_0x44abf3['push'](_0x44abf3['shift']());}};_0x125c91(++_0x5eb3ac);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});config[_0x0d8b('0x9')]=_['defaults'](config[_0x0d8b('0x9')],{'host':_0x0d8b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d8b('0x9')]));require(_0x0d8b('0xb'))[_0x0d8b('0xc')](socket);function respondWithRpcPromise(_0x1f4800,_0x28ff7f,_0x1cac62){return new BPromise(function(_0x2c5e9e,_0x28f87c){return client['request'](_0x1f4800,_0x1cac62)[_0x0d8b('0xd')](function(_0x4e0269){logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));logger[_0x0d8b('0x11')](_0x0d8b('0x12'),_0x28ff7f,_0x0d8b('0x10'),JSON[_0x0d8b('0x13')](_0x4e0269));if(_0x4e0269[_0x0d8b('0x14')]){if(_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x15')]===0x1f4){logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x28f87c(_0x4e0269['error'][_0x0d8b('0x16')]);}logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x2c5e9e(_0x4e0269['error'][_0x0d8b('0x16')]);}else{logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));_0x2c5e9e(_0x4e0269[_0x0d8b('0x17')][_0x0d8b('0x16')]);}})[_0x0d8b('0x18')](function(_0xa3612a){logger['error'](_0x0d8b('0xf'),_0x28ff7f,_0xa3612a);_0x28f87c(_0xa3612a);});});}exports[_0x0d8b('0x19')]=function(_0x196c0a){var _0x143372=this;return new Promise(function(_0x24e8ed,_0x5b709c){return db[_0x0d8b('0x1a')][_0x0d8b('0x1b')](_0x196c0a['body'],{'raw':_0x196c0a['options']?_0x196c0a[_0x0d8b('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5527d8){logger[_0x0d8b('0xe')](_0x0d8b('0x19'),_0x196c0a);logger[_0x0d8b('0x11')](_0x0d8b('0x19'),_0x196c0a,JSON[_0x0d8b('0x13')](_0x5527d8));_0x24e8ed(_0x5527d8);})[_0x0d8b('0x18')](function(_0x30980c){logger[_0x0d8b('0x14')](_0x0d8b('0x19'),_0x30980c['message'],_0x196c0a);_0x5b709c(_0x143372[_0x0d8b('0x14')](0x1f4,_0x30980c[_0x0d8b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 86aa376..52ef6d0 100644 --- a/server/api/openchannelMessage/openchannelMessage.socket.js +++ b/server/api/openchannelMessage/openchannelMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['removeListener','register','length','openchannelMessage:','save','remove','update','emit'];(function(_0x23d679,_0x1a4ba2){var _0x370008=function(_0x5f0425){while(--_0x5f0425){_0x23d679['push'](_0x23d679['shift']());}};_0x370008(++_0x1a4ba2);}(_0xedd9,0xfc));var _0x9edd=function(_0x5d3379,_0x33e21b){_0x5d3379=_0x5d3379-0x0;var _0xacfdb4=_0xedd9[_0x5d3379];return _0xacfdb4;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x9edd('0x0'),_0x9edd('0x1'),_0x9edd('0x2')];function createListener(_0x2c16b8,_0x3b51bc){return function(_0x127cbe){_0x3b51bc[_0x9edd('0x3')](_0x2c16b8,_0x127cbe);};}function removeListener(_0x36b53f,_0x5943b3){return function(){OpenchannelMessageEvents[_0x9edd('0x4')](_0x36b53f,_0x5943b3);};}exports[_0x9edd('0x5')]=function(_0x268f9e){for(var _0x34c1a7=0x0,_0x5319f7=events[_0x9edd('0x6')];_0x34c1a7<_0x5319f7;_0x34c1a7++){var _0x571af9=events[_0x34c1a7];var _0x172522=createListener(_0x9edd('0x7')+_0x571af9,_0x268f9e);OpenchannelMessageEvents['on'](_0x571af9,_0x172522);}}; \ No newline at end of file +var _0xcb91=['remove','update','emit','removeListener','register'];(function(_0x4486c3,_0x29e799){var _0x52390a=function(_0xf168ec){while(--_0xf168ec){_0x4486c3['push'](_0x4486c3['shift']());}};_0x52390a(++_0x29e799);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x31abee,_0x11ff0c){_0x31abee=_0x31abee-0x0;var _0x3c1761=_0xcb91[_0x31abee];return _0x3c1761;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x1cb9('0x0'),_0x1cb9('0x1')];function createListener(_0x17d4ec,_0x22c4b8){return function(_0x4c37e8){_0x22c4b8[_0x1cb9('0x2')](_0x17d4ec,_0x4c37e8);};}function removeListener(_0x2c17b8,_0x545a34){return function(){OpenchannelMessageEvents[_0x1cb9('0x3')](_0x2c17b8,_0x545a34);};}exports[_0x1cb9('0x4')]=function(_0x53ffbd){for(var _0x226b69=0x0,_0x3f7deb=events['length'];_0x226b69<_0x3f7deb;_0x226b69++){var _0x38737d=events[_0x226b69];var _0x12567c=createListener('openchannelMessage:'+_0x38737d,_0x53ffbd);OpenchannelMessageEvents['on'](_0x38737d,_0x12567c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index bf7e632..26b7eed 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 _0x0b3d=['getMembers','getTeams','/:id/users','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','exports','multer','path','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x242e41,_0x2beb78){var _0x171510=function(_0x4d8a5a){while(--_0x4d8a5a){_0x242e41['push'](_0x242e41['shift']());}};_0x171510(++_0x2beb78);}(_0x0b3d,0x76));var _0xd0b3=function(_0x163ab5,_0x6a7dbe){_0x163ab5=_0x163ab5-0x0;var _0x17e579=_0x0b3d[_0x163ab5];return _0x17e579;};'use strict';var multer=require(_0xd0b3('0x0'));var util=require('util');var path=require(_0xd0b3('0x1'));var timeout=require('connect-timeout');var express=require(_0xd0b3('0x2'));var router=express['Router']();var auth=require(_0xd0b3('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xd0b3('0x4'));var controller=require('./openchannelQueue.controller');router[_0xd0b3('0x5')]('/',auth[_0xd0b3('0x6')](),controller['index']);router[_0xd0b3('0x5')]('/describe',auth[_0xd0b3('0x6')](),controller['describe']);router['get'](_0xd0b3('0x7'),auth['isAuthenticated'](),controller['show']);router[_0xd0b3('0x5')]('/:id/members',auth[_0xd0b3('0x6')](),controller[_0xd0b3('0x8')]);router['get']('/:id/teams',auth[_0xd0b3('0x6')](),controller[_0xd0b3('0x9')]);router[_0xd0b3('0x5')](_0xd0b3('0xa'),auth['isAuthenticated'](),controller['getAgents']);router[_0xd0b3('0xb')]('/',auth[_0xd0b3('0x6')](),controller[_0xd0b3('0xc')]);router[_0xd0b3('0xb')](_0xd0b3('0xd'),auth[_0xd0b3('0x6')](),controller[_0xd0b3('0xe')]);router['post'](_0xd0b3('0xa'),auth[_0xd0b3('0x6')](),controller[_0xd0b3('0xf')]);router[_0xd0b3('0x10')]('/:id',auth[_0xd0b3('0x6')](),controller[_0xd0b3('0x11')]);router[_0xd0b3('0x12')]('/:id',auth[_0xd0b3('0x6')](),controller[_0xd0b3('0x13')]);router['delete'](_0xd0b3('0xd'),auth[_0xd0b3('0x6')](),controller['removeTeams']);router[_0xd0b3('0x12')](_0xd0b3('0xa'),auth[_0xd0b3('0x6')](),controller['removeAgents']);module[_0xd0b3('0x14')]=router; \ No newline at end of file +var _0x71ad=['delete','destroy','removeAgents','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update'];(function(_0x1a887f,_0x28423c){var _0x1841ff=function(_0x21f786){while(--_0x21f786){_0x1a887f['push'](_0x1a887f['shift']());}};_0x1841ff(++_0x28423c);}(_0x71ad,0xee));var _0xd71a=function(_0x572706,_0x81b426){_0x572706=_0x572706-0x0;var _0x21d8fb=_0x71ad[_0x572706];return _0x21d8fb;};'use strict';var multer=require(_0xd71a('0x0'));var util=require(_0xd71a('0x1'));var path=require('path');var timeout=require(_0xd71a('0x2'));var express=require('express');var router=express[_0xd71a('0x3')]();var auth=require(_0xd71a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd71a('0x5'));var controller=require('./openchannelQueue.controller');router['get']('/',auth[_0xd71a('0x6')](),controller['index']);router[_0xd71a('0x7')](_0xd71a('0x8'),auth[_0xd71a('0x6')](),controller[_0xd71a('0x9')]);router[_0xd71a('0x7')](_0xd71a('0xa'),auth[_0xd71a('0x6')](),controller['show']);router[_0xd71a('0x7')]('/:id/members',auth['isAuthenticated'](),controller[_0xd71a('0xb')]);router[_0xd71a('0x7')](_0xd71a('0xc'),auth[_0xd71a('0x6')](),controller[_0xd71a('0xd')]);router[_0xd71a('0x7')](_0xd71a('0xe'),auth[_0xd71a('0x6')](),controller[_0xd71a('0xf')]);router[_0xd71a('0x10')]('/',auth['isAuthenticated'](),controller[_0xd71a('0x11')]);router[_0xd71a('0x10')](_0xd71a('0xc'),auth[_0xd71a('0x6')](),controller[_0xd71a('0x12')]);router[_0xd71a('0x10')](_0xd71a('0xe'),auth[_0xd71a('0x6')](),controller[_0xd71a('0x13')]);router[_0xd71a('0x14')](_0xd71a('0xa'),auth[_0xd71a('0x6')](),controller[_0xd71a('0x15')]);router[_0xd71a('0x16')](_0xd71a('0xa'),auth['isAuthenticated'](),controller[_0xd71a('0x17')]);router[_0xd71a('0x16')](_0xd71a('0xc'),auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0xd71a('0xe'),auth[_0xd71a('0x6')](),controller[_0xd71a('0x18')]);module[_0xd71a('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index ac2ecab..0bf6632 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 _0x42fa=['roundrobin','sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x413f20,_0x530557){var _0x31309b=function(_0x1b1de9){while(--_0x1b1de9){_0x413f20['push'](_0x413f20['shift']());}};_0x31309b(++_0x530557);}(_0x42fa,0x161));var _0xa42f=function(_0x4246bd,_0x51191b){_0x4246bd=_0x4246bd-0x0;var _0x4aea95=_0x42fa[_0x4246bd];return _0x4aea95;};'use strict';var Sequelize=require(_0xa42f('0x0'));module[_0xa42f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa42f('0x2')]},'timeout':{'type':Sequelize[_0xa42f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa42f('0x4')](_0xa42f('0x5'),_0xa42f('0x6'),_0xa42f('0x7'))}}; \ No newline at end of file +var _0xb70c=['ENUM','rrmemory','beepall','sequelize','exports','STRING','name','INTEGER'];(function(_0x1a26ef,_0x556ccf){var _0x50ae2b=function(_0x2ecc71){while(--_0x2ecc71){_0x1a26ef['push'](_0x1a26ef['shift']());}};_0x50ae2b(++_0x556ccf);}(_0xb70c,0x10b));var _0xcb70=function(_0x13945b,_0x289c94){_0x13945b=_0x13945b-0x0;var _0x1b1643=_0xb70c[_0x13945b];return _0x1b1643;};'use strict';var Sequelize=require(_0xcb70('0x0'));module[_0xcb70('0x1')]={'name':{'type':Sequelize[_0xcb70('0x2')],'unique':_0xcb70('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcb70('0x2')]},'timeout':{'type':Sequelize[_0xcb70('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcb70('0x5')](_0xcb70('0x6'),_0xcb70('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 1692985..675f66a 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 _0x66ad=['User','online','interface','flatMap','Agents','sequelize','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','select','field','tq.TeamId','team_has_openchannel_queues','user_has_teams','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','SELECT','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','userOpenchannelQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','status','end','count','offset','limit','set','json','apply','save','update','then','destroy','OpenchannelQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','OpenchannelQueue','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','options','includeAll','findAll','catch','show','rawAttributes','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params','describe','getMembers','findOne','UserOpenchannelQueue','order','findAndCountAll','UserId','agent','createdAt','rows','format','%s/%s','openchannelPause','updatedAt','getTeams','Team','pick','ids'];(function(_0xb0de07,_0x3ca2a0){var _0x4633d8=function(_0x2368e0){while(--_0x2368e0){_0xb0de07['push'](_0xb0de07['shift']());}};_0x4633d8(++_0x3ca2a0);}(_0x66ad,0x12a));var _0xd66a=function(_0xd0c661,_0x458554){_0xd0c661=_0xd0c661-0x0;var _0x224591=_0x66ad[_0xd0c661];return _0x224591;};'use strict';var pdf=require(_0xd66a('0x0'));var emlformat=require(_0xd66a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd66a('0x2'));var jsonpatch=require(_0xd66a('0x3'));var rp=require('request-promise');var moment=require(_0xd66a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd66a('0x5'));var util=require(_0xd66a('0x6'));var path=require(_0xd66a('0x7'));var sox=require('sox');var csv=require(_0xd66a('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd66a('0x9'));var squel=require(_0xd66a('0xa'));var crypto=require('crypto');var jsforce=require(_0xd66a('0xb'));var deskjs=require(_0xd66a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd66a('0xd'));var Papa=require('papaparse');var Redis=require(_0xd66a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd66a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd66a('0x10'));var logger=require(_0xd66a('0x11'))(_0xd66a('0x12'));var utils=require(_0xd66a('0x13'));var config=require(_0xd66a('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xd66a('0x15')]=_[_0xd66a('0x16')](config['redis'],{'host':_0xd66a('0x17'),'port':0x18eb});var socket=require(_0xd66a('0x18'))(new Redis(config[_0xd66a('0x15')]));require(_0xd66a('0x19'))['register'](socket);function respondWithStatusCode(_0x46cfa8,_0x2c4334){_0x2c4334=_0x2c4334||0xcc;return function(_0x1ceb6e){if(_0x1ceb6e){return _0x46cfa8['sendStatus'](_0x2c4334);}return _0x46cfa8[_0xd66a('0x1a')](_0x2c4334)[_0xd66a('0x1b')]();};}function respondWithResult(_0x401a4e,_0x2ea979){_0x2ea979=_0x2ea979||0xc8;return function(_0x4b17ad){if(_0x4b17ad){return _0x401a4e[_0xd66a('0x1a')](_0x2ea979)['json'](_0x4b17ad);}};}function respondWithFilteredResult(_0x519ff0,_0x42361f){return function(_0xcf67c){if(_0xcf67c){var _0x225e1b=_0xcf67c[_0xd66a('0x1c')],_0x335ebe=_0x42361f[_0xd66a('0x1d')],_0x576288=_0x42361f['offset']+_0x42361f[_0xd66a('0x1e')],_0xd90717;if(_0x576288>=_0x225e1b){_0x576288=_0x225e1b;_0xd90717=0xc8;}else{_0xd90717=0xce;}_0x519ff0[_0xd66a('0x1a')](_0xd90717);return _0x519ff0[_0xd66a('0x1f')]('Content-Range',_0x335ebe+'-'+_0x576288+'/'+_0x225e1b)[_0xd66a('0x20')](_0xcf67c);}return null;};}function patchUpdates(_0x580120){return function(_0x4fc7a1){try{jsonpatch[_0xd66a('0x21')](_0x4fc7a1,_0x580120,!![]);}catch(_0x19339c){return BPromise['reject'](_0x19339c);}return _0x4fc7a1[_0xd66a('0x22')]();};}function saveUpdates(_0x584df7,_0x4c2190){return function(_0x31d593){if(_0x31d593){return _0x31d593[_0xd66a('0x23')](_0x584df7)[_0xd66a('0x24')](function(_0x5ea595){return _0x5ea595;});}return null;};}function removeEntity(_0x292a08,_0x22c813){return function(_0x259f10){if(_0x259f10){return _0x259f10[_0xd66a('0x25')]()[_0xd66a('0x24')](function(){var _0x1354fe=_0x259f10['get']({'plain':!![]});var _0x379073=_0xd66a('0x26');return db[_0xd66a('0x27')][_0xd66a('0x25')]({'where':{'type':_0x379073,'resourceId':_0x1354fe['id']}})['then'](function(){return _0x259f10;});})[_0xd66a('0x24')](function(){_0x292a08['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x133abf,_0x110e35){return function(_0x441891){if(!_0x441891){_0x133abf[_0xd66a('0x28')](0x194);}return _0x441891;};}function handleError(_0xce655e,_0x562986){_0x562986=_0x562986||0x1f4;return function(_0xb2e230){logger[_0xd66a('0x29')](_0xb2e230[_0xd66a('0x2a')]);if(_0xb2e230[_0xd66a('0x2b')]){delete _0xb2e230['name'];}_0xce655e[_0xd66a('0x1a')](_0x562986)[_0xd66a('0x2c')](_0xb2e230);};}exports[_0xd66a('0x2d')]=function(_0x2a3125,_0x732c0d){var _0x4b46d1={},_0x31c722={},_0x2d3bf1={'count':0x0,'rows':[]};var _0x122b3b=_[_0xd66a('0x2e')](db[_0xd66a('0x2f')]['rawAttributes'],function(_0x584620){return{'name':_0x584620[_0xd66a('0x30')],'type':_0x584620['type'][_0xd66a('0x31')]};});_0x31c722[_0xd66a('0x32')]=_[_0xd66a('0x2e')](_0x122b3b,'name');_0x31c722[_0xd66a('0x33')]=_[_0xd66a('0x34')](_0x2a3125[_0xd66a('0x33')]);_0x31c722[_0xd66a('0x35')]=_[_0xd66a('0x36')](_0x31c722[_0xd66a('0x32')],_0x31c722['query']);_0x4b46d1[_0xd66a('0x37')]=_[_0xd66a('0x36')](_0x31c722['model'],qs[_0xd66a('0x38')](_0x2a3125['query'][_0xd66a('0x38')]));_0x4b46d1['attributes']=_0x4b46d1[_0xd66a('0x37')][_0xd66a('0x39')]?_0x4b46d1[_0xd66a('0x37')]:_0x31c722[_0xd66a('0x32')];if(!_0x2a3125['query'][_0xd66a('0x3a')](_0xd66a('0x3b'))){_0x4b46d1[_0xd66a('0x1e')]=qs['limit'](_0x2a3125[_0xd66a('0x33')][_0xd66a('0x1e')]);_0x4b46d1['offset']=qs[_0xd66a('0x1d')](_0x2a3125['query']['offset']);}_0x4b46d1['order']=qs[_0xd66a('0x3c')](_0x2a3125[_0xd66a('0x33')]['sort']);_0x4b46d1['where']=qs['filters'](_['pick'](_0x2a3125[_0xd66a('0x33')],_0x31c722[_0xd66a('0x35')]),_0x122b3b);if(_0x2a3125[_0xd66a('0x33')][_0xd66a('0x3d')]){_0x4b46d1[_0xd66a('0x3e')]=_[_0xd66a('0x3f')](_0x4b46d1[_0xd66a('0x3e')],{'$or':_['map'](_0x122b3b,function(_0x4cd794){if(_0x4cd794['type']!=='VIRTUAL'){var _0xb67323={};_0xb67323[_0x4cd794[_0xd66a('0x2b')]]={'$like':'%'+_0x2a3125['query'][_0xd66a('0x3d')]+'%'};return _0xb67323;}})});}_0x4b46d1=_[_0xd66a('0x3f')]({},_0x4b46d1,_0x2a3125[_0xd66a('0x40')]);var _0x201ac3={'where':_0x4b46d1[_0xd66a('0x3e')]};return db[_0xd66a('0x2f')][_0xd66a('0x1c')](_0x201ac3)[_0xd66a('0x24')](function(_0x2a1fd6){_0x2d3bf1[_0xd66a('0x1c')]=_0x2a1fd6;if(_0x2a3125['query'][_0xd66a('0x41')]){_0x4b46d1['include']=[{'all':!![]}];}return db[_0xd66a('0x2f')][_0xd66a('0x42')](_0x4b46d1);})[_0xd66a('0x24')](function(_0x535bf7){_0x2d3bf1['rows']=_0x535bf7;return _0x2d3bf1;})[_0xd66a('0x24')](respondWithFilteredResult(_0x732c0d,_0x4b46d1))[_0xd66a('0x43')](handleError(_0x732c0d,null));};exports[_0xd66a('0x44')]=function(_0x254e51,_0x50751e){var _0x7bdc50={'raw':!![],'where':{'id':_0x254e51['params']['id']}},_0x15f866={};_0x15f866['model']=_[_0xd66a('0x34')](db[_0xd66a('0x2f')][_0xd66a('0x45')]);_0x15f866[_0xd66a('0x33')]=_['keys'](_0x254e51['query']);_0x15f866[_0xd66a('0x35')]=_[_0xd66a('0x36')](_0x15f866[_0xd66a('0x32')],_0x15f866[_0xd66a('0x33')]);_0x7bdc50['attributes']=_[_0xd66a('0x36')](_0x15f866[_0xd66a('0x32')],qs[_0xd66a('0x38')](_0x254e51[_0xd66a('0x33')][_0xd66a('0x38')]));_0x7bdc50[_0xd66a('0x37')]=_0x7bdc50[_0xd66a('0x37')][_0xd66a('0x39')]?_0x7bdc50['attributes']:_0x15f866['model'];if(_0x254e51['query'][_0xd66a('0x41')]){_0x7bdc50[_0xd66a('0x46')]=[{'all':!![]}];}_0x7bdc50=_[_0xd66a('0x3f')]({},_0x7bdc50,_0x254e51[_0xd66a('0x40')]);return db['OpenchannelQueue'][_0xd66a('0x47')](_0x7bdc50)[_0xd66a('0x24')](handleEntityNotFound(_0x50751e,null))[_0xd66a('0x24')](respondWithResult(_0x50751e,null))[_0xd66a('0x43')](handleError(_0x50751e,null));};exports['create']=function(_0x57493a,_0x28009f){return db[_0xd66a('0x2f')][_0xd66a('0x48')](_0x57493a[_0xd66a('0x49')],{})[_0xd66a('0x24')](function(_0x5abadf){var _0x3db66f=_0x57493a['user'][_0xd66a('0x4a')]({'plain':!![]});if(!_0x3db66f)throw new Error(_0xd66a('0x4b'));if(_0x3db66f[_0xd66a('0x4c')]==='user'){var _0x380112=_0x5abadf[_0xd66a('0x4a')]({'plain':!![]});var _0x4818dc='OpenchannelQueues';return db[_0xd66a('0x4d')][_0xd66a('0x47')]({'where':{'name':_0x4818dc,'userProfileId':_0x3db66f[_0xd66a('0x4e')]},'raw':!![]})[_0xd66a('0x24')](function(_0xa838db){if(_0xa838db&&_0xa838db['autoAssociation']===0x0){return db[_0xd66a('0x27')][_0xd66a('0x48')]({'name':_0x380112[_0xd66a('0x2b')],'resourceId':_0x380112['id'],'type':_0xa838db[_0xd66a('0x2b')],'sectionId':_0xa838db['id']},{})[_0xd66a('0x24')](function(){return _0x5abadf;});}else{return _0x5abadf;}})[_0xd66a('0x43')](function(_0x2a942d){logger[_0xd66a('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a942d);throw _0x2a942d;});}return _0x5abadf;})[_0xd66a('0x24')](respondWithResult(_0x28009f,0xc9))[_0xd66a('0x43')](handleError(_0x28009f,null));};exports[_0xd66a('0x23')]=function(_0x37b63c,_0x27a629){if(_0x37b63c[_0xd66a('0x49')]['id']){delete _0x37b63c['body']['id'];}return db[_0xd66a('0x2f')][_0xd66a('0x47')]({'where':{'id':_0x37b63c[_0xd66a('0x4f')]['id']}})[_0xd66a('0x24')](handleEntityNotFound(_0x27a629,null))[_0xd66a('0x24')](saveUpdates(_0x37b63c[_0xd66a('0x49')],null))[_0xd66a('0x24')](respondWithResult(_0x27a629,null))[_0xd66a('0x43')](handleError(_0x27a629,null));};exports[_0xd66a('0x25')]=function(_0x39ab9a,_0x503ab5){return db[_0xd66a('0x2f')][_0xd66a('0x47')]({'where':{'id':_0x39ab9a[_0xd66a('0x4f')]['id']}})[_0xd66a('0x24')](handleEntityNotFound(_0x503ab5,null))['then'](removeEntity(_0x503ab5,null))['catch'](handleError(_0x503ab5,null));};exports[_0xd66a('0x50')]=function(_0x5e40a,_0x2fb06e){return db['OpenchannelQueue'][_0xd66a('0x50')]()[_0xd66a('0x24')](respondWithResult(_0x2fb06e,null))[_0xd66a('0x43')](handleError(_0x2fb06e,null));};exports[_0xd66a('0x51')]=function(_0x4a21b3,_0x2abda1,_0x204d0b){var _0x22bca0={'raw':!![],'where':{}},_0x5f1873={},_0x42c5d3;return db[_0xd66a('0x2f')][_0xd66a('0x52')]({'where':{'id':_0x4a21b3[_0xd66a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2abda1,null))[_0xd66a('0x24')](function(_0x25bba4){if(_0x25bba4){_0x42c5d3=_0x25bba4['get']({'plain':!![]});_0x5f1873[_0xd66a('0x32')]=_[_0xd66a('0x34')](db[_0xd66a('0x53')][_0xd66a('0x45')]);_0x5f1873[_0xd66a('0x33')]=_[_0xd66a('0x34')](_0x4a21b3['query']);_0x5f1873[_0xd66a('0x35')]=_['intersection'](_0x5f1873[_0xd66a('0x32')],_0x5f1873[_0xd66a('0x33')]);_0x22bca0['attributes']=_[_0xd66a('0x36')](_0x5f1873[_0xd66a('0x32')],qs[_0xd66a('0x38')](_0x4a21b3[_0xd66a('0x33')]['fields']));_0x22bca0[_0xd66a('0x37')]=_0x22bca0[_0xd66a('0x37')][_0xd66a('0x39')]?_0x22bca0[_0xd66a('0x37')]:_0x5f1873[_0xd66a('0x32')];if(!_0x4a21b3[_0xd66a('0x33')][_0xd66a('0x3a')](_0xd66a('0x3b'))){_0x22bca0[_0xd66a('0x1e')]=qs[_0xd66a('0x1e')](_0x4a21b3[_0xd66a('0x33')][_0xd66a('0x1e')]);_0x22bca0[_0xd66a('0x1d')]=qs[_0xd66a('0x1d')](_0x4a21b3['query'][_0xd66a('0x1d')]);}_0x22bca0[_0xd66a('0x54')]=qs['sort'](_0x4a21b3['query']['sort']);_0x22bca0[_0xd66a('0x3e')]=qs['filters'](_['pick'](_0x4a21b3[_0xd66a('0x33')],_0x5f1873['filters']));_0x22bca0['where']['OpenchannelQueueId']=_0x25bba4['id'];if(_0x4a21b3['query'][_0xd66a('0x3d')]){_0x22bca0['where']=_[_0xd66a('0x3f')](_0x22bca0['where'],{'$or':_[_0xd66a('0x2e')](_0x22bca0[_0xd66a('0x37')],function(_0x5c065b){var _0x135999={};_0x135999[_0x5c065b]={'$like':'%'+_0x4a21b3[_0xd66a('0x33')][_0xd66a('0x3d')]+'%'};return _0x135999;})});}_0x22bca0=_[_0xd66a('0x3f')]({},_0x22bca0,_0x4a21b3[_0xd66a('0x40')]);return db[_0xd66a('0x53')][_0xd66a('0x42')](_0x22bca0);}})[_0xd66a('0x24')](function(_0x1326e5){if(_0x1326e5){return db['User'][_0xd66a('0x55')]({'where':{'id':_[_0xd66a('0x2e')](_0x1326e5,_0xd66a('0x56')),'role':_0xd66a('0x57')},'attributes':['id',_0xd66a('0x2b'),'openchannelPause','updatedAt',_0xd66a('0x58')]});}})[_0xd66a('0x24')](function(_0x56e9bb){if(_0x56e9bb){return{'count':_0x56e9bb[_0xd66a('0x1c')],'rows':_[_0xd66a('0x2e')](_0x56e9bb[_0xd66a('0x59')],function(_0x2f608e){return{'membername':_0x2f608e[_0xd66a('0x2b')],'UserId':_0x2f608e['id'],'queue_name':_0x42c5d3[_0xd66a('0x2b')],'OpenchannelQueueId':_0x42c5d3['id'],'interface':util[_0xd66a('0x5a')](_0xd66a('0x5b'),'SIP',_0x2f608e['name']),'penalty':0x0,'paused':_0x2f608e[_0xd66a('0x5c')],'createdAt':_0x2f608e[_0xd66a('0x58')],'updatedAt':_0x2f608e[_0xd66a('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd66a('0x24')](respondWithFilteredResult(_0x2abda1,_0x22bca0))[_0xd66a('0x43')](handleError(_0x2abda1,null));};exports[_0xd66a('0x5e')]=function(_0x26b811,_0x48e690,_0x184c65){var _0x4fc29a={};var _0x35065d={};var _0x5b17b3;var _0x7e1f6e;return db[_0xd66a('0x2f')][_0xd66a('0x52')]({'where':{'id':_0x26b811[_0xd66a('0x4f')]['id']}})[_0xd66a('0x24')](handleEntityNotFound(_0x48e690,null))[_0xd66a('0x24')](function(_0x4c9005){if(_0x4c9005){_0x5b17b3=_0x4c9005;_0x35065d[_0xd66a('0x32')]=_[_0xd66a('0x34')](db[_0xd66a('0x5f')][_0xd66a('0x45')]);_0x35065d['query']=_[_0xd66a('0x34')](_0x26b811['query']);_0x35065d['filters']=_[_0xd66a('0x36')](_0x35065d[_0xd66a('0x32')],_0x35065d[_0xd66a('0x33')]);_0x4fc29a['attributes']=_[_0xd66a('0x36')](_0x35065d[_0xd66a('0x32')],qs['fields'](_0x26b811[_0xd66a('0x33')][_0xd66a('0x38')]));_0x4fc29a['attributes']=_0x4fc29a[_0xd66a('0x37')][_0xd66a('0x39')]?_0x4fc29a[_0xd66a('0x37')]:_0x35065d[_0xd66a('0x32')];_0x4fc29a[_0xd66a('0x54')]=qs[_0xd66a('0x3c')](_0x26b811[_0xd66a('0x33')][_0xd66a('0x3c')]);_0x4fc29a['where']=qs[_0xd66a('0x35')](_[_0xd66a('0x60')](_0x26b811[_0xd66a('0x33')],_0x35065d['filters']));if(_0x26b811[_0xd66a('0x33')][_0xd66a('0x3d')]){_0x4fc29a['where']=_[_0xd66a('0x3f')](_0x4fc29a[_0xd66a('0x3e')],{'$or':_['map'](_0x4fc29a[_0xd66a('0x37')],function(_0x59478f){var _0x4b6dcc={};_0x4b6dcc[_0x59478f]={'$like':'%'+_0x26b811['query'][_0xd66a('0x3d')]+'%'};return _0x4b6dcc;})});}_0x4fc29a=_['merge']({},_0x4fc29a,_0x26b811['options']);return _0x5b17b3[_0xd66a('0x5e')](_0x4fc29a);}})[_0xd66a('0x24')](function(_0x30e54a){if(_0x30e54a){_0x7e1f6e=_0x30e54a[_0xd66a('0x39')];if(!_0x26b811[_0xd66a('0x33')][_0xd66a('0x3a')]('nolimit')){_0x4fc29a[_0xd66a('0x1e')]=qs[_0xd66a('0x1e')](_0x26b811[_0xd66a('0x33')][_0xd66a('0x1e')]);_0x4fc29a[_0xd66a('0x1d')]=qs['offset'](_0x26b811[_0xd66a('0x33')][_0xd66a('0x1d')]);}return _0x5b17b3['getTeams'](_0x4fc29a);}})[_0xd66a('0x24')](function(_0x359ecd){if(_0x359ecd){return _0x359ecd?{'count':_0x7e1f6e,'rows':_0x359ecd}:null;}})[_0xd66a('0x24')](respondWithResult(_0x48e690,null))[_0xd66a('0x43')](handleError(_0x48e690,null));};exports['addTeams']=function(_0x27cb3b,_0x37aa24,_0x46812a){var _0x3c0320=_0x27cb3b[_0xd66a('0x49')][_0xd66a('0x61')];return db[_0xd66a('0x5f')][_0xd66a('0x42')]({'where':{'id':_0x3c0320},'attributes':['id'],'include':[{'model':db[_0xd66a('0x62')],'as':'Agents','attributes':['id',_0xd66a('0x2b'),_0xd66a('0x63'),'voicePause',_0xd66a('0x64')],'raw':!![]}]})['then'](function(_0x2637f2){if(_0x2637f2){var _0x658110=_[_0xd66a('0x65')](_0x2637f2,function(_0x414481){var _0x14b11f=_0x414481[_0xd66a('0x4a')]({'plain':!![]});return _0x14b11f[_0xd66a('0x66')];});return db[_0xd66a('0x2f')][_0xd66a('0x47')]({'where':{'id':_0x27cb3b['params']['id']}})['then'](function(_0x5894e6){return db[_0xd66a('0x67')]['transaction'](function(_0x1041ca){return _0x5894e6['addTeams'](_0x3c0320,{'transaction':_0x1041ca})[_0xd66a('0x24')](function(){return BPromise[_0xd66a('0x68')](_0x658110,function(_0x45c54e){return db[_0xd66a('0x53')][_0xd66a('0x69')]({'where':{'UserId':_0x45c54e['id'],'OpenchannelQueueId':_0x27cb3b[_0xd66a('0x4f')]['id']},'transaction':_0x1041ca});});})[_0xd66a('0x24')](function(){_0x658110[_0xd66a('0x6a')](function(_0x23add9){socket[_0xd66a('0x6b')](_0xd66a('0x6c'),{'UserId':_0x23add9['id'],'OpenchannelQueueId':_0x5894e6['id']});});});});});}})[_0xd66a('0x24')](respondWithStatusCode(_0x37aa24,null))['catch'](handleError(_0x37aa24,null));};exports['removeTeams']=function(_0x362884,_0x3422ca,_0x45881c){return db[_0xd66a('0x5f')][_0xd66a('0x42')]({'where':{'id':_0x362884[_0xd66a('0x33')][_0xd66a('0x61')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd66a('0x66'),'attributes':['id'],'raw':!![]}]})[_0xd66a('0x24')](handleEntityNotFound(_0x3422ca,null))[_0xd66a('0x24')](function(_0xa310ae){var _0x301e84=_['map'](_0xa310ae,'id');var _0x30f994=[];var _0xf10a07=[];var _0x244181=squel[_0xd66a('0x6d')]();_0x244181[_0xd66a('0x6e')](_0xd66a('0x6f'))['from'](_0xd66a('0x70'),'tq')['join'](_0xd66a('0x71'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xd66a('0x72'),_0x362884['params']['id']);for(var _0x2c4bbb=0x0;_0x2c4bbb<_0xa310ae['length'];_0x2c4bbb+=0x1){let _0x431b4c=_0xa310ae[_0x2c4bbb];for(var _0x5c7f63=0x0;_0x5c7f63<_0x431b4c['Agents']['length'];_0x5c7f63+=0x1){let _0x290e49=_0x431b4c['Agents'][_0x5c7f63];var _0x109b31=_0x244181['clone']();_0x109b31[_0xd66a('0x3e')](_0xd66a('0x73'),_0x290e49['id']);_0xf10a07['push'](db[_0xd66a('0x67')][_0xd66a('0x33')](_0x109b31[_0xd66a('0x74')](),{'type':db[_0xd66a('0x67')]['QueryTypes'][_0xd66a('0x75')]})['then'](function(_0x4c4ecd){if(_0x4c4ecd['length']===0x1){return _0x290e49['id'];}else{var _0x57e024=_['every'](_[_0xd66a('0x2e')](_0x4c4ecd,_0xd66a('0x76')),function(_0x4fd6ec){return _[_0xd66a('0x77')](_0x301e84,_0x4fd6ec);});if(_0x57e024){return _0x290e49['id'];}}}));}}return BPromise[_0xd66a('0x78')](_0xf10a07)[_0xd66a('0x24')](function(_0x3b3e53){_0x30f994=_(_0x30f994)[_0xd66a('0x79')](_0x3b3e53)[_0xd66a('0x7a')]()[_0xd66a('0x7b')]();return db['OpenchannelQueue']['find']({'where':{'id':_0x362884[_0xd66a('0x4f')]['id']}})[_0xd66a('0x24')](function(_0x59b848){return db[_0xd66a('0x67')]['transaction'](function(_0x270b17){return _0x59b848[_0xd66a('0x7c')](_0x362884['query']['ids'],{'transaction':_0x270b17})[_0xd66a('0x24')](function(){if(!_[_0xd66a('0x7d')](_0x30f994)){return _0x59b848['removeAgents'](_0x30f994,{'transaction':_0x270b17});}})['then'](function(){_0x30f994[_0xd66a('0x6a')](function(_0x688fda){socket[_0xd66a('0x6b')](_0xd66a('0x7e'),{'UserId':_0x688fda,'OpenchannelQueueId':_0x59b848['id']});});});});});});})[_0xd66a('0x24')](respondWithStatusCode(_0x3422ca,null))['catch'](handleError(_0x3422ca,null));};exports[_0xd66a('0x7f')]=function(_0xf4d3e0,_0x718005,_0x4a1736){return db[_0xd66a('0x2f')][_0xd66a('0x47')]({'where':{'id':_0xf4d3e0['params']['id']}})[_0xd66a('0x24')](handleEntityNotFound(_0x718005,null))['then'](function(_0x2aa703){if(_0x2aa703){return _0x2aa703[_0xd66a('0x7f')](_0xf4d3e0['body']['ids'],_[_0xd66a('0x80')](_0xf4d3e0['body'],['ids','id'])||{})['spread'](function(_0x2055e8){for(var _0x11bff0=0x0;_0x11bff0<_0xf4d3e0[_0xd66a('0x49')][_0xd66a('0x61')][_0xd66a('0x39')];_0x11bff0+=0x1){socket['emit'](_0xd66a('0x6c'),{'UserId':_0xf4d3e0[_0xd66a('0x49')]['ids'][_0x11bff0],'OpenchannelQueueId':_0xf4d3e0[_0xd66a('0x4f')]['id']});}return _0x2055e8;});}})[_0xd66a('0x24')](respondWithResult(_0x718005,null))[_0xd66a('0x43')](handleError(_0x718005,null));};exports[_0xd66a('0x81')]=function(_0x45502a,_0x5e9033,_0xd91b74){return db['OpenchannelQueue']['find']({'where':{'id':_0x45502a[_0xd66a('0x4f')]['id']}})[_0xd66a('0x24')](handleEntityNotFound(_0x5e9033,null))[_0xd66a('0x24')](function(_0x27f5aa){if(_0x27f5aa){return _0x27f5aa[_0xd66a('0x81')](_0x45502a[_0xd66a('0x33')][_0xd66a('0x61')])[_0xd66a('0x24')](function(){if(_[_0xd66a('0x82')](_0x45502a[_0xd66a('0x33')]['ids'])){for(var _0x21653e=0x0;_0x21653e<_0x45502a[_0xd66a('0x33')][_0xd66a('0x61')][_0xd66a('0x39')];_0x21653e+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x45502a['query'][_0xd66a('0x61')][_0x21653e]),'OpenchannelQueueId':Number(_0x45502a[_0xd66a('0x4f')]['id'])});}}else{socket[_0xd66a('0x6b')](_0xd66a('0x7e'),{'UserId':Number(_0x45502a['query'][_0xd66a('0x61')]),'OpenchannelQueueId':Number(_0x45502a['params']['id'])});}});}})[_0xd66a('0x24')](respondWithStatusCode(_0x5e9033,null))[_0xd66a('0x43')](handleError(_0x5e9033,null));};exports[_0xd66a('0x83')]=function(_0x6bc45c,_0x3615d0,_0x387492){var _0x36a5a4={};var _0x5e87a8={};var _0xc1d6ff;var _0x477473;return db[_0xd66a('0x2f')][_0xd66a('0x52')]({'where':{'id':_0x6bc45c[_0xd66a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3615d0,null))[_0xd66a('0x24')](function(_0x5ca367){if(_0x5ca367){_0xc1d6ff=_0x5ca367;_0x5e87a8['model']=_[_0xd66a('0x34')](db['User'][_0xd66a('0x45')]);_0x5e87a8[_0xd66a('0x33')]=_[_0xd66a('0x34')](_0x6bc45c[_0xd66a('0x33')]);_0x5e87a8[_0xd66a('0x35')]=_[_0xd66a('0x36')](_0x5e87a8[_0xd66a('0x32')],_0x5e87a8[_0xd66a('0x33')]);_0x36a5a4[_0xd66a('0x37')]=_[_0xd66a('0x36')](_0x5e87a8[_0xd66a('0x32')],qs[_0xd66a('0x38')](_0x6bc45c[_0xd66a('0x33')][_0xd66a('0x38')]));_0x36a5a4[_0xd66a('0x37')]=_0x36a5a4[_0xd66a('0x37')][_0xd66a('0x39')]?_0x36a5a4['attributes']:_0x5e87a8[_0xd66a('0x32')];_0x36a5a4[_0xd66a('0x54')]=qs[_0xd66a('0x3c')](_0x6bc45c[_0xd66a('0x33')]['sort']);_0x36a5a4['where']=qs[_0xd66a('0x35')](_[_0xd66a('0x60')](_0x6bc45c[_0xd66a('0x33')],_0x5e87a8[_0xd66a('0x35')]));if(_0x6bc45c[_0xd66a('0x33')][_0xd66a('0x3d')]){_0x36a5a4['where']=_[_0xd66a('0x3f')](_0x36a5a4[_0xd66a('0x3e')],{'$or':_[_0xd66a('0x2e')](_0x36a5a4[_0xd66a('0x37')],function(_0x3dba18){var _0x8da3b9={};_0x8da3b9[_0x3dba18]={'$like':'%'+_0x6bc45c['query']['filter']+'%'};return _0x8da3b9;})});}_0x36a5a4=_[_0xd66a('0x3f')]({},_0x36a5a4,_0x6bc45c[_0xd66a('0x40')]);return _0xc1d6ff[_0xd66a('0x83')](_0x36a5a4);}})[_0xd66a('0x24')](function(_0x404cf6){if(_0x404cf6){_0x477473=_0x404cf6['length'];if(!_0x6bc45c[_0xd66a('0x33')][_0xd66a('0x3a')](_0xd66a('0x3b'))){_0x36a5a4[_0xd66a('0x1e')]=qs[_0xd66a('0x1e')](_0x6bc45c[_0xd66a('0x33')][_0xd66a('0x1e')]);_0x36a5a4[_0xd66a('0x1d')]=qs[_0xd66a('0x1d')](_0x6bc45c[_0xd66a('0x33')][_0xd66a('0x1d')]);}return _0xc1d6ff[_0xd66a('0x83')](_0x36a5a4);}})[_0xd66a('0x24')](function(_0x133875){if(_0x133875){return _0x133875?{'count':_0x477473,'rows':_0x133875}:null;}})[_0xd66a('0x24')](respondWithResult(_0x3615d0,null))[_0xd66a('0x43')](handleError(_0x3615d0,null));}; \ No newline at end of file +var _0x73c7=['hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','options','count','include','findAll','rows','catch','show','rawAttributes','includeAll','find','create','body','user','get','OpenchannelQueues','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserOpenchannelQueue','sort','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','voicePause','interface','sequelize','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','all','union','value','transaction','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','json','offset','set','apply','reject','save','update','destroy','UserProfileResource','then','stack','name','index','OpenchannelQueue','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length'];(function(_0x2077f6,_0x3de176){var _0x5d93a6=function(_0x43ee2e){while(--_0x43ee2e){_0x2077f6['push'](_0x2077f6['shift']());}};_0x5d93a6(++_0x3de176);}(_0x73c7,0xdd));var _0x773c=function(_0xe838f0,_0x379fa6){_0xe838f0=_0xe838f0-0x0;var _0x5dc933=_0x73c7[_0xe838f0];return _0x5dc933;};'use strict';var pdf=require(_0x773c('0x0'));var emlformat=require(_0x773c('0x1'));var rimraf=require(_0x773c('0x2'));var zipdir=require(_0x773c('0x3'));var jsonpatch=require(_0x773c('0x4'));var rp=require('request-promise');var moment=require(_0x773c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x773c('0x6'));var util=require(_0x773c('0x7'));var path=require(_0x773c('0x8'));var sox=require(_0x773c('0x9'));var csv=require(_0x773c('0xa'));var ejs=require(_0x773c('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x773c('0xc'));var crypto=require(_0x773c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x773c('0xe'));var toCsv=require(_0x773c('0xa'));var querystring=require(_0x773c('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x773c('0x10'));var as=require(_0x773c('0x11'));var hardwareService=require(_0x773c('0x12'));var logger=require(_0x773c('0x13'))(_0x773c('0x14'));var utils=require(_0x773c('0x15'));var config=require(_0x773c('0x16'));var licenseUtil=require(_0x773c('0x17'));var db=require(_0x773c('0x18'))['db'];config[_0x773c('0x19')]=_[_0x773c('0x1a')](config['redis'],{'host':_0x773c('0x1b'),'port':0x18eb});var socket=require(_0x773c('0x1c'))(new Redis(config[_0x773c('0x19')]));require(_0x773c('0x1d'))['register'](socket);function respondWithStatusCode(_0x1ddd8e,_0x4aceea){_0x4aceea=_0x4aceea||0xcc;return function(_0xb156ea){if(_0xb156ea){return _0x1ddd8e[_0x773c('0x1e')](_0x4aceea);}return _0x1ddd8e[_0x773c('0x1f')](_0x4aceea)[_0x773c('0x20')]();};}function respondWithResult(_0x51d3ea,_0x801ae2){_0x801ae2=_0x801ae2||0xc8;return function(_0xe3dd1b){if(_0xe3dd1b){return _0x51d3ea[_0x773c('0x1f')](_0x801ae2)[_0x773c('0x21')](_0xe3dd1b);}};}function respondWithFilteredResult(_0x3308de,_0x12248b){return function(_0x92bede){if(_0x92bede){var _0xb437eb=_0x92bede['count'],_0xe22612=_0x12248b[_0x773c('0x22')],_0x2663c5=_0x12248b['offset']+_0x12248b['limit'],_0x403ca8;if(_0x2663c5>=_0xb437eb){_0x2663c5=_0xb437eb;_0x403ca8=0xc8;}else{_0x403ca8=0xce;}_0x3308de[_0x773c('0x1f')](_0x403ca8);return _0x3308de[_0x773c('0x23')]('Content-Range',_0xe22612+'-'+_0x2663c5+'/'+_0xb437eb)[_0x773c('0x21')](_0x92bede);}return null;};}function patchUpdates(_0x4056a0){return function(_0x12deaa){try{jsonpatch[_0x773c('0x24')](_0x12deaa,_0x4056a0,!![]);}catch(_0x437988){return BPromise[_0x773c('0x25')](_0x437988);}return _0x12deaa[_0x773c('0x26')]();};}function saveUpdates(_0x4dfa20,_0x59f3cc){return function(_0x4a2560){if(_0x4a2560){return _0x4a2560[_0x773c('0x27')](_0x4dfa20)['then'](function(_0x2dee50){return _0x2dee50;});}return null;};}function removeEntity(_0x3a61c5,_0x2e0ed3){return function(_0x53d96c){if(_0x53d96c){return _0x53d96c[_0x773c('0x28')]()['then'](function(){var _0xbb5b30=_0x53d96c['get']({'plain':!![]});var _0x8602c3='OpenchannelQueues';return db[_0x773c('0x29')][_0x773c('0x28')]({'where':{'type':_0x8602c3,'resourceId':_0xbb5b30['id']}})[_0x773c('0x2a')](function(){return _0x53d96c;});})[_0x773c('0x2a')](function(){_0x3a61c5[_0x773c('0x1f')](0xcc)[_0x773c('0x20')]();});}};}function handleEntityNotFound(_0x42ece0,_0xdaa319){return function(_0x232eb4){if(!_0x232eb4){_0x42ece0['sendStatus'](0x194);}return _0x232eb4;};}function handleError(_0x3c632a,_0x39712a){_0x39712a=_0x39712a||0x1f4;return function(_0x373583){logger['error'](_0x373583[_0x773c('0x2b')]);if(_0x373583[_0x773c('0x2c')]){delete _0x373583[_0x773c('0x2c')];}_0x3c632a[_0x773c('0x1f')](_0x39712a)['send'](_0x373583);};}exports[_0x773c('0x2d')]=function(_0x43ab27,_0x37d7d){var _0x263be6={},_0x431ce3={},_0xda3c58={'count':0x0,'rows':[]};var _0xc5af76=_['map'](db[_0x773c('0x2e')]['rawAttributes'],function(_0x11db93){return{'name':_0x11db93[_0x773c('0x2f')],'type':_0x11db93[_0x773c('0x30')][_0x773c('0x31')]};});_0x431ce3[_0x773c('0x32')]=_[_0x773c('0x33')](_0xc5af76,_0x773c('0x2c'));_0x431ce3[_0x773c('0x34')]=_[_0x773c('0x35')](_0x43ab27['query']);_0x431ce3[_0x773c('0x36')]=_[_0x773c('0x37')](_0x431ce3[_0x773c('0x32')],_0x431ce3[_0x773c('0x34')]);_0x263be6[_0x773c('0x38')]=_[_0x773c('0x37')](_0x431ce3[_0x773c('0x32')],qs[_0x773c('0x39')](_0x43ab27[_0x773c('0x34')][_0x773c('0x39')]));_0x263be6[_0x773c('0x38')]=_0x263be6[_0x773c('0x38')][_0x773c('0x3a')]?_0x263be6[_0x773c('0x38')]:_0x431ce3[_0x773c('0x32')];if(!_0x43ab27[_0x773c('0x34')][_0x773c('0x3b')](_0x773c('0x3c'))){_0x263be6[_0x773c('0x3d')]=qs[_0x773c('0x3d')](_0x43ab27[_0x773c('0x34')]['limit']);_0x263be6['offset']=qs[_0x773c('0x22')](_0x43ab27[_0x773c('0x34')][_0x773c('0x22')]);}_0x263be6[_0x773c('0x3e')]=qs['sort'](_0x43ab27[_0x773c('0x34')]['sort']);_0x263be6[_0x773c('0x3f')]=qs[_0x773c('0x36')](_[_0x773c('0x40')](_0x43ab27[_0x773c('0x34')],_0x431ce3[_0x773c('0x36')]),_0xc5af76);if(_0x43ab27[_0x773c('0x34')][_0x773c('0x41')]){_0x263be6['where']=_[_0x773c('0x42')](_0x263be6[_0x773c('0x3f')],{'$or':_[_0x773c('0x33')](_0xc5af76,function(_0x4fcaae){if(_0x4fcaae['type']!=='VIRTUAL'){var _0x1df919={};_0x1df919[_0x4fcaae[_0x773c('0x2c')]]={'$like':'%'+_0x43ab27[_0x773c('0x34')][_0x773c('0x41')]+'%'};return _0x1df919;}})});}_0x263be6=_[_0x773c('0x42')]({},_0x263be6,_0x43ab27[_0x773c('0x43')]);var _0x71fb1c={'where':_0x263be6[_0x773c('0x3f')]};return db[_0x773c('0x2e')][_0x773c('0x44')](_0x71fb1c)['then'](function(_0x5237d6){_0xda3c58[_0x773c('0x44')]=_0x5237d6;if(_0x43ab27['query']['includeAll']){_0x263be6[_0x773c('0x45')]=[{'all':!![]}];}return db[_0x773c('0x2e')][_0x773c('0x46')](_0x263be6);})[_0x773c('0x2a')](function(_0x4e8d61){_0xda3c58[_0x773c('0x47')]=_0x4e8d61;return _0xda3c58;})[_0x773c('0x2a')](respondWithFilteredResult(_0x37d7d,_0x263be6))[_0x773c('0x48')](handleError(_0x37d7d,null));};exports[_0x773c('0x49')]=function(_0x197009,_0x2877b6){var _0x30c391={'raw':!![],'where':{'id':_0x197009['params']['id']}},_0x537215={};_0x537215[_0x773c('0x32')]=_[_0x773c('0x35')](db['OpenchannelQueue'][_0x773c('0x4a')]);_0x537215[_0x773c('0x34')]=_[_0x773c('0x35')](_0x197009[_0x773c('0x34')]);_0x537215[_0x773c('0x36')]=_[_0x773c('0x37')](_0x537215[_0x773c('0x32')],_0x537215['query']);_0x30c391[_0x773c('0x38')]=_['intersection'](_0x537215['model'],qs[_0x773c('0x39')](_0x197009[_0x773c('0x34')][_0x773c('0x39')]));_0x30c391['attributes']=_0x30c391[_0x773c('0x38')][_0x773c('0x3a')]?_0x30c391[_0x773c('0x38')]:_0x537215[_0x773c('0x32')];if(_0x197009['query'][_0x773c('0x4b')]){_0x30c391[_0x773c('0x45')]=[{'all':!![]}];}_0x30c391=_['merge']({},_0x30c391,_0x197009[_0x773c('0x43')]);return db[_0x773c('0x2e')][_0x773c('0x4c')](_0x30c391)['then'](handleEntityNotFound(_0x2877b6,null))['then'](respondWithResult(_0x2877b6,null))['catch'](handleError(_0x2877b6,null));};exports[_0x773c('0x4d')]=function(_0xcde216,_0x293f52){return db[_0x773c('0x2e')][_0x773c('0x4d')](_0xcde216[_0x773c('0x4e')],{})['then'](function(_0x298a9e){var _0x440f77=_0xcde216[_0x773c('0x4f')][_0x773c('0x50')]({'plain':!![]});if(!_0x440f77)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x440f77['role']===_0x773c('0x4f')){var _0x5e20ac=_0x298a9e[_0x773c('0x50')]({'plain':!![]});var _0x487467=_0x773c('0x51');return db[_0x773c('0x52')][_0x773c('0x4c')]({'where':{'name':_0x487467,'userProfileId':_0x440f77[_0x773c('0x53')]},'raw':!![]})[_0x773c('0x2a')](function(_0x3a845b){if(_0x3a845b&&_0x3a845b['autoAssociation']===0x0){return db[_0x773c('0x29')][_0x773c('0x4d')]({'name':_0x5e20ac[_0x773c('0x2c')],'resourceId':_0x5e20ac['id'],'type':_0x3a845b[_0x773c('0x2c')],'sectionId':_0x3a845b['id']},{})[_0x773c('0x2a')](function(){return _0x298a9e;});}else{return _0x298a9e;}})['catch'](function(_0x3a209a){logger[_0x773c('0x54')](_0x773c('0x55'),_0x3a209a);throw _0x3a209a;});}return _0x298a9e;})[_0x773c('0x2a')](respondWithResult(_0x293f52,0xc9))[_0x773c('0x48')](handleError(_0x293f52,null));};exports[_0x773c('0x27')]=function(_0xd33e70,_0x24c69c){if(_0xd33e70[_0x773c('0x4e')]['id']){delete _0xd33e70['body']['id'];}return db[_0x773c('0x2e')][_0x773c('0x4c')]({'where':{'id':_0xd33e70[_0x773c('0x56')]['id']}})[_0x773c('0x2a')](handleEntityNotFound(_0x24c69c,null))[_0x773c('0x2a')](saveUpdates(_0xd33e70['body'],null))['then'](respondWithResult(_0x24c69c,null))[_0x773c('0x48')](handleError(_0x24c69c,null));};exports[_0x773c('0x28')]=function(_0x3af14b,_0x54c4d1){return db[_0x773c('0x2e')]['find']({'where':{'id':_0x3af14b[_0x773c('0x56')]['id']}})[_0x773c('0x2a')](handleEntityNotFound(_0x54c4d1,null))[_0x773c('0x2a')](removeEntity(_0x54c4d1,null))[_0x773c('0x48')](handleError(_0x54c4d1,null));};exports[_0x773c('0x57')]=function(_0x39dcc6,_0x8edb0b){return db[_0x773c('0x2e')][_0x773c('0x57')]()[_0x773c('0x2a')](respondWithResult(_0x8edb0b,null))[_0x773c('0x48')](handleError(_0x8edb0b,null));};exports[_0x773c('0x58')]=function(_0x25434d,_0x317408,_0x4ab28f){var _0x2a12a7={'raw':!![],'where':{}},_0x13f51d={},_0x36e77e;return db['OpenchannelQueue'][_0x773c('0x59')]({'where':{'id':_0x25434d[_0x773c('0x56')]['id']}})[_0x773c('0x2a')](handleEntityNotFound(_0x317408,null))[_0x773c('0x2a')](function(_0x17a46f){if(_0x17a46f){_0x36e77e=_0x17a46f[_0x773c('0x50')]({'plain':!![]});_0x13f51d[_0x773c('0x32')]=_[_0x773c('0x35')](db[_0x773c('0x5a')][_0x773c('0x4a')]);_0x13f51d[_0x773c('0x34')]=_[_0x773c('0x35')](_0x25434d[_0x773c('0x34')]);_0x13f51d[_0x773c('0x36')]=_[_0x773c('0x37')](_0x13f51d[_0x773c('0x32')],_0x13f51d['query']);_0x2a12a7[_0x773c('0x38')]=_[_0x773c('0x37')](_0x13f51d[_0x773c('0x32')],qs[_0x773c('0x39')](_0x25434d['query'][_0x773c('0x39')]));_0x2a12a7[_0x773c('0x38')]=_0x2a12a7['attributes'][_0x773c('0x3a')]?_0x2a12a7[_0x773c('0x38')]:_0x13f51d[_0x773c('0x32')];if(!_0x25434d[_0x773c('0x34')][_0x773c('0x3b')](_0x773c('0x3c'))){_0x2a12a7['limit']=qs[_0x773c('0x3d')](_0x25434d[_0x773c('0x34')][_0x773c('0x3d')]);_0x2a12a7[_0x773c('0x22')]=qs['offset'](_0x25434d['query']['offset']);}_0x2a12a7['order']=qs[_0x773c('0x5b')](_0x25434d[_0x773c('0x34')][_0x773c('0x5b')]);_0x2a12a7[_0x773c('0x3f')]=qs[_0x773c('0x36')](_[_0x773c('0x40')](_0x25434d[_0x773c('0x34')],_0x13f51d[_0x773c('0x36')]));_0x2a12a7[_0x773c('0x3f')]['OpenchannelQueueId']=_0x17a46f['id'];if(_0x25434d[_0x773c('0x34')]['filter']){_0x2a12a7[_0x773c('0x3f')]=_[_0x773c('0x42')](_0x2a12a7[_0x773c('0x3f')],{'$or':_[_0x773c('0x33')](_0x2a12a7['attributes'],function(_0x42ce71){var _0x8ec6d4={};_0x8ec6d4[_0x42ce71]={'$like':'%'+_0x25434d[_0x773c('0x34')][_0x773c('0x41')]+'%'};return _0x8ec6d4;})});}_0x2a12a7=_[_0x773c('0x42')]({},_0x2a12a7,_0x25434d[_0x773c('0x43')]);return db[_0x773c('0x5a')]['findAll'](_0x2a12a7);}})[_0x773c('0x2a')](function(_0x21f4e1){if(_0x21f4e1){return db[_0x773c('0x5c')][_0x773c('0x5d')]({'where':{'id':_[_0x773c('0x33')](_0x21f4e1,_0x773c('0x5e')),'role':_0x773c('0x5f')},'attributes':['id','name',_0x773c('0x60'),_0x773c('0x61'),_0x773c('0x62')]});}})[_0x773c('0x2a')](function(_0x476630){if(_0x476630){return{'count':_0x476630[_0x773c('0x44')],'rows':_[_0x773c('0x33')](_0x476630[_0x773c('0x47')],function(_0x43d893){return{'membername':_0x43d893[_0x773c('0x2c')],'UserId':_0x43d893['id'],'queue_name':_0x36e77e['name'],'OpenchannelQueueId':_0x36e77e['id'],'interface':util[_0x773c('0x63')](_0x773c('0x64'),_0x773c('0x65'),_0x43d893[_0x773c('0x2c')]),'penalty':0x0,'paused':_0x43d893[_0x773c('0x60')],'createdAt':_0x43d893['createdAt'],'updatedAt':_0x43d893[_0x773c('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x773c('0x2a')](respondWithFilteredResult(_0x317408,_0x2a12a7))[_0x773c('0x48')](handleError(_0x317408,null));};exports[_0x773c('0x66')]=function(_0x8110d5,_0x7570ae,_0x46262c){var _0x9fba0e={};var _0x58db31={};var _0x3cecd5;var _0x17ddcd;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x8110d5[_0x773c('0x56')]['id']}})[_0x773c('0x2a')](handleEntityNotFound(_0x7570ae,null))[_0x773c('0x2a')](function(_0x22d1c4){if(_0x22d1c4){_0x3cecd5=_0x22d1c4;_0x58db31[_0x773c('0x32')]=_['keys'](db['Team'][_0x773c('0x4a')]);_0x58db31[_0x773c('0x34')]=_[_0x773c('0x35')](_0x8110d5[_0x773c('0x34')]);_0x58db31['filters']=_[_0x773c('0x37')](_0x58db31[_0x773c('0x32')],_0x58db31[_0x773c('0x34')]);_0x9fba0e[_0x773c('0x38')]=_[_0x773c('0x37')](_0x58db31['model'],qs[_0x773c('0x39')](_0x8110d5[_0x773c('0x34')][_0x773c('0x39')]));_0x9fba0e[_0x773c('0x38')]=_0x9fba0e[_0x773c('0x38')][_0x773c('0x3a')]?_0x9fba0e[_0x773c('0x38')]:_0x58db31['model'];_0x9fba0e[_0x773c('0x3e')]=qs[_0x773c('0x5b')](_0x8110d5[_0x773c('0x34')][_0x773c('0x5b')]);_0x9fba0e[_0x773c('0x3f')]=qs[_0x773c('0x36')](_[_0x773c('0x40')](_0x8110d5[_0x773c('0x34')],_0x58db31[_0x773c('0x36')]));if(_0x8110d5['query'][_0x773c('0x41')]){_0x9fba0e[_0x773c('0x3f')]=_[_0x773c('0x42')](_0x9fba0e[_0x773c('0x3f')],{'$or':_[_0x773c('0x33')](_0x9fba0e['attributes'],function(_0x4c88f9){var _0x301744={};_0x301744[_0x4c88f9]={'$like':'%'+_0x8110d5['query'][_0x773c('0x41')]+'%'};return _0x301744;})});}_0x9fba0e=_[_0x773c('0x42')]({},_0x9fba0e,_0x8110d5[_0x773c('0x43')]);return _0x3cecd5[_0x773c('0x66')](_0x9fba0e);}})[_0x773c('0x2a')](function(_0x288f66){if(_0x288f66){_0x17ddcd=_0x288f66[_0x773c('0x3a')];if(!_0x8110d5[_0x773c('0x34')]['hasOwnProperty'](_0x773c('0x3c'))){_0x9fba0e[_0x773c('0x3d')]=qs[_0x773c('0x3d')](_0x8110d5['query'][_0x773c('0x3d')]);_0x9fba0e[_0x773c('0x22')]=qs[_0x773c('0x22')](_0x8110d5[_0x773c('0x34')][_0x773c('0x22')]);}return _0x3cecd5[_0x773c('0x66')](_0x9fba0e);}})['then'](function(_0x375f4a){if(_0x375f4a){return _0x375f4a?{'count':_0x17ddcd,'rows':_0x375f4a}:null;}})[_0x773c('0x2a')](respondWithResult(_0x7570ae,null))['catch'](handleError(_0x7570ae,null));};exports[_0x773c('0x67')]=function(_0x577ad8,_0x446189,_0x41d76a){var _0x3f8cb8=_0x577ad8['body'][_0x773c('0x68')];return db[_0x773c('0x69')][_0x773c('0x46')]({'where':{'id':_0x3f8cb8},'attributes':['id'],'include':[{'model':db[_0x773c('0x5c')],'as':_0x773c('0x6a'),'attributes':['id',_0x773c('0x2c'),'online',_0x773c('0x6b'),_0x773c('0x6c')],'raw':!![]}]})['then'](function(_0x520d85){if(_0x520d85){var _0x5b314e=_['flatMap'](_0x520d85,function(_0x1a1789){var _0x4a12b2=_0x1a1789['get']({'plain':!![]});return _0x4a12b2[_0x773c('0x6a')];});return db[_0x773c('0x2e')][_0x773c('0x4c')]({'where':{'id':_0x577ad8['params']['id']}})[_0x773c('0x2a')](function(_0x5054d8){return db[_0x773c('0x6d')]['transaction'](function(_0x5a7a66){return _0x5054d8[_0x773c('0x67')](_0x3f8cb8,{'transaction':_0x5a7a66})[_0x773c('0x2a')](function(){return BPromise['each'](_0x5b314e,function(_0x2f9fec){return db[_0x773c('0x5a')][_0x773c('0x6e')]({'where':{'UserId':_0x2f9fec['id'],'OpenchannelQueueId':_0x577ad8['params']['id']},'transaction':_0x5a7a66});});})['then'](function(){_0x5b314e[_0x773c('0x6f')](function(_0x118684){socket[_0x773c('0x70')](_0x773c('0x71'),{'UserId':_0x118684['id'],'OpenchannelQueueId':_0x5054d8['id']});});});});});}})[_0x773c('0x2a')](respondWithStatusCode(_0x446189,null))[_0x773c('0x48')](handleError(_0x446189,null));};exports[_0x773c('0x72')]=function(_0x3bf438,_0x486372,_0x410261){return db[_0x773c('0x69')][_0x773c('0x46')]({'where':{'id':_0x3bf438['query'][_0x773c('0x68')]},'attributes':['id'],'include':[{'model':db[_0x773c('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x773c('0x2a')](handleEntityNotFound(_0x486372,null))[_0x773c('0x2a')](function(_0x1f2ce5){var _0x2d7303=_[_0x773c('0x33')](_0x1f2ce5,'id');var _0x436539=[];var _0xc85783=[];var _0x24fdd6=squel[_0x773c('0x73')]();_0x24fdd6[_0x773c('0x74')](_0x773c('0x75'))[_0x773c('0x76')](_0x773c('0x77'),'tq')['join'](_0x773c('0x78'),'ut',_0x773c('0x79'))[_0x773c('0x3f')]('OpenchannelQueueId\x20=\x20?',_0x3bf438[_0x773c('0x56')]['id']);for(var _0x2f9aee=0x0;_0x2f9aee<_0x1f2ce5[_0x773c('0x3a')];_0x2f9aee+=0x1){let _0x5a7676=_0x1f2ce5[_0x2f9aee];for(var _0x4eb874=0x0;_0x4eb874<_0x5a7676['Agents'][_0x773c('0x3a')];_0x4eb874+=0x1){let _0x45f927=_0x5a7676[_0x773c('0x6a')][_0x4eb874];var _0x2ab599=_0x24fdd6[_0x773c('0x7a')]();_0x2ab599['where'](_0x773c('0x7b'),_0x45f927['id']);_0xc85783[_0x773c('0x7c')](db[_0x773c('0x6d')][_0x773c('0x34')](_0x2ab599[_0x773c('0x7d')](),{'type':db[_0x773c('0x6d')][_0x773c('0x7e')]['SELECT']})['then'](function(_0x54cb5b){if(_0x54cb5b[_0x773c('0x3a')]===0x1){return _0x45f927['id'];}else{var _0x1f5386=_[_0x773c('0x7f')](_[_0x773c('0x33')](_0x54cb5b,'TeamId'),function(_0x6b0ba0){return _['includes'](_0x2d7303,_0x6b0ba0);});if(_0x1f5386){return _0x45f927['id'];}}}));}}return BPromise[_0x773c('0x80')](_0xc85783)[_0x773c('0x2a')](function(_0x59547b){_0x436539=_(_0x436539)[_0x773c('0x81')](_0x59547b)['compact']()[_0x773c('0x82')]();return db[_0x773c('0x2e')][_0x773c('0x4c')]({'where':{'id':_0x3bf438[_0x773c('0x56')]['id']}})['then'](function(_0x46148c){return db[_0x773c('0x6d')][_0x773c('0x83')](function(_0x40d374){return _0x46148c['removeTeams'](_0x3bf438[_0x773c('0x34')][_0x773c('0x68')],{'transaction':_0x40d374})[_0x773c('0x2a')](function(){if(!_[_0x773c('0x84')](_0x436539)){return _0x46148c[_0x773c('0x85')](_0x436539,{'transaction':_0x40d374});}})[_0x773c('0x2a')](function(){_0x436539[_0x773c('0x6f')](function(_0x1873cb){socket[_0x773c('0x70')](_0x773c('0x86'),{'UserId':_0x1873cb,'OpenchannelQueueId':_0x46148c['id']});});});});});});})['then'](respondWithStatusCode(_0x486372,null))['catch'](handleError(_0x486372,null));};exports['addAgents']=function(_0x4e0579,_0x424558,_0x30bbe3){return db[_0x773c('0x2e')][_0x773c('0x4c')]({'where':{'id':_0x4e0579[_0x773c('0x56')]['id']}})[_0x773c('0x2a')](handleEntityNotFound(_0x424558,null))['then'](function(_0x56571e){if(_0x56571e){return _0x56571e[_0x773c('0x87')](_0x4e0579['body']['ids'],_[_0x773c('0x88')](_0x4e0579[_0x773c('0x4e')],[_0x773c('0x68'),'id'])||{})[_0x773c('0x89')](function(_0x40bd49){for(var _0x2494e0=0x0;_0x2494e0<_0x4e0579[_0x773c('0x4e')][_0x773c('0x68')]['length'];_0x2494e0+=0x1){socket[_0x773c('0x70')]('userOpenchannelQueue:save',{'UserId':_0x4e0579[_0x773c('0x4e')][_0x773c('0x68')][_0x2494e0],'OpenchannelQueueId':_0x4e0579[_0x773c('0x56')]['id']});}return _0x40bd49;});}})['then'](respondWithResult(_0x424558,null))[_0x773c('0x48')](handleError(_0x424558,null));};exports[_0x773c('0x85')]=function(_0x348192,_0x424628,_0x3e47d8){return db[_0x773c('0x2e')]['find']({'where':{'id':_0x348192['params']['id']}})['then'](handleEntityNotFound(_0x424628,null))[_0x773c('0x2a')](function(_0x341613){if(_0x341613){return _0x341613[_0x773c('0x85')](_0x348192['query'][_0x773c('0x68')])[_0x773c('0x2a')](function(){if(_[_0x773c('0x8a')](_0x348192[_0x773c('0x34')]['ids'])){for(var _0x39ddb9=0x0;_0x39ddb9<_0x348192[_0x773c('0x34')][_0x773c('0x68')][_0x773c('0x3a')];_0x39ddb9+=0x1){socket[_0x773c('0x70')](_0x773c('0x86'),{'UserId':Number(_0x348192[_0x773c('0x34')][_0x773c('0x68')][_0x39ddb9]),'OpenchannelQueueId':Number(_0x348192[_0x773c('0x56')]['id'])});}}else{socket[_0x773c('0x70')]('userOpenchannelQueue:remove',{'UserId':Number(_0x348192[_0x773c('0x34')][_0x773c('0x68')]),'OpenchannelQueueId':Number(_0x348192[_0x773c('0x56')]['id'])});}});}})[_0x773c('0x2a')](respondWithStatusCode(_0x424628,null))['catch'](handleError(_0x424628,null));};exports['getAgents']=function(_0x26eb44,_0x21cc79,_0x216a6a){var _0x18da2d={};var _0x3d7d11={};var _0x2e0741;var _0x25b6ec;return db['OpenchannelQueue'][_0x773c('0x59')]({'where':{'id':_0x26eb44[_0x773c('0x56')]['id']}})[_0x773c('0x2a')](handleEntityNotFound(_0x21cc79,null))[_0x773c('0x2a')](function(_0x573f16){if(_0x573f16){_0x2e0741=_0x573f16;_0x3d7d11[_0x773c('0x32')]=_[_0x773c('0x35')](db[_0x773c('0x5c')]['rawAttributes']);_0x3d7d11[_0x773c('0x34')]=_[_0x773c('0x35')](_0x26eb44[_0x773c('0x34')]);_0x3d7d11[_0x773c('0x36')]=_[_0x773c('0x37')](_0x3d7d11['model'],_0x3d7d11['query']);_0x18da2d[_0x773c('0x38')]=_[_0x773c('0x37')](_0x3d7d11['model'],qs['fields'](_0x26eb44[_0x773c('0x34')]['fields']));_0x18da2d[_0x773c('0x38')]=_0x18da2d[_0x773c('0x38')][_0x773c('0x3a')]?_0x18da2d[_0x773c('0x38')]:_0x3d7d11[_0x773c('0x32')];_0x18da2d[_0x773c('0x3e')]=qs[_0x773c('0x5b')](_0x26eb44[_0x773c('0x34')][_0x773c('0x5b')]);_0x18da2d[_0x773c('0x3f')]=qs[_0x773c('0x36')](_['pick'](_0x26eb44[_0x773c('0x34')],_0x3d7d11[_0x773c('0x36')]));if(_0x26eb44[_0x773c('0x34')][_0x773c('0x41')]){_0x18da2d[_0x773c('0x3f')]=_[_0x773c('0x42')](_0x18da2d[_0x773c('0x3f')],{'$or':_[_0x773c('0x33')](_0x18da2d['attributes'],function(_0x50af26){var _0x3c5444={};_0x3c5444[_0x50af26]={'$like':'%'+_0x26eb44['query']['filter']+'%'};return _0x3c5444;})});}_0x18da2d=_[_0x773c('0x42')]({},_0x18da2d,_0x26eb44[_0x773c('0x43')]);return _0x2e0741[_0x773c('0x8b')](_0x18da2d);}})[_0x773c('0x2a')](function(_0x370252){if(_0x370252){_0x25b6ec=_0x370252[_0x773c('0x3a')];if(!_0x26eb44[_0x773c('0x34')][_0x773c('0x3b')]('nolimit')){_0x18da2d['limit']=qs['limit'](_0x26eb44[_0x773c('0x34')][_0x773c('0x3d')]);_0x18da2d[_0x773c('0x22')]=qs[_0x773c('0x22')](_0x26eb44[_0x773c('0x34')]['offset']);}return _0x2e0741[_0x773c('0x8b')](_0x18da2d);}})[_0x773c('0x2a')](function(_0x226f11){if(_0x226f11){return _0x226f11?{'count':_0x25b6ec,'rows':_0x226f11}:null;}})[_0x773c('0x2a')](respondWithResult(_0x21cc79,null))[_0x773c('0x48')](handleError(_0x21cc79,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 0642bb1..b4d518d 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 _0x56b8=['update','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save'];(function(_0x4c34ef,_0x3b438d){var _0x377846=function(_0x2d8741){while(--_0x2d8741){_0x4c34ef['push'](_0x4c34ef['shift']());}};_0x377846(++_0x3b438d);}(_0x56b8,0x12d));var _0x856b=function(_0x390bbe,_0x514843){_0x390bbe=_0x390bbe-0x0;var _0x5aaed0=_0x56b8[_0x390bbe];return _0x5aaed0;};'use strict';var EventEmitter=require(_0x856b('0x0'));var OpenchannelQueue=require(_0x856b('0x1'))['db'][_0x856b('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x856b('0x3')](0x0);var events={'afterCreate':_0x856b('0x4'),'afterUpdate':_0x856b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x509aef){return function(_0x3e7958,_0x489f5e,_0x334140){OpenchannelQueueEvents[_0x856b('0x6')](_0x509aef+':'+_0x3e7958['id'],_0x3e7958);OpenchannelQueueEvents[_0x856b('0x6')](_0x509aef,_0x3e7958);_0x334140(null);};}for(var e in events){if(events[_0x856b('0x7')](e)){var event=events[e];OpenchannelQueue[_0x856b('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x8735=['emit','hook','events','../../mysqldb','OpenchannelQueue','setMaxListeners','remove'];(function(_0x381372,_0xf0a5a){var _0x4e959a=function(_0x25a897){while(--_0x25a897){_0x381372['push'](_0x381372['shift']());}};_0x4e959a(++_0xf0a5a);}(_0x8735,0x1c9));var _0x5873=function(_0x1842ed,_0x40c0df){_0x1842ed=_0x1842ed-0x0;var _0x25282a=_0x8735[_0x1842ed];return _0x25282a;};'use strict';var EventEmitter=require(_0x5873('0x0'));var OpenchannelQueue=require(_0x5873('0x1'))['db'][_0x5873('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x5873('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5873('0x4')};function emitEvent(_0x2f29ea){return function(_0x494939,_0x5179ea,_0x388ca1){OpenchannelQueueEvents[_0x5873('0x5')](_0x2f29ea+':'+_0x494939['id'],_0x494939);OpenchannelQueueEvents[_0x5873('0x5')](_0x2f29ea,_0x494939);_0x388ca1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x5873('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 96f1fde..1a02a52 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 _0x809a=['../../config/logger','api','moment','./openchannelQueue.attributes','define','openchannel_queues','lodash','util'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x809a,0x186));var _0xa809=function(_0x3fbb29,_0x6372e5){_0x3fbb29=_0x3fbb29-0x0;var _0x4a9526=_0x809a[_0x3fbb29];return _0x4a9526;};'use strict';var _=require(_0xa809('0x0'));var util=require(_0xa809('0x1'));var logger=require(_0xa809('0x2'))(_0xa809('0x3'));var moment=require(_0xa809('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa809('0x5'));module['exports']=function(_0x2c6237,_0x4a161d){return _0x2c6237[_0xa809('0x6')]('OpenchannelQueue',attributes,{'tableName':_0xa809('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4522=['OpenchannelQueue','openchannel_queues','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define'];(function(_0x28ce43,_0x5b3962){var _0x14cbcb=function(_0x39b5f9){while(--_0x39b5f9){_0x28ce43['push'](_0x28ce43['shift']());}};_0x14cbcb(++_0x5b3962);}(_0x4522,0x9e));var _0x2452=function(_0x5614e8,_0x348b59){_0x5614e8=_0x5614e8-0x0;var _0x431f50=_0x4522[_0x5614e8];return _0x431f50;};'use strict';var _=require('lodash');var util=require(_0x2452('0x0'));var logger=require(_0x2452('0x1'))(_0x2452('0x2'));var moment=require(_0x2452('0x3'));var BPromise=require('bluebird');var rp=require(_0x2452('0x4'));var fs=require('fs');var path=require(_0x2452('0x5'));var rimraf=require(_0x2452('0x6'));var config=require(_0x2452('0x7'));var attributes=require(_0x2452('0x8'));module[_0x2452('0x9')]=function(_0x1843ef,_0x251326){return _0x1843ef[_0x2452('0xa')](_0x2452('0xb'),attributes,{'tableName':_0x2452('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index e6d67bd..b4fbd3f 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 _0x8605=['info','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./openchannelQueue.socket','register','then','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetOpenchannelQueue','options','where','attributes','limit','include','map','model','ShowOpenchannelQueue','OpenchannelQueue','find','raw'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x8605,0x1c9));var _0x5860=function(_0x574a7e,_0x17f2cb){_0x574a7e=_0x574a7e-0x0;var _0x116ffd=_0x8605[_0x574a7e];return _0x116ffd;};'use strict';var _=require(_0x5860('0x0'));var util=require(_0x5860('0x1'));var moment=require(_0x5860('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5860('0x3'));var db=require(_0x5860('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5860('0x5'))('rpc');var config=require(_0x5860('0x6'));var jayson=require(_0x5860('0x7'));var client=jayson[_0x5860('0x8')][_0x5860('0x9')]({'port':0x232a});config['redis']=_[_0x5860('0xa')](config[_0x5860('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x5860('0xc'))(new Redis(config[_0x5860('0xb')]));require(_0x5860('0xd'))[_0x5860('0xe')](socket);function respondWithRpcPromise(_0x123dab,_0x25c1d3,_0x2ae9f5){return new BPromise(function(_0x441184,_0x3bb227){return client['request'](_0x123dab,_0x2ae9f5)[_0x5860('0xf')](function(_0x4b1678){logger['info'](_0x5860('0x10'),_0x25c1d3,'request\x20sent');logger[_0x5860('0x11')](_0x5860('0x12'),_0x25c1d3,_0x5860('0x13'),JSON[_0x5860('0x14')](_0x4b1678));if(_0x4b1678[_0x5860('0x15')]){if(_0x4b1678[_0x5860('0x15')][_0x5860('0x16')]===0x1f4){logger[_0x5860('0x15')](_0x5860('0x10'),_0x25c1d3,_0x4b1678[_0x5860('0x15')]['message']);return _0x3bb227(_0x4b1678['error']['message']);}logger['error'](_0x5860('0x10'),_0x25c1d3,_0x4b1678[_0x5860('0x15')][_0x5860('0x17')]);return _0x441184(_0x4b1678[_0x5860('0x15')][_0x5860('0x17')]);}else{logger['info'](_0x5860('0x10'),_0x25c1d3,_0x5860('0x13'));_0x441184(_0x4b1678['result']['message']);}})[_0x5860('0x18')](function(_0x11b4ea){logger[_0x5860('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x25c1d3,_0x11b4ea);_0x3bb227(_0x11b4ea);});});}exports[_0x5860('0x19')]=function(_0x568003){var _0x291421=this;return new Promise(function(_0x23167b,_0x1371d6){return db['OpenchannelQueue']['findAll']({'raw':_0x568003['options']?_0x568003['options']['raw']===undefined?!![]:![]:!![],'where':_0x568003[_0x5860('0x1a')]?_0x568003[_0x5860('0x1a')][_0x5860('0x1b')]||null:null,'attributes':_0x568003[_0x5860('0x1a')]?_0x568003[_0x5860('0x1a')][_0x5860('0x1c')]||null:null,'limit':_0x568003['options']?_0x568003['options'][_0x5860('0x1d')]||null:null,'include':_0x568003[_0x5860('0x1a')]?_0x568003[_0x5860('0x1a')][_0x5860('0x1e')]?_[_0x5860('0x1f')](_0x568003[_0x5860('0x1a')]['include'],function(_0x19320c){return{'model':db[_0x19320c[_0x5860('0x20')]],'as':_0x19320c['as'],'attributes':_0x19320c[_0x5860('0x1c')],'include':_0x19320c[_0x5860('0x1e')]?_[_0x5860('0x1f')](_0x19320c[_0x5860('0x1e')],function(_0x1b1942){return{'model':db[_0x1b1942['model']],'as':_0x1b1942['as'],'attributes':_0x1b1942['attributes'],'include':_0x1b1942[_0x5860('0x1e')]?_[_0x5860('0x1f')](_0x1b1942[_0x5860('0x1e')],function(_0x14be98){return{'model':db[_0x14be98['model']],'as':_0x14be98['as'],'attributes':_0x14be98['attributes']};}):[]};}):[]};}):[]:[]})[_0x5860('0xf')](function(_0x2ce30d){logger['info'](_0x5860('0x19'),_0x568003);logger[_0x5860('0x11')](_0x5860('0x19'),_0x568003,JSON[_0x5860('0x14')](_0x2ce30d));_0x23167b(_0x2ce30d);})[_0x5860('0x18')](function(_0x56743d){logger[_0x5860('0x15')](_0x5860('0x19'),_0x56743d[_0x5860('0x17')],_0x568003);_0x1371d6(_0x291421[_0x5860('0x15')](0x1f4,_0x56743d[_0x5860('0x17')]));});});};exports[_0x5860('0x21')]=function(_0x105132){var _0x57eb43=this;return new Promise(function(_0x5acb59,_0x46a7d9){return db[_0x5860('0x22')][_0x5860('0x23')]({'raw':_0x105132[_0x5860('0x1a')]?_0x105132[_0x5860('0x1a')][_0x5860('0x24')]===undefined?!![]:![]:!![],'where':_0x105132[_0x5860('0x1a')]?_0x105132['options'][_0x5860('0x1b')]||null:null,'attributes':_0x105132['options']?_0x105132[_0x5860('0x1a')][_0x5860('0x1c')]||null:null,'include':_0x105132['options']?_0x105132[_0x5860('0x1a')][_0x5860('0x1e')]?_['map'](_0x105132[_0x5860('0x1a')][_0x5860('0x1e')],function(_0x252d51){return{'model':db[_0x252d51[_0x5860('0x20')]],'as':_0x252d51['as'],'attributes':_0x252d51[_0x5860('0x1c')],'include':_0x252d51[_0x5860('0x1e')]?_[_0x5860('0x1f')](_0x252d51[_0x5860('0x1e')],function(_0x44f6a9){return{'model':db[_0x44f6a9[_0x5860('0x20')]],'as':_0x44f6a9['as'],'attributes':_0x44f6a9[_0x5860('0x1c')],'include':_0x44f6a9[_0x5860('0x1e')]?_[_0x5860('0x1f')](_0x44f6a9[_0x5860('0x1e')],function(_0x1681a0){return{'model':db[_0x1681a0[_0x5860('0x20')]],'as':_0x1681a0['as'],'attributes':_0x1681a0[_0x5860('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5860('0xf')](function(_0x20939b){logger[_0x5860('0x25')](_0x5860('0x21'),_0x105132);logger[_0x5860('0x11')]('ShowOpenchannelQueue',_0x105132,JSON[_0x5860('0x14')](_0x20939b));_0x5acb59(_0x20939b);})[_0x5860('0x18')](function(_0x4bc70c){logger[_0x5860('0x15')]('ShowOpenchannelQueue',_0x4bc70c[_0x5860('0x17')],_0x105132);_0x46a7d9(_0x57eb43[_0x5860('0x15')](0x1f4,_0x4bc70c[_0x5860('0x17')]));});});}; \ No newline at end of file +var _0xbd6b=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','socket.io-emitter','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelQueue','findAll','options','attributes','limit','map','model','include','GetOpenchannelQueue','debug','find','raw','where','ShowOpenchannelQueue','moment','bluebird'];(function(_0x306412,_0x3fbd0b){var _0x47cf3f=function(_0xbb3cee){while(--_0xbb3cee){_0x306412['push'](_0x306412['shift']());}};_0x47cf3f(++_0x3fbd0b);}(_0xbd6b,0xc1));var _0xbbd6=function(_0x119a2a,_0x52a94f){_0x119a2a=_0x119a2a-0x0;var _0x22d268=_0xbd6b[_0x119a2a];return _0x22d268;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbbd6('0x0'));var BPromise=require(_0xbbd6('0x1'));var rs=require(_0xbbd6('0x2'));var fs=require('fs');var Redis=require(_0xbbd6('0x3'));var db=require(_0xbbd6('0x4'))['db'];var utils=require(_0xbbd6('0x5'));var logger=require(_0xbbd6('0x6'))('rpc');var config=require(_0xbbd6('0x7'));var jayson=require(_0xbbd6('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xbbd6('0x9')]=_['defaults'](config[_0xbbd6('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xbbd6('0xa'))(new Redis(config[_0xbbd6('0x9')]));require(_0xbbd6('0xb'))[_0xbbd6('0xc')](socket);function respondWithRpcPromise(_0x55ec93,_0x48b0b6,_0x4e75d5){return new BPromise(function(_0x5bd165,_0x179d54){return client[_0xbbd6('0xd')](_0x55ec93,_0x4e75d5)[_0xbbd6('0xe')](function(_0x366ca6){logger['info'](_0xbbd6('0xf'),_0x48b0b6,'request\x20sent');logger['debug'](_0xbbd6('0x10'),_0x48b0b6,_0xbbd6('0x11'),JSON[_0xbbd6('0x12')](_0x366ca6));if(_0x366ca6[_0xbbd6('0x13')]){if(_0x366ca6[_0xbbd6('0x13')][_0xbbd6('0x14')]===0x1f4){logger[_0xbbd6('0x13')](_0xbbd6('0xf'),_0x48b0b6,_0x366ca6[_0xbbd6('0x13')]['message']);return _0x179d54(_0x366ca6['error'][_0xbbd6('0x15')]);}logger['error'](_0xbbd6('0xf'),_0x48b0b6,_0x366ca6[_0xbbd6('0x13')][_0xbbd6('0x15')]);return _0x5bd165(_0x366ca6[_0xbbd6('0x13')][_0xbbd6('0x15')]);}else{logger[_0xbbd6('0x16')](_0xbbd6('0xf'),_0x48b0b6,_0xbbd6('0x11'));_0x5bd165(_0x366ca6[_0xbbd6('0x17')][_0xbbd6('0x15')]);}})[_0xbbd6('0x18')](function(_0x3722aa){logger[_0xbbd6('0x13')](_0xbbd6('0xf'),_0x48b0b6,_0x3722aa);_0x179d54(_0x3722aa);});});}exports['GetOpenchannelQueue']=function(_0x38f885){var _0x2ed1f0=this;return new Promise(function(_0xdae7c4,_0x5942ab){return db[_0xbbd6('0x19')][_0xbbd6('0x1a')]({'raw':_0x38f885[_0xbbd6('0x1b')]?_0x38f885[_0xbbd6('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x38f885['options']?_0x38f885['options']['where']||null:null,'attributes':_0x38f885[_0xbbd6('0x1b')]?_0x38f885[_0xbbd6('0x1b')][_0xbbd6('0x1c')]||null:null,'limit':_0x38f885[_0xbbd6('0x1b')]?_0x38f885[_0xbbd6('0x1b')][_0xbbd6('0x1d')]||null:null,'include':_0x38f885[_0xbbd6('0x1b')]?_0x38f885['options']['include']?_[_0xbbd6('0x1e')](_0x38f885['options']['include'],function(_0x4614e8){return{'model':db[_0x4614e8[_0xbbd6('0x1f')]],'as':_0x4614e8['as'],'attributes':_0x4614e8['attributes'],'include':_0x4614e8[_0xbbd6('0x20')]?_[_0xbbd6('0x1e')](_0x4614e8['include'],function(_0x2207f4){return{'model':db[_0x2207f4[_0xbbd6('0x1f')]],'as':_0x2207f4['as'],'attributes':_0x2207f4[_0xbbd6('0x1c')],'include':_0x2207f4[_0xbbd6('0x20')]?_[_0xbbd6('0x1e')](_0x2207f4[_0xbbd6('0x20')],function(_0x315960){return{'model':db[_0x315960[_0xbbd6('0x1f')]],'as':_0x315960['as'],'attributes':_0x315960[_0xbbd6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbbd6('0xe')](function(_0x24a5bf){logger[_0xbbd6('0x16')](_0xbbd6('0x21'),_0x38f885);logger[_0xbbd6('0x22')](_0xbbd6('0x21'),_0x38f885,JSON['stringify'](_0x24a5bf));_0xdae7c4(_0x24a5bf);})[_0xbbd6('0x18')](function(_0x5ce365){logger['error'](_0xbbd6('0x21'),_0x5ce365['message'],_0x38f885);_0x5942ab(_0x2ed1f0[_0xbbd6('0x13')](0x1f4,_0x5ce365[_0xbbd6('0x15')]));});});};exports['ShowOpenchannelQueue']=function(_0x4b526b){var _0x173cdd=this;return new Promise(function(_0x377363,_0x39bfb1){return db[_0xbbd6('0x19')][_0xbbd6('0x23')]({'raw':_0x4b526b[_0xbbd6('0x1b')]?_0x4b526b['options'][_0xbbd6('0x24')]===undefined?!![]:![]:!![],'where':_0x4b526b['options']?_0x4b526b[_0xbbd6('0x1b')][_0xbbd6('0x25')]||null:null,'attributes':_0x4b526b['options']?_0x4b526b[_0xbbd6('0x1b')][_0xbbd6('0x1c')]||null:null,'include':_0x4b526b['options']?_0x4b526b[_0xbbd6('0x1b')][_0xbbd6('0x20')]?_[_0xbbd6('0x1e')](_0x4b526b[_0xbbd6('0x1b')][_0xbbd6('0x20')],function(_0x1aeb31){return{'model':db[_0x1aeb31[_0xbbd6('0x1f')]],'as':_0x1aeb31['as'],'attributes':_0x1aeb31['attributes'],'include':_0x1aeb31[_0xbbd6('0x20')]?_[_0xbbd6('0x1e')](_0x1aeb31[_0xbbd6('0x20')],function(_0x1c8fef){return{'model':db[_0x1c8fef[_0xbbd6('0x1f')]],'as':_0x1c8fef['as'],'attributes':_0x1c8fef[_0xbbd6('0x1c')],'include':_0x1c8fef[_0xbbd6('0x20')]?_['map'](_0x1c8fef['include'],function(_0x4119e0){return{'model':db[_0x4119e0[_0xbbd6('0x1f')]],'as':_0x4119e0['as'],'attributes':_0x4119e0[_0xbbd6('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a3f26){logger[_0xbbd6('0x16')]('ShowOpenchannelQueue',_0x4b526b);logger[_0xbbd6('0x22')](_0xbbd6('0x26'),_0x4b526b,JSON[_0xbbd6('0x12')](_0x5a3f26));_0x377363(_0x5a3f26);})['catch'](function(_0x3ec2b4){logger[_0xbbd6('0x13')](_0xbbd6('0x26'),_0x3ec2b4[_0xbbd6('0x15')],_0x4b526b);_0x39bfb1(_0x173cdd[_0xbbd6('0x13')](0x1f4,_0x3ec2b4[_0xbbd6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index cec7487..0f8ee1e 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 _0x8c38=['remove','update','register','length','openchannelQueue:','./openchannelQueue.events'];(function(_0x51f89a,_0x31ab06){var _0x29de14=function(_0x10dbc3){while(--_0x10dbc3){_0x51f89a['push'](_0x51f89a['shift']());}};_0x29de14(++_0x31ab06);}(_0x8c38,0x16d));var _0x88c3=function(_0x1befd9,_0xb45d42){_0x1befd9=_0x1befd9-0x0;var _0xf26749=_0x8c38[_0x1befd9];return _0xf26749;};'use strict';var OpenchannelQueueEvents=require(_0x88c3('0x0'));var events=['save',_0x88c3('0x1'),_0x88c3('0x2')];function createListener(_0xeadc80,_0x342185){return function(_0x46fe42){_0x342185['emit'](_0xeadc80,_0x46fe42);};}function removeListener(_0x157028,_0x2ba457){return function(){OpenchannelQueueEvents['removeListener'](_0x157028,_0x2ba457);};}exports[_0x88c3('0x3')]=function(_0x5284cc){for(var _0x4828e5=0x0,_0x3c84f0=events[_0x88c3('0x4')];_0x4828e5<_0x3c84f0;_0x4828e5++){var _0x59a12f=events[_0x4828e5];var _0x5a86d7=createListener(_0x88c3('0x5')+_0x59a12f,_0x5284cc);OpenchannelQueueEvents['on'](_0x59a12f,_0x5a86d7);}}; \ No newline at end of file +var _0x91a9=['update','register','openchannelQueue:','./openchannelQueue.events'];(function(_0x21cee1,_0xd8683){var _0x48f04c=function(_0x15c6f9){while(--_0x15c6f9){_0x21cee1['push'](_0x21cee1['shift']());}};_0x48f04c(++_0xd8683);}(_0x91a9,0x183));var _0x991a=function(_0x297889,_0x3d0c4e){_0x297889=_0x297889-0x0;var _0x531d5e=_0x91a9[_0x297889];return _0x531d5e;};'use strict';var OpenchannelQueueEvents=require(_0x991a('0x0'));var events=['save','remove',_0x991a('0x1')];function createListener(_0x1e6b7f,_0x422e96){return function(_0x8b7200){_0x422e96['emit'](_0x1e6b7f,_0x8b7200);};}function removeListener(_0x55b541,_0x34bb16){return function(){OpenchannelQueueEvents['removeListener'](_0x55b541,_0x34bb16);};}exports[_0x991a('0x2')]=function(_0x1edb14){for(var _0x353f05=0x0,_0x3b2fa9=events['length'];_0x353f05<_0x3b2fa9;_0x353f05++){var _0xb4c656=events[_0x353f05];var _0x59a8dd=createListener(_0x991a('0x3')+_0xb4c656,_0x1edb14);OpenchannelQueueEvents['on'](_0xb4c656,_0x59a8dd);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index e98adf6..b3d5b85 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 _0xc614=['post','create','put','/:id','delete','destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','show'];(function(_0x467e24,_0x299d23){var _0x243a62=function(_0x4ab55c){while(--_0x4ab55c){_0x467e24['push'](_0x467e24['shift']());}};_0x243a62(++_0x299d23);}(_0xc614,0xfe));var _0x4c61=function(_0x2f1a23,_0x120632){_0x2f1a23=_0x2f1a23-0x0;var _0x3a12b5=_0xc614[_0x2f1a23];return _0x3a12b5;};'use strict';var multer=require(_0x4c61('0x0'));var util=require('util');var path=require(_0x4c61('0x1'));var timeout=require('connect-timeout');var express=require(_0x4c61('0x2'));var router=express['Router']();var auth=require(_0x4c61('0x3'));var interaction=require(_0x4c61('0x4'));var config=require(_0x4c61('0x5'));var controller=require(_0x4c61('0x6'));router[_0x4c61('0x7')]('/',auth[_0x4c61('0x8')](),controller[_0x4c61('0x9')]);router['get'](_0x4c61('0xa'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x4c61('0x8')](),controller[_0x4c61('0xb')]);router[_0x4c61('0xc')]('/',auth[_0x4c61('0x8')](),controller[_0x4c61('0xd')]);router[_0x4c61('0xe')](_0x4c61('0xf'),auth[_0x4c61('0x8')](),controller['update']);router[_0x4c61('0x10')](_0x4c61('0xf'),auth[_0x4c61('0x8')](),controller[_0x4c61('0x11')]);module[_0x4c61('0x12')]=router; \ No newline at end of file +var _0x87b6=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2a086e,_0x304033){var _0x1ff462=function(_0x1220a8){while(--_0x1220a8){_0x2a086e['push'](_0x2a086e['shift']());}};_0x1ff462(++_0x304033);}(_0x87b6,0x81));var _0x687b=function(_0x22a81b,_0x51edff){_0x22a81b=_0x22a81b-0x0;var _0x4540aa=_0x87b6[_0x22a81b];return _0x4540aa;};'use strict';var multer=require(_0x687b('0x0'));var util=require(_0x687b('0x1'));var path=require(_0x687b('0x2'));var timeout=require(_0x687b('0x3'));var express=require(_0x687b('0x4'));var router=express[_0x687b('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x687b('0x6'));var config=require(_0x687b('0x7'));var controller=require(_0x687b('0x8'));router['get']('/',auth[_0x687b('0x9')](),controller[_0x687b('0xa')]);router[_0x687b('0xb')](_0x687b('0xc'),auth['isAuthenticated'](),controller[_0x687b('0xd')]);router[_0x687b('0xb')](_0x687b('0xe'),auth['isAuthenticated'](),controller[_0x687b('0xf')]);router['post']('/',auth[_0x687b('0x9')](),controller[_0x687b('0x10')]);router[_0x687b('0x11')](_0x687b('0xe'),auth[_0x687b('0x9')](),controller[_0x687b('0x12')]);router[_0x687b('0x13')](_0x687b('0xe'),auth[_0x687b('0x9')](),controller[_0x687b('0x14')]);module[_0x687b('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 3090c69..d1df570 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 _0x439d=['STRING','DATE'];(function(_0x415e9e,_0x45cb1c){var _0x49f61c=function(_0x53e700){while(--_0x53e700){_0x415e9e['push'](_0x415e9e['shift']());}};_0x49f61c(++_0x45cb1c);}(_0x439d,0xb0));var _0xd439=function(_0x429003,_0x3508da){_0x429003=_0x429003-0x0;var _0x3cc0d9=_0x439d[_0x429003];return _0x3cc0d9;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xd439('0x0')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd439('0x1')]},'acceptAt':{'type':Sequelize[_0xd439('0x1')]},'exitAt':{'type':Sequelize[_0xd439('0x1')]},'reason':{'type':Sequelize[_0xd439('0x0')]}}; \ No newline at end of file +var _0x0b5c=['DATE','moment','exports','STRING'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x0b5c,0x1d5));var _0xc0b5=function(_0x531e85,_0x4c5f38){_0x531e85=_0x531e85-0x0;var _0x197b70=_0x0b5c[_0x531e85];return _0x197b70;};'use strict';var moment=require(_0xc0b5('0x0'));var Sequelize=require('sequelize');module[_0xc0b5('0x1')]={'uniqueid':{'type':Sequelize[_0xc0b5('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xc0b5('0x2')]},'joinAt':{'type':Sequelize[_0xc0b5('0x3')]},'leaveAt':{'type':Sequelize[_0xc0b5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xc0b5('0x3')]},'reason':{'type':Sequelize[_0xc0b5('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index ce0d8b7..47e132e 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 _0x0b78=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','fields','attributes','hasOwnProperty','limit','order','sort','pick','filters','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','intersection','length','find','create','body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x497559,_0x470d32){var _0x21f316=function(_0x3ff15f){while(--_0x3ff15f){_0x497559['push'](_0x497559['shift']());}};_0x21f316(++_0x470d32);}(_0x0b78,0x1ad));var _0x80b7=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x0b78[_0x40a045];return _0x1a687c;};'use strict';var pdf=require(_0x80b7('0x0'));var emlformat=require(_0x80b7('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x80b7('0x2'));var jsonpatch=require(_0x80b7('0x3'));var rp=require('request-promise');var moment=require(_0x80b7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x80b7('0x5'));var util=require(_0x80b7('0x6'));var path=require(_0x80b7('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x80b7('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x80b7('0x9'));var crypto=require(_0x80b7('0xa'));var jsforce=require(_0x80b7('0xb'));var deskjs=require(_0x80b7('0xc'));var toCsv=require('to-csv');var querystring=require(_0x80b7('0xd'));var Papa=require(_0x80b7('0xe'));var Redis=require(_0x80b7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x80b7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x80b7('0x11'));var logger=require(_0x80b7('0x12'))(_0x80b7('0x13'));var utils=require(_0x80b7('0x14'));var config=require(_0x80b7('0x15'));var licenseUtil=require(_0x80b7('0x16'));var db=require(_0x80b7('0x17'))['db'];function respondWithStatusCode(_0x145241,_0x323d06){_0x323d06=_0x323d06||0xcc;return function(_0x366e34){if(_0x366e34){return _0x145241[_0x80b7('0x18')](_0x323d06);}return _0x145241['status'](_0x323d06)[_0x80b7('0x19')]();};}function respondWithResult(_0x401ad3,_0x527c5b){_0x527c5b=_0x527c5b||0xc8;return function(_0x2ee168){if(_0x2ee168){return _0x401ad3[_0x80b7('0x1a')](_0x527c5b)['json'](_0x2ee168);}};}function respondWithFilteredResult(_0x46822c,_0x3b6b13){return function(_0x21ea65){if(_0x21ea65){var _0x2c0c4e=_0x21ea65[_0x80b7('0x1b')],_0x36d0bb=_0x3b6b13[_0x80b7('0x1c')],_0x352805=_0x3b6b13[_0x80b7('0x1c')]+_0x3b6b13['limit'],_0x1e3d1c;if(_0x352805>=_0x2c0c4e){_0x352805=_0x2c0c4e;_0x1e3d1c=0xc8;}else{_0x1e3d1c=0xce;}_0x46822c[_0x80b7('0x1a')](_0x1e3d1c);return _0x46822c[_0x80b7('0x1d')](_0x80b7('0x1e'),_0x36d0bb+'-'+_0x352805+'/'+_0x2c0c4e)[_0x80b7('0x1f')](_0x21ea65);}return null;};}function patchUpdates(_0x58dbda){return function(_0x48c356){try{jsonpatch[_0x80b7('0x20')](_0x48c356,_0x58dbda,!![]);}catch(_0x1e27aa){return BPromise[_0x80b7('0x21')](_0x1e27aa);}return _0x48c356[_0x80b7('0x22')]();};}function saveUpdates(_0x574e5c,_0x4f6eec){return function(_0x2aebe3){if(_0x2aebe3){return _0x2aebe3[_0x80b7('0x23')](_0x574e5c)[_0x80b7('0x24')](function(_0x3ad8c1){return _0x3ad8c1;});}return null;};}function removeEntity(_0x527d0f,_0x18d407){return function(_0x4c3bed){if(_0x4c3bed){return _0x4c3bed['destroy']()[_0x80b7('0x24')](function(){_0x527d0f[_0x80b7('0x1a')](0xcc)[_0x80b7('0x19')]();});}};}function handleEntityNotFound(_0x155c00,_0x3f3aa5){return function(_0x3a029b){if(!_0x3a029b){_0x155c00[_0x80b7('0x18')](0x194);}return _0x3a029b;};}function handleError(_0x8fa95e,_0x375f10){_0x375f10=_0x375f10||0x1f4;return function(_0x1e751a){logger[_0x80b7('0x25')](_0x1e751a[_0x80b7('0x26')]);if(_0x1e751a[_0x80b7('0x27')]){delete _0x1e751a[_0x80b7('0x27')];}_0x8fa95e[_0x80b7('0x1a')](_0x375f10)['send'](_0x1e751a);};}exports[_0x80b7('0x28')]=function(_0x1661be,_0x5e3f6f){var _0x370bfb={},_0x37fda1={},_0x17d845={'count':0x0,'rows':[]};var _0x5497e2=_[_0x80b7('0x29')](db[_0x80b7('0x2a')][_0x80b7('0x2b')],function(_0x30cd74){return{'name':_0x30cd74[_0x80b7('0x2c')],'type':_0x30cd74[_0x80b7('0x2d')][_0x80b7('0x2e')]};});_0x37fda1[_0x80b7('0x2f')]=_[_0x80b7('0x29')](_0x5497e2,_0x80b7('0x27'));_0x37fda1[_0x80b7('0x30')]=_[_0x80b7('0x31')](_0x1661be[_0x80b7('0x30')]);_0x37fda1['filters']=_['intersection'](_0x37fda1[_0x80b7('0x2f')],_0x37fda1[_0x80b7('0x30')]);_0x370bfb['attributes']=_['intersection'](_0x37fda1[_0x80b7('0x2f')],qs[_0x80b7('0x32')](_0x1661be[_0x80b7('0x30')][_0x80b7('0x32')]));_0x370bfb[_0x80b7('0x33')]=_0x370bfb[_0x80b7('0x33')]['length']?_0x370bfb[_0x80b7('0x33')]:_0x37fda1[_0x80b7('0x2f')];if(!_0x1661be[_0x80b7('0x30')][_0x80b7('0x34')]('nolimit')){_0x370bfb[_0x80b7('0x35')]=qs[_0x80b7('0x35')](_0x1661be['query'][_0x80b7('0x35')]);_0x370bfb[_0x80b7('0x1c')]=qs[_0x80b7('0x1c')](_0x1661be[_0x80b7('0x30')][_0x80b7('0x1c')]);}_0x370bfb[_0x80b7('0x36')]=qs[_0x80b7('0x37')](_0x1661be[_0x80b7('0x30')]['sort']);_0x370bfb['where']=qs['filters'](_[_0x80b7('0x38')](_0x1661be[_0x80b7('0x30')],_0x37fda1[_0x80b7('0x39')]),_0x5497e2);if(_0x1661be[_0x80b7('0x30')][_0x80b7('0x3a')]){_0x370bfb[_0x80b7('0x3b')]=_[_0x80b7('0x3c')](_0x370bfb[_0x80b7('0x3b')],{'$or':_['map'](_0x5497e2,function(_0x2a34eb){if(_0x2a34eb[_0x80b7('0x2d')]!==_0x80b7('0x3d')){var _0x44acf2={};_0x44acf2[_0x2a34eb[_0x80b7('0x27')]]={'$like':'%'+_0x1661be[_0x80b7('0x30')]['filter']+'%'};return _0x44acf2;}})});}_0x370bfb=_[_0x80b7('0x3c')]({},_0x370bfb,_0x1661be['options']);var _0x9ab5e6={'where':_0x370bfb[_0x80b7('0x3b')]};return db['OpenchannelQueueReport']['count'](_0x9ab5e6)[_0x80b7('0x24')](function(_0x5e21eb){_0x17d845['count']=_0x5e21eb;if(_0x1661be[_0x80b7('0x30')][_0x80b7('0x3e')]){_0x370bfb['include']=[{'all':!![]}];}return db[_0x80b7('0x2a')][_0x80b7('0x3f')](_0x370bfb);})['then'](function(_0x59e0c4){_0x17d845[_0x80b7('0x40')]=_0x59e0c4;return _0x17d845;})[_0x80b7('0x24')](respondWithFilteredResult(_0x5e3f6f,_0x370bfb))[_0x80b7('0x41')](handleError(_0x5e3f6f,null));};exports[_0x80b7('0x42')]=function(_0x213c0a,_0x21d4f2){var _0x57fcbf={'raw':!![],'where':{'id':_0x213c0a[_0x80b7('0x43')]['id']}},_0x1c28d2={};_0x1c28d2[_0x80b7('0x2f')]=_[_0x80b7('0x31')](db['OpenchannelQueueReport'][_0x80b7('0x2b')]);_0x1c28d2['query']=_[_0x80b7('0x31')](_0x213c0a[_0x80b7('0x30')]);_0x1c28d2[_0x80b7('0x39')]=_[_0x80b7('0x44')](_0x1c28d2[_0x80b7('0x2f')],_0x1c28d2[_0x80b7('0x30')]);_0x57fcbf[_0x80b7('0x33')]=_[_0x80b7('0x44')](_0x1c28d2[_0x80b7('0x2f')],qs[_0x80b7('0x32')](_0x213c0a[_0x80b7('0x30')][_0x80b7('0x32')]));_0x57fcbf[_0x80b7('0x33')]=_0x57fcbf['attributes'][_0x80b7('0x45')]?_0x57fcbf[_0x80b7('0x33')]:_0x1c28d2['model'];if(_0x213c0a[_0x80b7('0x30')]['includeAll']){_0x57fcbf['include']=[{'all':!![]}];}_0x57fcbf=_[_0x80b7('0x3c')]({},_0x57fcbf,_0x213c0a['options']);return db['OpenchannelQueueReport'][_0x80b7('0x46')](_0x57fcbf)[_0x80b7('0x24')](handleEntityNotFound(_0x21d4f2,null))['then'](respondWithResult(_0x21d4f2,null))[_0x80b7('0x41')](handleError(_0x21d4f2,null));};exports[_0x80b7('0x47')]=function(_0x226c20,_0x5455a5){return db[_0x80b7('0x2a')][_0x80b7('0x47')](_0x226c20[_0x80b7('0x48')],{})[_0x80b7('0x24')](respondWithResult(_0x5455a5,0xc9))['catch'](handleError(_0x5455a5,null));};exports['update']=function(_0x5417b9,_0x1ee2f9){if(_0x5417b9[_0x80b7('0x48')]['id']){delete _0x5417b9[_0x80b7('0x48')]['id'];}return db[_0x80b7('0x2a')][_0x80b7('0x46')]({'where':{'id':_0x5417b9[_0x80b7('0x43')]['id']}})[_0x80b7('0x24')](handleEntityNotFound(_0x1ee2f9,null))[_0x80b7('0x24')](saveUpdates(_0x5417b9['body'],null))['then'](respondWithResult(_0x1ee2f9,null))[_0x80b7('0x41')](handleError(_0x1ee2f9,null));};exports[_0x80b7('0x49')]=function(_0x3d01c6,_0x2d9168){return db[_0x80b7('0x2a')][_0x80b7('0x46')]({'where':{'id':_0x3d01c6['params']['id']}})[_0x80b7('0x24')](handleEntityNotFound(_0x2d9168,null))[_0x80b7('0x24')](removeEntity(_0x2d9168,null))['catch'](handleError(_0x2d9168,null));};exports[_0x80b7('0x4a')]=function(_0x40b524,_0xc5e5a4){return db['OpenchannelQueueReport']['describe']()[_0x80b7('0x24')](respondWithResult(_0xc5e5a4,null))[_0x80b7('0x41')](handleError(_0xc5e5a4,null));}; \ No newline at end of file +var _0xa4fb=['sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','send','index','OpenchannelQueueReport','fieldName','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xa4fb,0x150));var _0xba4f=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0xa4fb[_0x349367];return _0x14179b;};'use strict';var pdf=require(_0xba4f('0x0'));var emlformat=require(_0xba4f('0x1'));var rimraf=require(_0xba4f('0x2'));var zipdir=require(_0xba4f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xba4f('0x4'));var BPromise=require(_0xba4f('0x5'));var Mustache=require(_0xba4f('0x6'));var util=require('util');var path=require(_0xba4f('0x7'));var sox=require(_0xba4f('0x8'));var csv=require(_0xba4f('0x9'));var ejs=require(_0xba4f('0xa'));var fs=require('fs');var _=require(_0xba4f('0xb'));var squel=require(_0xba4f('0xc'));var crypto=require(_0xba4f('0xd'));var jsforce=require(_0xba4f('0xe'));var deskjs=require(_0xba4f('0xf'));var toCsv=require(_0xba4f('0x9'));var querystring=require('querystring');var Papa=require(_0xba4f('0x10'));var Redis=require('ioredis');var authService=require(_0xba4f('0x11'));var qs=require(_0xba4f('0x12'));var as=require(_0xba4f('0x13'));var hardwareService=require(_0xba4f('0x14'));var logger=require(_0xba4f('0x15'))(_0xba4f('0x16'));var utils=require('../../config/utils');var config=require(_0xba4f('0x17'));var licenseUtil=require(_0xba4f('0x18'));var db=require(_0xba4f('0x19'))['db'];function respondWithStatusCode(_0x35a461,_0x3a0216){_0x3a0216=_0x3a0216||0xcc;return function(_0x2e4e37){if(_0x2e4e37){return _0x35a461[_0xba4f('0x1a')](_0x3a0216);}return _0x35a461[_0xba4f('0x1b')](_0x3a0216)[_0xba4f('0x1c')]();};}function respondWithResult(_0xbccef6,_0x4b9e86){_0x4b9e86=_0x4b9e86||0xc8;return function(_0x4200a5){if(_0x4200a5){return _0xbccef6[_0xba4f('0x1b')](_0x4b9e86)[_0xba4f('0x1d')](_0x4200a5);}};}function respondWithFilteredResult(_0x5b9334,_0x5ad1e3){return function(_0x5a1e59){if(_0x5a1e59){var _0x26d144=_0x5a1e59[_0xba4f('0x1e')],_0x104caf=_0x5ad1e3[_0xba4f('0x1f')],_0xc0a442=_0x5ad1e3['offset']+_0x5ad1e3[_0xba4f('0x20')],_0x218dea;if(_0xc0a442>=_0x26d144){_0xc0a442=_0x26d144;_0x218dea=0xc8;}else{_0x218dea=0xce;}_0x5b9334[_0xba4f('0x1b')](_0x218dea);return _0x5b9334['set'](_0xba4f('0x21'),_0x104caf+'-'+_0xc0a442+'/'+_0x26d144)['json'](_0x5a1e59);}return null;};}function patchUpdates(_0x666124){return function(_0x11e784){try{jsonpatch[_0xba4f('0x22')](_0x11e784,_0x666124,!![]);}catch(_0x30581b){return BPromise[_0xba4f('0x23')](_0x30581b);}return _0x11e784[_0xba4f('0x24')]();};}function saveUpdates(_0x516024,_0x254ef9){return function(_0x44e6c2){if(_0x44e6c2){return _0x44e6c2[_0xba4f('0x25')](_0x516024)['then'](function(_0x17592f){return _0x17592f;});}return null;};}function removeEntity(_0x5a3ed0,_0x4bdddc){return function(_0x2a7f19){if(_0x2a7f19){return _0x2a7f19[_0xba4f('0x26')]()[_0xba4f('0x27')](function(){_0x5a3ed0[_0xba4f('0x1b')](0xcc)[_0xba4f('0x1c')]();});}};}function handleEntityNotFound(_0x277f93,_0x1e9b4f){return function(_0x5b9899){if(!_0x5b9899){_0x277f93['sendStatus'](0x194);}return _0x5b9899;};}function handleError(_0xd65629,_0x420099){_0x420099=_0x420099||0x1f4;return function(_0x3fa60b){logger[_0xba4f('0x28')](_0x3fa60b[_0xba4f('0x29')]);if(_0x3fa60b['name']){delete _0x3fa60b['name'];}_0xd65629[_0xba4f('0x1b')](_0x420099)[_0xba4f('0x2a')](_0x3fa60b);};}exports[_0xba4f('0x2b')]=function(_0x294be5,_0x2053d7){var _0x326443={},_0x16c6da={},_0xf3dd94={'count':0x0,'rows':[]};var _0x270012=_['map'](db[_0xba4f('0x2c')]['rawAttributes'],function(_0x9f5d82){return{'name':_0x9f5d82[_0xba4f('0x2d')],'type':_0x9f5d82['type'][_0xba4f('0x2e')]};});_0x16c6da[_0xba4f('0x2f')]=_[_0xba4f('0x30')](_0x270012,_0xba4f('0x31'));_0x16c6da[_0xba4f('0x32')]=_[_0xba4f('0x33')](_0x294be5[_0xba4f('0x32')]);_0x16c6da[_0xba4f('0x34')]=_[_0xba4f('0x35')](_0x16c6da[_0xba4f('0x2f')],_0x16c6da[_0xba4f('0x32')]);_0x326443[_0xba4f('0x36')]=_[_0xba4f('0x35')](_0x16c6da[_0xba4f('0x2f')],qs[_0xba4f('0x37')](_0x294be5[_0xba4f('0x32')][_0xba4f('0x37')]));_0x326443['attributes']=_0x326443[_0xba4f('0x36')][_0xba4f('0x38')]?_0x326443[_0xba4f('0x36')]:_0x16c6da[_0xba4f('0x2f')];if(!_0x294be5['query'][_0xba4f('0x39')](_0xba4f('0x3a'))){_0x326443[_0xba4f('0x20')]=qs[_0xba4f('0x20')](_0x294be5[_0xba4f('0x32')]['limit']);_0x326443['offset']=qs['offset'](_0x294be5['query'][_0xba4f('0x1f')]);}_0x326443['order']=qs['sort'](_0x294be5[_0xba4f('0x32')][_0xba4f('0x3b')]);_0x326443[_0xba4f('0x3c')]=qs[_0xba4f('0x34')](_[_0xba4f('0x3d')](_0x294be5[_0xba4f('0x32')],_0x16c6da[_0xba4f('0x34')]),_0x270012);if(_0x294be5[_0xba4f('0x32')][_0xba4f('0x3e')]){_0x326443[_0xba4f('0x3c')]=_['merge'](_0x326443[_0xba4f('0x3c')],{'$or':_['map'](_0x270012,function(_0x1cef6f){if(_0x1cef6f[_0xba4f('0x3f')]!==_0xba4f('0x40')){var _0x5d2700={};_0x5d2700[_0x1cef6f[_0xba4f('0x31')]]={'$like':'%'+_0x294be5[_0xba4f('0x32')]['filter']+'%'};return _0x5d2700;}})});}_0x326443=_[_0xba4f('0x41')]({},_0x326443,_0x294be5[_0xba4f('0x42')]);var _0xd7efa6={'where':_0x326443['where']};return db[_0xba4f('0x2c')][_0xba4f('0x1e')](_0xd7efa6)[_0xba4f('0x27')](function(_0x249748){_0xf3dd94['count']=_0x249748;if(_0x294be5['query'][_0xba4f('0x43')]){_0x326443['include']=[{'all':!![]}];}return db[_0xba4f('0x2c')][_0xba4f('0x44')](_0x326443);})[_0xba4f('0x27')](function(_0x226c19){_0xf3dd94[_0xba4f('0x45')]=_0x226c19;return _0xf3dd94;})[_0xba4f('0x27')](respondWithFilteredResult(_0x2053d7,_0x326443))[_0xba4f('0x46')](handleError(_0x2053d7,null));};exports[_0xba4f('0x47')]=function(_0x9e1543,_0x45c860){var _0x348a38={'raw':!![],'where':{'id':_0x9e1543[_0xba4f('0x48')]['id']}},_0x3b3b91={};_0x3b3b91[_0xba4f('0x2f')]=_['keys'](db[_0xba4f('0x2c')][_0xba4f('0x49')]);_0x3b3b91[_0xba4f('0x32')]=_['keys'](_0x9e1543[_0xba4f('0x32')]);_0x3b3b91[_0xba4f('0x34')]=_[_0xba4f('0x35')](_0x3b3b91['model'],_0x3b3b91['query']);_0x348a38[_0xba4f('0x36')]=_['intersection'](_0x3b3b91[_0xba4f('0x2f')],qs['fields'](_0x9e1543[_0xba4f('0x32')]['fields']));_0x348a38[_0xba4f('0x36')]=_0x348a38[_0xba4f('0x36')][_0xba4f('0x38')]?_0x348a38[_0xba4f('0x36')]:_0x3b3b91[_0xba4f('0x2f')];if(_0x9e1543['query'][_0xba4f('0x43')]){_0x348a38[_0xba4f('0x4a')]=[{'all':!![]}];}_0x348a38=_['merge']({},_0x348a38,_0x9e1543[_0xba4f('0x42')]);return db[_0xba4f('0x2c')][_0xba4f('0x4b')](_0x348a38)[_0xba4f('0x27')](handleEntityNotFound(_0x45c860,null))[_0xba4f('0x27')](respondWithResult(_0x45c860,null))[_0xba4f('0x46')](handleError(_0x45c860,null));};exports[_0xba4f('0x4c')]=function(_0x4fe97f,_0x8d4774){return db[_0xba4f('0x2c')][_0xba4f('0x4c')](_0x4fe97f[_0xba4f('0x4d')],{})[_0xba4f('0x27')](respondWithResult(_0x8d4774,0xc9))[_0xba4f('0x46')](handleError(_0x8d4774,null));};exports['update']=function(_0x3f0eb,_0x11f508){if(_0x3f0eb[_0xba4f('0x4d')]['id']){delete _0x3f0eb[_0xba4f('0x4d')]['id'];}return db[_0xba4f('0x2c')][_0xba4f('0x4b')]({'where':{'id':_0x3f0eb[_0xba4f('0x48')]['id']}})[_0xba4f('0x27')](handleEntityNotFound(_0x11f508,null))[_0xba4f('0x27')](saveUpdates(_0x3f0eb[_0xba4f('0x4d')],null))[_0xba4f('0x27')](respondWithResult(_0x11f508,null))[_0xba4f('0x46')](handleError(_0x11f508,null));};exports[_0xba4f('0x26')]=function(_0x15703a,_0x37c0c1){return db['OpenchannelQueueReport'][_0xba4f('0x4b')]({'where':{'id':_0x15703a['params']['id']}})[_0xba4f('0x27')](handleEntityNotFound(_0x37c0c1,null))['then'](removeEntity(_0x37c0c1,null))[_0xba4f('0x46')](handleError(_0x37c0c1,null));};exports['describe']=function(_0x430130,_0x208013){return db[_0xba4f('0x2c')][_0xba4f('0x4e')]()[_0xba4f('0x27')](respondWithResult(_0x208013,null))['catch'](handleError(_0x208013,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 3c99e0e..c0ac9cc 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 _0x9f62=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','util','api','moment','bluebird','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports'];(function(_0x46451c,_0x88ddd){var _0x12dce4=function(_0x2e4087){while(--_0x2e4087){_0x46451c['push'](_0x46451c['shift']());}};_0x12dce4(++_0x88ddd);}(_0x9f62,0x154));var _0x29f6=function(_0x2d19d0,_0x3c4a5a){_0x2d19d0=_0x2d19d0-0x0;var _0xff6948=_0x9f62[_0x2d19d0];return _0xff6948;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var attributes=require(_0x29f6('0x6'));module[_0x29f6('0x7')]=function(_0x595034,_0xf66137){return _0x595034[_0x29f6('0x8')](_0x29f6('0x9'),attributes,{'tableName':_0x29f6('0xa'),'paranoid':![],'indexes':[{'name':_0x29f6('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc716=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid'];(function(_0x19ae4c,_0x5d45b9){var _0x255830=function(_0x37859a){while(--_0x37859a){_0x19ae4c['push'](_0x19ae4c['shift']());}};_0x255830(++_0x5d45b9);}(_0xc716,0x16c));var _0x6c71=function(_0x230a93,_0x454df5){_0x230a93=_0x230a93-0x0;var _0xe6a4da=_0xc716[_0x230a93];return _0xe6a4da;};'use strict';var _=require(_0x6c71('0x0'));var util=require('util');var logger=require(_0x6c71('0x1'))(_0x6c71('0x2'));var moment=require(_0x6c71('0x3'));var BPromise=require(_0x6c71('0x4'));var rp=require(_0x6c71('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6c71('0x6'));var config=require('../../config/environment');var attributes=require(_0x6c71('0x7'));module[_0x6c71('0x8')]=function(_0x302e37,_0x15cc3e){return _0x302e37[_0x6c71('0x9')](_0x6c71('0xa'),attributes,{'tableName':_0x6c71('0xb'),'paranoid':![],'indexes':[{'name':_0x6c71('0xc'),'fields':[_0x6c71('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index ab4ca50..43d12ee 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 _0x53dc=['request','then','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','OpenchannelQueueReport,\x20%s,\x20%s','result','catch','body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','where','attributes','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x122b6a,_0x5c684e){var _0x5e08f7=function(_0x3a0a4f){while(--_0x3a0a4f){_0x122b6a['push'](_0x122b6a['shift']());}};_0x5e08f7(++_0x5c684e);}(_0x53dc,0xee));var _0xc53d=function(_0x56bab1,_0x12c10d){_0x56bab1=_0x56bab1-0x0;var _0x1f85e1=_0x53dc[_0x56bab1];return _0x1f85e1;};'use strict';var _=require(_0xc53d('0x0'));var util=require('util');var moment=require(_0xc53d('0x1'));var BPromise=require(_0xc53d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc53d('0x3'));var db=require(_0xc53d('0x4'))['db'];var utils=require(_0xc53d('0x5'));var logger=require('../../config/logger')(_0xc53d('0x6'));var config=require(_0xc53d('0x7'));var jayson=require(_0xc53d('0x8'));var client=jayson['client'][_0xc53d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x88c0a8,_0x2f3262,_0x24005a){return new BPromise(function(_0x2a1506,_0x145932){return client[_0xc53d('0xa')](_0x88c0a8,_0x24005a)[_0xc53d('0xb')](function(_0x52e06){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x2f3262,_0xc53d('0xc'));logger[_0xc53d('0xd')](_0xc53d('0xe'),_0x2f3262,_0xc53d('0xc'),JSON[_0xc53d('0xf')](_0x52e06));if(_0x52e06['error']){if(_0x52e06[_0xc53d('0x10')][_0xc53d('0x11')]===0x1f4){logger[_0xc53d('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2f3262,_0x52e06['error'][_0xc53d('0x12')]);return _0x145932(_0x52e06[_0xc53d('0x10')][_0xc53d('0x12')]);}logger[_0xc53d('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2f3262,_0x52e06['error'][_0xc53d('0x12')]);return _0x2a1506(_0x52e06['error'][_0xc53d('0x12')]);}else{logger[_0xc53d('0x13')](_0xc53d('0x14'),_0x2f3262,'request\x20sent');_0x2a1506(_0x52e06[_0xc53d('0x15')][_0xc53d('0x12')]);}})[_0xc53d('0x16')](function(_0x3f6f71){logger[_0xc53d('0x10')](_0xc53d('0x14'),_0x2f3262,_0x3f6f71);_0x145932(_0x3f6f71);});});}exports['CreateOpenchannelQueueReport']=function(_0x3fbcea){var _0x61ecae=this;return new Promise(function(_0x4fdf14,_0x4470a1){return db['OpenchannelQueueReport']['create'](_0x3fbcea[_0xc53d('0x17')],{'raw':_0x3fbcea[_0xc53d('0x18')]?_0x3fbcea[_0xc53d('0x18')][_0xc53d('0x19')]===undefined?!![]:![]:!![]})[_0xc53d('0xb')](function(_0xa80d5){logger[_0xc53d('0x13')](_0xc53d('0x1a'),_0x3fbcea);logger[_0xc53d('0xd')](_0xc53d('0x1a'),_0x3fbcea,JSON[_0xc53d('0xf')](_0xa80d5));_0x4fdf14(_0xa80d5);})[_0xc53d('0x16')](function(_0x1d56ac){logger[_0xc53d('0x10')](_0xc53d('0x1a'),_0x1d56ac[_0xc53d('0x12')],_0x3fbcea);_0x4470a1(_0x61ecae[_0xc53d('0x10')](0x1f4,_0x1d56ac[_0xc53d('0x12')]));});});};exports[_0xc53d('0x1b')]=function(_0x2d32fb){var _0x2eb93a=this;return new Promise(function(_0x5ea7d9,_0x388c14){return db[_0xc53d('0x1c')]['update'](_0x2d32fb[_0xc53d('0x17')],{'raw':_0x2d32fb[_0xc53d('0x18')]?_0x2d32fb[_0xc53d('0x18')][_0xc53d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d32fb[_0xc53d('0x18')]?_0x2d32fb['options'][_0xc53d('0x1d')]||null:null,'attributes':_0x2d32fb['options']?_0x2d32fb['options'][_0xc53d('0x1e')]||null:null,'limit':_0x2d32fb[_0xc53d('0x18')]?_0x2d32fb[_0xc53d('0x18')]['limit']||null:null})['then'](function(_0x120f10){logger[_0xc53d('0x13')]('UpdateOpenchannelQueueReport',_0x2d32fb);logger[_0xc53d('0xd')]('UpdateOpenchannelQueueReport',_0x2d32fb,JSON[_0xc53d('0xf')](_0x120f10));_0x5ea7d9(_0x120f10);})[_0xc53d('0x16')](function(_0x4ff364){logger['error'](_0xc53d('0x1b'),_0x4ff364[_0xc53d('0x12')],_0x2d32fb);_0x388c14(_0x2eb93a[_0xc53d('0x10')](0x1f4,_0x4ff364[_0xc53d('0x12')]));});});}; \ No newline at end of file +var _0xfd02=['update','where','attributes','limit','UpdateOpenchannelQueueReport','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw'];(function(_0x2fcf23,_0x19c646){var _0x58ba5a=function(_0x51bbd2){while(--_0x51bbd2){_0x2fcf23['push'](_0x2fcf23['shift']());}};_0x58ba5a(++_0x19c646);}(_0xfd02,0xd1));var _0x2fd0=function(_0x27d6c5,_0x4c0e92){_0x27d6c5=_0x27d6c5-0x0;var _0x51fba6=_0xfd02[_0x27d6c5];return _0x51fba6;};'use strict';var _=require('lodash');var util=require(_0x2fd0('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2fd0('0x1'));var db=require(_0x2fd0('0x2'))['db'];var utils=require(_0x2fd0('0x3'));var logger=require(_0x2fd0('0x4'))(_0x2fd0('0x5'));var config=require(_0x2fd0('0x6'));var jayson=require(_0x2fd0('0x7'));var client=jayson[_0x2fd0('0x8')][_0x2fd0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x131e40,_0x2bcb0b,_0x1bb245){return new BPromise(function(_0x563dc2,_0x3e6456){return client[_0x2fd0('0xa')](_0x131e40,_0x1bb245)[_0x2fd0('0xb')](function(_0x40cb3c){logger['info'](_0x2fd0('0xc'),_0x2bcb0b,_0x2fd0('0xd'));logger[_0x2fd0('0xe')](_0x2fd0('0xf'),_0x2bcb0b,_0x2fd0('0xd'),JSON[_0x2fd0('0x10')](_0x40cb3c));if(_0x40cb3c[_0x2fd0('0x11')]){if(_0x40cb3c['error'][_0x2fd0('0x12')]===0x1f4){logger[_0x2fd0('0x11')](_0x2fd0('0xc'),_0x2bcb0b,_0x40cb3c[_0x2fd0('0x11')]['message']);return _0x3e6456(_0x40cb3c[_0x2fd0('0x11')][_0x2fd0('0x13')]);}logger[_0x2fd0('0x11')](_0x2fd0('0xc'),_0x2bcb0b,_0x40cb3c[_0x2fd0('0x11')][_0x2fd0('0x13')]);return _0x563dc2(_0x40cb3c[_0x2fd0('0x11')][_0x2fd0('0x13')]);}else{logger[_0x2fd0('0x14')](_0x2fd0('0xc'),_0x2bcb0b,'request\x20sent');_0x563dc2(_0x40cb3c[_0x2fd0('0x15')][_0x2fd0('0x13')]);}})[_0x2fd0('0x16')](function(_0x21e8f1){logger[_0x2fd0('0x11')](_0x2fd0('0xc'),_0x2bcb0b,_0x21e8f1);_0x3e6456(_0x21e8f1);});});}exports[_0x2fd0('0x17')]=function(_0x442d0c){var _0x5c93d2=this;return new Promise(function(_0x5b9a84,_0x359d38){return db[_0x2fd0('0x18')][_0x2fd0('0x19')](_0x442d0c[_0x2fd0('0x1a')],{'raw':_0x442d0c['options']?_0x442d0c[_0x2fd0('0x1b')][_0x2fd0('0x1c')]===undefined?!![]:![]:!![]})[_0x2fd0('0xb')](function(_0x317cec){logger[_0x2fd0('0x14')](_0x2fd0('0x17'),_0x442d0c);logger[_0x2fd0('0xe')](_0x2fd0('0x17'),_0x442d0c,JSON['stringify'](_0x317cec));_0x5b9a84(_0x317cec);})[_0x2fd0('0x16')](function(_0x124b1d){logger[_0x2fd0('0x11')](_0x2fd0('0x17'),_0x124b1d[_0x2fd0('0x13')],_0x442d0c);_0x359d38(_0x5c93d2['error'](0x1f4,_0x124b1d[_0x2fd0('0x13')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x13365e){var _0x440e6e=this;return new Promise(function(_0x37d1cd,_0x3f8af0){return db['OpenchannelQueueReport'][_0x2fd0('0x1d')](_0x13365e[_0x2fd0('0x1a')],{'raw':_0x13365e['options']?_0x13365e[_0x2fd0('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13365e[_0x2fd0('0x1b')]?_0x13365e[_0x2fd0('0x1b')][_0x2fd0('0x1e')]||null:null,'attributes':_0x13365e[_0x2fd0('0x1b')]?_0x13365e[_0x2fd0('0x1b')][_0x2fd0('0x1f')]||null:null,'limit':_0x13365e['options']?_0x13365e[_0x2fd0('0x1b')][_0x2fd0('0x20')]||null:null})[_0x2fd0('0xb')](function(_0x339c9d){logger[_0x2fd0('0x14')]('UpdateOpenchannelQueueReport',_0x13365e);logger[_0x2fd0('0xe')](_0x2fd0('0x21'),_0x13365e,JSON['stringify'](_0x339c9d));_0x37d1cd(_0x339c9d);})[_0x2fd0('0x16')](function(_0x195c40){logger['error']('UpdateOpenchannelQueueReport',_0x195c40[_0x2fd0('0x13')],_0x13365e);_0x3f8af0(_0x440e6e[_0x2fd0('0x11')](0x1f4,_0x195c40['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index b8381e2..bc3217b 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(_0x2cd1fb,_0x291f55){var _0x48fd2b=function(_0x18e23e){while(--_0x18e23e){_0x2cd1fb['push'](_0x2cd1fb['shift']());}};_0x48fd2b(++_0x291f55);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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(_0x21bfab,_0x2fee48){var _0x4db318=function(_0x10396d){while(--_0x10396d){_0x21bfab['push'](_0x21bfab['shift']());}};_0x4db318(++_0x2fee48);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 e5dc8d3..989ccce 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 _0x61e5=['agent','queue','NOW','exports','account'];(function(_0x42f318,_0x336c90){var _0x4aa72a=function(_0xfce356){while(--_0xfce356){_0x42f318['push'](_0x42f318['shift']());}};_0x4aa72a(++_0x336c90);}(_0x61e5,0xfd));var _0x561e=function(_0x1e5d32,_0x36a176){_0x1e5d32=_0x1e5d32-0x0;var _0x44c0d6=_0x61e5[_0x1e5d32];return _0x44c0d6;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x561e('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x561e('0x1'),_0x561e('0x2'),_0x561e('0x3')),'allowNull':![],'defaultValue':_0x561e('0x3')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x561e('0x4')]}}; \ No newline at end of file +var _0x420d=['DATE','NOW','account','agent','queue'];(function(_0x5b2a0d,_0x2c03f0){var _0xe49fc5=function(_0x11f45e){while(--_0x11f45e){_0x5b2a0d['push'](_0x5b2a0d['shift']());}};_0xe49fc5(++_0x2c03f0);}(_0x420d,0xd9));var _0xd420=function(_0x5009e4,_0x5c11c6){_0x5009e4=_0x5009e4-0x0;var _0x213873=_0x420d[_0x5009e4];return _0x213873;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xd420('0x0'),_0xd420('0x1'),_0xd420('0x2')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xd420('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xd420('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 9f54952..09cac13 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 _0x317c=['describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','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','json','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','sort','filters','where','merge','VIRTUAL','filter','OpenchannelTransferReport','count','include','findAll','show','params','rawAttributes','fields','options','find','create','body','catch','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x317c,0x135));var _0xc317=function(_0x396297,_0x31644b){_0x396297=_0x396297-0x0;var _0x7afcb1=_0x317c[_0x396297];return _0x7afcb1;};'use strict';var pdf=require(_0xc317('0x0'));var emlformat=require(_0xc317('0x1'));var rimraf=require(_0xc317('0x2'));var zipdir=require(_0xc317('0x3'));var jsonpatch=require(_0xc317('0x4'));var rp=require('request-promise');var moment=require(_0xc317('0x5'));var BPromise=require(_0xc317('0x6'));var Mustache=require(_0xc317('0x7'));var util=require('util');var path=require(_0xc317('0x8'));var sox=require('sox');var csv=require(_0xc317('0x9'));var ejs=require(_0xc317('0xa'));var fs=require('fs');var _=require(_0xc317('0xb'));var squel=require(_0xc317('0xc'));var crypto=require(_0xc317('0xd'));var jsforce=require(_0xc317('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc317('0xf'));var Papa=require(_0xc317('0x10'));var Redis=require(_0xc317('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc317('0x12'));var as=require(_0xc317('0x13'));var hardwareService=require(_0xc317('0x14'));var logger=require(_0xc317('0x15'))(_0xc317('0x16'));var utils=require(_0xc317('0x17'));var config=require(_0xc317('0x18'));var licenseUtil=require(_0xc317('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38896f,_0x530176){_0x530176=_0x530176||0xcc;return function(_0x5cde1b){if(_0x5cde1b){return _0x38896f[_0xc317('0x1a')](_0x530176);}return _0x38896f[_0xc317('0x1b')](_0x530176)[_0xc317('0x1c')]();};}function respondWithResult(_0x2184fa,_0x4674c4){_0x4674c4=_0x4674c4||0xc8;return function(_0x267b57){if(_0x267b57){return _0x2184fa[_0xc317('0x1b')](_0x4674c4)[_0xc317('0x1d')](_0x267b57);}};}function respondWithFilteredResult(_0x573e63,_0xae4b6b){return function(_0x59fa27){if(_0x59fa27){var _0x580cae=_0x59fa27['count'],_0x14eafa=_0xae4b6b[_0xc317('0x1e')],_0x33f540=_0xae4b6b[_0xc317('0x1e')]+_0xae4b6b[_0xc317('0x1f')],_0x3d7751;if(_0x33f540>=_0x580cae){_0x33f540=_0x580cae;_0x3d7751=0xc8;}else{_0x3d7751=0xce;}_0x573e63[_0xc317('0x1b')](_0x3d7751);return _0x573e63[_0xc317('0x20')](_0xc317('0x21'),_0x14eafa+'-'+_0x33f540+'/'+_0x580cae)['json'](_0x59fa27);}return null;};}function patchUpdates(_0x53e306){return function(_0x3362ad){try{jsonpatch[_0xc317('0x22')](_0x3362ad,_0x53e306,!![]);}catch(_0x170acf){return BPromise[_0xc317('0x23')](_0x170acf);}return _0x3362ad[_0xc317('0x24')]();};}function saveUpdates(_0x3f8148,_0xc4d6c){return function(_0x53997d){if(_0x53997d){return _0x53997d['update'](_0x3f8148)['then'](function(_0x43e564){return _0x43e564;});}return null;};}function removeEntity(_0x13d63e,_0x36d817){return function(_0x246538){if(_0x246538){return _0x246538[_0xc317('0x25')]()[_0xc317('0x26')](function(){_0x13d63e[_0xc317('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c132a,_0x313bcb){return function(_0x4e0d66){if(!_0x4e0d66){_0x4c132a['sendStatus'](0x194);}return _0x4e0d66;};}function handleError(_0x22fb5b,_0x576f62){_0x576f62=_0x576f62||0x1f4;return function(_0x3830f9){logger[_0xc317('0x27')](_0x3830f9[_0xc317('0x28')]);if(_0x3830f9[_0xc317('0x29')]){delete _0x3830f9['name'];}_0x22fb5b[_0xc317('0x1b')](_0x576f62)[_0xc317('0x2a')](_0x3830f9);};}exports[_0xc317('0x2b')]=function(_0x3b9c73,_0x1af4f6){var _0x38c1d6={},_0x46e392={},_0x280f3e={'count':0x0,'rows':[]};var _0xc0753=_['map'](db['OpenchannelTransferReport']['rawAttributes'],function(_0x5198a7){return{'name':_0x5198a7[_0xc317('0x2c')],'type':_0x5198a7[_0xc317('0x2d')][_0xc317('0x2e')]};});_0x46e392[_0xc317('0x2f')]=_[_0xc317('0x30')](_0xc0753,_0xc317('0x29'));_0x46e392[_0xc317('0x31')]=_[_0xc317('0x32')](_0x3b9c73['query']);_0x46e392['filters']=_[_0xc317('0x33')](_0x46e392[_0xc317('0x2f')],_0x46e392[_0xc317('0x31')]);_0x38c1d6['attributes']=_['intersection'](_0x46e392[_0xc317('0x2f')],qs['fields'](_0x3b9c73[_0xc317('0x31')]['fields']));_0x38c1d6['attributes']=_0x38c1d6[_0xc317('0x34')][_0xc317('0x35')]?_0x38c1d6[_0xc317('0x34')]:_0x46e392[_0xc317('0x2f')];if(!_0x3b9c73[_0xc317('0x31')][_0xc317('0x36')](_0xc317('0x37'))){_0x38c1d6[_0xc317('0x1f')]=qs[_0xc317('0x1f')](_0x3b9c73[_0xc317('0x31')]['limit']);_0x38c1d6[_0xc317('0x1e')]=qs[_0xc317('0x1e')](_0x3b9c73[_0xc317('0x31')][_0xc317('0x1e')]);}_0x38c1d6['order']=qs[_0xc317('0x38')](_0x3b9c73[_0xc317('0x31')]['sort']);_0x38c1d6['where']=qs['filters'](_['pick'](_0x3b9c73['query'],_0x46e392[_0xc317('0x39')]),_0xc0753);if(_0x3b9c73['query']['filter']){_0x38c1d6[_0xc317('0x3a')]=_[_0xc317('0x3b')](_0x38c1d6[_0xc317('0x3a')],{'$or':_[_0xc317('0x30')](_0xc0753,function(_0x27efa5){if(_0x27efa5[_0xc317('0x2d')]!==_0xc317('0x3c')){var _0x3a76aa={};_0x3a76aa[_0x27efa5[_0xc317('0x29')]]={'$like':'%'+_0x3b9c73[_0xc317('0x31')][_0xc317('0x3d')]+'%'};return _0x3a76aa;}})});}_0x38c1d6=_[_0xc317('0x3b')]({},_0x38c1d6,_0x3b9c73['options']);var _0x152f48={'where':_0x38c1d6[_0xc317('0x3a')]};return db[_0xc317('0x3e')][_0xc317('0x3f')](_0x152f48)[_0xc317('0x26')](function(_0x474225){_0x280f3e[_0xc317('0x3f')]=_0x474225;if(_0x3b9c73[_0xc317('0x31')]['includeAll']){_0x38c1d6[_0xc317('0x40')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xc317('0x41')](_0x38c1d6);})[_0xc317('0x26')](function(_0x10cc02){_0x280f3e['rows']=_0x10cc02;return _0x280f3e;})[_0xc317('0x26')](respondWithFilteredResult(_0x1af4f6,_0x38c1d6))['catch'](handleError(_0x1af4f6,null));};exports[_0xc317('0x42')]=function(_0x57addc,_0x57ccb3){var _0x4e9ffe={'raw':!![],'where':{'id':_0x57addc[_0xc317('0x43')]['id']}},_0x4a0bfb={};_0x4a0bfb[_0xc317('0x2f')]=_['keys'](db['OpenchannelTransferReport'][_0xc317('0x44')]);_0x4a0bfb[_0xc317('0x31')]=_['keys'](_0x57addc[_0xc317('0x31')]);_0x4a0bfb['filters']=_['intersection'](_0x4a0bfb[_0xc317('0x2f')],_0x4a0bfb[_0xc317('0x31')]);_0x4e9ffe['attributes']=_[_0xc317('0x33')](_0x4a0bfb['model'],qs['fields'](_0x57addc['query'][_0xc317('0x45')]));_0x4e9ffe[_0xc317('0x34')]=_0x4e9ffe[_0xc317('0x34')][_0xc317('0x35')]?_0x4e9ffe[_0xc317('0x34')]:_0x4a0bfb['model'];if(_0x57addc['query']['includeAll']){_0x4e9ffe[_0xc317('0x40')]=[{'all':!![]}];}_0x4e9ffe=_[_0xc317('0x3b')]({},_0x4e9ffe,_0x57addc[_0xc317('0x46')]);return db[_0xc317('0x3e')][_0xc317('0x47')](_0x4e9ffe)[_0xc317('0x26')](handleEntityNotFound(_0x57ccb3,null))[_0xc317('0x26')](respondWithResult(_0x57ccb3,null))['catch'](handleError(_0x57ccb3,null));};exports[_0xc317('0x48')]=function(_0x3e3f59,_0x5a3612){return db[_0xc317('0x3e')][_0xc317('0x48')](_0x3e3f59[_0xc317('0x49')],{})[_0xc317('0x26')](respondWithResult(_0x5a3612,0xc9))[_0xc317('0x4a')](handleError(_0x5a3612,null));};exports[_0xc317('0x4b')]=function(_0x10c7bd,_0x21b36d){if(_0x10c7bd[_0xc317('0x49')]['id']){delete _0x10c7bd['body']['id'];}return db['OpenchannelTransferReport'][_0xc317('0x47')]({'where':{'id':_0x10c7bd[_0xc317('0x43')]['id']}})[_0xc317('0x26')](handleEntityNotFound(_0x21b36d,null))['then'](saveUpdates(_0x10c7bd[_0xc317('0x49')],null))['then'](respondWithResult(_0x21b36d,null))['catch'](handleError(_0x21b36d,null));};exports['destroy']=function(_0x36b415,_0x2f4be5){return db[_0xc317('0x3e')][_0xc317('0x47')]({'where':{'id':_0x36b415[_0xc317('0x43')]['id']}})[_0xc317('0x26')](handleEntityNotFound(_0x2f4be5,null))[_0xc317('0x26')](removeEntity(_0x2f4be5,null))[_0xc317('0x4a')](handleError(_0x2f4be5,null));};exports[_0xc317('0x4c')]=function(_0x5d7896,_0x56b270){return db['OpenchannelTransferReport']['describe']()[_0xc317('0x26')](respondWithResult(_0x56b270,null))[_0xc317('0x4a')](handleError(_0x56b270,null));}; \ No newline at end of file +var _0x613e=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','count','limit','set','json','apply','reject','save','then','destroy','end','error','name','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','rows','show','params','find','catch','create','body','update','describe','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x3a9ce4,_0x3c095b){var _0x134b48=function(_0x5c92ea){while(--_0x5c92ea){_0x3a9ce4['push'](_0x3a9ce4['shift']());}};_0x134b48(++_0x3c095b);}(_0x613e,0x166));var _0xe613=function(_0x4dd70a,_0x147237){_0x4dd70a=_0x4dd70a-0x0;var _0x2bd778=_0x613e[_0x4dd70a];return _0x2bd778;};'use strict';var pdf=require(_0xe613('0x0'));var emlformat=require(_0xe613('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe613('0x2'));var moment=require(_0xe613('0x3'));var BPromise=require(_0xe613('0x4'));var Mustache=require(_0xe613('0x5'));var util=require(_0xe613('0x6'));var path=require(_0xe613('0x7'));var sox=require(_0xe613('0x8'));var csv=require('to-csv');var ejs=require(_0xe613('0x9'));var fs=require('fs');var _=require(_0xe613('0xa'));var squel=require(_0xe613('0xb'));var crypto=require(_0xe613('0xc'));var jsforce=require(_0xe613('0xd'));var deskjs=require(_0xe613('0xe'));var toCsv=require(_0xe613('0xf'));var querystring=require(_0xe613('0x10'));var Papa=require(_0xe613('0x11'));var Redis=require('ioredis');var authService=require(_0xe613('0x12'));var qs=require(_0xe613('0x13'));var as=require(_0xe613('0x14'));var hardwareService=require(_0xe613('0x15'));var logger=require(_0xe613('0x16'))(_0xe613('0x17'));var utils=require(_0xe613('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe613('0x19'));var db=require(_0xe613('0x1a'))['db'];function respondWithStatusCode(_0x132fb9,_0x43de7a){_0x43de7a=_0x43de7a||0xcc;return function(_0x3691b5){if(_0x3691b5){return _0x132fb9[_0xe613('0x1b')](_0x43de7a);}return _0x132fb9[_0xe613('0x1c')](_0x43de7a)['end']();};}function respondWithResult(_0x5e51f4,_0x5a0123){_0x5a0123=_0x5a0123||0xc8;return function(_0x50d3f2){if(_0x50d3f2){return _0x5e51f4['status'](_0x5a0123)['json'](_0x50d3f2);}};}function respondWithFilteredResult(_0x5d8fc7,_0x5b7e91){return function(_0xeefe97){if(_0xeefe97){var _0xe8074=_0xeefe97[_0xe613('0x1d')],_0x4ac572=_0x5b7e91['offset'],_0x546a36=_0x5b7e91['offset']+_0x5b7e91[_0xe613('0x1e')],_0xd79c9e;if(_0x546a36>=_0xe8074){_0x546a36=_0xe8074;_0xd79c9e=0xc8;}else{_0xd79c9e=0xce;}_0x5d8fc7[_0xe613('0x1c')](_0xd79c9e);return _0x5d8fc7[_0xe613('0x1f')]('Content-Range',_0x4ac572+'-'+_0x546a36+'/'+_0xe8074)[_0xe613('0x20')](_0xeefe97);}return null;};}function patchUpdates(_0x238feb){return function(_0x9e14bd){try{jsonpatch[_0xe613('0x21')](_0x9e14bd,_0x238feb,!![]);}catch(_0xc18dbe){return BPromise[_0xe613('0x22')](_0xc18dbe);}return _0x9e14bd[_0xe613('0x23')]();};}function saveUpdates(_0x469cac,_0x1c7177){return function(_0x2de7c9){if(_0x2de7c9){return _0x2de7c9['update'](_0x469cac)[_0xe613('0x24')](function(_0x3629ad){return _0x3629ad;});}return null;};}function removeEntity(_0x284d8e,_0x25629a){return function(_0x20cb77){if(_0x20cb77){return _0x20cb77[_0xe613('0x25')]()['then'](function(){_0x284d8e['status'](0xcc)[_0xe613('0x26')]();});}};}function handleEntityNotFound(_0x483358,_0x272a95){return function(_0x1f22ac){if(!_0x1f22ac){_0x483358[_0xe613('0x1b')](0x194);}return _0x1f22ac;};}function handleError(_0xe5f8db,_0x58fb3f){_0x58fb3f=_0x58fb3f||0x1f4;return function(_0x19d68f){logger[_0xe613('0x27')](_0x19d68f['stack']);if(_0x19d68f[_0xe613('0x28')]){delete _0x19d68f[_0xe613('0x28')];}_0xe5f8db[_0xe613('0x1c')](_0x58fb3f)['send'](_0x19d68f);};}exports['index']=function(_0x2e73bc,_0x3cce01){var _0x522e4e={},_0x2bacf0={},_0x164828={'count':0x0,'rows':[]};var _0x507e82=_[_0xe613('0x29')](db[_0xe613('0x2a')][_0xe613('0x2b')],function(_0x32e691){return{'name':_0x32e691[_0xe613('0x2c')],'type':_0x32e691[_0xe613('0x2d')][_0xe613('0x2e')]};});_0x2bacf0[_0xe613('0x2f')]=_[_0xe613('0x29')](_0x507e82,'name');_0x2bacf0[_0xe613('0x30')]=_[_0xe613('0x31')](_0x2e73bc[_0xe613('0x30')]);_0x2bacf0[_0xe613('0x32')]=_[_0xe613('0x33')](_0x2bacf0[_0xe613('0x2f')],_0x2bacf0['query']);_0x522e4e[_0xe613('0x34')]=_[_0xe613('0x33')](_0x2bacf0[_0xe613('0x2f')],qs[_0xe613('0x35')](_0x2e73bc[_0xe613('0x30')][_0xe613('0x35')]));_0x522e4e[_0xe613('0x34')]=_0x522e4e[_0xe613('0x34')][_0xe613('0x36')]?_0x522e4e[_0xe613('0x34')]:_0x2bacf0[_0xe613('0x2f')];if(!_0x2e73bc[_0xe613('0x30')][_0xe613('0x37')]('nolimit')){_0x522e4e['limit']=qs[_0xe613('0x1e')](_0x2e73bc['query'][_0xe613('0x1e')]);_0x522e4e['offset']=qs['offset'](_0x2e73bc['query'][_0xe613('0x38')]);}_0x522e4e[_0xe613('0x39')]=qs[_0xe613('0x3a')](_0x2e73bc[_0xe613('0x30')]['sort']);_0x522e4e['where']=qs[_0xe613('0x32')](_['pick'](_0x2e73bc[_0xe613('0x30')],_0x2bacf0[_0xe613('0x32')]),_0x507e82);if(_0x2e73bc['query'][_0xe613('0x3b')]){_0x522e4e[_0xe613('0x3c')]=_['merge'](_0x522e4e[_0xe613('0x3c')],{'$or':_[_0xe613('0x29')](_0x507e82,function(_0x54ecf5){if(_0x54ecf5[_0xe613('0x2d')]!==_0xe613('0x3d')){var _0x2a66c4={};_0x2a66c4[_0x54ecf5['name']]={'$like':'%'+_0x2e73bc[_0xe613('0x30')][_0xe613('0x3b')]+'%'};return _0x2a66c4;}})});}_0x522e4e=_[_0xe613('0x3e')]({},_0x522e4e,_0x2e73bc[_0xe613('0x3f')]);var _0x2a352f={'where':_0x522e4e[_0xe613('0x3c')]};return db[_0xe613('0x2a')][_0xe613('0x1d')](_0x2a352f)['then'](function(_0x5628ae){_0x164828['count']=_0x5628ae;if(_0x2e73bc[_0xe613('0x30')][_0xe613('0x40')]){_0x522e4e[_0xe613('0x41')]=[{'all':!![]}];}return db[_0xe613('0x2a')]['findAll'](_0x522e4e);})[_0xe613('0x24')](function(_0x419ba8){_0x164828[_0xe613('0x42')]=_0x419ba8;return _0x164828;})[_0xe613('0x24')](respondWithFilteredResult(_0x3cce01,_0x522e4e))['catch'](handleError(_0x3cce01,null));};exports[_0xe613('0x43')]=function(_0xf9462c,_0x42b326){var _0x5ef0b5={'raw':!![],'where':{'id':_0xf9462c[_0xe613('0x44')]['id']}},_0x56fca9={};_0x56fca9['model']=_[_0xe613('0x31')](db[_0xe613('0x2a')][_0xe613('0x2b')]);_0x56fca9['query']=_[_0xe613('0x31')](_0xf9462c[_0xe613('0x30')]);_0x56fca9['filters']=_['intersection'](_0x56fca9['model'],_0x56fca9[_0xe613('0x30')]);_0x5ef0b5[_0xe613('0x34')]=_[_0xe613('0x33')](_0x56fca9[_0xe613('0x2f')],qs[_0xe613('0x35')](_0xf9462c[_0xe613('0x30')][_0xe613('0x35')]));_0x5ef0b5[_0xe613('0x34')]=_0x5ef0b5[_0xe613('0x34')]['length']?_0x5ef0b5[_0xe613('0x34')]:_0x56fca9[_0xe613('0x2f')];if(_0xf9462c[_0xe613('0x30')]['includeAll']){_0x5ef0b5[_0xe613('0x41')]=[{'all':!![]}];}_0x5ef0b5=_[_0xe613('0x3e')]({},_0x5ef0b5,_0xf9462c[_0xe613('0x3f')]);return db[_0xe613('0x2a')][_0xe613('0x45')](_0x5ef0b5)['then'](handleEntityNotFound(_0x42b326,null))[_0xe613('0x24')](respondWithResult(_0x42b326,null))[_0xe613('0x46')](handleError(_0x42b326,null));};exports['create']=function(_0x13a55b,_0x51dcb2){return db[_0xe613('0x2a')][_0xe613('0x47')](_0x13a55b[_0xe613('0x48')],{})[_0xe613('0x24')](respondWithResult(_0x51dcb2,0xc9))[_0xe613('0x46')](handleError(_0x51dcb2,null));};exports[_0xe613('0x49')]=function(_0x43d701,_0x592d60){if(_0x43d701['body']['id']){delete _0x43d701[_0xe613('0x48')]['id'];}return db[_0xe613('0x2a')][_0xe613('0x45')]({'where':{'id':_0x43d701['params']['id']}})['then'](handleEntityNotFound(_0x592d60,null))[_0xe613('0x24')](saveUpdates(_0x43d701[_0xe613('0x48')],null))[_0xe613('0x24')](respondWithResult(_0x592d60,null))['catch'](handleError(_0x592d60,null));};exports['destroy']=function(_0x35dfb5,_0x5880dc){return db[_0xe613('0x2a')][_0xe613('0x45')]({'where':{'id':_0x35dfb5[_0xe613('0x44')]['id']}})[_0xe613('0x24')](handleEntityNotFound(_0x5880dc,null))[_0xe613('0x24')](removeEntity(_0x5880dc,null))['catch'](handleError(_0x5880dc,null));};exports[_0xe613('0x4a')]=function(_0x52d2de,_0x31a402){return db[_0xe613('0x2a')]['describe']()['then'](respondWithResult(_0x31a402,null))['catch'](handleError(_0x31a402,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index a8555a0..797d46d 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 _0xa698=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','OpenchannelTransferReport','uniqueid'];(function(_0x568ed9,_0x839e5d){var _0x2cbad8=function(_0x1b4fdd){while(--_0x1b4fdd){_0x568ed9['push'](_0x568ed9['shift']());}};_0x2cbad8(++_0x839e5d);}(_0xa698,0x1ef));var _0x8a69=function(_0x1ac978,_0x1348e9){_0x1ac978=_0x1ac978-0x0;var _0x573024=_0xa698[_0x1ac978];return _0x573024;};'use strict';var _=require(_0x8a69('0x0'));var util=require(_0x8a69('0x1'));var logger=require(_0x8a69('0x2'))(_0x8a69('0x3'));var moment=require('moment');var BPromise=require(_0x8a69('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a69('0x5'));var rimraf=require(_0x8a69('0x6'));var config=require(_0x8a69('0x7'));var attributes=require(_0x8a69('0x8'));module['exports']=function(_0xa23752,_0x215c06){return _0xa23752['define'](_0x8a69('0x9'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x8a69('0xa'),'fields':[_0x8a69('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5236=['request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelTransferReport','uniqueid','lodash','util','moment','bluebird'];(function(_0x27f5de,_0x577080){var _0x484149=function(_0x7e9adb){while(--_0x7e9adb){_0x27f5de['push'](_0x27f5de['shift']());}};_0x484149(++_0x577080);}(_0x5236,0x68));var _0x6523=function(_0x5b835d,_0x4bc050){_0x5b835d=_0x5b835d-0x0;var _0x31fcee=_0x5236[_0x5b835d];return _0x31fcee;};'use strict';var _=require(_0x6523('0x0'));var util=require(_0x6523('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6523('0x2'));var BPromise=require(_0x6523('0x3'));var rp=require(_0x6523('0x4'));var fs=require('fs');var path=require(_0x6523('0x5'));var rimraf=require(_0x6523('0x6'));var config=require(_0x6523('0x7'));var attributes=require('./openchannelTransferReport.attributes');module[_0x6523('0x8')]=function(_0x131d1c,_0x1abdc5){return _0x131d1c[_0x6523('0x9')](_0x6523('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x6523('0xb'),'fields':[_0x6523('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 42259df..3149739 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 _0x625e=['lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x1138bd,_0x173cec){var _0x1cadbe=function(_0x505930){while(--_0x505930){_0x1138bd['push'](_0x1138bd['shift']());}};_0x1cadbe(++_0x173cec);}(_0x625e,0xd2));var _0xe625=function(_0x5b27da,_0x4a6532){_0x5b27da=_0x5b27da-0x0;var _0x3254f4=_0x625e[_0x5b27da];return _0x3254f4;};'use strict';var _=require(_0xe625('0x0'));var util=require(_0xe625('0x1'));var moment=require(_0xe625('0x2'));var BPromise=require('bluebird');var rs=require(_0xe625('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe625('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe625('0x5'))(_0xe625('0x6'));var config=require(_0xe625('0x7'));var jayson=require(_0xe625('0x8'));var client=jayson[_0xe625('0x9')][_0xe625('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5eb44b,_0x1ccefd,_0x417adc){return new BPromise(function(_0x19e9d5,_0x4f3ecb){return client['request'](_0x5eb44b,_0x417adc)[_0xe625('0xb')](function(_0x5b9705){logger[_0xe625('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1ccefd,_0xe625('0xd'));logger['debug'](_0xe625('0xe'),_0x1ccefd,_0xe625('0xd'),JSON[_0xe625('0xf')](_0x5b9705));if(_0x5b9705[_0xe625('0x10')]){if(_0x5b9705[_0xe625('0x10')]['code']===0x1f4){logger[_0xe625('0x10')](_0xe625('0x11'),_0x1ccefd,_0x5b9705[_0xe625('0x10')][_0xe625('0x12')]);return _0x4f3ecb(_0x5b9705[_0xe625('0x10')]['message']);}logger[_0xe625('0x10')](_0xe625('0x11'),_0x1ccefd,_0x5b9705[_0xe625('0x10')][_0xe625('0x12')]);return _0x19e9d5(_0x5b9705[_0xe625('0x10')][_0xe625('0x12')]);}else{logger[_0xe625('0xc')](_0xe625('0x11'),_0x1ccefd,_0xe625('0xd'));_0x19e9d5(_0x5b9705[_0xe625('0x13')][_0xe625('0x12')]);}})[_0xe625('0x14')](function(_0x620af2){logger[_0xe625('0x10')](_0xe625('0x11'),_0x1ccefd,_0x620af2);_0x4f3ecb(_0x620af2);});});} \ No newline at end of file +var _0x04e4=['moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x9b8963,_0x1d0588){var _0x4db0d8=function(_0x49defc){while(--_0x49defc){_0x9b8963['push'](_0x9b8963['shift']());}};_0x4db0d8(++_0x1d0588);}(_0x04e4,0xa6));var _0x404e=function(_0x559e74,_0x1696ed){_0x559e74=_0x559e74-0x0;var _0x2daf2f=_0x04e4[_0x559e74];return _0x2daf2f;};'use strict';var _=require(_0x404e('0x0'));var util=require(_0x404e('0x1'));var moment=require(_0x404e('0x2'));var BPromise=require(_0x404e('0x3'));var rs=require(_0x404e('0x4'));var fs=require('fs');var Redis=require(_0x404e('0x5'));var db=require(_0x404e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x404e('0x7'));var config=require(_0x404e('0x8'));var jayson=require(_0x404e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x37a4af,_0x33e944,_0x2ec305){return new BPromise(function(_0x5b7510,_0xfd4fdc){return client[_0x404e('0xa')](_0x37a4af,_0x2ec305)[_0x404e('0xb')](function(_0x57cd93){logger[_0x404e('0xc')](_0x404e('0xd'),_0x33e944,_0x404e('0xe'));logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x33e944,_0x404e('0xe'),JSON[_0x404e('0xf')](_0x57cd93));if(_0x57cd93[_0x404e('0x10')]){if(_0x57cd93['error'][_0x404e('0x11')]===0x1f4){logger['error'](_0x404e('0xd'),_0x33e944,_0x57cd93[_0x404e('0x10')][_0x404e('0x12')]);return _0xfd4fdc(_0x57cd93['error']['message']);}logger[_0x404e('0x10')](_0x404e('0xd'),_0x33e944,_0x57cd93[_0x404e('0x10')]['message']);return _0x5b7510(_0x57cd93['error'][_0x404e('0x12')]);}else{logger[_0x404e('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x33e944,_0x404e('0xe'));_0x5b7510(_0x57cd93[_0x404e('0x13')][_0x404e('0x12')]);}})[_0x404e('0x14')](function(_0x2825c7){logger[_0x404e('0x10')](_0x404e('0xd'),_0x33e944,_0x2825c7);_0xfd4fdc(_0x2825c7);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 357b0ed..cdf8b10 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 _0xc7ba=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','create','put','/:id','update','delete'];(function(_0x59bca9,_0x3cf77f){var _0x472e28=function(_0x3175e4){while(--_0x3175e4){_0x59bca9['push'](_0x59bca9['shift']());}};_0x472e28(++_0x3cf77f);}(_0xc7ba,0x7a));var _0xac7b=function(_0x35d638,_0x1f909c){_0x35d638=_0x35d638-0x0;var _0x4e7b79=_0xc7ba[_0x35d638];return _0x4e7b79;};'use strict';var multer=require(_0xac7b('0x0'));var util=require(_0xac7b('0x1'));var path=require(_0xac7b('0x2'));var timeout=require(_0xac7b('0x3'));var express=require(_0xac7b('0x4'));var router=express[_0xac7b('0x5')]();var auth=require(_0xac7b('0x6'));var interaction=require(_0xac7b('0x7'));var config=require(_0xac7b('0x8'));var controller=require('./pause.controller');router[_0xac7b('0x9')]('/',auth[_0xac7b('0xa')](),controller[_0xac7b('0xb')]);router[_0xac7b('0x9')]('/:id',auth[_0xac7b('0xa')](),controller[_0xac7b('0xc')]);router['post']('/',auth[_0xac7b('0xa')](),controller[_0xac7b('0xd')]);router[_0xac7b('0xe')](_0xac7b('0xf'),auth[_0xac7b('0xa')](),controller[_0xac7b('0x10')]);router[_0xac7b('0x11')](_0xac7b('0xf'),auth[_0xac7b('0xa')](),controller[_0xac7b('0x12')]);module[_0xac7b('0x13')]=router; \ No newline at end of file +var _0x36dc=['../../components/interaction/service','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0xbafd5f,_0x27cabb){var _0x148fad=function(_0x449f61){while(--_0x449f61){_0xbafd5f['push'](_0xbafd5f['shift']());}};_0x148fad(++_0x27cabb);}(_0x36dc,0xd2));var _0xc36d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36dc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc36d('0x0'));var util=require(_0xc36d('0x1'));var path=require(_0xc36d('0x2'));var timeout=require(_0xc36d('0x3'));var express=require('express');var router=express[_0xc36d('0x4')]();var auth=require(_0xc36d('0x5'));var interaction=require(_0xc36d('0x6'));var config=require('../../config/environment');var controller=require('./pause.controller');router['get']('/',auth[_0xc36d('0x7')](),controller[_0xc36d('0x8')]);router['get'](_0xc36d('0x9'),auth[_0xc36d('0x7')](),controller[_0xc36d('0xa')]);router[_0xc36d('0xb')]('/',auth[_0xc36d('0x7')](),controller[_0xc36d('0xc')]);router[_0xc36d('0xd')](_0xc36d('0x9'),auth[_0xc36d('0x7')](),controller[_0xc36d('0xe')]);router[_0xc36d('0xf')]('/:id',auth[_0xc36d('0x7')](),controller[_0xc36d('0x10')]);module[_0xc36d('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 4298fc1..0e95c61 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 _0x5629=['STRING','sequelize','name'];(function(_0x35a274,_0x98b399){var _0x40d905=function(_0x5c8455){while(--_0x5c8455){_0x35a274['push'](_0x35a274['shift']());}};_0x40d905(++_0x98b399);}(_0x5629,0xf7));var _0x9562=function(_0x504ccb,_0x5951ae){_0x504ccb=_0x504ccb-0x0;var _0x5cea26=_0x5629[_0x504ccb];return _0x5cea26;};'use strict';var Sequelize=require(_0x9562('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x9562('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x9562('0x2')]}}; \ No newline at end of file +var _0x116b=['exports','STRING','name'];(function(_0x2a23db,_0x23dbc1){var _0x37e1cf=function(_0x38a2a2){while(--_0x38a2a2){_0x2a23db['push'](_0x2a23db['shift']());}};_0x37e1cf(++_0x23dbc1);}(_0x116b,0x111));var _0xb116=function(_0x40a2e9,_0x4eb4e5){_0x40a2e9=_0x40a2e9-0x0;var _0x195ce8=_0x116b[_0x40a2e9];return _0x195ce8;};'use strict';var Sequelize=require('sequelize');module[_0xb116('0x0')]={'name':{'type':Sequelize[_0xb116('0x1')],'unique':_0xb116('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xb116('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index a8501a2..4228619 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 _0x9123=['params','keys','includeAll','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','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','set','reject','update','then','destroy','Pauses','sendStatus','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show'];(function(_0x5625cc,_0x28483e){var _0x5c858e=function(_0x511f7a){while(--_0x511f7a){_0x5625cc['push'](_0x5625cc['shift']());}};_0x5c858e(++_0x28483e);}(_0x9123,0xb0));var _0x3912=function(_0x4ff845,_0x53caa8){_0x4ff845=_0x4ff845-0x0;var _0x221498=_0x9123[_0x4ff845];return _0x221498;};'use strict';var pdf=require(_0x3912('0x0'));var emlformat=require(_0x3912('0x1'));var rimraf=require(_0x3912('0x2'));var zipdir=require(_0x3912('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3912('0x4'));var moment=require(_0x3912('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3912('0x6'));var path=require(_0x3912('0x7'));var sox=require(_0x3912('0x8'));var csv=require(_0x3912('0x9'));var ejs=require(_0x3912('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3912('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3912('0xc'));var toCsv=require(_0x3912('0x9'));var querystring=require(_0x3912('0xd'));var Papa=require('papaparse');var Redis=require(_0x3912('0xe'));var authService=require(_0x3912('0xf'));var qs=require(_0x3912('0x10'));var as=require(_0x3912('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3912('0x12'))(_0x3912('0x13'));var utils=require(_0x3912('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3912('0x15'));var db=require(_0x3912('0x16'))['db'];function respondWithStatusCode(_0x5ed0c2,_0x5dbfc1){_0x5dbfc1=_0x5dbfc1||0xcc;return function(_0x4b62cc){if(_0x4b62cc){return _0x5ed0c2['sendStatus'](_0x5dbfc1);}return _0x5ed0c2['status'](_0x5dbfc1)[_0x3912('0x17')]();};}function respondWithResult(_0x177e0a,_0x3769fc){_0x3769fc=_0x3769fc||0xc8;return function(_0x459981){if(_0x459981){return _0x177e0a[_0x3912('0x18')](_0x3769fc)[_0x3912('0x19')](_0x459981);}};}function respondWithFilteredResult(_0x925bd8,_0x19622b){return function(_0x105f01){if(_0x105f01){var _0x4f768c=_0x105f01[_0x3912('0x1a')],_0x12aa4d=_0x19622b['offset'],_0x4b4197=_0x19622b[_0x3912('0x1b')]+_0x19622b[_0x3912('0x1c')],_0x373b03;if(_0x4b4197>=_0x4f768c){_0x4b4197=_0x4f768c;_0x373b03=0xc8;}else{_0x373b03=0xce;}_0x925bd8[_0x3912('0x18')](_0x373b03);return _0x925bd8[_0x3912('0x1d')]('Content-Range',_0x12aa4d+'-'+_0x4b4197+'/'+_0x4f768c)[_0x3912('0x19')](_0x105f01);}return null;};}function patchUpdates(_0x3af5da){return function(_0x3209e8){try{jsonpatch['apply'](_0x3209e8,_0x3af5da,!![]);}catch(_0x3c1baa){return BPromise[_0x3912('0x1e')](_0x3c1baa);}return _0x3209e8['save']();};}function saveUpdates(_0x56206a,_0x95f8ad){return function(_0x2d8117){if(_0x2d8117){return _0x2d8117[_0x3912('0x1f')](_0x56206a)[_0x3912('0x20')](function(_0xc046eb){return _0xc046eb;});}return null;};}function removeEntity(_0x3f6d03,_0x28ea00){return function(_0x2fdc6b){if(_0x2fdc6b){return _0x2fdc6b[_0x3912('0x21')]()['then'](function(){var _0x4ea24b=_0x2fdc6b['get']({'plain':!![]});var _0x32ddb0=_0x3912('0x22');return db['UserProfileResource'][_0x3912('0x21')]({'where':{'type':_0x32ddb0,'resourceId':_0x4ea24b['id']}})[_0x3912('0x20')](function(){return _0x2fdc6b;});})[_0x3912('0x20')](function(){_0x3f6d03[_0x3912('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2269d1,_0x554c31){return function(_0x38a202){if(!_0x38a202){_0x2269d1[_0x3912('0x23')](0x194);}return _0x38a202;};}function handleError(_0x454643,_0x3e209c){_0x3e209c=_0x3e209c||0x1f4;return function(_0x2a0a42){logger[_0x3912('0x24')](_0x2a0a42[_0x3912('0x25')]);if(_0x2a0a42[_0x3912('0x26')]){delete _0x2a0a42['name'];}_0x454643[_0x3912('0x18')](_0x3e209c)[_0x3912('0x27')](_0x2a0a42);};}exports[_0x3912('0x28')]=function(_0x5430ee,_0x5cf06c){var _0x5b5e25={},_0x4f5bf2={},_0x29c9ad={'count':0x0,'rows':[]};var _0x475d4c=_[_0x3912('0x29')](db[_0x3912('0x2a')][_0x3912('0x2b')],function(_0x2b71e0){return{'name':_0x2b71e0[_0x3912('0x2c')],'type':_0x2b71e0[_0x3912('0x2d')][_0x3912('0x2e')]};});_0x4f5bf2['model']=_[_0x3912('0x29')](_0x475d4c,'name');_0x4f5bf2[_0x3912('0x2f')]=_['keys'](_0x5430ee['query']);_0x4f5bf2[_0x3912('0x30')]=_[_0x3912('0x31')](_0x4f5bf2[_0x3912('0x32')],_0x4f5bf2[_0x3912('0x2f')]);_0x5b5e25['attributes']=_[_0x3912('0x31')](_0x4f5bf2[_0x3912('0x32')],qs['fields'](_0x5430ee[_0x3912('0x2f')][_0x3912('0x33')]));_0x5b5e25[_0x3912('0x34')]=_0x5b5e25[_0x3912('0x34')][_0x3912('0x35')]?_0x5b5e25[_0x3912('0x34')]:_0x4f5bf2[_0x3912('0x32')];if(!_0x5430ee[_0x3912('0x2f')][_0x3912('0x36')](_0x3912('0x37'))){_0x5b5e25['limit']=qs['limit'](_0x5430ee['query']['limit']);_0x5b5e25['offset']=qs[_0x3912('0x1b')](_0x5430ee[_0x3912('0x2f')][_0x3912('0x1b')]);}_0x5b5e25[_0x3912('0x38')]=qs[_0x3912('0x39')](_0x5430ee[_0x3912('0x2f')]['sort']);_0x5b5e25[_0x3912('0x3a')]=qs['filters'](_[_0x3912('0x3b')](_0x5430ee[_0x3912('0x2f')],_0x4f5bf2[_0x3912('0x30')]),_0x475d4c);if(_0x5430ee[_0x3912('0x2f')][_0x3912('0x3c')]){_0x5b5e25[_0x3912('0x3a')]=_['merge'](_0x5b5e25['where'],{'$or':_[_0x3912('0x29')](_0x475d4c,function(_0x266f05){if(_0x266f05[_0x3912('0x2d')]!=='VIRTUAL'){var _0x1e765f={};_0x1e765f[_0x266f05[_0x3912('0x26')]]={'$like':'%'+_0x5430ee[_0x3912('0x2f')][_0x3912('0x3c')]+'%'};return _0x1e765f;}})});}_0x5b5e25=_[_0x3912('0x3d')]({},_0x5b5e25,_0x5430ee['options']);var _0x203424={'where':_0x5b5e25[_0x3912('0x3a')]};return db[_0x3912('0x2a')][_0x3912('0x1a')](_0x203424)[_0x3912('0x20')](function(_0x37038f){_0x29c9ad[_0x3912('0x1a')]=_0x37038f;if(_0x5430ee['query']['includeAll']){_0x5b5e25[_0x3912('0x3e')]=[{'all':!![]}];}return db[_0x3912('0x2a')][_0x3912('0x3f')](_0x5b5e25);})[_0x3912('0x20')](function(_0x1def51){_0x29c9ad[_0x3912('0x40')]=_0x1def51;return _0x29c9ad;})[_0x3912('0x20')](respondWithFilteredResult(_0x5cf06c,_0x5b5e25))[_0x3912('0x41')](handleError(_0x5cf06c,null));};exports[_0x3912('0x42')]=function(_0x29443b,_0x5e6d95){var _0xd18d98={'raw':!![],'where':{'id':_0x29443b[_0x3912('0x43')]['id']}},_0x4f7946={};_0x4f7946[_0x3912('0x32')]=_[_0x3912('0x44')](db[_0x3912('0x2a')][_0x3912('0x2b')]);_0x4f7946[_0x3912('0x2f')]=_['keys'](_0x29443b[_0x3912('0x2f')]);_0x4f7946['filters']=_[_0x3912('0x31')](_0x4f7946[_0x3912('0x32')],_0x4f7946[_0x3912('0x2f')]);_0xd18d98[_0x3912('0x34')]=_[_0x3912('0x31')](_0x4f7946[_0x3912('0x32')],qs[_0x3912('0x33')](_0x29443b[_0x3912('0x2f')]['fields']));_0xd18d98['attributes']=_0xd18d98[_0x3912('0x34')]['length']?_0xd18d98[_0x3912('0x34')]:_0x4f7946[_0x3912('0x32')];if(_0x29443b[_0x3912('0x2f')][_0x3912('0x45')]){_0xd18d98[_0x3912('0x3e')]=[{'all':!![]}];}_0xd18d98=_[_0x3912('0x3d')]({},_0xd18d98,_0x29443b['options']);return db[_0x3912('0x2a')][_0x3912('0x46')](_0xd18d98)[_0x3912('0x20')](handleEntityNotFound(_0x5e6d95,null))[_0x3912('0x20')](respondWithResult(_0x5e6d95,null))[_0x3912('0x41')](handleError(_0x5e6d95,null));};exports[_0x3912('0x47')]=function(_0x43e432,_0x497b89){return db['Pause'][_0x3912('0x47')](_0x43e432[_0x3912('0x48')],{})[_0x3912('0x20')](function(_0x2570aa){var _0x4fefc5=_0x43e432['user'][_0x3912('0x49')]({'plain':!![]});if(!_0x4fefc5)throw new Error(_0x3912('0x4a'));if(_0x4fefc5[_0x3912('0x4b')]===_0x3912('0x4c')){var _0x56697e=_0x2570aa[_0x3912('0x49')]({'plain':!![]});var _0x32d93b=_0x3912('0x22');return db[_0x3912('0x4d')][_0x3912('0x46')]({'where':{'name':_0x32d93b,'userProfileId':_0x4fefc5[_0x3912('0x4e')]},'raw':!![]})['then'](function(_0x376d01){if(_0x376d01&&_0x376d01[_0x3912('0x4f')]===0x0){return db['UserProfileResource'][_0x3912('0x47')]({'name':_0x56697e[_0x3912('0x26')],'resourceId':_0x56697e['id'],'type':_0x376d01[_0x3912('0x26')],'sectionId':_0x376d01['id']},{})[_0x3912('0x20')](function(){return _0x2570aa;});}else{return _0x2570aa;}})[_0x3912('0x41')](function(_0xcd15ca){logger[_0x3912('0x24')](_0x3912('0x50'),_0xcd15ca);throw _0xcd15ca;});}return _0x2570aa;})['then'](respondWithResult(_0x497b89,0xc9))[_0x3912('0x41')](handleError(_0x497b89,null));};exports['update']=function(_0x12c902,_0x3393c9){if(_0x12c902[_0x3912('0x48')]['id']){delete _0x12c902[_0x3912('0x48')]['id'];}return db[_0x3912('0x2a')][_0x3912('0x46')]({'where':{'id':_0x12c902[_0x3912('0x43')]['id']}})['then'](handleEntityNotFound(_0x3393c9,null))['then'](saveUpdates(_0x12c902[_0x3912('0x48')],null))[_0x3912('0x20')](respondWithResult(_0x3393c9,null))['catch'](handleError(_0x3393c9,null));};exports[_0x3912('0x21')]=function(_0x5db558,_0x194dc2){return db[_0x3912('0x2a')][_0x3912('0x46')]({'where':{'id':_0x5db558[_0x3912('0x43')]['id']}})['then'](handleEntityNotFound(_0x194dc2,null))[_0x3912('0x20')](removeEntity(_0x194dc2,null))['catch'](handleError(_0x194dc2,null));}; \ No newline at end of file +var _0xffb5=['html-pdf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','count','offset','limit','set','Content-Range','json','reject','update','then','destroy','get','Pauses','UserProfileResource','stack','name','send','index','map','Pause','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','pick','filter','where','merge','type','VIRTUAL','options','includeAll','params','length','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error'];(function(_0x2c9b22,_0x1bf74d){var _0x2a63f3=function(_0x5cdd14){while(--_0x5cdd14){_0x2c9b22['push'](_0x2c9b22['shift']());}};_0x2a63f3(++_0x1bf74d);}(_0xffb5,0x12c));var _0x5ffb=function(_0x4f6a31,_0x18825f){_0x4f6a31=_0x4f6a31-0x0;var _0x1f7d82=_0xffb5[_0x4f6a31];return _0x1f7d82;};'use strict';var pdf=require(_0x5ffb('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5ffb('0x1'));var moment=require('moment');var BPromise=require(_0x5ffb('0x2'));var Mustache=require(_0x5ffb('0x3'));var util=require(_0x5ffb('0x4'));var path=require('path');var sox=require(_0x5ffb('0x5'));var csv=require(_0x5ffb('0x6'));var ejs=require(_0x5ffb('0x7'));var fs=require('fs');var _=require(_0x5ffb('0x8'));var squel=require(_0x5ffb('0x9'));var crypto=require(_0x5ffb('0xa'));var jsforce=require(_0x5ffb('0xb'));var deskjs=require(_0x5ffb('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5ffb('0xd'));var Papa=require('papaparse');var Redis=require(_0x5ffb('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5ffb('0xf'));var hardwareService=require(_0x5ffb('0x10'));var logger=require(_0x5ffb('0x11'))(_0x5ffb('0x12'));var utils=require('../../config/utils');var config=require(_0x5ffb('0x13'));var licenseUtil=require(_0x5ffb('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x388c74,_0x375c1f){_0x375c1f=_0x375c1f||0xcc;return function(_0x202573){if(_0x202573){return _0x388c74[_0x5ffb('0x15')](_0x375c1f);}return _0x388c74['status'](_0x375c1f)[_0x5ffb('0x16')]();};}function respondWithResult(_0x410a72,_0x32f3ce){_0x32f3ce=_0x32f3ce||0xc8;return function(_0x18c415){if(_0x18c415){return _0x410a72[_0x5ffb('0x17')](_0x32f3ce)['json'](_0x18c415);}};}function respondWithFilteredResult(_0x92dc4c,_0x4ba190){return function(_0xe84654){if(_0xe84654){var _0x11eeb4=_0xe84654[_0x5ffb('0x18')],_0x295311=_0x4ba190['offset'],_0x4aa38b=_0x4ba190[_0x5ffb('0x19')]+_0x4ba190[_0x5ffb('0x1a')],_0x35a858;if(_0x4aa38b>=_0x11eeb4){_0x4aa38b=_0x11eeb4;_0x35a858=0xc8;}else{_0x35a858=0xce;}_0x92dc4c[_0x5ffb('0x17')](_0x35a858);return _0x92dc4c[_0x5ffb('0x1b')](_0x5ffb('0x1c'),_0x295311+'-'+_0x4aa38b+'/'+_0x11eeb4)[_0x5ffb('0x1d')](_0xe84654);}return null;};}function patchUpdates(_0x244545){return function(_0xe75e70){try{jsonpatch['apply'](_0xe75e70,_0x244545,!![]);}catch(_0x29ea9e){return BPromise[_0x5ffb('0x1e')](_0x29ea9e);}return _0xe75e70['save']();};}function saveUpdates(_0x1e3a04,_0x14a0b1){return function(_0x5ea243){if(_0x5ea243){return _0x5ea243[_0x5ffb('0x1f')](_0x1e3a04)[_0x5ffb('0x20')](function(_0x376491){return _0x376491;});}return null;};}function removeEntity(_0x4026e1,_0x45acbe){return function(_0x502fe8){if(_0x502fe8){return _0x502fe8[_0x5ffb('0x21')]()[_0x5ffb('0x20')](function(){var _0x1b3fe9=_0x502fe8[_0x5ffb('0x22')]({'plain':!![]});var _0x48cdc7=_0x5ffb('0x23');return db[_0x5ffb('0x24')][_0x5ffb('0x21')]({'where':{'type':_0x48cdc7,'resourceId':_0x1b3fe9['id']}})['then'](function(){return _0x502fe8;});})[_0x5ffb('0x20')](function(){_0x4026e1[_0x5ffb('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x572427,_0xddfe81){return function(_0x24983a){if(!_0x24983a){_0x572427[_0x5ffb('0x15')](0x194);}return _0x24983a;};}function handleError(_0x3e2229,_0x212bdc){_0x212bdc=_0x212bdc||0x1f4;return function(_0x2fb2c1){logger['error'](_0x2fb2c1[_0x5ffb('0x25')]);if(_0x2fb2c1[_0x5ffb('0x26')]){delete _0x2fb2c1[_0x5ffb('0x26')];}_0x3e2229[_0x5ffb('0x17')](_0x212bdc)[_0x5ffb('0x27')](_0x2fb2c1);};}exports[_0x5ffb('0x28')]=function(_0x53b969,_0x2792ca){var _0x531636={},_0x54c0ed={},_0x154def={'count':0x0,'rows':[]};var _0x2b4cef=_[_0x5ffb('0x29')](db[_0x5ffb('0x2a')][_0x5ffb('0x2b')],function(_0x12e244){return{'name':_0x12e244[_0x5ffb('0x2c')],'type':_0x12e244['type'][_0x5ffb('0x2d')]};});_0x54c0ed[_0x5ffb('0x2e')]=_[_0x5ffb('0x29')](_0x2b4cef,_0x5ffb('0x26'));_0x54c0ed[_0x5ffb('0x2f')]=_[_0x5ffb('0x30')](_0x53b969[_0x5ffb('0x2f')]);_0x54c0ed[_0x5ffb('0x31')]=_[_0x5ffb('0x32')](_0x54c0ed['model'],_0x54c0ed['query']);_0x531636[_0x5ffb('0x33')]=_['intersection'](_0x54c0ed[_0x5ffb('0x2e')],qs[_0x5ffb('0x34')](_0x53b969['query'][_0x5ffb('0x34')]));_0x531636[_0x5ffb('0x33')]=_0x531636['attributes']['length']?_0x531636['attributes']:_0x54c0ed[_0x5ffb('0x2e')];if(!_0x53b969[_0x5ffb('0x2f')][_0x5ffb('0x35')]('nolimit')){_0x531636[_0x5ffb('0x1a')]=qs['limit'](_0x53b969[_0x5ffb('0x2f')][_0x5ffb('0x1a')]);_0x531636[_0x5ffb('0x19')]=qs[_0x5ffb('0x19')](_0x53b969['query'][_0x5ffb('0x19')]);}_0x531636['order']=qs['sort'](_0x53b969[_0x5ffb('0x2f')]['sort']);_0x531636['where']=qs[_0x5ffb('0x31')](_[_0x5ffb('0x36')](_0x53b969['query'],_0x54c0ed[_0x5ffb('0x31')]),_0x2b4cef);if(_0x53b969[_0x5ffb('0x2f')][_0x5ffb('0x37')]){_0x531636[_0x5ffb('0x38')]=_[_0x5ffb('0x39')](_0x531636[_0x5ffb('0x38')],{'$or':_[_0x5ffb('0x29')](_0x2b4cef,function(_0x526bc9){if(_0x526bc9[_0x5ffb('0x3a')]!==_0x5ffb('0x3b')){var _0x374059={};_0x374059[_0x526bc9[_0x5ffb('0x26')]]={'$like':'%'+_0x53b969['query']['filter']+'%'};return _0x374059;}})});}_0x531636=_[_0x5ffb('0x39')]({},_0x531636,_0x53b969[_0x5ffb('0x3c')]);var _0x3a5d2a={'where':_0x531636['where']};return db[_0x5ffb('0x2a')][_0x5ffb('0x18')](_0x3a5d2a)[_0x5ffb('0x20')](function(_0x2c30d3){_0x154def[_0x5ffb('0x18')]=_0x2c30d3;if(_0x53b969['query'][_0x5ffb('0x3d')]){_0x531636['include']=[{'all':!![]}];}return db[_0x5ffb('0x2a')]['findAll'](_0x531636);})[_0x5ffb('0x20')](function(_0x44f06e){_0x154def['rows']=_0x44f06e;return _0x154def;})['then'](respondWithFilteredResult(_0x2792ca,_0x531636))['catch'](handleError(_0x2792ca,null));};exports['show']=function(_0x34809d,_0x437124){var _0x5c155a={'raw':!![],'where':{'id':_0x34809d[_0x5ffb('0x3e')]['id']}},_0x8aa7f4={};_0x8aa7f4[_0x5ffb('0x2e')]=_[_0x5ffb('0x30')](db[_0x5ffb('0x2a')]['rawAttributes']);_0x8aa7f4[_0x5ffb('0x2f')]=_[_0x5ffb('0x30')](_0x34809d[_0x5ffb('0x2f')]);_0x8aa7f4[_0x5ffb('0x31')]=_[_0x5ffb('0x32')](_0x8aa7f4[_0x5ffb('0x2e')],_0x8aa7f4[_0x5ffb('0x2f')]);_0x5c155a[_0x5ffb('0x33')]=_[_0x5ffb('0x32')](_0x8aa7f4[_0x5ffb('0x2e')],qs[_0x5ffb('0x34')](_0x34809d[_0x5ffb('0x2f')][_0x5ffb('0x34')]));_0x5c155a[_0x5ffb('0x33')]=_0x5c155a[_0x5ffb('0x33')][_0x5ffb('0x3f')]?_0x5c155a[_0x5ffb('0x33')]:_0x8aa7f4[_0x5ffb('0x2e')];if(_0x34809d[_0x5ffb('0x2f')][_0x5ffb('0x3d')]){_0x5c155a[_0x5ffb('0x40')]=[{'all':!![]}];}_0x5c155a=_[_0x5ffb('0x39')]({},_0x5c155a,_0x34809d[_0x5ffb('0x3c')]);return db[_0x5ffb('0x2a')][_0x5ffb('0x41')](_0x5c155a)[_0x5ffb('0x20')](handleEntityNotFound(_0x437124,null))[_0x5ffb('0x20')](respondWithResult(_0x437124,null))[_0x5ffb('0x42')](handleError(_0x437124,null));};exports[_0x5ffb('0x43')]=function(_0x34ae6d,_0x3fbc50){return db[_0x5ffb('0x2a')][_0x5ffb('0x43')](_0x34ae6d[_0x5ffb('0x44')],{})[_0x5ffb('0x20')](function(_0x58442c){var _0x1f22a9=_0x34ae6d[_0x5ffb('0x45')][_0x5ffb('0x22')]({'plain':!![]});if(!_0x1f22a9)throw new Error(_0x5ffb('0x46'));if(_0x1f22a9[_0x5ffb('0x47')]==='user'){var _0x233e9a=_0x58442c[_0x5ffb('0x22')]({'plain':!![]});var _0x32bfbd='Pauses';return db['UserProfileSection'][_0x5ffb('0x41')]({'where':{'name':_0x32bfbd,'userProfileId':_0x1f22a9[_0x5ffb('0x48')]},'raw':!![]})[_0x5ffb('0x20')](function(_0x2891e5){if(_0x2891e5&&_0x2891e5[_0x5ffb('0x49')]===0x0){return db['UserProfileResource'][_0x5ffb('0x43')]({'name':_0x233e9a['name'],'resourceId':_0x233e9a['id'],'type':_0x2891e5['name'],'sectionId':_0x2891e5['id']},{})[_0x5ffb('0x20')](function(){return _0x58442c;});}else{return _0x58442c;}})[_0x5ffb('0x42')](function(_0x1f3901){logger[_0x5ffb('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f3901);throw _0x1f3901;});}return _0x58442c;})[_0x5ffb('0x20')](respondWithResult(_0x3fbc50,0xc9))[_0x5ffb('0x42')](handleError(_0x3fbc50,null));};exports['update']=function(_0x33d951,_0x16ed74){if(_0x33d951[_0x5ffb('0x44')]['id']){delete _0x33d951[_0x5ffb('0x44')]['id'];}return db[_0x5ffb('0x2a')]['find']({'where':{'id':_0x33d951[_0x5ffb('0x3e')]['id']}})['then'](handleEntityNotFound(_0x16ed74,null))['then'](saveUpdates(_0x33d951[_0x5ffb('0x44')],null))['then'](respondWithResult(_0x16ed74,null))[_0x5ffb('0x42')](handleError(_0x16ed74,null));};exports['destroy']=function(_0x573ca7,_0x258fe9){return db[_0x5ffb('0x2a')][_0x5ffb('0x41')]({'where':{'id':_0x573ca7[_0x5ffb('0x3e')]['id']}})[_0x5ffb('0x20')](handleEntityNotFound(_0x258fe9,null))['then'](removeEntity(_0x258fe9,null))['catch'](handleError(_0x258fe9,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index f49049e..34e82ee 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 _0x63ef=['bluebird','rimraf','../../config/environment','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','moment'];(function(_0x338b15,_0x3202d8){var _0x466e43=function(_0x3c79ae){while(--_0x3c79ae){_0x338b15['push'](_0x338b15['shift']());}};_0x466e43(++_0x3202d8);}(_0x63ef,0x11a));var _0xf63e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x63ef[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require(_0xf63e('0x0'));var util=require(_0xf63e('0x1'));var logger=require(_0xf63e('0x2'))('api');var moment=require(_0xf63e('0x3'));var BPromise=require(_0xf63e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf63e('0x5'));var config=require(_0xf63e('0x6'));var attributes=require('./pause.attributes');module[_0xf63e('0x7')]=function(_0x367f73,_0x519a33){return _0x367f73[_0xf63e('0x8')](_0xf63e('0x9'),attributes,{'tableName':_0xf63e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef0a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','define','Pause'];(function(_0x35aeb5,_0x4e8855){var _0x18fcec=function(_0x2f81a5){while(--_0x2f81a5){_0x35aeb5['push'](_0x35aeb5['shift']());}};_0x18fcec(++_0x4e8855);}(_0xef0a,0xdd));var _0xaef0=function(_0x3c19fe,_0x2e1b96){_0x3c19fe=_0x3c19fe-0x0;var _0x25245a=_0xef0a[_0x3c19fe];return _0x25245a;};'use strict';var _=require(_0xaef0('0x0'));var util=require(_0xaef0('0x1'));var logger=require(_0xaef0('0x2'))(_0xaef0('0x3'));var moment=require(_0xaef0('0x4'));var BPromise=require(_0xaef0('0x5'));var rp=require(_0xaef0('0x6'));var fs=require('fs');var path=require(_0xaef0('0x7'));var rimraf=require(_0xaef0('0x8'));var config=require(_0xaef0('0x9'));var attributes=require(_0xaef0('0xa'));module['exports']=function(_0x32868a,_0x12dd17){return _0x32868a[_0xaef0('0xb')](_0xaef0('0xc'),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 b200b31..c7a824e 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 _0xe700=['request','then','info','Pause,\x20%s,\x20%s','debug','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','ShowPause','Pause','find','options','raw','where','include','model','attributes','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http'];(function(_0x260a78,_0x20c234){var _0x56c872=function(_0x37db61){while(--_0x37db61){_0x260a78['push'](_0x260a78['shift']());}};_0x56c872(++_0x20c234);}(_0xe700,0x16a));var _0x0e70=function(_0x1e7e50,_0x404257){_0x1e7e50=_0x1e7e50-0x0;var _0x28dc81=_0xe700[_0x1e7e50];return _0x28dc81;};'use strict';var _=require(_0x0e70('0x0'));var util=require(_0x0e70('0x1'));var moment=require(_0x0e70('0x2'));var BPromise=require(_0x0e70('0x3'));var rs=require(_0x0e70('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0e70('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0e70('0x6'))(_0x0e70('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0e70('0x8')][_0x0e70('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4415bb,_0x65a900,_0x51382d){return new BPromise(function(_0x33f0c3,_0x37da83){return client[_0x0e70('0xa')](_0x4415bb,_0x51382d)[_0x0e70('0xb')](function(_0x151c76){logger[_0x0e70('0xc')](_0x0e70('0xd'),_0x65a900,'request\x20sent');logger[_0x0e70('0xe')](_0x0e70('0xf'),_0x65a900,_0x0e70('0x10'),JSON['stringify'](_0x151c76));if(_0x151c76[_0x0e70('0x11')]){if(_0x151c76[_0x0e70('0x11')][_0x0e70('0x12')]===0x1f4){logger[_0x0e70('0x11')](_0x0e70('0xd'),_0x65a900,_0x151c76[_0x0e70('0x11')]['message']);return _0x37da83(_0x151c76[_0x0e70('0x11')][_0x0e70('0x13')]);}logger[_0x0e70('0x11')](_0x0e70('0xd'),_0x65a900,_0x151c76[_0x0e70('0x11')][_0x0e70('0x13')]);return _0x33f0c3(_0x151c76['error']['message']);}else{logger[_0x0e70('0xc')](_0x0e70('0xd'),_0x65a900,_0x0e70('0x10'));_0x33f0c3(_0x151c76['result'][_0x0e70('0x13')]);}})[_0x0e70('0x14')](function(_0x3c9545){logger[_0x0e70('0x11')](_0x0e70('0xd'),_0x65a900,_0x3c9545);_0x37da83(_0x3c9545);});});}exports[_0x0e70('0x15')]=function(_0x5300d6){var _0x536cda=this;return new Promise(function(_0x482ad,_0x5e5fdc){return db[_0x0e70('0x16')][_0x0e70('0x17')]({'raw':_0x5300d6['options']?_0x5300d6[_0x0e70('0x18')][_0x0e70('0x19')]===undefined?!![]:![]:!![],'where':_0x5300d6[_0x0e70('0x18')]?_0x5300d6[_0x0e70('0x18')][_0x0e70('0x1a')]||null:null,'attributes':_0x5300d6[_0x0e70('0x18')]?_0x5300d6[_0x0e70('0x18')]['attributes']||null:null,'include':_0x5300d6[_0x0e70('0x18')]?_0x5300d6[_0x0e70('0x18')][_0x0e70('0x1b')]?_['map'](_0x5300d6[_0x0e70('0x18')]['include'],function(_0xc01490){return{'model':db[_0xc01490[_0x0e70('0x1c')]],'as':_0xc01490['as'],'attributes':_0xc01490[_0x0e70('0x1d')],'include':_0xc01490[_0x0e70('0x1b')]?_['map'](_0xc01490['include'],function(_0x260d1b){return{'model':db[_0x260d1b[_0x0e70('0x1c')]],'as':_0x260d1b['as'],'attributes':_0x260d1b[_0x0e70('0x1d')],'include':_0x260d1b[_0x0e70('0x1b')]?_['map'](_0x260d1b[_0x0e70('0x1b')],function(_0x42e20d){return{'model':db[_0x42e20d['model']],'as':_0x42e20d['as'],'attributes':_0x42e20d[_0x0e70('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0e70('0xb')](function(_0x48d979){logger['info'](_0x0e70('0x15'),_0x5300d6);logger[_0x0e70('0xe')](_0x0e70('0x15'),_0x5300d6,JSON[_0x0e70('0x1e')](_0x48d979));_0x482ad(_0x48d979);})[_0x0e70('0x14')](function(_0x150e45){logger[_0x0e70('0x11')]('ShowPause',_0x150e45[_0x0e70('0x13')],_0x5300d6);_0x5e5fdc(_0x536cda['error'](0x1f4,_0x150e45['message']));});});}; \ No newline at end of file +var _0x38e2=['moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Pause,\x20%s,\x20%s','result','catch','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','then','info','util'];(function(_0x4de003,_0x1677e9){var _0x2875b9=function(_0x686fda){while(--_0x686fda){_0x4de003['push'](_0x4de003['shift']());}};_0x2875b9(++_0x1677e9);}(_0x38e2,0xff));var _0x238e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x38e2[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0x238e('0x0'));var moment=require(_0x238e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x238e('0x2'));var db=require(_0x238e('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x238e('0x4'));var config=require(_0x238e('0x5'));var jayson=require(_0x238e('0x6'));var client=jayson[_0x238e('0x7')][_0x238e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d1ac1,_0x29f1fc,_0xe3694e){return new BPromise(function(_0x21fb2b,_0x4bd390){return client[_0x238e('0x9')](_0x5d1ac1,_0xe3694e)['then'](function(_0x3b3957){logger['info']('Pause,\x20%s,\x20%s',_0x29f1fc,_0x238e('0xa'));logger[_0x238e('0xb')](_0x238e('0xc'),_0x29f1fc,'request\x20sent',JSON[_0x238e('0xd')](_0x3b3957));if(_0x3b3957[_0x238e('0xe')]){if(_0x3b3957[_0x238e('0xe')][_0x238e('0xf')]===0x1f4){logger[_0x238e('0xe')]('Pause,\x20%s,\x20%s',_0x29f1fc,_0x3b3957[_0x238e('0xe')]['message']);return _0x4bd390(_0x3b3957[_0x238e('0xe')][_0x238e('0x10')]);}logger[_0x238e('0xe')](_0x238e('0x11'),_0x29f1fc,_0x3b3957[_0x238e('0xe')]['message']);return _0x21fb2b(_0x3b3957[_0x238e('0xe')][_0x238e('0x10')]);}else{logger['info']('Pause,\x20%s,\x20%s',_0x29f1fc,_0x238e('0xa'));_0x21fb2b(_0x3b3957[_0x238e('0x12')]['message']);}})[_0x238e('0x13')](function(_0x8034f2){logger[_0x238e('0xe')](_0x238e('0x11'),_0x29f1fc,_0x8034f2);_0x4bd390(_0x8034f2);});});}exports[_0x238e('0x14')]=function(_0x2127da){var _0x1ea75b=this;return new Promise(function(_0x350ca8,_0x4ed984){return db[_0x238e('0x15')][_0x238e('0x16')]({'raw':_0x2127da[_0x238e('0x17')]?_0x2127da[_0x238e('0x17')][_0x238e('0x18')]===undefined?!![]:![]:!![],'where':_0x2127da[_0x238e('0x17')]?_0x2127da[_0x238e('0x17')][_0x238e('0x19')]||null:null,'attributes':_0x2127da['options']?_0x2127da['options'][_0x238e('0x1a')]||null:null,'include':_0x2127da[_0x238e('0x17')]?_0x2127da[_0x238e('0x17')]['include']?_[_0x238e('0x1b')](_0x2127da[_0x238e('0x17')][_0x238e('0x1c')],function(_0x3fffff){return{'model':db[_0x3fffff[_0x238e('0x1d')]],'as':_0x3fffff['as'],'attributes':_0x3fffff[_0x238e('0x1a')],'include':_0x3fffff[_0x238e('0x1c')]?_[_0x238e('0x1b')](_0x3fffff[_0x238e('0x1c')],function(_0x1b4b9c){return{'model':db[_0x1b4b9c['model']],'as':_0x1b4b9c['as'],'attributes':_0x1b4b9c[_0x238e('0x1a')],'include':_0x1b4b9c[_0x238e('0x1c')]?_[_0x238e('0x1b')](_0x1b4b9c['include'],function(_0x2691bd){return{'model':db[_0x2691bd[_0x238e('0x1d')]],'as':_0x2691bd['as'],'attributes':_0x2691bd[_0x238e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x238e('0x1e')](function(_0x5e9c7e){logger[_0x238e('0x1f')]('ShowPause',_0x2127da);logger[_0x238e('0xb')](_0x238e('0x14'),_0x2127da,JSON[_0x238e('0xd')](_0x5e9c7e));_0x350ca8(_0x5e9c7e);})[_0x238e('0x13')](function(_0x517c29){logger['error']('ShowPause',_0x517c29[_0x238e('0x10')],_0x2127da);_0x4ed984(_0x1ea75b[_0x238e('0xe')](0x1f4,_0x517c29[_0x238e('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 9289946..f0d8922 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 _0x211d=['single','file','webhookPost','put','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','/webhook','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','post'];(function(_0x298582,_0x37cdd6){var _0x47ce4d=function(_0xaddc49){while(--_0xaddc49){_0x298582['push'](_0x298582['shift']());}};_0x47ce4d(++_0x37cdd6);}(_0x211d,0x186));var _0xd211=function(_0x57e6a8,_0x13a585){_0x57e6a8=_0x57e6a8-0x0;var _0x5e8420=_0x211d[_0x57e6a8];return _0x5e8420;};'use strict';var multer=require(_0xd211('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd211('0x1'));var express=require(_0xd211('0x2'));var router=express[_0xd211('0x3')]();var auth=require(_0xd211('0x4'));var interaction=require(_0xd211('0x5'));var config=require(_0xd211('0x6'));var controller=require(_0xd211('0x7'));router[_0xd211('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd211('0x8')](_0xd211('0x9'),controller['webhookGet']);router[_0xd211('0x8')](_0xd211('0xa'),auth[_0xd211('0xb')](),controller[_0xd211('0xc')]);router[_0xd211('0x8')](_0xd211('0xd'),auth[_0xd211('0xb')](),controller[_0xd211('0xe')]);var upload=multer({'storage':multer[_0xd211('0xf')]({'destination':function(_0x2798d1,_0x29ad19,_0x4b3237){_0x4b3237(null,path[_0xd211('0x10')](config[_0xd211('0x11')],_0xd211('0x12')));},'filename':function(_0x3f00bb,_0x437008,_0x2decb7){_0x437008[_0xd211('0x13')]=_0x437008['originalname'][_0xd211('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2decb7(null,util[_0xd211('0x15')](_0xd211('0x16'),path['basename'](_0x437008[_0xd211('0x13')],path[_0xd211('0x17')](_0x437008[_0xd211('0x13')])),Date[_0xd211('0x18')](),path[_0xd211('0x17')](_0x437008[_0xd211('0x13')])));}})});router[_0xd211('0x19')]('/',upload[_0xd211('0x1a')](_0xd211('0x1b')),controller['upload']);router[_0xd211('0x19')](_0xd211('0x9'),controller[_0xd211('0x1c')]);router[_0xd211('0x1d')](_0xd211('0xa'),auth[_0xd211('0xb')](),controller['update']);router[_0xd211('0x1e')](_0xd211('0xa'),auth[_0xd211('0xb')](),controller[_0xd211('0x1e')]);module[_0xd211('0x1f')]=router; \ No newline at end of file +var _0xfac2=['replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','update','delete','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','/:id/download','download','root','server/files/plugins','originalname'];(function(_0x53294d,_0x4868a2){var _0x4ebd0d=function(_0x5ca2de){while(--_0x5ca2de){_0x53294d['push'](_0x53294d['shift']());}};_0x4ebd0d(++_0x4868a2);}(_0xfac2,0xf6));var _0x2fac=function(_0x3d5a4d,_0x3f24f0){_0x3d5a4d=_0x3d5a4d-0x0;var _0x52c10a=_0xfac2[_0x3d5a4d];return _0x52c10a;};'use strict';var multer=require(_0x2fac('0x0'));var util=require(_0x2fac('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2fac('0x2'));var router=express[_0x2fac('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x2fac('0x4'));var config=require(_0x2fac('0x5'));var controller=require(_0x2fac('0x6'));router[_0x2fac('0x7')]('/',auth[_0x2fac('0x8')](),controller[_0x2fac('0x9')]);router['get'](_0x2fac('0xa'),controller[_0x2fac('0xb')]);router[_0x2fac('0x7')](_0x2fac('0xc'),auth[_0x2fac('0x8')](),controller['show']);router[_0x2fac('0x7')](_0x2fac('0xd'),auth['isAuthenticated'](),controller[_0x2fac('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x166f5b,_0x3f7677,_0x5c28e7){_0x5c28e7(null,path['join'](config[_0x2fac('0xf')],_0x2fac('0x10')));},'filename':function(_0x4132e0,_0xf575fd,_0x45a2ab){_0xf575fd[_0x2fac('0x11')]=_0xf575fd[_0x2fac('0x11')][_0x2fac('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x45a2ab(null,util[_0x2fac('0x13')](_0x2fac('0x14'),path[_0x2fac('0x15')](_0xf575fd[_0x2fac('0x11')],path[_0x2fac('0x16')](_0xf575fd[_0x2fac('0x11')])),Date[_0x2fac('0x17')](),path[_0x2fac('0x16')](_0xf575fd[_0x2fac('0x11')])));}})});router[_0x2fac('0x18')]('/',upload[_0x2fac('0x19')](_0x2fac('0x1a')),controller[_0x2fac('0x1b')]);router[_0x2fac('0x18')](_0x2fac('0xa'),controller[_0x2fac('0x1c')]);router[_0x2fac('0x1d')](_0x2fac('0xc'),auth[_0x2fac('0x8')](),controller[_0x2fac('0x1e')]);router[_0x2fac('0x1f')]('/:id',auth[_0x2fac('0x8')](),controller['delete']);module[_0x2fac('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 5b3e4f2..9112a62 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 _0x0edf=['exports','STRING','ENUM','html','script','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x0edf,0x83));var _0xf0ed=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x0edf[_0x4fde08];return _0x12e725;};'use strict';var Sequelize=require(_0xf0ed('0x0'));module[_0xf0ed('0x1')]={'name':{'type':Sequelize[_0xf0ed('0x2')]},'type':{'type':Sequelize[_0xf0ed('0x3')](_0xf0ed('0x4'),_0xf0ed('0x5'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xf0ed('0x2')],'comment':_0xf0ed('0x6')},'active':{'type':Sequelize[_0xf0ed('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM']('adminOnly',_0xf0ed('0x8'),_0xf0ed('0x9'),'never'),'defaultValue':_0xf0ed('0x9'),'comment':_0xf0ed('0xa')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xf0ed('0x2')]},'scriptName':{'type':Sequelize[_0xf0ed('0x2')]},'scriptPath':{'type':Sequelize[_0xf0ed('0x2')]}}; \ No newline at end of file +var _0xebc8=['adminOnly','always','never','sequelize','exports','STRING','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x3c4dad,_0x25ffd5){var _0x1a4f49=function(_0x6fe6c){while(--_0x6fe6c){_0x3c4dad['push'](_0x3c4dad['shift']());}};_0x1a4f49(++_0x25ffd5);}(_0xebc8,0x10b));var _0x8ebc=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xebc8[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0x8ebc('0x0'));module[_0x8ebc('0x1')]={'name':{'type':Sequelize[_0x8ebc('0x2')]},'type':{'type':Sequelize['ENUM'](_0x8ebc('0x3'),_0x8ebc('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x8ebc('0x5')]},'path':{'type':Sequelize[_0x8ebc('0x2')],'comment':_0x8ebc('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x8ebc('0x7')},'sidebar':{'type':Sequelize['ENUM'](_0x8ebc('0x8'),'agentOnly',_0x8ebc('0x9'),_0x8ebc('0xa')),'defaultValue':_0x8ebc('0x9'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x8ebc('0x2')]},'scriptName':{'type':Sequelize[_0x8ebc('0x2')]},'scriptPath':{'type':Sequelize[_0x8ebc('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index d149ec5..8d0d3e5 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 _0x56a1=['params','format','%s.zip','basename','createWriteStream','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','glob','join','server/files/plugins','dirname','node_modules/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','root','info','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','parse','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','role','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','encoding','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','hostname','method','%s%s','sendStatus','html-pdf','eml-format','request-promise','moment','bluebird','util','path','to-csv','lodash','desk.js','querystring','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','index','map','Plugin','rawAttributes','fieldName','type','key','query','keys','attributes','intersection','model','fields','nolimit','sort','where','pick','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','length','options','download','find'];(function(_0x33f6a9,_0x5e195c){var _0x36df01=function(_0x2225d9){while(--_0x2225d9){_0x33f6a9['push'](_0x33f6a9['shift']());}};_0x36df01(++_0x5e195c);}(_0x56a1,0x1a9));var _0x156a=function(_0x26a818,_0x40708a){_0x26a818=_0x26a818-0x0;var _0x5d8ca0=_0x56a1[_0x26a818];return _0x5d8ca0;};'use strict';var pdf=require(_0x156a('0x0'));var emlformat=require(_0x156a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x156a('0x2'));var moment=require(_0x156a('0x3'));var BPromise=require(_0x156a('0x4'));var Mustache=require('mustache');var util=require(_0x156a('0x5'));var path=require(_0x156a('0x6'));var sox=require('sox');var csv=require(_0x156a('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x156a('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x156a('0x9'));var toCsv=require(_0x156a('0x7'));var querystring=require(_0x156a('0xa'));var Papa=require(_0x156a('0xb'));var extract=require(_0x156a('0xc'));var rimraf=require(_0x156a('0xd'));var archiver=require(_0x156a('0xe'));var Redis=require(_0x156a('0xf'));var authService=require(_0x156a('0x10'));var qs=require(_0x156a('0x11'));var as=require(_0x156a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x156a('0x13'));var utils=require(_0x156a('0x14'));var config=require(_0x156a('0x15'));var licenseUtil=require(_0x156a('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x156a('0x17')](config[_0x156a('0x18')],{'host':_0x156a('0x19'),'port':0x18eb});var socket=require(_0x156a('0x1a'))(new Redis(config[_0x156a('0x18')]));require(_0x156a('0x1b'))[_0x156a('0x1c')](socket);function respondWithStatusCode(_0x763a44,_0x354ba6){_0x354ba6=_0x354ba6||0xcc;return function(_0x16ef7e){if(_0x16ef7e){return _0x763a44['sendStatus'](_0x354ba6);}return _0x763a44[_0x156a('0x1d')](_0x354ba6)[_0x156a('0x1e')]();};}function respondWithResult(_0x3d0410,_0x1b9b0c){_0x1b9b0c=_0x1b9b0c||0xc8;return function(_0x3aea35){if(_0x3aea35){return _0x3d0410[_0x156a('0x1d')](_0x1b9b0c)[_0x156a('0x1f')](_0x3aea35);}};}function respondWithFilteredResult(_0x25fcb8,_0xe07c96){return function(_0x1ca0a5){if(_0x1ca0a5){var _0x43613b=_0x1ca0a5['count'],_0x507d8f=_0xe07c96['offset'],_0x279b44=_0xe07c96[_0x156a('0x20')]+_0xe07c96[_0x156a('0x21')],_0x42a205;if(_0x279b44>=_0x43613b){_0x279b44=_0x43613b;_0x42a205=0xc8;}else{_0x42a205=0xce;}_0x25fcb8[_0x156a('0x1d')](_0x42a205);return _0x25fcb8[_0x156a('0x22')](_0x156a('0x23'),_0x507d8f+'-'+_0x279b44+'/'+_0x43613b)[_0x156a('0x1f')](_0x1ca0a5);}return null;};}function patchUpdates(_0x793772){return function(_0x462367){try{jsonpatch[_0x156a('0x24')](_0x462367,_0x793772,!![]);}catch(_0x39fec1){return BPromise[_0x156a('0x25')](_0x39fec1);}return _0x462367[_0x156a('0x26')]();};}function saveUpdates(_0x5cbcc5,_0x402ec4){return function(_0x24e957){if(_0x24e957){return _0x24e957[_0x156a('0x27')](_0x5cbcc5)[_0x156a('0x28')](function(_0x4832c7){return _0x4832c7;});}return null;};}function removeEntity(_0x3cfc7b,_0x2e8fe0){return function(_0x1e5c60){if(_0x1e5c60){return _0x1e5c60[_0x156a('0x29')]()[_0x156a('0x28')](function(){var _0x5b34b8=_0x1e5c60[_0x156a('0x2a')]({'plain':!![]});var _0x5a2858=_0x156a('0x2b');return db[_0x156a('0x2c')][_0x156a('0x29')]({'where':{'type':_0x5a2858,'resourceId':_0x5b34b8['id']}})[_0x156a('0x28')](function(){return _0x1e5c60;});})[_0x156a('0x28')](function(){_0x3cfc7b[_0x156a('0x1d')](0xcc)[_0x156a('0x1e')]();});}};}function handleEntityNotFound(_0x49c5b4,_0x2689ca){return function(_0x49edf3){if(!_0x49edf3){_0x49c5b4['sendStatus'](0x194);}return _0x49edf3;};}function handleError(_0x305377,_0x2ccc3d){_0x2ccc3d=_0x2ccc3d||0x1f4;return function(_0x4e1fae){logger[_0x156a('0x2d')](_0x4e1fae[_0x156a('0x2e')]);if(_0x4e1fae['name']){delete _0x4e1fae[_0x156a('0x2f')];}_0x305377[_0x156a('0x1d')](_0x2ccc3d)['send'](_0x4e1fae);};}exports[_0x156a('0x30')]=function(_0x3eb0c7,_0x4454db){var _0x51743f={},_0x1b89d1={},_0x337443={'count':0x0,'rows':[]};var _0x26d39c=_[_0x156a('0x31')](db[_0x156a('0x32')][_0x156a('0x33')],function(_0x50716a){return{'name':_0x50716a[_0x156a('0x34')],'type':_0x50716a[_0x156a('0x35')][_0x156a('0x36')]};});_0x1b89d1['model']=_[_0x156a('0x31')](_0x26d39c,'name');_0x1b89d1[_0x156a('0x37')]=_[_0x156a('0x38')](_0x3eb0c7[_0x156a('0x37')]);_0x1b89d1['filters']=_['intersection'](_0x1b89d1['model'],_0x1b89d1[_0x156a('0x37')]);_0x51743f[_0x156a('0x39')]=_[_0x156a('0x3a')](_0x1b89d1[_0x156a('0x3b')],qs[_0x156a('0x3c')](_0x3eb0c7[_0x156a('0x37')][_0x156a('0x3c')]));_0x51743f[_0x156a('0x39')]=_0x51743f[_0x156a('0x39')]['length']?_0x51743f['attributes']:_0x1b89d1['model'];if(!_0x3eb0c7[_0x156a('0x37')]['hasOwnProperty'](_0x156a('0x3d'))){_0x51743f['limit']=qs[_0x156a('0x21')](_0x3eb0c7[_0x156a('0x37')][_0x156a('0x21')]);_0x51743f[_0x156a('0x20')]=qs[_0x156a('0x20')](_0x3eb0c7['query']['offset']);}_0x51743f['order']=qs[_0x156a('0x3e')](_0x3eb0c7[_0x156a('0x37')][_0x156a('0x3e')]);_0x51743f[_0x156a('0x3f')]=qs['filters'](_[_0x156a('0x40')](_0x3eb0c7[_0x156a('0x37')],_0x1b89d1[_0x156a('0x41')]),_0x26d39c);if(_0x3eb0c7['query']['filter']){_0x51743f['where']=_[_0x156a('0x42')](_0x51743f[_0x156a('0x3f')],{'$or':_[_0x156a('0x31')](_0x26d39c,function(_0x467f21){if(_0x467f21[_0x156a('0x35')]!==_0x156a('0x43')){var _0x419fa4={};_0x419fa4[_0x467f21[_0x156a('0x2f')]]={'$like':'%'+_0x3eb0c7[_0x156a('0x37')][_0x156a('0x44')]+'%'};return _0x419fa4;}})});}_0x51743f=_[_0x156a('0x42')]({},_0x51743f,_0x3eb0c7['options']);var _0x51ae24={'where':_0x51743f[_0x156a('0x3f')]};return db[_0x156a('0x32')]['count'](_0x51ae24)[_0x156a('0x28')](function(_0x4ecc82){_0x337443['count']=_0x4ecc82;if(_0x3eb0c7[_0x156a('0x37')][_0x156a('0x45')]){_0x51743f[_0x156a('0x46')]=[{'all':!![]}];}return db[_0x156a('0x32')][_0x156a('0x47')](_0x51743f);})[_0x156a('0x28')](function(_0x2d4638){_0x337443[_0x156a('0x48')]=_0x2d4638;return _0x337443;})[_0x156a('0x28')](respondWithFilteredResult(_0x4454db,_0x51743f))[_0x156a('0x49')](handleError(_0x4454db,null));};exports[_0x156a('0x4a')]=function(_0x386080,_0x2f5130){var _0x33c4cf={'raw':!![],'where':{'id':_0x386080['params']['id']}},_0x13ba43={};_0x13ba43[_0x156a('0x3b')]=_['keys'](db[_0x156a('0x32')][_0x156a('0x33')]);_0x13ba43[_0x156a('0x37')]=_[_0x156a('0x38')](_0x386080[_0x156a('0x37')]);_0x13ba43[_0x156a('0x41')]=_[_0x156a('0x3a')](_0x13ba43[_0x156a('0x3b')],_0x13ba43[_0x156a('0x37')]);_0x33c4cf[_0x156a('0x39')]=_[_0x156a('0x3a')](_0x13ba43['model'],qs[_0x156a('0x3c')](_0x386080[_0x156a('0x37')]['fields']));_0x33c4cf[_0x156a('0x39')]=_0x33c4cf['attributes'][_0x156a('0x4b')]?_0x33c4cf[_0x156a('0x39')]:_0x13ba43[_0x156a('0x3b')];if(_0x386080[_0x156a('0x37')]['includeAll']){_0x33c4cf[_0x156a('0x46')]=[{'all':!![]}];}_0x33c4cf=_[_0x156a('0x42')]({},_0x33c4cf,_0x386080[_0x156a('0x4c')]);return db[_0x156a('0x32')]['find'](_0x33c4cf)[_0x156a('0x28')](handleEntityNotFound(_0x2f5130,null))[_0x156a('0x28')](respondWithResult(_0x2f5130,null))[_0x156a('0x49')](handleError(_0x2f5130,null));};exports[_0x156a('0x4d')]=function(_0x18b4be,_0x219662,_0x281513){return db['Plugin'][_0x156a('0x4e')]({'where':{'id':_0x18b4be[_0x156a('0x4f')]['id']},'attributes':[_0x156a('0x2f'),'path'],'raw':!![]})[_0x156a('0x28')](handleEntityNotFound(_0x219662,null))[_0x156a('0x28')](function(_0x4382be){if(_0x4382be){var _0xa9c98c=path['join'](config['root'],'server/files/plugins',util[_0x156a('0x50')](_0x156a('0x51'),path[_0x156a('0x52')](_0x4382be[_0x156a('0x6')])));var _0x231488=fs[_0x156a('0x53')](_0xa9c98c);var _0x49e678=archiver('zip',{'zlib':{'level':0x9}});_0x49e678['on'](_0x156a('0x54'),function(_0x228e2a){if(_0x228e2a[_0x156a('0x55')]===_0x156a('0x56')){logger[_0x156a('0x2d')](_0x228e2a);}else{throw new db['Sequelize'][(_0x156a('0x57'))](_0x156a('0x58'));}});_0x49e678['on']('error',function(_0x474b6b){throw new db[(_0x156a('0x59'))][(_0x156a('0x57'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x49e678['pipe'](_0x231488);_0x49e678[_0x156a('0x5a')]('**/*',{'cwd':path[_0x156a('0x5b')](config['root'],_0x156a('0x5c'),path[_0x156a('0x5d')](_0x4382be[_0x156a('0x6')])),'ignore':[path[_0x156a('0x5b')](path[_0x156a('0x52')](_0x4382be[_0x156a('0x6')]),_0x156a('0x5e')),path[_0x156a('0x5b')](path['basename'](_0x4382be['path']),'attachments/**/*')],'nodir':!![]})[_0x156a('0x5f')]();_0x231488['on'](_0x156a('0x60'),function(){if(!fs[_0x156a('0x61')](_0xa9c98c)){throw new db[(_0x156a('0x59'))][(_0x156a('0x57'))](_0x156a('0x62'));}return _0x219662[_0x156a('0x4d')](_0xa9c98c,util[_0x156a('0x50')](_0x156a('0x51'),path[_0x156a('0x52')](_0x4382be[_0x156a('0x6')])),function(_0x482f39){if(_0x482f39){throw new db[(_0x156a('0x59'))][(_0x156a('0x57'))](_0x156a('0x63'));}fs[_0x156a('0x64')](_0xa9c98c);logger['info'](_0x156a('0x65'));logger['info'](_0x156a('0x66'));});});}return null;})[_0x156a('0x49')](handleError(_0x219662,null));};exports[_0x156a('0x67')]=function(_0x79f547,_0x188ba7,_0x19e1f5){var _0xbf7f82=path[_0x156a('0x52')](_0x79f547[_0x156a('0x68')][_0x156a('0x69')],path[_0x156a('0x6a')](_0x79f547['file'][_0x156a('0x69')]));var _0x4e16ab=path['join'](config['root'],'server/files/plugins',_0x79f547[_0x156a('0x68')][_0x156a('0x69')]);var _0x3c7d0d=path[_0x156a('0x5b')](config[_0x156a('0x6b')],_0x156a('0x5c'),_0xbf7f82);logger[_0x156a('0x6c')]('Plugin\x20upload\x20filepath:\x20%s',_0x4e16ab);logger[_0x156a('0x6c')](_0x156a('0x6d'),_0x3c7d0d);try{fs[_0x156a('0x6e')](_0x4e16ab,parseInt(_0x156a('0x6f'),0x8));extract(_0x4e16ab,{'dir':_0x3c7d0d},function(_0x30f2b4){if(_0x30f2b4){logger[_0x156a('0x2d')](_0x30f2b4);handleError(_0x30f2b4,!![]);};var _0x442b41=fs[_0x156a('0x70')](_0x3c7d0d);if(_0x442b41[_0x156a('0x4b')]>0x1){removeReferences(_0x4e16ab,_0x3c7d0d);logger[_0x156a('0x2d')](_0x156a('0x71'));return _0x19e1f5(new Error(_0x156a('0x71')));}var _0x312629=fs[_0x156a('0x72')](path[_0x156a('0x5b')](_0x3c7d0d,_0x442b41[0x0]));if(_0x312629[_0x156a('0x73')]()){removeReferences(_0x4e16ab,_0x3c7d0d);logger[_0x156a('0x2d')]('Invalid\x20plugin\x20structure');return _0x19e1f5(new Error(_0x156a('0x71')));}if(_0x312629[_0x156a('0x74')]()){var _0x37f564=fs[_0x156a('0x70')](path[_0x156a('0x5b')](_0x3c7d0d,_0x442b41[0x0]));if(_0x37f564[_0x156a('0x4b')]===0x0){removeReferences(_0x4e16ab,_0x3c7d0d);logger[_0x156a('0x2d')](_0x156a('0x71'));return _0x19e1f5(new Error(_0x156a('0x71')));}var _0x283b3c=_0x37f564[_0x156a('0x75')](function(_0x1929e7){return _0x1929e7===_0x156a('0x76');});if(!_0x283b3c){return _0x19e1f5(new Error('Plugin\x20manifest\x20missing'));}var _0x305083=fs['readFileSync'](path[_0x156a('0x5b')](_0x3c7d0d,_0x442b41[0x0],_0x156a('0x76')));var _0x4ef1b2=JSON[_0x156a('0x77')](_0x305083);if('undefined'==typeof _0x4ef1b2[_0x156a('0x2f')]){return _0x19e1f5(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x156a('0x78')==typeof _0x4ef1b2['type']){return _0x19e1f5(new Error(_0x156a('0x79')));}if(_0x156a('0x78')==typeof _0x4ef1b2[_0x156a('0x7a')]){return _0x19e1f5(new Error(_0x156a('0x7b')));}if('undefined'==typeof _0x4ef1b2[_0x156a('0x7c')]){return _0x19e1f5(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x4ef1b2['type']==='html'){if('undefined'==typeof _0x4ef1b2[_0x156a('0x7c')]['views']){return _0x19e1f5(new Error(_0x156a('0x7d')));}if(_0x156a('0x78')==typeof _0x4ef1b2[_0x156a('0x7c')][_0x156a('0x7e')][_0x156a('0x7f')]&&'undefined'==typeof _0x4ef1b2[_0x156a('0x7c')][_0x156a('0x7e')][_0x156a('0x80')]){return _0x19e1f5(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x4ef1b2[_0x156a('0x35')]==='script'){if(_0x156a('0x78')==typeof _0x4ef1b2[_0x156a('0x7c')]['scriptName']){return _0x19e1f5(new Error(_0x156a('0x81')));}if(_0x156a('0x78')==typeof _0x4ef1b2[_0x156a('0x7c')]['scriptPath']){return _0x19e1f5(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x19e1f5(new Error(_0x156a('0x82')));}var _0x441721=_0x4ef1b2[_0x156a('0x2f')];var _0x3f327f=_0x4ef1b2[_0x156a('0x83')];var _0x5d1af2=_0x4ef1b2[_0x156a('0x35')];var _0x11460f=_0x4ef1b2[_0x156a('0x84')]?_0x4ef1b2['sidebar']:_0x156a('0x85');var _0x22867b=_0x4ef1b2[_0x156a('0x86')]?_0x4ef1b2[_0x156a('0x86')]:_0x156a('0x87');var _0x204662='';var _0x18884e='';var _0x22de24='';var _0x50767a='';var _0x21d293=_0x4ef1b2['version'];if(_0x5d1af2==='html'){if('undefined'!=typeof _0x4ef1b2[_0x156a('0x7c')]['views'][_0x156a('0x7f')]){var _0x58dcd1=_0x4ef1b2[_0x156a('0x7c')]['views'][_0x156a('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x156a('0x88')](_0x58dcd1)){_0x204662=path[_0x156a('0x5b')](_0x156a('0x89'),_0xbf7f82,_0x442b41[0x0],_0x58dcd1);}else{_0x204662=_0x58dcd1;}}else{logger[_0x156a('0x6c')](_0x156a('0x8a'));}if(_0x156a('0x78')!=typeof _0x4ef1b2[_0x156a('0x7c')][_0x156a('0x7e')][_0x156a('0x80')]){var _0x5b5bca=_0x4ef1b2[_0x156a('0x7c')][_0x156a('0x7e')][_0x156a('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x5b5bca)){_0x18884e=path[_0x156a('0x5b')](_0x156a('0x89'),_0xbf7f82,_0x442b41[0x0],_0x5b5bca);}else{_0x18884e=_0x5b5bca;}}else{logger[_0x156a('0x6c')](_0x156a('0x8b'));}}else if(_0x5d1af2==='script'){_0x22de24=_0x4ef1b2[_0x156a('0x7c')]['scriptName'];_0x50767a=_0x4ef1b2[_0x156a('0x7c')][_0x156a('0x8c')];if('undefined'!=typeof _0x4ef1b2['parameters']['views']){if(_0x156a('0x78')!=typeof _0x4ef1b2[_0x156a('0x7c')][_0x156a('0x7e')][_0x156a('0x7f')]){var _0x58dcd1=_0x4ef1b2['parameters']['views'][_0x156a('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x156a('0x88')](_0x58dcd1)){_0x204662=path[_0x156a('0x5b')](_0x156a('0x89'),_0xbf7f82,_0x442b41[0x0],_0x58dcd1);}else{_0x204662=_0x58dcd1;}}if(_0x156a('0x78')!=typeof _0x4ef1b2['parameters'][_0x156a('0x7e')][_0x156a('0x80')]){var _0x5b5bca=_0x4ef1b2[_0x156a('0x7c')][_0x156a('0x7e')][_0x156a('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x156a('0x88')](_0x5b5bca)){_0x18884e=path[_0x156a('0x5b')]('plugins',_0xbf7f82,_0x442b41[0x0],_0x5b5bca);}else{_0x18884e=_0x5b5bca;}}}}var _0x38f86b={'name':_0x441721,'description':_0x3f327f,'path':path[_0x156a('0x5b')](_0xbf7f82,_0x442b41[0x0]),'type':_0x5d1af2,'sidebar':_0x11460f,'icon':_0x22867b,'adminUrl':_0x204662,'agentUrl':_0x18884e,'scriptName':_0x22de24,'scriptPath':_0x50767a,'version':_0x21d293};removeReferences(_0x4e16ab,null);return db[_0x156a('0x32')][_0x156a('0x8d')](_0x38f86b)[_0x156a('0x28')](function(_0x52d373){var _0x3f03e6={'role':_0x79f547['body'][_0x156a('0x8e')],'userProfileId':_0x79f547[_0x156a('0x8f')]['userProfileId']};if(!_0x3f03e6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f03e6[_0x156a('0x8e')]===_0x156a('0x90')){var _0x5f42c6=_0x52d373[_0x156a('0x2a')]({'plain':!![]});return db[_0x156a('0x91')]['find']({'where':{'name':'Plugins','userProfileId':_0x3f03e6[_0x156a('0x92')]},'raw':!![]})[_0x156a('0x28')](function(_0x50a461){if(_0x50a461&&_0x50a461[_0x156a('0x93')]===0x0){return db['UserProfileResource'][_0x156a('0x8d')]({'name':_0x5f42c6[_0x156a('0x2f')],'resourceId':_0x5f42c6['id'],'type':_0x50a461[_0x156a('0x2f')],'sectionId':_0x50a461['id']},{})[_0x156a('0x28')](function(){return _0x52d373;});}else{return _0x52d373;}})[_0x156a('0x49')](function(_0x4ef149){logger[_0x156a('0x2d')](_0x156a('0x94'),_0x4ef149);throw _0x4ef149;});}return _0x52d373;})['then'](respondWithResult(_0x188ba7,null))[_0x156a('0x49')](handleError(_0x188ba7,null));}});}catch(_0xb2203f){_0x188ba7[_0x156a('0x1d')](0x1f4)[_0x156a('0x95')](_0xb2203f);}};function removeReferences(_0x115dfa,_0x17a6da){try{if(_0x115dfa){fs[_0x156a('0x64')](_0x115dfa);logger[_0x156a('0x6c')]('Zip\x20archive\x20removed');}if(_0x17a6da){rimraf(_0x17a6da,function(){});logger[_0x156a('0x6c')]('Extracted\x20folder\x20removed');}}catch(_0x361710){logger[_0x156a('0x2d')](_0x361710);}}exports['update']=function(_0x4d4d9a,_0x1e91c4,_0x18217d){return db[_0x156a('0x32')][_0x156a('0x4e')]({'where':{'id':_0x4d4d9a[_0x156a('0x4f')]['id']}})[_0x156a('0x28')](handleEntityNotFound(_0x1e91c4,null))['then'](saveUpdates(_0x4d4d9a[_0x156a('0x8f')],null))[_0x156a('0x28')](respondWithResult(_0x1e91c4,null))[_0x156a('0x49')](handleError(_0x1e91c4,null));};exports[_0x156a('0x96')]=function(_0xcfc91f,_0xdaadb,_0x248ee1){return db[_0x156a('0x32')][_0x156a('0x4e')]({'where':{'id':_0xcfc91f[_0x156a('0x4f')]['id']}})[_0x156a('0x28')](function(_0x2c7ee8){if(_0x2c7ee8){return _0x2c7ee8[_0x156a('0x29')]();}})[_0x156a('0x28')](function(_0x1a3da6){rimraf(path[_0x156a('0x5b')](config[_0x156a('0x6b')],'server/files/plugins',path[_0x156a('0x5d')](_0x1a3da6[_0x156a('0x6')])),function(){});return _0x1a3da6;})[_0x156a('0x28')](handleEntityNotFound(_0xdaadb,null))[_0x156a('0x28')](respondWithStatusCode(_0xdaadb,null))['catch'](handleError(_0xdaadb,null));};exports[_0x156a('0x97')]=function(_0x6020fb,_0x4354da,_0x394780){return BPromise['resolve']()[_0x156a('0x28')](function(){if(!_0x6020fb[_0x156a('0x37')]['path']){throw new Error(_0x156a('0x98'));}if(!_0x6020fb[_0x156a('0x37')][_0x156a('0x99')]){throw new Error(_0x156a('0x9a'));}var _0x5f6832=_0x6020fb[_0x156a('0x37')]['hostname']?_0x6020fb['query']['hostname']+':'+_0x6020fb[_0x156a('0x37')]['port']:_0x156a('0x9b')+_0x6020fb['query'][_0x156a('0x99')];var _0x263690=_0x6020fb['query'][_0x156a('0x1f')]?_0x6020fb[_0x156a('0x37')][_0x156a('0x1f')]:!![];var _0x16239d=_0x6020fb[_0x156a('0x37')][_0x156a('0x9c')]?_0x6020fb[_0x156a('0x37')][_0x156a('0x9c')]:null;var _0x4c141a={'method':_0x6020fb['method'],'uri':util['format']('%s%s',_0x5f6832,_0x6020fb[_0x156a('0x37')][_0x156a('0x6')]),'json':_0x263690,'resolveWithFullResponse':!![],'encoding':_0x16239d,'qs':_0x6020fb[_0x156a('0x37')]};if(_0x6020fb[_0x156a('0x9d')]){_0x4c141a[_0x156a('0x9d')]=_0x6020fb[_0x156a('0x9d')];if(_0x4c141a[_0x156a('0x9d')][_0x156a('0x9e')]){delete _0x4c141a[_0x156a('0x9d')][_0x156a('0x9e')];}}if(_0x4c141a['headers'][_0x156a('0x9f')]){delete _0x4c141a[_0x156a('0x9d')]['content-type'];}return rp(_0x4c141a);})[_0x156a('0x28')](function(_0x50b119){if(_0x50b119){_0x4354da[_0x156a('0x22')](_0x50b119['headers']);logger[_0x156a('0x6c')](_0x50b119['body']);if(_[_0x156a('0xa0')](_0x6020fb['query'][_0x156a('0x6')],_0x156a('0x4d'))&&_0x50b119['statusCode']==0x1f4){return _0x4354da['sendStatus'](_0x50b119[_0x156a('0xa1')]);}else{return _0x4354da[_0x156a('0x1d')](_0x50b119[_0x156a('0xa1')])[_0x156a('0x95')](_0x50b119[_0x156a('0x8f')]);}}else{return _0x4354da['sendStatus'](0xc8);}})[_0x156a('0x49')](handleError(_0x4354da,null));};exports[_0x156a('0xa2')]=function(_0x5f159d,_0x37777f,_0x3ee356){return BPromise[_0x156a('0xa3')]()[_0x156a('0x28')](function(){if(!_0x5f159d['query'][_0x156a('0x6')]){throw new Error(_0x156a('0x98'));}if(!_0x5f159d[_0x156a('0x37')][_0x156a('0x99')]){throw new Error(_0x156a('0x9a'));}var _0x189e1a=_0x5f159d['query'][_0x156a('0xa4')]?_0x5f159d['query']['hostname']+':'+_0x5f159d['query'][_0x156a('0x99')]:'http://localhost:'+_0x5f159d[_0x156a('0x37')][_0x156a('0x99')];var _0x20d354=_0x5f159d['query']['json']?_0x5f159d[_0x156a('0x37')][_0x156a('0x1f')]:!![];var _0x3337e7=_0x5f159d[_0x156a('0x37')][_0x156a('0x9c')]?_0x5f159d[_0x156a('0x37')][_0x156a('0x9c')]:null;var _0x2babfb={'method':_0x5f159d[_0x156a('0xa5')],'uri':util[_0x156a('0x50')](_0x156a('0xa6'),_0x189e1a,_0x5f159d[_0x156a('0x37')][_0x156a('0x6')]),'json':_0x20d354,'resolveWithFullResponse':!![],'encoding':_0x3337e7,'body':_0x5f159d[_0x156a('0x8f')]};if(_0x5f159d[_0x156a('0x9d')]){_0x2babfb[_0x156a('0x9d')]=_0x5f159d[_0x156a('0x9d')];if(_0x2babfb[_0x156a('0x9d')][_0x156a('0x9e')]){delete _0x2babfb[_0x156a('0x9d')][_0x156a('0x9e')];}}if(_0x2babfb['headers'][_0x156a('0x9f')]){delete _0x2babfb[_0x156a('0x9d')]['content-type'];}return rp(_0x2babfb);})[_0x156a('0x28')](function(_0x47977c){if(_0x47977c){_0x37777f[_0x156a('0x22')](_0x47977c['headers']);logger['info'](_0x47977c[_0x156a('0x8f')]);return _0x37777f[_0x156a('0x1d')](_0x47977c[_0x156a('0xa1')])['send'](_0x47977c[_0x156a('0x8f')]);}else{return _0x37777f[_0x156a('0xa7')](0xc8);}})[_0x156a('0x49')](handleError(_0x37777f,null));}; \ No newline at end of file +var _0x0058=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','count','offset','set','Content-Range','json','apply','update','then','get','Plugins','UserProfileResource','stack','send','Plugin','fieldName','key','model','map','name','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','options','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','find','download','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','error','pipe','**/*','attachments/**/*','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','Invalid\x20manifest:\x20views\x20missing','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','always','icon','version','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','statusCode','webhookPost','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0x0058,0x13f));var _0x8005=function(_0x41b009,_0x576295){_0x41b009=_0x41b009-0x0;var _0x5e8660=_0x0058[_0x41b009];return _0x5e8660;};'use strict';var pdf=require(_0x8005('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8005('0x1'));var zipdir=require(_0x8005('0x2'));var jsonpatch=require(_0x8005('0x3'));var rp=require(_0x8005('0x4'));var moment=require(_0x8005('0x5'));var BPromise=require(_0x8005('0x6'));var Mustache=require(_0x8005('0x7'));var util=require(_0x8005('0x8'));var path=require(_0x8005('0x9'));var sox=require('sox');var csv=require(_0x8005('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8005('0xb'));var squel=require(_0x8005('0xc'));var crypto=require(_0x8005('0xd'));var jsforce=require(_0x8005('0xe'));var deskjs=require(_0x8005('0xf'));var toCsv=require(_0x8005('0xa'));var querystring=require(_0x8005('0x10'));var Papa=require(_0x8005('0x11'));var extract=require(_0x8005('0x12'));var rimraf=require(_0x8005('0x1'));var archiver=require(_0x8005('0x13'));var Redis=require(_0x8005('0x14'));var authService=require(_0x8005('0x15'));var qs=require(_0x8005('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8005('0x17'));var logger=require(_0x8005('0x18'))(_0x8005('0x19'));var utils=require(_0x8005('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8005('0x1b'))['db'];config['redis']=_[_0x8005('0x1c')](config[_0x8005('0x1d')],{'host':_0x8005('0x1e'),'port':0x18eb});var socket=require(_0x8005('0x1f'))(new Redis(config[_0x8005('0x1d')]));require(_0x8005('0x20'))[_0x8005('0x21')](socket);function respondWithStatusCode(_0xe09678,_0x411c9a){_0x411c9a=_0x411c9a||0xcc;return function(_0x5a821d){if(_0x5a821d){return _0xe09678[_0x8005('0x22')](_0x411c9a);}return _0xe09678[_0x8005('0x23')](_0x411c9a)[_0x8005('0x24')]();};}function respondWithResult(_0x4a8f81,_0x4d2dd7){_0x4d2dd7=_0x4d2dd7||0xc8;return function(_0x3367ca){if(_0x3367ca){return _0x4a8f81['status'](_0x4d2dd7)['json'](_0x3367ca);}};}function respondWithFilteredResult(_0x1e2d89,_0x47a474){return function(_0x151e7f){if(_0x151e7f){var _0x2e87f6=_0x151e7f[_0x8005('0x25')],_0x58cc3d=_0x47a474[_0x8005('0x26')],_0x591b03=_0x47a474[_0x8005('0x26')]+_0x47a474['limit'],_0x4a6508;if(_0x591b03>=_0x2e87f6){_0x591b03=_0x2e87f6;_0x4a6508=0xc8;}else{_0x4a6508=0xce;}_0x1e2d89[_0x8005('0x23')](_0x4a6508);return _0x1e2d89[_0x8005('0x27')](_0x8005('0x28'),_0x58cc3d+'-'+_0x591b03+'/'+_0x2e87f6)[_0x8005('0x29')](_0x151e7f);}return null;};}function patchUpdates(_0x230131){return function(_0x41858a){try{jsonpatch[_0x8005('0x2a')](_0x41858a,_0x230131,!![]);}catch(_0x21b46d){return BPromise['reject'](_0x21b46d);}return _0x41858a['save']();};}function saveUpdates(_0x192b41,_0x1df94d){return function(_0x33ba51){if(_0x33ba51){return _0x33ba51[_0x8005('0x2b')](_0x192b41)['then'](function(_0x54287d){return _0x54287d;});}return null;};}function removeEntity(_0x3493c1,_0x7871b4){return function(_0x31b439){if(_0x31b439){return _0x31b439['destroy']()[_0x8005('0x2c')](function(){var _0x343fce=_0x31b439[_0x8005('0x2d')]({'plain':!![]});var _0x8e5856=_0x8005('0x2e');return db[_0x8005('0x2f')]['destroy']({'where':{'type':_0x8e5856,'resourceId':_0x343fce['id']}})['then'](function(){return _0x31b439;});})[_0x8005('0x2c')](function(){_0x3493c1[_0x8005('0x23')](0xcc)[_0x8005('0x24')]();});}};}function handleEntityNotFound(_0x148958,_0x246ba5){return function(_0x5e7790){if(!_0x5e7790){_0x148958['sendStatus'](0x194);}return _0x5e7790;};}function handleError(_0x346481,_0x5719b7){_0x5719b7=_0x5719b7||0x1f4;return function(_0x5ef058){logger['error'](_0x5ef058[_0x8005('0x30')]);if(_0x5ef058['name']){delete _0x5ef058['name'];}_0x346481[_0x8005('0x23')](_0x5719b7)[_0x8005('0x31')](_0x5ef058);};}exports['index']=function(_0x244315,_0x54fa56){var _0x3819e4={},_0x32d8b1={},_0x2c4ffb={'count':0x0,'rows':[]};var _0x3df60e=_['map'](db[_0x8005('0x32')]['rawAttributes'],function(_0x4b791f){return{'name':_0x4b791f[_0x8005('0x33')],'type':_0x4b791f['type'][_0x8005('0x34')]};});_0x32d8b1[_0x8005('0x35')]=_[_0x8005('0x36')](_0x3df60e,_0x8005('0x37'));_0x32d8b1['query']=_['keys'](_0x244315[_0x8005('0x38')]);_0x32d8b1['filters']=_[_0x8005('0x39')](_0x32d8b1['model'],_0x32d8b1[_0x8005('0x38')]);_0x3819e4[_0x8005('0x3a')]=_[_0x8005('0x39')](_0x32d8b1[_0x8005('0x35')],qs[_0x8005('0x3b')](_0x244315[_0x8005('0x38')][_0x8005('0x3b')]));_0x3819e4[_0x8005('0x3a')]=_0x3819e4['attributes'][_0x8005('0x3c')]?_0x3819e4[_0x8005('0x3a')]:_0x32d8b1[_0x8005('0x35')];if(!_0x244315[_0x8005('0x38')][_0x8005('0x3d')](_0x8005('0x3e'))){_0x3819e4[_0x8005('0x3f')]=qs[_0x8005('0x3f')](_0x244315[_0x8005('0x38')][_0x8005('0x3f')]);_0x3819e4['offset']=qs[_0x8005('0x26')](_0x244315[_0x8005('0x38')]['offset']);}_0x3819e4[_0x8005('0x40')]=qs[_0x8005('0x41')](_0x244315['query'][_0x8005('0x41')]);_0x3819e4[_0x8005('0x42')]=qs[_0x8005('0x43')](_[_0x8005('0x44')](_0x244315[_0x8005('0x38')],_0x32d8b1[_0x8005('0x43')]),_0x3df60e);if(_0x244315[_0x8005('0x38')][_0x8005('0x45')]){_0x3819e4[_0x8005('0x42')]=_[_0x8005('0x46')](_0x3819e4[_0x8005('0x42')],{'$or':_[_0x8005('0x36')](_0x3df60e,function(_0x197acc){if(_0x197acc[_0x8005('0x47')]!=='VIRTUAL'){var _0x3c20dc={};_0x3c20dc[_0x197acc['name']]={'$like':'%'+_0x244315['query'][_0x8005('0x45')]+'%'};return _0x3c20dc;}})});}_0x3819e4=_[_0x8005('0x46')]({},_0x3819e4,_0x244315[_0x8005('0x48')]);var _0x3ef11b={'where':_0x3819e4[_0x8005('0x42')]};return db['Plugin'][_0x8005('0x25')](_0x3ef11b)['then'](function(_0x57fe7c){_0x2c4ffb[_0x8005('0x25')]=_0x57fe7c;if(_0x244315['query']['includeAll']){_0x3819e4[_0x8005('0x49')]=[{'all':!![]}];}return db[_0x8005('0x32')][_0x8005('0x4a')](_0x3819e4);})[_0x8005('0x2c')](function(_0x4bab09){_0x2c4ffb[_0x8005('0x4b')]=_0x4bab09;return _0x2c4ffb;})[_0x8005('0x2c')](respondWithFilteredResult(_0x54fa56,_0x3819e4))[_0x8005('0x4c')](handleError(_0x54fa56,null));};exports[_0x8005('0x4d')]=function(_0x473f13,_0x4b0400){var _0x57cd80={'raw':!![],'where':{'id':_0x473f13[_0x8005('0x4e')]['id']}},_0x2a99e7={};_0x2a99e7[_0x8005('0x35')]=_[_0x8005('0x4f')](db[_0x8005('0x32')][_0x8005('0x50')]);_0x2a99e7[_0x8005('0x38')]=_[_0x8005('0x4f')](_0x473f13[_0x8005('0x38')]);_0x2a99e7[_0x8005('0x43')]=_['intersection'](_0x2a99e7['model'],_0x2a99e7['query']);_0x57cd80['attributes']=_[_0x8005('0x39')](_0x2a99e7[_0x8005('0x35')],qs[_0x8005('0x3b')](_0x473f13[_0x8005('0x38')][_0x8005('0x3b')]));_0x57cd80[_0x8005('0x3a')]=_0x57cd80['attributes']['length']?_0x57cd80[_0x8005('0x3a')]:_0x2a99e7[_0x8005('0x35')];if(_0x473f13['query'][_0x8005('0x51')]){_0x57cd80[_0x8005('0x49')]=[{'all':!![]}];}_0x57cd80=_['merge']({},_0x57cd80,_0x473f13[_0x8005('0x48')]);return db[_0x8005('0x32')][_0x8005('0x52')](_0x57cd80)[_0x8005('0x2c')](handleEntityNotFound(_0x4b0400,null))[_0x8005('0x2c')](respondWithResult(_0x4b0400,null))['catch'](handleError(_0x4b0400,null));};exports[_0x8005('0x53')]=function(_0x3d683a,_0x200ad8,_0xe43ea9){return db[_0x8005('0x32')][_0x8005('0x52')]({'where':{'id':_0x3d683a['params']['id']},'attributes':[_0x8005('0x37'),_0x8005('0x9')],'raw':!![]})[_0x8005('0x2c')](handleEntityNotFound(_0x200ad8,null))[_0x8005('0x2c')](function(_0x190a95){if(_0x190a95){var _0x49e9ad=path[_0x8005('0x54')](config[_0x8005('0x55')],_0x8005('0x56'),util[_0x8005('0x57')](_0x8005('0x58'),path[_0x8005('0x59')](_0x190a95[_0x8005('0x9')])));var _0x18a1e7=fs[_0x8005('0x5a')](_0x49e9ad);var _0x51188f=archiver(_0x8005('0x5b'),{'zlib':{'level':0x9}});_0x51188f['on'](_0x8005('0x5c'),function(_0x5b17dc){if(_0x5b17dc[_0x8005('0x5d')]==='ENOENT'){logger['error'](_0x5b17dc);}else{throw new db[(_0x8005('0x5e'))][(_0x8005('0x5f'))](_0x8005('0x60'));}});_0x51188f['on'](_0x8005('0x61'),function(_0x79b398){throw new db['Sequelize'][(_0x8005('0x5f'))](_0x8005('0x60'));});_0x51188f[_0x8005('0x62')](_0x18a1e7);_0x51188f['glob'](_0x8005('0x63'),{'cwd':path['join'](config[_0x8005('0x55')],_0x8005('0x56'),path['dirname'](_0x190a95[_0x8005('0x9')])),'ignore':[path[_0x8005('0x54')](path[_0x8005('0x59')](_0x190a95['path']),'node_modules/**/*'),path[_0x8005('0x54')](path[_0x8005('0x59')](_0x190a95[_0x8005('0x9')]),_0x8005('0x64'))],'nodir':!![]})['finalize']();_0x18a1e7['on'](_0x8005('0x65'),function(){if(!fs[_0x8005('0x66')](_0x49e9ad)){throw new db[(_0x8005('0x5e'))]['Error'](_0x8005('0x67'));}return _0x200ad8[_0x8005('0x53')](_0x49e9ad,util[_0x8005('0x57')](_0x8005('0x58'),path[_0x8005('0x59')](_0x190a95[_0x8005('0x9')])),function(_0xe84323){if(_0xe84323){throw new db[(_0x8005('0x5e'))][(_0x8005('0x5f'))](_0x8005('0x68'));}fs[_0x8005('0x69')](_0x49e9ad);logger[_0x8005('0x6a')](_0x8005('0x6b'));logger[_0x8005('0x6a')](_0x8005('0x6c'));});});}return null;})['catch'](handleError(_0x200ad8,null));};exports[_0x8005('0x6d')]=function(_0x467924,_0x2f7881,_0x116d4e){var _0x347533=path['basename'](_0x467924[_0x8005('0x6e')]['filename'],path[_0x8005('0x6f')](_0x467924[_0x8005('0x6e')][_0x8005('0x70')]));var _0x4cd4b7=path['join'](config[_0x8005('0x55')],'server/files/plugins',_0x467924[_0x8005('0x6e')]['filename']);var _0x25ec37=path['join'](config[_0x8005('0x55')],'server/files/plugins',_0x347533);logger['info'](_0x8005('0x71'),_0x4cd4b7);logger[_0x8005('0x6a')](_0x8005('0x72'),_0x25ec37);try{fs[_0x8005('0x73')](_0x4cd4b7,parseInt(_0x8005('0x74'),0x8));extract(_0x4cd4b7,{'dir':_0x25ec37},function(_0x617ea5){if(_0x617ea5){logger[_0x8005('0x61')](_0x617ea5);handleError(_0x617ea5,!![]);};var _0x518ea4=fs[_0x8005('0x75')](_0x25ec37);if(_0x518ea4[_0x8005('0x3c')]>0x1){removeReferences(_0x4cd4b7,_0x25ec37);logger['error'](_0x8005('0x76'));return _0x116d4e(new Error(_0x8005('0x76')));}var _0x3cf16f=fs[_0x8005('0x77')](path['join'](_0x25ec37,_0x518ea4[0x0]));if(_0x3cf16f[_0x8005('0x78')]()){removeReferences(_0x4cd4b7,_0x25ec37);logger[_0x8005('0x61')](_0x8005('0x76'));return _0x116d4e(new Error(_0x8005('0x76')));}if(_0x3cf16f['isDirectory']()){var _0x209aef=fs[_0x8005('0x75')](path['join'](_0x25ec37,_0x518ea4[0x0]));if(_0x209aef[_0x8005('0x3c')]===0x0){removeReferences(_0x4cd4b7,_0x25ec37);logger[_0x8005('0x61')](_0x8005('0x76'));return _0x116d4e(new Error(_0x8005('0x76')));}var _0x1534cb=_0x209aef[_0x8005('0x79')](function(_0x10c08b){return _0x10c08b===_0x8005('0x7a');});if(!_0x1534cb){return _0x116d4e(new Error(_0x8005('0x7b')));}var _0x34bb5d=fs[_0x8005('0x7c')](path[_0x8005('0x54')](_0x25ec37,_0x518ea4[0x0],_0x8005('0x7a')));var _0x8c29bc=JSON[_0x8005('0x7d')](_0x34bb5d);if(_0x8005('0x7e')==typeof _0x8c29bc[_0x8005('0x37')]){return _0x116d4e(new Error(_0x8005('0x7f')));}if(_0x8005('0x7e')==typeof _0x8c29bc[_0x8005('0x47')]){return _0x116d4e(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x8005('0x7e')==typeof _0x8c29bc['version']){return _0x116d4e(new Error(_0x8005('0x80')));}if('undefined'==typeof _0x8c29bc[_0x8005('0x81')]){return _0x116d4e(new Error(_0x8005('0x82')));}if(_0x8c29bc[_0x8005('0x47')]==='html'){if('undefined'==typeof _0x8c29bc[_0x8005('0x81')]['views']){return _0x116d4e(new Error(_0x8005('0x83')));}if('undefined'==typeof _0x8c29bc[_0x8005('0x81')][_0x8005('0x84')][_0x8005('0x85')]&&'undefined'==typeof _0x8c29bc[_0x8005('0x81')]['views']['agent']){return _0x116d4e(new Error(_0x8005('0x86')));}}else if(_0x8c29bc[_0x8005('0x47')]===_0x8005('0x87')){if(_0x8005('0x7e')==typeof _0x8c29bc[_0x8005('0x81')][_0x8005('0x88')]){return _0x116d4e(new Error(_0x8005('0x89')));}if(_0x8005('0x7e')==typeof _0x8c29bc[_0x8005('0x81')][_0x8005('0x8a')]){return _0x116d4e(new Error(_0x8005('0x8b')));}}else{return _0x116d4e(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x452900=_0x8c29bc['name'];var _0x320e4a=_0x8c29bc['description'];var _0x2f281c=_0x8c29bc[_0x8005('0x47')];var _0x470ca1=_0x8c29bc['sidebar']?_0x8c29bc[_0x8005('0x8c')]:_0x8005('0x8d');var _0x3562a1=_0x8c29bc[_0x8005('0x8e')]?_0x8c29bc[_0x8005('0x8e')]:'icon-apps';var _0x56fbf2='';var _0x544223='';var _0x56ca57='';var _0x1c7c95='';var _0xc2a0d3=_0x8c29bc[_0x8005('0x8f')];if(_0x2f281c==='html'){if('undefined'!=typeof _0x8c29bc[_0x8005('0x81')][_0x8005('0x84')][_0x8005('0x85')]){var _0x4c901e=_0x8c29bc['parameters'][_0x8005('0x84')][_0x8005('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x8005('0x90')](_0x4c901e)){_0x56fbf2=path['join'](_0x8005('0x91'),_0x347533,_0x518ea4[0x0],_0x4c901e);}else{_0x56fbf2=_0x4c901e;}}else{logger[_0x8005('0x6a')](_0x8005('0x92'));}if(_0x8005('0x7e')!=typeof _0x8c29bc[_0x8005('0x81')][_0x8005('0x84')][_0x8005('0x93')]){var _0x1a872c=_0x8c29bc[_0x8005('0x81')][_0x8005('0x84')][_0x8005('0x93')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1a872c)){_0x544223=path[_0x8005('0x54')]('plugins',_0x347533,_0x518ea4[0x0],_0x1a872c);}else{_0x544223=_0x1a872c;}}else{logger['info']('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x2f281c===_0x8005('0x87')){_0x56ca57=_0x8c29bc[_0x8005('0x81')][_0x8005('0x88')];_0x1c7c95=_0x8c29bc[_0x8005('0x81')][_0x8005('0x8a')];if(_0x8005('0x7e')!=typeof _0x8c29bc[_0x8005('0x81')][_0x8005('0x84')]){if(_0x8005('0x7e')!=typeof _0x8c29bc['parameters'][_0x8005('0x84')]['admin']){var _0x4c901e=_0x8c29bc[_0x8005('0x81')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x8005('0x90')](_0x4c901e)){_0x56fbf2=path[_0x8005('0x54')](_0x8005('0x91'),_0x347533,_0x518ea4[0x0],_0x4c901e);}else{_0x56fbf2=_0x4c901e;}}if(_0x8005('0x7e')!=typeof _0x8c29bc[_0x8005('0x81')][_0x8005('0x84')]['agent']){var _0x1a872c=_0x8c29bc['parameters']['views'][_0x8005('0x93')];if(!/^(f|ht)tps?:\/\//i[_0x8005('0x90')](_0x1a872c)){_0x544223=path['join'](_0x8005('0x91'),_0x347533,_0x518ea4[0x0],_0x1a872c);}else{_0x544223=_0x1a872c;}}}}var _0x4b4cbe={'name':_0x452900,'description':_0x320e4a,'path':path[_0x8005('0x54')](_0x347533,_0x518ea4[0x0]),'type':_0x2f281c,'sidebar':_0x470ca1,'icon':_0x3562a1,'adminUrl':_0x56fbf2,'agentUrl':_0x544223,'scriptName':_0x56ca57,'scriptPath':_0x1c7c95,'version':_0xc2a0d3};removeReferences(_0x4cd4b7,null);return db['Plugin'][_0x8005('0x94')](_0x4b4cbe)['then'](function(_0x3edc53){var _0x18de21={'role':_0x467924[_0x8005('0x95')][_0x8005('0x96')],'userProfileId':_0x467924['body']['userProfileId']};if(!_0x18de21)throw new Error(_0x8005('0x97'));if(_0x18de21[_0x8005('0x96')]===_0x8005('0x98')){var _0x40e182=_0x3edc53['get']({'plain':!![]});return db['UserProfileSection'][_0x8005('0x52')]({'where':{'name':_0x8005('0x2e'),'userProfileId':_0x18de21[_0x8005('0x99')]},'raw':!![]})[_0x8005('0x2c')](function(_0x28893f){if(_0x28893f&&_0x28893f[_0x8005('0x9a')]===0x0){return db[_0x8005('0x2f')]['create']({'name':_0x40e182['name'],'resourceId':_0x40e182['id'],'type':_0x28893f[_0x8005('0x37')],'sectionId':_0x28893f['id']},{})[_0x8005('0x2c')](function(){return _0x3edc53;});}else{return _0x3edc53;}})[_0x8005('0x4c')](function(_0x4096fa){logger[_0x8005('0x61')](_0x8005('0x9b'),_0x4096fa);throw _0x4096fa;});}return _0x3edc53;})[_0x8005('0x2c')](respondWithResult(_0x2f7881,null))['catch'](handleError(_0x2f7881,null));}});}catch(_0x12ca51){_0x2f7881[_0x8005('0x23')](0x1f4)['send'](_0x12ca51);}};function removeReferences(_0x43f87e,_0x4de967){try{if(_0x43f87e){fs['unlinkSync'](_0x43f87e);logger[_0x8005('0x6a')]('Zip\x20archive\x20removed');}if(_0x4de967){rimraf(_0x4de967,function(){});logger[_0x8005('0x6a')](_0x8005('0x9c'));}}catch(_0x4c4e10){logger['error'](_0x4c4e10);}}exports['update']=function(_0x4aada0,_0x31dc01,_0x99ff37){return db[_0x8005('0x32')][_0x8005('0x52')]({'where':{'id':_0x4aada0[_0x8005('0x4e')]['id']}})[_0x8005('0x2c')](handleEntityNotFound(_0x31dc01,null))[_0x8005('0x2c')](saveUpdates(_0x4aada0['body'],null))[_0x8005('0x2c')](respondWithResult(_0x31dc01,null))['catch'](handleError(_0x31dc01,null));};exports['delete']=function(_0x487a9d,_0x2ad858,_0x1c00d0){return db[_0x8005('0x32')][_0x8005('0x52')]({'where':{'id':_0x487a9d[_0x8005('0x4e')]['id']}})['then'](function(_0x1a6bd0){if(_0x1a6bd0){return _0x1a6bd0['destroy']();}})[_0x8005('0x2c')](function(_0x2f117e){rimraf(path[_0x8005('0x54')](config[_0x8005('0x55')],_0x8005('0x56'),path['dirname'](_0x2f117e['path'])),function(){});return _0x2f117e;})[_0x8005('0x2c')](handleEntityNotFound(_0x2ad858,null))[_0x8005('0x2c')](respondWithStatusCode(_0x2ad858,null))[_0x8005('0x4c')](handleError(_0x2ad858,null));};exports['webhookGet']=function(_0x10bc34,_0x242329,_0x197f9d){return BPromise[_0x8005('0x9d')]()[_0x8005('0x2c')](function(){if(!_0x10bc34[_0x8005('0x38')][_0x8005('0x9')]){throw new Error(_0x8005('0x9e'));}if(!_0x10bc34[_0x8005('0x38')]['port']){throw new Error(_0x8005('0x9f'));}var _0x103b7e=_0x10bc34[_0x8005('0x38')][_0x8005('0xa0')]?_0x10bc34[_0x8005('0x38')]['hostname']+':'+_0x10bc34[_0x8005('0x38')][_0x8005('0xa1')]:_0x8005('0xa2')+_0x10bc34[_0x8005('0x38')]['port'];var _0xebae0=_0x10bc34[_0x8005('0x38')][_0x8005('0x29')]?_0x10bc34['query']['json']:!![];var _0x293580=_0x10bc34[_0x8005('0x38')][_0x8005('0xa3')]?_0x10bc34['query'][_0x8005('0xa3')]:null;var _0x5e97b7={'method':_0x10bc34[_0x8005('0xa4')],'uri':util[_0x8005('0x57')](_0x8005('0xa5'),_0x103b7e,_0x10bc34[_0x8005('0x38')][_0x8005('0x9')]),'json':_0xebae0,'resolveWithFullResponse':!![],'encoding':_0x293580,'qs':_0x10bc34[_0x8005('0x38')]};if(_0x10bc34['headers']){_0x5e97b7[_0x8005('0xa6')]=_0x10bc34[_0x8005('0xa6')];if(_0x5e97b7[_0x8005('0xa6')][_0x8005('0xa7')]){delete _0x5e97b7[_0x8005('0xa6')][_0x8005('0xa7')];}}if(_0x5e97b7[_0x8005('0xa6')][_0x8005('0xa8')]){delete _0x5e97b7[_0x8005('0xa6')][_0x8005('0xa8')];}return rp(_0x5e97b7);})[_0x8005('0x2c')](function(_0x4eb668){if(_0x4eb668){_0x242329[_0x8005('0x27')](_0x4eb668[_0x8005('0xa6')]);logger[_0x8005('0x6a')](_0x4eb668[_0x8005('0x95')]);if(_['endsWith'](_0x10bc34[_0x8005('0x38')][_0x8005('0x9')],'download')&&_0x4eb668['statusCode']==0x1f4){return _0x242329[_0x8005('0x22')](_0x4eb668[_0x8005('0xa9')]);}else{return _0x242329['status'](_0x4eb668[_0x8005('0xa9')])[_0x8005('0x31')](_0x4eb668[_0x8005('0x95')]);}}else{return _0x242329['sendStatus'](0xc8);}})[_0x8005('0x4c')](handleError(_0x242329,null));};exports[_0x8005('0xaa')]=function(_0x27f9e0,_0x399e6f,_0x2fa9ca){return BPromise[_0x8005('0x9d')]()[_0x8005('0x2c')](function(){if(!_0x27f9e0[_0x8005('0x38')][_0x8005('0x9')]){throw new Error(_0x8005('0x9e'));}if(!_0x27f9e0[_0x8005('0x38')]['port']){throw new Error(_0x8005('0x9f'));}var _0x391a1a=_0x27f9e0[_0x8005('0x38')]['hostname']?_0x27f9e0[_0x8005('0x38')][_0x8005('0xa0')]+':'+_0x27f9e0[_0x8005('0x38')][_0x8005('0xa1')]:'http://localhost:'+_0x27f9e0['query'][_0x8005('0xa1')];var _0x46a284=_0x27f9e0[_0x8005('0x38')][_0x8005('0x29')]?_0x27f9e0[_0x8005('0x38')][_0x8005('0x29')]:!![];var _0x10c53e=_0x27f9e0[_0x8005('0x38')][_0x8005('0xa3')]?_0x27f9e0[_0x8005('0x38')]['encoding']:null;var _0x45ba7a={'method':_0x27f9e0[_0x8005('0xa4')],'uri':util['format'](_0x8005('0xa5'),_0x391a1a,_0x27f9e0[_0x8005('0x38')][_0x8005('0x9')]),'json':_0x46a284,'resolveWithFullResponse':!![],'encoding':_0x10c53e,'body':_0x27f9e0[_0x8005('0x95')]};if(_0x27f9e0['headers']){_0x45ba7a['headers']=_0x27f9e0[_0x8005('0xa6')];if(_0x45ba7a['headers'][_0x8005('0xa7')]){delete _0x45ba7a['headers']['content-length'];}}if(_0x45ba7a[_0x8005('0xa6')][_0x8005('0xa8')]){delete _0x45ba7a[_0x8005('0xa6')][_0x8005('0xa8')];}return rp(_0x45ba7a);})[_0x8005('0x2c')](function(_0x4d858e){if(_0x4d858e){_0x399e6f['set'](_0x4d858e[_0x8005('0xa6')]);logger['info'](_0x4d858e['body']);return _0x399e6f[_0x8005('0x23')](_0x4d858e[_0x8005('0xa9')])[_0x8005('0x31')](_0x4d858e[_0x8005('0x95')]);}else{return _0x399e6f[_0x8005('0x22')](0xc8);}})[_0x8005('0x4c')](handleError(_0x399e6f,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 0224131..6a658c1 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 _0xa30a=['../../mysqldb','Plugin','save','update','remove','emit','hook','exports','events'];(function(_0x4a4dc9,_0x706f71){var _0x4decc2=function(_0x7e4d23){while(--_0x7e4d23){_0x4a4dc9['push'](_0x4a4dc9['shift']());}};_0x4decc2(++_0x706f71);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xaa30('0x0'));var Plugin=require(_0xaa30('0x1'))['db'][_0xaa30('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaa30('0x3'),'afterUpdate':_0xaa30('0x4'),'afterDestroy':_0xaa30('0x5')};function emitEvent(_0x2901b7){return function(_0x2a9b06,_0x271425,_0x102ad7){PluginEvents['emit'](_0x2901b7+':'+_0x2a9b06['id'],_0x2a9b06);PluginEvents[_0xaa30('0x6')](_0x2901b7,_0x2a9b06);_0x102ad7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xaa30('0x7')](e,emitEvent(event));}}module[_0xaa30('0x8')]=PluginEvents; \ No newline at end of file +var _0x4325=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4325,0x1da));var _0x5432=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4325[_0x167cc1];return _0x10bc4b;};'use strict';var EventEmitter=require(_0x5432('0x0'));var Plugin=require(_0x5432('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x5432('0x2')](0x0);var events={'afterCreate':_0x5432('0x3'),'afterUpdate':_0x5432('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4fc4e9){return function(_0x20f704,_0x36ce53,_0xad26e9){PluginEvents['emit'](_0x4fc4e9+':'+_0x20f704['id'],_0x20f704);PluginEvents[_0x5432('0x5')](_0x4fc4e9,_0x20f704);_0xad26e9(null);};}for(var e in events){if(events[_0x5432('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x5432('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 c2f3be6..8416d8c 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 _0xa41a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','plugins','lodash','util','api'];(function(_0x10dac8,_0x1827a7){var _0x22117d=function(_0x4ff6f0){while(--_0x4ff6f0){_0x10dac8['push'](_0x10dac8['shift']());}};_0x22117d(++_0x1827a7);}(_0xa41a,0x6b));var _0xaa41=function(_0x4ab65e,_0x2405ea){_0x4ab65e=_0x4ab65e-0x0;var _0x52a368=_0xa41a[_0x4ab65e];return _0x52a368;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var logger=require('../../config/logger')(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var BPromise=require(_0xaa41('0x4'));var rp=require(_0xaa41('0x5'));var fs=require('fs');var path=require(_0xaa41('0x6'));var rimraf=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var attributes=require(_0xaa41('0x9'));module['exports']=function(_0x2122a0,_0x1ec9d4){return _0x2122a0['define']('Plugin',attributes,{'tableName':_0xaa41('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7dfd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins'];(function(_0x2b173c,_0x27d0b2){var _0x51be42=function(_0x5592da){while(--_0x5592da){_0x2b173c['push'](_0x2b173c['shift']());}};_0x51be42(++_0x27d0b2);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var logger=require(_0xd7df('0x2'))(_0xd7df('0x3'));var moment=require(_0xd7df('0x4'));var BPromise=require(_0xd7df('0x5'));var rp=require(_0xd7df('0x6'));var fs=require('fs');var path=require(_0xd7df('0x7'));var rimraf=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var attributes=require(_0xd7df('0xa'));module[_0xd7df('0xb')]=function(_0x36cf0f,_0x39ce98){return _0x36cf0f[_0xd7df('0xc')](_0xd7df('0xd'),attributes,{'tableName':_0xd7df('0xe'),'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 5e7fcf0..d79c964 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 _0xf7eb=['body','options','raw','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf7eb,0x163));var _0xbf7e=function(_0x571b13,_0x100ff3){_0x571b13=_0x571b13-0x0;var _0x19110b=_0xf7eb[_0x571b13];return _0x19110b;};'use strict';var _=require(_0xbf7e('0x0'));var util=require(_0xbf7e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbf7e('0x2'));var fs=require('fs');var Redis=require(_0xbf7e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf7e('0x4'))(_0xbf7e('0x5'));var config=require(_0xbf7e('0x6'));var jayson=require(_0xbf7e('0x7'));var client=jayson[_0xbf7e('0x8')][_0xbf7e('0x9')]({'port':0x232a});config[_0xbf7e('0xa')]=_[_0xbf7e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbf7e('0xc'))(new Redis(config[_0xbf7e('0xa')]));require(_0xbf7e('0xd'))[_0xbf7e('0xe')](socket);function respondWithRpcPromise(_0x4b7b92,_0x35c5aa,_0x22128c){return new BPromise(function(_0x501e2f,_0x28cda1){return client[_0xbf7e('0xf')](_0x4b7b92,_0x22128c)['then'](function(_0x53736c){logger[_0xbf7e('0x10')](_0xbf7e('0x11'),_0x35c5aa,_0xbf7e('0x12'));logger[_0xbf7e('0x13')](_0xbf7e('0x14'),_0x35c5aa,'request\x20sent',JSON[_0xbf7e('0x15')](_0x53736c));if(_0x53736c['error']){if(_0x53736c[_0xbf7e('0x16')][_0xbf7e('0x17')]===0x1f4){logger['error'](_0xbf7e('0x11'),_0x35c5aa,_0x53736c[_0xbf7e('0x16')][_0xbf7e('0x18')]);return _0x28cda1(_0x53736c[_0xbf7e('0x16')][_0xbf7e('0x18')]);}logger[_0xbf7e('0x16')]('Plugin,\x20%s,\x20%s',_0x35c5aa,_0x53736c[_0xbf7e('0x16')]['message']);return _0x501e2f(_0x53736c[_0xbf7e('0x16')][_0xbf7e('0x18')]);}else{logger['info'](_0xbf7e('0x11'),_0x35c5aa,_0xbf7e('0x12'));_0x501e2f(_0x53736c[_0xbf7e('0x19')]['message']);}})[_0xbf7e('0x1a')](function(_0x5507ff){logger[_0xbf7e('0x16')](_0xbf7e('0x11'),_0x35c5aa,_0x5507ff);_0x28cda1(_0x5507ff);});});}exports[_0xbf7e('0x1b')]=function(_0x4a727c){var _0xea8a19=this;return new Promise(function(_0x140f73,_0x21289b){return db[_0xbf7e('0x1c')]['create'](_0x4a727c[_0xbf7e('0x1d')],{'raw':_0x4a727c[_0xbf7e('0x1e')]?_0x4a727c[_0xbf7e('0x1e')][_0xbf7e('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x1120c7){logger[_0xbf7e('0x10')](_0xbf7e('0x1b'),_0x4a727c);logger[_0xbf7e('0x13')](_0xbf7e('0x1b'),_0x4a727c,JSON[_0xbf7e('0x15')](_0x1120c7));_0x140f73(_0x1120c7);})[_0xbf7e('0x1a')](function(_0x39e7d9){logger[_0xbf7e('0x16')](_0xbf7e('0x1b'),_0x39e7d9['message'],_0x4a727c);_0x21289b(_0xea8a19[_0xbf7e('0x16')](0x1f4,_0x39e7d9[_0xbf7e('0x18')]));});});}; \ No newline at end of file +var _0xff94=['util','moment','bluebird','randomstring','../../mysqldb','rpc','http','defaults','socket.io-emitter','redis','register','request','then','info','Plugin,\x20%s,\x20%s','debug','request\x20sent','code','error','message','catch','CreatePlugin','Plugin','create','body','options','lodash'];(function(_0x208941,_0x2cb343){var _0x61fd0=function(_0x3f7eb9){while(--_0x3f7eb9){_0x208941['push'](_0x208941['shift']());}};_0x61fd0(++_0x2cb343);}(_0xff94,0xa1));var _0x4ff9=function(_0x35f63b,_0xa52cfc){_0x35f63b=_0x35f63b-0x0;var _0x24af68=_0xff94[_0x35f63b];return _0x24af68;};'use strict';var _=require(_0x4ff9('0x0'));var util=require(_0x4ff9('0x1'));var moment=require(_0x4ff9('0x2'));var BPromise=require(_0x4ff9('0x3'));var rs=require(_0x4ff9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ff9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4ff9('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4ff9('0x7')]({'port':0x232a});config['redis']=_[_0x4ff9('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4ff9('0x9'))(new Redis(config[_0x4ff9('0xa')]));require('./plugin.socket')[_0x4ff9('0xb')](socket);function respondWithRpcPromise(_0x5b9b97,_0x1657b4,_0x3525ec){return new BPromise(function(_0x25146f,_0x57152d){return client[_0x4ff9('0xc')](_0x5b9b97,_0x3525ec)[_0x4ff9('0xd')](function(_0x58649a){logger[_0x4ff9('0xe')](_0x4ff9('0xf'),_0x1657b4,'request\x20sent');logger[_0x4ff9('0x10')]('Plugin,\x20%s,\x20%s,\x20%s',_0x1657b4,_0x4ff9('0x11'),JSON['stringify'](_0x58649a));if(_0x58649a['error']){if(_0x58649a['error'][_0x4ff9('0x12')]===0x1f4){logger[_0x4ff9('0x13')](_0x4ff9('0xf'),_0x1657b4,_0x58649a[_0x4ff9('0x13')][_0x4ff9('0x14')]);return _0x57152d(_0x58649a[_0x4ff9('0x13')][_0x4ff9('0x14')]);}logger[_0x4ff9('0x13')](_0x4ff9('0xf'),_0x1657b4,_0x58649a['error'][_0x4ff9('0x14')]);return _0x25146f(_0x58649a[_0x4ff9('0x13')][_0x4ff9('0x14')]);}else{logger[_0x4ff9('0xe')](_0x4ff9('0xf'),_0x1657b4,_0x4ff9('0x11'));_0x25146f(_0x58649a['result'][_0x4ff9('0x14')]);}})[_0x4ff9('0x15')](function(_0xea268c){logger[_0x4ff9('0x13')]('Plugin,\x20%s,\x20%s',_0x1657b4,_0xea268c);_0x57152d(_0xea268c);});});}exports[_0x4ff9('0x16')]=function(_0xb24764){var _0x5db686=this;return new Promise(function(_0x3f1f47,_0x55230f){return db[_0x4ff9('0x17')][_0x4ff9('0x18')](_0xb24764[_0x4ff9('0x19')],{'raw':_0xb24764['options']?_0xb24764[_0x4ff9('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x4ff9('0xd')](function(_0x1a4037){logger[_0x4ff9('0xe')]('CreatePlugin',_0xb24764);logger['debug']('CreatePlugin',_0xb24764,JSON['stringify'](_0x1a4037));_0x3f1f47(_0x1a4037);})[_0x4ff9('0x15')](function(_0x4d9cf6){logger[_0x4ff9('0x13')](_0x4ff9('0x16'),_0x4d9cf6['message'],_0xb24764);_0x55230f(_0x5db686['error'](0x1f4,_0x4d9cf6[_0x4ff9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 1e1a41e..4397514 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 _0x3237=['plugin:','remove','update','emit','removeListener'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x3237,0x150));var _0x7323=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x3237[_0x6c993a];return _0x27f547;};'use strict';var PluginEvents=require('./plugin.events');var events=['save',_0x7323('0x0'),_0x7323('0x1')];function createListener(_0x562932,_0xa06873){return function(_0x531128){_0xa06873[_0x7323('0x2')](_0x562932,_0x531128);};}function removeListener(_0xf32d0c,_0x63d2fe){return function(){PluginEvents[_0x7323('0x3')](_0xf32d0c,_0x63d2fe);};}exports['register']=function(_0x1fbba0){for(var _0x2f4dd6=0x0,_0xdfdb3c=events['length'];_0x2f4dd6<_0xdfdb3c;_0x2f4dd6++){var _0x418bc2=events[_0x2f4dd6];var _0x48bee7=createListener(_0x7323('0x4')+_0x418bc2,_0x1fbba0);PluginEvents['on'](_0x418bc2,_0x48bee7);}}; \ No newline at end of file +var _0xb7aa=['./plugin.events','save','remove','update','emit','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7aa,0x11a));var _0xab7a=function(_0x4849f6,_0x104836){_0x4849f6=_0x4849f6-0x0;var _0x1a3dcd=_0xb7aa[_0x4849f6];return _0x1a3dcd;};'use strict';var PluginEvents=require(_0xab7a('0x0'));var events=[_0xab7a('0x1'),_0xab7a('0x2'),_0xab7a('0x3')];function createListener(_0x1d2507,_0x3eab6c){return function(_0x20b86d){_0x3eab6c[_0xab7a('0x4')](_0x1d2507,_0x20b86d);};}function removeListener(_0x34adc3,_0x3b0621){return function(){PluginEvents['removeListener'](_0x34adc3,_0x3b0621);};}exports[_0xab7a('0x5')]=function(_0x1c761b){for(var _0x2ee412=0x0,_0x29ef15=events['length'];_0x2ee412<_0x29ef15;_0x2ee412++){var _0x99ac82=events[_0x2ee412];var _0x1e3b23=createListener('plugin:'+_0x99ac82,_0x1c761b);PluginEvents['on'](_0x99ac82,_0x1e3b23);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 76d5ad9..12d1c09 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 _0x3792=['Router','../../components/auth/service','./pm2.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','express'];(function(_0x3bf4d5,_0x366a37){var _0x48fdea=function(_0x665bbe){while(--_0x665bbe){_0x3bf4d5['push'](_0x3bf4d5['shift']());}};_0x48fdea(++_0x366a37);}(_0x3792,0x1df));var _0x2379=function(_0x313766,_0x1f5479){_0x313766=_0x313766-0x0;var _0x593542=_0x3792[_0x313766];return _0x593542;};'use strict';var express=require(_0x2379('0x0'));var router=express[_0x2379('0x1')]();var auth=require(_0x2379('0x2'));var controller=require(_0x2379('0x3'));router[_0x2379('0x4')]('/',auth[_0x2379('0x5')](),controller[_0x2379('0x6')]);router[_0x2379('0x4')](_0x2379('0x7'),auth[_0x2379('0x5')](),controller[_0x2379('0x8')]);router[_0x2379('0x9')]('/',auth['isAuthenticated'](),controller[_0x2379('0xa')]);router[_0x2379('0xb')]('/:id',auth[_0x2379('0x5')](),controller[_0x2379('0xc')]);router[_0x2379('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x2379('0xe')]);module[_0x2379('0xf')]=router; \ No newline at end of file +var _0x26b6=['index','/:id','show','post','put','update','delete','exports','Router','../../components/auth/service','./pm2.controller','get','isAuthenticated'];(function(_0xc57e4c,_0x7a2a86){var _0x2a0557=function(_0x236879){while(--_0x236879){_0xc57e4c['push'](_0xc57e4c['shift']());}};_0x2a0557(++_0x7a2a86);}(_0x26b6,0x97));var _0x626b=function(_0x12192c,_0x1f63b6){_0x12192c=_0x12192c-0x0;var _0x3331e2=_0x26b6[_0x12192c];return _0x3331e2;};'use strict';var express=require('express');var router=express[_0x626b('0x0')]();var auth=require(_0x626b('0x1'));var controller=require(_0x626b('0x2'));router[_0x626b('0x3')]('/',auth[_0x626b('0x4')](),controller[_0x626b('0x5')]);router[_0x626b('0x3')](_0x626b('0x6'),auth[_0x626b('0x4')](),controller[_0x626b('0x7')]);router[_0x626b('0x8')]('/',auth[_0x626b('0x4')](),controller['create']);router[_0x626b('0x9')](_0x626b('0x6'),auth[_0x626b('0x4')](),controller[_0x626b('0xa')]);router[_0x626b('0xb')]('/:id',auth[_0x626b('0x4')](),controller['destroy']);module[_0x626b('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index ff2a4bd..c3dbf90 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 _0x67ab=['send','npm\x20install','index','list','then','reject','motion2','length','catch','show','describe','params','create','body','script','join','cwd','dirname','start','dump','update','restart','stop','hasOwnProperty','destroy','delete','Unknown\x20id','lodash','../../config/pm2','api','child_process','bluebird','sendStatus','status','json','error','name'];(function(_0xa53067,_0x48b0e1){var _0x1fe763=function(_0x47a63f){while(--_0x47a63f){_0xa53067['push'](_0xa53067['shift']());}};_0x1fe763(++_0x48b0e1);}(_0x67ab,0x1d7));var _0xb67a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x67ab[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb67a('0x0'));var pm2=require(_0xb67a('0x1'));var logger=require('../../config/logger')(_0xb67a('0x2'));var path=require('path');var exec=require(_0xb67a('0x3'))['exec'];var BPromise=require(_0xb67a('0x4'));function handleEntityNotFound(_0x459ef4,_0xcdc1a7){return function(_0x2fa1af){if(!_0x2fa1af){_0x459ef4[_0xb67a('0x5')](0x194);;}return _0x2fa1af;};}function respondWithResult(_0x458f48,_0x38a06a){_0x38a06a=_0x38a06a||0xc8;return function(_0x152661){if(_0x152661){return _0x458f48[_0xb67a('0x6')](_0x38a06a)[_0xb67a('0x7')](_0x152661);}return null;};}function handleError(_0x34a72e,_0x592356){_0x592356=_0x592356||0x1f4;return function(_0x10738b){logger[_0xb67a('0x8')](_0x10738b['stack']);if(_0x10738b['name']){delete _0x10738b[_0xb67a('0x9')];}_0x34a72e[_0xb67a('0x6')](_0x592356)[_0xb67a('0xa')](_0x10738b);};}function execChildProcess(){return new BPromise(function(_0x3d8345,_0x370e12){exec(_0xb67a('0xb'),function(_0x1ff710,_0x46fa76,_0x1cb7a1){logger['info'](_0x46fa76);logger['info'](_0x1cb7a1);if(_0x1ff710){logger[_0xb67a('0x8')](_0x1ff710);return _0x370e12(_0x1ff710);}return _0x3d8345(_0x46fa76);});});}exports[_0xb67a('0xc')]=function(_0x48f8f9,_0x25d06b){return pm2[_0xb67a('0xd')]()[_0xb67a('0xe')](function(_0x49eb78){if(_0x49eb78){var _0x308acd=_[_0xb67a('0xf')](_0x49eb78,function(_0xb85e75){return _0xb85e75['name']==='express'||_0xb85e75[_0xb67a('0x9')]===_0xb67a('0x10');});return{'rows':_0x308acd,'count':_0x308acd[_0xb67a('0x11')]};}return null;})[_0xb67a('0xe')](respondWithResult(_0x25d06b,null))[_0xb67a('0x12')](handleError(_0x25d06b,null));};exports[_0xb67a('0x13')]=function(_0x182084,_0x1b4f09){return pm2[_0xb67a('0x14')](_0x182084[_0xb67a('0x15')]['id'])[_0xb67a('0xe')](respondWithResult(_0x1b4f09,null))[_0xb67a('0xe')](handleEntityNotFound(_0x1b4f09,null))[_0xb67a('0x12')](handleError(_0x1b4f09,null));};exports[_0xb67a('0x16')]=function(_0x2a66a6,_0x449820){if(_0x2a66a6[_0xb67a('0x17')][_0xb67a('0x9')]&&_0x2a66a6['body'][_0xb67a('0x18')]){var _0x32ffee=path[_0xb67a('0x19')](__dirname,'../../files/plugins',_0x2a66a6[_0xb67a('0x17')][_0xb67a('0x18')]);var _0x3add6e=process[_0xb67a('0x1a')]();process['chdir'](path[_0xb67a('0x1b')](_0x32ffee));return execChildProcess()[_0xb67a('0xe')](function(_0x331e50){process['chdir'](_0x3add6e);return pm2[_0xb67a('0x1c')]({'name':_0x2a66a6[_0xb67a('0x17')][_0xb67a('0x9')],'script':_0x32ffee});})[_0xb67a('0xe')](function(_0x1f777f){pm2[_0xb67a('0x1d')]();return _0x1f777f[0x0];})[_0xb67a('0xe')](respondWithResult(_0x449820,0xc9))['catch'](handleError(_0x449820,null));}else{return _0x449820[_0xb67a('0x6')](0x1f4)[_0xb67a('0xa')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xb67a('0x1e')]=function(_0x10ad90,_0x2940eb){if(_0x10ad90[_0xb67a('0x17')]['id']){delete _0x10ad90['body']['id'];}var _0x50599b={'online':_0xb67a('0x1f'),'stopped':_0xb67a('0x20')};if(_0x50599b[_0xb67a('0x21')](_0x10ad90['body']['status'])){return pm2[_0x50599b[_0x10ad90[_0xb67a('0x17')]['status']]](_0x10ad90[_0xb67a('0x15')]['id'])[_0xb67a('0xe')](respondWithResult(_0x2940eb,0xc8))[_0xb67a('0x12')](handleError(_0x2940eb,null));}else{return _0x2940eb[_0xb67a('0x6')](0x1f4)[_0xb67a('0xa')]({'message':'Unknown\x20status'});}};exports[_0xb67a('0x22')]=function(_0x407ad1,_0x26cc90){if(_0x407ad1[_0xb67a('0x17')]['id']){delete _0x407ad1['body']['id'];}if(_0x407ad1[_0xb67a('0x15')]['id']){return pm2[_0xb67a('0x23')](_0x407ad1[_0xb67a('0x15')]['id'])[_0xb67a('0xe')](function(_0x1b38d9){pm2[_0xb67a('0x1d')]();return _0x1b38d9[0x0];})['then'](respondWithResult(_0x26cc90,null))[_0xb67a('0x12')](handleError(_0x26cc90,null));}else{return _0x26cc90[_0xb67a('0x6')](0x1f4)[_0xb67a('0xa')]({'message':_0xb67a('0x24')});}}; \ No newline at end of file +var _0x01ff=['update','stop','destroy','delete','dump','../../config/pm2','../../config/logger','child_process','exec','json','error','stack','name','status','send','npm\x20install','index','list','then','reject','express','motion2','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname','Missing\x20name\x20and/or\x20path'];(function(_0x54fea4,_0x18ed21){var _0x43b8d8=function(_0x1352e5){while(--_0x1352e5){_0x54fea4['push'](_0x54fea4['shift']());}};_0x43b8d8(++_0x18ed21);}(_0x01ff,0x1cc));var _0xf01f=function(_0x2f1043,_0x52cb0e){_0x2f1043=_0x2f1043-0x0;var _0x38110c=_0x01ff[_0x2f1043];return _0x38110c;};'use strict';var _=require('lodash');var pm2=require(_0xf01f('0x0'));var logger=require(_0xf01f('0x1'))('api');var path=require('path');var exec=require(_0xf01f('0x2'))[_0xf01f('0x3')];var BPromise=require('bluebird');function handleEntityNotFound(_0x49e7d6,_0x30203e){return function(_0x4af83c){if(!_0x4af83c){_0x49e7d6['sendStatus'](0x194);;}return _0x4af83c;};}function respondWithResult(_0x311d35,_0x1498f2){_0x1498f2=_0x1498f2||0xc8;return function(_0x2d43f4){if(_0x2d43f4){return _0x311d35['status'](_0x1498f2)[_0xf01f('0x4')](_0x2d43f4);}return null;};}function handleError(_0x1327f8,_0x385b8e){_0x385b8e=_0x385b8e||0x1f4;return function(_0x3d58e3){logger[_0xf01f('0x5')](_0x3d58e3[_0xf01f('0x6')]);if(_0x3d58e3[_0xf01f('0x7')]){delete _0x3d58e3[_0xf01f('0x7')];}_0x1327f8[_0xf01f('0x8')](_0x385b8e)[_0xf01f('0x9')](_0x3d58e3);};}function execChildProcess(){return new BPromise(function(_0x4ebdaa,_0x1879b6){exec(_0xf01f('0xa'),function(_0x45a78d,_0x414db5,_0x856f98){logger['info'](_0x414db5);logger['info'](_0x856f98);if(_0x45a78d){logger['error'](_0x45a78d);return _0x1879b6(_0x45a78d);}return _0x4ebdaa(_0x414db5);});});}exports[_0xf01f('0xb')]=function(_0x9c33db,_0x9c9b55){return pm2[_0xf01f('0xc')]()[_0xf01f('0xd')](function(_0x1fc1c5){if(_0x1fc1c5){var _0xbed0d4=_[_0xf01f('0xe')](_0x1fc1c5,function(_0x2fa1bb){return _0x2fa1bb[_0xf01f('0x7')]===_0xf01f('0xf')||_0x2fa1bb[_0xf01f('0x7')]===_0xf01f('0x10');});return{'rows':_0xbed0d4,'count':_0xbed0d4['length']};}return null;})[_0xf01f('0xd')](respondWithResult(_0x9c9b55,null))[_0xf01f('0x11')](handleError(_0x9c9b55,null));};exports[_0xf01f('0x12')]=function(_0x1bc62b,_0x39d40c){return pm2[_0xf01f('0x13')](_0x1bc62b[_0xf01f('0x14')]['id'])[_0xf01f('0xd')](respondWithResult(_0x39d40c,null))[_0xf01f('0xd')](handleEntityNotFound(_0x39d40c,null))[_0xf01f('0x11')](handleError(_0x39d40c,null));};exports[_0xf01f('0x15')]=function(_0x424cd1,_0x3e3c5a){if(_0x424cd1[_0xf01f('0x16')][_0xf01f('0x7')]&&_0x424cd1[_0xf01f('0x16')][_0xf01f('0x17')]){var _0x380c31=path[_0xf01f('0x18')](__dirname,_0xf01f('0x19'),_0x424cd1[_0xf01f('0x16')][_0xf01f('0x17')]);var _0x20cbfb=process[_0xf01f('0x1a')]();process[_0xf01f('0x1b')](path[_0xf01f('0x1c')](_0x380c31));return execChildProcess()[_0xf01f('0xd')](function(_0x40b193){process[_0xf01f('0x1b')](_0x20cbfb);return pm2['start']({'name':_0x424cd1[_0xf01f('0x16')][_0xf01f('0x7')],'script':_0x380c31});})[_0xf01f('0xd')](function(_0x541142){pm2['dump']();return _0x541142[0x0];})[_0xf01f('0xd')](respondWithResult(_0x3e3c5a,0xc9))[_0xf01f('0x11')](handleError(_0x3e3c5a,null));}else{return _0x3e3c5a[_0xf01f('0x8')](0x1f4)['send']({'message':_0xf01f('0x1d')});}};exports[_0xf01f('0x1e')]=function(_0x3f52a8,_0x224411){if(_0x3f52a8['body']['id']){delete _0x3f52a8[_0xf01f('0x16')]['id'];}var _0x4e806d={'online':'restart','stopped':_0xf01f('0x1f')};if(_0x4e806d['hasOwnProperty'](_0x3f52a8[_0xf01f('0x16')]['status'])){return pm2[_0x4e806d[_0x3f52a8[_0xf01f('0x16')][_0xf01f('0x8')]]](_0x3f52a8[_0xf01f('0x14')]['id'])[_0xf01f('0xd')](respondWithResult(_0x224411,0xc8))[_0xf01f('0x11')](handleError(_0x224411,null));}else{return _0x224411[_0xf01f('0x8')](0x1f4)['send']({'message':'Unknown\x20status'});}};exports[_0xf01f('0x20')]=function(_0x3f5b47,_0x54b8c3){if(_0x3f5b47[_0xf01f('0x16')]['id']){delete _0x3f5b47[_0xf01f('0x16')]['id'];}if(_0x3f5b47[_0xf01f('0x14')]['id']){return pm2[_0xf01f('0x21')](_0x3f5b47[_0xf01f('0x14')]['id'])[_0xf01f('0xd')](function(_0x5e9e8a){pm2[_0xf01f('0x22')]();return _0x5e9e8a[0x0];})['then'](respondWithResult(_0x54b8c3,null))[_0xf01f('0x11')](handleError(_0x54b8c3,null));}else{return _0x54b8c3[_0xf01f('0x8')](0x1f4)[_0xf01f('0x9')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index a99cb99..52f84a7 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 _0x5b64=['../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x3f4fc8,_0xd48416){var _0xf00ef2=function(_0x1f6c55){while(--_0x1f6c55){_0x3f4fc8['push'](_0x3f4fc8['shift']());}};_0xf00ef2(++_0xd48416);}(_0x5b64,0x122));var _0x45b6=function(_0x330d6c,_0x159218){_0x330d6c=_0x330d6c-0x0;var _0x4388ba=_0x5b64[_0x330d6c];return _0x4388ba;};'use strict';var multer=require(_0x45b6('0x0'));var util=require(_0x45b6('0x1'));var path=require(_0x45b6('0x2'));var timeout=require(_0x45b6('0x3'));var express=require(_0x45b6('0x4'));var router=express[_0x45b6('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x45b6('0x6'));var config=require(_0x45b6('0x7'));module[_0x45b6('0x8')]=router; \ No newline at end of file +var _0x763a=['../../config/environment','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x6efb20,_0x55cf1a){var _0x2bd413=function(_0x365c6b){while(--_0x365c6b){_0x6efb20['push'](_0x6efb20['shift']());}};_0x2bd413(++_0x55cf1a);}(_0x763a,0x9b));var _0xa763=function(_0x4e4683,_0x4b61a7){_0x4e4683=_0x4e4683-0x0;var _0x3457eb=_0x763a[_0x4e4683];return _0x3457eb;};'use strict';var multer=require(_0xa763('0x0'));var util=require(_0xa763('0x1'));var path=require(_0xa763('0x2'));var timeout=require(_0xa763('0x3'));var express=require(_0xa763('0x4'));var router=express['Router']();var auth=require(_0xa763('0x5'));var interaction=require(_0xa763('0x6'));var config=require(_0xa763('0x7'));module[_0xa763('0x8')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index b313289..36a382d 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 _0xb461=['exports','INTEGER','STRING','DATE'];(function(_0x1e081a,_0x482d6b){var _0x428209=function(_0x524b53){while(--_0x524b53){_0x1e081a['push'](_0x1e081a['shift']());}};_0x428209(++_0x482d6b);}(_0xb461,0x180));var _0x1b46=function(_0x5ed6a4,_0x3e42dc){_0x5ed6a4=_0x5ed6a4-0x0;var _0x58cf91=_0xb461[_0x5ed6a4];return _0x58cf91;};'use strict';var Sequelize=require('sequelize');module[_0x1b46('0x0')]={'state':{'type':Sequelize[_0x1b46('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x1b46('0x2')]},'scheduledat':{'type':Sequelize[_0x1b46('0x3')]},'uniqueid':{'type':Sequelize[_0x1b46('0x2')]},'starttime':{'type':Sequelize[_0x1b46('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x1b46('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x1b46('0x2')]},'campaigntype':{'type':Sequelize[_0x1b46('0x2')]},'membername':{'type':Sequelize[_0x1b46('0x2')]}}; \ No newline at end of file +var _0x8e76=['DATE','sequelize','INTEGER','STRING'];(function(_0x242df1,_0x401c8d){var _0xbe8463=function(_0x4074e1){while(--_0x4074e1){_0x242df1['push'](_0x242df1['shift']());}};_0xbe8463(++_0x401c8d);}(_0x8e76,0xad));var _0x68e7=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x8e76[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require(_0x68e7('0x0'));module['exports']={'state':{'type':Sequelize[_0x68e7('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x68e7('0x2')]},'scheduledat':{'type':Sequelize[_0x68e7('0x3')]},'uniqueid':{'type':Sequelize[_0x68e7('0x2')]},'starttime':{'type':Sequelize[_0x68e7('0x3')]},'responsetime':{'type':Sequelize[_0x68e7('0x3')]},'ringtime':{'type':Sequelize[_0x68e7('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x68e7('0x2')]},'campaigntype':{'type':Sequelize[_0x68e7('0x2')]},'membername':{'type':Sequelize[_0x68e7('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index b51bca6..b05c71c 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 _0x71cd=['report_agent_preview','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','ReportAgentPreview'];(function(_0x14d39d,_0x585cdc){var _0x3218ba=function(_0x3b7ace){while(--_0x3b7ace){_0x14d39d['push'](_0x14d39d['shift']());}};_0x3218ba(++_0x585cdc);}(_0x71cd,0x10f));var _0xd71c=function(_0x56a061,_0x53fb1b){_0x56a061=_0x56a061-0x0;var _0x105fa0=_0x71cd[_0x56a061];return _0x105fa0;};'use strict';var _=require(_0xd71c('0x0'));var util=require('util');var logger=require(_0xd71c('0x1'))(_0xd71c('0x2'));var moment=require(_0xd71c('0x3'));var BPromise=require(_0xd71c('0x4'));var rp=require(_0xd71c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd71c('0x6'));var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module[_0xd71c('0x7')]=function(_0x5a49a1,_0x3f7161){return _0x5a49a1['define'](_0xd71c('0x8'),attributes,{'tableName':_0xd71c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdfef=['lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','report_agent_preview'];(function(_0x2fc5d4,_0x514199){var _0x3b273c=function(_0x46665a){while(--_0x46665a){_0x2fc5d4['push'](_0x2fc5d4['shift']());}};_0x3b273c(++_0x514199);}(_0xdfef,0xd1));var _0xfdfe=function(_0x4f2c8b,_0x574d9f){_0x4f2c8b=_0x4f2c8b-0x0;var _0x23dbfb=_0xdfef[_0x4f2c8b];return _0x23dbfb;};'use strict';var _=require(_0xfdfe('0x0'));var util=require('util');var logger=require(_0xfdfe('0x1'))(_0xfdfe('0x2'));var moment=require(_0xfdfe('0x3'));var BPromise=require('bluebird');var rp=require(_0xfdfe('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfdfe('0x5'));var config=require(_0xfdfe('0x6'));var attributes=require(_0xfdfe('0x7'));module[_0xfdfe('0x8')]=function(_0x25fbd6,_0x1adea1){return _0x25fbd6[_0xfdfe('0x9')]('ReportAgentPreview',attributes,{'tableName':_0xfdfe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index d16983b..f2a3e04 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 _0x8fff=['../../config/logger','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x492535,_0x46524a){var _0x256620=function(_0x3015f8){while(--_0x3015f8){_0x492535['push'](_0x492535['shift']());}};_0x256620(++_0x46524a);}(_0x8fff,0x1ba));var _0xf8ff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8fff[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf8ff('0x0'));var moment=require('moment');var BPromise=require(_0xf8ff('0x1'));var rs=require(_0xf8ff('0x2'));var fs=require('fs');var Redis=require(_0xf8ff('0x3'));var db=require(_0xf8ff('0x4'))['db'];var utils=require(_0xf8ff('0x5'));var logger=require(_0xf8ff('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf8ff('0x7')][_0xf8ff('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c5de0,_0x23b3f4,_0x1bb98b){return new BPromise(function(_0x1312dc,_0x5be1e5){return client[_0xf8ff('0x9')](_0x3c5de0,_0x1bb98b)[_0xf8ff('0xa')](function(_0x4c6f3f){logger[_0xf8ff('0xb')](_0xf8ff('0xc'),_0x23b3f4,_0xf8ff('0xd'));logger[_0xf8ff('0xe')](_0xf8ff('0xf'),_0x23b3f4,'request\x20sent',JSON[_0xf8ff('0x10')](_0x4c6f3f));if(_0x4c6f3f[_0xf8ff('0x11')]){if(_0x4c6f3f[_0xf8ff('0x11')][_0xf8ff('0x12')]===0x1f4){logger[_0xf8ff('0x11')](_0xf8ff('0xc'),_0x23b3f4,_0x4c6f3f[_0xf8ff('0x11')]['message']);return _0x5be1e5(_0x4c6f3f[_0xf8ff('0x11')]['message']);}logger['error'](_0xf8ff('0xc'),_0x23b3f4,_0x4c6f3f[_0xf8ff('0x11')][_0xf8ff('0x13')]);return _0x1312dc(_0x4c6f3f[_0xf8ff('0x11')]['message']);}else{logger[_0xf8ff('0xb')](_0xf8ff('0xc'),_0x23b3f4,'request\x20sent');_0x1312dc(_0x4c6f3f[_0xf8ff('0x14')][_0xf8ff('0x13')]);}})[_0xf8ff('0x15')](function(_0x319b8d){logger['error'](_0xf8ff('0xc'),_0x23b3f4,_0x319b8d);_0x5be1e5(_0x319b8d);});});}exports[_0xf8ff('0x16')]=function(_0x4866e7){var _0x2211e0=this;return new Promise(function(_0x23185b,_0x22cd19){return db[_0xf8ff('0x17')][_0xf8ff('0x18')](_0x4866e7[_0xf8ff('0x19')],{'raw':_0x4866e7['options']?_0x4866e7[_0xf8ff('0x1a')][_0xf8ff('0x1b')]===undefined?!![]:![]:!![]})[_0xf8ff('0xa')](function(_0x3695a2){logger[_0xf8ff('0xb')](_0xf8ff('0x16'),_0x4866e7);logger[_0xf8ff('0xe')](_0xf8ff('0x16'),_0x4866e7,JSON[_0xf8ff('0x10')](_0x3695a2));_0x23185b(_0x3695a2);})[_0xf8ff('0x15')](function(_0x215e74){logger[_0xf8ff('0x11')](_0xf8ff('0x16'),_0x215e74['message'],_0x4866e7);_0x22cd19(_0x2211e0[_0xf8ff('0x11')](0x1f4,_0x215e74[_0xf8ff('0x13')]));});});}; \ No newline at end of file +var _0x633c=['then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','CreateReportAgentPreview','ReportAgentPreview','create','body','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x633c,0xd3));var _0xc633=function(_0x2fd1fc,_0x55d932){_0x2fd1fc=_0x2fd1fc-0x0;var _0x1af888=_0x633c[_0x2fd1fc];return _0x1af888;};'use strict';var _=require(_0xc633('0x0'));var util=require(_0xc633('0x1'));var moment=require(_0xc633('0x2'));var BPromise=require(_0xc633('0x3'));var rs=require(_0xc633('0x4'));var fs=require('fs');var Redis=require(_0xc633('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc633('0x6'));var logger=require(_0xc633('0x7'))(_0xc633('0x8'));var config=require(_0xc633('0x9'));var jayson=require(_0xc633('0xa'));var client=jayson[_0xc633('0xb')][_0xc633('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f769b,_0x32fec2,_0xf7020d){return new BPromise(function(_0x13f122,_0x5d7baa){return client['request'](_0x4f769b,_0xf7020d)[_0xc633('0xd')](function(_0x12335b){logger[_0xc633('0xe')](_0xc633('0xf'),_0x32fec2,_0xc633('0x10'));logger[_0xc633('0x11')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x32fec2,_0xc633('0x10'),JSON[_0xc633('0x12')](_0x12335b));if(_0x12335b['error']){if(_0x12335b['error']['code']===0x1f4){logger['error'](_0xc633('0xf'),_0x32fec2,_0x12335b[_0xc633('0x13')]['message']);return _0x5d7baa(_0x12335b[_0xc633('0x13')][_0xc633('0x14')]);}logger[_0xc633('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0x32fec2,_0x12335b[_0xc633('0x13')][_0xc633('0x14')]);return _0x13f122(_0x12335b['error'][_0xc633('0x14')]);}else{logger[_0xc633('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x32fec2,_0xc633('0x10'));_0x13f122(_0x12335b[_0xc633('0x15')]['message']);}})['catch'](function(_0xe57557){logger[_0xc633('0x13')](_0xc633('0xf'),_0x32fec2,_0xe57557);_0x5d7baa(_0xe57557);});});}exports[_0xc633('0x16')]=function(_0x324329){var _0x3981c4=this;return new Promise(function(_0xcef089,_0x41e8b3){return db[_0xc633('0x17')][_0xc633('0x18')](_0x324329[_0xc633('0x19')],{'raw':_0x324329['options']?_0x324329['options'][_0xc633('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1a28d6){logger['info'](_0xc633('0x16'),_0x324329);logger[_0xc633('0x11')]('CreateReportAgentPreview',_0x324329,JSON['stringify'](_0x1a28d6));_0xcef089(_0x1a28d6);})[_0xc633('0x1b')](function(_0x5cdff1){logger[_0xc633('0x13')]('CreateReportAgentPreview',_0x5cdff1['message'],_0x324329);_0x41e8b3(_0x3981c4[_0xc633('0x13')](0x1f4,_0x5cdff1[_0xc633('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 8d36a4a..46a2572 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 _0xbeb1=['Router','../../components/auth/service','isAuthenticated','get','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','/chat/queues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','smsQueues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/outbound','outbound','outboundChannels','/agents','agents','put','/agents/:id/capacity','/telephones','trunks','campaigns','faxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','showMailQueues','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','multer','util','express'];(function(_0x377828,_0x58c57e){var _0x26adb1=function(_0x25c4cc){while(--_0x25c4cc){_0x377828['push'](_0x377828['shift']());}};_0x26adb1(++_0x58c57e);}(_0xbeb1,0xf9));var _0x1beb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xbeb1[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x1beb('0x0'));var util=require(_0x1beb('0x1'));var path=require('path');var express=require(_0x1beb('0x2'));var router=express[_0x1beb('0x3')]();var auth=require(_0x1beb('0x4'));var controller=require('./rpc.controller');router['get']('/voice/channels',auth[_0x1beb('0x5')](),controller['voiceChannels']);router[_0x1beb('0x6')](_0x1beb('0x7'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router['get'](_0x1beb('0x8'),auth[_0x1beb('0x5')](),controller['voiceChannelStopMixMonitor']);router['get']('/voice/queues',auth[_0x1beb('0x5')](),controller['voiceQueues']);router[_0x1beb('0x6')](_0x1beb('0x9'),auth[_0x1beb('0x5')](),controller['chatQueues']);router[_0x1beb('0x6')](_0x1beb('0xa'),auth[_0x1beb('0x5')](),controller[_0x1beb('0xb')]);router[_0x1beb('0x6')](_0x1beb('0xc'),auth['isAuthenticated'](),controller['mailAccounts']);router[_0x1beb('0x6')](_0x1beb('0xd'),auth[_0x1beb('0x5')](),controller[_0x1beb('0xe')]);router[_0x1beb('0x6')]('/sms/queues',auth['isAuthenticated'](),controller[_0x1beb('0xf')]);router[_0x1beb('0x6')]('/whatsapp/queues',auth[_0x1beb('0x5')](),controller[_0x1beb('0x10')]);router[_0x1beb('0x6')]('/fax/queues',auth['isAuthenticated'](),controller[_0x1beb('0x11')]);router[_0x1beb('0x6')](_0x1beb('0x12'),auth[_0x1beb('0x5')](),controller[_0x1beb('0x13')]);router['get']('/voice/queues/channels',auth[_0x1beb('0x5')](),controller['voiceQueuesChannels']);router[_0x1beb('0x6')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x1beb('0x14')]);router[_0x1beb('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x1beb('0x5')](),controller[_0x1beb('0x15')]);router[_0x1beb('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller[_0x1beb('0x16')]);router[_0x1beb('0x6')]('/voice/queues/:id',auth['isAuthenticated'](),controller['showVoiceQueues']);router[_0x1beb('0x6')](_0x1beb('0x17'),auth[_0x1beb('0x5')](),controller[_0x1beb('0x18')]);router['get']('/outbound/channels',auth[_0x1beb('0x5')](),controller[_0x1beb('0x19')]);router[_0x1beb('0x6')](_0x1beb('0x1a'),auth['isAuthenticated'](),controller[_0x1beb('0x1b')]);router[_0x1beb('0x1c')](_0x1beb('0x1d'),auth[_0x1beb('0x5')](),controller['agentCapacity']);router['get'](_0x1beb('0x1e'),auth[_0x1beb('0x5')](),controller['telephones']);router['get']('/trunks',auth[_0x1beb('0x5')](),controller[_0x1beb('0x1f')]);router['get']('/campaigns',auth[_0x1beb('0x5')](),controller[_0x1beb('0x20')]);router[_0x1beb('0x6')]('/fax/accounts',auth[_0x1beb('0x5')](),controller[_0x1beb('0x21')]);router[_0x1beb('0x6')]('/chat/queues/waitinginteractions',auth[_0x1beb('0x5')](),controller[_0x1beb('0x22')]);router['get']('/mail/queues/waitinginteractions',auth[_0x1beb('0x5')](),controller[_0x1beb('0x23')]);router[_0x1beb('0x6')](_0x1beb('0x24'),auth['isAuthenticated'](),controller[_0x1beb('0x25')]);router[_0x1beb('0x6')](_0x1beb('0x26'),auth[_0x1beb('0x5')](),controller[_0x1beb('0x27')]);router[_0x1beb('0x6')]('/sms/queues/waitinginteractions',auth[_0x1beb('0x5')](),controller['smsQueuesWaitingInteractions']);router[_0x1beb('0x6')](_0x1beb('0x28'),auth['isAuthenticated'](),controller[_0x1beb('0x29')]);router[_0x1beb('0x6')](_0x1beb('0x2a'),auth[_0x1beb('0x5')](),controller[_0x1beb('0x2b')]);router[_0x1beb('0x2c')](_0x1beb('0x2d'),auth[_0x1beb('0x5')](),controller['queueNotify']('mail'));router[_0x1beb('0x6')]('/mail/queues/:id',auth[_0x1beb('0x5')](),controller[_0x1beb('0x2e')]);router[_0x1beb('0x2c')](_0x1beb('0x2f'),auth[_0x1beb('0x5')](),controller[_0x1beb('0x30')](_0x1beb('0x31')));router[_0x1beb('0x6')](_0x1beb('0x32'),auth[_0x1beb('0x5')](),controller['showChatQueues']);router[_0x1beb('0x2c')]('/fax/queues/:id/notify',auth[_0x1beb('0x5')](),controller[_0x1beb('0x30')](_0x1beb('0x33')));router['get']('/fax/queues/:id',auth[_0x1beb('0x5')](),controller[_0x1beb('0x34')]);router[_0x1beb('0x2c')](_0x1beb('0x35'),auth[_0x1beb('0x5')](),controller[_0x1beb('0x30')](_0x1beb('0x36')));router[_0x1beb('0x6')]('/openchannel/queues/:id',auth['isAuthenticated'](),controller[_0x1beb('0x37')]);router['post'](_0x1beb('0x38'),auth[_0x1beb('0x5')](),controller[_0x1beb('0x30')]('sms'));router[_0x1beb('0x2c')]('/whatsapp/queues/:id/notify',auth[_0x1beb('0x5')](),controller[_0x1beb('0x30')](_0x1beb('0x39')));router[_0x1beb('0x6')](_0x1beb('0x3a'),auth['isAuthenticated'](),controller['showSmsQueues']);router[_0x1beb('0x6')](_0x1beb('0x3b'),auth[_0x1beb('0x5')](),controller[_0x1beb('0x3c')]);router[_0x1beb('0x2c')](_0x1beb('0x3d'),auth[_0x1beb('0x5')](),controller['agentNotify']);module[_0x1beb('0x3e')]=router; \ No newline at end of file +var _0x2d8f=['mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','express','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/chat/queues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','/whatsapp/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','/trunks','/fax/accounts','/mail/queues/waitinginteractions'];(function(_0x510ea9,_0x41716a){var _0x3914c0=function(_0x419727){while(--_0x419727){_0x510ea9['push'](_0x510ea9['shift']());}};_0x3914c0(++_0x41716a);}(_0x2d8f,0x65));var _0xf2d8=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0x2d8f[_0x313c96];return _0x522f53;};'use strict';var multer=require(_0xf2d8('0x0'));var util=require(_0xf2d8('0x1'));var path=require('path');var express=require(_0xf2d8('0x2'));var router=express['Router']();var auth=require(_0xf2d8('0x3'));var controller=require(_0xf2d8('0x4'));router[_0xf2d8('0x5')](_0xf2d8('0x6'),auth[_0xf2d8('0x7')](),controller[_0xf2d8('0x8')]);router[_0xf2d8('0x5')]('/voice/channels/:uniqueid/mixmonitor',auth[_0xf2d8('0x7')](),controller[_0xf2d8('0x9')]);router[_0xf2d8('0x5')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xf2d8('0x7')](),controller['voiceChannelStopMixMonitor']);router[_0xf2d8('0x5')]('/voice/queues',auth[_0xf2d8('0x7')](),controller['voiceQueues']);router['get'](_0xf2d8('0xa'),auth[_0xf2d8('0x7')](),controller[_0xf2d8('0xb')]);router['get'](_0xf2d8('0xc'),auth['isAuthenticated'](),controller['mailQueues']);router[_0xf2d8('0x5')](_0xf2d8('0xd'),auth[_0xf2d8('0x7')](),controller[_0xf2d8('0xe')]);router[_0xf2d8('0x5')](_0xf2d8('0xf'),auth[_0xf2d8('0x7')](),controller['openchannelQueues']);router[_0xf2d8('0x5')](_0xf2d8('0x10'),auth[_0xf2d8('0x7')](),controller['smsQueues']);router[_0xf2d8('0x5')](_0xf2d8('0x11'),auth[_0xf2d8('0x7')](),controller['whatsappQueues']);router[_0xf2d8('0x5')]('/fax/queues',auth['isAuthenticated'](),controller[_0xf2d8('0x12')]);router[_0xf2d8('0x5')](_0xf2d8('0x13'),auth[_0xf2d8('0x7')](),controller['voiceQueuesPreview']);router[_0xf2d8('0x5')](_0xf2d8('0x14'),auth[_0xf2d8('0x7')](),controller[_0xf2d8('0x15')]);router[_0xf2d8('0x5')](_0xf2d8('0x16'),auth['isAuthenticated'](),controller[_0xf2d8('0x17')]);router[_0xf2d8('0x5')](_0xf2d8('0x18'),auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router['get'](_0xf2d8('0x19'),auth[_0xf2d8('0x7')](),controller[_0xf2d8('0x1a')]);router[_0xf2d8('0x5')](_0xf2d8('0x1b'),auth[_0xf2d8('0x7')](),controller[_0xf2d8('0x1c')]);router[_0xf2d8('0x5')](_0xf2d8('0x1d'),auth[_0xf2d8('0x7')](),controller[_0xf2d8('0x1e')]);router[_0xf2d8('0x5')](_0xf2d8('0x1f'),auth[_0xf2d8('0x7')](),controller['outboundChannels']);router[_0xf2d8('0x5')](_0xf2d8('0x20'),auth[_0xf2d8('0x7')](),controller[_0xf2d8('0x21')]);router[_0xf2d8('0x22')](_0xf2d8('0x23'),auth['isAuthenticated'](),controller[_0xf2d8('0x24')]);router['get'](_0xf2d8('0x25'),auth[_0xf2d8('0x7')](),controller['telephones']);router['get'](_0xf2d8('0x26'),auth['isAuthenticated'](),controller['trunks']);router[_0xf2d8('0x5')]('/campaigns',auth[_0xf2d8('0x7')](),controller['campaigns']);router[_0xf2d8('0x5')](_0xf2d8('0x27'),auth['isAuthenticated'](),controller['faxAccounts']);router['get']('/chat/queues/waitinginteractions',auth[_0xf2d8('0x7')](),controller['chatQueuesWaitingInteractions']);router[_0xf2d8('0x5')](_0xf2d8('0x28'),auth['isAuthenticated'](),controller[_0xf2d8('0x29')]);router[_0xf2d8('0x5')]('/openchannel/queues/waitinginteractions',auth[_0xf2d8('0x7')](),controller[_0xf2d8('0x2a')]);router[_0xf2d8('0x5')](_0xf2d8('0x2b'),auth[_0xf2d8('0x7')](),controller[_0xf2d8('0x2c')]);router['get']('/sms/queues/waitinginteractions',auth[_0xf2d8('0x7')](),controller['smsQueuesWaitingInteractions']);router[_0xf2d8('0x5')](_0xf2d8('0x2d'),auth[_0xf2d8('0x7')](),controller[_0xf2d8('0x2e')]);router[_0xf2d8('0x5')]('/fax/queues/waitinginteractions',auth[_0xf2d8('0x7')](),controller['faxQueuesWaitingInteractions']);router['post'](_0xf2d8('0x2f'),auth[_0xf2d8('0x7')](),controller[_0xf2d8('0x30')]('mail'));router[_0xf2d8('0x5')](_0xf2d8('0x31'),auth[_0xf2d8('0x7')](),controller[_0xf2d8('0x32')]);router[_0xf2d8('0x33')](_0xf2d8('0x34'),auth[_0xf2d8('0x7')](),controller[_0xf2d8('0x30')](_0xf2d8('0x35')));router[_0xf2d8('0x5')](_0xf2d8('0x36'),auth['isAuthenticated'](),controller['showChatQueues']);router[_0xf2d8('0x33')](_0xf2d8('0x37'),auth[_0xf2d8('0x7')](),controller['queueNotify'](_0xf2d8('0x38')));router[_0xf2d8('0x5')](_0xf2d8('0x39'),auth[_0xf2d8('0x7')](),controller[_0xf2d8('0x3a')]);router[_0xf2d8('0x33')]('/openchannel/queues/:id/notify',auth[_0xf2d8('0x7')](),controller[_0xf2d8('0x30')](_0xf2d8('0x3b')));router[_0xf2d8('0x5')](_0xf2d8('0x3c'),auth[_0xf2d8('0x7')](),controller[_0xf2d8('0x3d')]);router[_0xf2d8('0x33')](_0xf2d8('0x3e'),auth[_0xf2d8('0x7')](),controller[_0xf2d8('0x30')](_0xf2d8('0x3f')));router[_0xf2d8('0x33')](_0xf2d8('0x40'),auth[_0xf2d8('0x7')](),controller[_0xf2d8('0x30')]('whatsapp'));router[_0xf2d8('0x5')](_0xf2d8('0x41'),auth[_0xf2d8('0x7')](),controller['showSmsQueues']);router[_0xf2d8('0x5')](_0xf2d8('0x42'),auth['isAuthenticated'](),controller[_0xf2d8('0x43')]);router['post'](_0xf2d8('0x44'),auth['isAuthenticated'](),controller[_0xf2d8('0x45')]);module[_0xf2d8('0x46')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index caf788c..93bc42e 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 _0x2f0d=['value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','Account','QueueId','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','TransferReport','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','catch','json','sendStatus','stack','name','send','isNil','rows','voiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','INTERACTION','interface','format','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','queue_id','uniq'];(function(_0x176a30,_0x214804){var _0x568f0a=function(_0x133e05){while(--_0x133e05){_0x176a30['push'](_0x176a30['shift']());}};_0x568f0a(++_0x214804);}(_0x2f0d,0xa8));var _0xd2f0=function(_0x1a20d9,_0x24f24d){_0x1a20d9=_0x1a20d9-0x0;var _0x3b50ac=_0x2f0d[_0x1a20d9];return _0x3b50ac;};'use strict';var BPromise=require(_0xd2f0('0x0'));var moment=require(_0xd2f0('0x1'));var _=require(_0xd2f0('0x2'));var util=require(_0xd2f0('0x3'));var db=require(_0xd2f0('0x4'))['db'];var logger=require(_0xd2f0('0x5'))(_0xd2f0('0x6'));var jayson=require('jayson/promise');var amiClient=jayson[_0xd2f0('0x7')][_0xd2f0('0x8')]({'port':0x232a});var mailClient=jayson[_0xd2f0('0x7')][_0xd2f0('0x8')]({'port':0x232b});var routingClient=jayson['client'][_0xd2f0('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x1c8200,_0xa5ade5,_0x1d749e){return new BPromise(function(_0x287e19,_0xf204be){var _0x55e27e=_0x1d749e?_0x1d749e:amiClient;return _0x55e27e[_0xd2f0('0x9')](_0x1c8200,_0xa5ade5)[_0xd2f0('0xa')](function(_0x21fff9){if(_0x21fff9[_0xd2f0('0xb')]){if(_0x21fff9[_0xd2f0('0xb')][_0xd2f0('0xc')]===0x1f4){return _0xf204be(_0x21fff9[_0xd2f0('0xb')][_0xd2f0('0xd')]);}return _0x287e19(_0x21fff9[_0xd2f0('0xb')][_0xd2f0('0xd')]);}else{_0x287e19(_0x21fff9[_0xd2f0('0xe')]);}})[_0xd2f0('0xf')](function(_0x91c28){_0xf204be(_0x91c28);});});}function respondWithResult(_0x287b47,_0x5cb7ad){_0x5cb7ad=_0x5cb7ad||0xc8;return function(_0x4e4a2f){if(_0x4e4a2f){return _0x287b47['status'](_0x5cb7ad)[_0xd2f0('0x10')](_0x4e4a2f);}return _0x287b47[_0xd2f0('0x11')](0x194);};}function handleError(_0x559bd6,_0x5e16c1){_0x5e16c1=_0x5e16c1||0x1f4;return function(_0x418976){logger['error'](_0x418976[_0xd2f0('0x12')]);if(_0x418976[_0xd2f0('0x13')]){delete _0x418976['name'];}_0x559bd6['status'](_0x5e16c1)[_0xd2f0('0x14')](_0x418976);};}function findById(_0x438a29){return function(_0x4ee456){if(!_[_0xd2f0('0x15')](_0x438a29)&&!_[_0xd2f0('0x15')](_0x4ee456)&&!_['isNil'](_0x4ee456[_0xd2f0('0x16')])){return _['find'](_0x4ee456[_0xd2f0('0x16')],function(_0x254b10){return _0x254b10['id']==_0x438a29;});}return null;};}exports[_0xd2f0('0x17')]=function(_0x46fc59,_0x5abbc4){return respondWithRpcPromise('VoiceChannels',_0x46fc59[_0xd2f0('0x18')])[_0xd2f0('0xa')](respondWithResult(_0x5abbc4,null))[_0xd2f0('0xf')](handleError(_0x5abbc4,null));};exports[_0xd2f0('0x19')]=function(_0x2d8d5d,_0x1c73e0){return respondWithRpcPromise(_0xd2f0('0x1a'),_[_0xd2f0('0x1b')](_0x2d8d5d[_0xd2f0('0x18')],_0x2d8d5d[_0xd2f0('0x1c')]))[_0xd2f0('0xa')](respondWithResult(_0x1c73e0,null))[_0xd2f0('0xf')](handleError(_0x1c73e0,null));};exports['voiceChannelStopMixMonitor']=function(_0xfdc458,_0x28cc24){return respondWithRpcPromise(_0xd2f0('0x1d'),_[_0xd2f0('0x1b')](_0xfdc458[_0xd2f0('0x18')],_0xfdc458[_0xd2f0('0x1c')]))[_0xd2f0('0xa')](respondWithResult(_0x28cc24,null))[_0xd2f0('0xf')](handleError(_0x28cc24,null));};exports['voiceQueues']=function(_0x336da3,_0xbbd3a7){return respondWithRpcPromise(_0xd2f0('0x1e'),_0x336da3[_0xd2f0('0x18')])['then'](respondWithResult(_0xbbd3a7,null))[_0xd2f0('0xf')](handleError(_0xbbd3a7,null));};exports[_0xd2f0('0x1f')]=function(_0x44f130,_0x2f344b){return respondWithRpcPromise(_0xd2f0('0x1e'),_0x44f130['query'])[_0xd2f0('0xa')](findById(_0x44f130[_0xd2f0('0x1c')]['id']))[_0xd2f0('0xa')](respondWithResult(_0x2f344b,null))[_0xd2f0('0xf')](handleError(_0x2f344b,null));};exports['voiceQueuesPreview']=function(_0x5b4cfe,_0x4df06a){return respondWithRpcPromise(_0xd2f0('0x20'),_['merge'](_0x5b4cfe['query'],_0x5b4cfe[_0xd2f0('0x1c')]))[_0xd2f0('0xa')](respondWithResult(_0x4df06a,null))['catch'](handleError(_0x4df06a,null));};exports['voiceQueuesChannels']=function(_0x30a87e,_0x13a88b){return respondWithRpcPromise(_0xd2f0('0x21'),_0x30a87e[_0xd2f0('0x18')])[_0xd2f0('0xa')](respondWithResult(_0x13a88b,null))['catch'](handleError(_0x13a88b,null));};exports[_0xd2f0('0x22')]=function(_0x478c0d,_0x46ea4a){return respondWithRpcPromise(_0xd2f0('0x23'),_[_0xd2f0('0x1b')](_0x478c0d[_0xd2f0('0x18')],_0x478c0d[_0xd2f0('0x1c')]))[_0xd2f0('0xa')](respondWithResult(_0x46ea4a,null))['catch'](handleError(_0x46ea4a,null));};exports[_0xd2f0('0x24')]=function(_0x237a9f,_0xbefcb8){return respondWithRpcPromise(_0xd2f0('0x25'),_[_0xd2f0('0x1b')](_0x237a9f['query'],_0x237a9f[_0xd2f0('0x1c')]))[_0xd2f0('0xa')](respondWithResult(_0xbefcb8,null))[_0xd2f0('0xf')](handleError(_0xbefcb8,null));};exports['voiceQueuesChannelRedirect']=function(_0x1bf86d,_0x355161){return respondWithRpcPromise(_0xd2f0('0x26'),_[_0xd2f0('0x1b')](_0x1bf86d[_0xd2f0('0x18')],_0x1bf86d[_0xd2f0('0x1c')]))[_0xd2f0('0xa')](respondWithResult(_0x355161,null))[_0xd2f0('0xf')](handleError(_0x355161,null));};exports[_0xd2f0('0x27')]=function(_0x26ef4c,_0x62563e){return respondWithRpcPromise(_0xd2f0('0x28'),_0x26ef4c[_0xd2f0('0x18')])[_0xd2f0('0xa')](respondWithResult(_0x62563e,null))[_0xd2f0('0xf')](handleError(_0x62563e,null));};exports[_0xd2f0('0x29')]=function(_0x18dae5,_0x30fa35){return respondWithRpcPromise(_0xd2f0('0x2a'),_0x18dae5[_0xd2f0('0x18')])[_0xd2f0('0xa')](respondWithResult(_0x30fa35,null))[_0xd2f0('0xf')](handleError(_0x30fa35,null));};exports[_0xd2f0('0x2b')]=function(_0x18521e,_0x1d3c94){var _0x42fad6;return respondWithRpcPromise(_0xd2f0('0x2c'),_0x18521e['query'])[_0xd2f0('0xa')](function(_0x54ef34){_0x42fad6=_0x54ef34;return respondWithRpcPromise('Agents',_0x18521e[_0xd2f0('0x18')],routingClient);})[_0xd2f0('0xa')](function(_0x48ecd0){return _[_0xd2f0('0x1b')]({},_0x48ecd0,_0x42fad6);})[_0xd2f0('0xa')](respondWithResult(_0x1d3c94,null))['catch'](handleError(_0x1d3c94,null));};exports[_0xd2f0('0x2d')]=function(_0x4dca4d,_0x3faa2d){if(_0x4dca4d['body']&&_0x4dca4d[_0xd2f0('0x2e')][_0xd2f0('0x2f')]&&_0x4dca4d[_0xd2f0('0x30')]&&_0x4dca4d[_0xd2f0('0x30')][_0xd2f0('0x13')]){for(var _0x42972b in _0x4dca4d[_0xd2f0('0x2e')][_0xd2f0('0x2f')]){if(_0x4dca4d[_0xd2f0('0x2e')]['interaction'][_0xd2f0('0x31')](_0x42972b)){db[_0xd2f0('0x32')]['findAll']({'where':{'channel':_0x42972b,'membername':_0x4dca4d['user'][_0xd2f0('0x13')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x4dca4d[_0xd2f0('0x2e')][_0xd2f0('0x2f')][_0x42972b]&&_0x4dca4d['body'][_0xd2f0('0x2f')][_0x42972b][_0xd2f0('0x33')]?{'$notIn':_0x4dca4d[_0xd2f0('0x2e')][_0xd2f0('0x2f')][_0x42972b]}:{'$ne':null}}})[_0xd2f0('0xa')](function(_0x2ff1fe){var _0x426af9=moment()['format'](_0xd2f0('0x34'));for(var _0x5a4bfb=0x0,_0x5a4e2e=_0x2ff1fe[_0xd2f0('0x33')];_0x5a4bfb<_0x5a4e2e;_0x5a4bfb+=0x1){_0x2ff1fe[_0x5a4bfb][_0xd2f0('0x35')]({'exitAt':_0x426af9});}});for(var _0x29d1ab=0x0;_0x29d1ab<_0x4dca4d['body']['interaction'][_0x42972b]['length'];_0x29d1ab+=0x1){db[_0xd2f0('0x32')][_0xd2f0('0x36')]({'where':{'channel':_0x42972b,'membername':_0x4dca4d[_0xd2f0('0x30')][_0xd2f0('0x13')],'type':_0xd2f0('0x37'),'uniqueid':_0x4dca4d[_0xd2f0('0x2e')]['interaction'][_0x42972b][_0x29d1ab],'exitAt':null},'defaults':{'channel':_0x42972b,'membername':_0x4dca4d[_0xd2f0('0x30')][_0xd2f0('0x13')],'interface':_[_0xd2f0('0x15')](_0x4dca4d[_0xd2f0('0x30')][_0xd2f0('0x38')])?util[_0xd2f0('0x39')](_0xd2f0('0x3a'),_0x4dca4d[_0xd2f0('0x30')][_0xd2f0('0x13')]):_0x4dca4d['user'][_0xd2f0('0x38')],'type':_0xd2f0('0x37'),'enterAt':moment()['format'](_0xd2f0('0x34')),'role':_0xd2f0('0x3b'),'internal':_0x4dca4d[_0xd2f0('0x30')][_0xd2f0('0x3c')],'uniqueid':_0x4dca4d['body'][_0xd2f0('0x2f')][_0x42972b][_0x29d1ab]}});}}}}return respondWithRpcPromise(_0xd2f0('0x3d'),{'id':_0x4dca4d['params']['id'],'capacity':_0x4dca4d[_0xd2f0('0x2e')][_0xd2f0('0x3e')]},routingClient)[_0xd2f0('0xa')](respondWithResult(_0x3faa2d,null))['catch'](handleError(_0x3faa2d,null));};exports[_0xd2f0('0x3f')]=function(_0x48ad48,_0x1b43d6){return respondWithRpcPromise(_0xd2f0('0x40'),_0x48ad48['query'])['then'](respondWithResult(_0x1b43d6,null))[_0xd2f0('0xf')](handleError(_0x1b43d6,null));};exports[_0xd2f0('0x41')]=function(_0x3fe993,_0x4a25ca){return respondWithRpcPromise(_0xd2f0('0x42'),_0x3fe993['query'])['then'](respondWithResult(_0x4a25ca,null))[_0xd2f0('0xf')](handleError(_0x4a25ca,null));};exports[_0xd2f0('0x43')]=function(_0x5ce2d0,_0x45dc36){return respondWithRpcPromise(_0xd2f0('0x44'),_0x5ce2d0[_0xd2f0('0x18')])['then'](respondWithResult(_0x45dc36,null))[_0xd2f0('0xf')](handleError(_0x45dc36,null));};exports['chatQueues']=function(_0xade04d,_0x4badc4){return respondWithRpcPromise(_0xd2f0('0x45'),_0xade04d[_0xd2f0('0x18')],routingClient)['then'](respondWithResult(_0x4badc4,null))[_0xd2f0('0xf')](handleError(_0x4badc4,null));};exports[_0xd2f0('0x46')]=function(_0x5e3654,_0xf9026d){return respondWithRpcPromise(_0xd2f0('0x45'),_0x5e3654['query'],routingClient)[_0xd2f0('0xa')](findById(_0x5e3654[_0xd2f0('0x1c')]['id']))['then'](respondWithResult(_0xf9026d,null))[_0xd2f0('0xf')](handleError(_0xf9026d,null));};exports[_0xd2f0('0x47')]=function(_0x5c5700,_0x46c2bd){return respondWithRpcPromise(_0xd2f0('0x48'),_0x5c5700['query'],routingClient)['then'](respondWithResult(_0x46c2bd,null))['catch'](handleError(_0x46c2bd,null));};exports[_0xd2f0('0x49')]=function(_0xfbc913,_0x32910f){return respondWithRpcPromise(_0xd2f0('0x48'),_0xfbc913['query'],routingClient)[_0xd2f0('0xa')](findById(_0xfbc913[_0xd2f0('0x1c')]['id']))[_0xd2f0('0xa')](respondWithResult(_0x32910f,null))[_0xd2f0('0xf')](handleError(_0x32910f,null));};exports[_0xd2f0('0x4a')]=function(_0x2e7247,_0x33987a){return respondWithRpcPromise(_0xd2f0('0x4b'),_0x2e7247[_0xd2f0('0x18')],mailClient)[_0xd2f0('0xa')](respondWithResult(_0x33987a,null))[_0xd2f0('0xf')](handleError(_0x33987a,null));};exports[_0xd2f0('0x4c')]=function(_0x4385ee,_0x9bb4f8){return respondWithRpcPromise('OpenchannelQueues',_0x4385ee['query'],routingClient)[_0xd2f0('0xa')](respondWithResult(_0x9bb4f8,null))['catch'](handleError(_0x9bb4f8,null));};exports['showOpenchannelQueues']=function(_0x318ffe,_0xb778b0){return respondWithRpcPromise(_0xd2f0('0x4d'),_0x318ffe[_0xd2f0('0x18')],routingClient)[_0xd2f0('0xa')](findById(_0x318ffe[_0xd2f0('0x1c')]['id']))[_0xd2f0('0xa')](respondWithResult(_0xb778b0,null))['catch'](handleError(_0xb778b0,null));};exports[_0xd2f0('0x4e')]=function(_0xf5f533,_0x13dce5){return respondWithRpcPromise(_0xd2f0('0x4f'),_0xf5f533['query'],routingClient)[_0xd2f0('0xa')](respondWithResult(_0x13dce5,null))[_0xd2f0('0xf')](handleError(_0x13dce5,null));};exports[_0xd2f0('0x50')]=function(_0x5b0042,_0x3af8d2){return respondWithRpcPromise('SmsQueues',_0x5b0042[_0xd2f0('0x18')],routingClient)[_0xd2f0('0xa')](findById(_0x5b0042[_0xd2f0('0x1c')]['id']))[_0xd2f0('0xa')](respondWithResult(_0x3af8d2,null))[_0xd2f0('0xf')](handleError(_0x3af8d2,null));};exports[_0xd2f0('0x51')]=function(_0x4337ff,_0xfa96c1){return respondWithRpcPromise(_0xd2f0('0x52'),_0x4337ff['query'],routingClient)[_0xd2f0('0xa')](respondWithResult(_0xfa96c1,null))[_0xd2f0('0xf')](handleError(_0xfa96c1,null));};exports[_0xd2f0('0x53')]=function(_0x32e427,_0x4f1b1b){return respondWithRpcPromise('WhatsappQueues',_0x32e427[_0xd2f0('0x18')],routingClient)[_0xd2f0('0xa')](findById(_0x32e427[_0xd2f0('0x1c')]['id']))[_0xd2f0('0xa')](respondWithResult(_0x4f1b1b,null))[_0xd2f0('0xf')](handleError(_0x4f1b1b,null));};exports[_0xd2f0('0x54')]=function(_0x35e2fe,_0x39eafd){return respondWithRpcPromise(_0xd2f0('0x55'),_0x35e2fe[_0xd2f0('0x18')],routingClient)['then'](respondWithResult(_0x39eafd,null))[_0xd2f0('0xf')](handleError(_0x39eafd,null));};exports['showFaxQueues']=function(_0x415727,_0x41b47a){return respondWithRpcPromise(_0xd2f0('0x55'),_0x415727['query'],routingClient)[_0xd2f0('0xa')](findById(_0x415727[_0xd2f0('0x1c')]['id']))[_0xd2f0('0xa')](respondWithResult(_0x41b47a,null))['catch'](handleError(_0x41b47a,null));};exports[_0xd2f0('0x56')]=function(_0x13dfef,_0x351086){return respondWithRpcPromise(_0xd2f0('0x57'),_0x13dfef['query'])['then'](respondWithResult(_0x351086,null))[_0xd2f0('0xf')](handleError(_0x351086,null));};exports[_0xd2f0('0x58')]=function(_0x28cc62,_0xa55732){return respondWithRpcPromise(_0xd2f0('0x59'),_0x28cc62[_0xd2f0('0x18')],routingClient)[_0xd2f0('0xa')](respondWithResult(_0xa55732,null))[_0xd2f0('0xf')](handleError(_0xa55732,null));};exports[_0xd2f0('0x5a')]=function(_0x2e9435,_0x26e2b3){return respondWithRpcPromise(_0xd2f0('0x5b'),_0x2e9435[_0xd2f0('0x18')],routingClient)[_0xd2f0('0xa')](respondWithResult(_0x26e2b3,null))['catch'](handleError(_0x26e2b3,null));};exports[_0xd2f0('0x5c')]=function(_0x3310e6,_0x5aa5e6){return respondWithRpcPromise(_0xd2f0('0x5d'),_0x3310e6[_0xd2f0('0x18')],routingClient)[_0xd2f0('0xa')](respondWithResult(_0x5aa5e6,null))['catch'](handleError(_0x5aa5e6,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x2d57b6,_0x3cee8a){return respondWithRpcPromise(_0xd2f0('0x5d'),_0x2d57b6[_0xd2f0('0x18')],routingClient)[_0xd2f0('0xa')](function(_0x5957c8){if(_0x2d57b6[_0xd2f0('0x18')][_0xd2f0('0x5e')]!==undefined){var _0x1186cb=_(_0x5957c8[_0xd2f0('0x16')])[_0xd2f0('0x5f')]([_0x2d57b6[_0xd2f0('0x18')]['type'],_0x2d57b6[_0xd2f0('0x1c')]['id']])['map'](_0xd2f0('0x60'))[_0xd2f0('0x61')]()[_0xd2f0('0x62')]();return _0x5957c8['rows'][_0xd2f0('0x5f')](function(_0x34fc06){return _0x1186cb[_0xd2f0('0x63')](_0x34fc06['queue_id'])>-0x1;});}else{return _0x5957c8[_0xd2f0('0x16')]['filter'](function(_0x258d8f){return _0x258d8f['queue_id']===parseInt(_0x2d57b6[_0xd2f0('0x1c')]['id']);});}})['then'](respondWithResult(_0x3cee8a,null))['catch'](handleError(_0x3cee8a,null));};exports[_0xd2f0('0x64')]=function(_0x59b1e3,_0x209fa5){return respondWithRpcPromise(_0xd2f0('0x65'),_0x59b1e3[_0xd2f0('0x18')],routingClient)[_0xd2f0('0xa')](respondWithResult(_0x209fa5,null))[_0xd2f0('0xf')](handleError(_0x209fa5,null));};exports[_0xd2f0('0x66')]=function(_0x5e20a3,_0x2ffae5){return respondWithRpcPromise(_0xd2f0('0x67'),_0x5e20a3[_0xd2f0('0x18')],routingClient)['then'](respondWithResult(_0x2ffae5,null))['catch'](handleError(_0x2ffae5,null));};exports[_0xd2f0('0x68')]=function(_0x556cb6,_0x3589dc){return respondWithRpcPromise(_0xd2f0('0x69'),_0x556cb6[_0xd2f0('0x18')],routingClient)['then'](respondWithResult(_0x3589dc,null))[_0xd2f0('0xf')](handleError(_0x3589dc,null));};exports[_0xd2f0('0x6a')]=function(_0x42d6c3){return function(_0x5bbc16,_0x5070e7){var _0x22bfec,_0x436ff8;var _0x142f9c=_[_0xd2f0('0x6b')](_0x42d6c3);var _0x42e628=_0x42d6c3===_0xd2f0('0x6c')?_0xd2f0('0x6d'):'Account';return db[_0x142f9c+_0xd2f0('0x6e')][_0xd2f0('0x6f')]({'raw':!![],'where':{'id':_0x5bbc16[_0xd2f0('0x1c')]['id']}})[_0xd2f0('0xa')](function(_0x137e5e){if(_['isNil'](_0x137e5e)){throw new Error(_0x142f9c+_0xd2f0('0x70'));}_0x22bfec=_0x137e5e;return db[_0x142f9c+_0xd2f0('0x71')][_0xd2f0('0x6f')]({'where':{'id':_0x5bbc16[_0xd2f0('0x2e')][_0xd2f0('0x72')]},'include':[{'model':db[_0x142f9c+_0xd2f0('0x73')],'as':_0xd2f0('0x73')},{'model':db[_0x142f9c+_0x42e628],'as':'Account'}]});})['then'](function(_0x48288f){if(_[_0xd2f0('0x15')](_0x48288f)){throw new Error(_0x142f9c+_0xd2f0('0x74'));}_0x436ff8=_0x48288f;return _0x48288f[_0xd2f0('0x75')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd2f0('0xa')](function(){var _0xb08e11={'uniqueid':_0x42d6c3+'.'+_0x436ff8['id']+'.'+_0x436ff8[_0xd2f0('0x73')]['id'],'FromUserId':_0x5bbc16[_0xd2f0('0x30')]['id'],'type':'queue'};_0xb08e11[_0x142f9c+_0xd2f0('0x76')]=_0x436ff8['id'];_0xb08e11[_0x142f9c+_0xd2f0('0x77')]=_0x436ff8[_0xd2f0('0x73')]['id'];_0xb08e11[_0xd2f0('0x78')+_0x142f9c+_0x42e628+'Id']=_0x436ff8[_0xd2f0('0x79')]['id'];_0xb08e11['To'+_0x142f9c+_0xd2f0('0x7a')]=_0x22bfec['id'];return db[_0x142f9c+'TransferReport']['create'](_0xb08e11);})[_0xd2f0('0xa')](function(){return respondWithRpcPromise(_0xd2f0('0x7b'),{'channel':_0x42d6c3,'interaction':_0x436ff8['Interaction'],'message':_0x436ff8,'account':_0x436ff8[_0xd2f0('0x79')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd2f0('0x7c'),'appdata':_0x22bfec[_0xd2f0('0x13')]+','+(_0x436ff8[_0xd2f0('0x79')][_0xd2f0('0x7d')]||0x12c),'interval':_0xd2f0('0x7e')}]},routingClient);})[_0xd2f0('0xa')](respondWithResult(_0x5070e7,null))[_0xd2f0('0xf')](handleError(_0x5070e7,null));};};exports[_0xd2f0('0x7f')]=function(_0x34a3c3,_0x4b45a5){var _0x31cb42,_0x8a3b76;if(_['isNil'](_0x34a3c3[_0xd2f0('0x2e')]['channel'])){throw new Error(_0xd2f0('0x80'));}var _0x127eb9=_0x34a3c3[_0xd2f0('0x2e')][_0xd2f0('0x81')];var _0x3f1d4e=_[_0xd2f0('0x6b')](_0x127eb9);var _0x136c77=_0x127eb9===_0xd2f0('0x6c')?_0xd2f0('0x6d'):_0xd2f0('0x79');return db[_0xd2f0('0x82')][_0xd2f0('0x6f')]({'raw':!![],'where':{'id':_0x34a3c3[_0xd2f0('0x1c')]['id'],'role':_0xd2f0('0x3b')}})[_0xd2f0('0xa')](function(_0x23bfa1){if(_['isNil'](_0x23bfa1)){throw new Error(_0xd2f0('0x83'));}_0x31cb42=_0x23bfa1;return db[_0x3f1d4e+_0xd2f0('0x71')][_0xd2f0('0x6f')]({'where':{'id':_0x34a3c3['body'][_0xd2f0('0x72')]},'include':[{'model':db[_0x3f1d4e+'Interaction'],'as':_0xd2f0('0x73')},{'model':db[_0x3f1d4e+_0x136c77],'as':_0xd2f0('0x79')}]});})[_0xd2f0('0xa')](function(_0x4e5c61){if(_['isNil'](_0x4e5c61)){throw new Error(_0x3f1d4e+_0xd2f0('0x74'));}_0x8a3b76=_0x4e5c61;return _0x4e5c61[_0xd2f0('0x75')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd2f0('0xa')](function(){var _0x37287d={'uniqueid':_0x127eb9+'.'+_0x8a3b76['id']+'.'+_0x8a3b76['Interaction']['id'],'FromUserId':_0x34a3c3[_0xd2f0('0x30')]['id'],'type':_0xd2f0('0x7c'),'ToUserId':_0x31cb42['id']};_0x37287d[_0x3f1d4e+'MessageId']=_0x8a3b76['id'];_0x37287d[_0x3f1d4e+_0xd2f0('0x77')]=_0x8a3b76[_0xd2f0('0x73')]['id'];_0x37287d['From'+_0x3f1d4e+_0x136c77+'Id']=_0x8a3b76[_0xd2f0('0x79')]['id'];return db[_0x3f1d4e+_0xd2f0('0x84')]['create'](_0x37287d);})[_0xd2f0('0xa')](function(){return respondWithRpcPromise(_0xd2f0('0x7b'),{'channel':_0x127eb9,'interaction':_0x8a3b76['Interaction'],'message':_0x8a3b76,'account':_0x8a3b76[_0xd2f0('0x79')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd2f0('0x3b'),'appdata':_0x31cb42['name']+','+(_0x8a3b76[_0xd2f0('0x79')]['agentTransferTimeout']||0x12c),'interval':_0xd2f0('0x7e')}]},routingClient);})[_0xd2f0('0xa')](respondWithResult(_0x4b45a5,null))[_0xd2f0('0xf')](handleError(_0x4b45a5,null));}; \ No newline at end of file +var _0x5ee6=['voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','format','length','updateAttributes','findOrCreate','SIP/%s','interface','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Website','Account','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','queue','InteractionId','From','QueueId','TransferReport','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','Agent\x20not\x20found','MessageId','create','bluebird','moment','lodash','util','../../config/logger','jayson/promise','client','http','request','then','error','code','message','result','catch','sendStatus','stack','name','status','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','merge','params'];(function(_0x101a01,_0x18bd83){var _0x538e92=function(_0x3ed902){while(--_0x3ed902){_0x101a01['push'](_0x101a01['shift']());}};_0x538e92(++_0x18bd83);}(_0x5ee6,0x15c));var _0x65ee=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5ee6[_0x19950b];return _0x3c6b41;};'use strict';var BPromise=require(_0x65ee('0x0'));var moment=require(_0x65ee('0x1'));var _=require(_0x65ee('0x2'));var util=require(_0x65ee('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x65ee('0x4'))('api');var jayson=require(_0x65ee('0x5'));var amiClient=jayson[_0x65ee('0x6')][_0x65ee('0x7')]({'port':0x232a});var mailClient=jayson[_0x65ee('0x6')][_0x65ee('0x7')]({'port':0x232b});var routingClient=jayson[_0x65ee('0x6')][_0x65ee('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x140869,_0x2d1ab3,_0x5aa1ac){return new BPromise(function(_0x11da8a,_0xd9ba31){var _0x2ff7fc=_0x5aa1ac?_0x5aa1ac:amiClient;return _0x2ff7fc[_0x65ee('0x8')](_0x140869,_0x2d1ab3)[_0x65ee('0x9')](function(_0x4f3168){if(_0x4f3168['error']){if(_0x4f3168[_0x65ee('0xa')][_0x65ee('0xb')]===0x1f4){return _0xd9ba31(_0x4f3168[_0x65ee('0xa')][_0x65ee('0xc')]);}return _0x11da8a(_0x4f3168[_0x65ee('0xa')][_0x65ee('0xc')]);}else{_0x11da8a(_0x4f3168[_0x65ee('0xd')]);}})[_0x65ee('0xe')](function(_0x536522){_0xd9ba31(_0x536522);});});}function respondWithResult(_0x27fc1b,_0x59964b){_0x59964b=_0x59964b||0xc8;return function(_0x56b6b4){if(_0x56b6b4){return _0x27fc1b['status'](_0x59964b)['json'](_0x56b6b4);}return _0x27fc1b[_0x65ee('0xf')](0x194);};}function handleError(_0x263514,_0x4e9781){_0x4e9781=_0x4e9781||0x1f4;return function(_0x6f48ee){logger[_0x65ee('0xa')](_0x6f48ee[_0x65ee('0x10')]);if(_0x6f48ee[_0x65ee('0x11')]){delete _0x6f48ee[_0x65ee('0x11')];}_0x263514[_0x65ee('0x12')](_0x4e9781)[_0x65ee('0x13')](_0x6f48ee);};}function findById(_0x4894e9){return function(_0x2e4f83){if(!_[_0x65ee('0x14')](_0x4894e9)&&!_[_0x65ee('0x14')](_0x2e4f83)&&!_[_0x65ee('0x14')](_0x2e4f83['rows'])){return _['find'](_0x2e4f83[_0x65ee('0x15')],function(_0x53e3e6){return _0x53e3e6['id']==_0x4894e9;});}return null;};}exports['voiceChannels']=function(_0x2db6eb,_0x123cf1){return respondWithRpcPromise(_0x65ee('0x16'),_0x2db6eb[_0x65ee('0x17')])['then'](respondWithResult(_0x123cf1,null))[_0x65ee('0xe')](handleError(_0x123cf1,null));};exports[_0x65ee('0x18')]=function(_0x509568,_0x4ada4f){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x65ee('0x19')](_0x509568['query'],_0x509568[_0x65ee('0x1a')]))[_0x65ee('0x9')](respondWithResult(_0x4ada4f,null))[_0x65ee('0xe')](handleError(_0x4ada4f,null));};exports[_0x65ee('0x1b')]=function(_0x4176e1,_0x94d812){return respondWithRpcPromise(_0x65ee('0x1c'),_[_0x65ee('0x19')](_0x4176e1[_0x65ee('0x17')],_0x4176e1['params']))[_0x65ee('0x9')](respondWithResult(_0x94d812,null))[_0x65ee('0xe')](handleError(_0x94d812,null));};exports[_0x65ee('0x1d')]=function(_0x44c361,_0x21a748){return respondWithRpcPromise('VoiceQueues',_0x44c361['query'])[_0x65ee('0x9')](respondWithResult(_0x21a748,null))[_0x65ee('0xe')](handleError(_0x21a748,null));};exports['showVoiceQueues']=function(_0x56bee4,_0x5f1494){return respondWithRpcPromise('VoiceQueues',_0x56bee4['query'])[_0x65ee('0x9')](findById(_0x56bee4[_0x65ee('0x1a')]['id']))[_0x65ee('0x9')](respondWithResult(_0x5f1494,null))[_0x65ee('0xe')](handleError(_0x5f1494,null));};exports['voiceQueuesPreview']=function(_0x1d2b63,_0x46034d){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x65ee('0x19')](_0x1d2b63['query'],_0x1d2b63[_0x65ee('0x1a')]))[_0x65ee('0x9')](respondWithResult(_0x46034d,null))[_0x65ee('0xe')](handleError(_0x46034d,null));};exports[_0x65ee('0x1e')]=function(_0x4cfc42,_0x4f385c){return respondWithRpcPromise('VoiceQueuesChannels',_0x4cfc42[_0x65ee('0x17')])['then'](respondWithResult(_0x4f385c,null))[_0x65ee('0xe')](handleError(_0x4f385c,null));};exports[_0x65ee('0x1f')]=function(_0x4208d8,_0x504955){return respondWithRpcPromise(_0x65ee('0x20'),_[_0x65ee('0x19')](_0x4208d8[_0x65ee('0x17')],_0x4208d8[_0x65ee('0x1a')]))['then'](respondWithResult(_0x504955,null))[_0x65ee('0xe')](handleError(_0x504955,null));};exports[_0x65ee('0x21')]=function(_0x297a9e,_0x4cdea){return respondWithRpcPromise(_0x65ee('0x22'),_[_0x65ee('0x19')](_0x297a9e['query'],_0x297a9e[_0x65ee('0x1a')]))[_0x65ee('0x9')](respondWithResult(_0x4cdea,null))[_0x65ee('0xe')](handleError(_0x4cdea,null));};exports[_0x65ee('0x23')]=function(_0x5ddbc0,_0xebb873){return respondWithRpcPromise(_0x65ee('0x24'),_[_0x65ee('0x19')](_0x5ddbc0[_0x65ee('0x17')],_0x5ddbc0['params']))['then'](respondWithResult(_0xebb873,null))[_0x65ee('0xe')](handleError(_0xebb873,null));};exports['outbound']=function(_0x3b1223,_0x31c5d4){return respondWithRpcPromise(_0x65ee('0x25'),_0x3b1223[_0x65ee('0x17')])[_0x65ee('0x9')](respondWithResult(_0x31c5d4,null))[_0x65ee('0xe')](handleError(_0x31c5d4,null));};exports[_0x65ee('0x26')]=function(_0x4526d0,_0x5b7403){return respondWithRpcPromise(_0x65ee('0x27'),_0x4526d0[_0x65ee('0x17')])[_0x65ee('0x9')](respondWithResult(_0x5b7403,null))[_0x65ee('0xe')](handleError(_0x5b7403,null));};exports['agents']=function(_0x40a773,_0x299608){var _0x5c48e7;return respondWithRpcPromise(_0x65ee('0x28'),_0x40a773['query'])[_0x65ee('0x9')](function(_0x3e4174){_0x5c48e7=_0x3e4174;return respondWithRpcPromise(_0x65ee('0x28'),_0x40a773['query'],routingClient);})['then'](function(_0x362b08){return _['merge']({},_0x362b08,_0x5c48e7);})[_0x65ee('0x9')](respondWithResult(_0x299608,null))[_0x65ee('0xe')](handleError(_0x299608,null));};exports[_0x65ee('0x29')]=function(_0x247630,_0x4f73a9){if(_0x247630[_0x65ee('0x2a')]&&_0x247630['body'][_0x65ee('0x2b')]&&_0x247630[_0x65ee('0x2c')]&&_0x247630[_0x65ee('0x2c')]['name']){for(var _0x46122b in _0x247630['body'][_0x65ee('0x2b')]){if(_0x247630[_0x65ee('0x2a')][_0x65ee('0x2b')][_0x65ee('0x2d')](_0x46122b)){db[_0x65ee('0x2e')][_0x65ee('0x2f')]({'where':{'channel':_0x46122b,'membername':_0x247630[_0x65ee('0x2c')][_0x65ee('0x11')],'type':_0x65ee('0x30'),'exitAt':null,'uniqueid':_0x247630[_0x65ee('0x2a')][_0x65ee('0x2b')][_0x46122b]&&_0x247630[_0x65ee('0x2a')][_0x65ee('0x2b')][_0x46122b]['length']?{'$notIn':_0x247630[_0x65ee('0x2a')][_0x65ee('0x2b')][_0x46122b]}:{'$ne':null}}})[_0x65ee('0x9')](function(_0x57a024){var _0x3b3e52=moment()[_0x65ee('0x31')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x386964=0x0,_0x4d4865=_0x57a024[_0x65ee('0x32')];_0x386964<_0x4d4865;_0x386964+=0x1){_0x57a024[_0x386964][_0x65ee('0x33')]({'exitAt':_0x3b3e52});}});for(var _0x5492d4=0x0;_0x5492d4<_0x247630[_0x65ee('0x2a')][_0x65ee('0x2b')][_0x46122b][_0x65ee('0x32')];_0x5492d4+=0x1){db[_0x65ee('0x2e')][_0x65ee('0x34')]({'where':{'channel':_0x46122b,'membername':_0x247630[_0x65ee('0x2c')][_0x65ee('0x11')],'type':_0x65ee('0x30'),'uniqueid':_0x247630['body'][_0x65ee('0x2b')][_0x46122b][_0x5492d4],'exitAt':null},'defaults':{'channel':_0x46122b,'membername':_0x247630[_0x65ee('0x2c')][_0x65ee('0x11')],'interface':_['isNil'](_0x247630[_0x65ee('0x2c')]['interface'])?util[_0x65ee('0x31')](_0x65ee('0x35'),_0x247630[_0x65ee('0x2c')][_0x65ee('0x11')]):_0x247630[_0x65ee('0x2c')][_0x65ee('0x36')],'type':_0x65ee('0x30'),'enterAt':moment()[_0x65ee('0x31')](_0x65ee('0x37')),'role':_0x65ee('0x38'),'internal':_0x247630[_0x65ee('0x2c')][_0x65ee('0x39')],'uniqueid':_0x247630['body']['interaction'][_0x46122b][_0x5492d4]}});}}}}return respondWithRpcPromise(_0x65ee('0x3a'),{'id':_0x247630[_0x65ee('0x1a')]['id'],'capacity':_0x247630['body']['capacity']},routingClient)[_0x65ee('0x9')](respondWithResult(_0x4f73a9,null))[_0x65ee('0xe')](handleError(_0x4f73a9,null));};exports['telephones']=function(_0xca0df4,_0x5cf607){return respondWithRpcPromise(_0x65ee('0x3b'),_0xca0df4[_0x65ee('0x17')])[_0x65ee('0x9')](respondWithResult(_0x5cf607,null))[_0x65ee('0xe')](handleError(_0x5cf607,null));};exports[_0x65ee('0x3c')]=function(_0x94b2a9,_0x2f3b2d){return respondWithRpcPromise(_0x65ee('0x3d'),_0x94b2a9[_0x65ee('0x17')])[_0x65ee('0x9')](respondWithResult(_0x2f3b2d,null))[_0x65ee('0xe')](handleError(_0x2f3b2d,null));};exports[_0x65ee('0x3e')]=function(_0x2220a8,_0x2ff727){return respondWithRpcPromise(_0x65ee('0x3f'),_0x2220a8[_0x65ee('0x17')])[_0x65ee('0x9')](respondWithResult(_0x2ff727,null))[_0x65ee('0xe')](handleError(_0x2ff727,null));};exports[_0x65ee('0x40')]=function(_0x3692e5,_0x2bbfe2){return respondWithRpcPromise(_0x65ee('0x41'),_0x3692e5[_0x65ee('0x17')],routingClient)[_0x65ee('0x9')](respondWithResult(_0x2bbfe2,null))[_0x65ee('0xe')](handleError(_0x2bbfe2,null));};exports[_0x65ee('0x42')]=function(_0x353b35,_0x509a6d){return respondWithRpcPromise(_0x65ee('0x41'),_0x353b35[_0x65ee('0x17')],routingClient)[_0x65ee('0x9')](findById(_0x353b35[_0x65ee('0x1a')]['id']))['then'](respondWithResult(_0x509a6d,null))[_0x65ee('0xe')](handleError(_0x509a6d,null));};exports[_0x65ee('0x43')]=function(_0x510527,_0x53461f){return respondWithRpcPromise('MailQueues',_0x510527[_0x65ee('0x17')],routingClient)[_0x65ee('0x9')](respondWithResult(_0x53461f,null))[_0x65ee('0xe')](handleError(_0x53461f,null));};exports[_0x65ee('0x44')]=function(_0x10353a,_0x21f8b6){return respondWithRpcPromise(_0x65ee('0x45'),_0x10353a[_0x65ee('0x17')],routingClient)[_0x65ee('0x9')](findById(_0x10353a[_0x65ee('0x1a')]['id']))[_0x65ee('0x9')](respondWithResult(_0x21f8b6,null))['catch'](handleError(_0x21f8b6,null));};exports[_0x65ee('0x46')]=function(_0x3818fc,_0x1180a3){return respondWithRpcPromise(_0x65ee('0x47'),_0x3818fc['query'],mailClient)[_0x65ee('0x9')](respondWithResult(_0x1180a3,null))['catch'](handleError(_0x1180a3,null));};exports['openchannelQueues']=function(_0x2f4953,_0x2e189c){return respondWithRpcPromise('OpenchannelQueues',_0x2f4953['query'],routingClient)[_0x65ee('0x9')](respondWithResult(_0x2e189c,null))[_0x65ee('0xe')](handleError(_0x2e189c,null));};exports[_0x65ee('0x48')]=function(_0x4f835c,_0x1424e9){return respondWithRpcPromise('OpenchannelQueues',_0x4f835c[_0x65ee('0x17')],routingClient)[_0x65ee('0x9')](findById(_0x4f835c[_0x65ee('0x1a')]['id']))['then'](respondWithResult(_0x1424e9,null))['catch'](handleError(_0x1424e9,null));};exports[_0x65ee('0x49')]=function(_0x487804,_0xc3ca72){return respondWithRpcPromise(_0x65ee('0x4a'),_0x487804['query'],routingClient)[_0x65ee('0x9')](respondWithResult(_0xc3ca72,null))[_0x65ee('0xe')](handleError(_0xc3ca72,null));};exports[_0x65ee('0x4b')]=function(_0x1a0c7d,_0xfe502d){return respondWithRpcPromise('SmsQueues',_0x1a0c7d[_0x65ee('0x17')],routingClient)['then'](findById(_0x1a0c7d[_0x65ee('0x1a')]['id']))[_0x65ee('0x9')](respondWithResult(_0xfe502d,null))[_0x65ee('0xe')](handleError(_0xfe502d,null));};exports[_0x65ee('0x4c')]=function(_0x1091ce,_0x5f266d){return respondWithRpcPromise(_0x65ee('0x4d'),_0x1091ce[_0x65ee('0x17')],routingClient)[_0x65ee('0x9')](respondWithResult(_0x5f266d,null))[_0x65ee('0xe')](handleError(_0x5f266d,null));};exports['showWhatsappQueues']=function(_0x1c9b2a,_0x28d796){return respondWithRpcPromise('WhatsappQueues',_0x1c9b2a[_0x65ee('0x17')],routingClient)[_0x65ee('0x9')](findById(_0x1c9b2a[_0x65ee('0x1a')]['id']))[_0x65ee('0x9')](respondWithResult(_0x28d796,null))['catch'](handleError(_0x28d796,null));};exports[_0x65ee('0x4e')]=function(_0x33dbb3,_0x4c3210){return respondWithRpcPromise(_0x65ee('0x4f'),_0x33dbb3[_0x65ee('0x17')],routingClient)[_0x65ee('0x9')](respondWithResult(_0x4c3210,null))[_0x65ee('0xe')](handleError(_0x4c3210,null));};exports[_0x65ee('0x50')]=function(_0x2d5d27,_0x26fa83){return respondWithRpcPromise(_0x65ee('0x4f'),_0x2d5d27[_0x65ee('0x17')],routingClient)[_0x65ee('0x9')](findById(_0x2d5d27[_0x65ee('0x1a')]['id']))['then'](respondWithResult(_0x26fa83,null))[_0x65ee('0xe')](handleError(_0x26fa83,null));};exports[_0x65ee('0x51')]=function(_0x2aca36,_0x36bb09){return respondWithRpcPromise(_0x65ee('0x52'),_0x2aca36[_0x65ee('0x17')])['then'](respondWithResult(_0x36bb09,null))[_0x65ee('0xe')](handleError(_0x36bb09,null));};exports['chatQueuesWaitingInteractions']=function(_0x2b8cc7,_0x1d4448){return respondWithRpcPromise(_0x65ee('0x53'),_0x2b8cc7[_0x65ee('0x17')],routingClient)['then'](respondWithResult(_0x1d4448,null))[_0x65ee('0xe')](handleError(_0x1d4448,null));};exports['mailQueuesWaitingInteractions']=function(_0x221735,_0x1917d6){return respondWithRpcPromise(_0x65ee('0x54'),_0x221735[_0x65ee('0x17')],routingClient)[_0x65ee('0x9')](respondWithResult(_0x1917d6,null))[_0x65ee('0xe')](handleError(_0x1917d6,null));};exports[_0x65ee('0x55')]=function(_0xa5102c,_0x5681c5){return respondWithRpcPromise(_0x65ee('0x56'),_0xa5102c[_0x65ee('0x17')],routingClient)[_0x65ee('0x9')](respondWithResult(_0x5681c5,null))[_0x65ee('0xe')](handleError(_0x5681c5,null));};exports[_0x65ee('0x57')]=function(_0x5d8f2b,_0x47df0e){return respondWithRpcPromise(_0x65ee('0x56'),_0x5d8f2b[_0x65ee('0x17')],routingClient)[_0x65ee('0x9')](function(_0x1bd0d2){if(_0x5d8f2b[_0x65ee('0x17')]['type']!==undefined){var _0x2d3b13=_(_0x1bd0d2[_0x65ee('0x15')])['filter']([_0x5d8f2b[_0x65ee('0x17')][_0x65ee('0x58')],_0x5d8f2b['params']['id']])[_0x65ee('0x59')](_0x65ee('0x5a'))[_0x65ee('0x5b')]()[_0x65ee('0x5c')]();return _0x1bd0d2[_0x65ee('0x15')][_0x65ee('0x5d')](function(_0x49b21b){return _0x2d3b13[_0x65ee('0x5e')](_0x49b21b[_0x65ee('0x5a')])>-0x1;});}else{return _0x1bd0d2[_0x65ee('0x15')]['filter'](function(_0x56d2c9){return _0x56d2c9[_0x65ee('0x5a')]===parseInt(_0x5d8f2b[_0x65ee('0x1a')]['id']);});}})[_0x65ee('0x9')](respondWithResult(_0x47df0e,null))[_0x65ee('0xe')](handleError(_0x47df0e,null));};exports['smsQueuesWaitingInteractions']=function(_0x34c26a,_0xe1613c){return respondWithRpcPromise(_0x65ee('0x5f'),_0x34c26a[_0x65ee('0x17')],routingClient)['then'](respondWithResult(_0xe1613c,null))[_0x65ee('0xe')](handleError(_0xe1613c,null));};exports[_0x65ee('0x60')]=function(_0x44fa04,_0x28c424){return respondWithRpcPromise(_0x65ee('0x61'),_0x44fa04[_0x65ee('0x17')],routingClient)[_0x65ee('0x9')](respondWithResult(_0x28c424,null))[_0x65ee('0xe')](handleError(_0x28c424,null));};exports[_0x65ee('0x62')]=function(_0x1d8499,_0xd1d40b){return respondWithRpcPromise(_0x65ee('0x63'),_0x1d8499[_0x65ee('0x17')],routingClient)['then'](respondWithResult(_0xd1d40b,null))['catch'](handleError(_0xd1d40b,null));};exports[_0x65ee('0x64')]=function(_0xd29757){return function(_0x323879,_0x1dfc94){var _0x3cf8d8,_0x58b33a;var _0x515570=_['capitalize'](_0xd29757);var _0x502269=_0xd29757===_0x65ee('0x65')?_0x65ee('0x66'):_0x65ee('0x67');return db[_0x515570+'Queue'][_0x65ee('0x68')]({'raw':!![],'where':{'id':_0x323879[_0x65ee('0x1a')]['id']}})[_0x65ee('0x9')](function(_0x5312a6){if(_['isNil'](_0x5312a6)){throw new Error(_0x515570+_0x65ee('0x69'));}_0x3cf8d8=_0x5312a6;return db[_0x515570+'Message'][_0x65ee('0x68')]({'where':{'id':_0x323879['body'][_0x65ee('0x6a')]},'include':[{'model':db[_0x515570+_0x65ee('0x6b')],'as':_0x65ee('0x6b')},{'model':db[_0x515570+_0x502269],'as':_0x65ee('0x67')}]});})[_0x65ee('0x9')](function(_0x38e3ee){if(_[_0x65ee('0x14')](_0x38e3ee)){throw new Error(_0x515570+_0x65ee('0x6c'));}_0x58b33a=_0x38e3ee;return _0x38e3ee[_0x65ee('0x6d')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x1d8d7d={'uniqueid':_0xd29757+'.'+_0x58b33a['id']+'.'+_0x58b33a['Interaction']['id'],'FromUserId':_0x323879[_0x65ee('0x2c')]['id'],'type':_0x65ee('0x6e')};_0x1d8d7d[_0x515570+'MessageId']=_0x58b33a['id'];_0x1d8d7d[_0x515570+_0x65ee('0x6f')]=_0x58b33a[_0x65ee('0x6b')]['id'];_0x1d8d7d[_0x65ee('0x70')+_0x515570+_0x502269+'Id']=_0x58b33a['Account']['id'];_0x1d8d7d['To'+_0x515570+_0x65ee('0x71')]=_0x3cf8d8['id'];return db[_0x515570+_0x65ee('0x72')]['create'](_0x1d8d7d);})[_0x65ee('0x9')](function(){return respondWithRpcPromise(_0x65ee('0x73'),{'channel':_0xd29757,'interaction':_0x58b33a[_0x65ee('0x6b')],'message':_0x58b33a,'account':_0x58b33a['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x65ee('0x6e'),'appdata':_0x3cf8d8[_0x65ee('0x11')]+','+(_0x58b33a[_0x65ee('0x67')][_0x65ee('0x74')]||0x12c),'interval':_0x65ee('0x75')}]},routingClient);})[_0x65ee('0x9')](respondWithResult(_0x1dfc94,null))[_0x65ee('0xe')](handleError(_0x1dfc94,null));};};exports[_0x65ee('0x76')]=function(_0x2b52ea,_0x24eec0){var _0x3a3e74,_0x5bebd5;if(_[_0x65ee('0x14')](_0x2b52ea[_0x65ee('0x2a')][_0x65ee('0x77')])){throw new Error(_0x65ee('0x78'));}var _0x1ed5f5=_0x2b52ea['body'][_0x65ee('0x77')];var _0x55dac4=_[_0x65ee('0x79')](_0x1ed5f5);var _0x424426=_0x1ed5f5===_0x65ee('0x65')?'Website':_0x65ee('0x67');return db['User'][_0x65ee('0x68')]({'raw':!![],'where':{'id':_0x2b52ea[_0x65ee('0x1a')]['id'],'role':_0x65ee('0x38')}})['then'](function(_0x58b758){if(_[_0x65ee('0x14')](_0x58b758)){throw new Error(_0x65ee('0x7a'));}_0x3a3e74=_0x58b758;return db[_0x55dac4+'Message'][_0x65ee('0x68')]({'where':{'id':_0x2b52ea[_0x65ee('0x2a')][_0x65ee('0x6a')]},'include':[{'model':db[_0x55dac4+'Interaction'],'as':_0x65ee('0x6b')},{'model':db[_0x55dac4+_0x424426],'as':'Account'}]});})[_0x65ee('0x9')](function(_0x447ba6){if(_['isNil'](_0x447ba6)){throw new Error(_0x55dac4+_0x65ee('0x6c'));}_0x5bebd5=_0x447ba6;return _0x447ba6['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x238962={'uniqueid':_0x1ed5f5+'.'+_0x5bebd5['id']+'.'+_0x5bebd5[_0x65ee('0x6b')]['id'],'FromUserId':_0x2b52ea[_0x65ee('0x2c')]['id'],'type':_0x65ee('0x6e'),'ToUserId':_0x3a3e74['id']};_0x238962[_0x55dac4+_0x65ee('0x7b')]=_0x5bebd5['id'];_0x238962[_0x55dac4+'InteractionId']=_0x5bebd5[_0x65ee('0x6b')]['id'];_0x238962[_0x65ee('0x70')+_0x55dac4+_0x424426+'Id']=_0x5bebd5[_0x65ee('0x67')]['id'];return db[_0x55dac4+_0x65ee('0x72')][_0x65ee('0x7c')](_0x238962);})[_0x65ee('0x9')](function(){return respondWithRpcPromise(_0x65ee('0x73'),{'channel':_0x1ed5f5,'interaction':_0x5bebd5[_0x65ee('0x6b')],'message':_0x5bebd5,'account':_0x5bebd5['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3a3e74[_0x65ee('0x11')]+','+(_0x5bebd5[_0x65ee('0x67')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x65ee('0x9')](respondWithResult(_0x24eec0,null))['catch'](handleError(_0x24eec0,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 3d5dbf0..6ca7b5a 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 _0x4cd6=['index','show','/:id/run','post','create','put','/:id','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4cd6,0xbe));var _0x64cd=function(_0x28c31b,_0x1e21e1){_0x28c31b=_0x28c31b-0x0;var _0x230e48=_0x4cd6[_0x28c31b];return _0x230e48;};'use strict';var multer=require(_0x64cd('0x0'));var util=require(_0x64cd('0x1'));var path=require(_0x64cd('0x2'));var timeout=require('connect-timeout');var express=require(_0x64cd('0x3'));var router=express[_0x64cd('0x4')]();var auth=require(_0x64cd('0x5'));var interaction=require(_0x64cd('0x6'));var config=require('../../config/environment');var controller=require(_0x64cd('0x7'));router[_0x64cd('0x8')]('/',auth[_0x64cd('0x9')](),controller[_0x64cd('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x64cd('0xb')]);router[_0x64cd('0x8')](_0x64cd('0xc'),auth[_0x64cd('0x9')](),controller['run']);router[_0x64cd('0xd')]('/',auth[_0x64cd('0x9')](),controller[_0x64cd('0xe')]);router[_0x64cd('0xf')](_0x64cd('0x10'),auth[_0x64cd('0x9')](),controller['update']);router[_0x64cd('0x11')](_0x64cd('0x10'),auth[_0x64cd('0x9')](),controller[_0x64cd('0x12')]);module[_0x64cd('0x13')]=router; \ No newline at end of file +var _0xafb7=['express','Router','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','show','/:id/run','run','post','create','put','/:id','delete','destroy','multer','util','path'];(function(_0x5dfdac,_0x21a4ea){var _0x4e871e=function(_0x22bb68){while(--_0x22bb68){_0x5dfdac['push'](_0x5dfdac['shift']());}};_0x4e871e(++_0x21a4ea);}(_0xafb7,0xbb));var _0x7afb=function(_0xbacfd6,_0x46dca9){_0xbacfd6=_0xbacfd6-0x0;var _0x5778b4=_0xafb7[_0xbacfd6];return _0x5778b4;};'use strict';var multer=require(_0x7afb('0x0'));var util=require(_0x7afb('0x1'));var path=require(_0x7afb('0x2'));var timeout=require('connect-timeout');var express=require(_0x7afb('0x3'));var router=express[_0x7afb('0x4')]();var auth=require(_0x7afb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7afb('0x6'));var controller=require(_0x7afb('0x7'));router[_0x7afb('0x8')]('/',auth[_0x7afb('0x9')](),controller['index']);router[_0x7afb('0x8')]('/:id',auth[_0x7afb('0x9')](),controller[_0x7afb('0xa')]);router[_0x7afb('0x8')](_0x7afb('0xb'),auth['isAuthenticated'](),controller[_0x7afb('0xc')]);router[_0x7afb('0xd')]('/',auth[_0x7afb('0x9')](),controller[_0x7afb('0xe')]);router[_0x7afb('0xf')](_0x7afb('0x10'),auth[_0x7afb('0x9')](),controller['update']);router[_0x7afb('0x11')](_0x7afb('0x10'),auth[_0x7afb('0x9')](),controller[_0x7afb('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 7c01212..f2019f6 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 _0xba18=['0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','hours','minutes','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN'];(function(_0x5c43e1,_0x4c1705){var _0x397fa7=function(_0x4485e8){while(--_0x4485e8){_0x5c43e1['push'](_0x5c43e1['shift']());}};_0x397fa7(++_0x4c1705);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8ba1('0x0'));module[_0x8ba1('0x1')]={'name':{'type':Sequelize[_0x8ba1('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8ba1('0x2')]},'active':{'type':Sequelize[_0x8ba1('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x8ba1('0x2')],'allowNull':![],'defaultValue':_0x8ba1('0x4')},'startAt':{'type':Sequelize[_0x8ba1('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x8ba1('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x8ba1('0x7')](_0x8ba1('0x8'),_0x8ba1('0x9'),_0x8ba1('0xa'),_0x8ba1('0xb'),'days',_0x8ba1('0xc'),_0x8ba1('0xd')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM']('csv',_0x8ba1('0xe'),_0x8ba1('0xf')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x8ba1('0x7')](_0x8ba1('0x10'),_0x8ba1('0x11')),'allowNull':![],'defaultValue':_0x8ba1('0x10')},'sendMail':{'type':Sequelize[_0x8ba1('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x8ba1('0x12')]},'bcc':{'type':Sequelize[_0x8ba1('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x8ba1('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xfd6e=['ENUM','csv','pdf','custom','default','TEXT','sequelize','STRING','BOOLEAN','INTEGER','quarters','months','weeks','days','hours'];(function(_0x35f6e9,_0x214bde){var _0x7f631e=function(_0xa0acb8){while(--_0xa0acb8){_0x35f6e9['push'](_0x35f6e9['shift']());}};_0x7f631e(++_0x214bde);}(_0xfd6e,0x16e));var _0xefd6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd6e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xefd6('0x0'));module['exports']={'name':{'type':Sequelize[_0xefd6('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xefd6('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xefd6('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xefd6('0x3')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0xefd6('0x4'),_0xefd6('0x5'),_0xefd6('0x6'),_0xefd6('0x7'),_0xefd6('0x8'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xefd6('0x9')](_0xefd6('0xa'),_0xefd6('0xb'),'xlsx'),'allowNull':![],'defaultValue':_0xefd6('0xa')},'type':{'type':Sequelize[_0xefd6('0x9')](_0xefd6('0xc'),_0xefd6('0xd')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xefd6('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xefd6('0x1')]},'cc':{'type':Sequelize[_0xefd6('0xe')]},'bcc':{'type':Sequelize[_0xefd6('0xe')]},'sendIfEmpty':{'type':Sequelize[_0xefd6('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 7dee26c..d79407e 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 _0xa047=['model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','length','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','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/license/util','../../mysqldb','sendStatus','status','offset','limit','Content-Range','apply','save','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','index','map','Schedule','type','query','keys','filters','intersection','attributes','fields'];(function(_0x535bb4,_0x4ef0c7){var _0x275848=function(_0x2f46e6){while(--_0x2f46e6){_0x535bb4['push'](_0x535bb4['shift']());}};_0x275848(++_0x4ef0c7);}(_0xa047,0xb6));var _0x7a04=function(_0x10dfdf,_0x36b623){_0x10dfdf=_0x10dfdf-0x0;var _0x4d857d=_0xa047[_0x10dfdf];return _0x4d857d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7a04('0x0'));var rimraf=require(_0x7a04('0x1'));var zipdir=require(_0x7a04('0x2'));var jsonpatch=require(_0x7a04('0x3'));var rp=require(_0x7a04('0x4'));var moment=require(_0x7a04('0x5'));var BPromise=require(_0x7a04('0x6'));var Mustache=require(_0x7a04('0x7'));var util=require(_0x7a04('0x8'));var path=require(_0x7a04('0x9'));var sox=require('sox');var csv=require(_0x7a04('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7a04('0xb'));var crypto=require('crypto');var jsforce=require(_0x7a04('0xc'));var deskjs=require(_0x7a04('0xd'));var toCsv=require(_0x7a04('0xa'));var querystring=require(_0x7a04('0xe'));var Papa=require(_0x7a04('0xf'));var Redis=require(_0x7a04('0x10'));var authService=require(_0x7a04('0x11'));var qs=require(_0x7a04('0x12'));var as=require(_0x7a04('0x13'));var hardwareService=require(_0x7a04('0x14'));var logger=require(_0x7a04('0x15'))(_0x7a04('0x16'));var utils=require(_0x7a04('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7a04('0x18'));var db=require(_0x7a04('0x19'))['db'];function respondWithStatusCode(_0x146693,_0xe34555){_0xe34555=_0xe34555||0xcc;return function(_0x4b5100){if(_0x4b5100){return _0x146693[_0x7a04('0x1a')](_0xe34555);}return _0x146693[_0x7a04('0x1b')](_0xe34555)['end']();};}function respondWithResult(_0x282507,_0x2bbaff){_0x2bbaff=_0x2bbaff||0xc8;return function(_0x3f51b4){if(_0x3f51b4){return _0x282507[_0x7a04('0x1b')](_0x2bbaff)['json'](_0x3f51b4);}};}function respondWithFilteredResult(_0x3fcd06,_0x54ec0d){return function(_0x5c768f){if(_0x5c768f){var _0x2d7f00=_0x5c768f['count'],_0x1d85e0=_0x54ec0d[_0x7a04('0x1c')],_0x5b249f=_0x54ec0d[_0x7a04('0x1c')]+_0x54ec0d[_0x7a04('0x1d')],_0x537470;if(_0x5b249f>=_0x2d7f00){_0x5b249f=_0x2d7f00;_0x537470=0xc8;}else{_0x537470=0xce;}_0x3fcd06[_0x7a04('0x1b')](_0x537470);return _0x3fcd06['set'](_0x7a04('0x1e'),_0x1d85e0+'-'+_0x5b249f+'/'+_0x2d7f00)['json'](_0x5c768f);}return null;};}function patchUpdates(_0x396151){return function(_0x2de1bd){try{jsonpatch[_0x7a04('0x1f')](_0x2de1bd,_0x396151,!![]);}catch(_0x27b730){return BPromise['reject'](_0x27b730);}return _0x2de1bd[_0x7a04('0x20')]();};}function saveUpdates(_0x23ede0,_0x412202){return function(_0x3d23f7){if(_0x3d23f7){return _0x3d23f7[_0x7a04('0x21')](_0x23ede0)[_0x7a04('0x22')](function(_0x247151){return _0x247151;});}return null;};}function removeEntity(_0x1aef65,_0x57d701){return function(_0x48ff5a){if(_0x48ff5a){return _0x48ff5a[_0x7a04('0x23')]()[_0x7a04('0x22')](function(){var _0x17f106=_0x48ff5a[_0x7a04('0x24')]({'plain':!![]});var _0x1b319b=_0x7a04('0x25');return db[_0x7a04('0x26')][_0x7a04('0x23')]({'where':{'type':_0x1b319b,'resourceId':_0x17f106['id']}})['then'](function(){return _0x48ff5a;});})[_0x7a04('0x22')](function(){_0x1aef65[_0x7a04('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe31f3,_0x40c849){return function(_0x7186d0){if(!_0x7186d0){_0xe31f3[_0x7a04('0x1a')](0x194);}return _0x7186d0;};}function handleError(_0x24bbb8,_0x550a74){_0x550a74=_0x550a74||0x1f4;return function(_0x28433b){logger[_0x7a04('0x27')](_0x28433b[_0x7a04('0x28')]);if(_0x28433b[_0x7a04('0x29')]){delete _0x28433b[_0x7a04('0x29')];}_0x24bbb8[_0x7a04('0x1b')](_0x550a74)['send'](_0x28433b);};}exports[_0x7a04('0x2a')]=function(_0x436b4f,_0x58f721){var _0x395226={},_0x23cdb7={},_0x3ff899={'count':0x0,'rows':[]};var _0x362013=_[_0x7a04('0x2b')](db[_0x7a04('0x2c')]['rawAttributes'],function(_0x19385a){return{'name':_0x19385a['fieldName'],'type':_0x19385a[_0x7a04('0x2d')]['key']};});_0x23cdb7['model']=_[_0x7a04('0x2b')](_0x362013,'name');_0x23cdb7[_0x7a04('0x2e')]=_[_0x7a04('0x2f')](_0x436b4f[_0x7a04('0x2e')]);_0x23cdb7[_0x7a04('0x30')]=_[_0x7a04('0x31')](_0x23cdb7['model'],_0x23cdb7[_0x7a04('0x2e')]);_0x395226[_0x7a04('0x32')]=_[_0x7a04('0x31')](_0x23cdb7['model'],qs[_0x7a04('0x33')](_0x436b4f[_0x7a04('0x2e')][_0x7a04('0x33')]));_0x395226[_0x7a04('0x32')]=_0x395226[_0x7a04('0x32')]['length']?_0x395226['attributes']:_0x23cdb7[_0x7a04('0x34')];if(!_0x436b4f[_0x7a04('0x2e')][_0x7a04('0x35')](_0x7a04('0x36'))){_0x395226['limit']=qs[_0x7a04('0x1d')](_0x436b4f[_0x7a04('0x2e')][_0x7a04('0x1d')]);_0x395226[_0x7a04('0x1c')]=qs[_0x7a04('0x1c')](_0x436b4f[_0x7a04('0x2e')][_0x7a04('0x1c')]);}_0x395226['order']=qs['sort'](_0x436b4f['query'][_0x7a04('0x37')]);_0x395226[_0x7a04('0x38')]=qs[_0x7a04('0x30')](_[_0x7a04('0x39')](_0x436b4f[_0x7a04('0x2e')],_0x23cdb7[_0x7a04('0x30')]),_0x362013);if(_0x436b4f['query'][_0x7a04('0x3a')]){_0x395226[_0x7a04('0x38')]=_[_0x7a04('0x3b')](_0x395226['where'],{'$or':_['map'](_0x362013,function(_0x84610d){if(_0x84610d[_0x7a04('0x2d')]!==_0x7a04('0x3c')){var _0x3cb8e5={};_0x3cb8e5[_0x84610d[_0x7a04('0x29')]]={'$like':'%'+_0x436b4f['query']['filter']+'%'};return _0x3cb8e5;}})});}_0x395226=_['merge']({},_0x395226,_0x436b4f[_0x7a04('0x3d')]);var _0x47b8d4={'where':_0x395226[_0x7a04('0x38')]};return db[_0x7a04('0x2c')]['count'](_0x47b8d4)[_0x7a04('0x22')](function(_0x1b69ee){_0x3ff899['count']=_0x1b69ee;if(_0x436b4f[_0x7a04('0x2e')][_0x7a04('0x3e')]){_0x395226[_0x7a04('0x3f')]=[{'all':!![]}];}return db['Schedule'][_0x7a04('0x40')](_0x395226);})[_0x7a04('0x22')](function(_0x3ce418){_0x3ff899['rows']=_0x3ce418;return _0x3ff899;})[_0x7a04('0x22')](respondWithFilteredResult(_0x58f721,_0x395226))['catch'](handleError(_0x58f721,null));};exports['show']=function(_0x1e8b0b,_0x134bc1){var _0x4449ec={'raw':![],'where':{'id':_0x1e8b0b['params']['id']}},_0x49321a={};_0x49321a[_0x7a04('0x34')]=_[_0x7a04('0x2f')](db['Schedule']['rawAttributes']);_0x49321a['query']=_[_0x7a04('0x2f')](_0x1e8b0b[_0x7a04('0x2e')]);_0x49321a['filters']=_[_0x7a04('0x31')](_0x49321a['model'],_0x49321a[_0x7a04('0x2e')]);_0x4449ec[_0x7a04('0x32')]=_[_0x7a04('0x31')](_0x49321a[_0x7a04('0x34')],qs[_0x7a04('0x33')](_0x1e8b0b['query'][_0x7a04('0x33')]));_0x4449ec['attributes']=_0x4449ec[_0x7a04('0x32')][_0x7a04('0x41')]?_0x4449ec[_0x7a04('0x32')]:_0x49321a[_0x7a04('0x34')];if(_0x1e8b0b[_0x7a04('0x2e')]['includeAll']){_0x4449ec[_0x7a04('0x3f')]=[{'all':!![]}];}_0x4449ec=_[_0x7a04('0x3b')]({},_0x4449ec,_0x1e8b0b[_0x7a04('0x3d')]);return db['Schedule']['find'](_0x4449ec)[_0x7a04('0x22')](handleEntityNotFound(_0x134bc1,null))[_0x7a04('0x22')](respondWithResult(_0x134bc1,null))[_0x7a04('0x42')](handleError(_0x134bc1,null));};exports['create']=function(_0x2aa08e,_0x41af5b){return db[_0x7a04('0x2c')][_0x7a04('0x43')](_0x2aa08e[_0x7a04('0x44')],{})[_0x7a04('0x22')](function(_0x49743a){var _0x4d18cc=_0x2aa08e['user'][_0x7a04('0x24')]({'plain':!![]});if(!_0x4d18cc)throw new Error(_0x7a04('0x45'));if(_0x4d18cc['role']===_0x7a04('0x46')){var _0x102248=_0x49743a[_0x7a04('0x24')]({'plain':!![]});var _0x5de468=_0x7a04('0x25');return db[_0x7a04('0x47')][_0x7a04('0x48')]({'where':{'name':_0x5de468,'userProfileId':_0x4d18cc['userProfileId']},'raw':!![]})[_0x7a04('0x22')](function(_0x4d4d21){if(_0x4d4d21&&_0x4d4d21[_0x7a04('0x49')]===0x0){return db[_0x7a04('0x26')][_0x7a04('0x43')]({'name':_0x102248[_0x7a04('0x29')],'resourceId':_0x102248['id'],'type':_0x4d4d21[_0x7a04('0x29')],'sectionId':_0x4d4d21['id']},{})['then'](function(){return _0x49743a;});}else{return _0x49743a;}})[_0x7a04('0x42')](function(_0x1311c6){logger[_0x7a04('0x27')](_0x7a04('0x4a'),_0x1311c6);throw _0x1311c6;});}return _0x49743a;})[_0x7a04('0x22')](respondWithResult(_0x41af5b,0xc9))[_0x7a04('0x42')](handleError(_0x41af5b,null));};exports[_0x7a04('0x21')]=function(_0x482080,_0x13118c){if(_0x482080[_0x7a04('0x44')]['id']){delete _0x482080['body']['id'];}return db[_0x7a04('0x2c')][_0x7a04('0x48')]({'where':{'id':_0x482080[_0x7a04('0x4b')]['id']}})[_0x7a04('0x22')](handleEntityNotFound(_0x13118c,null))[_0x7a04('0x22')](saveUpdates(_0x482080[_0x7a04('0x44')],null))[_0x7a04('0x22')](respondWithResult(_0x13118c,null))['catch'](handleError(_0x13118c,null));};exports['destroy']=function(_0x456605,_0x74fe8a){return db[_0x7a04('0x2c')]['find']({'where':{'id':_0x456605[_0x7a04('0x4b')]['id']}})[_0x7a04('0x22')](handleEntityNotFound(_0x74fe8a,null))[_0x7a04('0x22')](removeEntity(_0x74fe8a,null))[_0x7a04('0x42')](handleError(_0x74fe8a,null));};exports[_0x7a04('0x4c')]=function(_0x34769d,_0x8facbe,_0x2ff4f8){var _0x29242e=require(_0x7a04('0x4d'));return db[_0x7a04('0x2c')]['find']({'where':{'id':_0x34769d['params']['id']},'raw':!![]})[_0x7a04('0x22')](handleEntityNotFound(_0x8facbe,null))['then'](function(){_0x29242e[_0x7a04('0x4c')](_0x34769d[_0x7a04('0x4b')]['id']);})[_0x7a04('0x22')](respondWithStatusCode(_0x8facbe,null))['catch'](handleError(_0x8facbe,null));}; \ No newline at end of file +var _0xad31=['filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','get','Scheduler','UserProfileResource','error','name','send','index','Schedule','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0xad31,0x16c));var _0x1ad3=function(_0x544e09,_0x28d01a){_0x544e09=_0x544e09-0x0;var _0x1bc8a7=_0xad31[_0x544e09];return _0x1bc8a7;};'use strict';var pdf=require(_0x1ad3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1ad3('0x1'));var zipdir=require(_0x1ad3('0x2'));var jsonpatch=require(_0x1ad3('0x3'));var rp=require('request-promise');var moment=require(_0x1ad3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1ad3('0x5'));var util=require(_0x1ad3('0x6'));var path=require('path');var sox=require(_0x1ad3('0x7'));var csv=require(_0x1ad3('0x8'));var ejs=require(_0x1ad3('0x9'));var fs=require('fs');var _=require(_0x1ad3('0xa'));var squel=require(_0x1ad3('0xb'));var crypto=require(_0x1ad3('0xc'));var jsforce=require(_0x1ad3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1ad3('0x8'));var querystring=require(_0x1ad3('0xe'));var Papa=require(_0x1ad3('0xf'));var Redis=require(_0x1ad3('0x10'));var authService=require(_0x1ad3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1ad3('0x12'));var hardwareService=require(_0x1ad3('0x13'));var logger=require(_0x1ad3('0x14'))('api');var utils=require(_0x1ad3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1ad3('0x16'));var db=require(_0x1ad3('0x17'))['db'];function respondWithStatusCode(_0x246a84,_0x511db0){_0x511db0=_0x511db0||0xcc;return function(_0x2a66cf){if(_0x2a66cf){return _0x246a84[_0x1ad3('0x18')](_0x511db0);}return _0x246a84[_0x1ad3('0x19')](_0x511db0)[_0x1ad3('0x1a')]();};}function respondWithResult(_0x30c382,_0x53b64f){_0x53b64f=_0x53b64f||0xc8;return function(_0x62420f){if(_0x62420f){return _0x30c382[_0x1ad3('0x19')](_0x53b64f)[_0x1ad3('0x1b')](_0x62420f);}};}function respondWithFilteredResult(_0x206f4b,_0x536ffb){return function(_0x558eef){if(_0x558eef){var _0x56d94c=_0x558eef[_0x1ad3('0x1c')],_0x11229a=_0x536ffb[_0x1ad3('0x1d')],_0xc02a25=_0x536ffb[_0x1ad3('0x1d')]+_0x536ffb[_0x1ad3('0x1e')],_0x442f4f;if(_0xc02a25>=_0x56d94c){_0xc02a25=_0x56d94c;_0x442f4f=0xc8;}else{_0x442f4f=0xce;}_0x206f4b[_0x1ad3('0x19')](_0x442f4f);return _0x206f4b[_0x1ad3('0x1f')](_0x1ad3('0x20'),_0x11229a+'-'+_0xc02a25+'/'+_0x56d94c)[_0x1ad3('0x1b')](_0x558eef);}return null;};}function patchUpdates(_0x435ceb){return function(_0x4c72a4){try{jsonpatch[_0x1ad3('0x21')](_0x4c72a4,_0x435ceb,!![]);}catch(_0x2f10bd){return BPromise[_0x1ad3('0x22')](_0x2f10bd);}return _0x4c72a4['save']();};}function saveUpdates(_0x549afe,_0x2f1143){return function(_0x4c6623){if(_0x4c6623){return _0x4c6623['update'](_0x549afe)[_0x1ad3('0x23')](function(_0x49708e){return _0x49708e;});}return null;};}function removeEntity(_0x920580,_0x4e5582){return function(_0x2407d3){if(_0x2407d3){return _0x2407d3[_0x1ad3('0x24')]()[_0x1ad3('0x23')](function(){var _0x561e7f=_0x2407d3[_0x1ad3('0x25')]({'plain':!![]});var _0x3fcb52=_0x1ad3('0x26');return db[_0x1ad3('0x27')][_0x1ad3('0x24')]({'where':{'type':_0x3fcb52,'resourceId':_0x561e7f['id']}})[_0x1ad3('0x23')](function(){return _0x2407d3;});})[_0x1ad3('0x23')](function(){_0x920580['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xbaa095,_0x51f761){return function(_0x94ce2e){if(!_0x94ce2e){_0xbaa095[_0x1ad3('0x18')](0x194);}return _0x94ce2e;};}function handleError(_0x2ba08b,_0x5d6dec){_0x5d6dec=_0x5d6dec||0x1f4;return function(_0x24bbd9){logger[_0x1ad3('0x28')](_0x24bbd9['stack']);if(_0x24bbd9['name']){delete _0x24bbd9[_0x1ad3('0x29')];}_0x2ba08b['status'](_0x5d6dec)[_0x1ad3('0x2a')](_0x24bbd9);};}exports[_0x1ad3('0x2b')]=function(_0x4eff72,_0x228e67){var _0x31a8c9={},_0x41069f={},_0x422170={'count':0x0,'rows':[]};var _0x16800e=_['map'](db[_0x1ad3('0x2c')][_0x1ad3('0x2d')],function(_0x5e08ce){return{'name':_0x5e08ce[_0x1ad3('0x2e')],'type':_0x5e08ce[_0x1ad3('0x2f')][_0x1ad3('0x30')]};});_0x41069f[_0x1ad3('0x31')]=_[_0x1ad3('0x32')](_0x16800e,_0x1ad3('0x29'));_0x41069f['query']=_[_0x1ad3('0x33')](_0x4eff72[_0x1ad3('0x34')]);_0x41069f['filters']=_[_0x1ad3('0x35')](_0x41069f[_0x1ad3('0x31')],_0x41069f['query']);_0x31a8c9['attributes']=_[_0x1ad3('0x35')](_0x41069f[_0x1ad3('0x31')],qs[_0x1ad3('0x36')](_0x4eff72['query'][_0x1ad3('0x36')]));_0x31a8c9[_0x1ad3('0x37')]=_0x31a8c9[_0x1ad3('0x37')]['length']?_0x31a8c9[_0x1ad3('0x37')]:_0x41069f['model'];if(!_0x4eff72[_0x1ad3('0x34')][_0x1ad3('0x38')](_0x1ad3('0x39'))){_0x31a8c9['limit']=qs[_0x1ad3('0x1e')](_0x4eff72['query'][_0x1ad3('0x1e')]);_0x31a8c9[_0x1ad3('0x1d')]=qs[_0x1ad3('0x1d')](_0x4eff72['query']['offset']);}_0x31a8c9[_0x1ad3('0x3a')]=qs[_0x1ad3('0x3b')](_0x4eff72[_0x1ad3('0x34')]['sort']);_0x31a8c9[_0x1ad3('0x3c')]=qs[_0x1ad3('0x3d')](_[_0x1ad3('0x3e')](_0x4eff72[_0x1ad3('0x34')],_0x41069f[_0x1ad3('0x3d')]),_0x16800e);if(_0x4eff72[_0x1ad3('0x34')][_0x1ad3('0x3f')]){_0x31a8c9[_0x1ad3('0x3c')]=_[_0x1ad3('0x40')](_0x31a8c9[_0x1ad3('0x3c')],{'$or':_['map'](_0x16800e,function(_0x2dc17d){if(_0x2dc17d['type']!==_0x1ad3('0x41')){var _0x359ab1={};_0x359ab1[_0x2dc17d[_0x1ad3('0x29')]]={'$like':'%'+_0x4eff72['query'][_0x1ad3('0x3f')]+'%'};return _0x359ab1;}})});}_0x31a8c9=_[_0x1ad3('0x40')]({},_0x31a8c9,_0x4eff72['options']);var _0x58c96f={'where':_0x31a8c9[_0x1ad3('0x3c')]};return db['Schedule']['count'](_0x58c96f)[_0x1ad3('0x23')](function(_0xb483e3){_0x422170[_0x1ad3('0x1c')]=_0xb483e3;if(_0x4eff72['query'][_0x1ad3('0x42')]){_0x31a8c9[_0x1ad3('0x43')]=[{'all':!![]}];}return db[_0x1ad3('0x2c')][_0x1ad3('0x44')](_0x31a8c9);})[_0x1ad3('0x23')](function(_0x540972){_0x422170[_0x1ad3('0x45')]=_0x540972;return _0x422170;})[_0x1ad3('0x23')](respondWithFilteredResult(_0x228e67,_0x31a8c9))[_0x1ad3('0x46')](handleError(_0x228e67,null));};exports[_0x1ad3('0x47')]=function(_0x54c650,_0x4c625e){var _0x2b7ca2={'raw':![],'where':{'id':_0x54c650[_0x1ad3('0x48')]['id']}},_0x2af630={};_0x2af630[_0x1ad3('0x31')]=_[_0x1ad3('0x33')](db[_0x1ad3('0x2c')]['rawAttributes']);_0x2af630[_0x1ad3('0x34')]=_[_0x1ad3('0x33')](_0x54c650[_0x1ad3('0x34')]);_0x2af630['filters']=_['intersection'](_0x2af630[_0x1ad3('0x31')],_0x2af630['query']);_0x2b7ca2[_0x1ad3('0x37')]=_['intersection'](_0x2af630[_0x1ad3('0x31')],qs['fields'](_0x54c650[_0x1ad3('0x34')][_0x1ad3('0x36')]));_0x2b7ca2['attributes']=_0x2b7ca2[_0x1ad3('0x37')][_0x1ad3('0x49')]?_0x2b7ca2[_0x1ad3('0x37')]:_0x2af630[_0x1ad3('0x31')];if(_0x54c650['query']['includeAll']){_0x2b7ca2['include']=[{'all':!![]}];}_0x2b7ca2=_[_0x1ad3('0x40')]({},_0x2b7ca2,_0x54c650[_0x1ad3('0x4a')]);return db['Schedule'][_0x1ad3('0x4b')](_0x2b7ca2)[_0x1ad3('0x23')](handleEntityNotFound(_0x4c625e,null))[_0x1ad3('0x23')](respondWithResult(_0x4c625e,null))[_0x1ad3('0x46')](handleError(_0x4c625e,null));};exports[_0x1ad3('0x4c')]=function(_0x596a9b,_0x57efcf){return db['Schedule'][_0x1ad3('0x4c')](_0x596a9b[_0x1ad3('0x4d')],{})['then'](function(_0x59e4db){var _0x1f3907=_0x596a9b[_0x1ad3('0x4e')][_0x1ad3('0x25')]({'plain':!![]});if(!_0x1f3907)throw new Error(_0x1ad3('0x4f'));if(_0x1f3907[_0x1ad3('0x50')]===_0x1ad3('0x4e')){var _0x32ddaa=_0x59e4db[_0x1ad3('0x25')]({'plain':!![]});var _0x2e2c6c=_0x1ad3('0x26');return db[_0x1ad3('0x51')]['find']({'where':{'name':_0x2e2c6c,'userProfileId':_0x1f3907['userProfileId']},'raw':!![]})[_0x1ad3('0x23')](function(_0x1442e9){if(_0x1442e9&&_0x1442e9['autoAssociation']===0x0){return db[_0x1ad3('0x27')][_0x1ad3('0x4c')]({'name':_0x32ddaa[_0x1ad3('0x29')],'resourceId':_0x32ddaa['id'],'type':_0x1442e9['name'],'sectionId':_0x1442e9['id']},{})[_0x1ad3('0x23')](function(){return _0x59e4db;});}else{return _0x59e4db;}})['catch'](function(_0x17c1ba){logger[_0x1ad3('0x28')](_0x1ad3('0x52'),_0x17c1ba);throw _0x17c1ba;});}return _0x59e4db;})['then'](respondWithResult(_0x57efcf,0xc9))[_0x1ad3('0x46')](handleError(_0x57efcf,null));};exports['update']=function(_0x84dd3b,_0x1d1529){if(_0x84dd3b[_0x1ad3('0x4d')]['id']){delete _0x84dd3b[_0x1ad3('0x4d')]['id'];}return db[_0x1ad3('0x2c')][_0x1ad3('0x4b')]({'where':{'id':_0x84dd3b['params']['id']}})['then'](handleEntityNotFound(_0x1d1529,null))[_0x1ad3('0x23')](saveUpdates(_0x84dd3b[_0x1ad3('0x4d')],null))[_0x1ad3('0x23')](respondWithResult(_0x1d1529,null))[_0x1ad3('0x46')](handleError(_0x1d1529,null));};exports[_0x1ad3('0x24')]=function(_0x6750ff,_0x3c6176){return db['Schedule'][_0x1ad3('0x4b')]({'where':{'id':_0x6750ff[_0x1ad3('0x48')]['id']}})[_0x1ad3('0x23')](handleEntityNotFound(_0x3c6176,null))['then'](removeEntity(_0x3c6176,null))[_0x1ad3('0x46')](handleError(_0x3c6176,null));};exports['run']=function(_0x1df379,_0x35138b,_0x886c98){var _0xa86902=require(_0x1ad3('0x53'));return db['Schedule'][_0x1ad3('0x4b')]({'where':{'id':_0x1df379[_0x1ad3('0x48')]['id']},'raw':!![]})[_0x1ad3('0x23')](handleEntityNotFound(_0x35138b,null))[_0x1ad3('0x23')](function(){_0xa86902[_0x1ad3('0x54')](_0x1df379[_0x1ad3('0x48')]['id']);})[_0x1ad3('0x23')](respondWithStatusCode(_0x35138b,null))[_0x1ad3('0x46')](handleError(_0x35138b,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 6e31cef..340020a 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 _0xe686=['tools_schedules','moment','bluebird','request-promise','path','rimraf','./schedule.attributes','exports','define','Schedule'];(function(_0x3f4c67,_0x1a5f87){var _0x5c3777=function(_0x5b9906){while(--_0x5b9906){_0x3f4c67['push'](_0x3f4c67['shift']());}};_0x5c3777(++_0x1a5f87);}(_0xe686,0xbf));var _0x6e68=function(_0x7627e2,_0xbf2007){_0x7627e2=_0x7627e2-0x0;var _0x1442ac=_0xe686[_0x7627e2];return _0x1442ac;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x6e68('0x0'));var BPromise=require(_0x6e68('0x1'));var rp=require(_0x6e68('0x2'));var fs=require('fs');var path=require(_0x6e68('0x3'));var rimraf=require(_0x6e68('0x4'));var config=require('../../config/environment');var attributes=require(_0x6e68('0x5'));module[_0x6e68('0x6')]=function(_0x146368,_0x27809d){return _0x146368[_0x6e68('0x7')](_0x6e68('0x8'),attributes,{'tableName':_0x6e68('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb839=['api','moment','bluebird','request-promise','path','define','tools_schedules','../../config/logger'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xb839,0xb7));var _0x9b83=function(_0x398d9b,_0x414dc0){_0x398d9b=_0x398d9b-0x0;var _0x4348ea=_0xb839[_0x398d9b];return _0x4348ea;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9b83('0x0'))(_0x9b83('0x1'));var moment=require(_0x9b83('0x2'));var BPromise=require(_0x9b83('0x3'));var rp=require(_0x9b83('0x4'));var fs=require('fs');var path=require(_0x9b83('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./schedule.attributes');module['exports']=function(_0xbf9ced,_0x3ab089){return _0xbf9ced[_0x9b83('0x6')]('Schedule',attributes,{'tableName':_0x9b83('0x7'),'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 4fde2b3..e0bdd1a 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 _0xfc57=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0xdb357c,_0x3786b6){var _0x5c8735=function(_0x2e179c){while(--_0x2e179c){_0xdb357c['push'](_0xdb357c['shift']());}};_0x5c8735(++_0x3786b6);}(_0xfc57,0x108));var _0x7fc5=function(_0x5e9d70,_0x37d7a1){_0x5e9d70=_0x5e9d70-0x0;var _0x415475=_0xfc57[_0x5e9d70];return _0x415475;};'use strict';var _=require(_0x7fc5('0x0'));var util=require(_0x7fc5('0x1'));var moment=require('moment');var BPromise=require(_0x7fc5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7fc5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7fc5('0x4'));var logger=require(_0x7fc5('0x5'))(_0x7fc5('0x6'));var config=require(_0x7fc5('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7fc5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2123c5,_0x5bc564,_0x5545c6){return new BPromise(function(_0x533099,_0x45c14f){return client['request'](_0x2123c5,_0x5545c6)['then'](function(_0x54ed9b){logger['info'](_0x7fc5('0x9'),_0x5bc564,_0x7fc5('0xa'));logger[_0x7fc5('0xb')](_0x7fc5('0xc'),_0x5bc564,_0x7fc5('0xa'),JSON[_0x7fc5('0xd')](_0x54ed9b));if(_0x54ed9b['error']){if(_0x54ed9b[_0x7fc5('0xe')][_0x7fc5('0xf')]===0x1f4){logger[_0x7fc5('0xe')](_0x7fc5('0x9'),_0x5bc564,_0x54ed9b['error'][_0x7fc5('0x10')]);return _0x45c14f(_0x54ed9b['error'][_0x7fc5('0x10')]);}logger[_0x7fc5('0xe')]('Schedule,\x20%s,\x20%s',_0x5bc564,_0x54ed9b[_0x7fc5('0xe')][_0x7fc5('0x10')]);return _0x533099(_0x54ed9b[_0x7fc5('0xe')][_0x7fc5('0x10')]);}else{logger['info'](_0x7fc5('0x9'),_0x5bc564,_0x7fc5('0xa'));_0x533099(_0x54ed9b[_0x7fc5('0x11')][_0x7fc5('0x10')]);}})[_0x7fc5('0x12')](function(_0x5e81f8){logger[_0x7fc5('0xe')](_0x7fc5('0x9'),_0x5bc564,_0x5e81f8);_0x45c14f(_0x5e81f8);});});} \ No newline at end of file +var _0x1ea0=['request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0xe6beba,_0x3f15d1){var _0x2f1c08=function(_0x2e7d9f){while(--_0x2e7d9f){_0xe6beba['push'](_0xe6beba['shift']());}};_0x2f1c08(++_0x3f15d1);}(_0x1ea0,0x1aa));var _0x01ea=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1ea0[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x01ea('0x0'));var util=require(_0x01ea('0x1'));var moment=require(_0x01ea('0x2'));var BPromise=require(_0x01ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x01ea('0x4'));var db=require(_0x01ea('0x5'))['db'];var utils=require(_0x01ea('0x6'));var logger=require(_0x01ea('0x7'))(_0x01ea('0x8'));var config=require('../../config/environment');var jayson=require(_0x01ea('0x9'));var client=jayson['client'][_0x01ea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30c630,_0xbccd5e,_0x960c02){return new BPromise(function(_0x454692,_0x412cad){return client[_0x01ea('0xb')](_0x30c630,_0x960c02)[_0x01ea('0xc')](function(_0x3a2c45){logger[_0x01ea('0xd')](_0x01ea('0xe'),_0xbccd5e,_0x01ea('0xf'));logger[_0x01ea('0x10')](_0x01ea('0x11'),_0xbccd5e,_0x01ea('0xf'),JSON[_0x01ea('0x12')](_0x3a2c45));if(_0x3a2c45[_0x01ea('0x13')]){if(_0x3a2c45['error'][_0x01ea('0x14')]===0x1f4){logger[_0x01ea('0x13')]('Schedule,\x20%s,\x20%s',_0xbccd5e,_0x3a2c45[_0x01ea('0x13')][_0x01ea('0x15')]);return _0x412cad(_0x3a2c45[_0x01ea('0x13')][_0x01ea('0x15')]);}logger[_0x01ea('0x13')](_0x01ea('0xe'),_0xbccd5e,_0x3a2c45['error'][_0x01ea('0x15')]);return _0x454692(_0x3a2c45[_0x01ea('0x13')]['message']);}else{logger[_0x01ea('0xd')]('Schedule,\x20%s,\x20%s',_0xbccd5e,_0x01ea('0xf'));_0x454692(_0x3a2c45['result'][_0x01ea('0x15')]);}})[_0x01ea('0x16')](function(_0x26b132){logger[_0x01ea('0x13')](_0x01ea('0xe'),_0xbccd5e,_0x26b132);_0x412cad(_0x26b132);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 73489cb..71ffdc5 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 _0x81d6=['Router','../../components/auth/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','download','create','put','delete','exports','util','path','express'];(function(_0x466bfd,_0x56f4bb){var _0x29293d=function(_0x47298b){while(--_0x47298b){_0x466bfd['push'](_0x466bfd['shift']());}};_0x29293d(++_0x56f4bb);}(_0x81d6,0x95));var _0x681d=function(_0x414b2d,_0x5785d9){_0x414b2d=_0x414b2d-0x0;var _0xb6333f=_0x81d6[_0x414b2d];return _0xb6333f;};'use strict';var multer=require('multer');var util=require(_0x681d('0x0'));var path=require(_0x681d('0x1'));var timeout=require('connect-timeout');var express=require(_0x681d('0x2'));var router=express[_0x681d('0x3')]();var auth=require(_0x681d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x681d('0x5'));var controller=require(_0x681d('0x6'));router[_0x681d('0x7')]('/',auth[_0x681d('0x8')](),controller[_0x681d('0x9')]);router[_0x681d('0x7')](_0x681d('0xa'),auth[_0x681d('0x8')](),controller[_0x681d('0xb')]);router[_0x681d('0x7')](_0x681d('0xc'),auth[_0x681d('0x8')](),controller[_0x681d('0xd')]);router[_0x681d('0x7')]('/:id/download',auth[_0x681d('0x8')](),controller[_0x681d('0xe')]);router['post']('/',auth[_0x681d('0x8')](),controller[_0x681d('0xf')]);router[_0x681d('0x10')](_0x681d('0xc'),auth[_0x681d('0x8')](),controller['update']);router[_0x681d('0x11')](_0x681d('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x681d('0x12')]=router; \ No newline at end of file +var _0x3759=['isAuthenticated','index','/describe','describe','/:id','show','download','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get'];(function(_0x444c3a,_0x56d9f2){var _0x58b8c7=function(_0x20c3ac){while(--_0x20c3ac){_0x444c3a['push'](_0x444c3a['shift']());}};_0x58b8c7(++_0x56d9f2);}(_0x3759,0x157));var _0x9375=function(_0x2164d8,_0x128827){_0x2164d8=_0x2164d8-0x0;var _0x285a0a=_0x3759[_0x2164d8];return _0x285a0a;};'use strict';var multer=require('multer');var util=require(_0x9375('0x0'));var path=require(_0x9375('0x1'));var timeout=require(_0x9375('0x2'));var express=require(_0x9375('0x3'));var router=express[_0x9375('0x4')]();var auth=require(_0x9375('0x5'));var interaction=require(_0x9375('0x6'));var config=require('../../config/environment');var controller=require(_0x9375('0x7'));router[_0x9375('0x8')]('/',auth[_0x9375('0x9')](),controller[_0x9375('0xa')]);router[_0x9375('0x8')](_0x9375('0xb'),auth['isAuthenticated'](),controller[_0x9375('0xc')]);router[_0x9375('0x8')](_0x9375('0xd'),auth[_0x9375('0x9')](),controller[_0x9375('0xe')]);router['get']('/:id/download',auth[_0x9375('0x9')](),controller[_0x9375('0xf')]);router[_0x9375('0x10')]('/',auth[_0x9375('0x9')](),controller['create']);router[_0x9375('0x11')](_0x9375('0xd'),auth['isAuthenticated'](),controller[_0x9375('0x12')]);router[_0x9375('0x13')](_0x9375('0xd'),auth[_0x9375('0x9')](),controller[_0x9375('0x14')]);module[_0x9375('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index eef7755..fbcc924 100644 --- a/server/api/screenRecording/screenRecording.attributes.js +++ b/server/api/screenRecording/screenRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5636=['format','MM-DD-YYYY\x20HH:mm','toString','closedAt','createdAt','updatedAt','sequelize','moment','VIRTUAL','getDataValue','value','STRING','replace','setDataValue','INTEGER','subtract','DATE','startedAt'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5636,0x102));var _0x6563=function(_0x59c3ba,_0x15b023){_0x59c3ba=_0x59c3ba-0x0;var _0x277993=_0x5636[_0x59c3ba];return _0x277993;};'use strict';var Sequelize=require(_0x6563('0x0'));var moment=require(_0x6563('0x1'));var path=require('path');var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x6563('0x2')],'get':function(){return this[_0x6563('0x3')](_0x6563('0x4'))?path['extname'](this[_0x6563('0x3')](_0x6563('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0x6563('0x5')]},'channel':{'type':Sequelize[_0x6563('0x5')]},'value':{'type':Sequelize[_0x6563('0x5')],'set':function(_0x193942){var _0x9884a9=_0x193942[_0x6563('0x6')](/\\/g,'/');this[_0x6563('0x7')](_0x6563('0x4'),_0x9884a9);}},'rating':{'type':Sequelize[_0x6563('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x6563('0x8')],'set':function(_0x3ccb4e){this['setDataValue']('startedAt',moment()[_0x6563('0x9')](_0x3ccb4e,'ms'));this[_0x6563('0x7')]('closedAt',moment());this['setDataValue']('duration',_0x3ccb4e);}},'startedAt':{'type':Sequelize[_0x6563('0xa')],'get':function(){return moment(this[_0x6563('0x3')](_0x6563('0xb')))[_0x6563('0xc')](_0x6563('0xd'))[_0x6563('0xe')]();}},'closedAt':{'type':Sequelize[_0x6563('0xa')],'get':function(){return moment(this[_0x6563('0x3')](_0x6563('0xf')))['format'](_0x6563('0xd'))['toString']();}},'createdAt':{'type':Sequelize[_0x6563('0xa')],'get':function(){return moment(this[_0x6563('0x3')](_0x6563('0x10')))[_0x6563('0xc')]('MM-DD-YYYY\x20HH:mm')[_0x6563('0xe')]();}},'updatedAt':{'type':Sequelize[_0x6563('0xa')],'get':function(){return moment(this[_0x6563('0x3')](_0x6563('0x11')))['format'](_0x6563('0xd'))['toString']();}}}; \ No newline at end of file +var _0x98a8=['updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','extname','value','STRING','replace','INTEGER','setDataValue','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt'];(function(_0x5c5666,_0x11b1b2){var _0x367b76=function(_0x20c9ae){while(--_0x20c9ae){_0x5c5666['push'](_0x5c5666['shift']());}};_0x367b76(++_0x11b1b2);}(_0x98a8,0x12c));var _0x898a=function(_0x5db331,_0x1953ad){_0x5db331=_0x5db331-0x0;var _0x245bf2=_0x98a8[_0x5db331];return _0x245bf2;};'use strict';var Sequelize=require(_0x898a('0x0'));var moment=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var config=require(_0x898a('0x3'));module[_0x898a('0x4')]={'format':{'type':Sequelize[_0x898a('0x5')],'get':function(){return this[_0x898a('0x6')]('value')?path[_0x898a('0x7')](this[_0x898a('0x6')](_0x898a('0x8'))):undefined;}},'interactionid':{'type':Sequelize[_0x898a('0x9')]},'channel':{'type':Sequelize[_0x898a('0x9')]},'value':{'type':Sequelize['STRING'],'set':function(_0x3aadc2){var _0x564583=_0x3aadc2[_0x898a('0xa')](/\\/g,'/');this['setDataValue'](_0x898a('0x8'),_0x564583);}},'rating':{'type':Sequelize[_0x898a('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x898a('0xb')],'set':function(_0x96b636){this[_0x898a('0xc')](_0x898a('0xd'),moment()[_0x898a('0xe')](_0x96b636,'ms'));this[_0x898a('0xc')](_0x898a('0xf'),moment());this['setDataValue'](_0x898a('0x10'),_0x96b636);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x898a('0x6')]('startedAt'))[_0x898a('0x11')](_0x898a('0x12'))[_0x898a('0x13')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('closedAt'))[_0x898a('0x11')](_0x898a('0x12'))[_0x898a('0x13')]();}},'createdAt':{'type':Sequelize[_0x898a('0x14')],'get':function(){return moment(this[_0x898a('0x6')](_0x898a('0x15')))['format'](_0x898a('0x12'))['toString']();}},'updatedAt':{'type':Sequelize[_0x898a('0x14')],'get':function(){return moment(this['getDataValue'](_0x898a('0x16')))['format'](_0x898a('0x12'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 193e1ff..5e10835 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 _0x9e46=['sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','type','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','decryptFile','recording','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','end','status','json','count','offset','set','apply','save','update','then','destroy','error','name','send','index','ScreenRecording','rawAttributes','model','differenceBy','map','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order'];(function(_0x29c750,_0x224fcc){var _0x2dfcab=function(_0x4238f6){while(--_0x4238f6){_0x29c750['push'](_0x29c750['shift']());}};_0x2dfcab(++_0x224fcc);}(_0x9e46,0x94));var _0x69e4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9e46[_0x167cc1];return _0x10bc4b;};'use strict';var pdf=require(_0x69e4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x69e4('0x1'));var zipdir=require(_0x69e4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x69e4('0x3'));var moment=require(_0x69e4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x69e4('0x5'));var util=require(_0x69e4('0x6'));var path=require(_0x69e4('0x7'));var sox=require(_0x69e4('0x8'));var csv=require(_0x69e4('0x9'));var ejs=require(_0x69e4('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x69e4('0xb'));var crypto=require(_0x69e4('0xc'));var jsforce=require(_0x69e4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x69e4('0x9'));var querystring=require(_0x69e4('0xe'));var Papa=require(_0x69e4('0xf'));var Redis=require(_0x69e4('0x10'));var authService=require(_0x69e4('0x11'));var qs=require(_0x69e4('0x12'));var as=require(_0x69e4('0x13'));var hardwareService=require(_0x69e4('0x14'));var logger=require(_0x69e4('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x69e4('0x16'))['db'];function respondWithStatusCode(_0x472c81,_0xafff1f){_0xafff1f=_0xafff1f||0xcc;return function(_0x5513b4){if(_0x5513b4){return _0x472c81[_0x69e4('0x17')](_0xafff1f);}return _0x472c81['status'](_0xafff1f)[_0x69e4('0x18')]();};}function respondWithResult(_0x16bfae,_0x407e39){_0x407e39=_0x407e39||0xc8;return function(_0x4b54fc){if(_0x4b54fc){return _0x16bfae[_0x69e4('0x19')](_0x407e39)[_0x69e4('0x1a')](_0x4b54fc);}};}function respondWithFilteredResult(_0x1bc316,_0x4bd058){return function(_0x1b76c7){if(_0x1b76c7){var _0x1097cd=_0x1b76c7[_0x69e4('0x1b')],_0x4822e7=_0x4bd058[_0x69e4('0x1c')],_0xadb8a2=_0x4bd058[_0x69e4('0x1c')]+_0x4bd058['limit'],_0x63b84;if(_0xadb8a2>=_0x1097cd){_0xadb8a2=_0x1097cd;_0x63b84=0xc8;}else{_0x63b84=0xce;}_0x1bc316[_0x69e4('0x19')](_0x63b84);return _0x1bc316[_0x69e4('0x1d')]('Content-Range',_0x4822e7+'-'+_0xadb8a2+'/'+_0x1097cd)[_0x69e4('0x1a')](_0x1b76c7);}return null;};}function patchUpdates(_0x1361bb){return function(_0x1fe64b){try{jsonpatch[_0x69e4('0x1e')](_0x1fe64b,_0x1361bb,!![]);}catch(_0x11453f){return BPromise['reject'](_0x11453f);}return _0x1fe64b[_0x69e4('0x1f')]();};}function saveUpdates(_0x14381d,_0x7f5e0a){return function(_0x3be0f4){if(_0x3be0f4){return _0x3be0f4[_0x69e4('0x20')](_0x14381d)[_0x69e4('0x21')](function(_0xc4228d){return _0xc4228d;});}return null;};}function removeEntity(_0x3a2d5b,_0x11877e){return function(_0x2672f6){if(_0x2672f6){return _0x2672f6[_0x69e4('0x22')]()[_0x69e4('0x21')](function(){_0x3a2d5b[_0x69e4('0x19')](0xcc)[_0x69e4('0x18')]();});}};}function handleEntityNotFound(_0x3bb2e7,_0x5a3d05){return function(_0x25cb9b){if(!_0x25cb9b){_0x3bb2e7[_0x69e4('0x17')](0x194);}return _0x25cb9b;};}function handleError(_0x349f37,_0x160fe6){_0x160fe6=_0x160fe6||0x1f4;return function(_0x2f1962){logger[_0x69e4('0x23')](_0x2f1962['stack']);if(_0x2f1962[_0x69e4('0x24')]){delete _0x2f1962['name'];}_0x349f37[_0x69e4('0x19')](_0x160fe6)[_0x69e4('0x25')](_0x2f1962);};}exports[_0x69e4('0x26')]=function(_0x133fea,_0x389ac1){var _0x416371={},_0xe2b2a7={},_0x1c462c={'count':0x0,'rows':[]};var _0x5d2525=_['map'](db[_0x69e4('0x27')][_0x69e4('0x28')],function(_0x5eb629){return{'name':_0x5eb629['fieldName'],'type':_0x5eb629['type']['key']};});_0xe2b2a7[_0x69e4('0x29')]=_[_0x69e4('0x2a')](_[_0x69e4('0x2b')](_0x5d2525,_0x69e4('0x24')),[_0x69e4('0x2c')]);_0xe2b2a7[_0x69e4('0x2d')]=_[_0x69e4('0x2e')](_0x133fea[_0x69e4('0x2d')]);_0xe2b2a7[_0x69e4('0x2f')]=_[_0x69e4('0x30')](_0xe2b2a7[_0x69e4('0x29')],_0xe2b2a7[_0x69e4('0x2d')]);_0x416371[_0x69e4('0x31')]=_[_0x69e4('0x30')](_0xe2b2a7['model'],qs['fields'](_0x133fea[_0x69e4('0x2d')][_0x69e4('0x32')]));_0x416371[_0x69e4('0x31')]=_0x416371[_0x69e4('0x31')][_0x69e4('0x33')]?_0x416371[_0x69e4('0x31')]:_0xe2b2a7['model'];if(!_0x133fea['query'][_0x69e4('0x34')](_0x69e4('0x35'))){_0x416371[_0x69e4('0x36')]=qs[_0x69e4('0x36')](_0x133fea[_0x69e4('0x2d')]['limit']);_0x416371['offset']=qs[_0x69e4('0x1c')](_0x133fea[_0x69e4('0x2d')]['offset']);}_0x416371[_0x69e4('0x37')]=qs[_0x69e4('0x38')](_0x133fea[_0x69e4('0x2d')][_0x69e4('0x38')]);_0x416371[_0x69e4('0x39')]=qs['filters'](_['pick'](_0x133fea[_0x69e4('0x2d')],_0xe2b2a7['filters']),_0x5d2525);if(_0x133fea[_0x69e4('0x2d')][_0x69e4('0x3a')]){_0x416371[_0x69e4('0x39')]=_[_0x69e4('0x3b')](_0x416371[_0x69e4('0x39')],{'$or':_[_0x69e4('0x2b')](_0x5d2525,function(_0x1b229b){if(_0x1b229b['type']!=='VIRTUAL'){var _0x145752={};_0x145752[_0x1b229b[_0x69e4('0x24')]]={'$like':'%'+_0x133fea['query'][_0x69e4('0x3a')]+'%'};return _0x145752;}})});}_0x416371=_[_0x69e4('0x3b')]({},_0x416371,_0x133fea[_0x69e4('0x3c')]);var _0x2fbf5f={'where':_0x416371[_0x69e4('0x39')]};return db[_0x69e4('0x27')][_0x69e4('0x1b')](_0x2fbf5f)[_0x69e4('0x21')](function(_0x47be80){_0x1c462c[_0x69e4('0x1b')]=_0x47be80;if(_0x133fea[_0x69e4('0x2d')][_0x69e4('0x3d')]){_0x416371[_0x69e4('0x3e')]=[{'all':!![]}];}return db[_0x69e4('0x27')][_0x69e4('0x3f')](_0x416371);})[_0x69e4('0x21')](function(_0x317b5e){_0x1c462c[_0x69e4('0x40')]=_0x317b5e;return _0x1c462c;})['then'](respondWithFilteredResult(_0x389ac1,_0x416371))[_0x69e4('0x41')](handleError(_0x389ac1,null));};exports[_0x69e4('0x42')]=function(_0x379b98,_0x1cde2b){var _0x2052c7={'raw':![],'where':{'id':_0x379b98[_0x69e4('0x43')]['id']}},_0x13c1dd={};_0x13c1dd[_0x69e4('0x29')]=_['keys'](db['ScreenRecording']['rawAttributes']);_0x13c1dd['query']=_['keys'](_0x379b98[_0x69e4('0x2d')]);_0x13c1dd[_0x69e4('0x2f')]=_[_0x69e4('0x30')](_0x13c1dd[_0x69e4('0x29')],_0x13c1dd[_0x69e4('0x2d')]);_0x2052c7[_0x69e4('0x31')]=_[_0x69e4('0x30')](_0x13c1dd['model'],qs[_0x69e4('0x32')](_0x379b98[_0x69e4('0x2d')][_0x69e4('0x32')]));_0x2052c7['attributes']=_0x2052c7[_0x69e4('0x31')][_0x69e4('0x33')]?_0x2052c7[_0x69e4('0x31')]:_0x13c1dd[_0x69e4('0x29')];if(_0x379b98[_0x69e4('0x2d')]['includeAll']){_0x2052c7[_0x69e4('0x3e')]=[{'all':!![]}];}_0x2052c7=_[_0x69e4('0x3b')]({},_0x2052c7,_0x379b98['options']);return db['ScreenRecording'][_0x69e4('0x44')](_0x2052c7)[_0x69e4('0x21')](handleEntityNotFound(_0x1cde2b,null))[_0x69e4('0x21')](respondWithResult(_0x1cde2b,null))['catch'](handleError(_0x1cde2b,null));};exports['create']=function(_0x1d49d9,_0x5f5318){return db['ScreenRecording'][_0x69e4('0x45')](_0x1d49d9[_0x69e4('0x46')],{})[_0x69e4('0x21')](respondWithResult(_0x5f5318,0xc9))[_0x69e4('0x41')](handleError(_0x5f5318,null));};exports[_0x69e4('0x20')]=function(_0x3db331,_0x4786d2){if(_0x3db331[_0x69e4('0x46')]['id']){delete _0x3db331[_0x69e4('0x46')]['id'];}delete _0x3db331['body'][_0x69e4('0x47')];delete _0x3db331[_0x69e4('0x46')][_0x69e4('0x48')];delete _0x3db331[_0x69e4('0x46')][_0x69e4('0x49')];delete _0x3db331[_0x69e4('0x46')]['value'];return db['ScreenRecording']['find']({'where':{'id':_0x3db331[_0x69e4('0x43')]['id']}})['then'](handleEntityNotFound(_0x4786d2,null))[_0x69e4('0x21')](saveUpdates(_0x3db331[_0x69e4('0x46')],null))[_0x69e4('0x21')](respondWithResult(_0x4786d2,null))[_0x69e4('0x41')](handleError(_0x4786d2,null));};exports[_0x69e4('0x4a')]=function(_0x329f72,_0x42c1c0){return db[_0x69e4('0x27')][_0x69e4('0x4a')]()[_0x69e4('0x21')](respondWithResult(_0x42c1c0,null))[_0x69e4('0x41')](handleError(_0x42c1c0,null));};exports[_0x69e4('0x4b')]=function(_0x1b89f5,_0xaed9d,_0x480c81){var _0x51a80d=require(_0x69e4('0x4c'));var _0x395370=![];var _0x2bc48b={};if(_0x1b89f5['query'][_0x69e4('0x4d')]&&_0x1b89f5['query'][_0x69e4('0x4d')]===_0x69e4('0x4e')){_0x2bc48b[_0x69e4('0x4e')]=_0x1b89f5[_0x69e4('0x43')]['id'];}else{_0x2bc48b['id']=_0x1b89f5['params']['id'];}return db[_0x69e4('0x27')][_0x69e4('0x44')]({'where':_0x2bc48b,'attributes':['id',_0x69e4('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0xaed9d,null))[_0x69e4('0x21')](function(_0x42a38c){if(_0x42a38c){var _0xe15bf6=path[_0x69e4('0x50')](config[_0x69e4('0x51')],_0x69e4('0x52'),_0x42a38c[_0x69e4('0x4f')]);var _0x518245=util[_0x69e4('0x2c')](_0x69e4('0x53'),_0xe15bf6);if(fs['existsSync'](_0x518245)){_0x395370=!![];return _0x51a80d[_0x69e4('0x54')](_0x518245,_0xe15bf6,config['secrets'][_0x69e4('0x55')])['then'](function(){return _0x42a38c;});}return _0x42a38c;}})[_0x69e4('0x21')](function(_0x48b904){if(_0x48b904){var _0x5c313a=path[_0x69e4('0x50')](config[_0x69e4('0x51')],_0x69e4('0x52'),_0x48b904[_0x69e4('0x4f')]);if(!fs[_0x69e4('0x56')](_0x5c313a)){throw new db[(_0x69e4('0x57'))][(_0x69e4('0x58'))](_0x69e4('0x59'));}if(_0x48b904['filename']){return _0xaed9d['download'](_0x5c313a,_0x48b904[_0x69e4('0x5a')]+path[_0x69e4('0x5b')](_0x5c313a),function(){if(_0x395370){fs[_0x69e4('0x5c')](_0x5c313a);}});}else{return _0xaed9d[_0x69e4('0x4b')](_0x5c313a,function(_0x21a415){if(_0x395370){fs[_0x69e4('0x5c')](_0x5c313a);}});}}})[_0x69e4('0x41')](function(_0x4b63ed){if(_0x4b63ed[_0x69e4('0x5d')]===_0x69e4('0x59')){_0xaed9d['status'](0x194)['send'](_0x69e4('0x5e'));}else{return handleError(_0xaed9d,null);}});};exports[_0x69e4('0x22')]=function(_0x3d5907,_0xde4066){return db['ScreenRecording'][_0x69e4('0x44')]({'where':{'id':_0x3d5907[_0x69e4('0x43')]['id']}})[_0x69e4('0x21')](function(_0x23781b){if(!_0x23781b)throw new ReferenceError(_0x69e4('0x5f'));return _0x23781b;})[_0x69e4('0x21')](function(_0x1ff06a){var _0x1c97ba=path[_0x69e4('0x50')](config['root'],'server/files/screen_recordings',_0x1ff06a[_0x69e4('0x4f')]);logger[_0x69e4('0x60')]('cancellazione\x20fisica\x20documento\x20%s',_0x1c97ba);if(!_[_0x69e4('0x61')](_0x1ff06a[_0x69e4('0x4f')])&&fs[_0x69e4('0x56')](_0x1c97ba)){logger[_0x69e4('0x60')](_0x69e4('0x62')+_0x1c97ba+_0x69e4('0x63'));fs[_0x69e4('0x64')](_0x1c97ba);}_0x1c97ba=_0x1c97ba+_0x69e4('0x65');if(!_[_0x69e4('0x61')](_0x1ff06a[_0x69e4('0x4f')])&&fs[_0x69e4('0x56')](_0x1c97ba)){logger[_0x69e4('0x60')](_0x69e4('0x62')+_0x1c97ba+_0x69e4('0x63'));fs[_0x69e4('0x64')](_0x1c97ba);}return _0x1ff06a;})['then'](function(_0x334b5b){if(!_0x334b5b)throw new InternalError();return _0x334b5b['destroy']();})[_0x69e4('0x21')](function(){_0xde4066[_0x69e4('0x19')](0xcc)[_0x69e4('0x18')]();})[_0x69e4('0x41')](handleError(_0xde4066,null));}; \ No newline at end of file +var _0x05b7=['Content-Range','apply','save','update','then','error','name','send','ScreenRecording','fieldName','type','model','differenceBy','map','format','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','count','includeAll','include','findAll','rows','find','catch','create','body','duration','createdAt','closedAt','value','params','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','decryptFile','secrets','recording','existsSync','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','html-pdf','eml-format','rimraf','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x4d5144,_0x16a34e){var _0x225be5=function(_0x9a05e2){while(--_0x9a05e2){_0x4d5144['push'](_0x4d5144['shift']());}};_0x225be5(++_0x16a34e);}(_0x05b7,0xac));var _0x705b=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x05b7[_0xf50820];return _0x2a9b10;};'use strict';var pdf=require(_0x705b('0x0'));var emlformat=require(_0x705b('0x1'));var rimraf=require(_0x705b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x705b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x705b('0x4'));var util=require(_0x705b('0x5'));var path=require(_0x705b('0x6'));var sox=require(_0x705b('0x7'));var csv=require(_0x705b('0x8'));var ejs=require(_0x705b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x705b('0xa'));var crypto=require(_0x705b('0xb'));var jsforce=require(_0x705b('0xc'));var deskjs=require(_0x705b('0xd'));var toCsv=require(_0x705b('0x8'));var querystring=require(_0x705b('0xe'));var Papa=require(_0x705b('0xf'));var Redis=require(_0x705b('0x10'));var authService=require(_0x705b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x705b('0x12'));var hardwareService=require(_0x705b('0x13'));var logger=require(_0x705b('0x14'))(_0x705b('0x15'));var utils=require(_0x705b('0x16'));var config=require(_0x705b('0x17'));var licenseUtil=require(_0x705b('0x18'));var db=require(_0x705b('0x19'))['db'];function respondWithStatusCode(_0xf07a80,_0x24954e){_0x24954e=_0x24954e||0xcc;return function(_0x415539){if(_0x415539){return _0xf07a80[_0x705b('0x1a')](_0x24954e);}return _0xf07a80[_0x705b('0x1b')](_0x24954e)[_0x705b('0x1c')]();};}function respondWithResult(_0x401268,_0x273843){_0x273843=_0x273843||0xc8;return function(_0x38089f){if(_0x38089f){return _0x401268[_0x705b('0x1b')](_0x273843)[_0x705b('0x1d')](_0x38089f);}};}function respondWithFilteredResult(_0x2145a9,_0x525554){return function(_0x592470){if(_0x592470){var _0x2e937e=_0x592470['count'],_0x11746e=_0x525554[_0x705b('0x1e')],_0x56b8d3=_0x525554[_0x705b('0x1e')]+_0x525554[_0x705b('0x1f')],_0x10f94e;if(_0x56b8d3>=_0x2e937e){_0x56b8d3=_0x2e937e;_0x10f94e=0xc8;}else{_0x10f94e=0xce;}_0x2145a9['status'](_0x10f94e);return _0x2145a9['set'](_0x705b('0x20'),_0x11746e+'-'+_0x56b8d3+'/'+_0x2e937e)[_0x705b('0x1d')](_0x592470);}return null;};}function patchUpdates(_0x287311){return function(_0x29041){try{jsonpatch[_0x705b('0x21')](_0x29041,_0x287311,!![]);}catch(_0x2b37d9){return BPromise['reject'](_0x2b37d9);}return _0x29041[_0x705b('0x22')]();};}function saveUpdates(_0x275602,_0x23ab41){return function(_0x334dbe){if(_0x334dbe){return _0x334dbe[_0x705b('0x23')](_0x275602)[_0x705b('0x24')](function(_0x1c3d8e){return _0x1c3d8e;});}return null;};}function removeEntity(_0x49937e,_0x5e4d48){return function(_0xafe8b0){if(_0xafe8b0){return _0xafe8b0['destroy']()[_0x705b('0x24')](function(){_0x49937e[_0x705b('0x1b')](0xcc)[_0x705b('0x1c')]();});}};}function handleEntityNotFound(_0x361041,_0x19e57f){return function(_0xbae82b){if(!_0xbae82b){_0x361041[_0x705b('0x1a')](0x194);}return _0xbae82b;};}function handleError(_0x18f86f,_0x58fe4c){_0x58fe4c=_0x58fe4c||0x1f4;return function(_0x2fdd1e){logger[_0x705b('0x25')](_0x2fdd1e['stack']);if(_0x2fdd1e[_0x705b('0x26')]){delete _0x2fdd1e['name'];}_0x18f86f[_0x705b('0x1b')](_0x58fe4c)[_0x705b('0x27')](_0x2fdd1e);};}exports['index']=function(_0x2f002c,_0x2b20e){var _0xe4cdd2={},_0x1a6316={},_0x429476={'count':0x0,'rows':[]};var _0x3c2c5f=_['map'](db[_0x705b('0x28')]['rawAttributes'],function(_0x20f97e){return{'name':_0x20f97e[_0x705b('0x29')],'type':_0x20f97e[_0x705b('0x2a')]['key']};});_0x1a6316[_0x705b('0x2b')]=_[_0x705b('0x2c')](_[_0x705b('0x2d')](_0x3c2c5f,_0x705b('0x26')),[_0x705b('0x2e')]);_0x1a6316[_0x705b('0x2f')]=_[_0x705b('0x30')](_0x2f002c[_0x705b('0x2f')]);_0x1a6316['filters']=_[_0x705b('0x31')](_0x1a6316[_0x705b('0x2b')],_0x1a6316[_0x705b('0x2f')]);_0xe4cdd2['attributes']=_[_0x705b('0x31')](_0x1a6316[_0x705b('0x2b')],qs['fields'](_0x2f002c[_0x705b('0x2f')][_0x705b('0x32')]));_0xe4cdd2[_0x705b('0x33')]=_0xe4cdd2['attributes'][_0x705b('0x34')]?_0xe4cdd2['attributes']:_0x1a6316['model'];if(!_0x2f002c[_0x705b('0x2f')][_0x705b('0x35')](_0x705b('0x36'))){_0xe4cdd2['limit']=qs['limit'](_0x2f002c[_0x705b('0x2f')][_0x705b('0x1f')]);_0xe4cdd2['offset']=qs[_0x705b('0x1e')](_0x2f002c['query'][_0x705b('0x1e')]);}_0xe4cdd2[_0x705b('0x37')]=qs[_0x705b('0x38')](_0x2f002c[_0x705b('0x2f')][_0x705b('0x38')]);_0xe4cdd2[_0x705b('0x39')]=qs[_0x705b('0x3a')](_['pick'](_0x2f002c['query'],_0x1a6316[_0x705b('0x3a')]),_0x3c2c5f);if(_0x2f002c[_0x705b('0x2f')][_0x705b('0x3b')]){_0xe4cdd2[_0x705b('0x39')]=_[_0x705b('0x3c')](_0xe4cdd2['where'],{'$or':_['map'](_0x3c2c5f,function(_0x4b1213){if(_0x4b1213[_0x705b('0x2a')]!=='VIRTUAL'){var _0x4ff692={};_0x4ff692[_0x4b1213[_0x705b('0x26')]]={'$like':'%'+_0x2f002c[_0x705b('0x2f')][_0x705b('0x3b')]+'%'};return _0x4ff692;}})});}_0xe4cdd2=_[_0x705b('0x3c')]({},_0xe4cdd2,_0x2f002c[_0x705b('0x3d')]);var _0x52b17d={'where':_0xe4cdd2[_0x705b('0x39')]};return db[_0x705b('0x28')][_0x705b('0x3e')](_0x52b17d)[_0x705b('0x24')](function(_0x37711f){_0x429476['count']=_0x37711f;if(_0x2f002c[_0x705b('0x2f')][_0x705b('0x3f')]){_0xe4cdd2[_0x705b('0x40')]=[{'all':!![]}];}return db['ScreenRecording'][_0x705b('0x41')](_0xe4cdd2);})['then'](function(_0x46dc59){_0x429476[_0x705b('0x42')]=_0x46dc59;return _0x429476;})['then'](respondWithFilteredResult(_0x2b20e,_0xe4cdd2))['catch'](handleError(_0x2b20e,null));};exports['show']=function(_0x14a61f,_0x2c1240){var _0x165ec3={'raw':![],'where':{'id':_0x14a61f['params']['id']}},_0x242092={};_0x242092[_0x705b('0x2b')]=_[_0x705b('0x30')](db[_0x705b('0x28')]['rawAttributes']);_0x242092[_0x705b('0x2f')]=_[_0x705b('0x30')](_0x14a61f[_0x705b('0x2f')]);_0x242092[_0x705b('0x3a')]=_[_0x705b('0x31')](_0x242092['model'],_0x242092[_0x705b('0x2f')]);_0x165ec3['attributes']=_['intersection'](_0x242092[_0x705b('0x2b')],qs[_0x705b('0x32')](_0x14a61f[_0x705b('0x2f')][_0x705b('0x32')]));_0x165ec3[_0x705b('0x33')]=_0x165ec3[_0x705b('0x33')]['length']?_0x165ec3[_0x705b('0x33')]:_0x242092[_0x705b('0x2b')];if(_0x14a61f['query'][_0x705b('0x3f')]){_0x165ec3[_0x705b('0x40')]=[{'all':!![]}];}_0x165ec3=_[_0x705b('0x3c')]({},_0x165ec3,_0x14a61f['options']);return db[_0x705b('0x28')][_0x705b('0x43')](_0x165ec3)['then'](handleEntityNotFound(_0x2c1240,null))[_0x705b('0x24')](respondWithResult(_0x2c1240,null))[_0x705b('0x44')](handleError(_0x2c1240,null));};exports[_0x705b('0x45')]=function(_0x2a4c96,_0x559e4b){return db[_0x705b('0x28')][_0x705b('0x45')](_0x2a4c96[_0x705b('0x46')],{})[_0x705b('0x24')](respondWithResult(_0x559e4b,0xc9))[_0x705b('0x44')](handleError(_0x559e4b,null));};exports[_0x705b('0x23')]=function(_0x45cff1,_0x108605){if(_0x45cff1[_0x705b('0x46')]['id']){delete _0x45cff1[_0x705b('0x46')]['id'];}delete _0x45cff1[_0x705b('0x46')][_0x705b('0x47')];delete _0x45cff1[_0x705b('0x46')][_0x705b('0x48')];delete _0x45cff1['body'][_0x705b('0x49')];delete _0x45cff1[_0x705b('0x46')][_0x705b('0x4a')];return db[_0x705b('0x28')][_0x705b('0x43')]({'where':{'id':_0x45cff1[_0x705b('0x4b')]['id']}})[_0x705b('0x24')](handleEntityNotFound(_0x108605,null))[_0x705b('0x24')](saveUpdates(_0x45cff1['body'],null))[_0x705b('0x24')](respondWithResult(_0x108605,null))['catch'](handleError(_0x108605,null));};exports[_0x705b('0x4c')]=function(_0xc332f4,_0x1f21b4){return db['ScreenRecording'][_0x705b('0x4c')]()[_0x705b('0x24')](respondWithResult(_0x1f21b4,null))[_0x705b('0x44')](handleError(_0x1f21b4,null));};exports[_0x705b('0x4d')]=function(_0x543b37,_0x17ea69,_0xad3106){var _0x287d9b=require('../../components/encryptor');var _0x227c74=![];var _0x17a53f={};if(_0x543b37['query']['type']&&_0x543b37['query'][_0x705b('0x2a')]==='uniqueid'){_0x17a53f[_0x705b('0x4e')]=_0x543b37['params']['id'];}else{_0x17a53f['id']=_0x543b37[_0x705b('0x4b')]['id'];}return db[_0x705b('0x28')]['find']({'where':_0x17a53f,'attributes':['id','value'],'raw':!![]})[_0x705b('0x24')](handleEntityNotFound(_0x17ea69,null))['then'](function(_0x74478b){if(_0x74478b){var _0x169f25=path[_0x705b('0x4f')](config[_0x705b('0x50')],_0x705b('0x51'),_0x74478b[_0x705b('0x4a')]);var _0x5af54c=util[_0x705b('0x2e')](_0x705b('0x52'),_0x169f25);if(fs['existsSync'](_0x5af54c)){_0x227c74=!![];return _0x287d9b[_0x705b('0x53')](_0x5af54c,_0x169f25,config[_0x705b('0x54')][_0x705b('0x55')])[_0x705b('0x24')](function(){return _0x74478b;});}return _0x74478b;}})[_0x705b('0x24')](function(_0x422828){if(_0x422828){var _0x2bf65f=path[_0x705b('0x4f')](config['root'],_0x705b('0x51'),_0x422828['value']);if(!fs[_0x705b('0x56')](_0x2bf65f)){throw new db['Sequelize'][(_0x705b('0x57'))](_0x705b('0x58'));}if(_0x422828[_0x705b('0x59')]){return _0x17ea69[_0x705b('0x4d')](_0x2bf65f,_0x422828[_0x705b('0x59')]+path[_0x705b('0x5a')](_0x2bf65f),function(){if(_0x227c74){fs['unlink'](_0x2bf65f);}});}else{return _0x17ea69['download'](_0x2bf65f,function(_0x154d2e){if(_0x227c74){fs[_0x705b('0x5b')](_0x2bf65f);}});}}})['catch'](function(_0x8caa2f){if(_0x8caa2f[_0x705b('0x5c')]===_0x705b('0x58')){_0x17ea69['status'](0x194)[_0x705b('0x27')]('Not\x20found');}else{return handleError(_0x17ea69,null);}});};exports[_0x705b('0x5d')]=function(_0x5cbee3,_0x182cd4){return db[_0x705b('0x28')][_0x705b('0x43')]({'where':{'id':_0x5cbee3[_0x705b('0x4b')]['id']}})[_0x705b('0x24')](function(_0x11a96c){if(!_0x11a96c)throw new ReferenceError(_0x705b('0x5e'));return _0x11a96c;})[_0x705b('0x24')](function(_0x5c0a5b){var _0x33c7eb=path['join'](config[_0x705b('0x50')],_0x705b('0x51'),_0x5c0a5b[_0x705b('0x4a')]);logger[_0x705b('0x5f')](_0x705b('0x60'),_0x33c7eb);if(!_[_0x705b('0x61')](_0x5c0a5b[_0x705b('0x4a')])&&fs['existsSync'](_0x33c7eb)){logger[_0x705b('0x5f')]('File:\x20\x22'+_0x33c7eb+_0x705b('0x62'));fs[_0x705b('0x63')](_0x33c7eb);}_0x33c7eb=_0x33c7eb+_0x705b('0x64');if(!_[_0x705b('0x61')](_0x5c0a5b['value'])&&fs[_0x705b('0x56')](_0x33c7eb)){logger[_0x705b('0x5f')](_0x705b('0x65')+_0x33c7eb+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x705b('0x63')](_0x33c7eb);}return _0x5c0a5b;})['then'](function(_0x7e0249){if(!_0x7e0249)throw new InternalError();return _0x7e0249['destroy']();})[_0x705b('0x24')](function(){_0x182cd4['status'](0xcc)[_0x705b('0x1c')]();})[_0x705b('0x44')](handleError(_0x182cd4,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 84a4626..b34ad1a 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 _0x8348=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x8348,0xd2));var _0x8834=function(_0x3a616d,_0x30411f){_0x3a616d=_0x3a616d-0x0;var _0x135212=_0x8348[_0x3a616d];return _0x135212;};'use strict';var _=require(_0x8834('0x0'));var util=require(_0x8834('0x1'));var logger=require(_0x8834('0x2'))(_0x8834('0x3'));var moment=require(_0x8834('0x4'));var BPromise=require(_0x8834('0x5'));var rp=require(_0x8834('0x6'));var fs=require('fs');var path=require(_0x8834('0x7'));var rimraf=require(_0x8834('0x8'));var config=require(_0x8834('0x9'));var attributes=require(_0x8834('0xa'));module[_0x8834('0xb')]=function(_0x216835,_0x3dad75){return _0x216835['define'](_0x8834('0xc'),attributes,{'tableName':_0x8834('0xd'),'paranoid':![],'indexes':[{'name':_0x8834('0xe'),'fields':[_0x8834('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa422=['../../config/environment','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x34362,_0x1e9392){var _0x4613b0=function(_0x4a1285){while(--_0x4a1285){_0x34362['push'](_0x34362['shift']());}};_0x4613b0(++_0x1e9392);}(_0xa422,0xca));var _0x2a42=function(_0x20bb7a,_0x5dfd86){_0x20bb7a=_0x20bb7a-0x0;var _0x43a561=_0xa422[_0x20bb7a];return _0x43a561;};'use strict';var _=require(_0x2a42('0x0'));var util=require('util');var logger=require(_0x2a42('0x1'))(_0x2a42('0x2'));var moment=require(_0x2a42('0x3'));var BPromise=require(_0x2a42('0x4'));var rp=require(_0x2a42('0x5'));var fs=require('fs');var path=require(_0x2a42('0x6'));var rimraf=require(_0x2a42('0x7'));var config=require(_0x2a42('0x8'));var attributes=require('./screenRecording.attributes');module[_0x2a42('0x9')]=function(_0xdaa41,_0x5a689c){return _0xdaa41[_0x2a42('0xa')](_0x2a42('0xb'),attributes,{'tableName':_0x2a42('0xc'),'paranoid':![],'indexes':[{'name':_0x2a42('0xd'),'fields':[_0x2a42('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 2d8f57d..2a39d1a 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(_0x3c4fb5,_0x5b39b4){var _0xf484c6=function(_0x3e7d34){while(--_0x3e7d34){_0x3c4fb5['push'](_0x3c4fb5['shift']());}};_0xf484c6(++_0x5b39b4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','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(_0x28319e,_0x431175){var _0x44da37=function(_0x13196d){while(--_0x13196d){_0x28319e['push'](_0x28319e['shift']());}};_0x44da37(++_0x431175);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 933dac3..10052e0 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 _0x4b20=['preferred','/:id/favicon','addFavicon','put','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','index','get','getDate','/:id','show','getLogo','/:id/logo_login','/:id/gdpr','/:id/preferred','getFavicon','diskStorage','join','root','format','logo','extname','originalname','post','single','file','addLogo','server/files/images/logos/','%s%s','logologin','addLogoLogin'];(function(_0x58a485,_0x49f1ff){var _0x26cb5c=function(_0x2a6397){while(--_0x2a6397){_0x58a485['push'](_0x58a485['shift']());}};_0x26cb5c(++_0x49f1ff);}(_0x4b20,0xd2));var _0x04b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4b20[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x04b2('0x0'));var util=require(_0x04b2('0x1'));var path=require(_0x04b2('0x2'));var timeout=require(_0x04b2('0x3'));var express=require(_0x04b2('0x4'));var router=express[_0x04b2('0x5')]();var auth=require(_0x04b2('0x6'));var interaction=require(_0x04b2('0x7'));var config=require(_0x04b2('0x8'));var controller=require(_0x04b2('0x9'));router['get']('/',auth[_0x04b2('0xa')](),controller[_0x04b2('0xb')]);router[_0x04b2('0xc')]('/now',controller[_0x04b2('0xd')]);router[_0x04b2('0xc')](_0x04b2('0xe'),controller[_0x04b2('0xf')]);router['get']('/:id/logo',controller[_0x04b2('0x10')]);router['get'](_0x04b2('0x11'),controller['getLogoLogin']);router[_0x04b2('0xc')](_0x04b2('0x12'),controller['gdpr']);router[_0x04b2('0xc')](_0x04b2('0x13'),controller['getPreferred']);router[_0x04b2('0xc')]('/:id/favicon',controller[_0x04b2('0x14')]);var upload=multer({'storage':multer[_0x04b2('0x15')]({'destination':function(_0x62a317,_0x2fbb2b,_0x344ee6){_0x344ee6(null,path[_0x04b2('0x16')](config[_0x04b2('0x17')],'server/files/images/logos/'));},'filename':function(_0x59a5f1,_0x329796,_0x3df5eb){_0x3df5eb(null,util[_0x04b2('0x18')]('%s%s',_0x04b2('0x19'),path[_0x04b2('0x1a')](_0x329796[_0x04b2('0x1b')])));}})});router[_0x04b2('0x1c')]('/:id/logo',upload[_0x04b2('0x1d')](_0x04b2('0x1e')),controller[_0x04b2('0x1f')]);var upload=multer({'storage':multer[_0x04b2('0x15')]({'destination':function(_0x5c5c17,_0x21305d,_0x29d9dd){_0x29d9dd(null,path[_0x04b2('0x16')](config[_0x04b2('0x17')],_0x04b2('0x20')));},'filename':function(_0x1545d0,_0x597be4,_0x43390){_0x43390(null,util[_0x04b2('0x18')](_0x04b2('0x21'),_0x04b2('0x22'),path['extname'](_0x597be4[_0x04b2('0x1b')])));}})});router[_0x04b2('0x1c')]('/:id/logo_login',upload[_0x04b2('0x1d')](_0x04b2('0x1e')),controller[_0x04b2('0x23')]);var upload=multer({'storage':multer[_0x04b2('0x15')]({'destination':function(_0x12e83a,_0x425866,_0x1664f0){_0x1664f0(null,path[_0x04b2('0x16')](config[_0x04b2('0x17')],_0x04b2('0x20')));},'filename':function(_0x2c33ee,_0x277eb7,_0x3da81f){_0x3da81f(null,util[_0x04b2('0x18')]('%s%s',_0x04b2('0x24'),path[_0x04b2('0x1a')](_0x277eb7[_0x04b2('0x1b')])));}})});router[_0x04b2('0x1c')](_0x04b2('0x13'),upload[_0x04b2('0x1d')](_0x04b2('0x1e')),controller['addPreferred']);var upload=multer({'storage':multer[_0x04b2('0x15')]({'destination':function(_0x423e3f,_0x42b957,_0x9868b5){_0x9868b5(null,path[_0x04b2('0x16')](config[_0x04b2('0x17')],_0x04b2('0x20')));},'filename':function(_0x2e610f,_0xbd286f,_0x4d76f7){_0x4d76f7(null,util[_0x04b2('0x18')]('%s%s','favicon',path[_0x04b2('0x1a')](_0xbd286f[_0x04b2('0x1b')])));}})});router[_0x04b2('0x1c')](_0x04b2('0x25'),upload['single'](_0x04b2('0x1e')),controller[_0x04b2('0x26')]);router[_0x04b2('0x27')](_0x04b2('0xe'),auth[_0x04b2('0xa')](),controller[_0x04b2('0x28')]);module['exports']=router; \ No newline at end of file +var _0x88d6=['getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','server/files/images/logos/','format','%s%s','extname','originalname','post','single','file','addLogo','diskStorage','root','/:id/logo_login','preferred','addPreferred','favicon','put','update','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','getDate','/:id','show','getLogo'];(function(_0x22b5f6,_0x23a9fe){var _0x1b94ed=function(_0x2dba50){while(--_0x2dba50){_0x22b5f6['push'](_0x22b5f6['shift']());}};_0x1b94ed(++_0x23a9fe);}(_0x88d6,0x1be));var _0x688d=function(_0x535a0f,_0x29ca2d){_0x535a0f=_0x535a0f-0x0;var _0x331437=_0x88d6[_0x535a0f];return _0x331437;};'use strict';var multer=require(_0x688d('0x0'));var util=require(_0x688d('0x1'));var path=require(_0x688d('0x2'));var timeout=require(_0x688d('0x3'));var express=require('express');var router=express[_0x688d('0x4')]();var auth=require(_0x688d('0x5'));var interaction=require(_0x688d('0x6'));var config=require(_0x688d('0x7'));var controller=require(_0x688d('0x8'));router[_0x688d('0x9')]('/',auth['isAuthenticated'](),controller[_0x688d('0xa')]);router[_0x688d('0x9')](_0x688d('0xb'),controller[_0x688d('0xc')]);router[_0x688d('0x9')](_0x688d('0xd'),controller[_0x688d('0xe')]);router[_0x688d('0x9')]('/:id/logo',controller[_0x688d('0xf')]);router['get']('/:id/logo_login',controller[_0x688d('0x10')]);router[_0x688d('0x9')](_0x688d('0x11'),controller[_0x688d('0x12')]);router['get'](_0x688d('0x13'),controller[_0x688d('0x14')]);router['get'](_0x688d('0x15'),controller[_0x688d('0x16')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x8512e3,_0x320482,_0x39e3ee){_0x39e3ee(null,path[_0x688d('0x17')](config['root'],_0x688d('0x18')));},'filename':function(_0x412028,_0x44511a,_0x77efbe){_0x77efbe(null,util[_0x688d('0x19')](_0x688d('0x1a'),'logo',path[_0x688d('0x1b')](_0x44511a[_0x688d('0x1c')])));}})});router[_0x688d('0x1d')]('/:id/logo',upload[_0x688d('0x1e')](_0x688d('0x1f')),controller[_0x688d('0x20')]);var upload=multer({'storage':multer[_0x688d('0x21')]({'destination':function(_0xd90071,_0x260ae1,_0x4e5876){_0x4e5876(null,path['join'](config[_0x688d('0x22')],_0x688d('0x18')));},'filename':function(_0x55c38d,_0x1fe5a4,_0xa3047){_0xa3047(null,util['format'](_0x688d('0x1a'),'logologin',path[_0x688d('0x1b')](_0x1fe5a4[_0x688d('0x1c')])));}})});router[_0x688d('0x1d')](_0x688d('0x23'),upload[_0x688d('0x1e')](_0x688d('0x1f')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x688d('0x21')]({'destination':function(_0x2e30be,_0x112170,_0x10212a){_0x10212a(null,path['join'](config['root'],_0x688d('0x18')));},'filename':function(_0x2dd36f,_0xf633b6,_0xeccaec){_0xeccaec(null,util[_0x688d('0x19')](_0x688d('0x1a'),_0x688d('0x24'),path[_0x688d('0x1b')](_0xf633b6[_0x688d('0x1c')])));}})});router[_0x688d('0x1d')](_0x688d('0x13'),upload[_0x688d('0x1e')](_0x688d('0x1f')),controller[_0x688d('0x25')]);var upload=multer({'storage':multer[_0x688d('0x21')]({'destination':function(_0x2c9abe,_0x1e5389,_0x107e58){_0x107e58(null,path[_0x688d('0x17')](config[_0x688d('0x22')],_0x688d('0x18')));},'filename':function(_0x514856,_0x1e2b53,_0x3765f5){_0x3765f5(null,util[_0x688d('0x19')]('%s%s',_0x688d('0x26'),path[_0x688d('0x1b')](_0x1e2b53[_0x688d('0x1c')])));}})});router['post'](_0x688d('0x15'),upload['single'](_0x688d('0x1f')),controller['addFavicon']);router[_0x688d('0x27')](_0x688d('0xd'),auth['isAuthenticated'](),controller[_0x688d('0x28')]);module[_0x688d('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 74e7aee..3f1213a 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 _0x2e88=['UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate'];(function(_0x278d5b,_0x21571d){var _0x340019=function(_0x378e84){while(--_0x378e84){_0x278d5b['push'](_0x278d5b['shift']());}};_0x340019(++_0x21571d);}(_0x2e88,0xc7));var _0x82e8=function(_0x14d896,_0x53578b){_0x14d896=_0x14d896-0x0;var _0x28679a=_0x2e88[_0x14d896];return _0x28679a;};'use strict';var Sequelize=require(_0x82e8('0x0'));module[_0x82e8('0x1')]={'min_internal':{'type':Sequelize[_0x82e8('0x2')](0xb),'unique':_0x82e8('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x82e8('0x2')](0xb),'unique':_0x82e8('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x82e8('0x5')],'defaultValue':_0x82e8('0x6')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x82e8('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x82e8('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x82e8('0x5')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x82e8('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x82e8('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x82e8('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x82e8('0x5')],'defaultValue':_0x82e8('0x8')},'enableEmailPreview':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x82e8('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x82e8('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x82e8('0x5')],'defaultValue':_0x82e8('0x9')},'chatTimeout':{'type':Sequelize[_0x82e8('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x82e8('0x5')]},'defaultPreferred':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x82e8('0x5')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x82e8('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x82e8('0x5')]},'defaultFavicon':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x82e8('0x5')]},'language':{'type':Sequelize[_0x82e8('0x5')]},'bucket':{'type':Sequelize[_0x82e8('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x82e8('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x82e8('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x82e8('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x82e8('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x82e8('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x82e8('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x43ba=['STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','/var/opt/motion2/server/files/sounds/converted'];(function(_0x49c1b0,_0x35b033){var _0x5be831=function(_0x1ae2a4){while(--_0x1ae2a4){_0x49c1b0['push'](_0x49c1b0['shift']());}};_0x5be831(++_0x35b033);}(_0x43ba,0xe0));var _0xa43b=function(_0x44eb75,_0x216c91){_0x44eb75=_0x44eb75-0x0;var _0x4f68f8=_0x43ba[_0x44eb75];return _0x4f68f8;};'use strict';var Sequelize=require(_0xa43b('0x0'));module[_0xa43b('0x1')]={'min_internal':{'type':Sequelize[_0xa43b('0x2')](0xb),'unique':_0xa43b('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xa43b('0x2')](0xb),'unique':_0xa43b('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0xa43b('0x5')},'logo':{'type':Sequelize[_0xa43b('0x6')]},'defaultLogo':{'type':Sequelize[_0xa43b('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xa43b('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xa43b('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xa43b('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xa43b('0x6')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0xa43b('0x6')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xa43b('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xa43b('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xa43b('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xa43b('0x8')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0xa43b('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xa43b('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xa43b('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xa43b('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xa43b('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xa43b('0x6')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xa43b('0x6')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xa43b('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xa43b('0x6')]},'defaultFavicon':{'type':Sequelize[_0xa43b('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xa43b('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xa43b('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xa43b('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xa43b('0x2')]},'transcribeRegion':{'type':Sequelize[_0xa43b('0x6')]},'sentiment':{'type':Sequelize[_0xa43b('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xa43b('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xa43b('0x2')]},'sentimentRegion':{'type':Sequelize[_0xa43b('0x6')]},'language':{'type':Sequelize[_0xa43b('0x6')]},'bucket':{'type':Sequelize[_0xa43b('0x6')]},'googleSsoEnabled':{'type':Sequelize[_0xa43b('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xa43b('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xa43b('0x2')](0x2)[_0xa43b('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xa43b('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xa43b('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xa43b('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xa43b('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 47b3dc0..66faddb 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 _0xaeed=['VIRTUAL','options','count','include','findAll','rows','catch','show','rawAttributes','includeAll','update','body','find','addLogo','file','filename','logo','params','addLogoLogin','loginLogo','getLicense','preferred','defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','default','upperFirst','existsSync','\x20not\x20found','server/files/images/logos','favicon','defaultLogo','default_loginLogo.svg','custom','ValidationError','download','gdpr','securePassword','default_preferred.png','Sequelize','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','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','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','Setting,\x20%s,\x20%s','message','result','status','end','json','offset','limit','set','Content-Range','reject','sendStatus','stack','name','send','index','map','Setting','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','filter','merge'];(function(_0x2662ea,_0x47d321){var _0x135667=function(_0x5ab470){while(--_0x5ab470){_0x2662ea['push'](_0x2662ea['shift']());}};_0x135667(++_0x47d321);}(_0xaeed,0x1a5));var _0xdaee=function(_0x1223d6,_0x51863a){_0x1223d6=_0x1223d6-0x0;var _0x2cc448=_0xaeed[_0x1223d6];return _0x2cc448;};'use strict';var pdf=require(_0xdaee('0x0'));var emlformat=require(_0xdaee('0x1'));var rimraf=require(_0xdaee('0x2'));var zipdir=require(_0xdaee('0x3'));var jsonpatch=require(_0xdaee('0x4'));var rp=require(_0xdaee('0x5'));var moment=require(_0xdaee('0x6'));var BPromise=require(_0xdaee('0x7'));var Mustache=require(_0xdaee('0x8'));var util=require('util');var path=require(_0xdaee('0x9'));var sox=require(_0xdaee('0xa'));var csv=require(_0xdaee('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xdaee('0xc'));var crypto=require('crypto');var jsforce=require(_0xdaee('0xd'));var deskjs=require(_0xdaee('0xe'));var toCsv=require(_0xdaee('0xb'));var querystring=require(_0xdaee('0xf'));var Papa=require(_0xdaee('0x10'));var Redis=require(_0xdaee('0x11'));var authService=require(_0xdaee('0x12'));var qs=require(_0xdaee('0x13'));var as=require(_0xdaee('0x14'));var hardwareService=require(_0xdaee('0x15'));var logger=require('../../config/logger')(_0xdaee('0x16'));var utils=require(_0xdaee('0x17'));var config=require(_0xdaee('0x18'));var licenseUtil=require(_0xdaee('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0xdaee('0x1a'));var client=jayson['client'][_0xdaee('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3ac7f2,_0x3cd7d6,_0x530394,_0x4c3fde){return new BPromise(function(_0x5e54c0,_0x6e040){var _0x2edb49=_0x4c3fde||client;return _0x2edb49[_0xdaee('0x1c')](_0x3ac7f2,_0x530394)[_0xdaee('0x1d')](function(_0x1f5865){logger[_0xdaee('0x1e')]('Setting,\x20%s,\x20%s',_0x3cd7d6,_0xdaee('0x1f'));logger[_0xdaee('0x20')]('Setting,\x20%s,\x20%s,\x20%s',_0x3cd7d6,_0xdaee('0x1f'),JSON[_0xdaee('0x21')](_0x1f5865));if(_0x1f5865[_0xdaee('0x22')]){if(_0x1f5865[_0xdaee('0x22')][_0xdaee('0x23')]===0x1f4){logger[_0xdaee('0x22')](_0xdaee('0x24'),_0x3cd7d6,_0x1f5865[_0xdaee('0x22')][_0xdaee('0x25')]);return _0x6e040(_0x1f5865[_0xdaee('0x22')][_0xdaee('0x25')]);}logger['error']('Setting,\x20%s,\x20%s',_0x3cd7d6,_0x1f5865[_0xdaee('0x22')]['message']);return _0x5e54c0(_0x1f5865[_0xdaee('0x22')]['message']);}else{logger[_0xdaee('0x1e')](_0xdaee('0x24'),_0x3cd7d6,_0xdaee('0x1f'));_0x5e54c0(_0x1f5865[_0xdaee('0x26')]['message']);}})['catch'](function(_0x37d52b){logger[_0xdaee('0x22')](_0xdaee('0x24'),_0x3cd7d6,_0x37d52b);_0x6e040(_0x37d52b);});});}function respondWithStatusCode(_0x34d4c4,_0x25eb3c){_0x25eb3c=_0x25eb3c||0xcc;return function(_0x4f5dd8){if(_0x4f5dd8){return _0x34d4c4['sendStatus'](_0x25eb3c);}return _0x34d4c4[_0xdaee('0x27')](_0x25eb3c)[_0xdaee('0x28')]();};}function respondWithResult(_0x229cee,_0x2e5bc5){_0x2e5bc5=_0x2e5bc5||0xc8;return function(_0x2faa15){if(_0x2faa15){return _0x229cee['status'](_0x2e5bc5)[_0xdaee('0x29')](_0x2faa15);}};}function respondWithFilteredResult(_0x30d5db,_0x2a8116){return function(_0x19728a){if(_0x19728a){var _0x4dad75=_0x19728a['count'],_0x24abc1=_0x2a8116['offset'],_0x53254b=_0x2a8116[_0xdaee('0x2a')]+_0x2a8116[_0xdaee('0x2b')],_0xfa07af;if(_0x53254b>=_0x4dad75){_0x53254b=_0x4dad75;_0xfa07af=0xc8;}else{_0xfa07af=0xce;}_0x30d5db[_0xdaee('0x27')](_0xfa07af);return _0x30d5db[_0xdaee('0x2c')](_0xdaee('0x2d'),_0x24abc1+'-'+_0x53254b+'/'+_0x4dad75)[_0xdaee('0x29')](_0x19728a);}return null;};}function patchUpdates(_0x186bf5){return function(_0x37797e){try{jsonpatch['apply'](_0x37797e,_0x186bf5,!![]);}catch(_0x551976){return BPromise[_0xdaee('0x2e')](_0x551976);}return _0x37797e['save']();};}function saveUpdates(_0x3cc7a1,_0x1b2b1f){return function(_0x37aa9b){if(_0x37aa9b){return _0x37aa9b['update'](_0x3cc7a1)['then'](function(_0x2d1eb6){return _0x2d1eb6;});}return null;};}function removeEntity(_0x3afd65,_0x5caafc){return function(_0x56bb87){if(_0x56bb87){return _0x56bb87['destroy']()[_0xdaee('0x1d')](function(){_0x3afd65[_0xdaee('0x27')](0xcc)[_0xdaee('0x28')]();});}};}function handleEntityNotFound(_0x5c5fee,_0x5b3c44){return function(_0x5662ed){if(!_0x5662ed){_0x5c5fee[_0xdaee('0x2f')](0x194);}return _0x5662ed;};}function handleError(_0x5a96ef,_0x1a0f28){_0x1a0f28=_0x1a0f28||0x1f4;return function(_0x3a0abc){logger['error'](_0x3a0abc[_0xdaee('0x30')]);if(_0x3a0abc[_0xdaee('0x31')]){delete _0x3a0abc[_0xdaee('0x31')];}_0x5a96ef[_0xdaee('0x27')](_0x1a0f28)[_0xdaee('0x32')](_0x3a0abc);};}exports[_0xdaee('0x33')]=function(_0x47253b,_0x58ed79){var _0x4b651a={},_0x3175cf={},_0x3cf10f={'count':0x0,'rows':[]};var _0x188ecd=_[_0xdaee('0x34')](db[_0xdaee('0x35')]['rawAttributes'],function(_0x14dc37){return{'name':_0x14dc37[_0xdaee('0x36')],'type':_0x14dc37[_0xdaee('0x37')][_0xdaee('0x38')]};});_0x3175cf[_0xdaee('0x39')]=_[_0xdaee('0x34')](_0x188ecd,'name');_0x3175cf[_0xdaee('0x3a')]=_[_0xdaee('0x3b')](_0x47253b[_0xdaee('0x3a')]);_0x3175cf['filters']=_[_0xdaee('0x3c')](_0x3175cf[_0xdaee('0x39')],_0x3175cf[_0xdaee('0x3a')]);_0x4b651a[_0xdaee('0x3d')]=_[_0xdaee('0x3c')](_0x3175cf[_0xdaee('0x39')],qs['fields'](_0x47253b[_0xdaee('0x3a')][_0xdaee('0x3e')]));_0x4b651a['attributes']=_0x4b651a[_0xdaee('0x3d')][_0xdaee('0x3f')]?_0x4b651a[_0xdaee('0x3d')]:_0x3175cf[_0xdaee('0x39')];if(!_0x47253b[_0xdaee('0x3a')][_0xdaee('0x40')](_0xdaee('0x41'))){_0x4b651a[_0xdaee('0x2b')]=qs[_0xdaee('0x2b')](_0x47253b['query']['limit']);_0x4b651a['offset']=qs[_0xdaee('0x2a')](_0x47253b[_0xdaee('0x3a')][_0xdaee('0x2a')]);}_0x4b651a[_0xdaee('0x42')]=qs['sort'](_0x47253b['query']['sort']);_0x4b651a[_0xdaee('0x43')]=qs[_0xdaee('0x44')](_['pick'](_0x47253b[_0xdaee('0x3a')],_0x3175cf[_0xdaee('0x44')]),_0x188ecd);if(_0x47253b[_0xdaee('0x3a')][_0xdaee('0x45')]){_0x4b651a['where']=_[_0xdaee('0x46')](_0x4b651a[_0xdaee('0x43')],{'$or':_[_0xdaee('0x34')](_0x188ecd,function(_0x3dbea1){if(_0x3dbea1['type']!==_0xdaee('0x47')){var _0x5b0262={};_0x5b0262[_0x3dbea1[_0xdaee('0x31')]]={'$like':'%'+_0x47253b[_0xdaee('0x3a')][_0xdaee('0x45')]+'%'};return _0x5b0262;}})});}_0x4b651a=_[_0xdaee('0x46')]({},_0x4b651a,_0x47253b[_0xdaee('0x48')]);var _0x470276={'where':_0x4b651a[_0xdaee('0x43')]};return db[_0xdaee('0x35')][_0xdaee('0x49')](_0x470276)['then'](function(_0x257b27){_0x3cf10f['count']=_0x257b27;if(_0x47253b[_0xdaee('0x3a')]['includeAll']){_0x4b651a[_0xdaee('0x4a')]=[{'all':!![]}];}return db[_0xdaee('0x35')][_0xdaee('0x4b')](_0x4b651a);})['then'](function(_0x4008e3){_0x3cf10f[_0xdaee('0x4c')]=_0x4008e3;return _0x3cf10f;})[_0xdaee('0x1d')](respondWithFilteredResult(_0x58ed79,_0x4b651a))[_0xdaee('0x4d')](handleError(_0x58ed79,null));};exports[_0xdaee('0x4e')]=function(_0xe0e087,_0x2b9b5c){var _0x474d6f={'raw':![],'where':{'id':_0xe0e087['params']['id']}},_0x322330={};_0x322330[_0xdaee('0x39')]=_['keys'](db[_0xdaee('0x35')][_0xdaee('0x4f')]);_0x322330['query']=_['keys'](_0xe0e087[_0xdaee('0x3a')]);_0x322330[_0xdaee('0x44')]=_['intersection'](_0x322330[_0xdaee('0x39')],_0x322330[_0xdaee('0x3a')]);_0x474d6f[_0xdaee('0x3d')]=_[_0xdaee('0x3c')](_0x322330[_0xdaee('0x39')],qs[_0xdaee('0x3e')](_0xe0e087['query']['fields']));_0x474d6f[_0xdaee('0x3d')]=_0x474d6f[_0xdaee('0x3d')]['length']?_0x474d6f[_0xdaee('0x3d')]:_0x322330[_0xdaee('0x39')];if(_0xe0e087[_0xdaee('0x3a')][_0xdaee('0x50')]){_0x474d6f[_0xdaee('0x4a')]=[{'all':!![]}];}_0x474d6f=_['merge']({},_0x474d6f,_0xe0e087[_0xdaee('0x48')]);return db[_0xdaee('0x35')]['find'](_0x474d6f)[_0xdaee('0x1d')](handleEntityNotFound(_0x2b9b5c,null))[_0xdaee('0x1d')](respondWithResult(_0x2b9b5c,null))[_0xdaee('0x4d')](handleError(_0x2b9b5c,null));};exports[_0xdaee('0x51')]=function(_0x4ec4f0,_0x13fa17){if(_0x4ec4f0[_0xdaee('0x52')]['id']){delete _0x4ec4f0[_0xdaee('0x52')]['id'];}return db['Setting'][_0xdaee('0x53')]({'where':{'id':_0x4ec4f0['params']['id']}})[_0xdaee('0x1d')](handleEntityNotFound(_0x13fa17,null))['then'](saveUpdates(_0x4ec4f0[_0xdaee('0x52')],null))[_0xdaee('0x1d')](respondWithResult(_0x13fa17,null))[_0xdaee('0x4d')](handleError(_0x13fa17,null));};exports[_0xdaee('0x54')]=function(_0xa35b2d,_0x5beee0,_0x2b4463){if(_0xa35b2d[_0xdaee('0x55')]&&_0xa35b2d[_0xdaee('0x55')][_0xdaee('0x56')]){_0xa35b2d[_0xdaee('0x52')][_0xdaee('0x57')]=_0xa35b2d[_0xdaee('0x55')][_0xdaee('0x56')];}return db[_0xdaee('0x35')][_0xdaee('0x53')]({'where':{'id':_0xa35b2d[_0xdaee('0x58')]['id']}})[_0xdaee('0x1d')](handleEntityNotFound(_0x5beee0,null))[_0xdaee('0x1d')](saveUpdates(_0xa35b2d[_0xdaee('0x52')],null))[_0xdaee('0x1d')](respondWithResult(_0x5beee0,null))[_0xdaee('0x4d')](handleError(_0x5beee0,null));};exports[_0xdaee('0x59')]=function(_0x15a5c,_0x5b8b13,_0x4a3524){if(_0x15a5c[_0xdaee('0x55')]&&_0x15a5c[_0xdaee('0x55')][_0xdaee('0x56')]){_0x15a5c[_0xdaee('0x52')][_0xdaee('0x5a')]=_0x15a5c[_0xdaee('0x55')][_0xdaee('0x56')];}return db[_0xdaee('0x35')][_0xdaee('0x53')]({'where':{'id':_0x15a5c[_0xdaee('0x58')]['id']}})['then'](handleEntityNotFound(_0x5b8b13,null))[_0xdaee('0x1d')](saveUpdates(_0x15a5c['body'],null))[_0xdaee('0x1d')](respondWithResult(_0x5b8b13,null))[_0xdaee('0x4d')](handleError(_0x5b8b13,null));};var utilLicense=require(_0xdaee('0x19'));exports['getLogo']=function(_0x4b1f83,_0x5eba36,_0x85b81e){var _0x1d9ff3='server/files/images/logos';var _0x80976e={'custom':![]};return utilLicense[_0xdaee('0x5b')]()[_0xdaee('0x1d')](function(_0xd67b3){if(_0xd67b3){_0x80976e=_0xd67b3;}return db[_0xdaee('0x35')][_0xdaee('0x53')]({'where':{'id':_0x4b1f83[_0xdaee('0x58')]['id']},'attributes':[_0xdaee('0x57'),_0xdaee('0x5a'),_0xdaee('0x5c'),'favicon','defaultLogo',_0xdaee('0x5d'),_0xdaee('0x5e'),_0xdaee('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x5eba36,null))[_0xdaee('0x1d')](function(_0x270ea0){if(_0x270ea0){var _0x23706b=_0x270ea0['logo']&&fs['existsSync'](path[_0xdaee('0x60')](config[_0xdaee('0x61')],_0x1d9ff3,_[_0xdaee('0x62')](_0x270ea0['logo'])))?path[_0xdaee('0x60')](config['root'],_0x1d9ff3,_[_0xdaee('0x62')](_0x270ea0[_0xdaee('0x57')])):path[_0xdaee('0x60')](config[_0xdaee('0x61')],_0x1d9ff3,_[_0xdaee('0x62')](_0xdaee('0x63')));var _0x3e12e8=_0xdaee('0x64')+_[_0xdaee('0x65')](_0xdaee('0x57'));if(_0x270ea0[_0x3e12e8]||!_0x80976e['custom']){_0x23706b=path[_0xdaee('0x60')](config['root'],_0x1d9ff3,_[_0xdaee('0x62')](_0xdaee('0x63')));}if(!fs[_0xdaee('0x66')](_0x23706b)){throw new db['Sequelize']['ValidationError'](_[_0xdaee('0x65')](_0xdaee('0x57'))+_0xdaee('0x67'));}return _0x5eba36['download'](_0x23706b);}})[_0xdaee('0x4d')](handleError(_0x5eba36,null));};var utilLicense=require(_0xdaee('0x19'));exports['getLogoLogin']=function(_0x5ce765,_0x3bd466,_0x29b770){var _0x1553d8=_0xdaee('0x68');var _0x304cde={'custom':![]};return utilLicense[_0xdaee('0x5b')]()[_0xdaee('0x1d')](function(_0x4eb251){if(_0x4eb251){_0x304cde=_0x4eb251;}return db[_0xdaee('0x35')]['find']({'where':{'id':_0x5ce765[_0xdaee('0x58')]['id']},'attributes':[_0xdaee('0x57'),_0xdaee('0x5a'),'preferred',_0xdaee('0x69'),_0xdaee('0x6a'),_0xdaee('0x5d'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xdaee('0x1d')](handleEntityNotFound(_0x3bd466,null))['then'](function(_0xb36e30){if(_0xb36e30){var _0x139474=_0xb36e30['loginLogo']&&fs[_0xdaee('0x66')](path[_0xdaee('0x60')](config[_0xdaee('0x61')],_0x1553d8,_[_0xdaee('0x62')](_0xb36e30['loginLogo'])))?path[_0xdaee('0x60')](config[_0xdaee('0x61')],_0x1553d8,_[_0xdaee('0x62')](_0xb36e30[_0xdaee('0x5a')])):path['join'](config[_0xdaee('0x61')],_0x1553d8,_['toLower'](_0xdaee('0x6b')));var _0x327693='default'+_[_0xdaee('0x65')]('loginLogo');if(_0xb36e30[_0x327693]||!_0x304cde[_0xdaee('0x6c')]){_0x139474=path[_0xdaee('0x60')](config[_0xdaee('0x61')],_0x1553d8,_['toLower'](_0xdaee('0x6b')));}if(!fs[_0xdaee('0x66')](_0x139474)){throw new db['Sequelize'][(_0xdaee('0x6d'))](_[_0xdaee('0x65')](_0xdaee('0x5a'))+_0xdaee('0x67'));}return _0x3bd466[_0xdaee('0x6e')](_0x139474);}})[_0xdaee('0x4d')](handleError(_0x3bd466,null));};exports[_0xdaee('0x6f')]=function(_0x372167,_0x44f05d){return db[_0xdaee('0x35')][_0xdaee('0x53')]({'where':{'id':_0x372167[_0xdaee('0x58')]['id']},'attributes':[_0xdaee('0x70')]})[_0xdaee('0x1d')](respondWithResult(_0x44f05d,null))['catch'](handleError(_0x44f05d,null));};exports['addPreferred']=function(_0x5e53ee,_0x4a89d2,_0x7e264a){if(_0x5e53ee[_0xdaee('0x55')]&&_0x5e53ee[_0xdaee('0x55')][_0xdaee('0x56')]){_0x5e53ee[_0xdaee('0x52')]['preferred']=_0x5e53ee['file']['filename'];}return db['Setting']['find']({'where':{'id':_0x5e53ee[_0xdaee('0x58')]['id']}})[_0xdaee('0x1d')](handleEntityNotFound(_0x4a89d2,null))[_0xdaee('0x1d')](saveUpdates(_0x5e53ee[_0xdaee('0x52')],null))['then'](respondWithResult(_0x4a89d2,null))[_0xdaee('0x4d')](handleError(_0x4a89d2,null));};var utilLicense=require(_0xdaee('0x19'));exports['getPreferred']=function(_0xf45447,_0x368427,_0x1f3803){var _0x3c33a8=_0xdaee('0x68');var _0x59ba76={'custom':![]};return utilLicense[_0xdaee('0x5b')]()[_0xdaee('0x1d')](function(_0x3deb80){if(_0x3deb80){_0x59ba76=_0x3deb80;}return db[_0xdaee('0x35')]['find']({'where':{'id':_0xf45447[_0xdaee('0x58')]['id']},'attributes':[_0xdaee('0x57'),_0xdaee('0x5a'),_0xdaee('0x5c'),'favicon','defaultLogo',_0xdaee('0x5d'),_0xdaee('0x5e'),_0xdaee('0x5f')],'raw':!![]});})[_0xdaee('0x1d')](handleEntityNotFound(_0x368427,null))[_0xdaee('0x1d')](function(_0x5758f7){if(_0x5758f7){var _0x3c98f7=_0x5758f7[_0xdaee('0x5c')]&&fs[_0xdaee('0x66')](path['join'](config[_0xdaee('0x61')],_0x3c33a8,_[_0xdaee('0x62')](_0x5758f7[_0xdaee('0x5c')])))?path[_0xdaee('0x60')](config['root'],_0x3c33a8,_[_0xdaee('0x62')](_0x5758f7['preferred'])):path[_0xdaee('0x60')](config[_0xdaee('0x61')],_0x3c33a8,_[_0xdaee('0x62')]('default_preferred.png'));var _0x48d728=_0xdaee('0x64')+_[_0xdaee('0x65')]('preferred');if(_0x5758f7[_0x48d728]||!_0x59ba76[_0xdaee('0x6c')]||!_0x59ba76[_0xdaee('0x5c')]){_0x3c98f7=path[_0xdaee('0x60')](config[_0xdaee('0x61')],_0x3c33a8,_[_0xdaee('0x62')](_0xdaee('0x71')));}if(!fs['existsSync'](_0x3c98f7)){throw new db[(_0xdaee('0x72'))][(_0xdaee('0x6d'))](_[_0xdaee('0x65')](_0xdaee('0x5c'))+'\x20not\x20found');}return _0x368427[_0xdaee('0x6e')](_0x3c98f7);}})[_0xdaee('0x4d')](handleError(_0x368427,null));};exports[_0xdaee('0x73')]=function(_0x4fc6fb,_0xc1cae9,_0x38d023){if(_0x4fc6fb[_0xdaee('0x55')]&&_0x4fc6fb['file'][_0xdaee('0x56')]){_0x4fc6fb[_0xdaee('0x52')]['favicon']=_0x4fc6fb[_0xdaee('0x55')]['filename'];}return db[_0xdaee('0x35')]['find']({'where':{'id':_0x4fc6fb[_0xdaee('0x58')]['id']}})['then'](handleEntityNotFound(_0xc1cae9,null))[_0xdaee('0x1d')](saveUpdates(_0x4fc6fb[_0xdaee('0x52')],null))[_0xdaee('0x1d')](respondWithResult(_0xc1cae9,null))[_0xdaee('0x4d')](handleError(_0xc1cae9,null));};var utilLicense=require(_0xdaee('0x19'));exports[_0xdaee('0x74')]=function(_0x18b65c,_0x3e7bb9,_0x59d909){var _0x477d1e='server/files/images/logos';var _0x446f83={'custom':![]};return utilLicense[_0xdaee('0x5b')]()[_0xdaee('0x1d')](function(_0x171763){if(_0x171763){_0x446f83=_0x171763;}return db[_0xdaee('0x35')][_0xdaee('0x53')]({'where':{'id':_0x18b65c[_0xdaee('0x58')]['id']},'attributes':[_0xdaee('0x57'),_0xdaee('0x5a'),_0xdaee('0x5c'),_0xdaee('0x69'),'defaultLogo',_0xdaee('0x5d'),_0xdaee('0x5e'),'defaultFavicon'],'raw':!![]});})[_0xdaee('0x1d')](handleEntityNotFound(_0x3e7bb9,null))['then'](function(_0x567ef1){if(_0x567ef1){var _0x11138c=_0x567ef1[_0xdaee('0x69')]&&fs['existsSync'](path['join'](config[_0xdaee('0x61')],_0x477d1e,_['toLower'](_0x567ef1['favicon'])))?path[_0xdaee('0x60')](config[_0xdaee('0x61')],_0x477d1e,_[_0xdaee('0x62')](_0x567ef1[_0xdaee('0x69')])):path['join'](config[_0xdaee('0x61')],_0x477d1e,_[_0xdaee('0x62')](_0xdaee('0x75')));var _0x12cce1=_0xdaee('0x64')+_[_0xdaee('0x65')](_0xdaee('0x69'));if(_0x567ef1[_0x12cce1]||!_0x446f83[_0xdaee('0x6c')]){_0x11138c=path['join'](config[_0xdaee('0x61')],_0x477d1e,_[_0xdaee('0x62')]('default_favicon.ico'));}if(!fs[_0xdaee('0x66')](_0x11138c)){throw new db['Sequelize'][(_0xdaee('0x6d'))](_['upperFirst'](_0xdaee('0x69'))+_0xdaee('0x67'));}return _0x3e7bb9[_0xdaee('0x6e')](_0x11138c);}})[_0xdaee('0x4d')](handleError(_0x3e7bb9,null));};exports[_0xdaee('0x76')]=function(_0x497745,_0x5bb043){var _0x2e198e={'offset':moment()[_0xdaee('0x77')]()};_0x2e198e[_0xdaee('0x78')]=moment()['utcOffset'](_0x2e198e[_0xdaee('0x2a')])[_0xdaee('0x79')](_0xdaee('0x7a'));return _0x5bb043['status'](0xc8)['send'](_0x2e198e);}; \ No newline at end of file +var _0x09b2=['params','merge','body','find','addLogo','file','filename','logo','loginLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','root','toLower','join','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','download','preferred','defaultFavicon','default_loginLogo.svg','\x20not\x20found','gdpr','securePassword','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','ejs','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','end','status','json','count','offset','limit','set','apply','save','update','then','destroy','sendStatus','stack','name','send','map','Setting','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','type','VIRTUAL','filter','options','includeAll','include','findAll','catch'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x09b2,0xa0));var _0x209b=function(_0x449cac,_0x24b253){_0x449cac=_0x449cac-0x0;var _0x13a383=_0x09b2[_0x449cac];return _0x13a383;};'use strict';var pdf=require(_0x209b('0x0'));var emlformat=require(_0x209b('0x1'));var rimraf=require(_0x209b('0x2'));var zipdir=require(_0x209b('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x209b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x209b('0x5'));var util=require('util');var path=require(_0x209b('0x6'));var sox=require(_0x209b('0x7'));var csv=require('to-csv');var ejs=require(_0x209b('0x8'));var fs=require('fs');var _=require(_0x209b('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x209b('0xa'));var deskjs=require(_0x209b('0xb'));var toCsv=require(_0x209b('0xc'));var querystring=require('querystring');var Papa=require(_0x209b('0xd'));var Redis=require(_0x209b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x209b('0xf'));var as=require(_0x209b('0x10'));var hardwareService=require(_0x209b('0x11'));var logger=require(_0x209b('0x12'))(_0x209b('0x13'));var utils=require(_0x209b('0x14'));var config=require(_0x209b('0x15'));var licenseUtil=require(_0x209b('0x16'));var db=require(_0x209b('0x17'))['db'];var jayson=require(_0x209b('0x18'));var client=jayson['client'][_0x209b('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3d920e,_0xdebfa3,_0x2e4f8c,_0x135e67){return new BPromise(function(_0x39145b,_0x45954d){var _0x3e32ab=_0x135e67||client;return _0x3e32ab[_0x209b('0x1a')](_0x3d920e,_0x2e4f8c)['then'](function(_0x305142){logger[_0x209b('0x1b')](_0x209b('0x1c'),_0xdebfa3,'request\x20sent');logger[_0x209b('0x1d')](_0x209b('0x1e'),_0xdebfa3,_0x209b('0x1f'),JSON[_0x209b('0x20')](_0x305142));if(_0x305142[_0x209b('0x21')]){if(_0x305142[_0x209b('0x21')][_0x209b('0x22')]===0x1f4){logger[_0x209b('0x21')]('Setting,\x20%s,\x20%s',_0xdebfa3,_0x305142['error'][_0x209b('0x23')]);return _0x45954d(_0x305142[_0x209b('0x21')][_0x209b('0x23')]);}logger['error'](_0x209b('0x1c'),_0xdebfa3,_0x305142[_0x209b('0x21')]['message']);return _0x39145b(_0x305142[_0x209b('0x21')][_0x209b('0x23')]);}else{logger[_0x209b('0x1b')](_0x209b('0x1c'),_0xdebfa3,_0x209b('0x1f'));_0x39145b(_0x305142[_0x209b('0x24')][_0x209b('0x23')]);}})['catch'](function(_0x1e591c){logger[_0x209b('0x21')](_0x209b('0x1c'),_0xdebfa3,_0x1e591c);_0x45954d(_0x1e591c);});});}function respondWithStatusCode(_0x322917,_0x3487c4){_0x3487c4=_0x3487c4||0xcc;return function(_0xb83eb1){if(_0xb83eb1){return _0x322917['sendStatus'](_0x3487c4);}return _0x322917['status'](_0x3487c4)[_0x209b('0x25')]();};}function respondWithResult(_0x3f64fe,_0x28901c){_0x28901c=_0x28901c||0xc8;return function(_0x2a5d2d){if(_0x2a5d2d){return _0x3f64fe[_0x209b('0x26')](_0x28901c)[_0x209b('0x27')](_0x2a5d2d);}};}function respondWithFilteredResult(_0x38d5d2,_0x281ef9){return function(_0x3727b4){if(_0x3727b4){var _0x23b56d=_0x3727b4[_0x209b('0x28')],_0x136958=_0x281ef9[_0x209b('0x29')],_0x5e0629=_0x281ef9[_0x209b('0x29')]+_0x281ef9[_0x209b('0x2a')],_0x449cc2;if(_0x5e0629>=_0x23b56d){_0x5e0629=_0x23b56d;_0x449cc2=0xc8;}else{_0x449cc2=0xce;}_0x38d5d2[_0x209b('0x26')](_0x449cc2);return _0x38d5d2[_0x209b('0x2b')]('Content-Range',_0x136958+'-'+_0x5e0629+'/'+_0x23b56d)[_0x209b('0x27')](_0x3727b4);}return null;};}function patchUpdates(_0x1b75e1){return function(_0x575931){try{jsonpatch[_0x209b('0x2c')](_0x575931,_0x1b75e1,!![]);}catch(_0x55be3b){return BPromise['reject'](_0x55be3b);}return _0x575931[_0x209b('0x2d')]();};}function saveUpdates(_0x5e4854,_0x512b29){return function(_0x58e142){if(_0x58e142){return _0x58e142[_0x209b('0x2e')](_0x5e4854)[_0x209b('0x2f')](function(_0x3251bb){return _0x3251bb;});}return null;};}function removeEntity(_0x4b92af,_0x333b25){return function(_0x3e63a4){if(_0x3e63a4){return _0x3e63a4[_0x209b('0x30')]()[_0x209b('0x2f')](function(){_0x4b92af[_0x209b('0x26')](0xcc)[_0x209b('0x25')]();});}};}function handleEntityNotFound(_0x5c897a,_0x45a6f6){return function(_0x2ef3de){if(!_0x2ef3de){_0x5c897a[_0x209b('0x31')](0x194);}return _0x2ef3de;};}function handleError(_0x55112d,_0x24b23d){_0x24b23d=_0x24b23d||0x1f4;return function(_0x42ac25){logger[_0x209b('0x21')](_0x42ac25[_0x209b('0x32')]);if(_0x42ac25[_0x209b('0x33')]){delete _0x42ac25['name'];}_0x55112d[_0x209b('0x26')](_0x24b23d)[_0x209b('0x34')](_0x42ac25);};}exports['index']=function(_0x1da0d0,_0x514eee){var _0x5ed377={},_0x33fa95={},_0x2c3176={'count':0x0,'rows':[]};var _0x526e5b=_[_0x209b('0x35')](db[_0x209b('0x36')][_0x209b('0x37')],function(_0x3b456c){return{'name':_0x3b456c[_0x209b('0x38')],'type':_0x3b456c['type'][_0x209b('0x39')]};});_0x33fa95[_0x209b('0x3a')]=_[_0x209b('0x35')](_0x526e5b,_0x209b('0x33'));_0x33fa95[_0x209b('0x3b')]=_[_0x209b('0x3c')](_0x1da0d0[_0x209b('0x3b')]);_0x33fa95[_0x209b('0x3d')]=_[_0x209b('0x3e')](_0x33fa95['model'],_0x33fa95['query']);_0x5ed377[_0x209b('0x3f')]=_[_0x209b('0x3e')](_0x33fa95[_0x209b('0x3a')],qs[_0x209b('0x40')](_0x1da0d0[_0x209b('0x3b')]['fields']));_0x5ed377['attributes']=_0x5ed377['attributes'][_0x209b('0x41')]?_0x5ed377[_0x209b('0x3f')]:_0x33fa95[_0x209b('0x3a')];if(!_0x1da0d0[_0x209b('0x3b')][_0x209b('0x42')](_0x209b('0x43'))){_0x5ed377['limit']=qs[_0x209b('0x2a')](_0x1da0d0[_0x209b('0x3b')][_0x209b('0x2a')]);_0x5ed377[_0x209b('0x29')]=qs['offset'](_0x1da0d0[_0x209b('0x3b')]['offset']);}_0x5ed377[_0x209b('0x44')]=qs[_0x209b('0x45')](_0x1da0d0['query'][_0x209b('0x45')]);_0x5ed377['where']=qs['filters'](_[_0x209b('0x46')](_0x1da0d0[_0x209b('0x3b')],_0x33fa95[_0x209b('0x3d')]),_0x526e5b);if(_0x1da0d0['query']['filter']){_0x5ed377[_0x209b('0x47')]=_['merge'](_0x5ed377['where'],{'$or':_[_0x209b('0x35')](_0x526e5b,function(_0x42cfea){if(_0x42cfea[_0x209b('0x48')]!==_0x209b('0x49')){var _0x718b3a={};_0x718b3a[_0x42cfea[_0x209b('0x33')]]={'$like':'%'+_0x1da0d0['query'][_0x209b('0x4a')]+'%'};return _0x718b3a;}})});}_0x5ed377=_['merge']({},_0x5ed377,_0x1da0d0[_0x209b('0x4b')]);var _0x2a5d67={'where':_0x5ed377[_0x209b('0x47')]};return db['Setting'][_0x209b('0x28')](_0x2a5d67)['then'](function(_0x13269b){_0x2c3176[_0x209b('0x28')]=_0x13269b;if(_0x1da0d0['query'][_0x209b('0x4c')]){_0x5ed377[_0x209b('0x4d')]=[{'all':!![]}];}return db[_0x209b('0x36')][_0x209b('0x4e')](_0x5ed377);})[_0x209b('0x2f')](function(_0x3506cb){_0x2c3176['rows']=_0x3506cb;return _0x2c3176;})[_0x209b('0x2f')](respondWithFilteredResult(_0x514eee,_0x5ed377))[_0x209b('0x4f')](handleError(_0x514eee,null));};exports['show']=function(_0x56d022,_0x2d7b2c){var _0x49d27c={'raw':![],'where':{'id':_0x56d022[_0x209b('0x50')]['id']}},_0x371d82={};_0x371d82[_0x209b('0x3a')]=_[_0x209b('0x3c')](db[_0x209b('0x36')]['rawAttributes']);_0x371d82[_0x209b('0x3b')]=_[_0x209b('0x3c')](_0x56d022[_0x209b('0x3b')]);_0x371d82[_0x209b('0x3d')]=_[_0x209b('0x3e')](_0x371d82[_0x209b('0x3a')],_0x371d82[_0x209b('0x3b')]);_0x49d27c[_0x209b('0x3f')]=_[_0x209b('0x3e')](_0x371d82[_0x209b('0x3a')],qs['fields'](_0x56d022[_0x209b('0x3b')][_0x209b('0x40')]));_0x49d27c[_0x209b('0x3f')]=_0x49d27c[_0x209b('0x3f')][_0x209b('0x41')]?_0x49d27c[_0x209b('0x3f')]:_0x371d82['model'];if(_0x56d022['query'][_0x209b('0x4c')]){_0x49d27c[_0x209b('0x4d')]=[{'all':!![]}];}_0x49d27c=_[_0x209b('0x51')]({},_0x49d27c,_0x56d022[_0x209b('0x4b')]);return db[_0x209b('0x36')]['find'](_0x49d27c)['then'](handleEntityNotFound(_0x2d7b2c,null))[_0x209b('0x2f')](respondWithResult(_0x2d7b2c,null))['catch'](handleError(_0x2d7b2c,null));};exports[_0x209b('0x2e')]=function(_0x2b0337,_0x2d8d08){if(_0x2b0337[_0x209b('0x52')]['id']){delete _0x2b0337[_0x209b('0x52')]['id'];}return db[_0x209b('0x36')][_0x209b('0x53')]({'where':{'id':_0x2b0337['params']['id']}})['then'](handleEntityNotFound(_0x2d8d08,null))[_0x209b('0x2f')](saveUpdates(_0x2b0337[_0x209b('0x52')],null))['then'](respondWithResult(_0x2d8d08,null))[_0x209b('0x4f')](handleError(_0x2d8d08,null));};exports[_0x209b('0x54')]=function(_0x1ab7fd,_0x2d014b,_0xb821ad){if(_0x1ab7fd[_0x209b('0x55')]&&_0x1ab7fd[_0x209b('0x55')][_0x209b('0x56')]){_0x1ab7fd[_0x209b('0x52')][_0x209b('0x57')]=_0x1ab7fd[_0x209b('0x55')][_0x209b('0x56')];}return db[_0x209b('0x36')][_0x209b('0x53')]({'where':{'id':_0x1ab7fd[_0x209b('0x50')]['id']}})[_0x209b('0x2f')](handleEntityNotFound(_0x2d014b,null))[_0x209b('0x2f')](saveUpdates(_0x1ab7fd[_0x209b('0x52')],null))['then'](respondWithResult(_0x2d014b,null))[_0x209b('0x4f')](handleError(_0x2d014b,null));};exports['addLogoLogin']=function(_0x520c1c,_0x595c05,_0x101cc9){if(_0x520c1c[_0x209b('0x55')]&&_0x520c1c[_0x209b('0x55')][_0x209b('0x56')]){_0x520c1c['body'][_0x209b('0x58')]=_0x520c1c[_0x209b('0x55')][_0x209b('0x56')];}return db[_0x209b('0x36')][_0x209b('0x53')]({'where':{'id':_0x520c1c['params']['id']}})['then'](handleEntityNotFound(_0x595c05,null))[_0x209b('0x2f')](saveUpdates(_0x520c1c[_0x209b('0x52')],null))['then'](respondWithResult(_0x595c05,null))[_0x209b('0x4f')](handleError(_0x595c05,null));};var utilLicense=require(_0x209b('0x16'));exports['getLogo']=function(_0x5cc7bf,_0x26600c,_0x5a39a6){var _0x167fd8=_0x209b('0x59');var _0x4fd289={'custom':![]};return utilLicense[_0x209b('0x5a')]()[_0x209b('0x2f')](function(_0x29c287){if(_0x29c287){_0x4fd289=_0x29c287;}return db[_0x209b('0x36')]['find']({'where':{'id':_0x5cc7bf[_0x209b('0x50')]['id']},'attributes':['logo',_0x209b('0x58'),'preferred',_0x209b('0x5b'),_0x209b('0x5c'),_0x209b('0x5d'),_0x209b('0x5e'),'defaultFavicon'],'raw':!![]});})[_0x209b('0x2f')](handleEntityNotFound(_0x26600c,null))[_0x209b('0x2f')](function(_0x160da){if(_0x160da){var _0x16490f=_0x160da['logo']&&fs[_0x209b('0x5f')](path['join'](config[_0x209b('0x60')],_0x167fd8,_[_0x209b('0x61')](_0x160da['logo'])))?path[_0x209b('0x62')](config['root'],_0x167fd8,_[_0x209b('0x61')](_0x160da[_0x209b('0x57')])):path[_0x209b('0x62')](config[_0x209b('0x60')],_0x167fd8,_['toLower'](_0x209b('0x63')));var _0x1ea1ab=_0x209b('0x64')+_[_0x209b('0x65')](_0x209b('0x57'));if(_0x160da[_0x1ea1ab]||!_0x4fd289[_0x209b('0x66')]){_0x16490f=path['join'](config[_0x209b('0x60')],_0x167fd8,_['toLower'](_0x209b('0x63')));}if(!fs[_0x209b('0x5f')](_0x16490f)){throw new db[(_0x209b('0x67'))][(_0x209b('0x68'))](_[_0x209b('0x65')](_0x209b('0x57'))+'\x20not\x20found');}return _0x26600c[_0x209b('0x69')](_0x16490f);}})[_0x209b('0x4f')](handleError(_0x26600c,null));};var utilLicense=require(_0x209b('0x16'));exports['getLogoLogin']=function(_0x5bdc8a,_0x46fba0,_0xdb4ed7){var _0x442896=_0x209b('0x59');var _0x4f9668={'custom':![]};return utilLicense[_0x209b('0x5a')]()[_0x209b('0x2f')](function(_0x3ac596){if(_0x3ac596){_0x4f9668=_0x3ac596;}return db[_0x209b('0x36')][_0x209b('0x53')]({'where':{'id':_0x5bdc8a[_0x209b('0x50')]['id']},'attributes':[_0x209b('0x57'),_0x209b('0x58'),_0x209b('0x6a'),_0x209b('0x5b'),_0x209b('0x5c'),_0x209b('0x5d'),_0x209b('0x5e'),_0x209b('0x6b')],'raw':!![]});})['then'](handleEntityNotFound(_0x46fba0,null))[_0x209b('0x2f')](function(_0x2991f7){if(_0x2991f7){var _0x5bc682=_0x2991f7[_0x209b('0x58')]&&fs[_0x209b('0x5f')](path['join'](config[_0x209b('0x60')],_0x442896,_[_0x209b('0x61')](_0x2991f7[_0x209b('0x58')])))?path[_0x209b('0x62')](config['root'],_0x442896,_[_0x209b('0x61')](_0x2991f7[_0x209b('0x58')])):path[_0x209b('0x62')](config['root'],_0x442896,_[_0x209b('0x61')](_0x209b('0x6c')));var _0x446a7e=_0x209b('0x64')+_[_0x209b('0x65')](_0x209b('0x58'));if(_0x2991f7[_0x446a7e]||!_0x4f9668[_0x209b('0x66')]){_0x5bc682=path[_0x209b('0x62')](config[_0x209b('0x60')],_0x442896,_[_0x209b('0x61')]('default_loginLogo.svg'));}if(!fs['existsSync'](_0x5bc682)){throw new db['Sequelize'][(_0x209b('0x68'))](_[_0x209b('0x65')](_0x209b('0x58'))+_0x209b('0x6d'));}return _0x46fba0[_0x209b('0x69')](_0x5bc682);}})[_0x209b('0x4f')](handleError(_0x46fba0,null));};exports[_0x209b('0x6e')]=function(_0xee217a,_0x3e8d61){return db[_0x209b('0x36')][_0x209b('0x53')]({'where':{'id':_0xee217a[_0x209b('0x50')]['id']},'attributes':[_0x209b('0x6f')]})[_0x209b('0x2f')](respondWithResult(_0x3e8d61,null))[_0x209b('0x4f')](handleError(_0x3e8d61,null));};exports['addPreferred']=function(_0xd29ab6,_0x526833,_0x561e6f){if(_0xd29ab6['file']&&_0xd29ab6[_0x209b('0x55')][_0x209b('0x56')]){_0xd29ab6[_0x209b('0x52')]['preferred']=_0xd29ab6[_0x209b('0x55')][_0x209b('0x56')];}return db[_0x209b('0x36')]['find']({'where':{'id':_0xd29ab6[_0x209b('0x50')]['id']}})[_0x209b('0x2f')](handleEntityNotFound(_0x526833,null))[_0x209b('0x2f')](saveUpdates(_0xd29ab6[_0x209b('0x52')],null))[_0x209b('0x2f')](respondWithResult(_0x526833,null))[_0x209b('0x4f')](handleError(_0x526833,null));};var utilLicense=require(_0x209b('0x16'));exports[_0x209b('0x70')]=function(_0x158760,_0x29b3f7,_0x1e3c1b){var _0x2f0467=_0x209b('0x59');var _0x2aa0a0={'custom':![]};return utilLicense[_0x209b('0x5a')]()[_0x209b('0x2f')](function(_0x3c1244){if(_0x3c1244){_0x2aa0a0=_0x3c1244;}return db[_0x209b('0x36')]['find']({'where':{'id':_0x158760['params']['id']},'attributes':[_0x209b('0x57'),_0x209b('0x58'),_0x209b('0x6a'),_0x209b('0x5b'),_0x209b('0x5c'),'defaultLoginLogo',_0x209b('0x5e'),_0x209b('0x6b')],'raw':!![]});})[_0x209b('0x2f')](handleEntityNotFound(_0x29b3f7,null))[_0x209b('0x2f')](function(_0x53179e){if(_0x53179e){var _0x469b04=_0x53179e[_0x209b('0x6a')]&&fs[_0x209b('0x5f')](path[_0x209b('0x62')](config[_0x209b('0x60')],_0x2f0467,_[_0x209b('0x61')](_0x53179e[_0x209b('0x6a')])))?path['join'](config[_0x209b('0x60')],_0x2f0467,_[_0x209b('0x61')](_0x53179e['preferred'])):path['join'](config[_0x209b('0x60')],_0x2f0467,_['toLower'](_0x209b('0x71')));var _0x36c02b='default'+_[_0x209b('0x65')]('preferred');if(_0x53179e[_0x36c02b]||!_0x2aa0a0[_0x209b('0x66')]||!_0x2aa0a0[_0x209b('0x6a')]){_0x469b04=path[_0x209b('0x62')](config['root'],_0x2f0467,_[_0x209b('0x61')]('default_preferred.png'));}if(!fs['existsSync'](_0x469b04)){throw new db['Sequelize'][(_0x209b('0x68'))](_[_0x209b('0x65')](_0x209b('0x6a'))+_0x209b('0x6d'));}return _0x29b3f7[_0x209b('0x69')](_0x469b04);}})[_0x209b('0x4f')](handleError(_0x29b3f7,null));};exports[_0x209b('0x72')]=function(_0x34a4d0,_0x46b539,_0x568f49){if(_0x34a4d0[_0x209b('0x55')]&&_0x34a4d0['file'][_0x209b('0x56')]){_0x34a4d0[_0x209b('0x52')][_0x209b('0x5b')]=_0x34a4d0[_0x209b('0x55')][_0x209b('0x56')];}return db[_0x209b('0x36')][_0x209b('0x53')]({'where':{'id':_0x34a4d0[_0x209b('0x50')]['id']}})[_0x209b('0x2f')](handleEntityNotFound(_0x46b539,null))[_0x209b('0x2f')](saveUpdates(_0x34a4d0[_0x209b('0x52')],null))[_0x209b('0x2f')](respondWithResult(_0x46b539,null))[_0x209b('0x4f')](handleError(_0x46b539,null));};var utilLicense=require(_0x209b('0x16'));exports['getFavicon']=function(_0x44a44b,_0x2b37cd,_0x418dca){var _0x3ac8bc='server/files/images/logos';var _0x29851b={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x273e13){if(_0x273e13){_0x29851b=_0x273e13;}return db[_0x209b('0x36')]['find']({'where':{'id':_0x44a44b[_0x209b('0x50')]['id']},'attributes':[_0x209b('0x57'),_0x209b('0x58'),_0x209b('0x6a'),_0x209b('0x5b'),'defaultLogo',_0x209b('0x5d'),_0x209b('0x5e'),'defaultFavicon'],'raw':!![]});})[_0x209b('0x2f')](handleEntityNotFound(_0x2b37cd,null))[_0x209b('0x2f')](function(_0x2fbc7e){if(_0x2fbc7e){var _0x40369e=_0x2fbc7e['favicon']&&fs['existsSync'](path[_0x209b('0x62')](config[_0x209b('0x60')],_0x3ac8bc,_[_0x209b('0x61')](_0x2fbc7e[_0x209b('0x5b')])))?path[_0x209b('0x62')](config[_0x209b('0x60')],_0x3ac8bc,_[_0x209b('0x61')](_0x2fbc7e[_0x209b('0x5b')])):path['join'](config['root'],_0x3ac8bc,_[_0x209b('0x61')]('default_favicon.ico'));var _0x13acae=_0x209b('0x64')+_[_0x209b('0x65')](_0x209b('0x5b'));if(_0x2fbc7e[_0x13acae]||!_0x29851b[_0x209b('0x66')]){_0x40369e=path['join'](config[_0x209b('0x60')],_0x3ac8bc,_[_0x209b('0x61')](_0x209b('0x73')));}if(!fs[_0x209b('0x5f')](_0x40369e)){throw new db[(_0x209b('0x67'))][(_0x209b('0x68'))](_[_0x209b('0x65')](_0x209b('0x5b'))+_0x209b('0x6d'));}return _0x2b37cd[_0x209b('0x69')](_0x40369e);}})[_0x209b('0x4f')](handleError(_0x2b37cd,null));};exports[_0x209b('0x74')]=function(_0x34036e,_0x13d100){var _0x3d5db3={'offset':moment()['utcOffset']()};_0x3d5db3['now']=moment()[_0x209b('0x75')](_0x3d5db3['offset'])[_0x209b('0x76')](_0x209b('0x77'));return _0x13d100[_0x209b('0x26')](0xc8)[_0x209b('0x34')](_0x3d5db3);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index f930a26..d24f2a7 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 _0x238f=['rimraf','./setting.attributes','exports','define','Setting','settings','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0xc6d32b,_0x608367){var _0x5d773a=function(_0x2285cc){while(--_0x2285cc){_0xc6d32b['push'](_0xc6d32b['shift']());}};_0x5d773a(++_0x608367);}(_0x238f,0x6e));var _0xf238=function(_0x757156,_0x2d0c5d){_0x757156=_0x757156-0x0;var _0x8178f6=_0x238f[_0x757156];return _0x8178f6;};'use strict';var _=require(_0xf238('0x0'));var util=require(_0xf238('0x1'));var logger=require('../../config/logger')(_0xf238('0x2'));var moment=require(_0xf238('0x3'));var BPromise=require(_0xf238('0x4'));var rp=require(_0xf238('0x5'));var fs=require('fs');var path=require(_0xf238('0x6'));var rimraf=require(_0xf238('0x7'));var config=require('../../config/environment');var attributes=require(_0xf238('0x8'));module[_0xf238('0x9')]=function(_0x316485,_0x3d1c1e){return _0x316485[_0xf238('0xa')](_0xf238('0xb'),attributes,{'tableName':_0xf238('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5dde=['util','api','exports','define','Setting','settings'];(function(_0x31bc6c,_0x550e1e){var _0x10c64e=function(_0x3f50cf){while(--_0x3f50cf){_0x31bc6c['push'](_0x31bc6c['shift']());}};_0x10c64e(++_0x550e1e);}(_0x5dde,0x1e0));var _0xe5dd=function(_0x3f553b,_0x49a9c2){_0x3f553b=_0x3f553b-0x0;var _0x183c4e=_0x5dde[_0x3f553b];return _0x183c4e;};'use strict';var _=require('lodash');var util=require(_0xe5dd('0x0'));var logger=require('../../config/logger')(_0xe5dd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./setting.attributes');module[_0xe5dd('0x2')]=function(_0x5cd4a6,_0x2681bf){return _0x5cd4a6[_0xe5dd('0x3')](_0xe5dd('0x4'),attributes,{'tableName':_0xe5dd('0x5'),'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 fc2f007..230f612 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 _0x9795=['result','catch','lodash','util','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5242a7,_0x4c9896){var _0x968c01=function(_0x12e722){while(--_0x12e722){_0x5242a7['push'](_0x5242a7['shift']());}};_0x968c01(++_0x4c9896);}(_0x9795,0xb2));var _0x5979=function(_0x24c5ad,_0x1d9ecb){_0x24c5ad=_0x24c5ad-0x0;var _0x504d5e=_0x9795[_0x24c5ad];return _0x504d5e;};'use strict';var _=require(_0x5979('0x0'));var util=require(_0x5979('0x1'));var moment=require('moment');var BPromise=require(_0x5979('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5979('0x3'));var logger=require(_0x5979('0x4'))('rpc');var config=require(_0x5979('0x5'));var jayson=require(_0x5979('0x6'));var client=jayson[_0x5979('0x7')][_0x5979('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b7d7b,_0x53e3bd,_0x1e0255){return new BPromise(function(_0x165365,_0x283230){return client[_0x5979('0x9')](_0x4b7d7b,_0x1e0255)[_0x5979('0xa')](function(_0x126589){logger[_0x5979('0xb')](_0x5979('0xc'),_0x53e3bd,_0x5979('0xd'));logger[_0x5979('0xe')](_0x5979('0xf'),_0x53e3bd,_0x5979('0xd'),JSON[_0x5979('0x10')](_0x126589));if(_0x126589[_0x5979('0x11')]){if(_0x126589[_0x5979('0x11')][_0x5979('0x12')]===0x1f4){logger[_0x5979('0x11')]('Setting,\x20%s,\x20%s',_0x53e3bd,_0x126589[_0x5979('0x11')][_0x5979('0x13')]);return _0x283230(_0x126589[_0x5979('0x11')]['message']);}logger['error'](_0x5979('0xc'),_0x53e3bd,_0x126589[_0x5979('0x11')]['message']);return _0x165365(_0x126589[_0x5979('0x11')][_0x5979('0x13')]);}else{logger[_0x5979('0xb')]('Setting,\x20%s,\x20%s',_0x53e3bd,'request\x20sent');_0x165365(_0x126589[_0x5979('0x14')][_0x5979('0x13')]);}})[_0x5979('0x15')](function(_0x15e729){logger[_0x5979('0x11')](_0x5979('0xc'),_0x53e3bd,_0x15e729);_0x283230(_0x15e729);});});} \ No newline at end of file +var _0x5c1f=['request\x20sent','debug','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x525ddf,_0x173917){var _0x547fd1=function(_0xd1255b){while(--_0xd1255b){_0x525ddf['push'](_0x525ddf['shift']());}};_0x547fd1(++_0x173917);}(_0x5c1f,0x106));var _0xf5c1=function(_0x44b3bd,_0x44c97d){_0x44b3bd=_0x44b3bd-0x0;var _0x1efc4a=_0x5c1f[_0x44b3bd];return _0x1efc4a;};'use strict';var _=require(_0xf5c1('0x0'));var util=require('util');var moment=require(_0xf5c1('0x1'));var BPromise=require(_0xf5c1('0x2'));var rs=require(_0xf5c1('0x3'));var fs=require('fs');var Redis=require(_0xf5c1('0x4'));var db=require(_0xf5c1('0x5'))['db'];var utils=require(_0xf5c1('0x6'));var logger=require(_0xf5c1('0x7'))(_0xf5c1('0x8'));var config=require(_0xf5c1('0x9'));var jayson=require(_0xf5c1('0xa'));var client=jayson[_0xf5c1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52a0e6,_0x52185b,_0x339473){return new BPromise(function(_0x465ec4,_0x588940){return client[_0xf5c1('0xc')](_0x52a0e6,_0x339473)[_0xf5c1('0xd')](function(_0xea120d){logger['info']('Setting,\x20%s,\x20%s',_0x52185b,_0xf5c1('0xe'));logger[_0xf5c1('0xf')]('Setting,\x20%s,\x20%s,\x20%s',_0x52185b,_0xf5c1('0xe'),JSON[_0xf5c1('0x10')](_0xea120d));if(_0xea120d[_0xf5c1('0x11')]){if(_0xea120d[_0xf5c1('0x11')][_0xf5c1('0x12')]===0x1f4){logger[_0xf5c1('0x11')](_0xf5c1('0x13'),_0x52185b,_0xea120d[_0xf5c1('0x11')][_0xf5c1('0x14')]);return _0x588940(_0xea120d[_0xf5c1('0x11')][_0xf5c1('0x14')]);}logger['error'](_0xf5c1('0x13'),_0x52185b,_0xea120d[_0xf5c1('0x11')][_0xf5c1('0x14')]);return _0x465ec4(_0xea120d[_0xf5c1('0x11')][_0xf5c1('0x14')]);}else{logger['info'](_0xf5c1('0x13'),_0x52185b,_0xf5c1('0xe'));_0x465ec4(_0xea120d[_0xf5c1('0x15')]['message']);}})[_0xf5c1('0x16')](function(_0x114cef){logger[_0xf5c1('0x11')](_0xf5c1('0x13'),_0x52185b,_0x114cef);_0x588940(_0x114cef);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index fd74975..88ba32c 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 _0x323f=['removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','/:id/send','send','status','addAgents','put','update','destroy','delete','removeAnswers'];(function(_0x34c24c,_0x3a056f){var _0x35c544=function(_0x3c7a43){while(--_0x3c7a43){_0x34c24c['push'](_0x34c24c['shift']());}};_0x35c544(++_0x3a056f);}(_0x323f,0x185));var _0xf323=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x323f[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xf323('0x0'));var util=require('util');var path=require(_0xf323('0x1'));var timeout=require(_0xf323('0x2'));var express=require(_0xf323('0x3'));var router=express[_0xf323('0x4')]();var auth=require(_0xf323('0x5'));var interaction=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var controller=require(_0xf323('0x8'));router[_0xf323('0x9')]('/',auth[_0xf323('0xa')](),controller[_0xf323('0xb')]);router[_0xf323('0x9')](_0xf323('0xc'),auth[_0xf323('0xa')](),controller[_0xf323('0xd')]);router['get'](_0xf323('0xe'),auth[_0xf323('0xa')](),controller['show']);router['get'](_0xf323('0xf'),auth[_0xf323('0xa')](),controller[_0xf323('0x10')]);router[_0xf323('0x9')](_0xf323('0x11'),auth[_0xf323('0xa')](),controller[_0xf323('0x12')]);router[_0xf323('0x9')]('/:id/applications',auth[_0xf323('0xa')](),controller['getApplications']);router[_0xf323('0x9')](_0xf323('0x13'),auth['isAuthenticated'](),controller[_0xf323('0x14')]);router['get'](_0xf323('0x15'),controller[_0xf323('0x16')]);router[_0xf323('0x9')](_0xf323('0x17'),auth[_0xf323('0xa')](),controller[_0xf323('0x18')]);router[_0xf323('0x19')]('/',auth[_0xf323('0xa')](),controller[_0xf323('0x1a')]);router[_0xf323('0x19')](_0xf323('0xf'),auth['isAuthenticated'](),controller[_0xf323('0x1b')]);router[_0xf323('0x19')](_0xf323('0x11'),auth[_0xf323('0xa')](),controller[_0xf323('0x1c')]);router[_0xf323('0x19')](_0xf323('0x1d'),controller[_0xf323('0x1e')]);router[_0xf323('0x19')](_0xf323('0x1f'),auth[_0xf323('0xa')](),controller['addApplications']);router[_0xf323('0x19')](_0xf323('0x20'),auth[_0xf323('0xa')](),controller[_0xf323('0x21')]);router[_0xf323('0x19')](_0xf323('0x15'),controller[_0xf323('0x22')]);router[_0xf323('0x19')]('/:id/users',auth[_0xf323('0xa')](),controller[_0xf323('0x23')]);router[_0xf323('0x24')](_0xf323('0xe'),auth[_0xf323('0xa')](),controller[_0xf323('0x25')]);router['delete'](_0xf323('0xe'),auth['isAuthenticated'](),controller[_0xf323('0x26')]);router[_0xf323('0x27')](_0xf323('0xf'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0xf323('0x11'),auth[_0xf323('0xa')](),controller[_0xf323('0x28')]);router[_0xf323('0x27')](_0xf323('0x17'),auth[_0xf323('0xa')](),controller[_0xf323('0x29')]);module[_0xf323('0x2a')]=router; \ No newline at end of file +var _0xe4d0=['post','addDisposition','/:id/notify','/:id/applications','/:id/send','status','/:id','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users'];(function(_0x279368,_0x41c002){var _0x40b6d0=function(_0x493776){while(--_0x493776){_0x279368['push'](_0x279368['shift']());}};_0x40b6d0(++_0x41c002);}(_0xe4d0,0xc6));var _0x0e4d=function(_0x3186aa,_0x34c21e){_0x3186aa=_0x3186aa-0x0;var _0x2d8c36=_0xe4d0[_0x3186aa];return _0x2d8c36;};'use strict';var multer=require(_0x0e4d('0x0'));var util=require(_0x0e4d('0x1'));var path=require(_0x0e4d('0x2'));var timeout=require(_0x0e4d('0x3'));var express=require(_0x0e4d('0x4'));var router=express[_0x0e4d('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0e4d('0x6'));var config=require(_0x0e4d('0x7'));var controller=require('./smsAccount.controller');router[_0x0e4d('0x8')]('/',auth[_0x0e4d('0x9')](),controller[_0x0e4d('0xa')]);router[_0x0e4d('0x8')](_0x0e4d('0xb'),auth['isAuthenticated'](),controller[_0x0e4d('0xc')]);router[_0x0e4d('0x8')]('/:id',auth[_0x0e4d('0x9')](),controller[_0x0e4d('0xd')]);router[_0x0e4d('0x8')](_0x0e4d('0xe'),auth['isAuthenticated'](),controller[_0x0e4d('0xf')]);router[_0x0e4d('0x8')](_0x0e4d('0x10'),auth[_0x0e4d('0x9')](),controller[_0x0e4d('0x11')]);router[_0x0e4d('0x8')]('/:id/applications',auth[_0x0e4d('0x9')](),controller[_0x0e4d('0x12')]);router['get'](_0x0e4d('0x13'),auth[_0x0e4d('0x9')](),controller[_0x0e4d('0x14')]);router[_0x0e4d('0x8')](_0x0e4d('0x15'),controller[_0x0e4d('0x16')]);router[_0x0e4d('0x8')](_0x0e4d('0x17'),auth[_0x0e4d('0x9')](),controller['getAgents']);router[_0x0e4d('0x18')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0e4d('0x18')](_0x0e4d('0xe'),auth['isAuthenticated'](),controller[_0x0e4d('0x19')]);router[_0x0e4d('0x18')]('/:id/canned_answers',auth[_0x0e4d('0x9')](),controller['addAnswer']);router[_0x0e4d('0x18')](_0x0e4d('0x1a'),controller['notify']);router[_0x0e4d('0x18')](_0x0e4d('0x1b'),auth[_0x0e4d('0x9')](),controller['addApplications']);router[_0x0e4d('0x18')](_0x0e4d('0x1c'),auth[_0x0e4d('0x9')](),controller['send']);router[_0x0e4d('0x18')](_0x0e4d('0x15'),controller[_0x0e4d('0x1d')]);router[_0x0e4d('0x18')](_0x0e4d('0x17'),auth[_0x0e4d('0x9')](),controller['addAgents']);router['put'](_0x0e4d('0x1e'),auth[_0x0e4d('0x9')](),controller[_0x0e4d('0x1f')]);router[_0x0e4d('0x20')]('/:id',auth[_0x0e4d('0x9')](),controller['destroy']);router[_0x0e4d('0x20')](_0x0e4d('0xe'),auth[_0x0e4d('0x9')](),controller[_0x0e4d('0x21')]);router['delete'](_0x0e4d('0x10'),auth[_0x0e4d('0x9')](),controller[_0x0e4d('0x22')]);router[_0x0e4d('0x20')]('/:id/users',auth[_0x0e4d('0x9')](),controller[_0x0e4d('0x23')]);module[_0x0e4d('0x24')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 7b48ffd..ecde5e3 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 _0x38c9=['bandwidth','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','ENUM','twilio','skebby','clicksend','plivo','clickatell'];(function(_0x42d709,_0x2e336c){var _0x2ac71e=function(_0x4049c2){while(--_0x4049c2){_0x42d709['push'](_0x42d709['shift']());}};_0x2ac71e(++_0x2e336c);}(_0x38c9,0x199));var _0x938c=function(_0x2d6197,_0x82ebfb){_0x2d6197=_0x2d6197-0x0;var _0x4d0e75=_0x38c9[_0x2d6197];return _0x4d0e75;};'use strict';var Sequelize=require(_0x938c('0x0'));var rs=require(_0x938c('0x1'));module[_0x938c('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x938c('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x938c('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x938c('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0x938c('0x4')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x938c('0x4')]},'type':{'type':Sequelize[_0x938c('0x5')](_0x938c('0x6'),_0x938c('0x7'),'connectel',_0x938c('0x8'),_0x938c('0x9'),_0x938c('0xa'),_0x938c('0xb'),'csc','infobip',_0x938c('0xc'))},'accountSid':{'type':Sequelize[_0x938c('0x4')]},'authId':{'type':Sequelize[_0x938c('0x4')]},'authToken':{'type':Sequelize[_0x938c('0x4')]},'smsMethod':{'type':Sequelize[_0x938c('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x938c('0x4')]},'password':{'type':Sequelize[_0x938c('0x4')]},'apiKey':{'type':Sequelize[_0x938c('0x4')]},'applicationId':{'type':Sequelize[_0x938c('0x4')]},'accountId':{'type':Sequelize[_0x938c('0x4')]},'senderString':{'type':Sequelize[_0x938c('0x4')]},'deliveryReport':{'type':Sequelize[_0x938c('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x938c('0x4')]},'notificationTemplate':{'type':Sequelize[_0x938c('0xe')],'defaultValue':function(){return _0x938c('0xf');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x938c('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x938c('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x938c('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x938c('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x938c('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x938c('0x10')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x938c('0xd')],'defaultValue':![],'comment':_0x938c('0x11'),'set':function(_0x9d9f88){if(!_0x9d9f88)this[_0x938c('0x12')](_0x938c('0x13'),null);this['setDataValue'](_0x938c('0x14'),_0x9d9f88);}}}; \ No newline at end of file +var _0x9d9b=['mandatoryDisposition','randomstring','exports','name','STRING','generate','ENUM','skebby','connectel','plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x1d3a41,_0x45c793){var _0x16564e=function(_0x1e4950){while(--_0x1e4950){_0x1d3a41['push'](_0x1d3a41['shift']());}};_0x16564e(++_0x45c793);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x3868d6,_0x2de626){_0x3868d6=_0x3868d6-0x0;var _0xf7cdc1=_0x9d9b[_0x3868d6];return _0xf7cdc1;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xb9d9('0x0'));module[_0xb9d9('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb9d9('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xb9d9('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xb9d9('0x3')],'defaultValue':function(){return rs[_0xb9d9('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb9d9('0x5')]('twilio',_0xb9d9('0x6'),_0xb9d9('0x7'),'clicksend',_0xb9d9('0x8'),_0xb9d9('0x9'),_0xb9d9('0xa'),_0xb9d9('0xb'),_0xb9d9('0xc'),_0xb9d9('0xd'))},'accountSid':{'type':Sequelize[_0xb9d9('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xb9d9('0x3')]},'apiKey':{'type':Sequelize[_0xb9d9('0x3')]},'applicationId':{'type':Sequelize[_0xb9d9('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xb9d9('0x3')]},'deliveryReport':{'type':Sequelize[_0xb9d9('0xe')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xb9d9('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xb9d9('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb9d9('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb9d9('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb9d9('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb9d9('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb9d9('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb9d9('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xb9d9('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xb9d9('0xe')],'defaultValue':![],'comment':_0xb9d9('0x11'),'set':function(_0x3909ab){if(!_0x3909ab)this[_0xb9d9('0x12')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xb9d9('0x13'),_0x3909ab);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 6458f0b..e4d8f2f 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 _0x3fae=['SmsApplication','Applications','account','orderBy','priority','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','from','From','Body','messageId','MessageSid','text','connectel','clicksend','message_id','MessageUUID','infobip','results','csc','originatingAddress','fromNumber','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','mapKey','CmList','CmContact','Contacts','DESC','omit','SmsInteraction','spread','interaction','created','autoclose','applications','push','close','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','Contact','User','Owner','fullname','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','status_code','redif','DELIVERED','error_code','groupName','clickatell','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','ACCEPTD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','destroy','SmsAccounts','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','include','rows','show','params','length','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','SmsAccountId','Disposition','addAnswer','getAnswers','findOne','CannedAnswer','findAll','removeAnswers','ids','notify'];(function(_0x31bab3,_0x44554f){var _0x4fd382=function(_0x42b336){while(--_0x42b336){_0x31bab3['push'](_0x31bab3['shift']());}};_0x4fd382(++_0x44554f);}(_0x3fae,0x6a));var _0xe3fa=function(_0x2bc7d4,_0x2cbf1f){_0x2bc7d4=_0x2bc7d4-0x0;var _0x3e60b0=_0x3fae[_0x2bc7d4];return _0x3e60b0;};'use strict';var pdf=require(_0xe3fa('0x0'));var emlformat=require(_0xe3fa('0x1'));var rimraf=require(_0xe3fa('0x2'));var zipdir=require(_0xe3fa('0x3'));var jsonpatch=require(_0xe3fa('0x4'));var rp=require('request-promise');var moment=require(_0xe3fa('0x5'));var BPromise=require(_0xe3fa('0x6'));var Mustache=require(_0xe3fa('0x7'));var util=require(_0xe3fa('0x8'));var path=require(_0xe3fa('0x9'));var sox=require('sox');var csv=require(_0xe3fa('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe3fa('0xb'));var squel=require(_0xe3fa('0xc'));var crypto=require(_0xe3fa('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe3fa('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe3fa('0xf'));var Papa=require(_0xe3fa('0x10'));var Redis=require(_0xe3fa('0x11'));var authService=require(_0xe3fa('0x12'));var qs=require(_0xe3fa('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3fa('0x14'));var logger=require(_0xe3fa('0x15'))(_0xe3fa('0x16'));var utils=require(_0xe3fa('0x17'));var config=require(_0xe3fa('0x18'));var licenseUtil=require(_0xe3fa('0x19'));var db=require(_0xe3fa('0x1a'))['db'];config[_0xe3fa('0x1b')]=_[_0xe3fa('0x1c')](config['redis'],{'host':_0xe3fa('0x1d'),'port':0x18eb});var socket=require(_0xe3fa('0x1e'))(new Redis(config[_0xe3fa('0x1b')]));require(_0xe3fa('0x1f'))[_0xe3fa('0x20')](socket);var jayson=require(_0xe3fa('0x21'));var client=jayson[_0xe3fa('0x22')][_0xe3fa('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x226938,_0x1ab5ee,_0x31f3b7,_0x548fd0){return new BPromise(function(_0x506d2a,_0x9eb198){var _0x11e492=_0x548fd0||client;return _0x11e492[_0xe3fa('0x24')](_0x226938,_0x31f3b7)[_0xe3fa('0x25')](function(_0x270682){logger[_0xe3fa('0x26')](_0xe3fa('0x27'),_0x1ab5ee,_0xe3fa('0x28'));logger[_0xe3fa('0x29')](_0xe3fa('0x2a'),_0x1ab5ee,_0xe3fa('0x28'),JSON['stringify'](_0x270682));if(_0x270682['error']){if(_0x270682[_0xe3fa('0x2b')]['code']===0x1f4){logger[_0xe3fa('0x2b')](_0xe3fa('0x27'),_0x1ab5ee,_0x270682[_0xe3fa('0x2b')][_0xe3fa('0x2c')]);return _0x9eb198(_0x270682[_0xe3fa('0x2b')][_0xe3fa('0x2c')]);}logger[_0xe3fa('0x2b')](_0xe3fa('0x27'),_0x1ab5ee,_0x270682['error'][_0xe3fa('0x2c')]);return _0x506d2a(_0x270682['error'][_0xe3fa('0x2c')]);}else{logger[_0xe3fa('0x26')](_0xe3fa('0x27'),_0x1ab5ee,_0xe3fa('0x28'));_0x506d2a(_0x270682[_0xe3fa('0x2d')]['message']);}})[_0xe3fa('0x2e')](function(_0x4016e1){logger[_0xe3fa('0x2b')](_0xe3fa('0x27'),_0x1ab5ee,_0x4016e1);_0x9eb198(_0x4016e1);});});}function respondWithStatusCode(_0x484c4e,_0x4f3edd){_0x4f3edd=_0x4f3edd||0xcc;return function(_0x20b719){if(_0x20b719){return _0x484c4e[_0xe3fa('0x2f')](_0x4f3edd);}return _0x484c4e[_0xe3fa('0x30')](_0x4f3edd)['end']();};}function respondWithResult(_0x1e8b83,_0x304bc){_0x304bc=_0x304bc||0xc8;return function(_0x56521d){if(_0x56521d){return _0x1e8b83[_0xe3fa('0x30')](_0x304bc)[_0xe3fa('0x31')](_0x56521d);}};}function respondWithFilteredResult(_0x2c5524,_0x2dea21){return function(_0x2ae9a9){if(_0x2ae9a9){var _0x15f265=_0x2ae9a9[_0xe3fa('0x32')],_0x3d6e97=_0x2dea21[_0xe3fa('0x33')],_0x478f81=_0x2dea21[_0xe3fa('0x33')]+_0x2dea21['limit'],_0x37234a;if(_0x478f81>=_0x15f265){_0x478f81=_0x15f265;_0x37234a=0xc8;}else{_0x37234a=0xce;}_0x2c5524[_0xe3fa('0x30')](_0x37234a);return _0x2c5524[_0xe3fa('0x34')](_0xe3fa('0x35'),_0x3d6e97+'-'+_0x478f81+'/'+_0x15f265)[_0xe3fa('0x31')](_0x2ae9a9);}return null;};}function patchUpdates(_0x5c6ac3){return function(_0x968ec0){try{jsonpatch[_0xe3fa('0x36')](_0x968ec0,_0x5c6ac3,!![]);}catch(_0x1deb4d){return BPromise[_0xe3fa('0x37')](_0x1deb4d);}return _0x968ec0[_0xe3fa('0x38')]();};}function saveUpdates(_0x4a7d89,_0x32662f){return function(_0x57362f){if(_0x57362f){return _0x57362f['update'](_0x4a7d89)['then'](function(_0x2c83c9){return _0x2c83c9;});}return null;};}function removeEntity(_0x206b5f,_0x458658){return function(_0x157642){if(_0x157642){return _0x157642[_0xe3fa('0x39')]()['then'](function(){var _0x3ef22d=_0x157642['get']({'plain':!![]});var _0x267ecf=_0xe3fa('0x3a');return db[_0xe3fa('0x3b')][_0xe3fa('0x39')]({'where':{'type':_0x267ecf,'resourceId':_0x3ef22d['id']}})['then'](function(){return _0x157642;});})['then'](function(){_0x206b5f[_0xe3fa('0x30')](0xcc)[_0xe3fa('0x3c')]();});}};}function handleEntityNotFound(_0x206052,_0x196ff2){return function(_0x384816){if(!_0x384816){_0x206052[_0xe3fa('0x2f')](0x194);}return _0x384816;};}function handleError(_0x28c11a,_0x39642a){_0x39642a=_0x39642a||0x1f4;return function(_0x447d4d){logger[_0xe3fa('0x2b')](_0x447d4d[_0xe3fa('0x3d')]);if(_0x447d4d['name']){delete _0x447d4d[_0xe3fa('0x3e')];}_0x28c11a['status'](_0x39642a)[_0xe3fa('0x3f')](_0x447d4d);};}exports[_0xe3fa('0x40')]=function(_0x13dc9a,_0x43561b){var _0x1c17da={'include':[{'model':db[_0xe3fa('0x41')],'as':_0xe3fa('0x42')}]},_0x389ec2={},_0x232d39={'count':0x0,'rows':[]};var _0x29cd26=_[_0xe3fa('0x43')](db[_0xe3fa('0x44')][_0xe3fa('0x45')],function(_0x236757){return{'name':_0x236757[_0xe3fa('0x46')],'type':_0x236757['type']['key']};});_0x389ec2[_0xe3fa('0x47')]=_[_0xe3fa('0x43')](_0x29cd26,'name');_0x389ec2[_0xe3fa('0x48')]=_[_0xe3fa('0x49')](_0x13dc9a[_0xe3fa('0x48')]);_0x389ec2[_0xe3fa('0x4a')]=_[_0xe3fa('0x4b')](_0x389ec2[_0xe3fa('0x47')],_0x389ec2[_0xe3fa('0x48')]);_0x1c17da[_0xe3fa('0x4c')]=_[_0xe3fa('0x4b')](_0x389ec2[_0xe3fa('0x47')],qs['fields'](_0x13dc9a[_0xe3fa('0x48')][_0xe3fa('0x4d')]));_0x1c17da[_0xe3fa('0x4c')]=_0x1c17da[_0xe3fa('0x4c')]['length']?_0x1c17da['attributes']:_0x389ec2['model'];if(!_0x13dc9a[_0xe3fa('0x48')][_0xe3fa('0x4e')](_0xe3fa('0x4f'))){_0x1c17da[_0xe3fa('0x50')]=qs[_0xe3fa('0x50')](_0x13dc9a[_0xe3fa('0x48')]['limit']);_0x1c17da[_0xe3fa('0x33')]=qs[_0xe3fa('0x33')](_0x13dc9a[_0xe3fa('0x48')][_0xe3fa('0x33')]);}_0x1c17da[_0xe3fa('0x51')]=qs[_0xe3fa('0x52')](_0x13dc9a[_0xe3fa('0x48')][_0xe3fa('0x52')]);_0x1c17da['where']=qs[_0xe3fa('0x4a')](_[_0xe3fa('0x53')](_0x13dc9a[_0xe3fa('0x48')],_0x389ec2[_0xe3fa('0x4a')]),_0x29cd26);if(_0x13dc9a['query'][_0xe3fa('0x54')]){_0x1c17da['where']=_[_0xe3fa('0x55')](_0x1c17da[_0xe3fa('0x56')],{'$or':_[_0xe3fa('0x43')](_0x29cd26,function(_0x4aef80){if(_0x4aef80[_0xe3fa('0x57')]!==_0xe3fa('0x58')){var _0x4d82ac={};_0x4d82ac[_0x4aef80[_0xe3fa('0x3e')]]={'$like':'%'+_0x13dc9a[_0xe3fa('0x48')][_0xe3fa('0x54')]+'%'};return _0x4d82ac;}})});}_0x1c17da=_[_0xe3fa('0x55')]({},_0x1c17da,_0x13dc9a[_0xe3fa('0x59')]);var _0x26ad47={'where':_0x1c17da[_0xe3fa('0x56')]};return db[_0xe3fa('0x44')][_0xe3fa('0x32')](_0x26ad47)[_0xe3fa('0x25')](function(_0x29402c){_0x232d39[_0xe3fa('0x32')]=_0x29402c;if(_0x13dc9a[_0xe3fa('0x48')]['includeAll']){_0x1c17da[_0xe3fa('0x5a')]=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x1c17da);})[_0xe3fa('0x25')](function(_0x3105c8){_0x232d39[_0xe3fa('0x5b')]=_0x3105c8;return _0x232d39;})[_0xe3fa('0x25')](respondWithFilteredResult(_0x43561b,_0x1c17da))['catch'](handleError(_0x43561b,null));};exports[_0xe3fa('0x5c')]=function(_0x10d0ef,_0x330828){var _0x5ae9fd={'raw':![],'where':{'id':_0x10d0ef[_0xe3fa('0x5d')]['id']},'include':[{'model':db[_0xe3fa('0x41')],'as':_0xe3fa('0x42')}]},_0x305778={};_0x305778[_0xe3fa('0x47')]=_[_0xe3fa('0x49')](db[_0xe3fa('0x44')]['rawAttributes']);_0x305778[_0xe3fa('0x48')]=_[_0xe3fa('0x49')](_0x10d0ef['query']);_0x305778[_0xe3fa('0x4a')]=_['intersection'](_0x305778['model'],_0x305778[_0xe3fa('0x48')]);_0x5ae9fd[_0xe3fa('0x4c')]=_[_0xe3fa('0x4b')](_0x305778[_0xe3fa('0x47')],qs[_0xe3fa('0x4d')](_0x10d0ef[_0xe3fa('0x48')][_0xe3fa('0x4d')]));_0x5ae9fd[_0xe3fa('0x4c')]=_0x5ae9fd[_0xe3fa('0x4c')][_0xe3fa('0x5e')]?_0x5ae9fd[_0xe3fa('0x4c')]:_0x305778['model'];if(_0x10d0ef[_0xe3fa('0x48')][_0xe3fa('0x5f')]){_0x5ae9fd[_0xe3fa('0x5a')]=[{'all':!![]}];}_0x5ae9fd=_['merge']({},_0x5ae9fd,_0x10d0ef[_0xe3fa('0x59')]);return db['SmsAccount'][_0xe3fa('0x60')](_0x5ae9fd)[_0xe3fa('0x25')](handleEntityNotFound(_0x330828,null))[_0xe3fa('0x25')](respondWithResult(_0x330828,null))[_0xe3fa('0x2e')](handleError(_0x330828,null));};exports['create']=function(_0x383038,_0x2db452){return db[_0xe3fa('0x44')][_0xe3fa('0x61')](_0x383038[_0xe3fa('0x62')],{})['then'](function(_0x568371){var _0x11adc2=_0x383038['user']['get']({'plain':!![]});if(!_0x11adc2)throw new Error(_0xe3fa('0x63'));if(_0x11adc2[_0xe3fa('0x64')]===_0xe3fa('0x65')){var _0x2d306b=_0x568371[_0xe3fa('0x66')]({'plain':!![]});var _0x31d521='SmsAccounts';return db[_0xe3fa('0x67')][_0xe3fa('0x60')]({'where':{'name':_0x31d521,'userProfileId':_0x11adc2['userProfileId']},'raw':!![]})[_0xe3fa('0x25')](function(_0x52e067){if(_0x52e067&&_0x52e067[_0xe3fa('0x68')]===0x0){return db[_0xe3fa('0x3b')][_0xe3fa('0x61')]({'name':_0x2d306b[_0xe3fa('0x3e')],'resourceId':_0x2d306b['id'],'type':_0x52e067[_0xe3fa('0x3e')],'sectionId':_0x52e067['id']},{})[_0xe3fa('0x25')](function(){return _0x568371;});}else{return _0x568371;}})[_0xe3fa('0x2e')](function(_0x2411cb){logger[_0xe3fa('0x2b')](_0xe3fa('0x69'),_0x2411cb);throw _0x2411cb;});}return _0x568371;})[_0xe3fa('0x25')](respondWithResult(_0x2db452,0xc9))[_0xe3fa('0x2e')](handleError(_0x2db452,null));};exports[_0xe3fa('0x6a')]=function(_0xbcc8ad,_0x32bcdf){if(_0xbcc8ad['body']['id']){delete _0xbcc8ad['body']['id'];}return db[_0xe3fa('0x44')]['find']({'where':{'id':_0xbcc8ad[_0xe3fa('0x5d')]['id']},'include':[{'model':db[_0xe3fa('0x41')],'as':_0xe3fa('0x42')}]})['then'](handleEntityNotFound(_0x32bcdf,null))[_0xe3fa('0x25')](saveUpdates(_0xbcc8ad[_0xe3fa('0x62')],null))[_0xe3fa('0x25')](respondWithResult(_0x32bcdf,null))[_0xe3fa('0x2e')](handleError(_0x32bcdf,null));};exports[_0xe3fa('0x39')]=function(_0x25ee4d,_0x24ce29){return db['SmsAccount'][_0xe3fa('0x60')]({'where':{'id':_0x25ee4d[_0xe3fa('0x5d')]['id']}})[_0xe3fa('0x25')](handleEntityNotFound(_0x24ce29,null))[_0xe3fa('0x25')](removeEntity(_0x24ce29,null))[_0xe3fa('0x2e')](handleError(_0x24ce29,null));};exports[_0xe3fa('0x6b')]=function(_0x4d8a40,_0x29ac79){return db[_0xe3fa('0x44')]['describe']()['then'](respondWithResult(_0x29ac79,null))[_0xe3fa('0x2e')](handleError(_0x29ac79,null));};exports['addDisposition']=function(_0x1e624f,_0x2161d4,_0x385367){if(_0x1e624f[_0xe3fa('0x62')]['id']){delete _0x1e624f[_0xe3fa('0x62')]['id'];}return db[_0xe3fa('0x44')][_0xe3fa('0x60')]({'where':{'id':_0x1e624f['params']['id']}})['then'](handleEntityNotFound(_0x2161d4,null))[_0xe3fa('0x25')](function(_0x5bda9d){if(_0x5bda9d){_0x1e624f[_0xe3fa('0x62')][_0xe3fa('0x6c')]=_0x5bda9d['id'];return db[_0xe3fa('0x6d')][_0xe3fa('0x61')](_0x1e624f['body']);}})[_0xe3fa('0x25')](respondWithResult(_0x2161d4,null))[_0xe3fa('0x2e')](handleError(_0x2161d4,null));};exports['getDispositions']=function(_0x3acdd4,_0x1d07a5,_0x27c56b){var _0x36053d={'raw':![],'where':{}};var _0x5805c3={};var _0x2893c8={'count':0x0,'rows':[]};return db[_0xe3fa('0x44')]['findOne']({'where':{'id':_0x3acdd4[_0xe3fa('0x5d')]['id']}})[_0xe3fa('0x25')](handleEntityNotFound(_0x1d07a5,null))['then'](function(_0x4bb197){if(_0x4bb197){_0x5805c3[_0xe3fa('0x47')]=_['keys'](db[_0xe3fa('0x6d')][_0xe3fa('0x45')]);_0x5805c3[_0xe3fa('0x48')]=_[_0xe3fa('0x49')](_0x3acdd4['query']);_0x5805c3[_0xe3fa('0x4a')]=_[_0xe3fa('0x4b')](_0x5805c3['model'],_0x5805c3[_0xe3fa('0x48')]);_0x36053d['attributes']=_[_0xe3fa('0x4b')](_0x5805c3['model'],qs[_0xe3fa('0x4d')](_0x3acdd4[_0xe3fa('0x48')][_0xe3fa('0x4d')]));_0x36053d[_0xe3fa('0x4c')]=_0x36053d[_0xe3fa('0x4c')]['length']?_0x36053d['attributes']:_0x5805c3[_0xe3fa('0x47')];if(!_0x3acdd4['query'][_0xe3fa('0x4e')](_0xe3fa('0x4f'))){_0x36053d[_0xe3fa('0x50')]=qs[_0xe3fa('0x50')](_0x3acdd4['query'][_0xe3fa('0x50')]);_0x36053d['offset']=qs[_0xe3fa('0x33')](_0x3acdd4['query'][_0xe3fa('0x33')]);}_0x36053d['order']=qs['sort'](_0x3acdd4[_0xe3fa('0x48')]['sort']);_0x36053d[_0xe3fa('0x56')]=qs[_0xe3fa('0x4a')](_[_0xe3fa('0x53')](_0x3acdd4[_0xe3fa('0x48')],_0x5805c3[_0xe3fa('0x4a')]));_0x36053d[_0xe3fa('0x56')][_0xe3fa('0x6c')]=_0x4bb197['id'];if(_0x3acdd4[_0xe3fa('0x48')][_0xe3fa('0x54')]){_0x36053d[_0xe3fa('0x56')]=_[_0xe3fa('0x55')](_0x36053d[_0xe3fa('0x56')],{'$or':_['map'](_0x36053d[_0xe3fa('0x4c')],function(_0x28f3f){var _0x1cc97e={};_0x1cc97e[_0x28f3f]={'$like':'%'+_0x3acdd4[_0xe3fa('0x48')][_0xe3fa('0x54')]+'%'};return _0x1cc97e;})});}_0x36053d=_[_0xe3fa('0x55')]({},_0x36053d,_0x3acdd4[_0xe3fa('0x59')]);return db['Disposition'][_0xe3fa('0x32')]({'where':_0x36053d[_0xe3fa('0x56')]})[_0xe3fa('0x25')](function(_0x204463){_0x2893c8[_0xe3fa('0x32')]=_0x204463;if(_0x3acdd4[_0xe3fa('0x48')]['includeAll']){_0x36053d['include']=[{'all':!![]}];}return db[_0xe3fa('0x6d')]['findAll'](_0x36053d);})[_0xe3fa('0x25')](function(_0x10d55e){_0x2893c8[_0xe3fa('0x5b')]=_0x10d55e;return _0x2893c8;});}})[_0xe3fa('0x25')](respondWithFilteredResult(_0x1d07a5,_0x36053d))[_0xe3fa('0x2e')](handleError(_0x1d07a5,null));};exports['removeDispositions']=function(_0x540e2f,_0x3e6b80,_0x5c1be0){return db[_0xe3fa('0x44')]['find']({'where':{'id':_0x540e2f['params']['id']}})[_0xe3fa('0x25')](handleEntityNotFound(_0x3e6b80,null))[_0xe3fa('0x25')](function(_0x572572){if(_0x572572){return _0x572572['removeDispositions'](_0x540e2f[_0xe3fa('0x48')]['ids']);}})[_0xe3fa('0x25')](respondWithStatusCode(_0x3e6b80,null))['catch'](handleError(_0x3e6b80,null));};exports[_0xe3fa('0x6e')]=function(_0x344b38,_0x53b0e7,_0x3848cc){if(_0x344b38[_0xe3fa('0x62')]['id']){delete _0x344b38['body']['id'];}return db[_0xe3fa('0x44')][_0xe3fa('0x60')]({'where':{'id':_0x344b38[_0xe3fa('0x5d')]['id']}})['then'](handleEntityNotFound(_0x53b0e7,null))[_0xe3fa('0x25')](function(_0x2cf066){if(_0x2cf066){_0x344b38[_0xe3fa('0x62')][_0xe3fa('0x6c')]=_0x2cf066['id'];return db['CannedAnswer'][_0xe3fa('0x61')](_0x344b38['body']);}})[_0xe3fa('0x25')](respondWithResult(_0x53b0e7,null))[_0xe3fa('0x2e')](handleError(_0x53b0e7,null));};exports[_0xe3fa('0x6f')]=function(_0x1000f4,_0x21c6fd,_0x40ad1a){var _0x4e018d={'raw':![],'where':{}};var _0x2038b1={};var _0x17d905={'count':0x0,'rows':[]};return db['SmsAccount'][_0xe3fa('0x70')]({'where':{'id':_0x1000f4[_0xe3fa('0x5d')]['id']}})[_0xe3fa('0x25')](handleEntityNotFound(_0x21c6fd,null))[_0xe3fa('0x25')](function(_0x57f6c5){if(_0x57f6c5){_0x2038b1['model']=_[_0xe3fa('0x49')](db[_0xe3fa('0x71')][_0xe3fa('0x45')]);_0x2038b1['query']=_[_0xe3fa('0x49')](_0x1000f4['query']);_0x2038b1[_0xe3fa('0x4a')]=_['intersection'](_0x2038b1[_0xe3fa('0x47')],_0x2038b1['query']);_0x4e018d[_0xe3fa('0x4c')]=_[_0xe3fa('0x4b')](_0x2038b1[_0xe3fa('0x47')],qs['fields'](_0x1000f4['query'][_0xe3fa('0x4d')]));_0x4e018d[_0xe3fa('0x4c')]=_0x4e018d[_0xe3fa('0x4c')][_0xe3fa('0x5e')]?_0x4e018d[_0xe3fa('0x4c')]:_0x2038b1[_0xe3fa('0x47')];if(!_0x1000f4[_0xe3fa('0x48')][_0xe3fa('0x4e')](_0xe3fa('0x4f'))){_0x4e018d[_0xe3fa('0x50')]=qs[_0xe3fa('0x50')](_0x1000f4[_0xe3fa('0x48')]['limit']);_0x4e018d[_0xe3fa('0x33')]=qs[_0xe3fa('0x33')](_0x1000f4[_0xe3fa('0x48')][_0xe3fa('0x33')]);}_0x4e018d[_0xe3fa('0x51')]=qs['sort'](_0x1000f4[_0xe3fa('0x48')][_0xe3fa('0x52')]);_0x4e018d[_0xe3fa('0x56')]=qs[_0xe3fa('0x4a')](_[_0xe3fa('0x53')](_0x1000f4[_0xe3fa('0x48')],_0x2038b1[_0xe3fa('0x4a')]));_0x4e018d['where'][_0xe3fa('0x6c')]=_0x57f6c5['id'];if(_0x1000f4[_0xe3fa('0x48')][_0xe3fa('0x54')]){_0x4e018d[_0xe3fa('0x56')]=_[_0xe3fa('0x55')](_0x4e018d[_0xe3fa('0x56')],{'$or':_[_0xe3fa('0x43')](_0x4e018d[_0xe3fa('0x4c')],function(_0x2ba781){var _0x25754e={};_0x25754e[_0x2ba781]={'$like':'%'+_0x1000f4['query'][_0xe3fa('0x54')]+'%'};return _0x25754e;})});}_0x4e018d=_[_0xe3fa('0x55')]({},_0x4e018d,_0x1000f4['options']);return db['CannedAnswer'][_0xe3fa('0x32')]({'where':_0x4e018d[_0xe3fa('0x56')]})[_0xe3fa('0x25')](function(_0x46c53c){_0x17d905[_0xe3fa('0x32')]=_0x46c53c;if(_0x1000f4[_0xe3fa('0x48')][_0xe3fa('0x5f')]){_0x4e018d[_0xe3fa('0x5a')]=[{'all':!![]}];}return db['CannedAnswer'][_0xe3fa('0x72')](_0x4e018d);})[_0xe3fa('0x25')](function(_0x57e132){_0x17d905[_0xe3fa('0x5b')]=_0x57e132;return _0x17d905;});}})[_0xe3fa('0x25')](respondWithFilteredResult(_0x21c6fd,_0x4e018d))[_0xe3fa('0x2e')](handleError(_0x21c6fd,null));};exports[_0xe3fa('0x73')]=function(_0x4aff23,_0x4b17dc,_0x1b41a5){return db['SmsAccount'][_0xe3fa('0x60')]({'where':{'id':_0x4aff23[_0xe3fa('0x5d')]['id']}})[_0xe3fa('0x25')](handleEntityNotFound(_0x4b17dc,null))['then'](function(_0x113e27){if(_0x113e27){return _0x113e27[_0xe3fa('0x73')](_0x4aff23[_0xe3fa('0x48')][_0xe3fa('0x74')]);}})[_0xe3fa('0x25')](respondWithStatusCode(_0x4b17dc,null))[_0xe3fa('0x2e')](handleError(_0x4b17dc,null));};exports[_0xe3fa('0x75')]=function(_0x2e9aa9,_0x47a33f,_0x5841c5){var _0x4d27a5={'channel':'sms'};var _0x330aa0=[];var _0x3dbe54=[];var _0x255f38={};return db['SmsAccount'][_0xe3fa('0x60')]({'where':{'id':_0x2e9aa9[_0xe3fa('0x5d')]['id']},'include':[{'model':db[_0xe3fa('0x76')],'as':_0xe3fa('0x77')}]})[_0xe3fa('0x25')](handleEntityNotFound(_0x47a33f,null))[_0xe3fa('0x25')](function(_0x112c8d){_0x4d27a5[_0xe3fa('0x78')]=_0x112c8d;_0x4d27a5['applications']=_[_0xe3fa('0x79')](_0x112c8d[_0xe3fa('0x77')],[_0xe3fa('0x7a')],[_0xe3fa('0x7b')]);if(_0x4d27a5[_0xe3fa('0x78')][_0xe3fa('0x77')]){delete _0x4d27a5[_0xe3fa('0x78')][_0xe3fa('0x77')];}return db['CmContact'][_0xe3fa('0x6b')]();})[_0xe3fa('0x25')](function(_0x48faf3){if(!_0x48faf3){throw new db[(_0xe3fa('0x7c'))][(_0xe3fa('0x7d'))](_0xe3fa('0x7e'));}_0x330aa0=_[_0xe3fa('0x7f')](_[_0xe3fa('0x49')](_0x48faf3),[_0xe3fa('0x80'),'updatedAt']);_0x3dbe54=_[_0xe3fa('0x7f')](_[_0xe3fa('0x49')](_0x48faf3),[_0xe3fa('0x80'),_0xe3fa('0x81'),'CompanyId',_0xe3fa('0x82')]);_0x4d27a5[_0xe3fa('0x62')]={'mapKey':_0xe3fa('0x83')};if(_0x4d27a5[_0xe3fa('0x78')][_0xe3fa('0x57')]){switch(_0x4d27a5[_0xe3fa('0x78')][_0xe3fa('0x57')]){case'twilio':_0x4d27a5['body'][_0xe3fa('0x84')]=_0x2e9aa9[_0xe3fa('0x62')][_0xe3fa('0x85')];_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x62')]=_0x2e9aa9[_0xe3fa('0x62')][_0xe3fa('0x86')];_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x87')]=_0x2e9aa9[_0xe3fa('0x62')][_0xe3fa('0x88')];break;case'skebby':_0x4d27a5['body'][_0xe3fa('0x84')]='+'+_0x2e9aa9[_0xe3fa('0x62')]['sender'];_0x4d27a5[_0xe3fa('0x62')]['body']=_0x2e9aa9['body'][_0xe3fa('0x89')];break;case _0xe3fa('0x8a'):_0x4d27a5[_0xe3fa('0x62')]['from']=_0x2e9aa9[_0xe3fa('0x62')]['from'];_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x62')]=_0x2e9aa9['body'][_0xe3fa('0x2c')];break;case _0xe3fa('0x8b'):_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x84')]=_0x2e9aa9[_0xe3fa('0x62')][_0xe3fa('0x84')];_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x62')]=_0x2e9aa9[_0xe3fa('0x62')][_0xe3fa('0x62')];_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x87')]=_0x2e9aa9[_0xe3fa('0x62')][_0xe3fa('0x8c')];break;case'plivo':_0x4d27a5['body'][_0xe3fa('0x84')]=_0x2e9aa9[_0xe3fa('0x62')][_0xe3fa('0x85')];_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x62')]=_0x2e9aa9[_0xe3fa('0x62')]['Text'];_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x87')]=_0x2e9aa9['body'][_0xe3fa('0x8d')];break;case _0xe3fa('0x8e'):_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x84')]='+'+_0x2e9aa9[_0xe3fa('0x62')][_0xe3fa('0x8f')][0x0][_0xe3fa('0x84')];_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x62')]=_0x2e9aa9[_0xe3fa('0x62')][_0xe3fa('0x8f')][0x0][_0xe3fa('0x89')];_0x4d27a5['body']['messageId']=_0x2e9aa9['body']['results'][0x0]['messageId'];break;case _0xe3fa('0x90'):_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x84')]=_0x2e9aa9[_0xe3fa('0x62')][_0xe3fa('0x91')];_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x62')]=_0x2e9aa9[_0xe3fa('0x62')]['segmentedMessage']['message'];break;case'clickatell':_0x4d27a5['body']['from']=_0x2e9aa9[_0xe3fa('0x62')][_0xe3fa('0x92')];_0x4d27a5['body'][_0xe3fa('0x62')]=_0x2e9aa9['body'][_0xe3fa('0x89')];_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x87')]=_0x2e9aa9[_0xe3fa('0x62')]['replyMessageId'];break;case _0xe3fa('0x93'):_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x87')]=_0x2e9aa9[_0xe3fa('0x62')][0x0][_0xe3fa('0x2c')]['id'];_0x4d27a5[_0xe3fa('0x62')]['from']=_0x2e9aa9[_0xe3fa('0x62')][0x0][_0xe3fa('0x2c')][_0xe3fa('0x84')];_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x62')]=_0x2e9aa9['body'][0x0][_0xe3fa('0x2c')][_0xe3fa('0x89')];break;case _0xe3fa('0x94'):_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x84')]=_0x2e9aa9[_0xe3fa('0x62')]['from'];_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x62')]=_0x2e9aa9[_0xe3fa('0x62')]['message'];_0x4d27a5['body'][_0xe3fa('0x87')]=_0x2e9aa9[_0xe3fa('0x62')][_0xe3fa('0x95')];break;}}if(_0x4d27a5[_0xe3fa('0x62')]['id']){delete _0x4d27a5[_0xe3fa('0x62')]['id'];}if(_[_0xe3fa('0x96')](_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x84')])){throw new db[(_0xe3fa('0x7c'))][(_0xe3fa('0x7d'))](_0xe3fa('0x97'));}if(_['isNil'](_0x4d27a5['body'][_0xe3fa('0x62')])||_0x4d27a5['body'][_0xe3fa('0x62')]===''){throw new db[(_0xe3fa('0x7c'))][(_0xe3fa('0x7d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xe3fa('0x96')](_0x4d27a5['body'][_0xe3fa('0x98')])){throw new db[(_0xe3fa('0x7c'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3dbe54);}if(!_['includes'](_0x3dbe54,_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x98')])){throw new db[(_0xe3fa('0x7c'))][(_0xe3fa('0x7d'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3dbe54);}_0x255f38[_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x98')]]=_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x84')];return db[_0xe3fa('0x99')][_0xe3fa('0x60')]({'where':{'id':_0x4d27a5['account'][_0xe3fa('0x82')]},'include':[{'model':db[_0xe3fa('0x9a')],'as':_0xe3fa('0x9b'),'where':_0x255f38,'limit':0x1,'order':[[_0xe3fa('0x81'),_0xe3fa('0x9c')]]}]});})[_0xe3fa('0x25')](handleEntityNotFound(_0x47a33f,null))[_0xe3fa('0x25')](function(_0x241f4c){if(_0x241f4c){_0x4d27a5['list']=_[_0xe3fa('0x9d')](_0x241f4c,[_0xe3fa('0x9b')]);if(_0x241f4c['Contacts'][_0xe3fa('0x5e')]){return _0x241f4c[_0xe3fa('0x9b')][0x0];}var _0x588cdb=_[_0xe3fa('0x1c')](_0x4d27a5[_0xe3fa('0x62')],{'firstName':_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x84')],'ListId':_0x241f4c['id']});_0x588cdb[_0x4d27a5['body']['mapKey']]=_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0x84')];return db[_0xe3fa('0x9a')][_0xe3fa('0x61')](_0x588cdb,{'fields':_0x330aa0,'raw':!![]});}})[_0xe3fa('0x25')](handleEntityNotFound(_0x47a33f,null))[_0xe3fa('0x25')](function(_0x3f33dd){if(_0x3f33dd){_0x4d27a5['contact']=_0x3f33dd;var _0x14b151={'ContactId':_0x3f33dd['id'],'phone':_0x4d27a5[_0xe3fa('0x62')]['from'],'SmsAccountId':_0x2e9aa9[_0xe3fa('0x5d')]['id']};var _0x34536e={'ContactId':_0x3f33dd['id'],'SmsAccountId':_0x2e9aa9[_0xe3fa('0x5d')]['id'],'closed':![]};return db[_0xe3fa('0x9e')][_0xe3fa('0x60')]({'where':_0x34536e})[_0xe3fa('0x25')](function(_0x1bedcd){if(_0x1bedcd){return[_0x1bedcd,![]];}return db['SmsInteraction'][_0xe3fa('0x61')](_0x14b151)['then'](function(_0x13a6fd){return[_0x13a6fd,!![]];});});}})[_0xe3fa('0x9f')](function(_0x488d23,_0x5900f8){_0x4d27a5['interaction']=_0x488d23[_0xe3fa('0x66')]({'plain':!![]});_0x4d27a5[_0xe3fa('0xa0')][_0xe3fa('0xa1')]=![];if(_0x5900f8){if(_0x4d27a5['account'][_0xe3fa('0xa2')]){_0x4d27a5[_0xe3fa('0xa3')][_0xe3fa('0xa4')]({'id':0x0,'priority':_0x4d27a5[_0xe3fa('0xa3')]['length']+0x1,'app':_0xe3fa('0xa5'),'appdata':'unmanaged','interval':_0xe3fa('0xa6')});}_0x4d27a5[_0xe3fa('0xa0')][_0xe3fa('0xa1')]=!![];}return db[_0xe3fa('0xa7')][_0xe3fa('0x61')]({'phone':_0x4d27a5['body']['from'],'messageId':_0x4d27a5['body']['messageId'],'body':_0x4d27a5[_0xe3fa('0x62')]['body'],'SmsAccountId':_0x2e9aa9['params']['id'],'SmsInteractionId':_0x488d23['id'],'direction':'in','ContactId':_0x488d23[_0xe3fa('0xa8')],'AttachmentId':_0x4d27a5[_0xe3fa('0x62')][_0xe3fa('0xa9')]});})[_0xe3fa('0x25')](function(_0x24e4cc){_0x4d27a5[_0xe3fa('0x2c')]=_0x24e4cc;if(_0x4d27a5[_0xe3fa('0xa0')]['UserId']){return db['User'][_0xe3fa('0x60')]({'attributes':['id',_0xe3fa('0x3e')],'where':{'id':_0x4d27a5['interaction'][_0xe3fa('0xaa')]}})[_0xe3fa('0x25')](function(_0x1d851f){if(_0x1d851f){_0x4d27a5['applications'][_0xe3fa('0xab')]({'id':0x0,'priority':0x0,'app':_0xe3fa('0xac'),'appdata':_0x1d851f[_0xe3fa('0x3e')]+','+(_0x4d27a5[_0xe3fa('0x78')][_0xe3fa('0xad')]||0xa),'interval':_0xe3fa('0xa6')});}return respondWithRpcPromise('Start',_0xe3fa('0xae'),_0x4d27a5);});}return respondWithRpcPromise('Start',_0xe3fa('0xae'),_0x4d27a5);})['then'](function(_0x539c3d){if(_0x539c3d){var _0x3ed522=0xc8;var _0x27ae83=_0xe3fa('0xaf');logger[_0xe3fa('0x26')](_0xe3fa('0x2a'),_0x27ae83,_0x3ed522,_0xe3fa('0xb0'));logger[_0xe3fa('0x29')](_0xe3fa('0xb1'),_0x27ae83,_0x3ed522,'entity\x20found',JSON['stringify'](_0x539c3d));if(_0x4d27a5[_0xe3fa('0x78')]['type']===_0xe3fa('0xb2')){return _0x47a33f[_0xe3fa('0x30')](_0x3ed522)[_0xe3fa('0x34')](_0xe3fa('0xb3'),_0xe3fa('0xb4'))[_0xe3fa('0x3f')](_0xe3fa('0xb5'));}else{return _0x47a33f[_0xe3fa('0x30')](_0x3ed522)[_0xe3fa('0x31')](_0x539c3d);}}})['catch'](handleError(_0x47a33f,null));};exports[_0xe3fa('0xb6')]=function(_0x5a9eda,_0x2c83a8,_0x237dd9){return db[_0xe3fa('0x44')][_0xe3fa('0x70')]({'where':{'id':_0x5a9eda['params']['id']}})[_0xe3fa('0x25')](handleEntityNotFound(_0x2c83a8,null))[_0xe3fa('0x25')](function(_0x50b42e){if(_0x50b42e){return db[_0xe3fa('0xb7')][_0xe3fa('0xb8')](function(_0x11bf48){return db['SmsApplication'][_0xe3fa('0x39')]({'where':{'SmsAccountId':_0x5a9eda[_0xe3fa('0x5d')]['id']},'transaction':_0x11bf48})[_0xe3fa('0x25')](function(_0x3ffa8d){var _0x44b10e=_[_0xe3fa('0x43')](_0x5a9eda[_0xe3fa('0x62')],function(_0x2d066d){_0x2d066d['SmsAccountId']=_0x5a9eda[_0xe3fa('0x5d')]['id'];return _0x2d066d;});return db[_0xe3fa('0x76')][_0xe3fa('0xb9')](_0x44b10e,{'transaction':_0x11bf48});});})[_0xe3fa('0x25')](function(){return db['SmsApplication'][_0xe3fa('0xba')]({'where':{'SmsAccountId':_0x5a9eda[_0xe3fa('0x5d')]['id']},'order':_0xe3fa('0x7a')});});}})[_0xe3fa('0x25')](respondWithResult(_0x2c83a8,null))['catch'](handleError(_0x2c83a8,null));};exports['getApplications']=function(_0xac6844,_0x3c52f7,_0x464812){var _0x34cb38={};var _0x2282ec={};var _0x142d8b;var _0x15eea4;return db[_0xe3fa('0x44')][_0xe3fa('0x70')]({'where':{'id':_0xac6844['params']['id']}})['then'](handleEntityNotFound(_0x3c52f7,null))[_0xe3fa('0x25')](function(_0xc1a6bc){if(_0xc1a6bc){_0x142d8b=_0xc1a6bc;_0x2282ec[_0xe3fa('0x47')]=_[_0xe3fa('0x49')](db[_0xe3fa('0x76')][_0xe3fa('0x45')]);_0x2282ec['query']=_[_0xe3fa('0x49')](_0xac6844[_0xe3fa('0x48')]);_0x2282ec['filters']=_['intersection'](_0x2282ec['model'],_0x2282ec[_0xe3fa('0x48')]);_0x34cb38['attributes']=_['intersection'](_0x2282ec[_0xe3fa('0x47')],qs[_0xe3fa('0x4d')](_0xac6844[_0xe3fa('0x48')]['fields']));_0x34cb38[_0xe3fa('0x4c')]=_0x34cb38[_0xe3fa('0x4c')][_0xe3fa('0x5e')]?_0x34cb38['attributes']:_0x2282ec[_0xe3fa('0x47')];_0x34cb38[_0xe3fa('0x51')]=qs[_0xe3fa('0x52')](_0xac6844[_0xe3fa('0x48')][_0xe3fa('0x52')]);_0x34cb38['where']=qs[_0xe3fa('0x4a')](_['pick'](_0xac6844[_0xe3fa('0x48')],_0x2282ec[_0xe3fa('0x4a')]));if(_0xac6844['query'][_0xe3fa('0x54')]){_0x34cb38[_0xe3fa('0x56')]=_[_0xe3fa('0x55')](_0x34cb38[_0xe3fa('0x56')],{'$or':_[_0xe3fa('0x43')](_0x34cb38[_0xe3fa('0x4c')],function(_0x39a6e5){var _0x13df29={};_0x13df29[_0x39a6e5]={'$like':'%'+_0xac6844['query'][_0xe3fa('0x54')]+'%'};return _0x13df29;})});}_0x34cb38=_['merge']({},_0x34cb38,_0xac6844[_0xe3fa('0x59')]);return _0x142d8b['getApplications'](_0x34cb38);}})['then'](function(_0x392b1e){if(_0x392b1e){_0x15eea4=_0x392b1e[_0xe3fa('0x5e')];if(!_0xac6844['query'][_0xe3fa('0x4e')]('nolimit')){_0x34cb38[_0xe3fa('0x50')]=qs['limit'](_0xac6844[_0xe3fa('0x48')]['limit']);_0x34cb38[_0xe3fa('0x33')]=qs['offset'](_0xac6844[_0xe3fa('0x48')][_0xe3fa('0x33')]);}return _0x142d8b[_0xe3fa('0xbb')](_0x34cb38);}})[_0xe3fa('0x25')](function(_0x515fac){if(_0x515fac){return _0x515fac?{'count':_0x15eea4,'rows':_0x515fac}:null;}})[_0xe3fa('0x25')](respondWithResult(_0x3c52f7,null))['catch'](handleError(_0x3c52f7,null));};exports['getInteractions']=function(_0x4aabe0,_0x51fe5d,_0x1be9a2){var _0x14e2f4={'raw':![],'where':{}};var _0x3a0f1b={};var _0x581895={'count':0x0,'rows':[]};return db['SmsAccount'][_0xe3fa('0x70')]({'where':{'id':_0x4aabe0[_0xe3fa('0x5d')]['id']}})['then'](handleEntityNotFound(_0x51fe5d,null))['then'](function(_0x26160b){if(_0x26160b){_0x3a0f1b['model']=_[_0xe3fa('0x49')](db[_0xe3fa('0x9e')][_0xe3fa('0x45')]);_0x3a0f1b['query']=_['keys'](_0x4aabe0['query']);_0x3a0f1b[_0xe3fa('0x4a')]=_['intersection'](_0x3a0f1b[_0xe3fa('0x47')],_0x3a0f1b[_0xe3fa('0x48')]);_0x14e2f4[_0xe3fa('0x4c')]=_[_0xe3fa('0x4b')](_0x3a0f1b[_0xe3fa('0x47')],qs[_0xe3fa('0x4d')](_0x4aabe0[_0xe3fa('0x48')][_0xe3fa('0x4d')]));_0x14e2f4[_0xe3fa('0x4c')]=_0x14e2f4['attributes']['length']?_0x14e2f4['attributes']:_0x3a0f1b[_0xe3fa('0x47')];if(!_0x4aabe0['query'][_0xe3fa('0x4e')](_0xe3fa('0x4f'))){_0x14e2f4[_0xe3fa('0x50')]=qs['limit'](_0x4aabe0[_0xe3fa('0x48')][_0xe3fa('0x50')]);_0x14e2f4['offset']=qs[_0xe3fa('0x33')](_0x4aabe0[_0xe3fa('0x48')][_0xe3fa('0x33')]);}_0x14e2f4['order']=qs[_0xe3fa('0x52')](_0x4aabe0['query'][_0xe3fa('0x52')]);_0x14e2f4[_0xe3fa('0x56')]=qs[_0xe3fa('0x4a')](_[_0xe3fa('0x53')](_0x4aabe0[_0xe3fa('0x48')],_0x3a0f1b[_0xe3fa('0x4a')]));_0x14e2f4[_0xe3fa('0x56')][_0xe3fa('0x6c')]=_0x26160b['id'];if(_0x4aabe0[_0xe3fa('0x48')][_0xe3fa('0x54')]){_0x14e2f4[_0xe3fa('0x56')]=_[_0xe3fa('0x55')](_0x14e2f4[_0xe3fa('0x56')],{'$or':_['map'](_0x14e2f4[_0xe3fa('0x4c')],function(_0x486e88){var _0x2be679={};_0x2be679[_0x486e88]={'$like':'%'+_0x4aabe0[_0xe3fa('0x48')][_0xe3fa('0x54')]+'%'};return _0x2be679;})});}_0x14e2f4=_[_0xe3fa('0x55')]({},_0x14e2f4,_0x4aabe0['options']);return db[_0xe3fa('0x9e')][_0xe3fa('0x32')]({'where':_0x14e2f4[_0xe3fa('0x56')]})['then'](function(_0xfaf187){_0x581895['count']=_0xfaf187;if(_0x4aabe0['query'][_0xe3fa('0x5f')]){_0x14e2f4['include']=[{'model':db[_0xe3fa('0x9a')],'as':_0xe3fa('0xbc'),'required':![]},{'model':db[_0xe3fa('0xbd')],'as':_0xe3fa('0xbe'),'attributes':['name',_0xe3fa('0xbf'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xe3fa('0xc0'),'attributes':['id',_0xe3fa('0x3e'),_0xe3fa('0xc1')],'where':_0x4aabe0[_0xe3fa('0x48')][_0xe3fa('0xc2')]?{'id':_0x4aabe0['query'][_0xe3fa('0xc2')]}:undefined,'required':_0x4aabe0['query']['tag']?!![]:![]}];}return db[_0xe3fa('0x9e')][_0xe3fa('0x72')](_0x14e2f4);})[_0xe3fa('0x25')](function(_0x5dfbcd){_0x581895['rows']=_0x5dfbcd;return _0x581895;});}})[_0xe3fa('0x25')](respondWithFilteredResult(_0x51fe5d,_0x14e2f4))['catch'](handleError(_0x51fe5d,null));};exports[_0xe3fa('0x3f')]=function(_0x4bb8aa,_0x20d064,_0x29328f){var _0x316ec4,_0x585910,_0x4a4f30;if(_[_0xe3fa('0x96')](_0x4bb8aa[_0xe3fa('0x62')][_0xe3fa('0x62')])||_0x4bb8aa[_0xe3fa('0x62')][_0xe3fa('0x62')]===''){throw new db[(_0xe3fa('0x7c'))]['ValidationError'](_0xe3fa('0xc3'));}if(_[_0xe3fa('0x96')](_0x4bb8aa['body']['to'])){throw new db[(_0xe3fa('0x7c'))][(_0xe3fa('0x7d'))](_0xe3fa('0xc4'));}_0x316ec4=_0x4bb8aa[_0xe3fa('0x62')]['to'];return db['SmsAccount']['find']({'where':{'id':_0x4bb8aa[_0xe3fa('0x5d')]['id']},'include':[{'model':db['CmList'],'as':_0xe3fa('0xc5'),'include':[{'model':db[_0xe3fa('0x9a')],'as':_0xe3fa('0x9b'),'where':{'mobile':_0x316ec4},'limit':0x1,'order':[['updatedAt',_0xe3fa('0x9c')]]}]}]})[_0xe3fa('0x25')](handleEntityNotFound(_0x20d064,null))[_0xe3fa('0x25')](function(_0x5a680e){if(_0x5a680e&&_0x5a680e['List']){_0x585910=_0x5a680e['get']({'plain':!![]});if(_0x585910[_0xe3fa('0xc5')]&&_0x585910[_0xe3fa('0xc5')]['Contacts'][_0xe3fa('0x5e')]){return _0x585910[_0xe3fa('0xc5')][_0xe3fa('0x9b')][0x0];}return db[_0xe3fa('0x9a')]['create'](_[_0xe3fa('0x1c')](_0x4bb8aa[_0xe3fa('0x62')],{'firstName':_0x316ec4,'mobile':_0x316ec4,'phone':_0x316ec4,'ListId':_0x585910[_0xe3fa('0x82')]}));}})['then'](handleEntityNotFound(_0x20d064,null))[_0xe3fa('0x25')](function(_0x358147){if(_0x358147){_0x4a4f30=_0x358147;return db[_0xe3fa('0x9e')][_0xe3fa('0x60')]({'where':{'ContactId':_0x4a4f30['id'],'closed':![],'SmsAccountId':_0x585910['id']}})['then'](function(_0x4ab962){if(_0x4ab962){return[_0x4ab962,![]];}return db[_0xe3fa('0x9e')][_0xe3fa('0x61')]({'UserId':_0x4bb8aa[_0xe3fa('0x65')]['id'],'ContactId':_0x4a4f30['id'],'SmsAccountId':_0x585910['id'],'phone':_0x316ec4,'firstMsgDirection':'out','Messages':[_[_0xe3fa('0x55')](_0x4bb8aa[_0xe3fa('0x62')],{'read':![],'body':_0x4bb8aa[_0xe3fa('0x62')][_0xe3fa('0x62')],'phone':_0x316ec4,'SmsAccountId':_0x585910['id'],'UserId':_0x4bb8aa[_0xe3fa('0x65')]['id'],'ContactId':_0x4a4f30['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xe3fa('0xc6')}]})[_0xe3fa('0x25')](function(_0x582bdd){return[_0x582bdd,!![]];});});}})[_0xe3fa('0x9f')](function(_0x374cd8,_0x3af786){if(_0x3af786){return _0x374cd8;}return db[_0xe3fa('0xa7')][_0xe3fa('0x61')](_[_0xe3fa('0x55')](_0x4bb8aa[_0xe3fa('0x62')],{'read':![],'body':_0x4bb8aa[_0xe3fa('0x62')][_0xe3fa('0x62')],'phone':_0x316ec4,'SmsAccountId':_0x585910['id'],'SmsInteractionId':_0x374cd8['id'],'UserId':_0x4bb8aa[_0xe3fa('0x65')]['id'],'ContactId':_0x4a4f30['id']}))[_0xe3fa('0x25')](function(_0x3eeaf0){_0x374cd8[_0xe3fa('0xc7')][_0xe3fa('0xc6')]=[];_0x374cd8['dataValues'][_0xe3fa('0xc6')][_0xe3fa('0xa4')](_0x3eeaf0[_0xe3fa('0xc7')]);return _0x374cd8;});})['then'](respondWithResult(_0x20d064,null))[_0xe3fa('0x2e')](handleError(_0x20d064,null));};exports[_0xe3fa('0x30')]=function(_0x3fd6d5,_0x598312,_0x4a2e84){if(_0x3fd6d5['body']['id']){delete _0x3fd6d5[_0xe3fa('0x62')]['id'];}var _0x14075c,_0x1cd5f8,_0x5cc4f7;return db[_0xe3fa('0x44')][_0xe3fa('0x60')]({'where':{'id':_0x3fd6d5[_0xe3fa('0x5d')]['id']}})[_0xe3fa('0x25')](handleEntityNotFound(_0x598312,null))[_0xe3fa('0x25')](function(_0x1db48f){if(_0x1db48f){_0x5cc4f7=_0x1db48f;logger['debug'](_0xe3fa('0x2a'),_0xe3fa('0x30'),_0xe3fa('0xc8'),_0x1db48f[_0xe3fa('0x57')],util[_0xe3fa('0xc9')](_0x3fd6d5[_0xe3fa('0x62')],{'showHidden':![],'depth':null}));switch(_0x1db48f[_0xe3fa('0x57')]){case _0xe3fa('0xca'):if(_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0xcb')]&&_0x3fd6d5['body'][_0xe3fa('0x30')]){_0x1cd5f8=_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0x30')];return db[_0xe3fa('0xa7')]['find']({'where':{'messageId':_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0xcb')]}});}break;case _0xe3fa('0x8a'):if(_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0xcc')]&&_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0xcd')]){_0x1cd5f8=_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0xcd')];return db[_0xe3fa('0xa7')][_0xe3fa('0x60')]({'where':{'messageId':_0x3fd6d5[_0xe3fa('0x62')]['requestid']}});}break;case _0xe3fa('0x8b'):if(_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0x8c')]&&_0x3fd6d5[_0xe3fa('0x62')]['status_code']){_0x1cd5f8=_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0xce')];return db[_0xe3fa('0xa7')][_0xe3fa('0x60')]({'where':{'messageId':_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0x8c')]}});}break;case'infobip':var _0x291fad=_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0x8f')][0x0];if(_0x291fad[_0xe3fa('0x87')]&&_0x291fad[_0xe3fa('0x30')]['groupName']==='DELIVERED'){_0x1cd5f8=_0x291fad[_0xe3fa('0x30')]['groupName'];return db['SmsMessage']['find']({'where':{'messageId':_0x291fad[_0xe3fa('0x87')]}});}break;case'clickatell':if(_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0x87')]&&_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0x30')]){_0x1cd5f8=_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0x30')];return db[_0xe3fa('0xa7')]['find']({'where':{'messageId':_0x3fd6d5['body']['messageId']}});}break;case _0xe3fa('0x93'):if(_0x3fd6d5[_0xe3fa('0x62')][0x0][_0xe3fa('0x2c')]['id']){_0x1cd5f8=_0x3fd6d5[_0xe3fa('0x62')][0x0][_0xe3fa('0x57')];return db[_0xe3fa('0xa7')][_0xe3fa('0x60')]({'where':{'messageId':_0x3fd6d5['body'][0x0]['message']['id']}});}break;case _0xe3fa('0x94'):if(_0x3fd6d5['body'][_0xe3fa('0xcf')]&&_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0x30')]){_0x1cd5f8=_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0x30')];return db['SmsMessage']['find']({'where':{'messageId':_0x3fd6d5['body'][_0xe3fa('0xcf')]}});}break;}}})[_0xe3fa('0x25')](handleEntityNotFound(_0x598312,null))['then'](function(_0x2c4a1d){if(_0x2c4a1d){_0x14075c=_0x2c4a1d;switch(_0x5cc4f7[_0xe3fa('0x57')]){case'skebby':if(_0x1cd5f8===_0xe3fa('0xd0')){return _0x14075c[_0xe3fa('0x6a')]({'read':!![]});}else{logger[_0xe3fa('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe3fa('0x30'),_0xe3fa('0xca'),util[_0xe3fa('0xc9')](_0x3fd6d5[_0xe3fa('0x62')],{'showHidden':![],'depth':null}));}break;case _0xe3fa('0x8a'):if(_0x1cd5f8==='1'){return _0x14075c[_0xe3fa('0x6a')]({'read':!![]});}else{logger[_0xe3fa('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe3fa('0x30'),_0xe3fa('0xca'),util[_0xe3fa('0xc9')](_0x3fd6d5[_0xe3fa('0x62')],{'showHidden':![],'depth':null}));}break;case _0xe3fa('0x8b'):if(!_0x3fd6d5['body'][_0xe3fa('0xd1')]&&_0x1cd5f8>=0xc8&&_0x1cd5f8<=0xce){return _0x14075c[_0xe3fa('0x6a')]({'read':!![]});}else{logger[_0xe3fa('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe3fa('0x30'),_0xe3fa('0x8b'),util[_0xe3fa('0xc9')](_0x3fd6d5[_0xe3fa('0x62')],{'showHidden':![],'depth':null}));}break;case _0xe3fa('0x8e'):var _0x1fbf59=_0x3fd6d5[_0xe3fa('0x62')][_0xe3fa('0x8f')][0x0];if(_0x1fbf59[_0xe3fa('0x30')][_0xe3fa('0xd2')]==='DELIVERED'){return _0x14075c[_0xe3fa('0x6a')]({'read':!![]});}else{logger['error'](_0xe3fa('0x2a'),'status',_0xe3fa('0x8e'),util[_0xe3fa('0xc9')](_0x3fd6d5[_0xe3fa('0x62')],{'showHidden':![],'depth':null}));}break;case _0xe3fa('0xd3'):if(_0x1cd5f8==_0xe3fa('0xd4')||_0x1cd5f8==_0xe3fa('0xd5')){return _0x14075c[_0xe3fa('0x6a')]({'read':!![]});}else{logger[_0xe3fa('0x2b')](_0xe3fa('0x2a'),_0xe3fa('0x30'),_0xe3fa('0xd3'),util[_0xe3fa('0xc9')](_0x3fd6d5[_0xe3fa('0x62')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x1cd5f8=='message-delivered'){return _0x14075c[_0xe3fa('0x6a')]({'read':!![]});}else{logger[_0xe3fa('0x2b')](_0xe3fa('0x2a'),_0xe3fa('0x30'),_0xe3fa('0x93'),util[_0xe3fa('0xc9')](_0x3fd6d5[_0xe3fa('0x62')],{'showHidden':![],'depth':null}));}break;case _0xe3fa('0x94'):if(_0x1cd5f8==='DELIVRD'||_0x1cd5f8===_0xe3fa('0xd6')){return _0x14075c['update']({'read':!![]});}else{logger[_0xe3fa('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe3fa('0x30'),_0xe3fa('0x94'),util['inspect'](_0x3fd6d5[_0xe3fa('0x62')],{'showHidden':![],'depth':null}));}break;}return _0x14075c;}})[_0xe3fa('0x25')](respondWithResult(_0x598312,null))[_0xe3fa('0x2e')](handleError(_0x598312,null));};exports['statusGet']=function(_0x3a78a8,_0x50df5e,_0x33e7a9){var _0x19dc26,_0x3a10b9,_0x535923;return db['SmsAccount']['find']({'where':{'id':_0x3a78a8[_0xe3fa('0x5d')]['id']}})[_0xe3fa('0x25')](handleEntityNotFound(_0x50df5e,null))[_0xe3fa('0x25')](function(_0x472a10){if(_0x472a10){_0x535923=_0x472a10;logger[_0xe3fa('0x29')](_0xe3fa('0x2a'),_0xe3fa('0x30'),_0xe3fa('0xc8'),_0x472a10[_0xe3fa('0x57')],util[_0xe3fa('0xc9')](_0x3a78a8[_0xe3fa('0x48')],{'showHidden':![],'depth':null}));switch(_0x472a10[_0xe3fa('0x57')]){case _0xe3fa('0x90'):if(_0x3a78a8[_0xe3fa('0x48')][_0xe3fa('0xd7')]&&_0x3a78a8[_0xe3fa('0x48')][_0xe3fa('0xd8')]){_0x3a10b9=_0x3a78a8[_0xe3fa('0x48')]['state'];return db[_0xe3fa('0xa7')]['find']({'where':{'messageId':_0x3a78a8[_0xe3fa('0x48')]['message-id']}});}break;}}})[_0xe3fa('0x25')](handleEntityNotFound(_0x50df5e,null))[_0xe3fa('0x25')](function(_0x1930ba){if(_0x1930ba){_0x19dc26=_0x1930ba;switch(_0x535923[_0xe3fa('0x57')]){case _0xe3fa('0x90'):if(_0x3a10b9==='2'||_0x3a10b9==='6'){return _0x19dc26[_0xe3fa('0x6a')]({'read':!![]});}else{logger[_0xe3fa('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xe3fa('0x90'),util[_0xe3fa('0xc9')](_0x3a78a8['query'],{'showHidden':![],'depth':null}));};break;}return _0x19dc26;}})[_0xe3fa('0x25')](respondWithResult(_0x50df5e,null))[_0xe3fa('0x2e')](handleError(_0x50df5e,null));};exports[_0xe3fa('0xd9')]=function(_0x46df64,_0x589ded,_0x4546d4){return db[_0xe3fa('0x44')]['find']({'where':{'id':_0x46df64[_0xe3fa('0x5d')]['id']}})[_0xe3fa('0x25')](handleEntityNotFound(_0x589ded,null))[_0xe3fa('0x25')](function(_0x184c31){if(_0x184c31){return _0x184c31[_0xe3fa('0xd9')](_0x46df64[_0xe3fa('0x62')][_0xe3fa('0x74')],_[_0xe3fa('0x9d')](_0x46df64[_0xe3fa('0x62')],[_0xe3fa('0x74'),'id'])||{})[_0xe3fa('0x9f')](function(_0x415c4b){for(var _0x186d00=0x0;_0x186d00<_0x46df64[_0xe3fa('0x62')][_0xe3fa('0x74')]['length'];_0x186d00+=0x1){socket[_0xe3fa('0xda')](_0xe3fa('0xdb'),{'UserId':_0x46df64[_0xe3fa('0x62')][_0xe3fa('0x74')][_0x186d00],'SmsAccountId':_0x46df64[_0xe3fa('0x5d')]['id']});}return _0x415c4b;});}})[_0xe3fa('0x25')](respondWithResult(_0x589ded,null))[_0xe3fa('0x2e')](handleError(_0x589ded,null));};exports[_0xe3fa('0xdc')]=function(_0xd490bc,_0xb7afa,_0xb9bf59){return db['SmsAccount']['find']({'where':{'id':_0xd490bc[_0xe3fa('0x5d')]['id']}})[_0xe3fa('0x25')](handleEntityNotFound(_0xb7afa,null))[_0xe3fa('0x25')](function(_0x51f237){if(_0x51f237){return _0x51f237[_0xe3fa('0xdc')](_0xd490bc[_0xe3fa('0x48')][_0xe3fa('0x74')])['then'](function(){if(_[_0xe3fa('0xdd')](_0xd490bc[_0xe3fa('0x48')]['ids'])){for(var _0x2527f3=0x0;_0x2527f3<_0xd490bc['query'][_0xe3fa('0x74')][_0xe3fa('0x5e')];_0x2527f3+=0x1){socket[_0xe3fa('0xda')](_0xe3fa('0xde'),{'UserId':Number(_0xd490bc[_0xe3fa('0x48')][_0xe3fa('0x74')][_0x2527f3]),'SmsAccountId':Number(_0xd490bc[_0xe3fa('0x5d')]['id'])});}}else{socket[_0xe3fa('0xda')](_0xe3fa('0xde'),{'UserId':Number(_0xd490bc[_0xe3fa('0x48')][_0xe3fa('0x74')]),'SmsAccountId':Number(_0xd490bc['params']['id'])});}});}})[_0xe3fa('0x25')](respondWithStatusCode(_0xb7afa,null))[_0xe3fa('0x2e')](handleError(_0xb7afa,null));};exports[_0xe3fa('0xdf')]=function(_0xc5aad8,_0x1dac95,_0x22bf37){var _0x59cf61={};var _0x5978a5={};var _0x45d88e;var _0x48afb6;return db[_0xe3fa('0x44')]['findOne']({'where':{'id':_0xc5aad8[_0xe3fa('0x5d')]['id']}})[_0xe3fa('0x25')](handleEntityNotFound(_0x1dac95,null))[_0xe3fa('0x25')](function(_0x48aded){if(_0x48aded){_0x45d88e=_0x48aded;_0x5978a5[_0xe3fa('0x47')]=_[_0xe3fa('0x49')](db['User'][_0xe3fa('0x45')]);_0x5978a5['query']=_[_0xe3fa('0x49')](_0xc5aad8[_0xe3fa('0x48')]);_0x5978a5[_0xe3fa('0x4a')]=_[_0xe3fa('0x4b')](_0x5978a5[_0xe3fa('0x47')],_0x5978a5[_0xe3fa('0x48')]);_0x59cf61[_0xe3fa('0x4c')]=_['intersection'](_0x5978a5[_0xe3fa('0x47')],qs[_0xe3fa('0x4d')](_0xc5aad8['query']['fields']));_0x59cf61[_0xe3fa('0x4c')]=_0x59cf61[_0xe3fa('0x4c')][_0xe3fa('0x5e')]?_0x59cf61[_0xe3fa('0x4c')]:_0x5978a5[_0xe3fa('0x47')];_0x59cf61['order']=qs[_0xe3fa('0x52')](_0xc5aad8[_0xe3fa('0x48')][_0xe3fa('0x52')]);_0x59cf61[_0xe3fa('0x56')]=qs[_0xe3fa('0x4a')](_[_0xe3fa('0x53')](_0xc5aad8[_0xe3fa('0x48')],_0x5978a5[_0xe3fa('0x4a')]));if(_0xc5aad8[_0xe3fa('0x48')][_0xe3fa('0x54')]){_0x59cf61[_0xe3fa('0x56')]=_[_0xe3fa('0x55')](_0x59cf61[_0xe3fa('0x56')],{'$or':_[_0xe3fa('0x43')](_0x59cf61['attributes'],function(_0x3bfef7){var _0x571bc1={};_0x571bc1[_0x3bfef7]={'$like':'%'+_0xc5aad8['query'][_0xe3fa('0x54')]+'%'};return _0x571bc1;})});}_0x59cf61=_[_0xe3fa('0x55')]({},_0x59cf61,_0xc5aad8[_0xe3fa('0x59')]);return _0x45d88e[_0xe3fa('0xdf')](_0x59cf61);}})[_0xe3fa('0x25')](function(_0x5599ef){if(_0x5599ef){_0x48afb6=_0x5599ef[_0xe3fa('0x5e')];if(!_0xc5aad8[_0xe3fa('0x48')][_0xe3fa('0x4e')](_0xe3fa('0x4f'))){_0x59cf61[_0xe3fa('0x50')]=qs[_0xe3fa('0x50')](_0xc5aad8[_0xe3fa('0x48')][_0xe3fa('0x50')]);_0x59cf61[_0xe3fa('0x33')]=qs[_0xe3fa('0x33')](_0xc5aad8[_0xe3fa('0x48')][_0xe3fa('0x33')]);}return _0x45d88e[_0xe3fa('0xdf')](_0x59cf61);}})['then'](function(_0xbfc7ef){if(_0xbfc7ef){return _0xbfc7ef?{'count':_0x48afb6,'rows':_0xbfc7ef}:null;}})[_0xe3fa('0x25')](respondWithResult(_0x1dac95,null))['catch'](handleError(_0x1dac95,null));}; \ No newline at end of file +var _0xfb9e=['describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','CannedAnswer','getAnswers','rows','removeAnswers','ids','sms','Applications','applications','priority','account','CmContact','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','mobile','twilio','From','Body','messageId','from','sender','text','connectel','clicksend','MessageUUID','infobip','results','originatingAddress','segmentedMessage','clickatell','fromNumber','bandwidth','refid','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','list','SmsInteraction','interaction','created','autoclose','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','sequelize','SmsApplication','findAndCountAll','getApplications','getInteractions','Contact','User','fullname','internal','Tag','color','tag','send','to\x20is\x20mandatory','List','DESC','out','Messages','spread','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','message_id','status_code','groupName','DELIVERED','intelepeer','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','statusGet','csc','message-id','state','addAgents','omit','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','get','SmsAccounts','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','name','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','SmsAccount','includeAll','include','findAll','show','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'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xfb9e,0x161));var _0xefb9=function(_0x36d203,_0x3653f3){_0x36d203=_0x36d203-0x0;var _0x2f9e62=_0xfb9e[_0x36d203];return _0x2f9e62;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xefb9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xefb9('0x1'));var rp=require(_0xefb9('0x2'));var moment=require(_0xefb9('0x3'));var BPromise=require(_0xefb9('0x4'));var Mustache=require(_0xefb9('0x5'));var util=require(_0xefb9('0x6'));var path=require(_0xefb9('0x7'));var sox=require('sox');var csv=require(_0xefb9('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xefb9('0x9'));var squel=require('squel');var crypto=require(_0xefb9('0xa'));var jsforce=require(_0xefb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xefb9('0x8'));var querystring=require(_0xefb9('0xc'));var Papa=require(_0xefb9('0xd'));var Redis=require(_0xefb9('0xe'));var authService=require(_0xefb9('0xf'));var qs=require(_0xefb9('0x10'));var as=require(_0xefb9('0x11'));var hardwareService=require(_0xefb9('0x12'));var logger=require(_0xefb9('0x13'))(_0xefb9('0x14'));var utils=require(_0xefb9('0x15'));var config=require(_0xefb9('0x16'));var licenseUtil=require(_0xefb9('0x17'));var db=require(_0xefb9('0x18'))['db'];config[_0xefb9('0x19')]=_[_0xefb9('0x1a')](config['redis'],{'host':_0xefb9('0x1b'),'port':0x18eb});var socket=require(_0xefb9('0x1c'))(new Redis(config[_0xefb9('0x19')]));require(_0xefb9('0x1d'))[_0xefb9('0x1e')](socket);var jayson=require(_0xefb9('0x1f'));var client=jayson[_0xefb9('0x20')]['http']({'port':0x232c});function respondWithRpcPromise(_0x24092d,_0x523f93,_0x44e90d,_0x2821f1){return new BPromise(function(_0x27e5d2,_0x46f97b){var _0x25188e=_0x2821f1||client;return _0x25188e[_0xefb9('0x21')](_0x24092d,_0x44e90d)[_0xefb9('0x22')](function(_0x4f51f0){logger[_0xefb9('0x23')](_0xefb9('0x24'),_0x523f93,_0xefb9('0x25'));logger[_0xefb9('0x26')](_0xefb9('0x27'),_0x523f93,_0xefb9('0x25'),JSON[_0xefb9('0x28')](_0x4f51f0));if(_0x4f51f0['error']){if(_0x4f51f0[_0xefb9('0x29')][_0xefb9('0x2a')]===0x1f4){logger[_0xefb9('0x29')](_0xefb9('0x24'),_0x523f93,_0x4f51f0[_0xefb9('0x29')]['message']);return _0x46f97b(_0x4f51f0[_0xefb9('0x29')][_0xefb9('0x2b')]);}logger[_0xefb9('0x29')](_0xefb9('0x24'),_0x523f93,_0x4f51f0[_0xefb9('0x29')][_0xefb9('0x2b')]);return _0x27e5d2(_0x4f51f0['error'][_0xefb9('0x2b')]);}else{logger['info'](_0xefb9('0x24'),_0x523f93,_0xefb9('0x25'));_0x27e5d2(_0x4f51f0[_0xefb9('0x2c')][_0xefb9('0x2b')]);}})[_0xefb9('0x2d')](function(_0x4250bd){logger[_0xefb9('0x29')](_0xefb9('0x24'),_0x523f93,_0x4250bd);_0x46f97b(_0x4250bd);});});}function respondWithStatusCode(_0x471171,_0x4929a1){_0x4929a1=_0x4929a1||0xcc;return function(_0xcc94a8){if(_0xcc94a8){return _0x471171[_0xefb9('0x2e')](_0x4929a1);}return _0x471171[_0xefb9('0x2f')](_0x4929a1)[_0xefb9('0x30')]();};}function respondWithResult(_0x376d28,_0x543d85){_0x543d85=_0x543d85||0xc8;return function(_0x27b069){if(_0x27b069){return _0x376d28[_0xefb9('0x2f')](_0x543d85)[_0xefb9('0x31')](_0x27b069);}};}function respondWithFilteredResult(_0x51176b,_0x57cbe1){return function(_0x18ca8c){if(_0x18ca8c){var _0x183c2a=_0x18ca8c[_0xefb9('0x32')],_0x2bb1a7=_0x57cbe1[_0xefb9('0x33')],_0x4d3d4a=_0x57cbe1['offset']+_0x57cbe1[_0xefb9('0x34')],_0x155ce4;if(_0x4d3d4a>=_0x183c2a){_0x4d3d4a=_0x183c2a;_0x155ce4=0xc8;}else{_0x155ce4=0xce;}_0x51176b[_0xefb9('0x2f')](_0x155ce4);return _0x51176b[_0xefb9('0x35')](_0xefb9('0x36'),_0x2bb1a7+'-'+_0x4d3d4a+'/'+_0x183c2a)[_0xefb9('0x31')](_0x18ca8c);}return null;};}function patchUpdates(_0x3b2207){return function(_0x2ae71e){try{jsonpatch[_0xefb9('0x37')](_0x2ae71e,_0x3b2207,!![]);}catch(_0x20e413){return BPromise[_0xefb9('0x38')](_0x20e413);}return _0x2ae71e['save']();};}function saveUpdates(_0x2470ac,_0x4f3ff5){return function(_0xe2a304){if(_0xe2a304){return _0xe2a304[_0xefb9('0x39')](_0x2470ac)[_0xefb9('0x22')](function(_0x4ad0cc){return _0x4ad0cc;});}return null;};}function removeEntity(_0x4b2ef8,_0x491944){return function(_0x2486f1){if(_0x2486f1){return _0x2486f1[_0xefb9('0x3a')]()[_0xefb9('0x22')](function(){var _0x416719=_0x2486f1[_0xefb9('0x3b')]({'plain':!![]});var _0x37cb02=_0xefb9('0x3c');return db['UserProfileResource'][_0xefb9('0x3a')]({'where':{'type':_0x37cb02,'resourceId':_0x416719['id']}})[_0xefb9('0x22')](function(){return _0x2486f1;});})[_0xefb9('0x22')](function(){_0x4b2ef8[_0xefb9('0x2f')](0xcc)[_0xefb9('0x30')]();});}};}function handleEntityNotFound(_0x497bd0,_0x557469){return function(_0x5914bb){if(!_0x5914bb){_0x497bd0['sendStatus'](0x194);}return _0x5914bb;};}function handleError(_0x403837,_0x1ac4a9){_0x1ac4a9=_0x1ac4a9||0x1f4;return function(_0x17c9af){logger[_0xefb9('0x29')](_0x17c9af['stack']);if(_0x17c9af['name']){delete _0x17c9af['name'];}_0x403837[_0xefb9('0x2f')](_0x1ac4a9)['send'](_0x17c9af);};}exports['index']=function(_0x18a72c,_0x4dd3b1){var _0x1f169={'include':[{'model':db[_0xefb9('0x3d')],'as':_0xefb9('0x3e')}]},_0x2eeafc={},_0x44408d={'count':0x0,'rows':[]};var _0x213222=_[_0xefb9('0x3f')](db['SmsAccount'][_0xefb9('0x40')],function(_0x3f5d1a){return{'name':_0x3f5d1a[_0xefb9('0x41')],'type':_0x3f5d1a[_0xefb9('0x42')][_0xefb9('0x43')]};});_0x2eeafc[_0xefb9('0x44')]=_['map'](_0x213222,_0xefb9('0x45'));_0x2eeafc['query']=_[_0xefb9('0x46')](_0x18a72c['query']);_0x2eeafc[_0xefb9('0x47')]=_[_0xefb9('0x48')](_0x2eeafc[_0xefb9('0x44')],_0x2eeafc[_0xefb9('0x49')]);_0x1f169[_0xefb9('0x4a')]=_[_0xefb9('0x48')](_0x2eeafc[_0xefb9('0x44')],qs[_0xefb9('0x4b')](_0x18a72c['query'][_0xefb9('0x4b')]));_0x1f169['attributes']=_0x1f169[_0xefb9('0x4a')][_0xefb9('0x4c')]?_0x1f169[_0xefb9('0x4a')]:_0x2eeafc[_0xefb9('0x44')];if(!_0x18a72c[_0xefb9('0x49')][_0xefb9('0x4d')]('nolimit')){_0x1f169[_0xefb9('0x34')]=qs[_0xefb9('0x34')](_0x18a72c['query'][_0xefb9('0x34')]);_0x1f169['offset']=qs['offset'](_0x18a72c['query'][_0xefb9('0x33')]);}_0x1f169[_0xefb9('0x4e')]=qs[_0xefb9('0x4f')](_0x18a72c[_0xefb9('0x49')][_0xefb9('0x4f')]);_0x1f169[_0xefb9('0x50')]=qs[_0xefb9('0x47')](_[_0xefb9('0x51')](_0x18a72c[_0xefb9('0x49')],_0x2eeafc[_0xefb9('0x47')]),_0x213222);if(_0x18a72c[_0xefb9('0x49')][_0xefb9('0x52')]){_0x1f169[_0xefb9('0x50')]=_[_0xefb9('0x53')](_0x1f169[_0xefb9('0x50')],{'$or':_[_0xefb9('0x3f')](_0x213222,function(_0x229aba){if(_0x229aba[_0xefb9('0x42')]!==_0xefb9('0x54')){var _0x3f411f={};_0x3f411f[_0x229aba[_0xefb9('0x45')]]={'$like':'%'+_0x18a72c['query'][_0xefb9('0x52')]+'%'};return _0x3f411f;}})});}_0x1f169=_[_0xefb9('0x53')]({},_0x1f169,_0x18a72c[_0xefb9('0x55')]);var _0x1a8a9a={'where':_0x1f169[_0xefb9('0x50')]};return db[_0xefb9('0x56')][_0xefb9('0x32')](_0x1a8a9a)[_0xefb9('0x22')](function(_0x258efa){_0x44408d[_0xefb9('0x32')]=_0x258efa;if(_0x18a72c['query'][_0xefb9('0x57')]){_0x1f169[_0xefb9('0x58')]=[{'all':!![]}];}return db[_0xefb9('0x56')][_0xefb9('0x59')](_0x1f169);})['then'](function(_0x6cf32c){_0x44408d['rows']=_0x6cf32c;return _0x44408d;})[_0xefb9('0x22')](respondWithFilteredResult(_0x4dd3b1,_0x1f169))['catch'](handleError(_0x4dd3b1,null));};exports[_0xefb9('0x5a')]=function(_0x48e065,_0x45d702){var _0x39c164={'raw':![],'where':{'id':_0x48e065['params']['id']},'include':[{'model':db['Pause'],'as':_0xefb9('0x3e')}]},_0x2316ff={};_0x2316ff[_0xefb9('0x44')]=_[_0xefb9('0x46')](db[_0xefb9('0x56')][_0xefb9('0x40')]);_0x2316ff['query']=_[_0xefb9('0x46')](_0x48e065['query']);_0x2316ff[_0xefb9('0x47')]=_[_0xefb9('0x48')](_0x2316ff['model'],_0x2316ff[_0xefb9('0x49')]);_0x39c164[_0xefb9('0x4a')]=_[_0xefb9('0x48')](_0x2316ff[_0xefb9('0x44')],qs[_0xefb9('0x4b')](_0x48e065[_0xefb9('0x49')][_0xefb9('0x4b')]));_0x39c164[_0xefb9('0x4a')]=_0x39c164[_0xefb9('0x4a')][_0xefb9('0x4c')]?_0x39c164[_0xefb9('0x4a')]:_0x2316ff[_0xefb9('0x44')];if(_0x48e065['query']['includeAll']){_0x39c164[_0xefb9('0x58')]=[{'all':!![]}];}_0x39c164=_[_0xefb9('0x53')]({},_0x39c164,_0x48e065[_0xefb9('0x55')]);return db['SmsAccount'][_0xefb9('0x5b')](_0x39c164)[_0xefb9('0x22')](handleEntityNotFound(_0x45d702,null))[_0xefb9('0x22')](respondWithResult(_0x45d702,null))[_0xefb9('0x2d')](handleError(_0x45d702,null));};exports[_0xefb9('0x5c')]=function(_0x200825,_0x23d51d){return db[_0xefb9('0x56')][_0xefb9('0x5c')](_0x200825[_0xefb9('0x5d')],{})['then'](function(_0x4a700d){var _0x27ad56=_0x200825[_0xefb9('0x5e')][_0xefb9('0x3b')]({'plain':!![]});if(!_0x27ad56)throw new Error(_0xefb9('0x5f'));if(_0x27ad56[_0xefb9('0x60')]==='user'){var _0x4e0ffd=_0x4a700d[_0xefb9('0x3b')]({'plain':!![]});var _0x25fc42=_0xefb9('0x3c');return db[_0xefb9('0x61')][_0xefb9('0x5b')]({'where':{'name':_0x25fc42,'userProfileId':_0x27ad56[_0xefb9('0x62')]},'raw':!![]})['then'](function(_0x3d392f){if(_0x3d392f&&_0x3d392f[_0xefb9('0x63')]===0x0){return db[_0xefb9('0x64')]['create']({'name':_0x4e0ffd[_0xefb9('0x45')],'resourceId':_0x4e0ffd['id'],'type':_0x3d392f[_0xefb9('0x45')],'sectionId':_0x3d392f['id']},{})[_0xefb9('0x22')](function(){return _0x4a700d;});}else{return _0x4a700d;}})['catch'](function(_0x25ea28){logger[_0xefb9('0x29')](_0xefb9('0x65'),_0x25ea28);throw _0x25ea28;});}return _0x4a700d;})[_0xefb9('0x22')](respondWithResult(_0x23d51d,0xc9))[_0xefb9('0x2d')](handleError(_0x23d51d,null));};exports['update']=function(_0x1f2666,_0x4088ca){if(_0x1f2666[_0xefb9('0x5d')]['id']){delete _0x1f2666[_0xefb9('0x5d')]['id'];}return db[_0xefb9('0x56')]['find']({'where':{'id':_0x1f2666[_0xefb9('0x66')]['id']},'include':[{'model':db[_0xefb9('0x3d')],'as':'mandatoryDispositionPause'}]})[_0xefb9('0x22')](handleEntityNotFound(_0x4088ca,null))['then'](saveUpdates(_0x1f2666[_0xefb9('0x5d')],null))[_0xefb9('0x22')](respondWithResult(_0x4088ca,null))['catch'](handleError(_0x4088ca,null));};exports[_0xefb9('0x3a')]=function(_0x1616a4,_0x5c6021){return db[_0xefb9('0x56')][_0xefb9('0x5b')]({'where':{'id':_0x1616a4['params']['id']}})[_0xefb9('0x22')](handleEntityNotFound(_0x5c6021,null))[_0xefb9('0x22')](removeEntity(_0x5c6021,null))[_0xefb9('0x2d')](handleError(_0x5c6021,null));};exports[_0xefb9('0x67')]=function(_0x2df4a1,_0x3d2930){return db[_0xefb9('0x56')][_0xefb9('0x67')]()[_0xefb9('0x22')](respondWithResult(_0x3d2930,null))[_0xefb9('0x2d')](handleError(_0x3d2930,null));};exports[_0xefb9('0x68')]=function(_0x39c137,_0x3fcf39,_0x5f5200){if(_0x39c137[_0xefb9('0x5d')]['id']){delete _0x39c137[_0xefb9('0x5d')]['id'];}return db[_0xefb9('0x56')][_0xefb9('0x5b')]({'where':{'id':_0x39c137['params']['id']}})[_0xefb9('0x22')](handleEntityNotFound(_0x3fcf39,null))[_0xefb9('0x22')](function(_0xa9c598){if(_0xa9c598){_0x39c137[_0xefb9('0x5d')][_0xefb9('0x69')]=_0xa9c598['id'];return db[_0xefb9('0x6a')][_0xefb9('0x5c')](_0x39c137[_0xefb9('0x5d')]);}})[_0xefb9('0x22')](respondWithResult(_0x3fcf39,null))[_0xefb9('0x2d')](handleError(_0x3fcf39,null));};exports[_0xefb9('0x6b')]=function(_0x2710ba,_0x25db15,_0x5e1466){var _0x5a3ee0={'raw':![],'where':{}};var _0x49acaf={};var _0x4c4711={'count':0x0,'rows':[]};return db[_0xefb9('0x56')][_0xefb9('0x6c')]({'where':{'id':_0x2710ba[_0xefb9('0x66')]['id']}})[_0xefb9('0x22')](handleEntityNotFound(_0x25db15,null))[_0xefb9('0x22')](function(_0x214e6f){if(_0x214e6f){_0x49acaf[_0xefb9('0x44')]=_[_0xefb9('0x46')](db['Disposition'][_0xefb9('0x40')]);_0x49acaf[_0xefb9('0x49')]=_[_0xefb9('0x46')](_0x2710ba['query']);_0x49acaf[_0xefb9('0x47')]=_['intersection'](_0x49acaf[_0xefb9('0x44')],_0x49acaf[_0xefb9('0x49')]);_0x5a3ee0[_0xefb9('0x4a')]=_[_0xefb9('0x48')](_0x49acaf[_0xefb9('0x44')],qs[_0xefb9('0x4b')](_0x2710ba[_0xefb9('0x49')][_0xefb9('0x4b')]));_0x5a3ee0[_0xefb9('0x4a')]=_0x5a3ee0['attributes'][_0xefb9('0x4c')]?_0x5a3ee0[_0xefb9('0x4a')]:_0x49acaf[_0xefb9('0x44')];if(!_0x2710ba[_0xefb9('0x49')][_0xefb9('0x4d')](_0xefb9('0x6d'))){_0x5a3ee0[_0xefb9('0x34')]=qs[_0xefb9('0x34')](_0x2710ba[_0xefb9('0x49')][_0xefb9('0x34')]);_0x5a3ee0[_0xefb9('0x33')]=qs[_0xefb9('0x33')](_0x2710ba[_0xefb9('0x49')]['offset']);}_0x5a3ee0[_0xefb9('0x4e')]=qs[_0xefb9('0x4f')](_0x2710ba[_0xefb9('0x49')]['sort']);_0x5a3ee0[_0xefb9('0x50')]=qs['filters'](_['pick'](_0x2710ba['query'],_0x49acaf[_0xefb9('0x47')]));_0x5a3ee0[_0xefb9('0x50')][_0xefb9('0x69')]=_0x214e6f['id'];if(_0x2710ba[_0xefb9('0x49')]['filter']){_0x5a3ee0[_0xefb9('0x50')]=_[_0xefb9('0x53')](_0x5a3ee0['where'],{'$or':_[_0xefb9('0x3f')](_0x5a3ee0['attributes'],function(_0x43c382){var _0x3ccae7={};_0x3ccae7[_0x43c382]={'$like':'%'+_0x2710ba[_0xefb9('0x49')][_0xefb9('0x52')]+'%'};return _0x3ccae7;})});}_0x5a3ee0=_['merge']({},_0x5a3ee0,_0x2710ba[_0xefb9('0x55')]);return db['Disposition'][_0xefb9('0x32')]({'where':_0x5a3ee0[_0xefb9('0x50')]})[_0xefb9('0x22')](function(_0x43c16b){_0x4c4711[_0xefb9('0x32')]=_0x43c16b;if(_0x2710ba[_0xefb9('0x49')][_0xefb9('0x57')]){_0x5a3ee0[_0xefb9('0x58')]=[{'all':!![]}];}return db[_0xefb9('0x6a')][_0xefb9('0x59')](_0x5a3ee0);})['then'](function(_0x3eab55){_0x4c4711['rows']=_0x3eab55;return _0x4c4711;});}})['then'](respondWithFilteredResult(_0x25db15,_0x5a3ee0))['catch'](handleError(_0x25db15,null));};exports[_0xefb9('0x6e')]=function(_0x33fe35,_0x3a4fda,_0x57a259){return db[_0xefb9('0x56')]['find']({'where':{'id':_0x33fe35[_0xefb9('0x66')]['id']}})[_0xefb9('0x22')](handleEntityNotFound(_0x3a4fda,null))['then'](function(_0x424e9e){if(_0x424e9e){return _0x424e9e[_0xefb9('0x6e')](_0x33fe35[_0xefb9('0x49')]['ids']);}})[_0xefb9('0x22')](respondWithStatusCode(_0x3a4fda,null))[_0xefb9('0x2d')](handleError(_0x3a4fda,null));};exports['addAnswer']=function(_0x41aa4c,_0x268a38,_0x521c81){if(_0x41aa4c[_0xefb9('0x5d')]['id']){delete _0x41aa4c[_0xefb9('0x5d')]['id'];}return db[_0xefb9('0x56')][_0xefb9('0x5b')]({'where':{'id':_0x41aa4c['params']['id']}})[_0xefb9('0x22')](handleEntityNotFound(_0x268a38,null))[_0xefb9('0x22')](function(_0x2fa69a){if(_0x2fa69a){_0x41aa4c[_0xefb9('0x5d')][_0xefb9('0x69')]=_0x2fa69a['id'];return db[_0xefb9('0x6f')][_0xefb9('0x5c')](_0x41aa4c[_0xefb9('0x5d')]);}})[_0xefb9('0x22')](respondWithResult(_0x268a38,null))[_0xefb9('0x2d')](handleError(_0x268a38,null));};exports[_0xefb9('0x70')]=function(_0x269997,_0x54a158,_0x2077ef){var _0x2aa788={'raw':![],'where':{}};var _0x29a677={};var _0x217ebe={'count':0x0,'rows':[]};return db[_0xefb9('0x56')][_0xefb9('0x6c')]({'where':{'id':_0x269997[_0xefb9('0x66')]['id']}})[_0xefb9('0x22')](handleEntityNotFound(_0x54a158,null))['then'](function(_0x5b5158){if(_0x5b5158){_0x29a677[_0xefb9('0x44')]=_[_0xefb9('0x46')](db[_0xefb9('0x6f')][_0xefb9('0x40')]);_0x29a677['query']=_[_0xefb9('0x46')](_0x269997[_0xefb9('0x49')]);_0x29a677[_0xefb9('0x47')]=_[_0xefb9('0x48')](_0x29a677[_0xefb9('0x44')],_0x29a677[_0xefb9('0x49')]);_0x2aa788['attributes']=_['intersection'](_0x29a677[_0xefb9('0x44')],qs[_0xefb9('0x4b')](_0x269997['query'][_0xefb9('0x4b')]));_0x2aa788[_0xefb9('0x4a')]=_0x2aa788['attributes']['length']?_0x2aa788[_0xefb9('0x4a')]:_0x29a677['model'];if(!_0x269997['query']['hasOwnProperty'](_0xefb9('0x6d'))){_0x2aa788[_0xefb9('0x34')]=qs[_0xefb9('0x34')](_0x269997[_0xefb9('0x49')][_0xefb9('0x34')]);_0x2aa788['offset']=qs[_0xefb9('0x33')](_0x269997[_0xefb9('0x49')][_0xefb9('0x33')]);}_0x2aa788[_0xefb9('0x4e')]=qs[_0xefb9('0x4f')](_0x269997[_0xefb9('0x49')][_0xefb9('0x4f')]);_0x2aa788['where']=qs['filters'](_[_0xefb9('0x51')](_0x269997[_0xefb9('0x49')],_0x29a677[_0xefb9('0x47')]));_0x2aa788[_0xefb9('0x50')]['SmsAccountId']=_0x5b5158['id'];if(_0x269997[_0xefb9('0x49')]['filter']){_0x2aa788[_0xefb9('0x50')]=_[_0xefb9('0x53')](_0x2aa788[_0xefb9('0x50')],{'$or':_[_0xefb9('0x3f')](_0x2aa788[_0xefb9('0x4a')],function(_0x170bcd){var _0x46952d={};_0x46952d[_0x170bcd]={'$like':'%'+_0x269997[_0xefb9('0x49')][_0xefb9('0x52')]+'%'};return _0x46952d;})});}_0x2aa788=_['merge']({},_0x2aa788,_0x269997['options']);return db[_0xefb9('0x6f')]['count']({'where':_0x2aa788[_0xefb9('0x50')]})[_0xefb9('0x22')](function(_0x9f0566){_0x217ebe['count']=_0x9f0566;if(_0x269997['query'][_0xefb9('0x57')]){_0x2aa788[_0xefb9('0x58')]=[{'all':!![]}];}return db[_0xefb9('0x6f')][_0xefb9('0x59')](_0x2aa788);})[_0xefb9('0x22')](function(_0x32e64b){_0x217ebe[_0xefb9('0x71')]=_0x32e64b;return _0x217ebe;});}})['then'](respondWithFilteredResult(_0x54a158,_0x2aa788))['catch'](handleError(_0x54a158,null));};exports[_0xefb9('0x72')]=function(_0x33c702,_0x4124e7,_0x3e4487){return db[_0xefb9('0x56')]['find']({'where':{'id':_0x33c702[_0xefb9('0x66')]['id']}})[_0xefb9('0x22')](handleEntityNotFound(_0x4124e7,null))[_0xefb9('0x22')](function(_0x1c3cc7){if(_0x1c3cc7){return _0x1c3cc7[_0xefb9('0x72')](_0x33c702[_0xefb9('0x49')][_0xefb9('0x73')]);}})['then'](respondWithStatusCode(_0x4124e7,null))['catch'](handleError(_0x4124e7,null));};exports['notify']=function(_0x31dd58,_0x49b009,_0x5e1b70){var _0x4d2449={'channel':_0xefb9('0x74')};var _0x279724=[];var _0x25c3fa=[];var _0x2f66e7={};return db['SmsAccount'][_0xefb9('0x5b')]({'where':{'id':_0x31dd58[_0xefb9('0x66')]['id']},'include':[{'model':db['SmsApplication'],'as':_0xefb9('0x75')}]})[_0xefb9('0x22')](handleEntityNotFound(_0x49b009,null))[_0xefb9('0x22')](function(_0xda7911){_0x4d2449['account']=_0xda7911;_0x4d2449[_0xefb9('0x76')]=_['orderBy'](_0xda7911[_0xefb9('0x75')],[_0xefb9('0x77')],['asc']);if(_0x4d2449[_0xefb9('0x78')][_0xefb9('0x75')]){delete _0x4d2449[_0xefb9('0x78')][_0xefb9('0x75')];}return db[_0xefb9('0x79')][_0xefb9('0x67')]();})['then'](function(_0x4ec224){if(!_0x4ec224){throw new db['Sequelize'][(_0xefb9('0x7a'))](_0xefb9('0x7b'));}_0x279724=_['difference'](_[_0xefb9('0x46')](_0x4ec224),[_0xefb9('0x7c'),_0xefb9('0x7d')]);_0x25c3fa=_[_0xefb9('0x7e')](_[_0xefb9('0x46')](_0x4ec224),[_0xefb9('0x7c'),_0xefb9('0x7d'),_0xefb9('0x7f'),'ListId']);_0x4d2449[_0xefb9('0x5d')]={'mapKey':_0xefb9('0x80')};if(_0x4d2449[_0xefb9('0x78')][_0xefb9('0x42')]){switch(_0x4d2449[_0xefb9('0x78')][_0xefb9('0x42')]){case _0xefb9('0x81'):_0x4d2449[_0xefb9('0x5d')]['from']=_0x31dd58['body'][_0xefb9('0x82')];_0x4d2449['body'][_0xefb9('0x5d')]=_0x31dd58[_0xefb9('0x5d')][_0xefb9('0x83')];_0x4d2449[_0xefb9('0x5d')][_0xefb9('0x84')]=_0x31dd58[_0xefb9('0x5d')]['MessageSid'];break;case'skebby':_0x4d2449[_0xefb9('0x5d')][_0xefb9('0x85')]='+'+_0x31dd58['body'][_0xefb9('0x86')];_0x4d2449[_0xefb9('0x5d')]['body']=_0x31dd58[_0xefb9('0x5d')][_0xefb9('0x87')];break;case _0xefb9('0x88'):_0x4d2449[_0xefb9('0x5d')][_0xefb9('0x85')]=_0x31dd58[_0xefb9('0x5d')][_0xefb9('0x85')];_0x4d2449[_0xefb9('0x5d')][_0xefb9('0x5d')]=_0x31dd58['body'][_0xefb9('0x2b')];break;case _0xefb9('0x89'):_0x4d2449[_0xefb9('0x5d')][_0xefb9('0x85')]=_0x31dd58['body'][_0xefb9('0x85')];_0x4d2449[_0xefb9('0x5d')][_0xefb9('0x5d')]=_0x31dd58[_0xefb9('0x5d')][_0xefb9('0x5d')];_0x4d2449[_0xefb9('0x5d')][_0xefb9('0x84')]=_0x31dd58[_0xefb9('0x5d')]['message_id'];break;case'plivo':_0x4d2449[_0xefb9('0x5d')]['from']=_0x31dd58[_0xefb9('0x5d')]['From'];_0x4d2449[_0xefb9('0x5d')][_0xefb9('0x5d')]=_0x31dd58[_0xefb9('0x5d')]['Text'];_0x4d2449[_0xefb9('0x5d')][_0xefb9('0x84')]=_0x31dd58[_0xefb9('0x5d')][_0xefb9('0x8a')];break;case _0xefb9('0x8b'):_0x4d2449[_0xefb9('0x5d')][_0xefb9('0x85')]='+'+_0x31dd58['body']['results'][0x0][_0xefb9('0x85')];_0x4d2449[_0xefb9('0x5d')][_0xefb9('0x5d')]=_0x31dd58[_0xefb9('0x5d')][_0xefb9('0x8c')][0x0][_0xefb9('0x87')];_0x4d2449[_0xefb9('0x5d')][_0xefb9('0x84')]=_0x31dd58[_0xefb9('0x5d')][_0xefb9('0x8c')][0x0][_0xefb9('0x84')];break;case'csc':_0x4d2449['body'][_0xefb9('0x85')]=_0x31dd58[_0xefb9('0x5d')][_0xefb9('0x8d')];_0x4d2449['body'][_0xefb9('0x5d')]=_0x31dd58[_0xefb9('0x5d')][_0xefb9('0x8e')]['message'];break;case _0xefb9('0x8f'):_0x4d2449['body'][_0xefb9('0x85')]=_0x31dd58[_0xefb9('0x5d')][_0xefb9('0x90')];_0x4d2449['body']['body']=_0x31dd58[_0xefb9('0x5d')]['text'];_0x4d2449[_0xefb9('0x5d')]['messageId']=_0x31dd58['body']['replyMessageId'];break;case _0xefb9('0x91'):_0x4d2449['body'][_0xefb9('0x84')]=_0x31dd58[_0xefb9('0x5d')][0x0]['message']['id'];_0x4d2449['body']['from']=_0x31dd58[_0xefb9('0x5d')][0x0][_0xefb9('0x2b')][_0xefb9('0x85')];_0x4d2449[_0xefb9('0x5d')][_0xefb9('0x5d')]=_0x31dd58[_0xefb9('0x5d')][0x0][_0xefb9('0x2b')][_0xefb9('0x87')];break;case'intelepeer':_0x4d2449[_0xefb9('0x5d')][_0xefb9('0x85')]=_0x31dd58[_0xefb9('0x5d')]['from'];_0x4d2449['body'][_0xefb9('0x5d')]=_0x31dd58[_0xefb9('0x5d')][_0xefb9('0x2b')];_0x4d2449['body'][_0xefb9('0x84')]=_0x31dd58[_0xefb9('0x5d')][_0xefb9('0x92')];break;}}if(_0x4d2449[_0xefb9('0x5d')]['id']){delete _0x4d2449[_0xefb9('0x5d')]['id'];}if(_[_0xefb9('0x93')](_0x4d2449['body'][_0xefb9('0x85')])){throw new db[(_0xefb9('0x94'))][(_0xefb9('0x7a'))](_0xefb9('0x95'));}if(_[_0xefb9('0x93')](_0x4d2449[_0xefb9('0x5d')][_0xefb9('0x5d')])||_0x4d2449[_0xefb9('0x5d')][_0xefb9('0x5d')]===''){throw new db[(_0xefb9('0x94'))]['ValidationError'](_0xefb9('0x96'));}if(_[_0xefb9('0x93')](_0x4d2449['body'][_0xefb9('0x97')])){throw new db['Sequelize'][(_0xefb9('0x7a'))](_0xefb9('0x98')+_0x25c3fa);}if(!_[_0xefb9('0x99')](_0x25c3fa,_0x4d2449[_0xefb9('0x5d')][_0xefb9('0x97')])){throw new db[(_0xefb9('0x94'))][(_0xefb9('0x7a'))](_0xefb9('0x9a')+_0x25c3fa);}_0x2f66e7[_0x4d2449['body'][_0xefb9('0x97')]]=_0x4d2449['body'][_0xefb9('0x85')];return db[_0xefb9('0x9b')][_0xefb9('0x5b')]({'where':{'id':_0x4d2449['account'][_0xefb9('0x9c')]},'include':[{'model':db[_0xefb9('0x79')],'as':_0xefb9('0x9d'),'where':_0x2f66e7,'limit':0x1,'order':[[_0xefb9('0x7d'),'DESC']]}]});})[_0xefb9('0x22')](handleEntityNotFound(_0x49b009,null))['then'](function(_0x1f0ed8){if(_0x1f0ed8){_0x4d2449[_0xefb9('0x9e')]=_['omit'](_0x1f0ed8,[_0xefb9('0x9d')]);if(_0x1f0ed8['Contacts'][_0xefb9('0x4c')]){return _0x1f0ed8[_0xefb9('0x9d')][0x0];}var _0x25b366=_['defaults'](_0x4d2449[_0xefb9('0x5d')],{'firstName':_0x4d2449[_0xefb9('0x5d')]['from'],'ListId':_0x1f0ed8['id']});_0x25b366[_0x4d2449[_0xefb9('0x5d')][_0xefb9('0x97')]]=_0x4d2449[_0xefb9('0x5d')]['from'];return db[_0xefb9('0x79')][_0xefb9('0x5c')](_0x25b366,{'fields':_0x279724,'raw':!![]});}})[_0xefb9('0x22')](handleEntityNotFound(_0x49b009,null))[_0xefb9('0x22')](function(_0x3648e4){if(_0x3648e4){_0x4d2449['contact']=_0x3648e4;var _0x36468d={'ContactId':_0x3648e4['id'],'phone':_0x4d2449[_0xefb9('0x5d')][_0xefb9('0x85')],'SmsAccountId':_0x31dd58[_0xefb9('0x66')]['id']};var _0x34aca7={'ContactId':_0x3648e4['id'],'SmsAccountId':_0x31dd58[_0xefb9('0x66')]['id'],'closed':![]};return db[_0xefb9('0x9f')][_0xefb9('0x5b')]({'where':_0x34aca7})['then'](function(_0x56b1f5){if(_0x56b1f5){return[_0x56b1f5,![]];}return db[_0xefb9('0x9f')][_0xefb9('0x5c')](_0x36468d)['then'](function(_0x4a38b3){return[_0x4a38b3,!![]];});});}})['spread'](function(_0x1ae299,_0x81beac){_0x4d2449[_0xefb9('0xa0')]=_0x1ae299[_0xefb9('0x3b')]({'plain':!![]});_0x4d2449[_0xefb9('0xa0')][_0xefb9('0xa1')]=![];if(_0x81beac){if(_0x4d2449[_0xefb9('0x78')][_0xefb9('0xa2')]){_0x4d2449[_0xefb9('0x76')]['push']({'id':0x0,'priority':_0x4d2449[_0xefb9('0x76')]['length']+0x1,'app':_0xefb9('0xa3'),'appdata':_0xefb9('0xa4'),'interval':_0xefb9('0xa5')});}_0x4d2449['interaction'][_0xefb9('0xa1')]=!![];}return db[_0xefb9('0xa6')][_0xefb9('0x5c')]({'phone':_0x4d2449['body'][_0xefb9('0x85')],'messageId':_0x4d2449['body'][_0xefb9('0x84')],'body':_0x4d2449[_0xefb9('0x5d')]['body'],'SmsAccountId':_0x31dd58[_0xefb9('0x66')]['id'],'SmsInteractionId':_0x1ae299['id'],'direction':'in','ContactId':_0x1ae299[_0xefb9('0xa7')],'AttachmentId':_0x4d2449[_0xefb9('0x5d')][_0xefb9('0xa8')]});})['then'](function(_0x27db68){_0x4d2449[_0xefb9('0x2b')]=_0x27db68;if(_0x4d2449[_0xefb9('0xa0')][_0xefb9('0xa9')]){return db['User']['find']({'attributes':['id',_0xefb9('0x45')],'where':{'id':_0x4d2449[_0xefb9('0xa0')][_0xefb9('0xa9')]}})[_0xefb9('0x22')](function(_0x230a16){if(_0x230a16){_0x4d2449[_0xefb9('0x76')][_0xefb9('0xaa')]({'id':0x0,'priority':0x0,'app':_0xefb9('0xab'),'appdata':_0x230a16[_0xefb9('0x45')]+','+(_0x4d2449['account']['waitForTheAssignedAgent']||0xa),'interval':_0xefb9('0xa5')});}return respondWithRpcPromise('Start','startRouting',_0x4d2449);});}return respondWithRpcPromise(_0xefb9('0xac'),_0xefb9('0xad'),_0x4d2449);})['then'](function(_0x43c7f7){if(_0x43c7f7){var _0x2488f2=0xc8;var _0xe01b22=_0xefb9('0xae');logger[_0xefb9('0x23')](_0xefb9('0x27'),_0xe01b22,_0x2488f2,_0xefb9('0xaf'));logger['debug'](_0xefb9('0xb0'),_0xe01b22,_0x2488f2,'entity\x20found',JSON['stringify'](_0x43c7f7));if(_0x4d2449[_0xefb9('0x78')][_0xefb9('0x42')]===_0xefb9('0x81')){return _0x49b009[_0xefb9('0x2f')](_0x2488f2)[_0xefb9('0x35')]('Content-Type',_0xefb9('0xb1'))['send'](_0xefb9('0xb2'));}else{return _0x49b009['status'](_0x2488f2)[_0xefb9('0x31')](_0x43c7f7);}}})[_0xefb9('0x2d')](handleError(_0x49b009,null));};exports['addApplications']=function(_0x484d74,_0x433699,_0x5df3d4){return db[_0xefb9('0x56')]['findOne']({'where':{'id':_0x484d74[_0xefb9('0x66')]['id']}})[_0xefb9('0x22')](handleEntityNotFound(_0x433699,null))[_0xefb9('0x22')](function(_0x4a97ba){if(_0x4a97ba){return db[_0xefb9('0xb3')]['transaction'](function(_0x4c4a42){return db[_0xefb9('0xb4')][_0xefb9('0x3a')]({'where':{'SmsAccountId':_0x484d74[_0xefb9('0x66')]['id']},'transaction':_0x4c4a42})[_0xefb9('0x22')](function(_0x3579bd){var _0x5e7080=_[_0xefb9('0x3f')](_0x484d74[_0xefb9('0x5d')],function(_0x18e2d0){_0x18e2d0[_0xefb9('0x69')]=_0x484d74[_0xefb9('0x66')]['id'];return _0x18e2d0;});return db[_0xefb9('0xb4')]['bulkCreate'](_0x5e7080,{'transaction':_0x4c4a42});});})[_0xefb9('0x22')](function(){return db[_0xefb9('0xb4')][_0xefb9('0xb5')]({'where':{'SmsAccountId':_0x484d74[_0xefb9('0x66')]['id']},'order':_0xefb9('0x77')});});}})['then'](respondWithResult(_0x433699,null))['catch'](handleError(_0x433699,null));};exports[_0xefb9('0xb6')]=function(_0x466c3f,_0xe1454a,_0x17c36b){var _0x2c5120={};var _0x3f7d0f={};var _0xc30709;var _0x12a8a0;return db['SmsAccount']['findOne']({'where':{'id':_0x466c3f[_0xefb9('0x66')]['id']}})[_0xefb9('0x22')](handleEntityNotFound(_0xe1454a,null))[_0xefb9('0x22')](function(_0x1d5a4d){if(_0x1d5a4d){_0xc30709=_0x1d5a4d;_0x3f7d0f[_0xefb9('0x44')]=_['keys'](db[_0xefb9('0xb4')][_0xefb9('0x40')]);_0x3f7d0f[_0xefb9('0x49')]=_[_0xefb9('0x46')](_0x466c3f[_0xefb9('0x49')]);_0x3f7d0f[_0xefb9('0x47')]=_['intersection'](_0x3f7d0f[_0xefb9('0x44')],_0x3f7d0f[_0xefb9('0x49')]);_0x2c5120[_0xefb9('0x4a')]=_['intersection'](_0x3f7d0f[_0xefb9('0x44')],qs[_0xefb9('0x4b')](_0x466c3f[_0xefb9('0x49')]['fields']));_0x2c5120[_0xefb9('0x4a')]=_0x2c5120[_0xefb9('0x4a')][_0xefb9('0x4c')]?_0x2c5120['attributes']:_0x3f7d0f[_0xefb9('0x44')];_0x2c5120['order']=qs['sort'](_0x466c3f[_0xefb9('0x49')][_0xefb9('0x4f')]);_0x2c5120[_0xefb9('0x50')]=qs[_0xefb9('0x47')](_['pick'](_0x466c3f[_0xefb9('0x49')],_0x3f7d0f[_0xefb9('0x47')]));if(_0x466c3f['query'][_0xefb9('0x52')]){_0x2c5120[_0xefb9('0x50')]=_['merge'](_0x2c5120['where'],{'$or':_[_0xefb9('0x3f')](_0x2c5120[_0xefb9('0x4a')],function(_0x35b380){var _0x162a93={};_0x162a93[_0x35b380]={'$like':'%'+_0x466c3f[_0xefb9('0x49')][_0xefb9('0x52')]+'%'};return _0x162a93;})});}_0x2c5120=_[_0xefb9('0x53')]({},_0x2c5120,_0x466c3f['options']);return _0xc30709['getApplications'](_0x2c5120);}})[_0xefb9('0x22')](function(_0x455e82){if(_0x455e82){_0x12a8a0=_0x455e82[_0xefb9('0x4c')];if(!_0x466c3f[_0xefb9('0x49')][_0xefb9('0x4d')](_0xefb9('0x6d'))){_0x2c5120[_0xefb9('0x34')]=qs[_0xefb9('0x34')](_0x466c3f[_0xefb9('0x49')][_0xefb9('0x34')]);_0x2c5120[_0xefb9('0x33')]=qs[_0xefb9('0x33')](_0x466c3f[_0xefb9('0x49')][_0xefb9('0x33')]);}return _0xc30709[_0xefb9('0xb6')](_0x2c5120);}})['then'](function(_0x355caa){if(_0x355caa){return _0x355caa?{'count':_0x12a8a0,'rows':_0x355caa}:null;}})[_0xefb9('0x22')](respondWithResult(_0xe1454a,null))[_0xefb9('0x2d')](handleError(_0xe1454a,null));};exports[_0xefb9('0xb7')]=function(_0x1cf476,_0x1da43a,_0x2ce400){var _0x5c122b={'raw':![],'where':{}};var _0x45290d={};var _0x56a88c={'count':0x0,'rows':[]};return db[_0xefb9('0x56')][_0xefb9('0x6c')]({'where':{'id':_0x1cf476['params']['id']}})['then'](handleEntityNotFound(_0x1da43a,null))[_0xefb9('0x22')](function(_0x349a46){if(_0x349a46){_0x45290d[_0xefb9('0x44')]=_[_0xefb9('0x46')](db[_0xefb9('0x9f')][_0xefb9('0x40')]);_0x45290d[_0xefb9('0x49')]=_['keys'](_0x1cf476[_0xefb9('0x49')]);_0x45290d[_0xefb9('0x47')]=_[_0xefb9('0x48')](_0x45290d['model'],_0x45290d[_0xefb9('0x49')]);_0x5c122b[_0xefb9('0x4a')]=_[_0xefb9('0x48')](_0x45290d[_0xefb9('0x44')],qs[_0xefb9('0x4b')](_0x1cf476['query'][_0xefb9('0x4b')]));_0x5c122b[_0xefb9('0x4a')]=_0x5c122b[_0xefb9('0x4a')][_0xefb9('0x4c')]?_0x5c122b[_0xefb9('0x4a')]:_0x45290d[_0xefb9('0x44')];if(!_0x1cf476[_0xefb9('0x49')][_0xefb9('0x4d')](_0xefb9('0x6d'))){_0x5c122b[_0xefb9('0x34')]=qs[_0xefb9('0x34')](_0x1cf476['query'][_0xefb9('0x34')]);_0x5c122b['offset']=qs[_0xefb9('0x33')](_0x1cf476['query']['offset']);}_0x5c122b[_0xefb9('0x4e')]=qs[_0xefb9('0x4f')](_0x1cf476[_0xefb9('0x49')]['sort']);_0x5c122b['where']=qs[_0xefb9('0x47')](_[_0xefb9('0x51')](_0x1cf476[_0xefb9('0x49')],_0x45290d[_0xefb9('0x47')]));_0x5c122b[_0xefb9('0x50')]['SmsAccountId']=_0x349a46['id'];if(_0x1cf476[_0xefb9('0x49')][_0xefb9('0x52')]){_0x5c122b[_0xefb9('0x50')]=_['merge'](_0x5c122b[_0xefb9('0x50')],{'$or':_[_0xefb9('0x3f')](_0x5c122b[_0xefb9('0x4a')],function(_0xff3e64){var _0x33bd87={};_0x33bd87[_0xff3e64]={'$like':'%'+_0x1cf476['query'][_0xefb9('0x52')]+'%'};return _0x33bd87;})});}_0x5c122b=_[_0xefb9('0x53')]({},_0x5c122b,_0x1cf476[_0xefb9('0x55')]);return db[_0xefb9('0x9f')][_0xefb9('0x32')]({'where':_0x5c122b[_0xefb9('0x50')]})[_0xefb9('0x22')](function(_0x4f293a){_0x56a88c['count']=_0x4f293a;if(_0x1cf476['query']['includeAll']){_0x5c122b['include']=[{'model':db['CmContact'],'as':_0xefb9('0xb8'),'required':![]},{'model':db[_0xefb9('0xb9')],'as':'Owner','attributes':[_0xefb9('0x45'),_0xefb9('0xba'),_0xefb9('0xbb')],'required':![]},{'model':db[_0xefb9('0xbc')],'as':'Tags','attributes':['id','name',_0xefb9('0xbd')],'where':_0x1cf476[_0xefb9('0x49')][_0xefb9('0xbe')]?{'id':_0x1cf476['query'][_0xefb9('0xbe')]}:undefined,'required':_0x1cf476[_0xefb9('0x49')]['tag']?!![]:![]}];}return db[_0xefb9('0x9f')]['findAll'](_0x5c122b);})[_0xefb9('0x22')](function(_0x1c059e){_0x56a88c['rows']=_0x1c059e;return _0x56a88c;});}})[_0xefb9('0x22')](respondWithFilteredResult(_0x1da43a,_0x5c122b))[_0xefb9('0x2d')](handleError(_0x1da43a,null));};exports[_0xefb9('0xbf')]=function(_0x3e8544,_0x52d795,_0x5ad35a){var _0x15d6f7,_0x5d8d52,_0x1b17d1;if(_[_0xefb9('0x93')](_0x3e8544[_0xefb9('0x5d')][_0xefb9('0x5d')])||_0x3e8544[_0xefb9('0x5d')][_0xefb9('0x5d')]===''){throw new db[(_0xefb9('0x94'))][(_0xefb9('0x7a'))](_0xefb9('0x96'));}if(_['isNil'](_0x3e8544['body']['to'])){throw new db['Sequelize']['ValidationError'](_0xefb9('0xc0'));}_0x15d6f7=_0x3e8544['body']['to'];return db[_0xefb9('0x56')][_0xefb9('0x5b')]({'where':{'id':_0x3e8544[_0xefb9('0x66')]['id']},'include':[{'model':db[_0xefb9('0x9b')],'as':_0xefb9('0xc1'),'include':[{'model':db[_0xefb9('0x79')],'as':_0xefb9('0x9d'),'where':{'mobile':_0x15d6f7},'limit':0x1,'order':[[_0xefb9('0x7d'),_0xefb9('0xc2')]]}]}]})['then'](handleEntityNotFound(_0x52d795,null))['then'](function(_0x2aeecb){if(_0x2aeecb&&_0x2aeecb['List']){_0x5d8d52=_0x2aeecb['get']({'plain':!![]});if(_0x5d8d52[_0xefb9('0xc1')]&&_0x5d8d52['List'][_0xefb9('0x9d')][_0xefb9('0x4c')]){return _0x5d8d52[_0xefb9('0xc1')][_0xefb9('0x9d')][0x0];}return db[_0xefb9('0x79')]['create'](_['defaults'](_0x3e8544[_0xefb9('0x5d')],{'firstName':_0x15d6f7,'mobile':_0x15d6f7,'phone':_0x15d6f7,'ListId':_0x5d8d52[_0xefb9('0x9c')]}));}})[_0xefb9('0x22')](handleEntityNotFound(_0x52d795,null))[_0xefb9('0x22')](function(_0x2c8fe5){if(_0x2c8fe5){_0x1b17d1=_0x2c8fe5;return db[_0xefb9('0x9f')][_0xefb9('0x5b')]({'where':{'ContactId':_0x1b17d1['id'],'closed':![],'SmsAccountId':_0x5d8d52['id']}})[_0xefb9('0x22')](function(_0x165a9d){if(_0x165a9d){return[_0x165a9d,![]];}return db[_0xefb9('0x9f')][_0xefb9('0x5c')]({'UserId':_0x3e8544[_0xefb9('0x5e')]['id'],'ContactId':_0x1b17d1['id'],'SmsAccountId':_0x5d8d52['id'],'phone':_0x15d6f7,'firstMsgDirection':_0xefb9('0xc3'),'Messages':[_[_0xefb9('0x53')](_0x3e8544[_0xefb9('0x5d')],{'read':![],'body':_0x3e8544['body'][_0xefb9('0x5d')],'phone':_0x15d6f7,'SmsAccountId':_0x5d8d52['id'],'UserId':_0x3e8544[_0xefb9('0x5e')]['id'],'ContactId':_0x1b17d1['id']})]},{'include':[{'model':db[_0xefb9('0xa6')],'as':_0xefb9('0xc4')}]})[_0xefb9('0x22')](function(_0x1e92fb){return[_0x1e92fb,!![]];});});}})[_0xefb9('0xc5')](function(_0x213b6c,_0x6b138d){if(_0x6b138d){return _0x213b6c;}return db[_0xefb9('0xa6')][_0xefb9('0x5c')](_[_0xefb9('0x53')](_0x3e8544[_0xefb9('0x5d')],{'read':![],'body':_0x3e8544[_0xefb9('0x5d')][_0xefb9('0x5d')],'phone':_0x15d6f7,'SmsAccountId':_0x5d8d52['id'],'SmsInteractionId':_0x213b6c['id'],'UserId':_0x3e8544[_0xefb9('0x5e')]['id'],'ContactId':_0x1b17d1['id']}))[_0xefb9('0x22')](function(_0xd06ca7){_0x213b6c['dataValues']['Messages']=[];_0x213b6c[_0xefb9('0xc6')][_0xefb9('0xc4')][_0xefb9('0xc7')](_0xd06ca7[_0xefb9('0xc6')]);return _0x213b6c;});})['then'](respondWithResult(_0x52d795,null))[_0xefb9('0x2d')](handleError(_0x52d795,null));};exports[_0xefb9('0x2f')]=function(_0x29e164,_0x148704,_0x49b2b8){if(_0x29e164['body']['id']){delete _0x29e164[_0xefb9('0x5d')]['id'];}var _0x1c3d01,_0x3eb28a,_0x554407;return db[_0xefb9('0x56')]['find']({'where':{'id':_0x29e164['params']['id']}})[_0xefb9('0x22')](handleEntityNotFound(_0x148704,null))['then'](function(_0x5910de){if(_0x5910de){_0x554407=_0x5910de;logger['debug'](_0xefb9('0x27'),_0xefb9('0x2f'),_0xefb9('0xc8'),_0x5910de[_0xefb9('0x42')],util[_0xefb9('0xc9')](_0x29e164[_0xefb9('0x5d')],{'showHidden':![],'depth':null}));switch(_0x5910de[_0xefb9('0x42')]){case _0xefb9('0xca'):if(_0x29e164['body'][_0xefb9('0xcb')]&&_0x29e164[_0xefb9('0x5d')][_0xefb9('0x2f')]){_0x3eb28a=_0x29e164[_0xefb9('0x5d')][_0xefb9('0x2f')];return db[_0xefb9('0xa6')]['find']({'where':{'messageId':_0x29e164['body'][_0xefb9('0xcb')]}});}break;case _0xefb9('0x88'):if(_0x29e164[_0xefb9('0x5d')][_0xefb9('0xcc')]&&_0x29e164[_0xefb9('0x5d')][_0xefb9('0xcd')]){_0x3eb28a=_0x29e164[_0xefb9('0x5d')][_0xefb9('0xcd')];return db[_0xefb9('0xa6')][_0xefb9('0x5b')]({'where':{'messageId':_0x29e164[_0xefb9('0x5d')][_0xefb9('0xcc')]}});}break;case _0xefb9('0x89'):if(_0x29e164[_0xefb9('0x5d')][_0xefb9('0xce')]&&_0x29e164['body']['status_code']){_0x3eb28a=_0x29e164[_0xefb9('0x5d')][_0xefb9('0xcf')];return db['SmsMessage'][_0xefb9('0x5b')]({'where':{'messageId':_0x29e164['body']['message_id']}});}break;case'infobip':var _0x3e6b57=_0x29e164[_0xefb9('0x5d')][_0xefb9('0x8c')][0x0];if(_0x3e6b57[_0xefb9('0x84')]&&_0x3e6b57[_0xefb9('0x2f')][_0xefb9('0xd0')]===_0xefb9('0xd1')){_0x3eb28a=_0x3e6b57[_0xefb9('0x2f')][_0xefb9('0xd0')];return db[_0xefb9('0xa6')]['find']({'where':{'messageId':_0x3e6b57['messageId']}});}break;case _0xefb9('0x8f'):if(_0x29e164[_0xefb9('0x5d')][_0xefb9('0x84')]&&_0x29e164[_0xefb9('0x5d')]['status']){_0x3eb28a=_0x29e164[_0xefb9('0x5d')][_0xefb9('0x2f')];return db[_0xefb9('0xa6')][_0xefb9('0x5b')]({'where':{'messageId':_0x29e164[_0xefb9('0x5d')][_0xefb9('0x84')]}});}break;case _0xefb9('0x91'):if(_0x29e164[_0xefb9('0x5d')][0x0][_0xefb9('0x2b')]['id']){_0x3eb28a=_0x29e164[_0xefb9('0x5d')][0x0][_0xefb9('0x42')];return db['SmsMessage'][_0xefb9('0x5b')]({'where':{'messageId':_0x29e164[_0xefb9('0x5d')][0x0][_0xefb9('0x2b')]['id']}});}break;case _0xefb9('0xd2'):if(_0x29e164['body'][_0xefb9('0xd3')]&&_0x29e164[_0xefb9('0x5d')][_0xefb9('0x2f')]){_0x3eb28a=_0x29e164[_0xefb9('0x5d')][_0xefb9('0x2f')];return db[_0xefb9('0xa6')]['find']({'where':{'messageId':_0x29e164[_0xefb9('0x5d')][_0xefb9('0xd3')]}});}break;}}})[_0xefb9('0x22')](handleEntityNotFound(_0x148704,null))[_0xefb9('0x22')](function(_0x27beec){if(_0x27beec){_0x1c3d01=_0x27beec;switch(_0x554407[_0xefb9('0x42')]){case'skebby':if(_0x3eb28a==='DELIVERED'){return _0x1c3d01[_0xefb9('0x39')]({'read':!![]});}else{logger[_0xefb9('0x29')](_0xefb9('0x27'),_0xefb9('0x2f'),_0xefb9('0xca'),util[_0xefb9('0xc9')](_0x29e164['body'],{'showHidden':![],'depth':null}));}break;case _0xefb9('0x88'):if(_0x3eb28a==='1'){return _0x1c3d01[_0xefb9('0x39')]({'read':!![]});}else{logger['error'](_0xefb9('0x27'),_0xefb9('0x2f'),_0xefb9('0xca'),util['inspect'](_0x29e164[_0xefb9('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xefb9('0x89'):if(!_0x29e164[_0xefb9('0x5d')][_0xefb9('0xd4')]&&_0x3eb28a>=0xc8&&_0x3eb28a<=0xce){return _0x1c3d01[_0xefb9('0x39')]({'read':!![]});}else{logger['error'](_0xefb9('0x27'),_0xefb9('0x2f'),_0xefb9('0x89'),util[_0xefb9('0xc9')](_0x29e164[_0xefb9('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xefb9('0x8b'):var _0x213390=_0x29e164[_0xefb9('0x5d')][_0xefb9('0x8c')][0x0];if(_0x213390[_0xefb9('0x2f')]['groupName']===_0xefb9('0xd1')){return _0x1c3d01[_0xefb9('0x39')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xefb9('0x8b'),util[_0xefb9('0xc9')](_0x29e164[_0xefb9('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xefb9('0x8f'):if(_0x3eb28a==_0xefb9('0xd5')||_0x3eb28a==_0xefb9('0xd6')){return _0x1c3d01[_0xefb9('0x39')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xefb9('0x2f'),_0xefb9('0x8f'),util[_0xefb9('0xc9')](_0x29e164['body'],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x3eb28a==_0xefb9('0xd7')){return _0x1c3d01[_0xefb9('0x39')]({'read':!![]});}else{logger[_0xefb9('0x29')](_0xefb9('0x27'),_0xefb9('0x2f'),_0xefb9('0x91'),util[_0xefb9('0xc9')](_0x29e164[_0xefb9('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xefb9('0xd2'):if(_0x3eb28a==='DELIVRD'||_0x3eb28a===_0xefb9('0xd8')){return _0x1c3d01[_0xefb9('0x39')]({'read':!![]});}else{logger[_0xefb9('0x29')](_0xefb9('0x27'),_0xefb9('0x2f'),_0xefb9('0xd2'),util[_0xefb9('0xc9')](_0x29e164['body'],{'showHidden':![],'depth':null}));}break;}return _0x1c3d01;}})[_0xefb9('0x22')](respondWithResult(_0x148704,null))[_0xefb9('0x2d')](handleError(_0x148704,null));};exports[_0xefb9('0xd9')]=function(_0x202fdf,_0x15456e,_0x36016c){var _0x365dd7,_0x5e4d0c,_0x1a38d4;return db[_0xefb9('0x56')][_0xefb9('0x5b')]({'where':{'id':_0x202fdf[_0xefb9('0x66')]['id']}})[_0xefb9('0x22')](handleEntityNotFound(_0x15456e,null))[_0xefb9('0x22')](function(_0x59df0c){if(_0x59df0c){_0x1a38d4=_0x59df0c;logger[_0xefb9('0x26')](_0xefb9('0x27'),_0xefb9('0x2f'),_0xefb9('0xc8'),_0x59df0c[_0xefb9('0x42')],util['inspect'](_0x202fdf[_0xefb9('0x49')],{'showHidden':![],'depth':null}));switch(_0x59df0c[_0xefb9('0x42')]){case _0xefb9('0xda'):if(_0x202fdf[_0xefb9('0x49')][_0xefb9('0xdb')]&&_0x202fdf[_0xefb9('0x49')]['state']){_0x5e4d0c=_0x202fdf[_0xefb9('0x49')][_0xefb9('0xdc')];return db[_0xefb9('0xa6')][_0xefb9('0x5b')]({'where':{'messageId':_0x202fdf[_0xefb9('0x49')][_0xefb9('0xdb')]}});}break;}}})[_0xefb9('0x22')](handleEntityNotFound(_0x15456e,null))[_0xefb9('0x22')](function(_0x4112c7){if(_0x4112c7){_0x365dd7=_0x4112c7;switch(_0x1a38d4[_0xefb9('0x42')]){case _0xefb9('0xda'):if(_0x5e4d0c==='2'||_0x5e4d0c==='6'){return _0x365dd7[_0xefb9('0x39')]({'read':!![]});}else{logger[_0xefb9('0x29')](_0xefb9('0x27'),_0xefb9('0x2f'),'csc',util[_0xefb9('0xc9')](_0x202fdf[_0xefb9('0x49')],{'showHidden':![],'depth':null}));};break;}return _0x365dd7;}})[_0xefb9('0x22')](respondWithResult(_0x15456e,null))['catch'](handleError(_0x15456e,null));};exports['addAgents']=function(_0x4ee669,_0x48d780,_0x5259cc){return db['SmsAccount'][_0xefb9('0x5b')]({'where':{'id':_0x4ee669['params']['id']}})[_0xefb9('0x22')](handleEntityNotFound(_0x48d780,null))[_0xefb9('0x22')](function(_0x3cd3f6){if(_0x3cd3f6){return _0x3cd3f6[_0xefb9('0xdd')](_0x4ee669[_0xefb9('0x5d')][_0xefb9('0x73')],_[_0xefb9('0xde')](_0x4ee669[_0xefb9('0x5d')],['ids','id'])||{})[_0xefb9('0xc5')](function(_0x36171d){for(var _0x152781=0x0;_0x152781<_0x4ee669[_0xefb9('0x5d')][_0xefb9('0x73')]['length'];_0x152781+=0x1){socket[_0xefb9('0xdf')]('userSmsAccount:save',{'UserId':_0x4ee669[_0xefb9('0x5d')][_0xefb9('0x73')][_0x152781],'SmsAccountId':_0x4ee669[_0xefb9('0x66')]['id']});}return _0x36171d;});}})['then'](respondWithResult(_0x48d780,null))[_0xefb9('0x2d')](handleError(_0x48d780,null));};exports[_0xefb9('0xe0')]=function(_0x5c1f12,_0x534407,_0x1ea9c8){return db['SmsAccount'][_0xefb9('0x5b')]({'where':{'id':_0x5c1f12['params']['id']}})[_0xefb9('0x22')](handleEntityNotFound(_0x534407,null))[_0xefb9('0x22')](function(_0x509f3d){if(_0x509f3d){return _0x509f3d[_0xefb9('0xe0')](_0x5c1f12[_0xefb9('0x49')][_0xefb9('0x73')])[_0xefb9('0x22')](function(){if(_[_0xefb9('0xe1')](_0x5c1f12[_0xefb9('0x49')][_0xefb9('0x73')])){for(var _0x1cd563=0x0;_0x1cd563<_0x5c1f12[_0xefb9('0x49')][_0xefb9('0x73')]['length'];_0x1cd563+=0x1){socket[_0xefb9('0xdf')](_0xefb9('0xe2'),{'UserId':Number(_0x5c1f12[_0xefb9('0x49')][_0xefb9('0x73')][_0x1cd563]),'SmsAccountId':Number(_0x5c1f12[_0xefb9('0x66')]['id'])});}}else{socket[_0xefb9('0xdf')](_0xefb9('0xe2'),{'UserId':Number(_0x5c1f12[_0xefb9('0x49')][_0xefb9('0x73')]),'SmsAccountId':Number(_0x5c1f12['params']['id'])});}});}})[_0xefb9('0x22')](respondWithStatusCode(_0x534407,null))[_0xefb9('0x2d')](handleError(_0x534407,null));};exports[_0xefb9('0xe3')]=function(_0x2be428,_0x4205a8,_0x5c07ef){var _0x2a52d2={};var _0x1ed558={};var _0x1f032f;var _0x136399;return db[_0xefb9('0x56')][_0xefb9('0x6c')]({'where':{'id':_0x2be428[_0xefb9('0x66')]['id']}})[_0xefb9('0x22')](handleEntityNotFound(_0x4205a8,null))[_0xefb9('0x22')](function(_0x57da88){if(_0x57da88){_0x1f032f=_0x57da88;_0x1ed558[_0xefb9('0x44')]=_[_0xefb9('0x46')](db[_0xefb9('0xb9')]['rawAttributes']);_0x1ed558['query']=_[_0xefb9('0x46')](_0x2be428[_0xefb9('0x49')]);_0x1ed558[_0xefb9('0x47')]=_[_0xefb9('0x48')](_0x1ed558[_0xefb9('0x44')],_0x1ed558['query']);_0x2a52d2[_0xefb9('0x4a')]=_[_0xefb9('0x48')](_0x1ed558[_0xefb9('0x44')],qs[_0xefb9('0x4b')](_0x2be428[_0xefb9('0x49')][_0xefb9('0x4b')]));_0x2a52d2[_0xefb9('0x4a')]=_0x2a52d2['attributes'][_0xefb9('0x4c')]?_0x2a52d2[_0xefb9('0x4a')]:_0x1ed558[_0xefb9('0x44')];_0x2a52d2[_0xefb9('0x4e')]=qs['sort'](_0x2be428[_0xefb9('0x49')][_0xefb9('0x4f')]);_0x2a52d2[_0xefb9('0x50')]=qs[_0xefb9('0x47')](_[_0xefb9('0x51')](_0x2be428[_0xefb9('0x49')],_0x1ed558[_0xefb9('0x47')]));if(_0x2be428[_0xefb9('0x49')]['filter']){_0x2a52d2['where']=_['merge'](_0x2a52d2[_0xefb9('0x50')],{'$or':_[_0xefb9('0x3f')](_0x2a52d2[_0xefb9('0x4a')],function(_0x4c08a7){var _0xf6e80c={};_0xf6e80c[_0x4c08a7]={'$like':'%'+_0x2be428['query'][_0xefb9('0x52')]+'%'};return _0xf6e80c;})});}_0x2a52d2=_[_0xefb9('0x53')]({},_0x2a52d2,_0x2be428[_0xefb9('0x55')]);return _0x1f032f[_0xefb9('0xe3')](_0x2a52d2);}})[_0xefb9('0x22')](function(_0x4425cb){if(_0x4425cb){_0x136399=_0x4425cb[_0xefb9('0x4c')];if(!_0x2be428[_0xefb9('0x49')][_0xefb9('0x4d')](_0xefb9('0x6d'))){_0x2a52d2[_0xefb9('0x34')]=qs[_0xefb9('0x34')](_0x2be428[_0xefb9('0x49')][_0xefb9('0x34')]);_0x2a52d2[_0xefb9('0x33')]=qs[_0xefb9('0x33')](_0x2be428[_0xefb9('0x49')][_0xefb9('0x33')]);}return _0x1f032f[_0xefb9('0xe3')](_0x2a52d2);}})[_0xefb9('0x22')](function(_0x5e463d){if(_0x5e463d){return _0x5e463d?{'count':_0x136399,'rows':_0x5e463d}:null;}})[_0xefb9('0x22')](respondWithResult(_0x4205a8,null))['catch'](handleError(_0x4205a8,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 925f436..4928d7b 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 _0x2127=['SmsAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x49194a,_0x3b1c4e){var _0x2c14e6=function(_0x3f870e){while(--_0x3f870e){_0x49194a['push'](_0x49194a['shift']());}};_0x2c14e6(++_0x3b1c4e);}(_0x2127,0x12a));var _0x7212=function(_0xddb363,_0x5bf558){_0xddb363=_0xddb363-0x0;var _0x9c97e0=_0x2127[_0xddb363];return _0x9c97e0;};'use strict';var EventEmitter=require(_0x7212('0x0'));var SmsAccount=require(_0x7212('0x1'))['db'][_0x7212('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x7212('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7212('0x4'),'afterDestroy':_0x7212('0x5')};function emitEvent(_0x19d971){return function(_0x3b2dc2,_0x12d9a4,_0x2cc58c){SmsAccountEvents[_0x7212('0x6')](_0x19d971+':'+_0x3b2dc2['id'],_0x3b2dc2);SmsAccountEvents['emit'](_0x19d971,_0x3b2dc2);_0x2cc58c(null);};}for(var e in events){if(events[_0x7212('0x7')](e)){var event=events[e];SmsAccount[_0x7212('0x8')](e,emitEvent(event));}}module[_0x7212('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x7867=['../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x411069,_0x16ae05){var _0x68c645=function(_0x55d1c8){while(--_0x55d1c8){_0x411069['push'](_0x411069['shift']());}};_0x68c645(++_0x16ae05);}(_0x7867,0x128));var _0x7786=function(_0x308c1b,_0x268249){_0x308c1b=_0x308c1b-0x0;var _0x52c63a=_0x7867[_0x308c1b];return _0x52c63a;};'use strict';var EventEmitter=require(_0x7786('0x0'));var SmsAccount=require(_0x7786('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x7786('0x2')](0x0);var events={'afterCreate':_0x7786('0x3'),'afterUpdate':'update','afterDestroy':_0x7786('0x4')};function emitEvent(_0x14b4c0){return function(_0x4c60d7,_0x4a8064,_0x2bf3a7){SmsAccountEvents[_0x7786('0x5')](_0x14b4c0+':'+_0x4c60d7['id'],_0x4c60d7);SmsAccountEvents[_0x7786('0x5')](_0x14b4c0,_0x4c60d7);_0x2bf3a7(null);};}for(var e in events){if(events[_0x7786('0x6')](e)){var event=events[e];SmsAccount[_0x7786('0x7')](e,emitEvent(event));}}module[_0x7786('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index cf25692..2b17615 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 _0x82ba=['util','../../config/logger','moment','bluebird','request-promise','path','./smsAccount.attributes','exports','sms_accounts','lodash'];(function(_0x49b887,_0x116827){var _0x334826=function(_0x2cef9b){while(--_0x2cef9b){_0x49b887['push'](_0x49b887['shift']());}};_0x334826(++_0x116827);}(_0x82ba,0x153));var _0xa82b=function(_0x4c5cfc,_0x4c3607){_0x4c5cfc=_0x4c5cfc-0x0;var _0x3ce4c8=_0x82ba[_0x4c5cfc];return _0x3ce4c8;};'use strict';var _=require(_0xa82b('0x0'));var util=require(_0xa82b('0x1'));var logger=require(_0xa82b('0x2'))('api');var moment=require(_0xa82b('0x3'));var BPromise=require(_0xa82b('0x4'));var rp=require(_0xa82b('0x5'));var fs=require('fs');var path=require(_0xa82b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa82b('0x7'));module[_0xa82b('0x8')]=function(_0xc9f3bf,_0x42854a){return _0xc9f3bf['define']('SmsAccount',attributes,{'tableName':_0xa82b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed67=['define','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xed67,0xc1));var _0x7ed6=function(_0x4aa838,_0x4aa14f){_0x4aa838=_0x4aa838-0x0;var _0x3abff0=_0xed67[_0x4aa838];return _0x3abff0;};'use strict';var _=require(_0x7ed6('0x0'));var util=require(_0x7ed6('0x1'));var logger=require('../../config/logger')(_0x7ed6('0x2'));var moment=require(_0x7ed6('0x3'));var BPromise=require(_0x7ed6('0x4'));var rp=require(_0x7ed6('0x5'));var fs=require('fs');var path=require(_0x7ed6('0x6'));var rimraf=require(_0x7ed6('0x7'));var config=require(_0x7ed6('0x8'));var attributes=require(_0x7ed6('0x9'));module[_0x7ed6('0xa')]=function(_0x5c2307,_0x535f05){return _0x5c2307[_0x7ed6('0xb')]('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 348e2a5..3a84d9a 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 _0x9bdc=['error','message','SmsAccount','options','raw','where','attributes','include','model','map','ShowSmsAccount','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5b7f35,_0xbdcc40){var _0x477a99=function(_0x3c3d8e){while(--_0x3c3d8e){_0x5b7f35['push'](_0x5b7f35['shift']());}};_0x477a99(++_0xbdcc40);}(_0x9bdc,0xa0));var _0xc9bd=function(_0x101124,_0x5c5aee){_0x101124=_0x101124-0x0;var _0x1ac695=_0x9bdc[_0x101124];return _0x1ac695;};'use strict';var _=require(_0xc9bd('0x0'));var util=require(_0xc9bd('0x1'));var moment=require(_0xc9bd('0x2'));var BPromise=require(_0xc9bd('0x3'));var rs=require(_0xc9bd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc9bd('0x5'))['db'];var utils=require(_0xc9bd('0x6'));var logger=require(_0xc9bd('0x7'))(_0xc9bd('0x8'));var config=require('../../config/environment');var jayson=require(_0xc9bd('0x9'));var client=jayson[_0xc9bd('0xa')][_0xc9bd('0xb')]({'port':0x232a});config[_0xc9bd('0xc')]=_[_0xc9bd('0xd')](config[_0xc9bd('0xc')],{'host':_0xc9bd('0xe'),'port':0x18eb});var socket=require(_0xc9bd('0xf'))(new Redis(config[_0xc9bd('0xc')]));require(_0xc9bd('0x10'))[_0xc9bd('0x11')](socket);function respondWithRpcPromise(_0x5af9a3,_0x4da18b,_0x1b253b){return new BPromise(function(_0x2d947c,_0x58baf0){return client[_0xc9bd('0x12')](_0x5af9a3,_0x1b253b)[_0xc9bd('0x13')](function(_0x48a466){logger[_0xc9bd('0x14')](_0xc9bd('0x15'),_0x4da18b,_0xc9bd('0x16'));logger[_0xc9bd('0x17')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4da18b,'request\x20sent',JSON[_0xc9bd('0x18')](_0x48a466));if(_0x48a466['error']){if(_0x48a466['error']['code']===0x1f4){logger[_0xc9bd('0x19')](_0xc9bd('0x15'),_0x4da18b,_0x48a466[_0xc9bd('0x19')][_0xc9bd('0x1a')]);return _0x58baf0(_0x48a466['error'][_0xc9bd('0x1a')]);}logger[_0xc9bd('0x19')](_0xc9bd('0x15'),_0x4da18b,_0x48a466[_0xc9bd('0x19')]['message']);return _0x2d947c(_0x48a466[_0xc9bd('0x19')][_0xc9bd('0x1a')]);}else{logger[_0xc9bd('0x14')](_0xc9bd('0x15'),_0x4da18b,_0xc9bd('0x16'));_0x2d947c(_0x48a466['result']['message']);}})['catch'](function(_0x576292){logger[_0xc9bd('0x19')]('SmsAccount,\x20%s,\x20%s',_0x4da18b,_0x576292);_0x58baf0(_0x576292);});});}exports['ShowSmsAccount']=function(_0x1691c1){var _0x46871b=this;return new Promise(function(_0x183493,_0x1c40f6){return db[_0xc9bd('0x1b')]['find']({'raw':_0x1691c1[_0xc9bd('0x1c')]?_0x1691c1['options'][_0xc9bd('0x1d')]===undefined?!![]:![]:!![],'where':_0x1691c1[_0xc9bd('0x1c')]?_0x1691c1['options'][_0xc9bd('0x1e')]||null:null,'attributes':_0x1691c1[_0xc9bd('0x1c')]?_0x1691c1[_0xc9bd('0x1c')][_0xc9bd('0x1f')]||null:null,'include':_0x1691c1[_0xc9bd('0x1c')]?_0x1691c1[_0xc9bd('0x1c')][_0xc9bd('0x20')]?_['map'](_0x1691c1[_0xc9bd('0x1c')][_0xc9bd('0x20')],function(_0x14384e){return{'model':db[_0x14384e[_0xc9bd('0x21')]],'as':_0x14384e['as'],'attributes':_0x14384e['attributes'],'include':_0x14384e['include']?_[_0xc9bd('0x22')](_0x14384e['include'],function(_0x8fc892){return{'model':db[_0x8fc892[_0xc9bd('0x21')]],'as':_0x8fc892['as'],'attributes':_0x8fc892[_0xc9bd('0x1f')],'include':_0x8fc892[_0xc9bd('0x20')]?_['map'](_0x8fc892['include'],function(_0x5c6f0e){return{'model':db[_0x5c6f0e[_0xc9bd('0x21')]],'as':_0x5c6f0e['as'],'attributes':_0x5c6f0e['attributes']};}):[]};}):[]};}):[]:[]})[_0xc9bd('0x13')](function(_0x2ca6bb){logger['info']('ShowSmsAccount',_0x1691c1);logger[_0xc9bd('0x17')](_0xc9bd('0x23'),_0x1691c1,JSON['stringify'](_0x2ca6bb));_0x183493(_0x2ca6bb);})[_0xc9bd('0x24')](function(_0xfc4639){logger[_0xc9bd('0x19')](_0xc9bd('0x23'),_0xfc4639[_0xc9bd('0x1a')],_0x1691c1);_0x1c40f6(_0x46871b[_0xc9bd('0x19')](0x1f4,_0xfc4639[_0xc9bd('0x1a')]));});});}; \ No newline at end of file +var _0xc5cf=['options','raw','where','attributes','map','model','include','ShowSmsAccount','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','SmsAccount','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc5cf,0x71));var _0xfc5c=function(_0x316880,_0xf68286){_0x316880=_0x316880-0x0;var _0x51ec89=_0xc5cf[_0x316880];return _0x51ec89;};'use strict';var _=require('lodash');var util=require(_0xfc5c('0x0'));var moment=require(_0xfc5c('0x1'));var BPromise=require(_0xfc5c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfc5c('0x3'));var logger=require(_0xfc5c('0x4'))(_0xfc5c('0x5'));var config=require(_0xfc5c('0x6'));var jayson=require(_0xfc5c('0x7'));var client=jayson['client'][_0xfc5c('0x8')]({'port':0x232a});config['redis']=_[_0xfc5c('0x9')](config[_0xfc5c('0xa')],{'host':_0xfc5c('0xb'),'port':0x18eb});var socket=require(_0xfc5c('0xc'))(new Redis(config[_0xfc5c('0xa')]));require(_0xfc5c('0xd'))[_0xfc5c('0xe')](socket);function respondWithRpcPromise(_0x48c490,_0xe50fd7,_0x466461){return new BPromise(function(_0x5cd8d2,_0x5ea855){return client[_0xfc5c('0xf')](_0x48c490,_0x466461)[_0xfc5c('0x10')](function(_0x2297e3){logger[_0xfc5c('0x11')](_0xfc5c('0x12'),_0xe50fd7,'request\x20sent');logger[_0xfc5c('0x13')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe50fd7,_0xfc5c('0x14'),JSON['stringify'](_0x2297e3));if(_0x2297e3[_0xfc5c('0x15')]){if(_0x2297e3['error'][_0xfc5c('0x16')]===0x1f4){logger[_0xfc5c('0x15')]('SmsAccount,\x20%s,\x20%s',_0xe50fd7,_0x2297e3[_0xfc5c('0x15')][_0xfc5c('0x17')]);return _0x5ea855(_0x2297e3[_0xfc5c('0x15')][_0xfc5c('0x17')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0xe50fd7,_0x2297e3[_0xfc5c('0x15')]['message']);return _0x5cd8d2(_0x2297e3['error']['message']);}else{logger[_0xfc5c('0x11')](_0xfc5c('0x12'),_0xe50fd7,'request\x20sent');_0x5cd8d2(_0x2297e3[_0xfc5c('0x18')][_0xfc5c('0x17')]);}})['catch'](function(_0x139c3f){logger[_0xfc5c('0x15')](_0xfc5c('0x12'),_0xe50fd7,_0x139c3f);_0x5ea855(_0x139c3f);});});}exports['ShowSmsAccount']=function(_0xf12693){var _0x2feb7f=this;return new Promise(function(_0x351f7d,_0x427beb){return db[_0xfc5c('0x19')][_0xfc5c('0x1a')]({'raw':_0xf12693[_0xfc5c('0x1b')]?_0xf12693[_0xfc5c('0x1b')][_0xfc5c('0x1c')]===undefined?!![]:![]:!![],'where':_0xf12693[_0xfc5c('0x1b')]?_0xf12693[_0xfc5c('0x1b')][_0xfc5c('0x1d')]||null:null,'attributes':_0xf12693[_0xfc5c('0x1b')]?_0xf12693[_0xfc5c('0x1b')][_0xfc5c('0x1e')]||null:null,'include':_0xf12693[_0xfc5c('0x1b')]?_0xf12693[_0xfc5c('0x1b')]['include']?_[_0xfc5c('0x1f')](_0xf12693[_0xfc5c('0x1b')]['include'],function(_0x18d6cc){return{'model':db[_0x18d6cc[_0xfc5c('0x20')]],'as':_0x18d6cc['as'],'attributes':_0x18d6cc[_0xfc5c('0x1e')],'include':_0x18d6cc[_0xfc5c('0x21')]?_[_0xfc5c('0x1f')](_0x18d6cc[_0xfc5c('0x21')],function(_0x16d993){return{'model':db[_0x16d993['model']],'as':_0x16d993['as'],'attributes':_0x16d993[_0xfc5c('0x1e')],'include':_0x16d993[_0xfc5c('0x21')]?_[_0xfc5c('0x1f')](_0x16d993['include'],function(_0x2f5bea){return{'model':db[_0x2f5bea[_0xfc5c('0x20')]],'as':_0x2f5bea['as'],'attributes':_0x2f5bea[_0xfc5c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfc5c('0x10')](function(_0x4d91bc){logger[_0xfc5c('0x11')](_0xfc5c('0x22'),_0xf12693);logger[_0xfc5c('0x13')](_0xfc5c('0x22'),_0xf12693,JSON['stringify'](_0x4d91bc));_0x351f7d(_0x4d91bc);})['catch'](function(_0x439a89){logger[_0xfc5c('0x15')](_0xfc5c('0x22'),_0x439a89['message'],_0xf12693);_0x427beb(_0x2feb7f[_0xfc5c('0x15')](0x1f4,_0x439a89[_0xfc5c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 60d4b09..b48490f 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 _0xa9e2=['removeListener','register','smsAccount:','./smsAccount.events','save','remove','update'];(function(_0x5f05fc,_0x5cefb0){var _0x543b6e=function(_0x2e5fe0){while(--_0x2e5fe0){_0x5f05fc['push'](_0x5f05fc['shift']());}};_0x543b6e(++_0x5cefb0);}(_0xa9e2,0xc0));var _0x2a9e=function(_0x547bcb,_0x36d551){_0x547bcb=_0x547bcb-0x0;var _0x44a7ca=_0xa9e2[_0x547bcb];return _0x44a7ca;};'use strict';var SmsAccountEvents=require(_0x2a9e('0x0'));var events=[_0x2a9e('0x1'),_0x2a9e('0x2'),_0x2a9e('0x3')];function createListener(_0x55e4e9,_0x171570){return function(_0x598aea){_0x171570['emit'](_0x55e4e9,_0x598aea);};}function removeListener(_0x1adf2a,_0x562528){return function(){SmsAccountEvents[_0x2a9e('0x4')](_0x1adf2a,_0x562528);};}exports[_0x2a9e('0x5')]=function(_0x2eb623){for(var _0x2c8a5e=0x0,_0x15a389=events['length'];_0x2c8a5e<_0x15a389;_0x2c8a5e++){var _0x524a57=events[_0x2c8a5e];var _0x4f5b58=createListener(_0x2a9e('0x6')+_0x524a57,_0x2eb623);SmsAccountEvents['on'](_0x524a57,_0x4f5b58);}}; \ No newline at end of file +var _0x39ee=['update','emit','removeListener','register','length','remove'];(function(_0x131ddd,_0x16ec53){var _0x5d9fa6=function(_0x53d83d){while(--_0x53d83d){_0x131ddd['push'](_0x131ddd['shift']());}};_0x5d9fa6(++_0x16ec53);}(_0x39ee,0x8f));var _0xe39e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x39ee[_0x20a584];return _0x4b41a8;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=['save',_0xe39e('0x0'),_0xe39e('0x1')];function createListener(_0x4a74f4,_0x4ef904){return function(_0x1ce08e){_0x4ef904[_0xe39e('0x2')](_0x4a74f4,_0x1ce08e);};}function removeListener(_0x1085e0,_0x153640){return function(){SmsAccountEvents[_0xe39e('0x3')](_0x1085e0,_0x153640);};}exports[_0xe39e('0x4')]=function(_0x57292c){for(var _0x254d0c=0x0,_0x2603a2=events[_0xe39e('0x5')];_0x254d0c<_0x2603a2;_0x254d0c++){var _0x5ac93f=events[_0x254d0c];var _0x35b7d0=createListener('smsAccount:'+_0x5ac93f,_0x57292c);SmsAccountEvents['on'](_0x5ac93f,_0x35b7d0);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index edf9206..5fe7bc1 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 _0x4988=['post','create','/:id','update','delete','destroy','exports','multer','path','express','Router','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','show'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x4988,0x177));var _0x8498=function(_0x315851,_0x3a273e){_0x315851=_0x315851-0x0;var _0x589e40=_0x4988[_0x315851];return _0x589e40;};'use strict';var multer=require(_0x8498('0x0'));var util=require('util');var path=require(_0x8498('0x1'));var timeout=require('connect-timeout');var express=require(_0x8498('0x2'));var router=express[_0x8498('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x8498('0x4'));var config=require('../../config/environment');var controller=require(_0x8498('0x5'));router[_0x8498('0x6')]('/',auth[_0x8498('0x7')](),controller['index']);router[_0x8498('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x8498('0x8')]);router[_0x8498('0x9')]('/',auth[_0x8498('0x7')](),controller[_0x8498('0xa')]);router['put'](_0x8498('0xb'),auth['isAuthenticated'](),controller[_0x8498('0xc')]);router[_0x8498('0xd')]('/:id',auth[_0x8498('0x7')](),controller[_0x8498('0xe')]);module[_0x8498('0xf')]=router; \ No newline at end of file +var _0x2d93=['show','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x3f87ce,_0x4abd6c){var _0x8d7035=function(_0x5aa071){while(--_0x5aa071){_0x3f87ce['push'](_0x3f87ce['shift']());}};_0x8d7035(++_0x4abd6c);}(_0x2d93,0x1bf));var _0x32d9=function(_0x35e92e,_0x21581b){_0x35e92e=_0x35e92e-0x0;var _0x1205a8=_0x2d93[_0x35e92e];return _0x1205a8;};'use strict';var multer=require(_0x32d9('0x0'));var util=require(_0x32d9('0x1'));var path=require(_0x32d9('0x2'));var timeout=require('connect-timeout');var express=require(_0x32d9('0x3'));var router=express[_0x32d9('0x4')]();var auth=require(_0x32d9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x32d9('0x6'));var controller=require(_0x32d9('0x7'));router[_0x32d9('0x8')]('/',auth[_0x32d9('0x9')](),controller[_0x32d9('0xa')]);router[_0x32d9('0x8')](_0x32d9('0xb'),auth[_0x32d9('0x9')](),controller[_0x32d9('0xc')]);router[_0x32d9('0xd')]('/',auth[_0x32d9('0x9')](),controller['create']);router['put'](_0x32d9('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x32d9('0xe')](_0x32d9('0xb'),auth[_0x32d9('0x9')](),controller[_0x32d9('0xf')]);module[_0x32d9('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 0f5d5cb..beb3a02 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 _0xfd08=['INTEGER','STRING','noop'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xfd08,0x159));var _0x8fd0=function(_0x14e27a,_0x3b4136){_0x14e27a=_0x14e27a-0x0;var _0x288688=_0xfd08[_0x14e27a];return _0x288688;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x8fd0('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x8fd0('0x1')],'allowNull':![],'defaultValue':_0x8fd0('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xce11=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x1bbac4,_0x2088eb){var _0x47ee41=function(_0x1f3347){while(--_0x1f3347){_0x1bbac4['push'](_0x1bbac4['shift']());}};_0x47ee41(++_0x2088eb);}(_0xce11,0x96));var _0x1ce1=function(_0x5ebb22,_0x436320){_0x5ebb22=_0x5ebb22-0x0;var _0x2c7171=_0xce11[_0x5ebb22];return _0x2c7171;};'use strict';var Sequelize=require('sequelize');module[_0x1ce1('0x0')]={'priority':{'type':Sequelize[_0x1ce1('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1ce1('0x2')],'allowNull':![],'defaultValue':_0x1ce1('0x3')},'appdata':{'type':Sequelize[_0x1ce1('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1ce1('0x2')],'defaultValue':_0x1ce1('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 10f5e83..87f17c4 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 _0xd016=['moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','type','key','query','filters','intersection','fields','attributes','model','hasOwnProperty','nolimit','order','sort','filter','where','merge','SmsApplication','include','findAll','show','keys','options','catch','create','body','find','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xd016,0xd5));var _0x6d01=function(_0x54a82e,_0x4dffea){_0x54a82e=_0x54a82e-0x0;var _0x5a0c22=_0xd016[_0x54a82e];return _0x5a0c22;};'use strict';var pdf=require(_0x6d01('0x0'));var emlformat=require(_0x6d01('0x1'));var rimraf=require(_0x6d01('0x2'));var zipdir=require(_0x6d01('0x3'));var jsonpatch=require(_0x6d01('0x4'));var rp=require(_0x6d01('0x5'));var moment=require(_0x6d01('0x6'));var BPromise=require(_0x6d01('0x7'));var Mustache=require(_0x6d01('0x8'));var util=require(_0x6d01('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x6d01('0xa'));var ejs=require(_0x6d01('0xb'));var fs=require('fs');var _=require(_0x6d01('0xc'));var squel=require(_0x6d01('0xd'));var crypto=require(_0x6d01('0xe'));var jsforce=require(_0x6d01('0xf'));var deskjs=require(_0x6d01('0x10'));var toCsv=require(_0x6d01('0xa'));var querystring=require(_0x6d01('0x11'));var Papa=require(_0x6d01('0x12'));var Redis=require(_0x6d01('0x13'));var authService=require(_0x6d01('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x6d01('0x15'));var hardwareService=require(_0x6d01('0x16'));var logger=require(_0x6d01('0x17'))('api');var utils=require(_0x6d01('0x18'));var config=require(_0x6d01('0x19'));var licenseUtil=require(_0x6d01('0x1a'));var db=require(_0x6d01('0x1b'))['db'];function respondWithStatusCode(_0x148f8f,_0x4e5f47){_0x4e5f47=_0x4e5f47||0xcc;return function(_0x5891b7){if(_0x5891b7){return _0x148f8f[_0x6d01('0x1c')](_0x4e5f47);}return _0x148f8f[_0x6d01('0x1d')](_0x4e5f47)[_0x6d01('0x1e')]();};}function respondWithResult(_0x4ff632,_0x13b0cc){_0x13b0cc=_0x13b0cc||0xc8;return function(_0x555763){if(_0x555763){return _0x4ff632[_0x6d01('0x1d')](_0x13b0cc)[_0x6d01('0x1f')](_0x555763);}};}function respondWithFilteredResult(_0x493a4a,_0x2a75e2){return function(_0x8834ec){if(_0x8834ec){var _0x41efec=_0x8834ec[_0x6d01('0x20')],_0x34033a=_0x2a75e2[_0x6d01('0x21')],_0x216c29=_0x2a75e2[_0x6d01('0x21')]+_0x2a75e2[_0x6d01('0x22')],_0x56c28c;if(_0x216c29>=_0x41efec){_0x216c29=_0x41efec;_0x56c28c=0xc8;}else{_0x56c28c=0xce;}_0x493a4a[_0x6d01('0x1d')](_0x56c28c);return _0x493a4a[_0x6d01('0x23')]('Content-Range',_0x34033a+'-'+_0x216c29+'/'+_0x41efec)[_0x6d01('0x1f')](_0x8834ec);}return null;};}function patchUpdates(_0x58f0ae){return function(_0x5896ab){try{jsonpatch[_0x6d01('0x24')](_0x5896ab,_0x58f0ae,!![]);}catch(_0x2582e9){return BPromise['reject'](_0x2582e9);}return _0x5896ab[_0x6d01('0x25')]();};}function saveUpdates(_0x5d000d,_0x4e21dd){return function(_0x4b1472){if(_0x4b1472){return _0x4b1472[_0x6d01('0x26')](_0x5d000d)[_0x6d01('0x27')](function(_0x5d0a4d){return _0x5d0a4d;});}return null;};}function removeEntity(_0x4d2134,_0x53cdad){return function(_0x2b3074){if(_0x2b3074){return _0x2b3074['destroy']()[_0x6d01('0x27')](function(){_0x4d2134[_0x6d01('0x1d')](0xcc)[_0x6d01('0x1e')]();});}};}function handleEntityNotFound(_0x46efd1,_0x11b270){return function(_0x2fab1c){if(!_0x2fab1c){_0x46efd1[_0x6d01('0x1c')](0x194);}return _0x2fab1c;};}function handleError(_0x5b4903,_0xabb190){_0xabb190=_0xabb190||0x1f4;return function(_0x12c33e){logger[_0x6d01('0x28')](_0x12c33e[_0x6d01('0x29')]);if(_0x12c33e['name']){delete _0x12c33e[_0x6d01('0x2a')];}_0x5b4903['status'](_0xabb190)[_0x6d01('0x2b')](_0x12c33e);};}exports[_0x6d01('0x2c')]=function(_0x1aaa5c,_0x1e3d67){var _0x34f8ca={},_0x277b9e={},_0xb66c86={'count':0x0,'rows':[]};var _0x4b96fb=_[_0x6d01('0x2d')](db['SmsApplication'][_0x6d01('0x2e')],function(_0x44b8b8){return{'name':_0x44b8b8['fieldName'],'type':_0x44b8b8[_0x6d01('0x2f')][_0x6d01('0x30')]};});_0x277b9e['model']=_[_0x6d01('0x2d')](_0x4b96fb,'name');_0x277b9e[_0x6d01('0x31')]=_['keys'](_0x1aaa5c[_0x6d01('0x31')]);_0x277b9e[_0x6d01('0x32')]=_[_0x6d01('0x33')](_0x277b9e['model'],_0x277b9e['query']);_0x34f8ca['attributes']=_[_0x6d01('0x33')](_0x277b9e['model'],qs['fields'](_0x1aaa5c['query'][_0x6d01('0x34')]));_0x34f8ca[_0x6d01('0x35')]=_0x34f8ca[_0x6d01('0x35')]['length']?_0x34f8ca['attributes']:_0x277b9e[_0x6d01('0x36')];if(!_0x1aaa5c['query'][_0x6d01('0x37')](_0x6d01('0x38'))){_0x34f8ca[_0x6d01('0x22')]=qs[_0x6d01('0x22')](_0x1aaa5c[_0x6d01('0x31')][_0x6d01('0x22')]);_0x34f8ca[_0x6d01('0x21')]=qs[_0x6d01('0x21')](_0x1aaa5c[_0x6d01('0x31')][_0x6d01('0x21')]);}_0x34f8ca[_0x6d01('0x39')]=qs['sort'](_0x1aaa5c[_0x6d01('0x31')][_0x6d01('0x3a')]);_0x34f8ca['where']=qs[_0x6d01('0x32')](_['pick'](_0x1aaa5c[_0x6d01('0x31')],_0x277b9e['filters']),_0x4b96fb);if(_0x1aaa5c[_0x6d01('0x31')][_0x6d01('0x3b')]){_0x34f8ca[_0x6d01('0x3c')]=_[_0x6d01('0x3d')](_0x34f8ca['where'],{'$or':_['map'](_0x4b96fb,function(_0x400c9b){if(_0x400c9b[_0x6d01('0x2f')]!=='VIRTUAL'){var _0x1989d5={};_0x1989d5[_0x400c9b[_0x6d01('0x2a')]]={'$like':'%'+_0x1aaa5c['query'][_0x6d01('0x3b')]+'%'};return _0x1989d5;}})});}_0x34f8ca=_[_0x6d01('0x3d')]({},_0x34f8ca,_0x1aaa5c['options']);var _0x4bd02f={'where':_0x34f8ca['where']};return db[_0x6d01('0x3e')][_0x6d01('0x20')](_0x4bd02f)[_0x6d01('0x27')](function(_0x3e85e8){_0xb66c86[_0x6d01('0x20')]=_0x3e85e8;if(_0x1aaa5c[_0x6d01('0x31')]['includeAll']){_0x34f8ca[_0x6d01('0x3f')]=[{'all':!![]}];}return db[_0x6d01('0x3e')][_0x6d01('0x40')](_0x34f8ca);})[_0x6d01('0x27')](function(_0x2e52c8){_0xb66c86['rows']=_0x2e52c8;return _0xb66c86;})['then'](respondWithFilteredResult(_0x1e3d67,_0x34f8ca))['catch'](handleError(_0x1e3d67,null));};exports[_0x6d01('0x41')]=function(_0x230b7e,_0x48926a){var _0x5b2a80={'raw':!![],'where':{'id':_0x230b7e['params']['id']}},_0x38fcf4={};_0x38fcf4[_0x6d01('0x36')]=_[_0x6d01('0x42')](db['SmsApplication'][_0x6d01('0x2e')]);_0x38fcf4[_0x6d01('0x31')]=_[_0x6d01('0x42')](_0x230b7e['query']);_0x38fcf4[_0x6d01('0x32')]=_[_0x6d01('0x33')](_0x38fcf4[_0x6d01('0x36')],_0x38fcf4['query']);_0x5b2a80[_0x6d01('0x35')]=_[_0x6d01('0x33')](_0x38fcf4[_0x6d01('0x36')],qs['fields'](_0x230b7e['query']['fields']));_0x5b2a80[_0x6d01('0x35')]=_0x5b2a80[_0x6d01('0x35')]['length']?_0x5b2a80[_0x6d01('0x35')]:_0x38fcf4[_0x6d01('0x36')];if(_0x230b7e[_0x6d01('0x31')]['includeAll']){_0x5b2a80[_0x6d01('0x3f')]=[{'all':!![]}];}_0x5b2a80=_[_0x6d01('0x3d')]({},_0x5b2a80,_0x230b7e[_0x6d01('0x43')]);return db[_0x6d01('0x3e')]['find'](_0x5b2a80)['then'](handleEntityNotFound(_0x48926a,null))[_0x6d01('0x27')](respondWithResult(_0x48926a,null))[_0x6d01('0x44')](handleError(_0x48926a,null));};exports[_0x6d01('0x45')]=function(_0x33e959,_0x57cb77){return db[_0x6d01('0x3e')][_0x6d01('0x45')](_0x33e959[_0x6d01('0x46')],{})['then'](respondWithResult(_0x57cb77,0xc9))[_0x6d01('0x44')](handleError(_0x57cb77,null));};exports[_0x6d01('0x26')]=function(_0x37499f,_0x5cf5b4){if(_0x37499f[_0x6d01('0x46')]['id']){delete _0x37499f[_0x6d01('0x46')]['id'];}return db['SmsApplication'][_0x6d01('0x47')]({'where':{'id':_0x37499f['params']['id']}})[_0x6d01('0x27')](handleEntityNotFound(_0x5cf5b4,null))[_0x6d01('0x27')](saveUpdates(_0x37499f[_0x6d01('0x46')],null))['then'](respondWithResult(_0x5cf5b4,null))[_0x6d01('0x44')](handleError(_0x5cf5b4,null));};exports[_0x6d01('0x48')]=function(_0x566e7f,_0x14bd18){return db[_0x6d01('0x3e')][_0x6d01('0x47')]({'where':{'id':_0x566e7f['params']['id']}})[_0x6d01('0x27')](handleEntityNotFound(_0x14bd18,null))[_0x6d01('0x27')](removeEntity(_0x14bd18,null))['catch'](handleError(_0x14bd18,null));}; \ No newline at end of file +var _0x95b5=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','name','send','map','rawAttributes','fieldName','key','query','keys','intersection','fields','length','attributes','model','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','options','SmsApplication','count','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','html-pdf','rimraf','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x57928b,_0x29a111){var _0x49aad6=function(_0x34a268){while(--_0x34a268){_0x57928b['push'](_0x57928b['shift']());}};_0x49aad6(++_0x29a111);}(_0x95b5,0x143));var _0x595b=function(_0x146aac,_0x378163){_0x146aac=_0x146aac-0x0;var _0x2c0c27=_0x95b5[_0x146aac];return _0x2c0c27;};'use strict';var pdf=require(_0x595b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x595b('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('mustache');var util=require(_0x595b('0x2'));var path=require(_0x595b('0x3'));var sox=require(_0x595b('0x4'));var csv=require(_0x595b('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x595b('0x6'));var jsforce=require(_0x595b('0x7'));var deskjs=require(_0x595b('0x8'));var toCsv=require(_0x595b('0x5'));var querystring=require(_0x595b('0x9'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x595b('0xa'));var qs=require(_0x595b('0xb'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x595b('0xc'));var logger=require(_0x595b('0xd'))(_0x595b('0xe'));var utils=require('../../config/utils');var config=require(_0x595b('0xf'));var licenseUtil=require(_0x595b('0x10'));var db=require(_0x595b('0x11'))['db'];function respondWithStatusCode(_0x7df826,_0x3c845c){_0x3c845c=_0x3c845c||0xcc;return function(_0x28f05a){if(_0x28f05a){return _0x7df826['sendStatus'](_0x3c845c);}return _0x7df826[_0x595b('0x12')](_0x3c845c)['end']();};}function respondWithResult(_0x576e58,_0x1c2f8b){_0x1c2f8b=_0x1c2f8b||0xc8;return function(_0x26a88a){if(_0x26a88a){return _0x576e58[_0x595b('0x12')](_0x1c2f8b)[_0x595b('0x13')](_0x26a88a);}};}function respondWithFilteredResult(_0x48429d,_0x1ab11e){return function(_0x385f64){if(_0x385f64){var _0x549fbf=_0x385f64['count'],_0xf1ecde=_0x1ab11e[_0x595b('0x14')],_0x2c53d4=_0x1ab11e[_0x595b('0x14')]+_0x1ab11e[_0x595b('0x15')],_0x12d45b;if(_0x2c53d4>=_0x549fbf){_0x2c53d4=_0x549fbf;_0x12d45b=0xc8;}else{_0x12d45b=0xce;}_0x48429d[_0x595b('0x12')](_0x12d45b);return _0x48429d[_0x595b('0x16')](_0x595b('0x17'),_0xf1ecde+'-'+_0x2c53d4+'/'+_0x549fbf)[_0x595b('0x13')](_0x385f64);}return null;};}function patchUpdates(_0x3b08f7){return function(_0x2fb087){try{jsonpatch[_0x595b('0x18')](_0x2fb087,_0x3b08f7,!![]);}catch(_0x37afba){return BPromise[_0x595b('0x19')](_0x37afba);}return _0x2fb087[_0x595b('0x1a')]();};}function saveUpdates(_0x50ec9e,_0xbf59e3){return function(_0x1981de){if(_0x1981de){return _0x1981de[_0x595b('0x1b')](_0x50ec9e)[_0x595b('0x1c')](function(_0x5bc0c){return _0x5bc0c;});}return null;};}function removeEntity(_0x4cd310,_0x2eaed6){return function(_0x378444){if(_0x378444){return _0x378444['destroy']()['then'](function(){_0x4cd310[_0x595b('0x12')](0xcc)[_0x595b('0x1d')]();});}};}function handleEntityNotFound(_0x3218b1,_0x3cfaa5){return function(_0x44dc72){if(!_0x44dc72){_0x3218b1[_0x595b('0x1e')](0x194);}return _0x44dc72;};}function handleError(_0x577151,_0x5dae54){_0x5dae54=_0x5dae54||0x1f4;return function(_0x30856e){logger[_0x595b('0x1f')](_0x30856e['stack']);if(_0x30856e[_0x595b('0x20')]){delete _0x30856e['name'];}_0x577151[_0x595b('0x12')](_0x5dae54)[_0x595b('0x21')](_0x30856e);};}exports['index']=function(_0x2542cb,_0x2cf493){var _0x36c41c={},_0x144915={},_0x59e161={'count':0x0,'rows':[]};var _0x3cd69a=_[_0x595b('0x22')](db['SmsApplication'][_0x595b('0x23')],function(_0x1f2e34){return{'name':_0x1f2e34[_0x595b('0x24')],'type':_0x1f2e34['type'][_0x595b('0x25')]};});_0x144915['model']=_[_0x595b('0x22')](_0x3cd69a,_0x595b('0x20'));_0x144915[_0x595b('0x26')]=_[_0x595b('0x27')](_0x2542cb[_0x595b('0x26')]);_0x144915['filters']=_[_0x595b('0x28')](_0x144915['model'],_0x144915['query']);_0x36c41c['attributes']=_['intersection'](_0x144915['model'],qs['fields'](_0x2542cb[_0x595b('0x26')][_0x595b('0x29')]));_0x36c41c['attributes']=_0x36c41c['attributes'][_0x595b('0x2a')]?_0x36c41c[_0x595b('0x2b')]:_0x144915[_0x595b('0x2c')];if(!_0x2542cb[_0x595b('0x26')][_0x595b('0x2d')](_0x595b('0x2e'))){_0x36c41c[_0x595b('0x15')]=qs[_0x595b('0x15')](_0x2542cb[_0x595b('0x26')][_0x595b('0x15')]);_0x36c41c[_0x595b('0x14')]=qs['offset'](_0x2542cb['query'][_0x595b('0x14')]);}_0x36c41c['order']=qs[_0x595b('0x2f')](_0x2542cb[_0x595b('0x26')][_0x595b('0x2f')]);_0x36c41c[_0x595b('0x30')]=qs[_0x595b('0x31')](_[_0x595b('0x32')](_0x2542cb[_0x595b('0x26')],_0x144915[_0x595b('0x31')]),_0x3cd69a);if(_0x2542cb[_0x595b('0x26')][_0x595b('0x33')]){_0x36c41c[_0x595b('0x30')]=_[_0x595b('0x34')](_0x36c41c['where'],{'$or':_['map'](_0x3cd69a,function(_0x496d4d){if(_0x496d4d[_0x595b('0x35')]!=='VIRTUAL'){var _0x36feb8={};_0x36feb8[_0x496d4d[_0x595b('0x20')]]={'$like':'%'+_0x2542cb[_0x595b('0x26')][_0x595b('0x33')]+'%'};return _0x36feb8;}})});}_0x36c41c=_[_0x595b('0x34')]({},_0x36c41c,_0x2542cb[_0x595b('0x36')]);var _0x51be1b={'where':_0x36c41c[_0x595b('0x30')]};return db[_0x595b('0x37')][_0x595b('0x38')](_0x51be1b)['then'](function(_0x16c9a3){_0x59e161[_0x595b('0x38')]=_0x16c9a3;if(_0x2542cb['query'][_0x595b('0x39')]){_0x36c41c[_0x595b('0x3a')]=[{'all':!![]}];}return db[_0x595b('0x37')][_0x595b('0x3b')](_0x36c41c);})[_0x595b('0x1c')](function(_0x2fc379){_0x59e161[_0x595b('0x3c')]=_0x2fc379;return _0x59e161;})[_0x595b('0x1c')](respondWithFilteredResult(_0x2cf493,_0x36c41c))[_0x595b('0x3d')](handleError(_0x2cf493,null));};exports['show']=function(_0x58c918,_0x21e453){var _0x5825ca={'raw':!![],'where':{'id':_0x58c918[_0x595b('0x3e')]['id']}},_0x166244={};_0x166244[_0x595b('0x2c')]=_[_0x595b('0x27')](db[_0x595b('0x37')]['rawAttributes']);_0x166244['query']=_[_0x595b('0x27')](_0x58c918[_0x595b('0x26')]);_0x166244[_0x595b('0x31')]=_[_0x595b('0x28')](_0x166244['model'],_0x166244[_0x595b('0x26')]);_0x5825ca[_0x595b('0x2b')]=_['intersection'](_0x166244[_0x595b('0x2c')],qs['fields'](_0x58c918[_0x595b('0x26')][_0x595b('0x29')]));_0x5825ca['attributes']=_0x5825ca[_0x595b('0x2b')]['length']?_0x5825ca[_0x595b('0x2b')]:_0x166244['model'];if(_0x58c918[_0x595b('0x26')][_0x595b('0x39')]){_0x5825ca[_0x595b('0x3a')]=[{'all':!![]}];}_0x5825ca=_[_0x595b('0x34')]({},_0x5825ca,_0x58c918[_0x595b('0x36')]);return db[_0x595b('0x37')][_0x595b('0x3f')](_0x5825ca)[_0x595b('0x1c')](handleEntityNotFound(_0x21e453,null))['then'](respondWithResult(_0x21e453,null))[_0x595b('0x3d')](handleError(_0x21e453,null));};exports[_0x595b('0x40')]=function(_0x44c9d6,_0x59236d){return db[_0x595b('0x37')][_0x595b('0x40')](_0x44c9d6[_0x595b('0x41')],{})['then'](respondWithResult(_0x59236d,0xc9))[_0x595b('0x3d')](handleError(_0x59236d,null));};exports['update']=function(_0x3579a7,_0x5e9dd8){if(_0x3579a7['body']['id']){delete _0x3579a7[_0x595b('0x41')]['id'];}return db[_0x595b('0x37')][_0x595b('0x3f')]({'where':{'id':_0x3579a7[_0x595b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5e9dd8,null))[_0x595b('0x1c')](saveUpdates(_0x3579a7[_0x595b('0x41')],null))[_0x595b('0x1c')](respondWithResult(_0x5e9dd8,null))[_0x595b('0x3d')](handleError(_0x5e9dd8,null));};exports[_0x595b('0x42')]=function(_0xc16a2a,_0x48ce19){return db[_0x595b('0x37')][_0x595b('0x3f')]({'where':{'id':_0xc16a2a[_0x595b('0x3e')]['id']}})[_0x595b('0x1c')](handleEntityNotFound(_0x48ce19,null))[_0x595b('0x1c')](removeEntity(_0x48ce19,null))[_0x595b('0x3d')](handleError(_0x48ce19,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 11ff303..5b16e65 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 _0x7203=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','SmsApplication','sms_applications','utf8mb4'];(function(_0x4fbb3e,_0x55785f){var _0x1eb197=function(_0xfda25){while(--_0xfda25){_0x4fbb3e['push'](_0x4fbb3e['shift']());}};_0x1eb197(++_0x55785f);}(_0x7203,0x69));var _0x3720=function(_0x29a539,_0x10a434){_0x29a539=_0x29a539-0x0;var _0x137682=_0x7203[_0x29a539];return _0x137682;};'use strict';var _=require(_0x3720('0x0'));var util=require('util');var logger=require(_0x3720('0x1'))(_0x3720('0x2'));var moment=require(_0x3720('0x3'));var BPromise=require('bluebird');var rp=require(_0x3720('0x4'));var fs=require('fs');var path=require(_0x3720('0x5'));var rimraf=require(_0x3720('0x6'));var config=require(_0x3720('0x7'));var attributes=require('./smsApplication.attributes');module[_0x3720('0x8')]=function(_0x23ae08,_0x2157ab){return _0x23ae08['define'](_0x3720('0x9'),attributes,{'tableName':_0x3720('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3720('0xb'),'collate':_0x3720('0xc')});}; \ No newline at end of file +var _0x8f78=['utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','SmsApplication','utf8mb4'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8f78,0x194));var _0x88f7=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x8f78[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x88f7('0x0'));var util=require(_0x88f7('0x1'));var logger=require(_0x88f7('0x2'))('api');var moment=require(_0x88f7('0x3'));var BPromise=require(_0x88f7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x88f7('0x5'));var rimraf=require(_0x88f7('0x6'));var config=require(_0x88f7('0x7'));var attributes=require('./smsApplication.attributes');module[_0x88f7('0x8')]=function(_0x4cc1c1,_0x4ffd1a){return _0x4cc1c1[_0x88f7('0x9')](_0x88f7('0xa'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x88f7('0xb'),'collate':_0x88f7('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 15a43cb..9527861 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 _0xdcf6=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsApplication,\x20%s,\x20%s','message','info','result'];(function(_0x2ea10b,_0x1c26b9){var _0x50f1e6=function(_0x50db75){while(--_0x50db75){_0x2ea10b['push'](_0x2ea10b['shift']());}};_0x50f1e6(++_0x1c26b9);}(_0xdcf6,0x1b6));var _0x6dcf=function(_0x4c5c97,_0x4f85bf){_0x4c5c97=_0x4c5c97-0x0;var _0xd5d2cb=_0xdcf6[_0x4c5c97];return _0xd5d2cb;};'use strict';var _=require('lodash');var util=require(_0x6dcf('0x0'));var moment=require(_0x6dcf('0x1'));var BPromise=require(_0x6dcf('0x2'));var rs=require(_0x6dcf('0x3'));var fs=require('fs');var Redis=require(_0x6dcf('0x4'));var db=require(_0x6dcf('0x5'))['db'];var utils=require(_0x6dcf('0x6'));var logger=require('../../config/logger')(_0x6dcf('0x7'));var config=require(_0x6dcf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6dcf('0x9')][_0x6dcf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5abd79,_0x56fdb2,_0x5766db){return new BPromise(function(_0x34517a,_0x4e2877){return client[_0x6dcf('0xb')](_0x5abd79,_0x5766db)[_0x6dcf('0xc')](function(_0x304a75){logger['info']('SmsApplication,\x20%s,\x20%s',_0x56fdb2,'request\x20sent');logger[_0x6dcf('0xd')](_0x6dcf('0xe'),_0x56fdb2,_0x6dcf('0xf'),JSON['stringify'](_0x304a75));if(_0x304a75[_0x6dcf('0x10')]){if(_0x304a75[_0x6dcf('0x10')][_0x6dcf('0x11')]===0x1f4){logger[_0x6dcf('0x10')](_0x6dcf('0x12'),_0x56fdb2,_0x304a75[_0x6dcf('0x10')][_0x6dcf('0x13')]);return _0x4e2877(_0x304a75[_0x6dcf('0x10')][_0x6dcf('0x13')]);}logger[_0x6dcf('0x10')](_0x6dcf('0x12'),_0x56fdb2,_0x304a75[_0x6dcf('0x10')][_0x6dcf('0x13')]);return _0x34517a(_0x304a75[_0x6dcf('0x10')][_0x6dcf('0x13')]);}else{logger[_0x6dcf('0x14')](_0x6dcf('0x12'),_0x56fdb2,'request\x20sent');_0x34517a(_0x304a75[_0x6dcf('0x15')][_0x6dcf('0x13')]);}})[_0x6dcf('0x16')](function(_0x4874ff){logger[_0x6dcf('0x10')](_0x6dcf('0x12'),_0x56fdb2,_0x4874ff);_0x4e2877(_0x4874ff);});});} \ No newline at end of file +var _0xb4e6=['request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsApplication,\x20%s,\x20%s'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xb4e6,0xd8));var _0x6b4e=function(_0x2440fe,_0x281a11){_0x2440fe=_0x2440fe-0x0;var _0x5cf734=_0xb4e6[_0x2440fe];return _0x5cf734;};'use strict';var _=require(_0x6b4e('0x0'));var util=require(_0x6b4e('0x1'));var moment=require(_0x6b4e('0x2'));var BPromise=require(_0x6b4e('0x3'));var rs=require(_0x6b4e('0x4'));var fs=require('fs');var Redis=require(_0x6b4e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6b4e('0x6'));var logger=require('../../config/logger')(_0x6b4e('0x7'));var config=require(_0x6b4e('0x8'));var jayson=require(_0x6b4e('0x9'));var client=jayson[_0x6b4e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4091d6,_0x189e5b,_0x471c1e){return new BPromise(function(_0x187c7d,_0x2abbbb){return client[_0x6b4e('0xb')](_0x4091d6,_0x471c1e)[_0x6b4e('0xc')](function(_0x23c442){logger[_0x6b4e('0xd')](_0x6b4e('0xe'),_0x189e5b,_0x6b4e('0xf'));logger[_0x6b4e('0x10')](_0x6b4e('0x11'),_0x189e5b,_0x6b4e('0xf'),JSON[_0x6b4e('0x12')](_0x23c442));if(_0x23c442[_0x6b4e('0x13')]){if(_0x23c442[_0x6b4e('0x13')]['code']===0x1f4){logger['error'](_0x6b4e('0xe'),_0x189e5b,_0x23c442[_0x6b4e('0x13')][_0x6b4e('0x14')]);return _0x2abbbb(_0x23c442[_0x6b4e('0x13')]['message']);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x189e5b,_0x23c442['error'][_0x6b4e('0x14')]);return _0x187c7d(_0x23c442[_0x6b4e('0x13')][_0x6b4e('0x14')]);}else{logger[_0x6b4e('0xd')](_0x6b4e('0xe'),_0x189e5b,_0x6b4e('0xf'));_0x187c7d(_0x23c442['result'][_0x6b4e('0x14')]);}})['catch'](function(_0x3a7508){logger[_0x6b4e('0x13')](_0x6b4e('0xe'),_0x189e5b,_0x3a7508);_0x2abbbb(_0x3a7508);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index ee9ca98..e871eff 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 _0x14bc=['get','index','/describe','describe','show','/:id/messages','isAuthenticated','getMessages','/:id/download','download','create','post','/:id/tags','tracked','smsinteraction:addtags','addTags','put','sms','smsinteraction:update','update','smsinteraction:destroy','destroy','delete','removeTags','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsInteraction.controller'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x14bc,0x199));var _0xc14b=function(_0x532ee0,_0x20be59){_0x532ee0=_0x532ee0-0x0;var _0x22990b=_0x14bc[_0x532ee0];return _0x22990b;};'use strict';var multer=require('multer');var util=require(_0xc14b('0x0'));var path=require('path');var timeout=require(_0xc14b('0x1'));var express=require(_0xc14b('0x2'));var router=express[_0xc14b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc14b('0x4'));var config=require(_0xc14b('0x5'));var controller=require(_0xc14b('0x6'));router[_0xc14b('0x7')]('/',auth['isAuthenticated'](),controller[_0xc14b('0x8')]);router[_0xc14b('0x7')](_0xc14b('0x9'),auth['isAuthenticated'](),controller[_0xc14b('0xa')]);router[_0xc14b('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xc14b('0xb')]);router[_0xc14b('0x7')](_0xc14b('0xc'),auth[_0xc14b('0xd')](),controller[_0xc14b('0xe')]);router[_0xc14b('0x7')](_0xc14b('0xf'),auth[_0xc14b('0xd')](),controller[_0xc14b('0x10')]);router['post']('/',auth[_0xc14b('0xd')](),controller[_0xc14b('0x11')]);router[_0xc14b('0x12')](_0xc14b('0xc'),auth['isAuthenticated'](),controller['addMessage']);router[_0xc14b('0x12')](_0xc14b('0x13'),auth[_0xc14b('0xd')](),interaction[_0xc14b('0x14')]('sms',_0xc14b('0x15')),controller[_0xc14b('0x16')]);router[_0xc14b('0x17')]('/:id',auth[_0xc14b('0xd')](),interaction[_0xc14b('0x14')](_0xc14b('0x18'),_0xc14b('0x19')),controller[_0xc14b('0x1a')]);router['delete']('/:id',auth[_0xc14b('0xd')](),interaction[_0xc14b('0x14')](_0xc14b('0x18'),_0xc14b('0x1b')),controller[_0xc14b('0x1c')]);router[_0xc14b('0x1d')](_0xc14b('0x13'),auth[_0xc14b('0xd')](),controller[_0xc14b('0x1e')]);module[_0xc14b('0x1f')]=router; \ No newline at end of file +var _0x9e07=['update','delete','/:id','destroy','removeTags','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','get','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','sms','addTags','put','smsinteraction:update'];(function(_0x15411f,_0x42bef8){var _0x555650=function(_0x215e4f){while(--_0x215e4f){_0x15411f['push'](_0x15411f['shift']());}};_0x555650(++_0x42bef8);}(_0x9e07,0x10b));var _0x79e0=function(_0x353bbb,_0x47e987){_0x353bbb=_0x353bbb-0x0;var _0x16e096=_0x9e07[_0x353bbb];return _0x16e096;};'use strict';var multer=require('multer');var util=require(_0x79e0('0x0'));var path=require('path');var timeout=require(_0x79e0('0x1'));var express=require(_0x79e0('0x2'));var router=express['Router']();var auth=require(_0x79e0('0x3'));var interaction=require(_0x79e0('0x4'));var config=require(_0x79e0('0x5'));var controller=require('./smsInteraction.controller');router['get']('/',auth[_0x79e0('0x6')](),controller[_0x79e0('0x7')]);router['get'](_0x79e0('0x8'),auth[_0x79e0('0x6')](),controller['describe']);router[_0x79e0('0x9')]('/:id',auth[_0x79e0('0x6')](),controller[_0x79e0('0xa')]);router[_0x79e0('0x9')](_0x79e0('0xb'),auth[_0x79e0('0x6')](),controller[_0x79e0('0xc')]);router['get'](_0x79e0('0xd'),auth[_0x79e0('0x6')](),controller['download']);router[_0x79e0('0xe')]('/',auth[_0x79e0('0x6')](),controller[_0x79e0('0xf')]);router[_0x79e0('0xe')](_0x79e0('0xb'),auth[_0x79e0('0x6')](),controller[_0x79e0('0x10')]);router[_0x79e0('0xe')](_0x79e0('0x11'),auth[_0x79e0('0x6')](),interaction[_0x79e0('0x12')](_0x79e0('0x13'),'smsinteraction:addtags'),controller[_0x79e0('0x14')]);router[_0x79e0('0x15')]('/:id',auth[_0x79e0('0x6')](),interaction[_0x79e0('0x12')](_0x79e0('0x13'),_0x79e0('0x16')),controller[_0x79e0('0x17')]);router[_0x79e0('0x18')](_0x79e0('0x19'),auth[_0x79e0('0x6')](),interaction[_0x79e0('0x12')](_0x79e0('0x13'),'smsinteraction:destroy'),controller[_0x79e0('0x1a')]);router['delete']('/:id/tags',auth[_0x79e0('0x6')](),controller[_0x79e0('0x1b')]);module[_0x79e0('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 10f870a..95c44af 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 _0xab8e=['DATE','ENUM','out','sequelize','exports','BOOLEAN','STRING'];(function(_0xeee806,_0x3bbc55){var _0x7ed38e=function(_0x28e2b4){while(--_0x28e2b4){_0xeee806['push'](_0xeee806['shift']());}};_0x7ed38e(++_0x3bbc55);}(_0xab8e,0xf8));var _0xeab8=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xab8e[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0xeab8('0x0'));var moment=require('moment');module[_0xeab8('0x1')]={'closed':{'type':Sequelize[_0xeab8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xeab8('0x3')]},'secondDisposition':{'type':Sequelize[_0xeab8('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xeab8('0x3')]},'read1stAt':{'type':Sequelize[_0xeab8('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xeab8('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xeab8('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xeab8('0x5')]('in',_0xeab8('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x5ac6=['out','sequelize','moment','BOOLEAN','DATE','STRING','ENUM'];(function(_0x4b8d97,_0x39ac63){var _0x58f95f=function(_0x568ea2){while(--_0x568ea2){_0x4b8d97['push'](_0x4b8d97['shift']());}};_0x58f95f(++_0x39ac63);}(_0x5ac6,0x1a5));var _0x65ac=function(_0x547fd9,_0x12501b){_0x547fd9=_0x547fd9-0x0;var _0xd46477=_0x5ac6[_0x547fd9];return _0xd46477;};'use strict';var Sequelize=require(_0x65ac('0x0'));var moment=require(_0x65ac('0x1'));module['exports']={'closed':{'type':Sequelize[_0x65ac('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x65ac('0x3')]},'disposition':{'type':Sequelize[_0x65ac('0x4')]},'secondDisposition':{'type':Sequelize[_0x65ac('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x65ac('0x4')]},'phone':{'type':Sequelize[_0x65ac('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x65ac('0x5')]('in',_0x65ac('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x65ac('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x65ac('0x5')]('in','out'),'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 a81c249..df99f3b 100644 --- a/server/api/smsInteraction/smsInteraction.controller.js +++ b/server/api/smsInteraction/smsInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['params','keys','includeAll','include','options','create','body','describe','SmsMessage','addMessage','ids','omit','getMessages','format','rows','addTags','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','transcript-%d-%s.zip','CmContact','lastName','direction','SmsAccount','Owner','mkdirSync','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Sms','YYYY-MM-DD','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','Messages','out','System','secret','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','catch','index','map','SmsInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','ContactId','buildExpression','text','start','end','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','length','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','show'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function updateSmsInteraction(_0x2407f9,_0x3ae878,_0x1122db){return new BPromise(function(_0x33bdb7,_0x25ce3a){return getInteractionUsers(_0x2407f9,_0x1122db)['then'](function(_0x66c1d2){return getInteractionTags(_0x66c1d2,_0x3ae878);})[_0x0a9e('0x22')](function(_0x40cb85){_0x33bdb7(_0x40cb85);})[_0x0a9e('0x2d')](function(_0x2b45ea){_0x25ce3a(_0x2b45ea);});});}exports[_0x0a9e('0x2e')]=function(_0x332d35,_0x39e565){var _0x5583a4={},_0x44295a={},_0x5e7238={'count':0x0,'rows':[]};var _0x2cc7a0=_[_0x0a9e('0x2f')](db[_0x0a9e('0x30')][_0x0a9e('0x31')],function(_0x567193){return{'name':_0x567193[_0x0a9e('0x32')],'type':_0x567193[_0x0a9e('0x33')][_0x0a9e('0x34')]};});_0x44295a[_0x0a9e('0x35')]=_['map'](_0x2cc7a0,'name');_0x44295a[_0x0a9e('0x36')]=_['keys'](_0x332d35[_0x0a9e('0x36')]);_0x44295a[_0x0a9e('0x37')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],_0x44295a['query']);_0x5583a4[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],qs['fields'](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]));_0x5583a4[_0x0a9e('0x39')]=_0x5583a4['attributes']['length']?_0x5583a4[_0x0a9e('0x39')]:_0x44295a[_0x0a9e('0x35')];if(!_0x332d35['query'][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x5583a4[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x332d35['query']['limit']);_0x5583a4[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x332d35['query'][_0x0a9e('0x1c')]);}_0x5583a4[_0x0a9e('0x3d')]=qs[_0x0a9e('0x3e')](_0x332d35['query'][_0x0a9e('0x3e')]);_0x5583a4[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_[_0x0a9e('0x40')](_0x332d35[_0x0a9e('0x36')],_0x44295a[_0x0a9e('0x37')]),_0x2cc7a0);var _0x2881b3=[];var _0x45a9b8=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x25'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')]('tools_tags');var _0x52628e=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')](_0x0a9e('0x45'))[_0x0a9e('0x42')](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x44')](_0x0a9e('0x48'),'ui')[_0x0a9e('0x49')](_0x0a9e('0x4a'),'u',_0x0a9e('0x4b'));var _0x5026aa=squel[_0x0a9e('0x41')]()[_0x0a9e('0x44')](_0x0a9e('0x4c'),'i')[_0x0a9e('0x49')](_0x0a9e('0x4d'),'c',_0x0a9e('0x4e'))[_0x0a9e('0x49')](_0x0a9e('0x4a'),'o','o.id\x20=\x20i.UserId')[_0x0a9e('0x49')]('sms_accounts','a',_0x0a9e('0x4f'))[_0x0a9e('0x49')](_0x0a9e('0x50'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x0a9e('0x49')](_0x0a9e('0x51'),'it',_0x0a9e('0x52'))[_0x0a9e('0x49')](_0x0a9e('0x53'),'t',_0x0a9e('0x54'));var _0x45bf7f=squel['expr']();var _0x13f44d=[];var _0x1bde3c=squel[_0x0a9e('0x55')]();var _0x16f976;if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]){_0x16f976=as[_0x0a9e('0x57')](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]);var _0x58a5c2=_0x16f976[_0x0a9e('0x58')];for(var _0x3fe430=0x0;_0x3fe430<_0x16f976['conditions']['length'];_0x3fe430++){var _0x5ddf84=_0x16f976[_0x0a9e('0x59')][_0x3fe430];var _0x4317e3='i';var _0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x5ddf84[_0x0a9e('0x42')]]);if(!_0x37edaa){switch(_0x5ddf84[_0x0a9e('0x42')]){case _0x0a9e('0x5b'):if(_0x5ddf84['value']==0x1){_0x5026aa['having']('`'+_0x5ddf84['field']+_0x0a9e('0x5c'));}else{_0x5026aa[_0x0a9e('0x5d')]('`'+_0x5ddf84[_0x0a9e('0x42')]+'`\x20>\x200');}break;case _0x0a9e('0x5e'):if(_0x5ddf84[_0x0a9e('0x5f')]==='$substring'){if(_0x5ddf84['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x45bf7f[_0x58a5c2](_0x0a9e('0x60'),qs['getFullTextValue'](_0x5ddf84[_0x0a9e('0x61')]),null);}else{var _0x3c20b2='%'+_0x5ddf84[_0x0a9e('0x61')]+'%';_0x45bf7f[_0x58a5c2]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3c20b2,_0x3c20b2,_0x3c20b2);}}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),'ContactId']);_0x5ddf84['field']=_0x0a9e('0x62');_0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa['type'],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'Tag':var _0x5da27d=_0x5ddf84['value'][_0x0a9e('0x2b')](',')['map'](function(_0x2f7092){return Number(_0x2f7092);});_0x5da27d[_0x0a9e('0x2c')](function(_0x3cfd00){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x3cfd00+',%');});_0x13f44d=_[_0x0a9e('0x68')](_0x13f44d,_0x5da27d);break;case _0x0a9e('0x69'):if(_0x5ddf84[_0x0a9e('0x5f')]===_0x0a9e('0x6a')){_0x45bf7f[_0x58a5c2]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5ddf84[_0x0a9e('0x61')]+'%',null);}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x0a9e('0x6b')]);_0x5ddf84[_0x0a9e('0x42')]=_0x0a9e('0x6b');_0x261adb=as['buildExpression'](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'body':_0x261adb=as['buildExpression']('me',null,_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb['text'],_0x261adb[_0x0a9e('0x61')]['start'],_0x261adb[_0x0a9e('0x61')][_0x0a9e('0x66')]);break;}}else{var _0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}}}else{var _0x1f07cb=_(_0x332d35[_0x0a9e('0x36')])['keys']()[_0x0a9e('0x2f')](function(_0x156f1c){return _[_0x0a9e('0x6c')](_0x2cc7a0,[_0x0a9e('0x25'),_0x156f1c])?_0x156f1c:undefined;})['compact']()[_0x0a9e('0x61')]();if(!_[_0x0a9e('0x6d')](_0x1f07cb)){_0x1f07cb['forEach'](function(_0x797b45){if(_0x797b45===_0x0a9e('0x6e')){_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x6f'),[][_0x0a9e('0x70')](_0x332d35['query'][_0x797b45]));}else if(_0x797b45===_0x0a9e('0x71')){var _0x2937e0=JSON[_0x0a9e('0x72')](_0x332d35['query'][_0x797b45])[_0x0a9e('0x73')];var _0x4f1e60=JSON['parse'](_0x332d35[_0x0a9e('0x36')][_0x797b45])[_0x0a9e('0x74')];_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x75'),_0x2937e0,_0x4f1e60);}else{if(_0x332d35[_0x0a9e('0x36')][_0x797b45]===_0x0a9e('0x76')){_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x77'));}else{_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x78'),_0x332d35[_0x0a9e('0x36')][_0x797b45]);}}});}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]==0x1){_0x5026aa[_0x0a9e('0x5d')](_0x0a9e('0x7a'));}else{_0x5026aa[_0x0a9e('0x5d')]('`unreadMessages`\x20>\x200');}}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]){_0x13f44d=_[_0x0a9e('0x7c')](_0x332d35['query'][_0x0a9e('0x7b')])?_0x332d35[_0x0a9e('0x36')]['tag']:new Array(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]);_0x13f44d[_0x0a9e('0x2c')](function(_0x427946){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x427946+',%');});}if(_0x332d35['query']['filter']){var _0x4a2438=_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7d')][_0x0a9e('0x7e')]('\x5c','\x5c\x5c')[_0x0a9e('0x7e')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x7f')](_0x4a2438)){_0x45bf7f['or'](_0x0a9e('0x80'),_0x4a2438+'%')['or'](_0x0a9e('0x81'),_0x4a2438+'%');}else{_0x45bf7f['or'](_0x0a9e('0x82'),qs['getFullTextValue'](_0x4a2438))['or'](_0x0a9e('0x83'),_0x4a2438+'%');}}}_0x5026aa[_0x0a9e('0x3f')](_0x45bf7f);_0x5026aa[_0x0a9e('0x84')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x85')][_0x0a9e('0x86')],'raw':!![]};var _0x4c46c1=_0x5026aa[_0x0a9e('0x87')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x88'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5b'));if(_0x5583a4[_0x0a9e('0x3d')]){_0x5583a4[_0x0a9e('0x3d')][_0x0a9e('0x2c')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x89')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x5026aa[_0x0a9e('0x3d')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x8a')?![]:!![]);});}if(!_['isEmpty'](_0x13f44d)){_0x5026aa[_0x0a9e('0x5d')](_0x1bde3c);_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8b'),_0x13f44d);}BPromise[_0x0a9e('0x8c')]()[_0x0a9e('0x22')](function(){if(!_0x16f976){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return;_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8d'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x8d'));return;}if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]!==_0x0a9e('0x90'))return;return _0x332d35['user'][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x92'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x92'));}else{_0x4c46c1['where']('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));_0x5026aa[_0x0a9e('0x3f')]('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));}});})['then'](function(){if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]==='agent'&&!_0x16f976&&!_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x4c46c1[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x444f1f){_0x5e7238['count']=_0x444f1f[_0x0a9e('0x95')];if(_0x5e7238[_0x0a9e('0x1b')]===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x45a9b8['toString'](),_0x2bdc44)[_0x0a9e('0x22')](function(_0xf0db1){_0x2881b3=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x96')](_0x2bdc44,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]){_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x2c')](function(_0x5af453){_0x5026aa['field']('i.'+_0x5af453);});}else{_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x97'),_0x0a9e('0x5b'));_0x5026aa['field'](_0x0a9e('0x98'),_0x0a9e('0x99'));_0x5026aa['field']('a.mandatoryDisposition',_0x0a9e('0x9a'));_0x5026aa['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9b'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9c'),_0x0a9e('0x9d'));_0x5026aa[_0x0a9e('0x42')]('c.lastName',_0x0a9e('0x9e'));_0x5026aa['field'](_0x0a9e('0x9f'),_0x0a9e('0xa0'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa1'),'Contact.phone');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x5026aa['field'](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x5026aa['field'](_0x0a9e('0xaa'),_0x0a9e('0x29'));}if(_0x5583a4['limit'])_0x5026aa[_0x0a9e('0x1d')](_0x5583a4[_0x0a9e('0x1d')]);if(_0x5583a4[_0x0a9e('0x1c')])_0x5026aa['offset'](_0x5583a4[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x36')](_0x5026aa[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x1f29bd){_0x52628e[_0x0a9e('0x3f')](_0x0a9e('0xab'),_[_0x0a9e('0x2f')](_0x1f29bd,'id'));return db[_0x0a9e('0x93')]['query'](_0x52628e[_0x0a9e('0x94')](),_0x2bdc44)[_0x0a9e('0x22')](function(_0x17f692){var _0x30ef6e=_[_0x0a9e('0xac')](_0x17f692,_0x0a9e('0xad'));var _0x6803d6=[];_0x1f29bd[_0x0a9e('0x2c')](function(_0x1808ba){_0x6803d6[_0x0a9e('0xae')](updateSmsInteraction(_0x1808ba,_0x2881b3,_0x30ef6e));});return BPromise[_0x0a9e('0xaf')](_0x6803d6);});});})[_0x0a9e('0x22')](function(_0x18273f){_0x5e7238['rows']=_0x18273f;return _0x5e7238;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x39e565,_0x5583a4))[_0x0a9e('0x2d')](handleError(_0x39e565,null));};exports[_0x0a9e('0xb0')]=function(_0x2ed526,_0xb0599a){var _0x5d9ddb={'raw':![],'where':{'id':_0x2ed526[_0x0a9e('0xb1')]['id']}},_0x3afc8c={};_0x3afc8c['model']=_[_0x0a9e('0xb2')](db['SmsInteraction'][_0x0a9e('0x31')]);_0x3afc8c[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x2ed526[_0x0a9e('0x36')]);_0x3afc8c['filters']=_[_0x0a9e('0x38')](_0x3afc8c['model'],_0x3afc8c[_0x0a9e('0x36')]);_0x5d9ddb[_0x0a9e('0x39')]=_['intersection'](_0x3afc8c[_0x0a9e('0x35')],qs[_0x0a9e('0x3a')](_0x2ed526[_0x0a9e('0x36')]['fields']));_0x5d9ddb['attributes']=_0x5d9ddb[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x5d9ddb[_0x0a9e('0x39')]:_0x3afc8c[_0x0a9e('0x35')];if(_0x2ed526[_0x0a9e('0x36')][_0x0a9e('0xb3')]){_0x5d9ddb[_0x0a9e('0xb4')]=[{'all':!![]}];}_0x5d9ddb=_[_0x0a9e('0x96')]({},_0x5d9ddb,_0x2ed526[_0x0a9e('0xb5')]);return db['SmsInteraction'][_0x0a9e('0x5a')](_0x5d9ddb)['then'](handleEntityNotFound(_0xb0599a,null))[_0x0a9e('0x22')](respondWithResult(_0xb0599a,null))[_0x0a9e('0x2d')](handleError(_0xb0599a,null));};exports[_0x0a9e('0xb6')]=function(_0x28ce92,_0x1b61d5){return db['SmsInteraction'][_0x0a9e('0xb6')](_0x28ce92[_0x0a9e('0xb7')],{})[_0x0a9e('0x22')](respondWithResult(_0x1b61d5,0xc9))[_0x0a9e('0x2d')](handleError(_0x1b61d5,null));};exports[_0x0a9e('0x20')]=function(_0x5c66ef,_0x4f074c){if(_0x5c66ef[_0x0a9e('0xb7')]['id']){delete _0x5c66ef['body']['id'];}return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x5c66ef[_0x0a9e('0xb1')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](saveUpdates(_0x5c66ef[_0x0a9e('0xb7')],null))['then'](respondWithResult(_0x4f074c,null))['catch'](handleError(_0x4f074c,null));};exports[_0x0a9e('0x21')]=function(_0x5dfbe2,_0x2469d1){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x5dfbe2['params']['id']}})['then'](handleEntityNotFound(_0x2469d1,null))[_0x0a9e('0x22')](removeEntity(_0x2469d1,null))[_0x0a9e('0x2d')](handleError(_0x2469d1,null));};exports['describe']=function(_0x170af6,_0x17cb30){return db[_0x0a9e('0x30')][_0x0a9e('0xb8')]()[_0x0a9e('0x22')](respondWithResult(_0x17cb30,null))['catch'](handleError(_0x17cb30,null));};exports['addMessage']=function(_0x16449b,_0x22286c,_0x41c8cd){return db[_0x0a9e('0xb9')][_0x0a9e('0x5a')]({'where':{'id':_0x16449b['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x22286c,null))[_0x0a9e('0x22')](function(_0x5416a9){if(_0x5416a9){return _0x5416a9[_0x0a9e('0xba')](_0x16449b[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_[_0x0a9e('0xbc')](_0x16449b[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x22286c,null))[_0x0a9e('0x2d')](handleError(_0x22286c,null));};exports[_0x0a9e('0xbd')]=function(_0x16afb3,_0x4bdebb,_0x1065a7){var _0x301047={'raw':![],'where':{}};var _0x2ada60={};var _0x1c4232={'count':0x0,'rows':[]};return db[_0x0a9e('0x30')]['findOne']({'where':{'id':_0x16afb3['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4bdebb,null))[_0x0a9e('0x22')](function(_0x466bbf){if(_0x466bbf){_0x2ada60[_0x0a9e('0x35')]=_[_0x0a9e('0xb2')](db['SmsMessage'][_0x0a9e('0x31')]);_0x2ada60[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x16afb3['query']);_0x2ada60[_0x0a9e('0x37')]=_['intersection'](_0x2ada60[_0x0a9e('0x35')],_0x2ada60['query']);_0x301047[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x2ada60[_0x0a9e('0x35')],qs['fields'](_0x16afb3[_0x0a9e('0x36')]['fields']));_0x301047[_0x0a9e('0x39')]=_0x301047[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x301047[_0x0a9e('0x39')]:_0x2ada60[_0x0a9e('0x35')];if(!_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x301047[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1d')]);_0x301047[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1c')]);}_0x301047['order']=qs['sort'](_0x16afb3[_0x0a9e('0x36')]['sort']);_0x301047[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_['pick'](_0x16afb3[_0x0a9e('0x36')],_0x2ada60[_0x0a9e('0x37')]));_0x301047[_0x0a9e('0x3f')][_0x0a9e('0xad')]=_0x466bbf['id'];if(_0x16afb3['query'][_0x0a9e('0x7d')]){_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047[_0x0a9e('0x3f')],{'$or':_['map'](_0x301047[_0x0a9e('0x39')],function(_0x1a0b08){var _0x2b7092={};_0x2b7092[_0x1a0b08]={'$like':'%'+_0x16afb3['query'][_0x0a9e('0x7d')]+'%'};return _0x2b7092;})});}if(_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')]){var _0x54b107=_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')][_0x0a9e('0x2b')](',');var _0x1a7f58={};_0x1a7f58[_0x54b107[0x0]]={'$gte':moment(_0x54b107[0x1])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047['where'],_0x1a7f58);}_0x301047=_[_0x0a9e('0x96')]({},_0x301047,_0x16afb3[_0x0a9e('0xb5')]);return db[_0x0a9e('0xb9')]['count']({'where':_0x301047['where']})['then'](function(_0x1015aa){_0x1c4232[_0x0a9e('0x1b')]=_0x1015aa;if(_0x16afb3['query'][_0x0a9e('0xb3')]){_0x301047[_0x0a9e('0xb4')]=[{'all':!![]}];}return db[_0x0a9e('0xb9')]['findAll'](_0x301047);})[_0x0a9e('0x22')](function(_0x30e037){_0x1c4232[_0x0a9e('0xbf')]=_0x30e037;return _0x1c4232;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4bdebb,_0x301047))[_0x0a9e('0x2d')](handleError(_0x4bdebb,null));};exports[_0x0a9e('0xc0')]=function(_0x40e6e7,_0x328ec5,_0x3b5bda){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x40e6e7['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x328ec5,null))[_0x0a9e('0x22')](function(_0x2097d8){if(_0x2097d8){return _0x2097d8[_0x0a9e('0xc1')](_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_['omit'](_0x40e6e7[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{})[_0x0a9e('0xc2')](function(){return db[_0x0a9e('0xc3')]['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x43')],'where':{'id':_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')]}});})[_0x0a9e('0x22')](function(_0x2be526){socket[_0x0a9e('0xc4')](_0x0a9e('0xc5'),{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]});return{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]};});}})['then'](respondWithResult(_0x328ec5,null))[_0x0a9e('0x2d')](handleError(_0x328ec5,null));};exports[_0x0a9e('0xc6')]=function(_0x2ff265,_0x26b826,_0xea8bd1){return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x2ff265[_0x0a9e('0xb1')]['id']}})['then'](handleEntityNotFound(_0x26b826,null))[_0x0a9e('0x22')](function(_0xd2391){if(_0xd2391){return _0xd2391[_0x0a9e('0xc6')](_0x2ff265['query'][_0x0a9e('0xbb')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x26b826,null))[_0x0a9e('0x2d')](handleError(_0x26b826,null));};exports[_0x0a9e('0xc7')]=function(_0x370b5e,_0x1ba457){var _0x424f1b=moment()[_0x0a9e('0xc8')]()[_0x0a9e('0x94')]();var _0x451010=path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xcb'),_0x0a9e('0xcc'));var _0x2b624e=path[_0x0a9e('0xcd')](config['root'],_0x0a9e('0xca'),'files','attachments');var _0x573df6=path[_0x0a9e('0xcd')](_0x451010,_0x424f1b);var _0x3fa3f2=util[_0x0a9e('0xbe')](_0x0a9e('0xce'),_0x370b5e['params']['id'],_0x424f1b);var _0x4156a5=path[_0x0a9e('0xcd')](_0x451010,_0x3fa3f2);var _0x3ddbc7=[];_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0x69')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xcf')],'as':_0x0a9e('0x5e'),'attributes':['id','firstName',_0x0a9e('0xd0')],'raw':!![]});var _0x248a9a=[{'model':db[_0x0a9e('0xb9')],'as':'Messages','attributes':['id',_0x0a9e('0xb7'),_0x0a9e('0x71'),_0x0a9e('0xd1'),'secret',_0x0a9e('0x79')],'include':_0x3ddbc7}];_0x248a9a[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xd2')],'as':'Account','attributes':['id','name']});_0x248a9a['push']({'model':db[_0x0a9e('0x69')],'as':_0x0a9e('0xd3'),'attributes':['id',_0x0a9e('0x28')]});return db[_0x0a9e('0x30')]['find']({'where':{'id':_0x370b5e[_0x0a9e('0xb1')]['id']},'include':_0x248a9a})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x2ff2ab){if(_0x2ff2ab){var _0x242f23=_0x2ff2ab['get']({'plain':!![]});fs[_0x0a9e('0xd4')](_0x573df6);var _0x33a26c={'format':'A4','border':_0x0a9e('0xd5'),'header':{'height':'40px','contents':{'first':_0x0a9e('0xd6')}},'footer':{'height':'30px','contents':{'default':util[_0x0a9e('0xbe')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0x0a9e('0xbe')]('%s\x20#%d',_0x0a9e('0xd7'),_0x242f23['id']),moment()[_0x0a9e('0xbe')](_0x0a9e('0xd8'))[_0x0a9e('0x94')]())}}};var _0x1e306c={'channel':_0x0a9e('0xd7'),'account':_0x242f23[_0x0a9e('0xd9')]['name'],'agent':_0x242f23[_0x0a9e('0xd3')]?_0x242f23[_0x0a9e('0xd3')]['fullname']:_0x0a9e('0xda'),'createdAt':moment(_0x242f23[_0x0a9e('0x71')])['format'](_0x0a9e('0xdb'))[_0x0a9e('0x94')](),'closedAt':_0x242f23[_0x0a9e('0xdc')]?moment(_0x242f23['closedAt'])[_0x0a9e('0xbe')](_0x0a9e('0xdb'))[_0x0a9e('0x94')]():'','disposition':_0x242f23[_0x0a9e('0xdd')],'messages':_(_0x242f23[_0x0a9e('0xde')])[_0x0a9e('0x7d')]({'secret':![]})[_0x0a9e('0x2f')](function(_0x74d9b8){return{'date':moment(_0x74d9b8[_0x0a9e('0x71')])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0a9e('0x94')](),'sender':_0x74d9b8['direction']===_0x0a9e('0xdf')?_0x74d9b8[_0x0a9e('0x69')]?_0x74d9b8[_0x0a9e('0x69')][_0x0a9e('0x28')]:_0x0a9e('0xe0'):_0x74d9b8[_0x0a9e('0x5e')]['firstName']+(_0x74d9b8[_0x0a9e('0x5e')][_0x0a9e('0xd0')]?'\x20'+_0x74d9b8[_0x0a9e('0x5e')]['lastName']:''),'body':_0x74d9b8[_0x0a9e('0xb7')],'direction':_0x74d9b8[_0x0a9e('0xd1')]===_0x0a9e('0xdf')?'A':'C','secret':_0x74d9b8[_0x0a9e('0xe1')],'read':_0x74d9b8[_0x0a9e('0x79')]};})[_0x0a9e('0x61')]()};return ejs[_0x0a9e('0xe2')](path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xe3'),_0x0a9e('0xe4')),{'interaction':_0x1e306c})[_0x0a9e('0x22')](function(_0x241404){return new BPromise(function(_0x8120e,_0x5d6a48){pdf['create'](_0x241404,_0x33a26c)[_0x0a9e('0xe5')](path[_0x0a9e('0xcd')](_0x573df6,_0x0a9e('0xe6')+_0x242f23['id']+'-'+_0x424f1b+_0x0a9e('0xe7')),function(_0x40e2da,_0x131da8){if(_0x40e2da)return _0x5d6a48(_0x40e2da);_0x8120e(_0x131da8);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x584854,_0x39ea62){zipdir(_0x573df6,{'saveTo':_0x4156a5},function(_0x1d7fc4,_0x2d8e91){if(_0x1d7fc4)return _0x39ea62(_0x1d7fc4);return _0x584854(_0x2d8e91);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1b1757,_0x3c6082){rimraf(_0x573df6,function(_0x16be7e){if(_0x16be7e)_0x3c6082(_0x16be7e);return _0x1b1757();});});})['then'](function(){return _0x1ba457[_0x0a9e('0xc7')](_0x4156a5,_0x3fa3f2,function(_0x294310){if(_0x294310){console[_0x0a9e('0xe8')]('err',_0x294310);}else{fs[_0x0a9e('0xe9')](_0x4156a5);}});});});}else{return _0x1ba457[_0x0a9e('0x23')](0xc8);}})[_0x0a9e('0x2d')](handleError(_0x1ba457,null));}; \ No newline at end of file +var _0xa9e0=['params','keys','includeAll','include','options','create','body','describe','SmsMessage','addMessage','ids','omit','getMessages','format','rows','addTags','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','transcript-%d-%s.zip','CmContact','lastName','direction','SmsAccount','Owner','mkdirSync','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Sms','YYYY-MM-DD','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','Messages','out','System','secret','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','catch','index','map','SmsInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','ContactId','buildExpression','text','start','end','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','length','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','show'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function updateSmsInteraction(_0x2407f9,_0x3ae878,_0x1122db){return new BPromise(function(_0x33bdb7,_0x25ce3a){return getInteractionUsers(_0x2407f9,_0x1122db)['then'](function(_0x66c1d2){return getInteractionTags(_0x66c1d2,_0x3ae878);})[_0x0a9e('0x22')](function(_0x40cb85){_0x33bdb7(_0x40cb85);})[_0x0a9e('0x2d')](function(_0x2b45ea){_0x25ce3a(_0x2b45ea);});});}exports[_0x0a9e('0x2e')]=function(_0x332d35,_0x39e565){var _0x5583a4={},_0x44295a={},_0x5e7238={'count':0x0,'rows':[]};var _0x2cc7a0=_[_0x0a9e('0x2f')](db[_0x0a9e('0x30')][_0x0a9e('0x31')],function(_0x567193){return{'name':_0x567193[_0x0a9e('0x32')],'type':_0x567193[_0x0a9e('0x33')][_0x0a9e('0x34')]};});_0x44295a[_0x0a9e('0x35')]=_['map'](_0x2cc7a0,'name');_0x44295a[_0x0a9e('0x36')]=_['keys'](_0x332d35[_0x0a9e('0x36')]);_0x44295a[_0x0a9e('0x37')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],_0x44295a['query']);_0x5583a4[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],qs['fields'](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]));_0x5583a4[_0x0a9e('0x39')]=_0x5583a4['attributes']['length']?_0x5583a4[_0x0a9e('0x39')]:_0x44295a[_0x0a9e('0x35')];if(!_0x332d35['query'][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x5583a4[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x332d35['query']['limit']);_0x5583a4[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x332d35['query'][_0x0a9e('0x1c')]);}_0x5583a4[_0x0a9e('0x3d')]=qs[_0x0a9e('0x3e')](_0x332d35['query'][_0x0a9e('0x3e')]);_0x5583a4[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_[_0x0a9e('0x40')](_0x332d35[_0x0a9e('0x36')],_0x44295a[_0x0a9e('0x37')]),_0x2cc7a0);var _0x2881b3=[];var _0x45a9b8=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x25'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')]('tools_tags');var _0x52628e=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')](_0x0a9e('0x45'))[_0x0a9e('0x42')](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x44')](_0x0a9e('0x48'),'ui')[_0x0a9e('0x49')](_0x0a9e('0x4a'),'u',_0x0a9e('0x4b'));var _0x5026aa=squel[_0x0a9e('0x41')]()[_0x0a9e('0x44')](_0x0a9e('0x4c'),'i')[_0x0a9e('0x49')](_0x0a9e('0x4d'),'c',_0x0a9e('0x4e'))[_0x0a9e('0x49')](_0x0a9e('0x4a'),'o','o.id\x20=\x20i.UserId')[_0x0a9e('0x49')]('sms_accounts','a',_0x0a9e('0x4f'))[_0x0a9e('0x49')](_0x0a9e('0x50'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x0a9e('0x49')](_0x0a9e('0x51'),'it',_0x0a9e('0x52'))[_0x0a9e('0x49')](_0x0a9e('0x53'),'t',_0x0a9e('0x54'));var _0x45bf7f=squel['expr']();var _0x13f44d=[];var _0x1bde3c=squel[_0x0a9e('0x55')]();var _0x16f976;if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]){_0x16f976=as[_0x0a9e('0x57')](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]);var _0x58a5c2=_0x16f976[_0x0a9e('0x58')];for(var _0x3fe430=0x0;_0x3fe430<_0x16f976['conditions']['length'];_0x3fe430++){var _0x5ddf84=_0x16f976[_0x0a9e('0x59')][_0x3fe430];var _0x4317e3='i';var _0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x5ddf84[_0x0a9e('0x42')]]);if(!_0x37edaa){switch(_0x5ddf84[_0x0a9e('0x42')]){case _0x0a9e('0x5b'):if(_0x5ddf84['value']==0x1){_0x5026aa['having']('`'+_0x5ddf84['field']+_0x0a9e('0x5c'));}else{_0x5026aa[_0x0a9e('0x5d')]('`'+_0x5ddf84[_0x0a9e('0x42')]+'`\x20>\x200');}break;case _0x0a9e('0x5e'):if(_0x5ddf84[_0x0a9e('0x5f')]==='$substring'){if(_0x5ddf84['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x45bf7f[_0x58a5c2](_0x0a9e('0x60'),qs['getFullTextValue'](_0x5ddf84[_0x0a9e('0x61')]),null);}else{var _0x3c20b2='%'+_0x5ddf84[_0x0a9e('0x61')]+'%';_0x45bf7f[_0x58a5c2]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3c20b2,_0x3c20b2,_0x3c20b2);}}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),'ContactId']);_0x5ddf84['field']=_0x0a9e('0x62');_0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa['type'],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'Tag':var _0x5da27d=_0x5ddf84['value'][_0x0a9e('0x2b')](',')['map'](function(_0x2f7092){return Number(_0x2f7092);});_0x5da27d[_0x0a9e('0x2c')](function(_0x3cfd00){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x3cfd00+',%');});_0x13f44d=_[_0x0a9e('0x68')](_0x13f44d,_0x5da27d);break;case _0x0a9e('0x69'):if(_0x5ddf84[_0x0a9e('0x5f')]===_0x0a9e('0x6a')){_0x45bf7f[_0x58a5c2]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5ddf84[_0x0a9e('0x61')]+'%',null);}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x0a9e('0x6b')]);_0x5ddf84[_0x0a9e('0x42')]=_0x0a9e('0x6b');_0x261adb=as['buildExpression'](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'body':_0x261adb=as['buildExpression']('me',null,_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb['text'],_0x261adb[_0x0a9e('0x61')]['start'],_0x261adb[_0x0a9e('0x61')][_0x0a9e('0x66')]);break;}}else{var _0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}}}else{var _0x1f07cb=_(_0x332d35[_0x0a9e('0x36')])['keys']()[_0x0a9e('0x2f')](function(_0x156f1c){return _[_0x0a9e('0x6c')](_0x2cc7a0,[_0x0a9e('0x25'),_0x156f1c])?_0x156f1c:undefined;})['compact']()[_0x0a9e('0x61')]();if(!_[_0x0a9e('0x6d')](_0x1f07cb)){_0x1f07cb['forEach'](function(_0x797b45){if(_0x797b45===_0x0a9e('0x6e')){_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x6f'),[][_0x0a9e('0x70')](_0x332d35['query'][_0x797b45]));}else if(_0x797b45===_0x0a9e('0x71')){var _0x2937e0=JSON[_0x0a9e('0x72')](_0x332d35['query'][_0x797b45])[_0x0a9e('0x73')];var _0x4f1e60=JSON['parse'](_0x332d35[_0x0a9e('0x36')][_0x797b45])[_0x0a9e('0x74')];_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x75'),_0x2937e0,_0x4f1e60);}else{if(_0x332d35[_0x0a9e('0x36')][_0x797b45]===_0x0a9e('0x76')){_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x77'));}else{_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x78'),_0x332d35[_0x0a9e('0x36')][_0x797b45]);}}});}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]==0x1){_0x5026aa[_0x0a9e('0x5d')](_0x0a9e('0x7a'));}else{_0x5026aa[_0x0a9e('0x5d')]('`unreadMessages`\x20>\x200');}}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]){_0x13f44d=_[_0x0a9e('0x7c')](_0x332d35['query'][_0x0a9e('0x7b')])?_0x332d35[_0x0a9e('0x36')]['tag']:new Array(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]);_0x13f44d[_0x0a9e('0x2c')](function(_0x427946){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x427946+',%');});}if(_0x332d35['query']['filter']){var _0x4a2438=_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7d')][_0x0a9e('0x7e')]('\x5c','\x5c\x5c')[_0x0a9e('0x7e')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x7f')](_0x4a2438)){_0x45bf7f['or'](_0x0a9e('0x80'),_0x4a2438+'%')['or'](_0x0a9e('0x81'),_0x4a2438+'%');}else{_0x45bf7f['or'](_0x0a9e('0x82'),qs['getFullTextValue'](_0x4a2438))['or'](_0x0a9e('0x83'),_0x4a2438+'%');}}}_0x5026aa[_0x0a9e('0x3f')](_0x45bf7f);_0x5026aa[_0x0a9e('0x84')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x85')][_0x0a9e('0x86')],'raw':!![]};var _0x4c46c1=_0x5026aa[_0x0a9e('0x87')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x88'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5b'));if(_0x5583a4[_0x0a9e('0x3d')]){_0x5583a4[_0x0a9e('0x3d')][_0x0a9e('0x2c')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x89')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x5026aa[_0x0a9e('0x3d')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x8a')?![]:!![]);});}if(!_['isEmpty'](_0x13f44d)){_0x5026aa[_0x0a9e('0x5d')](_0x1bde3c);_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8b'),_0x13f44d);}BPromise[_0x0a9e('0x8c')]()[_0x0a9e('0x22')](function(){if(!_0x16f976){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return;_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8d'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x8d'));return;}if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]!==_0x0a9e('0x90'))return;return _0x332d35['user'][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x92'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x92'));}else{_0x4c46c1['where']('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));_0x5026aa[_0x0a9e('0x3f')]('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));}});})['then'](function(){if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]==='agent'&&!_0x16f976&&!_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x4c46c1[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x444f1f){_0x5e7238['count']=_0x444f1f[_0x0a9e('0x95')];if(_0x5e7238[_0x0a9e('0x1b')]===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x45a9b8['toString'](),_0x2bdc44)[_0x0a9e('0x22')](function(_0xf0db1){_0x2881b3=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x96')](_0x2bdc44,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]){_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x2c')](function(_0x5af453){_0x5026aa['field']('i.'+_0x5af453);});}else{_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x97'),_0x0a9e('0x5b'));_0x5026aa['field'](_0x0a9e('0x98'),_0x0a9e('0x99'));_0x5026aa['field']('a.mandatoryDisposition',_0x0a9e('0x9a'));_0x5026aa['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9b'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9c'),_0x0a9e('0x9d'));_0x5026aa[_0x0a9e('0x42')]('c.lastName',_0x0a9e('0x9e'));_0x5026aa['field'](_0x0a9e('0x9f'),_0x0a9e('0xa0'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa1'),'Contact.phone');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x5026aa['field'](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x5026aa['field'](_0x0a9e('0xaa'),_0x0a9e('0x29'));}if(_0x5583a4['limit'])_0x5026aa[_0x0a9e('0x1d')](_0x5583a4[_0x0a9e('0x1d')]);if(_0x5583a4[_0x0a9e('0x1c')])_0x5026aa['offset'](_0x5583a4[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x36')](_0x5026aa[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x1f29bd){_0x52628e[_0x0a9e('0x3f')](_0x0a9e('0xab'),_[_0x0a9e('0x2f')](_0x1f29bd,'id'));return db[_0x0a9e('0x93')]['query'](_0x52628e[_0x0a9e('0x94')](),_0x2bdc44)[_0x0a9e('0x22')](function(_0x17f692){var _0x30ef6e=_[_0x0a9e('0xac')](_0x17f692,_0x0a9e('0xad'));var _0x6803d6=[];_0x1f29bd[_0x0a9e('0x2c')](function(_0x1808ba){_0x6803d6[_0x0a9e('0xae')](updateSmsInteraction(_0x1808ba,_0x2881b3,_0x30ef6e));});return BPromise[_0x0a9e('0xaf')](_0x6803d6);});});})[_0x0a9e('0x22')](function(_0x18273f){_0x5e7238['rows']=_0x18273f;return _0x5e7238;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x39e565,_0x5583a4))[_0x0a9e('0x2d')](handleError(_0x39e565,null));};exports[_0x0a9e('0xb0')]=function(_0x2ed526,_0xb0599a){var _0x5d9ddb={'raw':![],'where':{'id':_0x2ed526[_0x0a9e('0xb1')]['id']}},_0x3afc8c={};_0x3afc8c['model']=_[_0x0a9e('0xb2')](db['SmsInteraction'][_0x0a9e('0x31')]);_0x3afc8c[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x2ed526[_0x0a9e('0x36')]);_0x3afc8c['filters']=_[_0x0a9e('0x38')](_0x3afc8c['model'],_0x3afc8c[_0x0a9e('0x36')]);_0x5d9ddb[_0x0a9e('0x39')]=_['intersection'](_0x3afc8c[_0x0a9e('0x35')],qs[_0x0a9e('0x3a')](_0x2ed526[_0x0a9e('0x36')]['fields']));_0x5d9ddb['attributes']=_0x5d9ddb[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x5d9ddb[_0x0a9e('0x39')]:_0x3afc8c[_0x0a9e('0x35')];if(_0x2ed526[_0x0a9e('0x36')][_0x0a9e('0xb3')]){_0x5d9ddb[_0x0a9e('0xb4')]=[{'all':!![]}];}_0x5d9ddb=_[_0x0a9e('0x96')]({},_0x5d9ddb,_0x2ed526[_0x0a9e('0xb5')]);return db['SmsInteraction'][_0x0a9e('0x5a')](_0x5d9ddb)['then'](handleEntityNotFound(_0xb0599a,null))[_0x0a9e('0x22')](respondWithResult(_0xb0599a,null))[_0x0a9e('0x2d')](handleError(_0xb0599a,null));};exports[_0x0a9e('0xb6')]=function(_0x28ce92,_0x1b61d5){return db['SmsInteraction'][_0x0a9e('0xb6')](_0x28ce92[_0x0a9e('0xb7')],{})[_0x0a9e('0x22')](respondWithResult(_0x1b61d5,0xc9))[_0x0a9e('0x2d')](handleError(_0x1b61d5,null));};exports[_0x0a9e('0x20')]=function(_0x5c66ef,_0x4f074c){if(_0x5c66ef[_0x0a9e('0xb7')]['id']){delete _0x5c66ef['body']['id'];}return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x5c66ef[_0x0a9e('0xb1')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](saveUpdates(_0x5c66ef[_0x0a9e('0xb7')],null))['then'](respondWithResult(_0x4f074c,null))['catch'](handleError(_0x4f074c,null));};exports[_0x0a9e('0x21')]=function(_0x5dfbe2,_0x2469d1){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x5dfbe2['params']['id']}})['then'](handleEntityNotFound(_0x2469d1,null))[_0x0a9e('0x22')](removeEntity(_0x2469d1,null))[_0x0a9e('0x2d')](handleError(_0x2469d1,null));};exports['describe']=function(_0x170af6,_0x17cb30){return db[_0x0a9e('0x30')][_0x0a9e('0xb8')]()[_0x0a9e('0x22')](respondWithResult(_0x17cb30,null))['catch'](handleError(_0x17cb30,null));};exports['addMessage']=function(_0x16449b,_0x22286c,_0x41c8cd){return db[_0x0a9e('0xb9')][_0x0a9e('0x5a')]({'where':{'id':_0x16449b['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x22286c,null))[_0x0a9e('0x22')](function(_0x5416a9){if(_0x5416a9){return _0x5416a9[_0x0a9e('0xba')](_0x16449b[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_[_0x0a9e('0xbc')](_0x16449b[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x22286c,null))[_0x0a9e('0x2d')](handleError(_0x22286c,null));};exports[_0x0a9e('0xbd')]=function(_0x16afb3,_0x4bdebb,_0x1065a7){var _0x301047={'raw':![],'where':{}};var _0x2ada60={};var _0x1c4232={'count':0x0,'rows':[]};return db[_0x0a9e('0x30')]['findOne']({'where':{'id':_0x16afb3['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4bdebb,null))[_0x0a9e('0x22')](function(_0x466bbf){if(_0x466bbf){_0x2ada60[_0x0a9e('0x35')]=_[_0x0a9e('0xb2')](db['SmsMessage'][_0x0a9e('0x31')]);_0x2ada60[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x16afb3['query']);_0x2ada60[_0x0a9e('0x37')]=_['intersection'](_0x2ada60[_0x0a9e('0x35')],_0x2ada60['query']);_0x301047[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x2ada60[_0x0a9e('0x35')],qs['fields'](_0x16afb3[_0x0a9e('0x36')]['fields']));_0x301047[_0x0a9e('0x39')]=_0x301047[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x301047[_0x0a9e('0x39')]:_0x2ada60[_0x0a9e('0x35')];if(!_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x301047[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1d')]);_0x301047[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1c')]);}_0x301047['order']=qs['sort'](_0x16afb3[_0x0a9e('0x36')]['sort']);_0x301047[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_['pick'](_0x16afb3[_0x0a9e('0x36')],_0x2ada60[_0x0a9e('0x37')]));_0x301047[_0x0a9e('0x3f')][_0x0a9e('0xad')]=_0x466bbf['id'];if(_0x16afb3['query'][_0x0a9e('0x7d')]){_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047[_0x0a9e('0x3f')],{'$or':_['map'](_0x301047[_0x0a9e('0x39')],function(_0x1a0b08){var _0x2b7092={};_0x2b7092[_0x1a0b08]={'$like':'%'+_0x16afb3['query'][_0x0a9e('0x7d')]+'%'};return _0x2b7092;})});}if(_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')]){var _0x54b107=_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')][_0x0a9e('0x2b')](',');var _0x1a7f58={};_0x1a7f58[_0x54b107[0x0]]={'$gte':moment(_0x54b107[0x1])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047['where'],_0x1a7f58);}_0x301047=_[_0x0a9e('0x96')]({},_0x301047,_0x16afb3[_0x0a9e('0xb5')]);return db[_0x0a9e('0xb9')]['count']({'where':_0x301047['where']})['then'](function(_0x1015aa){_0x1c4232[_0x0a9e('0x1b')]=_0x1015aa;if(_0x16afb3['query'][_0x0a9e('0xb3')]){_0x301047[_0x0a9e('0xb4')]=[{'all':!![]}];}return db[_0x0a9e('0xb9')]['findAll'](_0x301047);})[_0x0a9e('0x22')](function(_0x30e037){_0x1c4232[_0x0a9e('0xbf')]=_0x30e037;return _0x1c4232;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4bdebb,_0x301047))[_0x0a9e('0x2d')](handleError(_0x4bdebb,null));};exports[_0x0a9e('0xc0')]=function(_0x40e6e7,_0x328ec5,_0x3b5bda){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x40e6e7['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x328ec5,null))[_0x0a9e('0x22')](function(_0x2097d8){if(_0x2097d8){return _0x2097d8[_0x0a9e('0xc1')](_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_['omit'](_0x40e6e7[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{})[_0x0a9e('0xc2')](function(){return db[_0x0a9e('0xc3')]['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x43')],'where':{'id':_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')]}});})[_0x0a9e('0x22')](function(_0x2be526){socket[_0x0a9e('0xc4')](_0x0a9e('0xc5'),{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]});return{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]};});}})['then'](respondWithResult(_0x328ec5,null))[_0x0a9e('0x2d')](handleError(_0x328ec5,null));};exports[_0x0a9e('0xc6')]=function(_0x2ff265,_0x26b826,_0xea8bd1){return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x2ff265[_0x0a9e('0xb1')]['id']}})['then'](handleEntityNotFound(_0x26b826,null))[_0x0a9e('0x22')](function(_0xd2391){if(_0xd2391){return _0xd2391[_0x0a9e('0xc6')](_0x2ff265['query'][_0x0a9e('0xbb')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x26b826,null))[_0x0a9e('0x2d')](handleError(_0x26b826,null));};exports[_0x0a9e('0xc7')]=function(_0x370b5e,_0x1ba457){var _0x424f1b=moment()[_0x0a9e('0xc8')]()[_0x0a9e('0x94')]();var _0x451010=path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xcb'),_0x0a9e('0xcc'));var _0x2b624e=path[_0x0a9e('0xcd')](config['root'],_0x0a9e('0xca'),'files','attachments');var _0x573df6=path[_0x0a9e('0xcd')](_0x451010,_0x424f1b);var _0x3fa3f2=util[_0x0a9e('0xbe')](_0x0a9e('0xce'),_0x370b5e['params']['id'],_0x424f1b);var _0x4156a5=path[_0x0a9e('0xcd')](_0x451010,_0x3fa3f2);var _0x3ddbc7=[];_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0x69')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xcf')],'as':_0x0a9e('0x5e'),'attributes':['id','firstName',_0x0a9e('0xd0')],'raw':!![]});var _0x248a9a=[{'model':db[_0x0a9e('0xb9')],'as':'Messages','attributes':['id',_0x0a9e('0xb7'),_0x0a9e('0x71'),_0x0a9e('0xd1'),'secret',_0x0a9e('0x79')],'include':_0x3ddbc7}];_0x248a9a[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xd2')],'as':'Account','attributes':['id','name']});_0x248a9a['push']({'model':db[_0x0a9e('0x69')],'as':_0x0a9e('0xd3'),'attributes':['id',_0x0a9e('0x28')]});return db[_0x0a9e('0x30')]['find']({'where':{'id':_0x370b5e[_0x0a9e('0xb1')]['id']},'include':_0x248a9a})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x2ff2ab){if(_0x2ff2ab){var _0x242f23=_0x2ff2ab['get']({'plain':!![]});fs[_0x0a9e('0xd4')](_0x573df6);var _0x33a26c={'format':'A4','border':_0x0a9e('0xd5'),'header':{'height':'40px','contents':{'first':_0x0a9e('0xd6')}},'footer':{'height':'30px','contents':{'default':util[_0x0a9e('0xbe')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0x0a9e('0xbe')]('%s\x20#%d',_0x0a9e('0xd7'),_0x242f23['id']),moment()[_0x0a9e('0xbe')](_0x0a9e('0xd8'))[_0x0a9e('0x94')]())}}};var _0x1e306c={'channel':_0x0a9e('0xd7'),'account':_0x242f23[_0x0a9e('0xd9')]['name'],'agent':_0x242f23[_0x0a9e('0xd3')]?_0x242f23[_0x0a9e('0xd3')]['fullname']:_0x0a9e('0xda'),'createdAt':moment(_0x242f23[_0x0a9e('0x71')])['format'](_0x0a9e('0xdb'))[_0x0a9e('0x94')](),'closedAt':_0x242f23[_0x0a9e('0xdc')]?moment(_0x242f23['closedAt'])[_0x0a9e('0xbe')](_0x0a9e('0xdb'))[_0x0a9e('0x94')]():'','disposition':_0x242f23[_0x0a9e('0xdd')],'messages':_(_0x242f23[_0x0a9e('0xde')])[_0x0a9e('0x7d')]({'secret':![]})[_0x0a9e('0x2f')](function(_0x74d9b8){return{'date':moment(_0x74d9b8[_0x0a9e('0x71')])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0a9e('0x94')](),'sender':_0x74d9b8['direction']===_0x0a9e('0xdf')?_0x74d9b8[_0x0a9e('0x69')]?_0x74d9b8[_0x0a9e('0x69')][_0x0a9e('0x28')]:_0x0a9e('0xe0'):_0x74d9b8[_0x0a9e('0x5e')]['firstName']+(_0x74d9b8[_0x0a9e('0x5e')][_0x0a9e('0xd0')]?'\x20'+_0x74d9b8[_0x0a9e('0x5e')]['lastName']:''),'body':_0x74d9b8[_0x0a9e('0xb7')],'direction':_0x74d9b8[_0x0a9e('0xd1')]===_0x0a9e('0xdf')?'A':'C','secret':_0x74d9b8[_0x0a9e('0xe1')],'read':_0x74d9b8[_0x0a9e('0x79')]};})[_0x0a9e('0x61')]()};return ejs[_0x0a9e('0xe2')](path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xe3'),_0x0a9e('0xe4')),{'interaction':_0x1e306c})[_0x0a9e('0x22')](function(_0x241404){return new BPromise(function(_0x8120e,_0x5d6a48){pdf['create'](_0x241404,_0x33a26c)[_0x0a9e('0xe5')](path[_0x0a9e('0xcd')](_0x573df6,_0x0a9e('0xe6')+_0x242f23['id']+'-'+_0x424f1b+_0x0a9e('0xe7')),function(_0x40e2da,_0x131da8){if(_0x40e2da)return _0x5d6a48(_0x40e2da);_0x8120e(_0x131da8);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x584854,_0x39ea62){zipdir(_0x573df6,{'saveTo':_0x4156a5},function(_0x1d7fc4,_0x2d8e91){if(_0x1d7fc4)return _0x39ea62(_0x1d7fc4);return _0x584854(_0x2d8e91);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1b1757,_0x3c6082){rimraf(_0x573df6,function(_0x16be7e){if(_0x16be7e)_0x3c6082(_0x16be7e);return _0x1b1757();});});})['then'](function(){return _0x1ba457[_0x0a9e('0xc7')](_0x4156a5,_0x3fa3f2,function(_0x294310){if(_0x294310){console[_0x0a9e('0xe8')]('err',_0x294310);}else{fs[_0x0a9e('0xe9')](_0x4156a5);}});});});}else{return _0x1ba457[_0x0a9e('0x23')](0xc8);}})[_0x0a9e('0x2d')](handleError(_0x1ba457,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 89bc1a9..b0c1055 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 _0xdc97=['update','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','events','../../mysqldb','SmsInteraction','SmsMessage','save'];(function(_0x4c5c83,_0x12be6e){var _0x54c0ff=function(_0x5c7e1d){while(--_0x5c7e1d){_0x4c5c83['push'](_0x4c5c83['shift']());}};_0x54c0ff(++_0x12be6e);}(_0xdc97,0x13b));var _0x7dc9=function(_0xbe42d9,_0x414114){_0xbe42d9=_0xbe42d9-0x0;var _0x3b69a7=_0xdc97[_0xbe42d9];return _0x3b69a7;};'use strict';var EventEmitter=require(_0x7dc9('0x0'));var SmsInteraction=require(_0x7dc9('0x1'))['db'][_0x7dc9('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0x7dc9('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7dc9('0x4'),'afterUpdate':_0x7dc9('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2a77c1){return function(_0x1e513b,_0xb15a0b,_0x3ba3ca){_0x1e513b['getUsers']({'attributes':['id'],'raw':!![]})[_0x7dc9('0x6')](function(_0x4f91c7){_0x1e513b['setDataValue'](_0x7dc9('0x7'),_0x4f91c7[_0x7dc9('0x8')](function(_0x3318ea){return{'id':_0x3318ea['id']};}));return SmsMessage[_0x7dc9('0x9')]({'where':{'SmsInteractionId':_0x1e513b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7dc9('0x6')](function(_0x5ca05b){_0x1e513b[_0x7dc9('0xa')](_0x7dc9('0xb'),_0x5ca05b[_0x7dc9('0xc')]);SmsInteractionEvents[_0x7dc9('0xd')](_0x2a77c1+':'+_0x1e513b['id'],_0x1e513b);SmsInteractionEvents[_0x7dc9('0xd')](_0x2a77c1,_0x1e513b);_0x3ba3ca(null);})[_0x7dc9('0xe')](_0x3ba3ca(null));};}for(var e in events){if(events[_0x7dc9('0xf')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x98a8=['setMaxListeners','save','remove','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hook','events','../../mysqldb','SmsInteraction','SmsMessage'];(function(_0x524e93,_0x489892){var _0x36f9d2=function(_0x4d383d){while(--_0x4d383d){_0x524e93['push'](_0x524e93['shift']());}};_0x36f9d2(++_0x489892);}(_0x98a8,0x12c));var _0x898a=function(_0x48767c,_0x536c04){_0x48767c=_0x48767c-0x0;var _0x1d4326=_0x98a8[_0x48767c];return _0x1d4326;};'use strict';var EventEmitter=require(_0x898a('0x0'));var SmsInteraction=require(_0x898a('0x1'))['db'][_0x898a('0x2')];var SmsMessage=require(_0x898a('0x1'))['db'][_0x898a('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x898a('0x4')](0x0);var events={'afterCreate':_0x898a('0x5'),'afterUpdate':'update','afterDestroy':_0x898a('0x6')};function emitEvent(_0xf84a19){return function(_0x1b3dd0,_0x101b7b,_0x3e7ddd){_0x1b3dd0['getUsers']({'attributes':['id'],'raw':!![]})[_0x898a('0x7')](function(_0x564583){_0x1b3dd0[_0x898a('0x8')]('Users',_0x564583[_0x898a('0x9')](function(_0x283c5){return{'id':_0x283c5['id']};}));return SmsMessage[_0x898a('0xa')]({'where':{'SmsInteractionId':_0x1b3dd0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x898a('0x7')](function(_0x3150df){_0x1b3dd0[_0x898a('0x8')](_0x898a('0xb'),_0x3150df[_0x898a('0xc')]);SmsInteractionEvents[_0x898a('0xd')](_0xf84a19+':'+_0x1b3dd0['id'],_0x1b3dd0);SmsInteractionEvents['emit'](_0xf84a19,_0x1b3dd0);_0x3e7ddd(null);})[_0x898a('0xe')](_0x3e7ddd(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x898a('0xf')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 63638e4..c3cfaec 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 _0xcc9b=['define','sms_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports'];(function(_0x102235,_0x5afcbd){var _0x301f0b=function(_0x23ffee){while(--_0x23ffee){_0x102235['push'](_0x102235['shift']());}};_0x301f0b(++_0x5afcbd);}(_0xcc9b,0x1f3));var _0xbcc9=function(_0x15686d,_0x3f5829){_0x15686d=_0x15686d-0x0;var _0x850585=_0xcc9b[_0x15686d];return _0x850585;};'use strict';var _=require(_0xbcc9('0x0'));var util=require(_0xbcc9('0x1'));var logger=require(_0xbcc9('0x2'))(_0xbcc9('0x3'));var moment=require('moment');var BPromise=require(_0xbcc9('0x4'));var rp=require(_0xbcc9('0x5'));var fs=require('fs');var path=require(_0xbcc9('0x6'));var rimraf=require(_0xbcc9('0x7'));var config=require(_0xbcc9('0x8'));var attributes=require(_0xbcc9('0x9'));module[_0xbcc9('0xa')]=function(_0x49c3dd,_0x4272f3){return _0x49c3dd[_0xbcc9('0xb')]('SmsInteraction',attributes,{'tableName':_0xbcc9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x50ca3f,_0x31cf08,_0x23459a){if(_0x50ca3f[_0xbcc9('0xd')]('closed')){_0x50ca3f[_0xbcc9('0xe')]=moment()[_0xbcc9('0xf')](_0xbcc9('0x10'));}_0x23459a(null,_0x50ca3f);}}});}; \ No newline at end of file +var _0x7085=['sms_interactions','changed','closed','closedAt','format','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction'];(function(_0x29f03a,_0x18e529){var _0x3b60bf=function(_0x507be1){while(--_0x507be1){_0x29f03a['push'](_0x29f03a['shift']());}};_0x3b60bf(++_0x18e529);}(_0x7085,0x125));var _0x5708=function(_0x135448,_0x4ca19f){_0x135448=_0x135448-0x0;var _0x28389e=_0x7085[_0x135448];return _0x28389e;};'use strict';var _=require(_0x5708('0x0'));var util=require(_0x5708('0x1'));var logger=require(_0x5708('0x2'))(_0x5708('0x3'));var moment=require('moment');var BPromise=require(_0x5708('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5708('0x5'));var rimraf=require('rimraf');var config=require(_0x5708('0x6'));var attributes=require(_0x5708('0x7'));module[_0x5708('0x8')]=function(_0x5c5c6b,_0x16c771){return _0x5c5c6b[_0x5708('0x9')](_0x5708('0xa'),attributes,{'tableName':_0x5708('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xe13599,_0xd9c4ec,_0x34fc36){if(_0xe13599[_0x5708('0xc')](_0x5708('0xd'))){_0xe13599[_0x5708('0xe')]=moment()[_0x5708('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x34fc36(null,_0xe13599);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 7c7720b..dd6df27 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 _0x1cce=['limit','find','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','where','attributes'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x1cce,0x80));var _0xe1cc=function(_0x5b7788,_0x309ae5){_0x5b7788=_0x5b7788-0x0;var _0x573871=_0x1cce[_0x5b7788];return _0x573871;};'use strict';var _=require(_0xe1cc('0x0'));var util=require(_0xe1cc('0x1'));var moment=require(_0xe1cc('0x2'));var BPromise=require(_0xe1cc('0x3'));var rs=require(_0xe1cc('0x4'));var fs=require('fs');var Redis=require(_0xe1cc('0x5'));var db=require(_0xe1cc('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe1cc('0x7'));var config=require('../../config/environment');var jayson=require(_0xe1cc('0x8'));var client=jayson[_0xe1cc('0x9')][_0xe1cc('0xa')]({'port':0x232a});config[_0xe1cc('0xb')]=_['defaults'](config[_0xe1cc('0xb')],{'host':_0xe1cc('0xc'),'port':0x18eb});var socket=require(_0xe1cc('0xd'))(new Redis(config['redis']));require(_0xe1cc('0xe'))[_0xe1cc('0xf')](socket);function respondWithRpcPromise(_0x5ed349,_0x230310,_0x191f15){return new BPromise(function(_0x2e35f8,_0x2d0cfb){return client[_0xe1cc('0x10')](_0x5ed349,_0x191f15)[_0xe1cc('0x11')](function(_0xce8b75){logger[_0xe1cc('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x230310,'request\x20sent');logger[_0xe1cc('0x13')](_0xe1cc('0x14'),_0x230310,_0xe1cc('0x15'),JSON[_0xe1cc('0x16')](_0xce8b75));if(_0xce8b75['error']){if(_0xce8b75[_0xe1cc('0x17')][_0xe1cc('0x18')]===0x1f4){logger['error'](_0xe1cc('0x19'),_0x230310,_0xce8b75['error']['message']);return _0x2d0cfb(_0xce8b75['error']['message']);}logger['error'](_0xe1cc('0x19'),_0x230310,_0xce8b75[_0xe1cc('0x17')]['message']);return _0x2e35f8(_0xce8b75[_0xe1cc('0x17')][_0xe1cc('0x1a')]);}else{logger[_0xe1cc('0x12')](_0xe1cc('0x19'),_0x230310,_0xe1cc('0x15'));_0x2e35f8(_0xce8b75[_0xe1cc('0x1b')][_0xe1cc('0x1a')]);}})[_0xe1cc('0x1c')](function(_0x370fcc){logger[_0xe1cc('0x17')](_0xe1cc('0x19'),_0x230310,_0x370fcc);_0x2d0cfb(_0x370fcc);});});}exports[_0xe1cc('0x1d')]=function(_0x127ca5){var _0x5911e3=this;return new Promise(function(_0x2603be,_0xf2b900){return db[_0xe1cc('0x1e')]['update'](_0x127ca5[_0xe1cc('0x1f')],{'raw':_0x127ca5[_0xe1cc('0x20')]?_0x127ca5[_0xe1cc('0x20')][_0xe1cc('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x127ca5[_0xe1cc('0x20')]?_0x127ca5[_0xe1cc('0x20')][_0xe1cc('0x22')]||null:null,'attributes':_0x127ca5[_0xe1cc('0x20')]?_0x127ca5[_0xe1cc('0x20')][_0xe1cc('0x23')]||null:null,'limit':_0x127ca5[_0xe1cc('0x20')]?_0x127ca5[_0xe1cc('0x20')][_0xe1cc('0x24')]||null:null})['then'](function(_0x4d245a){logger['info'](_0xe1cc('0x1d'),_0x127ca5);logger[_0xe1cc('0x13')](_0xe1cc('0x1d'),_0x127ca5,JSON['stringify'](_0x4d245a));_0x2603be(_0x4d245a);})[_0xe1cc('0x1c')](function(_0xde9a6){logger[_0xe1cc('0x17')]('UpdateSmsInteraction',_0xde9a6[_0xe1cc('0x1a')],_0x127ca5);_0xf2b900(_0x5911e3[_0xe1cc('0x17')](0x1f4,_0xde9a6[_0xe1cc('0x1a')]));});});};exports['AddTagsToSmsInteraction']=function(_0x2db3ba){return new Promise(function(_0x5d62f6,_0x15ad0b){return db[_0xe1cc('0x1e')][_0xe1cc('0x25')]({'where':_0x2db3ba[_0xe1cc('0x20')]?_0x2db3ba[_0xe1cc('0x20')][_0xe1cc('0x22')]||null:null})[_0xe1cc('0x11')](function(_0xa94138){if(_0xa94138){return _0xa94138['addTags'](_0x2db3ba[_0xe1cc('0x1f')]['ids'],_[_0xe1cc('0x26')](_0x2db3ba[_0xe1cc('0x1f')],['ids','id'])||{});}})[_0xe1cc('0x27')](function(_0x1554cd){logger['info'](_0xe1cc('0x28'),_0x2db3ba);logger[_0xe1cc('0x13')](_0xe1cc('0x28'),_0x2db3ba,JSON[_0xe1cc('0x16')](_0x1554cd));_0x5d62f6(_0x1554cd);})['catch'](function(_0x21d3c4){logger[_0xe1cc('0x17')](_0xe1cc('0x28'),_0x21d3c4[_0xe1cc('0x1a')],_0x2db3ba);_0x15ad0b(_this[_0xe1cc('0x17')](0x1f4,_0x21d3c4[_0xe1cc('0x1a')]));});});}; \ No newline at end of file +var _0x1c4b=['AddTagsToSmsInteraction','find','addTags','ids','omit','body','spread','AddTags','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','request','then','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','limit'];(function(_0x26eb3b,_0x39ed05){var _0x4a930a=function(_0x1cc1f2){while(--_0x1cc1f2){_0x26eb3b['push'](_0x26eb3b['shift']());}};_0x4a930a(++_0x39ed05);}(_0x1c4b,0x179));var _0xb1c4=function(_0x27ccf0,_0x551eeb){_0x27ccf0=_0x27ccf0-0x0;var _0x1f5e58=_0x1c4b[_0x27ccf0];return _0x1f5e58;};'use strict';var _=require('lodash');var util=require(_0xb1c4('0x0'));var moment=require(_0xb1c4('0x1'));var BPromise=require(_0xb1c4('0x2'));var rs=require(_0xb1c4('0x3'));var fs=require('fs');var Redis=require(_0xb1c4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb1c4('0x5'));var config=require(_0xb1c4('0x6'));var jayson=require(_0xb1c4('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xb1c4('0x8')]=_[_0xb1c4('0x9')](config[_0xb1c4('0x8')],{'host':_0xb1c4('0xa'),'port':0x18eb});var socket=require(_0xb1c4('0xb'))(new Redis(config[_0xb1c4('0x8')]));require('./smsInteraction.socket')[_0xb1c4('0xc')](socket);function respondWithRpcPromise(_0x2c714f,_0x4405d9,_0x7992ee){return new BPromise(function(_0x2efc7a,_0x19dda2){return client[_0xb1c4('0xd')](_0x2c714f,_0x7992ee)[_0xb1c4('0xe')](function(_0x3f3f9b){logger['info'](_0xb1c4('0xf'),_0x4405d9,'request\x20sent');logger[_0xb1c4('0x10')](_0xb1c4('0x11'),_0x4405d9,_0xb1c4('0x12'),JSON[_0xb1c4('0x13')](_0x3f3f9b));if(_0x3f3f9b[_0xb1c4('0x14')]){if(_0x3f3f9b['error'][_0xb1c4('0x15')]===0x1f4){logger['error'](_0xb1c4('0xf'),_0x4405d9,_0x3f3f9b[_0xb1c4('0x14')]['message']);return _0x19dda2(_0x3f3f9b[_0xb1c4('0x14')][_0xb1c4('0x16')]);}logger[_0xb1c4('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x4405d9,_0x3f3f9b['error'][_0xb1c4('0x16')]);return _0x2efc7a(_0x3f3f9b[_0xb1c4('0x14')][_0xb1c4('0x16')]);}else{logger[_0xb1c4('0x17')](_0xb1c4('0xf'),_0x4405d9,_0xb1c4('0x12'));_0x2efc7a(_0x3f3f9b[_0xb1c4('0x18')][_0xb1c4('0x16')]);}})[_0xb1c4('0x19')](function(_0x1437ab){logger[_0xb1c4('0x14')](_0xb1c4('0xf'),_0x4405d9,_0x1437ab);_0x19dda2(_0x1437ab);});});}exports[_0xb1c4('0x1a')]=function(_0x573175){var _0x166157=this;return new Promise(function(_0x3ecd64,_0x4438ef){return db[_0xb1c4('0x1b')][_0xb1c4('0x1c')](_0x573175['body'],{'raw':_0x573175[_0xb1c4('0x1d')]?_0x573175[_0xb1c4('0x1d')][_0xb1c4('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x573175['options']?_0x573175[_0xb1c4('0x1d')][_0xb1c4('0x1f')]||null:null,'attributes':_0x573175['options']?_0x573175[_0xb1c4('0x1d')]['attributes']||null:null,'limit':_0x573175[_0xb1c4('0x1d')]?_0x573175[_0xb1c4('0x1d')][_0xb1c4('0x20')]||null:null})['then'](function(_0x2ed1a1){logger[_0xb1c4('0x17')](_0xb1c4('0x1a'),_0x573175);logger[_0xb1c4('0x10')](_0xb1c4('0x1a'),_0x573175,JSON[_0xb1c4('0x13')](_0x2ed1a1));_0x3ecd64(_0x2ed1a1);})[_0xb1c4('0x19')](function(_0x579a24){logger['error'](_0xb1c4('0x1a'),_0x579a24[_0xb1c4('0x16')],_0x573175);_0x4438ef(_0x166157[_0xb1c4('0x14')](0x1f4,_0x579a24['message']));});});};exports[_0xb1c4('0x21')]=function(_0x165649){return new Promise(function(_0x10ee26,_0x34a2fc){return db[_0xb1c4('0x1b')][_0xb1c4('0x22')]({'where':_0x165649[_0xb1c4('0x1d')]?_0x165649[_0xb1c4('0x1d')][_0xb1c4('0x1f')]||null:null})[_0xb1c4('0xe')](function(_0x2befa0){if(_0x2befa0){return _0x2befa0[_0xb1c4('0x23')](_0x165649['body'][_0xb1c4('0x24')],_[_0xb1c4('0x25')](_0x165649[_0xb1c4('0x26')],[_0xb1c4('0x24'),'id'])||{});}})[_0xb1c4('0x27')](function(_0x584847){logger[_0xb1c4('0x17')](_0xb1c4('0x28'),_0x165649);logger['debug'](_0xb1c4('0x28'),_0x165649,JSON[_0xb1c4('0x13')](_0x584847));_0x10ee26(_0x584847);})[_0xb1c4('0x19')](function(_0x2c8a34){logger[_0xb1c4('0x14')](_0xb1c4('0x28'),_0x2c8a34[_0xb1c4('0x16')],_0x165649);_0x34a2fc(_this['error'](0x1f4,_0x2c8a34[_0xb1c4('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index ec6d897..4732b9c 100644 --- a/server/api/smsInteraction/smsInteraction.socket.js +++ b/server/api/smsInteraction/smsInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['save','remove','update','removeListener','register','length','smsInteraction:'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0x2032,0xd9));var _0x2203=function(_0x4b8adf,_0x1017d1){_0x4b8adf=_0x4b8adf-0x0;var _0x173feb=_0x2032[_0x4b8adf];return _0x173feb;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x2203('0x0'),_0x2203('0x1'),_0x2203('0x2')];function createListener(_0x4c28da,_0x486390){return function(_0x228a29){_0x486390['emit'](_0x4c28da,_0x228a29);};}function removeListener(_0x46c49a,_0x880dcd){return function(){SmsInteractionEvents[_0x2203('0x3')](_0x46c49a,_0x880dcd);};}exports[_0x2203('0x4')]=function(_0x3f7ba1){for(var _0x13367a=0x0,_0x2e0f63=events[_0x2203('0x5')];_0x13367a<_0x2e0f63;_0x13367a++){var _0x18c4d6=events[_0x13367a];var _0x2049ff=createListener(_0x2203('0x6')+_0x18c4d6,_0x3f7ba1);SmsInteractionEvents['on'](_0x18c4d6,_0x2049ff);}}; \ No newline at end of file +var _0xbaf0=['removeListener','register','length','smsInteraction:','save','remove','update'];(function(_0xead2da,_0x18ebaa){var _0x464924=function(_0x52072f){while(--_0x52072f){_0xead2da['push'](_0xead2da['shift']());}};_0x464924(++_0x18ebaa);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var SmsInteractionEvents=require('./smsInteraction.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(){SmsInteractionEvents[_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);SmsInteractionEvents['on'](_0x1d0a0d,_0x5f5030);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 49578da..5ca3d4d 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 _0x656a=['Router','../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','describe','show','tracked','smsmessage:create','create','/:id/status','status','put','/:id','update','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x656a,0x87));var _0xa656=function(_0x349915,_0x124261){_0x349915=_0x349915-0x0;var _0x8be4f3=_0x656a[_0x349915];return _0x8be4f3;};'use strict';var multer=require(_0xa656('0x0'));var util=require(_0xa656('0x1'));var path=require(_0xa656('0x2'));var timeout=require(_0xa656('0x3'));var express=require(_0xa656('0x4'));var router=express[_0xa656('0x5')]();var auth=require(_0xa656('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa656('0x7'));var controller=require(_0xa656('0x8'));router[_0xa656('0x9')]('/',auth[_0xa656('0xa')](),controller[_0xa656('0xb')]);router[_0xa656('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xa656('0xc')]);router[_0xa656('0x9')]('/:id',auth[_0xa656('0xa')](),controller[_0xa656('0xd')]);router['post']('/',auth[_0xa656('0xa')](),interaction[_0xa656('0xe')]('sms',_0xa656('0xf')),controller[_0xa656('0x10')]);router['post'](_0xa656('0x11'),controller[_0xa656('0x12')]);router[_0xa656('0x13')](_0xa656('0x14'),auth[_0xa656('0xa')](),controller[_0xa656('0x15')]);router[_0xa656('0x13')]('/:id/accept',auth[_0xa656('0xa')](),controller[_0xa656('0x16')]);router['put'](_0xa656('0x17'),auth[_0xa656('0xa')](),controller[_0xa656('0x18')]);router[_0xa656('0x19')](_0xa656('0x14'),auth[_0xa656('0xa')](),controller[_0xa656('0x1a')]);module[_0xa656('0x1b')]=router; \ No newline at end of file +var _0x0527=['/:id/accept','accept','/:id/reject','reject','delete','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','sms','smsmessage:create','post','/:id/status','status','/:id','update','put'];(function(_0x507a2d,_0x386ee0){var _0xffac47=function(_0x4ad731){while(--_0x4ad731){_0x507a2d['push'](_0x507a2d['shift']());}};_0xffac47(++_0x386ee0);}(_0x0527,0xb4));var _0x7052=function(_0x327ccf,_0x3fc254){_0x327ccf=_0x327ccf-0x0;var _0x4f0ad0=_0x0527[_0x327ccf];return _0x4f0ad0;};'use strict';var multer=require(_0x7052('0x0'));var util=require(_0x7052('0x1'));var path=require('path');var timeout=require(_0x7052('0x2'));var express=require(_0x7052('0x3'));var router=express['Router']();var auth=require(_0x7052('0x4'));var interaction=require(_0x7052('0x5'));var config=require(_0x7052('0x6'));var controller=require('./smsMessage.controller');router[_0x7052('0x7')]('/',auth[_0x7052('0x8')](),controller[_0x7052('0x9')]);router[_0x7052('0x7')](_0x7052('0xa'),auth['isAuthenticated'](),controller[_0x7052('0xb')]);router[_0x7052('0x7')]('/:id',auth[_0x7052('0x8')](),controller['show']);router['post']('/',auth[_0x7052('0x8')](),interaction['tracked'](_0x7052('0xc'),_0x7052('0xd')),controller['create']);router[_0x7052('0xe')](_0x7052('0xf'),controller[_0x7052('0x10')]);router['put'](_0x7052('0x11'),auth['isAuthenticated'](),controller[_0x7052('0x12')]);router[_0x7052('0x13')](_0x7052('0x14'),auth['isAuthenticated'](),controller[_0x7052('0x15')]);router[_0x7052('0x13')](_0x7052('0x16'),auth[_0x7052('0x8')](),controller[_0x7052('0x17')]);router[_0x7052('0x18')]('/:id',auth[_0x7052('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index b546e58..538d29a 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 _0xc5ef=['BOOLEAN','sequelize','exports','TEXT','ENUM','out','STRING','DATE'];(function(_0x19c9bc,_0x33df60){var _0x35f5ef=function(_0x4a8836){while(--_0x4a8836){_0x19c9bc['push'](_0x19c9bc['shift']());}};_0x35f5ef(++_0x33df60);}(_0xc5ef,0x149));var _0xfc5e=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xc5ef[_0x487b0c];return _0x1adbdc;};'use strict';var Sequelize=require(_0xfc5e('0x0'));module[_0xfc5e('0x1')]={'body':{'type':Sequelize[_0xfc5e('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xfc5e('0x3')]('in',_0xfc5e('0x4')),'defaultValue':_0xfc5e('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xfc5e('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xfc5e('0x6')]},'secret':{'type':Sequelize[_0xfc5e('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xfc5e('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x6189=['BOOLEAN','ENUM','out','STRING','sequelize','exports','TEXT','medium'];(function(_0x4ceee4,_0x234442){var _0x19afbb=function(_0x53dddd){while(--_0x53dddd){_0x4ceee4['push'](_0x4ceee4['shift']());}};_0x19afbb(++_0x234442);}(_0x6189,0xac));var _0x9618=function(_0x3be8fa,_0x519349){_0x3be8fa=_0x3be8fa-0x0;var _0x90ed=_0x6189[_0x3be8fa];return _0x90ed;};'use strict';var Sequelize=require(_0x9618('0x0'));module[_0x9618('0x1')]={'body':{'type':Sequelize[_0x9618('0x2')](_0x9618('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9618('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9618('0x5')]('in',_0x9618('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x9618('0x7')](0xbe)},'phone':{'type':Sequelize[_0x9618('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x9618('0x7')]},'providerResponse':{'type':Sequelize[_0x9618('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index bbc312c..5749a12 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 _0x7321=['limit','set','apply','reject','save','update','then','stack','name','index','map','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','SmsMessage','include','findAll','rows','create','body','params','find','describe','../../config/logger','sms-interactions','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','interaction','user','role','stringify','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','RejectMessage','rejectMessage','SmsAccount','SmsAccountId','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','indexOf','sent','Status','infobip','results','groupName','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','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/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','count','offset'];(function(_0x4c93d5,_0x202aa2){var _0x3f357b=function(_0x3ba74f){while(--_0x3ba74f){_0x4c93d5['push'](_0x4c93d5['shift']());}};_0x3f357b(++_0x202aa2);}(_0x7321,0x1e3));var _0x1732=function(_0x2f3570,_0x4d7940){_0x2f3570=_0x2f3570-0x0;var _0x5bbab8=_0x7321[_0x2f3570];return _0x5bbab8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1732('0x0'));var rimraf=require(_0x1732('0x1'));var zipdir=require(_0x1732('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1732('0x3'));var moment=require('moment');var BPromise=require(_0x1732('0x4'));var Mustache=require(_0x1732('0x5'));var util=require('util');var path=require(_0x1732('0x6'));var sox=require(_0x1732('0x7'));var csv=require(_0x1732('0x8'));var ejs=require(_0x1732('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1732('0xa'));var crypto=require('crypto');var jsforce=require(_0x1732('0xb'));var deskjs=require(_0x1732('0xc'));var toCsv=require(_0x1732('0x8'));var querystring=require(_0x1732('0xd'));var Papa=require(_0x1732('0xe'));var Redis=require(_0x1732('0xf'));var authService=require(_0x1732('0x10'));var qs=require(_0x1732('0x11'));var as=require(_0x1732('0x12'));var hardwareService=require(_0x1732('0x13'));var logger=require('../../config/logger')(_0x1732('0x14'));var utils=require(_0x1732('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1732('0x16'));var db=require(_0x1732('0x17'))['db'];config['redis']=_['defaults'](config[_0x1732('0x18')],{'host':_0x1732('0x19'),'port':0x18eb});var socket=require(_0x1732('0x1a'))(new Redis(config[_0x1732('0x18')]));require(_0x1732('0x1b'))[_0x1732('0x1c')](socket);var jayson=require(_0x1732('0x1d'));var client=jayson[_0x1732('0x1e')][_0x1732('0x1f')]({'port':0x232c});var client9002=jayson[_0x1732('0x1e')][_0x1732('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x519c06,_0x446fa4,_0x52df0c,_0x4c31a8){return new BPromise(function(_0x14c1e3,_0x16e5e0){var _0x4cd27a=_0x4c31a8||client;return _0x4cd27a[_0x1732('0x20')](_0x519c06,_0x52df0c)['then'](function(_0x276514){logger[_0x1732('0x21')](_0x1732('0x22'),_0x446fa4,_0x1732('0x23'));logger[_0x1732('0x24')](_0x1732('0x25'),_0x446fa4,_0x1732('0x23'),JSON['stringify'](_0x276514));if(_0x276514['error']){if(_0x276514[_0x1732('0x26')][_0x1732('0x27')]===0x1f4){logger['error'](_0x1732('0x22'),_0x446fa4,_0x276514[_0x1732('0x26')]['message']);return _0x16e5e0(_0x276514[_0x1732('0x26')][_0x1732('0x28')]);}logger['error'](_0x1732('0x22'),_0x446fa4,_0x276514[_0x1732('0x26')][_0x1732('0x28')]);return _0x14c1e3(_0x276514['error'][_0x1732('0x28')]);}else{logger['info'](_0x1732('0x22'),_0x446fa4,_0x1732('0x23'));_0x14c1e3(_0x276514[_0x1732('0x29')]['message']);}})[_0x1732('0x2a')](function(_0x3d5fa0){logger[_0x1732('0x26')]('SmsMessage,\x20%s,\x20%s',_0x446fa4,_0x3d5fa0);_0x16e5e0(_0x3d5fa0);});});}function respondWithStatusCode(_0x21125f,_0x495d73){_0x495d73=_0x495d73||0xcc;return function(_0x464496){if(_0x464496){return _0x21125f[_0x1732('0x2b')](_0x495d73);}return _0x21125f['status'](_0x495d73)[_0x1732('0x2c')]();};}function respondWithResult(_0x2e3d46,_0x135331){_0x135331=_0x135331||0xc8;return function(_0xf38155){if(_0xf38155){return _0x2e3d46[_0x1732('0x2d')](_0x135331)[_0x1732('0x2e')](_0xf38155);}};}function respondWithFilteredResult(_0x59587a,_0x36c099){return function(_0x2b07e1){if(_0x2b07e1){var _0x121f58=_0x2b07e1[_0x1732('0x2f')],_0xa49f20=_0x36c099[_0x1732('0x30')],_0x944c1d=_0x36c099[_0x1732('0x30')]+_0x36c099[_0x1732('0x31')],_0x327268;if(_0x944c1d>=_0x121f58){_0x944c1d=_0x121f58;_0x327268=0xc8;}else{_0x327268=0xce;}_0x59587a[_0x1732('0x2d')](_0x327268);return _0x59587a[_0x1732('0x32')]('Content-Range',_0xa49f20+'-'+_0x944c1d+'/'+_0x121f58)[_0x1732('0x2e')](_0x2b07e1);}return null;};}function patchUpdates(_0xb94b2a){return function(_0x574d70){try{jsonpatch[_0x1732('0x33')](_0x574d70,_0xb94b2a,!![]);}catch(_0x22ff1a){return BPromise[_0x1732('0x34')](_0x22ff1a);}return _0x574d70[_0x1732('0x35')]();};}function saveUpdates(_0x179c61,_0x51d71f){return function(_0x5cd227){if(_0x5cd227){return _0x5cd227[_0x1732('0x36')](_0x179c61)[_0x1732('0x37')](function(_0x2b150e){return _0x2b150e;});}return null;};}function removeEntity(_0x3ef8d8,_0x5726c3){return function(_0x21e6c4){if(_0x21e6c4){return _0x21e6c4['destroy']()[_0x1732('0x37')](function(){_0x3ef8d8[_0x1732('0x2d')](0xcc)[_0x1732('0x2c')]();});}};}function handleEntityNotFound(_0x30a29a,_0x19da8f){return function(_0x34ab31){if(!_0x34ab31){_0x30a29a[_0x1732('0x2b')](0x194);}return _0x34ab31;};}function handleError(_0x55b5d6,_0x27c582){_0x27c582=_0x27c582||0x1f4;return function(_0x23aa54){logger[_0x1732('0x26')](_0x23aa54[_0x1732('0x38')]);if(_0x23aa54[_0x1732('0x39')]){delete _0x23aa54[_0x1732('0x39')];}_0x55b5d6['status'](_0x27c582)['send'](_0x23aa54);};}exports[_0x1732('0x3a')]=function(_0x273c61,_0x157c27){var _0x495492={},_0x76862d={},_0x5e7fd0={'count':0x0,'rows':[]};var _0x3f8e82=_[_0x1732('0x3b')](db['SmsMessage'][_0x1732('0x3c')],function(_0x3ad859){return{'name':_0x3ad859['fieldName'],'type':_0x3ad859['type'][_0x1732('0x3d')]};});_0x76862d[_0x1732('0x3e')]=_[_0x1732('0x3b')](_0x3f8e82,'name');_0x76862d['query']=_[_0x1732('0x3f')](_0x273c61[_0x1732('0x40')]);_0x76862d[_0x1732('0x41')]=_[_0x1732('0x42')](_0x76862d['model'],_0x76862d['query']);_0x495492[_0x1732('0x43')]=_[_0x1732('0x42')](_0x76862d['model'],qs[_0x1732('0x44')](_0x273c61[_0x1732('0x40')][_0x1732('0x44')]));_0x495492[_0x1732('0x43')]=_0x495492[_0x1732('0x43')][_0x1732('0x45')]?_0x495492[_0x1732('0x43')]:_0x76862d[_0x1732('0x3e')];if(!_0x273c61[_0x1732('0x40')][_0x1732('0x46')]('nolimit')){_0x495492[_0x1732('0x31')]=qs[_0x1732('0x31')](_0x273c61[_0x1732('0x40')]['limit']);_0x495492[_0x1732('0x30')]=qs[_0x1732('0x30')](_0x273c61[_0x1732('0x40')]['offset']);}_0x495492[_0x1732('0x47')]=qs[_0x1732('0x48')](_0x273c61[_0x1732('0x40')][_0x1732('0x48')]);_0x495492[_0x1732('0x49')]=qs[_0x1732('0x41')](_[_0x1732('0x4a')](_0x273c61[_0x1732('0x40')],_0x76862d['filters']),_0x3f8e82);if(_0x273c61[_0x1732('0x40')]['filter']){_0x495492['where']=_[_0x1732('0x4b')](_0x495492[_0x1732('0x49')],{'$or':_[_0x1732('0x3b')](_0x3f8e82,function(_0x238f6c){if(_0x238f6c[_0x1732('0x4c')]!==_0x1732('0x4d')){var _0x13c5a0={};_0x13c5a0[_0x238f6c[_0x1732('0x39')]]={'$like':'%'+_0x273c61[_0x1732('0x40')][_0x1732('0x4e')]+'%'};return _0x13c5a0;}})});}_0x495492=_['merge']({},_0x495492,_0x273c61[_0x1732('0x4f')]);var _0x45122a={'where':_0x495492[_0x1732('0x49')]};return db[_0x1732('0x50')]['count'](_0x45122a)[_0x1732('0x37')](function(_0x1e7b54){_0x5e7fd0[_0x1732('0x2f')]=_0x1e7b54;if(_0x273c61['query']['includeAll']){_0x495492[_0x1732('0x51')]=[{'all':!![]}];}return db[_0x1732('0x50')][_0x1732('0x52')](_0x495492);})['then'](function(_0x2ae8b5){_0x5e7fd0[_0x1732('0x53')]=_0x2ae8b5;return _0x5e7fd0;})[_0x1732('0x37')](respondWithFilteredResult(_0x157c27,_0x495492))[_0x1732('0x2a')](handleError(_0x157c27,null));};exports['show']=function(_0xf42ecf,_0x32e826){var _0x529904={'raw':!![],'where':{'id':_0xf42ecf['params']['id']}},_0x40d37e={};_0x40d37e[_0x1732('0x3e')]=_['keys'](db[_0x1732('0x50')][_0x1732('0x3c')]);_0x40d37e[_0x1732('0x40')]=_[_0x1732('0x3f')](_0xf42ecf['query']);_0x40d37e[_0x1732('0x41')]=_[_0x1732('0x42')](_0x40d37e[_0x1732('0x3e')],_0x40d37e['query']);_0x529904[_0x1732('0x43')]=_[_0x1732('0x42')](_0x40d37e[_0x1732('0x3e')],qs[_0x1732('0x44')](_0xf42ecf['query'][_0x1732('0x44')]));_0x529904['attributes']=_0x529904['attributes'][_0x1732('0x45')]?_0x529904['attributes']:_0x40d37e[_0x1732('0x3e')];if(_0xf42ecf['query']['includeAll']){_0x529904[_0x1732('0x51')]=[{'all':!![]}];}_0x529904=_[_0x1732('0x4b')]({},_0x529904,_0xf42ecf['options']);return db[_0x1732('0x50')]['find'](_0x529904)[_0x1732('0x37')](handleEntityNotFound(_0x32e826,null))[_0x1732('0x37')](respondWithResult(_0x32e826,null))[_0x1732('0x2a')](handleError(_0x32e826,null));};exports[_0x1732('0x54')]=function(_0x2fea03,_0x1c312f){return db['SmsMessage'][_0x1732('0x54')](_0x2fea03[_0x1732('0x55')],{})['then'](respondWithResult(_0x1c312f,0xc9))[_0x1732('0x2a')](handleError(_0x1c312f,null));};exports[_0x1732('0x36')]=function(_0x13462f,_0x36feb9){if(_0x13462f[_0x1732('0x55')]['id']){delete _0x13462f['body']['id'];}return db[_0x1732('0x50')]['find']({'where':{'id':_0x13462f[_0x1732('0x56')]['id']}})[_0x1732('0x37')](handleEntityNotFound(_0x36feb9,null))[_0x1732('0x37')](saveUpdates(_0x13462f[_0x1732('0x55')],null))[_0x1732('0x37')](respondWithResult(_0x36feb9,null))[_0x1732('0x2a')](handleError(_0x36feb9,null));};exports['destroy']=function(_0x28754a,_0x376765){return db[_0x1732('0x50')][_0x1732('0x57')]({'where':{'id':_0x28754a['params']['id']}})[_0x1732('0x37')](handleEntityNotFound(_0x376765,null))['then'](removeEntity(_0x376765,null))[_0x1732('0x2a')](handleError(_0x376765,null));};exports[_0x1732('0x58')]=function(_0x5e160b,_0x161277){return db[_0x1732('0x50')][_0x1732('0x58')]()[_0x1732('0x37')](respondWithResult(_0x161277,null))[_0x1732('0x2a')](handleError(_0x161277,null));};var interaction_log=require(_0x1732('0x59'))(_0x1732('0x5a'));exports['accept']=function(_0x3c1e8f,_0x1f50c0,_0x586ad2){var _0x5c588a={'agent':{},'channel':_0x1732('0x5b')};if(_0x3c1e8f[_0x1732('0x55')]['id']){delete _0x3c1e8f[_0x1732('0x55')]['id'];}_0x3c1e8f['body'][_0x1732('0x5c')]=!![];_0x3c1e8f[_0x1732('0x55')][_0x1732('0x5d')]=moment()['format'](_0x1732('0x5e'));_0x3c1e8f[_0x1732('0x55')][_0x1732('0x5f')]=_0x3c1e8f[_0x1732('0x55')][_0x1732('0x5f')]||_0x3c1e8f['user']['id'];_0x5c588a[_0x1732('0x60')]['id']=_0x3c1e8f[_0x1732('0x55')][_0x1732('0x5f')];return db[_0x1732('0x50')][_0x1732('0x57')]({'where':{'id':_0x3c1e8f[_0x1732('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x1732('0x61')],'as':_0x1732('0x62')}]})[_0x1732('0x37')](handleEntityNotFound(_0x1f50c0,null))[_0x1732('0x37')](saveUpdates(_0x3c1e8f[_0x1732('0x55')],null))['then'](function(_0x300a66){if(_0x300a66){_0x5c588a[_0x1732('0x28')]=_0x300a66[_0x1732('0x63')]({'plain':!![]});return db[_0x1732('0x64')][_0x1732('0x57')]({'where':{'id':_0x300a66[_0x1732('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x1f50c0,null))[_0x1732('0x37')](function(_0x39abf0){if(_0x39abf0){return _0x39abf0[_0x1732('0x36')]({'UserId':_0x3c1e8f['body'][_0x1732('0x5f')],'read1stAt':_[_0x1732('0x66')](_0x39abf0[_0x1732('0x67')])?moment()[_0x1732('0x68')](_0x1732('0x5e')):undefined});}return null;})[_0x1732('0x37')](function(_0x3ed413){if(_0x3ed413){_0x5c588a[_0x1732('0x69')]=_0x3ed413['get']({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3c1e8f[_0x1732('0x6a')]['id'],_0x3c1e8f[_0x1732('0x6a')][_0x1732('0x39')],_0x3c1e8f['user'][_0x1732('0x6b')],_0x5c588a['interaction']['id'],_0x3c1e8f[_0x1732('0x55')]?JSON[_0x1732('0x6c')](_0x3c1e8f[_0x1732('0x55')]):'null');return respondWithRpcPromise(_0x1732('0x6d'),_0x1732('0x6e'),_0x5c588a);}return null;})[_0x1732('0x37')](function(_0x339b87){if(_0x339b87){if(_0x3c1e8f['body'][_0x1732('0x6f')]){_0x5c588a[_0x1732('0x28')][_0x1732('0x70')]=util[_0x1732('0x68')](_0x1732('0x71'),_0x3c1e8f['user'][_0x1732('0x39')]);_0x5c588a['message'][_0x1732('0x72')]=_0x5c588a[_0x1732('0x72')];_0x5c588a[_0x1732('0x28')]['event']='accept';return respondWithRpcPromise(_0x1732('0x73'),_0x1732('0x73'),{'event':_0x1732('0x74'),'message':_0x5c588a['message']},client9002)['then'](function(){return _0x5c588a;});}return _0x5c588a;}return null;})['then'](respondWithResult(_0x1f50c0,null))['catch'](handleError(_0x1f50c0,null));};var interaction_log=require(_0x1732('0x59'))('sms-interactions');exports['reject']=function(_0xe4451f,_0x403f0f,_0xab29d1){var _0x4ba0b6={'agent':{},'channel':_0x1732('0x5b')};if(_0xe4451f[_0x1732('0x55')]['id']){delete _0xe4451f['body']['id'];}_0xe4451f[_0x1732('0x55')][_0x1732('0x5f')]=_0xe4451f[_0x1732('0x55')][_0x1732('0x5f')]||_0xe4451f[_0x1732('0x6a')]['id'];_0x4ba0b6['agent']['id']=_0xe4451f[_0x1732('0x55')]['UserId'];return db['SmsMessage'][_0x1732('0x57')]({'where':{'id':_0xe4451f[_0x1732('0x56')]['id'],'UserId':null}})[_0x1732('0x37')](handleEntityNotFound(_0x403f0f,null))[_0x1732('0x37')](function(_0x4d2ae4){if(_0x4d2ae4){_0x4ba0b6[_0x1732('0x28')]=_0x4d2ae4[_0x1732('0x63')]({'plain':!![]});return db[_0x1732('0x64')]['find']({'where':{'id':_0x4d2ae4[_0x1732('0x65')]}});}return null;})[_0x1732('0x37')](handleEntityNotFound(_0x403f0f,null))[_0x1732('0x37')](function(_0x3459bd){if(_0x3459bd){_0x4ba0b6[_0x1732('0x69')]=_0x3459bd[_0x1732('0x63')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xe4451f[_0x1732('0x6a')]['id'],_0xe4451f[_0x1732('0x6a')][_0x1732('0x39')],_0xe4451f['user'][_0x1732('0x6b')],_0x4ba0b6[_0x1732('0x69')]['id'],_0xe4451f[_0x1732('0x55')]?JSON[_0x1732('0x6c')](_0xe4451f['body']):'null');return respondWithRpcPromise(_0x1732('0x75'),_0x1732('0x76'),_0x4ba0b6);}return null;})[_0x1732('0x37')](function(_0x53f07d){if(_0x53f07d){_0x53f07d['message'][_0x1732('0x70')]=util['format'](_0x1732('0x71'),_0xe4451f[_0x1732('0x6a')][_0x1732('0x39')]);_0x53f07d[_0x1732('0x28')][_0x1732('0x72')]=_0x4ba0b6['channel'];_0x53f07d[_0x1732('0x28')]['event']='reject';respondWithRpcPromise('EventManager',_0x1732('0x73'),{'event':'rejectmessage','message':_0x53f07d[_0x1732('0x28')]},client9002);return _0x4ba0b6;}return null;})[_0x1732('0x37')](respondWithResult(_0x403f0f,null))[_0x1732('0x2a')](handleError(_0x403f0f,null));};exports[_0x1732('0x2d')]=function(_0x49c83a,_0x2297b6,_0x28ef10){if(_0x49c83a[_0x1732('0x55')]['id']){delete _0x49c83a[_0x1732('0x55')]['id'];}var _0x167a3d;return db[_0x1732('0x50')]['find']({'where':{'id':_0x49c83a[_0x1732('0x56')]['id']}})['then'](handleEntityNotFound(_0x2297b6,null))[_0x1732('0x37')](function(_0x18c6fb){if(_0x18c6fb){_0x167a3d=_0x18c6fb;return db[_0x1732('0x77')][_0x1732('0x57')]({'where':{'id':_0x18c6fb[_0x1732('0x78')]}});}})[_0x1732('0x37')](handleEntityNotFound(_0x2297b6,null))[_0x1732('0x37')](function(_0x21dfe7){if(_0x21dfe7){logger[_0x1732('0x24')](_0x1732('0x25'),_0x1732('0x2d'),'received\x20delivery\x20report\x20from',_0x21dfe7[_0x1732('0x4c')],util[_0x1732('0x79')](_0x49c83a[_0x1732('0x55')],{'showHidden':![],'depth':null}));switch(_0x21dfe7[_0x1732('0x4c')]){case _0x1732('0x7a'):if(_0x49c83a[_0x1732('0x55')][_0x1732('0x7b')]&&_0x49c83a[_0x1732('0x55')]['MessageSid']===_0x167a3d[_0x1732('0x7c')]){return _0x167a3d[_0x1732('0x36')]({'read':!![]});}else{logger[_0x1732('0x26')](_0x1732('0x7d'),_0x1732('0x2d'),'twilio',util['inspect'](_0x49c83a[_0x1732('0x55')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x49c83a[_0x1732('0x55')]['MessageUUID']&&_0x49c83a[_0x1732('0x55')][_0x1732('0x7e')]===_0x167a3d[_0x1732('0x7c')]&&_[_0x1732('0x7f')]([_0x1732('0x80'),'delivered'],_0x49c83a[_0x1732('0x55')][_0x1732('0x81')])>=0x0){return _0x167a3d['update']({'read':!![]});}else{logger['error'](_0x1732('0x7d'),_0x1732('0x2d'),'plivio',util[_0x1732('0x79')](_0x49c83a[_0x1732('0x55')],{'showHidden':![],'depth':null}));}break;case _0x1732('0x82'):var _0x5b26c2=_0x49c83a['body'][_0x1732('0x83')][0x0];if(_0x5b26c2['status'][_0x1732('0x84')]==='DELIVERED'){return _0x167a3d[_0x1732('0x36')]({'read':!![]});}else{logger[_0x1732('0x26')](_0x1732('0x7d'),_0x1732('0x2d'),_0x1732('0x82'),util['inspect'](_0x49c83a[_0x1732('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x167a3d;}})[_0x1732('0x37')](respondWithResult(_0x2297b6,null))['catch'](handleError(_0x2297b6,null));}; \ No newline at end of file +var _0x1785=['results','groupName','DELIVERED','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','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','./smsMessage.socket','register','client','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','end','status','json','count','offset','limit','set','Content-Range','apply','reject','sendStatus','name','send','index','map','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','SmsMessage','findAll','rows','show','params','keys','rawAttributes','include','find','catch','create','update','body','describe','accept','sms','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','interface','SIP/%s','channel','EventManager','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','rejectmessage','SmsAccount','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','plivio'];(function(_0x6c570d,_0x3ac9b1){var _0x2b5ecc=function(_0x425227){while(--_0x425227){_0x6c570d['push'](_0x6c570d['shift']());}};_0x2b5ecc(++_0x3ac9b1);}(_0x1785,0x89));var _0x5178=function(_0xb1174e,_0x1e68a7){_0xb1174e=_0xb1174e-0x0;var _0x285bac=_0x1785[_0xb1174e];return _0x285bac;};'use strict';var pdf=require(_0x5178('0x0'));var emlformat=require(_0x5178('0x1'));var rimraf=require(_0x5178('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5178('0x3'));var rp=require(_0x5178('0x4'));var moment=require('moment');var BPromise=require(_0x5178('0x5'));var Mustache=require(_0x5178('0x6'));var util=require(_0x5178('0x7'));var path=require(_0x5178('0x8'));var sox=require(_0x5178('0x9'));var csv=require(_0x5178('0xa'));var ejs=require(_0x5178('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5178('0xc'));var crypto=require(_0x5178('0xd'));var jsforce=require(_0x5178('0xe'));var deskjs=require(_0x5178('0xf'));var toCsv=require(_0x5178('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5178('0x10'));var authService=require(_0x5178('0x11'));var qs=require(_0x5178('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5178('0x13'));var logger=require(_0x5178('0x14'))('api');var utils=require(_0x5178('0x15'));var config=require(_0x5178('0x16'));var licenseUtil=require(_0x5178('0x17'));var db=require(_0x5178('0x18'))['db'];config[_0x5178('0x19')]=_[_0x5178('0x1a')](config[_0x5178('0x19')],{'host':_0x5178('0x1b'),'port':0x18eb});var socket=require(_0x5178('0x1c'))(new Redis(config[_0x5178('0x19')]));require(_0x5178('0x1d'))[_0x5178('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5178('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x5178('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22e7d6,_0x568311,_0x22e818,_0x13133d){return new BPromise(function(_0x1ceef6,_0x3d27b4){var _0x713d55=_0x13133d||client;return _0x713d55[_0x5178('0x20')](_0x22e7d6,_0x22e818)[_0x5178('0x21')](function(_0x5dae45){logger[_0x5178('0x22')](_0x5178('0x23'),_0x568311,_0x5178('0x24'));logger[_0x5178('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x568311,_0x5178('0x24'),JSON[_0x5178('0x26')](_0x5dae45));if(_0x5dae45[_0x5178('0x27')]){if(_0x5dae45[_0x5178('0x27')]['code']===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x568311,_0x5dae45['error'][_0x5178('0x28')]);return _0x3d27b4(_0x5dae45['error'][_0x5178('0x28')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x568311,_0x5dae45[_0x5178('0x27')]['message']);return _0x1ceef6(_0x5dae45[_0x5178('0x27')][_0x5178('0x28')]);}else{logger[_0x5178('0x22')]('SmsMessage,\x20%s,\x20%s',_0x568311,_0x5178('0x24'));_0x1ceef6(_0x5dae45[_0x5178('0x29')][_0x5178('0x28')]);}})['catch'](function(_0x169fcf){logger[_0x5178('0x27')]('SmsMessage,\x20%s,\x20%s',_0x568311,_0x169fcf);_0x3d27b4(_0x169fcf);});});}function respondWithStatusCode(_0x299618,_0x2c8da9){_0x2c8da9=_0x2c8da9||0xcc;return function(_0x2433c9){if(_0x2433c9){return _0x299618['sendStatus'](_0x2c8da9);}return _0x299618['status'](_0x2c8da9)[_0x5178('0x2a')]();};}function respondWithResult(_0x4ce96c,_0x12e6c4){_0x12e6c4=_0x12e6c4||0xc8;return function(_0x1b01ed){if(_0x1b01ed){return _0x4ce96c[_0x5178('0x2b')](_0x12e6c4)[_0x5178('0x2c')](_0x1b01ed);}};}function respondWithFilteredResult(_0x2c8f31,_0x3414a9){return function(_0x5e94b8){if(_0x5e94b8){var _0x4e1dd6=_0x5e94b8[_0x5178('0x2d')],_0x39ad8=_0x3414a9[_0x5178('0x2e')],_0x386f80=_0x3414a9[_0x5178('0x2e')]+_0x3414a9[_0x5178('0x2f')],_0x5dd3e6;if(_0x386f80>=_0x4e1dd6){_0x386f80=_0x4e1dd6;_0x5dd3e6=0xc8;}else{_0x5dd3e6=0xce;}_0x2c8f31['status'](_0x5dd3e6);return _0x2c8f31[_0x5178('0x30')](_0x5178('0x31'),_0x39ad8+'-'+_0x386f80+'/'+_0x4e1dd6)[_0x5178('0x2c')](_0x5e94b8);}return null;};}function patchUpdates(_0x316db1){return function(_0x44db72){try{jsonpatch[_0x5178('0x32')](_0x44db72,_0x316db1,!![]);}catch(_0x408a70){return BPromise[_0x5178('0x33')](_0x408a70);}return _0x44db72['save']();};}function saveUpdates(_0x4b5d29,_0x1fff47){return function(_0x5a08b3){if(_0x5a08b3){return _0x5a08b3['update'](_0x4b5d29)[_0x5178('0x21')](function(_0x6e9121){return _0x6e9121;});}return null;};}function removeEntity(_0xbf7cab,_0x1af67c){return function(_0x26d41a){if(_0x26d41a){return _0x26d41a['destroy']()[_0x5178('0x21')](function(){_0xbf7cab[_0x5178('0x2b')](0xcc)[_0x5178('0x2a')]();});}};}function handleEntityNotFound(_0x2a319b,_0x4c61c1){return function(_0x203216){if(!_0x203216){_0x2a319b[_0x5178('0x34')](0x194);}return _0x203216;};}function handleError(_0x514bef,_0x22ea6c){_0x22ea6c=_0x22ea6c||0x1f4;return function(_0xaee22e){logger[_0x5178('0x27')](_0xaee22e['stack']);if(_0xaee22e[_0x5178('0x35')]){delete _0xaee22e[_0x5178('0x35')];}_0x514bef['status'](_0x22ea6c)[_0x5178('0x36')](_0xaee22e);};}exports[_0x5178('0x37')]=function(_0x48238c,_0x1d424a){var _0x60d89={},_0x1815ef={},_0x5cb5a7={'count':0x0,'rows':[]};var _0x193630=_[_0x5178('0x38')](db['SmsMessage']['rawAttributes'],function(_0x1fed5e){return{'name':_0x1fed5e['fieldName'],'type':_0x1fed5e[_0x5178('0x39')][_0x5178('0x3a')]};});_0x1815ef[_0x5178('0x3b')]=_[_0x5178('0x38')](_0x193630,'name');_0x1815ef[_0x5178('0x3c')]=_['keys'](_0x48238c[_0x5178('0x3c')]);_0x1815ef[_0x5178('0x3d')]=_[_0x5178('0x3e')](_0x1815ef[_0x5178('0x3b')],_0x1815ef[_0x5178('0x3c')]);_0x60d89[_0x5178('0x3f')]=_[_0x5178('0x3e')](_0x1815ef[_0x5178('0x3b')],qs[_0x5178('0x40')](_0x48238c[_0x5178('0x3c')][_0x5178('0x40')]));_0x60d89['attributes']=_0x60d89['attributes'][_0x5178('0x41')]?_0x60d89['attributes']:_0x1815ef['model'];if(!_0x48238c[_0x5178('0x3c')][_0x5178('0x42')]('nolimit')){_0x60d89['limit']=qs[_0x5178('0x2f')](_0x48238c[_0x5178('0x3c')]['limit']);_0x60d89[_0x5178('0x2e')]=qs['offset'](_0x48238c[_0x5178('0x3c')][_0x5178('0x2e')]);}_0x60d89[_0x5178('0x43')]=qs[_0x5178('0x44')](_0x48238c['query']['sort']);_0x60d89[_0x5178('0x45')]=qs[_0x5178('0x3d')](_[_0x5178('0x46')](_0x48238c['query'],_0x1815ef[_0x5178('0x3d')]),_0x193630);if(_0x48238c[_0x5178('0x3c')][_0x5178('0x47')]){_0x60d89['where']=_['merge'](_0x60d89[_0x5178('0x45')],{'$or':_['map'](_0x193630,function(_0x411ee5){if(_0x411ee5[_0x5178('0x39')]!==_0x5178('0x48')){var _0x598f80={};_0x598f80[_0x411ee5[_0x5178('0x35')]]={'$like':'%'+_0x48238c['query'][_0x5178('0x47')]+'%'};return _0x598f80;}})});}_0x60d89=_[_0x5178('0x49')]({},_0x60d89,_0x48238c[_0x5178('0x4a')]);var _0x2e0470={'where':_0x60d89[_0x5178('0x45')]};return db['SmsMessage']['count'](_0x2e0470)[_0x5178('0x21')](function(_0x33131e){_0x5cb5a7[_0x5178('0x2d')]=_0x33131e;if(_0x48238c[_0x5178('0x3c')][_0x5178('0x4b')]){_0x60d89['include']=[{'all':!![]}];}return db[_0x5178('0x4c')][_0x5178('0x4d')](_0x60d89);})[_0x5178('0x21')](function(_0x23f526){_0x5cb5a7[_0x5178('0x4e')]=_0x23f526;return _0x5cb5a7;})[_0x5178('0x21')](respondWithFilteredResult(_0x1d424a,_0x60d89))['catch'](handleError(_0x1d424a,null));};exports[_0x5178('0x4f')]=function(_0x1912a2,_0x2b9589){var _0x304c67={'raw':!![],'where':{'id':_0x1912a2[_0x5178('0x50')]['id']}},_0x24a0e6={};_0x24a0e6[_0x5178('0x3b')]=_[_0x5178('0x51')](db[_0x5178('0x4c')][_0x5178('0x52')]);_0x24a0e6[_0x5178('0x3c')]=_['keys'](_0x1912a2[_0x5178('0x3c')]);_0x24a0e6[_0x5178('0x3d')]=_['intersection'](_0x24a0e6[_0x5178('0x3b')],_0x24a0e6['query']);_0x304c67[_0x5178('0x3f')]=_['intersection'](_0x24a0e6[_0x5178('0x3b')],qs['fields'](_0x1912a2[_0x5178('0x3c')][_0x5178('0x40')]));_0x304c67['attributes']=_0x304c67[_0x5178('0x3f')]['length']?_0x304c67[_0x5178('0x3f')]:_0x24a0e6['model'];if(_0x1912a2[_0x5178('0x3c')][_0x5178('0x4b')]){_0x304c67[_0x5178('0x53')]=[{'all':!![]}];}_0x304c67=_[_0x5178('0x49')]({},_0x304c67,_0x1912a2[_0x5178('0x4a')]);return db[_0x5178('0x4c')][_0x5178('0x54')](_0x304c67)[_0x5178('0x21')](handleEntityNotFound(_0x2b9589,null))[_0x5178('0x21')](respondWithResult(_0x2b9589,null))[_0x5178('0x55')](handleError(_0x2b9589,null));};exports[_0x5178('0x56')]=function(_0x51920e,_0x3a8a3d){return db[_0x5178('0x4c')][_0x5178('0x56')](_0x51920e['body'],{})[_0x5178('0x21')](respondWithResult(_0x3a8a3d,0xc9))[_0x5178('0x55')](handleError(_0x3a8a3d,null));};exports[_0x5178('0x57')]=function(_0x508b44,_0x23ee2f){if(_0x508b44[_0x5178('0x58')]['id']){delete _0x508b44[_0x5178('0x58')]['id'];}return db[_0x5178('0x4c')][_0x5178('0x54')]({'where':{'id':_0x508b44[_0x5178('0x50')]['id']}})[_0x5178('0x21')](handleEntityNotFound(_0x23ee2f,null))[_0x5178('0x21')](saveUpdates(_0x508b44[_0x5178('0x58')],null))[_0x5178('0x21')](respondWithResult(_0x23ee2f,null))[_0x5178('0x55')](handleError(_0x23ee2f,null));};exports['destroy']=function(_0x1aa6f6,_0x627904){return db[_0x5178('0x4c')][_0x5178('0x54')]({'where':{'id':_0x1aa6f6['params']['id']}})[_0x5178('0x21')](handleEntityNotFound(_0x627904,null))[_0x5178('0x21')](removeEntity(_0x627904,null))[_0x5178('0x55')](handleError(_0x627904,null));};exports[_0x5178('0x59')]=function(_0x39d833,_0x359e3c){return db[_0x5178('0x4c')][_0x5178('0x59')]()[_0x5178('0x21')](respondWithResult(_0x359e3c,null))[_0x5178('0x55')](handleError(_0x359e3c,null));};var interaction_log=require(_0x5178('0x14'))('sms-interactions');exports[_0x5178('0x5a')]=function(_0x24ece1,_0x2ab8e1,_0x506311){var _0x16645c={'agent':{},'channel':_0x5178('0x5b')};if(_0x24ece1[_0x5178('0x58')]['id']){delete _0x24ece1[_0x5178('0x58')]['id'];}_0x24ece1[_0x5178('0x58')]['read']=!![];_0x24ece1[_0x5178('0x58')][_0x5178('0x5c')]=moment()[_0x5178('0x5d')](_0x5178('0x5e'));_0x24ece1['body'][_0x5178('0x5f')]=_0x24ece1['body'][_0x5178('0x5f')]||_0x24ece1[_0x5178('0x60')]['id'];_0x16645c[_0x5178('0x61')]['id']=_0x24ece1[_0x5178('0x58')][_0x5178('0x5f')];return db[_0x5178('0x4c')][_0x5178('0x54')]({'where':{'id':_0x24ece1[_0x5178('0x50')]['id'],'UserId':null},'include':[{'model':db[_0x5178('0x62')],'as':_0x5178('0x63')}]})['then'](handleEntityNotFound(_0x2ab8e1,null))[_0x5178('0x21')](saveUpdates(_0x24ece1['body'],null))[_0x5178('0x21')](function(_0x1c2043){if(_0x1c2043){_0x16645c['message']=_0x1c2043[_0x5178('0x64')]({'plain':!![]});return db[_0x5178('0x65')][_0x5178('0x54')]({'where':{'id':_0x1c2043[_0x5178('0x66')]}});}return null;})[_0x5178('0x21')](handleEntityNotFound(_0x2ab8e1,null))[_0x5178('0x21')](function(_0x1ca9da){if(_0x1ca9da){return _0x1ca9da[_0x5178('0x57')]({'UserId':_0x24ece1[_0x5178('0x58')]['UserId'],'read1stAt':_[_0x5178('0x67')](_0x1ca9da[_0x5178('0x68')])?moment()[_0x5178('0x5d')](_0x5178('0x5e')):undefined});}return null;})[_0x5178('0x21')](function(_0x400594){if(_0x400594){_0x16645c[_0x5178('0x69')]=_0x400594[_0x5178('0x64')]({'plain':!![]});interaction_log[_0x5178('0x22')](_0x5178('0x6a'),_0x24ece1[_0x5178('0x60')]['id'],_0x24ece1['user'][_0x5178('0x35')],_0x24ece1[_0x5178('0x60')]['role'],_0x16645c[_0x5178('0x69')]['id'],_0x24ece1[_0x5178('0x58')]?JSON[_0x5178('0x26')](_0x24ece1[_0x5178('0x58')]):_0x5178('0x6b'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x16645c);}return null;})[_0x5178('0x21')](function(_0xf9588f){if(_0xf9588f){if(_0x24ece1[_0x5178('0x58')]['manual']){_0x16645c[_0x5178('0x28')][_0x5178('0x6c')]=util['format'](_0x5178('0x6d'),_0x24ece1[_0x5178('0x60')][_0x5178('0x35')]);_0x16645c[_0x5178('0x28')]['channel']=_0x16645c[_0x5178('0x6e')];_0x16645c[_0x5178('0x28')]['event']=_0x5178('0x5a');return respondWithRpcPromise(_0x5178('0x6f'),_0x5178('0x6f'),{'event':'acceptmessage','message':_0x16645c['message']},client9002)['then'](function(){return _0x16645c;});}return _0x16645c;}return null;})[_0x5178('0x21')](respondWithResult(_0x2ab8e1,null))['catch'](handleError(_0x2ab8e1,null));};var interaction_log=require(_0x5178('0x14'))(_0x5178('0x70'));exports[_0x5178('0x33')]=function(_0x1772d1,_0x47b592,_0x35c97d){var _0x130963={'agent':{},'channel':_0x5178('0x5b')};if(_0x1772d1['body']['id']){delete _0x1772d1[_0x5178('0x58')]['id'];}_0x1772d1['body']['UserId']=_0x1772d1[_0x5178('0x58')][_0x5178('0x5f')]||_0x1772d1[_0x5178('0x60')]['id'];_0x130963['agent']['id']=_0x1772d1[_0x5178('0x58')][_0x5178('0x5f')];return db[_0x5178('0x4c')][_0x5178('0x54')]({'where':{'id':_0x1772d1[_0x5178('0x50')]['id'],'UserId':null}})[_0x5178('0x21')](handleEntityNotFound(_0x47b592,null))[_0x5178('0x21')](function(_0x5729d2){if(_0x5729d2){_0x130963[_0x5178('0x28')]=_0x5729d2[_0x5178('0x64')]({'plain':!![]});return db[_0x5178('0x65')][_0x5178('0x54')]({'where':{'id':_0x5729d2[_0x5178('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x47b592,null))[_0x5178('0x21')](function(_0x146575){if(_0x146575){_0x130963[_0x5178('0x69')]=_0x146575[_0x5178('0x64')]({'plain':!![]});interaction_log[_0x5178('0x22')](_0x5178('0x71'),_0x1772d1['user']['id'],_0x1772d1['user']['name'],_0x1772d1[_0x5178('0x60')]['role'],_0x130963[_0x5178('0x69')]['id'],_0x1772d1[_0x5178('0x58')]?JSON['stringify'](_0x1772d1[_0x5178('0x58')]):'null');return respondWithRpcPromise(_0x5178('0x72'),_0x5178('0x73'),_0x130963);}return null;})[_0x5178('0x21')](function(_0x28655e){if(_0x28655e){_0x28655e[_0x5178('0x28')][_0x5178('0x6c')]=util[_0x5178('0x5d')](_0x5178('0x6d'),_0x1772d1[_0x5178('0x60')][_0x5178('0x35')]);_0x28655e[_0x5178('0x28')][_0x5178('0x6e')]=_0x130963[_0x5178('0x6e')];_0x28655e[_0x5178('0x28')][_0x5178('0x74')]=_0x5178('0x33');respondWithRpcPromise(_0x5178('0x6f'),_0x5178('0x6f'),{'event':_0x5178('0x75'),'message':_0x28655e[_0x5178('0x28')]},client9002);return _0x130963;}return null;})[_0x5178('0x21')](respondWithResult(_0x47b592,null))['catch'](handleError(_0x47b592,null));};exports[_0x5178('0x2b')]=function(_0x154bde,_0x4f29a9,_0x1e8cf0){if(_0x154bde[_0x5178('0x58')]['id']){delete _0x154bde['body']['id'];}var _0x32c1c0;return db['SmsMessage'][_0x5178('0x54')]({'where':{'id':_0x154bde[_0x5178('0x50')]['id']}})[_0x5178('0x21')](handleEntityNotFound(_0x4f29a9,null))[_0x5178('0x21')](function(_0x8d2325){if(_0x8d2325){_0x32c1c0=_0x8d2325;return db[_0x5178('0x76')][_0x5178('0x54')]({'where':{'id':_0x8d2325['SmsAccountId']}});}})[_0x5178('0x21')](handleEntityNotFound(_0x4f29a9,null))[_0x5178('0x21')](function(_0x19b28f){if(_0x19b28f){logger['debug'](_0x5178('0x77'),_0x5178('0x2b'),_0x5178('0x78'),_0x19b28f[_0x5178('0x39')],util['inspect'](_0x154bde[_0x5178('0x58')],{'showHidden':![],'depth':null}));switch(_0x19b28f['type']){case _0x5178('0x79'):if(_0x154bde[_0x5178('0x58')][_0x5178('0x7a')]&&_0x154bde['body'][_0x5178('0x7a')]===_0x32c1c0[_0x5178('0x7b')]){return _0x32c1c0[_0x5178('0x57')]({'read':!![]});}else{logger[_0x5178('0x27')](_0x5178('0x7c'),'status',_0x5178('0x79'),util[_0x5178('0x7d')](_0x154bde[_0x5178('0x58')],{'showHidden':![],'depth':null}));}break;case _0x5178('0x7e'):if(_0x154bde['body'][_0x5178('0x7f')]&&_0x154bde['body']['MessageUUID']===_0x32c1c0[_0x5178('0x7b')]&&_[_0x5178('0x80')]([_0x5178('0x81'),'delivered'],_0x154bde[_0x5178('0x58')]['Status'])>=0x0){return _0x32c1c0[_0x5178('0x57')]({'read':!![]});}else{logger[_0x5178('0x27')](_0x5178('0x7c'),_0x5178('0x2b'),_0x5178('0x82'),util[_0x5178('0x7d')](_0x154bde[_0x5178('0x58')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x23f6b7=_0x154bde[_0x5178('0x58')][_0x5178('0x83')][0x0];if(_0x23f6b7[_0x5178('0x2b')][_0x5178('0x84')]===_0x5178('0x85')){return _0x32c1c0[_0x5178('0x57')]({'read':!![]});}else{logger[_0x5178('0x27')](_0x5178('0x7c'),_0x5178('0x2b'),'infobip',util['inspect'](_0x154bde[_0x5178('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x32c1c0;}})[_0x5178('0x21')](respondWithResult(_0x4f29a9,null))[_0x5178('0x55')](handleError(_0x4f29a9,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 099a49b..49a3bdc 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 _0xec99=['SmsMessage','update','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0xd2e2ab,_0x2440cf){var _0x1703a2=function(_0x23deba){while(--_0x23deba){_0xd2e2ab['push'](_0xd2e2ab['shift']());}};_0x1703a2(++_0x2440cf);}(_0xec99,0x7d));var _0x9ec9=function(_0x4b48af,_0x4ad5b9){_0x4b48af=_0x4b48af-0x0;var _0x64ac44=_0xec99[_0x4b48af];return _0x64ac44;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x9ec9('0x0'))['db'][_0x9ec9('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9ec9('0x2'),'afterDestroy':_0x9ec9('0x3')};function emitEvent(_0x285726){return function(_0x3d55fc,_0x26c3e1,_0x4e6a4d){SmsMessageEvents[_0x9ec9('0x4')](_0x285726+':'+_0x3d55fc['id'],_0x3d55fc);SmsMessageEvents[_0x9ec9('0x4')](_0x285726,_0x3d55fc);_0x4e6a4d(null);};}for(var e in events){if(events[_0x9ec9('0x5')](e)){var event=events[e];SmsMessage[_0x9ec9('0x6')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x45fe=['events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit','exports'];(function(_0x21bc9a,_0x42cefc){var _0x48075d=function(_0x3056be){while(--_0x3056be){_0x21bc9a['push'](_0x21bc9a['shift']());}};_0x48075d(++_0x42cefc);}(_0x45fe,0x7e));var _0xe45f=function(_0x102789,_0x24217f){_0x102789=_0x102789-0x0;var _0x4aeb4f=_0x45fe[_0x102789];return _0x4aeb4f;};'use strict';var EventEmitter=require(_0xe45f('0x0'));var SmsMessage=require(_0xe45f('0x1'))['db'][_0xe45f('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xe45f('0x3')](0x0);var events={'afterCreate':_0xe45f('0x4'),'afterUpdate':_0xe45f('0x5'),'afterDestroy':_0xe45f('0x6')};function emitEvent(_0x61ac5e){return function(_0x8ede2f,_0xffc639,_0x311117){SmsMessageEvents[_0xe45f('0x7')](_0x61ac5e+':'+_0x8ede2f['id'],_0x8ede2f);SmsMessageEvents['emit'](_0x61ac5e,_0x8ede2f);_0x311117(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xe45f('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 8117f7a..ad3f53d 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 _0xa830=['internal_order_id','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','read','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','clickSend','plivo','authId','token','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','csc','crypto','login','timestamp','keys','sort','length','apiKey','createHash','md5','digest','signature=','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','Token\x20not\x20received','finally','utf8mb4_unicode_ci','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','SmsInteractionId','update','createdAt','catch','error','then','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','GET','split','sms','POST','total_sent'];(function(_0x342ff3,_0x256de7){var _0x291cf5=function(_0x8a336){while(--_0x8a336){_0x342ff3['push'](_0x342ff3['shift']());}};_0x291cf5(++_0x256de7);}(_0xa830,0x198));var _0x0a83=function(_0x18f64a,_0x1c8248){_0x18f64a=_0x18f64a-0x0;var _0x44687f=_0xa830[_0x18f64a];return _0x44687f;};'use strict';var _=require(_0x0a83('0x0'));var util=require(_0x0a83('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a83('0x2'));var BPromise=require(_0x0a83('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a83('0x4'));var rimraf=require(_0x0a83('0x5'));var config=require(_0x0a83('0x6'));var attributes=require(_0x0a83('0x7'));module[_0x0a83('0x8')]=function(_0x483839,_0x3664e7){return _0x483839['define'](_0x0a83('0x9'),attributes,{'tableName':_0x0a83('0xa'),'paranoid':![],'indexes':[{'name':_0x0a83('0xb'),'fields':[_0x0a83('0xb')]},{'name':_0x0a83('0xc'),'fields':[_0x0a83('0xd')],'type':_0x0a83('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2461b5,_0x4da291,_0x2d5278){var _0x3bee6a=_0x483839[_0x0a83('0xf')];var _0x28260c=_0x2461b5['get']({'plain':!![]});if(_0x28260c[_0x0a83('0x10')][_0x0a83('0x11')]()==='in'||_0x28260c['direction'][_0x0a83('0x11')]()==='out'&&!_0x28260c[_0x0a83('0x12')]&&!_[_0x0a83('0x13')](_0x28260c[_0x0a83('0x14')])){_0x3bee6a['SmsInteraction']['findOne']({'where':{'id':_0x28260c[_0x0a83('0x15')]}})['then'](function(_0x186a31){if(_0x186a31){_0x186a31[_0x0a83('0x16')]({'lastMsgAt':_0x28260c[_0x0a83('0x17')],'lastMsgDirection':_0x28260c[_0x0a83('0x10')][_0x0a83('0x11')]()});}})[_0x0a83('0x18')](function(_0x5e3a83){console[_0x0a83('0x19')](_0x5e3a83);});}if(_0x28260c[_0x0a83('0x10')]==='out'&&!_0x28260c[_0x0a83('0x12')]){var _0x19ea87;_0x3bee6a['SmsAccount']['find']({'where':{'id':_0x28260c['SmsAccountId']},'raw':!![]})[_0x0a83('0x1a')](function(_0x300fe1){_0x19ea87=_0x300fe1;if(_0x19ea87&&_0x19ea87['type']){switch(_0x19ea87['type']){case _0x0a83('0x1b'):var _0xd49044=require('twilio');if(_0x19ea87[_0x0a83('0x1c')]&&_0x19ea87[_0x0a83('0x1d')]&&_0x19ea87[_0x0a83('0x1e')]){var _0x373144=new _0xd49044(_0x19ea87[_0x0a83('0x1c')],_0x19ea87['authToken']);_0x373144[_0x0a83('0x1f')][_0x0a83('0x20')]({'body':_0x28260c['body'],'to':_0x28260c[_0x0a83('0x1e')],'from':_0x19ea87['phone'],'statusCallback':_0x19ea87[_0x0a83('0x21')]+_0x0a83('0x22')+_0x28260c['id']+_0x0a83('0x23')+_0x19ea87['token']})[_0x0a83('0x1a')](function(_0x404e02){if(_0x404e02[_0x0a83('0x24')]){return _0x2461b5[_0x0a83('0x16')]({'messageId':_0x404e02['sid']});}})[_0x0a83('0x18')](function(_0x58e49c){logger['error'](_0x0a83('0x25'),'afterCreate',_0x0a83('0x1b'),util['inspect'](_0x58e49c,{'showHidden':![],'depth':null}));});}else{logger[_0x0a83('0x19')](_0x0a83('0x25'),_0x0a83('0x26'),'twilio',_0x0a83('0x27'));}break;case _0x0a83('0x28'):var _0x45cf3e=_0x0a83('0x29');if(_0x19ea87['username']&&_0x19ea87[_0x0a83('0x2a')]){var _0x36c210={'recipient':[_0x28260c[_0x0a83('0x1e')]],'message':_0x28260c['body'],'message_type':_0x19ea87[_0x0a83('0x2b')]};if(_0x19ea87[_0x0a83('0x2b')]&&_0x19ea87[_0x0a83('0x2b')]!=='SI'){_0x36c210[_0x0a83('0x2c')]=_0x19ea87[_0x0a83('0x1e')];}var _0x5838e4={'url':_0x45cf3e+_0x0a83('0x2d')+_0x19ea87[_0x0a83('0x2e')]+'&password='+_0x19ea87[_0x0a83('0x2a')],'method':_0x0a83('0x2f')};rp(_0x5838e4)[_0x0a83('0x1a')](function(_0x14d297){var _0x4c5863=_0x14d297[_0x0a83('0x30')](';');var _0x455131={'user_key':_0x4c5863[0x0],'session_key':_0x4c5863[0x1]};_0x5838e4={'url':_0x45cf3e+_0x0a83('0x31'),'method':_0x0a83('0x32'),'headers':{'user_key':_0x455131['user_key'],'Session_key':_0x455131['session_key']},'json':!![],'body':_0x36c210};return rp(_0x5838e4);})[_0x0a83('0x1a')](function(_0x335a1c){if(_0x335a1c[_0x0a83('0x33')]>=0x1){var _0xae8387={'messageId':_0x335a1c[_0x0a83('0x34')]};if(_0x19ea87[_0x0a83('0x2b')]!=='GP'||!_0x19ea87['deliveryReport']){_0xae8387['read']=!![];}return _0x2461b5['update'](_0xae8387);}else{return logger[_0x0a83('0x19')](_0x0a83('0x25'),_0x0a83('0x26'),_0x0a83('0x28'),util[_0x0a83('0x35')](_0x335a1c,{'showHidden':![],'depth':null}));}})['catch'](function(_0x55aedd){return logger[_0x0a83('0x19')](_0x0a83('0x25'),'afterCreate',_0x0a83('0x28'),util[_0x0a83('0x35')](_0x55aedd,{'showHidden':![],'depth':null}));});}else{logger[_0x0a83('0x19')](_0x0a83('0x25'),_0x0a83('0x26'),_0x0a83('0x28'),_0x0a83('0x36'));}break;case _0x0a83('0x37'):if(_0x19ea87[_0x0a83('0x1d')]){var _0x59f360={'recipient':_0x28260c[_0x0a83('0x1e')],'message':_0x28260c[_0x0a83('0xd')],'sender':_0x19ea87[_0x0a83('0x38')]||_0x19ea87[_0x0a83('0x1e')],'authorization':_0x19ea87[_0x0a83('0x1d')]};var _0x4da291={'method':'POST','uri':_0x0a83('0x39'),'body':_0x59f360,'json':!![]};rp(_0x4da291)[_0x0a83('0x1a')](function(_0x5cb46f){var _0x5d2374={'messageId':_0x5cb46f[_0x0a83('0x3a')]};if(!_0x19ea87[_0x0a83('0x3b')]){_0x5d2374[_0x0a83('0x3c')]=!![];}return _0x2461b5[_0x0a83('0x16')](_0x5d2374);})[_0x0a83('0x18')](function(_0x43ac1d){logger[_0x0a83('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0a83('0x37'),util[_0x0a83('0x35')](_0x43ac1d,{'showHidden':![],'depth':null}));});}else{logger[_0x0a83('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0a83('0x26'),'connectel','Missing\x20parameters:\x20authToken');}break;case _0x0a83('0x3d'):if(_0x19ea87[_0x0a83('0x2e')]&&_0x19ea87[_0x0a83('0x2a')]){var _0x59f360={'messages':[{'source':_0x0a83('0x3e'),'to':_0x28260c[_0x0a83('0x1e')],'body':_0x28260c[_0x0a83('0xd')],'from':_0x19ea87[_0x0a83('0x38')]||_0x19ea87['phone']}]};var _0x2b7e85=util[_0x0a83('0x3f')](_0x0a83('0x40'),_0x19ea87['username'],_0x19ea87[_0x0a83('0x2a')]);var _0x4da291={'method':_0x0a83('0x32'),'uri':_0x0a83('0x41'),'body':_0x59f360,'headers':{'Authorization':util[_0x0a83('0x3f')](_0x0a83('0x42'),new Buffer(_0x2b7e85)[_0x0a83('0x43')](_0x0a83('0x44')))},'json':!![]};rp(_0x4da291)[_0x0a83('0x1a')](function(_0x28f110){if(_0x28f110[_0x0a83('0x45')]>=0xc8&&_0x28f110[_0x0a83('0x45')]<=0xce){if(_0x28f110[_0x0a83('0x46')]&&_0x28f110[_0x0a83('0x46')][_0x0a83('0x47')]>0x0){var _0x3574cd=_['head'](_0x28f110[_0x0a83('0x46')]['messages']);var _0xa66f6d={'messageId':_0x3574cd['message_id']};if(!_0x19ea87[_0x0a83('0x3b')]){_0xa66f6d['read']=!![];}return _0x2461b5[_0x0a83('0x16')](_0xa66f6d);}else{logger[_0x0a83('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0a83('0x48'),util[_0x0a83('0x35')](_0x28f110,{'showHidden':![],'depth':null}));}}else{logger[_0x0a83('0x19')](_0x0a83('0x25'),_0x0a83('0x26'),_0x0a83('0x48'),util['inspect'](_0x28f110,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1e3198){logger[_0x0a83('0x19')](_0x0a83('0x25'),_0x0a83('0x26'),'clickSend',util[_0x0a83('0x35')](_0x1e3198,{'showHidden':![],'depth':null}));});}else{logger[_0x0a83('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0a83('0x26'),_0x0a83('0x48'),_0x0a83('0x36'));}break;case _0x0a83('0x49'):if(_0x19ea87[_0x0a83('0x4a')]&&_0x19ea87[_0x0a83('0x1d')]){var _0x59f360={'dst':_0x28260c[_0x0a83('0x1e')],'text':_0x28260c[_0x0a83('0xd')],'src':_0x19ea87['senderString']||_0x19ea87[_0x0a83('0x1e')],'url':_0x19ea87['remote']+'/api/sms/messages/'+_0x28260c['id']+_0x0a83('0x23')+_0x19ea87[_0x0a83('0x4b')]};var _0x2b7e85=util['format'](_0x0a83('0x40'),_0x19ea87[_0x0a83('0x4a')],_0x19ea87[_0x0a83('0x1d')]);var _0x4da291={'method':_0x0a83('0x32'),'uri':util[_0x0a83('0x3f')]('https://api.plivo.com/v1/Account/%s/Message/',_0x19ea87[_0x0a83('0x4a')]),'body':_0x59f360,'headers':{'Authorization':util[_0x0a83('0x3f')](_0x0a83('0x42'),new Buffer(_0x2b7e85)[_0x0a83('0x43')](_0x0a83('0x44')))},'json':!![]};rp(_0x4da291)[_0x0a83('0x1a')](function(_0x15dcfb){var _0x2c8493={'messageId':_0x15dcfb[_0x0a83('0x4c')][0x0]};return _0x2461b5[_0x0a83('0x16')](_0x2c8493);})['catch'](function(_0x241e77){logger[_0x0a83('0x19')](_0x0a83('0x25'),_0x0a83('0x26'),'plivo',util['inspect'](_0x241e77,{'showHidden':![],'depth':null}));});}else{logger[_0x0a83('0x19')](_0x0a83('0x25'),_0x0a83('0x26'),_0x0a83('0x49'),_0x0a83('0x4d'));}break;case'infobip':if(_0x19ea87['username']&&_0x19ea87[_0x0a83('0x2a')]){if(_0x19ea87['baseUrl']){var _0x1d1693={'method':'POST','uri':_0x19ea87[_0x0a83('0x4e')]+_0x0a83('0x4f'),'body':{'username':_0x19ea87[_0x0a83('0x2e')],'password':_0x19ea87[_0x0a83('0x2a')]},'json':!![]};return rp(_0x1d1693)['then'](function(_0x3f3fbc){var _0x1cac9c={'method':_0x0a83('0x32'),'uri':_0x19ea87[_0x0a83('0x4e')]+_0x0a83('0x50'),'body':{'messages':[{'from':_0x19ea87[_0x0a83('0x1e')],'destinations':[{'to':_0x28260c['phone']}],'text':_0x28260c[_0x0a83('0xd')],'notifyUrl':_0x19ea87[_0x0a83('0x21')]+_0x0a83('0x22')+_0x28260c['id']+_0x0a83('0x23')+_0x19ea87[_0x0a83('0x4b')],'notifyContentType':_0x0a83('0x51'),'callbackData':_0x19ea87[_0x0a83('0x1e')]+';'+_0x28260c[_0x0a83('0xd')]}]},'headers':{'Authorization':_0x0a83('0x52')+_0x3f3fbc['token']},'json':!![]};return rp(_0x1cac9c)['then'](function(_0xec9adf){if(_0xec9adf[_0x0a83('0x1f')]){var _0x1e4ce8={'messageId':_0xec9adf[_0x0a83('0x1f')][0x0][_0x0a83('0xb')]};if(!_0x19ea87[_0x0a83('0x3b')]){_0x1e4ce8[_0x0a83('0x3c')]=!![];}return _0x2461b5[_0x0a83('0x16')](_0x1e4ce8);}else{return logger[_0x0a83('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0a83('0x26'),_0x0a83('0x53'),util[_0x0a83('0x35')](_0xec9adf,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x15b46e){return logger[_0x0a83('0x19')](_0x0a83('0x25'),_0x0a83('0x26'),_0x0a83('0x53'),util[_0x0a83('0x35')](_0x15b46e,{'showHidden':![],'depth':null}));});}else{logger[_0x0a83('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0a83('0x26'),_0x0a83('0x53'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x0a83('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip','Missing\x20parameters:\x20username,\x20password');}break;case _0x0a83('0x54'):var _0x5a75ae=require(_0x0a83('0x55'));if(_0x19ea87['apiKey']){var _0x15e78a={};_0x15e78a[_0x0a83('0x56')]=_0x19ea87[_0x0a83('0x2e')];_0x15e78a[_0x0a83('0x1e')]=_0x28260c[_0x0a83('0x1e')];_0x15e78a['sender']=_0x19ea87[_0x0a83('0x1e')];_0x15e78a['text']=_0x28260c[_0x0a83('0xd')];_0x15e78a[_0x0a83('0x57')]=+new Date();var _0x16158b='';var _0x32ebaa='';var _0x40b94e=Object[_0x0a83('0x58')](_0x15e78a);_0x40b94e[_0x0a83('0x59')]();for(var _0x5dab30=0x0;_0x5dab30<_0x40b94e[_0x0a83('0x5a')];_0x5dab30++){if(_0x16158b!=''){_0x16158b+='&';}_0x16158b+=_0x40b94e[_0x5dab30]+'='+encodeURIComponent(_0x15e78a[_0x40b94e[_0x5dab30]]);_0x32ebaa+=_0x15e78a[_0x40b94e[_0x5dab30]];}_0x32ebaa+=_0x19ea87[_0x0a83('0x5b')];_0x32ebaa=_0x5a75ae[_0x0a83('0x5c')](_0x0a83('0x5d'))[_0x0a83('0x16')](_0x32ebaa)[_0x0a83('0x5e')]('hex');if(_0x16158b!==''){_0x16158b+='&';}_0x16158b+=_0x0a83('0x5f')+_0x32ebaa;var _0x5838e4={'method':'GET','uri':_0x19ea87[_0x0a83('0x4e')]+'/external/get/send.php?'+_0x16158b,'json':!![]};return rp(_0x5838e4)[_0x0a83('0x1a')](function(_0x445486){var _0x9dd6ad=Object[_0x0a83('0x58')](_0x445486);if(_0x445486[_0x9dd6ad[0x0]][_0x0a83('0x19')]&&parseInt(_0x445486[_0x9dd6ad[0x0]][_0x0a83('0x19')])===0x0){var _0xa62319={'messageId':_0x445486[_0x9dd6ad[0x0]]['id_sms']};if(!_0x19ea87[_0x0a83('0x3b')]){_0xa62319[_0x0a83('0x3c')]=!![];}return _0x2461b5[_0x0a83('0x16')](_0xa62319);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0a83('0x26'),'csc',util[_0x0a83('0x35')](_0x445486['error'],{'showHidden':![],'depth':null}));}})[_0x0a83('0x18')](function(_0x2f0889){return logger['error'](_0x0a83('0x25'),_0x0a83('0x26'),_0x0a83('0x54'),util[_0x0a83('0x35')](_0x2f0889,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0a83('0x25'),'afterCreate','csc',_0x0a83('0x60'));}break;case _0x0a83('0x61'):if(_0x19ea87['apiKey']){var _0x23f72d={'method':'POST','uri':_0x0a83('0x62'),'headers':{'Authorization':_0x19ea87['apiKey']},'body':{'content':_0x28260c[_0x0a83('0xd')],'to':[_0x28260c[_0x0a83('0x1e')]],'from':_0x19ea87[_0x0a83('0x1e')],'binary':![],'clientMessageId':_0x0a83('0x63'),'charset':'UTF-8'},'json':!![]};rp(_0x23f72d)[_0x0a83('0x1a')](function(_0x3d6bc5){if(!_0x3d6bc5[_0x0a83('0x19')]){var _0x405d10={'messageId':_0x3d6bc5[_0x0a83('0x1f')][0x0][_0x0a83('0x64')]};if(!_0x19ea87['deliveryReport']){_0x405d10[_0x0a83('0x3c')]=!![];}return _0x2461b5[_0x0a83('0x16')](_0x405d10);}else{return logger[_0x0a83('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0a83('0x26'),_0x0a83('0x61'),util[_0x0a83('0x35')](_0x3d6bc5[_0x0a83('0x19')],{'showHidden':![],'depth':null}));}})[_0x0a83('0x18')](function(_0x4cec6f){return logger[_0x0a83('0x19')](_0x0a83('0x25'),'afterCreate','clickatell',util[_0x0a83('0x35')](_0x4cec6f,{'showHidden':![],'depth':null}));});}else{logger[_0x0a83('0x19')](_0x0a83('0x25'),_0x0a83('0x26'),_0x0a83('0x61'),_0x0a83('0x60'));}break;case _0x0a83('0x65'):if(_0x19ea87['username']&&_0x19ea87[_0x0a83('0x2a')]){var _0x2b7e85=util[_0x0a83('0x3f')](_0x0a83('0x40'),_0x19ea87[_0x0a83('0x2e')],_0x19ea87['password']);var _0x4da291={'method':_0x0a83('0x32'),'uri':_0x0a83('0x66')+_0x19ea87[_0x0a83('0x67')]+'/messages','body':{'to':[_0x28260c[_0x0a83('0x1e')]],'text':_0x28260c[_0x0a83('0xd')],'from':_0x19ea87[_0x0a83('0x1e')],'applicationId':_0x19ea87[_0x0a83('0x68')]},'headers':{'Authorization':util[_0x0a83('0x3f')](_0x0a83('0x42'),new Buffer(_0x2b7e85)[_0x0a83('0x43')](_0x0a83('0x44')))},'json':!![]};rp(_0x4da291)['then'](function(_0xf59181){if(_0xf59181['id']){var _0xb992ec={'messageId':_0xf59181['id']};return _0x2461b5[_0x0a83('0x16')](_0xb992ec);}else{logger[_0x0a83('0x19')](_0x0a83('0x25'),'afterCreate','bandwidth',util['inspect'](_0xf59181,{'showHidden':![],'depth':null}));}})[_0x0a83('0x18')](function(_0x492524){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0a83('0x26'),_0x0a83('0x65'),util['inspect'](_0x492524,{'showHidden':![],'depth':null}));});}else{logger[_0x0a83('0x19')](_0x0a83('0x25'),_0x0a83('0x26'),'bandwidth',_0x0a83('0x36'));}break;case _0x0a83('0x69'):if(_0x19ea87[_0x0a83('0x5b')]){var _0x1c5558={};var _0x5838e4={'method':_0x0a83('0x32'),'uri':_0x0a83('0x6a'),'headers':{'Authorization':_0x0a83('0x6b')+_0x19ea87[_0x0a83('0x5b')],'Content-Type':_0x0a83('0x51')},'body':{'from':_0x19ea87[_0x0a83('0x1e')],'to':_0x28260c[_0x0a83('0x1e')],'text':_0x28260c[_0x0a83('0xd')]},'json':!![]};return rp(_0x5838e4)['then'](function(_0x29f85f){if(_0x29f85f[_0x0a83('0x6c')]==0xca){_0x1c5558[_0x0a83('0x6d')]=_0x29f85f;var _0x2df0df={'method':'POST','uri':_0x0a83('0x6e'),'headers':{'Authorization':_0x0a83('0x6b')+_0x19ea87[_0x0a83('0x5b')],'Content-Type':_0x0a83('0x51')},'body':{'refid':_0x1c5558[_0x0a83('0x6d')][_0x0a83('0x6f')]},'json':!![]};return rp(_0x2df0df)[_0x0a83('0x1a')](function(_0x2e96e5){_0x1c5558['status']=_0x2e96e5;var _0x3fa619={'messageId':_0x1c5558['message'][_0x0a83('0x6f')],'read':!![]};return _0x2461b5[_0x0a83('0x16')](_0x3fa619);});}else{return logger[_0x0a83('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0a83('0x26'),_0x0a83('0x69'),util['inspect'](_0x29f85f,{'showHidden':![],'depth':null}));}})[_0x0a83('0x18')](function(_0x5486a9){return logger[_0x0a83('0x19')](_0x0a83('0x25'),'afterCreate',_0x0a83('0x69'),util['inspect'](_0x5486a9,{'showHidden':![],'depth':null}));});}else{return logger[_0x0a83('0x19')](_0x0a83('0x25'),'afterCreate','intelepeer',_0x0a83('0x70'));}break;}}})[_0x0a83('0x71')](function(){_0x2d5278();});}else{_0x2d5278();}}},'charset':'utf8mb4','collate':_0x0a83('0x72')});}; \ No newline at end of file +var _0x7692=['Missing\x20parameters:\x20username,\x20password','connectel','senderString','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','data','queued_count','head','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','application/json','Missing\x20parameters:\x20base_url','csc','apiKey','login','text','sort','createHash','digest','hex','GET','/external/get/send.php?','keys','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','bandwidth','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','refid','intelepeer','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','bluebird','../../config/environment','./smsMessage.attributes','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','SmsInteraction','findOne','then','createdAt','catch','error','SmsAccountId','type','twilio','authToken','phone','accountSid','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','split','sms','POST','user_key','session_key','deliveryReport','read','update'];(function(_0x2adda2,_0x2bc5bc){var _0x48ac05=function(_0x4a72c8){while(--_0x4a72c8){_0x2adda2['push'](_0x2adda2['shift']());}};_0x48ac05(++_0x2bc5bc);}(_0x7692,0xa5));var _0x2769=function(_0x1bdb82,_0x50e7a5){_0x1bdb82=_0x1bdb82-0x0;var _0x11a52b=_0x7692[_0x1bdb82];return _0x11a52b;};'use strict';var _=require(_0x2769('0x0'));var util=require(_0x2769('0x1'));var logger=require(_0x2769('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2769('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2769('0x4'));var attributes=require(_0x2769('0x5'));module['exports']=function(_0x393ba9,_0x5dc93f){return _0x393ba9[_0x2769('0x6')](_0x2769('0x7'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x2769('0x8'),'fields':[_0x2769('0x8')]},{'name':_0x2769('0x9'),'fields':[_0x2769('0xa')],'type':_0x2769('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x158aa5,_0x1afc86,_0x45872d){var _0x428bb9=_0x393ba9[_0x2769('0xc')];var _0x34a41d=_0x158aa5['get']({'plain':!![]});if(_0x34a41d[_0x2769('0xd')][_0x2769('0xe')]()==='in'||_0x34a41d[_0x2769('0xd')][_0x2769('0xe')]()==='out'&&!_0x34a41d[_0x2769('0xf')]&&!_[_0x2769('0x10')](_0x34a41d[_0x2769('0x11')])){_0x428bb9[_0x2769('0x12')][_0x2769('0x13')]({'where':{'id':_0x34a41d['SmsInteractionId']}})[_0x2769('0x14')](function(_0x43ecfe){if(_0x43ecfe){_0x43ecfe['update']({'lastMsgAt':_0x34a41d[_0x2769('0x15')],'lastMsgDirection':_0x34a41d[_0x2769('0xd')]['toLowerCase']()});}})[_0x2769('0x16')](function(_0x590d65){console[_0x2769('0x17')](_0x590d65);});}if(_0x34a41d[_0x2769('0xd')]==='out'&&!_0x34a41d['secret']){var _0x519b2c;_0x428bb9['SmsAccount']['find']({'where':{'id':_0x34a41d[_0x2769('0x18')]},'raw':!![]})[_0x2769('0x14')](function(_0x2f2a0e){_0x519b2c=_0x2f2a0e;if(_0x519b2c&&_0x519b2c[_0x2769('0x19')]){switch(_0x519b2c['type']){case _0x2769('0x1a'):var _0x56650=require(_0x2769('0x1a'));if(_0x519b2c['accountSid']&&_0x519b2c[_0x2769('0x1b')]&&_0x519b2c[_0x2769('0x1c')]){var _0x3ffb69=new _0x56650(_0x519b2c[_0x2769('0x1d')],_0x519b2c[_0x2769('0x1b')]);_0x3ffb69[_0x2769('0x1e')][_0x2769('0x1f')]({'body':_0x34a41d['body'],'to':_0x34a41d[_0x2769('0x1c')],'from':_0x519b2c[_0x2769('0x1c')],'statusCallback':_0x519b2c[_0x2769('0x20')]+_0x2769('0x21')+_0x34a41d['id']+_0x2769('0x22')+_0x519b2c[_0x2769('0x23')]})['then'](function(_0x377410){if(_0x377410['sid']){return _0x158aa5['update']({'messageId':_0x377410[_0x2769('0x24')]});}})[_0x2769('0x16')](function(_0x53a71e){logger[_0x2769('0x17')](_0x2769('0x25'),_0x2769('0x26'),_0x2769('0x1a'),util[_0x2769('0x27')](_0x53a71e,{'showHidden':![],'depth':null}));});}else{logger[_0x2769('0x17')](_0x2769('0x25'),_0x2769('0x26'),'twilio',_0x2769('0x28'));}break;case _0x2769('0x29'):var _0x44ae4f=_0x2769('0x2a');if(_0x519b2c[_0x2769('0x2b')]&&_0x519b2c[_0x2769('0x2c')]){var _0x4fa117={'recipient':[_0x34a41d[_0x2769('0x1c')]],'message':_0x34a41d[_0x2769('0xa')],'message_type':_0x519b2c[_0x2769('0x2d')]};if(_0x519b2c['smsMethod']&&_0x519b2c[_0x2769('0x2d')]!=='SI'){_0x4fa117[_0x2769('0x2e')]=_0x519b2c[_0x2769('0x1c')];}var _0xc64f7b={'url':_0x44ae4f+_0x2769('0x2f')+_0x519b2c[_0x2769('0x2b')]+_0x2769('0x30')+_0x519b2c[_0x2769('0x2c')],'method':'GET'};rp(_0xc64f7b)[_0x2769('0x14')](function(_0x420c69){var _0x5a5fad=_0x420c69[_0x2769('0x31')](';');var _0x367def={'user_key':_0x5a5fad[0x0],'session_key':_0x5a5fad[0x1]};_0xc64f7b={'url':_0x44ae4f+_0x2769('0x32'),'method':_0x2769('0x33'),'headers':{'user_key':_0x367def[_0x2769('0x34')],'Session_key':_0x367def[_0x2769('0x35')]},'json':!![],'body':_0x4fa117};return rp(_0xc64f7b);})['then'](function(_0x3ed6e9){if(_0x3ed6e9['total_sent']>=0x1){var _0x3a5e00={'messageId':_0x3ed6e9['internal_order_id']};if(_0x519b2c[_0x2769('0x2d')]!=='GP'||!_0x519b2c[_0x2769('0x36')]){_0x3a5e00[_0x2769('0x37')]=!![];}return _0x158aa5[_0x2769('0x38')](_0x3a5e00);}else{return logger[_0x2769('0x17')](_0x2769('0x25'),'afterCreate',_0x2769('0x29'),util['inspect'](_0x3ed6e9,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3d6168){return logger[_0x2769('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2769('0x26'),_0x2769('0x29'),util[_0x2769('0x27')](_0x3d6168,{'showHidden':![],'depth':null}));});}else{logger[_0x2769('0x17')](_0x2769('0x25'),_0x2769('0x26'),_0x2769('0x29'),_0x2769('0x39'));}break;case _0x2769('0x3a'):if(_0x519b2c[_0x2769('0x1b')]){var _0x438aed={'recipient':_0x34a41d[_0x2769('0x1c')],'message':_0x34a41d[_0x2769('0xa')],'sender':_0x519b2c[_0x2769('0x3b')]||_0x519b2c[_0x2769('0x1c')],'authorization':_0x519b2c['authToken']};var _0x1afc86={'method':_0x2769('0x33'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x438aed,'json':!![]};rp(_0x1afc86)[_0x2769('0x14')](function(_0x5edfff){var _0xfb69f0={'messageId':_0x5edfff['requestid']};if(!_0x519b2c[_0x2769('0x36')]){_0xfb69f0['read']=!![];}return _0x158aa5[_0x2769('0x38')](_0xfb69f0);})[_0x2769('0x16')](function(_0x70e681){logger['error'](_0x2769('0x25'),_0x2769('0x26'),_0x2769('0x3a'),util[_0x2769('0x27')](_0x70e681,{'showHidden':![],'depth':null}));});}else{logger[_0x2769('0x17')](_0x2769('0x25'),_0x2769('0x26'),'connectel',_0x2769('0x3c'));}break;case _0x2769('0x3d'):if(_0x519b2c['username']&&_0x519b2c[_0x2769('0x2c')]){var _0x438aed={'messages':[{'source':_0x2769('0x3e'),'to':_0x34a41d['phone'],'body':_0x34a41d[_0x2769('0xa')],'from':_0x519b2c[_0x2769('0x3b')]||_0x519b2c[_0x2769('0x1c')]}]};var _0x401250=util[_0x2769('0x3f')](_0x2769('0x40'),_0x519b2c[_0x2769('0x2b')],_0x519b2c['password']);var _0x1afc86={'method':'POST','uri':_0x2769('0x41'),'body':_0x438aed,'headers':{'Authorization':util[_0x2769('0x3f')](_0x2769('0x42'),new Buffer(_0x401250)[_0x2769('0x43')]('base64'))},'json':!![]};rp(_0x1afc86)[_0x2769('0x14')](function(_0x230986){if(_0x230986['http_code']>=0xc8&&_0x230986['http_code']<=0xce){if(_0x230986[_0x2769('0x44')]&&_0x230986[_0x2769('0x44')][_0x2769('0x45')]>0x0){var _0x35208d=_[_0x2769('0x46')](_0x230986[_0x2769('0x44')]['messages']);var _0x3e6d32={'messageId':_0x35208d['message_id']};if(!_0x519b2c[_0x2769('0x36')]){_0x3e6d32[_0x2769('0x37')]=!![];}return _0x158aa5[_0x2769('0x38')](_0x3e6d32);}else{logger[_0x2769('0x17')](_0x2769('0x25'),_0x2769('0x26'),'clickSend',util['inspect'](_0x230986,{'showHidden':![],'depth':null}));}}else{logger[_0x2769('0x17')](_0x2769('0x25'),'afterCreate','clickSend',util[_0x2769('0x27')](_0x230986,{'showHidden':![],'depth':null}));}})[_0x2769('0x16')](function(_0x2095f8){logger[_0x2769('0x17')](_0x2769('0x25'),'afterCreate','clickSend',util['inspect'](_0x2095f8,{'showHidden':![],'depth':null}));});}else{logger[_0x2769('0x17')](_0x2769('0x25'),_0x2769('0x26'),_0x2769('0x47'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x2769('0x48'):if(_0x519b2c['authId']&&_0x519b2c[_0x2769('0x1b')]){var _0x438aed={'dst':_0x34a41d[_0x2769('0x1c')],'text':_0x34a41d[_0x2769('0xa')],'src':_0x519b2c[_0x2769('0x3b')]||_0x519b2c[_0x2769('0x1c')],'url':_0x519b2c[_0x2769('0x20')]+_0x2769('0x21')+_0x34a41d['id']+_0x2769('0x22')+_0x519b2c[_0x2769('0x23')]};var _0x401250=util[_0x2769('0x3f')]('%s:%s',_0x519b2c[_0x2769('0x49')],_0x519b2c['authToken']);var _0x1afc86={'method':_0x2769('0x33'),'uri':util[_0x2769('0x3f')](_0x2769('0x4a'),_0x519b2c[_0x2769('0x49')]),'body':_0x438aed,'headers':{'Authorization':util[_0x2769('0x3f')](_0x2769('0x42'),new Buffer(_0x401250)['toString'](_0x2769('0x4b')))},'json':!![]};rp(_0x1afc86)[_0x2769('0x14')](function(_0x1f82aa){var _0xcf431f={'messageId':_0x1f82aa[_0x2769('0x4c')][0x0]};return _0x158aa5[_0x2769('0x38')](_0xcf431f);})[_0x2769('0x16')](function(_0x4cd4a2){logger[_0x2769('0x17')](_0x2769('0x25'),_0x2769('0x26'),'plivo',util[_0x2769('0x27')](_0x4cd4a2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2769('0x25'),'afterCreate','plivo',_0x2769('0x4d'));}break;case _0x2769('0x4e'):if(_0x519b2c['username']&&_0x519b2c[_0x2769('0x2c')]){if(_0x519b2c[_0x2769('0x4f')]){var _0xcfa552={'method':'POST','uri':_0x519b2c[_0x2769('0x4f')]+'/auth/1/session','body':{'username':_0x519b2c['username'],'password':_0x519b2c[_0x2769('0x2c')]},'json':!![]};return rp(_0xcfa552)[_0x2769('0x14')](function(_0x539da){var _0x1cb889={'method':_0x2769('0x33'),'uri':_0x519b2c[_0x2769('0x4f')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x519b2c[_0x2769('0x1c')],'destinations':[{'to':_0x34a41d['phone']}],'text':_0x34a41d['body'],'notifyUrl':_0x519b2c[_0x2769('0x20')]+_0x2769('0x21')+_0x34a41d['id']+'/status?token='+_0x519b2c['token'],'notifyContentType':_0x2769('0x50'),'callbackData':_0x519b2c[_0x2769('0x1c')]+';'+_0x34a41d['body']}]},'headers':{'Authorization':'IBSSO\x20'+_0x539da[_0x2769('0x23')]},'json':!![]};return rp(_0x1cb889)[_0x2769('0x14')](function(_0x3c7901){if(_0x3c7901[_0x2769('0x1e')]){var _0x5872a2={'messageId':_0x3c7901[_0x2769('0x1e')][0x0][_0x2769('0x8')]};if(!_0x519b2c['deliveryReport']){_0x5872a2[_0x2769('0x37')]=!![];}return _0x158aa5['update'](_0x5872a2);}else{return logger[_0x2769('0x17')](_0x2769('0x25'),_0x2769('0x26'),'infobip',util['inspect'](_0x3c7901,{'showHidden':![],'depth':null}));}});})[_0x2769('0x16')](function(_0x316d2c){return logger[_0x2769('0x17')](_0x2769('0x25'),_0x2769('0x26'),_0x2769('0x4e'),util[_0x2769('0x27')](_0x316d2c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2769('0x25'),_0x2769('0x26'),_0x2769('0x4e'),_0x2769('0x51'));}}else{logger[_0x2769('0x17')](_0x2769('0x25'),_0x2769('0x26'),'infobip','Missing\x20parameters:\x20username,\x20password');}break;case _0x2769('0x52'):var _0x243d2f=require('crypto');if(_0x519b2c[_0x2769('0x53')]){var _0x56742c={};_0x56742c[_0x2769('0x54')]=_0x519b2c[_0x2769('0x2b')];_0x56742c['phone']=_0x34a41d[_0x2769('0x1c')];_0x56742c[_0x2769('0x2e')]=_0x519b2c['phone'];_0x56742c[_0x2769('0x55')]=_0x34a41d[_0x2769('0xa')];_0x56742c['timestamp']=+new Date();var _0xe7a6d9='';var _0x4fd378='';var _0x1ab98d=Object['keys'](_0x56742c);_0x1ab98d[_0x2769('0x56')]();for(var _0x3f33f9=0x0;_0x3f33f9<_0x1ab98d['length'];_0x3f33f9++){if(_0xe7a6d9!=''){_0xe7a6d9+='&';}_0xe7a6d9+=_0x1ab98d[_0x3f33f9]+'='+encodeURIComponent(_0x56742c[_0x1ab98d[_0x3f33f9]]);_0x4fd378+=_0x56742c[_0x1ab98d[_0x3f33f9]];}_0x4fd378+=_0x519b2c['apiKey'];_0x4fd378=_0x243d2f[_0x2769('0x57')]('md5')[_0x2769('0x38')](_0x4fd378)[_0x2769('0x58')](_0x2769('0x59'));if(_0xe7a6d9!==''){_0xe7a6d9+='&';}_0xe7a6d9+='signature='+_0x4fd378;var _0xc64f7b={'method':_0x2769('0x5a'),'uri':_0x519b2c[_0x2769('0x4f')]+_0x2769('0x5b')+_0xe7a6d9,'json':!![]};return rp(_0xc64f7b)['then'](function(_0x379116){var _0x140295=Object[_0x2769('0x5c')](_0x379116);if(_0x379116[_0x140295[0x0]][_0x2769('0x17')]&&parseInt(_0x379116[_0x140295[0x0]][_0x2769('0x17')])===0x0){var _0x15d33a={'messageId':_0x379116[_0x140295[0x0]]['id_sms']};if(!_0x519b2c[_0x2769('0x36')]){_0x15d33a[_0x2769('0x37')]=!![];}return _0x158aa5[_0x2769('0x38')](_0x15d33a);}else{return logger[_0x2769('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2769('0x26'),_0x2769('0x52'),util[_0x2769('0x27')](_0x379116[_0x2769('0x17')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x206938){return logger[_0x2769('0x17')](_0x2769('0x25'),_0x2769('0x26'),_0x2769('0x52'),util[_0x2769('0x27')](_0x206938,{'showHidden':![],'depth':null}));});}else{logger[_0x2769('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2769('0x52'),_0x2769('0x5d'));}break;case'clickatell':if(_0x519b2c['apiKey']){var _0x596676={'method':_0x2769('0x33'),'uri':_0x2769('0x5e'),'headers':{'Authorization':_0x519b2c[_0x2769('0x53')]},'body':{'content':_0x34a41d[_0x2769('0xa')],'to':[_0x34a41d[_0x2769('0x1c')]],'from':_0x519b2c['phone'],'binary':![],'clientMessageId':_0x2769('0x5f'),'charset':_0x2769('0x60')},'json':!![]};rp(_0x596676)[_0x2769('0x14')](function(_0x54eb62){if(!_0x54eb62[_0x2769('0x17')]){var _0x34d493={'messageId':_0x54eb62[_0x2769('0x1e')][0x0][_0x2769('0x61')]};if(!_0x519b2c['deliveryReport']){_0x34d493[_0x2769('0x37')]=!![];}return _0x158aa5[_0x2769('0x38')](_0x34d493);}else{return logger[_0x2769('0x17')](_0x2769('0x25'),_0x2769('0x26'),_0x2769('0x62'),util[_0x2769('0x27')](_0x54eb62[_0x2769('0x17')],{'showHidden':![],'depth':null}));}})[_0x2769('0x16')](function(_0x1aff93){return logger[_0x2769('0x17')](_0x2769('0x25'),_0x2769('0x26'),'clickatell',util[_0x2769('0x27')](_0x1aff93,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2769('0x62'),_0x2769('0x5d'));}break;case'bandwidth':if(_0x519b2c['username']&&_0x519b2c[_0x2769('0x2c')]){var _0x401250=util[_0x2769('0x3f')](_0x2769('0x40'),_0x519b2c['username'],_0x519b2c['password']);var _0x1afc86={'method':'POST','uri':_0x2769('0x63')+_0x519b2c[_0x2769('0x64')]+'/messages','body':{'to':[_0x34a41d['phone']],'text':_0x34a41d[_0x2769('0xa')],'from':_0x519b2c[_0x2769('0x1c')],'applicationId':_0x519b2c[_0x2769('0x65')]},'headers':{'Authorization':util[_0x2769('0x3f')](_0x2769('0x42'),new Buffer(_0x401250)['toString']('base64'))},'json':!![]};rp(_0x1afc86)[_0x2769('0x14')](function(_0x3a303f){if(_0x3a303f['id']){var _0x13adfd={'messageId':_0x3a303f['id']};return _0x158aa5['update'](_0x13adfd);}else{logger[_0x2769('0x17')](_0x2769('0x25'),_0x2769('0x26'),'bandwidth',util[_0x2769('0x27')](_0x3a303f,{'showHidden':![],'depth':null}));}})[_0x2769('0x16')](function(_0x44be5e){logger[_0x2769('0x17')](_0x2769('0x25'),_0x2769('0x26'),_0x2769('0x66'),util[_0x2769('0x27')](_0x44be5e,{'showHidden':![],'depth':null}));});}else{logger[_0x2769('0x17')](_0x2769('0x25'),_0x2769('0x26'),_0x2769('0x66'),_0x2769('0x39'));}break;case'intelepeer':if(_0x519b2c[_0x2769('0x53')]){var _0x264e23={};var _0xc64f7b={'method':_0x2769('0x33'),'uri':_0x2769('0x67'),'headers':{'Authorization':_0x2769('0x68')+_0x519b2c['apiKey'],'Content-Type':'application/json'},'body':{'from':_0x519b2c[_0x2769('0x1c')],'to':_0x34a41d[_0x2769('0x1c')],'text':_0x34a41d['body']},'json':!![]};return rp(_0xc64f7b)['then'](function(_0x5d48e2){if(_0x5d48e2['code']==0xca){_0x264e23[_0x2769('0x69')]=_0x5d48e2;var _0x49c2c4={'method':_0x2769('0x33'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x2769('0x68')+_0x519b2c[_0x2769('0x53')],'Content-Type':_0x2769('0x50')},'body':{'refid':_0x264e23[_0x2769('0x69')]['refid']},'json':!![]};return rp(_0x49c2c4)[_0x2769('0x14')](function(_0x1f84e6){_0x264e23['status']=_0x1f84e6;var _0x14a0ee={'messageId':_0x264e23[_0x2769('0x69')][_0x2769('0x6a')],'read':!![]};return _0x158aa5['update'](_0x14a0ee);});}else{return logger[_0x2769('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2769('0x26'),_0x2769('0x6b'),util[_0x2769('0x27')](_0x5d48e2,{'showHidden':![],'depth':null}));}})['catch'](function(_0xb3c69e){return logger[_0x2769('0x17')](_0x2769('0x25'),'afterCreate','intelepeer',util['inspect'](_0xb3c69e,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x2769('0x25'),_0x2769('0x26'),_0x2769('0x6b'),_0x2769('0x6c'));}break;}}})[_0x2769('0x6d')](function(){_0x45872d();});}else{_0x45872d();}}},'charset':_0x2769('0x6e'),'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 c7418a1..d4bd434 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 _0x3ec2=['info','result','catch','CreateSmsMessage','create','options','debug','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0x3ec2,0xee));var _0x23ec=function(_0x56a86e,_0x51f246){_0x56a86e=_0x56a86e-0x0;var _0x48ae90=_0x3ec2[_0x56a86e];return _0x48ae90;};'use strict';var _=require(_0x23ec('0x0'));var util=require(_0x23ec('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x23ec('0x2'));var db=require(_0x23ec('0x3'))['db'];var utils=require(_0x23ec('0x4'));var logger=require(_0x23ec('0x5'))(_0x23ec('0x6'));var config=require(_0x23ec('0x7'));var jayson=require(_0x23ec('0x8'));var client=jayson[_0x23ec('0x9')][_0x23ec('0xa')]({'port':0x232a});config[_0x23ec('0xb')]=_[_0x23ec('0xc')](config['redis'],{'host':_0x23ec('0xd'),'port':0x18eb});var socket=require(_0x23ec('0xe'))(new Redis(config[_0x23ec('0xb')]));require(_0x23ec('0xf'))[_0x23ec('0x10')](socket);function respondWithRpcPromise(_0x174e02,_0x198de5,_0x584f4f){return new BPromise(function(_0x29986a,_0x1765bc){return client[_0x23ec('0x11')](_0x174e02,_0x584f4f)[_0x23ec('0x12')](function(_0x200031){logger['info']('SmsMessage,\x20%s,\x20%s',_0x198de5,_0x23ec('0x13'));logger['debug'](_0x23ec('0x14'),_0x198de5,_0x23ec('0x13'),JSON[_0x23ec('0x15')](_0x200031));if(_0x200031[_0x23ec('0x16')]){if(_0x200031['error'][_0x23ec('0x17')]===0x1f4){logger[_0x23ec('0x16')](_0x23ec('0x18'),_0x198de5,_0x200031[_0x23ec('0x16')][_0x23ec('0x19')]);return _0x1765bc(_0x200031[_0x23ec('0x16')][_0x23ec('0x19')]);}logger[_0x23ec('0x16')](_0x23ec('0x18'),_0x198de5,_0x200031[_0x23ec('0x16')]['message']);return _0x29986a(_0x200031[_0x23ec('0x16')][_0x23ec('0x19')]);}else{logger[_0x23ec('0x1a')]('SmsMessage,\x20%s,\x20%s',_0x198de5,_0x23ec('0x13'));_0x29986a(_0x200031[_0x23ec('0x1b')][_0x23ec('0x19')]);}})[_0x23ec('0x1c')](function(_0x2ea900){logger[_0x23ec('0x16')](_0x23ec('0x18'),_0x198de5,_0x2ea900);_0x1765bc(_0x2ea900);});});}exports[_0x23ec('0x1d')]=function(_0x548594){var _0x52ae90=this;return new Promise(function(_0x40df90,_0x104cd0){return db['SmsMessage'][_0x23ec('0x1e')](_0x548594['body'],{'raw':_0x548594[_0x23ec('0x1f')]?_0x548594[_0x23ec('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x23ec('0x12')](function(_0x310af6){logger[_0x23ec('0x1a')](_0x23ec('0x1d'),_0x548594);logger[_0x23ec('0x20')](_0x23ec('0x1d'),_0x548594,JSON[_0x23ec('0x15')](_0x310af6));_0x40df90(_0x310af6);})[_0x23ec('0x1c')](function(_0x59480d){logger[_0x23ec('0x16')](_0x23ec('0x1d'),_0x59480d[_0x23ec('0x19')],_0x548594);_0x104cd0(_0x52ae90[_0x23ec('0x16')](0x1f4,_0x59480d[_0x23ec('0x19')]));});});}; \ No newline at end of file +var _0x5aa7=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring'];(function(_0x3ef45e,_0xe84f33){var _0x69e7c=function(_0x43ba11){while(--_0x43ba11){_0x3ef45e['push'](_0x3ef45e['shift']());}};_0x69e7c(++_0xe84f33);}(_0x5aa7,0xdb));var _0x75aa=function(_0x3ff18f,_0x1f92ef){_0x3ff18f=_0x3ff18f-0x0;var _0x1fb014=_0x5aa7[_0x3ff18f];return _0x1fb014;};'use strict';var _=require(_0x75aa('0x0'));var util=require(_0x75aa('0x1'));var moment=require(_0x75aa('0x2'));var BPromise=require(_0x75aa('0x3'));var rs=require(_0x75aa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x75aa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x75aa('0x6'))(_0x75aa('0x7'));var config=require(_0x75aa('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x75aa('0x9')]['http']({'port':0x232a});config[_0x75aa('0xa')]=_[_0x75aa('0xb')](config[_0x75aa('0xa')],{'host':_0x75aa('0xc'),'port':0x18eb});var socket=require(_0x75aa('0xd'))(new Redis(config['redis']));require(_0x75aa('0xe'))[_0x75aa('0xf')](socket);function respondWithRpcPromise(_0x1a0695,_0x29ff1f,_0x434436){return new BPromise(function(_0x473ec8,_0xff58a4){return client[_0x75aa('0x10')](_0x1a0695,_0x434436)['then'](function(_0x4ed7d0){logger[_0x75aa('0x11')](_0x75aa('0x12'),_0x29ff1f,_0x75aa('0x13'));logger[_0x75aa('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x29ff1f,'request\x20sent',JSON[_0x75aa('0x15')](_0x4ed7d0));if(_0x4ed7d0['error']){if(_0x4ed7d0['error'][_0x75aa('0x16')]===0x1f4){logger[_0x75aa('0x17')](_0x75aa('0x12'),_0x29ff1f,_0x4ed7d0[_0x75aa('0x17')][_0x75aa('0x18')]);return _0xff58a4(_0x4ed7d0[_0x75aa('0x17')][_0x75aa('0x18')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x29ff1f,_0x4ed7d0[_0x75aa('0x17')][_0x75aa('0x18')]);return _0x473ec8(_0x4ed7d0[_0x75aa('0x17')][_0x75aa('0x18')]);}else{logger[_0x75aa('0x11')](_0x75aa('0x12'),_0x29ff1f,_0x75aa('0x13'));_0x473ec8(_0x4ed7d0['result'][_0x75aa('0x18')]);}})[_0x75aa('0x19')](function(_0x46bb4a){logger[_0x75aa('0x17')](_0x75aa('0x12'),_0x29ff1f,_0x46bb4a);_0xff58a4(_0x46bb4a);});});}exports[_0x75aa('0x1a')]=function(_0x5b4499){var _0x585365=this;return new Promise(function(_0x50c9fb,_0x497596){return db[_0x75aa('0x1b')][_0x75aa('0x1c')](_0x5b4499[_0x75aa('0x1d')],{'raw':_0x5b4499['options']?_0x5b4499[_0x75aa('0x1e')][_0x75aa('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0xe9aa2c){logger[_0x75aa('0x11')]('CreateSmsMessage',_0x5b4499);logger[_0x75aa('0x14')](_0x75aa('0x1a'),_0x5b4499,JSON[_0x75aa('0x15')](_0xe9aa2c));_0x50c9fb(_0xe9aa2c);})[_0x75aa('0x19')](function(_0x2962f8){logger[_0x75aa('0x17')](_0x75aa('0x1a'),_0x2962f8['message'],_0x5b4499);_0x497596(_0x585365['error'](0x1f4,_0x2962f8['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 2eef5e1..cc319e5 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 _0xd209=['./smsMessage.events','save','update','emit','removeListener','register','length','smsMessage:'];(function(_0x35e75a,_0x5ed225){var _0xb23c7f=function(_0x2fa40c){while(--_0x2fa40c){_0x35e75a['push'](_0x35e75a['shift']());}};_0xb23c7f(++_0x5ed225);}(_0xd209,0xf8));var _0x9d20=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xd209[_0x3a6efd];return _0x487b9a;};'use strict';var SmsMessageEvents=require(_0x9d20('0x0'));var events=[_0x9d20('0x1'),'remove',_0x9d20('0x2')];function createListener(_0x471387,_0x4d96de){return function(_0x40e953){_0x4d96de[_0x9d20('0x3')](_0x471387,_0x40e953);};}function removeListener(_0x4446c5,_0xec3cc8){return function(){SmsMessageEvents[_0x9d20('0x4')](_0x4446c5,_0xec3cc8);};}exports[_0x9d20('0x5')]=function(_0x3a0c0a){for(var _0x26ff8d=0x0,_0x1f9b9d=events[_0x9d20('0x6')];_0x26ff8d<_0x1f9b9d;_0x26ff8d++){var _0x10fa4f=events[_0x26ff8d];var _0x46748f=createListener(_0x9d20('0x7')+_0x10fa4f,_0x3a0c0a);SmsMessageEvents['on'](_0x10fa4f,_0x46748f);}}; \ No newline at end of file +var _0xf30e=['smsMessage:','update','removeListener','register'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf30e,0x121));var _0xef30=function(_0x14a0a0,_0x45d0cf){_0x14a0a0=_0x14a0a0-0x0;var _0x56b651=_0xf30e[_0x14a0a0];return _0x56b651;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save','remove',_0xef30('0x0')];function createListener(_0x1813b1,_0x17fd3a){return function(_0x27e5f9){_0x17fd3a['emit'](_0x1813b1,_0x27e5f9);};}function removeListener(_0x4ab5ef,_0x15db5b){return function(){SmsMessageEvents[_0xef30('0x1')](_0x4ab5ef,_0x15db5b);};}exports[_0xef30('0x2')]=function(_0x2f01db){for(var _0x21a9c3=0x0,_0x37e66e=events['length'];_0x21a9c3<_0x37e66e;_0x21a9c3++){var _0x4858ec=events[_0x21a9c3];var _0x264572=createListener(_0xef30('0x3')+_0x4858ec,_0x2f01db);SmsMessageEvents['on'](_0x4858ec,_0x264572);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 79a2c4e..8fbf76a 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 _0x89fb=['addAgents','put','update','destroy','delete','removeTeams','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','create','post','/:id/teams','addTeams'];(function(_0x13ba18,_0x39041f){var _0x5e292a=function(_0x4f35da){while(--_0x4f35da){_0x13ba18['push'](_0x13ba18['shift']());}};_0x5e292a(++_0x39041f);}(_0x89fb,0x14b));var _0xb89f=function(_0x2a3e29,_0x367135){_0x2a3e29=_0x2a3e29-0x0;var _0x472dca=_0x89fb[_0x2a3e29];return _0x472dca;};'use strict';var multer=require('multer');var util=require(_0xb89f('0x0'));var path=require(_0xb89f('0x1'));var timeout=require(_0xb89f('0x2'));var express=require(_0xb89f('0x3'));var router=express[_0xb89f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb89f('0x5'));var config=require(_0xb89f('0x6'));var controller=require(_0xb89f('0x7'));router[_0xb89f('0x8')]('/',auth[_0xb89f('0x9')](),controller['index']);router[_0xb89f('0x8')]('/describe',auth[_0xb89f('0x9')](),controller['describe']);router[_0xb89f('0x8')](_0xb89f('0xa'),auth[_0xb89f('0x9')](),controller['show']);router[_0xb89f('0x8')](_0xb89f('0xb'),auth[_0xb89f('0x9')](),controller[_0xb89f('0xc')]);router[_0xb89f('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0xb89f('0xd')]);router[_0xb89f('0x8')](_0xb89f('0xe'),auth[_0xb89f('0x9')](),controller[_0xb89f('0xf')]);router['post']('/',auth[_0xb89f('0x9')](),controller[_0xb89f('0x10')]);router[_0xb89f('0x11')](_0xb89f('0x12'),auth[_0xb89f('0x9')](),controller[_0xb89f('0x13')]);router['post'](_0xb89f('0xe'),auth[_0xb89f('0x9')](),controller[_0xb89f('0x14')]);router[_0xb89f('0x15')](_0xb89f('0xa'),auth[_0xb89f('0x9')](),controller[_0xb89f('0x16')]);router['delete'](_0xb89f('0xa'),auth[_0xb89f('0x9')](),controller[_0xb89f('0x17')]);router[_0xb89f('0x18')]('/:id/teams',auth['isAuthenticated'](),controller[_0xb89f('0x19')]);router[_0xb89f('0x18')](_0xb89f('0xe'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xb89f('0x1a')]=router; \ No newline at end of file +var _0x1939=['/:id/members','getMembers','getTeams','/:id/users','post','create','/:id/teams','addTeams','addAgents','put','update','destroy','delete','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','/describe','describe','get','/:id','show'];(function(_0x5ec7ba,_0x51ba2d){var _0x5a9682=function(_0x57b70f){while(--_0x57b70f){_0x5ec7ba['push'](_0x5ec7ba['shift']());}};_0x5a9682(++_0x51ba2d);}(_0x1939,0x1d1));var _0x9193=function(_0x567f0e,_0x2be7a0){_0x567f0e=_0x567f0e-0x0;var _0x15aca8=_0x1939[_0x567f0e];return _0x15aca8;};'use strict';var multer=require(_0x9193('0x0'));var util=require('util');var path=require(_0x9193('0x1'));var timeout=require(_0x9193('0x2'));var express=require(_0x9193('0x3'));var router=express['Router']();var auth=require(_0x9193('0x4'));var interaction=require(_0x9193('0x5'));var config=require(_0x9193('0x6'));var controller=require(_0x9193('0x7'));router['get']('/',auth[_0x9193('0x8')](),controller[_0x9193('0x9')]);router['get'](_0x9193('0xa'),auth[_0x9193('0x8')](),controller[_0x9193('0xb')]);router[_0x9193('0xc')](_0x9193('0xd'),auth['isAuthenticated'](),controller[_0x9193('0xe')]);router[_0x9193('0xc')](_0x9193('0xf'),auth[_0x9193('0x8')](),controller[_0x9193('0x10')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller[_0x9193('0x11')]);router['get'](_0x9193('0x12'),auth[_0x9193('0x8')](),controller['getAgents']);router[_0x9193('0x13')]('/',auth[_0x9193('0x8')](),controller[_0x9193('0x14')]);router[_0x9193('0x13')](_0x9193('0x15'),auth[_0x9193('0x8')](),controller[_0x9193('0x16')]);router[_0x9193('0x13')](_0x9193('0x12'),auth['isAuthenticated'](),controller[_0x9193('0x17')]);router[_0x9193('0x18')](_0x9193('0xd'),auth[_0x9193('0x8')](),controller[_0x9193('0x19')]);router['delete'](_0x9193('0xd'),auth[_0x9193('0x8')](),controller[_0x9193('0x1a')]);router[_0x9193('0x1b')](_0x9193('0x15'),auth[_0x9193('0x8')](),controller[_0x9193('0x1c')]);router['delete'](_0x9193('0x12'),auth[_0x9193('0x8')](),controller[_0x9193('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 2c92097..9a43d58 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 _0x3329=['roundrobin','sequelize','STRING','name','rrmemory','beepall'];(function(_0x43c816,_0x951a48){var _0x418ed3=function(_0x52ebdf){while(--_0x52ebdf){_0x43c816['push'](_0x43c816['shift']());}};_0x418ed3(++_0x951a48);}(_0x3329,0x139));var _0x9332=function(_0x2baaf0,_0x41d3ee){_0x2baaf0=_0x2baaf0-0x0;var _0x13a12e=_0x3329[_0x2baaf0];return _0x13a12e;};'use strict';var Sequelize=require(_0x9332('0x0'));module['exports']={'name':{'type':Sequelize[_0x9332('0x1')],'unique':_0x9332('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x9332('0x3'),_0x9332('0x4'),_0x9332('0x5'))}}; \ No newline at end of file +var _0x52bb=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','name'];(function(_0x25f7ed,_0x14862d){var _0x21b7e9=function(_0x5cb8d4){while(--_0x5cb8d4){_0x25f7ed['push'](_0x25f7ed['shift']());}};_0x21b7e9(++_0x14862d);}(_0x52bb,0x16e));var _0xb52b=function(_0x739126,_0x4256a9){_0x739126=_0x739126-0x0;var _0x45f5cf=_0x52bb[_0x739126];return _0x45f5cf;};'use strict';var Sequelize=require(_0xb52b('0x0'));module[_0xb52b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb52b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb52b('0x3')]},'timeout':{'type':Sequelize[_0xb52b('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb52b('0x5')](_0xb52b('0x6'),_0xb52b('0x7'),_0xb52b('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 5e189af..61e194c 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 _0x3eea=['createdAt','getTeams','addTeams','Team','User','Agents','online','voicePause','interface','flatMap','transaction','forEach','emit','userSmsQueue:save','removeTeams','findAll','ids','field','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','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','register','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','send','index','map','rawAttributes','type','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','SmsQueue','rows','catch','show','params','intersection','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserSmsQueue','fields','SmsQueueId','findAndCountAll','agent','format','%s/%s','SIP','smsPause'];(function(_0x7eaf3b,_0x30447e){var _0x3e6565=function(_0x25d3af){while(--_0x25d3af){_0x7eaf3b['push'](_0x7eaf3b['shift']());}};_0x3e6565(++_0x30447e);}(_0x3eea,0x1ca));var _0xa3ee=function(_0xb0d68e,_0x38758c){_0xb0d68e=_0xb0d68e-0x0;var _0x1f51b8=_0x3eea[_0xb0d68e];return _0x1f51b8;};'use strict';var pdf=require(_0xa3ee('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa3ee('0x1'));var zipdir=require(_0xa3ee('0x2'));var jsonpatch=require(_0xa3ee('0x3'));var rp=require(_0xa3ee('0x4'));var moment=require(_0xa3ee('0x5'));var BPromise=require(_0xa3ee('0x6'));var Mustache=require(_0xa3ee('0x7'));var util=require(_0xa3ee('0x8'));var path=require(_0xa3ee('0x9'));var sox=require(_0xa3ee('0xa'));var csv=require(_0xa3ee('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa3ee('0xc'));var crypto=require('crypto');var jsforce=require(_0xa3ee('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa3ee('0xb'));var querystring=require('querystring');var Papa=require(_0xa3ee('0xe'));var Redis=require('ioredis');var authService=require(_0xa3ee('0xf'));var qs=require(_0xa3ee('0x10'));var as=require(_0xa3ee('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3ee('0x12'))(_0xa3ee('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa3ee('0x14'));var db=require(_0xa3ee('0x15'))['db'];config[_0xa3ee('0x16')]=_[_0xa3ee('0x17')](config['redis'],{'host':_0xa3ee('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa3ee('0x16')]));require(_0xa3ee('0x19'))[_0xa3ee('0x1a')](socket);function respondWithStatusCode(_0x150e20,_0x527c59){_0x527c59=_0x527c59||0xcc;return function(_0x2a82e5){if(_0x2a82e5){return _0x150e20[_0xa3ee('0x1b')](_0x527c59);}return _0x150e20['status'](_0x527c59)['end']();};}function respondWithResult(_0x4b2c66,_0x40decb){_0x40decb=_0x40decb||0xc8;return function(_0x7277cd){if(_0x7277cd){return _0x4b2c66[_0xa3ee('0x1c')](_0x40decb)[_0xa3ee('0x1d')](_0x7277cd);}};}function respondWithFilteredResult(_0x4cc8bb,_0x4735b7){return function(_0x40ffdb){if(_0x40ffdb){var _0x339758=_0x40ffdb[_0xa3ee('0x1e')],_0x299b1e=_0x4735b7[_0xa3ee('0x1f')],_0xfab13e=_0x4735b7[_0xa3ee('0x1f')]+_0x4735b7[_0xa3ee('0x20')],_0x4aac0e;if(_0xfab13e>=_0x339758){_0xfab13e=_0x339758;_0x4aac0e=0xc8;}else{_0x4aac0e=0xce;}_0x4cc8bb[_0xa3ee('0x1c')](_0x4aac0e);return _0x4cc8bb[_0xa3ee('0x21')]('Content-Range',_0x299b1e+'-'+_0xfab13e+'/'+_0x339758)[_0xa3ee('0x1d')](_0x40ffdb);}return null;};}function patchUpdates(_0x446971){return function(_0x4b8445){try{jsonpatch[_0xa3ee('0x22')](_0x4b8445,_0x446971,!![]);}catch(_0x4e7f32){return BPromise[_0xa3ee('0x23')](_0x4e7f32);}return _0x4b8445[_0xa3ee('0x24')]();};}function saveUpdates(_0x1d3022,_0x1bd196){return function(_0x60b899){if(_0x60b899){return _0x60b899[_0xa3ee('0x25')](_0x1d3022)[_0xa3ee('0x26')](function(_0x12108e){return _0x12108e;});}return null;};}function removeEntity(_0x5ae0a1,_0x3aa81d){return function(_0x5b682b){if(_0x5b682b){return _0x5b682b[_0xa3ee('0x27')]()[_0xa3ee('0x26')](function(){var _0x157071=_0x5b682b[_0xa3ee('0x28')]({'plain':!![]});var _0x2c48db='SmsQueues';return db[_0xa3ee('0x29')][_0xa3ee('0x27')]({'where':{'type':_0x2c48db,'resourceId':_0x157071['id']}})[_0xa3ee('0x26')](function(){return _0x5b682b;});})[_0xa3ee('0x26')](function(){_0x5ae0a1[_0xa3ee('0x1c')](0xcc)[_0xa3ee('0x2a')]();});}};}function handleEntityNotFound(_0x443507,_0x30b12b){return function(_0xea54fe){if(!_0xea54fe){_0x443507[_0xa3ee('0x1b')](0x194);}return _0xea54fe;};}function handleError(_0x59c6f9,_0x5ba571){_0x5ba571=_0x5ba571||0x1f4;return function(_0x4abf49){logger[_0xa3ee('0x2b')](_0x4abf49['stack']);if(_0x4abf49[_0xa3ee('0x2c')]){delete _0x4abf49[_0xa3ee('0x2c')];}_0x59c6f9[_0xa3ee('0x1c')](_0x5ba571)[_0xa3ee('0x2d')](_0x4abf49);};}exports[_0xa3ee('0x2e')]=function(_0x14547d,_0x30ba4e){var _0x1dd03b={},_0x120d81={},_0x2cc835={'count':0x0,'rows':[]};var _0x4b717a=_[_0xa3ee('0x2f')](db['SmsQueue'][_0xa3ee('0x30')],function(_0x332d61){return{'name':_0x332d61['fieldName'],'type':_0x332d61[_0xa3ee('0x31')]['key']};});_0x120d81[_0xa3ee('0x32')]=_['map'](_0x4b717a,_0xa3ee('0x2c'));_0x120d81[_0xa3ee('0x33')]=_[_0xa3ee('0x34')](_0x14547d[_0xa3ee('0x33')]);_0x120d81[_0xa3ee('0x35')]=_['intersection'](_0x120d81[_0xa3ee('0x32')],_0x120d81[_0xa3ee('0x33')]);_0x1dd03b[_0xa3ee('0x36')]=_['intersection'](_0x120d81[_0xa3ee('0x32')],qs['fields'](_0x14547d[_0xa3ee('0x33')]['fields']));_0x1dd03b[_0xa3ee('0x36')]=_0x1dd03b['attributes'][_0xa3ee('0x37')]?_0x1dd03b[_0xa3ee('0x36')]:_0x120d81[_0xa3ee('0x32')];if(!_0x14547d[_0xa3ee('0x33')][_0xa3ee('0x38')](_0xa3ee('0x39'))){_0x1dd03b[_0xa3ee('0x20')]=qs[_0xa3ee('0x20')](_0x14547d[_0xa3ee('0x33')][_0xa3ee('0x20')]);_0x1dd03b[_0xa3ee('0x1f')]=qs[_0xa3ee('0x1f')](_0x14547d[_0xa3ee('0x33')]['offset']);}_0x1dd03b[_0xa3ee('0x3a')]=qs[_0xa3ee('0x3b')](_0x14547d[_0xa3ee('0x33')][_0xa3ee('0x3b')]);_0x1dd03b['where']=qs[_0xa3ee('0x35')](_[_0xa3ee('0x3c')](_0x14547d[_0xa3ee('0x33')],_0x120d81['filters']),_0x4b717a);if(_0x14547d[_0xa3ee('0x33')][_0xa3ee('0x3d')]){_0x1dd03b['where']=_[_0xa3ee('0x3e')](_0x1dd03b[_0xa3ee('0x3f')],{'$or':_['map'](_0x4b717a,function(_0x2a8e02){if(_0x2a8e02[_0xa3ee('0x31')]!==_0xa3ee('0x40')){var _0x2c8873={};_0x2c8873[_0x2a8e02[_0xa3ee('0x2c')]]={'$like':'%'+_0x14547d[_0xa3ee('0x33')][_0xa3ee('0x3d')]+'%'};return _0x2c8873;}})});}_0x1dd03b=_[_0xa3ee('0x3e')]({},_0x1dd03b,_0x14547d[_0xa3ee('0x41')]);var _0x2df069={'where':_0x1dd03b[_0xa3ee('0x3f')]};return db['SmsQueue']['count'](_0x2df069)['then'](function(_0x45aeec){_0x2cc835[_0xa3ee('0x1e')]=_0x45aeec;if(_0x14547d['query'][_0xa3ee('0x42')]){_0x1dd03b[_0xa3ee('0x43')]=[{'all':!![]}];}return db[_0xa3ee('0x44')]['findAll'](_0x1dd03b);})[_0xa3ee('0x26')](function(_0x559cc1){_0x2cc835[_0xa3ee('0x45')]=_0x559cc1;return _0x2cc835;})[_0xa3ee('0x26')](respondWithFilteredResult(_0x30ba4e,_0x1dd03b))[_0xa3ee('0x46')](handleError(_0x30ba4e,null));};exports[_0xa3ee('0x47')]=function(_0x1a8535,_0x413b4d){var _0x3dd243={'raw':!![],'where':{'id':_0x1a8535[_0xa3ee('0x48')]['id']}},_0x9875c0={};_0x9875c0[_0xa3ee('0x32')]=_[_0xa3ee('0x34')](db[_0xa3ee('0x44')][_0xa3ee('0x30')]);_0x9875c0[_0xa3ee('0x33')]=_[_0xa3ee('0x34')](_0x1a8535[_0xa3ee('0x33')]);_0x9875c0[_0xa3ee('0x35')]=_[_0xa3ee('0x49')](_0x9875c0['model'],_0x9875c0[_0xa3ee('0x33')]);_0x3dd243[_0xa3ee('0x36')]=_[_0xa3ee('0x49')](_0x9875c0[_0xa3ee('0x32')],qs['fields'](_0x1a8535[_0xa3ee('0x33')]['fields']));_0x3dd243[_0xa3ee('0x36')]=_0x3dd243[_0xa3ee('0x36')][_0xa3ee('0x37')]?_0x3dd243[_0xa3ee('0x36')]:_0x9875c0[_0xa3ee('0x32')];if(_0x1a8535[_0xa3ee('0x33')][_0xa3ee('0x42')]){_0x3dd243[_0xa3ee('0x43')]=[{'all':!![]}];}_0x3dd243=_[_0xa3ee('0x3e')]({},_0x3dd243,_0x1a8535[_0xa3ee('0x41')]);return db['SmsQueue'][_0xa3ee('0x4a')](_0x3dd243)['then'](handleEntityNotFound(_0x413b4d,null))['then'](respondWithResult(_0x413b4d,null))[_0xa3ee('0x46')](handleError(_0x413b4d,null));};exports[_0xa3ee('0x4b')]=function(_0x45029f,_0x1ec479){return db[_0xa3ee('0x44')][_0xa3ee('0x4b')](_0x45029f[_0xa3ee('0x4c')],{})['then'](function(_0x2d67f7){var _0x3ba287=_0x45029f['user'][_0xa3ee('0x28')]({'plain':!![]});if(!_0x3ba287)throw new Error(_0xa3ee('0x4d'));if(_0x3ba287[_0xa3ee('0x4e')]==='user'){var _0x587a1a=_0x2d67f7[_0xa3ee('0x28')]({'plain':!![]});var _0x345b5b=_0xa3ee('0x4f');return db[_0xa3ee('0x50')][_0xa3ee('0x4a')]({'where':{'name':_0x345b5b,'userProfileId':_0x3ba287['userProfileId']},'raw':!![]})['then'](function(_0x15b55e){if(_0x15b55e&&_0x15b55e[_0xa3ee('0x51')]===0x0){return db['UserProfileResource'][_0xa3ee('0x4b')]({'name':_0x587a1a[_0xa3ee('0x2c')],'resourceId':_0x587a1a['id'],'type':_0x15b55e[_0xa3ee('0x2c')],'sectionId':_0x15b55e['id']},{})['then'](function(){return _0x2d67f7;});}else{return _0x2d67f7;}})['catch'](function(_0x2388f7){logger['error'](_0xa3ee('0x52'),_0x2388f7);throw _0x2388f7;});}return _0x2d67f7;})[_0xa3ee('0x26')](respondWithResult(_0x1ec479,0xc9))['catch'](handleError(_0x1ec479,null));};exports[_0xa3ee('0x25')]=function(_0xf7b378,_0x25e34d){if(_0xf7b378['body']['id']){delete _0xf7b378[_0xa3ee('0x4c')]['id'];}return db[_0xa3ee('0x44')]['find']({'where':{'id':_0xf7b378[_0xa3ee('0x48')]['id']}})[_0xa3ee('0x26')](handleEntityNotFound(_0x25e34d,null))[_0xa3ee('0x26')](saveUpdates(_0xf7b378['body'],null))['then'](respondWithResult(_0x25e34d,null))[_0xa3ee('0x46')](handleError(_0x25e34d,null));};exports[_0xa3ee('0x27')]=function(_0x4a1a2f,_0x1f9913){return db[_0xa3ee('0x44')]['find']({'where':{'id':_0x4a1a2f['params']['id']}})[_0xa3ee('0x26')](handleEntityNotFound(_0x1f9913,null))[_0xa3ee('0x26')](removeEntity(_0x1f9913,null))[_0xa3ee('0x46')](handleError(_0x1f9913,null));};exports['describe']=function(_0x11fb6e,_0x1f401d){return db[_0xa3ee('0x44')][_0xa3ee('0x53')]()[_0xa3ee('0x26')](respondWithResult(_0x1f401d,null))[_0xa3ee('0x46')](handleError(_0x1f401d,null));};exports['getMembers']=function(_0x10f508,_0x2517ec,_0x4d09b4){var _0x374e1d={'raw':!![],'where':{}},_0x41536a={},_0x19fb7e;return db[_0xa3ee('0x44')][_0xa3ee('0x54')]({'where':{'id':_0x10f508[_0xa3ee('0x48')]['id']}})['then'](handleEntityNotFound(_0x2517ec,null))[_0xa3ee('0x26')](function(_0x17d06d){if(_0x17d06d){_0x19fb7e=_0x17d06d[_0xa3ee('0x28')]({'plain':!![]});_0x41536a['model']=_[_0xa3ee('0x34')](db[_0xa3ee('0x55')]['rawAttributes']);_0x41536a['query']=_['keys'](_0x10f508['query']);_0x41536a[_0xa3ee('0x35')]=_[_0xa3ee('0x49')](_0x41536a[_0xa3ee('0x32')],_0x41536a[_0xa3ee('0x33')]);_0x374e1d[_0xa3ee('0x36')]=_[_0xa3ee('0x49')](_0x41536a[_0xa3ee('0x32')],qs['fields'](_0x10f508[_0xa3ee('0x33')][_0xa3ee('0x56')]));_0x374e1d[_0xa3ee('0x36')]=_0x374e1d[_0xa3ee('0x36')][_0xa3ee('0x37')]?_0x374e1d['attributes']:_0x41536a['model'];if(!_0x10f508[_0xa3ee('0x33')][_0xa3ee('0x38')](_0xa3ee('0x39'))){_0x374e1d[_0xa3ee('0x20')]=qs[_0xa3ee('0x20')](_0x10f508[_0xa3ee('0x33')][_0xa3ee('0x20')]);_0x374e1d[_0xa3ee('0x1f')]=qs[_0xa3ee('0x1f')](_0x10f508[_0xa3ee('0x33')][_0xa3ee('0x1f')]);}_0x374e1d[_0xa3ee('0x3a')]=qs[_0xa3ee('0x3b')](_0x10f508[_0xa3ee('0x33')][_0xa3ee('0x3b')]);_0x374e1d['where']=qs[_0xa3ee('0x35')](_['pick'](_0x10f508['query'],_0x41536a[_0xa3ee('0x35')]));_0x374e1d['where'][_0xa3ee('0x57')]=_0x17d06d['id'];if(_0x10f508[_0xa3ee('0x33')][_0xa3ee('0x3d')]){_0x374e1d[_0xa3ee('0x3f')]=_['merge'](_0x374e1d[_0xa3ee('0x3f')],{'$or':_[_0xa3ee('0x2f')](_0x374e1d[_0xa3ee('0x36')],function(_0x370e3e){var _0x479123={};_0x479123[_0x370e3e]={'$like':'%'+_0x10f508[_0xa3ee('0x33')][_0xa3ee('0x3d')]+'%'};return _0x479123;})});}_0x374e1d=_['merge']({},_0x374e1d,_0x10f508[_0xa3ee('0x41')]);return db['UserSmsQueue']['findAll'](_0x374e1d);}})[_0xa3ee('0x26')](function(_0x4870a3){if(_0x4870a3){return db['User'][_0xa3ee('0x58')]({'where':{'id':_['map'](_0x4870a3,'UserId'),'role':_0xa3ee('0x59')},'attributes':['id',_0xa3ee('0x2c'),'smsPause','updatedAt','createdAt']});}})[_0xa3ee('0x26')](function(_0x133e58){if(_0x133e58){return{'count':_0x133e58[_0xa3ee('0x1e')],'rows':_[_0xa3ee('0x2f')](_0x133e58[_0xa3ee('0x45')],function(_0x1b7ff6){return{'membername':_0x1b7ff6['name'],'UserId':_0x1b7ff6['id'],'queue_name':_0x19fb7e['name'],'SmsQueueId':_0x19fb7e['id'],'interface':util[_0xa3ee('0x5a')](_0xa3ee('0x5b'),_0xa3ee('0x5c'),_0x1b7ff6['name']),'penalty':0x0,'paused':_0x1b7ff6[_0xa3ee('0x5d')],'createdAt':_0x1b7ff6[_0xa3ee('0x5e')],'updatedAt':_0x1b7ff6['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa3ee('0x26')](respondWithFilteredResult(_0x2517ec,_0x374e1d))[_0xa3ee('0x46')](handleError(_0x2517ec,null));};exports[_0xa3ee('0x5f')]=function(_0x2ad745,_0x117c3e,_0x58a7db){var _0x39c495={};var _0x432b8a={};var _0x9d9915;var _0x37e1c2;return db[_0xa3ee('0x44')][_0xa3ee('0x54')]({'where':{'id':_0x2ad745[_0xa3ee('0x48')]['id']}})[_0xa3ee('0x26')](handleEntityNotFound(_0x117c3e,null))[_0xa3ee('0x26')](function(_0x5e51fa){if(_0x5e51fa){_0x9d9915=_0x5e51fa;_0x432b8a['model']=_[_0xa3ee('0x34')](db['Team'][_0xa3ee('0x30')]);_0x432b8a[_0xa3ee('0x33')]=_[_0xa3ee('0x34')](_0x2ad745[_0xa3ee('0x33')]);_0x432b8a['filters']=_[_0xa3ee('0x49')](_0x432b8a[_0xa3ee('0x32')],_0x432b8a[_0xa3ee('0x33')]);_0x39c495[_0xa3ee('0x36')]=_[_0xa3ee('0x49')](_0x432b8a['model'],qs[_0xa3ee('0x56')](_0x2ad745[_0xa3ee('0x33')][_0xa3ee('0x56')]));_0x39c495['attributes']=_0x39c495[_0xa3ee('0x36')]['length']?_0x39c495[_0xa3ee('0x36')]:_0x432b8a['model'];_0x39c495[_0xa3ee('0x3a')]=qs[_0xa3ee('0x3b')](_0x2ad745[_0xa3ee('0x33')][_0xa3ee('0x3b')]);_0x39c495['where']=qs[_0xa3ee('0x35')](_[_0xa3ee('0x3c')](_0x2ad745['query'],_0x432b8a[_0xa3ee('0x35')]));if(_0x2ad745[_0xa3ee('0x33')][_0xa3ee('0x3d')]){_0x39c495[_0xa3ee('0x3f')]=_[_0xa3ee('0x3e')](_0x39c495['where'],{'$or':_[_0xa3ee('0x2f')](_0x39c495[_0xa3ee('0x36')],function(_0x55a6b7){var _0x2535ef={};_0x2535ef[_0x55a6b7]={'$like':'%'+_0x2ad745[_0xa3ee('0x33')][_0xa3ee('0x3d')]+'%'};return _0x2535ef;})});}_0x39c495=_[_0xa3ee('0x3e')]({},_0x39c495,_0x2ad745[_0xa3ee('0x41')]);return _0x9d9915[_0xa3ee('0x5f')](_0x39c495);}})[_0xa3ee('0x26')](function(_0x329e32){if(_0x329e32){_0x37e1c2=_0x329e32[_0xa3ee('0x37')];if(!_0x2ad745[_0xa3ee('0x33')]['hasOwnProperty'](_0xa3ee('0x39'))){_0x39c495[_0xa3ee('0x20')]=qs[_0xa3ee('0x20')](_0x2ad745['query'][_0xa3ee('0x20')]);_0x39c495['offset']=qs[_0xa3ee('0x1f')](_0x2ad745[_0xa3ee('0x33')]['offset']);}return _0x9d9915[_0xa3ee('0x5f')](_0x39c495);}})[_0xa3ee('0x26')](function(_0x55a333){if(_0x55a333){return _0x55a333?{'count':_0x37e1c2,'rows':_0x55a333}:null;}})[_0xa3ee('0x26')](respondWithResult(_0x117c3e,null))[_0xa3ee('0x46')](handleError(_0x117c3e,null));};exports[_0xa3ee('0x60')]=function(_0x27cf3f,_0xc43c3,_0x3395b8){var _0x4c6a41=_0x27cf3f['body']['ids'];return db[_0xa3ee('0x61')]['findAll']({'where':{'id':_0x4c6a41},'attributes':['id'],'include':[{'model':db[_0xa3ee('0x62')],'as':_0xa3ee('0x63'),'attributes':['id',_0xa3ee('0x2c'),_0xa3ee('0x64'),_0xa3ee('0x65'),_0xa3ee('0x66')],'raw':!![]}]})[_0xa3ee('0x26')](function(_0xea3d66){if(_0xea3d66){var _0x473bfc=_[_0xa3ee('0x67')](_0xea3d66,function(_0x1787bc){var _0x98482f=_0x1787bc[_0xa3ee('0x28')]({'plain':!![]});return _0x98482f[_0xa3ee('0x63')];});return db[_0xa3ee('0x44')][_0xa3ee('0x4a')]({'where':{'id':_0x27cf3f[_0xa3ee('0x48')]['id']}})[_0xa3ee('0x26')](function(_0x229832){return db['sequelize'][_0xa3ee('0x68')](function(_0x42cff2){return _0x229832[_0xa3ee('0x60')](_0x4c6a41,{'transaction':_0x42cff2})['then'](function(){return BPromise['each'](_0x473bfc,function(_0xc83f50){return db[_0xa3ee('0x55')]['findOrCreate']({'where':{'UserId':_0xc83f50['id'],'SmsQueueId':_0x27cf3f['params']['id']},'transaction':_0x42cff2});});})[_0xa3ee('0x26')](function(){_0x473bfc[_0xa3ee('0x69')](function(_0x212ed0){socket[_0xa3ee('0x6a')](_0xa3ee('0x6b'),{'UserId':_0x212ed0['id'],'SmsQueueId':_0x229832['id']});});});});});}})[_0xa3ee('0x26')](respondWithStatusCode(_0xc43c3,null))[_0xa3ee('0x46')](handleError(_0xc43c3,null));};exports[_0xa3ee('0x6c')]=function(_0x34ab5b,_0x3e6657,_0x312e28){return db[_0xa3ee('0x61')][_0xa3ee('0x6d')]({'where':{'id':_0x34ab5b['query'][_0xa3ee('0x6e')]},'attributes':['id'],'include':[{'model':db[_0xa3ee('0x62')],'as':_0xa3ee('0x63'),'attributes':['id'],'raw':!![]}]})[_0xa3ee('0x26')](handleEntityNotFound(_0x3e6657,null))[_0xa3ee('0x26')](function(_0x31475a){var _0x4cc5e5=_['map'](_0x31475a,'id');var _0x1f9fda=[];var _0x3bbaa0=[];var _0xdc8b7a=squel['select']();_0xdc8b7a[_0xa3ee('0x6f')]('tq.TeamId')[_0xa3ee('0x70')](_0xa3ee('0x71'),'tq')[_0xa3ee('0x72')](_0xa3ee('0x73'),'ut',_0xa3ee('0x74'))[_0xa3ee('0x3f')](_0xa3ee('0x75'),_0x34ab5b[_0xa3ee('0x48')]['id']);for(var _0x116de1=0x0;_0x116de1<_0x31475a[_0xa3ee('0x37')];_0x116de1+=0x1){let _0x5bdca6=_0x31475a[_0x116de1];for(var _0x4f50df=0x0;_0x4f50df<_0x5bdca6['Agents'][_0xa3ee('0x37')];_0x4f50df+=0x1){let _0x51c231=_0x5bdca6[_0xa3ee('0x63')][_0x4f50df];var _0x2c1261=_0xdc8b7a[_0xa3ee('0x76')]();_0x2c1261[_0xa3ee('0x3f')](_0xa3ee('0x77'),_0x51c231['id']);_0x3bbaa0[_0xa3ee('0x78')](db[_0xa3ee('0x79')][_0xa3ee('0x33')](_0x2c1261[_0xa3ee('0x7a')](),{'type':db['sequelize']['QueryTypes'][_0xa3ee('0x7b')]})[_0xa3ee('0x26')](function(_0x2c4959){if(_0x2c4959[_0xa3ee('0x37')]===0x1){return _0x51c231['id'];}else{var _0x119f26=_[_0xa3ee('0x7c')](_['map'](_0x2c4959,_0xa3ee('0x7d')),function(_0x390006){return _[_0xa3ee('0x7e')](_0x4cc5e5,_0x390006);});if(_0x119f26){return _0x51c231['id'];}}}));}}return BPromise[_0xa3ee('0x7f')](_0x3bbaa0)[_0xa3ee('0x26')](function(_0x1d01fc){_0x1f9fda=_(_0x1f9fda)[_0xa3ee('0x80')](_0x1d01fc)[_0xa3ee('0x81')]()[_0xa3ee('0x82')]();return db[_0xa3ee('0x44')]['find']({'where':{'id':_0x34ab5b[_0xa3ee('0x48')]['id']}})[_0xa3ee('0x26')](function(_0x40fa1a){return db[_0xa3ee('0x79')][_0xa3ee('0x68')](function(_0x156541){return _0x40fa1a['removeTeams'](_0x34ab5b['query']['ids'],{'transaction':_0x156541})['then'](function(){if(!_['isEmpty'](_0x1f9fda)){return _0x40fa1a[_0xa3ee('0x83')](_0x1f9fda,{'transaction':_0x156541});}})['then'](function(){_0x1f9fda[_0xa3ee('0x69')](function(_0x550f98){socket[_0xa3ee('0x6a')](_0xa3ee('0x84'),{'UserId':_0x550f98,'SmsQueueId':_0x40fa1a['id']});});});});});});})[_0xa3ee('0x26')](respondWithStatusCode(_0x3e6657,null))[_0xa3ee('0x46')](handleError(_0x3e6657,null));};exports[_0xa3ee('0x85')]=function(_0x20e97f,_0x151bc2,_0x8169ec){return db[_0xa3ee('0x44')][_0xa3ee('0x4a')]({'where':{'id':_0x20e97f[_0xa3ee('0x48')]['id']}})[_0xa3ee('0x26')](handleEntityNotFound(_0x151bc2,null))['then'](function(_0xe93682){if(_0xe93682){return _0xe93682[_0xa3ee('0x85')](_0x20e97f[_0xa3ee('0x4c')][_0xa3ee('0x6e')],_[_0xa3ee('0x86')](_0x20e97f[_0xa3ee('0x4c')],[_0xa3ee('0x6e'),'id'])||{})[_0xa3ee('0x87')](function(_0x241870){for(var _0x31c6d7=0x0;_0x31c6d7<_0x20e97f[_0xa3ee('0x4c')][_0xa3ee('0x6e')][_0xa3ee('0x37')];_0x31c6d7+=0x1){socket[_0xa3ee('0x6a')](_0xa3ee('0x6b'),{'UserId':_0x20e97f[_0xa3ee('0x4c')]['ids'][_0x31c6d7],'SmsQueueId':_0x20e97f['params']['id']});}return _0x241870;});}})['then'](respondWithResult(_0x151bc2,null))[_0xa3ee('0x46')](handleError(_0x151bc2,null));};exports['removeAgents']=function(_0x3f91f8,_0x11c0ce,_0x27c19d){return db[_0xa3ee('0x44')][_0xa3ee('0x4a')]({'where':{'id':_0x3f91f8[_0xa3ee('0x48')]['id']}})[_0xa3ee('0x26')](handleEntityNotFound(_0x11c0ce,null))[_0xa3ee('0x26')](function(_0x75e9db){if(_0x75e9db){return _0x75e9db[_0xa3ee('0x83')](_0x3f91f8['query'][_0xa3ee('0x6e')])[_0xa3ee('0x26')](function(){if(_[_0xa3ee('0x88')](_0x3f91f8['query'][_0xa3ee('0x6e')])){for(var _0x15ec1f=0x0;_0x15ec1f<_0x3f91f8['query'][_0xa3ee('0x6e')][_0xa3ee('0x37')];_0x15ec1f+=0x1){socket['emit'](_0xa3ee('0x84'),{'UserId':Number(_0x3f91f8['query'][_0xa3ee('0x6e')][_0x15ec1f]),'SmsQueueId':Number(_0x3f91f8[_0xa3ee('0x48')]['id'])});}}else{socket['emit'](_0xa3ee('0x84'),{'UserId':Number(_0x3f91f8['query'][_0xa3ee('0x6e')]),'SmsQueueId':Number(_0x3f91f8[_0xa3ee('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x11c0ce,null))[_0xa3ee('0x46')](handleError(_0x11c0ce,null));};exports[_0xa3ee('0x89')]=function(_0x2fd26d,_0x25ff19,_0x426e4c){var _0x58b19a={};var _0x56b103={};var _0x49b0fe;var _0x384f1b;return db[_0xa3ee('0x44')][_0xa3ee('0x54')]({'where':{'id':_0x2fd26d['params']['id']}})[_0xa3ee('0x26')](handleEntityNotFound(_0x25ff19,null))[_0xa3ee('0x26')](function(_0x1a76c1){if(_0x1a76c1){_0x49b0fe=_0x1a76c1;_0x56b103[_0xa3ee('0x32')]=_['keys'](db['User'][_0xa3ee('0x30')]);_0x56b103['query']=_[_0xa3ee('0x34')](_0x2fd26d[_0xa3ee('0x33')]);_0x56b103[_0xa3ee('0x35')]=_[_0xa3ee('0x49')](_0x56b103[_0xa3ee('0x32')],_0x56b103[_0xa3ee('0x33')]);_0x58b19a[_0xa3ee('0x36')]=_[_0xa3ee('0x49')](_0x56b103[_0xa3ee('0x32')],qs[_0xa3ee('0x56')](_0x2fd26d[_0xa3ee('0x33')][_0xa3ee('0x56')]));_0x58b19a[_0xa3ee('0x36')]=_0x58b19a[_0xa3ee('0x36')][_0xa3ee('0x37')]?_0x58b19a[_0xa3ee('0x36')]:_0x56b103[_0xa3ee('0x32')];_0x58b19a['order']=qs[_0xa3ee('0x3b')](_0x2fd26d[_0xa3ee('0x33')][_0xa3ee('0x3b')]);_0x58b19a['where']=qs[_0xa3ee('0x35')](_[_0xa3ee('0x3c')](_0x2fd26d['query'],_0x56b103['filters']));if(_0x2fd26d[_0xa3ee('0x33')][_0xa3ee('0x3d')]){_0x58b19a['where']=_['merge'](_0x58b19a['where'],{'$or':_['map'](_0x58b19a[_0xa3ee('0x36')],function(_0x29a88c){var _0x2afc1f={};_0x2afc1f[_0x29a88c]={'$like':'%'+_0x2fd26d[_0xa3ee('0x33')][_0xa3ee('0x3d')]+'%'};return _0x2afc1f;})});}_0x58b19a=_[_0xa3ee('0x3e')]({},_0x58b19a,_0x2fd26d[_0xa3ee('0x41')]);return _0x49b0fe[_0xa3ee('0x89')](_0x58b19a);}})[_0xa3ee('0x26')](function(_0x2d5fe9){if(_0x2d5fe9){_0x384f1b=_0x2d5fe9[_0xa3ee('0x37')];if(!_0x2fd26d[_0xa3ee('0x33')][_0xa3ee('0x38')](_0xa3ee('0x39'))){_0x58b19a[_0xa3ee('0x20')]=qs[_0xa3ee('0x20')](_0x2fd26d['query'][_0xa3ee('0x20')]);_0x58b19a[_0xa3ee('0x1f')]=qs[_0xa3ee('0x1f')](_0x2fd26d[_0xa3ee('0x33')]['offset']);}return _0x49b0fe[_0xa3ee('0x89')](_0x58b19a);}})[_0xa3ee('0x26')](function(_0x470c46){if(_0x470c46){return _0x470c46?{'count':_0x384f1b,'rows':_0x470c46}:null;}})[_0xa3ee('0x26')](respondWithResult(_0x25ff19,null))[_0xa3ee('0x46')](handleError(_0x25ff19,null));}; \ No newline at end of file +var _0x04de=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','then','get','SmsQueues','destroy','stack','name','send','index','SmsQueue','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','filters','pick','where','merge','type','filter','options','includeAll','findAll','rows','catch','show','include','find','create','body','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserSmsQueue','length','order','sort','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','createdAt','%s/%s','SIP','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','removeTeams','ids','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','userSmsQueue:remove','addAgents','spread','emit','userSmsQueue:save','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x04de,0x107));var _0xe04d=function(_0x48b40f,_0x3be506){_0x48b40f=_0x48b40f-0x0;var _0x193de7=_0x04de[_0x48b40f];return _0x193de7;};'use strict';var pdf=require(_0xe04d('0x0'));var emlformat=require(_0xe04d('0x1'));var rimraf=require(_0xe04d('0x2'));var zipdir=require(_0xe04d('0x3'));var jsonpatch=require(_0xe04d('0x4'));var rp=require(_0xe04d('0x5'));var moment=require(_0xe04d('0x6'));var BPromise=require(_0xe04d('0x7'));var Mustache=require(_0xe04d('0x8'));var util=require(_0xe04d('0x9'));var path=require(_0xe04d('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xe04d('0xb'));var crypto=require(_0xe04d('0xc'));var jsforce=require(_0xe04d('0xd'));var deskjs=require(_0xe04d('0xe'));var toCsv=require(_0xe04d('0xf'));var querystring=require(_0xe04d('0x10'));var Papa=require(_0xe04d('0x11'));var Redis=require(_0xe04d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe04d('0x13'));var as=require(_0xe04d('0x14'));var hardwareService=require(_0xe04d('0x15'));var logger=require(_0xe04d('0x16'))(_0xe04d('0x17'));var utils=require(_0xe04d('0x18'));var config=require(_0xe04d('0x19'));var licenseUtil=require(_0xe04d('0x1a'));var db=require(_0xe04d('0x1b'))['db'];config['redis']=_[_0xe04d('0x1c')](config[_0xe04d('0x1d')],{'host':_0xe04d('0x1e'),'port':0x18eb});var socket=require(_0xe04d('0x1f'))(new Redis(config[_0xe04d('0x1d')]));require(_0xe04d('0x20'))[_0xe04d('0x21')](socket);function respondWithStatusCode(_0x143019,_0x2fb7b6){_0x2fb7b6=_0x2fb7b6||0xcc;return function(_0x16b305){if(_0x16b305){return _0x143019[_0xe04d('0x22')](_0x2fb7b6);}return _0x143019[_0xe04d('0x23')](_0x2fb7b6)['end']();};}function respondWithResult(_0x1f29a7,_0x5b05a2){_0x5b05a2=_0x5b05a2||0xc8;return function(_0x27a6a8){if(_0x27a6a8){return _0x1f29a7['status'](_0x5b05a2)[_0xe04d('0x24')](_0x27a6a8);}};}function respondWithFilteredResult(_0xbd5fa1,_0x4221aa){return function(_0x93b107){if(_0x93b107){var _0x4090e0=_0x93b107[_0xe04d('0x25')],_0x35a2b4=_0x4221aa['offset'],_0x251772=_0x4221aa[_0xe04d('0x26')]+_0x4221aa[_0xe04d('0x27')],_0x399aa0;if(_0x251772>=_0x4090e0){_0x251772=_0x4090e0;_0x399aa0=0xc8;}else{_0x399aa0=0xce;}_0xbd5fa1[_0xe04d('0x23')](_0x399aa0);return _0xbd5fa1[_0xe04d('0x28')](_0xe04d('0x29'),_0x35a2b4+'-'+_0x251772+'/'+_0x4090e0)[_0xe04d('0x24')](_0x93b107);}return null;};}function patchUpdates(_0x55fc38){return function(_0x3b1f42){try{jsonpatch[_0xe04d('0x2a')](_0x3b1f42,_0x55fc38,!![]);}catch(_0x5a109f){return BPromise['reject'](_0x5a109f);}return _0x3b1f42['save']();};}function saveUpdates(_0x46fab1,_0x4e3498){return function(_0x5a94d5){if(_0x5a94d5){return _0x5a94d5[_0xe04d('0x2b')](_0x46fab1)[_0xe04d('0x2c')](function(_0x495f73){return _0x495f73;});}return null;};}function removeEntity(_0x942d8a,_0x5de700){return function(_0x19a618){if(_0x19a618){return _0x19a618['destroy']()[_0xe04d('0x2c')](function(){var _0x456822=_0x19a618[_0xe04d('0x2d')]({'plain':!![]});var _0x29ad33=_0xe04d('0x2e');return db['UserProfileResource'][_0xe04d('0x2f')]({'where':{'type':_0x29ad33,'resourceId':_0x456822['id']}})[_0xe04d('0x2c')](function(){return _0x19a618;});})[_0xe04d('0x2c')](function(){_0x942d8a[_0xe04d('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc73068,_0x6eba3b){return function(_0x19ad13){if(!_0x19ad13){_0xc73068['sendStatus'](0x194);}return _0x19ad13;};}function handleError(_0x187c29,_0x5a3899){_0x5a3899=_0x5a3899||0x1f4;return function(_0x4f5883){logger['error'](_0x4f5883[_0xe04d('0x30')]);if(_0x4f5883[_0xe04d('0x31')]){delete _0x4f5883['name'];}_0x187c29['status'](_0x5a3899)[_0xe04d('0x32')](_0x4f5883);};}exports[_0xe04d('0x33')]=function(_0xff4dfb,_0x4a2a10){var _0x2cf005={},_0x370cea={},_0x47cd45={'count':0x0,'rows':[]};var _0x23bc59=_['map'](db[_0xe04d('0x34')][_0xe04d('0x35')],function(_0x5406e3){return{'name':_0x5406e3[_0xe04d('0x36')],'type':_0x5406e3['type'][_0xe04d('0x37')]};});_0x370cea[_0xe04d('0x38')]=_[_0xe04d('0x39')](_0x23bc59,_0xe04d('0x31'));_0x370cea[_0xe04d('0x3a')]=_[_0xe04d('0x3b')](_0xff4dfb[_0xe04d('0x3a')]);_0x370cea['filters']=_[_0xe04d('0x3c')](_0x370cea[_0xe04d('0x38')],_0x370cea[_0xe04d('0x3a')]);_0x2cf005[_0xe04d('0x3d')]=_[_0xe04d('0x3c')](_0x370cea[_0xe04d('0x38')],qs[_0xe04d('0x3e')](_0xff4dfb[_0xe04d('0x3a')][_0xe04d('0x3e')]));_0x2cf005['attributes']=_0x2cf005[_0xe04d('0x3d')]['length']?_0x2cf005[_0xe04d('0x3d')]:_0x370cea['model'];if(!_0xff4dfb['query'][_0xe04d('0x3f')](_0xe04d('0x40'))){_0x2cf005[_0xe04d('0x27')]=qs[_0xe04d('0x27')](_0xff4dfb['query'][_0xe04d('0x27')]);_0x2cf005[_0xe04d('0x26')]=qs[_0xe04d('0x26')](_0xff4dfb[_0xe04d('0x3a')][_0xe04d('0x26')]);}_0x2cf005['order']=qs['sort'](_0xff4dfb[_0xe04d('0x3a')]['sort']);_0x2cf005['where']=qs[_0xe04d('0x41')](_[_0xe04d('0x42')](_0xff4dfb[_0xe04d('0x3a')],_0x370cea[_0xe04d('0x41')]),_0x23bc59);if(_0xff4dfb['query']['filter']){_0x2cf005[_0xe04d('0x43')]=_[_0xe04d('0x44')](_0x2cf005[_0xe04d('0x43')],{'$or':_[_0xe04d('0x39')](_0x23bc59,function(_0x3f215d){if(_0x3f215d[_0xe04d('0x45')]!=='VIRTUAL'){var _0x3df052={};_0x3df052[_0x3f215d['name']]={'$like':'%'+_0xff4dfb[_0xe04d('0x3a')][_0xe04d('0x46')]+'%'};return _0x3df052;}})});}_0x2cf005=_[_0xe04d('0x44')]({},_0x2cf005,_0xff4dfb[_0xe04d('0x47')]);var _0x446c8e={'where':_0x2cf005[_0xe04d('0x43')]};return db[_0xe04d('0x34')][_0xe04d('0x25')](_0x446c8e)['then'](function(_0x1c9640){_0x47cd45[_0xe04d('0x25')]=_0x1c9640;if(_0xff4dfb['query'][_0xe04d('0x48')]){_0x2cf005['include']=[{'all':!![]}];}return db[_0xe04d('0x34')][_0xe04d('0x49')](_0x2cf005);})['then'](function(_0x198d89){_0x47cd45[_0xe04d('0x4a')]=_0x198d89;return _0x47cd45;})[_0xe04d('0x2c')](respondWithFilteredResult(_0x4a2a10,_0x2cf005))[_0xe04d('0x4b')](handleError(_0x4a2a10,null));};exports[_0xe04d('0x4c')]=function(_0x265537,_0x1f594a){var _0xfe4360={'raw':!![],'where':{'id':_0x265537['params']['id']}},_0x23949f={};_0x23949f['model']=_['keys'](db[_0xe04d('0x34')]['rawAttributes']);_0x23949f[_0xe04d('0x3a')]=_[_0xe04d('0x3b')](_0x265537[_0xe04d('0x3a')]);_0x23949f[_0xe04d('0x41')]=_[_0xe04d('0x3c')](_0x23949f[_0xe04d('0x38')],_0x23949f['query']);_0xfe4360[_0xe04d('0x3d')]=_[_0xe04d('0x3c')](_0x23949f['model'],qs['fields'](_0x265537[_0xe04d('0x3a')][_0xe04d('0x3e')]));_0xfe4360['attributes']=_0xfe4360[_0xe04d('0x3d')]['length']?_0xfe4360[_0xe04d('0x3d')]:_0x23949f[_0xe04d('0x38')];if(_0x265537[_0xe04d('0x3a')][_0xe04d('0x48')]){_0xfe4360[_0xe04d('0x4d')]=[{'all':!![]}];}_0xfe4360=_[_0xe04d('0x44')]({},_0xfe4360,_0x265537[_0xe04d('0x47')]);return db[_0xe04d('0x34')][_0xe04d('0x4e')](_0xfe4360)[_0xe04d('0x2c')](handleEntityNotFound(_0x1f594a,null))['then'](respondWithResult(_0x1f594a,null))['catch'](handleError(_0x1f594a,null));};exports[_0xe04d('0x4f')]=function(_0x4b8822,_0x5c4e24){return db['SmsQueue'][_0xe04d('0x4f')](_0x4b8822[_0xe04d('0x50')],{})[_0xe04d('0x2c')](function(_0x59a02d){var _0x4b77e3=_0x4b8822[_0xe04d('0x51')][_0xe04d('0x2d')]({'plain':!![]});if(!_0x4b77e3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b77e3['role']===_0xe04d('0x51')){var _0x5c6dda=_0x59a02d[_0xe04d('0x2d')]({'plain':!![]});var _0x63f5d9=_0xe04d('0x2e');return db[_0xe04d('0x52')][_0xe04d('0x4e')]({'where':{'name':_0x63f5d9,'userProfileId':_0x4b77e3[_0xe04d('0x53')]},'raw':!![]})[_0xe04d('0x2c')](function(_0x4470c2){if(_0x4470c2&&_0x4470c2['autoAssociation']===0x0){return db['UserProfileResource'][_0xe04d('0x4f')]({'name':_0x5c6dda[_0xe04d('0x31')],'resourceId':_0x5c6dda['id'],'type':_0x4470c2[_0xe04d('0x31')],'sectionId':_0x4470c2['id']},{})[_0xe04d('0x2c')](function(){return _0x59a02d;});}else{return _0x59a02d;}})[_0xe04d('0x4b')](function(_0x4dd987){logger['error'](_0xe04d('0x54'),_0x4dd987);throw _0x4dd987;});}return _0x59a02d;})['then'](respondWithResult(_0x5c4e24,0xc9))['catch'](handleError(_0x5c4e24,null));};exports[_0xe04d('0x2b')]=function(_0x4c570f,_0x3e2fce){if(_0x4c570f['body']['id']){delete _0x4c570f[_0xe04d('0x50')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x4c570f[_0xe04d('0x55')]['id']}})[_0xe04d('0x2c')](handleEntityNotFound(_0x3e2fce,null))[_0xe04d('0x2c')](saveUpdates(_0x4c570f[_0xe04d('0x50')],null))[_0xe04d('0x2c')](respondWithResult(_0x3e2fce,null))[_0xe04d('0x4b')](handleError(_0x3e2fce,null));};exports[_0xe04d('0x2f')]=function(_0x42c863,_0xa032af){return db[_0xe04d('0x34')][_0xe04d('0x4e')]({'where':{'id':_0x42c863['params']['id']}})[_0xe04d('0x2c')](handleEntityNotFound(_0xa032af,null))[_0xe04d('0x2c')](removeEntity(_0xa032af,null))[_0xe04d('0x4b')](handleError(_0xa032af,null));};exports['describe']=function(_0x455951,_0x48a753){return db[_0xe04d('0x34')][_0xe04d('0x56')]()['then'](respondWithResult(_0x48a753,null))[_0xe04d('0x4b')](handleError(_0x48a753,null));};exports[_0xe04d('0x57')]=function(_0x19c0d6,_0x4e5ac9,_0x928e28){var _0x592965={'raw':!![],'where':{}},_0x2e1d36={},_0x3a940a;return db[_0xe04d('0x34')][_0xe04d('0x58')]({'where':{'id':_0x19c0d6['params']['id']}})[_0xe04d('0x2c')](handleEntityNotFound(_0x4e5ac9,null))['then'](function(_0x1f8535){if(_0x1f8535){_0x3a940a=_0x1f8535['get']({'plain':!![]});_0x2e1d36[_0xe04d('0x38')]=_[_0xe04d('0x3b')](db[_0xe04d('0x59')][_0xe04d('0x35')]);_0x2e1d36['query']=_[_0xe04d('0x3b')](_0x19c0d6['query']);_0x2e1d36['filters']=_[_0xe04d('0x3c')](_0x2e1d36[_0xe04d('0x38')],_0x2e1d36[_0xe04d('0x3a')]);_0x592965[_0xe04d('0x3d')]=_['intersection'](_0x2e1d36['model'],qs['fields'](_0x19c0d6['query'][_0xe04d('0x3e')]));_0x592965[_0xe04d('0x3d')]=_0x592965['attributes'][_0xe04d('0x5a')]?_0x592965[_0xe04d('0x3d')]:_0x2e1d36[_0xe04d('0x38')];if(!_0x19c0d6[_0xe04d('0x3a')][_0xe04d('0x3f')]('nolimit')){_0x592965[_0xe04d('0x27')]=qs['limit'](_0x19c0d6[_0xe04d('0x3a')]['limit']);_0x592965[_0xe04d('0x26')]=qs[_0xe04d('0x26')](_0x19c0d6[_0xe04d('0x3a')]['offset']);}_0x592965[_0xe04d('0x5b')]=qs[_0xe04d('0x5c')](_0x19c0d6[_0xe04d('0x3a')][_0xe04d('0x5c')]);_0x592965[_0xe04d('0x43')]=qs[_0xe04d('0x41')](_[_0xe04d('0x42')](_0x19c0d6['query'],_0x2e1d36['filters']));_0x592965[_0xe04d('0x43')][_0xe04d('0x5d')]=_0x1f8535['id'];if(_0x19c0d6[_0xe04d('0x3a')][_0xe04d('0x46')]){_0x592965['where']=_[_0xe04d('0x44')](_0x592965[_0xe04d('0x43')],{'$or':_[_0xe04d('0x39')](_0x592965[_0xe04d('0x3d')],function(_0x526733){var _0x1d3e7c={};_0x1d3e7c[_0x526733]={'$like':'%'+_0x19c0d6[_0xe04d('0x3a')]['filter']+'%'};return _0x1d3e7c;})});}_0x592965=_[_0xe04d('0x44')]({},_0x592965,_0x19c0d6[_0xe04d('0x47')]);return db[_0xe04d('0x59')]['findAll'](_0x592965);}})[_0xe04d('0x2c')](function(_0x11f62c){if(_0x11f62c){return db[_0xe04d('0x5e')][_0xe04d('0x5f')]({'where':{'id':_[_0xe04d('0x39')](_0x11f62c,_0xe04d('0x60')),'role':_0xe04d('0x61')},'attributes':['id',_0xe04d('0x31'),_0xe04d('0x62'),'updatedAt',_0xe04d('0x63')]});}})[_0xe04d('0x2c')](function(_0x44a79b){if(_0x44a79b){return{'count':_0x44a79b[_0xe04d('0x25')],'rows':_[_0xe04d('0x39')](_0x44a79b[_0xe04d('0x4a')],function(_0x2f5bd6){return{'membername':_0x2f5bd6[_0xe04d('0x31')],'UserId':_0x2f5bd6['id'],'queue_name':_0x3a940a[_0xe04d('0x31')],'SmsQueueId':_0x3a940a['id'],'interface':util['format'](_0xe04d('0x64'),_0xe04d('0x65'),_0x2f5bd6['name']),'penalty':0x0,'paused':_0x2f5bd6[_0xe04d('0x62')],'createdAt':_0x2f5bd6['createdAt'],'updatedAt':_0x2f5bd6['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xe04d('0x2c')](respondWithFilteredResult(_0x4e5ac9,_0x592965))[_0xe04d('0x4b')](handleError(_0x4e5ac9,null));};exports[_0xe04d('0x66')]=function(_0x29ee1f,_0x242a6b,_0x5416f7){var _0xb4b3c8={};var _0x38e22e={};var _0x5d3e7a;var _0x29dee3;return db['SmsQueue']['findOne']({'where':{'id':_0x29ee1f['params']['id']}})[_0xe04d('0x2c')](handleEntityNotFound(_0x242a6b,null))['then'](function(_0x18c3dc){if(_0x18c3dc){_0x5d3e7a=_0x18c3dc;_0x38e22e['model']=_[_0xe04d('0x3b')](db[_0xe04d('0x67')]['rawAttributes']);_0x38e22e[_0xe04d('0x3a')]=_['keys'](_0x29ee1f[_0xe04d('0x3a')]);_0x38e22e['filters']=_[_0xe04d('0x3c')](_0x38e22e[_0xe04d('0x38')],_0x38e22e[_0xe04d('0x3a')]);_0xb4b3c8[_0xe04d('0x3d')]=_[_0xe04d('0x3c')](_0x38e22e[_0xe04d('0x38')],qs[_0xe04d('0x3e')](_0x29ee1f['query'][_0xe04d('0x3e')]));_0xb4b3c8['attributes']=_0xb4b3c8[_0xe04d('0x3d')][_0xe04d('0x5a')]?_0xb4b3c8['attributes']:_0x38e22e[_0xe04d('0x38')];_0xb4b3c8[_0xe04d('0x5b')]=qs[_0xe04d('0x5c')](_0x29ee1f[_0xe04d('0x3a')]['sort']);_0xb4b3c8[_0xe04d('0x43')]=qs['filters'](_['pick'](_0x29ee1f[_0xe04d('0x3a')],_0x38e22e[_0xe04d('0x41')]));if(_0x29ee1f[_0xe04d('0x3a')][_0xe04d('0x46')]){_0xb4b3c8[_0xe04d('0x43')]=_[_0xe04d('0x44')](_0xb4b3c8[_0xe04d('0x43')],{'$or':_['map'](_0xb4b3c8[_0xe04d('0x3d')],function(_0xc6d30e){var _0x3727fe={};_0x3727fe[_0xc6d30e]={'$like':'%'+_0x29ee1f[_0xe04d('0x3a')][_0xe04d('0x46')]+'%'};return _0x3727fe;})});}_0xb4b3c8=_[_0xe04d('0x44')]({},_0xb4b3c8,_0x29ee1f[_0xe04d('0x47')]);return _0x5d3e7a[_0xe04d('0x66')](_0xb4b3c8);}})[_0xe04d('0x2c')](function(_0x33fa74){if(_0x33fa74){_0x29dee3=_0x33fa74[_0xe04d('0x5a')];if(!_0x29ee1f['query'][_0xe04d('0x3f')]('nolimit')){_0xb4b3c8[_0xe04d('0x27')]=qs[_0xe04d('0x27')](_0x29ee1f[_0xe04d('0x3a')][_0xe04d('0x27')]);_0xb4b3c8[_0xe04d('0x26')]=qs['offset'](_0x29ee1f['query']['offset']);}return _0x5d3e7a['getTeams'](_0xb4b3c8);}})[_0xe04d('0x2c')](function(_0x49e0e4){if(_0x49e0e4){return _0x49e0e4?{'count':_0x29dee3,'rows':_0x49e0e4}:null;}})[_0xe04d('0x2c')](respondWithResult(_0x242a6b,null))['catch'](handleError(_0x242a6b,null));};exports[_0xe04d('0x68')]=function(_0x1410d1,_0x5c5a07,_0x1afeeb){var _0xbc81af=_0x1410d1['body']['ids'];return db['Team']['findAll']({'where':{'id':_0xbc81af},'attributes':['id'],'include':[{'model':db[_0xe04d('0x5e')],'as':_0xe04d('0x69'),'attributes':['id','name',_0xe04d('0x6a'),_0xe04d('0x6b'),_0xe04d('0x6c')],'raw':!![]}]})[_0xe04d('0x2c')](function(_0x36d086){if(_0x36d086){var _0x4676d7=_[_0xe04d('0x6d')](_0x36d086,function(_0x5ee28d){var _0x770284=_0x5ee28d['get']({'plain':!![]});return _0x770284['Agents'];});return db[_0xe04d('0x34')][_0xe04d('0x4e')]({'where':{'id':_0x1410d1[_0xe04d('0x55')]['id']}})[_0xe04d('0x2c')](function(_0x4a952c){return db[_0xe04d('0x6e')][_0xe04d('0x6f')](function(_0x2bc3aa){return _0x4a952c['addTeams'](_0xbc81af,{'transaction':_0x2bc3aa})['then'](function(){return BPromise[_0xe04d('0x70')](_0x4676d7,function(_0x293ace){return db[_0xe04d('0x59')]['findOrCreate']({'where':{'UserId':_0x293ace['id'],'SmsQueueId':_0x1410d1['params']['id']},'transaction':_0x2bc3aa});});})[_0xe04d('0x2c')](function(){_0x4676d7[_0xe04d('0x71')](function(_0x24de68){socket['emit']('userSmsQueue:save',{'UserId':_0x24de68['id'],'SmsQueueId':_0x4a952c['id']});});});});});}})['then'](respondWithStatusCode(_0x5c5a07,null))['catch'](handleError(_0x5c5a07,null));};exports[_0xe04d('0x72')]=function(_0x3ecd40,_0x144d10,_0xd39867){return db[_0xe04d('0x67')][_0xe04d('0x49')]({'where':{'id':_0x3ecd40[_0xe04d('0x3a')][_0xe04d('0x73')]},'attributes':['id'],'include':[{'model':db[_0xe04d('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe04d('0x2c')](handleEntityNotFound(_0x144d10,null))[_0xe04d('0x2c')](function(_0x2bccbe){var _0x38c8ab=_[_0xe04d('0x39')](_0x2bccbe,'id');var _0x21c240=[];var _0x34e784=[];var _0x1e90c1=squel[_0xe04d('0x74')]();_0x1e90c1[_0xe04d('0x75')](_0xe04d('0x76'))[_0xe04d('0x77')]('team_has_sms_queues','tq')[_0xe04d('0x78')]('user_has_teams','ut',_0xe04d('0x79'))[_0xe04d('0x43')](_0xe04d('0x7a'),_0x3ecd40[_0xe04d('0x55')]['id']);for(var _0x3aafdf=0x0;_0x3aafdf<_0x2bccbe[_0xe04d('0x5a')];_0x3aafdf+=0x1){let _0x3e6979=_0x2bccbe[_0x3aafdf];for(var _0x22b8d8=0x0;_0x22b8d8<_0x3e6979[_0xe04d('0x69')][_0xe04d('0x5a')];_0x22b8d8+=0x1){let _0xac2d57=_0x3e6979[_0xe04d('0x69')][_0x22b8d8];var _0x1a8219=_0x1e90c1[_0xe04d('0x7b')]();_0x1a8219['where'](_0xe04d('0x7c'),_0xac2d57['id']);_0x34e784['push'](db['sequelize']['query'](_0x1a8219[_0xe04d('0x7d')](),{'type':db[_0xe04d('0x6e')][_0xe04d('0x7e')][_0xe04d('0x7f')]})[_0xe04d('0x2c')](function(_0x321118){if(_0x321118[_0xe04d('0x5a')]===0x1){return _0xac2d57['id'];}else{var _0x422d79=_['every'](_[_0xe04d('0x39')](_0x321118,_0xe04d('0x80')),function(_0x69547e){return _[_0xe04d('0x81')](_0x38c8ab,_0x69547e);});if(_0x422d79){return _0xac2d57['id'];}}}));}}return BPromise[_0xe04d('0x82')](_0x34e784)[_0xe04d('0x2c')](function(_0xc2cff7){_0x21c240=_(_0x21c240)[_0xe04d('0x83')](_0xc2cff7)[_0xe04d('0x84')]()[_0xe04d('0x85')]();return db[_0xe04d('0x34')][_0xe04d('0x4e')]({'where':{'id':_0x3ecd40[_0xe04d('0x55')]['id']}})[_0xe04d('0x2c')](function(_0x59510d){return db[_0xe04d('0x6e')][_0xe04d('0x6f')](function(_0x40ba96){return _0x59510d[_0xe04d('0x72')](_0x3ecd40[_0xe04d('0x3a')][_0xe04d('0x73')],{'transaction':_0x40ba96})[_0xe04d('0x2c')](function(){if(!_[_0xe04d('0x86')](_0x21c240)){return _0x59510d['removeAgents'](_0x21c240,{'transaction':_0x40ba96});}})[_0xe04d('0x2c')](function(){_0x21c240[_0xe04d('0x71')](function(_0x979d9f){socket['emit'](_0xe04d('0x87'),{'UserId':_0x979d9f,'SmsQueueId':_0x59510d['id']});});});});});});})[_0xe04d('0x2c')](respondWithStatusCode(_0x144d10,null))[_0xe04d('0x4b')](handleError(_0x144d10,null));};exports['addAgents']=function(_0x1e057b,_0x2b70e9,_0x55f967){return db['SmsQueue'][_0xe04d('0x4e')]({'where':{'id':_0x1e057b[_0xe04d('0x55')]['id']}})['then'](handleEntityNotFound(_0x2b70e9,null))[_0xe04d('0x2c')](function(_0x6fac32){if(_0x6fac32){return _0x6fac32[_0xe04d('0x88')](_0x1e057b[_0xe04d('0x50')][_0xe04d('0x73')],_['omit'](_0x1e057b[_0xe04d('0x50')],[_0xe04d('0x73'),'id'])||{})[_0xe04d('0x89')](function(_0x358047){for(var _0x154da9=0x0;_0x154da9<_0x1e057b[_0xe04d('0x50')][_0xe04d('0x73')][_0xe04d('0x5a')];_0x154da9+=0x1){socket[_0xe04d('0x8a')](_0xe04d('0x8b'),{'UserId':_0x1e057b[_0xe04d('0x50')][_0xe04d('0x73')][_0x154da9],'SmsQueueId':_0x1e057b['params']['id']});}return _0x358047;});}})['then'](respondWithResult(_0x2b70e9,null))[_0xe04d('0x4b')](handleError(_0x2b70e9,null));};exports[_0xe04d('0x8c')]=function(_0x253161,_0x4f1ad8,_0x3d8630){return db[_0xe04d('0x34')]['find']({'where':{'id':_0x253161[_0xe04d('0x55')]['id']}})[_0xe04d('0x2c')](handleEntityNotFound(_0x4f1ad8,null))['then'](function(_0x2064c2){if(_0x2064c2){return _0x2064c2['removeAgents'](_0x253161['query'][_0xe04d('0x73')])[_0xe04d('0x2c')](function(){if(_[_0xe04d('0x8d')](_0x253161[_0xe04d('0x3a')][_0xe04d('0x73')])){for(var _0x40ae79=0x0;_0x40ae79<_0x253161['query']['ids'][_0xe04d('0x5a')];_0x40ae79+=0x1){socket['emit'](_0xe04d('0x87'),{'UserId':Number(_0x253161[_0xe04d('0x3a')][_0xe04d('0x73')][_0x40ae79]),'SmsQueueId':Number(_0x253161[_0xe04d('0x55')]['id'])});}}else{socket[_0xe04d('0x8a')](_0xe04d('0x87'),{'UserId':Number(_0x253161['query']['ids']),'SmsQueueId':Number(_0x253161[_0xe04d('0x55')]['id'])});}});}})[_0xe04d('0x2c')](respondWithStatusCode(_0x4f1ad8,null))[_0xe04d('0x4b')](handleError(_0x4f1ad8,null));};exports[_0xe04d('0x8e')]=function(_0xbbd231,_0x36d936,_0x3f4018){var _0x1653fb={};var _0x1ae487={};var _0x5f36ad;var _0x417d99;return db[_0xe04d('0x34')][_0xe04d('0x58')]({'where':{'id':_0xbbd231['params']['id']}})[_0xe04d('0x2c')](handleEntityNotFound(_0x36d936,null))[_0xe04d('0x2c')](function(_0x25ac77){if(_0x25ac77){_0x5f36ad=_0x25ac77;_0x1ae487[_0xe04d('0x38')]=_['keys'](db[_0xe04d('0x5e')][_0xe04d('0x35')]);_0x1ae487[_0xe04d('0x3a')]=_[_0xe04d('0x3b')](_0xbbd231[_0xe04d('0x3a')]);_0x1ae487[_0xe04d('0x41')]=_[_0xe04d('0x3c')](_0x1ae487[_0xe04d('0x38')],_0x1ae487[_0xe04d('0x3a')]);_0x1653fb[_0xe04d('0x3d')]=_[_0xe04d('0x3c')](_0x1ae487[_0xe04d('0x38')],qs[_0xe04d('0x3e')](_0xbbd231[_0xe04d('0x3a')]['fields']));_0x1653fb[_0xe04d('0x3d')]=_0x1653fb[_0xe04d('0x3d')][_0xe04d('0x5a')]?_0x1653fb[_0xe04d('0x3d')]:_0x1ae487['model'];_0x1653fb[_0xe04d('0x5b')]=qs[_0xe04d('0x5c')](_0xbbd231['query']['sort']);_0x1653fb[_0xe04d('0x43')]=qs[_0xe04d('0x41')](_[_0xe04d('0x42')](_0xbbd231[_0xe04d('0x3a')],_0x1ae487[_0xe04d('0x41')]));if(_0xbbd231[_0xe04d('0x3a')][_0xe04d('0x46')]){_0x1653fb[_0xe04d('0x43')]=_['merge'](_0x1653fb['where'],{'$or':_[_0xe04d('0x39')](_0x1653fb[_0xe04d('0x3d')],function(_0x1f4520){var _0x358a18={};_0x358a18[_0x1f4520]={'$like':'%'+_0xbbd231['query'][_0xe04d('0x46')]+'%'};return _0x358a18;})});}_0x1653fb=_[_0xe04d('0x44')]({},_0x1653fb,_0xbbd231[_0xe04d('0x47')]);return _0x5f36ad[_0xe04d('0x8e')](_0x1653fb);}})[_0xe04d('0x2c')](function(_0x257a64){if(_0x257a64){_0x417d99=_0x257a64[_0xe04d('0x5a')];if(!_0xbbd231['query'][_0xe04d('0x3f')](_0xe04d('0x40'))){_0x1653fb[_0xe04d('0x27')]=qs['limit'](_0xbbd231['query']['limit']);_0x1653fb['offset']=qs[_0xe04d('0x26')](_0xbbd231[_0xe04d('0x3a')][_0xe04d('0x26')]);}return _0x5f36ad[_0xe04d('0x8e')](_0x1653fb);}})[_0xe04d('0x2c')](function(_0x12be35){if(_0x12be35){return _0x12be35?{'count':_0x417d99,'rows':_0x12be35}:null;}})[_0xe04d('0x2c')](respondWithResult(_0x36d936,null))['catch'](handleError(_0x36d936,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 403a6e7..016f453 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 _0x9722=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','SmsQueue','setMaxListeners','save'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x9722,0x140));var _0x2972=function(_0x5313dd,_0x5d6a84){_0x5313dd=_0x5313dd-0x0;var _0x23aa4c=_0x9722[_0x5313dd];return _0x23aa4c;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x2972('0x0'))['db'][_0x2972('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x2972('0x2')](0x0);var events={'afterCreate':_0x2972('0x3'),'afterUpdate':_0x2972('0x4'),'afterDestroy':_0x2972('0x5')};function emitEvent(_0x4f83de){return function(_0x515d60,_0x48f8f6,_0x45d27d){SmsQueueEvents[_0x2972('0x6')](_0x4f83de+':'+_0x515d60['id'],_0x515d60);SmsQueueEvents[_0x2972('0x6')](_0x4f83de,_0x515d60);_0x45d27d(null);};}for(var e in events){if(events[_0x2972('0x7')](e)){var event=events[e];SmsQueue[_0x2972('0x8')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x59f7=['exports','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2c3fce,_0x33fbed){var _0x2ee0de=function(_0x634405){while(--_0x634405){_0x2c3fce['push'](_0x2c3fce['shift']());}};_0x2ee0de(++_0x33fbed);}(_0x59f7,0x99));var _0x759f=function(_0x21cdf1,_0x54320f){_0x21cdf1=_0x21cdf1-0x0;var _0x39d4d7=_0x59f7[_0x21cdf1];return _0x39d4d7;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x759f('0x0'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x759f('0x1'),'afterUpdate':_0x759f('0x2'),'afterDestroy':_0x759f('0x3')};function emitEvent(_0x4e1924){return function(_0x8791ba,_0x123d35,_0x3b3ea2){SmsQueueEvents['emit'](_0x4e1924+':'+_0x8791ba['id'],_0x8791ba);SmsQueueEvents[_0x759f('0x4')](_0x4e1924,_0x8791ba);_0x3b3ea2(null);};}for(var e in events){if(events[_0x759f('0x5')](e)){var event=events[e];SmsQueue[_0x759f('0x6')](e,emitEvent(event));}}module[_0x759f('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 c45b468..6282b66 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 _0x07e5=['api','bluebird','request-promise','./smsQueue.attributes','exports','define','SmsQueue','lodash','util','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x07e5,0x133));var _0x507e=function(_0x479d3d,_0x32d023){_0x479d3d=_0x479d3d-0x0;var _0x3e614d=_0x07e5[_0x479d3d];return _0x3e614d;};'use strict';var _=require(_0x507e('0x0'));var util=require(_0x507e('0x1'));var logger=require(_0x507e('0x2'))(_0x507e('0x3'));var moment=require('moment');var BPromise=require(_0x507e('0x4'));var rp=require(_0x507e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x507e('0x6'));module[_0x507e('0x7')]=function(_0x263540,_0x2b423b){return _0x263540[_0x507e('0x8')](_0x507e('0x9'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88e8=['./smsQueue.attributes','exports','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x340f90,_0x38bf1f){var _0x521b46=function(_0x361993){while(--_0x361993){_0x340f90['push'](_0x340f90['shift']());}};_0x521b46(++_0x38bf1f);}(_0x88e8,0xc8));var _0x888e=function(_0x14735c,_0x56c131){_0x14735c=_0x14735c-0x0;var _0x44e4f4=_0x88e8[_0x14735c];return _0x44e4f4;};'use strict';var _=require(_0x888e('0x0'));var util=require(_0x888e('0x1'));var logger=require(_0x888e('0x2'))(_0x888e('0x3'));var moment=require(_0x888e('0x4'));var BPromise=require(_0x888e('0x5'));var rp=require(_0x888e('0x6'));var fs=require('fs');var path=require(_0x888e('0x7'));var rimraf=require(_0x888e('0x8'));var config=require(_0x888e('0x9'));var attributes=require(_0x888e('0xa'));module[_0x888e('0xb')]=function(_0x5c7b,_0x196cc0){return _0x5c7b['define'](_0x888e('0xc'),attributes,{'tableName':_0x888e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 17cc010..416ef7c 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 _0x6dc7=['options','where','attributes','limit','include','map','model','ShowSmsQueue','find','raw','lodash','util','bluebird','randomstring','ioredis','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetSmsQueue','findAll'];(function(_0x244454,_0x14d478){var _0x1c8eb4=function(_0x43063f){while(--_0x43063f){_0x244454['push'](_0x244454['shift']());}};_0x1c8eb4(++_0x14d478);}(_0x6dc7,0x1ac));var _0x76dc=function(_0x383158,_0x415e43){_0x383158=_0x383158-0x0;var _0x507985=_0x6dc7[_0x383158];return _0x507985;};'use strict';var _=require(_0x76dc('0x0'));var util=require(_0x76dc('0x1'));var moment=require('moment');var BPromise=require(_0x76dc('0x2'));var rs=require(_0x76dc('0x3'));var fs=require('fs');var Redis=require(_0x76dc('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x76dc('0x5'));var client=jayson[_0x76dc('0x6')][_0x76dc('0x7')]({'port':0x232a});config['redis']=_[_0x76dc('0x8')](config[_0x76dc('0x9')],{'host':_0x76dc('0xa'),'port':0x18eb});var socket=require(_0x76dc('0xb'))(new Redis(config[_0x76dc('0x9')]));require(_0x76dc('0xc'))[_0x76dc('0xd')](socket);function respondWithRpcPromise(_0x5ae3ad,_0x2df73a,_0x39dcff){return new BPromise(function(_0xfdc6a0,_0xe325f1){return client[_0x76dc('0xe')](_0x5ae3ad,_0x39dcff)[_0x76dc('0xf')](function(_0x533fc4){logger[_0x76dc('0x10')](_0x76dc('0x11'),_0x2df73a,'request\x20sent');logger[_0x76dc('0x12')](_0x76dc('0x13'),_0x2df73a,_0x76dc('0x14'),JSON[_0x76dc('0x15')](_0x533fc4));if(_0x533fc4[_0x76dc('0x16')]){if(_0x533fc4['error']['code']===0x1f4){logger[_0x76dc('0x16')](_0x76dc('0x11'),_0x2df73a,_0x533fc4['error'][_0x76dc('0x17')]);return _0xe325f1(_0x533fc4['error']['message']);}logger[_0x76dc('0x16')](_0x76dc('0x11'),_0x2df73a,_0x533fc4['error'][_0x76dc('0x17')]);return _0xfdc6a0(_0x533fc4[_0x76dc('0x16')][_0x76dc('0x17')]);}else{logger[_0x76dc('0x10')](_0x76dc('0x11'),_0x2df73a,'request\x20sent');_0xfdc6a0(_0x533fc4[_0x76dc('0x18')][_0x76dc('0x17')]);}})[_0x76dc('0x19')](function(_0x530dbb){logger['error'](_0x76dc('0x11'),_0x2df73a,_0x530dbb);_0xe325f1(_0x530dbb);});});}exports[_0x76dc('0x1a')]=function(_0x380efa){var _0x54c688=this;return new Promise(function(_0x33d68d,_0x3fb499){return db['SmsQueue'][_0x76dc('0x1b')]({'raw':_0x380efa['options']?_0x380efa[_0x76dc('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x380efa[_0x76dc('0x1c')]?_0x380efa[_0x76dc('0x1c')][_0x76dc('0x1d')]||null:null,'attributes':_0x380efa[_0x76dc('0x1c')]?_0x380efa[_0x76dc('0x1c')][_0x76dc('0x1e')]||null:null,'limit':_0x380efa[_0x76dc('0x1c')]?_0x380efa[_0x76dc('0x1c')][_0x76dc('0x1f')]||null:null,'include':_0x380efa['options']?_0x380efa[_0x76dc('0x1c')][_0x76dc('0x20')]?_[_0x76dc('0x21')](_0x380efa[_0x76dc('0x1c')][_0x76dc('0x20')],function(_0x2ff07a){return{'model':db[_0x2ff07a[_0x76dc('0x22')]],'as':_0x2ff07a['as'],'attributes':_0x2ff07a['attributes'],'include':_0x2ff07a[_0x76dc('0x20')]?_[_0x76dc('0x21')](_0x2ff07a['include'],function(_0x57c4e4){return{'model':db[_0x57c4e4['model']],'as':_0x57c4e4['as'],'attributes':_0x57c4e4[_0x76dc('0x1e')],'include':_0x57c4e4[_0x76dc('0x20')]?_['map'](_0x57c4e4[_0x76dc('0x20')],function(_0xd677a6){return{'model':db[_0xd677a6[_0x76dc('0x22')]],'as':_0xd677a6['as'],'attributes':_0xd677a6[_0x76dc('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x76dc('0xf')](function(_0x3d82f4){logger['info'](_0x76dc('0x1a'),_0x380efa);logger[_0x76dc('0x12')]('GetSmsQueue',_0x380efa,JSON[_0x76dc('0x15')](_0x3d82f4));_0x33d68d(_0x3d82f4);})['catch'](function(_0x5e43d9){logger[_0x76dc('0x16')](_0x76dc('0x1a'),_0x5e43d9['message'],_0x380efa);_0x3fb499(_0x54c688['error'](0x1f4,_0x5e43d9['message']));});});};exports[_0x76dc('0x23')]=function(_0x1056b3){var _0xbcf171=this;return new Promise(function(_0xa21692,_0x1442bb){return db['SmsQueue'][_0x76dc('0x24')]({'raw':_0x1056b3[_0x76dc('0x1c')]?_0x1056b3[_0x76dc('0x1c')][_0x76dc('0x25')]===undefined?!![]:![]:!![],'where':_0x1056b3[_0x76dc('0x1c')]?_0x1056b3[_0x76dc('0x1c')][_0x76dc('0x1d')]||null:null,'attributes':_0x1056b3[_0x76dc('0x1c')]?_0x1056b3['options']['attributes']||null:null,'include':_0x1056b3[_0x76dc('0x1c')]?_0x1056b3['options'][_0x76dc('0x20')]?_[_0x76dc('0x21')](_0x1056b3['options']['include'],function(_0x3474e5){return{'model':db[_0x3474e5[_0x76dc('0x22')]],'as':_0x3474e5['as'],'attributes':_0x3474e5[_0x76dc('0x1e')],'include':_0x3474e5[_0x76dc('0x20')]?_['map'](_0x3474e5['include'],function(_0x5c16ef){return{'model':db[_0x5c16ef['model']],'as':_0x5c16ef['as'],'attributes':_0x5c16ef[_0x76dc('0x1e')],'include':_0x5c16ef[_0x76dc('0x20')]?_[_0x76dc('0x21')](_0x5c16ef[_0x76dc('0x20')],function(_0x40412d){return{'model':db[_0x40412d['model']],'as':_0x40412d['as'],'attributes':_0x40412d['attributes']};}):[]};}):[]};}):[]:[]})[_0x76dc('0xf')](function(_0x133807){logger['info']('ShowSmsQueue',_0x1056b3);logger[_0x76dc('0x12')](_0x76dc('0x23'),_0x1056b3,JSON[_0x76dc('0x15')](_0x133807));_0xa21692(_0x133807);})[_0x76dc('0x19')](function(_0x503c83){logger[_0x76dc('0x16')](_0x76dc('0x23'),_0x503c83[_0x76dc('0x17')],_0x1056b3);_0x1442bb(_0xbcf171[_0x76dc('0x16')](0x1f4,_0x503c83['message']));});});}; \ No newline at end of file +var _0x11a6=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./smsQueue.socket','request','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','SmsQueue','findAll','options','where','attributes','map','include','model','then','GetSmsQueue','catch','ShowSmsQueue','raw','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1afdf8,_0x3a68be){var _0x28bfe4=function(_0x50e561){while(--_0x50e561){_0x1afdf8['push'](_0x1afdf8['shift']());}};_0x28bfe4(++_0x3a68be);}(_0x11a6,0x73));var _0x611a=function(_0x320a9e,_0x52d446){_0x320a9e=_0x320a9e-0x0;var _0x543ec2=_0x11a6[_0x320a9e];return _0x543ec2;};'use strict';var _=require('lodash');var util=require(_0x611a('0x0'));var moment=require(_0x611a('0x1'));var BPromise=require(_0x611a('0x2'));var rs=require(_0x611a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x611a('0x4'))['db'];var utils=require(_0x611a('0x5'));var logger=require('../../config/logger')(_0x611a('0x6'));var config=require(_0x611a('0x7'));var jayson=require(_0x611a('0x8'));var client=jayson[_0x611a('0x9')][_0x611a('0xa')]({'port':0x232a});config['redis']=_[_0x611a('0xb')](config['redis'],{'host':_0x611a('0xc'),'port':0x18eb});var socket=require(_0x611a('0xd'))(new Redis(config[_0x611a('0xe')]));require(_0x611a('0xf'))['register'](socket);function respondWithRpcPromise(_0x49ddf7,_0x4945f3,_0x55b5a3){return new BPromise(function(_0x300eb9,_0x37b70a){return client[_0x611a('0x10')](_0x49ddf7,_0x55b5a3)['then'](function(_0x57abe5){logger[_0x611a('0x11')](_0x611a('0x12'),_0x4945f3,'request\x20sent');logger[_0x611a('0x13')](_0x611a('0x14'),_0x4945f3,_0x611a('0x15'),JSON[_0x611a('0x16')](_0x57abe5));if(_0x57abe5[_0x611a('0x17')]){if(_0x57abe5[_0x611a('0x17')][_0x611a('0x18')]===0x1f4){logger['error'](_0x611a('0x12'),_0x4945f3,_0x57abe5[_0x611a('0x17')][_0x611a('0x19')]);return _0x37b70a(_0x57abe5[_0x611a('0x17')]['message']);}logger[_0x611a('0x17')](_0x611a('0x12'),_0x4945f3,_0x57abe5['error'][_0x611a('0x19')]);return _0x300eb9(_0x57abe5[_0x611a('0x17')][_0x611a('0x19')]);}else{logger['info'](_0x611a('0x12'),_0x4945f3,_0x611a('0x15'));_0x300eb9(_0x57abe5[_0x611a('0x1a')][_0x611a('0x19')]);}})['catch'](function(_0x3d1063){logger[_0x611a('0x17')](_0x611a('0x12'),_0x4945f3,_0x3d1063);_0x37b70a(_0x3d1063);});});}exports['GetSmsQueue']=function(_0x3432c4){var _0x34e070=this;return new Promise(function(_0x2b498b,_0x345dd0){return db[_0x611a('0x1b')][_0x611a('0x1c')]({'raw':_0x3432c4[_0x611a('0x1d')]?_0x3432c4['options']['raw']===undefined?!![]:![]:!![],'where':_0x3432c4[_0x611a('0x1d')]?_0x3432c4['options'][_0x611a('0x1e')]||null:null,'attributes':_0x3432c4[_0x611a('0x1d')]?_0x3432c4[_0x611a('0x1d')][_0x611a('0x1f')]||null:null,'limit':_0x3432c4['options']?_0x3432c4[_0x611a('0x1d')]['limit']||null:null,'include':_0x3432c4[_0x611a('0x1d')]?_0x3432c4[_0x611a('0x1d')]['include']?_[_0x611a('0x20')](_0x3432c4[_0x611a('0x1d')]['include'],function(_0x2f2fe5){return{'model':db[_0x2f2fe5['model']],'as':_0x2f2fe5['as'],'attributes':_0x2f2fe5['attributes'],'include':_0x2f2fe5[_0x611a('0x21')]?_[_0x611a('0x20')](_0x2f2fe5['include'],function(_0x4fd153){return{'model':db[_0x4fd153['model']],'as':_0x4fd153['as'],'attributes':_0x4fd153[_0x611a('0x1f')],'include':_0x4fd153['include']?_[_0x611a('0x20')](_0x4fd153[_0x611a('0x21')],function(_0x2fbc14){return{'model':db[_0x2fbc14[_0x611a('0x22')]],'as':_0x2fbc14['as'],'attributes':_0x2fbc14[_0x611a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x611a('0x23')](function(_0x206c7d){logger['info'](_0x611a('0x24'),_0x3432c4);logger[_0x611a('0x13')](_0x611a('0x24'),_0x3432c4,JSON['stringify'](_0x206c7d));_0x2b498b(_0x206c7d);})[_0x611a('0x25')](function(_0x44d4f0){logger[_0x611a('0x17')](_0x611a('0x24'),_0x44d4f0['message'],_0x3432c4);_0x345dd0(_0x34e070['error'](0x1f4,_0x44d4f0[_0x611a('0x19')]));});});};exports[_0x611a('0x26')]=function(_0x3c2e27){var _0x414184=this;return new Promise(function(_0x1befd4,_0x223f42){return db[_0x611a('0x1b')]['find']({'raw':_0x3c2e27['options']?_0x3c2e27['options'][_0x611a('0x27')]===undefined?!![]:![]:!![],'where':_0x3c2e27[_0x611a('0x1d')]?_0x3c2e27[_0x611a('0x1d')][_0x611a('0x1e')]||null:null,'attributes':_0x3c2e27['options']?_0x3c2e27[_0x611a('0x1d')]['attributes']||null:null,'include':_0x3c2e27[_0x611a('0x1d')]?_0x3c2e27['options'][_0x611a('0x21')]?_[_0x611a('0x20')](_0x3c2e27['options'][_0x611a('0x21')],function(_0x302762){return{'model':db[_0x302762[_0x611a('0x22')]],'as':_0x302762['as'],'attributes':_0x302762[_0x611a('0x1f')],'include':_0x302762[_0x611a('0x21')]?_[_0x611a('0x20')](_0x302762[_0x611a('0x21')],function(_0x122707){return{'model':db[_0x122707[_0x611a('0x22')]],'as':_0x122707['as'],'attributes':_0x122707[_0x611a('0x1f')],'include':_0x122707['include']?_[_0x611a('0x20')](_0x122707['include'],function(_0x1554f8){return{'model':db[_0x1554f8[_0x611a('0x22')]],'as':_0x1554f8['as'],'attributes':_0x1554f8[_0x611a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x611a('0x23')](function(_0x2d8690){logger[_0x611a('0x11')]('ShowSmsQueue',_0x3c2e27);logger['debug']('ShowSmsQueue',_0x3c2e27,JSON[_0x611a('0x16')](_0x2d8690));_0x1befd4(_0x2d8690);})[_0x611a('0x25')](function(_0x24ad8d){logger[_0x611a('0x17')](_0x611a('0x26'),_0x24ad8d[_0x611a('0x19')],_0x3c2e27);_0x223f42(_0x414184[_0x611a('0x17')](0x1f4,_0x24ad8d[_0x611a('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 9134a58..e8a22ce 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 _0xc533=['register','length','smsQueue:','./smsQueue.events','update','emit'];(function(_0x37cede,_0x391a5b){var _0x1bfc35=function(_0x479fdb){while(--_0x479fdb){_0x37cede['push'](_0x37cede['shift']());}};_0x1bfc35(++_0x391a5b);}(_0xc533,0x1d1));var _0x3c53=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0xc533[_0x485b5a];return _0xd2b34d;};'use strict';var SmsQueueEvents=require(_0x3c53('0x0'));var events=['save','remove',_0x3c53('0x1')];function createListener(_0x1b5443,_0x1424f2){return function(_0x267d10){_0x1424f2[_0x3c53('0x2')](_0x1b5443,_0x267d10);};}function removeListener(_0x38d36b,_0x41b327){return function(){SmsQueueEvents['removeListener'](_0x38d36b,_0x41b327);};}exports[_0x3c53('0x3')]=function(_0x3790b9){for(var _0x3fdf22=0x0,_0x5696f6=events[_0x3c53('0x4')];_0x3fdf22<_0x5696f6;_0x3fdf22++){var _0x1c8375=events[_0x3fdf22];var _0x1bfdcb=createListener(_0x3c53('0x5')+_0x1c8375,_0x3790b9);SmsQueueEvents['on'](_0x1c8375,_0x1bfdcb);}}; \ No newline at end of file +var _0xfc8a=['removeListener','register','length','emit'];(function(_0x138452,_0x4a4768){var _0x2edc68=function(_0x1c85fa){while(--_0x1c85fa){_0x138452['push'](_0x138452['shift']());}};_0x2edc68(++_0x4a4768);}(_0xfc8a,0x19b));var _0xafc8=function(_0x4d1be0,_0x135738){_0x4d1be0=_0x4d1be0-0x0;var _0x47d662=_0xfc8a[_0x4d1be0];return _0x47d662;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save','remove','update'];function createListener(_0x10fa43,_0x9049c8){return function(_0x314865){_0x9049c8[_0xafc8('0x0')](_0x10fa43,_0x314865);};}function removeListener(_0x444ce6,_0x4f27c7){return function(){SmsQueueEvents[_0xafc8('0x1')](_0x444ce6,_0x4f27c7);};}exports[_0xafc8('0x2')]=function(_0x3d3b33){for(var _0x513561=0x0,_0x4e7130=events[_0xafc8('0x3')];_0x513561<_0x4e7130;_0x513561++){var _0x504016=events[_0x513561];var _0x218ffc=createListener('smsQueue:'+_0x504016,_0x3d3b33);SmsQueueEvents['on'](_0x504016,_0x218ffc);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 92e9850..bc64b5a 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 _0x460c=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update'];(function(_0x2f1f08,_0x158f35){var _0x32f365=function(_0x2cc60e){while(--_0x2cc60e){_0x2f1f08['push'](_0x2f1f08['shift']());}};_0x32f365(++_0x158f35);}(_0x460c,0xf4));var _0xc460=function(_0x371955,_0x28bbc8){_0x371955=_0x371955-0x0;var _0x2046dc=_0x460c[_0x371955];return _0x2046dc;};'use strict';var multer=require(_0xc460('0x0'));var util=require(_0xc460('0x1'));var path=require(_0xc460('0x2'));var timeout=require(_0xc460('0x3'));var express=require(_0xc460('0x4'));var router=express[_0xc460('0x5')]();var auth=require(_0xc460('0x6'));var interaction=require(_0xc460('0x7'));var config=require(_0xc460('0x8'));var controller=require(_0xc460('0x9'));router[_0xc460('0xa')]('/',auth[_0xc460('0xb')](),controller[_0xc460('0xc')]);router[_0xc460('0xa')](_0xc460('0xd'),auth[_0xc460('0xb')](),controller[_0xc460('0xe')]);router[_0xc460('0xa')](_0xc460('0xf'),auth[_0xc460('0xb')](),controller['show']);router[_0xc460('0x10')]('/',auth['isAuthenticated'](),controller[_0xc460('0x11')]);router[_0xc460('0x12')](_0xc460('0xf'),auth[_0xc460('0xb')](),controller[_0xc460('0x13')]);router[_0xc460('0x14')]('/:id',auth[_0xc460('0xb')](),controller['destroy']);module[_0xc460('0x15')]=router; \ No newline at end of file +var _0x116b=['delete','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','/describe','describe','/:id','isAuthenticated','post','create','put','update'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_0x116b,0xf9));var _0xb116=function(_0x4dba33,_0x12f226){_0x4dba33=_0x4dba33-0x0;var _0x1e68f8=_0x116b[_0x4dba33];return _0x1e68f8;};'use strict';var multer=require('multer');var util=require(_0xb116('0x0'));var path=require('path');var timeout=require(_0xb116('0x1'));var express=require('express');var router=express[_0xb116('0x2')]();var auth=require(_0xb116('0x3'));var interaction=require(_0xb116('0x4'));var config=require(_0xb116('0x5'));var controller=require(_0xb116('0x6'));router[_0xb116('0x7')]('/',auth['isAuthenticated'](),controller[_0xb116('0x8')]);router['get'](_0xb116('0x9'),auth['isAuthenticated'](),controller[_0xb116('0xa')]);router['get'](_0xb116('0xb'),auth[_0xb116('0xc')](),controller['show']);router[_0xb116('0xd')]('/',auth[_0xb116('0xc')](),controller[_0xb116('0xe')]);router[_0xb116('0xf')]('/:id',auth[_0xb116('0xc')](),controller[_0xb116('0x10')]);router[_0xb116('0x11')](_0xb116('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xb116('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 272cfc1..857df9d 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 _0x4fc2=['DATE','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4fc2,0xe5));var _0x24fc=function(_0x1bd19f,_0x51cf4d){_0x1bd19f=_0x1bd19f-0x0;var _0x4d25c4=_0x4fc2[_0x1bd19f];return _0x4d25c4;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x24fc('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x24fc('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x24fc('0x2')]},'acceptAt':{'type':Sequelize[_0x24fc('0x2')]},'exitAt':{'type':Sequelize[_0x24fc('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4917=['moment','STRING','DATE'];(function(_0x723c56,_0x29ff14){var _0x4b6e72=function(_0x268a07){while(--_0x268a07){_0x723c56['push'](_0x723c56['shift']());}};_0x4b6e72(++_0x29ff14);}(_0x4917,0xb7));var _0x7491=function(_0x384dfd,_0x54bc76){_0x384dfd=_0x384dfd-0x0;var _0x5e232c=_0x4917[_0x384dfd];return _0x5e232c;};'use strict';var moment=require(_0x7491('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x7491('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7491('0x2')]},'acceptAt':{'type':Sequelize[_0x7491('0x2')]},'exitAt':{'type':Sequelize[_0x7491('0x2')]},'reason':{'type':Sequelize[_0x7491('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 6182d42..685732a 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 _0xcdd9=['reject','update','destroy','then','end','sendStatus','name','send','index','map','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','SmsQueueReport','include','findAll','rows','catch','show','params','keys','includeAll','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','json','count','offset','limit','status','Content-Range','apply'];(function(_0x2f30e7,_0x1f88d3){var _0x3ab5c8=function(_0x1289be){while(--_0x1289be){_0x2f30e7['push'](_0x2f30e7['shift']());}};_0x3ab5c8(++_0x1f88d3);}(_0xcdd9,0x19c));var _0x9cdd=function(_0x25be63,_0x4b335e){_0x25be63=_0x25be63-0x0;var _0x4daaa8=_0xcdd9[_0x25be63];return _0x4daaa8;};'use strict';var pdf=require(_0x9cdd('0x0'));var emlformat=require(_0x9cdd('0x1'));var rimraf=require(_0x9cdd('0x2'));var zipdir=require(_0x9cdd('0x3'));var jsonpatch=require(_0x9cdd('0x4'));var rp=require(_0x9cdd('0x5'));var moment=require(_0x9cdd('0x6'));var BPromise=require(_0x9cdd('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9cdd('0x8'));var csv=require(_0x9cdd('0x9'));var ejs=require(_0x9cdd('0xa'));var fs=require('fs');var _=require(_0x9cdd('0xb'));var squel=require(_0x9cdd('0xc'));var crypto=require(_0x9cdd('0xd'));var jsforce=require(_0x9cdd('0xe'));var deskjs=require(_0x9cdd('0xf'));var toCsv=require(_0x9cdd('0x9'));var querystring=require(_0x9cdd('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9cdd('0x11'));var qs=require(_0x9cdd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9cdd('0x13'));var logger=require(_0x9cdd('0x14'))(_0x9cdd('0x15'));var utils=require(_0x9cdd('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9cdd('0x17'));var db=require(_0x9cdd('0x18'))['db'];function respondWithStatusCode(_0x3a3cf4,_0x3d124c){_0x3d124c=_0x3d124c||0xcc;return function(_0x2c7266){if(_0x2c7266){return _0x3a3cf4['sendStatus'](_0x3d124c);}return _0x3a3cf4['status'](_0x3d124c)['end']();};}function respondWithResult(_0x4ba5d0,_0x1f300b){_0x1f300b=_0x1f300b||0xc8;return function(_0x45146f){if(_0x45146f){return _0x4ba5d0['status'](_0x1f300b)[_0x9cdd('0x19')](_0x45146f);}};}function respondWithFilteredResult(_0x9d9d26,_0x8ed13e){return function(_0x4e84b6){if(_0x4e84b6){var _0xd31307=_0x4e84b6[_0x9cdd('0x1a')],_0x52c71d=_0x8ed13e[_0x9cdd('0x1b')],_0x195a1f=_0x8ed13e[_0x9cdd('0x1b')]+_0x8ed13e[_0x9cdd('0x1c')],_0x3cf0f0;if(_0x195a1f>=_0xd31307){_0x195a1f=_0xd31307;_0x3cf0f0=0xc8;}else{_0x3cf0f0=0xce;}_0x9d9d26[_0x9cdd('0x1d')](_0x3cf0f0);return _0x9d9d26['set'](_0x9cdd('0x1e'),_0x52c71d+'-'+_0x195a1f+'/'+_0xd31307)['json'](_0x4e84b6);}return null;};}function patchUpdates(_0x2c10a1){return function(_0x40a146){try{jsonpatch[_0x9cdd('0x1f')](_0x40a146,_0x2c10a1,!![]);}catch(_0x346170){return BPromise[_0x9cdd('0x20')](_0x346170);}return _0x40a146['save']();};}function saveUpdates(_0x162ae,_0x3256ce){return function(_0x3bb3c2){if(_0x3bb3c2){return _0x3bb3c2[_0x9cdd('0x21')](_0x162ae)['then'](function(_0x4d2aeb){return _0x4d2aeb;});}return null;};}function removeEntity(_0x2fce82,_0x2d4649){return function(_0x1de090){if(_0x1de090){return _0x1de090[_0x9cdd('0x22')]()[_0x9cdd('0x23')](function(){_0x2fce82[_0x9cdd('0x1d')](0xcc)[_0x9cdd('0x24')]();});}};}function handleEntityNotFound(_0x4eee08,_0x3418b5){return function(_0x16097d){if(!_0x16097d){_0x4eee08[_0x9cdd('0x25')](0x194);}return _0x16097d;};}function handleError(_0x440c8b,_0x85da3d){_0x85da3d=_0x85da3d||0x1f4;return function(_0x1be1ed){logger['error'](_0x1be1ed['stack']);if(_0x1be1ed[_0x9cdd('0x26')]){delete _0x1be1ed[_0x9cdd('0x26')];}_0x440c8b[_0x9cdd('0x1d')](_0x85da3d)[_0x9cdd('0x27')](_0x1be1ed);};}exports[_0x9cdd('0x28')]=function(_0x4507f6,_0x1d3e5c){var _0x1ddc77={},_0x46d7ef={},_0x4dcc45={'count':0x0,'rows':[]};var _0x62db7e=_[_0x9cdd('0x29')](db['SmsQueueReport'][_0x9cdd('0x2a')],function(_0x543eb6){return{'name':_0x543eb6['fieldName'],'type':_0x543eb6['type'][_0x9cdd('0x2b')]};});_0x46d7ef[_0x9cdd('0x2c')]=_[_0x9cdd('0x29')](_0x62db7e,_0x9cdd('0x26'));_0x46d7ef[_0x9cdd('0x2d')]=_['keys'](_0x4507f6['query']);_0x46d7ef[_0x9cdd('0x2e')]=_[_0x9cdd('0x2f')](_0x46d7ef[_0x9cdd('0x2c')],_0x46d7ef[_0x9cdd('0x2d')]);_0x1ddc77[_0x9cdd('0x30')]=_[_0x9cdd('0x2f')](_0x46d7ef['model'],qs[_0x9cdd('0x31')](_0x4507f6['query'][_0x9cdd('0x31')]));_0x1ddc77[_0x9cdd('0x30')]=_0x1ddc77['attributes'][_0x9cdd('0x32')]?_0x1ddc77[_0x9cdd('0x30')]:_0x46d7ef['model'];if(!_0x4507f6[_0x9cdd('0x2d')][_0x9cdd('0x33')](_0x9cdd('0x34'))){_0x1ddc77['limit']=qs[_0x9cdd('0x1c')](_0x4507f6[_0x9cdd('0x2d')][_0x9cdd('0x1c')]);_0x1ddc77[_0x9cdd('0x1b')]=qs[_0x9cdd('0x1b')](_0x4507f6['query'][_0x9cdd('0x1b')]);}_0x1ddc77['order']=qs['sort'](_0x4507f6['query'][_0x9cdd('0x35')]);_0x1ddc77[_0x9cdd('0x36')]=qs[_0x9cdd('0x2e')](_[_0x9cdd('0x37')](_0x4507f6[_0x9cdd('0x2d')],_0x46d7ef[_0x9cdd('0x2e')]),_0x62db7e);if(_0x4507f6[_0x9cdd('0x2d')][_0x9cdd('0x38')]){_0x1ddc77[_0x9cdd('0x36')]=_[_0x9cdd('0x39')](_0x1ddc77[_0x9cdd('0x36')],{'$or':_['map'](_0x62db7e,function(_0x491be6){if(_0x491be6[_0x9cdd('0x3a')]!==_0x9cdd('0x3b')){var _0x466c2e={};_0x466c2e[_0x491be6['name']]={'$like':'%'+_0x4507f6['query'][_0x9cdd('0x38')]+'%'};return _0x466c2e;}})});}_0x1ddc77=_[_0x9cdd('0x39')]({},_0x1ddc77,_0x4507f6['options']);var _0x4ce93a={'where':_0x1ddc77[_0x9cdd('0x36')]};return db[_0x9cdd('0x3c')][_0x9cdd('0x1a')](_0x4ce93a)[_0x9cdd('0x23')](function(_0x55a073){_0x4dcc45[_0x9cdd('0x1a')]=_0x55a073;if(_0x4507f6['query']['includeAll']){_0x1ddc77[_0x9cdd('0x3d')]=[{'all':!![]}];}return db[_0x9cdd('0x3c')][_0x9cdd('0x3e')](_0x1ddc77);})[_0x9cdd('0x23')](function(_0x140a74){_0x4dcc45[_0x9cdd('0x3f')]=_0x140a74;return _0x4dcc45;})['then'](respondWithFilteredResult(_0x1d3e5c,_0x1ddc77))[_0x9cdd('0x40')](handleError(_0x1d3e5c,null));};exports[_0x9cdd('0x41')]=function(_0x120814,_0x149972){var _0x43ed28={'raw':!![],'where':{'id':_0x120814[_0x9cdd('0x42')]['id']}},_0x427cf8={};_0x427cf8[_0x9cdd('0x2c')]=_[_0x9cdd('0x43')](db[_0x9cdd('0x3c')][_0x9cdd('0x2a')]);_0x427cf8['query']=_[_0x9cdd('0x43')](_0x120814[_0x9cdd('0x2d')]);_0x427cf8[_0x9cdd('0x2e')]=_['intersection'](_0x427cf8[_0x9cdd('0x2c')],_0x427cf8[_0x9cdd('0x2d')]);_0x43ed28[_0x9cdd('0x30')]=_[_0x9cdd('0x2f')](_0x427cf8[_0x9cdd('0x2c')],qs[_0x9cdd('0x31')](_0x120814[_0x9cdd('0x2d')][_0x9cdd('0x31')]));_0x43ed28[_0x9cdd('0x30')]=_0x43ed28[_0x9cdd('0x30')][_0x9cdd('0x32')]?_0x43ed28[_0x9cdd('0x30')]:_0x427cf8['model'];if(_0x120814[_0x9cdd('0x2d')][_0x9cdd('0x44')]){_0x43ed28[_0x9cdd('0x3d')]=[{'all':!![]}];}_0x43ed28=_['merge']({},_0x43ed28,_0x120814[_0x9cdd('0x45')]);return db[_0x9cdd('0x3c')][_0x9cdd('0x46')](_0x43ed28)[_0x9cdd('0x23')](handleEntityNotFound(_0x149972,null))['then'](respondWithResult(_0x149972,null))[_0x9cdd('0x40')](handleError(_0x149972,null));};exports[_0x9cdd('0x47')]=function(_0x226704,_0x3c6bc3){return db[_0x9cdd('0x3c')][_0x9cdd('0x47')](_0x226704[_0x9cdd('0x48')],{})['then'](respondWithResult(_0x3c6bc3,0xc9))[_0x9cdd('0x40')](handleError(_0x3c6bc3,null));};exports[_0x9cdd('0x21')]=function(_0x2635d1,_0x33d597){if(_0x2635d1['body']['id']){delete _0x2635d1['body']['id'];}return db[_0x9cdd('0x3c')][_0x9cdd('0x46')]({'where':{'id':_0x2635d1[_0x9cdd('0x42')]['id']}})[_0x9cdd('0x23')](handleEntityNotFound(_0x33d597,null))['then'](saveUpdates(_0x2635d1['body'],null))[_0x9cdd('0x23')](respondWithResult(_0x33d597,null))[_0x9cdd('0x40')](handleError(_0x33d597,null));};exports[_0x9cdd('0x22')]=function(_0x43ac38,_0x3c5eee){return db[_0x9cdd('0x3c')][_0x9cdd('0x46')]({'where':{'id':_0x43ac38[_0x9cdd('0x42')]['id']}})[_0x9cdd('0x23')](handleEntityNotFound(_0x3c5eee,null))['then'](removeEntity(_0x3c5eee,null))[_0x9cdd('0x40')](handleError(_0x3c5eee,null));};exports[_0x9cdd('0x49')]=function(_0x333540,_0x5a3362){return db['SmsQueueReport'][_0x9cdd('0x49')]()[_0x9cdd('0x23')](respondWithResult(_0x5a3362,null))[_0x9cdd('0x40')](handleError(_0x5a3362,null));}; \ No newline at end of file +var _0xd160=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xd160,0x16a));var _0x0d16=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xd160[_0x1928c9];return _0x51b5fb;};'use strict';var pdf=require(_0x0d16('0x0'));var emlformat=require(_0x0d16('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0d16('0x2'));var jsonpatch=require(_0x0d16('0x3'));var rp=require(_0x0d16('0x4'));var moment=require(_0x0d16('0x5'));var BPromise=require(_0x0d16('0x6'));var Mustache=require(_0x0d16('0x7'));var util=require(_0x0d16('0x8'));var path=require(_0x0d16('0x9'));var sox=require(_0x0d16('0xa'));var csv=require(_0x0d16('0xb'));var ejs=require(_0x0d16('0xc'));var fs=require('fs');var _=require(_0x0d16('0xd'));var squel=require(_0x0d16('0xe'));var crypto=require(_0x0d16('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0d16('0xb'));var querystring=require(_0x0d16('0x10'));var Papa=require(_0x0d16('0x11'));var Redis=require(_0x0d16('0x12'));var authService=require(_0x0d16('0x13'));var qs=require(_0x0d16('0x14'));var as=require(_0x0d16('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d16('0x16'))(_0x0d16('0x17'));var utils=require(_0x0d16('0x18'));var config=require(_0x0d16('0x19'));var licenseUtil=require(_0x0d16('0x1a'));var db=require(_0x0d16('0x1b'))['db'];function respondWithStatusCode(_0x29cb32,_0x21eefc){_0x21eefc=_0x21eefc||0xcc;return function(_0xbebb39){if(_0xbebb39){return _0x29cb32['sendStatus'](_0x21eefc);}return _0x29cb32[_0x0d16('0x1c')](_0x21eefc)[_0x0d16('0x1d')]();};}function respondWithResult(_0xcc219e,_0x2c50f2){_0x2c50f2=_0x2c50f2||0xc8;return function(_0x37f51c){if(_0x37f51c){return _0xcc219e[_0x0d16('0x1c')](_0x2c50f2)[_0x0d16('0x1e')](_0x37f51c);}};}function respondWithFilteredResult(_0x230c40,_0x4efc15){return function(_0xbcdfd7){if(_0xbcdfd7){var _0x4a3372=_0xbcdfd7[_0x0d16('0x1f')],_0x3989b7=_0x4efc15[_0x0d16('0x20')],_0x3a9709=_0x4efc15[_0x0d16('0x20')]+_0x4efc15[_0x0d16('0x21')],_0x22385d;if(_0x3a9709>=_0x4a3372){_0x3a9709=_0x4a3372;_0x22385d=0xc8;}else{_0x22385d=0xce;}_0x230c40[_0x0d16('0x1c')](_0x22385d);return _0x230c40[_0x0d16('0x22')](_0x0d16('0x23'),_0x3989b7+'-'+_0x3a9709+'/'+_0x4a3372)[_0x0d16('0x1e')](_0xbcdfd7);}return null;};}function patchUpdates(_0x228736){return function(_0x47cb1a){try{jsonpatch[_0x0d16('0x24')](_0x47cb1a,_0x228736,!![]);}catch(_0x4a2814){return BPromise[_0x0d16('0x25')](_0x4a2814);}return _0x47cb1a['save']();};}function saveUpdates(_0x4638f4,_0x49d9b4){return function(_0x3f94bf){if(_0x3f94bf){return _0x3f94bf[_0x0d16('0x26')](_0x4638f4)[_0x0d16('0x27')](function(_0x3b7bd5){return _0x3b7bd5;});}return null;};}function removeEntity(_0x53c61e,_0x5cf348){return function(_0x53d14d){if(_0x53d14d){return _0x53d14d[_0x0d16('0x28')]()[_0x0d16('0x27')](function(){_0x53c61e[_0x0d16('0x1c')](0xcc)[_0x0d16('0x1d')]();});}};}function handleEntityNotFound(_0x18ab2b,_0x5be0bc){return function(_0x1c00bd){if(!_0x1c00bd){_0x18ab2b['sendStatus'](0x194);}return _0x1c00bd;};}function handleError(_0x501afb,_0x12cbe0){_0x12cbe0=_0x12cbe0||0x1f4;return function(_0x3abd6e){logger['error'](_0x3abd6e[_0x0d16('0x29')]);if(_0x3abd6e[_0x0d16('0x2a')]){delete _0x3abd6e[_0x0d16('0x2a')];}_0x501afb[_0x0d16('0x1c')](_0x12cbe0)[_0x0d16('0x2b')](_0x3abd6e);};}exports[_0x0d16('0x2c')]=function(_0x2a7d8c,_0x289084){var _0x111d7f={},_0x5380de={},_0x1dc41d={'count':0x0,'rows':[]};var _0x3fb77f=_[_0x0d16('0x2d')](db[_0x0d16('0x2e')][_0x0d16('0x2f')],function(_0x4c58de){return{'name':_0x4c58de[_0x0d16('0x30')],'type':_0x4c58de[_0x0d16('0x31')][_0x0d16('0x32')]};});_0x5380de[_0x0d16('0x33')]=_[_0x0d16('0x2d')](_0x3fb77f,'name');_0x5380de[_0x0d16('0x34')]=_[_0x0d16('0x35')](_0x2a7d8c[_0x0d16('0x34')]);_0x5380de[_0x0d16('0x36')]=_[_0x0d16('0x37')](_0x5380de[_0x0d16('0x33')],_0x5380de[_0x0d16('0x34')]);_0x111d7f[_0x0d16('0x38')]=_[_0x0d16('0x37')](_0x5380de['model'],qs[_0x0d16('0x39')](_0x2a7d8c['query']['fields']));_0x111d7f[_0x0d16('0x38')]=_0x111d7f[_0x0d16('0x38')][_0x0d16('0x3a')]?_0x111d7f['attributes']:_0x5380de[_0x0d16('0x33')];if(!_0x2a7d8c['query'][_0x0d16('0x3b')]('nolimit')){_0x111d7f['limit']=qs[_0x0d16('0x21')](_0x2a7d8c[_0x0d16('0x34')][_0x0d16('0x21')]);_0x111d7f['offset']=qs['offset'](_0x2a7d8c[_0x0d16('0x34')][_0x0d16('0x20')]);}_0x111d7f['order']=qs[_0x0d16('0x3c')](_0x2a7d8c['query']['sort']);_0x111d7f[_0x0d16('0x3d')]=qs[_0x0d16('0x36')](_['pick'](_0x2a7d8c[_0x0d16('0x34')],_0x5380de[_0x0d16('0x36')]),_0x3fb77f);if(_0x2a7d8c[_0x0d16('0x34')][_0x0d16('0x3e')]){_0x111d7f[_0x0d16('0x3d')]=_[_0x0d16('0x3f')](_0x111d7f[_0x0d16('0x3d')],{'$or':_[_0x0d16('0x2d')](_0x3fb77f,function(_0x44febc){if(_0x44febc[_0x0d16('0x31')]!==_0x0d16('0x40')){var _0x51cd02={};_0x51cd02[_0x44febc['name']]={'$like':'%'+_0x2a7d8c[_0x0d16('0x34')][_0x0d16('0x3e')]+'%'};return _0x51cd02;}})});}_0x111d7f=_['merge']({},_0x111d7f,_0x2a7d8c[_0x0d16('0x41')]);var _0x1730fc={'where':_0x111d7f['where']};return db[_0x0d16('0x2e')]['count'](_0x1730fc)[_0x0d16('0x27')](function(_0x1d2727){_0x1dc41d[_0x0d16('0x1f')]=_0x1d2727;if(_0x2a7d8c[_0x0d16('0x34')][_0x0d16('0x42')]){_0x111d7f[_0x0d16('0x43')]=[{'all':!![]}];}return db[_0x0d16('0x2e')][_0x0d16('0x44')](_0x111d7f);})[_0x0d16('0x27')](function(_0x27ccad){_0x1dc41d[_0x0d16('0x45')]=_0x27ccad;return _0x1dc41d;})[_0x0d16('0x27')](respondWithFilteredResult(_0x289084,_0x111d7f))[_0x0d16('0x46')](handleError(_0x289084,null));};exports[_0x0d16('0x47')]=function(_0x2fffa2,_0x145030){var _0x3e3e5a={'raw':!![],'where':{'id':_0x2fffa2[_0x0d16('0x48')]['id']}},_0x497504={};_0x497504[_0x0d16('0x33')]=_[_0x0d16('0x35')](db[_0x0d16('0x2e')][_0x0d16('0x2f')]);_0x497504[_0x0d16('0x34')]=_[_0x0d16('0x35')](_0x2fffa2['query']);_0x497504['filters']=_['intersection'](_0x497504['model'],_0x497504[_0x0d16('0x34')]);_0x3e3e5a[_0x0d16('0x38')]=_['intersection'](_0x497504[_0x0d16('0x33')],qs[_0x0d16('0x39')](_0x2fffa2['query']['fields']));_0x3e3e5a[_0x0d16('0x38')]=_0x3e3e5a[_0x0d16('0x38')][_0x0d16('0x3a')]?_0x3e3e5a['attributes']:_0x497504[_0x0d16('0x33')];if(_0x2fffa2[_0x0d16('0x34')][_0x0d16('0x42')]){_0x3e3e5a[_0x0d16('0x43')]=[{'all':!![]}];}_0x3e3e5a=_[_0x0d16('0x3f')]({},_0x3e3e5a,_0x2fffa2['options']);return db[_0x0d16('0x2e')]['find'](_0x3e3e5a)[_0x0d16('0x27')](handleEntityNotFound(_0x145030,null))[_0x0d16('0x27')](respondWithResult(_0x145030,null))['catch'](handleError(_0x145030,null));};exports[_0x0d16('0x49')]=function(_0x173660,_0x4436c6){return db[_0x0d16('0x2e')][_0x0d16('0x49')](_0x173660[_0x0d16('0x4a')],{})[_0x0d16('0x27')](respondWithResult(_0x4436c6,0xc9))[_0x0d16('0x46')](handleError(_0x4436c6,null));};exports[_0x0d16('0x26')]=function(_0x45861e,_0x370d65){if(_0x45861e['body']['id']){delete _0x45861e[_0x0d16('0x4a')]['id'];}return db[_0x0d16('0x2e')][_0x0d16('0x4b')]({'where':{'id':_0x45861e[_0x0d16('0x48')]['id']}})[_0x0d16('0x27')](handleEntityNotFound(_0x370d65,null))[_0x0d16('0x27')](saveUpdates(_0x45861e[_0x0d16('0x4a')],null))[_0x0d16('0x27')](respondWithResult(_0x370d65,null))[_0x0d16('0x46')](handleError(_0x370d65,null));};exports[_0x0d16('0x28')]=function(_0x449939,_0x3e5d7e){return db[_0x0d16('0x2e')][_0x0d16('0x4b')]({'where':{'id':_0x449939[_0x0d16('0x48')]['id']}})['then'](handleEntityNotFound(_0x3e5d7e,null))[_0x0d16('0x27')](removeEntity(_0x3e5d7e,null))['catch'](handleError(_0x3e5d7e,null));};exports['describe']=function(_0x20d498,_0x37053c){return db['SmsQueueReport'][_0x0d16('0x4c')]()[_0x0d16('0x27')](respondWithResult(_0x37053c,null))['catch'](handleError(_0x37053c,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 33a5c88..1ad1708 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 _0x6898=['SmsQueueReport','report_sms_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','exports','define'];(function(_0x4a7ad5,_0x4244a1){var _0x5df916=function(_0x2c4fe9){while(--_0x2c4fe9){_0x4a7ad5['push'](_0x4a7ad5['shift']());}};_0x5df916(++_0x4244a1);}(_0x6898,0x11b));var _0x8689=function(_0x22e6b7,_0x287fc6){_0x22e6b7=_0x22e6b7-0x0;var _0x3b8e07=_0x6898[_0x22e6b7];return _0x3b8e07;};'use strict';var _=require(_0x8689('0x0'));var util=require('util');var logger=require(_0x8689('0x1'))(_0x8689('0x2'));var moment=require(_0x8689('0x3'));var BPromise=require(_0x8689('0x4'));var rp=require(_0x8689('0x5'));var fs=require('fs');var path=require(_0x8689('0x6'));var rimraf=require(_0x8689('0x7'));var config=require('../../config/environment');var attributes=require(_0x8689('0x8'));module[_0x8689('0x9')]=function(_0x2c723e,_0x4e776d){return _0x2c723e[_0x8689('0xa')](_0x8689('0xb'),attributes,{'tableName':_0x8689('0xc'),'paranoid':![],'indexes':[{'name':_0x8689('0xd'),'fields':[_0x8689('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9193=['exports','SmsQueueReport','uniqueid','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x316efa,_0x20a1e1){var _0x4d96cc=function(_0x4a0648){while(--_0x4a0648){_0x316efa['push'](_0x316efa['shift']());}};_0x4d96cc(++_0x20a1e1);}(_0x9193,0x1dc));var _0x3919=function(_0x213518,_0x51e022){_0x213518=_0x213518-0x0;var _0x1baf75=_0x9193[_0x213518];return _0x1baf75;};'use strict';var _=require(_0x3919('0x0'));var util=require('util');var logger=require(_0x3919('0x1'))(_0x3919('0x2'));var moment=require(_0x3919('0x3'));var BPromise=require(_0x3919('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3919('0x5'));var rimraf=require(_0x3919('0x6'));var config=require(_0x3919('0x7'));var attributes=require('./smsQueueReport.attributes');module[_0x3919('0x8')]=function(_0x524b32,_0x1173c1){return _0x524b32['define'](_0x3919('0x9'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3919('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 3fa5aff..f5e2787 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 _0x52b3=['debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','body','options','raw','stringify','UpdateSmsQueueReport','update','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'];(function(_0x5ae836,_0x971d2){var _0xb37a03=function(_0x32851d){while(--_0x32851d){_0x5ae836['push'](_0x5ae836['shift']());}};_0xb37a03(++_0x971d2);}(_0x52b3,0x7b));var _0x352b=function(_0x598c44,_0x26a8fe){_0x598c44=_0x598c44-0x0;var _0x56c4af=_0x52b3[_0x598c44];return _0x56c4af;};'use strict';var _=require(_0x352b('0x0'));var util=require('util');var moment=require(_0x352b('0x1'));var BPromise=require(_0x352b('0x2'));var rs=require(_0x352b('0x3'));var fs=require('fs');var Redis=require(_0x352b('0x4'));var db=require(_0x352b('0x5'))['db'];var utils=require(_0x352b('0x6'));var logger=require(_0x352b('0x7'))(_0x352b('0x8'));var config=require(_0x352b('0x9'));var jayson=require(_0x352b('0xa'));var client=jayson[_0x352b('0xb')][_0x352b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3321ab,_0x19d470,_0x207c3f){return new BPromise(function(_0x3b9209,_0x2c5d4c){return client[_0x352b('0xd')](_0x3321ab,_0x207c3f)[_0x352b('0xe')](function(_0x2d1ab7){logger['info'](_0x352b('0xf'),_0x19d470,_0x352b('0x10'));logger[_0x352b('0x11')](_0x352b('0x12'),_0x19d470,_0x352b('0x10'),JSON['stringify'](_0x2d1ab7));if(_0x2d1ab7[_0x352b('0x13')]){if(_0x2d1ab7['error'][_0x352b('0x14')]===0x1f4){logger[_0x352b('0x13')](_0x352b('0xf'),_0x19d470,_0x2d1ab7[_0x352b('0x13')][_0x352b('0x15')]);return _0x2c5d4c(_0x2d1ab7[_0x352b('0x13')][_0x352b('0x15')]);}logger[_0x352b('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x19d470,_0x2d1ab7[_0x352b('0x13')][_0x352b('0x15')]);return _0x3b9209(_0x2d1ab7[_0x352b('0x13')][_0x352b('0x15')]);}else{logger[_0x352b('0x16')](_0x352b('0xf'),_0x19d470,_0x352b('0x10'));_0x3b9209(_0x2d1ab7[_0x352b('0x17')][_0x352b('0x15')]);}})[_0x352b('0x18')](function(_0x18ad8f){logger['error'](_0x352b('0xf'),_0x19d470,_0x18ad8f);_0x2c5d4c(_0x18ad8f);});});}exports[_0x352b('0x19')]=function(_0x2bccaf){var _0x4ac268=this;return new Promise(function(_0x371b8d,_0x489e63){return db[_0x352b('0x1a')]['create'](_0x2bccaf[_0x352b('0x1b')],{'raw':_0x2bccaf[_0x352b('0x1c')]?_0x2bccaf['options'][_0x352b('0x1d')]===undefined?!![]:![]:!![]})[_0x352b('0xe')](function(_0x28f58a){logger['info']('CreateSmsQueueReport',_0x2bccaf);logger[_0x352b('0x11')](_0x352b('0x19'),_0x2bccaf,JSON[_0x352b('0x1e')](_0x28f58a));_0x371b8d(_0x28f58a);})[_0x352b('0x18')](function(_0x94e855){logger[_0x352b('0x13')](_0x352b('0x19'),_0x94e855[_0x352b('0x15')],_0x2bccaf);_0x489e63(_0x4ac268[_0x352b('0x13')](0x1f4,_0x94e855[_0x352b('0x15')]));});});};exports[_0x352b('0x1f')]=function(_0x4e3632){var _0x91f9f=this;return new Promise(function(_0x3bdc6c,_0x41579b){return db['SmsQueueReport'][_0x352b('0x20')](_0x4e3632[_0x352b('0x1b')],{'raw':_0x4e3632[_0x352b('0x1c')]?_0x4e3632['options'][_0x352b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e3632[_0x352b('0x1c')]?_0x4e3632[_0x352b('0x1c')][_0x352b('0x21')]||null:null,'attributes':_0x4e3632[_0x352b('0x1c')]?_0x4e3632[_0x352b('0x1c')]['attributes']||null:null,'limit':_0x4e3632['options']?_0x4e3632[_0x352b('0x1c')][_0x352b('0x22')]||null:null})[_0x352b('0xe')](function(_0x412da3){logger['info']('UpdateSmsQueueReport',_0x4e3632);logger[_0x352b('0x11')]('UpdateSmsQueueReport',_0x4e3632,JSON[_0x352b('0x1e')](_0x412da3));_0x3bdc6c(_0x412da3);})['catch'](function(_0x2031ce){logger[_0x352b('0x13')]('UpdateSmsQueueReport',_0x2031ce['message'],_0x4e3632);_0x41579b(_0x91f9f[_0x352b('0x13')](0x1f4,_0x2031ce[_0x352b('0x15')]));});});}; \ No newline at end of file +var _0x5d56=['where','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SmsQueueReport','create','body','options','CreateSmsQueueReport','UpdateSmsQueueReport','update'];(function(_0x29edb5,_0x5bdc4f){var _0x3218ee=function(_0x52e3dd){while(--_0x52e3dd){_0x29edb5['push'](_0x29edb5['shift']());}};_0x3218ee(++_0x5bdc4f);}(_0x5d56,0x1e3));var _0x65d5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5d56[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x65d5('0x0'));var util=require(_0x65d5('0x1'));var moment=require('moment');var BPromise=require(_0x65d5('0x2'));var rs=require(_0x65d5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65d5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x65d5('0x5'))('rpc');var config=require(_0x65d5('0x6'));var jayson=require(_0x65d5('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x17a040,_0x1ee95a,_0x505c31){return new BPromise(function(_0x55f0c4,_0x4862d8){return client[_0x65d5('0x8')](_0x17a040,_0x505c31)[_0x65d5('0x9')](function(_0x579e2c){logger[_0x65d5('0xa')](_0x65d5('0xb'),_0x1ee95a,_0x65d5('0xc'));logger[_0x65d5('0xd')](_0x65d5('0xe'),_0x1ee95a,'request\x20sent',JSON[_0x65d5('0xf')](_0x579e2c));if(_0x579e2c['error']){if(_0x579e2c['error']['code']===0x1f4){logger[_0x65d5('0x10')](_0x65d5('0xb'),_0x1ee95a,_0x579e2c['error'][_0x65d5('0x11')]);return _0x4862d8(_0x579e2c[_0x65d5('0x10')][_0x65d5('0x11')]);}logger[_0x65d5('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x1ee95a,_0x579e2c['error'][_0x65d5('0x11')]);return _0x55f0c4(_0x579e2c[_0x65d5('0x10')][_0x65d5('0x11')]);}else{logger['info'](_0x65d5('0xb'),_0x1ee95a,_0x65d5('0xc'));_0x55f0c4(_0x579e2c[_0x65d5('0x12')]['message']);}})[_0x65d5('0x13')](function(_0xe6c264){logger['error'](_0x65d5('0xb'),_0x1ee95a,_0xe6c264);_0x4862d8(_0xe6c264);});});}exports['CreateSmsQueueReport']=function(_0x55ce4a){var _0x351b4a=this;return new Promise(function(_0x448e32,_0x1a8db5){return db[_0x65d5('0x14')][_0x65d5('0x15')](_0x55ce4a[_0x65d5('0x16')],{'raw':_0x55ce4a['options']?_0x55ce4a[_0x65d5('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3fd802){logger[_0x65d5('0xa')](_0x65d5('0x18'),_0x55ce4a);logger['debug'](_0x65d5('0x18'),_0x55ce4a,JSON[_0x65d5('0xf')](_0x3fd802));_0x448e32(_0x3fd802);})['catch'](function(_0x7923a4){logger[_0x65d5('0x10')]('CreateSmsQueueReport',_0x7923a4[_0x65d5('0x11')],_0x55ce4a);_0x1a8db5(_0x351b4a[_0x65d5('0x10')](0x1f4,_0x7923a4[_0x65d5('0x11')]));});});};exports[_0x65d5('0x19')]=function(_0x29c54c){var _0x2d59ac=this;return new Promise(function(_0x47cc12,_0xbc7f74){return db['SmsQueueReport'][_0x65d5('0x1a')](_0x29c54c[_0x65d5('0x16')],{'raw':_0x29c54c[_0x65d5('0x17')]?_0x29c54c[_0x65d5('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29c54c[_0x65d5('0x17')]?_0x29c54c[_0x65d5('0x17')][_0x65d5('0x1b')]||null:null,'attributes':_0x29c54c[_0x65d5('0x17')]?_0x29c54c[_0x65d5('0x17')][_0x65d5('0x1c')]||null:null,'limit':_0x29c54c[_0x65d5('0x17')]?_0x29c54c[_0x65d5('0x17')][_0x65d5('0x1d')]||null:null})['then'](function(_0x4c7b85){logger[_0x65d5('0xa')]('UpdateSmsQueueReport',_0x29c54c);logger[_0x65d5('0xd')](_0x65d5('0x19'),_0x29c54c,JSON[_0x65d5('0xf')](_0x4c7b85));_0x47cc12(_0x4c7b85);})[_0x65d5('0x13')](function(_0xc19e48){logger[_0x65d5('0x10')](_0x65d5('0x19'),_0xc19e48[_0x65d5('0x11')],_0x29c54c);_0xbc7f74(_0x2d59ac['error'](0x1f4,_0xc19e48['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index f7074ab..49c2fd2 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 _0x34b7=['/:id','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe'];(function(_0x144c04,_0x253bb0){var _0x11b816=function(_0x20da5b){while(--_0x20da5b){_0x144c04['push'](_0x144c04['shift']());}};_0x11b816(++_0x253bb0);}(_0x34b7,0x196));var _0x734b=function(_0x5cfb92,_0x5797e6){_0x5cfb92=_0x5cfb92-0x0;var _0x1cd7c2=_0x34b7[_0x5cfb92];return _0x1cd7c2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x734b('0x0'));var timeout=require(_0x734b('0x1'));var express=require(_0x734b('0x2'));var router=express[_0x734b('0x3')]();var auth=require(_0x734b('0x4'));var interaction=require(_0x734b('0x5'));var config=require('../../config/environment');var controller=require('./smsTransferReport.controller');router[_0x734b('0x6')]('/',auth[_0x734b('0x7')](),controller[_0x734b('0x8')]);router[_0x734b('0x6')](_0x734b('0x9'),auth[_0x734b('0x7')](),controller['describe']);router[_0x734b('0x6')](_0x734b('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x734b('0x7')](),controller['create']);router[_0x734b('0xb')](_0x734b('0xa'),auth[_0x734b('0x7')](),controller[_0x734b('0xc')]);router[_0x734b('0xd')](_0x734b('0xa'),auth[_0x734b('0x7')](),controller[_0x734b('0xe')]);module[_0x734b('0xf')]=router; \ No newline at end of file +var _0x878f=['../../config/environment','./smsTransferReport.controller','get','isAuthenticated','/describe','create','put','update','/:id','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3f9e54,_0xc3ce2c){var _0x2ddce5=function(_0x4325b0){while(--_0x4325b0){_0x3f9e54['push'](_0x3f9e54['shift']());}};_0x2ddce5(++_0xc3ce2c);}(_0x878f,0x173));var _0xf878=function(_0x5174fb,_0xdc5763){_0x5174fb=_0x5174fb-0x0;var _0x403d97=_0x878f[_0x5174fb];return _0x403d97;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var auth=require(_0xf878('0x5'));var interaction=require(_0xf878('0x6'));var config=require(_0xf878('0x7'));var controller=require(_0xf878('0x8'));router[_0xf878('0x9')]('/',auth[_0xf878('0xa')](),controller['index']);router['get'](_0xf878('0xb'),auth[_0xf878('0xa')](),controller['describe']);router['get']('/:id',auth[_0xf878('0xa')](),controller['show']);router['post']('/',auth[_0xf878('0xa')](),controller[_0xf878('0xc')]);router[_0xf878('0xd')]('/:id',auth[_0xf878('0xa')](),controller[_0xf878('0xe')]);router['delete'](_0xf878('0xf'),auth['isAuthenticated'](),controller[_0xf878('0x10')]);module[_0xf878('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 986a780..110cf70 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 _0x0716=['exports','STRING','ENUM','account','queue','DATE','NOW','moment','sequelize'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x0716,0xa0));var _0x6071=function(_0x2375e1,_0x3d125a){_0x2375e1=_0x2375e1-0x0;var _0x2ccc7d=_0x0716[_0x2375e1];return _0x2ccc7d;};'use strict';var moment=require(_0x6071('0x0'));var Sequelize=require(_0x6071('0x1'));module[_0x6071('0x2')]={'uniqueid':{'type':Sequelize[_0x6071('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x6071('0x4')](_0x6071('0x5'),'agent','queue'),'allowNull':![],'defaultValue':_0x6071('0x6')},'transferredAt':{'type':Sequelize[_0x6071('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6071('0x8')]}}; \ No newline at end of file +var _0x1c93=['moment','exports','ENUM','account','agent','queue'];(function(_0xa33403,_0x2d9f67){var _0x245456=function(_0x1241c6){while(--_0x1241c6){_0xa33403['push'](_0xa33403['shift']());}};_0x245456(++_0x2d9f67);}(_0x1c93,0x180));var _0x31c9=function(_0x531e47,_0x386b48){_0x531e47=_0x531e47-0x0;var _0x491c04=_0x1c93[_0x531e47];return _0x491c04;};'use strict';var moment=require(_0x31c9('0x0'));var Sequelize=require('sequelize');module[_0x31c9('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x31c9('0x2')](_0x31c9('0x3'),_0x31c9('0x4'),_0x31c9('0x5')),'allowNull':![],'defaultValue':_0x31c9('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 738a307..427cd8e 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 _0x9de3=['sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','json','count','limit','set','Content-Range','apply','update','then','sendStatus','error','name','send','map','SmsTransferReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order'];(function(_0x3cf3fc,_0x499ca9){var _0x4eaa2d=function(_0x79b294){while(--_0x79b294){_0x3cf3fc['push'](_0x3cf3fc['shift']());}};_0x4eaa2d(++_0x499ca9);}(_0x9de3,0xea));var _0x39de=function(_0x1f4880,_0x91d6fd){_0x1f4880=_0x1f4880-0x0;var _0x319b72=_0x9de3[_0x1f4880];return _0x319b72;};'use strict';var pdf=require(_0x39de('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x39de('0x1'));var zipdir=require(_0x39de('0x2'));var jsonpatch=require(_0x39de('0x3'));var rp=require('request-promise');var moment=require(_0x39de('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x39de('0x5'));var util=require(_0x39de('0x6'));var path=require(_0x39de('0x7'));var sox=require(_0x39de('0x8'));var csv=require('to-csv');var ejs=require(_0x39de('0x9'));var fs=require('fs');var _=require(_0x39de('0xa'));var squel=require(_0x39de('0xb'));var crypto=require(_0x39de('0xc'));var jsforce=require(_0x39de('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x39de('0xe'));var Redis=require(_0x39de('0xf'));var authService=require(_0x39de('0x10'));var qs=require(_0x39de('0x11'));var as=require(_0x39de('0x12'));var hardwareService=require(_0x39de('0x13'));var logger=require(_0x39de('0x14'))(_0x39de('0x15'));var utils=require('../../config/utils');var config=require(_0x39de('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bd0f0,_0x35061b){_0x35061b=_0x35061b||0xcc;return function(_0x32d610){if(_0x32d610){return _0x2bd0f0['sendStatus'](_0x35061b);}return _0x2bd0f0[_0x39de('0x17')](_0x35061b)[_0x39de('0x18')]();};}function respondWithResult(_0x1318d8,_0x905132){_0x905132=_0x905132||0xc8;return function(_0x38fe3b){if(_0x38fe3b){return _0x1318d8[_0x39de('0x17')](_0x905132)[_0x39de('0x19')](_0x38fe3b);}};}function respondWithFilteredResult(_0x25ca17,_0xaff589){return function(_0x316fdb){if(_0x316fdb){var _0x4c56df=_0x316fdb[_0x39de('0x1a')],_0x1f36e0=_0xaff589['offset'],_0x1b5daa=_0xaff589['offset']+_0xaff589[_0x39de('0x1b')],_0x20bd18;if(_0x1b5daa>=_0x4c56df){_0x1b5daa=_0x4c56df;_0x20bd18=0xc8;}else{_0x20bd18=0xce;}_0x25ca17['status'](_0x20bd18);return _0x25ca17[_0x39de('0x1c')](_0x39de('0x1d'),_0x1f36e0+'-'+_0x1b5daa+'/'+_0x4c56df)['json'](_0x316fdb);}return null;};}function patchUpdates(_0x410995){return function(_0x5dcb96){try{jsonpatch[_0x39de('0x1e')](_0x5dcb96,_0x410995,!![]);}catch(_0x250553){return BPromise['reject'](_0x250553);}return _0x5dcb96['save']();};}function saveUpdates(_0xab6f89,_0x5e4ab2){return function(_0x552590){if(_0x552590){return _0x552590[_0x39de('0x1f')](_0xab6f89)[_0x39de('0x20')](function(_0xbcf67c){return _0xbcf67c;});}return null;};}function removeEntity(_0x292dda,_0x400d62){return function(_0x10c0fc){if(_0x10c0fc){return _0x10c0fc['destroy']()[_0x39de('0x20')](function(){_0x292dda[_0x39de('0x17')](0xcc)[_0x39de('0x18')]();});}};}function handleEntityNotFound(_0x578eaa,_0x372564){return function(_0x483d49){if(!_0x483d49){_0x578eaa[_0x39de('0x21')](0x194);}return _0x483d49;};}function handleError(_0x102c5b,_0x30c3e3){_0x30c3e3=_0x30c3e3||0x1f4;return function(_0x39d01a){logger[_0x39de('0x22')](_0x39d01a['stack']);if(_0x39d01a[_0x39de('0x23')]){delete _0x39d01a[_0x39de('0x23')];}_0x102c5b[_0x39de('0x17')](_0x30c3e3)[_0x39de('0x24')](_0x39d01a);};}exports['index']=function(_0x3fd91a,_0x59e64f){var _0x4c11b3={},_0x17d876={},_0x1d3b79={'count':0x0,'rows':[]};var _0xfd80c8=_[_0x39de('0x25')](db[_0x39de('0x26')]['rawAttributes'],function(_0x352060){return{'name':_0x352060[_0x39de('0x27')],'type':_0x352060[_0x39de('0x28')][_0x39de('0x29')]};});_0x17d876[_0x39de('0x2a')]=_[_0x39de('0x25')](_0xfd80c8,_0x39de('0x23'));_0x17d876['query']=_[_0x39de('0x2b')](_0x3fd91a[_0x39de('0x2c')]);_0x17d876[_0x39de('0x2d')]=_[_0x39de('0x2e')](_0x17d876['model'],_0x17d876[_0x39de('0x2c')]);_0x4c11b3[_0x39de('0x2f')]=_[_0x39de('0x2e')](_0x17d876[_0x39de('0x2a')],qs['fields'](_0x3fd91a[_0x39de('0x2c')][_0x39de('0x30')]));_0x4c11b3[_0x39de('0x2f')]=_0x4c11b3[_0x39de('0x2f')][_0x39de('0x31')]?_0x4c11b3['attributes']:_0x17d876['model'];if(!_0x3fd91a[_0x39de('0x2c')][_0x39de('0x32')](_0x39de('0x33'))){_0x4c11b3[_0x39de('0x1b')]=qs['limit'](_0x3fd91a[_0x39de('0x2c')]['limit']);_0x4c11b3[_0x39de('0x34')]=qs[_0x39de('0x34')](_0x3fd91a[_0x39de('0x2c')]['offset']);}_0x4c11b3[_0x39de('0x35')]=qs[_0x39de('0x36')](_0x3fd91a[_0x39de('0x2c')][_0x39de('0x36')]);_0x4c11b3[_0x39de('0x37')]=qs[_0x39de('0x2d')](_[_0x39de('0x38')](_0x3fd91a[_0x39de('0x2c')],_0x17d876[_0x39de('0x2d')]),_0xfd80c8);if(_0x3fd91a['query'][_0x39de('0x39')]){_0x4c11b3[_0x39de('0x37')]=_[_0x39de('0x3a')](_0x4c11b3[_0x39de('0x37')],{'$or':_[_0x39de('0x25')](_0xfd80c8,function(_0x4ca613){if(_0x4ca613[_0x39de('0x28')]!=='VIRTUAL'){var _0x10c6c3={};_0x10c6c3[_0x4ca613[_0x39de('0x23')]]={'$like':'%'+_0x3fd91a[_0x39de('0x2c')][_0x39de('0x39')]+'%'};return _0x10c6c3;}})});}_0x4c11b3=_[_0x39de('0x3a')]({},_0x4c11b3,_0x3fd91a[_0x39de('0x3b')]);var _0x2fdfd0={'where':_0x4c11b3[_0x39de('0x37')]};return db[_0x39de('0x26')]['count'](_0x2fdfd0)[_0x39de('0x20')](function(_0x3dd32d){_0x1d3b79[_0x39de('0x1a')]=_0x3dd32d;if(_0x3fd91a['query'][_0x39de('0x3c')]){_0x4c11b3[_0x39de('0x3d')]=[{'all':!![]}];}return db[_0x39de('0x26')][_0x39de('0x3e')](_0x4c11b3);})['then'](function(_0x4b21d9){_0x1d3b79[_0x39de('0x3f')]=_0x4b21d9;return _0x1d3b79;})[_0x39de('0x20')](respondWithFilteredResult(_0x59e64f,_0x4c11b3))[_0x39de('0x40')](handleError(_0x59e64f,null));};exports[_0x39de('0x41')]=function(_0x482084,_0x71c4b6){var _0x2565aa={'raw':!![],'where':{'id':_0x482084[_0x39de('0x42')]['id']}},_0x432ef5={};_0x432ef5[_0x39de('0x2a')]=_[_0x39de('0x2b')](db[_0x39de('0x26')][_0x39de('0x43')]);_0x432ef5['query']=_[_0x39de('0x2b')](_0x482084[_0x39de('0x2c')]);_0x432ef5[_0x39de('0x2d')]=_['intersection'](_0x432ef5[_0x39de('0x2a')],_0x432ef5[_0x39de('0x2c')]);_0x2565aa[_0x39de('0x2f')]=_['intersection'](_0x432ef5[_0x39de('0x2a')],qs[_0x39de('0x30')](_0x482084[_0x39de('0x2c')]['fields']));_0x2565aa[_0x39de('0x2f')]=_0x2565aa[_0x39de('0x2f')][_0x39de('0x31')]?_0x2565aa[_0x39de('0x2f')]:_0x432ef5['model'];if(_0x482084[_0x39de('0x2c')][_0x39de('0x3c')]){_0x2565aa['include']=[{'all':!![]}];}_0x2565aa=_['merge']({},_0x2565aa,_0x482084['options']);return db[_0x39de('0x26')][_0x39de('0x44')](_0x2565aa)[_0x39de('0x20')](handleEntityNotFound(_0x71c4b6,null))[_0x39de('0x20')](respondWithResult(_0x71c4b6,null))[_0x39de('0x40')](handleError(_0x71c4b6,null));};exports[_0x39de('0x45')]=function(_0x53c640,_0x278e68){return db[_0x39de('0x26')][_0x39de('0x45')](_0x53c640['body'],{})[_0x39de('0x20')](respondWithResult(_0x278e68,0xc9))[_0x39de('0x40')](handleError(_0x278e68,null));};exports['update']=function(_0x5ee1a6,_0x3dd0a3){if(_0x5ee1a6[_0x39de('0x46')]['id']){delete _0x5ee1a6['body']['id'];}return db[_0x39de('0x26')][_0x39de('0x44')]({'where':{'id':_0x5ee1a6['params']['id']}})[_0x39de('0x20')](handleEntityNotFound(_0x3dd0a3,null))[_0x39de('0x20')](saveUpdates(_0x5ee1a6[_0x39de('0x46')],null))[_0x39de('0x20')](respondWithResult(_0x3dd0a3,null))[_0x39de('0x40')](handleError(_0x3dd0a3,null));};exports['destroy']=function(_0x18abca,_0x3c9fd9){return db['SmsTransferReport'][_0x39de('0x44')]({'where':{'id':_0x18abca[_0x39de('0x42')]['id']}})['then'](handleEntityNotFound(_0x3c9fd9,null))['then'](removeEntity(_0x3c9fd9,null))[_0x39de('0x40')](handleError(_0x3c9fd9,null));};exports['describe']=function(_0xfacb66,_0x49025f){return db[_0x39de('0x26')][_0x39de('0x47')]()[_0x39de('0x20')](respondWithResult(_0x49025f,null))['catch'](handleError(_0x49025f,null));}; \ No newline at end of file +var _0xc090=['../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','then','sendStatus','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','length','include','find','create','body','update','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xc090,0x112));var _0x0c09=function(_0x1f44bb,_0x30bf74){_0x1f44bb=_0x1f44bb-0x0;var _0x321b75=_0xc090[_0x1f44bb];return _0x321b75;};'use strict';var pdf=require(_0x0c09('0x0'));var emlformat=require(_0x0c09('0x1'));var rimraf=require(_0x0c09('0x2'));var zipdir=require(_0x0c09('0x3'));var jsonpatch=require(_0x0c09('0x4'));var rp=require(_0x0c09('0x5'));var moment=require(_0x0c09('0x6'));var BPromise=require(_0x0c09('0x7'));var Mustache=require(_0x0c09('0x8'));var util=require('util');var path=require(_0x0c09('0x9'));var sox=require(_0x0c09('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0c09('0xb'));var squel=require('squel');var crypto=require(_0x0c09('0xc'));var jsforce=require(_0x0c09('0xd'));var deskjs=require(_0x0c09('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0c09('0xf'));var Papa=require(_0x0c09('0x10'));var Redis=require('ioredis');var authService=require(_0x0c09('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0c09('0x12'));var hardwareService=require(_0x0c09('0x13'));var logger=require(_0x0c09('0x14'))(_0x0c09('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0c09('0x16'))['db'];function respondWithStatusCode(_0x5d1d77,_0x59df8b){_0x59df8b=_0x59df8b||0xcc;return function(_0xbe8522){if(_0xbe8522){return _0x5d1d77['sendStatus'](_0x59df8b);}return _0x5d1d77[_0x0c09('0x17')](_0x59df8b)[_0x0c09('0x18')]();};}function respondWithResult(_0x21c45b,_0xeb18fb){_0xeb18fb=_0xeb18fb||0xc8;return function(_0x388b2e){if(_0x388b2e){return _0x21c45b[_0x0c09('0x17')](_0xeb18fb)[_0x0c09('0x19')](_0x388b2e);}};}function respondWithFilteredResult(_0x2dcdae,_0x367c86){return function(_0x264d21){if(_0x264d21){var _0x482dc1=_0x264d21[_0x0c09('0x1a')],_0x3ea66e=_0x367c86[_0x0c09('0x1b')],_0x38de60=_0x367c86[_0x0c09('0x1b')]+_0x367c86[_0x0c09('0x1c')],_0x173f4c;if(_0x38de60>=_0x482dc1){_0x38de60=_0x482dc1;_0x173f4c=0xc8;}else{_0x173f4c=0xce;}_0x2dcdae[_0x0c09('0x17')](_0x173f4c);return _0x2dcdae[_0x0c09('0x1d')](_0x0c09('0x1e'),_0x3ea66e+'-'+_0x38de60+'/'+_0x482dc1)[_0x0c09('0x19')](_0x264d21);}return null;};}function patchUpdates(_0x4ce3f8){return function(_0x519eea){try{jsonpatch[_0x0c09('0x1f')](_0x519eea,_0x4ce3f8,!![]);}catch(_0xfc30b){return BPromise['reject'](_0xfc30b);}return _0x519eea['save']();};}function saveUpdates(_0x2af860,_0x205962){return function(_0x28f9d9){if(_0x28f9d9){return _0x28f9d9['update'](_0x2af860)[_0x0c09('0x20')](function(_0x5d24cb){return _0x5d24cb;});}return null;};}function removeEntity(_0x3206b5,_0x5488ac){return function(_0x301938){if(_0x301938){return _0x301938['destroy']()[_0x0c09('0x20')](function(){_0x3206b5[_0x0c09('0x17')](0xcc)[_0x0c09('0x18')]();});}};}function handleEntityNotFound(_0x1dc995,_0xad7cf9){return function(_0x3fc5e4){if(!_0x3fc5e4){_0x1dc995[_0x0c09('0x21')](0x194);}return _0x3fc5e4;};}function handleError(_0x42932e,_0x4c7f0b){_0x4c7f0b=_0x4c7f0b||0x1f4;return function(_0x544ac4){logger[_0x0c09('0x22')](_0x544ac4[_0x0c09('0x23')]);if(_0x544ac4[_0x0c09('0x24')]){delete _0x544ac4[_0x0c09('0x24')];}_0x42932e[_0x0c09('0x17')](_0x4c7f0b)[_0x0c09('0x25')](_0x544ac4);};}exports[_0x0c09('0x26')]=function(_0x49d07a,_0x544393){var _0x28eebe={},_0x454dea={},_0x147627={'count':0x0,'rows':[]};var _0x2d499c=_[_0x0c09('0x27')](db[_0x0c09('0x28')][_0x0c09('0x29')],function(_0x376742){return{'name':_0x376742[_0x0c09('0x2a')],'type':_0x376742[_0x0c09('0x2b')]['key']};});_0x454dea['model']=_[_0x0c09('0x27')](_0x2d499c,_0x0c09('0x24'));_0x454dea['query']=_[_0x0c09('0x2c')](_0x49d07a[_0x0c09('0x2d')]);_0x454dea[_0x0c09('0x2e')]=_[_0x0c09('0x2f')](_0x454dea[_0x0c09('0x30')],_0x454dea[_0x0c09('0x2d')]);_0x28eebe['attributes']=_[_0x0c09('0x2f')](_0x454dea[_0x0c09('0x30')],qs[_0x0c09('0x31')](_0x49d07a['query'][_0x0c09('0x31')]));_0x28eebe['attributes']=_0x28eebe['attributes']['length']?_0x28eebe[_0x0c09('0x32')]:_0x454dea[_0x0c09('0x30')];if(!_0x49d07a[_0x0c09('0x2d')][_0x0c09('0x33')](_0x0c09('0x34'))){_0x28eebe[_0x0c09('0x1c')]=qs['limit'](_0x49d07a[_0x0c09('0x2d')][_0x0c09('0x1c')]);_0x28eebe['offset']=qs[_0x0c09('0x1b')](_0x49d07a['query']['offset']);}_0x28eebe[_0x0c09('0x35')]=qs['sort'](_0x49d07a['query'][_0x0c09('0x36')]);_0x28eebe[_0x0c09('0x37')]=qs[_0x0c09('0x2e')](_[_0x0c09('0x38')](_0x49d07a[_0x0c09('0x2d')],_0x454dea[_0x0c09('0x2e')]),_0x2d499c);if(_0x49d07a[_0x0c09('0x2d')]['filter']){_0x28eebe[_0x0c09('0x37')]=_[_0x0c09('0x39')](_0x28eebe[_0x0c09('0x37')],{'$or':_[_0x0c09('0x27')](_0x2d499c,function(_0x298239){if(_0x298239[_0x0c09('0x2b')]!==_0x0c09('0x3a')){var _0x3afc74={};_0x3afc74[_0x298239[_0x0c09('0x24')]]={'$like':'%'+_0x49d07a[_0x0c09('0x2d')][_0x0c09('0x3b')]+'%'};return _0x3afc74;}})});}_0x28eebe=_[_0x0c09('0x39')]({},_0x28eebe,_0x49d07a[_0x0c09('0x3c')]);var _0x13d02b={'where':_0x28eebe[_0x0c09('0x37')]};return db[_0x0c09('0x28')][_0x0c09('0x1a')](_0x13d02b)[_0x0c09('0x20')](function(_0x3ba40d){_0x147627[_0x0c09('0x1a')]=_0x3ba40d;if(_0x49d07a[_0x0c09('0x2d')][_0x0c09('0x3d')]){_0x28eebe['include']=[{'all':!![]}];}return db['SmsTransferReport']['findAll'](_0x28eebe);})[_0x0c09('0x20')](function(_0x3b89cc){_0x147627[_0x0c09('0x3e')]=_0x3b89cc;return _0x147627;})[_0x0c09('0x20')](respondWithFilteredResult(_0x544393,_0x28eebe))[_0x0c09('0x3f')](handleError(_0x544393,null));};exports[_0x0c09('0x40')]=function(_0x55924a,_0x4454cf){var _0x29418c={'raw':!![],'where':{'id':_0x55924a[_0x0c09('0x41')]['id']}},_0x5513eb={};_0x5513eb[_0x0c09('0x30')]=_['keys'](db[_0x0c09('0x28')][_0x0c09('0x29')]);_0x5513eb['query']=_[_0x0c09('0x2c')](_0x55924a[_0x0c09('0x2d')]);_0x5513eb['filters']=_[_0x0c09('0x2f')](_0x5513eb[_0x0c09('0x30')],_0x5513eb[_0x0c09('0x2d')]);_0x29418c[_0x0c09('0x32')]=_[_0x0c09('0x2f')](_0x5513eb[_0x0c09('0x30')],qs[_0x0c09('0x31')](_0x55924a[_0x0c09('0x2d')]['fields']));_0x29418c[_0x0c09('0x32')]=_0x29418c[_0x0c09('0x32')][_0x0c09('0x42')]?_0x29418c['attributes']:_0x5513eb[_0x0c09('0x30')];if(_0x55924a[_0x0c09('0x2d')][_0x0c09('0x3d')]){_0x29418c[_0x0c09('0x43')]=[{'all':!![]}];}_0x29418c=_[_0x0c09('0x39')]({},_0x29418c,_0x55924a[_0x0c09('0x3c')]);return db[_0x0c09('0x28')][_0x0c09('0x44')](_0x29418c)['then'](handleEntityNotFound(_0x4454cf,null))[_0x0c09('0x20')](respondWithResult(_0x4454cf,null))[_0x0c09('0x3f')](handleError(_0x4454cf,null));};exports[_0x0c09('0x45')]=function(_0x1cab77,_0x57b481){return db[_0x0c09('0x28')][_0x0c09('0x45')](_0x1cab77[_0x0c09('0x46')],{})[_0x0c09('0x20')](respondWithResult(_0x57b481,0xc9))[_0x0c09('0x3f')](handleError(_0x57b481,null));};exports[_0x0c09('0x47')]=function(_0x2c4755,_0x160bca){if(_0x2c4755[_0x0c09('0x46')]['id']){delete _0x2c4755[_0x0c09('0x46')]['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x2c4755[_0x0c09('0x41')]['id']}})[_0x0c09('0x20')](handleEntityNotFound(_0x160bca,null))[_0x0c09('0x20')](saveUpdates(_0x2c4755[_0x0c09('0x46')],null))[_0x0c09('0x20')](respondWithResult(_0x160bca,null))[_0x0c09('0x3f')](handleError(_0x160bca,null));};exports[_0x0c09('0x48')]=function(_0x5664d1,_0x40066e){return db[_0x0c09('0x28')]['find']({'where':{'id':_0x5664d1[_0x0c09('0x41')]['id']}})[_0x0c09('0x20')](handleEntityNotFound(_0x40066e,null))[_0x0c09('0x20')](removeEntity(_0x40066e,null))['catch'](handleError(_0x40066e,null));};exports['describe']=function(_0x18e148,_0x24a0c4){return db[_0x0c09('0x28')][_0x0c09('0x49')]()[_0x0c09('0x20')](respondWithResult(_0x24a0c4,null))['catch'](handleError(_0x24a0c4,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 0370c96..9a84a4d 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 _0xadb5=['exports','define','SmsTransferReport','report_sms_transfer','uniqueid','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2d042c,_0x25b1ec){var _0x61b7bc=function(_0x468aa5){while(--_0x468aa5){_0x2d042c['push'](_0x2d042c['shift']());}};_0x61b7bc(++_0x25b1ec);}(_0xadb5,0xad));var _0x5adb=function(_0x40d2fc,_0x423de7){_0x40d2fc=_0x40d2fc-0x0;var _0x547724=_0xadb5[_0x40d2fc];return _0x547724;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./smsTransferReport.attributes');module[_0x5adb('0x7')]=function(_0x168d89,_0x3e2555){return _0x168d89[_0x5adb('0x8')](_0x5adb('0x9'),attributes,{'tableName':_0x5adb('0xa'),'paranoid':![],'indexes':[{'name':_0x5adb('0xb'),'fields':[_0x5adb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0f4d=['define','SmsTransferReport','uniqueid','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports'];(function(_0x48828f,_0x3ca36c){var _0x1c1df2=function(_0x168840){while(--_0x168840){_0x48828f['push'](_0x48828f['shift']());}};_0x1c1df2(++_0x3ca36c);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x47f9d7,_0x27b020){_0x47f9d7=_0x47f9d7-0x0;var _0x544a1c=_0x0f4d[_0x47f9d7];return _0x544a1c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd0f4('0x0'));var moment=require('moment');var BPromise=require(_0xd0f4('0x1'));var rp=require(_0xd0f4('0x2'));var fs=require('fs');var path=require(_0xd0f4('0x3'));var rimraf=require(_0xd0f4('0x4'));var config=require(_0xd0f4('0x5'));var attributes=require(_0xd0f4('0x6'));module[_0xd0f4('0x7')]=function(_0x1d9a9d,_0x531f85){return _0x1d9a9d[_0xd0f4('0x8')](_0xd0f4('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xd0f4('0xa'),'fields':[_0xd0f4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 16f42ad..190548a 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 _0xabd8=['SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x4a4c78,_0x13d5b7){var _0xd58f32=function(_0x32cc8e){while(--_0x32cc8e){_0x4a4c78['push'](_0x4a4c78['shift']());}};_0xd58f32(++_0x13d5b7);}(_0xabd8,0x14f));var _0x8abd=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xabd8[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0x8abd('0x0'));var util=require(_0x8abd('0x1'));var moment=require(_0x8abd('0x2'));var BPromise=require(_0x8abd('0x3'));var rs=require(_0x8abd('0x4'));var fs=require('fs');var Redis=require(_0x8abd('0x5'));var db=require(_0x8abd('0x6'))['db'];var utils=require(_0x8abd('0x7'));var logger=require(_0x8abd('0x8'))('rpc');var config=require(_0x8abd('0x9'));var jayson=require(_0x8abd('0xa'));var client=jayson['client'][_0x8abd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x401004,_0x179f47,_0x22b1a5){return new BPromise(function(_0x5d6598,_0x3dbfd4){return client[_0x8abd('0xc')](_0x401004,_0x22b1a5)[_0x8abd('0xd')](function(_0x4b8913){logger[_0x8abd('0xe')](_0x8abd('0xf'),_0x179f47,_0x8abd('0x10'));logger[_0x8abd('0x11')](_0x8abd('0x12'),_0x179f47,_0x8abd('0x10'),JSON[_0x8abd('0x13')](_0x4b8913));if(_0x4b8913[_0x8abd('0x14')]){if(_0x4b8913['error'][_0x8abd('0x15')]===0x1f4){logger[_0x8abd('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x179f47,_0x4b8913[_0x8abd('0x14')][_0x8abd('0x16')]);return _0x3dbfd4(_0x4b8913[_0x8abd('0x14')][_0x8abd('0x16')]);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x179f47,_0x4b8913['error'][_0x8abd('0x16')]);return _0x5d6598(_0x4b8913[_0x8abd('0x14')][_0x8abd('0x16')]);}else{logger[_0x8abd('0xe')](_0x8abd('0xf'),_0x179f47,_0x8abd('0x10'));_0x5d6598(_0x4b8913[_0x8abd('0x17')][_0x8abd('0x16')]);}})[_0x8abd('0x18')](function(_0x440bcc){logger[_0x8abd('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x179f47,_0x440bcc);_0x3dbfd4(_0x440bcc);});});} \ No newline at end of file +var _0xfd82=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x34c060,_0x36ba9d){var _0x23eb27=function(_0x38d8a0){while(--_0x38d8a0){_0x34c060['push'](_0x34c060['shift']());}};_0x23eb27(++_0x36ba9d);}(_0xfd82,0x144));var _0x2fd8=function(_0x444a8b,_0x526b10){_0x444a8b=_0x444a8b-0x0;var _0x2cebf5=_0xfd82[_0x444a8b];return _0x2cebf5;};'use strict';var _=require(_0x2fd8('0x0'));var util=require(_0x2fd8('0x1'));var moment=require('moment');var BPromise=require(_0x2fd8('0x2'));var rs=require(_0x2fd8('0x3'));var fs=require('fs');var Redis=require(_0x2fd8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2fd8('0x5'));var logger=require(_0x2fd8('0x6'))(_0x2fd8('0x7'));var config=require(_0x2fd8('0x8'));var jayson=require(_0x2fd8('0x9'));var client=jayson[_0x2fd8('0xa')][_0x2fd8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5245d2,_0x320b04,_0x236d36){return new BPromise(function(_0xdc8669,_0x32fff3){return client[_0x2fd8('0xc')](_0x5245d2,_0x236d36)[_0x2fd8('0xd')](function(_0x48f946){logger['info'](_0x2fd8('0xe'),_0x320b04,_0x2fd8('0xf'));logger['debug'](_0x2fd8('0x10'),_0x320b04,'request\x20sent',JSON[_0x2fd8('0x11')](_0x48f946));if(_0x48f946[_0x2fd8('0x12')]){if(_0x48f946[_0x2fd8('0x12')][_0x2fd8('0x13')]===0x1f4){logger[_0x2fd8('0x12')](_0x2fd8('0xe'),_0x320b04,_0x48f946['error'][_0x2fd8('0x14')]);return _0x32fff3(_0x48f946[_0x2fd8('0x12')]['message']);}logger[_0x2fd8('0x12')](_0x2fd8('0xe'),_0x320b04,_0x48f946[_0x2fd8('0x12')]['message']);return _0xdc8669(_0x48f946['error'][_0x2fd8('0x14')]);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x320b04,_0x2fd8('0xf'));_0xdc8669(_0x48f946[_0x2fd8('0x15')][_0x2fd8('0x14')]);}})['catch'](function(_0x161fd0){logger[_0x2fd8('0x12')](_0x2fd8('0xe'),_0x320b04,_0x161fd0);_0x32fff3(_0x161fd0);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index fb18deb..34ff51a 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 _0xb87a=['put','update','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','index','get','/:id','show','/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname','format','%s-%s%s','basename','extname','now','post','single','file','create'];(function(_0x4e54a0,_0x285242){var _0x5ca2dd=function(_0x356538){while(--_0x356538){_0x4e54a0['push'](_0x4e54a0['shift']());}};_0x5ca2dd(++_0x285242);}(_0xb87a,0xe4));var _0xab87=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xb87a[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require('multer');var util=require(_0xab87('0x0'));var path=require('path');var timeout=require(_0xab87('0x1'));var express=require(_0xab87('0x2'));var router=express[_0xab87('0x3')]();var auth=require(_0xab87('0x4'));var interaction=require(_0xab87('0x5'));var config=require(_0xab87('0x6'));var controller=require(_0xab87('0x7'));router['get']('/',auth[_0xab87('0x8')](),controller[_0xab87('0x9')]);router[_0xab87('0xa')](_0xab87('0xb'),auth[_0xab87('0x8')](),controller[_0xab87('0xc')]);router[_0xab87('0xa')](_0xab87('0xd'),auth[_0xab87('0x8')](),controller[_0xab87('0xe')]);var upload=multer({'storage':multer[_0xab87('0xf')]({'destination':function(_0x3949cb,_0x1e5af2,_0x57ce7e){_0x57ce7e(null,path['join'](config[_0xab87('0x10')],_0xab87('0x11')));},'filename':function(_0x13df38,_0x324de6,_0x4387d0){_0x324de6[_0xab87('0x12')]=_0x324de6['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4387d0(null,util[_0xab87('0x13')](_0xab87('0x14'),path[_0xab87('0x15')](_0x324de6[_0xab87('0x12')],path[_0xab87('0x16')](_0x324de6[_0xab87('0x12')])),Date[_0xab87('0x17')](),path[_0xab87('0x16')](_0x324de6[_0xab87('0x12')])));}})});router[_0xab87('0x18')]('/',upload[_0xab87('0x19')](_0xab87('0x1a')),controller[_0xab87('0x1b')]);router[_0xab87('0x1c')](_0xab87('0xb'),auth[_0xab87('0x8')](),controller[_0xab87('0x1d')]);router[_0xab87('0x1e')](_0xab87('0xb'),auth['isAuthenticated'](),controller['delete']);module[_0xab87('0x1f')]=router; \ No newline at end of file +var _0x2e9e=['download','join','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','create','put','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x140614,_0x50e9dd){var _0x1e2ea2=function(_0x228fd4){while(--_0x228fd4){_0x140614['push'](_0x140614['shift']());}};_0x1e2ea2(++_0x50e9dd);}(_0x2e9e,0x1ae));var _0xe2e9=function(_0x1ac5fb,_0x402eea){_0x1ac5fb=_0x1ac5fb-0x0;var _0x21df75=_0x2e9e[_0x1ac5fb];return _0x21df75;};'use strict';var multer=require(_0xe2e9('0x0'));var util=require('util');var path=require(_0xe2e9('0x1'));var timeout=require(_0xe2e9('0x2'));var express=require(_0xe2e9('0x3'));var router=express[_0xe2e9('0x4')]();var auth=require(_0xe2e9('0x5'));var interaction=require(_0xe2e9('0x6'));var config=require(_0xe2e9('0x7'));var controller=require('./sound.controller');router[_0xe2e9('0x8')]('/',auth[_0xe2e9('0x9')](),controller['index']);router['get'](_0xe2e9('0xa'),auth[_0xe2e9('0x9')](),controller[_0xe2e9('0xb')]);router[_0xe2e9('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xe2e9('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x36ba49,_0x25dadb,_0x3c0bc0){_0x3c0bc0(null,path[_0xe2e9('0xd')](config['root'],_0xe2e9('0xe')));},'filename':function(_0x2160a8,_0x200d08,_0x632448){_0x200d08[_0xe2e9('0xf')]=_0x200d08['originalname'][_0xe2e9('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x632448(null,util[_0xe2e9('0x11')](_0xe2e9('0x12'),path[_0xe2e9('0x13')](_0x200d08[_0xe2e9('0xf')],path[_0xe2e9('0x14')](_0x200d08[_0xe2e9('0xf')])),Date[_0xe2e9('0x15')](),path['extname'](_0x200d08[_0xe2e9('0xf')])));}})});router['post']('/',upload['single']('file'),controller[_0xe2e9('0x16')]);router[_0xe2e9('0x17')](_0xe2e9('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xe2e9('0x18')](_0xe2e9('0xa'),auth['isAuthenticated'](),controller['delete']);module[_0xe2e9('0x19')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 34ab102..ac284a6 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 _0x3a3e=['BIGINT','FLOAT','INTEGER','exports','STRING'];(function(_0x4471b3,_0x511a9f){var _0x386593=function(_0x1057e2){while(--_0x1057e2){_0x4471b3['push'](_0x4471b3['shift']());}};_0x386593(++_0x511a9f);}(_0x3a3e,0x1f2));var _0xe3a3=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x3a3e[_0x2d2c16];return _0x53f2fb;};'use strict';var Sequelize=require('sequelize');module[_0xe3a3('0x0')]={'name':{'type':Sequelize[_0xe3a3('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xe3a3('0x1')]},'display_name':{'type':Sequelize[_0xe3a3('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xe3a3('0x1')]},'original_format':{'type':Sequelize[_0xe3a3('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0xe3a3('0x2')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xe3a3('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xe3a3('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xe3a3('0x4')]}}; \ No newline at end of file +var _0x0603=['STRING','name','FLOAT','BIGINT','INTEGER','sequelize'];(function(_0x430296,_0x13f74f){var _0x4175e7=function(_0x529f17){while(--_0x529f17){_0x430296['push'](_0x430296['shift']());}};_0x4175e7(++_0x13f74f);}(_0x0603,0xe3));var _0x3060=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x0603[_0x2235bf];return _0x4c3a64;};'use strict';var Sequelize=require(_0x3060('0x0'));module['exports']={'name':{'type':Sequelize[_0x3060('0x1')],'unique':_0x3060('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x3060('0x1')]},'display_name':{'type':Sequelize[_0x3060('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x3060('0x1')]},'original_format':{'type':Sequelize[_0x3060('0x1')]},'original_duration':{'type':Sequelize[_0x3060('0x3')]},'original_sampleCount':{'type':Sequelize[_0x3060('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x3060('0x4')]},'original_sampleRate':{'type':Sequelize[_0x3060('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x3060('0x4')]},'converted_channelCount':{'type':Sequelize[_0x3060('0x5')]},'converted_bitRate':{'type':Sequelize[_0x3060('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x3060('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index a1f0905..5a75a8d 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 _0xcc5b=['show','params','rawAttributes','include','find','download','converted_format','existsSync','join','save_name','Sequelize','ValidationError','Sound\x20not\x20found','server/files/sounds/converted','format','%s.%s','create','basename','file','originalname','extname','filename','substring','server/files/sounds/original','root','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','wav','error','unlinkSync','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','body','userProfileId','role','user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','original_format','html-pdf','eml-format','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','Sounds','end','sendStatus','name','send','index','map','Sound','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch'];(function(_0x35daf5,_0x1cb0a8){var _0x9151e=function(_0x3c5cec){while(--_0x3c5cec){_0x35daf5['push'](_0x35daf5['shift']());}};_0x9151e(++_0x1cb0a8);}(_0xcc5b,0x1aa));var _0xbcc5=function(_0x12f054,_0x508c2d){_0x12f054=_0x12f054-0x0;var _0x36f9f3=_0xcc5b[_0x12f054];return _0x36f9f3;};'use strict';var pdf=require(_0xbcc5('0x0'));var emlformat=require(_0xbcc5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbcc5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbcc5('0x3'));var util=require(_0xbcc5('0x4'));var path=require(_0xbcc5('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbcc5('0x6'));var fs=require('fs');var _=require(_0xbcc5('0x7'));var squel=require('squel');var crypto=require(_0xbcc5('0x8'));var jsforce=require(_0xbcc5('0x9'));var deskjs=require(_0xbcc5('0xa'));var toCsv=require(_0xbcc5('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbcc5('0xc'));var authService=require(_0xbcc5('0xd'));var qs=require(_0xbcc5('0xe'));var as=require(_0xbcc5('0xf'));var hardwareService=require(_0xbcc5('0x10'));var logger=require(_0xbcc5('0x11'))(_0xbcc5('0x12'));var utils=require('../../config/utils');var config=require(_0xbcc5('0x13'));var licenseUtil=require(_0xbcc5('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x499700,_0x3af35a){_0x3af35a=_0x3af35a||0xcc;return function(_0x5b7ee4){if(_0x5b7ee4){return _0x499700['sendStatus'](_0x3af35a);}return _0x499700['status'](_0x3af35a)['end']();};}function respondWithResult(_0x4e60c0,_0x4a0ed5){_0x4a0ed5=_0x4a0ed5||0xc8;return function(_0x11654b){if(_0x11654b){return _0x4e60c0[_0xbcc5('0x15')](_0x4a0ed5)[_0xbcc5('0x16')](_0x11654b);}};}function respondWithFilteredResult(_0x27cadf,_0x4fc1fb){return function(_0x3557e4){if(_0x3557e4){var _0x2e08c8=_0x3557e4[_0xbcc5('0x17')],_0x35c03c=_0x4fc1fb[_0xbcc5('0x18')],_0x36773e=_0x4fc1fb[_0xbcc5('0x18')]+_0x4fc1fb[_0xbcc5('0x19')],_0xfc4722;if(_0x36773e>=_0x2e08c8){_0x36773e=_0x2e08c8;_0xfc4722=0xc8;}else{_0xfc4722=0xce;}_0x27cadf[_0xbcc5('0x15')](_0xfc4722);return _0x27cadf[_0xbcc5('0x1a')]('Content-Range',_0x35c03c+'-'+_0x36773e+'/'+_0x2e08c8)[_0xbcc5('0x16')](_0x3557e4);}return null;};}function patchUpdates(_0x50baa4){return function(_0x128d0a){try{jsonpatch[_0xbcc5('0x1b')](_0x128d0a,_0x50baa4,!![]);}catch(_0x31e86b){return BPromise[_0xbcc5('0x1c')](_0x31e86b);}return _0x128d0a[_0xbcc5('0x1d')]();};}function saveUpdates(_0x30b77,_0x5238cb){return function(_0x4d55cc){if(_0x4d55cc){return _0x4d55cc[_0xbcc5('0x1e')](_0x30b77)[_0xbcc5('0x1f')](function(_0x42bb38){return _0x42bb38;});}return null;};}function removeEntity(_0x5431f2,_0x875bf6){return function(_0x1acfe9){if(_0x1acfe9){return _0x1acfe9[_0xbcc5('0x20')]()['then'](function(){var _0x3bf0c8=_0x1acfe9[_0xbcc5('0x21')]({'plain':!![]});var _0x17ba72=_0xbcc5('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x17ba72,'resourceId':_0x3bf0c8['id']}})['then'](function(){return _0x1acfe9;});})['then'](function(){_0x5431f2[_0xbcc5('0x15')](0xcc)[_0xbcc5('0x23')]();});}};}function handleEntityNotFound(_0x33a093,_0x2a148f){return function(_0x1d27cf){if(!_0x1d27cf){_0x33a093[_0xbcc5('0x24')](0x194);}return _0x1d27cf;};}function handleError(_0x4d9681,_0x48c62a){_0x48c62a=_0x48c62a||0x1f4;return function(_0x388e0c){logger['error'](_0x388e0c['stack']);if(_0x388e0c['name']){delete _0x388e0c[_0xbcc5('0x25')];}_0x4d9681[_0xbcc5('0x15')](_0x48c62a)[_0xbcc5('0x26')](_0x388e0c);};}exports[_0xbcc5('0x27')]=function(_0x173556,_0x7dec22){var _0x50b293={},_0xf8006c={},_0x13af19={'count':0x0,'rows':[]};var _0x21e662=_[_0xbcc5('0x28')](db[_0xbcc5('0x29')]['rawAttributes'],function(_0x4f8f71){return{'name':_0x4f8f71[_0xbcc5('0x2a')],'type':_0x4f8f71[_0xbcc5('0x2b')][_0xbcc5('0x2c')]};});_0xf8006c[_0xbcc5('0x2d')]=_[_0xbcc5('0x28')](_0x21e662,_0xbcc5('0x25'));_0xf8006c[_0xbcc5('0x2e')]=_[_0xbcc5('0x2f')](_0x173556[_0xbcc5('0x2e')]);_0xf8006c[_0xbcc5('0x30')]=_['intersection'](_0xf8006c[_0xbcc5('0x2d')],_0xf8006c[_0xbcc5('0x2e')]);_0x50b293['attributes']=_[_0xbcc5('0x31')](_0xf8006c['model'],qs['fields'](_0x173556[_0xbcc5('0x2e')][_0xbcc5('0x32')]));_0x50b293[_0xbcc5('0x33')]=_0x50b293[_0xbcc5('0x33')][_0xbcc5('0x34')]?_0x50b293[_0xbcc5('0x33')]:_0xf8006c[_0xbcc5('0x2d')];if(!_0x173556[_0xbcc5('0x2e')][_0xbcc5('0x35')](_0xbcc5('0x36'))){_0x50b293['limit']=qs[_0xbcc5('0x19')](_0x173556[_0xbcc5('0x2e')][_0xbcc5('0x19')]);_0x50b293[_0xbcc5('0x18')]=qs['offset'](_0x173556['query'][_0xbcc5('0x18')]);}_0x50b293[_0xbcc5('0x37')]=qs[_0xbcc5('0x38')](_0x173556[_0xbcc5('0x2e')]['sort']);_0x50b293[_0xbcc5('0x39')]=qs[_0xbcc5('0x30')](_[_0xbcc5('0x3a')](_0x173556[_0xbcc5('0x2e')],_0xf8006c[_0xbcc5('0x30')]),_0x21e662);if(_0x173556[_0xbcc5('0x2e')][_0xbcc5('0x3b')]){_0x50b293[_0xbcc5('0x39')]=_[_0xbcc5('0x3c')](_0x50b293[_0xbcc5('0x39')],{'$or':_[_0xbcc5('0x28')](_0x21e662,function(_0x40d9fa){if(_0x40d9fa[_0xbcc5('0x2b')]!=='VIRTUAL'){var _0x562d06={};_0x562d06[_0x40d9fa[_0xbcc5('0x25')]]={'$like':'%'+_0x173556[_0xbcc5('0x2e')][_0xbcc5('0x3b')]+'%'};return _0x562d06;}})});}_0x50b293=_['merge']({},_0x50b293,_0x173556[_0xbcc5('0x3d')]);var _0x37040d={'where':_0x50b293[_0xbcc5('0x39')]};return db[_0xbcc5('0x29')]['count'](_0x37040d)[_0xbcc5('0x1f')](function(_0x240a74){_0x13af19[_0xbcc5('0x17')]=_0x240a74;if(_0x173556['query'][_0xbcc5('0x3e')]){_0x50b293['include']=[{'all':!![]}];}return db['Sound'][_0xbcc5('0x3f')](_0x50b293);})[_0xbcc5('0x1f')](function(_0x5011f9){_0x13af19[_0xbcc5('0x40')]=_0x5011f9;return _0x13af19;})[_0xbcc5('0x1f')](respondWithFilteredResult(_0x7dec22,_0x50b293))[_0xbcc5('0x41')](handleError(_0x7dec22,null));};exports[_0xbcc5('0x42')]=function(_0x3144ef,_0x388bb4){var _0x3c8ac8={'raw':!![],'where':{'id':_0x3144ef[_0xbcc5('0x43')]['id']}},_0x7e330f={};_0x7e330f['model']=_[_0xbcc5('0x2f')](db[_0xbcc5('0x29')][_0xbcc5('0x44')]);_0x7e330f[_0xbcc5('0x2e')]=_[_0xbcc5('0x2f')](_0x3144ef[_0xbcc5('0x2e')]);_0x7e330f['filters']=_[_0xbcc5('0x31')](_0x7e330f[_0xbcc5('0x2d')],_0x7e330f[_0xbcc5('0x2e')]);_0x3c8ac8[_0xbcc5('0x33')]=_[_0xbcc5('0x31')](_0x7e330f['model'],qs['fields'](_0x3144ef['query'][_0xbcc5('0x32')]));_0x3c8ac8[_0xbcc5('0x33')]=_0x3c8ac8[_0xbcc5('0x33')][_0xbcc5('0x34')]?_0x3c8ac8[_0xbcc5('0x33')]:_0x7e330f[_0xbcc5('0x2d')];if(_0x3144ef[_0xbcc5('0x2e')][_0xbcc5('0x3e')]){_0x3c8ac8[_0xbcc5('0x45')]=[{'all':!![]}];}_0x3c8ac8=_[_0xbcc5('0x3c')]({},_0x3c8ac8,_0x3144ef[_0xbcc5('0x3d')]);return db[_0xbcc5('0x29')][_0xbcc5('0x46')](_0x3c8ac8)[_0xbcc5('0x1f')](handleEntityNotFound(_0x388bb4,null))['then'](respondWithResult(_0x388bb4,null))[_0xbcc5('0x41')](handleError(_0x388bb4,null));};exports[_0xbcc5('0x47')]=function(_0x5049d1,_0x5aa128,_0x280508){return db[_0xbcc5('0x29')][_0xbcc5('0x46')]({'where':{'id':_0x5049d1['params']['id']},'attributes':[_0xbcc5('0x25'),'save_name',_0xbcc5('0x48')],'raw':!![]})[_0xbcc5('0x1f')](handleEntityNotFound(_0x5aa128,null))[_0xbcc5('0x1f')](function(_0x3ffab2){if(_0x3ffab2){if(!fs[_0xbcc5('0x49')](path[_0xbcc5('0x4a')](config['root'],'server/files/sounds/converted',_0x3ffab2[_0xbcc5('0x4b')]+'.'+_0x3ffab2['converted_format']))){throw new db[(_0xbcc5('0x4c'))][(_0xbcc5('0x4d'))](_0xbcc5('0x4e'));}return _0x5aa128[_0xbcc5('0x47')](path[_0xbcc5('0x4a')](config['root'],_0xbcc5('0x4f'),util[_0xbcc5('0x50')](_0xbcc5('0x51'),_0x3ffab2[_0xbcc5('0x4b')],_0x3ffab2['converted_format'])),util[_0xbcc5('0x50')](_0xbcc5('0x51'),_0x3ffab2['name'],_0x3ffab2[_0xbcc5('0x48')]));}return null;})[_0xbcc5('0x41')](handleError(_0x5aa128,null));};exports[_0xbcc5('0x52')]=function(_0x509647,_0x4fe93a,_0x26c798){var _0x494e45={'name':path[_0xbcc5('0x53')](_0x509647[_0xbcc5('0x54')][_0xbcc5('0x55')],path['extname'](_0x509647[_0xbcc5('0x54')][_0xbcc5('0x55')])),'save_name':path[_0xbcc5('0x53')](_0x509647[_0xbcc5('0x54')]['filename'],path[_0xbcc5('0x56')](_0x509647[_0xbcc5('0x54')][_0xbcc5('0x57')])),'original_format':path[_0xbcc5('0x56')](_0x509647['file'][_0xbcc5('0x55')])[_0xbcc5('0x58')](0x1),'converted_format':'wav'};var _0x5a5ecd=path['join'](config['root'],_0xbcc5('0x59'),_0x509647[_0xbcc5('0x54')][_0xbcc5('0x57')]);var _0x1a341a=path[_0xbcc5('0x4a')](config[_0xbcc5('0x5a')],_0xbcc5('0x4f'),util[_0xbcc5('0x50')](_0xbcc5('0x51'),path[_0xbcc5('0x53')](_0x509647[_0xbcc5('0x54')][_0xbcc5('0x57')],path[_0xbcc5('0x56')](_0x509647['file'][_0xbcc5('0x57')])),_0x494e45['converted_format']));logger[_0xbcc5('0x5b')](_0xbcc5('0x5c'),_0x5a5ecd);logger[_0xbcc5('0x5b')]('Sound\x20upload\x20destination:\x20%s',_0x1a341a);try{fs[_0xbcc5('0x5d')](_0x5a5ecd,parseInt(_0xbcc5('0x5e'),0x8));var _0x4c03e5=sox[_0xbcc5('0x5f')](_0x5a5ecd,_0x1a341a,{'sampleRate':0x1f40,'format':_0xbcc5('0x60'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4c03e5['on'](_0xbcc5('0x61'),function(_0x2071ee){fs[_0xbcc5('0x62')](_0x5a5ecd);_0x4fe93a[_0xbcc5('0x15')](0x1f4)[_0xbcc5('0x26')](_0x2071ee);});_0x4c03e5['on'](_0xbcc5('0x63'),function(_0x4bea2c){_0x494e45['original_duration']=isNaN(_0x4bea2c[_0xbcc5('0x64')])?null:_0x4bea2c['duration']*0x3e8;_0x494e45[_0xbcc5('0x65')]=isNaN(_0x4bea2c[_0xbcc5('0x66')])?null:_0x4bea2c['sampleCount'];_0x494e45[_0xbcc5('0x67')]=isNaN(_0x4bea2c['channelCount'])?null:_0x4bea2c[_0xbcc5('0x68')];_0x494e45['original_bitRate']=isNaN(_0x4bea2c[_0xbcc5('0x69')])?null:_0x4bea2c[_0xbcc5('0x69')];_0x494e45[_0xbcc5('0x6a')]=isNaN(_0x4bea2c[_0xbcc5('0x6b')])?null:_0x4bea2c[_0xbcc5('0x6b')];});_0x4c03e5['on'](_0xbcc5('0x6c'),function(_0x145653){_0x494e45[_0xbcc5('0x6d')]=isNaN(_0x145653['duration'])?null:_0x145653[_0xbcc5('0x64')]*0x3e8;_0x494e45[_0xbcc5('0x6e')]=isNaN(_0x145653['sampleCount'])?null:_0x145653[_0xbcc5('0x66')];_0x494e45[_0xbcc5('0x6f')]=isNaN(_0x145653[_0xbcc5('0x68')])?null:_0x145653[_0xbcc5('0x68')];_0x494e45[_0xbcc5('0x70')]=isNaN(_0x145653[_0xbcc5('0x69')])?null:_0x145653['bitRate'];_0x494e45['converted_sampleRate']=isNaN(_0x145653[_0xbcc5('0x6b')])?null:_0x145653['sampleRate'];});_0x4c03e5['on'](_0xbcc5('0x23'),function(){fs[_0xbcc5('0x5d')](_0x1a341a,parseInt(_0xbcc5('0x5e'),0x8));return db[_0xbcc5('0x29')][_0xbcc5('0x52')](_0x494e45)[_0xbcc5('0x1f')](function(_0x3e485a){var _0x4aa869={'role':_0x509647[_0xbcc5('0x71')]['role'],'userProfileId':_0x509647['body'][_0xbcc5('0x72')]};if(!_0x4aa869)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4aa869[_0xbcc5('0x73')]===_0xbcc5('0x74')){var _0x1a99cc=_0x3e485a[_0xbcc5('0x21')]({'plain':!![]});return db['UserProfileSection'][_0xbcc5('0x46')]({'where':{'name':_0xbcc5('0x22'),'userProfileId':_0x4aa869[_0xbcc5('0x72')]},'raw':!![]})[_0xbcc5('0x1f')](function(_0x54f90b){if(_0x54f90b&&_0x54f90b[_0xbcc5('0x75')]===0x0){return db[_0xbcc5('0x76')][_0xbcc5('0x52')]({'name':_0x1a99cc[_0xbcc5('0x25')],'resourceId':_0x1a99cc['id'],'type':_0x54f90b['name'],'sectionId':_0x54f90b['id']},{})[_0xbcc5('0x1f')](function(){return _0x3e485a;});}else{return _0x3e485a;}})[_0xbcc5('0x41')](function(_0x23d4f9){logger[_0xbcc5('0x61')](_0xbcc5('0x77'),_0x23d4f9);throw _0x23d4f9;});}return _0x3e485a;})[_0xbcc5('0x1f')](respondWithResult(_0x4fe93a,null))[_0xbcc5('0x41')](handleError(_0x4fe93a,null));});_0x4c03e5['start']();}catch(_0x578b9f){_0x4fe93a[_0xbcc5('0x15')](0x1f4)['send'](_0x578b9f);}};exports[_0xbcc5('0x1e')]=function(_0x3ea500,_0x597238,_0x56905d){return db[_0xbcc5('0x29')]['find']({'where':{'id':_0x3ea500[_0xbcc5('0x43')]['id']}})[_0xbcc5('0x1f')](handleEntityNotFound(_0x597238,null))[_0xbcc5('0x1f')](saveUpdates(_['pick'](_0x3ea500[_0xbcc5('0x71')],['name',_0xbcc5('0x78')]),null))[_0xbcc5('0x1f')](respondWithResult(_0x597238,null))[_0xbcc5('0x41')](handleError(_0x597238,null));};exports[_0xbcc5('0x79')]=function(_0x472e4a,_0x3dc4f8,_0x3ff0b3){return db[_0xbcc5('0x29')]['find']({'where':{'id':_0x472e4a[_0xbcc5('0x43')]['id']}})['then'](function(_0x403fb0){if(_0x403fb0){return _0x403fb0[_0xbcc5('0x20')]();}})['then'](function(_0x13886c){var _0x80c3e3=path[_0xbcc5('0x4a')](config[_0xbcc5('0x5a')],'server/files/sounds/original',util[_0xbcc5('0x50')](_0xbcc5('0x51'),_0x13886c[_0xbcc5('0x4b')],_0x13886c[_0xbcc5('0x7a')]));var _0xd1ba48=path[_0xbcc5('0x4a')](config[_0xbcc5('0x5a')],_0xbcc5('0x4f'),util[_0xbcc5('0x50')](_0xbcc5('0x51'),_0x13886c[_0xbcc5('0x4b')],_0x13886c[_0xbcc5('0x48')]));fs['unlinkSync'](_0x80c3e3);fs[_0xbcc5('0x62')](_0xd1ba48);return _0x13886c;})['then'](function(_0x51aa42){if(_0x51aa42){return _0x3dc4f8['status'](0xcc)[_0xbcc5('0x23')]();}})[_0xbcc5('0x1f')](handleEntityNotFound(_0x3dc4f8,null))[_0xbcc5('0x41')](handleError(_0x3dc4f8,null));}; \ No newline at end of file +var _0x0854=['Sound','count','includeAll','include','findAll','catch','show','params','intersection','download','save_name','converted_format','join','Sequelize','ValidationError','root','format','create','file','originalname','extname','filename','substring','server/files/sounds/original','server/files/sounds/converted','%s.%s','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','unlinkSync','src','original_duration','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','description','original_format','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','set','apply','reject','save','update','then','destroy','get','Sounds','end','stack','name','send','index','rawAttributes','fieldName','key','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options'];(function(_0x50306d,_0x2bcb07){var _0x377e29=function(_0x33bfb7){while(--_0x33bfb7){_0x50306d['push'](_0x50306d['shift']());}};_0x377e29(++_0x2bcb07);}(_0x0854,0x136));var _0x4085=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0854[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x4085('0x0'));var emlformat=require(_0x4085('0x1'));var rimraf=require(_0x4085('0x2'));var zipdir=require(_0x4085('0x3'));var jsonpatch=require(_0x4085('0x4'));var rp=require(_0x4085('0x5'));var moment=require(_0x4085('0x6'));var BPromise=require(_0x4085('0x7'));var Mustache=require(_0x4085('0x8'));var util=require(_0x4085('0x9'));var path=require(_0x4085('0xa'));var sox=require('sox');var csv=require(_0x4085('0xb'));var ejs=require(_0x4085('0xc'));var fs=require('fs');var _=require(_0x4085('0xd'));var squel=require(_0x4085('0xe'));var crypto=require(_0x4085('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x4085('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4085('0x11'));var Papa=require(_0x4085('0x12'));var Redis=require('ioredis');var authService=require(_0x4085('0x13'));var qs=require(_0x4085('0x14'));var as=require(_0x4085('0x15'));var hardwareService=require(_0x4085('0x16'));var logger=require(_0x4085('0x17'))(_0x4085('0x18'));var utils=require('../../config/utils');var config=require(_0x4085('0x19'));var licenseUtil=require(_0x4085('0x1a'));var db=require(_0x4085('0x1b'))['db'];function respondWithStatusCode(_0x3ddf9e,_0x4aab1e){_0x4aab1e=_0x4aab1e||0xcc;return function(_0x56baeb){if(_0x56baeb){return _0x3ddf9e[_0x4085('0x1c')](_0x4aab1e);}return _0x3ddf9e[_0x4085('0x1d')](_0x4aab1e)['end']();};}function respondWithResult(_0x62e262,_0x3db68c){_0x3db68c=_0x3db68c||0xc8;return function(_0x843885){if(_0x843885){return _0x62e262[_0x4085('0x1d')](_0x3db68c)[_0x4085('0x1e')](_0x843885);}};}function respondWithFilteredResult(_0x40fd1d,_0x3b248e){return function(_0x2b4297){if(_0x2b4297){var _0x162c1b=_0x2b4297['count'],_0x251d03=_0x3b248e[_0x4085('0x1f')],_0x3e357b=_0x3b248e[_0x4085('0x1f')]+_0x3b248e['limit'],_0x506b90;if(_0x3e357b>=_0x162c1b){_0x3e357b=_0x162c1b;_0x506b90=0xc8;}else{_0x506b90=0xce;}_0x40fd1d[_0x4085('0x1d')](_0x506b90);return _0x40fd1d[_0x4085('0x20')]('Content-Range',_0x251d03+'-'+_0x3e357b+'/'+_0x162c1b)['json'](_0x2b4297);}return null;};}function patchUpdates(_0x150783){return function(_0xf8dbf8){try{jsonpatch[_0x4085('0x21')](_0xf8dbf8,_0x150783,!![]);}catch(_0x519432){return BPromise[_0x4085('0x22')](_0x519432);}return _0xf8dbf8[_0x4085('0x23')]();};}function saveUpdates(_0x1a3537,_0x3840be){return function(_0x48fc28){if(_0x48fc28){return _0x48fc28[_0x4085('0x24')](_0x1a3537)[_0x4085('0x25')](function(_0xcdf25){return _0xcdf25;});}return null;};}function removeEntity(_0x5b128d,_0x2e2265){return function(_0x28d14b){if(_0x28d14b){return _0x28d14b[_0x4085('0x26')]()[_0x4085('0x25')](function(){var _0x559cd9=_0x28d14b[_0x4085('0x27')]({'plain':!![]});var _0x5a45cb=_0x4085('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x5a45cb,'resourceId':_0x559cd9['id']}})['then'](function(){return _0x28d14b;});})[_0x4085('0x25')](function(){_0x5b128d[_0x4085('0x1d')](0xcc)[_0x4085('0x29')]();});}};}function handleEntityNotFound(_0x55299d,_0x4e211a){return function(_0x11fa41){if(!_0x11fa41){_0x55299d[_0x4085('0x1c')](0x194);}return _0x11fa41;};}function handleError(_0x10649f,_0x161cbb){_0x161cbb=_0x161cbb||0x1f4;return function(_0x322e8f){logger['error'](_0x322e8f[_0x4085('0x2a')]);if(_0x322e8f[_0x4085('0x2b')]){delete _0x322e8f[_0x4085('0x2b')];}_0x10649f[_0x4085('0x1d')](_0x161cbb)[_0x4085('0x2c')](_0x322e8f);};}exports[_0x4085('0x2d')]=function(_0x438b2f,_0x113a6e){var _0x2631bb={},_0x36876d={},_0x41ec94={'count':0x0,'rows':[]};var _0x49e412=_['map'](db['Sound'][_0x4085('0x2e')],function(_0x4e7c62){return{'name':_0x4e7c62[_0x4085('0x2f')],'type':_0x4e7c62['type'][_0x4085('0x30')]};});_0x36876d[_0x4085('0x31')]=_[_0x4085('0x32')](_0x49e412,_0x4085('0x2b'));_0x36876d['query']=_[_0x4085('0x33')](_0x438b2f[_0x4085('0x34')]);_0x36876d[_0x4085('0x35')]=_['intersection'](_0x36876d['model'],_0x36876d[_0x4085('0x34')]);_0x2631bb[_0x4085('0x36')]=_['intersection'](_0x36876d[_0x4085('0x31')],qs[_0x4085('0x37')](_0x438b2f[_0x4085('0x34')][_0x4085('0x37')]));_0x2631bb[_0x4085('0x36')]=_0x2631bb[_0x4085('0x36')][_0x4085('0x38')]?_0x2631bb[_0x4085('0x36')]:_0x36876d[_0x4085('0x31')];if(!_0x438b2f[_0x4085('0x34')][_0x4085('0x39')](_0x4085('0x3a'))){_0x2631bb[_0x4085('0x3b')]=qs[_0x4085('0x3b')](_0x438b2f['query'][_0x4085('0x3b')]);_0x2631bb[_0x4085('0x1f')]=qs[_0x4085('0x1f')](_0x438b2f[_0x4085('0x34')]['offset']);}_0x2631bb[_0x4085('0x3c')]=qs[_0x4085('0x3d')](_0x438b2f[_0x4085('0x34')][_0x4085('0x3d')]);_0x2631bb[_0x4085('0x3e')]=qs[_0x4085('0x35')](_[_0x4085('0x3f')](_0x438b2f['query'],_0x36876d[_0x4085('0x35')]),_0x49e412);if(_0x438b2f[_0x4085('0x34')][_0x4085('0x40')]){_0x2631bb[_0x4085('0x3e')]=_['merge'](_0x2631bb[_0x4085('0x3e')],{'$or':_['map'](_0x49e412,function(_0x48bb99){if(_0x48bb99['type']!==_0x4085('0x41')){var _0x5b2a42={};_0x5b2a42[_0x48bb99['name']]={'$like':'%'+_0x438b2f[_0x4085('0x34')][_0x4085('0x40')]+'%'};return _0x5b2a42;}})});}_0x2631bb=_[_0x4085('0x42')]({},_0x2631bb,_0x438b2f[_0x4085('0x43')]);var _0x556c69={'where':_0x2631bb['where']};return db[_0x4085('0x44')]['count'](_0x556c69)[_0x4085('0x25')](function(_0x5a0e69){_0x41ec94[_0x4085('0x45')]=_0x5a0e69;if(_0x438b2f['query'][_0x4085('0x46')]){_0x2631bb[_0x4085('0x47')]=[{'all':!![]}];}return db['Sound'][_0x4085('0x48')](_0x2631bb);})['then'](function(_0x34926d){_0x41ec94['rows']=_0x34926d;return _0x41ec94;})[_0x4085('0x25')](respondWithFilteredResult(_0x113a6e,_0x2631bb))[_0x4085('0x49')](handleError(_0x113a6e,null));};exports[_0x4085('0x4a')]=function(_0x51cc8b,_0x417ab1){var _0x5f289c={'raw':!![],'where':{'id':_0x51cc8b[_0x4085('0x4b')]['id']}},_0x3e9977={};_0x3e9977[_0x4085('0x31')]=_[_0x4085('0x33')](db[_0x4085('0x44')][_0x4085('0x2e')]);_0x3e9977[_0x4085('0x34')]=_[_0x4085('0x33')](_0x51cc8b[_0x4085('0x34')]);_0x3e9977['filters']=_['intersection'](_0x3e9977[_0x4085('0x31')],_0x3e9977[_0x4085('0x34')]);_0x5f289c[_0x4085('0x36')]=_[_0x4085('0x4c')](_0x3e9977[_0x4085('0x31')],qs['fields'](_0x51cc8b[_0x4085('0x34')]['fields']));_0x5f289c[_0x4085('0x36')]=_0x5f289c[_0x4085('0x36')]['length']?_0x5f289c[_0x4085('0x36')]:_0x3e9977['model'];if(_0x51cc8b[_0x4085('0x34')][_0x4085('0x46')]){_0x5f289c['include']=[{'all':!![]}];}_0x5f289c=_['merge']({},_0x5f289c,_0x51cc8b[_0x4085('0x43')]);return db[_0x4085('0x44')]['find'](_0x5f289c)[_0x4085('0x25')](handleEntityNotFound(_0x417ab1,null))[_0x4085('0x25')](respondWithResult(_0x417ab1,null))[_0x4085('0x49')](handleError(_0x417ab1,null));};exports[_0x4085('0x4d')]=function(_0x5b8f25,_0x559ba4,_0x23fba1){return db[_0x4085('0x44')]['find']({'where':{'id':_0x5b8f25[_0x4085('0x4b')]['id']},'attributes':[_0x4085('0x2b'),_0x4085('0x4e'),_0x4085('0x4f')],'raw':!![]})[_0x4085('0x25')](handleEntityNotFound(_0x559ba4,null))[_0x4085('0x25')](function(_0x55cc4a){if(_0x55cc4a){if(!fs['existsSync'](path[_0x4085('0x50')](config['root'],'server/files/sounds/converted',_0x55cc4a['save_name']+'.'+_0x55cc4a[_0x4085('0x4f')]))){throw new db[(_0x4085('0x51'))][(_0x4085('0x52'))]('Sound\x20not\x20found');}return _0x559ba4[_0x4085('0x4d')](path['join'](config[_0x4085('0x53')],'server/files/sounds/converted',util[_0x4085('0x54')]('%s.%s',_0x55cc4a[_0x4085('0x4e')],_0x55cc4a[_0x4085('0x4f')])),util[_0x4085('0x54')]('%s.%s',_0x55cc4a[_0x4085('0x2b')],_0x55cc4a[_0x4085('0x4f')]));}return null;})[_0x4085('0x49')](handleError(_0x559ba4,null));};exports[_0x4085('0x55')]=function(_0x2539f1,_0x1d2153,_0x85ad36){var _0xcf078f={'name':path['basename'](_0x2539f1[_0x4085('0x56')][_0x4085('0x57')],path[_0x4085('0x58')](_0x2539f1[_0x4085('0x56')]['originalname'])),'save_name':path['basename'](_0x2539f1['file']['filename'],path['extname'](_0x2539f1[_0x4085('0x56')][_0x4085('0x59')])),'original_format':path['extname'](_0x2539f1[_0x4085('0x56')][_0x4085('0x57')])[_0x4085('0x5a')](0x1),'converted_format':'wav'};var _0x19010b=path[_0x4085('0x50')](config[_0x4085('0x53')],_0x4085('0x5b'),_0x2539f1['file'][_0x4085('0x59')]);var _0x1d80bc=path[_0x4085('0x50')](config[_0x4085('0x53')],_0x4085('0x5c'),util[_0x4085('0x54')](_0x4085('0x5d'),path['basename'](_0x2539f1[_0x4085('0x56')][_0x4085('0x59')],path['extname'](_0x2539f1[_0x4085('0x56')][_0x4085('0x59')])),_0xcf078f['converted_format']));logger[_0x4085('0x5e')](_0x4085('0x5f'),_0x19010b);logger[_0x4085('0x5e')]('Sound\x20upload\x20destination:\x20%s',_0x1d80bc);try{fs[_0x4085('0x60')](_0x19010b,parseInt(_0x4085('0x61'),0x8));var _0x627f73=sox['transcode'](_0x19010b,_0x1d80bc,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x627f73['on']('error',function(_0x27d5f0){fs[_0x4085('0x62')](_0x19010b);_0x1d2153[_0x4085('0x1d')](0x1f4)[_0x4085('0x2c')](_0x27d5f0);});_0x627f73['on'](_0x4085('0x63'),function(_0x369180){_0xcf078f[_0x4085('0x64')]=isNaN(_0x369180['duration'])?null:_0x369180['duration']*0x3e8;_0xcf078f['original_sampleCount']=isNaN(_0x369180[_0x4085('0x65')])?null:_0x369180[_0x4085('0x65')];_0xcf078f['original_channelCount']=isNaN(_0x369180['channelCount'])?null:_0x369180[_0x4085('0x66')];_0xcf078f[_0x4085('0x67')]=isNaN(_0x369180[_0x4085('0x68')])?null:_0x369180['bitRate'];_0xcf078f[_0x4085('0x69')]=isNaN(_0x369180[_0x4085('0x6a')])?null:_0x369180[_0x4085('0x6a')];});_0x627f73['on']('dest',function(_0x4d2cf7){_0xcf078f[_0x4085('0x6b')]=isNaN(_0x4d2cf7[_0x4085('0x6c')])?null:_0x4d2cf7[_0x4085('0x6c')]*0x3e8;_0xcf078f[_0x4085('0x6d')]=isNaN(_0x4d2cf7[_0x4085('0x65')])?null:_0x4d2cf7['sampleCount'];_0xcf078f[_0x4085('0x6e')]=isNaN(_0x4d2cf7['channelCount'])?null:_0x4d2cf7['channelCount'];_0xcf078f[_0x4085('0x6f')]=isNaN(_0x4d2cf7[_0x4085('0x68')])?null:_0x4d2cf7[_0x4085('0x68')];_0xcf078f[_0x4085('0x70')]=isNaN(_0x4d2cf7[_0x4085('0x6a')])?null:_0x4d2cf7['sampleRate'];});_0x627f73['on']('end',function(){fs[_0x4085('0x60')](_0x1d80bc,parseInt('0777',0x8));return db[_0x4085('0x44')][_0x4085('0x55')](_0xcf078f)[_0x4085('0x25')](function(_0x2ddbe0){var _0x53c968={'role':_0x2539f1[_0x4085('0x71')][_0x4085('0x72')],'userProfileId':_0x2539f1[_0x4085('0x71')][_0x4085('0x73')]};if(!_0x53c968)throw new Error(_0x4085('0x74'));if(_0x53c968[_0x4085('0x72')]===_0x4085('0x75')){var _0x20c2f7=_0x2ddbe0[_0x4085('0x27')]({'plain':!![]});return db[_0x4085('0x76')]['find']({'where':{'name':_0x4085('0x28'),'userProfileId':_0x53c968[_0x4085('0x73')]},'raw':!![]})[_0x4085('0x25')](function(_0x2f524a){if(_0x2f524a&&_0x2f524a[_0x4085('0x77')]===0x0){return db[_0x4085('0x78')][_0x4085('0x55')]({'name':_0x20c2f7[_0x4085('0x2b')],'resourceId':_0x20c2f7['id'],'type':_0x2f524a[_0x4085('0x2b')],'sectionId':_0x2f524a['id']},{})['then'](function(){return _0x2ddbe0;});}else{return _0x2ddbe0;}})['catch'](function(_0x5832fc){logger[_0x4085('0x79')](_0x4085('0x7a'),_0x5832fc);throw _0x5832fc;});}return _0x2ddbe0;})[_0x4085('0x25')](respondWithResult(_0x1d2153,null))[_0x4085('0x49')](handleError(_0x1d2153,null));});_0x627f73['start']();}catch(_0x34e0cb){_0x1d2153[_0x4085('0x1d')](0x1f4)[_0x4085('0x2c')](_0x34e0cb);}};exports['update']=function(_0xe49b92,_0x4841b0,_0x58eecd){return db[_0x4085('0x44')][_0x4085('0x7b')]({'where':{'id':_0xe49b92['params']['id']}})[_0x4085('0x25')](handleEntityNotFound(_0x4841b0,null))[_0x4085('0x25')](saveUpdates(_[_0x4085('0x3f')](_0xe49b92[_0x4085('0x71')],[_0x4085('0x2b'),_0x4085('0x7c')]),null))[_0x4085('0x25')](respondWithResult(_0x4841b0,null))[_0x4085('0x49')](handleError(_0x4841b0,null));};exports['delete']=function(_0x590cd5,_0x23f8a5,_0x27a356){return db['Sound'][_0x4085('0x7b')]({'where':{'id':_0x590cd5[_0x4085('0x4b')]['id']}})[_0x4085('0x25')](function(_0x4384b5){if(_0x4384b5){return _0x4384b5[_0x4085('0x26')]();}})[_0x4085('0x25')](function(_0x5a1021){var _0x8c7ac8=path[_0x4085('0x50')](config[_0x4085('0x53')],_0x4085('0x5b'),util[_0x4085('0x54')](_0x4085('0x5d'),_0x5a1021['save_name'],_0x5a1021[_0x4085('0x7d')]));var _0x2d1898=path[_0x4085('0x50')](config[_0x4085('0x53')],_0x4085('0x5c'),util[_0x4085('0x54')]('%s.%s',_0x5a1021['save_name'],_0x5a1021[_0x4085('0x4f')]));fs[_0x4085('0x62')](_0x8c7ac8);fs[_0x4085('0x62')](_0x2d1898);return _0x5a1021;})[_0x4085('0x25')](function(_0x551dbf){if(_0x551dbf){return _0x23f8a5[_0x4085('0x1d')](0xcc)[_0x4085('0x29')]();}})[_0x4085('0x25')](handleEntityNotFound(_0x23f8a5,null))[_0x4085('0x49')](handleError(_0x23f8a5,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 111a700..d6ebd2a 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 _0x3aa7=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','tools_sounds','lodash','util','../../config/logger'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x3aa7,0x8d));var _0x73aa=function(_0xc6cd4d,_0x4a4388){_0xc6cd4d=_0xc6cd4d-0x0;var _0x1fe3b2=_0x3aa7[_0xc6cd4d];return _0x1fe3b2;};'use strict';var _=require(_0x73aa('0x0'));var util=require(_0x73aa('0x1'));var logger=require(_0x73aa('0x2'))(_0x73aa('0x3'));var moment=require(_0x73aa('0x4'));var BPromise=require(_0x73aa('0x5'));var rp=require(_0x73aa('0x6'));var fs=require('fs');var path=require(_0x73aa('0x7'));var rimraf=require('rimraf');var config=require(_0x73aa('0x8'));var attributes=require('./sound.attributes');module[_0x73aa('0x9')]=function(_0x11f3a5,_0x4167f7){return _0x11f3a5[_0x73aa('0xa')]('Sound',attributes,{'tableName':_0x73aa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x417a=['./sound.attributes','exports','Sound','tools_sounds','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x417a,0x124));var _0xa417=function(_0x5d4f12,_0x11e67c){_0x5d4f12=_0x5d4f12-0x0;var _0x4eb577=_0x417a[_0x5d4f12];return _0x4eb577;};'use strict';var _=require(_0xa417('0x0'));var util=require('util');var logger=require(_0xa417('0x1'))(_0xa417('0x2'));var moment=require(_0xa417('0x3'));var BPromise=require(_0xa417('0x4'));var rp=require(_0xa417('0x5'));var fs=require('fs');var path=require(_0xa417('0x6'));var rimraf=require('rimraf');var config=require(_0xa417('0x7'));var attributes=require(_0xa417('0x8'));module[_0xa417('0x9')]=function(_0x13b947,_0x2803e7){return _0x13b947['define'](_0xa417('0xa'),attributes,{'tableName':_0xa417('0xb'),'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 ece24b5..2e97c85 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 _0x941e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','error','code','Sound,\x20%s,\x20%s','message','result','Sound','find','options','attributes','include','model','map','stringify','catch','lodash','util','moment','bluebird'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0x941e,0x15c));var _0xe941=function(_0x1599dd,_0x3e1f58){_0x1599dd=_0x1599dd-0x0;var _0x424844=_0x941e[_0x1599dd];return _0x424844;};'use strict';var _=require(_0xe941('0x0'));var util=require(_0xe941('0x1'));var moment=require(_0xe941('0x2'));var BPromise=require(_0xe941('0x3'));var rs=require(_0xe941('0x4'));var fs=require('fs');var Redis=require(_0xe941('0x5'));var db=require(_0xe941('0x6'))['db'];var utils=require(_0xe941('0x7'));var logger=require(_0xe941('0x8'))(_0xe941('0x9'));var config=require(_0xe941('0xa'));var jayson=require(_0xe941('0xb'));var client=jayson[_0xe941('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22e064,_0xbede6d,_0x433d53){return new BPromise(function(_0x2f6663,_0x39a5fb){return client[_0xe941('0xd')](_0x22e064,_0x433d53)[_0xe941('0xe')](function(_0x59972b){logger[_0xe941('0xf')]('Sound,\x20%s,\x20%s',_0xbede6d,_0xe941('0x10'));logger[_0xe941('0x11')]('Sound,\x20%s,\x20%s,\x20%s',_0xbede6d,'request\x20sent',JSON['stringify'](_0x59972b));if(_0x59972b[_0xe941('0x12')]){if(_0x59972b[_0xe941('0x12')][_0xe941('0x13')]===0x1f4){logger[_0xe941('0x12')](_0xe941('0x14'),_0xbede6d,_0x59972b['error']['message']);return _0x39a5fb(_0x59972b[_0xe941('0x12')][_0xe941('0x15')]);}logger[_0xe941('0x12')](_0xe941('0x14'),_0xbede6d,_0x59972b[_0xe941('0x12')][_0xe941('0x15')]);return _0x2f6663(_0x59972b['error'][_0xe941('0x15')]);}else{logger[_0xe941('0xf')](_0xe941('0x14'),_0xbede6d,_0xe941('0x10'));_0x2f6663(_0x59972b[_0xe941('0x16')][_0xe941('0x15')]);}})['catch'](function(_0x1c6bc1){logger[_0xe941('0x12')](_0xe941('0x14'),_0xbede6d,_0x1c6bc1);_0x39a5fb(_0x1c6bc1);});});}exports['ShowSound']=function(_0x11899e){var _0x151061=this;return new Promise(function(_0x43e934,_0x163c3){return db[_0xe941('0x17')][_0xe941('0x18')]({'raw':_0x11899e[_0xe941('0x19')]?_0x11899e[_0xe941('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x11899e[_0xe941('0x19')]?_0x11899e[_0xe941('0x19')]['where']||null:null,'attributes':_0x11899e[_0xe941('0x19')]?_0x11899e['options'][_0xe941('0x1a')]||null:null,'include':_0x11899e[_0xe941('0x19')]?_0x11899e[_0xe941('0x19')]['include']?_['map'](_0x11899e[_0xe941('0x19')][_0xe941('0x1b')],function(_0x517676){return{'model':db[_0x517676[_0xe941('0x1c')]],'as':_0x517676['as'],'attributes':_0x517676[_0xe941('0x1a')],'include':_0x517676[_0xe941('0x1b')]?_[_0xe941('0x1d')](_0x517676['include'],function(_0x34607f){return{'model':db[_0x34607f['model']],'as':_0x34607f['as'],'attributes':_0x34607f['attributes'],'include':_0x34607f['include']?_[_0xe941('0x1d')](_0x34607f['include'],function(_0x275017){return{'model':db[_0x275017[_0xe941('0x1c')]],'as':_0x275017['as'],'attributes':_0x275017[_0xe941('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa6a045){logger[_0xe941('0xf')]('ShowSound',_0x11899e);logger[_0xe941('0x11')]('ShowSound',_0x11899e,JSON[_0xe941('0x1e')](_0xa6a045));_0x43e934(_0xa6a045);})[_0xe941('0x1f')](function(_0x4abf78){logger['error']('ShowSound',_0x4abf78['message'],_0x11899e);_0x163c3(_0x151061[_0xe941('0x12')](0x1f4,_0x4abf78['message']));});});}; \ No newline at end of file +var _0xd588=['then','ShowSound','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Sound,\x20%s,\x20%s','message','result','catch','Sound','options','raw','where','attributes','include','model','map'];(function(_0x4b87a3,_0x3a698c){var _0x334112=function(_0x3e8fb0){while(--_0x3e8fb0){_0x4b87a3['push'](_0x4b87a3['shift']());}};_0x334112(++_0x3a698c);}(_0xd588,0xdb));var _0x8d58=function(_0x4688f3,_0x36fa36){_0x4688f3=_0x4688f3-0x0;var _0x3cb0b9=_0xd588[_0x4688f3];return _0x3cb0b9;};'use strict';var _=require(_0x8d58('0x0'));var util=require(_0x8d58('0x1'));var moment=require('moment');var BPromise=require(_0x8d58('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d58('0x3'));var db=require(_0x8d58('0x4'))['db'];var utils=require(_0x8d58('0x5'));var logger=require('../../config/logger')(_0x8d58('0x6'));var config=require(_0x8d58('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8d58('0x8')][_0x8d58('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x470bf6,_0x35f0d7,_0x154bb9){return new BPromise(function(_0x5c998b,_0x470a3e){return client[_0x8d58('0xa')](_0x470bf6,_0x154bb9)['then'](function(_0x49be15){logger[_0x8d58('0xb')]('Sound,\x20%s,\x20%s',_0x35f0d7,'request\x20sent');logger[_0x8d58('0xc')](_0x8d58('0xd'),_0x35f0d7,_0x8d58('0xe'),JSON[_0x8d58('0xf')](_0x49be15));if(_0x49be15[_0x8d58('0x10')]){if(_0x49be15[_0x8d58('0x10')]['code']===0x1f4){logger[_0x8d58('0x10')](_0x8d58('0x11'),_0x35f0d7,_0x49be15[_0x8d58('0x10')][_0x8d58('0x12')]);return _0x470a3e(_0x49be15[_0x8d58('0x10')][_0x8d58('0x12')]);}logger[_0x8d58('0x10')]('Sound,\x20%s,\x20%s',_0x35f0d7,_0x49be15['error'][_0x8d58('0x12')]);return _0x5c998b(_0x49be15['error'][_0x8d58('0x12')]);}else{logger[_0x8d58('0xb')](_0x8d58('0x11'),_0x35f0d7,'request\x20sent');_0x5c998b(_0x49be15[_0x8d58('0x13')][_0x8d58('0x12')]);}})[_0x8d58('0x14')](function(_0xb058ce){logger['error'](_0x8d58('0x11'),_0x35f0d7,_0xb058ce);_0x470a3e(_0xb058ce);});});}exports['ShowSound']=function(_0x38e4e4){var _0x3768a2=this;return new Promise(function(_0x29fd7f,_0x43dfdc){return db[_0x8d58('0x15')]['find']({'raw':_0x38e4e4[_0x8d58('0x16')]?_0x38e4e4[_0x8d58('0x16')][_0x8d58('0x17')]===undefined?!![]:![]:!![],'where':_0x38e4e4[_0x8d58('0x16')]?_0x38e4e4['options'][_0x8d58('0x18')]||null:null,'attributes':_0x38e4e4['options']?_0x38e4e4['options'][_0x8d58('0x19')]||null:null,'include':_0x38e4e4['options']?_0x38e4e4[_0x8d58('0x16')][_0x8d58('0x1a')]?_['map'](_0x38e4e4[_0x8d58('0x16')][_0x8d58('0x1a')],function(_0x11f724){return{'model':db[_0x11f724[_0x8d58('0x1b')]],'as':_0x11f724['as'],'attributes':_0x11f724[_0x8d58('0x19')],'include':_0x11f724[_0x8d58('0x1a')]?_['map'](_0x11f724[_0x8d58('0x1a')],function(_0x34ce3a){return{'model':db[_0x34ce3a[_0x8d58('0x1b')]],'as':_0x34ce3a['as'],'attributes':_0x34ce3a['attributes'],'include':_0x34ce3a[_0x8d58('0x1a')]?_[_0x8d58('0x1c')](_0x34ce3a[_0x8d58('0x1a')],function(_0x6a649f){return{'model':db[_0x6a649f['model']],'as':_0x6a649f['as'],'attributes':_0x6a649f['attributes']};}):[]};}):[]};}):[]:[]})[_0x8d58('0x1d')](function(_0xc382c2){logger['info']('ShowSound',_0x38e4e4);logger[_0x8d58('0xc')](_0x8d58('0x1e'),_0x38e4e4,JSON['stringify'](_0xc382c2));_0x29fd7f(_0xc382c2);})[_0x8d58('0x14')](function(_0x56fbfa){logger[_0x8d58('0x10')](_0x8d58('0x1e'),_0x56fbfa['message'],_0x38e4e4);_0x43dfdc(_0x3768a2[_0x8d58('0x10')](0x1f4,_0x56fbfa['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 89c56fd..f56e1dd 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 _0x1e20=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports'];(function(_0x512e72,_0x49ffe1){var _0x143086=function(_0x1d3921){while(--_0x1d3921){_0x512e72['push'](_0x512e72['shift']());}};_0x143086(++_0x49ffe1);}(_0x1e20,0x120));var _0x01e2=function(_0xf520ff,_0x2a7d91){_0xf520ff=_0xf520ff-0x0;var _0x9b098a=_0x1e20[_0xf520ff];return _0x9b098a;};'use strict';var multer=require(_0x01e2('0x0'));var util=require(_0x01e2('0x1'));var path=require(_0x01e2('0x2'));var timeout=require(_0x01e2('0x3'));var express=require(_0x01e2('0x4'));var router=express['Router']();var auth=require(_0x01e2('0x5'));var interaction=require(_0x01e2('0x6'));var config=require('../../config/environment');var controller=require(_0x01e2('0x7'));router[_0x01e2('0x8')]('/',auth[_0x01e2('0x9')](),controller[_0x01e2('0xa')]);router[_0x01e2('0x8')](_0x01e2('0xb'),auth[_0x01e2('0x9')](),controller['show']);router[_0x01e2('0xc')]('/',auth['isAuthenticated'](),controller[_0x01e2('0xd')]);router[_0x01e2('0xe')](_0x01e2('0xb'),auth[_0x01e2('0x9')](),controller[_0x01e2('0xf')]);router['delete'](_0x01e2('0xb'),auth['isAuthenticated'](),controller[_0x01e2('0x10')]);module[_0x01e2('0x11')]=router; \ No newline at end of file +var _0xf1c6=['index','/:id','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated'];(function(_0xd2f9e5,_0x9a32c6){var _0x49fa9d=function(_0x4251d7){while(--_0x4251d7){_0xd2f9e5['push'](_0xd2f9e5['shift']());}};_0x49fa9d(++_0x9a32c6);}(_0xf1c6,0x116));var _0x6f1c=function(_0x20e211,_0xaeed3f){_0x20e211=_0x20e211-0x0;var _0x196345=_0xf1c6[_0x20e211];return _0x196345;};'use strict';var multer=require(_0x6f1c('0x0'));var util=require(_0x6f1c('0x1'));var path=require('path');var timeout=require(_0x6f1c('0x2'));var express=require(_0x6f1c('0x3'));var router=express[_0x6f1c('0x4')]();var auth=require(_0x6f1c('0x5'));var interaction=require(_0x6f1c('0x6'));var config=require(_0x6f1c('0x7'));var controller=require(_0x6f1c('0x8'));router[_0x6f1c('0x9')]('/',auth[_0x6f1c('0xa')](),controller[_0x6f1c('0xb')]);router[_0x6f1c('0x9')](_0x6f1c('0xc'),auth[_0x6f1c('0xa')](),controller['show']);router['post']('/',auth[_0x6f1c('0xa')](),controller['create']);router[_0x6f1c('0xd')](_0x6f1c('0xc'),auth[_0x6f1c('0xa')](),controller[_0x6f1c('0xe')]);router[_0x6f1c('0xf')](_0x6f1c('0xc'),auth[_0x6f1c('0xa')](),controller[_0x6f1c('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 444cf75..ea2c75e 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 _0x1cb9=['TEXT','medium','ENUM','out','sequelize','STRING'];(function(_0x5a2340,_0x44b72c){var _0xdc5a04=function(_0x17a20f){while(--_0x17a20f){_0x5a2340['push'](_0x5a2340['shift']());}};_0xdc5a04(++_0x44b72c);}(_0x1cb9,0x14e));var _0x91cb=function(_0x54b9f3,_0x3d72c5){_0x54b9f3=_0x54b9f3-0x0;var _0x1728d5=_0x1cb9[_0x54b9f3];return _0x1728d5;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x91cb('0x1')]},'body':{'type':Sequelize[_0x91cb('0x2')](_0x91cb('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x91cb('0x4')]('in','out'),'defaultValue':_0x91cb('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x91cb('0x1')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3e74=['TEXT','medium','out','sequelize','STRING'];(function(_0x317390,_0x38d7e3){var _0x1082bb=function(_0x175c1c){while(--_0x175c1c){_0x317390['push'](_0x317390['shift']());}};_0x1082bb(++_0x38d7e3);}(_0x3e74,0x175));var _0x43e7=function(_0x1e7c25,_0x3f4f53){_0x1e7c25=_0x1e7c25-0x0;var _0x34d4f7=_0x3e74[_0x1e7c25];return _0x34d4f7;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x43e7('0x1')]},'body':{'type':Sequelize[_0x43e7('0x2')](_0x43e7('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x43e7('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x43e7('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 8bc5b7f..0029a32 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 _0xcbb8=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','apply','reject','save','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','SquareMessage','includeAll','findAll','rows','catch','show','params','intersection','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x5a8848,_0x3210a9){var _0x2deed1=function(_0x36e6f4){while(--_0x36e6f4){_0x5a8848['push'](_0x5a8848['shift']());}};_0x2deed1(++_0x3210a9);}(_0xcbb8,0x1eb));var _0x8cbb=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xcbb8[_0x2a6809];return _0x11c371;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8cbb('0x0'));var rimraf=require(_0x8cbb('0x1'));var zipdir=require(_0x8cbb('0x2'));var jsonpatch=require(_0x8cbb('0x3'));var rp=require('request-promise');var moment=require(_0x8cbb('0x4'));var BPromise=require(_0x8cbb('0x5'));var Mustache=require(_0x8cbb('0x6'));var util=require(_0x8cbb('0x7'));var path=require(_0x8cbb('0x8'));var sox=require(_0x8cbb('0x9'));var csv=require(_0x8cbb('0xa'));var ejs=require(_0x8cbb('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8cbb('0xc'));var deskjs=require(_0x8cbb('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8cbb('0xe'));var Papa=require(_0x8cbb('0xf'));var Redis=require('ioredis');var authService=require(_0x8cbb('0x10'));var qs=require(_0x8cbb('0x11'));var as=require(_0x8cbb('0x12'));var hardwareService=require(_0x8cbb('0x13'));var logger=require(_0x8cbb('0x14'))(_0x8cbb('0x15'));var utils=require(_0x8cbb('0x16'));var config=require(_0x8cbb('0x17'));var licenseUtil=require(_0x8cbb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23ab0c,_0x44d47c){_0x44d47c=_0x44d47c||0xcc;return function(_0x21e263){if(_0x21e263){return _0x23ab0c[_0x8cbb('0x19')](_0x44d47c);}return _0x23ab0c['status'](_0x44d47c)['end']();};}function respondWithResult(_0x436540,_0x8f4f37){_0x8f4f37=_0x8f4f37||0xc8;return function(_0x3169e0){if(_0x3169e0){return _0x436540[_0x8cbb('0x1a')](_0x8f4f37)[_0x8cbb('0x1b')](_0x3169e0);}};}function respondWithFilteredResult(_0x1a7765,_0x5addbc){return function(_0x4086ca){if(_0x4086ca){var _0x2426b5=_0x4086ca[_0x8cbb('0x1c')],_0x1f1dd6=_0x5addbc[_0x8cbb('0x1d')],_0x49b1a7=_0x5addbc['offset']+_0x5addbc[_0x8cbb('0x1e')],_0xbfc80f;if(_0x49b1a7>=_0x2426b5){_0x49b1a7=_0x2426b5;_0xbfc80f=0xc8;}else{_0xbfc80f=0xce;}_0x1a7765[_0x8cbb('0x1a')](_0xbfc80f);return _0x1a7765[_0x8cbb('0x1f')]('Content-Range',_0x1f1dd6+'-'+_0x49b1a7+'/'+_0x2426b5)[_0x8cbb('0x1b')](_0x4086ca);}return null;};}function patchUpdates(_0x1ca247){return function(_0x5a8559){try{jsonpatch[_0x8cbb('0x20')](_0x5a8559,_0x1ca247,!![]);}catch(_0x43d737){return BPromise[_0x8cbb('0x21')](_0x43d737);}return _0x5a8559[_0x8cbb('0x22')]();};}function saveUpdates(_0x5efd42,_0x3e9e28){return function(_0x371738){if(_0x371738){return _0x371738['update'](_0x5efd42)[_0x8cbb('0x23')](function(_0x5d94b9){return _0x5d94b9;});}return null;};}function removeEntity(_0x34ad69,_0x5db172){return function(_0x55c2b9){if(_0x55c2b9){return _0x55c2b9[_0x8cbb('0x24')]()[_0x8cbb('0x23')](function(){_0x34ad69[_0x8cbb('0x1a')](0xcc)[_0x8cbb('0x25')]();});}};}function handleEntityNotFound(_0x4526f8,_0x247d65){return function(_0xdd97ef){if(!_0xdd97ef){_0x4526f8[_0x8cbb('0x19')](0x194);}return _0xdd97ef;};}function handleError(_0x161854,_0x266f1a){_0x266f1a=_0x266f1a||0x1f4;return function(_0x22cf5f){logger[_0x8cbb('0x26')](_0x22cf5f['stack']);if(_0x22cf5f[_0x8cbb('0x27')]){delete _0x22cf5f[_0x8cbb('0x27')];}_0x161854['status'](_0x266f1a)[_0x8cbb('0x28')](_0x22cf5f);};}exports[_0x8cbb('0x29')]=function(_0x5eb40e,_0x560b6a){var _0x5620fa={},_0x21f46a={},_0x4b2201={'count':0x0,'rows':[]};var _0x13ab9a=_[_0x8cbb('0x2a')](db['SquareMessage'][_0x8cbb('0x2b')],function(_0x3b1b96){return{'name':_0x3b1b96[_0x8cbb('0x2c')],'type':_0x3b1b96['type'][_0x8cbb('0x2d')]};});_0x21f46a['model']=_[_0x8cbb('0x2a')](_0x13ab9a,_0x8cbb('0x27'));_0x21f46a[_0x8cbb('0x2e')]=_[_0x8cbb('0x2f')](_0x5eb40e[_0x8cbb('0x2e')]);_0x21f46a[_0x8cbb('0x30')]=_['intersection'](_0x21f46a[_0x8cbb('0x31')],_0x21f46a[_0x8cbb('0x2e')]);_0x5620fa[_0x8cbb('0x32')]=_['intersection'](_0x21f46a[_0x8cbb('0x31')],qs[_0x8cbb('0x33')](_0x5eb40e[_0x8cbb('0x2e')]['fields']));_0x5620fa[_0x8cbb('0x32')]=_0x5620fa[_0x8cbb('0x32')][_0x8cbb('0x34')]?_0x5620fa[_0x8cbb('0x32')]:_0x21f46a[_0x8cbb('0x31')];if(!_0x5eb40e['query'][_0x8cbb('0x35')](_0x8cbb('0x36'))){_0x5620fa['limit']=qs[_0x8cbb('0x1e')](_0x5eb40e[_0x8cbb('0x2e')][_0x8cbb('0x1e')]);_0x5620fa[_0x8cbb('0x1d')]=qs[_0x8cbb('0x1d')](_0x5eb40e[_0x8cbb('0x2e')][_0x8cbb('0x1d')]);}_0x5620fa[_0x8cbb('0x37')]=qs[_0x8cbb('0x38')](_0x5eb40e[_0x8cbb('0x2e')][_0x8cbb('0x38')]);_0x5620fa[_0x8cbb('0x39')]=qs[_0x8cbb('0x30')](_['pick'](_0x5eb40e['query'],_0x21f46a[_0x8cbb('0x30')]),_0x13ab9a);if(_0x5eb40e['query']['filter']){_0x5620fa['where']=_[_0x8cbb('0x3a')](_0x5620fa[_0x8cbb('0x39')],{'$or':_[_0x8cbb('0x2a')](_0x13ab9a,function(_0x130c27){if(_0x130c27['type']!=='VIRTUAL'){var _0x566b51={};_0x566b51[_0x130c27[_0x8cbb('0x27')]]={'$like':'%'+_0x5eb40e[_0x8cbb('0x2e')][_0x8cbb('0x3b')]+'%'};return _0x566b51;}})});}_0x5620fa=_[_0x8cbb('0x3a')]({},_0x5620fa,_0x5eb40e[_0x8cbb('0x3c')]);var _0x22bda1={'where':_0x5620fa[_0x8cbb('0x39')]};return db[_0x8cbb('0x3d')][_0x8cbb('0x1c')](_0x22bda1)['then'](function(_0x3df19b){_0x4b2201[_0x8cbb('0x1c')]=_0x3df19b;if(_0x5eb40e[_0x8cbb('0x2e')][_0x8cbb('0x3e')]){_0x5620fa['include']=[{'all':!![]}];}return db[_0x8cbb('0x3d')][_0x8cbb('0x3f')](_0x5620fa);})[_0x8cbb('0x23')](function(_0x1bcc84){_0x4b2201[_0x8cbb('0x40')]=_0x1bcc84;return _0x4b2201;})[_0x8cbb('0x23')](respondWithFilteredResult(_0x560b6a,_0x5620fa))[_0x8cbb('0x41')](handleError(_0x560b6a,null));};exports[_0x8cbb('0x42')]=function(_0x36625c,_0x45fe1a){var _0x333a1b={'raw':!![],'where':{'id':_0x36625c[_0x8cbb('0x43')]['id']}},_0x19b3b0={};_0x19b3b0[_0x8cbb('0x31')]=_['keys'](db[_0x8cbb('0x3d')][_0x8cbb('0x2b')]);_0x19b3b0['query']=_[_0x8cbb('0x2f')](_0x36625c[_0x8cbb('0x2e')]);_0x19b3b0[_0x8cbb('0x30')]=_[_0x8cbb('0x44')](_0x19b3b0['model'],_0x19b3b0[_0x8cbb('0x2e')]);_0x333a1b[_0x8cbb('0x32')]=_[_0x8cbb('0x44')](_0x19b3b0[_0x8cbb('0x31')],qs[_0x8cbb('0x33')](_0x36625c[_0x8cbb('0x2e')][_0x8cbb('0x33')]));_0x333a1b[_0x8cbb('0x32')]=_0x333a1b[_0x8cbb('0x32')][_0x8cbb('0x34')]?_0x333a1b[_0x8cbb('0x32')]:_0x19b3b0[_0x8cbb('0x31')];if(_0x36625c[_0x8cbb('0x2e')][_0x8cbb('0x3e')]){_0x333a1b['include']=[{'all':!![]}];}_0x333a1b=_[_0x8cbb('0x3a')]({},_0x333a1b,_0x36625c[_0x8cbb('0x3c')]);return db[_0x8cbb('0x3d')][_0x8cbb('0x45')](_0x333a1b)[_0x8cbb('0x23')](handleEntityNotFound(_0x45fe1a,null))[_0x8cbb('0x23')](respondWithResult(_0x45fe1a,null))['catch'](handleError(_0x45fe1a,null));};exports[_0x8cbb('0x46')]=function(_0x11d54c,_0x4d4559){return db[_0x8cbb('0x3d')][_0x8cbb('0x46')](_0x11d54c[_0x8cbb('0x47')],{})[_0x8cbb('0x23')](respondWithResult(_0x4d4559,0xc9))['catch'](handleError(_0x4d4559,null));};exports[_0x8cbb('0x48')]=function(_0x460ad6,_0x4f1bdf){if(_0x460ad6['body']['id']){delete _0x460ad6[_0x8cbb('0x47')]['id'];}return db[_0x8cbb('0x3d')][_0x8cbb('0x45')]({'where':{'id':_0x460ad6[_0x8cbb('0x43')]['id']}})['then'](handleEntityNotFound(_0x4f1bdf,null))[_0x8cbb('0x23')](saveUpdates(_0x460ad6[_0x8cbb('0x47')],null))['then'](respondWithResult(_0x4f1bdf,null))['catch'](handleError(_0x4f1bdf,null));};exports[_0x8cbb('0x24')]=function(_0x5c8b4b,_0x10a4b2){return db[_0x8cbb('0x3d')]['find']({'where':{'id':_0x5c8b4b['params']['id']}})[_0x8cbb('0x23')](handleEntityNotFound(_0x10a4b2,null))[_0x8cbb('0x23')](removeEntity(_0x10a4b2,null))[_0x8cbb('0x41')](handleError(_0x10a4b2,null));}; \ No newline at end of file +var _0x1417=['fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','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','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','params','length','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x25ae05,_0xbfbed2){var _0x3f3493=function(_0x56bad4){while(--_0x56bad4){_0x25ae05['push'](_0x25ae05['shift']());}};_0x3f3493(++_0xbfbed2);}(_0x1417,0xd1));var _0x7141=function(_0x399601,_0x213d4f){_0x399601=_0x399601-0x0;var _0x3d0c01=_0x1417[_0x399601];return _0x3d0c01;};'use strict';var pdf=require(_0x7141('0x0'));var emlformat=require(_0x7141('0x1'));var rimraf=require(_0x7141('0x2'));var zipdir=require(_0x7141('0x3'));var jsonpatch=require(_0x7141('0x4'));var rp=require('request-promise');var moment=require(_0x7141('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7141('0x6'));var util=require(_0x7141('0x7'));var path=require(_0x7141('0x8'));var sox=require('sox');var csv=require(_0x7141('0x9'));var ejs=require(_0x7141('0xa'));var fs=require('fs');var _=require(_0x7141('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7141('0xc'));var deskjs=require(_0x7141('0xd'));var toCsv=require(_0x7141('0x9'));var querystring=require(_0x7141('0xe'));var Papa=require('papaparse');var Redis=require(_0x7141('0xf'));var authService=require(_0x7141('0x10'));var qs=require(_0x7141('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7141('0x12'));var logger=require(_0x7141('0x13'))('api');var utils=require(_0x7141('0x14'));var config=require(_0x7141('0x15'));var licenseUtil=require(_0x7141('0x16'));var db=require(_0x7141('0x17'))['db'];function respondWithStatusCode(_0x35c258,_0x4f70e9){_0x4f70e9=_0x4f70e9||0xcc;return function(_0x18a503){if(_0x18a503){return _0x35c258[_0x7141('0x18')](_0x4f70e9);}return _0x35c258[_0x7141('0x19')](_0x4f70e9)[_0x7141('0x1a')]();};}function respondWithResult(_0x520de5,_0x5357d9){_0x5357d9=_0x5357d9||0xc8;return function(_0x131a56){if(_0x131a56){return _0x520de5[_0x7141('0x19')](_0x5357d9)[_0x7141('0x1b')](_0x131a56);}};}function respondWithFilteredResult(_0x1c4099,_0x24eb4b){return function(_0x204ace){if(_0x204ace){var _0x313949=_0x204ace[_0x7141('0x1c')],_0x2b31c6=_0x24eb4b['offset'],_0x1166ba=_0x24eb4b[_0x7141('0x1d')]+_0x24eb4b[_0x7141('0x1e')],_0x489738;if(_0x1166ba>=_0x313949){_0x1166ba=_0x313949;_0x489738=0xc8;}else{_0x489738=0xce;}_0x1c4099['status'](_0x489738);return _0x1c4099[_0x7141('0x1f')](_0x7141('0x20'),_0x2b31c6+'-'+_0x1166ba+'/'+_0x313949)[_0x7141('0x1b')](_0x204ace);}return null;};}function patchUpdates(_0xf18489){return function(_0x3676c1){try{jsonpatch['apply'](_0x3676c1,_0xf18489,!![]);}catch(_0x3199f8){return BPromise[_0x7141('0x21')](_0x3199f8);}return _0x3676c1['save']();};}function saveUpdates(_0x49ae1d,_0x737eda){return function(_0x71eb46){if(_0x71eb46){return _0x71eb46[_0x7141('0x22')](_0x49ae1d)[_0x7141('0x23')](function(_0x22e29b){return _0x22e29b;});}return null;};}function removeEntity(_0x463d1c,_0x2a57ca){return function(_0x3ecb40){if(_0x3ecb40){return _0x3ecb40[_0x7141('0x24')]()[_0x7141('0x23')](function(){_0x463d1c[_0x7141('0x19')](0xcc)[_0x7141('0x1a')]();});}};}function handleEntityNotFound(_0x4b9220,_0x34ead0){return function(_0x1a1b4b){if(!_0x1a1b4b){_0x4b9220[_0x7141('0x18')](0x194);}return _0x1a1b4b;};}function handleError(_0x5213da,_0x114840){_0x114840=_0x114840||0x1f4;return function(_0x30b324){logger[_0x7141('0x25')](_0x30b324[_0x7141('0x26')]);if(_0x30b324[_0x7141('0x27')]){delete _0x30b324[_0x7141('0x27')];}_0x5213da[_0x7141('0x19')](_0x114840)[_0x7141('0x28')](_0x30b324);};}exports[_0x7141('0x29')]=function(_0x4aa11d,_0x3bc209){var _0xcb0173={},_0x5ddd88={},_0x9f69ed={'count':0x0,'rows':[]};var _0x37ded7=_[_0x7141('0x2a')](db[_0x7141('0x2b')][_0x7141('0x2c')],function(_0x16e672){return{'name':_0x16e672[_0x7141('0x2d')],'type':_0x16e672[_0x7141('0x2e')][_0x7141('0x2f')]};});_0x5ddd88[_0x7141('0x30')]=_[_0x7141('0x2a')](_0x37ded7,_0x7141('0x27'));_0x5ddd88[_0x7141('0x31')]=_[_0x7141('0x32')](_0x4aa11d[_0x7141('0x31')]);_0x5ddd88[_0x7141('0x33')]=_[_0x7141('0x34')](_0x5ddd88[_0x7141('0x30')],_0x5ddd88[_0x7141('0x31')]);_0xcb0173[_0x7141('0x35')]=_[_0x7141('0x34')](_0x5ddd88[_0x7141('0x30')],qs[_0x7141('0x36')](_0x4aa11d[_0x7141('0x31')][_0x7141('0x36')]));_0xcb0173[_0x7141('0x35')]=_0xcb0173[_0x7141('0x35')]['length']?_0xcb0173[_0x7141('0x35')]:_0x5ddd88[_0x7141('0x30')];if(!_0x4aa11d[_0x7141('0x31')]['hasOwnProperty']('nolimit')){_0xcb0173['limit']=qs[_0x7141('0x1e')](_0x4aa11d['query']['limit']);_0xcb0173[_0x7141('0x1d')]=qs['offset'](_0x4aa11d['query'][_0x7141('0x1d')]);}_0xcb0173['order']=qs[_0x7141('0x37')](_0x4aa11d['query'][_0x7141('0x37')]);_0xcb0173[_0x7141('0x38')]=qs[_0x7141('0x33')](_[_0x7141('0x39')](_0x4aa11d['query'],_0x5ddd88['filters']),_0x37ded7);if(_0x4aa11d['query'][_0x7141('0x3a')]){_0xcb0173[_0x7141('0x38')]=_[_0x7141('0x3b')](_0xcb0173[_0x7141('0x38')],{'$or':_[_0x7141('0x2a')](_0x37ded7,function(_0x32e38c){if(_0x32e38c[_0x7141('0x2e')]!=='VIRTUAL'){var _0x20c103={};_0x20c103[_0x32e38c[_0x7141('0x27')]]={'$like':'%'+_0x4aa11d['query']['filter']+'%'};return _0x20c103;}})});}_0xcb0173=_[_0x7141('0x3b')]({},_0xcb0173,_0x4aa11d['options']);var _0x1ade61={'where':_0xcb0173[_0x7141('0x38')]};return db[_0x7141('0x2b')]['count'](_0x1ade61)[_0x7141('0x23')](function(_0x5c3171){_0x9f69ed[_0x7141('0x1c')]=_0x5c3171;if(_0x4aa11d['query'][_0x7141('0x3c')]){_0xcb0173[_0x7141('0x3d')]=[{'all':!![]}];}return db[_0x7141('0x2b')][_0x7141('0x3e')](_0xcb0173);})[_0x7141('0x23')](function(_0x5a5e75){_0x9f69ed[_0x7141('0x3f')]=_0x5a5e75;return _0x9f69ed;})[_0x7141('0x23')](respondWithFilteredResult(_0x3bc209,_0xcb0173))[_0x7141('0x40')](handleError(_0x3bc209,null));};exports['show']=function(_0x1c262b,_0x2e0c73){var _0x4390a7={'raw':!![],'where':{'id':_0x1c262b[_0x7141('0x41')]['id']}},_0x4e5e45={};_0x4e5e45[_0x7141('0x30')]=_[_0x7141('0x32')](db[_0x7141('0x2b')][_0x7141('0x2c')]);_0x4e5e45[_0x7141('0x31')]=_[_0x7141('0x32')](_0x1c262b[_0x7141('0x31')]);_0x4e5e45['filters']=_[_0x7141('0x34')](_0x4e5e45['model'],_0x4e5e45[_0x7141('0x31')]);_0x4390a7[_0x7141('0x35')]=_[_0x7141('0x34')](_0x4e5e45[_0x7141('0x30')],qs[_0x7141('0x36')](_0x1c262b['query']['fields']));_0x4390a7[_0x7141('0x35')]=_0x4390a7[_0x7141('0x35')][_0x7141('0x42')]?_0x4390a7['attributes']:_0x4e5e45[_0x7141('0x30')];if(_0x1c262b['query'][_0x7141('0x3c')]){_0x4390a7[_0x7141('0x3d')]=[{'all':!![]}];}_0x4390a7=_[_0x7141('0x3b')]({},_0x4390a7,_0x1c262b[_0x7141('0x43')]);return db[_0x7141('0x2b')][_0x7141('0x44')](_0x4390a7)[_0x7141('0x23')](handleEntityNotFound(_0x2e0c73,null))[_0x7141('0x23')](respondWithResult(_0x2e0c73,null))[_0x7141('0x40')](handleError(_0x2e0c73,null));};exports[_0x7141('0x45')]=function(_0x275f9d,_0x4c1de0){return db[_0x7141('0x2b')][_0x7141('0x45')](_0x275f9d['body'],{})[_0x7141('0x23')](respondWithResult(_0x4c1de0,0xc9))['catch'](handleError(_0x4c1de0,null));};exports[_0x7141('0x22')]=function(_0x18a2e9,_0x3e7684){if(_0x18a2e9[_0x7141('0x46')]['id']){delete _0x18a2e9[_0x7141('0x46')]['id'];}return db['SquareMessage'][_0x7141('0x44')]({'where':{'id':_0x18a2e9[_0x7141('0x41')]['id']}})[_0x7141('0x23')](handleEntityNotFound(_0x3e7684,null))[_0x7141('0x23')](saveUpdates(_0x18a2e9[_0x7141('0x46')],null))[_0x7141('0x23')](respondWithResult(_0x3e7684,null))[_0x7141('0x40')](handleError(_0x3e7684,null));};exports[_0x7141('0x24')]=function(_0x52ef62,_0x2e2d04){return db[_0x7141('0x2b')][_0x7141('0x44')]({'where':{'id':_0x52ef62[_0x7141('0x41')]['id']}})['then'](handleEntityNotFound(_0x2e2d04,null))[_0x7141('0x23')](removeEntity(_0x2e2d04,null))[_0x7141('0x40')](handleError(_0x2e2d04,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 26dd945..11f5e00 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 _0x8964=['api','moment','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','util'];(function(_0x218d5c,_0x58d566){var _0x388244=function(_0x321703){while(--_0x321703){_0x218d5c['push'](_0x218d5c['shift']());}};_0x388244(++_0x58d566);}(_0x8964,0xc5));var _0x4896=function(_0x1cd4d5,_0x40bd09){_0x1cd4d5=_0x1cd4d5-0x0;var _0x348028=_0x8964[_0x1cd4d5];return _0x348028;};'use strict';var _=require('lodash');var util=require(_0x4896('0x0'));var logger=require('../../config/logger')(_0x4896('0x1'));var moment=require(_0x4896('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4896('0x3'));var rimraf=require(_0x4896('0x4'));var config=require(_0x4896('0x5'));var attributes=require(_0x4896('0x6'));module[_0x4896('0x7')]=function(_0x439ab4,_0x24d5e1){return _0x439ab4[_0x4896('0x8')](_0x4896('0x9'),attributes,{'tableName':_0x4896('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1001=['request-promise','path','../../config/environment','./squareMessage.attributes','exports','define','square_messages','lodash','util','../../config/logger','api','moment'];(function(_0x4f8d94,_0x2ada22){var _0x2c9d73=function(_0x17ab8c){while(--_0x17ab8c){_0x4f8d94['push'](_0x4f8d94['shift']());}};_0x2c9d73(++_0x2ada22);}(_0x1001,0x193));var _0x1100=function(_0x57297a,_0x198904){_0x57297a=_0x57297a-0x0;var _0x404dad=_0x1001[_0x57297a];return _0x404dad;};'use strict';var _=require(_0x1100('0x0'));var util=require(_0x1100('0x1'));var logger=require(_0x1100('0x2'))(_0x1100('0x3'));var moment=require(_0x1100('0x4'));var BPromise=require('bluebird');var rp=require(_0x1100('0x5'));var fs=require('fs');var path=require(_0x1100('0x6'));var rimraf=require('rimraf');var config=require(_0x1100('0x7'));var attributes=require(_0x1100('0x8'));module[_0x1100('0x9')]=function(_0x1ad8db,_0x63f3b2){return _0x1ad8db[_0x1100('0xa')]('SquareMessage',attributes,{'tableName':_0x1100('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 2eb5e6c..4ba885f 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(_0x4210e1,_0x16471d){var _0x32bab2=function(_0x4f41e1){while(--_0x4f41e1){_0x4210e1['push'](_0x4210e1['shift']());}};_0x32bab2(++_0x16471d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['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(_0x15876d,_0xe1cd34){var _0x3e2734=function(_0x5ccd09){while(--_0x5ccd09){_0x15876d['push'](_0x15876d['shift']());}};_0x3e2734(++_0xe1cd34);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 e7cfc81..7a997bd 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 _0x80eb=['show','/:id/test','test','post','create','put','/:id','update','delete','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated'];(function(_0x433397,_0x1660c1){var _0x3119dc=function(_0x41bfcf){while(--_0x41bfcf){_0x433397['push'](_0x433397['shift']());}};_0x3119dc(++_0x1660c1);}(_0x80eb,0x1ae));var _0xb80e=function(_0x871f5b,_0x4d3987){_0x871f5b=_0x871f5b-0x0;var _0x25d1fa=_0x80eb[_0x871f5b];return _0x25d1fa;};'use strict';var multer=require(_0xb80e('0x0'));var util=require(_0xb80e('0x1'));var path=require(_0xb80e('0x2'));var timeout=require('connect-timeout');var express=require(_0xb80e('0x3'));var router=express[_0xb80e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb80e('0x5'));var config=require(_0xb80e('0x6'));var controller=require(_0xb80e('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb80e('0x8')]('/:id',auth[_0xb80e('0x9')](),controller[_0xb80e('0xa')]);router['get'](_0xb80e('0xb'),auth[_0xb80e('0x9')](),timeout('15s'),controller[_0xb80e('0xc')]);router[_0xb80e('0xd')]('/',auth[_0xb80e('0x9')](),controller[_0xb80e('0xe')]);router[_0xb80e('0xf')](_0xb80e('0x10'),auth['isAuthenticated'](),controller[_0xb80e('0x11')]);router[_0xb80e('0x12')]('/:id',auth[_0xb80e('0x9')](),controller['destroy']);module[_0xb80e('0x13')]=router; \ No newline at end of file +var _0x349a=['get','isAuthenticated','index','/:id','show','15s','test','create','put','update','delete','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller'];(function(_0xa355ee,_0x4b6360){var _0x44307e=function(_0x421d83){while(--_0x421d83){_0xa355ee['push'](_0xa355ee['shift']());}};_0x44307e(++_0x4b6360);}(_0x349a,0x188));var _0xa349=function(_0x5aa141,_0x2d6e3a){_0x5aa141=_0x5aa141-0x0;var _0x446d2f=_0x349a[_0x5aa141];return _0x446d2f;};'use strict';var multer=require(_0xa349('0x0'));var util=require(_0xa349('0x1'));var path=require('path');var timeout=require(_0xa349('0x2'));var express=require('express');var router=express[_0xa349('0x3')]();var auth=require(_0xa349('0x4'));var interaction=require(_0xa349('0x5'));var config=require(_0xa349('0x6'));var controller=require(_0xa349('0x7'));router[_0xa349('0x8')]('/',auth[_0xa349('0x9')](),controller[_0xa349('0xa')]);router[_0xa349('0x8')](_0xa349('0xb'),auth[_0xa349('0x9')](),controller[_0xa349('0xc')]);router[_0xa349('0x8')]('/:id/test',auth[_0xa349('0x9')](),timeout(_0xa349('0xd')),controller[_0xa349('0xe')]);router['post']('/',auth[_0xa349('0x9')](),controller[_0xa349('0xf')]);router[_0xa349('0x10')](_0xa349('0xb'),auth[_0xa349('0x9')](),controller[_0xa349('0x11')]);router[_0xa349('0x12')](_0xa349('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xa349('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index d9737b6..8cd48fd 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 _0x256c=['name','sequelize','exports','STRING'];(function(_0xc652b9,_0x3e59d4){var _0x48a8f6=function(_0x41ffa3){while(--_0x41ffa3){_0xc652b9['push'](_0xc652b9['shift']());}};_0x48a8f6(++_0x3e59d4);}(_0x256c,0x95));var _0xc256=function(_0x139d64,_0x1d5b10){_0x139d64=_0x139d64-0x0;var _0x5df7c0=_0x256c[_0x139d64];return _0x5df7c0;};'use strict';var Sequelize=require(_0xc256('0x0'));module[_0xc256('0x1')]={'name':{'type':Sequelize[_0xc256('0x2')],'unique':_0xc256('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc256('0x2')]}}; \ No newline at end of file +var _0xeb4b=['sequelize','exports','STRING'];(function(_0x1627ae,_0x2aaa24){var _0x34b38f=function(_0x5c4332){while(--_0x5c4332){_0x1627ae['push'](_0x1627ae['shift']());}};_0x34b38f(++_0x2aaa24);}(_0xeb4b,0x84));var _0xbeb4=function(_0xeef9e1,_0xb4c1ee){_0xeef9e1=_0xeef9e1-0x0;var _0xadd459=_0xeb4b[_0xeef9e1];return _0xadd459;};'use strict';var Sequelize=require(_0xbeb4('0x0'));module[_0xbeb4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xbeb4('0x2')]},'description':{'type':Sequelize[_0xbeb4('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index b674e1e..e201e84 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 _0x51b9=['nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','update','params','dsn','openSync','closeSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','json','apply','save','then','get','ODBC','UserProfileResource','destroy','error','name','send','index','map','SquareOdbc','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x2b1389,_0x1a40f7){var _0x398996=function(_0x379434){while(--_0x379434){_0x2b1389['push'](_0x2b1389['shift']());}};_0x398996(++_0x1a40f7);}(_0x51b9,0x17d));var _0x951b=function(_0x42711a,_0x50df0d){_0x42711a=_0x42711a-0x0;var _0x5d912a=_0x51b9[_0x42711a];return _0x5d912a;};'use strict';var pdf=require(_0x951b('0x0'));var emlformat=require(_0x951b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x951b('0x2'));var jsonpatch=require(_0x951b('0x3'));var rp=require(_0x951b('0x4'));var moment=require(_0x951b('0x5'));var BPromise=require(_0x951b('0x6'));var Mustache=require(_0x951b('0x7'));var util=require(_0x951b('0x8'));var path=require(_0x951b('0x9'));var sox=require('sox');var csv=require(_0x951b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x951b('0xb'));var squel=require(_0x951b('0xc'));var crypto=require(_0x951b('0xd'));var jsforce=require(_0x951b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x951b('0xa'));var querystring=require(_0x951b('0xf'));var Papa=require(_0x951b('0x10'));var Redis=require(_0x951b('0x11'));var authService=require(_0x951b('0x12'));var qs=require(_0x951b('0x13'));var as=require(_0x951b('0x14'));var hardwareService=require(_0x951b('0x15'));var logger=require(_0x951b('0x16'))(_0x951b('0x17'));var utils=require(_0x951b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x951b('0x19'));var db=require(_0x951b('0x1a'))['db'];function respondWithStatusCode(_0x47cbcd,_0x476426){_0x476426=_0x476426||0xcc;return function(_0x1d300b){if(_0x1d300b){return _0x47cbcd[_0x951b('0x1b')](_0x476426);}return _0x47cbcd[_0x951b('0x1c')](_0x476426)[_0x951b('0x1d')]();};}function respondWithResult(_0x321591,_0x554926){_0x554926=_0x554926||0xc8;return function(_0x896040){if(_0x896040){return _0x321591[_0x951b('0x1c')](_0x554926)['json'](_0x896040);}};}function respondWithFilteredResult(_0x2fe48d,_0x2aba42){return function(_0x129fdf){if(_0x129fdf){var _0xe5a59d=_0x129fdf[_0x951b('0x1e')],_0x4b0ad6=_0x2aba42['offset'],_0x4aa600=_0x2aba42[_0x951b('0x1f')]+_0x2aba42['limit'],_0x20d162;if(_0x4aa600>=_0xe5a59d){_0x4aa600=_0xe5a59d;_0x20d162=0xc8;}else{_0x20d162=0xce;}_0x2fe48d[_0x951b('0x1c')](_0x20d162);return _0x2fe48d['set'](_0x951b('0x20'),_0x4b0ad6+'-'+_0x4aa600+'/'+_0xe5a59d)[_0x951b('0x21')](_0x129fdf);}return null;};}function patchUpdates(_0x26933b){return function(_0xc242f4){try{jsonpatch[_0x951b('0x22')](_0xc242f4,_0x26933b,!![]);}catch(_0x1ee11d){return BPromise['reject'](_0x1ee11d);}return _0xc242f4[_0x951b('0x23')]();};}function saveUpdates(_0x143647,_0x29938d){return function(_0x2261b6){if(_0x2261b6){return _0x2261b6['update'](_0x143647)[_0x951b('0x24')](function(_0x2fbeca){return _0x2fbeca;});}return null;};}function removeEntity(_0x58429d,_0x4d3c08){return function(_0x29370b){if(_0x29370b){return _0x29370b['destroy']()[_0x951b('0x24')](function(){var _0x4a20cb=_0x29370b[_0x951b('0x25')]({'plain':!![]});var _0x67df4=_0x951b('0x26');return db[_0x951b('0x27')][_0x951b('0x28')]({'where':{'type':_0x67df4,'resourceId':_0x4a20cb['id']}})['then'](function(){return _0x29370b;});})[_0x951b('0x24')](function(){_0x58429d['status'](0xcc)[_0x951b('0x1d')]();});}};}function handleEntityNotFound(_0x42f670,_0x33e424){return function(_0x5c28db){if(!_0x5c28db){_0x42f670[_0x951b('0x1b')](0x194);}return _0x5c28db;};}function handleError(_0x2271fd,_0x4563b2){_0x4563b2=_0x4563b2||0x1f4;return function(_0x5191c8){logger[_0x951b('0x29')](_0x5191c8['stack']);if(_0x5191c8[_0x951b('0x2a')]){delete _0x5191c8[_0x951b('0x2a')];}_0x2271fd[_0x951b('0x1c')](_0x4563b2)[_0x951b('0x2b')](_0x5191c8);};}exports[_0x951b('0x2c')]=function(_0x1aa0fb,_0x290159){var _0x28d830={},_0x44886e={},_0x41c458={'count':0x0,'rows':[]};var _0x361e36=_[_0x951b('0x2d')](db[_0x951b('0x2e')]['rawAttributes'],function(_0x2b46fd){return{'name':_0x2b46fd[_0x951b('0x2f')],'type':_0x2b46fd[_0x951b('0x30')][_0x951b('0x31')]};});_0x44886e[_0x951b('0x32')]=_[_0x951b('0x2d')](_0x361e36,_0x951b('0x2a'));_0x44886e[_0x951b('0x33')]=_[_0x951b('0x34')](_0x1aa0fb[_0x951b('0x33')]);_0x44886e[_0x951b('0x35')]=_[_0x951b('0x36')](_0x44886e[_0x951b('0x32')],_0x44886e['query']);_0x28d830[_0x951b('0x37')]=_[_0x951b('0x36')](_0x44886e[_0x951b('0x32')],qs[_0x951b('0x38')](_0x1aa0fb[_0x951b('0x33')][_0x951b('0x38')]));_0x28d830[_0x951b('0x37')]=_0x28d830[_0x951b('0x37')][_0x951b('0x39')]?_0x28d830['attributes']:_0x44886e[_0x951b('0x32')];if(!_0x1aa0fb['query'][_0x951b('0x3a')](_0x951b('0x3b'))){_0x28d830[_0x951b('0x3c')]=qs[_0x951b('0x3c')](_0x1aa0fb['query'][_0x951b('0x3c')]);_0x28d830[_0x951b('0x1f')]=qs[_0x951b('0x1f')](_0x1aa0fb[_0x951b('0x33')][_0x951b('0x1f')]);}_0x28d830[_0x951b('0x3d')]=qs[_0x951b('0x3e')](_0x1aa0fb[_0x951b('0x33')]['sort']);_0x28d830[_0x951b('0x3f')]=qs[_0x951b('0x35')](_[_0x951b('0x40')](_0x1aa0fb['query'],_0x44886e[_0x951b('0x35')]),_0x361e36);if(_0x1aa0fb['query'][_0x951b('0x41')]){_0x28d830[_0x951b('0x3f')]=_[_0x951b('0x42')](_0x28d830[_0x951b('0x3f')],{'$or':_[_0x951b('0x2d')](_0x361e36,function(_0x48e1b8){if(_0x48e1b8[_0x951b('0x30')]!==_0x951b('0x43')){var _0x3e496b={};_0x3e496b[_0x48e1b8[_0x951b('0x2a')]]={'$like':'%'+_0x1aa0fb['query'][_0x951b('0x41')]+'%'};return _0x3e496b;}})});}_0x28d830=_[_0x951b('0x42')]({},_0x28d830,_0x1aa0fb[_0x951b('0x44')]);var _0x4ca61d={'where':_0x28d830[_0x951b('0x3f')]};return db[_0x951b('0x2e')]['count'](_0x4ca61d)[_0x951b('0x24')](function(_0x525f66){_0x41c458[_0x951b('0x1e')]=_0x525f66;if(_0x1aa0fb[_0x951b('0x33')][_0x951b('0x45')]){_0x28d830['include']=[{'all':!![]}];}return db[_0x951b('0x2e')][_0x951b('0x46')](_0x28d830);})[_0x951b('0x24')](function(_0x3b0b0f){_0x41c458[_0x951b('0x47')]=_0x3b0b0f;return _0x41c458;})[_0x951b('0x24')](respondWithFilteredResult(_0x290159,_0x28d830))['catch'](handleError(_0x290159,null));};exports[_0x951b('0x48')]=function(_0x10ac21,_0x4e6ccb){var _0x5e0b17={'raw':!![],'where':{'id':_0x10ac21['params']['id']}},_0x1c8dc6={};_0x1c8dc6[_0x951b('0x32')]=_[_0x951b('0x34')](db['SquareOdbc']['rawAttributes']);_0x1c8dc6[_0x951b('0x33')]=_[_0x951b('0x34')](_0x10ac21[_0x951b('0x33')]);_0x1c8dc6[_0x951b('0x35')]=_[_0x951b('0x36')](_0x1c8dc6['model'],_0x1c8dc6['query']);_0x5e0b17['attributes']=_['intersection'](_0x1c8dc6[_0x951b('0x32')],qs[_0x951b('0x38')](_0x10ac21[_0x951b('0x33')]['fields']));_0x5e0b17[_0x951b('0x37')]=_0x5e0b17[_0x951b('0x37')]['length']?_0x5e0b17['attributes']:_0x1c8dc6[_0x951b('0x32')];if(_0x10ac21[_0x951b('0x33')]['includeAll']){_0x5e0b17[_0x951b('0x49')]=[{'all':!![]}];}_0x5e0b17=_[_0x951b('0x42')]({},_0x5e0b17,_0x10ac21[_0x951b('0x44')]);return db[_0x951b('0x2e')]['find'](_0x5e0b17)[_0x951b('0x24')](handleEntityNotFound(_0x4e6ccb,null))[_0x951b('0x24')](respondWithResult(_0x4e6ccb,null))[_0x951b('0x4a')](handleError(_0x4e6ccb,null));};exports[_0x951b('0x4b')]=function(_0x5e6d3f,_0x19109f){return db[_0x951b('0x2e')][_0x951b('0x4b')](_0x5e6d3f[_0x951b('0x4c')],{})[_0x951b('0x24')](function(_0x27ad16){var _0x56cd53=_0x5e6d3f[_0x951b('0x4d')]['get']({'plain':!![]});if(!_0x56cd53)throw new Error(_0x951b('0x4e'));if(_0x56cd53[_0x951b('0x4f')]===_0x951b('0x4d')){var _0x12b02a=_0x27ad16[_0x951b('0x25')]({'plain':!![]});var _0x5c1fd1=_0x951b('0x26');return db[_0x951b('0x50')][_0x951b('0x51')]({'where':{'name':_0x5c1fd1,'userProfileId':_0x56cd53['userProfileId']},'raw':!![]})[_0x951b('0x24')](function(_0x268441){if(_0x268441&&_0x268441[_0x951b('0x52')]===0x0){return db[_0x951b('0x27')][_0x951b('0x4b')]({'name':_0x12b02a[_0x951b('0x2a')],'resourceId':_0x12b02a['id'],'type':_0x268441[_0x951b('0x2a')],'sectionId':_0x268441['id']},{})[_0x951b('0x24')](function(){return _0x27ad16;});}else{return _0x27ad16;}})[_0x951b('0x4a')](function(_0x500422){logger[_0x951b('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x500422);throw _0x500422;});}return _0x27ad16;})['then'](respondWithResult(_0x19109f,0xc9))['catch'](handleError(_0x19109f,null));};exports[_0x951b('0x53')]=function(_0x2fe9e8,_0x536ffd){if(_0x2fe9e8[_0x951b('0x4c')]['id']){delete _0x2fe9e8[_0x951b('0x4c')]['id'];}return db[_0x951b('0x2e')][_0x951b('0x51')]({'where':{'id':_0x2fe9e8[_0x951b('0x54')]['id']}})[_0x951b('0x24')](handleEntityNotFound(_0x536ffd,null))[_0x951b('0x24')](saveUpdates(_0x2fe9e8[_0x951b('0x4c')],null))[_0x951b('0x24')](respondWithResult(_0x536ffd,null))[_0x951b('0x4a')](handleError(_0x536ffd,null));};exports[_0x951b('0x28')]=function(_0xcdd8a3,_0x1e8135){return db[_0x951b('0x2e')][_0x951b('0x51')]({'where':{'id':_0xcdd8a3[_0x951b('0x54')]['id']}})[_0x951b('0x24')](handleEntityNotFound(_0x1e8135,null))[_0x951b('0x24')](removeEntity(_0x1e8135,null))['catch'](handleError(_0x1e8135,null));};exports['test']=function(_0x1fa38a,_0x57f8e7,_0x19bd4f){var _0x32bd42;return db['SquareOdbc']['find']({'where':{'id':_0x1fa38a[_0x951b('0x54')]['id']},'attributes':['id',_0x951b('0x55')]})['then'](handleEntityNotFound(_0x57f8e7,null))[_0x951b('0x24')](function(_0x35488e){if(_0x35488e){var _0x12f050=require('odbc')();_0x12f050[_0x951b('0x56')](_0x35488e[_0x951b('0x55')]);_0x12f050[_0x951b('0x57')]();return _0x35488e;}})[_0x951b('0x24')](respondWithResult(_0x57f8e7,null))[_0x951b('0x4a')](handleError(_0x57f8e7,null));}; \ No newline at end of file +var _0x79ed=['path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','update','destroy','get','ODBC','UserProfileResource','then','error','stack','name','send','SquareOdbc','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','test','dsn','odbc','openSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x68085e,_0xfe42b5){var _0x945c1f=function(_0x3988fa){while(--_0x3988fa){_0x68085e['push'](_0x68085e['shift']());}};_0x945c1f(++_0xfe42b5);}(_0x79ed,0xef));var _0xd79e=function(_0x10d56e,_0x559d7d){_0x10d56e=_0x10d56e-0x0;var _0x113b6e=_0x79ed[_0x10d56e];return _0x113b6e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd79e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd79e('0x1'));var jsonpatch=require(_0xd79e('0x2'));var rp=require(_0xd79e('0x3'));var moment=require(_0xd79e('0x4'));var BPromise=require(_0xd79e('0x5'));var Mustache=require('mustache');var util=require(_0xd79e('0x6'));var path=require(_0xd79e('0x7'));var sox=require(_0xd79e('0x8'));var csv=require(_0xd79e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd79e('0xa'));var squel=require(_0xd79e('0xb'));var crypto=require('crypto');var jsforce=require(_0xd79e('0xc'));var deskjs=require(_0xd79e('0xd'));var toCsv=require(_0xd79e('0x9'));var querystring=require(_0xd79e('0xe'));var Papa=require(_0xd79e('0xf'));var Redis=require(_0xd79e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd79e('0x11'));var as=require(_0xd79e('0x12'));var hardwareService=require(_0xd79e('0x13'));var logger=require(_0xd79e('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd79e('0x15'));var db=require(_0xd79e('0x16'))['db'];function respondWithStatusCode(_0x3c272f,_0x4020ec){_0x4020ec=_0x4020ec||0xcc;return function(_0xc4fc56){if(_0xc4fc56){return _0x3c272f[_0xd79e('0x17')](_0x4020ec);}return _0x3c272f['status'](_0x4020ec)['end']();};}function respondWithResult(_0x5c68bd,_0x3a81be){_0x3a81be=_0x3a81be||0xc8;return function(_0x184caa){if(_0x184caa){return _0x5c68bd[_0xd79e('0x18')](_0x3a81be)[_0xd79e('0x19')](_0x184caa);}};}function respondWithFilteredResult(_0x46172d,_0x412ab3){return function(_0x326c8c){if(_0x326c8c){var _0x45c4fd=_0x326c8c[_0xd79e('0x1a')],_0x135d72=_0x412ab3[_0xd79e('0x1b')],_0x2f5a58=_0x412ab3[_0xd79e('0x1b')]+_0x412ab3['limit'],_0x4cdeb2;if(_0x2f5a58>=_0x45c4fd){_0x2f5a58=_0x45c4fd;_0x4cdeb2=0xc8;}else{_0x4cdeb2=0xce;}_0x46172d[_0xd79e('0x18')](_0x4cdeb2);return _0x46172d[_0xd79e('0x1c')](_0xd79e('0x1d'),_0x135d72+'-'+_0x2f5a58+'/'+_0x45c4fd)[_0xd79e('0x19')](_0x326c8c);}return null;};}function patchUpdates(_0x81ab1a){return function(_0x25fb3c){try{jsonpatch[_0xd79e('0x1e')](_0x25fb3c,_0x81ab1a,!![]);}catch(_0x7e6890){return BPromise[_0xd79e('0x1f')](_0x7e6890);}return _0x25fb3c['save']();};}function saveUpdates(_0x1ff68a,_0x3a0d44){return function(_0x25ac0a){if(_0x25ac0a){return _0x25ac0a[_0xd79e('0x20')](_0x1ff68a)['then'](function(_0x53254f){return _0x53254f;});}return null;};}function removeEntity(_0x36bf78,_0x23914a){return function(_0x417112){if(_0x417112){return _0x417112[_0xd79e('0x21')]()['then'](function(){var _0x57c79e=_0x417112[_0xd79e('0x22')]({'plain':!![]});var _0x3e8acf=_0xd79e('0x23');return db[_0xd79e('0x24')][_0xd79e('0x21')]({'where':{'type':_0x3e8acf,'resourceId':_0x57c79e['id']}})['then'](function(){return _0x417112;});})[_0xd79e('0x25')](function(){_0x36bf78[_0xd79e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a5d9c,_0x3d7892){return function(_0xbf2c00){if(!_0xbf2c00){_0x1a5d9c['sendStatus'](0x194);}return _0xbf2c00;};}function handleError(_0x262fe9,_0x5039b1){_0x5039b1=_0x5039b1||0x1f4;return function(_0x219678){logger[_0xd79e('0x26')](_0x219678[_0xd79e('0x27')]);if(_0x219678[_0xd79e('0x28')]){delete _0x219678[_0xd79e('0x28')];}_0x262fe9['status'](_0x5039b1)[_0xd79e('0x29')](_0x219678);};}exports['index']=function(_0x398393,_0x30aef1){var _0x53eea1={},_0x339dfc={},_0x55e0a1={'count':0x0,'rows':[]};var _0x56c3ee=_['map'](db[_0xd79e('0x2a')]['rawAttributes'],function(_0x4e5934){return{'name':_0x4e5934[_0xd79e('0x2b')],'type':_0x4e5934[_0xd79e('0x2c')]['key']};});_0x339dfc[_0xd79e('0x2d')]=_['map'](_0x56c3ee,_0xd79e('0x28'));_0x339dfc[_0xd79e('0x2e')]=_['keys'](_0x398393['query']);_0x339dfc[_0xd79e('0x2f')]=_['intersection'](_0x339dfc[_0xd79e('0x2d')],_0x339dfc[_0xd79e('0x2e')]);_0x53eea1[_0xd79e('0x30')]=_[_0xd79e('0x31')](_0x339dfc[_0xd79e('0x2d')],qs[_0xd79e('0x32')](_0x398393[_0xd79e('0x2e')][_0xd79e('0x32')]));_0x53eea1[_0xd79e('0x30')]=_0x53eea1[_0xd79e('0x30')][_0xd79e('0x33')]?_0x53eea1['attributes']:_0x339dfc[_0xd79e('0x2d')];if(!_0x398393[_0xd79e('0x2e')][_0xd79e('0x34')](_0xd79e('0x35'))){_0x53eea1[_0xd79e('0x36')]=qs[_0xd79e('0x36')](_0x398393[_0xd79e('0x2e')][_0xd79e('0x36')]);_0x53eea1[_0xd79e('0x1b')]=qs[_0xd79e('0x1b')](_0x398393['query'][_0xd79e('0x1b')]);}_0x53eea1[_0xd79e('0x37')]=qs[_0xd79e('0x38')](_0x398393['query'][_0xd79e('0x38')]);_0x53eea1['where']=qs[_0xd79e('0x2f')](_['pick'](_0x398393[_0xd79e('0x2e')],_0x339dfc[_0xd79e('0x2f')]),_0x56c3ee);if(_0x398393[_0xd79e('0x2e')][_0xd79e('0x39')]){_0x53eea1[_0xd79e('0x3a')]=_[_0xd79e('0x3b')](_0x53eea1['where'],{'$or':_[_0xd79e('0x3c')](_0x56c3ee,function(_0x7dc3fe){if(_0x7dc3fe[_0xd79e('0x2c')]!==_0xd79e('0x3d')){var _0x3195b8={};_0x3195b8[_0x7dc3fe[_0xd79e('0x28')]]={'$like':'%'+_0x398393[_0xd79e('0x2e')][_0xd79e('0x39')]+'%'};return _0x3195b8;}})});}_0x53eea1=_[_0xd79e('0x3b')]({},_0x53eea1,_0x398393[_0xd79e('0x3e')]);var _0xc1a2fe={'where':_0x53eea1[_0xd79e('0x3a')]};return db[_0xd79e('0x2a')][_0xd79e('0x1a')](_0xc1a2fe)['then'](function(_0x73fa39){_0x55e0a1[_0xd79e('0x1a')]=_0x73fa39;if(_0x398393[_0xd79e('0x2e')][_0xd79e('0x3f')]){_0x53eea1['include']=[{'all':!![]}];}return db[_0xd79e('0x2a')][_0xd79e('0x40')](_0x53eea1);})[_0xd79e('0x25')](function(_0x5746e6){_0x55e0a1[_0xd79e('0x41')]=_0x5746e6;return _0x55e0a1;})[_0xd79e('0x25')](respondWithFilteredResult(_0x30aef1,_0x53eea1))[_0xd79e('0x42')](handleError(_0x30aef1,null));};exports[_0xd79e('0x43')]=function(_0x3e412b,_0x4c549a){var _0x21aa54={'raw':!![],'where':{'id':_0x3e412b[_0xd79e('0x44')]['id']}},_0x27eedb={};_0x27eedb[_0xd79e('0x2d')]=_[_0xd79e('0x45')](db[_0xd79e('0x2a')][_0xd79e('0x46')]);_0x27eedb[_0xd79e('0x2e')]=_[_0xd79e('0x45')](_0x3e412b[_0xd79e('0x2e')]);_0x27eedb[_0xd79e('0x2f')]=_[_0xd79e('0x31')](_0x27eedb[_0xd79e('0x2d')],_0x27eedb[_0xd79e('0x2e')]);_0x21aa54[_0xd79e('0x30')]=_[_0xd79e('0x31')](_0x27eedb[_0xd79e('0x2d')],qs[_0xd79e('0x32')](_0x3e412b['query'][_0xd79e('0x32')]));_0x21aa54[_0xd79e('0x30')]=_0x21aa54[_0xd79e('0x30')][_0xd79e('0x33')]?_0x21aa54['attributes']:_0x27eedb[_0xd79e('0x2d')];if(_0x3e412b[_0xd79e('0x2e')][_0xd79e('0x3f')]){_0x21aa54[_0xd79e('0x47')]=[{'all':!![]}];}_0x21aa54=_[_0xd79e('0x3b')]({},_0x21aa54,_0x3e412b['options']);return db[_0xd79e('0x2a')][_0xd79e('0x48')](_0x21aa54)[_0xd79e('0x25')](handleEntityNotFound(_0x4c549a,null))['then'](respondWithResult(_0x4c549a,null))[_0xd79e('0x42')](handleError(_0x4c549a,null));};exports[_0xd79e('0x49')]=function(_0x3d2195,_0x182b60){return db[_0xd79e('0x2a')][_0xd79e('0x49')](_0x3d2195[_0xd79e('0x4a')],{})['then'](function(_0x5aa296){var _0xa204e2=_0x3d2195['user'][_0xd79e('0x22')]({'plain':!![]});if(!_0xa204e2)throw new Error(_0xd79e('0x4b'));if(_0xa204e2['role']===_0xd79e('0x4c')){var _0x51bfb5=_0x5aa296[_0xd79e('0x22')]({'plain':!![]});var _0x514209=_0xd79e('0x23');return db['UserProfileSection']['find']({'where':{'name':_0x514209,'userProfileId':_0xa204e2['userProfileId']},'raw':!![]})[_0xd79e('0x25')](function(_0xa99bfc){if(_0xa99bfc&&_0xa99bfc[_0xd79e('0x4d')]===0x0){return db[_0xd79e('0x24')][_0xd79e('0x49')]({'name':_0x51bfb5[_0xd79e('0x28')],'resourceId':_0x51bfb5['id'],'type':_0xa99bfc[_0xd79e('0x28')],'sectionId':_0xa99bfc['id']},{})[_0xd79e('0x25')](function(){return _0x5aa296;});}else{return _0x5aa296;}})[_0xd79e('0x42')](function(_0x210dbe){logger[_0xd79e('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x210dbe);throw _0x210dbe;});}return _0x5aa296;})[_0xd79e('0x25')](respondWithResult(_0x182b60,0xc9))[_0xd79e('0x42')](handleError(_0x182b60,null));};exports[_0xd79e('0x20')]=function(_0x39499a,_0x55093e){if(_0x39499a['body']['id']){delete _0x39499a[_0xd79e('0x4a')]['id'];}return db[_0xd79e('0x2a')]['find']({'where':{'id':_0x39499a[_0xd79e('0x44')]['id']}})[_0xd79e('0x25')](handleEntityNotFound(_0x55093e,null))[_0xd79e('0x25')](saveUpdates(_0x39499a[_0xd79e('0x4a')],null))[_0xd79e('0x25')](respondWithResult(_0x55093e,null))[_0xd79e('0x42')](handleError(_0x55093e,null));};exports[_0xd79e('0x21')]=function(_0x3f453a,_0x43637d){return db['SquareOdbc'][_0xd79e('0x48')]({'where':{'id':_0x3f453a[_0xd79e('0x44')]['id']}})['then'](handleEntityNotFound(_0x43637d,null))[_0xd79e('0x25')](removeEntity(_0x43637d,null))['catch'](handleError(_0x43637d,null));};exports[_0xd79e('0x4e')]=function(_0x21817b,_0x31e0c1,_0xb3519e){var _0x41b20f;return db[_0xd79e('0x2a')][_0xd79e('0x48')]({'where':{'id':_0x21817b[_0xd79e('0x44')]['id']},'attributes':['id',_0xd79e('0x4f')]})[_0xd79e('0x25')](handleEntityNotFound(_0x31e0c1,null))[_0xd79e('0x25')](function(_0x264c8f){if(_0x264c8f){var _0x18a3c3=require(_0xd79e('0x50'))();_0x18a3c3[_0xd79e('0x51')](_0x264c8f[_0xd79e('0x4f')]);_0x18a3c3['closeSync']();return _0x264c8f;}})[_0xd79e('0x25')](respondWithResult(_0x31e0c1,null))[_0xd79e('0x42')](handleError(_0x31e0c1,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index bf2c7fa..04d26b5 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 _0x17a7=['exports','define','SquareOdbc','square_odbc','api','moment','bluebird','request-promise','rimraf','./squareOdbc.attributes'];(function(_0x11616c,_0x26252e){var _0x11f4bf=function(_0x185c9a){while(--_0x185c9a){_0x11616c['push'](_0x11616c['shift']());}};_0x11f4bf(++_0x26252e);}(_0x17a7,0xc2));var _0x717a=function(_0x4f5d03,_0x2a2ce8){_0x4f5d03=_0x4f5d03-0x0;var _0x44b91a=_0x17a7[_0x4f5d03];return _0x44b91a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x717a('0x0'));var moment=require(_0x717a('0x1'));var BPromise=require(_0x717a('0x2'));var rp=require(_0x717a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x717a('0x4'));var config=require('../../config/environment');var attributes=require(_0x717a('0x5'));module[_0x717a('0x6')]=function(_0x4dd8c3,_0x232539){return _0x4dd8c3[_0x717a('0x7')](_0x717a('0x8'),attributes,{'tableName':_0x717a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f0e=['../../config/environment','square_odbc','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x468ac5,_0x2edfd5){var _0x33a807=function(_0x204fb5){while(--_0x204fb5){_0x468ac5['push'](_0x468ac5['shift']());}};_0x33a807(++_0x2edfd5);}(_0x0f0e,0x17e));var _0xe0f0=function(_0x3294d2,_0x5df38b){_0x3294d2=_0x3294d2-0x0;var _0x214a30=_0x0f0e[_0x3294d2];return _0x214a30;};'use strict';var _=require(_0xe0f0('0x0'));var util=require('util');var logger=require(_0xe0f0('0x1'))(_0xe0f0('0x2'));var moment=require(_0xe0f0('0x3'));var BPromise=require(_0xe0f0('0x4'));var rp=require(_0xe0f0('0x5'));var fs=require('fs');var path=require(_0xe0f0('0x6'));var rimraf=require(_0xe0f0('0x7'));var config=require(_0xe0f0('0x8'));var attributes=require('./squareOdbc.attributes');module['exports']=function(_0x365225,_0x1846e6){return _0x365225['define']('SquareOdbc',attributes,{'tableName':_0xe0f0('0x9'),'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 8f3775b..6ee8e37 100644 --- a/server/api/squareOdbc/squareOdbc.rpc.js +++ b/server/api/squareOdbc/squareOdbc.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['where','attributes','map','include','model','ShowSquareOdbc','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareOdbc','find','options','raw'];(function(_0x314e6d,_0x671d5a){var _0x92117f=function(_0x350e2a){while(--_0x350e2a){_0x314e6d['push'](_0x314e6d['shift']());}};_0x92117f(++_0x671d5a);}(_0x7217,0x19e));var _0x7721=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x7217[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowSquareOdbc']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowSquareOdbc',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file +var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSquareOdbc','SquareOdbc','find'];(function(_0x1978cf,_0x106e44){var _0x7ec3f5=function(_0x5dbc39){while(--_0x5dbc39){_0x1978cf['push'](_0x1978cf['shift']());}};_0x7ec3f5(++_0x106e44);}(_0x55ca,0x126));var _0xa55c=function(_0x9ace37,_0x4d1159){_0x9ace37=_0x9ace37-0x0;var _0x23ecc0=_0x55ca[_0x9ace37];return _0x23ecc0;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 78466cd..5db0b1f 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 _0x856d=['/:id','destroy','removeUsers','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','/:id/users','post','addUsers','put','delete'];(function(_0x215735,_0x5e3eca){var _0x3aee2b=function(_0x2bdb40){while(--_0x2bdb40){_0x215735['push'](_0x215735['shift']());}};_0x3aee2b(++_0x5e3eca);}(_0x856d,0x180));var _0xd856=function(_0x54efb6,_0x78e231){_0x54efb6=_0x54efb6-0x0;var _0x40fc6e=_0x856d[_0x54efb6];return _0x40fc6e;};'use strict';var multer=require(_0xd856('0x0'));var util=require(_0xd856('0x1'));var path=require(_0xd856('0x2'));var timeout=require(_0xd856('0x3'));var express=require(_0xd856('0x4'));var router=express[_0xd856('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd856('0x6'));var config=require(_0xd856('0x7'));var controller=require('./squareProject.controller');router['get']('/',auth[_0xd856('0x8')](),controller['index']);router[_0xd856('0x9')]('/:id',auth[_0xd856('0x8')](),controller[_0xd856('0xa')]);router[_0xd856('0x9')](_0xd856('0xb'),auth[_0xd856('0x8')](),controller['getUsers']);router[_0xd856('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd856('0xc')]('/:id/users',auth[_0xd856('0x8')](),controller[_0xd856('0xd')]);router[_0xd856('0xe')]('/:id',auth[_0xd856('0x8')](),controller['update']);router[_0xd856('0xf')](_0xd856('0x10'),auth[_0xd856('0x8')](),controller[_0xd856('0x11')]);router['delete']('/:id/users',auth[_0xd856('0x8')](),controller[_0xd856('0x12')]);module[_0xd856('0x13')]=router; \ No newline at end of file +var _0xd055=['put','delete','destroy','removeUsers','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/users','getUsers','post','create','addUsers'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd055,0x90));var _0x5d05=function(_0x1f44e4,_0x22d9fd){_0x1f44e4=_0x1f44e4-0x0;var _0x591989=_0xd055[_0x1f44e4];return _0x591989;};'use strict';var multer=require(_0x5d05('0x0'));var util=require(_0x5d05('0x1'));var path=require('path');var timeout=require(_0x5d05('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x5d05('0x3'));var interaction=require(_0x5d05('0x4'));var config=require(_0x5d05('0x5'));var controller=require('./squareProject.controller');router['get']('/',auth[_0x5d05('0x6')](),controller[_0x5d05('0x7')]);router[_0x5d05('0x8')](_0x5d05('0x9'),auth[_0x5d05('0x6')](),controller[_0x5d05('0xa')]);router[_0x5d05('0x8')](_0x5d05('0xb'),auth[_0x5d05('0x6')](),controller[_0x5d05('0xc')]);router[_0x5d05('0xd')]('/',auth[_0x5d05('0x6')](),controller[_0x5d05('0xe')]);router[_0x5d05('0xd')](_0x5d05('0xb'),auth['isAuthenticated'](),controller[_0x5d05('0xf')]);router[_0x5d05('0x10')](_0x5d05('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x5d05('0x11')]('/:id',auth[_0x5d05('0x6')](),controller[_0x5d05('0x12')]);router[_0x5d05('0x11')](_0x5d05('0xb'),auth[_0x5d05('0x6')](),controller[_0x5d05('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 d967787..88ee307 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 _0xc902=['sequelize','exports','STRING','name','TEXT','long','getDataValue','preproduction','BLOB','production','utf8','DATE'];(function(_0x422262,_0x5ca5fc){var _0x5902e1=function(_0x2eec7e){while(--_0x2eec7e){_0x422262['push'](_0x422262['shift']());}};_0x5902e1(++_0x5ca5fc);}(_0xc902,0x15c));var _0x2c90=function(_0x127f98,_0x3583e2){_0x127f98=_0x127f98-0x0;var _0x2b33d7=_0xc902[_0x127f98];return _0x2b33d7;};'use strict';var Sequelize=require(_0x2c90('0x0'));module[_0x2c90('0x1')]={'name':{'type':Sequelize[_0x2c90('0x2')],'unique':_0x2c90('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x2c90('0x2')]},'notes':{'type':Sequelize[_0x2c90('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x2c90('0x5')),'get':function(){if(this[_0x2c90('0x6')](_0x2c90('0x7'))){return this[_0x2c90('0x6')](_0x2c90('0x7'))['toString']('utf8');}}},'production':{'type':Sequelize[_0x2c90('0x8')](_0x2c90('0x5')),'get':function(){if(this[_0x2c90('0x6')](_0x2c90('0x9'))){return this[_0x2c90('0x6')]('production')['toString'](_0x2c90('0xa'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x2c90('0xb')]}}; \ No newline at end of file +var _0xc8f5=['exports','name','STRING','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize'];(function(_0x3297a9,_0x5f43b1){var _0x47f0a8=function(_0x29f0f4){while(--_0x29f0f4){_0x3297a9['push'](_0x3297a9['shift']());}};_0x47f0a8(++_0x5f43b1);}(_0xc8f5,0x17f));var _0x5c8f=function(_0x112e2a,_0x364486){_0x112e2a=_0x112e2a-0x0;var _0x4f8af9=_0xc8f5[_0x112e2a];return _0x4f8af9;};'use strict';var Sequelize=require(_0x5c8f('0x0'));module[_0x5c8f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5c8f('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x5c8f('0x3')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x5c8f('0x4')](_0x5c8f('0x5')),'get':function(){if(this[_0x5c8f('0x6')]('preproduction')){return this['getDataValue'](_0x5c8f('0x7'))[_0x5c8f('0x8')](_0x5c8f('0x9'));}}},'production':{'type':Sequelize[_0x5c8f('0x4')](_0x5c8f('0x5')),'get':function(){if(this[_0x5c8f('0x6')](_0x5c8f('0xa'))){return this[_0x5c8f('0x6')](_0x5c8f('0xa'))[_0x5c8f('0x8')](_0x5c8f('0x9'));}}},'savedAt':{'type':Sequelize[_0x5c8f('0xb')]},'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 4e9932c..48766d5 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 _0x9a57=['find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','order','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','error','name','send','index','SquareProject','rawAttributes','fieldName','type','model','query','keys','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','map','includeAll','include','findAll','catch','show','params','intersection','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SquareProjects','UserProfileSection'];(function(_0x233d72,_0x54a0dd){var _0x2e6a0f=function(_0xda39df){while(--_0xda39df){_0x233d72['push'](_0x233d72['shift']());}};_0x2e6a0f(++_0x54a0dd);}(_0x9a57,0x12e));var _0x79a5=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9a57[_0x8c43de];return _0xa6591b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x79a5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x79a5('0x1'));var rp=require(_0x79a5('0x2'));var moment=require(_0x79a5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x79a5('0x4'));var util=require(_0x79a5('0x5'));var path=require(_0x79a5('0x6'));var sox=require(_0x79a5('0x7'));var csv=require(_0x79a5('0x8'));var ejs=require(_0x79a5('0x9'));var fs=require('fs');var _=require(_0x79a5('0xa'));var squel=require(_0x79a5('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x79a5('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x79a5('0xd'));var Redis=require(_0x79a5('0xe'));var authService=require(_0x79a5('0xf'));var qs=require(_0x79a5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x79a5('0x11'));var logger=require(_0x79a5('0x12'))(_0x79a5('0x13'));var utils=require(_0x79a5('0x14'));var config=require(_0x79a5('0x15'));var licenseUtil=require(_0x79a5('0x16'));var db=require(_0x79a5('0x17'))['db'];config['redis']=_[_0x79a5('0x18')](config[_0x79a5('0x19')],{'host':_0x79a5('0x1a'),'port':0x18eb});var socket=require(_0x79a5('0x1b'))(new Redis(config['redis']));require(_0x79a5('0x1c'))[_0x79a5('0x1d')](socket);function respondWithStatusCode(_0xef5d9d,_0x363934){_0x363934=_0x363934||0xcc;return function(_0x436b3f){if(_0x436b3f){return _0xef5d9d[_0x79a5('0x1e')](_0x363934);}return _0xef5d9d['status'](_0x363934)[_0x79a5('0x1f')]();};}function respondWithResult(_0x7a2925,_0x278bba){_0x278bba=_0x278bba||0xc8;return function(_0xa20e21){if(_0xa20e21){return _0x7a2925[_0x79a5('0x20')](_0x278bba)[_0x79a5('0x21')](_0xa20e21);}};}function respondWithFilteredResult(_0x752ba5,_0x217a1c){return function(_0x198f9f){if(_0x198f9f){var _0x32cbc7=_0x198f9f[_0x79a5('0x22')],_0x5ed6ee=_0x217a1c['offset'],_0x5e4017=_0x217a1c[_0x79a5('0x23')]+_0x217a1c[_0x79a5('0x24')],_0x260c20;if(_0x5e4017>=_0x32cbc7){_0x5e4017=_0x32cbc7;_0x260c20=0xc8;}else{_0x260c20=0xce;}_0x752ba5[_0x79a5('0x20')](_0x260c20);return _0x752ba5[_0x79a5('0x25')](_0x79a5('0x26'),_0x5ed6ee+'-'+_0x5e4017+'/'+_0x32cbc7)['json'](_0x198f9f);}return null;};}function patchUpdates(_0x3cf943){return function(_0x340341){try{jsonpatch[_0x79a5('0x27')](_0x340341,_0x3cf943,!![]);}catch(_0x3e7e7c){return BPromise[_0x79a5('0x28')](_0x3e7e7c);}return _0x340341[_0x79a5('0x29')]();};}function saveUpdates(_0x228040,_0x14cf8d){return function(_0x564f96){if(_0x564f96){return _0x564f96['update'](_0x228040)[_0x79a5('0x2a')](function(_0x2af5cb){return _0x2af5cb;});}return null;};}function removeEntity(_0x15ad61,_0x469717){return function(_0x4b071d){if(_0x4b071d){return _0x4b071d['destroy']()[_0x79a5('0x2a')](function(){var _0x40618f=_0x4b071d[_0x79a5('0x2b')]({'plain':!![]});var _0x2ddc3a='SquareProjects';return db[_0x79a5('0x2c')][_0x79a5('0x2d')]({'where':{'type':_0x2ddc3a,'resourceId':_0x40618f['id']}})[_0x79a5('0x2a')](function(){return _0x4b071d;});})[_0x79a5('0x2a')](function(){_0x15ad61['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b2310,_0x4aac7c){return function(_0x31231b){if(!_0x31231b){_0x5b2310[_0x79a5('0x1e')](0x194);}return _0x31231b;};}function handleError(_0x4569a2,_0xccab04){_0xccab04=_0xccab04||0x1f4;return function(_0x494c50){logger[_0x79a5('0x2e')](_0x494c50['stack']);if(_0x494c50[_0x79a5('0x2f')]){delete _0x494c50[_0x79a5('0x2f')];}_0x4569a2['status'](_0xccab04)[_0x79a5('0x30')](_0x494c50);};}exports[_0x79a5('0x31')]=function(_0x5817e4,_0x1c42ce){var _0x2435d4={},_0x53517d={},_0x24d265={'count':0x0,'rows':[]};var _0x401ff0=_['map'](db[_0x79a5('0x32')][_0x79a5('0x33')],function(_0x2a26ff){return{'name':_0x2a26ff[_0x79a5('0x34')],'type':_0x2a26ff[_0x79a5('0x35')]['key']};});_0x53517d[_0x79a5('0x36')]=_['map'](_0x401ff0,'name');_0x53517d[_0x79a5('0x37')]=_[_0x79a5('0x38')](_0x5817e4['query']);_0x53517d['filters']=_['intersection'](_0x53517d[_0x79a5('0x36')],_0x53517d[_0x79a5('0x37')]);_0x2435d4[_0x79a5('0x39')]=_['intersection'](_0x53517d[_0x79a5('0x36')],qs['fields'](_0x5817e4['query'][_0x79a5('0x3a')]));_0x2435d4[_0x79a5('0x39')]=_0x2435d4[_0x79a5('0x39')]['length']?_0x2435d4[_0x79a5('0x39')]:_0x53517d[_0x79a5('0x36')];if(!_0x5817e4[_0x79a5('0x37')][_0x79a5('0x3b')](_0x79a5('0x3c'))){_0x2435d4[_0x79a5('0x24')]=qs[_0x79a5('0x24')](_0x5817e4['query'][_0x79a5('0x24')]);_0x2435d4[_0x79a5('0x23')]=qs[_0x79a5('0x23')](_0x5817e4[_0x79a5('0x37')][_0x79a5('0x23')]);}_0x2435d4['order']=qs[_0x79a5('0x3d')](_0x5817e4['query'][_0x79a5('0x3d')]);_0x2435d4[_0x79a5('0x3e')]=qs['filters'](_['pick'](_0x5817e4['query'],_0x53517d[_0x79a5('0x3f')]),_0x401ff0);if(_0x5817e4['query'][_0x79a5('0x40')]){_0x2435d4[_0x79a5('0x3e')]=_[_0x79a5('0x41')](_0x2435d4[_0x79a5('0x3e')],{'$or':_[_0x79a5('0x42')](_0x401ff0,function(_0x5a2a67){if(_0x5a2a67[_0x79a5('0x35')]!=='VIRTUAL'){var _0x540944={};_0x540944[_0x5a2a67['name']]={'$like':'%'+_0x5817e4[_0x79a5('0x37')][_0x79a5('0x40')]+'%'};return _0x540944;}})});}_0x2435d4=_['merge']({},_0x2435d4,_0x5817e4['options']);var _0x957e6={'where':_0x2435d4[_0x79a5('0x3e')]};return db[_0x79a5('0x32')][_0x79a5('0x22')](_0x957e6)[_0x79a5('0x2a')](function(_0x1ea5b9){_0x24d265[_0x79a5('0x22')]=_0x1ea5b9;if(_0x5817e4[_0x79a5('0x37')][_0x79a5('0x43')]){_0x2435d4[_0x79a5('0x44')]=[{'all':!![]}];}return db['SquareProject'][_0x79a5('0x45')](_0x2435d4);})[_0x79a5('0x2a')](function(_0x12d9a2){_0x24d265['rows']=_0x12d9a2;return _0x24d265;})[_0x79a5('0x2a')](respondWithFilteredResult(_0x1c42ce,_0x2435d4))[_0x79a5('0x46')](handleError(_0x1c42ce,null));};exports[_0x79a5('0x47')]=function(_0x3f79a4,_0x39f835){var _0x20d598={'raw':![],'where':{'id':_0x3f79a4[_0x79a5('0x48')]['id']}},_0x19dcb8={};_0x19dcb8['model']=_[_0x79a5('0x38')](db['SquareProject']['rawAttributes']);_0x19dcb8[_0x79a5('0x37')]=_['keys'](_0x3f79a4[_0x79a5('0x37')]);_0x19dcb8['filters']=_[_0x79a5('0x49')](_0x19dcb8[_0x79a5('0x36')],_0x19dcb8[_0x79a5('0x37')]);_0x20d598[_0x79a5('0x39')]=_['intersection'](_0x19dcb8['model'],qs[_0x79a5('0x3a')](_0x3f79a4[_0x79a5('0x37')]['fields']));_0x20d598[_0x79a5('0x39')]=_0x20d598[_0x79a5('0x39')][_0x79a5('0x4a')]?_0x20d598[_0x79a5('0x39')]:_0x19dcb8[_0x79a5('0x36')];if(_0x3f79a4[_0x79a5('0x37')]['includeAll']){_0x20d598[_0x79a5('0x44')]=[{'all':!![]}];}_0x20d598=_[_0x79a5('0x41')]({},_0x20d598,_0x3f79a4[_0x79a5('0x4b')]);return db[_0x79a5('0x32')]['find'](_0x20d598)[_0x79a5('0x2a')](handleEntityNotFound(_0x39f835,null))[_0x79a5('0x2a')](respondWithResult(_0x39f835,null))[_0x79a5('0x46')](handleError(_0x39f835,null));};exports[_0x79a5('0x4c')]=function(_0x5d2a1e,_0x565e17){return db[_0x79a5('0x32')]['create'](_0x5d2a1e[_0x79a5('0x4d')],{})[_0x79a5('0x2a')](function(_0x4d0310){var _0x5c6a39=_0x5d2a1e[_0x79a5('0x4e')][_0x79a5('0x2b')]({'plain':!![]});if(!_0x5c6a39)throw new Error(_0x79a5('0x4f'));if(_0x5c6a39['role']===_0x79a5('0x4e')){var _0x246cd6=_0x4d0310[_0x79a5('0x2b')]({'plain':!![]});var _0x5d423d=_0x79a5('0x50');return db[_0x79a5('0x51')][_0x79a5('0x52')]({'where':{'name':_0x5d423d,'userProfileId':_0x5c6a39[_0x79a5('0x53')]},'raw':!![]})[_0x79a5('0x2a')](function(_0x588577){if(_0x588577&&_0x588577[_0x79a5('0x54')]===0x0){return db[_0x79a5('0x2c')][_0x79a5('0x4c')]({'name':_0x246cd6['name'],'resourceId':_0x246cd6['id'],'type':_0x588577['name'],'sectionId':_0x588577['id']},{})[_0x79a5('0x2a')](function(){return _0x4d0310;});}else{return _0x4d0310;}})['catch'](function(_0x4b0609){logger[_0x79a5('0x2e')](_0x79a5('0x55'),_0x4b0609);throw _0x4b0609;});}return _0x4d0310;})['then'](respondWithResult(_0x565e17,0xc9))[_0x79a5('0x46')](handleError(_0x565e17,null));};exports[_0x79a5('0x56')]=function(_0x23b3a8,_0x37d132){if(_0x23b3a8[_0x79a5('0x4d')]['id']){delete _0x23b3a8[_0x79a5('0x4d')]['id'];}return db[_0x79a5('0x32')][_0x79a5('0x52')]({'where':{'id':_0x23b3a8['params']['id']}})[_0x79a5('0x2a')](handleEntityNotFound(_0x37d132,null))[_0x79a5('0x2a')](saveUpdates(_0x23b3a8[_0x79a5('0x4d')],null))[_0x79a5('0x2a')](respondWithResult(_0x37d132,null))['catch'](handleError(_0x37d132,null));};exports[_0x79a5('0x2d')]=function(_0x1d4b97,_0x46e226){return db['SquareProject'][_0x79a5('0x52')]({'where':{'id':_0x1d4b97['params']['id']}})[_0x79a5('0x2a')](handleEntityNotFound(_0x46e226,null))[_0x79a5('0x2a')](removeEntity(_0x46e226,null))[_0x79a5('0x46')](handleError(_0x46e226,null));};exports[_0x79a5('0x57')]=function(_0x37f01c,_0x182dcd,_0x3db615){return db['SquareProject'][_0x79a5('0x52')]({'where':{'id':_0x37f01c[_0x79a5('0x48')]['id']}})[_0x79a5('0x2a')](handleEntityNotFound(_0x182dcd,null))[_0x79a5('0x2a')](function(_0x46d4b5){if(_0x46d4b5){return _0x46d4b5[_0x79a5('0x57')](_0x37f01c[_0x79a5('0x4d')][_0x79a5('0x58')],_['omit'](_0x37f01c[_0x79a5('0x4d')],[_0x79a5('0x58'),'id'])||{});}})[_0x79a5('0x2a')](respondWithResult(_0x182dcd,null))[_0x79a5('0x46')](handleError(_0x182dcd,null));};exports[_0x79a5('0x59')]=function(_0x22a47d,_0x4f1c96,_0x23df65){return db[_0x79a5('0x32')]['find']({'where':{'id':_0x22a47d[_0x79a5('0x48')]['id']}})['then'](handleEntityNotFound(_0x4f1c96,null))[_0x79a5('0x2a')](function(_0x31196f){if(_0x31196f){return _0x31196f[_0x79a5('0x59')](_0x22a47d['query'][_0x79a5('0x58')])[_0x79a5('0x2a')](function(){if(_[_0x79a5('0x5a')](_0x22a47d[_0x79a5('0x37')][_0x79a5('0x58')])){for(var _0xe07f28=0x0;_0xe07f28<_0x22a47d[_0x79a5('0x37')][_0x79a5('0x58')][_0x79a5('0x4a')];_0xe07f28+=0x1){socket[_0x79a5('0x5b')](_0x79a5('0x5c'),{'UserId':Number(_0x22a47d[_0x79a5('0x37')][_0x79a5('0x58')][_0xe07f28]),'SquareProjectId':Number(_0x22a47d[_0x79a5('0x48')]['id'])});}}else{socket[_0x79a5('0x5b')](_0x79a5('0x5c'),{'UserId':Number(_0x22a47d[_0x79a5('0x37')][_0x79a5('0x58')]),'SquareProjectId':Number(_0x22a47d[_0x79a5('0x48')]['id'])});}});}})[_0x79a5('0x2a')](respondWithStatusCode(_0x4f1c96,null))[_0x79a5('0x46')](handleError(_0x4f1c96,null));};exports[_0x79a5('0x5d')]=function(_0x118267,_0x58d933,_0x9147e0){var _0x41bd39={};var _0x9183c8={};var _0x2c3880;var _0x4e3fee;return db[_0x79a5('0x32')][_0x79a5('0x5e')]({'where':{'id':_0x118267[_0x79a5('0x48')]['id']}})[_0x79a5('0x2a')](handleEntityNotFound(_0x58d933,null))[_0x79a5('0x2a')](function(_0x1a7b3e){if(_0x1a7b3e){_0x2c3880=_0x1a7b3e;_0x9183c8[_0x79a5('0x36')]=_[_0x79a5('0x38')](db['User']['rawAttributes']);_0x9183c8[_0x79a5('0x37')]=_[_0x79a5('0x38')](_0x118267[_0x79a5('0x37')]);_0x9183c8[_0x79a5('0x3f')]=_[_0x79a5('0x49')](_0x9183c8[_0x79a5('0x36')],_0x9183c8[_0x79a5('0x37')]);_0x41bd39[_0x79a5('0x39')]=_[_0x79a5('0x49')](_0x9183c8[_0x79a5('0x36')],qs[_0x79a5('0x3a')](_0x118267[_0x79a5('0x37')][_0x79a5('0x3a')]));_0x41bd39[_0x79a5('0x39')]=_0x41bd39['attributes'][_0x79a5('0x4a')]?_0x41bd39['attributes']:_0x9183c8[_0x79a5('0x36')];_0x41bd39[_0x79a5('0x5f')]=qs[_0x79a5('0x3d')](_0x118267[_0x79a5('0x37')]['sort']);_0x41bd39[_0x79a5('0x3e')]=qs['filters'](_['pick'](_0x118267[_0x79a5('0x37')],_0x9183c8[_0x79a5('0x3f')]));if(_0x118267[_0x79a5('0x37')][_0x79a5('0x40')]){_0x41bd39['where']=_[_0x79a5('0x41')](_0x41bd39[_0x79a5('0x3e')],{'$or':_[_0x79a5('0x42')](_0x41bd39[_0x79a5('0x39')],function(_0x4807b6){var _0x18ba84={};_0x18ba84[_0x4807b6]={'$like':'%'+_0x118267[_0x79a5('0x37')]['filter']+'%'};return _0x18ba84;})});}_0x41bd39=_[_0x79a5('0x41')]({},_0x41bd39,_0x118267['options']);return _0x2c3880['getUsers'](_0x41bd39);}})['then'](function(_0x32c69a){if(_0x32c69a){_0x4e3fee=_0x32c69a['length'];if(!_0x118267[_0x79a5('0x37')][_0x79a5('0x3b')](_0x79a5('0x3c'))){_0x41bd39[_0x79a5('0x24')]=qs[_0x79a5('0x24')](_0x118267[_0x79a5('0x37')][_0x79a5('0x24')]);_0x41bd39[_0x79a5('0x23')]=qs[_0x79a5('0x23')](_0x118267[_0x79a5('0x37')][_0x79a5('0x23')]);}return _0x2c3880[_0x79a5('0x5d')](_0x41bd39);}})[_0x79a5('0x2a')](function(_0x531905){if(_0x531905){return _0x531905?{'count':_0x4e3fee,'rows':_0x531905}:null;}})[_0x79a5('0x2a')](respondWithResult(_0x58d933,null))['catch'](handleError(_0x58d933,null));}; \ No newline at end of file +var _0x9011=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','addUsers','ids','omit','removeUsers','isArray','userSquareProject:remove','emit','findOne','User','pick','filter','getUsers','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','count','offset','set','apply','reject','update','then','destroy','get','SquareProjects','UserProfileResource','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection'];(function(_0x58245d,_0x2b7846){var _0x38eb5d=function(_0x70b8fc){while(--_0x70b8fc){_0x58245d['push'](_0x58245d['shift']());}};_0x38eb5d(++_0x2b7846);}(_0x9011,0xd7));var _0x1901=function(_0x18ff0c,_0x1bace1){_0x18ff0c=_0x18ff0c-0x0;var _0x186474=_0x9011[_0x18ff0c];return _0x186474;};'use strict';var pdf=require(_0x1901('0x0'));var emlformat=require(_0x1901('0x1'));var rimraf=require(_0x1901('0x2'));var zipdir=require(_0x1901('0x3'));var jsonpatch=require(_0x1901('0x4'));var rp=require(_0x1901('0x5'));var moment=require(_0x1901('0x6'));var BPromise=require(_0x1901('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1901('0x8'));var sox=require(_0x1901('0x9'));var csv=require('to-csv');var ejs=require(_0x1901('0xa'));var fs=require('fs');var _=require(_0x1901('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1901('0xc'));var deskjs=require(_0x1901('0xd'));var toCsv=require(_0x1901('0xe'));var querystring=require(_0x1901('0xf'));var Papa=require(_0x1901('0x10'));var Redis=require(_0x1901('0x11'));var authService=require(_0x1901('0x12'));var qs=require(_0x1901('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1901('0x14'));var logger=require(_0x1901('0x15'))(_0x1901('0x16'));var utils=require('../../config/utils');var config=require(_0x1901('0x17'));var licenseUtil=require(_0x1901('0x18'));var db=require(_0x1901('0x19'))['db'];config[_0x1901('0x1a')]=_['defaults'](config[_0x1901('0x1a')],{'host':_0x1901('0x1b'),'port':0x18eb});var socket=require(_0x1901('0x1c'))(new Redis(config['redis']));require(_0x1901('0x1d'))[_0x1901('0x1e')](socket);function respondWithStatusCode(_0x55b673,_0x4c58c4){_0x4c58c4=_0x4c58c4||0xcc;return function(_0x4e97b5){if(_0x4e97b5){return _0x55b673[_0x1901('0x1f')](_0x4c58c4);}return _0x55b673[_0x1901('0x20')](_0x4c58c4)[_0x1901('0x21')]();};}function respondWithResult(_0x2a7283,_0x3ee170){_0x3ee170=_0x3ee170||0xc8;return function(_0x379e00){if(_0x379e00){return _0x2a7283[_0x1901('0x20')](_0x3ee170)[_0x1901('0x22')](_0x379e00);}};}function respondWithFilteredResult(_0x1365d5,_0xb22936){return function(_0x416fa7){if(_0x416fa7){var _0x5a8d4=_0x416fa7[_0x1901('0x23')],_0x4d36ee=_0xb22936[_0x1901('0x24')],_0xef6293=_0xb22936[_0x1901('0x24')]+_0xb22936['limit'],_0x1167c5;if(_0xef6293>=_0x5a8d4){_0xef6293=_0x5a8d4;_0x1167c5=0xc8;}else{_0x1167c5=0xce;}_0x1365d5[_0x1901('0x20')](_0x1167c5);return _0x1365d5[_0x1901('0x25')]('Content-Range',_0x4d36ee+'-'+_0xef6293+'/'+_0x5a8d4)['json'](_0x416fa7);}return null;};}function patchUpdates(_0x4ae41f){return function(_0x9afd74){try{jsonpatch[_0x1901('0x26')](_0x9afd74,_0x4ae41f,!![]);}catch(_0x598734){return BPromise[_0x1901('0x27')](_0x598734);}return _0x9afd74['save']();};}function saveUpdates(_0x422338,_0xc50d8d){return function(_0x912a50){if(_0x912a50){return _0x912a50[_0x1901('0x28')](_0x422338)[_0x1901('0x29')](function(_0x49d116){return _0x49d116;});}return null;};}function removeEntity(_0x3b242c,_0x36ed9f){return function(_0x3a1641){if(_0x3a1641){return _0x3a1641[_0x1901('0x2a')]()['then'](function(){var _0x1b8319=_0x3a1641[_0x1901('0x2b')]({'plain':!![]});var _0x175ab4=_0x1901('0x2c');return db[_0x1901('0x2d')][_0x1901('0x2a')]({'where':{'type':_0x175ab4,'resourceId':_0x1b8319['id']}})[_0x1901('0x29')](function(){return _0x3a1641;});})[_0x1901('0x29')](function(){_0x3b242c[_0x1901('0x20')](0xcc)[_0x1901('0x21')]();});}};}function handleEntityNotFound(_0x387ff4,_0x13407c){return function(_0x265cd9){if(!_0x265cd9){_0x387ff4[_0x1901('0x1f')](0x194);}return _0x265cd9;};}function handleError(_0x4d25a1,_0x56a2db){_0x56a2db=_0x56a2db||0x1f4;return function(_0x401f8b){logger['error'](_0x401f8b[_0x1901('0x2e')]);if(_0x401f8b[_0x1901('0x2f')]){delete _0x401f8b[_0x1901('0x2f')];}_0x4d25a1[_0x1901('0x20')](_0x56a2db)[_0x1901('0x30')](_0x401f8b);};}exports[_0x1901('0x31')]=function(_0x483590,_0x101b28){var _0xcee5ce={},_0x143b3c={},_0x5735f5={'count':0x0,'rows':[]};var _0x382147=_[_0x1901('0x32')](db[_0x1901('0x33')][_0x1901('0x34')],function(_0x114a0a){return{'name':_0x114a0a[_0x1901('0x35')],'type':_0x114a0a['type']['key']};});_0x143b3c['model']=_['map'](_0x382147,'name');_0x143b3c[_0x1901('0x36')]=_[_0x1901('0x37')](_0x483590[_0x1901('0x36')]);_0x143b3c[_0x1901('0x38')]=_[_0x1901('0x39')](_0x143b3c[_0x1901('0x3a')],_0x143b3c[_0x1901('0x36')]);_0xcee5ce[_0x1901('0x3b')]=_[_0x1901('0x39')](_0x143b3c[_0x1901('0x3a')],qs[_0x1901('0x3c')](_0x483590['query'][_0x1901('0x3c')]));_0xcee5ce[_0x1901('0x3b')]=_0xcee5ce[_0x1901('0x3b')][_0x1901('0x3d')]?_0xcee5ce[_0x1901('0x3b')]:_0x143b3c[_0x1901('0x3a')];if(!_0x483590[_0x1901('0x36')][_0x1901('0x3e')](_0x1901('0x3f'))){_0xcee5ce['limit']=qs[_0x1901('0x40')](_0x483590[_0x1901('0x36')][_0x1901('0x40')]);_0xcee5ce[_0x1901('0x24')]=qs[_0x1901('0x24')](_0x483590['query'][_0x1901('0x24')]);}_0xcee5ce[_0x1901('0x41')]=qs['sort'](_0x483590['query'][_0x1901('0x42')]);_0xcee5ce[_0x1901('0x43')]=qs[_0x1901('0x38')](_['pick'](_0x483590[_0x1901('0x36')],_0x143b3c['filters']),_0x382147);if(_0x483590[_0x1901('0x36')]['filter']){_0xcee5ce[_0x1901('0x43')]=_[_0x1901('0x44')](_0xcee5ce[_0x1901('0x43')],{'$or':_['map'](_0x382147,function(_0x35f636){if(_0x35f636[_0x1901('0x45')]!==_0x1901('0x46')){var _0x5c94a5={};_0x5c94a5[_0x35f636[_0x1901('0x2f')]]={'$like':'%'+_0x483590[_0x1901('0x36')]['filter']+'%'};return _0x5c94a5;}})});}_0xcee5ce=_[_0x1901('0x44')]({},_0xcee5ce,_0x483590[_0x1901('0x47')]);var _0x1ea155={'where':_0xcee5ce['where']};return db[_0x1901('0x33')][_0x1901('0x23')](_0x1ea155)['then'](function(_0x501ba9){_0x5735f5[_0x1901('0x23')]=_0x501ba9;if(_0x483590[_0x1901('0x36')][_0x1901('0x48')]){_0xcee5ce[_0x1901('0x49')]=[{'all':!![]}];}return db[_0x1901('0x33')][_0x1901('0x4a')](_0xcee5ce);})[_0x1901('0x29')](function(_0x5b3d92){_0x5735f5[_0x1901('0x4b')]=_0x5b3d92;return _0x5735f5;})[_0x1901('0x29')](respondWithFilteredResult(_0x101b28,_0xcee5ce))[_0x1901('0x4c')](handleError(_0x101b28,null));};exports['show']=function(_0x1d9444,_0xc8d8){var _0x570f51={'raw':![],'where':{'id':_0x1d9444['params']['id']}},_0x588480={};_0x588480[_0x1901('0x3a')]=_['keys'](db['SquareProject'][_0x1901('0x34')]);_0x588480[_0x1901('0x36')]=_['keys'](_0x1d9444[_0x1901('0x36')]);_0x588480[_0x1901('0x38')]=_[_0x1901('0x39')](_0x588480[_0x1901('0x3a')],_0x588480['query']);_0x570f51['attributes']=_['intersection'](_0x588480[_0x1901('0x3a')],qs[_0x1901('0x3c')](_0x1d9444[_0x1901('0x36')]['fields']));_0x570f51[_0x1901('0x3b')]=_0x570f51[_0x1901('0x3b')]['length']?_0x570f51[_0x1901('0x3b')]:_0x588480[_0x1901('0x3a')];if(_0x1d9444[_0x1901('0x36')][_0x1901('0x48')]){_0x570f51[_0x1901('0x49')]=[{'all':!![]}];}_0x570f51=_[_0x1901('0x44')]({},_0x570f51,_0x1d9444['options']);return db[_0x1901('0x33')]['find'](_0x570f51)[_0x1901('0x29')](handleEntityNotFound(_0xc8d8,null))[_0x1901('0x29')](respondWithResult(_0xc8d8,null))[_0x1901('0x4c')](handleError(_0xc8d8,null));};exports[_0x1901('0x4d')]=function(_0x206964,_0x45d8c0){return db[_0x1901('0x33')]['create'](_0x206964[_0x1901('0x4e')],{})[_0x1901('0x29')](function(_0x91f613){var _0x363648=_0x206964[_0x1901('0x4f')][_0x1901('0x2b')]({'plain':!![]});if(!_0x363648)throw new Error(_0x1901('0x50'));if(_0x363648['role']===_0x1901('0x4f')){var _0x2e3fe4=_0x91f613[_0x1901('0x2b')]({'plain':!![]});var _0x51ab69=_0x1901('0x2c');return db[_0x1901('0x51')]['find']({'where':{'name':_0x51ab69,'userProfileId':_0x363648[_0x1901('0x52')]},'raw':!![]})[_0x1901('0x29')](function(_0x394294){if(_0x394294&&_0x394294[_0x1901('0x53')]===0x0){return db[_0x1901('0x2d')][_0x1901('0x4d')]({'name':_0x2e3fe4[_0x1901('0x2f')],'resourceId':_0x2e3fe4['id'],'type':_0x394294['name'],'sectionId':_0x394294['id']},{})['then'](function(){return _0x91f613;});}else{return _0x91f613;}})[_0x1901('0x4c')](function(_0x2d3ec9){logger['error'](_0x1901('0x54'),_0x2d3ec9);throw _0x2d3ec9;});}return _0x91f613;})[_0x1901('0x29')](respondWithResult(_0x45d8c0,0xc9))[_0x1901('0x4c')](handleError(_0x45d8c0,null));};exports['update']=function(_0x26fe3e,_0x37d647){if(_0x26fe3e['body']['id']){delete _0x26fe3e[_0x1901('0x4e')]['id'];}return db['SquareProject'][_0x1901('0x55')]({'where':{'id':_0x26fe3e[_0x1901('0x56')]['id']}})[_0x1901('0x29')](handleEntityNotFound(_0x37d647,null))[_0x1901('0x29')](saveUpdates(_0x26fe3e[_0x1901('0x4e')],null))[_0x1901('0x29')](respondWithResult(_0x37d647,null))[_0x1901('0x4c')](handleError(_0x37d647,null));};exports['destroy']=function(_0xffd1fd,_0x506407){return db[_0x1901('0x33')][_0x1901('0x55')]({'where':{'id':_0xffd1fd[_0x1901('0x56')]['id']}})[_0x1901('0x29')](handleEntityNotFound(_0x506407,null))['then'](removeEntity(_0x506407,null))[_0x1901('0x4c')](handleError(_0x506407,null));};exports[_0x1901('0x57')]=function(_0x2144d0,_0x54684f,_0x49db6b){return db[_0x1901('0x33')][_0x1901('0x55')]({'where':{'id':_0x2144d0['params']['id']}})[_0x1901('0x29')](handleEntityNotFound(_0x54684f,null))[_0x1901('0x29')](function(_0x536048){if(_0x536048){return _0x536048[_0x1901('0x57')](_0x2144d0[_0x1901('0x4e')][_0x1901('0x58')],_[_0x1901('0x59')](_0x2144d0[_0x1901('0x4e')],[_0x1901('0x58'),'id'])||{});}})[_0x1901('0x29')](respondWithResult(_0x54684f,null))[_0x1901('0x4c')](handleError(_0x54684f,null));};exports[_0x1901('0x5a')]=function(_0x35fe34,_0x31879c,_0x45bccc){return db[_0x1901('0x33')][_0x1901('0x55')]({'where':{'id':_0x35fe34[_0x1901('0x56')]['id']}})[_0x1901('0x29')](handleEntityNotFound(_0x31879c,null))[_0x1901('0x29')](function(_0x16dcec){if(_0x16dcec){return _0x16dcec[_0x1901('0x5a')](_0x35fe34['query'][_0x1901('0x58')])[_0x1901('0x29')](function(){if(_[_0x1901('0x5b')](_0x35fe34[_0x1901('0x36')][_0x1901('0x58')])){for(var _0xf3702=0x0;_0xf3702<_0x35fe34[_0x1901('0x36')]['ids'][_0x1901('0x3d')];_0xf3702+=0x1){socket['emit'](_0x1901('0x5c'),{'UserId':Number(_0x35fe34[_0x1901('0x36')][_0x1901('0x58')][_0xf3702]),'SquareProjectId':Number(_0x35fe34[_0x1901('0x56')]['id'])});}}else{socket[_0x1901('0x5d')](_0x1901('0x5c'),{'UserId':Number(_0x35fe34[_0x1901('0x36')][_0x1901('0x58')]),'SquareProjectId':Number(_0x35fe34['params']['id'])});}});}})[_0x1901('0x29')](respondWithStatusCode(_0x31879c,null))[_0x1901('0x4c')](handleError(_0x31879c,null));};exports['getUsers']=function(_0x1bd6a6,_0x254d5b,_0x175ad0){var _0x452363={};var _0x4e826c={};var _0x3c0249;var _0x4d6660;return db[_0x1901('0x33')][_0x1901('0x5e')]({'where':{'id':_0x1bd6a6[_0x1901('0x56')]['id']}})[_0x1901('0x29')](handleEntityNotFound(_0x254d5b,null))[_0x1901('0x29')](function(_0x396174){if(_0x396174){_0x3c0249=_0x396174;_0x4e826c['model']=_[_0x1901('0x37')](db[_0x1901('0x5f')][_0x1901('0x34')]);_0x4e826c['query']=_['keys'](_0x1bd6a6[_0x1901('0x36')]);_0x4e826c[_0x1901('0x38')]=_[_0x1901('0x39')](_0x4e826c[_0x1901('0x3a')],_0x4e826c[_0x1901('0x36')]);_0x452363[_0x1901('0x3b')]=_[_0x1901('0x39')](_0x4e826c[_0x1901('0x3a')],qs[_0x1901('0x3c')](_0x1bd6a6['query'][_0x1901('0x3c')]));_0x452363[_0x1901('0x3b')]=_0x452363[_0x1901('0x3b')]['length']?_0x452363[_0x1901('0x3b')]:_0x4e826c[_0x1901('0x3a')];_0x452363[_0x1901('0x41')]=qs[_0x1901('0x42')](_0x1bd6a6['query'][_0x1901('0x42')]);_0x452363[_0x1901('0x43')]=qs[_0x1901('0x38')](_[_0x1901('0x60')](_0x1bd6a6[_0x1901('0x36')],_0x4e826c['filters']));if(_0x1bd6a6['query']['filter']){_0x452363[_0x1901('0x43')]=_[_0x1901('0x44')](_0x452363[_0x1901('0x43')],{'$or':_[_0x1901('0x32')](_0x452363[_0x1901('0x3b')],function(_0x5c005f){var _0x414637={};_0x414637[_0x5c005f]={'$like':'%'+_0x1bd6a6[_0x1901('0x36')][_0x1901('0x61')]+'%'};return _0x414637;})});}_0x452363=_[_0x1901('0x44')]({},_0x452363,_0x1bd6a6[_0x1901('0x47')]);return _0x3c0249[_0x1901('0x62')](_0x452363);}})[_0x1901('0x29')](function(_0x1a6895){if(_0x1a6895){_0x4d6660=_0x1a6895['length'];if(!_0x1bd6a6[_0x1901('0x36')][_0x1901('0x3e')]('nolimit')){_0x452363[_0x1901('0x40')]=qs[_0x1901('0x40')](_0x1bd6a6[_0x1901('0x36')][_0x1901('0x40')]);_0x452363[_0x1901('0x24')]=qs[_0x1901('0x24')](_0x1bd6a6['query']['offset']);}return _0x3c0249['getUsers'](_0x452363);}})['then'](function(_0x5df9ca){if(_0x5df9ca){return _0x5df9ca?{'count':_0x4d6660,'rows':_0x5df9ca}:null;}})[_0x1901('0x29')](respondWithResult(_0x254d5b,null))['catch'](handleError(_0x254d5b,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index d3f6d13..6e43238 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 _0x45d1=['events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1c205a,_0x5c1f4e){var _0x58d7a0=function(_0x5d1f62){while(--_0x5d1f62){_0x1c205a['push'](_0x1c205a['shift']());}};_0x58d7a0(++_0x5c1f4e);}(_0x45d1,0x1cb));var _0x145d=function(_0x304c47,_0x4e0e20){_0x304c47=_0x304c47-0x0;var _0x2dbd2c=_0x45d1[_0x304c47];return _0x2dbd2c;};'use strict';var EventEmitter=require(_0x145d('0x0'));var SquareProject=require(_0x145d('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x145d('0x2')](0x0);var events={'afterCreate':_0x145d('0x3'),'afterUpdate':'update','afterDestroy':_0x145d('0x4')};function emitEvent(_0x55eb4e){return function(_0x3076c2,_0x327cd3,_0x407d84){SquareProjectEvents[_0x145d('0x5')](_0x55eb4e+':'+_0x3076c2['id'],_0x3076c2);SquareProjectEvents[_0x145d('0x5')](_0x55eb4e,_0x3076c2);_0x407d84(null);};}for(var e in events){if(events[_0x145d('0x6')](e)){var event=events[e];SquareProject[_0x145d('0x7')](e,emitEvent(event));}}module[_0x145d('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x135c=['hook','exports','events','../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x38574a,_0xdee6fb){var _0x2ff952=function(_0x4d79b1){while(--_0x4d79b1){_0x38574a['push'](_0x38574a['shift']());}};_0x2ff952(++_0xdee6fb);}(_0x135c,0xda));var _0xc135=function(_0x3e08f5,_0x747a67){_0x3e08f5=_0x3e08f5-0x0;var _0x182dc8=_0x135c[_0x3e08f5];return _0x182dc8;};'use strict';var EventEmitter=require(_0xc135('0x0'));var SquareProject=require(_0xc135('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xc135('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc135('0x3')};function emitEvent(_0x3c76c0){return function(_0x1d62b8,_0x4fea6a,_0x1f0aa0){SquareProjectEvents[_0xc135('0x4')](_0x3c76c0+':'+_0x1d62b8['id'],_0x1d62b8);SquareProjectEvents[_0xc135('0x4')](_0x3c76c0,_0x1d62b8);_0x1f0aa0(null);};}for(var e in events){if(events[_0xc135('0x5')](e)){var event=events[e];SquareProject[_0xc135('0x6')](e,emitEvent(event));}}module[_0xc135('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 99512e8..3bb3f46 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 _0x28a2=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./squareProject.attributes','exports','define','square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt','lodash','util'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x28a2,0x141));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x228a('0x0'));var util=require(_0x228a('0x1'));var logger=require(_0x228a('0x2'))(_0x228a('0x3'));var moment=require(_0x228a('0x4'));var BPromise=require(_0x228a('0x5'));var rp=require(_0x228a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x228a('0x7'));var config=require('../../config/environment');var attributes=require(_0x228a('0x8'));module[_0x228a('0x9')]=function(_0x17727b,_0xf86d1d){return _0x17727b[_0x228a('0xa')]('SquareProject',attributes,{'tableName':_0x228a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x7767ab,_0x105317,_0x20494b){if(_0x7767ab['changed'](_0x228a('0xc'))){_0x7767ab[_0x228a('0xd')]=moment()[_0x228a('0xe')](_0x228a('0xf'));}if(_0x7767ab[_0x228a('0x10')](_0x228a('0x11'))){_0x7767ab[_0x228a('0x12')]=moment()[_0x228a('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x20494b(null,_0x7767ab);}}});}; \ No newline at end of file +var _0x758e=['bluebird','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','format','YYYY-MM-DD\x20HH:mm:ss','changed','publishedAt','lodash','api','moment'];(function(_0x522eb9,_0x154dd9){var _0x28df87=function(_0xcea8e){while(--_0xcea8e){_0x522eb9['push'](_0x522eb9['shift']());}};_0x28df87(++_0x154dd9);}(_0x758e,0x1af));var _0xe758=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x758e[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xe758('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe758('0x1'));var moment=require(_0xe758('0x2'));var BPromise=require(_0xe758('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe758('0x4'));var config=require(_0xe758('0x5'));var attributes=require(_0xe758('0x6'));module[_0xe758('0x7')]=function(_0x5a2226,_0x2cdf89){return _0x5a2226[_0xe758('0x8')](_0xe758('0x9'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4c03ba,_0x454ee0,_0x55601a){if(_0x4c03ba['changed']('preproduction')){_0x4c03ba['savedAt']=moment()[_0xe758('0xa')](_0xe758('0xb'));}if(_0x4c03ba[_0xe758('0xc')]('production')){_0x4c03ba[_0xe758('0xd')]=moment()['format'](_0xe758('0xb'));}_0x55601a(null,_0x4c03ba);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 3b6bdc1..1e569e4 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 _0x265c=['include','map','model','ShowSquareProject','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','socket.io-emitter','register','request','then','info','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareProject,\x20%s,\x20%s','message','result','catch','options','where','attributes'];(function(_0x5d1c41,_0x1cc0e3){var _0x17f9a4=function(_0x1666a3){while(--_0x1666a3){_0x5d1c41['push'](_0x5d1c41['shift']());}};_0x17f9a4(++_0x1cc0e3);}(_0x265c,0x88));var _0xc265=function(_0x128d8e,_0xdf3c7b){_0x128d8e=_0x128d8e-0x0;var _0x5a1306=_0x265c[_0x128d8e];return _0x5a1306;};'use strict';var _=require(_0xc265('0x0'));var util=require(_0xc265('0x1'));var moment=require('moment');var BPromise=require(_0xc265('0x2'));var rs=require(_0xc265('0x3'));var fs=require('fs');var Redis=require(_0xc265('0x4'));var db=require(_0xc265('0x5'))['db'];var utils=require(_0xc265('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc265('0x7'));var jayson=require(_0xc265('0x8'));var client=jayson[_0xc265('0x9')]['http']({'port':0x232a});config[_0xc265('0xa')]=_['defaults'](config[_0xc265('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xc265('0xb'))(new Redis(config[_0xc265('0xa')]));require('./squareProject.socket')[_0xc265('0xc')](socket);function respondWithRpcPromise(_0x270a9f,_0x1d0976,_0x54a3b2){return new BPromise(function(_0x51e2e9,_0x39b41b){return client[_0xc265('0xd')](_0x270a9f,_0x54a3b2)[_0xc265('0xe')](function(_0x3b9fb8){logger[_0xc265('0xf')]('SquareProject,\x20%s,\x20%s',_0x1d0976,_0xc265('0x10'));logger[_0xc265('0x11')](_0xc265('0x12'),_0x1d0976,_0xc265('0x10'),JSON[_0xc265('0x13')](_0x3b9fb8));if(_0x3b9fb8['error']){if(_0x3b9fb8[_0xc265('0x14')][_0xc265('0x15')]===0x1f4){logger[_0xc265('0x14')](_0xc265('0x16'),_0x1d0976,_0x3b9fb8[_0xc265('0x14')][_0xc265('0x17')]);return _0x39b41b(_0x3b9fb8['error'][_0xc265('0x17')]);}logger[_0xc265('0x14')](_0xc265('0x16'),_0x1d0976,_0x3b9fb8['error'][_0xc265('0x17')]);return _0x51e2e9(_0x3b9fb8[_0xc265('0x14')]['message']);}else{logger[_0xc265('0xf')](_0xc265('0x16'),_0x1d0976,_0xc265('0x10'));_0x51e2e9(_0x3b9fb8[_0xc265('0x18')][_0xc265('0x17')]);}})[_0xc265('0x19')](function(_0x26b55f){logger['error'](_0xc265('0x16'),_0x1d0976,_0x26b55f);_0x39b41b(_0x26b55f);});});}exports['ShowSquareProject']=function(_0x59f45b){var _0x5d6981=this;return new Promise(function(_0x5f29e0,_0x3a26d8){return db['SquareProject']['find']({'raw':_0x59f45b['options']?_0x59f45b[_0xc265('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x59f45b[_0xc265('0x1a')]?_0x59f45b[_0xc265('0x1a')][_0xc265('0x1b')]||null:null,'attributes':_0x59f45b[_0xc265('0x1a')]?_0x59f45b[_0xc265('0x1a')][_0xc265('0x1c')]||null:null,'include':_0x59f45b[_0xc265('0x1a')]?_0x59f45b[_0xc265('0x1a')][_0xc265('0x1d')]?_[_0xc265('0x1e')](_0x59f45b[_0xc265('0x1a')]['include'],function(_0x343914){return{'model':db[_0x343914[_0xc265('0x1f')]],'as':_0x343914['as'],'attributes':_0x343914[_0xc265('0x1c')],'include':_0x343914[_0xc265('0x1d')]?_[_0xc265('0x1e')](_0x343914[_0xc265('0x1d')],function(_0x478d11){return{'model':db[_0x478d11['model']],'as':_0x478d11['as'],'attributes':_0x478d11['attributes'],'include':_0x478d11[_0xc265('0x1d')]?_[_0xc265('0x1e')](_0x478d11[_0xc265('0x1d')],function(_0x3b5ee8){return{'model':db[_0x3b5ee8[_0xc265('0x1f')]],'as':_0x3b5ee8['as'],'attributes':_0x3b5ee8[_0xc265('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ca064){logger[_0xc265('0xf')]('ShowSquareProject',_0x59f45b);logger[_0xc265('0x11')](_0xc265('0x20'),_0x59f45b,JSON['stringify'](_0x4ca064));_0x5f29e0(_0x4ca064);})[_0xc265('0x19')](function(_0x39e6ad){logger[_0xc265('0x14')](_0xc265('0x20'),_0x39e6ad['message'],_0x59f45b);_0x3a26d8(_0x5d6981[_0xc265('0x14')](0x1f4,_0x39e6ad['message']));});});}; \ No newline at end of file +var _0xdfec=['socket.io-emitter','./squareProject.socket','register','request','then','SquareProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','SquareProject','find','options','raw','attributes','include','model','map','ShowSquareProject','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x30a98c,_0x243723){var _0x18456d=function(_0x8b97fa){while(--_0x8b97fa){_0x30a98c['push'](_0x30a98c['shift']());}};_0x18456d(++_0x243723);}(_0xdfec,0x15b));var _0xcdfe=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdfec[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xcdfe('0x0'));var util=require(_0xcdfe('0x1'));var moment=require('moment');var BPromise=require(_0xcdfe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcdfe('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcdfe('0x4'))(_0xcdfe('0x5'));var config=require(_0xcdfe('0x6'));var jayson=require(_0xcdfe('0x7'));var client=jayson[_0xcdfe('0x8')][_0xcdfe('0x9')]({'port':0x232a});config[_0xcdfe('0xa')]=_[_0xcdfe('0xb')](config[_0xcdfe('0xa')],{'host':_0xcdfe('0xc'),'port':0x18eb});var socket=require(_0xcdfe('0xd'))(new Redis(config[_0xcdfe('0xa')]));require(_0xcdfe('0xe'))[_0xcdfe('0xf')](socket);function respondWithRpcPromise(_0x5f21ed,_0x5b1acb,_0x2c13a2){return new BPromise(function(_0xd59275,_0x3155d4){return client[_0xcdfe('0x10')](_0x5f21ed,_0x2c13a2)[_0xcdfe('0x11')](function(_0x36961d){logger['info'](_0xcdfe('0x12'),_0x5b1acb,_0xcdfe('0x13'));logger[_0xcdfe('0x14')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x5b1acb,_0xcdfe('0x13'),JSON[_0xcdfe('0x15')](_0x36961d));if(_0x36961d['error']){if(_0x36961d[_0xcdfe('0x16')][_0xcdfe('0x17')]===0x1f4){logger[_0xcdfe('0x16')](_0xcdfe('0x12'),_0x5b1acb,_0x36961d[_0xcdfe('0x16')][_0xcdfe('0x18')]);return _0x3155d4(_0x36961d[_0xcdfe('0x16')][_0xcdfe('0x18')]);}logger[_0xcdfe('0x16')](_0xcdfe('0x12'),_0x5b1acb,_0x36961d['error']['message']);return _0xd59275(_0x36961d[_0xcdfe('0x16')][_0xcdfe('0x18')]);}else{logger[_0xcdfe('0x19')](_0xcdfe('0x12'),_0x5b1acb,_0xcdfe('0x13'));_0xd59275(_0x36961d['result'][_0xcdfe('0x18')]);}})['catch'](function(_0x42a972){logger['error'](_0xcdfe('0x12'),_0x5b1acb,_0x42a972);_0x3155d4(_0x42a972);});});}exports['ShowSquareProject']=function(_0x4d8fab){var _0x15e201=this;return new Promise(function(_0x57c39a,_0x5e3b75){return db[_0xcdfe('0x1a')][_0xcdfe('0x1b')]({'raw':_0x4d8fab[_0xcdfe('0x1c')]?_0x4d8fab['options'][_0xcdfe('0x1d')]===undefined?!![]:![]:!![],'where':_0x4d8fab[_0xcdfe('0x1c')]?_0x4d8fab[_0xcdfe('0x1c')]['where']||null:null,'attributes':_0x4d8fab['options']?_0x4d8fab[_0xcdfe('0x1c')][_0xcdfe('0x1e')]||null:null,'include':_0x4d8fab['options']?_0x4d8fab[_0xcdfe('0x1c')][_0xcdfe('0x1f')]?_['map'](_0x4d8fab[_0xcdfe('0x1c')][_0xcdfe('0x1f')],function(_0x257127){return{'model':db[_0x257127[_0xcdfe('0x20')]],'as':_0x257127['as'],'attributes':_0x257127[_0xcdfe('0x1e')],'include':_0x257127[_0xcdfe('0x1f')]?_[_0xcdfe('0x21')](_0x257127['include'],function(_0x15cedb){return{'model':db[_0x15cedb[_0xcdfe('0x20')]],'as':_0x15cedb['as'],'attributes':_0x15cedb['attributes'],'include':_0x15cedb[_0xcdfe('0x1f')]?_[_0xcdfe('0x21')](_0x15cedb[_0xcdfe('0x1f')],function(_0x1cb276){return{'model':db[_0x1cb276['model']],'as':_0x1cb276['as'],'attributes':_0x1cb276[_0xcdfe('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x351fcc){logger['info']('ShowSquareProject',_0x4d8fab);logger[_0xcdfe('0x14')](_0xcdfe('0x22'),_0x4d8fab,JSON[_0xcdfe('0x15')](_0x351fcc));_0x57c39a(_0x351fcc);})[_0xcdfe('0x23')](function(_0x400f0c){logger[_0xcdfe('0x16')]('ShowSquareProject',_0x400f0c[_0xcdfe('0x18')],_0x4d8fab);_0x5e3b75(_0x15e201[_0xcdfe('0x16')](0x1f4,_0x400f0c[_0xcdfe('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index d419be2..a20dbad 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 _0x187d=['./squareProject.events','remove','update','emit','removeListener','length','squareProject:'];(function(_0x473826,_0x343007){var _0x11fcbd=function(_0x44a6cf){while(--_0x44a6cf){_0x473826['push'](_0x473826['shift']());}};_0x11fcbd(++_0x343007);}(_0x187d,0x93));var _0xd187=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x187d[_0x4c7fb5];return _0x2e10ac;};'use strict';var SquareProjectEvents=require(_0xd187('0x0'));var events=['save',_0xd187('0x1'),_0xd187('0x2')];function createListener(_0x44d5f6,_0x1cb41f){return function(_0x18498b){_0x1cb41f[_0xd187('0x3')](_0x44d5f6,_0x18498b);};}function removeListener(_0x58622a,_0x28fa0b){return function(){SquareProjectEvents[_0xd187('0x4')](_0x58622a,_0x28fa0b);};}exports['register']=function(_0x1d2533){for(var _0x58ee7=0x0,_0x444a60=events[_0xd187('0x5')];_0x58ee7<_0x444a60;_0x58ee7++){var _0x28ce2f=events[_0x58ee7];var _0x2d6992=createListener(_0xd187('0x6')+_0x28ce2f,_0x1d2533);SquareProjectEvents['on'](_0x28ce2f,_0x2d6992);}}; \ No newline at end of file +var _0x430c=['register','length','squareProject:','./squareProject.events','update','removeListener'];(function(_0x147a4b,_0x4e4526){var _0x4a985d=function(_0x2015b8){while(--_0x2015b8){_0x147a4b['push'](_0x147a4b['shift']());}};_0x4a985d(++_0x4e4526);}(_0x430c,0x1a1));var _0xc430=function(_0x39609a,_0x28a563){_0x39609a=_0x39609a-0x0;var _0xecd92=_0x430c[_0x39609a];return _0xecd92;};'use strict';var SquareProjectEvents=require(_0xc430('0x0'));var events=['save','remove',_0xc430('0x1')];function createListener(_0xe2d084,_0x1d5b5e){return function(_0x503988){_0x1d5b5e['emit'](_0xe2d084,_0x503988);};}function removeListener(_0x5ccda6,_0x47d8b9){return function(){SquareProjectEvents[_0xc430('0x2')](_0x5ccda6,_0x47d8b9);};}exports[_0xc430('0x3')]=function(_0x50b256){for(var _0x42aa9c=0x0,_0x4de44f=events[_0xc430('0x4')];_0x42aa9c<_0x4de44f;_0x42aa9c++){var _0x2e51c6=events[_0x42aa9c];var _0x814a90=createListener(_0xc430('0x5')+_0x2e51c6,_0x50b256);SquareProjectEvents['on'](_0x2e51c6,_0x814a90);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 5d1b828..62363a4 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 _0x0fb8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','download','post','isAuthenticated','create','put','/:id','update','delete','/:id/delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x0fb8,0x10d));var _0x80fb=function(_0x1de9d4,_0x3940c4){_0x1de9d4=_0x1de9d4-0x0;var _0xe52a0b=_0x0fb8[_0x1de9d4];return _0xe52a0b;};'use strict';var multer=require(_0x80fb('0x0'));var util=require(_0x80fb('0x1'));var path=require(_0x80fb('0x2'));var timeout=require(_0x80fb('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x80fb('0x4'));var interaction=require(_0x80fb('0x5'));var config=require(_0x80fb('0x6'));var controller=require(_0x80fb('0x7'));router[_0x80fb('0x8')]('/',auth['isAuthenticated'](),controller[_0x80fb('0x9')]);router[_0x80fb('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x80fb('0xa')]);router[_0x80fb('0xb')]('/',auth[_0x80fb('0xc')](),controller[_0x80fb('0xd')]);router[_0x80fb('0xe')](_0x80fb('0xf'),auth[_0x80fb('0xc')](),controller[_0x80fb('0x10')]);router[_0x80fb('0x11')](_0x80fb('0x12'),auth[_0x80fb('0xc')](),controller[_0x80fb('0x13')]);module[_0x80fb('0x14')]=router; \ No newline at end of file +var _0x0414=['exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','isAuthenticated','download','post','put','/:id','update','delete','destroy'];(function(_0x1cd2d5,_0x596527){var _0x12ac25=function(_0x1494c7){while(--_0x1494c7){_0x1cd2d5['push'](_0x1cd2d5['shift']());}};_0x12ac25(++_0x596527);}(_0x0414,0x1cc));var _0x4041=function(_0x3ff685,_0x304b9e){_0x3ff685=_0x3ff685-0x0;var _0x2046c9=_0x0414[_0x3ff685];return _0x2046c9;};'use strict';var multer=require('multer');var util=require(_0x4041('0x0'));var path=require('path');var timeout=require(_0x4041('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x4041('0x2'));var interaction=require(_0x4041('0x3'));var config=require(_0x4041('0x4'));var controller=require(_0x4041('0x5'));router[_0x4041('0x6')]('/',auth['isAuthenticated'](),controller[_0x4041('0x7')]);router['get']('/:id',auth[_0x4041('0x8')](),controller['show']);router[_0x4041('0x6')]('/:id/download',auth[_0x4041('0x8')](),controller[_0x4041('0x9')]);router[_0x4041('0xa')]('/',auth[_0x4041('0x8')](),controller['create']);router[_0x4041('0xb')](_0x4041('0xc'),auth['isAuthenticated'](),controller[_0x4041('0xd')]);router[_0x4041('0xe')]('/:id/delete',auth[_0x4041('0x8')](),controller[_0x4041('0xf')]);module[_0x4041('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 4df36e7..95b672a 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 _0x8c2e=['STRING','VIRTUAL','savePath','substring','lastIndexOf','sequelize','exports'];(function(_0x414f67,_0x861aed){var _0x338537=function(_0x4696fd){while(--_0x4696fd){_0x414f67['push'](_0x414f67['shift']());}};_0x338537(++_0x861aed);}(_0x8c2e,0x17f));var _0xe8c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8c2e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe8c2('0x0'));module[_0xe8c2('0x1')]={'uniqueid':{'type':Sequelize[_0xe8c2('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe8c2('0x2')]},'context':{'type':Sequelize[_0xe8c2('0x2')]},'extension':{'type':Sequelize[_0xe8c2('0x2')]},'priority':{'type':Sequelize[_0xe8c2('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xe8c2('0x2')]},'projectName':{'type':Sequelize[_0xe8c2('0x2')]},'saveName':{'type':Sequelize[_0xe8c2('0x2')]},'filename':{'type':Sequelize[_0xe8c2('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xe8c2('0x3')],'get':function(){var _0x5b8b1c='';var _0x1db8a6=this['getDataValue'](_0xe8c2('0x4'));if(_0x1db8a6){_0x5b8b1c=_0x1db8a6[_0xe8c2('0x5')](_0x1db8a6[_0xe8c2('0x6')]('.'));}return _0x5b8b1c;}}}; \ No newline at end of file +var _0x1c38=['savePath','substring','exports','STRING','VIRTUAL'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1c38,0x188));var _0x81c3=function(_0x1afda3,_0xf74e14){_0x1afda3=_0x1afda3-0x0;var _0x454b7c=_0x1c38[_0x1afda3];return _0x454b7c;};'use strict';var Sequelize=require('sequelize');module[_0x81c3('0x0')]={'uniqueid':{'type':Sequelize[_0x81c3('0x1')]},'callerid':{'type':Sequelize[_0x81c3('0x1')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x81c3('0x1')]},'extension':{'type':Sequelize[_0x81c3('0x1')]},'priority':{'type':Sequelize[_0x81c3('0x1')]},'accountcode':{'type':Sequelize[_0x81c3('0x1')]},'dnid':{'type':Sequelize[_0x81c3('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x81c3('0x1')]},'savePath':{'type':Sequelize[_0x81c3('0x1')]},'format':{'type':Sequelize[_0x81c3('0x2')],'get':function(){var _0x564cc3='';var _0x1303a6=this['getDataValue'](_0x81c3('0x3'));if(_0x1303a6){_0x564cc3=_0x1303a6[_0x81c3('0x4')](_0x1303a6['lastIndexOf']('.'));}return _0x564cc3;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 79074fa..cd8ef82 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 _0x3bbd=['offset','limit','reject','save','update','then','destroy','error','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','catch','body','download','../../components/encryptor','uniqueid','savePath','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count'];(function(_0x174d77,_0x420cec){var _0x3f2328=function(_0x5368c1){while(--_0x5368c1){_0x174d77['push'](_0x174d77['shift']());}};_0x3f2328(++_0x420cec);}(_0x3bbd,0x1b2));var _0xd3bb=function(_0x54dc49,_0x39e070){_0x54dc49=_0x54dc49-0x0;var _0x3b18a5=_0x3bbd[_0x54dc49];return _0x3b18a5;};'use strict';var pdf=require(_0xd3bb('0x0'));var emlformat=require(_0xd3bb('0x1'));var rimraf=require(_0xd3bb('0x2'));var zipdir=require(_0xd3bb('0x3'));var jsonpatch=require(_0xd3bb('0x4'));var rp=require(_0xd3bb('0x5'));var moment=require(_0xd3bb('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd3bb('0x7'));var sox=require('sox');var csv=require(_0xd3bb('0x8'));var ejs=require(_0xd3bb('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd3bb('0xa'));var crypto=require(_0xd3bb('0xb'));var jsforce=require(_0xd3bb('0xc'));var deskjs=require(_0xd3bb('0xd'));var toCsv=require(_0xd3bb('0x8'));var querystring=require(_0xd3bb('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd3bb('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd3bb('0x10'));var hardwareService=require(_0xd3bb('0x11'));var logger=require(_0xd3bb('0x12'))('api');var utils=require(_0xd3bb('0x13'));var config=require(_0xd3bb('0x14'));var licenseUtil=require(_0xd3bb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19fa07,_0x194c28){_0x194c28=_0x194c28||0xcc;return function(_0x1753f8){if(_0x1753f8){return _0x19fa07[_0xd3bb('0x16')](_0x194c28);}return _0x19fa07[_0xd3bb('0x17')](_0x194c28)['end']();};}function respondWithResult(_0x1dca8e,_0x18ff16){_0x18ff16=_0x18ff16||0xc8;return function(_0x17639f){if(_0x17639f){return _0x1dca8e[_0xd3bb('0x17')](_0x18ff16)[_0xd3bb('0x18')](_0x17639f);}};}function respondWithFilteredResult(_0x1fb239,_0x588d44){return function(_0x223fc6){if(_0x223fc6){var _0x4a08fc=_0x223fc6[_0xd3bb('0x19')],_0x4b0ddd=_0x588d44[_0xd3bb('0x1a')],_0x5b7c78=_0x588d44['offset']+_0x588d44[_0xd3bb('0x1b')],_0x3da3e8;if(_0x5b7c78>=_0x4a08fc){_0x5b7c78=_0x4a08fc;_0x3da3e8=0xc8;}else{_0x3da3e8=0xce;}_0x1fb239[_0xd3bb('0x17')](_0x3da3e8);return _0x1fb239['set']('Content-Range',_0x4b0ddd+'-'+_0x5b7c78+'/'+_0x4a08fc)['json'](_0x223fc6);}return null;};}function patchUpdates(_0x17951e){return function(_0x40ab11){try{jsonpatch['apply'](_0x40ab11,_0x17951e,!![]);}catch(_0x5381b2){return BPromise[_0xd3bb('0x1c')](_0x5381b2);}return _0x40ab11[_0xd3bb('0x1d')]();};}function saveUpdates(_0x2e7701,_0x494b7c){return function(_0x1edcfa){if(_0x1edcfa){return _0x1edcfa[_0xd3bb('0x1e')](_0x2e7701)[_0xd3bb('0x1f')](function(_0x33f22b){return _0x33f22b;});}return null;};}function removeEntity(_0x49ad60,_0x274cc8){return function(_0x15557b){if(_0x15557b){return _0x15557b[_0xd3bb('0x20')]()[_0xd3bb('0x1f')](function(){_0x49ad60[_0xd3bb('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf49f2,_0x220354){return function(_0x299f90){if(!_0x299f90){_0xf49f2['sendStatus'](0x194);}return _0x299f90;};}function handleError(_0x26880e,_0x1717bd){_0x1717bd=_0x1717bd||0x1f4;return function(_0x5c1f53){logger[_0xd3bb('0x21')](_0x5c1f53['stack']);if(_0x5c1f53[_0xd3bb('0x22')]){delete _0x5c1f53['name'];}_0x26880e[_0xd3bb('0x17')](_0x1717bd)[_0xd3bb('0x23')](_0x5c1f53);};}exports[_0xd3bb('0x24')]=function(_0x11f4d0,_0x32ae40){var _0x12def0={},_0x30e92b={},_0x223f47={'count':0x0,'rows':[]};var _0x43ad61=_[_0xd3bb('0x25')](db[_0xd3bb('0x26')][_0xd3bb('0x27')],function(_0x1cabe6){return{'name':_0x1cabe6[_0xd3bb('0x28')],'type':_0x1cabe6[_0xd3bb('0x29')][_0xd3bb('0x2a')]};});_0x30e92b[_0xd3bb('0x2b')]=_['map'](_0x43ad61,_0xd3bb('0x22'));_0x30e92b[_0xd3bb('0x2c')]=_[_0xd3bb('0x2d')](_0x11f4d0[_0xd3bb('0x2c')]);_0x30e92b['filters']=_[_0xd3bb('0x2e')](_0x30e92b[_0xd3bb('0x2b')],_0x30e92b[_0xd3bb('0x2c')]);_0x12def0[_0xd3bb('0x2f')]=_['intersection'](_0x30e92b[_0xd3bb('0x2b')],qs['fields'](_0x11f4d0['query'][_0xd3bb('0x30')]));_0x12def0[_0xd3bb('0x2f')]=_0x12def0[_0xd3bb('0x2f')][_0xd3bb('0x31')]?_0x12def0[_0xd3bb('0x2f')]:_0x30e92b[_0xd3bb('0x2b')];if(!_0x11f4d0[_0xd3bb('0x2c')][_0xd3bb('0x32')](_0xd3bb('0x33'))){_0x12def0['limit']=qs[_0xd3bb('0x1b')](_0x11f4d0[_0xd3bb('0x2c')][_0xd3bb('0x1b')]);_0x12def0[_0xd3bb('0x1a')]=qs[_0xd3bb('0x1a')](_0x11f4d0['query'][_0xd3bb('0x1a')]);}_0x12def0[_0xd3bb('0x34')]=qs[_0xd3bb('0x35')](_0x11f4d0[_0xd3bb('0x2c')][_0xd3bb('0x35')]);_0x12def0[_0xd3bb('0x36')]=qs[_0xd3bb('0x37')](_[_0xd3bb('0x38')](_0x11f4d0[_0xd3bb('0x2c')],_0x30e92b['filters']),_0x43ad61);if(_0x11f4d0['query'][_0xd3bb('0x39')]){_0x12def0[_0xd3bb('0x36')]=_[_0xd3bb('0x3a')](_0x12def0[_0xd3bb('0x36')],{'$or':_[_0xd3bb('0x25')](_0x43ad61,function(_0x509478){if(_0x509478[_0xd3bb('0x29')]!==_0xd3bb('0x3b')){var _0x30336c={};_0x30336c[_0x509478[_0xd3bb('0x22')]]={'$like':'%'+_0x11f4d0[_0xd3bb('0x2c')][_0xd3bb('0x39')]+'%'};return _0x30336c;}})});}_0x12def0=_[_0xd3bb('0x3a')]({},_0x12def0,_0x11f4d0[_0xd3bb('0x3c')]);var _0x593b51={'where':_0x12def0['where']};return db[_0xd3bb('0x26')][_0xd3bb('0x19')](_0x593b51)[_0xd3bb('0x1f')](function(_0x223b7f){_0x223f47[_0xd3bb('0x19')]=_0x223b7f;if(_0x11f4d0['query'][_0xd3bb('0x3d')]){_0x12def0[_0xd3bb('0x3e')]=[{'all':!![]}];}return db['SquareRecording'][_0xd3bb('0x3f')](_0x12def0);})['then'](function(_0x391d08){_0x223f47[_0xd3bb('0x40')]=_0x391d08;return _0x223f47;})[_0xd3bb('0x1f')](respondWithFilteredResult(_0x32ae40,_0x12def0))['catch'](handleError(_0x32ae40,null));};exports[_0xd3bb('0x41')]=function(_0x2b2480,_0x373229){var _0x1d805f={'raw':!![],'where':{'id':_0x2b2480[_0xd3bb('0x42')]['id']}},_0x3b5977={};_0x3b5977[_0xd3bb('0x2b')]=_[_0xd3bb('0x2d')](db['SquareRecording']['rawAttributes']);_0x3b5977[_0xd3bb('0x2c')]=_[_0xd3bb('0x2d')](_0x2b2480[_0xd3bb('0x2c')]);_0x3b5977[_0xd3bb('0x37')]=_[_0xd3bb('0x2e')](_0x3b5977[_0xd3bb('0x2b')],_0x3b5977['query']);_0x1d805f[_0xd3bb('0x2f')]=_[_0xd3bb('0x2e')](_0x3b5977[_0xd3bb('0x2b')],qs[_0xd3bb('0x30')](_0x2b2480[_0xd3bb('0x2c')]['fields']));_0x1d805f[_0xd3bb('0x2f')]=_0x1d805f[_0xd3bb('0x2f')][_0xd3bb('0x31')]?_0x1d805f[_0xd3bb('0x2f')]:_0x3b5977['model'];if(_0x2b2480[_0xd3bb('0x2c')][_0xd3bb('0x3d')]){_0x1d805f[_0xd3bb('0x3e')]=[{'all':!![]}];}_0x1d805f=_[_0xd3bb('0x3a')]({},_0x1d805f,_0x2b2480[_0xd3bb('0x3c')]);return db[_0xd3bb('0x26')][_0xd3bb('0x43')](_0x1d805f)['then'](handleEntityNotFound(_0x373229,null))[_0xd3bb('0x1f')](respondWithResult(_0x373229,null))['catch'](handleError(_0x373229,null));};exports['create']=function(_0x153c9c,_0x225449){return db[_0xd3bb('0x26')][_0xd3bb('0x44')](_0x153c9c['body'],{})[_0xd3bb('0x1f')](respondWithResult(_0x225449,0xc9))[_0xd3bb('0x45')](handleError(_0x225449,null));};exports[_0xd3bb('0x1e')]=function(_0x1e27fd,_0x587744){if(_0x1e27fd[_0xd3bb('0x46')]['id']){delete _0x1e27fd[_0xd3bb('0x46')]['id'];}return db[_0xd3bb('0x26')][_0xd3bb('0x43')]({'where':{'id':_0x1e27fd[_0xd3bb('0x42')]['id']}})['then'](handleEntityNotFound(_0x587744,null))[_0xd3bb('0x1f')](saveUpdates(_0x1e27fd[_0xd3bb('0x46')],null))['then'](respondWithResult(_0x587744,null))['catch'](handleError(_0x587744,null));};exports[_0xd3bb('0x47')]=function(_0x2ffdf3,_0x3bd987,_0x2b4621){var _0xe20efc=require(_0xd3bb('0x48'));var _0x2fec92=![];var _0x51fd68={};if(_0x2ffdf3[_0xd3bb('0x2c')][_0xd3bb('0x29')]&&_0x2ffdf3['query'][_0xd3bb('0x29')]==='uniqueid'){_0x51fd68[_0xd3bb('0x49')]=_0x2ffdf3['params']['id'];}else{_0x51fd68['id']=_0x2ffdf3[_0xd3bb('0x42')]['id'];}return db[_0xd3bb('0x26')][_0xd3bb('0x43')]({'where':_0x51fd68,'attributes':['id',_0xd3bb('0x4a'),'filename'],'raw':!![]})[_0xd3bb('0x1f')](handleEntityNotFound(_0x3bd987,null))['then'](function(_0x254b40){if(_0x254b40){var _0x1965d8=_0x254b40[_0xd3bb('0x4a')];var _0x37f5e3=util['format']('%s.cypher',_0x1965d8);if(fs['existsSync'](_0x37f5e3)){_0x2fec92=!![];return _0xe20efc['decryptFile'](_0x37f5e3,_0x1965d8,config[_0xd3bb('0x4b')][_0xd3bb('0x4c')])[_0xd3bb('0x1f')](function(){return _0x254b40;});}return _0x254b40;}})[_0xd3bb('0x1f')](function(_0x7495c3){if(_0x7495c3){var _0x5d16a5=_0x7495c3[_0xd3bb('0x4a')];if(!fs['existsSync'](_0x5d16a5)){throw new db[(_0xd3bb('0x4d'))][(_0xd3bb('0x4e'))](_0xd3bb('0x4f'));}if(_0x7495c3[_0xd3bb('0x50')]){return _0x3bd987['download'](_0x5d16a5,_0x7495c3['filename']+path[_0xd3bb('0x51')](_0x5d16a5),function(){if(_0x2fec92){fs['unlink'](_0x5d16a5);}});}else{return _0x3bd987[_0xd3bb('0x47')](_0x5d16a5,function(_0x5215da){if(_0x2fec92){fs[_0xd3bb('0x52')](_0x5d16a5);}});}}})[_0xd3bb('0x45')](function(_0x5d382e){if(_0x5d382e[_0xd3bb('0x53')]==='SquareRecording\x20not\x20found'){_0x3bd987[_0xd3bb('0x17')](0x194)[_0xd3bb('0x23')](_0xd3bb('0x54'));}else{return handleError(_0x3bd987,null);}});};exports[_0xd3bb('0x20')]=function(_0x3d4cf5,_0x33c091){return db['SquareRecording'][_0xd3bb('0x43')]({'where':{'id':_0x3d4cf5[_0xd3bb('0x42')]['id']}})[_0xd3bb('0x1f')](function(_0x578187){if(!_0x578187)throw new ReferenceError('Entity\x20not\x20found');return _0x578187;})[_0xd3bb('0x1f')](function(_0x534020){var _0x29f9e7=_0x534020[_0xd3bb('0x4a')];logger[_0xd3bb('0x55')](_0xd3bb('0x56'),_0x29f9e7);if(!_[_0xd3bb('0x57')](_0x534020[_0xd3bb('0x4a')])&&fs['existsSync'](_0x29f9e7)){logger['info'](_0xd3bb('0x58')+_0x29f9e7+_0xd3bb('0x59'));fs['unlinkSync'](_0x29f9e7);}_0x29f9e7=_0x29f9e7+_0xd3bb('0x5a');if(!_['isNil'](_0x534020['savePath'])&&fs['existsSync'](_0x29f9e7)){logger[_0xd3bb('0x55')](_0xd3bb('0x58')+_0x29f9e7+_0xd3bb('0x59'));fs[_0xd3bb('0x5b')](_0x29f9e7);}return _0x534020;})[_0xd3bb('0x1f')](function(_0x4aebc3){if(!_0x4aebc3)throw new InternalError();return _0x4aebc3[_0xd3bb('0x20')]();})[_0xd3bb('0x1f')](function(){_0x33c091['status'](0xcc)['end']();})[_0xd3bb('0x45')](handleError(_0x33c091,null));}; \ No newline at end of file +var _0xf5de=['Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','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','status','end','count','offset','limit','set','json','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','SquareRecording','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','include','findAll','rows','catch','params','rawAttributes','includeAll','options','find','create','body','../../components/encryptor','uniqueid','filename','savePath','format','decryptFile','secrets','recording','existsSync','ValidationError','SquareRecording\x20not\x20found','download','unlink','message'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xf5de,0x1e4));var _0xef5d=function(_0x4899d0,_0xdcb3d2){_0x4899d0=_0x4899d0-0x0;var _0x53153e=_0xf5de[_0x4899d0];return _0x53153e;};'use strict';var pdf=require(_0xef5d('0x0'));var emlformat=require(_0xef5d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xef5d('0x2'));var jsonpatch=require(_0xef5d('0x3'));var rp=require(_0xef5d('0x4'));var moment=require(_0xef5d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xef5d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xef5d('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xef5d('0x8'));var squel=require(_0xef5d('0x9'));var crypto=require(_0xef5d('0xa'));var jsforce=require(_0xef5d('0xb'));var deskjs=require(_0xef5d('0xc'));var toCsv=require('to-csv');var querystring=require(_0xef5d('0xd'));var Papa=require(_0xef5d('0xe'));var Redis=require(_0xef5d('0xf'));var authService=require(_0xef5d('0x10'));var qs=require(_0xef5d('0x11'));var as=require(_0xef5d('0x12'));var hardwareService=require(_0xef5d('0x13'));var logger=require(_0xef5d('0x14'))(_0xef5d('0x15'));var utils=require('../../config/utils');var config=require(_0xef5d('0x16'));var licenseUtil=require(_0xef5d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfe8c73,_0x1ac8fb){_0x1ac8fb=_0x1ac8fb||0xcc;return function(_0x287950){if(_0x287950){return _0xfe8c73['sendStatus'](_0x1ac8fb);}return _0xfe8c73[_0xef5d('0x18')](_0x1ac8fb)[_0xef5d('0x19')]();};}function respondWithResult(_0x4ca124,_0x2f53ce){_0x2f53ce=_0x2f53ce||0xc8;return function(_0x3560c3){if(_0x3560c3){return _0x4ca124[_0xef5d('0x18')](_0x2f53ce)['json'](_0x3560c3);}};}function respondWithFilteredResult(_0x512ee3,_0x10c488){return function(_0x41a8c9){if(_0x41a8c9){var _0x1e2003=_0x41a8c9[_0xef5d('0x1a')],_0x3da170=_0x10c488[_0xef5d('0x1b')],_0xc5d737=_0x10c488[_0xef5d('0x1b')]+_0x10c488[_0xef5d('0x1c')],_0x58c820;if(_0xc5d737>=_0x1e2003){_0xc5d737=_0x1e2003;_0x58c820=0xc8;}else{_0x58c820=0xce;}_0x512ee3[_0xef5d('0x18')](_0x58c820);return _0x512ee3[_0xef5d('0x1d')]('Content-Range',_0x3da170+'-'+_0xc5d737+'/'+_0x1e2003)[_0xef5d('0x1e')](_0x41a8c9);}return null;};}function patchUpdates(_0x1b6485){return function(_0x2dbc26){try{jsonpatch[_0xef5d('0x1f')](_0x2dbc26,_0x1b6485,!![]);}catch(_0xb1db1){return BPromise['reject'](_0xb1db1);}return _0x2dbc26[_0xef5d('0x20')]();};}function saveUpdates(_0x8013fc,_0x474421){return function(_0x143f70){if(_0x143f70){return _0x143f70[_0xef5d('0x21')](_0x8013fc)[_0xef5d('0x22')](function(_0x483f21){return _0x483f21;});}return null;};}function removeEntity(_0x52915a,_0x1bbd41){return function(_0x49c56f){if(_0x49c56f){return _0x49c56f[_0xef5d('0x23')]()[_0xef5d('0x22')](function(){_0x52915a[_0xef5d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30f432,_0x1184b2){return function(_0x2393c4){if(!_0x2393c4){_0x30f432[_0xef5d('0x24')](0x194);}return _0x2393c4;};}function handleError(_0x23eee8,_0x14447b){_0x14447b=_0x14447b||0x1f4;return function(_0x2ec96d){logger[_0xef5d('0x25')](_0x2ec96d['stack']);if(_0x2ec96d['name']){delete _0x2ec96d[_0xef5d('0x26')];}_0x23eee8[_0xef5d('0x18')](_0x14447b)[_0xef5d('0x27')](_0x2ec96d);};}exports[_0xef5d('0x28')]=function(_0xa3dccd,_0xf41591){var _0x1f7867={},_0x23fb5b={},_0x1d5a90={'count':0x0,'rows':[]};var _0xe80f99=_[_0xef5d('0x29')](db[_0xef5d('0x2a')]['rawAttributes'],function(_0x104598){return{'name':_0x104598['fieldName'],'type':_0x104598[_0xef5d('0x2b')][_0xef5d('0x2c')]};});_0x23fb5b[_0xef5d('0x2d')]=_['map'](_0xe80f99,_0xef5d('0x26'));_0x23fb5b['query']=_[_0xef5d('0x2e')](_0xa3dccd['query']);_0x23fb5b[_0xef5d('0x2f')]=_[_0xef5d('0x30')](_0x23fb5b[_0xef5d('0x2d')],_0x23fb5b[_0xef5d('0x31')]);_0x1f7867['attributes']=_[_0xef5d('0x30')](_0x23fb5b['model'],qs[_0xef5d('0x32')](_0xa3dccd[_0xef5d('0x31')]['fields']));_0x1f7867['attributes']=_0x1f7867[_0xef5d('0x33')][_0xef5d('0x34')]?_0x1f7867[_0xef5d('0x33')]:_0x23fb5b[_0xef5d('0x2d')];if(!_0xa3dccd[_0xef5d('0x31')][_0xef5d('0x35')](_0xef5d('0x36'))){_0x1f7867[_0xef5d('0x1c')]=qs[_0xef5d('0x1c')](_0xa3dccd[_0xef5d('0x31')][_0xef5d('0x1c')]);_0x1f7867[_0xef5d('0x1b')]=qs[_0xef5d('0x1b')](_0xa3dccd[_0xef5d('0x31')]['offset']);}_0x1f7867[_0xef5d('0x37')]=qs['sort'](_0xa3dccd[_0xef5d('0x31')][_0xef5d('0x38')]);_0x1f7867[_0xef5d('0x39')]=qs[_0xef5d('0x2f')](_['pick'](_0xa3dccd[_0xef5d('0x31')],_0x23fb5b['filters']),_0xe80f99);if(_0xa3dccd[_0xef5d('0x31')][_0xef5d('0x3a')]){_0x1f7867[_0xef5d('0x39')]=_['merge'](_0x1f7867[_0xef5d('0x39')],{'$or':_[_0xef5d('0x29')](_0xe80f99,function(_0xa27269){if(_0xa27269['type']!==_0xef5d('0x3b')){var _0x422032={};_0x422032[_0xa27269[_0xef5d('0x26')]]={'$like':'%'+_0xa3dccd[_0xef5d('0x31')][_0xef5d('0x3a')]+'%'};return _0x422032;}})});}_0x1f7867=_[_0xef5d('0x3c')]({},_0x1f7867,_0xa3dccd['options']);var _0x5115c0={'where':_0x1f7867[_0xef5d('0x39')]};return db[_0xef5d('0x2a')][_0xef5d('0x1a')](_0x5115c0)[_0xef5d('0x22')](function(_0x3f2268){_0x1d5a90['count']=_0x3f2268;if(_0xa3dccd['query']['includeAll']){_0x1f7867[_0xef5d('0x3d')]=[{'all':!![]}];}return db[_0xef5d('0x2a')][_0xef5d('0x3e')](_0x1f7867);})[_0xef5d('0x22')](function(_0x21e46b){_0x1d5a90[_0xef5d('0x3f')]=_0x21e46b;return _0x1d5a90;})['then'](respondWithFilteredResult(_0xf41591,_0x1f7867))[_0xef5d('0x40')](handleError(_0xf41591,null));};exports['show']=function(_0x194477,_0xaea6df){var _0x586159={'raw':!![],'where':{'id':_0x194477[_0xef5d('0x41')]['id']}},_0x3374e1={};_0x3374e1[_0xef5d('0x2d')]=_[_0xef5d('0x2e')](db['SquareRecording'][_0xef5d('0x42')]);_0x3374e1['query']=_[_0xef5d('0x2e')](_0x194477[_0xef5d('0x31')]);_0x3374e1['filters']=_[_0xef5d('0x30')](_0x3374e1[_0xef5d('0x2d')],_0x3374e1[_0xef5d('0x31')]);_0x586159[_0xef5d('0x33')]=_[_0xef5d('0x30')](_0x3374e1[_0xef5d('0x2d')],qs[_0xef5d('0x32')](_0x194477[_0xef5d('0x31')][_0xef5d('0x32')]));_0x586159[_0xef5d('0x33')]=_0x586159[_0xef5d('0x33')][_0xef5d('0x34')]?_0x586159[_0xef5d('0x33')]:_0x3374e1['model'];if(_0x194477[_0xef5d('0x31')][_0xef5d('0x43')]){_0x586159['include']=[{'all':!![]}];}_0x586159=_[_0xef5d('0x3c')]({},_0x586159,_0x194477[_0xef5d('0x44')]);return db[_0xef5d('0x2a')][_0xef5d('0x45')](_0x586159)[_0xef5d('0x22')](handleEntityNotFound(_0xaea6df,null))['then'](respondWithResult(_0xaea6df,null))[_0xef5d('0x40')](handleError(_0xaea6df,null));};exports['create']=function(_0x24dc70,_0xbe287f){return db[_0xef5d('0x2a')][_0xef5d('0x46')](_0x24dc70[_0xef5d('0x47')],{})['then'](respondWithResult(_0xbe287f,0xc9))[_0xef5d('0x40')](handleError(_0xbe287f,null));};exports[_0xef5d('0x21')]=function(_0x2530c2,_0x1f6cd2){if(_0x2530c2[_0xef5d('0x47')]['id']){delete _0x2530c2[_0xef5d('0x47')]['id'];}return db[_0xef5d('0x2a')][_0xef5d('0x45')]({'where':{'id':_0x2530c2[_0xef5d('0x41')]['id']}})[_0xef5d('0x22')](handleEntityNotFound(_0x1f6cd2,null))[_0xef5d('0x22')](saveUpdates(_0x2530c2[_0xef5d('0x47')],null))[_0xef5d('0x22')](respondWithResult(_0x1f6cd2,null))[_0xef5d('0x40')](handleError(_0x1f6cd2,null));};exports['download']=function(_0x2e0477,_0x2d0a25,_0x4d6897){var _0x8f531f=require(_0xef5d('0x48'));var _0x3d44d2=![];var _0x1fd2ae={};if(_0x2e0477[_0xef5d('0x31')][_0xef5d('0x2b')]&&_0x2e0477[_0xef5d('0x31')][_0xef5d('0x2b')]===_0xef5d('0x49')){_0x1fd2ae['uniqueid']=_0x2e0477[_0xef5d('0x41')]['id'];}else{_0x1fd2ae['id']=_0x2e0477[_0xef5d('0x41')]['id'];}return db[_0xef5d('0x2a')][_0xef5d('0x45')]({'where':_0x1fd2ae,'attributes':['id','savePath',_0xef5d('0x4a')],'raw':!![]})['then'](handleEntityNotFound(_0x2d0a25,null))[_0xef5d('0x22')](function(_0x52447e){if(_0x52447e){var _0x45f6f2=_0x52447e[_0xef5d('0x4b')];var _0x8f298d=util[_0xef5d('0x4c')]('%s.cypher',_0x45f6f2);if(fs['existsSync'](_0x8f298d)){_0x3d44d2=!![];return _0x8f531f[_0xef5d('0x4d')](_0x8f298d,_0x45f6f2,config[_0xef5d('0x4e')][_0xef5d('0x4f')])['then'](function(){return _0x52447e;});}return _0x52447e;}})[_0xef5d('0x22')](function(_0x4e7f4a){if(_0x4e7f4a){var _0x76bb89=_0x4e7f4a[_0xef5d('0x4b')];if(!fs[_0xef5d('0x50')](_0x76bb89)){throw new db['Sequelize'][(_0xef5d('0x51'))](_0xef5d('0x52'));}if(_0x4e7f4a[_0xef5d('0x4a')]){return _0x2d0a25[_0xef5d('0x53')](_0x76bb89,_0x4e7f4a[_0xef5d('0x4a')]+path['extname'](_0x76bb89),function(){if(_0x3d44d2){fs[_0xef5d('0x54')](_0x76bb89);}});}else{return _0x2d0a25[_0xef5d('0x53')](_0x76bb89,function(_0x535756){if(_0x3d44d2){fs[_0xef5d('0x54')](_0x76bb89);}});}}})[_0xef5d('0x40')](function(_0x585dbe){if(_0x585dbe[_0xef5d('0x55')]===_0xef5d('0x52')){_0x2d0a25[_0xef5d('0x18')](0x194)['send'](_0xef5d('0x56'));}else{return handleError(_0x2d0a25,null);}});};exports[_0xef5d('0x23')]=function(_0x55759c,_0x3627d5){return db[_0xef5d('0x2a')]['find']({'where':{'id':_0x55759c['params']['id']}})['then'](function(_0x196f2f){if(!_0x196f2f)throw new ReferenceError(_0xef5d('0x57'));return _0x196f2f;})[_0xef5d('0x22')](function(_0x59e4d0){var _0x519437=_0x59e4d0[_0xef5d('0x4b')];logger[_0xef5d('0x58')](_0xef5d('0x59'),_0x519437);if(!_[_0xef5d('0x5a')](_0x59e4d0['savePath'])&&fs['existsSync'](_0x519437)){logger[_0xef5d('0x58')](_0xef5d('0x5b')+_0x519437+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xef5d('0x5c')](_0x519437);}_0x519437=_0x519437+_0xef5d('0x5d');if(!_['isNil'](_0x59e4d0[_0xef5d('0x4b')])&&fs[_0xef5d('0x50')](_0x519437)){logger[_0xef5d('0x58')](_0xef5d('0x5b')+_0x519437+_0xef5d('0x5e'));fs[_0xef5d('0x5c')](_0x519437);}return _0x59e4d0;})[_0xef5d('0x22')](function(_0x36214f){if(!_0x36214f)throw new InternalError();return _0x36214f[_0xef5d('0x23')]();})[_0xef5d('0x22')](function(){_0x3627d5[_0xef5d('0x18')](0xcc)[_0xef5d('0x19')]();})['catch'](handleError(_0x3627d5,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 18ad1ed..4515781 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 _0x65c9=['bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','square_recordings','lodash','util','api','moment'];(function(_0x153b36,_0x265eda){var _0x38b194=function(_0x2a4797){while(--_0x2a4797){_0x153b36['push'](_0x153b36['shift']());}};_0x38b194(++_0x265eda);}(_0x65c9,0x182));var _0x965c=function(_0x4a53a0,_0x5c92f4){_0x4a53a0=_0x4a53a0-0x0;var _0x1dbb57=_0x65c9[_0x4a53a0];return _0x1dbb57;};'use strict';var _=require(_0x965c('0x0'));var util=require(_0x965c('0x1'));var logger=require('../../config/logger')(_0x965c('0x2'));var moment=require(_0x965c('0x3'));var BPromise=require(_0x965c('0x4'));var rp=require(_0x965c('0x5'));var fs=require('fs');var path=require(_0x965c('0x6'));var rimraf=require(_0x965c('0x7'));var config=require(_0x965c('0x8'));var attributes=require(_0x965c('0x9'));module[_0x965c('0xa')]=function(_0xbda9ee,_0xb9c834){return _0xbda9ee[_0x965c('0xb')]('SquareRecording',attributes,{'tableName':_0x965c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x42f4=['request-promise','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','../../config/logger','api','moment','bluebird'];(function(_0xde276c,_0x2d99bd){var _0x2be7b9=function(_0x595b58){while(--_0x595b58){_0xde276c['push'](_0xde276c['shift']());}};_0x2be7b9(++_0x2d99bd);}(_0x42f4,0x19d));var _0x442f=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x42f4[_0x138f59];return _0x3d114d;};'use strict';var _=require(_0x442f('0x0'));var util=require('util');var logger=require(_0x442f('0x1'))(_0x442f('0x2'));var moment=require(_0x442f('0x3'));var BPromise=require(_0x442f('0x4'));var rp=require(_0x442f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x442f('0x6'));module[_0x442f('0x7')]=function(_0x545b7b,_0x3ed622){return _0x545b7b[_0x442f('0x8')](_0x442f('0x9'),attributes,{'tableName':_0x442f('0xa'),'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 f687f8e..7e00210 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 _0xe5ec=['client','http','then','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','SquareRecording,\x20%s,\x20%s','CreateSquareRecording','SquareRecording','create','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x373daf,_0x18b9a8){var _0x1fa416=function(_0x1c40b8){while(--_0x1c40b8){_0x373daf['push'](_0x373daf['shift']());}};_0x1fa416(++_0x18b9a8);}(_0xe5ec,0x85));var _0xce5e=function(_0x1d5972,_0x161cd5){_0x1d5972=_0x1d5972-0x0;var _0x370829=_0xe5ec[_0x1d5972];return _0x370829;};'use strict';var _=require(_0xce5e('0x0'));var util=require(_0xce5e('0x1'));var moment=require(_0xce5e('0x2'));var BPromise=require(_0xce5e('0x3'));var rs=require(_0xce5e('0x4'));var fs=require('fs');var Redis=require(_0xce5e('0x5'));var db=require(_0xce5e('0x6'))['db'];var utils=require(_0xce5e('0x7'));var logger=require(_0xce5e('0x8'))(_0xce5e('0x9'));var config=require(_0xce5e('0xa'));var jayson=require(_0xce5e('0xb'));var client=jayson[_0xce5e('0xc')][_0xce5e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x22c802,_0x83fd71,_0xb8aa44){return new BPromise(function(_0x1b88ae,_0x5bc144){return client['request'](_0x22c802,_0xb8aa44)[_0xce5e('0xe')](function(_0x5990c3){logger[_0xce5e('0xf')]('SquareRecording,\x20%s,\x20%s',_0x83fd71,_0xce5e('0x10'));logger[_0xce5e('0x11')](_0xce5e('0x12'),_0x83fd71,'request\x20sent',JSON[_0xce5e('0x13')](_0x5990c3));if(_0x5990c3[_0xce5e('0x14')]){if(_0x5990c3[_0xce5e('0x14')]['code']===0x1f4){logger[_0xce5e('0x14')]('SquareRecording,\x20%s,\x20%s',_0x83fd71,_0x5990c3[_0xce5e('0x14')][_0xce5e('0x15')]);return _0x5bc144(_0x5990c3[_0xce5e('0x14')][_0xce5e('0x15')]);}logger[_0xce5e('0x14')](_0xce5e('0x16'),_0x83fd71,_0x5990c3[_0xce5e('0x14')][_0xce5e('0x15')]);return _0x1b88ae(_0x5990c3['error'][_0xce5e('0x15')]);}else{logger[_0xce5e('0xf')](_0xce5e('0x16'),_0x83fd71,_0xce5e('0x10'));_0x1b88ae(_0x5990c3['result']['message']);}})['catch'](function(_0x229287){logger[_0xce5e('0x14')](_0xce5e('0x16'),_0x83fd71,_0x229287);_0x5bc144(_0x229287);});});}exports[_0xce5e('0x17')]=function(_0x4edd47){var _0x16478f=this;return new Promise(function(_0x4f4480,_0xe141b){return db[_0xce5e('0x18')][_0xce5e('0x19')](_0x4edd47['body'],{'raw':_0x4edd47['options']?_0x4edd47[_0xce5e('0x1a')][_0xce5e('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3838ed){logger['info']('CreateSquareRecording',_0x4edd47);logger[_0xce5e('0x11')](_0xce5e('0x17'),_0x4edd47,JSON[_0xce5e('0x13')](_0x3838ed));_0x4f4480(_0x3838ed);})[_0xce5e('0x1c')](function(_0x5d99cd){logger[_0xce5e('0x14')](_0xce5e('0x17'),_0x5d99cd[_0xce5e('0x15')],_0x4edd47);_0xe141b(_0x16478f[_0xce5e('0x14')](0x1f4,_0x5d99cd['message']));});});}; \ No newline at end of file +var _0xa89e=['CreateSquareRecording','create','body','options','raw','then','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch'];(function(_0x4c3df8,_0xb2409a){var _0x320750=function(_0x3befe8){while(--_0x3befe8){_0x4c3df8['push'](_0x4c3df8['shift']());}};_0x320750(++_0xb2409a);}(_0xa89e,0x1e7));var _0xea89=function(_0x1fcc97,_0x3fb286){_0x1fcc97=_0x1fcc97-0x0;var _0x4763f7=_0xa89e[_0x1fcc97];return _0x4763f7;};'use strict';var _=require(_0xea89('0x0'));var util=require(_0xea89('0x1'));var moment=require('moment');var BPromise=require(_0xea89('0x2'));var rs=require(_0xea89('0x3'));var fs=require('fs');var Redis=require(_0xea89('0x4'));var db=require(_0xea89('0x5'))['db'];var utils=require(_0xea89('0x6'));var logger=require('../../config/logger')(_0xea89('0x7'));var config=require(_0xea89('0x8'));var jayson=require(_0xea89('0x9'));var client=jayson[_0xea89('0xa')][_0xea89('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29dc2d,_0x112165,_0x43b3e1){return new BPromise(function(_0x43ef94,_0x1c45e4){return client[_0xea89('0xc')](_0x29dc2d,_0x43b3e1)['then'](function(_0xf31cf6){logger['info'](_0xea89('0xd'),_0x112165,_0xea89('0xe'));logger[_0xea89('0xf')](_0xea89('0x10'),_0x112165,_0xea89('0xe'),JSON['stringify'](_0xf31cf6));if(_0xf31cf6[_0xea89('0x11')]){if(_0xf31cf6[_0xea89('0x11')][_0xea89('0x12')]===0x1f4){logger[_0xea89('0x11')](_0xea89('0xd'),_0x112165,_0xf31cf6['error']['message']);return _0x1c45e4(_0xf31cf6[_0xea89('0x11')][_0xea89('0x13')]);}logger[_0xea89('0x11')](_0xea89('0xd'),_0x112165,_0xf31cf6[_0xea89('0x11')][_0xea89('0x13')]);return _0x43ef94(_0xf31cf6[_0xea89('0x11')][_0xea89('0x13')]);}else{logger[_0xea89('0x14')](_0xea89('0xd'),_0x112165,_0xea89('0xe'));_0x43ef94(_0xf31cf6[_0xea89('0x15')][_0xea89('0x13')]);}})[_0xea89('0x16')](function(_0xdf5c27){logger['error']('SquareRecording,\x20%s,\x20%s',_0x112165,_0xdf5c27);_0x1c45e4(_0xdf5c27);});});}exports[_0xea89('0x17')]=function(_0x16d449){var _0x595941=this;return new Promise(function(_0x224a52,_0x477d18){return db['SquareRecording'][_0xea89('0x18')](_0x16d449[_0xea89('0x19')],{'raw':_0x16d449[_0xea89('0x1a')]?_0x16d449[_0xea89('0x1a')][_0xea89('0x1b')]===undefined?!![]:![]:!![]})[_0xea89('0x1c')](function(_0x51d31c){logger[_0xea89('0x14')](_0xea89('0x17'),_0x16d449);logger[_0xea89('0xf')]('CreateSquareRecording',_0x16d449,JSON[_0xea89('0x1d')](_0x51d31c));_0x224a52(_0x51d31c);})[_0xea89('0x16')](function(_0x1c10d7){logger[_0xea89('0x11')](_0xea89('0x17'),_0x1c10d7['message'],_0x16d449);_0x477d18(_0x595941['error'](0x1f4,_0x1c10d7[_0xea89('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 1ad2852..cbae17b 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 _0xe020=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','isAuthenticated','get','/describe','describe','/:id','post','create','put','update','exports','multer','util','connect-timeout','express'];(function(_0x419c37,_0x547f85){var _0x42b6f5=function(_0x4eedd7){while(--_0x4eedd7){_0x419c37['push'](_0x419c37['shift']());}};_0x42b6f5(++_0x547f85);}(_0xe020,0x119));var _0x0e02=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xe020[_0x5f309e];return _0x487b5e;};'use strict';var multer=require(_0x0e02('0x0'));var util=require(_0x0e02('0x1'));var path=require('path');var timeout=require(_0x0e02('0x2'));var express=require(_0x0e02('0x3'));var router=express[_0x0e02('0x4')]();var auth=require(_0x0e02('0x5'));var interaction=require(_0x0e02('0x6'));var config=require(_0x0e02('0x7'));var controller=require(_0x0e02('0x8'));router['get']('/',auth[_0x0e02('0x9')](),controller['index']);router[_0x0e02('0xa')](_0x0e02('0xb'),auth[_0x0e02('0x9')](),controller[_0x0e02('0xc')]);router['get'](_0x0e02('0xd'),auth[_0x0e02('0x9')](),controller['show']);router[_0x0e02('0xe')]('/',auth[_0x0e02('0x9')](),controller[_0x0e02('0xf')]);router[_0x0e02('0x10')]('/:id',auth[_0x0e02('0x9')](),controller[_0x0e02('0x11')]);router['delete'](_0x0e02('0xd'),auth[_0x0e02('0x9')](),controller['destroy']);module[_0x0e02('0x12')]=router; \ No newline at end of file +var _0x136d=['show','post','create','put','/:id','delete','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x136d,0x1bf));var _0xd136=function(_0x2bcddb,_0x3eaf37){_0x2bcddb=_0x2bcddb-0x0;var _0x12a9e8=_0x136d[_0x2bcddb];return _0x12a9e8;};'use strict';var multer=require(_0xd136('0x0'));var util=require(_0xd136('0x1'));var path=require('path');var timeout=require(_0xd136('0x2'));var express=require('express');var router=express[_0xd136('0x3')]();var auth=require(_0xd136('0x4'));var interaction=require(_0xd136('0x5'));var config=require(_0xd136('0x6'));var controller=require(_0xd136('0x7'));router[_0xd136('0x8')]('/',auth[_0xd136('0x9')](),controller[_0xd136('0xa')]);router['get'](_0xd136('0xb'),auth['isAuthenticated'](),controller[_0xd136('0xc')]);router['get']('/:id',auth[_0xd136('0x9')](),controller[_0xd136('0xd')]);router[_0xd136('0xe')]('/',auth[_0xd136('0x9')](),controller[_0xd136('0xf')]);router[_0xd136('0x10')](_0xd136('0x11'),auth['isAuthenticated'](),controller['update']);router[_0xd136('0x12')](_0xd136('0x11'),auth[_0xd136('0x9')](),controller['destroy']);module[_0xd136('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 b6403c2..3003da4 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 _0xc7e2=['STRING','DATE','exports'];(function(_0x270d12,_0x2d189f){var _0x510b61=function(_0x48685b){while(--_0x48685b){_0x270d12['push'](_0x270d12['shift']());}};_0x510b61(++_0x2d189f);}(_0xc7e2,0x143));var _0x2c7e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7e2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x2c7e('0x0')]={'network':{'type':Sequelize[_0x2c7e('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x2c7e('0x1')]},'channel':{'type':Sequelize[_0x2c7e('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2c7e('0x1')]},'uniqueid':{'type':Sequelize[_0x2c7e('0x1')]},'version':{'type':Sequelize[_0x2c7e('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2c7e('0x1')]},'callingpres':{'type':Sequelize[_0x2c7e('0x1')]},'callingani2':{'type':Sequelize[_0x2c7e('0x1')]},'callington':{'type':Sequelize[_0x2c7e('0x1')]},'callingtns':{'type':Sequelize[_0x2c7e('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x2c7e('0x1')]},'context':{'type':Sequelize[_0x2c7e('0x1')]},'extension':{'type':Sequelize[_0x2c7e('0x1')]},'priority':{'type':Sequelize[_0x2c7e('0x1')]},'enhanced':{'type':Sequelize[_0x2c7e('0x1')]},'accountcode':{'type':Sequelize[_0x2c7e('0x1')]},'threadid':{'type':Sequelize[_0x2c7e('0x1')]},'project_name':{'type':Sequelize[_0x2c7e('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x2c7e('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd73d=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x5eac75,_0x1a1291){var _0x19b7e0=function(_0x3732c4){while(--_0x3732c4){_0x5eac75['push'](_0x5eac75['shift']());}};_0x19b7e0(++_0x1a1291);}(_0xd73d,0x182));var _0xdd73=function(_0x4a6284,_0x3335bb){_0x4a6284=_0x4a6284-0x0;var _0x2f6bbc=_0xd73d[_0x4a6284];return _0x2f6bbc;};'use strict';var Sequelize=require(_0xdd73('0x0'));module[_0xdd73('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xdd73('0x2')]},'request':{'type':Sequelize[_0xdd73('0x2')]},'channel':{'type':Sequelize[_0xdd73('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xdd73('0x2')]},'uniqueid':{'type':Sequelize[_0xdd73('0x2')]},'version':{'type':Sequelize[_0xdd73('0x2')]},'callerid':{'type':Sequelize[_0xdd73('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xdd73('0x2')]},'callingani2':{'type':Sequelize[_0xdd73('0x2')]},'callington':{'type':Sequelize[_0xdd73('0x2')]},'callingtns':{'type':Sequelize[_0xdd73('0x2')]},'dnid':{'type':Sequelize[_0xdd73('0x2')]},'rdnis':{'type':Sequelize[_0xdd73('0x2')]},'context':{'type':Sequelize[_0xdd73('0x2')]},'extension':{'type':Sequelize[_0xdd73('0x2')]},'priority':{'type':Sequelize[_0xdd73('0x2')]},'enhanced':{'type':Sequelize[_0xdd73('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xdd73('0x2')]},'project_name':{'type':Sequelize[_0xdd73('0x2')]},'joinAt':{'type':Sequelize[_0xdd73('0x3')]},'leaveAt':{'type':Sequelize[_0xdd73('0x3')]},'bot':{'type':Sequelize[_0xdd73('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 83b3b1a..2efd4f0 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 _0x9e8a=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','limit','offset','order','sort','where','pick','filter','VIRTUAL','merge','options','SquareReport','includeAll','include','rows','catch','params','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x337ef8,_0x3971ab){var _0x585b75=function(_0x3827a8){while(--_0x3827a8){_0x337ef8['push'](_0x337ef8['shift']());}};_0x585b75(++_0x3971ab);}(_0x9e8a,0x112));var _0xa9e8=function(_0x3a5a8d,_0x22dac9){_0x3a5a8d=_0x3a5a8d-0x0;var _0x1b94b7=_0x9e8a[_0x3a5a8d];return _0x1b94b7;};'use strict';var pdf=require(_0xa9e8('0x0'));var emlformat=require(_0xa9e8('0x1'));var rimraf=require(_0xa9e8('0x2'));var zipdir=require(_0xa9e8('0x3'));var jsonpatch=require(_0xa9e8('0x4'));var rp=require(_0xa9e8('0x5'));var moment=require(_0xa9e8('0x6'));var BPromise=require(_0xa9e8('0x7'));var Mustache=require(_0xa9e8('0x8'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa9e8('0x9'));var fs=require('fs');var _=require(_0xa9e8('0xa'));var squel=require(_0xa9e8('0xb'));var crypto=require(_0xa9e8('0xc'));var jsforce=require(_0xa9e8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa9e8('0xe'));var querystring=require(_0xa9e8('0xf'));var Papa=require(_0xa9e8('0x10'));var Redis=require(_0xa9e8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa9e8('0x12'));var as=require(_0xa9e8('0x13'));var hardwareService=require(_0xa9e8('0x14'));var logger=require(_0xa9e8('0x15'))('api');var utils=require(_0xa9e8('0x16'));var config=require(_0xa9e8('0x17'));var licenseUtil=require(_0xa9e8('0x18'));var db=require(_0xa9e8('0x19'))['db'];function respondWithStatusCode(_0x42cee1,_0x328918){_0x328918=_0x328918||0xcc;return function(_0xa982d){if(_0xa982d){return _0x42cee1[_0xa9e8('0x1a')](_0x328918);}return _0x42cee1['status'](_0x328918)[_0xa9e8('0x1b')]();};}function respondWithResult(_0x5e2cbf,_0x514de0){_0x514de0=_0x514de0||0xc8;return function(_0x56ddfb){if(_0x56ddfb){return _0x5e2cbf['status'](_0x514de0)['json'](_0x56ddfb);}};}function respondWithFilteredResult(_0x391969,_0x62ee19){return function(_0x185068){if(_0x185068){var _0x403645=_0x185068[_0xa9e8('0x1c')],_0x1c3c3f=_0x62ee19['offset'],_0x2dfef7=_0x62ee19['offset']+_0x62ee19['limit'],_0x541831;if(_0x2dfef7>=_0x403645){_0x2dfef7=_0x403645;_0x541831=0xc8;}else{_0x541831=0xce;}_0x391969[_0xa9e8('0x1d')](_0x541831);return _0x391969[_0xa9e8('0x1e')](_0xa9e8('0x1f'),_0x1c3c3f+'-'+_0x2dfef7+'/'+_0x403645)['json'](_0x185068);}return null;};}function patchUpdates(_0xc5bde9){return function(_0x29b91b){try{jsonpatch[_0xa9e8('0x20')](_0x29b91b,_0xc5bde9,!![]);}catch(_0x322287){return BPromise[_0xa9e8('0x21')](_0x322287);}return _0x29b91b[_0xa9e8('0x22')]();};}function saveUpdates(_0x266d07,_0x25a5d5){return function(_0x1ee38b){if(_0x1ee38b){return _0x1ee38b[_0xa9e8('0x23')](_0x266d07)[_0xa9e8('0x24')](function(_0x4f3964){return _0x4f3964;});}return null;};}function removeEntity(_0x51ee03,_0x40b9ea){return function(_0x6b6fab){if(_0x6b6fab){return _0x6b6fab[_0xa9e8('0x25')]()[_0xa9e8('0x24')](function(){_0x51ee03[_0xa9e8('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x74fe20,_0x561a40){return function(_0x1f2acd){if(!_0x1f2acd){_0x74fe20[_0xa9e8('0x1a')](0x194);}return _0x1f2acd;};}function handleError(_0x1739f7,_0x2950cd){_0x2950cd=_0x2950cd||0x1f4;return function(_0xc015c5){logger[_0xa9e8('0x26')](_0xc015c5['stack']);if(_0xc015c5[_0xa9e8('0x27')]){delete _0xc015c5['name'];}_0x1739f7[_0xa9e8('0x1d')](_0x2950cd)[_0xa9e8('0x28')](_0xc015c5);};}exports['index']=function(_0x23b33a,_0x55d0ec){var _0x3a206f={},_0x240029={},_0x76ea32={'count':0x0,'rows':[]};var _0x5c40e6=_[_0xa9e8('0x29')](db['SquareReport'][_0xa9e8('0x2a')],function(_0x3e6c63){return{'name':_0x3e6c63[_0xa9e8('0x2b')],'type':_0x3e6c63[_0xa9e8('0x2c')]['key']};});_0x240029[_0xa9e8('0x2d')]=_[_0xa9e8('0x29')](_0x5c40e6,_0xa9e8('0x27'));_0x240029['query']=_[_0xa9e8('0x2e')](_0x23b33a['query']);_0x240029[_0xa9e8('0x2f')]=_[_0xa9e8('0x30')](_0x240029[_0xa9e8('0x2d')],_0x240029[_0xa9e8('0x31')]);_0x3a206f[_0xa9e8('0x32')]=_[_0xa9e8('0x30')](_0x240029[_0xa9e8('0x2d')],qs[_0xa9e8('0x33')](_0x23b33a[_0xa9e8('0x31')][_0xa9e8('0x33')]));_0x3a206f[_0xa9e8('0x32')]=_0x3a206f[_0xa9e8('0x32')][_0xa9e8('0x34')]?_0x3a206f['attributes']:_0x240029[_0xa9e8('0x2d')];if(!_0x23b33a[_0xa9e8('0x31')][_0xa9e8('0x35')]('nolimit')){_0x3a206f['limit']=qs[_0xa9e8('0x36')](_0x23b33a[_0xa9e8('0x31')][_0xa9e8('0x36')]);_0x3a206f[_0xa9e8('0x37')]=qs[_0xa9e8('0x37')](_0x23b33a[_0xa9e8('0x31')][_0xa9e8('0x37')]);}_0x3a206f[_0xa9e8('0x38')]=qs[_0xa9e8('0x39')](_0x23b33a[_0xa9e8('0x31')][_0xa9e8('0x39')]);_0x3a206f[_0xa9e8('0x3a')]=qs[_0xa9e8('0x2f')](_[_0xa9e8('0x3b')](_0x23b33a[_0xa9e8('0x31')],_0x240029[_0xa9e8('0x2f')]),_0x5c40e6);if(_0x23b33a[_0xa9e8('0x31')][_0xa9e8('0x3c')]){_0x3a206f[_0xa9e8('0x3a')]=_['merge'](_0x3a206f['where'],{'$or':_[_0xa9e8('0x29')](_0x5c40e6,function(_0x4b64b7){if(_0x4b64b7[_0xa9e8('0x2c')]!==_0xa9e8('0x3d')){var _0x1d2dc4={};_0x1d2dc4[_0x4b64b7[_0xa9e8('0x27')]]={'$like':'%'+_0x23b33a[_0xa9e8('0x31')]['filter']+'%'};return _0x1d2dc4;}})});}_0x3a206f=_[_0xa9e8('0x3e')]({},_0x3a206f,_0x23b33a[_0xa9e8('0x3f')]);var _0x2c03ba={'where':_0x3a206f[_0xa9e8('0x3a')]};return db[_0xa9e8('0x40')][_0xa9e8('0x1c')](_0x2c03ba)[_0xa9e8('0x24')](function(_0xc8be58){_0x76ea32[_0xa9e8('0x1c')]=_0xc8be58;if(_0x23b33a[_0xa9e8('0x31')][_0xa9e8('0x41')]){_0x3a206f[_0xa9e8('0x42')]=[{'all':!![]}];}return db[_0xa9e8('0x40')]['findAll'](_0x3a206f);})[_0xa9e8('0x24')](function(_0x38c83d){_0x76ea32[_0xa9e8('0x43')]=_0x38c83d;return _0x76ea32;})[_0xa9e8('0x24')](respondWithFilteredResult(_0x55d0ec,_0x3a206f))[_0xa9e8('0x44')](handleError(_0x55d0ec,null));};exports['show']=function(_0x544a11,_0x4c08e4){var _0x3cf18a={'raw':!![],'where':{'id':_0x544a11[_0xa9e8('0x45')]['id']}},_0x149327={};_0x149327[_0xa9e8('0x2d')]=_['keys'](db[_0xa9e8('0x40')][_0xa9e8('0x2a')]);_0x149327[_0xa9e8('0x31')]=_[_0xa9e8('0x2e')](_0x544a11[_0xa9e8('0x31')]);_0x149327[_0xa9e8('0x2f')]=_[_0xa9e8('0x30')](_0x149327[_0xa9e8('0x2d')],_0x149327[_0xa9e8('0x31')]);_0x3cf18a['attributes']=_['intersection'](_0x149327[_0xa9e8('0x2d')],qs['fields'](_0x544a11['query'][_0xa9e8('0x33')]));_0x3cf18a['attributes']=_0x3cf18a[_0xa9e8('0x32')][_0xa9e8('0x34')]?_0x3cf18a[_0xa9e8('0x32')]:_0x149327['model'];if(_0x544a11[_0xa9e8('0x31')][_0xa9e8('0x41')]){_0x3cf18a[_0xa9e8('0x42')]=[{'all':!![]}];}_0x3cf18a=_['merge']({},_0x3cf18a,_0x544a11[_0xa9e8('0x3f')]);return db[_0xa9e8('0x40')]['find'](_0x3cf18a)[_0xa9e8('0x24')](handleEntityNotFound(_0x4c08e4,null))['then'](respondWithResult(_0x4c08e4,null))['catch'](handleError(_0x4c08e4,null));};exports[_0xa9e8('0x46')]=function(_0x4299ab,_0x26f10e){return db[_0xa9e8('0x40')][_0xa9e8('0x46')](_0x4299ab[_0xa9e8('0x47')],{})['then'](respondWithResult(_0x26f10e,0xc9))[_0xa9e8('0x44')](handleError(_0x26f10e,null));};exports[_0xa9e8('0x23')]=function(_0x1890f1,_0x38d2f1){if(_0x1890f1[_0xa9e8('0x47')]['id']){delete _0x1890f1[_0xa9e8('0x47')]['id'];}return db[_0xa9e8('0x40')][_0xa9e8('0x48')]({'where':{'id':_0x1890f1[_0xa9e8('0x45')]['id']}})[_0xa9e8('0x24')](handleEntityNotFound(_0x38d2f1,null))[_0xa9e8('0x24')](saveUpdates(_0x1890f1[_0xa9e8('0x47')],null))[_0xa9e8('0x24')](respondWithResult(_0x38d2f1,null))[_0xa9e8('0x44')](handleError(_0x38d2f1,null));};exports[_0xa9e8('0x25')]=function(_0x2299f8,_0x2457ee){return db[_0xa9e8('0x40')][_0xa9e8('0x48')]({'where':{'id':_0x2299f8[_0xa9e8('0x45')]['id']}})['then'](handleEntityNotFound(_0x2457ee,null))[_0xa9e8('0x24')](removeEntity(_0x2457ee,null))[_0xa9e8('0x44')](handleError(_0x2457ee,null));};exports[_0xa9e8('0x49')]=function(_0x2526cc,_0x541c09){return db[_0xa9e8('0x40')][_0xa9e8('0x49')]()[_0xa9e8('0x24')](respondWithResult(_0x541c09,null))[_0xa9e8('0x44')](handleError(_0x541c09,null));}; \ No newline at end of file +var _0xf811=['model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','VIRTUAL','filter','SquareReport','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x4569c3,_0x30cf78){var _0x103053=function(_0x1cf0d8){while(--_0x1cf0d8){_0x4569c3['push'](_0x4569c3['shift']());}};_0x103053(++_0x30cf78);}(_0xf811,0x6f));var _0x1f81=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xf811[_0x33032e];return _0x13316b;};'use strict';var pdf=require(_0x1f81('0x0'));var emlformat=require(_0x1f81('0x1'));var rimraf=require(_0x1f81('0x2'));var zipdir=require(_0x1f81('0x3'));var jsonpatch=require(_0x1f81('0x4'));var rp=require(_0x1f81('0x5'));var moment=require(_0x1f81('0x6'));var BPromise=require(_0x1f81('0x7'));var Mustache=require(_0x1f81('0x8'));var util=require(_0x1f81('0x9'));var path=require(_0x1f81('0xa'));var sox=require(_0x1f81('0xb'));var csv=require(_0x1f81('0xc'));var ejs=require(_0x1f81('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1f81('0xe'));var crypto=require(_0x1f81('0xf'));var jsforce=require(_0x1f81('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x1f81('0xc'));var querystring=require(_0x1f81('0x11'));var Papa=require('papaparse');var Redis=require(_0x1f81('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1f81('0x13'));var as=require(_0x1f81('0x14'));var hardwareService=require(_0x1f81('0x15'));var logger=require(_0x1f81('0x16'))(_0x1f81('0x17'));var utils=require(_0x1f81('0x18'));var config=require(_0x1f81('0x19'));var licenseUtil=require(_0x1f81('0x1a'));var db=require(_0x1f81('0x1b'))['db'];function respondWithStatusCode(_0x111c85,_0x14851a){_0x14851a=_0x14851a||0xcc;return function(_0x1d9ef5){if(_0x1d9ef5){return _0x111c85[_0x1f81('0x1c')](_0x14851a);}return _0x111c85[_0x1f81('0x1d')](_0x14851a)[_0x1f81('0x1e')]();};}function respondWithResult(_0x247b10,_0x5a4992){_0x5a4992=_0x5a4992||0xc8;return function(_0x29941f){if(_0x29941f){return _0x247b10[_0x1f81('0x1d')](_0x5a4992)['json'](_0x29941f);}};}function respondWithFilteredResult(_0x5e1036,_0x20cea6){return function(_0x1a781d){if(_0x1a781d){var _0x5da9d1=_0x1a781d[_0x1f81('0x1f')],_0x3c042c=_0x20cea6['offset'],_0x558761=_0x20cea6['offset']+_0x20cea6[_0x1f81('0x20')],_0x37434a;if(_0x558761>=_0x5da9d1){_0x558761=_0x5da9d1;_0x37434a=0xc8;}else{_0x37434a=0xce;}_0x5e1036[_0x1f81('0x1d')](_0x37434a);return _0x5e1036['set'](_0x1f81('0x21'),_0x3c042c+'-'+_0x558761+'/'+_0x5da9d1)['json'](_0x1a781d);}return null;};}function patchUpdates(_0x25df22){return function(_0x1f9813){try{jsonpatch[_0x1f81('0x22')](_0x1f9813,_0x25df22,!![]);}catch(_0x4beeae){return BPromise[_0x1f81('0x23')](_0x4beeae);}return _0x1f9813[_0x1f81('0x24')]();};}function saveUpdates(_0x2d9b8d,_0x3d35bd){return function(_0x38e0bb){if(_0x38e0bb){return _0x38e0bb[_0x1f81('0x25')](_0x2d9b8d)['then'](function(_0x299974){return _0x299974;});}return null;};}function removeEntity(_0x37b6ff,_0x3751d4){return function(_0x4ecfa9){if(_0x4ecfa9){return _0x4ecfa9['destroy']()[_0x1f81('0x26')](function(){_0x37b6ff['status'](0xcc)[_0x1f81('0x1e')]();});}};}function handleEntityNotFound(_0x4f714a,_0x59c93a){return function(_0x34cdbc){if(!_0x34cdbc){_0x4f714a['sendStatus'](0x194);}return _0x34cdbc;};}function handleError(_0x3d97a3,_0x599b8f){_0x599b8f=_0x599b8f||0x1f4;return function(_0x21caa5){logger[_0x1f81('0x27')](_0x21caa5[_0x1f81('0x28')]);if(_0x21caa5[_0x1f81('0x29')]){delete _0x21caa5[_0x1f81('0x29')];}_0x3d97a3[_0x1f81('0x1d')](_0x599b8f)[_0x1f81('0x2a')](_0x21caa5);};}exports[_0x1f81('0x2b')]=function(_0x34bc53,_0x243bf5){var _0x587636={},_0x292758={},_0x5413a1={'count':0x0,'rows':[]};var _0x2f1096=_[_0x1f81('0x2c')](db['SquareReport'][_0x1f81('0x2d')],function(_0x186e42){return{'name':_0x186e42[_0x1f81('0x2e')],'type':_0x186e42[_0x1f81('0x2f')][_0x1f81('0x30')]};});_0x292758[_0x1f81('0x31')]=_[_0x1f81('0x2c')](_0x2f1096,_0x1f81('0x29'));_0x292758['query']=_[_0x1f81('0x32')](_0x34bc53[_0x1f81('0x33')]);_0x292758[_0x1f81('0x34')]=_[_0x1f81('0x35')](_0x292758[_0x1f81('0x31')],_0x292758[_0x1f81('0x33')]);_0x587636[_0x1f81('0x36')]=_[_0x1f81('0x35')](_0x292758[_0x1f81('0x31')],qs[_0x1f81('0x37')](_0x34bc53[_0x1f81('0x33')]['fields']));_0x587636[_0x1f81('0x36')]=_0x587636[_0x1f81('0x36')][_0x1f81('0x38')]?_0x587636[_0x1f81('0x36')]:_0x292758['model'];if(!_0x34bc53[_0x1f81('0x33')][_0x1f81('0x39')](_0x1f81('0x3a'))){_0x587636['limit']=qs['limit'](_0x34bc53[_0x1f81('0x33')]['limit']);_0x587636[_0x1f81('0x3b')]=qs['offset'](_0x34bc53[_0x1f81('0x33')][_0x1f81('0x3b')]);}_0x587636[_0x1f81('0x3c')]=qs[_0x1f81('0x3d')](_0x34bc53[_0x1f81('0x33')][_0x1f81('0x3d')]);_0x587636[_0x1f81('0x3e')]=qs['filters'](_[_0x1f81('0x3f')](_0x34bc53['query'],_0x292758[_0x1f81('0x34')]),_0x2f1096);if(_0x34bc53[_0x1f81('0x33')]['filter']){_0x587636[_0x1f81('0x3e')]=_[_0x1f81('0x40')](_0x587636[_0x1f81('0x3e')],{'$or':_['map'](_0x2f1096,function(_0x37bcc2){if(_0x37bcc2[_0x1f81('0x2f')]!==_0x1f81('0x41')){var _0x2e46dc={};_0x2e46dc[_0x37bcc2[_0x1f81('0x29')]]={'$like':'%'+_0x34bc53['query'][_0x1f81('0x42')]+'%'};return _0x2e46dc;}})});}_0x587636=_[_0x1f81('0x40')]({},_0x587636,_0x34bc53['options']);var _0x5a57d1={'where':_0x587636['where']};return db[_0x1f81('0x43')][_0x1f81('0x1f')](_0x5a57d1)['then'](function(_0x4eb018){_0x5413a1['count']=_0x4eb018;if(_0x34bc53[_0x1f81('0x33')][_0x1f81('0x44')]){_0x587636['include']=[{'all':!![]}];}return db[_0x1f81('0x43')][_0x1f81('0x45')](_0x587636);})[_0x1f81('0x26')](function(_0x4dcab0){_0x5413a1[_0x1f81('0x46')]=_0x4dcab0;return _0x5413a1;})[_0x1f81('0x26')](respondWithFilteredResult(_0x243bf5,_0x587636))[_0x1f81('0x47')](handleError(_0x243bf5,null));};exports[_0x1f81('0x48')]=function(_0x2f2d11,_0xb0d536){var _0x5ac2a2={'raw':!![],'where':{'id':_0x2f2d11[_0x1f81('0x49')]['id']}},_0x179b03={};_0x179b03[_0x1f81('0x31')]=_[_0x1f81('0x32')](db['SquareReport'][_0x1f81('0x2d')]);_0x179b03[_0x1f81('0x33')]=_['keys'](_0x2f2d11[_0x1f81('0x33')]);_0x179b03['filters']=_[_0x1f81('0x35')](_0x179b03['model'],_0x179b03[_0x1f81('0x33')]);_0x5ac2a2['attributes']=_[_0x1f81('0x35')](_0x179b03[_0x1f81('0x31')],qs[_0x1f81('0x37')](_0x2f2d11['query'][_0x1f81('0x37')]));_0x5ac2a2[_0x1f81('0x36')]=_0x5ac2a2['attributes'][_0x1f81('0x38')]?_0x5ac2a2[_0x1f81('0x36')]:_0x179b03[_0x1f81('0x31')];if(_0x2f2d11[_0x1f81('0x33')][_0x1f81('0x44')]){_0x5ac2a2[_0x1f81('0x4a')]=[{'all':!![]}];}_0x5ac2a2=_[_0x1f81('0x40')]({},_0x5ac2a2,_0x2f2d11['options']);return db[_0x1f81('0x43')][_0x1f81('0x4b')](_0x5ac2a2)['then'](handleEntityNotFound(_0xb0d536,null))[_0x1f81('0x26')](respondWithResult(_0xb0d536,null))[_0x1f81('0x47')](handleError(_0xb0d536,null));};exports[_0x1f81('0x4c')]=function(_0x590b47,_0x25d345){return db[_0x1f81('0x43')]['create'](_0x590b47[_0x1f81('0x4d')],{})['then'](respondWithResult(_0x25d345,0xc9))['catch'](handleError(_0x25d345,null));};exports[_0x1f81('0x25')]=function(_0x43f658,_0x337f11){if(_0x43f658['body']['id']){delete _0x43f658['body']['id'];}return db[_0x1f81('0x43')]['find']({'where':{'id':_0x43f658[_0x1f81('0x49')]['id']}})[_0x1f81('0x26')](handleEntityNotFound(_0x337f11,null))[_0x1f81('0x26')](saveUpdates(_0x43f658[_0x1f81('0x4d')],null))[_0x1f81('0x26')](respondWithResult(_0x337f11,null))['catch'](handleError(_0x337f11,null));};exports[_0x1f81('0x4e')]=function(_0x301ac8,_0x178538){return db[_0x1f81('0x43')]['find']({'where':{'id':_0x301ac8['params']['id']}})[_0x1f81('0x26')](handleEntityNotFound(_0x178538,null))[_0x1f81('0x26')](removeEntity(_0x178538,null))['catch'](handleError(_0x178538,null));};exports[_0x1f81('0x4f')]=function(_0x54da30,_0x19d5fa){return db['SquareReport'][_0x1f81('0x4f')]()['then'](respondWithResult(_0x19d5fa,null))[_0x1f81('0x47')](handleError(_0x19d5fa,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 78559b8..660d006 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 _0x1907=['uid_pname','project_name','leaveAt','util','../../config/logger','api','moment','request-promise','path','rimraf','./squareReport.attributes','exports','define','report_square'];(function(_0x18af13,_0x1a0693){var _0x37a567=function(_0x2e42e3){while(--_0x2e42e3){_0x18af13['push'](_0x18af13['shift']());}};_0x37a567(++_0x1a0693);}(_0x1907,0x1df));var _0x7190=function(_0x107e40,_0x653f6f){_0x107e40=_0x107e40-0x0;var _0x346736=_0x1907[_0x107e40];return _0x346736;};'use strict';var _=require('lodash');var util=require(_0x7190('0x0'));var logger=require(_0x7190('0x1'))(_0x7190('0x2'));var moment=require(_0x7190('0x3'));var BPromise=require('bluebird');var rp=require(_0x7190('0x4'));var fs=require('fs');var path=require(_0x7190('0x5'));var rimraf=require(_0x7190('0x6'));var config=require('../../config/environment');var attributes=require(_0x7190('0x7'));module[_0x7190('0x8')]=function(_0x26270a,_0x5c464d){return _0x26270a[_0x7190('0x9')]('SquareReport',attributes,{'tableName':_0x7190('0xa'),'paranoid':![],'indexes':[{'name':_0x7190('0xb'),'fields':['uniqueid',_0x7190('0xc')]},{'name':_0x7190('0xd'),'fields':[_0x7190('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1f7c=['./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5adb18,_0x222326){var _0x420c98=function(_0x146b7b){while(--_0x146b7b){_0x5adb18['push'](_0x5adb18['shift']());}};_0x420c98(++_0x222326);}(_0x1f7c,0xcf));var _0xc1f7=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0x1f7c[_0x100682];return _0xcb6e87;};'use strict';var _=require(_0xc1f7('0x0'));var util=require(_0xc1f7('0x1'));var logger=require(_0xc1f7('0x2'))('api');var moment=require(_0xc1f7('0x3'));var BPromise=require(_0xc1f7('0x4'));var rp=require(_0xc1f7('0x5'));var fs=require('fs');var path=require(_0xc1f7('0x6'));var rimraf=require(_0xc1f7('0x7'));var config=require(_0xc1f7('0x8'));var attributes=require(_0xc1f7('0x9'));module[_0xc1f7('0xa')]=function(_0x3f446d,_0x1ce16a){return _0x3f446d[_0xc1f7('0xb')](_0xc1f7('0xc'),attributes,{'tableName':_0xc1f7('0xd'),'paranoid':![],'indexes':[{'name':_0xc1f7('0xe'),'fields':[_0xc1f7('0xf'),_0xc1f7('0x10')]},{'name':_0xc1f7('0x11'),'fields':[_0xc1f7('0x11')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 5fd0de9..d14caa4 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 _0xd6d6=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','body','options','raw','then','CreateSquareReport','UpdateSquareReport','SquareReport','update','where','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x2651f8,_0x2a46bb){_0x2651f8=_0x2651f8-0x0;var _0x5ec767=_0xd6d6[_0x2651f8];return _0x5ec767;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));var BPromise=require(_0x6d6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d6d('0x4'));var db=require(_0x6d6d('0x5'))['db'];var utils=require(_0x6d6d('0x6'));var logger=require(_0x6d6d('0x7'))(_0x6d6d('0x8'));var config=require(_0x6d6d('0x9'));var jayson=require(_0x6d6d('0xa'));var client=jayson['client'][_0x6d6d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bf731,_0x44f83d,_0x18f824){return new BPromise(function(_0xd49f57,_0x408f88){return client[_0x6d6d('0xc')](_0x1bf731,_0x18f824)['then'](function(_0x51dd38){logger[_0x6d6d('0xd')](_0x6d6d('0xe'),_0x44f83d,_0x6d6d('0xf'));logger[_0x6d6d('0x10')](_0x6d6d('0x11'),_0x44f83d,'request\x20sent',JSON[_0x6d6d('0x12')](_0x51dd38));if(_0x51dd38[_0x6d6d('0x13')]){if(_0x51dd38['error']['code']===0x1f4){logger[_0x6d6d('0x13')](_0x6d6d('0xe'),_0x44f83d,_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);return _0x408f88(_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);}logger[_0x6d6d('0x13')](_0x6d6d('0xe'),_0x44f83d,_0x51dd38['error'][_0x6d6d('0x14')]);return _0xd49f57(_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);}else{logger[_0x6d6d('0xd')](_0x6d6d('0xe'),_0x44f83d,'request\x20sent');_0xd49f57(_0x51dd38[_0x6d6d('0x15')]['message']);}})[_0x6d6d('0x16')](function(_0x2cbc86){logger[_0x6d6d('0x13')]('SquareReport,\x20%s,\x20%s',_0x44f83d,_0x2cbc86);_0x408f88(_0x2cbc86);});});}exports['CreateSquareReport']=function(_0x9e1e18){var _0x1a75d8=this;return new Promise(function(_0x2b59d4,_0x2c5314){return db['SquareReport']['create'](_0x9e1e18[_0x6d6d('0x17')],{'raw':_0x9e1e18['options']?_0x9e1e18[_0x6d6d('0x18')][_0x6d6d('0x19')]===undefined?!![]:![]:!![]})[_0x6d6d('0x1a')](function(_0x450352){logger[_0x6d6d('0xd')](_0x6d6d('0x1b'),_0x9e1e18);logger[_0x6d6d('0x10')](_0x6d6d('0x1b'),_0x9e1e18,JSON[_0x6d6d('0x12')](_0x450352));_0x2b59d4(_0x450352);})[_0x6d6d('0x16')](function(_0x24b10d){logger[_0x6d6d('0x13')](_0x6d6d('0x1b'),_0x24b10d[_0x6d6d('0x14')],_0x9e1e18);_0x2c5314(_0x1a75d8[_0x6d6d('0x13')](0x1f4,_0x24b10d[_0x6d6d('0x14')]));});});};exports[_0x6d6d('0x1c')]=function(_0x583b10){var _0x3b73e5=this;return new Promise(function(_0x2dcb9c,_0x99f7d6){return db[_0x6d6d('0x1d')][_0x6d6d('0x1e')](_0x583b10[_0x6d6d('0x17')],{'raw':_0x583b10['options']?_0x583b10[_0x6d6d('0x18')][_0x6d6d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x583b10[_0x6d6d('0x18')]?_0x583b10[_0x6d6d('0x18')][_0x6d6d('0x1f')]||null:null,'attributes':_0x583b10[_0x6d6d('0x18')]?_0x583b10[_0x6d6d('0x18')]['attributes']||null:null,'limit':_0x583b10[_0x6d6d('0x18')]?_0x583b10[_0x6d6d('0x18')]['limit']||null:null})['then'](function(_0x3edcce){logger[_0x6d6d('0xd')](_0x6d6d('0x1c'),_0x583b10);logger['debug'](_0x6d6d('0x1c'),_0x583b10,JSON[_0x6d6d('0x12')](_0x3edcce));_0x2dcb9c(_0x3edcce);})[_0x6d6d('0x16')](function(_0x1c8340){logger[_0x6d6d('0x13')](_0x6d6d('0x1c'),_0x1c8340[_0x6d6d('0x14')],_0x583b10);_0x99f7d6(_0x3b73e5[_0x6d6d('0x13')](0x1f4,_0x1c8340[_0x6d6d('0x14')]));});});}; \ No newline at end of file +var _0x7da7=['update','raw','where','attributes','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareReport','create','body','options','CreateSquareReport','debug','UpdateSquareReport'];(function(_0x406115,_0x19f7a1){var _0xbbabdb=function(_0x28554d){while(--_0x28554d){_0x406115['push'](_0x406115['shift']());}};_0xbbabdb(++_0x19f7a1);}(_0x7da7,0x10d));var _0x77da=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x7da7[_0x75f869];return _0x10af8b;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var moment=require(_0x77da('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x77da('0x3'));var db=require(_0x77da('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x77da('0x5'))(_0x77da('0x6'));var config=require('../../config/environment');var jayson=require(_0x77da('0x7'));var client=jayson[_0x77da('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30afe0,_0x47cf1d,_0x1191de){return new BPromise(function(_0x13992e,_0x37c5ab){return client[_0x77da('0x9')](_0x30afe0,_0x1191de)[_0x77da('0xa')](function(_0x58f3fe){logger[_0x77da('0xb')](_0x77da('0xc'),_0x47cf1d,_0x77da('0xd'));logger['debug'](_0x77da('0xe'),_0x47cf1d,_0x77da('0xd'),JSON[_0x77da('0xf')](_0x58f3fe));if(_0x58f3fe[_0x77da('0x10')]){if(_0x58f3fe['error'][_0x77da('0x11')]===0x1f4){logger[_0x77da('0x10')](_0x77da('0xc'),_0x47cf1d,_0x58f3fe['error']['message']);return _0x37c5ab(_0x58f3fe[_0x77da('0x10')][_0x77da('0x12')]);}logger['error'](_0x77da('0xc'),_0x47cf1d,_0x58f3fe[_0x77da('0x10')][_0x77da('0x12')]);return _0x13992e(_0x58f3fe[_0x77da('0x10')]['message']);}else{logger[_0x77da('0xb')]('SquareReport,\x20%s,\x20%s',_0x47cf1d,_0x77da('0xd'));_0x13992e(_0x58f3fe[_0x77da('0x13')][_0x77da('0x12')]);}})[_0x77da('0x14')](function(_0x4ecd98){logger['error']('SquareReport,\x20%s,\x20%s',_0x47cf1d,_0x4ecd98);_0x37c5ab(_0x4ecd98);});});}exports['CreateSquareReport']=function(_0x103e46){var _0x295bef=this;return new Promise(function(_0x289887,_0x335dcb){return db[_0x77da('0x15')][_0x77da('0x16')](_0x103e46[_0x77da('0x17')],{'raw':_0x103e46[_0x77da('0x18')]?_0x103e46['options']['raw']===undefined?!![]:![]:!![]})[_0x77da('0xa')](function(_0x4d1512){logger['info'](_0x77da('0x19'),_0x103e46);logger[_0x77da('0x1a')](_0x77da('0x19'),_0x103e46,JSON['stringify'](_0x4d1512));_0x289887(_0x4d1512);})['catch'](function(_0x3e6cfe){logger['error'](_0x77da('0x19'),_0x3e6cfe[_0x77da('0x12')],_0x103e46);_0x335dcb(_0x295bef[_0x77da('0x10')](0x1f4,_0x3e6cfe[_0x77da('0x12')]));});});};exports[_0x77da('0x1b')]=function(_0x270318){var _0x95b5db=this;return new Promise(function(_0x50799d,_0x4885ec){return db[_0x77da('0x15')][_0x77da('0x1c')](_0x270318[_0x77da('0x17')],{'raw':_0x270318[_0x77da('0x18')]?_0x270318['options'][_0x77da('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x270318[_0x77da('0x18')]?_0x270318[_0x77da('0x18')][_0x77da('0x1e')]||null:null,'attributes':_0x270318[_0x77da('0x18')]?_0x270318['options'][_0x77da('0x1f')]||null:null,'limit':_0x270318[_0x77da('0x18')]?_0x270318[_0x77da('0x18')][_0x77da('0x20')]||null:null})['then'](function(_0x5b4638){logger['info'](_0x77da('0x1b'),_0x270318);logger[_0x77da('0x1a')](_0x77da('0x1b'),_0x270318,JSON[_0x77da('0xf')](_0x5b4638));_0x50799d(_0x5b4638);})[_0x77da('0x14')](function(_0x4eeb99){logger[_0x77da('0x10')](_0x77da('0x1b'),_0x4eeb99[_0x77da('0x12')],_0x270318);_0x4885ec(_0x95b5db[_0x77da('0x10')](0x1f4,_0x4eeb99[_0x77da('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 6bbc8cd..d337c30 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(_0x53727c,_0x50b9e7){var _0x1346ef=function(_0xf2102e){while(--_0xf2102e){_0x53727c['push'](_0x53727c['shift']());}};_0x1346ef(++_0x50b9e7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x20ee16,_0x3d0700){_0x20ee16=_0x20ee16-0x0;var _0x428f43=_0x5f2f[_0x20ee16];return _0x428f43;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file +var _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x26b990,_0x2cf5c0){var _0x1a7c09=function(_0x1ff90d){while(--_0x1ff90d){_0x26b990['push'](_0x26b990['shift']());}};_0x1a7c09(++_0x2cf5c0);}(_0x7a54,0x106));var _0x47a5=function(_0xe96d27,_0x48b4b2){_0xe96d27=_0xe96d27-0x0;var _0x5be833=_0x7a54[_0xe96d27];return _0x5be833;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 5642531..c4ae04a 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 _0xe110=['sequelize','STRING','TEXT'];(function(_0x3a7272,_0x2e51da){var _0x23d3e7=function(_0x2068a8){while(--_0x2068a8){_0x3a7272['push'](_0x3a7272['shift']());}};_0x23d3e7(++_0x2e51da);}(_0xe110,0x16b));var _0x0e11=function(_0x2f0811,_0x589ce){_0x2f0811=_0x2f0811-0x0;var _0x18ff83=_0xe110[_0x2f0811];return _0x18ff83;};'use strict';var Sequelize=require(_0x0e11('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x0e11('0x1')]},'node':{'type':Sequelize[_0x0e11('0x1')]},'application':{'type':Sequelize[_0x0e11('0x1')]},'data':{'type':Sequelize[_0x0e11('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x0e11('0x1')]}}; \ No newline at end of file +var _0x58ce=['exports','STRING','TEXT'];(function(_0x4be300,_0x4eef22){var _0x2ca555=function(_0x4e314e){while(--_0x4e314e){_0x4be300['push'](_0x4be300['shift']());}};_0x2ca555(++_0x4eef22);}(_0x58ce,0xb1));var _0xe58c=function(_0x1960a1,_0x4bb3d3){_0x1960a1=_0x1960a1-0x0;var _0x227267=_0x58ce[_0x1960a1];return _0x227267;};'use strict';var Sequelize=require('sequelize');module[_0xe58c('0x0')]={'uniqueid':{'type':Sequelize[_0xe58c('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xe58c('0x1')]},'data':{'type':Sequelize[_0xe58c('0x2')]},'project_name':{'type':Sequelize[_0xe58c('0x1')]},'callerid':{'type':Sequelize[_0xe58c('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 6dc38ea..cea07b2 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 _0xcb22=['lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','status','end','count','offset','limit','apply','save','update','then','sendStatus','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','sort','pick','filters','filter','merge','where','VIRTUAL','includeAll','rows','catch','params','options','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x5435df,_0x52c37a){var _0x320c1c=function(_0x2fc6fd){while(--_0x2fc6fd){_0x5435df['push'](_0x5435df['shift']());}};_0x320c1c(++_0x52c37a);}(_0xcb22,0xc8));var _0x2cb2=function(_0x314cd1,_0x33679e){_0x314cd1=_0x314cd1-0x0;var _0x2a0846=_0xcb22[_0x314cd1];return _0x2a0846;};'use strict';var pdf=require(_0x2cb2('0x0'));var emlformat=require(_0x2cb2('0x1'));var rimraf=require(_0x2cb2('0x2'));var zipdir=require(_0x2cb2('0x3'));var jsonpatch=require(_0x2cb2('0x4'));var rp=require(_0x2cb2('0x5'));var moment=require(_0x2cb2('0x6'));var BPromise=require(_0x2cb2('0x7'));var Mustache=require(_0x2cb2('0x8'));var util=require(_0x2cb2('0x9'));var path=require(_0x2cb2('0xa'));var sox=require('sox');var csv=require(_0x2cb2('0xb'));var ejs=require(_0x2cb2('0xc'));var fs=require('fs');var _=require(_0x2cb2('0xd'));var squel=require(_0x2cb2('0xe'));var crypto=require(_0x2cb2('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x2cb2('0x10'));var toCsv=require(_0x2cb2('0xb'));var querystring=require('querystring');var Papa=require(_0x2cb2('0x11'));var Redis=require(_0x2cb2('0x12'));var authService=require(_0x2cb2('0x13'));var qs=require(_0x2cb2('0x14'));var as=require(_0x2cb2('0x15'));var hardwareService=require(_0x2cb2('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x2cb2('0x17'));var config=require(_0x2cb2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9311fa,_0x50253a){_0x50253a=_0x50253a||0xcc;return function(_0x1fcb05){if(_0x1fcb05){return _0x9311fa['sendStatus'](_0x50253a);}return _0x9311fa[_0x2cb2('0x19')](_0x50253a)[_0x2cb2('0x1a')]();};}function respondWithResult(_0x529c51,_0x3b423a){_0x3b423a=_0x3b423a||0xc8;return function(_0x1be548){if(_0x1be548){return _0x529c51[_0x2cb2('0x19')](_0x3b423a)['json'](_0x1be548);}};}function respondWithFilteredResult(_0xeed9cf,_0x62121){return function(_0x58d9b4){if(_0x58d9b4){var _0x181ef1=_0x58d9b4[_0x2cb2('0x1b')],_0x4aa895=_0x62121[_0x2cb2('0x1c')],_0xac72c4=_0x62121[_0x2cb2('0x1c')]+_0x62121[_0x2cb2('0x1d')],_0x26045d;if(_0xac72c4>=_0x181ef1){_0xac72c4=_0x181ef1;_0x26045d=0xc8;}else{_0x26045d=0xce;}_0xeed9cf['status'](_0x26045d);return _0xeed9cf['set']('Content-Range',_0x4aa895+'-'+_0xac72c4+'/'+_0x181ef1)['json'](_0x58d9b4);}return null;};}function patchUpdates(_0x15708b){return function(_0x46ba55){try{jsonpatch[_0x2cb2('0x1e')](_0x46ba55,_0x15708b,!![]);}catch(_0x64d13e){return BPromise['reject'](_0x64d13e);}return _0x46ba55[_0x2cb2('0x1f')]();};}function saveUpdates(_0x10bd4a,_0x195de5){return function(_0x582890){if(_0x582890){return _0x582890[_0x2cb2('0x20')](_0x10bd4a)[_0x2cb2('0x21')](function(_0x3203fb){return _0x3203fb;});}return null;};}function removeEntity(_0x2c1831,_0x161cdf){return function(_0x142a7c){if(_0x142a7c){return _0x142a7c['destroy']()[_0x2cb2('0x21')](function(){_0x2c1831[_0x2cb2('0x19')](0xcc)[_0x2cb2('0x1a')]();});}};}function handleEntityNotFound(_0x3f43bd,_0x1365f8){return function(_0x3fd947){if(!_0x3fd947){_0x3f43bd[_0x2cb2('0x22')](0x194);}return _0x3fd947;};}function handleError(_0x1e19be,_0x512dc2){_0x512dc2=_0x512dc2||0x1f4;return function(_0x1c217c){logger[_0x2cb2('0x23')](_0x1c217c[_0x2cb2('0x24')]);if(_0x1c217c[_0x2cb2('0x25')]){delete _0x1c217c[_0x2cb2('0x25')];}_0x1e19be[_0x2cb2('0x19')](_0x512dc2)[_0x2cb2('0x26')](_0x1c217c);};}exports[_0x2cb2('0x27')]=function(_0x779ae3,_0x4e4eff){var _0x46db09={},_0x4f5192={},_0x279bd2={'count':0x0,'rows':[]};var _0x2625de=_[_0x2cb2('0x28')](db[_0x2cb2('0x29')][_0x2cb2('0x2a')],function(_0x200067){return{'name':_0x200067[_0x2cb2('0x2b')],'type':_0x200067[_0x2cb2('0x2c')][_0x2cb2('0x2d')]};});_0x4f5192['model']=_['map'](_0x2625de,_0x2cb2('0x25'));_0x4f5192['query']=_[_0x2cb2('0x2e')](_0x779ae3['query']);_0x4f5192['filters']=_[_0x2cb2('0x2f')](_0x4f5192[_0x2cb2('0x30')],_0x4f5192[_0x2cb2('0x31')]);_0x46db09[_0x2cb2('0x32')]=_[_0x2cb2('0x2f')](_0x4f5192[_0x2cb2('0x30')],qs[_0x2cb2('0x33')](_0x779ae3[_0x2cb2('0x31')][_0x2cb2('0x33')]));_0x46db09['attributes']=_0x46db09[_0x2cb2('0x32')][_0x2cb2('0x34')]?_0x46db09['attributes']:_0x4f5192[_0x2cb2('0x30')];if(!_0x779ae3[_0x2cb2('0x31')][_0x2cb2('0x35')]('nolimit')){_0x46db09['limit']=qs[_0x2cb2('0x1d')](_0x779ae3[_0x2cb2('0x31')][_0x2cb2('0x1d')]);_0x46db09['offset']=qs[_0x2cb2('0x1c')](_0x779ae3[_0x2cb2('0x31')]['offset']);}_0x46db09['order']=qs[_0x2cb2('0x36')](_0x779ae3[_0x2cb2('0x31')][_0x2cb2('0x36')]);_0x46db09['where']=qs['filters'](_[_0x2cb2('0x37')](_0x779ae3[_0x2cb2('0x31')],_0x4f5192[_0x2cb2('0x38')]),_0x2625de);if(_0x779ae3[_0x2cb2('0x31')][_0x2cb2('0x39')]){_0x46db09['where']=_[_0x2cb2('0x3a')](_0x46db09[_0x2cb2('0x3b')],{'$or':_[_0x2cb2('0x28')](_0x2625de,function(_0x4af179){if(_0x4af179['type']!==_0x2cb2('0x3c')){var _0x328494={};_0x328494[_0x4af179[_0x2cb2('0x25')]]={'$like':'%'+_0x779ae3[_0x2cb2('0x31')][_0x2cb2('0x39')]+'%'};return _0x328494;}})});}_0x46db09=_[_0x2cb2('0x3a')]({},_0x46db09,_0x779ae3['options']);var _0x41adac={'where':_0x46db09[_0x2cb2('0x3b')]};return db[_0x2cb2('0x29')][_0x2cb2('0x1b')](_0x41adac)[_0x2cb2('0x21')](function(_0x15dd90){_0x279bd2[_0x2cb2('0x1b')]=_0x15dd90;if(_0x779ae3[_0x2cb2('0x31')][_0x2cb2('0x3d')]){_0x46db09['include']=[{'all':!![]}];}return db[_0x2cb2('0x29')]['findAll'](_0x46db09);})[_0x2cb2('0x21')](function(_0x48b59f){_0x279bd2[_0x2cb2('0x3e')]=_0x48b59f;return _0x279bd2;})[_0x2cb2('0x21')](respondWithFilteredResult(_0x4e4eff,_0x46db09))[_0x2cb2('0x3f')](handleError(_0x4e4eff,null));};exports['show']=function(_0x2e4135,_0x39a6ff){var _0x113957={'raw':!![],'where':{'id':_0x2e4135[_0x2cb2('0x40')]['id']}},_0x44e3aa={};_0x44e3aa[_0x2cb2('0x30')]=_[_0x2cb2('0x2e')](db[_0x2cb2('0x29')][_0x2cb2('0x2a')]);_0x44e3aa['query']=_[_0x2cb2('0x2e')](_0x2e4135[_0x2cb2('0x31')]);_0x44e3aa['filters']=_['intersection'](_0x44e3aa[_0x2cb2('0x30')],_0x44e3aa[_0x2cb2('0x31')]);_0x113957['attributes']=_[_0x2cb2('0x2f')](_0x44e3aa[_0x2cb2('0x30')],qs['fields'](_0x2e4135['query'][_0x2cb2('0x33')]));_0x113957[_0x2cb2('0x32')]=_0x113957['attributes'][_0x2cb2('0x34')]?_0x113957[_0x2cb2('0x32')]:_0x44e3aa['model'];if(_0x2e4135['query']['includeAll']){_0x113957['include']=[{'all':!![]}];}_0x113957=_[_0x2cb2('0x3a')]({},_0x113957,_0x2e4135[_0x2cb2('0x41')]);return db['SquareDetailsReport'][_0x2cb2('0x42')](_0x113957)[_0x2cb2('0x21')](handleEntityNotFound(_0x39a6ff,null))[_0x2cb2('0x21')](respondWithResult(_0x39a6ff,null))[_0x2cb2('0x3f')](handleError(_0x39a6ff,null));};exports[_0x2cb2('0x43')]=function(_0x49f83f,_0x27d883){return db['SquareDetailsReport']['create'](_0x49f83f['body'],{})['then'](respondWithResult(_0x27d883,0xc9))[_0x2cb2('0x3f')](handleError(_0x27d883,null));};exports[_0x2cb2('0x20')]=function(_0x71d263,_0x2a49d8){if(_0x71d263['body']['id']){delete _0x71d263[_0x2cb2('0x44')]['id'];}return db[_0x2cb2('0x29')][_0x2cb2('0x42')]({'where':{'id':_0x71d263[_0x2cb2('0x40')]['id']}})['then'](handleEntityNotFound(_0x2a49d8,null))[_0x2cb2('0x21')](saveUpdates(_0x71d263[_0x2cb2('0x44')],null))['then'](respondWithResult(_0x2a49d8,null))['catch'](handleError(_0x2a49d8,null));};exports[_0x2cb2('0x45')]=function(_0x1f050c,_0x3ccca1){return db[_0x2cb2('0x29')]['find']({'where':{'id':_0x1f050c['params']['id']}})[_0x2cb2('0x21')](handleEntityNotFound(_0x3ccca1,null))[_0x2cb2('0x21')](removeEntity(_0x3ccca1,null))[_0x2cb2('0x3f')](handleError(_0x3ccca1,null));};exports[_0x2cb2('0x46')]=function(_0x112d98,_0x235c62){return db[_0x2cb2('0x29')][_0x2cb2('0x46')]()[_0x2cb2('0x21')](respondWithResult(_0x235c62,null))[_0x2cb2('0x3f')](handleError(_0x235c62,null));}; \ No newline at end of file +var _0x8137=['key','map','keys','query','filters','intersection','model','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','SquareDetailsReport','count','includeAll','include','findAll','rows','show','params','rawAttributes','fields','catch','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','fieldName','type'];(function(_0x5327ac,_0x5152f4){var _0x13c2ca=function(_0x344ea3){while(--_0x344ea3){_0x5327ac['push'](_0x5327ac['shift']());}};_0x13c2ca(++_0x5152f4);}(_0x8137,0x11d));var _0x7813=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x8137[_0x1203f];return _0x365f0a;};'use strict';var pdf=require(_0x7813('0x0'));var emlformat=require(_0x7813('0x1'));var rimraf=require(_0x7813('0x2'));var zipdir=require(_0x7813('0x3'));var jsonpatch=require(_0x7813('0x4'));var rp=require(_0x7813('0x5'));var moment=require(_0x7813('0x6'));var BPromise=require(_0x7813('0x7'));var Mustache=require(_0x7813('0x8'));var util=require(_0x7813('0x9'));var path=require(_0x7813('0xa'));var sox=require(_0x7813('0xb'));var csv=require(_0x7813('0xc'));var ejs=require(_0x7813('0xd'));var fs=require('fs');var _=require(_0x7813('0xe'));var squel=require(_0x7813('0xf'));var crypto=require(_0x7813('0x10'));var jsforce=require(_0x7813('0x11'));var deskjs=require(_0x7813('0x12'));var toCsv=require(_0x7813('0xc'));var querystring=require(_0x7813('0x13'));var Papa=require(_0x7813('0x14'));var Redis=require(_0x7813('0x15'));var authService=require(_0x7813('0x16'));var qs=require(_0x7813('0x17'));var as=require(_0x7813('0x18'));var hardwareService=require(_0x7813('0x19'));var logger=require(_0x7813('0x1a'))(_0x7813('0x1b'));var utils=require(_0x7813('0x1c'));var config=require(_0x7813('0x1d'));var licenseUtil=require(_0x7813('0x1e'));var db=require(_0x7813('0x1f'))['db'];function respondWithStatusCode(_0x2e2a21,_0xf370a2){_0xf370a2=_0xf370a2||0xcc;return function(_0x2ae2c6){if(_0x2ae2c6){return _0x2e2a21[_0x7813('0x20')](_0xf370a2);}return _0x2e2a21['status'](_0xf370a2)[_0x7813('0x21')]();};}function respondWithResult(_0x4338b2,_0x1f0ae4){_0x1f0ae4=_0x1f0ae4||0xc8;return function(_0x28b275){if(_0x28b275){return _0x4338b2[_0x7813('0x22')](_0x1f0ae4)['json'](_0x28b275);}};}function respondWithFilteredResult(_0x1b0e93,_0x420a9b){return function(_0x48f874){if(_0x48f874){var _0x1f75d2=_0x48f874['count'],_0x58d032=_0x420a9b['offset'],_0x2ed73d=_0x420a9b[_0x7813('0x23')]+_0x420a9b['limit'],_0x3a4de2;if(_0x2ed73d>=_0x1f75d2){_0x2ed73d=_0x1f75d2;_0x3a4de2=0xc8;}else{_0x3a4de2=0xce;}_0x1b0e93['status'](_0x3a4de2);return _0x1b0e93[_0x7813('0x24')](_0x7813('0x25'),_0x58d032+'-'+_0x2ed73d+'/'+_0x1f75d2)[_0x7813('0x26')](_0x48f874);}return null;};}function patchUpdates(_0x4febb8){return function(_0x48c0c8){try{jsonpatch[_0x7813('0x27')](_0x48c0c8,_0x4febb8,!![]);}catch(_0x4d2d6f){return BPromise[_0x7813('0x28')](_0x4d2d6f);}return _0x48c0c8['save']();};}function saveUpdates(_0x43da37,_0x4b06de){return function(_0x3f3d0d){if(_0x3f3d0d){return _0x3f3d0d[_0x7813('0x29')](_0x43da37)[_0x7813('0x2a')](function(_0x199dfc){return _0x199dfc;});}return null;};}function removeEntity(_0x564d31,_0x2d7813){return function(_0x64cd7f){if(_0x64cd7f){return _0x64cd7f[_0x7813('0x2b')]()[_0x7813('0x2a')](function(){_0x564d31['status'](0xcc)[_0x7813('0x21')]();});}};}function handleEntityNotFound(_0x2de2e0,_0x3ffec1){return function(_0x19d94f){if(!_0x19d94f){_0x2de2e0['sendStatus'](0x194);}return _0x19d94f;};}function handleError(_0x230c9d,_0x473e6c){_0x473e6c=_0x473e6c||0x1f4;return function(_0x1797b7){logger[_0x7813('0x2c')](_0x1797b7[_0x7813('0x2d')]);if(_0x1797b7['name']){delete _0x1797b7[_0x7813('0x2e')];}_0x230c9d[_0x7813('0x22')](_0x473e6c)[_0x7813('0x2f')](_0x1797b7);};}exports[_0x7813('0x30')]=function(_0x3e96c6,_0x15d72d){var _0x327c10={},_0x5049bc={},_0x5c082d={'count':0x0,'rows':[]};var _0x7c1882=_['map'](db['SquareDetailsReport']['rawAttributes'],function(_0x447e3c){return{'name':_0x447e3c[_0x7813('0x31')],'type':_0x447e3c[_0x7813('0x32')][_0x7813('0x33')]};});_0x5049bc['model']=_[_0x7813('0x34')](_0x7c1882,_0x7813('0x2e'));_0x5049bc['query']=_[_0x7813('0x35')](_0x3e96c6[_0x7813('0x36')]);_0x5049bc[_0x7813('0x37')]=_[_0x7813('0x38')](_0x5049bc[_0x7813('0x39')],_0x5049bc[_0x7813('0x36')]);_0x327c10[_0x7813('0x3a')]=_['intersection'](_0x5049bc['model'],qs['fields'](_0x3e96c6[_0x7813('0x36')]['fields']));_0x327c10[_0x7813('0x3a')]=_0x327c10['attributes']['length']?_0x327c10[_0x7813('0x3a')]:_0x5049bc[_0x7813('0x39')];if(!_0x3e96c6['query'][_0x7813('0x3b')](_0x7813('0x3c'))){_0x327c10[_0x7813('0x3d')]=qs[_0x7813('0x3d')](_0x3e96c6[_0x7813('0x36')][_0x7813('0x3d')]);_0x327c10['offset']=qs[_0x7813('0x23')](_0x3e96c6[_0x7813('0x36')]['offset']);}_0x327c10[_0x7813('0x3e')]=qs[_0x7813('0x3f')](_0x3e96c6[_0x7813('0x36')][_0x7813('0x3f')]);_0x327c10[_0x7813('0x40')]=qs[_0x7813('0x37')](_[_0x7813('0x41')](_0x3e96c6['query'],_0x5049bc[_0x7813('0x37')]),_0x7c1882);if(_0x3e96c6['query']['filter']){_0x327c10[_0x7813('0x40')]=_[_0x7813('0x42')](_0x327c10['where'],{'$or':_['map'](_0x7c1882,function(_0x1fb422){if(_0x1fb422[_0x7813('0x32')]!==_0x7813('0x43')){var _0x47d168={};_0x47d168[_0x1fb422['name']]={'$like':'%'+_0x3e96c6[_0x7813('0x36')]['filter']+'%'};return _0x47d168;}})});}_0x327c10=_['merge']({},_0x327c10,_0x3e96c6[_0x7813('0x44')]);var _0x32ab2e={'where':_0x327c10['where']};return db[_0x7813('0x45')][_0x7813('0x46')](_0x32ab2e)['then'](function(_0x36d1c8){_0x5c082d['count']=_0x36d1c8;if(_0x3e96c6['query'][_0x7813('0x47')]){_0x327c10[_0x7813('0x48')]=[{'all':!![]}];}return db[_0x7813('0x45')][_0x7813('0x49')](_0x327c10);})[_0x7813('0x2a')](function(_0x4ae89a){_0x5c082d[_0x7813('0x4a')]=_0x4ae89a;return _0x5c082d;})[_0x7813('0x2a')](respondWithFilteredResult(_0x15d72d,_0x327c10))['catch'](handleError(_0x15d72d,null));};exports[_0x7813('0x4b')]=function(_0xa2203d,_0x1cead2){var _0x4b0bff={'raw':!![],'where':{'id':_0xa2203d[_0x7813('0x4c')]['id']}},_0xef6d2a={};_0xef6d2a[_0x7813('0x39')]=_[_0x7813('0x35')](db[_0x7813('0x45')][_0x7813('0x4d')]);_0xef6d2a[_0x7813('0x36')]=_[_0x7813('0x35')](_0xa2203d[_0x7813('0x36')]);_0xef6d2a['filters']=_['intersection'](_0xef6d2a[_0x7813('0x39')],_0xef6d2a[_0x7813('0x36')]);_0x4b0bff[_0x7813('0x3a')]=_['intersection'](_0xef6d2a[_0x7813('0x39')],qs[_0x7813('0x4e')](_0xa2203d['query'][_0x7813('0x4e')]));_0x4b0bff[_0x7813('0x3a')]=_0x4b0bff[_0x7813('0x3a')]['length']?_0x4b0bff[_0x7813('0x3a')]:_0xef6d2a[_0x7813('0x39')];if(_0xa2203d[_0x7813('0x36')]['includeAll']){_0x4b0bff['include']=[{'all':!![]}];}_0x4b0bff=_[_0x7813('0x42')]({},_0x4b0bff,_0xa2203d['options']);return db[_0x7813('0x45')]['find'](_0x4b0bff)[_0x7813('0x2a')](handleEntityNotFound(_0x1cead2,null))[_0x7813('0x2a')](respondWithResult(_0x1cead2,null))[_0x7813('0x4f')](handleError(_0x1cead2,null));};exports[_0x7813('0x50')]=function(_0x4ab82d,_0x480d69){return db[_0x7813('0x45')][_0x7813('0x50')](_0x4ab82d[_0x7813('0x51')],{})['then'](respondWithResult(_0x480d69,0xc9))[_0x7813('0x4f')](handleError(_0x480d69,null));};exports[_0x7813('0x29')]=function(_0xc7b309,_0x331ab9){if(_0xc7b309[_0x7813('0x51')]['id']){delete _0xc7b309['body']['id'];}return db['SquareDetailsReport'][_0x7813('0x52')]({'where':{'id':_0xc7b309['params']['id']}})['then'](handleEntityNotFound(_0x331ab9,null))[_0x7813('0x2a')](saveUpdates(_0xc7b309['body'],null))['then'](respondWithResult(_0x331ab9,null))['catch'](handleError(_0x331ab9,null));};exports[_0x7813('0x2b')]=function(_0x119621,_0x1e952e){return db[_0x7813('0x45')][_0x7813('0x52')]({'where':{'id':_0x119621[_0x7813('0x4c')]['id']}})[_0x7813('0x2a')](handleEntityNotFound(_0x1e952e,null))[_0x7813('0x2a')](removeEntity(_0x1e952e,null))[_0x7813('0x4f')](handleError(_0x1e952e,null));};exports[_0x7813('0x53')]=function(_0x19d046,_0x4113e2){return db[_0x7813('0x45')]['describe']()['then'](respondWithResult(_0x4113e2,null))[_0x7813('0x4f')](handleError(_0x4113e2,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index cc85026..4a6e028 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 _0xee3c=['./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x554292,_0x82948a){var _0x3dd555=function(_0xab7590){while(--_0xab7590){_0x554292['push'](_0x554292['shift']());}};_0x3dd555(++_0x82948a);}(_0xee3c,0x14a));var _0xcee3=function(_0x3ce6b9,_0x68396c){_0x3ce6b9=_0x3ce6b9-0x0;var _0x3312e8=_0xee3c[_0x3ce6b9];return _0x3312e8;};'use strict';var _=require(_0xcee3('0x0'));var util=require(_0xcee3('0x1'));var logger=require(_0xcee3('0x2'))(_0xcee3('0x3'));var moment=require(_0xcee3('0x4'));var BPromise=require(_0xcee3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcee3('0x6'));var config=require(_0xcee3('0x7'));var attributes=require(_0xcee3('0x8'));module[_0xcee3('0x9')]=function(_0x9350f3,_0x44e46f){return _0x9350f3[_0xcee3('0xa')](_0xcee3('0xb'),attributes,{'tableName':_0xcee3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x889e=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','SquareDetailsReport','report_square_details','lodash','util'];(function(_0x428f5d,_0x212901){var _0x424cf3=function(_0x769874){while(--_0x769874){_0x428f5d['push'](_0x428f5d['shift']());}};_0x424cf3(++_0x212901);}(_0x889e,0x77));var _0xe889=function(_0x2089cb,_0x42f59a){_0x2089cb=_0x2089cb-0x0;var _0x1bf94f=_0x889e[_0x2089cb];return _0x1bf94f;};'use strict';var _=require(_0xe889('0x0'));var util=require(_0xe889('0x1'));var logger=require('../../config/logger')(_0xe889('0x2'));var moment=require('moment');var BPromise=require(_0xe889('0x3'));var rp=require(_0xe889('0x4'));var fs=require('fs');var path=require(_0xe889('0x5'));var rimraf=require(_0xe889('0x6'));var config=require(_0xe889('0x7'));var attributes=require('./squareReportDetail.attributes');module[_0xe889('0x8')]=function(_0x2f7b58,_0x51a440){return _0x2f7b58['define'](_0xe889('0x9'),attributes,{'tableName':_0xe889('0xa'),'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 8ef18de..cbd1eab 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 _0x2f45=['CreateSquareDetailsReport','debug','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','create','body','options'];(function(_0x31d268,_0x4f5f5a){var _0x563a2c=function(_0xe828f2){while(--_0xe828f2){_0x31d268['push'](_0x31d268['shift']());}};_0x563a2c(++_0x4f5f5a);}(_0x2f45,0xe3));var _0x52f4=function(_0x481778,_0x3591a2){_0x481778=_0x481778-0x0;var _0x180616=_0x2f45[_0x481778];return _0x180616;};'use strict';var _=require(_0x52f4('0x0'));var util=require(_0x52f4('0x1'));var moment=require(_0x52f4('0x2'));var BPromise=require('bluebird');var rs=require(_0x52f4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x52f4('0x4'))['db'];var utils=require(_0x52f4('0x5'));var logger=require(_0x52f4('0x6'))(_0x52f4('0x7'));var config=require(_0x52f4('0x8'));var jayson=require(_0x52f4('0x9'));var client=jayson[_0x52f4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5729a9,_0x270da6,_0x11afd6){return new BPromise(function(_0x51dacf,_0x1e8cdc){return client[_0x52f4('0xb')](_0x5729a9,_0x11afd6)['then'](function(_0x5609f0){logger['info'](_0x52f4('0xc'),_0x270da6,_0x52f4('0xd'));logger['debug'](_0x52f4('0xe'),_0x270da6,_0x52f4('0xd'),JSON[_0x52f4('0xf')](_0x5609f0));if(_0x5609f0[_0x52f4('0x10')]){if(_0x5609f0[_0x52f4('0x10')]['code']===0x1f4){logger[_0x52f4('0x10')](_0x52f4('0xc'),_0x270da6,_0x5609f0[_0x52f4('0x10')]['message']);return _0x1e8cdc(_0x5609f0[_0x52f4('0x10')][_0x52f4('0x11')]);}logger[_0x52f4('0x10')](_0x52f4('0xc'),_0x270da6,_0x5609f0[_0x52f4('0x10')]['message']);return _0x51dacf(_0x5609f0[_0x52f4('0x10')][_0x52f4('0x11')]);}else{logger[_0x52f4('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x270da6,_0x52f4('0xd'));_0x51dacf(_0x5609f0[_0x52f4('0x13')]['message']);}})['catch'](function(_0x2bda61){logger[_0x52f4('0x10')](_0x52f4('0xc'),_0x270da6,_0x2bda61);_0x1e8cdc(_0x2bda61);});});}exports['CreateSquareDetailsReport']=function(_0xfb095a){var _0x3ebf76=this;return new Promise(function(_0x9e82e8,_0xf0e0ad){return db['SquareDetailsReport'][_0x52f4('0x14')](_0xfb095a[_0x52f4('0x15')],{'raw':_0xfb095a[_0x52f4('0x16')]?_0xfb095a[_0x52f4('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x44eed4){logger[_0x52f4('0x12')](_0x52f4('0x17'),_0xfb095a);logger[_0x52f4('0x18')](_0x52f4('0x17'),_0xfb095a,JSON[_0x52f4('0xf')](_0x44eed4));_0x9e82e8(_0x44eed4);})['catch'](function(_0x545162){logger[_0x52f4('0x10')](_0x52f4('0x17'),_0x545162['message'],_0xfb095a);_0xf0e0ad(_0x3ebf76[_0x52f4('0x10')](0x1f4,_0x545162[_0x52f4('0x11')]));});});}; \ No newline at end of file +var _0xeaf8=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','CreateSquareDetailsReport','SquareDetailsReport','body','options','debug','lodash'];(function(_0xa0c1bd,_0x5b2a86){var _0x1ca764=function(_0x575ec9){while(--_0x575ec9){_0xa0c1bd['push'](_0xa0c1bd['shift']());}};_0x1ca764(++_0x5b2a86);}(_0xeaf8,0xe0));var _0x8eaf=function(_0x6671ab,_0x50cbdf){_0x6671ab=_0x6671ab-0x0;var _0x389711=_0xeaf8[_0x6671ab];return _0x389711;};'use strict';var _=require(_0x8eaf('0x0'));var util=require('util');var moment=require(_0x8eaf('0x1'));var BPromise=require('bluebird');var rs=require(_0x8eaf('0x2'));var fs=require('fs');var Redis=require(_0x8eaf('0x3'));var db=require(_0x8eaf('0x4'))['db'];var utils=require(_0x8eaf('0x5'));var logger=require(_0x8eaf('0x6'))('rpc');var config=require(_0x8eaf('0x7'));var jayson=require(_0x8eaf('0x8'));var client=jayson[_0x8eaf('0x9')][_0x8eaf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x239fb4,_0x5b8f0b,_0x382add){return new BPromise(function(_0xc5937b,_0x5f55a2){return client[_0x8eaf('0xb')](_0x239fb4,_0x382add)[_0x8eaf('0xc')](function(_0x16db55){logger['info'](_0x8eaf('0xd'),_0x5b8f0b,'request\x20sent');logger['debug'](_0x8eaf('0xe'),_0x5b8f0b,_0x8eaf('0xf'),JSON[_0x8eaf('0x10')](_0x16db55));if(_0x16db55[_0x8eaf('0x11')]){if(_0x16db55[_0x8eaf('0x11')]['code']===0x1f4){logger['error'](_0x8eaf('0xd'),_0x5b8f0b,_0x16db55[_0x8eaf('0x11')][_0x8eaf('0x12')]);return _0x5f55a2(_0x16db55['error'][_0x8eaf('0x12')]);}logger[_0x8eaf('0x11')](_0x8eaf('0xd'),_0x5b8f0b,_0x16db55['error'][_0x8eaf('0x12')]);return _0xc5937b(_0x16db55[_0x8eaf('0x11')][_0x8eaf('0x12')]);}else{logger[_0x8eaf('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0x5b8f0b,'request\x20sent');_0xc5937b(_0x16db55['result'][_0x8eaf('0x12')]);}})['catch'](function(_0xbfa728){logger['error'](_0x8eaf('0xd'),_0x5b8f0b,_0xbfa728);_0x5f55a2(_0xbfa728);});});}exports[_0x8eaf('0x14')]=function(_0x501e44){var _0x378fbe=this;return new Promise(function(_0xd11bb6,_0x5db77f){return db[_0x8eaf('0x15')]['create'](_0x501e44[_0x8eaf('0x16')],{'raw':_0x501e44[_0x8eaf('0x17')]?_0x501e44[_0x8eaf('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x8eaf('0xc')](function(_0x2f9dd5){logger[_0x8eaf('0x13')](_0x8eaf('0x14'),_0x501e44);logger[_0x8eaf('0x18')](_0x8eaf('0x14'),_0x501e44,JSON[_0x8eaf('0x10')](_0x2f9dd5));_0xd11bb6(_0x2f9dd5);})['catch'](function(_0x2b6976){logger[_0x8eaf('0x11')](_0x8eaf('0x14'),_0x2b6976['message'],_0x501e44);_0x5db77f(_0x378fbe['error'](0x1f4,_0x2b6976[_0x8eaf('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 5d452f1..f07b01c 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 _0xe5fe=['/process/:pid/kill','killProcess','exports','express','./system.controller','get','isAuthenticated','index'];(function(_0x53c09e,_0x39d3b7){var _0x5630ef=function(_0x2c6f98){while(--_0x2c6f98){_0x53c09e['push'](_0x53c09e['shift']());}};_0x5630ef(++_0x39d3b7);}(_0xe5fe,0x93));var _0xee5f=function(_0x1033bd,_0x562ad5){_0x1033bd=_0x1033bd-0x0;var _0x360ab0=_0xe5fe[_0x1033bd];return _0x360ab0;};'use strict';var express=require(_0xee5f('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xee5f('0x1'));router[_0xee5f('0x2')]('/',auth[_0xee5f('0x3')](),controller[_0xee5f('0x4')]);router['get'](_0xee5f('0x5'),auth[_0xee5f('0x3')](),controller[_0xee5f('0x6')]);module[_0xee5f('0x7')]=router; \ No newline at end of file +var _0x434f=['express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill','exports'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x434f,0x120));var _0xf434=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x434f[_0x321bb2];return _0x9c12ed;};'use strict';var express=require(_0xf434('0x0'));var router=express[_0xf434('0x1')]();var auth=require(_0xf434('0x2'));var controller=require(_0xf434('0x3'));router[_0xf434('0x4')]('/',auth[_0xf434('0x5')](),controller[_0xf434('0x6')]);router[_0xf434('0x4')](_0xf434('0x7'),auth[_0xf434('0x5')](),controller['killProcess']);module[_0xf434('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 00754d5..106eee5 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 _0x889e=['child_process','../../config/logger','util','bluebird','lodash','error','name','status','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation'];(function(_0x34a62a,_0xad7cc2){var _0x3a3ecf=function(_0x37fbe6){while(--_0x37fbe6){_0x34a62a['push'](_0x34a62a['shift']());}};_0x3a3ecf(++_0xad7cc2);}(_0x889e,0x77));var _0xe889=function(_0x2f0be3,_0x5e18c1){_0x2f0be3=_0x2f0be3-0x0;var _0x2eb9f1=_0x889e[_0x2f0be3];return _0x2eb9f1;};'use strict';var info=require(_0xe889('0x0'));var exec=require(_0xe889('0x1'))['exec'];var logger=require(_0xe889('0x2'))('api');var util=require(_0xe889('0x3'));var BPromise=require(_0xe889('0x4'));var _=require(_0xe889('0x5'));function handleError(_0x3a638f,_0x459c41,_0x5acbcd){_0x459c41=_0x459c41||0x1f4;return function(_0x3c7a62){logger[_0xe889('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x5acbcd,_0x459c41,util['inspect'](_0x3c7a62,{'showHidden':![],'depth':null}));delete _0x3c7a62[_0xe889('0x7')];_0x3a638f[_0xe889('0x8')](_0x459c41)['send'](_0x3c7a62);};}exports['index']=function(_0x4ccc1e,_0x278601){return info[_0xe889('0x9')]()[_0xe889('0xa')](function(_0x416df2){return _0x278601[_0xe889('0x8')](0xc8)[_0xe889('0xb')](_0x416df2);})[_0xe889('0xc')](function(_0x1a1cdf){return _0x278601[_0xe889('0x8')](0x1f4)[_0xe889('0xb')](_0x1a1cdf);});};exports[_0xe889('0xd')]=function(_0x3eaaa3,_0x493dda){var _0x19b3a5=[_0xe889('0xe')];return new BPromise(function(_0x3b52a1,_0x1b808b){return exec(util[_0xe889('0xf')](_0xe889('0x10'),_0x3eaaa3[_0xe889('0x11')][_0xe889('0x12')]),function(_0x480f13,_0x36dc1f,_0x277b67){if(_0x480f13){return _0x1b808b(_0x480f13);}return _0x3b52a1(_0x36dc1f);});})[_0xe889('0xa')](function(_0x5db1f2){var _0x3546d4=![];var _0x3cc520=_0x5db1f2[_0xe889('0x13')](/\n/);for(var _0x54a0de=0x0,_0x1c32d8=_0x19b3a5[_0xe889('0x14')];_0x54a0de<_0x1c32d8,_0x3546d4===![];_0x54a0de+=0x1){if(_0x5db1f2['indexOf'](_0x19b3a5[_0x54a0de])>=0x0){_0x3546d4=!![];}}if(!_0x3546d4){throw new Error(util[_0xe889('0xf')](_0xe889('0x15'),_0x3eaaa3['params']['pid']));}process['kill'](_0x3eaaa3[_0xe889('0x11')][_0xe889('0x12')],_0xe889('0x16'));return _0x493dda[_0xe889('0x8')](0xc8)[_0xe889('0xb')]({'message':util[_0xe889('0xf')](_0xe889('0x17'),_0x3eaaa3[_0xe889('0x11')][_0xe889('0x12')])});})[_0xe889('0xc')](handleError(_0x493dda,null,_0xe889('0xd')));}; \ No newline at end of file +var _0xff61=['inspect','name','status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','indexOf','SIGINT','params','systeminformation','child_process','exec','../../config/logger','api','bluebird','lodash'];(function(_0x103a84,_0x5c29c4){var _0x3609d3=function(_0xf82f6b){while(--_0xf82f6b){_0x103a84['push'](_0x103a84['shift']());}};_0x3609d3(++_0x5c29c4);}(_0xff61,0x17f));var _0x1ff6=function(_0x2b983e,_0xf9dd42){_0x2b983e=_0x2b983e-0x0;var _0x243392=_0xff61[_0x2b983e];return _0x243392;};'use strict';var info=require(_0x1ff6('0x0'));var exec=require(_0x1ff6('0x1'))[_0x1ff6('0x2')];var logger=require(_0x1ff6('0x3'))(_0x1ff6('0x4'));var util=require('util');var BPromise=require(_0x1ff6('0x5'));var _=require(_0x1ff6('0x6'));function handleError(_0x58d10e,_0x3e9d36,_0x3200c1){_0x3e9d36=_0x3e9d36||0x1f4;return function(_0x3d27d9){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x3200c1,_0x3e9d36,util[_0x1ff6('0x7')](_0x3d27d9,{'showHidden':![],'depth':null}));delete _0x3d27d9[_0x1ff6('0x8')];_0x58d10e[_0x1ff6('0x9')](_0x3e9d36)[_0x1ff6('0xa')](_0x3d27d9);};}exports[_0x1ff6('0xb')]=function(_0xb28873,_0x585b22){return info[_0x1ff6('0xc')]()[_0x1ff6('0xd')](function(_0x534e5a){return _0x585b22[_0x1ff6('0x9')](0xc8)[_0x1ff6('0xe')](_0x534e5a);})[_0x1ff6('0xf')](function(_0x12f8c6){return _0x585b22[_0x1ff6('0x9')](0x1f4)[_0x1ff6('0xe')](_0x12f8c6);});};exports[_0x1ff6('0x10')]=function(_0x2cf429,_0x4c322f){var _0x4f7898=[_0x1ff6('0x11')];return new BPromise(function(_0x1df274,_0x5f1c02){return exec(util[_0x1ff6('0x12')](_0x1ff6('0x13'),_0x2cf429['params'][_0x1ff6('0x14')]),function(_0x36282a,_0x22bebb,_0x4be830){if(_0x36282a){return _0x5f1c02(_0x36282a);}return _0x1df274(_0x22bebb);});})[_0x1ff6('0xd')](function(_0x23d04f){var _0x52bcd2=![];var _0x25dab9=_0x23d04f[_0x1ff6('0x15')](/\n/);for(var _0x1dbb9e=0x0,_0x46bbe0=_0x4f7898[_0x1ff6('0x16')];_0x1dbb9e<_0x46bbe0,_0x52bcd2===![];_0x1dbb9e+=0x1){if(_0x23d04f[_0x1ff6('0x17')](_0x4f7898[_0x1dbb9e])>=0x0){_0x52bcd2=!![];}}if(!_0x52bcd2){throw new Error(util[_0x1ff6('0x12')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x2cf429['params']['pid']));}process['kill'](_0x2cf429['params'][_0x1ff6('0x14')],_0x1ff6('0x18'));return _0x4c322f[_0x1ff6('0x9')](0xc8)[_0x1ff6('0xe')]({'message':util[_0x1ff6('0x12')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x2cf429[_0x1ff6('0x19')][_0x1ff6('0x14')])});})['catch'](handleError(_0x4c322f,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index b0cc8fa..0141dc6 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 _0xcb91=['post','create','update','delete','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x4de586,_0x183427){var _0x46baf5=function(_0x1157f0){while(--_0x1157f0){_0x4de586['push'](_0x4de586['shift']());}};_0x46baf5(++_0x183427);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x16aaef,_0x410651){_0x16aaef=_0x16aaef-0x0;var _0x1c82ef=_0xcb91[_0x16aaef];return _0x1c82ef;};'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('./tag.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0xa')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0xb')]);router['put']('/:id',auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xc')]);router[_0x1cb9('0xd')](_0x1cb9('0x8'),auth[_0x1cb9('0x7')](),controller['destroy']);module[_0x1cb9('0xe')]=router; \ No newline at end of file +var _0x1be1=['get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x22d45f,_0x141304){var _0x2bd897=function(_0x32bb8e){while(--_0x32bb8e){_0x22d45f['push'](_0x22d45f['shift']());}};_0x2bd897(++_0x141304);}(_0x1be1,0x192));var _0x11be=function(_0x5bf736,_0x4a7c5e){_0x5bf736=_0x5bf736-0x0;var _0x3b5f34=_0x1be1[_0x5bf736];return _0x3b5f34;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11be('0x0'));var timeout=require(_0x11be('0x1'));var express=require('express');var router=express[_0x11be('0x2')]();var auth=require(_0x11be('0x3'));var interaction=require(_0x11be('0x4'));var config=require(_0x11be('0x5'));var controller=require('./tag.controller');router[_0x11be('0x6')]('/',auth[_0x11be('0x7')](),controller[_0x11be('0x8')]);router['get'](_0x11be('0x9'),auth['isAuthenticated'](),controller[_0x11be('0xa')]);router[_0x11be('0xb')]('/',auth[_0x11be('0x7')](),controller[_0x11be('0xc')]);router[_0x11be('0xd')]('/:id',auth[_0x11be('0x7')](),controller[_0x11be('0xe')]);router['delete'](_0x11be('0x9'),auth[_0x11be('0x7')](),controller[_0x11be('0xf')]);module[_0x11be('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index ada5783..8073ecf 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 _0x5c00=['STRING','sequelize','exports'];(function(_0x303221,_0x254ba3){var _0x43acd5=function(_0x17f12d){while(--_0x17f12d){_0x303221['push'](_0x303221['shift']());}};_0x43acd5(++_0x254ba3);}(_0x5c00,0x17e));var _0x05c0=function(_0x42ddf8,_0x264fc9){_0x42ddf8=_0x42ddf8-0x0;var _0x558152=_0x5c00[_0x42ddf8];return _0x558152;};'use strict';var Sequelize=require(_0x05c0('0x0'));module[_0x05c0('0x1')]={'name':{'type':Sequelize[_0x05c0('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x05c0('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x05c0('0x2')]}}; \ No newline at end of file +var _0x878f=['STRING','name','#0091EA','exports'];(function(_0x224bf2,_0x4c6a26){var _0x4c06de=function(_0x4d6d93){while(--_0x4d6d93){_0x224bf2['push'](_0x224bf2['shift']());}};_0x4c06de(++_0x4c6a26);}(_0x878f,0x173));var _0xf878=function(_0x2482fd,_0x5de80a){_0x2482fd=_0x2482fd-0x0;var _0x232584=_0x878f[_0x2482fd];return _0x232584;};'use strict';var Sequelize=require('sequelize');module[_0xf878('0x0')]={'name':{'type':Sequelize[_0xf878('0x1')],'unique':_0xf878('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xf878('0x1')],'defaultValue':_0xf878('0x3')},'description':{'type':Sequelize[_0xf878('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 7e8ee8f..0543213 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 _0x29b5=['params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','limit','set','Content-Range','apply','destroy','then','get','Tags','UserProfileResource','end','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show'];(function(_0x497fbe,_0x3fed8c){var _0x5a10c1=function(_0x36c2e6){while(--_0x36c2e6){_0x497fbe['push'](_0x497fbe['shift']());}};_0x5a10c1(++_0x3fed8c);}(_0x29b5,0xa2));var _0x529b=function(_0xacfdde,_0x2b85a5){_0xacfdde=_0xacfdde-0x0;var _0x3b0882=_0x29b5[_0xacfdde];return _0x3b0882;};'use strict';var pdf=require(_0x529b('0x0'));var emlformat=require(_0x529b('0x1'));var rimraf=require(_0x529b('0x2'));var zipdir=require(_0x529b('0x3'));var jsonpatch=require(_0x529b('0x4'));var rp=require(_0x529b('0x5'));var moment=require(_0x529b('0x6'));var BPromise=require(_0x529b('0x7'));var Mustache=require(_0x529b('0x8'));var util=require('util');var path=require(_0x529b('0x9'));var sox=require(_0x529b('0xa'));var csv=require('to-csv');var ejs=require(_0x529b('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x529b('0xc'));var crypto=require(_0x529b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x529b('0xe'));var toCsv=require(_0x529b('0xf'));var querystring=require(_0x529b('0x10'));var Papa=require(_0x529b('0x11'));var Redis=require(_0x529b('0x12'));var authService=require(_0x529b('0x13'));var qs=require(_0x529b('0x14'));var as=require(_0x529b('0x15'));var hardwareService=require(_0x529b('0x16'));var logger=require(_0x529b('0x17'))(_0x529b('0x18'));var utils=require(_0x529b('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x529b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b3e9d,_0x454440){_0x454440=_0x454440||0xcc;return function(_0x428df9){if(_0x428df9){return _0x1b3e9d[_0x529b('0x1b')](_0x454440);}return _0x1b3e9d['status'](_0x454440)['end']();};}function respondWithResult(_0x166a67,_0x46d769){_0x46d769=_0x46d769||0xc8;return function(_0x3e8c27){if(_0x3e8c27){return _0x166a67[_0x529b('0x1c')](_0x46d769)[_0x529b('0x1d')](_0x3e8c27);}};}function respondWithFilteredResult(_0x14e8e0,_0x4e2e04){return function(_0x52e02d){if(_0x52e02d){var _0x48112f=_0x52e02d['count'],_0x57a682=_0x4e2e04[_0x529b('0x1e')],_0x2c2294=_0x4e2e04['offset']+_0x4e2e04[_0x529b('0x1f')],_0x1a8304;if(_0x2c2294>=_0x48112f){_0x2c2294=_0x48112f;_0x1a8304=0xc8;}else{_0x1a8304=0xce;}_0x14e8e0[_0x529b('0x1c')](_0x1a8304);return _0x14e8e0[_0x529b('0x20')](_0x529b('0x21'),_0x57a682+'-'+_0x2c2294+'/'+_0x48112f)[_0x529b('0x1d')](_0x52e02d);}return null;};}function patchUpdates(_0x216bfa){return function(_0x3ed79d){try{jsonpatch[_0x529b('0x22')](_0x3ed79d,_0x216bfa,!![]);}catch(_0x59dbdd){return BPromise['reject'](_0x59dbdd);}return _0x3ed79d['save']();};}function saveUpdates(_0x52a17c,_0x377c76){return function(_0x518892){if(_0x518892){return _0x518892['update'](_0x52a17c)['then'](function(_0x371333){return _0x371333;});}return null;};}function removeEntity(_0x1b6647,_0x56c2a1){return function(_0x3888b1){if(_0x3888b1){return _0x3888b1[_0x529b('0x23')]()[_0x529b('0x24')](function(){var _0x37aa33=_0x3888b1[_0x529b('0x25')]({'plain':!![]});var _0x2af19c=_0x529b('0x26');return db[_0x529b('0x27')]['destroy']({'where':{'type':_0x2af19c,'resourceId':_0x37aa33['id']}})[_0x529b('0x24')](function(){return _0x3888b1;});})['then'](function(){_0x1b6647[_0x529b('0x1c')](0xcc)[_0x529b('0x28')]();});}};}function handleEntityNotFound(_0x7da3f1,_0x167e96){return function(_0x30fd29){if(!_0x30fd29){_0x7da3f1[_0x529b('0x1b')](0x194);}return _0x30fd29;};}function handleError(_0x400020,_0x30233b){_0x30233b=_0x30233b||0x1f4;return function(_0x382142){logger['error'](_0x382142['stack']);if(_0x382142[_0x529b('0x29')]){delete _0x382142['name'];}_0x400020[_0x529b('0x1c')](_0x30233b)[_0x529b('0x2a')](_0x382142);};}exports[_0x529b('0x2b')]=function(_0x514a58,_0x36fae2){var _0x553c25={},_0x4933cc={},_0x4c46f6={'count':0x0,'rows':[]};var _0x1fc79d=_[_0x529b('0x2c')](db[_0x529b('0x2d')][_0x529b('0x2e')],function(_0x519f77){return{'name':_0x519f77[_0x529b('0x2f')],'type':_0x519f77[_0x529b('0x30')][_0x529b('0x31')]};});_0x4933cc[_0x529b('0x32')]=_['map'](_0x1fc79d,_0x529b('0x29'));_0x4933cc['query']=_[_0x529b('0x33')](_0x514a58[_0x529b('0x34')]);_0x4933cc[_0x529b('0x35')]=_[_0x529b('0x36')](_0x4933cc['model'],_0x4933cc['query']);_0x553c25[_0x529b('0x37')]=_[_0x529b('0x36')](_0x4933cc[_0x529b('0x32')],qs['fields'](_0x514a58[_0x529b('0x34')][_0x529b('0x38')]));_0x553c25['attributes']=_0x553c25[_0x529b('0x37')]['length']?_0x553c25[_0x529b('0x37')]:_0x4933cc['model'];if(!_0x514a58['query'][_0x529b('0x39')](_0x529b('0x3a'))){_0x553c25[_0x529b('0x1f')]=qs[_0x529b('0x1f')](_0x514a58[_0x529b('0x34')][_0x529b('0x1f')]);_0x553c25[_0x529b('0x1e')]=qs['offset'](_0x514a58['query'][_0x529b('0x1e')]);}_0x553c25[_0x529b('0x3b')]=qs[_0x529b('0x3c')](_0x514a58['query']['sort']);_0x553c25['where']=qs[_0x529b('0x35')](_[_0x529b('0x3d')](_0x514a58['query'],_0x4933cc[_0x529b('0x35')]),_0x1fc79d);if(_0x514a58[_0x529b('0x34')][_0x529b('0x3e')]){_0x553c25[_0x529b('0x3f')]=_[_0x529b('0x40')](_0x553c25[_0x529b('0x3f')],{'$or':_[_0x529b('0x2c')](_0x1fc79d,function(_0x2a1e32){if(_0x2a1e32[_0x529b('0x30')]!==_0x529b('0x41')){var _0x4c25e3={};_0x4c25e3[_0x2a1e32[_0x529b('0x29')]]={'$like':'%'+_0x514a58[_0x529b('0x34')][_0x529b('0x3e')]+'%'};return _0x4c25e3;}})});}_0x553c25=_[_0x529b('0x40')]({},_0x553c25,_0x514a58[_0x529b('0x42')]);var _0x5d59af={'where':_0x553c25[_0x529b('0x3f')]};return db['Tag']['count'](_0x5d59af)['then'](function(_0x555006){_0x4c46f6['count']=_0x555006;if(_0x514a58[_0x529b('0x34')][_0x529b('0x43')]){_0x553c25[_0x529b('0x44')]=[{'all':!![]}];}return db[_0x529b('0x2d')]['findAll'](_0x553c25);})[_0x529b('0x24')](function(_0xd44a13){_0x4c46f6[_0x529b('0x45')]=_0xd44a13;return _0x4c46f6;})[_0x529b('0x24')](respondWithFilteredResult(_0x36fae2,_0x553c25))[_0x529b('0x46')](handleError(_0x36fae2,null));};exports[_0x529b('0x47')]=function(_0x190c28,_0xfca9a1){var _0x54366a={'raw':!![],'where':{'id':_0x190c28[_0x529b('0x48')]['id']}},_0x567287={};_0x567287[_0x529b('0x32')]=_['keys'](db[_0x529b('0x2d')][_0x529b('0x2e')]);_0x567287[_0x529b('0x34')]=_[_0x529b('0x33')](_0x190c28[_0x529b('0x34')]);_0x567287['filters']=_[_0x529b('0x36')](_0x567287['model'],_0x567287[_0x529b('0x34')]);_0x54366a[_0x529b('0x37')]=_[_0x529b('0x36')](_0x567287[_0x529b('0x32')],qs[_0x529b('0x38')](_0x190c28[_0x529b('0x34')][_0x529b('0x38')]));_0x54366a[_0x529b('0x37')]=_0x54366a[_0x529b('0x37')]['length']?_0x54366a['attributes']:_0x567287[_0x529b('0x32')];if(_0x190c28[_0x529b('0x34')][_0x529b('0x43')]){_0x54366a[_0x529b('0x44')]=[{'all':!![]}];}_0x54366a=_['merge']({},_0x54366a,_0x190c28[_0x529b('0x42')]);return db[_0x529b('0x2d')]['find'](_0x54366a)[_0x529b('0x24')](handleEntityNotFound(_0xfca9a1,null))['then'](respondWithResult(_0xfca9a1,null))[_0x529b('0x46')](handleError(_0xfca9a1,null));};exports[_0x529b('0x49')]=function(_0x1c3ef8,_0x32f6b5){return db['Tag'][_0x529b('0x49')](_0x1c3ef8[_0x529b('0x4a')],{})[_0x529b('0x24')](function(_0x5acbb2){var _0x5b63b2=_0x1c3ef8[_0x529b('0x4b')][_0x529b('0x25')]({'plain':!![]});if(!_0x5b63b2)throw new Error(_0x529b('0x4c'));if(_0x5b63b2['role']===_0x529b('0x4b')){var _0x5b4341=_0x5acbb2[_0x529b('0x25')]({'plain':!![]});var _0x518388=_0x529b('0x26');return db['UserProfileSection'][_0x529b('0x4d')]({'where':{'name':_0x518388,'userProfileId':_0x5b63b2['userProfileId']},'raw':!![]})[_0x529b('0x24')](function(_0xa26d69){if(_0xa26d69&&_0xa26d69['autoAssociation']===0x0){return db[_0x529b('0x27')][_0x529b('0x49')]({'name':_0x5b4341[_0x529b('0x29')],'resourceId':_0x5b4341['id'],'type':_0xa26d69[_0x529b('0x29')],'sectionId':_0xa26d69['id']},{})[_0x529b('0x24')](function(){return _0x5acbb2;});}else{return _0x5acbb2;}})[_0x529b('0x46')](function(_0x230784){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x230784);throw _0x230784;});}return _0x5acbb2;})[_0x529b('0x24')](respondWithResult(_0x32f6b5,0xc9))[_0x529b('0x46')](handleError(_0x32f6b5,null));};exports['update']=function(_0x2ad05e,_0x3be953){if(_0x2ad05e[_0x529b('0x4a')]['id']){delete _0x2ad05e[_0x529b('0x4a')]['id'];}return db[_0x529b('0x2d')][_0x529b('0x4d')]({'where':{'id':_0x2ad05e[_0x529b('0x48')]['id']}})[_0x529b('0x24')](handleEntityNotFound(_0x3be953,null))['then'](saveUpdates(_0x2ad05e['body'],null))[_0x529b('0x24')](respondWithResult(_0x3be953,null))['catch'](handleError(_0x3be953,null));};exports[_0x529b('0x23')]=function(_0x1e9cf1,_0xc701db){return db[_0x529b('0x2d')][_0x529b('0x4d')]({'where':{'id':_0x1e9cf1['params']['id']}})[_0x529b('0x24')](handleEntityNotFound(_0xc701db,null))['then'](removeEntity(_0xc701db,null))[_0x529b('0x46')](handleError(_0xc701db,null));}; \ No newline at end of file +var _0xef15=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','count','offset','limit','set','apply','update','then','destroy','Tags','UserProfileResource','sendStatus','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','Tag','includeAll','include','findAll','params','rawAttributes','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x49f28b,_0xb46d79){var _0x2943c8=function(_0xf15a0b){while(--_0xf15a0b){_0x49f28b['push'](_0x49f28b['shift']());}};_0x2943c8(++_0xb46d79);}(_0xef15,0x183));var _0x5ef1=function(_0x4c0658,_0x833e86){_0x4c0658=_0x4c0658-0x0;var _0x1ebcd7=_0xef15[_0x4c0658];return _0x1ebcd7;};'use strict';var pdf=require(_0x5ef1('0x0'));var emlformat=require(_0x5ef1('0x1'));var rimraf=require(_0x5ef1('0x2'));var zipdir=require(_0x5ef1('0x3'));var jsonpatch=require(_0x5ef1('0x4'));var rp=require('request-promise');var moment=require(_0x5ef1('0x5'));var BPromise=require(_0x5ef1('0x6'));var Mustache=require(_0x5ef1('0x7'));var util=require(_0x5ef1('0x8'));var path=require('path');var sox=require(_0x5ef1('0x9'));var csv=require('to-csv');var ejs=require(_0x5ef1('0xa'));var fs=require('fs');var _=require(_0x5ef1('0xb'));var squel=require('squel');var crypto=require(_0x5ef1('0xc'));var jsforce=require(_0x5ef1('0xd'));var deskjs=require(_0x5ef1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5ef1('0xf'));var Papa=require(_0x5ef1('0x10'));var Redis=require(_0x5ef1('0x11'));var authService=require(_0x5ef1('0x12'));var qs=require(_0x5ef1('0x13'));var as=require(_0x5ef1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ef1('0x15'))(_0x5ef1('0x16'));var utils=require(_0x5ef1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5ef1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56467d,_0x411a64){_0x411a64=_0x411a64||0xcc;return function(_0x47345e){if(_0x47345e){return _0x56467d['sendStatus'](_0x411a64);}return _0x56467d[_0x5ef1('0x19')](_0x411a64)[_0x5ef1('0x1a')]();};}function respondWithResult(_0x6eb15,_0x268a13){_0x268a13=_0x268a13||0xc8;return function(_0x21c94d){if(_0x21c94d){return _0x6eb15[_0x5ef1('0x19')](_0x268a13)[_0x5ef1('0x1b')](_0x21c94d);}};}function respondWithFilteredResult(_0x19f4ee,_0x5c658c){return function(_0x2d7cb7){if(_0x2d7cb7){var _0x5cf53a=_0x2d7cb7[_0x5ef1('0x1c')],_0x6a05a1=_0x5c658c[_0x5ef1('0x1d')],_0x24aaa6=_0x5c658c[_0x5ef1('0x1d')]+_0x5c658c[_0x5ef1('0x1e')],_0xf04aaa;if(_0x24aaa6>=_0x5cf53a){_0x24aaa6=_0x5cf53a;_0xf04aaa=0xc8;}else{_0xf04aaa=0xce;}_0x19f4ee['status'](_0xf04aaa);return _0x19f4ee[_0x5ef1('0x1f')]('Content-Range',_0x6a05a1+'-'+_0x24aaa6+'/'+_0x5cf53a)[_0x5ef1('0x1b')](_0x2d7cb7);}return null;};}function patchUpdates(_0x411189){return function(_0xe96219){try{jsonpatch[_0x5ef1('0x20')](_0xe96219,_0x411189,!![]);}catch(_0x553489){return BPromise['reject'](_0x553489);}return _0xe96219['save']();};}function saveUpdates(_0x326855,_0x120faf){return function(_0x109cb0){if(_0x109cb0){return _0x109cb0[_0x5ef1('0x21')](_0x326855)[_0x5ef1('0x22')](function(_0x2c15c2){return _0x2c15c2;});}return null;};}function removeEntity(_0x5671ac,_0x58974a){return function(_0x44b70e){if(_0x44b70e){return _0x44b70e[_0x5ef1('0x23')]()['then'](function(){var _0x252777=_0x44b70e['get']({'plain':!![]});var _0x4eb91f=_0x5ef1('0x24');return db[_0x5ef1('0x25')][_0x5ef1('0x23')]({'where':{'type':_0x4eb91f,'resourceId':_0x252777['id']}})['then'](function(){return _0x44b70e;});})[_0x5ef1('0x22')](function(){_0x5671ac[_0x5ef1('0x19')](0xcc)[_0x5ef1('0x1a')]();});}};}function handleEntityNotFound(_0x240467,_0x4cb685){return function(_0x5bb834){if(!_0x5bb834){_0x240467[_0x5ef1('0x26')](0x194);}return _0x5bb834;};}function handleError(_0x5b309c,_0x4fbe90){_0x4fbe90=_0x4fbe90||0x1f4;return function(_0x4b8898){logger['error'](_0x4b8898[_0x5ef1('0x27')]);if(_0x4b8898[_0x5ef1('0x28')]){delete _0x4b8898[_0x5ef1('0x28')];}_0x5b309c['status'](_0x4fbe90)[_0x5ef1('0x29')](_0x4b8898);};}exports[_0x5ef1('0x2a')]=function(_0x23b3b8,_0x2a4455){var _0x3edd87={},_0x2708c7={},_0x12cf8f={'count':0x0,'rows':[]};var _0x207914=_[_0x5ef1('0x2b')](db['Tag']['rawAttributes'],function(_0x33cdf6){return{'name':_0x33cdf6[_0x5ef1('0x2c')],'type':_0x33cdf6[_0x5ef1('0x2d')][_0x5ef1('0x2e')]};});_0x2708c7[_0x5ef1('0x2f')]=_[_0x5ef1('0x2b')](_0x207914,'name');_0x2708c7['query']=_[_0x5ef1('0x30')](_0x23b3b8[_0x5ef1('0x31')]);_0x2708c7[_0x5ef1('0x32')]=_[_0x5ef1('0x33')](_0x2708c7[_0x5ef1('0x2f')],_0x2708c7[_0x5ef1('0x31')]);_0x3edd87[_0x5ef1('0x34')]=_[_0x5ef1('0x33')](_0x2708c7[_0x5ef1('0x2f')],qs['fields'](_0x23b3b8[_0x5ef1('0x31')][_0x5ef1('0x35')]));_0x3edd87[_0x5ef1('0x34')]=_0x3edd87[_0x5ef1('0x34')][_0x5ef1('0x36')]?_0x3edd87['attributes']:_0x2708c7[_0x5ef1('0x2f')];if(!_0x23b3b8[_0x5ef1('0x31')][_0x5ef1('0x37')](_0x5ef1('0x38'))){_0x3edd87['limit']=qs['limit'](_0x23b3b8[_0x5ef1('0x31')][_0x5ef1('0x1e')]);_0x3edd87[_0x5ef1('0x1d')]=qs[_0x5ef1('0x1d')](_0x23b3b8[_0x5ef1('0x31')][_0x5ef1('0x1d')]);}_0x3edd87[_0x5ef1('0x39')]=qs[_0x5ef1('0x3a')](_0x23b3b8[_0x5ef1('0x31')][_0x5ef1('0x3a')]);_0x3edd87[_0x5ef1('0x3b')]=qs['filters'](_[_0x5ef1('0x3c')](_0x23b3b8[_0x5ef1('0x31')],_0x2708c7[_0x5ef1('0x32')]),_0x207914);if(_0x23b3b8[_0x5ef1('0x31')][_0x5ef1('0x3d')]){_0x3edd87[_0x5ef1('0x3b')]=_['merge'](_0x3edd87[_0x5ef1('0x3b')],{'$or':_[_0x5ef1('0x2b')](_0x207914,function(_0x41425){if(_0x41425[_0x5ef1('0x2d')]!==_0x5ef1('0x3e')){var _0x1ef153={};_0x1ef153[_0x41425[_0x5ef1('0x28')]]={'$like':'%'+_0x23b3b8['query'][_0x5ef1('0x3d')]+'%'};return _0x1ef153;}})});}_0x3edd87=_[_0x5ef1('0x3f')]({},_0x3edd87,_0x23b3b8[_0x5ef1('0x40')]);var _0x581d64={'where':_0x3edd87[_0x5ef1('0x3b')]};return db[_0x5ef1('0x41')][_0x5ef1('0x1c')](_0x581d64)[_0x5ef1('0x22')](function(_0x32b3ba){_0x12cf8f['count']=_0x32b3ba;if(_0x23b3b8[_0x5ef1('0x31')][_0x5ef1('0x42')]){_0x3edd87[_0x5ef1('0x43')]=[{'all':!![]}];}return db[_0x5ef1('0x41')][_0x5ef1('0x44')](_0x3edd87);})[_0x5ef1('0x22')](function(_0x3abb9b){_0x12cf8f['rows']=_0x3abb9b;return _0x12cf8f;})[_0x5ef1('0x22')](respondWithFilteredResult(_0x2a4455,_0x3edd87))['catch'](handleError(_0x2a4455,null));};exports['show']=function(_0x2a47da,_0x241d45){var _0xe0a4d={'raw':!![],'where':{'id':_0x2a47da[_0x5ef1('0x45')]['id']}},_0x547531={};_0x547531[_0x5ef1('0x2f')]=_[_0x5ef1('0x30')](db[_0x5ef1('0x41')][_0x5ef1('0x46')]);_0x547531[_0x5ef1('0x31')]=_['keys'](_0x2a47da['query']);_0x547531[_0x5ef1('0x32')]=_[_0x5ef1('0x33')](_0x547531['model'],_0x547531[_0x5ef1('0x31')]);_0xe0a4d[_0x5ef1('0x34')]=_[_0x5ef1('0x33')](_0x547531['model'],qs[_0x5ef1('0x35')](_0x2a47da[_0x5ef1('0x31')][_0x5ef1('0x35')]));_0xe0a4d[_0x5ef1('0x34')]=_0xe0a4d[_0x5ef1('0x34')]['length']?_0xe0a4d['attributes']:_0x547531[_0x5ef1('0x2f')];if(_0x2a47da[_0x5ef1('0x31')][_0x5ef1('0x42')]){_0xe0a4d['include']=[{'all':!![]}];}_0xe0a4d=_[_0x5ef1('0x3f')]({},_0xe0a4d,_0x2a47da[_0x5ef1('0x40')]);return db[_0x5ef1('0x41')]['find'](_0xe0a4d)[_0x5ef1('0x22')](handleEntityNotFound(_0x241d45,null))[_0x5ef1('0x22')](respondWithResult(_0x241d45,null))[_0x5ef1('0x47')](handleError(_0x241d45,null));};exports['create']=function(_0x46d83a,_0x5f544b){return db[_0x5ef1('0x41')][_0x5ef1('0x48')](_0x46d83a[_0x5ef1('0x49')],{})[_0x5ef1('0x22')](function(_0x2dd1db){var _0x525ea1=_0x46d83a[_0x5ef1('0x4a')][_0x5ef1('0x4b')]({'plain':!![]});if(!_0x525ea1)throw new Error(_0x5ef1('0x4c'));if(_0x525ea1[_0x5ef1('0x4d')]===_0x5ef1('0x4a')){var _0x4a785e=_0x2dd1db[_0x5ef1('0x4b')]({'plain':!![]});var _0x34de7b='Tags';return db[_0x5ef1('0x4e')][_0x5ef1('0x4f')]({'where':{'name':_0x34de7b,'userProfileId':_0x525ea1[_0x5ef1('0x50')]},'raw':!![]})[_0x5ef1('0x22')](function(_0x3b03d1){if(_0x3b03d1&&_0x3b03d1['autoAssociation']===0x0){return db[_0x5ef1('0x25')]['create']({'name':_0x4a785e['name'],'resourceId':_0x4a785e['id'],'type':_0x3b03d1[_0x5ef1('0x28')],'sectionId':_0x3b03d1['id']},{})[_0x5ef1('0x22')](function(){return _0x2dd1db;});}else{return _0x2dd1db;}})[_0x5ef1('0x47')](function(_0x15e346){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15e346);throw _0x15e346;});}return _0x2dd1db;})[_0x5ef1('0x22')](respondWithResult(_0x5f544b,0xc9))['catch'](handleError(_0x5f544b,null));};exports[_0x5ef1('0x21')]=function(_0x789c84,_0xab39c2){if(_0x789c84['body']['id']){delete _0x789c84[_0x5ef1('0x49')]['id'];}return db[_0x5ef1('0x41')][_0x5ef1('0x4f')]({'where':{'id':_0x789c84[_0x5ef1('0x45')]['id']}})['then'](handleEntityNotFound(_0xab39c2,null))[_0x5ef1('0x22')](saveUpdates(_0x789c84['body'],null))[_0x5ef1('0x22')](respondWithResult(_0xab39c2,null))['catch'](handleError(_0xab39c2,null));};exports['destroy']=function(_0x2d1eff,_0x1d68ca){return db[_0x5ef1('0x41')]['find']({'where':{'id':_0x2d1eff[_0x5ef1('0x45')]['id']}})[_0x5ef1('0x22')](handleEntityNotFound(_0x1d68ca,null))[_0x5ef1('0x22')](removeEntity(_0x1d68ca,null))[_0x5ef1('0x47')](handleError(_0x1d68ca,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 14eb12d..937b47c 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 _0x3a6d=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x3a6d,0x196));var _0xd3a6=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x3a6d[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var logger=require(_0xd3a6('0x2'))(_0xd3a6('0x3'));var moment=require(_0xd3a6('0x4'));var BPromise=require('bluebird');var rp=require(_0xd3a6('0x5'));var fs=require('fs');var path=require(_0xd3a6('0x6'));var rimraf=require(_0xd3a6('0x7'));var config=require(_0xd3a6('0x8'));var attributes=require(_0xd3a6('0x9'));module[_0xd3a6('0xa')]=function(_0x292432,_0x496461){return _0x292432[_0xd3a6('0xb')](_0xd3a6('0xc'),attributes,{'tableName':_0xd3a6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a65=['../../config/logger','bluebird','path','rimraf','./tag.attributes','exports','define','Tag','tools_tags','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a65,0x1a3));var _0x52a6=function(_0x4941c6,_0x3ca9f8){_0x4941c6=_0x4941c6-0x0;var _0x4d3654=_0x2a65[_0x4941c6];return _0x4d3654;};'use strict';var _=require(_0x52a6('0x0'));var util=require('util');var logger=require(_0x52a6('0x1'))('api');var moment=require('moment');var BPromise=require(_0x52a6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x52a6('0x3'));var rimraf=require(_0x52a6('0x4'));var config=require('../../config/environment');var attributes=require(_0x52a6('0x5'));module[_0x52a6('0x6')]=function(_0x431047,_0x180b23){return _0x431047[_0x52a6('0x7')](_0x52a6('0x8'),attributes,{'tableName':_0x52a6('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 bc7d31a..737df49 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 _0xf45e=['result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s','message'];(function(_0x47a5fc,_0x4649ca){var _0x26e3d2=function(_0x1d1dd1){while(--_0x1d1dd1){_0x47a5fc['push'](_0x47a5fc['shift']());}};_0x26e3d2(++_0x4649ca);}(_0xf45e,0x115));var _0xef45=function(_0x101d1b,_0x3d5ecc){_0x101d1b=_0x101d1b-0x0;var _0x56cf71=_0xf45e[_0x101d1b];return _0x56cf71;};'use strict';var _=require(_0xef45('0x0'));var util=require('util');var moment=require(_0xef45('0x1'));var BPromise=require('bluebird');var rs=require(_0xef45('0x2'));var fs=require('fs');var Redis=require(_0xef45('0x3'));var db=require(_0xef45('0x4'))['db'];var utils=require(_0xef45('0x5'));var logger=require(_0xef45('0x6'))(_0xef45('0x7'));var config=require(_0xef45('0x8'));var jayson=require(_0xef45('0x9'));var client=jayson[_0xef45('0xa')][_0xef45('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f2e92,_0x3303ad,_0x1a68c4){return new BPromise(function(_0x1e0def,_0x268ef6){return client[_0xef45('0xc')](_0x2f2e92,_0x1a68c4)[_0xef45('0xd')](function(_0x158a0b){logger[_0xef45('0xe')]('Tag,\x20%s,\x20%s',_0x3303ad,_0xef45('0xf'));logger[_0xef45('0x10')](_0xef45('0x11'),_0x3303ad,_0xef45('0xf'),JSON[_0xef45('0x12')](_0x158a0b));if(_0x158a0b[_0xef45('0x13')]){if(_0x158a0b['error'][_0xef45('0x14')]===0x1f4){logger[_0xef45('0x13')](_0xef45('0x15'),_0x3303ad,_0x158a0b[_0xef45('0x13')][_0xef45('0x16')]);return _0x268ef6(_0x158a0b['error']['message']);}logger[_0xef45('0x13')]('Tag,\x20%s,\x20%s',_0x3303ad,_0x158a0b[_0xef45('0x13')][_0xef45('0x16')]);return _0x1e0def(_0x158a0b[_0xef45('0x13')]['message']);}else{logger['info'](_0xef45('0x15'),_0x3303ad,'request\x20sent');_0x1e0def(_0x158a0b[_0xef45('0x17')][_0xef45('0x16')]);}})[_0xef45('0x18')](function(_0x3f40e5){logger['error']('Tag,\x20%s,\x20%s',_0x3303ad,_0x3f40e5);_0x268ef6(_0x3f40e5);});});} \ No newline at end of file +var _0xa74f=['result','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x5ad771,_0x34186f){var _0x5b5dce=function(_0x5ad0fb){while(--_0x5ad0fb){_0x5ad771['push'](_0x5ad771['shift']());}};_0x5b5dce(++_0x34186f);}(_0xa74f,0x9a));var _0xfa74=function(_0x5f5cce,_0x138cc5){_0x5f5cce=_0x5f5cce-0x0;var _0x705ecf=_0xa74f[_0x5f5cce];return _0x705ecf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfa74('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa74('0x1'));var db=require(_0xfa74('0x2'))['db'];var utils=require(_0xfa74('0x3'));var logger=require(_0xfa74('0x4'))('rpc');var config=require(_0xfa74('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfa74('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x9ddbd2,_0x3ac32e,_0x2d9fa9){return new BPromise(function(_0x287921,_0x344e04){return client['request'](_0x9ddbd2,_0x2d9fa9)[_0xfa74('0x7')](function(_0x37d4d8){logger[_0xfa74('0x8')](_0xfa74('0x9'),_0x3ac32e,'request\x20sent');logger[_0xfa74('0xa')](_0xfa74('0xb'),_0x3ac32e,'request\x20sent',JSON[_0xfa74('0xc')](_0x37d4d8));if(_0x37d4d8[_0xfa74('0xd')]){if(_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xe')]===0x1f4){logger['error'](_0xfa74('0x9'),_0x3ac32e,_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xf')]);return _0x344e04(_0x37d4d8[_0xfa74('0xd')]['message']);}logger[_0xfa74('0xd')](_0xfa74('0x9'),_0x3ac32e,_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xf')]);return _0x287921(_0x37d4d8[_0xfa74('0xd')]['message']);}else{logger[_0xfa74('0x8')](_0xfa74('0x9'),_0x3ac32e,_0xfa74('0x10'));_0x287921(_0x37d4d8[_0xfa74('0x11')][_0xfa74('0xf')]);}})[_0xfa74('0x12')](function(_0x3b9e32){logger['error'](_0xfa74('0x9'),_0x3ac32e,_0x3b9e32);_0x344e04(_0x3b9e32);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index d8e7d06..5130b25 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 _0x7965=['isAuthenticated','index','/:id/queues','getAgents','post','addQueues','/:id/users','addAgents','put','/:id','destroy','delete','removeQueues','removeAgents','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller'];(function(_0x175ad3,_0x173c72){var _0x11f580=function(_0x1b6078){while(--_0x1b6078){_0x175ad3['push'](_0x175ad3['shift']());}};_0x11f580(++_0x173c72);}(_0x7965,0x12c));var _0x5796=function(_0x40dd56,_0x726ca5){_0x40dd56=_0x40dd56-0x0;var _0x4f850f=_0x7965[_0x40dd56];return _0x4f850f;};'use strict';var multer=require(_0x5796('0x0'));var util=require('util');var path=require(_0x5796('0x1'));var timeout=require('connect-timeout');var express=require(_0x5796('0x2'));var router=express[_0x5796('0x3')]();var auth=require(_0x5796('0x4'));var interaction=require(_0x5796('0x5'));var config=require(_0x5796('0x6'));var controller=require(_0x5796('0x7'));router['get']('/',auth[_0x5796('0x8')](),controller[_0x5796('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x5796('0xa'),auth['isAuthenticated'](),controller['getQueues']);router['get']('/:id/users',auth[_0x5796('0x8')](),controller[_0x5796('0xb')]);router[_0x5796('0xc')]('/',auth[_0x5796('0x8')](),controller['create']);router[_0x5796('0xc')](_0x5796('0xa'),auth['isAuthenticated'](),controller[_0x5796('0xd')]);router['post'](_0x5796('0xe'),auth[_0x5796('0x8')](),controller[_0x5796('0xf')]);router[_0x5796('0x10')]('/:id',auth[_0x5796('0x8')](),controller['update']);router['delete'](_0x5796('0x11'),auth[_0x5796('0x8')](),controller[_0x5796('0x12')]);router[_0x5796('0x13')](_0x5796('0xa'),auth[_0x5796('0x8')](),controller[_0x5796('0x14')]);router[_0x5796('0x13')](_0x5796('0xe'),auth[_0x5796('0x8')](),controller[_0x5796('0x15')]);module['exports']=router; \ No newline at end of file +var _0x01e4=['post','create','addQueues','addAgents','update','delete','destroy','removeQueues','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/queues','getQueues','/:id/users'];(function(_0x4a4922,_0x82cb8f){var _0x55a8c6=function(_0x59712e){while(--_0x59712e){_0x4a4922['push'](_0x4a4922['shift']());}};_0x55a8c6(++_0x82cb8f);}(_0x01e4,0x133));var _0x401e=function(_0xbe3f36,_0x1b7346){_0xbe3f36=_0xbe3f36-0x0;var _0x38705a=_0x01e4[_0xbe3f36];return _0x38705a;};'use strict';var multer=require(_0x401e('0x0'));var util=require(_0x401e('0x1'));var path=require(_0x401e('0x2'));var timeout=require(_0x401e('0x3'));var express=require(_0x401e('0x4'));var router=express[_0x401e('0x5')]();var auth=require(_0x401e('0x6'));var interaction=require(_0x401e('0x7'));var config=require(_0x401e('0x8'));var controller=require('./team.controller');router['get']('/',auth[_0x401e('0x9')](),controller[_0x401e('0xa')]);router[_0x401e('0xb')](_0x401e('0xc'),auth['isAuthenticated'](),controller[_0x401e('0xd')]);router[_0x401e('0xb')](_0x401e('0xe'),auth[_0x401e('0x9')](),controller[_0x401e('0xf')]);router[_0x401e('0xb')](_0x401e('0x10'),auth[_0x401e('0x9')](),controller['getAgents']);router[_0x401e('0x11')]('/',auth[_0x401e('0x9')](),controller[_0x401e('0x12')]);router[_0x401e('0x11')](_0x401e('0xe'),auth[_0x401e('0x9')](),controller[_0x401e('0x13')]);router[_0x401e('0x11')]('/:id/users',auth[_0x401e('0x9')](),controller[_0x401e('0x14')]);router['put'](_0x401e('0xc'),auth[_0x401e('0x9')](),controller[_0x401e('0x15')]);router[_0x401e('0x16')]('/:id',auth[_0x401e('0x9')](),controller[_0x401e('0x17')]);router[_0x401e('0x16')](_0x401e('0xe'),auth[_0x401e('0x9')](),controller[_0x401e('0x18')]);router[_0x401e('0x16')]('/:id/users',auth[_0x401e('0x9')](),controller[_0x401e('0x19')]);module[_0x401e('0x1a')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 47dc3a0..880cf31 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 _0x0106=['exports','STRING','name','sequelize'];(function(_0x4d7671,_0x26bd46){var _0x5f1a6d=function(_0x1b3b82){while(--_0x1b3b82){_0x4d7671['push'](_0x4d7671['shift']());}};_0x5f1a6d(++_0x26bd46);}(_0x0106,0x73));var _0x6010=function(_0x13d5c1,_0x6fd929){_0x13d5c1=_0x13d5c1-0x0;var _0x152477=_0x0106[_0x13d5c1];return _0x152477;};'use strict';var Sequelize=require(_0x6010('0x0'));module[_0x6010('0x1')]={'name':{'type':Sequelize[_0x6010('0x2')],'allowNull':![],'unique':_0x6010('0x3')},'description':{'type':Sequelize[_0x6010('0x2')]}}; \ No newline at end of file +var _0x5d25=['name','exports'];(function(_0x59cb3a,_0x1c4965){var _0x29783a=function(_0x2c518f){while(--_0x2c518f){_0x59cb3a['push'](_0x59cb3a['shift']());}};_0x29783a(++_0x1c4965);}(_0x5d25,0x13d));var _0x55d2=function(_0x157a98,_0x27bd64){_0x157a98=_0x157a98-0x0;var _0x31dbdf=_0x5d25[_0x157a98];return _0x31dbdf;};'use strict';var Sequelize=require('sequelize');module[_0x55d2('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x55d2('0x1')},'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 d82aa7b..5b4cfa3 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 _0xba8a=['Mail','Sms','Fax','Whatsapp','addAgents','voicePause','interface','each','filter','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','omit','emit','removeAgents','voice','mail','sms','fax','whatsapp','getAgents','User','html-pdf','zip-dir','request-promise','moment','mustache','path','sox','ejs','lodash','squel','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./team.socket','register','status','end','json','offset','limit','Content-Range','apply','update','then','Teams','destroy','error','name','send','index','map','Team','rawAttributes','type','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','options','count','include','findAll','rows','show','params','includeAll','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','catch','body','channel','isValidChannel','ValidationError','Unknown\x20channel','Queue','length','order','capitalize','toLowerCase','Queues','addQueues','findOne','Sequelize','add','ids','Chat'];(function(_0x3f152b,_0x435cdf){var _0x49dc6e=function(_0x59a0b8){while(--_0x59a0b8){_0x3f152b['push'](_0x3f152b['shift']());}};_0x49dc6e(++_0x435cdf);}(_0xba8a,0x1e8));var _0xaba8=function(_0x1a637c,_0x245b0c){_0x1a637c=_0x1a637c-0x0;var _0x113850=_0xba8a[_0x1a637c];return _0x113850;};'use strict';var pdf=require(_0xaba8('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaba8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaba8('0x2'));var moment=require(_0xaba8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaba8('0x4'));var util=require('util');var path=require(_0xaba8('0x5'));var sox=require(_0xaba8('0x6'));var csv=require('to-csv');var ejs=require(_0xaba8('0x7'));var fs=require('fs');var _=require(_0xaba8('0x8'));var squel=require(_0xaba8('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaba8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xaba8('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaba8('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaba8('0xd'))(_0xaba8('0xe'));var utils=require(_0xaba8('0xf'));var config=require(_0xaba8('0x10'));var licenseUtil=require(_0xaba8('0x11'));var db=require(_0xaba8('0x12'))['db'];config[_0xaba8('0x13')]=_[_0xaba8('0x14')](config['redis'],{'host':_0xaba8('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaba8('0x13')]));require(_0xaba8('0x16'))[_0xaba8('0x17')](socket);function respondWithStatusCode(_0x55eb9c,_0x11f532){_0x11f532=_0x11f532||0xcc;return function(_0x4f293b){if(_0x4f293b){return _0x55eb9c['sendStatus'](_0x11f532);}return _0x55eb9c[_0xaba8('0x18')](_0x11f532)[_0xaba8('0x19')]();};}function respondWithResult(_0x1f399b,_0x311b8f){_0x311b8f=_0x311b8f||0xc8;return function(_0x37612c){if(_0x37612c){return _0x1f399b[_0xaba8('0x18')](_0x311b8f)[_0xaba8('0x1a')](_0x37612c);}};}function respondWithFilteredResult(_0x33708d,_0x51aadf){return function(_0x384ca2){if(_0x384ca2){var _0x354669=_0x384ca2['count'],_0x5b1c17=_0x51aadf[_0xaba8('0x1b')],_0x18f32a=_0x51aadf[_0xaba8('0x1b')]+_0x51aadf[_0xaba8('0x1c')],_0x14469b;if(_0x18f32a>=_0x354669){_0x18f32a=_0x354669;_0x14469b=0xc8;}else{_0x14469b=0xce;}_0x33708d[_0xaba8('0x18')](_0x14469b);return _0x33708d['set'](_0xaba8('0x1d'),_0x5b1c17+'-'+_0x18f32a+'/'+_0x354669)['json'](_0x384ca2);}return null;};}function patchUpdates(_0x40833e){return function(_0x30b328){try{jsonpatch[_0xaba8('0x1e')](_0x30b328,_0x40833e,!![]);}catch(_0x16d117){return BPromise['reject'](_0x16d117);}return _0x30b328['save']();};}function saveUpdates(_0x36f9d6,_0x1e0384){return function(_0x2cda03){if(_0x2cda03){return _0x2cda03[_0xaba8('0x1f')](_0x36f9d6)[_0xaba8('0x20')](function(_0x15ad4c){return _0x15ad4c;});}return null;};}function removeEntity(_0x47bbdb,_0x58212c){return function(_0x19f310){if(_0x19f310){return _0x19f310['destroy']()['then'](function(){var _0x45d5b6=_0x19f310['get']({'plain':!![]});var _0x39892c=_0xaba8('0x21');return db['UserProfileResource'][_0xaba8('0x22')]({'where':{'type':_0x39892c,'resourceId':_0x45d5b6['id']}})[_0xaba8('0x20')](function(){return _0x19f310;});})[_0xaba8('0x20')](function(){_0x47bbdb[_0xaba8('0x18')](0xcc)[_0xaba8('0x19')]();});}};}function handleEntityNotFound(_0xe70791,_0x39a1b4){return function(_0xca8559){if(!_0xca8559){_0xe70791['sendStatus'](0x194);}return _0xca8559;};}function handleError(_0x1ef6a0,_0x4954a7){_0x4954a7=_0x4954a7||0x1f4;return function(_0x623e9a){logger[_0xaba8('0x23')](_0x623e9a['stack']);if(_0x623e9a[_0xaba8('0x24')]){delete _0x623e9a[_0xaba8('0x24')];}_0x1ef6a0['status'](_0x4954a7)[_0xaba8('0x25')](_0x623e9a);};}exports[_0xaba8('0x26')]=function(_0x400983,_0x319a10){var _0x3b00d0={},_0x147821={},_0x1489d7={'count':0x0,'rows':[]};var _0xc14e09=_[_0xaba8('0x27')](db[_0xaba8('0x28')][_0xaba8('0x29')],function(_0x4a7b4e){return{'name':_0x4a7b4e['fieldName'],'type':_0x4a7b4e[_0xaba8('0x2a')]['key']};});_0x147821['model']=_[_0xaba8('0x27')](_0xc14e09,_0xaba8('0x24'));_0x147821[_0xaba8('0x2b')]=_[_0xaba8('0x2c')](_0x400983['query']);_0x147821['filters']=_[_0xaba8('0x2d')](_0x147821[_0xaba8('0x2e')],_0x147821[_0xaba8('0x2b')]);_0x3b00d0['attributes']=_[_0xaba8('0x2d')](_0x147821[_0xaba8('0x2e')],qs['fields'](_0x400983[_0xaba8('0x2b')][_0xaba8('0x2f')]));_0x3b00d0[_0xaba8('0x30')]=_0x3b00d0['attributes']['length']?_0x3b00d0[_0xaba8('0x30')]:_0x147821['model'];if(!_0x400983[_0xaba8('0x2b')][_0xaba8('0x31')](_0xaba8('0x32'))){_0x3b00d0['limit']=qs[_0xaba8('0x1c')](_0x400983[_0xaba8('0x2b')][_0xaba8('0x1c')]);_0x3b00d0['offset']=qs[_0xaba8('0x1b')](_0x400983[_0xaba8('0x2b')][_0xaba8('0x1b')]);}_0x3b00d0['order']=qs[_0xaba8('0x33')](_0x400983[_0xaba8('0x2b')][_0xaba8('0x33')]);_0x3b00d0[_0xaba8('0x34')]=qs[_0xaba8('0x35')](_[_0xaba8('0x36')](_0x400983['query'],_0x147821[_0xaba8('0x35')]),_0xc14e09);if(_0x400983[_0xaba8('0x2b')]['filter']){_0x3b00d0[_0xaba8('0x34')]=_[_0xaba8('0x37')](_0x3b00d0['where'],{'$or':_[_0xaba8('0x27')](_0xc14e09,function(_0xd247ee){if(_0xd247ee[_0xaba8('0x2a')]!==_0xaba8('0x38')){var _0x3a688f={};_0x3a688f[_0xd247ee['name']]={'$like':'%'+_0x400983[_0xaba8('0x2b')]['filter']+'%'};return _0x3a688f;}})});}_0x3b00d0=_[_0xaba8('0x37')]({},_0x3b00d0,_0x400983[_0xaba8('0x39')]);var _0x4b319e={'where':_0x3b00d0['where']};return db[_0xaba8('0x28')][_0xaba8('0x3a')](_0x4b319e)['then'](function(_0x3c1da5){_0x1489d7['count']=_0x3c1da5;if(_0x400983[_0xaba8('0x2b')]['includeAll']){_0x3b00d0[_0xaba8('0x3b')]=[{'all':!![]}];}return db[_0xaba8('0x28')][_0xaba8('0x3c')](_0x3b00d0);})[_0xaba8('0x20')](function(_0x4b0247){_0x1489d7[_0xaba8('0x3d')]=_0x4b0247;return _0x1489d7;})[_0xaba8('0x20')](respondWithFilteredResult(_0x319a10,_0x3b00d0))['catch'](handleError(_0x319a10,null));};exports[_0xaba8('0x3e')]=function(_0x35c9ba,_0x56d86a){var _0x30c457={'raw':![],'where':{'id':_0x35c9ba[_0xaba8('0x3f')]['id']}},_0x479653={};_0x479653[_0xaba8('0x2e')]=_[_0xaba8('0x2c')](db[_0xaba8('0x28')][_0xaba8('0x29')]);_0x479653[_0xaba8('0x2b')]=_[_0xaba8('0x2c')](_0x35c9ba[_0xaba8('0x2b')]);_0x479653[_0xaba8('0x35')]=_[_0xaba8('0x2d')](_0x479653[_0xaba8('0x2e')],_0x479653[_0xaba8('0x2b')]);_0x30c457['attributes']=_[_0xaba8('0x2d')](_0x479653[_0xaba8('0x2e')],qs[_0xaba8('0x2f')](_0x35c9ba[_0xaba8('0x2b')]['fields']));_0x30c457['attributes']=_0x30c457[_0xaba8('0x30')]['length']?_0x30c457['attributes']:_0x479653[_0xaba8('0x2e')];if(_0x35c9ba[_0xaba8('0x2b')][_0xaba8('0x40')]){_0x30c457[_0xaba8('0x3b')]=[{'all':!![]}];}_0x30c457=_[_0xaba8('0x37')]({},_0x30c457,_0x35c9ba[_0xaba8('0x39')]);return db[_0xaba8('0x28')][_0xaba8('0x41')](_0x30c457)['then'](handleEntityNotFound(_0x56d86a,null))[_0xaba8('0x20')](respondWithResult(_0x56d86a,null))['catch'](handleError(_0x56d86a,null));};exports[_0xaba8('0x42')]=function(_0x4c7745,_0x3a96dd){return db['Team'][_0xaba8('0x42')](_0x4c7745['body'],{})[_0xaba8('0x20')](function(_0x1078e1){var _0x28613d=_0x4c7745['user'][_0xaba8('0x43')]({'plain':!![]});if(!_0x28613d)throw new Error(_0xaba8('0x44'));if(_0x28613d[_0xaba8('0x45')]===_0xaba8('0x46')){var _0x293243=_0x1078e1[_0xaba8('0x43')]({'plain':!![]});var _0x217d34=_0xaba8('0x21');return db['UserProfileSection'][_0xaba8('0x41')]({'where':{'name':_0x217d34,'userProfileId':_0x28613d[_0xaba8('0x47')]},'raw':!![]})[_0xaba8('0x20')](function(_0x54fba3){if(_0x54fba3&&_0x54fba3[_0xaba8('0x48')]===0x0){return db[_0xaba8('0x49')][_0xaba8('0x42')]({'name':_0x293243['name'],'resourceId':_0x293243['id'],'type':_0x54fba3['name'],'sectionId':_0x54fba3['id']},{})[_0xaba8('0x20')](function(){return _0x1078e1;});}else{return _0x1078e1;}})[_0xaba8('0x4a')](function(_0x16ead6){logger[_0xaba8('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16ead6);throw _0x16ead6;});}return _0x1078e1;})[_0xaba8('0x20')](respondWithResult(_0x3a96dd,0xc9))[_0xaba8('0x4a')](handleError(_0x3a96dd,null));};exports['update']=function(_0x141a1e,_0x2d3d46){if(_0x141a1e[_0xaba8('0x4b')]['id']){delete _0x141a1e[_0xaba8('0x4b')]['id'];}return db['Team']['find']({'where':{'id':_0x141a1e['params']['id']}})[_0xaba8('0x20')](handleEntityNotFound(_0x2d3d46,null))[_0xaba8('0x20')](saveUpdates(_0x141a1e[_0xaba8('0x4b')],null))[_0xaba8('0x20')](respondWithResult(_0x2d3d46,null))['catch'](handleError(_0x2d3d46,null));};exports[_0xaba8('0x22')]=function(_0x38efe0,_0x4ae579){return db[_0xaba8('0x28')][_0xaba8('0x41')]({'where':{'id':_0x38efe0[_0xaba8('0x3f')]['id']}})[_0xaba8('0x20')](handleEntityNotFound(_0x4ae579,null))[_0xaba8('0x20')](removeEntity(_0x4ae579,null))[_0xaba8('0x4a')](handleError(_0x4ae579,null));};exports['getQueues']=function(_0xc72d2c,_0x20342f,_0x2d553f){return db[_0xaba8('0x28')]['findOne']({'where':{'id':_0xc72d2c[_0xaba8('0x3f')]['id']}})[_0xaba8('0x20')](handleEntityNotFound(_0x20342f,null))[_0xaba8('0x20')](function(_0x3bd530){if(!_0xc72d2c[_0xaba8('0x2b')][_0xaba8('0x4c')]||!utils[_0xaba8('0x4d')](_0xc72d2c[_0xaba8('0x2b')][_0xaba8('0x4c')])){throw new db['Sequelize'][(_0xaba8('0x4e'))](_0xaba8('0x4f'));}var _0x52ac25={};var _0x3b7766={};_0x3b7766['model']=_[_0xaba8('0x2c')](db[_['capitalize'](_0xc72d2c['query']['channel']['toLowerCase']())+_0xaba8('0x50')]['rawAttributes']);_0x3b7766[_0xaba8('0x2b')]=_[_0xaba8('0x2c')](_0xc72d2c[_0xaba8('0x2b')]);_0x3b7766[_0xaba8('0x35')]=_[_0xaba8('0x2d')](_0x3b7766[_0xaba8('0x2e')],_0x3b7766[_0xaba8('0x2b')]);_0x52ac25['attributes']=_[_0xaba8('0x2d')](_0x3b7766[_0xaba8('0x2e')],qs['fields'](_0xc72d2c[_0xaba8('0x2b')]['fields']));_0x52ac25['attributes']=_0x52ac25[_0xaba8('0x30')][_0xaba8('0x51')]?_0x52ac25['attributes']:_0x3b7766[_0xaba8('0x2e')];_0x52ac25[_0xaba8('0x1c')]=qs[_0xaba8('0x1c')](_0xc72d2c[_0xaba8('0x2b')]['limit']);_0x52ac25[_0xaba8('0x1b')]=qs[_0xaba8('0x1b')](_0xc72d2c[_0xaba8('0x2b')][_0xaba8('0x1b')]);_0x52ac25[_0xaba8('0x52')]=qs['sort'](_0xc72d2c[_0xaba8('0x2b')][_0xaba8('0x33')]);_0x52ac25[_0xaba8('0x34')]=qs['filters'](_['pick'](_0xc72d2c[_0xaba8('0x2b')],_0x3b7766[_0xaba8('0x35')]));_0x52ac25=_[_0xaba8('0x37')]({},_0x52ac25,_0xc72d2c['options']);return _0x3bd530[_0xaba8('0x43')+_[_0xaba8('0x53')](_0xc72d2c[_0xaba8('0x2b')][_0xaba8('0x4c')][_0xaba8('0x54')]())+_0xaba8('0x55')](_0x52ac25);})[_0xaba8('0x20')](respondWithResult(_0x20342f,null))[_0xaba8('0x4a')](handleError(_0x20342f,null));};exports[_0xaba8('0x56')]=function(_0x156eae,_0x4496ce,_0x423f1b){return db[_0xaba8('0x28')][_0xaba8('0x57')]({'where':{'id':_0x156eae['params']['id']}})[_0xaba8('0x20')](function(_0x31cce7){if(_0x31cce7){if(!_0x156eae[_0xaba8('0x4b')][_0xaba8('0x4c')]||!utils[_0xaba8('0x4d')](_0x156eae[_0xaba8('0x4b')][_0xaba8('0x4c')])){throw new db[(_0xaba8('0x58'))]['ValidationError'](_0xaba8('0x4f'));}return _0x31cce7[_0xaba8('0x59')+_[_0xaba8('0x53')](_0x156eae[_0xaba8('0x4b')][_0xaba8('0x4c')]['toLowerCase']())+_0xaba8('0x55')](_0x156eae[_0xaba8('0x4b')][_0xaba8('0x5a')]);}return null;})[_0xaba8('0x20')](handleEntityNotFound(_0x4496ce,null))[_0xaba8('0x20')](respondWithStatusCode(_0x4496ce,null))[_0xaba8('0x4a')](handleError(_0x4496ce,null));};exports['removeQueues']=function(_0x50b839,_0x4c2069,_0x2f862b){return db['Team'][_0xaba8('0x57')]({'where':{'id':_0x50b839[_0xaba8('0x3f')]['id']}})['then'](function(_0x21d671){if(_0x21d671){if(!_0x50b839['query'][_0xaba8('0x4c')]||!utils['isValidChannel'](_0x50b839['query']['channel'])){throw new db[(_0xaba8('0x58'))][(_0xaba8('0x4e'))](_0xaba8('0x4f'));}return _0x21d671['remove'+_['capitalize'](_0x50b839['query'][_0xaba8('0x4c')]['toLowerCase']())+_0xaba8('0x55')](_0x50b839[_0xaba8('0x2b')][_0xaba8('0x5a')]);}return null;})['then'](handleEntityNotFound(_0x4c2069,null))[_0xaba8('0x20')](respondWithStatusCode(_0x4c2069,null))[_0xaba8('0x4a')](handleError(_0x4c2069,null));};exports['addAgents']=function(_0x482bc0,_0x536d27,_0x5f5173){return db['Team'][_0xaba8('0x41')]({'where':{'id':_0x482bc0[_0xaba8('0x3f')]['id']}})[_0xaba8('0x20')](handleEntityNotFound(_0x536d27,null))['then'](function(_0x176c76){if(_0x176c76){var _0x80d7c=['Voice',_0xaba8('0x5b'),_0xaba8('0x5c'),_0xaba8('0x5d'),_0xaba8('0x5e'),'Openchannel',_0xaba8('0x5f')];return BPromise['each'](_0x80d7c,function(_0x24ef5f){return _0x176c76['get'+_0x24ef5f+_0xaba8('0x55')]({'attributes':['id','name']})[_0xaba8('0x20')](function(_0x32015a){return BPromise['each'](_0x32015a,function(_0x2ef9ce){return _0x2ef9ce[_0xaba8('0x60')](_0x482bc0['body'][_0xaba8('0x5a')])['then'](function(){if(_0x24ef5f==='Voice'){return db['User'][_0xaba8('0x3c')]({'where':{'id':_0x482bc0[_0xaba8('0x4b')][_0xaba8('0x5a')]},'attributes':['id',_0xaba8('0x24'),'online',_0xaba8('0x61'),_0xaba8('0x62')],'raw':!![]})[_0xaba8('0x20')](function(_0x3b2896){return BPromise[_0xaba8('0x63')](_[_0xaba8('0x64')](_0x3b2896,{'online':0x1}),function(_0x5e83b7){return db[_0xaba8('0x65')][_0xaba8('0x66')]({'membername':_0x5e83b7[_0xaba8('0x24')],'UserId':_0x5e83b7['id'],'queue_name':_0x2ef9ce['name'],'VoiceQueueId':_0x2ef9ce['id'],'interface':_[_0xaba8('0x67')](_0x5e83b7[_0xaba8('0x62')])?util[_0xaba8('0x68')](_0xaba8('0x69'),_0x5e83b7[_0xaba8('0x24')]):_0x5e83b7[_0xaba8('0x62')],'paused':_0x5e83b7[_0xaba8('0x61')]||![],'penalty':0x0});});});}});});})[_0xaba8('0x20')](function(){return _0x176c76;});})['then'](function(){return _0x176c76;});}})[_0xaba8('0x20')](function(_0x3d59d7){if(_0x3d59d7){return _0x3d59d7[_0xaba8('0x60')](_0x482bc0['body']['ids'],_[_0xaba8('0x6a')](_0x482bc0[_0xaba8('0x4b')],[_0xaba8('0x5a'),'id'])||{})['spread'](function(_0x5790d8){for(var _0x2dc51c=0x0;_0x2dc51c<_0x482bc0[_0xaba8('0x4b')][_0xaba8('0x5a')][_0xaba8('0x51')];_0x2dc51c+=0x1){socket[_0xaba8('0x6b')]('userTeam:save',{'UserId':_0x482bc0['body'][_0xaba8('0x5a')][_0x2dc51c],'TeamId':_0x482bc0[_0xaba8('0x3f')]['id']});}return _0x5790d8;});}})[_0xaba8('0x20')](respondWithResult(_0x536d27,null))['catch'](handleError(_0x536d27,null));};exports[_0xaba8('0x6c')]=function(_0x5250ed,_0x4d18aa,_0x4798b9){return db[_0xaba8('0x28')][_0xaba8('0x41')]({'where':{'id':_0x5250ed[_0xaba8('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4d18aa,null))[_0xaba8('0x20')](function(_0x4acefe){if(_0x4acefe){return BPromise[_0xaba8('0x63')]([_0xaba8('0x6d'),'chat',_0xaba8('0x6e'),_0xaba8('0x6f'),_0xaba8('0x70'),'openchannel',_0xaba8('0x71')],function(_0x5d9137){return _0x4acefe[_0xaba8('0x43')+_[_0xaba8('0x53')](_0x5d9137)+_0xaba8('0x55')]({'attributes':['id',_0xaba8('0x24')]})[_0xaba8('0x20')](function(_0x31dcb7){return BPromise[_0xaba8('0x63')](_0x31dcb7,function(_0xc25eb3){return _0xc25eb3['removeAgents'](_0x5250ed[_0xaba8('0x2b')][_0xaba8('0x5a')])[_0xaba8('0x20')](function(){if(_0x5d9137===_0xaba8('0x6d')){return db[_0xaba8('0x65')][_0xaba8('0x22')]({'where':{'VoiceQueueId':_0xc25eb3['id'],'UserId':_0x5250ed['query'][_0xaba8('0x5a')]}});}});});})['then'](function(){return _0x4acefe;});})[_0xaba8('0x20')](function(){return _0x4acefe;});}})[_0xaba8('0x20')](function(_0x534bd4){if(_0x534bd4){return _0x534bd4[_0xaba8('0x6c')](_0x5250ed[_0xaba8('0x2b')]['ids'])[_0xaba8('0x20')](function(){if(_['isArray'](_0x5250ed[_0xaba8('0x2b')]['ids'])){for(var _0x109a1a=0x0;_0x109a1a<_0x5250ed[_0xaba8('0x2b')][_0xaba8('0x5a')][_0xaba8('0x51')];_0x109a1a+=0x1){socket[_0xaba8('0x6b')]('userTeam:remove',{'UserId':Number(_0x5250ed[_0xaba8('0x2b')]['ids'][_0x109a1a]),'TeamId':Number(_0x5250ed[_0xaba8('0x3f')]['id'])});}}else{socket[_0xaba8('0x6b')]('userTeam:remove',{'UserId':Number(_0x5250ed[_0xaba8('0x2b')][_0xaba8('0x5a')]),'TeamId':Number(_0x5250ed['params']['id'])});}});}})[_0xaba8('0x20')](respondWithStatusCode(_0x4d18aa,null))[_0xaba8('0x4a')](handleError(_0x4d18aa,null));};exports[_0xaba8('0x72')]=function(_0x1b5f98,_0xfeaef,_0x9dc49d){var _0x1b3044={};var _0x323387={};var _0x2ab9cb;var _0x3ef83c;return db[_0xaba8('0x28')]['findOne']({'where':{'id':_0x1b5f98[_0xaba8('0x3f')]['id']}})['then'](handleEntityNotFound(_0xfeaef,null))['then'](function(_0x43df35){if(_0x43df35){_0x2ab9cb=_0x43df35;_0x323387[_0xaba8('0x2e')]=_[_0xaba8('0x2c')](db[_0xaba8('0x73')][_0xaba8('0x29')]);_0x323387[_0xaba8('0x2b')]=_[_0xaba8('0x2c')](_0x1b5f98[_0xaba8('0x2b')]);_0x323387[_0xaba8('0x35')]=_[_0xaba8('0x2d')](_0x323387[_0xaba8('0x2e')],_0x323387[_0xaba8('0x2b')]);_0x1b3044[_0xaba8('0x30')]=_[_0xaba8('0x2d')](_0x323387[_0xaba8('0x2e')],qs['fields'](_0x1b5f98[_0xaba8('0x2b')][_0xaba8('0x2f')]));_0x1b3044[_0xaba8('0x30')]=_0x1b3044[_0xaba8('0x30')]['length']?_0x1b3044[_0xaba8('0x30')]:_0x323387[_0xaba8('0x2e')];_0x1b3044[_0xaba8('0x52')]=qs[_0xaba8('0x33')](_0x1b5f98[_0xaba8('0x2b')][_0xaba8('0x33')]);_0x1b3044[_0xaba8('0x34')]=qs[_0xaba8('0x35')](_['pick'](_0x1b5f98['query'],_0x323387['filters']));if(_0x1b5f98[_0xaba8('0x2b')][_0xaba8('0x64')]){_0x1b3044['where']=_[_0xaba8('0x37')](_0x1b3044[_0xaba8('0x34')],{'$or':_['map'](_0x1b3044[_0xaba8('0x30')],function(_0x3fa28b){var _0x5746ed={};_0x5746ed[_0x3fa28b]={'$like':'%'+_0x1b5f98[_0xaba8('0x2b')][_0xaba8('0x64')]+'%'};return _0x5746ed;})});}_0x1b3044=_[_0xaba8('0x37')]({},_0x1b3044,_0x1b5f98['options']);return _0x2ab9cb[_0xaba8('0x72')](_0x1b3044);}})[_0xaba8('0x20')](function(_0x2cad09){if(_0x2cad09){_0x3ef83c=_0x2cad09[_0xaba8('0x51')];if(!_0x1b5f98[_0xaba8('0x2b')]['hasOwnProperty'](_0xaba8('0x32'))){_0x1b3044['limit']=qs['limit'](_0x1b5f98[_0xaba8('0x2b')]['limit']);_0x1b3044[_0xaba8('0x1b')]=qs['offset'](_0x1b5f98[_0xaba8('0x2b')][_0xaba8('0x1b')]);}return _0x2ab9cb['getAgents'](_0x1b3044);}})['then'](function(_0x298c69){if(_0x298c69){return _0x298c69?{'count':_0x3ef83c,'rows':_0x298c69}:null;}})[_0xaba8('0x20')](respondWithResult(_0xfeaef,null))[_0xaba8('0x4a')](handleError(_0xfeaef,null));}; \ No newline at end of file +var _0x8914=['hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','Team','include','rows','params','keys','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','update','destroy','findOne','channel','isValidChannel','Sequelize','ValidationError','Queue','capitalize','toLowerCase','Queues','addQueues','Unknown\x20channel','add','removeQueues','remove','ids','Voice','Mail','Fax','Whatsapp','each','User','findAll','online','voicePause','upsert','format','SIP/%s','interface','omit','spread','emit','userTeam:save','removeAgents','chat','mail','sms','fax','openchannel','voice','isArray','userTeam:remove','getAgents','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','Teams','error','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length'];(function(_0x1d9163,_0x79567d){var _0xb42197=function(_0x3818e8){while(--_0x3818e8){_0x1d9163['push'](_0x1d9163['shift']());}};_0xb42197(++_0x79567d);}(_0x8914,0x1cc));var _0x4891=function(_0x14d6f3,_0x19b70b){_0x14d6f3=_0x14d6f3-0x0;var _0x3e8588=_0x8914[_0x14d6f3];return _0x3e8588;};'use strict';var pdf=require(_0x4891('0x0'));var emlformat=require(_0x4891('0x1'));var rimraf=require(_0x4891('0x2'));var zipdir=require(_0x4891('0x3'));var jsonpatch=require(_0x4891('0x4'));var rp=require(_0x4891('0x5'));var moment=require(_0x4891('0x6'));var BPromise=require(_0x4891('0x7'));var Mustache=require(_0x4891('0x8'));var util=require('util');var path=require(_0x4891('0x9'));var sox=require(_0x4891('0xa'));var csv=require('to-csv');var ejs=require(_0x4891('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4891('0xc'));var crypto=require('crypto');var jsforce=require(_0x4891('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4891('0xe'));var querystring=require(_0x4891('0xf'));var Papa=require(_0x4891('0x10'));var Redis=require(_0x4891('0x11'));var authService=require(_0x4891('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4891('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4891('0x14'))(_0x4891('0x15'));var utils=require(_0x4891('0x16'));var config=require(_0x4891('0x17'));var licenseUtil=require(_0x4891('0x18'));var db=require(_0x4891('0x19'))['db'];config[_0x4891('0x1a')]=_[_0x4891('0x1b')](config[_0x4891('0x1a')],{'host':_0x4891('0x1c'),'port':0x18eb});var socket=require(_0x4891('0x1d'))(new Redis(config[_0x4891('0x1a')]));require(_0x4891('0x1e'))[_0x4891('0x1f')](socket);function respondWithStatusCode(_0x350862,_0x57abf6){_0x57abf6=_0x57abf6||0xcc;return function(_0x2866ba){if(_0x2866ba){return _0x350862[_0x4891('0x20')](_0x57abf6);}return _0x350862[_0x4891('0x21')](_0x57abf6)[_0x4891('0x22')]();};}function respondWithResult(_0x34413b,_0x4c0a9c){_0x4c0a9c=_0x4c0a9c||0xc8;return function(_0x55b236){if(_0x55b236){return _0x34413b['status'](_0x4c0a9c)[_0x4891('0x23')](_0x55b236);}};}function respondWithFilteredResult(_0xc0c0d0,_0x53f1d3){return function(_0x31afbd){if(_0x31afbd){var _0x3c25f2=_0x31afbd[_0x4891('0x24')],_0x5b3079=_0x53f1d3[_0x4891('0x25')],_0x1c9e2a=_0x53f1d3['offset']+_0x53f1d3['limit'],_0x53579a;if(_0x1c9e2a>=_0x3c25f2){_0x1c9e2a=_0x3c25f2;_0x53579a=0xc8;}else{_0x53579a=0xce;}_0xc0c0d0['status'](_0x53579a);return _0xc0c0d0[_0x4891('0x26')](_0x4891('0x27'),_0x5b3079+'-'+_0x1c9e2a+'/'+_0x3c25f2)[_0x4891('0x23')](_0x31afbd);}return null;};}function patchUpdates(_0x46c2ff){return function(_0x38a7bb){try{jsonpatch[_0x4891('0x28')](_0x38a7bb,_0x46c2ff,!![]);}catch(_0x53e847){return BPromise[_0x4891('0x29')](_0x53e847);}return _0x38a7bb[_0x4891('0x2a')]();};}function saveUpdates(_0x299bae,_0x3795ec){return function(_0x3ac2af){if(_0x3ac2af){return _0x3ac2af['update'](_0x299bae)[_0x4891('0x2b')](function(_0x395cd9){return _0x395cd9;});}return null;};}function removeEntity(_0x434a86,_0xf2ac0a){return function(_0x59ecb5){if(_0x59ecb5){return _0x59ecb5['destroy']()[_0x4891('0x2b')](function(){var _0x3882cb=_0x59ecb5['get']({'plain':!![]});var _0x44ed28=_0x4891('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x44ed28,'resourceId':_0x3882cb['id']}})[_0x4891('0x2b')](function(){return _0x59ecb5;});})[_0x4891('0x2b')](function(){_0x434a86[_0x4891('0x21')](0xcc)[_0x4891('0x22')]();});}};}function handleEntityNotFound(_0x4aa769,_0x183cef){return function(_0x45cb46){if(!_0x45cb46){_0x4aa769[_0x4891('0x20')](0x194);}return _0x45cb46;};}function handleError(_0x571b43,_0x376887){_0x376887=_0x376887||0x1f4;return function(_0x146f04){logger[_0x4891('0x2d')](_0x146f04['stack']);if(_0x146f04['name']){delete _0x146f04[_0x4891('0x2e')];}_0x571b43[_0x4891('0x21')](_0x376887)['send'](_0x146f04);};}exports[_0x4891('0x2f')]=function(_0x1188f4,_0x535e0c){var _0x4b96ac={},_0x252c4e={},_0x36f9af={'count':0x0,'rows':[]};var _0x1277e2=_[_0x4891('0x30')](db['Team'][_0x4891('0x31')],function(_0x3a11dc){return{'name':_0x3a11dc[_0x4891('0x32')],'type':_0x3a11dc[_0x4891('0x33')][_0x4891('0x34')]};});_0x252c4e[_0x4891('0x35')]=_['map'](_0x1277e2,'name');_0x252c4e[_0x4891('0x36')]=_['keys'](_0x1188f4[_0x4891('0x36')]);_0x252c4e[_0x4891('0x37')]=_[_0x4891('0x38')](_0x252c4e['model'],_0x252c4e['query']);_0x4b96ac[_0x4891('0x39')]=_[_0x4891('0x38')](_0x252c4e['model'],qs[_0x4891('0x3a')](_0x1188f4[_0x4891('0x36')][_0x4891('0x3a')]));_0x4b96ac[_0x4891('0x39')]=_0x4b96ac['attributes'][_0x4891('0x3b')]?_0x4b96ac['attributes']:_0x252c4e[_0x4891('0x35')];if(!_0x1188f4[_0x4891('0x36')][_0x4891('0x3c')]('nolimit')){_0x4b96ac['limit']=qs[_0x4891('0x3d')](_0x1188f4[_0x4891('0x36')]['limit']);_0x4b96ac[_0x4891('0x25')]=qs[_0x4891('0x25')](_0x1188f4[_0x4891('0x36')][_0x4891('0x25')]);}_0x4b96ac[_0x4891('0x3e')]=qs[_0x4891('0x3f')](_0x1188f4['query']['sort']);_0x4b96ac[_0x4891('0x40')]=qs[_0x4891('0x37')](_[_0x4891('0x41')](_0x1188f4[_0x4891('0x36')],_0x252c4e[_0x4891('0x37')]),_0x1277e2);if(_0x1188f4[_0x4891('0x36')]['filter']){_0x4b96ac[_0x4891('0x40')]=_[_0x4891('0x42')](_0x4b96ac['where'],{'$or':_[_0x4891('0x30')](_0x1277e2,function(_0xd38911){if(_0xd38911['type']!==_0x4891('0x43')){var _0x198550={};_0x198550[_0xd38911[_0x4891('0x2e')]]={'$like':'%'+_0x1188f4[_0x4891('0x36')][_0x4891('0x44')]+'%'};return _0x198550;}})});}_0x4b96ac=_['merge']({},_0x4b96ac,_0x1188f4[_0x4891('0x45')]);var _0x4db8aa={'where':_0x4b96ac['where']};return db[_0x4891('0x46')][_0x4891('0x24')](_0x4db8aa)['then'](function(_0xac0107){_0x36f9af['count']=_0xac0107;if(_0x1188f4[_0x4891('0x36')]['includeAll']){_0x4b96ac[_0x4891('0x47')]=[{'all':!![]}];}return db['Team']['findAll'](_0x4b96ac);})['then'](function(_0x29dc81){_0x36f9af[_0x4891('0x48')]=_0x29dc81;return _0x36f9af;})['then'](respondWithFilteredResult(_0x535e0c,_0x4b96ac))['catch'](handleError(_0x535e0c,null));};exports['show']=function(_0x5d3a9d,_0x50b131){var _0x10a551={'raw':![],'where':{'id':_0x5d3a9d[_0x4891('0x49')]['id']}},_0x48f837={};_0x48f837[_0x4891('0x35')]=_[_0x4891('0x4a')](db[_0x4891('0x46')][_0x4891('0x31')]);_0x48f837[_0x4891('0x36')]=_[_0x4891('0x4a')](_0x5d3a9d[_0x4891('0x36')]);_0x48f837[_0x4891('0x37')]=_[_0x4891('0x38')](_0x48f837['model'],_0x48f837[_0x4891('0x36')]);_0x10a551[_0x4891('0x39')]=_[_0x4891('0x38')](_0x48f837[_0x4891('0x35')],qs[_0x4891('0x3a')](_0x5d3a9d['query'][_0x4891('0x3a')]));_0x10a551[_0x4891('0x39')]=_0x10a551[_0x4891('0x39')]['length']?_0x10a551[_0x4891('0x39')]:_0x48f837[_0x4891('0x35')];if(_0x5d3a9d[_0x4891('0x36')][_0x4891('0x4b')]){_0x10a551[_0x4891('0x47')]=[{'all':!![]}];}_0x10a551=_[_0x4891('0x42')]({},_0x10a551,_0x5d3a9d[_0x4891('0x45')]);return db[_0x4891('0x46')][_0x4891('0x4c')](_0x10a551)['then'](handleEntityNotFound(_0x50b131,null))[_0x4891('0x2b')](respondWithResult(_0x50b131,null))[_0x4891('0x4d')](handleError(_0x50b131,null));};exports['create']=function(_0xb019a5,_0x2a8292){return db[_0x4891('0x46')][_0x4891('0x4e')](_0xb019a5[_0x4891('0x4f')],{})['then'](function(_0x3f417){var _0x368322=_0xb019a5[_0x4891('0x50')]['get']({'plain':!![]});if(!_0x368322)throw new Error(_0x4891('0x51'));if(_0x368322['role']===_0x4891('0x50')){var _0x4cfbfa=_0x3f417[_0x4891('0x52')]({'plain':!![]});var _0x39bfba='Teams';return db[_0x4891('0x53')][_0x4891('0x4c')]({'where':{'name':_0x39bfba,'userProfileId':_0x368322[_0x4891('0x54')]},'raw':!![]})[_0x4891('0x2b')](function(_0x277741){if(_0x277741&&_0x277741['autoAssociation']===0x0){return db['UserProfileResource'][_0x4891('0x4e')]({'name':_0x4cfbfa[_0x4891('0x2e')],'resourceId':_0x4cfbfa['id'],'type':_0x277741[_0x4891('0x2e')],'sectionId':_0x277741['id']},{})[_0x4891('0x2b')](function(){return _0x3f417;});}else{return _0x3f417;}})[_0x4891('0x4d')](function(_0x49a444){logger[_0x4891('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a444);throw _0x49a444;});}return _0x3f417;})[_0x4891('0x2b')](respondWithResult(_0x2a8292,0xc9))[_0x4891('0x4d')](handleError(_0x2a8292,null));};exports[_0x4891('0x55')]=function(_0x2fc60f,_0x25b368){if(_0x2fc60f['body']['id']){delete _0x2fc60f[_0x4891('0x4f')]['id'];}return db[_0x4891('0x46')]['find']({'where':{'id':_0x2fc60f['params']['id']}})['then'](handleEntityNotFound(_0x25b368,null))[_0x4891('0x2b')](saveUpdates(_0x2fc60f[_0x4891('0x4f')],null))[_0x4891('0x2b')](respondWithResult(_0x25b368,null))[_0x4891('0x4d')](handleError(_0x25b368,null));};exports[_0x4891('0x56')]=function(_0x3aa700,_0x1b4a33){return db[_0x4891('0x46')][_0x4891('0x4c')]({'where':{'id':_0x3aa700[_0x4891('0x49')]['id']}})[_0x4891('0x2b')](handleEntityNotFound(_0x1b4a33,null))[_0x4891('0x2b')](removeEntity(_0x1b4a33,null))[_0x4891('0x4d')](handleError(_0x1b4a33,null));};exports['getQueues']=function(_0x4ea78c,_0x2b5ee4,_0x45d963){return db[_0x4891('0x46')][_0x4891('0x57')]({'where':{'id':_0x4ea78c[_0x4891('0x49')]['id']}})[_0x4891('0x2b')](handleEntityNotFound(_0x2b5ee4,null))[_0x4891('0x2b')](function(_0x4f6ae9){if(!_0x4ea78c['query'][_0x4891('0x58')]||!utils[_0x4891('0x59')](_0x4ea78c[_0x4891('0x36')][_0x4891('0x58')])){throw new db[(_0x4891('0x5a'))][(_0x4891('0x5b'))]('Unknown\x20channel');}var _0x1b9981={};var _0x2630a={};_0x2630a[_0x4891('0x35')]=_[_0x4891('0x4a')](db[_['capitalize'](_0x4ea78c[_0x4891('0x36')][_0x4891('0x58')]['toLowerCase']())+_0x4891('0x5c')]['rawAttributes']);_0x2630a[_0x4891('0x36')]=_['keys'](_0x4ea78c[_0x4891('0x36')]);_0x2630a[_0x4891('0x37')]=_[_0x4891('0x38')](_0x2630a[_0x4891('0x35')],_0x2630a[_0x4891('0x36')]);_0x1b9981[_0x4891('0x39')]=_[_0x4891('0x38')](_0x2630a[_0x4891('0x35')],qs['fields'](_0x4ea78c[_0x4891('0x36')]['fields']));_0x1b9981[_0x4891('0x39')]=_0x1b9981[_0x4891('0x39')][_0x4891('0x3b')]?_0x1b9981['attributes']:_0x2630a[_0x4891('0x35')];_0x1b9981['limit']=qs['limit'](_0x4ea78c[_0x4891('0x36')][_0x4891('0x3d')]);_0x1b9981[_0x4891('0x25')]=qs[_0x4891('0x25')](_0x4ea78c['query'][_0x4891('0x25')]);_0x1b9981[_0x4891('0x3e')]=qs[_0x4891('0x3f')](_0x4ea78c[_0x4891('0x36')]['sort']);_0x1b9981[_0x4891('0x40')]=qs[_0x4891('0x37')](_[_0x4891('0x41')](_0x4ea78c[_0x4891('0x36')],_0x2630a[_0x4891('0x37')]));_0x1b9981=_[_0x4891('0x42')]({},_0x1b9981,_0x4ea78c[_0x4891('0x45')]);return _0x4f6ae9[_0x4891('0x52')+_[_0x4891('0x5d')](_0x4ea78c[_0x4891('0x36')][_0x4891('0x58')][_0x4891('0x5e')]())+_0x4891('0x5f')](_0x1b9981);})[_0x4891('0x2b')](respondWithResult(_0x2b5ee4,null))[_0x4891('0x4d')](handleError(_0x2b5ee4,null));};exports[_0x4891('0x60')]=function(_0x34ad4d,_0x1aebd1,_0x51b4fc){return db[_0x4891('0x46')][_0x4891('0x57')]({'where':{'id':_0x34ad4d[_0x4891('0x49')]['id']}})[_0x4891('0x2b')](function(_0x837c10){if(_0x837c10){if(!_0x34ad4d[_0x4891('0x4f')][_0x4891('0x58')]||!utils[_0x4891('0x59')](_0x34ad4d[_0x4891('0x4f')][_0x4891('0x58')])){throw new db[(_0x4891('0x5a'))][(_0x4891('0x5b'))](_0x4891('0x61'));}return _0x837c10[_0x4891('0x62')+_[_0x4891('0x5d')](_0x34ad4d[_0x4891('0x4f')][_0x4891('0x58')][_0x4891('0x5e')]())+_0x4891('0x5f')](_0x34ad4d[_0x4891('0x4f')]['ids']);}return null;})[_0x4891('0x2b')](handleEntityNotFound(_0x1aebd1,null))[_0x4891('0x2b')](respondWithStatusCode(_0x1aebd1,null))[_0x4891('0x4d')](handleError(_0x1aebd1,null));};exports[_0x4891('0x63')]=function(_0xed31ff,_0x4432c5,_0x2c7fef){return db[_0x4891('0x46')][_0x4891('0x57')]({'where':{'id':_0xed31ff[_0x4891('0x49')]['id']}})[_0x4891('0x2b')](function(_0x538f48){if(_0x538f48){if(!_0xed31ff[_0x4891('0x36')]['channel']||!utils['isValidChannel'](_0xed31ff[_0x4891('0x36')][_0x4891('0x58')])){throw new db[(_0x4891('0x5a'))][(_0x4891('0x5b'))](_0x4891('0x61'));}return _0x538f48[_0x4891('0x64')+_[_0x4891('0x5d')](_0xed31ff[_0x4891('0x36')][_0x4891('0x58')][_0x4891('0x5e')]())+_0x4891('0x5f')](_0xed31ff[_0x4891('0x36')][_0x4891('0x65')]);}return null;})[_0x4891('0x2b')](handleEntityNotFound(_0x4432c5,null))[_0x4891('0x2b')](respondWithStatusCode(_0x4432c5,null))[_0x4891('0x4d')](handleError(_0x4432c5,null));};exports['addAgents']=function(_0x4bb675,_0x4362c2,_0x13cf0a){return db[_0x4891('0x46')][_0x4891('0x4c')]({'where':{'id':_0x4bb675[_0x4891('0x49')]['id']}})[_0x4891('0x2b')](handleEntityNotFound(_0x4362c2,null))[_0x4891('0x2b')](function(_0x16450a){if(_0x16450a){var _0x3345ad=[_0x4891('0x66'),'Chat',_0x4891('0x67'),'Sms',_0x4891('0x68'),'Openchannel',_0x4891('0x69')];return BPromise['each'](_0x3345ad,function(_0x34a2e5){return _0x16450a[_0x4891('0x52')+_0x34a2e5+_0x4891('0x5f')]({'attributes':['id',_0x4891('0x2e')]})[_0x4891('0x2b')](function(_0x3eb83b){return BPromise[_0x4891('0x6a')](_0x3eb83b,function(_0xe53216){return _0xe53216['addAgents'](_0x4bb675[_0x4891('0x4f')][_0x4891('0x65')])['then'](function(){if(_0x34a2e5===_0x4891('0x66')){return db[_0x4891('0x6b')][_0x4891('0x6c')]({'where':{'id':_0x4bb675[_0x4891('0x4f')][_0x4891('0x65')]},'attributes':['id',_0x4891('0x2e'),_0x4891('0x6d'),_0x4891('0x6e'),'interface'],'raw':!![]})['then'](function(_0x9c244b){return BPromise[_0x4891('0x6a')](_[_0x4891('0x44')](_0x9c244b,{'online':0x1}),function(_0x70b1fc){return db['UserVoiceQueueRt'][_0x4891('0x6f')]({'membername':_0x70b1fc[_0x4891('0x2e')],'UserId':_0x70b1fc['id'],'queue_name':_0xe53216[_0x4891('0x2e')],'VoiceQueueId':_0xe53216['id'],'interface':_['isNil'](_0x70b1fc['interface'])?util[_0x4891('0x70')](_0x4891('0x71'),_0x70b1fc[_0x4891('0x2e')]):_0x70b1fc[_0x4891('0x72')],'paused':_0x70b1fc['voicePause']||![],'penalty':0x0});});});}});});})[_0x4891('0x2b')](function(){return _0x16450a;});})[_0x4891('0x2b')](function(){return _0x16450a;});}})['then'](function(_0x127b56){if(_0x127b56){return _0x127b56['addAgents'](_0x4bb675[_0x4891('0x4f')][_0x4891('0x65')],_[_0x4891('0x73')](_0x4bb675[_0x4891('0x4f')],[_0x4891('0x65'),'id'])||{})[_0x4891('0x74')](function(_0x45245a){for(var _0x565997=0x0;_0x565997<_0x4bb675[_0x4891('0x4f')][_0x4891('0x65')][_0x4891('0x3b')];_0x565997+=0x1){socket[_0x4891('0x75')](_0x4891('0x76'),{'UserId':_0x4bb675['body'][_0x4891('0x65')][_0x565997],'TeamId':_0x4bb675[_0x4891('0x49')]['id']});}return _0x45245a;});}})[_0x4891('0x2b')](respondWithResult(_0x4362c2,null))[_0x4891('0x4d')](handleError(_0x4362c2,null));};exports[_0x4891('0x77')]=function(_0x45ae6a,_0x2a1110,_0x3446da){return db[_0x4891('0x46')][_0x4891('0x4c')]({'where':{'id':_0x45ae6a[_0x4891('0x49')]['id']}})[_0x4891('0x2b')](handleEntityNotFound(_0x2a1110,null))[_0x4891('0x2b')](function(_0x38a590){if(_0x38a590){return BPromise['each'](['voice',_0x4891('0x78'),_0x4891('0x79'),_0x4891('0x7a'),_0x4891('0x7b'),_0x4891('0x7c'),'whatsapp'],function(_0x4f6294){return _0x38a590[_0x4891('0x52')+_['capitalize'](_0x4f6294)+_0x4891('0x5f')]({'attributes':['id',_0x4891('0x2e')]})[_0x4891('0x2b')](function(_0xfe24ed){return BPromise[_0x4891('0x6a')](_0xfe24ed,function(_0x18ea8c){return _0x18ea8c[_0x4891('0x77')](_0x45ae6a[_0x4891('0x36')][_0x4891('0x65')])[_0x4891('0x2b')](function(){if(_0x4f6294===_0x4891('0x7d')){return db['UserVoiceQueueRt'][_0x4891('0x56')]({'where':{'VoiceQueueId':_0x18ea8c['id'],'UserId':_0x45ae6a[_0x4891('0x36')][_0x4891('0x65')]}});}});});})[_0x4891('0x2b')](function(){return _0x38a590;});})[_0x4891('0x2b')](function(){return _0x38a590;});}})[_0x4891('0x2b')](function(_0x322b90){if(_0x322b90){return _0x322b90[_0x4891('0x77')](_0x45ae6a[_0x4891('0x36')][_0x4891('0x65')])['then'](function(){if(_[_0x4891('0x7e')](_0x45ae6a[_0x4891('0x36')][_0x4891('0x65')])){for(var _0x35f47c=0x0;_0x35f47c<_0x45ae6a[_0x4891('0x36')][_0x4891('0x65')]['length'];_0x35f47c+=0x1){socket[_0x4891('0x75')](_0x4891('0x7f'),{'UserId':Number(_0x45ae6a['query'][_0x4891('0x65')][_0x35f47c]),'TeamId':Number(_0x45ae6a[_0x4891('0x49')]['id'])});}}else{socket[_0x4891('0x75')](_0x4891('0x7f'),{'UserId':Number(_0x45ae6a[_0x4891('0x36')][_0x4891('0x65')]),'TeamId':Number(_0x45ae6a[_0x4891('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a1110,null))['catch'](handleError(_0x2a1110,null));};exports[_0x4891('0x80')]=function(_0x39ad59,_0x18333b,_0xfb365f){var _0x3c6966={};var _0x52f366={};var _0x4f29e9;var _0x4b5829;return db['Team'][_0x4891('0x57')]({'where':{'id':_0x39ad59['params']['id']}})['then'](handleEntityNotFound(_0x18333b,null))['then'](function(_0x12a599){if(_0x12a599){_0x4f29e9=_0x12a599;_0x52f366[_0x4891('0x35')]=_[_0x4891('0x4a')](db[_0x4891('0x6b')][_0x4891('0x31')]);_0x52f366[_0x4891('0x36')]=_[_0x4891('0x4a')](_0x39ad59[_0x4891('0x36')]);_0x52f366['filters']=_[_0x4891('0x38')](_0x52f366[_0x4891('0x35')],_0x52f366[_0x4891('0x36')]);_0x3c6966[_0x4891('0x39')]=_['intersection'](_0x52f366['model'],qs[_0x4891('0x3a')](_0x39ad59[_0x4891('0x36')][_0x4891('0x3a')]));_0x3c6966[_0x4891('0x39')]=_0x3c6966[_0x4891('0x39')][_0x4891('0x3b')]?_0x3c6966[_0x4891('0x39')]:_0x52f366[_0x4891('0x35')];_0x3c6966['order']=qs[_0x4891('0x3f')](_0x39ad59['query'][_0x4891('0x3f')]);_0x3c6966[_0x4891('0x40')]=qs[_0x4891('0x37')](_[_0x4891('0x41')](_0x39ad59[_0x4891('0x36')],_0x52f366[_0x4891('0x37')]));if(_0x39ad59[_0x4891('0x36')][_0x4891('0x44')]){_0x3c6966[_0x4891('0x40')]=_[_0x4891('0x42')](_0x3c6966['where'],{'$or':_[_0x4891('0x30')](_0x3c6966['attributes'],function(_0x2a0da7){var _0xdced9={};_0xdced9[_0x2a0da7]={'$like':'%'+_0x39ad59['query'][_0x4891('0x44')]+'%'};return _0xdced9;})});}_0x3c6966=_[_0x4891('0x42')]({},_0x3c6966,_0x39ad59[_0x4891('0x45')]);return _0x4f29e9[_0x4891('0x80')](_0x3c6966);}})[_0x4891('0x2b')](function(_0x455d62){if(_0x455d62){_0x4b5829=_0x455d62[_0x4891('0x3b')];if(!_0x39ad59[_0x4891('0x36')][_0x4891('0x3c')](_0x4891('0x81'))){_0x3c6966['limit']=qs[_0x4891('0x3d')](_0x39ad59['query'][_0x4891('0x3d')]);_0x3c6966[_0x4891('0x25')]=qs[_0x4891('0x25')](_0x39ad59[_0x4891('0x36')][_0x4891('0x25')]);}return _0x4f29e9[_0x4891('0x80')](_0x3c6966);}})['then'](function(_0x3738af){if(_0x3738af){return _0x3738af?{'count':_0x4b5829,'rows':_0x3738af}:null;}})[_0x4891('0x2b')](respondWithResult(_0x18333b,null))[_0x4891('0x4d')](handleError(_0x18333b,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index b93f093..a022d6c 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 _0x86e7=['../../mysqldb','Team','setMaxListeners','save','update','emit','hook','exports','events'];(function(_0x4379e1,_0x751b8b){var _0x1d490a=function(_0x22b464){while(--_0x22b464){_0x4379e1['push'](_0x4379e1['shift']());}};_0x1d490a(++_0x751b8b);}(_0x86e7,0xfb));var _0x786e=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0x86e7[_0x3ce2c4];return _0x4047c1;};'use strict';var EventEmitter=require(_0x786e('0x0'));var Team=require(_0x786e('0x1'))['db'][_0x786e('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x786e('0x3')](0x0);var events={'afterCreate':_0x786e('0x4'),'afterUpdate':_0x786e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x41f651){return function(_0x192762,_0x25c41c,_0x578a10){TeamEvents[_0x786e('0x6')](_0x41f651+':'+_0x192762['id'],_0x192762);TeamEvents[_0x786e('0x6')](_0x41f651,_0x192762);_0x578a10(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x786e('0x7')](e,emitEvent(event));}}module[_0x786e('0x8')]=TeamEvents; \ No newline at end of file +var _0x3399=['setMaxListeners','save','update','emit','hasOwnProperty','hook','../../mysqldb','Team'];(function(_0x4fbb4d,_0x2914eb){var _0x1818c0=function(_0x2f1ff0){while(--_0x2f1ff0){_0x4fbb4d['push'](_0x4fbb4d['shift']());}};_0x1818c0(++_0x2914eb);}(_0x3399,0x126));var _0x9339=function(_0x1dc8dc,_0x384acb){_0x1dc8dc=_0x1dc8dc-0x0;var _0x9b6337=_0x3399[_0x1dc8dc];return _0x9b6337;};'use strict';var EventEmitter=require('events');var Team=require(_0x9339('0x0'))['db'][_0x9339('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x9339('0x2')](0x0);var events={'afterCreate':_0x9339('0x3'),'afterUpdate':_0x9339('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1f5f84){return function(_0x56bae3,_0xb0a86,_0xac01b4){TeamEvents[_0x9339('0x5')](_0x1f5f84+':'+_0x56bae3['id'],_0x56bae3);TeamEvents['emit'](_0x1f5f84,_0x56bae3);_0xac01b4(null);};}for(var e in events){if(events[_0x9339('0x6')](e)){var event=events[e];Team[_0x9339('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index faceada..a183915 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 _0x513f=['lodash','util','../../config/logger','api','moment','bluebird','path','./team.attributes','exports','define','Team','teams'];(function(_0x2af689,_0x25b2bf){var _0x105b05=function(_0x4870f2){while(--_0x4870f2){_0x2af689['push'](_0x2af689['shift']());}};_0x105b05(++_0x25b2bf);}(_0x513f,0xc0));var _0xf513=function(_0x343b86,_0x570a2e){_0x343b86=_0x343b86-0x0;var _0x18ec41=_0x513f[_0x343b86];return _0x18ec41;};'use strict';var _=require(_0xf513('0x0'));var util=require(_0xf513('0x1'));var logger=require(_0xf513('0x2'))(_0xf513('0x3'));var moment=require(_0xf513('0x4'));var BPromise=require(_0xf513('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf513('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf513('0x7'));module[_0xf513('0x8')]=function(_0x32c77e,_0x461dcc){return _0x32c77e[_0xf513('0x9')](_0xf513('0xa'),attributes,{'tableName':_0xf513('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54bf=['util','../../config/logger','api','request-promise','rimraf','./team.attributes','exports','Team','teams'];(function(_0x456af7,_0x3d36d3){var _0x3818f7=function(_0x2e7ca1){while(--_0x2e7ca1){_0x456af7['push'](_0x456af7['shift']());}};_0x3818f7(++_0x3d36d3);}(_0x54bf,0x1e6));var _0xf54b=function(_0x4c8026,_0x41bff9){_0x4c8026=_0x4c8026-0x0;var _0x202724=_0x54bf[_0x4c8026];return _0x202724;};'use strict';var _=require('lodash');var util=require(_0xf54b('0x0'));var logger=require(_0xf54b('0x1'))(_0xf54b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf54b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf54b('0x4'));var config=require('../../config/environment');var attributes=require(_0xf54b('0x5'));module[_0xf54b('0x6')]=function(_0x3a4e53,_0x489e9e){return _0x3a4e53['define'](_0xf54b('0x7'),attributes,{'tableName':_0xf54b('0x8'),'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 6a122dc..3b82440 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 _0x1b18=['message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./team.socket','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x1f5fa9,_0x5cec46){var _0x3cb6e0=function(_0x5f0b49){while(--_0x5f0b49){_0x1f5fa9['push'](_0x1f5fa9['shift']());}};_0x3cb6e0(++_0x5cec46);}(_0x1b18,0xc9));var _0x81b1=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x1b18[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x81b1('0x0'));var util=require(_0x81b1('0x1'));var moment=require(_0x81b1('0x2'));var BPromise=require(_0x81b1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x81b1('0x4'));var db=require(_0x81b1('0x5'))['db'];var utils=require(_0x81b1('0x6'));var logger=require(_0x81b1('0x7'))(_0x81b1('0x8'));var config=require(_0x81b1('0x9'));var jayson=require(_0x81b1('0xa'));var client=jayson['client'][_0x81b1('0xb')]({'port':0x232a});config[_0x81b1('0xc')]=_[_0x81b1('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x81b1('0xe'))(new Redis(config[_0x81b1('0xc')]));require(_0x81b1('0xf'))['register'](socket);function respondWithRpcPromise(_0x218101,_0x26b01c,_0x58a74c){return new BPromise(function(_0x5b2242,_0x580858){return client[_0x81b1('0x10')](_0x218101,_0x58a74c)[_0x81b1('0x11')](function(_0x11f19d){logger[_0x81b1('0x12')](_0x81b1('0x13'),_0x26b01c,_0x81b1('0x14'));logger[_0x81b1('0x15')]('Team,\x20%s,\x20%s,\x20%s',_0x26b01c,_0x81b1('0x14'),JSON['stringify'](_0x11f19d));if(_0x11f19d[_0x81b1('0x16')]){if(_0x11f19d[_0x81b1('0x16')][_0x81b1('0x17')]===0x1f4){logger[_0x81b1('0x16')](_0x81b1('0x13'),_0x26b01c,_0x11f19d[_0x81b1('0x16')][_0x81b1('0x18')]);return _0x580858(_0x11f19d[_0x81b1('0x16')]['message']);}logger[_0x81b1('0x16')](_0x81b1('0x13'),_0x26b01c,_0x11f19d[_0x81b1('0x16')][_0x81b1('0x18')]);return _0x5b2242(_0x11f19d[_0x81b1('0x16')][_0x81b1('0x18')]);}else{logger[_0x81b1('0x12')](_0x81b1('0x13'),_0x26b01c,_0x81b1('0x14'));_0x5b2242(_0x11f19d['result'][_0x81b1('0x18')]);}})['catch'](function(_0x1de85a){logger[_0x81b1('0x16')](_0x81b1('0x13'),_0x26b01c,_0x1de85a);_0x580858(_0x1de85a);});});} \ No newline at end of file +var _0xb5fe=['Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info'];(function(_0x2c3a8f,_0x374e56){var _0x189412=function(_0x560055){while(--_0x560055){_0x2c3a8f['push'](_0x2c3a8f['shift']());}};_0x189412(++_0x374e56);}(_0xb5fe,0x166));var _0xeb5f=function(_0x195643,_0x5ae288){_0x195643=_0x195643-0x0;var _0x3cf997=_0xb5fe[_0x195643];return _0x3cf997;};'use strict';var _=require('lodash');var util=require(_0xeb5f('0x0'));var moment=require(_0xeb5f('0x1'));var BPromise=require(_0xeb5f('0x2'));var rs=require(_0xeb5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb5f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xeb5f('0x5'))('rpc');var config=require(_0xeb5f('0x6'));var jayson=require(_0xeb5f('0x7'));var client=jayson[_0xeb5f('0x8')][_0xeb5f('0x9')]({'port':0x232a});config[_0xeb5f('0xa')]=_[_0xeb5f('0xb')](config[_0xeb5f('0xa')],{'host':_0xeb5f('0xc'),'port':0x18eb});var socket=require(_0xeb5f('0xd'))(new Redis(config[_0xeb5f('0xa')]));require(_0xeb5f('0xe'))[_0xeb5f('0xf')](socket);function respondWithRpcPromise(_0x42adf8,_0x146324,_0x544f65){return new BPromise(function(_0x1a9c75,_0xa96be2){return client[_0xeb5f('0x10')](_0x42adf8,_0x544f65)[_0xeb5f('0x11')](function(_0x17c1b0){logger[_0xeb5f('0x12')](_0xeb5f('0x13'),_0x146324,_0xeb5f('0x14'));logger[_0xeb5f('0x15')](_0xeb5f('0x16'),_0x146324,_0xeb5f('0x14'),JSON[_0xeb5f('0x17')](_0x17c1b0));if(_0x17c1b0[_0xeb5f('0x18')]){if(_0x17c1b0[_0xeb5f('0x18')][_0xeb5f('0x19')]===0x1f4){logger[_0xeb5f('0x18')](_0xeb5f('0x13'),_0x146324,_0x17c1b0[_0xeb5f('0x18')][_0xeb5f('0x1a')]);return _0xa96be2(_0x17c1b0[_0xeb5f('0x18')][_0xeb5f('0x1a')]);}logger[_0xeb5f('0x18')](_0xeb5f('0x13'),_0x146324,_0x17c1b0[_0xeb5f('0x18')][_0xeb5f('0x1a')]);return _0x1a9c75(_0x17c1b0[_0xeb5f('0x18')][_0xeb5f('0x1a')]);}else{logger['info'](_0xeb5f('0x13'),_0x146324,_0xeb5f('0x14'));_0x1a9c75(_0x17c1b0[_0xeb5f('0x1b')]['message']);}})[_0xeb5f('0x1c')](function(_0x222109){logger[_0xeb5f('0x18')](_0xeb5f('0x13'),_0x146324,_0x222109);_0xa96be2(_0x222109);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 5acce92..2664c90 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 _0x06ae=['length','save','remove','update','emit'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0x06ae,0x16e));var _0xe06a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x06ae[_0xa464c9];return _0x3d73c4;};'use strict';var TeamEvents=require('./team.events');var events=[_0xe06a('0x0'),_0xe06a('0x1'),_0xe06a('0x2')];function createListener(_0x2f7d69,_0xbfddd7){return function(_0x145ff8){_0xbfddd7[_0xe06a('0x3')](_0x2f7d69,_0x145ff8);};}function removeListener(_0x1d695f,_0x1e7706){return function(){TeamEvents['removeListener'](_0x1d695f,_0x1e7706);};}exports['register']=function(_0x50e6cf){for(var _0x1df79f=0x0,_0x745f79=events[_0xe06a('0x4')];_0x1df79f<_0x745f79;_0x1df79f++){var _0x3dfa60=events[_0x1df79f];var _0x1ea66c=createListener('team:'+_0x3dfa60,_0x50e6cf);TeamEvents['on'](_0x3dfa60,_0x1ea66c);}}; \ No newline at end of file +var _0xd0c9=['team:','./team.events','save','emit','length'];(function(_0x4d7f00,_0x14717c){var _0x4f5e58=function(_0xa12f15){while(--_0xa12f15){_0x4d7f00['push'](_0x4d7f00['shift']());}};_0x4f5e58(++_0x14717c);}(_0xd0c9,0xe2));var _0x9d0c=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0xd0c9[_0x11c573];return _0x6b72de;};'use strict';var TeamEvents=require(_0x9d0c('0x0'));var events=[_0x9d0c('0x1'),'remove','update'];function createListener(_0x5d3eb1,_0x154c38){return function(_0x2eff0e){_0x154c38[_0x9d0c('0x2')](_0x5d3eb1,_0x2eff0e);};}function removeListener(_0x5922f1,_0x3b4b50){return function(){TeamEvents['removeListener'](_0x5922f1,_0x3b4b50);};}exports['register']=function(_0x6749){for(var _0x5bcaf9=0x0,_0x3eec5f=events[_0x9d0c('0x3')];_0x5bcaf9<_0x3eec5f;_0x5bcaf9++){var _0x308d9e=events[_0x5bcaf9];var _0x413a70=createListener(_0x9d0c('0x4')+_0x308d9e,_0x6749);TeamEvents['on'](_0x308d9e,_0x413a70);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index ecf1ecc..54e3fcf 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 _0xf895=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./template.controller','isAuthenticated','get','/:id','post','create'];(function(_0xcd4c5b,_0x2152b6){var _0x17d55e=function(_0x4ec8db){while(--_0x4ec8db){_0xcd4c5b['push'](_0xcd4c5b['shift']());}};_0x17d55e(++_0x2152b6);}(_0xf895,0x1e1));var _0x5f89=function(_0x1bf29f,_0x33cb02){_0x1bf29f=_0x1bf29f-0x0;var _0x4aa579=_0xf895[_0x1bf29f];return _0x4aa579;};'use strict';var multer=require(_0x5f89('0x0'));var util=require('util');var path=require(_0x5f89('0x1'));var timeout=require(_0x5f89('0x2'));var express=require(_0x5f89('0x3'));var router=express['Router']();var auth=require(_0x5f89('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5f89('0x5'));var controller=require(_0x5f89('0x6'));router['get']('/',auth[_0x5f89('0x7')](),controller['index']);router[_0x5f89('0x8')](_0x5f89('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x5f89('0xa')]('/',auth[_0x5f89('0x7')](),controller[_0x5f89('0xb')]);router[_0x5f89('0xc')]('/:id',auth[_0x5f89('0x7')](),controller[_0x5f89('0xd')]);router[_0x5f89('0xe')](_0x5f89('0x9'),auth[_0x5f89('0x7')](),controller[_0x5f89('0xf')]);module[_0x5f89('0x10')]=router; \ No newline at end of file +var _0x401c=['index','/:id','post','create','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x401c,0x172));var _0xc401=function(_0x4f1da5,_0x4ced17){_0x4f1da5=_0x4f1da5-0x0;var _0xe972a8=_0x401c[_0x4f1da5];return _0xe972a8;};'use strict';var multer=require(_0xc401('0x0'));var util=require('util');var path=require(_0xc401('0x1'));var timeout=require('connect-timeout');var express=require(_0xc401('0x2'));var router=express[_0xc401('0x3')]();var auth=require(_0xc401('0x4'));var interaction=require(_0xc401('0x5'));var config=require(_0xc401('0x6'));var controller=require(_0xc401('0x7'));router[_0xc401('0x8')]('/',auth[_0xc401('0x9')](),controller[_0xc401('0xa')]);router[_0xc401('0x8')](_0xc401('0xb'),auth[_0xc401('0x9')](),controller['show']);router[_0xc401('0xc')]('/',auth[_0xc401('0x9')](),controller[_0xc401('0xd')]);router[_0xc401('0xe')](_0xc401('0xb'),auth[_0xc401('0x9')](),controller[_0xc401('0xf')]);router[_0xc401('0x10')](_0xc401('0xb'),auth[_0xc401('0x9')](),controller[_0xc401('0x11')]);module[_0xc401('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 3bb25d9..9ca6014 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 _0x33a8=['STRING','TEXT','exports'];(function(_0x40cbbc,_0x56a82f){var _0x9c166d=function(_0x14fd0f){while(--_0x14fd0f){_0x40cbbc['push'](_0x40cbbc['shift']());}};_0x9c166d(++_0x56a82f);}(_0x33a8,0x1a0));var _0x833a=function(_0x26939f,_0x135815){_0x26939f=_0x26939f-0x0;var _0x3197dd=_0x33a8[_0x26939f];return _0x3197dd;};'use strict';var Sequelize=require('sequelize');module[_0x833a('0x0')]={'name':{'type':Sequelize[_0x833a('0x1')]},'description':{'type':Sequelize[_0x833a('0x1')]},'html':{'type':Sequelize[_0x833a('0x2')]}}; \ No newline at end of file +var _0xc220=['TEXT','STRING'];(function(_0x3c2e0c,_0x62ca5f){var _0xa67634=function(_0x7fe4b5){while(--_0x7fe4b5){_0x3c2e0c['push'](_0x3c2e0c['shift']());}};_0xa67634(++_0x62ca5f);}(_0xc220,0x1af));var _0x0c22=function(_0x1bf9da,_0x2c63f0){_0x1bf9da=_0x1bf9da-0x0;var _0x36df12=_0xc220[_0x1bf9da];return _0x36df12;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0c22('0x0')]},'description':{'type':Sequelize[_0x0c22('0x0')]},'html':{'type':Sequelize[_0x0c22('0x1')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 5fefabf..cc273e0 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 _0x7a54=['fields','attributes','nolimit','order','sort','where','filters','pick','merge','options','count','includeAll','include','findAll','catch','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','Template','rawAttributes','type','key','model','map','keys','query','intersection'];(function(_0x7e3412,_0x2656be){var _0x395335=function(_0x44f719){while(--_0x44f719){_0x7e3412['push'](_0x7e3412['shift']());}};_0x395335(++_0x2656be);}(_0x7a54,0x106));var _0x47a5=function(_0x4c1d0a,_0x3e5fe4){_0x4c1d0a=_0x4c1d0a-0x0;var _0xeb2217=_0x7a54[_0x4c1d0a];return _0xeb2217;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=_0x11faf5['count'],_0x2a2cbb=_0x362359[_0x47a5('0x1a')],_0x1ef44c=_0x362359['offset']+_0x362359['limit'],_0x574af6;if(_0x1ef44c>=_0x3b001e){_0x1ef44c=_0x3b001e;_0x574af6=0xc8;}else{_0x574af6=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x574af6);return _0x4e99a8[_0x47a5('0x1b')](_0x47a5('0x1c'),_0x2a2cbb+'-'+_0x1ef44c+'/'+_0x3b001e)[_0x47a5('0x19')](_0x11faf5);}return null;};}function patchUpdates(_0x477b1d){return function(_0x12b98e){try{jsonpatch[_0x47a5('0x1d')](_0x12b98e,_0x477b1d,!![]);}catch(_0xe3c618){return BPromise[_0x47a5('0x1e')](_0xe3c618);}return _0x12b98e['save']();};}function saveUpdates(_0x1570bc,_0xf160ba){return function(_0x47cf3c){if(_0x47cf3c){return _0x47cf3c[_0x47a5('0x1f')](_0x1570bc)[_0x47a5('0x20')](function(_0x36874d){return _0x36874d;});}return null;};}function removeEntity(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x21')]()[_0x47a5('0x20')](function(){var _0x5ef1b1=_0x2f142b[_0x47a5('0x22')]({'plain':!![]});var _0x385687='Templates';return db[_0x47a5('0x23')][_0x47a5('0x21')]({'where':{'type':_0x385687,'resourceId':_0x5ef1b1['id']}})[_0x47a5('0x20')](function(){return _0x2f142b;});})[_0x47a5('0x20')](function(){_0x4c5910[_0x47a5('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53078a,_0x136745){return function(_0x5686db){if(!_0x5686db){_0x53078a[_0x47a5('0x16')](0x194);}return _0x5686db;};}function handleError(_0x5b6c4e,_0x23cb77){_0x23cb77=_0x23cb77||0x1f4;return function(_0x378208){logger[_0x47a5('0x24')](_0x378208[_0x47a5('0x25')]);if(_0x378208[_0x47a5('0x26')]){delete _0x378208[_0x47a5('0x26')];}_0x5b6c4e[_0x47a5('0x17')](_0x23cb77)[_0x47a5('0x27')](_0x378208);};}exports[_0x47a5('0x28')]=function(_0x361bfa,_0x1127f8){var _0x11a4fa={},_0x3ad507={},_0x528582={'count':0x0,'rows':[]};var _0x243210=_['map'](db[_0x47a5('0x29')][_0x47a5('0x2a')],function(_0x16901f){return{'name':_0x16901f['fieldName'],'type':_0x16901f[_0x47a5('0x2b')][_0x47a5('0x2c')]};});_0x3ad507[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x243210,'name');_0x3ad507['query']=_[_0x47a5('0x2f')](_0x361bfa[_0x47a5('0x30')]);_0x3ad507['filters']=_['intersection'](_0x3ad507[_0x47a5('0x2d')],_0x3ad507[_0x47a5('0x30')]);_0x11a4fa['attributes']=_[_0x47a5('0x31')](_0x3ad507['model'],qs[_0x47a5('0x32')](_0x361bfa[_0x47a5('0x30')]['fields']));_0x11a4fa['attributes']=_0x11a4fa[_0x47a5('0x33')]['length']?_0x11a4fa[_0x47a5('0x33')]:_0x3ad507[_0x47a5('0x2d')];if(!_0x361bfa[_0x47a5('0x30')]['hasOwnProperty'](_0x47a5('0x34'))){_0x11a4fa['limit']=qs['limit'](_0x361bfa[_0x47a5('0x30')]['limit']);_0x11a4fa[_0x47a5('0x1a')]=qs['offset'](_0x361bfa[_0x47a5('0x30')][_0x47a5('0x1a')]);}_0x11a4fa[_0x47a5('0x35')]=qs[_0x47a5('0x36')](_0x361bfa[_0x47a5('0x30')][_0x47a5('0x36')]);_0x11a4fa[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_[_0x47a5('0x39')](_0x361bfa['query'],_0x3ad507[_0x47a5('0x38')]),_0x243210);if(_0x361bfa[_0x47a5('0x30')]['filter']){_0x11a4fa[_0x47a5('0x37')]=_[_0x47a5('0x3a')](_0x11a4fa[_0x47a5('0x37')],{'$or':_['map'](_0x243210,function(_0x101f70){if(_0x101f70[_0x47a5('0x2b')]!=='VIRTUAL'){var _0x2ebba0={};_0x2ebba0[_0x101f70[_0x47a5('0x26')]]={'$like':'%'+_0x361bfa['query']['filter']+'%'};return _0x2ebba0;}})});}_0x11a4fa=_['merge']({},_0x11a4fa,_0x361bfa[_0x47a5('0x3b')]);var _0x5c569e={'where':_0x11a4fa[_0x47a5('0x37')]};return db[_0x47a5('0x29')][_0x47a5('0x3c')](_0x5c569e)[_0x47a5('0x20')](function(_0x1b2c80){_0x528582[_0x47a5('0x3c')]=_0x1b2c80;if(_0x361bfa[_0x47a5('0x30')][_0x47a5('0x3d')]){_0x11a4fa[_0x47a5('0x3e')]=[{'all':!![]}];}return db[_0x47a5('0x29')][_0x47a5('0x3f')](_0x11a4fa);})[_0x47a5('0x20')](function(_0x23d6d8){_0x528582['rows']=_0x23d6d8;return _0x528582;})[_0x47a5('0x20')](respondWithFilteredResult(_0x1127f8,_0x11a4fa))[_0x47a5('0x40')](handleError(_0x1127f8,null));};exports[_0x47a5('0x41')]=function(_0x23bd8d,_0x586f4f){var _0x7de536={'raw':!![],'where':{'id':_0x23bd8d['params']['id']}},_0x528ef3={};_0x528ef3['model']=_['keys'](db[_0x47a5('0x29')]['rawAttributes']);_0x528ef3[_0x47a5('0x30')]=_[_0x47a5('0x2f')](_0x23bd8d[_0x47a5('0x30')]);_0x528ef3['filters']=_[_0x47a5('0x31')](_0x528ef3[_0x47a5('0x2d')],_0x528ef3['query']);_0x7de536['attributes']=_[_0x47a5('0x31')](_0x528ef3['model'],qs[_0x47a5('0x32')](_0x23bd8d[_0x47a5('0x30')][_0x47a5('0x32')]));_0x7de536[_0x47a5('0x33')]=_0x7de536[_0x47a5('0x33')][_0x47a5('0x42')]?_0x7de536[_0x47a5('0x33')]:_0x528ef3[_0x47a5('0x2d')];if(_0x23bd8d[_0x47a5('0x30')][_0x47a5('0x3d')]){_0x7de536[_0x47a5('0x3e')]=[{'all':!![]}];}_0x7de536=_[_0x47a5('0x3a')]({},_0x7de536,_0x23bd8d[_0x47a5('0x3b')]);return db[_0x47a5('0x29')][_0x47a5('0x43')](_0x7de536)[_0x47a5('0x20')](handleEntityNotFound(_0x586f4f,null))['then'](respondWithResult(_0x586f4f,null))[_0x47a5('0x40')](handleError(_0x586f4f,null));};exports[_0x47a5('0x44')]=function(_0x49eab1,_0x52b3a8){return db[_0x47a5('0x29')]['create'](_0x49eab1[_0x47a5('0x45')],{})[_0x47a5('0x20')](function(_0x54c35f){var _0x4f62d3=_0x49eab1[_0x47a5('0x46')]['get']({'plain':!![]});if(!_0x4f62d3)throw new Error(_0x47a5('0x47'));if(_0x4f62d3[_0x47a5('0x48')]===_0x47a5('0x46')){var _0x3e12a7=_0x54c35f[_0x47a5('0x22')]({'plain':!![]});var _0x26acd2=_0x47a5('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x26acd2,'userProfileId':_0x4f62d3[_0x47a5('0x4a')]},'raw':!![]})[_0x47a5('0x20')](function(_0x1163e3){if(_0x1163e3&&_0x1163e3[_0x47a5('0x4b')]===0x0){return db[_0x47a5('0x23')][_0x47a5('0x44')]({'name':_0x3e12a7[_0x47a5('0x26')],'resourceId':_0x3e12a7['id'],'type':_0x1163e3['name'],'sectionId':_0x1163e3['id']},{})[_0x47a5('0x20')](function(){return _0x54c35f;});}else{return _0x54c35f;}})[_0x47a5('0x40')](function(_0x5f6a){logger['error'](_0x47a5('0x4c'),_0x5f6a);throw _0x5f6a;});}return _0x54c35f;})['then'](respondWithResult(_0x52b3a8,0xc9))[_0x47a5('0x40')](handleError(_0x52b3a8,null));};exports[_0x47a5('0x1f')]=function(_0x46e90b,_0xf03bd5){if(_0x46e90b['body']['id']){delete _0x46e90b[_0x47a5('0x45')]['id'];}return db[_0x47a5('0x29')][_0x47a5('0x43')]({'where':{'id':_0x46e90b[_0x47a5('0x4d')]['id']}})[_0x47a5('0x20')](handleEntityNotFound(_0xf03bd5,null))[_0x47a5('0x20')](saveUpdates(_0x46e90b[_0x47a5('0x45')],null))['then'](respondWithResult(_0xf03bd5,null))[_0x47a5('0x40')](handleError(_0xf03bd5,null));};exports[_0x47a5('0x21')]=function(_0x187d7e,_0x8da9fb){return db[_0x47a5('0x29')][_0x47a5('0x43')]({'where':{'id':_0x187d7e['params']['id']}})[_0x47a5('0x20')](handleEntityNotFound(_0x8da9fb,null))[_0x47a5('0x20')](removeEntity(_0x8da9fb,null))[_0x47a5('0x40')](handleError(_0x8da9fb,null));}; \ No newline at end of file +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(_0x144a8b,_0x163e37){var _0x3fbf41=function(_0xbbb76f){while(--_0xbbb76f){_0x144a8b['push'](_0x144a8b['shift']());}};_0x3fbf41(++_0x163e37);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xc4aa[_0x209941];return _0x1e8729;};'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 diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 23db06d..3df3097 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 _0xa1b1=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','util'];(function(_0x293254,_0x5477d3){var _0x30e808=function(_0x5a99fb){while(--_0x5a99fb){_0x293254['push'](_0x293254['shift']());}};_0x30e808(++_0x5477d3);}(_0xa1b1,0x187));var _0x1a1b=function(_0x3520a3,_0x585b4e){_0x3520a3=_0x3520a3-0x0;var _0x266257=_0xa1b1[_0x3520a3];return _0x266257;};'use strict';var _=require('lodash');var util=require(_0x1a1b('0x0'));var logger=require(_0x1a1b('0x1'))(_0x1a1b('0x2'));var moment=require(_0x1a1b('0x3'));var BPromise=require(_0x1a1b('0x4'));var rp=require(_0x1a1b('0x5'));var fs=require('fs');var path=require(_0x1a1b('0x6'));var rimraf=require(_0x1a1b('0x7'));var config=require(_0x1a1b('0x8'));var attributes=require(_0x1a1b('0x9'));module[_0x1a1b('0xa')]=function(_0x266bad,_0x20f6d0){return _0x266bad[_0x1a1b('0xb')](_0x1a1b('0xc'),attributes,{'tableName':_0x1a1b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe35=['../../config/logger','path','../../config/environment','./template.attributes','exports','define','tools_templates','lodash','util'];(function(_0x1f9758,_0x52e99a){var _0x27be23=function(_0x36dfcd){while(--_0x36dfcd){_0x1f9758['push'](_0x1f9758['shift']());}};_0x27be23(++_0x52e99a);}(_0xfe35,0x15d));var _0x5fe3=function(_0x1ccb48,_0x3356c6){_0x1ccb48=_0x1ccb48-0x0;var _0x5ae15f=_0xfe35[_0x1ccb48];return _0x5ae15f;};'use strict';var _=require(_0x5fe3('0x0'));var util=require(_0x5fe3('0x1'));var logger=require(_0x5fe3('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5fe3('0x3'));var rimraf=require('rimraf');var config=require(_0x5fe3('0x4'));var attributes=require(_0x5fe3('0x5'));module[_0x5fe3('0x6')]=function(_0x62efae,_0x18410e){return _0x62efae[_0x5fe3('0x7')]('Template',attributes,{'tableName':_0x5fe3('0x8'),'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 2d01351..82d5e54 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 _0x18af=['request','then','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','info','Template,\x20%s,\x20%s','result','catch','GetTemplate','options','raw','where','attributes','limit','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x51eafa,_0x26ac6d){var _0x12b345=function(_0x513ef5){while(--_0x513ef5){_0x51eafa['push'](_0x51eafa['shift']());}};_0x12b345(++_0x26ac6d);}(_0x18af,0x16a));var _0xf18a=function(_0xb86674,_0x50e4ef){_0xb86674=_0xb86674-0x0;var _0x39db0c=_0x18af[_0xb86674];return _0x39db0c;};'use strict';var _=require(_0xf18a('0x0'));var util=require(_0xf18a('0x1'));var moment=require(_0xf18a('0x2'));var BPromise=require(_0xf18a('0x3'));var rs=require(_0xf18a('0x4'));var fs=require('fs');var Redis=require(_0xf18a('0x5'));var db=require(_0xf18a('0x6'))['db'];var utils=require(_0xf18a('0x7'));var logger=require(_0xf18a('0x8'))('rpc');var config=require(_0xf18a('0x9'));var jayson=require(_0xf18a('0xa'));var client=jayson[_0xf18a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x351dce,_0x3f242d,_0x605b3c){return new BPromise(function(_0xd4ca35,_0x51660c){return client[_0xf18a('0xc')](_0x351dce,_0x605b3c)[_0xf18a('0xd')](function(_0x11110d){logger['info']('Template,\x20%s,\x20%s',_0x3f242d,_0xf18a('0xe'));logger[_0xf18a('0xf')](_0xf18a('0x10'),_0x3f242d,_0xf18a('0xe'),JSON['stringify'](_0x11110d));if(_0x11110d[_0xf18a('0x11')]){if(_0x11110d[_0xf18a('0x11')][_0xf18a('0x12')]===0x1f4){logger[_0xf18a('0x11')]('Template,\x20%s,\x20%s',_0x3f242d,_0x11110d[_0xf18a('0x11')][_0xf18a('0x13')]);return _0x51660c(_0x11110d['error']['message']);}logger[_0xf18a('0x11')]('Template,\x20%s,\x20%s',_0x3f242d,_0x11110d[_0xf18a('0x11')][_0xf18a('0x13')]);return _0xd4ca35(_0x11110d['error'][_0xf18a('0x13')]);}else{logger[_0xf18a('0x14')](_0xf18a('0x15'),_0x3f242d,_0xf18a('0xe'));_0xd4ca35(_0x11110d[_0xf18a('0x16')][_0xf18a('0x13')]);}})[_0xf18a('0x17')](function(_0x202f99){logger[_0xf18a('0x11')](_0xf18a('0x15'),_0x3f242d,_0x202f99);_0x51660c(_0x202f99);});});}exports[_0xf18a('0x18')]=function(_0x53ffac){var _0x53daaf=this;return new Promise(function(_0x41c850,_0x770a02){return db['Template']['findAll']({'raw':_0x53ffac['options']?_0x53ffac[_0xf18a('0x19')][_0xf18a('0x1a')]===undefined?!![]:![]:!![],'where':_0x53ffac[_0xf18a('0x19')]?_0x53ffac[_0xf18a('0x19')][_0xf18a('0x1b')]||null:null,'attributes':_0x53ffac[_0xf18a('0x19')]?_0x53ffac[_0xf18a('0x19')][_0xf18a('0x1c')]||null:null,'limit':_0x53ffac[_0xf18a('0x19')]?_0x53ffac[_0xf18a('0x19')][_0xf18a('0x1d')]||null:null,'include':_0x53ffac[_0xf18a('0x19')]?_0x53ffac[_0xf18a('0x19')][_0xf18a('0x1e')]?_[_0xf18a('0x1f')](_0x53ffac[_0xf18a('0x19')][_0xf18a('0x1e')],function(_0x71c7c6){return{'model':db[_0x71c7c6['model']],'as':_0x71c7c6['as'],'attributes':_0x71c7c6[_0xf18a('0x1c')],'include':_0x71c7c6[_0xf18a('0x1e')]?_[_0xf18a('0x1f')](_0x71c7c6[_0xf18a('0x1e')],function(_0x1dc3e3){return{'model':db[_0x1dc3e3[_0xf18a('0x20')]],'as':_0x1dc3e3['as'],'attributes':_0x1dc3e3[_0xf18a('0x1c')],'include':_0x1dc3e3['include']?_[_0xf18a('0x1f')](_0x1dc3e3[_0xf18a('0x1e')],function(_0x49d263){return{'model':db[_0x49d263[_0xf18a('0x20')]],'as':_0x49d263['as'],'attributes':_0x49d263[_0xf18a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf18a('0xd')](function(_0x533bba){logger['info']('GetTemplate',_0x53ffac);logger[_0xf18a('0xf')](_0xf18a('0x18'),_0x53ffac,JSON[_0xf18a('0x21')](_0x533bba));_0x41c850(_0x533bba);})[_0xf18a('0x17')](function(_0x4443a4){logger['error'](_0xf18a('0x18'),_0x4443a4[_0xf18a('0x13')],_0x53ffac);_0x770a02(_0x53daaf['error'](0x1f4,_0x4443a4['message']));});});}; \ No newline at end of file +var _0x7974=['where','attributes','include','map','model','then','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTemplate','Template','findAll','options','raw'];(function(_0x2ca734,_0x303109){var _0x1241e2=function(_0xedbced){while(--_0xedbced){_0x2ca734['push'](_0x2ca734['shift']());}};_0x1241e2(++_0x303109);}(_0x7974,0xc1));var _0x4797=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x7974[_0x550d12];return _0x12103d;};'use strict';var _=require(_0x4797('0x0'));var util=require('util');var moment=require(_0x4797('0x1'));var BPromise=require('bluebird');var rs=require(_0x4797('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4797('0x3'));var logger=require(_0x4797('0x4'))(_0x4797('0x5'));var config=require(_0x4797('0x6'));var jayson=require(_0x4797('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5b21d1,_0x434f4d,_0x49dfec){return new BPromise(function(_0x67f2a5,_0x1f27fa){return client[_0x4797('0x8')](_0x5b21d1,_0x49dfec)['then'](function(_0x592da8){logger[_0x4797('0x9')](_0x4797('0xa'),_0x434f4d,_0x4797('0xb'));logger[_0x4797('0xc')](_0x4797('0xd'),_0x434f4d,_0x4797('0xb'),JSON[_0x4797('0xe')](_0x592da8));if(_0x592da8[_0x4797('0xf')]){if(_0x592da8[_0x4797('0xf')][_0x4797('0x10')]===0x1f4){logger[_0x4797('0xf')](_0x4797('0xa'),_0x434f4d,_0x592da8['error']['message']);return _0x1f27fa(_0x592da8[_0x4797('0xf')][_0x4797('0x11')]);}logger[_0x4797('0xf')](_0x4797('0xa'),_0x434f4d,_0x592da8['error']['message']);return _0x67f2a5(_0x592da8[_0x4797('0xf')][_0x4797('0x11')]);}else{logger[_0x4797('0x9')](_0x4797('0xa'),_0x434f4d,_0x4797('0xb'));_0x67f2a5(_0x592da8[_0x4797('0x12')][_0x4797('0x11')]);}})['catch'](function(_0x26c6c1){logger[_0x4797('0xf')](_0x4797('0xa'),_0x434f4d,_0x26c6c1);_0x1f27fa(_0x26c6c1);});});}exports[_0x4797('0x13')]=function(_0x2ac365){var _0x203de2=this;return new Promise(function(_0x3c93ef,_0x82d02){return db[_0x4797('0x14')][_0x4797('0x15')]({'raw':_0x2ac365[_0x4797('0x16')]?_0x2ac365[_0x4797('0x16')][_0x4797('0x17')]===undefined?!![]:![]:!![],'where':_0x2ac365[_0x4797('0x16')]?_0x2ac365[_0x4797('0x16')][_0x4797('0x18')]||null:null,'attributes':_0x2ac365[_0x4797('0x16')]?_0x2ac365[_0x4797('0x16')][_0x4797('0x19')]||null:null,'limit':_0x2ac365[_0x4797('0x16')]?_0x2ac365[_0x4797('0x16')]['limit']||null:null,'include':_0x2ac365[_0x4797('0x16')]?_0x2ac365['options'][_0x4797('0x1a')]?_[_0x4797('0x1b')](_0x2ac365[_0x4797('0x16')][_0x4797('0x1a')],function(_0xa0c1cd){return{'model':db[_0xa0c1cd[_0x4797('0x1c')]],'as':_0xa0c1cd['as'],'attributes':_0xa0c1cd[_0x4797('0x19')],'include':_0xa0c1cd[_0x4797('0x1a')]?_[_0x4797('0x1b')](_0xa0c1cd[_0x4797('0x1a')],function(_0x220792){return{'model':db[_0x220792[_0x4797('0x1c')]],'as':_0x220792['as'],'attributes':_0x220792[_0x4797('0x19')],'include':_0x220792[_0x4797('0x1a')]?_['map'](_0x220792[_0x4797('0x1a')],function(_0x56978c){return{'model':db[_0x56978c['model']],'as':_0x56978c['as'],'attributes':_0x56978c[_0x4797('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4797('0x1d')](function(_0xf7d37d){logger[_0x4797('0x9')](_0x4797('0x13'),_0x2ac365);logger[_0x4797('0xc')](_0x4797('0x13'),_0x2ac365,JSON['stringify'](_0xf7d37d));_0x3c93ef(_0xf7d37d);})[_0x4797('0x1e')](function(_0x30f7d9){logger['error'](_0x4797('0x13'),_0x30f7d9[_0x4797('0x11')],_0x2ac365);_0x82d02(_0x203de2[_0x4797('0xf')](0x1f4,_0x30f7d9[_0x4797('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 996758c..b74012a 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 _0xe8ae=['isAuthenticated','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getActions','create','post','addAnyCondition','/:id/actions','addAction','put','update','delete','exports','multer','util','path','express','../../components/auth/service','./trigger.controller','get'];(function(_0x313916,_0x2b721b){var _0x2c2d44=function(_0x8802e6){while(--_0x8802e6){_0x313916['push'](_0x313916['shift']());}};_0x2c2d44(++_0x2b721b);}(_0xe8ae,0x152));var _0xee8a=function(_0x428506,_0xb4a965){_0x428506=_0x428506-0x0;var _0x2c4596=_0xe8ae[_0x428506];return _0x2c4596;};'use strict';var multer=require(_0xee8a('0x0'));var util=require(_0xee8a('0x1'));var path=require(_0xee8a('0x2'));var timeout=require('connect-timeout');var express=require(_0xee8a('0x3'));var router=express['Router']();var auth=require(_0xee8a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xee8a('0x5'));router[_0xee8a('0x6')]('/',auth[_0xee8a('0x7')](),controller['index']);router[_0xee8a('0x6')](_0xee8a('0x8'),auth[_0xee8a('0x7')](),controller[_0xee8a('0x9')]);router[_0xee8a('0x6')](_0xee8a('0xa'),auth[_0xee8a('0x7')](),controller[_0xee8a('0xb')]);router['get'](_0xee8a('0xc'),auth[_0xee8a('0x7')](),controller['getAnyConditions']);router['get']('/:id/actions',auth[_0xee8a('0x7')](),controller[_0xee8a('0xd')]);router['post']('/',auth[_0xee8a('0x7')](),controller[_0xee8a('0xe')]);router['post'](_0xee8a('0xa'),auth[_0xee8a('0x7')](),controller['addAllCondition']);router[_0xee8a('0xf')](_0xee8a('0xc'),auth[_0xee8a('0x7')](),controller[_0xee8a('0x10')]);router[_0xee8a('0xf')](_0xee8a('0x11'),auth['isAuthenticated'](),controller[_0xee8a('0x12')]);router[_0xee8a('0x13')]('/:id',auth[_0xee8a('0x7')](),controller[_0xee8a('0x14')]);router[_0xee8a('0x15')](_0xee8a('0x8'),auth[_0xee8a('0x7')](),controller['destroy']);module[_0xee8a('0x16')]=router; \ No newline at end of file +var _0x07d3=['getActions','post','create','/:id/all_conditions','/:id/any_conditions','addAnyCondition','/:id','update','delete','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','show','/:id/actions'];(function(_0x18d152,_0x4d7b8e){var _0x31df26=function(_0x1b4726){while(--_0x1b4726){_0x18d152['push'](_0x18d152['shift']());}};_0x31df26(++_0x4d7b8e);}(_0x07d3,0x72));var _0x307d=function(_0x2e73a2,_0x2851ea){_0x2e73a2=_0x2e73a2-0x0;var _0x2c411f=_0x07d3[_0x2e73a2];return _0x2c411f;};'use strict';var multer=require(_0x307d('0x0'));var util=require('util');var path=require(_0x307d('0x1'));var timeout=require(_0x307d('0x2'));var express=require(_0x307d('0x3'));var router=express['Router']();var auth=require(_0x307d('0x4'));var interaction=require(_0x307d('0x5'));var config=require(_0x307d('0x6'));var controller=require(_0x307d('0x7'));router[_0x307d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x307d('0x8')]('/:id',auth[_0x307d('0x9')](),controller[_0x307d('0xa')]);router[_0x307d('0x8')]('/:id/all_conditions',auth[_0x307d('0x9')](),controller['getAllConditions']);router['get']('/:id/any_conditions',auth[_0x307d('0x9')](),controller['getAnyConditions']);router[_0x307d('0x8')](_0x307d('0xb'),auth[_0x307d('0x9')](),controller[_0x307d('0xc')]);router[_0x307d('0xd')]('/',auth[_0x307d('0x9')](),controller[_0x307d('0xe')]);router[_0x307d('0xd')](_0x307d('0xf'),auth[_0x307d('0x9')](),controller['addAllCondition']);router[_0x307d('0xd')](_0x307d('0x10'),auth[_0x307d('0x9')](),controller[_0x307d('0x11')]);router[_0x307d('0xd')]('/:id/actions',auth[_0x307d('0x9')](),controller['addAction']);router['put'](_0x307d('0x12'),auth[_0x307d('0x9')](),controller[_0x307d('0x13')]);router[_0x307d('0x14')]('/:id',auth[_0x307d('0x9')](),controller['destroy']);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 3396e29..8fcfec2 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 _0x2e29=['exports','STRING','BOOLEAN','sequelize'];(function(_0x1e38bd,_0xc29d61){var _0x533bd9=function(_0x3d4a21){while(--_0x3d4a21){_0x1e38bd['push'](_0x1e38bd['shift']());}};_0x533bd9(++_0xc29d61);}(_0x2e29,0x8f));var _0x92e2=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x2e29[_0x1a36a5];return _0x746243;};'use strict';var Sequelize=require(_0x92e2('0x0'));module[_0x92e2('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x92e2('0x2')]},'description':{'type':Sequelize[_0x92e2('0x2')]},'status':{'type':Sequelize[_0x92e2('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xcff6=['STRING','BOOLEAN','sequelize','exports'];(function(_0x16c117,_0x5c4e32){var _0x13d413=function(_0x2e12c8){while(--_0x2e12c8){_0x16c117['push'](_0x16c117['shift']());}};_0x13d413(++_0x5c4e32);}(_0xcff6,0x82));var _0x6cff=function(_0x2e8700,_0x3f68cf){_0x2e8700=_0x2e8700-0x0;var _0xaa1405=_0xcff6[_0x2e8700];return _0xaa1405;};'use strict';var Sequelize=require(_0x6cff('0x0'));module[_0x6cff('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x6cff('0x2')]},'description':{'type':Sequelize[_0x6cff('0x2')]},'status':{'type':Sequelize[_0x6cff('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 d550ce8..2e903b4 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 _0xf3ff=['bluebird','util','path','sox','ejs','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','error','stack','name','send','map','Trigger','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','params','length','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','destroy','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','hasOwnProperty','getAnyConditions','addAction','Action','getActions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x44686e,_0x6b649d){var _0x552916=function(_0x53522d){while(--_0x53522d){_0x44686e['push'](_0x44686e['shift']());}};_0x552916(++_0x6b649d);}(_0xf3ff,0xae));var _0xff3f=function(_0x176d17,_0x5eb048){_0x176d17=_0x176d17-0x0;var _0x2e4a0b=_0xf3ff[_0x176d17];return _0x2e4a0b;};'use strict';var pdf=require(_0xff3f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xff3f('0x1'));var zipdir=require(_0xff3f('0x2'));var jsonpatch=require(_0xff3f('0x3'));var rp=require(_0xff3f('0x4'));var moment=require(_0xff3f('0x5'));var BPromise=require(_0xff3f('0x6'));var Mustache=require('mustache');var util=require(_0xff3f('0x7'));var path=require(_0xff3f('0x8'));var sox=require(_0xff3f('0x9'));var csv=require('to-csv');var ejs=require(_0xff3f('0xa'));var fs=require('fs');var _=require(_0xff3f('0xb'));var squel=require('squel');var crypto=require(_0xff3f('0xc'));var jsforce=require(_0xff3f('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xff3f('0xe'));var Redis=require('ioredis');var authService=require(_0xff3f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xff3f('0x10'));var hardwareService=require(_0xff3f('0x11'));var logger=require(_0xff3f('0x12'))(_0xff3f('0x13'));var utils=require(_0xff3f('0x14'));var config=require(_0xff3f('0x15'));var licenseUtil=require(_0xff3f('0x16'));var db=require(_0xff3f('0x17'))['db'];function respondWithStatusCode(_0x24a3c8,_0x2b5d15){_0x2b5d15=_0x2b5d15||0xcc;return function(_0x59fe19){if(_0x59fe19){return _0x24a3c8['sendStatus'](_0x2b5d15);}return _0x24a3c8[_0xff3f('0x18')](_0x2b5d15)[_0xff3f('0x19')]();};}function respondWithResult(_0x32f887,_0x4b3409){_0x4b3409=_0x4b3409||0xc8;return function(_0x54b52c){if(_0x54b52c){return _0x32f887[_0xff3f('0x18')](_0x4b3409)['json'](_0x54b52c);}};}function respondWithFilteredResult(_0x5ae3af,_0x2a7c79){return function(_0x95d895){if(_0x95d895){var _0x54e2a5=_0x95d895['count'],_0x195bea=_0x2a7c79[_0xff3f('0x1a')],_0x50225e=_0x2a7c79[_0xff3f('0x1a')]+_0x2a7c79[_0xff3f('0x1b')],_0x129647;if(_0x50225e>=_0x54e2a5){_0x50225e=_0x54e2a5;_0x129647=0xc8;}else{_0x129647=0xce;}_0x5ae3af['status'](_0x129647);return _0x5ae3af[_0xff3f('0x1c')](_0xff3f('0x1d'),_0x195bea+'-'+_0x50225e+'/'+_0x54e2a5)['json'](_0x95d895);}return null;};}function patchUpdates(_0x2d1d09){return function(_0x3a220b){try{jsonpatch[_0xff3f('0x1e')](_0x3a220b,_0x2d1d09,!![]);}catch(_0x2a0322){return BPromise[_0xff3f('0x1f')](_0x2a0322);}return _0x3a220b[_0xff3f('0x20')]();};}function saveUpdates(_0x2ffd20,_0xfd9c46){return function(_0x79a72e){if(_0x79a72e){return _0x79a72e[_0xff3f('0x21')](_0x2ffd20)[_0xff3f('0x22')](function(_0x28abcb){return _0x28abcb;});}return null;};}function removeEntity(_0x2daed4,_0x396044){return function(_0x52986f){if(_0x52986f){return _0x52986f['destroy']()[_0xff3f('0x22')](function(){var _0x53fbeb=_0x52986f[_0xff3f('0x23')]({'plain':!![]});var _0x2bbbb2='Triggers';return db[_0xff3f('0x24')]['destroy']({'where':{'type':_0x2bbbb2,'resourceId':_0x53fbeb['id']}})[_0xff3f('0x22')](function(){return _0x52986f;});})['then'](function(){_0x2daed4[_0xff3f('0x18')](0xcc)[_0xff3f('0x19')]();});}};}function handleEntityNotFound(_0x21cb5d,_0x2f3c83){return function(_0x44fb87){if(!_0x44fb87){_0x21cb5d['sendStatus'](0x194);}return _0x44fb87;};}function handleError(_0x579659,_0x32addc){_0x32addc=_0x32addc||0x1f4;return function(_0x4721f9){logger[_0xff3f('0x25')](_0x4721f9[_0xff3f('0x26')]);if(_0x4721f9[_0xff3f('0x27')]){delete _0x4721f9['name'];}_0x579659[_0xff3f('0x18')](_0x32addc)[_0xff3f('0x28')](_0x4721f9);};}exports['index']=function(_0x1f6d2a,_0x33a849){var _0x27a253={},_0xe269e6={},_0x3bdbfa={'count':0x0,'rows':[]};var _0x14ea17=_[_0xff3f('0x29')](db[_0xff3f('0x2a')][_0xff3f('0x2b')],function(_0x183922){return{'name':_0x183922['fieldName'],'type':_0x183922[_0xff3f('0x2c')]['key']};});_0xe269e6[_0xff3f('0x2d')]=_[_0xff3f('0x29')](_0x14ea17,_0xff3f('0x27'));_0xe269e6[_0xff3f('0x2e')]=_[_0xff3f('0x2f')](_0x1f6d2a[_0xff3f('0x2e')]);_0xe269e6[_0xff3f('0x30')]=_[_0xff3f('0x31')](_0xe269e6['model'],_0xe269e6['query']);_0x27a253[_0xff3f('0x32')]=_[_0xff3f('0x31')](_0xe269e6[_0xff3f('0x2d')],qs[_0xff3f('0x33')](_0x1f6d2a['query'][_0xff3f('0x33')]));_0x27a253[_0xff3f('0x32')]=_0x27a253[_0xff3f('0x32')]['length']?_0x27a253[_0xff3f('0x32')]:_0xe269e6[_0xff3f('0x2d')];if(!_0x1f6d2a[_0xff3f('0x2e')]['hasOwnProperty'](_0xff3f('0x34'))){_0x27a253['limit']=qs[_0xff3f('0x1b')](_0x1f6d2a[_0xff3f('0x2e')][_0xff3f('0x1b')]);_0x27a253[_0xff3f('0x1a')]=qs[_0xff3f('0x1a')](_0x1f6d2a['query']['offset']);}_0x27a253[_0xff3f('0x35')]=qs['sort'](_0x1f6d2a[_0xff3f('0x2e')][_0xff3f('0x36')]);_0x27a253[_0xff3f('0x37')]=qs[_0xff3f('0x30')](_[_0xff3f('0x38')](_0x1f6d2a[_0xff3f('0x2e')],_0xe269e6[_0xff3f('0x30')]),_0x14ea17);if(_0x1f6d2a[_0xff3f('0x2e')][_0xff3f('0x39')]){_0x27a253[_0xff3f('0x37')]=_[_0xff3f('0x3a')](_0x27a253[_0xff3f('0x37')],{'$or':_['map'](_0x14ea17,function(_0x48198a){if(_0x48198a['type']!==_0xff3f('0x3b')){var _0x4d63b8={};_0x4d63b8[_0x48198a['name']]={'$like':'%'+_0x1f6d2a[_0xff3f('0x2e')]['filter']+'%'};return _0x4d63b8;}})});}_0x27a253=_[_0xff3f('0x3a')]({},_0x27a253,_0x1f6d2a[_0xff3f('0x3c')]);var _0x383c95={'where':_0x27a253[_0xff3f('0x37')]};return db[_0xff3f('0x2a')][_0xff3f('0x3d')](_0x383c95)[_0xff3f('0x22')](function(_0x32ac31){_0x3bdbfa[_0xff3f('0x3d')]=_0x32ac31;if(_0x1f6d2a[_0xff3f('0x2e')][_0xff3f('0x3e')]){_0x27a253[_0xff3f('0x3f')]=[{'all':!![]}];}return db[_0xff3f('0x2a')]['findAll'](_0x27a253);})['then'](function(_0x47c13d){_0x3bdbfa[_0xff3f('0x40')]=_0x47c13d;return _0x3bdbfa;})[_0xff3f('0x22')](respondWithFilteredResult(_0x33a849,_0x27a253))['catch'](handleError(_0x33a849,null));};exports[_0xff3f('0x41')]=function(_0x27bd47,_0x1e57e8){var _0x83bde8={'raw':![],'where':{'id':_0x27bd47[_0xff3f('0x42')]['id']}},_0x49f05f={};_0x49f05f[_0xff3f('0x2d')]=_[_0xff3f('0x2f')](db[_0xff3f('0x2a')][_0xff3f('0x2b')]);_0x49f05f[_0xff3f('0x2e')]=_[_0xff3f('0x2f')](_0x27bd47[_0xff3f('0x2e')]);_0x49f05f['filters']=_[_0xff3f('0x31')](_0x49f05f['model'],_0x49f05f[_0xff3f('0x2e')]);_0x83bde8[_0xff3f('0x32')]=_['intersection'](_0x49f05f[_0xff3f('0x2d')],qs['fields'](_0x27bd47[_0xff3f('0x2e')]['fields']));_0x83bde8[_0xff3f('0x32')]=_0x83bde8[_0xff3f('0x32')][_0xff3f('0x43')]?_0x83bde8[_0xff3f('0x32')]:_0x49f05f[_0xff3f('0x2d')];if(_0x27bd47[_0xff3f('0x2e')]['includeAll']){_0x83bde8['include']=[{'all':!![]}];}_0x83bde8=_[_0xff3f('0x3a')]({},_0x83bde8,_0x27bd47[_0xff3f('0x3c')]);return db['Trigger'][_0xff3f('0x44')](_0x83bde8)[_0xff3f('0x22')](handleEntityNotFound(_0x1e57e8,null))['then'](respondWithResult(_0x1e57e8,null))[_0xff3f('0x45')](handleError(_0x1e57e8,null));};exports['create']=function(_0x58dff5,_0x3ba0c7){return db[_0xff3f('0x2a')][_0xff3f('0x46')](_0x58dff5['body'],{})[_0xff3f('0x22')](function(_0x4af5a0){var _0xec21bf=_0x58dff5[_0xff3f('0x47')][_0xff3f('0x23')]({'plain':!![]});if(!_0xec21bf)throw new Error(_0xff3f('0x48'));if(_0xec21bf[_0xff3f('0x49')]===_0xff3f('0x47')){var _0x52df1b=_0x4af5a0[_0xff3f('0x23')]({'plain':!![]});var _0x41265e='Triggers';return db[_0xff3f('0x4a')][_0xff3f('0x44')]({'where':{'name':_0x41265e,'userProfileId':_0xec21bf[_0xff3f('0x4b')]},'raw':!![]})[_0xff3f('0x22')](function(_0x319435){if(_0x319435&&_0x319435[_0xff3f('0x4c')]===0x0){return db[_0xff3f('0x24')][_0xff3f('0x46')]({'name':_0x52df1b[_0xff3f('0x27')],'resourceId':_0x52df1b['id'],'type':_0x319435[_0xff3f('0x27')],'sectionId':_0x319435['id']},{})['then'](function(){return _0x4af5a0;});}else{return _0x4af5a0;}})[_0xff3f('0x45')](function(_0x3de785){logger[_0xff3f('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3de785);throw _0x3de785;});}return _0x4af5a0;})[_0xff3f('0x22')](respondWithResult(_0x3ba0c7,0xc9))[_0xff3f('0x45')](handleError(_0x3ba0c7,null));};exports[_0xff3f('0x21')]=function(_0xf09e40,_0x554dc3){if(_0xf09e40['body']['id']){delete _0xf09e40[_0xff3f('0x4d')]['id'];}return db['Trigger'][_0xff3f('0x44')]({'where':{'id':_0xf09e40['params']['id']}})['then'](handleEntityNotFound(_0x554dc3,null))['then'](saveUpdates(_0xf09e40[_0xff3f('0x4d')],null))[_0xff3f('0x22')](respondWithResult(_0x554dc3,null))[_0xff3f('0x45')](handleError(_0x554dc3,null));};exports[_0xff3f('0x4e')]=function(_0x5cd12d,_0x582ec9){return db['Trigger']['find']({'where':{'id':_0x5cd12d[_0xff3f('0x42')]['id']}})['then'](handleEntityNotFound(_0x582ec9,null))[_0xff3f('0x22')](removeEntity(_0x582ec9,null))['catch'](handleError(_0x582ec9,null));};exports[_0xff3f('0x4f')]=function(_0x3c20b3,_0x3b0f6b,_0x30f326){if(_0x3c20b3[_0xff3f('0x4d')]['id']){delete _0x3c20b3[_0xff3f('0x4d')]['id'];}return db['Trigger']['find']({'where':{'id':_0x3c20b3[_0xff3f('0x42')]['id']}})[_0xff3f('0x22')](handleEntityNotFound(_0x3b0f6b,null))['then'](function(_0x4583d9){if(_0x4583d9){_0x3c20b3[_0xff3f('0x4d')][_0xff3f('0x50')]=_0x4583d9['id'];return db[_0xff3f('0x51')][_0xff3f('0x46')](_0x3c20b3[_0xff3f('0x4d')]);}})[_0xff3f('0x22')](respondWithResult(_0x3b0f6b,null))['catch'](handleError(_0x3b0f6b,null));};exports[_0xff3f('0x52')]=function(_0x5f22e0,_0x5d2c37,_0x673bf){if(_0x5f22e0[_0xff3f('0x4d')]['id']){delete _0x5f22e0[_0xff3f('0x4d')]['id'];}return db['Trigger']['find']({'where':{'id':_0x5f22e0[_0xff3f('0x42')]['id']}})[_0xff3f('0x22')](handleEntityNotFound(_0x5d2c37,null))[_0xff3f('0x22')](function(_0x2771bd){if(_0x2771bd){_0x5f22e0[_0xff3f('0x4d')]['TriggerAnyId']=_0x2771bd['id'];return db[_0xff3f('0x51')]['create'](_0x5f22e0['body']);}})[_0xff3f('0x22')](respondWithResult(_0x5d2c37,null))['catch'](handleError(_0x5d2c37,null));};exports[_0xff3f('0x53')]=function(_0x4af2ed,_0x1a0a2e,_0x13455c){var _0x5c663f={};var _0x35dcf8={};var _0x18f840;var _0x26c8fc;return db[_0xff3f('0x2a')][_0xff3f('0x54')]({'where':{'id':_0x4af2ed[_0xff3f('0x42')]['id']}})['then'](handleEntityNotFound(_0x1a0a2e,null))[_0xff3f('0x22')](function(_0xe05a77){if(_0xe05a77){_0x18f840=_0xe05a77;_0x35dcf8['model']=_['keys'](db[_0xff3f('0x51')][_0xff3f('0x2b')]);_0x35dcf8[_0xff3f('0x2e')]=_[_0xff3f('0x2f')](_0x4af2ed['query']);_0x35dcf8[_0xff3f('0x30')]=_[_0xff3f('0x31')](_0x35dcf8[_0xff3f('0x2d')],_0x35dcf8[_0xff3f('0x2e')]);_0x5c663f['attributes']=_['intersection'](_0x35dcf8[_0xff3f('0x2d')],qs['fields'](_0x4af2ed['query'][_0xff3f('0x33')]));_0x5c663f[_0xff3f('0x32')]=_0x5c663f[_0xff3f('0x32')][_0xff3f('0x43')]?_0x5c663f[_0xff3f('0x32')]:_0x35dcf8[_0xff3f('0x2d')];_0x5c663f[_0xff3f('0x35')]=qs[_0xff3f('0x36')](_0x4af2ed[_0xff3f('0x2e')][_0xff3f('0x36')]);_0x5c663f[_0xff3f('0x37')]=qs[_0xff3f('0x30')](_['pick'](_0x4af2ed[_0xff3f('0x2e')],_0x35dcf8[_0xff3f('0x30')]));if(_0x4af2ed[_0xff3f('0x2e')][_0xff3f('0x39')]){_0x5c663f['where']=_[_0xff3f('0x3a')](_0x5c663f[_0xff3f('0x37')],{'$or':_[_0xff3f('0x29')](_0x5c663f[_0xff3f('0x32')],function(_0x9b3acc){var _0x3086c9={};_0x3086c9[_0x9b3acc]={'$like':'%'+_0x4af2ed[_0xff3f('0x2e')][_0xff3f('0x39')]+'%'};return _0x3086c9;})});}_0x5c663f=_[_0xff3f('0x3a')]({},_0x5c663f,_0x4af2ed[_0xff3f('0x3c')]);return _0x18f840['getAllConditions'](_0x5c663f);}})[_0xff3f('0x22')](function(_0x105a5f){if(_0x105a5f){_0x26c8fc=_0x105a5f[_0xff3f('0x43')];if(!_0x4af2ed[_0xff3f('0x2e')][_0xff3f('0x55')](_0xff3f('0x34'))){_0x5c663f[_0xff3f('0x1b')]=qs[_0xff3f('0x1b')](_0x4af2ed['query'][_0xff3f('0x1b')]);_0x5c663f['offset']=qs[_0xff3f('0x1a')](_0x4af2ed[_0xff3f('0x2e')]['offset']);}return _0x18f840['getAllConditions'](_0x5c663f);}})[_0xff3f('0x22')](function(_0x34fb05){if(_0x34fb05){return _0x34fb05?{'count':_0x26c8fc,'rows':_0x34fb05}:null;}})[_0xff3f('0x22')](respondWithResult(_0x1a0a2e,null))[_0xff3f('0x45')](handleError(_0x1a0a2e,null));};exports[_0xff3f('0x56')]=function(_0x2397af,_0x3aa63a,_0x1c5713){var _0x4b69a1={};var _0x51f258={};var _0x200301;var _0x457e1e;return db[_0xff3f('0x2a')]['findOne']({'where':{'id':_0x2397af['params']['id']}})[_0xff3f('0x22')](handleEntityNotFound(_0x3aa63a,null))[_0xff3f('0x22')](function(_0x196a14){if(_0x196a14){_0x200301=_0x196a14;_0x51f258[_0xff3f('0x2d')]=_['keys'](db[_0xff3f('0x51')]['rawAttributes']);_0x51f258['query']=_['keys'](_0x2397af[_0xff3f('0x2e')]);_0x51f258[_0xff3f('0x30')]=_['intersection'](_0x51f258[_0xff3f('0x2d')],_0x51f258[_0xff3f('0x2e')]);_0x4b69a1['attributes']=_[_0xff3f('0x31')](_0x51f258[_0xff3f('0x2d')],qs[_0xff3f('0x33')](_0x2397af['query'][_0xff3f('0x33')]));_0x4b69a1[_0xff3f('0x32')]=_0x4b69a1['attributes'][_0xff3f('0x43')]?_0x4b69a1['attributes']:_0x51f258['model'];_0x4b69a1[_0xff3f('0x35')]=qs[_0xff3f('0x36')](_0x2397af[_0xff3f('0x2e')]['sort']);_0x4b69a1[_0xff3f('0x37')]=qs['filters'](_[_0xff3f('0x38')](_0x2397af['query'],_0x51f258[_0xff3f('0x30')]));if(_0x2397af[_0xff3f('0x2e')][_0xff3f('0x39')]){_0x4b69a1['where']=_[_0xff3f('0x3a')](_0x4b69a1[_0xff3f('0x37')],{'$or':_['map'](_0x4b69a1[_0xff3f('0x32')],function(_0x201edb){var _0x4a251f={};_0x4a251f[_0x201edb]={'$like':'%'+_0x2397af[_0xff3f('0x2e')][_0xff3f('0x39')]+'%'};return _0x4a251f;})});}_0x4b69a1=_[_0xff3f('0x3a')]({},_0x4b69a1,_0x2397af[_0xff3f('0x3c')]);return _0x200301[_0xff3f('0x56')](_0x4b69a1);}})[_0xff3f('0x22')](function(_0x4868b9){if(_0x4868b9){_0x457e1e=_0x4868b9[_0xff3f('0x43')];if(!_0x2397af[_0xff3f('0x2e')][_0xff3f('0x55')](_0xff3f('0x34'))){_0x4b69a1[_0xff3f('0x1b')]=qs[_0xff3f('0x1b')](_0x2397af[_0xff3f('0x2e')][_0xff3f('0x1b')]);_0x4b69a1[_0xff3f('0x1a')]=qs['offset'](_0x2397af['query'][_0xff3f('0x1a')]);}return _0x200301[_0xff3f('0x56')](_0x4b69a1);}})[_0xff3f('0x22')](function(_0x103f0a){if(_0x103f0a){return _0x103f0a?{'count':_0x457e1e,'rows':_0x103f0a}:null;}})[_0xff3f('0x22')](respondWithResult(_0x3aa63a,null))[_0xff3f('0x45')](handleError(_0x3aa63a,null));};exports[_0xff3f('0x57')]=function(_0x49222b,_0x1758d7,_0x1907e5){if(_0x49222b[_0xff3f('0x4d')]['id']){delete _0x49222b[_0xff3f('0x4d')]['id'];}return db['Trigger'][_0xff3f('0x44')]({'where':{'id':_0x49222b[_0xff3f('0x42')]['id']}})[_0xff3f('0x22')](handleEntityNotFound(_0x1758d7,null))['then'](function(_0x575591){if(_0x575591){_0x49222b[_0xff3f('0x4d')]['TriggerId']=_0x575591['id'];return db[_0xff3f('0x58')][_0xff3f('0x46')](_0x49222b['body']);}})['then'](respondWithResult(_0x1758d7,null))[_0xff3f('0x45')](handleError(_0x1758d7,null));};exports['getActions']=function(_0x5d6181,_0x4fcb06,_0xb2bca2){var _0x55c481={};var _0x5dac01={};var _0x58147f;var _0x876f68;return db[_0xff3f('0x2a')]['findOne']({'where':{'id':_0x5d6181[_0xff3f('0x42')]['id']}})[_0xff3f('0x22')](handleEntityNotFound(_0x4fcb06,null))[_0xff3f('0x22')](function(_0x3e38f8){if(_0x3e38f8){_0x58147f=_0x3e38f8;_0x5dac01[_0xff3f('0x2d')]=_[_0xff3f('0x2f')](db[_0xff3f('0x58')][_0xff3f('0x2b')]);_0x5dac01[_0xff3f('0x2e')]=_[_0xff3f('0x2f')](_0x5d6181[_0xff3f('0x2e')]);_0x5dac01['filters']=_[_0xff3f('0x31')](_0x5dac01[_0xff3f('0x2d')],_0x5dac01[_0xff3f('0x2e')]);_0x55c481[_0xff3f('0x32')]=_[_0xff3f('0x31')](_0x5dac01[_0xff3f('0x2d')],qs[_0xff3f('0x33')](_0x5d6181[_0xff3f('0x2e')][_0xff3f('0x33')]));_0x55c481[_0xff3f('0x32')]=_0x55c481[_0xff3f('0x32')][_0xff3f('0x43')]?_0x55c481['attributes']:_0x5dac01[_0xff3f('0x2d')];_0x55c481[_0xff3f('0x35')]=qs['sort'](_0x5d6181[_0xff3f('0x2e')][_0xff3f('0x36')]);_0x55c481['where']=qs[_0xff3f('0x30')](_[_0xff3f('0x38')](_0x5d6181[_0xff3f('0x2e')],_0x5dac01[_0xff3f('0x30')]));if(_0x5d6181[_0xff3f('0x2e')][_0xff3f('0x39')]){_0x55c481[_0xff3f('0x37')]=_[_0xff3f('0x3a')](_0x55c481['where'],{'$or':_['map'](_0x55c481[_0xff3f('0x32')],function(_0x1b08d8){var _0x47a709={};_0x47a709[_0x1b08d8]={'$like':'%'+_0x5d6181['query'][_0xff3f('0x39')]+'%'};return _0x47a709;})});}_0x55c481=_[_0xff3f('0x3a')]({},_0x55c481,_0x5d6181[_0xff3f('0x3c')]);return _0x58147f[_0xff3f('0x59')](_0x55c481);}})[_0xff3f('0x22')](function(_0x47a809){if(_0x47a809){_0x876f68=_0x47a809[_0xff3f('0x43')];if(!_0x5d6181[_0xff3f('0x2e')][_0xff3f('0x55')](_0xff3f('0x34'))){_0x55c481[_0xff3f('0x1b')]=qs[_0xff3f('0x1b')](_0x5d6181[_0xff3f('0x2e')][_0xff3f('0x1b')]);_0x55c481[_0xff3f('0x1a')]=qs[_0xff3f('0x1a')](_0x5d6181[_0xff3f('0x2e')][_0xff3f('0x1a')]);}return _0x58147f[_0xff3f('0x59')](_0x55c481);}})[_0xff3f('0x22')](function(_0x45aeec){if(_0x45aeec){return _0x45aeec?{'count':_0x876f68,'rows':_0x45aeec}:null;}})[_0xff3f('0x22')](respondWithResult(_0x4fcb06,null))[_0xff3f('0x45')](handleError(_0x4fcb06,null));}; \ No newline at end of file +var _0x0e17=['user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','findOne','rawAttributes','getAllConditions','nolimit','getAnyConditions','hasOwnProperty','TriggerId','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','Triggers','UserProfileResource','destroy','stack','name','send','index','map','Trigger','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','rows','catch','params','includeAll','create','body'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0e17,0xd6));var _0x70e1=function(_0x192e1f,_0x2420e1){_0x192e1f=_0x192e1f-0x0;var _0x1de59f=_0x0e17[_0x192e1f];return _0x1de59f;};'use strict';var pdf=require(_0x70e1('0x0'));var emlformat=require(_0x70e1('0x1'));var rimraf=require(_0x70e1('0x2'));var zipdir=require(_0x70e1('0x3'));var jsonpatch=require(_0x70e1('0x4'));var rp=require(_0x70e1('0x5'));var moment=require(_0x70e1('0x6'));var BPromise=require(_0x70e1('0x7'));var Mustache=require(_0x70e1('0x8'));var util=require(_0x70e1('0x9'));var path=require(_0x70e1('0xa'));var sox=require(_0x70e1('0xb'));var csv=require('to-csv');var ejs=require(_0x70e1('0xc'));var fs=require('fs');var _=require(_0x70e1('0xd'));var squel=require(_0x70e1('0xe'));var crypto=require(_0x70e1('0xf'));var jsforce=require(_0x70e1('0x10'));var deskjs=require(_0x70e1('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x70e1('0x12'));var Redis=require('ioredis');var authService=require(_0x70e1('0x13'));var qs=require(_0x70e1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x70e1('0x15'));var logger=require(_0x70e1('0x16'))('api');var utils=require(_0x70e1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x70e1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcf9668,_0xcf2748){_0xcf2748=_0xcf2748||0xcc;return function(_0x15e180){if(_0x15e180){return _0xcf9668[_0x70e1('0x19')](_0xcf2748);}return _0xcf9668[_0x70e1('0x1a')](_0xcf2748)[_0x70e1('0x1b')]();};}function respondWithResult(_0xec5aea,_0x46e174){_0x46e174=_0x46e174||0xc8;return function(_0xf824e){if(_0xf824e){return _0xec5aea[_0x70e1('0x1a')](_0x46e174)[_0x70e1('0x1c')](_0xf824e);}};}function respondWithFilteredResult(_0x491c9c,_0x1f50aa){return function(_0x3c645c){if(_0x3c645c){var _0x39be1b=_0x3c645c[_0x70e1('0x1d')],_0x141b8f=_0x1f50aa[_0x70e1('0x1e')],_0x33e090=_0x1f50aa[_0x70e1('0x1e')]+_0x1f50aa[_0x70e1('0x1f')],_0xc18a09;if(_0x33e090>=_0x39be1b){_0x33e090=_0x39be1b;_0xc18a09=0xc8;}else{_0xc18a09=0xce;}_0x491c9c[_0x70e1('0x1a')](_0xc18a09);return _0x491c9c['set']('Content-Range',_0x141b8f+'-'+_0x33e090+'/'+_0x39be1b)[_0x70e1('0x1c')](_0x3c645c);}return null;};}function patchUpdates(_0x2234a4){return function(_0x2963a7){try{jsonpatch[_0x70e1('0x20')](_0x2963a7,_0x2234a4,!![]);}catch(_0xe86bd1){return BPromise[_0x70e1('0x21')](_0xe86bd1);}return _0x2963a7[_0x70e1('0x22')]();};}function saveUpdates(_0x17442e,_0xdb1503){return function(_0x42400c){if(_0x42400c){return _0x42400c[_0x70e1('0x23')](_0x17442e)[_0x70e1('0x24')](function(_0x1299a2){return _0x1299a2;});}return null;};}function removeEntity(_0x17631b,_0x3afc9b){return function(_0x1bd254){if(_0x1bd254){return _0x1bd254['destroy']()[_0x70e1('0x24')](function(){var _0x5a59ff=_0x1bd254['get']({'plain':!![]});var _0x1b4043=_0x70e1('0x25');return db[_0x70e1('0x26')][_0x70e1('0x27')]({'where':{'type':_0x1b4043,'resourceId':_0x5a59ff['id']}})[_0x70e1('0x24')](function(){return _0x1bd254;});})[_0x70e1('0x24')](function(){_0x17631b['status'](0xcc)[_0x70e1('0x1b')]();});}};}function handleEntityNotFound(_0x2f418b,_0x13cc1c){return function(_0x223474){if(!_0x223474){_0x2f418b['sendStatus'](0x194);}return _0x223474;};}function handleError(_0x181abc,_0x1b5dd0){_0x1b5dd0=_0x1b5dd0||0x1f4;return function(_0x15ded4){logger['error'](_0x15ded4[_0x70e1('0x28')]);if(_0x15ded4[_0x70e1('0x29')]){delete _0x15ded4[_0x70e1('0x29')];}_0x181abc[_0x70e1('0x1a')](_0x1b5dd0)[_0x70e1('0x2a')](_0x15ded4);};}exports[_0x70e1('0x2b')]=function(_0x49a5a9,_0x47c97c){var _0x266fb0={},_0x47a096={},_0x5bc816={'count':0x0,'rows':[]};var _0x1e84b0=_[_0x70e1('0x2c')](db[_0x70e1('0x2d')]['rawAttributes'],function(_0x54d187){return{'name':_0x54d187['fieldName'],'type':_0x54d187[_0x70e1('0x2e')][_0x70e1('0x2f')]};});_0x47a096[_0x70e1('0x30')]=_[_0x70e1('0x2c')](_0x1e84b0,_0x70e1('0x29'));_0x47a096[_0x70e1('0x31')]=_[_0x70e1('0x32')](_0x49a5a9[_0x70e1('0x31')]);_0x47a096['filters']=_[_0x70e1('0x33')](_0x47a096[_0x70e1('0x30')],_0x47a096['query']);_0x266fb0[_0x70e1('0x34')]=_[_0x70e1('0x33')](_0x47a096[_0x70e1('0x30')],qs[_0x70e1('0x35')](_0x49a5a9['query'][_0x70e1('0x35')]));_0x266fb0[_0x70e1('0x34')]=_0x266fb0[_0x70e1('0x34')][_0x70e1('0x36')]?_0x266fb0[_0x70e1('0x34')]:_0x47a096[_0x70e1('0x30')];if(!_0x49a5a9['query']['hasOwnProperty']('nolimit')){_0x266fb0[_0x70e1('0x1f')]=qs[_0x70e1('0x1f')](_0x49a5a9[_0x70e1('0x31')]['limit']);_0x266fb0['offset']=qs[_0x70e1('0x1e')](_0x49a5a9[_0x70e1('0x31')]['offset']);}_0x266fb0[_0x70e1('0x37')]=qs[_0x70e1('0x38')](_0x49a5a9[_0x70e1('0x31')][_0x70e1('0x38')]);_0x266fb0[_0x70e1('0x39')]=qs[_0x70e1('0x3a')](_[_0x70e1('0x3b')](_0x49a5a9[_0x70e1('0x31')],_0x47a096['filters']),_0x1e84b0);if(_0x49a5a9[_0x70e1('0x31')][_0x70e1('0x3c')]){_0x266fb0['where']=_['merge'](_0x266fb0['where'],{'$or':_['map'](_0x1e84b0,function(_0x2d5289){if(_0x2d5289[_0x70e1('0x2e')]!==_0x70e1('0x3d')){var _0x2b600c={};_0x2b600c[_0x2d5289[_0x70e1('0x29')]]={'$like':'%'+_0x49a5a9[_0x70e1('0x31')][_0x70e1('0x3c')]+'%'};return _0x2b600c;}})});}_0x266fb0=_[_0x70e1('0x3e')]({},_0x266fb0,_0x49a5a9[_0x70e1('0x3f')]);var _0x94b47f={'where':_0x266fb0['where']};return db[_0x70e1('0x2d')][_0x70e1('0x1d')](_0x94b47f)['then'](function(_0x30d8a0){_0x5bc816[_0x70e1('0x1d')]=_0x30d8a0;if(_0x49a5a9['query']['includeAll']){_0x266fb0[_0x70e1('0x40')]=[{'all':!![]}];}return db['Trigger']['findAll'](_0x266fb0);})[_0x70e1('0x24')](function(_0x5c903d){_0x5bc816[_0x70e1('0x41')]=_0x5c903d;return _0x5bc816;})['then'](respondWithFilteredResult(_0x47c97c,_0x266fb0))[_0x70e1('0x42')](handleError(_0x47c97c,null));};exports['show']=function(_0x47ac6f,_0x1ad9d3){var _0x443804={'raw':![],'where':{'id':_0x47ac6f[_0x70e1('0x43')]['id']}},_0x3c9a98={};_0x3c9a98[_0x70e1('0x30')]=_[_0x70e1('0x32')](db[_0x70e1('0x2d')]['rawAttributes']);_0x3c9a98[_0x70e1('0x31')]=_[_0x70e1('0x32')](_0x47ac6f[_0x70e1('0x31')]);_0x3c9a98[_0x70e1('0x3a')]=_['intersection'](_0x3c9a98['model'],_0x3c9a98[_0x70e1('0x31')]);_0x443804[_0x70e1('0x34')]=_['intersection'](_0x3c9a98[_0x70e1('0x30')],qs['fields'](_0x47ac6f[_0x70e1('0x31')]['fields']));_0x443804[_0x70e1('0x34')]=_0x443804[_0x70e1('0x34')]['length']?_0x443804[_0x70e1('0x34')]:_0x3c9a98[_0x70e1('0x30')];if(_0x47ac6f['query'][_0x70e1('0x44')]){_0x443804[_0x70e1('0x40')]=[{'all':!![]}];}_0x443804=_[_0x70e1('0x3e')]({},_0x443804,_0x47ac6f[_0x70e1('0x3f')]);return db[_0x70e1('0x2d')]['find'](_0x443804)[_0x70e1('0x24')](handleEntityNotFound(_0x1ad9d3,null))[_0x70e1('0x24')](respondWithResult(_0x1ad9d3,null))[_0x70e1('0x42')](handleError(_0x1ad9d3,null));};exports[_0x70e1('0x45')]=function(_0xdd7d43,_0x2794d7){return db[_0x70e1('0x2d')][_0x70e1('0x45')](_0xdd7d43[_0x70e1('0x46')],{})[_0x70e1('0x24')](function(_0x1e0410){var _0xf30d81=_0xdd7d43[_0x70e1('0x47')][_0x70e1('0x48')]({'plain':!![]});if(!_0xf30d81)throw new Error(_0x70e1('0x49'));if(_0xf30d81[_0x70e1('0x4a')]===_0x70e1('0x47')){var _0x1de95e=_0x1e0410[_0x70e1('0x48')]({'plain':!![]});var _0x289ac2='Triggers';return db[_0x70e1('0x4b')]['find']({'where':{'name':_0x289ac2,'userProfileId':_0xf30d81[_0x70e1('0x4c')]},'raw':!![]})[_0x70e1('0x24')](function(_0x15250e){if(_0x15250e&&_0x15250e[_0x70e1('0x4d')]===0x0){return db[_0x70e1('0x26')][_0x70e1('0x45')]({'name':_0x1de95e[_0x70e1('0x29')],'resourceId':_0x1de95e['id'],'type':_0x15250e['name'],'sectionId':_0x15250e['id']},{})[_0x70e1('0x24')](function(){return _0x1e0410;});}else{return _0x1e0410;}})['catch'](function(_0x4da97c){logger[_0x70e1('0x4e')](_0x70e1('0x4f'),_0x4da97c);throw _0x4da97c;});}return _0x1e0410;})[_0x70e1('0x24')](respondWithResult(_0x2794d7,0xc9))[_0x70e1('0x42')](handleError(_0x2794d7,null));};exports[_0x70e1('0x23')]=function(_0x33af2b,_0x5d1d9f){if(_0x33af2b[_0x70e1('0x46')]['id']){delete _0x33af2b[_0x70e1('0x46')]['id'];}return db[_0x70e1('0x2d')][_0x70e1('0x50')]({'where':{'id':_0x33af2b[_0x70e1('0x43')]['id']}})[_0x70e1('0x24')](handleEntityNotFound(_0x5d1d9f,null))[_0x70e1('0x24')](saveUpdates(_0x33af2b[_0x70e1('0x46')],null))[_0x70e1('0x24')](respondWithResult(_0x5d1d9f,null))[_0x70e1('0x42')](handleError(_0x5d1d9f,null));};exports[_0x70e1('0x27')]=function(_0x2af15e,_0x420675){return db[_0x70e1('0x2d')][_0x70e1('0x50')]({'where':{'id':_0x2af15e['params']['id']}})[_0x70e1('0x24')](handleEntityNotFound(_0x420675,null))[_0x70e1('0x24')](removeEntity(_0x420675,null))[_0x70e1('0x42')](handleError(_0x420675,null));};exports[_0x70e1('0x51')]=function(_0x34e725,_0x53634b,_0x36f3bd){if(_0x34e725[_0x70e1('0x46')]['id']){delete _0x34e725['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x34e725[_0x70e1('0x43')]['id']}})['then'](handleEntityNotFound(_0x53634b,null))[_0x70e1('0x24')](function(_0x194ffc){if(_0x194ffc){_0x34e725[_0x70e1('0x46')][_0x70e1('0x52')]=_0x194ffc['id'];return db['Condition'][_0x70e1('0x45')](_0x34e725[_0x70e1('0x46')]);}})['then'](respondWithResult(_0x53634b,null))['catch'](handleError(_0x53634b,null));};exports[_0x70e1('0x53')]=function(_0x14354c,_0x41a14e,_0x267479){if(_0x14354c[_0x70e1('0x46')]['id']){delete _0x14354c[_0x70e1('0x46')]['id'];}return db['Trigger']['find']({'where':{'id':_0x14354c[_0x70e1('0x43')]['id']}})[_0x70e1('0x24')](handleEntityNotFound(_0x41a14e,null))[_0x70e1('0x24')](function(_0x391dd9){if(_0x391dd9){_0x14354c[_0x70e1('0x46')][_0x70e1('0x54')]=_0x391dd9['id'];return db[_0x70e1('0x55')][_0x70e1('0x45')](_0x14354c[_0x70e1('0x46')]);}})[_0x70e1('0x24')](respondWithResult(_0x41a14e,null))[_0x70e1('0x42')](handleError(_0x41a14e,null));};exports['getAllConditions']=function(_0xbceac9,_0x4d4201,_0x469a81){var _0x29945d={};var _0x2b7662={};var _0x5d6e58;var _0x17727f;return db['Trigger'][_0x70e1('0x56')]({'where':{'id':_0xbceac9[_0x70e1('0x43')]['id']}})[_0x70e1('0x24')](handleEntityNotFound(_0x4d4201,null))[_0x70e1('0x24')](function(_0x3dccd8){if(_0x3dccd8){_0x5d6e58=_0x3dccd8;_0x2b7662[_0x70e1('0x30')]=_[_0x70e1('0x32')](db[_0x70e1('0x55')][_0x70e1('0x57')]);_0x2b7662['query']=_['keys'](_0xbceac9[_0x70e1('0x31')]);_0x2b7662['filters']=_['intersection'](_0x2b7662[_0x70e1('0x30')],_0x2b7662[_0x70e1('0x31')]);_0x29945d['attributes']=_['intersection'](_0x2b7662[_0x70e1('0x30')],qs[_0x70e1('0x35')](_0xbceac9[_0x70e1('0x31')][_0x70e1('0x35')]));_0x29945d[_0x70e1('0x34')]=_0x29945d['attributes'][_0x70e1('0x36')]?_0x29945d[_0x70e1('0x34')]:_0x2b7662[_0x70e1('0x30')];_0x29945d[_0x70e1('0x37')]=qs[_0x70e1('0x38')](_0xbceac9[_0x70e1('0x31')]['sort']);_0x29945d[_0x70e1('0x39')]=qs[_0x70e1('0x3a')](_[_0x70e1('0x3b')](_0xbceac9[_0x70e1('0x31')],_0x2b7662[_0x70e1('0x3a')]));if(_0xbceac9[_0x70e1('0x31')]['filter']){_0x29945d[_0x70e1('0x39')]=_[_0x70e1('0x3e')](_0x29945d[_0x70e1('0x39')],{'$or':_[_0x70e1('0x2c')](_0x29945d[_0x70e1('0x34')],function(_0x523d7f){var _0x3539cf={};_0x3539cf[_0x523d7f]={'$like':'%'+_0xbceac9[_0x70e1('0x31')][_0x70e1('0x3c')]+'%'};return _0x3539cf;})});}_0x29945d=_[_0x70e1('0x3e')]({},_0x29945d,_0xbceac9['options']);return _0x5d6e58[_0x70e1('0x58')](_0x29945d);}})[_0x70e1('0x24')](function(_0x379831){if(_0x379831){_0x17727f=_0x379831[_0x70e1('0x36')];if(!_0xbceac9['query']['hasOwnProperty'](_0x70e1('0x59'))){_0x29945d[_0x70e1('0x1f')]=qs[_0x70e1('0x1f')](_0xbceac9['query']['limit']);_0x29945d[_0x70e1('0x1e')]=qs[_0x70e1('0x1e')](_0xbceac9[_0x70e1('0x31')][_0x70e1('0x1e')]);}return _0x5d6e58[_0x70e1('0x58')](_0x29945d);}})[_0x70e1('0x24')](function(_0x3c0cb3){if(_0x3c0cb3){return _0x3c0cb3?{'count':_0x17727f,'rows':_0x3c0cb3}:null;}})[_0x70e1('0x24')](respondWithResult(_0x4d4201,null))[_0x70e1('0x42')](handleError(_0x4d4201,null));};exports[_0x70e1('0x5a')]=function(_0x53900d,_0x636047,_0x4441ed){var _0x46b38b={};var _0x2580d7={};var _0x415720;var _0x1e8a56;return db[_0x70e1('0x2d')]['findOne']({'where':{'id':_0x53900d[_0x70e1('0x43')]['id']}})[_0x70e1('0x24')](handleEntityNotFound(_0x636047,null))[_0x70e1('0x24')](function(_0x43d5f8){if(_0x43d5f8){_0x415720=_0x43d5f8;_0x2580d7[_0x70e1('0x30')]=_['keys'](db['Condition']['rawAttributes']);_0x2580d7[_0x70e1('0x31')]=_['keys'](_0x53900d[_0x70e1('0x31')]);_0x2580d7['filters']=_[_0x70e1('0x33')](_0x2580d7[_0x70e1('0x30')],_0x2580d7['query']);_0x46b38b['attributes']=_[_0x70e1('0x33')](_0x2580d7[_0x70e1('0x30')],qs[_0x70e1('0x35')](_0x53900d[_0x70e1('0x31')]['fields']));_0x46b38b['attributes']=_0x46b38b[_0x70e1('0x34')][_0x70e1('0x36')]?_0x46b38b[_0x70e1('0x34')]:_0x2580d7[_0x70e1('0x30')];_0x46b38b['order']=qs['sort'](_0x53900d[_0x70e1('0x31')][_0x70e1('0x38')]);_0x46b38b[_0x70e1('0x39')]=qs[_0x70e1('0x3a')](_[_0x70e1('0x3b')](_0x53900d[_0x70e1('0x31')],_0x2580d7['filters']));if(_0x53900d[_0x70e1('0x31')]['filter']){_0x46b38b[_0x70e1('0x39')]=_[_0x70e1('0x3e')](_0x46b38b[_0x70e1('0x39')],{'$or':_[_0x70e1('0x2c')](_0x46b38b[_0x70e1('0x34')],function(_0x15fd76){var _0x17a677={};_0x17a677[_0x15fd76]={'$like':'%'+_0x53900d[_0x70e1('0x31')][_0x70e1('0x3c')]+'%'};return _0x17a677;})});}_0x46b38b=_['merge']({},_0x46b38b,_0x53900d[_0x70e1('0x3f')]);return _0x415720[_0x70e1('0x5a')](_0x46b38b);}})['then'](function(_0x4d491d){if(_0x4d491d){_0x1e8a56=_0x4d491d[_0x70e1('0x36')];if(!_0x53900d[_0x70e1('0x31')][_0x70e1('0x5b')](_0x70e1('0x59'))){_0x46b38b[_0x70e1('0x1f')]=qs[_0x70e1('0x1f')](_0x53900d[_0x70e1('0x31')][_0x70e1('0x1f')]);_0x46b38b['offset']=qs[_0x70e1('0x1e')](_0x53900d[_0x70e1('0x31')][_0x70e1('0x1e')]);}return _0x415720[_0x70e1('0x5a')](_0x46b38b);}})[_0x70e1('0x24')](function(_0x25ce8c){if(_0x25ce8c){return _0x25ce8c?{'count':_0x1e8a56,'rows':_0x25ce8c}:null;}})[_0x70e1('0x24')](respondWithResult(_0x636047,null))[_0x70e1('0x42')](handleError(_0x636047,null));};exports['addAction']=function(_0x41298c,_0x29acc2,_0x26a51e){if(_0x41298c[_0x70e1('0x46')]['id']){delete _0x41298c[_0x70e1('0x46')]['id'];}return db[_0x70e1('0x2d')][_0x70e1('0x50')]({'where':{'id':_0x41298c[_0x70e1('0x43')]['id']}})['then'](handleEntityNotFound(_0x29acc2,null))[_0x70e1('0x24')](function(_0x2b6c3d){if(_0x2b6c3d){_0x41298c[_0x70e1('0x46')][_0x70e1('0x5c')]=_0x2b6c3d['id'];return db[_0x70e1('0x5d')][_0x70e1('0x45')](_0x41298c[_0x70e1('0x46')]);}})['then'](respondWithResult(_0x29acc2,null))[_0x70e1('0x42')](handleError(_0x29acc2,null));};exports[_0x70e1('0x5e')]=function(_0x4b9d02,_0x4682fc,_0x538a87){var _0x5dabd3={};var _0x344b93={};var _0x1ef09b;var _0xbd7894;return db['Trigger']['findOne']({'where':{'id':_0x4b9d02[_0x70e1('0x43')]['id']}})['then'](handleEntityNotFound(_0x4682fc,null))[_0x70e1('0x24')](function(_0x11d31b){if(_0x11d31b){_0x1ef09b=_0x11d31b;_0x344b93[_0x70e1('0x30')]=_[_0x70e1('0x32')](db[_0x70e1('0x5d')]['rawAttributes']);_0x344b93['query']=_[_0x70e1('0x32')](_0x4b9d02[_0x70e1('0x31')]);_0x344b93[_0x70e1('0x3a')]=_[_0x70e1('0x33')](_0x344b93[_0x70e1('0x30')],_0x344b93['query']);_0x5dabd3[_0x70e1('0x34')]=_[_0x70e1('0x33')](_0x344b93[_0x70e1('0x30')],qs[_0x70e1('0x35')](_0x4b9d02[_0x70e1('0x31')][_0x70e1('0x35')]));_0x5dabd3['attributes']=_0x5dabd3[_0x70e1('0x34')]['length']?_0x5dabd3[_0x70e1('0x34')]:_0x344b93[_0x70e1('0x30')];_0x5dabd3[_0x70e1('0x37')]=qs['sort'](_0x4b9d02[_0x70e1('0x31')]['sort']);_0x5dabd3[_0x70e1('0x39')]=qs[_0x70e1('0x3a')](_[_0x70e1('0x3b')](_0x4b9d02[_0x70e1('0x31')],_0x344b93['filters']));if(_0x4b9d02['query']['filter']){_0x5dabd3['where']=_['merge'](_0x5dabd3['where'],{'$or':_[_0x70e1('0x2c')](_0x5dabd3[_0x70e1('0x34')],function(_0x4cf6af){var _0x247238={};_0x247238[_0x4cf6af]={'$like':'%'+_0x4b9d02['query'][_0x70e1('0x3c')]+'%'};return _0x247238;})});}_0x5dabd3=_[_0x70e1('0x3e')]({},_0x5dabd3,_0x4b9d02[_0x70e1('0x3f')]);return _0x1ef09b[_0x70e1('0x5e')](_0x5dabd3);}})[_0x70e1('0x24')](function(_0x32634e){if(_0x32634e){_0xbd7894=_0x32634e[_0x70e1('0x36')];if(!_0x4b9d02[_0x70e1('0x31')]['hasOwnProperty'](_0x70e1('0x59'))){_0x5dabd3[_0x70e1('0x1f')]=qs[_0x70e1('0x1f')](_0x4b9d02[_0x70e1('0x31')][_0x70e1('0x1f')]);_0x5dabd3[_0x70e1('0x1e')]=qs['offset'](_0x4b9d02[_0x70e1('0x31')][_0x70e1('0x1e')]);}return _0x1ef09b[_0x70e1('0x5e')](_0x5dabd3);}})['then'](function(_0x52514b){if(_0x52514b){return _0x52514b?{'count':_0xbd7894,'rows':_0x52514b}:null;}})[_0x70e1('0x24')](respondWithResult(_0x4682fc,null))[_0x70e1('0x42')](handleError(_0x4682fc,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 656b84c..0cb167f 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 _0x1173=['exports','define','Trigger','tools_triggers','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./trigger.attributes'];(function(_0x4b6ccc,_0x146dc3){var _0x15e250=function(_0xef70d5){while(--_0xef70d5){_0x4b6ccc['push'](_0x4b6ccc['shift']());}};_0x15e250(++_0x146dc3);}(_0x1173,0x138));var _0x3117=function(_0x427094,_0x412378){_0x427094=_0x427094-0x0;var _0x24f773=_0x1173[_0x427094];return _0x24f773;};'use strict';var _=require('lodash');var util=require(_0x3117('0x0'));var logger=require(_0x3117('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3117('0x2'));var rp=require(_0x3117('0x3'));var fs=require('fs');var path=require(_0x3117('0x4'));var rimraf=require('rimraf');var config=require(_0x3117('0x5'));var attributes=require(_0x3117('0x6'));module[_0x3117('0x7')]=function(_0x32e084,_0x3a38b){return _0x32e084[_0x3117('0x8')](_0x3117('0x9'),attributes,{'tableName':_0x3117('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbce=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./trigger.attributes','define','Trigger','tools_triggers','lodash','util'];(function(_0x40ebdb,_0x426b91){var _0x20833b=function(_0x1df348){while(--_0x1df348){_0x40ebdb['push'](_0x40ebdb['shift']());}};_0x20833b(++_0x426b91);}(_0xbbce,0x15a));var _0xebbc=function(_0xf59b8,_0x4ae94f){_0xf59b8=_0xf59b8-0x0;var _0xcbb55f=_0xbbce[_0xf59b8];return _0xcbb55f;};'use strict';var _=require(_0xebbc('0x0'));var util=require(_0xebbc('0x1'));var logger=require(_0xebbc('0x2'))(_0xebbc('0x3'));var moment=require(_0xebbc('0x4'));var BPromise=require('bluebird');var rp=require(_0xebbc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xebbc('0x6'));var config=require(_0xebbc('0x7'));var attributes=require(_0xebbc('0x8'));module['exports']=function(_0x2eeddb,_0x1ed3db){return _0x2eeddb[_0xebbc('0x9')](_0xebbc('0xa'),attributes,{'tableName':_0xebbc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 6ba8dc3..d236d12 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 _0x1c9a=['limit','include','map','attributes','model','ShowTrigger','find','where','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','findAll','options','raw'];(function(_0x5b80a9,_0x42a5e0){var _0x268eba=function(_0x39e065){while(--_0x39e065){_0x5b80a9['push'](_0x5b80a9['shift']());}};_0x268eba(++_0x42a5e0);}(_0x1c9a,0x98));var _0xa1c9=function(_0x51d824,_0x121043){_0x51d824=_0x51d824-0x0;var _0x125cfc=_0x1c9a[_0x51d824];return _0x125cfc;};'use strict';var _=require(_0xa1c9('0x0'));var util=require('util');var moment=require(_0xa1c9('0x1'));var BPromise=require('bluebird');var rs=require(_0xa1c9('0x2'));var fs=require('fs');var Redis=require(_0xa1c9('0x3'));var db=require(_0xa1c9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1c9('0x5'))(_0xa1c9('0x6'));var config=require(_0xa1c9('0x7'));var jayson=require(_0xa1c9('0x8'));var client=jayson['client'][_0xa1c9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5448f2,_0x222624,_0x463c9c){return new BPromise(function(_0x3f07c2,_0x5059df){return client[_0xa1c9('0xa')](_0x5448f2,_0x463c9c)[_0xa1c9('0xb')](function(_0x24136d){logger[_0xa1c9('0xc')]('Trigger,\x20%s,\x20%s',_0x222624,_0xa1c9('0xd'));logger[_0xa1c9('0xe')](_0xa1c9('0xf'),_0x222624,_0xa1c9('0xd'),JSON[_0xa1c9('0x10')](_0x24136d));if(_0x24136d[_0xa1c9('0x11')]){if(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x12')]===0x1f4){logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x222624,_0x24136d['error'][_0xa1c9('0x14')]);return _0x5059df(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x14')]);}logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x222624,_0x24136d['error'][_0xa1c9('0x14')]);return _0x3f07c2(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x14')]);}else{logger[_0xa1c9('0xc')](_0xa1c9('0x13'),_0x222624,_0xa1c9('0xd'));_0x3f07c2(_0x24136d[_0xa1c9('0x15')][_0xa1c9('0x14')]);}})[_0xa1c9('0x16')](function(_0x373f5d){logger['error'](_0xa1c9('0x13'),_0x222624,_0x373f5d);_0x5059df(_0x373f5d);});});}exports[_0xa1c9('0x17')]=function(_0x224ae4){var _0x50db9b=this;return new Promise(function(_0x2fb81e,_0x5ab911){return db[_0xa1c9('0x18')][_0xa1c9('0x19')]({'raw':_0x224ae4[_0xa1c9('0x1a')]?_0x224ae4['options'][_0xa1c9('0x1b')]===undefined?!![]:![]:!![],'where':_0x224ae4[_0xa1c9('0x1a')]?_0x224ae4[_0xa1c9('0x1a')]['where']||null:null,'attributes':_0x224ae4[_0xa1c9('0x1a')]?_0x224ae4[_0xa1c9('0x1a')]['attributes']||null:null,'limit':_0x224ae4[_0xa1c9('0x1a')]?_0x224ae4[_0xa1c9('0x1a')][_0xa1c9('0x1c')]||null:null,'include':_0x224ae4['options']?_0x224ae4[_0xa1c9('0x1a')][_0xa1c9('0x1d')]?_[_0xa1c9('0x1e')](_0x224ae4[_0xa1c9('0x1a')][_0xa1c9('0x1d')],function(_0x4a0a0c){return{'model':db[_0x4a0a0c['model']],'as':_0x4a0a0c['as'],'attributes':_0x4a0a0c[_0xa1c9('0x1f')],'include':_0x4a0a0c['include']?_[_0xa1c9('0x1e')](_0x4a0a0c[_0xa1c9('0x1d')],function(_0x1c6f37){return{'model':db[_0x1c6f37[_0xa1c9('0x20')]],'as':_0x1c6f37['as'],'attributes':_0x1c6f37[_0xa1c9('0x1f')],'include':_0x1c6f37['include']?_[_0xa1c9('0x1e')](_0x1c6f37[_0xa1c9('0x1d')],function(_0x20cbe1){return{'model':db[_0x20cbe1['model']],'as':_0x20cbe1['as'],'attributes':_0x20cbe1[_0xa1c9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa1c9('0xb')](function(_0x1ca443){logger['info'](_0xa1c9('0x17'),_0x224ae4);logger[_0xa1c9('0xe')]('GetTrigger',_0x224ae4,JSON[_0xa1c9('0x10')](_0x1ca443));_0x2fb81e(_0x1ca443);})['catch'](function(_0xdf6d0c){logger[_0xa1c9('0x11')](_0xa1c9('0x17'),_0xdf6d0c[_0xa1c9('0x14')],_0x224ae4);_0x5ab911(_0x50db9b[_0xa1c9('0x11')](0x1f4,_0xdf6d0c[_0xa1c9('0x14')]));});});};exports[_0xa1c9('0x21')]=function(_0x58b900){var _0x5648b8=this;return new Promise(function(_0x4d23cd,_0x1c7038){return db[_0xa1c9('0x18')][_0xa1c9('0x22')]({'raw':_0x58b900[_0xa1c9('0x1a')]?_0x58b900[_0xa1c9('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x58b900['options']?_0x58b900['options'][_0xa1c9('0x23')]||null:null,'attributes':_0x58b900[_0xa1c9('0x1a')]?_0x58b900[_0xa1c9('0x1a')][_0xa1c9('0x1f')]||null:null,'include':_0x58b900[_0xa1c9('0x1a')]?_0x58b900[_0xa1c9('0x1a')][_0xa1c9('0x1d')]?_['map'](_0x58b900[_0xa1c9('0x1a')]['include'],function(_0x1b8707){return{'model':db[_0x1b8707['model']],'as':_0x1b8707['as'],'attributes':_0x1b8707[_0xa1c9('0x1f')],'include':_0x1b8707[_0xa1c9('0x1d')]?_[_0xa1c9('0x1e')](_0x1b8707['include'],function(_0x39818f){return{'model':db[_0x39818f[_0xa1c9('0x20')]],'as':_0x39818f['as'],'attributes':_0x39818f[_0xa1c9('0x1f')],'include':_0x39818f[_0xa1c9('0x1d')]?_['map'](_0x39818f['include'],function(_0x1f1612){return{'model':db[_0x1f1612[_0xa1c9('0x20')]],'as':_0x1f1612['as'],'attributes':_0x1f1612[_0xa1c9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa1c9('0xb')](function(_0x1c0cce){logger[_0xa1c9('0xc')](_0xa1c9('0x21'),_0x58b900);logger[_0xa1c9('0xe')](_0xa1c9('0x21'),_0x58b900,JSON[_0xa1c9('0x10')](_0x1c0cce));_0x4d23cd(_0x1c0cce);})['catch'](function(_0x3e6ec0){logger[_0xa1c9('0x11')](_0xa1c9('0x21'),_0x3e6ec0[_0xa1c9('0x14')],_0x58b900);_0x1c7038(_0x5648b8[_0xa1c9('0x11')](0x1f4,_0x3e6ec0[_0xa1c9('0x14')]));});});}; \ No newline at end of file +var _0x5423=['options','raw','where','limit','include','attributes','map','model','then','ShowTrigger','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','findAll'];(function(_0x38c868,_0x35b526){var _0x15212b=function(_0x4216ae){while(--_0x4216ae){_0x38c868['push'](_0x38c868['shift']());}};_0x15212b(++_0x35b526);}(_0x5423,0xe3));var _0x3542=function(_0x4e1b78,_0x543457){_0x4e1b78=_0x4e1b78-0x0;var _0x2f5220=_0x5423[_0x4e1b78];return _0x2f5220;};'use strict';var _=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var moment=require('moment');var BPromise=require(_0x3542('0x2'));var rs=require(_0x3542('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3542('0x4'))['db'];var utils=require(_0x3542('0x5'));var logger=require(_0x3542('0x6'))(_0x3542('0x7'));var config=require('../../config/environment');var jayson=require(_0x3542('0x8'));var client=jayson[_0x3542('0x9')][_0x3542('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29c3fa,_0x2e1a62,_0x55413c){return new BPromise(function(_0x4cdc86,_0xbc51ab){return client[_0x3542('0xb')](_0x29c3fa,_0x55413c)['then'](function(_0x681195){logger[_0x3542('0xc')]('Trigger,\x20%s,\x20%s',_0x2e1a62,_0x3542('0xd'));logger[_0x3542('0xe')]('Trigger,\x20%s,\x20%s,\x20%s',_0x2e1a62,_0x3542('0xd'),JSON[_0x3542('0xf')](_0x681195));if(_0x681195[_0x3542('0x10')]){if(_0x681195[_0x3542('0x10')][_0x3542('0x11')]===0x1f4){logger[_0x3542('0x10')](_0x3542('0x12'),_0x2e1a62,_0x681195[_0x3542('0x10')][_0x3542('0x13')]);return _0xbc51ab(_0x681195[_0x3542('0x10')][_0x3542('0x13')]);}logger[_0x3542('0x10')](_0x3542('0x12'),_0x2e1a62,_0x681195['error'][_0x3542('0x13')]);return _0x4cdc86(_0x681195['error'][_0x3542('0x13')]);}else{logger[_0x3542('0xc')](_0x3542('0x12'),_0x2e1a62,'request\x20sent');_0x4cdc86(_0x681195[_0x3542('0x14')][_0x3542('0x13')]);}})[_0x3542('0x15')](function(_0x5726af){logger[_0x3542('0x10')](_0x3542('0x12'),_0x2e1a62,_0x5726af);_0xbc51ab(_0x5726af);});});}exports[_0x3542('0x16')]=function(_0x3d5199){var _0x493d95=this;return new Promise(function(_0x32df3f,_0x53d4aa){return db[_0x3542('0x17')][_0x3542('0x18')]({'raw':_0x3d5199['options']?_0x3d5199[_0x3542('0x19')][_0x3542('0x1a')]===undefined?!![]:![]:!![],'where':_0x3d5199[_0x3542('0x19')]?_0x3d5199[_0x3542('0x19')][_0x3542('0x1b')]||null:null,'attributes':_0x3d5199['options']?_0x3d5199['options']['attributes']||null:null,'limit':_0x3d5199[_0x3542('0x19')]?_0x3d5199['options'][_0x3542('0x1c')]||null:null,'include':_0x3d5199['options']?_0x3d5199[_0x3542('0x19')]['include']?_['map'](_0x3d5199[_0x3542('0x19')][_0x3542('0x1d')],function(_0x5ae097){return{'model':db[_0x5ae097['model']],'as':_0x5ae097['as'],'attributes':_0x5ae097[_0x3542('0x1e')],'include':_0x5ae097['include']?_[_0x3542('0x1f')](_0x5ae097[_0x3542('0x1d')],function(_0x1e0723){return{'model':db[_0x1e0723[_0x3542('0x20')]],'as':_0x1e0723['as'],'attributes':_0x1e0723[_0x3542('0x1e')],'include':_0x1e0723[_0x3542('0x1d')]?_[_0x3542('0x1f')](_0x1e0723[_0x3542('0x1d')],function(_0x18dc6c){return{'model':db[_0x18dc6c[_0x3542('0x20')]],'as':_0x18dc6c['as'],'attributes':_0x18dc6c[_0x3542('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3542('0x21')](function(_0x220021){logger[_0x3542('0xc')](_0x3542('0x16'),_0x3d5199);logger[_0x3542('0xe')](_0x3542('0x16'),_0x3d5199,JSON[_0x3542('0xf')](_0x220021));_0x32df3f(_0x220021);})[_0x3542('0x15')](function(_0x5590a2){logger[_0x3542('0x10')](_0x3542('0x16'),_0x5590a2[_0x3542('0x13')],_0x3d5199);_0x53d4aa(_0x493d95['error'](0x1f4,_0x5590a2[_0x3542('0x13')]));});});};exports[_0x3542('0x22')]=function(_0x2e883a){var _0x30b5e8=this;return new Promise(function(_0x5c882f,_0x5a274b){return db[_0x3542('0x17')][_0x3542('0x23')]({'raw':_0x2e883a[_0x3542('0x19')]?_0x2e883a[_0x3542('0x19')][_0x3542('0x1a')]===undefined?!![]:![]:!![],'where':_0x2e883a[_0x3542('0x19')]?_0x2e883a[_0x3542('0x19')]['where']||null:null,'attributes':_0x2e883a['options']?_0x2e883a[_0x3542('0x19')]['attributes']||null:null,'include':_0x2e883a['options']?_0x2e883a[_0x3542('0x19')]['include']?_['map'](_0x2e883a[_0x3542('0x19')][_0x3542('0x1d')],function(_0x1bf178){return{'model':db[_0x1bf178['model']],'as':_0x1bf178['as'],'attributes':_0x1bf178[_0x3542('0x1e')],'include':_0x1bf178['include']?_[_0x3542('0x1f')](_0x1bf178[_0x3542('0x1d')],function(_0x561fd0){return{'model':db[_0x561fd0[_0x3542('0x20')]],'as':_0x561fd0['as'],'attributes':_0x561fd0['attributes'],'include':_0x561fd0[_0x3542('0x1d')]?_[_0x3542('0x1f')](_0x561fd0[_0x3542('0x1d')],function(_0x4cfb8f){return{'model':db[_0x4cfb8f[_0x3542('0x20')]],'as':_0x4cfb8f['as'],'attributes':_0x4cfb8f['attributes']};}):[]};}):[]};}):[]:[]})[_0x3542('0x21')](function(_0x1fe5c6){logger[_0x3542('0xc')](_0x3542('0x22'),_0x2e883a);logger[_0x3542('0xe')](_0x3542('0x22'),_0x2e883a,JSON[_0x3542('0xf')](_0x1fe5c6));_0x5c882f(_0x1fe5c6);})[_0x3542('0x15')](function(_0x110aa8){logger[_0x3542('0x10')](_0x3542('0x22'),_0x110aa8[_0x3542('0x13')],_0x2e883a);_0x5a274b(_0x30b5e8[_0x3542('0x10')](0x1f4,_0x110aa8['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 1d6bd7c..6c7cfd5 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 _0xe14d=['index','show','post','/:id/clone','clone','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated'];(function(_0x2b8baf,_0x289508){var _0x5501a6=function(_0x1dd64f){while(--_0x1dd64f){_0x2b8baf['push'](_0x2b8baf['shift']());}};_0x5501a6(++_0x289508);}(_0xe14d,0x1ee));var _0xde14=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xe14d[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var path=require(_0xde14('0x2'));var timeout=require(_0xde14('0x3'));var express=require('express');var router=express[_0xde14('0x4')]();var auth=require(_0xde14('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xde14('0x6'));var controller=require(_0xde14('0x7'));router[_0xde14('0x8')]('/',auth[_0xde14('0x9')](),controller[_0xde14('0xa')]);router[_0xde14('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xde14('0xb')]);router[_0xde14('0xc')](_0xde14('0xd'),auth[_0xde14('0x9')](),controller[_0xde14('0xe')]);router[_0xde14('0xc')]('/',auth[_0xde14('0x9')](),controller[_0xde14('0xf')]);router['put'](_0xde14('0x10'),auth[_0xde14('0x9')](),controller[_0xde14('0x11')]);router[_0xde14('0x12')](_0xde14('0x10'),auth[_0xde14('0x9')](),controller[_0xde14('0x13')]);module[_0xde14('0x14')]=router; \ No newline at end of file +var _0xa8a8=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone'];(function(_0x1e25bb,_0x2734d8){var _0x3b0395=function(_0x125f69){while(--_0x125f69){_0x1e25bb['push'](_0x1e25bb['shift']());}};_0x3b0395(++_0x2734d8);}(_0xa8a8,0xec));var _0x8a8a=function(_0x71a712,_0xa13b1f){_0x71a712=_0x71a712-0x0;var _0x21e307=_0xa8a8[_0x71a712];return _0x21e307;};'use strict';var multer=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var path=require(_0x8a8a('0x2'));var timeout=require(_0x8a8a('0x3'));var express=require('express');var router=express[_0x8a8a('0x4')]();var auth=require(_0x8a8a('0x5'));var interaction=require(_0x8a8a('0x6'));var config=require(_0x8a8a('0x7'));var controller=require(_0x8a8a('0x8'));router[_0x8a8a('0x9')]('/',auth[_0x8a8a('0xa')](),controller[_0x8a8a('0xb')]);router[_0x8a8a('0x9')](_0x8a8a('0xc'),auth[_0x8a8a('0xa')](),controller[_0x8a8a('0xd')]);router[_0x8a8a('0xe')](_0x8a8a('0xf'),auth[_0x8a8a('0xa')](),controller['clone']);router['post']('/',auth[_0x8a8a('0xa')](),controller['create']);router[_0x8a8a('0x10')](_0x8a8a('0xc'),auth['isAuthenticated'](),controller[_0x8a8a('0x11')]);router[_0x8a8a('0x12')](_0x8a8a('0xc'),auth['isAuthenticated'](),controller[_0x8a8a('0x13')]);module[_0x8a8a('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 8ee5633..5a82f57 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 _0xb740=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','INTEGER','\x22\x22\x20<>','refuse','uac','uas','pai','fingerprint','certificate','active','actpass','sequelize','exports','STRING','ENUM','friend','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','udp','setDataValue','transport','getDataValue','split','rfc2833','info','shortinfo','inband','yes','update','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow'];(function(_0x493d82,_0x9fb603){var _0x12ccf0=function(_0x392fd0){while(--_0x392fd0){_0x493d82['push'](_0x493d82['shift']());}};_0x12ccf0(++_0x9fb603);}(_0xb740,0x187));var _0x0b74=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb740[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0b74('0x0'));module[_0x0b74('0x1')]={'name':{'type':Sequelize[_0x0b74('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x0b74('0x3')](_0x0b74('0x4'),'user',_0x0b74('0x5')),'allowNull':![],'defaultValue':_0x0b74('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0b74('0x6')},'callingpres':{'type':Sequelize[_0x0b74('0x3')](_0x0b74('0x7'),_0x0b74('0x8'),'ALLOWED_FAILED_SCREEN',_0x0b74('0x9'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0x0b74('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x0b74('0x2')]},'remotesecret':{'type':Sequelize[_0x0b74('0x2')]},'transport':{'type':Sequelize[_0x0b74('0x2')],'defaultValue':_0x0b74('0xa'),'set':function(_0x5c0346){this[_0x0b74('0xb')](_0x0b74('0xc'),_0x5c0346?_0x5c0346['join'](','):null);},'get':function(){return this[_0x0b74('0xd')](_0x0b74('0xc'))?this['getDataValue'](_0x0b74('0xc'))[_0x0b74('0xe')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x0b74('0xf'),_0x0b74('0x10'),_0x0b74('0x11'),_0x0b74('0x12'),'auto'),'defaultValue':_0x0b74('0xf')},'directmedia':{'type':Sequelize['ENUM'](_0x0b74('0x13'),'no','nonat',_0x0b74('0x14'),_0x0b74('0x15')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0b74('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x0b74('0x2')]},'nat':{'type':Sequelize[_0x0b74('0x2')],'defaultValue':_0x0b74('0x16'),'set':function(_0x25e744){this[_0x0b74('0xb')](_0x0b74('0x17'),_0x25e744?_0x25e744[_0x0b74('0x18')](','):null);},'get':function(){return this[_0x0b74('0xd')](_0x0b74('0x17'))?this[_0x0b74('0xd')]('nat')['split'](','):null;},'comment':_0x0b74('0x19')},'callgroup':{'type':Sequelize[_0x0b74('0x2')]},'namedcallgroup':{'type':Sequelize[_0x0b74('0x2')]},'pickupgroup':{'type':Sequelize[_0x0b74('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x0b74('0x2')]},'language':{'type':Sequelize[_0x0b74('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0b74('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x0b74('0x2')],'defaultValue':_0x0b74('0x1a')},'allow':{'type':Sequelize[_0x0b74('0x2')],'allowNull':![],'defaultValue':_0x0b74('0x1b'),'set':function(_0x249e50){this['setDataValue'](_0x0b74('0x1c'),_0x249e50?_0x249e50[_0x0b74('0x18')](';'):_0x0b74('0x1b'));},'get':function(){return this[_0x0b74('0xd')]('allow')?this[_0x0b74('0xd')](_0x0b74('0x1c'))[_0x0b74('0xe')](';'):null;},'comment':_0x0b74('0x1d')},'autoframing':{'type':Sequelize[_0x0b74('0x3')](_0x0b74('0x13'),'no')},'insecure':{'type':Sequelize[_0x0b74('0x2')],'defaultValue':_0x0b74('0x1e'),'set':function(_0x254090){this[_0x0b74('0xb')](_0x0b74('0x1f'),_0x254090?_0x254090[_0x0b74('0x18')](','):null);},'get':function(){return this[_0x0b74('0xd')](_0x0b74('0x1f'))?this[_0x0b74('0xd')]('insecure')[_0x0b74('0xe')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x0b74('0x13'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0b74('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0b74('0x3')]('yes','no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0x0b74('0x13'),'no')},'useclientcode':{'type':Sequelize[_0x0b74('0x3')](_0x0b74('0x13'),'no')},'accountcode':{'type':Sequelize[_0x0b74('0x20')](0xb)},'setvar':{'type':Sequelize[_0x0b74('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x0b74('0x21')},'amaflags':{'type':Sequelize[_0x0b74('0x2')]},'callcounter':{'type':Sequelize[_0x0b74('0x3')](_0x0b74('0x13'),'no'),'defaultValue':_0x0b74('0x13')},'busylevel':{'type':Sequelize[_0x0b74('0x20')](0xb)},'allowoverlap':{'type':Sequelize[_0x0b74('0x3')](_0x0b74('0x13'),'no')},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no')},'allowtransfer':{'type':Sequelize[_0x0b74('0x3')](_0x0b74('0x13'),'no')},'ignoresdpversion':{'type':Sequelize[_0x0b74('0x3')](_0x0b74('0x13'),'no')},'subscribecontext':{'type':Sequelize[_0x0b74('0x2')]},'template':{'type':Sequelize[_0x0b74('0x2')]},'videosupport':{'type':Sequelize[_0x0b74('0x3')]('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x0b74('0x3')](_0x0b74('0x13'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x0b74('0x3')]('accept',_0x0b74('0x22'),'originate')},'session_expires':{'type':Sequelize[_0x0b74('0x20')](0xb)},'session_minse':{'type':Sequelize[_0x0b74('0x20')](0xb)},'session_refresher':{'type':Sequelize[_0x0b74('0x3')](_0x0b74('0x23'),'uas'),'defaultValue':_0x0b74('0x24')},'t38pt_usertpsource':{'type':Sequelize[_0x0b74('0x2')]},'regexten':{'type':Sequelize[_0x0b74('0x2')]},'fromdomain':{'type':Sequelize[_0x0b74('0x2')]},'fromuser':{'type':Sequelize[_0x0b74('0x2')]},'port':{'type':Sequelize[_0x0b74('0x20')](0x5)},'qualify':{'type':Sequelize[_0x0b74('0x3')]('yes','no'),'defaultValue':_0x0b74('0x13')},'keepalive':{'type':Sequelize[_0x0b74('0x20')](0xb)},'defaultip':{'type':Sequelize[_0x0b74('0x2')]},'defaultuser':{'type':Sequelize[_0x0b74('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x0b74('0x20')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x0b74('0x20')](0xb)},'sendrpid':{'type':Sequelize[_0x0b74('0x3')](_0x0b74('0x13'),'no',_0x0b74('0x25')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0b74('0x2')]},'callbackextension':{'type':Sequelize[_0x0b74('0x2')]},'timert1':{'type':Sequelize[_0x0b74('0x20')](0xb)},'timerb':{'type':Sequelize[_0x0b74('0x20')](0xb)},'qualifyfreq':{'type':Sequelize[_0x0b74('0x20')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x0b74('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x0b74('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x0b74('0x20')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x0b74('0x13'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0b74('0x3')]('yes','no')},'force_avp':{'type':Sequelize[_0x0b74('0x3')](_0x0b74('0x13'),'no')},'icesupport':{'type':Sequelize[_0x0b74('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x0b74('0x13'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x0b74('0x13'),'no',_0x0b74('0x26'),_0x0b74('0x27'))},'dtlsrekey':{'type':Sequelize[_0x0b74('0x20')](0xb)},'dtlscertfile':{'type':Sequelize[_0x0b74('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x0b74('0x2')]},'dtlscipher':{'type':Sequelize[_0x0b74('0x2')]},'dtlscafile':{'type':Sequelize[_0x0b74('0x2')]},'dtlscapath':{'type':Sequelize[_0x0b74('0x2')]},'dtlssetup':{'type':Sequelize[_0x0b74('0x3')](_0x0b74('0x28'),'passive',_0x0b74('0x29')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0b74('0x2')]},'usereqphone':{'type':Sequelize[_0x0b74('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x0b74('0x2')]},'recordofffeature':{'type':Sequelize[_0x0b74('0x2')]},'call_limit':{'type':Sequelize[_0x0b74('0x20')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x0b74('0x3')](_0x0b74('0x13'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x0b74('0x13'),'no')},'vmexten':{'type':Sequelize[_0x0b74('0x2')]},'mohinterpret':{'type':Sequelize[_0x0b74('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0b74('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x0b74('0x3')]('yes','no','nonat',_0x0b74('0x14'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x0b74('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x0b74('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x9453=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','auto','rfc2833','yes','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','port,invite','insecure','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','refuse','originate','pai','fingerprint','certificate','active','passive','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue','split'];(function(_0xf93076,_0x1acb30){var _0x33d1da=function(_0x29e6bf){while(--_0x29e6bf){_0xf93076['push'](_0xf93076['shift']());}};_0x33d1da(++_0x1acb30);}(_0x9453,0x1ea));var _0x3945=function(_0x3b073e,_0x4e7fc3){_0x3b073e=_0x3b073e-0x0;var _0xf7f9f5=_0x9453[_0x3b073e];return _0xf7f9f5;};'use strict';var Sequelize=require(_0x3945('0x0'));module[_0x3945('0x1')]={'name':{'type':Sequelize[_0x3945('0x2')],'allowNull':![],'unique':_0x3945('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3945('0x4')](_0x3945('0x5'),'user',_0x3945('0x6')),'allowNull':![],'defaultValue':_0x3945('0x5')},'context':{'type':Sequelize[_0x3945('0x2')],'allowNull':![],'defaultValue':_0x3945('0x7')},'callingpres':{'type':Sequelize[_0x3945('0x4')](_0x3945('0x8'),_0x3945('0x9'),_0x3945('0xa'),_0x3945('0xb'),_0x3945('0xc'),'PROHIB_PASSED_SCREEN',_0x3945('0xd'),_0x3945('0xe'))},'deny':{'type':Sequelize[_0x3945('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x3945('0x2')]},'transport':{'type':Sequelize[_0x3945('0x2')],'defaultValue':_0x3945('0xf'),'set':function(_0x37b3b4){this[_0x3945('0x10')](_0x3945('0x11'),_0x37b3b4?_0x37b3b4['join'](','):null);},'get':function(){return this[_0x3945('0x12')]('transport')?this['getDataValue'](_0x3945('0x11'))[_0x3945('0x13')](','):null;},'comment':_0x3945('0x14')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x3945('0x15'),_0x3945('0x16'),'inband',_0x3945('0x17')),'defaultValue':_0x3945('0x18')},'directmedia':{'type':Sequelize[_0x3945('0x4')](_0x3945('0x19'),'no',_0x3945('0x1a'),_0x3945('0x1b'),_0x3945('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3945('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3945('0x2')]},'directmediadeny':{'type':Sequelize[_0x3945('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x57f944){this['setDataValue']('nat',_0x57f944?_0x57f944['join'](','):null);},'get':function(){return this['getDataValue'](_0x3945('0x1d'))?this[_0x3945('0x12')](_0x3945('0x1d'))['split'](','):null;},'comment':_0x3945('0x1e')},'callgroup':{'type':Sequelize[_0x3945('0x2')]},'namedcallgroup':{'type':Sequelize[_0x3945('0x2')]},'pickupgroup':{'type':Sequelize[_0x3945('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x3945('0x2')]},'language':{'type':Sequelize[_0x3945('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3945('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x3945('0x2')],'defaultValue':_0x3945('0x1f')},'allow':{'type':Sequelize[_0x3945('0x2')],'allowNull':![],'defaultValue':_0x3945('0x20'),'set':function(_0x49fab5){this[_0x3945('0x10')](_0x3945('0x21'),_0x49fab5?_0x49fab5['join'](';'):_0x3945('0x20'));},'get':function(){return this[_0x3945('0x12')](_0x3945('0x21'))?this[_0x3945('0x12')](_0x3945('0x21'))[_0x3945('0x13')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x3945('0x4')](_0x3945('0x19'),'no')},'insecure':{'type':Sequelize[_0x3945('0x2')],'defaultValue':_0x3945('0x22'),'set':function(_0x3ff3f9){this[_0x3945('0x10')](_0x3945('0x23'),_0x3ff3f9?_0x3ff3f9[_0x3945('0x24')](','):null);},'get':function(){return this[_0x3945('0x12')]('insecure')?this[_0x3945('0x12')]('insecure')[_0x3945('0x13')](','):null;},'comment':_0x3945('0x25')},'trustrpid':{'type':Sequelize[_0x3945('0x4')](_0x3945('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x3945('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no','never')},'promiscredir':{'type':Sequelize[_0x3945('0x4')](_0x3945('0x19'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x3945('0x19'),'no')},'accountcode':{'type':Sequelize[_0x3945('0x26')](0xb)},'setvar':{'type':Sequelize[_0x3945('0x2')]},'callerid':{'type':Sequelize[_0x3945('0x2')],'defaultValue':_0x3945('0x27')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x3945('0x4')](_0x3945('0x19'),'no'),'defaultValue':_0x3945('0x19')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x3945('0x4')](_0x3945('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x3945('0x4')](_0x3945('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x3945('0x4')](_0x3945('0x19'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize[_0x3945('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize['ENUM'](_0x3945('0x19'),'no',_0x3945('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3945('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x3945('0x19'),'no')},'mailbox':{'type':Sequelize[_0x3945('0x2')]},'session_timers':{'type':Sequelize[_0x3945('0x4')]('accept',_0x3945('0x29'),_0x3945('0x2a'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x3945('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0x3945('0x4')]('uac','uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x3945('0x2')]},'regexten':{'type':Sequelize[_0x3945('0x2')]},'fromdomain':{'type':Sequelize[_0x3945('0x2')]},'fromuser':{'type':Sequelize[_0x3945('0x2')]},'port':{'type':Sequelize[_0x3945('0x26')](0x5)},'qualify':{'type':Sequelize[_0x3945('0x4')](_0x3945('0x19'),'no'),'defaultValue':_0x3945('0x19')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x3945('0x2')]},'defaultuser':{'type':Sequelize[_0x3945('0x2')]},'rtptimeout':{'type':Sequelize[_0x3945('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x3945('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x3945('0x4')](_0x3945('0x19'),'no',_0x3945('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3945('0x2')]},'callbackextension':{'type':Sequelize[_0x3945('0x2')]},'timert1':{'type':Sequelize[_0x3945('0x26')](0xb)},'timerb':{'type':Sequelize[_0x3945('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0x3945('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x3945('0x2')]},'contactdeny':{'type':Sequelize[_0x3945('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x3945('0x2')]},'maxforwards':{'type':Sequelize[_0x3945('0x26')](0xb)},'encryption':{'type':Sequelize[_0x3945('0x4')](_0x3945('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no')},'force_avp':{'type':Sequelize[_0x3945('0x4')](_0x3945('0x19'),'no')},'icesupport':{'type':Sequelize[_0x3945('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x3945('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x3945('0x4')](_0x3945('0x19'),'no',_0x3945('0x2c'),_0x3945('0x2d'))},'dtlsrekey':{'type':Sequelize[_0x3945('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0x3945('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x3945('0x2')]},'dtlscipher':{'type':Sequelize[_0x3945('0x2')]},'dtlscafile':{'type':Sequelize[_0x3945('0x2')]},'dtlscapath':{'type':Sequelize[_0x3945('0x2')]},'dtlssetup':{'type':Sequelize[_0x3945('0x4')](_0x3945('0x2e'),_0x3945('0x2f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x3945('0x4')](_0x3945('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3945('0x2')]},'recordofffeature':{'type':Sequelize[_0x3945('0x2')]},'call_limit':{'type':Sequelize[_0x3945('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x3945('0x4')](_0x3945('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0x3945('0x4')](_0x3945('0x19'),'no')},'vmexten':{'type':Sequelize[_0x3945('0x2')]},'mohinterpret':{'type':Sequelize[_0x3945('0x2')]},'mohsuggest':{'type':Sequelize[_0x3945('0x2')]},'parkinglot':{'type':Sequelize[_0x3945('0x2')]},'description':{'type':Sequelize[_0x3945('0x2')]},'host':{'type':Sequelize[_0x3945('0x2')],'defaultValue':_0x3945('0x30')},'canreinvite':{'type':Sequelize[_0x3945('0x4')](_0x3945('0x19'),'no','nonat',_0x3945('0x1b'),_0x3945('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x3945('0x2')]},'otherFields':{'type':Sequelize[_0x3945('0x2')]},'active':{'type':Sequelize[_0x3945('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x3945('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 defa3e2..7a1b586 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 _0x4339=['order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','fields','include','find','omit','createdAt','body','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','chan_sip.so','server/files/templates/registry.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','get','Trunks','sendStatus','stack','name','send','index','map','Trunk','fieldName','key','query','filters','model','attributes','intersection','length','hasOwnProperty','nolimit'];(function(_0x50a004,_0x193d84){var _0x5e9992=function(_0x3c8c37){while(--_0x3c8c37){_0x50a004['push'](_0x50a004['shift']());}};_0x5e9992(++_0x193d84);}(_0x4339,0x186));var _0x9433=function(_0x5aca4c,_0x4add68){_0x5aca4c=_0x5aca4c-0x0;var _0x496604=_0x4339[_0x5aca4c];return _0x496604;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9433('0x0'));var rimraf=require(_0x9433('0x1'));var zipdir=require(_0x9433('0x2'));var jsonpatch=require(_0x9433('0x3'));var rp=require(_0x9433('0x4'));var moment=require(_0x9433('0x5'));var BPromise=require(_0x9433('0x6'));var Mustache=require(_0x9433('0x7'));var util=require(_0x9433('0x8'));var path=require(_0x9433('0x9'));var sox=require(_0x9433('0xa'));var csv=require('to-csv');var ejs=require(_0x9433('0xb'));var fs=require('fs');var _=require(_0x9433('0xc'));var squel=require(_0x9433('0xd'));var crypto=require(_0x9433('0xe'));var jsforce=require(_0x9433('0xf'));var deskjs=require(_0x9433('0x10'));var toCsv=require(_0x9433('0x11'));var querystring=require(_0x9433('0x12'));var Papa=require(_0x9433('0x13'));var Redis=require(_0x9433('0x14'));var authService=require(_0x9433('0x15'));var qs=require(_0x9433('0x16'));var as=require(_0x9433('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9433('0x18'))(_0x9433('0x19'));var utils=require(_0x9433('0x1a'));var config=require(_0x9433('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x9433('0x1c'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x9433('0x1d')][_0x9433('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x396c15,_0x3afa7f,_0x17ff9b,_0x5aff68){return new BPromise(function(_0x3034ad,_0x146520){var _0xd3ad63=_0x5aff68||client;return _0xd3ad63[_0x9433('0x1f')](_0x396c15,_0x17ff9b)['then'](function(_0x309260){logger[_0x9433('0x20')](_0x9433('0x21'),_0x3afa7f,_0x9433('0x22'));logger[_0x9433('0x23')](_0x9433('0x24'),_0x3afa7f,'request\x20sent',JSON[_0x9433('0x25')](_0x309260));if(_0x309260[_0x9433('0x26')]){if(_0x309260['error'][_0x9433('0x27')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x3afa7f,_0x309260['error'][_0x9433('0x28')]);return _0x146520(_0x309260[_0x9433('0x26')][_0x9433('0x28')]);}logger[_0x9433('0x26')](_0x9433('0x21'),_0x3afa7f,_0x309260[_0x9433('0x26')][_0x9433('0x28')]);return _0x3034ad(_0x309260[_0x9433('0x26')][_0x9433('0x28')]);}else{logger[_0x9433('0x20')](_0x9433('0x21'),_0x3afa7f,_0x9433('0x22'));_0x3034ad(_0x309260[_0x9433('0x29')][_0x9433('0x28')]);}})['catch'](function(_0x81316e){logger[_0x9433('0x26')](_0x9433('0x21'),_0x3afa7f,_0x81316e);_0x146520(_0x81316e);});});}function respondWithStatusCode(_0x17dea0,_0x357a02){_0x357a02=_0x357a02||0xcc;return function(_0x549b77){if(_0x549b77){return _0x17dea0['sendStatus'](_0x357a02);}return _0x17dea0[_0x9433('0x2a')](_0x357a02)[_0x9433('0x2b')]();};}function respondWithResult(_0x1798fd,_0x62963b){_0x62963b=_0x62963b||0xc8;return function(_0xbcc2c6){if(_0xbcc2c6){return _0x1798fd[_0x9433('0x2a')](_0x62963b)[_0x9433('0x2c')](_0xbcc2c6);}};}function respondWithFilteredResult(_0x5243b6,_0x5bb4b6){return function(_0x3fc7c9){if(_0x3fc7c9){var _0x2ac8bb=_0x3fc7c9[_0x9433('0x2d')],_0x1c1688=_0x5bb4b6[_0x9433('0x2e')],_0x388afd=_0x5bb4b6[_0x9433('0x2e')]+_0x5bb4b6[_0x9433('0x2f')],_0x560cbd;if(_0x388afd>=_0x2ac8bb){_0x388afd=_0x2ac8bb;_0x560cbd=0xc8;}else{_0x560cbd=0xce;}_0x5243b6['status'](_0x560cbd);return _0x5243b6['set'](_0x9433('0x30'),_0x1c1688+'-'+_0x388afd+'/'+_0x2ac8bb)[_0x9433('0x2c')](_0x3fc7c9);}return null;};}function patchUpdates(_0x452363){return function(_0x22c994){try{jsonpatch[_0x9433('0x31')](_0x22c994,_0x452363,!![]);}catch(_0x35743b){return BPromise[_0x9433('0x32')](_0x35743b);}return _0x22c994[_0x9433('0x33')]();};}function saveUpdates(_0xddefeb,_0x461e68){return function(_0x417fc6){if(_0x417fc6){return _0x417fc6[_0x9433('0x34')](_0xddefeb)['then'](function(_0x55ad47){return _0x55ad47;});}return null;};}function removeEntity(_0x2cdc05,_0x569b8c){return function(_0x41cd07){if(_0x41cd07){return _0x41cd07[_0x9433('0x35')]()[_0x9433('0x36')](function(){var _0x460ea3=_0x41cd07[_0x9433('0x37')]({'plain':!![]});var _0x34ad87=_0x9433('0x38');return db['UserProfileResource'][_0x9433('0x35')]({'where':{'type':_0x34ad87,'resourceId':_0x460ea3['id']}})['then'](function(){return _0x41cd07;});})[_0x9433('0x36')](function(){_0x2cdc05[_0x9433('0x2a')](0xcc)[_0x9433('0x2b')]();});}};}function handleEntityNotFound(_0x2c9a31,_0x225f74){return function(_0x435470){if(!_0x435470){_0x2c9a31[_0x9433('0x39')](0x194);}return _0x435470;};}function handleError(_0x552432,_0x9ac48d){_0x9ac48d=_0x9ac48d||0x1f4;return function(_0x2cd12b){logger[_0x9433('0x26')](_0x2cd12b[_0x9433('0x3a')]);if(_0x2cd12b[_0x9433('0x3b')]){delete _0x2cd12b[_0x9433('0x3b')];}_0x552432['status'](_0x9ac48d)[_0x9433('0x3c')](_0x2cd12b);};}exports[_0x9433('0x3d')]=function(_0x45c768,_0x479398){var _0x2ad9c9={},_0x3c7cee={},_0x6a82ae={'count':0x0,'rows':[]};var _0x487b76=_[_0x9433('0x3e')](db[_0x9433('0x3f')]['rawAttributes'],function(_0x13fb3d){return{'name':_0x13fb3d[_0x9433('0x40')],'type':_0x13fb3d['type'][_0x9433('0x41')]};});_0x3c7cee['model']=_[_0x9433('0x3e')](_0x487b76,_0x9433('0x3b'));_0x3c7cee[_0x9433('0x42')]=_['keys'](_0x45c768['query']);_0x3c7cee[_0x9433('0x43')]=_['intersection'](_0x3c7cee[_0x9433('0x44')],_0x3c7cee['query']);_0x2ad9c9[_0x9433('0x45')]=_[_0x9433('0x46')](_0x3c7cee[_0x9433('0x44')],qs['fields'](_0x45c768['query']['fields']));_0x2ad9c9[_0x9433('0x45')]=_0x2ad9c9['attributes'][_0x9433('0x47')]?_0x2ad9c9[_0x9433('0x45')]:_0x3c7cee[_0x9433('0x44')];if(!_0x45c768['query'][_0x9433('0x48')](_0x9433('0x49'))){_0x2ad9c9[_0x9433('0x2f')]=qs[_0x9433('0x2f')](_0x45c768[_0x9433('0x42')][_0x9433('0x2f')]);_0x2ad9c9[_0x9433('0x2e')]=qs['offset'](_0x45c768[_0x9433('0x42')][_0x9433('0x2e')]);}_0x2ad9c9[_0x9433('0x4a')]=qs['sort'](_0x45c768[_0x9433('0x42')][_0x9433('0x4b')]);_0x2ad9c9[_0x9433('0x4c')]=qs['filters'](_['pick'](_0x45c768['query'],_0x3c7cee['filters']),_0x487b76);if(_0x45c768[_0x9433('0x42')][_0x9433('0x4d')]){_0x2ad9c9[_0x9433('0x4c')]=_[_0x9433('0x4e')](_0x2ad9c9[_0x9433('0x4c')],{'$or':_[_0x9433('0x3e')](_0x487b76,function(_0x346cb5){if(_0x346cb5[_0x9433('0x4f')]!==_0x9433('0x50')){var _0x4e93b6={};_0x4e93b6[_0x346cb5['name']]={'$like':'%'+_0x45c768[_0x9433('0x42')][_0x9433('0x4d')]+'%'};return _0x4e93b6;}})});}_0x2ad9c9=_['merge']({},_0x2ad9c9,_0x45c768[_0x9433('0x51')]);var _0x4e9d0d={'where':_0x2ad9c9[_0x9433('0x4c')]};return db[_0x9433('0x3f')][_0x9433('0x2d')](_0x4e9d0d)[_0x9433('0x36')](function(_0x19e761){_0x6a82ae[_0x9433('0x2d')]=_0x19e761;if(_0x45c768[_0x9433('0x42')][_0x9433('0x52')]){_0x2ad9c9['include']=[{'all':!![]}];}return db['Trunk'][_0x9433('0x53')](_0x2ad9c9);})['then'](function(_0x1f773b){_0x6a82ae[_0x9433('0x54')]=_0x1f773b;return _0x6a82ae;})[_0x9433('0x36')](respondWithFilteredResult(_0x479398,_0x2ad9c9))[_0x9433('0x55')](handleError(_0x479398,null));};exports['show']=function(_0x35f93b,_0x5c3440){var _0x2aa40f={'raw':![],'where':{'id':_0x35f93b[_0x9433('0x56')]['id']}},_0x35f8c6={};_0x35f8c6[_0x9433('0x44')]=_[_0x9433('0x57')](db['Trunk'][_0x9433('0x58')]);_0x35f8c6[_0x9433('0x42')]=_[_0x9433('0x57')](_0x35f93b[_0x9433('0x42')]);_0x35f8c6[_0x9433('0x43')]=_[_0x9433('0x46')](_0x35f8c6['model'],_0x35f8c6[_0x9433('0x42')]);_0x2aa40f[_0x9433('0x45')]=_[_0x9433('0x46')](_0x35f8c6[_0x9433('0x44')],qs[_0x9433('0x59')](_0x35f93b[_0x9433('0x42')][_0x9433('0x59')]));_0x2aa40f[_0x9433('0x45')]=_0x2aa40f[_0x9433('0x45')][_0x9433('0x47')]?_0x2aa40f['attributes']:_0x35f8c6['model'];if(_0x35f93b[_0x9433('0x42')][_0x9433('0x52')]){_0x2aa40f[_0x9433('0x5a')]=[{'all':!![]}];}_0x2aa40f=_[_0x9433('0x4e')]({},_0x2aa40f,_0x35f93b[_0x9433('0x51')]);return db[_0x9433('0x3f')]['find'](_0x2aa40f)[_0x9433('0x36')](handleEntityNotFound(_0x5c3440,null))[_0x9433('0x36')](respondWithResult(_0x5c3440,null))[_0x9433('0x55')](handleError(_0x5c3440,null));};exports['clone']=function(_0xe67a10,_0x3031c5){var _0x3a71a5={'where':{'id':_0xe67a10[_0x9433('0x56')]['id']}},_0x255091={};_0x255091[_0x9433('0x44')]=_['keys'](db['Trunk'][_0x9433('0x58')]);_0x3a71a5[_0x9433('0x45')]=_[_0x9433('0x46')](_0x255091['model'],qs['fields'](_0xe67a10['query']['fields']));_0x3a71a5[_0x9433('0x45')]=_0x3a71a5[_0x9433('0x45')][_0x9433('0x47')]?_0x3a71a5[_0x9433('0x45')]:_0x255091['model'];if(_0xe67a10[_0x9433('0x42')][_0x9433('0x52')]){_0x3a71a5[_0x9433('0x5a')]=[{'all':!![]}];}_0x3a71a5=_['merge']({},_0x3a71a5,_0xe67a10[_0x9433('0x51')]);return db['Trunk'][_0x9433('0x5b')](_0x3a71a5)[_0x9433('0x36')](handleEntityNotFound(_0x3031c5,null))[_0x9433('0x36')](function(_0x3aa803){if(_0x3aa803){var _0x92421c=_0x3aa803[_0x9433('0x37')]({'plain':!![]});_0x92421c=qs[_0x9433('0x5c')](_0x92421c,['id',_0x9433('0x5d'),'updatedAt']);_0xe67a10[_0x9433('0x5e')]=_[_0x9433('0x5c')](_0xe67a10['body'],['id','createdAt','updatedAt']);return db['Trunk'][_0x9433('0x5f')](_[_0x9433('0x4e')](_0x92421c,_0xe67a10[_0x9433('0x5e')]),{'include':_0xe67a10[_0x9433('0x42')][_0x9433('0x52')]?[{'all':!![]}]:undefined})[_0x9433('0x36')](function(_0x2043ec){var _0x4724a5=_0xe67a10['user'][_0x9433('0x37')]({'plain':!![]});if(!_0x4724a5)throw new Error(_0x9433('0x60'));if(_0x4724a5['role']===_0x9433('0x61')){var _0x4b9ae4=_0x2043ec['get']({'plain':!![]});var _0x52fb93=_0x9433('0x38');return db[_0x9433('0x62')]['find']({'where':{'name':_0x52fb93,'userProfileId':_0x4724a5[_0x9433('0x63')]},'raw':!![]})[_0x9433('0x36')](function(_0x308c26){if(_0x308c26&&_0x308c26[_0x9433('0x64')]===0x0){return db[_0x9433('0x65')][_0x9433('0x5f')]({'name':_0x4b9ae4['name'],'resourceId':_0x4b9ae4['id'],'type':_0x308c26[_0x9433('0x3b')],'sectionId':_0x308c26['id']},{})[_0x9433('0x36')](function(){return _0x2043ec;});}else{return _0x2043ec;}})[_0x9433('0x55')](function(_0x26a844){logger[_0x9433('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x26a844);throw _0x26a844;});}return _0x2043ec;});}})['then'](respondWithResult(_0x3031c5,0xc9))[_0x9433('0x55')](handleError(_0x3031c5,null));};exports[_0x9433('0x5f')]=function(_0x5a5408,_0xabb804,_0x4a1416){var _0x10aae6;return db[_0x9433('0x3f')][_0x9433('0x5f')](_0x5a5408[_0x9433('0x5e')],{'raw':!![]})[_0x9433('0x36')](function(_0x4d1db3){_0x10aae6=_0x4d1db3;return db[_0x9433('0x3f')][_0x9433('0x53')]({'raw':!![]});})[_0x9433('0x36')](function(_0x4e4445){var _0x2c9078=fs[_0x9433('0x66')](path[_0x9433('0x67')](config[_0x9433('0x68')],_0x9433('0x69')),_0x9433('0x6a'));var _0x24d2af=fs[_0x9433('0x66')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0x9433('0x6a'));var _0x1e5630=ejs[_0x9433('0x6b')](_0x2c9078,{'trunks':_0x4e4445||[]});fs[_0x9433('0x6c')](_0x9433('0x6d'),_0x1e5630);if(_0x10aae6[_0x9433('0x6e')]){var _0x18aec7=ejs[_0x9433('0x6b')](_0x24d2af,{'trunks':_0x4e4445||[]});fs[_0x9433('0x6c')](_0x9433('0x6f'),_0x18aec7);}})[_0x9433('0x36')](function(){return respondWithRpcPromise(_0x9433('0x70'),_0x9433('0x5f'),{'module':'chan_sip.so'});})['then'](function(){var _0x4b9706=_0x5a5408[_0x9433('0x61')]['get']({'plain':!![]});if(!_0x4b9706)throw new Error(_0x9433('0x60'));if(_0x4b9706['role']===_0x9433('0x61')){var _0x2be0ca=_0x10aae6[_0x9433('0x37')]({'plain':!![]});return db[_0x9433('0x62')][_0x9433('0x5b')]({'where':{'name':'Trunks','userProfileId':_0x4b9706[_0x9433('0x63')]},'raw':!![]})[_0x9433('0x36')](function(_0x4b3513){if(_0x4b3513&&_0x4b3513[_0x9433('0x64')]===0x0){return db[_0x9433('0x65')][_0x9433('0x5f')]({'name':_0x2be0ca[_0x9433('0x3b')],'resourceId':_0x2be0ca['id'],'type':_0x4b3513[_0x9433('0x3b')],'sectionId':_0x4b3513['id']},{})[_0x9433('0x36')](function(){return _0x10aae6;});}else{return _0x10aae6;}})[_0x9433('0x55')](function(_0x2fa927){logger['error'](_0x9433('0x71'),_0x2fa927);throw _0x2fa927;});}return _0x10aae6;})[_0x9433('0x36')](respondWithResult(_0xabb804,0xc9))[_0x9433('0x55')](handleError(_0xabb804,null));};exports[_0x9433('0x34')]=function(_0x2c66f6,_0x2bd0b2,_0x50498c){var _0x33ed26;return db[_0x9433('0x3f')]['find']({'where':{'id':_0x2c66f6[_0x9433('0x56')]['id']}})[_0x9433('0x36')](handleEntityNotFound(_0x2bd0b2,null))[_0x9433('0x36')](saveUpdates(_0x2c66f6[_0x9433('0x5e')],null))['then'](function(_0x294d21){if(_0x294d21){_0x33ed26=_0x294d21;return db[_0x9433('0x3f')][_0x9433('0x53')]({'raw':!![]});}})[_0x9433('0x36')](function(_0x1bb596){if(_0x1bb596){var _0x4508ea=fs[_0x9433('0x66')](path['join'](config[_0x9433('0x68')],_0x9433('0x69')),'utf8');var _0x4e5f07=fs['readFileSync'](path['join'](config[_0x9433('0x68')],'server/files/templates/registry.ejs'),'utf8');var _0x3d7a46=ejs[_0x9433('0x6b')](_0x4508ea,{'trunks':_0x1bb596||[]});fs[_0x9433('0x6c')]('/etc/asterisk/sip_xcally_trunks.conf',_0x3d7a46);var _0x44563a=ejs[_0x9433('0x6b')](_0x4e5f07,{'trunks':_0x1bb596||[]});fs[_0x9433('0x6c')](_0x9433('0x6f'),_0x44563a);return respondWithRpcPromise(_0x9433('0x70'),_0x9433('0x34'),{'module':_0x9433('0x72')});}return null;})[_0x9433('0x36')](function(_0x1f583d){if(_0x1f583d){return _0x33ed26;}})['then'](respondWithResult(_0x2bd0b2,null))[_0x9433('0x55')](handleError(_0x2bd0b2,null));};exports['destroy']=function(_0x104ade,_0x5ca96e,_0x5343bd){var _0x4b2420;return db[_0x9433('0x3f')]['find']({'where':{'id':_0x104ade['params']['id']}})['then'](handleEntityNotFound(_0x5ca96e,null))[_0x9433('0x36')](removeEntity(_0x5ca96e,null))[_0x9433('0x36')](function(){return db[_0x9433('0x3f')][_0x9433('0x53')]({'raw':!![]});})[_0x9433('0x36')](function(_0x4838c2){var _0x4d1035=fs[_0x9433('0x66')](path[_0x9433('0x67')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0xcfb498=fs[_0x9433('0x66')](path['join'](config[_0x9433('0x68')],_0x9433('0x73')),_0x9433('0x6a'));var _0x34ff7f=ejs[_0x9433('0x6b')](_0x4d1035,{'trunks':_0x4838c2});var _0x3da0bf=ejs[_0x9433('0x6b')](_0xcfb498,{'trunks':_0x4838c2});fs[_0x9433('0x6c')](_0x9433('0x6d'),_0x34ff7f);fs[_0x9433('0x6c')]('/etc/asterisk/sip_xcally_registers.conf',_0x3da0bf);return respondWithRpcPromise(_0x9433('0x70'),_0x9433('0x35'),{'module':'chan_sip.so'});})[_0x9433('0x55')](handleError(_0x5ca96e,null));}; \ No newline at end of file +var _0x6467=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','server/files/templates/registry.ejs','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s,\x20%s','error','code','Trunk,\x20%s,\x20%s','message','request\x20sent','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','show','params','fields','include','options','clone','omit','createdAt','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','create'];(function(_0x1ff38f,_0x77afc8){var _0x5c394a=function(_0x5566d2){while(--_0x5566d2){_0x1ff38f['push'](_0x1ff38f['shift']());}};_0x5c394a(++_0x77afc8);}(_0x6467,0xe9));var _0x7646=function(_0x424a7e,_0xe3943f){_0x424a7e=_0x424a7e-0x0;var _0x27a518=_0x6467[_0x424a7e];return _0x27a518;};'use strict';var pdf=require(_0x7646('0x0'));var emlformat=require(_0x7646('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7646('0x2'));var jsonpatch=require(_0x7646('0x3'));var rp=require(_0x7646('0x4'));var moment=require('moment');var BPromise=require(_0x7646('0x5'));var Mustache=require(_0x7646('0x6'));var util=require(_0x7646('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7646('0x8'));var ejs=require(_0x7646('0x9'));var fs=require('fs');var _=require(_0x7646('0xa'));var squel=require('squel');var crypto=require(_0x7646('0xb'));var jsforce=require(_0x7646('0xc'));var deskjs=require(_0x7646('0xd'));var toCsv=require(_0x7646('0x8'));var querystring=require(_0x7646('0xe'));var Papa=require(_0x7646('0xf'));var Redis=require(_0x7646('0x10'));var authService=require(_0x7646('0x11'));var qs=require(_0x7646('0x12'));var as=require(_0x7646('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7646('0x14'));var config=require(_0x7646('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7646('0x16'))['db'];var jayson=require(_0x7646('0x17'));var client=jayson[_0x7646('0x18')][_0x7646('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x41e2eb,_0x95aca6,_0x3adc63,_0x1b47ae){return new BPromise(function(_0x1d7ed0,_0x336ead){var _0x437a5c=_0x1b47ae||client;return _0x437a5c[_0x7646('0x1a')](_0x41e2eb,_0x3adc63)[_0x7646('0x1b')](function(_0x13259b){logger[_0x7646('0x1c')]('Trunk,\x20%s,\x20%s',_0x95aca6,'request\x20sent');logger['debug'](_0x7646('0x1d'),_0x95aca6,'request\x20sent',JSON['stringify'](_0x13259b));if(_0x13259b[_0x7646('0x1e')]){if(_0x13259b['error'][_0x7646('0x1f')]===0x1f4){logger[_0x7646('0x1e')](_0x7646('0x20'),_0x95aca6,_0x13259b['error'][_0x7646('0x21')]);return _0x336ead(_0x13259b[_0x7646('0x1e')]['message']);}logger[_0x7646('0x1e')](_0x7646('0x20'),_0x95aca6,_0x13259b[_0x7646('0x1e')][_0x7646('0x21')]);return _0x1d7ed0(_0x13259b[_0x7646('0x1e')][_0x7646('0x21')]);}else{logger[_0x7646('0x1c')](_0x7646('0x20'),_0x95aca6,_0x7646('0x22'));_0x1d7ed0(_0x13259b['result'][_0x7646('0x21')]);}})[_0x7646('0x23')](function(_0x71d82e){logger[_0x7646('0x1e')]('Trunk,\x20%s,\x20%s',_0x95aca6,_0x71d82e);_0x336ead(_0x71d82e);});});}function respondWithStatusCode(_0x1235b6,_0x1b9719){_0x1b9719=_0x1b9719||0xcc;return function(_0xc29083){if(_0xc29083){return _0x1235b6[_0x7646('0x24')](_0x1b9719);}return _0x1235b6['status'](_0x1b9719)[_0x7646('0x25')]();};}function respondWithResult(_0x1db439,_0x3944f1){_0x3944f1=_0x3944f1||0xc8;return function(_0x13a7db){if(_0x13a7db){return _0x1db439[_0x7646('0x26')](_0x3944f1)[_0x7646('0x27')](_0x13a7db);}};}function respondWithFilteredResult(_0x53afc7,_0x1df8a3){return function(_0xa7c817){if(_0xa7c817){var _0x58a051=_0xa7c817[_0x7646('0x28')],_0x2bc75a=_0x1df8a3[_0x7646('0x29')],_0x1f8e26=_0x1df8a3[_0x7646('0x29')]+_0x1df8a3[_0x7646('0x2a')],_0x4e3cff;if(_0x1f8e26>=_0x58a051){_0x1f8e26=_0x58a051;_0x4e3cff=0xc8;}else{_0x4e3cff=0xce;}_0x53afc7[_0x7646('0x26')](_0x4e3cff);return _0x53afc7[_0x7646('0x2b')](_0x7646('0x2c'),_0x2bc75a+'-'+_0x1f8e26+'/'+_0x58a051)['json'](_0xa7c817);}return null;};}function patchUpdates(_0xd931f9){return function(_0x471b10){try{jsonpatch[_0x7646('0x2d')](_0x471b10,_0xd931f9,!![]);}catch(_0x5f2ea1){return BPromise[_0x7646('0x2e')](_0x5f2ea1);}return _0x471b10[_0x7646('0x2f')]();};}function saveUpdates(_0x5e2403,_0x44e92d){return function(_0xc0466){if(_0xc0466){return _0xc0466[_0x7646('0x30')](_0x5e2403)['then'](function(_0x43671f){return _0x43671f;});}return null;};}function removeEntity(_0xd61325,_0x2022d1){return function(_0x75348a){if(_0x75348a){return _0x75348a[_0x7646('0x31')]()['then'](function(){var _0xa4f049=_0x75348a[_0x7646('0x32')]({'plain':!![]});var _0x49bdba=_0x7646('0x33');return db[_0x7646('0x34')]['destroy']({'where':{'type':_0x49bdba,'resourceId':_0xa4f049['id']}})['then'](function(){return _0x75348a;});})['then'](function(){_0xd61325[_0x7646('0x26')](0xcc)[_0x7646('0x25')]();});}};}function handleEntityNotFound(_0x58d419,_0x1e5040){return function(_0x2c08e9){if(!_0x2c08e9){_0x58d419['sendStatus'](0x194);}return _0x2c08e9;};}function handleError(_0x32729b,_0x232a90){_0x232a90=_0x232a90||0x1f4;return function(_0x50b3f0){logger[_0x7646('0x1e')](_0x50b3f0[_0x7646('0x35')]);if(_0x50b3f0[_0x7646('0x36')]){delete _0x50b3f0[_0x7646('0x36')];}_0x32729b[_0x7646('0x26')](_0x232a90)['send'](_0x50b3f0);};}exports[_0x7646('0x37')]=function(_0x47835a,_0x57495a){var _0x37501c={},_0x5dbdb2={},_0xa0c6f4={'count':0x0,'rows':[]};var _0x393422=_[_0x7646('0x38')](db[_0x7646('0x39')][_0x7646('0x3a')],function(_0x12d9e6){return{'name':_0x12d9e6['fieldName'],'type':_0x12d9e6[_0x7646('0x3b')][_0x7646('0x3c')]};});_0x5dbdb2['model']=_[_0x7646('0x38')](_0x393422,_0x7646('0x36'));_0x5dbdb2['query']=_[_0x7646('0x3d')](_0x47835a[_0x7646('0x3e')]);_0x5dbdb2[_0x7646('0x3f')]=_[_0x7646('0x40')](_0x5dbdb2[_0x7646('0x41')],_0x5dbdb2[_0x7646('0x3e')]);_0x37501c[_0x7646('0x42')]=_[_0x7646('0x40')](_0x5dbdb2[_0x7646('0x41')],qs['fields'](_0x47835a[_0x7646('0x3e')]['fields']));_0x37501c[_0x7646('0x42')]=_0x37501c[_0x7646('0x42')][_0x7646('0x43')]?_0x37501c[_0x7646('0x42')]:_0x5dbdb2[_0x7646('0x41')];if(!_0x47835a[_0x7646('0x3e')][_0x7646('0x44')](_0x7646('0x45'))){_0x37501c['limit']=qs[_0x7646('0x2a')](_0x47835a['query'][_0x7646('0x2a')]);_0x37501c[_0x7646('0x29')]=qs['offset'](_0x47835a[_0x7646('0x3e')][_0x7646('0x29')]);}_0x37501c[_0x7646('0x46')]=qs[_0x7646('0x47')](_0x47835a[_0x7646('0x3e')][_0x7646('0x47')]);_0x37501c['where']=qs[_0x7646('0x3f')](_[_0x7646('0x48')](_0x47835a[_0x7646('0x3e')],_0x5dbdb2['filters']),_0x393422);if(_0x47835a[_0x7646('0x3e')][_0x7646('0x49')]){_0x37501c[_0x7646('0x4a')]=_[_0x7646('0x4b')](_0x37501c[_0x7646('0x4a')],{'$or':_[_0x7646('0x38')](_0x393422,function(_0x4ce5f9){if(_0x4ce5f9['type']!==_0x7646('0x4c')){var _0x2e121f={};_0x2e121f[_0x4ce5f9[_0x7646('0x36')]]={'$like':'%'+_0x47835a[_0x7646('0x3e')][_0x7646('0x49')]+'%'};return _0x2e121f;}})});}_0x37501c=_[_0x7646('0x4b')]({},_0x37501c,_0x47835a['options']);var _0x19633b={'where':_0x37501c['where']};return db[_0x7646('0x39')][_0x7646('0x28')](_0x19633b)[_0x7646('0x1b')](function(_0xd8e33e){_0xa0c6f4['count']=_0xd8e33e;if(_0x47835a[_0x7646('0x3e')][_0x7646('0x4d')]){_0x37501c['include']=[{'all':!![]}];}return db[_0x7646('0x39')][_0x7646('0x4e')](_0x37501c);})[_0x7646('0x1b')](function(_0x14c5e7){_0xa0c6f4[_0x7646('0x4f')]=_0x14c5e7;return _0xa0c6f4;})['then'](respondWithFilteredResult(_0x57495a,_0x37501c))[_0x7646('0x23')](handleError(_0x57495a,null));};exports[_0x7646('0x50')]=function(_0x236039,_0xb26871){var _0x27e849={'raw':![],'where':{'id':_0x236039[_0x7646('0x51')]['id']}},_0x1fc79a={};_0x1fc79a['model']=_[_0x7646('0x3d')](db['Trunk']['rawAttributes']);_0x1fc79a[_0x7646('0x3e')]=_[_0x7646('0x3d')](_0x236039[_0x7646('0x3e')]);_0x1fc79a[_0x7646('0x3f')]=_[_0x7646('0x40')](_0x1fc79a[_0x7646('0x41')],_0x1fc79a[_0x7646('0x3e')]);_0x27e849[_0x7646('0x42')]=_['intersection'](_0x1fc79a[_0x7646('0x41')],qs[_0x7646('0x52')](_0x236039[_0x7646('0x3e')][_0x7646('0x52')]));_0x27e849[_0x7646('0x42')]=_0x27e849[_0x7646('0x42')][_0x7646('0x43')]?_0x27e849[_0x7646('0x42')]:_0x1fc79a[_0x7646('0x41')];if(_0x236039[_0x7646('0x3e')]['includeAll']){_0x27e849[_0x7646('0x53')]=[{'all':!![]}];}_0x27e849=_[_0x7646('0x4b')]({},_0x27e849,_0x236039[_0x7646('0x54')]);return db[_0x7646('0x39')]['find'](_0x27e849)[_0x7646('0x1b')](handleEntityNotFound(_0xb26871,null))[_0x7646('0x1b')](respondWithResult(_0xb26871,null))['catch'](handleError(_0xb26871,null));};exports[_0x7646('0x55')]=function(_0x32ff8c,_0x4c8511){var _0xa873ec={'where':{'id':_0x32ff8c[_0x7646('0x51')]['id']}},_0x52025b={};_0x52025b[_0x7646('0x41')]=_[_0x7646('0x3d')](db[_0x7646('0x39')][_0x7646('0x3a')]);_0xa873ec[_0x7646('0x42')]=_['intersection'](_0x52025b[_0x7646('0x41')],qs[_0x7646('0x52')](_0x32ff8c[_0x7646('0x3e')][_0x7646('0x52')]));_0xa873ec[_0x7646('0x42')]=_0xa873ec[_0x7646('0x42')]['length']?_0xa873ec[_0x7646('0x42')]:_0x52025b[_0x7646('0x41')];if(_0x32ff8c[_0x7646('0x3e')]['includeAll']){_0xa873ec[_0x7646('0x53')]=[{'all':!![]}];}_0xa873ec=_['merge']({},_0xa873ec,_0x32ff8c['options']);return db[_0x7646('0x39')]['find'](_0xa873ec)['then'](handleEntityNotFound(_0x4c8511,null))[_0x7646('0x1b')](function(_0x15ea88){if(_0x15ea88){var _0x477a5e=_0x15ea88[_0x7646('0x32')]({'plain':!![]});_0x477a5e=qs[_0x7646('0x56')](_0x477a5e,['id',_0x7646('0x57'),'updatedAt']);_0x32ff8c[_0x7646('0x58')]=_[_0x7646('0x56')](_0x32ff8c[_0x7646('0x58')],['id',_0x7646('0x57'),'updatedAt']);return db[_0x7646('0x39')]['create'](_[_0x7646('0x4b')](_0x477a5e,_0x32ff8c['body']),{'include':_0x32ff8c[_0x7646('0x3e')]['includeAll']?[{'all':!![]}]:undefined})[_0x7646('0x1b')](function(_0x32d555){var _0x3cfa9e=_0x32ff8c[_0x7646('0x59')][_0x7646('0x32')]({'plain':!![]});if(!_0x3cfa9e)throw new Error(_0x7646('0x5a'));if(_0x3cfa9e[_0x7646('0x5b')]==='user'){var _0x4beb46=_0x32d555[_0x7646('0x32')]({'plain':!![]});var _0x449d5e=_0x7646('0x33');return db[_0x7646('0x5c')][_0x7646('0x5d')]({'where':{'name':_0x449d5e,'userProfileId':_0x3cfa9e[_0x7646('0x5e')]},'raw':!![]})['then'](function(_0x2216e1){if(_0x2216e1&&_0x2216e1[_0x7646('0x5f')]===0x0){return db[_0x7646('0x34')][_0x7646('0x60')]({'name':_0x4beb46[_0x7646('0x36')],'resourceId':_0x4beb46['id'],'type':_0x2216e1[_0x7646('0x36')],'sectionId':_0x2216e1['id']},{})[_0x7646('0x1b')](function(){return _0x32d555;});}else{return _0x32d555;}})[_0x7646('0x23')](function(_0x1fd5ec){logger['error'](_0x7646('0x61'),_0x1fd5ec);throw _0x1fd5ec;});}return _0x32d555;});}})[_0x7646('0x1b')](respondWithResult(_0x4c8511,0xc9))[_0x7646('0x23')](handleError(_0x4c8511,null));};exports[_0x7646('0x60')]=function(_0x3ab1e2,_0x22e34a,_0x27f9a7){var _0x49b859;return db[_0x7646('0x39')][_0x7646('0x60')](_0x3ab1e2[_0x7646('0x58')],{'raw':!![]})[_0x7646('0x1b')](function(_0x157fee){_0x49b859=_0x157fee;return db[_0x7646('0x39')][_0x7646('0x4e')]({'raw':!![]});})['then'](function(_0x45920c){var _0x27c5a4=fs[_0x7646('0x62')](path[_0x7646('0x63')](config['root'],_0x7646('0x64')),_0x7646('0x65'));var _0x2a8818=fs['readFileSync'](path[_0x7646('0x63')](config[_0x7646('0x66')],'server/files/templates/registry.ejs'),_0x7646('0x65'));var _0x309f9d=ejs['render'](_0x27c5a4,{'trunks':_0x45920c||[]});fs[_0x7646('0x67')](_0x7646('0x68'),_0x309f9d);if(_0x49b859['registry']){var _0x3add87=ejs[_0x7646('0x69')](_0x2a8818,{'trunks':_0x45920c||[]});fs['writeFileSync'](_0x7646('0x6a'),_0x3add87);}})[_0x7646('0x1b')](function(){return respondWithRpcPromise(_0x7646('0x6b'),_0x7646('0x60'),{'module':_0x7646('0x6c')});})[_0x7646('0x1b')](function(){var _0x4bffbc=_0x3ab1e2[_0x7646('0x59')]['get']({'plain':!![]});if(!_0x4bffbc)throw new Error(_0x7646('0x5a'));if(_0x4bffbc['role']===_0x7646('0x59')){var _0xcdc816=_0x49b859[_0x7646('0x32')]({'plain':!![]});return db[_0x7646('0x5c')][_0x7646('0x5d')]({'where':{'name':_0x7646('0x33'),'userProfileId':_0x4bffbc['userProfileId']},'raw':!![]})[_0x7646('0x1b')](function(_0x27f134){if(_0x27f134&&_0x27f134[_0x7646('0x5f')]===0x0){return db['UserProfileResource']['create']({'name':_0xcdc816['name'],'resourceId':_0xcdc816['id'],'type':_0x27f134[_0x7646('0x36')],'sectionId':_0x27f134['id']},{})['then'](function(){return _0x49b859;});}else{return _0x49b859;}})['catch'](function(_0x1de217){logger[_0x7646('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1de217);throw _0x1de217;});}return _0x49b859;})[_0x7646('0x1b')](respondWithResult(_0x22e34a,0xc9))[_0x7646('0x23')](handleError(_0x22e34a,null));};exports[_0x7646('0x30')]=function(_0x3cad77,_0x2e54ed,_0x366626){var _0x5e8f07;return db[_0x7646('0x39')][_0x7646('0x5d')]({'where':{'id':_0x3cad77[_0x7646('0x51')]['id']}})[_0x7646('0x1b')](handleEntityNotFound(_0x2e54ed,null))[_0x7646('0x1b')](saveUpdates(_0x3cad77[_0x7646('0x58')],null))['then'](function(_0x2afc2d){if(_0x2afc2d){_0x5e8f07=_0x2afc2d;return db[_0x7646('0x39')]['findAll']({'raw':!![]});}})['then'](function(_0x293753){if(_0x293753){var _0x5d1326=fs[_0x7646('0x62')](path['join'](config[_0x7646('0x66')],_0x7646('0x64')),'utf8');var _0x54da06=fs[_0x7646('0x62')](path[_0x7646('0x63')](config['root'],_0x7646('0x6d')),_0x7646('0x65'));var _0x382e14=ejs['render'](_0x5d1326,{'trunks':_0x293753||[]});fs[_0x7646('0x67')](_0x7646('0x68'),_0x382e14);var _0x34dc6a=ejs[_0x7646('0x69')](_0x54da06,{'trunks':_0x293753||[]});fs[_0x7646('0x67')](_0x7646('0x6a'),_0x34dc6a);return respondWithRpcPromise(_0x7646('0x6b'),_0x7646('0x30'),{'module':_0x7646('0x6c')});}return null;})['then'](function(_0x47474f){if(_0x47474f){return _0x5e8f07;}})[_0x7646('0x1b')](respondWithResult(_0x2e54ed,null))[_0x7646('0x23')](handleError(_0x2e54ed,null));};exports['destroy']=function(_0x4a0cb0,_0x4edbc4,_0x24077e){var _0x5d500b;return db[_0x7646('0x39')]['find']({'where':{'id':_0x4a0cb0[_0x7646('0x51')]['id']}})[_0x7646('0x1b')](handleEntityNotFound(_0x4edbc4,null))['then'](removeEntity(_0x4edbc4,null))[_0x7646('0x1b')](function(){return db[_0x7646('0x39')]['findAll']({'raw':!![]});})[_0x7646('0x1b')](function(_0x57bb86){var _0x4226c8=fs[_0x7646('0x62')](path[_0x7646('0x63')](config[_0x7646('0x66')],_0x7646('0x64')),_0x7646('0x65'));var _0x53c6c1=fs['readFileSync'](path[_0x7646('0x63')](config[_0x7646('0x66')],_0x7646('0x6d')),'utf8');var _0x2bcd20=ejs['render'](_0x4226c8,{'trunks':_0x57bb86});var _0x554dfa=ejs[_0x7646('0x69')](_0x53c6c1,{'trunks':_0x57bb86});fs[_0x7646('0x67')](_0x7646('0x68'),_0x2bcd20);fs[_0x7646('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x554dfa);return respondWithRpcPromise(_0x7646('0x6b'),_0x7646('0x31'),{'module':'chan_sip.so'});})[_0x7646('0x23')](handleError(_0x4edbc4,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index d926461..699a5e6 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 _0x69f7=['define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./trunk.attributes'];(function(_0x24355a,_0x401e18){var _0x5df365=function(_0x3a6fa7){while(--_0x3a6fa7){_0x24355a['push'](_0x24355a['shift']());}};_0x5df365(++_0x401e18);}(_0x69f7,0x87));var _0x769f=function(_0x54988e,_0x3d6599){_0x54988e=_0x54988e-0x0;var _0x51821e=_0x69f7[_0x54988e];return _0x51821e;};'use strict';var _=require(_0x769f('0x0'));var util=require(_0x769f('0x1'));var logger=require(_0x769f('0x2'))(_0x769f('0x3'));var moment=require(_0x769f('0x4'));var BPromise=require(_0x769f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x769f('0x6'));var rimraf=require('rimraf');var config=require(_0x769f('0x7'));var attributes=require(_0x769f('0x8'));module['exports']=function(_0x55258f,_0x45544d){return _0x55258f[_0x769f('0x9')](_0x769f('0xa'),attributes,{'tableName':_0x769f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21a6=['moment','bluebird','request-promise','path','../../config/environment','Trunk','tools_trunks','lodash','util','../../config/logger','api'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x21a6,0x10f));var _0x621a=function(_0x8c1005,_0x1f3f16){_0x8c1005=_0x8c1005-0x0;var _0x175354=_0x21a6[_0x8c1005];return _0x175354;};'use strict';var _=require(_0x621a('0x0'));var util=require(_0x621a('0x1'));var logger=require(_0x621a('0x2'))(_0x621a('0x3'));var moment=require(_0x621a('0x4'));var BPromise=require(_0x621a('0x5'));var rp=require(_0x621a('0x6'));var fs=require('fs');var path=require(_0x621a('0x7'));var rimraf=require('rimraf');var config=require(_0x621a('0x8'));var attributes=require('./trunk.attributes');module['exports']=function(_0x572c57,_0x15c69d){return _0x572c57['define'](_0x621a('0x9'),attributes,{'tableName':_0x621a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 2d31315..6767712 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 _0x5f2f=['map','include','model','attributes','then','ShowTrunk','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','GetTrunk','Trunk','findAll','options','raw','limit'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2c9040,_0x39fb32){_0x2c9040=_0x2c9040-0x0;var _0x829717=_0x5f2f[_0x2c9040];return _0x829717;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('Trunk,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')]({'raw':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd['options'][_0xf5f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd['options']['where']||null:null,'attributes':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')]['attributes']||null:null,'limit':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')][_0xf5f2('0x1c')]||null:null,'include':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')]['include']?_[_0xf5f2('0x1d')](_0x20fccd[_0xf5f2('0x1a')][_0xf5f2('0x1e')],function(_0x2833fe){return{'model':db[_0x2833fe[_0xf5f2('0x1f')]],'as':_0x2833fe['as'],'attributes':_0x2833fe['attributes'],'include':_0x2833fe['include']?_[_0xf5f2('0x1d')](_0x2833fe[_0xf5f2('0x1e')],function(_0x13da6f){return{'model':db[_0x13da6f[_0xf5f2('0x1f')]],'as':_0x13da6f['as'],'attributes':_0x13da6f[_0xf5f2('0x20')],'include':_0x13da6f[_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x13da6f[_0xf5f2('0x1e')],function(_0x294414){return{'model':db[_0x294414['model']],'as':_0x294414['as'],'attributes':_0x294414[_0xf5f2('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x21')](function(_0x375ca8){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')]('GetTrunk',_0x20fccd,JSON['stringify'](_0x375ca8));_0x4ff59b(_0x375ca8);})[_0xf5f2('0x16')](function(_0x14c829){logger[_0xf5f2('0x11')]('GetTrunk',_0x14c829['message'],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x14c829[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x22')]=function(_0x153924){var _0x1b381e=this;return new Promise(function(_0x54c0c8,_0x52e959){return db[_0xf5f2('0x18')]['find']({'raw':_0x153924[_0xf5f2('0x1a')]?_0x153924['options'][_0xf5f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x153924[_0xf5f2('0x1a')]?_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x23')]||null:null,'attributes':_0x153924[_0xf5f2('0x1a')]?_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x20')]||null:null,'include':_0x153924[_0xf5f2('0x1a')]?_0x153924['options'][_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x1e')],function(_0x1408b9){return{'model':db[_0x1408b9[_0xf5f2('0x1f')]],'as':_0x1408b9['as'],'attributes':_0x1408b9[_0xf5f2('0x20')],'include':_0x1408b9['include']?_[_0xf5f2('0x1d')](_0x1408b9[_0xf5f2('0x1e')],function(_0x55989d){return{'model':db[_0x55989d[_0xf5f2('0x1f')]],'as':_0x55989d['as'],'attributes':_0x55989d['attributes'],'include':_0x55989d[_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x55989d[_0xf5f2('0x1e')],function(_0x2e3cca){return{'model':db[_0x2e3cca['model']],'as':_0x2e3cca['as'],'attributes':_0x2e3cca['attributes']};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x21')](function(_0x46ad4a){logger[_0xf5f2('0xd')]('ShowTrunk',_0x153924);logger[_0xf5f2('0xf')]('ShowTrunk',_0x153924,JSON[_0xf5f2('0x10')](_0x46ad4a));_0x54c0c8(_0x46ad4a);})['catch'](function(_0x46f464){logger[_0xf5f2('0x11')]('ShowTrunk',_0x46f464[_0xf5f2('0x13')],_0x153924);_0x52e959(_0x1b381e[_0xf5f2('0x11')](0x1f4,_0x46f464[_0xf5f2('0x13')]));});});}; \ No newline at end of file +var _0x1a85=['info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','Trunk','options','raw','where','limit','include','model','map','attributes','then','ShowTrunk','find','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x1a85,0x178));var _0x51a8=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0x1a85[_0x648163];return _0x199d4d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('Trunk,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});}exports[_0x51a8('0x13')]=function(_0x45a433){var _0xd52230=this;return new Promise(function(_0x23539e,_0x3bc1a2){return db[_0x51a8('0x14')]['findAll']({'raw':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x16')]===undefined?!![]:![]:!![],'where':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x17')]||null:null,'attributes':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')]['attributes']||null:null,'limit':_0x45a433[_0x51a8('0x15')]?_0x45a433['options'][_0x51a8('0x18')]||null:null,'include':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x19')]?_['map'](_0x45a433[_0x51a8('0x15')]['include'],function(_0x47f063){return{'model':db[_0x47f063[_0x51a8('0x1a')]],'as':_0x47f063['as'],'attributes':_0x47f063['attributes'],'include':_0x47f063[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x47f063[_0x51a8('0x19')],function(_0x18e2f3){return{'model':db[_0x18e2f3[_0x51a8('0x1a')]],'as':_0x18e2f3['as'],'attributes':_0x18e2f3[_0x51a8('0x1c')],'include':_0x18e2f3[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x18e2f3['include'],function(_0x273ce2){return{'model':db[_0x273ce2[_0x51a8('0x1a')]],'as':_0x273ce2['as'],'attributes':_0x273ce2[_0x51a8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x51a8('0x1d')](function(_0x1c150d){logger[_0x51a8('0x8')](_0x51a8('0x13'),_0x45a433);logger[_0x51a8('0xb')](_0x51a8('0x13'),_0x45a433,JSON[_0x51a8('0xd')](_0x1c150d));_0x23539e(_0x1c150d);})[_0x51a8('0x12')](function(_0x347a02){logger['error'](_0x51a8('0x13'),_0x347a02['message'],_0x45a433);_0x3bc1a2(_0xd52230[_0x51a8('0xe')](0x1f4,_0x347a02[_0x51a8('0x10')]));});});};exports[_0x51a8('0x1e')]=function(_0x41df56){var _0x2136b4=this;return new Promise(function(_0x4ea271,_0x10c19b){return db['Trunk'][_0x51a8('0x1f')]({'raw':_0x41df56[_0x51a8('0x15')]?_0x41df56[_0x51a8('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x41df56[_0x51a8('0x15')]?_0x41df56['options'][_0x51a8('0x17')]||null:null,'attributes':_0x41df56[_0x51a8('0x15')]?_0x41df56[_0x51a8('0x15')][_0x51a8('0x1c')]||null:null,'include':_0x41df56[_0x51a8('0x15')]?_0x41df56['options'][_0x51a8('0x19')]?_['map'](_0x41df56[_0x51a8('0x15')][_0x51a8('0x19')],function(_0x41561a){return{'model':db[_0x41561a['model']],'as':_0x41561a['as'],'attributes':_0x41561a[_0x51a8('0x1c')],'include':_0x41561a[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x41561a[_0x51a8('0x19')],function(_0x41c020){return{'model':db[_0x41c020['model']],'as':_0x41c020['as'],'attributes':_0x41c020['attributes'],'include':_0x41c020['include']?_[_0x51a8('0x1b')](_0x41c020[_0x51a8('0x19')],function(_0x4ec1db){return{'model':db[_0x4ec1db[_0x51a8('0x1a')]],'as':_0x4ec1db['as'],'attributes':_0x4ec1db['attributes']};}):[]};}):[]};}):[]:[]})[_0x51a8('0x1d')](function(_0x38aa25){logger[_0x51a8('0x8')](_0x51a8('0x1e'),_0x41df56);logger[_0x51a8('0xb')](_0x51a8('0x1e'),_0x41df56,JSON['stringify'](_0x38aa25));_0x4ea271(_0x38aa25);})['catch'](function(_0x377b4c){logger['error']('ShowTrunk',_0x377b4c['message'],_0x41df56);_0x10c19b(_0x2136b4[_0x51a8('0xe')](0x1f4,_0x377b4c[_0x51a8('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 3a93447..88b92d6 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 _0x48d3=['logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addSmsAccounts','addChatWebsites','addSquareProjects','createApiKey','/:id','update','put','/:id/password','changePassword','delete','removeTeams','/:id/chat_interactions','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSquareProjects','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','/describe','get','/whoami','whoami','show','getAvatar','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','/:id/contacts','create','/create_many','join','root','server/files/images/','format','now','originalname','/:id/avatar','single','addAvatar'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x48d3,0x90));var _0x348d=function(_0x39c999,_0x1968b8){_0x39c999=_0x39c999-0x0;var _0x2044f=_0x48d3[_0x39c999];return _0x2044f;};'use strict';var multer=require(_0x348d('0x0'));var util=require(_0x348d('0x1'));var path=require(_0x348d('0x2'));var timeout=require(_0x348d('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x348d('0x4'));var config=require(_0x348d('0x5'));var controller=require(_0x348d('0x6'));router['get']('/',auth[_0x348d('0x7')](),controller[_0x348d('0x8')]);router['get'](_0x348d('0x9'),auth[_0x348d('0x7')](),controller['describe']);router[_0x348d('0xa')](_0x348d('0xb'),auth[_0x348d('0x7')](),controller[_0x348d('0xc')]);router['get']('/:id',auth[_0x348d('0x7')](),controller[_0x348d('0xd')]);router[_0x348d('0xa')]('/:id/avatar',controller[_0x348d('0xe')]);router['get']('/:id/contacts',auth['isAuthenticated'](),controller[_0x348d('0xf')]);router['get'](_0x348d('0x10'),auth[_0x348d('0x7')](),controller[_0x348d('0x11')]);router[_0x348d('0xa')](_0x348d('0x12'),auth[_0x348d('0x7')](),controller[_0x348d('0x13')]);router[_0x348d('0xa')](_0x348d('0x14'),auth['isAuthenticated'](),controller['getGroups']);router[_0x348d('0xa')](_0x348d('0x15'),auth[_0x348d('0x7')](),controller[_0x348d('0x16')]);router[_0x348d('0xa')](_0x348d('0x17'),auth[_0x348d('0x7')](),controller[_0x348d('0x18')]);router['get'](_0x348d('0x19'),auth['isAuthenticated'](),controller['getChatInteractions']);router[_0x348d('0xa')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0x348d('0x1a')]);router['get'](_0x348d('0x1b'),auth['isAuthenticated'](),controller[_0x348d('0x1c')]);router[_0x348d('0xa')](_0x348d('0x1d'),auth[_0x348d('0x7')](),controller[_0x348d('0x1e')]);router[_0x348d('0xa')](_0x348d('0x1f'),auth[_0x348d('0x7')](),controller[_0x348d('0x20')]);router[_0x348d('0xa')](_0x348d('0x21'),auth[_0x348d('0x7')](),controller[_0x348d('0x22')]);router[_0x348d('0xa')](_0x348d('0x23'),auth[_0x348d('0x7')](),controller[_0x348d('0x24')]);router[_0x348d('0xa')]('/:id/lists',auth[_0x348d('0x7')](),controller[_0x348d('0x25')]);router[_0x348d('0xa')](_0x348d('0x26'),auth[_0x348d('0x7')](),controller['getAgents']);router[_0x348d('0xa')](_0x348d('0x27'),auth[_0x348d('0x7')](),controller[_0x348d('0x28')]);router[_0x348d('0xa')]('/:id/fax_accounts',auth[_0x348d('0x7')](),controller[_0x348d('0x29')]);router['get']('/:id/mail_accounts',auth[_0x348d('0x7')](),controller[_0x348d('0x2a')]);router['get'](_0x348d('0x2b'),auth[_0x348d('0x7')](),controller[_0x348d('0x2c')]);router[_0x348d('0xa')](_0x348d('0x2d'),auth[_0x348d('0x7')](),controller[_0x348d('0x2e')]);router[_0x348d('0xa')](_0x348d('0x2f'),auth[_0x348d('0x7')](),controller[_0x348d('0x30')]);router[_0x348d('0xa')](_0x348d('0x31'),auth['isAuthenticated'](),controller[_0x348d('0x32')]);router[_0x348d('0xa')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x348d('0x33')]);router[_0x348d('0xa')](_0x348d('0x34'),auth[_0x348d('0x7')](),controller[_0x348d('0x35')]);router['get'](_0x348d('0x36'),auth[_0x348d('0x7')](),controller['getApiKey']);router[_0x348d('0x37')](_0x348d('0x38'),auth['isAuthenticated'](),controller['addContacts']);router[_0x348d('0x37')]('/',auth[_0x348d('0x7')](),controller[_0x348d('0x39')]);router[_0x348d('0x37')](_0x348d('0x3a'),auth[_0x348d('0x7')](),controller['bulkCreate']);router['post'](_0x348d('0x10'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x109741,_0x4be5c6,_0x4632a3){_0x4632a3(null,path[_0x348d('0x3b')](config[_0x348d('0x3c')],_0x348d('0x3d')));},'filename':function(_0x4eb852,_0x3291cc,_0x5a2b23){_0x5a2b23(null,util[_0x348d('0x3e')]('%s-%s',Date[_0x348d('0x3f')](),_0x3291cc[_0x348d('0x40')]));}})});router['post'](_0x348d('0x41'),upload[_0x348d('0x42')]('file'),controller[_0x348d('0x43')]);router[_0x348d('0x37')]('/:id/login',auth[_0x348d('0x7')](),controller['login']);router[_0x348d('0x37')]('/:id/logout',auth[_0x348d('0x7')](),controller[_0x348d('0x44')]);router[_0x348d('0x37')](_0x348d('0x45'),auth[_0x348d('0x7')](),controller[_0x348d('0x46')]);router[_0x348d('0x37')](_0x348d('0x47'),auth['isAuthenticated'](),controller[_0x348d('0x48')]);router['post'](_0x348d('0x23'),auth[_0x348d('0x7')](),controller[_0x348d('0x49')]);router[_0x348d('0x37')]('/:id/chat_interactions',auth[_0x348d('0x7')](),controller[_0x348d('0x4a')]);router['post'](_0x348d('0x4b'),auth[_0x348d('0x7')](),controller['addMailInteractions']);router['post']('/:id/fax_interactions',auth[_0x348d('0x7')](),controller[_0x348d('0x4c')]);router[_0x348d('0x37')](_0x348d('0x4d'),auth[_0x348d('0x7')](),controller[_0x348d('0x4e')]);router[_0x348d('0x37')](_0x348d('0x4f'),auth[_0x348d('0x7')](),controller[_0x348d('0x50')]);router[_0x348d('0x37')](_0x348d('0x51'),auth[_0x348d('0x7')](),controller[_0x348d('0x52')]);router['post'](_0x348d('0x53'),auth[_0x348d('0x7')](),controller[_0x348d('0x54')]);router[_0x348d('0x37')](_0x348d('0x55'),auth['isAuthenticated'](),controller[_0x348d('0x56')]);router[_0x348d('0x37')](_0x348d('0x2b'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router[_0x348d('0x37')](_0x348d('0x2d'),auth[_0x348d('0x7')](),controller[_0x348d('0x57')]);router['post'](_0x348d('0x2f'),auth[_0x348d('0x7')](),controller[_0x348d('0x58')]);router[_0x348d('0x37')](_0x348d('0x31'),auth[_0x348d('0x7')](),controller['addWhatsappAccounts']);router['post']('/:id/square_projects',auth[_0x348d('0x7')](),controller[_0x348d('0x59')]);router['post'](_0x348d('0x36'),auth['isAuthenticated'](),controller[_0x348d('0x5a')]);router['put'](_0x348d('0x5b'),auth[_0x348d('0x7')](),controller[_0x348d('0x5c')]);router[_0x348d('0x5d')](_0x348d('0x5e'),auth['isAuthenticated'](),controller[_0x348d('0x5f')]);router[_0x348d('0x60')]('/:id/queues',auth[_0x348d('0x7')](),controller['removeQueues']);router[_0x348d('0x60')](_0x348d('0x23'),auth['isAuthenticated'](),controller[_0x348d('0x61')]);router['delete'](_0x348d('0x5b'),auth[_0x348d('0x7')](),controller['destroy']);router[_0x348d('0x60')](_0x348d('0x62'),auth[_0x348d('0x7')](),controller['removeChatInteractions']);router[_0x348d('0x60')](_0x348d('0x4b'),auth[_0x348d('0x7')](),controller[_0x348d('0x63')]);router[_0x348d('0x60')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x348d('0x64')]);router['delete']('/:id/sms_interactions',auth[_0x348d('0x7')](),controller['removeSmsInteractions']);router[_0x348d('0x60')](_0x348d('0x4f'),auth[_0x348d('0x7')](),controller[_0x348d('0x65')]);router[_0x348d('0x60')](_0x348d('0x51'),auth[_0x348d('0x7')](),controller['removeWhatsappInteractions']);router[_0x348d('0x60')](_0x348d('0x53'),auth[_0x348d('0x7')](),controller[_0x348d('0x66')]);router['delete'](_0x348d('0x55'),auth[_0x348d('0x7')](),controller['removeMailAccounts']);router[_0x348d('0x60')](_0x348d('0x2b'),auth[_0x348d('0x7')](),controller[_0x348d('0x67')]);router[_0x348d('0x60')](_0x348d('0x2d'),auth[_0x348d('0x7')](),controller['removeSmsAccounts']);router['delete']('/:id/chat_websites',auth['isAuthenticated'](),controller['removeChatWebsites']);router['delete']('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router[_0x348d('0x60')]('/:id/square_projects',auth[_0x348d('0x7')](),controller[_0x348d('0x68')]);router[_0x348d('0x60')](_0x348d('0x36'),auth[_0x348d('0x7')](),controller['removeApiKey']);module[_0x348d('0x69')]=router; \ No newline at end of file +var _0xf3bb=['/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','/whoami','whoami','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','addContacts','create','/create_many','join','server/files/images/','format','%s-%s','now','single','addAvatar','/:id/login','login','logout','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addFaxInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','/:id/fax_accounts','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addSquareProjects','put','/:id','update'];(function(_0x4ed6c7,_0x2e6803){var _0x112d0c=function(_0x188c4f){while(--_0x188c4f){_0x4ed6c7['push'](_0x4ed6c7['shift']());}};_0x112d0c(++_0x2e6803);}(_0xf3bb,0x1b6));var _0xbf3b=function(_0x321165,_0x4a38f6){_0x321165=_0x321165-0x0;var _0x300b8f=_0xf3bb[_0x321165];return _0x300b8f;};'use strict';var multer=require(_0xbf3b('0x0'));var util=require(_0xbf3b('0x1'));var path=require(_0xbf3b('0x2'));var timeout=require(_0xbf3b('0x3'));var express=require(_0xbf3b('0x4'));var router=express[_0xbf3b('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xbf3b('0x6'));var config=require(_0xbf3b('0x7'));var controller=require(_0xbf3b('0x8'));router['get']('/',auth[_0xbf3b('0x9')](),controller[_0xbf3b('0xa')]);router[_0xbf3b('0xb')]('/describe',auth[_0xbf3b('0x9')](),controller['describe']);router[_0xbf3b('0xb')](_0xbf3b('0xc'),auth[_0xbf3b('0x9')](),controller[_0xbf3b('0xd')]);router[_0xbf3b('0xb')]('/:id',auth[_0xbf3b('0x9')](),controller['show']);router[_0xbf3b('0xb')](_0xbf3b('0xe'),controller[_0xbf3b('0xf')]);router[_0xbf3b('0xb')](_0xbf3b('0x10'),auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x11')]);router['get'](_0xbf3b('0x12'),auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x13')]);router[_0xbf3b('0xb')]('/:id/queues_rt',auth[_0xbf3b('0x9')](),controller['getVoiceQueuesRt']);router[_0xbf3b('0xb')]('/:id/groups',auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x14')]);router[_0xbf3b('0xb')](_0xbf3b('0x15'),auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x16')]);router['get'](_0xbf3b('0x17'),auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x18')]);router[_0xbf3b('0xb')]('/:id/chat/interactions',auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x19')]);router[_0xbf3b('0xb')](_0xbf3b('0x1a'),auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x1b')]);router[_0xbf3b('0xb')](_0xbf3b('0x1c'),auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x1d')]);router[_0xbf3b('0xb')]('/:id/sms/interactions',auth[_0xbf3b('0x9')](),controller['getSmsInteractions']);router[_0xbf3b('0xb')](_0xbf3b('0x1e'),auth[_0xbf3b('0x9')](),controller['getFaxInteractions']);router[_0xbf3b('0xb')](_0xbf3b('0x1f'),auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x20')]);router[_0xbf3b('0xb')](_0xbf3b('0x21'),auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x22')]);router[_0xbf3b('0xb')](_0xbf3b('0x23'),auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x24')]);router[_0xbf3b('0xb')](_0xbf3b('0x25'),auth['isAuthenticated'](),controller[_0xbf3b('0x26')]);router['get'](_0xbf3b('0x27'),auth[_0xbf3b('0x9')](),controller['getVoicePrefixes']);router['get']('/:id/fax_accounts',auth['isAuthenticated'](),controller['getFaxAccounts']);router['get'](_0xbf3b('0x28'),auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x29')]);router[_0xbf3b('0xb')](_0xbf3b('0x2a'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router['get'](_0xbf3b('0x2b'),auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x2c')]);router[_0xbf3b('0xb')]('/:id/chat_websites',auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x2d')]);router['get'](_0xbf3b('0x2e'),auth['isAuthenticated'](),controller['getWhatsappAccounts']);router[_0xbf3b('0xb')](_0xbf3b('0x2f'),auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x30')]);router[_0xbf3b('0xb')](_0xbf3b('0x31'),auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x32')]);router[_0xbf3b('0xb')]('/:id/api_key',auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x33')]);router[_0xbf3b('0x34')](_0xbf3b('0x10'),auth['isAuthenticated'](),controller[_0xbf3b('0x35')]);router[_0xbf3b('0x34')]('/',auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x36')]);router['post'](_0xbf3b('0x37'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0xbf3b('0x34')]('/:id/queues',auth[_0xbf3b('0x9')](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x105b9d,_0x590395,_0x216c5a){_0x216c5a(null,path[_0xbf3b('0x38')](config['root'],_0xbf3b('0x39')));},'filename':function(_0x24967a,_0x181f88,_0x375267){_0x375267(null,util[_0xbf3b('0x3a')](_0xbf3b('0x3b'),Date[_0xbf3b('0x3c')](),_0x181f88['originalname']));}})});router[_0xbf3b('0x34')](_0xbf3b('0xe'),upload[_0xbf3b('0x3d')]('file'),controller[_0xbf3b('0x3e')]);router[_0xbf3b('0x34')](_0xbf3b('0x3f'),auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x40')]);router[_0xbf3b('0x34')]('/:id/logout',auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x41')]);router[_0xbf3b('0x34')]('/:id/pause',auth['isAuthenticated'](),controller[_0xbf3b('0x42')]);router[_0xbf3b('0x34')](_0xbf3b('0x43'),auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x44')]);router[_0xbf3b('0x34')](_0xbf3b('0x21'),auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x45')]);router[_0xbf3b('0x34')](_0xbf3b('0x46'),auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x47')]);router['post'](_0xbf3b('0x48'),auth[_0xbf3b('0x9')](),controller['addMailInteractions']);router[_0xbf3b('0x34')]('/:id/fax_interactions',auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x49')]);router[_0xbf3b('0x34')]('/:id/sms_interactions',auth[_0xbf3b('0x9')](),controller['addSmsInteractions']);router[_0xbf3b('0x34')](_0xbf3b('0x4a'),auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x4b')]);router[_0xbf3b('0x34')](_0xbf3b('0x4c'),auth['isAuthenticated'](),controller['addWhatsappInteractions']);router[_0xbf3b('0x34')](_0xbf3b('0x4d'),auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x4e')]);router[_0xbf3b('0x34')](_0xbf3b('0x28'),auth[_0xbf3b('0x9')](),controller['addMailAccounts']);router[_0xbf3b('0x34')](_0xbf3b('0x2a'),auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x4f')]);router[_0xbf3b('0x34')](_0xbf3b('0x2b'),auth['isAuthenticated'](),controller[_0xbf3b('0x50')]);router[_0xbf3b('0x34')](_0xbf3b('0x51'),auth['isAuthenticated'](),controller[_0xbf3b('0x52')]);router['post']('/:id/whatsapp_accounts',auth[_0xbf3b('0x9')](),controller['addWhatsappAccounts']);router[_0xbf3b('0x34')](_0xbf3b('0x2f'),auth['isAuthenticated'](),controller[_0xbf3b('0x53')]);router[_0xbf3b('0x34')]('/:id/api_key',auth['isAuthenticated'](),controller['createApiKey']);router[_0xbf3b('0x54')](_0xbf3b('0x55'),auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x56')]);router[_0xbf3b('0x54')](_0xbf3b('0x57'),auth['isAuthenticated'](),controller[_0xbf3b('0x58')]);router[_0xbf3b('0x59')]('/:id/queues',auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x5a')]);router['delete'](_0xbf3b('0x21'),auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x5b')]);router[_0xbf3b('0x59')](_0xbf3b('0x55'),auth['isAuthenticated'](),controller[_0xbf3b('0x5c')]);router['delete'](_0xbf3b('0x46'),auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x5d')]);router['delete'](_0xbf3b('0x48'),auth['isAuthenticated'](),controller[_0xbf3b('0x5e')]);router[_0xbf3b('0x59')](_0xbf3b('0x5f'),auth[_0xbf3b('0x9')](),controller['removeFaxInteractions']);router[_0xbf3b('0x59')](_0xbf3b('0x60'),auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x61')]);router['delete'](_0xbf3b('0x4a'),auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x62')]);router[_0xbf3b('0x59')](_0xbf3b('0x4c'),auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x63')]);router['delete'](_0xbf3b('0x4d'),auth['isAuthenticated'](),controller[_0xbf3b('0x64')]);router[_0xbf3b('0x59')](_0xbf3b('0x28'),auth[_0xbf3b('0x9')](),controller[_0xbf3b('0x65')]);router[_0xbf3b('0x59')](_0xbf3b('0x2a'),auth[_0xbf3b('0x9')](),controller['removeOpenchannelAccounts']);router['delete']('/:id/sms_accounts',auth[_0xbf3b('0x9')](),controller['removeSmsAccounts']);router['delete'](_0xbf3b('0x51'),auth['isAuthenticated'](),controller[_0xbf3b('0x66')]);router[_0xbf3b('0x59')](_0xbf3b('0x2e'),auth[_0xbf3b('0x9')](),controller['removeWhatsappAccounts']);router[_0xbf3b('0x59')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0xbf3b('0x67')]);router[_0xbf3b('0x59')]('/:id/api_key',auth['isAuthenticated'](),controller[_0xbf3b('0x68')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 18defb6..80d26f7 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 _0x01e0=['from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','insecure','never','\x22\x22\x20<>','accept','refuse','originate','uac','uas','certificate','active','passive','update,nonat','showWebBar','isArray','udp','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','/etc/pki/tls/certs/motion.crt','TEXT','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','sequelize','moment','util','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','toLowerCase','ENUM','admin','user','local','accountcode','format','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','friend','peer'];(function(_0x101d25,_0x33dbba){var _0x586671=function(_0x2d7f63){while(--_0x2d7f63){_0x101d25['push'](_0x101d25['shift']());}};_0x586671(++_0x33dbba);}(_0x01e0,0x96));var _0x001e=function(_0x53e35e,_0x114a69){_0x53e35e=_0x53e35e-0x0;var _0xaaaa6a=_0x01e0[_0x53e35e];return _0xaaaa6a;};'use strict';var Sequelize=require(_0x001e('0x0'));var moment=require(_0x001e('0x1'));var util=require(_0x001e('0x2'));var _=require(_0x001e('0x3'));module[_0x001e('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x001e('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x51aca1){this['setDataValue']('name',_0x51aca1);this[_0x001e('0x6')](_0x001e('0x7'),_0x51aca1);},'comment':_0x001e('0x8')},'fullname':{'type':Sequelize[_0x001e('0x9')],'allowNull':![],'set':function(_0x4faea7){this[_0x001e('0x6')](_0x001e('0xa'),_0x4faea7);this[_0x001e('0x6')](_0x001e('0xb'),util['format'](_0x001e('0xc'),_0x4faea7,this[_0x001e('0xd')](_0x001e('0xe'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x001e('0x9')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x1959ed){if(_0x1959ed){this[_0x001e('0x6')]('email',_0x1959ed[_0x001e('0xf')]());}}},'role':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x11'),_0x001e('0x12'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x001e('0x9')],'defaultValue':_0x001e('0x13')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x001e('0xe'),'set':function(_0x13e8df){this[_0x001e('0x6')]('internal',_0x13e8df);this[_0x001e('0x6')](_0x001e('0x14'),_0x13e8df);this[_0x001e('0x6')]('callerid',util[_0x001e('0x15')](_0x001e('0xc'),this[_0x001e('0xd')](_0x001e('0xa')),_0x13e8df));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x001e('0x9')]},'mobile':{'type':Sequelize[_0x001e('0x9')]},'address':{'type':Sequelize[_0x001e('0x9')]},'zipcode':{'type':Sequelize[_0x001e('0x9')]},'userpic':{'type':Sequelize[_0x001e('0x9')]},'city':{'type':Sequelize[_0x001e('0x9')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x001e('0x17')]},'voicePause':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x001e('0x18')},'lastPauseAt':{'type':Sequelize[_0x001e('0x17')]},'chatCapacity':{'type':Sequelize[_0x001e('0x19')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x001e('0x19')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x001e('0x19')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x001e('0x19')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x001e('0x19')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x001e('0x19')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x001e('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x001e('0x19')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x001e('0x19')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x001e('0x19')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x1a'),_0x001e('0x12'),_0x001e('0x1b')),'allowNull':!![],'defaultValue':_0x001e('0x1a')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x001e('0x1c')},'callingpres':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x1d'),_0x001e('0x1e'),_0x001e('0x1f'),_0x001e('0x20'),_0x001e('0x21'),_0x001e('0x22'),_0x001e('0x23'),_0x001e('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'permit':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'secret':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'transport':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![],'defaultValue':'udp','set':function(_0x13005f){this[_0x001e('0x6')]('transport',_0x13005f?_0x13005f['join'](','):null);},'get':function(){return this[_0x001e('0xd')](_0x001e('0x25'))?this[_0x001e('0xd')](_0x001e('0x25'))[_0x001e('0x26')](','):null;},'comment':_0x001e('0x27')},'dtmfmode':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x28'),'info',_0x001e('0x29'),'inband',_0x001e('0x2a')),'allowNull':!![],'defaultValue':_0x001e('0x28')},'directmedia':{'type':Sequelize['ENUM'](_0x001e('0x2b'),'no',_0x001e('0x2c'),_0x001e('0x2d'),_0x001e('0x2e')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x001e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'nat':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![],'defaultValue':_0x001e('0x2f'),'set':function(_0x227c93){this[_0x001e('0x6')](_0x001e('0x30'),_0x227c93?_0x227c93[_0x001e('0x31')](','):null);},'get':function(){return this[_0x001e('0xd')](_0x001e('0x30'))?this[_0x001e('0xd')]('nat')[_0x001e('0x26')](','):null;},'comment':_0x001e('0x32')},'callgroup':{'type':Sequelize[_0x001e('0x9')]},'namedcallgroup':{'type':Sequelize[_0x001e('0x9')]},'pickupgroup':{'type':Sequelize[_0x001e('0x9')]},'namedpickupgroup':{'type':Sequelize[_0x001e('0x9')]},'language':{'type':Sequelize[_0x001e('0x9')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x001e('0x9')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x001e('0x33')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x8357b6){this['setDataValue'](_0x001e('0x34'),_0x8357b6?_0x8357b6[_0x001e('0x31')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x001e('0xd')]('allow')?this[_0x001e('0xd')](_0x001e('0x34'))[_0x001e('0x26')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![],'set':function(_0x4a82d3){this[_0x001e('0x6')](_0x001e('0x35'),_0x4a82d3?_0x4a82d3[_0x001e('0x31')](','):null);},'get':function(){return this[_0x001e('0xd')]('insecure')?this['getDataValue']('insecure')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x001e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x2b'),'no',_0x001e('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![],'defaultValue':_0x001e('0x37')},'amaflags':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x001e('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x001e('0x2b')},'busylevel':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x001e('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'template':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x001e('0x2b'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x38'),_0x001e('0x39'),_0x001e('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x001e('0x3b'),_0x001e('0x3c')),'allowNull':!![],'defaultValue':_0x001e('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x001e('0x2b')},'keepalive':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x001e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x001e('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x001e('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x2b'),'no','fingerprint',_0x001e('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x001e('0x3e'),_0x001e('0x3f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x001e('0x19')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x001e('0x10')]('yes','no',_0x001e('0x2c'),'update',_0x001e('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x001e('0x9')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x001e('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x001e('0x9')]},'showWebBar':{'type':Sequelize[_0x001e('0x19')],'defaultValue':0x0,'set':function(_0x511f65){this['setDataValue'](_0x001e('0x41'),_0x511f65);var _0x2fb3d2=this['get']({'plain':!![]});switch(_0x511f65){case 0x0:case 0x1:var _0x554d2e=_0x2fb3d2[_0x001e('0x25')]?_[_0x001e('0x42')](_0x2fb3d2[_0x001e('0x25')])?_0x2fb3d2[_0x001e('0x25')][_0x001e('0x31')]():_0x2fb3d2['transport']:_0x001e('0x43');if(_0x554d2e==='wss'){_0x554d2e=_0x001e('0x43');}this['setDataValue'](_0x001e('0x25'),_0x554d2e);this[_0x001e('0x6')]('encryption','no');this['setDataValue'](_0x001e('0x44'),null);this[_0x001e('0x6')](_0x001e('0x45'),null);this[_0x001e('0x6')](_0x001e('0x46'),null);this[_0x001e('0x6')](_0x001e('0x47'),null);this['setDataValue'](_0x001e('0x48'),null);this[_0x001e('0x6')](_0x001e('0x49'),null);this[_0x001e('0x6')](_0x001e('0x4a'),null);this[_0x001e('0x6')](_0x001e('0x4b'),null);this[_0x001e('0x6')](_0x001e('0x4c'),'no');break;case 0x2:this['setDataValue'](_0x001e('0x25'),_0x001e('0x4d'));this[_0x001e('0x6')]('encryption',_0x001e('0x2b'));this[_0x001e('0x6')](_0x001e('0x44'),'yes');this[_0x001e('0x6')](_0x001e('0x45'),'yes');this[_0x001e('0x6')]('icesupport',_0x001e('0x2b'));this[_0x001e('0x6')]('dtlsenable',_0x001e('0x2b'));this[_0x001e('0x6')](_0x001e('0x48'),'no');this['setDataValue']('dtlssetup','actpass');this[_0x001e('0x6')]('dtlscertfile',_0x2fb3d2[_0x001e('0x4a')]||_0x001e('0x4e'));this[_0x001e('0x6')](_0x001e('0x4b'),_0x2fb3d2['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this[_0x001e('0x6')](_0x001e('0x4c'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x001e('0x4f')],'set':function(_0x5a09e2){this[_0x001e('0x6')]('permissions',_0x5a09e2?_0x5a09e2[_0x001e('0x31')](','):[]);},'get':function(){return this[_0x001e('0xd')](_0x001e('0x50'))?_[_0x001e('0x51')](this[_0x001e('0xd')](_0x001e('0x50'))[_0x001e('0x26')](','),function(_0x44a444){return parseInt(_0x44a444,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x001e('0x9')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x001e('0x9')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x001e('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x001e('0x19')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x001e('0x9')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x001e('0x19')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x001e('0x10')](_0x001e('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x001e('0x9')]},'phoneBarEnableJaws':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x001e('0xd')]('phoneBarEnableScreenRecordingByAgent')?this[_0x001e('0xd')](_0x001e('0x52')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0x001e('0x9')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x001e('0x9')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![],'set':function(_0xe28dcd){if(typeof _0xe28dcd===_0x001e('0x53')){var _0x1935e0=_0xe28dcd==='1'?!![]:_0xe28dcd==='0'?![]:_0xe28dcd===_0x001e('0x54')?!![]:_0xe28dcd===_0x001e('0x55')?![]:![];this[_0x001e('0x6')](_0x001e('0x56'),_0x1935e0);}else{this[_0x001e('0x6')]('screenrecording',_0xe28dcd);}}},'blocked':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![],'set':function(_0x4ada42){this[_0x001e('0x6')]('blocked',_0x4ada42);if(_0x4ada42===!![]){this[_0x001e('0x6')](_0x001e('0x57'),moment());this[_0x001e('0x6')](_0x001e('0x58'),0x0);}else{this[_0x001e('0x6')](_0x001e('0x57'),null);}}},'blockedAt':{'type':Sequelize[_0x001e('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x001e('0x19')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x001e('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x001e('0x16')],'defaultValue':!![]}}; \ No newline at end of file +var _0x37d5=['phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','blockedAt','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','user','agent','INTEGER','accountcode','getDataValue','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','yes','nonat','update','outgoing','nat','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','uac','uas','fingerprint','certificate','actpass','update,nonat','showWebBar','get','isArray','udp','wss','encryption','avpf','icesupport','dtlsenable','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','force_avp','dtlsverify','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL'];(function(_0x383b59,_0x341713){var _0x381adc=function(_0x626106){while(--_0x626106){_0x383b59['push'](_0x383b59['shift']());}};_0x381adc(++_0x341713);}(_0x37d5,0xb3));var _0x537d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x37d5[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x537d('0x0'));var moment=require(_0x537d('0x1'));var util=require(_0x537d('0x2'));var _=require(_0x537d('0x3'));module[_0x537d('0x4')]={'name':{'type':Sequelize[_0x537d('0x5')],'allowNull':![],'unique':_0x537d('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4e6613){this[_0x537d('0x7')]('name',_0x4e6613);this['setDataValue'](_0x537d('0x8'),_0x4e6613);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x537d('0x5')],'allowNull':![],'set':function(_0x1859b9){this[_0x537d('0x7')](_0x537d('0x9'),_0x1859b9);this[_0x537d('0x7')](_0x537d('0xa'),util[_0x537d('0xb')](_0x537d('0xc'),_0x1859b9,this['getDataValue'](_0x537d('0xd'))));}},'alias':{'type':Sequelize[_0x537d('0x5')]},'email':{'type':Sequelize[_0x537d('0x5')],'allowNull':![],'unique':_0x537d('0xe'),'validate':{'isEmail':!![]},'set':function(_0x5d93e1){if(_0x5d93e1){this[_0x537d('0x7')]('email',_0x5d93e1[_0x537d('0xf')]());}}},'role':{'type':Sequelize[_0x537d('0x10')]('admin',_0x537d('0x11'),_0x537d('0x12'),'telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x537d('0x5')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x537d('0x13')](0xb),'allowNull':![],'unique':'internal','set':function(_0x5d38ee){this[_0x537d('0x7')](_0x537d('0xd'),_0x5d38ee);this[_0x537d('0x7')](_0x537d('0x14'),_0x5d38ee);this[_0x537d('0x7')](_0x537d('0xa'),util['format'](_0x537d('0xc'),this[_0x537d('0x15')](_0x537d('0x9')),_0x5d38ee));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x537d('0x5')]},'address':{'type':Sequelize[_0x537d('0x5')]},'zipcode':{'type':Sequelize[_0x537d('0x5')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x537d('0x5')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x537d('0x16')]},'voicePause':{'type':Sequelize[_0x537d('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x537d('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x537d('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x537d('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x537d('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x537d('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x537d('0x18')},'lastPauseAt':{'type':Sequelize[_0x537d('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x537d('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x537d('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x537d('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x537d('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x537d('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x537d('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x537d('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x537d('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x537d('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![],'defaultValue':_0x537d('0x19')},'ipaddr':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0x537d('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x537d('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x537d('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x537d('0x10')](_0x537d('0x1a'),_0x537d('0x11'),_0x537d('0x1b')),'allowNull':!![],'defaultValue':_0x537d('0x1a')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x537d('0x1c')},'callingpres':{'type':Sequelize[_0x537d('0x10')](_0x537d('0x1d'),_0x537d('0x1e'),'ALLOWED_FAILED_SCREEN',_0x537d('0x1f'),_0x537d('0x20'),'PROHIB_PASSED_SCREEN',_0x537d('0x21'),_0x537d('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x587d1a){this['setDataValue'](_0x537d('0x23'),_0x587d1a?_0x587d1a[_0x537d('0x24')](','):null);},'get':function(){return this[_0x537d('0x15')](_0x537d('0x23'))?this[_0x537d('0x15')](_0x537d('0x23'))[_0x537d('0x25')](','):null;},'comment':_0x537d('0x26')},'dtmfmode':{'type':Sequelize[_0x537d('0x10')]('rfc2833',_0x537d('0x27'),_0x537d('0x28'),_0x537d('0x29'),_0x537d('0x2a')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x537d('0x10')](_0x537d('0x2b'),'no',_0x537d('0x2c'),_0x537d('0x2d'),_0x537d('0x2e')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x537d('0x10')](_0x537d('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x7a6db6){this['setDataValue']('nat',_0x7a6db6?_0x7a6db6[_0x537d('0x24')](','):null);},'get':function(){return this[_0x537d('0x15')](_0x537d('0x2f'))?this[_0x537d('0x15')](_0x537d('0x2f'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x537d('0x5')]},'namedcallgroup':{'type':Sequelize[_0x537d('0x5')]},'pickupgroup':{'type':Sequelize[_0x537d('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x537d('0x5')]},'language':{'type':Sequelize[_0x537d('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x537d('0x5')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x537d('0x5')],'allowNull':![],'defaultValue':_0x537d('0x30'),'set':function(_0x25ae66){this[_0x537d('0x7')](_0x537d('0x31'),_0x25ae66?_0x25ae66[_0x537d('0x24')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x537d('0x15')](_0x537d('0x31'))?this[_0x537d('0x15')](_0x537d('0x31'))[_0x537d('0x25')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x537d('0x10')](_0x537d('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x4742d2){this[_0x537d('0x7')]('insecure',_0x4742d2?_0x4742d2['join'](','):null);},'get':function(){return this[_0x537d('0x15')](_0x537d('0x32'))?this[_0x537d('0x15')](_0x537d('0x32'))['split'](','):null;},'comment':_0x537d('0x33')},'trustrpid':{'type':Sequelize[_0x537d('0x10')](_0x537d('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x537d('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x537d('0x2b'),'no',_0x537d('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x537d('0x10')](_0x537d('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x537d('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x537d('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x537d('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x537d('0x2b')},'busylevel':{'type':Sequelize[_0x537d('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x537d('0x10')](_0x537d('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x537d('0x10')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x537d('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x537d('0x10')](_0x537d('0x2b'),'no',_0x537d('0x35')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x537d('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x537d('0x10')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x537d('0x10')]('accept','refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x537d('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x537d('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x537d('0x36'),_0x537d('0x37')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x537d('0x10')](_0x537d('0x2b'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x537d('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x537d('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x537d('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x537d('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x537d('0x10')](_0x537d('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x537d('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x537d('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x537d('0x10')](_0x537d('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x537d('0x10')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x537d('0x10')](_0x537d('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x537d('0x10')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x537d('0x10')](_0x537d('0x2b'),'no',_0x537d('0x38'),_0x537d('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x537d('0x10')]('active','passive',_0x537d('0x3a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x537d('0x10')](_0x537d('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x537d('0x10')](_0x537d('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x537d('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x537d('0x2b'),'no','nonat',_0x537d('0x2d'),_0x537d('0x3b')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x537d('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0x537d('0x16')]},'passwordResetAt':{'type':Sequelize[_0x537d('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x537d('0x5')]},'showWebBar':{'type':Sequelize[_0x537d('0x13')],'defaultValue':0x0,'set':function(_0x2ec2d4){this[_0x537d('0x7')](_0x537d('0x3c'),_0x2ec2d4);var _0x5bd54b=this[_0x537d('0x3d')]({'plain':!![]});switch(_0x2ec2d4){case 0x0:case 0x1:var _0x3a02be=_0x5bd54b['transport']?_[_0x537d('0x3e')](_0x5bd54b['transport'])?_0x5bd54b['transport'][_0x537d('0x24')]():_0x5bd54b['transport']:_0x537d('0x3f');if(_0x3a02be===_0x537d('0x40')){_0x3a02be=_0x537d('0x3f');}this['setDataValue'](_0x537d('0x23'),_0x3a02be);this[_0x537d('0x7')](_0x537d('0x41'),'no');this['setDataValue'](_0x537d('0x42'),null);this['setDataValue']('force_avp',null);this[_0x537d('0x7')](_0x537d('0x43'),null);this[_0x537d('0x7')](_0x537d('0x44'),null);this[_0x537d('0x7')]('dtlsverify',null);this['setDataValue'](_0x537d('0x45'),null);this['setDataValue'](_0x537d('0x46'),null);this[_0x537d('0x7')](_0x537d('0x47'),null);this['setDataValue'](_0x537d('0x48'),'no');break;case 0x2:this[_0x537d('0x7')](_0x537d('0x23'),'wss');this[_0x537d('0x7')](_0x537d('0x41'),_0x537d('0x2b'));this['setDataValue'](_0x537d('0x42'),_0x537d('0x2b'));this[_0x537d('0x7')](_0x537d('0x49'),'yes');this['setDataValue']('icesupport',_0x537d('0x2b'));this['setDataValue'](_0x537d('0x44'),_0x537d('0x2b'));this['setDataValue'](_0x537d('0x4a'),'no');this[_0x537d('0x7')](_0x537d('0x45'),_0x537d('0x3a'));this[_0x537d('0x7')](_0x537d('0x46'),_0x5bd54b[_0x537d('0x46')]||'/etc/pki/tls/certs/motion.crt');this[_0x537d('0x7')](_0x537d('0x47'),_0x5bd54b[_0x537d('0x47')]||_0x537d('0x4b'));this[_0x537d('0x7')](_0x537d('0x48'),_0x537d('0x2b'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x17c3e3){this[_0x537d('0x7')](_0x537d('0x4c'),_0x17c3e3?_0x17c3e3[_0x537d('0x24')](','):[]);},'get':function(){return this[_0x537d('0x15')](_0x537d('0x4c'))?_[_0x537d('0x4d')](this[_0x537d('0x15')](_0x537d('0x4c'))[_0x537d('0x25')](','),function(_0x5bff61){return parseInt(_0x5bff61,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x537d('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x537d('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0x537d('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x537d('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x537d('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x537d('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x537d('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x537d('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x537d('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x537d('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x537d('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x537d('0x5')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x537d('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x537d('0x4e')],'get':function(){return this[_0x537d('0x15')]('phoneBarEnableScreenRecordingByAgent')?this[_0x537d('0x15')](_0x537d('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x537d('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x537d('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x537d('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x537d('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x537d('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x537d('0x17')],'defaultValue':![],'set':function(_0xbcd022){if(typeof _0xbcd022===_0x537d('0x50')){var _0x12b22a=_0xbcd022==='1'?!![]:_0xbcd022==='0'?![]:_0xbcd022==='true'?!![]:_0xbcd022===_0x537d('0x51')?![]:![];this[_0x537d('0x7')](_0x537d('0x52'),_0x12b22a);}else{this[_0x537d('0x7')]('screenrecording',_0xbcd022);}}},'blocked':{'type':Sequelize[_0x537d('0x17')],'defaultValue':![],'set':function(_0x28045a){this[_0x537d('0x7')](_0x537d('0x53'),_0x28045a);if(_0x28045a===!![]){this['setDataValue']('blockedAt',moment());this[_0x537d('0x7')](_0x537d('0x54'),0x0);}else{this[_0x537d('0x7')](_0x537d('0x55'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x537d('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x537d('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x537d('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 28ded2c..533ff25 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 _0xba39=['keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','pick','filters','merge','VIRTUAL','sequelize','where','lower','col','options','findAll','rows','catch','show','params','rawAttributes','salt','includeAll','body','describe','ids','internal','Setting','findById','securePassword','max','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','mailbox','VoiceMail','fullname','permissions','101','102','103','113','110','105','106','107','108','100','111','114','user','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','create','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','push','all','each','autoAssociation','compact','changePassword','oldPassword','newPassword','ValidationError','Sequelize','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','Queues','penalty','spread','toLowerCase','QueueId','emit','capitalize','Queue:save','voice','VoiceQueue','online','format','SIP/%s','upsert','removeQueues','remove','Queue:remove','userpic','filename','getAvatar','root','download','existsSync','join','server/files/images/','getContacts','sort','include','List','color','tag','order','Queue','get','Unknown\x20role','getVoiceQueuesRt','UserVoiceQueueRt','getGroups','ChatGroup','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','connection','socket','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','LOGIN','PAUSE','LOGININPAUSE','concat','isMiddleware','logout','pause','QueuePause','updateAttributes','type','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','smsPause','whatsapppause','pauseType','lastPauseAt','mail','chat','fax','sms','whatsapp','openchannel','%s%s','manual','getTeams','addTeams','omit','Team','setDataValue','Voice','Chat','getMailQueues','Sms','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','removeTeams','getChatQueues','Mail','removeAgent','CmList','getLists','getAgents','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','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','isArray','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','$and','$or','$gt','$gte','$lte','$ne','$not','$between','$notBetween','$in','$like','$notLike','$iLike','$notILike','$overlap','$contains','$any','lastName','phone','CmContact','Contact','dialActive','CmHopper','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./user.socket','register','jayson/promise','client','http','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','limit','set','Content-Range','reject','update','destroy','role','admin','Agents','agent','Telephones','telephone','filter','map','value','includes','find','name','send','index','User','fieldName','key','model','differenceBy','password'];(function(_0x1662fe,_0x209eca){var _0x3e6da6=function(_0x3c7775){while(--_0x3c7775){_0x1662fe['push'](_0x1662fe['shift']());}};_0x3e6da6(++_0x209eca);}(_0xba39,0x133));var _0x9ba3=function(_0x388502,_0x231833){_0x388502=_0x388502-0x0;var _0x3f50ed=_0xba39[_0x388502];return _0x3f50ed;};'use strict';var pdf=require(_0x9ba3('0x0'));var emlformat=require(_0x9ba3('0x1'));var rimraf=require(_0x9ba3('0x2'));var zipdir=require(_0x9ba3('0x3'));var jsonpatch=require(_0x9ba3('0x4'));var rp=require(_0x9ba3('0x5'));var moment=require(_0x9ba3('0x6'));var BPromise=require(_0x9ba3('0x7'));var Mustache=require(_0x9ba3('0x8'));var util=require(_0x9ba3('0x9'));var path=require(_0x9ba3('0xa'));var sox=require('sox');var csv=require(_0x9ba3('0xb'));var ejs=require(_0x9ba3('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9ba3('0xd'));var jsforce=require(_0x9ba3('0xe'));var deskjs=require(_0x9ba3('0xf'));var toCsv=require(_0x9ba3('0xb'));var querystring=require(_0x9ba3('0x10'));var Papa=require(_0x9ba3('0x11'));var Redis=require(_0x9ba3('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9ba3('0x13'));var as=require(_0x9ba3('0x14'));var hardwareService=require(_0x9ba3('0x15'));var logger=require(_0x9ba3('0x16'))(_0x9ba3('0x17'));var utils=require('../../config/utils');var config=require(_0x9ba3('0x18'));var licenseUtil=require(_0x9ba3('0x19'));var db=require(_0x9ba3('0x1a'))['db'];config[_0x9ba3('0x1b')]=_['defaults'](config[_0x9ba3('0x1b')],{'host':_0x9ba3('0x1c'),'port':0x18eb});var socket=require(_0x9ba3('0x1d'))(new Redis(config[_0x9ba3('0x1b')]));require(_0x9ba3('0x1e'))[_0x9ba3('0x1f')](socket);var jayson=require(_0x9ba3('0x20'));var client=jayson[_0x9ba3('0x21')][_0x9ba3('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x13aecd,_0x249480,_0x2c97bc,_0x1d90b6){return new BPromise(function(_0x16591b,_0x3b6b71){var _0x29b53c=_0x1d90b6||client;return _0x29b53c[_0x9ba3('0x23')](_0x13aecd,_0x2c97bc)[_0x9ba3('0x24')](function(_0x3b50eb){logger[_0x9ba3('0x25')](_0x9ba3('0x26'),_0x249480,_0x9ba3('0x27'));logger[_0x9ba3('0x28')](_0x9ba3('0x29'),_0x249480,_0x9ba3('0x27'),JSON[_0x9ba3('0x2a')](_0x3b50eb));if(_0x3b50eb['error']){if(_0x3b50eb[_0x9ba3('0x2b')][_0x9ba3('0x2c')]===0x1f4){logger[_0x9ba3('0x2b')](_0x9ba3('0x26'),_0x249480,_0x3b50eb['error']['message']);return _0x3b6b71(_0x3b50eb['error'][_0x9ba3('0x2d')]);}logger[_0x9ba3('0x2b')]('User,\x20%s,\x20%s',_0x249480,_0x3b50eb[_0x9ba3('0x2b')][_0x9ba3('0x2d')]);return _0x16591b(_0x3b50eb[_0x9ba3('0x2b')][_0x9ba3('0x2d')]);}else{logger[_0x9ba3('0x25')](_0x9ba3('0x26'),_0x249480,_0x9ba3('0x27'));_0x16591b(_0x3b50eb[_0x9ba3('0x2e')]['message']);}})['catch'](function(_0x5dc66a){logger[_0x9ba3('0x2b')](_0x9ba3('0x26'),_0x249480,_0x5dc66a);_0x3b6b71(_0x5dc66a);});});}function respondWithStatusCode(_0x39d436,_0x1ca342){_0x1ca342=_0x1ca342||0xcc;return function(_0xa686fa){if(_0xa686fa){return _0x39d436[_0x9ba3('0x2f')](_0x1ca342);}return _0x39d436[_0x9ba3('0x30')](_0x1ca342)[_0x9ba3('0x31')]();};}function respondWithResult(_0x399db3,_0x16c482){_0x16c482=_0x16c482||0xc8;return function(_0x3280f2){if(_0x3280f2){return _0x399db3['status'](_0x16c482)[_0x9ba3('0x32')](_0x3280f2);}};}function respondWithFilteredResult(_0x5a8ed6,_0x19af2d){return function(_0x2e8f04){if(_0x2e8f04){var _0x1ddfe1=_0x2e8f04[_0x9ba3('0x33')],_0x142c0a=_0x19af2d['offset'],_0x138d67=_0x19af2d['offset']+_0x19af2d[_0x9ba3('0x34')],_0x4de463;if(_0x138d67>=_0x1ddfe1){_0x138d67=_0x1ddfe1;_0x4de463=0xc8;}else{_0x4de463=0xce;}_0x5a8ed6[_0x9ba3('0x30')](_0x4de463);return _0x5a8ed6[_0x9ba3('0x35')](_0x9ba3('0x36'),_0x142c0a+'-'+_0x138d67+'/'+_0x1ddfe1)[_0x9ba3('0x32')](_0x2e8f04);}return null;};}function patchUpdates(_0x232a31){return function(_0x582b99){try{jsonpatch['apply'](_0x582b99,_0x232a31,!![]);}catch(_0x3f2d1f){return BPromise[_0x9ba3('0x37')](_0x3f2d1f);}return _0x582b99['save']();};}function saveUpdates(_0x44a023,_0x357ca9){return function(_0x383c11){if(_0x383c11){return _0x383c11[_0x9ba3('0x38')](_0x44a023)[_0x9ba3('0x24')](function(_0xf48b43){return _0xf48b43;});}return null;};}function removeEntity(_0x59c12a,_0x512179){return function(_0x44f528){if(_0x44f528){return _0x44f528[_0x9ba3('0x39')]()[_0x9ba3('0x24')](function(){var _0x1b3306=_0x44f528['get']({'plain':!![]});if(_0x1b3306[_0x9ba3('0x3a')]===_0x9ba3('0x3b'))return;var _0x1cd6d0=[{'name':'Users','value':'user','ignore':!![]},{'name':_0x9ba3('0x3c'),'value':_0x9ba3('0x3d'),'ignore':![]},{'name':_0x9ba3('0x3e'),'value':_0x9ba3('0x3f'),'ignore':![]}];var _0x39fc4b=_(_0x1cd6d0)[_0x9ba3('0x40')]('ignore')[_0x9ba3('0x41')](_0x9ba3('0x42'))['value']();if(_[_0x9ba3('0x43')](_0x39fc4b,_0x1b3306[_0x9ba3('0x3a')])){return;}var _0x1e20f9=_[_0x9ba3('0x44')](_0x1cd6d0,[_0x9ba3('0x42'),_0x1b3306[_0x9ba3('0x3a')]])[_0x9ba3('0x45')];return db['UserProfileResource'][_0x9ba3('0x39')]({'where':{'type':_0x1e20f9,'resourceId':_0x1b3306['id']}})[_0x9ba3('0x24')](function(){return _0x44f528;});})[_0x9ba3('0x24')](function(){_0x59c12a[_0x9ba3('0x30')](0xcc)[_0x9ba3('0x31')]();});}};}function handleEntityNotFound(_0x4f6b20,_0x4577eb){return function(_0x1a0d70){if(!_0x1a0d70){_0x4f6b20[_0x9ba3('0x2f')](0x194);}return _0x1a0d70;};}function handleError(_0x41357d,_0x43e7f1){_0x43e7f1=_0x43e7f1||0x1f4;return function(_0xd64eba){logger[_0x9ba3('0x2b')](_0xd64eba['stack']);if(_0xd64eba[_0x9ba3('0x45')]){delete _0xd64eba[_0x9ba3('0x45')];}_0x41357d[_0x9ba3('0x30')](_0x43e7f1)[_0x9ba3('0x46')](_0xd64eba);};}exports[_0x9ba3('0x47')]=function(_0x8f9b1b,_0x3bd02c){var _0x950d0={},_0x478c16={},_0x3b7234={'count':0x0,'rows':[]};var _0x5e083f=_[_0x9ba3('0x41')](db[_0x9ba3('0x48')]['rawAttributes'],function(_0x50292c){return{'name':_0x50292c[_0x9ba3('0x49')],'type':_0x50292c['type'][_0x9ba3('0x4a')]};});_0x478c16[_0x9ba3('0x4b')]=_[_0x9ba3('0x4c')](_[_0x9ba3('0x41')](_0x5e083f,'name'),[_0x9ba3('0x4d'),'salt']);_0x478c16['query']=_[_0x9ba3('0x4e')](_0x8f9b1b[_0x9ba3('0x4f')]);_0x478c16['filters']=_[_0x9ba3('0x50')](_0x478c16[_0x9ba3('0x4b')],_0x478c16[_0x9ba3('0x4f')]);_0x950d0['attributes']=_[_0x9ba3('0x50')](_0x478c16[_0x9ba3('0x4b')],qs[_0x9ba3('0x51')](_0x8f9b1b[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x950d0[_0x9ba3('0x52')]=_0x950d0[_0x9ba3('0x52')][_0x9ba3('0x53')]?_0x950d0['attributes']:_0x478c16[_0x9ba3('0x4b')];if(!_0x8f9b1b['query'][_0x9ba3('0x54')](_0x9ba3('0x55'))){_0x950d0[_0x9ba3('0x34')]=qs[_0x9ba3('0x34')](_0x8f9b1b[_0x9ba3('0x4f')]['limit']);_0x950d0[_0x9ba3('0x56')]=qs[_0x9ba3('0x56')](_0x8f9b1b[_0x9ba3('0x4f')][_0x9ba3('0x56')]);}_0x950d0['order']=qs['sort'](_0x8f9b1b[_0x9ba3('0x4f')]['sort']);_0x950d0['where']=qs['filters'](_[_0x9ba3('0x57')](_0x8f9b1b[_0x9ba3('0x4f')],_0x478c16[_0x9ba3('0x58')]),_0x5e083f);if(_0x8f9b1b[_0x9ba3('0x4f')][_0x9ba3('0x40')]){_0x950d0['where']=_[_0x9ba3('0x59')](_0x950d0['where'],{'$or':_[_0x9ba3('0x41')](_0x5e083f,function(_0x24f178){if(_0x24f178['type']!==_0x9ba3('0x5a')){return db[_0x9ba3('0x5b')][_0x9ba3('0x5c')](db[_0x9ba3('0x5b')]['fn'](_0x9ba3('0x5d'),db['sequelize'][_0x9ba3('0x5e')](_0x24f178[_0x9ba3('0x45')])),{'$like':db[_0x9ba3('0x5b')]['fn'](_0x9ba3('0x5d'),'%'+_0x8f9b1b[_0x9ba3('0x4f')][_0x9ba3('0x40')]+'%')});}})});}_0x950d0=_['merge']({},_0x950d0,_0x8f9b1b[_0x9ba3('0x5f')]);var _0x260d16={'where':_0x950d0[_0x9ba3('0x5c')]};return db['User'][_0x9ba3('0x33')](_0x260d16)[_0x9ba3('0x24')](function(_0x535760){_0x3b7234[_0x9ba3('0x33')]=_0x535760;if(_0x8f9b1b[_0x9ba3('0x4f')]['includeAll']){_0x950d0['include']=[{'all':!![]}];}return db[_0x9ba3('0x48')][_0x9ba3('0x60')](_0x950d0);})[_0x9ba3('0x24')](function(_0xb58652){_0x3b7234[_0x9ba3('0x61')]=_0xb58652;return _0x3b7234;})[_0x9ba3('0x24')](respondWithFilteredResult(_0x3bd02c,_0x950d0))[_0x9ba3('0x62')](handleError(_0x3bd02c,null));};exports[_0x9ba3('0x63')]=function(_0x2bdc30,_0x13e502){var _0x45b83d={'raw':![],'where':{'id':_0x2bdc30[_0x9ba3('0x64')]['id']}},_0x32b307={};_0x32b307['model']=_[_0x9ba3('0x4c')](_[_0x9ba3('0x4e')](db['User'][_0x9ba3('0x65')]),['password',_0x9ba3('0x66')]);_0x32b307[_0x9ba3('0x4f')]=_[_0x9ba3('0x4e')](_0x2bdc30[_0x9ba3('0x4f')]);_0x32b307[_0x9ba3('0x58')]=_['intersection'](_0x32b307[_0x9ba3('0x4b')],_0x32b307[_0x9ba3('0x4f')]);_0x45b83d[_0x9ba3('0x52')]=_[_0x9ba3('0x50')](_0x32b307[_0x9ba3('0x4b')],qs[_0x9ba3('0x51')](_0x2bdc30[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x45b83d[_0x9ba3('0x52')]=_0x45b83d[_0x9ba3('0x52')][_0x9ba3('0x53')]?_0x45b83d['attributes']:_0x32b307[_0x9ba3('0x4b')];if(_0x2bdc30[_0x9ba3('0x4f')][_0x9ba3('0x67')]){_0x45b83d['include']=[{'all':!![]}];}_0x45b83d=_[_0x9ba3('0x59')]({},_0x45b83d,_0x2bdc30[_0x9ba3('0x5f')]);return db[_0x9ba3('0x48')][_0x9ba3('0x44')](_0x45b83d)[_0x9ba3('0x24')](handleEntityNotFound(_0x13e502,null))['then'](respondWithResult(_0x13e502,null))[_0x9ba3('0x62')](handleError(_0x13e502,null));};exports['update']=function(_0x537ced,_0x11e484){if(_0x537ced[_0x9ba3('0x68')]['id']){delete _0x537ced[_0x9ba3('0x68')]['id'];}delete _0x537ced[_0x9ba3('0x68')][_0x9ba3('0x3a')];return db['User'][_0x9ba3('0x44')]({'where':{'id':_0x537ced[_0x9ba3('0x64')]['id']}})[_0x9ba3('0x24')](handleEntityNotFound(_0x11e484,null))['then'](saveUpdates(_0x537ced['body'],null))[_0x9ba3('0x24')](respondWithResult(_0x11e484,null))[_0x9ba3('0x62')](handleError(_0x11e484,null));};exports[_0x9ba3('0x69')]=function(_0x17e682,_0x14a470){return db['User']['describe']()[_0x9ba3('0x24')](respondWithResult(_0x14a470,null))['catch'](handleError(_0x14a470,null));};exports['addContacts']=function(_0x486999,_0x297a7e,_0x33e55c){return db['User'][_0x9ba3('0x44')]({'where':{'id':_0x486999['params']['id']}})[_0x9ba3('0x24')](handleEntityNotFound(_0x297a7e,null))[_0x9ba3('0x24')](function(_0x379da8){if(_0x379da8){return _0x379da8['addContacts'](_0x486999[_0x9ba3('0x68')][_0x9ba3('0x6a')],_['omit'](_0x486999[_0x9ba3('0x68')],[_0x9ba3('0x6a'),'id'])||{});}})[_0x9ba3('0x24')](respondWithResult(_0x297a7e,null))['catch'](handleError(_0x297a7e,null));};function validateUser(_0x461051){return new BPromise(function(_0x496b08,_0xae51a9){if(_0x461051[_0x9ba3('0x6b')])return _0x496b08(_0x461051);return db[_0x9ba3('0x6c')][_0x9ba3('0x6d')](0x1)[_0x9ba3('0x24')](function(_0x3463d0){if(_0x3463d0[_0x9ba3('0x6e')])authService['validatePasswordPattern'](_0x461051[_0x9ba3('0x4d')]);db[_0x9ba3('0x48')][_0x9ba3('0x6f')](_0x9ba3('0x6b'))[_0x9ba3('0x24')](function(_0x3680eb){if(_[_0x9ba3('0x70')](_0x3680eb)){_0x461051['internal']=_0x3463d0['min_internal']||0x1;return;}if(_[_0x9ba3('0x70')](_0x3463d0[_0x9ba3('0x71')])||_0x3463d0[_0x9ba3('0x71')]===_0x3680eb){_0x461051[_0x9ba3('0x6b')]=_0x3680eb+0x1;return;}if(_0x3463d0['min_internal']>_0x3680eb){_0x461051[_0x9ba3('0x6b')]=_0x3463d0[_0x9ba3('0x71')];return;}return db[_0x9ba3('0x5b')]['query'](_0x9ba3('0x72'),{'type':db[_0x9ba3('0x5b')][_0x9ba3('0x73')][_0x9ba3('0x74')]})['then'](function(_0x6cd3c1){if(_0x6cd3c1&&_0x6cd3c1['length']){for(var _0x20d68=0x0,_0x31c9e1=_0x6cd3c1[_0x9ba3('0x53')];_0x20d68<_0x31c9e1&&_[_0x9ba3('0x70')](_0x461051['internal']);_0x20d68++){if(_0x3463d0['min_internal']<=_0x6cd3c1[_0x20d68][_0x9ba3('0x75')]){_0x461051[_0x9ba3('0x6b')]=_0x6cd3c1[_0x20d68][_0x9ba3('0x75')];}else if(_0x3463d0[_0x9ba3('0x71')]>_0x6cd3c1[_0x20d68][_0x9ba3('0x75')]&&_0x3463d0['min_internal']<=_0x6cd3c1[_0x20d68]['to']){_0x461051[_0x9ba3('0x6b')]=_0x3463d0['min_internal'];}}}if(_[_0x9ba3('0x70')](_0x461051[_0x9ba3('0x6b')])){_0x461051[_0x9ba3('0x6b')]=_0x3680eb+0x1;}return _0x496b08(_0x461051);});});})[_0x9ba3('0x62')](function(_0x29fab3){_0xae51a9(_0x29fab3);});});}function updateUser(_0x521e74){return new BPromise(function(_0xd9f941,_0x172cc7){try{if(_0x521e74['voicemail']){_0x521e74[_0x9ba3('0x76')]=_0x521e74[_0x9ba3('0x6b')];_0x521e74[_0x9ba3('0x77')]={'mailbox':_0x521e74[_0x9ba3('0x6b')],'password':_0x521e74[_0x9ba3('0x4d')],'fullname':_0x521e74[_0x9ba3('0x78')],'email':_0x521e74['email']};}if(_0x521e74[_0x9ba3('0x3a')]===_0x9ba3('0x3d')){if(!_0x521e74[_0x9ba3('0x79')])_0x521e74[_0x9ba3('0x79')]=[_0x9ba3('0x7a'),_0x9ba3('0x7b'),_0x9ba3('0x7c'),_0x9ba3('0x7d'),_0x9ba3('0x7e'),'104',_0x9ba3('0x7f'),_0x9ba3('0x80'),_0x9ba3('0x81'),_0x9ba3('0x82'),'109',_0x9ba3('0x83'),_0x9ba3('0x84'),_0x9ba3('0x85')];}_0xd9f941(_0x521e74);}catch(_0x10bf90){_0x172cc7(_0x10bf90);}});}exports['create']=function(_0x39a1f7,_0xe70e2b){if(_0x39a1f7[_0x9ba3('0x86')][_0x9ba3('0x3a')]===_0x9ba3('0x3d'))throw new Error(_0x9ba3('0x87'));if(_0x39a1f7[_0x9ba3('0x68')][_0x9ba3('0x3a')]===_0x9ba3('0x86')&&_0x39a1f7[_0x9ba3('0x86')]['role']!==_0x9ba3('0x3b')){throw new Error(_0x9ba3('0x88'));}if(_0x39a1f7[_0x9ba3('0x68')][_0x9ba3('0x3a')]===_0x9ba3('0x3b')&&_0x39a1f7[_0x9ba3('0x86')][_0x9ba3('0x3a')]!=='admin'){throw new Error(_0x9ba3('0x89'));}return licenseUtil[_0x9ba3('0x8a')]([_0x39a1f7[_0x9ba3('0x68')]])['then'](function(){return validateUser(_0x39a1f7[_0x9ba3('0x68')]);})[_0x9ba3('0x24')](function(_0x5d43ee){return updateUser(_0x5d43ee)['then'](function(_0x29f20c){if(_0x29f20c[_0x9ba3('0x3a')]==='admin'){_0x29f20c[_0x9ba3('0x8b')]=_0x39a1f7[_0x9ba3('0x86')]['settingsEnabled'];delete _0x29f20c[_0x9ba3('0x8c')];}return _0x29f20c;});})[_0x9ba3('0x24')](function(_0x11b715){return db['User'][_0x9ba3('0x8d')](_0x11b715,{'include':[{'model':db[_0x9ba3('0x77')],'as':_0x9ba3('0x77')}]});})[_0x9ba3('0x24')](function(_0x3253b7){if(_0x39a1f7['body'][_0x9ba3('0x3a')]===_0x9ba3('0x86'))return _0x3253b7;if(_0x39a1f7[_0x9ba3('0x86')][_0x9ba3('0x3a')]!==_0x9ba3('0x86'))return _0x3253b7;return db[_0x9ba3('0x8e')]['find']({'where':{'name':_0x3253b7[_0x9ba3('0x3a')]===_0x9ba3('0x3d')?_0x9ba3('0x3c'):_0x9ba3('0x3e'),'userProfileId':_0x39a1f7[_0x9ba3('0x86')][_0x9ba3('0x8c')]},'raw':!![]})[_0x9ba3('0x24')](function(_0x36f014){if(!_0x36f014||_0x36f014['autoAssociation']!=0x0)return _0x3253b7;return db['UserProfileResource'][_0x9ba3('0x8d')]({'name':_0x3253b7['name'],'resourceId':_0x3253b7['id'],'type':_0x36f014[_0x9ba3('0x45')],'sectionId':_0x36f014['id']},{})[_0x9ba3('0x24')](function(){return _0x3253b7;});})['catch'](function(_0x1731d1){logger[_0x9ba3('0x2b')](_0x9ba3('0x8f'),_0x1731d1);throw _0x1731d1;});})[_0x9ba3('0x24')](respondWithResult(_0xe70e2b,0xc9))['catch'](handleError(_0xe70e2b,null));};exports[_0x9ba3('0x90')]=function(_0x1ed63d,_0x3bf9c6){var _0x51ad80=_0x1ed63d[_0x9ba3('0x68')];var _0x571dff=[];if(_0x1ed63d['user'][_0x9ba3('0x3a')]===_0x9ba3('0x3d'))throw new Error(_0x9ba3('0x87'));if(_[_0x9ba3('0x91')](_0x51ad80,[_0x9ba3('0x3a'),'user'])&&_0x1ed63d[_0x9ba3('0x86')][_0x9ba3('0x3a')]!=='admin'){throw new Error(_0x9ba3('0x88'));}if(_[_0x9ba3('0x91')](_0x51ad80,[_0x9ba3('0x3a'),'admin'])&&_0x1ed63d['user']['role']!=='admin'){throw new Error(_0x9ba3('0x92'));}return licenseUtil[_0x9ba3('0x8a')](_0x51ad80)[_0x9ba3('0x24')](function(){return validateUser(_0x51ad80[0x0]);})[_0x9ba3('0x24')](function(){for(var _0x38df5a=0x1;_0x38df5a<_0x51ad80[_0x9ba3('0x53')];_0x38df5a++){var _0x7da61e=_0x51ad80[_0x38df5a-0x1][_0x9ba3('0x6b')];if(!_0x51ad80[_0x38df5a]['internal'])_0x51ad80[_0x38df5a][_0x9ba3('0x6b')]=_0x7da61e+0x1;_0x571dff[_0x9ba3('0x93')](validateUser(_0x51ad80[_0x38df5a]));}return BPromise[_0x9ba3('0x94')](_0x571dff);})[_0x9ba3('0x24')](function(){_0x571dff=[];for(var _0x481d6d=0x0;_0x481d6d<_0x51ad80[_0x9ba3('0x53')];_0x481d6d++){_0x571dff['push'](updateUser(_0x51ad80[_0x481d6d]));}return BPromise['all'](_0x571dff);})[_0x9ba3('0x24')](function(){return BPromise[_0x9ba3('0x95')](_0x51ad80,function(_0x3d1f65){return db[_0x9ba3('0x48')][_0x9ba3('0x8d')](_0x3d1f65,{'include':[{'model':db[_0x9ba3('0x77')],'as':_0x9ba3('0x77')}]})['then'](function(_0x23ad27){_0x3d1f65['id']=_0x23ad27['id'];return _0x3d1f65;});});})[_0x9ba3('0x24')](function(_0x2492b8){if(_0x1ed63d[_0x9ba3('0x68')][_0x9ba3('0x3a')]===_0x9ba3('0x86'))return _0x2492b8;if(_0x1ed63d['user'][_0x9ba3('0x3a')]!==_0x9ba3('0x86'))return _0x2492b8;var _0x13542c=_['some'](_0x2492b8,function(_0xe9326c){return _0xe9326c['role']===_0x9ba3('0x3d')||_0xe9326c[_0x9ba3('0x3a')]===_0x9ba3('0x3f');});if(!_0x13542c)return _0x2492b8;return db[_0x9ba3('0x8e')][_0x9ba3('0x60')]({'where':{'name':{'$or':[_0x9ba3('0x3c'),_0x9ba3('0x3e')]},'userProfileId':_0x1ed63d[_0x9ba3('0x86')][_0x9ba3('0x8c')]},'raw':!![]})[_0x9ba3('0x24')](function(_0x231684){if(_['isEmpty'](_0x231684)||!_['some'](_0x231684,['autoAssociation',0x0]))return _0x2492b8;_0x571dff=[];var _0x245e3e=_(_0x231684)[_0x9ba3('0x41')](function(_0x406924){if(_0x406924[_0x9ba3('0x96')]===0x1)return;return _0x406924['name']===_0x9ba3('0x3c')?'agent':_0x9ba3('0x3f');})[_0x9ba3('0x97')]()[_0x9ba3('0x42')]();for(var _0x4bcded=0x0;_0x4bcded<_0x2492b8[_0x9ba3('0x53')];_0x4bcded++){if(!_[_0x9ba3('0x43')](_0x245e3e,_0x2492b8[_0x4bcded]['role']))return;var _0x130a95=_0x2492b8[_0x4bcded][_0x9ba3('0x3a')]==='agent'?'Agents':'Telephones';_0x571dff[_0x9ba3('0x93')](db['UserProfileResource'][_0x9ba3('0x8d')]({'name':_0x2492b8[_0x4bcded][_0x9ba3('0x45')],'resourceId':_0x2492b8[_0x4bcded]['id'],'type':_0x130a95,'sectionId':_['find'](_0x231684,[_0x9ba3('0x45'),_0x130a95])['id']},{}));}return BPromise['all'](_0x571dff);})['then'](respondWithResult(_0x3bf9c6,0xc9))[_0x9ba3('0x62')](handleError(_0x3bf9c6,null));});};exports[_0x9ba3('0x98')]=function(_0x330ffd,_0x4c7a4a,_0x387300){if(_0x330ffd[_0x9ba3('0x68')]['id']){delete _0x330ffd[_0x9ba3('0x68')]['id'];}return db['User']['find']({'where':{'id':_0x330ffd['params']['id']}})[_0x9ba3('0x24')](function(_0x730303){if(!_0x730303)return null;if(_0x730303['id']===_0x330ffd[_0x9ba3('0x86')]['id']){if(!_0x330ffd[_0x9ba3('0x68')][_0x9ba3('0x99')]||!_0x330ffd['body'][_0x9ba3('0x9a')]){throw new db['Sequelize'][(_0x9ba3('0x9b'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x730303['authenticate'](_0x330ffd[_0x9ba3('0x68')][_0x9ba3('0x99')])){throw new db['Sequelize'][(_0x9ba3('0x9b'))]('Wrong\x20credentials');}if(_0x330ffd[_0x9ba3('0x68')][_0x9ba3('0x99')]===_0x330ffd[_0x9ba3('0x68')]['newPassword']){throw new db[(_0x9ba3('0x9c'))]['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x330ffd[_0x9ba3('0x86')][_0x9ba3('0x3a')]==='admin'){if(!_0x330ffd['body']['newPassword']){throw new db[(_0x9ba3('0x9c'))]['ValidationError'](_0x9ba3('0x9d'));}}else if(_0x330ffd[_0x9ba3('0x86')][_0x9ba3('0x3a')]==='user'){if(!_0x330ffd[_0x9ba3('0x68')][_0x9ba3('0x9a')]){throw new db[(_0x9ba3('0x9c'))][(_0x9ba3('0x9b'))](_0x9ba3('0x9d'));}if(_0x730303[_0x9ba3('0x3a')]!==_0x9ba3('0x3d')){throw new db['Sequelize']['ValidationError'](_0x9ba3('0x87'));}}else{throw new db['Sequelize'][(_0x9ba3('0x9b'))](_0x9ba3('0x87'));}return _0x730303;})[_0x9ba3('0x24')](handleEntityNotFound(_0x4c7a4a,null))[_0x9ba3('0x24')](function(_0x39cb39){return db['Setting'][_0x9ba3('0x9e')]({'attributes':['id',_0x9ba3('0x6e'),_0x9ba3('0x9f'),_0x9ba3('0xa0')]})['then'](function(_0x3895c0){if(_0x3895c0['securePassword'])authService[_0x9ba3('0xa1')](_0x330ffd[_0x9ba3('0x68')]['newPassword']);if(!_0x3895c0[_0x9ba3('0x9f')]||!_0x39cb39[_0x9ba3('0xa2')])return _0x39cb39;authService[_0x9ba3('0xa3')](_0x330ffd[_0x9ba3('0x68')][_0x9ba3('0x9a')],_0x39cb39[_0x9ba3('0xa2')],_0x3895c0[_0x9ba3('0xa0')]);return _0x39cb39;})[_0x9ba3('0x24')](saveUpdates({'password':_0x330ffd['body'][_0x9ba3('0x9a')],'passwordResetAt':_0x330ffd['user']['id']==_0x330ffd[_0x9ba3('0x64')]['id']?moment():null,'previousPasswords':authService[_0x9ba3('0xa4')](_0x330ffd[_0x9ba3('0x68')][_0x9ba3('0x9a')],_0x39cb39['previousPasswords'])},null));})[_0x9ba3('0x24')](respondWithResult(_0x4c7a4a,null))['catch'](handleError(_0x4c7a4a,null));};exports[_0x9ba3('0xa5')]=function(_0x4dfeca,_0x45ed7e,_0x5f07a7){var _0x26a8d3=_0x4dfeca[_0x9ba3('0x68')][_0x9ba3('0xa6')];return db['User'][_0x9ba3('0x44')]({'where':{'id':_0x4dfeca[_0x9ba3('0x64')]['id']},'attributes':['id',_0x9ba3('0x45'),_0x9ba3('0x3a'),'online',_0x9ba3('0xa7'),_0x9ba3('0xa8'),_0x9ba3('0xa9')]})['then'](handleEntityNotFound(_0x45ed7e,null))[_0x9ba3('0x24')](function(_0xe30b8b){if(_0xe30b8b){if(!utils[_0x9ba3('0xaa')](_0x26a8d3)){throw new db[(_0x9ba3('0x9c'))][(_0x9ba3('0x9b'))](_0x9ba3('0xab'));}return _0xe30b8b[_0x9ba3('0xac')+_['capitalize'](_0x26a8d3['toLowerCase']())+_0x9ba3('0xad')](_0x4dfeca[_0x9ba3('0x68')]['ids'],{'penalty':_0x4dfeca['body'][_0x9ba3('0xae')]||0x0})[_0x9ba3('0xaf')](function(_0x12fbdf){for(var _0x25cfbd=0x0;_0x25cfbd<_0x4dfeca[_0x9ba3('0x68')]['ids'][_0x9ba3('0x53')];_0x25cfbd+=0x1){var _0x33a343={'UserId':_0x4dfeca[_0x9ba3('0x64')]['id']};_0x33a343[_['capitalize'](_0x26a8d3[_0x9ba3('0xb0')]())+_0x9ba3('0xb1')]=_0x4dfeca[_0x9ba3('0x68')]['ids'][_0x25cfbd];socket[_0x9ba3('0xb2')](_0x9ba3('0x86')+_[_0x9ba3('0xb3')](_0x26a8d3[_0x9ba3('0xb0')]())+_0x9ba3('0xb4'),_0x33a343);}return _0x12fbdf;})[_0x9ba3('0x24')](function(){if(_0x26a8d3===_0x9ba3('0xb5')){return db[_0x9ba3('0xb6')][_0x9ba3('0x60')]({'where':{'id':_0x4dfeca[_0x9ba3('0x68')][_0x9ba3('0x6a')]||[]},'raw':!![],'attributes':['id',_0x9ba3('0x45')]});}})[_0x9ba3('0x24')](function(_0x149631){var _0x385077=_0xe30b8b['get']({'plain':!![]});var _0x42ab58=[];if(_0x26a8d3===_0x9ba3('0xb5')&&_0x385077[_0x9ba3('0x3a')]===_0x9ba3('0x3d')&&_0x385077[_0x9ba3('0xb7')]){for(var _0x1f1006=0x0;_0x1f1006<_0x149631['length'];_0x1f1006+=0x1){_0x42ab58[_0x9ba3('0x93')]({'membername':_0x385077[_0x9ba3('0x45')],'UserId':_0x385077['id'],'queue_name':_0x149631[_0x1f1006][_0x9ba3('0x45')],'VoiceQueueId':_0x149631[_0x1f1006]['id'],'interface':_[_0x9ba3('0x70')](_0x385077['interface'])?util[_0x9ba3('0xb8')](_0x9ba3('0xb9'),_0x385077[_0x9ba3('0x45')]):_0x385077['interface'],'paused':_0x385077['voicePause']||![],'penalty':_0x4dfeca[_0x9ba3('0x68')][_0x9ba3('0xae')]||0x0});}return BPromise['each'](_0x42ab58,function(_0x2eb2be){return db['UserVoiceQueueRt'][_0x9ba3('0xba')](_0x2eb2be);});}return _0xe30b8b;});}})[_0x9ba3('0x24')](respondWithStatusCode(_0x45ed7e,null))[_0x9ba3('0x62')](handleError(_0x45ed7e,null));};exports[_0x9ba3('0xbb')]=function(_0x32840b,_0x2da0ae,_0x3e38d6){var _0x10270f;return db[_0x9ba3('0x48')]['find']({'where':{'id':_0x32840b['params']['id']},'attributes':['id',_0x9ba3('0x45'),_0x9ba3('0x3a')]})[_0x9ba3('0x24')](handleEntityNotFound(_0x2da0ae,null))[_0x9ba3('0x24')](function(_0x2a2f7a){if(_0x2a2f7a){_0x10270f=_0x2a2f7a;if(!_0x32840b['query'][_0x9ba3('0xa6')]||!utils[_0x9ba3('0xaa')](_0x32840b[_0x9ba3('0x4f')][_0x9ba3('0xa6')])){throw new db[(_0x9ba3('0x9c'))][(_0x9ba3('0x9b'))](_0x9ba3('0xab'));}return _0x2a2f7a[_0x9ba3('0xbc')+_[_0x9ba3('0xb3')](_0x32840b['query']['channel'][_0x9ba3('0xb0')]())+'Queues'](_0x32840b['query'][_0x9ba3('0x6a')]);}})['then'](function(_0x11aa8f){for(var _0x1e88f2=0x0;_0x1e88f2<_0x32840b['query']['ids']['length'];_0x1e88f2+=0x1){var _0xbd65e7={'UserId':_0x32840b['params']['id']};_0xbd65e7[_['capitalize'](_0x32840b[_0x9ba3('0x4f')][_0x9ba3('0xa6')][_0x9ba3('0xb0')]())+_0x9ba3('0xb1')]=_0x32840b['query'][_0x9ba3('0x6a')][_0x1e88f2];socket[_0x9ba3('0xb2')](_0x9ba3('0x86')+_['capitalize'](_0x32840b[_0x9ba3('0x4f')][_0x9ba3('0xa6')][_0x9ba3('0xb0')]())+_0x9ba3('0xbd'),_0xbd65e7);}return _0x11aa8f;})[_0x9ba3('0x24')](function(){if(_0x32840b[_0x9ba3('0x4f')][_0x9ba3('0xa6')]===_0x9ba3('0xb5')){return db['UserVoiceQueueRt'][_0x9ba3('0x39')]({'where':{'UserId':_0x32840b['params']['id'],'VoiceQueueId':_0x32840b[_0x9ba3('0x4f')][_0x9ba3('0x6a')]},'individualHooks':!![]})['then'](function(){return _0x10270f;});}return _0x10270f;})['then'](respondWithStatusCode(_0x2da0ae,null))[_0x9ba3('0x62')](handleError(_0x2da0ae,null));};exports['addAvatar']=function(_0x4e0f08,_0x3b6fd7,_0x8f910a){_0x4e0f08['body'][_0x9ba3('0xbe')]=_0x4e0f08['file'][_0x9ba3('0xbf')];return db[_0x9ba3('0x48')]['find']({'where':{'id':_0x4e0f08[_0x9ba3('0x64')]['id']}})[_0x9ba3('0x24')](handleEntityNotFound(_0x3b6fd7,null))['then'](saveUpdates(_0x4e0f08['body'],null))[_0x9ba3('0x24')](respondWithResult(_0x3b6fd7,null))[_0x9ba3('0x62')](handleError(_0x3b6fd7,null));};exports[_0x9ba3('0xc0')]=function(_0x11a2fa,_0x3dc02f,_0x4481e9){var _0x1e2e4c=path['join'](config[_0x9ba3('0xc1')],'server/files/images/logos/default_profile.png');return db[_0x9ba3('0x48')][_0x9ba3('0x44')]({'where':{'id':_0x11a2fa[_0x9ba3('0x64')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x3dc02f,null))[_0x9ba3('0x24')](function(_0x2c6b71){if(_0x2c6b71){if(_[_0x9ba3('0x70')](_0x2c6b71[_0x9ba3('0xbe')])){return _0x3dc02f[_0x9ba3('0xc2')](_0x1e2e4c);}else{if(!fs[_0x9ba3('0xc3')](path[_0x9ba3('0xc4')](config[_0x9ba3('0xc1')],_0x9ba3('0xc5'),_0x2c6b71[_0x9ba3('0xbe')]))){return _0x3dc02f['download'](_0x1e2e4c);}return _0x3dc02f[_0x9ba3('0xc2')](path[_0x9ba3('0xc4')](config[_0x9ba3('0xc1')],_0x9ba3('0xc5'),_0x2c6b71[_0x9ba3('0xbe')]));}}})[_0x9ba3('0x62')](handleError(_0x3dc02f,null));};exports[_0x9ba3('0xc6')]=function(_0x5d6ded,_0x1d9f0b,_0x352b77){var _0x5b75b3={};var _0x2883a3={};var _0xdc9837;var _0x20ff2c;return db[_0x9ba3('0x48')][_0x9ba3('0x9e')]({'where':{'id':_0x5d6ded[_0x9ba3('0x64')]['id']}})[_0x9ba3('0x24')](handleEntityNotFound(_0x1d9f0b,null))[_0x9ba3('0x24')](function(_0x178945){if(_0x178945){_0xdc9837=_0x178945;_0x2883a3[_0x9ba3('0x4b')]=_[_0x9ba3('0x4e')](db['CmContact'][_0x9ba3('0x65')]);_0x2883a3[_0x9ba3('0x4f')]=_[_0x9ba3('0x4e')](_0x5d6ded[_0x9ba3('0x4f')]);_0x2883a3[_0x9ba3('0x58')]=_[_0x9ba3('0x50')](_0x2883a3[_0x9ba3('0x4b')],_0x2883a3[_0x9ba3('0x4f')]);_0x5b75b3['attributes']=_[_0x9ba3('0x50')](_0x2883a3['model'],qs[_0x9ba3('0x51')](_0x5d6ded[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x5b75b3[_0x9ba3('0x52')]=_0x5b75b3[_0x9ba3('0x52')][_0x9ba3('0x53')]?_0x5b75b3[_0x9ba3('0x52')]:_0x2883a3[_0x9ba3('0x4b')];_0x5b75b3['order']=qs[_0x9ba3('0xc7')](_0x5d6ded[_0x9ba3('0x4f')][_0x9ba3('0xc7')]);_0x5b75b3[_0x9ba3('0x5c')]=qs[_0x9ba3('0x58')](_['pick'](_0x5d6ded[_0x9ba3('0x4f')],_0x2883a3[_0x9ba3('0x58')]));if(_0x5d6ded[_0x9ba3('0x4f')][_0x9ba3('0x40')]){_0x5b75b3[_0x9ba3('0x5c')]=_[_0x9ba3('0x59')](_0x5b75b3[_0x9ba3('0x5c')],{'$or':_['map'](_0x5b75b3['attributes'],function(_0x1b2abd){var _0x5466ff={};_0x5466ff[_0x1b2abd]={'$like':'%'+_0x5d6ded[_0x9ba3('0x4f')][_0x9ba3('0x40')]+'%'};return _0x5466ff;})});}_0x5b75b3=_[_0x9ba3('0x59')]({},_0x5b75b3,_0x5d6ded[_0x9ba3('0x5f')]);return _0xdc9837[_0x9ba3('0xc6')](_0x5b75b3);}})[_0x9ba3('0x24')](function(_0x533f09){if(_0x533f09){_0x20ff2c=_0x533f09[_0x9ba3('0x53')];if(_0x5d6ded[_0x9ba3('0x4f')][_0x9ba3('0x54')](_0x9ba3('0x67'))){_0x5b75b3[_0x9ba3('0xc8')]=[{'model':db['CmList'],'as':_0x9ba3('0xc9'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x9ba3('0x45'),_0x9ba3('0xca')],'where':_0x5d6ded[_0x9ba3('0x4f')][_0x9ba3('0xcb')]?{'id':_0x5d6ded['query'][_0x9ba3('0xcb')]}:undefined,'required':_0x5d6ded[_0x9ba3('0x4f')][_0x9ba3('0xcb')]?!![]:![]}];}if(!_0x5d6ded[_0x9ba3('0x4f')][_0x9ba3('0x54')]('nolimit')){_0x5b75b3[_0x9ba3('0x34')]=qs['limit'](_0x5d6ded[_0x9ba3('0x4f')][_0x9ba3('0x34')]);_0x5b75b3[_0x9ba3('0x56')]=qs[_0x9ba3('0x56')](_0x5d6ded[_0x9ba3('0x4f')][_0x9ba3('0x56')]);}return _0xdc9837[_0x9ba3('0xc6')](_0x5b75b3);}})[_0x9ba3('0x24')](function(_0x5db44f){if(_0x5db44f){return _0x5db44f?{'count':_0x20ff2c,'rows':_0x5db44f}:null;}})['then'](respondWithResult(_0x1d9f0b,null))[_0x9ba3('0x62')](handleError(_0x1d9f0b,null));};exports['getQueues']=function(_0x484399,_0xa5d6fc,_0x476b58){var _0x13f917;var _0x5f0a9e;var _0x499e7d={};var _0x51097b;return db['User'][_0x9ba3('0x9e')]({'where':{'id':_0x484399[_0x9ba3('0x64')]['id']},'attributes':['id',_0x9ba3('0x45'),_0x9ba3('0x3a')]})[_0x9ba3('0x24')](handleEntityNotFound(_0xa5d6fc,null))[_0x9ba3('0x24')](function(_0x1aa5f6){if(!utils['isValidChannel'](_0x484399[_0x9ba3('0x4f')][_0x9ba3('0xa6')])){throw new db[(_0x9ba3('0x9c'))][(_0x9ba3('0x9b'))](_0x9ba3('0xab'));}_0x13f917=_0x1aa5f6;var _0x5a7063={};_0x5a7063[_0x9ba3('0x4b')]=_[_0x9ba3('0x4e')](db[_['capitalize'](_0x484399['query'][_0x9ba3('0xa6')])+'Queue'][_0x9ba3('0x65')]);_0x5a7063[_0x9ba3('0x4f')]=_['keys'](_0x484399['query']);_0x5a7063[_0x9ba3('0x58')]=_[_0x9ba3('0x50')](_0x5a7063['model'],_0x5a7063['query']);_0x499e7d[_0x9ba3('0x52')]=_[_0x9ba3('0x50')](_0x5a7063['model'],qs[_0x9ba3('0x51')](_0x484399[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x499e7d[_0x9ba3('0x52')]=_0x499e7d['attributes'][_0x9ba3('0x53')]?_0x499e7d['attributes']:_0x5a7063[_0x9ba3('0x4b')];_0x499e7d[_0x9ba3('0xcc')]=qs[_0x9ba3('0xc7')](_0x484399[_0x9ba3('0x4f')][_0x9ba3('0xc7')]);_0x499e7d[_0x9ba3('0x5c')]=qs[_0x9ba3('0x58')](_[_0x9ba3('0x57')](_0x484399[_0x9ba3('0x4f')],_0x5a7063[_0x9ba3('0x58')]));if(_0x484399[_0x9ba3('0x4f')][_0x9ba3('0x40')]){_0x499e7d[_0x9ba3('0x5c')]=_[_0x9ba3('0x59')](_0x499e7d[_0x9ba3('0x5c')],{'$or':_[_0x9ba3('0x41')](_0x499e7d['attributes'],function(_0x1afd3b){var _0x4cee6d={};_0x4cee6d[_0x1afd3b]={'$like':'%'+_0x484399[_0x9ba3('0x4f')][_0x9ba3('0x40')]+'%'};return _0x4cee6d;})});}_0x499e7d=_[_0x9ba3('0x59')]({},_0x499e7d,_0x484399[_0x9ba3('0x5f')]);switch(_0x13f917[_0x9ba3('0x3a')]){case _0x9ba3('0x3b'):return db[_[_0x9ba3('0xb3')](_0x484399[_0x9ba3('0x4f')][_0x9ba3('0xa6')])+_0x9ba3('0xcd')]['findAll'](_0x499e7d);case _0x9ba3('0x86'):case'agent':return _0x13f917[_0x9ba3('0xce')+_['capitalize'](_0x484399[_0x9ba3('0x4f')]['channel'])+'Queues'](_0x499e7d);default:throw new db[(_0x9ba3('0x9c'))][(_0x9ba3('0x9b'))](_0x9ba3('0xcf'));}})['then'](function(_0x31ed2a){_0x51097b=_0x31ed2a[_0x9ba3('0x53')];if(!_0x484399[_0x9ba3('0x4f')][_0x9ba3('0x54')](_0x9ba3('0x55'))){_0x499e7d[_0x9ba3('0x34')]=qs['limit'](_0x484399['query'][_0x9ba3('0x34')]);_0x499e7d[_0x9ba3('0x56')]=qs[_0x9ba3('0x56')](_0x484399[_0x9ba3('0x4f')][_0x9ba3('0x56')]);}switch(_0x13f917[_0x9ba3('0x3a')]){case _0x9ba3('0x3b'):return db[_[_0x9ba3('0xb3')](_0x484399[_0x9ba3('0x4f')][_0x9ba3('0xa6')])+_0x9ba3('0xcd')][_0x9ba3('0x60')](_0x499e7d);case _0x9ba3('0x86'):case'agent':return _0x13f917[_0x9ba3('0xce')+_['capitalize'](_0x484399['query'][_0x9ba3('0xa6')])+_0x9ba3('0xad')](_0x499e7d);}})['then'](function(_0x5f168b){return{'count':_0x51097b,'rows':_0x5f168b};})[_0x9ba3('0x24')](respondWithResult(_0xa5d6fc,null))['catch'](handleError(_0xa5d6fc,null));};exports[_0x9ba3('0xd0')]=function(_0x38dea7,_0x5a1554,_0x3b0df8){var _0x25d9f2={};var _0x4c116e={};var _0x34615a;var _0x251003;return db[_0x9ba3('0x48')]['findOne']({'where':{'id':_0x38dea7[_0x9ba3('0x64')]['id']}})[_0x9ba3('0x24')](handleEntityNotFound(_0x5a1554,null))[_0x9ba3('0x24')](function(_0x312618){if(_0x312618){_0x34615a=_0x312618;_0x4c116e[_0x9ba3('0x4b')]=_['keys'](db[_0x9ba3('0xd1')][_0x9ba3('0x65')]);_0x4c116e[_0x9ba3('0x4f')]=_[_0x9ba3('0x4e')](_0x38dea7[_0x9ba3('0x4f')]);_0x4c116e[_0x9ba3('0x58')]=_['intersection'](_0x4c116e[_0x9ba3('0x4b')],_0x4c116e[_0x9ba3('0x4f')]);_0x25d9f2['attributes']=_[_0x9ba3('0x50')](_0x4c116e[_0x9ba3('0x4b')],qs[_0x9ba3('0x51')](_0x38dea7['query'][_0x9ba3('0x51')]));_0x25d9f2[_0x9ba3('0x52')]=_0x25d9f2[_0x9ba3('0x52')][_0x9ba3('0x53')]?_0x25d9f2[_0x9ba3('0x52')]:_0x4c116e[_0x9ba3('0x4b')];_0x25d9f2[_0x9ba3('0xcc')]=qs[_0x9ba3('0xc7')](_0x38dea7[_0x9ba3('0x4f')][_0x9ba3('0xc7')]);_0x25d9f2['where']=qs[_0x9ba3('0x58')](_[_0x9ba3('0x57')](_0x38dea7[_0x9ba3('0x4f')],_0x4c116e[_0x9ba3('0x58')]));if(_0x38dea7[_0x9ba3('0x4f')][_0x9ba3('0x40')]){_0x25d9f2['where']=_[_0x9ba3('0x59')](_0x25d9f2[_0x9ba3('0x5c')],{'$or':_[_0x9ba3('0x41')](_0x25d9f2[_0x9ba3('0x52')],function(_0x4ece09){var _0x357ba7={};_0x357ba7[_0x4ece09]={'$like':'%'+_0x38dea7[_0x9ba3('0x4f')][_0x9ba3('0x40')]+'%'};return _0x357ba7;})});}_0x25d9f2=_[_0x9ba3('0x59')]({},_0x25d9f2,_0x38dea7['options']);return _0x34615a['getVoiceQueuesRt'](_0x25d9f2);}})[_0x9ba3('0x24')](function(_0x52c078){if(_0x52c078){_0x251003=_0x52c078[_0x9ba3('0x53')];if(!_0x38dea7[_0x9ba3('0x4f')][_0x9ba3('0x54')](_0x9ba3('0x55'))){_0x25d9f2[_0x9ba3('0x34')]=qs[_0x9ba3('0x34')](_0x38dea7[_0x9ba3('0x4f')][_0x9ba3('0x34')]);_0x25d9f2[_0x9ba3('0x56')]=qs[_0x9ba3('0x56')](_0x38dea7[_0x9ba3('0x4f')][_0x9ba3('0x56')]);}return _0x34615a[_0x9ba3('0xd0')](_0x25d9f2);}})[_0x9ba3('0x24')](function(_0x3145bd){if(_0x3145bd){return _0x3145bd?{'count':_0x251003,'rows':_0x3145bd}:null;}})[_0x9ba3('0x24')](respondWithResult(_0x5a1554,null))['catch'](handleError(_0x5a1554,null));};exports[_0x9ba3('0xd2')]=function(_0x4b1c06,_0xe2d1f2,_0x2aff40){var _0x397282={};var _0x53e2a9={};var _0x507197;var _0x212929;return db['User'][_0x9ba3('0x9e')]({'where':{'id':_0x4b1c06[_0x9ba3('0x64')]['id']}})[_0x9ba3('0x24')](handleEntityNotFound(_0xe2d1f2,null))[_0x9ba3('0x24')](function(_0x54b0d2){if(_0x54b0d2){_0x507197=_0x54b0d2;_0x53e2a9[_0x9ba3('0x4b')]=_[_0x9ba3('0x4e')](db[_0x9ba3('0xd3')][_0x9ba3('0x65')]);_0x53e2a9[_0x9ba3('0x4f')]=_['keys'](_0x4b1c06[_0x9ba3('0x4f')]);_0x53e2a9[_0x9ba3('0x58')]=_['intersection'](_0x53e2a9['model'],_0x53e2a9['query']);_0x397282[_0x9ba3('0x52')]=_['intersection'](_0x53e2a9[_0x9ba3('0x4b')],qs['fields'](_0x4b1c06[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x397282['attributes']=_0x397282[_0x9ba3('0x52')][_0x9ba3('0x53')]?_0x397282[_0x9ba3('0x52')]:_0x53e2a9[_0x9ba3('0x4b')];_0x397282[_0x9ba3('0xcc')]=qs[_0x9ba3('0xc7')](_0x4b1c06[_0x9ba3('0x4f')][_0x9ba3('0xc7')]);_0x397282[_0x9ba3('0x5c')]=qs[_0x9ba3('0x58')](_[_0x9ba3('0x57')](_0x4b1c06['query'],_0x53e2a9[_0x9ba3('0x58')]));if(_0x4b1c06[_0x9ba3('0x4f')][_0x9ba3('0x40')]){_0x397282[_0x9ba3('0x5c')]=_[_0x9ba3('0x59')](_0x397282['where'],{'$or':_[_0x9ba3('0x41')](_0x397282[_0x9ba3('0x52')],function(_0x3a6b35){var _0x113cf8={};_0x113cf8[_0x3a6b35]={'$like':'%'+_0x4b1c06['query']['filter']+'%'};return _0x113cf8;})});}_0x397282=_['merge']({},_0x397282,_0x4b1c06[_0x9ba3('0x5f')]);return _0x507197[_0x9ba3('0xd2')](_0x397282);}})[_0x9ba3('0x24')](function(_0x3c0936){if(_0x3c0936){_0x212929=_0x3c0936[_0x9ba3('0x53')];if(!_0x4b1c06[_0x9ba3('0x4f')][_0x9ba3('0x54')]('nolimit')){_0x397282[_0x9ba3('0x34')]=qs[_0x9ba3('0x34')](_0x4b1c06[_0x9ba3('0x4f')][_0x9ba3('0x34')]);_0x397282[_0x9ba3('0x56')]=qs[_0x9ba3('0x56')](_0x4b1c06[_0x9ba3('0x4f')]['offset']);}return _0x507197[_0x9ba3('0xd2')](_0x397282);}})[_0x9ba3('0x24')](function(_0x29b830){if(_0x29b830){return _0x29b830?{'count':_0x212929,'rows':_0x29b830}:null;}})['then'](respondWithResult(_0xe2d1f2,null))[_0x9ba3('0x62')](handleError(_0xe2d1f2,null));};exports['getRecordings']=function(_0x5aebf0,_0x51ffa4,_0xc7ca0e){var _0x1b521e={'raw':!![],'where':{}};var _0x4aacb0={};var _0x112035={'count':0x0,'rows':[]};return db[_0x9ba3('0x48')][_0x9ba3('0x9e')]({'where':{'id':_0x5aebf0[_0x9ba3('0x64')]['id']}})['then'](handleEntityNotFound(_0x51ffa4,null))[_0x9ba3('0x24')](function(_0x146ff2){if(_0x146ff2){_0x4aacb0[_0x9ba3('0x4b')]=_[_0x9ba3('0x4e')](db[_0x9ba3('0xd4')][_0x9ba3('0x65')]);_0x4aacb0[_0x9ba3('0x4f')]=_[_0x9ba3('0x4e')](_0x5aebf0[_0x9ba3('0x4f')]);_0x4aacb0[_0x9ba3('0x58')]=_[_0x9ba3('0x50')](_0x4aacb0[_0x9ba3('0x4b')],_0x4aacb0[_0x9ba3('0x4f')]);_0x1b521e['attributes']=_['intersection'](_0x4aacb0['model'],qs[_0x9ba3('0x51')](_0x5aebf0[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x1b521e[_0x9ba3('0x52')]=_0x1b521e['attributes'][_0x9ba3('0x53')]?_0x1b521e[_0x9ba3('0x52')]:_0x4aacb0[_0x9ba3('0x4b')];if(!_0x5aebf0['query'][_0x9ba3('0x54')](_0x9ba3('0x55'))){_0x1b521e[_0x9ba3('0x34')]=qs[_0x9ba3('0x34')](_0x5aebf0[_0x9ba3('0x4f')][_0x9ba3('0x34')]);_0x1b521e[_0x9ba3('0x56')]=qs[_0x9ba3('0x56')](_0x5aebf0['query']['offset']);}_0x1b521e[_0x9ba3('0xcc')]=qs[_0x9ba3('0xc7')](_0x5aebf0[_0x9ba3('0x4f')][_0x9ba3('0xc7')]);_0x1b521e[_0x9ba3('0x5c')]=qs[_0x9ba3('0x58')](_[_0x9ba3('0x57')](_0x5aebf0[_0x9ba3('0x4f')],_0x4aacb0[_0x9ba3('0x58')]));_0x1b521e[_0x9ba3('0x5c')][_0x9ba3('0xd5')]=_0x146ff2['id'];if(_0x5aebf0[_0x9ba3('0x4f')]['filter']){_0x1b521e[_0x9ba3('0x5c')]=_[_0x9ba3('0x59')](_0x1b521e[_0x9ba3('0x5c')],{'$or':_[_0x9ba3('0x41')](_0x1b521e[_0x9ba3('0x52')],function(_0x3e647c){var _0x59481f={};_0x59481f[_0x3e647c]={'$like':'%'+_0x5aebf0[_0x9ba3('0x4f')][_0x9ba3('0x40')]+'%'};return _0x59481f;})});}_0x1b521e=_[_0x9ba3('0x59')]({},_0x1b521e,_0x5aebf0['options']);return db['VoiceRecording']['count']({'where':_0x1b521e[_0x9ba3('0x5c')]})['then'](function(_0x19b48c){_0x112035[_0x9ba3('0x33')]=_0x19b48c;if(_0x5aebf0['query']['includeAll']){_0x1b521e[_0x9ba3('0xc8')]=[{'all':!![]}];}return db[_0x9ba3('0xd4')][_0x9ba3('0x60')](_0x1b521e);})[_0x9ba3('0x24')](function(_0x1c69ac){_0x112035['rows']=_0x1c69ac;return _0x112035;});}})['then'](respondWithFilteredResult(_0x51ffa4,_0x1b521e))[_0x9ba3('0x62')](handleError(_0x51ffa4,null));};exports[_0x9ba3('0xd6')]=function(_0x5938e8,_0x387ccb,_0x26aed0){var _0x4f0b3f={'raw':!![],'where':{}};var _0x5359f7={};var _0x50cbfa={'count':0x0,'rows':[]};return db[_0x9ba3('0x48')][_0x9ba3('0x9e')]({'where':{'id':_0x5938e8[_0x9ba3('0x64')]['id']}})[_0x9ba3('0x24')](handleEntityNotFound(_0x387ccb,null))[_0x9ba3('0x24')](function(_0x1097ca){if(_0x1097ca){_0x5359f7[_0x9ba3('0x4b')]=_[_0x9ba3('0x4e')](db[_0x9ba3('0xd7')][_0x9ba3('0x65')]);_0x5359f7[_0x9ba3('0x4f')]=_[_0x9ba3('0x4e')](_0x5938e8[_0x9ba3('0x4f')]);_0x5359f7[_0x9ba3('0x58')]=_[_0x9ba3('0x50')](_0x5359f7[_0x9ba3('0x4b')],_0x5359f7[_0x9ba3('0x4f')]);_0x4f0b3f[_0x9ba3('0x52')]=_[_0x9ba3('0x50')](_0x5359f7['model'],qs[_0x9ba3('0x51')](_0x5938e8[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x4f0b3f[_0x9ba3('0x52')]=_0x4f0b3f[_0x9ba3('0x52')]['length']?_0x4f0b3f['attributes']:_0x5359f7[_0x9ba3('0x4b')];if(!_0x5938e8[_0x9ba3('0x4f')]['hasOwnProperty'](_0x9ba3('0x55'))){_0x4f0b3f[_0x9ba3('0x34')]=qs[_0x9ba3('0x34')](_0x5938e8[_0x9ba3('0x4f')][_0x9ba3('0x34')]);_0x4f0b3f[_0x9ba3('0x56')]=qs[_0x9ba3('0x56')](_0x5938e8[_0x9ba3('0x4f')][_0x9ba3('0x56')]);}_0x4f0b3f[_0x9ba3('0xcc')]=qs[_0x9ba3('0xc7')](_0x5938e8[_0x9ba3('0x4f')][_0x9ba3('0xc7')]);_0x4f0b3f['where']=qs['filters'](_[_0x9ba3('0x57')](_0x5938e8['query'],_0x5359f7[_0x9ba3('0x58')]));_0x4f0b3f['where'][_0x9ba3('0xd5')]=_0x1097ca['id'];if(_0x5938e8[_0x9ba3('0x4f')][_0x9ba3('0x40')]){_0x4f0b3f[_0x9ba3('0x5c')]=_[_0x9ba3('0x59')](_0x4f0b3f[_0x9ba3('0x5c')],{'$or':_['map'](_0x4f0b3f['attributes'],function(_0x3931af){var _0x2da35f={};_0x2da35f[_0x3931af]={'$like':'%'+_0x5938e8[_0x9ba3('0x4f')]['filter']+'%'};return _0x2da35f;})});}_0x4f0b3f=_['merge']({},_0x4f0b3f,_0x5938e8[_0x9ba3('0x5f')]);return db[_0x9ba3('0xd7')][_0x9ba3('0x33')]({'where':_0x4f0b3f[_0x9ba3('0x5c')]})['then'](function(_0x20f12e){_0x50cbfa[_0x9ba3('0x33')]=_0x20f12e;if(_0x5938e8[_0x9ba3('0x4f')][_0x9ba3('0x67')]){_0x4f0b3f[_0x9ba3('0xc8')]=[{'all':!![]}];}return db[_0x9ba3('0xd7')]['findAll'](_0x4f0b3f);})['then'](function(_0x36ea5b){_0x50cbfa[_0x9ba3('0x61')]=_0x36ea5b;return _0x50cbfa;});}})[_0x9ba3('0x24')](respondWithFilteredResult(_0x387ccb,_0x4f0b3f))['catch'](handleError(_0x387ccb,null));};exports['getChatInteractions']=function(_0x29651b,_0x341294,_0x39addb){var _0x4f238f={};var _0x525c2b={};var _0xf07836;var _0x5f3227;return db['User'][_0x9ba3('0x9e')]({'where':{'id':_0x29651b[_0x9ba3('0x64')]['id']}})[_0x9ba3('0x24')](handleEntityNotFound(_0x341294,null))['then'](function(_0x21dbf7){if(_0x21dbf7){_0xf07836=_0x21dbf7;_0x525c2b['model']=_['keys'](db['ChatInteraction'][_0x9ba3('0x65')]);_0x525c2b[_0x9ba3('0x4f')]=_['keys'](_0x29651b[_0x9ba3('0x4f')]);_0x525c2b[_0x9ba3('0x58')]=_[_0x9ba3('0x50')](_0x525c2b['model'],_0x525c2b[_0x9ba3('0x4f')]);_0x4f238f['attributes']=_[_0x9ba3('0x50')](_0x525c2b[_0x9ba3('0x4b')],qs[_0x9ba3('0x51')](_0x29651b[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x4f238f[_0x9ba3('0x52')]=_0x4f238f['attributes']['length']?_0x4f238f[_0x9ba3('0x52')]:_0x525c2b['model'];_0x4f238f['order']=qs[_0x9ba3('0xc7')](_0x29651b[_0x9ba3('0x4f')][_0x9ba3('0xc7')]);_0x4f238f[_0x9ba3('0x5c')]=qs['filters'](_[_0x9ba3('0x57')](_0x29651b[_0x9ba3('0x4f')],_0x525c2b[_0x9ba3('0x58')]));if(_0x29651b[_0x9ba3('0x4f')][_0x9ba3('0x40')]){_0x4f238f[_0x9ba3('0x5c')]=_[_0x9ba3('0x59')](_0x4f238f[_0x9ba3('0x5c')],{'$or':_['map'](_0x4f238f['attributes'],function(_0xfb2108){var _0x4cd62d={};_0x4cd62d[_0xfb2108]={'$like':'%'+_0x29651b[_0x9ba3('0x4f')][_0x9ba3('0x40')]+'%'};return _0x4cd62d;})});}_0x4f238f=_[_0x9ba3('0x59')]({},_0x4f238f,_0x29651b[_0x9ba3('0x5f')]);return _0xf07836[_0x9ba3('0xd8')](_0x4f238f);}})[_0x9ba3('0x24')](function(_0x47e34a){if(_0x47e34a){_0x5f3227=_0x47e34a['length'];if(!_0x29651b['query'][_0x9ba3('0x54')]('nolimit')){_0x4f238f[_0x9ba3('0x34')]=qs[_0x9ba3('0x34')](_0x29651b[_0x9ba3('0x4f')][_0x9ba3('0x34')]);_0x4f238f[_0x9ba3('0x56')]=qs[_0x9ba3('0x56')](_0x29651b['query'][_0x9ba3('0x56')]);}return _0xf07836['getChatInteractions'](_0x4f238f);}})[_0x9ba3('0x24')](function(_0x1a25f3){if(_0x1a25f3){return _0x1a25f3?{'count':_0x5f3227,'rows':_0x1a25f3}:null;}})[_0x9ba3('0x24')](respondWithResult(_0x341294,null))[_0x9ba3('0x62')](handleError(_0x341294,null));};exports[_0x9ba3('0xd9')]=function(_0x2ca227,_0x817823,_0xc903b9){var _0x586152={};var _0x229ae9={};var _0x4abbdf;var _0x2231b5;return db[_0x9ba3('0x48')]['findOne']({'where':{'id':_0x2ca227[_0x9ba3('0x64')]['id']}})[_0x9ba3('0x24')](handleEntityNotFound(_0x817823,null))[_0x9ba3('0x24')](function(_0x359459){if(_0x359459){_0x4abbdf=_0x359459;_0x229ae9[_0x9ba3('0x4b')]=_['keys'](db[_0x9ba3('0xda')]['rawAttributes']);_0x229ae9[_0x9ba3('0x4f')]=_[_0x9ba3('0x4e')](_0x2ca227[_0x9ba3('0x4f')]);_0x229ae9[_0x9ba3('0x58')]=_[_0x9ba3('0x50')](_0x229ae9[_0x9ba3('0x4b')],_0x229ae9['query']);_0x586152['attributes']=_[_0x9ba3('0x50')](_0x229ae9[_0x9ba3('0x4b')],qs[_0x9ba3('0x51')](_0x2ca227[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x586152[_0x9ba3('0x52')]=_0x586152['attributes'][_0x9ba3('0x53')]?_0x586152[_0x9ba3('0x52')]:_0x229ae9[_0x9ba3('0x4b')];_0x586152[_0x9ba3('0xcc')]=qs[_0x9ba3('0xc7')](_0x2ca227[_0x9ba3('0x4f')][_0x9ba3('0xc7')]);_0x586152['where']=qs[_0x9ba3('0x58')](_[_0x9ba3('0x57')](_0x2ca227[_0x9ba3('0x4f')],_0x229ae9[_0x9ba3('0x58')]));if(_0x2ca227['query'][_0x9ba3('0x40')]){_0x586152[_0x9ba3('0x5c')]=_[_0x9ba3('0x59')](_0x586152[_0x9ba3('0x5c')],{'$or':_['map'](_0x586152[_0x9ba3('0x52')],function(_0x133e3c){var _0x461061={};_0x461061[_0x133e3c]={'$like':'%'+_0x2ca227[_0x9ba3('0x4f')][_0x9ba3('0x40')]+'%'};return _0x461061;})});}_0x586152=_[_0x9ba3('0x59')]({},_0x586152,_0x2ca227[_0x9ba3('0x5f')]);return _0x4abbdf[_0x9ba3('0xd9')](_0x586152);}})[_0x9ba3('0x24')](function(_0x8895e4){if(_0x8895e4){_0x2231b5=_0x8895e4[_0x9ba3('0x53')];if(!_0x2ca227[_0x9ba3('0x4f')][_0x9ba3('0x54')](_0x9ba3('0x55'))){_0x586152[_0x9ba3('0x34')]=qs[_0x9ba3('0x34')](_0x2ca227[_0x9ba3('0x4f')][_0x9ba3('0x34')]);_0x586152['offset']=qs[_0x9ba3('0x56')](_0x2ca227[_0x9ba3('0x4f')]['offset']);}return _0x4abbdf[_0x9ba3('0xd9')](_0x586152);}})[_0x9ba3('0x24')](function(_0x26bba2){if(_0x26bba2){return _0x26bba2?{'count':_0x2231b5,'rows':_0x26bba2}:null;}})[_0x9ba3('0x24')](respondWithResult(_0x817823,null))['catch'](handleError(_0x817823,null));};exports['getMailInteractions']=function(_0x4da137,_0x48fe63,_0x385cca){var _0x152a0d={'raw':!![],'where':{}};var _0x514121={};var _0x231b0a={'count':0x0,'rows':[]};return db['User'][_0x9ba3('0x9e')]({'where':{'id':_0x4da137['params']['id']}})[_0x9ba3('0x24')](handleEntityNotFound(_0x48fe63,null))[_0x9ba3('0x24')](function(_0x508547){if(_0x508547){_0x514121[_0x9ba3('0x4b')]=_[_0x9ba3('0x4e')](db[_0x9ba3('0xdb')][_0x9ba3('0x65')]);_0x514121[_0x9ba3('0x4f')]=_[_0x9ba3('0x4e')](_0x4da137['query']);_0x514121[_0x9ba3('0x58')]=_[_0x9ba3('0x50')](_0x514121['model'],_0x514121[_0x9ba3('0x4f')]);_0x152a0d[_0x9ba3('0x52')]=_[_0x9ba3('0x50')](_0x514121[_0x9ba3('0x4b')],qs[_0x9ba3('0x51')](_0x4da137[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x152a0d['attributes']=_0x152a0d[_0x9ba3('0x52')][_0x9ba3('0x53')]?_0x152a0d[_0x9ba3('0x52')]:_0x514121[_0x9ba3('0x4b')];if(!_0x4da137[_0x9ba3('0x4f')][_0x9ba3('0x54')](_0x9ba3('0x55'))){_0x152a0d['limit']=qs[_0x9ba3('0x34')](_0x4da137[_0x9ba3('0x4f')][_0x9ba3('0x34')]);_0x152a0d['offset']=qs[_0x9ba3('0x56')](_0x4da137[_0x9ba3('0x4f')][_0x9ba3('0x56')]);}_0x152a0d[_0x9ba3('0xcc')]=qs['sort'](_0x4da137[_0x9ba3('0x4f')][_0x9ba3('0xc7')]);_0x152a0d['where']=qs[_0x9ba3('0x58')](_[_0x9ba3('0x57')](_0x4da137[_0x9ba3('0x4f')],_0x514121[_0x9ba3('0x58')]));_0x152a0d[_0x9ba3('0x5c')][_0x9ba3('0xd5')]=_0x508547['id'];if(_0x4da137[_0x9ba3('0x4f')][_0x9ba3('0x40')]){_0x152a0d[_0x9ba3('0x5c')]=_[_0x9ba3('0x59')](_0x152a0d[_0x9ba3('0x5c')],{'$or':_[_0x9ba3('0x41')](_0x152a0d['attributes'],function(_0x2b11e0){var _0x5d3935={};_0x5d3935[_0x2b11e0]={'$like':'%'+_0x4da137[_0x9ba3('0x4f')]['filter']+'%'};return _0x5d3935;})});}_0x152a0d=_[_0x9ba3('0x59')]({},_0x152a0d,_0x4da137[_0x9ba3('0x5f')]);return db['MailInteraction'][_0x9ba3('0x33')]({'where':_0x152a0d[_0x9ba3('0x5c')]})[_0x9ba3('0x24')](function(_0x10e112){_0x231b0a[_0x9ba3('0x33')]=_0x10e112;if(_0x4da137[_0x9ba3('0x4f')]['includeAll']){_0x152a0d[_0x9ba3('0xc8')]=[{'all':!![]}];}return db['MailInteraction']['findAll'](_0x152a0d);})[_0x9ba3('0x24')](function(_0x30f54c){_0x231b0a['rows']=_0x30f54c;return _0x231b0a;});}})[_0x9ba3('0x24')](respondWithFilteredResult(_0x48fe63,_0x152a0d))['catch'](handleError(_0x48fe63,null));};exports[_0x9ba3('0xdc')]=function(_0x20d81b,_0x4364c2,_0x3d6240){var _0x2936ba={};var _0x38552a={};var _0x1e4c0e;var _0x278517;return db[_0x9ba3('0x48')][_0x9ba3('0x9e')]({'where':{'id':_0x20d81b[_0x9ba3('0x64')]['id']}})[_0x9ba3('0x24')](handleEntityNotFound(_0x4364c2,null))[_0x9ba3('0x24')](function(_0x24dc01){if(_0x24dc01){_0x1e4c0e=_0x24dc01;_0x38552a[_0x9ba3('0x4b')]=_[_0x9ba3('0x4e')](db[_0x9ba3('0xdd')]['rawAttributes']);_0x38552a['query']=_[_0x9ba3('0x4e')](_0x20d81b[_0x9ba3('0x4f')]);_0x38552a[_0x9ba3('0x58')]=_[_0x9ba3('0x50')](_0x38552a[_0x9ba3('0x4b')],_0x38552a['query']);_0x2936ba['attributes']=_[_0x9ba3('0x50')](_0x38552a[_0x9ba3('0x4b')],qs['fields'](_0x20d81b[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x2936ba['attributes']=_0x2936ba['attributes'][_0x9ba3('0x53')]?_0x2936ba[_0x9ba3('0x52')]:_0x38552a['model'];_0x2936ba[_0x9ba3('0xcc')]=qs[_0x9ba3('0xc7')](_0x20d81b[_0x9ba3('0x4f')][_0x9ba3('0xc7')]);_0x2936ba[_0x9ba3('0x5c')]=qs[_0x9ba3('0x58')](_['pick'](_0x20d81b[_0x9ba3('0x4f')],_0x38552a[_0x9ba3('0x58')]));if(_0x20d81b[_0x9ba3('0x4f')][_0x9ba3('0x40')]){_0x2936ba[_0x9ba3('0x5c')]=_[_0x9ba3('0x59')](_0x2936ba[_0x9ba3('0x5c')],{'$or':_[_0x9ba3('0x41')](_0x2936ba[_0x9ba3('0x52')],function(_0x205d5a){var _0xd21fc9={};_0xd21fc9[_0x205d5a]={'$like':'%'+_0x20d81b[_0x9ba3('0x4f')][_0x9ba3('0x40')]+'%'};return _0xd21fc9;})});}_0x2936ba=_[_0x9ba3('0x59')]({},_0x2936ba,_0x20d81b['options']);return _0x1e4c0e[_0x9ba3('0xdc')](_0x2936ba);}})[_0x9ba3('0x24')](function(_0x5d1821){if(_0x5d1821){_0x278517=_0x5d1821[_0x9ba3('0x53')];if(!_0x20d81b[_0x9ba3('0x4f')][_0x9ba3('0x54')](_0x9ba3('0x55'))){_0x2936ba[_0x9ba3('0x34')]=qs[_0x9ba3('0x34')](_0x20d81b[_0x9ba3('0x4f')][_0x9ba3('0x34')]);_0x2936ba[_0x9ba3('0x56')]=qs[_0x9ba3('0x56')](_0x20d81b[_0x9ba3('0x4f')][_0x9ba3('0x56')]);}return _0x1e4c0e['getSmsInteractions'](_0x2936ba);}})[_0x9ba3('0x24')](function(_0x4d10e7){if(_0x4d10e7){return _0x4d10e7?{'count':_0x278517,'rows':_0x4d10e7}:null;}})[_0x9ba3('0x24')](respondWithResult(_0x4364c2,null))['catch'](handleError(_0x4364c2,null));};exports['getFaxInteractions']=function(_0x2d0378,_0x3a0439,_0x29af3a){var _0x41d720={};var _0x68ae63={};var _0x1443d1;var _0x14bcb0;return db[_0x9ba3('0x48')]['findOne']({'where':{'id':_0x2d0378[_0x9ba3('0x64')]['id']}})['then'](handleEntityNotFound(_0x3a0439,null))[_0x9ba3('0x24')](function(_0x4f37a8){if(_0x4f37a8){_0x1443d1=_0x4f37a8;_0x68ae63[_0x9ba3('0x4b')]=_[_0x9ba3('0x4e')](db[_0x9ba3('0xde')][_0x9ba3('0x65')]);_0x68ae63['query']=_[_0x9ba3('0x4e')](_0x2d0378[_0x9ba3('0x4f')]);_0x68ae63[_0x9ba3('0x58')]=_['intersection'](_0x68ae63[_0x9ba3('0x4b')],_0x68ae63['query']);_0x41d720[_0x9ba3('0x52')]=_[_0x9ba3('0x50')](_0x68ae63[_0x9ba3('0x4b')],qs[_0x9ba3('0x51')](_0x2d0378[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x41d720[_0x9ba3('0x52')]=_0x41d720[_0x9ba3('0x52')][_0x9ba3('0x53')]?_0x41d720['attributes']:_0x68ae63[_0x9ba3('0x4b')];_0x41d720['order']=qs[_0x9ba3('0xc7')](_0x2d0378[_0x9ba3('0x4f')][_0x9ba3('0xc7')]);_0x41d720['where']=qs[_0x9ba3('0x58')](_[_0x9ba3('0x57')](_0x2d0378[_0x9ba3('0x4f')],_0x68ae63[_0x9ba3('0x58')]));if(_0x2d0378[_0x9ba3('0x4f')][_0x9ba3('0x40')]){_0x41d720[_0x9ba3('0x5c')]=_['merge'](_0x41d720[_0x9ba3('0x5c')],{'$or':_[_0x9ba3('0x41')](_0x41d720[_0x9ba3('0x52')],function(_0x402ed5){var _0x3ed308={};_0x3ed308[_0x402ed5]={'$like':'%'+_0x2d0378[_0x9ba3('0x4f')][_0x9ba3('0x40')]+'%'};return _0x3ed308;})});}_0x41d720=_[_0x9ba3('0x59')]({},_0x41d720,_0x2d0378[_0x9ba3('0x5f')]);return _0x1443d1[_0x9ba3('0xdf')](_0x41d720);}})[_0x9ba3('0x24')](function(_0x59e341){if(_0x59e341){_0x14bcb0=_0x59e341['length'];if(!_0x2d0378['query'][_0x9ba3('0x54')](_0x9ba3('0x55'))){_0x41d720[_0x9ba3('0x34')]=qs[_0x9ba3('0x34')](_0x2d0378['query'][_0x9ba3('0x34')]);_0x41d720[_0x9ba3('0x56')]=qs['offset'](_0x2d0378['query'][_0x9ba3('0x56')]);}return _0x1443d1[_0x9ba3('0xdf')](_0x41d720);}})[_0x9ba3('0x24')](function(_0x5b588a){if(_0x5b588a){return _0x5b588a?{'count':_0x14bcb0,'rows':_0x5b588a}:null;}})[_0x9ba3('0x24')](respondWithResult(_0x3a0439,null))['catch'](handleError(_0x3a0439,null));};exports[_0x9ba3('0xe0')]=function(_0x5aa68b,_0x43ec19,_0x2d4879){var _0x3ade01={};var _0x36cc8e={};var _0x18a401;var _0x498903;return db[_0x9ba3('0x48')][_0x9ba3('0x9e')]({'where':{'id':_0x5aa68b[_0x9ba3('0x64')]['id']}})[_0x9ba3('0x24')](handleEntityNotFound(_0x43ec19,null))[_0x9ba3('0x24')](function(_0x561064){if(_0x561064){_0x18a401=_0x561064;_0x36cc8e[_0x9ba3('0x4b')]=_[_0x9ba3('0x4e')](db[_0x9ba3('0xe1')][_0x9ba3('0x65')]);_0x36cc8e[_0x9ba3('0x4f')]=_[_0x9ba3('0x4e')](_0x5aa68b[_0x9ba3('0x4f')]);_0x36cc8e['filters']=_[_0x9ba3('0x50')](_0x36cc8e[_0x9ba3('0x4b')],_0x36cc8e[_0x9ba3('0x4f')]);_0x3ade01[_0x9ba3('0x52')]=_['intersection'](_0x36cc8e['model'],qs[_0x9ba3('0x51')](_0x5aa68b[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x3ade01[_0x9ba3('0x52')]=_0x3ade01[_0x9ba3('0x52')][_0x9ba3('0x53')]?_0x3ade01[_0x9ba3('0x52')]:_0x36cc8e['model'];_0x3ade01[_0x9ba3('0xcc')]=qs['sort'](_0x5aa68b[_0x9ba3('0x4f')]['sort']);_0x3ade01[_0x9ba3('0x5c')]=qs[_0x9ba3('0x58')](_[_0x9ba3('0x57')](_0x5aa68b['query'],_0x36cc8e[_0x9ba3('0x58')]));if(_0x5aa68b['query'][_0x9ba3('0x40')]){_0x3ade01[_0x9ba3('0x5c')]=_[_0x9ba3('0x59')](_0x3ade01[_0x9ba3('0x5c')],{'$or':_[_0x9ba3('0x41')](_0x3ade01[_0x9ba3('0x52')],function(_0xa4c955){var _0x4c5ecc={};_0x4c5ecc[_0xa4c955]={'$like':'%'+_0x5aa68b[_0x9ba3('0x4f')][_0x9ba3('0x40')]+'%'};return _0x4c5ecc;})});}_0x3ade01=_[_0x9ba3('0x59')]({},_0x3ade01,_0x5aa68b['options']);return _0x18a401[_0x9ba3('0xe0')](_0x3ade01);}})[_0x9ba3('0x24')](function(_0x49ceb){if(_0x49ceb){_0x498903=_0x49ceb['length'];if(!_0x5aa68b[_0x9ba3('0x4f')]['hasOwnProperty'](_0x9ba3('0x55'))){_0x3ade01[_0x9ba3('0x34')]=qs[_0x9ba3('0x34')](_0x5aa68b[_0x9ba3('0x4f')]['limit']);_0x3ade01[_0x9ba3('0x56')]=qs[_0x9ba3('0x56')](_0x5aa68b['query'][_0x9ba3('0x56')]);}return _0x18a401['getWhatsappInteractions'](_0x3ade01);}})[_0x9ba3('0x24')](function(_0x5655d1){if(_0x5655d1){return _0x5655d1?{'count':_0x498903,'rows':_0x5655d1}:null;}})['then'](respondWithResult(_0x43ec19,null))[_0x9ba3('0x62')](handleError(_0x43ec19,null));};exports[_0x9ba3('0xe2')]=function(_0x3d78ec,_0x5daf67,_0x3f9300){var _0x19122f;var _0x46136d;var _0xe3e710;var _0x328d39=!_['isNil'](_0x3d78ec[_0x9ba3('0x64')]['id'])?_0x3d78ec['params']['id']:!_[_0x9ba3('0x70')](_0x3d78ec[_0x9ba3('0x86')]['id'])?_0x3d78ec[_0x9ba3('0x86')]['id']:null;return db[_0x9ba3('0x48')][_0x9ba3('0x44')]({'where':{'id':_0x328d39,'role':{'$or':[_0x9ba3('0x3b'),'user',_0x9ba3('0x3d')]}},'attributes':['id',_0x9ba3('0x45'),'phone',_0x9ba3('0xe3'),_0x9ba3('0x3a'),_0x9ba3('0x6b'),_0x9ba3('0xa7')]})[_0x9ba3('0x24')](function(_0x48ceca){if(_0x48ceca){if(_0x48ceca[_0x9ba3('0x3a')]===_0x9ba3('0x3d')){_0x19122f=_0x48ceca;if(_0x3d78ec[_0x9ba3('0x68')][_0x9ba3('0xa9')]){_0xe3e710=util[_0x9ba3('0xb8')](_0x9ba3('0xe4'),_0x19122f[_0x3d78ec[_0x9ba3('0x68')]['interface']]);}else if(_0x3d78ec[_0x9ba3('0x68')]['intrf']){_0xe3e710=util[_0x9ba3('0xb8')](_0x9ba3('0xb9'),_0x3d78ec[_0x9ba3('0x68')][_0x9ba3('0xe5')]);}else{_0xe3e710=util[_0x9ba3('0xb8')](_0x9ba3('0xb9'),_0x19122f[_0x9ba3('0x45')]);}socket['to'](util['format'](_0x9ba3('0xe6'),_0x19122f[_0x9ba3('0x45')]))[_0x9ba3('0xb2')](_0x9ba3('0xe7'),{'ip':_0x3d78ec['headers']['x-forwarded-for']||_0x3d78ec[_0x9ba3('0xe8')]['remoteAddress']||_0x3d78ec[_0x9ba3('0xe9')]['remoteAddress']||_0x3d78ec['connection'][_0x9ba3('0xe9')][_0x9ba3('0xea')]});return db[_0x9ba3('0xd1')][_0x9ba3('0x39')]({'where':{'membername':_0x19122f['name']},'individualHooks':!![]});}}else{throw new db[(_0x9ba3('0x9c'))][(_0x9ba3('0x9b'))](_0x9ba3('0xeb'));}})[_0x9ba3('0x24')](function(){if(_0x19122f){return _0x19122f[_0x9ba3('0xec')]({'raw':!![]});}})[_0x9ba3('0x24')](function(_0x5c2c0c){if(_0x19122f){var _0x3c5eb7=[];if(_0x5c2c0c){_0x46136d=_0x5c2c0c;if(_0x46136d['length']){for(var _0x592c12=0x0;_0x592c12<_0x46136d[_0x9ba3('0x53')];_0x592c12++){_0x3c5eb7[_0x9ba3('0x93')]({'membername':_0x19122f[_0x9ba3('0x45')],'UserId':_0x19122f['id'],'queue_name':_0x46136d[_0x592c12]['name'],'VoiceQueueId':_0x46136d[_0x592c12]['id'],'interface':_0xe3e710,'paused':_0x19122f[_0x9ba3('0xa7')]||![],'penalty':_0x46136d[_0x592c12][_0x9ba3('0xed')]||0x0});}return BPromise[_0x9ba3('0x95')](_0x3c5eb7,function(_0x3d75ce){return db[_0x9ba3('0xd1')][_0x9ba3('0xba')](_0x3d75ce);});}}}})[_0x9ba3('0x24')](function(){if(_0x19122f){return db[_0x9ba3('0xee')]['findAll']({'where':{'membername':_0x19122f[_0x9ba3('0x45')],'exitAt':null}});}})[_0x9ba3('0x24')](function(_0x174b19){if(_0x19122f){var _0x146689=[];_0x174b19['forEach'](function(_0x415e2d){_0x146689['push'](_0x415e2d[_0x9ba3('0x38')]({'exitAt':moment()[_0x9ba3('0xb8')](_0x9ba3('0xef'))}));});return BPromise[_0x9ba3('0x94')](_0x146689);}})[_0x9ba3('0x24')](function(){if(_0x19122f){var _0x4d4256=[];var _0x212daf=[];var _0x51eebd=utils[_0x9ba3('0xf0')]();var _0x2af678={'membername':_0x19122f[_0x9ba3('0x45')],'interface':_0xe3e710,'enterAt':moment()['format'](_0x9ba3('0xef')),'role':_0x19122f[_0x9ba3('0x3a')],'internal':_0x19122f[_0x9ba3('0x6b')]};_0x51eebd[_0x9ba3('0xf1')](function(_0x53b603){_0x4d4256[_0x9ba3('0x93')](_['merge']({'channel':_0x53b603,'type':_0x9ba3('0xf2'),'data1':_0x3d78ec['body']['device'],'data2':_0xe3e710},_0x2af678));if(_0x19122f[_0x9ba3('0xa7')]){_0x212daf[_0x9ba3('0x93')](_[_0x9ba3('0x59')]({'channel':_0x53b603,'type':_0x9ba3('0xf3'),'data1':_0x9ba3('0xf4')},_0x2af678));}});return db['MemberReport'][_0x9ba3('0x90')](_0x4d4256[_0x9ba3('0xf5')](_0x212daf),{'individualHooks':!![]});}})['then'](function(){if(_0x19122f){return _0x19122f[_0x9ba3('0x38')]({'online':!![],'lastLoginAt':moment()['format'](_0x9ba3('0xef')),'voicePause':_0x19122f[_0x9ba3('0xa7')]||![],'mailPause':_0x19122f[_0x9ba3('0xa7')]||![],'chatPause':_0x19122f[_0x9ba3('0xa7')]||![],'faxPause':_0x19122f['loginInPause']||![],'smsPause':_0x19122f[_0x9ba3('0xa7')]||![],'openchannelPause':_0x19122f[_0x9ba3('0xa7')]||![],'whatsappPause':_0x19122f[_0x9ba3('0xa7')]||![],'pauseType':_0x19122f[_0x9ba3('0xa7')]?'LOGININPAUSE':null,'interface':_0xe3e710,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})['then'](function(_0x461e2b){if(_0x3d78ec[_0x9ba3('0xf6')]){return _0x3f9300();}else{return BPromise['resolve'](_0x461e2b)['then'](respondWithResult(_0x5daf67,null));}})[_0x9ba3('0x62')](handleError(_0x5daf67,null));};exports[_0x9ba3('0xf7')]=function(_0x1f8e4c,_0x444323,_0x2562fc){var _0xd3770;return db[_0x9ba3('0x48')]['find']({'where':{'id':_0x1f8e4c[_0x9ba3('0x64')]['id'],'role':'agent'},'attributes':['id',_0x9ba3('0x45'),_0x9ba3('0x3a')]})[_0x9ba3('0x24')](handleEntityNotFound(_0x444323,null))['then'](function(_0x23e183){if(_0x23e183){_0xd3770=_0x23e183;return db[_0x9ba3('0xd1')][_0x9ba3('0x39')]({'where':{'membername':_0xd3770['name']},'individualHooks':!![]});}})[_0x9ba3('0x24')](function(){return db[_0x9ba3('0xee')]['findAll']({'where':{'membername':_0xd3770[_0x9ba3('0x45')],'exitAt':null}});})[_0x9ba3('0x24')](function(_0x55e657){var _0xe733a4=[];_0x55e657['forEach'](function(_0x1c8eeb){_0xe733a4[_0x9ba3('0x93')](_0x1c8eeb['update']({'exitAt':moment()[_0x9ba3('0xb8')](_0x9ba3('0xef'))}));});return BPromise['all'](_0xe733a4);})[_0x9ba3('0x24')](function(){return _0xd3770[_0x9ba3('0x38')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x444323,null))[_0x9ba3('0x62')](handleError(_0x444323,null));};exports[_0x9ba3('0xf8')]=function(_0x3840c6,_0x3748a7,_0x14ea3c){var _0x166f24;return db[_0x9ba3('0xd1')][_0x9ba3('0x38')]({'paused':0x1},{'where':{'UserId':_0x3840c6[_0x9ba3('0x64')]['id']},'individualHooks':!![]})[_0x9ba3('0x24')](function(){return db[_0x9ba3('0x48')][_0x9ba3('0x44')]({'where':{'id':_0x3840c6[_0x9ba3('0x64')]['id'],'role':_0x9ba3('0x3d')},'attributes':['id','name',_0x9ba3('0x3a'),_0x9ba3('0x6b'),_0x9ba3('0xa9')]});})['then'](handleEntityNotFound(_0x3748a7,null))['then'](function(_0x29ef93){if(_0x29ef93){_0x166f24=_0x29ef93;return respondWithRpcPromise(_0x9ba3('0xf9'),_0x9ba3('0xf8'),{'id':_0x166f24['id'],'name':_0x166f24[_0x9ba3('0x45')],'pause':!![]});}})[_0x9ba3('0x24')](function(){if(_0x166f24){return db[_0x9ba3('0xee')][_0x9ba3('0x60')]({'where':{'membername':_0x166f24[_0x9ba3('0x45')],'type':_0x9ba3('0xf3'),'exitAt':null}});}})[_0x9ba3('0x24')](function(_0x444581){if(_0x444581['length']){var _0x41502f=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x42c796=0x0,_0x435078=_0x444581[_0x9ba3('0x53')];_0x42c796<_0x435078;_0x42c796++){_0x444581[_0x42c796][_0x9ba3('0xfa')]({'exitAt':_0x41502f});}}})[_0x9ba3('0x24')](function(){var _0x138b6f=[];var _0x3928ce=utils[_0x9ba3('0xf0')]();_0x3928ce[_0x9ba3('0xf1')](function(_0x23f122){_0x138b6f[_0x9ba3('0x93')]({'channel':_0x23f122,'membername':_0x166f24[_0x9ba3('0x45')],'interface':_[_0x9ba3('0x70')](_0x166f24['interface'])?util[_0x9ba3('0xb8')](_0x9ba3('0xb9'),_0x166f24[_0x9ba3('0x45')]):_0x166f24[_0x9ba3('0xa9')],'type':_0x9ba3('0xf3'),'enterAt':moment()['format'](_0x9ba3('0xef')),'data1':_0x3840c6[_0x9ba3('0x68')][_0x9ba3('0xfb')]||_0x9ba3('0xfc'),'role':_0x166f24[_0x9ba3('0x3a')],'internal':_0x166f24['internal']});});return db[_0x9ba3('0xee')]['bulkCreate'](_0x138b6f,{'individualHooks':!![]});})[_0x9ba3('0x24')](function(){return _0x166f24['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x3840c6['body'][_0x9ba3('0xfb')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x9ba3('0xb8')]('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x3748a7,null))[_0x9ba3('0x62')](handleError(_0x3748a7,null));};exports[_0x9ba3('0xfd')]=function(_0x563993,_0x4b44c9,_0x53c0a3){var _0x524430;return db[_0x9ba3('0x48')]['find']({'where':{'id':_0x563993['params']['id']},'attributes':['id',_0x9ba3('0x45'),_0x9ba3('0x3a'),_0x9ba3('0xa8'),_0x9ba3('0xfe'),_0x9ba3('0xff'),_0x9ba3('0x100'),'openchannelPause',_0x9ba3('0x101'),_0x9ba3('0x102'),_0x9ba3('0x103'),_0x9ba3('0x104')]})[_0x9ba3('0x24')](handleEntityNotFound(_0x4b44c9,null))[_0x9ba3('0x24')](function(_0x2992ad){if(_0x2992ad){_0x524430=_0x2992ad;if(_0x563993[_0x9ba3('0x68')]['channel']&&!utils[_0x9ba3('0xaa')](_0x563993[_0x9ba3('0x68')][_0x9ba3('0xa6')])){throw new db[(_0x9ba3('0x9c'))]['ValidationError']('Unknown\x20channel');}switch(_0x563993[_0x9ba3('0x68')][_0x9ba3('0xa6')]){case _0x9ba3('0xb5'):return respondWithRpcPromise(_0x9ba3('0xf9'),_0x9ba3('0xfd'),{'id':_0x524430['id'],'name':_0x524430[_0x9ba3('0x45')],'pause':![]})['then'](function(){return db[_0x9ba3('0xd1')][_0x9ba3('0x38')]({'paused':0x0},{'where':{'UserId':_0x524430['id']},'individualHooks':!![]});})[_0x9ba3('0x24')](function(){return db['MemberReport'][_0x9ba3('0x44')]({'where':{'channel':_0x563993[_0x9ba3('0x68')][_0x9ba3('0xa6')],'membername':_0x524430[_0x9ba3('0x45')],'type':'PAUSE','exitAt':null}});})[_0x9ba3('0x24')](function(_0x18e242){if(_0x18e242){return _0x18e242[_0x9ba3('0x38')]({'exitAt':moment()['format'](_0x9ba3('0xef')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x9ba3('0x24')](function(){return _0x524430[_0x9ba3('0x38')]({'voicePause':![]});});case _0x9ba3('0x105'):case _0x9ba3('0x106'):case _0x9ba3('0x107'):case _0x9ba3('0x108'):case _0x9ba3('0x109'):case _0x9ba3('0x10a'):return db[_0x9ba3('0xee')][_0x9ba3('0x44')]({'where':{'channel':_0x563993[_0x9ba3('0x68')][_0x9ba3('0xa6')],'membername':_0x524430[_0x9ba3('0x45')],'type':_0x9ba3('0xf3'),'exitAt':null}})[_0x9ba3('0x24')](function(_0xe76cf7){if(_0xe76cf7){return _0xe76cf7[_0x9ba3('0x38')]({'exitAt':moment()[_0x9ba3('0xb8')](_0x9ba3('0xef')),'data2':'manual'},{'individualHooks':!![]});}return null;})['then'](function(){var _0x4becbe={};_['set'](_0x4becbe,util[_0x9ba3('0xb8')](_0x9ba3('0x10b'),_0x563993['body'][_0x9ba3('0xa6')],'Pause'),![]);return _0x524430[_0x9ba3('0x38')](_0x4becbe);});default:return respondWithRpcPromise(_0x9ba3('0xf9'),_0x9ba3('0xfd'),{'id':_0x524430['id'],'name':_0x524430['name'],'pause':![]})[_0x9ba3('0x24')](function(){return db[_0x9ba3('0xd1')][_0x9ba3('0x38')]({'paused':0x0},{'where':{'UserId':_0x524430['id']}});})[_0x9ba3('0x24')](function(){return db[_0x9ba3('0xee')][_0x9ba3('0x60')]({'where':{'membername':_0x524430['name'],'type':_0x9ba3('0xf3'),'exitAt':null}});})['then'](function(_0x1371ca){var _0x386c8d=[];_0x1371ca[_0x9ba3('0xf1')](function(_0x564ca4){_0x386c8d[_0x9ba3('0x93')](_0x564ca4[_0x9ba3('0x38')]({'exitAt':moment()['format'](_0x9ba3('0xef')),'data2':_0x9ba3('0x10c')}));});return BPromise['all'](_0x386c8d);})[_0x9ba3('0x24')](function(){return _0x524430[_0x9ba3('0x38')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x9ba3('0x24')](respondWithResult(_0x4b44c9,null))['catch'](handleError(_0x4b44c9,null));};exports['getTeams']=function(_0xe4ab9a,_0x43f686,_0xea8452){var _0x2b15ec={};var _0x4ed469={};var _0x3cfd0e;var _0x2eab40;return db['User'][_0x9ba3('0x9e')]({'where':{'id':_0xe4ab9a[_0x9ba3('0x64')]['id']}})[_0x9ba3('0x24')](handleEntityNotFound(_0x43f686,null))['then'](function(_0x3cb565){if(_0x3cb565){_0x3cfd0e=_0x3cb565;_0x4ed469[_0x9ba3('0x4b')]=_[_0x9ba3('0x4e')](db['Team'][_0x9ba3('0x65')]);_0x4ed469[_0x9ba3('0x4f')]=_[_0x9ba3('0x4e')](_0xe4ab9a[_0x9ba3('0x4f')]);_0x4ed469[_0x9ba3('0x58')]=_[_0x9ba3('0x50')](_0x4ed469[_0x9ba3('0x4b')],_0x4ed469[_0x9ba3('0x4f')]);_0x2b15ec[_0x9ba3('0x52')]=_[_0x9ba3('0x50')](_0x4ed469['model'],qs['fields'](_0xe4ab9a[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x2b15ec[_0x9ba3('0x52')]=_0x2b15ec['attributes']['length']?_0x2b15ec[_0x9ba3('0x52')]:_0x4ed469['model'];_0x2b15ec[_0x9ba3('0xcc')]=qs[_0x9ba3('0xc7')](_0xe4ab9a[_0x9ba3('0x4f')][_0x9ba3('0xc7')]);_0x2b15ec[_0x9ba3('0x5c')]=qs[_0x9ba3('0x58')](_['pick'](_0xe4ab9a[_0x9ba3('0x4f')],_0x4ed469[_0x9ba3('0x58')]));if(_0xe4ab9a[_0x9ba3('0x4f')][_0x9ba3('0x40')]){_0x2b15ec[_0x9ba3('0x5c')]=_[_0x9ba3('0x59')](_0x2b15ec[_0x9ba3('0x5c')],{'$or':_[_0x9ba3('0x41')](_0x2b15ec['attributes'],function(_0x13d348){var _0x103715={};_0x103715[_0x13d348]={'$like':'%'+_0xe4ab9a[_0x9ba3('0x4f')][_0x9ba3('0x40')]+'%'};return _0x103715;})});}_0x2b15ec=_[_0x9ba3('0x59')]({},_0x2b15ec,_0xe4ab9a[_0x9ba3('0x5f')]);return _0x3cfd0e[_0x9ba3('0x10d')](_0x2b15ec);}})[_0x9ba3('0x24')](function(_0x454e0f){if(_0x454e0f){_0x2eab40=_0x454e0f['length'];if(!_0xe4ab9a[_0x9ba3('0x4f')][_0x9ba3('0x54')](_0x9ba3('0x55'))){_0x2b15ec['limit']=qs['limit'](_0xe4ab9a[_0x9ba3('0x4f')]['limit']);_0x2b15ec[_0x9ba3('0x56')]=qs['offset'](_0xe4ab9a[_0x9ba3('0x4f')][_0x9ba3('0x56')]);}return _0x3cfd0e[_0x9ba3('0x10d')](_0x2b15ec);}})[_0x9ba3('0x24')](function(_0x575a89){if(_0x575a89){return _0x575a89?{'count':_0x2eab40,'rows':_0x575a89}:null;}})[_0x9ba3('0x24')](respondWithResult(_0x43f686,null))[_0x9ba3('0x62')](handleError(_0x43f686,null));};exports[_0x9ba3('0x10e')]=function(_0xfce4e3,_0x5a7393){return db['User'][_0x9ba3('0x44')]({'where':{'id':_0xfce4e3['params']['id']}})['then'](handleEntityNotFound(_0x5a7393,null))[_0x9ba3('0x24')](function(_0x489afb){if(_0x489afb){var _0x47e3ac=_0x489afb[_0x9ba3('0xce')]({'plain':!![]});return _0x489afb[_0x9ba3('0x10e')](_0xfce4e3[_0x9ba3('0x68')][_0x9ba3('0x6a')],_[_0x9ba3('0x10f')](_0xfce4e3[_0x9ba3('0x68')],[_0x9ba3('0x6a'),'id'])||{})[_0x9ba3('0x24')](function(){for(var _0x3ce492=0x0;_0x3ce492<_0xfce4e3['body'][_0x9ba3('0x6a')]['length'];_0x3ce492++){var _0x35e479=[];db[_0x9ba3('0x110')][_0x9ba3('0x9e')]({'where':{'id':_0xfce4e3[_0x9ba3('0x68')][_0x9ba3('0x6a')][_0x3ce492]}})[_0x9ba3('0x24')](function(_0x5c237e){_0x35e479[_0x9ba3('0x93')](_0x5c237e['getVoiceQueues']()[_0x9ba3('0x24')](function(_0x1703e6){for(var _0x22d6d5=0x0;_0x22d6d5<_0x1703e6[_0x9ba3('0x53')];_0x22d6d5++){_0x1703e6[_0x22d6d5][_0x9ba3('0x111')]('channel',_0x9ba3('0x112'));}return _0x1703e6;}));_0x35e479[_0x9ba3('0x93')](_0x5c237e['getChatQueues']()[_0x9ba3('0x24')](function(_0x5d0e01){for(var _0x1ebbc7=0x0;_0x1ebbc7<_0x5d0e01[_0x9ba3('0x53')];_0x1ebbc7++){_0x5d0e01[_0x1ebbc7][_0x9ba3('0x111')](_0x9ba3('0xa6'),_0x9ba3('0x113'));}return _0x5d0e01;}));_0x35e479[_0x9ba3('0x93')](_0x5c237e[_0x9ba3('0x114')]()[_0x9ba3('0x24')](function(_0x311f61){for(var _0x12fd9d=0x0;_0x12fd9d<_0x311f61[_0x9ba3('0x53')];_0x12fd9d++){_0x311f61[_0x12fd9d]['setDataValue'](_0x9ba3('0xa6'),'Mail');}return _0x311f61;}));_0x35e479['push'](_0x5c237e['getSmsQueues']()[_0x9ba3('0x24')](function(_0x58be5c){for(var _0x3ded7e=0x0;_0x3ded7e<_0x58be5c['length'];_0x3ded7e++){_0x58be5c[_0x3ded7e]['setDataValue'](_0x9ba3('0xa6'),_0x9ba3('0x115'));}return _0x58be5c;}));_0x35e479[_0x9ba3('0x93')](_0x5c237e['getWhatsappQueues']()[_0x9ba3('0x24')](function(_0x2a9b3f){for(var _0x8d158f=0x0;_0x8d158f<_0x2a9b3f[_0x9ba3('0x53')];_0x8d158f++){_0x2a9b3f[_0x8d158f][_0x9ba3('0x111')](_0x9ba3('0xa6'),_0x9ba3('0x116'));}return _0x2a9b3f;}));_0x35e479[_0x9ba3('0x93')](_0x5c237e[_0x9ba3('0x117')]()[_0x9ba3('0x24')](function(_0x4cd4f8){for(var _0x5e9f1c=0x0;_0x5e9f1c<_0x4cd4f8[_0x9ba3('0x53')];_0x5e9f1c++){_0x4cd4f8[_0x5e9f1c][_0x9ba3('0x111')](_0x9ba3('0xa6'),_0x9ba3('0x118'));}return _0x4cd4f8;}));_0x35e479[_0x9ba3('0x93')](_0x5c237e[_0x9ba3('0x119')]()[_0x9ba3('0x24')](function(_0x4b6674){for(var _0x100bcc=0x0;_0x100bcc<_0x4b6674['length'];_0x100bcc++){_0x4b6674[_0x100bcc][_0x9ba3('0x111')](_0x9ba3('0xa6'),_0x9ba3('0x11a'));}return _0x4b6674;}));return BPromise[_0x9ba3('0x94')](_0x35e479);})[_0x9ba3('0x24')](function(_0x53ea32){var _0x2ac94b=_[_0x9ba3('0x11b')](_0x53ea32);_0x35e479=[];return db['sequelize'][_0x9ba3('0x11c')](function(_0x505647){for(var _0x5c7c28=0x0;_0x5c7c28<_0x2ac94b[_0x9ba3('0x53')];_0x5c7c28++){_0x35e479['push'](_0x2ac94b[_0x5c7c28][_0x9ba3('0x11d')](_0x47e3ac['id']),{'transaction':_0x505647});}return BPromise[_0x9ba3('0x94')](_0x35e479)[_0x9ba3('0x24')](function(){if(_0x47e3ac[_0x9ba3('0xb7')]){return BPromise[_0x9ba3('0x95')](_[_0x9ba3('0x40')](_0x2ac94b,function(_0x5b02f4){return _0x5b02f4[_0x9ba3('0x11e')](_0x9ba3('0xa6'))==='Voice';}),function(_0x57c559){return db[_0x9ba3('0xd1')][_0x9ba3('0xba')]({'membername':_0x47e3ac[_0x9ba3('0x45')],'UserId':_0x47e3ac['id'],'queue_name':_0x57c559[_0x9ba3('0x45')],'VoiceQueueId':_0x57c559['id'],'interface':_['isNil'](_0x47e3ac[_0x9ba3('0xa9')])?util[_0x9ba3('0xb8')](_0x9ba3('0xb9'),_0x47e3ac[_0x9ba3('0x45')]):_0x47e3ac[_0x9ba3('0xa9')],'paused':_0x47e3ac[_0x9ba3('0xa8')]||![],'penalty':_0x47e3ac['penalty']},{'transaction':_0x505647});});}else{return;}})[_0x9ba3('0x24')](function(){for(var _0x16d499=0x0;_0x16d499<_0x2ac94b[_0x9ba3('0x53')];_0x16d499++){var _0x421660=_0x2ac94b[_0x16d499][_0x9ba3('0x11e')]('channel');var _0x88b7c6=_0x421660+_0x9ba3('0xb1');socket[_0x9ba3('0xb2')](_0x9ba3('0x86')+_0x421660+_0x9ba3('0xb4'),{'UserId':_0x47e3ac['id'],['queueField']:_0x2ac94b[_0x16d499]['id']});}});});});}});}})[_0x9ba3('0x24')](respondWithStatusCode(_0x5a7393,null))[_0x9ba3('0x62')](handleError(_0x5a7393,null));};exports[_0x9ba3('0x11f')]=function(_0x3b0702,_0x3539ba){return db['User'][_0x9ba3('0x9e')]({'where':{'id':_0x3b0702[_0x9ba3('0x64')]['id']}})['then'](handleEntityNotFound(_0x3539ba,null))[_0x9ba3('0x24')](function(_0xcef132){if(_0xcef132){var _0x2f07fb=_0xcef132[_0x9ba3('0xce')]({'plain':!![]});var _0x356d46=_0x3b0702[_0x9ba3('0x4f')][_0x9ba3('0x6a')];return _0xcef132[_0x9ba3('0x11f')](_0x356d46)[_0x9ba3('0x24')](function(){for(var _0x10c0a2=0x0;_0x10c0a2<_0x356d46[_0x9ba3('0x53')];_0x10c0a2++){var _0x48a300=[];db[_0x9ba3('0x110')][_0x9ba3('0x9e')]({'where':{'id':_0x356d46[_0x10c0a2]}})[_0x9ba3('0x24')](function(_0x550ccd){_0x48a300[_0x9ba3('0x93')](_0x550ccd[_0x9ba3('0xec')]()[_0x9ba3('0x24')](function(_0x52ecf6){for(var _0x5cd4b1=0x0;_0x5cd4b1<_0x52ecf6[_0x9ba3('0x53')];_0x5cd4b1++){_0x52ecf6[_0x5cd4b1][_0x9ba3('0x111')]('channel',_0x9ba3('0x112'));}return _0x52ecf6;}));_0x48a300[_0x9ba3('0x93')](_0x550ccd[_0x9ba3('0x120')]()[_0x9ba3('0x24')](function(_0x2df0c0){for(var _0x525816=0x0;_0x525816<_0x2df0c0['length'];_0x525816++){_0x2df0c0[_0x525816][_0x9ba3('0x111')](_0x9ba3('0xa6'),_0x9ba3('0x113'));}return _0x2df0c0;}));_0x48a300[_0x9ba3('0x93')](_0x550ccd['getMailQueues']()[_0x9ba3('0x24')](function(_0x340348){for(var _0x56ebdd=0x0;_0x56ebdd<_0x340348['length'];_0x56ebdd++){_0x340348[_0x56ebdd][_0x9ba3('0x111')](_0x9ba3('0xa6'),_0x9ba3('0x121'));}return _0x340348;}));_0x48a300['push'](_0x550ccd['getSmsQueues']()['then'](function(_0x54f0b1){for(var _0x5c56d1=0x0;_0x5c56d1<_0x54f0b1[_0x9ba3('0x53')];_0x5c56d1++){_0x54f0b1[_0x5c56d1][_0x9ba3('0x111')](_0x9ba3('0xa6'),_0x9ba3('0x115'));}return _0x54f0b1;}));_0x48a300[_0x9ba3('0x93')](_0x550ccd['getWhatsappQueues']()[_0x9ba3('0x24')](function(_0x1470cb){for(var _0x5919fc=0x0;_0x5919fc<_0x1470cb[_0x9ba3('0x53')];_0x5919fc++){_0x1470cb[_0x5919fc][_0x9ba3('0x111')](_0x9ba3('0xa6'),'Whatsapp');}return _0x1470cb;}));_0x48a300['push'](_0x550ccd[_0x9ba3('0x117')]()[_0x9ba3('0x24')](function(_0x4935d0){for(var _0x209d3b=0x0;_0x209d3b<_0x4935d0[_0x9ba3('0x53')];_0x209d3b++){_0x4935d0[_0x209d3b][_0x9ba3('0x111')](_0x9ba3('0xa6'),'Fax');}return _0x4935d0;}));_0x48a300[_0x9ba3('0x93')](_0x550ccd['getOpenchannelQueues']()[_0x9ba3('0x24')](function(_0x5693e6){for(var _0x49d692=0x0;_0x49d692<_0x5693e6['length'];_0x49d692++){_0x5693e6[_0x49d692][_0x9ba3('0x111')](_0x9ba3('0xa6'),'Openchannel');}return _0x5693e6;}));return BPromise[_0x9ba3('0x94')](_0x48a300);})[_0x9ba3('0x24')](function(_0x4db678){var _0x408ff1=_[_0x9ba3('0x11b')](_0x4db678);_0x48a300=[];return db['sequelize'][_0x9ba3('0x11c')](function(_0x2f6841){for(var _0x281a57=0x0;_0x281a57<_0x408ff1[_0x9ba3('0x53')];_0x281a57++){_0x48a300[_0x9ba3('0x93')](_0x408ff1[_0x281a57][_0x9ba3('0x122')](_0x2f07fb['id']),{'transaction':_0x2f6841});}return BPromise[_0x9ba3('0x94')](_0x48a300)[_0x9ba3('0x24')](function(){if(_0x2f07fb['online']){return BPromise[_0x9ba3('0x95')](_['filter'](_0x408ff1,function(_0xd8cd38){return _0xd8cd38[_0x9ba3('0x11e')](_0x9ba3('0xa6'))===_0x9ba3('0x112');}),function(_0x3d86ea){return db[_0x9ba3('0xd1')][_0x9ba3('0x39')]({'where':{'VoiceQueueId':_0x3d86ea['id'],'UserId':_0x2f07fb['id']},'transaction':_0x2f6841});});}else{return;}})[_0x9ba3('0x24')](function(){for(var _0x2f3e53=0x0;_0x2f3e53<_0x408ff1[_0x9ba3('0x53')];_0x2f3e53++){var _0xcb82f=_0x408ff1[_0x2f3e53][_0x9ba3('0x11e')]('channel');var _0x336a58=_0xcb82f+_0x9ba3('0xb1');socket[_0x9ba3('0xb2')](_0x9ba3('0x86')+_0xcb82f+_0x9ba3('0xbd'),{'UserId':_0x2f07fb['id'],['queueField']:_0x408ff1[_0x2f3e53]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x3539ba,null))['catch'](handleError(_0x3539ba,null));};exports['getLists']=function(_0x2e026e,_0x258b20,_0x2807a7){var _0x47be17={};var _0x20d3b7={};var _0x219378;var _0x53882a;return db[_0x9ba3('0x48')][_0x9ba3('0x9e')]({'where':{'id':_0x2e026e[_0x9ba3('0x64')]['id']}})['then'](handleEntityNotFound(_0x258b20,null))[_0x9ba3('0x24')](function(_0xa01a35){if(_0xa01a35){_0x219378=_0xa01a35;_0x20d3b7[_0x9ba3('0x4b')]=_[_0x9ba3('0x4e')](db[_0x9ba3('0x123')][_0x9ba3('0x65')]);_0x20d3b7[_0x9ba3('0x4f')]=_[_0x9ba3('0x4e')](_0x2e026e[_0x9ba3('0x4f')]);_0x20d3b7[_0x9ba3('0x58')]=_[_0x9ba3('0x50')](_0x20d3b7[_0x9ba3('0x4b')],_0x20d3b7['query']);_0x47be17[_0x9ba3('0x52')]=_[_0x9ba3('0x50')](_0x20d3b7['model'],qs[_0x9ba3('0x51')](_0x2e026e[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x47be17[_0x9ba3('0x52')]=_0x47be17[_0x9ba3('0x52')]['length']?_0x47be17[_0x9ba3('0x52')]:_0x20d3b7[_0x9ba3('0x4b')];_0x47be17[_0x9ba3('0xcc')]=qs['sort'](_0x2e026e[_0x9ba3('0x4f')]['sort']);_0x47be17[_0x9ba3('0x5c')]=qs[_0x9ba3('0x58')](_[_0x9ba3('0x57')](_0x2e026e['query'],_0x20d3b7[_0x9ba3('0x58')]));if(_0x2e026e[_0x9ba3('0x4f')][_0x9ba3('0x40')]){_0x47be17[_0x9ba3('0x5c')]=_[_0x9ba3('0x59')](_0x47be17[_0x9ba3('0x5c')],{'$or':_[_0x9ba3('0x41')](_0x47be17['attributes'],function(_0x13fd4f){var _0x254135={};_0x254135[_0x13fd4f]={'$like':'%'+_0x2e026e[_0x9ba3('0x4f')][_0x9ba3('0x40')]+'%'};return _0x254135;})});}_0x47be17=_[_0x9ba3('0x59')]({},_0x47be17,_0x2e026e['options']);return _0x219378[_0x9ba3('0x124')](_0x47be17);}})[_0x9ba3('0x24')](function(_0x38ea14){if(_0x38ea14){_0x53882a=_0x38ea14['length'];if(!_0x2e026e[_0x9ba3('0x4f')]['hasOwnProperty'](_0x9ba3('0x55'))){_0x47be17['limit']=qs[_0x9ba3('0x34')](_0x2e026e[_0x9ba3('0x4f')][_0x9ba3('0x34')]);_0x47be17['offset']=qs[_0x9ba3('0x56')](_0x2e026e[_0x9ba3('0x4f')][_0x9ba3('0x56')]);}return _0x219378[_0x9ba3('0x124')](_0x47be17);}})['then'](function(_0x5ccd0e){if(_0x5ccd0e){return _0x5ccd0e?{'count':_0x53882a,'rows':_0x5ccd0e}:null;}})[_0x9ba3('0x24')](respondWithResult(_0x258b20,null))[_0x9ba3('0x62')](handleError(_0x258b20,null));};exports[_0x9ba3('0x125')]=function(_0x266046,_0x147d56,_0x536bf4){var _0x3d002e={};var _0x20d21b={};var _0x3cc433;var _0x17822c;return db['User']['findOne']({'where':{'id':_0x266046[_0x9ba3('0x64')]['id']}})[_0x9ba3('0x24')](handleEntityNotFound(_0x147d56,null))['then'](function(_0x4cb17a){if(_0x4cb17a){_0x3cc433=_0x4cb17a;_0x20d21b['model']=_['keys'](db[_0x9ba3('0x48')]['rawAttributes']);_0x20d21b[_0x9ba3('0x4f')]=_[_0x9ba3('0x4e')](_0x266046[_0x9ba3('0x4f')]);_0x20d21b[_0x9ba3('0x58')]=_[_0x9ba3('0x50')](_0x20d21b[_0x9ba3('0x4b')],_0x20d21b[_0x9ba3('0x4f')]);_0x3d002e['attributes']=_['intersection'](_0x20d21b['model'],qs[_0x9ba3('0x51')](_0x266046[_0x9ba3('0x4f')][_0x9ba3('0x51')]));_0x3d002e[_0x9ba3('0x52')]=_0x3d002e[_0x9ba3('0x52')]['length']?_0x3d002e[_0x9ba3('0x52')]:_0x20d21b[_0x9ba3('0x4b')];_0x3d002e['order']=qs[_0x9ba3('0xc7')](_0x266046[_0x9ba3('0x4f')]['sort']);_0x3d002e[_0x9ba3('0x5c')]=qs[_0x9ba3('0x58')](_[_0x9ba3('0x57')](_0x266046[_0x9ba3('0x4f')],_0x20d21b[_0x9ba3('0x58')]));if(_0x266046[_0x9ba3('0x4f')][_0x9ba3('0x40')]){_0x3d002e['where']=_[_0x9ba3('0x59')](_0x3d002e[_0x9ba3('0x5c')],{'$or':_[_0x9ba3('0x41')](_0x3d002e['attributes'],function(_0x4c2079){var _0x2d2969={};_0x2d2969[_0x4c2079]={'$like':'%'+_0x266046[_0x9ba3('0x4f')][_0x9ba3('0x40')]+'%'};return _0x2d2969;})});}_0x3d002e[_0x9ba3('0x4b')]=db['User'];_0x3d002e['as']='Agents';_0x3d002e=_[_0x9ba3('0x59')]({},_0x3d002e,_0x266046[_0x9ba3('0x5f')]);return _0x3cc433[_0x9ba3('0xec')]({'include':[_0x3d002e]});}})['then'](function(_0x14d49e){if(_0x14d49e){var _0x455a3f={},_0x419f76=[],_0x359810=0x0;for(var _0x2caa8b=0x0;_0x2caa8b<_0x14d49e[_0x9ba3('0x53')];_0x2caa8b+=0x1){for(var _0x45bd5f=0x0,_0x13b532;_0x45bd5f<_0x14d49e[_0x2caa8b]['Agents'][_0x9ba3('0x53')];_0x45bd5f+=0x1){_0x13b532=_0x14d49e[_0x2caa8b][_0x9ba3('0x3c')][_0x45bd5f][_0x9ba3('0xce')]({'plain':!![]});_0x455a3f[_0x13b532['id']]=_0x13b532;}}_0x455a3f=_[_0x9ba3('0x126')](_0x455a3f);for(var _0x5902c8=qs[_0x9ba3('0x56')](_0x266046[_0x9ba3('0x4f')][_0x9ba3('0x56')]);_0x5902c8<_0x455a3f[_0x9ba3('0x53')]&&_0x419f76[_0x9ba3('0x53')]=_0x41ea19){_0x1e759d=_0x41ea19;_0x328846=0xc8;}else{_0x328846=0xce;}_0x3e6846[_0x3e88('0x30')](_0x328846);return _0x3e6846['set'](_0x3e88('0x35'),_0x37be97+'-'+_0x1e759d+'/'+_0x41ea19)['json'](_0x4d54b6);}return null;};}function patchUpdates(_0x462d5b){return function(_0xf5acf4){try{jsonpatch[_0x3e88('0x36')](_0xf5acf4,_0x462d5b,!![]);}catch(_0x263531){return BPromise[_0x3e88('0x37')](_0x263531);}return _0xf5acf4[_0x3e88('0x38')]();};}function saveUpdates(_0x21791b,_0x172628){return function(_0x5c7e5a){if(_0x5c7e5a){return _0x5c7e5a[_0x3e88('0x39')](_0x21791b)[_0x3e88('0x23')](function(_0x573307){return _0x573307;});}return null;};}function removeEntity(_0x20bc0b,_0x1ab49f){return function(_0xe7a292){if(_0xe7a292){return _0xe7a292[_0x3e88('0x3a')]()[_0x3e88('0x23')](function(){var _0x443534=_0xe7a292[_0x3e88('0x3b')]({'plain':!![]});if(_0x443534[_0x3e88('0x3c')]===_0x3e88('0x3d'))return;var _0x1a3506=[{'name':'Users','value':_0x3e88('0x3e'),'ignore':!![]},{'name':'Agents','value':_0x3e88('0x3f'),'ignore':![]},{'name':_0x3e88('0x40'),'value':_0x3e88('0x41'),'ignore':![]}];var _0x489869=_(_0x1a3506)[_0x3e88('0x42')](_0x3e88('0x43'))['map'](_0x3e88('0x44'))[_0x3e88('0x44')]();if(_[_0x3e88('0x45')](_0x489869,_0x443534[_0x3e88('0x3c')])){return;}var _0x530ad8=_[_0x3e88('0x46')](_0x1a3506,[_0x3e88('0x44'),_0x443534[_0x3e88('0x3c')]])[_0x3e88('0x47')];return db[_0x3e88('0x48')]['destroy']({'where':{'type':_0x530ad8,'resourceId':_0x443534['id']}})['then'](function(){return _0xe7a292;});})[_0x3e88('0x23')](function(){_0x20bc0b[_0x3e88('0x30')](0xcc)[_0x3e88('0x31')]();});}};}function handleEntityNotFound(_0x59faf8,_0x37cf81){return function(_0x46fb00){if(!_0x46fb00){_0x59faf8['sendStatus'](0x194);}return _0x46fb00;};}function handleError(_0x3cc89f,_0x42119b){_0x42119b=_0x42119b||0x1f4;return function(_0x3890d2){logger['error'](_0x3890d2['stack']);if(_0x3890d2['name']){delete _0x3890d2['name'];}_0x3cc89f[_0x3e88('0x30')](_0x42119b)[_0x3e88('0x49')](_0x3890d2);};}exports['index']=function(_0x2fe642,_0x105802){var _0x1d2c12={},_0x5d01dc={},_0x44ae3b={'count':0x0,'rows':[]};var _0x216ee3=_[_0x3e88('0x4a')](db[_0x3e88('0x4b')]['rawAttributes'],function(_0x3b71ce){return{'name':_0x3b71ce[_0x3e88('0x4c')],'type':_0x3b71ce[_0x3e88('0x4d')][_0x3e88('0x4e')]};});_0x5d01dc[_0x3e88('0x4f')]=_[_0x3e88('0x50')](_['map'](_0x216ee3,_0x3e88('0x47')),[_0x3e88('0x51'),'salt']);_0x5d01dc[_0x3e88('0x52')]=_[_0x3e88('0x53')](_0x2fe642['query']);_0x5d01dc['filters']=_[_0x3e88('0x54')](_0x5d01dc['model'],_0x5d01dc[_0x3e88('0x52')]);_0x1d2c12[_0x3e88('0x55')]=_[_0x3e88('0x54')](_0x5d01dc[_0x3e88('0x4f')],qs[_0x3e88('0x56')](_0x2fe642[_0x3e88('0x52')]['fields']));_0x1d2c12['attributes']=_0x1d2c12['attributes'][_0x3e88('0x57')]?_0x1d2c12[_0x3e88('0x55')]:_0x5d01dc[_0x3e88('0x4f')];if(!_0x2fe642[_0x3e88('0x52')][_0x3e88('0x58')](_0x3e88('0x59'))){_0x1d2c12[_0x3e88('0x5a')]=qs[_0x3e88('0x5a')](_0x2fe642['query']['limit']);_0x1d2c12[_0x3e88('0x34')]=qs[_0x3e88('0x34')](_0x2fe642['query']['offset']);}_0x1d2c12[_0x3e88('0x5b')]=qs[_0x3e88('0x5c')](_0x2fe642[_0x3e88('0x52')][_0x3e88('0x5c')]);_0x1d2c12[_0x3e88('0x5d')]=qs[_0x3e88('0x5e')](_[_0x3e88('0x5f')](_0x2fe642['query'],_0x5d01dc[_0x3e88('0x5e')]),_0x216ee3);if(_0x2fe642[_0x3e88('0x52')]['filter']){_0x1d2c12['where']=_[_0x3e88('0x60')](_0x1d2c12[_0x3e88('0x5d')],{'$or':_[_0x3e88('0x4a')](_0x216ee3,function(_0x374b4b){if(_0x374b4b['type']!==_0x3e88('0x61')){return db[_0x3e88('0x62')][_0x3e88('0x5d')](db[_0x3e88('0x62')]['fn']('lower',db[_0x3e88('0x62')][_0x3e88('0x63')](_0x374b4b[_0x3e88('0x47')])),{'$like':db['sequelize']['fn'](_0x3e88('0x64'),'%'+_0x2fe642['query']['filter']+'%')});}})});}_0x1d2c12=_[_0x3e88('0x60')]({},_0x1d2c12,_0x2fe642[_0x3e88('0x65')]);var _0x1385f4={'where':_0x1d2c12[_0x3e88('0x5d')]};return db[_0x3e88('0x4b')][_0x3e88('0x33')](_0x1385f4)['then'](function(_0x5b2257){_0x44ae3b[_0x3e88('0x33')]=_0x5b2257;if(_0x2fe642['query'][_0x3e88('0x66')]){_0x1d2c12[_0x3e88('0x67')]=[{'all':!![]}];}return db[_0x3e88('0x4b')][_0x3e88('0x68')](_0x1d2c12);})[_0x3e88('0x23')](function(_0x4c4af0){_0x44ae3b[_0x3e88('0x69')]=_0x4c4af0;return _0x44ae3b;})[_0x3e88('0x23')](respondWithFilteredResult(_0x105802,_0x1d2c12))[_0x3e88('0x2e')](handleError(_0x105802,null));};exports[_0x3e88('0x6a')]=function(_0x16d590,_0x49e14b){var _0x3823fd={'raw':![],'where':{'id':_0x16d590['params']['id']}},_0x3af366={};_0x3af366[_0x3e88('0x4f')]=_['differenceBy'](_[_0x3e88('0x53')](db['User']['rawAttributes']),[_0x3e88('0x51'),_0x3e88('0x6b')]);_0x3af366['query']=_[_0x3e88('0x53')](_0x16d590[_0x3e88('0x52')]);_0x3af366[_0x3e88('0x5e')]=_[_0x3e88('0x54')](_0x3af366[_0x3e88('0x4f')],_0x3af366[_0x3e88('0x52')]);_0x3823fd[_0x3e88('0x55')]=_[_0x3e88('0x54')](_0x3af366[_0x3e88('0x4f')],qs[_0x3e88('0x56')](_0x16d590[_0x3e88('0x52')][_0x3e88('0x56')]));_0x3823fd[_0x3e88('0x55')]=_0x3823fd['attributes'][_0x3e88('0x57')]?_0x3823fd[_0x3e88('0x55')]:_0x3af366[_0x3e88('0x4f')];if(_0x16d590[_0x3e88('0x52')][_0x3e88('0x66')]){_0x3823fd[_0x3e88('0x67')]=[{'all':!![]}];}_0x3823fd=_[_0x3e88('0x60')]({},_0x3823fd,_0x16d590[_0x3e88('0x65')]);return db[_0x3e88('0x4b')][_0x3e88('0x46')](_0x3823fd)[_0x3e88('0x23')](handleEntityNotFound(_0x49e14b,null))[_0x3e88('0x23')](respondWithResult(_0x49e14b,null))[_0x3e88('0x2e')](handleError(_0x49e14b,null));};exports[_0x3e88('0x39')]=function(_0x5e0494,_0x1a843a){if(_0x5e0494[_0x3e88('0x6c')]['id']){delete _0x5e0494[_0x3e88('0x6c')]['id'];}delete _0x5e0494[_0x3e88('0x6c')][_0x3e88('0x3c')];return db[_0x3e88('0x4b')][_0x3e88('0x46')]({'where':{'id':_0x5e0494[_0x3e88('0x6d')]['id']}})[_0x3e88('0x23')](handleEntityNotFound(_0x1a843a,null))[_0x3e88('0x23')](saveUpdates(_0x5e0494['body'],null))[_0x3e88('0x23')](respondWithResult(_0x1a843a,null))[_0x3e88('0x2e')](handleError(_0x1a843a,null));};exports[_0x3e88('0x6e')]=function(_0x4ccc55,_0x4f8ce2){return db[_0x3e88('0x4b')][_0x3e88('0x6e')]()[_0x3e88('0x23')](respondWithResult(_0x4f8ce2,null))[_0x3e88('0x2e')](handleError(_0x4f8ce2,null));};exports[_0x3e88('0x6f')]=function(_0x13ebea,_0x546f74,_0x59a187){return db[_0x3e88('0x4b')][_0x3e88('0x46')]({'where':{'id':_0x13ebea[_0x3e88('0x6d')]['id']}})[_0x3e88('0x23')](handleEntityNotFound(_0x546f74,null))[_0x3e88('0x23')](function(_0x390ec6){if(_0x390ec6){return _0x390ec6['addContacts'](_0x13ebea[_0x3e88('0x6c')][_0x3e88('0x70')],_[_0x3e88('0x71')](_0x13ebea[_0x3e88('0x6c')],[_0x3e88('0x70'),'id'])||{});}})[_0x3e88('0x23')](respondWithResult(_0x546f74,null))[_0x3e88('0x2e')](handleError(_0x546f74,null));};function validateUser(_0x2e4689){return new BPromise(function(_0x197a82,_0x1d83be){if(_0x2e4689[_0x3e88('0x72')])return _0x197a82(_0x2e4689);return db[_0x3e88('0x73')]['findById'](0x1)[_0x3e88('0x23')](function(_0x3d74e2){if(_0x3d74e2[_0x3e88('0x74')])authService[_0x3e88('0x75')](_0x2e4689['password']);db[_0x3e88('0x4b')][_0x3e88('0x76')]('internal')[_0x3e88('0x23')](function(_0x2275d8){if(_[_0x3e88('0x77')](_0x2275d8)){_0x2e4689[_0x3e88('0x72')]=_0x3d74e2[_0x3e88('0x78')]||0x1;return;}if(_[_0x3e88('0x77')](_0x3d74e2['min_internal'])||_0x3d74e2[_0x3e88('0x78')]===_0x2275d8){_0x2e4689[_0x3e88('0x72')]=_0x2275d8+0x1;return;}if(_0x3d74e2[_0x3e88('0x78')]>_0x2275d8){_0x2e4689['internal']=_0x3d74e2['min_internal'];return;}return db[_0x3e88('0x62')]['query'](_0x3e88('0x79'),{'type':db['sequelize'][_0x3e88('0x7a')][_0x3e88('0x7b')]})[_0x3e88('0x23')](function(_0x5e5dc7){if(_0x5e5dc7&&_0x5e5dc7[_0x3e88('0x57')]){for(var _0x4a3db2=0x0,_0xad48a9=_0x5e5dc7[_0x3e88('0x57')];_0x4a3db2<_0xad48a9&&_[_0x3e88('0x77')](_0x2e4689[_0x3e88('0x72')]);_0x4a3db2++){if(_0x3d74e2[_0x3e88('0x78')]<=_0x5e5dc7[_0x4a3db2][_0x3e88('0x7c')]){_0x2e4689[_0x3e88('0x72')]=_0x5e5dc7[_0x4a3db2][_0x3e88('0x7c')];}else if(_0x3d74e2[_0x3e88('0x78')]>_0x5e5dc7[_0x4a3db2][_0x3e88('0x7c')]&&_0x3d74e2['min_internal']<=_0x5e5dc7[_0x4a3db2]['to']){_0x2e4689[_0x3e88('0x72')]=_0x3d74e2[_0x3e88('0x78')];}}}if(_[_0x3e88('0x77')](_0x2e4689['internal'])){_0x2e4689['internal']=_0x2275d8+0x1;}return _0x197a82(_0x2e4689);});});})[_0x3e88('0x2e')](function(_0x379bd9){_0x1d83be(_0x379bd9);});});}function updateUser(_0xa51980){return new BPromise(function(_0x2e1bd1,_0x4f4cef){try{if(_0xa51980[_0x3e88('0x7d')]){_0xa51980[_0x3e88('0x7e')]=_0xa51980['internal'];_0xa51980[_0x3e88('0x7f')]={'mailbox':_0xa51980[_0x3e88('0x72')],'password':_0xa51980[_0x3e88('0x51')],'fullname':_0xa51980['fullname'],'email':_0xa51980['email']};}if(_0xa51980[_0x3e88('0x3c')]===_0x3e88('0x3f')){if(!_0xa51980['permissions'])_0xa51980[_0x3e88('0x80')]=[_0x3e88('0x81'),_0x3e88('0x82'),'103',_0x3e88('0x83'),_0x3e88('0x84'),_0x3e88('0x85'),_0x3e88('0x86'),_0x3e88('0x87'),'107',_0x3e88('0x88'),_0x3e88('0x89'),_0x3e88('0x8a'),'111',_0x3e88('0x8b')];}_0x2e1bd1(_0xa51980);}catch(_0x4abc3d){_0x4f4cef(_0x4abc3d);}});}exports[_0x3e88('0x8c')]=function(_0xf630ec,_0x5a0884){if(_0xf630ec['user'][_0x3e88('0x3c')]==='agent')throw new Error(_0x3e88('0x8d'));if(_0xf630ec[_0x3e88('0x6c')][_0x3e88('0x3c')]===_0x3e88('0x3e')&&_0xf630ec['user']['role']!==_0x3e88('0x3d')){throw new Error(_0x3e88('0x8e'));}if(_0xf630ec['body'][_0x3e88('0x3c')]==='admin'&&_0xf630ec[_0x3e88('0x3e')][_0x3e88('0x3c')]!=='admin'){throw new Error(_0x3e88('0x8f'));}return licenseUtil[_0x3e88('0x90')]([_0xf630ec[_0x3e88('0x6c')]])[_0x3e88('0x23')](function(){return validateUser(_0xf630ec[_0x3e88('0x6c')]);})['then'](function(_0x33234b){return updateUser(_0x33234b)[_0x3e88('0x23')](function(_0x1c8c42){if(_0x1c8c42[_0x3e88('0x3c')]==='admin'){_0x1c8c42[_0x3e88('0x91')]=_0xf630ec[_0x3e88('0x3e')][_0x3e88('0x91')];delete _0x1c8c42['userProfileId'];}return _0x1c8c42;});})[_0x3e88('0x23')](function(_0x1bb4e9){return db[_0x3e88('0x4b')][_0x3e88('0x8c')](_0x1bb4e9,{'include':[{'model':db[_0x3e88('0x7f')],'as':_0x3e88('0x7f')}]});})[_0x3e88('0x23')](function(_0x40d6e3){if(_0xf630ec[_0x3e88('0x6c')][_0x3e88('0x3c')]===_0x3e88('0x3e'))return _0x40d6e3;if(_0xf630ec[_0x3e88('0x3e')][_0x3e88('0x3c')]!==_0x3e88('0x3e'))return _0x40d6e3;return db[_0x3e88('0x92')]['find']({'where':{'name':_0x40d6e3[_0x3e88('0x3c')]==='agent'?'Agents':_0x3e88('0x40'),'userProfileId':_0xf630ec[_0x3e88('0x3e')][_0x3e88('0x93')]},'raw':!![]})[_0x3e88('0x23')](function(_0x46df50){if(!_0x46df50||_0x46df50[_0x3e88('0x94')]!=0x0)return _0x40d6e3;return db['UserProfileResource'][_0x3e88('0x8c')]({'name':_0x40d6e3[_0x3e88('0x47')],'resourceId':_0x40d6e3['id'],'type':_0x46df50['name'],'sectionId':_0x46df50['id']},{})[_0x3e88('0x23')](function(){return _0x40d6e3;});})['catch'](function(_0xb1cb2){logger[_0x3e88('0x29')](_0x3e88('0x95'),_0xb1cb2);throw _0xb1cb2;});})[_0x3e88('0x23')](respondWithResult(_0x5a0884,0xc9))[_0x3e88('0x2e')](handleError(_0x5a0884,null));};exports['bulkCreate']=function(_0x297cd6,_0x5ef34e){var _0x2f08e7=_0x297cd6[_0x3e88('0x6c')];var _0x31de41=[];if(_0x297cd6['user'][_0x3e88('0x3c')]===_0x3e88('0x3f'))throw new Error(_0x3e88('0x8d'));if(_[_0x3e88('0x96')](_0x2f08e7,[_0x3e88('0x3c'),_0x3e88('0x3e')])&&_0x297cd6[_0x3e88('0x3e')][_0x3e88('0x3c')]!==_0x3e88('0x3d')){throw new Error(_0x3e88('0x8e'));}if(_[_0x3e88('0x96')](_0x2f08e7,[_0x3e88('0x3c'),'admin'])&&_0x297cd6[_0x3e88('0x3e')][_0x3e88('0x3c')]!==_0x3e88('0x3d')){throw new Error(_0x3e88('0x97'));}return licenseUtil['checkUserLimits'](_0x2f08e7)[_0x3e88('0x23')](function(){return validateUser(_0x2f08e7[0x0]);})[_0x3e88('0x23')](function(){for(var _0x566059=0x1;_0x566059<_0x2f08e7[_0x3e88('0x57')];_0x566059++){var _0x278422=_0x2f08e7[_0x566059-0x1][_0x3e88('0x72')];if(!_0x2f08e7[_0x566059][_0x3e88('0x72')])_0x2f08e7[_0x566059][_0x3e88('0x72')]=_0x278422+0x1;_0x31de41[_0x3e88('0x98')](validateUser(_0x2f08e7[_0x566059]));}return BPromise[_0x3e88('0x99')](_0x31de41);})[_0x3e88('0x23')](function(){_0x31de41=[];for(var _0x3a876d=0x0;_0x3a876d<_0x2f08e7[_0x3e88('0x57')];_0x3a876d++){_0x31de41[_0x3e88('0x98')](updateUser(_0x2f08e7[_0x3a876d]));}return BPromise[_0x3e88('0x99')](_0x31de41);})[_0x3e88('0x23')](function(){return BPromise[_0x3e88('0x9a')](_0x2f08e7,function(_0x363586){return db[_0x3e88('0x4b')][_0x3e88('0x8c')](_0x363586,{'include':[{'model':db[_0x3e88('0x7f')],'as':_0x3e88('0x7f')}]})[_0x3e88('0x23')](function(_0x2bb6e8){_0x363586['id']=_0x2bb6e8['id'];return _0x363586;});});})[_0x3e88('0x23')](function(_0x11bca2){if(_0x297cd6[_0x3e88('0x6c')][_0x3e88('0x3c')]==='user')return _0x11bca2;if(_0x297cd6[_0x3e88('0x3e')][_0x3e88('0x3c')]!==_0x3e88('0x3e'))return _0x11bca2;var _0x288263=_[_0x3e88('0x96')](_0x11bca2,function(_0x1dbb43){return _0x1dbb43[_0x3e88('0x3c')]===_0x3e88('0x3f')||_0x1dbb43['role']===_0x3e88('0x41');});if(!_0x288263)return _0x11bca2;return db[_0x3e88('0x92')][_0x3e88('0x68')]({'where':{'name':{'$or':['Agents',_0x3e88('0x40')]},'userProfileId':_0x297cd6[_0x3e88('0x3e')][_0x3e88('0x93')]},'raw':!![]})[_0x3e88('0x23')](function(_0x54e0e5){if(_['isEmpty'](_0x54e0e5)||!_[_0x3e88('0x96')](_0x54e0e5,[_0x3e88('0x94'),0x0]))return _0x11bca2;_0x31de41=[];var _0x4ca359=_(_0x54e0e5)['map'](function(_0x2ff2eb){if(_0x2ff2eb[_0x3e88('0x94')]===0x1)return;return _0x2ff2eb['name']===_0x3e88('0x9b')?_0x3e88('0x3f'):_0x3e88('0x41');})[_0x3e88('0x9c')]()[_0x3e88('0x44')]();for(var _0x25791b=0x0;_0x25791b<_0x11bca2['length'];_0x25791b++){if(!_[_0x3e88('0x45')](_0x4ca359,_0x11bca2[_0x25791b][_0x3e88('0x3c')]))return;var _0x49f830=_0x11bca2[_0x25791b][_0x3e88('0x3c')]===_0x3e88('0x3f')?'Agents':_0x3e88('0x40');_0x31de41[_0x3e88('0x98')](db[_0x3e88('0x48')][_0x3e88('0x8c')]({'name':_0x11bca2[_0x25791b][_0x3e88('0x47')],'resourceId':_0x11bca2[_0x25791b]['id'],'type':_0x49f830,'sectionId':_[_0x3e88('0x46')](_0x54e0e5,['name',_0x49f830])['id']},{}));}return BPromise[_0x3e88('0x99')](_0x31de41);})[_0x3e88('0x23')](respondWithResult(_0x5ef34e,0xc9))[_0x3e88('0x2e')](handleError(_0x5ef34e,null));});};exports[_0x3e88('0x9d')]=function(_0x126d6e,_0x3a40ec,_0x4a871b){if(_0x126d6e[_0x3e88('0x6c')]['id']){delete _0x126d6e[_0x3e88('0x6c')]['id'];}return db[_0x3e88('0x4b')][_0x3e88('0x46')]({'where':{'id':_0x126d6e[_0x3e88('0x6d')]['id']}})[_0x3e88('0x23')](function(_0x29f53b){if(!_0x29f53b)return null;if(_0x29f53b['id']===_0x126d6e[_0x3e88('0x3e')]['id']){if(!_0x126d6e[_0x3e88('0x6c')][_0x3e88('0x9e')]||!_0x126d6e[_0x3e88('0x6c')][_0x3e88('0x9f')]){throw new db[(_0x3e88('0xa0'))][(_0x3e88('0xa1'))](_0x3e88('0xa2'));}if(!_0x29f53b[_0x3e88('0xa3')](_0x126d6e[_0x3e88('0x6c')]['oldPassword'])){throw new db['Sequelize']['ValidationError'](_0x3e88('0xa4'));}if(_0x126d6e[_0x3e88('0x6c')][_0x3e88('0x9e')]===_0x126d6e['body']['newPassword']){throw new db[(_0x3e88('0xa0'))][(_0x3e88('0xa1'))](_0x3e88('0xa5'));}}else if(_0x126d6e['user']['role']==='admin'){if(!_0x126d6e[_0x3e88('0x6c')]['newPassword']){throw new db['Sequelize'][(_0x3e88('0xa1'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x126d6e[_0x3e88('0x3e')][_0x3e88('0x3c')]===_0x3e88('0x3e')){if(!_0x126d6e[_0x3e88('0x6c')][_0x3e88('0x9f')]){throw new db[(_0x3e88('0xa0'))][(_0x3e88('0xa1'))](_0x3e88('0xa6'));}if(_0x29f53b[_0x3e88('0x3c')]!==_0x3e88('0x3f')){throw new db[(_0x3e88('0xa0'))][(_0x3e88('0xa1'))]('Unauthorized');}}else{throw new db[(_0x3e88('0xa0'))][(_0x3e88('0xa1'))](_0x3e88('0x8d'));}return _0x29f53b;})[_0x3e88('0x23')](handleEntityNotFound(_0x3a40ec,null))[_0x3e88('0x23')](function(_0x61a3fc){return db[_0x3e88('0x73')][_0x3e88('0xa7')]({'attributes':['id',_0x3e88('0x74'),_0x3e88('0xa8'),_0x3e88('0xa9')]})[_0x3e88('0x23')](function(_0x5e4dd8){if(_0x5e4dd8[_0x3e88('0x74')])authService[_0x3e88('0x75')](_0x126d6e[_0x3e88('0x6c')][_0x3e88('0x9f')]);if(!_0x5e4dd8['enforcePasswordHistory']||!_0x61a3fc[_0x3e88('0xaa')])return _0x61a3fc;authService[_0x3e88('0xab')](_0x126d6e[_0x3e88('0x6c')]['newPassword'],_0x61a3fc['previousPasswords'],_0x5e4dd8[_0x3e88('0xa9')]);return _0x61a3fc;})['then'](saveUpdates({'password':_0x126d6e['body'][_0x3e88('0x9f')],'passwordResetAt':_0x126d6e['user']['id']==_0x126d6e['params']['id']?moment():null,'previousPasswords':authService[_0x3e88('0xac')](_0x126d6e[_0x3e88('0x6c')][_0x3e88('0x9f')],_0x61a3fc[_0x3e88('0xaa')])},null));})[_0x3e88('0x23')](respondWithResult(_0x3a40ec,null))[_0x3e88('0x2e')](handleError(_0x3a40ec,null));};exports[_0x3e88('0xad')]=function(_0x6365b5,_0x2617d4,_0x1128b5){var _0x280d14=_0x6365b5['body']['channel'];return db['User'][_0x3e88('0x46')]({'where':{'id':_0x6365b5[_0x3e88('0x6d')]['id']},'attributes':['id','name',_0x3e88('0x3c'),_0x3e88('0xae'),'loginInPause',_0x3e88('0xaf'),_0x3e88('0xb0')]})[_0x3e88('0x23')](handleEntityNotFound(_0x2617d4,null))[_0x3e88('0x23')](function(_0x54bc83){if(_0x54bc83){if(!utils[_0x3e88('0xb1')](_0x280d14)){throw new db[(_0x3e88('0xa0'))][(_0x3e88('0xa1'))](_0x3e88('0xb2'));}return _0x54bc83['add'+_[_0x3e88('0xb3')](_0x280d14[_0x3e88('0xb4')]())+'Queues'](_0x6365b5[_0x3e88('0x6c')][_0x3e88('0x70')],{'penalty':_0x6365b5['body'][_0x3e88('0xb5')]||0x0})['spread'](function(_0x33a7fb){for(var _0x4ea2ef=0x0;_0x4ea2ef<_0x6365b5[_0x3e88('0x6c')][_0x3e88('0x70')][_0x3e88('0x57')];_0x4ea2ef+=0x1){var _0x51e439={'UserId':_0x6365b5[_0x3e88('0x6d')]['id']};_0x51e439[_[_0x3e88('0xb3')](_0x280d14[_0x3e88('0xb4')]())+_0x3e88('0xb6')]=_0x6365b5['body'][_0x3e88('0x70')][_0x4ea2ef];socket[_0x3e88('0xb7')](_0x3e88('0x3e')+_[_0x3e88('0xb3')](_0x280d14[_0x3e88('0xb4')]())+'Queue:save',_0x51e439);}return _0x33a7fb;})['then'](function(){if(_0x280d14==='voice'){return db[_0x3e88('0xb8')][_0x3e88('0x68')]({'where':{'id':_0x6365b5[_0x3e88('0x6c')]['ids']||[]},'raw':!![],'attributes':['id','name']});}})[_0x3e88('0x23')](function(_0xe85dea){var _0x2f1c48=_0x54bc83[_0x3e88('0x3b')]({'plain':!![]});var _0x1d3f12=[];if(_0x280d14===_0x3e88('0xb9')&&_0x2f1c48[_0x3e88('0x3c')]===_0x3e88('0x3f')&&_0x2f1c48['online']){for(var _0x5361ea=0x0;_0x5361ea<_0xe85dea[_0x3e88('0x57')];_0x5361ea+=0x1){_0x1d3f12[_0x3e88('0x98')]({'membername':_0x2f1c48['name'],'UserId':_0x2f1c48['id'],'queue_name':_0xe85dea[_0x5361ea][_0x3e88('0x47')],'VoiceQueueId':_0xe85dea[_0x5361ea]['id'],'interface':_['isNil'](_0x2f1c48['interface'])?util[_0x3e88('0xba')](_0x3e88('0xbb'),_0x2f1c48[_0x3e88('0x47')]):_0x2f1c48[_0x3e88('0xb0')],'paused':_0x2f1c48[_0x3e88('0xaf')]||![],'penalty':_0x6365b5[_0x3e88('0x6c')][_0x3e88('0xb5')]||0x0});}return BPromise[_0x3e88('0x9a')](_0x1d3f12,function(_0x14831b){return db[_0x3e88('0xbc')]['upsert'](_0x14831b);});}return _0x54bc83;});}})[_0x3e88('0x23')](respondWithStatusCode(_0x2617d4,null))[_0x3e88('0x2e')](handleError(_0x2617d4,null));};exports[_0x3e88('0xbd')]=function(_0x248bfe,_0x53b23e,_0x525bd8){var _0x515226;return db['User'][_0x3e88('0x46')]({'where':{'id':_0x248bfe[_0x3e88('0x6d')]['id']},'attributes':['id','name',_0x3e88('0x3c')]})['then'](handleEntityNotFound(_0x53b23e,null))['then'](function(_0x6175b9){if(_0x6175b9){_0x515226=_0x6175b9;if(!_0x248bfe['query'][_0x3e88('0xbe')]||!utils[_0x3e88('0xb1')](_0x248bfe[_0x3e88('0x52')][_0x3e88('0xbe')])){throw new db[(_0x3e88('0xa0'))][(_0x3e88('0xa1'))](_0x3e88('0xb2'));}return _0x6175b9[_0x3e88('0xbf')+_[_0x3e88('0xb3')](_0x248bfe[_0x3e88('0x52')][_0x3e88('0xbe')][_0x3e88('0xb4')]())+'Queues'](_0x248bfe[_0x3e88('0x52')][_0x3e88('0x70')]);}})['then'](function(_0x22215f){for(var _0x2b21d3=0x0;_0x2b21d3<_0x248bfe[_0x3e88('0x52')][_0x3e88('0x70')]['length'];_0x2b21d3+=0x1){var _0x305964={'UserId':_0x248bfe[_0x3e88('0x6d')]['id']};_0x305964[_[_0x3e88('0xb3')](_0x248bfe[_0x3e88('0x52')][_0x3e88('0xbe')][_0x3e88('0xb4')]())+_0x3e88('0xb6')]=_0x248bfe['query'][_0x3e88('0x70')][_0x2b21d3];socket[_0x3e88('0xb7')](_0x3e88('0x3e')+_[_0x3e88('0xb3')](_0x248bfe['query'][_0x3e88('0xbe')][_0x3e88('0xb4')]())+'Queue:remove',_0x305964);}return _0x22215f;})['then'](function(){if(_0x248bfe['query'][_0x3e88('0xbe')]===_0x3e88('0xb9')){return db['UserVoiceQueueRt'][_0x3e88('0x3a')]({'where':{'UserId':_0x248bfe[_0x3e88('0x6d')]['id'],'VoiceQueueId':_0x248bfe[_0x3e88('0x52')][_0x3e88('0x70')]},'individualHooks':!![]})['then'](function(){return _0x515226;});}return _0x515226;})[_0x3e88('0x23')](respondWithStatusCode(_0x53b23e,null))[_0x3e88('0x2e')](handleError(_0x53b23e,null));};exports['addAvatar']=function(_0x4c697b,_0x37b8a6,_0x368324){_0x4c697b[_0x3e88('0x6c')][_0x3e88('0xc0')]=_0x4c697b['file']['filename'];return db[_0x3e88('0x4b')][_0x3e88('0x46')]({'where':{'id':_0x4c697b[_0x3e88('0x6d')]['id']}})[_0x3e88('0x23')](handleEntityNotFound(_0x37b8a6,null))['then'](saveUpdates(_0x4c697b[_0x3e88('0x6c')],null))[_0x3e88('0x23')](respondWithResult(_0x37b8a6,null))[_0x3e88('0x2e')](handleError(_0x37b8a6,null));};exports[_0x3e88('0xc1')]=function(_0x24956e,_0x4bc882,_0x140dcb){var _0x4e1d2a=path[_0x3e88('0xc2')](config[_0x3e88('0xc3')],'server/files/images/logos/default_profile.png');return db[_0x3e88('0x4b')][_0x3e88('0x46')]({'where':{'id':_0x24956e[_0x3e88('0x6d')]['id']},'attributes':['id',_0x3e88('0xc0')],'raw':!![]})[_0x3e88('0x23')](handleEntityNotFound(_0x4bc882,null))[_0x3e88('0x23')](function(_0x5dc2dd){if(_0x5dc2dd){if(_['isNil'](_0x5dc2dd[_0x3e88('0xc0')])){return _0x4bc882[_0x3e88('0xc4')](_0x4e1d2a);}else{if(!fs[_0x3e88('0xc5')](path[_0x3e88('0xc2')](config[_0x3e88('0xc3')],_0x3e88('0xc6'),_0x5dc2dd[_0x3e88('0xc0')]))){return _0x4bc882[_0x3e88('0xc4')](_0x4e1d2a);}return _0x4bc882['download'](path['join'](config[_0x3e88('0xc3')],'server/files/images/',_0x5dc2dd['userpic']));}}})[_0x3e88('0x2e')](handleError(_0x4bc882,null));};exports['getContacts']=function(_0x255893,_0x472355,_0x46eb97){var _0xd00833={};var _0x27a0d5={};var _0x520c55;var _0x96589e;return db[_0x3e88('0x4b')]['findOne']({'where':{'id':_0x255893[_0x3e88('0x6d')]['id']}})[_0x3e88('0x23')](handleEntityNotFound(_0x472355,null))['then'](function(_0x3632fc){if(_0x3632fc){_0x520c55=_0x3632fc;_0x27a0d5[_0x3e88('0x4f')]=_[_0x3e88('0x53')](db[_0x3e88('0xc7')]['rawAttributes']);_0x27a0d5[_0x3e88('0x52')]=_[_0x3e88('0x53')](_0x255893[_0x3e88('0x52')]);_0x27a0d5[_0x3e88('0x5e')]=_['intersection'](_0x27a0d5['model'],_0x27a0d5[_0x3e88('0x52')]);_0xd00833['attributes']=_['intersection'](_0x27a0d5[_0x3e88('0x4f')],qs[_0x3e88('0x56')](_0x255893[_0x3e88('0x52')][_0x3e88('0x56')]));_0xd00833[_0x3e88('0x55')]=_0xd00833['attributes']['length']?_0xd00833[_0x3e88('0x55')]:_0x27a0d5[_0x3e88('0x4f')];_0xd00833[_0x3e88('0x5b')]=qs[_0x3e88('0x5c')](_0x255893[_0x3e88('0x52')][_0x3e88('0x5c')]);_0xd00833[_0x3e88('0x5d')]=qs[_0x3e88('0x5e')](_[_0x3e88('0x5f')](_0x255893['query'],_0x27a0d5['filters']));if(_0x255893['query'][_0x3e88('0x42')]){_0xd00833[_0x3e88('0x5d')]=_[_0x3e88('0x60')](_0xd00833[_0x3e88('0x5d')],{'$or':_['map'](_0xd00833[_0x3e88('0x55')],function(_0x5addd3){var _0x4fa9f6={};_0x4fa9f6[_0x5addd3]={'$like':'%'+_0x255893['query']['filter']+'%'};return _0x4fa9f6;})});}_0xd00833=_[_0x3e88('0x60')]({},_0xd00833,_0x255893['options']);return _0x520c55[_0x3e88('0xc8')](_0xd00833);}})[_0x3e88('0x23')](function(_0x4bf977){if(_0x4bf977){_0x96589e=_0x4bf977[_0x3e88('0x57')];if(_0x255893[_0x3e88('0x52')][_0x3e88('0x58')]('includeAll')){_0xd00833[_0x3e88('0x67')]=[{'model':db[_0x3e88('0xc9')],'as':'List','required':![]},{'model':db[_0x3e88('0xca')],'as':'Tags','attributes':['id',_0x3e88('0x47'),_0x3e88('0xcb')],'where':_0x255893[_0x3e88('0x52')][_0x3e88('0xcc')]?{'id':_0x255893[_0x3e88('0x52')][_0x3e88('0xcc')]}:undefined,'required':_0x255893[_0x3e88('0x52')][_0x3e88('0xcc')]?!![]:![]}];}if(!_0x255893[_0x3e88('0x52')][_0x3e88('0x58')](_0x3e88('0x59'))){_0xd00833[_0x3e88('0x5a')]=qs['limit'](_0x255893['query']['limit']);_0xd00833[_0x3e88('0x34')]=qs[_0x3e88('0x34')](_0x255893[_0x3e88('0x52')][_0x3e88('0x34')]);}return _0x520c55[_0x3e88('0xc8')](_0xd00833);}})[_0x3e88('0x23')](function(_0x2a1710){if(_0x2a1710){return _0x2a1710?{'count':_0x96589e,'rows':_0x2a1710}:null;}})[_0x3e88('0x23')](respondWithResult(_0x472355,null))[_0x3e88('0x2e')](handleError(_0x472355,null));};exports['getQueues']=function(_0x441c65,_0x3a2908,_0x1534e2){var _0x5dcad4;var _0x4d87c7;var _0x1a1ccf={};var _0x24aa86;return db[_0x3e88('0x4b')][_0x3e88('0xa7')]({'where':{'id':_0x441c65[_0x3e88('0x6d')]['id']},'attributes':['id',_0x3e88('0x47'),'role']})[_0x3e88('0x23')](handleEntityNotFound(_0x3a2908,null))[_0x3e88('0x23')](function(_0xc3b418){if(!utils[_0x3e88('0xb1')](_0x441c65[_0x3e88('0x52')][_0x3e88('0xbe')])){throw new db[(_0x3e88('0xa0'))][(_0x3e88('0xa1'))](_0x3e88('0xb2'));}_0x5dcad4=_0xc3b418;var _0x139518={};_0x139518[_0x3e88('0x4f')]=_[_0x3e88('0x53')](db[_[_0x3e88('0xb3')](_0x441c65[_0x3e88('0x52')]['channel'])+_0x3e88('0xcd')][_0x3e88('0xce')]);_0x139518[_0x3e88('0x52')]=_[_0x3e88('0x53')](_0x441c65['query']);_0x139518[_0x3e88('0x5e')]=_['intersection'](_0x139518[_0x3e88('0x4f')],_0x139518[_0x3e88('0x52')]);_0x1a1ccf[_0x3e88('0x55')]=_['intersection'](_0x139518['model'],qs[_0x3e88('0x56')](_0x441c65[_0x3e88('0x52')][_0x3e88('0x56')]));_0x1a1ccf[_0x3e88('0x55')]=_0x1a1ccf[_0x3e88('0x55')][_0x3e88('0x57')]?_0x1a1ccf[_0x3e88('0x55')]:_0x139518[_0x3e88('0x4f')];_0x1a1ccf['order']=qs[_0x3e88('0x5c')](_0x441c65[_0x3e88('0x52')][_0x3e88('0x5c')]);_0x1a1ccf[_0x3e88('0x5d')]=qs[_0x3e88('0x5e')](_['pick'](_0x441c65['query'],_0x139518[_0x3e88('0x5e')]));if(_0x441c65['query']['filter']){_0x1a1ccf[_0x3e88('0x5d')]=_[_0x3e88('0x60')](_0x1a1ccf[_0x3e88('0x5d')],{'$or':_['map'](_0x1a1ccf[_0x3e88('0x55')],function(_0x31c77e){var _0x227ffe={};_0x227ffe[_0x31c77e]={'$like':'%'+_0x441c65[_0x3e88('0x52')][_0x3e88('0x42')]+'%'};return _0x227ffe;})});}_0x1a1ccf=_['merge']({},_0x1a1ccf,_0x441c65[_0x3e88('0x65')]);switch(_0x5dcad4[_0x3e88('0x3c')]){case _0x3e88('0x3d'):return db[_[_0x3e88('0xb3')](_0x441c65[_0x3e88('0x52')]['channel'])+_0x3e88('0xcd')]['findAll'](_0x1a1ccf);case _0x3e88('0x3e'):case _0x3e88('0x3f'):return _0x5dcad4[_0x3e88('0x3b')+_['capitalize'](_0x441c65[_0x3e88('0x52')][_0x3e88('0xbe')])+_0x3e88('0xcf')](_0x1a1ccf);default:throw new db[(_0x3e88('0xa0'))][(_0x3e88('0xa1'))](_0x3e88('0xd0'));}})[_0x3e88('0x23')](function(_0x593170){_0x24aa86=_0x593170[_0x3e88('0x57')];if(!_0x441c65[_0x3e88('0x52')][_0x3e88('0x58')](_0x3e88('0x59'))){_0x1a1ccf['limit']=qs[_0x3e88('0x5a')](_0x441c65[_0x3e88('0x52')]['limit']);_0x1a1ccf['offset']=qs[_0x3e88('0x34')](_0x441c65[_0x3e88('0x52')][_0x3e88('0x34')]);}switch(_0x5dcad4[_0x3e88('0x3c')]){case _0x3e88('0x3d'):return db[_[_0x3e88('0xb3')](_0x441c65[_0x3e88('0x52')][_0x3e88('0xbe')])+_0x3e88('0xcd')][_0x3e88('0x68')](_0x1a1ccf);case'user':case'agent':return _0x5dcad4[_0x3e88('0x3b')+_[_0x3e88('0xb3')](_0x441c65[_0x3e88('0x52')][_0x3e88('0xbe')])+'Queues'](_0x1a1ccf);}})[_0x3e88('0x23')](function(_0xe75878){return{'count':_0x24aa86,'rows':_0xe75878};})[_0x3e88('0x23')](respondWithResult(_0x3a2908,null))[_0x3e88('0x2e')](handleError(_0x3a2908,null));};exports[_0x3e88('0xd1')]=function(_0x43000b,_0x586cd4,_0x27a468){var _0x5e5ba3={};var _0x483a31={};var _0x65f14b;var _0x1b7e5e;return db[_0x3e88('0x4b')][_0x3e88('0xa7')]({'where':{'id':_0x43000b[_0x3e88('0x6d')]['id']}})[_0x3e88('0x23')](handleEntityNotFound(_0x586cd4,null))[_0x3e88('0x23')](function(_0x57e95d){if(_0x57e95d){_0x65f14b=_0x57e95d;_0x483a31[_0x3e88('0x4f')]=_['keys'](db[_0x3e88('0xbc')][_0x3e88('0xce')]);_0x483a31[_0x3e88('0x52')]=_['keys'](_0x43000b[_0x3e88('0x52')]);_0x483a31[_0x3e88('0x5e')]=_['intersection'](_0x483a31['model'],_0x483a31[_0x3e88('0x52')]);_0x5e5ba3[_0x3e88('0x55')]=_[_0x3e88('0x54')](_0x483a31[_0x3e88('0x4f')],qs[_0x3e88('0x56')](_0x43000b[_0x3e88('0x52')][_0x3e88('0x56')]));_0x5e5ba3[_0x3e88('0x55')]=_0x5e5ba3[_0x3e88('0x55')]['length']?_0x5e5ba3[_0x3e88('0x55')]:_0x483a31[_0x3e88('0x4f')];_0x5e5ba3[_0x3e88('0x5b')]=qs['sort'](_0x43000b[_0x3e88('0x52')][_0x3e88('0x5c')]);_0x5e5ba3[_0x3e88('0x5d')]=qs[_0x3e88('0x5e')](_['pick'](_0x43000b[_0x3e88('0x52')],_0x483a31[_0x3e88('0x5e')]));if(_0x43000b[_0x3e88('0x52')][_0x3e88('0x42')]){_0x5e5ba3[_0x3e88('0x5d')]=_[_0x3e88('0x60')](_0x5e5ba3[_0x3e88('0x5d')],{'$or':_[_0x3e88('0x4a')](_0x5e5ba3['attributes'],function(_0x47af3e){var _0x2cfe49={};_0x2cfe49[_0x47af3e]={'$like':'%'+_0x43000b[_0x3e88('0x52')]['filter']+'%'};return _0x2cfe49;})});}_0x5e5ba3=_['merge']({},_0x5e5ba3,_0x43000b[_0x3e88('0x65')]);return _0x65f14b['getVoiceQueuesRt'](_0x5e5ba3);}})[_0x3e88('0x23')](function(_0x38c472){if(_0x38c472){_0x1b7e5e=_0x38c472['length'];if(!_0x43000b[_0x3e88('0x52')][_0x3e88('0x58')](_0x3e88('0x59'))){_0x5e5ba3[_0x3e88('0x5a')]=qs['limit'](_0x43000b[_0x3e88('0x52')][_0x3e88('0x5a')]);_0x5e5ba3[_0x3e88('0x34')]=qs[_0x3e88('0x34')](_0x43000b[_0x3e88('0x52')][_0x3e88('0x34')]);}return _0x65f14b[_0x3e88('0xd1')](_0x5e5ba3);}})[_0x3e88('0x23')](function(_0x5cff59){if(_0x5cff59){return _0x5cff59?{'count':_0x1b7e5e,'rows':_0x5cff59}:null;}})['then'](respondWithResult(_0x586cd4,null))[_0x3e88('0x2e')](handleError(_0x586cd4,null));};exports['getGroups']=function(_0x5dbed7,_0xdfd459,_0xb83da1){var _0x40853e={};var _0x16606a={};var _0x57a832;var _0x30d13b;return db[_0x3e88('0x4b')][_0x3e88('0xa7')]({'where':{'id':_0x5dbed7['params']['id']}})[_0x3e88('0x23')](handleEntityNotFound(_0xdfd459,null))[_0x3e88('0x23')](function(_0x2998c3){if(_0x2998c3){_0x57a832=_0x2998c3;_0x16606a[_0x3e88('0x4f')]=_['keys'](db[_0x3e88('0xd2')]['rawAttributes']);_0x16606a[_0x3e88('0x52')]=_[_0x3e88('0x53')](_0x5dbed7[_0x3e88('0x52')]);_0x16606a['filters']=_['intersection'](_0x16606a['model'],_0x16606a['query']);_0x40853e['attributes']=_['intersection'](_0x16606a[_0x3e88('0x4f')],qs[_0x3e88('0x56')](_0x5dbed7[_0x3e88('0x52')][_0x3e88('0x56')]));_0x40853e[_0x3e88('0x55')]=_0x40853e[_0x3e88('0x55')][_0x3e88('0x57')]?_0x40853e[_0x3e88('0x55')]:_0x16606a[_0x3e88('0x4f')];_0x40853e[_0x3e88('0x5b')]=qs[_0x3e88('0x5c')](_0x5dbed7['query']['sort']);_0x40853e['where']=qs[_0x3e88('0x5e')](_['pick'](_0x5dbed7[_0x3e88('0x52')],_0x16606a[_0x3e88('0x5e')]));if(_0x5dbed7[_0x3e88('0x52')][_0x3e88('0x42')]){_0x40853e['where']=_[_0x3e88('0x60')](_0x40853e['where'],{'$or':_['map'](_0x40853e[_0x3e88('0x55')],function(_0x14d178){var _0x21abf4={};_0x21abf4[_0x14d178]={'$like':'%'+_0x5dbed7[_0x3e88('0x52')][_0x3e88('0x42')]+'%'};return _0x21abf4;})});}_0x40853e=_[_0x3e88('0x60')]({},_0x40853e,_0x5dbed7[_0x3e88('0x65')]);return _0x57a832[_0x3e88('0xd3')](_0x40853e);}})['then'](function(_0x3eef59){if(_0x3eef59){_0x30d13b=_0x3eef59['length'];if(!_0x5dbed7['query'][_0x3e88('0x58')]('nolimit')){_0x40853e[_0x3e88('0x5a')]=qs[_0x3e88('0x5a')](_0x5dbed7[_0x3e88('0x52')][_0x3e88('0x5a')]);_0x40853e[_0x3e88('0x34')]=qs[_0x3e88('0x34')](_0x5dbed7[_0x3e88('0x52')]['offset']);}return _0x57a832['getGroups'](_0x40853e);}})['then'](function(_0x4f4b82){if(_0x4f4b82){return _0x4f4b82?{'count':_0x30d13b,'rows':_0x4f4b82}:null;}})[_0x3e88('0x23')](respondWithResult(_0xdfd459,null))['catch'](handleError(_0xdfd459,null));};exports[_0x3e88('0xd4')]=function(_0x1ddb61,_0x2bcadc,_0x11f180){var _0x3452d3={'raw':!![],'where':{}};var _0x41cdc4={};var _0x5bfd3f={'count':0x0,'rows':[]};return db['User'][_0x3e88('0xa7')]({'where':{'id':_0x1ddb61['params']['id']}})[_0x3e88('0x23')](handleEntityNotFound(_0x2bcadc,null))[_0x3e88('0x23')](function(_0x53d30a){if(_0x53d30a){_0x41cdc4['model']=_[_0x3e88('0x53')](db[_0x3e88('0xd5')][_0x3e88('0xce')]);_0x41cdc4[_0x3e88('0x52')]=_[_0x3e88('0x53')](_0x1ddb61[_0x3e88('0x52')]);_0x41cdc4[_0x3e88('0x5e')]=_[_0x3e88('0x54')](_0x41cdc4[_0x3e88('0x4f')],_0x41cdc4[_0x3e88('0x52')]);_0x3452d3[_0x3e88('0x55')]=_[_0x3e88('0x54')](_0x41cdc4[_0x3e88('0x4f')],qs['fields'](_0x1ddb61[_0x3e88('0x52')][_0x3e88('0x56')]));_0x3452d3[_0x3e88('0x55')]=_0x3452d3['attributes']['length']?_0x3452d3[_0x3e88('0x55')]:_0x41cdc4['model'];if(!_0x1ddb61['query'][_0x3e88('0x58')](_0x3e88('0x59'))){_0x3452d3[_0x3e88('0x5a')]=qs[_0x3e88('0x5a')](_0x1ddb61['query']['limit']);_0x3452d3[_0x3e88('0x34')]=qs[_0x3e88('0x34')](_0x1ddb61[_0x3e88('0x52')][_0x3e88('0x34')]);}_0x3452d3[_0x3e88('0x5b')]=qs['sort'](_0x1ddb61[_0x3e88('0x52')][_0x3e88('0x5c')]);_0x3452d3['where']=qs[_0x3e88('0x5e')](_[_0x3e88('0x5f')](_0x1ddb61['query'],_0x41cdc4['filters']));_0x3452d3['where'][_0x3e88('0xd6')]=_0x53d30a['id'];if(_0x1ddb61[_0x3e88('0x52')][_0x3e88('0x42')]){_0x3452d3[_0x3e88('0x5d')]=_[_0x3e88('0x60')](_0x3452d3[_0x3e88('0x5d')],{'$or':_[_0x3e88('0x4a')](_0x3452d3['attributes'],function(_0x41cadd){var _0x16c8db={};_0x16c8db[_0x41cadd]={'$like':'%'+_0x1ddb61[_0x3e88('0x52')][_0x3e88('0x42')]+'%'};return _0x16c8db;})});}_0x3452d3=_['merge']({},_0x3452d3,_0x1ddb61[_0x3e88('0x65')]);return db[_0x3e88('0xd5')][_0x3e88('0x33')]({'where':_0x3452d3[_0x3e88('0x5d')]})[_0x3e88('0x23')](function(_0x29ced8){_0x5bfd3f[_0x3e88('0x33')]=_0x29ced8;if(_0x1ddb61[_0x3e88('0x52')]['includeAll']){_0x3452d3[_0x3e88('0x67')]=[{'all':!![]}];}return db[_0x3e88('0xd5')][_0x3e88('0x68')](_0x3452d3);})[_0x3e88('0x23')](function(_0x14d4ef){_0x5bfd3f['rows']=_0x14d4ef;return _0x5bfd3f;});}})[_0x3e88('0x23')](respondWithFilteredResult(_0x2bcadc,_0x3452d3))[_0x3e88('0x2e')](handleError(_0x2bcadc,null));};exports[_0x3e88('0xd7')]=function(_0x4489b3,_0x1b3a16,_0x241265){var _0x589a9e={'raw':!![],'where':{}};var _0x30e693={};var _0x53410d={'count':0x0,'rows':[]};return db[_0x3e88('0x4b')][_0x3e88('0xa7')]({'where':{'id':_0x4489b3['params']['id']}})[_0x3e88('0x23')](handleEntityNotFound(_0x1b3a16,null))[_0x3e88('0x23')](function(_0x158668){if(_0x158668){_0x30e693[_0x3e88('0x4f')]=_[_0x3e88('0x53')](db['ScreenRecording']['rawAttributes']);_0x30e693[_0x3e88('0x52')]=_[_0x3e88('0x53')](_0x4489b3[_0x3e88('0x52')]);_0x30e693[_0x3e88('0x5e')]=_[_0x3e88('0x54')](_0x30e693[_0x3e88('0x4f')],_0x30e693['query']);_0x589a9e[_0x3e88('0x55')]=_[_0x3e88('0x54')](_0x30e693[_0x3e88('0x4f')],qs['fields'](_0x4489b3[_0x3e88('0x52')][_0x3e88('0x56')]));_0x589a9e[_0x3e88('0x55')]=_0x589a9e['attributes']['length']?_0x589a9e[_0x3e88('0x55')]:_0x30e693[_0x3e88('0x4f')];if(!_0x4489b3[_0x3e88('0x52')]['hasOwnProperty']('nolimit')){_0x589a9e[_0x3e88('0x5a')]=qs[_0x3e88('0x5a')](_0x4489b3[_0x3e88('0x52')][_0x3e88('0x5a')]);_0x589a9e[_0x3e88('0x34')]=qs[_0x3e88('0x34')](_0x4489b3[_0x3e88('0x52')][_0x3e88('0x34')]);}_0x589a9e[_0x3e88('0x5b')]=qs[_0x3e88('0x5c')](_0x4489b3[_0x3e88('0x52')][_0x3e88('0x5c')]);_0x589a9e[_0x3e88('0x5d')]=qs[_0x3e88('0x5e')](_[_0x3e88('0x5f')](_0x4489b3[_0x3e88('0x52')],_0x30e693[_0x3e88('0x5e')]));_0x589a9e[_0x3e88('0x5d')][_0x3e88('0xd6')]=_0x158668['id'];if(_0x4489b3['query'][_0x3e88('0x42')]){_0x589a9e[_0x3e88('0x5d')]=_['merge'](_0x589a9e[_0x3e88('0x5d')],{'$or':_['map'](_0x589a9e[_0x3e88('0x55')],function(_0x1d87b8){var _0x3a4e22={};_0x3a4e22[_0x1d87b8]={'$like':'%'+_0x4489b3[_0x3e88('0x52')][_0x3e88('0x42')]+'%'};return _0x3a4e22;})});}_0x589a9e=_['merge']({},_0x589a9e,_0x4489b3[_0x3e88('0x65')]);return db[_0x3e88('0xd8')][_0x3e88('0x33')]({'where':_0x589a9e[_0x3e88('0x5d')]})['then'](function(_0x264e23){_0x53410d[_0x3e88('0x33')]=_0x264e23;if(_0x4489b3['query']['includeAll']){_0x589a9e[_0x3e88('0x67')]=[{'all':!![]}];}return db[_0x3e88('0xd8')][_0x3e88('0x68')](_0x589a9e);})[_0x3e88('0x23')](function(_0x35e2b4){_0x53410d[_0x3e88('0x69')]=_0x35e2b4;return _0x53410d;});}})[_0x3e88('0x23')](respondWithFilteredResult(_0x1b3a16,_0x589a9e))[_0x3e88('0x2e')](handleError(_0x1b3a16,null));};exports[_0x3e88('0xd9')]=function(_0x4a1c4f,_0x4e7e32,_0x45bdd5){var _0x8de568={};var _0x58d702={};var _0x58457b;var _0x3e83f9;return db[_0x3e88('0x4b')][_0x3e88('0xa7')]({'where':{'id':_0x4a1c4f['params']['id']}})[_0x3e88('0x23')](handleEntityNotFound(_0x4e7e32,null))[_0x3e88('0x23')](function(_0x509d4b){if(_0x509d4b){_0x58457b=_0x509d4b;_0x58d702[_0x3e88('0x4f')]=_['keys'](db[_0x3e88('0xda')][_0x3e88('0xce')]);_0x58d702[_0x3e88('0x52')]=_[_0x3e88('0x53')](_0x4a1c4f[_0x3e88('0x52')]);_0x58d702[_0x3e88('0x5e')]=_[_0x3e88('0x54')](_0x58d702['model'],_0x58d702[_0x3e88('0x52')]);_0x8de568[_0x3e88('0x55')]=_['intersection'](_0x58d702['model'],qs[_0x3e88('0x56')](_0x4a1c4f[_0x3e88('0x52')][_0x3e88('0x56')]));_0x8de568['attributes']=_0x8de568[_0x3e88('0x55')][_0x3e88('0x57')]?_0x8de568[_0x3e88('0x55')]:_0x58d702[_0x3e88('0x4f')];_0x8de568[_0x3e88('0x5b')]=qs[_0x3e88('0x5c')](_0x4a1c4f[_0x3e88('0x52')][_0x3e88('0x5c')]);_0x8de568[_0x3e88('0x5d')]=qs['filters'](_[_0x3e88('0x5f')](_0x4a1c4f[_0x3e88('0x52')],_0x58d702[_0x3e88('0x5e')]));if(_0x4a1c4f[_0x3e88('0x52')][_0x3e88('0x42')]){_0x8de568['where']=_[_0x3e88('0x60')](_0x8de568['where'],{'$or':_['map'](_0x8de568[_0x3e88('0x55')],function(_0x4ba065){var _0x469980={};_0x469980[_0x4ba065]={'$like':'%'+_0x4a1c4f[_0x3e88('0x52')]['filter']+'%'};return _0x469980;})});}_0x8de568=_[_0x3e88('0x60')]({},_0x8de568,_0x4a1c4f[_0x3e88('0x65')]);return _0x58457b[_0x3e88('0xd9')](_0x8de568);}})[_0x3e88('0x23')](function(_0x38883d){if(_0x38883d){_0x3e83f9=_0x38883d[_0x3e88('0x57')];if(!_0x4a1c4f[_0x3e88('0x52')]['hasOwnProperty'](_0x3e88('0x59'))){_0x8de568[_0x3e88('0x5a')]=qs['limit'](_0x4a1c4f[_0x3e88('0x52')][_0x3e88('0x5a')]);_0x8de568[_0x3e88('0x34')]=qs[_0x3e88('0x34')](_0x4a1c4f[_0x3e88('0x52')][_0x3e88('0x34')]);}return _0x58457b[_0x3e88('0xd9')](_0x8de568);}})[_0x3e88('0x23')](function(_0x2d96e7){if(_0x2d96e7){return _0x2d96e7?{'count':_0x3e83f9,'rows':_0x2d96e7}:null;}})[_0x3e88('0x23')](respondWithResult(_0x4e7e32,null))[_0x3e88('0x2e')](handleError(_0x4e7e32,null));};exports[_0x3e88('0xdb')]=function(_0x3ae4e7,_0x4a496e,_0x5e5f52){var _0x3a4338={};var _0x7d783a={};var _0x570ba5;var _0x5b8960;return db[_0x3e88('0x4b')][_0x3e88('0xa7')]({'where':{'id':_0x3ae4e7[_0x3e88('0x6d')]['id']}})['then'](handleEntityNotFound(_0x4a496e,null))[_0x3e88('0x23')](function(_0x1610e9){if(_0x1610e9){_0x570ba5=_0x1610e9;_0x7d783a[_0x3e88('0x4f')]=_['keys'](db[_0x3e88('0xdc')][_0x3e88('0xce')]);_0x7d783a['query']=_[_0x3e88('0x53')](_0x3ae4e7[_0x3e88('0x52')]);_0x7d783a[_0x3e88('0x5e')]=_[_0x3e88('0x54')](_0x7d783a[_0x3e88('0x4f')],_0x7d783a[_0x3e88('0x52')]);_0x3a4338['attributes']=_[_0x3e88('0x54')](_0x7d783a[_0x3e88('0x4f')],qs[_0x3e88('0x56')](_0x3ae4e7['query'][_0x3e88('0x56')]));_0x3a4338[_0x3e88('0x55')]=_0x3a4338[_0x3e88('0x55')][_0x3e88('0x57')]?_0x3a4338[_0x3e88('0x55')]:_0x7d783a['model'];_0x3a4338['order']=qs[_0x3e88('0x5c')](_0x3ae4e7[_0x3e88('0x52')][_0x3e88('0x5c')]);_0x3a4338['where']=qs[_0x3e88('0x5e')](_[_0x3e88('0x5f')](_0x3ae4e7[_0x3e88('0x52')],_0x7d783a[_0x3e88('0x5e')]));if(_0x3ae4e7[_0x3e88('0x52')][_0x3e88('0x42')]){_0x3a4338[_0x3e88('0x5d')]=_[_0x3e88('0x60')](_0x3a4338['where'],{'$or':_['map'](_0x3a4338[_0x3e88('0x55')],function(_0x4aaec2){var _0x14428c={};_0x14428c[_0x4aaec2]={'$like':'%'+_0x3ae4e7[_0x3e88('0x52')][_0x3e88('0x42')]+'%'};return _0x14428c;})});}_0x3a4338=_['merge']({},_0x3a4338,_0x3ae4e7['options']);return _0x570ba5['getOpenchannelInteractions'](_0x3a4338);}})[_0x3e88('0x23')](function(_0x1f49a2){if(_0x1f49a2){_0x5b8960=_0x1f49a2[_0x3e88('0x57')];if(!_0x3ae4e7[_0x3e88('0x52')][_0x3e88('0x58')]('nolimit')){_0x3a4338[_0x3e88('0x5a')]=qs[_0x3e88('0x5a')](_0x3ae4e7['query']['limit']);_0x3a4338[_0x3e88('0x34')]=qs[_0x3e88('0x34')](_0x3ae4e7[_0x3e88('0x52')][_0x3e88('0x34')]);}return _0x570ba5[_0x3e88('0xdb')](_0x3a4338);}})[_0x3e88('0x23')](function(_0x1174d8){if(_0x1174d8){return _0x1174d8?{'count':_0x5b8960,'rows':_0x1174d8}:null;}})[_0x3e88('0x23')](respondWithResult(_0x4a496e,null))[_0x3e88('0x2e')](handleError(_0x4a496e,null));};exports[_0x3e88('0xdd')]=function(_0x1351c3,_0x1ec92f,_0x49d1bc){var _0xc91176={'raw':!![],'where':{}};var _0x2066a5={};var _0x38ce01={'count':0x0,'rows':[]};return db['User'][_0x3e88('0xa7')]({'where':{'id':_0x1351c3[_0x3e88('0x6d')]['id']}})[_0x3e88('0x23')](handleEntityNotFound(_0x1ec92f,null))[_0x3e88('0x23')](function(_0x501a63){if(_0x501a63){_0x2066a5[_0x3e88('0x4f')]=_[_0x3e88('0x53')](db[_0x3e88('0xde')][_0x3e88('0xce')]);_0x2066a5['query']=_['keys'](_0x1351c3[_0x3e88('0x52')]);_0x2066a5['filters']=_[_0x3e88('0x54')](_0x2066a5[_0x3e88('0x4f')],_0x2066a5[_0x3e88('0x52')]);_0xc91176['attributes']=_['intersection'](_0x2066a5[_0x3e88('0x4f')],qs['fields'](_0x1351c3[_0x3e88('0x52')]['fields']));_0xc91176[_0x3e88('0x55')]=_0xc91176[_0x3e88('0x55')]['length']?_0xc91176[_0x3e88('0x55')]:_0x2066a5['model'];if(!_0x1351c3[_0x3e88('0x52')][_0x3e88('0x58')](_0x3e88('0x59'))){_0xc91176[_0x3e88('0x5a')]=qs[_0x3e88('0x5a')](_0x1351c3['query']['limit']);_0xc91176[_0x3e88('0x34')]=qs['offset'](_0x1351c3[_0x3e88('0x52')][_0x3e88('0x34')]);}_0xc91176[_0x3e88('0x5b')]=qs[_0x3e88('0x5c')](_0x1351c3[_0x3e88('0x52')][_0x3e88('0x5c')]);_0xc91176['where']=qs[_0x3e88('0x5e')](_[_0x3e88('0x5f')](_0x1351c3['query'],_0x2066a5[_0x3e88('0x5e')]));_0xc91176[_0x3e88('0x5d')][_0x3e88('0xd6')]=_0x501a63['id'];if(_0x1351c3[_0x3e88('0x52')][_0x3e88('0x42')]){_0xc91176['where']=_['merge'](_0xc91176[_0x3e88('0x5d')],{'$or':_[_0x3e88('0x4a')](_0xc91176[_0x3e88('0x55')],function(_0x294083){var _0x8839ff={};_0x8839ff[_0x294083]={'$like':'%'+_0x1351c3[_0x3e88('0x52')][_0x3e88('0x42')]+'%'};return _0x8839ff;})});}_0xc91176=_[_0x3e88('0x60')]({},_0xc91176,_0x1351c3[_0x3e88('0x65')]);return db[_0x3e88('0xde')][_0x3e88('0x33')]({'where':_0xc91176[_0x3e88('0x5d')]})['then'](function(_0x1e7c11){_0x38ce01[_0x3e88('0x33')]=_0x1e7c11;if(_0x1351c3[_0x3e88('0x52')][_0x3e88('0x66')]){_0xc91176['include']=[{'all':!![]}];}return db[_0x3e88('0xde')][_0x3e88('0x68')](_0xc91176);})['then'](function(_0x5ce9dc){_0x38ce01[_0x3e88('0x69')]=_0x5ce9dc;return _0x38ce01;});}})[_0x3e88('0x23')](respondWithFilteredResult(_0x1ec92f,_0xc91176))[_0x3e88('0x2e')](handleError(_0x1ec92f,null));};exports[_0x3e88('0xdf')]=function(_0x1c9d26,_0x329ffb,_0x16cd7f){var _0x14eadf={};var _0xf8b23d={};var _0x3a6ee7;var _0xa081e9;return db[_0x3e88('0x4b')][_0x3e88('0xa7')]({'where':{'id':_0x1c9d26['params']['id']}})['then'](handleEntityNotFound(_0x329ffb,null))[_0x3e88('0x23')](function(_0x28d183){if(_0x28d183){_0x3a6ee7=_0x28d183;_0xf8b23d[_0x3e88('0x4f')]=_['keys'](db['SmsInteraction'][_0x3e88('0xce')]);_0xf8b23d[_0x3e88('0x52')]=_[_0x3e88('0x53')](_0x1c9d26['query']);_0xf8b23d[_0x3e88('0x5e')]=_[_0x3e88('0x54')](_0xf8b23d['model'],_0xf8b23d[_0x3e88('0x52')]);_0x14eadf['attributes']=_[_0x3e88('0x54')](_0xf8b23d['model'],qs[_0x3e88('0x56')](_0x1c9d26['query'][_0x3e88('0x56')]));_0x14eadf['attributes']=_0x14eadf[_0x3e88('0x55')][_0x3e88('0x57')]?_0x14eadf[_0x3e88('0x55')]:_0xf8b23d[_0x3e88('0x4f')];_0x14eadf[_0x3e88('0x5b')]=qs['sort'](_0x1c9d26['query'][_0x3e88('0x5c')]);_0x14eadf['where']=qs[_0x3e88('0x5e')](_['pick'](_0x1c9d26[_0x3e88('0x52')],_0xf8b23d[_0x3e88('0x5e')]));if(_0x1c9d26[_0x3e88('0x52')][_0x3e88('0x42')]){_0x14eadf[_0x3e88('0x5d')]=_[_0x3e88('0x60')](_0x14eadf['where'],{'$or':_['map'](_0x14eadf['attributes'],function(_0x1503fa){var _0x322b8d={};_0x322b8d[_0x1503fa]={'$like':'%'+_0x1c9d26[_0x3e88('0x52')][_0x3e88('0x42')]+'%'};return _0x322b8d;})});}_0x14eadf=_['merge']({},_0x14eadf,_0x1c9d26[_0x3e88('0x65')]);return _0x3a6ee7[_0x3e88('0xdf')](_0x14eadf);}})[_0x3e88('0x23')](function(_0x43a3a1){if(_0x43a3a1){_0xa081e9=_0x43a3a1[_0x3e88('0x57')];if(!_0x1c9d26[_0x3e88('0x52')][_0x3e88('0x58')](_0x3e88('0x59'))){_0x14eadf[_0x3e88('0x5a')]=qs[_0x3e88('0x5a')](_0x1c9d26[_0x3e88('0x52')][_0x3e88('0x5a')]);_0x14eadf['offset']=qs[_0x3e88('0x34')](_0x1c9d26[_0x3e88('0x52')]['offset']);}return _0x3a6ee7['getSmsInteractions'](_0x14eadf);}})[_0x3e88('0x23')](function(_0x2ca342){if(_0x2ca342){return _0x2ca342?{'count':_0xa081e9,'rows':_0x2ca342}:null;}})[_0x3e88('0x23')](respondWithResult(_0x329ffb,null))['catch'](handleError(_0x329ffb,null));};exports[_0x3e88('0xe0')]=function(_0x386790,_0x5ad26f,_0x553322){var _0x24e98e={};var _0x2bdcbe={};var _0x35fd8c;var _0x3686c1;return db[_0x3e88('0x4b')][_0x3e88('0xa7')]({'where':{'id':_0x386790[_0x3e88('0x6d')]['id']}})['then'](handleEntityNotFound(_0x5ad26f,null))[_0x3e88('0x23')](function(_0x2004b7){if(_0x2004b7){_0x35fd8c=_0x2004b7;_0x2bdcbe[_0x3e88('0x4f')]=_[_0x3e88('0x53')](db[_0x3e88('0xe1')][_0x3e88('0xce')]);_0x2bdcbe[_0x3e88('0x52')]=_['keys'](_0x386790[_0x3e88('0x52')]);_0x2bdcbe[_0x3e88('0x5e')]=_[_0x3e88('0x54')](_0x2bdcbe[_0x3e88('0x4f')],_0x2bdcbe['query']);_0x24e98e[_0x3e88('0x55')]=_['intersection'](_0x2bdcbe[_0x3e88('0x4f')],qs[_0x3e88('0x56')](_0x386790[_0x3e88('0x52')][_0x3e88('0x56')]));_0x24e98e['attributes']=_0x24e98e[_0x3e88('0x55')][_0x3e88('0x57')]?_0x24e98e[_0x3e88('0x55')]:_0x2bdcbe[_0x3e88('0x4f')];_0x24e98e['order']=qs['sort'](_0x386790[_0x3e88('0x52')]['sort']);_0x24e98e[_0x3e88('0x5d')]=qs[_0x3e88('0x5e')](_[_0x3e88('0x5f')](_0x386790['query'],_0x2bdcbe['filters']));if(_0x386790[_0x3e88('0x52')][_0x3e88('0x42')]){_0x24e98e['where']=_[_0x3e88('0x60')](_0x24e98e[_0x3e88('0x5d')],{'$or':_[_0x3e88('0x4a')](_0x24e98e[_0x3e88('0x55')],function(_0x3096bf){var _0x47363f={};_0x47363f[_0x3096bf]={'$like':'%'+_0x386790[_0x3e88('0x52')][_0x3e88('0x42')]+'%'};return _0x47363f;})});}_0x24e98e=_[_0x3e88('0x60')]({},_0x24e98e,_0x386790[_0x3e88('0x65')]);return _0x35fd8c['getFaxInteractions'](_0x24e98e);}})[_0x3e88('0x23')](function(_0x3a1b00){if(_0x3a1b00){_0x3686c1=_0x3a1b00['length'];if(!_0x386790[_0x3e88('0x52')][_0x3e88('0x58')](_0x3e88('0x59'))){_0x24e98e[_0x3e88('0x5a')]=qs['limit'](_0x386790['query'][_0x3e88('0x5a')]);_0x24e98e[_0x3e88('0x34')]=qs['offset'](_0x386790[_0x3e88('0x52')]['offset']);}return _0x35fd8c['getFaxInteractions'](_0x24e98e);}})[_0x3e88('0x23')](function(_0x52cf89){if(_0x52cf89){return _0x52cf89?{'count':_0x3686c1,'rows':_0x52cf89}:null;}})['then'](respondWithResult(_0x5ad26f,null))['catch'](handleError(_0x5ad26f,null));};exports[_0x3e88('0xe2')]=function(_0x2cba55,_0x3957a3,_0x51a74d){var _0x2775d0={};var _0x14975d={};var _0x480c87;var _0x1fbfb2;return db['User'][_0x3e88('0xa7')]({'where':{'id':_0x2cba55[_0x3e88('0x6d')]['id']}})[_0x3e88('0x23')](handleEntityNotFound(_0x3957a3,null))[_0x3e88('0x23')](function(_0xd091bb){if(_0xd091bb){_0x480c87=_0xd091bb;_0x14975d['model']=_[_0x3e88('0x53')](db[_0x3e88('0xe3')][_0x3e88('0xce')]);_0x14975d[_0x3e88('0x52')]=_[_0x3e88('0x53')](_0x2cba55[_0x3e88('0x52')]);_0x14975d[_0x3e88('0x5e')]=_[_0x3e88('0x54')](_0x14975d['model'],_0x14975d['query']);_0x2775d0['attributes']=_['intersection'](_0x14975d['model'],qs['fields'](_0x2cba55[_0x3e88('0x52')]['fields']));_0x2775d0[_0x3e88('0x55')]=_0x2775d0['attributes'][_0x3e88('0x57')]?_0x2775d0[_0x3e88('0x55')]:_0x14975d[_0x3e88('0x4f')];_0x2775d0[_0x3e88('0x5b')]=qs[_0x3e88('0x5c')](_0x2cba55[_0x3e88('0x52')][_0x3e88('0x5c')]);_0x2775d0[_0x3e88('0x5d')]=qs[_0x3e88('0x5e')](_['pick'](_0x2cba55[_0x3e88('0x52')],_0x14975d[_0x3e88('0x5e')]));if(_0x2cba55[_0x3e88('0x52')]['filter']){_0x2775d0[_0x3e88('0x5d')]=_[_0x3e88('0x60')](_0x2775d0[_0x3e88('0x5d')],{'$or':_[_0x3e88('0x4a')](_0x2775d0[_0x3e88('0x55')],function(_0x387a57){var _0x239ae4={};_0x239ae4[_0x387a57]={'$like':'%'+_0x2cba55[_0x3e88('0x52')]['filter']+'%'};return _0x239ae4;})});}_0x2775d0=_[_0x3e88('0x60')]({},_0x2775d0,_0x2cba55[_0x3e88('0x65')]);return _0x480c87[_0x3e88('0xe2')](_0x2775d0);}})[_0x3e88('0x23')](function(_0x23ec11){if(_0x23ec11){_0x1fbfb2=_0x23ec11[_0x3e88('0x57')];if(!_0x2cba55[_0x3e88('0x52')][_0x3e88('0x58')]('nolimit')){_0x2775d0['limit']=qs[_0x3e88('0x5a')](_0x2cba55['query'][_0x3e88('0x5a')]);_0x2775d0[_0x3e88('0x34')]=qs[_0x3e88('0x34')](_0x2cba55[_0x3e88('0x52')][_0x3e88('0x34')]);}return _0x480c87[_0x3e88('0xe2')](_0x2775d0);}})[_0x3e88('0x23')](function(_0x3af371){if(_0x3af371){return _0x3af371?{'count':_0x1fbfb2,'rows':_0x3af371}:null;}})[_0x3e88('0x23')](respondWithResult(_0x3957a3,null))[_0x3e88('0x2e')](handleError(_0x3957a3,null));};exports['login']=function(_0x2a53b8,_0x33c600,_0x5cb97d){var _0x3e26b3;var _0x3a2cbb;var _0x3cec3d;var _0x27c5fa=!_[_0x3e88('0x77')](_0x2a53b8['params']['id'])?_0x2a53b8[_0x3e88('0x6d')]['id']:!_[_0x3e88('0x77')](_0x2a53b8[_0x3e88('0x3e')]['id'])?_0x2a53b8[_0x3e88('0x3e')]['id']:null;return db['User']['find']({'where':{'id':_0x27c5fa,'role':{'$or':[_0x3e88('0x3d'),_0x3e88('0x3e'),'agent']}},'attributes':['id',_0x3e88('0x47'),_0x3e88('0xe4'),_0x3e88('0xe5'),_0x3e88('0x3c'),'internal','loginInPause']})[_0x3e88('0x23')](function(_0x53df07){if(_0x53df07){if(_0x53df07[_0x3e88('0x3c')]===_0x3e88('0x3f')){_0x3e26b3=_0x53df07;if(_0x2a53b8[_0x3e88('0x6c')][_0x3e88('0xb0')]){_0x3cec3d=util[_0x3e88('0xba')]('LOCAL/%s@from-sip/n',_0x3e26b3[_0x2a53b8['body'][_0x3e88('0xb0')]]);}else if(_0x2a53b8[_0x3e88('0x6c')][_0x3e88('0xe6')]){_0x3cec3d=util[_0x3e88('0xba')](_0x3e88('0xbb'),_0x2a53b8[_0x3e88('0x6c')][_0x3e88('0xe6')]);}else{_0x3cec3d=util[_0x3e88('0xba')]('SIP/%s',_0x3e26b3[_0x3e88('0x47')]);}socket['to'](util['format']('user:%s',_0x3e26b3[_0x3e88('0x47')]))[_0x3e88('0xb7')](_0x3e88('0xe7'),{'ip':_0x2a53b8[_0x3e88('0xe8')][_0x3e88('0xe9')]||_0x2a53b8['connection'][_0x3e88('0xea')]||_0x2a53b8['socket']['remoteAddress']||_0x2a53b8[_0x3e88('0xeb')][_0x3e88('0xec')][_0x3e88('0xea')]});return db[_0x3e88('0xbc')][_0x3e88('0x3a')]({'where':{'membername':_0x3e26b3[_0x3e88('0x47')]},'individualHooks':!![]});}}else{throw new db[(_0x3e88('0xa0'))][(_0x3e88('0xa1'))](_0x3e88('0xed'));}})[_0x3e88('0x23')](function(){if(_0x3e26b3){return _0x3e26b3[_0x3e88('0xee')]({'raw':!![]});}})[_0x3e88('0x23')](function(_0x32b70f){if(_0x3e26b3){var _0x39e709=[];if(_0x32b70f){_0x3a2cbb=_0x32b70f;if(_0x3a2cbb[_0x3e88('0x57')]){for(var _0x7a75e0=0x0;_0x7a75e0<_0x3a2cbb[_0x3e88('0x57')];_0x7a75e0++){_0x39e709[_0x3e88('0x98')]({'membername':_0x3e26b3[_0x3e88('0x47')],'UserId':_0x3e26b3['id'],'queue_name':_0x3a2cbb[_0x7a75e0]['name'],'VoiceQueueId':_0x3a2cbb[_0x7a75e0]['id'],'interface':_0x3cec3d,'paused':_0x3e26b3[_0x3e88('0xef')]||![],'penalty':_0x3a2cbb[_0x7a75e0][_0x3e88('0xf0')]||0x0});}return BPromise[_0x3e88('0x9a')](_0x39e709,function(_0x8fc2cd){return db[_0x3e88('0xbc')]['upsert'](_0x8fc2cd);});}}}})[_0x3e88('0x23')](function(){if(_0x3e26b3){return db['MemberReport'][_0x3e88('0x68')]({'where':{'membername':_0x3e26b3['name'],'exitAt':null}});}})[_0x3e88('0x23')](function(_0x39f999){if(_0x3e26b3){var _0x4b243b=[];_0x39f999[_0x3e88('0xf1')](function(_0x1a2933){_0x4b243b['push'](_0x1a2933['update']({'exitAt':moment()['format'](_0x3e88('0xf2'))}));});return BPromise['all'](_0x4b243b);}})[_0x3e88('0x23')](function(){if(_0x3e26b3){var _0x1cac77=[];var _0x3fc5d2=[];var _0x2c67f6=utils['getChannels']();var _0x442850={'membername':_0x3e26b3['name'],'interface':_0x3cec3d,'enterAt':moment()['format'](_0x3e88('0xf2')),'role':_0x3e26b3['role'],'internal':_0x3e26b3[_0x3e88('0x72')]};_0x2c67f6[_0x3e88('0xf1')](function(_0x3bace6){_0x1cac77['push'](_[_0x3e88('0x60')]({'channel':_0x3bace6,'type':_0x3e88('0xf3'),'data1':_0x2a53b8['body'][_0x3e88('0xf4')],'data2':_0x3cec3d},_0x442850));if(_0x3e26b3['loginInPause']){_0x3fc5d2[_0x3e88('0x98')](_[_0x3e88('0x60')]({'channel':_0x3bace6,'type':'PAUSE','data1':'LOGININPAUSE'},_0x442850));}});return db['MemberReport'][_0x3e88('0xf5')](_0x1cac77[_0x3e88('0xf6')](_0x3fc5d2),{'individualHooks':!![]});}})[_0x3e88('0x23')](function(){if(_0x3e26b3){return _0x3e26b3['update']({'online':!![],'lastLoginAt':moment()['format'](_0x3e88('0xf2')),'voicePause':_0x3e26b3[_0x3e88('0xef')]||![],'mailPause':_0x3e26b3[_0x3e88('0xef')]||![],'chatPause':_0x3e26b3[_0x3e88('0xef')]||![],'faxPause':_0x3e26b3['loginInPause']||![],'smsPause':_0x3e26b3[_0x3e88('0xef')]||![],'openchannelPause':_0x3e26b3['loginInPause']||![],'whatsappPause':_0x3e26b3['loginInPause']||![],'pauseType':_0x3e26b3[_0x3e88('0xef')]?_0x3e88('0xf7'):null,'interface':_0x3cec3d,'lastPauseAt':moment()[_0x3e88('0xba')]('YYYY-MM-DD\x20HH:mm:ss')});}})['then'](function(_0x479649){if(_0x2a53b8[_0x3e88('0xf8')]){return _0x5cb97d();}else{return BPromise[_0x3e88('0xf9')](_0x479649)[_0x3e88('0x23')](respondWithResult(_0x33c600,null));}})[_0x3e88('0x2e')](handleError(_0x33c600,null));};exports[_0x3e88('0xfa')]=function(_0x4de9c7,_0x5bcd62,_0x5620a6){var _0x4b5819;return db[_0x3e88('0x4b')][_0x3e88('0x46')]({'where':{'id':_0x4de9c7['params']['id'],'role':_0x3e88('0x3f')},'attributes':['id',_0x3e88('0x47'),_0x3e88('0x3c')]})[_0x3e88('0x23')](handleEntityNotFound(_0x5bcd62,null))[_0x3e88('0x23')](function(_0x1c7974){if(_0x1c7974){_0x4b5819=_0x1c7974;return db['UserVoiceQueueRt'][_0x3e88('0x3a')]({'where':{'membername':_0x4b5819[_0x3e88('0x47')]},'individualHooks':!![]});}})[_0x3e88('0x23')](function(){return db[_0x3e88('0xfb')][_0x3e88('0x68')]({'where':{'membername':_0x4b5819[_0x3e88('0x47')],'exitAt':null}});})['then'](function(_0x530c29){var _0x4e2f41=[];_0x530c29[_0x3e88('0xf1')](function(_0xe6bd7){_0x4e2f41[_0x3e88('0x98')](_0xe6bd7[_0x3e88('0x39')]({'exitAt':moment()[_0x3e88('0xba')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x3e88('0x99')](_0x4e2f41);})[_0x3e88('0x23')](function(){return _0x4b5819[_0x3e88('0x39')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x5bcd62,null))[_0x3e88('0x2e')](handleError(_0x5bcd62,null));};exports[_0x3e88('0xfc')]=function(_0x1bcc22,_0x2f86a9,_0xf48aea){var _0x190e94;return db['UserVoiceQueueRt'][_0x3e88('0x39')]({'paused':0x1},{'where':{'UserId':_0x1bcc22[_0x3e88('0x6d')]['id']},'individualHooks':!![]})[_0x3e88('0x23')](function(){return db[_0x3e88('0x4b')][_0x3e88('0x46')]({'where':{'id':_0x1bcc22[_0x3e88('0x6d')]['id'],'role':_0x3e88('0x3f')},'attributes':['id',_0x3e88('0x47'),_0x3e88('0x3c'),'internal',_0x3e88('0xb0')]});})[_0x3e88('0x23')](handleEntityNotFound(_0x2f86a9,null))[_0x3e88('0x23')](function(_0x3edc77){if(_0x3edc77){_0x190e94=_0x3edc77;return respondWithRpcPromise('QueuePause','pause',{'id':_0x190e94['id'],'name':_0x190e94['name'],'pause':!![]});}})[_0x3e88('0x23')](function(){if(_0x190e94){return db[_0x3e88('0xfb')][_0x3e88('0x68')]({'where':{'membername':_0x190e94['name'],'type':'PAUSE','exitAt':null}});}})[_0x3e88('0x23')](function(_0xd270cb){if(_0xd270cb['length']){var _0x34b605=moment()[_0x3e88('0xba')](_0x3e88('0xf2'));for(var _0x54f9d4=0x0,_0x31e612=_0xd270cb[_0x3e88('0x57')];_0x54f9d4<_0x31e612;_0x54f9d4++){_0xd270cb[_0x54f9d4][_0x3e88('0xfd')]({'exitAt':_0x34b605});}}})['then'](function(){var _0x21f13a=[];var _0xfdce1d=utils[_0x3e88('0xfe')]();_0xfdce1d['forEach'](function(_0x4d1085){_0x21f13a[_0x3e88('0x98')]({'channel':_0x4d1085,'membername':_0x190e94['name'],'interface':_['isNil'](_0x190e94['interface'])?util['format'](_0x3e88('0xbb'),_0x190e94[_0x3e88('0x47')]):_0x190e94['interface'],'type':'PAUSE','enterAt':moment()['format'](_0x3e88('0xf2')),'data1':_0x1bcc22[_0x3e88('0x6c')]['type']||_0x3e88('0xff'),'role':_0x190e94[_0x3e88('0x3c')],'internal':_0x190e94[_0x3e88('0x72')]});});return db[_0x3e88('0xfb')][_0x3e88('0xf5')](_0x21f13a,{'individualHooks':!![]});})[_0x3e88('0x23')](function(){return _0x190e94['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1bcc22[_0x3e88('0x6c')][_0x3e88('0x4d')]||_0x3e88('0xff'),'lastPauseAt':moment()[_0x3e88('0xba')]('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x2f86a9,null))[_0x3e88('0x2e')](handleError(_0x2f86a9,null));};exports[_0x3e88('0x100')]=function(_0x1f0dbd,_0x33ad79,_0x36edbc){var _0x432cf1;return db[_0x3e88('0x4b')][_0x3e88('0x46')]({'where':{'id':_0x1f0dbd[_0x3e88('0x6d')]['id']},'attributes':['id',_0x3e88('0x47'),_0x3e88('0x3c'),_0x3e88('0xaf'),_0x3e88('0x101'),_0x3e88('0x102'),_0x3e88('0x103'),_0x3e88('0x104'),_0x3e88('0x105'),_0x3e88('0x106'),_0x3e88('0x107'),_0x3e88('0x108')]})[_0x3e88('0x23')](handleEntityNotFound(_0x33ad79,null))[_0x3e88('0x23')](function(_0x1572f1){if(_0x1572f1){_0x432cf1=_0x1572f1;if(_0x1f0dbd[_0x3e88('0x6c')][_0x3e88('0xbe')]&&!utils['isValidChannel'](_0x1f0dbd[_0x3e88('0x6c')][_0x3e88('0xbe')])){throw new db[(_0x3e88('0xa0'))][(_0x3e88('0xa1'))](_0x3e88('0xb2'));}switch(_0x1f0dbd[_0x3e88('0x6c')][_0x3e88('0xbe')]){case _0x3e88('0xb9'):return respondWithRpcPromise('QueuePause',_0x3e88('0x100'),{'id':_0x432cf1['id'],'name':_0x432cf1[_0x3e88('0x47')],'pause':![]})['then'](function(){return db[_0x3e88('0xbc')][_0x3e88('0x39')]({'paused':0x0},{'where':{'UserId':_0x432cf1['id']},'individualHooks':!![]});})[_0x3e88('0x23')](function(){return db[_0x3e88('0xfb')][_0x3e88('0x46')]({'where':{'channel':_0x1f0dbd[_0x3e88('0x6c')]['channel'],'membername':_0x432cf1[_0x3e88('0x47')],'type':_0x3e88('0x109'),'exitAt':null}});})[_0x3e88('0x23')](function(_0x3e7447){if(_0x3e7447){return _0x3e7447[_0x3e88('0x39')]({'exitAt':moment()[_0x3e88('0xba')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x3e88('0x10a')},{'individualHooks':!![]});}return null;})[_0x3e88('0x23')](function(){return _0x432cf1[_0x3e88('0x39')]({'voicePause':![]});});case'mail':case'chat':case'fax':case _0x3e88('0x10b'):case _0x3e88('0x10c'):case _0x3e88('0x10d'):return db[_0x3e88('0xfb')][_0x3e88('0x46')]({'where':{'channel':_0x1f0dbd['body']['channel'],'membername':_0x432cf1[_0x3e88('0x47')],'type':'PAUSE','exitAt':null}})[_0x3e88('0x23')](function(_0x56e58d){if(_0x56e58d){return _0x56e58d['update']({'exitAt':moment()[_0x3e88('0xba')](_0x3e88('0xf2')),'data2':_0x3e88('0x10a')},{'individualHooks':!![]});}return null;})[_0x3e88('0x23')](function(){var _0x1c2ab5={};_['set'](_0x1c2ab5,util['format'](_0x3e88('0x10e'),_0x1f0dbd[_0x3e88('0x6c')][_0x3e88('0xbe')],_0x3e88('0x10f')),![]);return _0x432cf1['update'](_0x1c2ab5);});default:return respondWithRpcPromise(_0x3e88('0x110'),'unpause',{'id':_0x432cf1['id'],'name':_0x432cf1[_0x3e88('0x47')],'pause':![]})[_0x3e88('0x23')](function(){return db[_0x3e88('0xbc')][_0x3e88('0x39')]({'paused':0x0},{'where':{'UserId':_0x432cf1['id']}});})[_0x3e88('0x23')](function(){return db[_0x3e88('0xfb')][_0x3e88('0x68')]({'where':{'membername':_0x432cf1[_0x3e88('0x47')],'type':_0x3e88('0x109'),'exitAt':null}});})[_0x3e88('0x23')](function(_0x2e54cf){var _0x377470=[];_0x2e54cf[_0x3e88('0xf1')](function(_0x2996cd){_0x377470[_0x3e88('0x98')](_0x2996cd[_0x3e88('0x39')]({'exitAt':moment()[_0x3e88('0xba')](_0x3e88('0xf2')),'data2':_0x3e88('0x10a')}));});return BPromise[_0x3e88('0x99')](_0x377470);})[_0x3e88('0x23')](function(){return _0x432cf1[_0x3e88('0x39')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x3e88('0x23')](respondWithResult(_0x33ad79,null))[_0x3e88('0x2e')](handleError(_0x33ad79,null));};exports[_0x3e88('0x111')]=function(_0x1337f6,_0x13afe1,_0x16cef8){var _0xb1d3cb={};var _0x1a569c={};var _0x1c7077;var _0x26beff;return db[_0x3e88('0x4b')][_0x3e88('0xa7')]({'where':{'id':_0x1337f6[_0x3e88('0x6d')]['id']}})[_0x3e88('0x23')](handleEntityNotFound(_0x13afe1,null))[_0x3e88('0x23')](function(_0x1a75c1){if(_0x1a75c1){_0x1c7077=_0x1a75c1;_0x1a569c[_0x3e88('0x4f')]=_[_0x3e88('0x53')](db[_0x3e88('0x112')]['rawAttributes']);_0x1a569c['query']=_[_0x3e88('0x53')](_0x1337f6['query']);_0x1a569c['filters']=_[_0x3e88('0x54')](_0x1a569c[_0x3e88('0x4f')],_0x1a569c['query']);_0xb1d3cb[_0x3e88('0x55')]=_[_0x3e88('0x54')](_0x1a569c[_0x3e88('0x4f')],qs['fields'](_0x1337f6[_0x3e88('0x52')][_0x3e88('0x56')]));_0xb1d3cb[_0x3e88('0x55')]=_0xb1d3cb['attributes'][_0x3e88('0x57')]?_0xb1d3cb[_0x3e88('0x55')]:_0x1a569c['model'];_0xb1d3cb[_0x3e88('0x5b')]=qs['sort'](_0x1337f6[_0x3e88('0x52')][_0x3e88('0x5c')]);_0xb1d3cb['where']=qs[_0x3e88('0x5e')](_['pick'](_0x1337f6[_0x3e88('0x52')],_0x1a569c[_0x3e88('0x5e')]));if(_0x1337f6[_0x3e88('0x52')][_0x3e88('0x42')]){_0xb1d3cb[_0x3e88('0x5d')]=_[_0x3e88('0x60')](_0xb1d3cb[_0x3e88('0x5d')],{'$or':_[_0x3e88('0x4a')](_0xb1d3cb['attributes'],function(_0x31564c){var _0xe6b1e7={};_0xe6b1e7[_0x31564c]={'$like':'%'+_0x1337f6[_0x3e88('0x52')][_0x3e88('0x42')]+'%'};return _0xe6b1e7;})});}_0xb1d3cb=_[_0x3e88('0x60')]({},_0xb1d3cb,_0x1337f6[_0x3e88('0x65')]);return _0x1c7077[_0x3e88('0x111')](_0xb1d3cb);}})['then'](function(_0x189680){if(_0x189680){_0x26beff=_0x189680['length'];if(!_0x1337f6[_0x3e88('0x52')][_0x3e88('0x58')](_0x3e88('0x59'))){_0xb1d3cb[_0x3e88('0x5a')]=qs[_0x3e88('0x5a')](_0x1337f6[_0x3e88('0x52')]['limit']);_0xb1d3cb['offset']=qs['offset'](_0x1337f6[_0x3e88('0x52')][_0x3e88('0x34')]);}return _0x1c7077[_0x3e88('0x111')](_0xb1d3cb);}})[_0x3e88('0x23')](function(_0x4f84bb){if(_0x4f84bb){return _0x4f84bb?{'count':_0x26beff,'rows':_0x4f84bb}:null;}})['then'](respondWithResult(_0x13afe1,null))['catch'](handleError(_0x13afe1,null));};exports['addTeams']=function(_0x30ea41,_0x15e9a7){return db['User'][_0x3e88('0x46')]({'where':{'id':_0x30ea41[_0x3e88('0x6d')]['id']}})[_0x3e88('0x23')](handleEntityNotFound(_0x15e9a7,null))['then'](function(_0x3da412){if(_0x3da412){var _0x329e2f=_0x3da412[_0x3e88('0x3b')]({'plain':!![]});return _0x3da412[_0x3e88('0x113')](_0x30ea41['body'][_0x3e88('0x70')],_[_0x3e88('0x71')](_0x30ea41[_0x3e88('0x6c')],[_0x3e88('0x70'),'id'])||{})[_0x3e88('0x23')](function(){for(var _0x6dc92b=0x0;_0x6dc92b<_0x30ea41[_0x3e88('0x6c')][_0x3e88('0x70')]['length'];_0x6dc92b++){var _0x5dc2dc=[];db[_0x3e88('0x112')][_0x3e88('0xa7')]({'where':{'id':_0x30ea41[_0x3e88('0x6c')][_0x3e88('0x70')][_0x6dc92b]}})[_0x3e88('0x23')](function(_0x561367){_0x5dc2dc['push'](_0x561367[_0x3e88('0xee')]()[_0x3e88('0x23')](function(_0x1bacc6){for(var _0x209196=0x0;_0x209196<_0x1bacc6['length'];_0x209196++){_0x1bacc6[_0x209196]['setDataValue'](_0x3e88('0xbe'),_0x3e88('0x114'));}return _0x1bacc6;}));_0x5dc2dc[_0x3e88('0x98')](_0x561367[_0x3e88('0x115')]()[_0x3e88('0x23')](function(_0x2bec9b){for(var _0x1a227d=0x0;_0x1a227d<_0x2bec9b[_0x3e88('0x57')];_0x1a227d++){_0x2bec9b[_0x1a227d][_0x3e88('0x116')](_0x3e88('0xbe'),_0x3e88('0x117'));}return _0x2bec9b;}));_0x5dc2dc['push'](_0x561367[_0x3e88('0x118')]()['then'](function(_0x3ab684){for(var _0x229e53=0x0;_0x229e53<_0x3ab684[_0x3e88('0x57')];_0x229e53++){_0x3ab684[_0x229e53][_0x3e88('0x116')](_0x3e88('0xbe'),_0x3e88('0x119'));}return _0x3ab684;}));_0x5dc2dc['push'](_0x561367[_0x3e88('0x11a')]()['then'](function(_0x16c126){for(var _0x4c166b=0x0;_0x4c166b<_0x16c126[_0x3e88('0x57')];_0x4c166b++){_0x16c126[_0x4c166b][_0x3e88('0x116')](_0x3e88('0xbe'),_0x3e88('0x11b'));}return _0x16c126;}));_0x5dc2dc['push'](_0x561367[_0x3e88('0x11c')]()[_0x3e88('0x23')](function(_0x29c9af){for(var _0x186b77=0x0;_0x186b77<_0x29c9af[_0x3e88('0x57')];_0x186b77++){_0x29c9af[_0x186b77][_0x3e88('0x116')](_0x3e88('0xbe'),_0x3e88('0x11d'));}return _0x29c9af;}));_0x5dc2dc[_0x3e88('0x98')](_0x561367[_0x3e88('0x11e')]()[_0x3e88('0x23')](function(_0x5a102d){for(var _0x3f1883=0x0;_0x3f1883<_0x5a102d[_0x3e88('0x57')];_0x3f1883++){_0x5a102d[_0x3f1883]['setDataValue']('channel',_0x3e88('0x11f'));}return _0x5a102d;}));_0x5dc2dc[_0x3e88('0x98')](_0x561367['getOpenchannelQueues']()['then'](function(_0x4c94b3){for(var _0x543ee2=0x0;_0x543ee2<_0x4c94b3[_0x3e88('0x57')];_0x543ee2++){_0x4c94b3[_0x543ee2][_0x3e88('0x116')](_0x3e88('0xbe'),'Openchannel');}return _0x4c94b3;}));return BPromise['all'](_0x5dc2dc);})['then'](function(_0x49cb73){var _0x3121b3=_[_0x3e88('0x120')](_0x49cb73);_0x5dc2dc=[];return db[_0x3e88('0x62')][_0x3e88('0x121')](function(_0x180bb0){for(var _0x4cb269=0x0;_0x4cb269<_0x3121b3[_0x3e88('0x57')];_0x4cb269++){_0x5dc2dc[_0x3e88('0x98')](_0x3121b3[_0x4cb269][_0x3e88('0x122')](_0x329e2f['id']),{'transaction':_0x180bb0});}return BPromise[_0x3e88('0x99')](_0x5dc2dc)[_0x3e88('0x23')](function(){if(_0x329e2f['online']){return BPromise[_0x3e88('0x9a')](_[_0x3e88('0x42')](_0x3121b3,function(_0x30a75f){return _0x30a75f[_0x3e88('0x123')](_0x3e88('0xbe'))==='Voice';}),function(_0x5f2138){return db[_0x3e88('0xbc')][_0x3e88('0x124')]({'membername':_0x329e2f[_0x3e88('0x47')],'UserId':_0x329e2f['id'],'queue_name':_0x5f2138[_0x3e88('0x47')],'VoiceQueueId':_0x5f2138['id'],'interface':_[_0x3e88('0x77')](_0x329e2f['interface'])?util[_0x3e88('0xba')]('SIP/%s',_0x329e2f['name']):_0x329e2f[_0x3e88('0xb0')],'paused':_0x329e2f['voicePause']||![],'penalty':_0x329e2f[_0x3e88('0xb5')]},{'transaction':_0x180bb0});});}else{return;}})['then'](function(){for(var _0x15d97a=0x0;_0x15d97a<_0x3121b3['length'];_0x15d97a++){var _0x538b18=_0x3121b3[_0x15d97a][_0x3e88('0x123')](_0x3e88('0xbe'));var _0x4a3923=_0x538b18+_0x3e88('0xb6');socket[_0x3e88('0xb7')]('user'+_0x538b18+_0x3e88('0x125'),{'UserId':_0x329e2f['id'],['queueField']:_0x3121b3[_0x15d97a]['id']});}});});});}});}})[_0x3e88('0x23')](respondWithStatusCode(_0x15e9a7,null))[_0x3e88('0x2e')](handleError(_0x15e9a7,null));};exports[_0x3e88('0x126')]=function(_0x4b14e8,_0x890ce8){return db[_0x3e88('0x4b')][_0x3e88('0xa7')]({'where':{'id':_0x4b14e8[_0x3e88('0x6d')]['id']}})[_0x3e88('0x23')](handleEntityNotFound(_0x890ce8,null))[_0x3e88('0x23')](function(_0x501203){if(_0x501203){var _0x1ef128=_0x501203[_0x3e88('0x3b')]({'plain':!![]});var _0x3d68fc=_0x4b14e8['query']['ids'];return _0x501203[_0x3e88('0x126')](_0x3d68fc)[_0x3e88('0x23')](function(){for(var _0x5a96f5=0x0;_0x5a96f5<_0x3d68fc[_0x3e88('0x57')];_0x5a96f5++){var _0x586aa9=[];db[_0x3e88('0x112')]['findOne']({'where':{'id':_0x3d68fc[_0x5a96f5]}})[_0x3e88('0x23')](function(_0xac07a){_0x586aa9[_0x3e88('0x98')](_0xac07a['getVoiceQueues']()[_0x3e88('0x23')](function(_0x47ef9d){for(var _0x96dc25=0x0;_0x96dc25<_0x47ef9d[_0x3e88('0x57')];_0x96dc25++){_0x47ef9d[_0x96dc25][_0x3e88('0x116')](_0x3e88('0xbe'),_0x3e88('0x114'));}return _0x47ef9d;}));_0x586aa9[_0x3e88('0x98')](_0xac07a[_0x3e88('0x115')]()['then'](function(_0x18a51c){for(var _0x104f2f=0x0;_0x104f2f<_0x18a51c[_0x3e88('0x57')];_0x104f2f++){_0x18a51c[_0x104f2f]['setDataValue'](_0x3e88('0xbe'),_0x3e88('0x117'));}return _0x18a51c;}));_0x586aa9[_0x3e88('0x98')](_0xac07a[_0x3e88('0x118')]()[_0x3e88('0x23')](function(_0x2a53cf){for(var _0x1ad718=0x0;_0x1ad718<_0x2a53cf[_0x3e88('0x57')];_0x1ad718++){_0x2a53cf[_0x1ad718][_0x3e88('0x116')](_0x3e88('0xbe'),'Mail');}return _0x2a53cf;}));_0x586aa9[_0x3e88('0x98')](_0xac07a['getSmsQueues']()[_0x3e88('0x23')](function(_0x52eea6){for(var _0x436e90=0x0;_0x436e90<_0x52eea6['length'];_0x436e90++){_0x52eea6[_0x436e90][_0x3e88('0x116')](_0x3e88('0xbe'),_0x3e88('0x11b'));}return _0x52eea6;}));_0x586aa9['push'](_0xac07a[_0x3e88('0x11c')]()[_0x3e88('0x23')](function(_0x428ebc){for(var _0x19e3cc=0x0;_0x19e3cc<_0x428ebc[_0x3e88('0x57')];_0x19e3cc++){_0x428ebc[_0x19e3cc][_0x3e88('0x116')]('channel',_0x3e88('0x11d'));}return _0x428ebc;}));_0x586aa9['push'](_0xac07a['getFaxQueues']()[_0x3e88('0x23')](function(_0x1db179){for(var _0x381b17=0x0;_0x381b17<_0x1db179[_0x3e88('0x57')];_0x381b17++){_0x1db179[_0x381b17]['setDataValue'](_0x3e88('0xbe'),'Fax');}return _0x1db179;}));_0x586aa9[_0x3e88('0x98')](_0xac07a[_0x3e88('0x127')]()[_0x3e88('0x23')](function(_0x478d11){for(var _0x100cdd=0x0;_0x100cdd<_0x478d11[_0x3e88('0x57')];_0x100cdd++){_0x478d11[_0x100cdd][_0x3e88('0x116')](_0x3e88('0xbe'),_0x3e88('0x128'));}return _0x478d11;}));return BPromise[_0x3e88('0x99')](_0x586aa9);})[_0x3e88('0x23')](function(_0x49a9ef){var _0x149cb3=_['flatten'](_0x49a9ef);_0x586aa9=[];return db[_0x3e88('0x62')][_0x3e88('0x121')](function(_0x39a997){for(var _0x3cea4f=0x0;_0x3cea4f<_0x149cb3[_0x3e88('0x57')];_0x3cea4f++){_0x586aa9[_0x3e88('0x98')](_0x149cb3[_0x3cea4f][_0x3e88('0x129')](_0x1ef128['id']),{'transaction':_0x39a997});}return BPromise[_0x3e88('0x99')](_0x586aa9)[_0x3e88('0x23')](function(){if(_0x1ef128['online']){return BPromise[_0x3e88('0x9a')](_[_0x3e88('0x42')](_0x149cb3,function(_0x4c0bab){return _0x4c0bab[_0x3e88('0x123')](_0x3e88('0xbe'))===_0x3e88('0x114');}),function(_0x5bf4fa){return db['UserVoiceQueueRt'][_0x3e88('0x3a')]({'where':{'VoiceQueueId':_0x5bf4fa['id'],'UserId':_0x1ef128['id']},'transaction':_0x39a997});});}else{return;}})[_0x3e88('0x23')](function(){for(var _0x1f5a28=0x0;_0x1f5a28<_0x149cb3['length'];_0x1f5a28++){var _0x2700b4=_0x149cb3[_0x1f5a28][_0x3e88('0x123')](_0x3e88('0xbe'));var _0x1b4006=_0x2700b4+_0x3e88('0xb6');socket['emit'](_0x3e88('0x3e')+_0x2700b4+'Queue:remove',{'UserId':_0x1ef128['id'],['queueField']:_0x149cb3[_0x1f5a28]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x890ce8,null))['catch'](handleError(_0x890ce8,null));};exports[_0x3e88('0x12a')]=function(_0x2216ff,_0xb849bd,_0x41fb5f){var _0x1558b2={};var _0x3209a7={};var _0x5c5725;var _0x35c184;return db[_0x3e88('0x4b')][_0x3e88('0xa7')]({'where':{'id':_0x2216ff['params']['id']}})[_0x3e88('0x23')](handleEntityNotFound(_0xb849bd,null))['then'](function(_0x481fd8){if(_0x481fd8){_0x5c5725=_0x481fd8;_0x3209a7[_0x3e88('0x4f')]=_['keys'](db[_0x3e88('0xc9')][_0x3e88('0xce')]);_0x3209a7[_0x3e88('0x52')]=_[_0x3e88('0x53')](_0x2216ff['query']);_0x3209a7[_0x3e88('0x5e')]=_['intersection'](_0x3209a7[_0x3e88('0x4f')],_0x3209a7[_0x3e88('0x52')]);_0x1558b2[_0x3e88('0x55')]=_[_0x3e88('0x54')](_0x3209a7[_0x3e88('0x4f')],qs[_0x3e88('0x56')](_0x2216ff['query'][_0x3e88('0x56')]));_0x1558b2[_0x3e88('0x55')]=_0x1558b2['attributes'][_0x3e88('0x57')]?_0x1558b2[_0x3e88('0x55')]:_0x3209a7['model'];_0x1558b2[_0x3e88('0x5b')]=qs[_0x3e88('0x5c')](_0x2216ff[_0x3e88('0x52')][_0x3e88('0x5c')]);_0x1558b2['where']=qs[_0x3e88('0x5e')](_[_0x3e88('0x5f')](_0x2216ff[_0x3e88('0x52')],_0x3209a7[_0x3e88('0x5e')]));if(_0x2216ff[_0x3e88('0x52')][_0x3e88('0x42')]){_0x1558b2['where']=_[_0x3e88('0x60')](_0x1558b2[_0x3e88('0x5d')],{'$or':_[_0x3e88('0x4a')](_0x1558b2[_0x3e88('0x55')],function(_0x49ba34){var _0x3065df={};_0x3065df[_0x49ba34]={'$like':'%'+_0x2216ff[_0x3e88('0x52')][_0x3e88('0x42')]+'%'};return _0x3065df;})});}_0x1558b2=_[_0x3e88('0x60')]({},_0x1558b2,_0x2216ff[_0x3e88('0x65')]);return _0x5c5725[_0x3e88('0x12a')](_0x1558b2);}})[_0x3e88('0x23')](function(_0x3c1811){if(_0x3c1811){_0x35c184=_0x3c1811[_0x3e88('0x57')];if(!_0x2216ff[_0x3e88('0x52')]['hasOwnProperty'](_0x3e88('0x59'))){_0x1558b2[_0x3e88('0x5a')]=qs[_0x3e88('0x5a')](_0x2216ff['query'][_0x3e88('0x5a')]);_0x1558b2[_0x3e88('0x34')]=qs[_0x3e88('0x34')](_0x2216ff[_0x3e88('0x52')]['offset']);}return _0x5c5725[_0x3e88('0x12a')](_0x1558b2);}})[_0x3e88('0x23')](function(_0x2ecdf0){if(_0x2ecdf0){return _0x2ecdf0?{'count':_0x35c184,'rows':_0x2ecdf0}:null;}})[_0x3e88('0x23')](respondWithResult(_0xb849bd,null))[_0x3e88('0x2e')](handleError(_0xb849bd,null));};exports[_0x3e88('0x12b')]=function(_0x591096,_0x4f8fa7,_0x21c282){var _0x23b429={};var _0x6c4e6f={};var _0x29e4f5;var _0x2b0843;return db['User']['findOne']({'where':{'id':_0x591096[_0x3e88('0x6d')]['id']}})[_0x3e88('0x23')](handleEntityNotFound(_0x4f8fa7,null))['then'](function(_0x244395){if(_0x244395){_0x29e4f5=_0x244395;_0x6c4e6f[_0x3e88('0x4f')]=_[_0x3e88('0x53')](db[_0x3e88('0x4b')]['rawAttributes']);_0x6c4e6f[_0x3e88('0x52')]=_[_0x3e88('0x53')](_0x591096[_0x3e88('0x52')]);_0x6c4e6f[_0x3e88('0x5e')]=_[_0x3e88('0x54')](_0x6c4e6f['model'],_0x6c4e6f[_0x3e88('0x52')]);_0x23b429[_0x3e88('0x55')]=_[_0x3e88('0x54')](_0x6c4e6f[_0x3e88('0x4f')],qs[_0x3e88('0x56')](_0x591096[_0x3e88('0x52')][_0x3e88('0x56')]));_0x23b429[_0x3e88('0x55')]=_0x23b429[_0x3e88('0x55')][_0x3e88('0x57')]?_0x23b429[_0x3e88('0x55')]:_0x6c4e6f[_0x3e88('0x4f')];_0x23b429[_0x3e88('0x5b')]=qs[_0x3e88('0x5c')](_0x591096['query'][_0x3e88('0x5c')]);_0x23b429['where']=qs[_0x3e88('0x5e')](_[_0x3e88('0x5f')](_0x591096[_0x3e88('0x52')],_0x6c4e6f[_0x3e88('0x5e')]));if(_0x591096[_0x3e88('0x52')]['filter']){_0x23b429['where']=_[_0x3e88('0x60')](_0x23b429[_0x3e88('0x5d')],{'$or':_[_0x3e88('0x4a')](_0x23b429[_0x3e88('0x55')],function(_0x26d0a5){var _0x5ef392={};_0x5ef392[_0x26d0a5]={'$like':'%'+_0x591096[_0x3e88('0x52')]['filter']+'%'};return _0x5ef392;})});}_0x23b429[_0x3e88('0x4f')]=db['User'];_0x23b429['as']=_0x3e88('0x9b');_0x23b429=_[_0x3e88('0x60')]({},_0x23b429,_0x591096[_0x3e88('0x65')]);return _0x29e4f5['getVoiceQueues']({'include':[_0x23b429]});}})['then'](function(_0x2da100){if(_0x2da100){var _0x3791f4={},_0x15c774=[],_0x43de5d=0x0;for(var _0x384819=0x0;_0x384819<_0x2da100['length'];_0x384819+=0x1){for(var _0x2c6292=0x0,_0x40eba1;_0x2c6292<_0x2da100[_0x384819][_0x3e88('0x9b')][_0x3e88('0x57')];_0x2c6292+=0x1){_0x40eba1=_0x2da100[_0x384819][_0x3e88('0x9b')][_0x2c6292][_0x3e88('0x3b')]({'plain':!![]});_0x3791f4[_0x40eba1['id']]=_0x40eba1;}}_0x3791f4=_[_0x3e88('0x12c')](_0x3791f4);for(var _0x38ebd6=qs[_0x3e88('0x34')](_0x591096[_0x3e88('0x52')][_0x3e88('0x34')]);_0x38ebd6<_0x3791f4[_0x3e88('0x57')]&&_0x15c774['length']=_0x4569f9[_0x5349('0x54')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x5349('0x24')](function(){if(_0xba2400){return db['UserVoiceQueueRt'][_0x5349('0x55')]({'where':{'membername':_0xba2400[_0x5349('0x29')]},'individualHooks':!![]});}})[_0x5349('0x24')](function(){if(_0xba2400){return _0xba2400[_0x5349('0x56')]({'raw':!![]});}})[_0x5349('0x24')](function(_0x44da7a){if(_0xba2400){if(_0x44da7a){var _0x3ffabf=[];_0x3a2738=_0x44da7a;if(_0x3a2738[_0x5349('0x31')]){for(var _0x5a58e1=0x0;_0x5a58e1<_0x3a2738['length'];_0x5a58e1++){_0x3ffabf[_0x5349('0x34')](db['UserVoiceQueueRt']['upsert']({'membername':_0xba2400['name'],'UserId':_0xba2400['id'],'queue_name':_0x3a2738[_0x5a58e1][_0x5349('0x29')],'VoiceQueueId':_0x3a2738[_0x5a58e1]['id'],'interface':_0xa58477,'paused':_0xba2400[_0x5349('0x50')]||![],'penalty':_0x3a2738[_0x5a58e1][_0x5349('0x57')]||0x0}));}return BPromise[_0x5349('0x58')](_0x3ffabf);}}}})[_0x5349('0x24')](function(){if(_0xba2400){return db[_0x5349('0x2c')][_0x5349('0x2d')]({'where':{'membername':_0xba2400[_0x5349('0x29')],'exitAt':null}});}})['then'](function(_0x5871b1){if(_0xba2400){if(_0x5871b1&&_0x5871b1[_0x5349('0x31')]){var _0x3a28ab=[];_0x5871b1['forEach'](function(_0x34bc2c){_0x3a28ab[_0x5349('0x34')](_0x34bc2c[_0x5349('0x2b')]({'exitAt':moment()[_0x5349('0x2f')](_0x5349('0x30'))}));});return BPromise[_0x5349('0x58')](_0x3a28ab);}}})['then'](function(_0x27f695){if(_0xba2400){var _0x5e39ff=[];var _0x3c4031=[];var _0x16fab6=utils[_0x5349('0x32')]();var _0x128b71={'membername':_0xba2400[_0x5349('0x29')],'interface':_0xa58477,'enterAt':moment()[_0x5349('0x2f')](_0x5349('0x30')),'role':_0xba2400['role'],'internal':_0xba2400[_0x5349('0x2a')]};_0x16fab6[_0x5349('0x33')](function(_0x3bc056){_0x5e39ff['push'](_[_0x5349('0x59')]({'channel':_0x3bc056,'type':_0x5349('0x5a'),'data1':_0x5349('0x5b'),'data2':_0xa58477},_0x128b71));if(_0xba2400['loginInPause']){_0x3c4031[_0x5349('0x34')](_[_0x5349('0x59')]({'channel':_0x3bc056,'type':_0x5349('0x2e'),'data1':_0x5349('0x5c')},_0x128b71));}});return db[_0x5349('0x2c')][_0x5349('0x3c')](_0x5e39ff[_0x5349('0x5d')](_0x3c4031),{'individualHooks':!![]});}})[_0x5349('0x24')](function(){if(_0xba2400){return _0xba2400[_0x5349('0x2b')]({'online':!![],'lastLoginAt':moment()[_0x5349('0x2f')](_0x5349('0x30')),'voicePause':_0xba2400[_0x5349('0x50')]||![],'mailPause':_0xba2400[_0x5349('0x50')]||![],'chatPause':_0xba2400[_0x5349('0x50')]||![],'faxPause':_0xba2400['loginInPause']||![],'smsPause':_0xba2400[_0x5349('0x50')]||![],'openchannelPause':_0xba2400[_0x5349('0x50')]||![],'pauseType':_0xba2400[_0x5349('0x50')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0xa58477});}})[_0x5349('0x24')](function(_0x17ddf0){_0x674054(_0x17ddf0);})['catch'](function(_0x4eb212){_0x3331f6(_0x5239da[_0x5349('0x18')](0x1f4,_0x4eb212[_0x5349('0x19')]));});});}; \ No newline at end of file +var _0x186d=['upsert','loginInPause','UserVoiceQueue.penalty','merge','LOGIN','LOGININPAUSE','bulkCreate','concat','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','User,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','GetUser','User','findAll','options','raw','attributes','include','model','map','then','stringify','ShowUser','find','where','PauseUser','name','role','internal','interface','update','MemberReport','format','updateAttributes','getChannels','push','SIP/%s','PAUSE','body','DEFAULT\x20PAUSE','uniqueid','type','UnpauseUser','findOne','channel','isValidChannel','voice','UserVoiceQueueRt','YYYY-MM-DD\x20HH:mm:ss','mail','chat','sms','openchannel','system','set','%s%s','LogoutUser','destroy','length','forEach','all','LoginUser','mobile','count','agent','../../config/license/util','getLicense','agents','getVoiceQueues'];(function(_0x5c0e14,_0x49a8f8){var _0x31a163=function(_0x1c86c4){while(--_0x1c86c4){_0x5c0e14['push'](_0x5c0e14['shift']());}};_0x31a163(++_0x49a8f8);}(_0x186d,0x1ca));var _0xd186=function(_0x415603,_0x21320c){_0x415603=_0x415603-0x0;var _0x131e72=_0x186d[_0x415603];return _0x131e72;};'use strict';var _=require('lodash');var util=require(_0xd186('0x0'));var moment=require(_0xd186('0x1'));var BPromise=require(_0xd186('0x2'));var rs=require(_0xd186('0x3'));var fs=require('fs');var Redis=require(_0xd186('0x4'));var db=require(_0xd186('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd186('0x6'))(_0xd186('0x7'));var config=require(_0xd186('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd186('0x9')]({'port':0x232a});config[_0xd186('0xa')]=_[_0xd186('0xb')](config['redis'],{'host':_0xd186('0xc'),'port':0x18eb});var socket=require(_0xd186('0xd'))(new Redis(config[_0xd186('0xa')]));require('./user.socket')[_0xd186('0xe')](socket);function respondWithRpcPromise(_0x434a4b,_0x2d9f08,_0xcdaf04){return new BPromise(function(_0x39ad45,_0x2fdffd){return client['request'](_0x434a4b,_0xcdaf04)['then'](function(_0x41b132){logger['info'](_0xd186('0xf'),_0x2d9f08,_0xd186('0x10'));logger[_0xd186('0x11')]('User,\x20%s,\x20%s,\x20%s',_0x2d9f08,_0xd186('0x10'),JSON['stringify'](_0x41b132));if(_0x41b132[_0xd186('0x12')]){if(_0x41b132[_0xd186('0x12')][_0xd186('0x13')]===0x1f4){logger[_0xd186('0x12')](_0xd186('0xf'),_0x2d9f08,_0x41b132[_0xd186('0x12')][_0xd186('0x14')]);return _0x2fdffd(_0x41b132[_0xd186('0x12')][_0xd186('0x14')]);}logger[_0xd186('0x12')](_0xd186('0xf'),_0x2d9f08,_0x41b132['error'][_0xd186('0x14')]);return _0x39ad45(_0x41b132[_0xd186('0x12')][_0xd186('0x14')]);}else{logger[_0xd186('0x15')](_0xd186('0xf'),_0x2d9f08,_0xd186('0x10'));_0x39ad45(_0x41b132[_0xd186('0x16')]['message']);}})[_0xd186('0x17')](function(_0x3287a7){logger['error'](_0xd186('0xf'),_0x2d9f08,_0x3287a7);_0x2fdffd(_0x3287a7);});});}exports[_0xd186('0x18')]=function(_0x4f6f63){var _0x5f460e=this;return new Promise(function(_0x4111a8,_0x374e72){return db[_0xd186('0x19')][_0xd186('0x1a')]({'raw':_0x4f6f63[_0xd186('0x1b')]?_0x4f6f63['options'][_0xd186('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f6f63[_0xd186('0x1b')]?_0x4f6f63[_0xd186('0x1b')]['where']||null:null,'attributes':_0x4f6f63['options']?_0x4f6f63[_0xd186('0x1b')][_0xd186('0x1d')]||null:null,'limit':_0x4f6f63[_0xd186('0x1b')]?_0x4f6f63['options']['limit']||null:null,'include':_0x4f6f63[_0xd186('0x1b')]?_0x4f6f63[_0xd186('0x1b')]['include']?_['map'](_0x4f6f63[_0xd186('0x1b')][_0xd186('0x1e')],function(_0x3c0a37){return{'model':db[_0x3c0a37[_0xd186('0x1f')]],'as':_0x3c0a37['as'],'attributes':_0x3c0a37[_0xd186('0x1d')],'include':_0x3c0a37[_0xd186('0x1e')]?_[_0xd186('0x20')](_0x3c0a37['include'],function(_0x5a40b8){return{'model':db[_0x5a40b8[_0xd186('0x1f')]],'as':_0x5a40b8['as'],'attributes':_0x5a40b8[_0xd186('0x1d')],'include':_0x5a40b8[_0xd186('0x1e')]?_[_0xd186('0x20')](_0x5a40b8[_0xd186('0x1e')],function(_0x5962c9){return{'model':db[_0x5962c9[_0xd186('0x1f')]],'as':_0x5962c9['as'],'attributes':_0x5962c9[_0xd186('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd186('0x21')](function(_0x3a5284){logger[_0xd186('0x15')](_0xd186('0x18'),_0x4f6f63);logger[_0xd186('0x11')](_0xd186('0x18'),_0x4f6f63,JSON[_0xd186('0x22')](_0x3a5284));_0x4111a8(_0x3a5284);})[_0xd186('0x17')](function(_0x37c08f){logger[_0xd186('0x12')](_0xd186('0x18'),_0x37c08f[_0xd186('0x14')],_0x4f6f63);_0x374e72(_0x5f460e[_0xd186('0x12')](0x1f4,_0x37c08f[_0xd186('0x14')]));});});};exports[_0xd186('0x23')]=function(_0x74f846){var _0xd5b3e=this;return new Promise(function(_0x280bbb,_0x3e8af6){return db[_0xd186('0x19')][_0xd186('0x24')]({'raw':_0x74f846[_0xd186('0x1b')]?_0x74f846[_0xd186('0x1b')][_0xd186('0x1c')]===undefined?!![]:![]:!![],'where':_0x74f846[_0xd186('0x1b')]?_0x74f846[_0xd186('0x1b')][_0xd186('0x25')]||null:null,'attributes':_0x74f846[_0xd186('0x1b')]?_0x74f846[_0xd186('0x1b')][_0xd186('0x1d')]||null:null,'include':_0x74f846['options']?_0x74f846[_0xd186('0x1b')][_0xd186('0x1e')]?_[_0xd186('0x20')](_0x74f846[_0xd186('0x1b')][_0xd186('0x1e')],function(_0x9145e){return{'model':db[_0x9145e[_0xd186('0x1f')]],'as':_0x9145e['as'],'attributes':_0x9145e[_0xd186('0x1d')],'include':_0x9145e['include']?_[_0xd186('0x20')](_0x9145e[_0xd186('0x1e')],function(_0x3ccf89){return{'model':db[_0x3ccf89[_0xd186('0x1f')]],'as':_0x3ccf89['as'],'attributes':_0x3ccf89[_0xd186('0x1d')],'include':_0x3ccf89[_0xd186('0x1e')]?_[_0xd186('0x20')](_0x3ccf89[_0xd186('0x1e')],function(_0x3f09fc){return{'model':db[_0x3f09fc[_0xd186('0x1f')]],'as':_0x3f09fc['as'],'attributes':_0x3f09fc[_0xd186('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd186('0x21')](function(_0x4dcd43){logger[_0xd186('0x15')](_0xd186('0x23'),_0x74f846);logger['debug'](_0xd186('0x23'),_0x74f846,JSON[_0xd186('0x22')](_0x4dcd43));_0x280bbb(_0x4dcd43);})[_0xd186('0x17')](function(_0x319bd5){logger['error'](_0xd186('0x23'),_0x319bd5['message'],_0x74f846);_0x3e8af6(_0xd5b3e[_0xd186('0x12')](0x1f4,_0x319bd5[_0xd186('0x14')]));});});};exports[_0xd186('0x26')]=function(_0x58df98){var _0x5072b6=this;return new Promise(function(_0x38d001,_0x535429){var _0x5675e7;return db['User'][_0xd186('0x24')]({'where':_0x58df98[_0xd186('0x1b')]['where']||{},'attributes':['id',_0xd186('0x27'),_0xd186('0x28'),_0xd186('0x29'),_0xd186('0x2a')]})['then'](function(_0x3a7bec){if(_0x3a7bec){_0x5675e7=_0x3a7bec;return db['UserVoiceQueueRt'][_0xd186('0x2b')]({'paused':0x1},{'where':{'UserId':_0x5675e7['id']},'individualHooks':!![]});}})['then'](function(){if(_0x5675e7){return db[_0xd186('0x2c')][_0xd186('0x1a')]({'where':{'membername':_0x5675e7[_0xd186('0x27')],'type':'PAUSE','exitAt':null}});}})[_0xd186('0x21')](function(_0x279fb6){if(_0x5675e7){if(_0x279fb6&&_0x279fb6['length']){var _0x364a8f=moment()[_0xd186('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x55d2ef=0x0,_0x1c9cd5=_0x279fb6['length'];_0x55d2ef<_0x1c9cd5;_0x55d2ef++){_0x279fb6[_0x55d2ef][_0xd186('0x2e')]({'exitAt':_0x364a8f});}}}})['then'](function(){if(_0x5675e7){var _0x4c4f0f=[];var _0x3005dc=utils[_0xd186('0x2f')]();_0x3005dc['forEach'](function(_0x6b4f31){_0x4c4f0f[_0xd186('0x30')]({'channel':_0x6b4f31,'membername':_0x5675e7['name'],'interface':_['isNil'](_0x5675e7[_0xd186('0x2a')])?util[_0xd186('0x2d')](_0xd186('0x31'),_0x5675e7[_0xd186('0x27')]):_0x5675e7[_0xd186('0x2a')],'type':_0xd186('0x32'),'enterAt':moment()[_0xd186('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x58df98[_0xd186('0x33')]['type']||_0xd186('0x34'),'role':_0x5675e7[_0xd186('0x28')],'internal':_0x5675e7[_0xd186('0x29')],'uniqueid':_0x58df98[_0xd186('0x33')][_0xd186('0x35')]||null});});return db[_0xd186('0x2c')]['bulkCreate'](_0x4c4f0f,{'individualHooks':!![]});}})[_0xd186('0x21')](function(){if(_0x5675e7){return _0x5675e7[_0xd186('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x58df98[_0xd186('0x33')][_0xd186('0x36')]||_0xd186('0x34'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xd186('0x21')](function(_0x3e9a00){_0x38d001(_0x3e9a00);})['catch'](function(_0x42272f){_0x535429(_0x5072b6[_0xd186('0x12')](0x1f4,_0x42272f['message']));});});};exports[_0xd186('0x37')]=function(_0x4a39e4){var _0x9bc3e0=this;return new Promise(function(_0x5696e4,_0x3c41e1){var _0x1acf9e;return db[_0xd186('0x19')][_0xd186('0x38')]({'where':_0x4a39e4['options'][_0xd186('0x25')]||{},'attributes':['id',_0xd186('0x27')]})[_0xd186('0x21')](function(_0x50f2bd){if(_0x50f2bd){_0x1acf9e=_0x50f2bd;if(_0x4a39e4['body'][_0xd186('0x39')]&&!utils[_0xd186('0x3a')](_0x4a39e4[_0xd186('0x33')][_0xd186('0x39')])){throw new Error('Unknown\x20channel');}switch(_0x4a39e4[_0xd186('0x33')][_0xd186('0x39')]){case _0xd186('0x3b'):return db[_0xd186('0x3c')]['update']({'paused':0x0},{'where':{'UserId':_0x1acf9e['id']}})[_0xd186('0x21')](function(){return db[_0xd186('0x2c')][_0xd186('0x24')]({'where':{'channel':_0x4a39e4[_0xd186('0x33')]['channel'],'membername':_0x1acf9e[_0xd186('0x27')],'type':_0xd186('0x32'),'exitAt':null}});})['then'](function(_0x190e98){if(_0x190e98){return _0x190e98[_0xd186('0x2b')]({'exitAt':moment()[_0xd186('0x2d')](_0xd186('0x3d')),'data2':'system'},{'individualHooks':!![]});}return null;})[_0xd186('0x21')](function(){return _0x1acf9e[_0xd186('0x2b')]({'voicePause':![]});});case _0xd186('0x3e'):case _0xd186('0x3f'):case'fax':case _0xd186('0x40'):case _0xd186('0x41'):case'whatsapp':return db[_0xd186('0x2c')][_0xd186('0x24')]({'where':{'channel':_0x4a39e4['body'][_0xd186('0x39')],'membername':_0x1acf9e[_0xd186('0x27')],'type':'PAUSE','exitAt':null}})[_0xd186('0x21')](function(_0x1fa433){return _0x1fa433[_0xd186('0x2b')]({'exitAt':moment()[_0xd186('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xd186('0x42')},{'individualHooks':!![]});})[_0xd186('0x21')](function(){var _0x3fa3ef={};_[_0xd186('0x43')](_0x3fa3ef,util[_0xd186('0x2d')](_0xd186('0x44'),_0x4a39e4[_0xd186('0x33')][_0xd186('0x39')],'Pause'),![]);return _0x1acf9e[_0xd186('0x2b')](_0x3fa3ef);});default:return db['UserVoiceQueueRt'][_0xd186('0x2b')]({'paused':0x0},{'where':{'UserId':_0x1acf9e['id']}})[_0xd186('0x21')](function(){return db[_0xd186('0x2c')][_0xd186('0x1a')]({'where':{'membername':_0x1acf9e[_0xd186('0x27')],'type':_0xd186('0x32'),'exitAt':null}});})[_0xd186('0x21')](function(_0x5ee77a){var _0x3a1861=[];_0x5ee77a['forEach'](function(_0x3be610){_0x3a1861[_0xd186('0x30')](_0x3be610[_0xd186('0x2b')]({'exitAt':moment()['format'](_0xd186('0x3d')),'data2':_0xd186('0x42')}));});return BPromise['all'](_0x3a1861);})[_0xd186('0x21')](function(){return _0x1acf9e[_0xd186('0x2b')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xd186('0x21')](function(_0xb27c67){_0x5696e4(_0xb27c67);})[_0xd186('0x17')](function(_0x45629c){_0x3c41e1(_0x9bc3e0[_0xd186('0x12')](0x1f4,_0x45629c['message']));});});};exports[_0xd186('0x45')]=function(_0xca10e8){var _0x3f1489=this;return new Promise(function(_0xdf52e9,_0x5d1cd7){var _0x2c10ca;return db[_0xd186('0x19')][_0xd186('0x38')]({'where':_0xca10e8[_0xd186('0x1b')][_0xd186('0x25')]||{},'attributes':['id','name']})['then'](function(_0x3ede1e){if(_0x3ede1e){_0x2c10ca=_0x3ede1e;return db[_0xd186('0x3c')][_0xd186('0x46')]({'where':{'membername':_0x2c10ca[_0xd186('0x27')]},'individualHooks':!![]});}})['then'](function(){if(_0x2c10ca){return db[_0xd186('0x2c')][_0xd186('0x1a')]({'where':{'membername':_0x2c10ca[_0xd186('0x27')],'exitAt':null}});}})[_0xd186('0x21')](function(_0x2911d3){if(_0x2c10ca){if(_0x2911d3&&_0x2911d3[_0xd186('0x47')]){var _0x20c7c8=[];_0x2911d3[_0xd186('0x48')](function(_0x1c221d){_0x20c7c8[_0xd186('0x30')](_0x1c221d[_0xd186('0x2b')]({'exitAt':moment()[_0xd186('0x2d')](_0xd186('0x3d'))}));});return BPromise[_0xd186('0x49')](_0x20c7c8);}}})[_0xd186('0x21')](function(){if(_0x2c10ca){return _0x2c10ca[_0xd186('0x2b')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xd186('0x21')](function(_0x4874e5){_0xdf52e9(_0x4874e5);})[_0xd186('0x17')](function(_0x5d6157){_0x5d1cd7(_0x3f1489[_0xd186('0x12')](0x1f4,_0x5d6157[_0xd186('0x14')]));});});};exports[_0xd186('0x4a')]=function(_0x23ce28){var _0x3709e3=this;return new Promise(function(_0x444fcf,_0x2cf1de){var _0x51ec43;var _0x2cdeb3;var _0x443654;var _0x2f8794;return db[_0xd186('0x19')][_0xd186('0x38')]({'where':_0x23ce28[_0xd186('0x1b')]['where']||{},'attributes':['id',_0xd186('0x27'),_0xd186('0x28'),_0xd186('0x4b'),'phone',_0xd186('0x29'),'loginInPause',_0xd186('0x2a')]})['then'](function(_0x1f3e0a){if(_0x1f3e0a){_0x51ec43=_0x1f3e0a;_0x2f8794=_0x23ce28['body'][_0xd186('0x2a')]?_0x23ce28[_0xd186('0x33')][_0xd186('0x2a')]:util[_0xd186('0x2d')](_0xd186('0x31'),_0x51ec43[_0xd186('0x27')]);return db[_0xd186('0x19')][_0xd186('0x4c')]({'where':{'role':_0xd186('0x4d'),'online':!![],'id':{'$ne':_0x51ec43['id']}}});}})[_0xd186('0x21')](function(_0x224061){if(_0x224061){_0x443654=_0x224061;return require(_0xd186('0x4e'))[_0xd186('0x4f')]();}})[_0xd186('0x21')](function(_0x55ce91){if(_0x55ce91&&_0x55ce91[_0xd186('0x50')]&&_0x443654>=_0x55ce91['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x51ec43){return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x51ec43[_0xd186('0x27')]},'individualHooks':!![]});}})[_0xd186('0x21')](function(){if(_0x51ec43){return _0x51ec43[_0xd186('0x51')]({'raw':!![]});}})[_0xd186('0x21')](function(_0x31c82c){if(_0x51ec43){if(_0x31c82c){var _0x1ce792=[];_0x2cdeb3=_0x31c82c;if(_0x2cdeb3[_0xd186('0x47')]){for(var _0x3d1643=0x0;_0x3d1643<_0x2cdeb3[_0xd186('0x47')];_0x3d1643++){_0x1ce792['push'](db['UserVoiceQueueRt'][_0xd186('0x52')]({'membername':_0x51ec43[_0xd186('0x27')],'UserId':_0x51ec43['id'],'queue_name':_0x2cdeb3[_0x3d1643]['name'],'VoiceQueueId':_0x2cdeb3[_0x3d1643]['id'],'interface':_0x2f8794,'paused':_0x51ec43[_0xd186('0x53')]||![],'penalty':_0x2cdeb3[_0x3d1643][_0xd186('0x54')]||0x0}));}return BPromise[_0xd186('0x49')](_0x1ce792);}}}})[_0xd186('0x21')](function(){if(_0x51ec43){return db[_0xd186('0x2c')][_0xd186('0x1a')]({'where':{'membername':_0x51ec43[_0xd186('0x27')],'exitAt':null}});}})['then'](function(_0xc6ca76){if(_0x51ec43){if(_0xc6ca76&&_0xc6ca76['length']){var _0x54fbc6=[];_0xc6ca76[_0xd186('0x48')](function(_0x30a9ad){_0x54fbc6[_0xd186('0x30')](_0x30a9ad[_0xd186('0x2b')]({'exitAt':moment()[_0xd186('0x2d')](_0xd186('0x3d'))}));});return BPromise[_0xd186('0x49')](_0x54fbc6);}}})[_0xd186('0x21')](function(_0xcece4a){if(_0x51ec43){var _0x218190=[];var _0x24a57d=[];var _0x2e519c=utils[_0xd186('0x2f')]();var _0x55a05d={'membername':_0x51ec43[_0xd186('0x27')],'interface':_0x2f8794,'enterAt':moment()[_0xd186('0x2d')](_0xd186('0x3d')),'role':_0x51ec43['role'],'internal':_0x51ec43[_0xd186('0x29')]};_0x2e519c['forEach'](function(_0x543e75){_0x218190['push'](_[_0xd186('0x55')]({'channel':_0x543e75,'type':_0xd186('0x56'),'data1':'callysquare','data2':_0x2f8794},_0x55a05d));if(_0x51ec43[_0xd186('0x53')]){_0x24a57d['push'](_[_0xd186('0x55')]({'channel':_0x543e75,'type':_0xd186('0x32'),'data1':_0xd186('0x57')},_0x55a05d));}});return db[_0xd186('0x2c')][_0xd186('0x58')](_0x218190[_0xd186('0x59')](_0x24a57d),{'individualHooks':!![]});}})['then'](function(){if(_0x51ec43){return _0x51ec43[_0xd186('0x2b')]({'online':!![],'lastLoginAt':moment()[_0xd186('0x2d')](_0xd186('0x3d')),'voicePause':_0x51ec43[_0xd186('0x53')]||![],'mailPause':_0x51ec43[_0xd186('0x53')]||![],'chatPause':_0x51ec43[_0xd186('0x53')]||![],'faxPause':_0x51ec43[_0xd186('0x53')]||![],'smsPause':_0x51ec43[_0xd186('0x53')]||![],'openchannelPause':_0x51ec43[_0xd186('0x53')]||![],'pauseType':_0x51ec43['loginInPause']?_0xd186('0x57'):null,'lastPauseAt':moment()[_0xd186('0x2d')](_0xd186('0x3d')),'interface':_0x2f8794});}})[_0xd186('0x21')](function(_0x274aa9){_0x444fcf(_0x274aa9);})[_0xd186('0x17')](function(_0x2f47b6){_0x2cf1de(_0x3709e3['error'](0x1f4,_0x2f47b6['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 069f8fe..9156b1c 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 _0xe89b=['register','user:','save','remove','update','emit','removeListener'];(function(_0x49ee34,_0x489d34){var _0x13e172=function(_0x5d607e){while(--_0x5d607e){_0x49ee34['push'](_0x49ee34['shift']());}};_0x13e172(++_0x489d34);}(_0xe89b,0x64));var _0xbe89=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xe89b[_0x618414];return _0x21c19a;};'use strict';var UserEvents=require('./user.events');var events=[_0xbe89('0x0'),_0xbe89('0x1'),_0xbe89('0x2')];function createListener(_0x4806b7,_0x303692){return function(_0x303003){_0x303692[_0xbe89('0x3')](_0x4806b7,_0x303003);};}function removeListener(_0x164cf5,_0x510570){return function(){UserEvents[_0xbe89('0x4')](_0x164cf5,_0x510570);};}exports[_0xbe89('0x5')]=function(_0x343477){for(var _0x5c4d0e=0x0,_0x24283c=events['length'];_0x5c4d0e<_0x24283c;_0x5c4d0e++){var _0x196e51=events[_0x5c4d0e];var _0x412a06=createListener(_0xbe89('0x6')+_0x196e51,_0x343477);UserEvents['on'](_0x196e51,_0x412a06);}}; \ No newline at end of file +var _0x91ba=['register','length','user:','./user.events','save','removeListener'];(function(_0x4d6f3b,_0x169895){var _0x2c3010=function(_0x2cad24){while(--_0x2cad24){_0x4d6f3b['push'](_0x4d6f3b['shift']());}};_0x2c3010(++_0x169895);}(_0x91ba,0x93));var _0xa91b=function(_0x48a660,_0x35ad89){_0x48a660=_0x48a660-0x0;var _0x874e67=_0x91ba[_0x48a660];return _0x874e67;};'use strict';var UserEvents=require(_0xa91b('0x0'));var events=[_0xa91b('0x1'),'remove','update'];function createListener(_0x4e720e,_0x3d3e61){return function(_0x5352de){_0x3d3e61['emit'](_0x4e720e,_0x5352de);};}function removeListener(_0x22027f,_0x2d5e0f){return function(){UserEvents[_0xa91b('0x2')](_0x22027f,_0x2d5e0f);};}exports[_0xa91b('0x3')]=function(_0x335a89){for(var _0x41b9a8=0x0,_0x37c88=events[_0xa91b('0x4')];_0x41b9a8<_0x37c88;_0x41b9a8++){var _0x22e695=events[_0x41b9a8];var _0x46be0e=createListener(_0xa91b('0x5')+_0x22e695,_0x335a89);UserEvents['on'](_0x22e695,_0x46be0e);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 8999b93..f31af5c 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 _0xc89d=['multer','util','path','connect-timeout','../../components/auth/service','exports'];(function(_0x5953ca,_0x595eb4){var _0x3b60f4=function(_0x1ee6f7){while(--_0x1ee6f7){_0x5953ca['push'](_0x5953ca['shift']());}};_0x3b60f4(++_0x595eb4);}(_0xc89d,0x17a));var _0xdc89=function(_0x4c4ae8,_0x31cf2d){_0x4c4ae8=_0x4c4ae8-0x0;var _0x1b3a1c=_0xc89d[_0x4c4ae8];return _0x1b3a1c;};'use strict';var multer=require(_0xdc89('0x0'));var util=require(_0xdc89('0x1'));var path=require(_0xdc89('0x2'));var timeout=require(_0xdc89('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xdc89('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xdc89('0x5')]=router; \ No newline at end of file +var _0xda85=['../../components/auth/service','../../config/environment','exports','multer','util','path','express','Router'];(function(_0x15dbca,_0x1d7c3c){var _0x326533=function(_0x507ee2){while(--_0x507ee2){_0x15dbca['push'](_0x15dbca['shift']());}};_0x326533(++_0x1d7c3c);}(_0xda85,0x12b));var _0x5da8=function(_0x572246,_0x31c860){_0x572246=_0x572246-0x0;var _0x53ff43=_0xda85[_0x572246];return _0x53ff43;};'use strict';var multer=require(_0x5da8('0x0'));var util=require(_0x5da8('0x1'));var path=require(_0x5da8('0x2'));var timeout=require('connect-timeout');var express=require(_0x5da8('0x3'));var router=express[_0x5da8('0x4')]();var auth=require(_0x5da8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5da8('0x6'));module[_0x5da8('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 079855f..f5fb85b 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(_0x10dcbe,_0x30d60d){var _0x294e6b=function(_0x5ff33b){while(--_0x5ff33b){_0x10dcbe['push'](_0x10dcbe['shift']());}};_0x294e6b(++_0x30d60d);}(_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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x36f613,_0x39add7){var _0x7bc41f=function(_0x2f3606){while(--_0x2f3606){_0x36f613['push'](_0x36f613['shift']());}};_0x7bc41f(++_0x39add7);}(_0xe706,0xa3));var _0x6e70=function(_0x5cedbc,_0x48fc4d){_0x5cedbc=_0x5cedbc-0x0;var _0x5d73a0=_0xe706[_0x5cedbc];return _0x5d73a0;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index c6f732a..efa5a39 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 _0x34bd=['../../config/environment','exports','UserChatQueue','user_has_chat_queues','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x43fdf8,_0x8426b3){var _0x1160c6=function(_0x281fb6){while(--_0x281fb6){_0x43fdf8['push'](_0x43fdf8['shift']());}};_0x1160c6(++_0x8426b3);}(_0x34bd,0x1d2));var _0xd34b=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x34bd[_0x1a72f3];return _0x57ef47;};'use strict';var _=require(_0xd34b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd34b('0x1'));var moment=require(_0xd34b('0x2'));var BPromise=require(_0xd34b('0x3'));var rp=require(_0xd34b('0x4'));var fs=require('fs');var path=require(_0xd34b('0x5'));var rimraf=require(_0xd34b('0x6'));var config=require(_0xd34b('0x7'));var attributes=require('./userChatQueue.attributes');module[_0xd34b('0x8')]=function(_0x5d161e,_0x4e6e94){return _0x5d161e['define'](_0xd34b('0x9'),attributes,{'tableName':_0xd34b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd677=['./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x52a90a,_0x384afc){var _0x19b954=function(_0x1b1d1e){while(--_0x1b1d1e){_0x52a90a['push'](_0x52a90a['shift']());}};_0x19b954(++_0x384afc);}(_0xd677,0x88));var _0x7d67=function(_0x430cb0,_0x860700){_0x430cb0=_0x430cb0-0x0;var _0x4e21d5=_0xd677[_0x430cb0];return _0x4e21d5;};'use strict';var _=require(_0x7d67('0x0'));var util=require('util');var logger=require(_0x7d67('0x1'))(_0x7d67('0x2'));var moment=require(_0x7d67('0x3'));var BPromise=require(_0x7d67('0x4'));var rp=require(_0x7d67('0x5'));var fs=require('fs');var path=require(_0x7d67('0x6'));var rimraf=require('rimraf');var config=require(_0x7d67('0x7'));var attributes=require(_0x7d67('0x8'));module['exports']=function(_0x46cde6,_0x2317a0){return _0x46cde6[_0x7d67('0x9')](_0x7d67('0xa'),attributes,{'tableName':_0x7d67('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 aea13c6..f3a8269 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 _0x82a4=['stringify','error','UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x585478,_0x45a6ef){var _0x3b1ea9=function(_0x4bf348){while(--_0x4bf348){_0x585478['push'](_0x585478['shift']());}};_0x3b1ea9(++_0x45a6ef);}(_0x82a4,0x17c));var _0x482a=function(_0x204c4e,_0x57f093){_0x204c4e=_0x204c4e-0x0;var _0x2c6733=_0x82a4[_0x204c4e];return _0x2c6733;};'use strict';var _=require(_0x482a('0x0'));var util=require(_0x482a('0x1'));var moment=require(_0x482a('0x2'));var BPromise=require(_0x482a('0x3'));var rs=require(_0x482a('0x4'));var fs=require('fs');var Redis=require(_0x482a('0x5'));var db=require(_0x482a('0x6'))['db'];var utils=require(_0x482a('0x7'));var logger=require(_0x482a('0x8'))('rpc');var config=require(_0x482a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x482a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a407f,_0x375244,_0x31f9a7){return new BPromise(function(_0x24ed5c,_0x36f141){return client['request'](_0x5a407f,_0x31f9a7)[_0x482a('0xb')](function(_0x5961b6){logger[_0x482a('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x375244,_0x482a('0xd'));logger[_0x482a('0xe')](_0x482a('0xf'),_0x375244,_0x482a('0xd'),JSON[_0x482a('0x10')](_0x5961b6));if(_0x5961b6['error']){if(_0x5961b6['error']['code']===0x1f4){logger[_0x482a('0x11')](_0x482a('0x12'),_0x375244,_0x5961b6[_0x482a('0x11')][_0x482a('0x13')]);return _0x36f141(_0x5961b6['error'][_0x482a('0x13')]);}logger['error'](_0x482a('0x12'),_0x375244,_0x5961b6['error'][_0x482a('0x13')]);return _0x24ed5c(_0x5961b6[_0x482a('0x11')]['message']);}else{logger[_0x482a('0xc')](_0x482a('0x12'),_0x375244,_0x482a('0xd'));_0x24ed5c(_0x5961b6[_0x482a('0x14')][_0x482a('0x13')]);}})[_0x482a('0x15')](function(_0x71aa21){logger['error'](_0x482a('0x12'),_0x375244,_0x71aa21);_0x36f141(_0x71aa21);});});} \ No newline at end of file +var _0xeaa1=['debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserChatQueue,\x20%s,\x20%s','request\x20sent'];(function(_0xce6f11,_0x3c3137){var _0x35b709=function(_0x1755c6){while(--_0x1755c6){_0xce6f11['push'](_0xce6f11['shift']());}};_0x35b709(++_0x3c3137);}(_0xeaa1,0x98));var _0x1eaa=function(_0x1c89e5,_0x45e86e){_0x1c89e5=_0x1c89e5-0x0;var _0x5b39f6=_0xeaa1[_0x1c89e5];return _0x5b39f6;};'use strict';var _=require(_0x1eaa('0x0'));var util=require('util');var moment=require(_0x1eaa('0x1'));var BPromise=require(_0x1eaa('0x2'));var rs=require(_0x1eaa('0x3'));var fs=require('fs');var Redis=require(_0x1eaa('0x4'));var db=require(_0x1eaa('0x5'))['db'];var utils=require(_0x1eaa('0x6'));var logger=require(_0x1eaa('0x7'))(_0x1eaa('0x8'));var config=require(_0x1eaa('0x9'));var jayson=require(_0x1eaa('0xa'));var client=jayson[_0x1eaa('0xb')][_0x1eaa('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4cd243,_0x444ad8,_0x4d464f){return new BPromise(function(_0x48f993,_0x36ccc8){return client['request'](_0x4cd243,_0x4d464f)['then'](function(_0x1e55ee){logger[_0x1eaa('0xd')](_0x1eaa('0xe'),_0x444ad8,_0x1eaa('0xf'));logger[_0x1eaa('0x10')](_0x1eaa('0x11'),_0x444ad8,'request\x20sent',JSON[_0x1eaa('0x12')](_0x1e55ee));if(_0x1e55ee[_0x1eaa('0x13')]){if(_0x1e55ee[_0x1eaa('0x13')][_0x1eaa('0x14')]===0x1f4){logger[_0x1eaa('0x13')](_0x1eaa('0xe'),_0x444ad8,_0x1e55ee[_0x1eaa('0x13')]['message']);return _0x36ccc8(_0x1e55ee[_0x1eaa('0x13')][_0x1eaa('0x15')]);}logger[_0x1eaa('0x13')](_0x1eaa('0xe'),_0x444ad8,_0x1e55ee[_0x1eaa('0x13')][_0x1eaa('0x15')]);return _0x48f993(_0x1e55ee[_0x1eaa('0x13')][_0x1eaa('0x15')]);}else{logger[_0x1eaa('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x444ad8,_0x1eaa('0xf'));_0x48f993(_0x1e55ee[_0x1eaa('0x16')][_0x1eaa('0x15')]);}})[_0x1eaa('0x17')](function(_0x164f8b){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x444ad8,_0x164f8b);_0x36ccc8(_0x164f8b);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 6b260d8..4fad4ec 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 _0x474e=['express','Router','../../components/interaction/service','../../config/environment','multer','path','connect-timeout'];(function(_0x2209fd,_0x5422da){var _0x2c2241=function(_0x316cf7){while(--_0x316cf7){_0x2209fd['push'](_0x2209fd['shift']());}};_0x2c2241(++_0x5422da);}(_0x474e,0x17e));var _0xe474=function(_0x1eb74d,_0x301c40){_0x1eb74d=_0x1eb74d-0x0;var _0x439ae3=_0x474e[_0x1eb74d];return _0x439ae3;};'use strict';var multer=require(_0xe474('0x0'));var util=require('util');var path=require(_0xe474('0x1'));var timeout=require(_0xe474('0x2'));var express=require(_0xe474('0x3'));var router=express[_0xe474('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe474('0x5'));var config=require(_0xe474('0x6'));module['exports']=router; \ No newline at end of file +var _0xd096=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','connect-timeout','express'];(function(_0x26bc1f,_0xeff2ac){var _0x56a4d9=function(_0x181580){while(--_0x181580){_0x26bc1f['push'](_0x26bc1f['shift']());}};_0x56a4d9(++_0xeff2ac);}(_0xd096,0x1e8));var _0x6d09=function(_0x5b5bed,_0x1095b7){_0x5b5bed=_0x5b5bed-0x0;var _0x268b3d=_0xd096[_0x5b5bed];return _0x268b3d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x6d09('0x0'));var express=require(_0x6d09('0x1'));var router=express[_0x6d09('0x2')]();var auth=require(_0x6d09('0x3'));var interaction=require(_0x6d09('0x4'));var config=require(_0x6d09('0x5'));module[_0x6d09('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index f93d054..7dbcd80 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 _0x80ed=['INTEGER','STRING','sequelize'];(function(_0x2cfee1,_0x1f4678){var _0x3bd7ae=function(_0x2af38d){while(--_0x2af38d){_0x2cfee1['push'](_0x2cfee1['shift']());}};_0x3bd7ae(++_0x1f4678);}(_0x80ed,0x11c));var _0xd80e=function(_0x2662ea,_0x543a9b){_0x2662ea=_0x2662ea-0x0;var _0x5c1a53=_0x80ed[_0x2662ea];return _0x5c1a53;};'use strict';var Sequelize=require(_0xd80e('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xd80e('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xd80e('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xd80e('0x2')]}}; \ No newline at end of file +var _0x8e3f=['STRING','sequelize','exports','INTEGER'];(function(_0x24f573,_0x361d1b){var _0x138e7b=function(_0x254c9d){while(--_0x254c9d){_0x24f573['push'](_0x24f573['shift']());}};_0x138e7b(++_0x361d1b);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8e3f[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xf8e3('0x0'));module[_0xf8e3('0x1')]={'penalty':{'type':Sequelize[_0xf8e3('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xf8e3('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 478b853..a8c6fa7 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 _0x39ca=['define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x39ca,0xb7));var _0xa39c=function(_0x3b711c,_0x4b22dc){_0x3b711c=_0x3b711c-0x0;var _0x2685f0=_0x39ca[_0x3b711c];return _0x2685f0;};'use strict';var _=require(_0xa39c('0x0'));var util=require(_0xa39c('0x1'));var logger=require(_0xa39c('0x2'))(_0xa39c('0x3'));var moment=require(_0xa39c('0x4'));var BPromise=require(_0xa39c('0x5'));var rp=require(_0xa39c('0x6'));var fs=require('fs');var path=require(_0xa39c('0x7'));var rimraf=require(_0xa39c('0x8'));var config=require(_0xa39c('0x9'));var attributes=require(_0xa39c('0xa'));module[_0xa39c('0xb')]=function(_0x26d6e5,_0x5e34cf){return _0x26d6e5[_0xa39c('0xc')](_0xa39c('0xd'),attributes,{'tableName':_0xa39c('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6a0=['util','api','moment','request-promise','path','rimraf','./userFaxQueue.attributes','user_has_fax_queues'];(function(_0x50d94b,_0x1fda85){var _0x4e1fa3=function(_0x213929){while(--_0x213929){_0x50d94b['push'](_0x50d94b['shift']());}};_0x4e1fa3(++_0x1fda85);}(_0xb6a0,0xf0));var _0x0b6a=function(_0x2eb254,_0x5f283c){_0x2eb254=_0x2eb254-0x0;var _0x537017=_0xb6a0[_0x2eb254];return _0x537017;};'use strict';var _=require('lodash');var util=require(_0x0b6a('0x0'));var logger=require('../../config/logger')(_0x0b6a('0x1'));var moment=require(_0x0b6a('0x2'));var BPromise=require('bluebird');var rp=require(_0x0b6a('0x3'));var fs=require('fs');var path=require(_0x0b6a('0x4'));var rimraf=require(_0x0b6a('0x5'));var config=require('../../config/environment');var attributes=require(_0x0b6a('0x6'));module['exports']=function(_0x3f6ef3,_0x2ed045){return _0x3f6ef3['define']('UserFaxQueue',attributes,{'tableName':_0x0b6a('0x7'),'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 01fba25..912c2b9 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 _0x6f12=['../../config/utils','../../config/logger','rpc','../../config/environment','client','info','UserFaxQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x6f12,0x86));var _0x26f1=function(_0x53c866,_0x4e1b69){_0x53c866=_0x53c866-0x0;var _0x23d503=_0x6f12[_0x53c866];return _0x23d503;};'use strict';var _=require(_0x26f1('0x0'));var util=require('util');var moment=require(_0x26f1('0x1'));var BPromise=require(_0x26f1('0x2'));var rs=require(_0x26f1('0x3'));var fs=require('fs');var Redis=require(_0x26f1('0x4'));var db=require(_0x26f1('0x5'))['db'];var utils=require(_0x26f1('0x6'));var logger=require(_0x26f1('0x7'))(_0x26f1('0x8'));var config=require(_0x26f1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x26f1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa5c21d,_0x2da597,_0x5047d8){return new BPromise(function(_0x43f47d,_0x4883ad){return client['request'](_0xa5c21d,_0x5047d8)['then'](function(_0x245122){logger[_0x26f1('0xb')](_0x26f1('0xc'),_0x2da597,'request\x20sent');logger[_0x26f1('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x2da597,_0x26f1('0xe'),JSON[_0x26f1('0xf')](_0x245122));if(_0x245122['error']){if(_0x245122[_0x26f1('0x10')]['code']===0x1f4){logger[_0x26f1('0x10')](_0x26f1('0xc'),_0x2da597,_0x245122[_0x26f1('0x10')][_0x26f1('0x11')]);return _0x4883ad(_0x245122['error'][_0x26f1('0x11')]);}logger[_0x26f1('0x10')](_0x26f1('0xc'),_0x2da597,_0x245122[_0x26f1('0x10')][_0x26f1('0x11')]);return _0x43f47d(_0x245122[_0x26f1('0x10')]['message']);}else{logger['info'](_0x26f1('0xc'),_0x2da597,_0x26f1('0xe'));_0x43f47d(_0x245122[_0x26f1('0x12')][_0x26f1('0x11')]);}})[_0x26f1('0x13')](function(_0x16989){logger[_0x26f1('0x10')](_0x26f1('0xc'),_0x2da597,_0x16989);_0x4883ad(_0x16989);});});} \ No newline at end of file +var _0xa332=['result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','debug','request\x20sent','error','code','UserFaxQueue,\x20%s,\x20%s','message'];(function(_0x16e4cb,_0x197931){var _0x2b61b6=function(_0x1509c2){while(--_0x1509c2){_0x16e4cb['push'](_0x16e4cb['shift']());}};_0x2b61b6(++_0x197931);}(_0xa332,0x1ce));var _0x2a33=function(_0xbb0bf8,_0x44b827){_0xbb0bf8=_0xbb0bf8-0x0;var _0x33ba75=_0xa332[_0xbb0bf8];return _0x33ba75;};'use strict';var _=require(_0x2a33('0x0'));var util=require(_0x2a33('0x1'));var moment=require(_0x2a33('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a33('0x3'))['db'];var utils=require(_0x2a33('0x4'));var logger=require(_0x2a33('0x5'))('rpc');var config=require(_0x2a33('0x6'));var jayson=require(_0x2a33('0x7'));var client=jayson[_0x2a33('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59f6a4,_0x3dd06b,_0x39e476){return new BPromise(function(_0xa7cfbc,_0x179928){return client[_0x2a33('0x9')](_0x59f6a4,_0x39e476)[_0x2a33('0xa')](function(_0x4be2ca){logger[_0x2a33('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x3dd06b,'request\x20sent');logger[_0x2a33('0xc')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x3dd06b,_0x2a33('0xd'),JSON['stringify'](_0x4be2ca));if(_0x4be2ca[_0x2a33('0xe')]){if(_0x4be2ca[_0x2a33('0xe')][_0x2a33('0xf')]===0x1f4){logger[_0x2a33('0xe')](_0x2a33('0x10'),_0x3dd06b,_0x4be2ca[_0x2a33('0xe')][_0x2a33('0x11')]);return _0x179928(_0x4be2ca[_0x2a33('0xe')][_0x2a33('0x11')]);}logger[_0x2a33('0xe')](_0x2a33('0x10'),_0x3dd06b,_0x4be2ca[_0x2a33('0xe')][_0x2a33('0x11')]);return _0xa7cfbc(_0x4be2ca[_0x2a33('0xe')][_0x2a33('0x11')]);}else{logger[_0x2a33('0xb')](_0x2a33('0x10'),_0x3dd06b,_0x2a33('0xd'));_0xa7cfbc(_0x4be2ca[_0x2a33('0x12')][_0x2a33('0x11')]);}})[_0x2a33('0x13')](function(_0x254d30){logger[_0x2a33('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x3dd06b,_0x254d30);_0x179928(_0x254d30);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 6fb2d60..488b514 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 _0x4a9a=['Router','../../components/interaction/service','../../config/environment','util','path','express'];(function(_0x4f66ef,_0x3d47ef){var _0x34c6ec=function(_0x449aaf){while(--_0x449aaf){_0x4f66ef['push'](_0x4f66ef['shift']());}};_0x34c6ec(++_0x3d47ef);}(_0x4a9a,0x123));var _0xa4a9=function(_0x58a02f,_0x113e34){_0x58a02f=_0x58a02f-0x0;var _0x37c115=_0x4a9a[_0x58a02f];return _0x37c115;};'use strict';var multer=require('multer');var util=require(_0xa4a9('0x0'));var path=require(_0xa4a9('0x1'));var timeout=require('connect-timeout');var express=require(_0xa4a9('0x2'));var router=express[_0xa4a9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa4a9('0x4'));var config=require(_0xa4a9('0x5'));module['exports']=router; \ No newline at end of file +var _0xce35=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x32ed1f,_0x15ea8f){var _0x4e9fbe=function(_0x148366){while(--_0x148366){_0x32ed1f['push'](_0x32ed1f['shift']());}};_0x4e9fbe(++_0x15ea8f);}(_0xce35,0x1a8));var _0x5ce3=function(_0x40fbc4,_0x3ef673){_0x40fbc4=_0x40fbc4-0x0;var _0x4aaca7=_0xce35[_0x40fbc4];return _0x4aaca7;};'use strict';var multer=require(_0x5ce3('0x0'));var util=require(_0x5ce3('0x1'));var path=require(_0x5ce3('0x2'));var timeout=require(_0x5ce3('0x3'));var express=require(_0x5ce3('0x4'));var router=express['Router']();var auth=require(_0x5ce3('0x5'));var interaction=require(_0x5ce3('0x6'));var config=require(_0x5ce3('0x7'));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 a83b8f1..3d035a6 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x19bdf5,_0x3a6395){var _0x140930=function(_0x1b1a19){while(--_0x1b1a19){_0x19bdf5['push'](_0x19bdf5['shift']());}};_0x140930(++_0x3a6395);}(_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(_0x570990,_0x483310){var _0x2ebad9=function(_0x8271ad){while(--_0x8271ad){_0x570990['push'](_0x570990['shift']());}};_0x2ebad9(++_0x483310);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index c90501a..9588453 100644 --- a/server/api/userMailQueue/userMailQueue.model.js +++ b/server/api/userMailQueue/userMailQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['user_has_mail_queues','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue'];(function(_0xd4dc58,_0x1638a0){var _0xba87f1=function(_0x1e62ee){while(--_0x1e62ee){_0xd4dc58['push'](_0xd4dc58['shift']());}};_0xba87f1(++_0x1638a0);}(_0x2032,0xd9));var _0x2203=function(_0x599556,_0x470f66){_0x599556=_0x599556-0x0;var _0x3f6182=_0x2032[_0x599556];return _0x3f6182;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var attributes=require(_0x2203('0x7'));module[_0x2203('0x8')]=function(_0x3f7ba1,_0x13367a){return _0x3f7ba1[_0x2203('0x9')](_0x2203('0xa'),attributes,{'tableName':_0x2203('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['define','user_has_mail_queues','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports'];(function(_0x60878f,_0x1166d3){var _0x1fbefb=function(_0x375d8c){while(--_0x375d8c){_0x60878f['push'](_0x60878f['shift']());}};_0x1fbefb(++_0x1166d3);}(_0x757a,0xde));var _0xa757=function(_0x9e13e9,_0x87ed46){_0x9e13e9=_0x9e13e9-0x0;var _0x3694d9=_0x757a[_0x9e13e9];return _0x3694d9;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('UserMailQueue',attributes,{'tableName':_0xa757('0x9'),'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 c4b53b6..4811044 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 _0x6bfc=['error','message','result','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x4f1820,_0x1a7a89){var _0x42ef0e=function(_0x2a9aa1){while(--_0x2a9aa1){_0x4f1820['push'](_0x4f1820['shift']());}};_0x42ef0e(++_0x1a7a89);}(_0x6bfc,0x159));var _0xc6bf=function(_0x2fc428,_0x1de237){_0x2fc428=_0x2fc428-0x0;var _0x4e53ef=_0x6bfc[_0x2fc428];return _0x4e53ef;};'use strict';var _=require('lodash');var util=require(_0xc6bf('0x0'));var moment=require(_0xc6bf('0x1'));var BPromise=require(_0xc6bf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc6bf('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc6bf('0x4'));var logger=require('../../config/logger')(_0xc6bf('0x5'));var config=require(_0xc6bf('0x6'));var jayson=require(_0xc6bf('0x7'));var client=jayson['client'][_0xc6bf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c9049,_0x47039a,_0x28d218){return new BPromise(function(_0x250311,_0x3b2815){return client[_0xc6bf('0x9')](_0x2c9049,_0x28d218)[_0xc6bf('0xa')](function(_0x52dac0){logger[_0xc6bf('0xb')](_0xc6bf('0xc'),_0x47039a,_0xc6bf('0xd'));logger[_0xc6bf('0xe')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x47039a,'request\x20sent',JSON[_0xc6bf('0xf')](_0x52dac0));if(_0x52dac0[_0xc6bf('0x10')]){if(_0x52dac0['error']['code']===0x1f4){logger[_0xc6bf('0x10')](_0xc6bf('0xc'),_0x47039a,_0x52dac0['error'][_0xc6bf('0x11')]);return _0x3b2815(_0x52dac0[_0xc6bf('0x10')][_0xc6bf('0x11')]);}logger[_0xc6bf('0x10')](_0xc6bf('0xc'),_0x47039a,_0x52dac0['error']['message']);return _0x250311(_0x52dac0[_0xc6bf('0x10')][_0xc6bf('0x11')]);}else{logger[_0xc6bf('0xb')](_0xc6bf('0xc'),_0x47039a,_0xc6bf('0xd'));_0x250311(_0x52dac0[_0xc6bf('0x12')][_0xc6bf('0x11')]);}})['catch'](function(_0x23498a){logger['error']('UserMailQueue,\x20%s,\x20%s',_0x47039a,_0x23498a);_0x3b2815(_0x23498a);});});} \ No newline at end of file +var _0x5e17=['message','UserMailQueue,\x20%s,\x20%s','result','catch','lodash','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x5c1b6c,_0x12c5e7){var _0xbed2c0=function(_0x35d2b9){while(--_0x35d2b9){_0x5c1b6c['push'](_0x5c1b6c['shift']());}};_0xbed2c0(++_0x12c5e7);}(_0x5e17,0x17a));var _0x75e1=function(_0x37266b,_0x31a43d){_0x37266b=_0x37266b-0x0;var _0x27dd57=_0x5e17[_0x37266b];return _0x27dd57;};'use strict';var _=require(_0x75e1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x75e1('0x1'))['db'];var utils=require(_0x75e1('0x2'));var logger=require(_0x75e1('0x3'))(_0x75e1('0x4'));var config=require(_0x75e1('0x5'));var jayson=require(_0x75e1('0x6'));var client=jayson[_0x75e1('0x7')][_0x75e1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb1af59,_0x36e724,_0x689ac3){return new BPromise(function(_0x1eecde,_0x23fab8){return client[_0x75e1('0x9')](_0xb1af59,_0x689ac3)[_0x75e1('0xa')](function(_0x57e230){logger[_0x75e1('0xb')]('UserMailQueue,\x20%s,\x20%s',_0x36e724,'request\x20sent');logger[_0x75e1('0xc')](_0x75e1('0xd'),_0x36e724,_0x75e1('0xe'),JSON[_0x75e1('0xf')](_0x57e230));if(_0x57e230[_0x75e1('0x10')]){if(_0x57e230[_0x75e1('0x10')][_0x75e1('0x11')]===0x1f4){logger[_0x75e1('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x36e724,_0x57e230[_0x75e1('0x10')][_0x75e1('0x12')]);return _0x23fab8(_0x57e230[_0x75e1('0x10')]['message']);}logger[_0x75e1('0x10')](_0x75e1('0x13'),_0x36e724,_0x57e230[_0x75e1('0x10')][_0x75e1('0x12')]);return _0x1eecde(_0x57e230['error'][_0x75e1('0x12')]);}else{logger[_0x75e1('0xb')](_0x75e1('0x13'),_0x36e724,_0x75e1('0xe'));_0x1eecde(_0x57e230[_0x75e1('0x14')][_0x75e1('0x12')]);}})[_0x75e1('0x15')](function(_0x56c741){logger[_0x75e1('0x10')](_0x75e1('0x13'),_0x36e724,_0x56c741);_0x23fab8(_0x56c741);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 093a3d7..cc65a8d 100644 --- a/server/api/userNotification/index.js +++ b/server/api/userNotification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ee4=['../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','multer','path','connect-timeout','Router','../../components/auth/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3ee4,0x13a));var _0x43ee=function(_0x2e751f,_0x2cfb6d){_0x2e751f=_0x2e751f-0x0;var _0x2ec570=_0x3ee4[_0x2e751f];return _0x2ec570;};'use strict';var multer=require(_0x43ee('0x0'));var util=require('util');var path=require(_0x43ee('0x1'));var timeout=require(_0x43ee('0x2'));var express=require('express');var router=express[_0x43ee('0x3')]();var auth=require(_0x43ee('0x4'));var interaction=require(_0x43ee('0x5'));var config=require(_0x43ee('0x6'));var controller=require(_0x43ee('0x7'));router[_0x43ee('0x8')]('/',auth[_0x43ee('0x9')](),controller[_0x43ee('0xa')]);module['exports']=router; \ No newline at end of file +var _0xb333=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','util'];(function(_0x4ecbdb,_0x22c609){var _0x2333b1=function(_0x5833ad){while(--_0x5833ad){_0x4ecbdb['push'](_0x4ecbdb['shift']());}};_0x2333b1(++_0x22c609);}(_0xb333,0xce));var _0x3b33=function(_0x3055bf,_0x1d6916){_0x3055bf=_0x3055bf-0x0;var _0x20be19=_0xb333[_0x3055bf];return _0x20be19;};'use strict';var multer=require(_0x3b33('0x0'));var util=require(_0x3b33('0x1'));var path=require(_0x3b33('0x2'));var timeout=require(_0x3b33('0x3'));var express=require('express');var router=express[_0x3b33('0x4')]();var auth=require(_0x3b33('0x5'));var interaction=require(_0x3b33('0x6'));var config=require(_0x3b33('0x7'));var controller=require(_0x3b33('0x8'));router[_0x3b33('0x9')]('/',auth[_0x3b33('0xa')](),controller[_0x3b33('0xb')]);module[_0x3b33('0xc')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 2488c03..80fa006 100644 --- a/server/api/userNotification/userNotification.attributes.js +++ b/server/api/userNotification/userNotification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe94b=['exports','TEXT','STRING'];(function(_0x152aa1,_0x307718){var _0x1bc01a=function(_0xd3211e){while(--_0xd3211e){_0x152aa1['push'](_0x152aa1['shift']());}};_0x1bc01a(++_0x307718);}(_0xe94b,0xea));var _0xbe94=function(_0x2e4a0f,_0x244837){_0x2e4a0f=_0x2e4a0f-0x0;var _0xea8d39=_0xe94b[_0x2e4a0f];return _0xea8d39;};'use strict';var Sequelize=require('sequelize');module[_0xbe94('0x0')]={'body':{'type':Sequelize[_0xbe94('0x1')]},'senderName':{'type':Sequelize[_0xbe94('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xbe94('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0xa686=['STRING','TEXT','sequelize'];(function(_0x3c0fb0,_0x30329f){var _0x726751=function(_0x177806){while(--_0x177806){_0x3c0fb0['push'](_0x3c0fb0['shift']());}};_0x726751(++_0x30329f);}(_0xa686,0x152));var _0x6a68=function(_0x1882e2,_0x35b10c){_0x1882e2=_0x1882e2-0x0;var _0x229a77=_0xa686[_0x1882e2];return _0x229a77;};'use strict';var Sequelize=require(_0x6a68('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x6a68('0x1')]},'recipientsId':{'type':Sequelize[_0x6a68('0x2')]},'recipientsDescription':{'type':Sequelize[_0x6a68('0x1')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index bd5aa1e..2cd0d8a 100644 --- a/server/api/userNotification/userNotification.controller.js +++ b/server/api/userNotification/userNotification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d46=['hasOwnProperty','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','senderName','fullname','recipientsDescription','isEmpty','beep','recipientsId','sortBy','join','sequelize','transaction','UserNotification','forEach','recipient','emit','userNotification:send','catch','Template','findOne','startCase','model','union','ids','queue','push','all','flatten','getAgents','map','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','json','count','offset','limit','status','set','Content-Range','apply','reject','then','destroy','sendStatus','name','send','sendUserNotification','body','text'];(function(_0x5469d3,_0x56f223){var _0x30ab7e=function(_0x21231a){while(--_0x21231a){_0x5469d3['push'](_0x5469d3['shift']());}};_0x30ab7e(++_0x56f223);}(_0x4d46,0x1ad));var _0x64d4=function(_0xc498b3,_0x5610b4){_0xc498b3=_0xc498b3-0x0;var _0x1e2530=_0x4d46[_0xc498b3];return _0x1e2530;};'use strict';var pdf=require(_0x64d4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x64d4('0x1'));var zipdir=require(_0x64d4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x64d4('0x3'));var moment=require(_0x64d4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x64d4('0x5'));var util=require(_0x64d4('0x6'));var path=require(_0x64d4('0x7'));var sox=require(_0x64d4('0x8'));var csv=require(_0x64d4('0x9'));var ejs=require(_0x64d4('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x64d4('0xb'));var jsforce=require(_0x64d4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x64d4('0xd'));var Papa=require('papaparse');var Redis=require(_0x64d4('0xe'));var authService=require(_0x64d4('0xf'));var qs=require(_0x64d4('0x10'));var as=require(_0x64d4('0x11'));var hardwareService=require(_0x64d4('0x12'));var logger=require(_0x64d4('0x13'))(_0x64d4('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x64d4('0x15'));var db=require(_0x64d4('0x16'))['db'];config[_0x64d4('0x17')]=_[_0x64d4('0x18')](config['redis'],{'host':_0x64d4('0x19'),'port':0x18eb});var socket=require(_0x64d4('0x1a'))(new Redis(config[_0x64d4('0x17')]));require(_0x64d4('0x1b'))[_0x64d4('0x1c')](socket);function respondWithStatusCode(_0x19d2dd,_0x28f031){_0x28f031=_0x28f031||0xcc;return function(_0x41006e){if(_0x41006e){return _0x19d2dd['sendStatus'](_0x28f031);}return _0x19d2dd['status'](_0x28f031)['end']();};}function respondWithResult(_0x2de70a,_0x3bae9d){_0x3bae9d=_0x3bae9d||0xc8;return function(_0x43eae0){if(_0x43eae0){return _0x2de70a['status'](_0x3bae9d)[_0x64d4('0x1d')](_0x43eae0);}};}function respondWithFilteredResult(_0xf14e98,_0x23657f){return function(_0x69abef){if(_0x69abef){var _0x512390=_0x69abef[_0x64d4('0x1e')],_0x13b627=_0x23657f[_0x64d4('0x1f')],_0x2b4ded=_0x23657f[_0x64d4('0x1f')]+_0x23657f[_0x64d4('0x20')],_0x51cda5;if(_0x2b4ded>=_0x512390){_0x2b4ded=_0x512390;_0x51cda5=0xc8;}else{_0x51cda5=0xce;}_0xf14e98[_0x64d4('0x21')](_0x51cda5);return _0xf14e98[_0x64d4('0x22')](_0x64d4('0x23'),_0x13b627+'-'+_0x2b4ded+'/'+_0x512390)[_0x64d4('0x1d')](_0x69abef);}return null;};}function patchUpdates(_0x4d1f7d){return function(_0xd9dd17){try{jsonpatch[_0x64d4('0x24')](_0xd9dd17,_0x4d1f7d,!![]);}catch(_0x3f60f4){return BPromise[_0x64d4('0x25')](_0x3f60f4);}return _0xd9dd17['save']();};}function saveUpdates(_0x5b5fbe,_0x1f4ded){return function(_0xf74809){if(_0xf74809){return _0xf74809['update'](_0x5b5fbe)[_0x64d4('0x26')](function(_0x5586af){return _0x5586af;});}return null;};}function removeEntity(_0xa22c59,_0x2de663){return function(_0x23d26e){if(_0x23d26e){return _0x23d26e[_0x64d4('0x27')]()[_0x64d4('0x26')](function(){_0xa22c59['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x40b984,_0x466d33){return function(_0x696241){if(!_0x696241){_0x40b984[_0x64d4('0x28')](0x194);}return _0x696241;};}function handleError(_0x2b9b0b,_0x4843d2){_0x4843d2=_0x4843d2||0x1f4;return function(_0x224e53){logger['error'](_0x224e53['stack']);if(_0x224e53[_0x64d4('0x29')]){delete _0x224e53[_0x64d4('0x29')];}_0x2b9b0b['status'](_0x4843d2)[_0x64d4('0x2a')](_0x224e53);};}exports[_0x64d4('0x2b')]=function(_0x476446,_0x50c101,_0x2309b9){if(!_0x476446[_0x64d4('0x2c')]['hasOwnProperty'](_0x64d4('0x2d'))&&!_0x476446[_0x64d4('0x2c')][_0x64d4('0x2e')](_0x64d4('0x2f'))){throw new db[(_0x64d4('0x30'))][(_0x64d4('0x31'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x476446[_0x64d4('0x2c')][_0x64d4('0x2e')](_0x64d4('0x2f'))&&!_0x476446[_0x64d4('0x2c')]['hasOwnProperty'](_0x64d4('0x32'))){throw new db[(_0x64d4('0x30'))][(_0x64d4('0x31'))](_0x64d4('0x33'));}if(!_0x476446[_0x64d4('0x2c')][_0x64d4('0x2e')]('recipients')){throw new db[(_0x64d4('0x30'))]['ValidationError'](_0x64d4('0x34'));}else{try{var _0x37f2b8=JSON[_0x64d4('0x35')](_0x476446['body'][_0x64d4('0x36')]);}catch(_0x1edb8d){logger[_0x64d4('0x37')](_0x1edb8d);throw new db[(_0x64d4('0x30'))]['ValidationError'](_0x64d4('0x38'));}var _0x3885dc=[_0x64d4('0x39'),_0x64d4('0x3a'),'mailqueue',_0x64d4('0x3b'),_0x64d4('0x3c'),_0x64d4('0x3d'),_0x64d4('0x3e'),_0x64d4('0x3f'),_0x64d4('0x40')];if(_[_0x64d4('0x41')](_0x37f2b8,function(_0x443c67){return!_[_0x64d4('0x42')](_0x3885dc,_0x443c67['model']['toLowerCase']());})){throw new db[(_0x64d4('0x30'))][(_0x64d4('0x31'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x3d36dc={};_0x3d36dc['senderName']=_0x476446[_0x64d4('0x2c')][_0x64d4('0x2e')](_0x64d4('0x43'))?_0x476446[_0x64d4('0x2c')][_0x64d4('0x43')]:_0x476446[_0x64d4('0x40')][_0x64d4('0x44')];_0x3d36dc[_0x64d4('0x45')]=_[_0x64d4('0x46')](_0x476446[_0x64d4('0x2c')][_0x64d4('0x45')])?null:_0x476446[_0x64d4('0x2c')]['recipientsDescription'];_0x3d36dc[_0x64d4('0x47')]=_0x476446[_0x64d4('0x2c')][_0x64d4('0x47')]||![];_0x3d36dc['SenderId']=_0x476446[_0x64d4('0x40')]['id'];return getContent(_0x476446[_0x64d4('0x2c')])['then'](function(_0x5cd56f){_0x3d36dc[_0x64d4('0x2c')]=_0x5cd56f;return getRecipients(_0x37f2b8);})[_0x64d4('0x26')](function(_0x38e1cf){_0x3d36dc[_0x64d4('0x48')]=_[_0x64d4('0x49')](_0x38e1cf)[_0x64d4('0x4a')](',');return db[_0x64d4('0x4b')][_0x64d4('0x4c')](function(_0x13ddcc){return db[_0x64d4('0x4d')]['create'](_0x3d36dc,{'raw':!![],'transaction':_0x13ddcc})[_0x64d4('0x26')](function(_0x1cc84e){var _0x3d8851={'sender':_0x3d36dc['senderName'],'description':_0x3d36dc[_0x64d4('0x45')],'content':_0x3d36dc[_0x64d4('0x2c')],'beep':_0x3d36dc[_0x64d4('0x47')]};_0x38e1cf[_0x64d4('0x4e')](function(_0x190854){_0x3d8851[_0x64d4('0x4f')]=_0x190854;socket[_0x64d4('0x50')](_0x64d4('0x51'),_0x3d8851);});return _0x1cc84e;});});})[_0x64d4('0x26')](respondWithResult(_0x50c101,0xc9))[_0x64d4('0x52')](handleError(_0x50c101,null));};function getContent(_0x41e0a8){return new BPromise(function(_0x27d00a,_0x479e7b){if(_0x41e0a8['text']){_0x27d00a(_0x41e0a8[_0x64d4('0x2d')]);return;}return db[_0x64d4('0x53')][_0x64d4('0x54')]({'attributes':['html'],'where':{'id':_0x41e0a8[_0x64d4('0x2f')]},'raw':!![]})[_0x64d4('0x26')](function(_0x556bb1){if(!_0x556bb1)throw new db['Sequelize'][(_0x64d4('0x31'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x205c48=Mustache['render'](_0x556bb1['html'],_0x41e0a8[_0x64d4('0x32')]);_0x27d00a(_0x205c48);})['catch'](function(_0x3dac1f){_0x479e7b(_0x3dac1f);});});}function getRecipients(_0x305458){return new BPromise(function(_0x50c65e,_0x348356){var _0xcbc33a=[];var _0x955cac=[];_0x305458['forEach'](function(_0x5c7c9){var _0x5d690f=_[_0x64d4('0x55')](_0x5c7c9[_0x64d4('0x56')]['toLowerCase']());if(_0x5d690f==='User'){_0xcbc33a=_[_0x64d4('0x57')](_0xcbc33a,_0x5c7c9[_0x64d4('0x58')]);}else{if(_[_0x64d4('0x42')](_0x5d690f,_0x64d4('0x59')))_0x5d690f=_0x5d690f['replace'](_0x64d4('0x59'),'Queue');_0x5c7c9['ids'][_0x64d4('0x4e')](function(_0xd75953){_0x955cac[_0x64d4('0x5a')](getAgents(_0x5d690f,_0xd75953));});}});return BPromise[_0x64d4('0x5b')](_0x955cac)[_0x64d4('0x26')](function(_0x203192){_0xcbc33a=_[_0x64d4('0x57')](_0xcbc33a,_[_0x64d4('0x5c')](_0x203192));_0x50c65e(_0xcbc33a);})[_0x64d4('0x52')](function(_0x4b1b31){_0x348356(_0x4b1b31);});});}function getAgents(_0x5aab5c,_0x915569){return new BPromise(function(_0x5c2fea,_0x36dff4){return db[_0x5aab5c][_0x64d4('0x54')]({'where':{'id':_0x915569}})['then'](function(_0xc8885d){return _0xc8885d[_0x64d4('0x5d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3072c5){var _0x2bebd7=_[_0x64d4('0x5e')](_0x3072c5,'id');_0x5c2fea(_0x2bebd7);});})[_0x64d4('0x52')](function(_0x9c21df){_0x36dff4(_0x9c21df);});});} \ No newline at end of file +var _0x73df=['apply','reject','save','update','error','stack','name','send','sendUserNotification','text','body','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','hasOwnProperty','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','team','user','some','includes','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','then','recipientsId','join','transaction','forEach','recipient','emit','userNotification:send','catch','findOne','html','TemplateId','Invalid\x20\x27TemplateId\x27\x20parameter','render','model','User','union','ids','queue','replace','Queue','all','flatten','getAgents','map','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','end','status','json','offset','Content-Range'];(function(_0x525069,_0x2c2fe8){var _0x21a499=function(_0x21f513){while(--_0x21f513){_0x525069['push'](_0x525069['shift']());}};_0x21a499(++_0x2c2fe8);}(_0x73df,0x1ca));var _0xf73d=function(_0x258df2,_0x4eddd1){_0x258df2=_0x258df2-0x0;var _0x2600ef=_0x73df[_0x258df2];return _0x2600ef;};'use strict';var pdf=require(_0xf73d('0x0'));var emlformat=require(_0xf73d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf73d('0x2'));var jsonpatch=require(_0xf73d('0x3'));var rp=require(_0xf73d('0x4'));var moment=require(_0xf73d('0x5'));var BPromise=require(_0xf73d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf73d('0x7'));var sox=require(_0xf73d('0x8'));var csv=require('to-csv');var ejs=require(_0xf73d('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf73d('0xa'));var crypto=require(_0xf73d('0xb'));var jsforce=require(_0xf73d('0xc'));var deskjs=require(_0xf73d('0xd'));var toCsv=require(_0xf73d('0xe'));var querystring=require('querystring');var Papa=require(_0xf73d('0xf'));var Redis=require(_0xf73d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf73d('0x11'));var as=require(_0xf73d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf73d('0x13'))(_0xf73d('0x14'));var utils=require(_0xf73d('0x15'));var config=require(_0xf73d('0x16'));var licenseUtil=require(_0xf73d('0x17'));var db=require(_0xf73d('0x18'))['db'];config[_0xf73d('0x19')]=_[_0xf73d('0x1a')](config[_0xf73d('0x19')],{'host':_0xf73d('0x1b'),'port':0x18eb});var socket=require(_0xf73d('0x1c'))(new Redis(config['redis']));require(_0xf73d('0x1d'))[_0xf73d('0x1e')](socket);function respondWithStatusCode(_0x8ea04d,_0x4b0a28){_0x4b0a28=_0x4b0a28||0xcc;return function(_0x23109e){if(_0x23109e){return _0x8ea04d[_0xf73d('0x1f')](_0x4b0a28);}return _0x8ea04d['status'](_0x4b0a28)[_0xf73d('0x20')]();};}function respondWithResult(_0x4ab2c8,_0x59eca4){_0x59eca4=_0x59eca4||0xc8;return function(_0x37206f){if(_0x37206f){return _0x4ab2c8[_0xf73d('0x21')](_0x59eca4)[_0xf73d('0x22')](_0x37206f);}};}function respondWithFilteredResult(_0x3aac15,_0x9e1736){return function(_0x1cf97e){if(_0x1cf97e){var _0x5e8afe=_0x1cf97e['count'],_0x3aa1e9=_0x9e1736['offset'],_0x44851c=_0x9e1736[_0xf73d('0x23')]+_0x9e1736['limit'],_0x2b00df;if(_0x44851c>=_0x5e8afe){_0x44851c=_0x5e8afe;_0x2b00df=0xc8;}else{_0x2b00df=0xce;}_0x3aac15[_0xf73d('0x21')](_0x2b00df);return _0x3aac15['set'](_0xf73d('0x24'),_0x3aa1e9+'-'+_0x44851c+'/'+_0x5e8afe)[_0xf73d('0x22')](_0x1cf97e);}return null;};}function patchUpdates(_0x2f056a){return function(_0x50a348){try{jsonpatch[_0xf73d('0x25')](_0x50a348,_0x2f056a,!![]);}catch(_0x479334){return BPromise[_0xf73d('0x26')](_0x479334);}return _0x50a348[_0xf73d('0x27')]();};}function saveUpdates(_0x24ad24,_0x1b2e66){return function(_0x5af28f){if(_0x5af28f){return _0x5af28f[_0xf73d('0x28')](_0x24ad24)['then'](function(_0x3d29b0){return _0x3d29b0;});}return null;};}function removeEntity(_0x39f06d,_0x4beb12){return function(_0x3569e2){if(_0x3569e2){return _0x3569e2['destroy']()['then'](function(){_0x39f06d[_0xf73d('0x21')](0xcc)[_0xf73d('0x20')]();});}};}function handleEntityNotFound(_0x5b3e7a,_0x12c3fe){return function(_0x33e8b6){if(!_0x33e8b6){_0x5b3e7a[_0xf73d('0x1f')](0x194);}return _0x33e8b6;};}function handleError(_0x15eefa,_0x535b52){_0x535b52=_0x535b52||0x1f4;return function(_0x2ff700){logger[_0xf73d('0x29')](_0x2ff700[_0xf73d('0x2a')]);if(_0x2ff700['name']){delete _0x2ff700[_0xf73d('0x2b')];}_0x15eefa[_0xf73d('0x21')](_0x535b52)[_0xf73d('0x2c')](_0x2ff700);};}exports[_0xf73d('0x2d')]=function(_0x57cb36,_0x183af3,_0x2cad9f){if(!_0x57cb36['body']['hasOwnProperty'](_0xf73d('0x2e'))&&!_0x57cb36[_0xf73d('0x2f')]['hasOwnProperty']('TemplateId')){throw new db['Sequelize'][(_0xf73d('0x30'))](_0xf73d('0x31'));}else{if(_0x57cb36['body'][_0xf73d('0x32')]('TemplateId')&&!_0x57cb36[_0xf73d('0x2f')][_0xf73d('0x32')](_0xf73d('0x33'))){throw new db[(_0xf73d('0x34'))][(_0xf73d('0x30'))](_0xf73d('0x35'));}if(!_0x57cb36[_0xf73d('0x2f')][_0xf73d('0x32')](_0xf73d('0x36'))){throw new db['Sequelize']['ValidationError'](_0xf73d('0x37'));}else{try{var _0x4c7e13=JSON[_0xf73d('0x38')](_0x57cb36[_0xf73d('0x2f')][_0xf73d('0x36')]);}catch(_0x57788c){logger[_0xf73d('0x29')](_0x57788c);throw new db[(_0xf73d('0x34'))]['ValidationError'](_0xf73d('0x39'));}var _0x272760=[_0xf73d('0x3a'),_0xf73d('0x3b'),_0xf73d('0x3c'),_0xf73d('0x3d'),_0xf73d('0x3e'),_0xf73d('0x3f'),'whatsappqueue',_0xf73d('0x40'),_0xf73d('0x41')];if(_[_0xf73d('0x42')](_0x4c7e13,function(_0x1eab45){return!_[_0xf73d('0x43')](_0x272760,_0x1eab45['model']['toLowerCase']());})){throw new db[(_0xf73d('0x34'))][(_0xf73d('0x30'))](_0xf73d('0x44'));}}}var _0x2aae89={};_0x2aae89[_0xf73d('0x45')]=_0x57cb36[_0xf73d('0x2f')][_0xf73d('0x32')](_0xf73d('0x45'))?_0x57cb36['body']['senderName']:_0x57cb36[_0xf73d('0x41')][_0xf73d('0x46')];_0x2aae89['recipientsDescription']=_[_0xf73d('0x47')](_0x57cb36[_0xf73d('0x2f')][_0xf73d('0x48')])?null:_0x57cb36[_0xf73d('0x2f')][_0xf73d('0x48')];_0x2aae89[_0xf73d('0x49')]=_0x57cb36[_0xf73d('0x2f')][_0xf73d('0x49')]||![];_0x2aae89['SenderId']=_0x57cb36[_0xf73d('0x41')]['id'];return getContent(_0x57cb36['body'])[_0xf73d('0x4a')](function(_0x575ffe){_0x2aae89['body']=_0x575ffe;return getRecipients(_0x4c7e13);})[_0xf73d('0x4a')](function(_0x83b9d7){_0x2aae89[_0xf73d('0x4b')]=_['sortBy'](_0x83b9d7)[_0xf73d('0x4c')](',');return db['sequelize'][_0xf73d('0x4d')](function(_0xf63417){return db['UserNotification']['create'](_0x2aae89,{'raw':!![],'transaction':_0xf63417})[_0xf73d('0x4a')](function(_0x500fa5){var _0x1be4a0={'sender':_0x2aae89['senderName'],'description':_0x2aae89[_0xf73d('0x48')],'content':_0x2aae89['body'],'beep':_0x2aae89[_0xf73d('0x49')]};_0x83b9d7[_0xf73d('0x4e')](function(_0x46b811){_0x1be4a0[_0xf73d('0x4f')]=_0x46b811;socket[_0xf73d('0x50')](_0xf73d('0x51'),_0x1be4a0);});return _0x500fa5;});});})[_0xf73d('0x4a')](respondWithResult(_0x183af3,0xc9))[_0xf73d('0x52')](handleError(_0x183af3,null));};function getContent(_0x1b0e08){return new BPromise(function(_0x2013ec,_0x9011d){if(_0x1b0e08[_0xf73d('0x2e')]){_0x2013ec(_0x1b0e08[_0xf73d('0x2e')]);return;}return db['Template'][_0xf73d('0x53')]({'attributes':[_0xf73d('0x54')],'where':{'id':_0x1b0e08[_0xf73d('0x55')]},'raw':!![]})['then'](function(_0x2756ad){if(!_0x2756ad)throw new db['Sequelize']['ValidationError'](_0xf73d('0x56'));var _0x3e256c=Mustache[_0xf73d('0x57')](_0x2756ad[_0xf73d('0x54')],_0x1b0e08[_0xf73d('0x33')]);_0x2013ec(_0x3e256c);})[_0xf73d('0x52')](function(_0x4f4f78){_0x9011d(_0x4f4f78);});});}function getRecipients(_0x39f6ef){return new BPromise(function(_0x260e95,_0x3c2b85){var _0x558671=[];var _0x3de790=[];_0x39f6ef[_0xf73d('0x4e')](function(_0x5075c2){var _0x218da4=_['startCase'](_0x5075c2[_0xf73d('0x58')]['toLowerCase']());if(_0x218da4===_0xf73d('0x59')){_0x558671=_[_0xf73d('0x5a')](_0x558671,_0x5075c2[_0xf73d('0x5b')]);}else{if(_[_0xf73d('0x43')](_0x218da4,_0xf73d('0x5c')))_0x218da4=_0x218da4[_0xf73d('0x5d')](_0xf73d('0x5c'),_0xf73d('0x5e'));_0x5075c2[_0xf73d('0x5b')][_0xf73d('0x4e')](function(_0x1bed80){_0x3de790['push'](getAgents(_0x218da4,_0x1bed80));});}});return BPromise[_0xf73d('0x5f')](_0x3de790)['then'](function(_0x12c37f){_0x558671=_[_0xf73d('0x5a')](_0x558671,_[_0xf73d('0x60')](_0x12c37f));_0x260e95(_0x558671);})[_0xf73d('0x52')](function(_0x48ce6c){_0x3c2b85(_0x48ce6c);});});}function getAgents(_0x528ebc,_0x380139){return new BPromise(function(_0x368d83,_0x1c8079){return db[_0x528ebc][_0xf73d('0x53')]({'where':{'id':_0x380139}})['then'](function(_0x38a366){return _0x38a366[_0xf73d('0x61')]({'attributes':['id'],'raw':!![]})[_0xf73d('0x4a')](function(_0x486556){var _0x15b8b3=_[_0xf73d('0x62')](_0x486556,'id');_0x368d83(_0x15b8b3);});})['catch'](function(_0x675b07){_0x1c8079(_0x675b07);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 500b0bb..fa9cbfa 100644 --- a/server/api/userNotification/userNotification.events.js +++ b/server/api/userNotification/userNotification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0fda=['hook','exports','events','UserNotification','setMaxListeners','save','update','remove','emit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x10dff0,_0x59de15){_0x10dff0=_0x10dff0-0x0;var _0x2f7d89=_0x0fda[_0x10dff0];return _0x2f7d89;};'use strict';var EventEmitter=require(_0xa0fd('0x0'));var UserNotification=require('../../mysqldb')['db'][_0xa0fd('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xa0fd('0x2')](0x0);var events={'afterCreate':_0xa0fd('0x3'),'afterUpdate':_0xa0fd('0x4'),'afterDestroy':_0xa0fd('0x5')};function emitEvent(_0xd8e73a){return function(_0x13c734,_0x574fca,_0x4978fa){UserNotificationEvents[_0xa0fd('0x6')](_0xd8e73a+':'+_0x13c734['id'],_0x13c734);UserNotificationEvents['emit'](_0xd8e73a,_0x13c734);_0x4978fa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xa0fd('0x7')](e,emitEvent(event));}}module[_0xa0fd('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0x50a6=['hasOwnProperty','hook','exports','events','../../mysqldb','save','remove'];(function(_0x437d2b,_0x54b793){var _0x30789b=function(_0x25bbc2){while(--_0x25bbc2){_0x437d2b['push'](_0x437d2b['shift']());}};_0x30789b(++_0x54b793);}(_0x50a6,0xa4));var _0x650a=function(_0x154940,_0x4a448a){_0x154940=_0x154940-0x0;var _0x401409=_0x50a6[_0x154940];return _0x401409;};'use strict';var EventEmitter=require(_0x650a('0x0'));var UserNotification=require(_0x650a('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x650a('0x2'),'afterUpdate':'update','afterDestroy':_0x650a('0x3')};function emitEvent(_0x15dd02){return function(_0x2c71ba,_0x4a0147,_0xa3311){UserNotificationEvents['emit'](_0x15dd02+':'+_0x2c71ba['id'],_0x2c71ba);UserNotificationEvents['emit'](_0x15dd02,_0x2c71ba);_0xa3311(null);};}for(var e in events){if(events[_0x650a('0x4')](e)){var event=events[e];UserNotification[_0x650a('0x5')](e,emitEvent(event));}}module[_0x650a('0x6')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 44f4102..f4fe345 100644 --- a/server/api/userNotification/userNotification.model.js +++ b/server/api/userNotification/userNotification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fc2=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./userNotification.attributes','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x1691ad,_0x1cf04c){var _0x50cfc6=function(_0x304a29){while(--_0x304a29){_0x1691ad['push'](_0x1691ad['shift']());}};_0x50cfc6(++_0x1cf04c);}(_0x4fc2,0x111));var _0x24fc=function(_0x2f75ce,_0x229bf4){_0x2f75ce=_0x2f75ce-0x0;var _0x5f1f2d=_0x4fc2[_0x2f75ce];return _0x5f1f2d;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var logger=require(_0x24fc('0x2'))(_0x24fc('0x3'));var moment=require('moment');var BPromise=require(_0x24fc('0x4'));var rp=require(_0x24fc('0x5'));var fs=require('fs');var path=require(_0x24fc('0x6'));var rimraf=require('rimraf');var config=require(_0x24fc('0x7'));var attributes=require(_0x24fc('0x8'));module['exports']=function(_0x26fcc6,_0x12d602){return _0x26fcc6['define'](_0x24fc('0x9'),attributes,{'tableName':_0x24fc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x24fc('0xb'),'collate':_0x24fc('0xc')});}; \ No newline at end of file +var _0x00ea=['../../config/environment','exports','define','userNotifications','utf8mb4','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x59622b,_0x26e364){var _0x453424=function(_0x1663de){while(--_0x1663de){_0x59622b['push'](_0x59622b['shift']());}};_0x453424(++_0x26e364);}(_0x00ea,0x19d));var _0xa00e=function(_0x4872ae,_0x20ffe0){_0x4872ae=_0x4872ae-0x0;var _0x508e4e=_0x00ea[_0x4872ae];return _0x508e4e;};'use strict';var _=require('lodash');var util=require(_0xa00e('0x0'));var logger=require(_0xa00e('0x1'))('api');var moment=require(_0xa00e('0x2'));var BPromise=require(_0xa00e('0x3'));var rp=require(_0xa00e('0x4'));var fs=require('fs');var path=require(_0xa00e('0x5'));var rimraf=require(_0xa00e('0x6'));var config=require(_0xa00e('0x7'));var attributes=require('./userNotification.attributes');module[_0xa00e('0x8')]=function(_0x348310,_0x220b95){return _0x348310[_0xa00e('0x9')]('UserNotification',attributes,{'tableName':_0xa00e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa00e('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 7ec6cb3..252f64a 100644 --- a/server/api/userNotification/userNotification.rpc.js +++ b/server/api/userNotification/userNotification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2efb=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird'];(function(_0x438adb,_0x4e56f4){var _0x13a473=function(_0x51ac3e){while(--_0x51ac3e){_0x438adb['push'](_0x438adb['shift']());}};_0x13a473(++_0x4e56f4);}(_0x2efb,0x102));var _0xb2ef=function(_0x3452e4,_0x18f3f0){_0x3452e4=_0x3452e4-0x0;var _0x4f62b5=_0x2efb[_0x3452e4];return _0x4f62b5;};'use strict';var _=require(_0xb2ef('0x0'));var util=require('util');var moment=require(_0xb2ef('0x1'));var BPromise=require(_0xb2ef('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb2ef('0x3'));var db=require(_0xb2ef('0x4'))['db'];var utils=require(_0xb2ef('0x5'));var logger=require(_0xb2ef('0x6'))(_0xb2ef('0x7'));var config=require(_0xb2ef('0x8'));var jayson=require(_0xb2ef('0x9'));var client=jayson[_0xb2ef('0xa')][_0xb2ef('0xb')]({'port':0x232a});config['redis']=_[_0xb2ef('0xc')](config[_0xb2ef('0xd')],{'host':_0xb2ef('0xe'),'port':0x18eb});var socket=require(_0xb2ef('0xf'))(new Redis(config[_0xb2ef('0xd')]));require('./userNotification.socket')[_0xb2ef('0x10')](socket);function respondWithRpcPromise(_0x11e654,_0x3eb071,_0x468589){return new BPromise(function(_0x368e0c,_0x1e3977){return client[_0xb2ef('0x11')](_0x11e654,_0x468589)[_0xb2ef('0x12')](function(_0x193be9){logger[_0xb2ef('0x13')](_0xb2ef('0x14'),_0x3eb071,_0xb2ef('0x15'));logger[_0xb2ef('0x16')](_0xb2ef('0x17'),_0x3eb071,_0xb2ef('0x15'),JSON[_0xb2ef('0x18')](_0x193be9));if(_0x193be9[_0xb2ef('0x19')]){if(_0x193be9[_0xb2ef('0x19')]['code']===0x1f4){logger[_0xb2ef('0x19')](_0xb2ef('0x14'),_0x3eb071,_0x193be9[_0xb2ef('0x19')][_0xb2ef('0x1a')]);return _0x1e3977(_0x193be9['error'][_0xb2ef('0x1a')]);}logger[_0xb2ef('0x19')](_0xb2ef('0x14'),_0x3eb071,_0x193be9[_0xb2ef('0x19')][_0xb2ef('0x1a')]);return _0x368e0c(_0x193be9[_0xb2ef('0x19')]['message']);}else{logger[_0xb2ef('0x13')](_0xb2ef('0x14'),_0x3eb071,_0xb2ef('0x15'));_0x368e0c(_0x193be9[_0xb2ef('0x1b')]['message']);}})[_0xb2ef('0x1c')](function(_0x2031b5){logger[_0xb2ef('0x19')](_0xb2ef('0x14'),_0x3eb071,_0x2031b5);_0x1e3977(_0x2031b5);});});} \ No newline at end of file +var _0x2f1e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','register','request','then','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','UserNotification,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x51d95e,_0x2d7be5){var _0x2d07f5=function(_0x208357){while(--_0x208357){_0x51d95e['push'](_0x51d95e['shift']());}};_0x2d07f5(++_0x2d7be5);}(_0x2f1e,0x175));var _0xe2f1=function(_0x260d3f,_0x5c0c51){_0x260d3f=_0x260d3f-0x0;var _0x1bbb43=_0x2f1e[_0x260d3f];return _0x1bbb43;};'use strict';var _=require(_0xe2f1('0x0'));var util=require(_0xe2f1('0x1'));var moment=require(_0xe2f1('0x2'));var BPromise=require(_0xe2f1('0x3'));var rs=require(_0xe2f1('0x4'));var fs=require('fs');var Redis=require(_0xe2f1('0x5'));var db=require(_0xe2f1('0x6'))['db'];var utils=require(_0xe2f1('0x7'));var logger=require(_0xe2f1('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe2f1('0x9'));var client=jayson[_0xe2f1('0xa')]['http']({'port':0x232a});config[_0xe2f1('0xb')]=_[_0xe2f1('0xc')](config[_0xe2f1('0xb')],{'host':_0xe2f1('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userNotification.socket')[_0xe2f1('0xe')](socket);function respondWithRpcPromise(_0x25fdfb,_0x421658,_0xca1c40){return new BPromise(function(_0x205dbc,_0x1e9ccd){return client[_0xe2f1('0xf')](_0x25fdfb,_0xca1c40)[_0xe2f1('0x10')](function(_0x451a60){logger['info']('UserNotification,\x20%s,\x20%s',_0x421658,_0xe2f1('0x11'));logger[_0xe2f1('0x12')](_0xe2f1('0x13'),_0x421658,'request\x20sent',JSON[_0xe2f1('0x14')](_0x451a60));if(_0x451a60[_0xe2f1('0x15')]){if(_0x451a60['error']['code']===0x1f4){logger[_0xe2f1('0x15')](_0xe2f1('0x16'),_0x421658,_0x451a60['error'][_0xe2f1('0x17')]);return _0x1e9ccd(_0x451a60[_0xe2f1('0x15')][_0xe2f1('0x17')]);}logger[_0xe2f1('0x15')](_0xe2f1('0x16'),_0x421658,_0x451a60[_0xe2f1('0x15')][_0xe2f1('0x17')]);return _0x205dbc(_0x451a60[_0xe2f1('0x15')][_0xe2f1('0x17')]);}else{logger[_0xe2f1('0x18')](_0xe2f1('0x16'),_0x421658,_0xe2f1('0x11'));_0x205dbc(_0x451a60[_0xe2f1('0x19')][_0xe2f1('0x17')]);}})[_0xe2f1('0x1a')](function(_0x1979ef){logger['error'](_0xe2f1('0x16'),_0x421658,_0x1979ef);_0x1e9ccd(_0x1979ef);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 1232731..0e6f05a 100644 --- a/server/api/userNotification/userNotification.socket.js +++ b/server/api/userNotification/userNotification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e65=['remove','update','emit','removeListener','register','length','userNotification:','./userNotification.events','save'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x2e65,0x193));var _0x52e6=function(_0x557fd2,_0x2c0a7a){_0x557fd2=_0x557fd2-0x0;var _0x1b54a2=_0x2e65[_0x557fd2];return _0x1b54a2;};'use strict';var UserNotificationEvents=require(_0x52e6('0x0'));var events=[_0x52e6('0x1'),_0x52e6('0x2'),_0x52e6('0x3')];function createListener(_0xd7e693,_0x23aa21){return function(_0x1ab739){_0x23aa21[_0x52e6('0x4')](_0xd7e693,_0x1ab739);};}function removeListener(_0x47912f,_0x383919){return function(){UserNotificationEvents[_0x52e6('0x5')](_0x47912f,_0x383919);};}exports[_0x52e6('0x6')]=function(_0xe67caa){for(var _0x1cf6d2=0x0,_0x116651=events[_0x52e6('0x7')];_0x1cf6d2<_0x116651;_0x1cf6d2++){var _0x1401a3=events[_0x1cf6d2];var _0x27f270=createListener(_0x52e6('0x8')+_0x1401a3,_0xe67caa);UserNotificationEvents['on'](_0x1401a3,_0x27f270);}}; \ No newline at end of file +var _0x71ab=['length','userNotification:','save','update','emit','removeListener','register'];(function(_0x98de40,_0x35fbd9){var _0x59fea7=function(_0x1acceb){while(--_0x1acceb){_0x98de40['push'](_0x98de40['shift']());}};_0x59fea7(++_0x35fbd9);}(_0x71ab,0x64));var _0xb71a=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x71ab[_0x432682];return _0x463d05;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xb71a('0x0'),'remove',_0xb71a('0x1')];function createListener(_0x5bdf89,_0x3e985a){return function(_0x3f0529){_0x3e985a[_0xb71a('0x2')](_0x5bdf89,_0x3f0529);};}function removeListener(_0x4094b2,_0x37ce74){return function(){UserNotificationEvents[_0xb71a('0x3')](_0x4094b2,_0x37ce74);};}exports[_0xb71a('0x4')]=function(_0x38d931){for(var _0x22c072=0x0,_0x35a84e=events[_0xb71a('0x5')];_0x22c072<_0x35a84e;_0x22c072++){var _0x2a4c86=events[_0x22c072];var _0x43ca14=createListener(_0xb71a('0x6')+_0x2a4c86,_0x38d931);UserNotificationEvents['on'](_0x2a4c86,_0x43ca14);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index a5436fb..916f4ff 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 _0x89d8=['../../config/environment','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x14a34f,_0x250eec){var _0x32676c=function(_0x414e9e){while(--_0x414e9e){_0x14a34f['push'](_0x14a34f['shift']());}};_0x32676c(++_0x250eec);}(_0x89d8,0xfd));var _0x889d=function(_0x42be6a,_0xd81fd8){_0x42be6a=_0x42be6a-0x0;var _0x2d8d9d=_0x89d8[_0x42be6a];return _0x2d8d9d;};'use strict';var multer=require(_0x889d('0x0'));var util=require('util');var path=require(_0x889d('0x1'));var timeout=require(_0x889d('0x2'));var express=require(_0x889d('0x3'));var router=express['Router']();var auth=require(_0x889d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x889d('0x5'));module['exports']=router; \ No newline at end of file +var _0x21dc=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','multer'];(function(_0x3f0ef0,_0x5abe2c){var _0x205fbc=function(_0x212ce8){while(--_0x212ce8){_0x3f0ef0['push'](_0x3f0ef0['shift']());}};_0x205fbc(++_0x5abe2c);}(_0x21dc,0xf7));var _0xc21d=function(_0x3b2aa4,_0x57b314){_0x3b2aa4=_0x3b2aa4-0x0;var _0x419c58=_0x21dc[_0x3b2aa4];return _0x419c58;};'use strict';var multer=require(_0xc21d('0x0'));var util=require(_0xc21d('0x1'));var path=require(_0xc21d('0x2'));var timeout=require(_0xc21d('0x3'));var express=require(_0xc21d('0x4'));var router=express['Router']();var auth=require(_0xc21d('0x5'));var interaction=require(_0xc21d('0x6'));var config=require(_0xc21d('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 5fa2696..415ff45 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 _0xd8b0=['exports','sequelize'];(function(_0x56ba8b,_0x5f0021){var _0x528ea2=function(_0x23fb86){while(--_0x23fb86){_0x56ba8b['push'](_0x56ba8b['shift']());}};_0x528ea2(++_0x5f0021);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x45fe9c,_0x55e0d7){var _0x233d48=function(_0xa2ba2e){while(--_0xa2ba2e){_0x45fe9c['push'](_0x45fe9c['shift']());}};_0x233d48(++_0x55e0d7);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 1aa9e83..24e42c5 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 _0xefaa=['UserOpenchannelQueue','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','define'];(function(_0x449941,_0x5b7094){var _0x316d93=function(_0x537431){while(--_0x537431){_0x449941['push'](_0x449941['shift']());}};_0x316d93(++_0x5b7094);}(_0xefaa,0x182));var _0xaefa=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xefaa[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0xaefa('0x0'));var util=require(_0xaefa('0x1'));var logger=require(_0xaefa('0x2'))(_0xaefa('0x3'));var moment=require(_0xaefa('0x4'));var BPromise=require('bluebird');var rp=require(_0xaefa('0x5'));var fs=require('fs');var path=require(_0xaefa('0x6'));var rimraf=require(_0xaefa('0x7'));var config=require('../../config/environment');var attributes=require('./userOpenchannelQueue.attributes');module[_0xaefa('0x8')]=function(_0x125164,_0x56a3e5){return _0x125164[_0xaefa('0x9')](_0xaefa('0xa'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9208=['../../config/environment','./userOpenchannelQueue.attributes','define','user_has_openchannel_queues','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x9208,0xeb));var _0x8920=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9208[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8920('0x0'));var util=require(_0x8920('0x1'));var logger=require('../../config/logger')(_0x8920('0x2'));var moment=require(_0x8920('0x3'));var BPromise=require('bluebird');var rp=require(_0x8920('0x4'));var fs=require('fs');var path=require(_0x8920('0x5'));var rimraf=require(_0x8920('0x6'));var config=require(_0x8920('0x7'));var attributes=require(_0x8920('0x8'));module['exports']=function(_0x56c0d7,_0x41f9ac){return _0x56c0d7[_0x8920('0x9')]('UserOpenchannelQueue',attributes,{'tableName':_0x8920('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 2ba0512..de8a5d0 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 _0x8770=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x431bb3,_0x11954e){var _0x5b798c=function(_0x566bf1){while(--_0x566bf1){_0x431bb3['push'](_0x431bb3['shift']());}};_0x5b798c(++_0x11954e);}(_0x8770,0x122));var _0x0877=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8770[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0877('0x0'));var util=require(_0x0877('0x1'));var moment=require(_0x0877('0x2'));var BPromise=require(_0x0877('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0877('0x4'));var db=require(_0x0877('0x5'))['db'];var utils=require(_0x0877('0x6'));var logger=require(_0x0877('0x7'))(_0x0877('0x8'));var config=require(_0x0877('0x9'));var jayson=require(_0x0877('0xa'));var client=jayson[_0x0877('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f221f,_0x4e92f5,_0x3c03e5){return new BPromise(function(_0x4d400e,_0x198cf1){return client['request'](_0x4f221f,_0x3c03e5)[_0x0877('0xc')](function(_0x472635){logger[_0x0877('0xd')](_0x0877('0xe'),_0x4e92f5,_0x0877('0xf'));logger['debug'](_0x0877('0x10'),_0x4e92f5,'request\x20sent',JSON['stringify'](_0x472635));if(_0x472635[_0x0877('0x11')]){if(_0x472635[_0x0877('0x11')][_0x0877('0x12')]===0x1f4){logger[_0x0877('0x11')](_0x0877('0xe'),_0x4e92f5,_0x472635['error'][_0x0877('0x13')]);return _0x198cf1(_0x472635[_0x0877('0x11')][_0x0877('0x13')]);}logger['error'](_0x0877('0xe'),_0x4e92f5,_0x472635[_0x0877('0x11')][_0x0877('0x13')]);return _0x4d400e(_0x472635['error'][_0x0877('0x13')]);}else{logger['info'](_0x0877('0xe'),_0x4e92f5,'request\x20sent');_0x4d400e(_0x472635[_0x0877('0x14')][_0x0877('0x13')]);}})['catch'](function(_0x3ff8b8){logger[_0x0877('0x11')](_0x0877('0xe'),_0x4e92f5,_0x3ff8b8);_0x198cf1(_0x3ff8b8);});});} \ No newline at end of file +var _0xf45f=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','bluebird','randomstring','ioredis'];(function(_0x3cb3ca,_0x44d697){var _0x214366=function(_0x6b38e1){while(--_0x6b38e1){_0x3cb3ca['push'](_0x3cb3ca['shift']());}};_0x214366(++_0x44d697);}(_0xf45f,0x14b));var _0xff45=function(_0x2b9b6d,_0x3103d9){_0x2b9b6d=_0x2b9b6d-0x0;var _0x3098e9=_0xf45f[_0x2b9b6d];return _0x3098e9;};'use strict';var _=require(_0xff45('0x0'));var util=require(_0xff45('0x1'));var moment=require('moment');var BPromise=require(_0xff45('0x2'));var rs=require(_0xff45('0x3'));var fs=require('fs');var Redis=require(_0xff45('0x4'));var db=require(_0xff45('0x5'))['db'];var utils=require(_0xff45('0x6'));var logger=require(_0xff45('0x7'))(_0xff45('0x8'));var config=require(_0xff45('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xff45('0xa')][_0xff45('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ea16a,_0x455ed1,_0x38bbed){return new BPromise(function(_0x33520a,_0x3b08b7){return client['request'](_0x3ea16a,_0x38bbed)['then'](function(_0x557e06){logger[_0xff45('0xc')](_0xff45('0xd'),_0x455ed1,_0xff45('0xe'));logger['debug'](_0xff45('0xf'),_0x455ed1,'request\x20sent',JSON[_0xff45('0x10')](_0x557e06));if(_0x557e06['error']){if(_0x557e06['error'][_0xff45('0x11')]===0x1f4){logger[_0xff45('0x12')](_0xff45('0xd'),_0x455ed1,_0x557e06['error'][_0xff45('0x13')]);return _0x3b08b7(_0x557e06[_0xff45('0x12')][_0xff45('0x13')]);}logger['error'](_0xff45('0xd'),_0x455ed1,_0x557e06[_0xff45('0x12')][_0xff45('0x13')]);return _0x33520a(_0x557e06[_0xff45('0x12')][_0xff45('0x13')]);}else{logger[_0xff45('0xc')](_0xff45('0xd'),_0x455ed1,_0xff45('0xe'));_0x33520a(_0x557e06[_0xff45('0x14')][_0xff45('0x13')]);}})['catch'](function(_0x5ebc9d){logger['error'](_0xff45('0xd'),_0x455ed1,_0x5ebc9d);_0x3b08b7(_0x5ebc9d);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 4195ef8..d1746cc 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 _0x0d9b=['/:id/resources','getResources','post','create','/:id/clone','clone','addSections','put','update','delete','destroy','removeSections','removeResources','exports','path','connect-timeout','express','Router','../../components/interaction/service','./userProfile.controller','isAuthenticated','index','/describe','/:id','get','/:id/sections','getSections'];(function(_0x22e59d,_0x4ebf38){var _0x34adaa=function(_0x25a717){while(--_0x25a717){_0x22e59d['push'](_0x22e59d['shift']());}};_0x34adaa(++_0x4ebf38);}(_0x0d9b,0x1d9));var _0xb0d9=function(_0x54d8d7,_0x446e6f){_0x54d8d7=_0x54d8d7-0x0;var _0x150af6=_0x0d9b[_0x54d8d7];return _0x150af6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb0d9('0x0'));var timeout=require(_0xb0d9('0x1'));var express=require(_0xb0d9('0x2'));var router=express[_0xb0d9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb0d9('0x4'));var config=require('../../config/environment');var controller=require(_0xb0d9('0x5'));router['get']('/',auth[_0xb0d9('0x6')](),controller[_0xb0d9('0x7')]);router['get'](_0xb0d9('0x8'),auth[_0xb0d9('0x6')](),controller['describe']);router['get'](_0xb0d9('0x9'),auth[_0xb0d9('0x6')](),controller['show']);router[_0xb0d9('0xa')](_0xb0d9('0xb'),auth[_0xb0d9('0x6')](),controller[_0xb0d9('0xc')]);router[_0xb0d9('0xa')](_0xb0d9('0xd'),auth[_0xb0d9('0x6')](),controller[_0xb0d9('0xe')]);router[_0xb0d9('0xf')]('/',auth[_0xb0d9('0x6')](),controller[_0xb0d9('0x10')]);router[_0xb0d9('0xf')](_0xb0d9('0x11'),auth[_0xb0d9('0x6')](),controller[_0xb0d9('0x12')]);router[_0xb0d9('0xf')](_0xb0d9('0xb'),auth[_0xb0d9('0x6')](),controller[_0xb0d9('0x13')]);router[_0xb0d9('0xf')](_0xb0d9('0xd'),auth[_0xb0d9('0x6')](),controller['addResources']);router[_0xb0d9('0x14')](_0xb0d9('0x9'),auth[_0xb0d9('0x6')](),controller[_0xb0d9('0x15')]);router[_0xb0d9('0x16')]('/:id',auth[_0xb0d9('0x6')](),controller[_0xb0d9('0x17')]);router[_0xb0d9('0x16')](_0xb0d9('0xb'),auth['isAuthenticated'](),controller[_0xb0d9('0x18')]);router[_0xb0d9('0x16')](_0xb0d9('0xd'),auth[_0xb0d9('0x6')](),controller[_0xb0d9('0x19')]);module[_0xb0d9('0x1a')]=router; \ No newline at end of file +var _0xcfd0=['create','/:id/clone','clone','put','delete','destroy','/:id/sections','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','describe','/:id','show','/:id/resources','getResources','post'];(function(_0x237a4a,_0x2ce609){var _0x109392=function(_0x57b19c){while(--_0x57b19c){_0x237a4a['push'](_0x237a4a['shift']());}};_0x109392(++_0x2ce609);}(_0xcfd0,0x96));var _0x0cfd=function(_0x17515b,_0x399b6e){_0x17515b=_0x17515b-0x0;var _0x349beb=_0xcfd0[_0x17515b];return _0x349beb;};'use strict';var multer=require(_0x0cfd('0x0'));var util=require(_0x0cfd('0x1'));var path=require(_0x0cfd('0x2'));var timeout=require(_0x0cfd('0x3'));var express=require(_0x0cfd('0x4'));var router=express[_0x0cfd('0x5')]();var auth=require(_0x0cfd('0x6'));var interaction=require(_0x0cfd('0x7'));var config=require(_0x0cfd('0x8'));var controller=require(_0x0cfd('0x9'));router[_0x0cfd('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0cfd('0xa')]('/describe',auth[_0x0cfd('0xb')](),controller[_0x0cfd('0xc')]);router[_0x0cfd('0xa')](_0x0cfd('0xd'),auth[_0x0cfd('0xb')](),controller[_0x0cfd('0xe')]);router[_0x0cfd('0xa')]('/:id/sections',auth['isAuthenticated'](),controller['getSections']);router['get'](_0x0cfd('0xf'),auth[_0x0cfd('0xb')](),controller[_0x0cfd('0x10')]);router[_0x0cfd('0x11')]('/',auth['isAuthenticated'](),controller[_0x0cfd('0x12')]);router[_0x0cfd('0x11')](_0x0cfd('0x13'),auth[_0x0cfd('0xb')](),controller[_0x0cfd('0x14')]);router['post']('/:id/sections',auth[_0x0cfd('0xb')](),controller['addSections']);router[_0x0cfd('0x11')](_0x0cfd('0xf'),auth[_0x0cfd('0xb')](),controller['addResources']);router[_0x0cfd('0x15')](_0x0cfd('0xd'),auth[_0x0cfd('0xb')](),controller['update']);router[_0x0cfd('0x16')](_0x0cfd('0xd'),auth[_0x0cfd('0xb')](),controller[_0x0cfd('0x17')]);router['delete'](_0x0cfd('0x18'),auth[_0x0cfd('0xb')](),controller[_0x0cfd('0x19')]);router['delete'](_0x0cfd('0xf'),auth[_0x0cfd('0xb')](),controller[_0x0cfd('0x1a')]);module[_0x0cfd('0x1b')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 3f18322..05eb14e 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 _0xebd0=['sequelize','exports','STRING','setDataValue','crudPermissions','join','getDataValue'];(function(_0x10a230,_0x448917){var _0x5c78e2=function(_0x27584c){while(--_0x27584c){_0x10a230['push'](_0x10a230['shift']());}};_0x5c78e2(++_0x448917);}(_0xebd0,0x149));var _0x0ebd=function(_0x1dda20,_0x1edfa6){_0x1dda20=_0x1dda20-0x0;var _0x5259e2=_0xebd0[_0x1dda20];return _0x5259e2;};'use strict';var Sequelize=require(_0x0ebd('0x0'));module[_0x0ebd('0x1')]={'name':{'type':Sequelize[_0x0ebd('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x0ebd('0x2')],'set':function(_0x1c0a1c){this[_0x0ebd('0x3')](_0x0ebd('0x4'),_0x1c0a1c?_0x1c0a1c[_0x0ebd('0x5')](''):[]);},'get':function(){return this[_0x0ebd('0x6')]('crudPermissions')?this[_0x0ebd('0x6')](_0x0ebd('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x0ebd('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x5169=['getDataValue','split','sequelize','STRING','setDataValue','crudPermissions'];(function(_0x4f69d0,_0x2cc29e){var _0x387612=function(_0x9877d5){while(--_0x9877d5){_0x4f69d0['push'](_0x4f69d0['shift']());}};_0x387612(++_0x2cc29e);}(_0x5169,0x140));var _0x9516=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5169[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x9516('0x0'));module['exports']={'name':{'type':Sequelize[_0x9516('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x41eb9e){this[_0x9516('0x2')](_0x9516('0x3'),_0x41eb9e?_0x41eb9e['join'](''):[]);},'get':function(){return this[_0x9516('0x4')](_0x9516('0x3'))?this[_0x9516('0x4')]('crudPermissions')[_0x9516('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x9516('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 683d323..b13d1c5 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 _0x8db0=['tag','value','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','projects','contacts','Lists','ListId','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','voicemails','VoiceMail','VoiceRecording','Agents','User','agent','Telephones','membername','telephone','VoiceQueues','queue','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','voicequeues','queuecampaigns','users','agents','telephones','role','admin','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','pauses','Pause','Schedule','tags','templates','Template','triggers','Trigger','Trunk','variables','plugins','extractedreports','AnalyticMetric','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','UserProfile','includeAll','findAll','rows','catch','show','params','rawAttributes','include','clone','omit','updatedAt','crudPermissions','body','createdAt','transaction','UserProfileSection','autoAssociation','UserProfileResource','Resources','create','find','describe','addSections','sectionId','userProfileId','push','get','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','forEach','resourceId','addResources','sequelize','bulkCreate','removeResources','getResources','section','undefined','Sequelize','ValidationError','mergeResources','childModel','parentSections','all','ignore','pick','type','field','foreignKey','associatedResources','AnalyticExtractedReport','reportType','default','reportId','DefaultReports','custom','CmContact','Tag','Tags','color'];(function(_0x4f1717,_0x4920b6){var _0x504f18=function(_0x5a3e85){while(--_0x5a3e85){_0x4f1717['push'](_0x4f1717['shift']());}};_0x504f18(++_0x4920b6);}(_0x8db0,0x65));var _0x08db=function(_0x3a0863,_0x4cd5ef){_0x3a0863=_0x3a0863-0x0;var _0x85c557=_0x8db0[_0x3a0863];return _0x85c557;};'use strict';var pdf=require(_0x08db('0x0'));var emlformat=require(_0x08db('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x08db('0x2'));var jsonpatch=require(_0x08db('0x3'));var rp=require(_0x08db('0x4'));var moment=require('moment');var BPromise=require(_0x08db('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x08db('0x6'));var csv=require('to-csv');var ejs=require(_0x08db('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x08db('0x8'));var crypto=require(_0x08db('0x9'));var jsforce=require(_0x08db('0xa'));var deskjs=require(_0x08db('0xb'));var toCsv=require(_0x08db('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x08db('0xd'));var authService=require(_0x08db('0xe'));var qs=require(_0x08db('0xf'));var as=require(_0x08db('0x10'));var hardwareService=require(_0x08db('0x11'));var logger=require(_0x08db('0x12'))(_0x08db('0x13'));var utils=require(_0x08db('0x14'));var config=require(_0x08db('0x15'));var licenseUtil=require(_0x08db('0x16'));var db=require(_0x08db('0x17'))['db'];config[_0x08db('0x18')]=_[_0x08db('0x19')](config[_0x08db('0x18')],{'host':_0x08db('0x1a'),'port':0x18eb});var socket=require(_0x08db('0x1b'))(new Redis(config[_0x08db('0x18')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x541875,_0x1e05f3){_0x1e05f3=_0x1e05f3||0xcc;return function(_0x291cb6){if(_0x291cb6){return _0x541875[_0x08db('0x1c')](_0x1e05f3);}return _0x541875[_0x08db('0x1d')](_0x1e05f3)['end']();};}function respondWithResult(_0x13345a,_0x4eb1b5){_0x4eb1b5=_0x4eb1b5||0xc8;return function(_0x6395dc){if(_0x6395dc){return _0x13345a['status'](_0x4eb1b5)[_0x08db('0x1e')](_0x6395dc);}};}function respondWithFilteredResult(_0x1b9169,_0x593622){return function(_0x2a2351){if(_0x2a2351){var _0x16ca71=_0x2a2351[_0x08db('0x1f')],_0x28ceca=_0x593622[_0x08db('0x20')],_0x4c9830=_0x593622[_0x08db('0x20')]+_0x593622[_0x08db('0x21')],_0x21c282;if(_0x4c9830>=_0x16ca71){_0x4c9830=_0x16ca71;_0x21c282=0xc8;}else{_0x21c282=0xce;}_0x1b9169[_0x08db('0x1d')](_0x21c282);return _0x1b9169[_0x08db('0x22')](_0x08db('0x23'),_0x28ceca+'-'+_0x4c9830+'/'+_0x16ca71)[_0x08db('0x1e')](_0x2a2351);}return null;};}function patchUpdates(_0x3bd1fd){return function(_0x5ebd36){try{jsonpatch[_0x08db('0x24')](_0x5ebd36,_0x3bd1fd,!![]);}catch(_0x1b9302){return BPromise[_0x08db('0x25')](_0x1b9302);}return _0x5ebd36[_0x08db('0x26')]();};}function saveUpdates(_0x5d8b35,_0x4ed886){return function(_0x5db163){if(_0x5db163){return _0x5db163[_0x08db('0x27')](_0x5d8b35)[_0x08db('0x28')](function(_0x504a12){return _0x504a12;});}return null;};}function removeEntity(_0x49b072,_0x51c2c4){return function(_0x4c638e){if(_0x4c638e){return _0x4c638e[_0x08db('0x29')]()[_0x08db('0x28')](function(){_0x49b072[_0x08db('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a7702,_0x3c22e){return function(_0x4de740){if(!_0x4de740){_0x4a7702['sendStatus'](0x194);}return _0x4de740;};}function handleError(_0x1e9446,_0x50d65b){_0x50d65b=_0x50d65b||0x1f4;return function(_0x14c47f){logger[_0x08db('0x2a')](_0x14c47f[_0x08db('0x2b')]);if(_0x14c47f[_0x08db('0x2c')]){delete _0x14c47f[_0x08db('0x2c')];}_0x1e9446[_0x08db('0x1d')](_0x50d65b)[_0x08db('0x2d')](_0x14c47f);};}exports['index']=function(_0x40e0d2,_0xa2f2b6){var _0x45d7d8={},_0x168d44={},_0x1146f7={'count':0x0,'rows':[]};var _0xb4ffdd=_['map'](db['UserProfile']['rawAttributes'],function(_0x379bee){return{'name':_0x379bee['fieldName'],'type':_0x379bee['type'][_0x08db('0x2e')]};});_0x168d44[_0x08db('0x2f')]=_[_0x08db('0x30')](_0xb4ffdd,_0x08db('0x2c'));_0x168d44[_0x08db('0x31')]=_[_0x08db('0x32')](_0x40e0d2['query']);_0x168d44[_0x08db('0x33')]=_[_0x08db('0x34')](_0x168d44['model'],_0x168d44[_0x08db('0x31')]);_0x45d7d8[_0x08db('0x35')]=_[_0x08db('0x34')](_0x168d44['model'],qs[_0x08db('0x36')](_0x40e0d2['query'][_0x08db('0x36')]));_0x45d7d8[_0x08db('0x35')]=_0x45d7d8[_0x08db('0x35')][_0x08db('0x37')]?_0x45d7d8[_0x08db('0x35')]:_0x168d44[_0x08db('0x2f')];if(!_0x40e0d2[_0x08db('0x31')][_0x08db('0x38')](_0x08db('0x39'))){_0x45d7d8[_0x08db('0x21')]=qs['limit'](_0x40e0d2['query'][_0x08db('0x21')]);_0x45d7d8[_0x08db('0x20')]=qs[_0x08db('0x20')](_0x40e0d2[_0x08db('0x31')]['offset']);}_0x45d7d8['order']=qs[_0x08db('0x3a')](_0x40e0d2['query'][_0x08db('0x3a')]);_0x45d7d8['where']=qs[_0x08db('0x33')](_['pick'](_0x40e0d2[_0x08db('0x31')],_0x168d44['filters']),_0xb4ffdd);if(_0x40e0d2[_0x08db('0x31')][_0x08db('0x3b')]){_0x45d7d8[_0x08db('0x3c')]=_[_0x08db('0x3d')](_0x45d7d8[_0x08db('0x3c')],{'$or':_[_0x08db('0x30')](_0xb4ffdd,function(_0x23aae4){if(_0x23aae4['type']!==_0x08db('0x3e')){var _0x4a82b9={};_0x4a82b9[_0x23aae4[_0x08db('0x2c')]]={'$like':'%'+_0x40e0d2['query'][_0x08db('0x3b')]+'%'};return _0x4a82b9;}})});}_0x45d7d8=_[_0x08db('0x3d')]({},_0x45d7d8,_0x40e0d2[_0x08db('0x3f')]);var _0x12a13f={'where':_0x45d7d8[_0x08db('0x3c')]};return db[_0x08db('0x40')][_0x08db('0x1f')](_0x12a13f)[_0x08db('0x28')](function(_0x4dfb94){_0x1146f7[_0x08db('0x1f')]=_0x4dfb94;if(_0x40e0d2['query'][_0x08db('0x41')]){_0x45d7d8['include']=[{'all':!![]}];}return db[_0x08db('0x40')][_0x08db('0x42')](_0x45d7d8);})[_0x08db('0x28')](function(_0xf03cdc){_0x1146f7[_0x08db('0x43')]=_0xf03cdc;return _0x1146f7;})[_0x08db('0x28')](respondWithFilteredResult(_0xa2f2b6,_0x45d7d8))[_0x08db('0x44')](handleError(_0xa2f2b6,null));};exports[_0x08db('0x45')]=function(_0x1dcbd0,_0x19dd5c){var _0x39f6b4={'raw':![],'where':{'id':_0x1dcbd0[_0x08db('0x46')]['id']}},_0x4573b1={};_0x4573b1['model']=_[_0x08db('0x32')](db[_0x08db('0x40')][_0x08db('0x47')]);_0x4573b1[_0x08db('0x31')]=_[_0x08db('0x32')](_0x1dcbd0[_0x08db('0x31')]);_0x4573b1[_0x08db('0x33')]=_[_0x08db('0x34')](_0x4573b1[_0x08db('0x2f')],_0x4573b1[_0x08db('0x31')]);_0x39f6b4['attributes']=_[_0x08db('0x34')](_0x4573b1[_0x08db('0x2f')],qs[_0x08db('0x36')](_0x1dcbd0[_0x08db('0x31')][_0x08db('0x36')]));_0x39f6b4[_0x08db('0x35')]=_0x39f6b4[_0x08db('0x35')]['length']?_0x39f6b4[_0x08db('0x35')]:_0x4573b1[_0x08db('0x2f')];if(_0x1dcbd0[_0x08db('0x31')][_0x08db('0x41')]){_0x39f6b4[_0x08db('0x48')]=[{'all':!![]}];}_0x39f6b4=_[_0x08db('0x3d')]({},_0x39f6b4,_0x1dcbd0[_0x08db('0x3f')]);return db[_0x08db('0x40')]['find'](_0x39f6b4)[_0x08db('0x28')](handleEntityNotFound(_0x19dd5c,null))['then'](respondWithResult(_0x19dd5c,null))[_0x08db('0x44')](handleError(_0x19dd5c,null));};exports['create']=function(_0x3355bd,_0x25a45c){return db['UserProfile']['create'](_0x3355bd['body'],{})[_0x08db('0x28')](respondWithResult(_0x25a45c,0xc9))[_0x08db('0x44')](handleError(_0x25a45c,null));};exports[_0x08db('0x49')]=function(_0x7f4eaa,_0x5eacca){var _0x13a52a={'where':{'id':_0x7f4eaa[_0x08db('0x46')]['id']}},_0x16f88c={};_0x16f88c[_0x08db('0x2f')]=_['keys'](db['UserProfile'][_0x08db('0x47')]);_0x13a52a[_0x08db('0x35')]=_[_0x08db('0x34')](_0x16f88c['model'],qs['fields'](_0x7f4eaa['query']['fields']));_0x13a52a[_0x08db('0x35')]=_0x13a52a[_0x08db('0x35')]['length']?_0x13a52a['attributes']:_0x16f88c[_0x08db('0x2f')];if(_0x7f4eaa[_0x08db('0x31')]['includeAll']){_0x13a52a[_0x08db('0x48')]=[{'all':!![]}];}_0x13a52a=_[_0x08db('0x3d')]({},_0x13a52a,_0x7f4eaa[_0x08db('0x3f')]);return db[_0x08db('0x40')]['find'](_0x13a52a)[_0x08db('0x28')](handleEntityNotFound(_0x5eacca,null))[_0x08db('0x28')](function(_0x42eaa1){if(_0x42eaa1){var _0x32fc2b=_0x42eaa1['get']({'plain':!![]});_0x32fc2b=qs[_0x08db('0x4a')](_0x32fc2b,['id','createdAt',_0x08db('0x4b'),_0x08db('0x4c')]);_0x7f4eaa['body']=_[_0x08db('0x4a')](_0x7f4eaa[_0x08db('0x4d')],['id',_0x08db('0x4e'),_0x08db('0x4b')]);return db['sequelize'][_0x08db('0x4f')](function(_0x1670da){return db[_0x08db('0x40')]['create'](_[_0x08db('0x3d')](_0x32fc2b,_0x7f4eaa[_0x08db('0x4d')]),{'include':_0x7f4eaa['query'][_0x08db('0x41')]?[{'all':!![]}]:undefined,'transaction':_0x1670da})[_0x08db('0x28')](function(_0x3f6060){var _0x497ed5=_0x3f6060['get']({'plain':!![]});return db[_0x08db('0x50')][_0x08db('0x42')]({'where':{'userProfileId':_0x7f4eaa[_0x08db('0x46')]['id']},'raw':!![]})[_0x08db('0x28')](function(_0x52a2e1){if(_0x52a2e1){return BPromise['each'](_0x52a2e1,function(_0x4deca1){return new BPromise(function(_0x36fc85,_0x573cf7){if(_0x4deca1['autoAssociation']===null||_0x4deca1[_0x08db('0x51')]===0x1)_0x36fc85(null);return db[_0x08db('0x52')][_0x08db('0x42')]({'where':{'sectionId':_0x4deca1['id']},'raw':!![]})[_0x08db('0x28')](function(_0x278074){var _0x54ba94=_[_0x08db('0x30')](_0x278074,function(_0x57f8e8){return qs['omit'](_0x57f8e8,['id',_0x08db('0x4e'),_0x08db('0x4b'),'sectionId']);});_0x36fc85(_0x54ba94);})[_0x08db('0x44')](function(_0x272ada){_0x573cf7(_0x272ada);});})[_0x08db('0x28')](function(_0x5742f5){var _0x52827f=qs[_0x08db('0x4a')](_0x4deca1,['id','createdAt','updatedAt']);_0x52827f['userProfileId']=_0x497ed5['id'];if(_0x5742f5)_0x52827f[_0x08db('0x53')]=_0x5742f5;return _0x52827f;})[_0x08db('0x28')](function(_0x4a03fa){return db[_0x08db('0x50')][_0x08db('0x54')](_0x4a03fa,{'include':[{'model':db[_0x08db('0x52')],'as':'Resources'}],'raw':!![],'transaction':_0x1670da});});})[_0x08db('0x28')](function(){return _0x497ed5;});}});});});}})['then'](respondWithResult(_0x5eacca,0xc9))[_0x08db('0x44')](handleError(_0x5eacca,null));};exports[_0x08db('0x27')]=function(_0x359bcb,_0x2c1594){if(_0x359bcb['body']['id']){delete _0x359bcb[_0x08db('0x4d')]['id'];}return db[_0x08db('0x40')]['find']({'where':{'id':_0x359bcb[_0x08db('0x46')]['id']}})[_0x08db('0x28')](handleEntityNotFound(_0x2c1594,null))[_0x08db('0x28')](saveUpdates(_0x359bcb[_0x08db('0x4d')],null))['then'](respondWithResult(_0x2c1594,null))[_0x08db('0x44')](handleError(_0x2c1594,null));};exports['destroy']=function(_0x3d0f39,_0x371990){return db['UserProfile'][_0x08db('0x55')]({'where':{'id':_0x3d0f39[_0x08db('0x46')]['id']}})['then'](handleEntityNotFound(_0x371990,null))[_0x08db('0x28')](removeEntity(_0x371990,null))[_0x08db('0x44')](handleError(_0x371990,null));};exports['describe']=function(_0x16e510,_0xcdd618){return db[_0x08db('0x40')][_0x08db('0x56')]()[_0x08db('0x28')](respondWithResult(_0xcdd618,null))['catch'](handleError(_0xcdd618,null));};exports[_0x08db('0x57')]=function(_0x10da8c,_0x13eb95){var _0x283494=_0x10da8c['body'];return db[_0x08db('0x40')][_0x08db('0x55')]({'where':{'id':_0x10da8c[_0x08db('0x46')]['id']}})[_0x08db('0x28')](handleEntityNotFound(_0x13eb95,null))[_0x08db('0x28')](function(_0x5bc09a){if(_0x5bc09a){return db['sequelize']['transaction'](function(_0x429a9b){return db[_0x08db('0x50')][_0x08db('0x29')]({'where':{'userProfileId':_0x10da8c[_0x08db('0x46')]['id'],'sectionId':_[_0x08db('0x30')](_0x283494,function(_0x431629){return _0x431629[_0x08db('0x58')];})},'transaction':_0x429a9b})[_0x08db('0x28')](function(){var _0x2a1d51=_[_0x08db('0x30')](_0x283494,function(_0x47cfcd){_0x47cfcd[_0x08db('0x59')]=_0x10da8c[_0x08db('0x46')]['id'];return _0x47cfcd;});var _0xe49619=[];return BPromise['each'](_0x2a1d51,function(_0x2fdedd){return db['UserProfileSection'][_0x08db('0x54')](_0x2fdedd,{'include':[{'model':db[_0x08db('0x52')],'as':_0x08db('0x53')}],'raw':!![],'transaction':_0x429a9b})[_0x08db('0x28')](function(_0x48a346){_0xe49619[_0x08db('0x5a')](_0x48a346[_0x08db('0x5b')]({'plain':!![]}));});})['then'](function(){return _0xe49619;});});});}})[_0x08db('0x28')](function(_0x29170b){return _0x29170b;})['then'](respondWithResult(_0x13eb95,null))[_0x08db('0x44')](handleError(_0x13eb95,null));};exports[_0x08db('0x5c')]=function(_0x782a05,_0x33057a){var _0x1285ce;return db['UserProfile'][_0x08db('0x55')]({'where':{'id':_0x782a05[_0x08db('0x46')]['id']},'attributes':['id','name']})[_0x08db('0x28')](handleEntityNotFound(_0x33057a,null))[_0x08db('0x28')](function(_0x35da23){if(_0x35da23){_0x1285ce=_0x35da23;return db[_0x08db('0x50')][_0x08db('0x29')]({'where':{'userProfileId':_0x782a05[_0x08db('0x46')]['id'],'sectionId':_0x782a05[_0x08db('0x31')][_0x08db('0x5d')]}});}})[_0x08db('0x28')](function(){return _0x1285ce;})[_0x08db('0x28')](respondWithStatusCode(_0x33057a,null))[_0x08db('0x44')](handleError(_0x33057a,null));};exports[_0x08db('0x5e')]=function(_0x583a4f,_0x3f5479){var _0x315d37=[];var _0x311356=[];return db[_0x08db('0x50')][_0x08db('0x42')]({'where':{'userProfileId':_0x583a4f[_0x08db('0x46')]['id']},'raw':!![]})[_0x08db('0x28')](function(_0x5d61cc){_0x315d37=_['filter'](_0x5d61cc,function(_0x36c9d3){return _0x36c9d3[_0x08db('0x5f')]===0x1||_[_0x08db('0x60')]([0x3eb,0x709],_0x36c9d3[_0x08db('0x58')]);});if(!_[_0x08db('0x61')](_0x315d37)){return _[_0x08db('0x30')](_0x315d37,function(_0x3fbb7e){return _0x3fbb7e[_0x08db('0x58')];});}else{return;}})['then'](function(_0x1061c1){if(_0x1061c1)_0x311356=_0x1061c1;if(_[_0x08db('0x60')](_0x311356,0x64)){var _0x5187c2=_[_0x08db('0x55')](_0x315d37,{'sectionId':0x64});return hasDefaultDashboard(_0x5187c2)['then'](function(_0xf78a9d){return _[_0x08db('0x30')](_0x315d37,function(_0x6d5b5){if(_0x6d5b5[_0x08db('0x58')]===0x64){_0x6d5b5[_0x08db('0x62')]=_0xf78a9d;}return _0x6d5b5;});});}else{return;}})[_0x08db('0x28')](function(_0x47aed0){if(_0x47aed0)_0x315d37=_0x47aed0;if(_['includes'](_0x311356,0x3eb)){var _0x386bbb=_[_0x08db('0x55')](_0x315d37,{'sectionId':0x3eb});return getCustomDashboards(_0x386bbb)[_0x08db('0x28')](function(_0x1114a9){return _[_0x08db('0x30')](_0x315d37,function(_0x367d3d){if(_0x386bbb['enabled']){if(_0x367d3d[_0x08db('0x58')]===0x3eb){_0x367d3d['subsections']=_0x1114a9;}}else{if(_0x367d3d[_0x08db('0x58')]===0x64){_0x367d3d['subsections']=_0x1114a9;}}return _0x367d3d;});});}else{return;}})[_0x08db('0x28')](function(_0x389e6c){if(_0x389e6c)_0x315d37=_0x389e6c;if(_[_0x08db('0x60')](_0x311356,0x709)){var _0x37cc75=_['find'](_0x315d37,{'sectionId':0x709});return getPlugins(_0x37cc75)['then'](function(_0x518bfc){if(_0x37cc75[_0x08db('0x5f')]){return _[_0x08db('0x30')](_0x315d37,function(_0x2c5354){if(_0x2c5354[_0x08db('0x58')]===0x709){_0x2c5354[_0x08db('0x62')]=_0x518bfc;}return _0x2c5354;});}else{var _0x48ba4d={'sectionId':0x76c,'enabled':0x1,'subsections':_0x518bfc};var _0x3b484e=_[_0x08db('0x30')](_0x315d37);_0x3b484e['push'](_0x48ba4d);return _0x3b484e;}});}else{return;}})['then'](function(_0x36435a){if(_0x36435a)_0x315d37=_0x36435a;return _['filter'](_0x315d37,[_0x08db('0x5f'),0x1]);})[_0x08db('0x28')](respondWithResult(_0x3f5479,null))['catch'](handleError(_0x3f5479,null));};function hasDefaultDashboard(_0x5de081){var _0x36661d=[0x65];return new BPromise(function(_0x2ecd70,_0x5704ab){try{if(_0x5de081[_0x08db('0x51')]){_0x2ecd70(_0x36661d);}else{return db[_0x08db('0x52')][_0x08db('0x63')]({'where':{'sectionId':_0x5de081['id']},'raw':!![]})[_0x08db('0x28')](function(_0x1f66e1){_0x1f66e1?_0x2ecd70(_0x36661d):_0x2ecd70();});}}catch(_0x269d68){_0x5704ab(_0x269d68);}});}function getCustomDashboards(_0x199974){var _0x12584d=[];return new BPromise(function(_0x23ab99,_0x47f260){try{if(_0x199974[_0x08db('0x51')]){return db['Dashboard']['findAll']({'raw':!![]})['then'](function(_0x41593a){_0x41593a[_0x08db('0x64')](function(_0x4cd74d){_0x12584d[_0x08db('0x5a')](_0x4cd74d['id']+0x1869f);});_0x23ab99(_0x12584d);});}else{return db[_0x08db('0x52')][_0x08db('0x42')]({'where':{'sectionId':_0x199974['id']},'raw':!![]})['then'](function(_0x56a8e9){_0x56a8e9['forEach'](function(_0x14dfc2){_0x12584d[_0x08db('0x5a')](_0x14dfc2['resourceId']+0x1869f);});_0x23ab99(_0x12584d);});}}catch(_0x42ccff){_0x47f260(_0x42ccff);}});}function getPlugins(_0x22af97){var _0xa51c8c=[];return new BPromise(function(_0x1798a8,_0xc68fa8){try{if(_0x22af97[_0x08db('0x51')]){return db['Plugin'][_0x08db('0x42')]({'raw':!![]})[_0x08db('0x28')](function(_0x234ef9){_0x234ef9[_0x08db('0x64')](function(_0x3e7d86){_0xa51c8c['push'](_0x3e7d86['id']+0x15b38);});_0x1798a8(_0xa51c8c);});}else{return db[_0x08db('0x52')]['findAll']({'where':{'sectionId':_0x22af97['id']},'raw':!![]})[_0x08db('0x28')](function(_0x249a68){_0x249a68['forEach'](function(_0x1743f1){_0xa51c8c[_0x08db('0x5a')](_0x1743f1[_0x08db('0x65')]+0x15b38);});_0x1798a8(_0xa51c8c);});}}catch(_0xeab13c){_0xc68fa8(_0xeab13c);}});}exports[_0x08db('0x66')]=function(_0x40084b,_0x37ec22){return db[_0x08db('0x40')][_0x08db('0x55')]({'where':{'id':_0x40084b['params']['id']}})['then'](handleEntityNotFound(_0x37ec22,null))['then'](function(_0x3189d2){if(_0x3189d2){return db[_0x08db('0x67')][_0x08db('0x4f')](function(_0x4d9ee0){return db[_0x08db('0x50')]['findAll']({'where':{'userProfileId':_0x40084b[_0x08db('0x46')]['id']},'attributes':['id'],'raw':!![]})[_0x08db('0x28')](function(_0xf9d78a){if(_0xf9d78a){return db[_0x08db('0x50')]['destroy']({'where':{'userProfileId':_0x40084b[_0x08db('0x46')]['id'],'id':_[_0x08db('0x30')](_0xf9d78a,function(_0x38929b){return _0x38929b['id'];})},'transaction':_0x4d9ee0});}})[_0x08db('0x28')](function(_0x471f8a){var _0x20b030=_[_0x08db('0x30')](_0x40084b['body'],function(_0x5d7f5d){_0x5d7f5d['userProfileId']=_0x40084b[_0x08db('0x46')]['id'];return _0x5d7f5d;});return db['UserProfileSection'][_0x08db('0x68')](_0x20b030,{'raw':!![],'transaction':_0x4d9ee0});})[_0x08db('0x28')](function(_0x34df58){var _0x28e822=_['filter'](_[_0x08db('0x30')](_0x34df58,function(_0x3d469e){return _0x3d469e[_0x08db('0x5b')]({'plain':!![]});}),{'includeAll':![]});if(_0x28e822){return db[_0x08db('0x50')][_0x08db('0x42')]({'where':{'userProfileId':_0x40084b[_0x08db('0x46')]['id'],'sectionId':_[_0x08db('0x30')](_0x28e822,function(_0x1be5d8){return _0x1be5d8[_0x08db('0x58')];})},'attributes':['id',_0x08db('0x58')],'raw':!![]})['then'](function(_0x4b7acf){var _0x539be0=_[_0x08db('0x30')](_0x40084b[_0x08db('0x4d')],function(_0x12023b){_0x12023b[_0x08db('0x59')]=_0x40084b[_0x08db('0x46')]['id'];return _0x12023b;});return db[_0x08db('0x52')][_0x08db('0x68')](_0x539be0,{'raw':!![],'transaction':_0x4d9ee0});});}})['catch'](handleError(_0x37ec22,null));});}})[_0x08db('0x28')](function(_0x3cdc83){var _0x42d2a7=_[_0x08db('0x30')](_0x3cdc83,function(_0x2e1630){return _0x2e1630[_0x08db('0x5b')]({'plain':!![]});});})[_0x08db('0x28')](respondWithResult(_0x37ec22,null))[_0x08db('0x44')](handleError(_0x37ec22,null));};exports[_0x08db('0x69')]=function(_0x4e4795,_0x185af0,_0x54f4f3){return db[_0x08db('0x40')][_0x08db('0x55')]({'where':{'id':_0x4e4795[_0x08db('0x46')]['id']}})['then'](handleEntityNotFound(_0x185af0,null))[_0x08db('0x28')](function(_0x395ff5){if(_0x395ff5){return _0x395ff5[_0x08db('0x69')](_0x4e4795[_0x08db('0x31')][_0x08db('0x5d')]);}})['then'](respondWithStatusCode(_0x185af0,null))['catch'](handleError(_0x185af0,null));};exports[_0x08db('0x6a')]=function(_0x5ec042,_0x16b350){var _0x5eb2ae={'raw':![],'where':{}};var _0x4aec68={};var _0x34d0b8={'count':0x0,'rows':[]};var _0x10543f=_0x5ec042[_0x08db('0x31')][_0x08db('0x6b')];if(typeof _0x10543f===_0x08db('0x6c')){throw new db[(_0x08db('0x6d'))][(_0x08db('0x6e'))]('Unknown\x20section');}var _0x5e5a61=_0x5ec042[_0x08db('0x31')][_0x08db('0x6f')]||![];var _0x48b7b4=getQueryModels(_0x10543f,_0x5e5a61);if(typeof _0x48b7b4[_0x08db('0x70')]==='undefined'){throw new db[(_0x08db('0x6d'))][(_0x08db('0x6e'))]('Invalid\x20section\x20\x27'+_0x10543f+'\x27');}var _0x477da4=[];if(!_[_0x08db('0x61')](_0x48b7b4[_0x08db('0x71')])){_0x477da4=_0x48b7b4[_0x08db('0x71')];}else{_0x477da4=[{'name':_0x10543f}];}return db[_0x08db('0x40')][_0x08db('0x63')]({'where':{'id':_0x5ec042[_0x08db('0x46')]['id']}})[_0x08db('0x28')](handleEntityNotFound(_0x16b350,null))[_0x08db('0x28')](function(_0xe08d20){if(_0xe08d20){var _0x356d7d=[];for(var _0x52fe46=0x0;_0x52fe46<_0x477da4[_0x08db('0x37')];_0x52fe46++){_0x356d7d['push'](db[_0x08db('0x50')]['findOne']({'where':{'userProfileId':_0xe08d20['id'],'name':_0x477da4[_0x52fe46][_0x08db('0x2c')]},'raw':!![]}));}return BPromise[_0x08db('0x72')](_0x356d7d);}})[_0x08db('0x28')](function(_0x2a162a){var _0x170f43=_['filter'](_0x2a162a,function(_0x528aa9){return _0x528aa9?_0x528aa9:undefined;});var _0x33a9bf=_[_0x08db('0x3b')](_0x477da4,[_0x08db('0x73'),!![]]);var _0x1c324c=_[_0x08db('0x61')](_0x170f43)&&_['isEmpty'](_0x33a9bf)?null:_['union'](_0x33a9bf,_0x170f43);if(_0x1c324c){var _0x3fcb22=[];for(var _0x59631e=0x0;_0x59631e<_0x1c324c[_0x08db('0x37')];_0x59631e++){var _0x100a04=_[_0x08db('0x55')](_0x477da4,function(_0x37e165){return _0x1c324c[_0x59631e]?_0x37e165[_0x08db('0x2c')]===_0x1c324c[_0x59631e][_0x08db('0x2c')]:null;});if(_0x100a04){if(_0x1c324c[_0x59631e][_0x08db('0x73')]){_0x3fcb22['push'](getAllResources(_0x48b7b4[_0x08db('0x70')],_0x1c324c[_0x59631e]));}else{if(!_0x1c324c[_0x59631e][_0x08db('0x51')]){_0x3fcb22['push'](getAllowedResources(_0x100a04,_0x1c324c[_0x59631e],_0x48b7b4[_0x08db('0x70')]));}else{if(_0x100a04[_0x08db('0x2f')]){_0x3fcb22['push'](getAllFilteredResources(_0x100a04,_0x1c324c[_0x59631e]));}}}}}return BPromise[_0x08db('0x72')](_0x3fcb22);}else{return null;}})[_0x08db('0x28')](function(_0x4fe0f6){var _0xabe7ae=_0x4fe0f6;var _0x49e0b7=null;if(_0xabe7ae){_0x49e0b7=_0xabe7ae[_0x08db('0x37')]===0x1?_0xabe7ae[0x0]:null;}if(_0x49e0b7||_0xabe7ae){var _0x205205=db[_0x48b7b4[_0x08db('0x70')]][_0x08db('0x47')];_0x4aec68['model']=_[_0x08db('0x32')](_0x205205);_0x4aec68['query']=_[_0x08db('0x32')](_0x5ec042['query']);_0x4aec68[_0x08db('0x33')]=_[_0x08db('0x34')](_0x4aec68['model'],_0x4aec68['query']);_0x5eb2ae[_0x08db('0x35')]=_[_0x08db('0x34')](_0x4aec68[_0x08db('0x2f')],qs[_0x08db('0x36')](_0x5ec042[_0x08db('0x31')][_0x08db('0x36')]));_0x5eb2ae[_0x08db('0x35')]=_0x5eb2ae['attributes'][_0x08db('0x37')]?_0x5eb2ae[_0x08db('0x35')]:_0x4aec68[_0x08db('0x2f')];if(!_0x5ec042['query']['hasOwnProperty'](_0x08db('0x39'))){_0x5eb2ae[_0x08db('0x21')]=qs[_0x08db('0x21')](_0x5ec042['query']['limit']);_0x5eb2ae[_0x08db('0x20')]=qs['offset'](_0x5ec042['query'][_0x08db('0x20')]);}_0x5eb2ae['order']=qs[_0x08db('0x3a')](_0x5ec042['query'][_0x08db('0x3a')]);_0x5eb2ae['where']=qs[_0x08db('0x33')](_[_0x08db('0x74')](_0x5ec042[_0x08db('0x31')],_0x4aec68[_0x08db('0x33')]));if(_0x5ec042[_0x08db('0x31')][_0x08db('0x3b')]){_0x5eb2ae[_0x08db('0x3c')]=_[_0x08db('0x3d')](_0x5eb2ae[_0x08db('0x3c')],{'$or':_[_0x08db('0x30')](_0x205205,function(_0x10d135){if(_0x10d135[_0x08db('0x75')][_0x08db('0x2e')]!==_0x08db('0x3e')){var _0x45bfd9={};_0x45bfd9[_0x10d135['field']]={'$like':'%'+_0x5ec042[_0x08db('0x31')]['filter']+'%'};return _0x45bfd9;}})});}var _0x5b1337=[];if(_0x49e0b7){var _0x19efa5=_[_0x08db('0x55')](_0x477da4,['name',_0x49e0b7[_0x08db('0x2c')]]);if(_0x19efa5[_0x08db('0x76')]){var _0xed682d={};if(_0x48b7b4[_0x08db('0x70')]==='AnalyticExtractedReport'){_0xed682d[_0x19efa5[_0x08db('0x77')]]=_[_0x08db('0x30')](_0x49e0b7[_0x08db('0x78')],'id');}else{_0xed682d[_0x19efa5[_0x08db('0x77')]]=_0x49e0b7[_0x08db('0x78')];}_0x5b1337[_0x08db('0x5a')](_0xed682d);}else{_0x5eb2ae['where']['id']=_0x49e0b7[_0x08db('0x78')];}}else{for(var _0x3c70a7=0x0;_0x3c70a7<_0xabe7ae[_0x08db('0x37')];_0x3c70a7++){var _0x19efa5=_['find'](_0x477da4,['name',_0xabe7ae[_0x3c70a7][_0x08db('0x2c')]]);if(_0x19efa5['field']){var _0xed682d={};_0xed682d[_0x19efa5[_0x08db('0x77')]]=_0xabe7ae[_0x3c70a7][_0x08db('0x78')];_0x5b1337[_0x08db('0x5a')](_0xed682d);}else{if(!_0x5eb2ae['where']['id'])_0x5eb2ae[_0x08db('0x3c')]['id']=[];_0xabe7ae[_0x3c70a7][_0x08db('0x78')][_0x08db('0x64')](function(_0x3eefda){_0x5eb2ae[_0x08db('0x3c')]['id'][_0x08db('0x5a')](_0x3eefda);});}}}if(!_[_0x08db('0x61')](_0x5b1337)){_0x5eb2ae[_0x08db('0x3c')]=_[_0x08db('0x3d')](_0x5eb2ae['where'],{'$and':{'$or':_0x5b1337}});}_0x5eb2ae=_[_0x08db('0x3d')]({},_0x5eb2ae,_0x5ec042[_0x08db('0x3f')]);if(_0x49e0b7&&!_0x49e0b7[_0x08db('0x51')]&&_0x48b7b4[_0x08db('0x70')]===_0x08db('0x79')){if(_0x5ec042[_0x08db('0x31')][_0x08db('0x41')]){_0x5eb2ae[_0x08db('0x48')]=[{'all':!![]}];}return db[_0x48b7b4['childModel']]['findAll'](_0x5eb2ae)[_0x08db('0x28')](function(_0xabeebb){var _0x406dbb=[];_0xabeebb[_0x08db('0x64')](function(_0x151452){var _0xa036b7;switch(_0x151452[_0x08db('0x7a')]){case _0x08db('0x7b'):_0xa036b7=_[_0x08db('0x55')](_0x49e0b7[_0x08db('0x78')],function(_0x4698c3){return _0x4698c3['id']===_0x151452[_0x08db('0x7c')]&&_0x4698c3[_0x08db('0x75')]===_0x08db('0x7d');});break;case _0x08db('0x7e'):_0xa036b7=_[_0x08db('0x55')](_0x49e0b7[_0x08db('0x78')],function(_0x17d722){return _0x17d722['id']===_0x151452['reportId']&&_0x17d722[_0x08db('0x75')]==='CustomReports';});break;}if(_0xa036b7)_0x406dbb[_0x08db('0x5a')](_0x151452);});_0x34d0b8['count']=_0x406dbb['length'];_0x34d0b8[_0x08db('0x43')]=_0x406dbb;return _0x34d0b8;});}else{return db[_0x48b7b4[_0x08db('0x70')]][_0x08db('0x1f')]({'where':_0x5eb2ae[_0x08db('0x3c')]})[_0x08db('0x28')](function(_0x1831e9){_0x34d0b8[_0x08db('0x1f')]=_0x1831e9;if(_0x5ec042['query'][_0x08db('0x41')]){if(_0x48b7b4['childModel']===_0x08db('0x7f')){_0x5eb2ae[_0x08db('0x48')]=[{'model':db[_0x08db('0x80')],'as':_0x08db('0x81'),'attributes':['id',_0x08db('0x2c'),_0x08db('0x82')],'required':_0x5ec042[_0x08db('0x31')][_0x08db('0x83')]?!![]:![]},{'model':db['Tag'],'as':'ThroughTags','attributes':['id',_0x08db('0x2c'),_0x08db('0x82')],'through':_0x5ec042[_0x08db('0x31')][_0x08db('0x83')]?{'attributes':[],'where':{'TagId':_0x5ec042[_0x08db('0x31')]['tag']||undefined}}:{},'required':_0x5ec042['query'][_0x08db('0x83')]?!![]:![]}];}else{_0x5eb2ae[_0x08db('0x48')]=[{'all':!![]}];}}return db[_0x48b7b4[_0x08db('0x70')]][_0x08db('0x42')](_0x5eb2ae);})['then'](function(_0x5ba8dc){_0x34d0b8[_0x08db('0x43')]=_0x5ba8dc;return _0x34d0b8;});}}else{return _0x34d0b8;}})[_0x08db('0x28')](respondWithFilteredResult(_0x16b350,_0x5eb2ae))[_0x08db('0x44')](handleError(_0x16b350,null));};function getAllResources(_0xfc5e8e,_0x207344){return new BPromise(function(_0x4d2714,_0xbf404a){if(_0x207344){var _0x32bb4a=_0x207344[_0x08db('0x3b')]?{[_0x207344[_0x08db('0x3b')][_0x08db('0x76')]]:_0x207344[_0x08db('0x3b')][_0x08db('0x84')]}:undefined;return db[_0xfc5e8e]['findAll']({'where':_0x32bb4a,'raw':!![]})[_0x08db('0x28')](function(_0x8c614d){_0x207344['associatedResources']=_[_0x08db('0x30')](_0x8c614d,'id');_0x4d2714(_0x207344);})[_0x08db('0x44')](function(_0x20047e){_0xbf404a(_0x20047e);});}else{_0x4d2714(null);}});}function getAllFilteredResources(_0x11d4ed,_0x46c4f0){return new BPromise(function(_0x914074,_0x1eaf1a){var _0x1831da=_0x11d4ed['filter']?{[_0x11d4ed['filter'][_0x08db('0x76')]]:_0x11d4ed[_0x08db('0x3b')]['value']}:undefined;return db[_0x11d4ed[_0x08db('0x2f')]][_0x08db('0x42')]({'where':_0x1831da,'raw':!![]})[_0x08db('0x28')](function(_0x10f238){_0x46c4f0['associatedResources']=_[_0x08db('0x30')](_0x10f238,function(_0x138376){return _0x138376[_0x08db('0x2c')];});_0x914074(_0x46c4f0);})['catch'](function(_0x576b10){_0x1eaf1a(_0x576b10);});});}function getAllowedResources(_0x46e8e6,_0x144a4c,_0x4a062d){return new BPromise(function(_0x405800,_0x12ce88){if(_0x144a4c){return db[_0x08db('0x52')]['findAll']({'where':{'sectionId':_0x144a4c['id']},'raw':!![]})[_0x08db('0x28')](function(_0x90a872){if(_0x46e8e6[_0x08db('0x76')]&&_0x46e8e6[_0x08db('0x76')]!=='id'){_0x144a4c[_0x08db('0x78')]=_[_0x08db('0x30')](_0x90a872,function(_0x3fa99f){return _0x3fa99f[_0x46e8e6['field']];});}else{if(_0x4a062d===_0x08db('0x79')){_0x144a4c[_0x08db('0x78')]=_[_0x08db('0x30')](_0x90a872,function(_0x86f212){return{'id':_0x86f212[_0x08db('0x65')],'type':_0x86f212['type']};});}else{_0x144a4c['associatedResources']=_[_0x08db('0x30')](_0x90a872,function(_0x318b76){return _0x318b76[_0x08db('0x65')];});}}_0x405800(_0x144a4c);})[_0x08db('0x44')](function(_0x21a351){_0x12ce88(_0x21a351);});}else{_0x405800(null);}});}function getQueryModels(_0x5cda8d,_0x562f7f){var _0x251f66=_0x5cda8d[_0x08db('0x85')]();var _0x1d3c0e={'childModel':undefined,'parentSections':[]};switch(_0x251f66){case _0x08db('0x86'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0x87');break;case _0x08db('0x88'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0x89');break;case _0x08db('0x8a'):_0x1d3c0e[_0x08db('0x70')]='SquareRecording';_0x1d3c0e[_0x08db('0x71')]=[{'name':'SquareProjects','field':_0x08db('0x2c'),'foreignKey':'projectName'}];break;case _0x08db('0x8b'):_0x1d3c0e[_0x08db('0x70')]='JscriptyProject';break;case _0x08db('0x8c'):_0x1d3c0e['childModel']='CmContact';_0x1d3c0e['parentSections']=[{'name':_0x08db('0x8d'),'field':'id','foreignKey':_0x08db('0x8e')}];break;case'lists':_0x1d3c0e[_0x08db('0x70')]=_0x08db('0x8f');break;case'companies':_0x1d3c0e['childModel']=_0x08db('0x90');break;case _0x08db('0x91'):_0x1d3c0e['childModel']=_0x08db('0x92');break;case _0x08db('0x93'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0x94');break;case _0x08db('0x95'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0x96');break;case _0x08db('0x97'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0x98');break;case _0x08db('0x99'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0x9a');break;case _0x08db('0x9b'):case'internalroutes':case _0x08db('0x9c'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0x9d');break;case'contexts':_0x1d3c0e[_0x08db('0x70')]='VoiceContext';break;case _0x08db('0x9e'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0x9f');break;case'voicerecordings':_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xa0');_0x1d3c0e[_0x08db('0x71')]=[{'name':_0x08db('0xa1'),'field':_0x08db('0x2c'),'foreignKey':'membername','model':_0x08db('0xa2'),'filter':{'field':'role','value':[_0x08db('0xa3')]}},{'name':_0x08db('0xa4'),'field':_0x08db('0x2c'),'foreignKey':_0x08db('0xa5'),'model':_0x08db('0xa2'),'filter':{'field':'role','value':[_0x08db('0xa6')]}},{'name':_0x08db('0xa7'),'field':_0x08db('0x2c'),'foreignKey':_0x08db('0xa8'),'model':_0x08db('0xa9'),'filter':{'field':'type','value':[_0x08db('0xaa')]}},{'name':'QueueCampaigns','field':_0x08db('0x2c'),'foreignKey':_0x08db('0xa8'),'model':_0x08db('0xa9'),'filter':{'field':_0x08db('0x75'),'value':[_0x08db('0xab')]}}];break;case _0x08db('0xac'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xad');break;case _0x08db('0xae'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xaf');break;case'voiceprefixes':_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xb0');break;case _0x08db('0xb1'):_0x1d3c0e['childModel']=_0x08db('0xb2');break;case'mailqueues':_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xb3');break;case _0x08db('0xb4'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xb5');break;case _0x08db('0xb6'):_0x1d3c0e['childModel']=_0x08db('0xb7');break;case _0x08db('0xb8'):_0x1d3c0e['childModel']=_0x08db('0xb9');break;case _0x08db('0xba'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xbb');break;case'smsqueues':_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xbc');break;case _0x08db('0xbd'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xbe');break;case _0x08db('0xbf'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xc0');break;case _0x08db('0xc1'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xc2');break;case _0x08db('0xc3'):_0x1d3c0e[_0x08db('0x70')]='Team';break;case _0x08db('0xc4'):case _0x08db('0xc5'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xa9');if(_0x562f7f){_0x1d3c0e[_0x08db('0x71')]=[{'name':_0x08db('0xa7')},{'name':'QueueCampaigns'}];}break;case _0x08db('0xc6'):case _0x08db('0xc7'):case _0x08db('0xc8'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xa2');if(_0x562f7f){_0x1d3c0e[_0x08db('0x71')]=[{'name':'Users','filter':{'field':_0x08db('0xc9'),'value':[_0x08db('0xca'),'user']},'ignore':!![]},{'name':_0x08db('0xa1')},{'name':_0x08db('0xa4')}];}break;case _0x08db('0xcb'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xcc');break;case'salesforceaccounts':_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xcd');break;case _0x08db('0xce'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xcf');break;case _0x08db('0xd0'):_0x1d3c0e[_0x08db('0x70')]='SugarcrmAccount';break;case'deskaccounts':_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xd1');break;case _0x08db('0xd2'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xd3');break;case'vtigeraccounts':_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xa2');break;case _0x08db('0xd4'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xd5');break;case _0x08db('0xd6'):_0x1d3c0e['childModel']=_0x08db('0xd7');break;case _0x08db('0xd8'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xd9');break;case'intervals':_0x1d3c0e['childModel']=_0x08db('0xda');break;case _0x08db('0xdb'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xdc');break;case'scheduler':_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xdd');break;case'sounds':_0x1d3c0e[_0x08db('0x70')]='Sound';break;case _0x08db('0xde'):_0x1d3c0e['childModel']=_0x08db('0x80');break;case _0x08db('0xdf'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xe0');break;case _0x08db('0xe1'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xe2');break;case'trunks':_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xe3');break;case _0x08db('0xe4'):_0x1d3c0e['childModel']='Variable';break;case _0x08db('0xe5'):_0x1d3c0e[_0x08db('0x70')]='Plugin';break;case _0x08db('0xe6'):_0x1d3c0e['childModel']=_0x08db('0x79');_0x1d3c0e[_0x08db('0x71')]=[{'name':'Reports','field':'id','foreignKey':_0x08db('0x7c')}];break;case'metrics':_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xe7');break;case _0x08db('0xc1'):_0x1d3c0e[_0x08db('0x70')]=_0x08db('0xc2');break;default:return _0x1d3c0e;}return _0x1d3c0e;} \ No newline at end of file +var _0x52ef=['vtigeraccounts','CannedAnswer','dispositions','Disposition','Dashboard','intervals','Interval','Pause','Schedule','Sound','templates','Template','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','metrics','AnalyticMetric','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','status','end','json','offset','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','UserProfile','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','find','create','body','options','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','each','UserProfileResource','userProfileId','Resources','UserProfileSection','describe','sectionId','get','removeSections','ids','getSections','filter','includes','subsections','enabled','push','autoAssociation','findOne','forEach','resourceId','addResources','bulkCreate','removeResources','getResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','childModel','Invalid\x20section\x20\x27','parentSections','all','ignore','isEmpty','union','hasOwnProperty','key','field','AnalyticExtractedReport','foreignKey','associatedResources','default','reportId','DefaultReports','CustomReports','CmContact','Tag','color','tag','ThroughTags','value','toLowerCase','squareprojects','SquareProject','squarerecordings','SquareRecording','SquareProjects','projectName','projects','Lists','ListId','lists','CmList','companies','globalcustomfields','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','VoiceRecording','membername','User','agent','Telephones','role','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailSubstatus','openchannelqueues','openchannelaccounts','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','telephones','Users','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount'];(function(_0x4703a7,_0x38e28f){var _0x377e51=function(_0x426a94){while(--_0x426a94){_0x4703a7['push'](_0x4703a7['shift']());}};_0x377e51(++_0x38e28f);}(_0x52ef,0x1d9));var _0xf52e=function(_0x150a67,_0x4406ca){_0x150a67=_0x150a67-0x0;var _0x505c8f=_0x52ef[_0x150a67];return _0x505c8f;};'use strict';var pdf=require(_0xf52e('0x0'));var emlformat=require(_0xf52e('0x1'));var rimraf=require(_0xf52e('0x2'));var zipdir=require(_0xf52e('0x3'));var jsonpatch=require(_0xf52e('0x4'));var rp=require(_0xf52e('0x5'));var moment=require(_0xf52e('0x6'));var BPromise=require(_0xf52e('0x7'));var Mustache=require(_0xf52e('0x8'));var util=require(_0xf52e('0x9'));var path=require('path');var sox=require(_0xf52e('0xa'));var csv=require(_0xf52e('0xb'));var ejs=require(_0xf52e('0xc'));var fs=require('fs');var _=require(_0xf52e('0xd'));var squel=require(_0xf52e('0xe'));var crypto=require(_0xf52e('0xf'));var jsforce=require(_0xf52e('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xf52e('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf52e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf52e('0x12'));var hardwareService=require(_0xf52e('0x13'));var logger=require('../../config/logger')(_0xf52e('0x14'));var utils=require(_0xf52e('0x15'));var config=require(_0xf52e('0x16'));var licenseUtil=require(_0xf52e('0x17'));var db=require(_0xf52e('0x18'))['db'];config['redis']=_[_0xf52e('0x19')](config[_0xf52e('0x1a')],{'host':_0xf52e('0x1b'),'port':0x18eb});var socket=require(_0xf52e('0x1c'))(new Redis(config['redis']));require('./userProfile.socket')[_0xf52e('0x1d')](socket);function respondWithStatusCode(_0x2641d8,_0x2f1b2c){_0x2f1b2c=_0x2f1b2c||0xcc;return function(_0x11f9f7){if(_0x11f9f7){return _0x2641d8['sendStatus'](_0x2f1b2c);}return _0x2641d8[_0xf52e('0x1e')](_0x2f1b2c)[_0xf52e('0x1f')]();};}function respondWithResult(_0x56f937,_0x39640b){_0x39640b=_0x39640b||0xc8;return function(_0x5b8712){if(_0x5b8712){return _0x56f937[_0xf52e('0x1e')](_0x39640b)[_0xf52e('0x20')](_0x5b8712);}};}function respondWithFilteredResult(_0x6ef067,_0x38e9f5){return function(_0x12e5d3){if(_0x12e5d3){var _0x4fdb6f=_0x12e5d3['count'],_0x528bd2=_0x38e9f5[_0xf52e('0x21')],_0x1b001f=_0x38e9f5[_0xf52e('0x21')]+_0x38e9f5['limit'],_0x337506;if(_0x1b001f>=_0x4fdb6f){_0x1b001f=_0x4fdb6f;_0x337506=0xc8;}else{_0x337506=0xce;}_0x6ef067[_0xf52e('0x1e')](_0x337506);return _0x6ef067['set'](_0xf52e('0x22'),_0x528bd2+'-'+_0x1b001f+'/'+_0x4fdb6f)[_0xf52e('0x20')](_0x12e5d3);}return null;};}function patchUpdates(_0x525c58){return function(_0x218359){try{jsonpatch['apply'](_0x218359,_0x525c58,!![]);}catch(_0x36bf29){return BPromise[_0xf52e('0x23')](_0x36bf29);}return _0x218359[_0xf52e('0x24')]();};}function saveUpdates(_0x51317e,_0x3ab906){return function(_0x4de48b){if(_0x4de48b){return _0x4de48b[_0xf52e('0x25')](_0x51317e)[_0xf52e('0x26')](function(_0x598741){return _0x598741;});}return null;};}function removeEntity(_0x19aec8,_0x4c9f8b){return function(_0x494eb7){if(_0x494eb7){return _0x494eb7[_0xf52e('0x27')]()[_0xf52e('0x26')](function(){_0x19aec8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x57b023,_0x481566){return function(_0x81bf0c){if(!_0x81bf0c){_0x57b023['sendStatus'](0x194);}return _0x81bf0c;};}function handleError(_0x15dea7,_0x598387){_0x598387=_0x598387||0x1f4;return function(_0x49f693){logger[_0xf52e('0x28')](_0x49f693['stack']);if(_0x49f693[_0xf52e('0x29')]){delete _0x49f693[_0xf52e('0x29')];}_0x15dea7[_0xf52e('0x1e')](_0x598387)[_0xf52e('0x2a')](_0x49f693);};}exports[_0xf52e('0x2b')]=function(_0x101dd7,_0x4d4f7f){var _0x1dc417={},_0x42417f={},_0x152eda={'count':0x0,'rows':[]};var _0x5ed136=_[_0xf52e('0x2c')](db[_0xf52e('0x2d')][_0xf52e('0x2e')],function(_0x55c9c2){return{'name':_0x55c9c2[_0xf52e('0x2f')],'type':_0x55c9c2[_0xf52e('0x30')]['key']};});_0x42417f[_0xf52e('0x31')]=_[_0xf52e('0x2c')](_0x5ed136,_0xf52e('0x29'));_0x42417f[_0xf52e('0x32')]=_[_0xf52e('0x33')](_0x101dd7[_0xf52e('0x32')]);_0x42417f[_0xf52e('0x34')]=_[_0xf52e('0x35')](_0x42417f['model'],_0x42417f['query']);_0x1dc417['attributes']=_['intersection'](_0x42417f[_0xf52e('0x31')],qs['fields'](_0x101dd7[_0xf52e('0x32')][_0xf52e('0x36')]));_0x1dc417['attributes']=_0x1dc417[_0xf52e('0x37')][_0xf52e('0x38')]?_0x1dc417[_0xf52e('0x37')]:_0x42417f[_0xf52e('0x31')];if(!_0x101dd7[_0xf52e('0x32')]['hasOwnProperty'](_0xf52e('0x39'))){_0x1dc417[_0xf52e('0x3a')]=qs[_0xf52e('0x3a')](_0x101dd7[_0xf52e('0x32')][_0xf52e('0x3a')]);_0x1dc417['offset']=qs['offset'](_0x101dd7[_0xf52e('0x32')][_0xf52e('0x21')]);}_0x1dc417[_0xf52e('0x3b')]=qs['sort'](_0x101dd7[_0xf52e('0x32')][_0xf52e('0x3c')]);_0x1dc417['where']=qs[_0xf52e('0x34')](_[_0xf52e('0x3d')](_0x101dd7[_0xf52e('0x32')],_0x42417f[_0xf52e('0x34')]),_0x5ed136);if(_0x101dd7[_0xf52e('0x32')]['filter']){_0x1dc417[_0xf52e('0x3e')]=_[_0xf52e('0x3f')](_0x1dc417['where'],{'$or':_[_0xf52e('0x2c')](_0x5ed136,function(_0x624656){if(_0x624656[_0xf52e('0x30')]!==_0xf52e('0x40')){var _0x47a6cf={};_0x47a6cf[_0x624656[_0xf52e('0x29')]]={'$like':'%'+_0x101dd7['query']['filter']+'%'};return _0x47a6cf;}})});}_0x1dc417=_[_0xf52e('0x3f')]({},_0x1dc417,_0x101dd7['options']);var _0x4b82bc={'where':_0x1dc417['where']};return db['UserProfile']['count'](_0x4b82bc)[_0xf52e('0x26')](function(_0x48e76b){_0x152eda[_0xf52e('0x41')]=_0x48e76b;if(_0x101dd7[_0xf52e('0x32')][_0xf52e('0x42')]){_0x1dc417[_0xf52e('0x43')]=[{'all':!![]}];}return db[_0xf52e('0x2d')][_0xf52e('0x44')](_0x1dc417);})[_0xf52e('0x26')](function(_0x36955f){_0x152eda[_0xf52e('0x45')]=_0x36955f;return _0x152eda;})[_0xf52e('0x26')](respondWithFilteredResult(_0x4d4f7f,_0x1dc417))[_0xf52e('0x46')](handleError(_0x4d4f7f,null));};exports['show']=function(_0x5b7b8c,_0x58e7d7){var _0x5a3bc9={'raw':![],'where':{'id':_0x5b7b8c[_0xf52e('0x47')]['id']}},_0x86f48d={};_0x86f48d[_0xf52e('0x31')]=_[_0xf52e('0x33')](db[_0xf52e('0x2d')][_0xf52e('0x2e')]);_0x86f48d['query']=_[_0xf52e('0x33')](_0x5b7b8c[_0xf52e('0x32')]);_0x86f48d['filters']=_[_0xf52e('0x35')](_0x86f48d[_0xf52e('0x31')],_0x86f48d['query']);_0x5a3bc9[_0xf52e('0x37')]=_[_0xf52e('0x35')](_0x86f48d['model'],qs['fields'](_0x5b7b8c[_0xf52e('0x32')][_0xf52e('0x36')]));_0x5a3bc9[_0xf52e('0x37')]=_0x5a3bc9[_0xf52e('0x37')]['length']?_0x5a3bc9[_0xf52e('0x37')]:_0x86f48d[_0xf52e('0x31')];if(_0x5b7b8c[_0xf52e('0x32')][_0xf52e('0x42')]){_0x5a3bc9[_0xf52e('0x43')]=[{'all':!![]}];}_0x5a3bc9=_['merge']({},_0x5a3bc9,_0x5b7b8c['options']);return db['UserProfile'][_0xf52e('0x48')](_0x5a3bc9)[_0xf52e('0x26')](handleEntityNotFound(_0x58e7d7,null))['then'](respondWithResult(_0x58e7d7,null))[_0xf52e('0x46')](handleError(_0x58e7d7,null));};exports[_0xf52e('0x49')]=function(_0x14b2b5,_0x32c180){return db[_0xf52e('0x2d')][_0xf52e('0x49')](_0x14b2b5[_0xf52e('0x4a')],{})[_0xf52e('0x26')](respondWithResult(_0x32c180,0xc9))[_0xf52e('0x46')](handleError(_0x32c180,null));};exports['clone']=function(_0x4cacfe,_0x46c13b){var _0x1d0fcd={'where':{'id':_0x4cacfe[_0xf52e('0x47')]['id']}},_0x736b20={};_0x736b20[_0xf52e('0x31')]=_[_0xf52e('0x33')](db[_0xf52e('0x2d')][_0xf52e('0x2e')]);_0x1d0fcd[_0xf52e('0x37')]=_[_0xf52e('0x35')](_0x736b20[_0xf52e('0x31')],qs[_0xf52e('0x36')](_0x4cacfe[_0xf52e('0x32')][_0xf52e('0x36')]));_0x1d0fcd[_0xf52e('0x37')]=_0x1d0fcd[_0xf52e('0x37')][_0xf52e('0x38')]?_0x1d0fcd[_0xf52e('0x37')]:_0x736b20[_0xf52e('0x31')];if(_0x4cacfe[_0xf52e('0x32')][_0xf52e('0x42')]){_0x1d0fcd[_0xf52e('0x43')]=[{'all':!![]}];}_0x1d0fcd=_[_0xf52e('0x3f')]({},_0x1d0fcd,_0x4cacfe[_0xf52e('0x4b')]);return db[_0xf52e('0x2d')][_0xf52e('0x48')](_0x1d0fcd)[_0xf52e('0x26')](handleEntityNotFound(_0x46c13b,null))[_0xf52e('0x26')](function(_0x119b2c){if(_0x119b2c){var _0x57e0f1=_0x119b2c['get']({'plain':!![]});_0x57e0f1=qs[_0xf52e('0x4c')](_0x57e0f1,['id',_0xf52e('0x4d'),_0xf52e('0x4e'),_0xf52e('0x4f')]);_0x4cacfe[_0xf52e('0x4a')]=_[_0xf52e('0x4c')](_0x4cacfe[_0xf52e('0x4a')],['id',_0xf52e('0x4d'),_0xf52e('0x4e')]);return db[_0xf52e('0x50')][_0xf52e('0x51')](function(_0x33ff4b){return db['UserProfile'][_0xf52e('0x49')](_[_0xf52e('0x3f')](_0x57e0f1,_0x4cacfe[_0xf52e('0x4a')]),{'include':_0x4cacfe[_0xf52e('0x32')][_0xf52e('0x42')]?[{'all':!![]}]:undefined,'transaction':_0x33ff4b})[_0xf52e('0x26')](function(_0x18be89){var _0x321843=_0x18be89['get']({'plain':!![]});return db['UserProfileSection'][_0xf52e('0x44')]({'where':{'userProfileId':_0x4cacfe['params']['id']},'raw':!![]})[_0xf52e('0x26')](function(_0x3f2e2e){if(_0x3f2e2e){return BPromise[_0xf52e('0x52')](_0x3f2e2e,function(_0x33a4e1){return new BPromise(function(_0x4ccf80,_0x161a9f){if(_0x33a4e1['autoAssociation']===null||_0x33a4e1['autoAssociation']===0x1)_0x4ccf80(null);return db[_0xf52e('0x53')][_0xf52e('0x44')]({'where':{'sectionId':_0x33a4e1['id']},'raw':!![]})['then'](function(_0x5b11c3){var _0x52d8dc=_[_0xf52e('0x2c')](_0x5b11c3,function(_0x183b92){return qs[_0xf52e('0x4c')](_0x183b92,['id',_0xf52e('0x4d'),_0xf52e('0x4e'),'sectionId']);});_0x4ccf80(_0x52d8dc);})[_0xf52e('0x46')](function(_0x276dd5){_0x161a9f(_0x276dd5);});})['then'](function(_0x2b1be9){var _0x4e8b39=qs[_0xf52e('0x4c')](_0x33a4e1,['id','createdAt',_0xf52e('0x4e')]);_0x4e8b39[_0xf52e('0x54')]=_0x321843['id'];if(_0x2b1be9)_0x4e8b39[_0xf52e('0x55')]=_0x2b1be9;return _0x4e8b39;})[_0xf52e('0x26')](function(_0x5ca94a){return db[_0xf52e('0x56')][_0xf52e('0x49')](_0x5ca94a,{'include':[{'model':db[_0xf52e('0x53')],'as':'Resources'}],'raw':!![],'transaction':_0x33ff4b});});})['then'](function(){return _0x321843;});}});});});}})[_0xf52e('0x26')](respondWithResult(_0x46c13b,0xc9))['catch'](handleError(_0x46c13b,null));};exports[_0xf52e('0x25')]=function(_0x594bd4,_0x23a235){if(_0x594bd4[_0xf52e('0x4a')]['id']){delete _0x594bd4['body']['id'];}return db[_0xf52e('0x2d')][_0xf52e('0x48')]({'where':{'id':_0x594bd4[_0xf52e('0x47')]['id']}})[_0xf52e('0x26')](handleEntityNotFound(_0x23a235,null))[_0xf52e('0x26')](saveUpdates(_0x594bd4[_0xf52e('0x4a')],null))[_0xf52e('0x26')](respondWithResult(_0x23a235,null))[_0xf52e('0x46')](handleError(_0x23a235,null));};exports['destroy']=function(_0x178fdc,_0x28ca71){return db['UserProfile']['find']({'where':{'id':_0x178fdc[_0xf52e('0x47')]['id']}})[_0xf52e('0x26')](handleEntityNotFound(_0x28ca71,null))[_0xf52e('0x26')](removeEntity(_0x28ca71,null))[_0xf52e('0x46')](handleError(_0x28ca71,null));};exports['describe']=function(_0x55acf8,_0x4292e4){return db['UserProfile'][_0xf52e('0x57')]()[_0xf52e('0x26')](respondWithResult(_0x4292e4,null))[_0xf52e('0x46')](handleError(_0x4292e4,null));};exports['addSections']=function(_0x397635,_0x2d380f){var _0x3e60d6=_0x397635[_0xf52e('0x4a')];return db[_0xf52e('0x2d')][_0xf52e('0x48')]({'where':{'id':_0x397635[_0xf52e('0x47')]['id']}})[_0xf52e('0x26')](handleEntityNotFound(_0x2d380f,null))[_0xf52e('0x26')](function(_0x2b32ff){if(_0x2b32ff){return db[_0xf52e('0x50')][_0xf52e('0x51')](function(_0x22d30c){return db['UserProfileSection'][_0xf52e('0x27')]({'where':{'userProfileId':_0x397635['params']['id'],'sectionId':_['map'](_0x3e60d6,function(_0x1cd401){return _0x1cd401[_0xf52e('0x58')];})},'transaction':_0x22d30c})[_0xf52e('0x26')](function(){var _0x2948db=_[_0xf52e('0x2c')](_0x3e60d6,function(_0x29a8ba){_0x29a8ba[_0xf52e('0x54')]=_0x397635[_0xf52e('0x47')]['id'];return _0x29a8ba;});var _0x624782=[];return BPromise[_0xf52e('0x52')](_0x2948db,function(_0x36b90a){return db[_0xf52e('0x56')][_0xf52e('0x49')](_0x36b90a,{'include':[{'model':db['UserProfileResource'],'as':_0xf52e('0x55')}],'raw':!![],'transaction':_0x22d30c})[_0xf52e('0x26')](function(_0x3b8b60){_0x624782['push'](_0x3b8b60[_0xf52e('0x59')]({'plain':!![]}));});})[_0xf52e('0x26')](function(){return _0x624782;});});});}})['then'](function(_0x410829){return _0x410829;})[_0xf52e('0x26')](respondWithResult(_0x2d380f,null))[_0xf52e('0x46')](handleError(_0x2d380f,null));};exports[_0xf52e('0x5a')]=function(_0x5aae3c,_0x2d2022){var _0x462894;return db[_0xf52e('0x2d')]['find']({'where':{'id':_0x5aae3c[_0xf52e('0x47')]['id']},'attributes':['id','name']})[_0xf52e('0x26')](handleEntityNotFound(_0x2d2022,null))[_0xf52e('0x26')](function(_0x45a65d){if(_0x45a65d){_0x462894=_0x45a65d;return db[_0xf52e('0x56')][_0xf52e('0x27')]({'where':{'userProfileId':_0x5aae3c[_0xf52e('0x47')]['id'],'sectionId':_0x5aae3c[_0xf52e('0x32')][_0xf52e('0x5b')]}});}})[_0xf52e('0x26')](function(){return _0x462894;})[_0xf52e('0x26')](respondWithStatusCode(_0x2d2022,null))[_0xf52e('0x46')](handleError(_0x2d2022,null));};exports[_0xf52e('0x5c')]=function(_0x51f309,_0x2a350c){var _0xaad2d2=[];var _0x1a4318=[];return db[_0xf52e('0x56')][_0xf52e('0x44')]({'where':{'userProfileId':_0x51f309[_0xf52e('0x47')]['id']},'raw':!![]})[_0xf52e('0x26')](function(_0x39ea7c){_0xaad2d2=_[_0xf52e('0x5d')](_0x39ea7c,function(_0x7c371d){return _0x7c371d['enabled']===0x1||_[_0xf52e('0x5e')]([0x3eb,0x709],_0x7c371d['sectionId']);});if(!_['isEmpty'](_0xaad2d2)){return _[_0xf52e('0x2c')](_0xaad2d2,function(_0x820e2d){return _0x820e2d[_0xf52e('0x58')];});}else{return;}})[_0xf52e('0x26')](function(_0xa447a9){if(_0xa447a9)_0x1a4318=_0xa447a9;if(_[_0xf52e('0x5e')](_0x1a4318,0x64)){var _0x5e40fe=_[_0xf52e('0x48')](_0xaad2d2,{'sectionId':0x64});return hasDefaultDashboard(_0x5e40fe)[_0xf52e('0x26')](function(_0x505b07){return _['map'](_0xaad2d2,function(_0x17b488){if(_0x17b488[_0xf52e('0x58')]===0x64){_0x17b488[_0xf52e('0x5f')]=_0x505b07;}return _0x17b488;});});}else{return;}})[_0xf52e('0x26')](function(_0x3adf05){if(_0x3adf05)_0xaad2d2=_0x3adf05;if(_[_0xf52e('0x5e')](_0x1a4318,0x3eb)){var _0xe5a97=_[_0xf52e('0x48')](_0xaad2d2,{'sectionId':0x3eb});return getCustomDashboards(_0xe5a97)[_0xf52e('0x26')](function(_0x86d240){return _[_0xf52e('0x2c')](_0xaad2d2,function(_0x8f2658){if(_0xe5a97[_0xf52e('0x60')]){if(_0x8f2658[_0xf52e('0x58')]===0x3eb){_0x8f2658[_0xf52e('0x5f')]=_0x86d240;}}else{if(_0x8f2658[_0xf52e('0x58')]===0x64){_0x8f2658['subsections']=_0x86d240;}}return _0x8f2658;});});}else{return;}})[_0xf52e('0x26')](function(_0x2a45c2){if(_0x2a45c2)_0xaad2d2=_0x2a45c2;if(_[_0xf52e('0x5e')](_0x1a4318,0x709)){var _0x23b5d4=_[_0xf52e('0x48')](_0xaad2d2,{'sectionId':0x709});return getPlugins(_0x23b5d4)[_0xf52e('0x26')](function(_0x4ee12b){if(_0x23b5d4[_0xf52e('0x60')]){return _[_0xf52e('0x2c')](_0xaad2d2,function(_0x18cf35){if(_0x18cf35[_0xf52e('0x58')]===0x709){_0x18cf35[_0xf52e('0x5f')]=_0x4ee12b;}return _0x18cf35;});}else{var _0x57bf83={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4ee12b};var _0x24603a=_['map'](_0xaad2d2);_0x24603a[_0xf52e('0x61')](_0x57bf83);return _0x24603a;}});}else{return;}})[_0xf52e('0x26')](function(_0x2ee883){if(_0x2ee883)_0xaad2d2=_0x2ee883;return _[_0xf52e('0x5d')](_0xaad2d2,[_0xf52e('0x60'),0x1]);})[_0xf52e('0x26')](respondWithResult(_0x2a350c,null))['catch'](handleError(_0x2a350c,null));};function hasDefaultDashboard(_0xcdd9cb){var _0x428e14=[0x65];return new BPromise(function(_0x16aa9d,_0x2b9d61){try{if(_0xcdd9cb[_0xf52e('0x62')]){_0x16aa9d(_0x428e14);}else{return db[_0xf52e('0x53')][_0xf52e('0x63')]({'where':{'sectionId':_0xcdd9cb['id']},'raw':!![]})['then'](function(_0x101fd2){_0x101fd2?_0x16aa9d(_0x428e14):_0x16aa9d();});}}catch(_0x2385d0){_0x2b9d61(_0x2385d0);}});}function getCustomDashboards(_0x14aaaf){var _0x1189b0=[];return new BPromise(function(_0x401c69,_0x6201c5){try{if(_0x14aaaf['autoAssociation']){return db['Dashboard'][_0xf52e('0x44')]({'raw':!![]})['then'](function(_0x483416){_0x483416[_0xf52e('0x64')](function(_0x2e46c7){_0x1189b0[_0xf52e('0x61')](_0x2e46c7['id']+0x1869f);});_0x401c69(_0x1189b0);});}else{return db[_0xf52e('0x53')][_0xf52e('0x44')]({'where':{'sectionId':_0x14aaaf['id']},'raw':!![]})[_0xf52e('0x26')](function(_0x51d547){_0x51d547[_0xf52e('0x64')](function(_0x54b978){_0x1189b0[_0xf52e('0x61')](_0x54b978[_0xf52e('0x65')]+0x1869f);});_0x401c69(_0x1189b0);});}}catch(_0x59c02e){_0x6201c5(_0x59c02e);}});}function getPlugins(_0x38293c){var _0x3e5cd0=[];return new BPromise(function(_0xe3bdf9,_0x33737e){try{if(_0x38293c[_0xf52e('0x62')]){return db['Plugin'][_0xf52e('0x44')]({'raw':!![]})[_0xf52e('0x26')](function(_0x5fea38){_0x5fea38[_0xf52e('0x64')](function(_0x327c1b){_0x3e5cd0[_0xf52e('0x61')](_0x327c1b['id']+0x15b38);});_0xe3bdf9(_0x3e5cd0);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x38293c['id']},'raw':!![]})[_0xf52e('0x26')](function(_0x5dbdf6){_0x5dbdf6[_0xf52e('0x64')](function(_0x90dc49){_0x3e5cd0[_0xf52e('0x61')](_0x90dc49[_0xf52e('0x65')]+0x15b38);});_0xe3bdf9(_0x3e5cd0);});}}catch(_0x575451){_0x33737e(_0x575451);}});}exports[_0xf52e('0x66')]=function(_0x3d85ac,_0x49d32d){return db[_0xf52e('0x2d')][_0xf52e('0x48')]({'where':{'id':_0x3d85ac[_0xf52e('0x47')]['id']}})['then'](handleEntityNotFound(_0x49d32d,null))['then'](function(_0x3b9453){if(_0x3b9453){return db['sequelize'][_0xf52e('0x51')](function(_0x2bece5){return db[_0xf52e('0x56')][_0xf52e('0x44')]({'where':{'userProfileId':_0x3d85ac[_0xf52e('0x47')]['id']},'attributes':['id'],'raw':!![]})[_0xf52e('0x26')](function(_0x2acf1f){if(_0x2acf1f){return db[_0xf52e('0x56')][_0xf52e('0x27')]({'where':{'userProfileId':_0x3d85ac[_0xf52e('0x47')]['id'],'id':_[_0xf52e('0x2c')](_0x2acf1f,function(_0x274cce){return _0x274cce['id'];})},'transaction':_0x2bece5});}})[_0xf52e('0x26')](function(_0x34c861){var _0x3850fb=_[_0xf52e('0x2c')](_0x3d85ac['body'],function(_0x497fd5){_0x497fd5['userProfileId']=_0x3d85ac[_0xf52e('0x47')]['id'];return _0x497fd5;});return db[_0xf52e('0x56')][_0xf52e('0x67')](_0x3850fb,{'raw':!![],'transaction':_0x2bece5});})[_0xf52e('0x26')](function(_0x278f28){var _0x2c4b9e=_[_0xf52e('0x5d')](_[_0xf52e('0x2c')](_0x278f28,function(_0xba152e){return _0xba152e[_0xf52e('0x59')]({'plain':!![]});}),{'includeAll':![]});if(_0x2c4b9e){return db[_0xf52e('0x56')][_0xf52e('0x44')]({'where':{'userProfileId':_0x3d85ac[_0xf52e('0x47')]['id'],'sectionId':_[_0xf52e('0x2c')](_0x2c4b9e,function(_0x4f6f78){return _0x4f6f78[_0xf52e('0x58')];})},'attributes':['id',_0xf52e('0x58')],'raw':!![]})[_0xf52e('0x26')](function(_0x3702cc){var _0x4d6a35=_[_0xf52e('0x2c')](_0x3d85ac[_0xf52e('0x4a')],function(_0x42b5f0){_0x42b5f0[_0xf52e('0x54')]=_0x3d85ac[_0xf52e('0x47')]['id'];return _0x42b5f0;});return db[_0xf52e('0x53')][_0xf52e('0x67')](_0x4d6a35,{'raw':!![],'transaction':_0x2bece5});});}})[_0xf52e('0x46')](handleError(_0x49d32d,null));});}})[_0xf52e('0x26')](function(_0x1d971a){var _0x171573=_[_0xf52e('0x2c')](_0x1d971a,function(_0x52f3a9){return _0x52f3a9[_0xf52e('0x59')]({'plain':!![]});});})['then'](respondWithResult(_0x49d32d,null))['catch'](handleError(_0x49d32d,null));};exports['removeResources']=function(_0x803b1b,_0x58b5f5,_0x7f3d4d){return db['UserProfile']['find']({'where':{'id':_0x803b1b[_0xf52e('0x47')]['id']}})[_0xf52e('0x26')](handleEntityNotFound(_0x58b5f5,null))[_0xf52e('0x26')](function(_0x456e62){if(_0x456e62){return _0x456e62[_0xf52e('0x68')](_0x803b1b[_0xf52e('0x32')][_0xf52e('0x5b')]);}})[_0xf52e('0x26')](respondWithStatusCode(_0x58b5f5,null))[_0xf52e('0x46')](handleError(_0x58b5f5,null));};exports[_0xf52e('0x69')]=function(_0x28edd9,_0x41ec63){var _0x24c7bb={'raw':![],'where':{}};var _0x1d4d87={};var _0x4a7816={'count':0x0,'rows':[]};var _0x233cf3=_0x28edd9['query'][_0xf52e('0x6a')];if(typeof _0x233cf3===_0xf52e('0x6b')){throw new db[(_0xf52e('0x6c'))][(_0xf52e('0x6d'))](_0xf52e('0x6e'));}var _0x1889e9=_0x28edd9[_0xf52e('0x32')]['mergeResources']||![];var _0x2ba321=getQueryModels(_0x233cf3,_0x1889e9);if(typeof _0x2ba321[_0xf52e('0x6f')]===_0xf52e('0x6b')){throw new db['Sequelize'][(_0xf52e('0x6d'))](_0xf52e('0x70')+_0x233cf3+'\x27');}var _0x53c2c1=[];if(!_['isEmpty'](_0x2ba321[_0xf52e('0x71')])){_0x53c2c1=_0x2ba321[_0xf52e('0x71')];}else{_0x53c2c1=[{'name':_0x233cf3}];}return db[_0xf52e('0x2d')][_0xf52e('0x63')]({'where':{'id':_0x28edd9['params']['id']}})[_0xf52e('0x26')](handleEntityNotFound(_0x41ec63,null))['then'](function(_0x840fbc){if(_0x840fbc){var _0x37fbb3=[];for(var _0x25c7d8=0x0;_0x25c7d8<_0x53c2c1[_0xf52e('0x38')];_0x25c7d8++){_0x37fbb3['push'](db[_0xf52e('0x56')][_0xf52e('0x63')]({'where':{'userProfileId':_0x840fbc['id'],'name':_0x53c2c1[_0x25c7d8][_0xf52e('0x29')]},'raw':!![]}));}return BPromise[_0xf52e('0x72')](_0x37fbb3);}})['then'](function(_0x3828b9){var _0x252fa7=_['filter'](_0x3828b9,function(_0x3c7b09){return _0x3c7b09?_0x3c7b09:undefined;});var _0x3417d8=_[_0xf52e('0x5d')](_0x53c2c1,[_0xf52e('0x73'),!![]]);var _0x56a559=_[_0xf52e('0x74')](_0x252fa7)&&_[_0xf52e('0x74')](_0x3417d8)?null:_[_0xf52e('0x75')](_0x3417d8,_0x252fa7);if(_0x56a559){var _0x4029a4=[];for(var _0x7fcd66=0x0;_0x7fcd66<_0x56a559[_0xf52e('0x38')];_0x7fcd66++){var _0x5449b1=_['find'](_0x53c2c1,function(_0xca062b){return _0x56a559[_0x7fcd66]?_0xca062b[_0xf52e('0x29')]===_0x56a559[_0x7fcd66]['name']:null;});if(_0x5449b1){if(_0x56a559[_0x7fcd66][_0xf52e('0x73')]){_0x4029a4['push'](getAllResources(_0x2ba321[_0xf52e('0x6f')],_0x56a559[_0x7fcd66]));}else{if(!_0x56a559[_0x7fcd66][_0xf52e('0x62')]){_0x4029a4['push'](getAllowedResources(_0x5449b1,_0x56a559[_0x7fcd66],_0x2ba321[_0xf52e('0x6f')]));}else{if(_0x5449b1[_0xf52e('0x31')]){_0x4029a4[_0xf52e('0x61')](getAllFilteredResources(_0x5449b1,_0x56a559[_0x7fcd66]));}}}}}return BPromise[_0xf52e('0x72')](_0x4029a4);}else{return null;}})[_0xf52e('0x26')](function(_0x30c12d){var _0x5ceaf7=_0x30c12d;var _0x51e0b6=null;if(_0x5ceaf7){_0x51e0b6=_0x5ceaf7[_0xf52e('0x38')]===0x1?_0x5ceaf7[0x0]:null;}if(_0x51e0b6||_0x5ceaf7){var _0x4ea212=db[_0x2ba321[_0xf52e('0x6f')]][_0xf52e('0x2e')];_0x1d4d87['model']=_[_0xf52e('0x33')](_0x4ea212);_0x1d4d87[_0xf52e('0x32')]=_[_0xf52e('0x33')](_0x28edd9[_0xf52e('0x32')]);_0x1d4d87[_0xf52e('0x34')]=_[_0xf52e('0x35')](_0x1d4d87[_0xf52e('0x31')],_0x1d4d87[_0xf52e('0x32')]);_0x24c7bb['attributes']=_['intersection'](_0x1d4d87[_0xf52e('0x31')],qs[_0xf52e('0x36')](_0x28edd9[_0xf52e('0x32')][_0xf52e('0x36')]));_0x24c7bb[_0xf52e('0x37')]=_0x24c7bb['attributes'][_0xf52e('0x38')]?_0x24c7bb[_0xf52e('0x37')]:_0x1d4d87[_0xf52e('0x31')];if(!_0x28edd9[_0xf52e('0x32')][_0xf52e('0x76')](_0xf52e('0x39'))){_0x24c7bb[_0xf52e('0x3a')]=qs[_0xf52e('0x3a')](_0x28edd9['query']['limit']);_0x24c7bb[_0xf52e('0x21')]=qs[_0xf52e('0x21')](_0x28edd9[_0xf52e('0x32')][_0xf52e('0x21')]);}_0x24c7bb[_0xf52e('0x3b')]=qs[_0xf52e('0x3c')](_0x28edd9[_0xf52e('0x32')][_0xf52e('0x3c')]);_0x24c7bb[_0xf52e('0x3e')]=qs[_0xf52e('0x34')](_['pick'](_0x28edd9[_0xf52e('0x32')],_0x1d4d87['filters']));if(_0x28edd9[_0xf52e('0x32')][_0xf52e('0x5d')]){_0x24c7bb[_0xf52e('0x3e')]=_[_0xf52e('0x3f')](_0x24c7bb[_0xf52e('0x3e')],{'$or':_[_0xf52e('0x2c')](_0x4ea212,function(_0x37e5d2){if(_0x37e5d2[_0xf52e('0x30')][_0xf52e('0x77')]!==_0xf52e('0x40')){var _0x3a8639={};_0x3a8639[_0x37e5d2[_0xf52e('0x78')]]={'$like':'%'+_0x28edd9[_0xf52e('0x32')]['filter']+'%'};return _0x3a8639;}})});}var _0x29b3e1=[];if(_0x51e0b6){var _0x4aa993=_[_0xf52e('0x48')](_0x53c2c1,[_0xf52e('0x29'),_0x51e0b6['name']]);if(_0x4aa993[_0xf52e('0x78')]){var _0x19371d={};if(_0x2ba321[_0xf52e('0x6f')]===_0xf52e('0x79')){_0x19371d[_0x4aa993[_0xf52e('0x7a')]]=_[_0xf52e('0x2c')](_0x51e0b6[_0xf52e('0x7b')],'id');}else{_0x19371d[_0x4aa993[_0xf52e('0x7a')]]=_0x51e0b6['associatedResources'];}_0x29b3e1[_0xf52e('0x61')](_0x19371d);}else{_0x24c7bb['where']['id']=_0x51e0b6[_0xf52e('0x7b')];}}else{for(var _0x5d87b1=0x0;_0x5d87b1<_0x5ceaf7[_0xf52e('0x38')];_0x5d87b1++){var _0x4aa993=_[_0xf52e('0x48')](_0x53c2c1,[_0xf52e('0x29'),_0x5ceaf7[_0x5d87b1][_0xf52e('0x29')]]);if(_0x4aa993[_0xf52e('0x78')]){var _0x19371d={};_0x19371d[_0x4aa993[_0xf52e('0x7a')]]=_0x5ceaf7[_0x5d87b1][_0xf52e('0x7b')];_0x29b3e1[_0xf52e('0x61')](_0x19371d);}else{if(!_0x24c7bb[_0xf52e('0x3e')]['id'])_0x24c7bb['where']['id']=[];_0x5ceaf7[_0x5d87b1][_0xf52e('0x7b')]['forEach'](function(_0x14e9c2){_0x24c7bb[_0xf52e('0x3e')]['id']['push'](_0x14e9c2);});}}}if(!_[_0xf52e('0x74')](_0x29b3e1)){_0x24c7bb[_0xf52e('0x3e')]=_['merge'](_0x24c7bb['where'],{'$and':{'$or':_0x29b3e1}});}_0x24c7bb=_[_0xf52e('0x3f')]({},_0x24c7bb,_0x28edd9[_0xf52e('0x4b')]);if(_0x51e0b6&&!_0x51e0b6[_0xf52e('0x62')]&&_0x2ba321[_0xf52e('0x6f')]===_0xf52e('0x79')){if(_0x28edd9[_0xf52e('0x32')]['includeAll']){_0x24c7bb[_0xf52e('0x43')]=[{'all':!![]}];}return db[_0x2ba321[_0xf52e('0x6f')]][_0xf52e('0x44')](_0x24c7bb)[_0xf52e('0x26')](function(_0x46cea4){var _0xa50c77=[];_0x46cea4[_0xf52e('0x64')](function(_0x3e9b0a){var _0x55422b;switch(_0x3e9b0a['reportType']){case _0xf52e('0x7c'):_0x55422b=_[_0xf52e('0x48')](_0x51e0b6[_0xf52e('0x7b')],function(_0x3fba9f){return _0x3fba9f['id']===_0x3e9b0a[_0xf52e('0x7d')]&&_0x3fba9f['type']===_0xf52e('0x7e');});break;case'custom':_0x55422b=_[_0xf52e('0x48')](_0x51e0b6['associatedResources'],function(_0x3bb6c3){return _0x3bb6c3['id']===_0x3e9b0a['reportId']&&_0x3bb6c3[_0xf52e('0x30')]===_0xf52e('0x7f');});break;}if(_0x55422b)_0xa50c77['push'](_0x3e9b0a);});_0x4a7816['count']=_0xa50c77[_0xf52e('0x38')];_0x4a7816[_0xf52e('0x45')]=_0xa50c77;return _0x4a7816;});}else{return db[_0x2ba321[_0xf52e('0x6f')]][_0xf52e('0x41')]({'where':_0x24c7bb[_0xf52e('0x3e')]})[_0xf52e('0x26')](function(_0x24d704){_0x4a7816['count']=_0x24d704;if(_0x28edd9['query']['includeAll']){if(_0x2ba321[_0xf52e('0x6f')]===_0xf52e('0x80')){_0x24c7bb['include']=[{'model':db[_0xf52e('0x81')],'as':'Tags','attributes':['id',_0xf52e('0x29'),_0xf52e('0x82')],'required':_0x28edd9[_0xf52e('0x32')][_0xf52e('0x83')]?!![]:![]},{'model':db[_0xf52e('0x81')],'as':_0xf52e('0x84'),'attributes':['id','name',_0xf52e('0x82')],'through':_0x28edd9[_0xf52e('0x32')]['tag']?{'attributes':[],'where':{'TagId':_0x28edd9[_0xf52e('0x32')][_0xf52e('0x83')]||undefined}}:{},'required':_0x28edd9[_0xf52e('0x32')]['tag']?!![]:![]}];}else{_0x24c7bb['include']=[{'all':!![]}];}}return db[_0x2ba321[_0xf52e('0x6f')]][_0xf52e('0x44')](_0x24c7bb);})['then'](function(_0x1cf45d){_0x4a7816['rows']=_0x1cf45d;return _0x4a7816;});}}else{return _0x4a7816;}})['then'](respondWithFilteredResult(_0x41ec63,_0x24c7bb))[_0xf52e('0x46')](handleError(_0x41ec63,null));};function getAllResources(_0x5f6be2,_0x219fa3){return new BPromise(function(_0x509296,_0x278ab4){if(_0x219fa3){var _0x426386=_0x219fa3[_0xf52e('0x5d')]?{[_0x219fa3[_0xf52e('0x5d')][_0xf52e('0x78')]]:_0x219fa3[_0xf52e('0x5d')][_0xf52e('0x85')]}:undefined;return db[_0x5f6be2][_0xf52e('0x44')]({'where':_0x426386,'raw':!![]})[_0xf52e('0x26')](function(_0x56da02){_0x219fa3[_0xf52e('0x7b')]=_[_0xf52e('0x2c')](_0x56da02,'id');_0x509296(_0x219fa3);})[_0xf52e('0x46')](function(_0x6d974a){_0x278ab4(_0x6d974a);});}else{_0x509296(null);}});}function getAllFilteredResources(_0x2dd6b1,_0x26e581){return new BPromise(function(_0x4859cb,_0x3291c2){var _0x18f23d=_0x2dd6b1[_0xf52e('0x5d')]?{[_0x2dd6b1[_0xf52e('0x5d')][_0xf52e('0x78')]]:_0x2dd6b1[_0xf52e('0x5d')][_0xf52e('0x85')]}:undefined;return db[_0x2dd6b1[_0xf52e('0x31')]]['findAll']({'where':_0x18f23d,'raw':!![]})[_0xf52e('0x26')](function(_0x332b04){_0x26e581[_0xf52e('0x7b')]=_[_0xf52e('0x2c')](_0x332b04,function(_0x5edc4d){return _0x5edc4d[_0xf52e('0x29')];});_0x4859cb(_0x26e581);})['catch'](function(_0x4ed8f1){_0x3291c2(_0x4ed8f1);});});}function getAllowedResources(_0x272c7d,_0x37162a,_0x17dde2){return new BPromise(function(_0x444105,_0x167a67){if(_0x37162a){return db['UserProfileResource'][_0xf52e('0x44')]({'where':{'sectionId':_0x37162a['id']},'raw':!![]})[_0xf52e('0x26')](function(_0x562fb6){if(_0x272c7d[_0xf52e('0x78')]&&_0x272c7d['field']!=='id'){_0x37162a[_0xf52e('0x7b')]=_[_0xf52e('0x2c')](_0x562fb6,function(_0x2b8afa){return _0x2b8afa[_0x272c7d[_0xf52e('0x78')]];});}else{if(_0x17dde2==='AnalyticExtractedReport'){_0x37162a[_0xf52e('0x7b')]=_[_0xf52e('0x2c')](_0x562fb6,function(_0x1223c2){return{'id':_0x1223c2['resourceId'],'type':_0x1223c2[_0xf52e('0x30')]};});}else{_0x37162a[_0xf52e('0x7b')]=_[_0xf52e('0x2c')](_0x562fb6,function(_0x2fd6ad){return _0x2fd6ad[_0xf52e('0x65')];});}}_0x444105(_0x37162a);})[_0xf52e('0x46')](function(_0x52224b){_0x167a67(_0x52224b);});}else{_0x444105(null);}});}function getQueryModels(_0x136960,_0x32577d){var _0x3920d0=_0x136960[_0xf52e('0x86')]();var _0x3a3cef={'childModel':undefined,'parentSections':[]};switch(_0x3920d0){case _0xf52e('0x87'):_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0x88');break;case'odbc':_0x3a3cef[_0xf52e('0x6f')]='SquareOdbc';break;case _0xf52e('0x89'):_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0x8a');_0x3a3cef[_0xf52e('0x71')]=[{'name':_0xf52e('0x8b'),'field':_0xf52e('0x29'),'foreignKey':_0xf52e('0x8c')}];break;case _0xf52e('0x8d'):_0x3a3cef[_0xf52e('0x6f')]='JscriptyProject';break;case'contacts':_0x3a3cef['childModel']=_0xf52e('0x80');_0x3a3cef[_0xf52e('0x71')]=[{'name':_0xf52e('0x8e'),'field':'id','foreignKey':_0xf52e('0x8f')}];break;case _0xf52e('0x90'):_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0x91');break;case _0xf52e('0x92'):_0x3a3cef[_0xf52e('0x6f')]='CmCompany';break;case _0xf52e('0x93'):_0x3a3cef[_0xf52e('0x6f')]='CmCustomField';break;case _0xf52e('0x94'):_0x3a3cef['childModel']=_0xf52e('0x95');break;case'chatwebsites':_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0x96');break;case _0xf52e('0x97'):_0x3a3cef[_0xf52e('0x6f')]='FaxQueue';break;case'faxaccounts':_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0x98');break;case _0xf52e('0x99'):case'internalroutes':case _0xf52e('0x9a'):_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0x9b');break;case _0xf52e('0x9c'):_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0x9d');break;case _0xf52e('0x9e'):_0x3a3cef['childModel']=_0xf52e('0x9f');break;case'voicerecordings':_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0xa0');_0x3a3cef['parentSections']=[{'name':'Agents','field':_0xf52e('0x29'),'foreignKey':_0xf52e('0xa1'),'model':_0xf52e('0xa2'),'filter':{'field':'role','value':[_0xf52e('0xa3')]}},{'name':_0xf52e('0xa4'),'field':_0xf52e('0x29'),'foreignKey':'membername','model':_0xf52e('0xa2'),'filter':{'field':_0xf52e('0xa5'),'value':[_0xf52e('0xa6')]}},{'name':_0xf52e('0xa7'),'field':'name','foreignKey':'queue','model':_0xf52e('0xa8'),'filter':{'field':'type','value':[_0xf52e('0xa9')]}},{'name':_0xf52e('0xaa'),'field':_0xf52e('0x29'),'foreignKey':_0xf52e('0xab'),'model':_0xf52e('0xa8'),'filter':{'field':_0xf52e('0x30'),'value':[_0xf52e('0xac')]}}];break;case'musiconholds':_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0xad');break;case _0xf52e('0xae'):_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0xaf');break;case'voiceprefixes':_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0xb0');break;case _0xf52e('0xb1'):_0x3a3cef['childModel']=_0xf52e('0xb2');break;case _0xf52e('0xb3'):_0x3a3cef[_0xf52e('0x6f')]='MailQueue';break;case'mailaccounts':_0x3a3cef[_0xf52e('0x6f')]='MailAccount';break;case'mailsubstatuses':_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0xb4');break;case _0xf52e('0xb5'):_0x3a3cef[_0xf52e('0x6f')]='OpenchannelQueue';break;case _0xf52e('0xb6'):_0x3a3cef[_0xf52e('0x6f')]='OpenchannelAccount';break;case'smsqueues':_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0xb7');break;case _0xf52e('0xb8'):_0x3a3cef['childModel']=_0xf52e('0xb9');break;case _0xf52e('0xba'):_0x3a3cef['childModel']=_0xf52e('0xbb');break;case _0xf52e('0xbc'):_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0xbd');break;case _0xf52e('0xbe'):_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0xbf');break;case'voicequeues':case _0xf52e('0xc0'):_0x3a3cef['childModel']=_0xf52e('0xa8');if(_0x32577d){_0x3a3cef[_0xf52e('0x71')]=[{'name':'VoiceQueues'},{'name':_0xf52e('0xaa')}];}break;case'users':case'agents':case _0xf52e('0xc1'):_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0xa2');if(_0x32577d){_0x3a3cef[_0xf52e('0x71')]=[{'name':_0xf52e('0xc2'),'filter':{'field':'role','value':['admin',_0xf52e('0xc3')]},'ignore':!![]},{'name':'Agents'},{'name':_0xf52e('0xa4')}];}break;case _0xf52e('0xc4'):_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0xc5');break;case _0xf52e('0xc6'):_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0xc7');break;case'freshdeskaccounts':_0x3a3cef['childModel']=_0xf52e('0xc8');break;case _0xf52e('0xc9'):_0x3a3cef['childModel']=_0xf52e('0xca');break;case _0xf52e('0xcb'):_0x3a3cef['childModel']=_0xf52e('0xcc');break;case'zohoaccounts':_0x3a3cef[_0xf52e('0x6f')]='ZohoAccount';break;case _0xf52e('0xcd'):_0x3a3cef[_0xf52e('0x6f')]='User';break;case'cannedanswers':_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0xce');break;case _0xf52e('0xcf'):_0x3a3cef['childModel']=_0xf52e('0xd0');break;case'customdashboards':_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0xd1');break;case _0xf52e('0xd2'):_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0xd3');break;case'pauses':_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0xd4');break;case'scheduler':_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0xd5');break;case'sounds':_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0xd6');break;case'tags':_0x3a3cef[_0xf52e('0x6f')]='Tag';break;case _0xf52e('0xd7'):_0x3a3cef['childModel']=_0xf52e('0xd8');break;case'triggers':_0x3a3cef[_0xf52e('0x6f')]='Trigger';break;case _0xf52e('0xd9'):_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0xda');break;case _0xf52e('0xdb'):_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0xdc');break;case _0xf52e('0xdd'):_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0xde');break;case _0xf52e('0xdf'):_0x3a3cef['childModel']='AnalyticExtractedReport';_0x3a3cef[_0xf52e('0x71')]=[{'name':'Reports','field':'id','foreignKey':_0xf52e('0x7d')}];break;case _0xf52e('0xe0'):_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0xe1');break;case _0xf52e('0xbc'):_0x3a3cef[_0xf52e('0x6f')]=_0xf52e('0xbd');break;default:return _0x3a3cef;}return _0x3a3cef;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index d600754..5b6316f 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 _0xa337=['save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x59eddd,_0xb26fcc){var _0x27364f=function(_0x5d6b3a){while(--_0x5d6b3a){_0x59eddd['push'](_0x59eddd['shift']());}};_0x27364f(++_0xb26fcc);}(_0xa337,0x92));var _0x7a33=function(_0x1d87d9,_0x588dde){_0x1d87d9=_0x1d87d9-0x0;var _0xc7a600=_0xa337[_0x1d87d9];return _0xc7a600;};'use strict';var EventEmitter=require(_0x7a33('0x0'));var UserProfile=require('../../mysqldb')['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7a33('0x1'),'afterUpdate':'update','afterDestroy':_0x7a33('0x2')};function emitEvent(_0x249e35){return function(_0x3af896,_0x2ce976,_0x4dd361){UserProfileEvents[_0x7a33('0x3')](_0x249e35+':'+_0x3af896['id'],_0x3af896);UserProfileEvents['emit'](_0x249e35,_0x3af896);_0x4dd361(null);};}for(var e in events){if(events[_0x7a33('0x4')](e)){var event=events[e];UserProfile[_0x7a33('0x5')](e,emitEvent(event));}}module[_0x7a33('0x6')]=UserProfileEvents; \ No newline at end of file +var _0x0974=['../../mysqldb','UserProfile','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0974,0x1e9));var _0x4097=function(_0x4c54de,_0x2f862b){_0x4c54de=_0x4c54de-0x0;var _0x59c9b0=_0x0974[_0x4c54de];return _0x59c9b0;};'use strict';var EventEmitter=require(_0x4097('0x0'));var UserProfile=require(_0x4097('0x1'))['db'][_0x4097('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4097('0x3'),'afterUpdate':_0x4097('0x4'),'afterDestroy':_0x4097('0x5')};function emitEvent(_0x45810e){return function(_0x52cb55,_0x17283b,_0x1d959f){UserProfileEvents['emit'](_0x45810e+':'+_0x52cb55['id'],_0x52cb55);UserProfileEvents[_0x4097('0x6')](_0x45810e,_0x52cb55);_0x1d959f(null);};}for(var e in events){if(events[_0x4097('0x7')](e)){var event=events[e];UserProfile[_0x4097('0x8')](e,emitEvent(event));}}module[_0x4097('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 437b448..37aeff8 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 _0x6057=['moment','bluebird','path','rimraf','../../config/environment','./userProfile.attributes','exports','define','user_profiles','lodash','util','../../config/logger','api'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x6057,0x175));var _0x7605=function(_0x1a1b6e,_0x3a07a9){_0x1a1b6e=_0x1a1b6e-0x0;var _0x571e2c=_0x6057[_0x1a1b6e];return _0x571e2c;};'use strict';var _=require(_0x7605('0x0'));var util=require(_0x7605('0x1'));var logger=require(_0x7605('0x2'))(_0x7605('0x3'));var moment=require(_0x7605('0x4'));var BPromise=require(_0x7605('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7605('0x6'));var rimraf=require(_0x7605('0x7'));var config=require(_0x7605('0x8'));var attributes=require(_0x7605('0x9'));module[_0x7605('0xa')]=function(_0x162fec,_0x4be189){return _0x162fec[_0x7605('0xb')]('UserProfile',attributes,{'tableName':_0x7605('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6743=['path','../../config/environment','./userProfile.attributes','exports','define','UserProfile','user_profiles','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x62e15e,_0x4eccc4){var _0x56a9ef=function(_0x40ae7){while(--_0x40ae7){_0x62e15e['push'](_0x62e15e['shift']());}};_0x56a9ef(++_0x4eccc4);}(_0x6743,0x19d));var _0x3674=function(_0x28836b,_0x389433){_0x28836b=_0x28836b-0x0;var _0x51f3f8=_0x6743[_0x28836b];return _0x51f3f8;};'use strict';var _=require(_0x3674('0x0'));var util=require(_0x3674('0x1'));var logger=require(_0x3674('0x2'))(_0x3674('0x3'));var moment=require(_0x3674('0x4'));var BPromise=require(_0x3674('0x5'));var rp=require(_0x3674('0x6'));var fs=require('fs');var path=require(_0x3674('0x7'));var rimraf=require('rimraf');var config=require(_0x3674('0x8'));var attributes=require(_0x3674('0x9'));module[_0x3674('0xa')]=function(_0x3cd6d4,_0x930f74){return _0x3cd6d4[_0x3674('0xb')](_0x3674('0xc'),attributes,{'tableName':_0x3674('0xd'),'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 1da05dd..1aac1dd 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 _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','./userProfile.socket','register','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring'];(function(_0x380168,_0x40546c){var _0x12e86d=function(_0x559ef7){while(--_0x559ef7){_0x380168['push'](_0x380168['shift']());}};_0x12e86d(++_0x40546c);}(_0xe14b,0x93));var _0xbe14=function(_0x56d952,_0x1ef93d){_0x56d952=_0x56d952-0x0;var _0x4fdd5a=_0xe14b[_0x56d952];return _0x4fdd5a;};'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});config[_0xbe14('0x9')]=_[_0xbe14('0xa')](config[_0xbe14('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbe14('0xb'))[_0xbe14('0xc')](socket);function respondWithRpcPromise(_0xd68cd7,_0x90b4f,_0x53c7ea){return new BPromise(function(_0x5b9fc6,_0x113243){return client[_0xbe14('0xd')](_0xd68cd7,_0x53c7ea)['then'](function(_0x254c3b){logger[_0xbe14('0xe')](_0xbe14('0xf'),_0x90b4f,_0xbe14('0x10'));logger[_0xbe14('0x11')](_0xbe14('0x12'),_0x90b4f,_0xbe14('0x10'),JSON[_0xbe14('0x13')](_0x254c3b));if(_0x254c3b[_0xbe14('0x14')]){if(_0x254c3b[_0xbe14('0x14')][_0xbe14('0x15')]===0x1f4){logger[_0xbe14('0x14')](_0xbe14('0xf'),_0x90b4f,_0x254c3b['error']['message']);return _0x113243(_0x254c3b[_0xbe14('0x14')][_0xbe14('0x16')]);}logger[_0xbe14('0x14')](_0xbe14('0xf'),_0x90b4f,_0x254c3b['error'][_0xbe14('0x16')]);return _0x5b9fc6(_0x254c3b[_0xbe14('0x14')][_0xbe14('0x16')]);}else{logger[_0xbe14('0xe')](_0xbe14('0xf'),_0x90b4f,_0xbe14('0x10'));_0x5b9fc6(_0x254c3b[_0xbe14('0x17')]['message']);}})[_0xbe14('0x18')](function(_0x456ca8){logger[_0xbe14('0x14')](_0xbe14('0xf'),_0x90b4f,_0x456ca8);_0x113243(_0x456ca8);});});} \ No newline at end of file +var _0x5fd1=['http','redis','defaults','localhost','socket.io-emitter','register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x526dca,_0xe65155){var _0xc2d3c2=function(_0x4eef1f){while(--_0x4eef1f){_0x526dca['push'](_0x526dca['shift']());}};_0xc2d3c2(++_0xe65155);}(_0x5fd1,0x155));var _0x15fd=function(_0x18ae38,_0x154dc7){_0x18ae38=_0x18ae38-0x0;var _0x3e8a3e=_0x5fd1[_0x18ae38];return _0x3e8a3e;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var moment=require(_0x15fd('0x1'));var BPromise=require(_0x15fd('0x2'));var rs=require(_0x15fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x15fd('0x4'));var logger=require(_0x15fd('0x5'))(_0x15fd('0x6'));var config=require('../../config/environment');var jayson=require(_0x15fd('0x7'));var client=jayson[_0x15fd('0x8')][_0x15fd('0x9')]({'port':0x232a});config[_0x15fd('0xa')]=_[_0x15fd('0xb')](config['redis'],{'host':_0x15fd('0xc'),'port':0x18eb});var socket=require(_0x15fd('0xd'))(new Redis(config[_0x15fd('0xa')]));require('./userProfile.socket')[_0x15fd('0xe')](socket);function respondWithRpcPromise(_0x5c9c63,_0x3dfdbb,_0x250457){return new BPromise(function(_0x4c226a,_0x4883fd){return client['request'](_0x5c9c63,_0x250457)[_0x15fd('0xf')](function(_0x2a4d55){logger[_0x15fd('0x10')](_0x15fd('0x11'),_0x3dfdbb,_0x15fd('0x12'));logger[_0x15fd('0x13')](_0x15fd('0x14'),_0x3dfdbb,_0x15fd('0x12'),JSON[_0x15fd('0x15')](_0x2a4d55));if(_0x2a4d55['error']){if(_0x2a4d55['error']['code']===0x1f4){logger[_0x15fd('0x16')](_0x15fd('0x11'),_0x3dfdbb,_0x2a4d55[_0x15fd('0x16')][_0x15fd('0x17')]);return _0x4883fd(_0x2a4d55[_0x15fd('0x16')][_0x15fd('0x17')]);}logger[_0x15fd('0x16')](_0x15fd('0x11'),_0x3dfdbb,_0x2a4d55['error']['message']);return _0x4c226a(_0x2a4d55[_0x15fd('0x16')]['message']);}else{logger[_0x15fd('0x10')]('UserProfile,\x20%s,\x20%s',_0x3dfdbb,_0x15fd('0x12'));_0x4c226a(_0x2a4d55[_0x15fd('0x18')][_0x15fd('0x17')]);}})['catch'](function(_0x367c36){logger[_0x15fd('0x16')](_0x15fd('0x11'),_0x3dfdbb,_0x367c36);_0x4883fd(_0x367c36);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index f768e4d..2069a91 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 _0xfed7=['remove','update','emit','removeListener','userProfile:','./userProfile.events','save'];(function(_0x531318,_0x30f19f){var _0x11ab09=function(_0x1795d9){while(--_0x1795d9){_0x531318['push'](_0x531318['shift']());}};_0x11ab09(++_0x30f19f);}(_0xfed7,0x108));var _0x7fed=function(_0x3b594b,_0x5835c3){_0x3b594b=_0x3b594b-0x0;var _0x1ea5f8=_0xfed7[_0x3b594b];return _0x1ea5f8;};'use strict';var UserProfileEvents=require(_0x7fed('0x0'));var events=[_0x7fed('0x1'),_0x7fed('0x2'),_0x7fed('0x3')];function createListener(_0x1c1007,_0x1a31df){return function(_0x248700){_0x1a31df[_0x7fed('0x4')](_0x1c1007,_0x248700);};}function removeListener(_0x805974,_0x12094d){return function(){UserProfileEvents[_0x7fed('0x5')](_0x805974,_0x12094d);};}exports['register']=function(_0x1bbaa7){for(var _0x11d378=0x0,_0x41ea0f=events['length'];_0x11d378<_0x41ea0f;_0x11d378++){var _0x4e53a5=events[_0x11d378];var _0x475cb2=createListener(_0x7fed('0x6')+_0x4e53a5,_0x1bbaa7);UserProfileEvents['on'](_0x4e53a5,_0x475cb2);}}; \ No newline at end of file +var _0xaa71=['emit','removeListener','length','./userProfile.events','update'];(function(_0x11819d,_0x561264){var _0x42a7b2=function(_0x23e207){while(--_0x23e207){_0x11819d['push'](_0x11819d['shift']());}};_0x42a7b2(++_0x561264);}(_0xaa71,0x161));var _0x1aa7=function(_0x10424f,_0x53bc6a){_0x10424f=_0x10424f-0x0;var _0x317cec=_0xaa71[_0x10424f];return _0x317cec;};'use strict';var UserProfileEvents=require(_0x1aa7('0x0'));var events=['save','remove',_0x1aa7('0x1')];function createListener(_0x1b4336,_0x436eb9){return function(_0x1973b7){_0x436eb9[_0x1aa7('0x2')](_0x1b4336,_0x1973b7);};}function removeListener(_0x39ea7a,_0x2721e8){return function(){UserProfileEvents[_0x1aa7('0x3')](_0x39ea7a,_0x2721e8);};}exports['register']=function(_0xa07ec0){for(var _0x1c8287=0x0,_0xc9a46b=events[_0x1aa7('0x4')];_0x1c8287<_0xc9a46b;_0x1c8287++){var _0x291c81=events[_0x1c8287];var _0x1f175b=createListener('userProfile:'+_0x291c81,_0xa07ec0);UserProfileEvents['on'](_0x291c81,_0x1f175b);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 5834535..49f119f 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 _0x8d8f=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x8d8f,0x13d));var _0xf8d8=function(_0x5587df,_0x2c6f07){_0x5587df=_0x5587df-0x0;var _0x384d01=_0x8d8f[_0x5587df];return _0x384d01;};'use strict';var multer=require(_0xf8d8('0x0'));var util=require(_0xf8d8('0x1'));var path=require(_0xf8d8('0x2'));var timeout=require(_0xf8d8('0x3'));var express=require(_0xf8d8('0x4'));var router=express[_0xf8d8('0x5')]();var auth=require(_0xf8d8('0x6'));var interaction=require(_0xf8d8('0x7'));var config=require(_0xf8d8('0x8'));var controller=require(_0xf8d8('0x9'));router[_0xf8d8('0xa')]('/',auth[_0xf8d8('0xb')](),controller['index']);router['get'](_0xf8d8('0xc'),auth['isAuthenticated'](),controller[_0xf8d8('0xd')]);router[_0xf8d8('0xa')](_0xf8d8('0xe'),auth[_0xf8d8('0xb')](),controller[_0xf8d8('0xf')]);router[_0xf8d8('0x10')]('/',auth[_0xf8d8('0xb')](),controller[_0xf8d8('0x11')]);router['put'](_0xf8d8('0xe'),auth[_0xf8d8('0xb')](),controller[_0xf8d8('0x12')]);router['delete'](_0xf8d8('0xe'),auth[_0xf8d8('0xb')](),controller[_0xf8d8('0x13')]);module[_0xf8d8('0x14')]=router; \ No newline at end of file +var _0xada7=['put','delete','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','describe','/:id','show','post','create'];(function(_0x56eb70,_0x2bd75c){var _0x47f1fe=function(_0x1fbb17){while(--_0x1fbb17){_0x56eb70['push'](_0x56eb70['shift']());}};_0x47f1fe(++_0x2bd75c);}(_0xada7,0x120));var _0x7ada=function(_0x5ca8d9,_0x7d40e2){_0x5ca8d9=_0x5ca8d9-0x0;var _0x1742b1=_0xada7[_0x5ca8d9];return _0x1742b1;};'use strict';var multer=require(_0x7ada('0x0'));var util=require('util');var path=require(_0x7ada('0x1'));var timeout=require('connect-timeout');var express=require(_0x7ada('0x2'));var router=express[_0x7ada('0x3')]();var auth=require(_0x7ada('0x4'));var interaction=require(_0x7ada('0x5'));var config=require(_0x7ada('0x6'));var controller=require(_0x7ada('0x7'));router[_0x7ada('0x8')]('/',auth[_0x7ada('0x9')](),controller[_0x7ada('0xa')]);router[_0x7ada('0x8')]('/describe',auth[_0x7ada('0x9')](),controller[_0x7ada('0xb')]);router['get'](_0x7ada('0xc'),auth['isAuthenticated'](),controller[_0x7ada('0xd')]);router[_0x7ada('0xe')]('/',auth['isAuthenticated'](),controller[_0x7ada('0xf')]);router[_0x7ada('0x10')](_0x7ada('0xc'),auth[_0x7ada('0x9')](),controller['update']);router[_0x7ada('0x11')](_0x7ada('0xc'),auth[_0x7ada('0x9')](),controller[_0x7ada('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 437d650..6232037 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 _0x7b47=['sequelize','exports','INTEGER','STRING'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x7b47,0x1e8));var _0x77b4=function(_0x8424ab,_0x3283d5){_0x8424ab=_0x8424ab-0x0;var _0x23988a=_0x7b47[_0x8424ab];return _0x23988a;};'use strict';var Sequelize=require(_0x77b4('0x0'));module[_0x77b4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x77b4('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x77b4('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x7b4f=['STRING','sequelize','INTEGER'];(function(_0x3814eb,_0xca9c10){var _0x319966=function(_0x24be12){while(--_0x24be12){_0x3814eb['push'](_0x3814eb['shift']());}};_0x319966(++_0xca9c10);}(_0x7b4f,0x160));var _0xf7b4=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0x7b4f[_0x1d1d09];return _0x8827e;};'use strict';var Sequelize=require(_0xf7b4('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xf7b4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf7b4('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 583b1dc..39f44a5 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 _0x7fbe=['fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','includeAll','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection'];(function(_0x1c3375,_0x29cf53){var _0x179181=function(_0xc0207c){while(--_0xc0207c){_0x1c3375['push'](_0x1c3375['shift']());}};_0x179181(++_0x29cf53);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x5a184b,_0x457876){_0x5a184b=_0x5a184b-0x0;var _0x713964=_0x7fbe[_0x5a184b];return _0x713964;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe7fb('0x0'));var zipdir=require(_0xe7fb('0x1'));var jsonpatch=require(_0xe7fb('0x2'));var rp=require(_0xe7fb('0x3'));var moment=require(_0xe7fb('0x4'));var BPromise=require(_0xe7fb('0x5'));var Mustache=require(_0xe7fb('0x6'));var util=require(_0xe7fb('0x7'));var path=require(_0xe7fb('0x8'));var sox=require(_0xe7fb('0x9'));var csv=require(_0xe7fb('0xa'));var ejs=require(_0xe7fb('0xb'));var fs=require('fs');var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0xa'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];function respondWithStatusCode(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xcc;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0x1b')](_0x188e1d);}return _0x2437d4[_0xe7fb('0x1c')](_0x188e1d)['end']();};}function respondWithResult(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0xc8;return function(_0x5573ab){if(_0x5573ab){return _0x278b75[_0xe7fb('0x1c')](_0x2225e5)[_0xe7fb('0x1d')](_0x5573ab);}};}function respondWithFilteredResult(_0x482f7d,_0xa76acf){return function(_0x559129){if(_0x559129){var _0x12fff6=_0x559129['count'],_0x18d23c=_0xa76acf[_0xe7fb('0x1e')],_0x12603d=_0xa76acf['offset']+_0xa76acf[_0xe7fb('0x1f')],_0x17e8a8;if(_0x12603d>=_0x12fff6){_0x12603d=_0x12fff6;_0x17e8a8=0xc8;}else{_0x17e8a8=0xce;}_0x482f7d['status'](_0x17e8a8);return _0x482f7d[_0xe7fb('0x20')](_0xe7fb('0x21'),_0x18d23c+'-'+_0x12603d+'/'+_0x12fff6)[_0xe7fb('0x1d')](_0x559129);}return null;};}function patchUpdates(_0x182269){return function(_0x5df1a1){try{jsonpatch[_0xe7fb('0x22')](_0x5df1a1,_0x182269,!![]);}catch(_0x5d1c87){return BPromise[_0xe7fb('0x23')](_0x5d1c87);}return _0x5df1a1['save']();};}function saveUpdates(_0x15f7a4,_0x4ea664){return function(_0xa5af01){if(_0xa5af01){return _0xa5af01[_0xe7fb('0x24')](_0x15f7a4)['then'](function(_0x143eb6){return _0x143eb6;});}return null;};}function removeEntity(_0x4742bd,_0x3ae8f1){return function(_0x4dcb4b){if(_0x4dcb4b){return _0x4dcb4b[_0xe7fb('0x25')]()[_0xe7fb('0x26')](function(){_0x4742bd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52f08b,_0x35e4db){return function(_0x53c43a){if(!_0x53c43a){_0x52f08b['sendStatus'](0x194);}return _0x53c43a;};}function handleError(_0x4026b1,_0x32e8b2){_0x32e8b2=_0x32e8b2||0x1f4;return function(_0x2996ae){logger['error'](_0x2996ae[_0xe7fb('0x27')]);if(_0x2996ae[_0xe7fb('0x28')]){delete _0x2996ae[_0xe7fb('0x28')];}_0x4026b1[_0xe7fb('0x1c')](_0x32e8b2)[_0xe7fb('0x29')](_0x2996ae);};}exports[_0xe7fb('0x2a')]=function(_0x380130,_0x59e015){var _0x5df9f2={},_0x1086e6={},_0x3bdee9={'count':0x0,'rows':[]};var _0xead63=_['map'](db[_0xe7fb('0x2b')][_0xe7fb('0x2c')],function(_0xd3fffe){return{'name':_0xd3fffe[_0xe7fb('0x2d')],'type':_0xd3fffe[_0xe7fb('0x2e')][_0xe7fb('0x2f')]};});_0x1086e6[_0xe7fb('0x30')]=_[_0xe7fb('0x31')](_0xead63,'name');_0x1086e6[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x380130[_0xe7fb('0x32')]);_0x1086e6['filters']=_['intersection'](_0x1086e6[_0xe7fb('0x30')],_0x1086e6['query']);_0x5df9f2[_0xe7fb('0x34')]=_[_0xe7fb('0x35')](_0x1086e6[_0xe7fb('0x30')],qs[_0xe7fb('0x36')](_0x380130['query'][_0xe7fb('0x36')]));_0x5df9f2[_0xe7fb('0x34')]=_0x5df9f2[_0xe7fb('0x34')][_0xe7fb('0x37')]?_0x5df9f2[_0xe7fb('0x34')]:_0x1086e6['model'];if(!_0x380130[_0xe7fb('0x32')][_0xe7fb('0x38')](_0xe7fb('0x39'))){_0x5df9f2[_0xe7fb('0x1f')]=qs[_0xe7fb('0x1f')](_0x380130[_0xe7fb('0x32')][_0xe7fb('0x1f')]);_0x5df9f2[_0xe7fb('0x1e')]=qs[_0xe7fb('0x1e')](_0x380130['query'][_0xe7fb('0x1e')]);}_0x5df9f2[_0xe7fb('0x3a')]=qs[_0xe7fb('0x3b')](_0x380130['query'][_0xe7fb('0x3b')]);_0x5df9f2[_0xe7fb('0x3c')]=qs[_0xe7fb('0x3d')](_[_0xe7fb('0x3e')](_0x380130[_0xe7fb('0x32')],_0x1086e6[_0xe7fb('0x3d')]),_0xead63);if(_0x380130[_0xe7fb('0x32')][_0xe7fb('0x3f')]){_0x5df9f2[_0xe7fb('0x3c')]=_[_0xe7fb('0x40')](_0x5df9f2[_0xe7fb('0x3c')],{'$or':_[_0xe7fb('0x31')](_0xead63,function(_0x1544f2){if(_0x1544f2[_0xe7fb('0x2e')]!==_0xe7fb('0x41')){var _0x41e2d1={};_0x41e2d1[_0x1544f2[_0xe7fb('0x28')]]={'$like':'%'+_0x380130[_0xe7fb('0x32')][_0xe7fb('0x3f')]+'%'};return _0x41e2d1;}})});}_0x5df9f2=_['merge']({},_0x5df9f2,_0x380130[_0xe7fb('0x42')]);var _0x23f9f9={'where':_0x5df9f2[_0xe7fb('0x3c')]};return db[_0xe7fb('0x2b')]['count'](_0x23f9f9)[_0xe7fb('0x26')](function(_0x186418){_0x3bdee9[_0xe7fb('0x43')]=_0x186418;if(_0x380130[_0xe7fb('0x32')]['includeAll']){_0x5df9f2[_0xe7fb('0x44')]=[{'all':!![]}];}return db[_0xe7fb('0x2b')][_0xe7fb('0x45')](_0x5df9f2);})[_0xe7fb('0x26')](function(_0x468d16){_0x3bdee9[_0xe7fb('0x46')]=_0x468d16;return _0x3bdee9;})['then'](respondWithFilteredResult(_0x59e015,_0x5df9f2))[_0xe7fb('0x47')](handleError(_0x59e015,null));};exports[_0xe7fb('0x48')]=function(_0x3a96cd,_0x4b263d){var _0x36a341={'raw':![],'where':{'id':_0x3a96cd['params']['id']}},_0x3a8c52={};_0x3a8c52['model']=_['keys'](db['UserProfileResource']['rawAttributes']);_0x3a8c52[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x3a96cd[_0xe7fb('0x32')]);_0x3a8c52['filters']=_[_0xe7fb('0x35')](_0x3a8c52['model'],_0x3a8c52[_0xe7fb('0x32')]);_0x36a341[_0xe7fb('0x34')]=_['intersection'](_0x3a8c52[_0xe7fb('0x30')],qs[_0xe7fb('0x36')](_0x3a96cd[_0xe7fb('0x32')][_0xe7fb('0x36')]));_0x36a341['attributes']=_0x36a341[_0xe7fb('0x34')][_0xe7fb('0x37')]?_0x36a341[_0xe7fb('0x34')]:_0x3a8c52['model'];if(_0x3a96cd[_0xe7fb('0x32')][_0xe7fb('0x49')]){_0x36a341[_0xe7fb('0x44')]=[{'all':!![]}];}_0x36a341=_[_0xe7fb('0x40')]({},_0x36a341,_0x3a96cd[_0xe7fb('0x42')]);return db['UserProfileResource'][_0xe7fb('0x4a')](_0x36a341)['then'](handleEntityNotFound(_0x4b263d,null))[_0xe7fb('0x26')](respondWithResult(_0x4b263d,null))[_0xe7fb('0x47')](handleError(_0x4b263d,null));};exports[_0xe7fb('0x4b')]=function(_0x1ecbfd,_0x15cec3){return db['UserProfileResource'][_0xe7fb('0x4b')](_0x1ecbfd['body'],{})['then'](respondWithResult(_0x15cec3,0xc9))[_0xe7fb('0x47')](handleError(_0x15cec3,null));};exports[_0xe7fb('0x24')]=function(_0x16327f,_0x589555){if(_0x16327f[_0xe7fb('0x4c')]['id']){delete _0x16327f[_0xe7fb('0x4c')]['id'];}return db['UserProfileResource']['find']({'where':{'id':_0x16327f[_0xe7fb('0x4d')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x589555,null))[_0xe7fb('0x26')](saveUpdates(_0x16327f[_0xe7fb('0x4c')],null))[_0xe7fb('0x26')](respondWithResult(_0x589555,null))[_0xe7fb('0x47')](handleError(_0x589555,null));};exports[_0xe7fb('0x25')]=function(_0x347177,_0x5cd8e3){return db[_0xe7fb('0x2b')]['find']({'where':{'id':_0x347177[_0xe7fb('0x4d')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x5cd8e3,null))['then'](removeEntity(_0x5cd8e3,null))[_0xe7fb('0x47')](handleError(_0x5cd8e3,null));};exports['describe']=function(_0x239c56,_0x484bd8){return db[_0xe7fb('0x2b')]['describe']()[_0xe7fb('0x26')](respondWithResult(_0x484bd8,null))['catch'](handleError(_0x484bd8,null));}; \ No newline at end of file +var _0x7fbe=['fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','includeAll','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection'];(function(_0x4e43d4,_0xd760d0){var _0x4db61c=function(_0x4385c5){while(--_0x4385c5){_0x4e43d4['push'](_0x4e43d4['shift']());}};_0x4db61c(++_0xd760d0);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x200703,_0x4cccfd){_0x200703=_0x200703-0x0;var _0x5a32dc=_0x7fbe[_0x200703];return _0x5a32dc;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe7fb('0x0'));var zipdir=require(_0xe7fb('0x1'));var jsonpatch=require(_0xe7fb('0x2'));var rp=require(_0xe7fb('0x3'));var moment=require(_0xe7fb('0x4'));var BPromise=require(_0xe7fb('0x5'));var Mustache=require(_0xe7fb('0x6'));var util=require(_0xe7fb('0x7'));var path=require(_0xe7fb('0x8'));var sox=require(_0xe7fb('0x9'));var csv=require(_0xe7fb('0xa'));var ejs=require(_0xe7fb('0xb'));var fs=require('fs');var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0xa'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];function respondWithStatusCode(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xcc;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0x1b')](_0x188e1d);}return _0x2437d4[_0xe7fb('0x1c')](_0x188e1d)['end']();};}function respondWithResult(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0xc8;return function(_0x5573ab){if(_0x5573ab){return _0x278b75[_0xe7fb('0x1c')](_0x2225e5)[_0xe7fb('0x1d')](_0x5573ab);}};}function respondWithFilteredResult(_0x482f7d,_0xa76acf){return function(_0x559129){if(_0x559129){var _0x12fff6=_0x559129['count'],_0x18d23c=_0xa76acf[_0xe7fb('0x1e')],_0x12603d=_0xa76acf['offset']+_0xa76acf[_0xe7fb('0x1f')],_0x17e8a8;if(_0x12603d>=_0x12fff6){_0x12603d=_0x12fff6;_0x17e8a8=0xc8;}else{_0x17e8a8=0xce;}_0x482f7d['status'](_0x17e8a8);return _0x482f7d[_0xe7fb('0x20')](_0xe7fb('0x21'),_0x18d23c+'-'+_0x12603d+'/'+_0x12fff6)[_0xe7fb('0x1d')](_0x559129);}return null;};}function patchUpdates(_0x182269){return function(_0x5df1a1){try{jsonpatch[_0xe7fb('0x22')](_0x5df1a1,_0x182269,!![]);}catch(_0x5d1c87){return BPromise[_0xe7fb('0x23')](_0x5d1c87);}return _0x5df1a1['save']();};}function saveUpdates(_0x15f7a4,_0x4ea664){return function(_0xa5af01){if(_0xa5af01){return _0xa5af01[_0xe7fb('0x24')](_0x15f7a4)['then'](function(_0x143eb6){return _0x143eb6;});}return null;};}function removeEntity(_0x4742bd,_0x3ae8f1){return function(_0x4dcb4b){if(_0x4dcb4b){return _0x4dcb4b[_0xe7fb('0x25')]()[_0xe7fb('0x26')](function(){_0x4742bd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52f08b,_0x35e4db){return function(_0x53c43a){if(!_0x53c43a){_0x52f08b['sendStatus'](0x194);}return _0x53c43a;};}function handleError(_0x4026b1,_0x32e8b2){_0x32e8b2=_0x32e8b2||0x1f4;return function(_0x2996ae){logger['error'](_0x2996ae[_0xe7fb('0x27')]);if(_0x2996ae[_0xe7fb('0x28')]){delete _0x2996ae[_0xe7fb('0x28')];}_0x4026b1[_0xe7fb('0x1c')](_0x32e8b2)[_0xe7fb('0x29')](_0x2996ae);};}exports[_0xe7fb('0x2a')]=function(_0x380130,_0x59e015){var _0x5df9f2={},_0x1086e6={},_0x3bdee9={'count':0x0,'rows':[]};var _0xead63=_['map'](db[_0xe7fb('0x2b')][_0xe7fb('0x2c')],function(_0xd3fffe){return{'name':_0xd3fffe[_0xe7fb('0x2d')],'type':_0xd3fffe[_0xe7fb('0x2e')][_0xe7fb('0x2f')]};});_0x1086e6[_0xe7fb('0x30')]=_[_0xe7fb('0x31')](_0xead63,'name');_0x1086e6[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x380130[_0xe7fb('0x32')]);_0x1086e6['filters']=_['intersection'](_0x1086e6[_0xe7fb('0x30')],_0x1086e6['query']);_0x5df9f2[_0xe7fb('0x34')]=_[_0xe7fb('0x35')](_0x1086e6[_0xe7fb('0x30')],qs[_0xe7fb('0x36')](_0x380130['query'][_0xe7fb('0x36')]));_0x5df9f2[_0xe7fb('0x34')]=_0x5df9f2[_0xe7fb('0x34')][_0xe7fb('0x37')]?_0x5df9f2[_0xe7fb('0x34')]:_0x1086e6['model'];if(!_0x380130[_0xe7fb('0x32')][_0xe7fb('0x38')](_0xe7fb('0x39'))){_0x5df9f2[_0xe7fb('0x1f')]=qs[_0xe7fb('0x1f')](_0x380130[_0xe7fb('0x32')][_0xe7fb('0x1f')]);_0x5df9f2[_0xe7fb('0x1e')]=qs[_0xe7fb('0x1e')](_0x380130['query'][_0xe7fb('0x1e')]);}_0x5df9f2[_0xe7fb('0x3a')]=qs[_0xe7fb('0x3b')](_0x380130['query'][_0xe7fb('0x3b')]);_0x5df9f2[_0xe7fb('0x3c')]=qs[_0xe7fb('0x3d')](_[_0xe7fb('0x3e')](_0x380130[_0xe7fb('0x32')],_0x1086e6[_0xe7fb('0x3d')]),_0xead63);if(_0x380130[_0xe7fb('0x32')][_0xe7fb('0x3f')]){_0x5df9f2[_0xe7fb('0x3c')]=_[_0xe7fb('0x40')](_0x5df9f2[_0xe7fb('0x3c')],{'$or':_[_0xe7fb('0x31')](_0xead63,function(_0x1544f2){if(_0x1544f2[_0xe7fb('0x2e')]!==_0xe7fb('0x41')){var _0x41e2d1={};_0x41e2d1[_0x1544f2[_0xe7fb('0x28')]]={'$like':'%'+_0x380130[_0xe7fb('0x32')][_0xe7fb('0x3f')]+'%'};return _0x41e2d1;}})});}_0x5df9f2=_['merge']({},_0x5df9f2,_0x380130[_0xe7fb('0x42')]);var _0x23f9f9={'where':_0x5df9f2[_0xe7fb('0x3c')]};return db[_0xe7fb('0x2b')]['count'](_0x23f9f9)[_0xe7fb('0x26')](function(_0x186418){_0x3bdee9[_0xe7fb('0x43')]=_0x186418;if(_0x380130[_0xe7fb('0x32')]['includeAll']){_0x5df9f2[_0xe7fb('0x44')]=[{'all':!![]}];}return db[_0xe7fb('0x2b')][_0xe7fb('0x45')](_0x5df9f2);})[_0xe7fb('0x26')](function(_0x468d16){_0x3bdee9[_0xe7fb('0x46')]=_0x468d16;return _0x3bdee9;})['then'](respondWithFilteredResult(_0x59e015,_0x5df9f2))[_0xe7fb('0x47')](handleError(_0x59e015,null));};exports[_0xe7fb('0x48')]=function(_0x3a96cd,_0x4b263d){var _0x36a341={'raw':![],'where':{'id':_0x3a96cd['params']['id']}},_0x3a8c52={};_0x3a8c52['model']=_['keys'](db['UserProfileResource']['rawAttributes']);_0x3a8c52[_0xe7fb('0x32')]=_[_0xe7fb('0x33')](_0x3a96cd[_0xe7fb('0x32')]);_0x3a8c52['filters']=_[_0xe7fb('0x35')](_0x3a8c52['model'],_0x3a8c52[_0xe7fb('0x32')]);_0x36a341[_0xe7fb('0x34')]=_['intersection'](_0x3a8c52[_0xe7fb('0x30')],qs[_0xe7fb('0x36')](_0x3a96cd[_0xe7fb('0x32')][_0xe7fb('0x36')]));_0x36a341['attributes']=_0x36a341[_0xe7fb('0x34')][_0xe7fb('0x37')]?_0x36a341[_0xe7fb('0x34')]:_0x3a8c52['model'];if(_0x3a96cd[_0xe7fb('0x32')][_0xe7fb('0x49')]){_0x36a341[_0xe7fb('0x44')]=[{'all':!![]}];}_0x36a341=_[_0xe7fb('0x40')]({},_0x36a341,_0x3a96cd[_0xe7fb('0x42')]);return db['UserProfileResource'][_0xe7fb('0x4a')](_0x36a341)['then'](handleEntityNotFound(_0x4b263d,null))[_0xe7fb('0x26')](respondWithResult(_0x4b263d,null))[_0xe7fb('0x47')](handleError(_0x4b263d,null));};exports[_0xe7fb('0x4b')]=function(_0x1ecbfd,_0x15cec3){return db['UserProfileResource'][_0xe7fb('0x4b')](_0x1ecbfd['body'],{})['then'](respondWithResult(_0x15cec3,0xc9))[_0xe7fb('0x47')](handleError(_0x15cec3,null));};exports[_0xe7fb('0x24')]=function(_0x16327f,_0x589555){if(_0x16327f[_0xe7fb('0x4c')]['id']){delete _0x16327f[_0xe7fb('0x4c')]['id'];}return db['UserProfileResource']['find']({'where':{'id':_0x16327f[_0xe7fb('0x4d')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x589555,null))[_0xe7fb('0x26')](saveUpdates(_0x16327f[_0xe7fb('0x4c')],null))[_0xe7fb('0x26')](respondWithResult(_0x589555,null))[_0xe7fb('0x47')](handleError(_0x589555,null));};exports[_0xe7fb('0x25')]=function(_0x347177,_0x5cd8e3){return db[_0xe7fb('0x2b')]['find']({'where':{'id':_0x347177[_0xe7fb('0x4d')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x5cd8e3,null))['then'](removeEntity(_0x5cd8e3,null))[_0xe7fb('0x47')](handleError(_0x5cd8e3,null));};exports['describe']=function(_0x239c56,_0x484bd8){return db[_0xe7fb('0x2b')]['describe']()[_0xe7fb('0x26')](respondWithResult(_0x484bd8,null))['catch'](handleError(_0x484bd8,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 6afaba5..e121e92 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 _0x48d3=['moment','request-promise','rimraf','../../config/environment','exports','define','UserProfileResource','user_profile_has_resources','resourceId','sectionId','lodash','util','../../config/logger','api'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x48d3,0x96));var _0x348d=function(_0x4f65d2,_0x51ce91){_0x4f65d2=_0x4f65d2-0x0;var _0x44c0db=_0x48d3[_0x4f65d2];return _0x44c0db;};'use strict';var _=require(_0x348d('0x0'));var util=require(_0x348d('0x1'));var logger=require(_0x348d('0x2'))(_0x348d('0x3'));var moment=require(_0x348d('0x4'));var BPromise=require('bluebird');var rp=require(_0x348d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x348d('0x6'));var config=require(_0x348d('0x7'));var attributes=require('./userProfileResource.attributes');module[_0x348d('0x8')]=function(_0x4212be,_0x52e2df){return _0x4212be[_0x348d('0x9')](_0x348d('0xa'),attributes,{'tableName':_0x348d('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x348d('0xc'),_0x348d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2f82=['request-promise','../../config/environment','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','../../config/logger','moment'];(function(_0x5ad0c6,_0x56ee17){var _0x167958=function(_0x32dd81){while(--_0x32dd81){_0x5ad0c6['push'](_0x5ad0c6['shift']());}};_0x167958(++_0x56ee17);}(_0x2f82,0x159));var _0x22f8=function(_0x239875,_0x52a793){_0x239875=_0x239875-0x0;var _0x55a8d6=_0x2f82[_0x239875];return _0x55a8d6;};'use strict';var _=require(_0x22f8('0x0'));var util=require('util');var logger=require(_0x22f8('0x1'))('api');var moment=require(_0x22f8('0x2'));var BPromise=require('bluebird');var rp=require(_0x22f8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x22f8('0x4'));var attributes=require('./userProfileResource.attributes');module[_0x22f8('0x5')]=function(_0xa85399,_0x504880){return _0xa85399[_0x22f8('0x6')](_0x22f8('0x7'),attributes,{'tableName':_0x22f8('0x8'),'paranoid':![],'indexes':[{'name':_0x22f8('0x9'),'fields':[_0x22f8('0xa'),_0x22f8('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 12ee385..830c468 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 _0x812a=['result','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x403db1,_0x59018e){var _0x47c48f=function(_0x1b663c){while(--_0x1b663c){_0x403db1['push'](_0x403db1['shift']());}};_0x47c48f(++_0x59018e);}(_0x812a,0x1a6));var _0xa812=function(_0xf00c97,_0x45bbf9){_0xf00c97=_0xf00c97-0x0;var _0x252c31=_0x812a[_0xf00c97];return _0x252c31;};'use strict';var _=require(_0xa812('0x0'));var util=require(_0xa812('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa812('0x2'))['db'];var utils=require(_0xa812('0x3'));var logger=require(_0xa812('0x4'))('rpc');var config=require(_0xa812('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xa812('0x6')][_0xa812('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xe94f14,_0x2a84c7,_0x40c20c){return new BPromise(function(_0xd0eb9a,_0x546cdb){return client[_0xa812('0x8')](_0xe94f14,_0x40c20c)[_0xa812('0x9')](function(_0x25c6f2){logger[_0xa812('0xa')](_0xa812('0xb'),_0x2a84c7,_0xa812('0xc'));logger[_0xa812('0xd')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x2a84c7,_0xa812('0xc'),JSON[_0xa812('0xe')](_0x25c6f2));if(_0x25c6f2[_0xa812('0xf')]){if(_0x25c6f2['error'][_0xa812('0x10')]===0x1f4){logger[_0xa812('0xf')](_0xa812('0xb'),_0x2a84c7,_0x25c6f2[_0xa812('0xf')][_0xa812('0x11')]);return _0x546cdb(_0x25c6f2[_0xa812('0xf')][_0xa812('0x11')]);}logger[_0xa812('0xf')](_0xa812('0xb'),_0x2a84c7,_0x25c6f2['error']['message']);return _0xd0eb9a(_0x25c6f2[_0xa812('0xf')][_0xa812('0x11')]);}else{logger[_0xa812('0xa')](_0xa812('0xb'),_0x2a84c7,_0xa812('0xc'));_0xd0eb9a(_0x25c6f2[_0xa812('0x12')][_0xa812('0x11')]);}})[_0xa812('0x13')](function(_0x10f33b){logger[_0xa812('0xf')](_0xa812('0xb'),_0x2a84c7,_0x10f33b);_0x546cdb(_0x10f33b);});});} \ No newline at end of file +var _0xf73e=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x354e9d,_0x297682){var _0x56711d=function(_0x6ae780){while(--_0x6ae780){_0x354e9d['push'](_0x354e9d['shift']());}};_0x56711d(++_0x297682);}(_0xf73e,0x78));var _0xef73=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf73e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xef73('0x0'));var util=require(_0xef73('0x1'));var moment=require(_0xef73('0x2'));var BPromise=require(_0xef73('0x3'));var rs=require(_0xef73('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef73('0x5'))['db'];var utils=require(_0xef73('0x6'));var logger=require(_0xef73('0x7'))(_0xef73('0x8'));var config=require(_0xef73('0x9'));var jayson=require(_0xef73('0xa'));var client=jayson[_0xef73('0xb')][_0xef73('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4434d4,_0x144a5c,_0x29cf9b){return new BPromise(function(_0x3c8b09,_0x411c7f){return client[_0xef73('0xd')](_0x4434d4,_0x29cf9b)[_0xef73('0xe')](function(_0x2bce7f){logger[_0xef73('0xf')](_0xef73('0x10'),_0x144a5c,_0xef73('0x11'));logger[_0xef73('0x12')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x144a5c,_0xef73('0x11'),JSON[_0xef73('0x13')](_0x2bce7f));if(_0x2bce7f[_0xef73('0x14')]){if(_0x2bce7f[_0xef73('0x14')][_0xef73('0x15')]===0x1f4){logger[_0xef73('0x14')](_0xef73('0x10'),_0x144a5c,_0x2bce7f['error'][_0xef73('0x16')]);return _0x411c7f(_0x2bce7f['error'][_0xef73('0x16')]);}logger[_0xef73('0x14')]('UserProfileResource,\x20%s,\x20%s',_0x144a5c,_0x2bce7f[_0xef73('0x14')]['message']);return _0x3c8b09(_0x2bce7f['error']['message']);}else{logger['info'](_0xef73('0x10'),_0x144a5c,'request\x20sent');_0x3c8b09(_0x2bce7f[_0xef73('0x17')][_0xef73('0x16')]);}})[_0xef73('0x18')](function(_0x104665){logger[_0xef73('0x14')](_0xef73('0x10'),_0x144a5c,_0x104665);_0x411c7f(_0x104665);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 6d63ff1..78d6b6a 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 _0x3b43=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','exports','multer'];(function(_0x88df64,_0x4d860b){var _0x3c1ff6=function(_0x86425f){while(--_0x86425f){_0x88df64['push'](_0x88df64['shift']());}};_0x3c1ff6(++_0x4d860b);}(_0x3b43,0x71));var _0x33b4=function(_0x4dd721,_0x290e01){_0x4dd721=_0x4dd721-0x0;var _0x36de00=_0x3b43[_0x4dd721];return _0x36de00;};'use strict';var multer=require(_0x33b4('0x0'));var util=require(_0x33b4('0x1'));var path=require(_0x33b4('0x2'));var timeout=require(_0x33b4('0x3'));var express=require(_0x33b4('0x4'));var router=express[_0x33b4('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x33b4('0x6'));var config=require(_0x33b4('0x7'));var controller=require('./userProfileSection.controller');router[_0x33b4('0x8')]('/',auth['isAuthenticated'](),controller[_0x33b4('0x9')]);router['get'](_0x33b4('0xa'),auth[_0x33b4('0xb')](),controller[_0x33b4('0xc')]);router[_0x33b4('0x8')](_0x33b4('0xd'),auth[_0x33b4('0xb')](),controller[_0x33b4('0xe')]);router[_0x33b4('0xf')]('/',auth['isAuthenticated'](),controller[_0x33b4('0x10')]);router[_0x33b4('0x11')](_0x33b4('0xd'),auth[_0x33b4('0xb')](),controller['update']);router['delete'](_0x33b4('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x33b4('0x12')]=router; \ No newline at end of file +var _0x4105=['show','post','put','update','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x125417,_0x1b7756){var _0x32c46a=function(_0xf10bbf){while(--_0xf10bbf){_0x125417['push'](_0x125417['shift']());}};_0x32c46a(++_0x1b7756);}(_0x4105,0x10a));var _0x5410=function(_0x14cd87,_0x49f635){_0x14cd87=_0x14cd87-0x0;var _0x2d41db=_0x4105[_0x14cd87];return _0x2d41db;};'use strict';var multer=require(_0x5410('0x0'));var util=require(_0x5410('0x1'));var path=require('path');var timeout=require(_0x5410('0x2'));var express=require('express');var router=express[_0x5410('0x3')]();var auth=require(_0x5410('0x4'));var interaction=require(_0x5410('0x5'));var config=require(_0x5410('0x6'));var controller=require(_0x5410('0x7'));router[_0x5410('0x8')]('/',auth['isAuthenticated'](),controller[_0x5410('0x9')]);router[_0x5410('0x8')](_0x5410('0xa'),auth[_0x5410('0xb')](),controller[_0x5410('0xc')]);router[_0x5410('0x8')](_0x5410('0xd'),auth[_0x5410('0xb')](),controller[_0x5410('0xe')]);router[_0x5410('0xf')]('/',auth[_0x5410('0xb')](),controller['create']);router[_0x5410('0x10')](_0x5410('0xd'),auth[_0x5410('0xb')](),controller[_0x5410('0x11')]);router['delete'](_0x5410('0xd'),auth[_0x5410('0xb')](),controller[_0x5410('0x12')]);module[_0x5410('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index f427ae6..7ee1f81 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 _0xa8ca=['crudPermissions','split','sequelize','STRING','INTEGER','BOOLEAN','setDataValue','join','getDataValue'];(function(_0x11b8a5,_0x2b56a0){var _0x1f64e8=function(_0x313be4){while(--_0x313be4){_0x11b8a5['push'](_0x11b8a5['shift']());}};_0x1f64e8(++_0x2b56a0);}(_0xa8ca,0x12b));var _0xaa8c=function(_0x590c21,_0x2b4ab5){_0x590c21=_0x590c21-0x0;var _0x29c088=_0xa8ca[_0x590c21];return _0x29c088;};'use strict';var Sequelize=require(_0xaa8c('0x0'));module['exports']={'name':{'type':Sequelize[_0xaa8c('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xaa8c('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xaa8c('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xaa8c('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xaa8c('0x1')],'set':function(_0x2c993f){this[_0xaa8c('0x4')]('crudPermissions',_0x2c993f?_0x2c993f[_0xaa8c('0x5')](''):[]);},'get':function(){return this[_0xaa8c('0x6')]('crudPermissions')?this['getDataValue'](_0xaa8c('0x7'))[_0xaa8c('0x8')](''):[];}}}; \ No newline at end of file +var _0x861a=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x861a,0x194));var _0xa861=function(_0x53fd45,_0x1471a4){_0x53fd45=_0x53fd45-0x0;var _0x30c0f8=_0x861a[_0x53fd45];return _0x30c0f8;};'use strict';var Sequelize=require(_0xa861('0x0'));module['exports']={'name':{'type':Sequelize[_0xa861('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xa861('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xa861('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xa861('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xa861('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xa861('0x1')],'set':function(_0x5d3ee2){this[_0xa861('0x4')](_0xa861('0x5'),_0x5d3ee2?_0x5d3ee2[_0xa861('0x6')](''):[]);},'get':function(){return this[_0xa861('0x7')](_0xa861('0x5'))?this['getDataValue'](_0xa861('0x5'))[_0xa861('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index bff3921..16b93ca 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 _0xdcce=['merge','VIRTUAL','options','UserProfileSection','count','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','update','describe','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','offset','limit','set','Content-Range','json','apply','reject','then','destroy','error','name','send','index','rawAttributes','fieldName','map','query','keys','filters','intersection','model','attributes','length','nolimit','order','sort','where'];(function(_0x4dbe88,_0x2cd744){var _0x20d596=function(_0x52ed69){while(--_0x52ed69){_0x4dbe88['push'](_0x4dbe88['shift']());}};_0x20d596(++_0x2cd744);}(_0xdcce,0x1d2));var _0xedcc=function(_0x2c0c43,_0x54a06b){_0x2c0c43=_0x2c0c43-0x0;var _0x4a4525=_0xdcce[_0x2c0c43];return _0x4a4525;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xedcc('0x0'));var zipdir=require(_0xedcc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xedcc('0x2'));var moment=require(_0xedcc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xedcc('0x4'));var util=require(_0xedcc('0x5'));var path=require('path');var sox=require(_0xedcc('0x6'));var csv=require('to-csv');var ejs=require(_0xedcc('0x7'));var fs=require('fs');var _=require(_0xedcc('0x8'));var squel=require(_0xedcc('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xedcc('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xedcc('0xb'));var Redis=require(_0xedcc('0xc'));var authService=require(_0xedcc('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xedcc('0xe'))('api');var utils=require(_0xedcc('0xf'));var config=require(_0xedcc('0x10'));var licenseUtil=require(_0xedcc('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43dce7,_0x121ce9){_0x121ce9=_0x121ce9||0xcc;return function(_0xb88729){if(_0xb88729){return _0x43dce7['sendStatus'](_0x121ce9);}return _0x43dce7[_0xedcc('0x12')](_0x121ce9)['end']();};}function respondWithResult(_0x9f3817,_0x29cc1f){_0x29cc1f=_0x29cc1f||0xc8;return function(_0x3e05e6){if(_0x3e05e6){return _0x9f3817[_0xedcc('0x12')](_0x29cc1f)['json'](_0x3e05e6);}};}function respondWithFilteredResult(_0x30d6d1,_0x465517){return function(_0x363062){if(_0x363062){var _0x488ac1=_0x363062['count'],_0x3567cb=_0x465517[_0xedcc('0x13')],_0x518249=_0x465517[_0xedcc('0x13')]+_0x465517[_0xedcc('0x14')],_0xfef304;if(_0x518249>=_0x488ac1){_0x518249=_0x488ac1;_0xfef304=0xc8;}else{_0xfef304=0xce;}_0x30d6d1[_0xedcc('0x12')](_0xfef304);return _0x30d6d1[_0xedcc('0x15')](_0xedcc('0x16'),_0x3567cb+'-'+_0x518249+'/'+_0x488ac1)[_0xedcc('0x17')](_0x363062);}return null;};}function patchUpdates(_0xab868){return function(_0x4d5a37){try{jsonpatch[_0xedcc('0x18')](_0x4d5a37,_0xab868,!![]);}catch(_0x560e17){return BPromise[_0xedcc('0x19')](_0x560e17);}return _0x4d5a37['save']();};}function saveUpdates(_0x4d9baa,_0x257bac){return function(_0xdc82fa){if(_0xdc82fa){return _0xdc82fa['update'](_0x4d9baa)[_0xedcc('0x1a')](function(_0x230533){return _0x230533;});}return null;};}function removeEntity(_0x5adfed,_0x2d0981){return function(_0x227319){if(_0x227319){return _0x227319[_0xedcc('0x1b')]()[_0xedcc('0x1a')](function(){_0x5adfed[_0xedcc('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x572ad9,_0x4d10be){return function(_0x4590c4){if(!_0x4590c4){_0x572ad9['sendStatus'](0x194);}return _0x4590c4;};}function handleError(_0x401623,_0xbfadf5){_0xbfadf5=_0xbfadf5||0x1f4;return function(_0x37dcb2){logger[_0xedcc('0x1c')](_0x37dcb2['stack']);if(_0x37dcb2[_0xedcc('0x1d')]){delete _0x37dcb2['name'];}_0x401623['status'](_0xbfadf5)[_0xedcc('0x1e')](_0x37dcb2);};}exports[_0xedcc('0x1f')]=function(_0x42419c,_0x43d193){var _0x2c3b19={},_0x49d7f6={},_0x29f9e1={'count':0x0,'rows':[]};var _0x207b02=_['map'](db['UserProfileSection'][_0xedcc('0x20')],function(_0x595d39){return{'name':_0x595d39[_0xedcc('0x21')],'type':_0x595d39['type']['key']};});_0x49d7f6['model']=_[_0xedcc('0x22')](_0x207b02,_0xedcc('0x1d'));_0x49d7f6[_0xedcc('0x23')]=_[_0xedcc('0x24')](_0x42419c[_0xedcc('0x23')]);_0x49d7f6[_0xedcc('0x25')]=_[_0xedcc('0x26')](_0x49d7f6[_0xedcc('0x27')],_0x49d7f6['query']);_0x2c3b19[_0xedcc('0x28')]=_['intersection'](_0x49d7f6[_0xedcc('0x27')],qs['fields'](_0x42419c[_0xedcc('0x23')]['fields']));_0x2c3b19[_0xedcc('0x28')]=_0x2c3b19[_0xedcc('0x28')][_0xedcc('0x29')]?_0x2c3b19[_0xedcc('0x28')]:_0x49d7f6[_0xedcc('0x27')];if(!_0x42419c[_0xedcc('0x23')]['hasOwnProperty'](_0xedcc('0x2a'))){_0x2c3b19[_0xedcc('0x14')]=qs[_0xedcc('0x14')](_0x42419c[_0xedcc('0x23')][_0xedcc('0x14')]);_0x2c3b19[_0xedcc('0x13')]=qs['offset'](_0x42419c[_0xedcc('0x23')]['offset']);}_0x2c3b19[_0xedcc('0x2b')]=qs[_0xedcc('0x2c')](_0x42419c[_0xedcc('0x23')][_0xedcc('0x2c')]);_0x2c3b19[_0xedcc('0x2d')]=qs[_0xedcc('0x25')](_['pick'](_0x42419c[_0xedcc('0x23')],_0x49d7f6[_0xedcc('0x25')]),_0x207b02);if(_0x42419c[_0xedcc('0x23')]['filter']){_0x2c3b19[_0xedcc('0x2d')]=_[_0xedcc('0x2e')](_0x2c3b19[_0xedcc('0x2d')],{'$or':_['map'](_0x207b02,function(_0x1af615){if(_0x1af615['type']!==_0xedcc('0x2f')){var _0x51fde1={};_0x51fde1[_0x1af615['name']]={'$like':'%'+_0x42419c[_0xedcc('0x23')]['filter']+'%'};return _0x51fde1;}})});}_0x2c3b19=_[_0xedcc('0x2e')]({},_0x2c3b19,_0x42419c[_0xedcc('0x30')]);var _0x5e18eb={'where':_0x2c3b19[_0xedcc('0x2d')]};return db[_0xedcc('0x31')][_0xedcc('0x32')](_0x5e18eb)[_0xedcc('0x1a')](function(_0x18c3ab){_0x29f9e1[_0xedcc('0x32')]=_0x18c3ab;if(_0x42419c['query'][_0xedcc('0x33')]){_0x2c3b19[_0xedcc('0x34')]=[{'all':!![]}];}return db[_0xedcc('0x31')][_0xedcc('0x35')](_0x2c3b19);})[_0xedcc('0x1a')](function(_0x2039a6){_0x29f9e1[_0xedcc('0x36')]=_0x2039a6;return _0x29f9e1;})[_0xedcc('0x1a')](respondWithFilteredResult(_0x43d193,_0x2c3b19))[_0xedcc('0x37')](handleError(_0x43d193,null));};exports[_0xedcc('0x38')]=function(_0x4f6f60,_0x2fc3d3){var _0x2d64bd={'raw':![],'where':{'id':_0x4f6f60[_0xedcc('0x39')]['id']}},_0x521eb9={};_0x521eb9[_0xedcc('0x27')]=_['keys'](db['UserProfileSection'][_0xedcc('0x20')]);_0x521eb9[_0xedcc('0x23')]=_[_0xedcc('0x24')](_0x4f6f60['query']);_0x521eb9[_0xedcc('0x25')]=_[_0xedcc('0x26')](_0x521eb9[_0xedcc('0x27')],_0x521eb9[_0xedcc('0x23')]);_0x2d64bd[_0xedcc('0x28')]=_[_0xedcc('0x26')](_0x521eb9[_0xedcc('0x27')],qs[_0xedcc('0x3a')](_0x4f6f60[_0xedcc('0x23')]['fields']));_0x2d64bd[_0xedcc('0x28')]=_0x2d64bd[_0xedcc('0x28')][_0xedcc('0x29')]?_0x2d64bd['attributes']:_0x521eb9[_0xedcc('0x27')];if(_0x4f6f60[_0xedcc('0x23')][_0xedcc('0x33')]){_0x2d64bd[_0xedcc('0x34')]=[{'all':!![]}];}_0x2d64bd=_['merge']({},_0x2d64bd,_0x4f6f60[_0xedcc('0x30')]);return db[_0xedcc('0x31')][_0xedcc('0x3b')](_0x2d64bd)[_0xedcc('0x1a')](handleEntityNotFound(_0x2fc3d3,null))[_0xedcc('0x1a')](respondWithResult(_0x2fc3d3,null))[_0xedcc('0x37')](handleError(_0x2fc3d3,null));};exports['create']=function(_0x4da7f5,_0x3ef017){return db[_0xedcc('0x31')][_0xedcc('0x3c')](_0x4da7f5[_0xedcc('0x3d')],{})[_0xedcc('0x1a')](respondWithResult(_0x3ef017,0xc9))[_0xedcc('0x37')](handleError(_0x3ef017,null));};exports[_0xedcc('0x3e')]=function(_0x447b48,_0x544574){if(_0x447b48[_0xedcc('0x3d')]['id']){delete _0x447b48[_0xedcc('0x3d')]['id'];}return db[_0xedcc('0x31')][_0xedcc('0x3b')]({'where':{'id':_0x447b48[_0xedcc('0x39')]['id']}})[_0xedcc('0x1a')](handleEntityNotFound(_0x544574,null))[_0xedcc('0x1a')](saveUpdates(_0x447b48[_0xedcc('0x3d')],null))[_0xedcc('0x1a')](respondWithResult(_0x544574,null))[_0xedcc('0x37')](handleError(_0x544574,null));};exports[_0xedcc('0x1b')]=function(_0x5ab066,_0x55bd96){return db['UserProfileSection']['find']({'where':{'id':_0x5ab066[_0xedcc('0x39')]['id']}})['then'](handleEntityNotFound(_0x55bd96,null))[_0xedcc('0x1a')](removeEntity(_0x55bd96,null))['catch'](handleError(_0x55bd96,null));};exports[_0xedcc('0x3f')]=function(_0x375c6a,_0x59c0b4){return db['UserProfileSection'][_0xedcc('0x3f')]()['then'](respondWithResult(_0x59c0b4,null))[_0xedcc('0x37')](handleError(_0x59c0b4,null));}; \ No newline at end of file +var _0xd4bd=['index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','catch','params','include','UserProfileSection','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','destroy','then','error','stack','name','send'];(function(_0x44fbe8,_0x1c9f54){var _0x100666=function(_0x17008a){while(--_0x17008a){_0x44fbe8['push'](_0x44fbe8['shift']());}};_0x100666(++_0x1c9f54);}(_0xd4bd,0x6b));var _0xdd4b=function(_0x45c856,_0x5e6a1e){_0x45c856=_0x45c856-0x0;var _0x4961aa=_0xd4bd[_0x45c856];return _0x4961aa;};'use strict';var pdf=require(_0xdd4b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdd4b('0x1'));var zipdir=require(_0xdd4b('0x2'));var jsonpatch=require(_0xdd4b('0x3'));var rp=require(_0xdd4b('0x4'));var moment=require('moment');var BPromise=require(_0xdd4b('0x5'));var Mustache=require('mustache');var util=require(_0xdd4b('0x6'));var path=require(_0xdd4b('0x7'));var sox=require(_0xdd4b('0x8'));var csv=require('to-csv');var ejs=require(_0xdd4b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdd4b('0xa'));var crypto=require('crypto');var jsforce=require(_0xdd4b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdd4b('0xc'));var querystring=require(_0xdd4b('0xd'));var Papa=require(_0xdd4b('0xe'));var Redis=require(_0xdd4b('0xf'));var authService=require(_0xdd4b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xdd4b('0x11'));var hardwareService=require(_0xdd4b('0x12'));var logger=require(_0xdd4b('0x13'))(_0xdd4b('0x14'));var utils=require(_0xdd4b('0x15'));var config=require(_0xdd4b('0x16'));var licenseUtil=require(_0xdd4b('0x17'));var db=require(_0xdd4b('0x18'))['db'];function respondWithStatusCode(_0x4ba5cb,_0x58bc56){_0x58bc56=_0x58bc56||0xcc;return function(_0x3fcf86){if(_0x3fcf86){return _0x4ba5cb[_0xdd4b('0x19')](_0x58bc56);}return _0x4ba5cb[_0xdd4b('0x1a')](_0x58bc56)[_0xdd4b('0x1b')]();};}function respondWithResult(_0x4b7df8,_0x966e8b){_0x966e8b=_0x966e8b||0xc8;return function(_0x5899e0){if(_0x5899e0){return _0x4b7df8[_0xdd4b('0x1a')](_0x966e8b)[_0xdd4b('0x1c')](_0x5899e0);}};}function respondWithFilteredResult(_0x116440,_0x3c6ae1){return function(_0x2cfcc6){if(_0x2cfcc6){var _0x5121b2=_0x2cfcc6[_0xdd4b('0x1d')],_0x4b8e1e=_0x3c6ae1['offset'],_0x23dd24=_0x3c6ae1[_0xdd4b('0x1e')]+_0x3c6ae1['limit'],_0x28df44;if(_0x23dd24>=_0x5121b2){_0x23dd24=_0x5121b2;_0x28df44=0xc8;}else{_0x28df44=0xce;}_0x116440['status'](_0x28df44);return _0x116440[_0xdd4b('0x1f')](_0xdd4b('0x20'),_0x4b8e1e+'-'+_0x23dd24+'/'+_0x5121b2)[_0xdd4b('0x1c')](_0x2cfcc6);}return null;};}function patchUpdates(_0x607450){return function(_0x46027b){try{jsonpatch[_0xdd4b('0x21')](_0x46027b,_0x607450,!![]);}catch(_0x5e7a7f){return BPromise[_0xdd4b('0x22')](_0x5e7a7f);}return _0x46027b['save']();};}function saveUpdates(_0x668cda,_0xb5f836){return function(_0x265622){if(_0x265622){return _0x265622['update'](_0x668cda)['then'](function(_0xc380a3){return _0xc380a3;});}return null;};}function removeEntity(_0x4252ec,_0x5421a6){return function(_0x45b5b7){if(_0x45b5b7){return _0x45b5b7[_0xdd4b('0x23')]()[_0xdd4b('0x24')](function(){_0x4252ec[_0xdd4b('0x1a')](0xcc)[_0xdd4b('0x1b')]();});}};}function handleEntityNotFound(_0x2dd6c9,_0x1ed04a){return function(_0x11f630){if(!_0x11f630){_0x2dd6c9[_0xdd4b('0x19')](0x194);}return _0x11f630;};}function handleError(_0x359c5f,_0x548c2d){_0x548c2d=_0x548c2d||0x1f4;return function(_0x61f50f){logger[_0xdd4b('0x25')](_0x61f50f[_0xdd4b('0x26')]);if(_0x61f50f['name']){delete _0x61f50f[_0xdd4b('0x27')];}_0x359c5f[_0xdd4b('0x1a')](_0x548c2d)[_0xdd4b('0x28')](_0x61f50f);};}exports[_0xdd4b('0x29')]=function(_0x7b2ef9,_0x1acbd8){var _0xcd22f3={},_0x19d13c={},_0x34b193={'count':0x0,'rows':[]};var _0x51f815=_[_0xdd4b('0x2a')](db['UserProfileSection'][_0xdd4b('0x2b')],function(_0x34c76b){return{'name':_0x34c76b[_0xdd4b('0x2c')],'type':_0x34c76b[_0xdd4b('0x2d')]['key']};});_0x19d13c['model']=_[_0xdd4b('0x2a')](_0x51f815,_0xdd4b('0x27'));_0x19d13c[_0xdd4b('0x2e')]=_[_0xdd4b('0x2f')](_0x7b2ef9[_0xdd4b('0x2e')]);_0x19d13c[_0xdd4b('0x30')]=_[_0xdd4b('0x31')](_0x19d13c[_0xdd4b('0x32')],_0x19d13c[_0xdd4b('0x2e')]);_0xcd22f3[_0xdd4b('0x33')]=_[_0xdd4b('0x31')](_0x19d13c[_0xdd4b('0x32')],qs[_0xdd4b('0x34')](_0x7b2ef9[_0xdd4b('0x2e')][_0xdd4b('0x34')]));_0xcd22f3['attributes']=_0xcd22f3['attributes'][_0xdd4b('0x35')]?_0xcd22f3[_0xdd4b('0x33')]:_0x19d13c['model'];if(!_0x7b2ef9[_0xdd4b('0x2e')][_0xdd4b('0x36')](_0xdd4b('0x37'))){_0xcd22f3[_0xdd4b('0x38')]=qs[_0xdd4b('0x38')](_0x7b2ef9[_0xdd4b('0x2e')][_0xdd4b('0x38')]);_0xcd22f3[_0xdd4b('0x1e')]=qs[_0xdd4b('0x1e')](_0x7b2ef9['query'][_0xdd4b('0x1e')]);}_0xcd22f3[_0xdd4b('0x39')]=qs[_0xdd4b('0x3a')](_0x7b2ef9[_0xdd4b('0x2e')]['sort']);_0xcd22f3[_0xdd4b('0x3b')]=qs[_0xdd4b('0x30')](_[_0xdd4b('0x3c')](_0x7b2ef9['query'],_0x19d13c[_0xdd4b('0x30')]),_0x51f815);if(_0x7b2ef9[_0xdd4b('0x2e')][_0xdd4b('0x3d')]){_0xcd22f3[_0xdd4b('0x3b')]=_[_0xdd4b('0x3e')](_0xcd22f3[_0xdd4b('0x3b')],{'$or':_['map'](_0x51f815,function(_0x50601f){if(_0x50601f[_0xdd4b('0x2d')]!==_0xdd4b('0x3f')){var _0x130839={};_0x130839[_0x50601f[_0xdd4b('0x27')]]={'$like':'%'+_0x7b2ef9['query']['filter']+'%'};return _0x130839;}})});}_0xcd22f3=_[_0xdd4b('0x3e')]({},_0xcd22f3,_0x7b2ef9[_0xdd4b('0x40')]);var _0x348c6b={'where':_0xcd22f3['where']};return db['UserProfileSection'][_0xdd4b('0x1d')](_0x348c6b)['then'](function(_0x476f89){_0x34b193['count']=_0x476f89;if(_0x7b2ef9[_0xdd4b('0x2e')]['includeAll']){_0xcd22f3['include']=[{'all':!![]}];}return db['UserProfileSection'][_0xdd4b('0x41')](_0xcd22f3);})[_0xdd4b('0x24')](function(_0x20e476){_0x34b193['rows']=_0x20e476;return _0x34b193;})[_0xdd4b('0x24')](respondWithFilteredResult(_0x1acbd8,_0xcd22f3))[_0xdd4b('0x42')](handleError(_0x1acbd8,null));};exports['show']=function(_0x2eeca8,_0x536ae1){var _0x1b310c={'raw':![],'where':{'id':_0x2eeca8[_0xdd4b('0x43')]['id']}},_0x76ae96={};_0x76ae96[_0xdd4b('0x32')]=_[_0xdd4b('0x2f')](db['UserProfileSection'][_0xdd4b('0x2b')]);_0x76ae96['query']=_[_0xdd4b('0x2f')](_0x2eeca8[_0xdd4b('0x2e')]);_0x76ae96[_0xdd4b('0x30')]=_[_0xdd4b('0x31')](_0x76ae96[_0xdd4b('0x32')],_0x76ae96[_0xdd4b('0x2e')]);_0x1b310c['attributes']=_[_0xdd4b('0x31')](_0x76ae96[_0xdd4b('0x32')],qs[_0xdd4b('0x34')](_0x2eeca8[_0xdd4b('0x2e')]['fields']));_0x1b310c['attributes']=_0x1b310c[_0xdd4b('0x33')][_0xdd4b('0x35')]?_0x1b310c['attributes']:_0x76ae96[_0xdd4b('0x32')];if(_0x2eeca8['query']['includeAll']){_0x1b310c[_0xdd4b('0x44')]=[{'all':!![]}];}_0x1b310c=_[_0xdd4b('0x3e')]({},_0x1b310c,_0x2eeca8[_0xdd4b('0x40')]);return db[_0xdd4b('0x45')][_0xdd4b('0x46')](_0x1b310c)[_0xdd4b('0x24')](handleEntityNotFound(_0x536ae1,null))[_0xdd4b('0x24')](respondWithResult(_0x536ae1,null))[_0xdd4b('0x42')](handleError(_0x536ae1,null));};exports[_0xdd4b('0x47')]=function(_0x27bea4,_0x66058){return db['UserProfileSection']['create'](_0x27bea4['body'],{})['then'](respondWithResult(_0x66058,0xc9))[_0xdd4b('0x42')](handleError(_0x66058,null));};exports['update']=function(_0x558f58,_0x39400a){if(_0x558f58[_0xdd4b('0x48')]['id']){delete _0x558f58[_0xdd4b('0x48')]['id'];}return db['UserProfileSection'][_0xdd4b('0x46')]({'where':{'id':_0x558f58['params']['id']}})[_0xdd4b('0x24')](handleEntityNotFound(_0x39400a,null))['then'](saveUpdates(_0x558f58[_0xdd4b('0x48')],null))[_0xdd4b('0x24')](respondWithResult(_0x39400a,null))['catch'](handleError(_0x39400a,null));};exports['destroy']=function(_0x46f0f9,_0x2f9123){return db[_0xdd4b('0x45')][_0xdd4b('0x46')]({'where':{'id':_0x46f0f9[_0xdd4b('0x43')]['id']}})['then'](handleEntityNotFound(_0x2f9123,null))[_0xdd4b('0x24')](removeEntity(_0x2f9123,null))[_0xdd4b('0x42')](handleError(_0x2f9123,null));};exports[_0xdd4b('0x49')]=function(_0x125fa2,_0xe6f5cd){return db[_0xdd4b('0x45')]['describe']()[_0xdd4b('0x24')](respondWithResult(_0xe6f5cd,null))[_0xdd4b('0x42')](handleError(_0xe6f5cd,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 720d964..651db89 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 _0x3e9e=['path','../../config/environment','./userProfileSection.attributes','define','compositeIndex','sectionId','userProfileId','util','api','bluebird'];(function(_0x28dce1,_0x14b05f){var _0x59a43a=function(_0x479c19){while(--_0x479c19){_0x28dce1['push'](_0x28dce1['shift']());}};_0x59a43a(++_0x14b05f);}(_0x3e9e,0x13d));var _0xe3e9=function(_0x9226e8,_0x1a57a3){_0x9226e8=_0x9226e8-0x0;var _0x1d3842=_0x3e9e[_0x9226e8];return _0x1d3842;};'use strict';var _=require('lodash');var util=require(_0xe3e9('0x0'));var logger=require('../../config/logger')(_0xe3e9('0x1'));var moment=require('moment');var BPromise=require(_0xe3e9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe3e9('0x3'));var rimraf=require('rimraf');var config=require(_0xe3e9('0x4'));var attributes=require(_0xe3e9('0x5'));module['exports']=function(_0x50c4bd,_0x4c49af){return _0x50c4bd[_0xe3e9('0x6')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xe3e9('0x7'),'fields':[_0xe3e9('0x8'),_0xe3e9('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd973=['util','api','bluebird','request-promise','path','exports','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId'];(function(_0x5ed80b,_0x581a4b){var _0x5dbc17=function(_0xf980c4){while(--_0xf980c4){_0x5ed80b['push'](_0x5ed80b['shift']());}};_0x5dbc17(++_0x581a4b);}(_0xd973,0xb0));var _0x3d97=function(_0x3b33f7,_0x59128d){_0x3b33f7=_0x3b33f7-0x0;var _0x5b5121=_0xd973[_0x3b33f7];return _0x5b5121;};'use strict';var _=require('lodash');var util=require(_0x3d97('0x0'));var logger=require('../../config/logger')(_0x3d97('0x1'));var moment=require('moment');var BPromise=require(_0x3d97('0x2'));var rp=require(_0x3d97('0x3'));var fs=require('fs');var path=require(_0x3d97('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module[_0x3d97('0x5')]=function(_0x51d264,_0x477a89){return _0x51d264['define'](_0x3d97('0x6'),attributes,{'tableName':_0x3d97('0x7'),'paranoid':![],'indexes':[{'name':_0x3d97('0x8'),'fields':[_0x3d97('0x9'),_0x3d97('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index f64fda8..2dbe6c2 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 _0xcc48=['error','code','message','catch','UserProfileSection,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xcc48,0x10d));var _0x8cc4=function(_0xeeb156,_0x5392f4){_0xeeb156=_0xeeb156-0x0;var _0x4b7c74=_0xcc48[_0xeeb156];return _0x4b7c74;};'use strict';var _=require(_0x8cc4('0x0'));var util=require(_0x8cc4('0x1'));var moment=require(_0x8cc4('0x2'));var BPromise=require(_0x8cc4('0x3'));var rs=require(_0x8cc4('0x4'));var fs=require('fs');var Redis=require(_0x8cc4('0x5'));var db=require(_0x8cc4('0x6'))['db'];var utils=require(_0x8cc4('0x7'));var logger=require(_0x8cc4('0x8'))(_0x8cc4('0x9'));var config=require(_0x8cc4('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8cc4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e672b,_0x42579a,_0xa8e939){return new BPromise(function(_0x2c9ebc,_0x1a829c){return client[_0x8cc4('0xc')](_0x4e672b,_0xa8e939)['then'](function(_0x58b6ea){logger[_0x8cc4('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x42579a,_0x8cc4('0xe'));logger['debug'](_0x8cc4('0xf'),_0x42579a,_0x8cc4('0xe'),JSON[_0x8cc4('0x10')](_0x58b6ea));if(_0x58b6ea[_0x8cc4('0x11')]){if(_0x58b6ea[_0x8cc4('0x11')][_0x8cc4('0x12')]===0x1f4){logger[_0x8cc4('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x42579a,_0x58b6ea[_0x8cc4('0x11')][_0x8cc4('0x13')]);return _0x1a829c(_0x58b6ea['error'][_0x8cc4('0x13')]);}logger[_0x8cc4('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x42579a,_0x58b6ea[_0x8cc4('0x11')][_0x8cc4('0x13')]);return _0x2c9ebc(_0x58b6ea[_0x8cc4('0x11')][_0x8cc4('0x13')]);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0x42579a,_0x8cc4('0xe'));_0x2c9ebc(_0x58b6ea['result']['message']);}})[_0x8cc4('0x14')](function(_0x5f5959){logger[_0x8cc4('0x11')](_0x8cc4('0x15'),_0x42579a,_0x5f5959);_0x1a829c(_0x5f5959);});});} \ No newline at end of file +var _0x1af2=['request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s'];(function(_0x5bd1e7,_0xe56bd7){var _0x49f029=function(_0x19a26d){while(--_0x19a26d){_0x5bd1e7['push'](_0x5bd1e7['shift']());}};_0x49f029(++_0xe56bd7);}(_0x1af2,0x1d7));var _0x21af=function(_0x56edce,_0x3718d7){_0x56edce=_0x56edce-0x0;var _0x3ea2fe=_0x1af2[_0x56edce];return _0x3ea2fe;};'use strict';var _=require(_0x21af('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x21af('0x1'));var fs=require('fs');var Redis=require(_0x21af('0x2'));var db=require(_0x21af('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x21af('0x4'))(_0x21af('0x5'));var config=require('../../config/environment');var jayson=require(_0x21af('0x6'));var client=jayson[_0x21af('0x7')][_0x21af('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x944a48,_0x2868a1,_0x2136d7){return new BPromise(function(_0x5b07a9,_0x133653){return client[_0x21af('0x9')](_0x944a48,_0x2136d7)[_0x21af('0xa')](function(_0x5f0c35){logger[_0x21af('0xb')](_0x21af('0xc'),_0x2868a1,_0x21af('0xd'));logger[_0x21af('0xe')](_0x21af('0xf'),_0x2868a1,_0x21af('0xd'),JSON[_0x21af('0x10')](_0x5f0c35));if(_0x5f0c35[_0x21af('0x11')]){if(_0x5f0c35['error'][_0x21af('0x12')]===0x1f4){logger[_0x21af('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x2868a1,_0x5f0c35['error'][_0x21af('0x13')]);return _0x133653(_0x5f0c35[_0x21af('0x11')]['message']);}logger[_0x21af('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x2868a1,_0x5f0c35[_0x21af('0x11')][_0x21af('0x13')]);return _0x5b07a9(_0x5f0c35[_0x21af('0x11')]['message']);}else{logger['info'](_0x21af('0xc'),_0x2868a1,_0x21af('0xd'));_0x5b07a9(_0x5f0c35[_0x21af('0x14')][_0x21af('0x13')]);}})[_0x21af('0x15')](function(_0x42c0bc){logger['error'](_0x21af('0xc'),_0x2868a1,_0x42c0bc);_0x133653(_0x42c0bc);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index e076431..686e43f 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 _0x1ff2=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x56bb8e,_0xb5ff1a){var _0x4629d0=function(_0x469e08){while(--_0x469e08){_0x56bb8e['push'](_0x56bb8e['shift']());}};_0x4629d0(++_0xb5ff1a);}(_0x1ff2,0x141));var _0x21ff=function(_0x3c796b,_0x157c7c){_0x3c796b=_0x3c796b-0x0;var _0x5154d4=_0x1ff2[_0x3c796b];return _0x5154d4;};'use strict';var multer=require(_0x21ff('0x0'));var util=require(_0x21ff('0x1'));var path=require(_0x21ff('0x2'));var timeout=require(_0x21ff('0x3'));var express=require(_0x21ff('0x4'));var router=express[_0x21ff('0x5')]();var auth=require(_0x21ff('0x6'));var interaction=require(_0x21ff('0x7'));var config=require(_0x21ff('0x8'));module[_0x21ff('0x9')]=router; \ No newline at end of file +var _0x158c=['exports','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5adf94,_0x23557e){var _0x4fdf60=function(_0x53db22){while(--_0x53db22){_0x5adf94['push'](_0x5adf94['shift']());}};_0x4fdf60(++_0x23557e);}(_0x158c,0x15d));var _0xc158=function(_0x301b24,_0x11ea2a){_0x301b24=_0x301b24-0x0;var _0x589543=_0x158c[_0x301b24];return _0x589543;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc158('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc158('0x1')]();var auth=require(_0xc158('0x2'));var interaction=require(_0xc158('0x3'));var config=require(_0xc158('0x4'));module[_0xc158('0x5')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 09dff86..c1100cf 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x2fd8a7,_0x5db621){var _0x4bdc24=function(_0x30ef41){while(--_0x30ef41){_0x2fd8a7['push'](_0x2fd8a7['shift']());}};_0x4bdc24(++_0x5db621);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x5aa647,_0x1e85aa){var _0x1740ca=function(_0x1d93fc){while(--_0x1d93fc){_0x5aa647['push'](_0x5aa647['shift']());}};_0x1740ca(++_0x1e85aa);}(_0xe706,0xa3));var _0x6e70=function(_0x4b89d9,_0x3a4a59){_0x4b89d9=_0x4b89d9-0x0;var _0x5648ac=_0xe706[_0x4b89d9];return _0x5648ac;};'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 58b7ede..527d6df 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 _0xa44e=['bluebird','request-promise','exports','define','UserSmsQueue','user_has_sms_queues','util','api','moment'];(function(_0x43471c,_0x528d23){var _0x5f27a4=function(_0x1fdcd3){while(--_0x1fdcd3){_0x43471c['push'](_0x43471c['shift']());}};_0x5f27a4(++_0x528d23);}(_0xa44e,0x189));var _0xea44=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa44e[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xea44('0x0'));var logger=require('../../config/logger')(_0xea44('0x1'));var moment=require(_0xea44('0x2'));var BPromise=require(_0xea44('0x3'));var rp=require(_0xea44('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userSmsQueue.attributes');module[_0xea44('0x5')]=function(_0x51f9ba,_0x3a9824){return _0x51f9ba[_0xea44('0x6')](_0xea44('0x7'),attributes,{'tableName':_0xea44('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39f2=['user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue'];(function(_0x5e4563,_0x3ff918){var _0x8d1bf5=function(_0x3bf7a9){while(--_0x3bf7a9){_0x5e4563['push'](_0x5e4563['shift']());}};_0x8d1bf5(++_0x3ff918);}(_0x39f2,0x135));var _0x239f=function(_0x1ea252,_0x3b8d27){_0x1ea252=_0x1ea252-0x0;var _0x249c73=_0x39f2[_0x1ea252];return _0x249c73;};'use strict';var _=require(_0x239f('0x0'));var util=require(_0x239f('0x1'));var logger=require(_0x239f('0x2'))(_0x239f('0x3'));var moment=require(_0x239f('0x4'));var BPromise=require(_0x239f('0x5'));var rp=require(_0x239f('0x6'));var fs=require('fs');var path=require(_0x239f('0x7'));var rimraf=require(_0x239f('0x8'));var config=require(_0x239f('0x9'));var attributes=require(_0x239f('0xa'));module[_0x239f('0xb')]=function(_0x5c7bff,_0x6d4d16){return _0x5c7bff['define'](_0x239f('0xc'),attributes,{'tableName':_0x239f('0xd'),'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 cf2ae08..a020563 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 _0x8be2=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0xca465b,_0x470663){var _0x3d988d=function(_0x2d2e1f){while(--_0x2d2e1f){_0xca465b['push'](_0xca465b['shift']());}};_0x3d988d(++_0x470663);}(_0x8be2,0x1b4));var _0x28be=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x8be2[_0x31a371];return _0x2a5bd6;};'use strict';var _=require(_0x28be('0x0'));var util=require(_0x28be('0x1'));var moment=require(_0x28be('0x2'));var BPromise=require(_0x28be('0x3'));var rs=require(_0x28be('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x28be('0x5'))['db'];var utils=require(_0x28be('0x6'));var logger=require(_0x28be('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x28be('0x8'));var client=jayson[_0x28be('0x9')][_0x28be('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17bd4d,_0x259899,_0x422891){return new BPromise(function(_0x5caff2,_0x2fa60c){return client[_0x28be('0xb')](_0x17bd4d,_0x422891)[_0x28be('0xc')](function(_0x44d9ae){logger[_0x28be('0xd')](_0x28be('0xe'),_0x259899,'request\x20sent');logger['debug'](_0x28be('0xf'),_0x259899,_0x28be('0x10'),JSON[_0x28be('0x11')](_0x44d9ae));if(_0x44d9ae['error']){if(_0x44d9ae[_0x28be('0x12')][_0x28be('0x13')]===0x1f4){logger[_0x28be('0x12')](_0x28be('0xe'),_0x259899,_0x44d9ae[_0x28be('0x12')][_0x28be('0x14')]);return _0x2fa60c(_0x44d9ae[_0x28be('0x12')][_0x28be('0x14')]);}logger[_0x28be('0x12')](_0x28be('0xe'),_0x259899,_0x44d9ae[_0x28be('0x12')][_0x28be('0x14')]);return _0x5caff2(_0x44d9ae[_0x28be('0x12')][_0x28be('0x14')]);}else{logger[_0x28be('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x259899,_0x28be('0x10'));_0x5caff2(_0x44d9ae[_0x28be('0x15')]['message']);}})[_0x28be('0x16')](function(_0x4af078){logger['error'](_0x28be('0xe'),_0x259899,_0x4af078);_0x2fa60c(_0x4af078);});});} \ No newline at end of file +var _0xb0b4=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UserSmsQueue,\x20%s,\x20%s'];(function(_0x356e8d,_0x24c719){var _0x39e65a=function(_0x27ecc2){while(--_0x27ecc2){_0x356e8d['push'](_0x356e8d['shift']());}};_0x39e65a(++_0x24c719);}(_0xb0b4,0x13a));var _0x4b0b=function(_0x3c1ced,_0x19e25b){_0x3c1ced=_0x3c1ced-0x0;var _0x470493=_0xb0b4[_0x3c1ced];return _0x470493;};'use strict';var _=require(_0x4b0b('0x0'));var util=require(_0x4b0b('0x1'));var moment=require(_0x4b0b('0x2'));var BPromise=require(_0x4b0b('0x3'));var rs=require(_0x4b0b('0x4'));var fs=require('fs');var Redis=require(_0x4b0b('0x5'));var db=require(_0x4b0b('0x6'))['db'];var utils=require(_0x4b0b('0x7'));var logger=require(_0x4b0b('0x8'))(_0x4b0b('0x9'));var config=require(_0x4b0b('0xa'));var jayson=require(_0x4b0b('0xb'));var client=jayson['client'][_0x4b0b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5069fe,_0x31fe91,_0x2cec66){return new BPromise(function(_0x52422b,_0x7ebae0){return client[_0x4b0b('0xd')](_0x5069fe,_0x2cec66)[_0x4b0b('0xe')](function(_0x130ad0){logger[_0x4b0b('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x31fe91,'request\x20sent');logger[_0x4b0b('0x10')](_0x4b0b('0x11'),_0x31fe91,_0x4b0b('0x12'),JSON[_0x4b0b('0x13')](_0x130ad0));if(_0x130ad0['error']){if(_0x130ad0[_0x4b0b('0x14')][_0x4b0b('0x15')]===0x1f4){logger[_0x4b0b('0x14')]('UserSmsQueue,\x20%s,\x20%s',_0x31fe91,_0x130ad0[_0x4b0b('0x14')]['message']);return _0x7ebae0(_0x130ad0['error'][_0x4b0b('0x16')]);}logger[_0x4b0b('0x14')]('UserSmsQueue,\x20%s,\x20%s',_0x31fe91,_0x130ad0[_0x4b0b('0x14')]['message']);return _0x52422b(_0x130ad0[_0x4b0b('0x14')]['message']);}else{logger['info'](_0x4b0b('0x17'),_0x31fe91,_0x4b0b('0x12'));_0x52422b(_0x130ad0[_0x4b0b('0x18')]['message']);}})[_0x4b0b('0x19')](function(_0x131ef1){logger[_0x4b0b('0x14')](_0x4b0b('0x17'),_0x31fe91,_0x131ef1);_0x7ebae0(_0x131ef1);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 61c6bf2..d1cc3c8 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 _0xae1e=['exports','util','path','Router','../../components/interaction/service','../../config/environment'];(function(_0x12be05,_0x264872){var _0x43f6df=function(_0x5cbcb5){while(--_0x5cbcb5){_0x12be05['push'](_0x12be05['shift']());}};_0x43f6df(++_0x264872);}(_0xae1e,0x151));var _0xeae1=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xae1e[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0xeae1('0x0'));var path=require(_0xeae1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xeae1('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xeae1('0x3'));var config=require(_0xeae1('0x4'));module[_0xeae1('0x5')]=router; \ No newline at end of file +var _0x0560=['../../config/environment','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xd69bbe,_0x4b66fa){var _0x5801aa=function(_0x18ec03){while(--_0x18ec03){_0xd69bbe['push'](_0xd69bbe['shift']());}};_0x5801aa(++_0x4b66fa);}(_0x0560,0x82));var _0x0056=function(_0x4487c5,_0x23e764){_0x4487c5=_0x4487c5-0x0;var _0x55d469=_0x0560[_0x4487c5];return _0x55d469;};'use strict';var multer=require(_0x0056('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0056('0x1'));var express=require(_0x0056('0x2'));var router=express[_0x0056('0x3')]();var auth=require(_0x0056('0x4'));var interaction=require(_0x0056('0x5'));var config=require(_0x0056('0x6'));module[_0x0056('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index b96dfd5..3ec3598 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x3d35c9,_0x23e44a){var _0x10f0f9=function(_0xe05eb2){while(--_0xe05eb2){_0x3d35c9['push'](_0x3d35c9['shift']());}};_0x10f0f9(++_0x23e44a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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(_0x405ffe,_0x3727a0){var _0x35fd2c=function(_0x3d9bce){while(--_0x3d9bce){_0x405ffe['push'](_0x405ffe['shift']());}};_0x35fd2c(++_0x3727a0);}(_0xe706,0xa3));var _0x6e70=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0xe706[_0x166742];return _0xb7814a;};'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/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 0b8c021..9123cfd 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 _0x425d=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userVoiceQueue.attributes','exports','define','UserVoiceQueue'];(function(_0xfb2f46,_0x4f89df){var _0xcadef3=function(_0x1ae5c8){while(--_0x1ae5c8){_0xfb2f46['push'](_0xfb2f46['shift']());}};_0xcadef3(++_0x4f89df);}(_0x425d,0x1e0));var _0xd425=function(_0x27ec50,_0x1d8698){_0x27ec50=_0x27ec50-0x0;var _0x2da0f5=_0x425d[_0x27ec50];return _0x2da0f5;};'use strict';var _=require(_0xd425('0x0'));var util=require('util');var logger=require(_0xd425('0x1'))(_0xd425('0x2'));var moment=require(_0xd425('0x3'));var BPromise=require(_0xd425('0x4'));var rp=require(_0xd425('0x5'));var fs=require('fs');var path=require(_0xd425('0x6'));var rimraf=require(_0xd425('0x7'));var config=require('../../config/environment');var attributes=require(_0xd425('0x8'));module[_0xd425('0x9')]=function(_0xc4e080,_0x36866e){return _0xc4e080[_0xd425('0xa')](_0xd425('0xb'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b9b=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues'];(function(_0x331e3b,_0x1ec71a){var _0x53cf3b=function(_0x5b9aa6){while(--_0x5b9aa6){_0x331e3b['push'](_0x331e3b['shift']());}};_0x53cf3b(++_0x1ec71a);}(_0x9b9b,0x114));var _0xb9b9=function(_0x1f5974,_0x11540c){_0x1f5974=_0x1f5974-0x0;var _0x5cb353=_0x9b9b[_0x1f5974];return _0x5cb353;};'use strict';var _=require('lodash');var util=require(_0xb9b9('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb9b9('0x1'));var BPromise=require(_0xb9b9('0x2'));var rp=require(_0xb9b9('0x3'));var fs=require('fs');var path=require(_0xb9b9('0x4'));var rimraf=require(_0xb9b9('0x5'));var config=require(_0xb9b9('0x6'));var attributes=require(_0xb9b9('0x7'));module[_0xb9b9('0x8')]=function(_0x79dd,_0x3d1a95){return _0x79dd[_0xb9b9('0x9')](_0xb9b9('0xa'),attributes,{'tableName':_0xb9b9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 0dcebef..9c6bfce 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 _0xed4b=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','moment','bluebird'];(function(_0x3b2838,_0x3cd7b3){var _0x530b7d=function(_0x36782e){while(--_0x36782e){_0x3b2838['push'](_0x3b2838['shift']());}};_0x530b7d(++_0x3cd7b3);}(_0xed4b,0x12a));var _0xbed4=function(_0x136ffa,_0x49ef77){_0x136ffa=_0x136ffa-0x0;var _0x96647c=_0xed4b[_0x136ffa];return _0x96647c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbed4('0x0'));var BPromise=require(_0xbed4('0x1'));var rs=require(_0xbed4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbed4('0x3'))['db'];var utils=require(_0xbed4('0x4'));var logger=require('../../config/logger')(_0xbed4('0x5'));var config=require(_0xbed4('0x6'));var jayson=require(_0xbed4('0x7'));var client=jayson[_0xbed4('0x8')][_0xbed4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x404468,_0x4262e6,_0x2c010f){return new BPromise(function(_0x2d2719,_0x1e7007){return client[_0xbed4('0xa')](_0x404468,_0x2c010f)[_0xbed4('0xb')](function(_0x5b92fd){logger[_0xbed4('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x4262e6,_0xbed4('0xd'));logger['debug'](_0xbed4('0xe'),_0x4262e6,_0xbed4('0xd'),JSON['stringify'](_0x5b92fd));if(_0x5b92fd[_0xbed4('0xf')]){if(_0x5b92fd[_0xbed4('0xf')]['code']===0x1f4){logger['error'](_0xbed4('0x10'),_0x4262e6,_0x5b92fd[_0xbed4('0xf')]['message']);return _0x1e7007(_0x5b92fd[_0xbed4('0xf')][_0xbed4('0x11')]);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x4262e6,_0x5b92fd[_0xbed4('0xf')][_0xbed4('0x11')]);return _0x2d2719(_0x5b92fd[_0xbed4('0xf')][_0xbed4('0x11')]);}else{logger[_0xbed4('0xc')](_0xbed4('0x10'),_0x4262e6,'request\x20sent');_0x2d2719(_0x5b92fd[_0xbed4('0x12')]['message']);}})[_0xbed4('0x13')](function(_0x9c989b){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x4262e6,_0x9c989b);_0x1e7007(_0x9c989b);});});} \ No newline at end of file +var _0x04ea=['UserVoiceQueue,\x20%s,\x20%s','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0x5207d3,_0x1b67d4){var _0x36785c=function(_0x11a1d3){while(--_0x11a1d3){_0x5207d3['push'](_0x5207d3['shift']());}};_0x36785c(++_0x1b67d4);}(_0x04ea,0xa3));var _0xa04e=function(_0x4ed17b,_0x2b1745){_0x4ed17b=_0x4ed17b-0x0;var _0x24b248=_0x04ea[_0x4ed17b];return _0x24b248;};'use strict';var _=require(_0xa04e('0x0'));var util=require('util');var moment=require(_0xa04e('0x1'));var BPromise=require(_0xa04e('0x2'));var rs=require(_0xa04e('0x3'));var fs=require('fs');var Redis=require(_0xa04e('0x4'));var db=require(_0xa04e('0x5'))['db'];var utils=require(_0xa04e('0x6'));var logger=require(_0xa04e('0x7'))(_0xa04e('0x8'));var config=require(_0xa04e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa04e('0xa')][_0xa04e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9f30fc,_0x32eb9f,_0xa8087e){return new BPromise(function(_0x249bfc,_0xaa85b4){return client['request'](_0x9f30fc,_0xa8087e)[_0xa04e('0xc')](function(_0x9a06d3){logger['info'](_0xa04e('0xd'),_0x32eb9f,'request\x20sent');logger['debug'](_0xa04e('0xe'),_0x32eb9f,_0xa04e('0xf'),JSON['stringify'](_0x9a06d3));if(_0x9a06d3['error']){if(_0x9a06d3['error'][_0xa04e('0x10')]===0x1f4){logger[_0xa04e('0x11')](_0xa04e('0xd'),_0x32eb9f,_0x9a06d3['error'][_0xa04e('0x12')]);return _0xaa85b4(_0x9a06d3[_0xa04e('0x11')]['message']);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x32eb9f,_0x9a06d3[_0xa04e('0x11')][_0xa04e('0x12')]);return _0x249bfc(_0x9a06d3[_0xa04e('0x11')][_0xa04e('0x12')]);}else{logger[_0xa04e('0x13')](_0xa04e('0xd'),_0x32eb9f,_0xa04e('0xf'));_0x249bfc(_0x9a06d3[_0xa04e('0x14')][_0xa04e('0x12')]);}})[_0xa04e('0x15')](function(_0x4a1c0c){logger['error'](_0xa04e('0xd'),_0x32eb9f,_0x4a1c0c);_0xaa85b4(_0x4a1c0c);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 420ba2d..b7f2e56 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 _0xbf88=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x59a92e,_0x4af751){var _0x1c4ccb=function(_0x11ea0c){while(--_0x11ea0c){_0x59a92e['push'](_0x59a92e['shift']());}};_0x1c4ccb(++_0x4af751);}(_0xbf88,0x19e));var _0x8bf8=function(_0x3012e1,_0x30d750){_0x3012e1=_0x3012e1-0x0;var _0x501362=_0xbf88[_0x3012e1];return _0x501362;};'use strict';var multer=require(_0x8bf8('0x0'));var util=require(_0x8bf8('0x1'));var path=require(_0x8bf8('0x2'));var timeout=require(_0x8bf8('0x3'));var express=require(_0x8bf8('0x4'));var router=express[_0x8bf8('0x5')]();var auth=require(_0x8bf8('0x6'));var interaction=require(_0x8bf8('0x7'));var config=require(_0x8bf8('0x8'));module['exports']=router; \ No newline at end of file +var _0xfdf4=['util','path','connect-timeout','Router','../../components/auth/service','../../config/environment'];(function(_0x36981f,_0x35de12){var _0x4c1845=function(_0xe1ff6b){while(--_0xe1ff6b){_0x36981f['push'](_0x36981f['shift']());}};_0x4c1845(++_0x35de12);}(_0xfdf4,0xb4));var _0x4fdf=function(_0x37b426,_0x3463f5){_0x37b426=_0x37b426-0x0;var _0x14fcd8=_0xfdf4[_0x37b426];return _0x14fcd8;};'use strict';var multer=require('multer');var util=require(_0x4fdf('0x0'));var path=require(_0x4fdf('0x1'));var timeout=require(_0x4fdf('0x2'));var express=require('express');var router=express[_0x4fdf('0x3')]();var auth=require(_0x4fdf('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4fdf('0x5'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index c3f274b..ab13b22 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 _0x5039=['INTEGER','STRING','Required\x20by\x20Asterisk','queue_interface','sequelize','exports'];(function(_0x35af28,_0xa142f6){var _0x169538=function(_0x4da3c7){while(--_0x4da3c7){_0x35af28['push'](_0x35af28['shift']());}};_0x169538(++_0xa142f6);}(_0x5039,0xee));var _0x9503=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x5039[_0x53cf8e];return _0x459197;};'use strict';var Sequelize=require(_0x9503('0x0'));module[_0x9503('0x1')]={'uniqueid':{'type':Sequelize[_0x9503('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x9503('0x3')],'allowNull':![],'comment':_0x9503('0x4')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x9503('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x9503('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x9503('0x3')],'allowNull':![],'unique':_0x9503('0x5'),'comment':_0x9503('0x4')},'penalty':{'type':Sequelize[_0x9503('0x2')](0xb),'defaultValue':0x0,'comment':_0x9503('0x4')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x9503('0x4')}}; \ No newline at end of file +var _0x0e3b=['sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x0e3b,0x174));var _0xb0e3=function(_0x393d1c,_0x516a02){_0x393d1c=_0x393d1c-0x0;var _0x1de9b2=_0x0e3b[_0x393d1c];return _0x1de9b2;};'use strict';var Sequelize=require(_0xb0e3('0x0'));module[_0xb0e3('0x1')]={'uniqueid':{'type':Sequelize[_0xb0e3('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xb0e3('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0xb0e3('0x3')},'UserId':{'type':Sequelize[_0xb0e3('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xb0e3('0x4')],'allowNull':![],'unique':_0xb0e3('0x5'),'comment':_0xb0e3('0x3')},'VoiceQueueId':{'type':Sequelize[_0xb0e3('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb0e3('0x5'),'comment':_0xb0e3('0x3')},'penalty':{'type':Sequelize[_0xb0e3('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0xb0e3('0x2')](0xb),'defaultValue':0x0,'comment':_0xb0e3('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index ae0051d..344d439 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 _0xc8a3=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','UserVoiceQueueRt'];(function(_0x5b8eb0,_0x5db23b){var _0xfe39d7=function(_0x122123){while(--_0x122123){_0x5b8eb0['push'](_0x5b8eb0['shift']());}};_0xfe39d7(++_0x5db23b);}(_0xc8a3,0x7c));var _0x3c8a=function(_0x5ae54d,_0x2fc130){_0x5ae54d=_0x5ae54d-0x0;var _0x33cbed=_0xc8a3[_0x5ae54d];return _0x33cbed;};'use strict';var EventEmitter=require(_0x3c8a('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x3c8a('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x3c8a('0x2')](0x0);var events={'afterCreate':_0x3c8a('0x3'),'afterUpdate':_0x3c8a('0x4'),'afterDestroy':_0x3c8a('0x5')};function emitEvent(_0x452f35){return function(_0x3a598f,_0x258c62,_0xe39a9d){UserVoiceQueueRtEvents[_0x3c8a('0x6')](_0x452f35+':'+_0x3a598f['id'],_0x3a598f);UserVoiceQueueRtEvents['emit'](_0x452f35,_0x3a598f);_0xe39a9d(null);};}for(var e in events){if(events[_0x3c8a('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x3c8a('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x32a3=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserVoiceQueueRt'];(function(_0x4edccc,_0x415103){var _0x574a32=function(_0x5a74d1){while(--_0x5a74d1){_0x4edccc['push'](_0x4edccc['shift']());}};_0x574a32(++_0x415103);}(_0x32a3,0x166));var _0x332a=function(_0x128ec9,_0x5daaa8){_0x128ec9=_0x128ec9-0x0;var _0x442dab=_0x32a3[_0x128ec9];return _0x442dab;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x332a('0x0'))['db'][_0x332a('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x332a('0x2')](0x0);var events={'afterCreate':_0x332a('0x3'),'afterUpdate':'update','afterDestroy':_0x332a('0x4')};function emitEvent(_0x3f6193){return function(_0x3f5f4f,_0x2e732a,_0x4fae83){UserVoiceQueueRtEvents[_0x332a('0x5')](_0x3f6193+':'+_0x3f5f4f['id'],_0x3f5f4f);UserVoiceQueueRtEvents[_0x332a('0x5')](_0x3f6193,_0x3f5f4f);_0x4fae83(null);};}for(var e in events){if(events[_0x332a('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x332a('0x7')](e,emitEvent(event));}}module[_0x332a('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index ab126eb..bfd2457 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 _0x9856=['request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','util','../../config/logger','api'];(function(_0x38977c,_0x16b241){var _0x5cef84=function(_0x28ca51){while(--_0x28ca51){_0x38977c['push'](_0x38977c['shift']());}};_0x5cef84(++_0x16b241);}(_0x9856,0xb8));var _0x6985=function(_0x1104fc,_0x43f00a){_0x1104fc=_0x1104fc-0x0;var _0x21d63f=_0x9856[_0x1104fc];return _0x21d63f;};'use strict';var _=require('lodash');var util=require(_0x6985('0x0'));var logger=require(_0x6985('0x1'))(_0x6985('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6985('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6985('0x4'));var config=require(_0x6985('0x5'));var attributes=require(_0x6985('0x6'));module[_0x6985('0x7')]=function(_0x5dbf7e,_0x230d0c){return _0x5dbf7e[_0x6985('0x8')](_0x6985('0x9'),attributes,{'tableName':_0x6985('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6740=['exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x6740,0x15d));var _0x0674=function(_0x5e28c2,_0x1e48ab){_0x5e28c2=_0x5e28c2-0x0;var _0x1a8cc6=_0x6740[_0x5e28c2];return _0x1a8cc6;};'use strict';var _=require(_0x0674('0x0'));var util=require(_0x0674('0x1'));var logger=require(_0x0674('0x2'))(_0x0674('0x3'));var moment=require(_0x0674('0x4'));var BPromise=require(_0x0674('0x5'));var rp=require(_0x0674('0x6'));var fs=require('fs');var path=require(_0x0674('0x7'));var rimraf=require(_0x0674('0x8'));var config=require(_0x0674('0x9'));var attributes=require(_0x0674('0xa'));module[_0x0674('0xb')]=function(_0x4a1ef8,_0x48580a){return _0x4a1ef8[_0x0674('0xc')](_0x0674('0xd'),attributes,{'tableName':_0x0674('0xe'),'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 1b412d8..83a6974 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 _0x3dc1=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','UserVoiceQueueRt','options','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','GetVoiceQueueRtPauses','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x27858b,_0x1b52bd){var _0x751c89=function(_0x4655b3){while(--_0x4655b3){_0x27858b['push'](_0x27858b['shift']());}};_0x751c89(++_0x1b52bd);}(_0x3dc1,0x124));var _0x13dc=function(_0xa80333,_0x42f695){_0xa80333=_0xa80333-0x0;var _0xe7b5c=_0x3dc1[_0xa80333];return _0xe7b5c;};'use strict';var _=require('lodash');var util=require(_0x13dc('0x0'));var moment=require('moment');var BPromise=require(_0x13dc('0x1'));var rs=require(_0x13dc('0x2'));var fs=require('fs');var Redis=require(_0x13dc('0x3'));var db=require(_0x13dc('0x4'))['db'];var utils=require(_0x13dc('0x5'));var logger=require(_0x13dc('0x6'))(_0x13dc('0x7'));var config=require(_0x13dc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x13dc('0x9')][_0x13dc('0xa')]({'port':0x232a});config[_0x13dc('0xb')]=_['defaults'](config['redis'],{'host':_0x13dc('0xc'),'port':0x18eb});var socket=require(_0x13dc('0xd'))(new Redis(config[_0x13dc('0xb')]));require(_0x13dc('0xe'))[_0x13dc('0xf')](socket);function respondWithRpcPromise(_0x7ea336,_0x540e84,_0x37e6f3){return new BPromise(function(_0x5c2c75,_0x212004){return client['request'](_0x7ea336,_0x37e6f3)['then'](function(_0x3ea6ba){logger[_0x13dc('0x10')](_0x13dc('0x11'),_0x540e84,'request\x20sent');logger[_0x13dc('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x540e84,_0x13dc('0x13'),JSON[_0x13dc('0x14')](_0x3ea6ba));if(_0x3ea6ba[_0x13dc('0x15')]){if(_0x3ea6ba[_0x13dc('0x15')]['code']===0x1f4){logger['error'](_0x13dc('0x11'),_0x540e84,_0x3ea6ba[_0x13dc('0x15')][_0x13dc('0x16')]);return _0x212004(_0x3ea6ba[_0x13dc('0x15')][_0x13dc('0x16')]);}logger[_0x13dc('0x15')](_0x13dc('0x11'),_0x540e84,_0x3ea6ba[_0x13dc('0x15')][_0x13dc('0x16')]);return _0x5c2c75(_0x3ea6ba[_0x13dc('0x15')][_0x13dc('0x16')]);}else{logger[_0x13dc('0x10')](_0x13dc('0x11'),_0x540e84,_0x13dc('0x13'));_0x5c2c75(_0x3ea6ba['result'][_0x13dc('0x16')]);}})[_0x13dc('0x17')](function(_0x5dcaa3){logger[_0x13dc('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x540e84,_0x5dcaa3);_0x212004(_0x5dcaa3);});});}exports['GetVoiceQueueRtPauses']=function(_0x4f1b8c){var _0xf76618=this;return new Promise(function(_0x368054,_0x3c2f8a){return db[_0x13dc('0x18')]['findAll']({'raw':_0x4f1b8c['options']?_0x4f1b8c[_0x13dc('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4f1b8c[_0x13dc('0x19')]?_0x4f1b8c[_0x13dc('0x19')]['where']||null:null,'attributes':[[db[_0x13dc('0x1a')]['fn'](_0x13dc('0x1b'),db[_0x13dc('0x1a')]['fn']('IF',db[_0x13dc('0x1a')][_0x13dc('0x1c')](_0x13dc('0x1d')))),_0x13dc('0x1e')]]})[_0x13dc('0x1f')](function(_0x3c47dc){logger[_0x13dc('0x10')]('GetVoiceQueueRtPauses',_0x4f1b8c);logger[_0x13dc('0x12')](_0x13dc('0x20'),_0x4f1b8c,JSON[_0x13dc('0x14')](_0x3c47dc));_0x368054(_0x3c47dc);})[_0x13dc('0x17')](function(_0x54b97c){logger['error'](_0x13dc('0x20'),_0x54b97c[_0x13dc('0x16')],_0x4f1b8c);_0x3c2f8a(_0xf76618[_0x13dc('0x15')](0x1f4,_0x54b97c[_0x13dc('0x16')]));});});}; \ No newline at end of file +var _0xa129=['jayson/promise','client','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa129,0x1ef));var _0x9a12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa129[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9a12('0x0'));var util=require(_0x9a12('0x1'));var moment=require(_0x9a12('0x2'));var BPromise=require(_0x9a12('0x3'));var rs=require(_0x9a12('0x4'));var fs=require('fs');var Redis=require(_0x9a12('0x5'));var db=require(_0x9a12('0x6'))['db'];var utils=require(_0x9a12('0x7'));var logger=require('../../config/logger')(_0x9a12('0x8'));var config=require('../../config/environment');var jayson=require(_0x9a12('0x9'));var client=jayson[_0x9a12('0xa')][_0x9a12('0xb')]({'port':0x232a});config[_0x9a12('0xc')]=_[_0x9a12('0xd')](config[_0x9a12('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x9a12('0xe'))(new Redis(config[_0x9a12('0xc')]));require(_0x9a12('0xf'))['register'](socket);function respondWithRpcPromise(_0x4307df,_0x3d79e6,_0x3e201e){return new BPromise(function(_0x1c7ab4,_0x492e4d){return client['request'](_0x4307df,_0x3e201e)[_0x9a12('0x10')](function(_0x473ada){logger[_0x9a12('0x11')](_0x9a12('0x12'),_0x3d79e6,_0x9a12('0x13'));logger[_0x9a12('0x14')](_0x9a12('0x15'),_0x3d79e6,_0x9a12('0x13'),JSON[_0x9a12('0x16')](_0x473ada));if(_0x473ada[_0x9a12('0x17')]){if(_0x473ada[_0x9a12('0x17')][_0x9a12('0x18')]===0x1f4){logger[_0x9a12('0x17')](_0x9a12('0x12'),_0x3d79e6,_0x473ada[_0x9a12('0x17')][_0x9a12('0x19')]);return _0x492e4d(_0x473ada[_0x9a12('0x17')][_0x9a12('0x19')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x3d79e6,_0x473ada[_0x9a12('0x17')]['message']);return _0x1c7ab4(_0x473ada['error'][_0x9a12('0x19')]);}else{logger[_0x9a12('0x11')](_0x9a12('0x12'),_0x3d79e6,_0x9a12('0x13'));_0x1c7ab4(_0x473ada[_0x9a12('0x1a')][_0x9a12('0x19')]);}})['catch'](function(_0x57965a){logger[_0x9a12('0x17')](_0x9a12('0x12'),_0x3d79e6,_0x57965a);_0x492e4d(_0x57965a);});});}exports[_0x9a12('0x1b')]=function(_0x3aceb7){var _0x52ea56=this;return new Promise(function(_0x366fa5,_0x52685e){return db[_0x9a12('0x1c')][_0x9a12('0x1d')]({'raw':_0x3aceb7[_0x9a12('0x1e')]?_0x3aceb7['options']['raw']===undefined?!![]:![]:!![],'where':_0x3aceb7[_0x9a12('0x1e')]?_0x3aceb7['options'][_0x9a12('0x1f')]||null:null,'attributes':[[db[_0x9a12('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x9a12('0x20')]['literal'](_0x9a12('0x21')))),_0x9a12('0x22')]]})[_0x9a12('0x10')](function(_0xec76bb){logger[_0x9a12('0x11')](_0x9a12('0x1b'),_0x3aceb7);logger[_0x9a12('0x14')](_0x9a12('0x1b'),_0x3aceb7,JSON[_0x9a12('0x16')](_0xec76bb));_0x366fa5(_0xec76bb);})[_0x9a12('0x23')](function(_0x2109ac){logger['error'](_0x9a12('0x1b'),_0x2109ac[_0x9a12('0x19')],_0x3aceb7);_0x52685e(_0x52ea56[_0x9a12('0x17')](0x1f4,_0x2109ac[_0x9a12('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 8f4ee40..d6b7660 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 _0xae99=['userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit','length'];(function(_0x3fcc96,_0x1c65d4){var _0x5caa7a=function(_0x39962c){while(--_0x39962c){_0x3fcc96['push'](_0x3fcc96['shift']());}};_0x5caa7a(++_0x1c65d4);}(_0xae99,0x78));var _0x9ae9=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xae99[_0x5bd426];return _0x23a7eb;};'use strict';var UserVoiceQueueRtEvents=require(_0x9ae9('0x0'));var events=[_0x9ae9('0x1'),_0x9ae9('0x2'),_0x9ae9('0x3')];function createListener(_0x40c0b6,_0x282686){return function(_0x2720e5){_0x282686[_0x9ae9('0x4')](_0x40c0b6,_0x2720e5);};}function removeListener(_0x67c685,_0x2aaf17){return function(){UserVoiceQueueRtEvents['removeListener'](_0x67c685,_0x2aaf17);};}exports['register']=function(_0x49b5f4){for(var _0x2d73ea=0x0,_0x423b34=events[_0x9ae9('0x5')];_0x2d73ea<_0x423b34;_0x2d73ea++){var _0xddd1c7=events[_0x2d73ea];var _0x4a0ab3=createListener(_0x9ae9('0x6')+_0xddd1c7,_0x49b5f4);UserVoiceQueueRtEvents['on'](_0xddd1c7,_0x4a0ab3);}}; \ No newline at end of file +var _0x10e2=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit','removeListener'];(function(_0x47e003,_0x4e36a5){var _0x3ec731=function(_0x540aaa){while(--_0x540aaa){_0x47e003['push'](_0x47e003['shift']());}};_0x3ec731(++_0x4e36a5);}(_0x10e2,0x1aa));var _0x210e=function(_0x3f6834,_0x62927e){_0x3f6834=_0x3f6834-0x0;var _0x2b830d=_0x10e2[_0x3f6834];return _0x2b830d;};'use strict';var UserVoiceQueueRtEvents=require(_0x210e('0x0'));var events=[_0x210e('0x1'),_0x210e('0x2'),_0x210e('0x3')];function createListener(_0x163a9d,_0x317a04){return function(_0x45b8b6){_0x317a04[_0x210e('0x4')](_0x163a9d,_0x45b8b6);};}function removeListener(_0x433ad4,_0x5f4c89){return function(){UserVoiceQueueRtEvents[_0x210e('0x5')](_0x433ad4,_0x5f4c89);};}exports[_0x210e('0x6')]=function(_0x407d8c){for(var _0x58a687=0x0,_0x43d077=events[_0x210e('0x7')];_0x58a687<_0x43d077;_0x58a687++){var _0xea8a8a=events[_0x58a687];var _0x5756f2=createListener(_0x210e('0x8')+_0xea8a8a,_0x407d8c);UserVoiceQueueRtEvents['on'](_0xea8a8a,_0x5756f2);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 67365a8..c4752cc 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 _0x05ae=['multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x2882a8,_0x57fe11){var _0x594432=function(_0x4a0b42){while(--_0x4a0b42){_0x2882a8['push'](_0x2882a8['shift']());}};_0x594432(++_0x57fe11);}(_0x05ae,0x150));var _0xe05a=function(_0x51a3c6,_0x471ad3){_0x51a3c6=_0x51a3c6-0x0;var _0x1bcda1=_0x05ae[_0x51a3c6];return _0x1bcda1;};'use strict';var multer=require(_0xe05a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe05a('0x1'));var express=require(_0xe05a('0x2'));var router=express['Router']();var auth=require(_0xe05a('0x3'));var interaction=require(_0xe05a('0x4'));var config=require(_0xe05a('0x5'));module[_0xe05a('0x6')]=router; \ No newline at end of file +var _0x71d1=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x71d1,0x110));var _0x171d=function(_0x954b3a,_0x10a7c1){_0x954b3a=_0x954b3a-0x0;var _0x3a313e=_0x71d1[_0x954b3a];return _0x3a313e;};'use strict';var multer=require(_0x171d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x171d('0x1'));var express=require(_0x171d('0x2'));var router=express[_0x171d('0x3')]();var auth=require(_0x171d('0x4'));var interaction=require(_0x171d('0x5'));var config=require(_0x171d('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index eac1960..14978f7 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 _0xd8b0=['exports','sequelize'];(function(_0x204ce5,_0x46fb75){var _0x4f5a44=function(_0x55e0ac){while(--_0x55e0ac){_0x204ce5['push'](_0x204ce5['shift']());}};_0x4f5a44(++_0x46fb75);}(_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 _0xbaf0=['exports','INTEGER'];(function(_0x30abff,_0x5f2c5f){var _0x4c571e=function(_0x43de9a){while(--_0x43de9a){_0x30abff['push'](_0x30abff['shift']());}};_0x4c571e(++_0x5f2c5f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index b56f732..fdc73d3 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 _0xe511=['bluebird','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','lodash','util','api'];(function(_0xd943d6,_0x4af118){var _0x3f05b1=function(_0x2d341d){while(--_0x2d341d){_0xd943d6['push'](_0xd943d6['shift']());}};_0x3f05b1(++_0x4af118);}(_0xe511,0x16f));var _0x1e51=function(_0x105e01,_0x199717){_0x105e01=_0x105e01-0x0;var _0x421f22=_0xe511[_0x105e01];return _0x421f22;};'use strict';var _=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var logger=require('../../config/logger')(_0x1e51('0x2'));var moment=require('moment');var BPromise=require(_0x1e51('0x3'));var rp=require(_0x1e51('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var attributes=require(_0x1e51('0x7'));module[_0x1e51('0x8')]=function(_0x480cca,_0x26b22c){return _0x480cca[_0x1e51('0x9')]('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4a2=['UserWhatsappQueue','user_has_whatsapp_queues','lodash','api','bluebird','path','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0x203e2b,_0x5a16f4){var _0x28b67b=function(_0x4bcebc){while(--_0x4bcebc){_0x203e2b['push'](_0x203e2b['shift']());}};_0x28b67b(++_0x5a16f4);}(_0xd4a2,0x173));var _0x2d4a=function(_0x3c11d6,_0x5371bb){_0x3c11d6=_0x3c11d6-0x0;var _0x3ca102=_0xd4a2[_0x3c11d6];return _0x3ca102;};'use strict';var _=require(_0x2d4a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2d4a('0x1'));var moment=require('moment');var BPromise=require(_0x2d4a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d4a('0x3'));var rimraf=require('rimraf');var config=require(_0x2d4a('0x4'));var attributes=require(_0x2d4a('0x5'));module[_0x2d4a('0x6')]=function(_0x3a88e2,_0x1ca10b){return _0x3a88e2['define'](_0x2d4a('0x7'),attributes,{'tableName':_0x2d4a('0x8'),'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 8898bbb..b130dc6 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(_0x25f612,_0x37c9f9){var _0x172cc2=function(_0x2fc71c){while(--_0x2fc71c){_0x25f612['push'](_0x25f612['shift']());}};_0x172cc2(++_0x37c9f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ 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(_0x22c5e7,_0x4fa957){var _0x360c61=function(_0xf9fe78){while(--_0xf9fe78){_0x22c5e7['push'](_0x22c5e7['shift']());}};_0x360c61(++_0x4fa957);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index c109eaa..e294afe 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 _0xc02d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0xb60674,_0xa4e08a){var _0x2514a0=function(_0x5bfc26){while(--_0x5bfc26){_0xb60674['push'](_0xb60674['shift']());}};_0x2514a0(++_0xa4e08a);}(_0xc02d,0x160));var _0xdc02=function(_0x5a213d,_0x4ce201){_0x5a213d=_0x5a213d-0x0;var _0x214d26=_0xc02d[_0x5a213d];return _0x214d26;};'use strict';var multer=require(_0xdc02('0x0'));var util=require(_0xdc02('0x1'));var path=require(_0xdc02('0x2'));var timeout=require(_0xdc02('0x3'));var express=require(_0xdc02('0x4'));var router=express['Router']();var auth=require(_0xdc02('0x5'));var interaction=require(_0xdc02('0x6'));var config=require(_0xdc02('0x7'));var controller=require(_0xdc02('0x8'));router[_0xdc02('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0xdc02('0xa')](),controller['show']);router[_0xdc02('0xb')]('/',auth['isAuthenticated'](),controller[_0xdc02('0xc')]);router[_0xdc02('0xd')]('/:id',auth[_0xdc02('0xa')](),controller['update']);router['delete'](_0xdc02('0xe'),auth['isAuthenticated'](),controller[_0xdc02('0xf')]);module[_0xdc02('0x10')]=router; \ No newline at end of file +var _0x6caa=['destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete'];(function(_0x30a731,_0x4747d7){var _0x35825e=function(_0x4b115a){while(--_0x4b115a){_0x30a731['push'](_0x30a731['shift']());}};_0x35825e(++_0x4747d7);}(_0x6caa,0x157));var _0xa6ca=function(_0x3e0cd9,_0x536af8){_0x3e0cd9=_0x3e0cd9-0x0;var _0x1e5df7=_0x6caa[_0x3e0cd9];return _0x1e5df7;};'use strict';var multer=require('multer');var util=require(_0xa6ca('0x0'));var path=require(_0xa6ca('0x1'));var timeout=require(_0xa6ca('0x2'));var express=require(_0xa6ca('0x3'));var router=express[_0xa6ca('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa6ca('0x5'));var config=require(_0xa6ca('0x6'));var controller=require(_0xa6ca('0x7'));router[_0xa6ca('0x8')]('/',auth[_0xa6ca('0x9')](),controller[_0xa6ca('0xa')]);router['get'](_0xa6ca('0xb'),auth[_0xa6ca('0x9')](),controller['show']);router[_0xa6ca('0xc')]('/',auth[_0xa6ca('0x9')](),controller[_0xa6ca('0xd')]);router[_0xa6ca('0xe')](_0xa6ca('0xb'),auth[_0xa6ca('0x9')](),controller[_0xa6ca('0xf')]);router[_0xa6ca('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xa6ca('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 3bfa37d..88ce6ad 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 _0x6984=['name','exports','STRING'];(function(_0x1ab550,_0x5f38ab){var _0x49f7dc=function(_0x39b468){while(--_0x39b468){_0x1ab550['push'](_0x1ab550['shift']());}};_0x49f7dc(++_0x5f38ab);}(_0x6984,0xbb));var _0x4698=function(_0x3bbf74,_0x6049aa){_0x3bbf74=_0x3bbf74-0x0;var _0x5140c5=_0x6984[_0x3bbf74];return _0x5140c5;};'use strict';var Sequelize=require('sequelize');module[_0x4698('0x0')]={'name':{'type':Sequelize[_0x4698('0x1')],'unique':_0x4698('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4698('0x1')]}}; \ No newline at end of file +var _0xb9e3=['sequelize','exports','name','STRING'];(function(_0x375325,_0x57a850){var _0x228f57=function(_0x2ad744){while(--_0x2ad744){_0x375325['push'](_0x375325['shift']());}};_0x228f57(++_0x57a850);}(_0xb9e3,0x64));var _0x3b9e=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xb9e3[_0x2235bf];return _0x4c3a64;};'use strict';var Sequelize=require(_0x3b9e('0x0'));module[_0x3b9e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3b9e('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3b9e('0x3')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 351f3f3..299a804 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 _0x9f4d=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','count','offset','limit','apply','save','then','destroy','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Variables','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','querystring'];(function(_0x4d82ea,_0x4d459f){var _0x257f4a=function(_0x424c4f){while(--_0x424c4f){_0x4d82ea['push'](_0x4d82ea['shift']());}};_0x257f4a(++_0x4d459f);}(_0x9f4d,0x8f));var _0xd9f4=function(_0xf39e84,_0x825c93){_0xf39e84=_0xf39e84-0x0;var _0x58e41f=_0x9f4d[_0xf39e84];return _0x58e41f;};'use strict';var pdf=require(_0xd9f4('0x0'));var emlformat=require(_0xd9f4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd9f4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9f4('0x3'));var moment=require(_0xd9f4('0x4'));var BPromise=require(_0xd9f4('0x5'));var Mustache=require(_0xd9f4('0x6'));var util=require(_0xd9f4('0x7'));var path=require(_0xd9f4('0x8'));var sox=require(_0xd9f4('0x9'));var csv=require('to-csv');var ejs=require(_0xd9f4('0xa'));var fs=require('fs');var _=require(_0xd9f4('0xb'));var squel=require('squel');var crypto=require(_0xd9f4('0xc'));var jsforce=require(_0xd9f4('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd9f4('0xe'));var Papa=require(_0xd9f4('0xf'));var Redis=require(_0xd9f4('0x10'));var authService=require(_0xd9f4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd9f4('0x12'));var hardwareService=require(_0xd9f4('0x13'));var logger=require(_0xd9f4('0x14'))(_0xd9f4('0x15'));var utils=require(_0xd9f4('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd9f4('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x874eda,_0x56ac21){_0x56ac21=_0x56ac21||0xcc;return function(_0x4f76d2){if(_0x4f76d2){return _0x874eda['sendStatus'](_0x56ac21);}return _0x874eda[_0xd9f4('0x18')](_0x56ac21)[_0xd9f4('0x19')]();};}function respondWithResult(_0x276cc9,_0x2db951){_0x2db951=_0x2db951||0xc8;return function(_0x46e6fd){if(_0x46e6fd){return _0x276cc9['status'](_0x2db951)[_0xd9f4('0x1a')](_0x46e6fd);}};}function respondWithFilteredResult(_0x1e1d20,_0x3b955b){return function(_0xfaa282){if(_0xfaa282){var _0x269f7d=_0xfaa282[_0xd9f4('0x1b')],_0x5c290b=_0x3b955b['offset'],_0x15ffae=_0x3b955b[_0xd9f4('0x1c')]+_0x3b955b[_0xd9f4('0x1d')],_0x1c9a84;if(_0x15ffae>=_0x269f7d){_0x15ffae=_0x269f7d;_0x1c9a84=0xc8;}else{_0x1c9a84=0xce;}_0x1e1d20[_0xd9f4('0x18')](_0x1c9a84);return _0x1e1d20['set']('Content-Range',_0x5c290b+'-'+_0x15ffae+'/'+_0x269f7d)[_0xd9f4('0x1a')](_0xfaa282);}return null;};}function patchUpdates(_0x38950b){return function(_0x5661b2){try{jsonpatch[_0xd9f4('0x1e')](_0x5661b2,_0x38950b,!![]);}catch(_0xa8add1){return BPromise['reject'](_0xa8add1);}return _0x5661b2[_0xd9f4('0x1f')]();};}function saveUpdates(_0x2cf3b0,_0x3756b5){return function(_0x4d45d0){if(_0x4d45d0){return _0x4d45d0['update'](_0x2cf3b0)[_0xd9f4('0x20')](function(_0x1084f2){return _0x1084f2;});}return null;};}function removeEntity(_0x246c0e,_0x5e3411){return function(_0xf2f308){if(_0xf2f308){return _0xf2f308['destroy']()['then'](function(){var _0x905eaa=_0xf2f308['get']({'plain':!![]});var _0x498b20='Variables';return db['UserProfileResource'][_0xd9f4('0x21')]({'where':{'type':_0x498b20,'resourceId':_0x905eaa['id']}})['then'](function(){return _0xf2f308;});})['then'](function(){_0x246c0e[_0xd9f4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x541997,_0x4ad58a){return function(_0x2fc749){if(!_0x2fc749){_0x541997['sendStatus'](0x194);}return _0x2fc749;};}function handleError(_0x2b81c5,_0x1d190b){_0x1d190b=_0x1d190b||0x1f4;return function(_0x343c36){logger[_0xd9f4('0x22')](_0x343c36[_0xd9f4('0x23')]);if(_0x343c36[_0xd9f4('0x24')]){delete _0x343c36[_0xd9f4('0x24')];}_0x2b81c5[_0xd9f4('0x18')](_0x1d190b)[_0xd9f4('0x25')](_0x343c36);};}exports[_0xd9f4('0x26')]=function(_0x3835fe,_0x985f27){var _0x1cd9c7={},_0x4e25ee={},_0x2e64b3={'count':0x0,'rows':[]};var _0x6fb7d=_[_0xd9f4('0x27')](db[_0xd9f4('0x28')][_0xd9f4('0x29')],function(_0x38590f){return{'name':_0x38590f[_0xd9f4('0x2a')],'type':_0x38590f['type'][_0xd9f4('0x2b')]};});_0x4e25ee[_0xd9f4('0x2c')]=_[_0xd9f4('0x27')](_0x6fb7d,_0xd9f4('0x24'));_0x4e25ee[_0xd9f4('0x2d')]=_['keys'](_0x3835fe[_0xd9f4('0x2d')]);_0x4e25ee[_0xd9f4('0x2e')]=_[_0xd9f4('0x2f')](_0x4e25ee[_0xd9f4('0x2c')],_0x4e25ee[_0xd9f4('0x2d')]);_0x1cd9c7['attributes']=_[_0xd9f4('0x2f')](_0x4e25ee[_0xd9f4('0x2c')],qs[_0xd9f4('0x30')](_0x3835fe['query']['fields']));_0x1cd9c7[_0xd9f4('0x31')]=_0x1cd9c7[_0xd9f4('0x31')][_0xd9f4('0x32')]?_0x1cd9c7[_0xd9f4('0x31')]:_0x4e25ee['model'];if(!_0x3835fe['query'][_0xd9f4('0x33')](_0xd9f4('0x34'))){_0x1cd9c7[_0xd9f4('0x1d')]=qs[_0xd9f4('0x1d')](_0x3835fe[_0xd9f4('0x2d')]['limit']);_0x1cd9c7['offset']=qs[_0xd9f4('0x1c')](_0x3835fe['query'][_0xd9f4('0x1c')]);}_0x1cd9c7[_0xd9f4('0x35')]=qs[_0xd9f4('0x36')](_0x3835fe[_0xd9f4('0x2d')]['sort']);_0x1cd9c7[_0xd9f4('0x37')]=qs[_0xd9f4('0x2e')](_[_0xd9f4('0x38')](_0x3835fe[_0xd9f4('0x2d')],_0x4e25ee[_0xd9f4('0x2e')]),_0x6fb7d);if(_0x3835fe[_0xd9f4('0x2d')][_0xd9f4('0x39')]){_0x1cd9c7['where']=_['merge'](_0x1cd9c7[_0xd9f4('0x37')],{'$or':_[_0xd9f4('0x27')](_0x6fb7d,function(_0x508d0f){if(_0x508d0f[_0xd9f4('0x3a')]!==_0xd9f4('0x3b')){var _0x486dec={};_0x486dec[_0x508d0f[_0xd9f4('0x24')]]={'$like':'%'+_0x3835fe[_0xd9f4('0x2d')]['filter']+'%'};return _0x486dec;}})});}_0x1cd9c7=_['merge']({},_0x1cd9c7,_0x3835fe[_0xd9f4('0x3c')]);var _0x471603={'where':_0x1cd9c7[_0xd9f4('0x37')]};return db[_0xd9f4('0x28')][_0xd9f4('0x1b')](_0x471603)['then'](function(_0x438b60){_0x2e64b3[_0xd9f4('0x1b')]=_0x438b60;if(_0x3835fe[_0xd9f4('0x2d')][_0xd9f4('0x3d')]){_0x1cd9c7['include']=[{'all':!![]}];}return db[_0xd9f4('0x28')][_0xd9f4('0x3e')](_0x1cd9c7);})[_0xd9f4('0x20')](function(_0x27769b){_0x2e64b3[_0xd9f4('0x3f')]=_0x27769b;return _0x2e64b3;})[_0xd9f4('0x20')](respondWithFilteredResult(_0x985f27,_0x1cd9c7))[_0xd9f4('0x40')](handleError(_0x985f27,null));};exports[_0xd9f4('0x41')]=function(_0x12f228,_0x567f47){var _0x39e32a={'raw':!![],'where':{'id':_0x12f228['params']['id']}},_0x5920cb={};_0x5920cb[_0xd9f4('0x2c')]=_['keys'](db['Variable'][_0xd9f4('0x29')]);_0x5920cb[_0xd9f4('0x2d')]=_[_0xd9f4('0x42')](_0x12f228[_0xd9f4('0x2d')]);_0x5920cb[_0xd9f4('0x2e')]=_[_0xd9f4('0x2f')](_0x5920cb[_0xd9f4('0x2c')],_0x5920cb[_0xd9f4('0x2d')]);_0x39e32a[_0xd9f4('0x31')]=_[_0xd9f4('0x2f')](_0x5920cb[_0xd9f4('0x2c')],qs['fields'](_0x12f228[_0xd9f4('0x2d')][_0xd9f4('0x30')]));_0x39e32a[_0xd9f4('0x31')]=_0x39e32a[_0xd9f4('0x31')][_0xd9f4('0x32')]?_0x39e32a['attributes']:_0x5920cb['model'];if(_0x12f228[_0xd9f4('0x2d')][_0xd9f4('0x3d')]){_0x39e32a['include']=[{'all':!![]}];}_0x39e32a=_[_0xd9f4('0x43')]({},_0x39e32a,_0x12f228[_0xd9f4('0x3c')]);return db[_0xd9f4('0x28')][_0xd9f4('0x44')](_0x39e32a)[_0xd9f4('0x20')](handleEntityNotFound(_0x567f47,null))[_0xd9f4('0x20')](respondWithResult(_0x567f47,null))['catch'](handleError(_0x567f47,null));};exports['create']=function(_0x4f59fd,_0x498d51){return db[_0xd9f4('0x28')][_0xd9f4('0x45')](_0x4f59fd[_0xd9f4('0x46')],{})['then'](function(_0x4e48d4){var _0x1ff885=_0x4f59fd[_0xd9f4('0x47')][_0xd9f4('0x48')]({'plain':!![]});if(!_0x1ff885)throw new Error(_0xd9f4('0x49'));if(_0x1ff885['role']===_0xd9f4('0x47')){var _0x1cb65b=_0x4e48d4[_0xd9f4('0x48')]({'plain':!![]});var _0x48e4be=_0xd9f4('0x4a');return db[_0xd9f4('0x4b')][_0xd9f4('0x44')]({'where':{'name':_0x48e4be,'userProfileId':_0x1ff885[_0xd9f4('0x4c')]},'raw':!![]})[_0xd9f4('0x20')](function(_0x364017){if(_0x364017&&_0x364017[_0xd9f4('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x1cb65b['name'],'resourceId':_0x1cb65b['id'],'type':_0x364017[_0xd9f4('0x24')],'sectionId':_0x364017['id']},{})[_0xd9f4('0x20')](function(){return _0x4e48d4;});}else{return _0x4e48d4;}})[_0xd9f4('0x40')](function(_0x2f50a3){logger[_0xd9f4('0x22')](_0xd9f4('0x4e'),_0x2f50a3);throw _0x2f50a3;});}return _0x4e48d4;})[_0xd9f4('0x20')](respondWithResult(_0x498d51,0xc9))['catch'](handleError(_0x498d51,null));};exports['update']=function(_0x5678b6,_0x5f0b94){if(_0x5678b6[_0xd9f4('0x46')]['id']){delete _0x5678b6[_0xd9f4('0x46')]['id'];}return db['Variable']['find']({'where':{'id':_0x5678b6['params']['id']}})[_0xd9f4('0x20')](handleEntityNotFound(_0x5f0b94,null))[_0xd9f4('0x20')](saveUpdates(_0x5678b6[_0xd9f4('0x46')],null))[_0xd9f4('0x20')](respondWithResult(_0x5f0b94,null))[_0xd9f4('0x40')](handleError(_0x5f0b94,null));};exports[_0xd9f4('0x21')]=function(_0x535f94,_0x200087){return db[_0xd9f4('0x28')]['find']({'where':{'id':_0x535f94['params']['id']}})[_0xd9f4('0x20')](handleEntityNotFound(_0x200087,null))['then'](removeEntity(_0x200087,null))[_0xd9f4('0x40')](handleError(_0x200087,null));}; \ No newline at end of file +var _0xcebc=['name','send','index','map','Variable','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','type','merge','count','includeAll','include','rows','catch','params','keys','length','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Variables','error','stack'];(function(_0x4ad553,_0x586c5a){var _0x136750=function(_0x11dfbc){while(--_0x11dfbc){_0x4ad553['push'](_0x4ad553['shift']());}};_0x136750(++_0x586c5a);}(_0xcebc,0x1d1));var _0xcceb=function(_0x120b14,_0x4da3a6){_0x120b14=_0x120b14-0x0;var _0x286418=_0xcebc[_0x120b14];return _0x286418;};'use strict';var pdf=require(_0xcceb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xcceb('0x1'));var zipdir=require(_0xcceb('0x2'));var jsonpatch=require(_0xcceb('0x3'));var rp=require(_0xcceb('0x4'));var moment=require(_0xcceb('0x5'));var BPromise=require(_0xcceb('0x6'));var Mustache=require(_0xcceb('0x7'));var util=require(_0xcceb('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xcceb('0x9'));var ejs=require(_0xcceb('0xa'));var fs=require('fs');var _=require(_0xcceb('0xb'));var squel=require(_0xcceb('0xc'));var crypto=require('crypto');var jsforce=require(_0xcceb('0xd'));var deskjs=require(_0xcceb('0xe'));var toCsv=require(_0xcceb('0x9'));var querystring=require(_0xcceb('0xf'));var Papa=require(_0xcceb('0x10'));var Redis=require(_0xcceb('0x11'));var authService=require(_0xcceb('0x12'));var qs=require(_0xcceb('0x13'));var as=require(_0xcceb('0x14'));var hardwareService=require(_0xcceb('0x15'));var logger=require(_0xcceb('0x16'))(_0xcceb('0x17'));var utils=require(_0xcceb('0x18'));var config=require(_0xcceb('0x19'));var licenseUtil=require(_0xcceb('0x1a'));var db=require(_0xcceb('0x1b'))['db'];function respondWithStatusCode(_0x3df342,_0x3559a9){_0x3559a9=_0x3559a9||0xcc;return function(_0x1aaa58){if(_0x1aaa58){return _0x3df342[_0xcceb('0x1c')](_0x3559a9);}return _0x3df342[_0xcceb('0x1d')](_0x3559a9)[_0xcceb('0x1e')]();};}function respondWithResult(_0x109501,_0xd2e1c2){_0xd2e1c2=_0xd2e1c2||0xc8;return function(_0x31bfa8){if(_0x31bfa8){return _0x109501['status'](_0xd2e1c2)[_0xcceb('0x1f')](_0x31bfa8);}};}function respondWithFilteredResult(_0x51d29d,_0x1304c3){return function(_0x122e7d){if(_0x122e7d){var _0x35c3ed=_0x122e7d['count'],_0x1beea5=_0x1304c3['offset'],_0x26c12d=_0x1304c3[_0xcceb('0x20')]+_0x1304c3[_0xcceb('0x21')],_0x24bb2b;if(_0x26c12d>=_0x35c3ed){_0x26c12d=_0x35c3ed;_0x24bb2b=0xc8;}else{_0x24bb2b=0xce;}_0x51d29d[_0xcceb('0x1d')](_0x24bb2b);return _0x51d29d[_0xcceb('0x22')](_0xcceb('0x23'),_0x1beea5+'-'+_0x26c12d+'/'+_0x35c3ed)[_0xcceb('0x1f')](_0x122e7d);}return null;};}function patchUpdates(_0x111ac3){return function(_0x31f2e7){try{jsonpatch[_0xcceb('0x24')](_0x31f2e7,_0x111ac3,!![]);}catch(_0x581d47){return BPromise[_0xcceb('0x25')](_0x581d47);}return _0x31f2e7[_0xcceb('0x26')]();};}function saveUpdates(_0xfe68f8,_0x41d7d2){return function(_0x309f51){if(_0x309f51){return _0x309f51[_0xcceb('0x27')](_0xfe68f8)[_0xcceb('0x28')](function(_0x32c1e1){return _0x32c1e1;});}return null;};}function removeEntity(_0x42d2c1,_0x43cd39){return function(_0x31dae5){if(_0x31dae5){return _0x31dae5[_0xcceb('0x29')]()[_0xcceb('0x28')](function(){var _0xff91ed=_0x31dae5['get']({'plain':!![]});var _0x15f656=_0xcceb('0x2a');return db['UserProfileResource'][_0xcceb('0x29')]({'where':{'type':_0x15f656,'resourceId':_0xff91ed['id']}})[_0xcceb('0x28')](function(){return _0x31dae5;});})['then'](function(){_0x42d2c1['status'](0xcc)[_0xcceb('0x1e')]();});}};}function handleEntityNotFound(_0x2cb236,_0xe7ec10){return function(_0x47cbf7){if(!_0x47cbf7){_0x2cb236[_0xcceb('0x1c')](0x194);}return _0x47cbf7;};}function handleError(_0x320bed,_0x4bc61f){_0x4bc61f=_0x4bc61f||0x1f4;return function(_0x3cd0d1){logger[_0xcceb('0x2b')](_0x3cd0d1[_0xcceb('0x2c')]);if(_0x3cd0d1['name']){delete _0x3cd0d1[_0xcceb('0x2d')];}_0x320bed[_0xcceb('0x1d')](_0x4bc61f)[_0xcceb('0x2e')](_0x3cd0d1);};}exports[_0xcceb('0x2f')]=function(_0x1ce5a1,_0x27b222){var _0x589f0f={},_0x373df8={},_0x18dd8e={'count':0x0,'rows':[]};var _0x217f4c=_[_0xcceb('0x30')](db[_0xcceb('0x31')][_0xcceb('0x32')],function(_0x3eb073){return{'name':_0x3eb073[_0xcceb('0x33')],'type':_0x3eb073['type'][_0xcceb('0x34')]};});_0x373df8[_0xcceb('0x35')]=_[_0xcceb('0x30')](_0x217f4c,'name');_0x373df8[_0xcceb('0x36')]=_['keys'](_0x1ce5a1['query']);_0x373df8[_0xcceb('0x37')]=_[_0xcceb('0x38')](_0x373df8[_0xcceb('0x35')],_0x373df8[_0xcceb('0x36')]);_0x589f0f[_0xcceb('0x39')]=_[_0xcceb('0x38')](_0x373df8[_0xcceb('0x35')],qs[_0xcceb('0x3a')](_0x1ce5a1['query'][_0xcceb('0x3a')]));_0x589f0f[_0xcceb('0x39')]=_0x589f0f[_0xcceb('0x39')]['length']?_0x589f0f[_0xcceb('0x39')]:_0x373df8[_0xcceb('0x35')];if(!_0x1ce5a1[_0xcceb('0x36')][_0xcceb('0x3b')]('nolimit')){_0x589f0f[_0xcceb('0x21')]=qs[_0xcceb('0x21')](_0x1ce5a1[_0xcceb('0x36')]['limit']);_0x589f0f[_0xcceb('0x20')]=qs[_0xcceb('0x20')](_0x1ce5a1[_0xcceb('0x36')][_0xcceb('0x20')]);}_0x589f0f[_0xcceb('0x3c')]=qs[_0xcceb('0x3d')](_0x1ce5a1[_0xcceb('0x36')][_0xcceb('0x3d')]);_0x589f0f[_0xcceb('0x3e')]=qs['filters'](_['pick'](_0x1ce5a1[_0xcceb('0x36')],_0x373df8['filters']),_0x217f4c);if(_0x1ce5a1[_0xcceb('0x36')]['filter']){_0x589f0f['where']=_['merge'](_0x589f0f[_0xcceb('0x3e')],{'$or':_[_0xcceb('0x30')](_0x217f4c,function(_0x453725){if(_0x453725[_0xcceb('0x3f')]!=='VIRTUAL'){var _0x2681fb={};_0x2681fb[_0x453725[_0xcceb('0x2d')]]={'$like':'%'+_0x1ce5a1[_0xcceb('0x36')]['filter']+'%'};return _0x2681fb;}})});}_0x589f0f=_[_0xcceb('0x40')]({},_0x589f0f,_0x1ce5a1['options']);var _0x66f49={'where':_0x589f0f[_0xcceb('0x3e')]};return db['Variable'][_0xcceb('0x41')](_0x66f49)[_0xcceb('0x28')](function(_0x590809){_0x18dd8e[_0xcceb('0x41')]=_0x590809;if(_0x1ce5a1[_0xcceb('0x36')][_0xcceb('0x42')]){_0x589f0f[_0xcceb('0x43')]=[{'all':!![]}];}return db[_0xcceb('0x31')]['findAll'](_0x589f0f);})[_0xcceb('0x28')](function(_0x14041c){_0x18dd8e[_0xcceb('0x44')]=_0x14041c;return _0x18dd8e;})[_0xcceb('0x28')](respondWithFilteredResult(_0x27b222,_0x589f0f))[_0xcceb('0x45')](handleError(_0x27b222,null));};exports['show']=function(_0x3fb360,_0xd6d478){var _0x22eca8={'raw':!![],'where':{'id':_0x3fb360[_0xcceb('0x46')]['id']}},_0x596d47={};_0x596d47[_0xcceb('0x35')]=_[_0xcceb('0x47')](db[_0xcceb('0x31')][_0xcceb('0x32')]);_0x596d47['query']=_[_0xcceb('0x47')](_0x3fb360[_0xcceb('0x36')]);_0x596d47['filters']=_[_0xcceb('0x38')](_0x596d47[_0xcceb('0x35')],_0x596d47['query']);_0x22eca8[_0xcceb('0x39')]=_[_0xcceb('0x38')](_0x596d47[_0xcceb('0x35')],qs[_0xcceb('0x3a')](_0x3fb360[_0xcceb('0x36')][_0xcceb('0x3a')]));_0x22eca8[_0xcceb('0x39')]=_0x22eca8[_0xcceb('0x39')][_0xcceb('0x48')]?_0x22eca8[_0xcceb('0x39')]:_0x596d47[_0xcceb('0x35')];if(_0x3fb360[_0xcceb('0x36')][_0xcceb('0x42')]){_0x22eca8['include']=[{'all':!![]}];}_0x22eca8=_[_0xcceb('0x40')]({},_0x22eca8,_0x3fb360[_0xcceb('0x49')]);return db[_0xcceb('0x31')][_0xcceb('0x4a')](_0x22eca8)['then'](handleEntityNotFound(_0xd6d478,null))[_0xcceb('0x28')](respondWithResult(_0xd6d478,null))[_0xcceb('0x45')](handleError(_0xd6d478,null));};exports[_0xcceb('0x4b')]=function(_0x28f2fc,_0x455793){return db['Variable'][_0xcceb('0x4b')](_0x28f2fc[_0xcceb('0x4c')],{})[_0xcceb('0x28')](function(_0x460b1c){var _0x4c235f=_0x28f2fc[_0xcceb('0x4d')][_0xcceb('0x4e')]({'plain':!![]});if(!_0x4c235f)throw new Error(_0xcceb('0x4f'));if(_0x4c235f[_0xcceb('0x50')]==='user'){var _0x5e0c24=_0x460b1c['get']({'plain':!![]});var _0x299be4=_0xcceb('0x2a');return db[_0xcceb('0x51')]['find']({'where':{'name':_0x299be4,'userProfileId':_0x4c235f[_0xcceb('0x52')]},'raw':!![]})[_0xcceb('0x28')](function(_0x4c98cc){if(_0x4c98cc&&_0x4c98cc[_0xcceb('0x53')]===0x0){return db[_0xcceb('0x54')][_0xcceb('0x4b')]({'name':_0x5e0c24['name'],'resourceId':_0x5e0c24['id'],'type':_0x4c98cc['name'],'sectionId':_0x4c98cc['id']},{})['then'](function(){return _0x460b1c;});}else{return _0x460b1c;}})[_0xcceb('0x45')](function(_0x4de426){logger[_0xcceb('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4de426);throw _0x4de426;});}return _0x460b1c;})[_0xcceb('0x28')](respondWithResult(_0x455793,0xc9))[_0xcceb('0x45')](handleError(_0x455793,null));};exports['update']=function(_0x49952c,_0x5dfe1d){if(_0x49952c[_0xcceb('0x4c')]['id']){delete _0x49952c[_0xcceb('0x4c')]['id'];}return db[_0xcceb('0x31')][_0xcceb('0x4a')]({'where':{'id':_0x49952c[_0xcceb('0x46')]['id']}})[_0xcceb('0x28')](handleEntityNotFound(_0x5dfe1d,null))[_0xcceb('0x28')](saveUpdates(_0x49952c['body'],null))['then'](respondWithResult(_0x5dfe1d,null))[_0xcceb('0x45')](handleError(_0x5dfe1d,null));};exports[_0xcceb('0x29')]=function(_0x1eee08,_0x23b6f5){return db[_0xcceb('0x31')][_0xcceb('0x4a')]({'where':{'id':_0x1eee08[_0xcceb('0x46')]['id']}})[_0xcceb('0x28')](handleEntityNotFound(_0x23b6f5,null))[_0xcceb('0x28')](removeEntity(_0x23b6f5,null))[_0xcceb('0x45')](handleError(_0x23b6f5,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 6d7b7c1..b3e2058 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 _0x3715=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','tools_variables','lodash'];(function(_0x1aa306,_0x229e04){var _0x48d654=function(_0x281188){while(--_0x281188){_0x1aa306['push'](_0x1aa306['shift']());}};_0x48d654(++_0x229e04);}(_0x3715,0xc3));var _0x5371=function(_0x5120ca,_0xcda9aa){_0x5120ca=_0x5120ca-0x0;var _0x59c330=_0x3715[_0x5120ca];return _0x59c330;};'use strict';var _=require(_0x5371('0x0'));var util=require(_0x5371('0x1'));var logger=require(_0x5371('0x2'))(_0x5371('0x3'));var moment=require(_0x5371('0x4'));var BPromise=require(_0x5371('0x5'));var rp=require(_0x5371('0x6'));var fs=require('fs');var path=require(_0x5371('0x7'));var rimraf=require(_0x5371('0x8'));var config=require(_0x5371('0x9'));var attributes=require(_0x5371('0xa'));module[_0x5371('0xb')]=function(_0x50a759,_0x1ffdcb){return _0x50a759[_0x5371('0xc')]('Variable',attributes,{'tableName':_0x5371('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe062=['moment','bluebird','rimraf','../../config/environment','tools_variables','lodash','util','api'];(function(_0x1a035b,_0x29c1ec){var _0x7e7167=function(_0x635ef6){while(--_0x635ef6){_0x1a035b['push'](_0x1a035b['shift']());}};_0x7e7167(++_0x29c1ec);}(_0xe062,0xd5));var _0x2e06=function(_0x36acdb,_0x8fa2e6){_0x36acdb=_0x36acdb-0x0;var _0x593989=_0xe062[_0x36acdb];return _0x593989;};'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 diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index ba1e3f0..8ed9334 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 _0xb9bf=['message','catch','ShowVariable','Variable','find','options','where','attributes','include','map','model','debug','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb9bf,0x139));var _0xfb9b=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0xb9bf[_0x3c8e9a];return _0x2d4c57;};'use strict';var _=require(_0xfb9b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfb9b('0x1'));var rs=require(_0xfb9b('0x2'));var fs=require('fs');var Redis=require(_0xfb9b('0x3'));var db=require(_0xfb9b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfb9b('0x5'))(_0xfb9b('0x6'));var config=require(_0xfb9b('0x7'));var jayson=require(_0xfb9b('0x8'));var client=jayson['client'][_0xfb9b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x81b944,_0xad93b6,_0x2ce655){return new BPromise(function(_0x1b0382,_0x275164){return client[_0xfb9b('0xa')](_0x81b944,_0x2ce655)[_0xfb9b('0xb')](function(_0x276a30){logger[_0xfb9b('0xc')](_0xfb9b('0xd'),_0xad93b6,_0xfb9b('0xe'));logger['debug']('Variable,\x20%s,\x20%s,\x20%s',_0xad93b6,'request\x20sent',JSON['stringify'](_0x276a30));if(_0x276a30[_0xfb9b('0xf')]){if(_0x276a30[_0xfb9b('0xf')][_0xfb9b('0x10')]===0x1f4){logger[_0xfb9b('0xf')](_0xfb9b('0xd'),_0xad93b6,_0x276a30[_0xfb9b('0xf')][_0xfb9b('0x11')]);return _0x275164(_0x276a30['error'][_0xfb9b('0x11')]);}logger[_0xfb9b('0xf')](_0xfb9b('0xd'),_0xad93b6,_0x276a30[_0xfb9b('0xf')][_0xfb9b('0x11')]);return _0x1b0382(_0x276a30[_0xfb9b('0xf')][_0xfb9b('0x11')]);}else{logger[_0xfb9b('0xc')]('Variable,\x20%s,\x20%s',_0xad93b6,_0xfb9b('0xe'));_0x1b0382(_0x276a30['result'][_0xfb9b('0x11')]);}})[_0xfb9b('0x12')](function(_0x20fe5b){logger[_0xfb9b('0xf')](_0xfb9b('0xd'),_0xad93b6,_0x20fe5b);_0x275164(_0x20fe5b);});});}exports[_0xfb9b('0x13')]=function(_0x8adafa){var _0x4d082c=this;return new Promise(function(_0x2df2c6,_0xf81634){return db[_0xfb9b('0x14')][_0xfb9b('0x15')]({'raw':_0x8adafa[_0xfb9b('0x16')]?_0x8adafa[_0xfb9b('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x8adafa[_0xfb9b('0x16')]?_0x8adafa['options'][_0xfb9b('0x17')]||null:null,'attributes':_0x8adafa[_0xfb9b('0x16')]?_0x8adafa[_0xfb9b('0x16')][_0xfb9b('0x18')]||null:null,'include':_0x8adafa[_0xfb9b('0x16')]?_0x8adafa[_0xfb9b('0x16')][_0xfb9b('0x19')]?_[_0xfb9b('0x1a')](_0x8adafa[_0xfb9b('0x16')]['include'],function(_0x4ec56){return{'model':db[_0x4ec56['model']],'as':_0x4ec56['as'],'attributes':_0x4ec56[_0xfb9b('0x18')],'include':_0x4ec56[_0xfb9b('0x19')]?_[_0xfb9b('0x1a')](_0x4ec56[_0xfb9b('0x19')],function(_0x89c9d){return{'model':db[_0x89c9d[_0xfb9b('0x1b')]],'as':_0x89c9d['as'],'attributes':_0x89c9d[_0xfb9b('0x18')],'include':_0x89c9d[_0xfb9b('0x19')]?_[_0xfb9b('0x1a')](_0x89c9d[_0xfb9b('0x19')],function(_0x516a24){return{'model':db[_0x516a24[_0xfb9b('0x1b')]],'as':_0x516a24['as'],'attributes':_0x516a24[_0xfb9b('0x18')]};}):[]};}):[]};}):[]:[]})[_0xfb9b('0xb')](function(_0x3e86a1){logger[_0xfb9b('0xc')](_0xfb9b('0x13'),_0x8adafa);logger[_0xfb9b('0x1c')]('ShowVariable',_0x8adafa,JSON[_0xfb9b('0x1d')](_0x3e86a1));_0x2df2c6(_0x3e86a1);})['catch'](function(_0x12a963){logger[_0xfb9b('0xf')](_0xfb9b('0x13'),_0x12a963[_0xfb9b('0x11')],_0x8adafa);_0xf81634(_0x4d082c['error'](0x1f4,_0x12a963[_0xfb9b('0x11')]));});});}; \ No newline at end of file +var _0x77f4=['info','result','ShowVariable','find','options','attributes','include','model','map','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xb817f5,_0x5a46c3){var _0x980b9c=function(_0x4d7fb8){while(--_0x4d7fb8){_0xb817f5['push'](_0xb817f5['shift']());}};_0x980b9c(++_0x5a46c3);}(_0x77f4,0x1cc));var _0x477f=function(_0x345f9c,_0x5753bf){_0x345f9c=_0x345f9c-0x0;var _0x689d74=_0x77f4[_0x345f9c];return _0x689d74;};'use strict';var _=require('lodash');var util=require(_0x477f('0x0'));var moment=require(_0x477f('0x1'));var BPromise=require(_0x477f('0x2'));var rs=require(_0x477f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x477f('0x4'))['db'];var utils=require(_0x477f('0x5'));var logger=require(_0x477f('0x6'))('rpc');var config=require(_0x477f('0x7'));var jayson=require(_0x477f('0x8'));var client=jayson[_0x477f('0x9')][_0x477f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4409a7,_0x368334,_0x117bd2){return new BPromise(function(_0x3eee75,_0x33a5a0){return client['request'](_0x4409a7,_0x117bd2)[_0x477f('0xb')](function(_0x49e83c){logger['info'](_0x477f('0xc'),_0x368334,_0x477f('0xd'));logger[_0x477f('0xe')](_0x477f('0xf'),_0x368334,_0x477f('0xd'),JSON[_0x477f('0x10')](_0x49e83c));if(_0x49e83c['error']){if(_0x49e83c[_0x477f('0x11')][_0x477f('0x12')]===0x1f4){logger[_0x477f('0x11')]('Variable,\x20%s,\x20%s',_0x368334,_0x49e83c[_0x477f('0x11')]['message']);return _0x33a5a0(_0x49e83c[_0x477f('0x11')][_0x477f('0x13')]);}logger[_0x477f('0x11')]('Variable,\x20%s,\x20%s',_0x368334,_0x49e83c[_0x477f('0x11')]['message']);return _0x3eee75(_0x49e83c[_0x477f('0x11')][_0x477f('0x13')]);}else{logger[_0x477f('0x14')](_0x477f('0xc'),_0x368334,'request\x20sent');_0x3eee75(_0x49e83c[_0x477f('0x15')][_0x477f('0x13')]);}})['catch'](function(_0x2751dc){logger[_0x477f('0x11')](_0x477f('0xc'),_0x368334,_0x2751dc);_0x33a5a0(_0x2751dc);});});}exports[_0x477f('0x16')]=function(_0x369fa4){var _0x41f72c=this;return new Promise(function(_0x2b80e6,_0x11404c){return db['Variable'][_0x477f('0x17')]({'raw':_0x369fa4[_0x477f('0x18')]?_0x369fa4[_0x477f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x369fa4['options']?_0x369fa4[_0x477f('0x18')]['where']||null:null,'attributes':_0x369fa4[_0x477f('0x18')]?_0x369fa4['options'][_0x477f('0x19')]||null:null,'include':_0x369fa4[_0x477f('0x18')]?_0x369fa4[_0x477f('0x18')]['include']?_['map'](_0x369fa4[_0x477f('0x18')][_0x477f('0x1a')],function(_0x2c2385){return{'model':db[_0x2c2385[_0x477f('0x1b')]],'as':_0x2c2385['as'],'attributes':_0x2c2385[_0x477f('0x19')],'include':_0x2c2385[_0x477f('0x1a')]?_[_0x477f('0x1c')](_0x2c2385[_0x477f('0x1a')],function(_0x516a23){return{'model':db[_0x516a23[_0x477f('0x1b')]],'as':_0x516a23['as'],'attributes':_0x516a23[_0x477f('0x19')],'include':_0x516a23[_0x477f('0x1a')]?_[_0x477f('0x1c')](_0x516a23[_0x477f('0x1a')],function(_0x4cc43c){return{'model':db[_0x4cc43c[_0x477f('0x1b')]],'as':_0x4cc43c['as'],'attributes':_0x4cc43c[_0x477f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x477f('0xb')](function(_0x2ec450){logger[_0x477f('0x14')](_0x477f('0x16'),_0x369fa4);logger[_0x477f('0xe')](_0x477f('0x16'),_0x369fa4,JSON['stringify'](_0x2ec450));_0x2b80e6(_0x2ec450);})[_0x477f('0x1d')](function(_0x3457a7){logger[_0x477f('0x11')](_0x477f('0x16'),_0x3457a7['message'],_0x369fa4);_0x11404c(_0x41f72c['error'](0x1f4,_0x3457a7[_0x477f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 32f8301..229ec76 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 _0x6475=['Router','../../components/auth/service','get','index','isAuthenticated','canUpdate','fetch','/reset','/pull','/restart','restart','/migrations','migrations','express'];(function(_0xf48f4a,_0x141b39){var _0x11642e=function(_0x52eb2e){while(--_0x52eb2e){_0xf48f4a['push'](_0xf48f4a['shift']());}};_0x11642e(++_0x141b39);}(_0x6475,0x133));var _0x5647=function(_0xb2454d,_0x291753){_0xb2454d=_0xb2454d-0x0;var _0x5464fb=_0x6475[_0xb2454d];return _0x5464fb;};'use strict';var express=require(_0x5647('0x0'));var router=express[_0x5647('0x1')]();var auth=require(_0x5647('0x2'));var controller=require('./version.controller');router[_0x5647('0x3')]('/',controller[_0x5647('0x4')]);router[_0x5647('0x3')]('/fetch',auth[_0x5647('0x5')](),auth[_0x5647('0x6')](),controller[_0x5647('0x7')]);router['get'](_0x5647('0x8'),auth[_0x5647('0x5')](),auth['canUpdate'](),controller['reset']);router['get'](_0x5647('0x9'),auth[_0x5647('0x5')](),auth[_0x5647('0x6')](),controller['pull']);router['get'](_0x5647('0xa'),auth[_0x5647('0x5')](),controller[_0x5647('0xb')]);router[_0x5647('0x3')](_0x5647('0xc'),controller[_0x5647('0xd')]);module['exports']=router; \ No newline at end of file +var _0xb95a=['index','/fetch','isAuthenticated','canUpdate','fetch','reset','/pull','pull','restart','/migrations','exports','express','Router','../../components/auth/service','./version.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb95a,0x13b));var _0xab95=function(_0x37e1c6,_0x26c77b){_0x37e1c6=_0x37e1c6-0x0;var _0x3f0ee6=_0xb95a[_0x37e1c6];return _0x3f0ee6;};'use strict';var express=require(_0xab95('0x0'));var router=express[_0xab95('0x1')]();var auth=require(_0xab95('0x2'));var controller=require(_0xab95('0x3'));router[_0xab95('0x4')]('/',controller[_0xab95('0x5')]);router[_0xab95('0x4')](_0xab95('0x6'),auth[_0xab95('0x7')](),auth[_0xab95('0x8')](),controller[_0xab95('0x9')]);router[_0xab95('0x4')]('/reset',auth[_0xab95('0x7')](),auth[_0xab95('0x8')](),controller[_0xab95('0xa')]);router['get'](_0xab95('0xb'),auth[_0xab95('0x7')](),auth[_0xab95('0x8')](),controller[_0xab95('0xc')]);router[_0xab95('0x4')]('/restart',auth['isAuthenticated'](),controller[_0xab95('0xd')]);router[_0xab95('0x4')](_0xab95('0xe'),controller['migrations']);module[_0xab95('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 12f6995..099c5c0 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 _0x1fa9=['../../config/logger','update','root','index','exports','query','latest','fetch','2.0.0','status','origin','master','error','json','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','replace','push','sort','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','lodash','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2'];(function(_0x2b2f8a,_0x19cdb4){var _0x52d1c7=function(_0x5d8cb7){while(--_0x5d8cb7){_0x2b2f8a['push'](_0x2b2f8a['shift']());}};_0x52d1c7(++_0x19cdb4);}(_0x1fa9,0x136));var _0x91fa=function(_0x1f69de,_0x22aac1){_0x1f69de=_0x1f69de-0x0;var _0x4364b1=_0x1fa9[_0x1f69de];return _0x4364b1;};'use strict';var Umzug=require(_0x91fa('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x91fa('0x1'));var pkginfo=require('pkginfo')(module,_0x91fa('0x2'));var compareVersions=require(_0x91fa('0x3'));var exec=require(_0x91fa('0x4'))['exec'];var db=require(_0x91fa('0x5'))['db'];var config=require(_0x91fa('0x6'));var pm2=require(_0x91fa('0x7'));var logger=require(_0x91fa('0x8'))(_0x91fa('0x9'));var git=require('simple-git')(config[_0x91fa('0xa')]);exports[_0x91fa('0xb')]=function(_0x483dde,_0x5e30a6){var _0xb4a51f={'current':module[_0x91fa('0xc')][_0x91fa('0x2')],'phonebar':0x2};if(_0x483dde[_0x91fa('0xd')]&&_0x483dde[_0x91fa('0xd')][_0x91fa('0xe')]){return git[_0x91fa('0xf')]()['tags'](function(_0x544f1c,_0xfda31c){_0xb4a51f[_0x91fa('0xe')]=(_0x544f1c?module[_0x91fa('0xc')][_0x91fa('0x2')]:_0xfda31c[_0x91fa('0xe')])||_0x91fa('0x10');return _0x5e30a6[_0x91fa('0x11')](0xc8)['json'](_0xb4a51f);});}else{return _0x5e30a6['status'](0xc8)['json'](_0xb4a51f);}};exports[_0x91fa('0xf')]=function(_0x4ebf24,_0x5f215d){return git[_0x91fa('0xf')]([_0x91fa('0x12'),_0x91fa('0x13')],function(_0x5449a7){if(_0x5449a7){logger[_0x91fa('0x14')](_0x5449a7);return _0x5f215d[_0x91fa('0x11')](0x1f4)[_0x91fa('0x15')](_0x5449a7);}logger[_0x91fa('0x16')](_0x91fa('0x17'));return _0x5f215d[_0x91fa('0x11')](0xc8)['json']({'output':_0x91fa('0x18')});});};exports[_0x91fa('0x19')]=function(_0x2efa2a,_0x3916cc){return git[_0x91fa('0x19')](['--hard',_0x91fa('0x1a')],function(_0x433cf5){if(_0x433cf5){logger[_0x91fa('0x14')](_0x433cf5);return _0x3916cc[_0x91fa('0x11')](0x1f4)[_0x91fa('0x15')](_0x433cf5);}logger[_0x91fa('0x16')](_0x91fa('0x1b'));return _0x3916cc[_0x91fa('0x11')](0xc8)[_0x91fa('0x15')]({'output':_0x91fa('0x1c')});});};exports[_0x91fa('0x1d')]=function(_0x4a8f08,_0x46433d){exec(_0x91fa('0x1e'),function(_0x4ac68d,_0x1a6480,_0x50596c){logger[_0x91fa('0x16')](_0x1a6480);logger['info'](_0x50596c);if(_0x4ac68d){logger['error'](_0x4ac68d);return _0x46433d['status'](0x1f4)[_0x91fa('0x15')](_0x4ac68d);}return _0x46433d[_0x91fa('0x11')](0xc8)[_0x91fa('0x15')]({'output':_0x1a6480});});};exports[_0x91fa('0x1f')]=function(_0x1fd482,_0x5df647){return pm2[_0x91fa('0x1f')](_0x91fa('0x20'))[_0x91fa('0x21')](function(_0x1d2019){logger['info']('pm2\x20restart\x20motion\x20%s',_0x1d2019);return _0x5df647[_0x91fa('0x11')](0xc8)[_0x91fa('0x15')]({'output':_0x91fa('0x22')});})[_0x91fa('0x23')](function(_0x1224ef){logger['error'](_0x1224ef);return _0x5df647[_0x91fa('0x11')](0x1f4)[_0x91fa('0x15')](_0x1224ef);});};exports[_0x91fa('0x24')]=function(_0x5601c4,_0x518cae){var _0x342670=fs[_0x91fa('0x25')](path[_0x91fa('0x26')](config[_0x91fa('0xa')],_0x91fa('0x27'),_0x91fa('0x24')));var _0x27ed0e=[];for(var _0x33198a=0x0;_0x33198a<_0x342670[_0x91fa('0x28')];_0x33198a++){var _0x1ebc7c=_0x342670[_0x33198a][_0x91fa('0x29')]('.js','');if(compareVersions(module['exports'][_0x91fa('0x2')],_0x1ebc7c)===-0x1){_0x27ed0e[_0x91fa('0x2a')](_0x1ebc7c);}}if(_0x27ed0e[_0x91fa('0x28')]){var _0x432fd1=_0x27ed0e[_0x91fa('0x2b')](compareVersions);var _0x35a704=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x91fa('0x2c')],'modelName':_0x91fa('0x2c'),'columnName':_0x91fa('0x2')},'migrations':{'params':[db[_0x91fa('0x2d')][_0x91fa('0x2e')](),db[_0x91fa('0x2d')][_0x91fa('0x2f')],function(){throw new Error(_0x91fa('0x30'));}],'path':path['join'](config['root'],_0x91fa('0x27'),_0x91fa('0x24')),'pattern':/\.js$/}});_0x35a704['up']({'migrations':_['map'](_0x432fd1,function(_0x5057c9){return _0x5057c9+'.js';})})['then'](function(){return _0x518cae[_0x91fa('0x11')](0xc8)[_0x91fa('0x15')]({'output':_0x91fa('0x31')+module['exports'][_0x91fa('0x2')]+_0x91fa('0x32')+_[_0x91fa('0x33')](_0x432fd1),'migrations':_[_0x91fa('0x26')](_0x432fd1)});})[_0x91fa('0x23')](function(_0x421aaf){if(_0x421aaf instanceof db[_0x91fa('0x2d')]['UniqueConstraintError']){return _0x518cae[_0x91fa('0x11')](0xc8)[_0x91fa('0x15')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x518cae['status'](0x1f4)[_0x91fa('0x15')](_0x421aaf);}});}else{return _0x518cae[_0x91fa('0x11')](0xc8)['json']({'output':_0x91fa('0x34')});}}; \ No newline at end of file +var _0x8814=['fetch','origin','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','error','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server','migrations','length','replace','.js','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git','index','exports','version','query','latest','tags','2.0.0','status','json'];(function(_0x1a014b,_0x48acae){var _0x462258=function(_0x1473be){while(--_0x1473be){_0x1a014b['push'](_0x1a014b['shift']());}};_0x462258(++_0x48acae);}(_0x8814,0x1b8));var _0x4881=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x8814[_0xda464c];return _0x19e222;};'use strict';var Umzug=require(_0x4881('0x0'));var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x4881('0x1'))(module,'version');var compareVersions=require(_0x4881('0x2'));var exec=require(_0x4881('0x3'))[_0x4881('0x4')];var db=require(_0x4881('0x5'))['db'];var config=require('../../config/environment');var pm2=require(_0x4881('0x6'));var logger=require(_0x4881('0x7'))(_0x4881('0x8'));var git=require(_0x4881('0x9'))(config['root']);exports[_0x4881('0xa')]=function(_0x505b8a,_0x23a0d4){var _0x471090={'current':module[_0x4881('0xb')][_0x4881('0xc')],'phonebar':0x2};if(_0x505b8a['query']&&_0x505b8a[_0x4881('0xd')][_0x4881('0xe')]){return git['fetch']()[_0x4881('0xf')](function(_0x3cd6e7,_0x1431dc){_0x471090[_0x4881('0xe')]=(_0x3cd6e7?module[_0x4881('0xb')][_0x4881('0xc')]:_0x1431dc['latest'])||_0x4881('0x10');return _0x23a0d4[_0x4881('0x11')](0xc8)[_0x4881('0x12')](_0x471090);});}else{return _0x23a0d4[_0x4881('0x11')](0xc8)['json'](_0x471090);}};exports[_0x4881('0x13')]=function(_0x35ab50,_0x20357a){return git[_0x4881('0x13')]([_0x4881('0x14'),_0x4881('0x15')],function(_0x534063){if(_0x534063){logger['error'](_0x534063);return _0x20357a['status'](0x1f4)['json'](_0x534063);}logger[_0x4881('0x16')](_0x4881('0x17'));return _0x20357a['status'](0xc8)[_0x4881('0x12')]({'output':_0x4881('0x18')});});};exports[_0x4881('0x19')]=function(_0x57b676,_0x4f7f4e){return git['reset']([_0x4881('0x1a'),'FETCH_HEAD'],function(_0x3a8a57){if(_0x3a8a57){logger[_0x4881('0x1b')](_0x3a8a57);return _0x4f7f4e['status'](0x1f4)['json'](_0x3a8a57);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x4f7f4e[_0x4881('0x11')](0xc8)['json']({'output':'git\x20reset\x20--hard'});});};exports[_0x4881('0x1c')]=function(_0x20bc72,_0x446eb4){exec(_0x4881('0x1d'),function(_0x347b35,_0x33b74a,_0x5a514d){logger['info'](_0x33b74a);logger['info'](_0x5a514d);if(_0x347b35){logger[_0x4881('0x1b')](_0x347b35);return _0x446eb4[_0x4881('0x11')](0x1f4)[_0x4881('0x12')](_0x347b35);}return _0x446eb4[_0x4881('0x11')](0xc8)[_0x4881('0x12')]({'output':_0x33b74a});});};exports[_0x4881('0x1e')]=function(_0x4cf5c3,_0x783a6a){return pm2[_0x4881('0x1e')]('motion2')[_0x4881('0x1f')](function(_0x1a8fb0){logger[_0x4881('0x16')](_0x4881('0x20'),_0x1a8fb0);return _0x783a6a[_0x4881('0x11')](0xc8)['json']({'output':_0x4881('0x21')});})[_0x4881('0x22')](function(_0x41b83f){logger['error'](_0x41b83f);return _0x783a6a[_0x4881('0x11')](0x1f4)[_0x4881('0x12')](_0x41b83f);});};exports['migrations']=function(_0x273995,_0x1e61a){var _0x3096d1=fs[_0x4881('0x23')](path[_0x4881('0x24')](config['root'],_0x4881('0x25'),_0x4881('0x26')));var _0x373c7e=[];for(var _0x42fc74=0x0;_0x42fc74<_0x3096d1[_0x4881('0x27')];_0x42fc74++){var _0x144c63=_0x3096d1[_0x42fc74][_0x4881('0x28')](_0x4881('0x29'),'');if(compareVersions(module[_0x4881('0xb')]['version'],_0x144c63)===-0x1){_0x373c7e['push'](_0x144c63);}}if(_0x373c7e[_0x4881('0x27')]){var _0x40957f=_0x373c7e['sort'](compareVersions);var _0x42b734=new Umzug({'storage':_0x4881('0x2a'),'storageOptions':{'model':db['Migration'],'modelName':_0x4881('0x2b'),'columnName':_0x4881('0xc')},'migrations':{'params':[db[_0x4881('0x2a')]['getQueryInterface'](),db['sequelize'][_0x4881('0x2c')],function(){throw new Error(_0x4881('0x2d'));}],'path':path[_0x4881('0x24')](config['root'],_0x4881('0x25'),_0x4881('0x26')),'pattern':/\.js$/}});_0x42b734['up']({'migrations':_[_0x4881('0x2e')](_0x40957f,function(_0x52fbf2){return _0x52fbf2+_0x4881('0x29');})})[_0x4881('0x1f')](function(){return _0x1e61a[_0x4881('0x11')](0xc8)[_0x4881('0x12')]({'output':_0x4881('0x2f')+module['exports'][_0x4881('0xc')]+_0x4881('0x30')+_['last'](_0x40957f),'migrations':_[_0x4881('0x24')](_0x40957f)});})[_0x4881('0x22')](function(_0x11441b){if(_0x11441b instanceof db[_0x4881('0x2a')][_0x4881('0x31')]){return _0x1e61a['status'](0xc8)[_0x4881('0x12')]({'output':_0x4881('0x32')});}else{return _0x1e61a['status'](0x1f4)[_0x4881('0x12')](_0x11441b);}});}else{return _0x1e61a[_0x4881('0x11')](0xc8)[_0x4881('0x12')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index f5ca9de..8c6d978 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 _0xf9cb=['/:id','show','post','create','put','update','delete','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0xf9cb,0x112));var _0xbf9c=function(_0x2c5340,_0x5c86e5){_0x2c5340=_0x2c5340-0x0;var _0x3c505e=_0xf9cb[_0x2c5340];return _0x3c505e;};'use strict';var multer=require(_0xbf9c('0x0'));var util=require(_0xbf9c('0x1'));var path=require(_0xbf9c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xbf9c('0x3'));var interaction=require(_0xbf9c('0x4'));var config=require(_0xbf9c('0x5'));var controller=require(_0xbf9c('0x6'));router[_0xbf9c('0x7')]('/',auth[_0xbf9c('0x8')](),controller['index']);router[_0xbf9c('0x7')](_0xbf9c('0x9'),auth['isAuthenticated'](),controller[_0xbf9c('0xa')]);router[_0xbf9c('0x7')](_0xbf9c('0xb'),auth[_0xbf9c('0x8')](),controller[_0xbf9c('0xc')]);router[_0xbf9c('0xd')]('/',auth['isAuthenticated'](),controller[_0xbf9c('0xe')]);router[_0xbf9c('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xbf9c('0x10')]);router[_0xbf9c('0x11')](_0xbf9c('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xbf9c('0x12')]=router; \ No newline at end of file +var _0x2915=['exports','multer','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','post','create','update','destroy'];(function(_0x11e37a,_0x3b9e9e){var _0x2e8a33=function(_0x50f33f){while(--_0x50f33f){_0x11e37a['push'](_0x11e37a['shift']());}};_0x2e8a33(++_0x3b9e9e);}(_0x2915,0x91));var _0x5291=function(_0x1069f5,_0x51cc78){_0x1069f5=_0x1069f5-0x0;var _0x5c211d=_0x2915[_0x1069f5];return _0x5c211d;};'use strict';var multer=require(_0x5291('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5291('0x1'));var router=express['Router']();var auth=require(_0x5291('0x2'));var interaction=require(_0x5291('0x3'));var config=require(_0x5291('0x4'));var controller=require(_0x5291('0x5'));router[_0x5291('0x6')]('/',auth[_0x5291('0x7')](),controller[_0x5291('0x8')]);router['get'](_0x5291('0x9'),auth[_0x5291('0x7')](),controller[_0x5291('0xa')]);router[_0x5291('0x6')]('/:id',auth[_0x5291('0x7')](),controller['show']);router[_0x5291('0xb')]('/',auth['isAuthenticated'](),controller[_0x5291('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x5291('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5291('0xe')]);module[_0x5291('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 9aa8b83..839db96 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 _0xeff8=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x1356d5,_0x340024){var _0x514318=function(_0x12fc30){while(--_0x12fc30){_0x1356d5['push'](_0x1356d5['shift']());}};_0x514318(++_0x340024);}(_0xeff8,0x186));var _0x8eff=function(_0x1d558c,_0x1e497c){_0x1d558c=_0x1d558c-0x0;var _0x15767d=_0xeff8[_0x1d558c];return _0x15767d;};'use strict';var Sequelize=require(_0x8eff('0x0'));module[_0x8eff('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8eff('0x2')]},'calleridnum':{'type':Sequelize[_0x8eff('0x2')]},'calleridname':{'type':Sequelize[_0x8eff('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x8eff('0x2')]},'membername':{'type':Sequelize[_0x8eff('0x2')]},'agentcalledAt':{'type':Sequelize[_0x8eff('0x3')]},'agentconnectAt':{'type':Sequelize[_0x8eff('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x8eff('0x3')]},'agentdumpAt':{'type':Sequelize[_0x8eff('0x3')]},'holdtime':{'type':Sequelize[_0x8eff('0x4')]},'agentcomplete':{'type':Sequelize[_0x8eff('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x8eff('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x8eff('0x4')]},'agentacw':{'type':Sequelize[_0x8eff('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8eff('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8eff('0x2')]},'channelstate':{'type':Sequelize[_0x8eff('0x4')]},'channelstatedesc':{'type':Sequelize[_0x8eff('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x8eff('0x2')]},'language':{'type':Sequelize[_0x8eff('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8eff('0x2')]},'exten':{'type':Sequelize[_0x8eff('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x8eff('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x8eff('0x2')]},'destcalleridnum':{'type':Sequelize[_0x8eff('0x2')]},'destcalleridname':{'type':Sequelize[_0x8eff('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x8eff('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x8eff('0x2')]},'destaccountcode':{'type':Sequelize[_0x8eff('0x2')]},'destcontext':{'type':Sequelize[_0x8eff('0x2')]},'destexten':{'type':Sequelize[_0x8eff('0x2')]},'destpriority':{'type':Sequelize[_0x8eff('0x2')]},'destuniqueid':{'type':Sequelize[_0x8eff('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x8eff('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x8eff('0x2')]},'transfer':{'type':Sequelize[_0x8eff('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8eff('0x2')],'comment':_0x8eff('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x8eff('0x2')]},'agententerreason':{'type':Sequelize[_0x8eff('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5fd1=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x3603e1,_0x117af0){var _0x2f192d=function(_0x448f0e){while(--_0x448f0e){_0x3603e1['push'](_0x3603e1['shift']());}};_0x2f192d(++_0x117af0);}(_0x5fd1,0x155));var _0x15fd=function(_0x261655,_0x5c949f){_0x261655=_0x261655-0x0;var _0x25b37e=_0x5fd1[_0x261655];return _0x25b37e;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'type':{'type':Sequelize[_0x15fd('0x1')]},'uniqueid':{'type':Sequelize[_0x15fd('0x1')]},'calleridnum':{'type':Sequelize[_0x15fd('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x15fd('0x1')]},'membername':{'type':Sequelize[_0x15fd('0x1')]},'agentcalledAt':{'type':Sequelize[_0x15fd('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x15fd('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x15fd('0x2')]},'agentdumpAt':{'type':Sequelize[_0x15fd('0x2')]},'holdtime':{'type':Sequelize[_0x15fd('0x3')]},'agentcomplete':{'type':Sequelize[_0x15fd('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x15fd('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x15fd('0x3')]},'agentacw':{'type':Sequelize[_0x15fd('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x15fd('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x15fd('0x1')]},'channelstate':{'type':Sequelize[_0x15fd('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x15fd('0x1')]},'accountcode':{'type':Sequelize[_0x15fd('0x1')]},'context':{'type':Sequelize[_0x15fd('0x1')]},'exten':{'type':Sequelize[_0x15fd('0x1')]},'priority':{'type':Sequelize[_0x15fd('0x1')]},'destchannel':{'type':Sequelize[_0x15fd('0x1')]},'destchannelstate':{'type':Sequelize[_0x15fd('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x15fd('0x1')]},'destcalleridnum':{'type':Sequelize[_0x15fd('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x15fd('0x1')]},'destaccountcode':{'type':Sequelize[_0x15fd('0x1')]},'destcontext':{'type':Sequelize[_0x15fd('0x1')]},'destexten':{'type':Sequelize[_0x15fd('0x1')]},'destpriority':{'type':Sequelize[_0x15fd('0x1')]},'destuniqueid':{'type':Sequelize[_0x15fd('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x15fd('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x15fd('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x15fd('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x15fd('0x1')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 585596a..d026e58 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 _0x8b2b=['where','then','includeAll','include','findAll','show','params','rawAttributes','intersection','find','catch','body','describe','html-pdf','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','update','destroy','error','stack','name','send','index','map','VoiceAgentReport','fieldName','key','query','keys','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','VIRTUAL','merge','options'];(function(_0x4f8fc6,_0x49865a){var _0xdb26c0=function(_0x2a1a6b){while(--_0x2a1a6b){_0x4f8fc6['push'](_0x4f8fc6['shift']());}};_0xdb26c0(++_0x49865a);}(_0x8b2b,0xdc));var _0xb8b2=function(_0x52184d,_0x478491){_0x52184d=_0x52184d-0x0;var _0x3c9324=_0x8b2b[_0x52184d];return _0x3c9324;};'use strict';var pdf=require(_0xb8b2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb8b2('0x1'));var zipdir=require(_0xb8b2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb8b2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb8b2('0x4'));var util=require(_0xb8b2('0x5'));var path=require(_0xb8b2('0x6'));var sox=require(_0xb8b2('0x7'));var csv=require(_0xb8b2('0x8'));var ejs=require(_0xb8b2('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb8b2('0xa'));var jsforce=require(_0xb8b2('0xb'));var deskjs=require(_0xb8b2('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb8b2('0xd'));var Papa=require(_0xb8b2('0xe'));var Redis=require('ioredis');var authService=require(_0xb8b2('0xf'));var qs=require(_0xb8b2('0x10'));var as=require(_0xb8b2('0x11'));var hardwareService=require(_0xb8b2('0x12'));var logger=require(_0xb8b2('0x13'))(_0xb8b2('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb8b2('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc20e4f,_0x141ec5){_0x141ec5=_0x141ec5||0xcc;return function(_0x264f35){if(_0x264f35){return _0xc20e4f[_0xb8b2('0x16')](_0x141ec5);}return _0xc20e4f[_0xb8b2('0x17')](_0x141ec5)['end']();};}function respondWithResult(_0x2eb967,_0x11d610){_0x11d610=_0x11d610||0xc8;return function(_0x5ecb3c){if(_0x5ecb3c){return _0x2eb967['status'](_0x11d610)[_0xb8b2('0x18')](_0x5ecb3c);}};}function respondWithFilteredResult(_0x478678,_0x3c0fc7){return function(_0x4b0c44){if(_0x4b0c44){var _0x5a2ed1=_0x4b0c44[_0xb8b2('0x19')],_0x4d11a6=_0x3c0fc7[_0xb8b2('0x1a')],_0x276c69=_0x3c0fc7[_0xb8b2('0x1a')]+_0x3c0fc7[_0xb8b2('0x1b')],_0x52b365;if(_0x276c69>=_0x5a2ed1){_0x276c69=_0x5a2ed1;_0x52b365=0xc8;}else{_0x52b365=0xce;}_0x478678[_0xb8b2('0x17')](_0x52b365);return _0x478678[_0xb8b2('0x1c')](_0xb8b2('0x1d'),_0x4d11a6+'-'+_0x276c69+'/'+_0x5a2ed1)[_0xb8b2('0x18')](_0x4b0c44);}return null;};}function patchUpdates(_0x29fc89){return function(_0x6fa954){try{jsonpatch['apply'](_0x6fa954,_0x29fc89,!![]);}catch(_0x2a022c){return BPromise['reject'](_0x2a022c);}return _0x6fa954['save']();};}function saveUpdates(_0x108fb4,_0x4e1561){return function(_0x435bf6){if(_0x435bf6){return _0x435bf6[_0xb8b2('0x1e')](_0x108fb4)['then'](function(_0x312ab1){return _0x312ab1;});}return null;};}function removeEntity(_0x664abd,_0x22a4dc){return function(_0x14660b){if(_0x14660b){return _0x14660b[_0xb8b2('0x1f')]()['then'](function(){_0x664abd[_0xb8b2('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d4836,_0x5af73a){return function(_0x1952d8){if(!_0x1952d8){_0x5d4836[_0xb8b2('0x16')](0x194);}return _0x1952d8;};}function handleError(_0x551094,_0x3d6575){_0x3d6575=_0x3d6575||0x1f4;return function(_0x3f4193){logger[_0xb8b2('0x20')](_0x3f4193[_0xb8b2('0x21')]);if(_0x3f4193['name']){delete _0x3f4193[_0xb8b2('0x22')];}_0x551094[_0xb8b2('0x17')](_0x3d6575)[_0xb8b2('0x23')](_0x3f4193);};}exports[_0xb8b2('0x24')]=function(_0x323a5d,_0x47970b){var _0x214079={},_0x5e6f82={},_0x1ca9e9={'count':0x0,'rows':[]};var _0x5323be=_[_0xb8b2('0x25')](db[_0xb8b2('0x26')]['rawAttributes'],function(_0x4e5a4){return{'name':_0x4e5a4[_0xb8b2('0x27')],'type':_0x4e5a4['type'][_0xb8b2('0x28')]};});_0x5e6f82['model']=_[_0xb8b2('0x25')](_0x5323be,'name');_0x5e6f82[_0xb8b2('0x29')]=_[_0xb8b2('0x2a')](_0x323a5d[_0xb8b2('0x29')]);_0x5e6f82['filters']=_['intersection'](_0x5e6f82[_0xb8b2('0x2b')],_0x5e6f82[_0xb8b2('0x29')]);_0x214079[_0xb8b2('0x2c')]=_['intersection'](_0x5e6f82['model'],qs[_0xb8b2('0x2d')](_0x323a5d[_0xb8b2('0x29')]['fields']));_0x214079[_0xb8b2('0x2c')]=_0x214079[_0xb8b2('0x2c')]['length']?_0x214079[_0xb8b2('0x2c')]:_0x5e6f82[_0xb8b2('0x2b')];if(!_0x323a5d[_0xb8b2('0x29')][_0xb8b2('0x2e')](_0xb8b2('0x2f'))){_0x214079[_0xb8b2('0x1b')]=qs[_0xb8b2('0x1b')](_0x323a5d[_0xb8b2('0x29')]['limit']);_0x214079[_0xb8b2('0x1a')]=qs[_0xb8b2('0x1a')](_0x323a5d[_0xb8b2('0x29')][_0xb8b2('0x1a')]);}_0x214079[_0xb8b2('0x30')]=qs[_0xb8b2('0x31')](_0x323a5d[_0xb8b2('0x29')]['sort']);_0x214079['where']=qs[_0xb8b2('0x32')](_[_0xb8b2('0x33')](_0x323a5d[_0xb8b2('0x29')],_0x5e6f82[_0xb8b2('0x32')]),_0x5323be);if(_0x323a5d[_0xb8b2('0x29')][_0xb8b2('0x34')]){_0x214079['where']=_['merge'](_0x214079['where'],{'$or':_[_0xb8b2('0x25')](_0x5323be,function(_0x8b5c1a){if(_0x8b5c1a['type']!==_0xb8b2('0x35')){var _0xeba120={};_0xeba120[_0x8b5c1a[_0xb8b2('0x22')]]={'$like':'%'+_0x323a5d[_0xb8b2('0x29')][_0xb8b2('0x34')]+'%'};return _0xeba120;}})});}_0x214079=_[_0xb8b2('0x36')]({},_0x214079,_0x323a5d[_0xb8b2('0x37')]);var _0x1eb2bd={'where':_0x214079[_0xb8b2('0x38')]};return db['VoiceAgentReport'][_0xb8b2('0x19')](_0x1eb2bd)[_0xb8b2('0x39')](function(_0x51c6d8){_0x1ca9e9['count']=_0x51c6d8;if(_0x323a5d[_0xb8b2('0x29')][_0xb8b2('0x3a')]){_0x214079[_0xb8b2('0x3b')]=[{'all':!![]}];}return db[_0xb8b2('0x26')][_0xb8b2('0x3c')](_0x214079);})[_0xb8b2('0x39')](function(_0x339c3c){_0x1ca9e9['rows']=_0x339c3c;return _0x1ca9e9;})[_0xb8b2('0x39')](respondWithFilteredResult(_0x47970b,_0x214079))['catch'](handleError(_0x47970b,null));};exports[_0xb8b2('0x3d')]=function(_0x518c91,_0x4c89b2){var _0x4fcc50={'raw':![],'where':{'id':_0x518c91[_0xb8b2('0x3e')]['id']}},_0xf3faee={};_0xf3faee['model']=_[_0xb8b2('0x2a')](db['VoiceAgentReport'][_0xb8b2('0x3f')]);_0xf3faee[_0xb8b2('0x29')]=_[_0xb8b2('0x2a')](_0x518c91[_0xb8b2('0x29')]);_0xf3faee[_0xb8b2('0x32')]=_[_0xb8b2('0x40')](_0xf3faee['model'],_0xf3faee[_0xb8b2('0x29')]);_0x4fcc50[_0xb8b2('0x2c')]=_[_0xb8b2('0x40')](_0xf3faee[_0xb8b2('0x2b')],qs[_0xb8b2('0x2d')](_0x518c91['query']['fields']));_0x4fcc50[_0xb8b2('0x2c')]=_0x4fcc50['attributes']['length']?_0x4fcc50['attributes']:_0xf3faee[_0xb8b2('0x2b')];if(_0x518c91[_0xb8b2('0x29')][_0xb8b2('0x3a')]){_0x4fcc50[_0xb8b2('0x3b')]=[{'all':!![]}];}_0x4fcc50=_[_0xb8b2('0x36')]({},_0x4fcc50,_0x518c91[_0xb8b2('0x37')]);return db[_0xb8b2('0x26')][_0xb8b2('0x41')](_0x4fcc50)['then'](handleEntityNotFound(_0x4c89b2,null))[_0xb8b2('0x39')](respondWithResult(_0x4c89b2,null))[_0xb8b2('0x42')](handleError(_0x4c89b2,null));};exports['create']=function(_0x261469,_0x19f53b){return db[_0xb8b2('0x26')]['create'](_0x261469[_0xb8b2('0x43')],{})[_0xb8b2('0x39')](respondWithResult(_0x19f53b,0xc9))['catch'](handleError(_0x19f53b,null));};exports['update']=function(_0x6e2106,_0x891826){if(_0x6e2106[_0xb8b2('0x43')]['id']){delete _0x6e2106['body']['id'];}return db['VoiceAgentReport']['find']({'where':{'id':_0x6e2106[_0xb8b2('0x3e')]['id']}})[_0xb8b2('0x39')](handleEntityNotFound(_0x891826,null))['then'](saveUpdates(_0x6e2106[_0xb8b2('0x43')],null))[_0xb8b2('0x39')](respondWithResult(_0x891826,null))['catch'](handleError(_0x891826,null));};exports['destroy']=function(_0x593e41,_0x1181ff){return db['VoiceAgentReport'][_0xb8b2('0x41')]({'where':{'id':_0x593e41[_0xb8b2('0x3e')]['id']}})[_0xb8b2('0x39')](handleEntityNotFound(_0x1181ff,null))[_0xb8b2('0x39')](removeEntity(_0x1181ff,null))[_0xb8b2('0x42')](handleError(_0x1181ff,null));};exports[_0xb8b2('0x44')]=function(_0x3cad71,_0x562e6a){return db[_0xb8b2('0x26')][_0xb8b2('0x44')]()[_0xb8b2('0x39')](respondWithResult(_0x562e6a,null))[_0xb8b2('0x42')](handleError(_0x562e6a,null));}; \ No newline at end of file +var _0x815d=['reject','update','then','destroy','end','sendStatus','error','name','send','map','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','VIRTUAL','where','VoiceAgentReport','includeAll','rows','show','params','include','options','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','count','offset','limit','set','Content-Range','json'];(function(_0x2f880a,_0x25ca9e){var _0x575b46=function(_0x428d01){while(--_0x428d01){_0x2f880a['push'](_0x2f880a['shift']());}};_0x575b46(++_0x25ca9e);}(_0x815d,0xfb));var _0xd815=function(_0x27b525,_0xee22d0){_0x27b525=_0x27b525-0x0;var _0x3a665d=_0x815d[_0x27b525];return _0x3a665d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd815('0x0'));var rimraf=require(_0xd815('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd815('0x2'));var rp=require(_0xd815('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd815('0x4'));var util=require(_0xd815('0x5'));var path=require('path');var sox=require(_0xd815('0x6'));var csv=require(_0xd815('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd815('0x8'));var crypto=require(_0xd815('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd815('0xa'));var toCsv=require('to-csv');var querystring=require(_0xd815('0xb'));var Papa=require('papaparse');var Redis=require(_0xd815('0xc'));var authService=require(_0xd815('0xd'));var qs=require(_0xd815('0xe'));var as=require(_0xd815('0xf'));var hardwareService=require(_0xd815('0x10'));var logger=require(_0xd815('0x11'))(_0xd815('0x12'));var utils=require('../../config/utils');var config=require(_0xd815('0x13'));var licenseUtil=require(_0xd815('0x14'));var db=require(_0xd815('0x15'))['db'];function respondWithStatusCode(_0x430345,_0x58d454){_0x58d454=_0x58d454||0xcc;return function(_0x535870){if(_0x535870){return _0x430345['sendStatus'](_0x58d454);}return _0x430345[_0xd815('0x16')](_0x58d454)['end']();};}function respondWithResult(_0x325f10,_0x85bac0){_0x85bac0=_0x85bac0||0xc8;return function(_0x177205){if(_0x177205){return _0x325f10[_0xd815('0x16')](_0x85bac0)['json'](_0x177205);}};}function respondWithFilteredResult(_0x5c90be,_0x4d2071){return function(_0x4bac7d){if(_0x4bac7d){var _0x2f2ad2=_0x4bac7d[_0xd815('0x17')],_0x25b6b3=_0x4d2071['offset'],_0x3f3ac4=_0x4d2071[_0xd815('0x18')]+_0x4d2071[_0xd815('0x19')],_0x14b6c1;if(_0x3f3ac4>=_0x2f2ad2){_0x3f3ac4=_0x2f2ad2;_0x14b6c1=0xc8;}else{_0x14b6c1=0xce;}_0x5c90be[_0xd815('0x16')](_0x14b6c1);return _0x5c90be[_0xd815('0x1a')](_0xd815('0x1b'),_0x25b6b3+'-'+_0x3f3ac4+'/'+_0x2f2ad2)[_0xd815('0x1c')](_0x4bac7d);}return null;};}function patchUpdates(_0x43a7e4){return function(_0x195876){try{jsonpatch['apply'](_0x195876,_0x43a7e4,!![]);}catch(_0x28e29c){return BPromise[_0xd815('0x1d')](_0x28e29c);}return _0x195876['save']();};}function saveUpdates(_0x535569,_0xe583b8){return function(_0x14b378){if(_0x14b378){return _0x14b378[_0xd815('0x1e')](_0x535569)[_0xd815('0x1f')](function(_0x2b78b2){return _0x2b78b2;});}return null;};}function removeEntity(_0x1e313c,_0x4651ac){return function(_0x3c19be){if(_0x3c19be){return _0x3c19be[_0xd815('0x20')]()[_0xd815('0x1f')](function(){_0x1e313c[_0xd815('0x16')](0xcc)[_0xd815('0x21')]();});}};}function handleEntityNotFound(_0x3f4452,_0x176874){return function(_0x362805){if(!_0x362805){_0x3f4452[_0xd815('0x22')](0x194);}return _0x362805;};}function handleError(_0x183047,_0x3b855f){_0x3b855f=_0x3b855f||0x1f4;return function(_0x2cdc6a){logger[_0xd815('0x23')](_0x2cdc6a['stack']);if(_0x2cdc6a[_0xd815('0x24')]){delete _0x2cdc6a['name'];}_0x183047['status'](_0x3b855f)[_0xd815('0x25')](_0x2cdc6a);};}exports['index']=function(_0x2a7181,_0x9deb54){var _0x4262a6={},_0x1f662f={},_0x1d1430={'count':0x0,'rows':[]};var _0x4f7859=_[_0xd815('0x26')](db['VoiceAgentReport'][_0xd815('0x27')],function(_0x194039){return{'name':_0x194039[_0xd815('0x28')],'type':_0x194039[_0xd815('0x29')][_0xd815('0x2a')]};});_0x1f662f['model']=_[_0xd815('0x26')](_0x4f7859,_0xd815('0x24'));_0x1f662f['query']=_[_0xd815('0x2b')](_0x2a7181[_0xd815('0x2c')]);_0x1f662f['filters']=_[_0xd815('0x2d')](_0x1f662f[_0xd815('0x2e')],_0x1f662f[_0xd815('0x2c')]);_0x4262a6[_0xd815('0x2f')]=_[_0xd815('0x2d')](_0x1f662f[_0xd815('0x2e')],qs[_0xd815('0x30')](_0x2a7181['query'][_0xd815('0x30')]));_0x4262a6['attributes']=_0x4262a6[_0xd815('0x2f')][_0xd815('0x31')]?_0x4262a6['attributes']:_0x1f662f[_0xd815('0x2e')];if(!_0x2a7181[_0xd815('0x2c')][_0xd815('0x32')]('nolimit')){_0x4262a6[_0xd815('0x19')]=qs[_0xd815('0x19')](_0x2a7181[_0xd815('0x2c')]['limit']);_0x4262a6[_0xd815('0x18')]=qs[_0xd815('0x18')](_0x2a7181[_0xd815('0x2c')][_0xd815('0x18')]);}_0x4262a6[_0xd815('0x33')]=qs[_0xd815('0x34')](_0x2a7181[_0xd815('0x2c')][_0xd815('0x34')]);_0x4262a6['where']=qs['filters'](_['pick'](_0x2a7181[_0xd815('0x2c')],_0x1f662f[_0xd815('0x35')]),_0x4f7859);if(_0x2a7181['query'][_0xd815('0x36')]){_0x4262a6['where']=_[_0xd815('0x37')](_0x4262a6['where'],{'$or':_[_0xd815('0x26')](_0x4f7859,function(_0x5c2f71){if(_0x5c2f71[_0xd815('0x29')]!==_0xd815('0x38')){var _0x18dc8e={};_0x18dc8e[_0x5c2f71[_0xd815('0x24')]]={'$like':'%'+_0x2a7181['query'][_0xd815('0x36')]+'%'};return _0x18dc8e;}})});}_0x4262a6=_[_0xd815('0x37')]({},_0x4262a6,_0x2a7181['options']);var _0x33f34c={'where':_0x4262a6[_0xd815('0x39')]};return db[_0xd815('0x3a')]['count'](_0x33f34c)[_0xd815('0x1f')](function(_0x2f4da6){_0x1d1430[_0xd815('0x17')]=_0x2f4da6;if(_0x2a7181[_0xd815('0x2c')][_0xd815('0x3b')]){_0x4262a6['include']=[{'all':!![]}];}return db['VoiceAgentReport']['findAll'](_0x4262a6);})['then'](function(_0x42cc8e){_0x1d1430[_0xd815('0x3c')]=_0x42cc8e;return _0x1d1430;})[_0xd815('0x1f')](respondWithFilteredResult(_0x9deb54,_0x4262a6))['catch'](handleError(_0x9deb54,null));};exports[_0xd815('0x3d')]=function(_0x2ec6cb,_0x13636a){var _0x114234={'raw':![],'where':{'id':_0x2ec6cb[_0xd815('0x3e')]['id']}},_0x2d68b8={};_0x2d68b8[_0xd815('0x2e')]=_[_0xd815('0x2b')](db['VoiceAgentReport'][_0xd815('0x27')]);_0x2d68b8['query']=_[_0xd815('0x2b')](_0x2ec6cb[_0xd815('0x2c')]);_0x2d68b8[_0xd815('0x35')]=_[_0xd815('0x2d')](_0x2d68b8[_0xd815('0x2e')],_0x2d68b8[_0xd815('0x2c')]);_0x114234[_0xd815('0x2f')]=_[_0xd815('0x2d')](_0x2d68b8[_0xd815('0x2e')],qs[_0xd815('0x30')](_0x2ec6cb[_0xd815('0x2c')][_0xd815('0x30')]));_0x114234[_0xd815('0x2f')]=_0x114234[_0xd815('0x2f')]['length']?_0x114234[_0xd815('0x2f')]:_0x2d68b8['model'];if(_0x2ec6cb[_0xd815('0x2c')]['includeAll']){_0x114234[_0xd815('0x3f')]=[{'all':!![]}];}_0x114234=_[_0xd815('0x37')]({},_0x114234,_0x2ec6cb[_0xd815('0x40')]);return db['VoiceAgentReport'][_0xd815('0x41')](_0x114234)['then'](handleEntityNotFound(_0x13636a,null))['then'](respondWithResult(_0x13636a,null))[_0xd815('0x42')](handleError(_0x13636a,null));};exports[_0xd815('0x43')]=function(_0x2a5768,_0x273f7a){return db[_0xd815('0x3a')][_0xd815('0x43')](_0x2a5768[_0xd815('0x44')],{})['then'](respondWithResult(_0x273f7a,0xc9))[_0xd815('0x42')](handleError(_0x273f7a,null));};exports[_0xd815('0x1e')]=function(_0x1a525f,_0x41a062){if(_0x1a525f['body']['id']){delete _0x1a525f[_0xd815('0x44')]['id'];}return db[_0xd815('0x3a')][_0xd815('0x41')]({'where':{'id':_0x1a525f['params']['id']}})[_0xd815('0x1f')](handleEntityNotFound(_0x41a062,null))[_0xd815('0x1f')](saveUpdates(_0x1a525f['body'],null))['then'](respondWithResult(_0x41a062,null))['catch'](handleError(_0x41a062,null));};exports[_0xd815('0x20')]=function(_0x2d0ba6,_0x41a06b){return db['VoiceAgentReport'][_0xd815('0x41')]({'where':{'id':_0x2d0ba6[_0xd815('0x3e')]['id']}})['then'](handleEntityNotFound(_0x41a06b,null))[_0xd815('0x1f')](removeEntity(_0x41a06b,null))[_0xd815('0x42')](handleError(_0x41a06b,null));};exports['describe']=function(_0x127bf6,_0x2991d8){return db['VoiceAgentReport'][_0xd815('0x45')]()[_0xd815('0x1f')](respondWithResult(_0x2991d8,null))['catch'](handleError(_0x2991d8,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index afe7a03..2e4e776 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 _0x9d5c=['util','api','moment','bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport'];(function(_0xad0709,_0x2ece19){var _0x10ecba=function(_0x182fa6){while(--_0x182fa6){_0xad0709['push'](_0xad0709['shift']());}};_0x10ecba(++_0x2ece19);}(_0x9d5c,0xfa));var _0xc9d5=function(_0x1addad,_0x4f051b){_0x1addad=_0x1addad-0x0;var _0x49129b=_0x9d5c[_0x1addad];return _0x49129b;};'use strict';var _=require('lodash');var util=require(_0xc9d5('0x0'));var logger=require('../../config/logger')(_0xc9d5('0x1'));var moment=require(_0xc9d5('0x2'));var BPromise=require(_0xc9d5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9d5('0x4'));var rimraf=require(_0xc9d5('0x5'));var config=require(_0xc9d5('0x6'));var attributes=require(_0xc9d5('0x7'));module[_0xc9d5('0x8')]=function(_0x4a76c8,_0x386b5f){return _0x4a76c8['define'](_0xc9d5('0x9'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x16a6=['moment','bluebird','request-promise','path','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','destuniqueid','lodash','util','api'];(function(_0x1fc95f,_0x549938){var _0x1bbeca=function(_0xa4218d){while(--_0xa4218d){_0x1fc95f['push'](_0x1fc95f['shift']());}};_0x1bbeca(++_0x549938);}(_0x16a6,0x15c));var _0x616a=function(_0x324012,_0x23f45f){_0x324012=_0x324012-0x0;var _0x435cf2=_0x16a6[_0x324012];return _0x435cf2;};'use strict';var _=require(_0x616a('0x0'));var util=require(_0x616a('0x1'));var logger=require('../../config/logger')(_0x616a('0x2'));var moment=require(_0x616a('0x3'));var BPromise=require(_0x616a('0x4'));var rp=require(_0x616a('0x5'));var fs=require('fs');var path=require(_0x616a('0x6'));var rimraf=require(_0x616a('0x7'));var config=require('../../config/environment');var attributes=require(_0x616a('0x8'));module[_0x616a('0x9')]=function(_0x4c1641,_0x56eaab){return _0x4c1641[_0x616a('0xa')](_0x616a('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid',_0x616a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index a760841..c4def44 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 _0x3d3e=['request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VoiceAgentReport','create','options','CreateVoiceAgentReport','stringify','update','body','raw','where','attributes','limit','UpdateVoiceAgentReport','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s'];(function(_0x200834,_0x2d2c03){var _0x52e96e=function(_0x3f6c49){while(--_0x3f6c49){_0x200834['push'](_0x200834['shift']());}};_0x52e96e(++_0x2d2c03);}(_0x3d3e,0xbe));var _0xe3d3=function(_0x20c910,_0x4a776a){_0x20c910=_0x20c910-0x0;var _0x10717f=_0x3d3e[_0x20c910];return _0x10717f;};'use strict';var _=require(_0xe3d3('0x0'));var util=require('util');var moment=require(_0xe3d3('0x1'));var BPromise=require('bluebird');var rs=require(_0xe3d3('0x2'));var fs=require('fs');var Redis=require(_0xe3d3('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe3d3('0x4'))(_0xe3d3('0x5'));var config=require(_0xe3d3('0x6'));var jayson=require(_0xe3d3('0x7'));var client=jayson[_0xe3d3('0x8')][_0xe3d3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c746f,_0x1a808b,_0x2d925e){return new BPromise(function(_0xd1cadc,_0x5d255d){return client[_0xe3d3('0xa')](_0x2c746f,_0x2d925e)[_0xe3d3('0xb')](function(_0x2473fb){logger[_0xe3d3('0xc')](_0xe3d3('0xd'),_0x1a808b,_0xe3d3('0xe'));logger[_0xe3d3('0xf')](_0xe3d3('0x10'),_0x1a808b,_0xe3d3('0xe'),JSON['stringify'](_0x2473fb));if(_0x2473fb[_0xe3d3('0x11')]){if(_0x2473fb['error'][_0xe3d3('0x12')]===0x1f4){logger[_0xe3d3('0x11')](_0xe3d3('0xd'),_0x1a808b,_0x2473fb[_0xe3d3('0x11')][_0xe3d3('0x13')]);return _0x5d255d(_0x2473fb['error']['message']);}logger[_0xe3d3('0x11')](_0xe3d3('0xd'),_0x1a808b,_0x2473fb[_0xe3d3('0x11')][_0xe3d3('0x13')]);return _0xd1cadc(_0x2473fb[_0xe3d3('0x11')]['message']);}else{logger[_0xe3d3('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x1a808b,'request\x20sent');_0xd1cadc(_0x2473fb[_0xe3d3('0x14')]['message']);}})[_0xe3d3('0x15')](function(_0x358ab1){logger[_0xe3d3('0x11')](_0xe3d3('0xd'),_0x1a808b,_0x358ab1);_0x5d255d(_0x358ab1);});});}exports['CreateVoiceAgentReport']=function(_0x36642a){var _0x2aea85=this;return new Promise(function(_0x56e5ed,_0x564bb1){return db[_0xe3d3('0x16')][_0xe3d3('0x17')](_0x36642a['body'],{'raw':_0x36642a[_0xe3d3('0x18')]?_0x36642a['options']['raw']===undefined?!![]:![]:!![]})[_0xe3d3('0xb')](function(_0x2be6c7){logger[_0xe3d3('0xc')](_0xe3d3('0x19'),_0x36642a);logger[_0xe3d3('0xf')](_0xe3d3('0x19'),_0x36642a,JSON[_0xe3d3('0x1a')](_0x2be6c7));_0x56e5ed(_0x2be6c7);})[_0xe3d3('0x15')](function(_0x551b9a){logger['error'](_0xe3d3('0x19'),_0x551b9a['message'],_0x36642a);_0x564bb1(_0x2aea85[_0xe3d3('0x11')](0x1f4,_0x551b9a['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x329f72){var _0x19d582=this;return new Promise(function(_0x58076f,_0x14be99){return db[_0xe3d3('0x16')][_0xe3d3('0x1b')](_0x329f72[_0xe3d3('0x1c')],{'raw':_0x329f72['options']?_0x329f72[_0xe3d3('0x18')][_0xe3d3('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x329f72[_0xe3d3('0x18')]?_0x329f72[_0xe3d3('0x18')][_0xe3d3('0x1e')]||null:null,'attributes':_0x329f72[_0xe3d3('0x18')]?_0x329f72[_0xe3d3('0x18')][_0xe3d3('0x1f')]||null:null,'limit':_0x329f72[_0xe3d3('0x18')]?_0x329f72[_0xe3d3('0x18')][_0xe3d3('0x20')]||null:null})[_0xe3d3('0xb')](function(_0x2db91e){logger[_0xe3d3('0xc')]('UpdateVoiceAgentReport',_0x329f72);logger[_0xe3d3('0xf')](_0xe3d3('0x21'),_0x329f72,JSON[_0xe3d3('0x1a')](_0x2db91e));_0x58076f(_0x2db91e);})['catch'](function(_0x2f4398){logger[_0xe3d3('0x11')](_0xe3d3('0x21'),_0x2f4398[_0xe3d3('0x13')],_0x329f72);_0x14be99(_0x19d582[_0xe3d3('0x11')](0x1f4,_0x2f4398[_0xe3d3('0x13')]));});});}; \ No newline at end of file +var _0x2e25=['VoiceAgentReport','create','body','options','info','UpdateVoiceAgentReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','CreateVoiceAgentReport'];(function(_0x4a619f,_0x595277){var _0x38274e=function(_0x36c691){while(--_0x36c691){_0x4a619f['push'](_0x4a619f['shift']());}};_0x38274e(++_0x595277);}(_0x2e25,0x15e));var _0x52e2=function(_0x3db4a0,_0x718d4a){_0x3db4a0=_0x3db4a0-0x0;var _0x5d2f2a=_0x2e25[_0x3db4a0];return _0x5d2f2a;};'use strict';var _=require(_0x52e2('0x0'));var util=require(_0x52e2('0x1'));var moment=require(_0x52e2('0x2'));var BPromise=require(_0x52e2('0x3'));var rs=require(_0x52e2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x52e2('0x5'))['db'];var utils=require(_0x52e2('0x6'));var logger=require(_0x52e2('0x7'))(_0x52e2('0x8'));var config=require(_0x52e2('0x9'));var jayson=require(_0x52e2('0xa'));var client=jayson['client'][_0x52e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbd1770,_0xeda623,_0x48f32d){return new BPromise(function(_0x33b20d,_0x4df38c){return client['request'](_0xbd1770,_0x48f32d)[_0x52e2('0xc')](function(_0x58d87f){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0xeda623,_0x52e2('0xd'));logger[_0x52e2('0xe')](_0x52e2('0xf'),_0xeda623,'request\x20sent',JSON[_0x52e2('0x10')](_0x58d87f));if(_0x58d87f[_0x52e2('0x11')]){if(_0x58d87f[_0x52e2('0x11')][_0x52e2('0x12')]===0x1f4){logger[_0x52e2('0x11')](_0x52e2('0x13'),_0xeda623,_0x58d87f[_0x52e2('0x11')]['message']);return _0x4df38c(_0x58d87f[_0x52e2('0x11')]['message']);}logger[_0x52e2('0x11')](_0x52e2('0x13'),_0xeda623,_0x58d87f[_0x52e2('0x11')][_0x52e2('0x14')]);return _0x33b20d(_0x58d87f['error'][_0x52e2('0x14')]);}else{logger['info'](_0x52e2('0x13'),_0xeda623,_0x52e2('0xd'));_0x33b20d(_0x58d87f[_0x52e2('0x15')][_0x52e2('0x14')]);}})[_0x52e2('0x16')](function(_0x588684){logger[_0x52e2('0x11')](_0x52e2('0x13'),_0xeda623,_0x588684);_0x4df38c(_0x588684);});});}exports[_0x52e2('0x17')]=function(_0x2fd99a){var _0x5d3eb5=this;return new Promise(function(_0x489c63,_0x2f25df){return db[_0x52e2('0x18')][_0x52e2('0x19')](_0x2fd99a[_0x52e2('0x1a')],{'raw':_0x2fd99a[_0x52e2('0x1b')]?_0x2fd99a['options']['raw']===undefined?!![]:![]:!![]})[_0x52e2('0xc')](function(_0x1af5b5){logger[_0x52e2('0x1c')]('CreateVoiceAgentReport',_0x2fd99a);logger[_0x52e2('0xe')]('CreateVoiceAgentReport',_0x2fd99a,JSON['stringify'](_0x1af5b5));_0x489c63(_0x1af5b5);})['catch'](function(_0xd8e694){logger[_0x52e2('0x11')]('CreateVoiceAgentReport',_0xd8e694[_0x52e2('0x14')],_0x2fd99a);_0x2f25df(_0x5d3eb5[_0x52e2('0x11')](0x1f4,_0xd8e694['message']));});});};exports[_0x52e2('0x1d')]=function(_0x49c51b){var _0x1725ac=this;return new Promise(function(_0x43b366,_0x56b3cb){return db[_0x52e2('0x18')][_0x52e2('0x1e')](_0x49c51b[_0x52e2('0x1a')],{'raw':_0x49c51b[_0x52e2('0x1b')]?_0x49c51b[_0x52e2('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49c51b[_0x52e2('0x1b')]?_0x49c51b['options'][_0x52e2('0x1f')]||null:null,'attributes':_0x49c51b[_0x52e2('0x1b')]?_0x49c51b[_0x52e2('0x1b')][_0x52e2('0x20')]||null:null,'limit':_0x49c51b[_0x52e2('0x1b')]?_0x49c51b['options'][_0x52e2('0x21')]||null:null})[_0x52e2('0xc')](function(_0x1e8c73){logger[_0x52e2('0x1c')]('UpdateVoiceAgentReport',_0x49c51b);logger[_0x52e2('0xe')](_0x52e2('0x1d'),_0x49c51b,JSON['stringify'](_0x1e8c73));_0x43b366(_0x1e8c73);})[_0x52e2('0x16')](function(_0x29d53b){logger[_0x52e2('0x11')]('UpdateVoiceAgentReport',_0x29d53b[_0x52e2('0x14')],_0x49c51b);_0x56b3cb(_0x1725ac[_0x52e2('0x11')](0x1f4,_0x29d53b[_0x52e2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 0d883f2..5179ca9 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 _0x0de1=['delete','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update'];(function(_0x35508c,_0x57f0bd){var _0x3a2bc0=function(_0x3dc018){while(--_0x3dc018){_0x35508c['push'](_0x35508c['shift']());}};_0x3a2bc0(++_0x57f0bd);}(_0x0de1,0x1b1));var _0x10de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0de1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x10de('0x0'));var util=require('util');var path=require(_0x10de('0x1'));var timeout=require(_0x10de('0x2'));var express=require(_0x10de('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x10de('0x4'));var config=require(_0x10de('0x5'));var controller=require(_0x10de('0x6'));router[_0x10de('0x7')]('/',auth[_0x10de('0x8')](),controller[_0x10de('0x9')]);router[_0x10de('0x7')](_0x10de('0xa'),auth[_0x10de('0x8')](),controller['describe']);router[_0x10de('0x7')](_0x10de('0xb'),auth[_0x10de('0x8')](),controller[_0x10de('0xc')]);router[_0x10de('0xd')]('/',auth[_0x10de('0x8')](),controller[_0x10de('0xe')]);router[_0x10de('0xf')](_0x10de('0xb'),auth[_0x10de('0x8')](),controller[_0x10de('0x10')]);router[_0x10de('0x11')](_0x10de('0xb'),auth[_0x10de('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1576=['./voiceCallReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x21d9f3,_0x4e4c8b){var _0x1eedc2=function(_0x5ecf71){while(--_0x5ecf71){_0x21d9f3['push'](_0x21d9f3['shift']());}};_0x1eedc2(++_0x4e4c8b);}(_0x1576,0x110));var _0x6157=function(_0x4bfe08,_0x48ae7b){_0x4bfe08=_0x4bfe08-0x0;var _0x1f9125=_0x1576[_0x4bfe08];return _0x1f9125;};'use strict';var multer=require(_0x6157('0x0'));var util=require(_0x6157('0x1'));var path=require(_0x6157('0x2'));var timeout=require(_0x6157('0x3'));var express=require(_0x6157('0x4'));var router=express[_0x6157('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x6157('0x6'));var config=require(_0x6157('0x7'));var controller=require(_0x6157('0x8'));router[_0x6157('0x9')]('/',auth['isAuthenticated'](),controller[_0x6157('0xa')]);router[_0x6157('0x9')](_0x6157('0xb'),auth[_0x6157('0xc')](),controller[_0x6157('0xd')]);router[_0x6157('0x9')](_0x6157('0xe'),auth[_0x6157('0xc')](),controller[_0x6157('0xf')]);router[_0x6157('0x10')]('/',auth[_0x6157('0xc')](),controller['create']);router[_0x6157('0x11')](_0x6157('0xe'),auth[_0x6157('0xc')](),controller['update']);router[_0x6157('0x12')](_0x6157('0xe'),auth[_0x6157('0xc')](),controller['destroy']);module[_0x6157('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 6717692..f7e1aa7 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 _0x7217=['dialer','TEXT','DATE','INTEGER','sequelize','STRING','ENUM','inbound','internal','outbound'];(function(_0x40c4d2,_0xc30b6c){var _0x35d759=function(_0x5d5905){while(--_0x5d5905){_0x40c4d2['push'](_0x40c4d2['shift']());}};_0x35d759(++_0xc30b6c);}(_0x7217,0x19e));var _0x7721=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x7217[_0x2576d7];return _0x16a08c;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7721('0x1')]},'type':{'type':Sequelize[_0x7721('0x2')](_0x7721('0x3'),_0x7721('0x4'),_0x7721('0x5'),'inbound-fax','outbound-fax',_0x7721('0x6'))},'tag':{'type':Sequelize[_0x7721('0x1')]},'accountcode':{'type':Sequelize[_0x7721('0x1')]},'source':{'type':Sequelize[_0x7721('0x1')]},'destination':{'type':Sequelize[_0x7721('0x1')]},'destinationcontext':{'type':Sequelize[_0x7721('0x1')]},'callerid':{'type':Sequelize[_0x7721('0x1')]},'channel':{'type':Sequelize[_0x7721('0x1')]},'destinationchannel':{'type':Sequelize[_0x7721('0x1')]},'lastapplication':{'type':Sequelize[_0x7721('0x1')]},'lastdata':{'type':Sequelize[_0x7721('0x7')]},'starttime':{'type':Sequelize[_0x7721('0x8')]},'systemanswertime':{'type':Sequelize[_0x7721('0x8')]},'answertime':{'type':Sequelize[_0x7721('0x8')]},'endtime':{'type':Sequelize[_0x7721('0x8')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x7721('0x9')]},'mohtime':{'type':Sequelize[_0x7721('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x7721('0x1')]},'amaflags':{'type':Sequelize[_0x7721('0x1')]},'userfield':{'type':Sequelize[_0x7721('0x1')]},'userDisposition':{'type':Sequelize[_0x7721('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x7721('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x7721('0x1')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x7721('0x1')]},'routeid':{'type':Sequelize[_0x7721('0x9')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5162=['internal','outbound','inbound-fax','outbound-fax','dialer','STRING','TEXT','DATE','INTEGER','sequelize'];(function(_0x211bc3,_0x5860c8){var _0x34c9a2=function(_0x4bfa37){while(--_0x4bfa37){_0x211bc3['push'](_0x211bc3['shift']());}};_0x34c9a2(++_0x5860c8);}(_0x5162,0x103));var _0x2516=function(_0x4dda69,_0x2a0fe4){_0x4dda69=_0x4dda69-0x0;var _0x9014a9=_0x5162[_0x4dda69];return _0x9014a9;};'use strict';var Sequelize=require(_0x2516('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM']('inbound',_0x2516('0x1'),_0x2516('0x2'),_0x2516('0x3'),_0x2516('0x4'),_0x2516('0x5'))},'tag':{'type':Sequelize[_0x2516('0x6')]},'accountcode':{'type':Sequelize[_0x2516('0x6')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x2516('0x6')]},'channel':{'type':Sequelize[_0x2516('0x6')]},'destinationchannel':{'type':Sequelize[_0x2516('0x6')]},'lastapplication':{'type':Sequelize[_0x2516('0x6')]},'lastdata':{'type':Sequelize[_0x2516('0x7')]},'starttime':{'type':Sequelize[_0x2516('0x8')]},'systemanswertime':{'type':Sequelize[_0x2516('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x2516('0x8')]},'duration':{'type':Sequelize[_0x2516('0x9')]},'billableseconds':{'type':Sequelize[_0x2516('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x2516('0x6')]},'userSecondDisposition':{'type':Sequelize[_0x2516('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x2516('0x6')]},'note':{'type':Sequelize[_0x2516('0x6')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x2516('0x9')]},'sipcallid':{'type':Sequelize[_0x2516('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 5e91eb3..d1bda3d 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','fullname','User','rows','catch','show','params','keys','options','find','create','describe','body','uniqueid','user','html-pdf'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 a6b04ce..06d1886 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 _0xeaef=['path','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xeaef,0x1c2));var _0xfeae=function(_0x557a94,_0x19d140){_0x557a94=_0x557a94-0x0;var _0x206e74=_0xeaef[_0x557a94];return _0x206e74;};'use strict';var _=require(_0xfeae('0x0'));var util=require(_0xfeae('0x1'));var logger=require('../../config/logger')(_0xfeae('0x2'));var moment=require(_0xfeae('0x3'));var BPromise=require(_0xfeae('0x4'));var rp=require(_0xfeae('0x5'));var fs=require('fs');var path=require(_0xfeae('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0xfeae('0x7')]=function(_0x5576ee,_0x4f85e0){return _0x5576ee[_0xfeae('0x8')](_0xfeae('0x9'),attributes,{'tableName':_0xfeae('0xa'),'paranoid':![],'indexes':[{'fields':[_0xfeae('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x842e=['../../config/environment','./voiceCallReport.attributes','exports','define','report_call','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4efc67,_0x3d7609){var _0x1cdf2e=function(_0x199137){while(--_0x199137){_0x4efc67['push'](_0x4efc67['shift']());}};_0x1cdf2e(++_0x3d7609);}(_0x842e,0xbc));var _0xe842=function(_0x2cd1fb,_0x291f55){_0x2cd1fb=_0x2cd1fb-0x0;var _0x48fd2b=_0x842e[_0x2cd1fb];return _0x48fd2b;};'use strict';var _=require(_0xe842('0x0'));var util=require('util');var logger=require(_0xe842('0x1'))(_0xe842('0x2'));var moment=require(_0xe842('0x3'));var BPromise=require('bluebird');var rp=require(_0xe842('0x4'));var fs=require('fs');var path=require(_0xe842('0x5'));var rimraf=require(_0xe842('0x6'));var config=require(_0xe842('0x7'));var attributes=require(_0xe842('0x8'));module[_0xe842('0x9')]=function(_0x4692a5,_0x240591){return _0x4692a5[_0xe842('0xa')]('VoiceCallReport',attributes,{'tableName':_0xe842('0xb'),'paranoid':![],'indexes':[{'fields':[_0xe842('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 09eb6f7..fe78589 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 _0x68af=['message','result','catch','VoiceCallReport','options','limit','include','map','model','attributes','GetVoiceCallReport','create','body','raw','CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x1cec84,_0x101ec2){var _0x12b7d3=function(_0x9679d8){while(--_0x9679d8){_0x1cec84['push'](_0x1cec84['shift']());}};_0x12b7d3(++_0x101ec2);}(_0x68af,0x9d));var _0xf68a=function(_0x56dbbd,_0x53a898){_0x56dbbd=_0x56dbbd-0x0;var _0x26012c=_0x68af[_0x56dbbd];return _0x26012c;};'use strict';var _=require(_0xf68a('0x0'));var util=require('util');var moment=require(_0xf68a('0x1'));var BPromise=require(_0xf68a('0x2'));var rs=require(_0xf68a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf68a('0x4'));var logger=require('../../config/logger')(_0xf68a('0x5'));var config=require('../../config/environment');var jayson=require(_0xf68a('0x6'));var client=jayson[_0xf68a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fea5d,_0x400c5c,_0x4c4558){return new BPromise(function(_0x4088ca,_0xedfb59){return client[_0xf68a('0x8')](_0x4fea5d,_0x4c4558)[_0xf68a('0x9')](function(_0x5075d0){logger[_0xf68a('0xa')](_0xf68a('0xb'),_0x400c5c,_0xf68a('0xc'));logger[_0xf68a('0xd')](_0xf68a('0xe'),_0x400c5c,'request\x20sent',JSON[_0xf68a('0xf')](_0x5075d0));if(_0x5075d0['error']){if(_0x5075d0['error'][_0xf68a('0x10')]===0x1f4){logger['error'](_0xf68a('0xb'),_0x400c5c,_0x5075d0[_0xf68a('0x11')][_0xf68a('0x12')]);return _0xedfb59(_0x5075d0[_0xf68a('0x11')]['message']);}logger[_0xf68a('0x11')](_0xf68a('0xb'),_0x400c5c,_0x5075d0[_0xf68a('0x11')][_0xf68a('0x12')]);return _0x4088ca(_0x5075d0[_0xf68a('0x11')][_0xf68a('0x12')]);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x400c5c,_0xf68a('0xc'));_0x4088ca(_0x5075d0[_0xf68a('0x13')][_0xf68a('0x12')]);}})[_0xf68a('0x14')](function(_0x2ed8e6){logger[_0xf68a('0x11')](_0xf68a('0xb'),_0x400c5c,_0x2ed8e6);_0xedfb59(_0x2ed8e6);});});}exports['GetVoiceCallReport']=function(_0x2ea572){var _0x493fe0=this;return new Promise(function(_0x5eed5d,_0x5c7cb3){return db[_0xf68a('0x15')]['findAll']({'raw':_0x2ea572[_0xf68a('0x16')]?_0x2ea572['options']['raw']===undefined?!![]:![]:!![],'where':_0x2ea572['options']?_0x2ea572[_0xf68a('0x16')]['where']||null:null,'attributes':_0x2ea572[_0xf68a('0x16')]?_0x2ea572[_0xf68a('0x16')]['attributes']||null:null,'limit':_0x2ea572[_0xf68a('0x16')]?_0x2ea572[_0xf68a('0x16')][_0xf68a('0x17')]||null:null,'include':_0x2ea572[_0xf68a('0x16')]?_0x2ea572['options'][_0xf68a('0x18')]?_[_0xf68a('0x19')](_0x2ea572[_0xf68a('0x16')][_0xf68a('0x18')],function(_0xfcd4b){return{'model':db[_0xfcd4b[_0xf68a('0x1a')]],'as':_0xfcd4b['as'],'attributes':_0xfcd4b['attributes'],'include':_0xfcd4b['include']?_['map'](_0xfcd4b[_0xf68a('0x18')],function(_0x3a1f61){return{'model':db[_0x3a1f61[_0xf68a('0x1a')]],'as':_0x3a1f61['as'],'attributes':_0x3a1f61[_0xf68a('0x1b')],'include':_0x3a1f61[_0xf68a('0x18')]?_[_0xf68a('0x19')](_0x3a1f61[_0xf68a('0x18')],function(_0x3391e8){return{'model':db[_0x3391e8['model']],'as':_0x3391e8['as'],'attributes':_0x3391e8[_0xf68a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf68a('0x9')](function(_0x14e8fd){logger['info'](_0xf68a('0x1c'),_0x2ea572);logger[_0xf68a('0xd')](_0xf68a('0x1c'),_0x2ea572,JSON[_0xf68a('0xf')](_0x14e8fd));_0x5eed5d(_0x14e8fd);})['catch'](function(_0x225dc1){logger[_0xf68a('0x11')](_0xf68a('0x1c'),_0x225dc1[_0xf68a('0x12')],_0x2ea572);_0x5c7cb3(_0x493fe0['error'](0x1f4,_0x225dc1[_0xf68a('0x12')]));});});};exports['CreateVoiceCallReport']=function(_0x26129f){var _0x35936b=this;return new Promise(function(_0x99c6f,_0x9bc60b){return db['VoiceCallReport'][_0xf68a('0x1d')](_0x26129f[_0xf68a('0x1e')],{'raw':_0x26129f[_0xf68a('0x16')]?_0x26129f[_0xf68a('0x16')][_0xf68a('0x1f')]===undefined?!![]:![]:!![]})[_0xf68a('0x9')](function(_0x816f1b){logger[_0xf68a('0xa')](_0xf68a('0x20'),_0x26129f);logger[_0xf68a('0xd')]('CreateVoiceCallReport',_0x26129f,JSON[_0xf68a('0xf')](_0x816f1b));_0x99c6f(_0x816f1b);})['catch'](function(_0x14ea63){logger['error'](_0xf68a('0x20'),_0x14ea63[_0xf68a('0x12')],_0x26129f);_0x9bc60b(_0x35936b[_0xf68a('0x11')](0x1f4,_0x14ea63[_0xf68a('0x12')]));});});};exports[_0xf68a('0x21')]=function(_0xedea0b){var _0x12e2af=this;return new Promise(function(_0xaaaab4,_0x322749){return db['VoiceCallReport'][_0xf68a('0x22')](_0xedea0b[_0xf68a('0x1e')],{'raw':_0xedea0b[_0xf68a('0x16')]?_0xedea0b[_0xf68a('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xedea0b[_0xf68a('0x16')]?_0xedea0b['options']['where']||null:null,'attributes':_0xedea0b[_0xf68a('0x16')]?_0xedea0b['options'][_0xf68a('0x1b')]||null:null,'limit':_0xedea0b[_0xf68a('0x16')]?_0xedea0b[_0xf68a('0x16')][_0xf68a('0x17')]||null:null})['then'](function(_0x2622e5){logger['info'](_0xf68a('0x21'),_0xedea0b);logger[_0xf68a('0xd')]('UpdateVoiceCallReport',_0xedea0b,JSON[_0xf68a('0xf')](_0x2622e5));_0xaaaab4(_0x2622e5);})['catch'](function(_0x27fba4){logger[_0xf68a('0x11')](_0xf68a('0x21'),_0x27fba4['message'],_0xedea0b);_0x322749(_0x12e2af[_0xf68a('0x11')](0x1f4,_0x27fba4['message']));});});}; \ No newline at end of file +var _0xb149=['CreateVoiceCallReport','create','raw','UpdateVoiceCallReport','update','body','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch','VoiceCallReport','findAll','options','where','attributes','include','map','model','then','GetVoiceCallReport'];(function(_0x1b1e76,_0x31695b){var _0x3d743a=function(_0x4ae27b){while(--_0x4ae27b){_0x1b1e76['push'](_0x1b1e76['shift']());}};_0x3d743a(++_0x31695b);}(_0xb149,0x110));var _0x9b14=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0xb149[_0x3ea913];return _0x2b4f28;};'use strict';var _=require(_0x9b14('0x0'));var util=require(_0x9b14('0x1'));var moment=require(_0x9b14('0x2'));var BPromise=require(_0x9b14('0x3'));var rs=require(_0x9b14('0x4'));var fs=require('fs');var Redis=require(_0x9b14('0x5'));var db=require(_0x9b14('0x6'))['db'];var utils=require(_0x9b14('0x7'));var logger=require('../../config/logger')(_0x9b14('0x8'));var config=require('../../config/environment');var jayson=require(_0x9b14('0x9'));var client=jayson['client'][_0x9b14('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30918a,_0x4f3bc9,_0x193ba9){return new BPromise(function(_0x4180e0,_0x2a582e){return client['request'](_0x30918a,_0x193ba9)['then'](function(_0x18d62e){logger[_0x9b14('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x4f3bc9,_0x9b14('0xc'));logger[_0x9b14('0xd')](_0x9b14('0xe'),_0x4f3bc9,'request\x20sent',JSON[_0x9b14('0xf')](_0x18d62e));if(_0x18d62e[_0x9b14('0x10')]){if(_0x18d62e[_0x9b14('0x10')][_0x9b14('0x11')]===0x1f4){logger[_0x9b14('0x10')](_0x9b14('0x12'),_0x4f3bc9,_0x18d62e[_0x9b14('0x10')]['message']);return _0x2a582e(_0x18d62e[_0x9b14('0x10')][_0x9b14('0x13')]);}logger[_0x9b14('0x10')](_0x9b14('0x12'),_0x4f3bc9,_0x18d62e[_0x9b14('0x10')][_0x9b14('0x13')]);return _0x4180e0(_0x18d62e[_0x9b14('0x10')][_0x9b14('0x13')]);}else{logger[_0x9b14('0xb')](_0x9b14('0x12'),_0x4f3bc9,_0x9b14('0xc'));_0x4180e0(_0x18d62e[_0x9b14('0x14')][_0x9b14('0x13')]);}})[_0x9b14('0x15')](function(_0x36ae8e){logger[_0x9b14('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x4f3bc9,_0x36ae8e);_0x2a582e(_0x36ae8e);});});}exports['GetVoiceCallReport']=function(_0x4fad66){var _0x20a733=this;return new Promise(function(_0x3a9aa9,_0x414558){return db[_0x9b14('0x16')][_0x9b14('0x17')]({'raw':_0x4fad66[_0x9b14('0x18')]?_0x4fad66['options']['raw']===undefined?!![]:![]:!![],'where':_0x4fad66[_0x9b14('0x18')]?_0x4fad66[_0x9b14('0x18')][_0x9b14('0x19')]||null:null,'attributes':_0x4fad66[_0x9b14('0x18')]?_0x4fad66['options'][_0x9b14('0x1a')]||null:null,'limit':_0x4fad66[_0x9b14('0x18')]?_0x4fad66['options']['limit']||null:null,'include':_0x4fad66[_0x9b14('0x18')]?_0x4fad66[_0x9b14('0x18')][_0x9b14('0x1b')]?_[_0x9b14('0x1c')](_0x4fad66[_0x9b14('0x18')][_0x9b14('0x1b')],function(_0x3b531b){return{'model':db[_0x3b531b['model']],'as':_0x3b531b['as'],'attributes':_0x3b531b[_0x9b14('0x1a')],'include':_0x3b531b[_0x9b14('0x1b')]?_[_0x9b14('0x1c')](_0x3b531b[_0x9b14('0x1b')],function(_0x4f1538){return{'model':db[_0x4f1538[_0x9b14('0x1d')]],'as':_0x4f1538['as'],'attributes':_0x4f1538[_0x9b14('0x1a')],'include':_0x4f1538[_0x9b14('0x1b')]?_[_0x9b14('0x1c')](_0x4f1538[_0x9b14('0x1b')],function(_0x466c98){return{'model':db[_0x466c98[_0x9b14('0x1d')]],'as':_0x466c98['as'],'attributes':_0x466c98[_0x9b14('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9b14('0x1e')](function(_0x2aa2a5){logger[_0x9b14('0xb')](_0x9b14('0x1f'),_0x4fad66);logger[_0x9b14('0xd')](_0x9b14('0x1f'),_0x4fad66,JSON[_0x9b14('0xf')](_0x2aa2a5));_0x3a9aa9(_0x2aa2a5);})[_0x9b14('0x15')](function(_0x4ba6d2){logger['error'](_0x9b14('0x1f'),_0x4ba6d2[_0x9b14('0x13')],_0x4fad66);_0x414558(_0x20a733[_0x9b14('0x10')](0x1f4,_0x4ba6d2[_0x9b14('0x13')]));});});};exports[_0x9b14('0x20')]=function(_0x2bfdd1){var _0x2177ef=this;return new Promise(function(_0x46cd8c,_0x15a2b2){return db[_0x9b14('0x16')][_0x9b14('0x21')](_0x2bfdd1['body'],{'raw':_0x2bfdd1[_0x9b14('0x18')]?_0x2bfdd1[_0x9b14('0x18')][_0x9b14('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0x373fc6){logger[_0x9b14('0xb')](_0x9b14('0x20'),_0x2bfdd1);logger[_0x9b14('0xd')](_0x9b14('0x20'),_0x2bfdd1,JSON[_0x9b14('0xf')](_0x373fc6));_0x46cd8c(_0x373fc6);})[_0x9b14('0x15')](function(_0x59922e){logger['error'](_0x9b14('0x20'),_0x59922e[_0x9b14('0x13')],_0x2bfdd1);_0x15a2b2(_0x2177ef[_0x9b14('0x10')](0x1f4,_0x59922e[_0x9b14('0x13')]));});});};exports[_0x9b14('0x23')]=function(_0x3b1af2){var _0xe60ef3=this;return new Promise(function(_0x4df6a7,_0xc9665){return db[_0x9b14('0x16')][_0x9b14('0x24')](_0x3b1af2[_0x9b14('0x25')],{'raw':_0x3b1af2[_0x9b14('0x18')]?_0x3b1af2[_0x9b14('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b1af2[_0x9b14('0x18')]?_0x3b1af2[_0x9b14('0x18')][_0x9b14('0x19')]||null:null,'attributes':_0x3b1af2['options']?_0x3b1af2[_0x9b14('0x18')][_0x9b14('0x1a')]||null:null,'limit':_0x3b1af2[_0x9b14('0x18')]?_0x3b1af2[_0x9b14('0x18')]['limit']||null:null})['then'](function(_0xe2c9d1){logger[_0x9b14('0xb')](_0x9b14('0x23'),_0x3b1af2);logger[_0x9b14('0xd')](_0x9b14('0x23'),_0x3b1af2,JSON[_0x9b14('0xf')](_0xe2c9d1));_0x4df6a7(_0xe2c9d1);})[_0x9b14('0x15')](function(_0x5f3e74){logger['error'](_0x9b14('0x23'),_0x5f3e74[_0x9b14('0x13')],_0x3b1af2);_0xc9665(_0xe60ef3[_0x9b14('0x10')](0x1f4,_0x5f3e74[_0x9b14('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index ea44454..247e0d7 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 _0xad30=['../../config/environment','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x17692c,_0x520d2c){var _0x12d1d0=function(_0x2493ef){while(--_0x2493ef){_0x17692c['push'](_0x17692c['shift']());}};_0x12d1d0(++_0x520d2c);}(_0xad30,0x82));var _0x0ad3=function(_0x189069,_0x356af3){_0x189069=_0x189069-0x0;var _0x557ef6=_0xad30[_0x189069];return _0x557ef6;};'use strict';var multer=require(_0x0ad3('0x0'));var util=require(_0x0ad3('0x1'));var path=require(_0x0ad3('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ad3('0x3'));var router=express['Router']();var auth=require(_0x0ad3('0x4'));var interaction=require(_0x0ad3('0x5'));var config=require(_0x0ad3('0x6'));var controller=require('./voiceChanSpy.controller');router[_0x0ad3('0x7')]('/',auth[_0x0ad3('0x8')](),controller[_0x0ad3('0x9')]);router[_0x0ad3('0x7')](_0x0ad3('0xa'),auth[_0x0ad3('0x8')](),controller['show']);router['post']('/',auth[_0x0ad3('0x8')](),controller[_0x0ad3('0xb')]);router[_0x0ad3('0xc')](_0x0ad3('0xa'),auth[_0x0ad3('0x8')](),controller[_0x0ad3('0xd')]);router[_0x0ad3('0xe')](_0x0ad3('0xa'),auth['isAuthenticated'](),controller[_0x0ad3('0xf')]);module[_0x0ad3('0x10')]=router; \ No newline at end of file +var _0x64c4=['get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2e2568,_0x3f4818){var _0x58c455=function(_0x272a58){while(--_0x272a58){_0x2e2568['push'](_0x2e2568['shift']());}};_0x58c455(++_0x3f4818);}(_0x64c4,0x13a));var _0x464c=function(_0x412f6b,_0x40da83){_0x412f6b=_0x412f6b-0x0;var _0x3b1c2b=_0x64c4[_0x412f6b];return _0x3b1c2b;};'use strict';var multer=require('multer');var util=require(_0x464c('0x0'));var path=require('path');var timeout=require(_0x464c('0x1'));var express=require(_0x464c('0x2'));var router=express['Router']();var auth=require(_0x464c('0x3'));var interaction=require(_0x464c('0x4'));var config=require(_0x464c('0x5'));var controller=require('./voiceChanSpy.controller');router[_0x464c('0x6')]('/',auth[_0x464c('0x7')](),controller[_0x464c('0x8')]);router[_0x464c('0x6')](_0x464c('0x9'),auth['isAuthenticated'](),controller[_0x464c('0xa')]);router[_0x464c('0xb')]('/',auth[_0x464c('0x7')](),controller[_0x464c('0xc')]);router['put'](_0x464c('0x9'),auth[_0x464c('0x7')](),controller[_0x464c('0xd')]);router[_0x464c('0xe')](_0x464c('0x9'),auth['isAuthenticated'](),controller[_0x464c('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 65144ad..c346189 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 _0x1d5b=['STRING','name','setDataValue','join','getDataValue','options','split','BOOLEAN','sequelize','exports'];(function(_0x4f35ba,_0x2c07c3){var _0x28db05=function(_0x19298e){while(--_0x19298e){_0x4f35ba['push'](_0x4f35ba['shift']());}};_0x28db05(++_0x2c07c3);}(_0x1d5b,0xa8));var _0xb1d5=function(_0x86c352,_0x4c1b72){_0x86c352=_0x86c352-0x0;var _0x1a4086=_0x1d5b[_0x86c352];return _0x1a4086;};'use strict';var Sequelize=require(_0xb1d5('0x0'));module[_0xb1d5('0x1')]={'name':{'type':Sequelize[_0xb1d5('0x2')]},'prefix':{'type':Sequelize[_0xb1d5('0x2')],'unique':_0xb1d5('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xb1d5('0x2')],'set':function(_0x5acd5a){this[_0xb1d5('0x4')]('options',_0x5acd5a?_0x5acd5a[_0xb1d5('0x5')](''):[]);},'get':function(){return this[_0xb1d5('0x6')](_0xb1d5('0x7'))?this['getDataValue'](_0xb1d5('0x7'))[_0xb1d5('0x8')](''):[];}},'auth':{'type':Sequelize[_0xb1d5('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0xb1d5('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xb1d5('0x2')]},'description':{'type':Sequelize[_0xb1d5('0x2')]}}; \ No newline at end of file +var _0x0c98=['join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','options'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x0c98,0x7c));var _0x80c9=function(_0x1a2707,_0x3588f8){_0x1a2707=_0x1a2707-0x0;var _0x35e93c=_0x0c98[_0x1a2707];return _0x35e93c;};'use strict';var Sequelize=require(_0x80c9('0x0'));module[_0x80c9('0x1')]={'name':{'type':Sequelize[_0x80c9('0x2')]},'prefix':{'type':Sequelize[_0x80c9('0x2')],'unique':_0x80c9('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x1325f5){this[_0x80c9('0x4')](_0x80c9('0x5'),_0x1325f5?_0x1325f5[_0x80c9('0x6')](''):[]);},'get':function(){return this[_0x80c9('0x7')](_0x80c9('0x5'))?this[_0x80c9('0x7')]('options')[_0x80c9('0x8')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x80c9('0x2')]},'record':{'type':Sequelize[_0x80c9('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x80c9('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 3671da1..18a9109 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 _0xdb22=['destroy','get','UserProfileResource','then','end','error','stack','name','index','VoiceChanSpy','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','offset','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','create','body','user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','zip-dir','request-promise','moment','mustache','util','to-csv','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','json','count','limit','Content-Range'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xdb22,0x1d1));var _0x2db2=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xdb22[_0x167cc1];return _0x10bc4b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2db2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2db2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2db2('0x2'));var moment=require(_0x2db2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2db2('0x4'));var util=require(_0x2db2('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x2db2('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2db2('0x7'));var squel=require(_0x2db2('0x8'));var crypto=require('crypto');var jsforce=require(_0x2db2('0x9'));var deskjs=require(_0x2db2('0xa'));var toCsv=require(_0x2db2('0x6'));var querystring=require(_0x2db2('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2db2('0xc'));var qs=require(_0x2db2('0xd'));var as=require(_0x2db2('0xe'));var hardwareService=require(_0x2db2('0xf'));var logger=require(_0x2db2('0x10'))(_0x2db2('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2db2('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x132c74,_0x8752d6){_0x8752d6=_0x8752d6||0xcc;return function(_0xe73440){if(_0xe73440){return _0x132c74[_0x2db2('0x13')](_0x8752d6);}return _0x132c74['status'](_0x8752d6)['end']();};}function respondWithResult(_0x1dc16a,_0x1396a1){_0x1396a1=_0x1396a1||0xc8;return function(_0xf2bcd1){if(_0xf2bcd1){return _0x1dc16a[_0x2db2('0x14')](_0x1396a1)[_0x2db2('0x15')](_0xf2bcd1);}};}function respondWithFilteredResult(_0x24a655,_0x37af21){return function(_0x43ffcb){if(_0x43ffcb){var _0xb664c6=_0x43ffcb[_0x2db2('0x16')],_0xcd41d8=_0x37af21['offset'],_0x213c60=_0x37af21['offset']+_0x37af21[_0x2db2('0x17')],_0x2be77f;if(_0x213c60>=_0xb664c6){_0x213c60=_0xb664c6;_0x2be77f=0xc8;}else{_0x2be77f=0xce;}_0x24a655[_0x2db2('0x14')](_0x2be77f);return _0x24a655['set'](_0x2db2('0x18'),_0xcd41d8+'-'+_0x213c60+'/'+_0xb664c6)[_0x2db2('0x15')](_0x43ffcb);}return null;};}function patchUpdates(_0x40b325){return function(_0x293b11){try{jsonpatch['apply'](_0x293b11,_0x40b325,!![]);}catch(_0xfa330f){return BPromise['reject'](_0xfa330f);}return _0x293b11['save']();};}function saveUpdates(_0x241f7e,_0x336967){return function(_0x295b63){if(_0x295b63){return _0x295b63['update'](_0x241f7e)['then'](function(_0x592a8f){return _0x592a8f;});}return null;};}function removeEntity(_0x1ed23b,_0x477c21){return function(_0x144bbb){if(_0x144bbb){return _0x144bbb[_0x2db2('0x19')]()['then'](function(){var _0x4b22fd=_0x144bbb[_0x2db2('0x1a')]({'plain':!![]});var _0x4d1507='ChanSpies';return db[_0x2db2('0x1b')][_0x2db2('0x19')]({'where':{'type':_0x4d1507,'resourceId':_0x4b22fd['id']}})[_0x2db2('0x1c')](function(){return _0x144bbb;});})[_0x2db2('0x1c')](function(){_0x1ed23b[_0x2db2('0x14')](0xcc)[_0x2db2('0x1d')]();});}};}function handleEntityNotFound(_0x4cea0a,_0xb88a5e){return function(_0x5f3c30){if(!_0x5f3c30){_0x4cea0a[_0x2db2('0x13')](0x194);}return _0x5f3c30;};}function handleError(_0x56265e,_0x4e24d8){_0x4e24d8=_0x4e24d8||0x1f4;return function(_0x40394e){logger[_0x2db2('0x1e')](_0x40394e[_0x2db2('0x1f')]);if(_0x40394e[_0x2db2('0x20')]){delete _0x40394e[_0x2db2('0x20')];}_0x56265e[_0x2db2('0x14')](_0x4e24d8)['send'](_0x40394e);};}exports[_0x2db2('0x21')]=function(_0x178312,_0x5051b2){var _0x565008={},_0x34e4f2={},_0xaa49de={'count':0x0,'rows':[]};var _0x10bc6f=_['map'](db[_0x2db2('0x22')][_0x2db2('0x23')],function(_0x108fff){return{'name':_0x108fff[_0x2db2('0x24')],'type':_0x108fff[_0x2db2('0x25')]['key']};});_0x34e4f2[_0x2db2('0x26')]=_[_0x2db2('0x27')](_0x10bc6f,'name');_0x34e4f2[_0x2db2('0x28')]=_['keys'](_0x178312[_0x2db2('0x28')]);_0x34e4f2[_0x2db2('0x29')]=_[_0x2db2('0x2a')](_0x34e4f2[_0x2db2('0x26')],_0x34e4f2[_0x2db2('0x28')]);_0x565008[_0x2db2('0x2b')]=_[_0x2db2('0x2a')](_0x34e4f2[_0x2db2('0x26')],qs[_0x2db2('0x2c')](_0x178312[_0x2db2('0x28')]['fields']));_0x565008[_0x2db2('0x2b')]=_0x565008[_0x2db2('0x2b')][_0x2db2('0x2d')]?_0x565008['attributes']:_0x34e4f2[_0x2db2('0x26')];if(!_0x178312[_0x2db2('0x28')]['hasOwnProperty']('nolimit')){_0x565008[_0x2db2('0x17')]=qs['limit'](_0x178312[_0x2db2('0x28')]['limit']);_0x565008[_0x2db2('0x2e')]=qs[_0x2db2('0x2e')](_0x178312[_0x2db2('0x28')][_0x2db2('0x2e')]);}_0x565008[_0x2db2('0x2f')]=qs[_0x2db2('0x30')](_0x178312[_0x2db2('0x28')]['sort']);_0x565008[_0x2db2('0x31')]=qs['filters'](_[_0x2db2('0x32')](_0x178312['query'],_0x34e4f2[_0x2db2('0x29')]),_0x10bc6f);if(_0x178312[_0x2db2('0x28')]['filter']){_0x565008[_0x2db2('0x31')]=_[_0x2db2('0x33')](_0x565008[_0x2db2('0x31')],{'$or':_[_0x2db2('0x27')](_0x10bc6f,function(_0x25d582){if(_0x25d582['type']!==_0x2db2('0x34')){var _0x3418e7={};_0x3418e7[_0x25d582['name']]={'$like':'%'+_0x178312[_0x2db2('0x28')]['filter']+'%'};return _0x3418e7;}})});}_0x565008=_[_0x2db2('0x33')]({},_0x565008,_0x178312[_0x2db2('0x35')]);var _0x4af1b3={'where':_0x565008[_0x2db2('0x31')]};return db[_0x2db2('0x22')][_0x2db2('0x16')](_0x4af1b3)[_0x2db2('0x1c')](function(_0x400d41){_0xaa49de[_0x2db2('0x16')]=_0x400d41;if(_0x178312['query'][_0x2db2('0x36')]){_0x565008[_0x2db2('0x37')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x565008);})[_0x2db2('0x1c')](function(_0x199e70){_0xaa49de[_0x2db2('0x38')]=_0x199e70;return _0xaa49de;})[_0x2db2('0x1c')](respondWithFilteredResult(_0x5051b2,_0x565008))[_0x2db2('0x39')](handleError(_0x5051b2,null));};exports[_0x2db2('0x3a')]=function(_0x5705ca,_0x2f2493){var _0x4144ec={'raw':![],'where':{'id':_0x5705ca[_0x2db2('0x3b')]['id']}},_0x5d95a3={};_0x5d95a3[_0x2db2('0x26')]=_[_0x2db2('0x3c')](db['VoiceChanSpy']['rawAttributes']);_0x5d95a3[_0x2db2('0x28')]=_[_0x2db2('0x3c')](_0x5705ca['query']);_0x5d95a3[_0x2db2('0x29')]=_[_0x2db2('0x2a')](_0x5d95a3['model'],_0x5d95a3[_0x2db2('0x28')]);_0x4144ec[_0x2db2('0x2b')]=_[_0x2db2('0x2a')](_0x5d95a3[_0x2db2('0x26')],qs[_0x2db2('0x2c')](_0x5705ca['query'][_0x2db2('0x2c')]));_0x4144ec[_0x2db2('0x2b')]=_0x4144ec[_0x2db2('0x2b')][_0x2db2('0x2d')]?_0x4144ec['attributes']:_0x5d95a3[_0x2db2('0x26')];if(_0x5705ca[_0x2db2('0x28')][_0x2db2('0x36')]){_0x4144ec['include']=[{'all':!![]}];}_0x4144ec=_['merge']({},_0x4144ec,_0x5705ca[_0x2db2('0x35')]);return db[_0x2db2('0x22')]['find'](_0x4144ec)['then'](handleEntityNotFound(_0x2f2493,null))[_0x2db2('0x1c')](respondWithResult(_0x2f2493,null))[_0x2db2('0x39')](handleError(_0x2f2493,null));};exports[_0x2db2('0x3d')]=function(_0x522b82,_0x1875bf){return db[_0x2db2('0x22')][_0x2db2('0x3d')](_0x522b82[_0x2db2('0x3e')],{})[_0x2db2('0x1c')](function(_0x328fd1){var _0x5e5163=_0x522b82[_0x2db2('0x3f')][_0x2db2('0x1a')]({'plain':!![]});if(!_0x5e5163)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e5163[_0x2db2('0x40')]===_0x2db2('0x3f')){var _0x266618=_0x328fd1[_0x2db2('0x1a')]({'plain':!![]});var _0x25d16f='ChanSpies';return db['UserProfileSection'][_0x2db2('0x41')]({'where':{'name':_0x25d16f,'userProfileId':_0x5e5163[_0x2db2('0x42')]},'raw':!![]})['then'](function(_0x57c9d4){if(_0x57c9d4&&_0x57c9d4[_0x2db2('0x43')]===0x0){return db[_0x2db2('0x1b')][_0x2db2('0x3d')]({'name':_0x266618[_0x2db2('0x20')],'resourceId':_0x266618['id'],'type':_0x57c9d4['name'],'sectionId':_0x57c9d4['id']},{})[_0x2db2('0x1c')](function(){return _0x328fd1;});}else{return _0x328fd1;}})[_0x2db2('0x39')](function(_0x182797){logger[_0x2db2('0x1e')](_0x2db2('0x44'),_0x182797);throw _0x182797;});}return _0x328fd1;})[_0x2db2('0x1c')](respondWithResult(_0x1875bf,0xc9))[_0x2db2('0x39')](handleError(_0x1875bf,null));};exports[_0x2db2('0x45')]=function(_0x189bc4,_0x3dc74c){if(_0x189bc4[_0x2db2('0x3e')]['id']){delete _0x189bc4[_0x2db2('0x3e')]['id'];}return db[_0x2db2('0x22')][_0x2db2('0x41')]({'where':{'id':_0x189bc4[_0x2db2('0x3b')]['id']}})[_0x2db2('0x1c')](handleEntityNotFound(_0x3dc74c,null))[_0x2db2('0x1c')](saveUpdates(_0x189bc4[_0x2db2('0x3e')],null))[_0x2db2('0x1c')](respondWithResult(_0x3dc74c,null))[_0x2db2('0x39')](handleError(_0x3dc74c,null));};exports[_0x2db2('0x19')]=function(_0x1a04be,_0x507672){return db[_0x2db2('0x22')][_0x2db2('0x41')]({'where':{'id':_0x1a04be[_0x2db2('0x3b')]['id']}})[_0x2db2('0x1c')](handleEntityNotFound(_0x507672,null))[_0x2db2('0x1c')](removeEntity(_0x507672,null))['catch'](handleError(_0x507672,null));}; \ No newline at end of file +var _0x7e42=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','end','json','count','offset','limit','status','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','where','pick','filter','merge','options','VoiceChanSpy','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x7e42,0x144));var _0x27e4=function(_0x5b2251,_0x249324){_0x5b2251=_0x5b2251-0x0;var _0x25be78=_0x7e42[_0x5b2251];return _0x25be78;};'use strict';var pdf=require(_0x27e4('0x0'));var emlformat=require(_0x27e4('0x1'));var rimraf=require(_0x27e4('0x2'));var zipdir=require(_0x27e4('0x3'));var jsonpatch=require(_0x27e4('0x4'));var rp=require(_0x27e4('0x5'));var moment=require('moment');var BPromise=require(_0x27e4('0x6'));var Mustache=require(_0x27e4('0x7'));var util=require(_0x27e4('0x8'));var path=require(_0x27e4('0x9'));var sox=require(_0x27e4('0xa'));var csv=require(_0x27e4('0xb'));var ejs=require(_0x27e4('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x27e4('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x27e4('0xe'));var toCsv=require(_0x27e4('0xb'));var querystring=require(_0x27e4('0xf'));var Papa=require(_0x27e4('0x10'));var Redis=require(_0x27e4('0x11'));var authService=require(_0x27e4('0x12'));var qs=require(_0x27e4('0x13'));var as=require(_0x27e4('0x14'));var hardwareService=require(_0x27e4('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x27e4('0x16'));var config=require(_0x27e4('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35f4bc,_0x2ee6e9){_0x2ee6e9=_0x2ee6e9||0xcc;return function(_0x5c0e56){if(_0x5c0e56){return _0x35f4bc[_0x27e4('0x18')](_0x2ee6e9);}return _0x35f4bc['status'](_0x2ee6e9)[_0x27e4('0x19')]();};}function respondWithResult(_0x4cdd9e,_0x449be9){_0x449be9=_0x449be9||0xc8;return function(_0x5a0052){if(_0x5a0052){return _0x4cdd9e['status'](_0x449be9)[_0x27e4('0x1a')](_0x5a0052);}};}function respondWithFilteredResult(_0xd66ce6,_0x52653e){return function(_0x2161e3){if(_0x2161e3){var _0x6fc201=_0x2161e3[_0x27e4('0x1b')],_0x22256e=_0x52653e['offset'],_0x5be4e1=_0x52653e[_0x27e4('0x1c')]+_0x52653e[_0x27e4('0x1d')],_0xb2dc2c;if(_0x5be4e1>=_0x6fc201){_0x5be4e1=_0x6fc201;_0xb2dc2c=0xc8;}else{_0xb2dc2c=0xce;}_0xd66ce6[_0x27e4('0x1e')](_0xb2dc2c);return _0xd66ce6['set'](_0x27e4('0x1f'),_0x22256e+'-'+_0x5be4e1+'/'+_0x6fc201)[_0x27e4('0x1a')](_0x2161e3);}return null;};}function patchUpdates(_0x3dd21c){return function(_0x1fd685){try{jsonpatch[_0x27e4('0x20')](_0x1fd685,_0x3dd21c,!![]);}catch(_0x5e6277){return BPromise['reject'](_0x5e6277);}return _0x1fd685[_0x27e4('0x21')]();};}function saveUpdates(_0x108c33,_0x4a8138){return function(_0x198ee7){if(_0x198ee7){return _0x198ee7[_0x27e4('0x22')](_0x108c33)[_0x27e4('0x23')](function(_0x570dbf){return _0x570dbf;});}return null;};}function removeEntity(_0x13e5d1,_0x4aa1a5){return function(_0x21f907){if(_0x21f907){return _0x21f907[_0x27e4('0x24')]()[_0x27e4('0x23')](function(){var _0x110f0d=_0x21f907[_0x27e4('0x25')]({'plain':!![]});var _0x3001aa='ChanSpies';return db[_0x27e4('0x26')][_0x27e4('0x24')]({'where':{'type':_0x3001aa,'resourceId':_0x110f0d['id']}})['then'](function(){return _0x21f907;});})[_0x27e4('0x23')](function(){_0x13e5d1['status'](0xcc)[_0x27e4('0x19')]();});}};}function handleEntityNotFound(_0x5f4dc4,_0xe2ae2c){return function(_0x3e4a86){if(!_0x3e4a86){_0x5f4dc4[_0x27e4('0x18')](0x194);}return _0x3e4a86;};}function handleError(_0x117ccc,_0x317758){_0x317758=_0x317758||0x1f4;return function(_0x103505){logger[_0x27e4('0x27')](_0x103505[_0x27e4('0x28')]);if(_0x103505[_0x27e4('0x29')]){delete _0x103505[_0x27e4('0x29')];}_0x117ccc[_0x27e4('0x1e')](_0x317758)[_0x27e4('0x2a')](_0x103505);};}exports[_0x27e4('0x2b')]=function(_0x58bfa2,_0xfb4983){var _0x44f4c6={},_0x1d411b={},_0x5cbe71={'count':0x0,'rows':[]};var _0x223680=_[_0x27e4('0x2c')](db['VoiceChanSpy'][_0x27e4('0x2d')],function(_0x9c9797){return{'name':_0x9c9797[_0x27e4('0x2e')],'type':_0x9c9797[_0x27e4('0x2f')]['key']};});_0x1d411b[_0x27e4('0x30')]=_[_0x27e4('0x2c')](_0x223680,_0x27e4('0x29'));_0x1d411b[_0x27e4('0x31')]=_[_0x27e4('0x32')](_0x58bfa2[_0x27e4('0x31')]);_0x1d411b[_0x27e4('0x33')]=_[_0x27e4('0x34')](_0x1d411b['model'],_0x1d411b['query']);_0x44f4c6[_0x27e4('0x35')]=_[_0x27e4('0x34')](_0x1d411b[_0x27e4('0x30')],qs[_0x27e4('0x36')](_0x58bfa2['query'][_0x27e4('0x36')]));_0x44f4c6[_0x27e4('0x35')]=_0x44f4c6['attributes']['length']?_0x44f4c6[_0x27e4('0x35')]:_0x1d411b[_0x27e4('0x30')];if(!_0x58bfa2['query']['hasOwnProperty'](_0x27e4('0x37'))){_0x44f4c6['limit']=qs['limit'](_0x58bfa2[_0x27e4('0x31')][_0x27e4('0x1d')]);_0x44f4c6['offset']=qs[_0x27e4('0x1c')](_0x58bfa2['query'][_0x27e4('0x1c')]);}_0x44f4c6[_0x27e4('0x38')]=qs['sort'](_0x58bfa2['query']['sort']);_0x44f4c6[_0x27e4('0x39')]=qs[_0x27e4('0x33')](_[_0x27e4('0x3a')](_0x58bfa2[_0x27e4('0x31')],_0x1d411b[_0x27e4('0x33')]),_0x223680);if(_0x58bfa2[_0x27e4('0x31')][_0x27e4('0x3b')]){_0x44f4c6[_0x27e4('0x39')]=_['merge'](_0x44f4c6[_0x27e4('0x39')],{'$or':_['map'](_0x223680,function(_0xed7c77){if(_0xed7c77[_0x27e4('0x2f')]!=='VIRTUAL'){var _0x59c7a0={};_0x59c7a0[_0xed7c77[_0x27e4('0x29')]]={'$like':'%'+_0x58bfa2['query']['filter']+'%'};return _0x59c7a0;}})});}_0x44f4c6=_[_0x27e4('0x3c')]({},_0x44f4c6,_0x58bfa2[_0x27e4('0x3d')]);var _0x246f39={'where':_0x44f4c6[_0x27e4('0x39')]};return db[_0x27e4('0x3e')][_0x27e4('0x1b')](_0x246f39)[_0x27e4('0x23')](function(_0x14533b){_0x5cbe71[_0x27e4('0x1b')]=_0x14533b;if(_0x58bfa2['query']['includeAll']){_0x44f4c6[_0x27e4('0x3f')]=[{'all':!![]}];}return db[_0x27e4('0x3e')][_0x27e4('0x40')](_0x44f4c6);})['then'](function(_0x20da80){_0x5cbe71[_0x27e4('0x41')]=_0x20da80;return _0x5cbe71;})[_0x27e4('0x23')](respondWithFilteredResult(_0xfb4983,_0x44f4c6))[_0x27e4('0x42')](handleError(_0xfb4983,null));};exports[_0x27e4('0x43')]=function(_0x1a2705,_0x22b9ad){var _0xba83b0={'raw':![],'where':{'id':_0x1a2705[_0x27e4('0x44')]['id']}},_0x53c7a6={};_0x53c7a6['model']=_[_0x27e4('0x32')](db[_0x27e4('0x3e')]['rawAttributes']);_0x53c7a6[_0x27e4('0x31')]=_['keys'](_0x1a2705[_0x27e4('0x31')]);_0x53c7a6[_0x27e4('0x33')]=_[_0x27e4('0x34')](_0x53c7a6[_0x27e4('0x30')],_0x53c7a6[_0x27e4('0x31')]);_0xba83b0['attributes']=_[_0x27e4('0x34')](_0x53c7a6[_0x27e4('0x30')],qs[_0x27e4('0x36')](_0x1a2705[_0x27e4('0x31')][_0x27e4('0x36')]));_0xba83b0['attributes']=_0xba83b0[_0x27e4('0x35')][_0x27e4('0x45')]?_0xba83b0['attributes']:_0x53c7a6[_0x27e4('0x30')];if(_0x1a2705[_0x27e4('0x31')][_0x27e4('0x46')]){_0xba83b0['include']=[{'all':!![]}];}_0xba83b0=_[_0x27e4('0x3c')]({},_0xba83b0,_0x1a2705['options']);return db[_0x27e4('0x3e')][_0x27e4('0x47')](_0xba83b0)['then'](handleEntityNotFound(_0x22b9ad,null))[_0x27e4('0x23')](respondWithResult(_0x22b9ad,null))[_0x27e4('0x42')](handleError(_0x22b9ad,null));};exports[_0x27e4('0x48')]=function(_0x304819,_0x4b30df){return db[_0x27e4('0x3e')][_0x27e4('0x48')](_0x304819[_0x27e4('0x49')],{})[_0x27e4('0x23')](function(_0x27b215){var _0x541867=_0x304819[_0x27e4('0x4a')][_0x27e4('0x25')]({'plain':!![]});if(!_0x541867)throw new Error(_0x27e4('0x4b'));if(_0x541867[_0x27e4('0x4c')]==='user'){var _0x2d7c0d=_0x27b215[_0x27e4('0x25')]({'plain':!![]});var _0x3a0218=_0x27e4('0x4d');return db[_0x27e4('0x4e')][_0x27e4('0x47')]({'where':{'name':_0x3a0218,'userProfileId':_0x541867[_0x27e4('0x4f')]},'raw':!![]})[_0x27e4('0x23')](function(_0x30f291){if(_0x30f291&&_0x30f291['autoAssociation']===0x0){return db['UserProfileResource'][_0x27e4('0x48')]({'name':_0x2d7c0d[_0x27e4('0x29')],'resourceId':_0x2d7c0d['id'],'type':_0x30f291['name'],'sectionId':_0x30f291['id']},{})['then'](function(){return _0x27b215;});}else{return _0x27b215;}})[_0x27e4('0x42')](function(_0x484c6d){logger[_0x27e4('0x27')](_0x27e4('0x50'),_0x484c6d);throw _0x484c6d;});}return _0x27b215;})[_0x27e4('0x23')](respondWithResult(_0x4b30df,0xc9))['catch'](handleError(_0x4b30df,null));};exports[_0x27e4('0x22')]=function(_0x16bc19,_0x3bad9f){if(_0x16bc19[_0x27e4('0x49')]['id']){delete _0x16bc19[_0x27e4('0x49')]['id'];}return db[_0x27e4('0x3e')][_0x27e4('0x47')]({'where':{'id':_0x16bc19[_0x27e4('0x44')]['id']}})[_0x27e4('0x23')](handleEntityNotFound(_0x3bad9f,null))['then'](saveUpdates(_0x16bc19[_0x27e4('0x49')],null))[_0x27e4('0x23')](respondWithResult(_0x3bad9f,null))[_0x27e4('0x42')](handleError(_0x3bad9f,null));};exports[_0x27e4('0x24')]=function(_0x4bc4c1,_0x301457){return db['VoiceChanSpy'][_0x27e4('0x47')]({'where':{'id':_0x4bc4c1[_0x27e4('0x44')]['id']}})[_0x27e4('0x23')](handleEntityNotFound(_0x301457,null))['then'](removeEntity(_0x301457,null))['catch'](handleError(_0x301457,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 43cc6e1..de31ccd 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 _0x380a=['destroy','lodash','util','bluebird','context','from-sip','format','push','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','auth','merge','Authenticate','password','SIP/%s,%s','name','join','StopMixMonitor','length','internal','concat','agent','catch','exports','models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate'];(function(_0x396e16,_0x77cec0){var _0x4db08f=function(_0x4fbec0){while(--_0x4fbec0){_0x396e16['push'](_0x396e16['shift']());}};_0x4db08f(++_0x77cec0);}(_0x380a,0x16c));var _0xa380=function(_0x24c135,_0xdb4450){_0x24c135=_0x24c135-0x0;var _0x290c66=_0x380a[_0x24c135];return _0x290c66;};'use strict';var _=require(_0xa380('0x0'));var util=require(_0xa380('0x1'));var BPromise=require(_0xa380('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x120792,_0x56b1d7,_0x4bb205){var _0xfb00ee=0x1;var _0x54a96f=[];var _0x57953d={'context':_0x56b1d7[_0xa380('0x3')]||_0xa380('0x4'),'exten':util[_0xa380('0x5')]('%s%s',_0x120792['prefix'],_0x4bb205),'type':'system','isApp':![],'ChanSpyId':_0x120792['id'],'UserId':_0x56b1d7['id']};_0x54a96f[_0xa380('0x6')](_['merge']({'app':'Set','appdata':util[_0xa380('0x5')](_0xa380('0x7'),_0xa380('0x8')),'priority':_0xfb00ee++},_0x57953d));if(_0x120792[_0xa380('0x9')]){_0x54a96f['push'](_['merge']({'app':'MixMonitor','appdata':util[_0xa380('0x5')](_0xa380('0xa'),_0x120792['recordingFormat']),'priority':_0xfb00ee++},_0x57953d));}if(_0x120792[_0xa380('0xb')]){_0x54a96f[_0xa380('0x6')](_[_0xa380('0xc')]({'app':_0xa380('0xd'),'appdata':_0x120792[_0xa380('0xe')],'priority':_0xfb00ee++},_0x57953d));}_0x54a96f[_0xa380('0x6')](_[_0xa380('0xc')]({'app':'ChanSpy','appdata':util[_0xa380('0x5')](_0xa380('0xf'),_0x56b1d7[_0xa380('0x10')],_0x120792['options']?_0x120792['options'][_0xa380('0x11')](''):''),'priority':_0xfb00ee++},_0x57953d));if(_0x120792[_0xa380('0x9')]){_0x54a96f[_0xa380('0x6')](_[_0xa380('0xc')]({'app':_0xa380('0x12'),'priority':_0xfb00ee++},_0x57953d));}return _0x54a96f;};var getChanSpyApplications=function(_0x3a713e,_0x4c0021){var _0x34dfa1=[];for(var _0x5cb63d=0x0,_0x286316=0x1;_0x5cb63d<_0x4c0021[_0xa380('0x13')];_0x5cb63d++,_0x286316=0x1){_0x34dfa1=_0x34dfa1['concat'](getUserApplications(_0x3a713e,_0x4c0021[_0x5cb63d],_0x4c0021[_0x5cb63d][_0xa380('0x14')]));if(_0x4c0021[_0x5cb63d][_0xa380('0x14')]!=_0x4c0021[_0x5cb63d][_0xa380('0x10')]){_0x34dfa1=_0x34dfa1[_0xa380('0x15')](getUserApplications(_0x3a713e,_0x4c0021[_0x5cb63d],_0x4c0021[_0x5cb63d]['name']));}}return _0x34dfa1;};var getChanSpyPromise=function(_0xe38bfa,_0x3779bc){return new BPromise(function(_0xc6e3ae,_0x926459){return _0xe38bfa['User']['findAll']({'attributes':['id','name',_0xa380('0x14')],'where':{'role':_0xa380('0x16'),'chanspy':!![]},'raw':!![]})['then'](function(_0x78cb1c){if(_0x78cb1c){return _0xc6e3ae(getChanSpyApplications(_0x3779bc,_0x78cb1c));}return _0xc6e3ae([]);})[_0xa380('0x17')](function(_0x9d2294){_0x926459(_0x9d2294);});});};module[_0xa380('0x18')]=function(_0x250acf,_0x16753e){var _0x43fe4b=_0x250acf[_0xa380('0x19')];return _0x250acf[_0xa380('0x1a')](_0xa380('0x1b'),attributes,{'tableName':_0xa380('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x23b05f,_0x2a3023,_0x5cc7f6){return getChanSpyPromise(_0x43fe4b,_0x23b05f)[_0xa380('0x1d')](function(_0x1d603c){if(_0x1d603c&&_0x1d603c[_0xa380('0x13')]){return _0x43fe4b[_0xa380('0x1e')][_0xa380('0x1f')](_0x1d603c);}})['then'](function(){_0x5cc7f6();})['catch'](function(_0x332a5b){_0x5cc7f6(_0x332a5b);});},'afterUpdate':function(_0x262017,_0xa0c142,_0xc80edd){return _0x43fe4b[_0xa380('0x1e')][_0xa380('0x20')]({'where':{'ChanSpyId':_0x262017['id']}})['then'](function(){return getChanSpyPromise(_0x43fe4b,_0x262017);})[_0xa380('0x1d')](function(_0x1dd99b){if(_0x1dd99b&&_0x1dd99b['length']){return _0x43fe4b[_0xa380('0x1e')][_0xa380('0x1f')](_0x1dd99b);}})[_0xa380('0x1d')](function(){_0xc80edd();})[_0xa380('0x17')](function(_0x215ac0){_0xc80edd(_0x215ac0);});},'afterDestroy':function(_0x215aad,_0x1fce2b,_0x3618f7){return _0x43fe4b[_0xa380('0x1e')][_0xa380('0x20')]({'where':{'ChanSpyId':_0x215aad['id']}})[_0xa380('0x1d')](function(){_0x3618f7();})[_0xa380('0x17')](function(_0x569225){_0x3618f7(_0x569225);});}}});}; \ No newline at end of file +var _0xd382=['push','merge','Set','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','format','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','then','catch','exports','models','define','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','%s%s','prefix'];(function(_0x2698b5,_0x2faad4){var _0x5375c1=function(_0x5d5348){while(--_0x5d5348){_0x2698b5['push'](_0x2698b5['shift']());}};_0x5375c1(++_0x2faad4);}(_0xd382,0x1b6));var _0x2d38=function(_0x5ea10c,_0xcb5d0e){_0x5ea10c=_0x5ea10c-0x0;var _0x4d5a85=_0xd382[_0x5ea10c];return _0x4d5a85;};'use strict';var _=require(_0x2d38('0x0'));var util=require(_0x2d38('0x1'));var BPromise=require(_0x2d38('0x2'));var attributes=require(_0x2d38('0x3'));var getUserApplications=function(_0x260d8e,_0xe32566,_0x9ab754){var _0x3e5d82=0x1;var _0xf6bceb=[];var _0x312012={'context':_0xe32566['context']||'from-sip','exten':util['format'](_0x2d38('0x4'),_0x260d8e[_0x2d38('0x5')],_0x9ab754),'type':'system','isApp':![],'ChanSpyId':_0x260d8e['id'],'UserId':_0xe32566['id']};_0xf6bceb[_0x2d38('0x6')](_[_0x2d38('0x7')]({'app':_0x2d38('0x8'),'appdata':util['format']('CDR(type)=%s',_0x2d38('0x9')),'priority':_0x3e5d82++},_0x312012));if(_0x260d8e[_0x2d38('0xa')]){_0xf6bceb[_0x2d38('0x6')](_['merge']({'app':_0x2d38('0xb'),'appdata':util['format'](_0x2d38('0xc'),_0x260d8e[_0x2d38('0xd')]),'priority':_0x3e5d82++},_0x312012));}if(_0x260d8e[_0x2d38('0xe')]){_0xf6bceb[_0x2d38('0x6')](_[_0x2d38('0x7')]({'app':_0x2d38('0xf'),'appdata':_0x260d8e[_0x2d38('0x10')],'priority':_0x3e5d82++},_0x312012));}_0xf6bceb['push'](_[_0x2d38('0x7')]({'app':_0x2d38('0x11'),'appdata':util[_0x2d38('0x12')](_0x2d38('0x13'),_0xe32566[_0x2d38('0x14')],_0x260d8e['options']?_0x260d8e[_0x2d38('0x15')][_0x2d38('0x16')](''):''),'priority':_0x3e5d82++},_0x312012));if(_0x260d8e[_0x2d38('0xa')]){_0xf6bceb[_0x2d38('0x6')](_[_0x2d38('0x7')]({'app':_0x2d38('0x17'),'priority':_0x3e5d82++},_0x312012));}return _0xf6bceb;};var getChanSpyApplications=function(_0xc6de5a,_0x2d3cb1){var _0xc17f9e=[];for(var _0x6d2a9a=0x0,_0x19d134=0x1;_0x6d2a9a<_0x2d3cb1[_0x2d38('0x18')];_0x6d2a9a++,_0x19d134=0x1){_0xc17f9e=_0xc17f9e[_0x2d38('0x19')](getUserApplications(_0xc6de5a,_0x2d3cb1[_0x6d2a9a],_0x2d3cb1[_0x6d2a9a][_0x2d38('0x1a')]));if(_0x2d3cb1[_0x6d2a9a][_0x2d38('0x1a')]!=_0x2d3cb1[_0x6d2a9a][_0x2d38('0x14')]){_0xc17f9e=_0xc17f9e['concat'](getUserApplications(_0xc6de5a,_0x2d3cb1[_0x6d2a9a],_0x2d3cb1[_0x6d2a9a][_0x2d38('0x14')]));}}return _0xc17f9e;};var getChanSpyPromise=function(_0x235fb6,_0x508b8b){return new BPromise(function(_0x42c23e,_0x353874){return _0x235fb6[_0x2d38('0x1b')]['findAll']({'attributes':['id',_0x2d38('0x14'),'internal'],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x2d38('0x1c')](function(_0x2e0b73){if(_0x2e0b73){return _0x42c23e(getChanSpyApplications(_0x508b8b,_0x2e0b73));}return _0x42c23e([]);})[_0x2d38('0x1d')](function(_0x3892a5){_0x353874(_0x3892a5);});});};module[_0x2d38('0x1e')]=function(_0x3138bc,_0x123700){var _0x2c4391=_0x3138bc[_0x2d38('0x1f')];return _0x3138bc[_0x2d38('0x20')]('VoiceChanSpy',attributes,{'tableName':_0x2d38('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4826d1,_0x1ce712,_0x530fd9){return getChanSpyPromise(_0x2c4391,_0x4826d1)[_0x2d38('0x1c')](function(_0xfa9bd){if(_0xfa9bd&&_0xfa9bd[_0x2d38('0x18')]){return _0x2c4391[_0x2d38('0x22')][_0x2d38('0x23')](_0xfa9bd);}})[_0x2d38('0x1c')](function(){_0x530fd9();})[_0x2d38('0x1d')](function(_0x529564){_0x530fd9(_0x529564);});},'afterUpdate':function(_0xf55016,_0x3f0f7a,_0x34599a){return _0x2c4391[_0x2d38('0x22')][_0x2d38('0x24')]({'where':{'ChanSpyId':_0xf55016['id']}})[_0x2d38('0x1c')](function(){return getChanSpyPromise(_0x2c4391,_0xf55016);})[_0x2d38('0x1c')](function(_0x3a6437){if(_0x3a6437&&_0x3a6437['length']){return _0x2c4391['VoiceExtension']['bulkCreate'](_0x3a6437);}})[_0x2d38('0x1c')](function(){_0x34599a();})[_0x2d38('0x1d')](function(_0xd333fe){_0x34599a(_0xd333fe);});},'afterDestroy':function(_0x5ad475,_0x29a38c,_0x4b5891){return _0x2c4391[_0x2d38('0x22')][_0x2d38('0x24')]({'where':{'ChanSpyId':_0x5ad475['id']}})[_0x2d38('0x1c')](function(){_0x4b5891();})['catch'](function(_0x306c09){_0x4b5891(_0x306c09);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index fa83d2f..9f45b07 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 _0x2933=['lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x27f405,_0x1043e0){var _0x2e77c1=function(_0x4cdd4e){while(--_0x4cdd4e){_0x27f405['push'](_0x27f405['shift']());}};_0x2e77c1(++_0x1043e0);}(_0x2933,0xd2));var _0x3293=function(_0x39640e,_0x58cd55){_0x39640e=_0x39640e-0x0;var _0x2585d5=_0x2933[_0x39640e];return _0x2585d5;};'use strict';var _=require(_0x3293('0x0'));var util=require(_0x3293('0x1'));var moment=require(_0x3293('0x2'));var BPromise=require(_0x3293('0x3'));var rs=require(_0x3293('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3293('0x5'));var logger=require('../../config/logger')(_0x3293('0x6'));var config=require(_0x3293('0x7'));var jayson=require(_0x3293('0x8'));var client=jayson['client'][_0x3293('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52c903,_0x9aabe8,_0x2b10b8){return new BPromise(function(_0x558aff,_0x10444f){return client[_0x3293('0xa')](_0x52c903,_0x2b10b8)['then'](function(_0xfdfa5a){logger['info'](_0x3293('0xb'),_0x9aabe8,_0x3293('0xc'));logger[_0x3293('0xd')](_0x3293('0xe'),_0x9aabe8,_0x3293('0xc'),JSON[_0x3293('0xf')](_0xfdfa5a));if(_0xfdfa5a[_0x3293('0x10')]){if(_0xfdfa5a[_0x3293('0x10')][_0x3293('0x11')]===0x1f4){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x9aabe8,_0xfdfa5a[_0x3293('0x10')]['message']);return _0x10444f(_0xfdfa5a[_0x3293('0x10')][_0x3293('0x12')]);}logger[_0x3293('0x10')](_0x3293('0xb'),_0x9aabe8,_0xfdfa5a[_0x3293('0x10')][_0x3293('0x12')]);return _0x558aff(_0xfdfa5a[_0x3293('0x10')][_0x3293('0x12')]);}else{logger[_0x3293('0x13')](_0x3293('0xb'),_0x9aabe8,_0x3293('0xc'));_0x558aff(_0xfdfa5a[_0x3293('0x14')][_0x3293('0x12')]);}})['catch'](function(_0x20ee21){logger[_0x3293('0x10')](_0x3293('0xb'),_0x9aabe8,_0x20ee21);_0x10444f(_0x20ee21);});});} \ No newline at end of file +var _0x0fa4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','bluebird','randomstring'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x0fa4,0x86));var _0x40fa=function(_0x5cdbc4,_0xdc831b){_0x5cdbc4=_0x5cdbc4-0x0;var _0x35c946=_0x0fa4[_0x5cdbc4];return _0x35c946;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x40fa('0x0'));var rs=require(_0x40fa('0x1'));var fs=require('fs');var Redis=require(_0x40fa('0x2'));var db=require(_0x40fa('0x3'))['db'];var utils=require(_0x40fa('0x4'));var logger=require(_0x40fa('0x5'))(_0x40fa('0x6'));var config=require(_0x40fa('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19c802,_0x4d2c0c,_0x1b09f3){return new BPromise(function(_0x2746ff,_0x21774a){return client[_0x40fa('0x8')](_0x19c802,_0x1b09f3)['then'](function(_0x4e56eb){logger[_0x40fa('0x9')](_0x40fa('0xa'),_0x4d2c0c,'request\x20sent');logger[_0x40fa('0xb')](_0x40fa('0xc'),_0x4d2c0c,'request\x20sent',JSON[_0x40fa('0xd')](_0x4e56eb));if(_0x4e56eb[_0x40fa('0xe')]){if(_0x4e56eb[_0x40fa('0xe')]['code']===0x1f4){logger[_0x40fa('0xe')](_0x40fa('0xa'),_0x4d2c0c,_0x4e56eb[_0x40fa('0xe')][_0x40fa('0xf')]);return _0x21774a(_0x4e56eb['error'][_0x40fa('0xf')]);}logger['error'](_0x40fa('0xa'),_0x4d2c0c,_0x4e56eb[_0x40fa('0xe')][_0x40fa('0xf')]);return _0x2746ff(_0x4e56eb[_0x40fa('0xe')][_0x40fa('0xf')]);}else{logger[_0x40fa('0x9')](_0x40fa('0xa'),_0x4d2c0c,'request\x20sent');_0x2746ff(_0x4e56eb['result'][_0x40fa('0xf')]);}})[_0x40fa('0x10')](function(_0x5d3e81){logger[_0x40fa('0xe')](_0x40fa('0xa'),_0x4d2c0c,_0x5d3e81);_0x21774a(_0x5d3e81);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index f6d2c2c..d8300eb 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 _0xb335=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5ca6b2,_0x24be32){var _0x2b92e2=function(_0x3c5853){while(--_0x3c5853){_0x5ca6b2['push'](_0x5ca6b2['shift']());}};_0x2b92e2(++_0x24be32);}(_0xb335,0x82));var _0x5b33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb335[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5b33('0x0'));var util=require(_0x5b33('0x1'));var path=require(_0x5b33('0x2'));var timeout=require(_0x5b33('0x3'));var express=require('express');var router=express[_0x5b33('0x4')]();var auth=require(_0x5b33('0x5'));var interaction=require(_0x5b33('0x6'));var config=require(_0x5b33('0x7'));var controller=require('./voiceContext.controller');router[_0x5b33('0x8')]('/',auth[_0x5b33('0x9')](),controller[_0x5b33('0xa')]);router[_0x5b33('0x8')](_0x5b33('0xb'),auth[_0x5b33('0x9')](),controller[_0x5b33('0xc')]);router[_0x5b33('0xd')]('/',auth[_0x5b33('0x9')](),controller['create']);router[_0x5b33('0xe')](_0x5b33('0xb'),auth[_0x5b33('0x9')](),controller[_0x5b33('0xf')]);router[_0x5b33('0x10')](_0x5b33('0xb'),auth[_0x5b33('0x9')](),controller[_0x5b33('0x11')]);module[_0x5b33('0x12')]=router; \ No newline at end of file +var _0x34ff=['path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer'];(function(_0x2d3ffe,_0x4790dc){var _0x16aefb=function(_0x4eee7c){while(--_0x4eee7c){_0x2d3ffe['push'](_0x2d3ffe['shift']());}};_0x16aefb(++_0x4790dc);}(_0x34ff,0x11f));var _0xf34f=function(_0x54d12e,_0x1ab841){_0x54d12e=_0x54d12e-0x0;var _0x1a8e71=_0x34ff[_0x54d12e];return _0x1a8e71;};'use strict';var multer=require(_0xf34f('0x0'));var util=require('util');var path=require(_0xf34f('0x1'));var timeout=require('connect-timeout');var express=require(_0xf34f('0x2'));var router=express[_0xf34f('0x3')]();var auth=require(_0xf34f('0x4'));var interaction=require(_0xf34f('0x5'));var config=require('../../config/environment');var controller=require(_0xf34f('0x6'));router[_0xf34f('0x7')]('/',auth[_0xf34f('0x8')](),controller[_0xf34f('0x9')]);router[_0xf34f('0x7')](_0xf34f('0xa'),auth[_0xf34f('0x8')](),controller['show']);router[_0xf34f('0xb')]('/',auth[_0xf34f('0x8')](),controller[_0xf34f('0xc')]);router[_0xf34f('0xd')](_0xf34f('0xa'),auth[_0xf34f('0x8')](),controller[_0xf34f('0xe')]);router[_0xf34f('0xf')](_0xf34f('0xa'),auth['isAuthenticated'](),controller[_0xf34f('0x10')]);module[_0xf34f('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 e6b79c3..8a6b7b0 100644 --- a/server/api/voiceContext/voiceContext.attributes.js +++ b/server/api/voiceContext/voiceContext.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x34f393,_0x1273ba){var _0x334af7=function(_0x2775ca){while(--_0x2775ca){_0x34f393['push'](_0x34f393['shift']());}};_0x334af7(++_0x1273ba);}(_0x34e8,0x12c));var _0x834e=function(_0x1b383b,_0x2a403e){_0x1b383b=_0x1b383b-0x0;var _0x1fa32c=_0x34e8[_0x1b383b];return _0x1fa32c;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'unique':_0x834e('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x834e('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e74=['name','sequelize','STRING'];(function(_0x3fb63b,_0x376d67){var _0x22c858=function(_0x40b4f7){while(--_0x40b4f7){_0x3fb63b['push'](_0x3fb63b['shift']());}};_0x22c858(++_0x376d67);}(_0x3e74,0x175));var _0x43e7=function(_0x241ad9,_0x52da84){_0x241ad9=_0x241ad9-0x0;var _0x1da9c9=_0x3e74[_0x241ad9];return _0x1da9c9;};'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 diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index e55ee39..1ae1a5f 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 _0x04b8=['VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','length','find','create','body','join','root','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','render','readFileSync','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','request','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceContext,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Contexts','UserProfileResource','stack','name','VoiceContext','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick'];(function(_0x387f62,_0x28b750){var _0x9687e2=function(_0x5ef352){while(--_0x5ef352){_0x387f62['push'](_0x387f62['shift']());}};_0x9687e2(++_0x28b750);}(_0x04b8,0x159));var _0x804b=function(_0x34a843,_0x38ebb0){_0x34a843=_0x34a843-0x0;var _0x55a829=_0x04b8[_0x34a843];return _0x55a829;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x804b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x804b('0x1'));var jsonpatch=require(_0x804b('0x2'));var rp=require('request-promise');var moment=require(_0x804b('0x3'));var BPromise=require(_0x804b('0x4'));var Mustache=require('mustache');var util=require(_0x804b('0x5'));var path=require(_0x804b('0x6'));var sox=require(_0x804b('0x7'));var csv=require('to-csv');var ejs=require(_0x804b('0x8'));var fs=require('fs');var _=require(_0x804b('0x9'));var squel=require(_0x804b('0xa'));var crypto=require('crypto');var jsforce=require(_0x804b('0xb'));var deskjs=require(_0x804b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x804b('0xd'));var Papa=require(_0x804b('0xe'));var Redis=require(_0x804b('0xf'));var authService=require(_0x804b('0x10'));var qs=require(_0x804b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x804b('0x12'));var logger=require(_0x804b('0x13'))(_0x804b('0x14'));var utils=require(_0x804b('0x15'));var config=require(_0x804b('0x16'));var licenseUtil=require(_0x804b('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x804b('0x18'));var client=jayson['client'][_0x804b('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3a2702,_0xfa2ddd,_0x1f915d,_0x581fbf){return new BPromise(function(_0x215825,_0x1b01a7){var _0x274bb8=_0x581fbf||client;return _0x274bb8[_0x804b('0x1a')](_0x3a2702,_0x1f915d)['then'](function(_0x2fd593){logger[_0x804b('0x1b')]('VoiceContext,\x20%s,\x20%s',_0xfa2ddd,_0x804b('0x1c'));logger['debug'](_0x804b('0x1d'),_0xfa2ddd,_0x804b('0x1c'),JSON[_0x804b('0x1e')](_0x2fd593));if(_0x2fd593[_0x804b('0x1f')]){if(_0x2fd593[_0x804b('0x1f')]['code']===0x1f4){logger[_0x804b('0x1f')]('VoiceContext,\x20%s,\x20%s',_0xfa2ddd,_0x2fd593[_0x804b('0x1f')][_0x804b('0x20')]);return _0x1b01a7(_0x2fd593[_0x804b('0x1f')][_0x804b('0x20')]);}logger['error'](_0x804b('0x21'),_0xfa2ddd,_0x2fd593[_0x804b('0x1f')][_0x804b('0x20')]);return _0x215825(_0x2fd593[_0x804b('0x1f')][_0x804b('0x20')]);}else{logger[_0x804b('0x1b')](_0x804b('0x21'),_0xfa2ddd,_0x804b('0x1c'));_0x215825(_0x2fd593[_0x804b('0x22')][_0x804b('0x20')]);}})[_0x804b('0x23')](function(_0x5a968b){logger[_0x804b('0x1f')](_0x804b('0x21'),_0xfa2ddd,_0x5a968b);_0x1b01a7(_0x5a968b);});});}function respondWithStatusCode(_0x5585f8,_0x44a921){_0x44a921=_0x44a921||0xcc;return function(_0x367024){if(_0x367024){return _0x5585f8[_0x804b('0x24')](_0x44a921);}return _0x5585f8[_0x804b('0x25')](_0x44a921)[_0x804b('0x26')]();};}function respondWithResult(_0x552a76,_0x2de812){_0x2de812=_0x2de812||0xc8;return function(_0x7d9c33){if(_0x7d9c33){return _0x552a76['status'](_0x2de812)[_0x804b('0x27')](_0x7d9c33);}};}function respondWithFilteredResult(_0x2366b6,_0x1117a5){return function(_0x27d5ec){if(_0x27d5ec){var _0x2d88da=_0x27d5ec[_0x804b('0x28')],_0x5cc1dd=_0x1117a5[_0x804b('0x29')],_0x456580=_0x1117a5[_0x804b('0x29')]+_0x1117a5['limit'],_0x22f822;if(_0x456580>=_0x2d88da){_0x456580=_0x2d88da;_0x22f822=0xc8;}else{_0x22f822=0xce;}_0x2366b6[_0x804b('0x25')](_0x22f822);return _0x2366b6[_0x804b('0x2a')](_0x804b('0x2b'),_0x5cc1dd+'-'+_0x456580+'/'+_0x2d88da)['json'](_0x27d5ec);}return null;};}function patchUpdates(_0x3dbd41){return function(_0x407357){try{jsonpatch[_0x804b('0x2c')](_0x407357,_0x3dbd41,!![]);}catch(_0x57b8da){return BPromise[_0x804b('0x2d')](_0x57b8da);}return _0x407357[_0x804b('0x2e')]();};}function saveUpdates(_0x5e8f85,_0x391376){return function(_0x37dd3e){if(_0x37dd3e){return _0x37dd3e[_0x804b('0x2f')](_0x5e8f85)[_0x804b('0x30')](function(_0x46de73){return _0x46de73;});}return null;};}function removeEntity(_0x241c96,_0x551792){return function(_0x3b0692){if(_0x3b0692){return _0x3b0692[_0x804b('0x31')]()[_0x804b('0x30')](function(){var _0xa6d897=_0x3b0692[_0x804b('0x32')]({'plain':!![]});var _0x2c509a=_0x804b('0x33');return db[_0x804b('0x34')][_0x804b('0x31')]({'where':{'type':_0x2c509a,'resourceId':_0xa6d897['id']}})[_0x804b('0x30')](function(){return _0x3b0692;});})[_0x804b('0x30')](function(){_0x241c96[_0x804b('0x25')](0xcc)[_0x804b('0x26')]();});}};}function handleEntityNotFound(_0x15c366,_0x20c50b){return function(_0x384c44){if(!_0x384c44){_0x15c366[_0x804b('0x24')](0x194);}return _0x384c44;};}function handleError(_0x1be16f,_0xf47023){_0xf47023=_0xf47023||0x1f4;return function(_0x3cf6df){logger[_0x804b('0x1f')](_0x3cf6df[_0x804b('0x35')]);if(_0x3cf6df[_0x804b('0x36')]){delete _0x3cf6df[_0x804b('0x36')];}_0x1be16f[_0x804b('0x25')](_0xf47023)['send'](_0x3cf6df);};}exports['index']=function(_0x584452,_0x3da331){var _0x2f3661={},_0x37a883={},_0x5b28d7={'count':0x0,'rows':[]};var _0x5918f2=_['map'](db[_0x804b('0x37')][_0x804b('0x38')],function(_0x43cbdf){return{'name':_0x43cbdf[_0x804b('0x39')],'type':_0x43cbdf[_0x804b('0x3a')][_0x804b('0x3b')]};});_0x37a883[_0x804b('0x3c')]=_[_0x804b('0x3d')](_0x5918f2,_0x804b('0x36'));_0x37a883[_0x804b('0x3e')]=_[_0x804b('0x3f')](_0x584452[_0x804b('0x3e')]);_0x37a883[_0x804b('0x40')]=_['intersection'](_0x37a883[_0x804b('0x3c')],_0x37a883[_0x804b('0x3e')]);_0x2f3661[_0x804b('0x41')]=_[_0x804b('0x42')](_0x37a883[_0x804b('0x3c')],qs['fields'](_0x584452['query'][_0x804b('0x43')]));_0x2f3661[_0x804b('0x41')]=_0x2f3661[_0x804b('0x41')]['length']?_0x2f3661[_0x804b('0x41')]:_0x37a883['model'];if(!_0x584452[_0x804b('0x3e')][_0x804b('0x44')](_0x804b('0x45'))){_0x2f3661[_0x804b('0x46')]=qs[_0x804b('0x46')](_0x584452[_0x804b('0x3e')][_0x804b('0x46')]);_0x2f3661['offset']=qs[_0x804b('0x29')](_0x584452[_0x804b('0x3e')][_0x804b('0x29')]);}_0x2f3661[_0x804b('0x47')]=qs['sort'](_0x584452[_0x804b('0x3e')][_0x804b('0x48')]);_0x2f3661[_0x804b('0x49')]=qs[_0x804b('0x40')](_[_0x804b('0x4a')](_0x584452[_0x804b('0x3e')],_0x37a883[_0x804b('0x40')]),_0x5918f2);if(_0x584452[_0x804b('0x3e')]['filter']){_0x2f3661[_0x804b('0x49')]=_['merge'](_0x2f3661['where'],{'$or':_['map'](_0x5918f2,function(_0x467bc5){if(_0x467bc5['type']!==_0x804b('0x4b')){var _0x41a427={};_0x41a427[_0x467bc5[_0x804b('0x36')]]={'$like':'%'+_0x584452[_0x804b('0x3e')]['filter']+'%'};return _0x41a427;}})});}_0x2f3661=_[_0x804b('0x4c')]({},_0x2f3661,_0x584452[_0x804b('0x4d')]);var _0x44211d={'where':_0x2f3661['where']};return db[_0x804b('0x37')][_0x804b('0x28')](_0x44211d)[_0x804b('0x30')](function(_0x4cada2){_0x5b28d7[_0x804b('0x28')]=_0x4cada2;if(_0x584452[_0x804b('0x3e')][_0x804b('0x4e')]){_0x2f3661[_0x804b('0x4f')]=[{'all':!![]}];}return db[_0x804b('0x37')][_0x804b('0x50')](_0x2f3661);})[_0x804b('0x30')](function(_0x2a2a08){_0x5b28d7[_0x804b('0x51')]=_0x2a2a08;return _0x5b28d7;})[_0x804b('0x30')](respondWithFilteredResult(_0x3da331,_0x2f3661))[_0x804b('0x23')](handleError(_0x3da331,null));};exports[_0x804b('0x52')]=function(_0x20862f,_0x2c1796){var _0x578e92={'raw':![],'where':{'id':_0x20862f[_0x804b('0x53')]['id']}},_0x52d0a2={};_0x52d0a2[_0x804b('0x3c')]=_[_0x804b('0x3f')](db[_0x804b('0x37')][_0x804b('0x38')]);_0x52d0a2['query']=_[_0x804b('0x3f')](_0x20862f[_0x804b('0x3e')]);_0x52d0a2[_0x804b('0x40')]=_[_0x804b('0x42')](_0x52d0a2[_0x804b('0x3c')],_0x52d0a2[_0x804b('0x3e')]);_0x578e92['attributes']=_['intersection'](_0x52d0a2[_0x804b('0x3c')],qs[_0x804b('0x43')](_0x20862f['query']['fields']));_0x578e92[_0x804b('0x41')]=_0x578e92[_0x804b('0x41')][_0x804b('0x54')]?_0x578e92['attributes']:_0x52d0a2[_0x804b('0x3c')];if(_0x20862f[_0x804b('0x3e')]['includeAll']){_0x578e92[_0x804b('0x4f')]=[{'all':!![]}];}_0x578e92=_['merge']({},_0x578e92,_0x20862f[_0x804b('0x4d')]);return db['VoiceContext'][_0x804b('0x55')](_0x578e92)[_0x804b('0x30')](handleEntityNotFound(_0x2c1796,null))['then'](respondWithResult(_0x2c1796,null))[_0x804b('0x23')](handleError(_0x2c1796,null));};exports['create']=function(_0x36b417,_0x706e98,_0x33944c){var _0x2f4aa1;return db[_0x804b('0x37')][_0x804b('0x56')](_0x36b417[_0x804b('0x57')],{'raw':!![]})[_0x804b('0x30')](function(_0x453b94){_0x2f4aa1=_0x453b94;return db[_0x804b('0x37')]['findAll']({'raw':!![]});})['then'](function(_0x13fb5c){var _0x4799be=fs['readFileSync'](path[_0x804b('0x58')](config[_0x804b('0x59')],_0x804b('0x5a')),_0x804b('0x5b'));var _0x5a549f=ejs['render'](_0x4799be,{'contexts':_0x13fb5c||[]});fs[_0x804b('0x5c')](_0x804b('0x5d'),_0x5a549f);})[_0x804b('0x30')](function(){return respondWithRpcPromise(_0x804b('0x5e'),_0x804b('0x56'),{'module':_0x804b('0x5f')});})[_0x804b('0x30')](function(){var _0x3100aa=_0x36b417[_0x804b('0x60')][_0x804b('0x32')]({'plain':!![]});if(!_0x3100aa)throw new Error(_0x804b('0x61'));if(_0x3100aa[_0x804b('0x62')]===_0x804b('0x60')){var _0x15ca53=_0x2f4aa1[_0x804b('0x32')]({'plain':!![]});return db[_0x804b('0x63')]['find']({'where':{'name':_0x804b('0x33'),'userProfileId':_0x3100aa[_0x804b('0x64')]},'raw':!![]})['then'](function(_0x87640a){if(_0x87640a&&_0x87640a[_0x804b('0x65')]===0x0){return db[_0x804b('0x34')][_0x804b('0x56')]({'name':_0x15ca53['name'],'resourceId':_0x15ca53['id'],'type':_0x87640a[_0x804b('0x36')],'sectionId':_0x87640a['id']},{})[_0x804b('0x30')](function(){return _0x2f4aa1;});}else{return _0x2f4aa1;}})['catch'](function(_0x3098a1){logger[_0x804b('0x1f')](_0x804b('0x66'),_0x3098a1);throw _0x3098a1;});}return _0x2f4aa1;})['then'](respondWithResult(_0x706e98,0xc9))[_0x804b('0x23')](handleError(_0x706e98,null));};exports[_0x804b('0x2f')]=function(_0x3df323,_0x2295c5,_0x3f4532){var _0x555d2e;return db[_0x804b('0x37')][_0x804b('0x55')]({'where':{'id':_0x3df323[_0x804b('0x53')]['id']}})[_0x804b('0x30')](handleEntityNotFound(_0x2295c5,null))['then'](saveUpdates(_0x3df323['body'],null))[_0x804b('0x30')](function(_0x5695bb){if(_0x5695bb){_0x555d2e=_0x5695bb;return db[_0x804b('0x37')][_0x804b('0x50')]({'raw':!![]});}})[_0x804b('0x30')](function(_0x366f68){var _0x2bfef2=fs['readFileSync'](path[_0x804b('0x58')](config[_0x804b('0x59')],_0x804b('0x5a')),'utf8');var _0x360a81=ejs[_0x804b('0x67')](_0x2bfef2,{'contexts':_0x366f68||[]});fs['writeFileSync'](_0x804b('0x5d'),_0x360a81);})['then'](function(){return respondWithRpcPromise(_0x804b('0x5e'),_0x804b('0x2f'),{'module':'chan_sip.so'});})[_0x804b('0x30')](function(){return _0x555d2e;})[_0x804b('0x30')](respondWithResult(_0x2295c5,null))[_0x804b('0x23')](handleError(_0x2295c5,null));};exports['destroy']=function(_0x436425,_0x492904,_0x3b8d04){var _0x1e429b;return db[_0x804b('0x37')][_0x804b('0x55')]({'where':{'id':_0x436425['params']['id']}})[_0x804b('0x30')](handleEntityNotFound(_0x492904,null))[_0x804b('0x30')](removeEntity(_0x492904,null))[_0x804b('0x30')](function(){return db[_0x804b('0x37')][_0x804b('0x50')]({'raw':!![]});})[_0x804b('0x30')](function(_0x5b3b79){var _0x39ed3c=fs[_0x804b('0x68')](path['join'](config[_0x804b('0x59')],_0x804b('0x5a')),_0x804b('0x5b'));var _0x276230=ejs['render'](_0x39ed3c,{'contexts':_0x5b3b79});fs[_0x804b('0x5c')](_0x804b('0x5d'),_0x276230);return respondWithRpcPromise('Reload',_0x804b('0x31'),{'module':_0x804b('0x5f')});})['catch'](handleError(_0x492904,null));}; \ No newline at end of file +var _0x1ba2=['request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','Contexts','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VoiceContext','includeAll','include','rows','show','length','options','find','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','params','body','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','findAll','chan_sip.so','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','then','info','VoiceContext,\x20%s,\x20%s'];(function(_0x596ba8,_0x358056){var _0x352766=function(_0x49bd24){while(--_0x49bd24){_0x596ba8['push'](_0x596ba8['shift']());}};_0x352766(++_0x358056);}(_0x1ba2,0xb4));var _0x21ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ba2[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x21ba('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x21ba('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x21ba('0x2'));var rp=require(_0x21ba('0x3'));var moment=require(_0x21ba('0x4'));var BPromise=require(_0x21ba('0x5'));var Mustache=require(_0x21ba('0x6'));var util=require('util');var path=require(_0x21ba('0x7'));var sox=require(_0x21ba('0x8'));var csv=require('to-csv');var ejs=require(_0x21ba('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x21ba('0xa'));var crypto=require(_0x21ba('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x21ba('0xc'));var toCsv=require('to-csv');var querystring=require(_0x21ba('0xd'));var Papa=require(_0x21ba('0xe'));var Redis=require('ioredis');var authService=require(_0x21ba('0xf'));var qs=require(_0x21ba('0x10'));var as=require(_0x21ba('0x11'));var hardwareService=require(_0x21ba('0x12'));var logger=require(_0x21ba('0x13'))(_0x21ba('0x14'));var utils=require(_0x21ba('0x15'));var config=require(_0x21ba('0x16'));var licenseUtil=require(_0x21ba('0x17'));var db=require(_0x21ba('0x18'))['db'];var jayson=require(_0x21ba('0x19'));var client=jayson[_0x21ba('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4deda3,_0x183154,_0x1838b5,_0x214f8e){return new BPromise(function(_0x4f43e2,_0x4b9fd2){var _0x11eb4b=_0x214f8e||client;return _0x11eb4b['request'](_0x4deda3,_0x1838b5)[_0x21ba('0x1b')](function(_0x494588){logger[_0x21ba('0x1c')](_0x21ba('0x1d'),_0x183154,_0x21ba('0x1e'));logger[_0x21ba('0x1f')](_0x21ba('0x20'),_0x183154,'request\x20sent',JSON[_0x21ba('0x21')](_0x494588));if(_0x494588['error']){if(_0x494588[_0x21ba('0x22')][_0x21ba('0x23')]===0x1f4){logger[_0x21ba('0x22')](_0x21ba('0x1d'),_0x183154,_0x494588[_0x21ba('0x22')][_0x21ba('0x24')]);return _0x4b9fd2(_0x494588[_0x21ba('0x22')][_0x21ba('0x24')]);}logger['error'](_0x21ba('0x1d'),_0x183154,_0x494588[_0x21ba('0x22')]['message']);return _0x4f43e2(_0x494588[_0x21ba('0x22')]['message']);}else{logger[_0x21ba('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x183154,_0x21ba('0x1e'));_0x4f43e2(_0x494588[_0x21ba('0x25')][_0x21ba('0x24')]);}})[_0x21ba('0x26')](function(_0x47e88d){logger['error']('VoiceContext,\x20%s,\x20%s',_0x183154,_0x47e88d);_0x4b9fd2(_0x47e88d);});});}function respondWithStatusCode(_0x4b63fb,_0x2e4b49){_0x2e4b49=_0x2e4b49||0xcc;return function(_0x1529ec){if(_0x1529ec){return _0x4b63fb[_0x21ba('0x27')](_0x2e4b49);}return _0x4b63fb[_0x21ba('0x28')](_0x2e4b49)[_0x21ba('0x29')]();};}function respondWithResult(_0x472656,_0x2f4d96){_0x2f4d96=_0x2f4d96||0xc8;return function(_0x3ab7d3){if(_0x3ab7d3){return _0x472656[_0x21ba('0x28')](_0x2f4d96)[_0x21ba('0x2a')](_0x3ab7d3);}};}function respondWithFilteredResult(_0x240e3f,_0xb9b6d8){return function(_0x2f7414){if(_0x2f7414){var _0x32b602=_0x2f7414[_0x21ba('0x2b')],_0x1aca0c=_0xb9b6d8[_0x21ba('0x2c')],_0x38d430=_0xb9b6d8[_0x21ba('0x2c')]+_0xb9b6d8[_0x21ba('0x2d')],_0x19c367;if(_0x38d430>=_0x32b602){_0x38d430=_0x32b602;_0x19c367=0xc8;}else{_0x19c367=0xce;}_0x240e3f[_0x21ba('0x28')](_0x19c367);return _0x240e3f[_0x21ba('0x2e')](_0x21ba('0x2f'),_0x1aca0c+'-'+_0x38d430+'/'+_0x32b602)[_0x21ba('0x2a')](_0x2f7414);}return null;};}function patchUpdates(_0x2975e2){return function(_0x46ad83){try{jsonpatch[_0x21ba('0x30')](_0x46ad83,_0x2975e2,!![]);}catch(_0x41ad3e){return BPromise[_0x21ba('0x31')](_0x41ad3e);}return _0x46ad83[_0x21ba('0x32')]();};}function saveUpdates(_0x3f4833,_0x56bd9f){return function(_0x29fbb6){if(_0x29fbb6){return _0x29fbb6[_0x21ba('0x33')](_0x3f4833)[_0x21ba('0x1b')](function(_0x43e405){return _0x43e405;});}return null;};}function removeEntity(_0x5a3bde,_0x4c4472){return function(_0x120760){if(_0x120760){return _0x120760[_0x21ba('0x34')]()[_0x21ba('0x1b')](function(){var _0xf820fd=_0x120760[_0x21ba('0x35')]({'plain':!![]});var _0x5c1403=_0x21ba('0x36');return db['UserProfileResource'][_0x21ba('0x34')]({'where':{'type':_0x5c1403,'resourceId':_0xf820fd['id']}})[_0x21ba('0x1b')](function(){return _0x120760;});})[_0x21ba('0x1b')](function(){_0x5a3bde[_0x21ba('0x28')](0xcc)[_0x21ba('0x29')]();});}};}function handleEntityNotFound(_0x3869b4,_0x185b1){return function(_0x39354c){if(!_0x39354c){_0x3869b4[_0x21ba('0x27')](0x194);}return _0x39354c;};}function handleError(_0x59bd80,_0x519a6c){_0x519a6c=_0x519a6c||0x1f4;return function(_0x70b734){logger[_0x21ba('0x22')](_0x70b734[_0x21ba('0x37')]);if(_0x70b734[_0x21ba('0x38')]){delete _0x70b734['name'];}_0x59bd80[_0x21ba('0x28')](_0x519a6c)[_0x21ba('0x39')](_0x70b734);};}exports['index']=function(_0x806182,_0x202129){var _0x1ccb2d={},_0x1caf37={},_0x30e669={'count':0x0,'rows':[]};var _0xd7f47=_[_0x21ba('0x3a')](db['VoiceContext'][_0x21ba('0x3b')],function(_0x4e66c0){return{'name':_0x4e66c0[_0x21ba('0x3c')],'type':_0x4e66c0['type'][_0x21ba('0x3d')]};});_0x1caf37[_0x21ba('0x3e')]=_[_0x21ba('0x3a')](_0xd7f47,_0x21ba('0x38'));_0x1caf37[_0x21ba('0x3f')]=_[_0x21ba('0x40')](_0x806182[_0x21ba('0x3f')]);_0x1caf37[_0x21ba('0x41')]=_[_0x21ba('0x42')](_0x1caf37[_0x21ba('0x3e')],_0x1caf37[_0x21ba('0x3f')]);_0x1ccb2d[_0x21ba('0x43')]=_[_0x21ba('0x42')](_0x1caf37['model'],qs[_0x21ba('0x44')](_0x806182[_0x21ba('0x3f')][_0x21ba('0x44')]));_0x1ccb2d[_0x21ba('0x43')]=_0x1ccb2d[_0x21ba('0x43')]['length']?_0x1ccb2d[_0x21ba('0x43')]:_0x1caf37['model'];if(!_0x806182[_0x21ba('0x3f')][_0x21ba('0x45')](_0x21ba('0x46'))){_0x1ccb2d[_0x21ba('0x2d')]=qs[_0x21ba('0x2d')](_0x806182[_0x21ba('0x3f')][_0x21ba('0x2d')]);_0x1ccb2d['offset']=qs['offset'](_0x806182[_0x21ba('0x3f')]['offset']);}_0x1ccb2d[_0x21ba('0x47')]=qs[_0x21ba('0x48')](_0x806182[_0x21ba('0x3f')][_0x21ba('0x48')]);_0x1ccb2d[_0x21ba('0x49')]=qs[_0x21ba('0x41')](_['pick'](_0x806182[_0x21ba('0x3f')],_0x1caf37[_0x21ba('0x41')]),_0xd7f47);if(_0x806182['query'][_0x21ba('0x4a')]){_0x1ccb2d['where']=_[_0x21ba('0x4b')](_0x1ccb2d['where'],{'$or':_['map'](_0xd7f47,function(_0x1e12ca){if(_0x1e12ca[_0x21ba('0x4c')]!=='VIRTUAL'){var _0x59cbb9={};_0x59cbb9[_0x1e12ca[_0x21ba('0x38')]]={'$like':'%'+_0x806182[_0x21ba('0x3f')][_0x21ba('0x4a')]+'%'};return _0x59cbb9;}})});}_0x1ccb2d=_[_0x21ba('0x4b')]({},_0x1ccb2d,_0x806182['options']);var _0x594afe={'where':_0x1ccb2d[_0x21ba('0x49')]};return db[_0x21ba('0x4d')][_0x21ba('0x2b')](_0x594afe)[_0x21ba('0x1b')](function(_0xc0308d){_0x30e669['count']=_0xc0308d;if(_0x806182[_0x21ba('0x3f')][_0x21ba('0x4e')]){_0x1ccb2d[_0x21ba('0x4f')]=[{'all':!![]}];}return db['VoiceContext']['findAll'](_0x1ccb2d);})['then'](function(_0xea124f){_0x30e669[_0x21ba('0x50')]=_0xea124f;return _0x30e669;})[_0x21ba('0x1b')](respondWithFilteredResult(_0x202129,_0x1ccb2d))[_0x21ba('0x26')](handleError(_0x202129,null));};exports[_0x21ba('0x51')]=function(_0x592461,_0x3254ce){var _0x1f806e={'raw':![],'where':{'id':_0x592461['params']['id']}},_0x22e77f={};_0x22e77f[_0x21ba('0x3e')]=_[_0x21ba('0x40')](db['VoiceContext'][_0x21ba('0x3b')]);_0x22e77f[_0x21ba('0x3f')]=_[_0x21ba('0x40')](_0x592461[_0x21ba('0x3f')]);_0x22e77f['filters']=_[_0x21ba('0x42')](_0x22e77f[_0x21ba('0x3e')],_0x22e77f[_0x21ba('0x3f')]);_0x1f806e[_0x21ba('0x43')]=_[_0x21ba('0x42')](_0x22e77f[_0x21ba('0x3e')],qs[_0x21ba('0x44')](_0x592461[_0x21ba('0x3f')][_0x21ba('0x44')]));_0x1f806e[_0x21ba('0x43')]=_0x1f806e[_0x21ba('0x43')][_0x21ba('0x52')]?_0x1f806e['attributes']:_0x22e77f[_0x21ba('0x3e')];if(_0x592461['query'][_0x21ba('0x4e')]){_0x1f806e['include']=[{'all':!![]}];}_0x1f806e=_[_0x21ba('0x4b')]({},_0x1f806e,_0x592461[_0x21ba('0x53')]);return db[_0x21ba('0x4d')][_0x21ba('0x54')](_0x1f806e)[_0x21ba('0x1b')](handleEntityNotFound(_0x3254ce,null))[_0x21ba('0x1b')](respondWithResult(_0x3254ce,null))[_0x21ba('0x26')](handleError(_0x3254ce,null));};exports['create']=function(_0x4aacce,_0x9449e9,_0x7e1de2){var _0x4022ed;return db[_0x21ba('0x4d')]['create'](_0x4aacce['body'],{'raw':!![]})[_0x21ba('0x1b')](function(_0x17b277){_0x4022ed=_0x17b277;return db[_0x21ba('0x4d')]['findAll']({'raw':!![]});})[_0x21ba('0x1b')](function(_0x2fe608){var _0x45b1c6=fs[_0x21ba('0x55')](path[_0x21ba('0x56')](config[_0x21ba('0x57')],_0x21ba('0x58')),_0x21ba('0x59'));var _0x295205=ejs[_0x21ba('0x5a')](_0x45b1c6,{'contexts':_0x2fe608||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x295205);})['then'](function(){return respondWithRpcPromise('Reload',_0x21ba('0x5b'),{'module':'chan_sip.so'});})['then'](function(){var _0x2b5b52=_0x4aacce[_0x21ba('0x5c')][_0x21ba('0x35')]({'plain':!![]});if(!_0x2b5b52)throw new Error(_0x21ba('0x5d'));if(_0x2b5b52[_0x21ba('0x5e')]===_0x21ba('0x5c')){var _0x529823=_0x4022ed['get']({'plain':!![]});return db['UserProfileSection'][_0x21ba('0x54')]({'where':{'name':_0x21ba('0x36'),'userProfileId':_0x2b5b52[_0x21ba('0x5f')]},'raw':!![]})['then'](function(_0x41d69d){if(_0x41d69d&&_0x41d69d[_0x21ba('0x60')]===0x0){return db[_0x21ba('0x61')]['create']({'name':_0x529823[_0x21ba('0x38')],'resourceId':_0x529823['id'],'type':_0x41d69d[_0x21ba('0x38')],'sectionId':_0x41d69d['id']},{})[_0x21ba('0x1b')](function(){return _0x4022ed;});}else{return _0x4022ed;}})[_0x21ba('0x26')](function(_0x53f510){logger[_0x21ba('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53f510);throw _0x53f510;});}return _0x4022ed;})[_0x21ba('0x1b')](respondWithResult(_0x9449e9,0xc9))[_0x21ba('0x26')](handleError(_0x9449e9,null));};exports[_0x21ba('0x33')]=function(_0x58ce4a,_0xf1492e,_0x5724b3){var _0x147e27;return db['VoiceContext'][_0x21ba('0x54')]({'where':{'id':_0x58ce4a[_0x21ba('0x62')]['id']}})['then'](handleEntityNotFound(_0xf1492e,null))['then'](saveUpdates(_0x58ce4a[_0x21ba('0x63')],null))[_0x21ba('0x1b')](function(_0x5ecc47){if(_0x5ecc47){_0x147e27=_0x5ecc47;return db['VoiceContext']['findAll']({'raw':!![]});}})[_0x21ba('0x1b')](function(_0xace4c6){var _0xb2b09a=fs[_0x21ba('0x55')](path['join'](config[_0x21ba('0x57')],_0x21ba('0x58')),_0x21ba('0x59'));var _0x52aa36=ejs[_0x21ba('0x5a')](_0xb2b09a,{'contexts':_0xace4c6||[]});fs[_0x21ba('0x64')](_0x21ba('0x65'),_0x52aa36);})[_0x21ba('0x1b')](function(){return respondWithRpcPromise(_0x21ba('0x66'),'update',{'module':'chan_sip.so'});})[_0x21ba('0x1b')](function(){return _0x147e27;})['then'](respondWithResult(_0xf1492e,null))[_0x21ba('0x26')](handleError(_0xf1492e,null));};exports[_0x21ba('0x34')]=function(_0x289b8b,_0x2a950e,_0x2624ba){var _0x4ce4d5;return db[_0x21ba('0x4d')][_0x21ba('0x54')]({'where':{'id':_0x289b8b[_0x21ba('0x62')]['id']}})[_0x21ba('0x1b')](handleEntityNotFound(_0x2a950e,null))[_0x21ba('0x1b')](removeEntity(_0x2a950e,null))[_0x21ba('0x1b')](function(){return db['VoiceContext'][_0x21ba('0x67')]({'raw':!![]});})[_0x21ba('0x1b')](function(_0x3b1b1d){var _0x3bb5f4=fs['readFileSync'](path[_0x21ba('0x56')](config['root'],'server/files/templates/context.ejs'),_0x21ba('0x59'));var _0x14c5f3=ejs[_0x21ba('0x5a')](_0x3bb5f4,{'contexts':_0x3b1b1d});fs[_0x21ba('0x64')](_0x21ba('0x65'),_0x14c5f3);return respondWithRpcPromise(_0x21ba('0x66'),_0x21ba('0x34'),{'module':_0x21ba('0x68')});})['catch'](handleError(_0x2a950e,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index f5285d1..4efd91a 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 _0x0242=['../../config/environment','./voiceContext.attributes','define','VoiceContext','lodash','util','../../config/logger','moment','bluebird','rimraf'];(function(_0x11226b,_0x47daa3){var _0x11d550=function(_0x246ee2){while(--_0x246ee2){_0x11226b['push'](_0x11226b['shift']());}};_0x11d550(++_0x47daa3);}(_0x0242,0x72));var _0x2024=function(_0x45d5ef,_0x10c29b){_0x45d5ef=_0x45d5ef-0x0;var _0x474d19=_0x0242[_0x45d5ef];return _0x474d19;};'use strict';var _=require(_0x2024('0x0'));var util=require(_0x2024('0x1'));var logger=require(_0x2024('0x2'))('api');var moment=require(_0x2024('0x3'));var BPromise=require(_0x2024('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2024('0x5'));var config=require(_0x2024('0x6'));var attributes=require(_0x2024('0x7'));module['exports']=function(_0x4fa007,_0x1ac83e){return _0x4fa007[_0x2024('0x8')](_0x2024('0x9'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe640=['path','../../config/environment','exports','VoiceContext','voice_contexts','lodash','../../config/logger','api','moment','request-promise'];(function(_0x5873a4,_0x4c767f){var _0x2048c7=function(_0x38b8a7){while(--_0x38b8a7){_0x5873a4['push'](_0x5873a4['shift']());}};_0x2048c7(++_0x4c767f);}(_0xe640,0x177));var _0x0e64=function(_0x1891bc,_0x12fa04){_0x1891bc=_0x1891bc-0x0;var _0x156c14=_0xe640[_0x1891bc];return _0x156c14;};'use strict';var _=require(_0x0e64('0x0'));var util=require('util');var logger=require(_0x0e64('0x1'))(_0x0e64('0x2'));var moment=require(_0x0e64('0x3'));var BPromise=require('bluebird');var rp=require(_0x0e64('0x4'));var fs=require('fs');var path=require(_0x0e64('0x5'));var rimraf=require('rimraf');var config=require(_0x0e64('0x6'));var attributes=require('./voiceContext.attributes');module[_0x0e64('0x7')]=function(_0x5ceced,_0x879f3){return _0x5ceced['define'](_0x0e64('0x8'),attributes,{'tableName':_0x0e64('0x9'),'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 7e3ea87..81d30ce 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 _0x2b85=['debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceContext,\x20%s,\x20%s'];(function(_0x3af31b,_0x35a1e5){var _0x295ce4=function(_0x10514e){while(--_0x10514e){_0x3af31b['push'](_0x3af31b['shift']());}};_0x295ce4(++_0x35a1e5);}(_0x2b85,0x197));var _0x52b8=function(_0x133b50,_0x5a3c51){_0x133b50=_0x133b50-0x0;var _0xd2b24f=_0x2b85[_0x133b50];return _0xd2b24f;};'use strict';var _=require('lodash');var util=require(_0x52b8('0x0'));var moment=require('moment');var BPromise=require(_0x52b8('0x1'));var rs=require(_0x52b8('0x2'));var fs=require('fs');var Redis=require(_0x52b8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x52b8('0x4'));var logger=require(_0x52b8('0x5'))(_0x52b8('0x6'));var config=require(_0x52b8('0x7'));var jayson=require(_0x52b8('0x8'));var client=jayson[_0x52b8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe9fc41,_0x51afcc,_0x1fad4f){return new BPromise(function(_0x94af1a,_0x27acde){return client['request'](_0xe9fc41,_0x1fad4f)[_0x52b8('0xa')](function(_0x1b38aa){logger[_0x52b8('0xb')](_0x52b8('0xc'),_0x51afcc,'request\x20sent');logger[_0x52b8('0xd')](_0x52b8('0xe'),_0x51afcc,_0x52b8('0xf'),JSON[_0x52b8('0x10')](_0x1b38aa));if(_0x1b38aa[_0x52b8('0x11')]){if(_0x1b38aa[_0x52b8('0x11')][_0x52b8('0x12')]===0x1f4){logger[_0x52b8('0x11')](_0x52b8('0xc'),_0x51afcc,_0x1b38aa[_0x52b8('0x11')][_0x52b8('0x13')]);return _0x27acde(_0x1b38aa[_0x52b8('0x11')][_0x52b8('0x13')]);}logger[_0x52b8('0x11')](_0x52b8('0xc'),_0x51afcc,_0x1b38aa['error'][_0x52b8('0x13')]);return _0x94af1a(_0x1b38aa[_0x52b8('0x11')][_0x52b8('0x13')]);}else{logger[_0x52b8('0xb')]('VoiceContext,\x20%s,\x20%s',_0x51afcc,_0x52b8('0xf'));_0x94af1a(_0x1b38aa[_0x52b8('0x14')][_0x52b8('0x13')]);}})['catch'](function(_0x229ce8){logger['error'](_0x52b8('0xc'),_0x51afcc,_0x229ce8);_0x27acde(_0x229ce8);});});} \ No newline at end of file +var _0x84e1=['VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x158b04,_0x582976){var _0x258cb2=function(_0x25f2c4){while(--_0x25f2c4){_0x158b04['push'](_0x158b04['shift']());}};_0x258cb2(++_0x582976);}(_0x84e1,0x1dc));var _0x184e=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x84e1[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x184e('0x0'));var util=require(_0x184e('0x1'));var moment=require(_0x184e('0x2'));var BPromise=require(_0x184e('0x3'));var rs=require(_0x184e('0x4'));var fs=require('fs');var Redis=require(_0x184e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x184e('0x6'));var logger=require(_0x184e('0x7'))(_0x184e('0x8'));var config=require(_0x184e('0x9'));var jayson=require(_0x184e('0xa'));var client=jayson[_0x184e('0xb')][_0x184e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ad2c3,_0x3f24d3,_0xa32654){return new BPromise(function(_0x1e79b2,_0x4b6204){return client[_0x184e('0xd')](_0x4ad2c3,_0xa32654)[_0x184e('0xe')](function(_0x22af83){logger[_0x184e('0xf')]('VoiceContext,\x20%s,\x20%s',_0x3f24d3,_0x184e('0x10'));logger[_0x184e('0x11')](_0x184e('0x12'),_0x3f24d3,_0x184e('0x10'),JSON[_0x184e('0x13')](_0x22af83));if(_0x22af83[_0x184e('0x14')]){if(_0x22af83[_0x184e('0x14')][_0x184e('0x15')]===0x1f4){logger[_0x184e('0x14')](_0x184e('0x16'),_0x3f24d3,_0x22af83[_0x184e('0x14')][_0x184e('0x17')]);return _0x4b6204(_0x22af83['error'][_0x184e('0x17')]);}logger['error'](_0x184e('0x16'),_0x3f24d3,_0x22af83[_0x184e('0x14')][_0x184e('0x17')]);return _0x1e79b2(_0x22af83[_0x184e('0x14')][_0x184e('0x17')]);}else{logger[_0x184e('0xf')](_0x184e('0x16'),_0x3f24d3,_0x184e('0x10'));_0x1e79b2(_0x22af83[_0x184e('0x18')]['message']);}})[_0x184e('0x19')](function(_0x5d3a36){logger[_0x184e('0x14')]('VoiceContext,\x20%s,\x20%s',_0x3f24d3,_0x5d3a36);_0x4b6204(_0x5d3a36);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 0af66a3..41277e7 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 _0x1f45=['update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put'];(function(_0x5077f6,_0x3865a0){var _0x548cab=function(_0x298255){while(--_0x298255){_0x5077f6['push'](_0x5077f6['shift']());}};_0x548cab(++_0x3865a0);}(_0x1f45,0x87));var _0x51f4=function(_0x531767,_0x3714aa){_0x531767=_0x531767-0x0;var _0x3ddbd3=_0x1f45[_0x531767];return _0x3ddbd3;};'use strict';var multer=require('multer');var util=require(_0x51f4('0x0'));var path=require(_0x51f4('0x1'));var timeout=require(_0x51f4('0x2'));var express=require(_0x51f4('0x3'));var router=express[_0x51f4('0x4')]();var auth=require(_0x51f4('0x5'));var interaction=require(_0x51f4('0x6'));var config=require(_0x51f4('0x7'));var controller=require('./voiceDialReport.controller');router[_0x51f4('0x8')]('/',auth[_0x51f4('0x9')](),controller[_0x51f4('0xa')]);router['get'](_0x51f4('0xb'),auth[_0x51f4('0x9')](),controller[_0x51f4('0xc')]);router[_0x51f4('0x8')](_0x51f4('0xd'),auth['isAuthenticated'](),controller[_0x51f4('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x51f4('0xf')]);router[_0x51f4('0x10')](_0x51f4('0xd'),auth[_0x51f4('0x9')](),controller[_0x51f4('0x11')]);router['delete'](_0x51f4('0xd'),auth[_0x51f4('0x9')](),controller['destroy']);module[_0x51f4('0x12')]=router; \ No newline at end of file +var _0x0a68=['get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x0a68,0xb6));var _0x80a6=function(_0xc52e92,_0x154635){_0xc52e92=_0xc52e92-0x0;var _0x1c4eec=_0x0a68[_0xc52e92];return _0x1c4eec;};'use strict';var multer=require(_0x80a6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x80a6('0x1'));var express=require(_0x80a6('0x2'));var router=express[_0x80a6('0x3')]();var auth=require(_0x80a6('0x4'));var interaction=require(_0x80a6('0x5'));var config=require(_0x80a6('0x6'));var controller=require(_0x80a6('0x7'));router[_0x80a6('0x8')]('/',auth[_0x80a6('0x9')](),controller[_0x80a6('0xa')]);router[_0x80a6('0x8')]('/describe',auth[_0x80a6('0x9')](),controller[_0x80a6('0xb')]);router[_0x80a6('0x8')](_0x80a6('0xc'),auth[_0x80a6('0x9')](),controller[_0x80a6('0xd')]);router[_0x80a6('0xe')]('/',auth[_0x80a6('0x9')](),controller[_0x80a6('0xf')]);router[_0x80a6('0x10')](_0x80a6('0xc'),auth['isAuthenticated'](),controller[_0x80a6('0x11')]);router[_0x80a6('0x12')](_0x80a6('0xc'),auth[_0x80a6('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index aa4e99e..29daaf6 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 _0x35e6=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x1628d1,_0xcdacaa){var _0x2c1912=function(_0x8c8ff2){while(--_0x8c8ff2){_0x1628d1['push'](_0x1628d1['shift']());}};_0x2c1912(++_0xcdacaa);}(_0x35e6,0x184));var _0x635e=function(_0x1eb405,_0x37565b){_0x1eb405=_0x1eb405-0x0;var _0x4207a7=_0x35e6[_0x1eb405];return _0x4207a7;};'use strict';var Sequelize=require(_0x635e('0x0'));module[_0x635e('0x1')]={'privilege':{'type':Sequelize[_0x635e('0x2')]},'channel':{'type':Sequelize[_0x635e('0x2')]},'channelstate':{'type':Sequelize[_0x635e('0x3')]},'channelstatedesc':{'type':Sequelize[_0x635e('0x2')]},'calleridnum':{'type':Sequelize[_0x635e('0x2')]},'calleridname':{'type':Sequelize[_0x635e('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x635e('0x2')]},'language':{'type':Sequelize[_0x635e('0x2')]},'accountcode':{'type':Sequelize[_0x635e('0x2')]},'context':{'type':Sequelize[_0x635e('0x2')]},'exten':{'type':Sequelize[_0x635e('0x2')]},'priority':{'type':Sequelize[_0x635e('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x635e('0x2')]},'destchannel':{'type':Sequelize[_0x635e('0x2')]},'destchannelstate':{'type':Sequelize[_0x635e('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x635e('0x2')]},'destcalleridnum':{'type':Sequelize[_0x635e('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x635e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x635e('0x2')]},'destlanguage':{'type':Sequelize[_0x635e('0x2')]},'destaccountcode':{'type':Sequelize[_0x635e('0x2')]},'destcontext':{'type':Sequelize[_0x635e('0x2')]},'destexten':{'type':Sequelize[_0x635e('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x635e('0x2')]},'destlinkedid':{'type':Sequelize[_0x635e('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x635e('0x4')]},'answertime':{'type':Sequelize[_0x635e('0x4')]},'endtime':{'type':Sequelize[_0x635e('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x635e('0x5')},'routeId':{'type':Sequelize[_0x635e('0x3')]},'duration':{'type':Sequelize[_0x635e('0x3')]},'holdtime':{'type':Sequelize[_0x635e('0x3')]},'billableseconds':{'type':Sequelize[_0x635e('0x3')]}}; \ No newline at end of file +var _0x542e=['DATE','called,connect,complete','sequelize','exports','STRING','INTEGER'];(function(_0x35a274,_0x98b399){var _0x40d905=function(_0x5c8455){while(--_0x5c8455){_0x35a274['push'](_0x35a274['shift']());}};_0x40d905(++_0x98b399);}(_0x542e,0x104));var _0xe542=function(_0x415e96,_0x290213){_0x415e96=_0x415e96-0x0;var _0x35a097=_0x542e[_0x415e96];return _0x35a097;};'use strict';var Sequelize=require(_0xe542('0x0'));module[_0xe542('0x1')]={'privilege':{'type':Sequelize[_0xe542('0x2')]},'channel':{'type':Sequelize[_0xe542('0x2')]},'channelstate':{'type':Sequelize[_0xe542('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe542('0x2')]},'calleridname':{'type':Sequelize[_0xe542('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe542('0x2')]},'connectedlinename':{'type':Sequelize[_0xe542('0x2')]},'language':{'type':Sequelize[_0xe542('0x2')]},'accountcode':{'type':Sequelize[_0xe542('0x2')]},'context':{'type':Sequelize[_0xe542('0x2')]},'exten':{'type':Sequelize[_0xe542('0x2')]},'priority':{'type':Sequelize[_0xe542('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xe542('0x2')]},'destchannel':{'type':Sequelize[_0xe542('0x2')]},'destchannelstate':{'type':Sequelize[_0xe542('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xe542('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xe542('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xe542('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xe542('0x2')]},'destlanguage':{'type':Sequelize[_0xe542('0x2')]},'destaccountcode':{'type':Sequelize[_0xe542('0x2')]},'destcontext':{'type':Sequelize[_0xe542('0x2')]},'destexten':{'type':Sequelize[_0xe542('0x2')]},'destpriority':{'type':Sequelize[_0xe542('0x3')]},'destuniqueid':{'type':Sequelize[_0xe542('0x2')]},'destlinkedid':{'type':Sequelize[_0xe542('0x2')]},'dialstring':{'type':Sequelize[_0xe542('0x2')]},'dialstatus':{'type':Sequelize[_0xe542('0x2')]},'starttime':{'type':Sequelize[_0xe542('0x4')]},'answertime':{'type':Sequelize[_0xe542('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xe542('0x2')],'comment':_0xe542('0x5')},'routeId':{'type':Sequelize[_0xe542('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xe542('0x3')]},'billableseconds':{'type':Sequelize[_0xe542('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 296f751..067b20a 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 _0x4045=['count','offset','limit','set','Content-Range','apply','save','update','then','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','body','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json'];(function(_0x40b47f,_0x4ba03d){var _0x46ab88=function(_0x359c4b){while(--_0x359c4b){_0x40b47f['push'](_0x40b47f['shift']());}};_0x46ab88(++_0x4ba03d);}(_0x4045,0x14b));var _0x5404=function(_0x575e54,_0x5406f4){_0x575e54=_0x575e54-0x0;var _0x128cee=_0x4045[_0x575e54];return _0x128cee;};'use strict';var pdf=require(_0x5404('0x0'));var emlformat=require(_0x5404('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5404('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5404('0x3'));var moment=require(_0x5404('0x4'));var BPromise=require(_0x5404('0x5'));var Mustache=require(_0x5404('0x6'));var util=require(_0x5404('0x7'));var path=require(_0x5404('0x8'));var sox=require(_0x5404('0x9'));var csv=require('to-csv');var ejs=require(_0x5404('0xa'));var fs=require('fs');var _=require(_0x5404('0xb'));var squel=require(_0x5404('0xc'));var crypto=require('crypto');var jsforce=require(_0x5404('0xd'));var deskjs=require(_0x5404('0xe'));var toCsv=require(_0x5404('0xf'));var querystring=require(_0x5404('0x10'));var Papa=require(_0x5404('0x11'));var Redis=require('ioredis');var authService=require(_0x5404('0x12'));var qs=require(_0x5404('0x13'));var as=require(_0x5404('0x14'));var hardwareService=require(_0x5404('0x15'));var logger=require(_0x5404('0x16'))(_0x5404('0x17'));var utils=require(_0x5404('0x18'));var config=require(_0x5404('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x250357,_0x31bd6a){_0x31bd6a=_0x31bd6a||0xcc;return function(_0x3bede8){if(_0x3bede8){return _0x250357['sendStatus'](_0x31bd6a);}return _0x250357[_0x5404('0x1a')](_0x31bd6a)[_0x5404('0x1b')]();};}function respondWithResult(_0x12bb26,_0x3bfa6e){_0x3bfa6e=_0x3bfa6e||0xc8;return function(_0x544484){if(_0x544484){return _0x12bb26[_0x5404('0x1a')](_0x3bfa6e)[_0x5404('0x1c')](_0x544484);}};}function respondWithFilteredResult(_0x452e4e,_0x405f52){return function(_0x322f3c){if(_0x322f3c){var _0xefab74=_0x322f3c[_0x5404('0x1d')],_0x4d5858=_0x405f52[_0x5404('0x1e')],_0x3810f2=_0x405f52[_0x5404('0x1e')]+_0x405f52[_0x5404('0x1f')],_0x1fc072;if(_0x3810f2>=_0xefab74){_0x3810f2=_0xefab74;_0x1fc072=0xc8;}else{_0x1fc072=0xce;}_0x452e4e['status'](_0x1fc072);return _0x452e4e[_0x5404('0x20')](_0x5404('0x21'),_0x4d5858+'-'+_0x3810f2+'/'+_0xefab74)['json'](_0x322f3c);}return null;};}function patchUpdates(_0x3a260c){return function(_0x15f67){try{jsonpatch[_0x5404('0x22')](_0x15f67,_0x3a260c,!![]);}catch(_0x3d1801){return BPromise['reject'](_0x3d1801);}return _0x15f67[_0x5404('0x23')]();};}function saveUpdates(_0xf3fbf7,_0x246755){return function(_0x277589){if(_0x277589){return _0x277589[_0x5404('0x24')](_0xf3fbf7)[_0x5404('0x25')](function(_0x2a74f6){return _0x2a74f6;});}return null;};}function removeEntity(_0x1869be,_0x2a7f8c){return function(_0x1899eb){if(_0x1899eb){return _0x1899eb['destroy']()[_0x5404('0x25')](function(){_0x1869be[_0x5404('0x1a')](0xcc)[_0x5404('0x1b')]();});}};}function handleEntityNotFound(_0x4979f7,_0x2e0d6a){return function(_0x4905d2){if(!_0x4905d2){_0x4979f7['sendStatus'](0x194);}return _0x4905d2;};}function handleError(_0x419598,_0x305963){_0x305963=_0x305963||0x1f4;return function(_0xaf151a){logger['error'](_0xaf151a[_0x5404('0x26')]);if(_0xaf151a[_0x5404('0x27')]){delete _0xaf151a[_0x5404('0x27')];}_0x419598['status'](_0x305963)[_0x5404('0x28')](_0xaf151a);};}exports[_0x5404('0x29')]=function(_0x3a96d6,_0x2c430f){var _0x4108e4={},_0x25e6ee={},_0x3f300b={'count':0x0,'rows':[]};var _0x4135fb=_[_0x5404('0x2a')](db[_0x5404('0x2b')][_0x5404('0x2c')],function(_0x117e16){return{'name':_0x117e16[_0x5404('0x2d')],'type':_0x117e16[_0x5404('0x2e')][_0x5404('0x2f')]};});_0x25e6ee[_0x5404('0x30')]=_[_0x5404('0x2a')](_0x4135fb,_0x5404('0x27'));_0x25e6ee[_0x5404('0x31')]=_['keys'](_0x3a96d6[_0x5404('0x31')]);_0x25e6ee['filters']=_[_0x5404('0x32')](_0x25e6ee[_0x5404('0x30')],_0x25e6ee[_0x5404('0x31')]);_0x4108e4['attributes']=_[_0x5404('0x32')](_0x25e6ee['model'],qs[_0x5404('0x33')](_0x3a96d6['query'][_0x5404('0x33')]));_0x4108e4['attributes']=_0x4108e4[_0x5404('0x34')][_0x5404('0x35')]?_0x4108e4['attributes']:_0x25e6ee[_0x5404('0x30')];if(!_0x3a96d6['query']['hasOwnProperty'](_0x5404('0x36'))){_0x4108e4[_0x5404('0x1f')]=qs[_0x5404('0x1f')](_0x3a96d6[_0x5404('0x31')][_0x5404('0x1f')]);_0x4108e4[_0x5404('0x1e')]=qs['offset'](_0x3a96d6[_0x5404('0x31')][_0x5404('0x1e')]);}_0x4108e4['order']=qs['sort'](_0x3a96d6[_0x5404('0x31')]['sort']);_0x4108e4[_0x5404('0x37')]=qs[_0x5404('0x38')](_['pick'](_0x3a96d6['query'],_0x25e6ee[_0x5404('0x38')]),_0x4135fb);if(_0x3a96d6['query'][_0x5404('0x39')]){_0x4108e4[_0x5404('0x37')]=_[_0x5404('0x3a')](_0x4108e4[_0x5404('0x37')],{'$or':_[_0x5404('0x2a')](_0x4135fb,function(_0x14e216){if(_0x14e216[_0x5404('0x2e')]!==_0x5404('0x3b')){var _0x5537e0={};_0x5537e0[_0x14e216[_0x5404('0x27')]]={'$like':'%'+_0x3a96d6[_0x5404('0x31')]['filter']+'%'};return _0x5537e0;}})});}_0x4108e4=_[_0x5404('0x3a')]({},_0x4108e4,_0x3a96d6[_0x5404('0x3c')]);var _0xcdb106={'where':_0x4108e4[_0x5404('0x37')]};return db[_0x5404('0x2b')][_0x5404('0x1d')](_0xcdb106)['then'](function(_0x19af8c){_0x3f300b[_0x5404('0x1d')]=_0x19af8c;if(_0x3a96d6[_0x5404('0x31')][_0x5404('0x3d')]){_0x4108e4[_0x5404('0x3e')]=[{'all':!![]}];}return db[_0x5404('0x2b')][_0x5404('0x3f')](_0x4108e4);})[_0x5404('0x25')](function(_0x1deedb){_0x3f300b[_0x5404('0x40')]=_0x1deedb;return _0x3f300b;})[_0x5404('0x25')](respondWithFilteredResult(_0x2c430f,_0x4108e4))['catch'](handleError(_0x2c430f,null));};exports[_0x5404('0x41')]=function(_0x2dc175,_0x39bdcb){var _0x4f2c54={'raw':!![],'where':{'id':_0x2dc175[_0x5404('0x42')]['id']}},_0xa4f17f={};_0xa4f17f['model']=_[_0x5404('0x43')](db[_0x5404('0x2b')][_0x5404('0x2c')]);_0xa4f17f['query']=_['keys'](_0x2dc175[_0x5404('0x31')]);_0xa4f17f['filters']=_[_0x5404('0x32')](_0xa4f17f[_0x5404('0x30')],_0xa4f17f['query']);_0x4f2c54[_0x5404('0x34')]=_['intersection'](_0xa4f17f['model'],qs[_0x5404('0x33')](_0x2dc175[_0x5404('0x31')][_0x5404('0x33')]));_0x4f2c54[_0x5404('0x34')]=_0x4f2c54[_0x5404('0x34')][_0x5404('0x35')]?_0x4f2c54[_0x5404('0x34')]:_0xa4f17f[_0x5404('0x30')];if(_0x2dc175[_0x5404('0x31')][_0x5404('0x3d')]){_0x4f2c54['include']=[{'all':!![]}];}_0x4f2c54=_['merge']({},_0x4f2c54,_0x2dc175[_0x5404('0x3c')]);return db['VoiceDialReport'][_0x5404('0x44')](_0x4f2c54)[_0x5404('0x25')](handleEntityNotFound(_0x39bdcb,null))[_0x5404('0x25')](respondWithResult(_0x39bdcb,null))[_0x5404('0x45')](handleError(_0x39bdcb,null));};exports['create']=function(_0x16245b,_0x250eff){return db[_0x5404('0x2b')]['create'](_0x16245b[_0x5404('0x46')],{})[_0x5404('0x25')](respondWithResult(_0x250eff,0xc9))['catch'](handleError(_0x250eff,null));};exports[_0x5404('0x24')]=function(_0x4d09f6,_0xf09137){if(_0x4d09f6[_0x5404('0x46')]['id']){delete _0x4d09f6[_0x5404('0x46')]['id'];}return db[_0x5404('0x2b')]['find']({'where':{'id':_0x4d09f6[_0x5404('0x42')]['id']}})[_0x5404('0x25')](handleEntityNotFound(_0xf09137,null))[_0x5404('0x25')](saveUpdates(_0x4d09f6[_0x5404('0x46')],null))[_0x5404('0x25')](respondWithResult(_0xf09137,null))['catch'](handleError(_0xf09137,null));};exports['destroy']=function(_0x30b1e1,_0x5ea14c){return db[_0x5404('0x2b')][_0x5404('0x44')]({'where':{'id':_0x30b1e1[_0x5404('0x42')]['id']}})['then'](handleEntityNotFound(_0x5ea14c,null))[_0x5404('0x25')](removeEntity(_0x5ea14c,null))[_0x5404('0x45')](handleError(_0x5ea14c,null));};exports[_0x5404('0x47')]=function(_0x1497fd,_0x26246a){return db[_0x5404('0x2b')]['describe']()['then'](respondWithResult(_0x26246a,null))[_0x5404('0x45')](handleError(_0x26246a,null));}; \ No newline at end of file +var _0xacf7=['fields','length','order','sort','where','filter','merge','options','count','includeAll','include','findAll','catch','show','params','keys','find','create','body','update','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','then','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','query','filters','intersection','attributes','model'];(function(_0x698e19,_0x37fd58){var _0x3db5bf=function(_0x73b6b0){while(--_0x73b6b0){_0x698e19['push'](_0x698e19['shift']());}};_0x3db5bf(++_0x37fd58);}(_0xacf7,0x1d2));var _0x7acf=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xacf7[_0x4b369d];return _0x571a98;};'use strict';var pdf=require(_0x7acf('0x0'));var emlformat=require(_0x7acf('0x1'));var rimraf=require(_0x7acf('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7acf('0x3'));var rp=require(_0x7acf('0x4'));var moment=require(_0x7acf('0x5'));var BPromise=require(_0x7acf('0x6'));var Mustache=require(_0x7acf('0x7'));var util=require(_0x7acf('0x8'));var path=require('path');var sox=require(_0x7acf('0x9'));var csv=require('to-csv');var ejs=require(_0x7acf('0xa'));var fs=require('fs');var _=require(_0x7acf('0xb'));var squel=require(_0x7acf('0xc'));var crypto=require(_0x7acf('0xd'));var jsforce=require(_0x7acf('0xe'));var deskjs=require(_0x7acf('0xf'));var toCsv=require(_0x7acf('0x10'));var querystring=require(_0x7acf('0x11'));var Papa=require(_0x7acf('0x12'));var Redis=require('ioredis');var authService=require(_0x7acf('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7acf('0x14'));var hardwareService=require(_0x7acf('0x15'));var logger=require(_0x7acf('0x16'))(_0x7acf('0x17'));var utils=require(_0x7acf('0x18'));var config=require(_0x7acf('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x7acf('0x1a'))['db'];function respondWithStatusCode(_0x28d047,_0xf8bf6f){_0xf8bf6f=_0xf8bf6f||0xcc;return function(_0x5109ea){if(_0x5109ea){return _0x28d047[_0x7acf('0x1b')](_0xf8bf6f);}return _0x28d047[_0x7acf('0x1c')](_0xf8bf6f)[_0x7acf('0x1d')]();};}function respondWithResult(_0x5184aa,_0x4b113f){_0x4b113f=_0x4b113f||0xc8;return function(_0x10c5c0){if(_0x10c5c0){return _0x5184aa[_0x7acf('0x1c')](_0x4b113f)[_0x7acf('0x1e')](_0x10c5c0);}};}function respondWithFilteredResult(_0x3dfb10,_0x31c8b0){return function(_0x2e3a60){if(_0x2e3a60){var _0x1df01b=_0x2e3a60['count'],_0x4b303a=_0x31c8b0[_0x7acf('0x1f')],_0x21bf76=_0x31c8b0[_0x7acf('0x1f')]+_0x31c8b0[_0x7acf('0x20')],_0x5530e8;if(_0x21bf76>=_0x1df01b){_0x21bf76=_0x1df01b;_0x5530e8=0xc8;}else{_0x5530e8=0xce;}_0x3dfb10[_0x7acf('0x1c')](_0x5530e8);return _0x3dfb10[_0x7acf('0x21')](_0x7acf('0x22'),_0x4b303a+'-'+_0x21bf76+'/'+_0x1df01b)[_0x7acf('0x1e')](_0x2e3a60);}return null;};}function patchUpdates(_0x86de96){return function(_0x327003){try{jsonpatch['apply'](_0x327003,_0x86de96,!![]);}catch(_0x1e2b1c){return BPromise[_0x7acf('0x23')](_0x1e2b1c);}return _0x327003['save']();};}function saveUpdates(_0xdb5f3c,_0x5c6295){return function(_0xe37d9d){if(_0xe37d9d){return _0xe37d9d['update'](_0xdb5f3c)['then'](function(_0x3e97ea){return _0x3e97ea;});}return null;};}function removeEntity(_0x5e47c6,_0x4a5763){return function(_0x113500){if(_0x113500){return _0x113500['destroy']()[_0x7acf('0x24')](function(){_0x5e47c6[_0x7acf('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c9f2a,_0x2670b6){return function(_0x460594){if(!_0x460594){_0x4c9f2a['sendStatus'](0x194);}return _0x460594;};}function handleError(_0x3271e1,_0x4d0791){_0x4d0791=_0x4d0791||0x1f4;return function(_0x50d3e6){logger[_0x7acf('0x25')](_0x50d3e6[_0x7acf('0x26')]);if(_0x50d3e6[_0x7acf('0x27')]){delete _0x50d3e6[_0x7acf('0x27')];}_0x3271e1[_0x7acf('0x1c')](_0x4d0791)[_0x7acf('0x28')](_0x50d3e6);};}exports[_0x7acf('0x29')]=function(_0x167634,_0xdd5d46){var _0x4a8eb2={},_0xc0c0f7={},_0x41771d={'count':0x0,'rows':[]};var _0x460253=_[_0x7acf('0x2a')](db[_0x7acf('0x2b')][_0x7acf('0x2c')],function(_0x8ddbcf){return{'name':_0x8ddbcf[_0x7acf('0x2d')],'type':_0x8ddbcf[_0x7acf('0x2e')]['key']};});_0xc0c0f7['model']=_[_0x7acf('0x2a')](_0x460253,_0x7acf('0x27'));_0xc0c0f7['query']=_['keys'](_0x167634[_0x7acf('0x2f')]);_0xc0c0f7[_0x7acf('0x30')]=_[_0x7acf('0x31')](_0xc0c0f7['model'],_0xc0c0f7[_0x7acf('0x2f')]);_0x4a8eb2[_0x7acf('0x32')]=_[_0x7acf('0x31')](_0xc0c0f7[_0x7acf('0x33')],qs['fields'](_0x167634[_0x7acf('0x2f')][_0x7acf('0x34')]));_0x4a8eb2[_0x7acf('0x32')]=_0x4a8eb2[_0x7acf('0x32')][_0x7acf('0x35')]?_0x4a8eb2[_0x7acf('0x32')]:_0xc0c0f7[_0x7acf('0x33')];if(!_0x167634['query']['hasOwnProperty']('nolimit')){_0x4a8eb2[_0x7acf('0x20')]=qs[_0x7acf('0x20')](_0x167634[_0x7acf('0x2f')][_0x7acf('0x20')]);_0x4a8eb2['offset']=qs[_0x7acf('0x1f')](_0x167634[_0x7acf('0x2f')][_0x7acf('0x1f')]);}_0x4a8eb2[_0x7acf('0x36')]=qs[_0x7acf('0x37')](_0x167634[_0x7acf('0x2f')][_0x7acf('0x37')]);_0x4a8eb2[_0x7acf('0x38')]=qs[_0x7acf('0x30')](_['pick'](_0x167634[_0x7acf('0x2f')],_0xc0c0f7[_0x7acf('0x30')]),_0x460253);if(_0x167634['query'][_0x7acf('0x39')]){_0x4a8eb2[_0x7acf('0x38')]=_[_0x7acf('0x3a')](_0x4a8eb2[_0x7acf('0x38')],{'$or':_['map'](_0x460253,function(_0x4ce7de){if(_0x4ce7de['type']!=='VIRTUAL'){var _0x127a74={};_0x127a74[_0x4ce7de['name']]={'$like':'%'+_0x167634[_0x7acf('0x2f')][_0x7acf('0x39')]+'%'};return _0x127a74;}})});}_0x4a8eb2=_[_0x7acf('0x3a')]({},_0x4a8eb2,_0x167634[_0x7acf('0x3b')]);var _0x14d02f={'where':_0x4a8eb2[_0x7acf('0x38')]};return db[_0x7acf('0x2b')]['count'](_0x14d02f)[_0x7acf('0x24')](function(_0x367362){_0x41771d[_0x7acf('0x3c')]=_0x367362;if(_0x167634['query'][_0x7acf('0x3d')]){_0x4a8eb2[_0x7acf('0x3e')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x7acf('0x3f')](_0x4a8eb2);})[_0x7acf('0x24')](function(_0xf38e61){_0x41771d['rows']=_0xf38e61;return _0x41771d;})[_0x7acf('0x24')](respondWithFilteredResult(_0xdd5d46,_0x4a8eb2))[_0x7acf('0x40')](handleError(_0xdd5d46,null));};exports[_0x7acf('0x41')]=function(_0x4559a1,_0x5b5937){var _0x3fee19={'raw':!![],'where':{'id':_0x4559a1[_0x7acf('0x42')]['id']}},_0x5292d6={};_0x5292d6[_0x7acf('0x33')]=_[_0x7acf('0x43')](db['VoiceDialReport'][_0x7acf('0x2c')]);_0x5292d6['query']=_[_0x7acf('0x43')](_0x4559a1['query']);_0x5292d6[_0x7acf('0x30')]=_[_0x7acf('0x31')](_0x5292d6[_0x7acf('0x33')],_0x5292d6[_0x7acf('0x2f')]);_0x3fee19['attributes']=_[_0x7acf('0x31')](_0x5292d6['model'],qs['fields'](_0x4559a1[_0x7acf('0x2f')][_0x7acf('0x34')]));_0x3fee19[_0x7acf('0x32')]=_0x3fee19[_0x7acf('0x32')][_0x7acf('0x35')]?_0x3fee19[_0x7acf('0x32')]:_0x5292d6[_0x7acf('0x33')];if(_0x4559a1[_0x7acf('0x2f')]['includeAll']){_0x3fee19['include']=[{'all':!![]}];}_0x3fee19=_['merge']({},_0x3fee19,_0x4559a1['options']);return db[_0x7acf('0x2b')][_0x7acf('0x44')](_0x3fee19)[_0x7acf('0x24')](handleEntityNotFound(_0x5b5937,null))['then'](respondWithResult(_0x5b5937,null))['catch'](handleError(_0x5b5937,null));};exports[_0x7acf('0x45')]=function(_0x479110,_0x425e0c){return db['VoiceDialReport']['create'](_0x479110[_0x7acf('0x46')],{})[_0x7acf('0x24')](respondWithResult(_0x425e0c,0xc9))[_0x7acf('0x40')](handleError(_0x425e0c,null));};exports[_0x7acf('0x47')]=function(_0x39c998,_0x377e59){if(_0x39c998[_0x7acf('0x46')]['id']){delete _0x39c998[_0x7acf('0x46')]['id'];}return db['VoiceDialReport'][_0x7acf('0x44')]({'where':{'id':_0x39c998[_0x7acf('0x42')]['id']}})[_0x7acf('0x24')](handleEntityNotFound(_0x377e59,null))[_0x7acf('0x24')](saveUpdates(_0x39c998['body'],null))['then'](respondWithResult(_0x377e59,null))[_0x7acf('0x40')](handleError(_0x377e59,null));};exports[_0x7acf('0x48')]=function(_0x2b06f4,_0x462e94){return db[_0x7acf('0x2b')][_0x7acf('0x44')]({'where':{'id':_0x2b06f4[_0x7acf('0x42')]['id']}})[_0x7acf('0x24')](handleEntityNotFound(_0x462e94,null))[_0x7acf('0x24')](removeEntity(_0x462e94,null))['catch'](handleError(_0x462e94,null));};exports[_0x7acf('0x49')]=function(_0x546528,_0x207a86){return db[_0x7acf('0x2b')]['describe']()[_0x7acf('0x24')](respondWithResult(_0x207a86,null))[_0x7acf('0x40')](handleError(_0x207a86,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 1f53638..7e2b0a9 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 _0xdbfa=['rimraf','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0xcfc44,_0x179bc1){var _0x307a25=function(_0x2b64de){while(--_0x2b64de){_0xcfc44['push'](_0xcfc44['shift']());}};_0x307a25(++_0x179bc1);}(_0xdbfa,0x186));var _0xadbf=function(_0x5a24b4,_0x4999c5){_0x5a24b4=_0x5a24b4-0x0;var _0x526252=_0xdbfa[_0x5a24b4];return _0x526252;};'use strict';var _=require(_0xadbf('0x0'));var util=require(_0xadbf('0x1'));var logger=require(_0xadbf('0x2'))('api');var moment=require('moment');var BPromise=require(_0xadbf('0x3'));var rp=require(_0xadbf('0x4'));var fs=require('fs');var path=require(_0xadbf('0x5'));var rimraf=require(_0xadbf('0x6'));var config=require('../../config/environment');var attributes=require(_0xadbf('0x7'));module[_0xadbf('0x8')]=function(_0x332225,_0x19bf73){return _0x332225[_0xadbf('0x9')](_0xadbf('0xa'),attributes,{'tableName':_0xadbf('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xefa7=['path','rimraf','../../config/environment','exports','VoiceDialReport','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x1b1f06,_0x550602){var _0x3cfe02=function(_0x4a580a){while(--_0x4a580a){_0x1b1f06['push'](_0x1b1f06['shift']());}};_0x3cfe02(++_0x550602);}(_0xefa7,0x1b3));var _0x7efa=function(_0x533a22,_0x54fe4c){_0x533a22=_0x533a22-0x0;var _0x3587f0=_0xefa7[_0x533a22];return _0x3587f0;};'use strict';var _=require(_0x7efa('0x0'));var util=require(_0x7efa('0x1'));var logger=require(_0x7efa('0x2'))(_0x7efa('0x3'));var moment=require(_0x7efa('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7efa('0x5'));var rimraf=require(_0x7efa('0x6'));var config=require(_0x7efa('0x7'));var attributes=require('./voiceDialReport.attributes');module[_0x7efa('0x8')]=function(_0x21b808,_0x3de454){return _0x21b808['define'](_0x7efa('0x9'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x7efa('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 9b0f5bd..98f8133 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 _0x19e6=['stringify','error','code','message','result','CreateVoiceDialReport','create','options','raw','catch','UpdateVoiceDialReport','VoiceDialReport','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x516d17,_0x33afaf){var _0x841c1d=function(_0xdcac6c){while(--_0xdcac6c){_0x516d17['push'](_0x516d17['shift']());}};_0x841c1d(++_0x33afaf);}(_0x19e6,0xd6));var _0x619e=function(_0x41d2c6,_0x4c1a0c){_0x41d2c6=_0x41d2c6-0x0;var _0x1ec2ca=_0x19e6[_0x41d2c6];return _0x1ec2ca;};'use strict';var _=require(_0x619e('0x0'));var util=require(_0x619e('0x1'));var moment=require(_0x619e('0x2'));var BPromise=require(_0x619e('0x3'));var rs=require(_0x619e('0x4'));var fs=require('fs');var Redis=require(_0x619e('0x5'));var db=require(_0x619e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x619e('0x7'))(_0x619e('0x8'));var config=require('../../config/environment');var jayson=require(_0x619e('0x9'));var client=jayson[_0x619e('0xa')][_0x619e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48a3aa,_0x43f764,_0x50d7fc){return new BPromise(function(_0x2de837,_0x105a87){return client['request'](_0x48a3aa,_0x50d7fc)[_0x619e('0xc')](function(_0x110c7e){logger[_0x619e('0xd')](_0x619e('0xe'),_0x43f764,_0x619e('0xf'));logger[_0x619e('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x43f764,_0x619e('0xf'),JSON[_0x619e('0x11')](_0x110c7e));if(_0x110c7e[_0x619e('0x12')]){if(_0x110c7e[_0x619e('0x12')][_0x619e('0x13')]===0x1f4){logger[_0x619e('0x12')](_0x619e('0xe'),_0x43f764,_0x110c7e['error'][_0x619e('0x14')]);return _0x105a87(_0x110c7e[_0x619e('0x12')]['message']);}logger[_0x619e('0x12')](_0x619e('0xe'),_0x43f764,_0x110c7e['error'][_0x619e('0x14')]);return _0x2de837(_0x110c7e['error']['message']);}else{logger[_0x619e('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x43f764,'request\x20sent');_0x2de837(_0x110c7e[_0x619e('0x15')][_0x619e('0x14')]);}})['catch'](function(_0xb3e376){logger[_0x619e('0x12')](_0x619e('0xe'),_0x43f764,_0xb3e376);_0x105a87(_0xb3e376);});});}exports[_0x619e('0x16')]=function(_0x1fce67){var _0x23bf7a=this;return new Promise(function(_0x43d3be,_0x27a7dc){return db['VoiceDialReport'][_0x619e('0x17')](_0x1fce67['body'],{'raw':_0x1fce67['options']?_0x1fce67[_0x619e('0x18')][_0x619e('0x19')]===undefined?!![]:![]:!![]})[_0x619e('0xc')](function(_0x703982){logger[_0x619e('0xd')](_0x619e('0x16'),_0x1fce67);logger[_0x619e('0x10')](_0x619e('0x16'),_0x1fce67,JSON[_0x619e('0x11')](_0x703982));_0x43d3be(_0x703982);})[_0x619e('0x1a')](function(_0x1b13a9){logger[_0x619e('0x12')](_0x619e('0x16'),_0x1b13a9[_0x619e('0x14')],_0x1fce67);_0x27a7dc(_0x23bf7a[_0x619e('0x12')](0x1f4,_0x1b13a9[_0x619e('0x14')]));});});};exports[_0x619e('0x1b')]=function(_0x460cc2){var _0x439b20=this;return new Promise(function(_0x560ce5,_0x253e09){return db[_0x619e('0x1c')]['update'](_0x460cc2[_0x619e('0x1d')],{'raw':_0x460cc2['options']?_0x460cc2[_0x619e('0x18')][_0x619e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x460cc2[_0x619e('0x18')]?_0x460cc2[_0x619e('0x18')][_0x619e('0x1e')]||null:null,'attributes':_0x460cc2['options']?_0x460cc2[_0x619e('0x18')][_0x619e('0x1f')]||null:null,'limit':_0x460cc2[_0x619e('0x18')]?_0x460cc2[_0x619e('0x18')][_0x619e('0x20')]||null:null})['then'](function(_0x47f1c3){logger['info']('UpdateVoiceDialReport',_0x460cc2);logger[_0x619e('0x10')](_0x619e('0x1b'),_0x460cc2,JSON['stringify'](_0x47f1c3));_0x560ce5(_0x47f1c3);})['catch'](function(_0x3bdaeb){logger['error']('UpdateVoiceDialReport',_0x3bdaeb['message'],_0x460cc2);_0x253e09(_0x439b20[_0x619e('0x12')](0x1f4,_0x3bdaeb[_0x619e('0x14')]));});});}; \ No newline at end of file +var _0xdcd3=['../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','VoiceDialReport,\x20%s,\x20%s','result','catch','CreateVoiceDialReport','create','body','options','raw','then','stringify','UpdateVoiceDialReport','VoiceDialReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0xda1de5,_0x231f2c){var _0x52079b=function(_0x2cfa6f){while(--_0x2cfa6f){_0xda1de5['push'](_0xda1de5['shift']());}};_0x52079b(++_0x231f2c);}(_0xdcd3,0x1a8));var _0x3dcd=function(_0x4875a4,_0x3640b7){_0x4875a4=_0x4875a4-0x0;var _0x3ed6d4=_0xdcd3[_0x4875a4];return _0x3ed6d4;};'use strict';var _=require('lodash');var util=require(_0x3dcd('0x0'));var moment=require(_0x3dcd('0x1'));var BPromise=require(_0x3dcd('0x2'));var rs=require(_0x3dcd('0x3'));var fs=require('fs');var Redis=require(_0x3dcd('0x4'));var db=require(_0x3dcd('0x5'))['db'];var utils=require(_0x3dcd('0x6'));var logger=require('../../config/logger')(_0x3dcd('0x7'));var config=require(_0x3dcd('0x8'));var jayson=require(_0x3dcd('0x9'));var client=jayson[_0x3dcd('0xa')][_0x3dcd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50850f,_0x410aac,_0x19afe1){return new BPromise(function(_0x36818d,_0x3f7051){return client[_0x3dcd('0xc')](_0x50850f,_0x19afe1)['then'](function(_0x11a502){logger[_0x3dcd('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x410aac,_0x3dcd('0xe'));logger[_0x3dcd('0xf')](_0x3dcd('0x10'),_0x410aac,'request\x20sent',JSON['stringify'](_0x11a502));if(_0x11a502[_0x3dcd('0x11')]){if(_0x11a502[_0x3dcd('0x11')][_0x3dcd('0x12')]===0x1f4){logger[_0x3dcd('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x410aac,_0x11a502[_0x3dcd('0x11')][_0x3dcd('0x13')]);return _0x3f7051(_0x11a502[_0x3dcd('0x11')][_0x3dcd('0x13')]);}logger[_0x3dcd('0x11')](_0x3dcd('0x14'),_0x410aac,_0x11a502['error'][_0x3dcd('0x13')]);return _0x36818d(_0x11a502[_0x3dcd('0x11')][_0x3dcd('0x13')]);}else{logger[_0x3dcd('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x410aac,_0x3dcd('0xe'));_0x36818d(_0x11a502[_0x3dcd('0x15')]['message']);}})[_0x3dcd('0x16')](function(_0x9b9068){logger['error'](_0x3dcd('0x14'),_0x410aac,_0x9b9068);_0x3f7051(_0x9b9068);});});}exports[_0x3dcd('0x17')]=function(_0x185e3e){var _0xb8b986=this;return new Promise(function(_0x594a7e,_0x5c962b){return db['VoiceDialReport'][_0x3dcd('0x18')](_0x185e3e[_0x3dcd('0x19')],{'raw':_0x185e3e[_0x3dcd('0x1a')]?_0x185e3e[_0x3dcd('0x1a')][_0x3dcd('0x1b')]===undefined?!![]:![]:!![]})[_0x3dcd('0x1c')](function(_0x14aa91){logger[_0x3dcd('0xd')](_0x3dcd('0x17'),_0x185e3e);logger['debug'](_0x3dcd('0x17'),_0x185e3e,JSON[_0x3dcd('0x1d')](_0x14aa91));_0x594a7e(_0x14aa91);})['catch'](function(_0x3a6e90){logger[_0x3dcd('0x11')](_0x3dcd('0x17'),_0x3a6e90[_0x3dcd('0x13')],_0x185e3e);_0x5c962b(_0xb8b986[_0x3dcd('0x11')](0x1f4,_0x3a6e90[_0x3dcd('0x13')]));});});};exports[_0x3dcd('0x1e')]=function(_0xf23e7f){var _0x56c801=this;return new Promise(function(_0x2909d2,_0x106619){return db[_0x3dcd('0x1f')][_0x3dcd('0x20')](_0xf23e7f['body'],{'raw':_0xf23e7f[_0x3dcd('0x1a')]?_0xf23e7f[_0x3dcd('0x1a')][_0x3dcd('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf23e7f[_0x3dcd('0x1a')]?_0xf23e7f[_0x3dcd('0x1a')][_0x3dcd('0x21')]||null:null,'attributes':_0xf23e7f[_0x3dcd('0x1a')]?_0xf23e7f[_0x3dcd('0x1a')][_0x3dcd('0x22')]||null:null,'limit':_0xf23e7f[_0x3dcd('0x1a')]?_0xf23e7f[_0x3dcd('0x1a')][_0x3dcd('0x23')]||null:null})['then'](function(_0x36a273){logger['info'](_0x3dcd('0x1e'),_0xf23e7f);logger[_0x3dcd('0xf')](_0x3dcd('0x1e'),_0xf23e7f,JSON[_0x3dcd('0x1d')](_0x36a273));_0x2909d2(_0x36a273);})[_0x3dcd('0x16')](function(_0x46ad3e){logger[_0x3dcd('0x11')]('UpdateVoiceDialReport',_0x46ad3e[_0x3dcd('0x13')],_0xf23e7f);_0x106619(_0x56c801[_0x3dcd('0x11')](0x1f4,_0x46ad3e[_0x3dcd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index de96b77..f6544d3 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 _0x7f11=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','/:id/applications','addApplications','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x12e7b8,_0x65f525){var _0x2ba712=function(_0x5aa850){while(--_0x5aa850){_0x12e7b8['push'](_0x12e7b8['shift']());}};_0x2ba712(++_0x65f525);}(_0x7f11,0x10c));var _0x17f1=function(_0xa72c46,_0x5d6163){_0xa72c46=_0xa72c46-0x0;var _0x2cc7a6=_0x7f11[_0xa72c46];return _0x2cc7a6;};'use strict';var multer=require(_0x17f1('0x0'));var util=require(_0x17f1('0x1'));var path=require(_0x17f1('0x2'));var timeout=require(_0x17f1('0x3'));var express=require(_0x17f1('0x4'));var router=express[_0x17f1('0x5')]();var auth=require(_0x17f1('0x6'));var interaction=require(_0x17f1('0x7'));var config=require(_0x17f1('0x8'));var controller=require('./voiceExtension.controller');router[_0x17f1('0x9')]('/',auth[_0x17f1('0xa')](),controller[_0x17f1('0xb')]);router[_0x17f1('0x9')](_0x17f1('0xc'),auth['isAuthenticated'](),controller[_0x17f1('0xd')]);router[_0x17f1('0xe')]('/',auth[_0x17f1('0xa')](),controller['create']);router['post'](_0x17f1('0xf'),auth['isAuthenticated'](),controller[_0x17f1('0x10')]);router['put']('/:id',auth[_0x17f1('0xa')](),controller[_0x17f1('0x11')]);router[_0x17f1('0x12')](_0x17f1('0xc'),auth['isAuthenticated'](),controller[_0x17f1('0x13')]);module[_0x17f1('0x14')]=router; \ No newline at end of file +var _0x4d54=['./voiceExtension.controller','index','/:id','isAuthenticated','show','post','create','addApplications','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x36bf88,_0x15c459){var _0x332914=function(_0x512adf){while(--_0x512adf){_0x36bf88['push'](_0x36bf88['shift']());}};_0x332914(++_0x15c459);}(_0x4d54,0xc1));var _0x44d5=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x4d54[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x44d5('0x0'));var util=require('util');var path=require(_0x44d5('0x1'));var timeout=require(_0x44d5('0x2'));var express=require(_0x44d5('0x3'));var router=express[_0x44d5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x44d5('0x5'));var config=require(_0x44d5('0x6'));var controller=require(_0x44d5('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x44d5('0x8')]);router['get'](_0x44d5('0x9'),auth[_0x44d5('0xa')](),controller[_0x44d5('0xb')]);router[_0x44d5('0xc')]('/',auth['isAuthenticated'](),controller[_0x44d5('0xd')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0x44d5('0xe')]);router[_0x44d5('0xf')](_0x44d5('0x9'),auth[_0x44d5('0xa')](),controller[_0x44d5('0x10')]);router[_0x44d5('0x11')](_0x44d5('0x9'),auth[_0x44d5('0xa')](),controller[_0x44d5('0x12')]);module[_0x44d5('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 2a4c835..8e8928e 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(_0x343ea3,_0x520941){var _0x3d9fbf=function(_0x194095){while(--_0x194095){_0x343ea3['push'](_0x343ea3['shift']());}};_0x3d9fbf(++_0x520941);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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(_0x488b4d,_0x233540){var _0x51ee8f=function(_0x166556){while(--_0x166556){_0x488b4d['push'](_0x488b4d['shift']());}};_0x51ee8f(++_0x233540);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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 eee3ba4..33c5a4f 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 _0x0dcc=['VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','status','count','offset','limit','Content-Range','json','apply','reject','save','update','then','get','InboundRoutes','inbound','InternalRoutes','internal','filter','map','value','includes','type','find','name','UserProfileResource','end','stack','index','VoiceExtension','fieldName','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','merge','destroy','create','startsWith','body','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','OutboundRoutes','userProfileId','autoAssociation','description','cutdigits','context','addApplications','findOne','sequelize','transaction'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x0dcc,0x145));var _0xc0dc=function(_0x103ab3,_0x24957a){_0x103ab3=_0x103ab3-0x0;var _0x166d52=_0x0dcc[_0x103ab3];return _0x166d52;};'use strict';var pdf=require(_0xc0dc('0x0'));var emlformat=require(_0xc0dc('0x1'));var rimraf=require(_0xc0dc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc0dc('0x3'));var rp=require('request-promise');var moment=require(_0xc0dc('0x4'));var BPromise=require(_0xc0dc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc0dc('0x6'));var sox=require(_0xc0dc('0x7'));var csv=require(_0xc0dc('0x8'));var ejs=require(_0xc0dc('0x9'));var fs=require('fs');var _=require(_0xc0dc('0xa'));var squel=require(_0xc0dc('0xb'));var crypto=require(_0xc0dc('0xc'));var jsforce=require(_0xc0dc('0xd'));var deskjs=require(_0xc0dc('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc0dc('0xf'));var Papa=require(_0xc0dc('0x10'));var Redis=require(_0xc0dc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc0dc('0x12'));var as=require(_0xc0dc('0x13'));var hardwareService=require(_0xc0dc('0x14'));var logger=require(_0xc0dc('0x15'))(_0xc0dc('0x16'));var utils=require(_0xc0dc('0x17'));var config=require(_0xc0dc('0x18'));var licenseUtil=require(_0xc0dc('0x19'));var db=require(_0xc0dc('0x1a'))['db'];config[_0xc0dc('0x1b')]=_['defaults'](config[_0xc0dc('0x1b')],{'host':_0xc0dc('0x1c'),'port':0x18eb});var socket=require(_0xc0dc('0x1d'))(new Redis(config[_0xc0dc('0x1b')]));require(_0xc0dc('0x1e'))['register'](socket);function respondWithStatusCode(_0xc871e,_0xd8b713){_0xd8b713=_0xd8b713||0xcc;return function(_0x2a7951){if(_0x2a7951){return _0xc871e['sendStatus'](_0xd8b713);}return _0xc871e[_0xc0dc('0x1f')](_0xd8b713)['end']();};}function respondWithResult(_0x2f1c0a,_0x3f08f1){_0x3f08f1=_0x3f08f1||0xc8;return function(_0x32d4cb){if(_0x32d4cb){return _0x2f1c0a[_0xc0dc('0x1f')](_0x3f08f1)['json'](_0x32d4cb);}};}function respondWithFilteredResult(_0x29f8bc,_0x24b995){return function(_0x1b5f78){if(_0x1b5f78){var _0x47d0e7=_0x1b5f78[_0xc0dc('0x20')],_0x391a56=_0x24b995[_0xc0dc('0x21')],_0x5f35fd=_0x24b995[_0xc0dc('0x21')]+_0x24b995[_0xc0dc('0x22')],_0x3de6e8;if(_0x5f35fd>=_0x47d0e7){_0x5f35fd=_0x47d0e7;_0x3de6e8=0xc8;}else{_0x3de6e8=0xce;}_0x29f8bc[_0xc0dc('0x1f')](_0x3de6e8);return _0x29f8bc['set'](_0xc0dc('0x23'),_0x391a56+'-'+_0x5f35fd+'/'+_0x47d0e7)[_0xc0dc('0x24')](_0x1b5f78);}return null;};}function patchUpdates(_0x17be06){return function(_0x191a6f){try{jsonpatch[_0xc0dc('0x25')](_0x191a6f,_0x17be06,!![]);}catch(_0x5d592f){return BPromise[_0xc0dc('0x26')](_0x5d592f);}return _0x191a6f[_0xc0dc('0x27')]();};}function saveUpdates(_0x47a933,_0x5a5ab9){return function(_0x1816ae){if(_0x1816ae){return _0x1816ae[_0xc0dc('0x28')](_0x47a933)[_0xc0dc('0x29')](function(_0x51f8f2){return _0x51f8f2;});}return null;};}function removeEntity(_0x100a84,_0x20bdaa){return function(_0x26b75e){if(_0x26b75e){return _0x26b75e['destroy']()[_0xc0dc('0x29')](function(){var _0x18b06a=_0x26b75e[_0xc0dc('0x2a')]({'plain':!![]});var _0x47bec4=[{'name':_0xc0dc('0x2b'),'value':_0xc0dc('0x2c'),'ignore':![]},{'name':'OutboundRoutes','value':'outbound','ignore':![]},{'name':_0xc0dc('0x2d'),'value':_0xc0dc('0x2e'),'ignore':![]}];var _0x383aea=_(_0x47bec4)[_0xc0dc('0x2f')]('ignore')[_0xc0dc('0x30')](_0xc0dc('0x31'))[_0xc0dc('0x31')]();if(_[_0xc0dc('0x32')](_0x383aea,_0x18b06a[_0xc0dc('0x33')])){return;}var _0x511437=_[_0xc0dc('0x34')](_0x47bec4,[_0xc0dc('0x31'),_0x18b06a[_0xc0dc('0x33')]])[_0xc0dc('0x35')];return db[_0xc0dc('0x36')]['destroy']({'where':{'type':_0x511437,'resourceId':_0x18b06a['id']}})[_0xc0dc('0x29')](function(){return _0x26b75e;});})['then'](function(){_0x100a84['status'](0xcc)[_0xc0dc('0x37')]();});}};}function handleEntityNotFound(_0x5469b4,_0x47bdd4){return function(_0x2b679c){if(!_0x2b679c){_0x5469b4['sendStatus'](0x194);}return _0x2b679c;};}function handleError(_0x59f94b,_0x2a10d9){_0x2a10d9=_0x2a10d9||0x1f4;return function(_0x5396ed){logger['error'](_0x5396ed[_0xc0dc('0x38')]);if(_0x5396ed[_0xc0dc('0x35')]){delete _0x5396ed[_0xc0dc('0x35')];}_0x59f94b[_0xc0dc('0x1f')](_0x2a10d9)['send'](_0x5396ed);};}exports[_0xc0dc('0x39')]=function(_0x5618a3,_0x120ec4){var _0x1cfc84={},_0x1e2f2c={},_0x1ca1d5={'count':0x0,'rows':[]};var _0x227911=_[_0xc0dc('0x30')](db[_0xc0dc('0x3a')]['rawAttributes'],function(_0x1c21eb){return{'name':_0x1c21eb[_0xc0dc('0x3b')],'type':_0x1c21eb[_0xc0dc('0x33')][_0xc0dc('0x3c')]};});_0x1e2f2c['model']=_[_0xc0dc('0x30')](_0x227911,_0xc0dc('0x35'));_0x1e2f2c[_0xc0dc('0x3d')]=_[_0xc0dc('0x3e')](_0x5618a3[_0xc0dc('0x3d')]);_0x1e2f2c['filters']=_[_0xc0dc('0x3f')](_0x1e2f2c[_0xc0dc('0x40')],_0x1e2f2c['query']);_0x1cfc84['attributes']=_[_0xc0dc('0x3f')](_0x1e2f2c[_0xc0dc('0x40')],qs['fields'](_0x5618a3[_0xc0dc('0x3d')][_0xc0dc('0x41')]));_0x1cfc84['attributes']=_0x1cfc84[_0xc0dc('0x42')][_0xc0dc('0x43')]?_0x1cfc84[_0xc0dc('0x42')]:_0x1e2f2c[_0xc0dc('0x40')];if(!_0x5618a3[_0xc0dc('0x3d')][_0xc0dc('0x44')]('nolimit')){_0x1cfc84['limit']=qs[_0xc0dc('0x22')](_0x5618a3['query']['limit']);_0x1cfc84[_0xc0dc('0x21')]=qs['offset'](_0x5618a3[_0xc0dc('0x3d')][_0xc0dc('0x21')]);}_0x1cfc84[_0xc0dc('0x45')]=qs[_0xc0dc('0x46')](_0x5618a3['query'][_0xc0dc('0x46')]);_0x1cfc84[_0xc0dc('0x47')]=qs[_0xc0dc('0x48')](_['pick'](_0x5618a3[_0xc0dc('0x3d')],_0x1e2f2c[_0xc0dc('0x48')]),_0x227911);if(_0x5618a3[_0xc0dc('0x3d')][_0xc0dc('0x2f')]){_0x1cfc84['where']=_['merge'](_0x1cfc84[_0xc0dc('0x47')],{'$or':_[_0xc0dc('0x30')](_0x227911,function(_0x1a11f1){if(_0x1a11f1[_0xc0dc('0x33')]!==_0xc0dc('0x49')){var _0x228736={};_0x228736[_0x1a11f1[_0xc0dc('0x35')]]={'$like':'%'+_0x5618a3[_0xc0dc('0x3d')]['filter']+'%'};return _0x228736;}})});}_0x1cfc84=_['merge']({},_0x1cfc84,_0x5618a3[_0xc0dc('0x4a')]);var _0x44f488={'where':_0x1cfc84['where']};return db[_0xc0dc('0x3a')][_0xc0dc('0x20')](_0x44f488)[_0xc0dc('0x29')](function(_0x51a85e){_0x1ca1d5[_0xc0dc('0x20')]=_0x51a85e;if(_0x5618a3[_0xc0dc('0x3d')][_0xc0dc('0x4b')]){_0x1cfc84[_0xc0dc('0x4c')]=[{'all':!![]}];}return db[_0xc0dc('0x3a')][_0xc0dc('0x4d')](_0x1cfc84);})[_0xc0dc('0x29')](function(_0x53316b){_0x1ca1d5[_0xc0dc('0x4e')]=_0x53316b;return _0x1ca1d5;})[_0xc0dc('0x29')](respondWithFilteredResult(_0x120ec4,_0x1cfc84))[_0xc0dc('0x4f')](handleError(_0x120ec4,null));};exports[_0xc0dc('0x50')]=function(_0x4bb1ba,_0x35d65f){var _0x2abcb9={'raw':![],'where':{'id':_0x4bb1ba[_0xc0dc('0x51')]['id']}},_0x4801bf={};_0x4801bf[_0xc0dc('0x40')]=_[_0xc0dc('0x3e')](db['VoiceExtension'][_0xc0dc('0x52')]);_0x4801bf[_0xc0dc('0x3d')]=_['keys'](_0x4bb1ba['query']);_0x4801bf[_0xc0dc('0x48')]=_[_0xc0dc('0x3f')](_0x4801bf[_0xc0dc('0x40')],_0x4801bf[_0xc0dc('0x3d')]);_0x2abcb9['attributes']=_['intersection'](_0x4801bf['model'],qs['fields'](_0x4bb1ba['query']['fields']));_0x2abcb9['attributes']=_0x2abcb9[_0xc0dc('0x42')][_0xc0dc('0x43')]?_0x2abcb9[_0xc0dc('0x42')]:_0x4801bf[_0xc0dc('0x40')];if(_0x4bb1ba[_0xc0dc('0x3d')]['includeAll']){_0x2abcb9['include']=[{'all':!![]}];}_0x2abcb9=_[_0xc0dc('0x53')]({},_0x2abcb9,_0x4bb1ba[_0xc0dc('0x4a')]);return db['VoiceExtension'][_0xc0dc('0x34')](_0x2abcb9)['then'](handleEntityNotFound(_0x35d65f,null))[_0xc0dc('0x29')](respondWithResult(_0x35d65f,null))[_0xc0dc('0x4f')](handleError(_0x35d65f,null));};exports[_0xc0dc('0x54')]=function(_0x370f3d,_0x3f6c00){return db[_0xc0dc('0x3a')][_0xc0dc('0x34')]({'where':{'id':_0x370f3d['params']['id']}})[_0xc0dc('0x29')](handleEntityNotFound(_0x3f6c00,null))[_0xc0dc('0x29')](removeEntity(_0x3f6c00,null))[_0xc0dc('0x4f')](handleError(_0x3f6c00,null));};exports[_0xc0dc('0x55')]=function(_0x4771a8,_0x4900f8){if(_0x4771a8['body'][_0xc0dc('0x33')]==='outbound'&&!_[_0xc0dc('0x56')](_0x4771a8[_0xc0dc('0x57')][_0xc0dc('0x58')],'_')){_0x4771a8[_0xc0dc('0x57')]['exten']='_'[_0xc0dc('0x59')](_0x4771a8['body'][_0xc0dc('0x58')]);}return db[_0xc0dc('0x3a')][_0xc0dc('0x55')](_0x4771a8[_0xc0dc('0x57')],{'raw':![]})[_0xc0dc('0x29')](function(_0x55419e){var _0x21a6a5=_0x4771a8['user']['get']({'plain':!![]});if(!_0x21a6a5)throw new Error(_0xc0dc('0x5a'));if(_0x21a6a5[_0xc0dc('0x5b')]===_0xc0dc('0x5c')){var _0x42b4c3=_0x55419e[_0xc0dc('0x2a')]({'plain':!![]});var _0x271ede=[{'name':_0xc0dc('0x2b'),'value':_0xc0dc('0x2c')},{'name':_0xc0dc('0x5d'),'value':'outbound'},{'name':'InternalRoutes','value':'internal'}];var _0xd9bd96=_[_0xc0dc('0x34')](_0x271ede,[_0xc0dc('0x31'),_0x42b4c3[_0xc0dc('0x33')]])[_0xc0dc('0x35')];return db['UserProfileSection'][_0xc0dc('0x34')]({'where':{'name':_0xd9bd96,'userProfileId':_0x21a6a5[_0xc0dc('0x5e')]},'raw':!![]})[_0xc0dc('0x29')](function(_0x4f9652){if(_0x4f9652&&_0x4f9652[_0xc0dc('0x5f')]===0x0){return db[_0xc0dc('0x36')][_0xc0dc('0x55')]({'name':_0x42b4c3['name'],'resourceId':_0x42b4c3['id'],'type':_0x4f9652[_0xc0dc('0x35')],'sectionId':_0x4f9652['id']},{})[_0xc0dc('0x29')](function(){return _0x55419e;});}else{return _0x55419e;}})['catch'](function(_0x5ef194){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ef194);throw _0x5ef194;});}return _0x55419e;})[_0xc0dc('0x29')](respondWithResult(_0x4900f8,0xc9))[_0xc0dc('0x4f')](handleError(_0x4900f8,null));};exports[_0xc0dc('0x28')]=function(_0x550163,_0x34ea6d){if(_0x550163['body']['id']){delete _0x550163[_0xc0dc('0x57')]['id'];}return db[_0xc0dc('0x3a')][_0xc0dc('0x34')]({'where':{'id':_0x550163[_0xc0dc('0x51')]['id']}})[_0xc0dc('0x29')](handleEntityNotFound(_0x34ea6d,null))[_0xc0dc('0x29')](function(_0x406c6e){if(_0x406c6e){return db[_0xc0dc('0x3a')]['update'](_['pick'](_0x550163[_0xc0dc('0x57')],[_0xc0dc('0x58'),'context',_0xc0dc('0x60'),'recordingFormat',_0xc0dc('0x61'),'mandatoryDisposition']),{'where':{'context':_0x406c6e[_0xc0dc('0x62')],'exten':_0x406c6e[_0xc0dc('0x58')]},'individualHooks':!![]})['then'](function(_0x4dfed7){return _0x4dfed7;});}return null;})[_0xc0dc('0x29')](respondWithStatusCode(_0x34ea6d,null))['catch'](handleError(_0x34ea6d,null));};exports[_0xc0dc('0x63')]=function(_0x283704,_0x3d3f81,_0x38699b){return db[_0xc0dc('0x3a')][_0xc0dc('0x64')]({'where':{'id':_0x283704['params']['id']}})[_0xc0dc('0x29')](handleEntityNotFound(_0x3d3f81,null))[_0xc0dc('0x29')](function(_0x5d7bb6){if(_0x5d7bb6){return db[_0xc0dc('0x65')][_0xc0dc('0x66')](function(_0x2964e0){return db[_0xc0dc('0x3a')][_0xc0dc('0x54')]({'where':{'VoiceExtensionId':_0x283704[_0xc0dc('0x51')]['id']},'transaction':_0x2964e0})[_0xc0dc('0x29')](function(_0x459ef0){var _0x5e9fc1=_[_0xc0dc('0x30')](_0x283704[_0xc0dc('0x57')],function(_0x47eeb6){_0x47eeb6[_0xc0dc('0x67')]=_0x283704[_0xc0dc('0x51')]['id'];return _0x47eeb6;});return db[_0xc0dc('0x3a')][_0xc0dc('0x68')](_0x5e9fc1,{'transaction':_0x2964e0});});})[_0xc0dc('0x29')](function(){return db[_0xc0dc('0x3a')][_0xc0dc('0x69')]({'where':{'isApp':!![],'VoiceExtensionId':_0x283704['params']['id']},'order':_0xc0dc('0x6a')});});}})[_0xc0dc('0x29')](respondWithResult(_0x3d3f81,null))['catch'](handleError(_0x3d3f81,null));}; \ No newline at end of file +var _0x7e49=['limit','order','sort','where','filters','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','startsWith','body','exten','concat','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','OutboundRoutes','InternalRoutes','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','context','description','recordingFormat','cutdigits','mandatoryDisposition','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','lodash','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','InboundRoutes','inbound','outbound','internal','filter','ignore','map','value','find','type','name','UserProfileResource','end','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x2706c3,_0x3f06e9){var _0x30dba6=function(_0x1a6691){while(--_0x1a6691){_0x2706c3['push'](_0x2706c3['shift']());}};_0x30dba6(++_0x3f06e9);}(_0x7e49,0xfe));var _0x97e4=function(_0x4d7913,_0x166cf8){_0x4d7913=_0x4d7913-0x0;var _0xca4f21=_0x7e49[_0x4d7913];return _0xca4f21;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x97e4('0x0'));var zipdir=require(_0x97e4('0x1'));var jsonpatch=require(_0x97e4('0x2'));var rp=require('request-promise');var moment=require(_0x97e4('0x3'));var BPromise=require(_0x97e4('0x4'));var Mustache=require(_0x97e4('0x5'));var util=require('util');var path=require(_0x97e4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x97e4('0x7'));var fs=require('fs');var _=require(_0x97e4('0x8'));var squel=require('squel');var crypto=require(_0x97e4('0x9'));var jsforce=require(_0x97e4('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x97e4('0xb'));var querystring=require('querystring');var Papa=require(_0x97e4('0xc'));var Redis=require('ioredis');var authService=require(_0x97e4('0xd'));var qs=require(_0x97e4('0xe'));var as=require(_0x97e4('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x97e4('0x10'))(_0x97e4('0x11'));var utils=require('../../config/utils');var config=require(_0x97e4('0x12'));var licenseUtil=require(_0x97e4('0x13'));var db=require('../../mysqldb')['db'];config[_0x97e4('0x14')]=_[_0x97e4('0x15')](config[_0x97e4('0x14')],{'host':_0x97e4('0x16'),'port':0x18eb});var socket=require(_0x97e4('0x17'))(new Redis(config[_0x97e4('0x14')]));require(_0x97e4('0x18'))['register'](socket);function respondWithStatusCode(_0x364871,_0x17721c){_0x17721c=_0x17721c||0xcc;return function(_0x37f10b){if(_0x37f10b){return _0x364871[_0x97e4('0x19')](_0x17721c);}return _0x364871[_0x97e4('0x1a')](_0x17721c)['end']();};}function respondWithResult(_0x2ec4dd,_0x110589){_0x110589=_0x110589||0xc8;return function(_0x26cdb4){if(_0x26cdb4){return _0x2ec4dd[_0x97e4('0x1a')](_0x110589)[_0x97e4('0x1b')](_0x26cdb4);}};}function respondWithFilteredResult(_0x32554c,_0x1f6bd4){return function(_0x4ccd74){if(_0x4ccd74){var _0xa83d18=_0x4ccd74[_0x97e4('0x1c')],_0x3c2adf=_0x1f6bd4[_0x97e4('0x1d')],_0x389ea2=_0x1f6bd4[_0x97e4('0x1d')]+_0x1f6bd4['limit'],_0x2c3db1;if(_0x389ea2>=_0xa83d18){_0x389ea2=_0xa83d18;_0x2c3db1=0xc8;}else{_0x2c3db1=0xce;}_0x32554c[_0x97e4('0x1a')](_0x2c3db1);return _0x32554c[_0x97e4('0x1e')](_0x97e4('0x1f'),_0x3c2adf+'-'+_0x389ea2+'/'+_0xa83d18)[_0x97e4('0x1b')](_0x4ccd74);}return null;};}function patchUpdates(_0x6750fe){return function(_0x2856ed){try{jsonpatch['apply'](_0x2856ed,_0x6750fe,!![]);}catch(_0x2a08cc){return BPromise[_0x97e4('0x20')](_0x2a08cc);}return _0x2856ed[_0x97e4('0x21')]();};}function saveUpdates(_0xdc5a73,_0x5ad6e4){return function(_0x2e3729){if(_0x2e3729){return _0x2e3729[_0x97e4('0x22')](_0xdc5a73)[_0x97e4('0x23')](function(_0x3ebcfc){return _0x3ebcfc;});}return null;};}function removeEntity(_0x4eb85b,_0x3db59f){return function(_0x5ab700){if(_0x5ab700){return _0x5ab700[_0x97e4('0x24')]()[_0x97e4('0x23')](function(){var _0x56a417=_0x5ab700['get']({'plain':!![]});var _0x561d41=[{'name':_0x97e4('0x25'),'value':_0x97e4('0x26'),'ignore':![]},{'name':'OutboundRoutes','value':_0x97e4('0x27'),'ignore':![]},{'name':'InternalRoutes','value':_0x97e4('0x28'),'ignore':![]}];var _0x4207f4=_(_0x561d41)[_0x97e4('0x29')](_0x97e4('0x2a'))[_0x97e4('0x2b')](_0x97e4('0x2c'))[_0x97e4('0x2c')]();if(_['includes'](_0x4207f4,_0x56a417['type'])){return;}var _0x1b536f=_[_0x97e4('0x2d')](_0x561d41,[_0x97e4('0x2c'),_0x56a417[_0x97e4('0x2e')]])[_0x97e4('0x2f')];return db[_0x97e4('0x30')][_0x97e4('0x24')]({'where':{'type':_0x1b536f,'resourceId':_0x56a417['id']}})[_0x97e4('0x23')](function(){return _0x5ab700;});})[_0x97e4('0x23')](function(){_0x4eb85b['status'](0xcc)[_0x97e4('0x31')]();});}};}function handleEntityNotFound(_0x4fffe6,_0x51b4fd){return function(_0x4deabf){if(!_0x4deabf){_0x4fffe6[_0x97e4('0x19')](0x194);}return _0x4deabf;};}function handleError(_0x16b7a6,_0x28519b){_0x28519b=_0x28519b||0x1f4;return function(_0x2bad1d){logger[_0x97e4('0x32')](_0x2bad1d[_0x97e4('0x33')]);if(_0x2bad1d[_0x97e4('0x2f')]){delete _0x2bad1d[_0x97e4('0x2f')];}_0x16b7a6['status'](_0x28519b)[_0x97e4('0x34')](_0x2bad1d);};}exports[_0x97e4('0x35')]=function(_0x2eb748,_0x545708){var _0x37a736={},_0x147cb0={},_0x40d729={'count':0x0,'rows':[]};var _0x4bd6d6=_[_0x97e4('0x2b')](db[_0x97e4('0x36')][_0x97e4('0x37')],function(_0x286e44){return{'name':_0x286e44[_0x97e4('0x38')],'type':_0x286e44[_0x97e4('0x2e')][_0x97e4('0x39')]};});_0x147cb0[_0x97e4('0x3a')]=_[_0x97e4('0x2b')](_0x4bd6d6,_0x97e4('0x2f'));_0x147cb0[_0x97e4('0x3b')]=_[_0x97e4('0x3c')](_0x2eb748[_0x97e4('0x3b')]);_0x147cb0['filters']=_[_0x97e4('0x3d')](_0x147cb0['model'],_0x147cb0['query']);_0x37a736['attributes']=_[_0x97e4('0x3d')](_0x147cb0[_0x97e4('0x3a')],qs[_0x97e4('0x3e')](_0x2eb748[_0x97e4('0x3b')][_0x97e4('0x3e')]));_0x37a736[_0x97e4('0x3f')]=_0x37a736[_0x97e4('0x3f')][_0x97e4('0x40')]?_0x37a736['attributes']:_0x147cb0['model'];if(!_0x2eb748[_0x97e4('0x3b')][_0x97e4('0x41')](_0x97e4('0x42'))){_0x37a736['limit']=qs[_0x97e4('0x43')](_0x2eb748[_0x97e4('0x3b')][_0x97e4('0x43')]);_0x37a736[_0x97e4('0x1d')]=qs[_0x97e4('0x1d')](_0x2eb748[_0x97e4('0x3b')]['offset']);}_0x37a736[_0x97e4('0x44')]=qs[_0x97e4('0x45')](_0x2eb748[_0x97e4('0x3b')][_0x97e4('0x45')]);_0x37a736[_0x97e4('0x46')]=qs[_0x97e4('0x47')](_['pick'](_0x2eb748[_0x97e4('0x3b')],_0x147cb0[_0x97e4('0x47')]),_0x4bd6d6);if(_0x2eb748[_0x97e4('0x3b')][_0x97e4('0x29')]){_0x37a736[_0x97e4('0x46')]=_['merge'](_0x37a736[_0x97e4('0x46')],{'$or':_[_0x97e4('0x2b')](_0x4bd6d6,function(_0x551abb){if(_0x551abb[_0x97e4('0x2e')]!==_0x97e4('0x48')){var _0x8214df={};_0x8214df[_0x551abb[_0x97e4('0x2f')]]={'$like':'%'+_0x2eb748['query'][_0x97e4('0x29')]+'%'};return _0x8214df;}})});}_0x37a736=_[_0x97e4('0x49')]({},_0x37a736,_0x2eb748[_0x97e4('0x4a')]);var _0x5cfb63={'where':_0x37a736['where']};return db[_0x97e4('0x36')][_0x97e4('0x1c')](_0x5cfb63)[_0x97e4('0x23')](function(_0xc5af57){_0x40d729[_0x97e4('0x1c')]=_0xc5af57;if(_0x2eb748['query'][_0x97e4('0x4b')]){_0x37a736[_0x97e4('0x4c')]=[{'all':!![]}];}return db['VoiceExtension'][_0x97e4('0x4d')](_0x37a736);})[_0x97e4('0x23')](function(_0x14f826){_0x40d729['rows']=_0x14f826;return _0x40d729;})[_0x97e4('0x23')](respondWithFilteredResult(_0x545708,_0x37a736))[_0x97e4('0x4e')](handleError(_0x545708,null));};exports[_0x97e4('0x4f')]=function(_0xd59166,_0x483332){var _0x468522={'raw':![],'where':{'id':_0xd59166['params']['id']}},_0xbae14={};_0xbae14['model']=_[_0x97e4('0x3c')](db['VoiceExtension']['rawAttributes']);_0xbae14['query']=_[_0x97e4('0x3c')](_0xd59166[_0x97e4('0x3b')]);_0xbae14[_0x97e4('0x47')]=_[_0x97e4('0x3d')](_0xbae14[_0x97e4('0x3a')],_0xbae14['query']);_0x468522[_0x97e4('0x3f')]=_['intersection'](_0xbae14[_0x97e4('0x3a')],qs[_0x97e4('0x3e')](_0xd59166[_0x97e4('0x3b')][_0x97e4('0x3e')]));_0x468522['attributes']=_0x468522['attributes'][_0x97e4('0x40')]?_0x468522[_0x97e4('0x3f')]:_0xbae14[_0x97e4('0x3a')];if(_0xd59166[_0x97e4('0x3b')][_0x97e4('0x4b')]){_0x468522[_0x97e4('0x4c')]=[{'all':!![]}];}_0x468522=_[_0x97e4('0x49')]({},_0x468522,_0xd59166[_0x97e4('0x4a')]);return db[_0x97e4('0x36')]['find'](_0x468522)[_0x97e4('0x23')](handleEntityNotFound(_0x483332,null))[_0x97e4('0x23')](respondWithResult(_0x483332,null))[_0x97e4('0x4e')](handleError(_0x483332,null));};exports[_0x97e4('0x24')]=function(_0x4cb9d6,_0x3ea370){return db[_0x97e4('0x36')][_0x97e4('0x2d')]({'where':{'id':_0x4cb9d6[_0x97e4('0x50')]['id']}})[_0x97e4('0x23')](handleEntityNotFound(_0x3ea370,null))[_0x97e4('0x23')](removeEntity(_0x3ea370,null))[_0x97e4('0x4e')](handleError(_0x3ea370,null));};exports['create']=function(_0x5e914c,_0x2ff88e){if(_0x5e914c['body'][_0x97e4('0x2e')]===_0x97e4('0x27')&&!_[_0x97e4('0x51')](_0x5e914c[_0x97e4('0x52')][_0x97e4('0x53')],'_')){_0x5e914c[_0x97e4('0x52')][_0x97e4('0x53')]='_'[_0x97e4('0x54')](_0x5e914c[_0x97e4('0x52')]['exten']);}return db[_0x97e4('0x36')][_0x97e4('0x55')](_0x5e914c[_0x97e4('0x52')],{'raw':![]})['then'](function(_0x59270d){var _0x252c1b=_0x5e914c[_0x97e4('0x56')][_0x97e4('0x57')]({'plain':!![]});if(!_0x252c1b)throw new Error(_0x97e4('0x58'));if(_0x252c1b['role']===_0x97e4('0x56')){var _0x13b52e=_0x59270d['get']({'plain':!![]});var _0x58693c=[{'name':_0x97e4('0x25'),'value':_0x97e4('0x26')},{'name':_0x97e4('0x59'),'value':'outbound'},{'name':_0x97e4('0x5a'),'value':_0x97e4('0x28')}];var _0x3ed44b=_[_0x97e4('0x2d')](_0x58693c,[_0x97e4('0x2c'),_0x13b52e[_0x97e4('0x2e')]])[_0x97e4('0x2f')];return db[_0x97e4('0x5b')][_0x97e4('0x2d')]({'where':{'name':_0x3ed44b,'userProfileId':_0x252c1b[_0x97e4('0x5c')]},'raw':!![]})[_0x97e4('0x23')](function(_0x30134e){if(_0x30134e&&_0x30134e['autoAssociation']===0x0){return db[_0x97e4('0x30')][_0x97e4('0x55')]({'name':_0x13b52e[_0x97e4('0x2f')],'resourceId':_0x13b52e['id'],'type':_0x30134e[_0x97e4('0x2f')],'sectionId':_0x30134e['id']},{})['then'](function(){return _0x59270d;});}else{return _0x59270d;}})['catch'](function(_0x3c293c){logger[_0x97e4('0x32')](_0x97e4('0x5d'),_0x3c293c);throw _0x3c293c;});}return _0x59270d;})['then'](respondWithResult(_0x2ff88e,0xc9))[_0x97e4('0x4e')](handleError(_0x2ff88e,null));};exports['update']=function(_0x5b5558,_0x5c95fc){if(_0x5b5558['body']['id']){delete _0x5b5558[_0x97e4('0x52')]['id'];}return db[_0x97e4('0x36')]['find']({'where':{'id':_0x5b5558[_0x97e4('0x50')]['id']}})['then'](handleEntityNotFound(_0x5c95fc,null))[_0x97e4('0x23')](function(_0x3f4e0b){if(_0x3f4e0b){return db[_0x97e4('0x36')][_0x97e4('0x22')](_[_0x97e4('0x5e')](_0x5b5558[_0x97e4('0x52')],[_0x97e4('0x53'),_0x97e4('0x5f'),_0x97e4('0x60'),_0x97e4('0x61'),_0x97e4('0x62'),_0x97e4('0x63')]),{'where':{'context':_0x3f4e0b['context'],'exten':_0x3f4e0b['exten']},'individualHooks':!![]})[_0x97e4('0x23')](function(_0x4d12d8){return _0x4d12d8;});}return null;})['then'](respondWithStatusCode(_0x5c95fc,null))[_0x97e4('0x4e')](handleError(_0x5c95fc,null));};exports['addApplications']=function(_0x49d907,_0x3df4f6,_0x42e757){return db[_0x97e4('0x36')][_0x97e4('0x64')]({'where':{'id':_0x49d907['params']['id']}})['then'](handleEntityNotFound(_0x3df4f6,null))[_0x97e4('0x23')](function(_0xe69be5){if(_0xe69be5){return db[_0x97e4('0x65')][_0x97e4('0x66')](function(_0xfe6d8){return db[_0x97e4('0x36')][_0x97e4('0x24')]({'where':{'VoiceExtensionId':_0x49d907[_0x97e4('0x50')]['id']},'transaction':_0xfe6d8})[_0x97e4('0x23')](function(_0xf3f431){var _0xeef738=_[_0x97e4('0x2b')](_0x49d907['body'],function(_0x445d99){_0x445d99[_0x97e4('0x67')]=_0x49d907[_0x97e4('0x50')]['id'];return _0x445d99;});return db['VoiceExtension'][_0x97e4('0x68')](_0xeef738,{'transaction':_0xfe6d8});});})[_0x97e4('0x23')](function(){return db[_0x97e4('0x36')][_0x97e4('0x69')]({'where':{'isApp':!![],'VoiceExtensionId':_0x49d907['params']['id']},'order':_0x97e4('0x6a')});});}})['then'](respondWithResult(_0x3df4f6,null))[_0x97e4('0x4e')](handleError(_0x3df4f6,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 3609d86..0a5e485 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 _0x975c=['hook','exports','../../mysqldb','VoiceExtension','save','update','emit','hasOwnProperty'];(function(_0x2d554f,_0x284acd){var _0x579473=function(_0x4f155c){while(--_0x4f155c){_0x2d554f['push'](_0x2d554f['shift']());}};_0x579473(++_0x284acd);}(_0x975c,0x122));var _0xc975=function(_0x4dea7e,_0x1f527e){_0x4dea7e=_0x4dea7e-0x0;var _0x46cca6=_0x975c[_0x4dea7e];return _0x46cca6;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xc975('0x0'))['db'][_0xc975('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc975('0x2'),'afterUpdate':_0xc975('0x3'),'afterDestroy':'remove'};function emitEvent(_0x26b4ec){return function(_0x11f1a7,_0x3433d7,_0x560aa7){VoiceExtensionEvents[_0xc975('0x4')](_0x26b4ec+':'+_0x11f1a7['id'],_0x11f1a7);VoiceExtensionEvents[_0xc975('0x4')](_0x26b4ec,_0x11f1a7);_0x560aa7(null);};}for(var e in events){if(events[_0xc975('0x5')](e)){var event=events[e];VoiceExtension[_0xc975('0x6')](e,emitEvent(event));}}module[_0xc975('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0xf0ad=['save','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceExtension','setMaxListeners'];(function(_0x5deb3a,_0x3095cc){var _0x23e3b5=function(_0x2674c7){while(--_0x2674c7){_0x5deb3a['push'](_0x5deb3a['shift']());}};_0x23e3b5(++_0x3095cc);}(_0xf0ad,0x9c));var _0xdf0a=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0xf0ad[_0xf2628e];return _0x13863a;};'use strict';var EventEmitter=require(_0xdf0a('0x0'));var VoiceExtension=require(_0xdf0a('0x1'))['db'][_0xdf0a('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xdf0a('0x3')](0x0);var events={'afterCreate':_0xdf0a('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x205285){return function(_0x4fba4b,_0x4de225,_0x55f9cc){VoiceExtensionEvents[_0xdf0a('0x5')](_0x205285+':'+_0x4fba4b['id'],_0x4fba4b);VoiceExtensionEvents[_0xdf0a('0x5')](_0x205285,_0x4fba4b);_0x55f9cc(null);};}for(var e in events){if(events[_0xdf0a('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xdf0a('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 0e211ea..98a7758 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 _0xb31c=['path','rimraf','../../config/environment','./voiceExtension.attributes','exports','VoiceExtension','voice_extensions','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x542da8,_0x509c26){var _0x533d7e=function(_0x2a3d04){while(--_0x2a3d04){_0x542da8['push'](_0x542da8['shift']());}};_0x533d7e(++_0x509c26);}(_0xb31c,0xeb));var _0xcb31=function(_0x459975,_0x4afac3){_0x459975=_0x459975-0x0;var _0x4db023=_0xb31c[_0x459975];return _0x4db023;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcb31('0x0'))(_0xcb31('0x1'));var moment=require(_0xcb31('0x2'));var BPromise=require(_0xcb31('0x3'));var rp=require(_0xcb31('0x4'));var fs=require('fs');var path=require(_0xcb31('0x5'));var rimraf=require(_0xcb31('0x6'));var config=require(_0xcb31('0x7'));var attributes=require(_0xcb31('0x8'));module[_0xcb31('0x9')]=function(_0x84a13a,_0x175c93){return _0x84a13a['define'](_0xcb31('0xa'),attributes,{'tableName':_0xcb31('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ae2=['../../config/logger','moment','bluebird','request-promise','../../config/environment','./voiceExtension.attributes','exports','define','voice_extensions','util'];(function(_0x315fe,_0x3081c2){var _0x52b419=function(_0x73ddad){while(--_0x73ddad){_0x315fe['push'](_0x315fe['shift']());}};_0x52b419(++_0x3081c2);}(_0x1ae2,0xf9));var _0x21ae=function(_0x15c255,_0x531b09){_0x15c255=_0x15c255-0x0;var _0x5c980a=_0x1ae2[_0x15c255];return _0x5c980a;};'use strict';var _=require('lodash');var util=require(_0x21ae('0x0'));var logger=require(_0x21ae('0x1'))('api');var moment=require(_0x21ae('0x2'));var BPromise=require(_0x21ae('0x3'));var rp=require(_0x21ae('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x21ae('0x5'));var attributes=require(_0x21ae('0x6'));module[_0x21ae('0x7')]=function(_0x56d3f6,_0x2cc351){return _0x56d3f6[_0x21ae('0x8')]('VoiceExtension',attributes,{'tableName':_0x21ae('0x9'),'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 368a3ab..b0581b9 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 _0x177f=['where','attributes','limit','map','model','include','GetVoiceExtension','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','VoiceExtension','findAll','raw','options'];(function(_0x1f9ee0,_0x2152a2){var _0x4274b5=function(_0x4c72bd){while(--_0x4c72bd){_0x1f9ee0['push'](_0x1f9ee0['shift']());}};_0x4274b5(++_0x2152a2);}(_0x177f,0x120));var _0xf177=function(_0xf1a005,_0x361fee){_0xf1a005=_0xf1a005-0x0;var _0x5313f6=_0x177f[_0xf1a005];return _0x5313f6;};'use strict';var _=require(_0xf177('0x0'));var util=require('util');var moment=require(_0xf177('0x1'));var BPromise=require(_0xf177('0x2'));var rs=require(_0xf177('0x3'));var fs=require('fs');var Redis=require(_0xf177('0x4'));var db=require(_0xf177('0x5'))['db'];var utils=require(_0xf177('0x6'));var logger=require(_0xf177('0x7'))(_0xf177('0x8'));var config=require(_0xf177('0x9'));var jayson=require(_0xf177('0xa'));var client=jayson[_0xf177('0xb')]['http']({'port':0x232a});config[_0xf177('0xc')]=_[_0xf177('0xd')](config[_0xf177('0xc')],{'host':_0xf177('0xe'),'port':0x18eb});var socket=require(_0xf177('0xf'))(new Redis(config[_0xf177('0xc')]));require(_0xf177('0x10'))[_0xf177('0x11')](socket);function respondWithRpcPromise(_0x990bdb,_0x452ce9,_0x364f12){return new BPromise(function(_0xa1fdce,_0x4cd1ae){return client['request'](_0x990bdb,_0x364f12)[_0xf177('0x12')](function(_0x2f33d2){logger[_0xf177('0x13')](_0xf177('0x14'),_0x452ce9,_0xf177('0x15'));logger[_0xf177('0x16')](_0xf177('0x17'),_0x452ce9,_0xf177('0x15'),JSON['stringify'](_0x2f33d2));if(_0x2f33d2[_0xf177('0x18')]){if(_0x2f33d2[_0xf177('0x18')][_0xf177('0x19')]===0x1f4){logger['error'](_0xf177('0x14'),_0x452ce9,_0x2f33d2[_0xf177('0x18')][_0xf177('0x1a')]);return _0x4cd1ae(_0x2f33d2['error'][_0xf177('0x1a')]);}logger[_0xf177('0x18')](_0xf177('0x14'),_0x452ce9,_0x2f33d2[_0xf177('0x18')][_0xf177('0x1a')]);return _0xa1fdce(_0x2f33d2['error'][_0xf177('0x1a')]);}else{logger[_0xf177('0x13')](_0xf177('0x14'),_0x452ce9,_0xf177('0x15'));_0xa1fdce(_0x2f33d2[_0xf177('0x1b')][_0xf177('0x1a')]);}})['catch'](function(_0x35f3b8){logger[_0xf177('0x18')](_0xf177('0x14'),_0x452ce9,_0x35f3b8);_0x4cd1ae(_0x35f3b8);});});}exports['GetVoiceExtension']=function(_0x10874f){var _0x4aeb38=this;return new Promise(function(_0xee59db,_0x37ef1a){return db[_0xf177('0x1c')][_0xf177('0x1d')]({'raw':_0x10874f['options']?_0x10874f['options'][_0xf177('0x1e')]===undefined?!![]:![]:!![],'where':_0x10874f[_0xf177('0x1f')]?_0x10874f[_0xf177('0x1f')][_0xf177('0x20')]||null:null,'attributes':_0x10874f['options']?_0x10874f[_0xf177('0x1f')][_0xf177('0x21')]||null:null,'limit':_0x10874f[_0xf177('0x1f')]?_0x10874f[_0xf177('0x1f')][_0xf177('0x22')]||null:null,'include':_0x10874f[_0xf177('0x1f')]?_0x10874f[_0xf177('0x1f')]['include']?_[_0xf177('0x23')](_0x10874f[_0xf177('0x1f')]['include'],function(_0x4b67ef){return{'model':db[_0x4b67ef[_0xf177('0x24')]],'as':_0x4b67ef['as'],'attributes':_0x4b67ef[_0xf177('0x21')],'include':_0x4b67ef[_0xf177('0x25')]?_[_0xf177('0x23')](_0x4b67ef[_0xf177('0x25')],function(_0x4b9ac5){return{'model':db[_0x4b9ac5[_0xf177('0x24')]],'as':_0x4b9ac5['as'],'attributes':_0x4b9ac5[_0xf177('0x21')],'include':_0x4b9ac5['include']?_[_0xf177('0x23')](_0x4b9ac5[_0xf177('0x25')],function(_0xea61b1){return{'model':db[_0xea61b1['model']],'as':_0xea61b1['as'],'attributes':_0xea61b1[_0xf177('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf177('0x12')](function(_0x3f600e){logger[_0xf177('0x13')](_0xf177('0x26'),_0x10874f);logger[_0xf177('0x16')](_0xf177('0x26'),_0x10874f,JSON['stringify'](_0x3f600e));_0xee59db(_0x3f600e);})[_0xf177('0x27')](function(_0x3b2859){logger[_0xf177('0x18')]('GetVoiceExtension',_0x3b2859[_0xf177('0x1a')],_0x10874f);_0x37ef1a(_0x4aeb38[_0xf177('0x18')](0x1f4,_0x3b2859[_0xf177('0x1a')]));});});}; \ No newline at end of file +var _0x83c6=['GetVoiceExtension','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','request','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','VoiceExtension','findAll','options','raw','where','attributes','include','map','model','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x83c6,0x7c));var _0x683c=function(_0x32e4bc,_0x593204){_0x32e4bc=_0x32e4bc-0x0;var _0x1d5930=_0x83c6[_0x32e4bc];return _0x1d5930;};'use strict';var _=require(_0x683c('0x0'));var util=require(_0x683c('0x1'));var moment=require(_0x683c('0x2'));var BPromise=require(_0x683c('0x3'));var rs=require(_0x683c('0x4'));var fs=require('fs');var Redis=require(_0x683c('0x5'));var db=require(_0x683c('0x6'))['db'];var utils=require(_0x683c('0x7'));var logger=require(_0x683c('0x8'))(_0x683c('0x9'));var config=require('../../config/environment');var jayson=require(_0x683c('0xa'));var client=jayson[_0x683c('0xb')][_0x683c('0xc')]({'port':0x232a});config[_0x683c('0xd')]=_[_0x683c('0xe')](config[_0x683c('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x683c('0xf'))(new Redis(config['redis']));require(_0x683c('0x10'))[_0x683c('0x11')](socket);function respondWithRpcPromise(_0x14b558,_0x35781e,_0x53755a){return new BPromise(function(_0x4bbb9d,_0x3aaf84){return client[_0x683c('0x12')](_0x14b558,_0x53755a)['then'](function(_0x4ec044){logger[_0x683c('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x35781e,_0x683c('0x14'));logger[_0x683c('0x15')](_0x683c('0x16'),_0x35781e,_0x683c('0x14'),JSON[_0x683c('0x17')](_0x4ec044));if(_0x4ec044['error']){if(_0x4ec044[_0x683c('0x18')][_0x683c('0x19')]===0x1f4){logger[_0x683c('0x18')](_0x683c('0x1a'),_0x35781e,_0x4ec044[_0x683c('0x18')][_0x683c('0x1b')]);return _0x3aaf84(_0x4ec044['error']['message']);}logger[_0x683c('0x18')](_0x683c('0x1a'),_0x35781e,_0x4ec044[_0x683c('0x18')][_0x683c('0x1b')]);return _0x4bbb9d(_0x4ec044[_0x683c('0x18')][_0x683c('0x1b')]);}else{logger['info'](_0x683c('0x1a'),_0x35781e,'request\x20sent');_0x4bbb9d(_0x4ec044[_0x683c('0x1c')][_0x683c('0x1b')]);}})[_0x683c('0x1d')](function(_0x57d93e){logger['error'](_0x683c('0x1a'),_0x35781e,_0x57d93e);_0x3aaf84(_0x57d93e);});});}exports['GetVoiceExtension']=function(_0x18ff17){var _0x217ae2=this;return new Promise(function(_0x1f5a63,_0x774705){return db[_0x683c('0x1e')][_0x683c('0x1f')]({'raw':_0x18ff17[_0x683c('0x20')]?_0x18ff17[_0x683c('0x20')][_0x683c('0x21')]===undefined?!![]:![]:!![],'where':_0x18ff17[_0x683c('0x20')]?_0x18ff17['options'][_0x683c('0x22')]||null:null,'attributes':_0x18ff17[_0x683c('0x20')]?_0x18ff17[_0x683c('0x20')][_0x683c('0x23')]||null:null,'limit':_0x18ff17['options']?_0x18ff17[_0x683c('0x20')]['limit']||null:null,'include':_0x18ff17[_0x683c('0x20')]?_0x18ff17[_0x683c('0x20')][_0x683c('0x24')]?_[_0x683c('0x25')](_0x18ff17[_0x683c('0x20')][_0x683c('0x24')],function(_0x8e034){return{'model':db[_0x8e034[_0x683c('0x26')]],'as':_0x8e034['as'],'attributes':_0x8e034[_0x683c('0x23')],'include':_0x8e034[_0x683c('0x24')]?_['map'](_0x8e034[_0x683c('0x24')],function(_0x4b97db){return{'model':db[_0x4b97db[_0x683c('0x26')]],'as':_0x4b97db['as'],'attributes':_0x4b97db[_0x683c('0x23')],'include':_0x4b97db['include']?_[_0x683c('0x25')](_0x4b97db['include'],function(_0x456ac7){return{'model':db[_0x456ac7['model']],'as':_0x456ac7['as'],'attributes':_0x456ac7[_0x683c('0x23')]};}):[]};}):[]};}):[]:[]})[_0x683c('0x27')](function(_0x57ff0a){logger['info'](_0x683c('0x28'),_0x18ff17);logger[_0x683c('0x15')](_0x683c('0x28'),_0x18ff17,JSON['stringify'](_0x57ff0a));_0x1f5a63(_0x57ff0a);})[_0x683c('0x1d')](function(_0x119d83){logger[_0x683c('0x18')](_0x683c('0x28'),_0x119d83[_0x683c('0x1b')],_0x18ff17);_0x774705(_0x217ae2[_0x683c('0x18')](0x1f4,_0x119d83[_0x683c('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index ea759c8..e90f1fe 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 _0x7590=['./voiceExtension.events','remove','update','emit','removeListener','register','length','voiceExtension:'];(function(_0x41d4f1,_0x5c903f){var _0x22e971=function(_0x75b68){while(--_0x75b68){_0x41d4f1['push'](_0x41d4f1['shift']());}};_0x22e971(++_0x5c903f);}(_0x7590,0x160));var _0x0759=function(_0x2bda2b,_0xc5bb5d){_0x2bda2b=_0x2bda2b-0x0;var _0x50dbb2=_0x7590[_0x2bda2b];return _0x50dbb2;};'use strict';var VoiceExtensionEvents=require(_0x0759('0x0'));var events=['save',_0x0759('0x1'),_0x0759('0x2')];function createListener(_0x339a02,_0x3e5aa8){return function(_0x1fceae){_0x3e5aa8[_0x0759('0x3')](_0x339a02,_0x1fceae);};}function removeListener(_0x23afab,_0x3041c9){return function(){VoiceExtensionEvents[_0x0759('0x4')](_0x23afab,_0x3041c9);};}exports[_0x0759('0x5')]=function(_0x1b3417){for(var _0x4a4235=0x0,_0x40c66b=events[_0x0759('0x6')];_0x4a4235<_0x40c66b;_0x4a4235++){var _0x38e587=events[_0x4a4235];var _0x24619b=createListener(_0x0759('0x7')+_0x38e587,_0x1b3417);VoiceExtensionEvents['on'](_0x38e587,_0x24619b);}}; \ No newline at end of file +var _0xcf68=['remove','update','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x3a8677,_0x90fbe6){var _0x556ec4=function(_0x313617){while(--_0x313617){_0x3a8677['push'](_0x3a8677['shift']());}};_0x556ec4(++_0x90fbe6);}(_0xcf68,0xa9));var _0x8cf6=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xcf68[_0x279d37];return _0x530173;};'use strict';var VoiceExtensionEvents=require(_0x8cf6('0x0'));var events=[_0x8cf6('0x1'),_0x8cf6('0x2'),_0x8cf6('0x3')];function createListener(_0x127a24,_0x3c5a22){return function(_0x51efb3){_0x3c5a22[_0x8cf6('0x4')](_0x127a24,_0x51efb3);};}function removeListener(_0x4aefcd,_0x1b93b2){return function(){VoiceExtensionEvents[_0x8cf6('0x5')](_0x4aefcd,_0x1b93b2);};}exports[_0x8cf6('0x6')]=function(_0x2a9324){for(var _0x1fe58b=0x0,_0x57bb9=events[_0x8cf6('0x7')];_0x1fe58b<_0x57bb9;_0x1fe58b++){var _0xf8f6ab=events[_0x1fe58b];var _0xa2696a=createListener(_0x8cf6('0x8')+_0xf8f6ab,_0x2a9324);VoiceExtensionEvents['on'](_0xf8f6ab,_0xa2696a);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 89e9d80..cc9e466 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 _0xc78f=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','/:id/messages','create','/:id','update','destroy','exports'];(function(_0x439d2d,_0x3c3249){var _0x7d77cc=function(_0x44d3ce){while(--_0x44d3ce){_0x439d2d['push'](_0x439d2d['shift']());}};_0x7d77cc(++_0x3c3249);}(_0xc78f,0x170));var _0xfc78=function(_0x5843fd,_0x477c79){_0x5843fd=_0x5843fd-0x0;var _0x54159b=_0xc78f[_0x5843fd];return _0x54159b;};'use strict';var multer=require(_0xfc78('0x0'));var util=require('util');var path=require(_0xfc78('0x1'));var timeout=require(_0xfc78('0x2'));var express=require(_0xfc78('0x3'));var router=express[_0xfc78('0x4')]();var auth=require(_0xfc78('0x5'));var interaction=require(_0xfc78('0x6'));var config=require('../../config/environment');var controller=require(_0xfc78('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xfc78('0x8')]('/:id',auth[_0xfc78('0x9')](),controller['show']);router[_0xfc78('0x8')](_0xfc78('0xa'),auth[_0xfc78('0x9')](),controller['getMessages']);router['post']('/',auth[_0xfc78('0x9')](),controller[_0xfc78('0xb')]);router['put'](_0xfc78('0xc'),auth['isAuthenticated'](),controller[_0xfc78('0xd')]);router['delete'](_0xfc78('0xc'),auth[_0xfc78('0x9')](),controller[_0xfc78('0xe')]);module[_0xfc78('0xf')]=router; \ No newline at end of file +var _0x61cf=['put','delete','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','post','create'];(function(_0x5f4cae,_0x4421a3){var _0x2ffaf2=function(_0x1a2601){while(--_0x1a2601){_0x5f4cae['push'](_0x5f4cae['shift']());}};_0x2ffaf2(++_0x4421a3);}(_0x61cf,0x1f2));var _0xf61c=function(_0x45da56,_0x4b8a7a){_0x45da56=_0x45da56-0x0;var _0x104acf=_0x61cf[_0x45da56];return _0x104acf;};'use strict';var multer=require(_0xf61c('0x0'));var util=require('util');var path=require(_0xf61c('0x1'));var timeout=require(_0xf61c('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xf61c('0x3'));var interaction=require(_0xf61c('0x4'));var config=require('../../config/environment');var controller=require(_0xf61c('0x5'));router[_0xf61c('0x6')]('/',auth[_0xf61c('0x7')](),controller[_0xf61c('0x8')]);router[_0xf61c('0x6')](_0xf61c('0x9'),auth[_0xf61c('0x7')](),controller[_0xf61c('0xa')]);router['get'](_0xf61c('0xb'),auth[_0xf61c('0x7')](),controller['getMessages']);router[_0xf61c('0xc')]('/',auth[_0xf61c('0x7')](),controller[_0xf61c('0xd')]);router[_0xf61c('0xe')](_0xf61c('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xf61c('0xf')](_0xf61c('0x9'),auth[_0xf61c('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 9681c48..0c096c1 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 _0x0abf=['ENUM','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','STRING','setDataValue','email','string','trim','central','yes'];(function(_0x56806d,_0x51afa2){var _0x3e629a=function(_0xf3a318){while(--_0xf3a318){_0x56806d['push'](_0x56806d['shift']());}};_0x3e629a(++_0x51afa2);}(_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']={'customer_id':{'type':Sequelize[_0xf0ab('0x1')]},'context':{'type':Sequelize[_0xf0ab('0x1')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xf0ab('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xf0ab('0x1')]},'fullname':{'type':Sequelize[_0xf0ab('0x1')]},'email':{'type':Sequelize[_0xf0ab('0x1')],'validate':{'isEmail':!![]},'set':function(_0xbb1f91){this[_0xf0ab('0x2')](_0xf0ab('0x3'),typeof _0xbb1f91===_0xf0ab('0x4')&&_0xbb1f91['trim']()?_0xbb1f91[_0xf0ab('0x5')]():null);}},'pager':{'type':Sequelize[_0xf0ab('0x1')]},'tz':{'type':Sequelize[_0xf0ab('0x1')],'defaultValue':_0xf0ab('0x6')},'attach':{'type':Sequelize['ENUM'](_0xf0ab('0x7'),'no'),'defaultValue':_0xf0ab('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0xf0ab('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xf0ab('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xf0ab('0x8')](_0xf0ab('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xf0ab('0x8')](_0xf0ab('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xf0ab('0x8')](_0xf0ab('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xf0ab('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xf0ab('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xf0ab('0x8')](_0xf0ab('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xf0ab('0x8')](_0xf0ab('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xf0ab('0x8')](_0xf0ab('0x7'),'no'),'defaultValue':_0xf0ab('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0xf0ab('0x8')](_0xf0ab('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xf0ab('0x8')](_0xf0ab('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xf0ab('0x8')](_0xf0ab('0x7'),'no'),'defaultValue':_0xf0ab('0x7'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xf0ab('0x1')]},'emailbody':{'type':Sequelize[_0xf0ab('0x1')]},'maxsecs':{'type':Sequelize[_0xf0ab('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xf0ab('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xf0ab('0xb')],'get':function(){return this[_0xf0ab('0xc')](_0xf0ab('0xd'))+_0xf0ab('0xe')+this[_0xf0ab('0xc')](_0xf0ab('0xf'));}}}; \ No newline at end of file +var _0xea28=['yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','email','string','trim','central','ENUM'];(function(_0x13232d,_0xa0cb86){var _0x6b26e8=function(_0x1c4a9d){while(--_0x1c4a9d){_0x13232d['push'](_0x13232d['shift']());}};_0x6b26e8(++_0xa0cb86);}(_0xea28,0x13a));var _0x8ea2=function(_0x25a9e0,_0x1bc0de){_0x25a9e0=_0x25a9e0-0x0;var _0x296ebd=_0xea28[_0x25a9e0];return _0x296ebd;};'use strict';var Sequelize=require(_0x8ea2('0x0'));module[_0x8ea2('0x1')]={'customer_id':{'type':Sequelize[_0x8ea2('0x2')]},'context':{'type':Sequelize[_0x8ea2('0x2')],'defaultValue':_0x8ea2('0x3'),'unique':_0x8ea2('0x4')},'mailbox':{'type':Sequelize[_0x8ea2('0x2')],'defaultValue':'','allowNull':![],'unique':_0x8ea2('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x8ea2('0x2')]},'email':{'type':Sequelize[_0x8ea2('0x2')],'validate':{'isEmail':!![]},'set':function(_0x1ccf12){this['setDataValue'](_0x8ea2('0x5'),typeof _0x1ccf12===_0x8ea2('0x6')&&_0x1ccf12[_0x8ea2('0x7')]()?_0x1ccf12[_0x8ea2('0x7')]():null);}},'pager':{'type':Sequelize[_0x8ea2('0x2')]},'tz':{'type':Sequelize[_0x8ea2('0x2')],'defaultValue':_0x8ea2('0x8')},'attach':{'type':Sequelize[_0x8ea2('0x9')](_0x8ea2('0xa'),'no'),'defaultValue':_0x8ea2('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x8ea2('0x9')](_0x8ea2('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x8ea2('0x2')]},'review':{'type':Sequelize[_0x8ea2('0x9')](_0x8ea2('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x8ea2('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x8ea2('0x9')](_0x8ea2('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x8ea2('0x9')](_0x8ea2('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x8ea2('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x8ea2('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x8ea2('0x9')](_0x8ea2('0xa'),'no'),'defaultValue':_0x8ea2('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x8ea2('0x9')](_0x8ea2('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x8ea2('0x9')](_0x8ea2('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x8ea2('0x9')](_0x8ea2('0xa'),'no'),'defaultValue':_0x8ea2('0xa'),'allowNull':![]},'stamp':{'type':_0x8ea2('0xb')},'emailsubject':{'type':Sequelize[_0x8ea2('0x2')]},'emailbody':{'type':Sequelize[_0x8ea2('0x2')]},'maxsecs':{'type':Sequelize[_0x8ea2('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x8ea2('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x8ea2('0xd')],'get':function(){return this[_0x8ea2('0xe')](_0x8ea2('0xf'))+_0x8ea2('0x10')+this[_0x8ea2('0xe')](_0x8ea2('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 703a3fc..be3f6df 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 _0x86c0=['error','stack','send','index','VoiceMail','rawAttributes','type','model','name','query','filters','intersection','fields','attributes','length','nolimit','sort','pick','filter','where','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','getMessages','findOne','hasOwnProperty','order','VoiceMailMessage','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','update','then','Voicemails'];(function(_0x21debf,_0x5bab7b){var _0x324608=function(_0x2b9e13){while(--_0x2b9e13){_0x21debf['push'](_0x21debf['shift']());}};_0x324608(++_0x5bab7b);}(_0x86c0,0x133));var _0x086c=function(_0x269ee8,_0x477226){_0x269ee8=_0x269ee8-0x0;var _0x4d98bd=_0x86c0[_0x269ee8];return _0x4d98bd;};'use strict';var pdf=require(_0x086c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x086c('0x1'));var zipdir=require(_0x086c('0x2'));var jsonpatch=require(_0x086c('0x3'));var rp=require(_0x086c('0x4'));var moment=require('moment');var BPromise=require(_0x086c('0x5'));var Mustache=require(_0x086c('0x6'));var util=require(_0x086c('0x7'));var path=require(_0x086c('0x8'));var sox=require('sox');var csv=require(_0x086c('0x9'));var ejs=require(_0x086c('0xa'));var fs=require('fs');var _=require(_0x086c('0xb'));var squel=require(_0x086c('0xc'));var crypto=require(_0x086c('0xd'));var jsforce=require(_0x086c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x086c('0x9'));var querystring=require(_0x086c('0xf'));var Papa=require(_0x086c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x086c('0x11'));var as=require(_0x086c('0x12'));var hardwareService=require(_0x086c('0x13'));var logger=require(_0x086c('0x14'))(_0x086c('0x15'));var utils=require('../../config/utils');var config=require(_0x086c('0x16'));var licenseUtil=require(_0x086c('0x17'));var db=require(_0x086c('0x18'))['db'];function respondWithStatusCode(_0x3d7cde,_0x4b9681){_0x4b9681=_0x4b9681||0xcc;return function(_0x5144bb){if(_0x5144bb){return _0x3d7cde[_0x086c('0x19')](_0x4b9681);}return _0x3d7cde['status'](_0x4b9681)[_0x086c('0x1a')]();};}function respondWithResult(_0x282e0a,_0x5db47b){_0x5db47b=_0x5db47b||0xc8;return function(_0x40666e){if(_0x40666e){return _0x282e0a[_0x086c('0x1b')](_0x5db47b)[_0x086c('0x1c')](_0x40666e);}};}function respondWithFilteredResult(_0x2db80a,_0x587053){return function(_0x2e37fb){if(_0x2e37fb){var _0x174791=_0x2e37fb[_0x086c('0x1d')],_0x398d8f=_0x587053[_0x086c('0x1e')],_0x5382fe=_0x587053[_0x086c('0x1e')]+_0x587053[_0x086c('0x1f')],_0x34e74f;if(_0x5382fe>=_0x174791){_0x5382fe=_0x174791;_0x34e74f=0xc8;}else{_0x34e74f=0xce;}_0x2db80a['status'](_0x34e74f);return _0x2db80a['set'](_0x086c('0x20'),_0x398d8f+'-'+_0x5382fe+'/'+_0x174791)[_0x086c('0x1c')](_0x2e37fb);}return null;};}function patchUpdates(_0x1e80c2){return function(_0x36becb){try{jsonpatch[_0x086c('0x21')](_0x36becb,_0x1e80c2,!![]);}catch(_0x506b89){return BPromise['reject'](_0x506b89);}return _0x36becb['save']();};}function saveUpdates(_0x3ae033,_0x15582b){return function(_0x5b8565){if(_0x5b8565){return _0x5b8565[_0x086c('0x22')](_0x3ae033)['then'](function(_0x3a98c3){return _0x3a98c3;});}return null;};}function removeEntity(_0x216817,_0x2095d1){return function(_0x2dad53){if(_0x2dad53){return _0x2dad53['destroy']()[_0x086c('0x23')](function(){var _0x56a794=_0x2dad53['get']({'plain':!![]});var _0x5469d4=_0x086c('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x5469d4,'resourceId':_0x56a794['id']}})[_0x086c('0x23')](function(){return _0x2dad53;});})['then'](function(){_0x216817[_0x086c('0x1b')](0xcc)[_0x086c('0x1a')]();});}};}function handleEntityNotFound(_0x57507b,_0x591b0d){return function(_0x317d7b){if(!_0x317d7b){_0x57507b[_0x086c('0x19')](0x194);}return _0x317d7b;};}function handleError(_0x2ee764,_0x3fe25f){_0x3fe25f=_0x3fe25f||0x1f4;return function(_0x5a0d00){logger[_0x086c('0x25')](_0x5a0d00[_0x086c('0x26')]);if(_0x5a0d00['name']){delete _0x5a0d00['name'];}_0x2ee764['status'](_0x3fe25f)[_0x086c('0x27')](_0x5a0d00);};}exports[_0x086c('0x28')]=function(_0x57612c,_0x23e8e3){var _0x538075={},_0x43a1d0={},_0x31e428={'count':0x0,'rows':[]};var _0x290c50=_['map'](db[_0x086c('0x29')][_0x086c('0x2a')],function(_0x4b9e4c){return{'name':_0x4b9e4c['fieldName'],'type':_0x4b9e4c[_0x086c('0x2b')]['key']};});_0x43a1d0[_0x086c('0x2c')]=_['map'](_0x290c50,_0x086c('0x2d'));_0x43a1d0[_0x086c('0x2e')]=_['keys'](_0x57612c[_0x086c('0x2e')]);_0x43a1d0[_0x086c('0x2f')]=_[_0x086c('0x30')](_0x43a1d0['model'],_0x43a1d0['query']);_0x538075['attributes']=_['intersection'](_0x43a1d0[_0x086c('0x2c')],qs[_0x086c('0x31')](_0x57612c['query']['fields']));_0x538075[_0x086c('0x32')]=_0x538075[_0x086c('0x32')][_0x086c('0x33')]?_0x538075[_0x086c('0x32')]:_0x43a1d0[_0x086c('0x2c')];if(!_0x57612c[_0x086c('0x2e')]['hasOwnProperty'](_0x086c('0x34'))){_0x538075[_0x086c('0x1f')]=qs['limit'](_0x57612c['query']['limit']);_0x538075[_0x086c('0x1e')]=qs['offset'](_0x57612c[_0x086c('0x2e')][_0x086c('0x1e')]);}_0x538075['order']=qs[_0x086c('0x35')](_0x57612c['query']['sort']);_0x538075['where']=qs[_0x086c('0x2f')](_[_0x086c('0x36')](_0x57612c[_0x086c('0x2e')],_0x43a1d0[_0x086c('0x2f')]),_0x290c50);if(_0x57612c[_0x086c('0x2e')][_0x086c('0x37')]){_0x538075[_0x086c('0x38')]=_[_0x086c('0x39')](_0x538075['where'],{'$or':_[_0x086c('0x3a')](_0x290c50,function(_0x3d6ba1){if(_0x3d6ba1[_0x086c('0x2b')]!==_0x086c('0x3b')){var _0x3544a5={};_0x3544a5[_0x3d6ba1[_0x086c('0x2d')]]={'$like':'%'+_0x57612c[_0x086c('0x2e')][_0x086c('0x37')]+'%'};return _0x3544a5;}})});}_0x538075=_[_0x086c('0x39')]({},_0x538075,_0x57612c['options']);var _0x129492={'where':_0x538075[_0x086c('0x38')]};return db[_0x086c('0x29')][_0x086c('0x1d')](_0x129492)[_0x086c('0x23')](function(_0x14aca9){_0x31e428['count']=_0x14aca9;if(_0x57612c[_0x086c('0x2e')][_0x086c('0x3c')]){_0x538075[_0x086c('0x3d')]=[{'all':!![]}];}return db[_0x086c('0x29')][_0x086c('0x3e')](_0x538075);})[_0x086c('0x23')](function(_0xd73cf2){_0x31e428[_0x086c('0x3f')]=_0xd73cf2;return _0x31e428;})[_0x086c('0x23')](respondWithFilteredResult(_0x23e8e3,_0x538075))[_0x086c('0x40')](handleError(_0x23e8e3,null));};exports[_0x086c('0x41')]=function(_0x377fd1,_0x1c62ce){var _0x4a5bd7={'raw':!![],'where':{'id':_0x377fd1[_0x086c('0x42')]['id']}},_0x186694={};_0x186694[_0x086c('0x2c')]=_['keys'](db['VoiceMail'][_0x086c('0x2a')]);_0x186694[_0x086c('0x2e')]=_[_0x086c('0x43')](_0x377fd1[_0x086c('0x2e')]);_0x186694[_0x086c('0x2f')]=_[_0x086c('0x30')](_0x186694[_0x086c('0x2c')],_0x186694[_0x086c('0x2e')]);_0x4a5bd7[_0x086c('0x32')]=_[_0x086c('0x30')](_0x186694['model'],qs[_0x086c('0x31')](_0x377fd1[_0x086c('0x2e')][_0x086c('0x31')]));_0x4a5bd7['attributes']=_0x4a5bd7['attributes'][_0x086c('0x33')]?_0x4a5bd7[_0x086c('0x32')]:_0x186694[_0x086c('0x2c')];if(_0x377fd1['query'][_0x086c('0x3c')]){_0x4a5bd7[_0x086c('0x3d')]=[{'all':!![]}];}_0x4a5bd7=_[_0x086c('0x39')]({},_0x4a5bd7,_0x377fd1[_0x086c('0x44')]);return db['VoiceMail']['find'](_0x4a5bd7)['then'](handleEntityNotFound(_0x1c62ce,null))[_0x086c('0x23')](respondWithResult(_0x1c62ce,null))[_0x086c('0x40')](handleError(_0x1c62ce,null));};exports[_0x086c('0x45')]=function(_0x267e86,_0x5cdd68){return db[_0x086c('0x29')]['create'](_0x267e86[_0x086c('0x46')],{})[_0x086c('0x23')](function(_0x2b7cd7){var _0xc63c2d=_0x267e86['user'][_0x086c('0x47')]({'plain':!![]});if(!_0xc63c2d)throw new Error(_0x086c('0x48'));if(_0xc63c2d[_0x086c('0x49')]===_0x086c('0x4a')){var _0x464f07=_0x2b7cd7[_0x086c('0x47')]({'plain':!![]});var _0x289ccf=_0x086c('0x24');return db[_0x086c('0x4b')][_0x086c('0x4c')]({'where':{'name':_0x289ccf,'userProfileId':_0xc63c2d[_0x086c('0x4d')]},'raw':!![]})[_0x086c('0x23')](function(_0x25e4ca){if(_0x25e4ca&&_0x25e4ca['autoAssociation']===0x0){return db[_0x086c('0x4e')]['create']({'name':_0x464f07[_0x086c('0x2d')],'resourceId':_0x464f07['id'],'type':_0x25e4ca['name'],'sectionId':_0x25e4ca['id']},{})[_0x086c('0x23')](function(){return _0x2b7cd7;});}else{return _0x2b7cd7;}})[_0x086c('0x40')](function(_0x325cb5){logger[_0x086c('0x25')](_0x086c('0x4f'),_0x325cb5);throw _0x325cb5;});}return _0x2b7cd7;})['then'](respondWithResult(_0x5cdd68,0xc9))['catch'](handleError(_0x5cdd68,null));};exports[_0x086c('0x22')]=function(_0x2b2fe9,_0x478344){if(_0x2b2fe9[_0x086c('0x46')]['id']){delete _0x2b2fe9['body']['id'];}return db['VoiceMail']['find']({'where':{'id':_0x2b2fe9[_0x086c('0x42')]['id']}})[_0x086c('0x23')](handleEntityNotFound(_0x478344,null))['then'](saveUpdates(_0x2b2fe9[_0x086c('0x46')],null))[_0x086c('0x23')](respondWithResult(_0x478344,null))[_0x086c('0x40')](handleError(_0x478344,null));};exports[_0x086c('0x50')]=function(_0x22bd85,_0x2a5d5a){return db[_0x086c('0x29')][_0x086c('0x4c')]({'where':{'id':_0x22bd85['params']['id']}})[_0x086c('0x23')](handleEntityNotFound(_0x2a5d5a,null))[_0x086c('0x23')](removeEntity(_0x2a5d5a,null))['catch'](handleError(_0x2a5d5a,null));};exports[_0x086c('0x51')]=function(_0x5bdf01,_0x36b597,_0x500742){return db['VoiceMail'][_0x086c('0x52')]({'where':{'id':_0x5bdf01[_0x086c('0x42')]['id']}})[_0x086c('0x23')](handleEntityNotFound(_0x36b597,null))[_0x086c('0x23')](function(_0x17aa94){var _0x56ee0c;var _0x2f457f={},_0x2509c9={};_0x2509c9[_0x086c('0x2c')]=_[_0x086c('0x43')](db['VoiceMailMessage'][_0x086c('0x2a')]);_0x2509c9['query']=_[_0x086c('0x43')](_0x5bdf01[_0x086c('0x2e')]);_0x2509c9[_0x086c('0x2f')]=_[_0x086c('0x30')](_0x2509c9[_0x086c('0x2c')],_0x2509c9[_0x086c('0x2e')]);_0x2f457f[_0x086c('0x32')]=_['intersection'](_0x2509c9[_0x086c('0x2c')],qs[_0x086c('0x31')](_0x5bdf01[_0x086c('0x2e')]['fields']));_0x2f457f['attributes']=_0x2f457f[_0x086c('0x32')][_0x086c('0x33')]?_0x2f457f[_0x086c('0x32')]:_0x2509c9[_0x086c('0x2c')];if(!_0x5bdf01[_0x086c('0x2e')][_0x086c('0x53')](_0x086c('0x34'))){_0x2f457f[_0x086c('0x1f')]=qs[_0x086c('0x1f')](_0x5bdf01['query'][_0x086c('0x1f')]);_0x2f457f[_0x086c('0x1e')]=qs[_0x086c('0x1e')](_0x5bdf01['query'][_0x086c('0x1e')]);}_0x2f457f[_0x086c('0x54')]=qs[_0x086c('0x35')](_0x5bdf01[_0x086c('0x2e')][_0x086c('0x35')]);_0x2f457f['where']=qs[_0x086c('0x2f')](_[_0x086c('0x36')](_0x5bdf01['query'],_0x2509c9['filters']));if(_0x5bdf01[_0x086c('0x2e')][_0x086c('0x37')]){_0x2f457f[_0x086c('0x38')]=_[_0x086c('0x39')](_0x2f457f[_0x086c('0x38')],{'$or':_[_0x086c('0x3a')](_0x2f457f[_0x086c('0x32')],function(_0x2d721f){var _0x53571f={};_0x53571f[_0x2d721f]={'$like':'%'+_0x5bdf01[_0x086c('0x2e')][_0x086c('0x37')]+'%'};return _0x53571f;})});}_0x2f457f[_0x086c('0x38')]=_[_0x086c('0x39')](_0x2f457f[_0x086c('0x38')],{'mailboxuser':_0x17aa94['mailbox']});_0x2f457f=_[_0x086c('0x39')]({},_0x2f457f,_0x5bdf01[_0x086c('0x44')]);return db[_0x086c('0x55')]['findAndCountAll'](_0x2f457f)[_0x086c('0x23')](respondWithFilteredResult(_0x36b597,_0x2f457f));})[_0x086c('0x40')](handleError(_0x36b597,null));}; \ No newline at end of file +var _0x9962=['getMessages','findOne','VoiceMailMessage','order','mailbox','findAndCountAll','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','set','apply','reject','save','then','get','Voicemails','UserProfileResource','destroy','end','error','name','index','VoiceMail','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','intersection','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0xe518e6,_0x90141f){var _0x3d7e10=function(_0x2f989a){while(--_0x2f989a){_0xe518e6['push'](_0xe518e6['shift']());}};_0x3d7e10(++_0x90141f);}(_0x9962,0xb8));var _0x2996=function(_0x45358e,_0x55888f){_0x45358e=_0x45358e-0x0;var _0x21ebbf=_0x9962[_0x45358e];return _0x21ebbf;};'use strict';var pdf=require(_0x2996('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2996('0x1'));var zipdir=require(_0x2996('0x2'));var jsonpatch=require(_0x2996('0x3'));var rp=require('request-promise');var moment=require(_0x2996('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2996('0x5'));var util=require(_0x2996('0x6'));var path=require('path');var sox=require(_0x2996('0x7'));var csv=require(_0x2996('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2996('0x9'));var squel=require(_0x2996('0xa'));var crypto=require(_0x2996('0xb'));var jsforce=require(_0x2996('0xc'));var deskjs=require(_0x2996('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2996('0xe'));var Papa=require('papaparse');var Redis=require(_0x2996('0xf'));var authService=require(_0x2996('0x10'));var qs=require(_0x2996('0x11'));var as=require(_0x2996('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2996('0x13'))(_0x2996('0x14'));var utils=require(_0x2996('0x15'));var config=require(_0x2996('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2996('0x17'))['db'];function respondWithStatusCode(_0x21f096,_0x10a958){_0x10a958=_0x10a958||0xcc;return function(_0x30b5e4){if(_0x30b5e4){return _0x21f096['sendStatus'](_0x10a958);}return _0x21f096[_0x2996('0x18')](_0x10a958)['end']();};}function respondWithResult(_0x4117f5,_0x468a4f){_0x468a4f=_0x468a4f||0xc8;return function(_0x5b942f){if(_0x5b942f){return _0x4117f5[_0x2996('0x18')](_0x468a4f)[_0x2996('0x19')](_0x5b942f);}};}function respondWithFilteredResult(_0x39b18e,_0x43e380){return function(_0xc267fb){if(_0xc267fb){var _0xb50801=_0xc267fb[_0x2996('0x1a')],_0x311270=_0x43e380[_0x2996('0x1b')],_0x51762b=_0x43e380['offset']+_0x43e380['limit'],_0x4e5d53;if(_0x51762b>=_0xb50801){_0x51762b=_0xb50801;_0x4e5d53=0xc8;}else{_0x4e5d53=0xce;}_0x39b18e[_0x2996('0x18')](_0x4e5d53);return _0x39b18e[_0x2996('0x1c')]('Content-Range',_0x311270+'-'+_0x51762b+'/'+_0xb50801)[_0x2996('0x19')](_0xc267fb);}return null;};}function patchUpdates(_0x11ef19){return function(_0x9743ee){try{jsonpatch[_0x2996('0x1d')](_0x9743ee,_0x11ef19,!![]);}catch(_0x289748){return BPromise[_0x2996('0x1e')](_0x289748);}return _0x9743ee[_0x2996('0x1f')]();};}function saveUpdates(_0x232ec9,_0x2c5cb3){return function(_0x256c72){if(_0x256c72){return _0x256c72['update'](_0x232ec9)[_0x2996('0x20')](function(_0x11bf00){return _0x11bf00;});}return null;};}function removeEntity(_0x43e835,_0x64a05b){return function(_0xa39f6d){if(_0xa39f6d){return _0xa39f6d['destroy']()[_0x2996('0x20')](function(){var _0x42e5f5=_0xa39f6d[_0x2996('0x21')]({'plain':!![]});var _0x4de34d=_0x2996('0x22');return db[_0x2996('0x23')][_0x2996('0x24')]({'where':{'type':_0x4de34d,'resourceId':_0x42e5f5['id']}})['then'](function(){return _0xa39f6d;});})[_0x2996('0x20')](function(){_0x43e835[_0x2996('0x18')](0xcc)[_0x2996('0x25')]();});}};}function handleEntityNotFound(_0x53c636,_0x3c9303){return function(_0x15ab22){if(!_0x15ab22){_0x53c636['sendStatus'](0x194);}return _0x15ab22;};}function handleError(_0x229fad,_0xd66746){_0xd66746=_0xd66746||0x1f4;return function(_0xb8a383){logger[_0x2996('0x26')](_0xb8a383['stack']);if(_0xb8a383[_0x2996('0x27')]){delete _0xb8a383[_0x2996('0x27')];}_0x229fad['status'](_0xd66746)['send'](_0xb8a383);};}exports[_0x2996('0x28')]=function(_0x4941c3,_0x3adddd){var _0x3a509f={},_0x13bfc0={},_0x45b461={'count':0x0,'rows':[]};var _0x4b3e5e=_['map'](db[_0x2996('0x29')][_0x2996('0x2a')],function(_0x3b6503){return{'name':_0x3b6503[_0x2996('0x2b')],'type':_0x3b6503[_0x2996('0x2c')][_0x2996('0x2d')]};});_0x13bfc0[_0x2996('0x2e')]=_[_0x2996('0x2f')](_0x4b3e5e,'name');_0x13bfc0[_0x2996('0x30')]=_[_0x2996('0x31')](_0x4941c3['query']);_0x13bfc0[_0x2996('0x32')]=_['intersection'](_0x13bfc0[_0x2996('0x2e')],_0x13bfc0[_0x2996('0x30')]);_0x3a509f[_0x2996('0x33')]=_['intersection'](_0x13bfc0['model'],qs[_0x2996('0x34')](_0x4941c3['query'][_0x2996('0x34')]));_0x3a509f[_0x2996('0x33')]=_0x3a509f['attributes'][_0x2996('0x35')]?_0x3a509f[_0x2996('0x33')]:_0x13bfc0[_0x2996('0x2e')];if(!_0x4941c3[_0x2996('0x30')][_0x2996('0x36')](_0x2996('0x37'))){_0x3a509f['limit']=qs['limit'](_0x4941c3[_0x2996('0x30')][_0x2996('0x38')]);_0x3a509f[_0x2996('0x1b')]=qs[_0x2996('0x1b')](_0x4941c3[_0x2996('0x30')][_0x2996('0x1b')]);}_0x3a509f['order']=qs[_0x2996('0x39')](_0x4941c3[_0x2996('0x30')]['sort']);_0x3a509f['where']=qs[_0x2996('0x32')](_[_0x2996('0x3a')](_0x4941c3['query'],_0x13bfc0[_0x2996('0x32')]),_0x4b3e5e);if(_0x4941c3[_0x2996('0x30')][_0x2996('0x3b')]){_0x3a509f[_0x2996('0x3c')]=_[_0x2996('0x3d')](_0x3a509f[_0x2996('0x3c')],{'$or':_[_0x2996('0x2f')](_0x4b3e5e,function(_0x2a1e11){if(_0x2a1e11['type']!==_0x2996('0x3e')){var _0x20cbba={};_0x20cbba[_0x2a1e11[_0x2996('0x27')]]={'$like':'%'+_0x4941c3['query'][_0x2996('0x3b')]+'%'};return _0x20cbba;}})});}_0x3a509f=_['merge']({},_0x3a509f,_0x4941c3[_0x2996('0x3f')]);var _0x25b24a={'where':_0x3a509f[_0x2996('0x3c')]};return db[_0x2996('0x29')][_0x2996('0x1a')](_0x25b24a)[_0x2996('0x20')](function(_0x451a0b){_0x45b461[_0x2996('0x1a')]=_0x451a0b;if(_0x4941c3[_0x2996('0x30')][_0x2996('0x40')]){_0x3a509f['include']=[{'all':!![]}];}return db[_0x2996('0x29')][_0x2996('0x41')](_0x3a509f);})[_0x2996('0x20')](function(_0x577e3e){_0x45b461[_0x2996('0x42')]=_0x577e3e;return _0x45b461;})['then'](respondWithFilteredResult(_0x3adddd,_0x3a509f))['catch'](handleError(_0x3adddd,null));};exports[_0x2996('0x43')]=function(_0x256190,_0x134437){var _0x52b3a4={'raw':!![],'where':{'id':_0x256190[_0x2996('0x44')]['id']}},_0x40f830={};_0x40f830[_0x2996('0x2e')]=_[_0x2996('0x31')](db[_0x2996('0x29')][_0x2996('0x2a')]);_0x40f830['query']=_['keys'](_0x256190[_0x2996('0x30')]);_0x40f830[_0x2996('0x32')]=_[_0x2996('0x45')](_0x40f830[_0x2996('0x2e')],_0x40f830[_0x2996('0x30')]);_0x52b3a4[_0x2996('0x33')]=_[_0x2996('0x45')](_0x40f830[_0x2996('0x2e')],qs['fields'](_0x256190['query']['fields']));_0x52b3a4[_0x2996('0x33')]=_0x52b3a4[_0x2996('0x33')]['length']?_0x52b3a4[_0x2996('0x33')]:_0x40f830[_0x2996('0x2e')];if(_0x256190[_0x2996('0x30')]['includeAll']){_0x52b3a4[_0x2996('0x46')]=[{'all':!![]}];}_0x52b3a4=_[_0x2996('0x3d')]({},_0x52b3a4,_0x256190[_0x2996('0x3f')]);return db[_0x2996('0x29')][_0x2996('0x47')](_0x52b3a4)[_0x2996('0x20')](handleEntityNotFound(_0x134437,null))[_0x2996('0x20')](respondWithResult(_0x134437,null))[_0x2996('0x48')](handleError(_0x134437,null));};exports[_0x2996('0x49')]=function(_0x1fff15,_0x47da08){return db['VoiceMail']['create'](_0x1fff15[_0x2996('0x4a')],{})[_0x2996('0x20')](function(_0x1a4ea5){var _0x7d35b5=_0x1fff15[_0x2996('0x4b')][_0x2996('0x21')]({'plain':!![]});if(!_0x7d35b5)throw new Error(_0x2996('0x4c'));if(_0x7d35b5[_0x2996('0x4d')]===_0x2996('0x4b')){var _0x44271a=_0x1a4ea5['get']({'plain':!![]});var _0x4a4ff0=_0x2996('0x22');return db[_0x2996('0x4e')][_0x2996('0x47')]({'where':{'name':_0x4a4ff0,'userProfileId':_0x7d35b5[_0x2996('0x4f')]},'raw':!![]})[_0x2996('0x20')](function(_0x19fc64){if(_0x19fc64&&_0x19fc64[_0x2996('0x50')]===0x0){return db['UserProfileResource'][_0x2996('0x49')]({'name':_0x44271a[_0x2996('0x27')],'resourceId':_0x44271a['id'],'type':_0x19fc64[_0x2996('0x27')],'sectionId':_0x19fc64['id']},{})[_0x2996('0x20')](function(){return _0x1a4ea5;});}else{return _0x1a4ea5;}})[_0x2996('0x48')](function(_0x1805fd){logger['error'](_0x2996('0x51'),_0x1805fd);throw _0x1805fd;});}return _0x1a4ea5;})[_0x2996('0x20')](respondWithResult(_0x47da08,0xc9))[_0x2996('0x48')](handleError(_0x47da08,null));};exports[_0x2996('0x52')]=function(_0x52d37c,_0x4e2412){if(_0x52d37c[_0x2996('0x4a')]['id']){delete _0x52d37c[_0x2996('0x4a')]['id'];}return db[_0x2996('0x29')][_0x2996('0x47')]({'where':{'id':_0x52d37c['params']['id']}})['then'](handleEntityNotFound(_0x4e2412,null))['then'](saveUpdates(_0x52d37c[_0x2996('0x4a')],null))[_0x2996('0x20')](respondWithResult(_0x4e2412,null))[_0x2996('0x48')](handleError(_0x4e2412,null));};exports['destroy']=function(_0x444609,_0x13fb1b){return db[_0x2996('0x29')][_0x2996('0x47')]({'where':{'id':_0x444609['params']['id']}})[_0x2996('0x20')](handleEntityNotFound(_0x13fb1b,null))[_0x2996('0x20')](removeEntity(_0x13fb1b,null))[_0x2996('0x48')](handleError(_0x13fb1b,null));};exports[_0x2996('0x53')]=function(_0x2310f0,_0x5ce83c,_0x3acea9){return db[_0x2996('0x29')][_0x2996('0x54')]({'where':{'id':_0x2310f0[_0x2996('0x44')]['id']}})[_0x2996('0x20')](handleEntityNotFound(_0x5ce83c,null))[_0x2996('0x20')](function(_0x2497a4){var _0x3628d6;var _0x37e06e={},_0x11600e={};_0x11600e['model']=_[_0x2996('0x31')](db[_0x2996('0x55')][_0x2996('0x2a')]);_0x11600e[_0x2996('0x30')]=_[_0x2996('0x31')](_0x2310f0[_0x2996('0x30')]);_0x11600e['filters']=_['intersection'](_0x11600e[_0x2996('0x2e')],_0x11600e[_0x2996('0x30')]);_0x37e06e[_0x2996('0x33')]=_[_0x2996('0x45')](_0x11600e['model'],qs[_0x2996('0x34')](_0x2310f0[_0x2996('0x30')][_0x2996('0x34')]));_0x37e06e[_0x2996('0x33')]=_0x37e06e[_0x2996('0x33')]['length']?_0x37e06e[_0x2996('0x33')]:_0x11600e[_0x2996('0x2e')];if(!_0x2310f0[_0x2996('0x30')][_0x2996('0x36')](_0x2996('0x37'))){_0x37e06e[_0x2996('0x38')]=qs[_0x2996('0x38')](_0x2310f0[_0x2996('0x30')]['limit']);_0x37e06e[_0x2996('0x1b')]=qs[_0x2996('0x1b')](_0x2310f0[_0x2996('0x30')]['offset']);}_0x37e06e[_0x2996('0x56')]=qs['sort'](_0x2310f0[_0x2996('0x30')][_0x2996('0x39')]);_0x37e06e['where']=qs[_0x2996('0x32')](_['pick'](_0x2310f0[_0x2996('0x30')],_0x11600e['filters']));if(_0x2310f0[_0x2996('0x30')][_0x2996('0x3b')]){_0x37e06e[_0x2996('0x3c')]=_[_0x2996('0x3d')](_0x37e06e[_0x2996('0x3c')],{'$or':_[_0x2996('0x2f')](_0x37e06e[_0x2996('0x33')],function(_0x4c26d1){var _0x1d677e={};_0x1d677e[_0x4c26d1]={'$like':'%'+_0x2310f0[_0x2996('0x30')][_0x2996('0x3b')]+'%'};return _0x1d677e;})});}_0x37e06e[_0x2996('0x3c')]=_[_0x2996('0x3d')](_0x37e06e['where'],{'mailboxuser':_0x2497a4[_0x2996('0x57')]});_0x37e06e=_[_0x2996('0x3d')]({},_0x37e06e,_0x2310f0[_0x2996('0x3f')]);return db[_0x2996('0x55')][_0x2996('0x58')](_0x37e06e)[_0x2996('0x20')](respondWithFilteredResult(_0x5ce83c,_0x37e06e));})[_0x2996('0x48')](handleError(_0x5ce83c,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 8215579..a5fcb43 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 _0x414f=['rimraf','../../config/environment','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox_context','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x181d13,_0x261e23){var _0x179d8c=function(_0x5196cf){while(--_0x5196cf){_0x181d13['push'](_0x181d13['shift']());}};_0x179d8c(++_0x261e23);}(_0x414f,0x13f));var _0xf414=function(_0x397ddb,_0x574faf){_0x397ddb=_0x397ddb-0x0;var _0x4af353=_0x414f[_0x397ddb];return _0x4af353;};'use strict';var _=require(_0xf414('0x0'));var util=require('util');var logger=require(_0xf414('0x1'))(_0xf414('0x2'));var moment=require('moment');var BPromise=require(_0xf414('0x3'));var rp=require(_0xf414('0x4'));var fs=require('fs');var path=require(_0xf414('0x5'));var rimraf=require(_0xf414('0x6'));var config=require(_0xf414('0x7'));var attributes=require(_0xf414('0x8'));module[_0xf414('0x9')]=function(_0x5dda1d,_0x3be83a){return _0x5dda1d['define'](_0xf414('0xa'),attributes,{'tableName':_0xf414('0xb'),'paranoid':![],'indexes':[{'name':_0xf414('0xc'),'fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3af7=['moment','bluebird','path','../../config/environment','./voiceMail.attributes','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','util','../../config/logger','api'];(function(_0x3285d4,_0x136036){var _0x5408c9=function(_0x1c1de8){while(--_0x1c1de8){_0x3285d4['push'](_0x3285d4['shift']());}};_0x5408c9(++_0x136036);}(_0x3af7,0xb3));var _0x73af=function(_0x47f9e2,_0x1ec618){_0x47f9e2=_0x47f9e2-0x0;var _0x5418ac=_0x3af7[_0x47f9e2];return _0x5418ac;};'use strict';var _=require('lodash');var util=require(_0x73af('0x0'));var logger=require(_0x73af('0x1'))(_0x73af('0x2'));var moment=require(_0x73af('0x3'));var BPromise=require(_0x73af('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x73af('0x5'));var rimraf=require('rimraf');var config=require(_0x73af('0x6'));var attributes=require(_0x73af('0x7'));module['exports']=function(_0xfcd217,_0x70f98){return _0xfcd217[_0x73af('0x8')](_0x73af('0x9'),attributes,{'tableName':_0x73af('0xa'),'paranoid':![],'indexes':[{'name':_0x73af('0xb'),'fields':[_0x73af('0xc'),_0x73af('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 2b53e13..ea7d064 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 _0xbb8a=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0xbb8a,0x1a6));var _0xabb8=function(_0x3aab60,_0x379540){_0x3aab60=_0x3aab60-0x0;var _0x44a2cf=_0xbb8a[_0x3aab60];return _0x44a2cf;};'use strict';var _=require(_0xabb8('0x0'));var util=require(_0xabb8('0x1'));var moment=require(_0xabb8('0x2'));var BPromise=require(_0xabb8('0x3'));var rs=require(_0xabb8('0x4'));var fs=require('fs');var Redis=require(_0xabb8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xabb8('0x6'));var logger=require(_0xabb8('0x7'))(_0xabb8('0x8'));var config=require('../../config/environment');var jayson=require(_0xabb8('0x9'));var client=jayson[_0xabb8('0xa')][_0xabb8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52fd02,_0x5b7f6b,_0x111e06){return new BPromise(function(_0x2bed2b,_0x41ae9){return client['request'](_0x52fd02,_0x111e06)[_0xabb8('0xc')](function(_0xbaefba){logger[_0xabb8('0xd')](_0xabb8('0xe'),_0x5b7f6b,_0xabb8('0xf'));logger[_0xabb8('0x10')](_0xabb8('0x11'),_0x5b7f6b,_0xabb8('0xf'),JSON['stringify'](_0xbaefba));if(_0xbaefba[_0xabb8('0x12')]){if(_0xbaefba[_0xabb8('0x12')][_0xabb8('0x13')]===0x1f4){logger[_0xabb8('0x12')]('VoiceMail,\x20%s,\x20%s',_0x5b7f6b,_0xbaefba[_0xabb8('0x12')][_0xabb8('0x14')]);return _0x41ae9(_0xbaefba[_0xabb8('0x12')][_0xabb8('0x14')]);}logger[_0xabb8('0x12')](_0xabb8('0xe'),_0x5b7f6b,_0xbaefba[_0xabb8('0x12')]['message']);return _0x2bed2b(_0xbaefba[_0xabb8('0x12')][_0xabb8('0x14')]);}else{logger[_0xabb8('0xd')]('VoiceMail,\x20%s,\x20%s',_0x5b7f6b,_0xabb8('0xf'));_0x2bed2b(_0xbaefba[_0xabb8('0x15')][_0xabb8('0x14')]);}})['catch'](function(_0x4434b8){logger[_0xabb8('0x12')](_0xabb8('0xe'),_0x5b7f6b,_0x4434b8);_0x41ae9(_0x4434b8);});});} \ No newline at end of file +var _0x00a1=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x00a1,0x1c7));var _0x100a=function(_0x5e26e9,_0x467282){_0x5e26e9=_0x5e26e9-0x0;var _0x5c3807=_0x00a1[_0x5e26e9];return _0x5c3807;};'use strict';var _=require(_0x100a('0x0'));var util=require(_0x100a('0x1'));var moment=require('moment');var BPromise=require(_0x100a('0x2'));var rs=require(_0x100a('0x3'));var fs=require('fs');var Redis=require(_0x100a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x100a('0x5'));var logger=require('../../config/logger')(_0x100a('0x6'));var config=require(_0x100a('0x7'));var jayson=require(_0x100a('0x8'));var client=jayson[_0x100a('0x9')][_0x100a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ed808,_0x262ddd,_0x11498a){return new BPromise(function(_0x2ada6a,_0x4eb0c5){return client[_0x100a('0xb')](_0x5ed808,_0x11498a)[_0x100a('0xc')](function(_0x350edf){logger[_0x100a('0xd')]('VoiceMail,\x20%s,\x20%s',_0x262ddd,_0x100a('0xe'));logger[_0x100a('0xf')](_0x100a('0x10'),_0x262ddd,'request\x20sent',JSON['stringify'](_0x350edf));if(_0x350edf[_0x100a('0x11')]){if(_0x350edf[_0x100a('0x11')]['code']===0x1f4){logger['error'](_0x100a('0x12'),_0x262ddd,_0x350edf[_0x100a('0x11')]['message']);return _0x4eb0c5(_0x350edf['error']['message']);}logger[_0x100a('0x11')]('VoiceMail,\x20%s,\x20%s',_0x262ddd,_0x350edf[_0x100a('0x11')][_0x100a('0x13')]);return _0x2ada6a(_0x350edf[_0x100a('0x11')]['message']);}else{logger[_0x100a('0xd')](_0x100a('0x12'),_0x262ddd,_0x100a('0xe'));_0x2ada6a(_0x350edf[_0x100a('0x14')][_0x100a('0x13')]);}})[_0x100a('0x15')](function(_0x28cda8){logger['error'](_0x100a('0x12'),_0x262ddd,_0x28cda8);_0x4eb0c5(_0x28cda8);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 87aec80..8115a8d 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 _0x814b=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','destroy','exports','multer','util'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x814b,0x1a2));var _0xb814=function(_0x311f44,_0x1d7f5b){_0x311f44=_0x311f44-0x0;var _0x46f1e6=_0x814b[_0x311f44];return _0x46f1e6;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['show']);router[_0xb814('0x9')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')](_0xb814('0xc'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['delete'](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file +var _0x814b=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','destroy','exports','multer','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x814b,0x1a2));var _0xb814=function(_0x49b78f,_0x1ccdf7){_0x49b78f=_0x49b78f-0x0;var _0x544d2=_0x814b[_0x49b78f];return _0x544d2;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['show']);router[_0xb814('0x9')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')](_0xb814('0xc'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['delete'](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 220b9e6..0f83607 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 _0x19a3=['TIMESTAMP','sequelize','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long'];(function(_0x2f08,_0x5ab959){var _0x4f1927=function(_0x2d2902){while(--_0x2d2902){_0x2f08['push'](_0x2f08['shift']());}};_0x4f1927(++_0x5ab959);}(_0x19a3,0x69));var _0x319a=function(_0x2852e0,_0x5c8451){_0x2852e0=_0x2852e0-0x0;var _0x87132d=_0x19a3[_0x2852e0];return _0x87132d;};'use strict';var Sequelize=require(_0x319a('0x0'));module['exports']={'name':{'type':Sequelize[_0x319a('0x1')],'get':function(_0x290658){return this[_0x319a('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x319a('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x319a('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x319a('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x319a('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x319a('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x319a('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x319a('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x319a('0x5')](_0x319a('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x319a('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x319a('0x7'),'allowNull':![]}}; \ No newline at end of file +var _0xfa8f=['VIRTUAL','getDataValue','STRING','BLOB','long','TIMESTAMP','sequelize'];(function(_0x2d937e,_0x23648d){var _0x51c9d6=function(_0x4880fd){while(--_0x4880fd){_0x2d937e['push'](_0x2d937e['shift']());}};_0x51c9d6(++_0x23648d);}(_0xfa8f,0x1bf));var _0xffa8=function(_0x33194d,_0x3a531c){_0x33194d=_0x33194d-0x0;var _0x1bde38=_0xfa8f[_0x33194d];return _0x1bde38;};'use strict';var Sequelize=require(_0xffa8('0x0'));module['exports']={'name':{'type':Sequelize[_0xffa8('0x1')],'get':function(_0x31c01a){return this[_0xffa8('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xffa8('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xffa8('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xffa8('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xffa8('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xffa8('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xffa8('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xffa8('0x4')](_0xffa8('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xffa8('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xffa8('0x3')],'defaultValue':''},'stamp':{'type':_0xffa8('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 0c53d43..834e087 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 _0xe88e=['stack','name','send','VoiceMailMessage','rawAttributes','fieldName','key','differenceBy','map','query','keys','filters','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','catch','params','intersection','find','create','body','download','recording','msg_id','Sequelize','ValidationError','attachment','attachment;\x20filename=\x22','.wav\x22','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe88e,0xcb));var _0xee88=function(_0x401e83,_0xc6d9c5){_0x401e83=_0x401e83-0x0;var _0x3cc505=_0xe88e[_0x401e83];return _0x3cc505;};'use strict';var pdf=require(_0xee88('0x0'));var emlformat=require(_0xee88('0x1'));var rimraf=require(_0xee88('0x2'));var zipdir=require(_0xee88('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee88('0x4'));var moment=require(_0xee88('0x5'));var BPromise=require(_0xee88('0x6'));var Mustache=require(_0xee88('0x7'));var util=require(_0xee88('0x8'));var path=require(_0xee88('0x9'));var sox=require(_0xee88('0xa'));var csv=require(_0xee88('0xb'));var ejs=require(_0xee88('0xc'));var fs=require('fs');var _=require(_0xee88('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xee88('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xee88('0xb'));var querystring=require(_0xee88('0xf'));var Papa=require(_0xee88('0x10'));var Redis=require(_0xee88('0x11'));var authService=require(_0xee88('0x12'));var qs=require(_0xee88('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee88('0x14'));var logger=require('../../config/logger')(_0xee88('0x15'));var utils=require(_0xee88('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xae043c,_0x26b860){_0x26b860=_0x26b860||0xcc;return function(_0x1c64d9){if(_0x1c64d9){return _0xae043c[_0xee88('0x17')](_0x26b860);}return _0xae043c['status'](_0x26b860)[_0xee88('0x18')]();};}function respondWithResult(_0x4ec5c3,_0x5121a3){_0x5121a3=_0x5121a3||0xc8;return function(_0x5823a3){if(_0x5823a3){return _0x4ec5c3[_0xee88('0x19')](_0x5121a3)['json'](_0x5823a3);}};}function respondWithFilteredResult(_0x2486fb,_0x23c6ea){return function(_0xda10f1){if(_0xda10f1){var _0x14bfb1=_0xda10f1['count'],_0x76d4df=_0x23c6ea[_0xee88('0x1a')],_0x4e2f62=_0x23c6ea[_0xee88('0x1a')]+_0x23c6ea[_0xee88('0x1b')],_0x52a481;if(_0x4e2f62>=_0x14bfb1){_0x4e2f62=_0x14bfb1;_0x52a481=0xc8;}else{_0x52a481=0xce;}_0x2486fb[_0xee88('0x19')](_0x52a481);return _0x2486fb[_0xee88('0x1c')](_0xee88('0x1d'),_0x76d4df+'-'+_0x4e2f62+'/'+_0x14bfb1)[_0xee88('0x1e')](_0xda10f1);}return null;};}function patchUpdates(_0x21a35e){return function(_0x476b19){try{jsonpatch[_0xee88('0x1f')](_0x476b19,_0x21a35e,!![]);}catch(_0x46493e){return BPromise['reject'](_0x46493e);}return _0x476b19[_0xee88('0x20')]();};}function saveUpdates(_0x8ac8a1,_0x162f24){return function(_0x26df0d){if(_0x26df0d){return _0x26df0d[_0xee88('0x21')](_0x8ac8a1)[_0xee88('0x22')](function(_0x39c3fa){return _0x39c3fa;});}return null;};}function removeEntity(_0x26633f,_0x420c8f){return function(_0x543234){if(_0x543234){return _0x543234[_0xee88('0x23')]()[_0xee88('0x22')](function(){_0x26633f[_0xee88('0x19')](0xcc)[_0xee88('0x18')]();});}};}function handleEntityNotFound(_0x29de95,_0x54d0fb){return function(_0x3b7010){if(!_0x3b7010){_0x29de95[_0xee88('0x17')](0x194);}return _0x3b7010;};}function handleError(_0xa06cbe,_0x10d20a){_0x10d20a=_0x10d20a||0x1f4;return function(_0x4f825e){logger[_0xee88('0x24')](_0x4f825e[_0xee88('0x25')]);if(_0x4f825e[_0xee88('0x26')]){delete _0x4f825e[_0xee88('0x26')];}_0xa06cbe[_0xee88('0x19')](_0x10d20a)[_0xee88('0x27')](_0x4f825e);};}exports['index']=function(_0xd10ffa,_0x420993){var _0xa9e236={},_0x89a438={},_0x2366e9={'count':0x0,'rows':[]};var _0x4c72e6=_['map'](db[_0xee88('0x28')][_0xee88('0x29')],function(_0x1de0c0){return{'name':_0x1de0c0[_0xee88('0x2a')],'type':_0x1de0c0['type'][_0xee88('0x2b')]};});_0x89a438['model']=_[_0xee88('0x2c')](_[_0xee88('0x2d')](_0x4c72e6,_0xee88('0x26')),[_0xee88('0x26')]);_0x89a438[_0xee88('0x2e')]=_[_0xee88('0x2f')](_0xd10ffa['query']);_0x89a438[_0xee88('0x30')]=_['intersection'](_0x89a438[_0xee88('0x31')],_0x89a438[_0xee88('0x2e')]);_0xa9e236[_0xee88('0x32')]=_['intersection'](_0x89a438[_0xee88('0x31')],qs[_0xee88('0x33')](_0xd10ffa['query'][_0xee88('0x33')]));_0xa9e236[_0xee88('0x32')]=_0xa9e236[_0xee88('0x32')][_0xee88('0x34')]?_0xa9e236[_0xee88('0x32')]:_0x89a438[_0xee88('0x31')];if(!_0xd10ffa[_0xee88('0x2e')]['hasOwnProperty'](_0xee88('0x35'))){_0xa9e236['limit']=qs[_0xee88('0x1b')](_0xd10ffa['query'][_0xee88('0x1b')]);_0xa9e236[_0xee88('0x1a')]=qs[_0xee88('0x1a')](_0xd10ffa[_0xee88('0x2e')]['offset']);}_0xa9e236[_0xee88('0x36')]=qs['sort'](_0xd10ffa[_0xee88('0x2e')][_0xee88('0x37')]);_0xa9e236[_0xee88('0x38')]=qs[_0xee88('0x30')](_[_0xee88('0x39')](_0xd10ffa[_0xee88('0x2e')],_0x89a438[_0xee88('0x30')]),_0x4c72e6);if(_0xd10ffa['query'][_0xee88('0x3a')]){_0xa9e236[_0xee88('0x38')]=_[_0xee88('0x3b')](_0xa9e236[_0xee88('0x38')],{'$or':_[_0xee88('0x2d')](_0x4c72e6,function(_0x35b87b){if(_0x35b87b[_0xee88('0x3c')]!==_0xee88('0x3d')){var _0x78331b={};_0x78331b[_0x35b87b[_0xee88('0x26')]]={'$like':'%'+_0xd10ffa[_0xee88('0x2e')]['filter']+'%'};return _0x78331b;}})});}_0xa9e236=_[_0xee88('0x3b')]({},_0xa9e236,_0xd10ffa[_0xee88('0x3e')]);var _0x4590cf={'where':_0xa9e236[_0xee88('0x38')]};return db[_0xee88('0x28')][_0xee88('0x3f')](_0x4590cf)[_0xee88('0x22')](function(_0x3b5672){_0x2366e9[_0xee88('0x3f')]=_0x3b5672;if(_0xd10ffa[_0xee88('0x2e')][_0xee88('0x40')]){_0xa9e236[_0xee88('0x41')]=[{'all':!![]}];}return db[_0xee88('0x28')]['findAll'](_0xa9e236);})['then'](function(_0x343482){_0x2366e9['rows']=_0x343482;return _0x2366e9;})['then'](respondWithFilteredResult(_0x420993,_0xa9e236))[_0xee88('0x42')](handleError(_0x420993,null));};exports['show']=function(_0x39697e,_0x4f6067){var _0x363558={'raw':!![],'where':{'id':_0x39697e[_0xee88('0x43')]['id']}},_0xb3fc79={};_0xb3fc79[_0xee88('0x31')]=_[_0xee88('0x2f')](db[_0xee88('0x28')][_0xee88('0x29')]);_0xb3fc79[_0xee88('0x2e')]=_[_0xee88('0x2f')](_0x39697e[_0xee88('0x2e')]);_0xb3fc79[_0xee88('0x30')]=_[_0xee88('0x44')](_0xb3fc79['model'],_0xb3fc79[_0xee88('0x2e')]);_0x363558[_0xee88('0x32')]=_[_0xee88('0x44')](_0xb3fc79[_0xee88('0x31')],qs[_0xee88('0x33')](_0x39697e[_0xee88('0x2e')][_0xee88('0x33')]));_0x363558[_0xee88('0x32')]=_0x363558['attributes'][_0xee88('0x34')]?_0x363558['attributes']:_0xb3fc79['model'];if(_0x39697e['query'][_0xee88('0x40')]){_0x363558[_0xee88('0x41')]=[{'all':!![]}];}_0x363558=_[_0xee88('0x3b')]({},_0x363558,_0x39697e[_0xee88('0x3e')]);return db['VoiceMailMessage'][_0xee88('0x45')](_0x363558)[_0xee88('0x22')](handleEntityNotFound(_0x4f6067,null))[_0xee88('0x22')](respondWithResult(_0x4f6067,null))['catch'](handleError(_0x4f6067,null));};exports['create']=function(_0x4eb271,_0x289066){return db['VoiceMailMessage'][_0xee88('0x46')](_0x4eb271[_0xee88('0x47')],{})[_0xee88('0x22')](respondWithResult(_0x289066,0xc9))['catch'](handleError(_0x289066,null));};exports[_0xee88('0x21')]=function(_0x5cd255,_0x5996b8){if(_0x5cd255[_0xee88('0x47')]['id']){delete _0x5cd255['body']['id'];}return db[_0xee88('0x28')][_0xee88('0x45')]({'where':{'id':_0x5cd255['params']['id']}})[_0xee88('0x22')](handleEntityNotFound(_0x5996b8,null))['then'](saveUpdates(_0x5cd255[_0xee88('0x47')],null))['then'](respondWithResult(_0x5996b8,null))[_0xee88('0x42')](handleError(_0x5996b8,null));};exports['destroy']=function(_0x30165e,_0x41a71e){return db[_0xee88('0x28')]['find']({'where':{'id':_0x30165e[_0xee88('0x43')]['id']}})[_0xee88('0x22')](handleEntityNotFound(_0x41a71e,null))[_0xee88('0x22')](removeEntity(_0x41a71e,null))[_0xee88('0x42')](handleError(_0x41a71e,null));};exports[_0xee88('0x48')]=function(_0x48fbbd,_0x590e00,_0x2d49d2){return db[_0xee88('0x28')][_0xee88('0x45')]({'where':{'id':_0x48fbbd[_0xee88('0x43')]['id']},'attributes':['id',_0xee88('0x49'),_0xee88('0x4a')]})[_0xee88('0x22')](handleEntityNotFound(_0x590e00,null))[_0xee88('0x22')](function(_0x45dca1){if(_0x45dca1){if(!_0x45dca1[_0xee88('0x49')]){throw new db[(_0xee88('0x4b'))][(_0xee88('0x4c'))]('VoiceMailMessage\x20not\x20found');}var _0x490efe={'Content-Type':'audio/wav','Content-Disposition':_0xee88('0x4d')};if(_0x45dca1[_0xee88('0x4a')]){_0x490efe['Content-Disposition']=_0xee88('0x4e')+_0x45dca1[_0xee88('0x4a')]+_0xee88('0x4f');}_0x590e00['set'](_0x490efe);return _0x590e00['send'](new Buffer(_0x45dca1[_0xee88('0x49')]));}})[_0xee88('0x42')](handleError(_0x590e00,null));}; \ No newline at end of file +var _0xee2b=['merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create','body','destroy','download','msg_id','recording','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','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','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','limit','Content-Range','apply','reject','save','update','then','error','name','send','index','map','VoiceMailMessage','fieldName','key','differenceBy','query','filters','intersection','model','attributes','fields','length','nolimit','offset','order','sort','pick','filter','where'];(function(_0x36dae8,_0xeeb54e){var _0x91ecb1=function(_0x22fd76){while(--_0x22fd76){_0x36dae8['push'](_0x36dae8['shift']());}};_0x91ecb1(++_0xeeb54e);}(_0xee2b,0x6e));var _0xbee2=function(_0x55c414,_0x3c2567){_0x55c414=_0x55c414-0x0;var _0x356d50=_0xee2b[_0x55c414];return _0x356d50;};'use strict';var pdf=require(_0xbee2('0x0'));var emlformat=require(_0xbee2('0x1'));var rimraf=require(_0xbee2('0x2'));var zipdir=require(_0xbee2('0x3'));var jsonpatch=require(_0xbee2('0x4'));var rp=require(_0xbee2('0x5'));var moment=require(_0xbee2('0x6'));var BPromise=require(_0xbee2('0x7'));var Mustache=require(_0xbee2('0x8'));var util=require(_0xbee2('0x9'));var path=require('path');var sox=require(_0xbee2('0xa'));var csv=require(_0xbee2('0xb'));var ejs=require(_0xbee2('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbee2('0xd'));var crypto=require(_0xbee2('0xe'));var jsforce=require(_0xbee2('0xf'));var deskjs=require(_0xbee2('0x10'));var toCsv=require(_0xbee2('0xb'));var querystring=require(_0xbee2('0x11'));var Papa=require('papaparse');var Redis=require(_0xbee2('0x12'));var authService=require(_0xbee2('0x13'));var qs=require(_0xbee2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbee2('0x15'));var logger=require(_0xbee2('0x16'))('api');var utils=require(_0xbee2('0x17'));var config=require(_0xbee2('0x18'));var licenseUtil=require(_0xbee2('0x19'));var db=require(_0xbee2('0x1a'))['db'];function respondWithStatusCode(_0x11ebef,_0x16b537){_0x16b537=_0x16b537||0xcc;return function(_0x2acf51){if(_0x2acf51){return _0x11ebef[_0xbee2('0x1b')](_0x16b537);}return _0x11ebef[_0xbee2('0x1c')](_0x16b537)[_0xbee2('0x1d')]();};}function respondWithResult(_0x531258,_0x4b6d2d){_0x4b6d2d=_0x4b6d2d||0xc8;return function(_0x36ddad){if(_0x36ddad){return _0x531258['status'](_0x4b6d2d)[_0xbee2('0x1e')](_0x36ddad);}};}function respondWithFilteredResult(_0x536e57,_0x1b18f4){return function(_0x489afd){if(_0x489afd){var _0x1ee51d=_0x489afd[_0xbee2('0x1f')],_0xe7eb67=_0x1b18f4['offset'],_0x14c698=_0x1b18f4['offset']+_0x1b18f4[_0xbee2('0x20')],_0x4054e3;if(_0x14c698>=_0x1ee51d){_0x14c698=_0x1ee51d;_0x4054e3=0xc8;}else{_0x4054e3=0xce;}_0x536e57[_0xbee2('0x1c')](_0x4054e3);return _0x536e57['set'](_0xbee2('0x21'),_0xe7eb67+'-'+_0x14c698+'/'+_0x1ee51d)[_0xbee2('0x1e')](_0x489afd);}return null;};}function patchUpdates(_0x5dd95d){return function(_0x5ef8ae){try{jsonpatch[_0xbee2('0x22')](_0x5ef8ae,_0x5dd95d,!![]);}catch(_0x26a3c2){return BPromise[_0xbee2('0x23')](_0x26a3c2);}return _0x5ef8ae[_0xbee2('0x24')]();};}function saveUpdates(_0x3cb17f,_0x58cffd){return function(_0x576173){if(_0x576173){return _0x576173[_0xbee2('0x25')](_0x3cb17f)[_0xbee2('0x26')](function(_0x4a1ee7){return _0x4a1ee7;});}return null;};}function removeEntity(_0x90bbe5,_0x4b3c5b){return function(_0xae3ce){if(_0xae3ce){return _0xae3ce['destroy']()[_0xbee2('0x26')](function(){_0x90bbe5[_0xbee2('0x1c')](0xcc)[_0xbee2('0x1d')]();});}};}function handleEntityNotFound(_0x23feec,_0x55d794){return function(_0x72e607){if(!_0x72e607){_0x23feec[_0xbee2('0x1b')](0x194);}return _0x72e607;};}function handleError(_0x161387,_0x23269b){_0x23269b=_0x23269b||0x1f4;return function(_0x490489){logger[_0xbee2('0x27')](_0x490489['stack']);if(_0x490489[_0xbee2('0x28')]){delete _0x490489[_0xbee2('0x28')];}_0x161387['status'](_0x23269b)[_0xbee2('0x29')](_0x490489);};}exports[_0xbee2('0x2a')]=function(_0x5f5367,_0xd7ee12){var _0x59997c={},_0x5b57cc={},_0x1f55c4={'count':0x0,'rows':[]};var _0x483b27=_[_0xbee2('0x2b')](db[_0xbee2('0x2c')]['rawAttributes'],function(_0x5be94d){return{'name':_0x5be94d[_0xbee2('0x2d')],'type':_0x5be94d['type'][_0xbee2('0x2e')]};});_0x5b57cc['model']=_[_0xbee2('0x2f')](_[_0xbee2('0x2b')](_0x483b27,_0xbee2('0x28')),[_0xbee2('0x28')]);_0x5b57cc[_0xbee2('0x30')]=_['keys'](_0x5f5367[_0xbee2('0x30')]);_0x5b57cc[_0xbee2('0x31')]=_[_0xbee2('0x32')](_0x5b57cc[_0xbee2('0x33')],_0x5b57cc[_0xbee2('0x30')]);_0x59997c[_0xbee2('0x34')]=_['intersection'](_0x5b57cc['model'],qs[_0xbee2('0x35')](_0x5f5367[_0xbee2('0x30')][_0xbee2('0x35')]));_0x59997c[_0xbee2('0x34')]=_0x59997c['attributes'][_0xbee2('0x36')]?_0x59997c['attributes']:_0x5b57cc[_0xbee2('0x33')];if(!_0x5f5367[_0xbee2('0x30')]['hasOwnProperty'](_0xbee2('0x37'))){_0x59997c[_0xbee2('0x20')]=qs['limit'](_0x5f5367[_0xbee2('0x30')]['limit']);_0x59997c[_0xbee2('0x38')]=qs[_0xbee2('0x38')](_0x5f5367[_0xbee2('0x30')][_0xbee2('0x38')]);}_0x59997c[_0xbee2('0x39')]=qs[_0xbee2('0x3a')](_0x5f5367[_0xbee2('0x30')]['sort']);_0x59997c['where']=qs[_0xbee2('0x31')](_[_0xbee2('0x3b')](_0x5f5367['query'],_0x5b57cc['filters']),_0x483b27);if(_0x5f5367['query'][_0xbee2('0x3c')]){_0x59997c[_0xbee2('0x3d')]=_[_0xbee2('0x3e')](_0x59997c[_0xbee2('0x3d')],{'$or':_['map'](_0x483b27,function(_0xb4cf73){if(_0xb4cf73['type']!==_0xbee2('0x3f')){var _0x421f58={};_0x421f58[_0xb4cf73[_0xbee2('0x28')]]={'$like':'%'+_0x5f5367[_0xbee2('0x30')][_0xbee2('0x3c')]+'%'};return _0x421f58;}})});}_0x59997c=_[_0xbee2('0x3e')]({},_0x59997c,_0x5f5367[_0xbee2('0x40')]);var _0xc32fb9={'where':_0x59997c['where']};return db['VoiceMailMessage'][_0xbee2('0x1f')](_0xc32fb9)[_0xbee2('0x26')](function(_0x500fcd){_0x1f55c4[_0xbee2('0x1f')]=_0x500fcd;if(_0x5f5367[_0xbee2('0x30')][_0xbee2('0x41')]){_0x59997c[_0xbee2('0x42')]=[{'all':!![]}];}return db[_0xbee2('0x2c')]['findAll'](_0x59997c);})[_0xbee2('0x26')](function(_0x2edfe5){_0x1f55c4[_0xbee2('0x43')]=_0x2edfe5;return _0x1f55c4;})[_0xbee2('0x26')](respondWithFilteredResult(_0xd7ee12,_0x59997c))[_0xbee2('0x44')](handleError(_0xd7ee12,null));};exports[_0xbee2('0x45')]=function(_0x329117,_0x2eaf4d){var _0xc40250={'raw':!![],'where':{'id':_0x329117[_0xbee2('0x46')]['id']}},_0x51ad92={};_0x51ad92[_0xbee2('0x33')]=_[_0xbee2('0x47')](db[_0xbee2('0x2c')][_0xbee2('0x48')]);_0x51ad92[_0xbee2('0x30')]=_[_0xbee2('0x47')](_0x329117[_0xbee2('0x30')]);_0x51ad92['filters']=_['intersection'](_0x51ad92[_0xbee2('0x33')],_0x51ad92['query']);_0xc40250[_0xbee2('0x34')]=_['intersection'](_0x51ad92[_0xbee2('0x33')],qs[_0xbee2('0x35')](_0x329117[_0xbee2('0x30')][_0xbee2('0x35')]));_0xc40250[_0xbee2('0x34')]=_0xc40250['attributes'][_0xbee2('0x36')]?_0xc40250[_0xbee2('0x34')]:_0x51ad92[_0xbee2('0x33')];if(_0x329117[_0xbee2('0x30')][_0xbee2('0x41')]){_0xc40250[_0xbee2('0x42')]=[{'all':!![]}];}_0xc40250=_[_0xbee2('0x3e')]({},_0xc40250,_0x329117['options']);return db[_0xbee2('0x2c')][_0xbee2('0x49')](_0xc40250)[_0xbee2('0x26')](handleEntityNotFound(_0x2eaf4d,null))[_0xbee2('0x26')](respondWithResult(_0x2eaf4d,null))[_0xbee2('0x44')](handleError(_0x2eaf4d,null));};exports[_0xbee2('0x4a')]=function(_0xff8520,_0x5cf015){return db[_0xbee2('0x2c')][_0xbee2('0x4a')](_0xff8520[_0xbee2('0x4b')],{})[_0xbee2('0x26')](respondWithResult(_0x5cf015,0xc9))[_0xbee2('0x44')](handleError(_0x5cf015,null));};exports[_0xbee2('0x25')]=function(_0x3ddf4a,_0x23f045){if(_0x3ddf4a[_0xbee2('0x4b')]['id']){delete _0x3ddf4a[_0xbee2('0x4b')]['id'];}return db[_0xbee2('0x2c')][_0xbee2('0x49')]({'where':{'id':_0x3ddf4a[_0xbee2('0x46')]['id']}})[_0xbee2('0x26')](handleEntityNotFound(_0x23f045,null))[_0xbee2('0x26')](saveUpdates(_0x3ddf4a['body'],null))[_0xbee2('0x26')](respondWithResult(_0x23f045,null))['catch'](handleError(_0x23f045,null));};exports[_0xbee2('0x4c')]=function(_0x1d1d03,_0xe14391){return db[_0xbee2('0x2c')]['find']({'where':{'id':_0x1d1d03[_0xbee2('0x46')]['id']}})[_0xbee2('0x26')](handleEntityNotFound(_0xe14391,null))[_0xbee2('0x26')](removeEntity(_0xe14391,null))['catch'](handleError(_0xe14391,null));};exports[_0xbee2('0x4d')]=function(_0x1572c6,_0x3d1978,_0x565e6d){return db[_0xbee2('0x2c')][_0xbee2('0x49')]({'where':{'id':_0x1572c6[_0xbee2('0x46')]['id']},'attributes':['id','recording',_0xbee2('0x4e')]})[_0xbee2('0x26')](handleEntityNotFound(_0x3d1978,null))[_0xbee2('0x26')](function(_0x10e40b){if(_0x10e40b){if(!_0x10e40b[_0xbee2('0x4f')]){throw new db['Sequelize'][(_0xbee2('0x50'))](_0xbee2('0x51'));}var _0x36dd6f={'Content-Type':_0xbee2('0x52'),'Content-Disposition':_0xbee2('0x53')};if(_0x10e40b[_0xbee2('0x4e')]){_0x36dd6f[_0xbee2('0x54')]=_0xbee2('0x55')+_0x10e40b[_0xbee2('0x4e')]+'.wav\x22';}_0x3d1978['set'](_0x36dd6f);return _0x3d1978[_0xbee2('0x29')](new Buffer(_0x10e40b[_0xbee2('0x4f')]));}})[_0xbee2('0x44')](handleError(_0x3d1978,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 6023119..78602bc 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 _0xd8cb=['voice_voicemail_messages','dir','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','VoiceMailMessage'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd8cb,0x1d6));var _0xbd8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd8cb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xbd8c('0x0'));var logger=require(_0xbd8c('0x1'))(_0xbd8c('0x2'));var moment=require('moment');var BPromise=require(_0xbd8c('0x3'));var rp=require(_0xbd8c('0x4'));var fs=require('fs');var path=require(_0xbd8c('0x5'));var rimraf=require(_0xbd8c('0x6'));var config=require(_0xbd8c('0x7'));var attributes=require(_0xbd8c('0x8'));module['exports']=function(_0x3f51dd,_0x3025e7){return _0x3f51dd['define'](_0xbd8c('0x9'),attributes,{'tableName':_0xbd8c('0xa'),'paranoid':![],'indexes':[{'name':_0xbd8c('0xb'),'fields':[_0xbd8c('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0xf61a=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceMailMessage','dir'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xf61a,0x75));var _0xaf61=function(_0x1c77c4,_0x3a9e13){_0x1c77c4=_0x1c77c4-0x0;var _0x18a918=_0xf61a[_0x1c77c4];return _0x18a918;};'use strict';var _=require(_0xaf61('0x0'));var util=require(_0xaf61('0x1'));var logger=require(_0xaf61('0x2'))('api');var moment=require(_0xaf61('0x3'));var BPromise=require(_0xaf61('0x4'));var rp=require(_0xaf61('0x5'));var fs=require('fs');var path=require(_0xaf61('0x6'));var rimraf=require(_0xaf61('0x7'));var config=require(_0xaf61('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0xaf61('0x9')]=function(_0x280a47,_0x2df7f5){return _0x280a47[_0xaf61('0xa')](_0xaf61('0xb'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xaf61('0xc'),'fields':[_0xaf61('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 14b3340..85c969f 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','VoiceMailMessage,\x20%s,\x20%s','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x21d88d,_0x4ff19c){var _0x30a579=function(_0x24cf7a){while(--_0x24cf7a){_0x21d88d['push'](_0x21d88d['shift']());}};_0x30a579(++_0x4ff19c);}(_0x2ef3,0xba));var _0x32ef=function(_0x442a11,_0x532ddf){_0x442a11=_0x442a11-0x0;var _0x261a3b=_0x2ef3[_0x442a11];return _0x261a3b;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x57ca=['client','http','request','info','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x4c4a1f,_0x589ad5){var _0x3ea181=function(_0x4f17dc){while(--_0x4f17dc){_0x4c4a1f['push'](_0x4c4a1f['shift']());}};_0x3ea181(++_0x589ad5);}(_0x57ca,0x108));var _0xa57c=function(_0x3bc304,_0x5d4e12){_0x3bc304=_0x3bc304-0x0;var _0x1c90a9=_0x57ca[_0x3bc304];return _0x1c90a9;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index fd6a1d6..dfd50ed 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 _0x974a=['isAuthenticated','/:id','show','/:id/sounds','getSounds','create','post','put','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','connect-timeout','express','../../config/environment','./voiceMusicOnHold.controller','get'];(function(_0x456956,_0x7343d3){var _0xa25d0e=function(_0x3f0129){while(--_0x3f0129){_0x456956['push'](_0x456956['shift']());}};_0xa25d0e(++_0x7343d3);}(_0x974a,0xad));var _0xa974=function(_0x5d2dc3,_0x1e9809){_0x5d2dc3=_0x5d2dc3-0x0;var _0x59da9b=_0x974a[_0x5d2dc3];return _0x59da9b;};'use strict';var multer=require(_0xa974('0x0'));var util=require(_0xa974('0x1'));var path=require('path');var timeout=require(_0xa974('0x2'));var express=require(_0xa974('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa974('0x4'));var controller=require(_0xa974('0x5'));router[_0xa974('0x6')]('/',auth[_0xa974('0x7')](),controller['index']);router[_0xa974('0x6')](_0xa974('0x8'),auth[_0xa974('0x7')](),controller[_0xa974('0x9')]);router[_0xa974('0x6')](_0xa974('0xa'),auth[_0xa974('0x7')](),controller[_0xa974('0xb')]);router['post']('/',auth[_0xa974('0x7')](),controller[_0xa974('0xc')]);router[_0xa974('0xd')]('/:id/sounds',auth[_0xa974('0x7')](),controller['addSound']);router[_0xa974('0xe')](_0xa974('0x8'),auth[_0xa974('0x7')](),controller['update']);router[_0xa974('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xa974('0x10')]);router[_0xa974('0xf')](_0xa974('0x11'),auth['isAuthenticated'](),controller[_0xa974('0x12')]);module[_0xa974('0x13')]=router; \ No newline at end of file +var _0x0331=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','path'];(function(_0x37a3f3,_0x663b49){var _0x4da923=function(_0x47713f){while(--_0x47713f){_0x37a3f3['push'](_0x37a3f3['shift']());}};_0x4da923(++_0x663b49);}(_0x0331,0xad));var _0x1033=function(_0x3f3f40,_0x4c71f4){_0x3f3f40=_0x3f3f40-0x0;var _0x403b7a=_0x0331[_0x3f3f40];return _0x403b7a;};'use strict';var multer=require(_0x1033('0x0'));var util=require('util');var path=require(_0x1033('0x1'));var timeout=require('connect-timeout');var express=require(_0x1033('0x2'));var router=express[_0x1033('0x3')]();var auth=require(_0x1033('0x4'));var interaction=require(_0x1033('0x5'));var config=require(_0x1033('0x6'));var controller=require(_0x1033('0x7'));router[_0x1033('0x8')]('/',auth[_0x1033('0x9')](),controller[_0x1033('0xa')]);router[_0x1033('0x8')](_0x1033('0xb'),auth['isAuthenticated'](),controller[_0x1033('0xc')]);router[_0x1033('0x8')](_0x1033('0xd'),auth[_0x1033('0x9')](),controller[_0x1033('0xe')]);router[_0x1033('0xf')]('/',auth[_0x1033('0x9')](),controller[_0x1033('0x10')]);router[_0x1033('0xf')](_0x1033('0xd'),auth['isAuthenticated'](),controller[_0x1033('0x11')]);router[_0x1033('0x12')](_0x1033('0xb'),auth[_0x1033('0x9')](),controller[_0x1033('0x13')]);router[_0x1033('0x14')](_0x1033('0xb'),auth[_0x1033('0x9')](),controller[_0x1033('0x15')]);router[_0x1033('0x14')](_0x1033('0x16'),auth[_0x1033('0x9')](),controller[_0x1033('0x17')]);module[_0x1033('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 72d00c1..9cc615e 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 _0x0a6f=['files','mp3nb','quietmp3nb','mp3','STRING','TIMESTAMP','BOOLEAN','sequelize','exports','ENUM'];(function(_0x5d331d,_0x26691b){var _0x6898fa=function(_0x3a2083){while(--_0x3a2083){_0x5d331d['push'](_0x5d331d['shift']());}};_0x6898fa(++_0x26691b);}(_0x0a6f,0xbb));var _0xf0a6=function(_0x3db71e,_0x275086){_0x3db71e=_0x3db71e-0x0;var _0x4240a1=_0x0a6f[_0x3db71e];return _0x4240a1;};'use strict';var Sequelize=require(_0xf0a6('0x0'));module[_0xf0a6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0xf0a6('0x2')]('custom',_0xf0a6('0x3'),_0xf0a6('0x4'),_0xf0a6('0x5'),'quietmp3',_0xf0a6('0x6')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xf0a6('0x7')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xf0a6('0x7')],'allowNull':!![]},'sort':{'type':Sequelize[_0xf0a6('0x7')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xf0a6('0x7')],'allowNull':!![]},'stamp':{'type':_0xf0a6('0x8')},'defaultEntry':{'type':Sequelize[_0xf0a6('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa02c=['sequelize','exports','STRING','ENUM','files','mp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0xa02c,0xd1));var _0xca02=function(_0x5b988e,_0x58d8dd){_0x5b988e=_0x5b988e-0x0;var _0x8a1d2c=_0xa02c[_0x5b988e];return _0x8a1d2c;};'use strict';var Sequelize=require(_0xca02('0x0'));module[_0xca02('0x1')]={'name':{'type':Sequelize[_0xca02('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0xca02('0x3')]('custom',_0xca02('0x4'),_0xca02('0x5'),'quietmp3nb',_0xca02('0x6'),_0xca02('0x7')),'allowNull':!![],'defaultValue':_0xca02('0x4')},'directory':{'type':Sequelize[_0xca02('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xca02('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xca02('0x2')],'allowNull':!![],'defaultValue':_0xca02('0x8')},'format':{'type':Sequelize[_0xca02('0x2')],'allowNull':!![]},'stamp':{'type':_0xca02('0x9')},'defaultEntry':{'type':Sequelize[_0xca02('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 f0023fa..ec8d0b9 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 _0x8619=['show','params','keys','length','find','body','create','sequelize','transaction','mode','directory','root','server/files/moh','files','mkdirSync','0777','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','join','Sequelize','ValidationError','message','addSound','Sound','findOne','createdAt','server/files/sounds/converted','%s.%s','basename','save_name','extname','converted_format','format','symlinkSync','removeSound','id2','unlinkSync','getSounds','filter','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','update','then','get','MusicOnHolds','UserProfileResource','destroy','stack','name','index','map','VoiceMusicOnHold','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x26add1,_0xf64861){var _0x3330ee=function(_0x529b20){while(--_0x529b20){_0x26add1['push'](_0x26add1['shift']());}};_0x3330ee(++_0xf64861);}(_0x8619,0x9c));var _0x9861=function(_0x29df03,_0x2ddf27){_0x29df03=_0x29df03-0x0;var _0x2eab5b=_0x8619[_0x29df03];return _0x2eab5b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9861('0x0'));var rimraf=require(_0x9861('0x1'));var zipdir=require(_0x9861('0x2'));var jsonpatch=require(_0x9861('0x3'));var rp=require('request-promise');var moment=require(_0x9861('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9861('0x5'));var util=require(_0x9861('0x6'));var path=require(_0x9861('0x7'));var sox=require('sox');var csv=require(_0x9861('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9861('0x9'));var squel=require(_0x9861('0xa'));var crypto=require(_0x9861('0xb'));var jsforce=require(_0x9861('0xc'));var deskjs=require(_0x9861('0xd'));var toCsv=require(_0x9861('0x8'));var querystring=require(_0x9861('0xe'));var Papa=require('papaparse');var Redis=require(_0x9861('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9861('0x10'));var as=require(_0x9861('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9861('0x12'))('api');var utils=require(_0x9861('0x13'));var config=require(_0x9861('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9861('0x15'))['db'];function respondWithStatusCode(_0x38d1d9,_0x2b2024){_0x2b2024=_0x2b2024||0xcc;return function(_0x28a97f){if(_0x28a97f){return _0x38d1d9[_0x9861('0x16')](_0x2b2024);}return _0x38d1d9['status'](_0x2b2024)[_0x9861('0x17')]();};}function respondWithResult(_0x192c04,_0xb8338a){_0xb8338a=_0xb8338a||0xc8;return function(_0x24ab5f){if(_0x24ab5f){return _0x192c04[_0x9861('0x18')](_0xb8338a)[_0x9861('0x19')](_0x24ab5f);}};}function respondWithFilteredResult(_0x517ac1,_0x1c4604){return function(_0x5c49f3){if(_0x5c49f3){var _0x3b5b4d=_0x5c49f3[_0x9861('0x1a')],_0x300ee6=_0x1c4604[_0x9861('0x1b')],_0x263e7c=_0x1c4604[_0x9861('0x1b')]+_0x1c4604[_0x9861('0x1c')],_0x5c5547;if(_0x263e7c>=_0x3b5b4d){_0x263e7c=_0x3b5b4d;_0x5c5547=0xc8;}else{_0x5c5547=0xce;}_0x517ac1[_0x9861('0x18')](_0x5c5547);return _0x517ac1['set'](_0x9861('0x1d'),_0x300ee6+'-'+_0x263e7c+'/'+_0x3b5b4d)[_0x9861('0x19')](_0x5c49f3);}return null;};}function patchUpdates(_0x4114b4){return function(_0x104c86){try{jsonpatch[_0x9861('0x1e')](_0x104c86,_0x4114b4,!![]);}catch(_0x38f23c){return BPromise[_0x9861('0x1f')](_0x38f23c);}return _0x104c86['save']();};}function saveUpdates(_0x32c8c9,_0x21a641){return function(_0x41bcbc){if(_0x41bcbc){return _0x41bcbc[_0x9861('0x20')](_0x32c8c9)['then'](function(_0x436a7c){return _0x436a7c;});}return null;};}function removeEntity(_0xb5308c,_0x1e69bd){return function(_0x3899ff){if(_0x3899ff){return _0x3899ff['destroy']()[_0x9861('0x21')](function(){var _0x92f8b5=_0x3899ff[_0x9861('0x22')]({'plain':!![]});var _0x5927df=_0x9861('0x23');return db[_0x9861('0x24')][_0x9861('0x25')]({'where':{'type':_0x5927df,'resourceId':_0x92f8b5['id']}})[_0x9861('0x21')](function(){return _0x3899ff;});})[_0x9861('0x21')](function(){_0xb5308c[_0x9861('0x18')](0xcc)[_0x9861('0x17')]();});}};}function handleEntityNotFound(_0x4f201d,_0x586c42){return function(_0x388fa3){if(!_0x388fa3){_0x4f201d[_0x9861('0x16')](0x194);}return _0x388fa3;};}function handleError(_0x57b339,_0x484dec){_0x484dec=_0x484dec||0x1f4;return function(_0x41f054){logger['error'](_0x41f054[_0x9861('0x26')]);if(_0x41f054['name']){delete _0x41f054[_0x9861('0x27')];}_0x57b339[_0x9861('0x18')](_0x484dec)['send'](_0x41f054);};}exports[_0x9861('0x28')]=function(_0x3fab1e,_0x54044f){var _0xf517be={},_0x1208d1={},_0x5db5cb={'count':0x0,'rows':[]};var _0x5c5913=_[_0x9861('0x29')](db[_0x9861('0x2a')][_0x9861('0x2b')],function(_0x2b2ac8){return{'name':_0x2b2ac8[_0x9861('0x2c')],'type':_0x2b2ac8['type'][_0x9861('0x2d')]};});_0x1208d1[_0x9861('0x2e')]=_['map'](_0x5c5913,_0x9861('0x27'));_0x1208d1[_0x9861('0x2f')]=_['keys'](_0x3fab1e[_0x9861('0x2f')]);_0x1208d1[_0x9861('0x30')]=_['intersection'](_0x1208d1['model'],_0x1208d1['query']);_0xf517be[_0x9861('0x31')]=_[_0x9861('0x32')](_0x1208d1[_0x9861('0x2e')],qs[_0x9861('0x33')](_0x3fab1e[_0x9861('0x2f')]['fields']));_0xf517be[_0x9861('0x31')]=_0xf517be[_0x9861('0x31')]['length']?_0xf517be[_0x9861('0x31')]:_0x1208d1[_0x9861('0x2e')];if(!_0x3fab1e['query'][_0x9861('0x34')](_0x9861('0x35'))){_0xf517be[_0x9861('0x1c')]=qs[_0x9861('0x1c')](_0x3fab1e[_0x9861('0x2f')]['limit']);_0xf517be[_0x9861('0x1b')]=qs[_0x9861('0x1b')](_0x3fab1e[_0x9861('0x2f')][_0x9861('0x1b')]);}_0xf517be['order']=qs[_0x9861('0x36')](_0x3fab1e[_0x9861('0x2f')][_0x9861('0x36')]);_0xf517be['where']=qs[_0x9861('0x30')](_[_0x9861('0x37')](_0x3fab1e[_0x9861('0x2f')],_0x1208d1[_0x9861('0x30')]),_0x5c5913);if(_0x3fab1e[_0x9861('0x2f')]['filter']){_0xf517be[_0x9861('0x38')]=_[_0x9861('0x39')](_0xf517be[_0x9861('0x38')],{'$or':_[_0x9861('0x29')](_0x5c5913,function(_0x2b424f){if(_0x2b424f[_0x9861('0x3a')]!==_0x9861('0x3b')){var _0x280620={};_0x280620[_0x2b424f[_0x9861('0x27')]]={'$like':'%'+_0x3fab1e[_0x9861('0x2f')]['filter']+'%'};return _0x280620;}})});}_0xf517be=_[_0x9861('0x39')]({},_0xf517be,_0x3fab1e[_0x9861('0x3c')]);var _0x90ef39={'where':_0xf517be[_0x9861('0x38')]};return db[_0x9861('0x2a')][_0x9861('0x1a')](_0x90ef39)[_0x9861('0x21')](function(_0x3cf886){_0x5db5cb[_0x9861('0x1a')]=_0x3cf886;if(_0x3fab1e[_0x9861('0x2f')][_0x9861('0x3d')]){_0xf517be[_0x9861('0x3e')]=[{'all':!![]}];}return db[_0x9861('0x2a')][_0x9861('0x3f')](_0xf517be);})['then'](function(_0x49bbd3){_0x5db5cb[_0x9861('0x40')]=_0x49bbd3;return _0x5db5cb;})[_0x9861('0x21')](respondWithFilteredResult(_0x54044f,_0xf517be))[_0x9861('0x41')](handleError(_0x54044f,null));};exports[_0x9861('0x42')]=function(_0x30f573,_0x2a1b1a){var _0x5f25cf={'raw':![],'where':{'id':_0x30f573[_0x9861('0x43')]['id']}},_0x488b2e={};_0x488b2e['model']=_[_0x9861('0x44')](db[_0x9861('0x2a')][_0x9861('0x2b')]);_0x488b2e[_0x9861('0x2f')]=_[_0x9861('0x44')](_0x30f573[_0x9861('0x2f')]);_0x488b2e[_0x9861('0x30')]=_[_0x9861('0x32')](_0x488b2e[_0x9861('0x2e')],_0x488b2e[_0x9861('0x2f')]);_0x5f25cf[_0x9861('0x31')]=_[_0x9861('0x32')](_0x488b2e[_0x9861('0x2e')],qs['fields'](_0x30f573['query'][_0x9861('0x33')]));_0x5f25cf[_0x9861('0x31')]=_0x5f25cf[_0x9861('0x31')][_0x9861('0x45')]?_0x5f25cf[_0x9861('0x31')]:_0x488b2e[_0x9861('0x2e')];if(_0x30f573[_0x9861('0x2f')][_0x9861('0x3d')]){_0x5f25cf[_0x9861('0x3e')]=[{'all':!![]}];}_0x5f25cf=_['merge']({},_0x5f25cf,_0x30f573[_0x9861('0x3c')]);return db['VoiceMusicOnHold'][_0x9861('0x46')](_0x5f25cf)[_0x9861('0x21')](handleEntityNotFound(_0x2a1b1a,null))[_0x9861('0x21')](respondWithResult(_0x2a1b1a,null))[_0x9861('0x41')](handleError(_0x2a1b1a,null));};exports[_0x9861('0x20')]=function(_0x35394a,_0x1bfc2a){if(_0x35394a[_0x9861('0x47')]['id']){delete _0x35394a[_0x9861('0x47')]['id'];}return db[_0x9861('0x2a')][_0x9861('0x46')]({'where':{'id':_0x35394a['params']['id']}})[_0x9861('0x21')](handleEntityNotFound(_0x1bfc2a,null))[_0x9861('0x21')](saveUpdates(_0x35394a[_0x9861('0x47')],null))['then'](respondWithResult(_0x1bfc2a,null))['catch'](handleError(_0x1bfc2a,null));};exports[_0x9861('0x48')]=function(_0x4b3a8b,_0x565965,_0x567001){return db[_0x9861('0x49')][_0x9861('0x4a')](function(_0x36c7d1){if(_0x4b3a8b['body'][_0x9861('0x4b')]==='files'){_0x4b3a8b[_0x9861('0x47')][_0x9861('0x4c')]=path['join'](config[_0x9861('0x4d')],_0x9861('0x4e'),_0x4b3a8b['body'][_0x9861('0x27')]);}return db[_0x9861('0x2a')][_0x9861('0x48')](_0x4b3a8b[_0x9861('0x47')],{'transaction':_0x36c7d1})[_0x9861('0x21')](function(_0xafc9e5){if(_0x4b3a8b[_0x9861('0x47')][_0x9861('0x4b')]===_0x9861('0x4f')){fs[_0x9861('0x50')](_0xafc9e5['directory'],parseInt(_0x9861('0x51'),0x8));}var _0x2e64a8=_0x4b3a8b[_0x9861('0x52')]['get']({'plain':!![]});if(!_0x2e64a8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e64a8[_0x9861('0x53')]==='user'){var _0x1b2d60=_0xafc9e5[_0x9861('0x22')]({'plain':!![]});return db[_0x9861('0x54')][_0x9861('0x46')]({'where':{'name':_0x9861('0x23'),'userProfileId':_0x2e64a8[_0x9861('0x55')]},'raw':!![]})[_0x9861('0x21')](function(_0x5cf078){if(_0x5cf078&&_0x5cf078[_0x9861('0x56')]===0x0){return db[_0x9861('0x24')][_0x9861('0x48')]({'name':_0x1b2d60[_0x9861('0x27')],'resourceId':_0x1b2d60['id'],'type':_0x5cf078[_0x9861('0x27')],'sectionId':_0x5cf078['id']},{})[_0x9861('0x21')](function(){return _0xafc9e5;});}else{return _0xafc9e5;}})['catch'](function(_0x1468db){logger['error'](_0x9861('0x57'),_0x1468db);});}return _0xafc9e5;});})[_0x9861('0x21')](respondWithResult(_0x565965,0xc9))[_0x9861('0x41')](handleError(_0x565965,null));};exports[_0x9861('0x25')]=function(_0x85629f,_0xb5675f,_0x43a70b){var _0x5c7dfd;return db[_0x9861('0x2a')][_0x9861('0x46')]({'where':{'id':_0x85629f[_0x9861('0x43')]['id']}})[_0x9861('0x21')](function(_0x13c76b){if(_0x13c76b){return db['sequelize'][_0x9861('0x4a')](function(_0x236023){return _0x13c76b[_0x9861('0x25')]({'transaction':_0x236023,'raw':!![]})[_0x9861('0x21')](function(_0x454444){if(_0x454444['directory']){fs[_0x9861('0x58')](_0x454444[_0x9861('0x4c')])[_0x9861('0x59')](function(_0x115355){fs['unlinkSync'](path[_0x9861('0x5a')](_0x454444['directory'],_0x115355));});fs['rmdirSync'](_0x454444['directory']);}return _0x454444;});})[_0x9861('0x41')](function(_0x3dfce0){throw new db[(_0x9861('0x5b'))][(_0x9861('0x5c'))](_0x3dfce0[_0x9861('0x5d')]);});}})[_0x9861('0x21')](handleEntityNotFound(_0xb5675f,null))[_0x9861('0x21')](removeEntity(_0xb5675f,null))['catch'](handleError(_0xb5675f,null));};exports[_0x9861('0x5e')]=function(_0x5745e5,_0x2108f6,_0x3bf984){return db[_0x9861('0x49')][_0x9861('0x4a')](function(_0x5edd50){var _0x58cb74;return db[_0x9861('0x2a')][_0x9861('0x46')]({'where':{'id':_0x5745e5['params']['id']}})['then'](function(_0x4a57bb){if(_0x4a57bb){_0x58cb74=_0x4a57bb;return _0x4a57bb[_0x9861('0x5e')](_0x5745e5[_0x9861('0x47')]['id'],{'transaction':_0x5edd50});}})[_0x9861('0x21')](function(_0x323ef3){if(_0x323ef3){return db[_0x9861('0x5f')][_0x9861('0x60')]({'where':{'id':_0x5745e5['body']['id']},'attributes':['id',_0x9861('0x27'),'save_name','converted_format',_0x9861('0x61')],'raw':!![]});}})['then'](function(_0xfd94e3){if(_0xfd94e3){var _0x80db5f=path[_0x9861('0x5a')](config[_0x9861('0x4d')],_0x9861('0x62'),util['format'](_0x9861('0x63'),path[_0x9861('0x64')](_0xfd94e3[_0x9861('0x65')],path[_0x9861('0x66')](_0xfd94e3[_0x9861('0x65')])),_0xfd94e3[_0x9861('0x67')]));var _0x4872ad=path[_0x9861('0x5a')](config[_0x9861('0x4d')],_0x9861('0x4e'),_0x58cb74[_0x9861('0x27')],util[_0x9861('0x68')]('%s.%s',_0xfd94e3[_0x9861('0x27')],_0xfd94e3['converted_format']));fs[_0x9861('0x69')](_0x80db5f,_0x4872ad);return _0xfd94e3;}})[_0x9861('0x41')](function(_0x4e485c){throw new db['Sequelize'][(_0x9861('0x5c'))](_0x4e485c[_0x9861('0x5d')]);});})[_0x9861('0x21')](handleEntityNotFound(_0x2108f6,null))['then'](respondWithResult(_0x2108f6,0xc9))[_0x9861('0x41')](handleError(_0x2108f6,null));};exports[_0x9861('0x6a')]=function(_0x478f83,_0x326930,_0x2f933b){return db[_0x9861('0x49')][_0x9861('0x4a')](function(_0xc3a6bc){var _0x2c65a9;return db[_0x9861('0x2a')]['findOne']({'where':{'id':_0x478f83[_0x9861('0x43')]['id']}})['then'](handleEntityNotFound(_0x326930,null))['then'](function(_0x4f8d33){if(_0x4f8d33){_0x2c65a9=_0x4f8d33;return _0x4f8d33['removeSound'](_0x478f83['params'][_0x9861('0x6b')]);}})[_0x9861('0x21')](function(_0x303fe1){if(_0x303fe1){return db[_0x9861('0x5f')][_0x9861('0x60')]({'where':{'id':_0x478f83['params']['id2']},'attributes':['id',_0x9861('0x27'),'save_name',_0x9861('0x67'),_0x9861('0x61')],'raw':!![]});}})[_0x9861('0x21')](function(_0x99207){if(_0x99207){fs[_0x9861('0x6c')](path[_0x9861('0x5a')](_0x2c65a9[_0x9861('0x4c')],util[_0x9861('0x68')](_0x9861('0x63'),_0x99207[_0x9861('0x27')],_0x99207[_0x9861('0x67')])));return _0x99207;}})[_0x9861('0x41')](function(_0x3d5e73){throw new db[(_0x9861('0x5b'))][(_0x9861('0x5c'))](_0x3d5e73[_0x9861('0x5d')]);});})['then'](handleEntityNotFound(_0x326930,null))['then'](respondWithStatusCode(_0x326930,0xcc))['catch'](handleError(_0x326930,null));};exports[_0x9861('0x6d')]=function(_0x21320e,_0x5b77d2,_0x2a787f){var _0x1a52f6={};var _0x3f77e1={};var _0xb58d54;var _0x1cc774;return db[_0x9861('0x2a')][_0x9861('0x60')]({'where':{'id':_0x21320e['params']['id']}})[_0x9861('0x21')](handleEntityNotFound(_0x5b77d2,null))[_0x9861('0x21')](function(_0x4210c2){if(_0x4210c2){_0xb58d54=_0x4210c2;_0x3f77e1[_0x9861('0x2e')]=_[_0x9861('0x44')](db[_0x9861('0x5f')][_0x9861('0x2b')]);_0x3f77e1[_0x9861('0x2f')]=_['keys'](_0x21320e[_0x9861('0x2f')]);_0x3f77e1[_0x9861('0x30')]=_[_0x9861('0x32')](_0x3f77e1['model'],_0x3f77e1['query']);_0x1a52f6[_0x9861('0x31')]=_['intersection'](_0x3f77e1[_0x9861('0x2e')],qs[_0x9861('0x33')](_0x21320e[_0x9861('0x2f')][_0x9861('0x33')]));_0x1a52f6[_0x9861('0x31')]=_0x1a52f6['attributes'][_0x9861('0x45')]?_0x1a52f6[_0x9861('0x31')]:_0x3f77e1['model'];_0x1a52f6['order']=qs[_0x9861('0x36')](_0x21320e[_0x9861('0x2f')][_0x9861('0x36')]);_0x1a52f6['where']=qs[_0x9861('0x30')](_['pick'](_0x21320e['query'],_0x3f77e1[_0x9861('0x30')]));if(_0x21320e[_0x9861('0x2f')][_0x9861('0x6e')]){_0x1a52f6[_0x9861('0x38')]=_[_0x9861('0x39')](_0x1a52f6[_0x9861('0x38')],{'$or':_[_0x9861('0x29')](_0x1a52f6[_0x9861('0x31')],function(_0x17668d){var _0x4edf4e={};_0x4edf4e[_0x17668d]={'$like':'%'+_0x21320e[_0x9861('0x2f')]['filter']+'%'};return _0x4edf4e;})});}_0x1a52f6=_[_0x9861('0x39')]({},_0x1a52f6,_0x21320e['options']);return _0xb58d54[_0x9861('0x6d')](_0x1a52f6);}})[_0x9861('0x21')](function(_0x5f13c5){if(_0x5f13c5){_0x1cc774=_0x5f13c5[_0x9861('0x45')];if(!_0x21320e['query']['hasOwnProperty'](_0x9861('0x35'))){_0x1a52f6[_0x9861('0x1c')]=qs['limit'](_0x21320e['query'][_0x9861('0x1c')]);_0x1a52f6['offset']=qs[_0x9861('0x1b')](_0x21320e[_0x9861('0x2f')][_0x9861('0x1b')]);}return _0xb58d54[_0x9861('0x6d')](_0x1a52f6);}})[_0x9861('0x21')](function(_0x1e9908){if(_0x1e9908){return _0x1e9908?{'count':_0x1cc774,'rows':_0x1e9908}:null;}})['then'](respondWithResult(_0x5b77d2,null))[_0x9861('0x41')](handleError(_0x5b77d2,null));}; \ No newline at end of file +var _0x8b90=['0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','unlinkSync','rmdirSync','Sequelize','message','addSound','Sound','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','save_name','extname','symlinkSync','ValidationError','removeSound','findOne','getSounds','sort','pick','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','set','Content-Range','json','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','index','map','VoiceMusicOnHold','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','where','filter','merge','options','include','findAll','rows','catch','params','rawAttributes','includeAll','body','find','create','sequelize','transaction','mode','directory','join','root','server/files/moh','files','mkdirSync'];(function(_0x351bdf,_0x159510){var _0x46e630=function(_0x4c7664){while(--_0x4c7664){_0x351bdf['push'](_0x351bdf['shift']());}};_0x46e630(++_0x159510);}(_0x8b90,0x16e));var _0x08b9=function(_0x47a8c0,_0x4d5931){_0x47a8c0=_0x47a8c0-0x0;var _0x551fa1=_0x8b90[_0x47a8c0];return _0x551fa1;};'use strict';var pdf=require(_0x08b9('0x0'));var emlformat=require(_0x08b9('0x1'));var rimraf=require(_0x08b9('0x2'));var zipdir=require(_0x08b9('0x3'));var jsonpatch=require(_0x08b9('0x4'));var rp=require(_0x08b9('0x5'));var moment=require(_0x08b9('0x6'));var BPromise=require(_0x08b9('0x7'));var Mustache=require(_0x08b9('0x8'));var util=require(_0x08b9('0x9'));var path=require('path');var sox=require(_0x08b9('0xa'));var csv=require('to-csv');var ejs=require(_0x08b9('0xb'));var fs=require('fs');var _=require(_0x08b9('0xc'));var squel=require(_0x08b9('0xd'));var crypto=require(_0x08b9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x08b9('0xf'));var toCsv=require(_0x08b9('0x10'));var querystring=require(_0x08b9('0x11'));var Papa=require(_0x08b9('0x12'));var Redis=require('ioredis');var authService=require(_0x08b9('0x13'));var qs=require(_0x08b9('0x14'));var as=require(_0x08b9('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x08b9('0x16'));var utils=require(_0x08b9('0x17'));var config=require(_0x08b9('0x18'));var licenseUtil=require(_0x08b9('0x19'));var db=require(_0x08b9('0x1a'))['db'];function respondWithStatusCode(_0x1a7d71,_0x260893){_0x260893=_0x260893||0xcc;return function(_0x485e44){if(_0x485e44){return _0x1a7d71[_0x08b9('0x1b')](_0x260893);}return _0x1a7d71['status'](_0x260893)[_0x08b9('0x1c')]();};}function respondWithResult(_0x31d07d,_0x1b482b){_0x1b482b=_0x1b482b||0xc8;return function(_0x377e11){if(_0x377e11){return _0x31d07d[_0x08b9('0x1d')](_0x1b482b)['json'](_0x377e11);}};}function respondWithFilteredResult(_0x15fb85,_0x6a4ef){return function(_0x122762){if(_0x122762){var _0x32c2b9=_0x122762[_0x08b9('0x1e')],_0x1cf1f1=_0x6a4ef[_0x08b9('0x1f')],_0xeec74d=_0x6a4ef[_0x08b9('0x1f')]+_0x6a4ef['limit'],_0x2658e3;if(_0xeec74d>=_0x32c2b9){_0xeec74d=_0x32c2b9;_0x2658e3=0xc8;}else{_0x2658e3=0xce;}_0x15fb85[_0x08b9('0x1d')](_0x2658e3);return _0x15fb85[_0x08b9('0x20')](_0x08b9('0x21'),_0x1cf1f1+'-'+_0xeec74d+'/'+_0x32c2b9)[_0x08b9('0x22')](_0x122762);}return null;};}function patchUpdates(_0x453f2a){return function(_0x241fff){try{jsonpatch['apply'](_0x241fff,_0x453f2a,!![]);}catch(_0x4544e4){return BPromise[_0x08b9('0x23')](_0x4544e4);}return _0x241fff[_0x08b9('0x24')]();};}function saveUpdates(_0x32712d,_0x1fb51b){return function(_0x102a42){if(_0x102a42){return _0x102a42[_0x08b9('0x25')](_0x32712d)[_0x08b9('0x26')](function(_0x3d9a90){return _0x3d9a90;});}return null;};}function removeEntity(_0x236d21,_0x1aa949){return function(_0x1296d9){if(_0x1296d9){return _0x1296d9[_0x08b9('0x27')]()[_0x08b9('0x26')](function(){var _0x302f95=_0x1296d9[_0x08b9('0x28')]({'plain':!![]});var _0x5edba7=_0x08b9('0x29');return db[_0x08b9('0x2a')][_0x08b9('0x27')]({'where':{'type':_0x5edba7,'resourceId':_0x302f95['id']}})[_0x08b9('0x26')](function(){return _0x1296d9;});})[_0x08b9('0x26')](function(){_0x236d21[_0x08b9('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x399be4,_0xadd222){return function(_0x510445){if(!_0x510445){_0x399be4[_0x08b9('0x1b')](0x194);}return _0x510445;};}function handleError(_0x338d6f,_0x2cf52c){_0x2cf52c=_0x2cf52c||0x1f4;return function(_0x4a3dd4){logger[_0x08b9('0x2b')](_0x4a3dd4[_0x08b9('0x2c')]);if(_0x4a3dd4[_0x08b9('0x2d')]){delete _0x4a3dd4[_0x08b9('0x2d')];}_0x338d6f[_0x08b9('0x1d')](_0x2cf52c)['send'](_0x4a3dd4);};}exports[_0x08b9('0x2e')]=function(_0x56ddfb,_0x57f174){var _0x7980ad={},_0x56f543={},_0x46302e={'count':0x0,'rows':[]};var _0x201a96=_[_0x08b9('0x2f')](db[_0x08b9('0x30')]['rawAttributes'],function(_0x6072a6){return{'name':_0x6072a6[_0x08b9('0x31')],'type':_0x6072a6[_0x08b9('0x32')][_0x08b9('0x33')]};});_0x56f543[_0x08b9('0x34')]=_['map'](_0x201a96,'name');_0x56f543[_0x08b9('0x35')]=_[_0x08b9('0x36')](_0x56ddfb[_0x08b9('0x35')]);_0x56f543[_0x08b9('0x37')]=_[_0x08b9('0x38')](_0x56f543[_0x08b9('0x34')],_0x56f543[_0x08b9('0x35')]);_0x7980ad[_0x08b9('0x39')]=_['intersection'](_0x56f543[_0x08b9('0x34')],qs[_0x08b9('0x3a')](_0x56ddfb[_0x08b9('0x35')][_0x08b9('0x3a')]));_0x7980ad[_0x08b9('0x39')]=_0x7980ad[_0x08b9('0x39')][_0x08b9('0x3b')]?_0x7980ad[_0x08b9('0x39')]:_0x56f543['model'];if(!_0x56ddfb[_0x08b9('0x35')][_0x08b9('0x3c')](_0x08b9('0x3d'))){_0x7980ad[_0x08b9('0x3e')]=qs[_0x08b9('0x3e')](_0x56ddfb[_0x08b9('0x35')]['limit']);_0x7980ad['offset']=qs[_0x08b9('0x1f')](_0x56ddfb['query'][_0x08b9('0x1f')]);}_0x7980ad['order']=qs['sort'](_0x56ddfb[_0x08b9('0x35')]['sort']);_0x7980ad[_0x08b9('0x3f')]=qs['filters'](_['pick'](_0x56ddfb['query'],_0x56f543[_0x08b9('0x37')]),_0x201a96);if(_0x56ddfb[_0x08b9('0x35')][_0x08b9('0x40')]){_0x7980ad[_0x08b9('0x3f')]=_[_0x08b9('0x41')](_0x7980ad[_0x08b9('0x3f')],{'$or':_[_0x08b9('0x2f')](_0x201a96,function(_0xe770dd){if(_0xe770dd['type']!=='VIRTUAL'){var _0x5e33dd={};_0x5e33dd[_0xe770dd[_0x08b9('0x2d')]]={'$like':'%'+_0x56ddfb['query'][_0x08b9('0x40')]+'%'};return _0x5e33dd;}})});}_0x7980ad=_[_0x08b9('0x41')]({},_0x7980ad,_0x56ddfb[_0x08b9('0x42')]);var _0x273a2b={'where':_0x7980ad[_0x08b9('0x3f')]};return db[_0x08b9('0x30')][_0x08b9('0x1e')](_0x273a2b)[_0x08b9('0x26')](function(_0x199c9d){_0x46302e[_0x08b9('0x1e')]=_0x199c9d;if(_0x56ddfb[_0x08b9('0x35')]['includeAll']){_0x7980ad[_0x08b9('0x43')]=[{'all':!![]}];}return db[_0x08b9('0x30')][_0x08b9('0x44')](_0x7980ad);})[_0x08b9('0x26')](function(_0x54d4b1){_0x46302e[_0x08b9('0x45')]=_0x54d4b1;return _0x46302e;})[_0x08b9('0x26')](respondWithFilteredResult(_0x57f174,_0x7980ad))[_0x08b9('0x46')](handleError(_0x57f174,null));};exports['show']=function(_0x19db86,_0x22f287){var _0x56b95b={'raw':![],'where':{'id':_0x19db86[_0x08b9('0x47')]['id']}},_0x3f9849={};_0x3f9849[_0x08b9('0x34')]=_[_0x08b9('0x36')](db[_0x08b9('0x30')][_0x08b9('0x48')]);_0x3f9849[_0x08b9('0x35')]=_['keys'](_0x19db86[_0x08b9('0x35')]);_0x3f9849[_0x08b9('0x37')]=_[_0x08b9('0x38')](_0x3f9849[_0x08b9('0x34')],_0x3f9849[_0x08b9('0x35')]);_0x56b95b[_0x08b9('0x39')]=_[_0x08b9('0x38')](_0x3f9849['model'],qs['fields'](_0x19db86[_0x08b9('0x35')][_0x08b9('0x3a')]));_0x56b95b['attributes']=_0x56b95b[_0x08b9('0x39')][_0x08b9('0x3b')]?_0x56b95b[_0x08b9('0x39')]:_0x3f9849[_0x08b9('0x34')];if(_0x19db86['query'][_0x08b9('0x49')]){_0x56b95b[_0x08b9('0x43')]=[{'all':!![]}];}_0x56b95b=_[_0x08b9('0x41')]({},_0x56b95b,_0x19db86[_0x08b9('0x42')]);return db[_0x08b9('0x30')]['find'](_0x56b95b)[_0x08b9('0x26')](handleEntityNotFound(_0x22f287,null))[_0x08b9('0x26')](respondWithResult(_0x22f287,null))['catch'](handleError(_0x22f287,null));};exports[_0x08b9('0x25')]=function(_0x1d608d,_0x2d9d6b){if(_0x1d608d[_0x08b9('0x4a')]['id']){delete _0x1d608d[_0x08b9('0x4a')]['id'];}return db[_0x08b9('0x30')][_0x08b9('0x4b')]({'where':{'id':_0x1d608d[_0x08b9('0x47')]['id']}})[_0x08b9('0x26')](handleEntityNotFound(_0x2d9d6b,null))[_0x08b9('0x26')](saveUpdates(_0x1d608d[_0x08b9('0x4a')],null))['then'](respondWithResult(_0x2d9d6b,null))[_0x08b9('0x46')](handleError(_0x2d9d6b,null));};exports[_0x08b9('0x4c')]=function(_0x3a1f70,_0xea4a25,_0x3adfb2){return db[_0x08b9('0x4d')][_0x08b9('0x4e')](function(_0x1916bd){if(_0x3a1f70[_0x08b9('0x4a')][_0x08b9('0x4f')]==='files'){_0x3a1f70['body'][_0x08b9('0x50')]=path[_0x08b9('0x51')](config[_0x08b9('0x52')],_0x08b9('0x53'),_0x3a1f70['body'][_0x08b9('0x2d')]);}return db[_0x08b9('0x30')][_0x08b9('0x4c')](_0x3a1f70['body'],{'transaction':_0x1916bd})['then'](function(_0x269a9a){if(_0x3a1f70[_0x08b9('0x4a')][_0x08b9('0x4f')]===_0x08b9('0x54')){fs[_0x08b9('0x55')](_0x269a9a[_0x08b9('0x50')],parseInt(_0x08b9('0x56'),0x8));}var _0x2aefe0=_0x3a1f70[_0x08b9('0x57')]['get']({'plain':!![]});if(!_0x2aefe0)throw new Error(_0x08b9('0x58'));if(_0x2aefe0['role']===_0x08b9('0x57')){var _0x1bb5b7=_0x269a9a[_0x08b9('0x28')]({'plain':!![]});return db[_0x08b9('0x59')][_0x08b9('0x4b')]({'where':{'name':_0x08b9('0x29'),'userProfileId':_0x2aefe0[_0x08b9('0x5a')]},'raw':!![]})[_0x08b9('0x26')](function(_0x23d4fa){if(_0x23d4fa&&_0x23d4fa[_0x08b9('0x5b')]===0x0){return db[_0x08b9('0x2a')][_0x08b9('0x4c')]({'name':_0x1bb5b7['name'],'resourceId':_0x1bb5b7['id'],'type':_0x23d4fa['name'],'sectionId':_0x23d4fa['id']},{})['then'](function(){return _0x269a9a;});}else{return _0x269a9a;}})[_0x08b9('0x46')](function(_0x3bb815){logger[_0x08b9('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3bb815);});}return _0x269a9a;});})[_0x08b9('0x26')](respondWithResult(_0xea4a25,0xc9))[_0x08b9('0x46')](handleError(_0xea4a25,null));};exports[_0x08b9('0x27')]=function(_0x3d72a3,_0x5a97e4,_0x7e6786){var _0x2c4932;return db[_0x08b9('0x30')][_0x08b9('0x4b')]({'where':{'id':_0x3d72a3[_0x08b9('0x47')]['id']}})[_0x08b9('0x26')](function(_0x39ed9a){if(_0x39ed9a){return db[_0x08b9('0x4d')][_0x08b9('0x4e')](function(_0x26e5e2){return _0x39ed9a['destroy']({'transaction':_0x26e5e2,'raw':!![]})['then'](function(_0x3621c1){if(_0x3621c1[_0x08b9('0x50')]){fs['readdirSync'](_0x3621c1[_0x08b9('0x50')])['forEach'](function(_0x17d4dd){fs[_0x08b9('0x5c')](path[_0x08b9('0x51')](_0x3621c1[_0x08b9('0x50')],_0x17d4dd));});fs[_0x08b9('0x5d')](_0x3621c1[_0x08b9('0x50')]);}return _0x3621c1;});})[_0x08b9('0x46')](function(_0xaa6a9a){throw new db[(_0x08b9('0x5e'))]['ValidationError'](_0xaa6a9a[_0x08b9('0x5f')]);});}})[_0x08b9('0x26')](handleEntityNotFound(_0x5a97e4,null))['then'](removeEntity(_0x5a97e4,null))[_0x08b9('0x46')](handleError(_0x5a97e4,null));};exports['addSound']=function(_0x47f488,_0x4f63b2,_0x3761e1){return db[_0x08b9('0x4d')][_0x08b9('0x4e')](function(_0x58ed36){var _0x43bdf7;return db[_0x08b9('0x30')]['find']({'where':{'id':_0x47f488[_0x08b9('0x47')]['id']}})[_0x08b9('0x26')](function(_0x5e5083){if(_0x5e5083){_0x43bdf7=_0x5e5083;return _0x5e5083[_0x08b9('0x60')](_0x47f488[_0x08b9('0x4a')]['id'],{'transaction':_0x58ed36});}})[_0x08b9('0x26')](function(_0x38ebe1){if(_0x38ebe1){return db[_0x08b9('0x61')]['findOne']({'where':{'id':_0x47f488['body']['id']},'attributes':['id',_0x08b9('0x2d'),'save_name',_0x08b9('0x62'),_0x08b9('0x63')],'raw':!![]});}})[_0x08b9('0x26')](function(_0x13790f){if(_0x13790f){var _0x2cefed=path[_0x08b9('0x51')](config[_0x08b9('0x52')],_0x08b9('0x64'),util[_0x08b9('0x65')](_0x08b9('0x66'),path[_0x08b9('0x67')](_0x13790f[_0x08b9('0x68')],path[_0x08b9('0x69')](_0x13790f[_0x08b9('0x68')])),_0x13790f[_0x08b9('0x62')]));var _0x4f48d4=path[_0x08b9('0x51')](config['root'],_0x08b9('0x53'),_0x43bdf7[_0x08b9('0x2d')],util[_0x08b9('0x65')](_0x08b9('0x66'),_0x13790f[_0x08b9('0x2d')],_0x13790f[_0x08b9('0x62')]));fs[_0x08b9('0x6a')](_0x2cefed,_0x4f48d4);return _0x13790f;}})[_0x08b9('0x46')](function(_0x5711c1){throw new db[(_0x08b9('0x5e'))][(_0x08b9('0x6b'))](_0x5711c1[_0x08b9('0x5f')]);});})[_0x08b9('0x26')](handleEntityNotFound(_0x4f63b2,null))[_0x08b9('0x26')](respondWithResult(_0x4f63b2,0xc9))['catch'](handleError(_0x4f63b2,null));};exports[_0x08b9('0x6c')]=function(_0x123c15,_0x2d6d5d,_0x32647b){return db['sequelize'][_0x08b9('0x4e')](function(_0x1788f7){var _0x13e998;return db[_0x08b9('0x30')][_0x08b9('0x6d')]({'where':{'id':_0x123c15[_0x08b9('0x47')]['id']}})[_0x08b9('0x26')](handleEntityNotFound(_0x2d6d5d,null))[_0x08b9('0x26')](function(_0x207b47){if(_0x207b47){_0x13e998=_0x207b47;return _0x207b47[_0x08b9('0x6c')](_0x123c15[_0x08b9('0x47')]['id2']);}})['then'](function(_0x346b21){if(_0x346b21){return db[_0x08b9('0x61')][_0x08b9('0x6d')]({'where':{'id':_0x123c15[_0x08b9('0x47')]['id2']},'attributes':['id','name','save_name','converted_format',_0x08b9('0x63')],'raw':!![]});}})[_0x08b9('0x26')](function(_0x2f475b){if(_0x2f475b){fs[_0x08b9('0x5c')](path[_0x08b9('0x51')](_0x13e998[_0x08b9('0x50')],util[_0x08b9('0x65')](_0x08b9('0x66'),_0x2f475b['name'],_0x2f475b[_0x08b9('0x62')])));return _0x2f475b;}})[_0x08b9('0x46')](function(_0x625fdd){throw new db['Sequelize'][(_0x08b9('0x6b'))](_0x625fdd[_0x08b9('0x5f')]);});})['then'](handleEntityNotFound(_0x2d6d5d,null))[_0x08b9('0x26')](respondWithStatusCode(_0x2d6d5d,0xcc))[_0x08b9('0x46')](handleError(_0x2d6d5d,null));};exports[_0x08b9('0x6e')]=function(_0x5ad0a7,_0x4b4cda,_0x683720){var _0x19fbab={};var _0x3ec902={};var _0x172ca8;var _0x16b981;return db[_0x08b9('0x30')]['findOne']({'where':{'id':_0x5ad0a7[_0x08b9('0x47')]['id']}})[_0x08b9('0x26')](handleEntityNotFound(_0x4b4cda,null))[_0x08b9('0x26')](function(_0x2c7461){if(_0x2c7461){_0x172ca8=_0x2c7461;_0x3ec902['model']=_[_0x08b9('0x36')](db[_0x08b9('0x61')][_0x08b9('0x48')]);_0x3ec902['query']=_[_0x08b9('0x36')](_0x5ad0a7[_0x08b9('0x35')]);_0x3ec902['filters']=_[_0x08b9('0x38')](_0x3ec902[_0x08b9('0x34')],_0x3ec902[_0x08b9('0x35')]);_0x19fbab[_0x08b9('0x39')]=_[_0x08b9('0x38')](_0x3ec902['model'],qs['fields'](_0x5ad0a7[_0x08b9('0x35')][_0x08b9('0x3a')]));_0x19fbab[_0x08b9('0x39')]=_0x19fbab[_0x08b9('0x39')]['length']?_0x19fbab[_0x08b9('0x39')]:_0x3ec902[_0x08b9('0x34')];_0x19fbab['order']=qs[_0x08b9('0x6f')](_0x5ad0a7[_0x08b9('0x35')][_0x08b9('0x6f')]);_0x19fbab[_0x08b9('0x3f')]=qs[_0x08b9('0x37')](_[_0x08b9('0x70')](_0x5ad0a7['query'],_0x3ec902[_0x08b9('0x37')]));if(_0x5ad0a7[_0x08b9('0x35')][_0x08b9('0x40')]){_0x19fbab['where']=_[_0x08b9('0x41')](_0x19fbab[_0x08b9('0x3f')],{'$or':_['map'](_0x19fbab['attributes'],function(_0x1a0f89){var _0x1f9818={};_0x1f9818[_0x1a0f89]={'$like':'%'+_0x5ad0a7[_0x08b9('0x35')][_0x08b9('0x40')]+'%'};return _0x1f9818;})});}_0x19fbab=_[_0x08b9('0x41')]({},_0x19fbab,_0x5ad0a7['options']);return _0x172ca8[_0x08b9('0x6e')](_0x19fbab);}})['then'](function(_0x317a66){if(_0x317a66){_0x16b981=_0x317a66['length'];if(!_0x5ad0a7['query'][_0x08b9('0x3c')](_0x08b9('0x3d'))){_0x19fbab[_0x08b9('0x3e')]=qs[_0x08b9('0x3e')](_0x5ad0a7[_0x08b9('0x35')]['limit']);_0x19fbab[_0x08b9('0x1f')]=qs[_0x08b9('0x1f')](_0x5ad0a7[_0x08b9('0x35')][_0x08b9('0x1f')]);}return _0x172ca8[_0x08b9('0x6e')](_0x19fbab);}})[_0x08b9('0x26')](function(_0x2b8d71){if(_0x2b8d71){return _0x2b8d71?{'count':_0x16b981,'rows':_0x2b8d71}:null;}})[_0x08b9('0x26')](respondWithResult(_0x4b4cda,null))[_0x08b9('0x46')](handleError(_0x4b4cda,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 47ae2da..316db3f 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 _0x2359=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','lodash','../../config/logger','api','moment'];(function(_0x2e322a,_0xd4f6c2){var _0x509a65=function(_0x1135ed){while(--_0x1135ed){_0x2e322a['push'](_0x2e322a['shift']());}};_0x509a65(++_0xd4f6c2);}(_0x2359,0x1c3));var _0x9235=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x2359[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x9235('0x0'));var util=require('util');var logger=require(_0x9235('0x1'))(_0x9235('0x2'));var moment=require(_0x9235('0x3'));var BPromise=require(_0x9235('0x4'));var rp=require(_0x9235('0x5'));var fs=require('fs');var path=require(_0x9235('0x6'));var rimraf=require(_0x9235('0x7'));var config=require(_0x9235('0x8'));var attributes=require(_0x9235('0x9'));module[_0x9235('0xa')]=function(_0x286030,_0x147444){return _0x286030[_0x9235('0xb')](_0x9235('0xc'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b32=['path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','voice_musiconhold','lodash','moment','bluebird','request-promise'];(function(_0x5af050,_0x17fa68){var _0x29ffcd=function(_0x215f09){while(--_0x215f09){_0x5af050['push'](_0x5af050['shift']());}};_0x29ffcd(++_0x17fa68);}(_0x0b32,0x96));var _0x20b3=function(_0x4c8c79,_0x143d62){_0x4c8c79=_0x4c8c79-0x0;var _0x48e51c=_0x0b32[_0x4c8c79];return _0x48e51c;};'use strict';var _=require(_0x20b3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x20b3('0x1'));var BPromise=require(_0x20b3('0x2'));var rp=require(_0x20b3('0x3'));var fs=require('fs');var path=require(_0x20b3('0x4'));var rimraf=require(_0x20b3('0x5'));var config=require(_0x20b3('0x6'));var attributes=require(_0x20b3('0x7'));module['exports']=function(_0xa54bf3,_0x4abfd3){return _0xa54bf3[_0x20b3('0x8')](_0x20b3('0x9'),attributes,{'tableName':_0x20b3('0xa'),'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 4947c96..c91b4c6 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 _0x4e79=['request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','error','message','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4c53db,_0x361d7f){var _0x464b17=function(_0x731b3e){while(--_0x731b3e){_0x4c53db['push'](_0x4c53db['shift']());}};_0x464b17(++_0x361d7f);}(_0x4e79,0xff));var _0x94e7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4e79[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x94e7('0x0'));var util=require(_0x94e7('0x1'));var moment=require(_0x94e7('0x2'));var BPromise=require(_0x94e7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x94e7('0x4'));var logger=require(_0x94e7('0x5'))(_0x94e7('0x6'));var config=require(_0x94e7('0x7'));var jayson=require(_0x94e7('0x8'));var client=jayson[_0x94e7('0x9')][_0x94e7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e6760,_0x5a2af6,_0x45e23c){return new BPromise(function(_0x13ac18,_0x4d01ca){return client[_0x94e7('0xb')](_0x2e6760,_0x45e23c)[_0x94e7('0xc')](function(_0x434151){logger[_0x94e7('0xd')](_0x94e7('0xe'),_0x5a2af6,_0x94e7('0xf'));logger['debug']('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x5a2af6,_0x94e7('0xf'),JSON['stringify'](_0x434151));if(_0x434151['error']){if(_0x434151[_0x94e7('0x10')]['code']===0x1f4){logger[_0x94e7('0x10')](_0x94e7('0xe'),_0x5a2af6,_0x434151['error']['message']);return _0x4d01ca(_0x434151[_0x94e7('0x10')]['message']);}logger[_0x94e7('0x10')](_0x94e7('0xe'),_0x5a2af6,_0x434151[_0x94e7('0x10')]['message']);return _0x13ac18(_0x434151[_0x94e7('0x10')][_0x94e7('0x11')]);}else{logger[_0x94e7('0xd')](_0x94e7('0xe'),_0x5a2af6,'request\x20sent');_0x13ac18(_0x434151['result'][_0x94e7('0x11')]);}})[_0x94e7('0x12')](function(_0x26e431){logger[_0x94e7('0x10')](_0x94e7('0xe'),_0x5a2af6,_0x26e431);_0x4d01ca(_0x26e431);});});} \ No newline at end of file +var _0x93dc=['util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3d6a65,_0x565a17){var _0x492910=function(_0x4f1b27){while(--_0x4f1b27){_0x3d6a65['push'](_0x3d6a65['shift']());}};_0x492910(++_0x565a17);}(_0x93dc,0x1db));var _0xc93d=function(_0x43e534,_0x23dd38){_0x43e534=_0x43e534-0x0;var _0x4a536c=_0x93dc[_0x43e534];return _0x4a536c;};'use strict';var _=require('lodash');var util=require(_0xc93d('0x0'));var moment=require(_0xc93d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc93d('0x2'));var db=require(_0xc93d('0x3'))['db'];var utils=require(_0xc93d('0x4'));var logger=require('../../config/logger')(_0xc93d('0x5'));var config=require(_0xc93d('0x6'));var jayson=require(_0xc93d('0x7'));var client=jayson[_0xc93d('0x8')][_0xc93d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x399cab,_0x5b5905,_0x333783){return new BPromise(function(_0x140465,_0x26b4c1){return client['request'](_0x399cab,_0x333783)[_0xc93d('0xa')](function(_0x1cc174){logger[_0xc93d('0xb')](_0xc93d('0xc'),_0x5b5905,_0xc93d('0xd'));logger['debug'](_0xc93d('0xe'),_0x5b5905,_0xc93d('0xd'),JSON[_0xc93d('0xf')](_0x1cc174));if(_0x1cc174[_0xc93d('0x10')]){if(_0x1cc174[_0xc93d('0x10')][_0xc93d('0x11')]===0x1f4){logger['error'](_0xc93d('0xc'),_0x5b5905,_0x1cc174['error'][_0xc93d('0x12')]);return _0x26b4c1(_0x1cc174['error'][_0xc93d('0x12')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5b5905,_0x1cc174[_0xc93d('0x10')][_0xc93d('0x12')]);return _0x140465(_0x1cc174[_0xc93d('0x10')]['message']);}else{logger[_0xc93d('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5b5905,_0xc93d('0xd'));_0x140465(_0x1cc174['result'][_0xc93d('0x12')]);}})['catch'](function(_0xe6aafc){logger[_0xc93d('0x10')](_0xc93d('0xc'),_0x5b5905,_0xe6aafc);_0x26b4c1(_0xe6aafc);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 3791481..947fbcd 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 _0x6194=['util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/users','getAgents','post','addAgents','put','update','delete','destroy','removeAgents','exports','multer'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x6194,0x1c7));var _0x4619=function(_0x5d6a36,_0xa0fa93){_0x5d6a36=_0x5d6a36-0x0;var _0x5a52c1=_0x6194[_0x5d6a36];return _0x5a52c1;};'use strict';var multer=require(_0x4619('0x0'));var util=require(_0x4619('0x1'));var path=require('path');var timeout=require(_0x4619('0x2'));var express=require(_0x4619('0x3'));var router=express['Router']();var auth=require(_0x4619('0x4'));var interaction=require(_0x4619('0x5'));var config=require(_0x4619('0x6'));var controller=require('./voicePrefix.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4619('0x7')]);router[_0x4619('0x8')](_0x4619('0x9'),auth[_0x4619('0xa')](),controller[_0x4619('0xb')]);router[_0x4619('0x8')](_0x4619('0xc'),auth['isAuthenticated'](),controller[_0x4619('0xd')]);router['get'](_0x4619('0xe'),auth[_0x4619('0xa')](),controller[_0x4619('0xf')]);router[_0x4619('0x10')]('/',auth[_0x4619('0xa')](),controller['create']);router[_0x4619('0x10')](_0x4619('0xe'),auth[_0x4619('0xa')](),controller[_0x4619('0x11')]);router[_0x4619('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x4619('0x13')]);router[_0x4619('0x14')](_0x4619('0xc'),auth[_0x4619('0xa')](),controller[_0x4619('0x15')]);router[_0x4619('0x14')](_0x4619('0xe'),auth[_0x4619('0xa')](),controller[_0x4619('0x16')]);module[_0x4619('0x17')]=router; \ No newline at end of file +var _0x9b11=['removeAgents','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','post','create','addAgents','update','delete'];(function(_0x2669cd,_0x1ab1b3){var _0x56d6da=function(_0x541fbf){while(--_0x541fbf){_0x2669cd['push'](_0x2669cd['shift']());}};_0x56d6da(++_0x1ab1b3);}(_0x9b11,0x1a4));var _0x19b1=function(_0x11f5ff,_0xa0ef18){_0x11f5ff=_0x11f5ff-0x0;var _0x46eefb=_0x9b11[_0x11f5ff];return _0x46eefb;};'use strict';var multer=require(_0x19b1('0x0'));var util=require(_0x19b1('0x1'));var path=require('path');var timeout=require(_0x19b1('0x2'));var express=require('express');var router=express[_0x19b1('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x19b1('0x4'));var config=require(_0x19b1('0x5'));var controller=require(_0x19b1('0x6'));router[_0x19b1('0x7')]('/',auth[_0x19b1('0x8')](),controller[_0x19b1('0x9')]);router[_0x19b1('0x7')](_0x19b1('0xa'),auth['isAuthenticated'](),controller[_0x19b1('0xb')]);router[_0x19b1('0x7')](_0x19b1('0xc'),auth['isAuthenticated'](),controller[_0x19b1('0xd')]);router[_0x19b1('0x7')](_0x19b1('0xe'),auth['isAuthenticated'](),controller['getAgents']);router[_0x19b1('0xf')]('/',auth['isAuthenticated'](),controller[_0x19b1('0x10')]);router[_0x19b1('0xf')]('/:id/users',auth[_0x19b1('0x8')](),controller[_0x19b1('0x11')]);router['put'](_0x19b1('0xc'),auth[_0x19b1('0x8')](),controller[_0x19b1('0x12')]);router[_0x19b1('0x13')](_0x19b1('0xc'),auth[_0x19b1('0x8')](),controller['destroy']);router['delete'](_0x19b1('0xe'),auth[_0x19b1('0x8')](),controller[_0x19b1('0x14')]);module[_0x19b1('0x15')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index b93f16e..dc00574 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 _0xb6e6=['getDataValue','INTEGER','sequelize','STRING','name','VIRTUAL','system-'];(function(_0x58c053,_0x51c43f){var _0xe1079=function(_0x172345){while(--_0x172345){_0x58c053['push'](_0x58c053['shift']());}};_0xe1079(++_0x51c43f);}(_0xb6e6,0xbf));var _0x6b6e=function(_0x51d593,_0x547e60){_0x51d593=_0x51d593-0x0;var _0x1079ec=_0xb6e6[_0x51d593];return _0x1079ec;};'use strict';var Sequelize=require(_0x6b6e('0x0'));module['exports']={'name':{'type':Sequelize[_0x6b6e('0x1')],'allowNull':![],'unique':_0x6b6e('0x2')},'prefix':{'type':Sequelize[_0x6b6e('0x3')],'get':function(_0x43b560){return _0x6b6e('0x4')+this[_0x6b6e('0x5')](_0x6b6e('0x2'))+'-';}},'description':{'type':Sequelize[_0x6b6e('0x1')]},'callerIdAll':{'type':Sequelize[_0x6b6e('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x6b6e('0x6')]}}; \ No newline at end of file +var _0xecf0=['exports','STRING','name','system-','getDataValue','INTEGER','sequelize'];(function(_0x5b5947,_0x11623c){var _0x7623e0=function(_0x40d10e){while(--_0x40d10e){_0x5b5947['push'](_0x5b5947['shift']());}};_0x7623e0(++_0x11623c);}(_0xecf0,0x84));var _0x0ecf=function(_0x50e0c8,_0xbe796a){_0x50e0c8=_0x50e0c8-0x0;var _0x14c315=_0xecf0[_0x50e0c8];return _0x14c315;};'use strict';var Sequelize=require(_0x0ecf('0x0'));module[_0x0ecf('0x1')]={'name':{'type':Sequelize[_0x0ecf('0x2')],'allowNull':![],'unique':_0x0ecf('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x48bc3b){return _0x0ecf('0x4')+this[_0x0ecf('0x5')](_0x0ecf('0x3'))+'-';}},'description':{'type':Sequelize[_0x0ecf('0x2')]},'callerIdAll':{'type':Sequelize[_0x0ecf('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x0ecf('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 5b6b867..c0aa1db 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 _0x04e7=['NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','system-','sequelize','findById','addAgents','body','ids','omit','spread','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','name','send','index','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','VoicePrefix','rows','show','params','keys','length','include','find','catch','describe','create','transaction','VoiceExtension','VoiceExtensionId','user','UserProfileSection','autoAssociation','error','context','from-sip','exten','app','system','Voice\x20Prefix\x20Extension','prefix'];(function(_0x2c0312,_0x2be972){var _0x46222d=function(_0x593c31){while(--_0x593c31){_0x2c0312['push'](_0x2c0312['shift']());}};_0x46222d(++_0x2be972);}(_0x04e7,0x121));var _0x704e=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0x04e7[_0x3e3bee];return _0x3ae14c;};'use strict';var pdf=require(_0x704e('0x0'));var emlformat=require(_0x704e('0x1'));var rimraf=require(_0x704e('0x2'));var zipdir=require(_0x704e('0x3'));var jsonpatch=require(_0x704e('0x4'));var rp=require(_0x704e('0x5'));var moment=require(_0x704e('0x6'));var BPromise=require(_0x704e('0x7'));var Mustache=require(_0x704e('0x8'));var util=require(_0x704e('0x9'));var path=require(_0x704e('0xa'));var sox=require(_0x704e('0xb'));var csv=require('to-csv');var ejs=require(_0x704e('0xc'));var fs=require('fs');var _=require(_0x704e('0xd'));var squel=require(_0x704e('0xe'));var crypto=require(_0x704e('0xf'));var jsforce=require(_0x704e('0x10'));var deskjs=require(_0x704e('0x11'));var toCsv=require(_0x704e('0x12'));var querystring=require(_0x704e('0x13'));var Papa=require(_0x704e('0x14'));var Redis=require(_0x704e('0x15'));var authService=require(_0x704e('0x16'));var qs=require(_0x704e('0x17'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x704e('0x18'));var logger=require(_0x704e('0x19'))(_0x704e('0x1a'));var utils=require(_0x704e('0x1b'));var config=require(_0x704e('0x1c'));var licenseUtil=require(_0x704e('0x1d'));var db=require(_0x704e('0x1e'))['db'];config['redis']=_['defaults'](config[_0x704e('0x1f')],{'host':_0x704e('0x20'),'port':0x18eb});var socket=require(_0x704e('0x21'))(new Redis(config[_0x704e('0x1f')]));require(_0x704e('0x22'))[_0x704e('0x23')](socket);function respondWithStatusCode(_0x2abf61,_0x33a743){_0x33a743=_0x33a743||0xcc;return function(_0x57a907){if(_0x57a907){return _0x2abf61[_0x704e('0x24')](_0x33a743);}return _0x2abf61[_0x704e('0x25')](_0x33a743)[_0x704e('0x26')]();};}function respondWithResult(_0x583cc0,_0x2b203b){_0x2b203b=_0x2b203b||0xc8;return function(_0x35a3e9){if(_0x35a3e9){return _0x583cc0[_0x704e('0x25')](_0x2b203b)['json'](_0x35a3e9);}};}function respondWithFilteredResult(_0x1b347a,_0x1bd0cf){return function(_0x315636){if(_0x315636){var _0x340bde=_0x315636['count'],_0x3d10ba=_0x1bd0cf[_0x704e('0x27')],_0x554c09=_0x1bd0cf['offset']+_0x1bd0cf['limit'],_0x333524;if(_0x554c09>=_0x340bde){_0x554c09=_0x340bde;_0x333524=0xc8;}else{_0x333524=0xce;}_0x1b347a['status'](_0x333524);return _0x1b347a[_0x704e('0x28')](_0x704e('0x29'),_0x3d10ba+'-'+_0x554c09+'/'+_0x340bde)[_0x704e('0x2a')](_0x315636);}return null;};}function patchUpdates(_0x5f1a62){return function(_0x4a785a){try{jsonpatch[_0x704e('0x2b')](_0x4a785a,_0x5f1a62,!![]);}catch(_0x152ad8){return BPromise[_0x704e('0x2c')](_0x152ad8);}return _0x4a785a[_0x704e('0x2d')]();};}function saveUpdates(_0x418322,_0x3cafe7){return function(_0x30a391){if(_0x30a391){return _0x30a391[_0x704e('0x2e')](_0x418322)[_0x704e('0x2f')](function(_0x269113){return _0x269113;});}return null;};}function removeEntity(_0x1a46be,_0x5554d0){return function(_0x5cae04){if(_0x5cae04){return _0x5cae04[_0x704e('0x30')]()[_0x704e('0x2f')](function(){var _0x4130ad=_0x5cae04[_0x704e('0x31')]({'plain':!![]});var _0x36b851=_0x704e('0x32');return db[_0x704e('0x33')][_0x704e('0x30')]({'where':{'type':_0x36b851,'resourceId':_0x4130ad['id']}})['then'](function(){return _0x5cae04;});})[_0x704e('0x2f')](function(){_0x1a46be[_0x704e('0x25')](0xcc)[_0x704e('0x26')]();});}};}function handleEntityNotFound(_0x50d3ab,_0x3b2b13){return function(_0x510a70){if(!_0x510a70){_0x50d3ab[_0x704e('0x24')](0x194);}return _0x510a70;};}function handleError(_0x123e61,_0x39e535){_0x39e535=_0x39e535||0x1f4;return function(_0x395e7){logger['error'](_0x395e7['stack']);if(_0x395e7[_0x704e('0x34')]){delete _0x395e7['name'];}_0x123e61['status'](_0x39e535)[_0x704e('0x35')](_0x395e7);};}exports[_0x704e('0x36')]=function(_0x31a04b,_0x3b430c){var _0x3ed2ae={},_0x5cc6f5={},_0x5737d0={'count':0x0,'rows':[]};var _0x29738d=_['map'](db['VoicePrefix'][_0x704e('0x37')],function(_0xe57be){return{'name':_0xe57be[_0x704e('0x38')],'type':_0xe57be[_0x704e('0x39')][_0x704e('0x3a')]};});_0x5cc6f5[_0x704e('0x3b')]=_[_0x704e('0x3c')](_0x29738d,'name');_0x5cc6f5[_0x704e('0x3d')]=_['keys'](_0x31a04b[_0x704e('0x3d')]);_0x5cc6f5['filters']=_[_0x704e('0x3e')](_0x5cc6f5[_0x704e('0x3b')],_0x5cc6f5[_0x704e('0x3d')]);_0x3ed2ae[_0x704e('0x3f')]=_[_0x704e('0x3e')](_0x5cc6f5[_0x704e('0x3b')],qs[_0x704e('0x40')](_0x31a04b[_0x704e('0x3d')][_0x704e('0x40')]));_0x3ed2ae['attributes']=_0x3ed2ae[_0x704e('0x3f')]['length']?_0x3ed2ae[_0x704e('0x3f')]:_0x5cc6f5['model'];if(!_0x31a04b['query'][_0x704e('0x41')](_0x704e('0x42'))){_0x3ed2ae['limit']=qs[_0x704e('0x43')](_0x31a04b['query'][_0x704e('0x43')]);_0x3ed2ae[_0x704e('0x27')]=qs[_0x704e('0x27')](_0x31a04b['query'][_0x704e('0x27')]);}_0x3ed2ae[_0x704e('0x44')]=qs[_0x704e('0x45')](_0x31a04b[_0x704e('0x3d')][_0x704e('0x45')]);_0x3ed2ae[_0x704e('0x46')]=qs[_0x704e('0x47')](_[_0x704e('0x48')](_0x31a04b[_0x704e('0x3d')],_0x5cc6f5['filters']),_0x29738d);if(_0x31a04b['query'][_0x704e('0x49')]){_0x3ed2ae[_0x704e('0x46')]=_[_0x704e('0x4a')](_0x3ed2ae['where'],{'$or':_[_0x704e('0x3c')](_0x29738d,function(_0x264049){if(_0x264049[_0x704e('0x39')]!==_0x704e('0x4b')){var _0x152acf={};_0x152acf[_0x264049[_0x704e('0x34')]]={'$like':'%'+_0x31a04b[_0x704e('0x3d')][_0x704e('0x49')]+'%'};return _0x152acf;}})});}_0x3ed2ae=_['merge']({},_0x3ed2ae,_0x31a04b[_0x704e('0x4c')]);var _0x19cdb2={'where':_0x3ed2ae[_0x704e('0x46')]};return db['VoicePrefix']['count'](_0x19cdb2)[_0x704e('0x2f')](function(_0x2f2a49){_0x5737d0[_0x704e('0x4d')]=_0x2f2a49;if(_0x31a04b[_0x704e('0x3d')][_0x704e('0x4e')]){_0x3ed2ae['include']=[{'all':!![]}];}return db[_0x704e('0x4f')]['findAll'](_0x3ed2ae);})['then'](function(_0x55f03a){_0x5737d0[_0x704e('0x50')]=_0x55f03a;return _0x5737d0;})[_0x704e('0x2f')](respondWithFilteredResult(_0x3b430c,_0x3ed2ae))['catch'](handleError(_0x3b430c,null));};exports[_0x704e('0x51')]=function(_0xf2bfdb,_0xe6df5e){var _0x7c1129={'raw':![],'where':{'id':_0xf2bfdb[_0x704e('0x52')]['id']}},_0x3123ef={};_0x3123ef['model']=_[_0x704e('0x53')](db[_0x704e('0x4f')][_0x704e('0x37')]);_0x3123ef[_0x704e('0x3d')]=_[_0x704e('0x53')](_0xf2bfdb[_0x704e('0x3d')]);_0x3123ef[_0x704e('0x47')]=_[_0x704e('0x3e')](_0x3123ef['model'],_0x3123ef[_0x704e('0x3d')]);_0x7c1129[_0x704e('0x3f')]=_['intersection'](_0x3123ef[_0x704e('0x3b')],qs[_0x704e('0x40')](_0xf2bfdb[_0x704e('0x3d')][_0x704e('0x40')]));_0x7c1129[_0x704e('0x3f')]=_0x7c1129[_0x704e('0x3f')][_0x704e('0x54')]?_0x7c1129[_0x704e('0x3f')]:_0x3123ef['model'];if(_0xf2bfdb['query'][_0x704e('0x4e')]){_0x7c1129[_0x704e('0x55')]=[{'all':!![]}];}_0x7c1129=_['merge']({},_0x7c1129,_0xf2bfdb['options']);return db[_0x704e('0x4f')][_0x704e('0x56')](_0x7c1129)[_0x704e('0x2f')](handleEntityNotFound(_0xe6df5e,null))[_0x704e('0x2f')](respondWithResult(_0xe6df5e,null))[_0x704e('0x57')](handleError(_0xe6df5e,null));};exports[_0x704e('0x30')]=function(_0x4da19a,_0x1d06e8){return db[_0x704e('0x4f')]['find']({'where':{'id':_0x4da19a[_0x704e('0x52')]['id']}})['then'](handleEntityNotFound(_0x1d06e8,null))['then'](removeEntity(_0x1d06e8,null))[_0x704e('0x57')](handleError(_0x1d06e8,null));};exports[_0x704e('0x58')]=function(_0x4f21b2,_0x1ba5ec){return db[_0x704e('0x4f')]['describe']()[_0x704e('0x2f')](respondWithResult(_0x1ba5ec,null))[_0x704e('0x57')](handleError(_0x1ba5ec,null));};exports[_0x704e('0x59')]=function(_0x1d6c60,_0x15de31){var _0x18fedf;return db['sequelize'][_0x704e('0x5a')](function(_0xc5aa5f){return db[_0x704e('0x4f')][_0x704e('0x59')](_0x1d6c60['body'],{'transaction':_0xc5aa5f})[_0x704e('0x2f')](function(_0xff9801){_0x18fedf=_0xff9801['get']({'plain':!![]});return db[_0x704e('0x5b')][_0x704e('0x56')]({'where':{'id':_0x18fedf[_0x704e('0x5c')]},'raw':!![]})[_0x704e('0x2f')](function(_0x4d275e){return createVoicePrefixExtensions(_0x18fedf,_0x4d275e,_0xc5aa5f);});});})['then'](function(){var _0x41fdc1=_0x1d6c60[_0x704e('0x5d')][_0x704e('0x31')]({'plain':!![]});if(!_0x41fdc1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x41fdc1['role']===_0x704e('0x5d')){var _0x5c0e34=_0x18fedf;return db[_0x704e('0x5e')]['find']({'where':{'name':_0x704e('0x32'),'userProfileId':_0x41fdc1['userProfileId']},'raw':!![]})[_0x704e('0x2f')](function(_0x409706){if(_0x409706&&_0x409706[_0x704e('0x5f')]===0x0){return db['UserProfileResource'][_0x704e('0x59')]({'name':_0x5c0e34['name'],'resourceId':_0x5c0e34['id'],'type':_0x409706['name'],'sectionId':_0x409706['id']},{})[_0x704e('0x2f')](function(){return _0x18fedf;});}else{return _0x18fedf;}})['catch'](function(_0xed2fc1){logger[_0x704e('0x60')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xed2fc1);throw _0xed2fc1;});}return _0x18fedf;})['then'](respondWithResult(_0x15de31,null))[_0x704e('0x57')](handleError(_0x15de31,null));};function Extension(_0x70a17f,_0x334513,_0x3d65d3,_0x353732){this[_0x704e('0x61')]=_0x704e('0x62');this[_0x704e('0x63')]=_0x70a17f;this[_0x704e('0x64')]=_0x3d65d3;this['type']=_0x704e('0x65');this['description']=_0x704e('0x66');this['priority']=_0x334513;this['appdata']=_0x353732;}function createVoicePrefixExtensions(_0x31402c,_0x566654,_0x1ffe0a){return new BPromise(function(_0x260341,_0x58af7f){var _0x5ec2fc=new Extension(formatPrefixName(_0x31402c[_0x704e('0x67')]),0x1,_0x704e('0x68'),_0x704e('0x69'));_0x5ec2fc[_0x704e('0x6a')]=_0x31402c['id'];return db['VoiceExtension']['create'](_0x5ec2fc,{'transaction':_0x1ffe0a})[_0x704e('0x2f')](function(_0x32954e){var _0x52b324=_0x32954e[_0x704e('0x31')]({'plain':!![]});var _0x527f85=_[_0x704e('0x3c')](addVoicePrefixExtensions(_0x31402c,_0x566654),function(_0x28bcc1){_0x28bcc1[_0x704e('0x5c')]=_0x52b324['id'];_0x28bcc1['VoicePrefixId']=_0x31402c['id'];return _0x28bcc1;});return db['VoiceExtension'][_0x704e('0x6b')](_0x527f85,{'transaction':_0x1ffe0a})[_0x704e('0x2f')](function(_0x1b3628){if(!_0x1b3628){return _0x58af7f(_0x704e('0x6c'));}else{return _0x260341(_0x1b3628);}})['catch'](function(_0x1f9eb2){return _0x58af7f(_0x1f9eb2);});});;});};function addVoicePrefixExtensions(_0x197045,_0x4a66e1){var _0x50515c=[];var _0x4e792f=formatPrefixName(_0x197045[_0x704e('0x67')]);_0x50515c[_0x704e('0x6d')](new Extension(_0x4e792f,0x2,_0x704e('0x6e'),_0x704e('0x6f')+_0x197045[_0x704e('0x34')]));if(_0x197045[_0x704e('0x70')]){_0x50515c[_0x704e('0x6d')](new Extension(_0x4e792f,0x3,_0x704e('0x6e'),_0x704e('0x71')+_0x197045[_0x704e('0x70')]));}else{_0x50515c['push'](new Extension(_0x4e792f,0x3,'NoOp',_0x704e('0x72')));}_0x50515c['push'](new Extension(_0x4e792f,0x4,'goto',_0x4a66e1['context']+','+_0x704e('0x73')+(0x8+_0x197045[_0x704e('0x34')][_0x704e('0x54')])+'}'+','+0x1));return _0x50515c;}function formatPrefixName(_0x7ee846){var _0x116efd='_';for(var _0x274a8e=0x0;_0x274a8e<_0x7ee846['length'];_0x274a8e++){if(_0x7ee846[_0x704e('0x74')](_0x274a8e)=='-'){_0x116efd+=_0x7ee846[_0x704e('0x74')](_0x274a8e);}else{_0x116efd+='['+_0x7ee846[_0x704e('0x74')](_0x274a8e)+']';}}_0x116efd+='.';return _0x116efd;}exports['update']=function(_0xc4b3c4,_0x51d070,_0x1d3403){var _0x4574d7=_0xc4b3c4['body'];_0x4574d7[_0x704e('0x67')]=_0x704e('0x75')+_0x4574d7[_0x704e('0x34')]+'-';return db[_0x704e('0x76')][_0x704e('0x5a')](function(_0x4ab4b3){return db['VoicePrefix']['update'](_0x4574d7,{'where':{'id':_0x4574d7['id']},'transaction':_0x4ab4b3})[_0x704e('0x2f')](function(){return db[_0x704e('0x5b')][_0x704e('0x30')]({'where':{'VoicePrefixId':_0x4574d7['id']},'transaction':_0x4ab4b3})[_0x704e('0x2f')](function(){return db['VoiceExtension'][_0x704e('0x56')]({'where':{'id':_0x4574d7[_0x704e('0x5c')]},'raw':!![]})[_0x704e('0x2f')](function(_0x1e9387){return createVoicePrefixExtensions(_0x4574d7,_0x1e9387,_0x4ab4b3);});});});})[_0x704e('0x2f')](function(){return db['VoicePrefix'][_0x704e('0x77')](_0x4574d7['id']);})[_0x704e('0x2f')](respondWithResult(_0x51d070,null))[_0x704e('0x57')](handleError(_0x51d070,null));};exports[_0x704e('0x78')]=function(_0x124f2c,_0x8b7004,_0x417a71){return db[_0x704e('0x4f')][_0x704e('0x56')]({'where':{'id':_0x124f2c[_0x704e('0x52')]['id']}})[_0x704e('0x2f')](handleEntityNotFound(_0x8b7004,null))[_0x704e('0x2f')](function(_0x1df464){if(_0x1df464){return _0x1df464[_0x704e('0x78')](_0x124f2c[_0x704e('0x79')][_0x704e('0x7a')],_[_0x704e('0x7b')](_0x124f2c[_0x704e('0x79')],[_0x704e('0x7a'),'id'])||{})[_0x704e('0x7c')](function(_0x98fa66){for(var _0x113de8=0x0;_0x113de8<_0x124f2c[_0x704e('0x79')][_0x704e('0x7a')]['length'];_0x113de8+=0x1){socket[_0x704e('0x7d')]('userVoicePrefix:save',{'UserId':_0x124f2c[_0x704e('0x79')][_0x704e('0x7a')][_0x113de8],'VoicePrefixId':_0x124f2c[_0x704e('0x52')]['id']});}return _0x98fa66;});}})['then'](respondWithResult(_0x8b7004,null))[_0x704e('0x57')](handleError(_0x8b7004,null));};exports[_0x704e('0x7e')]=function(_0x39a417,_0x1c9c55,_0x408f0f){return db[_0x704e('0x4f')][_0x704e('0x56')]({'where':{'id':_0x39a417[_0x704e('0x52')]['id']}})[_0x704e('0x2f')](handleEntityNotFound(_0x1c9c55,null))[_0x704e('0x2f')](function(_0x4fa13d){if(_0x4fa13d){return _0x4fa13d['removeAgents'](_0x39a417[_0x704e('0x3d')][_0x704e('0x7a')])[_0x704e('0x2f')](function(){if(_[_0x704e('0x7f')](_0x39a417[_0x704e('0x3d')]['ids'])){for(var _0x5b51c7=0x0;_0x5b51c7<_0x39a417['query'][_0x704e('0x7a')]['length'];_0x5b51c7+=0x1){socket[_0x704e('0x7d')](_0x704e('0x80'),{'UserId':Number(_0x39a417[_0x704e('0x3d')]['ids'][_0x5b51c7]),'VoicePrefixId':Number(_0x39a417[_0x704e('0x52')]['id'])});}}else{socket[_0x704e('0x7d')](_0x704e('0x80'),{'UserId':Number(_0x39a417[_0x704e('0x3d')][_0x704e('0x7a')]),'VoicePrefixId':Number(_0x39a417[_0x704e('0x52')]['id'])});}});}})[_0x704e('0x2f')](respondWithStatusCode(_0x1c9c55,null))[_0x704e('0x57')](handleError(_0x1c9c55,null));};exports[_0x704e('0x81')]=function(_0x310164,_0xe16ef2,_0x45e2af){var _0x45b371={};var _0x286a76={};var _0x4a6ae0;var _0x4f04bd;return db[_0x704e('0x4f')][_0x704e('0x82')]({'where':{'id':_0x310164[_0x704e('0x52')]['id']}})[_0x704e('0x2f')](handleEntityNotFound(_0xe16ef2,null))[_0x704e('0x2f')](function(_0x56fe7c){if(_0x56fe7c){_0x4a6ae0=_0x56fe7c;_0x286a76['model']=_[_0x704e('0x53')](db['User'][_0x704e('0x37')]);_0x286a76[_0x704e('0x3d')]=_['keys'](_0x310164[_0x704e('0x3d')]);_0x286a76['filters']=_[_0x704e('0x3e')](_0x286a76[_0x704e('0x3b')],_0x286a76['query']);_0x45b371[_0x704e('0x3f')]=_['intersection'](_0x286a76['model'],qs[_0x704e('0x40')](_0x310164['query'][_0x704e('0x40')]));_0x45b371[_0x704e('0x3f')]=_0x45b371[_0x704e('0x3f')][_0x704e('0x54')]?_0x45b371[_0x704e('0x3f')]:_0x286a76[_0x704e('0x3b')];_0x45b371[_0x704e('0x44')]=qs[_0x704e('0x45')](_0x310164[_0x704e('0x3d')][_0x704e('0x45')]);_0x45b371['where']=qs[_0x704e('0x47')](_['pick'](_0x310164[_0x704e('0x3d')],_0x286a76[_0x704e('0x47')]));if(_0x310164['query'][_0x704e('0x49')]){_0x45b371[_0x704e('0x46')]=_[_0x704e('0x4a')](_0x45b371[_0x704e('0x46')],{'$or':_[_0x704e('0x3c')](_0x45b371[_0x704e('0x3f')],function(_0x3f4dbd){var _0x3e83dc={};_0x3e83dc[_0x3f4dbd]={'$like':'%'+_0x310164[_0x704e('0x3d')][_0x704e('0x49')]+'%'};return _0x3e83dc;})});}_0x45b371=_[_0x704e('0x4a')]({},_0x45b371,_0x310164[_0x704e('0x4c')]);return _0x4a6ae0['getAgents'](_0x45b371);}})[_0x704e('0x2f')](function(_0x1c7178){if(_0x1c7178){_0x4f04bd=_0x1c7178['length'];if(!_0x310164[_0x704e('0x3d')][_0x704e('0x41')](_0x704e('0x42'))){_0x45b371[_0x704e('0x43')]=qs[_0x704e('0x43')](_0x310164[_0x704e('0x3d')][_0x704e('0x43')]);_0x45b371[_0x704e('0x27')]=qs[_0x704e('0x27')](_0x310164[_0x704e('0x3d')][_0x704e('0x27')]);}return _0x4a6ae0[_0x704e('0x81')](_0x45b371);}})[_0x704e('0x2f')](function(_0x5822a8){if(_0x5822a8){return _0x5822a8?{'count':_0x4f04bd,'rows':_0x5822a8}:null;}})[_0x704e('0x2f')](respondWithResult(_0xe16ef2,null))['catch'](handleError(_0xe16ef2,null));}; \ No newline at end of file +var _0x1bce=['lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','defaults','redis','localhost','./voicePrefix.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','VoicePrefixes','error','stack','name','send','index','VoicePrefix','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','include','findAll','catch','show','find','params','describe','create','transaction','VoiceExtension','VoiceExtensionId','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','VoicePrefixId','map','prefix','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','body','system-','sequelize','findById','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1bce,0x73));var _0xe1bc=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1bce[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0xe1bc('0x0'));var emlformat=require(_0xe1bc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe1bc('0x2'));var jsonpatch=require(_0xe1bc('0x3'));var rp=require(_0xe1bc('0x4'));var moment=require(_0xe1bc('0x5'));var BPromise=require(_0xe1bc('0x6'));var Mustache=require(_0xe1bc('0x7'));var util=require(_0xe1bc('0x8'));var path=require(_0xe1bc('0x9'));var sox=require(_0xe1bc('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe1bc('0xb'));var squel=require(_0xe1bc('0xc'));var crypto=require(_0xe1bc('0xd'));var jsforce=require(_0xe1bc('0xe'));var deskjs=require(_0xe1bc('0xf'));var toCsv=require(_0xe1bc('0x10'));var querystring=require('querystring');var Papa=require(_0xe1bc('0x11'));var Redis=require('ioredis');var authService=require(_0xe1bc('0x12'));var qs=require(_0xe1bc('0x13'));var as=require(_0xe1bc('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe1bc('0x15'))(_0xe1bc('0x16'));var utils=require('../../config/utils');var config=require(_0xe1bc('0x17'));var licenseUtil=require(_0xe1bc('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xe1bc('0x19')](config[_0xe1bc('0x1a')],{'host':_0xe1bc('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe1bc('0x1c'))[_0xe1bc('0x1d')](socket);function respondWithStatusCode(_0x402a22,_0x4fd1aa){_0x4fd1aa=_0x4fd1aa||0xcc;return function(_0x9fdac5){if(_0x9fdac5){return _0x402a22[_0xe1bc('0x1e')](_0x4fd1aa);}return _0x402a22[_0xe1bc('0x1f')](_0x4fd1aa)[_0xe1bc('0x20')]();};}function respondWithResult(_0x556001,_0x391e02){_0x391e02=_0x391e02||0xc8;return function(_0x4a432f){if(_0x4a432f){return _0x556001[_0xe1bc('0x1f')](_0x391e02)[_0xe1bc('0x21')](_0x4a432f);}};}function respondWithFilteredResult(_0x4acd5b,_0x30deda){return function(_0x1ed85d){if(_0x1ed85d){var _0x1b7585=_0x1ed85d['count'],_0x3fd489=_0x30deda[_0xe1bc('0x22')],_0x391aa4=_0x30deda['offset']+_0x30deda[_0xe1bc('0x23')],_0x47620e;if(_0x391aa4>=_0x1b7585){_0x391aa4=_0x1b7585;_0x47620e=0xc8;}else{_0x47620e=0xce;}_0x4acd5b[_0xe1bc('0x1f')](_0x47620e);return _0x4acd5b[_0xe1bc('0x24')](_0xe1bc('0x25'),_0x3fd489+'-'+_0x391aa4+'/'+_0x1b7585)[_0xe1bc('0x21')](_0x1ed85d);}return null;};}function patchUpdates(_0x5030eb){return function(_0x313b16){try{jsonpatch['apply'](_0x313b16,_0x5030eb,!![]);}catch(_0x5f3bdc){return BPromise[_0xe1bc('0x26')](_0x5f3bdc);}return _0x313b16[_0xe1bc('0x27')]();};}function saveUpdates(_0x5cc42d,_0x4b43b2){return function(_0x39a634){if(_0x39a634){return _0x39a634[_0xe1bc('0x28')](_0x5cc42d)[_0xe1bc('0x29')](function(_0x126ae3){return _0x126ae3;});}return null;};}function removeEntity(_0x229b43,_0x18a5c6){return function(_0x33b32d){if(_0x33b32d){return _0x33b32d[_0xe1bc('0x2a')]()[_0xe1bc('0x29')](function(){var _0x16631e=_0x33b32d[_0xe1bc('0x2b')]({'plain':!![]});var _0x3d1946=_0xe1bc('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x3d1946,'resourceId':_0x16631e['id']}})[_0xe1bc('0x29')](function(){return _0x33b32d;});})['then'](function(){_0x229b43[_0xe1bc('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34cb80,_0x57f369){return function(_0x552101){if(!_0x552101){_0x34cb80[_0xe1bc('0x1e')](0x194);}return _0x552101;};}function handleError(_0x3958a4,_0x58a667){_0x58a667=_0x58a667||0x1f4;return function(_0x47d9b3){logger[_0xe1bc('0x2d')](_0x47d9b3[_0xe1bc('0x2e')]);if(_0x47d9b3[_0xe1bc('0x2f')]){delete _0x47d9b3[_0xe1bc('0x2f')];}_0x3958a4[_0xe1bc('0x1f')](_0x58a667)[_0xe1bc('0x30')](_0x47d9b3);};}exports[_0xe1bc('0x31')]=function(_0x32194a,_0x32bedb){var _0x51f98d={},_0x3bfd38={},_0x1eaa77={'count':0x0,'rows':[]};var _0x2033b7=_['map'](db[_0xe1bc('0x32')][_0xe1bc('0x33')],function(_0x492fc1){return{'name':_0x492fc1[_0xe1bc('0x34')],'type':_0x492fc1[_0xe1bc('0x35')]['key']};});_0x3bfd38[_0xe1bc('0x36')]=_['map'](_0x2033b7,'name');_0x3bfd38[_0xe1bc('0x37')]=_[_0xe1bc('0x38')](_0x32194a[_0xe1bc('0x37')]);_0x3bfd38['filters']=_[_0xe1bc('0x39')](_0x3bfd38[_0xe1bc('0x36')],_0x3bfd38['query']);_0x51f98d[_0xe1bc('0x3a')]=_[_0xe1bc('0x39')](_0x3bfd38[_0xe1bc('0x36')],qs[_0xe1bc('0x3b')](_0x32194a[_0xe1bc('0x37')][_0xe1bc('0x3b')]));_0x51f98d['attributes']=_0x51f98d[_0xe1bc('0x3a')][_0xe1bc('0x3c')]?_0x51f98d['attributes']:_0x3bfd38[_0xe1bc('0x36')];if(!_0x32194a['query'][_0xe1bc('0x3d')](_0xe1bc('0x3e'))){_0x51f98d[_0xe1bc('0x23')]=qs[_0xe1bc('0x23')](_0x32194a['query'][_0xe1bc('0x23')]);_0x51f98d[_0xe1bc('0x22')]=qs[_0xe1bc('0x22')](_0x32194a[_0xe1bc('0x37')][_0xe1bc('0x22')]);}_0x51f98d[_0xe1bc('0x3f')]=qs[_0xe1bc('0x40')](_0x32194a[_0xe1bc('0x37')][_0xe1bc('0x40')]);_0x51f98d[_0xe1bc('0x41')]=qs[_0xe1bc('0x42')](_[_0xe1bc('0x43')](_0x32194a[_0xe1bc('0x37')],_0x3bfd38[_0xe1bc('0x42')]),_0x2033b7);if(_0x32194a['query'][_0xe1bc('0x44')]){_0x51f98d[_0xe1bc('0x41')]=_['merge'](_0x51f98d[_0xe1bc('0x41')],{'$or':_['map'](_0x2033b7,function(_0x149d1a){if(_0x149d1a[_0xe1bc('0x35')]!==_0xe1bc('0x45')){var _0xf80e7f={};_0xf80e7f[_0x149d1a[_0xe1bc('0x2f')]]={'$like':'%'+_0x32194a['query']['filter']+'%'};return _0xf80e7f;}})});}_0x51f98d=_[_0xe1bc('0x46')]({},_0x51f98d,_0x32194a[_0xe1bc('0x47')]);var _0x3d7d34={'where':_0x51f98d[_0xe1bc('0x41')]};return db[_0xe1bc('0x32')][_0xe1bc('0x48')](_0x3d7d34)['then'](function(_0x16d64c){_0x1eaa77[_0xe1bc('0x48')]=_0x16d64c;if(_0x32194a[_0xe1bc('0x37')]['includeAll']){_0x51f98d[_0xe1bc('0x49')]=[{'all':!![]}];}return db['VoicePrefix'][_0xe1bc('0x4a')](_0x51f98d);})[_0xe1bc('0x29')](function(_0x42b55f){_0x1eaa77['rows']=_0x42b55f;return _0x1eaa77;})[_0xe1bc('0x29')](respondWithFilteredResult(_0x32bedb,_0x51f98d))[_0xe1bc('0x4b')](handleError(_0x32bedb,null));};exports[_0xe1bc('0x4c')]=function(_0x59be59,_0x473a44){var _0x5b0c25={'raw':![],'where':{'id':_0x59be59['params']['id']}},_0x4af12e={};_0x4af12e['model']=_['keys'](db['VoicePrefix'][_0xe1bc('0x33')]);_0x4af12e[_0xe1bc('0x37')]=_[_0xe1bc('0x38')](_0x59be59[_0xe1bc('0x37')]);_0x4af12e[_0xe1bc('0x42')]=_[_0xe1bc('0x39')](_0x4af12e['model'],_0x4af12e[_0xe1bc('0x37')]);_0x5b0c25[_0xe1bc('0x3a')]=_[_0xe1bc('0x39')](_0x4af12e[_0xe1bc('0x36')],qs[_0xe1bc('0x3b')](_0x59be59['query'][_0xe1bc('0x3b')]));_0x5b0c25[_0xe1bc('0x3a')]=_0x5b0c25['attributes'][_0xe1bc('0x3c')]?_0x5b0c25[_0xe1bc('0x3a')]:_0x4af12e['model'];if(_0x59be59[_0xe1bc('0x37')]['includeAll']){_0x5b0c25[_0xe1bc('0x49')]=[{'all':!![]}];}_0x5b0c25=_['merge']({},_0x5b0c25,_0x59be59['options']);return db[_0xe1bc('0x32')][_0xe1bc('0x4d')](_0x5b0c25)[_0xe1bc('0x29')](handleEntityNotFound(_0x473a44,null))[_0xe1bc('0x29')](respondWithResult(_0x473a44,null))[_0xe1bc('0x4b')](handleError(_0x473a44,null));};exports[_0xe1bc('0x2a')]=function(_0x56cde0,_0x324740){return db[_0xe1bc('0x32')]['find']({'where':{'id':_0x56cde0[_0xe1bc('0x4e')]['id']}})['then'](handleEntityNotFound(_0x324740,null))[_0xe1bc('0x29')](removeEntity(_0x324740,null))['catch'](handleError(_0x324740,null));};exports[_0xe1bc('0x4f')]=function(_0x39c4ce,_0x1a95bd){return db['VoicePrefix'][_0xe1bc('0x4f')]()['then'](respondWithResult(_0x1a95bd,null))[_0xe1bc('0x4b')](handleError(_0x1a95bd,null));};exports[_0xe1bc('0x50')]=function(_0x888d72,_0x58c3a9){var _0x167dd2;return db['sequelize'][_0xe1bc('0x51')](function(_0x4594bd){return db['VoicePrefix'][_0xe1bc('0x50')](_0x888d72['body'],{'transaction':_0x4594bd})[_0xe1bc('0x29')](function(_0x1c3b9c){_0x167dd2=_0x1c3b9c['get']({'plain':!![]});return db[_0xe1bc('0x52')][_0xe1bc('0x4d')]({'where':{'id':_0x167dd2[_0xe1bc('0x53')]},'raw':!![]})[_0xe1bc('0x29')](function(_0x219536){return createVoicePrefixExtensions(_0x167dd2,_0x219536,_0x4594bd);});});})[_0xe1bc('0x29')](function(){var _0x64c345=_0x888d72[_0xe1bc('0x54')][_0xe1bc('0x2b')]({'plain':!![]});if(!_0x64c345)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x64c345['role']===_0xe1bc('0x54')){var _0x242477=_0x167dd2;return db[_0xe1bc('0x55')][_0xe1bc('0x4d')]({'where':{'name':_0xe1bc('0x2c'),'userProfileId':_0x64c345[_0xe1bc('0x56')]},'raw':!![]})['then'](function(_0x417933){if(_0x417933&&_0x417933[_0xe1bc('0x57')]===0x0){return db[_0xe1bc('0x58')][_0xe1bc('0x50')]({'name':_0x242477['name'],'resourceId':_0x242477['id'],'type':_0x417933[_0xe1bc('0x2f')],'sectionId':_0x417933['id']},{})[_0xe1bc('0x29')](function(){return _0x167dd2;});}else{return _0x167dd2;}})[_0xe1bc('0x4b')](function(_0x84c493){logger['error'](_0xe1bc('0x59'),_0x84c493);throw _0x84c493;});}return _0x167dd2;})['then'](respondWithResult(_0x58c3a9,null))[_0xe1bc('0x4b')](handleError(_0x58c3a9,null));};function Extension(_0x59c79f,_0x2f7ef2,_0x32717f,_0x25450b){this[_0xe1bc('0x5a')]=_0xe1bc('0x5b');this['exten']=_0x59c79f;this[_0xe1bc('0x5c')]=_0x32717f;this['type']=_0xe1bc('0x5d');this[_0xe1bc('0x5e')]=_0xe1bc('0x5f');this[_0xe1bc('0x60')]=_0x2f7ef2;this[_0xe1bc('0x61')]=_0x25450b;}function createVoicePrefixExtensions(_0x39217d,_0x385b54,_0x3abc6f){return new BPromise(function(_0x46e20a,_0x3fc3cb){var _0x2a7de2=new Extension(formatPrefixName(_0x39217d['prefix']),0x1,_0xe1bc('0x62'),'Voice\x20Prefix');_0x2a7de2[_0xe1bc('0x63')]=_0x39217d['id'];return db[_0xe1bc('0x52')][_0xe1bc('0x50')](_0x2a7de2,{'transaction':_0x3abc6f})[_0xe1bc('0x29')](function(_0x305be5){var _0x4cacad=_0x305be5[_0xe1bc('0x2b')]({'plain':!![]});var _0x38eccf=_[_0xe1bc('0x64')](addVoicePrefixExtensions(_0x39217d,_0x385b54),function(_0x11ef33){_0x11ef33[_0xe1bc('0x53')]=_0x4cacad['id'];_0x11ef33[_0xe1bc('0x63')]=_0x39217d['id'];return _0x11ef33;});return db[_0xe1bc('0x52')]['bulkCreate'](_0x38eccf,{'transaction':_0x3abc6f})[_0xe1bc('0x29')](function(_0x2c1f98){if(!_0x2c1f98){return _0x3fc3cb('Extensions\x20creation\x20failed');}else{return _0x46e20a(_0x2c1f98);}})[_0xe1bc('0x4b')](function(_0x14afd2){return _0x3fc3cb(_0x14afd2);});});;});};function addVoicePrefixExtensions(_0x50e8d0,_0x4d76a3){var _0x3d9e35=[];var _0x16d62a=formatPrefixName(_0x50e8d0[_0xe1bc('0x65')]);_0x3d9e35[_0xe1bc('0x66')](new Extension(_0x16d62a,0x2,'Set',_0xe1bc('0x67')+_0x50e8d0[_0xe1bc('0x2f')]));if(_0x50e8d0[_0xe1bc('0x68')]){_0x3d9e35[_0xe1bc('0x66')](new Extension(_0x16d62a,0x3,_0xe1bc('0x69'),_0xe1bc('0x6a')+_0x50e8d0['callerIdAll']));}else{_0x3d9e35[_0xe1bc('0x66')](new Extension(_0x16d62a,0x3,_0xe1bc('0x62'),_0xe1bc('0x6b')));}_0x3d9e35[_0xe1bc('0x66')](new Extension(_0x16d62a,0x4,_0xe1bc('0x6c'),_0x4d76a3[_0xe1bc('0x5a')]+','+_0xe1bc('0x6d')+(0x8+_0x50e8d0[_0xe1bc('0x2f')][_0xe1bc('0x3c')])+'}'+','+0x1));return _0x3d9e35;}function formatPrefixName(_0x51b5b5){var _0x4542df='_';for(var _0x10e574=0x0;_0x10e574<_0x51b5b5['length'];_0x10e574++){if(_0x51b5b5['charAt'](_0x10e574)=='-'){_0x4542df+=_0x51b5b5[_0xe1bc('0x6e')](_0x10e574);}else{_0x4542df+='['+_0x51b5b5[_0xe1bc('0x6e')](_0x10e574)+']';}}_0x4542df+='.';return _0x4542df;}exports[_0xe1bc('0x28')]=function(_0x4c9be9,_0x5a400b,_0x28a243){var _0x283989=_0x4c9be9[_0xe1bc('0x6f')];_0x283989['prefix']=_0xe1bc('0x70')+_0x283989[_0xe1bc('0x2f')]+'-';return db[_0xe1bc('0x71')][_0xe1bc('0x51')](function(_0x3b4cc1){return db['VoicePrefix'][_0xe1bc('0x28')](_0x283989,{'where':{'id':_0x283989['id']},'transaction':_0x3b4cc1})[_0xe1bc('0x29')](function(){return db[_0xe1bc('0x52')][_0xe1bc('0x2a')]({'where':{'VoicePrefixId':_0x283989['id']},'transaction':_0x3b4cc1})[_0xe1bc('0x29')](function(){return db[_0xe1bc('0x52')]['find']({'where':{'id':_0x283989[_0xe1bc('0x53')]},'raw':!![]})[_0xe1bc('0x29')](function(_0x4908c3){return createVoicePrefixExtensions(_0x283989,_0x4908c3,_0x3b4cc1);});});});})[_0xe1bc('0x29')](function(){return db[_0xe1bc('0x32')][_0xe1bc('0x72')](_0x283989['id']);})[_0xe1bc('0x29')](respondWithResult(_0x5a400b,null))[_0xe1bc('0x4b')](handleError(_0x5a400b,null));};exports['addAgents']=function(_0x221cf6,_0x158f2d,_0x2055db){return db[_0xe1bc('0x32')][_0xe1bc('0x4d')]({'where':{'id':_0x221cf6[_0xe1bc('0x4e')]['id']}})[_0xe1bc('0x29')](handleEntityNotFound(_0x158f2d,null))['then'](function(_0x2e1a41){if(_0x2e1a41){return _0x2e1a41['addAgents'](_0x221cf6['body'][_0xe1bc('0x73')],_[_0xe1bc('0x74')](_0x221cf6[_0xe1bc('0x6f')],[_0xe1bc('0x73'),'id'])||{})[_0xe1bc('0x75')](function(_0x544f4a){for(var _0x22a9f0=0x0;_0x22a9f0<_0x221cf6['body'][_0xe1bc('0x73')][_0xe1bc('0x3c')];_0x22a9f0+=0x1){socket[_0xe1bc('0x76')](_0xe1bc('0x77'),{'UserId':_0x221cf6['body'][_0xe1bc('0x73')][_0x22a9f0],'VoicePrefixId':_0x221cf6['params']['id']});}return _0x544f4a;});}})[_0xe1bc('0x29')](respondWithResult(_0x158f2d,null))[_0xe1bc('0x4b')](handleError(_0x158f2d,null));};exports[_0xe1bc('0x78')]=function(_0x397388,_0x1b0027,_0x2a17ed){return db['VoicePrefix'][_0xe1bc('0x4d')]({'where':{'id':_0x397388[_0xe1bc('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1b0027,null))[_0xe1bc('0x29')](function(_0x731c30){if(_0x731c30){return _0x731c30[_0xe1bc('0x78')](_0x397388[_0xe1bc('0x37')][_0xe1bc('0x73')])[_0xe1bc('0x29')](function(){if(_[_0xe1bc('0x79')](_0x397388[_0xe1bc('0x37')]['ids'])){for(var _0xdbc51=0x0;_0xdbc51<_0x397388[_0xe1bc('0x37')][_0xe1bc('0x73')][_0xe1bc('0x3c')];_0xdbc51+=0x1){socket['emit'](_0xe1bc('0x7a'),{'UserId':Number(_0x397388['query']['ids'][_0xdbc51]),'VoicePrefixId':Number(_0x397388[_0xe1bc('0x4e')]['id'])});}}else{socket['emit'](_0xe1bc('0x7a'),{'UserId':Number(_0x397388[_0xe1bc('0x37')][_0xe1bc('0x73')]),'VoicePrefixId':Number(_0x397388['params']['id'])});}});}})[_0xe1bc('0x29')](respondWithStatusCode(_0x1b0027,null))[_0xe1bc('0x4b')](handleError(_0x1b0027,null));};exports[_0xe1bc('0x7b')]=function(_0x560575,_0x28ae1f,_0x5d4a0e){var _0x4a07f7={};var _0x4c251c={};var _0x41efcf;var _0x53034f;return db[_0xe1bc('0x32')][_0xe1bc('0x7c')]({'where':{'id':_0x560575['params']['id']}})['then'](handleEntityNotFound(_0x28ae1f,null))['then'](function(_0x5d598a){if(_0x5d598a){_0x41efcf=_0x5d598a;_0x4c251c[_0xe1bc('0x36')]=_[_0xe1bc('0x38')](db[_0xe1bc('0x7d')]['rawAttributes']);_0x4c251c[_0xe1bc('0x37')]=_[_0xe1bc('0x38')](_0x560575[_0xe1bc('0x37')]);_0x4c251c['filters']=_['intersection'](_0x4c251c[_0xe1bc('0x36')],_0x4c251c[_0xe1bc('0x37')]);_0x4a07f7[_0xe1bc('0x3a')]=_[_0xe1bc('0x39')](_0x4c251c['model'],qs[_0xe1bc('0x3b')](_0x560575[_0xe1bc('0x37')]['fields']));_0x4a07f7[_0xe1bc('0x3a')]=_0x4a07f7[_0xe1bc('0x3a')]['length']?_0x4a07f7[_0xe1bc('0x3a')]:_0x4c251c[_0xe1bc('0x36')];_0x4a07f7[_0xe1bc('0x3f')]=qs[_0xe1bc('0x40')](_0x560575['query'][_0xe1bc('0x40')]);_0x4a07f7[_0xe1bc('0x41')]=qs['filters'](_['pick'](_0x560575[_0xe1bc('0x37')],_0x4c251c[_0xe1bc('0x42')]));if(_0x560575['query'][_0xe1bc('0x44')]){_0x4a07f7[_0xe1bc('0x41')]=_[_0xe1bc('0x46')](_0x4a07f7[_0xe1bc('0x41')],{'$or':_[_0xe1bc('0x64')](_0x4a07f7[_0xe1bc('0x3a')],function(_0x146a9c){var _0xe4fcf2={};_0xe4fcf2[_0x146a9c]={'$like':'%'+_0x560575[_0xe1bc('0x37')][_0xe1bc('0x44')]+'%'};return _0xe4fcf2;})});}_0x4a07f7=_[_0xe1bc('0x46')]({},_0x4a07f7,_0x560575['options']);return _0x41efcf[_0xe1bc('0x7b')](_0x4a07f7);}})['then'](function(_0x4e9496){if(_0x4e9496){_0x53034f=_0x4e9496['length'];if(!_0x560575[_0xe1bc('0x37')][_0xe1bc('0x3d')](_0xe1bc('0x3e'))){_0x4a07f7[_0xe1bc('0x23')]=qs[_0xe1bc('0x23')](_0x560575['query'][_0xe1bc('0x23')]);_0x4a07f7['offset']=qs[_0xe1bc('0x22')](_0x560575[_0xe1bc('0x37')][_0xe1bc('0x22')]);}return _0x41efcf['getAgents'](_0x4a07f7);}})[_0xe1bc('0x29')](function(_0x4862fa){if(_0x4862fa){return _0x4862fa?{'count':_0x53034f,'rows':_0x4862fa}:null;}})[_0xe1bc('0x29')](respondWithResult(_0x28ae1f,null))[_0xe1bc('0x4b')](handleError(_0x28ae1f,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 3d2aebc..3246001 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 _0xedd9=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xedd9,0xfc));var _0x9edd=function(_0x574f3b,_0x31f052){_0x574f3b=_0x574f3b-0x0;var _0x1a1b1f=_0xedd9[_0x574f3b];return _0x1a1b1f;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x9edd('0x0'))['db'][_0x9edd('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x9edd('0x2')](0x0);var events={'afterCreate':_0x9edd('0x3'),'afterUpdate':_0x9edd('0x4'),'afterDestroy':_0x9edd('0x5')};function emitEvent(_0x3e6d3a){return function(_0x36b53f,_0x5943b3,_0x33679f){VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a+':'+_0x36b53f['id'],_0x36b53f);VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a,_0x36b53f);_0x33679f(null);};}for(var e in events){if(events[_0x9edd('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x9edd('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0xcb91=['save','update','emit','hasOwnProperty','hook','VoicePrefix','setMaxListeners'];(function(_0xc25ad7,_0x2ede3a){var _0x2c9d60=function(_0x1d0a38){while(--_0x1d0a38){_0xc25ad7['push'](_0xc25ad7['shift']());}};_0x2c9d60(++_0x2ede3a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x29d2d2,_0x3344){_0x29d2d2=_0x29d2d2-0x0;var _0x3f6476=_0xcb91[_0x29d2d2];return _0x3f6476;};'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 cdfd7cd..3c4ba76 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 _0xc736=['api','moment','bluebird','path','rimraf','../../config/environment','define','voice_prefixes','../../config/logger'];(function(_0xdc9009,_0x2e0722){var _0xa7bb77=function(_0x4a7330){while(--_0x4a7330){_0xdc9009['push'](_0xdc9009['shift']());}};_0xa7bb77(++_0x2e0722);}(_0xc736,0xaa));var _0x6c73=function(_0x3c9c54,_0x2f9f32){_0x3c9c54=_0x3c9c54-0x0;var _0x42766c=_0xc736[_0x3c9c54];return _0x42766c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6c73('0x0'))(_0x6c73('0x1'));var moment=require(_0x6c73('0x2'));var BPromise=require(_0x6c73('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c73('0x4'));var rimraf=require(_0x6c73('0x5'));var config=require(_0x6c73('0x6'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x360df4,_0x4a8304){return _0x360df4[_0x6c73('0x7')]('VoicePrefix',attributes,{'tableName':_0x6c73('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6171=['./voicePrefix.attributes','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x100e35,_0x482085){var _0x4097fe=function(_0x2e6544){while(--_0x2e6544){_0x100e35['push'](_0x100e35['shift']());}};_0x4097fe(++_0x482085);}(_0x6171,0x147));var _0x1617=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x6171[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x1617('0x0'));var util=require(_0x1617('0x1'));var logger=require(_0x1617('0x2'))(_0x1617('0x3'));var moment=require(_0x1617('0x4'));var BPromise=require(_0x1617('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1617('0x6'));var rimraf=require(_0x1617('0x7'));var config=require(_0x1617('0x8'));var attributes=require(_0x1617('0x9'));module['exports']=function(_0x49eee4,_0x13d367){return _0x49eee4['define'](_0x1617('0xa'),attributes,{'tableName':_0x1617('0xb'),'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 8a3c4e7..bd17fa5 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 _0x6bf1=['VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x6bf1,0x71));var _0x16bf=function(_0x447127,_0xbe4ade){_0x447127=_0x447127-0x0;var _0x358a25=_0x6bf1[_0x447127];return _0x358a25;};'use strict';var _=require(_0x16bf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x16bf('0x1'));var rs=require(_0x16bf('0x2'));var fs=require('fs');var Redis=require(_0x16bf('0x3'));var db=require(_0x16bf('0x4'))['db'];var utils=require(_0x16bf('0x5'));var logger=require('../../config/logger')(_0x16bf('0x6'));var config=require(_0x16bf('0x7'));var jayson=require(_0x16bf('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x16bf('0x9')]=_[_0x16bf('0xa')](config[_0x16bf('0x9')],{'host':_0x16bf('0xb'),'port':0x18eb});var socket=require(_0x16bf('0xc'))(new Redis(config[_0x16bf('0x9')]));require(_0x16bf('0xd'))[_0x16bf('0xe')](socket);function respondWithRpcPromise(_0x58ebb1,_0x232990,_0x22f6b8){return new BPromise(function(_0x2b0c9f,_0x407e2a){return client[_0x16bf('0xf')](_0x58ebb1,_0x22f6b8)[_0x16bf('0x10')](function(_0x51c193){logger['info'](_0x16bf('0x11'),_0x232990,_0x16bf('0x12'));logger[_0x16bf('0x13')](_0x16bf('0x14'),_0x232990,_0x16bf('0x12'),JSON[_0x16bf('0x15')](_0x51c193));if(_0x51c193[_0x16bf('0x16')]){if(_0x51c193[_0x16bf('0x16')][_0x16bf('0x17')]===0x1f4){logger['error'](_0x16bf('0x11'),_0x232990,_0x51c193[_0x16bf('0x16')]['message']);return _0x407e2a(_0x51c193[_0x16bf('0x16')][_0x16bf('0x18')]);}logger[_0x16bf('0x16')](_0x16bf('0x11'),_0x232990,_0x51c193[_0x16bf('0x16')]['message']);return _0x2b0c9f(_0x51c193['error']['message']);}else{logger[_0x16bf('0x19')]('VoicePrefix,\x20%s,\x20%s',_0x232990,_0x16bf('0x12'));_0x2b0c9f(_0x51c193['result'][_0x16bf('0x18')]);}})['catch'](function(_0x10c5fa){logger[_0x16bf('0x16')](_0x16bf('0x11'),_0x232990,_0x10c5fa);_0x407e2a(_0x10c5fa);});});} \ No newline at end of file +var _0xece2=['localhost','socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','moment','randomstring','ioredis','rpc','jayson/promise','client','redis'];(function(_0xba5e92,_0x38a184){var _0x43c82a=function(_0x4e628e){while(--_0x4e628e){_0xba5e92['push'](_0xba5e92['shift']());}};_0x43c82a(++_0x38a184);}(_0xece2,0x1f2));var _0x2ece=function(_0x3b5b7c,_0x1b4097){_0x3b5b7c=_0x3b5b7c-0x0;var _0x240b5b=_0xece2[_0x3b5b7c];return _0x240b5b;};'use strict';var _=require(_0x2ece('0x0'));var util=require('util');var moment=require(_0x2ece('0x1'));var BPromise=require('bluebird');var rs=require(_0x2ece('0x2'));var fs=require('fs');var Redis=require(_0x2ece('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2ece('0x4'));var config=require('../../config/environment');var jayson=require(_0x2ece('0x5'));var client=jayson[_0x2ece('0x6')]['http']({'port':0x232a});config[_0x2ece('0x7')]=_['defaults'](config[_0x2ece('0x7')],{'host':_0x2ece('0x8'),'port':0x18eb});var socket=require(_0x2ece('0x9'))(new Redis(config[_0x2ece('0x7')]));require('./voicePrefix.socket')[_0x2ece('0xa')](socket);function respondWithRpcPromise(_0x5d9b4f,_0x524c51,_0x1e6e84){return new BPromise(function(_0x368290,_0x83bab5){return client[_0x2ece('0xb')](_0x5d9b4f,_0x1e6e84)[_0x2ece('0xc')](function(_0x18d41d){logger[_0x2ece('0xd')](_0x2ece('0xe'),_0x524c51,_0x2ece('0xf'));logger[_0x2ece('0x10')](_0x2ece('0x11'),_0x524c51,_0x2ece('0xf'),JSON[_0x2ece('0x12')](_0x18d41d));if(_0x18d41d[_0x2ece('0x13')]){if(_0x18d41d[_0x2ece('0x13')][_0x2ece('0x14')]===0x1f4){logger[_0x2ece('0x13')](_0x2ece('0xe'),_0x524c51,_0x18d41d[_0x2ece('0x13')][_0x2ece('0x15')]);return _0x83bab5(_0x18d41d[_0x2ece('0x13')]['message']);}logger[_0x2ece('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x524c51,_0x18d41d[_0x2ece('0x13')]['message']);return _0x368290(_0x18d41d[_0x2ece('0x13')][_0x2ece('0x15')]);}else{logger[_0x2ece('0xd')](_0x2ece('0xe'),_0x524c51,'request\x20sent');_0x368290(_0x18d41d['result'][_0x2ece('0x15')]);}})['catch'](function(_0x3bd4c5){logger[_0x2ece('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x524c51,_0x3bd4c5);_0x83bab5(_0x3bd4c5);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index b029c3c..009f37c 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 _0xafdc=['./voicePrefix.events','save','remove','update','emit','removeListener','register','length','voicePrefix:'];(function(_0x54f01a,_0x12e01c){var _0x4787f1=function(_0x89ae1b){while(--_0x89ae1b){_0x54f01a['push'](_0x54f01a['shift']());}};_0x4787f1(++_0x12e01c);}(_0xafdc,0x1cb));var _0xcafd=function(_0x3f45fb,_0x4b67c0){_0x3f45fb=_0x3f45fb-0x0;var _0x1797ef=_0xafdc[_0x3f45fb];return _0x1797ef;};'use strict';var VoicePrefixEvents=require(_0xcafd('0x0'));var events=[_0xcafd('0x1'),_0xcafd('0x2'),_0xcafd('0x3')];function createListener(_0x8b547a,_0x90579b){return function(_0x4d14e3){_0x90579b[_0xcafd('0x4')](_0x8b547a,_0x4d14e3);};}function removeListener(_0x3b1440,_0xfabcf3){return function(){VoicePrefixEvents[_0xcafd('0x5')](_0x3b1440,_0xfabcf3);};}exports[_0xcafd('0x6')]=function(_0x52dafb){for(var _0x1a499b=0x0,_0x565f83=events[_0xcafd('0x7')];_0x1a499b<_0x565f83;_0x1a499b++){var _0x1160c8=events[_0x1a499b];var _0x7bc1a7=createListener(_0xcafd('0x8')+_0x1160c8,_0x52dafb);VoicePrefixEvents['on'](_0x1160c8,_0x7bc1a7);}}; \ No newline at end of file +var _0xc02c=['removeListener','register','length','voicePrefix:','./voicePrefix.events','save','update','emit'];(function(_0x3efddb,_0x984819){var _0x17089f=function(_0x5c9780){while(--_0x5c9780){_0x3efddb['push'](_0x3efddb['shift']());}};_0x17089f(++_0x984819);}(_0xc02c,0xfc));var _0xcc02=function(_0x36a8d9,_0x288b0a){_0x36a8d9=_0x36a8d9-0x0;var _0x4b5ada=_0xc02c[_0x36a8d9];return _0x4b5ada;};'use strict';var VoicePrefixEvents=require(_0xcc02('0x0'));var events=[_0xcc02('0x1'),'remove',_0xcc02('0x2')];function createListener(_0x327a32,_0x19a653){return function(_0xdb6430){_0x19a653[_0xcc02('0x3')](_0x327a32,_0xdb6430);};}function removeListener(_0x10b656,_0x43b03c){return function(){VoicePrefixEvents[_0xcc02('0x4')](_0x10b656,_0x43b03c);};}exports[_0xcc02('0x5')]=function(_0x530a1f){for(var _0x24cced=0x0,_0x4d1b2d=events[_0xcc02('0x6')];_0x24cced<_0x4d1b2d;_0x24cced++){var _0x4124c7=events[_0x24cced];var _0x5cc5f4=createListener(_0xcc02('0x7')+_0x4124c7,_0x530a1f);VoicePrefixEvents['on'](_0x4124c7,_0x5cc5f4);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 5c943a7..0db135e 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 _0x6a18=['addAgents','addLists','put','/:id','delete','destroy','removeTeams','removeLists','removeBlackLists','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','post','create','clone','/:id/teams','/:id/users'];(function(_0x5b40ff,_0x2b8d6e){var _0x2edd1b=function(_0x1a826d){while(--_0x1a826d){_0x5b40ff['push'](_0x5b40ff['shift']());}};_0x2edd1b(++_0x2b8d6e);}(_0x6a18,0xf9));var _0x86a1=function(_0x467ad6,_0x10892e){_0x467ad6=_0x467ad6-0x0;var _0x4052cc=_0x6a18[_0x467ad6];return _0x4052cc;};'use strict';var multer=require(_0x86a1('0x0'));var util=require(_0x86a1('0x1'));var path=require(_0x86a1('0x2'));var timeout=require(_0x86a1('0x3'));var express=require(_0x86a1('0x4'));var router=express[_0x86a1('0x5')]();var auth=require(_0x86a1('0x6'));var interaction=require(_0x86a1('0x7'));var config=require(_0x86a1('0x8'));var controller=require(_0x86a1('0x9'));router[_0x86a1('0xa')]('/',auth[_0x86a1('0xb')](),controller[_0x86a1('0xc')]);router[_0x86a1('0xa')]('/:id',auth[_0x86a1('0xb')](),controller[_0x86a1('0xd')]);router['get'](_0x86a1('0xe'),auth[_0x86a1('0xb')](),controller[_0x86a1('0xf')]);router['get']('/:id/hopper_histories',auth[_0x86a1('0xb')](),controller[_0x86a1('0x10')]);router[_0x86a1('0xa')](_0x86a1('0x11'),auth[_0x86a1('0xb')](),controller[_0x86a1('0x12')]);router[_0x86a1('0xa')](_0x86a1('0x13'),auth[_0x86a1('0xb')](),controller[_0x86a1('0x14')]);router['get']('/:id/teams',auth[_0x86a1('0xb')](),controller['getTeams']);router[_0x86a1('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0x86a1('0x15')]);router['get'](_0x86a1('0x16'),auth['isAuthenticated'](),controller[_0x86a1('0x17')]);router[_0x86a1('0xa')](_0x86a1('0x18'),auth[_0x86a1('0xb')](),controller['getLists']);router[_0x86a1('0xa')](_0x86a1('0x19'),auth[_0x86a1('0xb')](),controller['getBlackLists']);router[_0x86a1('0x1a')]('/',auth[_0x86a1('0xb')](),controller[_0x86a1('0x1b')]);router[_0x86a1('0x1a')]('/:id/clone',auth[_0x86a1('0xb')](),controller[_0x86a1('0x1c')]);router['post'](_0x86a1('0x1d'),auth['isAuthenticated'](),controller['addTeams']);router[_0x86a1('0x1a')](_0x86a1('0x1e'),auth[_0x86a1('0xb')](),controller[_0x86a1('0x1f')]);router[_0x86a1('0x1a')]('/:id/lists',auth[_0x86a1('0xb')](),controller[_0x86a1('0x20')]);router[_0x86a1('0x1a')](_0x86a1('0x19'),auth[_0x86a1('0xb')](),controller['addBlackLists']);router[_0x86a1('0x21')](_0x86a1('0x22'),auth[_0x86a1('0xb')](),controller['update']);router[_0x86a1('0x23')](_0x86a1('0x22'),auth[_0x86a1('0xb')](),controller[_0x86a1('0x24')]);router['delete'](_0x86a1('0x1d'),auth['isAuthenticated'](),controller[_0x86a1('0x25')]);router[_0x86a1('0x23')](_0x86a1('0x1e'),auth[_0x86a1('0xb')](),controller['removeAgents']);router[_0x86a1('0x23')](_0x86a1('0x18'),auth[_0x86a1('0xb')](),controller[_0x86a1('0x26')]);router[_0x86a1('0x23')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x86a1('0x27')]);module['exports']=router; \ No newline at end of file +var _0x4425=['addTeams','addAgents','addLists','addBlackLists','put','delete','destroy','removeTeams','removeAgents','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','show','/:id/hoppers','isAuthenticated','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getMembers','/:id/lists','getLists','/:id/blacklists','post','/:id/clone','clone'];(function(_0x1ee551,_0x19ed14){var _0xafc541=function(_0x5f57ed){while(--_0x5f57ed){_0x1ee551['push'](_0x1ee551['shift']());}};_0xafc541(++_0x19ed14);}(_0x4425,0x185));var _0x5442=function(_0x499322,_0x5f3c40){_0x499322=_0x499322-0x0;var _0x444136=_0x4425[_0x499322];return _0x444136;};'use strict';var multer=require(_0x5442('0x0'));var util=require(_0x5442('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5442('0x2'));var router=express[_0x5442('0x3')]();var auth=require(_0x5442('0x4'));var interaction=require(_0x5442('0x5'));var config=require(_0x5442('0x6'));var controller=require(_0x5442('0x7'));router[_0x5442('0x8')]('/',auth['isAuthenticated'](),controller[_0x5442('0x9')]);router[_0x5442('0x8')](_0x5442('0xa'),auth['isAuthenticated'](),controller[_0x5442('0xb')]);router['get'](_0x5442('0xc'),auth[_0x5442('0xd')](),controller['getHoppers']);router[_0x5442('0x8')](_0x5442('0xe'),auth[_0x5442('0xd')](),controller['getHopperHistories']);router['get'](_0x5442('0xf'),auth[_0x5442('0xd')](),controller[_0x5442('0x10')]);router[_0x5442('0x8')](_0x5442('0x11'),auth['isAuthenticated'](),controller[_0x5442('0x12')]);router['get'](_0x5442('0x13'),auth[_0x5442('0xd')](),controller[_0x5442('0x14')]);router[_0x5442('0x8')](_0x5442('0x15'),auth[_0x5442('0xd')](),controller['getAgents']);router[_0x5442('0x8')]('/:id/members',auth[_0x5442('0xd')](),controller[_0x5442('0x16')]);router[_0x5442('0x8')](_0x5442('0x17'),auth[_0x5442('0xd')](),controller[_0x5442('0x18')]);router[_0x5442('0x8')](_0x5442('0x19'),auth['isAuthenticated'](),controller['getBlackLists']);router['post']('/',auth[_0x5442('0xd')](),controller['create']);router[_0x5442('0x1a')](_0x5442('0x1b'),auth[_0x5442('0xd')](),controller[_0x5442('0x1c')]);router[_0x5442('0x1a')]('/:id/teams',auth[_0x5442('0xd')](),controller[_0x5442('0x1d')]);router[_0x5442('0x1a')](_0x5442('0x15'),auth['isAuthenticated'](),controller[_0x5442('0x1e')]);router[_0x5442('0x1a')](_0x5442('0x17'),auth[_0x5442('0xd')](),controller[_0x5442('0x1f')]);router[_0x5442('0x1a')](_0x5442('0x19'),auth['isAuthenticated'](),controller[_0x5442('0x20')]);router[_0x5442('0x21')](_0x5442('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x5442('0x22')](_0x5442('0xa'),auth['isAuthenticated'](),controller[_0x5442('0x23')]);router['delete'](_0x5442('0x13'),auth[_0x5442('0xd')](),controller[_0x5442('0x24')]);router[_0x5442('0x22')](_0x5442('0x15'),auth[_0x5442('0xd')](),controller[_0x5442('0x25')]);router[_0x5442('0x22')](_0x5442('0x17'),auth[_0x5442('0xd')](),controller['removeLists']);router[_0x5442('0x22')](_0x5442('0x19'),auth['isAuthenticated'](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 6c46979..fb74c22 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(_0x206c5a,_0xd53a88){var _0x16e118=function(_0x31dbb3){while(--_0x31dbb3){_0x206c5a['push'](_0x206c5a['shift']());}};_0x16e118(++_0xd53a88);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x192cff,_0x361327){var _0x20d2f6=function(_0x37baf9){while(--_0x37baf9){_0x192cff['push'](_0x192cff['shift']());}};_0x20d2f6(++_0x361327);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 5dffc44..b2135f1 100644 --- a/server/api/voiceQueue/voiceQueue.controller.js +++ b/server/api/voiceQueue/voiceQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','SELECT','every','all','union','compact','transaction','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','omit','spread','userVoiceQueue:save','push','isArray','getAgents','getMembers','getLists','CmList','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./voiceQueue.socket','sendStatus','status','json','count','offset','limit','apply','save','update','then','destroy','get','inbound','QueueCampaigns','filter','ignore','map','value','includes','type','find','UserProfileResource','end','error','name','send','index','VoiceQueue','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','includeAll','rows','catch','show','params','length','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','outbound','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','role','UserProfileSection','getHoppers','findOne','VoiceQueueId','CmHopper','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','emit','removeTeams','ids','select'];(function(_0x5622d4,_0x396780){var _0x353176=function(_0x3d1ede){while(--_0x3d1ede){_0x5622d4['push'](_0x5622d4['shift']());}};_0x353176(++_0x396780);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1b745b,_0x3e2d40){_0x1b745b=_0x1b745b-0x0;var _0x120a9d=_0xcb91[_0x1b745b];return _0x120a9d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xd'));var authService=require(_0x1cb9('0xe'));var qs=require(_0x1cb9('0xf'));var as=require(_0x1cb9('0x10'));var hardwareService=require(_0x1cb9('0x11'));var logger=require('../../config/logger')(_0x1cb9('0x12'));var utils=require(_0x1cb9('0x13'));var config=require(_0x1cb9('0x14'));var licenseUtil=require(_0x1cb9('0x15'));var db=require(_0x1cb9('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x1cb9('0x17'),'port':0x18eb});var socket=require(_0x1cb9('0x18'))(new Redis(config[_0x1cb9('0x19')]));require(_0x1cb9('0x1a'))['register'](socket);function respondWithStatusCode(_0x397727,_0x6ef389){_0x6ef389=_0x6ef389||0xcc;return function(_0x1b3cd7){if(_0x1b3cd7){return _0x397727[_0x1cb9('0x1b')](_0x6ef389);}return _0x397727[_0x1cb9('0x1c')](_0x6ef389)['end']();};}function respondWithResult(_0x5572cb,_0xd446a3){_0xd446a3=_0xd446a3||0xc8;return function(_0x3cc765){if(_0x3cc765){return _0x5572cb[_0x1cb9('0x1c')](_0xd446a3)[_0x1cb9('0x1d')](_0x3cc765);}};}function respondWithFilteredResult(_0x3e21e0,_0xf22920){return function(_0x23d3a9){if(_0x23d3a9){var _0x4e1340=_0x23d3a9[_0x1cb9('0x1e')],_0x479d43=_0xf22920[_0x1cb9('0x1f')],_0x1b2fa6=_0xf22920[_0x1cb9('0x1f')]+_0xf22920[_0x1cb9('0x20')],_0x41ac41;if(_0x1b2fa6>=_0x4e1340){_0x1b2fa6=_0x4e1340;_0x41ac41=0xc8;}else{_0x41ac41=0xce;}_0x3e21e0[_0x1cb9('0x1c')](_0x41ac41);return _0x3e21e0['set']('Content-Range',_0x479d43+'-'+_0x1b2fa6+'/'+_0x4e1340)[_0x1cb9('0x1d')](_0x23d3a9);}return null;};}function patchUpdates(_0x5dbfae){return function(_0x4750b1){try{jsonpatch[_0x1cb9('0x21')](_0x4750b1,_0x5dbfae,!![]);}catch(_0x523b26){return BPromise['reject'](_0x523b26);}return _0x4750b1[_0x1cb9('0x22')]();};}function saveUpdates(_0x325637,_0x103a63){return function(_0x4601b8){if(_0x4601b8){return _0x4601b8[_0x1cb9('0x23')](_0x325637)[_0x1cb9('0x24')](function(_0x59ebea){return _0x59ebea;});}return null;};}function removeEntity(_0x55b232,_0x6c6f61){return function(_0x557199){if(_0x557199){return _0x557199[_0x1cb9('0x25')]()[_0x1cb9('0x24')](function(){var _0x69b4c8=_0x557199[_0x1cb9('0x26')]({'plain':!![]});var _0x43a100=[{'name':'VoiceQueues','value':_0x1cb9('0x27'),'ignore':![]},{'name':_0x1cb9('0x28'),'value':'outbound','ignore':![]}];var _0xd6891c=_(_0x43a100)[_0x1cb9('0x29')](_0x1cb9('0x2a'))[_0x1cb9('0x2b')](_0x1cb9('0x2c'))[_0x1cb9('0x2c')]();if(_[_0x1cb9('0x2d')](_0xd6891c,_0x69b4c8[_0x1cb9('0x2e')])){return;}var _0x41e5c2=_[_0x1cb9('0x2f')](_0x43a100,['value',_0x69b4c8[_0x1cb9('0x2e')]])['name'];return db[_0x1cb9('0x30')]['destroy']({'where':{'type':_0x41e5c2,'resourceId':_0x69b4c8['id']}})[_0x1cb9('0x24')](function(){return _0x557199;});})[_0x1cb9('0x24')](function(){_0x55b232[_0x1cb9('0x1c')](0xcc)[_0x1cb9('0x31')]();});}};}function handleEntityNotFound(_0x561d89,_0x1c701f){return function(_0x4eba82){if(!_0x4eba82){_0x561d89[_0x1cb9('0x1b')](0x194);}return _0x4eba82;};}function handleError(_0x336a98,_0x4220d7){_0x4220d7=_0x4220d7||0x1f4;return function(_0x5d8793){logger[_0x1cb9('0x32')](_0x5d8793['stack']);if(_0x5d8793[_0x1cb9('0x33')]){delete _0x5d8793['name'];}_0x336a98[_0x1cb9('0x1c')](_0x4220d7)[_0x1cb9('0x34')](_0x5d8793);};}exports[_0x1cb9('0x35')]=function(_0xae910,_0x56c3e0){var _0x2114a4={},_0xf71b9a={},_0x3467d5={'count':0x0,'rows':[]};var _0x91a1db=_[_0x1cb9('0x2b')](db[_0x1cb9('0x36')][_0x1cb9('0x37')],function(_0x1ed5ad){return{'name':_0x1ed5ad[_0x1cb9('0x38')],'type':_0x1ed5ad[_0x1cb9('0x2e')][_0x1cb9('0x39')]};});_0xf71b9a[_0x1cb9('0x3a')]=_[_0x1cb9('0x2b')](_0x91a1db,'name');_0xf71b9a['query']=_[_0x1cb9('0x3b')](_0xae910[_0x1cb9('0x3c')]);_0xf71b9a[_0x1cb9('0x3d')]=_[_0x1cb9('0x3e')](_0xf71b9a[_0x1cb9('0x3a')],_0xf71b9a[_0x1cb9('0x3c')]);_0x2114a4[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0xf71b9a['model'],qs[_0x1cb9('0x40')](_0xae910[_0x1cb9('0x3c')][_0x1cb9('0x40')]));_0x2114a4['attributes']=_0x2114a4[_0x1cb9('0x3f')]['length']?_0x2114a4[_0x1cb9('0x3f')]:_0xf71b9a['model'];if(!_0xae910[_0x1cb9('0x3c')][_0x1cb9('0x41')](_0x1cb9('0x42'))){_0x2114a4[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0xae910[_0x1cb9('0x3c')][_0x1cb9('0x20')]);_0x2114a4['offset']=qs['offset'](_0xae910[_0x1cb9('0x3c')][_0x1cb9('0x1f')]);}_0x2114a4[_0x1cb9('0x43')]=qs[_0x1cb9('0x44')](_0xae910[_0x1cb9('0x3c')][_0x1cb9('0x44')]);_0x2114a4[_0x1cb9('0x45')]=qs['filters'](_[_0x1cb9('0x46')](_0xae910['query'],_0xf71b9a['filters']),_0x91a1db);if(_0xae910['query'][_0x1cb9('0x29')]){_0x2114a4[_0x1cb9('0x45')]=_[_0x1cb9('0x47')](_0x2114a4[_0x1cb9('0x45')],{'$or':_[_0x1cb9('0x2b')](_0x91a1db,function(_0x4f551f){if(_0x4f551f[_0x1cb9('0x2e')]!=='VIRTUAL'){var _0x91121={};_0x91121[_0x4f551f[_0x1cb9('0x33')]]={'$like':'%'+_0xae910[_0x1cb9('0x3c')]['filter']+'%'};return _0x91121;}})});}_0x2114a4=_[_0x1cb9('0x47')]({},_0x2114a4,_0xae910['options']);var _0xda1a44={'where':_0x2114a4[_0x1cb9('0x45')]};return db['VoiceQueue']['count'](_0xda1a44)[_0x1cb9('0x24')](function(_0x339829){_0x3467d5[_0x1cb9('0x1e')]=_0x339829;if(_0xae910[_0x1cb9('0x3c')][_0x1cb9('0x48')]){_0x2114a4['include']=[{'all':!![]}];}return db[_0x1cb9('0x36')]['findAll'](_0x2114a4);})['then'](function(_0x495335){_0x3467d5[_0x1cb9('0x49')]=_0x495335;return _0x3467d5;})[_0x1cb9('0x24')](respondWithFilteredResult(_0x56c3e0,_0x2114a4))[_0x1cb9('0x4a')](handleError(_0x56c3e0,null));};exports[_0x1cb9('0x4b')]=function(_0x116c05,_0x2a8b7f){var _0x40ca68={'raw':![],'where':{'id':_0x116c05[_0x1cb9('0x4c')]['id']}},_0x409b89={};_0x409b89[_0x1cb9('0x3a')]=_[_0x1cb9('0x3b')](db['VoiceQueue'][_0x1cb9('0x37')]);_0x409b89[_0x1cb9('0x3c')]=_[_0x1cb9('0x3b')](_0x116c05['query']);_0x409b89[_0x1cb9('0x3d')]=_[_0x1cb9('0x3e')](_0x409b89[_0x1cb9('0x3a')],_0x409b89[_0x1cb9('0x3c')]);_0x40ca68[_0x1cb9('0x3f')]=_['intersection'](_0x409b89[_0x1cb9('0x3a')],qs['fields'](_0x116c05[_0x1cb9('0x3c')]['fields']));_0x40ca68[_0x1cb9('0x3f')]=_0x40ca68[_0x1cb9('0x3f')][_0x1cb9('0x4d')]?_0x40ca68[_0x1cb9('0x3f')]:_0x409b89['model'];if(_0x116c05[_0x1cb9('0x3c')][_0x1cb9('0x48')]){_0x40ca68[_0x1cb9('0x4e')]=[{'all':!![]}];}_0x40ca68=_[_0x1cb9('0x47')]({},_0x40ca68,_0x116c05[_0x1cb9('0x4f')]);return db[_0x1cb9('0x36')][_0x1cb9('0x2f')](_0x40ca68)[_0x1cb9('0x24')](handleEntityNotFound(_0x2a8b7f,null))[_0x1cb9('0x24')](respondWithResult(_0x2a8b7f,null))[_0x1cb9('0x4a')](handleError(_0x2a8b7f,null));};exports['create']=function(_0x5092a6,_0x28c65d){return db[_0x1cb9('0x36')][_0x1cb9('0x50')](_0x5092a6[_0x1cb9('0x51')],{})[_0x1cb9('0x24')](function(_0x2d076b){var _0x367dd7=_0x5092a6[_0x1cb9('0x52')][_0x1cb9('0x26')]({'plain':!![]});if(!_0x367dd7)throw new Error(_0x1cb9('0x53'));if(_0x367dd7['role']===_0x1cb9('0x52')){var _0x5e773d=_0x2d076b[_0x1cb9('0x26')]({'plain':!![]});var _0x5201e8=[{'name':_0x1cb9('0x54'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x1cb9('0x55')}];var _0x3b0c2e=_[_0x1cb9('0x2f')](_0x5201e8,['value',_0x5e773d[_0x1cb9('0x2e')]])[_0x1cb9('0x33')];return db['UserProfileSection']['find']({'where':{'name':_0x3b0c2e,'userProfileId':_0x367dd7[_0x1cb9('0x56')]},'raw':!![]})[_0x1cb9('0x24')](function(_0x3e70fc){if(_0x3e70fc&&_0x3e70fc[_0x1cb9('0x57')]===0x0){return db[_0x1cb9('0x30')][_0x1cb9('0x50')]({'name':_0x5e773d[_0x1cb9('0x33')],'resourceId':_0x5e773d['id'],'type':_0x3e70fc['name'],'sectionId':_0x3e70fc['id']},{})[_0x1cb9('0x24')](function(){return _0x2d076b;});}else{return _0x2d076b;}})[_0x1cb9('0x4a')](function(_0x108551){logger['error'](_0x1cb9('0x58'),_0x108551);throw _0x108551;});}return _0x2d076b;})[_0x1cb9('0x24')](respondWithResult(_0x28c65d,0xc9))[_0x1cb9('0x4a')](handleError(_0x28c65d,null));};exports[_0x1cb9('0x59')]=function(_0x12d283,_0x3c4681){var _0x5ae762={'where':{'id':_0x12d283[_0x1cb9('0x4c')]['id']}},_0x37ceb5={};_0x37ceb5[_0x1cb9('0x3a')]=_[_0x1cb9('0x3b')](db[_0x1cb9('0x36')][_0x1cb9('0x37')]);_0x5ae762[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x37ceb5[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x12d283[_0x1cb9('0x3c')]['fields']));_0x5ae762[_0x1cb9('0x3f')]=_0x5ae762[_0x1cb9('0x3f')][_0x1cb9('0x4d')]?_0x5ae762[_0x1cb9('0x3f')]:_0x37ceb5['model'];if(_0x12d283['query'][_0x1cb9('0x48')]){_0x5ae762[_0x1cb9('0x4e')]=[{'all':!![]}];}_0x5ae762=_[_0x1cb9('0x47')]({},_0x5ae762,_0x12d283[_0x1cb9('0x4f')]);return db[_0x1cb9('0x36')][_0x1cb9('0x2f')](_0x5ae762)[_0x1cb9('0x24')](handleEntityNotFound(_0x3c4681,null))[_0x1cb9('0x24')](function(_0x478bba){if(_0x478bba){var _0x49f74c=_0x478bba[_0x1cb9('0x26')]({'plain':!![]});_0x49f74c=qs['omit'](_0x49f74c,['id','createdAt','updatedAt']);_0x12d283['body']=_['omit'](_0x12d283[_0x1cb9('0x51')],['id',_0x1cb9('0x5a'),_0x1cb9('0x5b')]);return db[_0x1cb9('0x36')][_0x1cb9('0x50')](_[_0x1cb9('0x47')](_0x49f74c,_0x12d283['body']),{'include':_0x12d283[_0x1cb9('0x3c')][_0x1cb9('0x48')]?[{'all':!![]}]:undefined})['then'](function(_0x58c7ed){var _0x150441=_0x12d283[_0x1cb9('0x52')][_0x1cb9('0x26')]({'plain':!![]});if(!_0x150441)throw new Error(_0x1cb9('0x53'));if(_0x150441[_0x1cb9('0x5c')]==='user'){var _0x538ff0=_0x58c7ed['get']({'plain':!![]});var _0x270282=[{'name':_0x1cb9('0x54'),'value':_0x1cb9('0x27')},{'name':_0x1cb9('0x28'),'value':_0x1cb9('0x55')}];var _0x59bad0=_[_0x1cb9('0x2f')](_0x270282,[_0x1cb9('0x2c'),_0x538ff0['type']])['name'];return db[_0x1cb9('0x5d')]['find']({'where':{'name':_0x59bad0,'userProfileId':_0x150441[_0x1cb9('0x56')]},'raw':!![]})[_0x1cb9('0x24')](function(_0x2c54ea){if(_0x2c54ea&&_0x2c54ea[_0x1cb9('0x57')]===0x0){return db[_0x1cb9('0x30')][_0x1cb9('0x50')]({'name':_0x538ff0['name'],'resourceId':_0x538ff0['id'],'type':_0x2c54ea[_0x1cb9('0x33')],'sectionId':_0x2c54ea['id']},{})[_0x1cb9('0x24')](function(){return _0x58c7ed;});}else{return _0x58c7ed;}})[_0x1cb9('0x4a')](function(_0x17c361){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17c361);throw _0x17c361;});}return _0x58c7ed;});}})[_0x1cb9('0x24')](respondWithResult(_0x3c4681,0xc9))[_0x1cb9('0x4a')](handleError(_0x3c4681,null));};exports[_0x1cb9('0x23')]=function(_0x1ee140,_0x210b0b){if(_0x1ee140[_0x1cb9('0x51')]['id']){delete _0x1ee140['body']['id'];}return db[_0x1cb9('0x36')]['find']({'where':{'id':_0x1ee140[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x210b0b,null))['then'](saveUpdates(_0x1ee140[_0x1cb9('0x51')],null))[_0x1cb9('0x24')](respondWithResult(_0x210b0b,null))[_0x1cb9('0x4a')](handleError(_0x210b0b,null));};exports['destroy']=function(_0x1b4878,_0x95be29){return db[_0x1cb9('0x36')][_0x1cb9('0x2f')]({'where':{'id':_0x1b4878[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x95be29,null))['then'](removeEntity(_0x95be29,null))[_0x1cb9('0x4a')](handleError(_0x95be29,null));};exports[_0x1cb9('0x5e')]=function(_0x38d6a7,_0x4398dc,_0x3d3c1a){var _0x1da41c={'raw':![],'where':{}};var _0x128a41={};var _0x37bcd9={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x1cb9('0x5f')]({'where':{'id':_0x38d6a7[_0x1cb9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4398dc,null))[_0x1cb9('0x24')](function(_0x5415fa){if(_0x5415fa){_0x128a41[_0x1cb9('0x3a')]=_['keys'](db['CmHopper'][_0x1cb9('0x37')]);_0x128a41[_0x1cb9('0x3c')]=_['keys'](_0x38d6a7[_0x1cb9('0x3c')]);_0x128a41['filters']=_[_0x1cb9('0x3e')](_0x128a41[_0x1cb9('0x3a')],_0x128a41[_0x1cb9('0x3c')]);_0x1da41c[_0x1cb9('0x3f')]=_['intersection'](_0x128a41[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x40')]));_0x1da41c[_0x1cb9('0x3f')]=_0x1da41c[_0x1cb9('0x3f')]['length']?_0x1da41c[_0x1cb9('0x3f')]:_0x128a41[_0x1cb9('0x3a')];if(!_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x41')](_0x1cb9('0x42'))){_0x1da41c[_0x1cb9('0x20')]=qs['limit'](_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x20')]);_0x1da41c['offset']=qs[_0x1cb9('0x1f')](_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x1f')]);}_0x1da41c[_0x1cb9('0x43')]=qs[_0x1cb9('0x44')](_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x44')]);_0x1da41c['where']=qs[_0x1cb9('0x3d')](_['pick'](_0x38d6a7[_0x1cb9('0x3c')],_0x128a41[_0x1cb9('0x3d')]));_0x1da41c['where'][_0x1cb9('0x60')]=_0x5415fa['id'];if(_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x29')]){_0x1da41c[_0x1cb9('0x45')]=_['merge'](_0x1da41c[_0x1cb9('0x45')],{'$or':_[_0x1cb9('0x2b')](_0x1da41c[_0x1cb9('0x3f')],function(_0x5d0e8c){var _0x10f13e={};_0x10f13e[_0x5d0e8c]={'$like':'%'+_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x29')]+'%'};return _0x10f13e;})});}_0x1da41c=_[_0x1cb9('0x47')]({},_0x1da41c,_0x38d6a7[_0x1cb9('0x4f')]);return db[_0x1cb9('0x61')][_0x1cb9('0x1e')]({'where':_0x1da41c['where']})[_0x1cb9('0x24')](function(_0x4b15a4){_0x37bcd9[_0x1cb9('0x1e')]=_0x4b15a4;if(_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x48')]){_0x1da41c[_0x1cb9('0x4e')]=[{'all':!![]}];}return db['CmHopper'][_0x1cb9('0x62')](_0x1da41c);})[_0x1cb9('0x24')](function(_0x5e68a1){_0x37bcd9[_0x1cb9('0x49')]=_0x5e68a1;return _0x37bcd9;});}})[_0x1cb9('0x24')](respondWithFilteredResult(_0x4398dc,_0x1da41c))[_0x1cb9('0x4a')](handleError(_0x4398dc,null));};exports[_0x1cb9('0x63')]=function(_0x453fa3,_0x52a3f1,_0x5e0e56){var _0x544d2d={'raw':!![],'where':{}};var _0x5ad853={};var _0x19daa1={'count':0x0,'rows':[]};return db[_0x1cb9('0x36')][_0x1cb9('0x5f')]({'where':{'id':_0x453fa3[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x52a3f1,null))[_0x1cb9('0x24')](function(_0x1e6402){if(_0x1e6402){_0x5ad853[_0x1cb9('0x3a')]=_['keys'](db[_0x1cb9('0x64')][_0x1cb9('0x37')]);_0x5ad853[_0x1cb9('0x3c')]=_['keys'](_0x453fa3[_0x1cb9('0x3c')]);_0x5ad853[_0x1cb9('0x3d')]=_['intersection'](_0x5ad853[_0x1cb9('0x3a')],_0x5ad853[_0x1cb9('0x3c')]);_0x544d2d[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x5ad853['model'],qs[_0x1cb9('0x40')](_0x453fa3[_0x1cb9('0x3c')]['fields']));_0x544d2d['attributes']=_0x544d2d[_0x1cb9('0x3f')][_0x1cb9('0x4d')]?_0x544d2d['attributes']:_0x5ad853['model'];if(!_0x453fa3[_0x1cb9('0x3c')][_0x1cb9('0x41')]('nolimit')){_0x544d2d['limit']=qs[_0x1cb9('0x20')](_0x453fa3['query']['limit']);_0x544d2d['offset']=qs[_0x1cb9('0x1f')](_0x453fa3['query'][_0x1cb9('0x1f')]);}_0x544d2d[_0x1cb9('0x43')]=qs[_0x1cb9('0x44')](_0x453fa3['query'][_0x1cb9('0x44')]);_0x544d2d[_0x1cb9('0x45')]=qs[_0x1cb9('0x3d')](_['pick'](_0x453fa3[_0x1cb9('0x3c')],_0x5ad853[_0x1cb9('0x3d')]));_0x544d2d[_0x1cb9('0x45')][_0x1cb9('0x60')]=_0x1e6402['id'];if(_0x453fa3[_0x1cb9('0x3c')]['filter']){_0x544d2d[_0x1cb9('0x45')]=_[_0x1cb9('0x47')](_0x544d2d[_0x1cb9('0x45')],{'$or':_['map'](_0x544d2d[_0x1cb9('0x3f')],function(_0x81962d){var _0x534378={};_0x534378[_0x81962d]={'$like':'%'+_0x453fa3[_0x1cb9('0x3c')][_0x1cb9('0x29')]+'%'};return _0x534378;})});}_0x544d2d=_['merge']({},_0x544d2d,_0x453fa3[_0x1cb9('0x4f')]);return db[_0x1cb9('0x64')][_0x1cb9('0x1e')]({'where':_0x544d2d[_0x1cb9('0x45')]})[_0x1cb9('0x24')](function(_0x1768b8){_0x19daa1[_0x1cb9('0x1e')]=_0x1768b8;if(_0x453fa3[_0x1cb9('0x3c')][_0x1cb9('0x48')]){_0x544d2d[_0x1cb9('0x4e')]=[{'all':!![]}];}return db[_0x1cb9('0x64')][_0x1cb9('0x62')](_0x544d2d);})[_0x1cb9('0x24')](function(_0x1b2b1c){_0x19daa1[_0x1cb9('0x49')]=_0x1b2b1c;return _0x19daa1;});}})[_0x1cb9('0x24')](respondWithFilteredResult(_0x52a3f1,_0x544d2d))[_0x1cb9('0x4a')](handleError(_0x52a3f1,null));};exports[_0x1cb9('0x65')]=function(_0x48e879,_0x508a75,_0x13ba32){var _0x94d2c2={'raw':!![],'where':{}};var _0x20af42={};var _0x35f64f={'count':0x0,'rows':[]};return db[_0x1cb9('0x36')][_0x1cb9('0x5f')]({'where':{'id':_0x48e879[_0x1cb9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x508a75,null))['then'](function(_0x1d14a4){if(_0x1d14a4){_0x20af42[_0x1cb9('0x3a')]=_[_0x1cb9('0x3b')](db[_0x1cb9('0x66')][_0x1cb9('0x37')]);_0x20af42['query']=_[_0x1cb9('0x3b')](_0x48e879[_0x1cb9('0x3c')]);_0x20af42[_0x1cb9('0x3d')]=_['intersection'](_0x20af42[_0x1cb9('0x3a')],_0x20af42[_0x1cb9('0x3c')]);_0x94d2c2[_0x1cb9('0x3f')]=_['intersection'](_0x20af42[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x48e879[_0x1cb9('0x3c')]['fields']));_0x94d2c2['attributes']=_0x94d2c2['attributes'][_0x1cb9('0x4d')]?_0x94d2c2[_0x1cb9('0x3f')]:_0x20af42[_0x1cb9('0x3a')];if(!_0x48e879['query'][_0x1cb9('0x41')]('nolimit')){_0x94d2c2['limit']=qs[_0x1cb9('0x20')](_0x48e879[_0x1cb9('0x3c')][_0x1cb9('0x20')]);_0x94d2c2[_0x1cb9('0x1f')]=qs[_0x1cb9('0x1f')](_0x48e879[_0x1cb9('0x3c')][_0x1cb9('0x1f')]);}_0x94d2c2[_0x1cb9('0x43')]=qs[_0x1cb9('0x44')](_0x48e879[_0x1cb9('0x3c')]['sort']);_0x94d2c2['where']=qs[_0x1cb9('0x3d')](_[_0x1cb9('0x46')](_0x48e879['query'],_0x20af42['filters']));_0x94d2c2['where']['VoiceQueueId']=_0x1d14a4['id'];if(_0x48e879[_0x1cb9('0x3c')][_0x1cb9('0x29')]){_0x94d2c2['where']=_[_0x1cb9('0x47')](_0x94d2c2[_0x1cb9('0x45')],{'$or':_[_0x1cb9('0x2b')](_0x94d2c2[_0x1cb9('0x3f')],function(_0x169b0f){var _0x5218ea={};_0x5218ea[_0x169b0f]={'$like':'%'+_0x48e879[_0x1cb9('0x3c')][_0x1cb9('0x29')]+'%'};return _0x5218ea;})});}_0x94d2c2=_[_0x1cb9('0x47')]({},_0x94d2c2,_0x48e879[_0x1cb9('0x4f')]);return db['CmHopperFinal'][_0x1cb9('0x1e')]({'where':_0x94d2c2[_0x1cb9('0x45')]})['then'](function(_0x5ee95a){_0x35f64f['count']=_0x5ee95a;if(_0x48e879[_0x1cb9('0x3c')]['includeAll']){_0x94d2c2[_0x1cb9('0x4e')]=[{'all':!![]}];}return db[_0x1cb9('0x66')][_0x1cb9('0x62')](_0x94d2c2);})[_0x1cb9('0x24')](function(_0x31d1e5){_0x35f64f[_0x1cb9('0x49')]=_0x31d1e5;return _0x35f64f;});}})['then'](respondWithFilteredResult(_0x508a75,_0x94d2c2))[_0x1cb9('0x4a')](handleError(_0x508a75,null));};exports[_0x1cb9('0x67')]=function(_0x3726ba,_0x242cad,_0x699d37){var _0xf8e83f={'raw':!![],'where':{}};var _0x237e3b={};var _0x21e3fb={'count':0x0,'rows':[]};return db[_0x1cb9('0x36')][_0x1cb9('0x5f')]({'where':{'id':_0x3726ba[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x242cad,null))[_0x1cb9('0x24')](function(_0x1022d8){if(_0x1022d8){_0x237e3b[_0x1cb9('0x3a')]=_['keys'](db['CmHopperBlack']['rawAttributes']);_0x237e3b[_0x1cb9('0x3c')]=_[_0x1cb9('0x3b')](_0x3726ba['query']);_0x237e3b[_0x1cb9('0x3d')]=_[_0x1cb9('0x3e')](_0x237e3b[_0x1cb9('0x3a')],_0x237e3b['query']);_0xf8e83f[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x237e3b[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x3726ba[_0x1cb9('0x3c')]['fields']));_0xf8e83f[_0x1cb9('0x3f')]=_0xf8e83f['attributes']['length']?_0xf8e83f[_0x1cb9('0x3f')]:_0x237e3b[_0x1cb9('0x3a')];if(!_0x3726ba[_0x1cb9('0x3c')][_0x1cb9('0x41')](_0x1cb9('0x42'))){_0xf8e83f[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x3726ba[_0x1cb9('0x3c')]['limit']);_0xf8e83f[_0x1cb9('0x1f')]=qs[_0x1cb9('0x1f')](_0x3726ba[_0x1cb9('0x3c')][_0x1cb9('0x1f')]);}_0xf8e83f[_0x1cb9('0x43')]=qs['sort'](_0x3726ba[_0x1cb9('0x3c')][_0x1cb9('0x44')]);_0xf8e83f[_0x1cb9('0x45')]=qs[_0x1cb9('0x3d')](_[_0x1cb9('0x46')](_0x3726ba['query'],_0x237e3b[_0x1cb9('0x3d')]));_0xf8e83f[_0x1cb9('0x45')][_0x1cb9('0x60')]=_0x1022d8['id'];if(_0x3726ba['query'][_0x1cb9('0x29')]){_0xf8e83f[_0x1cb9('0x45')]=_[_0x1cb9('0x47')](_0xf8e83f[_0x1cb9('0x45')],{'$or':_[_0x1cb9('0x2b')](_0xf8e83f[_0x1cb9('0x3f')],function(_0x4e3ad0){var _0x45dc8c={};_0x45dc8c[_0x4e3ad0]={'$like':'%'+_0x3726ba[_0x1cb9('0x3c')][_0x1cb9('0x29')]+'%'};return _0x45dc8c;})});}_0xf8e83f=_['merge']({},_0xf8e83f,_0x3726ba[_0x1cb9('0x4f')]);return db[_0x1cb9('0x68')]['count']({'where':_0xf8e83f['where']})[_0x1cb9('0x24')](function(_0x3fc823){_0x21e3fb[_0x1cb9('0x1e')]=_0x3fc823;if(_0x3726ba[_0x1cb9('0x3c')][_0x1cb9('0x48')]){_0xf8e83f['include']=[{'all':!![]}];}return db[_0x1cb9('0x68')][_0x1cb9('0x62')](_0xf8e83f);})[_0x1cb9('0x24')](function(_0x3180dd){_0x21e3fb[_0x1cb9('0x49')]=_0x3180dd;return _0x21e3fb;});}})['then'](respondWithFilteredResult(_0x242cad,_0xf8e83f))['catch'](handleError(_0x242cad,null));};exports[_0x1cb9('0x69')]=function(_0x35383b,_0x9f2cb1,_0x4f7cc8){var _0x53c35a={};var _0x40d403={};var _0x3c4b2b;var _0x33d06a;return db['VoiceQueue']['findOne']({'where':{'id':_0x35383b['params']['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x9f2cb1,null))[_0x1cb9('0x24')](function(_0x27995f){if(_0x27995f){_0x3c4b2b=_0x27995f;_0x40d403['model']=_[_0x1cb9('0x3b')](db['Team'][_0x1cb9('0x37')]);_0x40d403[_0x1cb9('0x3c')]=_[_0x1cb9('0x3b')](_0x35383b[_0x1cb9('0x3c')]);_0x40d403[_0x1cb9('0x3d')]=_['intersection'](_0x40d403[_0x1cb9('0x3a')],_0x40d403['query']);_0x53c35a[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x40d403[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x35383b[_0x1cb9('0x3c')]['fields']));_0x53c35a[_0x1cb9('0x3f')]=_0x53c35a[_0x1cb9('0x3f')][_0x1cb9('0x4d')]?_0x53c35a[_0x1cb9('0x3f')]:_0x40d403[_0x1cb9('0x3a')];_0x53c35a[_0x1cb9('0x43')]=qs[_0x1cb9('0x44')](_0x35383b['query']['sort']);_0x53c35a[_0x1cb9('0x45')]=qs[_0x1cb9('0x3d')](_[_0x1cb9('0x46')](_0x35383b[_0x1cb9('0x3c')],_0x40d403[_0x1cb9('0x3d')]));if(_0x35383b['query'][_0x1cb9('0x29')]){_0x53c35a[_0x1cb9('0x45')]=_['merge'](_0x53c35a['where'],{'$or':_[_0x1cb9('0x2b')](_0x53c35a['attributes'],function(_0x2f5a5f){var _0x4af9bb={};_0x4af9bb[_0x2f5a5f]={'$like':'%'+_0x35383b[_0x1cb9('0x3c')][_0x1cb9('0x29')]+'%'};return _0x4af9bb;})});}_0x53c35a=_[_0x1cb9('0x47')]({},_0x53c35a,_0x35383b[_0x1cb9('0x4f')]);return _0x3c4b2b[_0x1cb9('0x69')](_0x53c35a);}})[_0x1cb9('0x24')](function(_0x2c7326){if(_0x2c7326){_0x33d06a=_0x2c7326[_0x1cb9('0x4d')];if(!_0x35383b[_0x1cb9('0x3c')][_0x1cb9('0x41')](_0x1cb9('0x42'))){_0x53c35a[_0x1cb9('0x20')]=qs['limit'](_0x35383b['query']['limit']);_0x53c35a['offset']=qs[_0x1cb9('0x1f')](_0x35383b[_0x1cb9('0x3c')]['offset']);}return _0x3c4b2b['getTeams'](_0x53c35a);}})['then'](function(_0x3cf4ff){if(_0x3cf4ff){return _0x3cf4ff?{'count':_0x33d06a,'rows':_0x3cf4ff}:null;}})[_0x1cb9('0x24')](respondWithResult(_0x9f2cb1,null))[_0x1cb9('0x4a')](handleError(_0x9f2cb1,null));};exports[_0x1cb9('0x6a')]=function(_0x4d66d3,_0x178cba,_0x2492a0){var _0x436364=_0x4d66d3['body'][_0x1cb9('0x6b')];var _0x2d9fcb=_['map'](_0x436364,'id');return db[_0x1cb9('0x6c')]['findAll']({'where':{'id':_0x2d9fcb},'attributes':['id'],'include':[{'model':db[_0x1cb9('0x6d')],'as':_0x1cb9('0x6e'),'attributes':['id',_0x1cb9('0x33'),_0x1cb9('0x6f'),_0x1cb9('0x70'),_0x1cb9('0x71')],'raw':!![]}]})[_0x1cb9('0x24')](function(_0x4ea5ae){if(_0x4ea5ae){var _0x183bdb=_[_0x1cb9('0x72')](_0x4ea5ae,function(_0x21c0ab){var _0x384183=_0x21c0ab[_0x1cb9('0x26')]({'plain':!![]});_0x384183[_0x1cb9('0x6e')][_0x1cb9('0x73')](function(_0xd171b9){_0xd171b9[_0x1cb9('0x74')]=_[_0x1cb9('0x2f')](_0x436364,{'id':_0x384183['id']})['penalty'];});return _0x384183[_0x1cb9('0x6e')];});return db[_0x1cb9('0x36')][_0x1cb9('0x2f')]({'where':{'id':_0x4d66d3[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](function(_0x523fdb){return db[_0x1cb9('0x75')]['transaction'](function(_0x51770e){return _0x523fdb[_0x1cb9('0x6a')](_0x2d9fcb,{'transaction':_0x51770e})[_0x1cb9('0x24')](function(){return BPromise[_0x1cb9('0x76')](_0x183bdb,function(_0x182e0d){return db[_0x1cb9('0x77')][_0x1cb9('0x78')]({'where':{'UserId':_0x182e0d['id'],'VoiceQueueId':_0x4d66d3[_0x1cb9('0x4c')]['id']},'defaults':{'penalty':_0x182e0d[_0x1cb9('0x74')]},'transaction':_0x51770e});});})[_0x1cb9('0x24')](function(){return BPromise['each'](_['filter'](_0x183bdb,{'online':!![]}),function(_0x98f5cf){return db[_0x1cb9('0x79')][_0x1cb9('0x7a')]({'membername':_0x98f5cf[_0x1cb9('0x33')],'UserId':_0x98f5cf['id'],'queue_name':_0x523fdb[_0x1cb9('0x33')],'VoiceQueueId':_0x523fdb['id'],'interface':_[_0x1cb9('0x7b')](_0x98f5cf[_0x1cb9('0x71')])?util[_0x1cb9('0x7c')](_0x1cb9('0x7d'),_0x98f5cf[_0x1cb9('0x33')]):_0x98f5cf['interface'],'paused':_0x98f5cf[_0x1cb9('0x70')]||![],'penalty':_0x98f5cf[_0x1cb9('0x74')]},{'transaction':_0x51770e});});})[_0x1cb9('0x24')](function(){_0x183bdb[_0x1cb9('0x73')](function(_0xd38514){socket[_0x1cb9('0x7e')]('userVoiceQueue:save',{'UserId':_0xd38514['id'],'VoiceQueueId':_0x523fdb['id']});});});});});}})[_0x1cb9('0x24')](respondWithStatusCode(_0x178cba,null))[_0x1cb9('0x4a')](handleError(_0x178cba,null));};exports[_0x1cb9('0x7f')]=function(_0x40f1e3,_0x3d72d7,_0x1bf6a4){return db[_0x1cb9('0x6c')]['findAll']({'where':{'id':_0x40f1e3[_0x1cb9('0x3c')][_0x1cb9('0x80')]},'attributes':['id'],'include':[{'model':db[_0x1cb9('0x6d')],'as':_0x1cb9('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x1cb9('0x24')](handleEntityNotFound(_0x3d72d7,null))[_0x1cb9('0x24')](function(_0x399537){var _0x1ad996=_[_0x1cb9('0x2b')](_0x399537,'id');var _0x42622e=[];var _0x27390a=[];var _0x36761a=squel[_0x1cb9('0x81')]();_0x36761a[_0x1cb9('0x82')](_0x1cb9('0x83'))[_0x1cb9('0x84')](_0x1cb9('0x85'),'tq')[_0x1cb9('0x86')](_0x1cb9('0x87'),'ut',_0x1cb9('0x88'))[_0x1cb9('0x45')](_0x1cb9('0x89'),_0x40f1e3['params']['id']);for(var _0x11a83c=0x0;_0x11a83c<_0x399537[_0x1cb9('0x4d')];_0x11a83c+=0x1){let _0x16ec06=_0x399537[_0x11a83c];for(var _0x9ab004=0x0;_0x9ab004<_0x16ec06[_0x1cb9('0x6e')][_0x1cb9('0x4d')];_0x9ab004+=0x1){let _0x4cd6fc=_0x16ec06[_0x1cb9('0x6e')][_0x9ab004];var _0x56e26b=_0x36761a[_0x1cb9('0x59')]();_0x56e26b[_0x1cb9('0x45')](_0x1cb9('0x8a'),_0x4cd6fc['id']);_0x27390a['push'](db[_0x1cb9('0x75')][_0x1cb9('0x3c')](_0x56e26b[_0x1cb9('0x8b')](),{'type':db[_0x1cb9('0x75')]['QueryTypes'][_0x1cb9('0x8c')]})[_0x1cb9('0x24')](function(_0x3557bd){if(_0x3557bd[_0x1cb9('0x4d')]===0x1){return _0x4cd6fc['id'];}else{var _0x4f0c63=_[_0x1cb9('0x8d')](_[_0x1cb9('0x2b')](_0x3557bd,'TeamId'),function(_0x21d844){return _[_0x1cb9('0x2d')](_0x1ad996,_0x21d844);});if(_0x4f0c63){return _0x4cd6fc['id'];}}}));}}return BPromise[_0x1cb9('0x8e')](_0x27390a)[_0x1cb9('0x24')](function(_0x196350){_0x42622e=_(_0x42622e)[_0x1cb9('0x8f')](_0x196350)[_0x1cb9('0x90')]()[_0x1cb9('0x2c')]();return db[_0x1cb9('0x36')][_0x1cb9('0x2f')]({'where':{'id':_0x40f1e3[_0x1cb9('0x4c')]['id']}})['then'](function(_0x2d2180){return db['sequelize'][_0x1cb9('0x91')](function(_0x328e5a){return _0x2d2180[_0x1cb9('0x7f')](_0x40f1e3[_0x1cb9('0x3c')][_0x1cb9('0x80')],{'transaction':_0x328e5a})[_0x1cb9('0x24')](function(){if(!_[_0x1cb9('0x92')](_0x42622e)){return _0x2d2180[_0x1cb9('0x93')](_0x42622e,{'transaction':_0x328e5a})[_0x1cb9('0x24')](function(){return db[_0x1cb9('0x79')][_0x1cb9('0x25')]({'where':{'VoiceQueueId':_0x40f1e3[_0x1cb9('0x4c')]['id'],'UserId':_0x42622e},'transaction':_0x328e5a});});}})[_0x1cb9('0x24')](function(){_0x42622e['forEach'](function(_0x44b50d){socket[_0x1cb9('0x7e')](_0x1cb9('0x94'),{'UserId':_0x44b50d,'VoiceQueueId':_0x2d2180['id']});});});});});});})['then'](respondWithStatusCode(_0x3d72d7,null))['catch'](handleError(_0x3d72d7,null));};exports['addAgents']=function(_0x46e35d,_0x2dd501,_0x5018c5){var _0x47d696,_0x31627f;return db[_0x1cb9('0x36')][_0x1cb9('0x2f')]({'where':{'id':_0x46e35d[_0x1cb9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2dd501,null))[_0x1cb9('0x24')](function(_0x149b0c){if(_0x149b0c){_0x31627f=_0x149b0c;return _0x149b0c[_0x1cb9('0x95')](_0x46e35d[_0x1cb9('0x51')]['ids'],_[_0x1cb9('0x96')](_0x46e35d[_0x1cb9('0x51')],[_0x1cb9('0x80'),'id'])||{})[_0x1cb9('0x97')](function(_0x463d1c){for(var _0x3908a8=0x0;_0x3908a8<_0x46e35d['body'][_0x1cb9('0x80')][_0x1cb9('0x4d')];_0x3908a8+=0x1){socket[_0x1cb9('0x7e')](_0x1cb9('0x98'),{'UserId':_0x46e35d[_0x1cb9('0x51')][_0x1cb9('0x80')][_0x3908a8],'VoiceQueueId':_0x46e35d[_0x1cb9('0x4c')]['id']});}return _0x463d1c;});}})[_0x1cb9('0x24')](function(_0xa43246){_0x47d696=_0xa43246||[];if(_0x31627f){return db[_0x1cb9('0x6d')][_0x1cb9('0x62')]({'where':{'id':_0x46e35d['body'][_0x1cb9('0x80')]},'attributes':['id',_0x1cb9('0x33'),'online',_0x1cb9('0x70'),'interface'],'raw':!![]});}})[_0x1cb9('0x24')](function(_0x28f70a){if(!_[_0x1cb9('0x92')](_0x28f70a)){var _0x46fb97=[];for(var _0x193c14=0x0;_0x193c14<_0x28f70a[_0x1cb9('0x4d')];_0x193c14++){if(_0x28f70a[_0x193c14][_0x1cb9('0x6f')]){_0x46fb97[_0x1cb9('0x99')](db[_0x1cb9('0x79')]['upsert']({'membername':_0x28f70a[_0x193c14]['name'],'UserId':_0x28f70a[_0x193c14]['id'],'queue_name':_0x31627f['name'],'VoiceQueueId':_0x31627f['id'],'interface':_[_0x1cb9('0x7b')](_0x28f70a[_0x193c14][_0x1cb9('0x71')])?util[_0x1cb9('0x7c')]('SIP/%s',_0x28f70a[_0x193c14][_0x1cb9('0x33')]):_0x28f70a[_0x193c14][_0x1cb9('0x71')],'paused':_0x28f70a[_0x193c14][_0x1cb9('0x70')]||![],'penalty':_0x46e35d[_0x1cb9('0x51')]['penalty']||0x0}));}}return BPromise['all'](_0x46fb97);}})[_0x1cb9('0x24')](function(){return _0x47d696;})[_0x1cb9('0x24')](respondWithResult(_0x2dd501,null))['catch'](handleError(_0x2dd501,null));};exports[_0x1cb9('0x93')]=function(_0x3b7e24,_0x5c58a7,_0x18132b){return db[_0x1cb9('0x36')][_0x1cb9('0x2f')]({'where':{'id':_0x3b7e24['params']['id']}})['then'](handleEntityNotFound(_0x5c58a7,null))[_0x1cb9('0x24')](function(_0x73fc01){if(_0x73fc01){return _0x73fc01['removeAgents'](_0x3b7e24[_0x1cb9('0x3c')][_0x1cb9('0x80')])[_0x1cb9('0x24')](function(){if(_[_0x1cb9('0x9a')](_0x3b7e24['query'][_0x1cb9('0x80')])){for(var _0xb76fc2=0x0;_0xb76fc2<_0x3b7e24[_0x1cb9('0x3c')][_0x1cb9('0x80')][_0x1cb9('0x4d')];_0xb76fc2+=0x1){socket['emit'](_0x1cb9('0x94'),{'UserId':Number(_0x3b7e24['query'][_0x1cb9('0x80')][_0xb76fc2]),'VoiceQueueId':Number(_0x3b7e24['params']['id'])});}}else{socket[_0x1cb9('0x7e')]('userVoiceQueue:remove',{'UserId':Number(_0x3b7e24[_0x1cb9('0x3c')][_0x1cb9('0x80')]),'VoiceQueueId':Number(_0x3b7e24[_0x1cb9('0x4c')]['id'])});}});}})[_0x1cb9('0x24')](function(_0x3f54a8){return db[_0x1cb9('0x79')][_0x1cb9('0x25')]({'where':{'VoiceQueueId':_0x3b7e24[_0x1cb9('0x4c')]['id'],'UserId':_0x3b7e24['query'][_0x1cb9('0x80')]}})[_0x1cb9('0x24')](function(){return _0x3f54a8;});})[_0x1cb9('0x24')](respondWithStatusCode(_0x5c58a7,null))[_0x1cb9('0x4a')](handleError(_0x5c58a7,null));};exports[_0x1cb9('0x9b')]=function(_0x42f11b,_0x55fa4a,_0x4e85b0){var _0x335df3={};var _0x155ee5={};var _0x40ad48;var _0x17a6a2;return db[_0x1cb9('0x36')][_0x1cb9('0x5f')]({'where':{'id':_0x42f11b['params']['id']}})['then'](handleEntityNotFound(_0x55fa4a,null))[_0x1cb9('0x24')](function(_0x416300){if(_0x416300){_0x40ad48=_0x416300;_0x155ee5[_0x1cb9('0x3a')]=_['keys'](db[_0x1cb9('0x6d')][_0x1cb9('0x37')]);_0x155ee5[_0x1cb9('0x3c')]=_['keys'](_0x42f11b[_0x1cb9('0x3c')]);_0x155ee5[_0x1cb9('0x3d')]=_[_0x1cb9('0x3e')](_0x155ee5[_0x1cb9('0x3a')],_0x155ee5[_0x1cb9('0x3c')]);_0x335df3[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x155ee5[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x42f11b[_0x1cb9('0x3c')][_0x1cb9('0x40')]));_0x335df3[_0x1cb9('0x3f')]=_0x335df3['attributes'][_0x1cb9('0x4d')]?_0x335df3['attributes']:_0x155ee5['model'];_0x335df3['order']=qs['sort'](_0x42f11b[_0x1cb9('0x3c')][_0x1cb9('0x44')]);_0x335df3['where']=qs[_0x1cb9('0x3d')](_['pick'](_0x42f11b[_0x1cb9('0x3c')],_0x155ee5[_0x1cb9('0x3d')]));if(_0x42f11b[_0x1cb9('0x3c')]['filter']){_0x335df3[_0x1cb9('0x45')]=_[_0x1cb9('0x47')](_0x335df3[_0x1cb9('0x45')],{'$or':_[_0x1cb9('0x2b')](_0x335df3[_0x1cb9('0x3f')],function(_0x27064d){var _0x2ddb5f={};_0x2ddb5f[_0x27064d]={'$like':'%'+_0x42f11b[_0x1cb9('0x3c')]['filter']+'%'};return _0x2ddb5f;})});}_0x335df3=_[_0x1cb9('0x47')]({},_0x335df3,_0x42f11b['options']);return _0x40ad48[_0x1cb9('0x9b')](_0x335df3);}})['then'](function(_0xb75f4d){if(_0xb75f4d){_0x17a6a2=_0xb75f4d[_0x1cb9('0x4d')];if(!_0x42f11b[_0x1cb9('0x3c')]['hasOwnProperty'](_0x1cb9('0x42'))){_0x335df3[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x42f11b[_0x1cb9('0x3c')][_0x1cb9('0x20')]);_0x335df3['offset']=qs[_0x1cb9('0x1f')](_0x42f11b[_0x1cb9('0x3c')][_0x1cb9('0x1f')]);}return _0x40ad48['getAgents'](_0x335df3);}})[_0x1cb9('0x24')](function(_0x1978d3){if(_0x1978d3){return _0x1978d3?{'count':_0x17a6a2,'rows':_0x1978d3}:null;}})[_0x1cb9('0x24')](respondWithResult(_0x55fa4a,null))[_0x1cb9('0x4a')](handleError(_0x55fa4a,null));};exports['getMembers']=function(_0x25486c,_0x4ee661,_0x4e7706){var _0x327071={};var _0x48afe4={};var _0x209ba0;var _0x57685a;return db[_0x1cb9('0x36')][_0x1cb9('0x5f')]({'where':{'id':_0x25486c['params']['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x4ee661,null))[_0x1cb9('0x24')](function(_0x14cfb9){if(_0x14cfb9){_0x209ba0=_0x14cfb9;_0x48afe4[_0x1cb9('0x3a')]=_[_0x1cb9('0x3b')](db[_0x1cb9('0x79')]['rawAttributes']);_0x48afe4[_0x1cb9('0x3c')]=_[_0x1cb9('0x3b')](_0x25486c[_0x1cb9('0x3c')]);_0x48afe4[_0x1cb9('0x3d')]=_[_0x1cb9('0x3e')](_0x48afe4[_0x1cb9('0x3a')],_0x48afe4['query']);_0x327071['attributes']=_[_0x1cb9('0x3e')](_0x48afe4[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x25486c[_0x1cb9('0x3c')]['fields']));_0x327071[_0x1cb9('0x3f')]=_0x327071[_0x1cb9('0x3f')][_0x1cb9('0x4d')]?_0x327071['attributes']:_0x48afe4[_0x1cb9('0x3a')];_0x327071[_0x1cb9('0x43')]=qs['sort'](_0x25486c[_0x1cb9('0x3c')][_0x1cb9('0x44')]);_0x327071['where']=qs[_0x1cb9('0x3d')](_[_0x1cb9('0x46')](_0x25486c[_0x1cb9('0x3c')],_0x48afe4[_0x1cb9('0x3d')]));if(_0x25486c[_0x1cb9('0x3c')][_0x1cb9('0x29')]){_0x327071[_0x1cb9('0x45')]=_['merge'](_0x327071[_0x1cb9('0x45')],{'$or':_['map'](_0x327071[_0x1cb9('0x3f')],function(_0x1bb6e2){var _0x11869b={};_0x11869b[_0x1bb6e2]={'$like':'%'+_0x25486c[_0x1cb9('0x3c')]['filter']+'%'};return _0x11869b;})});}_0x327071=_[_0x1cb9('0x47')]({},_0x327071,_0x25486c[_0x1cb9('0x4f')]);return _0x209ba0[_0x1cb9('0x9c')](_0x327071);}})['then'](function(_0x3acaf7){if(_0x3acaf7){_0x57685a=_0x3acaf7['length'];if(!_0x25486c['query'][_0x1cb9('0x41')]('nolimit')){_0x327071[_0x1cb9('0x20')]=qs['limit'](_0x25486c[_0x1cb9('0x3c')][_0x1cb9('0x20')]);_0x327071[_0x1cb9('0x1f')]=qs[_0x1cb9('0x1f')](_0x25486c[_0x1cb9('0x3c')][_0x1cb9('0x1f')]);}return _0x209ba0[_0x1cb9('0x9c')](_0x327071);}})[_0x1cb9('0x24')](function(_0x1a4b8c){return _0x1a4b8c?{'count':_0x57685a,'rows':_0x1a4b8c}:null;})[_0x1cb9('0x24')](respondWithResult(_0x4ee661,null))[_0x1cb9('0x4a')](handleError(_0x4ee661,null));};exports[_0x1cb9('0x9d')]=function(_0x1b40ed,_0x50c592,_0x362ccf){var _0x183798={};var _0x572f51={};var _0x530922;var _0xc2f0cc;return db[_0x1cb9('0x36')][_0x1cb9('0x5f')]({'where':{'id':_0x1b40ed['params']['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x50c592,null))[_0x1cb9('0x24')](function(_0x55d14f){if(_0x55d14f){_0x530922=_0x55d14f;_0x572f51[_0x1cb9('0x3a')]=_[_0x1cb9('0x3b')](db[_0x1cb9('0x9e')][_0x1cb9('0x37')]);_0x572f51[_0x1cb9('0x3c')]=_[_0x1cb9('0x3b')](_0x1b40ed['query']);_0x572f51[_0x1cb9('0x3d')]=_['intersection'](_0x572f51[_0x1cb9('0x3a')],_0x572f51['query']);_0x183798[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x572f51[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x1b40ed[_0x1cb9('0x3c')][_0x1cb9('0x40')]));_0x183798['attributes']=_0x183798[_0x1cb9('0x3f')][_0x1cb9('0x4d')]?_0x183798[_0x1cb9('0x3f')]:_0x572f51['model'];_0x183798['order']=qs[_0x1cb9('0x44')](_0x1b40ed['query'][_0x1cb9('0x44')]);_0x183798[_0x1cb9('0x45')]=qs['filters'](_[_0x1cb9('0x46')](_0x1b40ed[_0x1cb9('0x3c')],_0x572f51[_0x1cb9('0x3d')]));if(_0x1b40ed[_0x1cb9('0x3c')][_0x1cb9('0x29')]){_0x183798[_0x1cb9('0x45')]=_[_0x1cb9('0x47')](_0x183798[_0x1cb9('0x45')],{'$or':_[_0x1cb9('0x2b')](_0x183798[_0x1cb9('0x3f')],function(_0x31f74e){var _0x209a74={};_0x209a74[_0x31f74e]={'$like':'%'+_0x1b40ed['query'][_0x1cb9('0x29')]+'%'};return _0x209a74;})});}_0x183798=_[_0x1cb9('0x47')]({},_0x183798,_0x1b40ed[_0x1cb9('0x4f')]);return _0x530922[_0x1cb9('0x9d')](_0x183798);}})[_0x1cb9('0x24')](function(_0x5d0cd8){if(_0x5d0cd8){_0xc2f0cc=_0x5d0cd8[_0x1cb9('0x4d')];if(!_0x1b40ed[_0x1cb9('0x3c')]['hasOwnProperty'](_0x1cb9('0x42'))){_0x183798[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x1b40ed[_0x1cb9('0x3c')][_0x1cb9('0x20')]);_0x183798[_0x1cb9('0x1f')]=qs['offset'](_0x1b40ed[_0x1cb9('0x3c')][_0x1cb9('0x1f')]);}return _0x530922['getLists'](_0x183798);}})[_0x1cb9('0x24')](function(_0x16aaad){if(_0x16aaad){return _0x16aaad?{'count':_0xc2f0cc,'rows':_0x16aaad}:null;}})[_0x1cb9('0x24')](respondWithResult(_0x50c592,null))['catch'](handleError(_0x50c592,null));};exports['addLists']=function(_0x465b41,_0x1ee133,_0x1c4e81){var _0x43b7b1,_0x26368f;return db[_0x1cb9('0x36')][_0x1cb9('0x2f')]({'where':{'id':_0x465b41['params']['id']}})['then'](handleEntityNotFound(_0x1ee133,null))['then'](function(_0x272cbc){if(_0x272cbc){_0x26368f=_0x272cbc;return _0x272cbc['addLists'](_0x465b41[_0x1cb9('0x51')][_0x1cb9('0x80')],_[_0x1cb9('0x96')](_0x465b41[_0x1cb9('0x51')],[_0x1cb9('0x80'),'id'])||{});}return null;})['spread'](function(_0x46ae55){var _0x590374;_0x43b7b1=_0x46ae55||[];var _0x4ecf13=[];if(_0x46ae55){for(var _0x2a4878=0x0;_0x2a4878<_0x46ae55[_0x1cb9('0x4d')];_0x2a4878+=0x1){var _0x267b06=_0x46ae55[_0x2a4878]['get']({'plain':!![]});_0x26368f[_0x1cb9('0x9f')]=_0x465b41[_0x1cb9('0x51')][_0x1cb9('0x9f')]?_0x465b41[_0x1cb9('0x51')][_0x1cb9('0x9f')]:_0x26368f[_0x1cb9('0x9f')];switch(_0x26368f[_0x1cb9('0x9f')]){case _0x1cb9('0xa0'):_0x590374=squel[_0x1cb9('0xa1')]()[_0x1cb9('0xa2')](_0x1cb9('0xa3'))[_0x1cb9('0xa4')]([_0x1cb9('0xa5'),_0x1cb9('0xa6'),_0x1cb9('0xa7'),'ListId',_0x1cb9('0x60'),'createdAt','updatedAt'],squel[_0x1cb9('0x81')]()[_0x1cb9('0x82')](_0x1cb9('0xa5'),_0x1cb9('0xa5'))[_0x1cb9('0x82')](_0x1cb9('0xa8'),_0x1cb9('0xa6'))['field']('id','ContactId')['field'](_0x267b06[_0x1cb9('0xa9')][_0x1cb9('0x8b')](),'ListId')['field'](_0x465b41[_0x1cb9('0x4c')]['id'][_0x1cb9('0x8b')](),_0x1cb9('0x60'))['field'](_0x1cb9('0xa8'),_0x1cb9('0x5a'))['field'](_0x1cb9('0xa8'),_0x1cb9('0x5b'))[_0x1cb9('0x84')](_0x1cb9('0xaa'))[_0x1cb9('0x45')](_0x1cb9('0xab'))['where']('ListId\x20=\x20?',_0x267b06['CmListId'][_0x1cb9('0x8b')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x1cb9('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x81')]()['field'](_0x1cb9('0xac'))['from'](_0x1cb9('0xad'))['where'](_0x1cb9('0x89'),_0x465b41[_0x1cb9('0x4c')]['id']['toString']()))[_0x1cb9('0x45')](_0x1cb9('0xae'),squel[_0x1cb9('0x81')]()[_0x1cb9('0x82')](_0x1cb9('0xaf'))['from'](_0x1cb9('0xa3'))['where'](_0x1cb9('0x89'),_0x465b41[_0x1cb9('0x4c')]['id'][_0x1cb9('0x8b')]())))[_0x1cb9('0x8b')]();break;case _0x1cb9('0xb0'):_0x590374=squel[_0x1cb9('0xa1')]()[_0x1cb9('0xa2')](_0x1cb9('0xa3'))['fromQuery'](['phone','scheduledAt',_0x1cb9('0xa7'),_0x1cb9('0xb1'),_0x1cb9('0x60'),_0x1cb9('0x5a'),_0x1cb9('0x5b')],squel[_0x1cb9('0x81')]()[_0x1cb9('0x82')](_0x1cb9('0xa5'),_0x1cb9('0xa5'))['field']('NOW()',_0x1cb9('0xa6'))[_0x1cb9('0x82')]('id',_0x1cb9('0xa7'))[_0x1cb9('0x82')](_0x267b06[_0x1cb9('0xa9')][_0x1cb9('0x8b')](),_0x1cb9('0xb1'))[_0x1cb9('0x82')](_0x465b41[_0x1cb9('0x4c')]['id'][_0x1cb9('0x8b')](),'VoiceQueueId')[_0x1cb9('0x82')](_0x1cb9('0xa8'),_0x1cb9('0x5a'))[_0x1cb9('0x82')]('NOW()',_0x1cb9('0x5b'))[_0x1cb9('0x84')](_0x1cb9('0xaa'))[_0x1cb9('0x45')]('deletedAt\x20IS\x20NULL')[_0x1cb9('0x45')](_0x1cb9('0xb2'),_0x267b06[_0x1cb9('0xa9')][_0x1cb9('0x8b')]())[_0x1cb9('0x45')](_0x1cb9('0xb3'))[_0x1cb9('0x45')](_0x1cb9('0xae'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0x1cb9('0x84')]('cm_hopper')['where'](_0x1cb9('0x89'),_0x465b41[_0x1cb9('0x4c')]['id']['toString']())))[_0x1cb9('0x8b')]();break;default:_0x590374=squel[_0x1cb9('0xa1')]()['into'](_0x1cb9('0xa3'))[_0x1cb9('0xa4')](['phone',_0x1cb9('0xa6'),_0x1cb9('0xa7'),_0x1cb9('0xb1'),_0x1cb9('0x60'),_0x1cb9('0x5a'),_0x1cb9('0x5b')],squel['select']()['field'](_0x1cb9('0xa5'),_0x1cb9('0xa5'))['field'](_0x1cb9('0xa8'),_0x1cb9('0xa6'))[_0x1cb9('0x82')]('id','ContactId')['field'](_0x267b06[_0x1cb9('0xa9')][_0x1cb9('0x8b')](),'ListId')[_0x1cb9('0x82')](_0x465b41[_0x1cb9('0x4c')]['id'][_0x1cb9('0x8b')](),'VoiceQueueId')['field'](_0x1cb9('0xa8'),_0x1cb9('0x5a'))[_0x1cb9('0x82')](_0x1cb9('0xa8'),'updatedAt')[_0x1cb9('0x84')](_0x1cb9('0xaa'))[_0x1cb9('0x45')](_0x1cb9('0xab'))[_0x1cb9('0x45')]('ListId\x20=\x20?',_0x267b06['CmListId'][_0x1cb9('0x8b')]())[_0x1cb9('0x45')](_0x1cb9('0xb3')))[_0x1cb9('0x8b')]();}_0x4ecf13[_0x1cb9('0x99')](db[_0x1cb9('0x75')]['query'](_0x590374));}return BPromise[_0x1cb9('0x8e')](_0x4ecf13);}})['then'](function(){return _0x43b7b1;})[_0x1cb9('0x24')](respondWithResult(_0x1ee133,null))[_0x1cb9('0x4a')](handleError(_0x1ee133,null));};exports['removeLists']=function(_0x49444a,_0x1f3976,_0x3fb70a){return db['VoiceQueue'][_0x1cb9('0x2f')]({'where':{'id':_0x49444a[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x1f3976,null))[_0x1cb9('0x24')](function(_0x3ea026){if(_0x3ea026){return _0x3ea026[_0x1cb9('0xb4')](_0x49444a[_0x1cb9('0x3c')][_0x1cb9('0x80')]);}})[_0x1cb9('0x24')](function(_0x2db8b9){if(_0x2db8b9){return db[_0x1cb9('0x61')][_0x1cb9('0x25')]({'where':{'ListId':_0x49444a[_0x1cb9('0x3c')]['ids'],'VoiceQueueId':_0x49444a[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](function(){return _0x2db8b9;});}})[_0x1cb9('0x24')](respondWithStatusCode(_0x1f3976,null))[_0x1cb9('0x4a')](handleError(_0x1f3976,null));};exports[_0x1cb9('0xb5')]=function(_0x355c3a,_0x5c9814,_0xd4ba25){var _0x1a6c4c={};var _0x4f4e04={};var _0x209197;var _0x35e3f4;return db['VoiceQueue'][_0x1cb9('0x5f')]({'where':{'id':_0x355c3a[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x5c9814,null))[_0x1cb9('0x24')](function(_0x2a799f){if(_0x2a799f){_0x209197=_0x2a799f;_0x4f4e04[_0x1cb9('0x3a')]=_['keys'](db[_0x1cb9('0x9e')][_0x1cb9('0x37')]);_0x4f4e04[_0x1cb9('0x3c')]=_['keys'](_0x355c3a[_0x1cb9('0x3c')]);_0x4f4e04['filters']=_['intersection'](_0x4f4e04[_0x1cb9('0x3a')],_0x4f4e04[_0x1cb9('0x3c')]);_0x1a6c4c[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x4f4e04['model'],qs[_0x1cb9('0x40')](_0x355c3a[_0x1cb9('0x3c')][_0x1cb9('0x40')]));_0x1a6c4c[_0x1cb9('0x3f')]=_0x1a6c4c[_0x1cb9('0x3f')][_0x1cb9('0x4d')]?_0x1a6c4c[_0x1cb9('0x3f')]:_0x4f4e04['model'];_0x1a6c4c[_0x1cb9('0x43')]=qs[_0x1cb9('0x44')](_0x355c3a[_0x1cb9('0x3c')]['sort']);_0x1a6c4c[_0x1cb9('0x45')]=qs['filters'](_[_0x1cb9('0x46')](_0x355c3a[_0x1cb9('0x3c')],_0x4f4e04[_0x1cb9('0x3d')]));if(_0x355c3a[_0x1cb9('0x3c')][_0x1cb9('0x29')]){_0x1a6c4c['where']=_['merge'](_0x1a6c4c['where'],{'$or':_['map'](_0x1a6c4c[_0x1cb9('0x3f')],function(_0x48fa02){var _0x35302e={};_0x35302e[_0x48fa02]={'$like':'%'+_0x355c3a['query'][_0x1cb9('0x29')]+'%'};return _0x35302e;})});}_0x1a6c4c=_[_0x1cb9('0x47')]({},_0x1a6c4c,_0x355c3a[_0x1cb9('0x4f')]);return _0x209197[_0x1cb9('0xb5')](_0x1a6c4c);}})[_0x1cb9('0x24')](function(_0x138763){if(_0x138763){_0x35e3f4=_0x138763[_0x1cb9('0x4d')];if(!_0x355c3a[_0x1cb9('0x3c')]['hasOwnProperty'](_0x1cb9('0x42'))){_0x1a6c4c[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x355c3a[_0x1cb9('0x3c')][_0x1cb9('0x20')]);_0x1a6c4c['offset']=qs['offset'](_0x355c3a[_0x1cb9('0x3c')]['offset']);}return _0x209197['getBlackLists'](_0x1a6c4c);}})['then'](function(_0x331c18){if(_0x331c18){return _0x331c18?{'count':_0x35e3f4,'rows':_0x331c18}:null;}})[_0x1cb9('0x24')](respondWithResult(_0x5c9814,null))[_0x1cb9('0x4a')](handleError(_0x5c9814,null));};exports[_0x1cb9('0xb6')]=function(_0x836ef4,_0x5a407f,_0x19ac33){var _0x12e221,_0x5cd228;return db[_0x1cb9('0x36')][_0x1cb9('0x2f')]({'where':{'id':_0x836ef4[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x5a407f,null))[_0x1cb9('0x24')](function(_0x74cb14){if(_0x74cb14){_0x5cd228=_0x74cb14;return _0x74cb14[_0x1cb9('0xb6')](_0x836ef4['body'][_0x1cb9('0x80')],_['omit'](_0x836ef4['body'],[_0x1cb9('0x80'),'id'])||{});}return null;})['spread'](function(_0x2c9609){var _0x169e38;_0x12e221=_0x2c9609||[];var _0x2b4f5c=[];if(_0x2c9609){for(var _0x50bed6=0x0;_0x50bed6<_0x2c9609[_0x1cb9('0x4d')];_0x50bed6+=0x1){var _0x290bb3=_0x2c9609[_0x50bed6][_0x1cb9('0x26')]({'plain':!![]});_0x169e38=squel[_0x1cb9('0xa1')]()[_0x1cb9('0xa2')](_0x1cb9('0xb7'))['fromQuery']([_0x1cb9('0xa5'),_0x1cb9('0xa7'),'ListId','VoiceQueueId',_0x1cb9('0x5a'),_0x1cb9('0x5b')],squel[_0x1cb9('0x81')]()[_0x1cb9('0x82')](_0x1cb9('0xa5'),'phone')[_0x1cb9('0x82')]('id','ContactId')[_0x1cb9('0x82')](_0x290bb3[_0x1cb9('0xa9')][_0x1cb9('0x8b')](),_0x1cb9('0xb1'))[_0x1cb9('0x82')](_0x836ef4['params']['id'][_0x1cb9('0x8b')](),'VoiceQueueId')[_0x1cb9('0x82')]('NOW()',_0x1cb9('0x5a'))[_0x1cb9('0x82')]('NOW()',_0x1cb9('0x5b'))['from'](_0x1cb9('0xaa'))[_0x1cb9('0x45')]('deletedAt\x20IS\x20NULL')[_0x1cb9('0x45')](_0x1cb9('0xb2'),_0x290bb3[_0x1cb9('0xa9')][_0x1cb9('0x8b')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x1cb9('0x8b')]();_0x2b4f5c[_0x1cb9('0x99')](db[_0x1cb9('0x75')][_0x1cb9('0x3c')](_0x169e38));}return BPromise['all'](_0x2b4f5c);}})[_0x1cb9('0x24')](function(){return _0x12e221;})[_0x1cb9('0x24')](respondWithResult(_0x5a407f,null))['catch'](handleError(_0x5a407f,null));};exports[_0x1cb9('0xb8')]=function(_0x18a18f,_0x202c3a,_0x5b39f7){return db[_0x1cb9('0x36')]['find']({'where':{'id':_0x18a18f[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x202c3a,null))['then'](function(_0x10f6f6){if(_0x10f6f6){return _0x10f6f6[_0x1cb9('0xb8')](_0x18a18f[_0x1cb9('0x3c')]['ids']);}})[_0x1cb9('0x24')](function(_0x3d4a83){if(_0x3d4a83){return db['CmHopperBlack'][_0x1cb9('0x25')]({'where':{'ListId':_0x18a18f[_0x1cb9('0x3c')][_0x1cb9('0x80')],'VoiceQueueId':_0x18a18f[_0x1cb9('0x4c')]['id']}})['then'](function(){return _0x3d4a83;});}})[_0x1cb9('0x24')](respondWithStatusCode(_0x202c3a,null))['catch'](handleError(_0x202c3a,null));}; \ No newline at end of file +var _0x70e0=['always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','createdAt','field','CmListId','toString','NOW()','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','fromQuery','COALESCE(phone,\x27\x27)','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','end','count','offset','limit','json','save','update','then','destroy','get','inbound','QueueCampaigns','outbound','filter','map','value','includes','type','find','name','UserProfileResource','status','sendStatus','send','index','VoiceQueue','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','create','body','user','role','VoiceQueues','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','error','getHoppers','findOne','nolimit','order','pick','VoiceQueueId','CmHopper','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','voicePause','interface','forEach','penalty','Agents','sequelize','transaction','addTeams','each','findOrCreate','UserVoiceQueueRt','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','User','select','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','all','isEmpty','userVoiceQueue:remove','addAgents','spread','online','upsert','isNil','removeAgents','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType'];(function(_0xd2e69b,_0x39642a){var _0x714ad1=function(_0x4e27a0){while(--_0x4e27a0){_0xd2e69b['push'](_0xd2e69b['shift']());}};_0x714ad1(++_0x39642a);}(_0x70e0,0x17b));var _0x070e=function(_0x30c13c,_0x3313bb){_0x30c13c=_0x30c13c-0x0;var _0x5f0486=_0x70e0[_0x30c13c];return _0x5f0486;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xc'));var Papa=require(_0x070e('0xd'));var Redis=require(_0x070e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0xf'));var hardwareService=require(_0x070e('0x10'));var logger=require(_0x070e('0x11'))(_0x070e('0x12'));var utils=require(_0x070e('0x13'));var config=require(_0x070e('0x14'));var licenseUtil=require(_0x070e('0x15'));var db=require(_0x070e('0x16'))['db'];config[_0x070e('0x17')]=_[_0x070e('0x18')](config[_0x070e('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x070e('0x17')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x5bae0f,_0x11d2ce){_0x11d2ce=_0x11d2ce||0xcc;return function(_0x14c3fd){if(_0x14c3fd){return _0x5bae0f['sendStatus'](_0x11d2ce);}return _0x5bae0f['status'](_0x11d2ce)[_0x070e('0x19')]();};}function respondWithResult(_0xeae1a5,_0x180897){_0x180897=_0x180897||0xc8;return function(_0x19d9da){if(_0x19d9da){return _0xeae1a5['status'](_0x180897)['json'](_0x19d9da);}};}function respondWithFilteredResult(_0x17e2e4,_0x2bd937){return function(_0x38f6e6){if(_0x38f6e6){var _0x2060cc=_0x38f6e6[_0x070e('0x1a')],_0x364b3f=_0x2bd937[_0x070e('0x1b')],_0x5037eb=_0x2bd937[_0x070e('0x1b')]+_0x2bd937[_0x070e('0x1c')],_0x3938b5;if(_0x5037eb>=_0x2060cc){_0x5037eb=_0x2060cc;_0x3938b5=0xc8;}else{_0x3938b5=0xce;}_0x17e2e4['status'](_0x3938b5);return _0x17e2e4['set']('Content-Range',_0x364b3f+'-'+_0x5037eb+'/'+_0x2060cc)[_0x070e('0x1d')](_0x38f6e6);}return null;};}function patchUpdates(_0x3004f0){return function(_0x20dc60){try{jsonpatch['apply'](_0x20dc60,_0x3004f0,!![]);}catch(_0x5b184){return BPromise['reject'](_0x5b184);}return _0x20dc60[_0x070e('0x1e')]();};}function saveUpdates(_0x3f6985,_0x27a01e){return function(_0x33e8c6){if(_0x33e8c6){return _0x33e8c6[_0x070e('0x1f')](_0x3f6985)[_0x070e('0x20')](function(_0xe405e){return _0xe405e;});}return null;};}function removeEntity(_0x164cdf,_0x595c7e){return function(_0x2f8055){if(_0x2f8055){return _0x2f8055[_0x070e('0x21')]()[_0x070e('0x20')](function(){var _0x503f4d=_0x2f8055[_0x070e('0x22')]({'plain':!![]});var _0x5f3e9d=[{'name':'VoiceQueues','value':_0x070e('0x23'),'ignore':![]},{'name':_0x070e('0x24'),'value':_0x070e('0x25'),'ignore':![]}];var _0x1743cc=_(_0x5f3e9d)[_0x070e('0x26')]('ignore')[_0x070e('0x27')](_0x070e('0x28'))[_0x070e('0x28')]();if(_[_0x070e('0x29')](_0x1743cc,_0x503f4d[_0x070e('0x2a')])){return;}var _0x28d7f2=_[_0x070e('0x2b')](_0x5f3e9d,[_0x070e('0x28'),_0x503f4d['type']])[_0x070e('0x2c')];return db[_0x070e('0x2d')][_0x070e('0x21')]({'where':{'type':_0x28d7f2,'resourceId':_0x503f4d['id']}})['then'](function(){return _0x2f8055;});})['then'](function(){_0x164cdf[_0x070e('0x2e')](0xcc)[_0x070e('0x19')]();});}};}function handleEntityNotFound(_0xa6c0ab,_0x51402c){return function(_0x3fa994){if(!_0x3fa994){_0xa6c0ab[_0x070e('0x2f')](0x194);}return _0x3fa994;};}function handleError(_0x3a9425,_0x5f2bee){_0x5f2bee=_0x5f2bee||0x1f4;return function(_0x53d473){logger['error'](_0x53d473['stack']);if(_0x53d473['name']){delete _0x53d473[_0x070e('0x2c')];}_0x3a9425['status'](_0x5f2bee)[_0x070e('0x30')](_0x53d473);};}exports[_0x070e('0x31')]=function(_0x4f8130,_0x47a739){var _0x699739={},_0x3454c7={},_0x55288a={'count':0x0,'rows':[]};var _0x546a16=_[_0x070e('0x27')](db[_0x070e('0x32')][_0x070e('0x33')],function(_0x31fdc5){return{'name':_0x31fdc5[_0x070e('0x34')],'type':_0x31fdc5['type']['key']};});_0x3454c7[_0x070e('0x35')]=_[_0x070e('0x27')](_0x546a16,_0x070e('0x2c'));_0x3454c7[_0x070e('0x36')]=_[_0x070e('0x37')](_0x4f8130['query']);_0x3454c7[_0x070e('0x38')]=_[_0x070e('0x39')](_0x3454c7['model'],_0x3454c7[_0x070e('0x36')]);_0x699739[_0x070e('0x3a')]=_['intersection'](_0x3454c7['model'],qs['fields'](_0x4f8130[_0x070e('0x36')][_0x070e('0x3b')]));_0x699739[_0x070e('0x3a')]=_0x699739[_0x070e('0x3a')][_0x070e('0x3c')]?_0x699739['attributes']:_0x3454c7[_0x070e('0x35')];if(!_0x4f8130[_0x070e('0x36')][_0x070e('0x3d')]('nolimit')){_0x699739[_0x070e('0x1c')]=qs[_0x070e('0x1c')](_0x4f8130[_0x070e('0x36')]['limit']);_0x699739[_0x070e('0x1b')]=qs[_0x070e('0x1b')](_0x4f8130['query'][_0x070e('0x1b')]);}_0x699739['order']=qs[_0x070e('0x3e')](_0x4f8130[_0x070e('0x36')][_0x070e('0x3e')]);_0x699739[_0x070e('0x3f')]=qs[_0x070e('0x38')](_['pick'](_0x4f8130[_0x070e('0x36')],_0x3454c7['filters']),_0x546a16);if(_0x4f8130['query'][_0x070e('0x26')]){_0x699739[_0x070e('0x3f')]=_[_0x070e('0x40')](_0x699739['where'],{'$or':_[_0x070e('0x27')](_0x546a16,function(_0x1223be){if(_0x1223be[_0x070e('0x2a')]!==_0x070e('0x41')){var _0x4a4ee3={};_0x4a4ee3[_0x1223be[_0x070e('0x2c')]]={'$like':'%'+_0x4f8130['query']['filter']+'%'};return _0x4a4ee3;}})});}_0x699739=_['merge']({},_0x699739,_0x4f8130[_0x070e('0x42')]);var _0x926533={'where':_0x699739[_0x070e('0x3f')]};return db[_0x070e('0x32')][_0x070e('0x1a')](_0x926533)['then'](function(_0x18607f){_0x55288a['count']=_0x18607f;if(_0x4f8130[_0x070e('0x36')][_0x070e('0x43')]){_0x699739[_0x070e('0x44')]=[{'all':!![]}];}return db['VoiceQueue']['findAll'](_0x699739);})[_0x070e('0x20')](function(_0x5ee4b8){_0x55288a[_0x070e('0x45')]=_0x5ee4b8;return _0x55288a;})[_0x070e('0x20')](respondWithFilteredResult(_0x47a739,_0x699739))[_0x070e('0x46')](handleError(_0x47a739,null));};exports['show']=function(_0x7c15f9,_0x20a1ee){var _0x48d836={'raw':![],'where':{'id':_0x7c15f9[_0x070e('0x47')]['id']}},_0x589b97={};_0x589b97[_0x070e('0x35')]=_[_0x070e('0x37')](db[_0x070e('0x32')][_0x070e('0x33')]);_0x589b97['query']=_[_0x070e('0x37')](_0x7c15f9[_0x070e('0x36')]);_0x589b97[_0x070e('0x38')]=_[_0x070e('0x39')](_0x589b97[_0x070e('0x35')],_0x589b97[_0x070e('0x36')]);_0x48d836[_0x070e('0x3a')]=_[_0x070e('0x39')](_0x589b97[_0x070e('0x35')],qs[_0x070e('0x3b')](_0x7c15f9[_0x070e('0x36')][_0x070e('0x3b')]));_0x48d836[_0x070e('0x3a')]=_0x48d836[_0x070e('0x3a')][_0x070e('0x3c')]?_0x48d836['attributes']:_0x589b97[_0x070e('0x35')];if(_0x7c15f9[_0x070e('0x36')][_0x070e('0x43')]){_0x48d836[_0x070e('0x44')]=[{'all':!![]}];}_0x48d836=_[_0x070e('0x40')]({},_0x48d836,_0x7c15f9[_0x070e('0x42')]);return db[_0x070e('0x32')][_0x070e('0x2b')](_0x48d836)[_0x070e('0x20')](handleEntityNotFound(_0x20a1ee,null))['then'](respondWithResult(_0x20a1ee,null))[_0x070e('0x46')](handleError(_0x20a1ee,null));};exports['create']=function(_0x1acddb,_0x2be643){return db['VoiceQueue'][_0x070e('0x48')](_0x1acddb[_0x070e('0x49')],{})[_0x070e('0x20')](function(_0xa74805){var _0x2b8e51=_0x1acddb[_0x070e('0x4a')][_0x070e('0x22')]({'plain':!![]});if(!_0x2b8e51)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b8e51[_0x070e('0x4b')]==='user'){var _0x516161=_0xa74805[_0x070e('0x22')]({'plain':!![]});var _0x3d1b5e=[{'name':_0x070e('0x4c'),'value':_0x070e('0x23')},{'name':_0x070e('0x24'),'value':_0x070e('0x25')}];var _0x440fa1=_[_0x070e('0x2b')](_0x3d1b5e,['value',_0x516161[_0x070e('0x2a')]])['name'];return db['UserProfileSection'][_0x070e('0x2b')]({'where':{'name':_0x440fa1,'userProfileId':_0x2b8e51[_0x070e('0x4d')]},'raw':!![]})['then'](function(_0x26af08){if(_0x26af08&&_0x26af08[_0x070e('0x4e')]===0x0){return db[_0x070e('0x2d')][_0x070e('0x48')]({'name':_0x516161[_0x070e('0x2c')],'resourceId':_0x516161['id'],'type':_0x26af08[_0x070e('0x2c')],'sectionId':_0x26af08['id']},{})[_0x070e('0x20')](function(){return _0xa74805;});}else{return _0xa74805;}})['catch'](function(_0x5874cd){logger['error'](_0x070e('0x4f'),_0x5874cd);throw _0x5874cd;});}return _0xa74805;})[_0x070e('0x20')](respondWithResult(_0x2be643,0xc9))[_0x070e('0x46')](handleError(_0x2be643,null));};exports[_0x070e('0x50')]=function(_0x5ac0b5,_0x25f34c){var _0x5d3c3a={'where':{'id':_0x5ac0b5[_0x070e('0x47')]['id']}},_0x212710={};_0x212710[_0x070e('0x35')]=_[_0x070e('0x37')](db[_0x070e('0x32')][_0x070e('0x33')]);_0x5d3c3a['attributes']=_[_0x070e('0x39')](_0x212710[_0x070e('0x35')],qs[_0x070e('0x3b')](_0x5ac0b5['query'][_0x070e('0x3b')]));_0x5d3c3a[_0x070e('0x3a')]=_0x5d3c3a['attributes'][_0x070e('0x3c')]?_0x5d3c3a['attributes']:_0x212710[_0x070e('0x35')];if(_0x5ac0b5['query']['includeAll']){_0x5d3c3a['include']=[{'all':!![]}];}_0x5d3c3a=_[_0x070e('0x40')]({},_0x5d3c3a,_0x5ac0b5[_0x070e('0x42')]);return db[_0x070e('0x32')][_0x070e('0x2b')](_0x5d3c3a)[_0x070e('0x20')](handleEntityNotFound(_0x25f34c,null))[_0x070e('0x20')](function(_0x498bc6){if(_0x498bc6){var _0x841c89=_0x498bc6['get']({'plain':!![]});_0x841c89=qs[_0x070e('0x51')](_0x841c89,['id','createdAt',_0x070e('0x52')]);_0x5ac0b5[_0x070e('0x49')]=_['omit'](_0x5ac0b5[_0x070e('0x49')],['id','createdAt',_0x070e('0x52')]);return db[_0x070e('0x32')][_0x070e('0x48')](_[_0x070e('0x40')](_0x841c89,_0x5ac0b5[_0x070e('0x49')]),{'include':_0x5ac0b5[_0x070e('0x36')][_0x070e('0x43')]?[{'all':!![]}]:undefined})[_0x070e('0x20')](function(_0x3ef9cc){var _0x3332d0=_0x5ac0b5[_0x070e('0x4a')][_0x070e('0x22')]({'plain':!![]});if(!_0x3332d0)throw new Error(_0x070e('0x53'));if(_0x3332d0[_0x070e('0x4b')]==='user'){var _0x45bf20=_0x3ef9cc[_0x070e('0x22')]({'plain':!![]});var _0x381c83=[{'name':_0x070e('0x4c'),'value':'inbound'},{'name':_0x070e('0x24'),'value':_0x070e('0x25')}];var _0x398f54=_[_0x070e('0x2b')](_0x381c83,[_0x070e('0x28'),_0x45bf20[_0x070e('0x2a')]])['name'];return db[_0x070e('0x54')][_0x070e('0x2b')]({'where':{'name':_0x398f54,'userProfileId':_0x3332d0[_0x070e('0x4d')]},'raw':!![]})[_0x070e('0x20')](function(_0x551ca5){if(_0x551ca5&&_0x551ca5[_0x070e('0x4e')]===0x0){return db['UserProfileResource'][_0x070e('0x48')]({'name':_0x45bf20[_0x070e('0x2c')],'resourceId':_0x45bf20['id'],'type':_0x551ca5[_0x070e('0x2c')],'sectionId':_0x551ca5['id']},{})[_0x070e('0x20')](function(){return _0x3ef9cc;});}else{return _0x3ef9cc;}})[_0x070e('0x46')](function(_0x50ef9f){logger[_0x070e('0x55')](_0x070e('0x4f'),_0x50ef9f);throw _0x50ef9f;});}return _0x3ef9cc;});}})[_0x070e('0x20')](respondWithResult(_0x25f34c,0xc9))[_0x070e('0x46')](handleError(_0x25f34c,null));};exports['update']=function(_0x26b2c0,_0x5cadcf){if(_0x26b2c0[_0x070e('0x49')]['id']){delete _0x26b2c0[_0x070e('0x49')]['id'];}return db[_0x070e('0x32')]['find']({'where':{'id':_0x26b2c0[_0x070e('0x47')]['id']}})['then'](handleEntityNotFound(_0x5cadcf,null))[_0x070e('0x20')](saveUpdates(_0x26b2c0['body'],null))[_0x070e('0x20')](respondWithResult(_0x5cadcf,null))[_0x070e('0x46')](handleError(_0x5cadcf,null));};exports['destroy']=function(_0x4683c7,_0x53f9a8){return db[_0x070e('0x32')][_0x070e('0x2b')]({'where':{'id':_0x4683c7['params']['id']}})['then'](handleEntityNotFound(_0x53f9a8,null))[_0x070e('0x20')](removeEntity(_0x53f9a8,null))[_0x070e('0x46')](handleError(_0x53f9a8,null));};exports[_0x070e('0x56')]=function(_0x17cf15,_0x25f1d0,_0x26c5c3){var _0x280d62={'raw':![],'where':{}};var _0x332c8a={};var _0x25b599={'count':0x0,'rows':[]};return db[_0x070e('0x32')][_0x070e('0x57')]({'where':{'id':_0x17cf15[_0x070e('0x47')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x25f1d0,null))['then'](function(_0x3308b5){if(_0x3308b5){_0x332c8a[_0x070e('0x35')]=_['keys'](db['CmHopper'][_0x070e('0x33')]);_0x332c8a[_0x070e('0x36')]=_[_0x070e('0x37')](_0x17cf15[_0x070e('0x36')]);_0x332c8a[_0x070e('0x38')]=_[_0x070e('0x39')](_0x332c8a[_0x070e('0x35')],_0x332c8a[_0x070e('0x36')]);_0x280d62[_0x070e('0x3a')]=_[_0x070e('0x39')](_0x332c8a[_0x070e('0x35')],qs[_0x070e('0x3b')](_0x17cf15[_0x070e('0x36')]['fields']));_0x280d62['attributes']=_0x280d62['attributes'][_0x070e('0x3c')]?_0x280d62[_0x070e('0x3a')]:_0x332c8a[_0x070e('0x35')];if(!_0x17cf15[_0x070e('0x36')]['hasOwnProperty'](_0x070e('0x58'))){_0x280d62[_0x070e('0x1c')]=qs[_0x070e('0x1c')](_0x17cf15[_0x070e('0x36')][_0x070e('0x1c')]);_0x280d62[_0x070e('0x1b')]=qs['offset'](_0x17cf15[_0x070e('0x36')]['offset']);}_0x280d62[_0x070e('0x59')]=qs[_0x070e('0x3e')](_0x17cf15[_0x070e('0x36')][_0x070e('0x3e')]);_0x280d62[_0x070e('0x3f')]=qs['filters'](_[_0x070e('0x5a')](_0x17cf15[_0x070e('0x36')],_0x332c8a['filters']));_0x280d62[_0x070e('0x3f')][_0x070e('0x5b')]=_0x3308b5['id'];if(_0x17cf15['query'][_0x070e('0x26')]){_0x280d62[_0x070e('0x3f')]=_[_0x070e('0x40')](_0x280d62['where'],{'$or':_[_0x070e('0x27')](_0x280d62[_0x070e('0x3a')],function(_0x134b72){var _0x1ad0bf={};_0x1ad0bf[_0x134b72]={'$like':'%'+_0x17cf15[_0x070e('0x36')][_0x070e('0x26')]+'%'};return _0x1ad0bf;})});}_0x280d62=_[_0x070e('0x40')]({},_0x280d62,_0x17cf15[_0x070e('0x42')]);return db[_0x070e('0x5c')][_0x070e('0x1a')]({'where':_0x280d62[_0x070e('0x3f')]})[_0x070e('0x20')](function(_0x18c27a){_0x25b599['count']=_0x18c27a;if(_0x17cf15[_0x070e('0x36')][_0x070e('0x43')]){_0x280d62[_0x070e('0x44')]=[{'all':!![]}];}return db[_0x070e('0x5c')][_0x070e('0x5d')](_0x280d62);})[_0x070e('0x20')](function(_0x5c4352){_0x25b599['rows']=_0x5c4352;return _0x25b599;});}})['then'](respondWithFilteredResult(_0x25f1d0,_0x280d62))[_0x070e('0x46')](handleError(_0x25f1d0,null));};exports[_0x070e('0x5e')]=function(_0x39cd65,_0x141099,_0x4b4b9a){var _0x7f3f5={'raw':!![],'where':{}};var _0x20cd8a={};var _0x370209={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x070e('0x57')]({'where':{'id':_0x39cd65['params']['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x141099,null))[_0x070e('0x20')](function(_0x59e6e5){if(_0x59e6e5){_0x20cd8a['model']=_[_0x070e('0x37')](db[_0x070e('0x5f')]['rawAttributes']);_0x20cd8a[_0x070e('0x36')]=_['keys'](_0x39cd65['query']);_0x20cd8a['filters']=_[_0x070e('0x39')](_0x20cd8a[_0x070e('0x35')],_0x20cd8a[_0x070e('0x36')]);_0x7f3f5[_0x070e('0x3a')]=_[_0x070e('0x39')](_0x20cd8a[_0x070e('0x35')],qs[_0x070e('0x3b')](_0x39cd65[_0x070e('0x36')][_0x070e('0x3b')]));_0x7f3f5[_0x070e('0x3a')]=_0x7f3f5[_0x070e('0x3a')][_0x070e('0x3c')]?_0x7f3f5[_0x070e('0x3a')]:_0x20cd8a[_0x070e('0x35')];if(!_0x39cd65[_0x070e('0x36')][_0x070e('0x3d')](_0x070e('0x58'))){_0x7f3f5[_0x070e('0x1c')]=qs[_0x070e('0x1c')](_0x39cd65[_0x070e('0x36')][_0x070e('0x1c')]);_0x7f3f5[_0x070e('0x1b')]=qs['offset'](_0x39cd65[_0x070e('0x36')][_0x070e('0x1b')]);}_0x7f3f5[_0x070e('0x59')]=qs[_0x070e('0x3e')](_0x39cd65['query'][_0x070e('0x3e')]);_0x7f3f5[_0x070e('0x3f')]=qs[_0x070e('0x38')](_[_0x070e('0x5a')](_0x39cd65[_0x070e('0x36')],_0x20cd8a[_0x070e('0x38')]));_0x7f3f5['where']['VoiceQueueId']=_0x59e6e5['id'];if(_0x39cd65['query'][_0x070e('0x26')]){_0x7f3f5['where']=_[_0x070e('0x40')](_0x7f3f5[_0x070e('0x3f')],{'$or':_['map'](_0x7f3f5[_0x070e('0x3a')],function(_0x462c64){var _0x4f9a95={};_0x4f9a95[_0x462c64]={'$like':'%'+_0x39cd65['query'][_0x070e('0x26')]+'%'};return _0x4f9a95;})});}_0x7f3f5=_[_0x070e('0x40')]({},_0x7f3f5,_0x39cd65[_0x070e('0x42')]);return db[_0x070e('0x5f')][_0x070e('0x1a')]({'where':_0x7f3f5['where']})[_0x070e('0x20')](function(_0x56e3da){_0x370209[_0x070e('0x1a')]=_0x56e3da;if(_0x39cd65[_0x070e('0x36')]['includeAll']){_0x7f3f5[_0x070e('0x44')]=[{'all':!![]}];}return db[_0x070e('0x5f')][_0x070e('0x5d')](_0x7f3f5);})[_0x070e('0x20')](function(_0x174ca6){_0x370209[_0x070e('0x45')]=_0x174ca6;return _0x370209;});}})['then'](respondWithFilteredResult(_0x141099,_0x7f3f5))[_0x070e('0x46')](handleError(_0x141099,null));};exports[_0x070e('0x60')]=function(_0xde8455,_0x1ba0de,_0x259ac4){var _0x4b3282={'raw':!![],'where':{}};var _0x2531f7={};var _0x3f03aa={'count':0x0,'rows':[]};return db[_0x070e('0x32')][_0x070e('0x57')]({'where':{'id':_0xde8455[_0x070e('0x47')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x1ba0de,null))[_0x070e('0x20')](function(_0x4546eb){if(_0x4546eb){_0x2531f7[_0x070e('0x35')]=_[_0x070e('0x37')](db[_0x070e('0x61')][_0x070e('0x33')]);_0x2531f7[_0x070e('0x36')]=_[_0x070e('0x37')](_0xde8455[_0x070e('0x36')]);_0x2531f7[_0x070e('0x38')]=_['intersection'](_0x2531f7['model'],_0x2531f7[_0x070e('0x36')]);_0x4b3282[_0x070e('0x3a')]=_['intersection'](_0x2531f7['model'],qs['fields'](_0xde8455['query'][_0x070e('0x3b')]));_0x4b3282[_0x070e('0x3a')]=_0x4b3282[_0x070e('0x3a')][_0x070e('0x3c')]?_0x4b3282[_0x070e('0x3a')]:_0x2531f7[_0x070e('0x35')];if(!_0xde8455[_0x070e('0x36')][_0x070e('0x3d')](_0x070e('0x58'))){_0x4b3282[_0x070e('0x1c')]=qs['limit'](_0xde8455[_0x070e('0x36')][_0x070e('0x1c')]);_0x4b3282['offset']=qs[_0x070e('0x1b')](_0xde8455[_0x070e('0x36')][_0x070e('0x1b')]);}_0x4b3282[_0x070e('0x59')]=qs['sort'](_0xde8455[_0x070e('0x36')][_0x070e('0x3e')]);_0x4b3282[_0x070e('0x3f')]=qs[_0x070e('0x38')](_['pick'](_0xde8455[_0x070e('0x36')],_0x2531f7[_0x070e('0x38')]));_0x4b3282[_0x070e('0x3f')][_0x070e('0x5b')]=_0x4546eb['id'];if(_0xde8455[_0x070e('0x36')][_0x070e('0x26')]){_0x4b3282[_0x070e('0x3f')]=_[_0x070e('0x40')](_0x4b3282[_0x070e('0x3f')],{'$or':_[_0x070e('0x27')](_0x4b3282[_0x070e('0x3a')],function(_0x479888){var _0x25aac7={};_0x25aac7[_0x479888]={'$like':'%'+_0xde8455[_0x070e('0x36')]['filter']+'%'};return _0x25aac7;})});}_0x4b3282=_['merge']({},_0x4b3282,_0xde8455[_0x070e('0x42')]);return db['CmHopperFinal'][_0x070e('0x1a')]({'where':_0x4b3282[_0x070e('0x3f')]})[_0x070e('0x20')](function(_0x1f6e07){_0x3f03aa[_0x070e('0x1a')]=_0x1f6e07;if(_0xde8455[_0x070e('0x36')][_0x070e('0x43')]){_0x4b3282['include']=[{'all':!![]}];}return db[_0x070e('0x61')][_0x070e('0x5d')](_0x4b3282);})[_0x070e('0x20')](function(_0x2a80bd){_0x3f03aa['rows']=_0x2a80bd;return _0x3f03aa;});}})['then'](respondWithFilteredResult(_0x1ba0de,_0x4b3282))[_0x070e('0x46')](handleError(_0x1ba0de,null));};exports[_0x070e('0x62')]=function(_0x2e92f0,_0x5b727f,_0x101bfc){var _0xf5b732={'raw':!![],'where':{}};var _0x4e795d={};var _0x2e9808={'count':0x0,'rows':[]};return db[_0x070e('0x32')][_0x070e('0x57')]({'where':{'id':_0x2e92f0[_0x070e('0x47')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x5b727f,null))[_0x070e('0x20')](function(_0x56169b){if(_0x56169b){_0x4e795d['model']=_[_0x070e('0x37')](db['CmHopperBlack'][_0x070e('0x33')]);_0x4e795d[_0x070e('0x36')]=_['keys'](_0x2e92f0[_0x070e('0x36')]);_0x4e795d['filters']=_[_0x070e('0x39')](_0x4e795d[_0x070e('0x35')],_0x4e795d[_0x070e('0x36')]);_0xf5b732[_0x070e('0x3a')]=_[_0x070e('0x39')](_0x4e795d[_0x070e('0x35')],qs['fields'](_0x2e92f0[_0x070e('0x36')][_0x070e('0x3b')]));_0xf5b732['attributes']=_0xf5b732['attributes'][_0x070e('0x3c')]?_0xf5b732[_0x070e('0x3a')]:_0x4e795d[_0x070e('0x35')];if(!_0x2e92f0[_0x070e('0x36')][_0x070e('0x3d')](_0x070e('0x58'))){_0xf5b732[_0x070e('0x1c')]=qs[_0x070e('0x1c')](_0x2e92f0['query'][_0x070e('0x1c')]);_0xf5b732[_0x070e('0x1b')]=qs[_0x070e('0x1b')](_0x2e92f0[_0x070e('0x36')][_0x070e('0x1b')]);}_0xf5b732[_0x070e('0x59')]=qs[_0x070e('0x3e')](_0x2e92f0[_0x070e('0x36')]['sort']);_0xf5b732[_0x070e('0x3f')]=qs[_0x070e('0x38')](_[_0x070e('0x5a')](_0x2e92f0[_0x070e('0x36')],_0x4e795d[_0x070e('0x38')]));_0xf5b732[_0x070e('0x3f')][_0x070e('0x5b')]=_0x56169b['id'];if(_0x2e92f0[_0x070e('0x36')][_0x070e('0x26')]){_0xf5b732[_0x070e('0x3f')]=_['merge'](_0xf5b732['where'],{'$or':_[_0x070e('0x27')](_0xf5b732[_0x070e('0x3a')],function(_0x256105){var _0x567202={};_0x567202[_0x256105]={'$like':'%'+_0x2e92f0[_0x070e('0x36')][_0x070e('0x26')]+'%'};return _0x567202;})});}_0xf5b732=_['merge']({},_0xf5b732,_0x2e92f0[_0x070e('0x42')]);return db[_0x070e('0x63')][_0x070e('0x1a')]({'where':_0xf5b732[_0x070e('0x3f')]})[_0x070e('0x20')](function(_0x5ff82e){_0x2e9808['count']=_0x5ff82e;if(_0x2e92f0['query'][_0x070e('0x43')]){_0xf5b732[_0x070e('0x44')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x070e('0x5d')](_0xf5b732);})[_0x070e('0x20')](function(_0x3dc00f){_0x2e9808[_0x070e('0x45')]=_0x3dc00f;return _0x2e9808;});}})[_0x070e('0x20')](respondWithFilteredResult(_0x5b727f,_0xf5b732))[_0x070e('0x46')](handleError(_0x5b727f,null));};exports['getTeams']=function(_0xb7866f,_0xaf1aa3,_0x5d7a66){var _0x44ab7c={};var _0x1be191={};var _0x1aec7c;var _0x1fe46c;return db['VoiceQueue']['findOne']({'where':{'id':_0xb7866f[_0x070e('0x47')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0xaf1aa3,null))[_0x070e('0x20')](function(_0x326948){if(_0x326948){_0x1aec7c=_0x326948;_0x1be191[_0x070e('0x35')]=_[_0x070e('0x37')](db[_0x070e('0x64')][_0x070e('0x33')]);_0x1be191[_0x070e('0x36')]=_[_0x070e('0x37')](_0xb7866f['query']);_0x1be191[_0x070e('0x38')]=_[_0x070e('0x39')](_0x1be191[_0x070e('0x35')],_0x1be191[_0x070e('0x36')]);_0x44ab7c['attributes']=_[_0x070e('0x39')](_0x1be191[_0x070e('0x35')],qs['fields'](_0xb7866f['query'][_0x070e('0x3b')]));_0x44ab7c[_0x070e('0x3a')]=_0x44ab7c[_0x070e('0x3a')]['length']?_0x44ab7c[_0x070e('0x3a')]:_0x1be191[_0x070e('0x35')];_0x44ab7c[_0x070e('0x59')]=qs[_0x070e('0x3e')](_0xb7866f[_0x070e('0x36')]['sort']);_0x44ab7c[_0x070e('0x3f')]=qs[_0x070e('0x38')](_['pick'](_0xb7866f[_0x070e('0x36')],_0x1be191['filters']));if(_0xb7866f['query']['filter']){_0x44ab7c[_0x070e('0x3f')]=_[_0x070e('0x40')](_0x44ab7c[_0x070e('0x3f')],{'$or':_[_0x070e('0x27')](_0x44ab7c['attributes'],function(_0x1c3c01){var _0x1ed436={};_0x1ed436[_0x1c3c01]={'$like':'%'+_0xb7866f['query'][_0x070e('0x26')]+'%'};return _0x1ed436;})});}_0x44ab7c=_[_0x070e('0x40')]({},_0x44ab7c,_0xb7866f[_0x070e('0x42')]);return _0x1aec7c[_0x070e('0x65')](_0x44ab7c);}})[_0x070e('0x20')](function(_0x445182){if(_0x445182){_0x1fe46c=_0x445182['length'];if(!_0xb7866f[_0x070e('0x36')]['hasOwnProperty'](_0x070e('0x58'))){_0x44ab7c[_0x070e('0x1c')]=qs[_0x070e('0x1c')](_0xb7866f['query'][_0x070e('0x1c')]);_0x44ab7c[_0x070e('0x1b')]=qs[_0x070e('0x1b')](_0xb7866f['query'][_0x070e('0x1b')]);}return _0x1aec7c[_0x070e('0x65')](_0x44ab7c);}})['then'](function(_0x453e0e){if(_0x453e0e){return _0x453e0e?{'count':_0x1fe46c,'rows':_0x453e0e}:null;}})[_0x070e('0x20')](respondWithResult(_0xaf1aa3,null))['catch'](handleError(_0xaf1aa3,null));};exports['addTeams']=function(_0x4e85ee,_0x5e1fee,_0x1f0ea5){var _0x207922=_0x4e85ee[_0x070e('0x49')][_0x070e('0x66')];var _0x1204d7=_[_0x070e('0x27')](_0x207922,'id');return db[_0x070e('0x64')][_0x070e('0x5d')]({'where':{'id':_0x1204d7},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name','online',_0x070e('0x67'),_0x070e('0x68')],'raw':!![]}]})[_0x070e('0x20')](function(_0x305c58){if(_0x305c58){var _0x347794=_['flatMap'](_0x305c58,function(_0x528946){var _0x1644c2=_0x528946[_0x070e('0x22')]({'plain':!![]});_0x1644c2['Agents'][_0x070e('0x69')](function(_0x46e19f){_0x46e19f[_0x070e('0x6a')]=_[_0x070e('0x2b')](_0x207922,{'id':_0x1644c2['id']})[_0x070e('0x6a')];});return _0x1644c2[_0x070e('0x6b')];});return db['VoiceQueue'][_0x070e('0x2b')]({'where':{'id':_0x4e85ee[_0x070e('0x47')]['id']}})[_0x070e('0x20')](function(_0x5eb2f9){return db[_0x070e('0x6c')][_0x070e('0x6d')](function(_0x3ed2c9){return _0x5eb2f9[_0x070e('0x6e')](_0x1204d7,{'transaction':_0x3ed2c9})['then'](function(){return BPromise[_0x070e('0x6f')](_0x347794,function(_0x2beaa8){return db['UserVoiceQueue'][_0x070e('0x70')]({'where':{'UserId':_0x2beaa8['id'],'VoiceQueueId':_0x4e85ee[_0x070e('0x47')]['id']},'defaults':{'penalty':_0x2beaa8['penalty']},'transaction':_0x3ed2c9});});})[_0x070e('0x20')](function(){return BPromise['each'](_[_0x070e('0x26')](_0x347794,{'online':!![]}),function(_0x54f8d3){return db[_0x070e('0x71')]['upsert']({'membername':_0x54f8d3['name'],'UserId':_0x54f8d3['id'],'queue_name':_0x5eb2f9[_0x070e('0x2c')],'VoiceQueueId':_0x5eb2f9['id'],'interface':_['isNil'](_0x54f8d3['interface'])?util[_0x070e('0x72')](_0x070e('0x73'),_0x54f8d3[_0x070e('0x2c')]):_0x54f8d3[_0x070e('0x68')],'paused':_0x54f8d3[_0x070e('0x67')]||![],'penalty':_0x54f8d3['penalty']},{'transaction':_0x3ed2c9});});})[_0x070e('0x20')](function(){_0x347794[_0x070e('0x69')](function(_0x203989){socket[_0x070e('0x74')](_0x070e('0x75'),{'UserId':_0x203989['id'],'VoiceQueueId':_0x5eb2f9['id']});});});});});}})[_0x070e('0x20')](respondWithStatusCode(_0x5e1fee,null))['catch'](handleError(_0x5e1fee,null));};exports[_0x070e('0x76')]=function(_0x264089,_0x6aca88,_0x44c780){return db['Team']['findAll']({'where':{'id':_0x264089[_0x070e('0x36')][_0x070e('0x77')]},'attributes':['id'],'include':[{'model':db[_0x070e('0x78')],'as':_0x070e('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x070e('0x20')](handleEntityNotFound(_0x6aca88,null))[_0x070e('0x20')](function(_0x4e0df9){var _0x354257=_[_0x070e('0x27')](_0x4e0df9,'id');var _0x1e05c9=[];var _0x3a894e=[];var _0x383e31=squel[_0x070e('0x79')]();_0x383e31['field']('tq.TeamId')[_0x070e('0x7a')](_0x070e('0x7b'),'tq')[_0x070e('0x7c')](_0x070e('0x7d'),'ut',_0x070e('0x7e'))[_0x070e('0x3f')](_0x070e('0x7f'),_0x264089['params']['id']);for(var _0x2269f0=0x0;_0x2269f0<_0x4e0df9['length'];_0x2269f0+=0x1){let _0xfe12a6=_0x4e0df9[_0x2269f0];for(var _0x5dc059=0x0;_0x5dc059<_0xfe12a6['Agents']['length'];_0x5dc059+=0x1){let _0x383f39=_0xfe12a6[_0x070e('0x6b')][_0x5dc059];var _0x396809=_0x383e31[_0x070e('0x50')]();_0x396809[_0x070e('0x3f')](_0x070e('0x80'),_0x383f39['id']);_0x3a894e[_0x070e('0x81')](db[_0x070e('0x6c')][_0x070e('0x36')](_0x396809['toString'](),{'type':db[_0x070e('0x6c')][_0x070e('0x82')][_0x070e('0x83')]})[_0x070e('0x20')](function(_0x243fc7){if(_0x243fc7[_0x070e('0x3c')]===0x1){return _0x383f39['id'];}else{var _0x32ebf1=_[_0x070e('0x84')](_[_0x070e('0x27')](_0x243fc7,'TeamId'),function(_0x538f0c){return _[_0x070e('0x29')](_0x354257,_0x538f0c);});if(_0x32ebf1){return _0x383f39['id'];}}}));}}return BPromise[_0x070e('0x85')](_0x3a894e)['then'](function(_0x469efd){_0x1e05c9=_(_0x1e05c9)['union'](_0x469efd)['compact']()[_0x070e('0x28')]();return db[_0x070e('0x32')]['find']({'where':{'id':_0x264089[_0x070e('0x47')]['id']}})[_0x070e('0x20')](function(_0x32ea56){return db['sequelize']['transaction'](function(_0xe195af){return _0x32ea56[_0x070e('0x76')](_0x264089[_0x070e('0x36')]['ids'],{'transaction':_0xe195af})[_0x070e('0x20')](function(){if(!_[_0x070e('0x86')](_0x1e05c9)){return _0x32ea56['removeAgents'](_0x1e05c9,{'transaction':_0xe195af})[_0x070e('0x20')](function(){return db[_0x070e('0x71')][_0x070e('0x21')]({'where':{'VoiceQueueId':_0x264089[_0x070e('0x47')]['id'],'UserId':_0x1e05c9},'transaction':_0xe195af});});}})[_0x070e('0x20')](function(){_0x1e05c9[_0x070e('0x69')](function(_0x921cc0){socket[_0x070e('0x74')](_0x070e('0x87'),{'UserId':_0x921cc0,'VoiceQueueId':_0x32ea56['id']});});});});});});})[_0x070e('0x20')](respondWithStatusCode(_0x6aca88,null))[_0x070e('0x46')](handleError(_0x6aca88,null));};exports[_0x070e('0x88')]=function(_0x1b8cc9,_0x2b56d9,_0x148dd1){var _0x31c9ad,_0x2948a2;return db['VoiceQueue']['find']({'where':{'id':_0x1b8cc9['params']['id']}})['then'](handleEntityNotFound(_0x2b56d9,null))[_0x070e('0x20')](function(_0x8e9f07){if(_0x8e9f07){_0x2948a2=_0x8e9f07;return _0x8e9f07[_0x070e('0x88')](_0x1b8cc9['body'][_0x070e('0x77')],_[_0x070e('0x51')](_0x1b8cc9[_0x070e('0x49')],['ids','id'])||{})[_0x070e('0x89')](function(_0x43d597){for(var _0x7dd27c=0x0;_0x7dd27c<_0x1b8cc9[_0x070e('0x49')]['ids'][_0x070e('0x3c')];_0x7dd27c+=0x1){socket[_0x070e('0x74')](_0x070e('0x75'),{'UserId':_0x1b8cc9['body'][_0x070e('0x77')][_0x7dd27c],'VoiceQueueId':_0x1b8cc9[_0x070e('0x47')]['id']});}return _0x43d597;});}})[_0x070e('0x20')](function(_0x220cc9){_0x31c9ad=_0x220cc9||[];if(_0x2948a2){return db[_0x070e('0x78')][_0x070e('0x5d')]({'where':{'id':_0x1b8cc9[_0x070e('0x49')][_0x070e('0x77')]},'attributes':['id',_0x070e('0x2c'),'online','voicePause',_0x070e('0x68')],'raw':!![]});}})['then'](function(_0x4fc9db){if(!_[_0x070e('0x86')](_0x4fc9db)){var _0x6479e4=[];for(var _0x3007b7=0x0;_0x3007b7<_0x4fc9db[_0x070e('0x3c')];_0x3007b7++){if(_0x4fc9db[_0x3007b7][_0x070e('0x8a')]){_0x6479e4[_0x070e('0x81')](db['UserVoiceQueueRt'][_0x070e('0x8b')]({'membername':_0x4fc9db[_0x3007b7][_0x070e('0x2c')],'UserId':_0x4fc9db[_0x3007b7]['id'],'queue_name':_0x2948a2[_0x070e('0x2c')],'VoiceQueueId':_0x2948a2['id'],'interface':_[_0x070e('0x8c')](_0x4fc9db[_0x3007b7]['interface'])?util[_0x070e('0x72')]('SIP/%s',_0x4fc9db[_0x3007b7][_0x070e('0x2c')]):_0x4fc9db[_0x3007b7][_0x070e('0x68')],'paused':_0x4fc9db[_0x3007b7][_0x070e('0x67')]||![],'penalty':_0x1b8cc9[_0x070e('0x49')][_0x070e('0x6a')]||0x0}));}}return BPromise[_0x070e('0x85')](_0x6479e4);}})[_0x070e('0x20')](function(){return _0x31c9ad;})[_0x070e('0x20')](respondWithResult(_0x2b56d9,null))[_0x070e('0x46')](handleError(_0x2b56d9,null));};exports['removeAgents']=function(_0xc35037,_0x1f71df,_0x3283f5){return db[_0x070e('0x32')][_0x070e('0x2b')]({'where':{'id':_0xc35037[_0x070e('0x47')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x1f71df,null))[_0x070e('0x20')](function(_0x4e4ebd){if(_0x4e4ebd){return _0x4e4ebd[_0x070e('0x8d')](_0xc35037[_0x070e('0x36')]['ids'])['then'](function(){if(_[_0x070e('0x8e')](_0xc35037[_0x070e('0x36')][_0x070e('0x77')])){for(var _0x17ee9d=0x0;_0x17ee9d<_0xc35037[_0x070e('0x36')][_0x070e('0x77')]['length'];_0x17ee9d+=0x1){socket['emit'](_0x070e('0x87'),{'UserId':Number(_0xc35037[_0x070e('0x36')]['ids'][_0x17ee9d]),'VoiceQueueId':Number(_0xc35037[_0x070e('0x47')]['id'])});}}else{socket['emit'](_0x070e('0x87'),{'UserId':Number(_0xc35037[_0x070e('0x36')]['ids']),'VoiceQueueId':Number(_0xc35037[_0x070e('0x47')]['id'])});}});}})[_0x070e('0x20')](function(_0x5490aa){return db['UserVoiceQueueRt'][_0x070e('0x21')]({'where':{'VoiceQueueId':_0xc35037['params']['id'],'UserId':_0xc35037[_0x070e('0x36')][_0x070e('0x77')]}})[_0x070e('0x20')](function(){return _0x5490aa;});})['then'](respondWithStatusCode(_0x1f71df,null))[_0x070e('0x46')](handleError(_0x1f71df,null));};exports[_0x070e('0x8f')]=function(_0x4d3a07,_0xad0bb0,_0x19a689){var _0x4757e3={};var _0x94d6b2={};var _0x32f846;var _0x203ecb;return db[_0x070e('0x32')][_0x070e('0x57')]({'where':{'id':_0x4d3a07[_0x070e('0x47')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0xad0bb0,null))['then'](function(_0x26e6ee){if(_0x26e6ee){_0x32f846=_0x26e6ee;_0x94d6b2[_0x070e('0x35')]=_[_0x070e('0x37')](db['User']['rawAttributes']);_0x94d6b2[_0x070e('0x36')]=_[_0x070e('0x37')](_0x4d3a07[_0x070e('0x36')]);_0x94d6b2[_0x070e('0x38')]=_['intersection'](_0x94d6b2[_0x070e('0x35')],_0x94d6b2['query']);_0x4757e3['attributes']=_[_0x070e('0x39')](_0x94d6b2['model'],qs[_0x070e('0x3b')](_0x4d3a07[_0x070e('0x36')][_0x070e('0x3b')]));_0x4757e3[_0x070e('0x3a')]=_0x4757e3['attributes'][_0x070e('0x3c')]?_0x4757e3['attributes']:_0x94d6b2[_0x070e('0x35')];_0x4757e3[_0x070e('0x59')]=qs[_0x070e('0x3e')](_0x4d3a07[_0x070e('0x36')][_0x070e('0x3e')]);_0x4757e3[_0x070e('0x3f')]=qs[_0x070e('0x38')](_[_0x070e('0x5a')](_0x4d3a07[_0x070e('0x36')],_0x94d6b2[_0x070e('0x38')]));if(_0x4d3a07[_0x070e('0x36')][_0x070e('0x26')]){_0x4757e3[_0x070e('0x3f')]=_[_0x070e('0x40')](_0x4757e3[_0x070e('0x3f')],{'$or':_[_0x070e('0x27')](_0x4757e3['attributes'],function(_0x48ea98){var _0x184343={};_0x184343[_0x48ea98]={'$like':'%'+_0x4d3a07[_0x070e('0x36')]['filter']+'%'};return _0x184343;})});}_0x4757e3=_[_0x070e('0x40')]({},_0x4757e3,_0x4d3a07[_0x070e('0x42')]);return _0x32f846['getAgents'](_0x4757e3);}})[_0x070e('0x20')](function(_0x5ad1aa){if(_0x5ad1aa){_0x203ecb=_0x5ad1aa['length'];if(!_0x4d3a07[_0x070e('0x36')][_0x070e('0x3d')](_0x070e('0x58'))){_0x4757e3[_0x070e('0x1c')]=qs[_0x070e('0x1c')](_0x4d3a07[_0x070e('0x36')]['limit']);_0x4757e3[_0x070e('0x1b')]=qs[_0x070e('0x1b')](_0x4d3a07[_0x070e('0x36')]['offset']);}return _0x32f846[_0x070e('0x8f')](_0x4757e3);}})[_0x070e('0x20')](function(_0xe50bad){if(_0xe50bad){return _0xe50bad?{'count':_0x203ecb,'rows':_0xe50bad}:null;}})[_0x070e('0x20')](respondWithResult(_0xad0bb0,null))['catch'](handleError(_0xad0bb0,null));};exports['getMembers']=function(_0x3991e5,_0xe3e68,_0x39ea01){var _0x2a36cb={};var _0x234a39={};var _0x3bc713;var _0x155555;return db['VoiceQueue'][_0x070e('0x57')]({'where':{'id':_0x3991e5[_0x070e('0x47')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0xe3e68,null))[_0x070e('0x20')](function(_0x47165e){if(_0x47165e){_0x3bc713=_0x47165e;_0x234a39[_0x070e('0x35')]=_[_0x070e('0x37')](db[_0x070e('0x71')][_0x070e('0x33')]);_0x234a39[_0x070e('0x36')]=_[_0x070e('0x37')](_0x3991e5[_0x070e('0x36')]);_0x234a39[_0x070e('0x38')]=_[_0x070e('0x39')](_0x234a39[_0x070e('0x35')],_0x234a39['query']);_0x2a36cb[_0x070e('0x3a')]=_[_0x070e('0x39')](_0x234a39[_0x070e('0x35')],qs[_0x070e('0x3b')](_0x3991e5[_0x070e('0x36')][_0x070e('0x3b')]));_0x2a36cb[_0x070e('0x3a')]=_0x2a36cb['attributes'][_0x070e('0x3c')]?_0x2a36cb[_0x070e('0x3a')]:_0x234a39[_0x070e('0x35')];_0x2a36cb[_0x070e('0x59')]=qs[_0x070e('0x3e')](_0x3991e5[_0x070e('0x36')][_0x070e('0x3e')]);_0x2a36cb[_0x070e('0x3f')]=qs[_0x070e('0x38')](_['pick'](_0x3991e5[_0x070e('0x36')],_0x234a39[_0x070e('0x38')]));if(_0x3991e5[_0x070e('0x36')][_0x070e('0x26')]){_0x2a36cb[_0x070e('0x3f')]=_[_0x070e('0x40')](_0x2a36cb[_0x070e('0x3f')],{'$or':_[_0x070e('0x27')](_0x2a36cb[_0x070e('0x3a')],function(_0x1c8c06){var _0x2b6400={};_0x2b6400[_0x1c8c06]={'$like':'%'+_0x3991e5[_0x070e('0x36')][_0x070e('0x26')]+'%'};return _0x2b6400;})});}_0x2a36cb=_[_0x070e('0x40')]({},_0x2a36cb,_0x3991e5[_0x070e('0x42')]);return _0x3bc713[_0x070e('0x90')](_0x2a36cb);}})[_0x070e('0x20')](function(_0x5608f9){if(_0x5608f9){_0x155555=_0x5608f9[_0x070e('0x3c')];if(!_0x3991e5[_0x070e('0x36')][_0x070e('0x3d')](_0x070e('0x58'))){_0x2a36cb['limit']=qs[_0x070e('0x1c')](_0x3991e5[_0x070e('0x36')][_0x070e('0x1c')]);_0x2a36cb[_0x070e('0x1b')]=qs['offset'](_0x3991e5[_0x070e('0x36')]['offset']);}return _0x3bc713[_0x070e('0x90')](_0x2a36cb);}})['then'](function(_0x59383a){return _0x59383a?{'count':_0x155555,'rows':_0x59383a}:null;})[_0x070e('0x20')](respondWithResult(_0xe3e68,null))[_0x070e('0x46')](handleError(_0xe3e68,null));};exports[_0x070e('0x91')]=function(_0x5880bb,_0x11e90d,_0x5ab854){var _0x120acd={};var _0x1e0e55={};var _0x4f11dc;var _0x17a593;return db['VoiceQueue'][_0x070e('0x57')]({'where':{'id':_0x5880bb[_0x070e('0x47')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x11e90d,null))['then'](function(_0x54fd79){if(_0x54fd79){_0x4f11dc=_0x54fd79;_0x1e0e55[_0x070e('0x35')]=_['keys'](db[_0x070e('0x92')][_0x070e('0x33')]);_0x1e0e55[_0x070e('0x36')]=_[_0x070e('0x37')](_0x5880bb[_0x070e('0x36')]);_0x1e0e55[_0x070e('0x38')]=_['intersection'](_0x1e0e55['model'],_0x1e0e55[_0x070e('0x36')]);_0x120acd['attributes']=_['intersection'](_0x1e0e55[_0x070e('0x35')],qs[_0x070e('0x3b')](_0x5880bb[_0x070e('0x36')]['fields']));_0x120acd[_0x070e('0x3a')]=_0x120acd[_0x070e('0x3a')][_0x070e('0x3c')]?_0x120acd['attributes']:_0x1e0e55['model'];_0x120acd[_0x070e('0x59')]=qs[_0x070e('0x3e')](_0x5880bb[_0x070e('0x36')]['sort']);_0x120acd[_0x070e('0x3f')]=qs['filters'](_[_0x070e('0x5a')](_0x5880bb['query'],_0x1e0e55[_0x070e('0x38')]));if(_0x5880bb[_0x070e('0x36')]['filter']){_0x120acd[_0x070e('0x3f')]=_[_0x070e('0x40')](_0x120acd[_0x070e('0x3f')],{'$or':_[_0x070e('0x27')](_0x120acd[_0x070e('0x3a')],function(_0xd6529a){var _0x24ded2={};_0x24ded2[_0xd6529a]={'$like':'%'+_0x5880bb[_0x070e('0x36')][_0x070e('0x26')]+'%'};return _0x24ded2;})});}_0x120acd=_[_0x070e('0x40')]({},_0x120acd,_0x5880bb[_0x070e('0x42')]);return _0x4f11dc[_0x070e('0x91')](_0x120acd);}})[_0x070e('0x20')](function(_0x5c437b){if(_0x5c437b){_0x17a593=_0x5c437b[_0x070e('0x3c')];if(!_0x5880bb[_0x070e('0x36')][_0x070e('0x3d')]('nolimit')){_0x120acd['limit']=qs[_0x070e('0x1c')](_0x5880bb[_0x070e('0x36')]['limit']);_0x120acd[_0x070e('0x1b')]=qs[_0x070e('0x1b')](_0x5880bb[_0x070e('0x36')]['offset']);}return _0x4f11dc[_0x070e('0x91')](_0x120acd);}})['then'](function(_0x27fc1f){if(_0x27fc1f){return _0x27fc1f?{'count':_0x17a593,'rows':_0x27fc1f}:null;}})[_0x070e('0x20')](respondWithResult(_0x11e90d,null))['catch'](handleError(_0x11e90d,null));};exports[_0x070e('0x93')]=function(_0x2268ea,_0x3dac08,_0xa2f25a){var _0x49bb8a,_0x19e6a3;return db[_0x070e('0x32')][_0x070e('0x2b')]({'where':{'id':_0x2268ea[_0x070e('0x47')]['id']}})['then'](handleEntityNotFound(_0x3dac08,null))[_0x070e('0x20')](function(_0x29e61d){if(_0x29e61d){_0x19e6a3=_0x29e61d;return _0x29e61d[_0x070e('0x93')](_0x2268ea[_0x070e('0x49')]['ids'],_['omit'](_0x2268ea['body'],[_0x070e('0x77'),'id'])||{});}return null;})['spread'](function(_0x384c8d){var _0x2d14eb;_0x49bb8a=_0x384c8d||[];var _0x5450bc=[];if(_0x384c8d){for(var _0x1276dd=0x0;_0x1276dd<_0x384c8d['length'];_0x1276dd+=0x1){var _0x483c17=_0x384c8d[_0x1276dd][_0x070e('0x22')]({'plain':!![]});_0x19e6a3[_0x070e('0x94')]=_0x2268ea[_0x070e('0x49')][_0x070e('0x94')]?_0x2268ea[_0x070e('0x49')][_0x070e('0x94')]:_0x19e6a3[_0x070e('0x94')];switch(_0x19e6a3[_0x070e('0x94')]){case _0x070e('0x95'):_0x2d14eb=squel[_0x070e('0x96')]()[_0x070e('0x97')](_0x070e('0x98'))['fromQuery']([_0x070e('0x99'),_0x070e('0x9a'),_0x070e('0x9b'),_0x070e('0x9c'),_0x070e('0x5b'),_0x070e('0x9d'),'updatedAt'],squel['select']()['field'](_0x070e('0x99'),_0x070e('0x99'))[_0x070e('0x9e')]('NOW()',_0x070e('0x9a'))[_0x070e('0x9e')]('id','ContactId')['field'](_0x483c17[_0x070e('0x9f')]['toString'](),_0x070e('0x9c'))[_0x070e('0x9e')](_0x2268ea[_0x070e('0x47')]['id'][_0x070e('0xa0')](),_0x070e('0x5b'))[_0x070e('0x9e')]('NOW()',_0x070e('0x9d'))[_0x070e('0x9e')](_0x070e('0xa1'),'updatedAt')[_0x070e('0x7a')]('cm_contacts')['where'](_0x070e('0xa2'))['where'](_0x070e('0xa3'),_0x483c17['CmListId'][_0x070e('0xa0')]())[_0x070e('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0x070e('0x3f')](_0x070e('0xa4'),squel[_0x070e('0x79')]()[_0x070e('0x9e')](_0x070e('0xa5'))[_0x070e('0x7a')](_0x070e('0xa6'))[_0x070e('0x3f')](_0x070e('0x7f'),_0x2268ea[_0x070e('0x47')]['id']['toString']()))[_0x070e('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0x070e('0x79')]()[_0x070e('0x9e')]('COALESCE(phone,\x27\x27)')[_0x070e('0x7a')]('cm_hopper')[_0x070e('0x3f')]('VoiceQueueId\x20=\x20?',_0x2268ea[_0x070e('0x47')]['id'][_0x070e('0xa0')]())))['toString']();break;case _0x070e('0xa7'):_0x2d14eb=squel[_0x070e('0x96')]()[_0x070e('0x97')](_0x070e('0x98'))[_0x070e('0xa8')](['phone',_0x070e('0x9a'),'ContactId','ListId',_0x070e('0x5b'),'createdAt','updatedAt'],squel[_0x070e('0x79')]()['field'](_0x070e('0x99'),_0x070e('0x99'))[_0x070e('0x9e')]('NOW()',_0x070e('0x9a'))[_0x070e('0x9e')]('id',_0x070e('0x9b'))[_0x070e('0x9e')](_0x483c17[_0x070e('0x9f')]['toString'](),_0x070e('0x9c'))[_0x070e('0x9e')](_0x2268ea[_0x070e('0x47')]['id'][_0x070e('0xa0')](),_0x070e('0x5b'))[_0x070e('0x9e')](_0x070e('0xa1'),'createdAt')[_0x070e('0x9e')](_0x070e('0xa1'),_0x070e('0x52'))[_0x070e('0x7a')]('cm_contacts')[_0x070e('0x3f')](_0x070e('0xa2'))[_0x070e('0x3f')]('ListId\x20=\x20?',_0x483c17[_0x070e('0x9f')][_0x070e('0xa0')]())[_0x070e('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0x070e('0x3f')](_0x070e('0xa4'),squel[_0x070e('0x79')]()[_0x070e('0x9e')](_0x070e('0xa9'))[_0x070e('0x7a')]('cm_hopper')[_0x070e('0x3f')](_0x070e('0x7f'),_0x2268ea['params']['id']['toString']())))[_0x070e('0xa0')]();break;default:_0x2d14eb=squel[_0x070e('0x96')]()[_0x070e('0x97')](_0x070e('0x98'))['fromQuery']([_0x070e('0x99'),_0x070e('0x9a'),_0x070e('0x9b'),'ListId',_0x070e('0x5b'),_0x070e('0x9d'),_0x070e('0x52')],squel[_0x070e('0x79')]()['field']('phone',_0x070e('0x99'))[_0x070e('0x9e')]('NOW()',_0x070e('0x9a'))[_0x070e('0x9e')]('id','ContactId')['field'](_0x483c17[_0x070e('0x9f')][_0x070e('0xa0')](),_0x070e('0x9c'))[_0x070e('0x9e')](_0x2268ea['params']['id']['toString'](),_0x070e('0x5b'))[_0x070e('0x9e')]('NOW()',_0x070e('0x9d'))['field'](_0x070e('0xa1'),_0x070e('0x52'))[_0x070e('0x7a')]('cm_contacts')[_0x070e('0x3f')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x483c17[_0x070e('0x9f')][_0x070e('0xa0')]())[_0x070e('0x3f')](_0x070e('0xaa')))[_0x070e('0xa0')]();}_0x5450bc[_0x070e('0x81')](db[_0x070e('0x6c')][_0x070e('0x36')](_0x2d14eb));}return BPromise[_0x070e('0x85')](_0x5450bc);}})[_0x070e('0x20')](function(){return _0x49bb8a;})[_0x070e('0x20')](respondWithResult(_0x3dac08,null))['catch'](handleError(_0x3dac08,null));};exports[_0x070e('0xab')]=function(_0x302c18,_0x47fdfe,_0x58106d){return db[_0x070e('0x32')][_0x070e('0x2b')]({'where':{'id':_0x302c18[_0x070e('0x47')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x47fdfe,null))['then'](function(_0x1935cb){if(_0x1935cb){return _0x1935cb[_0x070e('0xab')](_0x302c18[_0x070e('0x36')][_0x070e('0x77')]);}})[_0x070e('0x20')](function(_0x3fca22){if(_0x3fca22){return db['CmHopper'][_0x070e('0x21')]({'where':{'ListId':_0x302c18['query'][_0x070e('0x77')],'VoiceQueueId':_0x302c18[_0x070e('0x47')]['id']}})[_0x070e('0x20')](function(){return _0x3fca22;});}})[_0x070e('0x20')](respondWithStatusCode(_0x47fdfe,null))[_0x070e('0x46')](handleError(_0x47fdfe,null));};exports[_0x070e('0xac')]=function(_0x22cca8,_0x560176,_0x3f9ec8){var _0x431671={};var _0x1fb6fa={};var _0xb613e4;var _0xa7bca5;return db[_0x070e('0x32')][_0x070e('0x57')]({'where':{'id':_0x22cca8[_0x070e('0x47')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x560176,null))[_0x070e('0x20')](function(_0x14c924){if(_0x14c924){_0xb613e4=_0x14c924;_0x1fb6fa[_0x070e('0x35')]=_[_0x070e('0x37')](db[_0x070e('0x92')]['rawAttributes']);_0x1fb6fa[_0x070e('0x36')]=_[_0x070e('0x37')](_0x22cca8['query']);_0x1fb6fa[_0x070e('0x38')]=_[_0x070e('0x39')](_0x1fb6fa[_0x070e('0x35')],_0x1fb6fa[_0x070e('0x36')]);_0x431671['attributes']=_[_0x070e('0x39')](_0x1fb6fa[_0x070e('0x35')],qs['fields'](_0x22cca8[_0x070e('0x36')][_0x070e('0x3b')]));_0x431671[_0x070e('0x3a')]=_0x431671[_0x070e('0x3a')][_0x070e('0x3c')]?_0x431671['attributes']:_0x1fb6fa[_0x070e('0x35')];_0x431671[_0x070e('0x59')]=qs[_0x070e('0x3e')](_0x22cca8[_0x070e('0x36')]['sort']);_0x431671[_0x070e('0x3f')]=qs[_0x070e('0x38')](_[_0x070e('0x5a')](_0x22cca8['query'],_0x1fb6fa[_0x070e('0x38')]));if(_0x22cca8[_0x070e('0x36')]['filter']){_0x431671[_0x070e('0x3f')]=_[_0x070e('0x40')](_0x431671[_0x070e('0x3f')],{'$or':_[_0x070e('0x27')](_0x431671['attributes'],function(_0x2942c1){var _0x5e1a7a={};_0x5e1a7a[_0x2942c1]={'$like':'%'+_0x22cca8[_0x070e('0x36')][_0x070e('0x26')]+'%'};return _0x5e1a7a;})});}_0x431671=_[_0x070e('0x40')]({},_0x431671,_0x22cca8['options']);return _0xb613e4['getBlackLists'](_0x431671);}})['then'](function(_0x2fc59f){if(_0x2fc59f){_0xa7bca5=_0x2fc59f[_0x070e('0x3c')];if(!_0x22cca8['query'][_0x070e('0x3d')](_0x070e('0x58'))){_0x431671[_0x070e('0x1c')]=qs[_0x070e('0x1c')](_0x22cca8[_0x070e('0x36')][_0x070e('0x1c')]);_0x431671[_0x070e('0x1b')]=qs['offset'](_0x22cca8[_0x070e('0x36')]['offset']);}return _0xb613e4[_0x070e('0xac')](_0x431671);}})[_0x070e('0x20')](function(_0x14ed61){if(_0x14ed61){return _0x14ed61?{'count':_0xa7bca5,'rows':_0x14ed61}:null;}})[_0x070e('0x20')](respondWithResult(_0x560176,null))['catch'](handleError(_0x560176,null));};exports[_0x070e('0xad')]=function(_0x308f28,_0x18c17f,_0x599623){var _0x253029,_0x579554;return db[_0x070e('0x32')][_0x070e('0x2b')]({'where':{'id':_0x308f28[_0x070e('0x47')]['id']}})['then'](handleEntityNotFound(_0x18c17f,null))[_0x070e('0x20')](function(_0x4c3f6f){if(_0x4c3f6f){_0x579554=_0x4c3f6f;return _0x4c3f6f[_0x070e('0xad')](_0x308f28[_0x070e('0x49')][_0x070e('0x77')],_[_0x070e('0x51')](_0x308f28[_0x070e('0x49')],[_0x070e('0x77'),'id'])||{});}return null;})[_0x070e('0x89')](function(_0x1fdbbe){var _0x26d9b5;_0x253029=_0x1fdbbe||[];var _0x5e10c3=[];if(_0x1fdbbe){for(var _0x15fc52=0x0;_0x15fc52<_0x1fdbbe[_0x070e('0x3c')];_0x15fc52+=0x1){var _0x490713=_0x1fdbbe[_0x15fc52][_0x070e('0x22')]({'plain':!![]});_0x26d9b5=squel[_0x070e('0x96')]()[_0x070e('0x97')](_0x070e('0xae'))[_0x070e('0xa8')]([_0x070e('0x99'),_0x070e('0x9b'),_0x070e('0x9c'),_0x070e('0x5b'),'createdAt',_0x070e('0x52')],squel[_0x070e('0x79')]()[_0x070e('0x9e')]('phone',_0x070e('0x99'))[_0x070e('0x9e')]('id',_0x070e('0x9b'))[_0x070e('0x9e')](_0x490713[_0x070e('0x9f')][_0x070e('0xa0')](),_0x070e('0x9c'))['field'](_0x308f28[_0x070e('0x47')]['id'][_0x070e('0xa0')](),_0x070e('0x5b'))[_0x070e('0x9e')](_0x070e('0xa1'),'createdAt')[_0x070e('0x9e')](_0x070e('0xa1'),'updatedAt')['from']('cm_contacts')[_0x070e('0x3f')](_0x070e('0xa2'))['where']('ListId\x20=\x20?',_0x490713[_0x070e('0x9f')]['toString']())[_0x070e('0x3f')](_0x070e('0xaa')))[_0x070e('0xa0')]();_0x5e10c3[_0x070e('0x81')](db[_0x070e('0x6c')][_0x070e('0x36')](_0x26d9b5));}return BPromise[_0x070e('0x85')](_0x5e10c3);}})['then'](function(){return _0x253029;})[_0x070e('0x20')](respondWithResult(_0x18c17f,null))[_0x070e('0x46')](handleError(_0x18c17f,null));};exports[_0x070e('0xaf')]=function(_0x45baf1,_0x5c0b68,_0x548100){return db[_0x070e('0x32')][_0x070e('0x2b')]({'where':{'id':_0x45baf1[_0x070e('0x47')]['id']}})['then'](handleEntityNotFound(_0x5c0b68,null))[_0x070e('0x20')](function(_0x2b3145){if(_0x2b3145){return _0x2b3145[_0x070e('0xaf')](_0x45baf1[_0x070e('0x36')]['ids']);}})['then'](function(_0x462330){if(_0x462330){return db[_0x070e('0x63')][_0x070e('0x21')]({'where':{'ListId':_0x45baf1[_0x070e('0x36')][_0x070e('0x77')],'VoiceQueueId':_0x45baf1['params']['id']}})['then'](function(){return _0x462330;});}})['then'](respondWithStatusCode(_0x5c0b68,null))[_0x070e('0x46')](handleError(_0x5c0b68,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 05b8843..84904e4 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 _0x6d6d=['hook','events','../../mysqldb','VoiceQueue','save','update','remove','hasOwnProperty'];(function(_0x18ad19,_0x5c35a1){var _0x34d0cd=function(_0x280881){while(--_0x280881){_0x18ad19['push'](_0x18ad19['shift']());}};_0x34d0cd(++_0x5c35a1);}(_0x6d6d,0x1a1));var _0xd6d6=function(_0x5ac55b,_0xb5382b){_0x5ac55b=_0x5ac55b-0x0;var _0x2ef30c=_0x6d6d[_0x5ac55b];return _0x2ef30c;};'use strict';var EventEmitter=require(_0xd6d6('0x0'));var VoiceQueue=require(_0xd6d6('0x1'))['db'][_0xd6d6('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd6d6('0x3'),'afterUpdate':_0xd6d6('0x4'),'afterDestroy':_0xd6d6('0x5')};function emitEvent(_0xcdbb67){return function(_0x5769f6,_0x581746,_0x8752ed){VoiceQueueEvents['emit'](_0xcdbb67+':'+_0x5769f6['id'],_0x5769f6);VoiceQueueEvents['emit'](_0xcdbb67,_0x5769f6);_0x8752ed(null);};}for(var e in events){if(events[_0xd6d6('0x6')](e)){var event=events[e];VoiceQueue[_0xd6d6('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xad0c=['hook','exports','VoiceQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xad0c,0xa2));var _0xcad0=function(_0x474588,_0x3cfb9c){_0x474588=_0x474588-0x0;var _0x1f26e9=_0xad0c[_0x474588];return _0x1f26e9;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db'][_0xcad0('0x0')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xcad0('0x1')](0x0);var events={'afterCreate':_0xcad0('0x2'),'afterUpdate':_0xcad0('0x3'),'afterDestroy':'remove'};function emitEvent(_0x46d4af){return function(_0x498dac,_0x249d72,_0x354a71){VoiceQueueEvents[_0xcad0('0x4')](_0x46d4af+':'+_0x498dac['id'],_0x498dac);VoiceQueueEvents[_0xcad0('0x4')](_0x46d4af,_0x498dac);_0x354a71(null);};}for(var e in events){if(events[_0xcad0('0x5')](e)){var event=events[e];VoiceQueue[_0xcad0('0x6')](e,emitEvent(event));}}module[_0xcad0('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index fc5ecd2..b69fad6 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 _0xe883=['exports','define','VoiceQueue','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceQueue.attributes'];(function(_0x90f34f,_0x404021){var _0x4b18cf=function(_0x25112d){while(--_0x25112d){_0x90f34f['push'](_0x90f34f['shift']());}};_0x4b18cf(++_0x404021);}(_0xe883,0x18f));var _0x3e88=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0xe883[_0x9dfc10];return _0x4f938a;};'use strict';var _=require('lodash');var util=require(_0x3e88('0x0'));var logger=require(_0x3e88('0x1'))(_0x3e88('0x2'));var moment=require(_0x3e88('0x3'));var BPromise=require(_0x3e88('0x4'));var rp=require(_0x3e88('0x5'));var fs=require('fs');var path=require(_0x3e88('0x6'));var rimraf=require('rimraf');var config=require(_0x3e88('0x7'));var attributes=require(_0x3e88('0x8'));module[_0x3e88('0x9')]=function(_0x20f923,_0x198280){return _0x20f923[_0x3e88('0xa')](_0x3e88('0xb'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d68=['define','VoiceQueue','voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x1d68,0x9f));var _0x81d6=function(_0x2db82d,_0x2576f7){_0x2db82d=_0x2db82d-0x0;var _0x424948=_0x1d68[_0x2db82d];return _0x424948;};'use strict';var _=require(_0x81d6('0x0'));var util=require(_0x81d6('0x1'));var logger=require(_0x81d6('0x2'))(_0x81d6('0x3'));var moment=require(_0x81d6('0x4'));var BPromise=require(_0x81d6('0x5'));var rp=require(_0x81d6('0x6'));var fs=require('fs');var path=require(_0x81d6('0x7'));var rimraf=require(_0x81d6('0x8'));var config=require('../../config/environment');var attributes=require(_0x81d6('0x9'));module['exports']=function(_0x33b030,_0x1355ff){return _0x33b030[_0x81d6('0xa')](_0x81d6('0xb'),attributes,{'tableName':_0x81d6('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 828371d..e5af089 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 _0x1fdd=['localhost','socket.io-emitter','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','include','map','model','ShowVoiceQueue','find','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults'];(function(_0x2b26c5,_0x547bea){var _0xfc7f7f=function(_0x2280b9){while(--_0x2280b9){_0x2b26c5['push'](_0x2b26c5['shift']());}};_0xfc7f7f(++_0x547bea);}(_0x1fdd,0x153));var _0xd1fd=function(_0x1e6437,_0x52d483){_0x1e6437=_0x1e6437-0x0;var _0x3f97ae=_0x1fdd[_0x1e6437];return _0x3f97ae;};'use strict';var _=require(_0xd1fd('0x0'));var util=require(_0xd1fd('0x1'));var moment=require(_0xd1fd('0x2'));var BPromise=require(_0xd1fd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd1fd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd1fd('0x5'));var logger=require('../../config/logger')(_0xd1fd('0x6'));var config=require(_0xd1fd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd1fd('0x8')][_0xd1fd('0x9')]({'port':0x232a});config[_0xd1fd('0xa')]=_[_0xd1fd('0xb')](config['redis'],{'host':_0xd1fd('0xc'),'port':0x18eb});var socket=require(_0xd1fd('0xd'))(new Redis(config[_0xd1fd('0xa')]));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x22ae3e,_0xf2056b,_0x529249){return new BPromise(function(_0xe99215,_0xaa6a1a){return client[_0xd1fd('0xe')](_0x22ae3e,_0x529249)[_0xd1fd('0xf')](function(_0x5c347d){logger[_0xd1fd('0x10')](_0xd1fd('0x11'),_0xf2056b,_0xd1fd('0x12'));logger[_0xd1fd('0x13')](_0xd1fd('0x14'),_0xf2056b,_0xd1fd('0x12'),JSON[_0xd1fd('0x15')](_0x5c347d));if(_0x5c347d['error']){if(_0x5c347d['error'][_0xd1fd('0x16')]===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0xf2056b,_0x5c347d[_0xd1fd('0x17')]['message']);return _0xaa6a1a(_0x5c347d[_0xd1fd('0x17')][_0xd1fd('0x18')]);}logger[_0xd1fd('0x17')]('VoiceQueue,\x20%s,\x20%s',_0xf2056b,_0x5c347d[_0xd1fd('0x17')][_0xd1fd('0x18')]);return _0xe99215(_0x5c347d['error'][_0xd1fd('0x18')]);}else{logger[_0xd1fd('0x10')](_0xd1fd('0x11'),_0xf2056b,'request\x20sent');_0xe99215(_0x5c347d[_0xd1fd('0x19')]['message']);}})[_0xd1fd('0x1a')](function(_0x1396bb){logger[_0xd1fd('0x17')]('VoiceQueue,\x20%s,\x20%s',_0xf2056b,_0x1396bb);_0xaa6a1a(_0x1396bb);});});}exports[_0xd1fd('0x1b')]=function(_0xef1633){var _0x572cb3=this;return new Promise(function(_0x4c4763,_0x3428cf){return db[_0xd1fd('0x1c')][_0xd1fd('0x1d')]({'raw':_0xef1633[_0xd1fd('0x1e')]?_0xef1633[_0xd1fd('0x1e')][_0xd1fd('0x1f')]===undefined?!![]:![]:!![],'where':_0xef1633[_0xd1fd('0x1e')]?_0xef1633[_0xd1fd('0x1e')][_0xd1fd('0x20')]||null:null,'attributes':_0xef1633[_0xd1fd('0x1e')]?_0xef1633[_0xd1fd('0x1e')][_0xd1fd('0x21')]||null:null,'limit':_0xef1633[_0xd1fd('0x1e')]?_0xef1633[_0xd1fd('0x1e')]['limit']||null:null,'include':_0xef1633[_0xd1fd('0x1e')]?_0xef1633[_0xd1fd('0x1e')][_0xd1fd('0x22')]?_[_0xd1fd('0x23')](_0xef1633[_0xd1fd('0x1e')][_0xd1fd('0x22')],function(_0x3c1bfd){return{'model':db[_0x3c1bfd[_0xd1fd('0x24')]],'as':_0x3c1bfd['as'],'attributes':_0x3c1bfd['attributes'],'include':_0x3c1bfd['include']?_[_0xd1fd('0x23')](_0x3c1bfd[_0xd1fd('0x22')],function(_0x2afc41){return{'model':db[_0x2afc41[_0xd1fd('0x24')]],'as':_0x2afc41['as'],'attributes':_0x2afc41[_0xd1fd('0x21')],'include':_0x2afc41[_0xd1fd('0x22')]?_[_0xd1fd('0x23')](_0x2afc41[_0xd1fd('0x22')],function(_0x1c2aba){return{'model':db[_0x1c2aba[_0xd1fd('0x24')]],'as':_0x1c2aba['as'],'attributes':_0x1c2aba[_0xd1fd('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd1fd('0xf')](function(_0x3fd907){logger[_0xd1fd('0x10')](_0xd1fd('0x1b'),_0xef1633);logger[_0xd1fd('0x13')](_0xd1fd('0x1b'),_0xef1633,JSON[_0xd1fd('0x15')](_0x3fd907));_0x4c4763(_0x3fd907);})['catch'](function(_0x651102){logger['error'](_0xd1fd('0x1b'),_0x651102[_0xd1fd('0x18')],_0xef1633);_0x3428cf(_0x572cb3[_0xd1fd('0x17')](0x1f4,_0x651102[_0xd1fd('0x18')]));});});};exports[_0xd1fd('0x25')]=function(_0x531b0d){var _0x18d686=this;return new Promise(function(_0x4b2e67,_0x2139f5){return db[_0xd1fd('0x1c')][_0xd1fd('0x26')]({'raw':_0x531b0d[_0xd1fd('0x1e')]?_0x531b0d[_0xd1fd('0x1e')][_0xd1fd('0x1f')]===undefined?!![]:![]:!![],'where':_0x531b0d['options']?_0x531b0d[_0xd1fd('0x1e')][_0xd1fd('0x20')]||null:null,'attributes':_0x531b0d[_0xd1fd('0x1e')]?_0x531b0d[_0xd1fd('0x1e')]['attributes']||null:null,'include':_0x531b0d['options']?_0x531b0d[_0xd1fd('0x1e')]['include']?_[_0xd1fd('0x23')](_0x531b0d[_0xd1fd('0x1e')][_0xd1fd('0x22')],function(_0x2b0f53){return{'model':db[_0x2b0f53['model']],'as':_0x2b0f53['as'],'attributes':_0x2b0f53['attributes'],'include':_0x2b0f53[_0xd1fd('0x22')]?_[_0xd1fd('0x23')](_0x2b0f53[_0xd1fd('0x22')],function(_0x53a003){return{'model':db[_0x53a003[_0xd1fd('0x24')]],'as':_0x53a003['as'],'attributes':_0x53a003[_0xd1fd('0x21')],'include':_0x53a003[_0xd1fd('0x22')]?_['map'](_0x53a003[_0xd1fd('0x22')],function(_0x471392){return{'model':db[_0x471392[_0xd1fd('0x24')]],'as':_0x471392['as'],'attributes':_0x471392['attributes']};}):[]};}):[]};}):[]:[]})[_0xd1fd('0xf')](function(_0xcd5868){logger[_0xd1fd('0x10')](_0xd1fd('0x25'),_0x531b0d);logger[_0xd1fd('0x13')](_0xd1fd('0x25'),_0x531b0d,JSON[_0xd1fd('0x15')](_0xcd5868));_0x4b2e67(_0xcd5868);})[_0xd1fd('0x1a')](function(_0x48d22c){logger[_0xd1fd('0x17')](_0xd1fd('0x25'),_0x48d22c[_0xd1fd('0x18')],_0x531b0d);_0x2139f5(_0x18d686[_0xd1fd('0x17')](0x1f4,_0x48d22c[_0xd1fd('0x18')]));});});}; \ No newline at end of file +var _0xb6c2=['../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','GetVoiceQueue','ShowVoiceQueue','find','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x136cbb,_0x2a97f9){var _0x333a69=function(_0x5dc5bb){while(--_0x5dc5bb){_0x136cbb['push'](_0x136cbb['shift']());}};_0x333a69(++_0x2a97f9);}(_0xb6c2,0x1b2));var _0x2b6c=function(_0x592cac,_0x516116){_0x592cac=_0x592cac-0x0;var _0x27408c=_0xb6c2[_0x592cac];return _0x27408c;};'use strict';var _=require('lodash');var util=require(_0x2b6c('0x0'));var moment=require(_0x2b6c('0x1'));var BPromise=require('bluebird');var rs=require(_0x2b6c('0x2'));var fs=require('fs');var Redis=require(_0x2b6c('0x3'));var db=require(_0x2b6c('0x4'))['db'];var utils=require(_0x2b6c('0x5'));var logger=require(_0x2b6c('0x6'))(_0x2b6c('0x7'));var config=require(_0x2b6c('0x8'));var jayson=require(_0x2b6c('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x2b6c('0xa')]=_[_0x2b6c('0xb')](config[_0x2b6c('0xa')],{'host':_0x2b6c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2b6c('0xa')]));require('./voiceQueue.socket')[_0x2b6c('0xd')](socket);function respondWithRpcPromise(_0x1a55c6,_0x5b38be,_0x567c15){return new BPromise(function(_0x40f2b7,_0x23505b){return client[_0x2b6c('0xe')](_0x1a55c6,_0x567c15)['then'](function(_0x53a5aa){logger[_0x2b6c('0xf')](_0x2b6c('0x10'),_0x5b38be,_0x2b6c('0x11'));logger[_0x2b6c('0x12')](_0x2b6c('0x13'),_0x5b38be,'request\x20sent',JSON[_0x2b6c('0x14')](_0x53a5aa));if(_0x53a5aa[_0x2b6c('0x15')]){if(_0x53a5aa[_0x2b6c('0x15')][_0x2b6c('0x16')]===0x1f4){logger[_0x2b6c('0x15')](_0x2b6c('0x10'),_0x5b38be,_0x53a5aa[_0x2b6c('0x15')][_0x2b6c('0x17')]);return _0x23505b(_0x53a5aa[_0x2b6c('0x15')][_0x2b6c('0x17')]);}logger[_0x2b6c('0x15')](_0x2b6c('0x10'),_0x5b38be,_0x53a5aa[_0x2b6c('0x15')][_0x2b6c('0x17')]);return _0x40f2b7(_0x53a5aa[_0x2b6c('0x15')][_0x2b6c('0x17')]);}else{logger[_0x2b6c('0xf')](_0x2b6c('0x10'),_0x5b38be,_0x2b6c('0x11'));_0x40f2b7(_0x53a5aa[_0x2b6c('0x18')][_0x2b6c('0x17')]);}})[_0x2b6c('0x19')](function(_0x58dea9){logger[_0x2b6c('0x15')](_0x2b6c('0x10'),_0x5b38be,_0x58dea9);_0x23505b(_0x58dea9);});});}exports['GetVoiceQueue']=function(_0x15df8d){var _0x4fa252=this;return new Promise(function(_0x3a4888,_0x44e1df){return db[_0x2b6c('0x1a')][_0x2b6c('0x1b')]({'raw':_0x15df8d['options']?_0x15df8d[_0x2b6c('0x1c')][_0x2b6c('0x1d')]===undefined?!![]:![]:!![],'where':_0x15df8d['options']?_0x15df8d['options'][_0x2b6c('0x1e')]||null:null,'attributes':_0x15df8d['options']?_0x15df8d[_0x2b6c('0x1c')][_0x2b6c('0x1f')]||null:null,'limit':_0x15df8d[_0x2b6c('0x1c')]?_0x15df8d['options'][_0x2b6c('0x20')]||null:null,'include':_0x15df8d[_0x2b6c('0x1c')]?_0x15df8d[_0x2b6c('0x1c')][_0x2b6c('0x21')]?_[_0x2b6c('0x22')](_0x15df8d[_0x2b6c('0x1c')][_0x2b6c('0x21')],function(_0x4192d0){return{'model':db[_0x4192d0[_0x2b6c('0x23')]],'as':_0x4192d0['as'],'attributes':_0x4192d0[_0x2b6c('0x1f')],'include':_0x4192d0[_0x2b6c('0x21')]?_[_0x2b6c('0x22')](_0x4192d0[_0x2b6c('0x21')],function(_0x419557){return{'model':db[_0x419557[_0x2b6c('0x23')]],'as':_0x419557['as'],'attributes':_0x419557[_0x2b6c('0x1f')],'include':_0x419557['include']?_[_0x2b6c('0x22')](_0x419557[_0x2b6c('0x21')],function(_0x1fa2bc){return{'model':db[_0x1fa2bc[_0x2b6c('0x23')]],'as':_0x1fa2bc['as'],'attributes':_0x1fa2bc[_0x2b6c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2b6c('0x24')](function(_0x375c6b){logger[_0x2b6c('0xf')]('GetVoiceQueue',_0x15df8d);logger[_0x2b6c('0x12')]('GetVoiceQueue',_0x15df8d,JSON[_0x2b6c('0x14')](_0x375c6b));_0x3a4888(_0x375c6b);})['catch'](function(_0x1596c8){logger[_0x2b6c('0x15')](_0x2b6c('0x25'),_0x1596c8['message'],_0x15df8d);_0x44e1df(_0x4fa252[_0x2b6c('0x15')](0x1f4,_0x1596c8[_0x2b6c('0x17')]));});});};exports[_0x2b6c('0x26')]=function(_0x46733a){var _0xe06701=this;return new Promise(function(_0x3fc171,_0x257813){return db['VoiceQueue'][_0x2b6c('0x27')]({'raw':_0x46733a[_0x2b6c('0x1c')]?_0x46733a[_0x2b6c('0x1c')][_0x2b6c('0x1d')]===undefined?!![]:![]:!![],'where':_0x46733a['options']?_0x46733a[_0x2b6c('0x1c')][_0x2b6c('0x1e')]||null:null,'attributes':_0x46733a[_0x2b6c('0x1c')]?_0x46733a[_0x2b6c('0x1c')][_0x2b6c('0x1f')]||null:null,'include':_0x46733a[_0x2b6c('0x1c')]?_0x46733a[_0x2b6c('0x1c')]['include']?_[_0x2b6c('0x22')](_0x46733a[_0x2b6c('0x1c')]['include'],function(_0x3db670){return{'model':db[_0x3db670[_0x2b6c('0x23')]],'as':_0x3db670['as'],'attributes':_0x3db670[_0x2b6c('0x1f')],'include':_0x3db670['include']?_[_0x2b6c('0x22')](_0x3db670[_0x2b6c('0x21')],function(_0x4bebbc){return{'model':db[_0x4bebbc['model']],'as':_0x4bebbc['as'],'attributes':_0x4bebbc[_0x2b6c('0x1f')],'include':_0x4bebbc[_0x2b6c('0x21')]?_[_0x2b6c('0x22')](_0x4bebbc[_0x2b6c('0x21')],function(_0x376977){return{'model':db[_0x376977['model']],'as':_0x376977['as'],'attributes':_0x376977[_0x2b6c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2b6c('0x24')](function(_0x1ce136){logger[_0x2b6c('0xf')](_0x2b6c('0x26'),_0x46733a);logger[_0x2b6c('0x12')](_0x2b6c('0x26'),_0x46733a,JSON['stringify'](_0x1ce136));_0x3fc171(_0x1ce136);})['catch'](function(_0x41b66f){logger[_0x2b6c('0x15')](_0x2b6c('0x26'),_0x41b66f['message'],_0x46733a);_0x257813(_0xe06701[_0x2b6c('0x15')](0x1f4,_0x41b66f[_0x2b6c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index d6d5c9f..8823f35 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 _0x547b=['register','length','voiceQueue:','./voiceQueue.events','save','emit','removeListener'];(function(_0x2dc5b7,_0x3837ba){var _0x4edb5b=function(_0x3ed644){while(--_0x3ed644){_0x2dc5b7['push'](_0x2dc5b7['shift']());}};_0x4edb5b(++_0x3837ba);}(_0x547b,0x1b5));var _0xb547=function(_0x41458c,_0x2e3ffc){_0x41458c=_0x41458c-0x0;var _0x250e13=_0x547b[_0x41458c];return _0x250e13;};'use strict';var VoiceQueueEvents=require(_0xb547('0x0'));var events=[_0xb547('0x1'),'remove','update'];function createListener(_0x1d3cea,_0x56aebc){return function(_0x658071){_0x56aebc[_0xb547('0x2')](_0x1d3cea,_0x658071);};}function removeListener(_0x578a5d,_0xc6533d){return function(){VoiceQueueEvents[_0xb547('0x3')](_0x578a5d,_0xc6533d);};}exports[_0xb547('0x4')]=function(_0x2e6293){for(var _0x146eb7=0x0,_0x2b9508=events[_0xb547('0x5')];_0x146eb7<_0x2b9508;_0x146eb7++){var _0xd0f30f=events[_0x146eb7];var _0x2d3748=createListener(_0xb547('0x6')+_0xd0f30f,_0x2e6293);VoiceQueueEvents['on'](_0xd0f30f,_0x2d3748);}}; \ No newline at end of file +var _0x25bf=['register','length','voiceQueue:','save','remove','update','emit','removeListener'];(function(_0x294209,_0x5f12b1){var _0x297956=function(_0x48904f){while(--_0x48904f){_0x294209['push'](_0x294209['shift']());}};_0x297956(++_0x5f12b1);}(_0x25bf,0x12b));var _0xf25b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x25bf[_0x122ef9];return _0x42fba0;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xf25b('0x0'),_0xf25b('0x1'),_0xf25b('0x2')];function createListener(_0x5a6eda,_0x9e79d3){return function(_0x47ae9b){_0x9e79d3[_0xf25b('0x3')](_0x5a6eda,_0x47ae9b);};}function removeListener(_0x14ae52,_0x283100){return function(){VoiceQueueEvents[_0xf25b('0x4')](_0x14ae52,_0x283100);};}exports[_0xf25b('0x5')]=function(_0x43c34c){for(var _0x2737cd=0x0,_0x4df6a7=events[_0xf25b('0x6')];_0x2737cd<_0x4df6a7;_0x2737cd++){var _0x343d99=events[_0x2737cd];var _0x3ad91c=createListener(_0xf25b('0x7')+_0x343d99,_0x43c34c);VoiceQueueEvents['on'](_0x343d99,_0x3ad91c);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 150fdbe..c5424fc 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 _0x33af=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','put','update','delete','destroy','util','connect-timeout','express','Router'];(function(_0x47a192,_0x2f5f9f){var _0x9b9f14=function(_0x2357a4){while(--_0x2357a4){_0x47a192['push'](_0x47a192['shift']());}};_0x9b9f14(++_0x2f5f9f);}(_0x33af,0xec));var _0xf33a=function(_0x1f78cb,_0x58e9f3){_0x1f78cb=_0x1f78cb-0x0;var _0x2cf6b8=_0x33af[_0x1f78cb];return _0x2cf6b8;};'use strict';var multer=require('multer');var util=require(_0xf33a('0x0'));var path=require('path');var timeout=require(_0xf33a('0x1'));var express=require(_0xf33a('0x2'));var router=express[_0xf33a('0x3')]();var auth=require(_0xf33a('0x4'));var interaction=require(_0xf33a('0x5'));var config=require(_0xf33a('0x6'));var controller=require('./voiceQueueReport.controller');router[_0xf33a('0x7')]('/',auth[_0xf33a('0x8')](),controller['index']);router[_0xf33a('0x7')](_0xf33a('0x9'),auth[_0xf33a('0x8')](),controller[_0xf33a('0xa')]);router[_0xf33a('0x7')](_0xf33a('0xb'),auth['isAuthenticated'](),controller[_0xf33a('0xc')]);router[_0xf33a('0x7')](_0xf33a('0xd'),auth[_0xf33a('0x8')](),controller[_0xf33a('0xe')]);router[_0xf33a('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf33a('0x10')](_0xf33a('0xd'),auth[_0xf33a('0x8')](),controller[_0xf33a('0x11')]);router[_0xf33a('0x12')]('/:id',auth[_0xf33a('0x8')](),controller[_0xf33a('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0f4d=['../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','/index','getVoiceQueuesReport','show','post','put','/:id','update','delete','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4124c5,_0x4b0267){var _0x4cbf3f=function(_0x577ab3){while(--_0x577ab3){_0x4124c5['push'](_0x4124c5['shift']());}};_0x4cbf3f(++_0x4b0267);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x271e8a,_0x16244a){_0x271e8a=_0x271e8a-0x0;var _0x509d68=_0x0f4d[_0x271e8a];return _0x509d68;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd0f4('0x0'));var express=require('express');var router=express[_0xd0f4('0x1')]();var auth=require(_0xd0f4('0x2'));var interaction=require(_0xd0f4('0x3'));var config=require(_0xd0f4('0x4'));var controller=require(_0xd0f4('0x5'));router[_0xd0f4('0x6')]('/',auth[_0xd0f4('0x7')](),controller[_0xd0f4('0x8')]);router['get'](_0xd0f4('0x9'),auth[_0xd0f4('0x7')](),controller['describe']);router[_0xd0f4('0x6')](_0xd0f4('0xa'),auth['isAuthenticated'](),controller[_0xd0f4('0xb')]);router[_0xd0f4('0x6')]('/:id',auth[_0xd0f4('0x7')](),controller[_0xd0f4('0xc')]);router[_0xd0f4('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd0f4('0xe')](_0xd0f4('0xf'),auth[_0xd0f4('0x7')](),controller[_0xd0f4('0x10')]);router[_0xd0f4('0x11')](_0xd0f4('0xf'),auth[_0xd0f4('0x7')](),controller['destroy']);module[_0xd0f4('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 42ba7e2..74f9dea 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 _0x0713=['YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format'];(function(_0xb85fd5,_0x3362ae){var _0x34228e=function(_0x1e62fa){while(--_0x1e62fa){_0xb85fd5['push'](_0xb85fd5['shift']());}};_0x34228e(++_0x3362ae);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x3071('0x0')]={'type':{'type':Sequelize[_0x3071('0x1')]},'uniqueid':{'type':Sequelize[_0x3071('0x1')]},'calleridnum':{'type':Sequelize[_0x3071('0x1')]},'calleridname':{'type':Sequelize[_0x3071('0x1')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x3071('0x2')],'set':function(_0x33a70c){var _0x3137c8=moment(_0x33a70c);var _0xabd7b6=moment(this[_0x3071('0x3')](_0x3071('0x4')))[_0x3071('0x5')](_0x3071('0x6'));var _0x22274c=_0x3137c8[_0x3071('0x7')](_0xabd7b6,_0x3071('0x8'));this[_0x3071('0x9')]('queuecallerleaveAt',_0x33a70c);this[_0x3071('0x9')](_0x3071('0xa'),_0x22274c||null);}},'position':{'type':Sequelize[_0x3071('0xb')]},'count':{'type':Sequelize[_0x3071('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerexit':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x3071('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x3071('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x3071('0x1')]},'accountcode':{'type':Sequelize[_0x3071('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3071('0x1')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x3071('0xb')]},'mohtime':{'type':Sequelize[_0x3071('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3071('0x1')]},'transfer':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3071('0x1')],'comment':_0x3071('0xd')},'transferexten':{'type':Sequelize[_0x3071('0x1')]},'transferuniqueid':{'type':Sequelize[_0x3071('0x1')]},'disposition':{'type':Sequelize[_0x3071('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3071('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x3071('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff'];(function(_0x548dc7,_0xcefd94){var _0x5072c9=function(_0xc5f0bf){while(--_0xc5f0bf){_0x548dc7['push'](_0x548dc7['shift']());}};_0x5072c9(++_0xcefd94);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0a9e('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x0a9e('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x0a9e('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x0a9e('0x4')],'set':function(_0x991246){var _0x981158=moment(_0x991246);var _0x57b080=moment(this[_0x0a9e('0x5')](_0x0a9e('0x6')))[_0x0a9e('0x7')]('YYYY-MM-DD\x20HH:mm:ss');var _0x503809=_0x981158[_0x0a9e('0x8')](_0x57b080,'seconds');this['setDataValue'](_0x0a9e('0x9'),_0x991246);this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x503809||null);}},'position':{'type':Sequelize[_0x0a9e('0xc')]},'count':{'type':Sequelize[_0x0a9e('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x0a9e('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x0a9e('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x0a9e('0x3')],'comment':_0x0a9e('0xe')},'originalposition':{'type':Sequelize[_0x0a9e('0xc')]},'channel':{'type':Sequelize[_0x0a9e('0x3')]},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x0a9e('0x3')]},'context':{'type':Sequelize[_0x0a9e('0x3')]},'exten':{'type':Sequelize[_0x0a9e('0x3')]},'priority':{'type':Sequelize[_0x0a9e('0x3')]},'holdtime':{'type':Sequelize[_0x0a9e('0xc')]},'mohtime':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x0a9e('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0a9e('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x0a9e('0x3')]},'transferuniqueid':{'type':Sequelize[_0x0a9e('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0a9e('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index ae7f6cc..1d2d2f9 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(_0x5329d2,_0x268198){var _0x28218d=function(_0x4625be){while(--_0x4625be){_0x5329d2['push'](_0x5329d2['shift']());}};_0x28218d(++_0x268198);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x4cf070,_0x2e191c){var _0x545461=function(_0x3ac2d4){while(--_0x3ac2d4){_0x4cf070['push'](_0x4cf070['shift']());}};_0x545461(++_0x2e191c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 69e9626..1decd38 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 _0x9478=['VoiceQueueReport','setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb'];(function(_0x3f019d,_0x1d25d2){var _0x59dfcb=function(_0x3d8a1c){while(--_0x3d8a1c){_0x3f019d['push'](_0x3f019d['shift']());}};_0x59dfcb(++_0x1d25d2);}(_0x9478,0x1e4));var _0x8947=function(_0x48e705,_0x329c32){_0x48e705=_0x48e705-0x0;var _0x4eb2e4=_0x9478[_0x48e705];return _0x4eb2e4;};'use strict';var EventEmitter=require(_0x8947('0x0'));var VoiceQueueReport=require(_0x8947('0x1'))['db'][_0x8947('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x8947('0x3')](0x0);var events={'afterCreate':_0x8947('0x4'),'afterUpdate':_0x8947('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5b1649){return function(_0x57cde0,_0x15f740,_0xd8cab7){VoiceQueueReportEvents[_0x8947('0x6')](_0x5b1649+':'+_0x57cde0['id'],_0x57cde0);VoiceQueueReportEvents[_0x8947('0x6')](_0x5b1649,_0x57cde0);_0xd8cab7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x8947('0x7')](e,emitEvent(event));}}module[_0x8947('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xd56a=['remove','emit','exports','events','../../mysqldb','VoiceQueueReport','save','update'];(function(_0x12e073,_0x4d43db){var _0x267748=function(_0x381284){while(--_0x381284){_0x12e073['push'](_0x12e073['shift']());}};_0x267748(++_0x4d43db);}(_0xd56a,0x14b));var _0xad56=function(_0x392293,_0x408acf){_0x392293=_0x392293-0x0;var _0x16e674=_0xd56a[_0x392293];return _0x16e674;};'use strict';var EventEmitter=require(_0xad56('0x0'));var VoiceQueueReport=require(_0xad56('0x1'))['db'][_0xad56('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xad56('0x3'),'afterUpdate':_0xad56('0x4'),'afterDestroy':_0xad56('0x5')};function emitEvent(_0x5cb047){return function(_0x2963f4,_0xe16db0,_0x3517ff){VoiceQueueReportEvents['emit'](_0x5cb047+':'+_0x2963f4['id'],_0x2963f4);VoiceQueueReportEvents[_0xad56('0x6')](_0x5cb047,_0x2963f4);_0x3517ff(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xad56('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 6e0c346..57a8824 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 _0x2032=['./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x10f68e,_0xf198ea){var _0x4c8372=function(_0x38517){while(--_0x38517){_0x10f68e['push'](_0x10f68e['shift']());}};_0x4c8372(++_0xf198ea);}(_0x2032,0xd9));var _0x2203=function(_0x1beaa2,_0x1b21ec){_0x1beaa2=_0x1beaa2-0x0;var _0x12bb9c=_0x2032[_0x1beaa2];return _0x12bb9c;};'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 +var _0x5f66=['request-promise','path','../../config/environment','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','api','moment','bluebird'];(function(_0x367b9b,_0x1c0ba4){var _0x377921=function(_0xd887a4){while(--_0xd887a4){_0x367b9b['push'](_0x367b9b['shift']());}};_0x377921(++_0x1c0ba4);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./voiceQueueReport.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[{'fields':[_0x65f6('0xa')]},{'fields':[_0x65f6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index a72203b..03f2fe1 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 _0x5e6c=['limit','map','include','model','attributes','CreateVoiceQueueReport','create','catch','update','body','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','redis','defaults','localhost','socket.io-emitter','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where'];(function(_0x24b997,_0x1b388){var _0x341026=function(_0x3341d7){while(--_0x3341d7){_0x24b997['push'](_0x24b997['shift']());}};_0x341026(++_0x1b388);}(_0x5e6c,0x1b8));var _0xc5e6=function(_0x19c42e,_0x4b277b){_0x19c42e=_0x19c42e-0x0;var _0x52eb06=_0x5e6c[_0x19c42e];return _0x52eb06;};'use strict';var _=require(_0xc5e6('0x0'));var util=require(_0xc5e6('0x1'));var moment=require(_0xc5e6('0x2'));var BPromise=require(_0xc5e6('0x3'));var rs=require(_0xc5e6('0x4'));var fs=require('fs');var Redis=require(_0xc5e6('0x5'));var db=require(_0xc5e6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc5e6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc5e6('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xc5e6('0x9')]=_[_0xc5e6('0xa')](config[_0xc5e6('0x9')],{'host':_0xc5e6('0xb'),'port':0x18eb});var socket=require(_0xc5e6('0xc'))(new Redis(config[_0xc5e6('0x9')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x57427c,_0x4b44ed,_0x36e0e8){return new BPromise(function(_0x480b49,_0x4bf9bf){return client['request'](_0x57427c,_0x36e0e8)[_0xc5e6('0xd')](function(_0x295d98){logger[_0xc5e6('0xe')](_0xc5e6('0xf'),_0x4b44ed,_0xc5e6('0x10'));logger[_0xc5e6('0x11')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x4b44ed,'request\x20sent',JSON[_0xc5e6('0x12')](_0x295d98));if(_0x295d98[_0xc5e6('0x13')]){if(_0x295d98[_0xc5e6('0x13')][_0xc5e6('0x14')]===0x1f4){logger[_0xc5e6('0x13')](_0xc5e6('0xf'),_0x4b44ed,_0x295d98[_0xc5e6('0x13')][_0xc5e6('0x15')]);return _0x4bf9bf(_0x295d98[_0xc5e6('0x13')][_0xc5e6('0x15')]);}logger['error'](_0xc5e6('0xf'),_0x4b44ed,_0x295d98[_0xc5e6('0x13')][_0xc5e6('0x15')]);return _0x480b49(_0x295d98[_0xc5e6('0x13')][_0xc5e6('0x15')]);}else{logger[_0xc5e6('0xe')](_0xc5e6('0xf'),_0x4b44ed,_0xc5e6('0x10'));_0x480b49(_0x295d98['result'][_0xc5e6('0x15')]);}})['catch'](function(_0x3f9419){logger[_0xc5e6('0x13')](_0xc5e6('0xf'),_0x4b44ed,_0x3f9419);_0x4bf9bf(_0x3f9419);});});}exports[_0xc5e6('0x16')]=function(_0x437cab){var _0x44fa79=this;return new Promise(function(_0x38be91,_0x2a35e5){return db[_0xc5e6('0x17')][_0xc5e6('0x18')]({'raw':_0x437cab[_0xc5e6('0x19')]?_0x437cab[_0xc5e6('0x19')][_0xc5e6('0x1a')]===undefined?!![]:![]:!![],'where':_0x437cab[_0xc5e6('0x19')]?_0x437cab[_0xc5e6('0x19')][_0xc5e6('0x1b')]||null:null,'attributes':_0x437cab['options']?_0x437cab[_0xc5e6('0x19')]['attributes']||null:null,'limit':_0x437cab[_0xc5e6('0x19')]?_0x437cab[_0xc5e6('0x19')][_0xc5e6('0x1c')]||null:null,'include':_0x437cab[_0xc5e6('0x19')]?_0x437cab[_0xc5e6('0x19')]['include']?_[_0xc5e6('0x1d')](_0x437cab[_0xc5e6('0x19')][_0xc5e6('0x1e')],function(_0x523ed4){return{'model':db[_0x523ed4[_0xc5e6('0x1f')]],'as':_0x523ed4['as'],'attributes':_0x523ed4[_0xc5e6('0x20')],'include':_0x523ed4['include']?_['map'](_0x523ed4[_0xc5e6('0x1e')],function(_0x2f7036){return{'model':db[_0x2f7036['model']],'as':_0x2f7036['as'],'attributes':_0x2f7036[_0xc5e6('0x20')],'include':_0x2f7036[_0xc5e6('0x1e')]?_[_0xc5e6('0x1d')](_0x2f7036[_0xc5e6('0x1e')],function(_0x32f07f){return{'model':db[_0x32f07f[_0xc5e6('0x1f')]],'as':_0x32f07f['as'],'attributes':_0x32f07f[_0xc5e6('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26c3f4){logger['info'](_0xc5e6('0x16'),_0x437cab);logger[_0xc5e6('0x11')](_0xc5e6('0x16'),_0x437cab,JSON[_0xc5e6('0x12')](_0x26c3f4));_0x38be91(_0x26c3f4);})['catch'](function(_0xe0e01d){logger['error'](_0xc5e6('0x16'),_0xe0e01d['message'],_0x437cab);_0x2a35e5(_0x44fa79[_0xc5e6('0x13')](0x1f4,_0xe0e01d[_0xc5e6('0x15')]));});});};exports[_0xc5e6('0x21')]=function(_0x38da61){var _0x1d0483=this;return new Promise(function(_0x18e639,_0x225e13){return db[_0xc5e6('0x17')][_0xc5e6('0x22')](_0x38da61['body'],{'raw':_0x38da61[_0xc5e6('0x19')]?_0x38da61['options'][_0xc5e6('0x1a')]===undefined?!![]:![]:!![]})[_0xc5e6('0xd')](function(_0x511b82){logger[_0xc5e6('0xe')](_0xc5e6('0x21'),_0x38da61);logger['debug']('CreateVoiceQueueReport',_0x38da61,JSON[_0xc5e6('0x12')](_0x511b82));_0x18e639(_0x511b82);})[_0xc5e6('0x23')](function(_0x4e8c03){logger[_0xc5e6('0x13')](_0xc5e6('0x21'),_0x4e8c03[_0xc5e6('0x15')],_0x38da61);_0x225e13(_0x1d0483[_0xc5e6('0x13')](0x1f4,_0x4e8c03[_0xc5e6('0x15')]));});});};exports['UpdateVoiceQueueReport']=function(_0x255be8){var _0x4c4ba1=this;return new Promise(function(_0x20ffa5,_0x1a60a5){return db['VoiceQueueReport'][_0xc5e6('0x24')](_0x255be8[_0xc5e6('0x25')],{'raw':_0x255be8[_0xc5e6('0x19')]?_0x255be8['options'][_0xc5e6('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x255be8[_0xc5e6('0x19')]?_0x255be8[_0xc5e6('0x19')][_0xc5e6('0x1b')]||null:null,'attributes':_0x255be8[_0xc5e6('0x19')]?_0x255be8[_0xc5e6('0x19')][_0xc5e6('0x20')]||null:null,'limit':_0x255be8[_0xc5e6('0x19')]?_0x255be8['options'][_0xc5e6('0x1c')]||null:null})['then'](function(_0x462a39){logger['info'](_0xc5e6('0x26'),_0x255be8);logger[_0xc5e6('0x11')]('UpdateVoiceQueueReport',_0x255be8,JSON[_0xc5e6('0x12')](_0x462a39));_0x20ffa5(_0x462a39);})[_0xc5e6('0x23')](function(_0xb2dc21){logger[_0xc5e6('0x13')](_0xc5e6('0x26'),_0xb2dc21['message'],_0x255be8);_0x1a60a5(_0x4c4ba1[_0xc5e6('0x13')](0x1f4,_0xb2dc21[_0xc5e6('0x15')]));});});}; \ No newline at end of file +var _0x2f33=['limit','include','map','model','attributes','debug','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where'];(function(_0x167ad7,_0x2c6514){var _0x3d782f=function(_0x146911){while(--_0x146911){_0x167ad7['push'](_0x167ad7['shift']());}};_0x3d782f(++_0x2c6514);}(_0x2f33,0x131));var _0x32f3=function(_0x440a19,_0x30a22a){_0x440a19=_0x440a19-0x0;var _0x4c864c=_0x2f33[_0x440a19];return _0x4c864c;};'use strict';var _=require('lodash');var util=require(_0x32f3('0x0'));var moment=require(_0x32f3('0x1'));var BPromise=require(_0x32f3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x32f3('0x3'));var db=require(_0x32f3('0x4'))['db'];var utils=require(_0x32f3('0x5'));var logger=require('../../config/logger')(_0x32f3('0x6'));var config=require('../../config/environment');var jayson=require(_0x32f3('0x7'));var client=jayson[_0x32f3('0x8')][_0x32f3('0x9')]({'port':0x232a});config[_0x32f3('0xa')]=_[_0x32f3('0xb')](config[_0x32f3('0xa')],{'host':_0x32f3('0xc'),'port':0x18eb});var socket=require(_0x32f3('0xd'))(new Redis(config[_0x32f3('0xa')]));require(_0x32f3('0xe'))[_0x32f3('0xf')](socket);function respondWithRpcPromise(_0x5c60ff,_0x48220a,_0xcb5d6d){return new BPromise(function(_0x85ad92,_0x4b7ebc){return client[_0x32f3('0x10')](_0x5c60ff,_0xcb5d6d)[_0x32f3('0x11')](function(_0xada903){logger[_0x32f3('0x12')](_0x32f3('0x13'),_0x48220a,_0x32f3('0x14'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x48220a,_0x32f3('0x14'),JSON[_0x32f3('0x15')](_0xada903));if(_0xada903['error']){if(_0xada903[_0x32f3('0x16')][_0x32f3('0x17')]===0x1f4){logger[_0x32f3('0x16')](_0x32f3('0x13'),_0x48220a,_0xada903['error'][_0x32f3('0x18')]);return _0x4b7ebc(_0xada903[_0x32f3('0x16')][_0x32f3('0x18')]);}logger[_0x32f3('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x48220a,_0xada903[_0x32f3('0x16')][_0x32f3('0x18')]);return _0x85ad92(_0xada903['error'][_0x32f3('0x18')]);}else{logger[_0x32f3('0x12')](_0x32f3('0x13'),_0x48220a,_0x32f3('0x14'));_0x85ad92(_0xada903['result'][_0x32f3('0x18')]);}})[_0x32f3('0x19')](function(_0x33f391){logger['error'](_0x32f3('0x13'),_0x48220a,_0x33f391);_0x4b7ebc(_0x33f391);});});}exports[_0x32f3('0x1a')]=function(_0x5029a6){var _0xa48972=this;return new Promise(function(_0x4c3aad,_0x4fef28){return db[_0x32f3('0x1b')]['findAll']({'raw':_0x5029a6[_0x32f3('0x1c')]?_0x5029a6[_0x32f3('0x1c')][_0x32f3('0x1d')]===undefined?!![]:![]:!![],'where':_0x5029a6[_0x32f3('0x1c')]?_0x5029a6['options'][_0x32f3('0x1e')]||null:null,'attributes':_0x5029a6[_0x32f3('0x1c')]?_0x5029a6['options']['attributes']||null:null,'limit':_0x5029a6[_0x32f3('0x1c')]?_0x5029a6[_0x32f3('0x1c')][_0x32f3('0x1f')]||null:null,'include':_0x5029a6[_0x32f3('0x1c')]?_0x5029a6[_0x32f3('0x1c')][_0x32f3('0x20')]?_[_0x32f3('0x21')](_0x5029a6['options']['include'],function(_0x4ad349){return{'model':db[_0x4ad349[_0x32f3('0x22')]],'as':_0x4ad349['as'],'attributes':_0x4ad349[_0x32f3('0x23')],'include':_0x4ad349['include']?_[_0x32f3('0x21')](_0x4ad349[_0x32f3('0x20')],function(_0x5ed26a){return{'model':db[_0x5ed26a[_0x32f3('0x22')]],'as':_0x5ed26a['as'],'attributes':_0x5ed26a[_0x32f3('0x23')],'include':_0x5ed26a[_0x32f3('0x20')]?_['map'](_0x5ed26a[_0x32f3('0x20')],function(_0x2b1a4a){return{'model':db[_0x2b1a4a[_0x32f3('0x22')]],'as':_0x2b1a4a['as'],'attributes':_0x2b1a4a[_0x32f3('0x23')]};}):[]};}):[]};}):[]:[]})[_0x32f3('0x11')](function(_0x211338){logger[_0x32f3('0x12')](_0x32f3('0x1a'),_0x5029a6);logger[_0x32f3('0x24')](_0x32f3('0x1a'),_0x5029a6,JSON['stringify'](_0x211338));_0x4c3aad(_0x211338);})[_0x32f3('0x19')](function(_0x2e6f85){logger[_0x32f3('0x16')](_0x32f3('0x1a'),_0x2e6f85[_0x32f3('0x18')],_0x5029a6);_0x4fef28(_0xa48972['error'](0x1f4,_0x2e6f85[_0x32f3('0x18')]));});});};exports[_0x32f3('0x25')]=function(_0x15945d){var _0x520f81=this;return new Promise(function(_0x5c70fb,_0x1488b4){return db['VoiceQueueReport'][_0x32f3('0x26')](_0x15945d[_0x32f3('0x27')],{'raw':_0x15945d['options']?_0x15945d[_0x32f3('0x1c')][_0x32f3('0x1d')]===undefined?!![]:![]:!![]})[_0x32f3('0x11')](function(_0x3fa90d){logger['info'](_0x32f3('0x25'),_0x15945d);logger[_0x32f3('0x24')](_0x32f3('0x25'),_0x15945d,JSON[_0x32f3('0x15')](_0x3fa90d));_0x5c70fb(_0x3fa90d);})['catch'](function(_0x5d12ca){logger[_0x32f3('0x16')](_0x32f3('0x25'),_0x5d12ca['message'],_0x15945d);_0x1488b4(_0x520f81[_0x32f3('0x16')](0x1f4,_0x5d12ca['message']));});});};exports[_0x32f3('0x28')]=function(_0x16bea3){var _0x225b75=this;return new Promise(function(_0x4eadd7,_0x379cf5){return db[_0x32f3('0x1b')][_0x32f3('0x29')](_0x16bea3['body'],{'raw':_0x16bea3[_0x32f3('0x1c')]?_0x16bea3[_0x32f3('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16bea3[_0x32f3('0x1c')]?_0x16bea3[_0x32f3('0x1c')][_0x32f3('0x1e')]||null:null,'attributes':_0x16bea3['options']?_0x16bea3['options']['attributes']||null:null,'limit':_0x16bea3['options']?_0x16bea3['options'][_0x32f3('0x1f')]||null:null})[_0x32f3('0x11')](function(_0x54b722){logger[_0x32f3('0x12')](_0x32f3('0x28'),_0x16bea3);logger['debug'](_0x32f3('0x28'),_0x16bea3,JSON[_0x32f3('0x15')](_0x54b722));_0x4eadd7(_0x54b722);})[_0x32f3('0x19')](function(_0x459fbc){logger[_0x32f3('0x16')]('UpdateVoiceQueueReport',_0x459fbc[_0x32f3('0x18')],_0x16bea3);_0x379cf5(_0x225b75[_0x32f3('0x16')](0x1f4,_0x459fbc[_0x32f3('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 49f9db8..c377905 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 _0x8c68=['register','voiceQueueReport:','./voiceQueueReport.events','save','remove','emit'];(function(_0x59689b,_0x8421c0){var _0x2baa5f=function(_0x45a671){while(--_0x45a671){_0x59689b['push'](_0x59689b['shift']());}};_0x2baa5f(++_0x8421c0);}(_0x8c68,0x1be));var _0x88c6=function(_0xb516f1,_0x36ff20){_0xb516f1=_0xb516f1-0x0;var _0x466fc8=_0x8c68[_0xb516f1];return _0x466fc8;};'use strict';var VoiceQueueReportEvents=require(_0x88c6('0x0'));var events=[_0x88c6('0x1'),_0x88c6('0x2'),'update'];function createListener(_0x59c35f,_0x214baa){return function(_0xc973d7){_0x214baa[_0x88c6('0x3')](_0x59c35f,_0xc973d7);};}function removeListener(_0x453e91,_0x48eee1){return function(){VoiceQueueReportEvents['removeListener'](_0x453e91,_0x48eee1);};}exports[_0x88c6('0x4')]=function(_0x2fcc8e){for(var _0x3984ca=0x0,_0x3785d2=events['length'];_0x3984ca<_0x3785d2;_0x3984ca++){var _0x484742=events[_0x3984ca];var _0x3b16ee=createListener(_0x88c6('0x5')+_0x484742,_0x2fcc8e);VoiceQueueReportEvents['on'](_0x484742,_0x3b16ee);}}; \ No newline at end of file +var _0xda37=['update','emit','removeListener','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x5aa1e5,_0x3eb6bf){var _0x3531e3=function(_0x809342){while(--_0x809342){_0x5aa1e5['push'](_0x5aa1e5['shift']());}};_0x3531e3(++_0x3eb6bf);}(_0xda37,0x1b0));var _0x7da3=function(_0x124ee4,_0x5b1868){_0x124ee4=_0x124ee4-0x0;var _0x4f5a17=_0xda37[_0x124ee4];return _0x4f5a17;};'use strict';var VoiceQueueReportEvents=require(_0x7da3('0x0'));var events=[_0x7da3('0x1'),'remove',_0x7da3('0x2')];function createListener(_0xdcee88,_0x3d1fad){return function(_0x2d6c19){_0x3d1fad[_0x7da3('0x3')](_0xdcee88,_0x2d6c19);};}function removeListener(_0x3af43f,_0x37e9f2){return function(){VoiceQueueReportEvents[_0x7da3('0x4')](_0x3af43f,_0x37e9f2);};}exports['register']=function(_0x105f09){for(var _0x346738=0x0,_0x485e0b=events[_0x7da3('0x5')];_0x346738<_0x485e0b;_0x346738++){var _0x4b91c3=events[_0x346738];var _0x2fd033=createListener(_0x7da3('0x6')+_0x4b91c3,_0x105f09);VoiceQueueReportEvents['on'](_0x4b91c3,_0x2fd033);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index e9952c4..f147708 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 _0xbe43=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','index','isAuthenticated','show','post','create','/:id','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x1693b1,_0x521105){var _0x42b895=function(_0x224855){while(--_0x224855){_0x1693b1['push'](_0x1693b1['shift']());}};_0x42b895(++_0x521105);}(_0xbe43,0x1bc));var _0x3be4=function(_0x4c0fc3,_0x53946d){_0x4c0fc3=_0x4c0fc3-0x0;var _0x13f033=_0xbe43[_0x4c0fc3];return _0x13f033;};'use strict';var multer=require(_0x3be4('0x0'));var util=require(_0x3be4('0x1'));var path=require(_0x3be4('0x2'));var timeout=require(_0x3be4('0x3'));var express=require(_0x3be4('0x4'));var router=express[_0x3be4('0x5')]();var auth=require(_0x3be4('0x6'));var interaction=require(_0x3be4('0x7'));var config=require(_0x3be4('0x8'));var controller=require(_0x3be4('0x9'));router[_0x3be4('0xa')]('/',auth['isAuthenticated'](),controller[_0x3be4('0xb')]);router['get']('/:id',auth[_0x3be4('0xc')](),controller[_0x3be4('0xd')]);router[_0x3be4('0xe')]('/',auth[_0x3be4('0xc')](),controller[_0x3be4('0xf')]);router['put'](_0x3be4('0x10'),auth[_0x3be4('0xc')](),controller['update']);router['delete']('/:id',auth[_0x3be4('0xc')](),controller[_0x3be4('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe51b=['Router','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','/:id','post','create','destroy','exports','multer','util','connect-timeout','express'];(function(_0x2a63b4,_0x508c2f){var _0x4ec24d=function(_0x462aba){while(--_0x462aba){_0x2a63b4['push'](_0x2a63b4['shift']());}};_0x4ec24d(++_0x508c2f);}(_0xe51b,0x92));var _0xbe51=function(_0x4c2c23,_0x3d8d28){_0x4c2c23=_0x4c2c23-0x0;var _0x5c992e=_0xe51b[_0x4c2c23];return _0x5c992e;};'use strict';var multer=require(_0xbe51('0x0'));var util=require(_0xbe51('0x1'));var path=require('path');var timeout=require(_0xbe51('0x2'));var express=require(_0xbe51('0x3'));var router=express[_0xbe51('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xbe51('0x5'));var config=require(_0xbe51('0x6'));var controller=require(_0xbe51('0x7'));router['get']('/',auth[_0xbe51('0x8')](),controller[_0xbe51('0x9')]);router['get'](_0xbe51('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xbe51('0xb')]('/',auth['isAuthenticated'](),controller[_0xbe51('0xc')]);router['put'](_0xbe51('0xa'),auth[_0xbe51('0x8')](),controller['update']);router['delete'](_0xbe51('0xa'),auth[_0xbe51('0x8')](),controller[_0xbe51('0xd')]);module[_0xbe51('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 448c7f8..34e18bc 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 _0x191a=['YYYY-MM-DD\x20HH:mm:ss','moment','exports','STRING','DATE','format'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x191a,0x67));var _0xa191=function(_0x57a829,_0x1f4123){_0x57a829=_0x57a829-0x0;var _0x528802=_0x191a[_0x57a829];return _0x528802;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa191('0x0'));module[_0xa191('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xa191('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xa191('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa191('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xa191('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xa191('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa191('0x3')],'allowNull':![],'defaultValue':moment()[_0xa191('0x4')](_0xa191('0x5'))}}; \ No newline at end of file +var _0xfdb9=['STRING','DATE','format','sequelize','moment','exports'];(function(_0x34a1d5,_0xb2b673){var _0x2d5afc=function(_0x52161a){while(--_0x52161a){_0x34a1d5['push'](_0x34a1d5['shift']());}};_0x2d5afc(++_0xb2b673);}(_0xfdb9,0x1dd));var _0x9fdb=function(_0x475fa8,_0x444305){_0x475fa8=_0x475fa8-0x0;var _0x5c1657=_0xfdb9[_0x475fa8];return _0x5c1657;};'use strict';var Sequelize=require(_0x9fdb('0x0'));var moment=require(_0x9fdb('0x1'));module[_0x9fdb('0x2')]={'time':{'type':Sequelize[_0x9fdb('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x9fdb('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x9fdb('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x9fdb('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x9fdb('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x9fdb('0x4')],'allowNull':![],'defaultValue':moment()[_0x9fdb('0x5')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index b21a392..f2d92c2 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 _0xeee4=['lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','merge','options','include','findAll','rows','params','length','includeAll','find','catch','create','body','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x3b3210,_0x25e8ed){var _0x5b5484=function(_0x417858){while(--_0x417858){_0x3b3210['push'](_0x3b3210['shift']());}};_0x5b5484(++_0x25e8ed);}(_0xeee4,0xce));var _0x4eee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeee4[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x4eee('0x0'));var emlformat=require(_0x4eee('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4eee('0x2'));var rp=require('request-promise');var moment=require(_0x4eee('0x3'));var BPromise=require(_0x4eee('0x4'));var Mustache=require(_0x4eee('0x5'));var util=require(_0x4eee('0x6'));var path=require(_0x4eee('0x7'));var sox=require(_0x4eee('0x8'));var csv=require(_0x4eee('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4eee('0xa'));var squel=require(_0x4eee('0xb'));var crypto=require('crypto');var jsforce=require(_0x4eee('0xc'));var deskjs=require(_0x4eee('0xd'));var toCsv=require(_0x4eee('0x9'));var querystring=require(_0x4eee('0xe'));var Papa=require(_0x4eee('0xf'));var Redis=require('ioredis');var authService=require(_0x4eee('0x10'));var qs=require(_0x4eee('0x11'));var as=require(_0x4eee('0x12'));var hardwareService=require(_0x4eee('0x13'));var logger=require(_0x4eee('0x14'))(_0x4eee('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4eee('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b029f,_0x561a64){_0x561a64=_0x561a64||0xcc;return function(_0x653401){if(_0x653401){return _0x5b029f[_0x4eee('0x17')](_0x561a64);}return _0x5b029f['status'](_0x561a64)[_0x4eee('0x18')]();};}function respondWithResult(_0x57c708,_0x3cda78){_0x3cda78=_0x3cda78||0xc8;return function(_0x5a994f){if(_0x5a994f){return _0x57c708[_0x4eee('0x19')](_0x3cda78)[_0x4eee('0x1a')](_0x5a994f);}};}function respondWithFilteredResult(_0x5e398c,_0x54416b){return function(_0x424e05){if(_0x424e05){var _0x2cee47=_0x424e05[_0x4eee('0x1b')],_0x196a23=_0x54416b['offset'],_0x397831=_0x54416b[_0x4eee('0x1c')]+_0x54416b[_0x4eee('0x1d')],_0xf2b4b2;if(_0x397831>=_0x2cee47){_0x397831=_0x2cee47;_0xf2b4b2=0xc8;}else{_0xf2b4b2=0xce;}_0x5e398c[_0x4eee('0x19')](_0xf2b4b2);return _0x5e398c[_0x4eee('0x1e')]('Content-Range',_0x196a23+'-'+_0x397831+'/'+_0x2cee47)['json'](_0x424e05);}return null;};}function patchUpdates(_0x3c4451){return function(_0x4ae6ff){try{jsonpatch[_0x4eee('0x1f')](_0x4ae6ff,_0x3c4451,!![]);}catch(_0x2c148f){return BPromise[_0x4eee('0x20')](_0x2c148f);}return _0x4ae6ff[_0x4eee('0x21')]();};}function saveUpdates(_0x1542d5,_0x510088){return function(_0xff6955){if(_0xff6955){return _0xff6955[_0x4eee('0x22')](_0x1542d5)[_0x4eee('0x23')](function(_0x2c4838){return _0x2c4838;});}return null;};}function removeEntity(_0x233524,_0x5137e9){return function(_0x269647){if(_0x269647){return _0x269647[_0x4eee('0x24')]()[_0x4eee('0x23')](function(){_0x233524[_0x4eee('0x19')](0xcc)[_0x4eee('0x18')]();});}};}function handleEntityNotFound(_0x237256,_0x5acff8){return function(_0x52d6bc){if(!_0x52d6bc){_0x237256[_0x4eee('0x17')](0x194);}return _0x52d6bc;};}function handleError(_0x98b417,_0x58880e){_0x58880e=_0x58880e||0x1f4;return function(_0x52f77c){logger[_0x4eee('0x25')](_0x52f77c[_0x4eee('0x26')]);if(_0x52f77c[_0x4eee('0x27')]){delete _0x52f77c[_0x4eee('0x27')];}_0x98b417[_0x4eee('0x19')](_0x58880e)[_0x4eee('0x28')](_0x52f77c);};}exports[_0x4eee('0x29')]=function(_0x558ec4,_0x33aff3){var _0x842b73={},_0x4dafe3={},_0x3c68ab={'count':0x0,'rows':[]};var _0x1175ed=_[_0x4eee('0x2a')](db[_0x4eee('0x2b')][_0x4eee('0x2c')],function(_0x2a7067){return{'name':_0x2a7067['fieldName'],'type':_0x2a7067[_0x4eee('0x2d')][_0x4eee('0x2e')]};});_0x4dafe3[_0x4eee('0x2f')]=_['map'](_0x1175ed,'name');_0x4dafe3['query']=_[_0x4eee('0x30')](_0x558ec4[_0x4eee('0x31')]);_0x4dafe3[_0x4eee('0x32')]=_[_0x4eee('0x33')](_0x4dafe3['model'],_0x4dafe3[_0x4eee('0x31')]);_0x842b73['attributes']=_[_0x4eee('0x33')](_0x4dafe3[_0x4eee('0x2f')],qs['fields'](_0x558ec4[_0x4eee('0x31')][_0x4eee('0x34')]));_0x842b73['attributes']=_0x842b73['attributes']['length']?_0x842b73[_0x4eee('0x35')]:_0x4dafe3[_0x4eee('0x2f')];if(!_0x558ec4[_0x4eee('0x31')]['hasOwnProperty'](_0x4eee('0x36'))){_0x842b73[_0x4eee('0x1d')]=qs[_0x4eee('0x1d')](_0x558ec4[_0x4eee('0x31')]['limit']);_0x842b73[_0x4eee('0x1c')]=qs['offset'](_0x558ec4[_0x4eee('0x31')][_0x4eee('0x1c')]);}_0x842b73[_0x4eee('0x37')]=qs[_0x4eee('0x38')](_0x558ec4[_0x4eee('0x31')][_0x4eee('0x38')]);_0x842b73['where']=qs[_0x4eee('0x32')](_[_0x4eee('0x39')](_0x558ec4[_0x4eee('0x31')],_0x4dafe3[_0x4eee('0x32')]),_0x1175ed);if(_0x558ec4['query'][_0x4eee('0x3a')]){_0x842b73[_0x4eee('0x3b')]=_[_0x4eee('0x3c')](_0x842b73[_0x4eee('0x3b')],{'$or':_[_0x4eee('0x2a')](_0x1175ed,function(_0x17719a){if(_0x17719a[_0x4eee('0x2d')]!=='VIRTUAL'){var _0x1cbb93={};_0x1cbb93[_0x17719a[_0x4eee('0x27')]]={'$like':'%'+_0x558ec4['query'][_0x4eee('0x3a')]+'%'};return _0x1cbb93;}})});}_0x842b73=_[_0x4eee('0x3c')]({},_0x842b73,_0x558ec4[_0x4eee('0x3d')]);var _0x229b6d={'where':_0x842b73[_0x4eee('0x3b')]};return db[_0x4eee('0x2b')][_0x4eee('0x1b')](_0x229b6d)[_0x4eee('0x23')](function(_0x530dc3){_0x3c68ab['count']=_0x530dc3;if(_0x558ec4[_0x4eee('0x31')]['includeAll']){_0x842b73[_0x4eee('0x3e')]=[{'all':!![]}];}return db[_0x4eee('0x2b')][_0x4eee('0x3f')](_0x842b73);})[_0x4eee('0x23')](function(_0x79f123){_0x3c68ab[_0x4eee('0x40')]=_0x79f123;return _0x3c68ab;})[_0x4eee('0x23')](respondWithFilteredResult(_0x33aff3,_0x842b73))['catch'](handleError(_0x33aff3,null));};exports['show']=function(_0x24999d,_0x44ad8c){var _0x5e7c09={'raw':!![],'where':{'id':_0x24999d[_0x4eee('0x41')]['id']}},_0x13cf11={};_0x13cf11[_0x4eee('0x2f')]=_[_0x4eee('0x30')](db[_0x4eee('0x2b')][_0x4eee('0x2c')]);_0x13cf11[_0x4eee('0x31')]=_[_0x4eee('0x30')](_0x24999d['query']);_0x13cf11[_0x4eee('0x32')]=_[_0x4eee('0x33')](_0x13cf11['model'],_0x13cf11[_0x4eee('0x31')]);_0x5e7c09[_0x4eee('0x35')]=_['intersection'](_0x13cf11['model'],qs['fields'](_0x24999d[_0x4eee('0x31')]['fields']));_0x5e7c09[_0x4eee('0x35')]=_0x5e7c09[_0x4eee('0x35')][_0x4eee('0x42')]?_0x5e7c09[_0x4eee('0x35')]:_0x13cf11[_0x4eee('0x2f')];if(_0x24999d['query'][_0x4eee('0x43')]){_0x5e7c09[_0x4eee('0x3e')]=[{'all':!![]}];}_0x5e7c09=_[_0x4eee('0x3c')]({},_0x5e7c09,_0x24999d[_0x4eee('0x3d')]);return db[_0x4eee('0x2b')][_0x4eee('0x44')](_0x5e7c09)[_0x4eee('0x23')](handleEntityNotFound(_0x44ad8c,null))['then'](respondWithResult(_0x44ad8c,null))[_0x4eee('0x45')](handleError(_0x44ad8c,null));};exports[_0x4eee('0x46')]=function(_0x55417d,_0xd44c0a){return db[_0x4eee('0x2b')]['create'](_0x55417d[_0x4eee('0x47')],{})['then'](respondWithResult(_0xd44c0a,0xc9))[_0x4eee('0x45')](handleError(_0xd44c0a,null));};exports[_0x4eee('0x22')]=function(_0x3cfcab,_0x17b547){if(_0x3cfcab[_0x4eee('0x47')]['id']){delete _0x3cfcab[_0x4eee('0x47')]['id'];}return db[_0x4eee('0x2b')][_0x4eee('0x44')]({'where':{'id':_0x3cfcab['params']['id']}})[_0x4eee('0x23')](handleEntityNotFound(_0x17b547,null))[_0x4eee('0x23')](saveUpdates(_0x3cfcab[_0x4eee('0x47')],null))['then'](respondWithResult(_0x17b547,null))[_0x4eee('0x45')](handleError(_0x17b547,null));};exports[_0x4eee('0x24')]=function(_0xfa42e9,_0xe40314){return db[_0x4eee('0x2b')][_0x4eee('0x44')]({'where':{'id':_0xfa42e9[_0x4eee('0x41')]['id']}})[_0x4eee('0x23')](handleEntityNotFound(_0xe40314,null))[_0x4eee('0x23')](removeEntity(_0xe40314,null))[_0x4eee('0x45')](handleError(_0xe40314,null));}; \ No newline at end of file +var _0x709f=['index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','pick','filter','where','merge','options','VoiceQueuesLog','count','includeAll','include','findAll','catch','params','keys','find','create','body','destroy','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','offset','limit','Content-Range','json','save','then','end','error','name','send'];(function(_0x373a52,_0x58348e){var _0xa779d5=function(_0x832238){while(--_0x832238){_0x373a52['push'](_0x373a52['shift']());}};_0xa779d5(++_0x58348e);}(_0x709f,0xa1));var _0xf709=function(_0x24f326,_0x616a7){_0x24f326=_0x24f326-0x0;var _0x488e2d=_0x709f[_0x24f326];return _0x488e2d;};'use strict';var pdf=require(_0xf709('0x0'));var emlformat=require(_0xf709('0x1'));var rimraf=require(_0xf709('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf709('0x3'));var rp=require('request-promise');var moment=require(_0xf709('0x4'));var BPromise=require(_0xf709('0x5'));var Mustache=require(_0xf709('0x6'));var util=require(_0xf709('0x7'));var path=require(_0xf709('0x8'));var sox=require('sox');var csv=require(_0xf709('0x9'));var ejs=require(_0xf709('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf709('0xb'));var crypto=require(_0xf709('0xc'));var jsforce=require(_0xf709('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf709('0x9'));var querystring=require(_0xf709('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf709('0xf'));var qs=require(_0xf709('0x10'));var as=require(_0xf709('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf709('0x12'))(_0xf709('0x13'));var utils=require(_0xf709('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf709('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ce31e,_0x2ab8f1){_0x2ab8f1=_0x2ab8f1||0xcc;return function(_0x6eeacc){if(_0x6eeacc){return _0x5ce31e[_0xf709('0x16')](_0x2ab8f1);}return _0x5ce31e[_0xf709('0x17')](_0x2ab8f1)['end']();};}function respondWithResult(_0x346cb6,_0x37395){_0x37395=_0x37395||0xc8;return function(_0x3d5d89){if(_0x3d5d89){return _0x346cb6[_0xf709('0x17')](_0x37395)['json'](_0x3d5d89);}};}function respondWithFilteredResult(_0x11de58,_0xf5a3eb){return function(_0x1d345a){if(_0x1d345a){var _0x2dc1ce=_0x1d345a['count'],_0x15a066=_0xf5a3eb[_0xf709('0x18')],_0x58ef36=_0xf5a3eb[_0xf709('0x18')]+_0xf5a3eb[_0xf709('0x19')],_0x5ab79a;if(_0x58ef36>=_0x2dc1ce){_0x58ef36=_0x2dc1ce;_0x5ab79a=0xc8;}else{_0x5ab79a=0xce;}_0x11de58[_0xf709('0x17')](_0x5ab79a);return _0x11de58['set'](_0xf709('0x1a'),_0x15a066+'-'+_0x58ef36+'/'+_0x2dc1ce)[_0xf709('0x1b')](_0x1d345a);}return null;};}function patchUpdates(_0xd6be00){return function(_0x5b084c){try{jsonpatch['apply'](_0x5b084c,_0xd6be00,!![]);}catch(_0x2b6e8d){return BPromise['reject'](_0x2b6e8d);}return _0x5b084c[_0xf709('0x1c')]();};}function saveUpdates(_0x767cea,_0x1f3944){return function(_0x1468f8){if(_0x1468f8){return _0x1468f8['update'](_0x767cea)[_0xf709('0x1d')](function(_0x2b5922){return _0x2b5922;});}return null;};}function removeEntity(_0x440712,_0x65ce6){return function(_0x2f6b11){if(_0x2f6b11){return _0x2f6b11['destroy']()['then'](function(){_0x440712[_0xf709('0x17')](0xcc)[_0xf709('0x1e')]();});}};}function handleEntityNotFound(_0x203e37,_0x49bcef){return function(_0x3ae9df){if(!_0x3ae9df){_0x203e37['sendStatus'](0x194);}return _0x3ae9df;};}function handleError(_0x5b5361,_0x5b5976){_0x5b5976=_0x5b5976||0x1f4;return function(_0x434936){logger[_0xf709('0x1f')](_0x434936['stack']);if(_0x434936[_0xf709('0x20')]){delete _0x434936[_0xf709('0x20')];}_0x5b5361[_0xf709('0x17')](_0x5b5976)[_0xf709('0x21')](_0x434936);};}exports[_0xf709('0x22')]=function(_0x19fe22,_0x2a778c){var _0x437d4d={},_0x131417={},_0x161182={'count':0x0,'rows':[]};var _0x39dfdd=_[_0xf709('0x23')](db['VoiceQueuesLog'][_0xf709('0x24')],function(_0x27f5fb){return{'name':_0x27f5fb[_0xf709('0x25')],'type':_0x27f5fb[_0xf709('0x26')]['key']};});_0x131417[_0xf709('0x27')]=_[_0xf709('0x23')](_0x39dfdd,_0xf709('0x20'));_0x131417['query']=_['keys'](_0x19fe22[_0xf709('0x28')]);_0x131417[_0xf709('0x29')]=_[_0xf709('0x2a')](_0x131417[_0xf709('0x27')],_0x131417[_0xf709('0x28')]);_0x437d4d[_0xf709('0x2b')]=_['intersection'](_0x131417['model'],qs[_0xf709('0x2c')](_0x19fe22[_0xf709('0x28')][_0xf709('0x2c')]));_0x437d4d[_0xf709('0x2b')]=_0x437d4d[_0xf709('0x2b')][_0xf709('0x2d')]?_0x437d4d[_0xf709('0x2b')]:_0x131417['model'];if(!_0x19fe22[_0xf709('0x28')][_0xf709('0x2e')](_0xf709('0x2f'))){_0x437d4d[_0xf709('0x19')]=qs[_0xf709('0x19')](_0x19fe22['query']['limit']);_0x437d4d['offset']=qs[_0xf709('0x18')](_0x19fe22[_0xf709('0x28')][_0xf709('0x18')]);}_0x437d4d['order']=qs['sort'](_0x19fe22[_0xf709('0x28')]['sort']);_0x437d4d['where']=qs[_0xf709('0x29')](_[_0xf709('0x30')](_0x19fe22[_0xf709('0x28')],_0x131417['filters']),_0x39dfdd);if(_0x19fe22[_0xf709('0x28')][_0xf709('0x31')]){_0x437d4d[_0xf709('0x32')]=_[_0xf709('0x33')](_0x437d4d[_0xf709('0x32')],{'$or':_['map'](_0x39dfdd,function(_0x23db5f){if(_0x23db5f[_0xf709('0x26')]!=='VIRTUAL'){var _0x37c3f6={};_0x37c3f6[_0x23db5f[_0xf709('0x20')]]={'$like':'%'+_0x19fe22[_0xf709('0x28')][_0xf709('0x31')]+'%'};return _0x37c3f6;}})});}_0x437d4d=_[_0xf709('0x33')]({},_0x437d4d,_0x19fe22[_0xf709('0x34')]);var _0x121593={'where':_0x437d4d['where']};return db[_0xf709('0x35')][_0xf709('0x36')](_0x121593)[_0xf709('0x1d')](function(_0x15ef86){_0x161182[_0xf709('0x36')]=_0x15ef86;if(_0x19fe22[_0xf709('0x28')][_0xf709('0x37')]){_0x437d4d[_0xf709('0x38')]=[{'all':!![]}];}return db[_0xf709('0x35')][_0xf709('0x39')](_0x437d4d);})[_0xf709('0x1d')](function(_0x435b18){_0x161182['rows']=_0x435b18;return _0x161182;})['then'](respondWithFilteredResult(_0x2a778c,_0x437d4d))[_0xf709('0x3a')](handleError(_0x2a778c,null));};exports['show']=function(_0x2fc4aa,_0x49df0d){var _0xeea5e1={'raw':!![],'where':{'id':_0x2fc4aa[_0xf709('0x3b')]['id']}},_0x566ad9={};_0x566ad9['model']=_[_0xf709('0x3c')](db['VoiceQueuesLog'][_0xf709('0x24')]);_0x566ad9[_0xf709('0x28')]=_[_0xf709('0x3c')](_0x2fc4aa['query']);_0x566ad9[_0xf709('0x29')]=_[_0xf709('0x2a')](_0x566ad9[_0xf709('0x27')],_0x566ad9[_0xf709('0x28')]);_0xeea5e1[_0xf709('0x2b')]=_[_0xf709('0x2a')](_0x566ad9[_0xf709('0x27')],qs['fields'](_0x2fc4aa['query'][_0xf709('0x2c')]));_0xeea5e1['attributes']=_0xeea5e1['attributes'][_0xf709('0x2d')]?_0xeea5e1['attributes']:_0x566ad9[_0xf709('0x27')];if(_0x2fc4aa[_0xf709('0x28')]['includeAll']){_0xeea5e1[_0xf709('0x38')]=[{'all':!![]}];}_0xeea5e1=_[_0xf709('0x33')]({},_0xeea5e1,_0x2fc4aa[_0xf709('0x34')]);return db['VoiceQueuesLog'][_0xf709('0x3d')](_0xeea5e1)[_0xf709('0x1d')](handleEntityNotFound(_0x49df0d,null))[_0xf709('0x1d')](respondWithResult(_0x49df0d,null))[_0xf709('0x3a')](handleError(_0x49df0d,null));};exports[_0xf709('0x3e')]=function(_0x24e214,_0x4368bf){return db['VoiceQueuesLog'][_0xf709('0x3e')](_0x24e214['body'],{})[_0xf709('0x1d')](respondWithResult(_0x4368bf,0xc9))[_0xf709('0x3a')](handleError(_0x4368bf,null));};exports['update']=function(_0x11d2ff,_0x2659be){if(_0x11d2ff['body']['id']){delete _0x11d2ff[_0xf709('0x3f')]['id'];}return db[_0xf709('0x35')][_0xf709('0x3d')]({'where':{'id':_0x11d2ff[_0xf709('0x3b')]['id']}})[_0xf709('0x1d')](handleEntityNotFound(_0x2659be,null))['then'](saveUpdates(_0x11d2ff[_0xf709('0x3f')],null))['then'](respondWithResult(_0x2659be,null))[_0xf709('0x3a')](handleError(_0x2659be,null));};exports[_0xf709('0x40')]=function(_0x19dbe2,_0x8f11db){return db['VoiceQueuesLog'][_0xf709('0x3d')]({'where':{'id':_0x19dbe2['params']['id']}})['then'](handleEntityNotFound(_0x8f11db,null))[_0xf709('0x1d')](removeEntity(_0x8f11db,null))[_0xf709('0x3a')](handleError(_0x8f11db,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index cda00fc..3a7f89d 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 _0x8fb3=['./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x543752,_0x2a8db6){var _0x420891=function(_0x28de82){while(--_0x28de82){_0x543752['push'](_0x543752['shift']());}};_0x420891(++_0x2a8db6);}(_0x8fb3,0xa8));var _0x38fb=function(_0x58f0a1,_0x14cd3e){_0x58f0a1=_0x58f0a1-0x0;var _0x896d28=_0x8fb3[_0x58f0a1];return _0x896d28;};'use strict';var _=require(_0x38fb('0x0'));var util=require(_0x38fb('0x1'));var logger=require('../../config/logger')(_0x38fb('0x2'));var moment=require(_0x38fb('0x3'));var BPromise=require('bluebird');var rp=require(_0x38fb('0x4'));var fs=require('fs');var path=require(_0x38fb('0x5'));var rimraf=require(_0x38fb('0x6'));var config=require(_0x38fb('0x7'));var attributes=require(_0x38fb('0x8'));module[_0x38fb('0x9')]=function(_0x275024,_0x41692e){return _0x275024[_0x38fb('0xa')](_0x38fb('0xb'),attributes,{'tableName':_0x38fb('0xc'),'paranoid':![],'indexes':[{'name':_0x38fb('0xd'),'fields':[_0x38fb('0xe'),_0x38fb('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0x2d36=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','../../config/logger','api'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2d36,0x6e));var _0x62d3=function(_0x454e3a,_0x5b291f){_0x454e3a=_0x454e3a-0x0;var _0x5d4422=_0x2d36[_0x454e3a];return _0x5d4422;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x62d3('0x0'))(_0x62d3('0x1'));var moment=require('moment');var BPromise=require(_0x62d3('0x2'));var rp=require(_0x62d3('0x3'));var fs=require('fs');var path=require(_0x62d3('0x4'));var rimraf=require(_0x62d3('0x5'));var config=require(_0x62d3('0x6'));var attributes=require(_0x62d3('0x7'));module['exports']=function(_0x745555,_0x457173){return _0x745555[_0x62d3('0x8')](_0x62d3('0x9'),attributes,{'tableName':_0x62d3('0xa'),'paranoid':![],'indexes':[{'name':_0x62d3('0xb'),'fields':[_0x62d3('0xc'),_0x62d3('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 2cea47f..6be789d 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 _0x19e1=['moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueuesLog,\x20%s,\x20%s','message','info','result','catch','lodash','util'];(function(_0x577f95,_0xdffe12){var _0x41af5e=function(_0x14ae4d){while(--_0x14ae4d){_0x577f95['push'](_0x577f95['shift']());}};_0x41af5e(++_0xdffe12);}(_0x19e1,0x163));var _0x119e=function(_0x17bb31,_0x2fc6f8){_0x17bb31=_0x17bb31-0x0;var _0x505c71=_0x19e1[_0x17bb31];return _0x505c71;};'use strict';var _=require(_0x119e('0x0'));var util=require(_0x119e('0x1'));var moment=require(_0x119e('0x2'));var BPromise=require(_0x119e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x119e('0x4'))['db'];var utils=require(_0x119e('0x5'));var logger=require('../../config/logger')(_0x119e('0x6'));var config=require(_0x119e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x119e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b5306,_0x25e166,_0x16a2ee){return new BPromise(function(_0x1b3797,_0x53d5b7){return client[_0x119e('0x9')](_0x1b5306,_0x16a2ee)[_0x119e('0xa')](function(_0x1a6747){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x25e166,_0x119e('0xb'));logger[_0x119e('0xc')](_0x119e('0xd'),_0x25e166,_0x119e('0xb'),JSON[_0x119e('0xe')](_0x1a6747));if(_0x1a6747[_0x119e('0xf')]){if(_0x1a6747[_0x119e('0xf')]['code']===0x1f4){logger[_0x119e('0xf')](_0x119e('0x10'),_0x25e166,_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);return _0x53d5b7(_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);}logger['error'](_0x119e('0x10'),_0x25e166,_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);return _0x1b3797(_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);}else{logger[_0x119e('0x12')](_0x119e('0x10'),_0x25e166,_0x119e('0xb'));_0x1b3797(_0x1a6747[_0x119e('0x13')][_0x119e('0x11')]);}})[_0x119e('0x14')](function(_0x54c326){logger[_0x119e('0xf')](_0x119e('0x10'),_0x25e166,_0x54c326);_0x53d5b7(_0x54c326);});});} \ No newline at end of file +var _0xae60=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x349d0c,_0x1e2063){var _0x3b505d=function(_0x4419c0){while(--_0x4419c0){_0x349d0c['push'](_0x349d0c['shift']());}};_0x3b505d(++_0x1e2063);}(_0xae60,0x1c7));var _0x0ae6=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xae60[_0x17406a];return _0x1501ff;};'use strict';var _=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var moment=require(_0x0ae6('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ae6('0x3'));var fs=require('fs');var Redis=require(_0x0ae6('0x4'));var db=require(_0x0ae6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ae6('0x6'))(_0x0ae6('0x7'));var config=require('../../config/environment');var jayson=require(_0x0ae6('0x8'));var client=jayson[_0x0ae6('0x9')][_0x0ae6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46fed4,_0xbb596c,_0x447a1d){return new BPromise(function(_0x120910,_0x1b5e80){return client['request'](_0x46fed4,_0x447a1d)[_0x0ae6('0xb')](function(_0x36a5e0){logger[_0x0ae6('0xc')](_0x0ae6('0xd'),_0xbb596c,'request\x20sent');logger[_0x0ae6('0xe')](_0x0ae6('0xf'),_0xbb596c,_0x0ae6('0x10'),JSON[_0x0ae6('0x11')](_0x36a5e0));if(_0x36a5e0[_0x0ae6('0x12')]){if(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x13')]===0x1f4){logger[_0x0ae6('0x12')](_0x0ae6('0xd'),_0xbb596c,_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);return _0x1b5e80(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);}logger[_0x0ae6('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0xbb596c,_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);return _0x120910(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);}else{logger[_0x0ae6('0xc')](_0x0ae6('0xd'),_0xbb596c,_0x0ae6('0x10'));_0x120910(_0x36a5e0[_0x0ae6('0x15')][_0x0ae6('0x14')]);}})[_0x0ae6('0x16')](function(_0x8a4c9a){logger[_0x0ae6('0x12')](_0x0ae6('0xd'),_0xbb596c,_0x8a4c9a);_0x1b5e80(_0x8a4c9a);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index d7f0c43..984245d 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 _0xebb9=['post','create','runTranscribe','put','update','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index','/describe','describe','get','/:id','show','download','/:id/downloads','downloads'];(function(_0x5e573c,_0x1744dc){var _0x2170e1=function(_0x4af77e){while(--_0x4af77e){_0x5e573c['push'](_0x5e573c['shift']());}};_0x2170e1(++_0x1744dc);}(_0xebb9,0x66));var _0x9ebb=function(_0x292f2c,_0x2f94ad){_0x292f2c=_0x292f2c-0x0;var _0x443c8a=_0xebb9[_0x292f2c];return _0x443c8a;};'use strict';var multer=require(_0x9ebb('0x0'));var util=require(_0x9ebb('0x1'));var path=require('path');var timeout=require(_0x9ebb('0x2'));var express=require(_0x9ebb('0x3'));var router=express[_0x9ebb('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9ebb('0x5'));var config=require(_0x9ebb('0x6'));var controller=require(_0x9ebb('0x7'));router['get']('/',auth[_0x9ebb('0x8')](),controller[_0x9ebb('0x9')]);router['get'](_0x9ebb('0xa'),auth['isAuthenticated'](),controller[_0x9ebb('0xb')]);router[_0x9ebb('0xc')](_0x9ebb('0xd'),auth[_0x9ebb('0x8')](),controller[_0x9ebb('0xe')]);router['get']('/:id/download',auth[_0x9ebb('0x8')](),controller[_0x9ebb('0xf')]);router['get'](_0x9ebb('0x10'),controller[_0x9ebb('0x11')]);router[_0x9ebb('0xc')]('/:id/transcribe',auth['isAuthenticated'](),controller['downloadTranscribe']);router[_0x9ebb('0x12')]('/',auth['isAuthenticated'](),controller[_0x9ebb('0x13')]);router[_0x9ebb('0x12')]('/:id/transcribe',auth[_0x9ebb('0x8')](),controller[_0x9ebb('0x14')]);router[_0x9ebb('0x15')](_0x9ebb('0xd'),auth[_0x9ebb('0x8')](),controller[_0x9ebb('0x16')]);router['delete'](_0x9ebb('0xd'),auth['isAuthenticated'](),controller[_0x9ebb('0x17')]);module['exports']=router; \ No newline at end of file +var _0xc2a1=['/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','/describe','describe','get','/:id','show','/:id/download','download'];(function(_0x2fbd91,_0x4eb370){var _0x5d692b=function(_0x1b56bd){while(--_0x1b56bd){_0x2fbd91['push'](_0x2fbd91['shift']());}};_0x5d692b(++_0x4eb370);}(_0xc2a1,0x176));var _0x1c2a=function(_0x3ef2d5,_0x423d46){_0x3ef2d5=_0x3ef2d5-0x0;var _0x2fefb2=_0xc2a1[_0x3ef2d5];return _0x2fefb2;};'use strict';var multer=require(_0x1c2a('0x0'));var util=require(_0x1c2a('0x1'));var path=require(_0x1c2a('0x2'));var timeout=require(_0x1c2a('0x3'));var express=require(_0x1c2a('0x4'));var router=express[_0x1c2a('0x5')]();var auth=require(_0x1c2a('0x6'));var interaction=require(_0x1c2a('0x7'));var config=require(_0x1c2a('0x8'));var controller=require(_0x1c2a('0x9'));router['get']('/',auth[_0x1c2a('0xa')](),controller['index']);router['get'](_0x1c2a('0xb'),auth[_0x1c2a('0xa')](),controller[_0x1c2a('0xc')]);router[_0x1c2a('0xd')](_0x1c2a('0xe'),auth['isAuthenticated'](),controller[_0x1c2a('0xf')]);router[_0x1c2a('0xd')](_0x1c2a('0x10'),auth['isAuthenticated'](),controller[_0x1c2a('0x11')]);router[_0x1c2a('0xd')](_0x1c2a('0x12'),controller[_0x1c2a('0x13')]);router['get'](_0x1c2a('0x14'),auth[_0x1c2a('0xa')](),controller[_0x1c2a('0x15')]);router[_0x1c2a('0x16')]('/',auth[_0x1c2a('0xa')](),controller[_0x1c2a('0x17')]);router[_0x1c2a('0x16')](_0x1c2a('0x14'),auth[_0x1c2a('0xa')](),controller['runTranscribe']);router[_0x1c2a('0x18')](_0x1c2a('0xe'),auth[_0x1c2a('0xa')](),controller['update']);router[_0x1c2a('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x1c2a('0x1a')]);module[_0x1c2a('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index eda997a..2cb5c4c 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 _0x33f5=['BOOLEAN','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','exports','VIRTUAL','value','extname','getDataValue','STRING','setDataValue','channel','split','INTEGER','TEXT','NEW','FLOAT'];(function(_0x3b90e5,_0x1d17f9){var _0x2d0589=function(_0x425008){while(--_0x425008){_0x3b90e5['push'](_0x3b90e5['shift']());}};_0x2d0589(++_0x1d17f9);}(_0x33f5,0x18e));var _0x533f=function(_0xa765c,_0x3c7e74){_0xa765c=_0xa765c-0x0;var _0xc10485=_0x33f5[_0xa765c];return _0xc10485;};'use strict';var Sequelize=require(_0x533f('0x0'));var moment=require(_0x533f('0x1'));var path=require(_0x533f('0x2'));module[_0x533f('0x3')]={'format':{'type':Sequelize[_0x533f('0x4')],'get':function(){return this['getDataValue'](_0x533f('0x5'))?path[_0x533f('0x6')](this[_0x533f('0x7')](_0x533f('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x533f('0x8')]},'channel':{'type':Sequelize[_0x533f('0x8')],'set':function(_0x3c930f){if(_0x3c930f){this[_0x533f('0x9')](_0x533f('0xa'),_0x3c930f);this['setDataValue']('membername',_0x3c930f[_0x533f('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x533f('0x8')]},'calleridnum':{'type':Sequelize[_0x533f('0x8')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x533f('0x8')]},'connectedlinename':{'type':Sequelize[_0x533f('0x8')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x533f('0x8')]},'value':{'type':Sequelize[_0x533f('0x8')]},'type':{'type':Sequelize[_0x533f('0x8')]},'rating':{'type':Sequelize[_0x533f('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x533f('0x8')]},'userDisposition':{'type':Sequelize[_0x533f('0x8')]},'userSecondDisposition':{'type':Sequelize[_0x533f('0x8')]},'userThirdDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize[_0x533f('0xd')]},'transcribeName':{'type':Sequelize[_0x533f('0x8')]},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':_0x533f('0xe')},'fileUri':{'type':Sequelize[_0x533f('0xd')]},'fileText':{'type':Sequelize[_0x533f('0xd')]},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize[_0x533f('0x8')]},'sPositive':{'type':Sequelize[_0x533f('0xf')]},'sNegative':{'type':Sequelize[_0x533f('0xf')]},'sNeutral':{'type':Sequelize[_0x533f('0xf')]},'sMixed':{'type':Sequelize[_0x533f('0xf')]},'tempSentiment':{'type':Sequelize[_0x533f('0x10')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x533f('0x11')],'get':function(){return moment(this[_0x533f('0x7')](_0x533f('0x12')))[_0x533f('0x13')](_0x533f('0x14'))[_0x533f('0x15')]();}},'updatedAt':{'type':Sequelize[_0x533f('0x11')],'get':function(){return moment(this[_0x533f('0x7')](_0x533f('0x16')))[_0x533f('0x13')]('MM-DD-YYYY\x20HH:mm')[_0x533f('0x15')]();}}}; \ No newline at end of file +var _0xb4c2=['split','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','DATE','getDataValue','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','value','STRING','setDataValue','channel'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xb4c2,0x85));var _0x2b4c=function(_0x514c31,_0x5a4ea8){_0x514c31=_0x514c31-0x0;var _0x2ecc1c=_0xb4c2[_0x514c31];return _0x2ecc1c;};'use strict';var Sequelize=require(_0x2b4c('0x0'));var moment=require(_0x2b4c('0x1'));var path=require(_0x2b4c('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x2b4c('0x3'))?path['extname'](this['getDataValue'](_0x2b4c('0x3'))):undefined;}},'uniqueid':{'type':Sequelize[_0x2b4c('0x4')]},'channel':{'type':Sequelize[_0x2b4c('0x4')],'set':function(_0x2db25c){if(_0x2db25c){this[_0x2b4c('0x5')](_0x2b4c('0x6'),_0x2db25c);this[_0x2b4c('0x5')]('membername',_0x2db25c[_0x2b4c('0x7')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x2b4c('0x4')]},'calleridname':{'type':Sequelize[_0x2b4c('0x4')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x2b4c('0x4')]},'accountcode':{'type':Sequelize[_0x2b4c('0x4')]},'context':{'type':Sequelize[_0x2b4c('0x4')]},'exten':{'type':Sequelize[_0x2b4c('0x4')]},'value':{'type':Sequelize[_0x2b4c('0x4')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0x2b4c('0x8')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x2b4c('0x4')]},'userDisposition':{'type':Sequelize[_0x2b4c('0x4')]},'userSecondDisposition':{'type':Sequelize[_0x2b4c('0x4')]},'userThirdDisposition':{'type':Sequelize[_0x2b4c('0x4')]},'location':{'type':Sequelize[_0x2b4c('0x9')]},'transcribeName':{'type':Sequelize[_0x2b4c('0x4')]},'transcribeStatus':{'type':Sequelize[_0x2b4c('0x4')],'defaultValue':_0x2b4c('0xa')},'fileUri':{'type':Sequelize[_0x2b4c('0x9')]},'fileText':{'type':Sequelize[_0x2b4c('0x9')]},'failureReason':{'type':Sequelize[_0x2b4c('0x9')]},'sentiment':{'type':Sequelize[_0x2b4c('0x4')]},'sPositive':{'type':Sequelize[_0x2b4c('0xb')]},'sNegative':{'type':Sequelize[_0x2b4c('0xb')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize[_0x2b4c('0xb')]},'tempSentiment':{'type':Sequelize[_0x2b4c('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x2b4c('0xd')],'get':function(){return moment(this[_0x2b4c('0xe')](_0x2b4c('0xf')))[_0x2b4c('0x10')](_0x2b4c('0x11'))[_0x2b4c('0x12')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x2b4c('0xe')](_0x2b4c('0x13')))[_0x2b4c('0x10')](_0x2b4c('0x11'))[_0x2b4c('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index ac154cc..7090109 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 _0xbebc=['unlinkSync','.cypher','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','transcribeName','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Sequelize','Transcribe\x20not\x20configured','runSentiment','sentiment','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','catch','show','params','fields','include','find','create','body','describe','../../components/encryptor','uniqueid','value','format','%s.cypher','existsSync','decryptFile','secrets','VoiceRecording\x20not\x20found','filename','extname','unlink','download','message','downloads','sequelize','token','push','recording','ValidationError','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione'];(function(_0x3ccd1a,_0x26d505){var _0x490970=function(_0x547f3f){while(--_0x547f3f){_0x3ccd1a['push'](_0x3ccd1a['shift']());}};_0x490970(++_0x26d505);}(_0xbebc,0xc7));var _0xcbeb=function(_0x2a288e,_0xc92ec9){_0x2a288e=_0x2a288e-0x0;var _0x586128=_0xbebc[_0x2a288e];return _0x586128;};'use strict';var pdf=require(_0xcbeb('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcbeb('0x1'));var jsonpatch=require(_0xcbeb('0x2'));var rp=require('request-promise');var moment=require(_0xcbeb('0x3'));var BPromise=require(_0xcbeb('0x4'));var Mustache=require(_0xcbeb('0x5'));var util=require(_0xcbeb('0x6'));var path=require(_0xcbeb('0x7'));var sox=require(_0xcbeb('0x8'));var csv=require(_0xcbeb('0x9'));var ejs=require(_0xcbeb('0xa'));var fs=require('fs');var _=require(_0xcbeb('0xb'));var squel=require('squel');var crypto=require(_0xcbeb('0xc'));var jsforce=require(_0xcbeb('0xd'));var deskjs=require(_0xcbeb('0xe'));var toCsv=require(_0xcbeb('0x9'));var querystring=require(_0xcbeb('0xf'));var Papa=require(_0xcbeb('0x10'));var AWS=require('aws-sdk');var uuidv4=require(_0xcbeb('0x11'));var Redis=require(_0xcbeb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xcbeb('0x13'));var as=require(_0xcbeb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcbeb('0x15'))(_0xcbeb('0x16'));var utils=require(_0xcbeb('0x17'));var config=require(_0xcbeb('0x18'));var licenseUtil=require(_0xcbeb('0x19'));var db=require(_0xcbeb('0x1a'))['db'];function respondWithStatusCode(_0x32fa2a,_0x1ccda1){_0x1ccda1=_0x1ccda1||0xcc;return function(_0x16e7bc){if(_0x16e7bc){return _0x32fa2a[_0xcbeb('0x1b')](_0x1ccda1);}return _0x32fa2a[_0xcbeb('0x1c')](_0x1ccda1)[_0xcbeb('0x1d')]();};}function respondWithResult(_0x949ea3,_0xfcfd77){_0xfcfd77=_0xfcfd77||0xc8;return function(_0x55b449){if(_0x55b449){return _0x949ea3[_0xcbeb('0x1c')](_0xfcfd77)[_0xcbeb('0x1e')](_0x55b449);}};}function respondWithFilteredResult(_0x46bb90,_0x9cc7a1){return function(_0x56635e){if(_0x56635e){var _0x484c2c=_0x56635e[_0xcbeb('0x1f')],_0x58c3c9=_0x9cc7a1[_0xcbeb('0x20')],_0xed2ee4=_0x9cc7a1['offset']+_0x9cc7a1[_0xcbeb('0x21')],_0x377a32;if(_0xed2ee4>=_0x484c2c){_0xed2ee4=_0x484c2c;_0x377a32=0xc8;}else{_0x377a32=0xce;}_0x46bb90[_0xcbeb('0x1c')](_0x377a32);return _0x46bb90[_0xcbeb('0x22')](_0xcbeb('0x23'),_0x58c3c9+'-'+_0xed2ee4+'/'+_0x484c2c)[_0xcbeb('0x1e')](_0x56635e);}return null;};}function patchUpdates(_0x570865){return function(_0x29a4aa){try{jsonpatch[_0xcbeb('0x24')](_0x29a4aa,_0x570865,!![]);}catch(_0x984b6c){return BPromise[_0xcbeb('0x25')](_0x984b6c);}return _0x29a4aa['save']();};}function saveUpdates(_0x3a4e3e,_0x2b6a01){return function(_0x337417){if(_0x337417){return _0x337417[_0xcbeb('0x26')](_0x3a4e3e)[_0xcbeb('0x27')](function(_0x305362){return _0x305362;});}return null;};}function removeEntity(_0x529630,_0x548c0e){return function(_0x27d1ba){if(_0x27d1ba){return _0x27d1ba[_0xcbeb('0x28')]()[_0xcbeb('0x27')](function(){_0x529630[_0xcbeb('0x1c')](0xcc)[_0xcbeb('0x1d')]();});}};}function handleEntityNotFound(_0x22beb0,_0x4581b1){return function(_0x471abb){if(!_0x471abb){_0x22beb0[_0xcbeb('0x1b')](0x194);}return _0x471abb;};}function handleError(_0x1b352f,_0x51ad42){_0x51ad42=_0x51ad42||0x1f4;return function(_0x33c56e){logger['error'](_0x33c56e['stack']);if(_0x33c56e[_0xcbeb('0x29')]){delete _0x33c56e[_0xcbeb('0x29')];}_0x1b352f['status'](_0x51ad42)[_0xcbeb('0x2a')](_0x33c56e);};}exports[_0xcbeb('0x2b')]=function(_0x43b018,_0x14a904){var _0x4124fa={},_0x575d87={},_0x299f02={'count':0x0,'rows':[]};var _0x405ab3=_[_0xcbeb('0x2c')](db[_0xcbeb('0x2d')][_0xcbeb('0x2e')],function(_0x3706c7){return{'name':_0x3706c7[_0xcbeb('0x2f')],'type':_0x3706c7[_0xcbeb('0x30')]['key']};});_0x575d87[_0xcbeb('0x31')]=_[_0xcbeb('0x32')](_['map'](_0x405ab3,_0xcbeb('0x29')),['format']);_0x575d87['query']=_[_0xcbeb('0x33')](_0x43b018[_0xcbeb('0x34')]);_0x575d87[_0xcbeb('0x35')]=_[_0xcbeb('0x36')](_0x575d87['model'],_0x575d87[_0xcbeb('0x34')]);_0x4124fa[_0xcbeb('0x37')]=_[_0xcbeb('0x36')](_0x575d87['model'],qs['fields'](_0x43b018[_0xcbeb('0x34')]['fields']));_0x4124fa[_0xcbeb('0x37')]=_0x4124fa['attributes'][_0xcbeb('0x38')]?_0x4124fa[_0xcbeb('0x37')]:_0x575d87['model'];if(!_0x43b018[_0xcbeb('0x34')][_0xcbeb('0x39')](_0xcbeb('0x3a'))){_0x4124fa[_0xcbeb('0x21')]=qs[_0xcbeb('0x21')](_0x43b018['query']['limit']);_0x4124fa[_0xcbeb('0x20')]=qs[_0xcbeb('0x20')](_0x43b018[_0xcbeb('0x34')][_0xcbeb('0x20')]);}_0x4124fa[_0xcbeb('0x3b')]=qs['sort'](_0x43b018['query'][_0xcbeb('0x3c')]);_0x4124fa[_0xcbeb('0x3d')]=qs[_0xcbeb('0x35')](_[_0xcbeb('0x3e')](_0x43b018[_0xcbeb('0x34')],_0x575d87['filters']),_0x405ab3);if(_0x43b018[_0xcbeb('0x34')][_0xcbeb('0x3f')]){_0x4124fa['where']=_['merge'](_0x4124fa[_0xcbeb('0x3d')],{'$or':_['map'](_0x405ab3,function(_0x3bdbb4){if(_0x3bdbb4[_0xcbeb('0x30')]!==_0xcbeb('0x40')){var _0x453d51={};_0x453d51[_0x3bdbb4['name']]={'$like':'%'+_0x43b018[_0xcbeb('0x34')][_0xcbeb('0x3f')]+'%'};return _0x453d51;}})});}_0x4124fa=_[_0xcbeb('0x41')]({},_0x4124fa,_0x43b018[_0xcbeb('0x42')]);var _0x2a38b7={'where':_0x4124fa[_0xcbeb('0x3d')]};return db[_0xcbeb('0x2d')]['count'](_0x2a38b7)[_0xcbeb('0x27')](function(_0xa0d263){_0x299f02[_0xcbeb('0x1f')]=_0xa0d263;if(_0x43b018[_0xcbeb('0x34')][_0xcbeb('0x43')]){_0x4124fa['include']=[{'all':!![]}];}return db[_0xcbeb('0x2d')]['findAll'](_0x4124fa);})[_0xcbeb('0x27')](function(_0x19a034){_0x299f02['rows']=_0x19a034;return _0x299f02;})['then'](respondWithFilteredResult(_0x14a904,_0x4124fa))[_0xcbeb('0x44')](handleError(_0x14a904,null));};exports[_0xcbeb('0x45')]=function(_0x174853,_0x1ceff3){var _0x5ca0e8={'raw':![],'where':{'id':_0x174853[_0xcbeb('0x46')]['id']}},_0x5edae2={};_0x5edae2[_0xcbeb('0x31')]=_['keys'](db[_0xcbeb('0x2d')][_0xcbeb('0x2e')]);_0x5edae2[_0xcbeb('0x34')]=_[_0xcbeb('0x33')](_0x174853[_0xcbeb('0x34')]);_0x5edae2[_0xcbeb('0x35')]=_[_0xcbeb('0x36')](_0x5edae2[_0xcbeb('0x31')],_0x5edae2['query']);_0x5ca0e8[_0xcbeb('0x37')]=_[_0xcbeb('0x36')](_0x5edae2[_0xcbeb('0x31')],qs[_0xcbeb('0x47')](_0x174853['query'][_0xcbeb('0x47')]));_0x5ca0e8['attributes']=_0x5ca0e8[_0xcbeb('0x37')]['length']?_0x5ca0e8[_0xcbeb('0x37')]:_0x5edae2[_0xcbeb('0x31')];if(_0x174853[_0xcbeb('0x34')][_0xcbeb('0x43')]){_0x5ca0e8[_0xcbeb('0x48')]=[{'all':!![]}];}_0x5ca0e8=_[_0xcbeb('0x41')]({},_0x5ca0e8,_0x174853['options']);return db['VoiceRecording'][_0xcbeb('0x49')](_0x5ca0e8)[_0xcbeb('0x27')](handleEntityNotFound(_0x1ceff3,null))[_0xcbeb('0x27')](respondWithResult(_0x1ceff3,null))[_0xcbeb('0x44')](handleError(_0x1ceff3,null));};exports[_0xcbeb('0x4a')]=function(_0x26fbc4,_0x3680e6){return db[_0xcbeb('0x2d')][_0xcbeb('0x4a')](_0x26fbc4[_0xcbeb('0x4b')],{})['then'](respondWithResult(_0x3680e6,0xc9))[_0xcbeb('0x44')](handleError(_0x3680e6,null));};exports['update']=function(_0x42e4c1,_0x53ffc5){if(_0x42e4c1[_0xcbeb('0x4b')]['id']){delete _0x42e4c1[_0xcbeb('0x4b')]['id'];}return db['VoiceRecording'][_0xcbeb('0x49')]({'where':{'id':_0x42e4c1['params']['id']}})[_0xcbeb('0x27')](handleEntityNotFound(_0x53ffc5,null))[_0xcbeb('0x27')](saveUpdates(_0x42e4c1[_0xcbeb('0x4b')],null))[_0xcbeb('0x27')](respondWithResult(_0x53ffc5,null))[_0xcbeb('0x44')](handleError(_0x53ffc5,null));};exports[_0xcbeb('0x4c')]=function(_0x1a27c9,_0xfdcaf7){return db[_0xcbeb('0x2d')]['describe']()['then'](respondWithResult(_0xfdcaf7,null))[_0xcbeb('0x44')](handleError(_0xfdcaf7,null));};exports['download']=function(_0x3e57e3,_0x418383,_0x423e54){var _0x3955bc=require(_0xcbeb('0x4d'));var _0x154694=![];var _0x25e2eb={};if(_0x3e57e3['query']['type']&&_0x3e57e3[_0xcbeb('0x34')][_0xcbeb('0x30')]===_0xcbeb('0x4e')){_0x25e2eb['uniqueid']=_0x3e57e3['params']['id'];}else{_0x25e2eb['id']=_0x3e57e3['params']['id'];}return db[_0xcbeb('0x2d')][_0xcbeb('0x49')]({'where':_0x25e2eb,'attributes':['id',_0xcbeb('0x4f')],'raw':!![]})[_0xcbeb('0x27')](handleEntityNotFound(_0x418383,null))[_0xcbeb('0x27')](function(_0x1663ce){if(_0x1663ce){var _0x23a9b9=_0x1663ce[_0xcbeb('0x4f')];var _0x545809=util[_0xcbeb('0x50')](_0xcbeb('0x51'),_0x23a9b9);if(fs[_0xcbeb('0x52')](_0x545809)){_0x154694=!![];return _0x3955bc[_0xcbeb('0x53')](_0x545809,_0x23a9b9,config[_0xcbeb('0x54')]['recording'])[_0xcbeb('0x27')](function(){return _0x1663ce;});}return _0x1663ce;}})[_0xcbeb('0x27')](function(_0x4d1130){if(_0x4d1130){var _0x24cbc6=_0x4d1130[_0xcbeb('0x4f')];if(!fs[_0xcbeb('0x52')](_0x24cbc6)){throw new db['Sequelize']['ValidationError'](_0xcbeb('0x55'));}if(_0x4d1130[_0xcbeb('0x56')]){return _0x418383['download'](_0x24cbc6,_0x4d1130[_0xcbeb('0x56')]+path[_0xcbeb('0x57')](_0x24cbc6),function(){if(_0x154694){fs[_0xcbeb('0x58')](_0x24cbc6);}});}else{return _0x418383[_0xcbeb('0x59')](_0x24cbc6,function(_0x55a7fd){if(_0x154694){fs['unlink'](_0x24cbc6);}});}}})['catch'](function(_0x4b107d){if(_0x4b107d[_0xcbeb('0x5a')]===_0xcbeb('0x55')){_0x418383[_0xcbeb('0x1c')](0x194)['send']('Not\x20found');}else{return handleError(_0x418383,null);}});};exports[_0xcbeb('0x5b')]=function(_0x960d7f,_0x5250b1,_0x12300a){var _0x4a136d=require(_0xcbeb('0x4d'));var _0x21e6f1=![];var _0x2691e0={'$and':[db['sequelize']['where'](db[_0xcbeb('0x5c')]['fn']('MD5',db[_0xcbeb('0x5c')]['col'](_0xcbeb('0x4e'))),_0x960d7f[_0xcbeb('0x34')][_0xcbeb('0x5d')])]};if(_0x960d7f[_0xcbeb('0x34')][_0xcbeb('0x30')]&&_0x960d7f[_0xcbeb('0x34')][_0xcbeb('0x30')]==='uniqueid'){_0x2691e0['$and'][_0xcbeb('0x5e')]({'uniqueid':_0x960d7f[_0xcbeb('0x46')]['id']});}else{_0x2691e0['$and'][_0xcbeb('0x5e')]({'id':_0x960d7f[_0xcbeb('0x46')]['id']});}return db['VoiceRecording'][_0xcbeb('0x49')]({'where':_0x2691e0,'attributes':['id',_0xcbeb('0x4f')],'raw':!![]})[_0xcbeb('0x27')](handleEntityNotFound(_0x5250b1,null))[_0xcbeb('0x27')](function(_0x30600d){if(_0x30600d){var _0x462290=util['format']('%s.cypher',_0x30600d[_0xcbeb('0x4f')]);if(fs[_0xcbeb('0x52')](_0x462290)){_0x21e6f1=!![];return _0x4a136d[_0xcbeb('0x53')](_0x462290,_0x30600d[_0xcbeb('0x4f')],config[_0xcbeb('0x54')][_0xcbeb('0x5f')])[_0xcbeb('0x27')](function(){return _0x30600d;});}return _0x30600d;}})[_0xcbeb('0x27')](function(_0x511ff3){if(_0x511ff3){if(!fs[_0xcbeb('0x52')](_0x511ff3[_0xcbeb('0x4f')])){throw new db['Sequelize'][(_0xcbeb('0x60'))](_0xcbeb('0x55'));}if(_0x511ff3[_0xcbeb('0x56')]){return _0x5250b1[_0xcbeb('0x59')](_0x511ff3[_0xcbeb('0x4f')],_0x511ff3['filename']+path[_0xcbeb('0x57')](_0x511ff3['value']),function(){if(_0x21e6f1){fs['unlink'](_0x511ff3[_0xcbeb('0x4f')]);}});}else{return _0x5250b1[_0xcbeb('0x59')](_0x511ff3['value'],function(_0x5e5f88){if(_0x21e6f1){fs[_0xcbeb('0x58')](_0x511ff3[_0xcbeb('0x4f')]);}});}}})[_0xcbeb('0x44')](handleError(_0x5250b1,null));};exports['destroy']=function(_0x2661e2,_0x19564f){return db[_0xcbeb('0x2d')][_0xcbeb('0x49')]({'where':{'id':_0x2661e2[_0xcbeb('0x46')]['id']}})[_0xcbeb('0x27')](function(_0x33c39b){if(!_0x33c39b)throw new ReferenceError(_0xcbeb('0x61'));return _0x33c39b;})['then'](function(_0x5eabee){var _0x1835dd=_0x5eabee['value'];logger[_0xcbeb('0x62')](_0xcbeb('0x63'),_0x1835dd);if(!_[_0xcbeb('0x64')](_0x5eabee[_0xcbeb('0x4f')])&&fs[_0xcbeb('0x52')](_0x1835dd)){logger[_0xcbeb('0x62')](_0xcbeb('0x65')+_0x1835dd+_0xcbeb('0x66'));fs[_0xcbeb('0x67')](_0x1835dd);}_0x1835dd=_0x1835dd+_0xcbeb('0x68');if(!_[_0xcbeb('0x64')](_0x5eabee[_0xcbeb('0x4f')])&&fs[_0xcbeb('0x52')](_0x1835dd)){logger['info'](_0xcbeb('0x65')+_0x1835dd+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x1835dd);}return _0x5eabee;})[_0xcbeb('0x27')](function(_0x4ff92c){if(!_0x4ff92c)throw new InternalError();return _0x4ff92c[_0xcbeb('0x28')]();})[_0xcbeb('0x27')](function(){_0x19564f[_0xcbeb('0x1c')](0xcc)[_0xcbeb('0x1d')]();})[_0xcbeb('0x44')](handleError(_0x19564f,null));};function getBucketslist(_0x5bd354,_0x1117a4,_0x5869b6){return new Promise(function(_0x3f4fed,_0x53eb16){var _0xebfd15=new AWS['S3']({'accessKeyId':_0x1117a4,'secretAccessKey':_0x5bd354,'region':_0x5869b6});_0xebfd15[_0xcbeb('0x69')]({},function(_0x4f0f32,_0x2ffdd7){if(_0x4f0f32){return _0x53eb16(_0x4f0f32);}else{return _0x3f4fed(_0x2ffdd7);}});});}function createBucket(_0x4cf3f6,_0x40a1d0,_0x75b60,_0xfac52c){return new Promise(function(_0x1a88dd,_0x3310c9){var _0x299d8a=new AWS['S3']({'accessKeyId':_0x40a1d0,'secretAccessKey':_0x4cf3f6,'region':_0x75b60});_0x299d8a['createBucket']({'Bucket':_0xfac52c},function(_0x42fdd9,_0x19a829){if(_0x42fdd9){return _0x3310c9(_0x42fdd9);}else{return _0x1a88dd(_0x19a829);}});});}function uploadFile(_0x1df125,_0x3c2950,_0xc9330b,_0x199e2d,_0x1c1124,_0x512a12){return new Promise(function(_0x40dc22,_0x1e2cfb){var _0x3f6b3b=new AWS['S3']({'accessKeyId':_0x3c2950,'secretAccessKey':_0x1df125,'region':_0xc9330b});_0x3f6b3b[_0xcbeb('0x6a')]({'Bucket':_0x199e2d,'Key':_0x1c1124,'Body':_0x512a12},function(_0x1d5f6d,_0x4ec8c9){if(_0x1d5f6d){return _0x1e2cfb(_0x1d5f6d);}else{return _0x40dc22(_0x4ec8c9);}});});}function startTranscribe(_0x1c5f69,_0x12b704,_0xaa47f8,_0x3f479f,_0x58d604,_0x293daf){return new Promise(function(_0x188638,_0x474aa8){var _0x2fb775=new AWS[(_0xcbeb('0x6b'))]({'accessKeyId':_0x12b704,'secretAccessKey':_0x1c5f69,'region':_0xaa47f8});_0x2fb775[_0xcbeb('0x6c')]({'TranscriptionJobName':_0x3f479f,'LanguageCode':_0x58d604,'Media':{'MediaFileUri':_0x293daf}},function(_0x59d775,_0xa4070c){if(_0x59d775){return _0x474aa8(_0x59d775);}else{return _0x188638(_0xa4070c);}});});}function transcribe(_0xf2faca,_0x5b6415,_0x1b2dbf,_0x13ae2c,_0x5eb5a5,_0x3b55e5,_0x1f0ec7){return new Promise(function(_0x541f35,_0x196cce){var _0x2a837d={};logger[_0xcbeb('0x62')](util[_0xcbeb('0x50')](_0xcbeb('0x6d'),_0xf2faca,_0x5eb5a5));return uploadFile(_0x5b6415,_0x1b2dbf,_0x13ae2c,_0x5eb5a5,path[_0xcbeb('0x6e')](_0x3b55e5),fs[_0xcbeb('0x6f')](_0x3b55e5))[_0xcbeb('0x27')](function(_0x207989){logger[_0xcbeb('0x62')](util['format'](_0xcbeb('0x70'),_0xf2faca,_0x5eb5a5,_0x207989[_0xcbeb('0x71')]));_0x2a837d[_0xcbeb('0x72')]=_0x207989['Bucket'];_0x2a837d[_0xcbeb('0x73')]=_0x207989[_0xcbeb('0x71')];logger['info'](util[_0xcbeb('0x50')](_0xcbeb('0x74'),_0xf2faca));return startTranscribe(_0x5b6415,_0x1b2dbf,_0x13ae2c,uuidv4(),_0x1f0ec7,_0x207989[_0xcbeb('0x71')]);})['then'](function(_0x480724){logger[_0xcbeb('0x62')](util[_0xcbeb('0x50')](_0xcbeb('0x75'),_0xf2faca,_0x480724['TranscriptionJob']['TranscriptionJobName']));_0x2a837d[_0xcbeb('0x76')]=_0x480724[_0xcbeb('0x77')][_0xcbeb('0x78')];_0x2a837d[_0xcbeb('0x79')]=_0x480724[_0xcbeb('0x77')][_0xcbeb('0x7a')];return _0x541f35(_0x2a837d);})[_0xcbeb('0x44')](function(_0x3e626f){return _0x196cce(_0x3e626f);});});}exports[_0xcbeb('0x7b')]=function(_0x247df5,_0x560564,_0x5020c1){var _0x52aa22;var _0x6504b;var _0x27663a;var _0x25eb11=require('../../components/encryptor');return db[_0xcbeb('0x2d')][_0xcbeb('0x7c')]({'where':{'id':_0x247df5['params']['id']}})[_0xcbeb('0x27')](function(_0x6817d2){if(_0x6817d2){var _0x5211fe=util['format']('%s.cypher',_0x6817d2[_0xcbeb('0x4f')]);if(fs[_0xcbeb('0x52')](_0x5211fe)){cypher=!![];return _0x25eb11[_0xcbeb('0x53')](_0x5211fe,_0x6817d2[_0xcbeb('0x4f')],config[_0xcbeb('0x54')]['recording'])[_0xcbeb('0x27')](function(){return _0x6817d2;});}return _0x6817d2;}})[_0xcbeb('0x27')](function(_0x2b3b35){if(!_0x2b3b35){throw new db['Sequelize'][(_0xcbeb('0x60'))](_0xcbeb('0x7d'));}_0x6504b=_0x2b3b35;return db[_0xcbeb('0x7e')]['findOne']({'where':{'id':0x1}});})[_0xcbeb('0x27')](handleEntityNotFound(_0x560564,null))['then'](function(_0x3e1ab6){if(_0x3e1ab6){_0x52aa22=_0x3e1ab6;if(!_0x52aa22[_0xcbeb('0x7f')]||!_0x52aa22[_0xcbeb('0x80')]||!_0x52aa22[_0xcbeb('0x81')]||!_0x52aa22[_0xcbeb('0x82')]||!_0x52aa22[_0xcbeb('0x72')]){throw new db[(_0xcbeb('0x83'))][(_0xcbeb('0x60'))](_0xcbeb('0x84'));}if(_0x247df5['body'][_0xcbeb('0x85')]&&(!_0x52aa22[_0xcbeb('0x86')]||!_0x52aa22['sentimentAccountId']||!_0x52aa22['sentimentRegion']||!_0x52aa22[_0xcbeb('0x82')]||!_0x52aa22['bucket'])){throw new db[(_0xcbeb('0x83'))][(_0xcbeb('0x60'))](_0xcbeb('0x87'));}return db['CloudProvider'][_0xcbeb('0x7c')]({'where':{'id':_0x52aa22[_0xcbeb('0x80')]}});}})[_0xcbeb('0x27')](function(_0x33d9df){if(!_0x33d9df){throw new db['Sequelize'][(_0xcbeb('0x60'))](_0xcbeb('0x88'));}if(!_0x33d9df[_0xcbeb('0x89')]||!_0x33d9df[_0xcbeb('0x8a')]){throw new db[(_0xcbeb('0x83'))][(_0xcbeb('0x60'))](_0xcbeb('0x8b'));}_0x27663a=_0x33d9df;return getBucketslist(_0x27663a['data1'],_0x27663a[_0xcbeb('0x8a')],_0x52aa22[_0xcbeb('0x81')]);})[_0xcbeb('0x27')](function(_0x118458){if(_0x118458&&_0x118458['Buckets']){var _0xc3c541=_[_0xcbeb('0x49')](_0x118458[_0xcbeb('0x8c')],function(_0x4eeedb){return _0x4eeedb['Name']===_0x52aa22['bucket'];});if(!_0xc3c541){logger[_0xcbeb('0x62')](util[_0xcbeb('0x50')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x247df5[_0xcbeb('0x46')]['id'],_0x52aa22[_0xcbeb('0x72')]));return createBucket(_0x27663a[_0xcbeb('0x89')],_0x27663a[_0xcbeb('0x8a')],_0x52aa22[_0xcbeb('0x81')],_0x52aa22[_0xcbeb('0x72')]);}logger[_0xcbeb('0x62')](util[_0xcbeb('0x50')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x247df5['params']['id'],_0x52aa22[_0xcbeb('0x72')]));return;}})[_0xcbeb('0x27')](function(_0x5b0f72){if(_0x6504b[_0xcbeb('0x79')]===_0xcbeb('0x8d')){return transcribe(_0x247df5[_0xcbeb('0x46')]['id'],_0x27663a[_0xcbeb('0x89')],_0x27663a['data2'],_0x52aa22[_0xcbeb('0x81')],_0x52aa22['bucket'],_0x6504b[_0xcbeb('0x4f')],_0x52aa22['language']);}else{logger[_0xcbeb('0x62')](util[_0xcbeb('0x50')](_0xcbeb('0x8e'),_0x247df5['params']['id']));return{'transcribeStatus':_0xcbeb('0x8f')};}})[_0xcbeb('0x27')](function(_0x2dbed6){if(_0x2dbed6){_0x2dbed6[_0xcbeb('0x90')]=_0x247df5[_0xcbeb('0x4b')]['runSentiment'];return _0x6504b[_0xcbeb('0x91')](_0x2dbed6);}})[_0xcbeb('0x27')](respondWithResult(_0x560564,null))[_0xcbeb('0x44')](handleError(_0x560564,null));};function writeFile(_0x43aa45,_0x5d87a8){return new Promise(function(_0x5accbd,_0x3ec15d){fs[_0xcbeb('0x92')](_0x5d87a8,_0x43aa45,function(_0x162960,_0x5e6127){if(_0x162960){return _0x3ec15d(_0x162960);}else{return _0x5accbd(_0x5e6127);}});});}exports['downloadTranscribe']=function(_0x1f13b7,_0x42a56f,_0x3122c1){return db[_0xcbeb('0x2d')]['findOne']({'where':{'id':_0x1f13b7['params']['id']}})[_0xcbeb('0x27')](handleEntityNotFound(_0x42a56f))[_0xcbeb('0x27')](function(_0x384666){if(_0x384666&&_0x384666[_0xcbeb('0x93')]){var _0x4bd506=_0x384666[_0xcbeb('0x93')];var _0x471636=config[_0xcbeb('0x94')]+_0xcbeb('0x95')+_0x384666['id']+'.txt';if(fs[_0xcbeb('0x52')](_0x471636)){return _0x471636;}return writeFile(_0x4bd506,_0x471636)['then'](function(){return _0x471636;});}else{throw new db[(_0xcbeb('0x83'))][(_0xcbeb('0x60'))](_0xcbeb('0x96'));}})['then'](function(_0x489387){return _0x42a56f[_0xcbeb('0x59')](_0x489387);})['catch'](handleError(_0x42a56f));}; \ No newline at end of file +var _0xd5e3=['fieldName','type','key','model','format','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','options','include','findAll','rows','catch','show','params','merge','find','create','update','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','destroy','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeAccountId','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','name','send','map','VoiceRecording','rawAttributes'];(function(_0x9bdf5f,_0x1ae247){var _0x40df08=function(_0xc9cba9){while(--_0xc9cba9){_0x9bdf5f['push'](_0x9bdf5f['shift']());}};_0x40df08(++_0x1ae247);}(_0xd5e3,0x10c));var _0x3d5e=function(_0x26a6c4,_0x6862a0){_0x26a6c4=_0x26a6c4-0x0;var _0x40cf1f=_0xd5e3[_0x26a6c4];return _0x40cf1f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3d5e('0x0'));var jsonpatch=require(_0x3d5e('0x1'));var rp=require(_0x3d5e('0x2'));var moment=require(_0x3d5e('0x3'));var BPromise=require(_0x3d5e('0x4'));var Mustache=require(_0x3d5e('0x5'));var util=require(_0x3d5e('0x6'));var path=require(_0x3d5e('0x7'));var sox=require(_0x3d5e('0x8'));var csv=require(_0x3d5e('0x9'));var ejs=require(_0x3d5e('0xa'));var fs=require('fs');var _=require(_0x3d5e('0xb'));var squel=require('squel');var crypto=require(_0x3d5e('0xc'));var jsforce=require(_0x3d5e('0xd'));var deskjs=require(_0x3d5e('0xe'));var toCsv=require(_0x3d5e('0x9'));var querystring=require(_0x3d5e('0xf'));var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require(_0x3d5e('0x10'));var Redis=require(_0x3d5e('0x11'));var authService=require(_0x3d5e('0x12'));var qs=require(_0x3d5e('0x13'));var as=require(_0x3d5e('0x14'));var hardwareService=require(_0x3d5e('0x15'));var logger=require(_0x3d5e('0x16'))(_0x3d5e('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3d5e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2edc27,_0xee2797){_0xee2797=_0xee2797||0xcc;return function(_0x92fba6){if(_0x92fba6){return _0x2edc27[_0x3d5e('0x19')](_0xee2797);}return _0x2edc27[_0x3d5e('0x1a')](_0xee2797)[_0x3d5e('0x1b')]();};}function respondWithResult(_0x54e3fa,_0x5e606a){_0x5e606a=_0x5e606a||0xc8;return function(_0x1274dc){if(_0x1274dc){return _0x54e3fa[_0x3d5e('0x1a')](_0x5e606a)[_0x3d5e('0x1c')](_0x1274dc);}};}function respondWithFilteredResult(_0x53b38b,_0x54dc6a){return function(_0x66c4af){if(_0x66c4af){var _0x34c961=_0x66c4af[_0x3d5e('0x1d')],_0x424fd7=_0x54dc6a['offset'],_0x3a84cc=_0x54dc6a[_0x3d5e('0x1e')]+_0x54dc6a[_0x3d5e('0x1f')],_0x432a23;if(_0x3a84cc>=_0x34c961){_0x3a84cc=_0x34c961;_0x432a23=0xc8;}else{_0x432a23=0xce;}_0x53b38b[_0x3d5e('0x1a')](_0x432a23);return _0x53b38b[_0x3d5e('0x20')](_0x3d5e('0x21'),_0x424fd7+'-'+_0x3a84cc+'/'+_0x34c961)[_0x3d5e('0x1c')](_0x66c4af);}return null;};}function patchUpdates(_0x5e0c7b){return function(_0x4cd57e){try{jsonpatch[_0x3d5e('0x22')](_0x4cd57e,_0x5e0c7b,!![]);}catch(_0x16fd9f){return BPromise[_0x3d5e('0x23')](_0x16fd9f);}return _0x4cd57e[_0x3d5e('0x24')]();};}function saveUpdates(_0x33e65e,_0x34ecdc){return function(_0x1d6beb){if(_0x1d6beb){return _0x1d6beb['update'](_0x33e65e)[_0x3d5e('0x25')](function(_0x23aced){return _0x23aced;});}return null;};}function removeEntity(_0x235680,_0x499da0){return function(_0x2fd83e){if(_0x2fd83e){return _0x2fd83e['destroy']()['then'](function(){_0x235680[_0x3d5e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43c23b,_0x276a3a){return function(_0x1d47e9){if(!_0x1d47e9){_0x43c23b[_0x3d5e('0x19')](0x194);}return _0x1d47e9;};}function handleError(_0x151859,_0x46ec7d){_0x46ec7d=_0x46ec7d||0x1f4;return function(_0x57e393){logger[_0x3d5e('0x26')](_0x57e393['stack']);if(_0x57e393[_0x3d5e('0x27')]){delete _0x57e393[_0x3d5e('0x27')];}_0x151859[_0x3d5e('0x1a')](_0x46ec7d)[_0x3d5e('0x28')](_0x57e393);};}exports['index']=function(_0x5005c9,_0x37b68b){var _0x3fe2aa={},_0x47fbfd={},_0x3ee3d1={'count':0x0,'rows':[]};var _0x403678=_[_0x3d5e('0x29')](db[_0x3d5e('0x2a')][_0x3d5e('0x2b')],function(_0x49a28a){return{'name':_0x49a28a[_0x3d5e('0x2c')],'type':_0x49a28a[_0x3d5e('0x2d')][_0x3d5e('0x2e')]};});_0x47fbfd[_0x3d5e('0x2f')]=_['differenceBy'](_[_0x3d5e('0x29')](_0x403678,_0x3d5e('0x27')),[_0x3d5e('0x30')]);_0x47fbfd[_0x3d5e('0x31')]=_[_0x3d5e('0x32')](_0x5005c9[_0x3d5e('0x31')]);_0x47fbfd['filters']=_[_0x3d5e('0x33')](_0x47fbfd[_0x3d5e('0x2f')],_0x47fbfd[_0x3d5e('0x31')]);_0x3fe2aa[_0x3d5e('0x34')]=_['intersection'](_0x47fbfd[_0x3d5e('0x2f')],qs[_0x3d5e('0x35')](_0x5005c9[_0x3d5e('0x31')]['fields']));_0x3fe2aa['attributes']=_0x3fe2aa[_0x3d5e('0x34')][_0x3d5e('0x36')]?_0x3fe2aa[_0x3d5e('0x34')]:_0x47fbfd[_0x3d5e('0x2f')];if(!_0x5005c9[_0x3d5e('0x31')][_0x3d5e('0x37')](_0x3d5e('0x38'))){_0x3fe2aa[_0x3d5e('0x1f')]=qs[_0x3d5e('0x1f')](_0x5005c9[_0x3d5e('0x31')]['limit']);_0x3fe2aa[_0x3d5e('0x1e')]=qs[_0x3d5e('0x1e')](_0x5005c9['query'][_0x3d5e('0x1e')]);}_0x3fe2aa[_0x3d5e('0x39')]=qs[_0x3d5e('0x3a')](_0x5005c9[_0x3d5e('0x31')][_0x3d5e('0x3a')]);_0x3fe2aa[_0x3d5e('0x3b')]=qs[_0x3d5e('0x3c')](_[_0x3d5e('0x3d')](_0x5005c9['query'],_0x47fbfd[_0x3d5e('0x3c')]),_0x403678);if(_0x5005c9[_0x3d5e('0x31')]['filter']){_0x3fe2aa['where']=_['merge'](_0x3fe2aa['where'],{'$or':_[_0x3d5e('0x29')](_0x403678,function(_0x27f824){if(_0x27f824[_0x3d5e('0x2d')]!==_0x3d5e('0x3e')){var _0x20a1c6={};_0x20a1c6[_0x27f824[_0x3d5e('0x27')]]={'$like':'%'+_0x5005c9['query']['filter']+'%'};return _0x20a1c6;}})});}_0x3fe2aa=_['merge']({},_0x3fe2aa,_0x5005c9[_0x3d5e('0x3f')]);var _0x43df39={'where':_0x3fe2aa[_0x3d5e('0x3b')]};return db[_0x3d5e('0x2a')][_0x3d5e('0x1d')](_0x43df39)[_0x3d5e('0x25')](function(_0x22bdca){_0x3ee3d1[_0x3d5e('0x1d')]=_0x22bdca;if(_0x5005c9['query']['includeAll']){_0x3fe2aa[_0x3d5e('0x40')]=[{'all':!![]}];}return db[_0x3d5e('0x2a')][_0x3d5e('0x41')](_0x3fe2aa);})[_0x3d5e('0x25')](function(_0x2854f8){_0x3ee3d1[_0x3d5e('0x42')]=_0x2854f8;return _0x3ee3d1;})['then'](respondWithFilteredResult(_0x37b68b,_0x3fe2aa))[_0x3d5e('0x43')](handleError(_0x37b68b,null));};exports[_0x3d5e('0x44')]=function(_0x1b4e47,_0x2276b9){var _0x3bb165={'raw':![],'where':{'id':_0x1b4e47[_0x3d5e('0x45')]['id']}},_0x3b01d2={};_0x3b01d2[_0x3d5e('0x2f')]=_[_0x3d5e('0x32')](db[_0x3d5e('0x2a')][_0x3d5e('0x2b')]);_0x3b01d2[_0x3d5e('0x31')]=_[_0x3d5e('0x32')](_0x1b4e47[_0x3d5e('0x31')]);_0x3b01d2[_0x3d5e('0x3c')]=_['intersection'](_0x3b01d2['model'],_0x3b01d2[_0x3d5e('0x31')]);_0x3bb165[_0x3d5e('0x34')]=_[_0x3d5e('0x33')](_0x3b01d2[_0x3d5e('0x2f')],qs[_0x3d5e('0x35')](_0x1b4e47[_0x3d5e('0x31')][_0x3d5e('0x35')]));_0x3bb165['attributes']=_0x3bb165[_0x3d5e('0x34')][_0x3d5e('0x36')]?_0x3bb165['attributes']:_0x3b01d2[_0x3d5e('0x2f')];if(_0x1b4e47[_0x3d5e('0x31')]['includeAll']){_0x3bb165['include']=[{'all':!![]}];}_0x3bb165=_[_0x3d5e('0x46')]({},_0x3bb165,_0x1b4e47[_0x3d5e('0x3f')]);return db[_0x3d5e('0x2a')][_0x3d5e('0x47')](_0x3bb165)[_0x3d5e('0x25')](handleEntityNotFound(_0x2276b9,null))[_0x3d5e('0x25')](respondWithResult(_0x2276b9,null))[_0x3d5e('0x43')](handleError(_0x2276b9,null));};exports[_0x3d5e('0x48')]=function(_0x5415ac,_0x190ede){return db['VoiceRecording']['create'](_0x5415ac['body'],{})[_0x3d5e('0x25')](respondWithResult(_0x190ede,0xc9))[_0x3d5e('0x43')](handleError(_0x190ede,null));};exports[_0x3d5e('0x49')]=function(_0x55aa2c,_0x319495){if(_0x55aa2c[_0x3d5e('0x4a')]['id']){delete _0x55aa2c[_0x3d5e('0x4a')]['id'];}return db[_0x3d5e('0x2a')][_0x3d5e('0x47')]({'where':{'id':_0x55aa2c[_0x3d5e('0x45')]['id']}})['then'](handleEntityNotFound(_0x319495,null))[_0x3d5e('0x25')](saveUpdates(_0x55aa2c[_0x3d5e('0x4a')],null))[_0x3d5e('0x25')](respondWithResult(_0x319495,null))['catch'](handleError(_0x319495,null));};exports[_0x3d5e('0x4b')]=function(_0x5aece8,_0x3b72ff){return db[_0x3d5e('0x2a')][_0x3d5e('0x4b')]()[_0x3d5e('0x25')](respondWithResult(_0x3b72ff,null))[_0x3d5e('0x43')](handleError(_0x3b72ff,null));};exports[_0x3d5e('0x4c')]=function(_0x12faf9,_0x29a29a,_0x2307af){var _0x599e60=require(_0x3d5e('0x4d'));var _0x513bba=![];var _0x12ba90={};if(_0x12faf9[_0x3d5e('0x31')][_0x3d5e('0x2d')]&&_0x12faf9[_0x3d5e('0x31')][_0x3d5e('0x2d')]==='uniqueid'){_0x12ba90[_0x3d5e('0x4e')]=_0x12faf9['params']['id'];}else{_0x12ba90['id']=_0x12faf9[_0x3d5e('0x45')]['id'];}return db[_0x3d5e('0x2a')]['find']({'where':_0x12ba90,'attributes':['id',_0x3d5e('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x29a29a,null))['then'](function(_0xb86cb8){if(_0xb86cb8){var _0x4304be=_0xb86cb8[_0x3d5e('0x4f')];var _0x2933fe=util[_0x3d5e('0x30')](_0x3d5e('0x50'),_0x4304be);if(fs[_0x3d5e('0x51')](_0x2933fe)){_0x513bba=!![];return _0x599e60[_0x3d5e('0x52')](_0x2933fe,_0x4304be,config[_0x3d5e('0x53')][_0x3d5e('0x54')])[_0x3d5e('0x25')](function(){return _0xb86cb8;});}return _0xb86cb8;}})[_0x3d5e('0x25')](function(_0x4c8d72){if(_0x4c8d72){var _0x32c0d4=_0x4c8d72[_0x3d5e('0x4f')];if(!fs[_0x3d5e('0x51')](_0x32c0d4)){throw new db[(_0x3d5e('0x55'))][(_0x3d5e('0x56'))](_0x3d5e('0x57'));}if(_0x4c8d72[_0x3d5e('0x58')]){return _0x29a29a[_0x3d5e('0x4c')](_0x32c0d4,_0x4c8d72[_0x3d5e('0x58')]+path['extname'](_0x32c0d4),function(){if(_0x513bba){fs[_0x3d5e('0x59')](_0x32c0d4);}});}else{return _0x29a29a[_0x3d5e('0x4c')](_0x32c0d4,function(_0x3e0b3f){if(_0x513bba){fs[_0x3d5e('0x59')](_0x32c0d4);}});}}})[_0x3d5e('0x43')](function(_0x594ea3){if(_0x594ea3[_0x3d5e('0x5a')]===_0x3d5e('0x57')){_0x29a29a[_0x3d5e('0x1a')](0x194)[_0x3d5e('0x28')](_0x3d5e('0x5b'));}else{return handleError(_0x29a29a,null);}});};exports[_0x3d5e('0x5c')]=function(_0x56d3f9,_0x35e8d1,_0x4c64eb){var _0x508afb=require(_0x3d5e('0x4d'));var _0x5d35ab=![];var _0x54ae88={'$and':[db[_0x3d5e('0x5d')][_0x3d5e('0x3b')](db[_0x3d5e('0x5d')]['fn'](_0x3d5e('0x5e'),db['sequelize'][_0x3d5e('0x5f')]('uniqueid')),_0x56d3f9[_0x3d5e('0x31')][_0x3d5e('0x60')])]};if(_0x56d3f9['query'][_0x3d5e('0x2d')]&&_0x56d3f9[_0x3d5e('0x31')][_0x3d5e('0x2d')]===_0x3d5e('0x4e')){_0x54ae88[_0x3d5e('0x61')][_0x3d5e('0x62')]({'uniqueid':_0x56d3f9[_0x3d5e('0x45')]['id']});}else{_0x54ae88[_0x3d5e('0x61')][_0x3d5e('0x62')]({'id':_0x56d3f9[_0x3d5e('0x45')]['id']});}return db[_0x3d5e('0x2a')][_0x3d5e('0x47')]({'where':_0x54ae88,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x35e8d1,null))[_0x3d5e('0x25')](function(_0x4fef00){if(_0x4fef00){var _0x52197c=util[_0x3d5e('0x30')](_0x3d5e('0x50'),_0x4fef00[_0x3d5e('0x4f')]);if(fs[_0x3d5e('0x51')](_0x52197c)){_0x5d35ab=!![];return _0x508afb[_0x3d5e('0x52')](_0x52197c,_0x4fef00['value'],config[_0x3d5e('0x53')][_0x3d5e('0x54')])[_0x3d5e('0x25')](function(){return _0x4fef00;});}return _0x4fef00;}})['then'](function(_0x115ef0){if(_0x115ef0){if(!fs['existsSync'](_0x115ef0['value'])){throw new db['Sequelize'][(_0x3d5e('0x56'))](_0x3d5e('0x57'));}if(_0x115ef0[_0x3d5e('0x58')]){return _0x35e8d1[_0x3d5e('0x4c')](_0x115ef0[_0x3d5e('0x4f')],_0x115ef0['filename']+path['extname'](_0x115ef0[_0x3d5e('0x4f')]),function(){if(_0x5d35ab){fs[_0x3d5e('0x59')](_0x115ef0['value']);}});}else{return _0x35e8d1[_0x3d5e('0x4c')](_0x115ef0[_0x3d5e('0x4f')],function(_0x45cd80){if(_0x5d35ab){fs[_0x3d5e('0x59')](_0x115ef0[_0x3d5e('0x4f')]);}});}}})['catch'](handleError(_0x35e8d1,null));};exports[_0x3d5e('0x63')]=function(_0x5eab47,_0x503f9d){return db[_0x3d5e('0x2a')][_0x3d5e('0x47')]({'where':{'id':_0x5eab47[_0x3d5e('0x45')]['id']}})[_0x3d5e('0x25')](function(_0xcfc187){if(!_0xcfc187)throw new ReferenceError('Entity\x20not\x20found');return _0xcfc187;})['then'](function(_0x192bc3){var _0x501b26=_0x192bc3[_0x3d5e('0x4f')];logger[_0x3d5e('0x64')](_0x3d5e('0x65'),_0x501b26);if(!_[_0x3d5e('0x66')](_0x192bc3['value'])&&fs[_0x3d5e('0x51')](_0x501b26)){logger[_0x3d5e('0x64')](_0x3d5e('0x67')+_0x501b26+_0x3d5e('0x68'));fs[_0x3d5e('0x69')](_0x501b26);}_0x501b26=_0x501b26+_0x3d5e('0x6a');if(!_[_0x3d5e('0x66')](_0x192bc3[_0x3d5e('0x4f')])&&fs[_0x3d5e('0x51')](_0x501b26)){logger[_0x3d5e('0x64')]('File:\x20\x22'+_0x501b26+_0x3d5e('0x68'));fs[_0x3d5e('0x69')](_0x501b26);}return _0x192bc3;})[_0x3d5e('0x25')](function(_0x45c9cb){if(!_0x45c9cb)throw new InternalError();return _0x45c9cb[_0x3d5e('0x63')]();})[_0x3d5e('0x25')](function(){_0x503f9d[_0x3d5e('0x1a')](0xcc)[_0x3d5e('0x1b')]();})[_0x3d5e('0x43')](handleError(_0x503f9d,null));};function getBucketslist(_0x2af5f6,_0x537f87,_0x2b517d){return new Promise(function(_0x375f91,_0x8b1dda){var _0x1c5b29=new AWS['S3']({'accessKeyId':_0x537f87,'secretAccessKey':_0x2af5f6,'region':_0x2b517d});_0x1c5b29[_0x3d5e('0x6b')]({},function(_0x13622f,_0x102042){if(_0x13622f){return _0x8b1dda(_0x13622f);}else{return _0x375f91(_0x102042);}});});}function createBucket(_0x1917b7,_0x4b438e,_0x911498,_0x89e78b){return new Promise(function(_0x2a6ef9,_0x1ad2c5){var _0xb1cc30=new AWS['S3']({'accessKeyId':_0x4b438e,'secretAccessKey':_0x1917b7,'region':_0x911498});_0xb1cc30[_0x3d5e('0x6c')]({'Bucket':_0x89e78b},function(_0xd55596,_0x4e4dd6){if(_0xd55596){return _0x1ad2c5(_0xd55596);}else{return _0x2a6ef9(_0x4e4dd6);}});});}function uploadFile(_0xc1d03e,_0x10f1ba,_0x3db8c5,_0x381b92,_0x394c2e,_0x26d41d){return new Promise(function(_0xb06371,_0x4a106e){var _0x5aa72b=new AWS['S3']({'accessKeyId':_0x10f1ba,'secretAccessKey':_0xc1d03e,'region':_0x3db8c5});_0x5aa72b[_0x3d5e('0x6d')]({'Bucket':_0x381b92,'Key':_0x394c2e,'Body':_0x26d41d},function(_0x1a15fc,_0x462857){if(_0x1a15fc){return _0x4a106e(_0x1a15fc);}else{return _0xb06371(_0x462857);}});});}function startTranscribe(_0x3fd988,_0x3ffca4,_0x564314,_0xbb81e2,_0x1cc448,_0x2b093b){return new Promise(function(_0x1f8fea,_0x203bb4){var _0x2fdfbc=new AWS[(_0x3d5e('0x6e'))]({'accessKeyId':_0x3ffca4,'secretAccessKey':_0x3fd988,'region':_0x564314});_0x2fdfbc['startTranscriptionJob']({'TranscriptionJobName':_0xbb81e2,'LanguageCode':_0x1cc448,'Media':{'MediaFileUri':_0x2b093b}},function(_0xd46434,_0x331c3b){if(_0xd46434){return _0x203bb4(_0xd46434);}else{return _0x1f8fea(_0x331c3b);}});});}function transcribe(_0x17b26d,_0xfc7610,_0x55e7be,_0x5d5530,_0xde4ce4,_0x2d2b3f,_0x3fd4a8){return new Promise(function(_0x5d46db,_0x5dab5a){var _0x397826={};logger[_0x3d5e('0x64')](util[_0x3d5e('0x30')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x17b26d,_0xde4ce4));return uploadFile(_0xfc7610,_0x55e7be,_0x5d5530,_0xde4ce4,path[_0x3d5e('0x6f')](_0x2d2b3f),fs[_0x3d5e('0x70')](_0x2d2b3f))['then'](function(_0x3b09ce){logger[_0x3d5e('0x64')](util[_0x3d5e('0x30')](_0x3d5e('0x71'),_0x17b26d,_0xde4ce4,_0x3b09ce[_0x3d5e('0x72')]));_0x397826['bucket']=_0x3b09ce[_0x3d5e('0x73')];_0x397826[_0x3d5e('0x74')]=_0x3b09ce[_0x3d5e('0x72')];logger[_0x3d5e('0x64')](util['format'](_0x3d5e('0x75'),_0x17b26d));return startTranscribe(_0xfc7610,_0x55e7be,_0x5d5530,uuidv4(),_0x3fd4a8,_0x3b09ce[_0x3d5e('0x72')]);})['then'](function(_0x43189e){logger[_0x3d5e('0x64')](util[_0x3d5e('0x30')](_0x3d5e('0x76'),_0x17b26d,_0x43189e[_0x3d5e('0x77')]['TranscriptionJobName']));_0x397826[_0x3d5e('0x78')]=_0x43189e[_0x3d5e('0x77')]['TranscriptionJobName'];_0x397826[_0x3d5e('0x79')]=_0x43189e['TranscriptionJob'][_0x3d5e('0x7a')];return _0x5d46db(_0x397826);})[_0x3d5e('0x43')](function(_0x5fc76b){return _0x5dab5a(_0x5fc76b);});});}exports[_0x3d5e('0x7b')]=function(_0x27a4b9,_0x44f28d,_0x12a776){var _0xd757b6;var _0x5d9edf;var _0x236f67;var _0x102a6c=require(_0x3d5e('0x4d'));return db[_0x3d5e('0x2a')]['findOne']({'where':{'id':_0x27a4b9[_0x3d5e('0x45')]['id']}})['then'](function(_0x27ca4a){if(_0x27ca4a){var _0x2911f2=util['format'](_0x3d5e('0x50'),_0x27ca4a[_0x3d5e('0x4f')]);if(fs[_0x3d5e('0x51')](_0x2911f2)){cypher=!![];return _0x102a6c[_0x3d5e('0x52')](_0x2911f2,_0x27ca4a[_0x3d5e('0x4f')],config[_0x3d5e('0x53')][_0x3d5e('0x54')])[_0x3d5e('0x25')](function(){return _0x27ca4a;});}return _0x27ca4a;}})[_0x3d5e('0x25')](function(_0x27974e){if(!_0x27974e){throw new db[(_0x3d5e('0x55'))]['ValidationError'](_0x3d5e('0x7c'));}_0x5d9edf=_0x27974e;return db[_0x3d5e('0x7d')][_0x3d5e('0x7e')]({'where':{'id':0x1}});})[_0x3d5e('0x25')](handleEntityNotFound(_0x44f28d,null))[_0x3d5e('0x25')](function(_0x4dc6ee){if(_0x4dc6ee){_0xd757b6=_0x4dc6ee;if(!_0xd757b6[_0x3d5e('0x7f')]||!_0xd757b6[_0x3d5e('0x80')]||!_0xd757b6[_0x3d5e('0x81')]||!_0xd757b6[_0x3d5e('0x82')]||!_0xd757b6[_0x3d5e('0x83')]){throw new db[(_0x3d5e('0x55'))][(_0x3d5e('0x56'))](_0x3d5e('0x84'));}if(_0x27a4b9[_0x3d5e('0x4a')][_0x3d5e('0x85')]&&(!_0xd757b6[_0x3d5e('0x86')]||!_0xd757b6[_0x3d5e('0x87')]||!_0xd757b6[_0x3d5e('0x88')]||!_0xd757b6['language']||!_0xd757b6['bucket'])){throw new db[(_0x3d5e('0x55'))][(_0x3d5e('0x56'))](_0x3d5e('0x89'));}return db['CloudProvider'][_0x3d5e('0x7e')]({'where':{'id':_0xd757b6[_0x3d5e('0x80')]}});}})[_0x3d5e('0x25')](function(_0x291cd3){if(!_0x291cd3){throw new db[(_0x3d5e('0x55'))]['ValidationError'](_0x3d5e('0x8a'));}if(!_0x291cd3[_0x3d5e('0x8b')]||!_0x291cd3[_0x3d5e('0x8c')]){throw new db[(_0x3d5e('0x55'))]['ValidationError'](_0x3d5e('0x8d'));}_0x236f67=_0x291cd3;return getBucketslist(_0x236f67[_0x3d5e('0x8b')],_0x236f67[_0x3d5e('0x8c')],_0xd757b6[_0x3d5e('0x81')]);})[_0x3d5e('0x25')](function(_0x4f0853){if(_0x4f0853&&_0x4f0853[_0x3d5e('0x8e')]){var _0x6855af=_[_0x3d5e('0x47')](_0x4f0853[_0x3d5e('0x8e')],function(_0x185e19){return _0x185e19[_0x3d5e('0x8f')]===_0xd757b6['bucket'];});if(!_0x6855af){logger[_0x3d5e('0x64')](util[_0x3d5e('0x30')](_0x3d5e('0x90'),_0x27a4b9[_0x3d5e('0x45')]['id'],_0xd757b6[_0x3d5e('0x83')]));return createBucket(_0x236f67[_0x3d5e('0x8b')],_0x236f67[_0x3d5e('0x8c')],_0xd757b6['transcribeRegion'],_0xd757b6['bucket']);}logger[_0x3d5e('0x64')](util['format'](_0x3d5e('0x91'),_0x27a4b9[_0x3d5e('0x45')]['id'],_0xd757b6[_0x3d5e('0x83')]));return;}})['then'](function(_0x58ae74){if(_0x5d9edf[_0x3d5e('0x79')]===_0x3d5e('0x92')){return transcribe(_0x27a4b9[_0x3d5e('0x45')]['id'],_0x236f67[_0x3d5e('0x8b')],_0x236f67[_0x3d5e('0x8c')],_0xd757b6[_0x3d5e('0x81')],_0xd757b6['bucket'],_0x5d9edf[_0x3d5e('0x4f')],_0xd757b6[_0x3d5e('0x82')]);}else{logger[_0x3d5e('0x64')](util[_0x3d5e('0x30')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x27a4b9[_0x3d5e('0x45')]['id']));return{'transcribeStatus':_0x3d5e('0x93')};}})[_0x3d5e('0x25')](function(_0x57cf81){if(_0x57cf81){_0x57cf81[_0x3d5e('0x94')]=_0x27a4b9[_0x3d5e('0x4a')][_0x3d5e('0x85')];return _0x5d9edf[_0x3d5e('0x95')](_0x57cf81);}})['then'](respondWithResult(_0x44f28d,null))['catch'](handleError(_0x44f28d,null));};function writeFile(_0x33a755,_0x122a07){return new Promise(function(_0x2b350d,_0x7a9d3d){fs[_0x3d5e('0x96')](_0x122a07,_0x33a755,function(_0x1b75a6,_0x1ede84){if(_0x1b75a6){return _0x7a9d3d(_0x1b75a6);}else{return _0x2b350d(_0x1ede84);}});});}exports[_0x3d5e('0x97')]=function(_0x3b9019,_0x1d0f90,_0x38c5a0){return db['VoiceRecording']['findOne']({'where':{'id':_0x3b9019[_0x3d5e('0x45')]['id']}})[_0x3d5e('0x25')](handleEntityNotFound(_0x1d0f90))[_0x3d5e('0x25')](function(_0x28f454){if(_0x28f454&&_0x28f454[_0x3d5e('0x98')]){var _0x5e6f0e=_0x28f454[_0x3d5e('0x98')];var _0x253dd1=config['root']+_0x3d5e('0x99')+_0x28f454['id']+_0x3d5e('0x9a');if(fs[_0x3d5e('0x51')](_0x253dd1)){return _0x253dd1;}return writeFile(_0x5e6f0e,_0x253dd1)[_0x3d5e('0x25')](function(){return _0x253dd1;});}else{throw new db[(_0x3d5e('0x55'))]['ValidationError'](_0x3d5e('0x9b'));}})[_0x3d5e('0x25')](function(_0x43261e){return _0x1d0f90[_0x3d5e('0x4c')](_0x43261e);})[_0x3d5e('0x43')](handleError(_0x1d0f90));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 2ab42ca..2cb6265 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 _0xa86b=['exports','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa86b,0x147));var _0xba86=function(_0x4f4b9e,_0xafd458){_0x4f4b9e=_0x4f4b9e-0x0;var _0xc1a2bf=_0xa86b[_0x4f4b9e];return _0xc1a2bf;};'use strict';var _=require(_0xba86('0x0'));var util=require(_0xba86('0x1'));var logger=require(_0xba86('0x2'))(_0xba86('0x3'));var moment=require(_0xba86('0x4'));var BPromise=require(_0xba86('0x5'));var rp=require(_0xba86('0x6'));var fs=require('fs');var path=require(_0xba86('0x7'));var rimraf=require(_0xba86('0x8'));var config=require(_0xba86('0x9'));var attributes=require(_0xba86('0xa'));module[_0xba86('0xb')]=function(_0xcf1014,_0x5491cb){return _0xcf1014['define']('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xba86('0xc'),'fields':[_0xba86('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ce5=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voiceRecording.attributes','define','voice_recordings','uniqueid','lodash','util'];(function(_0x1b3335,_0x2b2f52){var _0x300d95=function(_0x2c2a38){while(--_0x2c2a38){_0x1b3335['push'](_0x1b3335['shift']());}};_0x300d95(++_0x2b2f52);}(_0x0ce5,0x142));var _0x50ce=function(_0x10a548,_0x26a534){_0x10a548=_0x10a548-0x0;var _0x2a8b3b=_0x0ce5[_0x10a548];return _0x2a8b3b;};'use strict';var _=require(_0x50ce('0x0'));var util=require(_0x50ce('0x1'));var logger=require(_0x50ce('0x2'))('api');var moment=require(_0x50ce('0x3'));var BPromise=require(_0x50ce('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x50ce('0x5'));var rimraf=require(_0x50ce('0x6'));var config=require(_0x50ce('0x7'));var attributes=require(_0x50ce('0x8'));module['exports']=function(_0x4d0b1b,_0x4701bc){return _0x4d0b1b[_0x50ce('0x9')]('VoiceRecording',attributes,{'tableName':_0x50ce('0xa'),'paranoid':![],'indexes':[{'name':_0x50ce('0xb'),'fields':[_0x50ce('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index ec7048c..cea931f 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(_0x237340,_0x39b15d){var _0x5542c8=function(_0xb6a05f){while(--_0xb6a05f){_0x237340['push'](_0x237340['shift']());}};_0x5542c8(++_0x39b15d);}(_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);});});}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(_0x348fec,_0x486f87){var _0x5914c7=function(_0xed01d5){while(--_0xed01d5){_0x348fec['push'](_0x348fec['shift']());}};_0x5914c7(++_0x486f87);}(_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 diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 2a51df3..3db1226 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 _0x1b18=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x5894be,_0x4aced5){var _0x367927=function(_0x2731b7){while(--_0x2731b7){_0x5894be['push'](_0x5894be['shift']());}};_0x367927(++_0x4aced5);}(_0x1b18,0x13a));var _0x81b1=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x1b18[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x81b1('0x0'));var util=require(_0x81b1('0x1'));var path=require(_0x81b1('0x2'));var timeout=require(_0x81b1('0x3'));var express=require(_0x81b1('0x4'));var router=express['Router']();var auth=require(_0x81b1('0x5'));var interaction=require(_0x81b1('0x6'));var config=require(_0x81b1('0x7'));var controller=require(_0x81b1('0x8'));router[_0x81b1('0x9')]('/',auth[_0x81b1('0xa')](),controller['index']);router[_0x81b1('0x9')](_0x81b1('0xb'),auth[_0x81b1('0xa')](),controller[_0x81b1('0xc')]);router[_0x81b1('0x9')]('/:id',auth[_0x81b1('0xa')](),controller[_0x81b1('0xd')]);router[_0x81b1('0xe')]('/',auth[_0x81b1('0xa')](),controller[_0x81b1('0xf')]);router[_0x81b1('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x81b1('0x11')]);router[_0x81b1('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x81b1('0x13')]);module[_0x81b1('0x14')]=router; \ No newline at end of file +var _0xb4aa=['get','index','/describe','isAuthenticated','describe','/:id','show','post','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb4aa,0xa4));var _0xab4a=function(_0x19de9c,_0x278cc3){_0x19de9c=_0x19de9c-0x0;var _0x4d5c74=_0xb4aa[_0x19de9c];return _0x4d5c74;};'use strict';var multer=require(_0xab4a('0x0'));var util=require('util');var path=require(_0xab4a('0x1'));var timeout=require(_0xab4a('0x2'));var express=require(_0xab4a('0x3'));var router=express[_0xab4a('0x4')]();var auth=require(_0xab4a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xab4a('0x6'));var controller=require('./voiceTransferReport.controller');router[_0xab4a('0x7')]('/',auth['isAuthenticated'](),controller[_0xab4a('0x8')]);router[_0xab4a('0x7')](_0xab4a('0x9'),auth[_0xab4a('0xa')](),controller[_0xab4a('0xb')]);router[_0xab4a('0x7')](_0xab4a('0xc'),auth[_0xab4a('0xa')](),controller[_0xab4a('0xd')]);router[_0xab4a('0xe')]('/',auth[_0xab4a('0xa')](),controller['create']);router[_0xab4a('0xf')](_0xab4a('0xc'),auth[_0xab4a('0xa')](),controller[_0xab4a('0x10')]);router[_0xab4a('0x11')](_0xab4a('0xc'),auth[_0xab4a('0xa')](),controller['destroy']);module[_0xab4a('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 979a454..f7fa58c 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 _0x5679=['sequelize','moment','ENUM','attended','STRING','Yes'];(function(_0x5e9d75,_0x15c37b){var _0x316f43=function(_0x35bc25){while(--_0x35bc25){_0x5e9d75['push'](_0x5e9d75['shift']());}};_0x316f43(++_0x15c37b);}(_0x5679,0x15c));var _0x9567=function(_0x2217d8,_0x2df132){_0x2217d8=_0x2217d8-0x0;var _0x1a86e2=_0x5679[_0x2217d8];return _0x1a86e2;};'use strict';var Sequelize=require(_0x9567('0x0'));var moment=require(_0x9567('0x1'));module['exports']={'type':{'type':Sequelize[_0x9567('0x2')]('blind',_0x9567('0x3'))},'result':{'type':Sequelize[_0x9567('0x4')]},'transfererchannel':{'type':Sequelize[_0x9567('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x9567('0x4')]},'transferercalleridname':{'type':Sequelize[_0x9567('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x9567('0x4')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x9567('0x4')]},'transferercontext':{'type':Sequelize[_0x9567('0x4')]},'transfererexten':{'type':Sequelize[_0x9567('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x9567('0x4')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x9567('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x9567('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x9567('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x9567('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x9567('0x4')]},'transfereeexten':{'type':Sequelize[_0x9567('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x9567('0x4')]},'isexternal':{'type':Sequelize[_0x9567('0x2')](_0x9567('0x5'),'No')},'context':{'type':Sequelize[_0x9567('0x4')]},'extension':{'type':Sequelize[_0x9567('0x4')]}}; \ No newline at end of file +var _0xb6d5=['blind','STRING','Yes','sequelize','moment','exports','ENUM'];(function(_0x274e0e,_0x3aace4){var _0x4ca356=function(_0x59e7a3){while(--_0x59e7a3){_0x274e0e['push'](_0x274e0e['shift']());}};_0x4ca356(++_0x3aace4);}(_0xb6d5,0x6c));var _0x5b6d=function(_0xbb14db,_0x3ee8c6){_0xbb14db=_0xbb14db-0x0;var _0x36bed7=_0xb6d5[_0xbb14db];return _0x36bed7;};'use strict';var Sequelize=require(_0x5b6d('0x0'));var moment=require(_0x5b6d('0x1'));module[_0x5b6d('0x2')]={'type':{'type':Sequelize[_0x5b6d('0x3')](_0x5b6d('0x4'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x5b6d('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x5b6d('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x5b6d('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x5b6d('0x5')]},'transfererexten':{'type':Sequelize[_0x5b6d('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x5b6d('0x5')]},'transfereechannel':{'type':Sequelize[_0x5b6d('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x5b6d('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x5b6d('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x5b6d('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x5b6d('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x5b6d('0x5')]},'transfereecontext':{'type':Sequelize[_0x5b6d('0x5')]},'transfereeexten':{'type':Sequelize[_0x5b6d('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x5b6d('0x5')]},'isexternal':{'type':Sequelize[_0x5b6d('0x3')](_0x5b6d('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x5b6d('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index e6470a4..7270810 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 _0x1952=['fast-json-patch','moment','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','map','VIRTUAL','merge','options','VoiceTransferReport','include','rows','catch','show','params','keys','includeAll','find','create','body','describe','eml-format','rimraf'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1952,0x92));var _0x2195=function(_0x2d2b9b,_0x487c93){_0x2d2b9b=_0x2d2b9b-0x0;var _0x4c3155=_0x1952[_0x2d2b9b];return _0x4c3155;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2195('0x0'));var rimraf=require(_0x2195('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2195('0x2'));var rp=require('request-promise');var moment=require(_0x2195('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2195('0x4'));var path=require(_0x2195('0x5'));var sox=require('sox');var csv=require(_0x2195('0x6'));var ejs=require(_0x2195('0x7'));var fs=require('fs');var _=require(_0x2195('0x8'));var squel=require(_0x2195('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2195('0xa'));var toCsv=require(_0x2195('0x6'));var querystring=require(_0x2195('0xb'));var Papa=require(_0x2195('0xc'));var Redis=require(_0x2195('0xd'));var authService=require(_0x2195('0xe'));var qs=require(_0x2195('0xf'));var as=require(_0x2195('0x10'));var hardwareService=require(_0x2195('0x11'));var logger=require(_0x2195('0x12'))(_0x2195('0x13'));var utils=require(_0x2195('0x14'));var config=require(_0x2195('0x15'));var licenseUtil=require(_0x2195('0x16'));var db=require(_0x2195('0x17'))['db'];function respondWithStatusCode(_0x231da3,_0xf78cd){_0xf78cd=_0xf78cd||0xcc;return function(_0x2d6800){if(_0x2d6800){return _0x231da3['sendStatus'](_0xf78cd);}return _0x231da3[_0x2195('0x18')](_0xf78cd)[_0x2195('0x19')]();};}function respondWithResult(_0x50a1eb,_0x5b039f){_0x5b039f=_0x5b039f||0xc8;return function(_0x5cdfd1){if(_0x5cdfd1){return _0x50a1eb[_0x2195('0x18')](_0x5b039f)[_0x2195('0x1a')](_0x5cdfd1);}};}function respondWithFilteredResult(_0x2b10b5,_0x19ca5d){return function(_0x27c97c){if(_0x27c97c){var _0x4f0030=_0x27c97c[_0x2195('0x1b')],_0x5c3e0c=_0x19ca5d[_0x2195('0x1c')],_0x2fd921=_0x19ca5d[_0x2195('0x1c')]+_0x19ca5d[_0x2195('0x1d')],_0x41ba82;if(_0x2fd921>=_0x4f0030){_0x2fd921=_0x4f0030;_0x41ba82=0xc8;}else{_0x41ba82=0xce;}_0x2b10b5[_0x2195('0x18')](_0x41ba82);return _0x2b10b5[_0x2195('0x1e')](_0x2195('0x1f'),_0x5c3e0c+'-'+_0x2fd921+'/'+_0x4f0030)['json'](_0x27c97c);}return null;};}function patchUpdates(_0x5be73b){return function(_0x5d94af){try{jsonpatch[_0x2195('0x20')](_0x5d94af,_0x5be73b,!![]);}catch(_0x411896){return BPromise[_0x2195('0x21')](_0x411896);}return _0x5d94af[_0x2195('0x22')]();};}function saveUpdates(_0x1e0c8d,_0xbf84cf){return function(_0x57d996){if(_0x57d996){return _0x57d996[_0x2195('0x23')](_0x1e0c8d)[_0x2195('0x24')](function(_0x3731db){return _0x3731db;});}return null;};}function removeEntity(_0x52e678,_0x3e24a6){return function(_0x257291){if(_0x257291){return _0x257291[_0x2195('0x25')]()[_0x2195('0x24')](function(){_0x52e678[_0x2195('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21966b,_0x5145d6){return function(_0x2e3fa3){if(!_0x2e3fa3){_0x21966b[_0x2195('0x26')](0x194);}return _0x2e3fa3;};}function handleError(_0x2f48a2,_0x3b16a4){_0x3b16a4=_0x3b16a4||0x1f4;return function(_0x22faec){logger[_0x2195('0x27')](_0x22faec[_0x2195('0x28')]);if(_0x22faec[_0x2195('0x29')]){delete _0x22faec[_0x2195('0x29')];}_0x2f48a2[_0x2195('0x18')](_0x3b16a4)['send'](_0x22faec);};}exports[_0x2195('0x2a')]=function(_0x4657d1,_0x4b06f5){var _0x30313a={},_0xdb0d18={},_0x24bc76={'count':0x0,'rows':[]};var _0x417bc8=_['map'](db['VoiceTransferReport'][_0x2195('0x2b')],function(_0x4a6c94){return{'name':_0x4a6c94[_0x2195('0x2c')],'type':_0x4a6c94[_0x2195('0x2d')]['key']};});_0xdb0d18[_0x2195('0x2e')]=_['map'](_0x417bc8,_0x2195('0x29'));_0xdb0d18[_0x2195('0x2f')]=_['keys'](_0x4657d1[_0x2195('0x2f')]);_0xdb0d18[_0x2195('0x30')]=_[_0x2195('0x31')](_0xdb0d18['model'],_0xdb0d18[_0x2195('0x2f')]);_0x30313a[_0x2195('0x32')]=_[_0x2195('0x31')](_0xdb0d18[_0x2195('0x2e')],qs[_0x2195('0x33')](_0x4657d1[_0x2195('0x2f')][_0x2195('0x33')]));_0x30313a[_0x2195('0x32')]=_0x30313a['attributes'][_0x2195('0x34')]?_0x30313a['attributes']:_0xdb0d18['model'];if(!_0x4657d1[_0x2195('0x2f')][_0x2195('0x35')](_0x2195('0x36'))){_0x30313a[_0x2195('0x1d')]=qs[_0x2195('0x1d')](_0x4657d1[_0x2195('0x2f')][_0x2195('0x1d')]);_0x30313a[_0x2195('0x1c')]=qs[_0x2195('0x1c')](_0x4657d1[_0x2195('0x2f')]['offset']);}_0x30313a['order']=qs['sort'](_0x4657d1['query']['sort']);_0x30313a[_0x2195('0x37')]=qs[_0x2195('0x30')](_[_0x2195('0x38')](_0x4657d1['query'],_0xdb0d18[_0x2195('0x30')]),_0x417bc8);if(_0x4657d1['query'][_0x2195('0x39')]){_0x30313a[_0x2195('0x37')]=_['merge'](_0x30313a[_0x2195('0x37')],{'$or':_[_0x2195('0x3a')](_0x417bc8,function(_0x5eb5d9){if(_0x5eb5d9[_0x2195('0x2d')]!==_0x2195('0x3b')){var _0x428b37={};_0x428b37[_0x5eb5d9[_0x2195('0x29')]]={'$like':'%'+_0x4657d1['query'][_0x2195('0x39')]+'%'};return _0x428b37;}})});}_0x30313a=_[_0x2195('0x3c')]({},_0x30313a,_0x4657d1[_0x2195('0x3d')]);var _0x1c5e9d={'where':_0x30313a[_0x2195('0x37')]};return db[_0x2195('0x3e')]['count'](_0x1c5e9d)[_0x2195('0x24')](function(_0x4eb1d5){_0x24bc76['count']=_0x4eb1d5;if(_0x4657d1['query']['includeAll']){_0x30313a[_0x2195('0x3f')]=[{'all':!![]}];}return db[_0x2195('0x3e')]['findAll'](_0x30313a);})[_0x2195('0x24')](function(_0x516b5c){_0x24bc76[_0x2195('0x40')]=_0x516b5c;return _0x24bc76;})[_0x2195('0x24')](respondWithFilteredResult(_0x4b06f5,_0x30313a))[_0x2195('0x41')](handleError(_0x4b06f5,null));};exports[_0x2195('0x42')]=function(_0x9bd9bc,_0x306107){var _0x112bba={'raw':!![],'where':{'id':_0x9bd9bc[_0x2195('0x43')]['id']}},_0x2ad53f={};_0x2ad53f['model']=_[_0x2195('0x44')](db[_0x2195('0x3e')][_0x2195('0x2b')]);_0x2ad53f[_0x2195('0x2f')]=_[_0x2195('0x44')](_0x9bd9bc[_0x2195('0x2f')]);_0x2ad53f[_0x2195('0x30')]=_[_0x2195('0x31')](_0x2ad53f['model'],_0x2ad53f[_0x2195('0x2f')]);_0x112bba[_0x2195('0x32')]=_['intersection'](_0x2ad53f[_0x2195('0x2e')],qs[_0x2195('0x33')](_0x9bd9bc[_0x2195('0x2f')][_0x2195('0x33')]));_0x112bba['attributes']=_0x112bba[_0x2195('0x32')][_0x2195('0x34')]?_0x112bba[_0x2195('0x32')]:_0x2ad53f[_0x2195('0x2e')];if(_0x9bd9bc[_0x2195('0x2f')][_0x2195('0x45')]){_0x112bba[_0x2195('0x3f')]=[{'all':!![]}];}_0x112bba=_[_0x2195('0x3c')]({},_0x112bba,_0x9bd9bc[_0x2195('0x3d')]);return db[_0x2195('0x3e')][_0x2195('0x46')](_0x112bba)['then'](handleEntityNotFound(_0x306107,null))['then'](respondWithResult(_0x306107,null))['catch'](handleError(_0x306107,null));};exports[_0x2195('0x47')]=function(_0xd5dcd,_0x598297){return db[_0x2195('0x3e')]['create'](_0xd5dcd[_0x2195('0x48')],{})[_0x2195('0x24')](respondWithResult(_0x598297,0xc9))[_0x2195('0x41')](handleError(_0x598297,null));};exports[_0x2195('0x23')]=function(_0x574a97,_0x138110){if(_0x574a97[_0x2195('0x48')]['id']){delete _0x574a97['body']['id'];}return db['VoiceTransferReport'][_0x2195('0x46')]({'where':{'id':_0x574a97[_0x2195('0x43')]['id']}})[_0x2195('0x24')](handleEntityNotFound(_0x138110,null))['then'](saveUpdates(_0x574a97[_0x2195('0x48')],null))[_0x2195('0x24')](respondWithResult(_0x138110,null))[_0x2195('0x41')](handleError(_0x138110,null));};exports[_0x2195('0x25')]=function(_0x26e112,_0x46e2ad){return db['VoiceTransferReport']['find']({'where':{'id':_0x26e112[_0x2195('0x43')]['id']}})[_0x2195('0x24')](handleEntityNotFound(_0x46e2ad,null))[_0x2195('0x24')](removeEntity(_0x46e2ad,null))[_0x2195('0x41')](handleError(_0x46e2ad,null));};exports['describe']=function(_0x5aba0a,_0x1ec74a){return db['VoiceTransferReport'][_0x2195('0x49')]()[_0x2195('0x24')](respondWithResult(_0x1ec74a,null))[_0x2195('0x41')](handleError(_0x1ec74a,null));}; \ No newline at end of file +var _0xfcbe=['fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','params','model','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','ejs','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes'];(function(_0x299137,_0x251783){var _0x1e64a2=function(_0x3023dd){while(--_0x3023dd){_0x299137['push'](_0x299137['shift']());}};_0x1e64a2(++_0x251783);}(_0xfcbe,0x1b1));var _0xefcb=function(_0x56f4b2,_0x88ac9f){_0x56f4b2=_0x56f4b2-0x0;var _0x2a5025=_0xfcbe[_0x56f4b2];return _0x2a5025;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xefcb('0x0'));var rimraf=require(_0xefcb('0x1'));var zipdir=require(_0xefcb('0x2'));var jsonpatch=require(_0xefcb('0x3'));var rp=require(_0xefcb('0x4'));var moment=require(_0xefcb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xefcb('0x6'));var util=require(_0xefcb('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xefcb('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xefcb('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xefcb('0xa'));var toCsv=require(_0xefcb('0xb'));var querystring=require(_0xefcb('0xc'));var Papa=require('papaparse');var Redis=require(_0xefcb('0xd'));var authService=require(_0xefcb('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xefcb('0xf'));var logger=require(_0xefcb('0x10'))(_0xefcb('0x11'));var utils=require(_0xefcb('0x12'));var config=require(_0xefcb('0x13'));var licenseUtil=require(_0xefcb('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x92bb0c,_0x163012){_0x163012=_0x163012||0xcc;return function(_0x2c77dd){if(_0x2c77dd){return _0x92bb0c[_0xefcb('0x15')](_0x163012);}return _0x92bb0c[_0xefcb('0x16')](_0x163012)['end']();};}function respondWithResult(_0x585355,_0x24ac43){_0x24ac43=_0x24ac43||0xc8;return function(_0xd13e37){if(_0xd13e37){return _0x585355['status'](_0x24ac43)[_0xefcb('0x17')](_0xd13e37);}};}function respondWithFilteredResult(_0x565c13,_0x3946ef){return function(_0x565fae){if(_0x565fae){var _0x172816=_0x565fae[_0xefcb('0x18')],_0x46a22a=_0x3946ef[_0xefcb('0x19')],_0x440e20=_0x3946ef['offset']+_0x3946ef[_0xefcb('0x1a')],_0x187f0f;if(_0x440e20>=_0x172816){_0x440e20=_0x172816;_0x187f0f=0xc8;}else{_0x187f0f=0xce;}_0x565c13[_0xefcb('0x16')](_0x187f0f);return _0x565c13[_0xefcb('0x1b')](_0xefcb('0x1c'),_0x46a22a+'-'+_0x440e20+'/'+_0x172816)[_0xefcb('0x17')](_0x565fae);}return null;};}function patchUpdates(_0x2baf5e){return function(_0x3a3ffe){try{jsonpatch['apply'](_0x3a3ffe,_0x2baf5e,!![]);}catch(_0x39ab04){return BPromise[_0xefcb('0x1d')](_0x39ab04);}return _0x3a3ffe['save']();};}function saveUpdates(_0x12a93f,_0x51c2e){return function(_0xea53e9){if(_0xea53e9){return _0xea53e9[_0xefcb('0x1e')](_0x12a93f)[_0xefcb('0x1f')](function(_0x4e13c0){return _0x4e13c0;});}return null;};}function removeEntity(_0x10c662,_0x33641c){return function(_0x2ab79d){if(_0x2ab79d){return _0x2ab79d[_0xefcb('0x20')]()[_0xefcb('0x1f')](function(){_0x10c662[_0xefcb('0x16')](0xcc)[_0xefcb('0x21')]();});}};}function handleEntityNotFound(_0x2a74f6,_0x52e7dd){return function(_0x5844e2){if(!_0x5844e2){_0x2a74f6['sendStatus'](0x194);}return _0x5844e2;};}function handleError(_0x104212,_0x38a583){_0x38a583=_0x38a583||0x1f4;return function(_0x457ff6){logger[_0xefcb('0x22')](_0x457ff6[_0xefcb('0x23')]);if(_0x457ff6[_0xefcb('0x24')]){delete _0x457ff6[_0xefcb('0x24')];}_0x104212['status'](_0x38a583)[_0xefcb('0x25')](_0x457ff6);};}exports[_0xefcb('0x26')]=function(_0xa42610,_0x11286f){var _0x18f4ef={},_0x18f3be={},_0x16757b={'count':0x0,'rows':[]};var _0x36521c=_[_0xefcb('0x27')](db[_0xefcb('0x28')][_0xefcb('0x29')],function(_0x160782){return{'name':_0x160782[_0xefcb('0x2a')],'type':_0x160782[_0xefcb('0x2b')][_0xefcb('0x2c')]};});_0x18f3be['model']=_[_0xefcb('0x27')](_0x36521c,_0xefcb('0x24'));_0x18f3be[_0xefcb('0x2d')]=_[_0xefcb('0x2e')](_0xa42610[_0xefcb('0x2d')]);_0x18f3be[_0xefcb('0x2f')]=_[_0xefcb('0x30')](_0x18f3be['model'],_0x18f3be['query']);_0x18f4ef[_0xefcb('0x31')]=_[_0xefcb('0x30')](_0x18f3be['model'],qs[_0xefcb('0x32')](_0xa42610[_0xefcb('0x2d')][_0xefcb('0x32')]));_0x18f4ef['attributes']=_0x18f4ef[_0xefcb('0x31')][_0xefcb('0x33')]?_0x18f4ef[_0xefcb('0x31')]:_0x18f3be['model'];if(!_0xa42610['query']['hasOwnProperty']('nolimit')){_0x18f4ef[_0xefcb('0x1a')]=qs[_0xefcb('0x1a')](_0xa42610[_0xefcb('0x2d')][_0xefcb('0x1a')]);_0x18f4ef[_0xefcb('0x19')]=qs[_0xefcb('0x19')](_0xa42610[_0xefcb('0x2d')][_0xefcb('0x19')]);}_0x18f4ef[_0xefcb('0x34')]=qs[_0xefcb('0x35')](_0xa42610[_0xefcb('0x2d')][_0xefcb('0x35')]);_0x18f4ef[_0xefcb('0x36')]=qs[_0xefcb('0x2f')](_[_0xefcb('0x37')](_0xa42610[_0xefcb('0x2d')],_0x18f3be['filters']),_0x36521c);if(_0xa42610[_0xefcb('0x2d')][_0xefcb('0x38')]){_0x18f4ef[_0xefcb('0x36')]=_[_0xefcb('0x39')](_0x18f4ef['where'],{'$or':_[_0xefcb('0x27')](_0x36521c,function(_0x5e5b5a){if(_0x5e5b5a[_0xefcb('0x2b')]!==_0xefcb('0x3a')){var _0x31bf8b={};_0x31bf8b[_0x5e5b5a[_0xefcb('0x24')]]={'$like':'%'+_0xa42610['query'][_0xefcb('0x38')]+'%'};return _0x31bf8b;}})});}_0x18f4ef=_[_0xefcb('0x39')]({},_0x18f4ef,_0xa42610[_0xefcb('0x3b')]);var _0x5ba923={'where':_0x18f4ef[_0xefcb('0x36')]};return db[_0xefcb('0x28')][_0xefcb('0x18')](_0x5ba923)['then'](function(_0x4d9550){_0x16757b[_0xefcb('0x18')]=_0x4d9550;if(_0xa42610['query']['includeAll']){_0x18f4ef[_0xefcb('0x3c')]=[{'all':!![]}];}return db[_0xefcb('0x28')][_0xefcb('0x3d')](_0x18f4ef);})['then'](function(_0x4d4f06){_0x16757b['rows']=_0x4d4f06;return _0x16757b;})[_0xefcb('0x1f')](respondWithFilteredResult(_0x11286f,_0x18f4ef))[_0xefcb('0x3e')](handleError(_0x11286f,null));};exports['show']=function(_0x464bd7,_0x5ae48d){var _0x36e545={'raw':!![],'where':{'id':_0x464bd7[_0xefcb('0x3f')]['id']}},_0x2a9d91={};_0x2a9d91[_0xefcb('0x40')]=_[_0xefcb('0x2e')](db['VoiceTransferReport']['rawAttributes']);_0x2a9d91[_0xefcb('0x2d')]=_[_0xefcb('0x2e')](_0x464bd7['query']);_0x2a9d91['filters']=_['intersection'](_0x2a9d91[_0xefcb('0x40')],_0x2a9d91[_0xefcb('0x2d')]);_0x36e545['attributes']=_[_0xefcb('0x30')](_0x2a9d91['model'],qs[_0xefcb('0x32')](_0x464bd7[_0xefcb('0x2d')][_0xefcb('0x32')]));_0x36e545[_0xefcb('0x31')]=_0x36e545[_0xefcb('0x31')]['length']?_0x36e545[_0xefcb('0x31')]:_0x2a9d91['model'];if(_0x464bd7[_0xefcb('0x2d')]['includeAll']){_0x36e545[_0xefcb('0x3c')]=[{'all':!![]}];}_0x36e545=_['merge']({},_0x36e545,_0x464bd7[_0xefcb('0x3b')]);return db['VoiceTransferReport'][_0xefcb('0x41')](_0x36e545)[_0xefcb('0x1f')](handleEntityNotFound(_0x5ae48d,null))[_0xefcb('0x1f')](respondWithResult(_0x5ae48d,null))[_0xefcb('0x3e')](handleError(_0x5ae48d,null));};exports[_0xefcb('0x42')]=function(_0x443a93,_0x4b0735){return db[_0xefcb('0x28')]['create'](_0x443a93[_0xefcb('0x43')],{})[_0xefcb('0x1f')](respondWithResult(_0x4b0735,0xc9))[_0xefcb('0x3e')](handleError(_0x4b0735,null));};exports[_0xefcb('0x1e')]=function(_0x3a313f,_0xc3db22){if(_0x3a313f['body']['id']){delete _0x3a313f[_0xefcb('0x43')]['id'];}return db[_0xefcb('0x28')][_0xefcb('0x41')]({'where':{'id':_0x3a313f['params']['id']}})['then'](handleEntityNotFound(_0xc3db22,null))[_0xefcb('0x1f')](saveUpdates(_0x3a313f[_0xefcb('0x43')],null))['then'](respondWithResult(_0xc3db22,null))[_0xefcb('0x3e')](handleError(_0xc3db22,null));};exports[_0xefcb('0x20')]=function(_0x1c3c7d,_0xa27108){return db[_0xefcb('0x28')][_0xefcb('0x41')]({'where':{'id':_0x1c3c7d['params']['id']}})[_0xefcb('0x1f')](handleEntityNotFound(_0xa27108,null))[_0xefcb('0x1f')](removeEntity(_0xa27108,null))[_0xefcb('0x3e')](handleError(_0xa27108,null));};exports[_0xefcb('0x44')]=function(_0x2743ba,_0x12acc6){return db[_0xefcb('0x28')]['describe']()[_0xefcb('0x1f')](respondWithResult(_0x12acc6,null))[_0xefcb('0x3e')](handleError(_0x12acc6,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 12ac2aa..5f9f727 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 _0x0626=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define','report_call_transfer'];(function(_0x3d65de,_0x231136){var _0x1c40b3=function(_0x3bbddc){while(--_0x3bbddc){_0x3d65de['push'](_0x3d65de['shift']());}};_0x1c40b3(++_0x231136);}(_0x0626,0x1ef));var _0x6062=function(_0x28ee95,_0x2377d3){_0x28ee95=_0x28ee95-0x0;var _0x235143=_0x0626[_0x28ee95];return _0x235143;};'use strict';var _=require(_0x6062('0x0'));var util=require(_0x6062('0x1'));var logger=require(_0x6062('0x2'))(_0x6062('0x3'));var moment=require(_0x6062('0x4'));var BPromise=require(_0x6062('0x5'));var rp=require(_0x6062('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6062('0x7'));var attributes=require('./voiceTransferReport.attributes');module[_0x6062('0x8')]=function(_0x354f34,_0x7c3d72){return _0x354f34[_0x6062('0x9')]('VoiceTransferReport',attributes,{'tableName':_0x6062('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b92=['../../config/logger','api','moment','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','util'];(function(_0x196d66,_0xe0afd0){var _0x2124fc=function(_0x205151){while(--_0x205151){_0x196d66['push'](_0x196d66['shift']());}};_0x2124fc(++_0xe0afd0);}(_0x5b92,0x1cd));var _0x25b9=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x5b92[_0x5783f4];return _0x28e380;};'use strict';var _=require('lodash');var util=require(_0x25b9('0x0'));var logger=require(_0x25b9('0x1'))(_0x25b9('0x2'));var moment=require(_0x25b9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x25b9('0x4'));var config=require(_0x25b9('0x5'));var attributes=require(_0x25b9('0x6'));module[_0x25b9('0x7')]=function(_0x549092,_0x159231){return _0x549092[_0x25b9('0x8')](_0x25b9('0x9'),attributes,{'tableName':_0x25b9('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 c0ec25e..27536b7 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 _0x2fc2=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','CreateVoiceTransferReport','create','options','raw','then','catch','lodash','bluebird'];(function(_0x10c3f1,_0x563147){var _0x1c9653=function(_0x5d026e){while(--_0x5d026e){_0x10c3f1['push'](_0x10c3f1['shift']());}};_0x1c9653(++_0x563147);}(_0x2fc2,0x193));var _0x22fc=function(_0x46e0eb,_0x4dd609){_0x46e0eb=_0x46e0eb-0x0;var _0x52687a=_0x2fc2[_0x46e0eb];return _0x52687a;};'use strict';var _=require(_0x22fc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x22fc('0x1'));var rs=require(_0x22fc('0x2'));var fs=require('fs');var Redis=require(_0x22fc('0x3'));var db=require(_0x22fc('0x4'))['db'];var utils=require(_0x22fc('0x5'));var logger=require(_0x22fc('0x6'))(_0x22fc('0x7'));var config=require(_0x22fc('0x8'));var jayson=require(_0x22fc('0x9'));var client=jayson[_0x22fc('0xa')][_0x22fc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39b7f6,_0x463c55,_0x1140d5){return new BPromise(function(_0x34f6b6,_0x31b327){return client[_0x22fc('0xc')](_0x39b7f6,_0x1140d5)['then'](function(_0x1234bf){logger[_0x22fc('0xd')](_0x22fc('0xe'),_0x463c55,_0x22fc('0xf'));logger[_0x22fc('0x10')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x463c55,_0x22fc('0xf'),JSON[_0x22fc('0x11')](_0x1234bf));if(_0x1234bf['error']){if(_0x1234bf[_0x22fc('0x12')][_0x22fc('0x13')]===0x1f4){logger['error'](_0x22fc('0xe'),_0x463c55,_0x1234bf[_0x22fc('0x12')][_0x22fc('0x14')]);return _0x31b327(_0x1234bf['error'][_0x22fc('0x14')]);}logger[_0x22fc('0x12')](_0x22fc('0xe'),_0x463c55,_0x1234bf['error'][_0x22fc('0x14')]);return _0x34f6b6(_0x1234bf[_0x22fc('0x12')][_0x22fc('0x14')]);}else{logger[_0x22fc('0xd')](_0x22fc('0xe'),_0x463c55,_0x22fc('0xf'));_0x34f6b6(_0x1234bf['result'][_0x22fc('0x14')]);}})['catch'](function(_0x46c106){logger[_0x22fc('0x12')](_0x22fc('0xe'),_0x463c55,_0x46c106);_0x31b327(_0x46c106);});});}exports[_0x22fc('0x15')]=function(_0x4b2872){var _0xb11a8f=this;return new Promise(function(_0x5dd580,_0x508e7e){return db['VoiceTransferReport'][_0x22fc('0x16')](_0x4b2872['body'],{'raw':_0x4b2872[_0x22fc('0x17')]?_0x4b2872[_0x22fc('0x17')][_0x22fc('0x18')]===undefined?!![]:![]:!![]})[_0x22fc('0x19')](function(_0x52fe71){logger[_0x22fc('0xd')]('CreateVoiceTransferReport',_0x4b2872);logger[_0x22fc('0x10')](_0x22fc('0x15'),_0x4b2872,JSON[_0x22fc('0x11')](_0x52fe71));_0x5dd580(_0x52fe71);})[_0x22fc('0x1a')](function(_0x3448f6){logger['error'](_0x22fc('0x15'),_0x3448f6[_0x22fc('0x14')],_0x4b2872);_0x508e7e(_0xb11a8f[_0x22fc('0x12')](0x1f4,_0x3448f6['message']));});});}; \ No newline at end of file +var _0xfa68=['raw','then','CreateVoiceTransferReport','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','request\x20sent','debug','stringify','error','code','message','VoiceTransferReport,\x20%s,\x20%s','result','create','options'];(function(_0x23d609,_0x188d22){var _0x48fa5d=function(_0x5f01d9){while(--_0x5f01d9){_0x23d609['push'](_0x23d609['shift']());}};_0x48fa5d(++_0x188d22);}(_0xfa68,0x86));var _0x8fa6=function(_0x130ddb,_0x409da1){_0x130ddb=_0x130ddb-0x0;var _0x359e29=_0xfa68[_0x130ddb];return _0x359e29;};'use strict';var _=require(_0x8fa6('0x0'));var util=require(_0x8fa6('0x1'));var moment=require(_0x8fa6('0x2'));var BPromise=require('bluebird');var rs=require(_0x8fa6('0x3'));var fs=require('fs');var Redis=require(_0x8fa6('0x4'));var db=require(_0x8fa6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8fa6('0x6'))(_0x8fa6('0x7'));var config=require(_0x8fa6('0x8'));var jayson=require(_0x8fa6('0x9'));var client=jayson[_0x8fa6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ab645,_0x42b044,_0x523f62){return new BPromise(function(_0x1cdf94,_0x269bda){return client['request'](_0x1ab645,_0x523f62)['then'](function(_0x1f3a90){logger[_0x8fa6('0xb')]('VoiceTransferReport,\x20%s,\x20%s',_0x42b044,_0x8fa6('0xc'));logger[_0x8fa6('0xd')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x42b044,'request\x20sent',JSON[_0x8fa6('0xe')](_0x1f3a90));if(_0x1f3a90[_0x8fa6('0xf')]){if(_0x1f3a90['error'][_0x8fa6('0x10')]===0x1f4){logger[_0x8fa6('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x42b044,_0x1f3a90[_0x8fa6('0xf')][_0x8fa6('0x11')]);return _0x269bda(_0x1f3a90['error'][_0x8fa6('0x11')]);}logger[_0x8fa6('0xf')](_0x8fa6('0x12'),_0x42b044,_0x1f3a90[_0x8fa6('0xf')][_0x8fa6('0x11')]);return _0x1cdf94(_0x1f3a90['error']['message']);}else{logger[_0x8fa6('0xb')]('VoiceTransferReport,\x20%s,\x20%s',_0x42b044,_0x8fa6('0xc'));_0x1cdf94(_0x1f3a90[_0x8fa6('0x13')][_0x8fa6('0x11')]);}})['catch'](function(_0x210bfe){logger[_0x8fa6('0xf')](_0x8fa6('0x12'),_0x42b044,_0x210bfe);_0x269bda(_0x210bfe);});});}exports['CreateVoiceTransferReport']=function(_0x329f97){var _0x2f7baf=this;return new Promise(function(_0x8de44e,_0x2dffbe){return db['VoiceTransferReport'][_0x8fa6('0x14')](_0x329f97['body'],{'raw':_0x329f97[_0x8fa6('0x15')]?_0x329f97[_0x8fa6('0x15')][_0x8fa6('0x16')]===undefined?!![]:![]:!![]})[_0x8fa6('0x17')](function(_0x50e633){logger[_0x8fa6('0xb')](_0x8fa6('0x18'),_0x329f97);logger['debug'](_0x8fa6('0x18'),_0x329f97,JSON[_0x8fa6('0xe')](_0x50e633));_0x8de44e(_0x50e633);})[_0x8fa6('0x19')](function(_0x50f8d2){logger[_0x8fa6('0xf')](_0x8fa6('0x18'),_0x50f8d2[_0x8fa6('0x11')],_0x329f97);_0x2dffbe(_0x2f7baf['error'](0x1f4,_0x50f8d2['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 0c5d233..6e194b0 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 _0x1da1=['unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','canUpdate','originate','isAuthenticated','hangup','/hold','hold','/unhold'];(function(_0x4fd109,_0x33c503){var _0x30f0a6=function(_0xc11c0d){while(--_0xc11c0d){_0x4fd109['push'](_0x4fd109['shift']());}};_0x30f0a6(++_0x33c503);}(_0x1da1,0x1a4));var _0x11da=function(_0x299e45,_0x2197bf){_0x299e45=_0x299e45-0x0;var _0x2ef4dd=_0x1da1[_0x299e45];return _0x2ef4dd;};'use strict';var express=require(_0x11da('0x0'));var router=express[_0x11da('0x1')]();var auth=require(_0x11da('0x2'));var controller=require(_0x11da('0x3'));router[_0x11da('0x4')]('/originate',auth['isAuthenticated'](),auth[_0x11da('0x5')](),controller[_0x11da('0x6')]);router[_0x11da('0x4')]('/hangup',auth[_0x11da('0x7')](),auth[_0x11da('0x5')](),controller[_0x11da('0x8')]);router['post']('/answer',auth[_0x11da('0x7')](),auth[_0x11da('0x5')](),controller['answer']);router[_0x11da('0x4')](_0x11da('0x9'),auth['isAuthenticated'](),auth[_0x11da('0x5')](),controller[_0x11da('0xa')]);router[_0x11da('0x4')](_0x11da('0xb'),auth[_0x11da('0x7')](),auth[_0x11da('0x5')](),controller[_0x11da('0xc')]);router[_0x11da('0x4')](_0x11da('0xd'),auth['isAuthenticated'](),auth[_0x11da('0x5')](),controller[_0x11da('0xe')]);router[_0x11da('0x4')](_0x11da('0xf'),auth[_0x11da('0x7')](),auth['canUpdate'](),controller[_0x11da('0x10')]);module[_0x11da('0x11')]=router; \ No newline at end of file +var _0x3645=['./webbar.controller','post','/originate','isAuthenticated','canUpdate','/hangup','hangup','/answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','transfer','Router','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3645,0x154));var _0x5364=function(_0x479160,_0x3ab560){_0x479160=_0x479160-0x0;var _0x47ac6d=_0x3645[_0x479160];return _0x47ac6d;};'use strict';var express=require('express');var router=express[_0x5364('0x0')]();var auth=require(_0x5364('0x1'));var controller=require(_0x5364('0x2'));router[_0x5364('0x3')](_0x5364('0x4'),auth[_0x5364('0x5')](),auth[_0x5364('0x6')](),controller['originate']);router[_0x5364('0x3')](_0x5364('0x7'),auth[_0x5364('0x5')](),auth[_0x5364('0x6')](),controller[_0x5364('0x8')]);router[_0x5364('0x3')](_0x5364('0x9'),auth[_0x5364('0x5')](),auth[_0x5364('0x6')](),controller['answer']);router[_0x5364('0x3')](_0x5364('0xa'),auth[_0x5364('0x5')](),auth[_0x5364('0x6')](),controller[_0x5364('0xb')]);router[_0x5364('0x3')](_0x5364('0xc'),auth[_0x5364('0x5')](),auth[_0x5364('0x6')](),controller[_0x5364('0xd')]);router[_0x5364('0x3')](_0x5364('0xe'),auth[_0x5364('0x5')](),auth['canUpdate'](),controller[_0x5364('0xf')]);router[_0x5364('0x3')](_0x5364('0x10'),auth[_0x5364('0x5')](),auth['canUpdate'](),controller[_0x5364('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index a5bd8ae..d454797 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 _0x3cb3=['length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','callNumber','callerId','entityFound:','user:%s','json','hangup\x20fired:','userId','format','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','filter','conference','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','webbarapi','defaults','redis','socket.io-emitter','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','agent','VoiceChannels','all','rows','UserId','sessionId'];(function(_0x336c2b,_0x3c04cc){var _0x348e81=function(_0x209b2f){while(--_0x209b2f){_0x336c2b['push'](_0x336c2b['shift']());}};_0x348e81(++_0x3c04cc);}(_0x3cb3,0x156));var _0x33cb=function(_0x2b79a4,_0x1d34d7){_0x2b79a4=_0x2b79a4-0x0;var _0x6ba213=_0x3cb3[_0x2b79a4];return _0x6ba213;};'use strict';var path=require(_0x33cb('0x0'));var fs=require('fs');var _=require(_0x33cb('0x1'));var db=require(_0x33cb('0x2'))['db'];var config=require(_0x33cb('0x3'));var util=require(_0x33cb('0x4'));var BPromise=require(_0x33cb('0x5'));var jayson=require(_0x33cb('0x6'));var amiClient=jayson[_0x33cb('0x7')]['http']({'port':0x232a});var logger=require('../../config/logger')(_0x33cb('0x8'));var Redis=require('ioredis');config['redis']=_[_0x33cb('0x9')](config[_0x33cb('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x33cb('0xb'))(new Redis(config['redis']));var Schema=require(_0x33cb('0xc'));var originateValidation=new Schema({'userId':{'type':_0x33cb('0xd'),'required':[!![],_0x33cb('0xe')]},'callNumber':{'type':'string','required':[!![],_0x33cb('0xf')]},'callerId':{'type':_0x33cb('0x10')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x33cb('0xd'),'required':[!![],_0x33cb('0xe')]},'sessionId':{'type':_0x33cb('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x33cb('0xd'),'required':[!![],_0x33cb('0xe')]},'sessionId':{'type':_0x33cb('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x33cb('0xe')]},'sessionId':{'type':_0x33cb('0x10'),'required':[!![],_0x33cb('0x11')]},'transferNumber':{'type':'string','required':[!![],_0x33cb('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x33cb('0xd'),'required':[!![],_0x33cb('0xe')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x33cb('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x33cb('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x33cb('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0xa5ac7d,_0x3020c3,_0x2494a3){logger[_0x33cb('0x13')](_0xa5ac7d,_0x3020c3,JSON[_0x33cb('0x14')](_0x2494a3));io['to'](_0xa5ac7d)[_0x33cb('0x15')](_0x3020c3,_0x2494a3);}function handleError(_0x1018f6){return function(_0x1bdceb){console[_0x33cb('0x16')](_0x33cb('0x17'),_0x1bdceb,_0x1bdceb instanceof RangeError);logger[_0x33cb('0x18')](_0x1bdceb[_0x33cb('0x19')]);if(_0x1bdceb instanceof RangeError){if(_0x1bdceb[_0x33cb('0x1a')]){delete _0x1bdceb[_0x33cb('0x1a')];}_0x1018f6[_0x33cb('0x1b')](0x194)[_0x33cb('0x1c')](_0x1bdceb);}else{if(_0x1bdceb['name']){delete _0x1bdceb[_0x33cb('0x1a')];}_0x1018f6['status'](0x1f4)[_0x33cb('0x1c')](_0x1bdceb);}};}function checkError(){return function(_0x2ef94e){if(!_0x2ef94e){throw new RangeError(_0x33cb('0x1d'));}return _0x2ef94e;};}function respondWithRpcPromise(_0xa7bcd8,_0x2f5f5b){return new BPromise(function(_0x48ef4f,_0x1ceb2f){var _0x5e98f6=amiClient;return _0x5e98f6[_0x33cb('0x1e')](_0xa7bcd8,_0x2f5f5b)[_0x33cb('0x1f')](function(_0x4cd4f3){if(_0x4cd4f3[_0x33cb('0x18')]){if(_0x4cd4f3[_0x33cb('0x18')][_0x33cb('0x20')]===0x1f4){return _0x1ceb2f(_0x4cd4f3[_0x33cb('0x18')][_0x33cb('0x21')]);}return _0x48ef4f(_0x4cd4f3[_0x33cb('0x18')][_0x33cb('0x21')]);}else{_0x48ef4f(_0x4cd4f3[_0x33cb('0x22')]);}})[_0x33cb('0x23')](function(_0x448a94){_0x1ceb2f(_0x448a94);});});}function getAgent(_0x3b83cb){return db[_0x33cb('0x24')]['findOne']({'where':{'id':_0x3b83cb,'role':_0x33cb('0x25')}})['then'](checkError());}function getAgentCheckSession(_0x327ced,_0x423b17){return new BPromise(function(_0x43a186,_0x29a193){var _0x2c0d1e=respondWithRpcPromise(_0x33cb('0x26'));var _0x1dd29d=getAgent(_0x327ced);Promise[_0x33cb('0x27')]([_0x2c0d1e,_0x1dd29d])[_0x33cb('0x1f')](function(_0x7f8dd){var _0x5f5173=_0x7f8dd[0x0];var _0x2dd613=_0x7f8dd[0x1];var _0x4e3d9e=_['filter'](_0x5f5173[_0x33cb('0x28')],function(_0x3b0fe7){return _0x3b0fe7[_0x33cb('0x29')]==_0x2dd613['id']&&_0x3b0fe7[_0x33cb('0x2a')]==_0x423b17;});if(_0x4e3d9e[_0x33cb('0x2b')]==0x1){_0x43a186(_0x2dd613);}else{_0x29a193(new RangeError(_0x33cb('0x2c')+_0x423b17+_0x33cb('0x2d')));}});});}exports[_0x33cb('0x2e')]=function(_0x4bb186,_0x408896){logger[_0x33cb('0x13')](_0x33cb('0x2f'),_0x4bb186[_0x33cb('0x30')]);var _0x4cf4b5=originateValidation[_0x33cb('0xc')](_0x4bb186[_0x33cb('0x30')]);if(_0x4cf4b5['length']>0x0){return _0x408896[_0x33cb('0x1b')](0x190)['json'](_0x4cf4b5);}var _0x725be5=_0x4bb186[_0x33cb('0x30')]['userId'];var _0x156426=_0x4bb186[_0x33cb('0x30')][_0x33cb('0x31')];var _0x2fdebe=_0x4bb186[_0x33cb('0x30')][_0x33cb('0x32')];var _0x2f669e=_0x4bb186[_0x33cb('0x30')]['callbackUrl'];return getAgent(_0x725be5)['then'](function(_0x233ad2){logger[_0x33cb('0x13')](_0x33cb('0x33'),_0x233ad2[_0x33cb('0x1a')]);emit(util['format'](_0x33cb('0x34'),_0x233ad2[_0x33cb('0x1a')]),'webbar:originate',{'callNumber':_0x156426,'callerId':_0x2fdebe,'callbackUrl':_0x2f669e});return _0x408896['status'](0xc8)[_0x33cb('0x35')]({'error':![],'message':'originate\x20executed!'});})[_0x33cb('0x23')](handleError(_0x408896));};exports['hangup']=function(_0x5ca7a4,_0x10a2e8){logger[_0x33cb('0x13')](_0x33cb('0x36'),_0x5ca7a4[_0x33cb('0x30')]);var _0x100a8e=hangupValidation[_0x33cb('0xc')](_0x5ca7a4[_0x33cb('0x30')]);if(_0x100a8e[_0x33cb('0x2b')]>0x0){return _0x10a2e8['status'](0x190)[_0x33cb('0x35')](_0x100a8e);}var _0x17d490=_0x5ca7a4['body']['userId'];var _0x1c8ace=_0x5ca7a4[_0x33cb('0x30')][_0x33cb('0x2a')];return getAgent(_0x17d490)[_0x33cb('0x1f')](function(_0x374500){logger[_0x33cb('0x13')](_0x33cb('0x33'),_0x374500['name']);emit(util['format'](_0x33cb('0x34'),_0x374500['name']),'webbar:hangup',{'sessionId':_0x1c8ace});return _0x10a2e8[_0x33cb('0x1b')](0xc8)[_0x33cb('0x35')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x10a2e8));};exports['answer']=function(_0x27d95e,_0x537e3a){logger[_0x33cb('0x13')]('answer\x20fired:',_0x27d95e[_0x33cb('0x30')]);var _0x2f9e46=answerValidation[_0x33cb('0xc')](_0x27d95e[_0x33cb('0x30')]);if(_0x2f9e46[_0x33cb('0x2b')]>0x0){return _0x537e3a[_0x33cb('0x1b')](0x190)[_0x33cb('0x35')](_0x2f9e46);}var _0x960ec4=_0x27d95e[_0x33cb('0x30')][_0x33cb('0x37')];var _0x235bc4=_0x27d95e['body'][_0x33cb('0x2a')];return getAgent(_0x960ec4)[_0x33cb('0x1f')](function(_0x3e26e1){logger[_0x33cb('0x13')]('entityFound:',_0x3e26e1['name']);emit(util[_0x33cb('0x38')]('user:%s',_0x3e26e1[_0x33cb('0x1a')]),_0x33cb('0x39'),{'sessionId':_0x235bc4});return _0x537e3a[_0x33cb('0x1b')](0xc8)[_0x33cb('0x35')]({'error':![],'message':_0x33cb('0x3a')});})['catch'](handleError(_0x537e3a));};exports[_0x33cb('0x3b')]=function(_0x241dea,_0x432452){logger[_0x33cb('0x13')](_0x33cb('0x3c'),_0x241dea[_0x33cb('0x30')]);var _0x56e80c=holdValidation['validate'](_0x241dea[_0x33cb('0x30')]);if(_0x56e80c[_0x33cb('0x2b')]>0x0){return _0x432452[_0x33cb('0x1b')](0x190)[_0x33cb('0x35')](_0x56e80c);}var _0xb81aac=_0x241dea['body'][_0x33cb('0x37')];var _0x4c45d7=_0x241dea[_0x33cb('0x30')][_0x33cb('0x2a')];return getAgent(_0xb81aac)[_0x33cb('0x1f')](function(_0x5caa09){logger[_0x33cb('0x13')]('entityFound:',_0x5caa09['name']);emit(util[_0x33cb('0x38')]('user:%s',_0x5caa09[_0x33cb('0x1a')]),_0x33cb('0x3d'),{'sessionId':_0x4c45d7});return _0x432452['status'](0xc8)[_0x33cb('0x35')]({'error':![],'message':_0x33cb('0x3e')});})['catch'](handleError(_0x432452));};exports[_0x33cb('0x3f')]=function(_0x532902,_0x2030b5){logger['info'](_0x33cb('0x40'),_0x532902[_0x33cb('0x30')]);var _0x37a022=unholdValidation[_0x33cb('0xc')](_0x532902['body']);if(_0x37a022[_0x33cb('0x2b')]>0x0){return _0x2030b5[_0x33cb('0x1b')](0x190)['json'](_0x37a022);}var _0x1d65c0=_0x532902['body']['userId'];var _0x2fb42d=_0x532902['body'][_0x33cb('0x2a')];return getAgent(_0x1d65c0)[_0x33cb('0x1f')](function(_0x5a6d4b){logger[_0x33cb('0x13')](_0x33cb('0x33'),_0x5a6d4b[_0x33cb('0x1a')]);emit(util['format'](_0x33cb('0x34'),_0x5a6d4b[_0x33cb('0x1a')]),_0x33cb('0x41'),{'sessionId':_0x2fb42d});return _0x2030b5[_0x33cb('0x1b')](0xc8)[_0x33cb('0x35')]({'error':![],'message':_0x33cb('0x42')});})[_0x33cb('0x23')](handleError(_0x2030b5));};exports[_0x33cb('0x43')]=function(_0x1878cf,_0x2cc290){logger[_0x33cb('0x13')](_0x33cb('0x44'),_0x2cc290['body']);var _0x1546b5=callsValidation[_0x33cb('0xc')](_0x1878cf[_0x33cb('0x30')]);if(_0x1546b5[_0x33cb('0x2b')]>0x0){return _0x2cc290[_0x33cb('0x1b')](0x190)[_0x33cb('0x35')](_0x1546b5);}var _0xe330a1=_0x1878cf[_0x33cb('0x30')][_0x33cb('0x37')];var _0x6b5121=respondWithRpcPromise(_0x33cb('0x26'));var _0x2b686a=getAgent(_0xe330a1);return Promise['all']([_0x6b5121,_0x2b686a])[_0x33cb('0x1f')](function(_0x3564c0){var _0x3a6231=_0x3564c0[0x0];var _0x1f718f=_0x3564c0[0x1];var _0x2d9842=_[_0x33cb('0x45')](_0x3a6231['rows'],function(_0x4cca5e){return _0x4cca5e[_0x33cb('0x29')]==_0x1f718f['id'];});return _0x2cc290[_0x33cb('0x1b')](0xc8)[_0x33cb('0x35')]({'count':_0x2d9842[_0x33cb('0x2b')],'rows':_0x2d9842});})['catch'](handleError(_0x2cc290));};exports[_0x33cb('0x46')]=function(_0x4ecb5f,_0x538ce4){logger[_0x33cb('0x13')](_0x33cb('0x47'),_0x4ecb5f[_0x33cb('0x30')]);var _0x568e55=conferenceValidation[_0x33cb('0xc')](_0x4ecb5f['body']);if(_0x568e55[_0x33cb('0x2b')]>0x0){return _0x538ce4[_0x33cb('0x1b')](0x190)[_0x33cb('0x35')](_0x568e55);}var _0x214420=_0x4ecb5f[_0x33cb('0x30')][_0x33cb('0x37')];return getAgent(_0x214420)['then'](function(_0x19032a){logger[_0x33cb('0x13')](_0x33cb('0x33'),_0x19032a[_0x33cb('0x1a')]);emit(util[_0x33cb('0x38')](_0x33cb('0x34'),_0x19032a[_0x33cb('0x1a')]),_0x33cb('0x48'));return _0x538ce4[_0x33cb('0x1b')](0xc8)[_0x33cb('0x35')]({'error':![],'message':'conference\x20executed!'});})[_0x33cb('0x23')](handleError(_0x538ce4));};exports[_0x33cb('0x49')]=function(_0xdfbaca,_0x1cf3f7){logger[_0x33cb('0x13')](_0x33cb('0x4a'),_0xdfbaca['body']);var _0x3c3985=transferValidation['validate'](_0xdfbaca['body']);if(_0x3c3985[_0x33cb('0x2b')]>0x0){return _0x1cf3f7[_0x33cb('0x1b')](0x190)[_0x33cb('0x35')](_0x3c3985);}var _0xadb85a=_0xdfbaca[_0x33cb('0x30')][_0x33cb('0x37')];var _0x2cfa1c=_0xdfbaca[_0x33cb('0x30')][_0x33cb('0x2a')];var _0x2354da=_0xdfbaca[_0x33cb('0x30')]['transferNumber'];return getAgent(_0xadb85a)[_0x33cb('0x1f')](function(_0x465f3e){logger[_0x33cb('0x13')](_0x33cb('0x33'),_0x465f3e[_0x33cb('0x1a')]);emit(util[_0x33cb('0x38')](_0x33cb('0x34'),_0x465f3e[_0x33cb('0x1a')]),_0x33cb('0x4b'),{'sessionId':_0x2cfa1c,'transferNumber':_0x2354da});return _0x1cf3f7[_0x33cb('0x1b')](0xc8)[_0x33cb('0x35')]({'error':![],'message':_0x33cb('0x4c')});})[_0x33cb('0x23')](handleError(_0x1cf3f7));}; \ No newline at end of file +var _0xbe45=['userId','webbar:answer','answer\x20executed!','hold','hold\x20executed!','unhold','unhold\x20fired:','format','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','transfer','transfer\x20fired:','transferNumber','webbar:transfer','path','lodash','../../config/environment','util','bluebird','jayson/promise','client','http','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','stack','name','status','send','then','error','message','result','catch','User','findOne','VoiceChannels','all','rows','UserId','sessionId','sessionId\x20','originate\x20fired:','body','length','json','callNumber','callerId','webbar:originate','originate\x20executed!','hangup\x20fired:','entityFound:','user:%s','hangup\x20executed!','answer','answer\x20fired:'];(function(_0x1ac3cf,_0x142edc){var _0xf3686c=function(_0x505d75){while(--_0x505d75){_0x1ac3cf['push'](_0x1ac3cf['shift']());}};_0xf3686c(++_0x142edc);}(_0xbe45,0xf0));var _0x5be4=function(_0x16131d,_0x69b9ae){_0x16131d=_0x16131d-0x0;var _0x38719c=_0xbe45[_0x16131d];return _0x38719c;};'use strict';var path=require(_0x5be4('0x0'));var fs=require('fs');var _=require(_0x5be4('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x5be4('0x2'));var util=require(_0x5be4('0x3'));var BPromise=require(_0x5be4('0x4'));var jayson=require(_0x5be4('0x5'));var amiClient=jayson[_0x5be4('0x6')][_0x5be4('0x7')]({'port':0x232a});var logger=require('../../config/logger')(_0x5be4('0x8'));var Redis=require(_0x5be4('0x9'));config[_0x5be4('0xa')]=_[_0x5be4('0xb')](config[_0x5be4('0xa')],{'host':_0x5be4('0xc'),'port':0x18eb});var io=require(_0x5be4('0xd'))(new Redis(config[_0x5be4('0xa')]));var Schema=require(_0x5be4('0xe'));var originateValidation=new Schema({'userId':{'type':_0x5be4('0xf'),'required':[!![],_0x5be4('0x10')]},'callNumber':{'type':_0x5be4('0x11'),'required':[!![],_0x5be4('0x12')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x5be4('0x11')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x5be4('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5be4('0x10')]},'sessionId':{'type':_0x5be4('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5be4('0x10')]},'sessionId':{'type':_0x5be4('0x11'),'required':[!![],_0x5be4('0x13')]},'transferNumber':{'type':'string','required':[!![],_0x5be4('0x14')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5be4('0x10')]},'sessionId':{'type':_0x5be4('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x5be4('0xf'),'required':[!![],_0x5be4('0x10')]},'sessionId':{'type':_0x5be4('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x5be4('0xf'),'required':[!![],_0x5be4('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5be4('0x10')]}});function emit(_0x8466a7,_0x1d7db7,_0x11e581){logger[_0x5be4('0x15')](_0x8466a7,_0x1d7db7,JSON[_0x5be4('0x16')](_0x11e581));io['to'](_0x8466a7)[_0x5be4('0x17')](_0x1d7db7,_0x11e581);}function handleError(_0x2b704d){return function(_0x51662a){console[_0x5be4('0x18')]('handleError:',_0x51662a,_0x51662a instanceof RangeError);logger['error'](_0x51662a[_0x5be4('0x19')]);if(_0x51662a instanceof RangeError){if(_0x51662a[_0x5be4('0x1a')]){delete _0x51662a['name'];}_0x2b704d[_0x5be4('0x1b')](0x194)[_0x5be4('0x1c')](_0x51662a);}else{if(_0x51662a['name']){delete _0x51662a['name'];}_0x2b704d[_0x5be4('0x1b')](0x1f4)[_0x5be4('0x1c')](_0x51662a);}};}function checkError(){return function(_0x4b73f9){if(!_0x4b73f9){throw new RangeError('NotFound');}return _0x4b73f9;};}function respondWithRpcPromise(_0x9bdadd,_0x132489){return new BPromise(function(_0x2843e3,_0x3ccd67){var _0xa20552=amiClient;return _0xa20552['request'](_0x9bdadd,_0x132489)[_0x5be4('0x1d')](function(_0x51d7a7){if(_0x51d7a7[_0x5be4('0x1e')]){if(_0x51d7a7[_0x5be4('0x1e')]['code']===0x1f4){return _0x3ccd67(_0x51d7a7[_0x5be4('0x1e')][_0x5be4('0x1f')]);}return _0x2843e3(_0x51d7a7['error'][_0x5be4('0x1f')]);}else{_0x2843e3(_0x51d7a7[_0x5be4('0x20')]);}})[_0x5be4('0x21')](function(_0x39cf54){_0x3ccd67(_0x39cf54);});});}function getAgent(_0xa7a16){return db[_0x5be4('0x22')][_0x5be4('0x23')]({'where':{'id':_0xa7a16,'role':'agent'}})['then'](checkError());}function getAgentCheckSession(_0x51584f,_0x29b1f4){return new BPromise(function(_0x39430a,_0x5c489e){var _0xd88995=respondWithRpcPromise(_0x5be4('0x24'));var _0x3bd842=getAgent(_0x51584f);Promise[_0x5be4('0x25')]([_0xd88995,_0x3bd842])[_0x5be4('0x1d')](function(_0x1e0485){var _0x4b9029=_0x1e0485[0x0];var _0x1661c2=_0x1e0485[0x1];var _0x17a291=_['filter'](_0x4b9029[_0x5be4('0x26')],function(_0x49780a){return _0x49780a[_0x5be4('0x27')]==_0x1661c2['id']&&_0x49780a[_0x5be4('0x28')]==_0x29b1f4;});if(_0x17a291['length']==0x1){_0x39430a(_0x1661c2);}else{_0x5c489e(new RangeError(_0x5be4('0x29')+_0x29b1f4+'\x20not\x20found!'));}});});}exports['originate']=function(_0x11929e,_0x337ca1){logger[_0x5be4('0x15')](_0x5be4('0x2a'),_0x11929e[_0x5be4('0x2b')]);var _0x23775c=originateValidation[_0x5be4('0xe')](_0x11929e[_0x5be4('0x2b')]);if(_0x23775c[_0x5be4('0x2c')]>0x0){return _0x337ca1[_0x5be4('0x1b')](0x190)[_0x5be4('0x2d')](_0x23775c);}var _0x3c9b5c=_0x11929e['body']['userId'];var _0x31e023=_0x11929e[_0x5be4('0x2b')][_0x5be4('0x2e')];var _0x2af6c3=_0x11929e['body'][_0x5be4('0x2f')];var _0x4ae580=_0x11929e[_0x5be4('0x2b')]['callbackUrl'];return getAgent(_0x3c9b5c)[_0x5be4('0x1d')](function(_0x146a7b){logger['info']('entityFound:',_0x146a7b[_0x5be4('0x1a')]);emit(util['format']('user:%s',_0x146a7b[_0x5be4('0x1a')]),_0x5be4('0x30'),{'callNumber':_0x31e023,'callerId':_0x2af6c3,'callbackUrl':_0x4ae580});return _0x337ca1[_0x5be4('0x1b')](0xc8)['json']({'error':![],'message':_0x5be4('0x31')});})[_0x5be4('0x21')](handleError(_0x337ca1));};exports['hangup']=function(_0xeb99b5,_0x46953c){logger[_0x5be4('0x15')](_0x5be4('0x32'),_0xeb99b5['body']);var _0x68cd9=hangupValidation[_0x5be4('0xe')](_0xeb99b5[_0x5be4('0x2b')]);if(_0x68cd9[_0x5be4('0x2c')]>0x0){return _0x46953c[_0x5be4('0x1b')](0x190)[_0x5be4('0x2d')](_0x68cd9);}var _0x11d139=_0xeb99b5[_0x5be4('0x2b')]['userId'];var _0x41f02e=_0xeb99b5[_0x5be4('0x2b')][_0x5be4('0x28')];return getAgent(_0x11d139)[_0x5be4('0x1d')](function(_0x304fab){logger['info'](_0x5be4('0x33'),_0x304fab[_0x5be4('0x1a')]);emit(util['format'](_0x5be4('0x34'),_0x304fab[_0x5be4('0x1a')]),'webbar:hangup',{'sessionId':_0x41f02e});return _0x46953c[_0x5be4('0x1b')](0xc8)[_0x5be4('0x2d')]({'error':![],'message':_0x5be4('0x35')});})[_0x5be4('0x21')](handleError(_0x46953c));};exports[_0x5be4('0x36')]=function(_0x14ae03,_0x1ab4de){logger[_0x5be4('0x15')](_0x5be4('0x37'),_0x14ae03['body']);var _0x1add45=answerValidation['validate'](_0x14ae03[_0x5be4('0x2b')]);if(_0x1add45[_0x5be4('0x2c')]>0x0){return _0x1ab4de['status'](0x190)[_0x5be4('0x2d')](_0x1add45);}var _0x48c1db=_0x14ae03['body'][_0x5be4('0x38')];var _0x126812=_0x14ae03[_0x5be4('0x2b')][_0x5be4('0x28')];return getAgent(_0x48c1db)[_0x5be4('0x1d')](function(_0x224321){logger[_0x5be4('0x15')]('entityFound:',_0x224321[_0x5be4('0x1a')]);emit(util['format'](_0x5be4('0x34'),_0x224321['name']),_0x5be4('0x39'),{'sessionId':_0x126812});return _0x1ab4de[_0x5be4('0x1b')](0xc8)['json']({'error':![],'message':_0x5be4('0x3a')});})[_0x5be4('0x21')](handleError(_0x1ab4de));};exports[_0x5be4('0x3b')]=function(_0x4f548c,_0x17fabd){logger[_0x5be4('0x15')]('hold\x20fired:',_0x4f548c[_0x5be4('0x2b')]);var _0x4d9bbb=holdValidation['validate'](_0x4f548c[_0x5be4('0x2b')]);if(_0x4d9bbb[_0x5be4('0x2c')]>0x0){return _0x17fabd['status'](0x190)[_0x5be4('0x2d')](_0x4d9bbb);}var _0x57f25d=_0x4f548c['body'][_0x5be4('0x38')];var _0xa8b6a9=_0x4f548c[_0x5be4('0x2b')]['sessionId'];return getAgent(_0x57f25d)['then'](function(_0x378ae7){logger[_0x5be4('0x15')](_0x5be4('0x33'),_0x378ae7[_0x5be4('0x1a')]);emit(util['format'](_0x5be4('0x34'),_0x378ae7[_0x5be4('0x1a')]),'webbar:hold',{'sessionId':_0xa8b6a9});return _0x17fabd[_0x5be4('0x1b')](0xc8)[_0x5be4('0x2d')]({'error':![],'message':_0x5be4('0x3c')});})['catch'](handleError(_0x17fabd));};exports[_0x5be4('0x3d')]=function(_0x3481c9,_0xc9ca2f){logger[_0x5be4('0x15')](_0x5be4('0x3e'),_0x3481c9[_0x5be4('0x2b')]);var _0x1396ce=unholdValidation[_0x5be4('0xe')](_0x3481c9[_0x5be4('0x2b')]);if(_0x1396ce[_0x5be4('0x2c')]>0x0){return _0xc9ca2f['status'](0x190)[_0x5be4('0x2d')](_0x1396ce);}var _0x5f5851=_0x3481c9[_0x5be4('0x2b')][_0x5be4('0x38')];var _0xafdf6e=_0x3481c9[_0x5be4('0x2b')][_0x5be4('0x28')];return getAgent(_0x5f5851)[_0x5be4('0x1d')](function(_0x40e5e3){logger[_0x5be4('0x15')](_0x5be4('0x33'),_0x40e5e3[_0x5be4('0x1a')]);emit(util[_0x5be4('0x3f')]('user:%s',_0x40e5e3[_0x5be4('0x1a')]),_0x5be4('0x40'),{'sessionId':_0xafdf6e});return _0xc9ca2f[_0x5be4('0x1b')](0xc8)[_0x5be4('0x2d')]({'error':![],'message':_0x5be4('0x41')});})['catch'](handleError(_0xc9ca2f));};exports[_0x5be4('0x42')]=function(_0xaae2c,_0xf454e6){logger[_0x5be4('0x15')](_0x5be4('0x43'),_0xf454e6[_0x5be4('0x2b')]);var _0x7d2b3c=callsValidation['validate'](_0xaae2c[_0x5be4('0x2b')]);if(_0x7d2b3c['length']>0x0){return _0xf454e6[_0x5be4('0x1b')](0x190)[_0x5be4('0x2d')](_0x7d2b3c);}var _0x5b8b7a=_0xaae2c[_0x5be4('0x2b')][_0x5be4('0x38')];var _0x3c3ebb=respondWithRpcPromise(_0x5be4('0x24'));var _0x29ca73=getAgent(_0x5b8b7a);return Promise[_0x5be4('0x25')]([_0x3c3ebb,_0x29ca73])[_0x5be4('0x1d')](function(_0xc2719f){var _0x570c5d=_0xc2719f[0x0];var _0x5bb7ce=_0xc2719f[0x1];var _0x3052d8=_['filter'](_0x570c5d[_0x5be4('0x26')],function(_0x562e1d){return _0x562e1d[_0x5be4('0x27')]==_0x5bb7ce['id'];});return _0xf454e6[_0x5be4('0x1b')](0xc8)[_0x5be4('0x2d')]({'count':_0x3052d8[_0x5be4('0x2c')],'rows':_0x3052d8});})[_0x5be4('0x21')](handleError(_0xf454e6));};exports[_0x5be4('0x44')]=function(_0x3991cb,_0x5d8f53){logger[_0x5be4('0x15')](_0x5be4('0x45'),_0x3991cb['body']);var _0x3c862b=conferenceValidation[_0x5be4('0xe')](_0x3991cb[_0x5be4('0x2b')]);if(_0x3c862b[_0x5be4('0x2c')]>0x0){return _0x5d8f53[_0x5be4('0x1b')](0x190)['json'](_0x3c862b);}var _0x3d1ad3=_0x3991cb[_0x5be4('0x2b')][_0x5be4('0x38')];return getAgent(_0x3d1ad3)[_0x5be4('0x1d')](function(_0x915605){logger['info'](_0x5be4('0x33'),_0x915605['name']);emit(util[_0x5be4('0x3f')](_0x5be4('0x34'),_0x915605[_0x5be4('0x1a')]),'webbar:conference');return _0x5d8f53[_0x5be4('0x1b')](0xc8)[_0x5be4('0x2d')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x5d8f53));};exports[_0x5be4('0x46')]=function(_0xbaf63b,_0x48816f){logger[_0x5be4('0x15')](_0x5be4('0x47'),_0xbaf63b[_0x5be4('0x2b')]);var _0x51b6af=transferValidation[_0x5be4('0xe')](_0xbaf63b[_0x5be4('0x2b')]);if(_0x51b6af[_0x5be4('0x2c')]>0x0){return _0x48816f[_0x5be4('0x1b')](0x190)[_0x5be4('0x2d')](_0x51b6af);}var _0x2aa387=_0xbaf63b[_0x5be4('0x2b')][_0x5be4('0x38')];var _0x5a7d62=_0xbaf63b[_0x5be4('0x2b')][_0x5be4('0x28')];var _0x4743b8=_0xbaf63b[_0x5be4('0x2b')][_0x5be4('0x48')];return getAgent(_0x2aa387)[_0x5be4('0x1d')](function(_0x2995e6){logger[_0x5be4('0x15')](_0x5be4('0x33'),_0x2995e6[_0x5be4('0x1a')]);emit(util[_0x5be4('0x3f')]('user:%s',_0x2995e6['name']),_0x5be4('0x49'),{'sessionId':_0x5a7d62,'transferNumber':_0x4743b8});return _0x48816f[_0x5be4('0x1b')](0xc8)[_0x5be4('0x2d')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x48816f));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 8ff14c7..7bb84a9 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 _0x4024=['index','get','/describe','describe','isAuthenticated','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getAgents','getApplications','post','create','addDisposition','addAnswer','/:id/users','addAgents','/:id/applications','/:id/notify','notify','/:id/send','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./whatsappAccount.controller'];(function(_0x4f8a7b,_0x4f9ea9){var _0x525fd3=function(_0x101c79){while(--_0x101c79){_0x4f8a7b['push'](_0x4f8a7b['shift']());}};_0x525fd3(++_0x4f9ea9);}(_0x4024,0x89));var _0x4402=function(_0x2a4b8f,_0x4d728b){_0x2a4b8f=_0x2a4b8f-0x0;var _0x42cbb3=_0x4024[_0x2a4b8f];return _0x42cbb3;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var auth=require(_0x4402('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4402('0x5'));var controller=require(_0x4402('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x4402('0x7')]);router[_0x4402('0x8')](_0x4402('0x9'),auth['isAuthenticated'](),controller[_0x4402('0xa')]);router['get']('/:id',auth[_0x4402('0xb')](),controller['show']);router['get'](_0x4402('0xc'),auth['isAuthenticated'](),controller[_0x4402('0xd')]);router['get'](_0x4402('0xe'),auth['isAuthenticated'](),controller[_0x4402('0xf')]);router[_0x4402('0x8')]('/:id/users',auth[_0x4402('0xb')](),controller[_0x4402('0x10')]);router[_0x4402('0x8')]('/:id/applications',auth[_0x4402('0xb')](),controller[_0x4402('0x11')]);router[_0x4402('0x12')]('/',auth[_0x4402('0xb')](),controller[_0x4402('0x13')]);router[_0x4402('0x12')](_0x4402('0xc'),auth[_0x4402('0xb')](),controller[_0x4402('0x14')]);router[_0x4402('0x12')](_0x4402('0xe'),auth[_0x4402('0xb')](),controller[_0x4402('0x15')]);router[_0x4402('0x12')](_0x4402('0x16'),auth[_0x4402('0xb')](),controller[_0x4402('0x17')]);router[_0x4402('0x12')](_0x4402('0x18'),auth[_0x4402('0xb')](),controller['addApplications']);router['post'](_0x4402('0x19'),controller[_0x4402('0x1a')]);router['post'](_0x4402('0x1b'),auth[_0x4402('0xb')](),controller['send']);router[_0x4402('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x4402('0x1d')]);router[_0x4402('0x1e')](_0x4402('0x1f'),auth['isAuthenticated'](),controller[_0x4402('0x20')]);router['delete']('/:id/dispositions',auth[_0x4402('0xb')](),controller[_0x4402('0x21')]);router[_0x4402('0x1e')](_0x4402('0xe'),auth[_0x4402('0xb')](),controller[_0x4402('0x22')]);router[_0x4402('0x1e')](_0x4402('0x16'),auth[_0x4402('0xb')](),controller['removeAgents']);module[_0x4402('0x23')]=router; \ No newline at end of file +var _0x7880=['index','/describe','describe','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','post','create','addAnswer','addApplications','/:id/notify','/:id/send','send','/:id','update','delete','destroy','removeDispositions','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated'];(function(_0x223358,_0x4f3a99){var _0x4ed2a3=function(_0xf992ee){while(--_0xf992ee){_0x223358['push'](_0x223358['shift']());}};_0x4ed2a3(++_0x4f3a99);}(_0x7880,0x1f4));var _0x0788=function(_0x19a11f,_0x6d8be7){_0x19a11f=_0x19a11f-0x0;var _0x51485f=_0x7880[_0x19a11f];return _0x51485f;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var auth=require(_0x0788('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0788('0x6'));var controller=require(_0x0788('0x7'));router[_0x0788('0x8')]('/',auth[_0x0788('0x9')](),controller[_0x0788('0xa')]);router[_0x0788('0x8')](_0x0788('0xb'),auth[_0x0788('0x9')](),controller[_0x0788('0xc')]);router[_0x0788('0x8')]('/:id',auth[_0x0788('0x9')](),controller['show']);router[_0x0788('0x8')]('/:id/dispositions',auth[_0x0788('0x9')](),controller[_0x0788('0xd')]);router[_0x0788('0x8')](_0x0788('0xe'),auth[_0x0788('0x9')](),controller['getAnswers']);router[_0x0788('0x8')](_0x0788('0xf'),auth[_0x0788('0x9')](),controller[_0x0788('0x10')]);router[_0x0788('0x8')](_0x0788('0x11'),auth[_0x0788('0x9')](),controller['getApplications']);router[_0x0788('0x12')]('/',auth[_0x0788('0x9')](),controller[_0x0788('0x13')]);router[_0x0788('0x12')]('/:id/dispositions',auth[_0x0788('0x9')](),controller['addDisposition']);router[_0x0788('0x12')](_0x0788('0xe'),auth[_0x0788('0x9')](),controller[_0x0788('0x14')]);router[_0x0788('0x12')](_0x0788('0xf'),auth['isAuthenticated'](),controller['addAgents']);router[_0x0788('0x12')](_0x0788('0x11'),auth['isAuthenticated'](),controller[_0x0788('0x15')]);router[_0x0788('0x12')](_0x0788('0x16'),controller['notify']);router[_0x0788('0x12')](_0x0788('0x17'),auth['isAuthenticated'](),controller[_0x0788('0x18')]);router['put'](_0x0788('0x19'),auth['isAuthenticated'](),controller[_0x0788('0x1a')]);router[_0x0788('0x1b')](_0x0788('0x19'),auth[_0x0788('0x9')](),controller[_0x0788('0x1c')]);router['delete']('/:id/dispositions',auth[_0x0788('0x9')](),controller[_0x0788('0x1d')]);router[_0x0788('0x1b')](_0x0788('0xe'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x0788('0x1b')](_0x0788('0xf'),auth[_0x0788('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 85bdadb..734269e 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 _0x5f81=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','ENUM','twilio','TEXT'];(function(_0x32dc49,_0x112ae2){var _0x169742=function(_0x3c53d8){while(--_0x3c53d8){_0x32dc49['push'](_0x32dc49['shift']());}};_0x169742(++_0x112ae2);}(_0x5f81,0xe8));var _0x15f8=function(_0x24080d,_0x510cd2){_0x24080d=_0x24080d-0x0;var _0x23ab68=_0x5f81[_0x24080d];return _0x23ab68;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x15f8('0x0'));module[_0x15f8('0x1')]={'name':{'type':Sequelize[_0x15f8('0x2')],'unique':_0x15f8('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x15f8('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x15f8('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x15f8('0x2')],'defaultValue':function(){return rs[_0x15f8('0x4')]();}},'phone':{'type':Sequelize[_0x15f8('0x2')]},'type':{'type':Sequelize[_0x15f8('0x5')](_0x15f8('0x6'))},'accountSid':{'type':Sequelize[_0x15f8('0x2')]},'authToken':{'type':Sequelize[_0x15f8('0x2')]},'notificationTemplate':{'type':Sequelize[_0x15f8('0x7')],'defaultValue':function(){return _0x15f8('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x15f8('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x15f8('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x15f8('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x15f8('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x15f8('0xc'),'set':function(_0x3ca1d6){if(!_0x3ca1d6){this[_0x15f8('0xd')](_0x15f8('0xe'),null);}this[_0x15f8('0xd')](_0x15f8('0xf'),_0x3ca1d6);}},'description':{'type':Sequelize[_0x15f8('0x2')]}}; \ No newline at end of file +var _0xc144=['exports','STRING','name','generate','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring'];(function(_0x46320d,_0x795ab){var _0x5a1811=function(_0x182a70){while(--_0x182a70){_0x46320d['push'](_0x46320d['shift']());}};_0x5a1811(++_0x795ab);}(_0xc144,0xc3));var _0x4c14=function(_0x5f1694,_0x4ebe17){_0x5f1694=_0x5f1694-0x0;var _0x2b99d9=_0xc144[_0x5f1694];return _0x2b99d9;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x4c14('0x0'));module[_0x4c14('0x1')]={'name':{'type':Sequelize[_0x4c14('0x2')],'unique':_0x4c14('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x4c14('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x4c14('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x4c14('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x4c14('0x5'))},'accountSid':{'type':Sequelize[_0x4c14('0x2')]},'authToken':{'type':Sequelize[_0x4c14('0x2')]},'notificationTemplate':{'type':Sequelize[_0x4c14('0x6')],'defaultValue':function(){return _0x4c14('0x7');}},'notificationSound':{'type':Sequelize[_0x4c14('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4c14('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4c14('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x4c14('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x45773a){if(!_0x45773a){this[_0x4c14('0xb')](_0x4c14('0xc'),null);}this[_0x4c14('0xb')](_0x4c14('0xd'),_0x45773a);}},'description':{'type':Sequelize[_0x4c14('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 87a6dc8..5e65a06 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 _0x0a4f=['Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','whatsapp:','messageId','isNil','ValidationError','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','omit','defaults','contact','WhatsappInteraction','interaction','created','push','close','unmanaged','ContactId','UserId','unshift','Start','startRouting','receiveMessage','entity\x20found','text/xml','send','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','WhatsappMessage','Messages','dataValues','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','get','UserProfileResource','destroy','stack','name','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','show','params','Pause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','userProfileId','autoAssociation','describe','addDisposition','Disposition','getDispositions','WhatsappAccountId','count','rows','removeDispositions','ids','CannedAnswer','getAnswers','findOne','include','removeAnswers','addAgents','spread','emit','removeAgents','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','transaction','WhatsappApplication','priority','getApplications','notify','whatsapp','account','applications'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0a4f,0x19b));var _0xf0a4=function(_0x3f62a7,_0xcd2468){_0x3f62a7=_0x3f62a7-0x0;var _0x5ceab2=_0x0a4f[_0x3f62a7];return _0x5ceab2;};'use strict';var pdf=require(_0xf0a4('0x0'));var emlformat=require(_0xf0a4('0x1'));var rimraf=require(_0xf0a4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf0a4('0x3'));var rp=require(_0xf0a4('0x4'));var moment=require(_0xf0a4('0x5'));var BPromise=require(_0xf0a4('0x6'));var Mustache=require(_0xf0a4('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf0a4('0x8'));var csv=require('to-csv');var ejs=require(_0xf0a4('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf0a4('0xa'));var crypto=require(_0xf0a4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf0a4('0xc'));var toCsv=require(_0xf0a4('0xd'));var querystring=require(_0xf0a4('0xe'));var Papa=require(_0xf0a4('0xf'));var Redis=require(_0xf0a4('0x10'));var authService=require(_0xf0a4('0x11'));var qs=require(_0xf0a4('0x12'));var as=require(_0xf0a4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0a4('0x14'))(_0xf0a4('0x15'));var utils=require(_0xf0a4('0x16'));var config=require(_0xf0a4('0x17'));var licenseUtil=require(_0xf0a4('0x18'));var db=require(_0xf0a4('0x19'))['db'];config[_0xf0a4('0x1a')]=_['defaults'](config[_0xf0a4('0x1a')],{'host':_0xf0a4('0x1b'),'port':0x18eb});var socket=require(_0xf0a4('0x1c'))(new Redis(config[_0xf0a4('0x1a')]));require(_0xf0a4('0x1d'))[_0xf0a4('0x1e')](socket);var jayson=require(_0xf0a4('0x1f'));var client=jayson[_0xf0a4('0x20')][_0xf0a4('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x5b4e9e,_0x288fcf,_0xbf533f,_0x13ab11){return new BPromise(function(_0x310ea5,_0x2bb28e){var _0x54e390=_0x13ab11||client;return _0x54e390[_0xf0a4('0x22')](_0x5b4e9e,_0xbf533f)[_0xf0a4('0x23')](function(_0x344756){logger['info'](_0xf0a4('0x24'),_0x288fcf,_0xf0a4('0x25'));logger[_0xf0a4('0x26')](_0xf0a4('0x27'),_0x288fcf,_0xf0a4('0x25'),JSON[_0xf0a4('0x28')](_0x344756));if(_0x344756[_0xf0a4('0x29')]){if(_0x344756[_0xf0a4('0x29')][_0xf0a4('0x2a')]===0x1f4){logger['error'](_0xf0a4('0x24'),_0x288fcf,_0x344756[_0xf0a4('0x29')][_0xf0a4('0x2b')]);return _0x2bb28e(_0x344756[_0xf0a4('0x29')][_0xf0a4('0x2b')]);}logger[_0xf0a4('0x29')](_0xf0a4('0x24'),_0x288fcf,_0x344756[_0xf0a4('0x29')][_0xf0a4('0x2b')]);return _0x310ea5(_0x344756[_0xf0a4('0x29')][_0xf0a4('0x2b')]);}else{logger[_0xf0a4('0x2c')]('WhatsappAccount,\x20%s,\x20%s',_0x288fcf,_0xf0a4('0x25'));_0x310ea5(_0x344756[_0xf0a4('0x2d')]['message']);}})[_0xf0a4('0x2e')](function(_0xdf0420){logger[_0xf0a4('0x29')](_0xf0a4('0x24'),_0x288fcf,_0xdf0420);_0x2bb28e(_0xdf0420);});});}function respondWithStatusCode(_0x14bf8e,_0x4ef837){_0x4ef837=_0x4ef837||0xcc;return function(_0x1c723f){if(_0x1c723f){return _0x14bf8e[_0xf0a4('0x2f')](_0x4ef837);}return _0x14bf8e[_0xf0a4('0x30')](_0x4ef837)[_0xf0a4('0x31')]();};}function respondWithResult(_0x4f7fe5,_0x2186c9){_0x2186c9=_0x2186c9||0xc8;return function(_0x59d294){if(_0x59d294){return _0x4f7fe5[_0xf0a4('0x30')](_0x2186c9)[_0xf0a4('0x32')](_0x59d294);}};}function respondWithFilteredResult(_0x13da73,_0x4e9667){return function(_0x44fe34){if(_0x44fe34){var _0x3d55a2=_0x44fe34['count'],_0x8a2d60=_0x4e9667[_0xf0a4('0x33')],_0x3c6ba6=_0x4e9667['offset']+_0x4e9667[_0xf0a4('0x34')],_0x203ede;if(_0x3c6ba6>=_0x3d55a2){_0x3c6ba6=_0x3d55a2;_0x203ede=0xc8;}else{_0x203ede=0xce;}_0x13da73[_0xf0a4('0x30')](_0x203ede);return _0x13da73[_0xf0a4('0x35')]('Content-Range',_0x8a2d60+'-'+_0x3c6ba6+'/'+_0x3d55a2)[_0xf0a4('0x32')](_0x44fe34);}return null;};}function patchUpdates(_0x583a83){return function(_0x598581){try{jsonpatch[_0xf0a4('0x36')](_0x598581,_0x583a83,!![]);}catch(_0x32a068){return BPromise[_0xf0a4('0x37')](_0x32a068);}return _0x598581[_0xf0a4('0x38')]();};}function saveUpdates(_0x3149c6,_0x1e0c67){return function(_0x33db9a){if(_0x33db9a){return _0x33db9a[_0xf0a4('0x39')](_0x3149c6)[_0xf0a4('0x23')](function(_0x3d1d31){return _0x3d1d31;});}return null;};}function removeEntity(_0x795ec3,_0x25964e){return function(_0x349aeb){if(_0x349aeb){return _0x349aeb['destroy']()[_0xf0a4('0x23')](function(){var _0x4c4886=_0x349aeb[_0xf0a4('0x3a')]({'plain':!![]});var _0x3e6bd6='WhatsappAccounts';return db[_0xf0a4('0x3b')][_0xf0a4('0x3c')]({'where':{'type':_0x3e6bd6,'resourceId':_0x4c4886['id']}})[_0xf0a4('0x23')](function(){return _0x349aeb;});})[_0xf0a4('0x23')](function(){_0x795ec3[_0xf0a4('0x30')](0xcc)[_0xf0a4('0x31')]();});}};}function handleEntityNotFound(_0xbb1e8c,_0x1b1228){return function(_0x570c3b){if(!_0x570c3b){_0xbb1e8c['sendStatus'](0x194);}return _0x570c3b;};}function handleError(_0x45ab13,_0x2a639a){_0x2a639a=_0x2a639a||0x1f4;return function(_0x13176c){logger['error'](_0x13176c[_0xf0a4('0x3d')]);if(_0x13176c[_0xf0a4('0x3e')]){delete _0x13176c['name'];}_0x45ab13[_0xf0a4('0x30')](_0x2a639a)['send'](_0x13176c);};}exports[_0xf0a4('0x3f')]=function(_0xb1ed65,_0x328472){var _0x4705c2={'include':[{'model':db['Pause'],'as':_0xf0a4('0x40')}]},_0x1b1ab7={},_0x59b1e1={'count':0x0,'rows':[]};var _0x2047de=_[_0xf0a4('0x41')](db[_0xf0a4('0x42')][_0xf0a4('0x43')],function(_0x43ab04){return{'name':_0x43ab04[_0xf0a4('0x44')],'type':_0x43ab04[_0xf0a4('0x45')]['key']};});_0x1b1ab7[_0xf0a4('0x46')]=_['map'](_0x2047de,_0xf0a4('0x3e'));_0x1b1ab7['query']=_[_0xf0a4('0x47')](_0xb1ed65[_0xf0a4('0x48')]);_0x1b1ab7[_0xf0a4('0x49')]=_['intersection'](_0x1b1ab7[_0xf0a4('0x46')],_0x1b1ab7['query']);_0x4705c2[_0xf0a4('0x4a')]=_[_0xf0a4('0x4b')](_0x1b1ab7[_0xf0a4('0x46')],qs[_0xf0a4('0x4c')](_0xb1ed65['query'][_0xf0a4('0x4c')]));_0x4705c2['attributes']=_0x4705c2[_0xf0a4('0x4a')][_0xf0a4('0x4d')]?_0x4705c2[_0xf0a4('0x4a')]:_0x1b1ab7['model'];if(!_0xb1ed65[_0xf0a4('0x48')][_0xf0a4('0x4e')](_0xf0a4('0x4f'))){_0x4705c2[_0xf0a4('0x34')]=qs[_0xf0a4('0x34')](_0xb1ed65['query'][_0xf0a4('0x34')]);_0x4705c2[_0xf0a4('0x33')]=qs[_0xf0a4('0x33')](_0xb1ed65['query'][_0xf0a4('0x33')]);}_0x4705c2[_0xf0a4('0x50')]=qs[_0xf0a4('0x51')](_0xb1ed65[_0xf0a4('0x48')][_0xf0a4('0x51')]);_0x4705c2[_0xf0a4('0x52')]=qs['filters'](_[_0xf0a4('0x53')](_0xb1ed65['query'],_0x1b1ab7[_0xf0a4('0x49')]),_0x2047de);if(_0xb1ed65[_0xf0a4('0x48')][_0xf0a4('0x54')]){_0x4705c2['where']=_['merge'](_0x4705c2['where'],{'$or':_[_0xf0a4('0x41')](_0x2047de,function(_0x416d59){if(_0x416d59['type']!=='VIRTUAL'){var _0x3a3b57={};_0x3a3b57[_0x416d59[_0xf0a4('0x3e')]]={'$like':'%'+_0xb1ed65[_0xf0a4('0x48')][_0xf0a4('0x54')]+'%'};return _0x3a3b57;}})});}_0x4705c2=_[_0xf0a4('0x55')]({},_0x4705c2,_0xb1ed65[_0xf0a4('0x56')]);var _0x17ca54={'where':_0x4705c2[_0xf0a4('0x52')]};return db[_0xf0a4('0x42')]['count'](_0x17ca54)[_0xf0a4('0x23')](function(_0x106025){_0x59b1e1['count']=_0x106025;if(_0xb1ed65['query'][_0xf0a4('0x57')]){_0x4705c2['include']=[{'all':!![]}];}return db[_0xf0a4('0x42')][_0xf0a4('0x58')](_0x4705c2);})[_0xf0a4('0x23')](function(_0xf7a710){_0x59b1e1['rows']=_0xf7a710;return _0x59b1e1;})[_0xf0a4('0x23')](respondWithFilteredResult(_0x328472,_0x4705c2))['catch'](handleError(_0x328472,null));};exports[_0xf0a4('0x59')]=function(_0x36022d,_0x46f40a){var _0x1dc88a={'raw':![],'where':{'id':_0x36022d[_0xf0a4('0x5a')]['id']},'include':[{'model':db[_0xf0a4('0x5b')],'as':_0xf0a4('0x40')}]},_0x4f1ac1={};_0x4f1ac1[_0xf0a4('0x46')]=_[_0xf0a4('0x47')](db[_0xf0a4('0x42')][_0xf0a4('0x43')]);_0x4f1ac1[_0xf0a4('0x48')]=_[_0xf0a4('0x47')](_0x36022d[_0xf0a4('0x48')]);_0x4f1ac1['filters']=_[_0xf0a4('0x4b')](_0x4f1ac1[_0xf0a4('0x46')],_0x4f1ac1[_0xf0a4('0x48')]);_0x1dc88a[_0xf0a4('0x4a')]=_[_0xf0a4('0x4b')](_0x4f1ac1[_0xf0a4('0x46')],qs[_0xf0a4('0x4c')](_0x36022d[_0xf0a4('0x48')][_0xf0a4('0x4c')]));_0x1dc88a[_0xf0a4('0x4a')]=_0x1dc88a[_0xf0a4('0x4a')]['length']?_0x1dc88a[_0xf0a4('0x4a')]:_0x4f1ac1['model'];if(_0x36022d['query'][_0xf0a4('0x57')]){_0x1dc88a['include']=[{'all':!![]}];}_0x1dc88a=_[_0xf0a4('0x55')]({},_0x1dc88a,_0x36022d[_0xf0a4('0x56')]);return db['WhatsappAccount'][_0xf0a4('0x5c')](_0x1dc88a)[_0xf0a4('0x23')](handleEntityNotFound(_0x46f40a,null))[_0xf0a4('0x23')](respondWithResult(_0x46f40a,null))['catch'](handleError(_0x46f40a,null));};exports[_0xf0a4('0x5d')]=function(_0x4713d1,_0x8e9838){return db[_0xf0a4('0x42')][_0xf0a4('0x5d')](_0x4713d1[_0xf0a4('0x5e')],{})[_0xf0a4('0x23')](function(_0x2a7b4e){var _0x2eb06d=_0x4713d1[_0xf0a4('0x5f')][_0xf0a4('0x3a')]({'plain':!![]});if(!_0x2eb06d)throw new Error(_0xf0a4('0x60'));if(_0x2eb06d[_0xf0a4('0x61')]===_0xf0a4('0x5f')){var _0x20a054=_0x2a7b4e['get']({'plain':!![]});var _0xcf6eb5=_0xf0a4('0x62');return db['UserProfileSection']['find']({'where':{'name':_0xcf6eb5,'userProfileId':_0x2eb06d[_0xf0a4('0x63')]},'raw':!![]})[_0xf0a4('0x23')](function(_0x1ec5d6){if(_0x1ec5d6&&_0x1ec5d6[_0xf0a4('0x64')]===0x0){return db[_0xf0a4('0x3b')][_0xf0a4('0x5d')]({'name':_0x20a054[_0xf0a4('0x3e')],'resourceId':_0x20a054['id'],'type':_0x1ec5d6[_0xf0a4('0x3e')],'sectionId':_0x1ec5d6['id']},{})[_0xf0a4('0x23')](function(){return _0x2a7b4e;});}else{return _0x2a7b4e;}})[_0xf0a4('0x2e')](function(_0x42ea59){logger[_0xf0a4('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42ea59);throw _0x42ea59;});}return _0x2a7b4e;})['then'](respondWithResult(_0x8e9838,0xc9))[_0xf0a4('0x2e')](handleError(_0x8e9838,null));};exports['update']=function(_0x20c648,_0x2e64d0){if(_0x20c648[_0xf0a4('0x5e')]['id']){delete _0x20c648['body']['id'];}return db['WhatsappAccount'][_0xf0a4('0x5c')]({'where':{'id':_0x20c648['params']['id']},'include':[{'model':db['Pause'],'as':_0xf0a4('0x40')}]})['then'](handleEntityNotFound(_0x2e64d0,null))[_0xf0a4('0x23')](saveUpdates(_0x20c648[_0xf0a4('0x5e')],null))['then'](respondWithResult(_0x2e64d0,null))['catch'](handleError(_0x2e64d0,null));};exports[_0xf0a4('0x3c')]=function(_0x421ec0,_0x457794){return db[_0xf0a4('0x42')][_0xf0a4('0x5c')]({'where':{'id':_0x421ec0[_0xf0a4('0x5a')]['id']}})[_0xf0a4('0x23')](handleEntityNotFound(_0x457794,null))[_0xf0a4('0x23')](removeEntity(_0x457794,null))[_0xf0a4('0x2e')](handleError(_0x457794,null));};exports[_0xf0a4('0x65')]=function(_0x9f8cd4,_0x3d75b6){return db[_0xf0a4('0x42')][_0xf0a4('0x65')]()[_0xf0a4('0x23')](respondWithResult(_0x3d75b6,null))[_0xf0a4('0x2e')](handleError(_0x3d75b6,null));};exports[_0xf0a4('0x66')]=function(_0x54440c,_0x57fca8,_0x5100a9){if(_0x54440c['body']['id']){delete _0x54440c[_0xf0a4('0x5e')]['id'];}return db[_0xf0a4('0x42')]['find']({'where':{'id':_0x54440c[_0xf0a4('0x5a')]['id']}})[_0xf0a4('0x23')](handleEntityNotFound(_0x57fca8,null))[_0xf0a4('0x23')](function(_0x29427e){if(_0x29427e){_0x54440c[_0xf0a4('0x5e')]['WhatsappAccountId']=_0x29427e['id'];return db[_0xf0a4('0x67')][_0xf0a4('0x5d')](_0x54440c[_0xf0a4('0x5e')]);}})[_0xf0a4('0x23')](respondWithResult(_0x57fca8,null))[_0xf0a4('0x2e')](handleError(_0x57fca8,null));};exports[_0xf0a4('0x68')]=function(_0x104c1b,_0x443221,_0x230f79){var _0x213906={'raw':![],'where':{}};var _0x249d6e={};var _0x2d092f={'count':0x0,'rows':[]};return db[_0xf0a4('0x42')]['findOne']({'where':{'id':_0x104c1b[_0xf0a4('0x5a')]['id']}})[_0xf0a4('0x23')](handleEntityNotFound(_0x443221,null))[_0xf0a4('0x23')](function(_0x13d448){if(_0x13d448){_0x249d6e['model']=_[_0xf0a4('0x47')](db['Disposition'][_0xf0a4('0x43')]);_0x249d6e[_0xf0a4('0x48')]=_['keys'](_0x104c1b[_0xf0a4('0x48')]);_0x249d6e[_0xf0a4('0x49')]=_['intersection'](_0x249d6e[_0xf0a4('0x46')],_0x249d6e[_0xf0a4('0x48')]);_0x213906['attributes']=_[_0xf0a4('0x4b')](_0x249d6e[_0xf0a4('0x46')],qs[_0xf0a4('0x4c')](_0x104c1b['query'][_0xf0a4('0x4c')]));_0x213906[_0xf0a4('0x4a')]=_0x213906[_0xf0a4('0x4a')][_0xf0a4('0x4d')]?_0x213906['attributes']:_0x249d6e['model'];if(!_0x104c1b[_0xf0a4('0x48')]['hasOwnProperty'](_0xf0a4('0x4f'))){_0x213906['limit']=qs[_0xf0a4('0x34')](_0x104c1b[_0xf0a4('0x48')][_0xf0a4('0x34')]);_0x213906[_0xf0a4('0x33')]=qs[_0xf0a4('0x33')](_0x104c1b['query'][_0xf0a4('0x33')]);}_0x213906['order']=qs[_0xf0a4('0x51')](_0x104c1b[_0xf0a4('0x48')]['sort']);_0x213906[_0xf0a4('0x52')]=qs['filters'](_['pick'](_0x104c1b[_0xf0a4('0x48')],_0x249d6e[_0xf0a4('0x49')]));_0x213906[_0xf0a4('0x52')][_0xf0a4('0x69')]=_0x13d448['id'];if(_0x104c1b['query'][_0xf0a4('0x54')]){_0x213906[_0xf0a4('0x52')]=_[_0xf0a4('0x55')](_0x213906[_0xf0a4('0x52')],{'$or':_[_0xf0a4('0x41')](_0x213906['attributes'],function(_0x559ee2){var _0x2fa086={};_0x2fa086[_0x559ee2]={'$like':'%'+_0x104c1b['query'][_0xf0a4('0x54')]+'%'};return _0x2fa086;})});}_0x213906=_['merge']({},_0x213906,_0x104c1b['options']);return db[_0xf0a4('0x67')][_0xf0a4('0x6a')]({'where':_0x213906[_0xf0a4('0x52')]})[_0xf0a4('0x23')](function(_0x2dcf61){_0x2d092f['count']=_0x2dcf61;if(_0x104c1b['query']['includeAll']){_0x213906['include']=[{'all':!![]}];}return db[_0xf0a4('0x67')][_0xf0a4('0x58')](_0x213906);})[_0xf0a4('0x23')](function(_0x1751bc){_0x2d092f[_0xf0a4('0x6b')]=_0x1751bc;return _0x2d092f;});}})[_0xf0a4('0x23')](respondWithFilteredResult(_0x443221,_0x213906))[_0xf0a4('0x2e')](handleError(_0x443221,null));};exports[_0xf0a4('0x6c')]=function(_0x90e0cb,_0x480143,_0x15667e){return db['WhatsappAccount'][_0xf0a4('0x5c')]({'where':{'id':_0x90e0cb[_0xf0a4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x480143,null))['then'](function(_0x1b2552){if(_0x1b2552){return _0x1b2552[_0xf0a4('0x6c')](_0x90e0cb[_0xf0a4('0x48')][_0xf0a4('0x6d')]);}})[_0xf0a4('0x23')](respondWithStatusCode(_0x480143,null))['catch'](handleError(_0x480143,null));};exports['addAnswer']=function(_0xe07c77,_0x2e1f19,_0x153428){if(_0xe07c77['body']['id']){delete _0xe07c77['body']['id'];}return db[_0xf0a4('0x42')][_0xf0a4('0x5c')]({'where':{'id':_0xe07c77[_0xf0a4('0x5a')]['id']}})[_0xf0a4('0x23')](handleEntityNotFound(_0x2e1f19,null))[_0xf0a4('0x23')](function(_0x4d108c){if(_0x4d108c){_0xe07c77[_0xf0a4('0x5e')][_0xf0a4('0x69')]=_0x4d108c['id'];return db[_0xf0a4('0x6e')][_0xf0a4('0x5d')](_0xe07c77[_0xf0a4('0x5e')]);}})[_0xf0a4('0x23')](respondWithResult(_0x2e1f19,null))['catch'](handleError(_0x2e1f19,null));};exports[_0xf0a4('0x6f')]=function(_0x1488bd,_0x3ba751,_0x39c86c){var _0x457812={'raw':![],'where':{}};var _0x4f7f72={};var _0x30c2b4={'count':0x0,'rows':[]};return db[_0xf0a4('0x42')][_0xf0a4('0x70')]({'where':{'id':_0x1488bd[_0xf0a4('0x5a')]['id']}})[_0xf0a4('0x23')](handleEntityNotFound(_0x3ba751,null))[_0xf0a4('0x23')](function(_0x44b4b4){if(_0x44b4b4){_0x4f7f72[_0xf0a4('0x46')]=_[_0xf0a4('0x47')](db[_0xf0a4('0x6e')]['rawAttributes']);_0x4f7f72[_0xf0a4('0x48')]=_[_0xf0a4('0x47')](_0x1488bd[_0xf0a4('0x48')]);_0x4f7f72[_0xf0a4('0x49')]=_['intersection'](_0x4f7f72[_0xf0a4('0x46')],_0x4f7f72[_0xf0a4('0x48')]);_0x457812['attributes']=_[_0xf0a4('0x4b')](_0x4f7f72['model'],qs[_0xf0a4('0x4c')](_0x1488bd[_0xf0a4('0x48')][_0xf0a4('0x4c')]));_0x457812[_0xf0a4('0x4a')]=_0x457812['attributes'][_0xf0a4('0x4d')]?_0x457812[_0xf0a4('0x4a')]:_0x4f7f72['model'];if(!_0x1488bd['query'][_0xf0a4('0x4e')](_0xf0a4('0x4f'))){_0x457812['limit']=qs[_0xf0a4('0x34')](_0x1488bd[_0xf0a4('0x48')][_0xf0a4('0x34')]);_0x457812[_0xf0a4('0x33')]=qs['offset'](_0x1488bd[_0xf0a4('0x48')]['offset']);}_0x457812[_0xf0a4('0x50')]=qs[_0xf0a4('0x51')](_0x1488bd['query']['sort']);_0x457812[_0xf0a4('0x52')]=qs[_0xf0a4('0x49')](_['pick'](_0x1488bd['query'],_0x4f7f72['filters']));_0x457812[_0xf0a4('0x52')]['WhatsappAccountId']=_0x44b4b4['id'];if(_0x1488bd[_0xf0a4('0x48')][_0xf0a4('0x54')]){_0x457812[_0xf0a4('0x52')]=_[_0xf0a4('0x55')](_0x457812[_0xf0a4('0x52')],{'$or':_['map'](_0x457812[_0xf0a4('0x4a')],function(_0x57c050){var _0x50388e={};_0x50388e[_0x57c050]={'$like':'%'+_0x1488bd[_0xf0a4('0x48')][_0xf0a4('0x54')]+'%'};return _0x50388e;})});}_0x457812=_['merge']({},_0x457812,_0x1488bd[_0xf0a4('0x56')]);return db[_0xf0a4('0x6e')][_0xf0a4('0x6a')]({'where':_0x457812['where']})[_0xf0a4('0x23')](function(_0x3ec2fe){_0x30c2b4[_0xf0a4('0x6a')]=_0x3ec2fe;if(_0x1488bd[_0xf0a4('0x48')]['includeAll']){_0x457812[_0xf0a4('0x71')]=[{'all':!![]}];}return db['CannedAnswer'][_0xf0a4('0x58')](_0x457812);})[_0xf0a4('0x23')](function(_0x1044cd){_0x30c2b4[_0xf0a4('0x6b')]=_0x1044cd;return _0x30c2b4;});}})[_0xf0a4('0x23')](respondWithFilteredResult(_0x3ba751,_0x457812))[_0xf0a4('0x2e')](handleError(_0x3ba751,null));};exports[_0xf0a4('0x72')]=function(_0x15db09,_0x5497ae,_0x116866){return db[_0xf0a4('0x42')][_0xf0a4('0x5c')]({'where':{'id':_0x15db09[_0xf0a4('0x5a')]['id']}})[_0xf0a4('0x23')](handleEntityNotFound(_0x5497ae,null))[_0xf0a4('0x23')](function(_0x17a8e3){if(_0x17a8e3){return _0x17a8e3[_0xf0a4('0x72')](_0x15db09[_0xf0a4('0x48')][_0xf0a4('0x6d')]);}})[_0xf0a4('0x23')](respondWithStatusCode(_0x5497ae,null))['catch'](handleError(_0x5497ae,null));};exports['addAgents']=function(_0x4440ac,_0x2d8fc4,_0x33b70b){return db['WhatsappAccount'][_0xf0a4('0x5c')]({'where':{'id':_0x4440ac[_0xf0a4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2d8fc4,null))['then'](function(_0x36f8d5){if(_0x36f8d5){return _0x36f8d5[_0xf0a4('0x73')](_0x4440ac[_0xf0a4('0x5e')][_0xf0a4('0x6d')],_['omit'](_0x4440ac['body'],[_0xf0a4('0x6d'),'id'])||{})[_0xf0a4('0x74')](function(_0x2969fc){for(var _0x209104=0x0;_0x209104<_0x4440ac['body']['ids'][_0xf0a4('0x4d')];_0x209104+=0x1){socket[_0xf0a4('0x75')]('userWhatsappAccount:save',{'UserId':_0x4440ac['body']['ids'][_0x209104],'WhatsappAccountId':_0x4440ac['params']['id']});}return _0x2969fc;});}})[_0xf0a4('0x23')](respondWithResult(_0x2d8fc4,null))['catch'](handleError(_0x2d8fc4,null));};exports['removeAgents']=function(_0x8325e4,_0x298358,_0x2600d9){return db[_0xf0a4('0x42')][_0xf0a4('0x5c')]({'where':{'id':_0x8325e4[_0xf0a4('0x5a')]['id']}})[_0xf0a4('0x23')](handleEntityNotFound(_0x298358,null))['then'](function(_0x402df2){if(_0x402df2){return _0x402df2[_0xf0a4('0x76')](_0x8325e4[_0xf0a4('0x48')][_0xf0a4('0x6d')])[_0xf0a4('0x23')](function(){if(_['isArray'](_0x8325e4[_0xf0a4('0x48')][_0xf0a4('0x6d')])){for(var _0x5f58de=0x0;_0x5f58de<_0x8325e4[_0xf0a4('0x48')][_0xf0a4('0x6d')][_0xf0a4('0x4d')];_0x5f58de+=0x1){socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x8325e4[_0xf0a4('0x48')][_0xf0a4('0x6d')][_0x5f58de]),'WhatsappAccountId':Number(_0x8325e4['params']['id'])});}}else{socket['emit'](_0xf0a4('0x77'),{'UserId':Number(_0x8325e4['query'][_0xf0a4('0x6d')]),'WhatsappAccountId':Number(_0x8325e4['params']['id'])});}});}})['then'](respondWithStatusCode(_0x298358,null))[_0xf0a4('0x2e')](handleError(_0x298358,null));};exports['getAgents']=function(_0xcbef60,_0x1dd760,_0x4e982f){var _0x4700ec={};var _0xd8c1ae={};var _0x1c1526;var _0x40663c;return db[_0xf0a4('0x42')][_0xf0a4('0x70')]({'where':{'id':_0xcbef60['params']['id']}})[_0xf0a4('0x23')](handleEntityNotFound(_0x1dd760,null))[_0xf0a4('0x23')](function(_0x890a54){if(_0x890a54){_0x1c1526=_0x890a54;_0xd8c1ae[_0xf0a4('0x46')]=_[_0xf0a4('0x47')](db[_0xf0a4('0x78')][_0xf0a4('0x43')]);_0xd8c1ae[_0xf0a4('0x48')]=_[_0xf0a4('0x47')](_0xcbef60[_0xf0a4('0x48')]);_0xd8c1ae[_0xf0a4('0x49')]=_[_0xf0a4('0x4b')](_0xd8c1ae[_0xf0a4('0x46')],_0xd8c1ae[_0xf0a4('0x48')]);_0x4700ec[_0xf0a4('0x4a')]=_[_0xf0a4('0x4b')](_0xd8c1ae[_0xf0a4('0x46')],qs['fields'](_0xcbef60['query']['fields']));_0x4700ec['attributes']=_0x4700ec[_0xf0a4('0x4a')][_0xf0a4('0x4d')]?_0x4700ec[_0xf0a4('0x4a')]:_0xd8c1ae[_0xf0a4('0x46')];_0x4700ec[_0xf0a4('0x50')]=qs[_0xf0a4('0x51')](_0xcbef60[_0xf0a4('0x48')]['sort']);_0x4700ec[_0xf0a4('0x52')]=qs[_0xf0a4('0x49')](_[_0xf0a4('0x53')](_0xcbef60['query'],_0xd8c1ae[_0xf0a4('0x49')]));if(_0xcbef60[_0xf0a4('0x48')][_0xf0a4('0x54')]){_0x4700ec[_0xf0a4('0x52')]=_[_0xf0a4('0x55')](_0x4700ec[_0xf0a4('0x52')],{'$or':_[_0xf0a4('0x41')](_0x4700ec[_0xf0a4('0x4a')],function(_0x18b95d){var _0x158b5f={};_0x158b5f[_0x18b95d]={'$like':'%'+_0xcbef60[_0xf0a4('0x48')][_0xf0a4('0x54')]+'%'};return _0x158b5f;})});}_0x4700ec=_['merge']({},_0x4700ec,_0xcbef60[_0xf0a4('0x56')]);return _0x1c1526[_0xf0a4('0x79')](_0x4700ec);}})['then'](function(_0x22dc77){if(_0x22dc77){_0x40663c=_0x22dc77[_0xf0a4('0x4d')];if(!_0xcbef60[_0xf0a4('0x48')][_0xf0a4('0x4e')](_0xf0a4('0x4f'))){_0x4700ec[_0xf0a4('0x34')]=qs[_0xf0a4('0x34')](_0xcbef60['query'][_0xf0a4('0x34')]);_0x4700ec[_0xf0a4('0x33')]=qs[_0xf0a4('0x33')](_0xcbef60[_0xf0a4('0x48')][_0xf0a4('0x33')]);}return _0x1c1526['getAgents'](_0x4700ec);}})[_0xf0a4('0x23')](function(_0x3f624a){if(_0x3f624a){return _0x3f624a?{'count':_0x40663c,'rows':_0x3f624a}:null;}})[_0xf0a4('0x23')](respondWithResult(_0x1dd760,null))[_0xf0a4('0x2e')](handleError(_0x1dd760,null));};exports[_0xf0a4('0x7a')]=function(_0x43ceb4,_0xbf03b3,_0x309102){return db[_0xf0a4('0x42')]['findOne']({'where':{'id':_0x43ceb4[_0xf0a4('0x5a')]['id']}})[_0xf0a4('0x23')](handleEntityNotFound(_0xbf03b3,null))['then'](function(_0x16c82d){if(_0x16c82d){return db[_0xf0a4('0x7b')][_0xf0a4('0x7c')](function(_0x3d3420){return db[_0xf0a4('0x7d')][_0xf0a4('0x3c')]({'where':{'WhatsappAccountId':_0x43ceb4[_0xf0a4('0x5a')]['id']},'transaction':_0x3d3420})[_0xf0a4('0x23')](function(_0x3b1594){var _0x4ef8fc=_[_0xf0a4('0x41')](_0x43ceb4[_0xf0a4('0x5e')],function(_0x3b91d8){_0x3b91d8[_0xf0a4('0x69')]=_0x43ceb4[_0xf0a4('0x5a')]['id'];return _0x3b91d8;});return db['WhatsappApplication']['bulkCreate'](_0x4ef8fc,{'transaction':_0x3d3420});});})[_0xf0a4('0x23')](function(){return db[_0xf0a4('0x7d')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x43ceb4[_0xf0a4('0x5a')]['id']},'order':_0xf0a4('0x7e')});});}})[_0xf0a4('0x23')](respondWithResult(_0xbf03b3,null))[_0xf0a4('0x2e')](handleError(_0xbf03b3,null));};exports[_0xf0a4('0x7f')]=function(_0x4d9a27,_0x3960fd,_0x59b7b4){var _0x30a74a={};var _0x303e50={};var _0x126384;var _0x5787b4;return db['WhatsappAccount'][_0xf0a4('0x70')]({'where':{'id':_0x4d9a27['params']['id']}})[_0xf0a4('0x23')](handleEntityNotFound(_0x3960fd,null))[_0xf0a4('0x23')](function(_0x399313){if(_0x399313){_0x126384=_0x399313;_0x303e50[_0xf0a4('0x46')]=_[_0xf0a4('0x47')](db[_0xf0a4('0x7d')][_0xf0a4('0x43')]);_0x303e50[_0xf0a4('0x48')]=_[_0xf0a4('0x47')](_0x4d9a27[_0xf0a4('0x48')]);_0x303e50[_0xf0a4('0x49')]=_[_0xf0a4('0x4b')](_0x303e50['model'],_0x303e50[_0xf0a4('0x48')]);_0x30a74a[_0xf0a4('0x4a')]=_[_0xf0a4('0x4b')](_0x303e50[_0xf0a4('0x46')],qs[_0xf0a4('0x4c')](_0x4d9a27[_0xf0a4('0x48')][_0xf0a4('0x4c')]));_0x30a74a['attributes']=_0x30a74a[_0xf0a4('0x4a')][_0xf0a4('0x4d')]?_0x30a74a[_0xf0a4('0x4a')]:_0x303e50[_0xf0a4('0x46')];_0x30a74a[_0xf0a4('0x50')]=qs['sort'](_0x4d9a27[_0xf0a4('0x48')][_0xf0a4('0x51')]);_0x30a74a[_0xf0a4('0x52')]=qs[_0xf0a4('0x49')](_['pick'](_0x4d9a27[_0xf0a4('0x48')],_0x303e50[_0xf0a4('0x49')]));if(_0x4d9a27[_0xf0a4('0x48')]['filter']){_0x30a74a[_0xf0a4('0x52')]=_[_0xf0a4('0x55')](_0x30a74a[_0xf0a4('0x52')],{'$or':_[_0xf0a4('0x41')](_0x30a74a[_0xf0a4('0x4a')],function(_0x5ce1a3){var _0x44a4a1={};_0x44a4a1[_0x5ce1a3]={'$like':'%'+_0x4d9a27['query'][_0xf0a4('0x54')]+'%'};return _0x44a4a1;})});}_0x30a74a=_['merge']({},_0x30a74a,_0x4d9a27[_0xf0a4('0x56')]);return _0x126384[_0xf0a4('0x7f')](_0x30a74a);}})[_0xf0a4('0x23')](function(_0x995abd){if(_0x995abd){_0x5787b4=_0x995abd[_0xf0a4('0x4d')];if(!_0x4d9a27[_0xf0a4('0x48')]['hasOwnProperty'](_0xf0a4('0x4f'))){_0x30a74a[_0xf0a4('0x34')]=qs[_0xf0a4('0x34')](_0x4d9a27['query'][_0xf0a4('0x34')]);_0x30a74a[_0xf0a4('0x33')]=qs[_0xf0a4('0x33')](_0x4d9a27[_0xf0a4('0x48')][_0xf0a4('0x33')]);}return _0x126384['getApplications'](_0x30a74a);}})[_0xf0a4('0x23')](function(_0x2b970b){if(_0x2b970b){return _0x2b970b?{'count':_0x5787b4,'rows':_0x2b970b}:null;}})[_0xf0a4('0x23')](respondWithResult(_0x3960fd,null))[_0xf0a4('0x2e')](handleError(_0x3960fd,null));};exports[_0xf0a4('0x80')]=function(_0x537800,_0xf9fa6a,_0x1d5a14){var _0x723b9d={'channel':_0xf0a4('0x81')};var _0xd7557a=[];var _0x5cddb8=[];var _0x368627={};return db[_0xf0a4('0x42')][_0xf0a4('0x5c')]({'where':{'id':_0x537800[_0xf0a4('0x5a')]['id']},'include':[{'model':db[_0xf0a4('0x7d')],'as':'Applications'}]})[_0xf0a4('0x23')](handleEntityNotFound(_0xf9fa6a,null))['then'](function(_0x2f6214){_0x723b9d[_0xf0a4('0x82')]=_0x2f6214;_0x723b9d[_0xf0a4('0x83')]=_['orderBy'](_0x2f6214[_0xf0a4('0x84')],['priority'],[_0xf0a4('0x85')]);if(_0x723b9d[_0xf0a4('0x82')][_0xf0a4('0x84')]){delete _0x723b9d[_0xf0a4('0x82')][_0xf0a4('0x84')];}return db[_0xf0a4('0x86')][_0xf0a4('0x65')]();})[_0xf0a4('0x23')](function(_0x5e5915){if(!_0x5e5915){throw new db[(_0xf0a4('0x87'))]['ValidationError'](_0xf0a4('0x88'));}_0xd7557a=_[_0xf0a4('0x89')](_[_0xf0a4('0x47')](_0x5e5915),[_0xf0a4('0x8a'),_0xf0a4('0x8b')]);_0x5cddb8=_[_0xf0a4('0x89')](_[_0xf0a4('0x47')](_0x5e5915),[_0xf0a4('0x8a'),_0xf0a4('0x8b'),_0xf0a4('0x8c'),_0xf0a4('0x8d')]);_0x723b9d[_0xf0a4('0x5e')]={'mapKey':'mobile'};if(_0x723b9d['account']['type']&&_0x723b9d[_0xf0a4('0x82')]['type']===_0xf0a4('0x8e')){_0x723b9d['body'][_0xf0a4('0x8f')]=_0x537800[_0xf0a4('0x5e')]['From']['replace'](_0xf0a4('0x90'),'');_0x723b9d['body'][_0xf0a4('0x5e')]=_0x537800[_0xf0a4('0x5e')]['Body'];_0x723b9d[_0xf0a4('0x5e')][_0xf0a4('0x91')]=_0x537800[_0xf0a4('0x5e')]['MessageSid'];}if(_0x723b9d[_0xf0a4('0x5e')]['id']){delete _0x723b9d[_0xf0a4('0x5e')]['id'];}if(_[_0xf0a4('0x92')](_0x723b9d['body'][_0xf0a4('0x8f')])){throw new db[(_0xf0a4('0x87'))][(_0xf0a4('0x93'))](_0xf0a4('0x94'));}if(_[_0xf0a4('0x92')](_0x723b9d[_0xf0a4('0x5e')][_0xf0a4('0x5e')])||_0x723b9d[_0xf0a4('0x5e')][_0xf0a4('0x5e')]===''){throw new db['Sequelize'][(_0xf0a4('0x93'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xf0a4('0x92')](_0x723b9d[_0xf0a4('0x5e')][_0xf0a4('0x95')])){throw new db[(_0xf0a4('0x87'))][(_0xf0a4('0x93'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5cddb8);}if(!_[_0xf0a4('0x96')](_0x5cddb8,_0x723b9d[_0xf0a4('0x5e')][_0xf0a4('0x95')])){throw new db[(_0xf0a4('0x87'))][(_0xf0a4('0x93'))](_0xf0a4('0x97')+_0x5cddb8);}_0x368627[_0x723b9d['body']['mapKey']]=_0x723b9d[_0xf0a4('0x5e')]['from'];return db['CmList']['find']({'where':{'id':_0x723b9d[_0xf0a4('0x82')][_0xf0a4('0x8d')]},'include':[{'model':db[_0xf0a4('0x86')],'as':_0xf0a4('0x98'),'where':_0x368627,'limit':0x1,'order':[[_0xf0a4('0x8b'),_0xf0a4('0x99')]]}]});})[_0xf0a4('0x23')](handleEntityNotFound(_0xf9fa6a,null))[_0xf0a4('0x23')](function(_0x53ed1d){if(_0x53ed1d){_0x723b9d[_0xf0a4('0x9a')]=_[_0xf0a4('0x9b')](_0x53ed1d,[_0xf0a4('0x98')]);if(_0x53ed1d[_0xf0a4('0x98')]['length']){return _0x53ed1d[_0xf0a4('0x98')][0x0];}var _0x115548=_[_0xf0a4('0x9c')](_0x723b9d['body'],{'firstName':_0x723b9d[_0xf0a4('0x5e')][_0xf0a4('0x8f')],'ListId':_0x53ed1d['id']});_0x115548[_0x723b9d[_0xf0a4('0x5e')][_0xf0a4('0x95')]]=_0x723b9d[_0xf0a4('0x5e')][_0xf0a4('0x8f')];return db[_0xf0a4('0x86')][_0xf0a4('0x5d')](_0x115548,{'fields':_0xd7557a,'raw':!![]});}})[_0xf0a4('0x23')](handleEntityNotFound(_0xf9fa6a,null))[_0xf0a4('0x23')](function(_0x19c651){if(_0x19c651){_0x723b9d[_0xf0a4('0x9d')]=_0x19c651;var _0x21d2a0={'ContactId':_0x19c651['id'],'phone':_0x723b9d['body'][_0xf0a4('0x8f')],'WhatsappAccountId':_0x537800[_0xf0a4('0x5a')]['id']};var _0x2fe3b1={'ContactId':_0x19c651['id'],'WhatsappAccountId':_0x537800[_0xf0a4('0x5a')]['id'],'closed':![]};return db[_0xf0a4('0x9e')][_0xf0a4('0x5c')]({'where':_0x2fe3b1})['then'](function(_0x5de094){if(_0x5de094){return[_0x5de094,![]];}return db[_0xf0a4('0x9e')][_0xf0a4('0x5d')](_0x21d2a0)['then'](function(_0x159956){return[_0x159956,!![]];});});}})[_0xf0a4('0x74')](function(_0x5a80bc,_0x156184){_0x723b9d['interaction']=_0x5a80bc[_0xf0a4('0x3a')]({'plain':!![]});_0x723b9d[_0xf0a4('0x9f')][_0xf0a4('0xa0')]=![];if(_0x156184){if(_0x723b9d[_0xf0a4('0x82')]['autoclose']){_0x723b9d[_0xf0a4('0x83')][_0xf0a4('0xa1')]({'id':0x0,'priority':_0x723b9d[_0xf0a4('0x83')]['length']+0x1,'app':_0xf0a4('0xa2'),'appdata':_0xf0a4('0xa3'),'interval':'*,*,*,*'});}_0x723b9d['interaction']['created']=!![];}return db['WhatsappMessage'][_0xf0a4('0x5d')]({'phone':_0x723b9d[_0xf0a4('0x5e')][_0xf0a4('0x8f')],'messageId':_0x723b9d[_0xf0a4('0x5e')][_0xf0a4('0x91')],'body':_0x723b9d[_0xf0a4('0x5e')][_0xf0a4('0x5e')],'WhatsappAccountId':_0x537800[_0xf0a4('0x5a')]['id'],'WhatsappInteractionId':_0x5a80bc['id'],'direction':'in','ContactId':_0x5a80bc[_0xf0a4('0xa4')],'AttachmentId':_0x723b9d[_0xf0a4('0x5e')]['AttachmentId']});})[_0xf0a4('0x23')](function(_0x542f32){_0x723b9d[_0xf0a4('0x2b')]=_0x542f32;if(_0x723b9d[_0xf0a4('0x9f')][_0xf0a4('0xa5')]){return db[_0xf0a4('0x78')][_0xf0a4('0x5c')]({'attributes':['id',_0xf0a4('0x3e')],'where':{'id':_0x723b9d[_0xf0a4('0x9f')]['UserId']}})[_0xf0a4('0x23')](function(_0x13fa50){if(_0x13fa50){_0x723b9d[_0xf0a4('0x83')][_0xf0a4('0xa6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x13fa50[_0xf0a4('0x3e')]+','+(_0x723b9d[_0xf0a4('0x82')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xf0a4('0xa7'),_0xf0a4('0xa8'),_0x723b9d);});}return respondWithRpcPromise(_0xf0a4('0xa7'),_0xf0a4('0xa8'),_0x723b9d);})['then'](function(_0x217a48){if(_0x217a48){var _0x5ea283=0xc8;var _0xb29d20=_0xf0a4('0xa9');logger['info'](_0xf0a4('0x27'),_0xb29d20,_0x5ea283,_0xf0a4('0xaa'));logger[_0xf0a4('0x26')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0xb29d20,_0x5ea283,_0xf0a4('0xaa'),JSON[_0xf0a4('0x28')](_0x217a48));if(_0x723b9d[_0xf0a4('0x82')][_0xf0a4('0x45')]==='twilio'){return _0xf9fa6a['status'](_0x5ea283)['set']('Content-Type',_0xf0a4('0xab'))[_0xf0a4('0xac')](_0xf0a4('0xad'));}else{return _0xf9fa6a['status'](_0x5ea283)['json'](_0x217a48);}}})['catch'](handleError(_0xf9fa6a,null));};exports[_0xf0a4('0xac')]=function(_0x328e2c,_0x4b22df,_0x4d4a1e){var _0x442662,_0x425f10,_0x16dc3d;if(_[_0xf0a4('0x92')](_0x328e2c['body']['body'])||_0x328e2c[_0xf0a4('0x5e')]['body']===''){throw new db['Sequelize'][(_0xf0a4('0x93'))](_0xf0a4('0xae'));}if(_[_0xf0a4('0x92')](_0x328e2c[_0xf0a4('0x5e')]['to'])){throw new db[(_0xf0a4('0x87'))][(_0xf0a4('0x93'))](_0xf0a4('0xaf'));}_0x442662=_0x328e2c[_0xf0a4('0x5e')]['to'];return db[_0xf0a4('0x42')]['find']({'where':{'id':_0x328e2c[_0xf0a4('0x5a')]['id']},'include':[{'model':db['CmList'],'as':_0xf0a4('0xb0'),'include':[{'model':db[_0xf0a4('0x86')],'as':_0xf0a4('0x98'),'where':{'mobile':_0x442662},'limit':0x1,'order':[[_0xf0a4('0x8b'),_0xf0a4('0x99')]]}]}]})['then'](handleEntityNotFound(_0x4b22df,null))[_0xf0a4('0x23')](function(_0x5e37a7){if(_0x5e37a7&&_0x5e37a7[_0xf0a4('0xb0')]){_0x425f10=_0x5e37a7[_0xf0a4('0x3a')]({'plain':!![]});if(_0x425f10['List']&&_0x425f10['List'][_0xf0a4('0x98')][_0xf0a4('0x4d')]){return _0x425f10[_0xf0a4('0xb0')]['Contacts'][0x0];}return db[_0xf0a4('0x86')][_0xf0a4('0x5d')](_[_0xf0a4('0x9c')](_0x328e2c[_0xf0a4('0x5e')],{'firstName':_0x442662,'mobile':_0x442662,'phone':_0x442662,'ListId':_0x425f10[_0xf0a4('0x8d')]}));}})[_0xf0a4('0x23')](handleEntityNotFound(_0x4b22df,null))[_0xf0a4('0x23')](function(_0x595e60){if(_0x595e60){_0x16dc3d=_0x595e60;return db[_0xf0a4('0x9e')]['find']({'where':{'ContactId':_0x16dc3d['id'],'closed':![],'WhatsappAccountId':_0x425f10['id']}})[_0xf0a4('0x23')](function(_0x3353fd){if(_0x3353fd){return[_0x3353fd,![]];}return db[_0xf0a4('0x9e')][_0xf0a4('0x5d')]({'UserId':_0x328e2c[_0xf0a4('0x5f')]['id'],'ContactId':_0x16dc3d['id'],'WhatsappAccountId':_0x425f10['id'],'phone':_0x442662,'firstMsgDirection':_0xf0a4('0xb1'),'Messages':[_['merge'](_0x328e2c['body'],{'read':![],'body':_0x328e2c[_0xf0a4('0x5e')]['body'],'phone':_0x442662,'WhatsappAccountId':_0x425f10['id'],'UserId':_0x328e2c[_0xf0a4('0x5f')]['id'],'ContactId':_0x16dc3d['id']})]},{'include':[{'model':db[_0xf0a4('0xb2')],'as':_0xf0a4('0xb3')}]})[_0xf0a4('0x23')](function(_0x5d1b56){return[_0x5d1b56,!![]];});});}})['spread'](function(_0x14cffc,_0x3bfc06){if(_0x3bfc06){return _0x14cffc;}return db['WhatsappMessage'][_0xf0a4('0x5d')](_[_0xf0a4('0x55')](_0x328e2c[_0xf0a4('0x5e')],{'read':![],'body':_0x328e2c['body'][_0xf0a4('0x5e')],'phone':_0x442662,'WhatsappAccountId':_0x425f10['id'],'WhatsappInteractionId':_0x14cffc['id'],'UserId':_0x328e2c[_0xf0a4('0x5f')]['id'],'ContactId':_0x16dc3d['id']}))[_0xf0a4('0x23')](function(_0x187074){_0x14cffc['dataValues'][_0xf0a4('0xb3')]=[];_0x14cffc[_0xf0a4('0xb4')]['Messages'][_0xf0a4('0xa1')](_0x187074[_0xf0a4('0xb4')]);return _0x14cffc;});})[_0xf0a4('0x23')](respondWithResult(_0x4b22df,null))[_0xf0a4('0x2e')](handleError(_0x4b22df,null));}; \ No newline at end of file +var _0x329a=['json','count','offset','set','Content-Range','apply','reject','save','update','get','WhatsappAccounts','UserProfileResource','stack','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','key','name','query','keys','intersection','model','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','fields','length','includeAll','find','user','role','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','Disposition','findOne','WhatsappAccountId','removeDispositions','CannedAnswer','getAnswers','removeAnswers','addAgents','ids','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','sequelize','transaction','WhatsappApplication','findAndCountAll','priority','getApplications','notify','whatsapp','applications','orderBy','Applications','account','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','type','twilio','from','From','replace','Body','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','Contacts','WhatsappInteraction','interaction','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','\x0a','List','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','../../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','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end'];(function(_0x55b3b5,_0x254983){var _0x5297a9=function(_0x5f302f){while(--_0x5f302f){_0x55b3b5['push'](_0x55b3b5['shift']());}};_0x5297a9(++_0x254983);}(_0x329a,0x85));var _0xa329=function(_0x1aeaaf,_0x2572d3){_0x1aeaaf=_0x1aeaaf-0x0;var _0x8bd35=_0x329a[_0x1aeaaf];return _0x8bd35;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa329('0x0'));var zipdir=require(_0xa329('0x1'));var jsonpatch=require(_0xa329('0x2'));var rp=require(_0xa329('0x3'));var moment=require('moment');var BPromise=require(_0xa329('0x4'));var Mustache=require(_0xa329('0x5'));var util=require(_0xa329('0x6'));var path=require(_0xa329('0x7'));var sox=require(_0xa329('0x8'));var csv=require('to-csv');var ejs=require(_0xa329('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa329('0xa'));var crypto=require(_0xa329('0xb'));var jsforce=require(_0xa329('0xc'));var deskjs=require(_0xa329('0xd'));var toCsv=require(_0xa329('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa329('0xf'));var qs=require(_0xa329('0x10'));var as=require(_0xa329('0x11'));var hardwareService=require(_0xa329('0x12'));var logger=require(_0xa329('0x13'))(_0xa329('0x14'));var utils=require(_0xa329('0x15'));var config=require(_0xa329('0x16'));var licenseUtil=require(_0xa329('0x17'));var db=require(_0xa329('0x18'))['db'];config['redis']=_[_0xa329('0x19')](config[_0xa329('0x1a')],{'host':_0xa329('0x1b'),'port':0x18eb});var socket=require(_0xa329('0x1c'))(new Redis(config['redis']));require(_0xa329('0x1d'))[_0xa329('0x1e')](socket);var jayson=require(_0xa329('0x1f'));var client=jayson['client'][_0xa329('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x2e7412,_0x3db3eb,_0xb3e9a7,_0x1752d4){return new BPromise(function(_0x2ef9de,_0x45d0bf){var _0x255363=_0x1752d4||client;return _0x255363[_0xa329('0x21')](_0x2e7412,_0xb3e9a7)[_0xa329('0x22')](function(_0x128954){logger[_0xa329('0x23')](_0xa329('0x24'),_0x3db3eb,_0xa329('0x25'));logger[_0xa329('0x26')](_0xa329('0x27'),_0x3db3eb,'request\x20sent',JSON[_0xa329('0x28')](_0x128954));if(_0x128954[_0xa329('0x29')]){if(_0x128954['error'][_0xa329('0x2a')]===0x1f4){logger['error'](_0xa329('0x24'),_0x3db3eb,_0x128954[_0xa329('0x29')][_0xa329('0x2b')]);return _0x45d0bf(_0x128954[_0xa329('0x29')]['message']);}logger[_0xa329('0x29')]('WhatsappAccount,\x20%s,\x20%s',_0x3db3eb,_0x128954[_0xa329('0x29')][_0xa329('0x2b')]);return _0x2ef9de(_0x128954[_0xa329('0x29')][_0xa329('0x2b')]);}else{logger[_0xa329('0x23')](_0xa329('0x24'),_0x3db3eb,'request\x20sent');_0x2ef9de(_0x128954[_0xa329('0x2c')]['message']);}})[_0xa329('0x2d')](function(_0x438442){logger[_0xa329('0x29')](_0xa329('0x24'),_0x3db3eb,_0x438442);_0x45d0bf(_0x438442);});});}function respondWithStatusCode(_0x192e15,_0xd5bf1a){_0xd5bf1a=_0xd5bf1a||0xcc;return function(_0x134e94){if(_0x134e94){return _0x192e15[_0xa329('0x2e')](_0xd5bf1a);}return _0x192e15[_0xa329('0x2f')](_0xd5bf1a)[_0xa329('0x30')]();};}function respondWithResult(_0x59daa7,_0x5a6f63){_0x5a6f63=_0x5a6f63||0xc8;return function(_0x2a7b6e){if(_0x2a7b6e){return _0x59daa7[_0xa329('0x2f')](_0x5a6f63)[_0xa329('0x31')](_0x2a7b6e);}};}function respondWithFilteredResult(_0x22cbc6,_0x31fb85){return function(_0x4e4c01){if(_0x4e4c01){var _0x49c8b5=_0x4e4c01[_0xa329('0x32')],_0x3dc619=_0x31fb85[_0xa329('0x33')],_0x1bd141=_0x31fb85['offset']+_0x31fb85['limit'],_0x4ecbf6;if(_0x1bd141>=_0x49c8b5){_0x1bd141=_0x49c8b5;_0x4ecbf6=0xc8;}else{_0x4ecbf6=0xce;}_0x22cbc6['status'](_0x4ecbf6);return _0x22cbc6[_0xa329('0x34')](_0xa329('0x35'),_0x3dc619+'-'+_0x1bd141+'/'+_0x49c8b5)[_0xa329('0x31')](_0x4e4c01);}return null;};}function patchUpdates(_0x23fe8f){return function(_0x5659f6){try{jsonpatch[_0xa329('0x36')](_0x5659f6,_0x23fe8f,!![]);}catch(_0x587c3d){return BPromise[_0xa329('0x37')](_0x587c3d);}return _0x5659f6[_0xa329('0x38')]();};}function saveUpdates(_0x173719,_0x427c32){return function(_0x572ad0){if(_0x572ad0){return _0x572ad0[_0xa329('0x39')](_0x173719)[_0xa329('0x22')](function(_0x2658e6){return _0x2658e6;});}return null;};}function removeEntity(_0x351f72,_0x18b47a){return function(_0x122156){if(_0x122156){return _0x122156['destroy']()[_0xa329('0x22')](function(){var _0x2673fc=_0x122156[_0xa329('0x3a')]({'plain':!![]});var _0x51f62d=_0xa329('0x3b');return db[_0xa329('0x3c')]['destroy']({'where':{'type':_0x51f62d,'resourceId':_0x2673fc['id']}})[_0xa329('0x22')](function(){return _0x122156;});})[_0xa329('0x22')](function(){_0x351f72[_0xa329('0x2f')](0xcc)[_0xa329('0x30')]();});}};}function handleEntityNotFound(_0x7306e0,_0x32dba4){return function(_0x5e38c9){if(!_0x5e38c9){_0x7306e0['sendStatus'](0x194);}return _0x5e38c9;};}function handleError(_0x3a1653,_0xa269f4){_0xa269f4=_0xa269f4||0x1f4;return function(_0x22b271){logger[_0xa329('0x29')](_0x22b271[_0xa329('0x3d')]);if(_0x22b271['name']){delete _0x22b271['name'];}_0x3a1653[_0xa329('0x2f')](_0xa269f4)[_0xa329('0x3e')](_0x22b271);};}exports[_0xa329('0x3f')]=function(_0x3ca466,_0x4f17d7){var _0x294e72={'include':[{'model':db[_0xa329('0x40')],'as':_0xa329('0x41')}]},_0x5f4181={},_0x51acfd={'count':0x0,'rows':[]};var _0x236fa8=_[_0xa329('0x42')](db[_0xa329('0x43')][_0xa329('0x44')],function(_0x2c1066){return{'name':_0x2c1066[_0xa329('0x45')],'type':_0x2c1066['type'][_0xa329('0x46')]};});_0x5f4181['model']=_[_0xa329('0x42')](_0x236fa8,_0xa329('0x47'));_0x5f4181[_0xa329('0x48')]=_[_0xa329('0x49')](_0x3ca466['query']);_0x5f4181['filters']=_[_0xa329('0x4a')](_0x5f4181[_0xa329('0x4b')],_0x5f4181['query']);_0x294e72['attributes']=_['intersection'](_0x5f4181[_0xa329('0x4b')],qs['fields'](_0x3ca466['query']['fields']));_0x294e72['attributes']=_0x294e72[_0xa329('0x4c')]['length']?_0x294e72['attributes']:_0x5f4181[_0xa329('0x4b')];if(!_0x3ca466['query'][_0xa329('0x4d')](_0xa329('0x4e'))){_0x294e72['limit']=qs[_0xa329('0x4f')](_0x3ca466['query'][_0xa329('0x4f')]);_0x294e72[_0xa329('0x33')]=qs[_0xa329('0x33')](_0x3ca466[_0xa329('0x48')][_0xa329('0x33')]);}_0x294e72[_0xa329('0x50')]=qs[_0xa329('0x51')](_0x3ca466[_0xa329('0x48')][_0xa329('0x51')]);_0x294e72[_0xa329('0x52')]=qs[_0xa329('0x53')](_[_0xa329('0x54')](_0x3ca466[_0xa329('0x48')],_0x5f4181[_0xa329('0x53')]),_0x236fa8);if(_0x3ca466[_0xa329('0x48')][_0xa329('0x55')]){_0x294e72['where']=_[_0xa329('0x56')](_0x294e72[_0xa329('0x52')],{'$or':_[_0xa329('0x42')](_0x236fa8,function(_0x57529b){if(_0x57529b['type']!==_0xa329('0x57')){var _0x45fefb={};_0x45fefb[_0x57529b[_0xa329('0x47')]]={'$like':'%'+_0x3ca466[_0xa329('0x48')][_0xa329('0x55')]+'%'};return _0x45fefb;}})});}_0x294e72=_[_0xa329('0x56')]({},_0x294e72,_0x3ca466[_0xa329('0x58')]);var _0x50a531={'where':_0x294e72[_0xa329('0x52')]};return db['WhatsappAccount'][_0xa329('0x32')](_0x50a531)[_0xa329('0x22')](function(_0x21c1db){_0x51acfd[_0xa329('0x32')]=_0x21c1db;if(_0x3ca466['query']['includeAll']){_0x294e72[_0xa329('0x59')]=[{'all':!![]}];}return db[_0xa329('0x43')][_0xa329('0x5a')](_0x294e72);})['then'](function(_0x4a7c1a){_0x51acfd[_0xa329('0x5b')]=_0x4a7c1a;return _0x51acfd;})[_0xa329('0x22')](respondWithFilteredResult(_0x4f17d7,_0x294e72))['catch'](handleError(_0x4f17d7,null));};exports[_0xa329('0x5c')]=function(_0x30a1e3,_0x47ff0e){var _0x391a42={'raw':![],'where':{'id':_0x30a1e3[_0xa329('0x5d')]['id']},'include':[{'model':db[_0xa329('0x40')],'as':_0xa329('0x41')}]},_0x19b8bc={};_0x19b8bc[_0xa329('0x4b')]=_['keys'](db[_0xa329('0x43')][_0xa329('0x44')]);_0x19b8bc[_0xa329('0x48')]=_[_0xa329('0x49')](_0x30a1e3['query']);_0x19b8bc[_0xa329('0x53')]=_['intersection'](_0x19b8bc['model'],_0x19b8bc[_0xa329('0x48')]);_0x391a42['attributes']=_[_0xa329('0x4a')](_0x19b8bc[_0xa329('0x4b')],qs[_0xa329('0x5e')](_0x30a1e3[_0xa329('0x48')][_0xa329('0x5e')]));_0x391a42[_0xa329('0x4c')]=_0x391a42[_0xa329('0x4c')][_0xa329('0x5f')]?_0x391a42[_0xa329('0x4c')]:_0x19b8bc[_0xa329('0x4b')];if(_0x30a1e3[_0xa329('0x48')][_0xa329('0x60')]){_0x391a42[_0xa329('0x59')]=[{'all':!![]}];}_0x391a42=_['merge']({},_0x391a42,_0x30a1e3[_0xa329('0x58')]);return db[_0xa329('0x43')][_0xa329('0x61')](_0x391a42)[_0xa329('0x22')](handleEntityNotFound(_0x47ff0e,null))[_0xa329('0x22')](respondWithResult(_0x47ff0e,null))[_0xa329('0x2d')](handleError(_0x47ff0e,null));};exports['create']=function(_0x1b808f,_0x793b6f){return db['WhatsappAccount']['create'](_0x1b808f['body'],{})[_0xa329('0x22')](function(_0x459f6c){var _0x56e4d5=_0x1b808f[_0xa329('0x62')][_0xa329('0x3a')]({'plain':!![]});if(!_0x56e4d5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x56e4d5[_0xa329('0x63')]===_0xa329('0x62')){var _0x335ee1=_0x459f6c['get']({'plain':!![]});var _0x4e82e1='WhatsappAccounts';return db['UserProfileSection']['find']({'where':{'name':_0x4e82e1,'userProfileId':_0x56e4d5['userProfileId']},'raw':!![]})[_0xa329('0x22')](function(_0x3cae49){if(_0x3cae49&&_0x3cae49[_0xa329('0x64')]===0x0){return db[_0xa329('0x3c')][_0xa329('0x65')]({'name':_0x335ee1[_0xa329('0x47')],'resourceId':_0x335ee1['id'],'type':_0x3cae49[_0xa329('0x47')],'sectionId':_0x3cae49['id']},{})[_0xa329('0x22')](function(){return _0x459f6c;});}else{return _0x459f6c;}})[_0xa329('0x2d')](function(_0x1b4a64){logger[_0xa329('0x29')](_0xa329('0x66'),_0x1b4a64);throw _0x1b4a64;});}return _0x459f6c;})[_0xa329('0x22')](respondWithResult(_0x793b6f,0xc9))[_0xa329('0x2d')](handleError(_0x793b6f,null));};exports[_0xa329('0x39')]=function(_0x651ce1,_0xa783a7){if(_0x651ce1[_0xa329('0x67')]['id']){delete _0x651ce1[_0xa329('0x67')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x651ce1[_0xa329('0x5d')]['id']},'include':[{'model':db[_0xa329('0x40')],'as':_0xa329('0x41')}]})[_0xa329('0x22')](handleEntityNotFound(_0xa783a7,null))['then'](saveUpdates(_0x651ce1['body'],null))['then'](respondWithResult(_0xa783a7,null))[_0xa329('0x2d')](handleError(_0xa783a7,null));};exports[_0xa329('0x68')]=function(_0x471ffe,_0x5f4a65){return db['WhatsappAccount'][_0xa329('0x61')]({'where':{'id':_0x471ffe['params']['id']}})[_0xa329('0x22')](handleEntityNotFound(_0x5f4a65,null))['then'](removeEntity(_0x5f4a65,null))['catch'](handleError(_0x5f4a65,null));};exports[_0xa329('0x69')]=function(_0x14e4b8,_0x28a021){return db[_0xa329('0x43')][_0xa329('0x69')]()[_0xa329('0x22')](respondWithResult(_0x28a021,null))[_0xa329('0x2d')](handleError(_0x28a021,null));};exports['addDisposition']=function(_0x22c881,_0x1aa516,_0x4325e6){if(_0x22c881['body']['id']){delete _0x22c881[_0xa329('0x67')]['id'];}return db[_0xa329('0x43')][_0xa329('0x61')]({'where':{'id':_0x22c881[_0xa329('0x5d')]['id']}})[_0xa329('0x22')](handleEntityNotFound(_0x1aa516,null))['then'](function(_0x13d35f){if(_0x13d35f){_0x22c881[_0xa329('0x67')]['WhatsappAccountId']=_0x13d35f['id'];return db[_0xa329('0x6a')][_0xa329('0x65')](_0x22c881[_0xa329('0x67')]);}})['then'](respondWithResult(_0x1aa516,null))[_0xa329('0x2d')](handleError(_0x1aa516,null));};exports['getDispositions']=function(_0x5d5082,_0x31552b,_0x49a955){var _0x3ca199={'raw':![],'where':{}};var _0x536459={};var _0x39607f={'count':0x0,'rows':[]};return db[_0xa329('0x43')][_0xa329('0x6b')]({'where':{'id':_0x5d5082[_0xa329('0x5d')]['id']}})[_0xa329('0x22')](handleEntityNotFound(_0x31552b,null))[_0xa329('0x22')](function(_0x3d6c4b){if(_0x3d6c4b){_0x536459[_0xa329('0x4b')]=_['keys'](db[_0xa329('0x6a')]['rawAttributes']);_0x536459[_0xa329('0x48')]=_[_0xa329('0x49')](_0x5d5082[_0xa329('0x48')]);_0x536459[_0xa329('0x53')]=_['intersection'](_0x536459['model'],_0x536459[_0xa329('0x48')]);_0x3ca199['attributes']=_[_0xa329('0x4a')](_0x536459[_0xa329('0x4b')],qs[_0xa329('0x5e')](_0x5d5082[_0xa329('0x48')]['fields']));_0x3ca199[_0xa329('0x4c')]=_0x3ca199[_0xa329('0x4c')][_0xa329('0x5f')]?_0x3ca199[_0xa329('0x4c')]:_0x536459[_0xa329('0x4b')];if(!_0x5d5082[_0xa329('0x48')][_0xa329('0x4d')]('nolimit')){_0x3ca199[_0xa329('0x4f')]=qs[_0xa329('0x4f')](_0x5d5082[_0xa329('0x48')][_0xa329('0x4f')]);_0x3ca199[_0xa329('0x33')]=qs['offset'](_0x5d5082[_0xa329('0x48')][_0xa329('0x33')]);}_0x3ca199[_0xa329('0x50')]=qs[_0xa329('0x51')](_0x5d5082[_0xa329('0x48')][_0xa329('0x51')]);_0x3ca199[_0xa329('0x52')]=qs[_0xa329('0x53')](_['pick'](_0x5d5082['query'],_0x536459[_0xa329('0x53')]));_0x3ca199[_0xa329('0x52')][_0xa329('0x6c')]=_0x3d6c4b['id'];if(_0x5d5082[_0xa329('0x48')]['filter']){_0x3ca199[_0xa329('0x52')]=_['merge'](_0x3ca199['where'],{'$or':_['map'](_0x3ca199[_0xa329('0x4c')],function(_0x149b94){var _0x3d6f54={};_0x3d6f54[_0x149b94]={'$like':'%'+_0x5d5082['query'][_0xa329('0x55')]+'%'};return _0x3d6f54;})});}_0x3ca199=_[_0xa329('0x56')]({},_0x3ca199,_0x5d5082[_0xa329('0x58')]);return db[_0xa329('0x6a')][_0xa329('0x32')]({'where':_0x3ca199[_0xa329('0x52')]})[_0xa329('0x22')](function(_0x314f60){_0x39607f[_0xa329('0x32')]=_0x314f60;if(_0x5d5082[_0xa329('0x48')][_0xa329('0x60')]){_0x3ca199['include']=[{'all':!![]}];}return db[_0xa329('0x6a')]['findAll'](_0x3ca199);})[_0xa329('0x22')](function(_0x499f6f){_0x39607f[_0xa329('0x5b')]=_0x499f6f;return _0x39607f;});}})[_0xa329('0x22')](respondWithFilteredResult(_0x31552b,_0x3ca199))[_0xa329('0x2d')](handleError(_0x31552b,null));};exports[_0xa329('0x6d')]=function(_0x1b186d,_0x658385,_0x270b2a){return db['WhatsappAccount'][_0xa329('0x61')]({'where':{'id':_0x1b186d[_0xa329('0x5d')]['id']}})['then'](handleEntityNotFound(_0x658385,null))['then'](function(_0x122982){if(_0x122982){return _0x122982[_0xa329('0x6d')](_0x1b186d[_0xa329('0x48')]['ids']);}})['then'](respondWithStatusCode(_0x658385,null))[_0xa329('0x2d')](handleError(_0x658385,null));};exports['addAnswer']=function(_0x52bf51,_0x304fa7,_0x5126d3){if(_0x52bf51[_0xa329('0x67')]['id']){delete _0x52bf51['body']['id'];}return db[_0xa329('0x43')][_0xa329('0x61')]({'where':{'id':_0x52bf51[_0xa329('0x5d')]['id']}})[_0xa329('0x22')](handleEntityNotFound(_0x304fa7,null))[_0xa329('0x22')](function(_0x5e15c8){if(_0x5e15c8){_0x52bf51[_0xa329('0x67')]['WhatsappAccountId']=_0x5e15c8['id'];return db[_0xa329('0x6e')][_0xa329('0x65')](_0x52bf51[_0xa329('0x67')]);}})[_0xa329('0x22')](respondWithResult(_0x304fa7,null))[_0xa329('0x2d')](handleError(_0x304fa7,null));};exports[_0xa329('0x6f')]=function(_0x372d9b,_0x2367db,_0x22ddc6){var _0x49268e={'raw':![],'where':{}};var _0x2a059e={};var _0x483f46={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xa329('0x6b')]({'where':{'id':_0x372d9b[_0xa329('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2367db,null))['then'](function(_0x3b8f66){if(_0x3b8f66){_0x2a059e[_0xa329('0x4b')]=_[_0xa329('0x49')](db[_0xa329('0x6e')][_0xa329('0x44')]);_0x2a059e[_0xa329('0x48')]=_[_0xa329('0x49')](_0x372d9b[_0xa329('0x48')]);_0x2a059e[_0xa329('0x53')]=_[_0xa329('0x4a')](_0x2a059e[_0xa329('0x4b')],_0x2a059e[_0xa329('0x48')]);_0x49268e['attributes']=_[_0xa329('0x4a')](_0x2a059e['model'],qs[_0xa329('0x5e')](_0x372d9b['query'][_0xa329('0x5e')]));_0x49268e['attributes']=_0x49268e[_0xa329('0x4c')][_0xa329('0x5f')]?_0x49268e['attributes']:_0x2a059e[_0xa329('0x4b')];if(!_0x372d9b[_0xa329('0x48')][_0xa329('0x4d')](_0xa329('0x4e'))){_0x49268e['limit']=qs[_0xa329('0x4f')](_0x372d9b[_0xa329('0x48')][_0xa329('0x4f')]);_0x49268e[_0xa329('0x33')]=qs[_0xa329('0x33')](_0x372d9b[_0xa329('0x48')][_0xa329('0x33')]);}_0x49268e[_0xa329('0x50')]=qs[_0xa329('0x51')](_0x372d9b[_0xa329('0x48')][_0xa329('0x51')]);_0x49268e[_0xa329('0x52')]=qs[_0xa329('0x53')](_[_0xa329('0x54')](_0x372d9b[_0xa329('0x48')],_0x2a059e[_0xa329('0x53')]));_0x49268e[_0xa329('0x52')][_0xa329('0x6c')]=_0x3b8f66['id'];if(_0x372d9b[_0xa329('0x48')][_0xa329('0x55')]){_0x49268e[_0xa329('0x52')]=_['merge'](_0x49268e[_0xa329('0x52')],{'$or':_['map'](_0x49268e[_0xa329('0x4c')],function(_0x30fae7){var _0x1884a7={};_0x1884a7[_0x30fae7]={'$like':'%'+_0x372d9b[_0xa329('0x48')][_0xa329('0x55')]+'%'};return _0x1884a7;})});}_0x49268e=_['merge']({},_0x49268e,_0x372d9b[_0xa329('0x58')]);return db[_0xa329('0x6e')][_0xa329('0x32')]({'where':_0x49268e['where']})[_0xa329('0x22')](function(_0x247b2d){_0x483f46['count']=_0x247b2d;if(_0x372d9b[_0xa329('0x48')][_0xa329('0x60')]){_0x49268e[_0xa329('0x59')]=[{'all':!![]}];}return db['CannedAnswer'][_0xa329('0x5a')](_0x49268e);})[_0xa329('0x22')](function(_0x5efc51){_0x483f46[_0xa329('0x5b')]=_0x5efc51;return _0x483f46;});}})[_0xa329('0x22')](respondWithFilteredResult(_0x2367db,_0x49268e))[_0xa329('0x2d')](handleError(_0x2367db,null));};exports[_0xa329('0x70')]=function(_0x221d13,_0x499599,_0x4ce3aa){return db[_0xa329('0x43')][_0xa329('0x61')]({'where':{'id':_0x221d13[_0xa329('0x5d')]['id']}})[_0xa329('0x22')](handleEntityNotFound(_0x499599,null))[_0xa329('0x22')](function(_0x485583){if(_0x485583){return _0x485583[_0xa329('0x70')](_0x221d13[_0xa329('0x48')]['ids']);}})['then'](respondWithStatusCode(_0x499599,null))[_0xa329('0x2d')](handleError(_0x499599,null));};exports[_0xa329('0x71')]=function(_0x53c44e,_0x16e94f,_0x489b72){return db[_0xa329('0x43')][_0xa329('0x61')]({'where':{'id':_0x53c44e[_0xa329('0x5d')]['id']}})[_0xa329('0x22')](handleEntityNotFound(_0x16e94f,null))[_0xa329('0x22')](function(_0x4a6c12){if(_0x4a6c12){return _0x4a6c12[_0xa329('0x71')](_0x53c44e[_0xa329('0x67')][_0xa329('0x72')],_[_0xa329('0x73')](_0x53c44e[_0xa329('0x67')],[_0xa329('0x72'),'id'])||{})[_0xa329('0x74')](function(_0x32b3bc){for(var _0x241826=0x0;_0x241826<_0x53c44e['body'][_0xa329('0x72')]['length'];_0x241826+=0x1){socket[_0xa329('0x75')](_0xa329('0x76'),{'UserId':_0x53c44e[_0xa329('0x67')][_0xa329('0x72')][_0x241826],'WhatsappAccountId':_0x53c44e[_0xa329('0x5d')]['id']});}return _0x32b3bc;});}})[_0xa329('0x22')](respondWithResult(_0x16e94f,null))[_0xa329('0x2d')](handleError(_0x16e94f,null));};exports[_0xa329('0x77')]=function(_0x36dffe,_0xbe762d,_0x50adb8){return db[_0xa329('0x43')][_0xa329('0x61')]({'where':{'id':_0x36dffe[_0xa329('0x5d')]['id']}})[_0xa329('0x22')](handleEntityNotFound(_0xbe762d,null))[_0xa329('0x22')](function(_0x16eb26){if(_0x16eb26){return _0x16eb26[_0xa329('0x77')](_0x36dffe[_0xa329('0x48')][_0xa329('0x72')])[_0xa329('0x22')](function(){if(_[_0xa329('0x78')](_0x36dffe[_0xa329('0x48')][_0xa329('0x72')])){for(var _0x361206=0x0;_0x361206<_0x36dffe[_0xa329('0x48')][_0xa329('0x72')]['length'];_0x361206+=0x1){socket[_0xa329('0x75')](_0xa329('0x79'),{'UserId':Number(_0x36dffe['query'][_0xa329('0x72')][_0x361206]),'WhatsappAccountId':Number(_0x36dffe[_0xa329('0x5d')]['id'])});}}else{socket['emit'](_0xa329('0x79'),{'UserId':Number(_0x36dffe[_0xa329('0x48')][_0xa329('0x72')]),'WhatsappAccountId':Number(_0x36dffe[_0xa329('0x5d')]['id'])});}});}})[_0xa329('0x22')](respondWithStatusCode(_0xbe762d,null))[_0xa329('0x2d')](handleError(_0xbe762d,null));};exports['getAgents']=function(_0x27f045,_0x33d1a1,_0xda46c3){var _0x41e5f3={};var _0x7ac1ff={};var _0x1cc001;var _0xe3e09a;return db[_0xa329('0x43')][_0xa329('0x6b')]({'where':{'id':_0x27f045[_0xa329('0x5d')]['id']}})[_0xa329('0x22')](handleEntityNotFound(_0x33d1a1,null))[_0xa329('0x22')](function(_0x511de1){if(_0x511de1){_0x1cc001=_0x511de1;_0x7ac1ff['model']=_[_0xa329('0x49')](db['User'][_0xa329('0x44')]);_0x7ac1ff[_0xa329('0x48')]=_['keys'](_0x27f045[_0xa329('0x48')]);_0x7ac1ff['filters']=_[_0xa329('0x4a')](_0x7ac1ff[_0xa329('0x4b')],_0x7ac1ff['query']);_0x41e5f3[_0xa329('0x4c')]=_[_0xa329('0x4a')](_0x7ac1ff[_0xa329('0x4b')],qs[_0xa329('0x5e')](_0x27f045['query']['fields']));_0x41e5f3['attributes']=_0x41e5f3['attributes'][_0xa329('0x5f')]?_0x41e5f3['attributes']:_0x7ac1ff[_0xa329('0x4b')];_0x41e5f3[_0xa329('0x50')]=qs[_0xa329('0x51')](_0x27f045[_0xa329('0x48')][_0xa329('0x51')]);_0x41e5f3[_0xa329('0x52')]=qs[_0xa329('0x53')](_['pick'](_0x27f045['query'],_0x7ac1ff[_0xa329('0x53')]));if(_0x27f045[_0xa329('0x48')]['filter']){_0x41e5f3[_0xa329('0x52')]=_[_0xa329('0x56')](_0x41e5f3[_0xa329('0x52')],{'$or':_[_0xa329('0x42')](_0x41e5f3['attributes'],function(_0x9d357f){var _0x2243a7={};_0x2243a7[_0x9d357f]={'$like':'%'+_0x27f045[_0xa329('0x48')][_0xa329('0x55')]+'%'};return _0x2243a7;})});}_0x41e5f3=_['merge']({},_0x41e5f3,_0x27f045[_0xa329('0x58')]);return _0x1cc001[_0xa329('0x7a')](_0x41e5f3);}})[_0xa329('0x22')](function(_0x1055cf){if(_0x1055cf){_0xe3e09a=_0x1055cf[_0xa329('0x5f')];if(!_0x27f045[_0xa329('0x48')][_0xa329('0x4d')](_0xa329('0x4e'))){_0x41e5f3[_0xa329('0x4f')]=qs[_0xa329('0x4f')](_0x27f045[_0xa329('0x48')][_0xa329('0x4f')]);_0x41e5f3[_0xa329('0x33')]=qs[_0xa329('0x33')](_0x27f045[_0xa329('0x48')][_0xa329('0x33')]);}return _0x1cc001[_0xa329('0x7a')](_0x41e5f3);}})[_0xa329('0x22')](function(_0x354c8c){if(_0x354c8c){return _0x354c8c?{'count':_0xe3e09a,'rows':_0x354c8c}:null;}})[_0xa329('0x22')](respondWithResult(_0x33d1a1,null))['catch'](handleError(_0x33d1a1,null));};exports['addApplications']=function(_0x1e2493,_0x344046,_0x1f2ab2){return db[_0xa329('0x43')][_0xa329('0x6b')]({'where':{'id':_0x1e2493['params']['id']}})[_0xa329('0x22')](handleEntityNotFound(_0x344046,null))[_0xa329('0x22')](function(_0x59fc7e){if(_0x59fc7e){return db[_0xa329('0x7b')][_0xa329('0x7c')](function(_0x5113fb){return db['WhatsappApplication'][_0xa329('0x68')]({'where':{'WhatsappAccountId':_0x1e2493['params']['id']},'transaction':_0x5113fb})[_0xa329('0x22')](function(_0x8514d3){var _0x51d82a=_[_0xa329('0x42')](_0x1e2493[_0xa329('0x67')],function(_0x430a68){_0x430a68[_0xa329('0x6c')]=_0x1e2493['params']['id'];return _0x430a68;});return db[_0xa329('0x7d')]['bulkCreate'](_0x51d82a,{'transaction':_0x5113fb});});})[_0xa329('0x22')](function(){return db[_0xa329('0x7d')][_0xa329('0x7e')]({'where':{'WhatsappAccountId':_0x1e2493['params']['id']},'order':_0xa329('0x7f')});});}})[_0xa329('0x22')](respondWithResult(_0x344046,null))[_0xa329('0x2d')](handleError(_0x344046,null));};exports[_0xa329('0x80')]=function(_0x11877e,_0x1e26d1,_0x32fcb6){var _0x4ad221={};var _0xf256b1={};var _0x372985;var _0x379fcb;return db[_0xa329('0x43')]['findOne']({'where':{'id':_0x11877e[_0xa329('0x5d')]['id']}})[_0xa329('0x22')](handleEntityNotFound(_0x1e26d1,null))['then'](function(_0x28ce04){if(_0x28ce04){_0x372985=_0x28ce04;_0xf256b1[_0xa329('0x4b')]=_[_0xa329('0x49')](db['WhatsappApplication'][_0xa329('0x44')]);_0xf256b1[_0xa329('0x48')]=_['keys'](_0x11877e[_0xa329('0x48')]);_0xf256b1[_0xa329('0x53')]=_[_0xa329('0x4a')](_0xf256b1[_0xa329('0x4b')],_0xf256b1[_0xa329('0x48')]);_0x4ad221[_0xa329('0x4c')]=_[_0xa329('0x4a')](_0xf256b1['model'],qs[_0xa329('0x5e')](_0x11877e[_0xa329('0x48')][_0xa329('0x5e')]));_0x4ad221['attributes']=_0x4ad221[_0xa329('0x4c')][_0xa329('0x5f')]?_0x4ad221[_0xa329('0x4c')]:_0xf256b1[_0xa329('0x4b')];_0x4ad221['order']=qs['sort'](_0x11877e[_0xa329('0x48')][_0xa329('0x51')]);_0x4ad221['where']=qs['filters'](_['pick'](_0x11877e['query'],_0xf256b1[_0xa329('0x53')]));if(_0x11877e[_0xa329('0x48')][_0xa329('0x55')]){_0x4ad221[_0xa329('0x52')]=_[_0xa329('0x56')](_0x4ad221[_0xa329('0x52')],{'$or':_[_0xa329('0x42')](_0x4ad221[_0xa329('0x4c')],function(_0x4f007f){var _0x4bd8bd={};_0x4bd8bd[_0x4f007f]={'$like':'%'+_0x11877e[_0xa329('0x48')][_0xa329('0x55')]+'%'};return _0x4bd8bd;})});}_0x4ad221=_[_0xa329('0x56')]({},_0x4ad221,_0x11877e[_0xa329('0x58')]);return _0x372985[_0xa329('0x80')](_0x4ad221);}})[_0xa329('0x22')](function(_0x57ea64){if(_0x57ea64){_0x379fcb=_0x57ea64[_0xa329('0x5f')];if(!_0x11877e[_0xa329('0x48')]['hasOwnProperty'](_0xa329('0x4e'))){_0x4ad221['limit']=qs[_0xa329('0x4f')](_0x11877e[_0xa329('0x48')][_0xa329('0x4f')]);_0x4ad221[_0xa329('0x33')]=qs['offset'](_0x11877e[_0xa329('0x48')][_0xa329('0x33')]);}return _0x372985[_0xa329('0x80')](_0x4ad221);}})[_0xa329('0x22')](function(_0x63e2c7){if(_0x63e2c7){return _0x63e2c7?{'count':_0x379fcb,'rows':_0x63e2c7}:null;}})['then'](respondWithResult(_0x1e26d1,null))['catch'](handleError(_0x1e26d1,null));};exports[_0xa329('0x81')]=function(_0x42e921,_0x407338,_0x2c7db1){var _0x1ba87d={'channel':_0xa329('0x82')};var _0x3dd4a8=[];var _0x2a1fc3=[];var _0x37438e={};return db[_0xa329('0x43')]['find']({'where':{'id':_0x42e921['params']['id']},'include':[{'model':db[_0xa329('0x7d')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x407338,null))[_0xa329('0x22')](function(_0x2757b5){_0x1ba87d['account']=_0x2757b5;_0x1ba87d[_0xa329('0x83')]=_[_0xa329('0x84')](_0x2757b5[_0xa329('0x85')],[_0xa329('0x7f')],['asc']);if(_0x1ba87d[_0xa329('0x86')][_0xa329('0x85')]){delete _0x1ba87d[_0xa329('0x86')][_0xa329('0x85')];}return db[_0xa329('0x87')][_0xa329('0x69')]();})[_0xa329('0x22')](function(_0x1c61a7){if(!_0x1c61a7){throw new db['Sequelize'][(_0xa329('0x88'))](_0xa329('0x89'));}_0x3dd4a8=_[_0xa329('0x8a')](_[_0xa329('0x49')](_0x1c61a7),[_0xa329('0x8b'),_0xa329('0x8c')]);_0x2a1fc3=_[_0xa329('0x8a')](_[_0xa329('0x49')](_0x1c61a7),[_0xa329('0x8b'),_0xa329('0x8c'),'CompanyId',_0xa329('0x8d')]);_0x1ba87d[_0xa329('0x67')]={'mapKey':_0xa329('0x8e')};if(_0x1ba87d['account']['type']&&_0x1ba87d[_0xa329('0x86')][_0xa329('0x8f')]===_0xa329('0x90')){_0x1ba87d['body'][_0xa329('0x91')]=_0x42e921[_0xa329('0x67')][_0xa329('0x92')][_0xa329('0x93')]('whatsapp:','');_0x1ba87d[_0xa329('0x67')]['body']=_0x42e921['body'][_0xa329('0x94')];_0x1ba87d[_0xa329('0x67')]['messageId']=_0x42e921[_0xa329('0x67')]['MessageSid'];}if(_0x1ba87d[_0xa329('0x67')]['id']){delete _0x1ba87d[_0xa329('0x67')]['id'];}if(_[_0xa329('0x95')](_0x1ba87d[_0xa329('0x67')][_0xa329('0x91')])){throw new db[(_0xa329('0x96'))][(_0xa329('0x88'))]('from\x20is\x20mandatory');}if(_[_0xa329('0x95')](_0x1ba87d[_0xa329('0x67')][_0xa329('0x67')])||_0x1ba87d['body']['body']===''){throw new db[(_0xa329('0x96'))][(_0xa329('0x88'))](_0xa329('0x97'));}if(_[_0xa329('0x95')](_0x1ba87d[_0xa329('0x67')][_0xa329('0x98')])){throw new db[(_0xa329('0x96'))][(_0xa329('0x88'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2a1fc3);}if(!_[_0xa329('0x99')](_0x2a1fc3,_0x1ba87d[_0xa329('0x67')]['mapKey'])){throw new db[(_0xa329('0x96'))][(_0xa329('0x88'))](_0xa329('0x9a')+_0x2a1fc3);}_0x37438e[_0x1ba87d['body']['mapKey']]=_0x1ba87d['body']['from'];return db[_0xa329('0x9b')][_0xa329('0x61')]({'where':{'id':_0x1ba87d[_0xa329('0x86')]['ListId']},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x37438e,'limit':0x1,'order':[[_0xa329('0x8c'),_0xa329('0x9c')]]}]});})[_0xa329('0x22')](handleEntityNotFound(_0x407338,null))[_0xa329('0x22')](function(_0x5d1bea){if(_0x5d1bea){_0x1ba87d[_0xa329('0x9d')]=_[_0xa329('0x73')](_0x5d1bea,[_0xa329('0x9e')]);if(_0x5d1bea[_0xa329('0x9e')][_0xa329('0x5f')]){return _0x5d1bea[_0xa329('0x9e')][0x0];}var _0x4959f0=_[_0xa329('0x19')](_0x1ba87d[_0xa329('0x67')],{'firstName':_0x1ba87d[_0xa329('0x67')][_0xa329('0x91')],'ListId':_0x5d1bea['id']});_0x4959f0[_0x1ba87d[_0xa329('0x67')][_0xa329('0x98')]]=_0x1ba87d['body']['from'];return db[_0xa329('0x87')][_0xa329('0x65')](_0x4959f0,{'fields':_0x3dd4a8,'raw':!![]});}})[_0xa329('0x22')](handleEntityNotFound(_0x407338,null))['then'](function(_0x5d12eb){if(_0x5d12eb){_0x1ba87d['contact']=_0x5d12eb;var _0x39bd07={'ContactId':_0x5d12eb['id'],'phone':_0x1ba87d[_0xa329('0x67')][_0xa329('0x91')],'WhatsappAccountId':_0x42e921[_0xa329('0x5d')]['id']};var _0xe200c6={'ContactId':_0x5d12eb['id'],'WhatsappAccountId':_0x42e921[_0xa329('0x5d')]['id'],'closed':![]};return db[_0xa329('0x9f')][_0xa329('0x61')]({'where':_0xe200c6})[_0xa329('0x22')](function(_0x5205b2){if(_0x5205b2){return[_0x5205b2,![]];}return db[_0xa329('0x9f')][_0xa329('0x65')](_0x39bd07)['then'](function(_0x3412ac){return[_0x3412ac,!![]];});});}})[_0xa329('0x74')](function(_0x73bb81,_0x290a7a){_0x1ba87d[_0xa329('0xa0')]=_0x73bb81[_0xa329('0x3a')]({'plain':!![]});_0x1ba87d[_0xa329('0xa0')]['created']=![];if(_0x290a7a){if(_0x1ba87d[_0xa329('0x86')][_0xa329('0xa1')]){_0x1ba87d[_0xa329('0x83')][_0xa329('0xa2')]({'id':0x0,'priority':_0x1ba87d[_0xa329('0x83')][_0xa329('0x5f')]+0x1,'app':_0xa329('0xa3'),'appdata':_0xa329('0xa4'),'interval':_0xa329('0xa5')});}_0x1ba87d[_0xa329('0xa0')]['created']=!![];}return db[_0xa329('0xa6')][_0xa329('0x65')]({'phone':_0x1ba87d['body'][_0xa329('0x91')],'messageId':_0x1ba87d['body']['messageId'],'body':_0x1ba87d[_0xa329('0x67')][_0xa329('0x67')],'WhatsappAccountId':_0x42e921[_0xa329('0x5d')]['id'],'WhatsappInteractionId':_0x73bb81['id'],'direction':'in','ContactId':_0x73bb81[_0xa329('0xa7')],'AttachmentId':_0x1ba87d[_0xa329('0x67')][_0xa329('0xa8')]});})['then'](function(_0x4d0b81){_0x1ba87d[_0xa329('0x2b')]=_0x4d0b81;if(_0x1ba87d[_0xa329('0xa0')][_0xa329('0xa9')]){return db[_0xa329('0xaa')]['find']({'attributes':['id',_0xa329('0x47')],'where':{'id':_0x1ba87d[_0xa329('0xa0')][_0xa329('0xa9')]}})[_0xa329('0x22')](function(_0x2dd9ea){if(_0x2dd9ea){_0x1ba87d[_0xa329('0x83')][_0xa329('0xab')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2dd9ea['name']+','+(_0x1ba87d[_0xa329('0x86')][_0xa329('0xac')]||0xa),'interval':_0xa329('0xa5')});}return respondWithRpcPromise('Start','startRouting',_0x1ba87d);});}return respondWithRpcPromise(_0xa329('0xad'),'startRouting',_0x1ba87d);})[_0xa329('0x22')](function(_0x21630b){if(_0x21630b){var _0x1c493d=0xc8;var _0x5d1fe5='receiveMessage';logger[_0xa329('0x23')](_0xa329('0x27'),_0x5d1fe5,_0x1c493d,'entity\x20found');logger[_0xa329('0x26')](_0xa329('0xae'),_0x5d1fe5,_0x1c493d,_0xa329('0xaf'),JSON['stringify'](_0x21630b));if(_0x1ba87d[_0xa329('0x86')][_0xa329('0x8f')]===_0xa329('0x90')){return _0x407338['status'](_0x1c493d)['set'](_0xa329('0xb0'),'text/xml')[_0xa329('0x3e')](_0xa329('0xb1'));}else{return _0x407338[_0xa329('0x2f')](_0x1c493d)[_0xa329('0x31')](_0x21630b);}}})[_0xa329('0x2d')](handleError(_0x407338,null));};exports[_0xa329('0x3e')]=function(_0x13bf6f,_0xf1725b,_0x3336b5){var _0x3b43de,_0x97cd34,_0x50b7e3;if(_[_0xa329('0x95')](_0x13bf6f['body'][_0xa329('0x67')])||_0x13bf6f[_0xa329('0x67')][_0xa329('0x67')]===''){throw new db['Sequelize'][(_0xa329('0x88'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa329('0x95')](_0x13bf6f['body']['to'])){throw new db['Sequelize'][(_0xa329('0x88'))]('to\x20is\x20mandatory');}_0x3b43de=_0x13bf6f[_0xa329('0x67')]['to'];return db['WhatsappAccount'][_0xa329('0x61')]({'where':{'id':_0x13bf6f['params']['id']},'include':[{'model':db[_0xa329('0x9b')],'as':_0xa329('0xb2'),'include':[{'model':db[_0xa329('0x87')],'as':'Contacts','where':{'mobile':_0x3b43de},'limit':0x1,'order':[[_0xa329('0x8c'),_0xa329('0x9c')]]}]}]})[_0xa329('0x22')](handleEntityNotFound(_0xf1725b,null))[_0xa329('0x22')](function(_0x53ab18){if(_0x53ab18&&_0x53ab18[_0xa329('0xb2')]){_0x97cd34=_0x53ab18['get']({'plain':!![]});if(_0x97cd34[_0xa329('0xb2')]&&_0x97cd34[_0xa329('0xb2')][_0xa329('0x9e')]['length']){return _0x97cd34[_0xa329('0xb2')]['Contacts'][0x0];}return db[_0xa329('0x87')][_0xa329('0x65')](_[_0xa329('0x19')](_0x13bf6f[_0xa329('0x67')],{'firstName':_0x3b43de,'mobile':_0x3b43de,'phone':_0x3b43de,'ListId':_0x97cd34[_0xa329('0x8d')]}));}})[_0xa329('0x22')](handleEntityNotFound(_0xf1725b,null))[_0xa329('0x22')](function(_0x15174e){if(_0x15174e){_0x50b7e3=_0x15174e;return db[_0xa329('0x9f')][_0xa329('0x61')]({'where':{'ContactId':_0x50b7e3['id'],'closed':![],'WhatsappAccountId':_0x97cd34['id']}})[_0xa329('0x22')](function(_0x4ec482){if(_0x4ec482){return[_0x4ec482,![]];}return db[_0xa329('0x9f')][_0xa329('0x65')]({'UserId':_0x13bf6f['user']['id'],'ContactId':_0x50b7e3['id'],'WhatsappAccountId':_0x97cd34['id'],'phone':_0x3b43de,'firstMsgDirection':_0xa329('0xb3'),'Messages':[_[_0xa329('0x56')](_0x13bf6f[_0xa329('0x67')],{'read':![],'body':_0x13bf6f['body']['body'],'phone':_0x3b43de,'WhatsappAccountId':_0x97cd34['id'],'UserId':_0x13bf6f[_0xa329('0x62')]['id'],'ContactId':_0x50b7e3['id']})]},{'include':[{'model':db[_0xa329('0xa6')],'as':_0xa329('0xb4')}]})[_0xa329('0x22')](function(_0xa3899a){return[_0xa3899a,!![]];});});}})[_0xa329('0x74')](function(_0x4865fb,_0x5720c4){if(_0x5720c4){return _0x4865fb;}return db[_0xa329('0xa6')][_0xa329('0x65')](_[_0xa329('0x56')](_0x13bf6f['body'],{'read':![],'body':_0x13bf6f['body'][_0xa329('0x67')],'phone':_0x3b43de,'WhatsappAccountId':_0x97cd34['id'],'WhatsappInteractionId':_0x4865fb['id'],'UserId':_0x13bf6f[_0xa329('0x62')]['id'],'ContactId':_0x50b7e3['id']}))[_0xa329('0x22')](function(_0x1c41ac){_0x4865fb['dataValues'][_0xa329('0xb4')]=[];_0x4865fb[_0xa329('0xb5')]['Messages']['push'](_0x1c41ac['dataValues']);return _0x4865fb;});})['then'](respondWithResult(_0xf1725b,null))[_0xa329('0x2d')](handleError(_0xf1725b,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index e82b7bd..f553fe1 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 _0x90b1=['hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','update','remove'];(function(_0x1fd581,_0x34ab1){var _0x18c07d=function(_0x37dcc9){while(--_0x37dcc9){_0x1fd581['push'](_0x1fd581['shift']());}};_0x18c07d(++_0x34ab1);}(_0x90b1,0x1bb));var _0x190b=function(_0x4ce93d,_0x552831){_0x4ce93d=_0x4ce93d-0x0;var _0x209b1a=_0x90b1[_0x4ce93d];return _0x209b1a;};'use strict';var EventEmitter=require(_0x190b('0x0'));var WhatsappAccount=require(_0x190b('0x1'))['db'][_0x190b('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x190b('0x3'),'afterDestroy':_0x190b('0x4')};function emitEvent(_0xa05468){return function(_0x120ddc,_0x4fbcad,_0x4c355f){WhatsappAccountEvents['emit'](_0xa05468+':'+_0x120ddc['id'],_0x120ddc);WhatsappAccountEvents['emit'](_0xa05468,_0x120ddc);_0x4c355f(null);};}for(var e in events){if(events[_0x190b('0x5')](e)){var event=events[e];WhatsappAccount[_0x190b('0x6')](e,emitEvent(event));}}module[_0x190b('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0x6d38=['WhatsappAccount','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x1114b8,_0x38a20e){var _0x5d51d1=function(_0x25ae67){while(--_0x25ae67){_0x1114b8['push'](_0x1114b8['shift']());}};_0x5d51d1(++_0x38a20e);}(_0x6d38,0x1ef));var _0x86d3=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x6d38[_0x36eaaa];return _0x461349;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x86d3('0x0'))['db'][_0x86d3('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x86d3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x86d3('0x3')};function emitEvent(_0x574a1c){return function(_0xe9198a,_0x455b9d,_0x2501dd){WhatsappAccountEvents['emit'](_0x574a1c+':'+_0xe9198a['id'],_0xe9198a);WhatsappAccountEvents[_0x86d3('0x4')](_0x574a1c,_0xe9198a);_0x2501dd(null);};}for(var e in events){if(events[_0x86d3('0x5')](e)){var event=events[e];WhatsappAccount[_0x86d3('0x6')](e,emitEvent(event));}}module[_0x86d3('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 017a13d..0e1a566 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 _0x414d=['rimraf','../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x2c6810,_0x23c079){var _0x213881=function(_0x528021){while(--_0x528021){_0x2c6810['push'](_0x2c6810['shift']());}};_0x213881(++_0x23c079);}(_0x414d,0x126));var _0xd414=function(_0x1d1963,_0x32cc0e){_0x1d1963=_0x1d1963-0x0;var _0x3f58bb=_0x414d[_0x1d1963];return _0x3f58bb;};'use strict';var _=require('lodash');var util=require(_0xd414('0x0'));var logger=require(_0xd414('0x1'))('api');var moment=require(_0xd414('0x2'));var BPromise=require(_0xd414('0x3'));var rp=require(_0xd414('0x4'));var fs=require('fs');var path=require(_0xd414('0x5'));var rimraf=require(_0xd414('0x6'));var config=require(_0xd414('0x7'));var attributes=require(_0xd414('0x8'));module['exports']=function(_0x5379b0,_0x1795c7){return _0x5379b0[_0xd414('0x9')](_0xd414('0xa'),attributes,{'tableName':_0xd414('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d6e=['lodash','util','api','moment','bluebird','request-promise','../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts'];(function(_0x2720ce,_0x4a6467){var _0x1126f0=function(_0x16a00e){while(--_0x16a00e){_0x2720ce['push'](_0x2720ce['shift']());}};_0x1126f0(++_0x4a6467);}(_0x5d6e,0x129));var _0xe5d6=function(_0x4a92c2,_0x28ed8b){_0x4a92c2=_0x4a92c2-0x0;var _0x7b52f1=_0x5d6e[_0x4a92c2];return _0x7b52f1;};'use strict';var _=require(_0xe5d6('0x0'));var util=require(_0xe5d6('0x1'));var logger=require('../../config/logger')(_0xe5d6('0x2'));var moment=require(_0xe5d6('0x3'));var BPromise=require(_0xe5d6('0x4'));var rp=require(_0xe5d6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe5d6('0x6'));var attributes=require(_0xe5d6('0x7'));module['exports']=function(_0xe7dea,_0x12e045){return _0xe7dea[_0xe5d6('0x8')](_0xe5d6('0x9'),attributes,{'tableName':_0xe5d6('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 7454277..98f9be0 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 _0x6d37=['WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowWhatsappAccount','find','options','raw','where','attributes','include','model','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x565d34,_0x4176da){var _0x3751e7=function(_0x42428b){while(--_0x42428b){_0x565d34['push'](_0x565d34['shift']());}};_0x3751e7(++_0x4176da);}(_0x6d37,0x103));var _0x76d3=function(_0x43d6f9,_0x215396){_0x43d6f9=_0x43d6f9-0x0;var _0x5ad561=_0x6d37[_0x43d6f9];return _0x5ad561;};'use strict';var _=require(_0x76d3('0x0'));var util=require(_0x76d3('0x1'));var moment=require(_0x76d3('0x2'));var BPromise=require(_0x76d3('0x3'));var rs=require(_0x76d3('0x4'));var fs=require('fs');var Redis=require(_0x76d3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x76d3('0x6'));var logger=require('../../config/logger')(_0x76d3('0x7'));var config=require('../../config/environment');var jayson=require(_0x76d3('0x8'));var client=jayson[_0x76d3('0x9')][_0x76d3('0xa')]({'port':0x232a});config[_0x76d3('0xb')]=_['defaults'](config[_0x76d3('0xb')],{'host':_0x76d3('0xc'),'port':0x18eb});var socket=require(_0x76d3('0xd'))(new Redis(config['redis']));require(_0x76d3('0xe'))[_0x76d3('0xf')](socket);function respondWithRpcPromise(_0x15270b,_0x32fec7,_0x25c051){return new BPromise(function(_0x3df62,_0x251064){return client[_0x76d3('0x10')](_0x15270b,_0x25c051)[_0x76d3('0x11')](function(_0x27c9d4){logger[_0x76d3('0x12')](_0x76d3('0x13'),_0x32fec7,_0x76d3('0x14'));logger['debug'](_0x76d3('0x15'),_0x32fec7,_0x76d3('0x14'),JSON[_0x76d3('0x16')](_0x27c9d4));if(_0x27c9d4[_0x76d3('0x17')]){if(_0x27c9d4[_0x76d3('0x17')]['code']===0x1f4){logger[_0x76d3('0x17')](_0x76d3('0x13'),_0x32fec7,_0x27c9d4[_0x76d3('0x17')]['message']);return _0x251064(_0x27c9d4[_0x76d3('0x17')][_0x76d3('0x18')]);}logger[_0x76d3('0x17')](_0x76d3('0x13'),_0x32fec7,_0x27c9d4['error'][_0x76d3('0x18')]);return _0x3df62(_0x27c9d4['error'][_0x76d3('0x18')]);}else{logger[_0x76d3('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x32fec7,_0x76d3('0x14'));_0x3df62(_0x27c9d4[_0x76d3('0x19')][_0x76d3('0x18')]);}})['catch'](function(_0x562b2b){logger[_0x76d3('0x17')](_0x76d3('0x13'),_0x32fec7,_0x562b2b);_0x251064(_0x562b2b);});});}exports[_0x76d3('0x1a')]=function(_0x1a6c9f){var _0x5acd09=this;return new Promise(function(_0x1fa6e2,_0x5865e7){return db['WhatsappAccount'][_0x76d3('0x1b')]({'raw':_0x1a6c9f[_0x76d3('0x1c')]?_0x1a6c9f[_0x76d3('0x1c')][_0x76d3('0x1d')]===undefined?!![]:![]:!![],'where':_0x1a6c9f[_0x76d3('0x1c')]?_0x1a6c9f[_0x76d3('0x1c')][_0x76d3('0x1e')]||null:null,'attributes':_0x1a6c9f['options']?_0x1a6c9f[_0x76d3('0x1c')][_0x76d3('0x1f')]||null:null,'include':_0x1a6c9f[_0x76d3('0x1c')]?_0x1a6c9f[_0x76d3('0x1c')][_0x76d3('0x20')]?_['map'](_0x1a6c9f['options'][_0x76d3('0x20')],function(_0x4d4f3f){return{'model':db[_0x4d4f3f[_0x76d3('0x21')]],'as':_0x4d4f3f['as'],'attributes':_0x4d4f3f[_0x76d3('0x1f')],'include':_0x4d4f3f['include']?_['map'](_0x4d4f3f[_0x76d3('0x20')],function(_0x58071b){return{'model':db[_0x58071b['model']],'as':_0x58071b['as'],'attributes':_0x58071b['attributes'],'include':_0x58071b[_0x76d3('0x20')]?_['map'](_0x58071b[_0x76d3('0x20')],function(_0x5dc097){return{'model':db[_0x5dc097[_0x76d3('0x21')]],'as':_0x5dc097['as'],'attributes':_0x5dc097['attributes']};}):[]};}):[]};}):[]:[]})[_0x76d3('0x11')](function(_0x3ced65){logger[_0x76d3('0x12')]('ShowWhatsappAccount',_0x1a6c9f);logger['debug'](_0x76d3('0x1a'),_0x1a6c9f,JSON[_0x76d3('0x16')](_0x3ced65));_0x1fa6e2(_0x3ced65);})[_0x76d3('0x22')](function(_0x116d02){logger[_0x76d3('0x17')](_0x76d3('0x1a'),_0x116d02[_0x76d3('0x18')],_0x1a6c9f);_0x5865e7(_0x5acd09['error'](0x1f4,_0x116d02[_0x76d3('0x18')]));});});}; \ No newline at end of file +var _0x8081=['map','model','include','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','info','request\x20sent','debug','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes'];(function(_0x119966,_0x3ddfbe){var _0x33c6fd=function(_0xe67fb0){while(--_0xe67fb0){_0x119966['push'](_0x119966['shift']());}};_0x33c6fd(++_0x3ddfbe);}(_0x8081,0xbc));var _0x1808=function(_0x117b52,_0x4c3190){_0x117b52=_0x117b52-0x0;var _0x5a4c2f=_0x8081[_0x117b52];return _0x5a4c2f;};'use strict';var _=require(_0x1808('0x0'));var util=require('util');var moment=require(_0x1808('0x1'));var BPromise=require(_0x1808('0x2'));var rs=require(_0x1808('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1808('0x4'))['db'];var utils=require(_0x1808('0x5'));var logger=require(_0x1808('0x6'))(_0x1808('0x7'));var config=require(_0x1808('0x8'));var jayson=require(_0x1808('0x9'));var client=jayson[_0x1808('0xa')]['http']({'port':0x232a});config[_0x1808('0xb')]=_[_0x1808('0xc')](config[_0x1808('0xb')],{'host':_0x1808('0xd'),'port':0x18eb});var socket=require(_0x1808('0xe'))(new Redis(config['redis']));require(_0x1808('0xf'))[_0x1808('0x10')](socket);function respondWithRpcPromise(_0x1b7ca2,_0x3a43d6,_0x55915f){return new BPromise(function(_0xb826be,_0x38dde9){return client[_0x1808('0x11')](_0x1b7ca2,_0x55915f)['then'](function(_0x17761a){logger[_0x1808('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x3a43d6,_0x1808('0x13'));logger[_0x1808('0x14')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3a43d6,_0x1808('0x13'),JSON[_0x1808('0x15')](_0x17761a));if(_0x17761a['error']){if(_0x17761a[_0x1808('0x16')][_0x1808('0x17')]===0x1f4){logger[_0x1808('0x16')](_0x1808('0x18'),_0x3a43d6,_0x17761a[_0x1808('0x16')][_0x1808('0x19')]);return _0x38dde9(_0x17761a[_0x1808('0x16')][_0x1808('0x19')]);}logger[_0x1808('0x16')](_0x1808('0x18'),_0x3a43d6,_0x17761a['error'][_0x1808('0x19')]);return _0xb826be(_0x17761a[_0x1808('0x16')][_0x1808('0x19')]);}else{logger[_0x1808('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x3a43d6,_0x1808('0x13'));_0xb826be(_0x17761a[_0x1808('0x1a')]['message']);}})[_0x1808('0x1b')](function(_0x25cea){logger[_0x1808('0x16')](_0x1808('0x18'),_0x3a43d6,_0x25cea);_0x38dde9(_0x25cea);});});}exports[_0x1808('0x1c')]=function(_0x582753){var _0x3fa156=this;return new Promise(function(_0xc6f24c,_0x305d2e){return db[_0x1808('0x1d')]['find']({'raw':_0x582753[_0x1808('0x1e')]?_0x582753[_0x1808('0x1e')][_0x1808('0x1f')]===undefined?!![]:![]:!![],'where':_0x582753[_0x1808('0x1e')]?_0x582753['options'][_0x1808('0x20')]||null:null,'attributes':_0x582753[_0x1808('0x1e')]?_0x582753['options'][_0x1808('0x21')]||null:null,'include':_0x582753[_0x1808('0x1e')]?_0x582753['options']['include']?_[_0x1808('0x22')](_0x582753['options']['include'],function(_0x371ba3){return{'model':db[_0x371ba3[_0x1808('0x23')]],'as':_0x371ba3['as'],'attributes':_0x371ba3[_0x1808('0x21')],'include':_0x371ba3['include']?_[_0x1808('0x22')](_0x371ba3[_0x1808('0x24')],function(_0x28f1df){return{'model':db[_0x28f1df[_0x1808('0x23')]],'as':_0x28f1df['as'],'attributes':_0x28f1df[_0x1808('0x21')],'include':_0x28f1df['include']?_[_0x1808('0x22')](_0x28f1df[_0x1808('0x24')],function(_0x16cda7){return{'model':db[_0x16cda7[_0x1808('0x23')]],'as':_0x16cda7['as'],'attributes':_0x16cda7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x24e43d){logger[_0x1808('0x12')](_0x1808('0x1c'),_0x582753);logger[_0x1808('0x14')](_0x1808('0x1c'),_0x582753,JSON[_0x1808('0x15')](_0x24e43d));_0xc6f24c(_0x24e43d);})[_0x1808('0x1b')](function(_0x101cb2){logger[_0x1808('0x16')](_0x1808('0x1c'),_0x101cb2[_0x1808('0x19')],_0x582753);_0x305d2e(_0x3fa156[_0x1808('0x16')](0x1f4,_0x101cb2[_0x1808('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index b40fb1d..cc60125 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 _0xea94=['update','emit','removeListener','register','length','./whatsappAccount.events','remove'];(function(_0x595a5c,_0x4197c6){var _0x3b384e=function(_0x54051f){while(--_0x54051f){_0x595a5c['push'](_0x595a5c['shift']());}};_0x3b384e(++_0x4197c6);}(_0xea94,0x155));var _0x4ea9=function(_0x49d48d,_0xf1fdaa){_0x49d48d=_0x49d48d-0x0;var _0x46e093=_0xea94[_0x49d48d];return _0x46e093;};'use strict';var WhatsappAccountEvents=require(_0x4ea9('0x0'));var events=['save',_0x4ea9('0x1'),_0x4ea9('0x2')];function createListener(_0x2f67ef,_0xabcb5a){return function(_0x20ec68){_0xabcb5a[_0x4ea9('0x3')](_0x2f67ef,_0x20ec68);};}function removeListener(_0x734ee3,_0x262054){return function(){WhatsappAccountEvents[_0x4ea9('0x4')](_0x734ee3,_0x262054);};}exports[_0x4ea9('0x5')]=function(_0x1cdf2a){for(var _0xbe159e=0x0,_0x48f994=events[_0x4ea9('0x6')];_0xbe159e<_0x48f994;_0xbe159e++){var _0x261e52=events[_0xbe159e];var _0x403c65=createListener('whatsappAccount:'+_0x261e52,_0x1cdf2a);WhatsappAccountEvents['on'](_0x261e52,_0x403c65);}}; \ No newline at end of file +var _0x51e6=['register','length','whatsappAccount:','save','emit','removeListener'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0x51e6,0xe1));var _0x651e=function(_0x5a2d3f,_0x27b04e){_0x5a2d3f=_0x5a2d3f-0x0;var _0x5c65d8=_0x51e6[_0x5a2d3f];return _0x5c65d8;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x651e('0x0'),'remove','update'];function createListener(_0x26a35f,_0x1f9d23){return function(_0x19ffb9){_0x1f9d23[_0x651e('0x1')](_0x26a35f,_0x19ffb9);};}function removeListener(_0xe46147,_0x22e97c){return function(){WhatsappAccountEvents[_0x651e('0x2')](_0xe46147,_0x22e97c);};}exports[_0x651e('0x3')]=function(_0x275010){for(var _0x52cf5e=0x0,_0x3f4cf0=events[_0x651e('0x4')];_0x52cf5e<_0x3f4cf0;_0x52cf5e++){var _0xf3e115=events[_0x52cf5e];var _0x96b7cf=createListener(_0x651e('0x5')+_0xf3e115,_0x275010);WhatsappAccountEvents['on'](_0xf3e115,_0x96b7cf);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 5ba7da1..d193f42 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 _0xb074=['get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./whatsappApplication.controller'];(function(_0x72d743,_0xaf43bd){var _0x3617e6=function(_0x1401e0){while(--_0x1401e0){_0x72d743['push'](_0x72d743['shift']());}};_0x3617e6(++_0xaf43bd);}(_0xb074,0xd6));var _0x4b07=function(_0x2154e7,_0x195446){_0x2154e7=_0x2154e7-0x0;var _0x462859=_0xb074[_0x2154e7];return _0x462859;};'use strict';var multer=require(_0x4b07('0x0'));var util=require(_0x4b07('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4b07('0x2'));var router=express[_0x4b07('0x3')]();var auth=require(_0x4b07('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4b07('0x5'));var controller=require(_0x4b07('0x6'));router[_0x4b07('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4b07('0x7')](_0x4b07('0x8'),auth[_0x4b07('0x9')](),controller[_0x4b07('0xa')]);router[_0x4b07('0xb')]('/',auth[_0x4b07('0x9')](),controller[_0x4b07('0xc')]);router[_0x4b07('0xd')](_0x4b07('0x8'),auth[_0x4b07('0x9')](),controller[_0x4b07('0xe')]);router[_0x4b07('0xf')](_0x4b07('0x8'),auth[_0x4b07('0x9')](),controller['destroy']);module[_0x4b07('0x10')]=router; \ No newline at end of file +var _0xeab8=['show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','get','/:id'];(function(_0x49e547,_0x1fbae7){var _0x595da0=function(_0x323c55){while(--_0x323c55){_0x49e547['push'](_0x49e547['shift']());}};_0x595da0(++_0x1fbae7);}(_0xeab8,0xfe));var _0x8eab=function(_0x2ca349,_0x7fd1b4){_0x2ca349=_0x2ca349-0x0;var _0x11edcb=_0xeab8[_0x2ca349];return _0x11edcb;};'use strict';var multer=require(_0x8eab('0x0'));var util=require(_0x8eab('0x1'));var path=require(_0x8eab('0x2'));var timeout=require(_0x8eab('0x3'));var express=require('express');var router=express[_0x8eab('0x4')]();var auth=require(_0x8eab('0x5'));var interaction=require(_0x8eab('0x6'));var config=require(_0x8eab('0x7'));var controller=require(_0x8eab('0x8'));router['get']('/',auth[_0x8eab('0x9')](),controller['index']);router[_0x8eab('0xa')](_0x8eab('0xb'),auth['isAuthenticated'](),controller[_0x8eab('0xc')]);router[_0x8eab('0xd')]('/',auth[_0x8eab('0x9')](),controller['create']);router[_0x8eab('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x8eab('0xf')]);router[_0x8eab('0x10')](_0x8eab('0xb'),auth['isAuthenticated'](),controller[_0x8eab('0x11')]);module[_0x8eab('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 4669b3d..b58decf 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 _0x2d4f=['STRING','exports','INTEGER','noop','TEXT'];(function(_0x4d7eff,_0x20826c){var _0x4fa4b3=function(_0x45e7ae){while(--_0x45e7ae){_0x4d7eff['push'](_0x4d7eff['shift']());}};_0x4fa4b3(++_0x20826c);}(_0x2d4f,0x150));var _0xf2d4=function(_0x5de21b,_0x5c76ba){_0x5de21b=_0x5de21b-0x0;var _0x4dbe50=_0x2d4f[_0x5de21b];return _0x4dbe50;};'use strict';var Sequelize=require('sequelize');module[_0xf2d4('0x0')]={'priority':{'type':Sequelize[_0xf2d4('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf2d4('0x2')},'appdata':{'type':Sequelize[_0xf2d4('0x3')]()},'description':{'type':Sequelize[_0xf2d4('0x4')]},'interval':{'type':Sequelize[_0xf2d4('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x2f9a=['noop','sequelize','STRING'];(function(_0x539cf6,_0x7466a2){var _0x4216b8=function(_0x3f9acd){while(--_0x3f9acd){_0x539cf6['push'](_0x539cf6['shift']());}};_0x4216b8(++_0x7466a2);}(_0x2f9a,0x7f));var _0xa2f9=function(_0x498b80,_0x4a207c){_0x498b80=_0x498b80-0x0;var _0x368941=_0x2f9a[_0x498b80];return _0x368941;};'use strict';var Sequelize=require(_0xa2f9('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xa2f9('0x1')],'allowNull':![],'defaultValue':_0xa2f9('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xa2f9('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 75397ac..9a499f0 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 _0xb11f=['sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','filter','options','include','rows','show','params','fields','includeAll','find','catch','create','body','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x442e11,_0x47488f){var _0x50495d=function(_0x3c72ba){while(--_0x3c72ba){_0x442e11['push'](_0x442e11['shift']());}};_0x50495d(++_0x47488f);}(_0xb11f,0x103));var _0xfb11=function(_0x157559,_0x3e1b99){_0x157559=_0x157559-0x0;var _0x165e17=_0xb11f[_0x157559];return _0x165e17;};'use strict';var pdf=require(_0xfb11('0x0'));var emlformat=require(_0xfb11('0x1'));var rimraf=require(_0xfb11('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfb11('0x3'));var rp=require(_0xfb11('0x4'));var moment=require(_0xfb11('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfb11('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xfb11('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfb11('0x8'));var squel=require(_0xfb11('0x9'));var crypto=require(_0xfb11('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfb11('0xb'));var toCsv=require(_0xfb11('0x7'));var querystring=require(_0xfb11('0xc'));var Papa=require('papaparse');var Redis=require(_0xfb11('0xd'));var authService=require(_0xfb11('0xe'));var qs=require(_0xfb11('0xf'));var as=require(_0xfb11('0x10'));var hardwareService=require(_0xfb11('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xfb11('0x12'));var licenseUtil=require(_0xfb11('0x13'));var db=require(_0xfb11('0x14'))['db'];function respondWithStatusCode(_0x3e2b7f,_0x3ae6c8){_0x3ae6c8=_0x3ae6c8||0xcc;return function(_0x2d3d38){if(_0x2d3d38){return _0x3e2b7f[_0xfb11('0x15')](_0x3ae6c8);}return _0x3e2b7f[_0xfb11('0x16')](_0x3ae6c8)[_0xfb11('0x17')]();};}function respondWithResult(_0x8ca91f,_0x4eb794){_0x4eb794=_0x4eb794||0xc8;return function(_0x533ecf){if(_0x533ecf){return _0x8ca91f[_0xfb11('0x16')](_0x4eb794)['json'](_0x533ecf);}};}function respondWithFilteredResult(_0x1c061e,_0x17109b){return function(_0x3fc216){if(_0x3fc216){var _0xbc1d8d=_0x3fc216[_0xfb11('0x18')],_0x16077e=_0x17109b[_0xfb11('0x19')],_0x3625ea=_0x17109b[_0xfb11('0x19')]+_0x17109b[_0xfb11('0x1a')],_0x451f47;if(_0x3625ea>=_0xbc1d8d){_0x3625ea=_0xbc1d8d;_0x451f47=0xc8;}else{_0x451f47=0xce;}_0x1c061e[_0xfb11('0x16')](_0x451f47);return _0x1c061e[_0xfb11('0x1b')](_0xfb11('0x1c'),_0x16077e+'-'+_0x3625ea+'/'+_0xbc1d8d)[_0xfb11('0x1d')](_0x3fc216);}return null;};}function patchUpdates(_0x4eea54){return function(_0x1354f5){try{jsonpatch['apply'](_0x1354f5,_0x4eea54,!![]);}catch(_0x2b045e){return BPromise[_0xfb11('0x1e')](_0x2b045e);}return _0x1354f5[_0xfb11('0x1f')]();};}function saveUpdates(_0x2bcab6,_0x1634c1){return function(_0x4b88c9){if(_0x4b88c9){return _0x4b88c9[_0xfb11('0x20')](_0x2bcab6)['then'](function(_0x23c8f9){return _0x23c8f9;});}return null;};}function removeEntity(_0x230842,_0x3c77b5){return function(_0x4d5a48){if(_0x4d5a48){return _0x4d5a48['destroy']()[_0xfb11('0x21')](function(){_0x230842[_0xfb11('0x16')](0xcc)[_0xfb11('0x17')]();});}};}function handleEntityNotFound(_0x381b91,_0x10609f){return function(_0x3cfdb7){if(!_0x3cfdb7){_0x381b91[_0xfb11('0x15')](0x194);}return _0x3cfdb7;};}function handleError(_0x9f8896,_0x44a7c9){_0x44a7c9=_0x44a7c9||0x1f4;return function(_0x56ee33){logger[_0xfb11('0x22')](_0x56ee33[_0xfb11('0x23')]);if(_0x56ee33[_0xfb11('0x24')]){delete _0x56ee33[_0xfb11('0x24')];}_0x9f8896[_0xfb11('0x16')](_0x44a7c9)[_0xfb11('0x25')](_0x56ee33);};}exports[_0xfb11('0x26')]=function(_0x2a73ba,_0x29fccb){var _0x471919={},_0x289cb6={},_0x3c1d57={'count':0x0,'rows':[]};var _0x10bcd0=_[_0xfb11('0x27')](db[_0xfb11('0x28')][_0xfb11('0x29')],function(_0x370dbe){return{'name':_0x370dbe[_0xfb11('0x2a')],'type':_0x370dbe['type']['key']};});_0x289cb6[_0xfb11('0x2b')]=_[_0xfb11('0x27')](_0x10bcd0,_0xfb11('0x24'));_0x289cb6['query']=_[_0xfb11('0x2c')](_0x2a73ba[_0xfb11('0x2d')]);_0x289cb6[_0xfb11('0x2e')]=_[_0xfb11('0x2f')](_0x289cb6[_0xfb11('0x2b')],_0x289cb6[_0xfb11('0x2d')]);_0x471919[_0xfb11('0x30')]=_[_0xfb11('0x2f')](_0x289cb6[_0xfb11('0x2b')],qs['fields'](_0x2a73ba['query']['fields']));_0x471919[_0xfb11('0x30')]=_0x471919[_0xfb11('0x30')][_0xfb11('0x31')]?_0x471919[_0xfb11('0x30')]:_0x289cb6['model'];if(!_0x2a73ba[_0xfb11('0x2d')][_0xfb11('0x32')](_0xfb11('0x33'))){_0x471919[_0xfb11('0x1a')]=qs[_0xfb11('0x1a')](_0x2a73ba[_0xfb11('0x2d')]['limit']);_0x471919['offset']=qs[_0xfb11('0x19')](_0x2a73ba[_0xfb11('0x2d')][_0xfb11('0x19')]);}_0x471919['order']=qs['sort'](_0x2a73ba[_0xfb11('0x2d')][_0xfb11('0x34')]);_0x471919[_0xfb11('0x35')]=qs[_0xfb11('0x2e')](_[_0xfb11('0x36')](_0x2a73ba[_0xfb11('0x2d')],_0x289cb6[_0xfb11('0x2e')]),_0x10bcd0);if(_0x2a73ba['query']['filter']){_0x471919[_0xfb11('0x35')]=_[_0xfb11('0x37')](_0x471919[_0xfb11('0x35')],{'$or':_['map'](_0x10bcd0,function(_0x27284c){if(_0x27284c[_0xfb11('0x38')]!=='VIRTUAL'){var _0x393b61={};_0x393b61[_0x27284c[_0xfb11('0x24')]]={'$like':'%'+_0x2a73ba['query'][_0xfb11('0x39')]+'%'};return _0x393b61;}})});}_0x471919=_[_0xfb11('0x37')]({},_0x471919,_0x2a73ba[_0xfb11('0x3a')]);var _0x176feb={'where':_0x471919['where']};return db['WhatsappApplication'][_0xfb11('0x18')](_0x176feb)['then'](function(_0x3f6c14){_0x3c1d57['count']=_0x3f6c14;if(_0x2a73ba['query']['includeAll']){_0x471919[_0xfb11('0x3b')]=[{'all':!![]}];}return db[_0xfb11('0x28')]['findAll'](_0x471919);})[_0xfb11('0x21')](function(_0x378c99){_0x3c1d57[_0xfb11('0x3c')]=_0x378c99;return _0x3c1d57;})[_0xfb11('0x21')](respondWithFilteredResult(_0x29fccb,_0x471919))['catch'](handleError(_0x29fccb,null));};exports[_0xfb11('0x3d')]=function(_0x178f87,_0x1c2cb7){var _0x1458fa={'raw':!![],'where':{'id':_0x178f87[_0xfb11('0x3e')]['id']}},_0x12beca={};_0x12beca[_0xfb11('0x2b')]=_['keys'](db[_0xfb11('0x28')][_0xfb11('0x29')]);_0x12beca['query']=_[_0xfb11('0x2c')](_0x178f87[_0xfb11('0x2d')]);_0x12beca[_0xfb11('0x2e')]=_[_0xfb11('0x2f')](_0x12beca[_0xfb11('0x2b')],_0x12beca[_0xfb11('0x2d')]);_0x1458fa[_0xfb11('0x30')]=_['intersection'](_0x12beca[_0xfb11('0x2b')],qs[_0xfb11('0x3f')](_0x178f87['query'][_0xfb11('0x3f')]));_0x1458fa[_0xfb11('0x30')]=_0x1458fa['attributes'][_0xfb11('0x31')]?_0x1458fa['attributes']:_0x12beca['model'];if(_0x178f87[_0xfb11('0x2d')][_0xfb11('0x40')]){_0x1458fa[_0xfb11('0x3b')]=[{'all':!![]}];}_0x1458fa=_[_0xfb11('0x37')]({},_0x1458fa,_0x178f87[_0xfb11('0x3a')]);return db[_0xfb11('0x28')][_0xfb11('0x41')](_0x1458fa)['then'](handleEntityNotFound(_0x1c2cb7,null))['then'](respondWithResult(_0x1c2cb7,null))[_0xfb11('0x42')](handleError(_0x1c2cb7,null));};exports[_0xfb11('0x43')]=function(_0x3bd0b6,_0xfb17c4){return db[_0xfb11('0x28')][_0xfb11('0x43')](_0x3bd0b6[_0xfb11('0x44')],{})[_0xfb11('0x21')](respondWithResult(_0xfb17c4,0xc9))[_0xfb11('0x42')](handleError(_0xfb17c4,null));};exports[_0xfb11('0x20')]=function(_0x74c716,_0x29804b){if(_0x74c716['body']['id']){delete _0x74c716[_0xfb11('0x44')]['id'];}return db[_0xfb11('0x28')][_0xfb11('0x41')]({'where':{'id':_0x74c716[_0xfb11('0x3e')]['id']}})[_0xfb11('0x21')](handleEntityNotFound(_0x29804b,null))[_0xfb11('0x21')](saveUpdates(_0x74c716[_0xfb11('0x44')],null))[_0xfb11('0x21')](respondWithResult(_0x29804b,null))[_0xfb11('0x42')](handleError(_0x29804b,null));};exports[_0xfb11('0x45')]=function(_0x103045,_0x5e385d){return db[_0xfb11('0x28')]['find']({'where':{'id':_0x103045[_0xfb11('0x3e')]['id']}})[_0xfb11('0x21')](handleEntityNotFound(_0x5e385d,null))[_0xfb11('0x21')](removeEntity(_0x5e385d,null))[_0xfb11('0x42')](handleError(_0x5e385d,null));}; \ No newline at end of file +var _0xcb6c=['sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcb6c,0x1a4));var _0xccb6=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xcb6c[_0x57b54c];return _0x59cc19;};'use strict';var pdf=require(_0xccb6('0x0'));var emlformat=require(_0xccb6('0x1'));var rimraf=require(_0xccb6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xccb6('0x3'));var rp=require('request-promise');var moment=require(_0xccb6('0x4'));var BPromise=require(_0xccb6('0x5'));var Mustache=require('mustache');var util=require(_0xccb6('0x6'));var path=require(_0xccb6('0x7'));var sox=require(_0xccb6('0x8'));var csv=require(_0xccb6('0x9'));var ejs=require(_0xccb6('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xccb6('0xb'));var crypto=require('crypto');var jsforce=require(_0xccb6('0xc'));var deskjs=require(_0xccb6('0xd'));var toCsv=require(_0xccb6('0x9'));var querystring=require(_0xccb6('0xe'));var Papa=require('papaparse');var Redis=require(_0xccb6('0xf'));var authService=require(_0xccb6('0x10'));var qs=require(_0xccb6('0x11'));var as=require(_0xccb6('0x12'));var hardwareService=require(_0xccb6('0x13'));var logger=require(_0xccb6('0x14'))('api');var utils=require(_0xccb6('0x15'));var config=require(_0xccb6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xccb6('0x17'))['db'];function respondWithStatusCode(_0x4ce1be,_0x1b2cf4){_0x1b2cf4=_0x1b2cf4||0xcc;return function(_0x52c79e){if(_0x52c79e){return _0x4ce1be[_0xccb6('0x18')](_0x1b2cf4);}return _0x4ce1be[_0xccb6('0x19')](_0x1b2cf4)[_0xccb6('0x1a')]();};}function respondWithResult(_0x3654d6,_0x29dbb3){_0x29dbb3=_0x29dbb3||0xc8;return function(_0x3a5abd){if(_0x3a5abd){return _0x3654d6['status'](_0x29dbb3)[_0xccb6('0x1b')](_0x3a5abd);}};}function respondWithFilteredResult(_0x154ba2,_0x11168f){return function(_0x89fd72){if(_0x89fd72){var _0x262db9=_0x89fd72['count'],_0x4e0bcc=_0x11168f[_0xccb6('0x1c')],_0x2ce362=_0x11168f['offset']+_0x11168f[_0xccb6('0x1d')],_0x57528e;if(_0x2ce362>=_0x262db9){_0x2ce362=_0x262db9;_0x57528e=0xc8;}else{_0x57528e=0xce;}_0x154ba2[_0xccb6('0x19')](_0x57528e);return _0x154ba2[_0xccb6('0x1e')](_0xccb6('0x1f'),_0x4e0bcc+'-'+_0x2ce362+'/'+_0x262db9)['json'](_0x89fd72);}return null;};}function patchUpdates(_0x393d50){return function(_0x348987){try{jsonpatch[_0xccb6('0x20')](_0x348987,_0x393d50,!![]);}catch(_0x504727){return BPromise['reject'](_0x504727);}return _0x348987[_0xccb6('0x21')]();};}function saveUpdates(_0x19d7c9,_0x4d21a4){return function(_0x4cefa0){if(_0x4cefa0){return _0x4cefa0['update'](_0x19d7c9)[_0xccb6('0x22')](function(_0x5d704e){return _0x5d704e;});}return null;};}function removeEntity(_0x1c757e,_0x4345a6){return function(_0x393015){if(_0x393015){return _0x393015[_0xccb6('0x23')]()[_0xccb6('0x22')](function(){_0x1c757e[_0xccb6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x412681,_0x15083a){return function(_0x417420){if(!_0x417420){_0x412681[_0xccb6('0x18')](0x194);}return _0x417420;};}function handleError(_0x235e01,_0x24e12b){_0x24e12b=_0x24e12b||0x1f4;return function(_0x5029d9){logger[_0xccb6('0x24')](_0x5029d9[_0xccb6('0x25')]);if(_0x5029d9['name']){delete _0x5029d9[_0xccb6('0x26')];}_0x235e01[_0xccb6('0x19')](_0x24e12b)[_0xccb6('0x27')](_0x5029d9);};}exports[_0xccb6('0x28')]=function(_0x3e62de,_0x317e3d){var _0x16a79f={},_0xf2c2db={},_0x3e9444={'count':0x0,'rows':[]};var _0x11cd15=_[_0xccb6('0x29')](db[_0xccb6('0x2a')][_0xccb6('0x2b')],function(_0xa169bf){return{'name':_0xa169bf['fieldName'],'type':_0xa169bf[_0xccb6('0x2c')][_0xccb6('0x2d')]};});_0xf2c2db[_0xccb6('0x2e')]=_[_0xccb6('0x29')](_0x11cd15,_0xccb6('0x26'));_0xf2c2db[_0xccb6('0x2f')]=_['keys'](_0x3e62de[_0xccb6('0x2f')]);_0xf2c2db[_0xccb6('0x30')]=_['intersection'](_0xf2c2db[_0xccb6('0x2e')],_0xf2c2db[_0xccb6('0x2f')]);_0x16a79f[_0xccb6('0x31')]=_[_0xccb6('0x32')](_0xf2c2db[_0xccb6('0x2e')],qs[_0xccb6('0x33')](_0x3e62de[_0xccb6('0x2f')]['fields']));_0x16a79f['attributes']=_0x16a79f['attributes'][_0xccb6('0x34')]?_0x16a79f[_0xccb6('0x31')]:_0xf2c2db[_0xccb6('0x2e')];if(!_0x3e62de[_0xccb6('0x2f')]['hasOwnProperty'](_0xccb6('0x35'))){_0x16a79f[_0xccb6('0x1d')]=qs[_0xccb6('0x1d')](_0x3e62de[_0xccb6('0x2f')][_0xccb6('0x1d')]);_0x16a79f[_0xccb6('0x1c')]=qs['offset'](_0x3e62de['query'][_0xccb6('0x1c')]);}_0x16a79f[_0xccb6('0x36')]=qs[_0xccb6('0x37')](_0x3e62de[_0xccb6('0x2f')][_0xccb6('0x37')]);_0x16a79f[_0xccb6('0x38')]=qs[_0xccb6('0x30')](_[_0xccb6('0x39')](_0x3e62de[_0xccb6('0x2f')],_0xf2c2db[_0xccb6('0x30')]),_0x11cd15);if(_0x3e62de[_0xccb6('0x2f')][_0xccb6('0x3a')]){_0x16a79f[_0xccb6('0x38')]=_[_0xccb6('0x3b')](_0x16a79f['where'],{'$or':_[_0xccb6('0x29')](_0x11cd15,function(_0x28d83b){if(_0x28d83b[_0xccb6('0x2c')]!==_0xccb6('0x3c')){var _0x373b9f={};_0x373b9f[_0x28d83b[_0xccb6('0x26')]]={'$like':'%'+_0x3e62de[_0xccb6('0x2f')][_0xccb6('0x3a')]+'%'};return _0x373b9f;}})});}_0x16a79f=_[_0xccb6('0x3b')]({},_0x16a79f,_0x3e62de[_0xccb6('0x3d')]);var _0x38b2a1={'where':_0x16a79f['where']};return db[_0xccb6('0x2a')][_0xccb6('0x3e')](_0x38b2a1)[_0xccb6('0x22')](function(_0x394466){_0x3e9444[_0xccb6('0x3e')]=_0x394466;if(_0x3e62de['query'][_0xccb6('0x3f')]){_0x16a79f[_0xccb6('0x40')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xccb6('0x41')](_0x16a79f);})[_0xccb6('0x22')](function(_0x3b938c){_0x3e9444[_0xccb6('0x42')]=_0x3b938c;return _0x3e9444;})['then'](respondWithFilteredResult(_0x317e3d,_0x16a79f))[_0xccb6('0x43')](handleError(_0x317e3d,null));};exports[_0xccb6('0x44')]=function(_0x27218d,_0x3dc4ce){var _0x21c502={'raw':!![],'where':{'id':_0x27218d[_0xccb6('0x45')]['id']}},_0xef5482={};_0xef5482[_0xccb6('0x2e')]=_[_0xccb6('0x46')](db[_0xccb6('0x2a')][_0xccb6('0x2b')]);_0xef5482[_0xccb6('0x2f')]=_[_0xccb6('0x46')](_0x27218d[_0xccb6('0x2f')]);_0xef5482['filters']=_['intersection'](_0xef5482[_0xccb6('0x2e')],_0xef5482[_0xccb6('0x2f')]);_0x21c502['attributes']=_[_0xccb6('0x32')](_0xef5482[_0xccb6('0x2e')],qs[_0xccb6('0x33')](_0x27218d[_0xccb6('0x2f')]['fields']));_0x21c502['attributes']=_0x21c502[_0xccb6('0x31')][_0xccb6('0x34')]?_0x21c502[_0xccb6('0x31')]:_0xef5482[_0xccb6('0x2e')];if(_0x27218d[_0xccb6('0x2f')][_0xccb6('0x3f')]){_0x21c502[_0xccb6('0x40')]=[{'all':!![]}];}_0x21c502=_[_0xccb6('0x3b')]({},_0x21c502,_0x27218d[_0xccb6('0x3d')]);return db['WhatsappApplication'][_0xccb6('0x47')](_0x21c502)[_0xccb6('0x22')](handleEntityNotFound(_0x3dc4ce,null))[_0xccb6('0x22')](respondWithResult(_0x3dc4ce,null))['catch'](handleError(_0x3dc4ce,null));};exports[_0xccb6('0x48')]=function(_0x324789,_0x5b6014){return db[_0xccb6('0x2a')][_0xccb6('0x48')](_0x324789['body'],{})[_0xccb6('0x22')](respondWithResult(_0x5b6014,0xc9))['catch'](handleError(_0x5b6014,null));};exports['update']=function(_0x536566,_0x500940){if(_0x536566[_0xccb6('0x49')]['id']){delete _0x536566[_0xccb6('0x49')]['id'];}return db['WhatsappApplication']['find']({'where':{'id':_0x536566[_0xccb6('0x45')]['id']}})['then'](handleEntityNotFound(_0x500940,null))['then'](saveUpdates(_0x536566[_0xccb6('0x49')],null))['then'](respondWithResult(_0x500940,null))[_0xccb6('0x43')](handleError(_0x500940,null));};exports[_0xccb6('0x23')]=function(_0x42262b,_0x53dfbd){return db[_0xccb6('0x2a')]['find']({'where':{'id':_0x42262b[_0xccb6('0x45')]['id']}})[_0xccb6('0x22')](handleEntityNotFound(_0x53dfbd,null))[_0xccb6('0x22')](removeEntity(_0x53dfbd,null))[_0xccb6('0x43')](handleError(_0x53dfbd,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 74f32b6..570b339 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 _0x01de=['whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication'];(function(_0x4c6176,_0x204159){var _0x1caaeb=function(_0xf78baf){while(--_0xf78baf){_0x4c6176['push'](_0x4c6176['shift']());}};_0x1caaeb(++_0x204159);}(_0x01de,0x1b6));var _0xe01d=function(_0x2add23,_0x37f8dd){_0x2add23=_0x2add23-0x0;var _0x287daf=_0x01de[_0x2add23];return _0x287daf;};'use strict';var _=require(_0xe01d('0x0'));var util=require(_0xe01d('0x1'));var logger=require('../../config/logger')(_0xe01d('0x2'));var moment=require(_0xe01d('0x3'));var BPromise=require(_0xe01d('0x4'));var rp=require(_0xe01d('0x5'));var fs=require('fs');var path=require(_0xe01d('0x6'));var rimraf=require('rimraf');var config=require(_0xe01d('0x7'));var attributes=require(_0xe01d('0x8'));module[_0xe01d('0x9')]=function(_0x10f6e1,_0x1d3776){return _0x10f6e1[_0xe01d('0xa')](_0xe01d('0xb'),attributes,{'tableName':_0xe01d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe01d('0xd'),'collate':_0xe01d('0xe')});}; \ No newline at end of file +var _0xd0be=['define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x21212e,_0x19c6bf){var _0x455174=function(_0x163ec5){while(--_0x163ec5){_0x21212e['push'](_0x21212e['shift']());}};_0x455174(++_0x19c6bf);}(_0xd0be,0x11d));var _0xed0b=function(_0xf69e3c,_0xb098fe){_0xf69e3c=_0xf69e3c-0x0;var _0x2e253a=_0xd0be[_0xf69e3c];return _0x2e253a;};'use strict';var _=require('lodash');var util=require(_0xed0b('0x0'));var logger=require(_0xed0b('0x1'))('api');var moment=require(_0xed0b('0x2'));var BPromise=require(_0xed0b('0x3'));var rp=require(_0xed0b('0x4'));var fs=require('fs');var path=require(_0xed0b('0x5'));var rimraf=require(_0xed0b('0x6'));var config=require(_0xed0b('0x7'));var attributes=require('./whatsappApplication.attributes');module[_0xed0b('0x8')]=function(_0x1c4ebb,_0x504eda){return _0x1c4ebb[_0xed0b('0x9')](_0xed0b('0xa'),attributes,{'tableName':_0xed0b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xed0b('0xc'),'collate':_0xed0b('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 7f63050..5f8394d 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 _0x14f5=['WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x14a27b,_0x3a1d4d){var _0x1cdd25=function(_0x313f05){while(--_0x313f05){_0x14a27b['push'](_0x14a27b['shift']());}};_0x1cdd25(++_0x3a1d4d);}(_0x14f5,0xae));var _0x514f=function(_0x5d543b,_0x6a969a){_0x5d543b=_0x5d543b-0x0;var _0x2015b8=_0x14f5[_0x5d543b];return _0x2015b8;};'use strict';var _=require('lodash');var util=require(_0x514f('0x0'));var moment=require('moment');var BPromise=require(_0x514f('0x1'));var rs=require(_0x514f('0x2'));var fs=require('fs');var Redis=require(_0x514f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x514f('0x4'));var logger=require(_0x514f('0x5'))('rpc');var config=require(_0x514f('0x6'));var jayson=require(_0x514f('0x7'));var client=jayson[_0x514f('0x8')][_0x514f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x463985,_0x43ec42,_0xdb9614){return new BPromise(function(_0x4a5497,_0x203b02){return client['request'](_0x463985,_0xdb9614)[_0x514f('0xa')](function(_0x1e3fa7){logger[_0x514f('0xb')](_0x514f('0xc'),_0x43ec42,_0x514f('0xd'));logger[_0x514f('0xe')](_0x514f('0xf'),_0x43ec42,'request\x20sent',JSON['stringify'](_0x1e3fa7));if(_0x1e3fa7['error']){if(_0x1e3fa7[_0x514f('0x10')][_0x514f('0x11')]===0x1f4){logger[_0x514f('0x10')](_0x514f('0xc'),_0x43ec42,_0x1e3fa7[_0x514f('0x10')][_0x514f('0x12')]);return _0x203b02(_0x1e3fa7[_0x514f('0x10')][_0x514f('0x12')]);}logger[_0x514f('0x10')](_0x514f('0xc'),_0x43ec42,_0x1e3fa7[_0x514f('0x10')][_0x514f('0x12')]);return _0x4a5497(_0x1e3fa7[_0x514f('0x10')][_0x514f('0x12')]);}else{logger[_0x514f('0xb')]('WhatsappApplication,\x20%s,\x20%s',_0x43ec42,_0x514f('0xd'));_0x4a5497(_0x1e3fa7[_0x514f('0x13')]['message']);}})[_0x514f('0x14')](function(_0x53851d){logger[_0x514f('0x10')](_0x514f('0xc'),_0x43ec42,_0x53851d);_0x203b02(_0x53851d);});});} \ No newline at end of file +var _0x0a6b=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','randomstring'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x1e1185,_0x35ca20){_0x1e1185=_0x1e1185-0x0;var _0x50615d=_0x0a6b[_0x1e1185];return _0x50615d;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb0a6('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb0a6('0x2'))['db'];var utils=require(_0xb0a6('0x3'));var logger=require(_0xb0a6('0x4'))('rpc');var config=require(_0xb0a6('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb0a6('0x6')][_0xb0a6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e2d2d,_0x11cd5b,_0x24515c){return new BPromise(function(_0x2a8516,_0x530c05){return client['request'](_0x5e2d2d,_0x24515c)['then'](function(_0x2ded05){logger[_0xb0a6('0x8')](_0xb0a6('0x9'),_0x11cd5b,_0xb0a6('0xa'));logger['debug'](_0xb0a6('0xb'),_0x11cd5b,_0xb0a6('0xa'),JSON['stringify'](_0x2ded05));if(_0x2ded05[_0xb0a6('0xc')]){if(_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xd')]===0x1f4){logger[_0xb0a6('0xc')](_0xb0a6('0x9'),_0x11cd5b,_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xe')]);return _0x530c05(_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xe')]);}logger[_0xb0a6('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x11cd5b,_0x2ded05[_0xb0a6('0xc')]['message']);return _0x2a8516(_0x2ded05[_0xb0a6('0xc')]['message']);}else{logger[_0xb0a6('0x8')]('WhatsappApplication,\x20%s,\x20%s',_0x11cd5b,_0xb0a6('0xa'));_0x2a8516(_0x2ded05[_0xb0a6('0xf')][_0xb0a6('0xe')]);}})['catch'](function(_0x56b594){logger[_0xb0a6('0xc')](_0xb0a6('0x9'),_0x11cd5b,_0x56b594);_0x530c05(_0x56b594);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index a5e883d..dba435b 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 _0x77eb=['removeTags','exports','multer','util','path','express','Router','../../config/environment','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','post','create','/:id/tags','tracked','whatsapp','put','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy'];(function(_0x3f1306,_0x3e6e7c){var _0x2562d2=function(_0x3f0182){while(--_0x3f0182){_0x3f1306['push'](_0x3f1306['shift']());}};_0x2562d2(++_0x3e6e7c);}(_0x77eb,0x98));var _0xb77e=function(_0xa2b098,_0x461a08){_0xa2b098=_0xa2b098-0x0;var _0x29502e=_0x77eb[_0xa2b098];return _0x29502e;};'use strict';var multer=require(_0xb77e('0x0'));var util=require(_0xb77e('0x1'));var path=require(_0xb77e('0x2'));var timeout=require('connect-timeout');var express=require(_0xb77e('0x3'));var router=express[_0xb77e('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb77e('0x5'));var controller=require('./whatsappInteraction.controller');router[_0xb77e('0x6')]('/',auth[_0xb77e('0x7')](),controller[_0xb77e('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xb77e('0x9')]);router['get'](_0xb77e('0xa'),auth[_0xb77e('0x7')](),controller['show']);router[_0xb77e('0x6')](_0xb77e('0xb'),auth[_0xb77e('0x7')](),controller[_0xb77e('0xc')]);router[_0xb77e('0x6')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xb77e('0xd')]('/',auth['isAuthenticated'](),controller[_0xb77e('0xe')]);router[_0xb77e('0xd')](_0xb77e('0xb'),auth[_0xb77e('0x7')](),controller['addMessage']);router['post'](_0xb77e('0xf'),auth['isAuthenticated'](),interaction[_0xb77e('0x10')](_0xb77e('0x11'),'whatsappinteraction:addtags'),controller['addTags']);router[_0xb77e('0x12')](_0xb77e('0xa'),auth[_0xb77e('0x7')](),interaction['tracked']('whatsapp',_0xb77e('0x13')),controller['update']);router[_0xb77e('0x14')](_0xb77e('0xa'),auth[_0xb77e('0x7')](),interaction[_0xb77e('0x10')](_0xb77e('0x11'),_0xb77e('0x15')),controller[_0xb77e('0x16')]);router[_0xb77e('0x14')](_0xb77e('0xf'),auth[_0xb77e('0x7')](),controller[_0xb77e('0x17')]);module[_0xb77e('0x18')]=router; \ No newline at end of file +var _0x32db=['/:id','show','/:id/messages','/:id/download','download','post','create','/:id/tags','tracked','whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe'];(function(_0x4378e0,_0x7f658c){var _0x4b2eb3=function(_0x4971c5){while(--_0x4971c5){_0x4378e0['push'](_0x4378e0['shift']());}};_0x4b2eb3(++_0x7f658c);}(_0x32db,0x1dd));var _0xb32d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x32db[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xb32d('0x0'));var util=require(_0xb32d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb32d('0x2')]();var auth=require(_0xb32d('0x3'));var interaction=require(_0xb32d('0x4'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0xb32d('0x5')]('/',auth[_0xb32d('0x6')](),controller[_0xb32d('0x7')]);router[_0xb32d('0x5')]('/describe',auth[_0xb32d('0x6')](),controller[_0xb32d('0x8')]);router[_0xb32d('0x5')](_0xb32d('0x9'),auth['isAuthenticated'](),controller[_0xb32d('0xa')]);router[_0xb32d('0x5')](_0xb32d('0xb'),auth[_0xb32d('0x6')](),controller['getMessages']);router[_0xb32d('0x5')](_0xb32d('0xc'),auth[_0xb32d('0x6')](),controller[_0xb32d('0xd')]);router[_0xb32d('0xe')]('/',auth['isAuthenticated'](),controller[_0xb32d('0xf')]);router[_0xb32d('0xe')](_0xb32d('0xb'),auth['isAuthenticated'](),controller['addMessage']);router[_0xb32d('0xe')](_0xb32d('0x10'),auth[_0xb32d('0x6')](),interaction[_0xb32d('0x11')]('whatsapp',_0xb32d('0x12')),controller[_0xb32d('0x13')]);router[_0xb32d('0x14')](_0xb32d('0x9'),auth[_0xb32d('0x6')](),interaction[_0xb32d('0x11')](_0xb32d('0x15'),_0xb32d('0x16')),controller[_0xb32d('0x17')]);router[_0xb32d('0x18')](_0xb32d('0x9'),auth[_0xb32d('0x6')](),interaction[_0xb32d('0x11')]('whatsapp',_0xb32d('0x19')),controller['destroy']);router['delete']('/:id/tags',auth[_0xb32d('0x6')](),controller['removeTags']);module[_0xb32d('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 5ac5165..ce543e0 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 _0x7d51=['STRING','out','ENUM','sequelize','moment','DATE'];(function(_0x49ab54,_0x487c8b){var _0x173ea3=function(_0x7dc49d){while(--_0x7dc49d){_0x49ab54['push'](_0x49ab54['shift']());}};_0x173ea3(++_0x487c8b);}(_0x7d51,0x1e9));var _0x17d5=function(_0x42ff7a,_0x368e66){_0x42ff7a=_0x42ff7a-0x0;var _0x5335ba=_0x7d51[_0x42ff7a];return _0x5335ba;};'use strict';var Sequelize=require(_0x17d5('0x0'));var moment=require(_0x17d5('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x17d5('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x17d5('0x3')]},'thirdDisposition':{'type':Sequelize[_0x17d5('0x3')]},'note':{'type':Sequelize[_0x17d5('0x3')]},'phone':{'type':Sequelize[_0x17d5('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x17d5('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x17d5('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x17d5('0x5')]('in',_0x17d5('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xecf3=['exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xecf3,0x66));var _0x3ecf=function(_0x25234f,_0x1fe636){_0x25234f=_0x25234f-0x0;var _0x4195bb=_0xecf3[_0x25234f];return _0x4195bb;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x3ecf('0x0')]={'closed':{'type':Sequelize[_0x3ecf('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3ecf('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x3ecf('0x3')]},'thirdDisposition':{'type':Sequelize[_0x3ecf('0x3')]},'note':{'type':Sequelize[_0x3ecf('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x3ecf('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x3ecf('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3ecf('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x3ecf('0x5')),'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 f4afc4e..f273c69 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 _0x5f2f=['filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','keyBy','merge','unreadMessages','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','toString','groupBy','WhatsappInteractionId','all','rows','show','params','rawAttributes','includeAll','include','options','create','body','describe','addMessage','omit','ids','getMessages','pick','format','YYYY-MM-DD\x20HH:mm:ss','WhatsappMessage','setTags','findAll','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','CmContact','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Whatsapp','YYYY-MM-DD','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','renderFile','views','downloadInteraction.html','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','fullname','TagIds','forEach','Tags','push','catch','index','map','WhatsappInteraction','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','having','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','text','start','Tag','split','union','User','UserId','buildExpression','keys','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4a2aa1,_0x552a98){_0x4a2aa1=_0x4a2aa1-0x0;var _0x23f0ce=_0x5f2f[_0x4a2aa1];return _0x23f0ce;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];config[_0xf5f2('0x18')]=_[_0xf5f2('0x19')](config[_0xf5f2('0x18')],{'host':_0xf5f2('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf5f2('0x18')]));require(_0xf5f2('0x1b'))[_0xf5f2('0x1c')](socket);function respondWithStatusCode(_0x1c1a5c,_0x422b55){_0x422b55=_0x422b55||0xcc;return function(_0x4d97fc){if(_0x4d97fc){return _0x1c1a5c[_0xf5f2('0x1d')](_0x422b55);}return _0x1c1a5c[_0xf5f2('0x1e')](_0x422b55)[_0xf5f2('0x1f')]();};}function respondWithResult(_0x1b6dd2,_0x23e23a){_0x23e23a=_0x23e23a||0xc8;return function(_0x3a9dbb){if(_0x3a9dbb){return _0x1b6dd2[_0xf5f2('0x1e')](_0x23e23a)[_0xf5f2('0x20')](_0x3a9dbb);}};}function respondWithFilteredResult(_0x11f702,_0x228ace){return function(_0x20fccd){if(_0x20fccd){var _0x28e097=_0x20fccd[_0xf5f2('0x21')],_0x4ff59b=_0x228ace[_0xf5f2('0x22')],_0x3ee69=_0x228ace['offset']+_0x228ace[_0xf5f2('0x23')],_0x3cf5ea;if(_0x3ee69>=_0x28e097){_0x3ee69=_0x28e097;_0x3cf5ea=0xc8;}else{_0x3cf5ea=0xce;}_0x11f702[_0xf5f2('0x1e')](_0x3cf5ea);return _0x11f702['set']('Content-Range',_0x4ff59b+'-'+_0x3ee69+'/'+_0x28e097)[_0xf5f2('0x20')](_0x20fccd);}return null;};}function patchUpdates(_0x388e6c){return function(_0x4ae323){try{jsonpatch[_0xf5f2('0x24')](_0x4ae323,_0x388e6c,!![]);}catch(_0x170042){return BPromise[_0xf5f2('0x25')](_0x170042);}return _0x4ae323[_0xf5f2('0x26')]();};}function saveUpdates(_0x36f1cb,_0x4c691a){return function(_0x21cd91){if(_0x21cd91){return _0x21cd91[_0xf5f2('0x27')](_0x36f1cb)[_0xf5f2('0x28')](function(_0x2833fe){return _0x2833fe;});}return null;};}function removeEntity(_0x287ad5,_0x5bdf4a){return function(_0x529f07){if(_0x529f07){return _0x529f07[_0xf5f2('0x29')]()[_0xf5f2('0x28')](function(){_0x287ad5[_0xf5f2('0x1e')](0xcc)[_0xf5f2('0x1f')]();});}};}function handleEntityNotFound(_0xf6c58d,_0x788a8d){return function(_0x13a3be){if(!_0x13a3be){_0xf6c58d[_0xf5f2('0x1d')](0x194);}return _0x13a3be;};}function handleError(_0x294414,_0x4ab014){_0x4ab014=_0x4ab014||0x1f4;return function(_0xaa2602){logger[_0xf5f2('0x2a')](_0xaa2602[_0xf5f2('0x2b')]);if(_0xaa2602[_0xf5f2('0x2c')]){delete _0xaa2602[_0xf5f2('0x2c')];}_0x294414[_0xf5f2('0x1e')](_0x4ab014)['send'](_0xaa2602);};}function getInteractionUsers(_0x53cb96,_0x22c826){return new BPromise(function(_0x14c829,_0x11c771){try{if(_0x22c826[_0x53cb96['id']]){_0x53cb96['Users']=_['map'](_0x22c826[_0x53cb96['id']],function(_0x29571b){return{'id':_0x29571b['id'],'fullname':_0x29571b[_0xf5f2('0x2d')]};});}}catch(_0x17394a){_0x11c771(_0x17394a);}_0x14c829(_0x53cb96);});}function getInteractionTags(_0x153924,_0x1b381e){return new BPromise(function(_0x54c0c8,_0x52e959){try{if(_0x153924[_0xf5f2('0x2e')]){_0x153924['Tags']=[];_0x153924[_0xf5f2('0x2e')]['split'](',')[_0xf5f2('0x2f')](function(_0x31087c){_0x153924[_0xf5f2('0x30')][_0xf5f2('0x31')](_0x1b381e[_0x31087c]);});}delete _0x153924[_0xf5f2('0x2e')];}catch(_0x277eee){_0x52e959(_0x277eee);}_0x54c0c8(_0x153924);});}function updateWhatsappInteraction(_0x2ac089,_0x2c0e05,_0x5ca917){return new BPromise(function(_0x4149e6,_0x43e4ff){return getInteractionUsers(_0x2ac089,_0x5ca917)[_0xf5f2('0x28')](function(_0x43c77d){return getInteractionTags(_0x43c77d,_0x2c0e05);})[_0xf5f2('0x28')](function(_0x27c0e7){_0x4149e6(_0x27c0e7);})[_0xf5f2('0x32')](function(_0x48d64d){_0x43e4ff(_0x48d64d);});});}exports[_0xf5f2('0x33')]=function(_0xf503e8,_0x55989d){var _0x3fc168={},_0x4b8c42={},_0x18ae07={'count':0x0,'rows':[]};var _0x3930fb=_[_0xf5f2('0x34')](db[_0xf5f2('0x35')]['rawAttributes'],function(_0x5a98d7){return{'name':_0x5a98d7[_0xf5f2('0x36')],'type':_0x5a98d7[_0xf5f2('0x37')][_0xf5f2('0x38')]};});_0x4b8c42['model']=_[_0xf5f2('0x34')](_0x3930fb,'name');_0x4b8c42[_0xf5f2('0x39')]=_['keys'](_0xf503e8[_0xf5f2('0x39')]);_0x4b8c42[_0xf5f2('0x3a')]=_['intersection'](_0x4b8c42[_0xf5f2('0x3b')],_0x4b8c42[_0xf5f2('0x39')]);_0x3fc168[_0xf5f2('0x3c')]=_[_0xf5f2('0x3d')](_0x4b8c42['model'],qs['fields'](_0xf503e8[_0xf5f2('0x39')][_0xf5f2('0x3e')]));_0x3fc168[_0xf5f2('0x3c')]=_0x3fc168[_0xf5f2('0x3c')][_0xf5f2('0x3f')]?_0x3fc168[_0xf5f2('0x3c')]:_0x4b8c42[_0xf5f2('0x3b')];if(!_0xf503e8['query'][_0xf5f2('0x40')](_0xf5f2('0x41'))){_0x3fc168['limit']=qs[_0xf5f2('0x23')](_0xf503e8[_0xf5f2('0x39')][_0xf5f2('0x23')]);_0x3fc168[_0xf5f2('0x22')]=qs[_0xf5f2('0x22')](_0xf503e8[_0xf5f2('0x39')][_0xf5f2('0x22')]);}_0x3fc168[_0xf5f2('0x42')]=qs['sort'](_0xf503e8[_0xf5f2('0x39')][_0xf5f2('0x43')]);_0x3fc168[_0xf5f2('0x44')]=qs['filters'](_['pick'](_0xf503e8['query'],_0x4b8c42[_0xf5f2('0x3a')]),_0x3930fb);var _0x2ad13c=[];var _0x4c8d8e=squel[_0xf5f2('0x45')]()[_0xf5f2('0x46')]('id')[_0xf5f2('0x46')](_0xf5f2('0x2c'))[_0xf5f2('0x46')](_0xf5f2('0x47'))[_0xf5f2('0x48')](_0xf5f2('0x49'));var _0x40c322=squel[_0xf5f2('0x45')]()[_0xf5f2('0x46')](_0xf5f2('0x4a'))[_0xf5f2('0x46')](_0xf5f2('0x4b'))['field'](_0xf5f2('0x4c'))['from'](_0xf5f2('0x4d'),'ui')[_0xf5f2('0x4e')](_0xf5f2('0x4f'),'u',_0xf5f2('0x50'));var _0x31bf0e=squel[_0xf5f2('0x45')]()['from'](_0xf5f2('0x51'),'i')[_0xf5f2('0x4e')](_0xf5f2('0x52'),'c',_0xf5f2('0x53'))[_0xf5f2('0x4e')](_0xf5f2('0x4f'),'o',_0xf5f2('0x54'))[_0xf5f2('0x4e')]('whatsapp_accounts','a',_0xf5f2('0x55'))[_0xf5f2('0x4e')](_0xf5f2('0x56'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0xf5f2('0x4e')](_0xf5f2('0x57'),'it',_0xf5f2('0x58'))['left_join']('tools_tags','t',_0xf5f2('0x59'));var _0x27c472=squel['expr']();var _0x14aa81=[];var _0x533cca=squel[_0xf5f2('0x5a')]();var _0x497eb8;if(_0xf503e8[_0xf5f2('0x39')]['search']){_0x497eb8=as[_0xf5f2('0x5b')](_0xf503e8[_0xf5f2('0x39')][_0xf5f2('0x5c')]);var _0x11a083=_0x497eb8['sqlOperator'];for(var _0x3154c1=0x0;_0x3154c1<_0x497eb8[_0xf5f2('0x5d')]['length'];_0x3154c1++){var _0x58213b=_0x497eb8[_0xf5f2('0x5d')][_0x3154c1];var _0x3dc0c4='i';var _0x57782c=_[_0xf5f2('0x5e')](_0x3930fb,[_0xf5f2('0x2c'),_0x58213b[_0xf5f2('0x46')]]);if(!_0x57782c){switch(_0x58213b[_0xf5f2('0x46')]){case'unreadMessages':if(_0x58213b['value']==0x1){_0x31bf0e[_0xf5f2('0x5f')]('`'+_0x58213b[_0xf5f2('0x46')]+'`\x20=\x200');}else{_0x31bf0e[_0xf5f2('0x5f')]('`'+_0x58213b[_0xf5f2('0x46')]+_0xf5f2('0x60'));}break;case _0xf5f2('0x61'):if(_0x58213b[_0xf5f2('0x62')]===_0xf5f2('0x63')){if(_0x58213b[_0xf5f2('0x64')]['split']('\x20')['length']>0x1){_0x27c472[_0x11a083](_0xf5f2('0x65'),qs[_0xf5f2('0x66')](_0x58213b[_0xf5f2('0x64')]),null);}else{var _0x46a905='%'+_0x58213b[_0xf5f2('0x64')]+'%';_0x27c472[_0x11a083]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x46a905,_0x46a905,_0x46a905);}}else{_0x57782c=_[_0xf5f2('0x5e')](_0x3930fb,[_0xf5f2('0x2c'),_0xf5f2('0x67')]);_0x58213b['field']=_0xf5f2('0x67');_0x20ccb6=as['buildExpression'](_0x3dc0c4,_0x57782c[_0xf5f2('0x37')],_0x58213b);_0x27c472[_0x11a083](_0x20ccb6[_0xf5f2('0x68')],_0x20ccb6[_0xf5f2('0x64')][_0xf5f2('0x69')],_0x20ccb6['value']['end']);}break;case _0xf5f2('0x6a'):var _0x4de303=_0x58213b[_0xf5f2('0x64')][_0xf5f2('0x6b')](',')['map'](function(_0x3f0579){return Number(_0x3f0579);});_0x4de303[_0xf5f2('0x2f')](function(_0x2a8f6d){_0x533cca['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2a8f6d+',%');});_0x14aa81=_[_0xf5f2('0x6c')](_0x14aa81,_0x4de303);break;case _0xf5f2('0x6d'):if(_0x58213b[_0xf5f2('0x62')]===_0xf5f2('0x63')){_0x27c472[_0x11a083]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x58213b[_0xf5f2('0x64')]+'%',null);}else{_0x57782c=_['find'](_0x3930fb,[_0xf5f2('0x2c'),_0xf5f2('0x6e')]);_0x58213b[_0xf5f2('0x46')]=_0xf5f2('0x6e');_0x20ccb6=as[_0xf5f2('0x6f')](_0x3dc0c4,_0x57782c['type'],_0x58213b);_0x27c472[_0x11a083](_0x20ccb6[_0xf5f2('0x68')],_0x20ccb6[_0xf5f2('0x64')][_0xf5f2('0x69')],_0x20ccb6[_0xf5f2('0x64')][_0xf5f2('0x1f')]);}break;case'body':_0x20ccb6=as[_0xf5f2('0x6f')]('me',null,_0x58213b);_0x27c472[_0x11a083](_0x20ccb6['text'],_0x20ccb6['value'][_0xf5f2('0x69')],_0x20ccb6['value'][_0xf5f2('0x1f')]);break;}}else{var _0x20ccb6=as[_0xf5f2('0x6f')](_0x3dc0c4,_0x57782c[_0xf5f2('0x37')],_0x58213b);_0x27c472[_0x11a083](_0x20ccb6['text'],_0x20ccb6[_0xf5f2('0x64')][_0xf5f2('0x69')],_0x20ccb6[_0xf5f2('0x64')][_0xf5f2('0x1f')]);}}}else{var _0x15b680=_(_0xf503e8[_0xf5f2('0x39')])[_0xf5f2('0x70')]()['map'](function(_0x1f55af){return _[_0xf5f2('0x71')](_0x3930fb,[_0xf5f2('0x2c'),_0x1f55af])?_0x1f55af:undefined;})[_0xf5f2('0x72')]()['value']();if(!_[_0xf5f2('0x73')](_0x15b680)){_0x15b680['forEach'](function(_0x410866){if(_0x410866===_0xf5f2('0x74')){_0x31bf0e['where'](_0xf5f2('0x75'),[][_0xf5f2('0x76')](_0xf503e8[_0xf5f2('0x39')][_0x410866]));}else if(_0x410866===_0xf5f2('0x77')){var _0x146462=JSON['parse'](_0xf503e8[_0xf5f2('0x39')][_0x410866])[_0xf5f2('0x78')];var _0x3a0e75=JSON[_0xf5f2('0x79')](_0xf503e8[_0xf5f2('0x39')][_0x410866])[_0xf5f2('0x7a')];_0x31bf0e['where'](_0xf5f2('0x7b'),_0x146462,_0x3a0e75);}else{if(_0xf503e8[_0xf5f2('0x39')][_0x410866]==='null'){_0x31bf0e[_0xf5f2('0x44')]('i.'+_0x410866+_0xf5f2('0x7c'));}else{_0x31bf0e[_0xf5f2('0x44')]('i.'+_0x410866+'\x20=\x20?',_0xf503e8['query'][_0x410866]);}}});}if(_0xf503e8['query'][_0xf5f2('0x7d')]){if(_0xf503e8[_0xf5f2('0x39')][_0xf5f2('0x7d')]==0x1){_0x31bf0e[_0xf5f2('0x5f')](_0xf5f2('0x7e'));}else{_0x31bf0e['having'](_0xf5f2('0x7f'));}}if(_0xf503e8[_0xf5f2('0x39')][_0xf5f2('0x80')]){_0x14aa81=_[_0xf5f2('0x81')](_0xf503e8[_0xf5f2('0x39')][_0xf5f2('0x80')])?_0xf503e8[_0xf5f2('0x39')][_0xf5f2('0x80')]:new Array(_0xf503e8[_0xf5f2('0x39')][_0xf5f2('0x80')]);_0x14aa81[_0xf5f2('0x2f')](function(_0x5679bc){_0x533cca['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5679bc+',%');});}if(_0xf503e8['query'][_0xf5f2('0x82')]){var _0xafba8e=_0xf503e8[_0xf5f2('0x39')][_0xf5f2('0x82')][_0xf5f2('0x83')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xf5f2('0x84')](_0xafba8e)){_0x27c472['or'](_0xf5f2('0x85'),_0xafba8e+'%')['or'](_0xf5f2('0x86'),_0xafba8e+'%');}else{_0x27c472['or'](_0xf5f2('0x87'),qs[_0xf5f2('0x66')](_0xafba8e))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0xafba8e+'%');}}}_0x31bf0e[_0xf5f2('0x44')](_0x27c472);_0x31bf0e[_0xf5f2('0x88')]('i.id');var _0x777098={'type':db[_0xf5f2('0x89')][_0xf5f2('0x8a')][_0xf5f2('0x8b')],'raw':!![]};var _0x588434=_0x31bf0e[_0xf5f2('0x8c')]();_0x588434[_0xf5f2('0x46')](_0xf5f2('0x8d'));_0x588434[_0xf5f2('0x46')](_0xf5f2('0x8e'),'unreadMessages');if(_0x3fc168['order']){_0x3fc168[_0xf5f2('0x42')][_0xf5f2('0x2f')](function(_0x17eb69){var _0xe3ea1e=_0x17eb69[0x0]==='contactName'?_0x17eb69[0x0]:'i.'+_0x17eb69[0x0];_0x31bf0e['order'](_0xe3ea1e,_0x17eb69[0x1]===_0xf5f2('0x8f')?![]:!![]);});}if(!_['isEmpty'](_0x14aa81)){_0x31bf0e['having'](_0x533cca);_0x588434['where']('t.id\x20IN\x20?',_0x14aa81);}BPromise[_0xf5f2('0x90')]()[_0xf5f2('0x28')](function(){if(!_0x497eb8){if(_0xf503e8[_0xf5f2('0x39')][_0xf5f2('0x74')])return;_0x588434[_0xf5f2('0x44')](_0xf5f2('0x91'));_0x31bf0e[_0xf5f2('0x44')](_0xf5f2('0x91'));return;}if(_0xf503e8[_0xf5f2('0x92')][_0xf5f2('0x93')]!==_0xf5f2('0x94'))return;return _0xf503e8[_0xf5f2('0x92')][_0xf5f2('0x95')]({'attributes':['id'],'raw':!![]})[_0xf5f2('0x28')](function(_0x796b01){if(_[_0xf5f2('0x73')](_0x796b01)){_0x588434[_0xf5f2('0x44')](_0xf5f2('0x96'));_0x31bf0e['where'](_0xf5f2('0x96'));}else{_0x588434[_0xf5f2('0x44')](_0xf5f2('0x75'),_[_0xf5f2('0x34')](_0x796b01,'id'));_0x31bf0e[_0xf5f2('0x44')](_0xf5f2('0x75'),_[_0xf5f2('0x34')](_0x796b01,'id'));}});})[_0xf5f2('0x28')](function(){if(_0xf503e8['user'][_0xf5f2('0x93')]==='agent'&&!_0x497eb8&&!_0xf503e8['query']['WhatsappAccountId'])return[];return db['sequelize']['query'](_0x588434['toString'](),_0x777098);})[_0xf5f2('0x28')](function(_0x18ce86){_0x18ae07[_0xf5f2('0x21')]=_0x18ce86[_0xf5f2('0x3f')];if(_0x18ae07[_0xf5f2('0x21')]===0x0)return[];return db[_0xf5f2('0x97')]['query'](_0x4c8d8e['toString'](),_0x777098)[_0xf5f2('0x28')](function(_0x578a22){_0x2ad13c=_[_0xf5f2('0x98')](_0x578a22,'id');_0x777098=_[_0xf5f2('0x99')](_0x777098,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xf503e8['query'][_0xf5f2('0x3e')]){_0x3fc168[_0xf5f2('0x3c')]['forEach'](function(_0x1c624f){_0x31bf0e[_0xf5f2('0x46')]('i.'+_0x1c624f);});}else{_0x31bf0e['field'](_0xf5f2('0x8e'),_0xf5f2('0x9a'));_0x31bf0e[_0xf5f2('0x46')]('a.key',_0xf5f2('0x9b'));_0x31bf0e[_0xf5f2('0x46')](_0xf5f2('0x9c'),_0xf5f2('0x9d'));_0x31bf0e[_0xf5f2('0x46')](_0xf5f2('0x9e'),_0xf5f2('0x9f'));_0x31bf0e[_0xf5f2('0x46')](_0xf5f2('0xa0'));_0x31bf0e[_0xf5f2('0x46')](_0xf5f2('0xa1'),_0xf5f2('0xa2'));_0x31bf0e[_0xf5f2('0x46')](_0xf5f2('0xa3'),_0xf5f2('0xa4'));_0x31bf0e[_0xf5f2('0x46')](_0xf5f2('0xa5'),_0xf5f2('0xa6'));_0x31bf0e[_0xf5f2('0x46')](_0xf5f2('0xa7'),_0xf5f2('0xa8'));_0x31bf0e['field'](_0xf5f2('0xa9'),_0xf5f2('0xaa'));_0x31bf0e['field'](_0xf5f2('0xab'),_0xf5f2('0xac'));_0x31bf0e['field'](_0xf5f2('0xad'),_0xf5f2('0xae'));_0x31bf0e[_0xf5f2('0x46')]('o.internal','Owner.internal');_0x31bf0e[_0xf5f2('0x46')](_0xf5f2('0xaf'),_0xf5f2('0x2e'));}if(_0x3fc168['limit'])_0x31bf0e['limit'](_0x3fc168[_0xf5f2('0x23')]);if(_0x3fc168[_0xf5f2('0x22')])_0x31bf0e[_0xf5f2('0x22')](_0x3fc168['offset']);return db['sequelize']['query'](_0x31bf0e['toString'](),_0x777098);})['then'](function(_0x4e884b){_0x40c322['where'](_0xf5f2('0xb0'),_[_0xf5f2('0x34')](_0x4e884b,'id'));return db[_0xf5f2('0x97')][_0xf5f2('0x39')](_0x40c322[_0xf5f2('0xb1')](),_0x777098)[_0xf5f2('0x28')](function(_0xa10f88){var _0x40e921=_[_0xf5f2('0xb2')](_0xa10f88,_0xf5f2('0xb3'));var _0x1bb4ac=[];_0x4e884b[_0xf5f2('0x2f')](function(_0x10c982){_0x1bb4ac['push'](updateWhatsappInteraction(_0x10c982,_0x2ad13c,_0x40e921));});return BPromise[_0xf5f2('0xb4')](_0x1bb4ac);});});})[_0xf5f2('0x28')](function(_0x5783e2){_0x18ae07[_0xf5f2('0xb5')]=_0x5783e2;return _0x18ae07;})[_0xf5f2('0x28')](respondWithFilteredResult(_0x55989d,_0x3fc168))['catch'](handleError(_0x55989d,null));};exports[_0xf5f2('0xb6')]=function(_0xfe9cf5,_0x281f61){var _0x4bd9e8={'raw':![],'where':{'id':_0xfe9cf5[_0xf5f2('0xb7')]['id']}},_0x21c5fc={};_0x21c5fc['model']=_[_0xf5f2('0x70')](db[_0xf5f2('0x35')][_0xf5f2('0xb8')]);_0x21c5fc['query']=_[_0xf5f2('0x70')](_0xfe9cf5['query']);_0x21c5fc[_0xf5f2('0x3a')]=_['intersection'](_0x21c5fc[_0xf5f2('0x3b')],_0x21c5fc[_0xf5f2('0x39')]);_0x4bd9e8[_0xf5f2('0x3c')]=_[_0xf5f2('0x3d')](_0x21c5fc['model'],qs[_0xf5f2('0x3e')](_0xfe9cf5['query']['fields']));_0x4bd9e8['attributes']=_0x4bd9e8[_0xf5f2('0x3c')][_0xf5f2('0x3f')]?_0x4bd9e8['attributes']:_0x21c5fc[_0xf5f2('0x3b')];if(_0xfe9cf5[_0xf5f2('0x39')][_0xf5f2('0xb9')]){_0x4bd9e8[_0xf5f2('0xba')]=[{'all':!![]}];}_0x4bd9e8=_[_0xf5f2('0x99')]({},_0x4bd9e8,_0xfe9cf5[_0xf5f2('0xbb')]);return db['WhatsappInteraction'][_0xf5f2('0x5e')](_0x4bd9e8)[_0xf5f2('0x28')](handleEntityNotFound(_0x281f61,null))['then'](respondWithResult(_0x281f61,null))[_0xf5f2('0x32')](handleError(_0x281f61,null));};exports[_0xf5f2('0xbc')]=function(_0x58042c,_0x32301a){return db[_0xf5f2('0x35')][_0xf5f2('0xbc')](_0x58042c[_0xf5f2('0xbd')],{})[_0xf5f2('0x28')](respondWithResult(_0x32301a,0xc9))[_0xf5f2('0x32')](handleError(_0x32301a,null));};exports['update']=function(_0x3f8452,_0x5a8af6){if(_0x3f8452[_0xf5f2('0xbd')]['id']){delete _0x3f8452[_0xf5f2('0xbd')]['id'];}return db[_0xf5f2('0x35')][_0xf5f2('0x5e')]({'where':{'id':_0x3f8452[_0xf5f2('0xb7')]['id']}})[_0xf5f2('0x28')](handleEntityNotFound(_0x5a8af6,null))[_0xf5f2('0x28')](saveUpdates(_0x3f8452['body'],null))[_0xf5f2('0x28')](respondWithResult(_0x5a8af6,null))[_0xf5f2('0x32')](handleError(_0x5a8af6,null));};exports[_0xf5f2('0x29')]=function(_0x934a7d,_0x35fe1a){return db[_0xf5f2('0x35')][_0xf5f2('0x5e')]({'where':{'id':_0x934a7d[_0xf5f2('0xb7')]['id']}})[_0xf5f2('0x28')](handleEntityNotFound(_0x35fe1a,null))[_0xf5f2('0x28')](removeEntity(_0x35fe1a,null))['catch'](handleError(_0x35fe1a,null));};exports['describe']=function(_0x2076c7,_0x46e2c6){return db[_0xf5f2('0x35')][_0xf5f2('0xbe')]()['then'](respondWithResult(_0x46e2c6,null))[_0xf5f2('0x32')](handleError(_0x46e2c6,null));};exports[_0xf5f2('0xbf')]=function(_0x3bb238,_0x3d7f53,_0x456a1e){return db['WhatsappMessage'][_0xf5f2('0x5e')]({'where':{'id':_0x3bb238[_0xf5f2('0xb7')]['id']}})['then'](handleEntityNotFound(_0x3d7f53,null))[_0xf5f2('0x28')](function(_0x3ff714){if(_0x3ff714){return _0x3ff714[_0xf5f2('0xbf')](_0x3bb238[_0xf5f2('0xbd')]['ids'],_[_0xf5f2('0xc0')](_0x3bb238[_0xf5f2('0xbd')],[_0xf5f2('0xc1'),'id'])||{});}})['then'](respondWithResult(_0x3d7f53,null))['catch'](handleError(_0x3d7f53,null));};exports[_0xf5f2('0xc2')]=function(_0x2a082c,_0x1432ef,_0x46aa62){var _0xbe2fb6={'raw':![],'where':{}};var _0x1a5d90={};var _0x58711d={'count':0x0,'rows':[]};return db[_0xf5f2('0x35')]['findOne']({'where':{'id':_0x2a082c[_0xf5f2('0xb7')]['id']}})[_0xf5f2('0x28')](handleEntityNotFound(_0x1432ef,null))[_0xf5f2('0x28')](function(_0xa74467){if(_0xa74467){_0x1a5d90[_0xf5f2('0x3b')]=_[_0xf5f2('0x70')](db['WhatsappMessage'][_0xf5f2('0xb8')]);_0x1a5d90[_0xf5f2('0x39')]=_[_0xf5f2('0x70')](_0x2a082c[_0xf5f2('0x39')]);_0x1a5d90[_0xf5f2('0x3a')]=_[_0xf5f2('0x3d')](_0x1a5d90[_0xf5f2('0x3b')],_0x1a5d90['query']);_0xbe2fb6[_0xf5f2('0x3c')]=_['intersection'](_0x1a5d90['model'],qs['fields'](_0x2a082c[_0xf5f2('0x39')][_0xf5f2('0x3e')]));_0xbe2fb6['attributes']=_0xbe2fb6[_0xf5f2('0x3c')][_0xf5f2('0x3f')]?_0xbe2fb6[_0xf5f2('0x3c')]:_0x1a5d90[_0xf5f2('0x3b')];if(!_0x2a082c['query'][_0xf5f2('0x40')](_0xf5f2('0x41'))){_0xbe2fb6[_0xf5f2('0x23')]=qs['limit'](_0x2a082c[_0xf5f2('0x39')][_0xf5f2('0x23')]);_0xbe2fb6['offset']=qs[_0xf5f2('0x22')](_0x2a082c[_0xf5f2('0x39')][_0xf5f2('0x22')]);}_0xbe2fb6[_0xf5f2('0x42')]=qs[_0xf5f2('0x43')](_0x2a082c[_0xf5f2('0x39')][_0xf5f2('0x43')]);_0xbe2fb6[_0xf5f2('0x44')]=qs[_0xf5f2('0x3a')](_[_0xf5f2('0xc3')](_0x2a082c[_0xf5f2('0x39')],_0x1a5d90['filters']));_0xbe2fb6[_0xf5f2('0x44')][_0xf5f2('0xb3')]=_0xa74467['id'];if(_0x2a082c['query'][_0xf5f2('0x82')]){_0xbe2fb6['where']=_[_0xf5f2('0x99')](_0xbe2fb6[_0xf5f2('0x44')],{'$or':_[_0xf5f2('0x34')](_0xbe2fb6[_0xf5f2('0x3c')],function(_0x57157a){var _0x451711={};_0x451711[_0x57157a]={'$like':'%'+_0x2a082c['query'][_0xf5f2('0x82')]+'%'};return _0x451711;})});}if(_0x2a082c['query'][_0xf5f2('0x78')]){var _0xde71c=_0x2a082c['query'][_0xf5f2('0x78')][_0xf5f2('0x6b')](',');var _0x16619b={};_0x16619b[_0xde71c[0x0]]={'$gte':moment(_0xde71c[0x1])[_0xf5f2('0xc4')](_0xf5f2('0xc5'))};_0xbe2fb6[_0xf5f2('0x44')]=_['merge'](_0xbe2fb6['where'],_0x16619b);}_0xbe2fb6=_[_0xf5f2('0x99')]({},_0xbe2fb6,_0x2a082c[_0xf5f2('0xbb')]);return db['WhatsappMessage'][_0xf5f2('0x21')]({'where':_0xbe2fb6[_0xf5f2('0x44')]})[_0xf5f2('0x28')](function(_0x1b4690){_0x58711d[_0xf5f2('0x21')]=_0x1b4690;if(_0x2a082c[_0xf5f2('0x39')][_0xf5f2('0xb9')]){_0xbe2fb6['include']=[{'all':!![]}];}return db[_0xf5f2('0xc6')]['findAll'](_0xbe2fb6);})[_0xf5f2('0x28')](function(_0x5ec0f3){_0x58711d[_0xf5f2('0xb5')]=_0x5ec0f3;return _0x58711d;});}})['then'](respondWithFilteredResult(_0x1432ef,_0xbe2fb6))[_0xf5f2('0x32')](handleError(_0x1432ef,null));};exports['addTags']=function(_0x51fd11,_0x2c285c,_0x2cfb98){return db['WhatsappInteraction'][_0xf5f2('0x5e')]({'where':{'id':_0x51fd11[_0xf5f2('0xb7')]['id']}})[_0xf5f2('0x28')](handleEntityNotFound(_0x2c285c,null))[_0xf5f2('0x28')](function(_0x1d1588){if(_0x1d1588){return _0x1d1588[_0xf5f2('0xc7')](_0x51fd11[_0xf5f2('0xbd')][_0xf5f2('0xc1')],_['omit'](_0x51fd11['body'],[_0xf5f2('0xc1'),'id'])||{})['spread'](function(){return db[_0xf5f2('0x6a')][_0xf5f2('0xc8')]({'attributes':['id',_0xf5f2('0x2c'),_0xf5f2('0x47')],'where':{'id':_0x51fd11[_0xf5f2('0xbd')][_0xf5f2('0xc1')]}});})[_0xf5f2('0x28')](function(_0x63dc22){socket[_0xf5f2('0xc9')](_0xf5f2('0xca'),{'id':Number(_0x51fd11[_0xf5f2('0xb7')]['id']),'tags':_0x63dc22||[]});return{'id':Number(_0x51fd11[_0xf5f2('0xb7')]['id']),'tags':_0x63dc22||[]};});}})['then'](respondWithResult(_0x2c285c,null))[_0xf5f2('0x32')](handleError(_0x2c285c,null));};exports['removeTags']=function(_0x12c153,_0x3910f9,_0x131fa8){return db[_0xf5f2('0x35')][_0xf5f2('0x5e')]({'where':{'id':_0x12c153[_0xf5f2('0xb7')]['id']}})[_0xf5f2('0x28')](handleEntityNotFound(_0x3910f9,null))[_0xf5f2('0x28')](function(_0x29db4f){if(_0x29db4f){return _0x29db4f[_0xf5f2('0xcb')](_0x12c153[_0xf5f2('0x39')]['ids']);}})[_0xf5f2('0x28')](respondWithStatusCode(_0x3910f9,null))[_0xf5f2('0x32')](handleError(_0x3910f9,null));};exports[_0xf5f2('0xcc')]=function(_0x18d4ce,_0x339035){var _0x3f8794=moment()[_0xf5f2('0xcd')]()['toString']();var _0x179995=path[_0xf5f2('0xce')](config[_0xf5f2('0xcf')],_0xf5f2('0xd0'),_0xf5f2('0xd1'),_0xf5f2('0xd2'));var _0x1b90d7=path[_0xf5f2('0xce')](config[_0xf5f2('0xcf')],_0xf5f2('0xd0'),_0xf5f2('0xd1'),_0xf5f2('0xd3'));var _0x15a94c=path[_0xf5f2('0xce')](_0x179995,_0x3f8794);var _0x140b28=util[_0xf5f2('0xc4')]('transcript-%d-%s.zip',_0x18d4ce[_0xf5f2('0xb7')]['id'],_0x3f8794);var _0x316162=path['join'](_0x179995,_0x140b28);var _0x59a477=[];_0x59a477[_0xf5f2('0x31')]({'model':db[_0xf5f2('0x6d')],'as':_0xf5f2('0x6d'),'attributes':['id',_0xf5f2('0x2d')],'raw':!![]});_0x59a477['push']({'model':db[_0xf5f2('0xd4')],'as':_0xf5f2('0x61'),'attributes':['id',_0xf5f2('0xd5'),_0xf5f2('0xd6')],'raw':!![]});if(_0x18d4ce[_0xf5f2('0x39')][_0xf5f2('0xd3')]){_0x59a477['push']({'model':db[_0xf5f2('0xd7')],'as':'Attachment','raw':!![]});}var _0x4f3dd0=[{'model':db[_0xf5f2('0xc6')],'as':_0xf5f2('0xd8'),'attributes':['id',_0xf5f2('0xbd'),_0xf5f2('0x77'),_0xf5f2('0xd9'),_0xf5f2('0xda'),_0xf5f2('0x7d')],'include':_0x59a477}];_0x4f3dd0['push']({'model':db[_0xf5f2('0xdb')],'as':_0xf5f2('0xdc'),'attributes':['id',_0xf5f2('0x2c')]});_0x4f3dd0['push']({'model':db[_0xf5f2('0x6d')],'as':'Owner','attributes':['id','fullname']});return db[_0xf5f2('0x35')]['find']({'where':{'id':_0x18d4ce[_0xf5f2('0xb7')]['id']},'include':_0x4f3dd0})[_0xf5f2('0x28')](handleEntityNotFound(_0x339035,null))['then'](function(_0x6cf15f){if(_0x6cf15f){var _0xdf8f44=_0x6cf15f['get']({'plain':!![]});fs[_0xf5f2('0xdd')](_0x15a94c);var _0xf60679={'format':'A4','border':_0xf5f2('0xde'),'header':{'height':_0xf5f2('0xdf'),'contents':{'first':_0xf5f2('0xe0')}},'footer':{'height':'30px','contents':{'default':util[_0xf5f2('0xc4')](_0xf5f2('0xe1'),util['format']('%s\x20#%d',_0xf5f2('0xe2'),_0xdf8f44['id']),moment()[_0xf5f2('0xc4')](_0xf5f2('0xe3'))[_0xf5f2('0xb1')]())}}};var _0x1f51d8={'channel':_0xf5f2('0xe2'),'account':_0xdf8f44[_0xf5f2('0xdc')][_0xf5f2('0x2c')],'agent':_0xdf8f44['Owner']?_0xdf8f44['Owner'][_0xf5f2('0x2d')]:'N.A.','createdAt':moment(_0xdf8f44[_0xf5f2('0x77')])[_0xf5f2('0xc4')](_0xf5f2('0xc5'))[_0xf5f2('0xb1')](),'closedAt':_0xdf8f44['closed']?moment(_0xdf8f44[_0xf5f2('0xe4')])[_0xf5f2('0xc4')](_0xf5f2('0xc5'))[_0xf5f2('0xb1')]():'','disposition':_0xdf8f44[_0xf5f2('0xe5')],'messages':_(_0xdf8f44['Messages'])[_0xf5f2('0x82')]({'secret':![]})[_0xf5f2('0x34')](function(_0x378009){if(_0x378009[_0xf5f2('0xd7')]){var _0x404ac7=path[_0xf5f2('0xce')](_0x1b90d7,_0x378009[_0xf5f2('0xd7')][_0xf5f2('0xe6')]);if(fs[_0xf5f2('0xe7')](_0x404ac7)){fs[_0xf5f2('0xe8')](_0x404ac7)[_0xf5f2('0xe9')](fs[_0xf5f2('0xea')](path['join'](_0x15a94c,_0x378009[_0xf5f2('0xd7')]['basename'])));}}return{'date':moment(_0x378009[_0xf5f2('0x77')])[_0xf5f2('0xc4')](_0xf5f2('0xc5'))[_0xf5f2('0xb1')](),'sender':_0x378009[_0xf5f2('0xd9')]===_0xf5f2('0xeb')?_0x378009[_0xf5f2('0x6d')]?_0x378009[_0xf5f2('0x6d')][_0xf5f2('0x2d')]:_0xf5f2('0xec'):_0x378009[_0xf5f2('0x61')][_0xf5f2('0xd5')]+(_0x378009[_0xf5f2('0x61')][_0xf5f2('0xd6')]?'\x20'+_0x378009[_0xf5f2('0x61')][_0xf5f2('0xd6')]:''),'body':_0x378009[_0xf5f2('0xd7')]?_0x378009[_0xf5f2('0xd7')]['basename']:_0x378009[_0xf5f2('0xbd')],'direction':_0x378009['direction']==='out'?'A':'C','secret':_0x378009[_0xf5f2('0xda')],'read':_0x378009[_0xf5f2('0x7d')],'attachment':_0x378009['Attachment']};})[_0xf5f2('0x64')]()};return ejs[_0xf5f2('0xed')](path[_0xf5f2('0xce')](config[_0xf5f2('0xcf')],_0xf5f2('0xd0'),_0xf5f2('0xee'),_0xf5f2('0xef')),{'interaction':_0x1f51d8})[_0xf5f2('0x28')](function(_0x5b64c5){return new BPromise(function(_0x3cabf8,_0x27f99){pdf[_0xf5f2('0xbc')](_0x5b64c5,_0xf60679)['toFile'](path[_0xf5f2('0xce')](_0x15a94c,_0xf5f2('0xf0')+_0xdf8f44['id']+'-'+_0x3f8794+_0xf5f2('0xf1')),function(_0x2aac82,_0x52d3e9){if(_0x2aac82)return _0x27f99(_0x2aac82);_0x3cabf8(_0x52d3e9);});});})['then'](function(){return new BPromise(function(_0x3ece47,_0x3d7497){zipdir(_0x15a94c,{'saveTo':_0x316162},function(_0x46a0ee,_0x346693){if(_0x46a0ee)return _0x3d7497(_0x46a0ee);return _0x3ece47(_0x346693);});})[_0xf5f2('0x28')](function(){return new BPromise(function(_0x46f940,_0x2cead8){rimraf(_0x15a94c,function(_0x106f50){if(_0x106f50)_0x2cead8(_0x106f50);return _0x46f940();});});})[_0xf5f2('0x28')](function(){return _0x339035[_0xf5f2('0xcc')](_0x316162,_0x140b28,function(_0x59070b){if(_0x59070b){console[_0xf5f2('0xf2')](_0xf5f2('0xf3'),_0x59070b);}else{fs[_0xf5f2('0xf4')](_0x316162);}});});});}else{return _0x339035['sendStatus'](0xc8);}})[_0xf5f2('0x32')](handleError(_0x339035,null));}; \ No newline at end of file +var _0x5f66=['limit','offset','order','sort','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_whatsapp_interactions','left_join','u.id\x20=\x20ui.UserId','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','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','keys','some','isEmpty','WhatsappAccountId','where','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','i.id','QueryTypes','clone','contactName','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','toString','sequelize','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','WhatsappInteractionId','rows','show','includeAll','include','merge','options','create','params','describe','WhatsappMessage','addMessage','ids','getMessages','findOne','rawAttributes','format','findAll','addTags','setTags','omit','spread','emit','whatsappInteractionTags:save','removeTags','unix','join','root','server','files','tmp','transcript-%d-%s.zip','CmContact','firstName','lastName','attachments','Attachment','Messages','createdAt','secret','WhatsappAccount','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\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.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','download','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','status','json','count','set','apply','reject','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','split','forEach','Tags','push','catch','index','WhatsappInteraction','fieldName','type','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x567312,_0x33020e){var _0xea4df1=function(_0x4a9ada){while(--_0x4a9ada){_0x567312['push'](_0x567312['shift']());}};_0xea4df1(++_0x33020e);}(_0x5f66,0x1a0));var _0x65f6=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5f66[_0x278e3c];return _0x3e2d9b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x65f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65f6('0x1'));var jsonpatch=require(_0x65f6('0x2'));var rp=require(_0x65f6('0x3'));var moment=require(_0x65f6('0x4'));var BPromise=require(_0x65f6('0x5'));var Mustache=require('mustache');var util=require(_0x65f6('0x6'));var path=require('path');var sox=require(_0x65f6('0x7'));var csv=require(_0x65f6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x8'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];config[_0x65f6('0x14')]=_['defaults'](config[_0x65f6('0x14')],{'host':_0x65f6('0x15'),'port':0x18eb});var socket=require(_0x65f6('0x16'))(new Redis(config[_0x65f6('0x14')]));require(_0x65f6('0x17'))[_0x65f6('0x18')](socket);function respondWithStatusCode(_0x44144b,_0xb1d40a){_0xb1d40a=_0xb1d40a||0xcc;return function(_0x46dbc6){if(_0x46dbc6){return _0x44144b[_0x65f6('0x19')](_0xb1d40a);}return _0x44144b['status'](_0xb1d40a)[_0x65f6('0x1a')]();};}function respondWithResult(_0x49a913,_0x5dd324){_0x5dd324=_0x5dd324||0xc8;return function(_0x1693e6){if(_0x1693e6){return _0x49a913[_0x65f6('0x1b')](_0x5dd324)[_0x65f6('0x1c')](_0x1693e6);}};}function respondWithFilteredResult(_0x1c955c,_0x1b1cbb){return function(_0x1f974c){if(_0x1f974c){var _0xc8660c=_0x1f974c[_0x65f6('0x1d')],_0x18380e=_0x1b1cbb['offset'],_0x495dd6=_0x1b1cbb['offset']+_0x1b1cbb['limit'],_0x4d79a1;if(_0x495dd6>=_0xc8660c){_0x495dd6=_0xc8660c;_0x4d79a1=0xc8;}else{_0x4d79a1=0xce;}_0x1c955c[_0x65f6('0x1b')](_0x4d79a1);return _0x1c955c[_0x65f6('0x1e')]('Content-Range',_0x18380e+'-'+_0x495dd6+'/'+_0xc8660c)[_0x65f6('0x1c')](_0x1f974c);}return null;};}function patchUpdates(_0x270893){return function(_0xbee6a4){try{jsonpatch[_0x65f6('0x1f')](_0xbee6a4,_0x270893,!![]);}catch(_0x219ab2){return BPromise[_0x65f6('0x20')](_0x219ab2);}return _0xbee6a4['save']();};}function saveUpdates(_0x197a49,_0x4bb39e){return function(_0x5b9e2a){if(_0x5b9e2a){return _0x5b9e2a[_0x65f6('0x21')](_0x197a49)[_0x65f6('0x22')](function(_0x524e42){return _0x524e42;});}return null;};}function removeEntity(_0x1eeaaa,_0x471a33){return function(_0x2317ce){if(_0x2317ce){return _0x2317ce[_0x65f6('0x23')]()['then'](function(){_0x1eeaaa[_0x65f6('0x1b')](0xcc)[_0x65f6('0x1a')]();});}};}function handleEntityNotFound(_0x20a161,_0x5963e0){return function(_0x5cb131){if(!_0x5cb131){_0x20a161['sendStatus'](0x194);}return _0x5cb131;};}function handleError(_0x29abdb,_0x16cde8){_0x16cde8=_0x16cde8||0x1f4;return function(_0x4b2292){logger[_0x65f6('0x24')](_0x4b2292[_0x65f6('0x25')]);if(_0x4b2292['name']){delete _0x4b2292[_0x65f6('0x26')];}_0x29abdb[_0x65f6('0x1b')](_0x16cde8)[_0x65f6('0x27')](_0x4b2292);};}function getInteractionUsers(_0x559330,_0x4ac04b){return new BPromise(function(_0x488d36,_0x266cfe){try{if(_0x4ac04b[_0x559330['id']]){_0x559330[_0x65f6('0x28')]=_[_0x65f6('0x29')](_0x4ac04b[_0x559330['id']],function(_0x408ccc){return{'id':_0x408ccc['id'],'fullname':_0x408ccc[_0x65f6('0x2a')]};});}}catch(_0x14a387){_0x266cfe(_0x14a387);}_0x488d36(_0x559330);});}function getInteractionTags(_0x144e55,_0x4ace4c){return new BPromise(function(_0x4ea23d,_0x154cbd){try{if(_0x144e55[_0x65f6('0x2b')]){_0x144e55['Tags']=[];_0x144e55['TagIds'][_0x65f6('0x2c')](',')[_0x65f6('0x2d')](function(_0x11fe3b){_0x144e55[_0x65f6('0x2e')][_0x65f6('0x2f')](_0x4ace4c[_0x11fe3b]);});}delete _0x144e55[_0x65f6('0x2b')];}catch(_0x5792a0){_0x154cbd(_0x5792a0);}_0x4ea23d(_0x144e55);});}function updateWhatsappInteraction(_0x103265,_0x38f3c6,_0x46f03c){return new BPromise(function(_0x4bc037,_0x217f35){return getInteractionUsers(_0x103265,_0x46f03c)[_0x65f6('0x22')](function(_0xbaed3c){return getInteractionTags(_0xbaed3c,_0x38f3c6);})[_0x65f6('0x22')](function(_0x37c086){_0x4bc037(_0x37c086);})[_0x65f6('0x30')](function(_0x4d4d84){_0x217f35(_0x4d4d84);});});}exports[_0x65f6('0x31')]=function(_0x1b24ea,_0x4f3e22){var _0x36dbf4={},_0x5a740a={},_0x2b403b={'count':0x0,'rows':[]};var _0x50494b=_[_0x65f6('0x29')](db[_0x65f6('0x32')]['rawAttributes'],function(_0x12dee6){return{'name':_0x12dee6[_0x65f6('0x33')],'type':_0x12dee6[_0x65f6('0x34')]['key']};});_0x5a740a['model']=_[_0x65f6('0x29')](_0x50494b,'name');_0x5a740a[_0x65f6('0x35')]=_['keys'](_0x1b24ea[_0x65f6('0x35')]);_0x5a740a[_0x65f6('0x36')]=_['intersection'](_0x5a740a[_0x65f6('0x37')],_0x5a740a['query']);_0x36dbf4['attributes']=_[_0x65f6('0x38')](_0x5a740a[_0x65f6('0x37')],qs[_0x65f6('0x39')](_0x1b24ea[_0x65f6('0x35')][_0x65f6('0x39')]));_0x36dbf4[_0x65f6('0x3a')]=_0x36dbf4[_0x65f6('0x3a')][_0x65f6('0x3b')]?_0x36dbf4['attributes']:_0x5a740a[_0x65f6('0x37')];if(!_0x1b24ea['query'][_0x65f6('0x3c')](_0x65f6('0x3d'))){_0x36dbf4[_0x65f6('0x3e')]=qs[_0x65f6('0x3e')](_0x1b24ea['query'][_0x65f6('0x3e')]);_0x36dbf4[_0x65f6('0x3f')]=qs[_0x65f6('0x3f')](_0x1b24ea[_0x65f6('0x35')][_0x65f6('0x3f')]);}_0x36dbf4[_0x65f6('0x40')]=qs[_0x65f6('0x41')](_0x1b24ea[_0x65f6('0x35')][_0x65f6('0x41')]);_0x36dbf4['where']=qs[_0x65f6('0x36')](_[_0x65f6('0x42')](_0x1b24ea[_0x65f6('0x35')],_0x5a740a[_0x65f6('0x36')]),_0x50494b);var _0x83e2d9=[];var _0x1ac040=squel[_0x65f6('0x43')]()[_0x65f6('0x44')]('id')[_0x65f6('0x44')](_0x65f6('0x26'))[_0x65f6('0x44')](_0x65f6('0x45'))[_0x65f6('0x46')](_0x65f6('0x47'));var _0xb1a132=squel[_0x65f6('0x43')]()['field'](_0x65f6('0x48'))[_0x65f6('0x44')](_0x65f6('0x49'))[_0x65f6('0x44')]('ui.WhatsappInteractionId')[_0x65f6('0x46')](_0x65f6('0x4a'),'ui')[_0x65f6('0x4b')]('users','u',_0x65f6('0x4c'));var _0x3386a2=squel[_0x65f6('0x43')]()[_0x65f6('0x46')]('whatsapp_interactions','i')[_0x65f6('0x4b')]('cm_contacts','c',_0x65f6('0x4d'))[_0x65f6('0x4b')]('users','o',_0x65f6('0x4e'))['left_join'](_0x65f6('0x4f'),'a',_0x65f6('0x50'))[_0x65f6('0x4b')](_0x65f6('0x51'),'me',_0x65f6('0x52'))[_0x65f6('0x4b')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0x65f6('0x4b')](_0x65f6('0x47'),'t',_0x65f6('0x53'));var _0x1e9e29=squel[_0x65f6('0x54')]();var _0x2d6ab9=[];var _0x149c28=squel[_0x65f6('0x54')]();var _0x414f49;if(_0x1b24ea['query'][_0x65f6('0x55')]){_0x414f49=as[_0x65f6('0x56')](_0x1b24ea[_0x65f6('0x35')]['search']);var _0x47e749=_0x414f49[_0x65f6('0x57')];for(var _0x49ba5a=0x0;_0x49ba5a<_0x414f49[_0x65f6('0x58')][_0x65f6('0x3b')];_0x49ba5a++){var _0x57eb04=_0x414f49[_0x65f6('0x58')][_0x49ba5a];var _0x4f96c4='i';var _0x247be3=_[_0x65f6('0x59')](_0x50494b,[_0x65f6('0x26'),_0x57eb04['field']]);if(!_0x247be3){switch(_0x57eb04[_0x65f6('0x44')]){case _0x65f6('0x5a'):if(_0x57eb04['value']==0x1){_0x3386a2[_0x65f6('0x5b')]('`'+_0x57eb04[_0x65f6('0x44')]+'`\x20=\x200');}else{_0x3386a2[_0x65f6('0x5b')]('`'+_0x57eb04[_0x65f6('0x44')]+_0x65f6('0x5c'));}break;case _0x65f6('0x5d'):if(_0x57eb04[_0x65f6('0x5e')]===_0x65f6('0x5f')){if(_0x57eb04[_0x65f6('0x60')][_0x65f6('0x2c')]('\x20')['length']>0x1){_0x1e9e29[_0x47e749]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x57eb04[_0x65f6('0x60')]),null);}else{var _0x2091f1='%'+_0x57eb04[_0x65f6('0x60')]+'%';_0x1e9e29[_0x47e749](_0x65f6('0x61'),_0x2091f1,_0x2091f1,_0x2091f1);}}else{_0x247be3=_['find'](_0x50494b,[_0x65f6('0x26'),_0x65f6('0x62')]);_0x57eb04[_0x65f6('0x44')]='ContactId';_0x4241db=as[_0x65f6('0x63')](_0x4f96c4,_0x247be3[_0x65f6('0x34')],_0x57eb04);_0x1e9e29[_0x47e749](_0x4241db[_0x65f6('0x64')],_0x4241db['value']['start'],_0x4241db[_0x65f6('0x60')][_0x65f6('0x1a')]);}break;case _0x65f6('0x65'):var _0x39364f=_0x57eb04[_0x65f6('0x60')][_0x65f6('0x2c')](',')[_0x65f6('0x29')](function(_0x138334){return Number(_0x138334);});_0x39364f[_0x65f6('0x2d')](function(_0xddbd90){_0x149c28['or'](_0x65f6('0x66'),'%,'+_0xddbd90+',%');});_0x2d6ab9=_[_0x65f6('0x67')](_0x2d6ab9,_0x39364f);break;case _0x65f6('0x68'):if(_0x57eb04[_0x65f6('0x5e')]==='$substring'){_0x1e9e29[_0x47e749](_0x65f6('0x69'),'%'+_0x57eb04[_0x65f6('0x60')]+'%',null);}else{_0x247be3=_[_0x65f6('0x59')](_0x50494b,['name',_0x65f6('0x6a')]);_0x57eb04[_0x65f6('0x44')]=_0x65f6('0x6a');_0x4241db=as[_0x65f6('0x63')](_0x4f96c4,_0x247be3['type'],_0x57eb04);_0x1e9e29[_0x47e749](_0x4241db[_0x65f6('0x64')],_0x4241db[_0x65f6('0x60')][_0x65f6('0x6b')],_0x4241db[_0x65f6('0x60')]['end']);}break;case _0x65f6('0x6c'):_0x4241db=as[_0x65f6('0x63')]('me',null,_0x57eb04);_0x1e9e29[_0x47e749](_0x4241db['text'],_0x4241db[_0x65f6('0x60')][_0x65f6('0x6b')],_0x4241db[_0x65f6('0x60')]['end']);break;}}else{var _0x4241db=as[_0x65f6('0x63')](_0x4f96c4,_0x247be3[_0x65f6('0x34')],_0x57eb04);_0x1e9e29[_0x47e749](_0x4241db[_0x65f6('0x64')],_0x4241db[_0x65f6('0x60')][_0x65f6('0x6b')],_0x4241db['value']['end']);}}}else{var _0x59cd44=_(_0x1b24ea[_0x65f6('0x35')])[_0x65f6('0x6d')]()[_0x65f6('0x29')](function(_0x471bec){return _[_0x65f6('0x6e')](_0x50494b,[_0x65f6('0x26'),_0x471bec])?_0x471bec:undefined;})['compact']()[_0x65f6('0x60')]();if(!_[_0x65f6('0x6f')](_0x59cd44)){_0x59cd44['forEach'](function(_0x225aeb){if(_0x225aeb===_0x65f6('0x70')){_0x3386a2[_0x65f6('0x71')]('i.WhatsappAccountId\x20IN\x20?',[][_0x65f6('0x72')](_0x1b24ea[_0x65f6('0x35')][_0x225aeb]));}else if(_0x225aeb==='createdAt'){var _0x271d76=JSON[_0x65f6('0x73')](_0x1b24ea[_0x65f6('0x35')][_0x225aeb])[_0x65f6('0x74')];var _0x3d55f7=JSON[_0x65f6('0x73')](_0x1b24ea[_0x65f6('0x35')][_0x225aeb])['$lte'];_0x3386a2['where'](_0x65f6('0x75'),_0x271d76,_0x3d55f7);}else{if(_0x1b24ea[_0x65f6('0x35')][_0x225aeb]==='null'){_0x3386a2[_0x65f6('0x71')]('i.'+_0x225aeb+'\x20IS\x20NULL');}else{_0x3386a2[_0x65f6('0x71')]('i.'+_0x225aeb+'\x20=\x20?',_0x1b24ea[_0x65f6('0x35')][_0x225aeb]);}}});}if(_0x1b24ea[_0x65f6('0x35')][_0x65f6('0x76')]){if(_0x1b24ea[_0x65f6('0x35')][_0x65f6('0x76')]==0x1){_0x3386a2[_0x65f6('0x5b')](_0x65f6('0x77'));}else{_0x3386a2[_0x65f6('0x5b')](_0x65f6('0x78'));}}if(_0x1b24ea['query']['tag']){_0x2d6ab9=_[_0x65f6('0x79')](_0x1b24ea[_0x65f6('0x35')][_0x65f6('0x7a')])?_0x1b24ea['query']['tag']:new Array(_0x1b24ea[_0x65f6('0x35')][_0x65f6('0x7a')]);_0x2d6ab9[_0x65f6('0x2d')](function(_0xc703f9){_0x149c28['or'](_0x65f6('0x66'),'%,'+_0xc703f9+',%');});}if(_0x1b24ea[_0x65f6('0x35')]['filter']){var _0x4f42ae=_0x1b24ea[_0x65f6('0x35')][_0x65f6('0x7b')]['replace']('\x5c','\x5c\x5c')[_0x65f6('0x7c')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x4f42ae)){_0x1e9e29['or'](_0x65f6('0x7d'),_0x4f42ae+'%')['or'](_0x65f6('0x7e'),_0x4f42ae+'%');}else{_0x1e9e29['or'](_0x65f6('0x7f'),qs[_0x65f6('0x80')](_0x4f42ae))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x4f42ae+'%');}}}_0x3386a2[_0x65f6('0x71')](_0x1e9e29);_0x3386a2[_0x65f6('0x81')](_0x65f6('0x82'));var _0x59131c={'type':db['Sequelize'][_0x65f6('0x83')]['SELECT'],'raw':!![]};var _0x305967=_0x3386a2[_0x65f6('0x84')]();_0x305967[_0x65f6('0x44')](_0x65f6('0x82'));_0x305967['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x36dbf4[_0x65f6('0x40')]){_0x36dbf4[_0x65f6('0x40')][_0x65f6('0x2d')](function(_0x57464e){var _0x46cbde=_0x57464e[0x0]===_0x65f6('0x85')?_0x57464e[0x0]:'i.'+_0x57464e[0x0];_0x3386a2[_0x65f6('0x40')](_0x46cbde,_0x57464e[0x1]==='DESC'?![]:!![]);});}if(!_[_0x65f6('0x6f')](_0x2d6ab9)){_0x3386a2[_0x65f6('0x5b')](_0x149c28);_0x305967['where'](_0x65f6('0x86'),_0x2d6ab9);}BPromise[_0x65f6('0x87')]()['then'](function(){if(!_0x414f49){if(_0x1b24ea[_0x65f6('0x35')]['WhatsappAccountId'])return;_0x305967[_0x65f6('0x71')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x3386a2[_0x65f6('0x71')](_0x65f6('0x88'));return;}if(_0x1b24ea['user'][_0x65f6('0x89')]!==_0x65f6('0x8a'))return;return _0x1b24ea[_0x65f6('0x8b')][_0x65f6('0x8c')]({'attributes':['id'],'raw':!![]})[_0x65f6('0x22')](function(_0x31117f){if(_[_0x65f6('0x6f')](_0x31117f)){_0x305967[_0x65f6('0x71')](_0x65f6('0x8d'));_0x3386a2[_0x65f6('0x71')](_0x65f6('0x8d'));}else{_0x305967['where'](_0x65f6('0x8e'),_[_0x65f6('0x29')](_0x31117f,'id'));_0x3386a2[_0x65f6('0x71')](_0x65f6('0x8e'),_['map'](_0x31117f,'id'));}});})[_0x65f6('0x22')](function(){if(_0x1b24ea[_0x65f6('0x8b')]['role']===_0x65f6('0x8a')&&!_0x414f49&&!_0x1b24ea['query'][_0x65f6('0x70')])return[];return db['sequelize'][_0x65f6('0x35')](_0x305967[_0x65f6('0x8f')](),_0x59131c);})['then'](function(_0x4946c7){_0x2b403b[_0x65f6('0x1d')]=_0x4946c7[_0x65f6('0x3b')];if(_0x2b403b['count']===0x0)return[];return db[_0x65f6('0x90')][_0x65f6('0x35')](_0x1ac040[_0x65f6('0x8f')](),_0x59131c)['then'](function(_0x1348ec){_0x83e2d9=_[_0x65f6('0x91')](_0x1348ec,'id');_0x59131c=_['merge'](_0x59131c,{'model':db[_0x65f6('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1b24ea['query'][_0x65f6('0x39')]){_0x36dbf4['attributes']['forEach'](function(_0x20687f){_0x3386a2[_0x65f6('0x44')]('i.'+_0x20687f);});}else{_0x3386a2[_0x65f6('0x44')](_0x65f6('0x92'),_0x65f6('0x5a'));_0x3386a2[_0x65f6('0x44')](_0x65f6('0x93'),_0x65f6('0x94'));_0x3386a2['field']('a.mandatoryDisposition',_0x65f6('0x95'));_0x3386a2['field'](_0x65f6('0x96'),_0x65f6('0x85'));_0x3386a2[_0x65f6('0x44')](_0x65f6('0x97'));_0x3386a2[_0x65f6('0x44')]('c.firstName',_0x65f6('0x98'));_0x3386a2[_0x65f6('0x44')](_0x65f6('0x99'),'Contact.lastName');_0x3386a2[_0x65f6('0x44')](_0x65f6('0x9a'),_0x65f6('0x9b'));_0x3386a2[_0x65f6('0x44')](_0x65f6('0x9c'),_0x65f6('0x9d'));_0x3386a2['field']('c.mobile',_0x65f6('0x9e'));_0x3386a2[_0x65f6('0x44')](_0x65f6('0x9f'),_0x65f6('0xa0'));_0x3386a2['field']('o.fullname',_0x65f6('0xa1'));_0x3386a2[_0x65f6('0x44')](_0x65f6('0xa2'),_0x65f6('0xa3'));_0x3386a2[_0x65f6('0x44')](_0x65f6('0xa4'),'TagIds');}if(_0x36dbf4['limit'])_0x3386a2['limit'](_0x36dbf4[_0x65f6('0x3e')]);if(_0x36dbf4[_0x65f6('0x3f')])_0x3386a2[_0x65f6('0x3f')](_0x36dbf4[_0x65f6('0x3f')]);return db['sequelize']['query'](_0x3386a2[_0x65f6('0x8f')](),_0x59131c);})[_0x65f6('0x22')](function(_0x56077a){_0xb1a132[_0x65f6('0x71')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0x65f6('0x29')](_0x56077a,'id'));return db['sequelize'][_0x65f6('0x35')](_0xb1a132[_0x65f6('0x8f')](),_0x59131c)['then'](function(_0x33f6cb){var _0x330e18=_[_0x65f6('0xa5')](_0x33f6cb,_0x65f6('0xa6'));var _0xec6a56=[];_0x56077a[_0x65f6('0x2d')](function(_0x584ea4){_0xec6a56[_0x65f6('0x2f')](updateWhatsappInteraction(_0x584ea4,_0x83e2d9,_0x330e18));});return BPromise['all'](_0xec6a56);});});})[_0x65f6('0x22')](function(_0x56336a){_0x2b403b[_0x65f6('0xa7')]=_0x56336a;return _0x2b403b;})[_0x65f6('0x22')](respondWithFilteredResult(_0x4f3e22,_0x36dbf4))[_0x65f6('0x30')](handleError(_0x4f3e22,null));};exports[_0x65f6('0xa8')]=function(_0x535558,_0x2b6f98){var _0x35885c={'raw':![],'where':{'id':_0x535558['params']['id']}},_0x376a23={};_0x376a23['model']=_[_0x65f6('0x6d')](db[_0x65f6('0x32')]['rawAttributes']);_0x376a23[_0x65f6('0x35')]=_[_0x65f6('0x6d')](_0x535558[_0x65f6('0x35')]);_0x376a23['filters']=_[_0x65f6('0x38')](_0x376a23[_0x65f6('0x37')],_0x376a23['query']);_0x35885c[_0x65f6('0x3a')]=_[_0x65f6('0x38')](_0x376a23[_0x65f6('0x37')],qs['fields'](_0x535558[_0x65f6('0x35')][_0x65f6('0x39')]));_0x35885c[_0x65f6('0x3a')]=_0x35885c['attributes'][_0x65f6('0x3b')]?_0x35885c['attributes']:_0x376a23[_0x65f6('0x37')];if(_0x535558[_0x65f6('0x35')][_0x65f6('0xa9')]){_0x35885c[_0x65f6('0xaa')]=[{'all':!![]}];}_0x35885c=_[_0x65f6('0xab')]({},_0x35885c,_0x535558[_0x65f6('0xac')]);return db['WhatsappInteraction'][_0x65f6('0x59')](_0x35885c)[_0x65f6('0x22')](handleEntityNotFound(_0x2b6f98,null))[_0x65f6('0x22')](respondWithResult(_0x2b6f98,null))[_0x65f6('0x30')](handleError(_0x2b6f98,null));};exports[_0x65f6('0xad')]=function(_0x59407d,_0x59f421){return db['WhatsappInteraction'][_0x65f6('0xad')](_0x59407d[_0x65f6('0x6c')],{})[_0x65f6('0x22')](respondWithResult(_0x59f421,0xc9))['catch'](handleError(_0x59f421,null));};exports[_0x65f6('0x21')]=function(_0x4de6fa,_0x4b2edb){if(_0x4de6fa[_0x65f6('0x6c')]['id']){delete _0x4de6fa[_0x65f6('0x6c')]['id'];}return db['WhatsappInteraction'][_0x65f6('0x59')]({'where':{'id':_0x4de6fa[_0x65f6('0xae')]['id']}})[_0x65f6('0x22')](handleEntityNotFound(_0x4b2edb,null))[_0x65f6('0x22')](saveUpdates(_0x4de6fa[_0x65f6('0x6c')],null))[_0x65f6('0x22')](respondWithResult(_0x4b2edb,null))[_0x65f6('0x30')](handleError(_0x4b2edb,null));};exports[_0x65f6('0x23')]=function(_0x477f29,_0x350641){return db[_0x65f6('0x32')][_0x65f6('0x59')]({'where':{'id':_0x477f29['params']['id']}})[_0x65f6('0x22')](handleEntityNotFound(_0x350641,null))['then'](removeEntity(_0x350641,null))['catch'](handleError(_0x350641,null));};exports[_0x65f6('0xaf')]=function(_0x10a877,_0xdcfe8){return db[_0x65f6('0x32')]['describe']()[_0x65f6('0x22')](respondWithResult(_0xdcfe8,null))['catch'](handleError(_0xdcfe8,null));};exports['addMessage']=function(_0x416ed4,_0x99fe6e,_0x1a7e52){return db[_0x65f6('0xb0')][_0x65f6('0x59')]({'where':{'id':_0x416ed4[_0x65f6('0xae')]['id']}})['then'](handleEntityNotFound(_0x99fe6e,null))[_0x65f6('0x22')](function(_0x56bf49){if(_0x56bf49){return _0x56bf49[_0x65f6('0xb1')](_0x416ed4[_0x65f6('0x6c')][_0x65f6('0xb2')],_['omit'](_0x416ed4[_0x65f6('0x6c')],['ids','id'])||{});}})['then'](respondWithResult(_0x99fe6e,null))[_0x65f6('0x30')](handleError(_0x99fe6e,null));};exports[_0x65f6('0xb3')]=function(_0x2dbed5,_0xf364a9,_0x3b8dd5){var _0x5adf21={'raw':![],'where':{}};var _0x439af3={};var _0x400633={'count':0x0,'rows':[]};return db[_0x65f6('0x32')][_0x65f6('0xb4')]({'where':{'id':_0x2dbed5['params']['id']}})[_0x65f6('0x22')](handleEntityNotFound(_0xf364a9,null))[_0x65f6('0x22')](function(_0x344163){if(_0x344163){_0x439af3[_0x65f6('0x37')]=_[_0x65f6('0x6d')](db[_0x65f6('0xb0')][_0x65f6('0xb5')]);_0x439af3[_0x65f6('0x35')]=_['keys'](_0x2dbed5[_0x65f6('0x35')]);_0x439af3[_0x65f6('0x36')]=_[_0x65f6('0x38')](_0x439af3[_0x65f6('0x37')],_0x439af3[_0x65f6('0x35')]);_0x5adf21[_0x65f6('0x3a')]=_['intersection'](_0x439af3[_0x65f6('0x37')],qs[_0x65f6('0x39')](_0x2dbed5['query'][_0x65f6('0x39')]));_0x5adf21['attributes']=_0x5adf21[_0x65f6('0x3a')][_0x65f6('0x3b')]?_0x5adf21[_0x65f6('0x3a')]:_0x439af3[_0x65f6('0x37')];if(!_0x2dbed5[_0x65f6('0x35')]['hasOwnProperty'](_0x65f6('0x3d'))){_0x5adf21[_0x65f6('0x3e')]=qs[_0x65f6('0x3e')](_0x2dbed5[_0x65f6('0x35')][_0x65f6('0x3e')]);_0x5adf21['offset']=qs['offset'](_0x2dbed5[_0x65f6('0x35')][_0x65f6('0x3f')]);}_0x5adf21[_0x65f6('0x40')]=qs[_0x65f6('0x41')](_0x2dbed5['query']['sort']);_0x5adf21['where']=qs[_0x65f6('0x36')](_[_0x65f6('0x42')](_0x2dbed5[_0x65f6('0x35')],_0x439af3['filters']));_0x5adf21[_0x65f6('0x71')][_0x65f6('0xa6')]=_0x344163['id'];if(_0x2dbed5[_0x65f6('0x35')][_0x65f6('0x7b')]){_0x5adf21[_0x65f6('0x71')]=_['merge'](_0x5adf21[_0x65f6('0x71')],{'$or':_[_0x65f6('0x29')](_0x5adf21['attributes'],function(_0x5aaa94){var _0x30b766={};_0x30b766[_0x5aaa94]={'$like':'%'+_0x2dbed5[_0x65f6('0x35')][_0x65f6('0x7b')]+'%'};return _0x30b766;})});}if(_0x2dbed5[_0x65f6('0x35')][_0x65f6('0x74')]){var _0x57dffb=_0x2dbed5[_0x65f6('0x35')]['$gte'][_0x65f6('0x2c')](',');var _0x5d181a={};_0x5d181a[_0x57dffb[0x0]]={'$gte':moment(_0x57dffb[0x1])[_0x65f6('0xb6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5adf21[_0x65f6('0x71')]=_['merge'](_0x5adf21[_0x65f6('0x71')],_0x5d181a);}_0x5adf21=_[_0x65f6('0xab')]({},_0x5adf21,_0x2dbed5['options']);return db['WhatsappMessage'][_0x65f6('0x1d')]({'where':_0x5adf21[_0x65f6('0x71')]})[_0x65f6('0x22')](function(_0xcc2932){_0x400633[_0x65f6('0x1d')]=_0xcc2932;if(_0x2dbed5[_0x65f6('0x35')][_0x65f6('0xa9')]){_0x5adf21[_0x65f6('0xaa')]=[{'all':!![]}];}return db[_0x65f6('0xb0')][_0x65f6('0xb7')](_0x5adf21);})[_0x65f6('0x22')](function(_0x6babec){_0x400633[_0x65f6('0xa7')]=_0x6babec;return _0x400633;});}})[_0x65f6('0x22')](respondWithFilteredResult(_0xf364a9,_0x5adf21))[_0x65f6('0x30')](handleError(_0xf364a9,null));};exports[_0x65f6('0xb8')]=function(_0x1afc18,_0x5efe82,_0x557cbf){return db[_0x65f6('0x32')][_0x65f6('0x59')]({'where':{'id':_0x1afc18[_0x65f6('0xae')]['id']}})[_0x65f6('0x22')](handleEntityNotFound(_0x5efe82,null))[_0x65f6('0x22')](function(_0x849936){if(_0x849936){return _0x849936[_0x65f6('0xb9')](_0x1afc18[_0x65f6('0x6c')]['ids'],_[_0x65f6('0xba')](_0x1afc18[_0x65f6('0x6c')],[_0x65f6('0xb2'),'id'])||{})[_0x65f6('0xbb')](function(){return db['Tag'][_0x65f6('0xb7')]({'attributes':['id',_0x65f6('0x26'),'color'],'where':{'id':_0x1afc18[_0x65f6('0x6c')][_0x65f6('0xb2')]}});})[_0x65f6('0x22')](function(_0x207831){socket[_0x65f6('0xbc')](_0x65f6('0xbd'),{'id':Number(_0x1afc18['params']['id']),'tags':_0x207831||[]});return{'id':Number(_0x1afc18[_0x65f6('0xae')]['id']),'tags':_0x207831||[]};});}})[_0x65f6('0x22')](respondWithResult(_0x5efe82,null))[_0x65f6('0x30')](handleError(_0x5efe82,null));};exports[_0x65f6('0xbe')]=function(_0x5e77ba,_0x510277,_0x5d710b){return db[_0x65f6('0x32')][_0x65f6('0x59')]({'where':{'id':_0x5e77ba[_0x65f6('0xae')]['id']}})[_0x65f6('0x22')](handleEntityNotFound(_0x510277,null))[_0x65f6('0x22')](function(_0x5515a4){if(_0x5515a4){return _0x5515a4['removeTags'](_0x5e77ba[_0x65f6('0x35')][_0x65f6('0xb2')]);}})[_0x65f6('0x22')](respondWithStatusCode(_0x510277,null))['catch'](handleError(_0x510277,null));};exports['download']=function(_0x11f300,_0x4e819f){var _0x10a218=moment()[_0x65f6('0xbf')]()[_0x65f6('0x8f')]();var _0x17d9cc=path[_0x65f6('0xc0')](config[_0x65f6('0xc1')],_0x65f6('0xc2'),_0x65f6('0xc3'),_0x65f6('0xc4'));var _0x4cdc4c=path[_0x65f6('0xc0')](config[_0x65f6('0xc1')],'server',_0x65f6('0xc3'),'attachments');var _0x27afb5=path[_0x65f6('0xc0')](_0x17d9cc,_0x10a218);var _0x2149e1=util['format'](_0x65f6('0xc5'),_0x11f300['params']['id'],_0x10a218);var _0x568ca5=path[_0x65f6('0xc0')](_0x17d9cc,_0x2149e1);var _0x42dd14=[];_0x42dd14['push']({'model':db[_0x65f6('0x68')],'as':'User','attributes':['id',_0x65f6('0x2a')],'raw':!![]});_0x42dd14[_0x65f6('0x2f')]({'model':db[_0x65f6('0xc6')],'as':_0x65f6('0x5d'),'attributes':['id',_0x65f6('0xc7'),_0x65f6('0xc8')],'raw':!![]});if(_0x11f300[_0x65f6('0x35')][_0x65f6('0xc9')]){_0x42dd14['push']({'model':db[_0x65f6('0xca')],'as':_0x65f6('0xca'),'raw':!![]});}var _0x4723e9=[{'model':db[_0x65f6('0xb0')],'as':_0x65f6('0xcb'),'attributes':['id','body',_0x65f6('0xcc'),'direction',_0x65f6('0xcd'),'read'],'include':_0x42dd14}];_0x4723e9[_0x65f6('0x2f')]({'model':db[_0x65f6('0xce')],'as':_0x65f6('0xcf'),'attributes':['id',_0x65f6('0x26')]});_0x4723e9[_0x65f6('0x2f')]({'model':db[_0x65f6('0x68')],'as':_0x65f6('0xd0'),'attributes':['id',_0x65f6('0x2a')]});return db[_0x65f6('0x32')][_0x65f6('0x59')]({'where':{'id':_0x11f300[_0x65f6('0xae')]['id']},'include':_0x4723e9})[_0x65f6('0x22')](handleEntityNotFound(_0x4e819f,null))[_0x65f6('0x22')](function(_0x1c4172){if(_0x1c4172){var _0x37fa08=_0x1c4172[_0x65f6('0xd1')]({'plain':!![]});fs[_0x65f6('0xd2')](_0x27afb5);var _0x5da2f8={'format':'A4','border':_0x65f6('0xd3'),'header':{'height':'40px','contents':{'first':_0x65f6('0xd4')}},'footer':{'height':_0x65f6('0xd5'),'contents':{'default':util[_0x65f6('0xb6')](_0x65f6('0xd6'),util[_0x65f6('0xb6')](_0x65f6('0xd7'),'Whatsapp',_0x37fa08['id']),moment()[_0x65f6('0xb6')](_0x65f6('0xd8'))[_0x65f6('0x8f')]())}}};var _0x359734={'channel':_0x65f6('0xd9'),'account':_0x37fa08[_0x65f6('0xcf')][_0x65f6('0x26')],'agent':_0x37fa08[_0x65f6('0xd0')]?_0x37fa08[_0x65f6('0xd0')][_0x65f6('0x2a')]:_0x65f6('0xda'),'createdAt':moment(_0x37fa08['createdAt'])['format'](_0x65f6('0xdb'))[_0x65f6('0x8f')](),'closedAt':_0x37fa08[_0x65f6('0xdc')]?moment(_0x37fa08[_0x65f6('0xdd')])[_0x65f6('0xb6')](_0x65f6('0xdb'))[_0x65f6('0x8f')]():'','disposition':_0x37fa08['disposition'],'messages':_(_0x37fa08[_0x65f6('0xcb')])[_0x65f6('0x7b')]({'secret':![]})[_0x65f6('0x29')](function(_0xa68327){if(_0xa68327[_0x65f6('0xca')]){var _0x129f29=path[_0x65f6('0xc0')](_0x4cdc4c,_0xa68327[_0x65f6('0xca')][_0x65f6('0xde')]);if(fs[_0x65f6('0xdf')](_0x129f29)){fs[_0x65f6('0xe0')](_0x129f29)[_0x65f6('0xe1')](fs[_0x65f6('0xe2')](path['join'](_0x27afb5,_0xa68327['Attachment']['basename'])));}}return{'date':moment(_0xa68327[_0x65f6('0xcc')])[_0x65f6('0xb6')](_0x65f6('0xdb'))['toString'](),'sender':_0xa68327[_0x65f6('0xe3')]===_0x65f6('0xe4')?_0xa68327[_0x65f6('0x68')]?_0xa68327['User'][_0x65f6('0x2a')]:_0x65f6('0xe5'):_0xa68327['Contact'][_0x65f6('0xc7')]+(_0xa68327[_0x65f6('0x5d')][_0x65f6('0xc8')]?'\x20'+_0xa68327['Contact'][_0x65f6('0xc8')]:''),'body':_0xa68327[_0x65f6('0xca')]?_0xa68327[_0x65f6('0xca')][_0x65f6('0xde')]:_0xa68327[_0x65f6('0x6c')],'direction':_0xa68327[_0x65f6('0xe3')]===_0x65f6('0xe4')?'A':'C','secret':_0xa68327[_0x65f6('0xcd')],'read':_0xa68327[_0x65f6('0x76')],'attachment':_0xa68327[_0x65f6('0xca')]};})['value']()};return ejs[_0x65f6('0xe6')](path[_0x65f6('0xc0')](config[_0x65f6('0xc1')],'server','views',_0x65f6('0xe7')),{'interaction':_0x359734})['then'](function(_0x3f5cf8){return new BPromise(function(_0x3e8f5f,_0x272652){pdf[_0x65f6('0xad')](_0x3f5cf8,_0x5da2f8)[_0x65f6('0xe8')](path['join'](_0x27afb5,_0x65f6('0xe9')+_0x37fa08['id']+'-'+_0x10a218+_0x65f6('0xea')),function(_0x207187,_0x118502){if(_0x207187)return _0x272652(_0x207187);_0x3e8f5f(_0x118502);});});})['then'](function(){return new BPromise(function(_0x375351,_0x45709b){zipdir(_0x27afb5,{'saveTo':_0x568ca5},function(_0x11d3fb,_0x19232e){if(_0x11d3fb)return _0x45709b(_0x11d3fb);return _0x375351(_0x19232e);});})[_0x65f6('0x22')](function(){return new BPromise(function(_0x25e34a,_0xcef4ba){rimraf(_0x27afb5,function(_0x2d9adc){if(_0x2d9adc)_0xcef4ba(_0x2d9adc);return _0x25e34a();});});})[_0x65f6('0x22')](function(){return _0x4e819f[_0x65f6('0xeb')](_0x568ca5,_0x2149e1,function(_0x418778){if(_0x418778){console[_0x65f6('0xec')](_0x65f6('0xed'),_0x418778);}else{fs[_0x65f6('0xee')](_0x568ca5);}});});});}else{return _0x4e819f[_0x65f6('0x19')](0xc8);}})['catch'](handleError(_0x4e819f,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index d7ffcfd..f6f981e 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 _0xec64=['then','setDataValue','Users','map','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','update','remove','getUsers'];(function(_0x578c22,_0x3b816f){var _0x50fe10=function(_0x21d25){while(--_0x21d25){_0x578c22['push'](_0x578c22['shift']());}};_0x50fe10(++_0x3b816f);}(_0xec64,0xb4));var _0x4ec6=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0xec64[_0xdd2bfa];return _0x55397e;};'use strict';var EventEmitter=require(_0x4ec6('0x0'));var WhatsappInteraction=require(_0x4ec6('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x4ec6('0x1'))['db'][_0x4ec6('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x4ec6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4ec6('0x4'),'afterDestroy':_0x4ec6('0x5')};function emitEvent(_0xdba419){return function(_0x2b336f,_0x434b35,_0x57d903){_0x2b336f[_0x4ec6('0x6')]({'attributes':['id'],'raw':!![]})[_0x4ec6('0x7')](function(_0x5bae9a){_0x2b336f[_0x4ec6('0x8')](_0x4ec6('0x9'),_0x5bae9a[_0x4ec6('0xa')](function(_0x2ecd48){return{'id':_0x2ecd48['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x2b336f['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x31979f){_0x2b336f['setDataValue'](_0x4ec6('0xb'),_0x31979f[_0x4ec6('0xc')]);WhatsappInteractionEvents[_0x4ec6('0xd')](_0xdba419+':'+_0x2b336f['id'],_0x2b336f);WhatsappInteractionEvents[_0x4ec6('0xd')](_0xdba419,_0x2b336f);_0x57d903(null);})[_0x4ec6('0xe')](_0x57d903(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x4ec6('0xf')](e,emitEvent(event));}}module[_0x4ec6('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x1625=['hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty'];(function(_0x5c7fc5,_0x58d403){var _0x3232ee=function(_0x36fb0c){while(--_0x36fb0c){_0x5c7fc5['push'](_0x5c7fc5['shift']());}};_0x3232ee(++_0x58d403);}(_0x1625,0x18e));var _0x5162=function(_0x5390a1,_0xa40155){_0x5390a1=_0x5390a1-0x0;var _0x157b8e=_0x1625[_0x5390a1];return _0x157b8e;};'use strict';var EventEmitter=require(_0x5162('0x0'));var WhatsappInteraction=require(_0x5162('0x1'))['db'][_0x5162('0x2')];var WhatsappMessage=require(_0x5162('0x1'))['db'][_0x5162('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x5162('0x4')](0x0);var events={'afterCreate':_0x5162('0x5'),'afterUpdate':'update','afterDestroy':_0x5162('0x6')};function emitEvent(_0x2e7348){return function(_0xa35557,_0x219b0b,_0x591aa7){_0xa35557['getUsers']({'attributes':['id'],'raw':!![]})[_0x5162('0x7')](function(_0x5a7d05){_0xa35557[_0x5162('0x8')](_0x5162('0x9'),_0x5a7d05[_0x5162('0xa')](function(_0x107c4d){return{'id':_0x107c4d['id']};}));return WhatsappMessage[_0x5162('0xb')]({'where':{'WhatsappInteractionId':_0xa35557['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x49e36c){_0xa35557['setDataValue'](_0x5162('0xc'),_0x49e36c[_0x5162('0xd')]);WhatsappInteractionEvents[_0x5162('0xe')](_0x2e7348+':'+_0xa35557['id'],_0xa35557);WhatsappInteractionEvents[_0x5162('0xe')](_0x2e7348,_0xa35557);_0x591aa7(null);})['catch'](_0x591aa7(null));};}for(var e in events){if(events[_0x5162('0xf')](e)){var event=events[e];WhatsappInteraction[_0x5162('0x10')](e,emitEvent(event));}}module[_0x5162('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 6757cb2..d6bdb21 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 _0x9e87=['moment','request-promise','rimraf','../../config/environment','define','WhatsappInteraction','whatsapp_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api'];(function(_0x5dbca3,_0x4eb5e0){var _0x502942=function(_0x27016d){while(--_0x27016d){_0x5dbca3['push'](_0x5dbca3['shift']());}};_0x502942(++_0x4eb5e0);}(_0x9e87,0x169));var _0x79e8=function(_0x15d409,_0x16c2ee){_0x15d409=_0x15d409-0x0;var _0x379106=_0x9e87[_0x15d409];return _0x379106;};'use strict';var _=require(_0x79e8('0x0'));var util=require('util');var logger=require(_0x79e8('0x1'))(_0x79e8('0x2'));var moment=require(_0x79e8('0x3'));var BPromise=require('bluebird');var rp=require(_0x79e8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x79e8('0x5'));var config=require(_0x79e8('0x6'));var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x39a4bb,_0x2bc042){return _0x39a4bb[_0x79e8('0x7')](_0x79e8('0x8'),attributes,{'tableName':_0x79e8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x44061c,_0x4ea183,_0x2b5fb0){if(_0x44061c[_0x79e8('0xa')](_0x79e8('0xb'))){_0x44061c['closedAt']=moment()[_0x79e8('0xc')](_0x79e8('0xd'));}_0x2b5fb0(null,_0x44061c);}}});}; \ No newline at end of file +var _0x9700=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x9700,0x65));var _0x0970=function(_0x23dc2b,_0xc1424f){_0x23dc2b=_0x23dc2b-0x0;var _0x52babe=_0x9700[_0x23dc2b];return _0x52babe;};'use strict';var _=require(_0x0970('0x0'));var util=require(_0x0970('0x1'));var logger=require(_0x0970('0x2'))(_0x0970('0x3'));var moment=require(_0x0970('0x4'));var BPromise=require(_0x0970('0x5'));var rp=require(_0x0970('0x6'));var fs=require('fs');var path=require(_0x0970('0x7'));var rimraf=require(_0x0970('0x8'));var config=require(_0x0970('0x9'));var attributes=require(_0x0970('0xa'));module[_0x0970('0xb')]=function(_0x59af8e,_0x565762){return _0x59af8e[_0x0970('0xc')](_0x0970('0xd'),attributes,{'tableName':_0x0970('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d300f,_0x3cdc25,_0x46f07b){if(_0x3d300f[_0x0970('0xf')](_0x0970('0x10'))){_0x3d300f[_0x0970('0x11')]=moment()[_0x0970('0x12')](_0x0970('0x13'));}_0x46f07b(null,_0x3d300f);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index c4339c7..84e8c78 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 _0x1e9c=['client','http','redis','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappInteraction','update','body','options','where','UpdateWhatsappInteraction','debug','AddTagsToWhatsappInteraction','find','addTags','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x13e093,_0x5970c3){var _0x5b3634=function(_0x460f16){while(--_0x460f16){_0x13e093['push'](_0x13e093['shift']());}};_0x5b3634(++_0x5970c3);}(_0x1e9c,0x6e));var _0xc1e9=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x1e9c[_0x26462c];return _0x509a42;};'use strict';var _=require(_0xc1e9('0x0'));var util=require('util');var moment=require(_0xc1e9('0x1'));var BPromise=require('bluebird');var rs=require(_0xc1e9('0x2'));var fs=require('fs');var Redis=require(_0xc1e9('0x3'));var db=require(_0xc1e9('0x4'))['db'];var utils=require(_0xc1e9('0x5'));var logger=require(_0xc1e9('0x6'))(_0xc1e9('0x7'));var config=require(_0xc1e9('0x8'));var jayson=require(_0xc1e9('0x9'));var client=jayson[_0xc1e9('0xa')][_0xc1e9('0xb')]({'port':0x232a});config[_0xc1e9('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc1e9('0xd'))(new Redis(config[_0xc1e9('0xc')]));require(_0xc1e9('0xe'))[_0xc1e9('0xf')](socket);function respondWithRpcPromise(_0x332d08,_0x4e713f,_0x1cc07b){return new BPromise(function(_0x5107d7,_0x26c484){return client[_0xc1e9('0x10')](_0x332d08,_0x1cc07b)[_0xc1e9('0x11')](function(_0x2906fc){logger[_0xc1e9('0x12')](_0xc1e9('0x13'),_0x4e713f,_0xc1e9('0x14'));logger['debug'](_0xc1e9('0x15'),_0x4e713f,_0xc1e9('0x14'),JSON[_0xc1e9('0x16')](_0x2906fc));if(_0x2906fc[_0xc1e9('0x17')]){if(_0x2906fc[_0xc1e9('0x17')][_0xc1e9('0x18')]===0x1f4){logger[_0xc1e9('0x17')](_0xc1e9('0x13'),_0x4e713f,_0x2906fc[_0xc1e9('0x17')][_0xc1e9('0x19')]);return _0x26c484(_0x2906fc[_0xc1e9('0x17')][_0xc1e9('0x19')]);}logger[_0xc1e9('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x4e713f,_0x2906fc[_0xc1e9('0x17')][_0xc1e9('0x19')]);return _0x5107d7(_0x2906fc[_0xc1e9('0x17')][_0xc1e9('0x19')]);}else{logger['info'](_0xc1e9('0x13'),_0x4e713f,_0xc1e9('0x14'));_0x5107d7(_0x2906fc[_0xc1e9('0x1a')][_0xc1e9('0x19')]);}})[_0xc1e9('0x1b')](function(_0x17d10c){logger[_0xc1e9('0x17')](_0xc1e9('0x13'),_0x4e713f,_0x17d10c);_0x26c484(_0x17d10c);});});}exports['UpdateWhatsappInteraction']=function(_0x11458c){var _0x446c18=this;return new Promise(function(_0x401f80,_0x1a84d7){return db[_0xc1e9('0x1c')][_0xc1e9('0x1d')](_0x11458c[_0xc1e9('0x1e')],{'raw':_0x11458c[_0xc1e9('0x1f')]?_0x11458c[_0xc1e9('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11458c['options']?_0x11458c[_0xc1e9('0x1f')][_0xc1e9('0x20')]||null:null,'attributes':_0x11458c[_0xc1e9('0x1f')]?_0x11458c[_0xc1e9('0x1f')]['attributes']||null:null,'limit':_0x11458c['options']?_0x11458c['options']['limit']||null:null})[_0xc1e9('0x11')](function(_0x30c4ec){logger[_0xc1e9('0x12')](_0xc1e9('0x21'),_0x11458c);logger[_0xc1e9('0x22')](_0xc1e9('0x21'),_0x11458c,JSON[_0xc1e9('0x16')](_0x30c4ec));_0x401f80(_0x30c4ec);})[_0xc1e9('0x1b')](function(_0x56333b){logger[_0xc1e9('0x17')](_0xc1e9('0x21'),_0x56333b[_0xc1e9('0x19')],_0x11458c);_0x1a84d7(_0x446c18['error'](0x1f4,_0x56333b[_0xc1e9('0x19')]));});});};exports[_0xc1e9('0x23')]=function(_0x4fa972){return new Promise(function(_0x3d89c8,_0x4067e5){return db['WhatsappInteraction'][_0xc1e9('0x24')]({'where':_0x4fa972[_0xc1e9('0x1f')]?_0x4fa972['options'][_0xc1e9('0x20')]||null:null})['then'](function(_0x52a60a){if(_0x52a60a){return _0x52a60a[_0xc1e9('0x25')](_0x4fa972['body']['ids'],_['omit'](_0x4fa972['body'],['ids','id'])||{});}})[_0xc1e9('0x26')](function(_0x1de23f){logger[_0xc1e9('0x12')](_0xc1e9('0x27'),_0x4fa972);logger['debug']('AddTags',_0x4fa972,JSON[_0xc1e9('0x16')](_0x1de23f));_0x3d89c8(_0x1de23f);})[_0xc1e9('0x1b')](function(_0x2a3a1b){logger[_0xc1e9('0x17')](_0xc1e9('0x27'),_0x2a3a1b[_0xc1e9('0x19')],_0x4fa972);_0x4067e5(_this['error'](0x1f4,_0x2a3a1b[_0xc1e9('0x19')]));});});}; \ No newline at end of file +var _0x2a45=['AddTagsToWhatsappInteraction','WhatsappInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateWhatsappInteraction','body','options','where','attributes'];(function(_0x5d41d0,_0x5c4bfe){var _0x215caf=function(_0x385f34){while(--_0x385f34){_0x5d41d0['push'](_0x5d41d0['shift']());}};_0x215caf(++_0x5c4bfe);}(_0x2a45,0xc0));var _0x52a4=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x2a45[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x52a4('0x0'));var util=require(_0x52a4('0x1'));var moment=require(_0x52a4('0x2'));var BPromise=require(_0x52a4('0x3'));var rs=require(_0x52a4('0x4'));var fs=require('fs');var Redis=require(_0x52a4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x52a4('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x52a4('0x7'));var jayson=require(_0x52a4('0x8'));var client=jayson[_0x52a4('0x9')]['http']({'port':0x232a});config[_0x52a4('0xa')]=_[_0x52a4('0xb')](config[_0x52a4('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x52a4('0xc'))(new Redis(config[_0x52a4('0xa')]));require(_0x52a4('0xd'))['register'](socket);function respondWithRpcPromise(_0x598071,_0x415510,_0x34c11b){return new BPromise(function(_0xe30270,_0x1797f7){return client[_0x52a4('0xe')](_0x598071,_0x34c11b)[_0x52a4('0xf')](function(_0x5f376e){logger[_0x52a4('0x10')](_0x52a4('0x11'),_0x415510,_0x52a4('0x12'));logger[_0x52a4('0x13')](_0x52a4('0x14'),_0x415510,'request\x20sent',JSON[_0x52a4('0x15')](_0x5f376e));if(_0x5f376e[_0x52a4('0x16')]){if(_0x5f376e[_0x52a4('0x16')]['code']===0x1f4){logger['error'](_0x52a4('0x11'),_0x415510,_0x5f376e[_0x52a4('0x16')][_0x52a4('0x17')]);return _0x1797f7(_0x5f376e['error'][_0x52a4('0x17')]);}logger[_0x52a4('0x16')](_0x52a4('0x11'),_0x415510,_0x5f376e['error'][_0x52a4('0x17')]);return _0xe30270(_0x5f376e[_0x52a4('0x16')][_0x52a4('0x17')]);}else{logger[_0x52a4('0x10')](_0x52a4('0x11'),_0x415510,_0x52a4('0x12'));_0xe30270(_0x5f376e[_0x52a4('0x18')][_0x52a4('0x17')]);}})['catch'](function(_0x1e0de2){logger[_0x52a4('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x415510,_0x1e0de2);_0x1797f7(_0x1e0de2);});});}exports[_0x52a4('0x19')]=function(_0x2191d7){var _0x9654e=this;return new Promise(function(_0x2dea9b,_0x59262c){return db['WhatsappInteraction']['update'](_0x2191d7[_0x52a4('0x1a')],{'raw':_0x2191d7[_0x52a4('0x1b')]?_0x2191d7['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2191d7['options']?_0x2191d7[_0x52a4('0x1b')][_0x52a4('0x1c')]||null:null,'attributes':_0x2191d7[_0x52a4('0x1b')]?_0x2191d7[_0x52a4('0x1b')][_0x52a4('0x1d')]||null:null,'limit':_0x2191d7['options']?_0x2191d7[_0x52a4('0x1b')]['limit']||null:null})[_0x52a4('0xf')](function(_0x2f8a03){logger[_0x52a4('0x10')](_0x52a4('0x19'),_0x2191d7);logger[_0x52a4('0x13')](_0x52a4('0x19'),_0x2191d7,JSON[_0x52a4('0x15')](_0x2f8a03));_0x2dea9b(_0x2f8a03);})['catch'](function(_0xd7e006){logger[_0x52a4('0x16')]('UpdateWhatsappInteraction',_0xd7e006[_0x52a4('0x17')],_0x2191d7);_0x59262c(_0x9654e[_0x52a4('0x16')](0x1f4,_0xd7e006['message']));});});};exports[_0x52a4('0x1e')]=function(_0x5687b7){return new Promise(function(_0x15b078,_0x1622cc){return db[_0x52a4('0x1f')][_0x52a4('0x20')]({'where':_0x5687b7[_0x52a4('0x1b')]?_0x5687b7['options'][_0x52a4('0x1c')]||null:null})[_0x52a4('0xf')](function(_0x4751ed){if(_0x4751ed){return _0x4751ed['addTags'](_0x5687b7[_0x52a4('0x1a')][_0x52a4('0x21')],_[_0x52a4('0x22')](_0x5687b7[_0x52a4('0x1a')],[_0x52a4('0x21'),'id'])||{});}})[_0x52a4('0x23')](function(_0x52751b){logger[_0x52a4('0x10')](_0x52a4('0x24'),_0x5687b7);logger[_0x52a4('0x13')]('AddTags',_0x5687b7,JSON['stringify'](_0x52751b));_0x15b078(_0x52751b);})['catch'](function(_0xa0bbf1){logger['error'](_0x52a4('0x24'),_0xa0bbf1[_0x52a4('0x17')],_0x5687b7);_0x1622cc(_this['error'](0x1f4,_0xa0bbf1[_0x52a4('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index e2c5f7c..50c3d9a 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 _0x684d=['save','update','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x470ede,_0x244451){var _0x369ab1=function(_0x32cbee){while(--_0x32cbee){_0x470ede['push'](_0x470ede['shift']());}};_0x369ab1(++_0x244451);}(_0x684d,0x1c7));var _0xd684=function(_0x5e1535,_0x40409c){_0x5e1535=_0x5e1535-0x0;var _0x3399c9=_0x684d[_0x5e1535];return _0x3399c9;};'use strict';var WhatsappInteractionEvents=require(_0xd684('0x0'));var events=[_0xd684('0x1'),'remove',_0xd684('0x2')];function createListener(_0x3effe7,_0x552c12){return function(_0x356240){_0x552c12[_0xd684('0x3')](_0x3effe7,_0x356240);};}function removeListener(_0x3b212c,_0x330d7a){return function(){WhatsappInteractionEvents[_0xd684('0x4')](_0x3b212c,_0x330d7a);};}exports[_0xd684('0x5')]=function(_0x51341b){for(var _0x254378=0x0,_0x44064a=events[_0xd684('0x6')];_0x254378<_0x44064a;_0x254378++){var _0x1c736e=events[_0x254378];var _0x54b26a=createListener(_0xd684('0x7')+_0x1c736e,_0x51341b);WhatsappInteractionEvents['on'](_0x1c736e,_0x54b26a);}}; \ No newline at end of file +var _0x3a76=['./whatsappInteraction.events','save','remove','emit','removeListener','length','whatsappInteraction:'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x3a76,0x7e));var _0x63a7=function(_0x520a6e,_0xfc1259){_0x520a6e=_0x520a6e-0x0;var _0x2a6711=_0x3a76[_0x520a6e];return _0x2a6711;};'use strict';var WhatsappInteractionEvents=require(_0x63a7('0x0'));var events=[_0x63a7('0x1'),_0x63a7('0x2'),'update'];function createListener(_0xc567e4,_0x452bdd){return function(_0x3a54fe){_0x452bdd[_0x63a7('0x3')](_0xc567e4,_0x3a54fe);};}function removeListener(_0x339ca4,_0xa5e733){return function(){WhatsappInteractionEvents[_0x63a7('0x4')](_0x339ca4,_0xa5e733);};}exports['register']=function(_0x32bbd0){for(var _0x2d5ea9=0x0,_0x5e1ad8=events[_0x63a7('0x5')];_0x2d5ea9<_0x5e1ad8;_0x2d5ea9++){var _0x582d04=events[_0x2d5ea9];var _0x35eaa7=createListener(_0x63a7('0x6')+_0x582d04,_0x32bbd0);WhatsappInteractionEvents['on'](_0x582d04,_0x35eaa7);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 9306c97..b8c1fbb 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 _0x3633=['accept','/:id/reject','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','whatsapp','whatsappmessage:create','create','/:id/status','status','put','/:id/accept'];(function(_0x550f80,_0x2d7260){var _0x2159d9=function(_0x3416e3){while(--_0x3416e3){_0x550f80['push'](_0x550f80['shift']());}};_0x2159d9(++_0x2d7260);}(_0x3633,0x148));var _0x3363=function(_0x18ff4e,_0x4a94dc){_0x18ff4e=_0x18ff4e-0x0;var _0xe63e7b=_0x3633[_0x18ff4e];return _0xe63e7b;};'use strict';var multer=require(_0x3363('0x0'));var util=require('util');var path=require(_0x3363('0x1'));var timeout=require(_0x3363('0x2'));var express=require(_0x3363('0x3'));var router=express[_0x3363('0x4')]();var auth=require(_0x3363('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3363('0x6'));var controller=require(_0x3363('0x7'));router[_0x3363('0x8')]('/',auth['isAuthenticated'](),controller[_0x3363('0x9')]);router['get'](_0x3363('0xa'),auth[_0x3363('0xb')](),controller[_0x3363('0xc')]);router[_0x3363('0x8')](_0x3363('0xd'),auth[_0x3363('0xb')](),controller[_0x3363('0xe')]);router[_0x3363('0xf')]('/',auth[_0x3363('0xb')](),interaction['tracked'](_0x3363('0x10'),_0x3363('0x11')),controller[_0x3363('0x12')]);router[_0x3363('0xf')](_0x3363('0x13'),controller[_0x3363('0x14')]);router[_0x3363('0x15')]('/:id',auth[_0x3363('0xb')](),controller['update']);router[_0x3363('0x15')](_0x3363('0x16'),auth[_0x3363('0xb')](),controller[_0x3363('0x17')]);router[_0x3363('0x15')](_0x3363('0x18'),auth[_0x3363('0xb')](),controller['reject']);router['delete'](_0x3363('0xd'),auth[_0x3363('0xb')](),controller[_0x3363('0x19')]);module[_0x3363('0x1a')]=router; \ No newline at end of file +var _0x782b=['tracked','whatsapp','create','/:id/status','status','put','update','/:id/reject','reject','delete','destroy','exports','path','express','Router','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x2855b9,_0x43f5c6){var _0xa4e025=function(_0x58a569){while(--_0x58a569){_0x2855b9['push'](_0x2855b9['shift']());}};_0xa4e025(++_0x43f5c6);}(_0x782b,0x89));var _0xb782=function(_0x188f19,_0x40e555){_0x188f19=_0x188f19-0x0;var _0x466996=_0x782b[_0x188f19];return _0x466996;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb782('0x0'));var timeout=require('connect-timeout');var express=require(_0xb782('0x1'));var router=express[_0xb782('0x2')]();var auth=require(_0xb782('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb782('0x4'));var controller=require(_0xb782('0x5'));router[_0xb782('0x6')]('/',auth[_0xb782('0x7')](),controller[_0xb782('0x8')]);router[_0xb782('0x6')](_0xb782('0x9'),auth['isAuthenticated'](),controller[_0xb782('0xa')]);router[_0xb782('0x6')](_0xb782('0xb'),auth[_0xb782('0x7')](),controller['show']);router[_0xb782('0xc')]('/',auth[_0xb782('0x7')](),interaction[_0xb782('0xd')](_0xb782('0xe'),'whatsappmessage:create'),controller[_0xb782('0xf')]);router[_0xb782('0xc')](_0xb782('0x10'),controller[_0xb782('0x11')]);router[_0xb782('0x12')](_0xb782('0xb'),auth[_0xb782('0x7')](),controller[_0xb782('0x13')]);router['put']('/:id/accept',auth[_0xb782('0x7')](),controller['accept']);router['put'](_0xb782('0x14'),auth[_0xb782('0x7')](),controller[_0xb782('0x15')]);router[_0xb782('0x16')](_0xb782('0xb'),auth['isAuthenticated'](),controller[_0xb782('0x17')]);module[_0xb782('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 ebff40b..41011d8 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 _0x849d=['medium','ENUM','out','BOOLEAN','STRING','sequelize','exports','TEXT'];(function(_0x11bac4,_0x4b137c){var _0x445507=function(_0x43ea0c){while(--_0x43ea0c){_0x11bac4['push'](_0x11bac4['shift']());}};_0x445507(++_0x4b137c);}(_0x849d,0x16d));var _0xd849=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x849d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd849('0x0'));module[_0xd849('0x1')]={'body':{'type':Sequelize[_0xd849('0x2')](_0xd849('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd849('0x4')]('in','out'),'defaultValue':_0xd849('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xd849('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xd849('0x7')]},'providerResponse':{'type':Sequelize[_0xd849('0x2')]}}; \ No newline at end of file +var _0x073e=['out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x073e,0x153));var _0xe073=function(_0x19d501,_0x364820){_0x19d501=_0x19d501-0x0;var _0x293e33=_0x073e[_0x19d501];return _0x293e33;};'use strict';var Sequelize=require(_0xe073('0x0'));module[_0xe073('0x1')]={'body':{'type':Sequelize[_0xe073('0x2')](_0xe073('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe073('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe073('0x5')),'defaultValue':_0xe073('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe073('0x6')](0xbe)},'phone':{'type':Sequelize[_0xe073('0x6')]},'readAt':{'type':Sequelize[_0xe073('0x7')]},'secret':{'type':Sequelize[_0xe073('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index b854fdc..a431c3c 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 _0x42f4=['EventManager','acceptmessage','whatsapp-interactions','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SIP/%s','channel','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','then','destroy','stack','name','send','map','rawAttributes','type','model','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappMessage','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','body','update','describe','whatsapp','read','UserId','user','agent','CmContact','Contact','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','null','AcceptMessage','acceptMessage','manual','interface','event','accept'];(function(_0x2dd471,_0x51a6af){var _0x200f68=function(_0x1891d4){while(--_0x1891d4){_0x2dd471['push'](_0x2dd471['shift']());}};_0x200f68(++_0x51a6af);}(_0x42f4,0x19d));var _0x442f=function(_0x5aef17,_0x592cd4){_0x5aef17=_0x5aef17-0x0;var _0x43f9d0=_0x42f4[_0x5aef17];return _0x43f9d0;};'use strict';var pdf=require(_0x442f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x442f('0x1'));var zipdir=require(_0x442f('0x2'));var jsonpatch=require(_0x442f('0x3'));var rp=require(_0x442f('0x4'));var moment=require(_0x442f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x442f('0x6'));var sox=require(_0x442f('0x7'));var csv=require('to-csv');var ejs=require(_0x442f('0x8'));var fs=require('fs');var _=require(_0x442f('0x9'));var squel=require(_0x442f('0xa'));var crypto=require(_0x442f('0xb'));var jsforce=require(_0x442f('0xc'));var deskjs=require(_0x442f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x442f('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x442f('0xf'));var as=require(_0x442f('0x10'));var hardwareService=require(_0x442f('0x11'));var logger=require(_0x442f('0x12'))(_0x442f('0x13'));var utils=require(_0x442f('0x14'));var config=require(_0x442f('0x15'));var licenseUtil=require(_0x442f('0x16'));var db=require(_0x442f('0x17'))['db'];config[_0x442f('0x18')]=_['defaults'](config[_0x442f('0x18')],{'host':_0x442f('0x19'),'port':0x18eb});var socket=require(_0x442f('0x1a'))(new Redis(config[_0x442f('0x18')]));require(_0x442f('0x1b'))[_0x442f('0x1c')](socket);var jayson=require(_0x442f('0x1d'));var client=jayson[_0x442f('0x1e')][_0x442f('0x1f')]({'port':0x232c});var client9002=jayson[_0x442f('0x1e')][_0x442f('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3d075a,_0x42fb1b,_0x2f0ff8,_0x23fe2e){return new BPromise(function(_0x3ff2b1,_0x5ee97b){var _0xa37e23=_0x23fe2e||client;return _0xa37e23['request'](_0x3d075a,_0x2f0ff8)['then'](function(_0x5668e0){logger['info'](_0x442f('0x20'),_0x42fb1b,_0x442f('0x21'));logger[_0x442f('0x22')](_0x442f('0x23'),_0x42fb1b,_0x442f('0x21'),JSON[_0x442f('0x24')](_0x5668e0));if(_0x5668e0['error']){if(_0x5668e0[_0x442f('0x25')]['code']===0x1f4){logger[_0x442f('0x25')](_0x442f('0x20'),_0x42fb1b,_0x5668e0[_0x442f('0x25')]['message']);return _0x5ee97b(_0x5668e0[_0x442f('0x25')][_0x442f('0x26')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x42fb1b,_0x5668e0[_0x442f('0x25')][_0x442f('0x26')]);return _0x3ff2b1(_0x5668e0[_0x442f('0x25')][_0x442f('0x26')]);}else{logger[_0x442f('0x27')](_0x442f('0x20'),_0x42fb1b,_0x442f('0x21'));_0x3ff2b1(_0x5668e0[_0x442f('0x28')][_0x442f('0x26')]);}})['catch'](function(_0x393eed){logger[_0x442f('0x25')](_0x442f('0x20'),_0x42fb1b,_0x393eed);_0x5ee97b(_0x393eed);});});}function respondWithStatusCode(_0x2d3cd5,_0x495f74){_0x495f74=_0x495f74||0xcc;return function(_0x10b312){if(_0x10b312){return _0x2d3cd5[_0x442f('0x29')](_0x495f74);}return _0x2d3cd5[_0x442f('0x2a')](_0x495f74)[_0x442f('0x2b')]();};}function respondWithResult(_0x55c9dc,_0x5ee478){_0x5ee478=_0x5ee478||0xc8;return function(_0x23fccf){if(_0x23fccf){return _0x55c9dc[_0x442f('0x2a')](_0x5ee478)['json'](_0x23fccf);}};}function respondWithFilteredResult(_0x37da9d,_0x5a272e){return function(_0x95dbe4){if(_0x95dbe4){var _0x36abd2=_0x95dbe4[_0x442f('0x2c')],_0x75f990=_0x5a272e[_0x442f('0x2d')],_0x539643=_0x5a272e[_0x442f('0x2d')]+_0x5a272e[_0x442f('0x2e')],_0x367ae0;if(_0x539643>=_0x36abd2){_0x539643=_0x36abd2;_0x367ae0=0xc8;}else{_0x367ae0=0xce;}_0x37da9d['status'](_0x367ae0);return _0x37da9d['set'](_0x442f('0x2f'),_0x75f990+'-'+_0x539643+'/'+_0x36abd2)['json'](_0x95dbe4);}return null;};}function patchUpdates(_0x253cf0){return function(_0x1ee1c2){try{jsonpatch[_0x442f('0x30')](_0x1ee1c2,_0x253cf0,!![]);}catch(_0x1b9a60){return BPromise[_0x442f('0x31')](_0x1b9a60);}return _0x1ee1c2[_0x442f('0x32')]();};}function saveUpdates(_0x44ac9b,_0x225f38){return function(_0x14b275){if(_0x14b275){return _0x14b275['update'](_0x44ac9b)[_0x442f('0x33')](function(_0x5459cb){return _0x5459cb;});}return null;};}function removeEntity(_0x67b48d,_0x30df94){return function(_0x53c0a0){if(_0x53c0a0){return _0x53c0a0[_0x442f('0x34')]()[_0x442f('0x33')](function(){_0x67b48d[_0x442f('0x2a')](0xcc)[_0x442f('0x2b')]();});}};}function handleEntityNotFound(_0x195946,_0x4fd8ed){return function(_0x318f34){if(!_0x318f34){_0x195946[_0x442f('0x29')](0x194);}return _0x318f34;};}function handleError(_0x257d03,_0x12d02b){_0x12d02b=_0x12d02b||0x1f4;return function(_0x185b05){logger['error'](_0x185b05[_0x442f('0x35')]);if(_0x185b05[_0x442f('0x36')]){delete _0x185b05['name'];}_0x257d03[_0x442f('0x2a')](_0x12d02b)[_0x442f('0x37')](_0x185b05);};}exports['index']=function(_0x41113f,_0x70e0a1){var _0x10bcf3={},_0x1e6266={},_0x396d5e={'count':0x0,'rows':[]};var _0x3ad24f=_[_0x442f('0x38')](db['WhatsappMessage'][_0x442f('0x39')],function(_0x40cc18){return{'name':_0x40cc18['fieldName'],'type':_0x40cc18[_0x442f('0x3a')]['key']};});_0x1e6266[_0x442f('0x3b')]=_[_0x442f('0x38')](_0x3ad24f,_0x442f('0x36'));_0x1e6266['query']=_['keys'](_0x41113f['query']);_0x1e6266[_0x442f('0x3c')]=_[_0x442f('0x3d')](_0x1e6266[_0x442f('0x3b')],_0x1e6266[_0x442f('0x3e')]);_0x10bcf3[_0x442f('0x3f')]=_[_0x442f('0x3d')](_0x1e6266['model'],qs[_0x442f('0x40')](_0x41113f[_0x442f('0x3e')][_0x442f('0x40')]));_0x10bcf3[_0x442f('0x3f')]=_0x10bcf3[_0x442f('0x3f')]['length']?_0x10bcf3['attributes']:_0x1e6266['model'];if(!_0x41113f['query'][_0x442f('0x41')](_0x442f('0x42'))){_0x10bcf3['limit']=qs[_0x442f('0x2e')](_0x41113f[_0x442f('0x3e')]['limit']);_0x10bcf3[_0x442f('0x2d')]=qs['offset'](_0x41113f[_0x442f('0x3e')][_0x442f('0x2d')]);}_0x10bcf3['order']=qs[_0x442f('0x43')](_0x41113f[_0x442f('0x3e')][_0x442f('0x43')]);_0x10bcf3[_0x442f('0x44')]=qs[_0x442f('0x3c')](_[_0x442f('0x45')](_0x41113f[_0x442f('0x3e')],_0x1e6266['filters']),_0x3ad24f);if(_0x41113f[_0x442f('0x3e')][_0x442f('0x46')]){_0x10bcf3[_0x442f('0x44')]=_[_0x442f('0x47')](_0x10bcf3[_0x442f('0x44')],{'$or':_[_0x442f('0x38')](_0x3ad24f,function(_0x1e93d8){if(_0x1e93d8[_0x442f('0x3a')]!==_0x442f('0x48')){var _0xa6602={};_0xa6602[_0x1e93d8[_0x442f('0x36')]]={'$like':'%'+_0x41113f[_0x442f('0x3e')]['filter']+'%'};return _0xa6602;}})});}_0x10bcf3=_[_0x442f('0x47')]({},_0x10bcf3,_0x41113f[_0x442f('0x49')]);var _0x1cecf8={'where':_0x10bcf3[_0x442f('0x44')]};return db[_0x442f('0x4a')][_0x442f('0x2c')](_0x1cecf8)[_0x442f('0x33')](function(_0x3c2736){_0x396d5e[_0x442f('0x2c')]=_0x3c2736;if(_0x41113f[_0x442f('0x3e')][_0x442f('0x4b')]){_0x10bcf3[_0x442f('0x4c')]=[{'all':!![]}];}return db[_0x442f('0x4a')][_0x442f('0x4d')](_0x10bcf3);})[_0x442f('0x33')](function(_0x54dcc8){_0x396d5e[_0x442f('0x4e')]=_0x54dcc8;return _0x396d5e;})[_0x442f('0x33')](respondWithFilteredResult(_0x70e0a1,_0x10bcf3))['catch'](handleError(_0x70e0a1,null));};exports[_0x442f('0x4f')]=function(_0x237234,_0x56f9d3){var _0x3f8b0f={'raw':!![],'where':{'id':_0x237234[_0x442f('0x50')]['id']}},_0xf80e44={};_0xf80e44[_0x442f('0x3b')]=_['keys'](db['WhatsappMessage']['rawAttributes']);_0xf80e44[_0x442f('0x3e')]=_[_0x442f('0x51')](_0x237234[_0x442f('0x3e')]);_0xf80e44[_0x442f('0x3c')]=_[_0x442f('0x3d')](_0xf80e44[_0x442f('0x3b')],_0xf80e44['query']);_0x3f8b0f[_0x442f('0x3f')]=_[_0x442f('0x3d')](_0xf80e44[_0x442f('0x3b')],qs[_0x442f('0x40')](_0x237234[_0x442f('0x3e')][_0x442f('0x40')]));_0x3f8b0f[_0x442f('0x3f')]=_0x3f8b0f[_0x442f('0x3f')][_0x442f('0x52')]?_0x3f8b0f['attributes']:_0xf80e44[_0x442f('0x3b')];if(_0x237234[_0x442f('0x3e')][_0x442f('0x4b')]){_0x3f8b0f[_0x442f('0x4c')]=[{'all':!![]}];}_0x3f8b0f=_[_0x442f('0x47')]({},_0x3f8b0f,_0x237234['options']);return db[_0x442f('0x4a')][_0x442f('0x53')](_0x3f8b0f)[_0x442f('0x33')](handleEntityNotFound(_0x56f9d3,null))['then'](respondWithResult(_0x56f9d3,null))[_0x442f('0x54')](handleError(_0x56f9d3,null));};exports[_0x442f('0x55')]=function(_0x218a3e,_0x5d201e){return db[_0x442f('0x4a')]['create'](_0x218a3e[_0x442f('0x56')],{})[_0x442f('0x33')](respondWithResult(_0x5d201e,0xc9))[_0x442f('0x54')](handleError(_0x5d201e,null));};exports[_0x442f('0x57')]=function(_0x3fd129,_0x3e2a84){if(_0x3fd129[_0x442f('0x56')]['id']){delete _0x3fd129[_0x442f('0x56')]['id'];}return db[_0x442f('0x4a')]['find']({'where':{'id':_0x3fd129[_0x442f('0x50')]['id']}})['then'](handleEntityNotFound(_0x3e2a84,null))[_0x442f('0x33')](saveUpdates(_0x3fd129[_0x442f('0x56')],null))['then'](respondWithResult(_0x3e2a84,null))['catch'](handleError(_0x3e2a84,null));};exports[_0x442f('0x34')]=function(_0x33624b,_0x33a9d2){return db[_0x442f('0x4a')]['find']({'where':{'id':_0x33624b['params']['id']}})[_0x442f('0x33')](handleEntityNotFound(_0x33a9d2,null))[_0x442f('0x33')](removeEntity(_0x33a9d2,null))['catch'](handleError(_0x33a9d2,null));};exports[_0x442f('0x58')]=function(_0x35f247,_0x280ea0){return db[_0x442f('0x4a')][_0x442f('0x58')]()['then'](respondWithResult(_0x280ea0,null))[_0x442f('0x54')](handleError(_0x280ea0,null));};var interaction_log=require(_0x442f('0x12'))('whatsapp-interactions');exports['accept']=function(_0x2813d1,_0xd95af8,_0x1f65e4){var _0x4830e3={'agent':{},'channel':_0x442f('0x59')};if(_0x2813d1[_0x442f('0x56')]['id']){delete _0x2813d1[_0x442f('0x56')]['id'];}_0x2813d1['body'][_0x442f('0x5a')]=!![];_0x2813d1['body']['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2813d1[_0x442f('0x56')][_0x442f('0x5b')]=_0x2813d1[_0x442f('0x56')][_0x442f('0x5b')]||_0x2813d1[_0x442f('0x5c')]['id'];_0x4830e3[_0x442f('0x5d')]['id']=_0x2813d1[_0x442f('0x56')][_0x442f('0x5b')];return db['WhatsappMessage'][_0x442f('0x53')]({'where':{'id':_0x2813d1[_0x442f('0x50')]['id'],'UserId':null},'include':[{'model':db[_0x442f('0x5e')],'as':_0x442f('0x5f')}]})[_0x442f('0x33')](handleEntityNotFound(_0xd95af8,null))[_0x442f('0x33')](saveUpdates(_0x2813d1[_0x442f('0x56')],null))[_0x442f('0x33')](function(_0xe3b8e7){if(_0xe3b8e7){_0x4830e3['message']=_0xe3b8e7[_0x442f('0x60')]({'plain':!![]});return db[_0x442f('0x61')][_0x442f('0x53')]({'where':{'id':_0xe3b8e7[_0x442f('0x62')]}});}return null;})[_0x442f('0x33')](handleEntityNotFound(_0xd95af8,null))[_0x442f('0x33')](function(_0x34721b){if(_0x34721b){return _0x34721b['update']({'UserId':_0x2813d1['body'][_0x442f('0x5b')],'read1stAt':_[_0x442f('0x63')](_0x34721b[_0x442f('0x64')])?moment()[_0x442f('0x65')](_0x442f('0x66')):undefined});}return null;})['then'](function(_0xa89eca){if(_0xa89eca){_0x4830e3[_0x442f('0x67')]=_0xa89eca[_0x442f('0x60')]({'plain':!![]});interaction_log[_0x442f('0x27')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2813d1[_0x442f('0x5c')]['id'],_0x2813d1[_0x442f('0x5c')]['name'],_0x2813d1['user']['role'],_0x4830e3[_0x442f('0x67')]['id'],_0x2813d1[_0x442f('0x56')]?JSON[_0x442f('0x24')](_0x2813d1[_0x442f('0x56')]):_0x442f('0x68'));return respondWithRpcPromise(_0x442f('0x69'),_0x442f('0x6a'),_0x4830e3);}return null;})[_0x442f('0x33')](function(_0xb958fb){if(_0xb958fb){if(_0x2813d1[_0x442f('0x56')][_0x442f('0x6b')]){_0x4830e3['message'][_0x442f('0x6c')]=util['format']('SIP/%s',_0x2813d1[_0x442f('0x5c')][_0x442f('0x36')]);_0x4830e3[_0x442f('0x26')]['channel']=_0x4830e3['channel'];_0x4830e3[_0x442f('0x26')][_0x442f('0x6d')]=_0x442f('0x6e');return respondWithRpcPromise(_0x442f('0x6f'),_0x442f('0x6f'),{'event':_0x442f('0x70'),'message':_0x4830e3[_0x442f('0x26')]},client9002)[_0x442f('0x33')](function(){return _0x4830e3;});}return _0x4830e3;}return null;})['then'](respondWithResult(_0xd95af8,null))['catch'](handleError(_0xd95af8,null));};var interaction_log=require(_0x442f('0x12'))(_0x442f('0x71'));exports[_0x442f('0x31')]=function(_0x4aee57,_0x141793,_0x5af59d){var _0x4d4620={'agent':{},'channel':_0x442f('0x59')};if(_0x4aee57[_0x442f('0x56')]['id']){delete _0x4aee57[_0x442f('0x56')]['id'];}_0x4aee57[_0x442f('0x56')][_0x442f('0x5b')]=_0x4aee57[_0x442f('0x56')][_0x442f('0x5b')]||_0x4aee57[_0x442f('0x5c')]['id'];_0x4d4620[_0x442f('0x5d')]['id']=_0x4aee57[_0x442f('0x56')][_0x442f('0x5b')];return db['WhatsappMessage'][_0x442f('0x53')]({'where':{'id':_0x4aee57[_0x442f('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x141793,null))[_0x442f('0x33')](function(_0x332194){if(_0x332194){_0x4d4620[_0x442f('0x26')]=_0x332194[_0x442f('0x60')]({'plain':!![]});return db[_0x442f('0x61')][_0x442f('0x53')]({'where':{'id':_0x332194[_0x442f('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x141793,null))[_0x442f('0x33')](function(_0x47a117){if(_0x47a117){_0x4d4620[_0x442f('0x67')]=_0x47a117[_0x442f('0x60')]({'plain':!![]});interaction_log[_0x442f('0x27')](_0x442f('0x72'),_0x4aee57[_0x442f('0x5c')]['id'],_0x4aee57[_0x442f('0x5c')][_0x442f('0x36')],_0x4aee57[_0x442f('0x5c')][_0x442f('0x73')],_0x4d4620[_0x442f('0x67')]['id'],_0x4aee57[_0x442f('0x56')]?JSON['stringify'](_0x4aee57[_0x442f('0x56')]):_0x442f('0x68'));return respondWithRpcPromise(_0x442f('0x74'),_0x442f('0x75'),_0x4d4620);}return null;})[_0x442f('0x33')](function(_0x7dacf5){if(_0x7dacf5){_0x7dacf5[_0x442f('0x26')]['interface']=util[_0x442f('0x65')](_0x442f('0x76'),_0x4aee57[_0x442f('0x5c')][_0x442f('0x36')]);_0x7dacf5[_0x442f('0x26')][_0x442f('0x77')]=_0x4d4620[_0x442f('0x77')];_0x7dacf5['message'][_0x442f('0x6d')]=_0x442f('0x31');respondWithRpcPromise(_0x442f('0x6f'),_0x442f('0x6f'),{'event':_0x442f('0x78'),'message':_0x7dacf5[_0x442f('0x26')]},client9002);return _0x4d4620;}return null;})[_0x442f('0x33')](respondWithResult(_0x141793,null))[_0x442f('0x54')](handleError(_0x141793,null));};exports['status']=function(_0x15d0d6,_0x35e4c0,_0x13e4c9){if(_0x15d0d6[_0x442f('0x56')]['id']){delete _0x15d0d6[_0x442f('0x56')]['id'];}var _0x56f66d;return db[_0x442f('0x4a')][_0x442f('0x53')]({'where':{'id':_0x15d0d6[_0x442f('0x50')]['id']}})[_0x442f('0x33')](handleEntityNotFound(_0x35e4c0,null))['then'](function(_0x12e5ba){if(_0x12e5ba){_0x56f66d=_0x12e5ba;return db[_0x442f('0x79')][_0x442f('0x53')]({'where':{'id':_0x12e5ba[_0x442f('0x7a')]}});}})['then'](handleEntityNotFound(_0x35e4c0,null))[_0x442f('0x33')](function(_0x56c861){if(_0x56c861){logger['debug'](_0x442f('0x7b'),_0x442f('0x2a'),_0x442f('0x7c'),_0x56c861['type'],util[_0x442f('0x7d')](_0x15d0d6[_0x442f('0x56')],{'showHidden':![],'depth':null}));switch(_0x56c861[_0x442f('0x3a')]){case _0x442f('0x7e'):if(_0x15d0d6[_0x442f('0x56')]['MessageSid']&&_0x15d0d6[_0x442f('0x56')][_0x442f('0x7f')]===_0x56f66d[_0x442f('0x80')]&&_0x15d0d6[_0x442f('0x56')][_0x442f('0x81')]&&_0x15d0d6['body']['MessageStatus']===_0x442f('0x5a')){return _0x56f66d[_0x442f('0x57')]({'read':!![]});}else{logger[_0x442f('0x25')](_0x442f('0x82'),_0x442f('0x2a'),_0x442f('0x7e'),util[_0x442f('0x7d')](_0x15d0d6[_0x442f('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x56f66d;}})[_0x442f('0x33')](respondWithResult(_0x35e4c0,null))[_0x442f('0x54')](handleError(_0x35e4c0,null));}; \ No newline at end of file +var _0xab75=['AcceptMessage','acceptMessage','manual','interface','SIP/%s','event','EventManager','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','rejectMessage','channel','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','read','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','client','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','WhatsappMessage,\x20%s,\x20%s','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','merge','VIRTUAL','where','includeAll','include','findAll','rows','show','params','options','find','create','update','body','describe','whatsapp-interactions','accept','whatsapp','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null'];(function(_0x4b89e6,_0x571a6d){var _0x59ea69=function(_0x289637){while(--_0x289637){_0x4b89e6['push'](_0x4b89e6['shift']());}};_0x59ea69(++_0x571a6d);}(_0xab75,0x11f));var _0x5ab7=function(_0x5b84ac,_0x43c6e0){_0x5b84ac=_0x5b84ac-0x0;var _0x1bd3e1=_0xab75[_0x5b84ac];return _0x1bd3e1;};'use strict';var pdf=require(_0x5ab7('0x0'));var emlformat=require(_0x5ab7('0x1'));var rimraf=require(_0x5ab7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5ab7('0x3'));var moment=require(_0x5ab7('0x4'));var BPromise=require(_0x5ab7('0x5'));var Mustache=require('mustache');var util=require(_0x5ab7('0x6'));var path=require(_0x5ab7('0x7'));var sox=require(_0x5ab7('0x8'));var csv=require(_0x5ab7('0x9'));var ejs=require(_0x5ab7('0xa'));var fs=require('fs');var _=require(_0x5ab7('0xb'));var squel=require(_0x5ab7('0xc'));var crypto=require(_0x5ab7('0xd'));var jsforce=require(_0x5ab7('0xe'));var deskjs=require(_0x5ab7('0xf'));var toCsv=require(_0x5ab7('0x9'));var querystring=require('querystring');var Papa=require(_0x5ab7('0x10'));var Redis=require(_0x5ab7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5ab7('0x12'));var as=require(_0x5ab7('0x13'));var hardwareService=require(_0x5ab7('0x14'));var logger=require(_0x5ab7('0x15'))(_0x5ab7('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5ab7('0x17'));var db=require(_0x5ab7('0x18'))['db'];config[_0x5ab7('0x19')]=_[_0x5ab7('0x1a')](config[_0x5ab7('0x19')],{'host':_0x5ab7('0x1b'),'port':0x18eb});var socket=require(_0x5ab7('0x1c'))(new Redis(config[_0x5ab7('0x19')]));require(_0x5ab7('0x1d'))[_0x5ab7('0x1e')](socket);var jayson=require(_0x5ab7('0x1f'));var client=jayson['client'][_0x5ab7('0x20')]({'port':0x232c});var client9002=jayson[_0x5ab7('0x21')][_0x5ab7('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x456a4b,_0x3ad6c9,_0x3a973d,_0x361c60){return new BPromise(function(_0x2a126c,_0x36f20a){var _0x168443=_0x361c60||client;return _0x168443['request'](_0x456a4b,_0x3a973d)[_0x5ab7('0x22')](function(_0xf47302){logger[_0x5ab7('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x3ad6c9,_0x5ab7('0x24'));logger[_0x5ab7('0x25')](_0x5ab7('0x26'),_0x3ad6c9,_0x5ab7('0x24'),JSON['stringify'](_0xf47302));if(_0xf47302[_0x5ab7('0x27')]){if(_0xf47302[_0x5ab7('0x27')][_0x5ab7('0x28')]===0x1f4){logger[_0x5ab7('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x3ad6c9,_0xf47302[_0x5ab7('0x27')]['message']);return _0x36f20a(_0xf47302[_0x5ab7('0x27')][_0x5ab7('0x29')]);}logger[_0x5ab7('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x3ad6c9,_0xf47302['error'][_0x5ab7('0x29')]);return _0x2a126c(_0xf47302['error'][_0x5ab7('0x29')]);}else{logger[_0x5ab7('0x23')](_0x5ab7('0x2a'),_0x3ad6c9,_0x5ab7('0x24'));_0x2a126c(_0xf47302['result'][_0x5ab7('0x29')]);}})[_0x5ab7('0x2b')](function(_0x509130){logger['error'](_0x5ab7('0x2a'),_0x3ad6c9,_0x509130);_0x36f20a(_0x509130);});});}function respondWithStatusCode(_0x4a2d92,_0x57341a){_0x57341a=_0x57341a||0xcc;return function(_0x322c6d){if(_0x322c6d){return _0x4a2d92[_0x5ab7('0x2c')](_0x57341a);}return _0x4a2d92[_0x5ab7('0x2d')](_0x57341a)[_0x5ab7('0x2e')]();};}function respondWithResult(_0x140a95,_0x340298){_0x340298=_0x340298||0xc8;return function(_0x30adda){if(_0x30adda){return _0x140a95['status'](_0x340298)[_0x5ab7('0x2f')](_0x30adda);}};}function respondWithFilteredResult(_0x20f930,_0x2fe95b){return function(_0x275ddd){if(_0x275ddd){var _0x5c0c4c=_0x275ddd[_0x5ab7('0x30')],_0x4e4b14=_0x2fe95b['offset'],_0x1cddec=_0x2fe95b[_0x5ab7('0x31')]+_0x2fe95b[_0x5ab7('0x32')],_0x364d26;if(_0x1cddec>=_0x5c0c4c){_0x1cddec=_0x5c0c4c;_0x364d26=0xc8;}else{_0x364d26=0xce;}_0x20f930['status'](_0x364d26);return _0x20f930[_0x5ab7('0x33')](_0x5ab7('0x34'),_0x4e4b14+'-'+_0x1cddec+'/'+_0x5c0c4c)[_0x5ab7('0x2f')](_0x275ddd);}return null;};}function patchUpdates(_0x4f9b61){return function(_0x3c6344){try{jsonpatch[_0x5ab7('0x35')](_0x3c6344,_0x4f9b61,!![]);}catch(_0x1389a2){return BPromise[_0x5ab7('0x36')](_0x1389a2);}return _0x3c6344[_0x5ab7('0x37')]();};}function saveUpdates(_0x51b08a,_0x55f7d4){return function(_0x2ed01f){if(_0x2ed01f){return _0x2ed01f['update'](_0x51b08a)['then'](function(_0x570215){return _0x570215;});}return null;};}function removeEntity(_0xdec3de,_0xcd3314){return function(_0x1f5daa){if(_0x1f5daa){return _0x1f5daa[_0x5ab7('0x38')]()['then'](function(){_0xdec3de[_0x5ab7('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2598a3,_0x160525){return function(_0x52a013){if(!_0x52a013){_0x2598a3[_0x5ab7('0x2c')](0x194);}return _0x52a013;};}function handleError(_0x3f1497,_0x13a54d){_0x13a54d=_0x13a54d||0x1f4;return function(_0xc0875b){logger['error'](_0xc0875b[_0x5ab7('0x39')]);if(_0xc0875b[_0x5ab7('0x3a')]){delete _0xc0875b[_0x5ab7('0x3a')];}_0x3f1497[_0x5ab7('0x2d')](_0x13a54d)[_0x5ab7('0x3b')](_0xc0875b);};}exports['index']=function(_0x17954a,_0x3a03bc){var _0x280bd5={},_0x520122={},_0x451423={'count':0x0,'rows':[]};var _0x57dd7e=_[_0x5ab7('0x3c')](db[_0x5ab7('0x3d')][_0x5ab7('0x3e')],function(_0x289483){return{'name':_0x289483[_0x5ab7('0x3f')],'type':_0x289483[_0x5ab7('0x40')][_0x5ab7('0x41')]};});_0x520122[_0x5ab7('0x42')]=_['map'](_0x57dd7e,_0x5ab7('0x3a'));_0x520122[_0x5ab7('0x43')]=_[_0x5ab7('0x44')](_0x17954a['query']);_0x520122['filters']=_[_0x5ab7('0x45')](_0x520122['model'],_0x520122[_0x5ab7('0x43')]);_0x280bd5[_0x5ab7('0x46')]=_[_0x5ab7('0x45')](_0x520122[_0x5ab7('0x42')],qs[_0x5ab7('0x47')](_0x17954a['query']['fields']));_0x280bd5[_0x5ab7('0x46')]=_0x280bd5[_0x5ab7('0x46')][_0x5ab7('0x48')]?_0x280bd5[_0x5ab7('0x46')]:_0x520122[_0x5ab7('0x42')];if(!_0x17954a[_0x5ab7('0x43')][_0x5ab7('0x49')](_0x5ab7('0x4a'))){_0x280bd5[_0x5ab7('0x32')]=qs[_0x5ab7('0x32')](_0x17954a[_0x5ab7('0x43')][_0x5ab7('0x32')]);_0x280bd5[_0x5ab7('0x31')]=qs[_0x5ab7('0x31')](_0x17954a['query']['offset']);}_0x280bd5[_0x5ab7('0x4b')]=qs[_0x5ab7('0x4c')](_0x17954a[_0x5ab7('0x43')][_0x5ab7('0x4c')]);_0x280bd5['where']=qs['filters'](_[_0x5ab7('0x4d')](_0x17954a['query'],_0x520122[_0x5ab7('0x4e')]),_0x57dd7e);if(_0x17954a[_0x5ab7('0x43')][_0x5ab7('0x4f')]){_0x280bd5['where']=_[_0x5ab7('0x50')](_0x280bd5['where'],{'$or':_['map'](_0x57dd7e,function(_0x40216e){if(_0x40216e[_0x5ab7('0x40')]!==_0x5ab7('0x51')){var _0x1294a0={};_0x1294a0[_0x40216e[_0x5ab7('0x3a')]]={'$like':'%'+_0x17954a[_0x5ab7('0x43')][_0x5ab7('0x4f')]+'%'};return _0x1294a0;}})});}_0x280bd5=_['merge']({},_0x280bd5,_0x17954a['options']);var _0x28d7c4={'where':_0x280bd5[_0x5ab7('0x52')]};return db[_0x5ab7('0x3d')][_0x5ab7('0x30')](_0x28d7c4)[_0x5ab7('0x22')](function(_0x8d5a2b){_0x451423[_0x5ab7('0x30')]=_0x8d5a2b;if(_0x17954a[_0x5ab7('0x43')][_0x5ab7('0x53')]){_0x280bd5[_0x5ab7('0x54')]=[{'all':!![]}];}return db[_0x5ab7('0x3d')][_0x5ab7('0x55')](_0x280bd5);})[_0x5ab7('0x22')](function(_0x1b11a4){_0x451423[_0x5ab7('0x56')]=_0x1b11a4;return _0x451423;})[_0x5ab7('0x22')](respondWithFilteredResult(_0x3a03bc,_0x280bd5))['catch'](handleError(_0x3a03bc,null));};exports[_0x5ab7('0x57')]=function(_0x517e57,_0x28cab5){var _0x40ea0={'raw':!![],'where':{'id':_0x517e57[_0x5ab7('0x58')]['id']}},_0x4bd539={};_0x4bd539[_0x5ab7('0x42')]=_[_0x5ab7('0x44')](db['WhatsappMessage']['rawAttributes']);_0x4bd539['query']=_[_0x5ab7('0x44')](_0x517e57[_0x5ab7('0x43')]);_0x4bd539[_0x5ab7('0x4e')]=_[_0x5ab7('0x45')](_0x4bd539[_0x5ab7('0x42')],_0x4bd539[_0x5ab7('0x43')]);_0x40ea0[_0x5ab7('0x46')]=_[_0x5ab7('0x45')](_0x4bd539[_0x5ab7('0x42')],qs[_0x5ab7('0x47')](_0x517e57[_0x5ab7('0x43')][_0x5ab7('0x47')]));_0x40ea0[_0x5ab7('0x46')]=_0x40ea0['attributes'][_0x5ab7('0x48')]?_0x40ea0[_0x5ab7('0x46')]:_0x4bd539[_0x5ab7('0x42')];if(_0x517e57[_0x5ab7('0x43')][_0x5ab7('0x53')]){_0x40ea0['include']=[{'all':!![]}];}_0x40ea0=_[_0x5ab7('0x50')]({},_0x40ea0,_0x517e57[_0x5ab7('0x59')]);return db[_0x5ab7('0x3d')][_0x5ab7('0x5a')](_0x40ea0)[_0x5ab7('0x22')](handleEntityNotFound(_0x28cab5,null))[_0x5ab7('0x22')](respondWithResult(_0x28cab5,null))[_0x5ab7('0x2b')](handleError(_0x28cab5,null));};exports['create']=function(_0x33d085,_0x3f362f){return db['WhatsappMessage'][_0x5ab7('0x5b')](_0x33d085['body'],{})[_0x5ab7('0x22')](respondWithResult(_0x3f362f,0xc9))[_0x5ab7('0x2b')](handleError(_0x3f362f,null));};exports[_0x5ab7('0x5c')]=function(_0x129559,_0x10d5d4){if(_0x129559[_0x5ab7('0x5d')]['id']){delete _0x129559[_0x5ab7('0x5d')]['id'];}return db[_0x5ab7('0x3d')]['find']({'where':{'id':_0x129559[_0x5ab7('0x58')]['id']}})[_0x5ab7('0x22')](handleEntityNotFound(_0x10d5d4,null))[_0x5ab7('0x22')](saveUpdates(_0x129559[_0x5ab7('0x5d')],null))[_0x5ab7('0x22')](respondWithResult(_0x10d5d4,null))[_0x5ab7('0x2b')](handleError(_0x10d5d4,null));};exports[_0x5ab7('0x38')]=function(_0x60d7d4,_0x7c32d){return db['WhatsappMessage']['find']({'where':{'id':_0x60d7d4[_0x5ab7('0x58')]['id']}})[_0x5ab7('0x22')](handleEntityNotFound(_0x7c32d,null))[_0x5ab7('0x22')](removeEntity(_0x7c32d,null))[_0x5ab7('0x2b')](handleError(_0x7c32d,null));};exports['describe']=function(_0x315c74,_0x7e210f){return db[_0x5ab7('0x3d')][_0x5ab7('0x5e')]()[_0x5ab7('0x22')](respondWithResult(_0x7e210f,null))[_0x5ab7('0x2b')](handleError(_0x7e210f,null));};var interaction_log=require(_0x5ab7('0x15'))(_0x5ab7('0x5f'));exports[_0x5ab7('0x60')]=function(_0x4cd3da,_0x170963,_0x27fb63){var _0x44dddc={'agent':{},'channel':_0x5ab7('0x61')};if(_0x4cd3da[_0x5ab7('0x5d')]['id']){delete _0x4cd3da['body']['id'];}_0x4cd3da[_0x5ab7('0x5d')]['read']=!![];_0x4cd3da['body']['readAt']=moment()[_0x5ab7('0x62')](_0x5ab7('0x63'));_0x4cd3da[_0x5ab7('0x5d')]['UserId']=_0x4cd3da[_0x5ab7('0x5d')][_0x5ab7('0x64')]||_0x4cd3da['user']['id'];_0x44dddc['agent']['id']=_0x4cd3da[_0x5ab7('0x5d')][_0x5ab7('0x64')];return db['WhatsappMessage'][_0x5ab7('0x5a')]({'where':{'id':_0x4cd3da[_0x5ab7('0x58')]['id'],'UserId':null},'include':[{'model':db[_0x5ab7('0x65')],'as':'Contact'}]})[_0x5ab7('0x22')](handleEntityNotFound(_0x170963,null))[_0x5ab7('0x22')](saveUpdates(_0x4cd3da[_0x5ab7('0x5d')],null))[_0x5ab7('0x22')](function(_0x25c1be){if(_0x25c1be){_0x44dddc[_0x5ab7('0x29')]=_0x25c1be[_0x5ab7('0x66')]({'plain':!![]});return db[_0x5ab7('0x67')]['find']({'where':{'id':_0x25c1be[_0x5ab7('0x68')]}});}return null;})[_0x5ab7('0x22')](handleEntityNotFound(_0x170963,null))['then'](function(_0x272ea5){if(_0x272ea5){return _0x272ea5[_0x5ab7('0x5c')]({'UserId':_0x4cd3da[_0x5ab7('0x5d')]['UserId'],'read1stAt':_[_0x5ab7('0x69')](_0x272ea5[_0x5ab7('0x6a')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x5ab7('0x22')](function(_0x2cda55){if(_0x2cda55){_0x44dddc[_0x5ab7('0x6b')]=_0x2cda55[_0x5ab7('0x66')]({'plain':!![]});interaction_log[_0x5ab7('0x23')](_0x5ab7('0x6c'),_0x4cd3da[_0x5ab7('0x6d')]['id'],_0x4cd3da['user'][_0x5ab7('0x3a')],_0x4cd3da[_0x5ab7('0x6d')][_0x5ab7('0x6e')],_0x44dddc[_0x5ab7('0x6b')]['id'],_0x4cd3da['body']?JSON['stringify'](_0x4cd3da[_0x5ab7('0x5d')]):_0x5ab7('0x6f'));return respondWithRpcPromise(_0x5ab7('0x70'),_0x5ab7('0x71'),_0x44dddc);}return null;})['then'](function(_0x11547a){if(_0x11547a){if(_0x4cd3da['body'][_0x5ab7('0x72')]){_0x44dddc[_0x5ab7('0x29')][_0x5ab7('0x73')]=util[_0x5ab7('0x62')](_0x5ab7('0x74'),_0x4cd3da['user'][_0x5ab7('0x3a')]);_0x44dddc['message']['channel']=_0x44dddc['channel'];_0x44dddc['message'][_0x5ab7('0x75')]=_0x5ab7('0x60');return respondWithRpcPromise(_0x5ab7('0x76'),_0x5ab7('0x76'),{'event':'acceptmessage','message':_0x44dddc['message']},client9002)[_0x5ab7('0x22')](function(){return _0x44dddc;});}return _0x44dddc;}return null;})[_0x5ab7('0x22')](respondWithResult(_0x170963,null))['catch'](handleError(_0x170963,null));};var interaction_log=require('../../config/logger')(_0x5ab7('0x5f'));exports[_0x5ab7('0x36')]=function(_0x510d27,_0x32e11d,_0x1624b2){var _0x5d2ba3={'agent':{},'channel':_0x5ab7('0x61')};if(_0x510d27[_0x5ab7('0x5d')]['id']){delete _0x510d27[_0x5ab7('0x5d')]['id'];}_0x510d27['body'][_0x5ab7('0x64')]=_0x510d27[_0x5ab7('0x5d')][_0x5ab7('0x64')]||_0x510d27[_0x5ab7('0x6d')]['id'];_0x5d2ba3[_0x5ab7('0x77')]['id']=_0x510d27[_0x5ab7('0x5d')][_0x5ab7('0x64')];return db[_0x5ab7('0x3d')][_0x5ab7('0x5a')]({'where':{'id':_0x510d27[_0x5ab7('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x32e11d,null))[_0x5ab7('0x22')](function(_0x599fb9){if(_0x599fb9){_0x5d2ba3[_0x5ab7('0x29')]=_0x599fb9[_0x5ab7('0x66')]({'plain':!![]});return db[_0x5ab7('0x67')]['find']({'where':{'id':_0x599fb9[_0x5ab7('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x32e11d,null))[_0x5ab7('0x22')](function(_0x5b9887){if(_0x5b9887){_0x5d2ba3[_0x5ab7('0x6b')]=_0x5b9887[_0x5ab7('0x66')]({'plain':!![]});interaction_log[_0x5ab7('0x23')](_0x5ab7('0x78'),_0x510d27[_0x5ab7('0x6d')]['id'],_0x510d27[_0x5ab7('0x6d')]['name'],_0x510d27[_0x5ab7('0x6d')][_0x5ab7('0x6e')],_0x5d2ba3['interaction']['id'],_0x510d27[_0x5ab7('0x5d')]?JSON[_0x5ab7('0x79')](_0x510d27['body']):_0x5ab7('0x6f'));return respondWithRpcPromise('RejectMessage',_0x5ab7('0x7a'),_0x5d2ba3);}return null;})['then'](function(_0x704695){if(_0x704695){_0x704695['message'][_0x5ab7('0x73')]=util[_0x5ab7('0x62')](_0x5ab7('0x74'),_0x510d27['user'][_0x5ab7('0x3a')]);_0x704695['message'][_0x5ab7('0x7b')]=_0x5d2ba3[_0x5ab7('0x7b')];_0x704695[_0x5ab7('0x29')][_0x5ab7('0x75')]=_0x5ab7('0x36');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x704695[_0x5ab7('0x29')]},client9002);return _0x5d2ba3;}return null;})[_0x5ab7('0x22')](respondWithResult(_0x32e11d,null))[_0x5ab7('0x2b')](handleError(_0x32e11d,null));};exports[_0x5ab7('0x2d')]=function(_0x1bb917,_0x58d57e,_0x312f7a){if(_0x1bb917[_0x5ab7('0x5d')]['id']){delete _0x1bb917['body']['id'];}var _0x46f5d7;return db[_0x5ab7('0x3d')][_0x5ab7('0x5a')]({'where':{'id':_0x1bb917[_0x5ab7('0x58')]['id']}})[_0x5ab7('0x22')](handleEntityNotFound(_0x58d57e,null))[_0x5ab7('0x22')](function(_0x4c6405){if(_0x4c6405){_0x46f5d7=_0x4c6405;return db[_0x5ab7('0x7c')][_0x5ab7('0x5a')]({'where':{'id':_0x4c6405['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x58d57e,null))[_0x5ab7('0x22')](function(_0x3c8aa8){if(_0x3c8aa8){logger['debug'](_0x5ab7('0x7d'),_0x5ab7('0x2d'),_0x5ab7('0x7e'),_0x3c8aa8[_0x5ab7('0x40')],util[_0x5ab7('0x7f')](_0x1bb917[_0x5ab7('0x5d')],{'showHidden':![],'depth':null}));switch(_0x3c8aa8[_0x5ab7('0x40')]){case _0x5ab7('0x80'):if(_0x1bb917[_0x5ab7('0x5d')]['MessageSid']&&_0x1bb917[_0x5ab7('0x5d')][_0x5ab7('0x81')]===_0x46f5d7[_0x5ab7('0x82')]&&_0x1bb917[_0x5ab7('0x5d')][_0x5ab7('0x83')]&&_0x1bb917[_0x5ab7('0x5d')][_0x5ab7('0x83')]===_0x5ab7('0x84')){return _0x46f5d7[_0x5ab7('0x5c')]({'read':!![]});}else{logger[_0x5ab7('0x27')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5ab7('0x2d'),_0x5ab7('0x80'),util[_0x5ab7('0x7f')](_0x1bb917[_0x5ab7('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x46f5d7;}})[_0x5ab7('0x22')](respondWithResult(_0x58d57e,null))[_0x5ab7('0x2b')](handleError(_0x58d57e,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 6693b43..ffed181 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 _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0x3e6ffb,_0x52b20a){var _0x55681d=function(_0x2945fb){while(--_0x2945fb){_0x3e6ffb['push'](_0x3e6ffb['shift']());}};_0x55681d(++_0x52b20a);}(_0xb10b,0x12a));var _0xbb10=function(_0x20e283,_0x2b5a6e){_0x20e283=_0x20e283-0x0;var _0x199e10=_0xb10b[_0x20e283];return _0x199e10;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbb10('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){WhatsappMessageEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);WhatsappMessageEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];WhatsappMessage[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0xc8d7b5,_0x2d4fd8){var _0x42262e=function(_0x303f84){while(--_0x303f84){_0xc8d7b5['push'](_0xc8d7b5['shift']());}};_0x42262e(++_0x2d4fd8);}(_0xb10b,0x12a));var _0xbb10=function(_0x12db71,_0x4ac41b){_0x12db71=_0x12db71-0x0;var _0x2dacbd=_0xb10b[_0x12db71];return _0x2dacbd;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbb10('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){WhatsappMessageEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);WhatsappMessageEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];WhatsappMessage[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 121bd8c..73e97cc 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 _0xd022=['get','direction','toLowerCase','out','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','secret','WhatsappAccountId','type','twilio','accountSid','authToken','messages','create','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','messageId','body','models'];(function(_0x1ca448,_0x112213){var _0xee2ac8=function(_0x5861ec){while(--_0x5861ec){_0x1ca448['push'](_0x1ca448['shift']());}};_0xee2ac8(++_0x112213);}(_0xd022,0x1c9));var _0x2d02=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xd022[_0x5f09c5];return _0x426ad9;};'use strict';var _=require('lodash');var util=require(_0x2d02('0x0'));var logger=require('../../config/logger')(_0x2d02('0x1'));var moment=require(_0x2d02('0x2'));var BPromise=require(_0x2d02('0x3'));var rp=require(_0x2d02('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2d02('0x5'));var config=require(_0x2d02('0x6'));var attributes=require(_0x2d02('0x7'));module['exports']=function(_0x15e435,_0x43f2e4){return _0x15e435[_0x2d02('0x8')](_0x2d02('0x9'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x2d02('0xa')]},{'name':'fti_whatsapp_messages','fields':[_0x2d02('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x48a4f0,_0x7bf1ad,_0x47c815){var _0x305e45=_0x15e435[_0x2d02('0xc')];var _0x390594=_0x48a4f0[_0x2d02('0xd')]({'plain':!![]});if(_0x390594[_0x2d02('0xe')][_0x2d02('0xf')]()==='in'||_0x390594[_0x2d02('0xe')][_0x2d02('0xf')]()===_0x2d02('0x10')&&!_0x390594['secret']&&!_[_0x2d02('0x11')](_0x390594['UserId'])){_0x305e45[_0x2d02('0x12')][_0x2d02('0x13')]({'where':{'id':_0x390594[_0x2d02('0x14')]}})[_0x2d02('0x15')](function(_0xf1a9ed){if(_0xf1a9ed){_0xf1a9ed[_0x2d02('0x16')]({'lastMsgAt':_0x390594[_0x2d02('0x17')],'lastMsgDirection':_0x390594[_0x2d02('0xe')][_0x2d02('0xf')]()});}})[_0x2d02('0x18')](function(_0x508ead){console[_0x2d02('0x19')](_0x508ead);});}if(_0x390594[_0x2d02('0xe')]===_0x2d02('0x10')&&!_0x390594[_0x2d02('0x1a')]){var _0x2466ea;_0x305e45['WhatsappAccount']['find']({'where':{'id':_0x390594[_0x2d02('0x1b')]},'raw':!![]})['then'](function(_0x47ea28){_0x2466ea=_0x47ea28;if(_0x2466ea&&_0x2466ea[_0x2d02('0x1c')]){switch(_0x2466ea[_0x2d02('0x1c')]){case _0x2d02('0x1d'):var _0x4982d2=require('twilio');if(_0x2466ea[_0x2d02('0x1e')]&&_0x2466ea['authToken']&&_0x2466ea['phone']){var _0x5c7685=new _0x4982d2(_0x2466ea[_0x2d02('0x1e')],_0x2466ea[_0x2d02('0x1f')]);_0x5c7685[_0x2d02('0x20')][_0x2d02('0x21')]({'body':_0x390594[_0x2d02('0xb')],'to':'whatsapp:'+_0x390594['phone'],'from':_0x2d02('0x22')+_0x2466ea[_0x2d02('0x23')],'statusCallback':_0x2466ea[_0x2d02('0x24')]+_0x2d02('0x25')+_0x390594['id']+_0x2d02('0x26')+_0x2466ea[_0x2d02('0x27')]})[_0x2d02('0x15')](function(_0x4b379b){if(_0x4b379b[_0x2d02('0x28')]){return _0x48a4f0[_0x2d02('0x16')]({'messageId':_0x4b379b[_0x2d02('0x28')]});}})[_0x2d02('0x18')](function(_0x56a7a1){logger[_0x2d02('0x19')](_0x2d02('0x29'),_0x2d02('0x2a'),_0x2d02('0x1d'),util['inspect'](_0x56a7a1,{'showHidden':![],'depth':null}));});}else{logger[_0x2d02('0x19')](_0x2d02('0x29'),_0x2d02('0x2a'),'twilio',_0x2d02('0x2b'));}break;}}})[_0x2d02('0x2c')](function(){_0x47c815();});}else{_0x47c815();}}},'charset':_0x2d02('0x2d'),'collate':_0x2d02('0x2e')});}; \ No newline at end of file +var _0xaffd=['afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','get','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s'];(function(_0x146e0b,_0x3466c6){var _0x64d273=function(_0x322a02){while(--_0x322a02){_0x146e0b['push'](_0x146e0b['shift']());}};_0x64d273(++_0x3466c6);}(_0xaffd,0x108));var _0xdaff=function(_0x193d3a,_0xb88b49){_0x193d3a=_0x193d3a-0x0;var _0x2e6d31=_0xaffd[_0x193d3a];return _0x2e6d31;};'use strict';var _=require(_0xdaff('0x0'));var util=require(_0xdaff('0x1'));var logger=require(_0xdaff('0x2'))(_0xdaff('0x3'));var moment=require(_0xdaff('0x4'));var BPromise=require('bluebird');var rp=require(_0xdaff('0x5'));var fs=require('fs');var path=require(_0xdaff('0x6'));var rimraf=require(_0xdaff('0x7'));var config=require(_0xdaff('0x8'));var attributes=require(_0xdaff('0x9'));module[_0xdaff('0xa')]=function(_0x42293d,_0x119661){return _0x42293d[_0xdaff('0xb')](_0xdaff('0xc'),attributes,{'tableName':_0xdaff('0xd'),'paranoid':![],'indexes':[{'name':_0xdaff('0xe'),'fields':['messageId']},{'name':_0xdaff('0xf'),'fields':['body'],'type':_0xdaff('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4af79d,_0x5f138f,_0x15dae9){var _0x22caf2=_0x42293d['models'];var _0xd1cc85=_0x4af79d[_0xdaff('0x11')]({'plain':!![]});if(_0xd1cc85[_0xdaff('0x12')][_0xdaff('0x13')]()==='in'||_0xd1cc85[_0xdaff('0x12')][_0xdaff('0x13')]()===_0xdaff('0x14')&&!_0xd1cc85[_0xdaff('0x15')]&&!_['isNil'](_0xd1cc85[_0xdaff('0x16')])){_0x22caf2[_0xdaff('0x17')][_0xdaff('0x18')]({'where':{'id':_0xd1cc85[_0xdaff('0x19')]}})[_0xdaff('0x1a')](function(_0x264ee6){if(_0x264ee6){_0x264ee6[_0xdaff('0x1b')]({'lastMsgAt':_0xd1cc85[_0xdaff('0x1c')],'lastMsgDirection':_0xd1cc85[_0xdaff('0x12')][_0xdaff('0x13')]()});}})[_0xdaff('0x1d')](function(_0x44604b){console[_0xdaff('0x1e')](_0x44604b);});}if(_0xd1cc85[_0xdaff('0x12')]===_0xdaff('0x14')&&!_0xd1cc85[_0xdaff('0x15')]){var _0x525ef5;_0x22caf2[_0xdaff('0x1f')]['find']({'where':{'id':_0xd1cc85[_0xdaff('0x20')]},'raw':!![]})[_0xdaff('0x1a')](function(_0x28826a){_0x525ef5=_0x28826a;if(_0x525ef5&&_0x525ef5[_0xdaff('0x21')]){switch(_0x525ef5[_0xdaff('0x21')]){case _0xdaff('0x22'):var _0x32c633=require(_0xdaff('0x22'));if(_0x525ef5[_0xdaff('0x23')]&&_0x525ef5[_0xdaff('0x24')]&&_0x525ef5[_0xdaff('0x25')]){var _0x13e167=new _0x32c633(_0x525ef5[_0xdaff('0x23')],_0x525ef5[_0xdaff('0x24')]);_0x13e167[_0xdaff('0x26')][_0xdaff('0x27')]({'body':_0xd1cc85[_0xdaff('0x28')],'to':'whatsapp:'+_0xd1cc85['phone'],'from':_0xdaff('0x29')+_0x525ef5['phone'],'statusCallback':_0x525ef5[_0xdaff('0x2a')]+_0xdaff('0x2b')+_0xd1cc85['id']+_0xdaff('0x2c')+_0x525ef5[_0xdaff('0x2d')]})[_0xdaff('0x1a')](function(_0x15d9e5){if(_0x15d9e5[_0xdaff('0x2e')]){return _0x4af79d['update']({'messageId':_0x15d9e5['sid']});}})[_0xdaff('0x1d')](function(_0x524141){logger[_0xdaff('0x1e')](_0xdaff('0x2f'),_0xdaff('0x30'),_0xdaff('0x22'),util['inspect'](_0x524141,{'showHidden':![],'depth':null}));});}else{logger[_0xdaff('0x1e')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',_0xdaff('0x31'));}break;}}})[_0xdaff('0x32')](function(){_0x15dae9();});}else{_0x15dae9();}}},'charset':_0xdaff('0x33'),'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 4357007..6363845 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 _0x3d33=['jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','request\x20sent','debug','error','code','WhatsappMessage,\x20%s,\x20%s','message','info','result','body','options','CreateWhatsappMessage','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x33cf93,_0x1f7083){var _0x54fc2b=function(_0x190fde){while(--_0x190fde){_0x33cf93['push'](_0x33cf93['shift']());}};_0x54fc2b(++_0x1f7083);}(_0x3d33,0x16b));var _0x33d3=function(_0x553bf7,_0x4acdaa){_0x553bf7=_0x553bf7-0x0;var _0x24437f=_0x3d33[_0x553bf7];return _0x24437f;};'use strict';var _=require(_0x33d3('0x0'));var util=require(_0x33d3('0x1'));var moment=require(_0x33d3('0x2'));var BPromise=require('bluebird');var rs=require(_0x33d3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x33d3('0x4'))['db'];var utils=require(_0x33d3('0x5'));var logger=require(_0x33d3('0x6'))(_0x33d3('0x7'));var config=require(_0x33d3('0x8'));var jayson=require(_0x33d3('0x9'));var client=jayson['client'][_0x33d3('0xa')]({'port':0x232a});config['redis']=_[_0x33d3('0xb')](config[_0x33d3('0xc')],{'host':_0x33d3('0xd'),'port':0x18eb});var socket=require(_0x33d3('0xe'))(new Redis(config['redis']));require(_0x33d3('0xf'))[_0x33d3('0x10')](socket);function respondWithRpcPromise(_0x2c2127,_0x2bf501,_0x4d061d){return new BPromise(function(_0x298f95,_0x895eb2){return client[_0x33d3('0x11')](_0x2c2127,_0x4d061d)[_0x33d3('0x12')](function(_0x56ae6d){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x2bf501,_0x33d3('0x13'));logger[_0x33d3('0x14')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x2bf501,_0x33d3('0x13'),JSON['stringify'](_0x56ae6d));if(_0x56ae6d[_0x33d3('0x15')]){if(_0x56ae6d[_0x33d3('0x15')][_0x33d3('0x16')]===0x1f4){logger[_0x33d3('0x15')](_0x33d3('0x17'),_0x2bf501,_0x56ae6d[_0x33d3('0x15')][_0x33d3('0x18')]);return _0x895eb2(_0x56ae6d['error']['message']);}logger[_0x33d3('0x15')](_0x33d3('0x17'),_0x2bf501,_0x56ae6d[_0x33d3('0x15')][_0x33d3('0x18')]);return _0x298f95(_0x56ae6d[_0x33d3('0x15')]['message']);}else{logger[_0x33d3('0x19')]('WhatsappMessage,\x20%s,\x20%s',_0x2bf501,'request\x20sent');_0x298f95(_0x56ae6d[_0x33d3('0x1a')][_0x33d3('0x18')]);}})['catch'](function(_0x3a9d4a){logger['error'](_0x33d3('0x17'),_0x2bf501,_0x3a9d4a);_0x895eb2(_0x3a9d4a);});});}exports['CreateWhatsappMessage']=function(_0xc10473){var _0x1d75d9=this;return new Promise(function(_0x31c34b,_0x237918){return db['WhatsappMessage']['create'](_0xc10473[_0x33d3('0x1b')],{'raw':_0xc10473[_0x33d3('0x1c')]?_0xc10473[_0x33d3('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3e75f9){logger[_0x33d3('0x19')]('CreateWhatsappMessage',_0xc10473);logger[_0x33d3('0x14')](_0x33d3('0x1d'),_0xc10473,JSON['stringify'](_0x3e75f9));_0x31c34b(_0x3e75f9);})[_0x33d3('0x1e')](function(_0x516b52){logger['error'](_0x33d3('0x1d'),_0x516b52[_0x33d3('0x18')],_0xc10473);_0x237918(_0x1d75d9[_0x33d3('0x15')](0x1f4,_0x516b52[_0x33d3('0x18')]));});});}; \ No newline at end of file +var _0x5186=['body','options','raw','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','then','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','info','result','catch','CreateWhatsappMessage','WhatsappMessage','create'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x5186,0x179));var _0x6518=function(_0x58d35a,_0x135b49){_0x58d35a=_0x58d35a-0x0;var _0xe5d2a6=_0x5186[_0x58d35a];return _0xe5d2a6;};'use strict';var _=require('lodash');var util=require(_0x6518('0x0'));var moment=require('moment');var BPromise=require(_0x6518('0x1'));var rs=require(_0x6518('0x2'));var fs=require('fs');var Redis=require(_0x6518('0x3'));var db=require(_0x6518('0x4'))['db'];var utils=require(_0x6518('0x5'));var logger=require(_0x6518('0x6'))(_0x6518('0x7'));var config=require(_0x6518('0x8'));var jayson=require(_0x6518('0x9'));var client=jayson['client'][_0x6518('0xa')]({'port':0x232a});config[_0x6518('0xb')]=_[_0x6518('0xc')](config[_0x6518('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6518('0xd'))(new Redis(config[_0x6518('0xb')]));require(_0x6518('0xe'))[_0x6518('0xf')](socket);function respondWithRpcPromise(_0x29b52d,_0x5a9992,_0x3a7438){return new BPromise(function(_0xfa7215,_0x56f749){return client['request'](_0x29b52d,_0x3a7438)[_0x6518('0x10')](function(_0xf8ae29){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x5a9992,_0x6518('0x11'));logger[_0x6518('0x12')](_0x6518('0x13'),_0x5a9992,'request\x20sent',JSON[_0x6518('0x14')](_0xf8ae29));if(_0xf8ae29['error']){if(_0xf8ae29[_0x6518('0x15')][_0x6518('0x16')]===0x1f4){logger[_0x6518('0x15')](_0x6518('0x17'),_0x5a9992,_0xf8ae29['error']['message']);return _0x56f749(_0xf8ae29[_0x6518('0x15')]['message']);}logger['error'](_0x6518('0x17'),_0x5a9992,_0xf8ae29[_0x6518('0x15')][_0x6518('0x18')]);return _0xfa7215(_0xf8ae29[_0x6518('0x15')][_0x6518('0x18')]);}else{logger[_0x6518('0x19')](_0x6518('0x17'),_0x5a9992,'request\x20sent');_0xfa7215(_0xf8ae29[_0x6518('0x1a')][_0x6518('0x18')]);}})[_0x6518('0x1b')](function(_0x3f63fb){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x5a9992,_0x3f63fb);_0x56f749(_0x3f63fb);});});}exports[_0x6518('0x1c')]=function(_0x348bc3){var _0x54ba4f=this;return new Promise(function(_0xd88da1,_0x3b1d95){return db[_0x6518('0x1d')][_0x6518('0x1e')](_0x348bc3[_0x6518('0x1f')],{'raw':_0x348bc3[_0x6518('0x20')]?_0x348bc3[_0x6518('0x20')][_0x6518('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x38ff3a){logger['info'](_0x6518('0x1c'),_0x348bc3);logger['debug'](_0x6518('0x1c'),_0x348bc3,JSON[_0x6518('0x14')](_0x38ff3a));_0xd88da1(_0x38ff3a);})[_0x6518('0x1b')](function(_0x50d92c){logger[_0x6518('0x15')](_0x6518('0x1c'),_0x50d92c[_0x6518('0x18')],_0x348bc3);_0x3b1d95(_0x54ba4f[_0x6518('0x15')](0x1f4,_0x50d92c[_0x6518('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 9c7a253..8611a29 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 _0xc13f=['register','length','whatsappMessage:','save','remove','update','emit','removeListener'];(function(_0x372515,_0xdd11f){var _0xa3bf4e=function(_0x212cc8){while(--_0x212cc8){_0x372515['push'](_0x372515['shift']());}};_0xa3bf4e(++_0xdd11f);}(_0xc13f,0x1c3));var _0xfc13=function(_0x386885,_0x309fbc){_0x386885=_0x386885-0x0;var _0xd23949=_0xc13f[_0x386885];return _0xd23949;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xfc13('0x0'),_0xfc13('0x1'),_0xfc13('0x2')];function createListener(_0x2cf3ed,_0x2f69b3){return function(_0x1f65e0){_0x2f69b3[_0xfc13('0x3')](_0x2cf3ed,_0x1f65e0);};}function removeListener(_0x37a6cc,_0x2629ce){return function(){WhatsappMessageEvents[_0xfc13('0x4')](_0x37a6cc,_0x2629ce);};}exports[_0xfc13('0x5')]=function(_0xc78059){for(var _0x34891c=0x0,_0x3f11a3=events[_0xfc13('0x6')];_0x34891c<_0x3f11a3;_0x34891c++){var _0x2244a9=events[_0x34891c];var _0x478886=createListener(_0xfc13('0x7')+_0x2244a9,_0xc78059);WhatsappMessageEvents['on'](_0x2244a9,_0x478886);}}; \ No newline at end of file +var _0x7a4c=['save','remove','emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events'];(function(_0x18c2ed,_0x322a9e){var _0x3200d4=function(_0x877c5c){while(--_0x877c5c){_0x18c2ed['push'](_0x18c2ed['shift']());}};_0x3200d4(++_0x322a9e);}(_0x7a4c,0x1cf));var _0xc7a4=function(_0x501732,_0x53aaa0){_0x501732=_0x501732-0x0;var _0x588ae8=_0x7a4c[_0x501732];return _0x588ae8;};'use strict';var WhatsappMessageEvents=require(_0xc7a4('0x0'));var events=[_0xc7a4('0x1'),_0xc7a4('0x2'),'update'];function createListener(_0xb77087,_0x5a3802){return function(_0x384162){_0x5a3802[_0xc7a4('0x3')](_0xb77087,_0x384162);};}function removeListener(_0xe376f5,_0x200b8a){return function(){WhatsappMessageEvents[_0xc7a4('0x4')](_0xe376f5,_0x200b8a);};}exports[_0xc7a4('0x5')]=function(_0xca256e){for(var _0x288f91=0x0,_0x23ceb3=events[_0xc7a4('0x6')];_0x288f91<_0x23ceb3;_0x288f91++){var _0x82e5dc=events[_0x288f91];var _0x2ca75b=createListener(_0xc7a4('0x7')+_0x82e5dc,_0xca256e);WhatsappMessageEvents['on'](_0x82e5dc,_0x2ca75b);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index cb7b6dc..7585765 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 _0x5726=['/:id/teams','addTeams','addAgents','/:id','destroy','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','/describe','isAuthenticated','describe','getMembers','getTeams','/:id/users','getAgents','create','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5726,0x17f));var _0x6572=function(_0x1e8637,_0x5d224f){_0x1e8637=_0x1e8637-0x0;var _0x588cf2=_0x5726[_0x1e8637];return _0x588cf2;};'use strict';var multer=require(_0x6572('0x0'));var util=require(_0x6572('0x1'));var path=require(_0x6572('0x2'));var timeout=require(_0x6572('0x3'));var express=require('express');var router=express[_0x6572('0x4')]();var auth=require(_0x6572('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6572('0x6'));var controller=require('./whatsappQueue.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6572('0x7')](_0x6572('0x8'),auth[_0x6572('0x9')](),controller[_0x6572('0xa')]);router[_0x6572('0x7')]('/:id',auth[_0x6572('0x9')](),controller['show']);router[_0x6572('0x7')]('/:id/members',auth[_0x6572('0x9')](),controller[_0x6572('0xb')]);router['get']('/:id/teams',auth[_0x6572('0x9')](),controller[_0x6572('0xc')]);router[_0x6572('0x7')](_0x6572('0xd'),auth['isAuthenticated'](),controller[_0x6572('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6572('0xf')]);router[_0x6572('0x10')](_0x6572('0x11'),auth[_0x6572('0x9')](),controller[_0x6572('0x12')]);router[_0x6572('0x10')](_0x6572('0xd'),auth[_0x6572('0x9')](),controller[_0x6572('0x13')]);router['put'](_0x6572('0x14'),auth[_0x6572('0x9')](),controller['update']);router['delete'](_0x6572('0x14'),auth['isAuthenticated'](),controller[_0x6572('0x15')]);router[_0x6572('0x16')](_0x6572('0x11'),auth['isAuthenticated'](),controller[_0x6572('0x17')]);router[_0x6572('0x16')]('/:id/users',auth[_0x6572('0x9')](),controller[_0x6572('0x18')]);module['exports']=router; \ No newline at end of file +var _0x9f08=['delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update'];(function(_0x118216,_0x492662){var _0x13f1d4=function(_0x2ae446){while(--_0x2ae446){_0x118216['push'](_0x118216['shift']());}};_0x13f1d4(++_0x492662);}(_0x9f08,0x1d6));var _0x89f0=function(_0x1f5c5a,_0x2ea04c){_0x1f5c5a=_0x1f5c5a-0x0;var _0x421376=_0x9f08[_0x1f5c5a];return _0x421376;};'use strict';var multer=require(_0x89f0('0x0'));var util=require(_0x89f0('0x1'));var path=require(_0x89f0('0x2'));var timeout=require(_0x89f0('0x3'));var express=require(_0x89f0('0x4'));var router=express['Router']();var auth=require(_0x89f0('0x5'));var interaction=require(_0x89f0('0x6'));var config=require('../../config/environment');var controller=require(_0x89f0('0x7'));router[_0x89f0('0x8')]('/',auth[_0x89f0('0x9')](),controller[_0x89f0('0xa')]);router[_0x89f0('0x8')](_0x89f0('0xb'),auth[_0x89f0('0x9')](),controller[_0x89f0('0xc')]);router[_0x89f0('0x8')](_0x89f0('0xd'),auth[_0x89f0('0x9')](),controller[_0x89f0('0xe')]);router[_0x89f0('0x8')](_0x89f0('0xf'),auth[_0x89f0('0x9')](),controller['getMembers']);router[_0x89f0('0x8')](_0x89f0('0x10'),auth[_0x89f0('0x9')](),controller[_0x89f0('0x11')]);router[_0x89f0('0x8')](_0x89f0('0x12'),auth[_0x89f0('0x9')](),controller[_0x89f0('0x13')]);router[_0x89f0('0x14')]('/',auth[_0x89f0('0x9')](),controller[_0x89f0('0x15')]);router['post'](_0x89f0('0x10'),auth[_0x89f0('0x9')](),controller[_0x89f0('0x16')]);router[_0x89f0('0x14')](_0x89f0('0x12'),auth[_0x89f0('0x9')](),controller[_0x89f0('0x17')]);router[_0x89f0('0x18')](_0x89f0('0xd'),auth[_0x89f0('0x9')](),controller[_0x89f0('0x19')]);router[_0x89f0('0x1a')](_0x89f0('0xd'),auth['isAuthenticated'](),controller[_0x89f0('0x1b')]);router[_0x89f0('0x1a')](_0x89f0('0x10'),auth[_0x89f0('0x9')](),controller[_0x89f0('0x1c')]);router[_0x89f0('0x1a')](_0x89f0('0x12'),auth[_0x89f0('0x9')](),controller[_0x89f0('0x1d')]);module[_0x89f0('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 9daa828..f700563 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 _0x24de=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x3d7734,_0x1da198){var _0x9dfc6f=function(_0x569a25){while(--_0x569a25){_0x3d7734['push'](_0x3d7734['shift']());}};_0x9dfc6f(++_0x1da198);}(_0x24de,0x1e7));var _0xe24d=function(_0x259860,_0x80f56d){_0x259860=_0x259860-0x0;var _0x599310=_0x24de[_0x259860];return _0x599310;};'use strict';var Sequelize=require(_0xe24d('0x0'));module[_0xe24d('0x1')]={'name':{'type':Sequelize[_0xe24d('0x2')],'unique':_0xe24d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xe24d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe24d('0x5')](_0xe24d('0x6'),_0xe24d('0x7'),_0xe24d('0x8'))},'description':{'type':Sequelize[_0xe24d('0x2')]}}; \ No newline at end of file +var _0x6fce=['name','INTEGER','ENUM','rrmemory','beepall','sequelize','STRING'];(function(_0x3e25c1,_0x1d15f9){var _0x52e7f2=function(_0x597a5a){while(--_0x597a5a){_0x3e25c1['push'](_0x3e25c1['shift']());}};_0x52e7f2(++_0x1d15f9);}(_0x6fce,0xbb));var _0xe6fc=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x6fce[_0x11005e];return _0x29338f;};'use strict';var Sequelize=require(_0xe6fc('0x0'));module['exports']={'name':{'type':Sequelize[_0xe6fc('0x1')],'unique':_0xe6fc('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xe6fc('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe6fc('0x4')](_0xe6fc('0x5'),_0xe6fc('0x6'),'roundrobin')},'description':{'type':Sequelize[_0xe6fc('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 9f9653a..7147a05 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 _0x33cd=['save','update','then','destroy','WhatsappQueues','error','stack','send','map','rawAttributes','fieldName','type','key','model','name','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','count','include','WhatsappQueue','findAll','rows','catch','show','params','length','includeAll','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','describe','getMembers','findOne','UserWhatsappQueue','User','findAndCountAll','UserId','agent','createdAt','%s/%s','SIP','whatsappPause','updatedAt','getTeams','Team','ids','online','voicePause','flatMap','sequelize','transaction','addTeams','each','emit','userWhatsappQueue:save','removeTeams','Agents','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','toString','SELECT','every','includes','all','union','compact','value','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','status','json','offset','limit','set','Content-Range','reject'];(function(_0x1d040d,_0x4fab9b){var _0x57aac7=function(_0x12a0c3){while(--_0x12a0c3){_0x1d040d['push'](_0x1d040d['shift']());}};_0x57aac7(++_0x4fab9b);}(_0x33cd,0x179));var _0xd33c=function(_0x3dd63a,_0x4bdddf){_0x3dd63a=_0x3dd63a-0x0;var _0x1af397=_0x33cd[_0x3dd63a];return _0x1af397;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd33c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd33c('0x1'));var rp=require(_0xd33c('0x2'));var moment=require(_0xd33c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd33c('0x4'));var util=require(_0xd33c('0x5'));var path=require('path');var sox=require(_0xd33c('0x6'));var csv=require('to-csv');var ejs=require(_0xd33c('0x7'));var fs=require('fs');var _=require(_0xd33c('0x8'));var squel=require(_0xd33c('0x9'));var crypto=require(_0xd33c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd33c('0xb'));var toCsv=require(_0xd33c('0xc'));var querystring=require(_0xd33c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd33c('0xe'));var qs=require(_0xd33c('0xf'));var as=require(_0xd33c('0x10'));var hardwareService=require(_0xd33c('0x11'));var logger=require(_0xd33c('0x12'))(_0xd33c('0x13'));var utils=require('../../config/utils');var config=require(_0xd33c('0x14'));var licenseUtil=require(_0xd33c('0x15'));var db=require(_0xd33c('0x16'))['db'];config[_0xd33c('0x17')]=_['defaults'](config['redis'],{'host':_0xd33c('0x18'),'port':0x18eb});var socket=require(_0xd33c('0x19'))(new Redis(config['redis']));require(_0xd33c('0x1a'))[_0xd33c('0x1b')](socket);function respondWithStatusCode(_0x405a23,_0xc2b799){_0xc2b799=_0xc2b799||0xcc;return function(_0x4db7c){if(_0x4db7c){return _0x405a23[_0xd33c('0x1c')](_0xc2b799);}return _0x405a23['status'](_0xc2b799)[_0xd33c('0x1d')]();};}function respondWithResult(_0x4396c3,_0x5a083a){_0x5a083a=_0x5a083a||0xc8;return function(_0x11a7d4){if(_0x11a7d4){return _0x4396c3[_0xd33c('0x1e')](_0x5a083a)[_0xd33c('0x1f')](_0x11a7d4);}};}function respondWithFilteredResult(_0x5db04d,_0x40574f){return function(_0x48d833){if(_0x48d833){var _0x451f1f=_0x48d833['count'],_0x2f2eef=_0x40574f[_0xd33c('0x20')],_0x1ddcb1=_0x40574f['offset']+_0x40574f[_0xd33c('0x21')],_0x305026;if(_0x1ddcb1>=_0x451f1f){_0x1ddcb1=_0x451f1f;_0x305026=0xc8;}else{_0x305026=0xce;}_0x5db04d[_0xd33c('0x1e')](_0x305026);return _0x5db04d[_0xd33c('0x22')](_0xd33c('0x23'),_0x2f2eef+'-'+_0x1ddcb1+'/'+_0x451f1f)[_0xd33c('0x1f')](_0x48d833);}return null;};}function patchUpdates(_0x5852bd){return function(_0x104082){try{jsonpatch['apply'](_0x104082,_0x5852bd,!![]);}catch(_0x36e18b){return BPromise[_0xd33c('0x24')](_0x36e18b);}return _0x104082[_0xd33c('0x25')]();};}function saveUpdates(_0x15568c,_0x13e573){return function(_0x18f4f9){if(_0x18f4f9){return _0x18f4f9[_0xd33c('0x26')](_0x15568c)[_0xd33c('0x27')](function(_0xacd683){return _0xacd683;});}return null;};}function removeEntity(_0xa176d4,_0x4e9f0e){return function(_0x799cf0){if(_0x799cf0){return _0x799cf0[_0xd33c('0x28')]()['then'](function(){var _0x5911b8=_0x799cf0['get']({'plain':!![]});var _0x39ba48=_0xd33c('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x39ba48,'resourceId':_0x5911b8['id']}})['then'](function(){return _0x799cf0;});})[_0xd33c('0x27')](function(){_0xa176d4['status'](0xcc)[_0xd33c('0x1d')]();});}};}function handleEntityNotFound(_0x20f735,_0x5c1a41){return function(_0x5c7a7b){if(!_0x5c7a7b){_0x20f735['sendStatus'](0x194);}return _0x5c7a7b;};}function handleError(_0x336df1,_0x3579f1){_0x3579f1=_0x3579f1||0x1f4;return function(_0x3054f1){logger[_0xd33c('0x2a')](_0x3054f1[_0xd33c('0x2b')]);if(_0x3054f1['name']){delete _0x3054f1['name'];}_0x336df1[_0xd33c('0x1e')](_0x3579f1)[_0xd33c('0x2c')](_0x3054f1);};}exports['index']=function(_0xb364da,_0x25e989){var _0x2630d4={},_0x1304c9={},_0x435dee={'count':0x0,'rows':[]};var _0x23d4fa=_[_0xd33c('0x2d')](db['WhatsappQueue'][_0xd33c('0x2e')],function(_0x1239d0){return{'name':_0x1239d0[_0xd33c('0x2f')],'type':_0x1239d0[_0xd33c('0x30')][_0xd33c('0x31')]};});_0x1304c9[_0xd33c('0x32')]=_[_0xd33c('0x2d')](_0x23d4fa,_0xd33c('0x33'));_0x1304c9['query']=_[_0xd33c('0x34')](_0xb364da['query']);_0x1304c9['filters']=_[_0xd33c('0x35')](_0x1304c9[_0xd33c('0x32')],_0x1304c9[_0xd33c('0x36')]);_0x2630d4[_0xd33c('0x37')]=_[_0xd33c('0x35')](_0x1304c9[_0xd33c('0x32')],qs[_0xd33c('0x38')](_0xb364da[_0xd33c('0x36')][_0xd33c('0x38')]));_0x2630d4[_0xd33c('0x37')]=_0x2630d4[_0xd33c('0x37')]['length']?_0x2630d4['attributes']:_0x1304c9[_0xd33c('0x32')];if(!_0xb364da[_0xd33c('0x36')][_0xd33c('0x39')](_0xd33c('0x3a'))){_0x2630d4['limit']=qs[_0xd33c('0x21')](_0xb364da[_0xd33c('0x36')][_0xd33c('0x21')]);_0x2630d4[_0xd33c('0x20')]=qs[_0xd33c('0x20')](_0xb364da[_0xd33c('0x36')][_0xd33c('0x20')]);}_0x2630d4[_0xd33c('0x3b')]=qs[_0xd33c('0x3c')](_0xb364da['query']['sort']);_0x2630d4[_0xd33c('0x3d')]=qs['filters'](_[_0xd33c('0x3e')](_0xb364da[_0xd33c('0x36')],_0x1304c9[_0xd33c('0x3f')]),_0x23d4fa);if(_0xb364da[_0xd33c('0x36')][_0xd33c('0x40')]){_0x2630d4['where']=_[_0xd33c('0x41')](_0x2630d4[_0xd33c('0x3d')],{'$or':_[_0xd33c('0x2d')](_0x23d4fa,function(_0x3eb862){if(_0x3eb862['type']!==_0xd33c('0x42')){var _0x4bdf33={};_0x4bdf33[_0x3eb862[_0xd33c('0x33')]]={'$like':'%'+_0xb364da[_0xd33c('0x36')]['filter']+'%'};return _0x4bdf33;}})});}_0x2630d4=_[_0xd33c('0x41')]({},_0x2630d4,_0xb364da['options']);var _0x2023f6={'where':_0x2630d4['where']};return db['WhatsappQueue'][_0xd33c('0x43')](_0x2023f6)[_0xd33c('0x27')](function(_0x3c10f1){_0x435dee[_0xd33c('0x43')]=_0x3c10f1;if(_0xb364da['query']['includeAll']){_0x2630d4[_0xd33c('0x44')]=[{'all':!![]}];}return db[_0xd33c('0x45')][_0xd33c('0x46')](_0x2630d4);})[_0xd33c('0x27')](function(_0x163dce){_0x435dee[_0xd33c('0x47')]=_0x163dce;return _0x435dee;})['then'](respondWithFilteredResult(_0x25e989,_0x2630d4))[_0xd33c('0x48')](handleError(_0x25e989,null));};exports[_0xd33c('0x49')]=function(_0x737d1a,_0x4df7cb){var _0x5bab10={'raw':!![],'where':{'id':_0x737d1a[_0xd33c('0x4a')]['id']}},_0x2510b6={};_0x2510b6[_0xd33c('0x32')]=_[_0xd33c('0x34')](db[_0xd33c('0x45')][_0xd33c('0x2e')]);_0x2510b6[_0xd33c('0x36')]=_[_0xd33c('0x34')](_0x737d1a['query']);_0x2510b6['filters']=_[_0xd33c('0x35')](_0x2510b6[_0xd33c('0x32')],_0x2510b6[_0xd33c('0x36')]);_0x5bab10[_0xd33c('0x37')]=_[_0xd33c('0x35')](_0x2510b6[_0xd33c('0x32')],qs[_0xd33c('0x38')](_0x737d1a[_0xd33c('0x36')][_0xd33c('0x38')]));_0x5bab10[_0xd33c('0x37')]=_0x5bab10[_0xd33c('0x37')][_0xd33c('0x4b')]?_0x5bab10[_0xd33c('0x37')]:_0x2510b6['model'];if(_0x737d1a[_0xd33c('0x36')][_0xd33c('0x4c')]){_0x5bab10[_0xd33c('0x44')]=[{'all':!![]}];}_0x5bab10=_[_0xd33c('0x41')]({},_0x5bab10,_0x737d1a[_0xd33c('0x4d')]);return db[_0xd33c('0x45')]['find'](_0x5bab10)[_0xd33c('0x27')](handleEntityNotFound(_0x4df7cb,null))[_0xd33c('0x27')](respondWithResult(_0x4df7cb,null))[_0xd33c('0x48')](handleError(_0x4df7cb,null));};exports[_0xd33c('0x4e')]=function(_0x4481fe,_0x26930a){return db[_0xd33c('0x45')][_0xd33c('0x4e')](_0x4481fe[_0xd33c('0x4f')],{})['then'](function(_0x4f3955){var _0x3579aa=_0x4481fe[_0xd33c('0x50')][_0xd33c('0x51')]({'plain':!![]});if(!_0x3579aa)throw new Error(_0xd33c('0x52'));if(_0x3579aa[_0xd33c('0x53')]===_0xd33c('0x50')){var _0xbf74cc=_0x4f3955[_0xd33c('0x51')]({'plain':!![]});var _0x5c8d81=_0xd33c('0x29');return db[_0xd33c('0x54')][_0xd33c('0x55')]({'where':{'name':_0x5c8d81,'userProfileId':_0x3579aa[_0xd33c('0x56')]},'raw':!![]})['then'](function(_0x17269c){if(_0x17269c&&_0x17269c[_0xd33c('0x57')]===0x0){return db[_0xd33c('0x58')][_0xd33c('0x4e')]({'name':_0xbf74cc[_0xd33c('0x33')],'resourceId':_0xbf74cc['id'],'type':_0x17269c['name'],'sectionId':_0x17269c['id']},{})[_0xd33c('0x27')](function(){return _0x4f3955;});}else{return _0x4f3955;}})[_0xd33c('0x48')](function(_0xdfb221){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xdfb221);throw _0xdfb221;});}return _0x4f3955;})['then'](respondWithResult(_0x26930a,0xc9))[_0xd33c('0x48')](handleError(_0x26930a,null));};exports[_0xd33c('0x26')]=function(_0x3ba8cc,_0x5e3a79){if(_0x3ba8cc[_0xd33c('0x4f')]['id']){delete _0x3ba8cc[_0xd33c('0x4f')]['id'];}return db['WhatsappQueue'][_0xd33c('0x55')]({'where':{'id':_0x3ba8cc[_0xd33c('0x4a')]['id']}})[_0xd33c('0x27')](handleEntityNotFound(_0x5e3a79,null))['then'](saveUpdates(_0x3ba8cc[_0xd33c('0x4f')],null))[_0xd33c('0x27')](respondWithResult(_0x5e3a79,null))['catch'](handleError(_0x5e3a79,null));};exports[_0xd33c('0x28')]=function(_0x248432,_0x489dfb){return db[_0xd33c('0x45')][_0xd33c('0x55')]({'where':{'id':_0x248432['params']['id']}})[_0xd33c('0x27')](handleEntityNotFound(_0x489dfb,null))[_0xd33c('0x27')](removeEntity(_0x489dfb,null))[_0xd33c('0x48')](handleError(_0x489dfb,null));};exports['describe']=function(_0x2c1763,_0x1bc6f7){return db['WhatsappQueue'][_0xd33c('0x59')]()[_0xd33c('0x27')](respondWithResult(_0x1bc6f7,null))[_0xd33c('0x48')](handleError(_0x1bc6f7,null));};exports[_0xd33c('0x5a')]=function(_0x285af8,_0x3ab9b2,_0x5270c8){var _0x2205e8={'raw':!![],'where':{}},_0xd8f29e={},_0x43451b;return db['WhatsappQueue'][_0xd33c('0x5b')]({'where':{'id':_0x285af8[_0xd33c('0x4a')]['id']}})[_0xd33c('0x27')](handleEntityNotFound(_0x3ab9b2,null))[_0xd33c('0x27')](function(_0x2d2bfb){if(_0x2d2bfb){_0x43451b=_0x2d2bfb['get']({'plain':!![]});_0xd8f29e['model']=_[_0xd33c('0x34')](db['UserWhatsappQueue'][_0xd33c('0x2e')]);_0xd8f29e[_0xd33c('0x36')]=_[_0xd33c('0x34')](_0x285af8[_0xd33c('0x36')]);_0xd8f29e[_0xd33c('0x3f')]=_[_0xd33c('0x35')](_0xd8f29e['model'],_0xd8f29e['query']);_0x2205e8[_0xd33c('0x37')]=_[_0xd33c('0x35')](_0xd8f29e[_0xd33c('0x32')],qs[_0xd33c('0x38')](_0x285af8[_0xd33c('0x36')][_0xd33c('0x38')]));_0x2205e8['attributes']=_0x2205e8[_0xd33c('0x37')][_0xd33c('0x4b')]?_0x2205e8[_0xd33c('0x37')]:_0xd8f29e[_0xd33c('0x32')];if(!_0x285af8[_0xd33c('0x36')][_0xd33c('0x39')](_0xd33c('0x3a'))){_0x2205e8[_0xd33c('0x21')]=qs[_0xd33c('0x21')](_0x285af8['query'][_0xd33c('0x21')]);_0x2205e8[_0xd33c('0x20')]=qs[_0xd33c('0x20')](_0x285af8[_0xd33c('0x36')][_0xd33c('0x20')]);}_0x2205e8[_0xd33c('0x3b')]=qs[_0xd33c('0x3c')](_0x285af8[_0xd33c('0x36')][_0xd33c('0x3c')]);_0x2205e8[_0xd33c('0x3d')]=qs['filters'](_[_0xd33c('0x3e')](_0x285af8[_0xd33c('0x36')],_0xd8f29e[_0xd33c('0x3f')]));_0x2205e8[_0xd33c('0x3d')]['WhatsappQueueId']=_0x2d2bfb['id'];if(_0x285af8['query']['filter']){_0x2205e8[_0xd33c('0x3d')]=_['merge'](_0x2205e8[_0xd33c('0x3d')],{'$or':_[_0xd33c('0x2d')](_0x2205e8['attributes'],function(_0x27473a){var _0xb39859={};_0xb39859[_0x27473a]={'$like':'%'+_0x285af8[_0xd33c('0x36')][_0xd33c('0x40')]+'%'};return _0xb39859;})});}_0x2205e8=_[_0xd33c('0x41')]({},_0x2205e8,_0x285af8[_0xd33c('0x4d')]);return db[_0xd33c('0x5c')][_0xd33c('0x46')](_0x2205e8);}})[_0xd33c('0x27')](function(_0xa6440b){if(_0xa6440b){return db[_0xd33c('0x5d')][_0xd33c('0x5e')]({'where':{'id':_[_0xd33c('0x2d')](_0xa6440b,_0xd33c('0x5f')),'role':_0xd33c('0x60')},'attributes':['id',_0xd33c('0x33'),'whatsappPause','updatedAt',_0xd33c('0x61')]});}})[_0xd33c('0x27')](function(_0x29801e){if(_0x29801e){return{'count':_0x29801e[_0xd33c('0x43')],'rows':_[_0xd33c('0x2d')](_0x29801e[_0xd33c('0x47')],function(_0x231881){return{'membername':_0x231881[_0xd33c('0x33')],'UserId':_0x231881['id'],'queue_name':_0x43451b[_0xd33c('0x33')],'WhatsappQueueId':_0x43451b['id'],'interface':util['format'](_0xd33c('0x62'),_0xd33c('0x63'),_0x231881[_0xd33c('0x33')]),'penalty':0x0,'paused':_0x231881[_0xd33c('0x64')],'createdAt':_0x231881[_0xd33c('0x61')],'updatedAt':_0x231881[_0xd33c('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd33c('0x27')](respondWithFilteredResult(_0x3ab9b2,_0x2205e8))[_0xd33c('0x48')](handleError(_0x3ab9b2,null));};exports[_0xd33c('0x66')]=function(_0x32541a,_0xb05399,_0x1e3c43){var _0x11d0c9={};var _0x5663b3={};var _0x466b57;var _0x3de8bd;return db[_0xd33c('0x45')][_0xd33c('0x5b')]({'where':{'id':_0x32541a[_0xd33c('0x4a')]['id']}})[_0xd33c('0x27')](handleEntityNotFound(_0xb05399,null))['then'](function(_0xb37dee){if(_0xb37dee){_0x466b57=_0xb37dee;_0x5663b3[_0xd33c('0x32')]=_[_0xd33c('0x34')](db[_0xd33c('0x67')][_0xd33c('0x2e')]);_0x5663b3[_0xd33c('0x36')]=_[_0xd33c('0x34')](_0x32541a['query']);_0x5663b3[_0xd33c('0x3f')]=_[_0xd33c('0x35')](_0x5663b3[_0xd33c('0x32')],_0x5663b3[_0xd33c('0x36')]);_0x11d0c9[_0xd33c('0x37')]=_[_0xd33c('0x35')](_0x5663b3[_0xd33c('0x32')],qs[_0xd33c('0x38')](_0x32541a[_0xd33c('0x36')][_0xd33c('0x38')]));_0x11d0c9[_0xd33c('0x37')]=_0x11d0c9['attributes'][_0xd33c('0x4b')]?_0x11d0c9[_0xd33c('0x37')]:_0x5663b3['model'];_0x11d0c9[_0xd33c('0x3b')]=qs[_0xd33c('0x3c')](_0x32541a[_0xd33c('0x36')][_0xd33c('0x3c')]);_0x11d0c9[_0xd33c('0x3d')]=qs[_0xd33c('0x3f')](_[_0xd33c('0x3e')](_0x32541a['query'],_0x5663b3[_0xd33c('0x3f')]));if(_0x32541a[_0xd33c('0x36')][_0xd33c('0x40')]){_0x11d0c9[_0xd33c('0x3d')]=_[_0xd33c('0x41')](_0x11d0c9[_0xd33c('0x3d')],{'$or':_[_0xd33c('0x2d')](_0x11d0c9[_0xd33c('0x37')],function(_0x4cecd5){var _0x20455f={};_0x20455f[_0x4cecd5]={'$like':'%'+_0x32541a[_0xd33c('0x36')][_0xd33c('0x40')]+'%'};return _0x20455f;})});}_0x11d0c9=_[_0xd33c('0x41')]({},_0x11d0c9,_0x32541a['options']);return _0x466b57[_0xd33c('0x66')](_0x11d0c9);}})[_0xd33c('0x27')](function(_0x2ea2c0){if(_0x2ea2c0){_0x3de8bd=_0x2ea2c0[_0xd33c('0x4b')];if(!_0x32541a['query']['hasOwnProperty']('nolimit')){_0x11d0c9[_0xd33c('0x21')]=qs[_0xd33c('0x21')](_0x32541a[_0xd33c('0x36')][_0xd33c('0x21')]);_0x11d0c9[_0xd33c('0x20')]=qs['offset'](_0x32541a[_0xd33c('0x36')][_0xd33c('0x20')]);}return _0x466b57[_0xd33c('0x66')](_0x11d0c9);}})[_0xd33c('0x27')](function(_0x4a7004){if(_0x4a7004){return _0x4a7004?{'count':_0x3de8bd,'rows':_0x4a7004}:null;}})[_0xd33c('0x27')](respondWithResult(_0xb05399,null))['catch'](handleError(_0xb05399,null));};exports['addTeams']=function(_0x5eaa18,_0x64029a,_0x3f5a48){var _0x25af62=_0x5eaa18[_0xd33c('0x4f')][_0xd33c('0x68')];return db[_0xd33c('0x67')][_0xd33c('0x46')]({'where':{'id':_0x25af62},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xd33c('0x33'),_0xd33c('0x69'),_0xd33c('0x6a'),'interface'],'raw':!![]}]})[_0xd33c('0x27')](function(_0x3e839){if(_0x3e839){var _0x5a2eb8=_[_0xd33c('0x6b')](_0x3e839,function(_0xb3292d){var _0x37b854=_0xb3292d['get']({'plain':!![]});return _0x37b854['Agents'];});return db['WhatsappQueue'][_0xd33c('0x55')]({'where':{'id':_0x5eaa18[_0xd33c('0x4a')]['id']}})['then'](function(_0x409e4c){return db[_0xd33c('0x6c')][_0xd33c('0x6d')](function(_0x4e094e){return _0x409e4c[_0xd33c('0x6e')](_0x25af62,{'transaction':_0x4e094e})[_0xd33c('0x27')](function(){return BPromise[_0xd33c('0x6f')](_0x5a2eb8,function(_0x8a932c){return db[_0xd33c('0x5c')]['findOrCreate']({'where':{'UserId':_0x8a932c['id'],'WhatsappQueueId':_0x5eaa18[_0xd33c('0x4a')]['id']},'transaction':_0x4e094e});});})[_0xd33c('0x27')](function(){_0x5a2eb8['forEach'](function(_0x5cfca0){socket[_0xd33c('0x70')](_0xd33c('0x71'),{'UserId':_0x5cfca0['id'],'WhatsappQueueId':_0x409e4c['id']});});});});});}})['then'](respondWithStatusCode(_0x64029a,null))[_0xd33c('0x48')](handleError(_0x64029a,null));};exports[_0xd33c('0x72')]=function(_0x1c023d,_0xbe84cb,_0x46897d){return db['Team']['findAll']({'where':{'id':_0x1c023d[_0xd33c('0x36')][_0xd33c('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd33c('0x73'),'attributes':['id'],'raw':!![]}]})[_0xd33c('0x27')](handleEntityNotFound(_0xbe84cb,null))[_0xd33c('0x27')](function(_0x313456){var _0x4820cc=_['map'](_0x313456,'id');var _0x8cab53=[];var _0x5701d3=[];var _0x5b1015=squel['select']();_0x5b1015[_0xd33c('0x74')](_0xd33c('0x75'))['from']('team_has_whatsapp_queues','tq')[_0xd33c('0x76')](_0xd33c('0x77'),'ut',_0xd33c('0x78'))['where'](_0xd33c('0x79'),_0x1c023d[_0xd33c('0x4a')]['id']);for(var _0x3ac858=0x0;_0x3ac858<_0x313456[_0xd33c('0x4b')];_0x3ac858+=0x1){let _0x21afdf=_0x313456[_0x3ac858];for(var _0x195cdc=0x0;_0x195cdc<_0x21afdf[_0xd33c('0x73')][_0xd33c('0x4b')];_0x195cdc+=0x1){let _0x59e881=_0x21afdf[_0xd33c('0x73')][_0x195cdc];var _0x526d25=_0x5b1015['clone']();_0x526d25[_0xd33c('0x3d')]('ut.UserId\x20=\x20?',_0x59e881['id']);_0x5701d3['push'](db[_0xd33c('0x6c')]['query'](_0x526d25[_0xd33c('0x7a')](),{'type':db[_0xd33c('0x6c')]['QueryTypes'][_0xd33c('0x7b')]})[_0xd33c('0x27')](function(_0x1cad58){if(_0x1cad58[_0xd33c('0x4b')]===0x1){return _0x59e881['id'];}else{var _0x486481=_[_0xd33c('0x7c')](_[_0xd33c('0x2d')](_0x1cad58,'TeamId'),function(_0x4fe354){return _[_0xd33c('0x7d')](_0x4820cc,_0x4fe354);});if(_0x486481){return _0x59e881['id'];}}}));}}return BPromise[_0xd33c('0x7e')](_0x5701d3)[_0xd33c('0x27')](function(_0x147b78){_0x8cab53=_(_0x8cab53)[_0xd33c('0x7f')](_0x147b78)[_0xd33c('0x80')]()[_0xd33c('0x81')]();return db[_0xd33c('0x45')][_0xd33c('0x55')]({'where':{'id':_0x1c023d[_0xd33c('0x4a')]['id']}})['then'](function(_0x467bae){return db[_0xd33c('0x6c')]['transaction'](function(_0x25a94e){return _0x467bae[_0xd33c('0x72')](_0x1c023d[_0xd33c('0x36')][_0xd33c('0x68')],{'transaction':_0x25a94e})[_0xd33c('0x27')](function(){if(!_['isEmpty'](_0x8cab53)){return _0x467bae[_0xd33c('0x82')](_0x8cab53,{'transaction':_0x25a94e});}})['then'](function(){_0x8cab53[_0xd33c('0x83')](function(_0x201637){socket['emit'](_0xd33c('0x84'),{'UserId':_0x201637,'WhatsappQueueId':_0x467bae['id']});});});});});});})[_0xd33c('0x27')](respondWithStatusCode(_0xbe84cb,null))[_0xd33c('0x48')](handleError(_0xbe84cb,null));};exports[_0xd33c('0x85')]=function(_0x435dd3,_0x284554,_0x3304f9){return db[_0xd33c('0x45')][_0xd33c('0x55')]({'where':{'id':_0x435dd3[_0xd33c('0x4a')]['id']}})[_0xd33c('0x27')](handleEntityNotFound(_0x284554,null))[_0xd33c('0x27')](function(_0x1e6e10){if(_0x1e6e10){return _0x1e6e10[_0xd33c('0x85')](_0x435dd3['body'][_0xd33c('0x68')],_[_0xd33c('0x86')](_0x435dd3['body'],[_0xd33c('0x68'),'id'])||{})[_0xd33c('0x87')](function(_0x3a86b2){for(var _0x17b07a=0x0;_0x17b07a<_0x435dd3[_0xd33c('0x4f')][_0xd33c('0x68')][_0xd33c('0x4b')];_0x17b07a+=0x1){socket['emit'](_0xd33c('0x71'),{'UserId':_0x435dd3['body'][_0xd33c('0x68')][_0x17b07a],'WhatsappQueueId':_0x435dd3[_0xd33c('0x4a')]['id']});}return _0x3a86b2;});}})[_0xd33c('0x27')](respondWithResult(_0x284554,null))[_0xd33c('0x48')](handleError(_0x284554,null));};exports['removeAgents']=function(_0x431703,_0x188576,_0x172c5c){return db[_0xd33c('0x45')]['find']({'where':{'id':_0x431703[_0xd33c('0x4a')]['id']}})[_0xd33c('0x27')](handleEntityNotFound(_0x188576,null))[_0xd33c('0x27')](function(_0x2df526){if(_0x2df526){return _0x2df526[_0xd33c('0x82')](_0x431703[_0xd33c('0x36')][_0xd33c('0x68')])[_0xd33c('0x27')](function(){if(_[_0xd33c('0x88')](_0x431703[_0xd33c('0x36')]['ids'])){for(var _0x5d187e=0x0;_0x5d187e<_0x431703[_0xd33c('0x36')][_0xd33c('0x68')]['length'];_0x5d187e+=0x1){socket[_0xd33c('0x70')]('userWhatsappQueue:remove',{'UserId':Number(_0x431703['query'][_0xd33c('0x68')][_0x5d187e]),'WhatsappQueueId':Number(_0x431703[_0xd33c('0x4a')]['id'])});}}else{socket[_0xd33c('0x70')](_0xd33c('0x84'),{'UserId':Number(_0x431703['query'][_0xd33c('0x68')]),'WhatsappQueueId':Number(_0x431703['params']['id'])});}});}})[_0xd33c('0x27')](respondWithStatusCode(_0x188576,null))['catch'](handleError(_0x188576,null));};exports[_0xd33c('0x89')]=function(_0x430b33,_0xf42df,_0x1d27cd){var _0x56a902={};var _0x38b1b7={};var _0xd27bb2;var _0xa64f71;return db['WhatsappQueue'][_0xd33c('0x5b')]({'where':{'id':_0x430b33[_0xd33c('0x4a')]['id']}})[_0xd33c('0x27')](handleEntityNotFound(_0xf42df,null))[_0xd33c('0x27')](function(_0x49c3a6){if(_0x49c3a6){_0xd27bb2=_0x49c3a6;_0x38b1b7['model']=_[_0xd33c('0x34')](db[_0xd33c('0x5d')]['rawAttributes']);_0x38b1b7[_0xd33c('0x36')]=_[_0xd33c('0x34')](_0x430b33['query']);_0x38b1b7[_0xd33c('0x3f')]=_['intersection'](_0x38b1b7[_0xd33c('0x32')],_0x38b1b7[_0xd33c('0x36')]);_0x56a902[_0xd33c('0x37')]=_[_0xd33c('0x35')](_0x38b1b7['model'],qs[_0xd33c('0x38')](_0x430b33['query']['fields']));_0x56a902[_0xd33c('0x37')]=_0x56a902[_0xd33c('0x37')]['length']?_0x56a902['attributes']:_0x38b1b7['model'];_0x56a902[_0xd33c('0x3b')]=qs[_0xd33c('0x3c')](_0x430b33[_0xd33c('0x36')][_0xd33c('0x3c')]);_0x56a902[_0xd33c('0x3d')]=qs[_0xd33c('0x3f')](_['pick'](_0x430b33['query'],_0x38b1b7[_0xd33c('0x3f')]));if(_0x430b33[_0xd33c('0x36')][_0xd33c('0x40')]){_0x56a902[_0xd33c('0x3d')]=_[_0xd33c('0x41')](_0x56a902[_0xd33c('0x3d')],{'$or':_[_0xd33c('0x2d')](_0x56a902[_0xd33c('0x37')],function(_0x217b80){var _0x2760cc={};_0x2760cc[_0x217b80]={'$like':'%'+_0x430b33['query'][_0xd33c('0x40')]+'%'};return _0x2760cc;})});}_0x56a902=_['merge']({},_0x56a902,_0x430b33[_0xd33c('0x4d')]);return _0xd27bb2[_0xd33c('0x89')](_0x56a902);}})[_0xd33c('0x27')](function(_0x327b4d){if(_0x327b4d){_0xa64f71=_0x327b4d[_0xd33c('0x4b')];if(!_0x430b33[_0xd33c('0x36')][_0xd33c('0x39')]('nolimit')){_0x56a902[_0xd33c('0x21')]=qs[_0xd33c('0x21')](_0x430b33[_0xd33c('0x36')][_0xd33c('0x21')]);_0x56a902[_0xd33c('0x20')]=qs[_0xd33c('0x20')](_0x430b33[_0xd33c('0x36')]['offset']);}return _0xd27bb2[_0xd33c('0x89')](_0x56a902);}})[_0xd33c('0x27')](function(_0x5b49a8){if(_0x5b49a8){return _0x5b49a8?{'count':_0xa64f71,'rows':_0x5b49a8}:null;}})[_0xd33c('0x27')](respondWithResult(_0xf42df,null))[_0xd33c('0x48')](handleError(_0xf42df,null));}; \ No newline at end of file +var _0xc8ae=['reject','save','then','destroy','WhatsappQueues','error','stack','send','map','WhatsappQueue','rawAttributes','model','name','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filters','merge','where','type','filter','options','includeAll','include','findAll','rows','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','UserWhatsappQueue','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','get','sequelize','transaction','each','findOrCreate','forEach','userWhatsappQueue:save','field','team_has_whatsapp_queues','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','TeamId','includes','union','compact','value','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','status','end','count','offset','limit','set','Content-Range','json'];(function(_0x2bc09c,_0x4d7f17){var _0x49ae6a=function(_0x2a8baa){while(--_0x2a8baa){_0x2bc09c['push'](_0x2bc09c['shift']());}};_0x49ae6a(++_0x4d7f17);}(_0xc8ae,0x171));var _0xec8a=function(_0x464abe,_0x303fcb){_0x464abe=_0x464abe-0x0;var _0x1d98da=_0xc8ae[_0x464abe];return _0x1d98da;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xec8a('0x0'));var zipdir=require(_0xec8a('0x1'));var jsonpatch=require(_0xec8a('0x2'));var rp=require('request-promise');var moment=require(_0xec8a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xec8a('0x4'));var util=require(_0xec8a('0x5'));var path=require(_0xec8a('0x6'));var sox=require(_0xec8a('0x7'));var csv=require(_0xec8a('0x8'));var ejs=require(_0xec8a('0x9'));var fs=require('fs');var _=require(_0xec8a('0xa'));var squel=require(_0xec8a('0xb'));var crypto=require(_0xec8a('0xc'));var jsforce=require(_0xec8a('0xd'));var deskjs=require(_0xec8a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xec8a('0xf'));var Papa=require('papaparse');var Redis=require(_0xec8a('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xec8a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xec8a('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xec8a('0x13'));var db=require(_0xec8a('0x14'))['db'];config[_0xec8a('0x15')]=_[_0xec8a('0x16')](config[_0xec8a('0x15')],{'host':_0xec8a('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappQueue.socket')[_0xec8a('0x18')](socket);function respondWithStatusCode(_0x1d71a1,_0x4c0f3c){_0x4c0f3c=_0x4c0f3c||0xcc;return function(_0x340964){if(_0x340964){return _0x1d71a1['sendStatus'](_0x4c0f3c);}return _0x1d71a1[_0xec8a('0x19')](_0x4c0f3c)[_0xec8a('0x1a')]();};}function respondWithResult(_0xc2e514,_0x4dceff){_0x4dceff=_0x4dceff||0xc8;return function(_0x465069){if(_0x465069){return _0xc2e514['status'](_0x4dceff)['json'](_0x465069);}};}function respondWithFilteredResult(_0x2471ac,_0x23abf6){return function(_0x80e474){if(_0x80e474){var _0x1e6061=_0x80e474[_0xec8a('0x1b')],_0x2f73f5=_0x23abf6[_0xec8a('0x1c')],_0x362e81=_0x23abf6[_0xec8a('0x1c')]+_0x23abf6[_0xec8a('0x1d')],_0x38f12f;if(_0x362e81>=_0x1e6061){_0x362e81=_0x1e6061;_0x38f12f=0xc8;}else{_0x38f12f=0xce;}_0x2471ac[_0xec8a('0x19')](_0x38f12f);return _0x2471ac[_0xec8a('0x1e')](_0xec8a('0x1f'),_0x2f73f5+'-'+_0x362e81+'/'+_0x1e6061)[_0xec8a('0x20')](_0x80e474);}return null;};}function patchUpdates(_0x36307f){return function(_0x470f23){try{jsonpatch['apply'](_0x470f23,_0x36307f,!![]);}catch(_0x34f92c){return BPromise[_0xec8a('0x21')](_0x34f92c);}return _0x470f23[_0xec8a('0x22')]();};}function saveUpdates(_0x1c74d5,_0x107316){return function(_0x35684b){if(_0x35684b){return _0x35684b['update'](_0x1c74d5)[_0xec8a('0x23')](function(_0x597f92){return _0x597f92;});}return null;};}function removeEntity(_0x1434cc,_0x33fe0){return function(_0x23abfe){if(_0x23abfe){return _0x23abfe[_0xec8a('0x24')]()[_0xec8a('0x23')](function(){var _0x4722b7=_0x23abfe['get']({'plain':!![]});var _0xc240f1=_0xec8a('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0xc240f1,'resourceId':_0x4722b7['id']}})[_0xec8a('0x23')](function(){return _0x23abfe;});})['then'](function(){_0x1434cc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x31b8b6,_0x30b032){return function(_0x5b020e){if(!_0x5b020e){_0x31b8b6['sendStatus'](0x194);}return _0x5b020e;};}function handleError(_0x54799d,_0x73f91c){_0x73f91c=_0x73f91c||0x1f4;return function(_0x21787b){logger[_0xec8a('0x26')](_0x21787b[_0xec8a('0x27')]);if(_0x21787b['name']){delete _0x21787b['name'];}_0x54799d[_0xec8a('0x19')](_0x73f91c)[_0xec8a('0x28')](_0x21787b);};}exports['index']=function(_0x31edf7,_0x37bc4c){var _0x57daea={},_0x5e454e={},_0x58548d={'count':0x0,'rows':[]};var _0x5c5b3a=_[_0xec8a('0x29')](db[_0xec8a('0x2a')][_0xec8a('0x2b')],function(_0x241514){return{'name':_0x241514['fieldName'],'type':_0x241514['type']['key']};});_0x5e454e[_0xec8a('0x2c')]=_[_0xec8a('0x29')](_0x5c5b3a,_0xec8a('0x2d'));_0x5e454e[_0xec8a('0x2e')]=_[_0xec8a('0x2f')](_0x31edf7[_0xec8a('0x2e')]);_0x5e454e['filters']=_[_0xec8a('0x30')](_0x5e454e[_0xec8a('0x2c')],_0x5e454e[_0xec8a('0x2e')]);_0x57daea['attributes']=_[_0xec8a('0x30')](_0x5e454e['model'],qs[_0xec8a('0x31')](_0x31edf7[_0xec8a('0x2e')][_0xec8a('0x31')]));_0x57daea[_0xec8a('0x32')]=_0x57daea['attributes']['length']?_0x57daea['attributes']:_0x5e454e[_0xec8a('0x2c')];if(!_0x31edf7['query'][_0xec8a('0x33')](_0xec8a('0x34'))){_0x57daea[_0xec8a('0x1d')]=qs['limit'](_0x31edf7[_0xec8a('0x2e')][_0xec8a('0x1d')]);_0x57daea['offset']=qs[_0xec8a('0x1c')](_0x31edf7[_0xec8a('0x2e')][_0xec8a('0x1c')]);}_0x57daea[_0xec8a('0x35')]=qs[_0xec8a('0x36')](_0x31edf7[_0xec8a('0x2e')]['sort']);_0x57daea['where']=qs['filters'](_[_0xec8a('0x37')](_0x31edf7[_0xec8a('0x2e')],_0x5e454e[_0xec8a('0x38')]),_0x5c5b3a);if(_0x31edf7['query']['filter']){_0x57daea['where']=_[_0xec8a('0x39')](_0x57daea[_0xec8a('0x3a')],{'$or':_[_0xec8a('0x29')](_0x5c5b3a,function(_0x465a68){if(_0x465a68[_0xec8a('0x3b')]!=='VIRTUAL'){var _0x4f80a3={};_0x4f80a3[_0x465a68[_0xec8a('0x2d')]]={'$like':'%'+_0x31edf7[_0xec8a('0x2e')][_0xec8a('0x3c')]+'%'};return _0x4f80a3;}})});}_0x57daea=_[_0xec8a('0x39')]({},_0x57daea,_0x31edf7[_0xec8a('0x3d')]);var _0x4372f1={'where':_0x57daea[_0xec8a('0x3a')]};return db[_0xec8a('0x2a')][_0xec8a('0x1b')](_0x4372f1)[_0xec8a('0x23')](function(_0x5ef739){_0x58548d[_0xec8a('0x1b')]=_0x5ef739;if(_0x31edf7[_0xec8a('0x2e')][_0xec8a('0x3e')]){_0x57daea[_0xec8a('0x3f')]=[{'all':!![]}];}return db[_0xec8a('0x2a')][_0xec8a('0x40')](_0x57daea);})[_0xec8a('0x23')](function(_0x3fe4e6){_0x58548d[_0xec8a('0x41')]=_0x3fe4e6;return _0x58548d;})[_0xec8a('0x23')](respondWithFilteredResult(_0x37bc4c,_0x57daea))['catch'](handleError(_0x37bc4c,null));};exports[_0xec8a('0x42')]=function(_0x1e1125,_0x466d68){var _0x5a4e17={'raw':!![],'where':{'id':_0x1e1125[_0xec8a('0x43')]['id']}},_0x32cc79={};_0x32cc79['model']=_[_0xec8a('0x2f')](db['WhatsappQueue']['rawAttributes']);_0x32cc79[_0xec8a('0x2e')]=_[_0xec8a('0x2f')](_0x1e1125[_0xec8a('0x2e')]);_0x32cc79[_0xec8a('0x38')]=_['intersection'](_0x32cc79[_0xec8a('0x2c')],_0x32cc79[_0xec8a('0x2e')]);_0x5a4e17[_0xec8a('0x32')]=_['intersection'](_0x32cc79[_0xec8a('0x2c')],qs[_0xec8a('0x31')](_0x1e1125[_0xec8a('0x2e')]['fields']));_0x5a4e17[_0xec8a('0x32')]=_0x5a4e17[_0xec8a('0x32')][_0xec8a('0x44')]?_0x5a4e17['attributes']:_0x32cc79[_0xec8a('0x2c')];if(_0x1e1125[_0xec8a('0x2e')][_0xec8a('0x3e')]){_0x5a4e17[_0xec8a('0x3f')]=[{'all':!![]}];}_0x5a4e17=_[_0xec8a('0x39')]({},_0x5a4e17,_0x1e1125[_0xec8a('0x3d')]);return db['WhatsappQueue'][_0xec8a('0x45')](_0x5a4e17)[_0xec8a('0x23')](handleEntityNotFound(_0x466d68,null))['then'](respondWithResult(_0x466d68,null))['catch'](handleError(_0x466d68,null));};exports['create']=function(_0x1743c1,_0x4913e7){return db[_0xec8a('0x2a')][_0xec8a('0x46')](_0x1743c1['body'],{})[_0xec8a('0x23')](function(_0x325a83){var _0x560f3d=_0x1743c1[_0xec8a('0x47')]['get']({'plain':!![]});if(!_0x560f3d)throw new Error(_0xec8a('0x48'));if(_0x560f3d['role']===_0xec8a('0x47')){var _0x2dfb54=_0x325a83['get']({'plain':!![]});var _0x597cb1='WhatsappQueues';return db[_0xec8a('0x49')][_0xec8a('0x45')]({'where':{'name':_0x597cb1,'userProfileId':_0x560f3d[_0xec8a('0x4a')]},'raw':!![]})[_0xec8a('0x23')](function(_0x43af80){if(_0x43af80&&_0x43af80[_0xec8a('0x4b')]===0x0){return db[_0xec8a('0x4c')][_0xec8a('0x46')]({'name':_0x2dfb54[_0xec8a('0x2d')],'resourceId':_0x2dfb54['id'],'type':_0x43af80[_0xec8a('0x2d')],'sectionId':_0x43af80['id']},{})[_0xec8a('0x23')](function(){return _0x325a83;});}else{return _0x325a83;}})[_0xec8a('0x4d')](function(_0x4c1f52){logger[_0xec8a('0x26')](_0xec8a('0x4e'),_0x4c1f52);throw _0x4c1f52;});}return _0x325a83;})['then'](respondWithResult(_0x4913e7,0xc9))[_0xec8a('0x4d')](handleError(_0x4913e7,null));};exports[_0xec8a('0x4f')]=function(_0xe4a919,_0x2d2609){if(_0xe4a919[_0xec8a('0x50')]['id']){delete _0xe4a919[_0xec8a('0x50')]['id'];}return db['WhatsappQueue'][_0xec8a('0x45')]({'where':{'id':_0xe4a919[_0xec8a('0x43')]['id']}})['then'](handleEntityNotFound(_0x2d2609,null))[_0xec8a('0x23')](saveUpdates(_0xe4a919[_0xec8a('0x50')],null))[_0xec8a('0x23')](respondWithResult(_0x2d2609,null))[_0xec8a('0x4d')](handleError(_0x2d2609,null));};exports['destroy']=function(_0x3a4fdd,_0x51dc42){return db[_0xec8a('0x2a')][_0xec8a('0x45')]({'where':{'id':_0x3a4fdd[_0xec8a('0x43')]['id']}})[_0xec8a('0x23')](handleEntityNotFound(_0x51dc42,null))[_0xec8a('0x23')](removeEntity(_0x51dc42,null))['catch'](handleError(_0x51dc42,null));};exports[_0xec8a('0x51')]=function(_0x489072,_0x1c8dae){return db[_0xec8a('0x2a')][_0xec8a('0x51')]()['then'](respondWithResult(_0x1c8dae,null))[_0xec8a('0x4d')](handleError(_0x1c8dae,null));};exports[_0xec8a('0x52')]=function(_0x28ee4a,_0x464064,_0x1f2c4a){var _0x49f303={'raw':!![],'where':{}},_0x12fb18={},_0x2c7cf3;return db['WhatsappQueue']['findOne']({'where':{'id':_0x28ee4a[_0xec8a('0x43')]['id']}})[_0xec8a('0x23')](handleEntityNotFound(_0x464064,null))[_0xec8a('0x23')](function(_0x27824d){if(_0x27824d){_0x2c7cf3=_0x27824d['get']({'plain':!![]});_0x12fb18[_0xec8a('0x2c')]=_[_0xec8a('0x2f')](db[_0xec8a('0x53')][_0xec8a('0x2b')]);_0x12fb18[_0xec8a('0x2e')]=_[_0xec8a('0x2f')](_0x28ee4a[_0xec8a('0x2e')]);_0x12fb18[_0xec8a('0x38')]=_[_0xec8a('0x30')](_0x12fb18['model'],_0x12fb18[_0xec8a('0x2e')]);_0x49f303[_0xec8a('0x32')]=_['intersection'](_0x12fb18['model'],qs[_0xec8a('0x31')](_0x28ee4a[_0xec8a('0x2e')][_0xec8a('0x31')]));_0x49f303['attributes']=_0x49f303[_0xec8a('0x32')][_0xec8a('0x44')]?_0x49f303[_0xec8a('0x32')]:_0x12fb18['model'];if(!_0x28ee4a[_0xec8a('0x2e')][_0xec8a('0x33')](_0xec8a('0x34'))){_0x49f303['limit']=qs['limit'](_0x28ee4a[_0xec8a('0x2e')][_0xec8a('0x1d')]);_0x49f303[_0xec8a('0x1c')]=qs[_0xec8a('0x1c')](_0x28ee4a['query'][_0xec8a('0x1c')]);}_0x49f303[_0xec8a('0x35')]=qs['sort'](_0x28ee4a[_0xec8a('0x2e')][_0xec8a('0x36')]);_0x49f303['where']=qs[_0xec8a('0x38')](_[_0xec8a('0x37')](_0x28ee4a[_0xec8a('0x2e')],_0x12fb18[_0xec8a('0x38')]));_0x49f303[_0xec8a('0x3a')][_0xec8a('0x54')]=_0x27824d['id'];if(_0x28ee4a[_0xec8a('0x2e')][_0xec8a('0x3c')]){_0x49f303[_0xec8a('0x3a')]=_[_0xec8a('0x39')](_0x49f303[_0xec8a('0x3a')],{'$or':_[_0xec8a('0x29')](_0x49f303[_0xec8a('0x32')],function(_0x1992ac){var _0x1af1f0={};_0x1af1f0[_0x1992ac]={'$like':'%'+_0x28ee4a[_0xec8a('0x2e')]['filter']+'%'};return _0x1af1f0;})});}_0x49f303=_[_0xec8a('0x39')]({},_0x49f303,_0x28ee4a[_0xec8a('0x3d')]);return db[_0xec8a('0x53')]['findAll'](_0x49f303);}})[_0xec8a('0x23')](function(_0x40c6c2){if(_0x40c6c2){return db[_0xec8a('0x55')][_0xec8a('0x56')]({'where':{'id':_[_0xec8a('0x29')](_0x40c6c2,_0xec8a('0x57')),'role':_0xec8a('0x58')},'attributes':['id',_0xec8a('0x2d'),_0xec8a('0x59'),_0xec8a('0x5a'),_0xec8a('0x5b')]});}})['then'](function(_0x1d5173){if(_0x1d5173){return{'count':_0x1d5173[_0xec8a('0x1b')],'rows':_[_0xec8a('0x29')](_0x1d5173[_0xec8a('0x41')],function(_0x5e9d5e){return{'membername':_0x5e9d5e[_0xec8a('0x2d')],'UserId':_0x5e9d5e['id'],'queue_name':_0x2c7cf3['name'],'WhatsappQueueId':_0x2c7cf3['id'],'interface':util[_0xec8a('0x5c')](_0xec8a('0x5d'),_0xec8a('0x5e'),_0x5e9d5e['name']),'penalty':0x0,'paused':_0x5e9d5e[_0xec8a('0x59')],'createdAt':_0x5e9d5e['createdAt'],'updatedAt':_0x5e9d5e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x464064,_0x49f303))[_0xec8a('0x4d')](handleError(_0x464064,null));};exports[_0xec8a('0x5f')]=function(_0x274b29,_0xd78639,_0x422e88){var _0x5759a4={};var _0x2c5796={};var _0x3674ba;var _0x431565;return db[_0xec8a('0x2a')][_0xec8a('0x60')]({'where':{'id':_0x274b29[_0xec8a('0x43')]['id']}})[_0xec8a('0x23')](handleEntityNotFound(_0xd78639,null))[_0xec8a('0x23')](function(_0x318f26){if(_0x318f26){_0x3674ba=_0x318f26;_0x2c5796[_0xec8a('0x2c')]=_[_0xec8a('0x2f')](db[_0xec8a('0x61')]['rawAttributes']);_0x2c5796[_0xec8a('0x2e')]=_['keys'](_0x274b29[_0xec8a('0x2e')]);_0x2c5796[_0xec8a('0x38')]=_[_0xec8a('0x30')](_0x2c5796['model'],_0x2c5796['query']);_0x5759a4[_0xec8a('0x32')]=_[_0xec8a('0x30')](_0x2c5796[_0xec8a('0x2c')],qs[_0xec8a('0x31')](_0x274b29[_0xec8a('0x2e')][_0xec8a('0x31')]));_0x5759a4['attributes']=_0x5759a4[_0xec8a('0x32')]['length']?_0x5759a4['attributes']:_0x2c5796['model'];_0x5759a4['order']=qs['sort'](_0x274b29['query'][_0xec8a('0x36')]);_0x5759a4[_0xec8a('0x3a')]=qs[_0xec8a('0x38')](_[_0xec8a('0x37')](_0x274b29[_0xec8a('0x2e')],_0x2c5796[_0xec8a('0x38')]));if(_0x274b29['query'][_0xec8a('0x3c')]){_0x5759a4['where']=_[_0xec8a('0x39')](_0x5759a4['where'],{'$or':_['map'](_0x5759a4[_0xec8a('0x32')],function(_0x1fcfba){var _0x28cf13={};_0x28cf13[_0x1fcfba]={'$like':'%'+_0x274b29[_0xec8a('0x2e')][_0xec8a('0x3c')]+'%'};return _0x28cf13;})});}_0x5759a4=_['merge']({},_0x5759a4,_0x274b29['options']);return _0x3674ba['getTeams'](_0x5759a4);}})[_0xec8a('0x23')](function(_0x415bac){if(_0x415bac){_0x431565=_0x415bac[_0xec8a('0x44')];if(!_0x274b29[_0xec8a('0x2e')][_0xec8a('0x33')]('nolimit')){_0x5759a4[_0xec8a('0x1d')]=qs[_0xec8a('0x1d')](_0x274b29[_0xec8a('0x2e')]['limit']);_0x5759a4[_0xec8a('0x1c')]=qs['offset'](_0x274b29[_0xec8a('0x2e')][_0xec8a('0x1c')]);}return _0x3674ba[_0xec8a('0x5f')](_0x5759a4);}})[_0xec8a('0x23')](function(_0x17ce98){if(_0x17ce98){return _0x17ce98?{'count':_0x431565,'rows':_0x17ce98}:null;}})['then'](respondWithResult(_0xd78639,null))[_0xec8a('0x4d')](handleError(_0xd78639,null));};exports[_0xec8a('0x62')]=function(_0x55ddba,_0x1f1737,_0x614ff4){var _0x30bac0=_0x55ddba['body'][_0xec8a('0x63')];return db['Team'][_0xec8a('0x40')]({'where':{'id':_0x30bac0},'attributes':['id'],'include':[{'model':db[_0xec8a('0x55')],'as':_0xec8a('0x64'),'attributes':['id','name',_0xec8a('0x65'),_0xec8a('0x66'),_0xec8a('0x67')],'raw':!![]}]})[_0xec8a('0x23')](function(_0x283d9e){if(_0x283d9e){var _0x586051=_[_0xec8a('0x68')](_0x283d9e,function(_0x4fdb6f){var _0x10a8a2=_0x4fdb6f[_0xec8a('0x69')]({'plain':!![]});return _0x10a8a2[_0xec8a('0x64')];});return db[_0xec8a('0x2a')][_0xec8a('0x45')]({'where':{'id':_0x55ddba[_0xec8a('0x43')]['id']}})[_0xec8a('0x23')](function(_0x5047a0){return db[_0xec8a('0x6a')][_0xec8a('0x6b')](function(_0x17c898){return _0x5047a0[_0xec8a('0x62')](_0x30bac0,{'transaction':_0x17c898})[_0xec8a('0x23')](function(){return BPromise[_0xec8a('0x6c')](_0x586051,function(_0x140db0){return db[_0xec8a('0x53')][_0xec8a('0x6d')]({'where':{'UserId':_0x140db0['id'],'WhatsappQueueId':_0x55ddba[_0xec8a('0x43')]['id']},'transaction':_0x17c898});});})[_0xec8a('0x23')](function(){_0x586051[_0xec8a('0x6e')](function(_0x56c4b6){socket['emit'](_0xec8a('0x6f'),{'UserId':_0x56c4b6['id'],'WhatsappQueueId':_0x5047a0['id']});});});});});}})[_0xec8a('0x23')](respondWithStatusCode(_0x1f1737,null))[_0xec8a('0x4d')](handleError(_0x1f1737,null));};exports['removeTeams']=function(_0xe62e9f,_0x2106a5,_0x17216a){return db[_0xec8a('0x61')]['findAll']({'where':{'id':_0xe62e9f[_0xec8a('0x2e')][_0xec8a('0x63')]},'attributes':['id'],'include':[{'model':db[_0xec8a('0x55')],'as':_0xec8a('0x64'),'attributes':['id'],'raw':!![]}]})[_0xec8a('0x23')](handleEntityNotFound(_0x2106a5,null))[_0xec8a('0x23')](function(_0xc59c3a){var _0x465bb6=_[_0xec8a('0x29')](_0xc59c3a,'id');var _0x480b92=[];var _0x4a47c4=[];var _0x4d6f32=squel['select']();_0x4d6f32[_0xec8a('0x70')]('tq.TeamId')['from'](_0xec8a('0x71'),'tq')['join']('user_has_teams','ut',_0xec8a('0x72'))['where'](_0xec8a('0x73'),_0xe62e9f['params']['id']);for(var _0x3793aa=0x0;_0x3793aa<_0xc59c3a[_0xec8a('0x44')];_0x3793aa+=0x1){let _0x534bd7=_0xc59c3a[_0x3793aa];for(var _0x47aa3b=0x0;_0x47aa3b<_0x534bd7[_0xec8a('0x64')][_0xec8a('0x44')];_0x47aa3b+=0x1){let _0x580b1c=_0x534bd7[_0xec8a('0x64')][_0x47aa3b];var _0x25403c=_0x4d6f32[_0xec8a('0x74')]();_0x25403c[_0xec8a('0x3a')](_0xec8a('0x75'),_0x580b1c['id']);_0x4a47c4[_0xec8a('0x76')](db[_0xec8a('0x6a')]['query'](_0x25403c['toString'](),{'type':db[_0xec8a('0x6a')]['QueryTypes'][_0xec8a('0x77')]})['then'](function(_0x125dfa){if(_0x125dfa[_0xec8a('0x44')]===0x1){return _0x580b1c['id'];}else{var _0x18c3f0=_['every'](_[_0xec8a('0x29')](_0x125dfa,_0xec8a('0x78')),function(_0x124ac2){return _[_0xec8a('0x79')](_0x465bb6,_0x124ac2);});if(_0x18c3f0){return _0x580b1c['id'];}}}));}}return BPromise['all'](_0x4a47c4)[_0xec8a('0x23')](function(_0x3ed9b0){_0x480b92=_(_0x480b92)[_0xec8a('0x7a')](_0x3ed9b0)[_0xec8a('0x7b')]()[_0xec8a('0x7c')]();return db[_0xec8a('0x2a')][_0xec8a('0x45')]({'where':{'id':_0xe62e9f[_0xec8a('0x43')]['id']}})[_0xec8a('0x23')](function(_0x453760){return db['sequelize'][_0xec8a('0x6b')](function(_0x45168a){return _0x453760['removeTeams'](_0xe62e9f[_0xec8a('0x2e')][_0xec8a('0x63')],{'transaction':_0x45168a})['then'](function(){if(!_[_0xec8a('0x7d')](_0x480b92)){return _0x453760[_0xec8a('0x7e')](_0x480b92,{'transaction':_0x45168a});}})[_0xec8a('0x23')](function(){_0x480b92[_0xec8a('0x6e')](function(_0x40c7c5){socket[_0xec8a('0x7f')](_0xec8a('0x80'),{'UserId':_0x40c7c5,'WhatsappQueueId':_0x453760['id']});});});});});});})[_0xec8a('0x23')](respondWithStatusCode(_0x2106a5,null))[_0xec8a('0x4d')](handleError(_0x2106a5,null));};exports[_0xec8a('0x81')]=function(_0xbbd23b,_0x41dc9e,_0x412a51){return db[_0xec8a('0x2a')]['find']({'where':{'id':_0xbbd23b[_0xec8a('0x43')]['id']}})[_0xec8a('0x23')](handleEntityNotFound(_0x41dc9e,null))[_0xec8a('0x23')](function(_0xc94b3c){if(_0xc94b3c){return _0xc94b3c[_0xec8a('0x81')](_0xbbd23b[_0xec8a('0x50')]['ids'],_[_0xec8a('0x82')](_0xbbd23b[_0xec8a('0x50')],['ids','id'])||{})[_0xec8a('0x83')](function(_0x7d996){for(var _0x494e64=0x0;_0x494e64<_0xbbd23b[_0xec8a('0x50')][_0xec8a('0x63')][_0xec8a('0x44')];_0x494e64+=0x1){socket['emit'](_0xec8a('0x6f'),{'UserId':_0xbbd23b[_0xec8a('0x50')]['ids'][_0x494e64],'WhatsappQueueId':_0xbbd23b[_0xec8a('0x43')]['id']});}return _0x7d996;});}})[_0xec8a('0x23')](respondWithResult(_0x41dc9e,null))[_0xec8a('0x4d')](handleError(_0x41dc9e,null));};exports[_0xec8a('0x7e')]=function(_0x4201d1,_0x174146,_0x147b9b){return db[_0xec8a('0x2a')][_0xec8a('0x45')]({'where':{'id':_0x4201d1['params']['id']}})[_0xec8a('0x23')](handleEntityNotFound(_0x174146,null))['then'](function(_0x6108ae){if(_0x6108ae){return _0x6108ae[_0xec8a('0x7e')](_0x4201d1[_0xec8a('0x2e')][_0xec8a('0x63')])[_0xec8a('0x23')](function(){if(_[_0xec8a('0x84')](_0x4201d1['query'][_0xec8a('0x63')])){for(var _0x45ab81=0x0;_0x45ab81<_0x4201d1[_0xec8a('0x2e')][_0xec8a('0x63')]['length'];_0x45ab81+=0x1){socket[_0xec8a('0x7f')](_0xec8a('0x80'),{'UserId':Number(_0x4201d1['query'][_0xec8a('0x63')][_0x45ab81]),'WhatsappQueueId':Number(_0x4201d1[_0xec8a('0x43')]['id'])});}}else{socket[_0xec8a('0x7f')](_0xec8a('0x80'),{'UserId':Number(_0x4201d1[_0xec8a('0x2e')][_0xec8a('0x63')]),'WhatsappQueueId':Number(_0x4201d1[_0xec8a('0x43')]['id'])});}});}})['then'](respondWithStatusCode(_0x174146,null))[_0xec8a('0x4d')](handleError(_0x174146,null));};exports[_0xec8a('0x85')]=function(_0x5b1547,_0x31aae0,_0x38084c){var _0x44a3bb={};var _0x1e044f={};var _0x494508;var _0xa60944;return db['WhatsappQueue'][_0xec8a('0x60')]({'where':{'id':_0x5b1547[_0xec8a('0x43')]['id']}})[_0xec8a('0x23')](handleEntityNotFound(_0x31aae0,null))['then'](function(_0x4e3bb1){if(_0x4e3bb1){_0x494508=_0x4e3bb1;_0x1e044f[_0xec8a('0x2c')]=_['keys'](db[_0xec8a('0x55')]['rawAttributes']);_0x1e044f[_0xec8a('0x2e')]=_[_0xec8a('0x2f')](_0x5b1547['query']);_0x1e044f[_0xec8a('0x38')]=_[_0xec8a('0x30')](_0x1e044f[_0xec8a('0x2c')],_0x1e044f[_0xec8a('0x2e')]);_0x44a3bb['attributes']=_[_0xec8a('0x30')](_0x1e044f[_0xec8a('0x2c')],qs[_0xec8a('0x31')](_0x5b1547[_0xec8a('0x2e')][_0xec8a('0x31')]));_0x44a3bb['attributes']=_0x44a3bb[_0xec8a('0x32')][_0xec8a('0x44')]?_0x44a3bb['attributes']:_0x1e044f[_0xec8a('0x2c')];_0x44a3bb['order']=qs[_0xec8a('0x36')](_0x5b1547['query'][_0xec8a('0x36')]);_0x44a3bb[_0xec8a('0x3a')]=qs[_0xec8a('0x38')](_['pick'](_0x5b1547[_0xec8a('0x2e')],_0x1e044f['filters']));if(_0x5b1547[_0xec8a('0x2e')]['filter']){_0x44a3bb[_0xec8a('0x3a')]=_[_0xec8a('0x39')](_0x44a3bb[_0xec8a('0x3a')],{'$or':_['map'](_0x44a3bb['attributes'],function(_0x2fd93b){var _0x24bbcf={};_0x24bbcf[_0x2fd93b]={'$like':'%'+_0x5b1547[_0xec8a('0x2e')]['filter']+'%'};return _0x24bbcf;})});}_0x44a3bb=_[_0xec8a('0x39')]({},_0x44a3bb,_0x5b1547[_0xec8a('0x3d')]);return _0x494508[_0xec8a('0x85')](_0x44a3bb);}})[_0xec8a('0x23')](function(_0xea76b8){if(_0xea76b8){_0xa60944=_0xea76b8['length'];if(!_0x5b1547[_0xec8a('0x2e')][_0xec8a('0x33')](_0xec8a('0x34'))){_0x44a3bb[_0xec8a('0x1d')]=qs[_0xec8a('0x1d')](_0x5b1547['query'][_0xec8a('0x1d')]);_0x44a3bb[_0xec8a('0x1c')]=qs['offset'](_0x5b1547[_0xec8a('0x2e')][_0xec8a('0x1c')]);}return _0x494508[_0xec8a('0x85')](_0x44a3bb);}})[_0xec8a('0x23')](function(_0x5a63fa){if(_0x5a63fa){return _0x5a63fa?{'count':_0xa60944,'rows':_0x5a63fa}:null;}})[_0xec8a('0x23')](respondWithResult(_0x31aae0,null))[_0xec8a('0x4d')](handleError(_0x31aae0,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 60216d6..54675c1 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 _0xadba=['WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0xf7b88a,_0x12c26c){var _0x286494=function(_0x22c311){while(--_0x22c311){_0xf7b88a['push'](_0xf7b88a['shift']());}};_0x286494(++_0x12c26c);}(_0xadba,0xaa));var _0xaadb=function(_0x2dad55,_0x148a03){_0x2dad55=_0x2dad55-0x0;var _0x5de97a=_0xadba[_0x2dad55];return _0x5de97a;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xaadb('0x0'))['db'][_0xaadb('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xaadb('0x2')](0x0);var events={'afterCreate':_0xaadb('0x3'),'afterUpdate':_0xaadb('0x4'),'afterDestroy':_0xaadb('0x5')};function emitEvent(_0x5aeaf9){return function(_0x569c2e,_0x386819,_0x9416ec){WhatsappQueueEvents['emit'](_0x5aeaf9+':'+_0x569c2e['id'],_0x569c2e);WhatsappQueueEvents[_0xaadb('0x6')](_0x5aeaf9,_0x569c2e);_0x9416ec(null);};}for(var e in events){if(events[_0xaadb('0x7')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xaadb('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xc581=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update'];(function(_0x211183,_0x4e505e){var _0x58a951=function(_0x449f3c){while(--_0x449f3c){_0x211183['push'](_0x211183['shift']());}};_0x58a951(++_0x4e505e);}(_0xc581,0x144));var _0x1c58=function(_0x4959d0,_0x21f44b){_0x4959d0=_0x4959d0-0x0;var _0x2a7258=_0xc581[_0x4959d0];return _0x2a7258;};'use strict';var EventEmitter=require(_0x1c58('0x0'));var WhatsappQueue=require(_0x1c58('0x1'))['db'][_0x1c58('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x1c58('0x3')](0x0);var events={'afterCreate':_0x1c58('0x4'),'afterUpdate':_0x1c58('0x5'),'afterDestroy':_0x1c58('0x6')};function emitEvent(_0x3f644e){return function(_0x5103b7,_0x20ab3a,_0xaed90f){WhatsappQueueEvents[_0x1c58('0x7')](_0x3f644e+':'+_0x5103b7['id'],_0x5103b7);WhatsappQueueEvents[_0x1c58('0x7')](_0x3f644e,_0x5103b7);_0xaed90f(null);};}for(var e in events){if(events[_0x1c58('0x8')](e)){var event=events[e];WhatsappQueue[_0x1c58('0x9')](e,emitEvent(event));}}module[_0x1c58('0xa')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index fcbcf01..b67bd77 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 _0x2f99=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappQueue','whatsapp_queues','lodash'];(function(_0x1ab0e6,_0x17ba8d){var _0x248815=function(_0x5d2b40){while(--_0x5d2b40){_0x1ab0e6['push'](_0x1ab0e6['shift']());}};_0x248815(++_0x17ba8d);}(_0x2f99,0xd0));var _0x92f9=function(_0x22327c,_0x555652){_0x22327c=_0x22327c-0x0;var _0x292823=_0x2f99[_0x22327c];return _0x292823;};'use strict';var _=require(_0x92f9('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x92f9('0x1'));var BPromise=require(_0x92f9('0x2'));var rp=require(_0x92f9('0x3'));var fs=require('fs');var path=require(_0x92f9('0x4'));var rimraf=require(_0x92f9('0x5'));var config=require(_0x92f9('0x6'));var attributes=require('./whatsappQueue.attributes');module[_0x92f9('0x7')]=function(_0x5409e5,_0x51f435){return _0x5409e5[_0x92f9('0x8')](_0x92f9('0x9'),attributes,{'tableName':_0x92f9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2797=['moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','util','../../config/logger','api'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x2797,0x99));var _0x7279=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x2797[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require('lodash');var util=require(_0x7279('0x0'));var logger=require(_0x7279('0x1'))(_0x7279('0x2'));var moment=require(_0x7279('0x3'));var BPromise=require(_0x7279('0x4'));var rp=require(_0x7279('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7279('0x6'));var config=require(_0x7279('0x7'));var attributes=require(_0x7279('0x8'));module[_0x7279('0x9')]=function(_0x3e168e,_0xb81bc8){return _0x3e168e[_0x7279('0xa')](_0x7279('0xb'),attributes,{'tableName':_0x7279('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 16f1b93..d9b471e 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 _0xac6e=['lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','raw','options','where','limit','include','map','model','attributes','stringify','find','ShowWhatsappQueue'];(function(_0x1325af,_0x89ed7f){var _0x453639=function(_0xcfc504){while(--_0xcfc504){_0x1325af['push'](_0x1325af['shift']());}};_0x453639(++_0x89ed7f);}(_0xac6e,0x156));var _0xeac6=function(_0x375524,_0x51b2d8){_0x375524=_0x375524-0x0;var _0x4272b2=_0xac6e[_0x375524];return _0x4272b2;};'use strict';var _=require(_0xeac6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xeac6('0x1'));var rs=require(_0xeac6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeac6('0x3'));var logger=require(_0xeac6('0x4'))(_0xeac6('0x5'));var config=require(_0xeac6('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xeac6('0x7')]({'port':0x232a});config[_0xeac6('0x8')]=_[_0xeac6('0x9')](config[_0xeac6('0x8')],{'host':_0xeac6('0xa'),'port':0x18eb});var socket=require(_0xeac6('0xb'))(new Redis(config[_0xeac6('0x8')]));require('./whatsappQueue.socket')[_0xeac6('0xc')](socket);function respondWithRpcPromise(_0xed6123,_0x55e5b1,_0x1e2163){return new BPromise(function(_0x2bd390,_0x369be9){return client[_0xeac6('0xd')](_0xed6123,_0x1e2163)[_0xeac6('0xe')](function(_0x22e205){logger['info'](_0xeac6('0xf'),_0x55e5b1,_0xeac6('0x10'));logger[_0xeac6('0x11')](_0xeac6('0x12'),_0x55e5b1,_0xeac6('0x10'),JSON['stringify'](_0x22e205));if(_0x22e205[_0xeac6('0x13')]){if(_0x22e205[_0xeac6('0x13')][_0xeac6('0x14')]===0x1f4){logger[_0xeac6('0x13')](_0xeac6('0xf'),_0x55e5b1,_0x22e205['error'][_0xeac6('0x15')]);return _0x369be9(_0x22e205['error']['message']);}logger[_0xeac6('0x13')](_0xeac6('0xf'),_0x55e5b1,_0x22e205[_0xeac6('0x13')]['message']);return _0x2bd390(_0x22e205[_0xeac6('0x13')]['message']);}else{logger[_0xeac6('0x16')](_0xeac6('0xf'),_0x55e5b1,_0xeac6('0x10'));_0x2bd390(_0x22e205[_0xeac6('0x17')]['message']);}})[_0xeac6('0x18')](function(_0x3b45dd){logger[_0xeac6('0x13')](_0xeac6('0xf'),_0x55e5b1,_0x3b45dd);_0x369be9(_0x3b45dd);});});}exports[_0xeac6('0x19')]=function(_0x55505e){var _0xd7dd68=this;return new Promise(function(_0x3cf4c5,_0x461bba){return db[_0xeac6('0x1a')]['findAll']({'raw':_0x55505e['options']?_0x55505e['options'][_0xeac6('0x1b')]===undefined?!![]:![]:!![],'where':_0x55505e['options']?_0x55505e[_0xeac6('0x1c')][_0xeac6('0x1d')]||null:null,'attributes':_0x55505e['options']?_0x55505e['options']['attributes']||null:null,'limit':_0x55505e[_0xeac6('0x1c')]?_0x55505e[_0xeac6('0x1c')][_0xeac6('0x1e')]||null:null,'include':_0x55505e[_0xeac6('0x1c')]?_0x55505e[_0xeac6('0x1c')][_0xeac6('0x1f')]?_[_0xeac6('0x20')](_0x55505e[_0xeac6('0x1c')][_0xeac6('0x1f')],function(_0x5afbfa){return{'model':db[_0x5afbfa[_0xeac6('0x21')]],'as':_0x5afbfa['as'],'attributes':_0x5afbfa[_0xeac6('0x22')],'include':_0x5afbfa[_0xeac6('0x1f')]?_[_0xeac6('0x20')](_0x5afbfa[_0xeac6('0x1f')],function(_0x8600ed){return{'model':db[_0x8600ed['model']],'as':_0x8600ed['as'],'attributes':_0x8600ed[_0xeac6('0x22')],'include':_0x8600ed['include']?_[_0xeac6('0x20')](_0x8600ed['include'],function(_0x1cd93e){return{'model':db[_0x1cd93e[_0xeac6('0x21')]],'as':_0x1cd93e['as'],'attributes':_0x1cd93e['attributes']};}):[]};}):[]};}):[]:[]})[_0xeac6('0xe')](function(_0x47a83e){logger[_0xeac6('0x16')]('GetWhatsappQueue',_0x55505e);logger[_0xeac6('0x11')]('GetWhatsappQueue',_0x55505e,JSON[_0xeac6('0x23')](_0x47a83e));_0x3cf4c5(_0x47a83e);})[_0xeac6('0x18')](function(_0x7b05ec){logger['error'](_0xeac6('0x19'),_0x7b05ec['message'],_0x55505e);_0x461bba(_0xd7dd68['error'](0x1f4,_0x7b05ec[_0xeac6('0x15')]));});});};exports['ShowWhatsappQueue']=function(_0x2fa1ea){var _0x4155b0=this;return new Promise(function(_0x314d48,_0x4ca84b){return db[_0xeac6('0x1a')][_0xeac6('0x24')]({'raw':_0x2fa1ea['options']?_0x2fa1ea['options'][_0xeac6('0x1b')]===undefined?!![]:![]:!![],'where':_0x2fa1ea[_0xeac6('0x1c')]?_0x2fa1ea[_0xeac6('0x1c')][_0xeac6('0x1d')]||null:null,'attributes':_0x2fa1ea[_0xeac6('0x1c')]?_0x2fa1ea[_0xeac6('0x1c')][_0xeac6('0x22')]||null:null,'include':_0x2fa1ea['options']?_0x2fa1ea[_0xeac6('0x1c')][_0xeac6('0x1f')]?_[_0xeac6('0x20')](_0x2fa1ea[_0xeac6('0x1c')]['include'],function(_0x1c3cb0){return{'model':db[_0x1c3cb0['model']],'as':_0x1c3cb0['as'],'attributes':_0x1c3cb0['attributes'],'include':_0x1c3cb0[_0xeac6('0x1f')]?_[_0xeac6('0x20')](_0x1c3cb0['include'],function(_0x4515c8){return{'model':db[_0x4515c8[_0xeac6('0x21')]],'as':_0x4515c8['as'],'attributes':_0x4515c8[_0xeac6('0x22')],'include':_0x4515c8['include']?_[_0xeac6('0x20')](_0x4515c8[_0xeac6('0x1f')],function(_0x586a06){return{'model':db[_0x586a06['model']],'as':_0x586a06['as'],'attributes':_0x586a06['attributes']};}):[]};}):[]};}):[]:[]})[_0xeac6('0xe')](function(_0x12db22){logger[_0xeac6('0x16')](_0xeac6('0x25'),_0x2fa1ea);logger[_0xeac6('0x11')](_0xeac6('0x25'),_0x2fa1ea,JSON['stringify'](_0x12db22));_0x314d48(_0x12db22);})[_0xeac6('0x18')](function(_0x490daf){logger['error'](_0xeac6('0x25'),_0x490daf[_0xeac6('0x15')],_0x2fa1ea);_0x4ca84b(_0x4155b0['error'](0x1f4,_0x490daf['message']));});});}; \ No newline at end of file +var _0x0048=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueue','findAll','options','where','limit','include','model','map','attributes','then','GetWhatsappQueue','ShowWhatsappQueue','raw','lodash','moment','randomstring','../../mysqldb'];(function(_0x1820d8,_0x35f8e8){var _0xfee840=function(_0x10991c){while(--_0x10991c){_0x1820d8['push'](_0x1820d8['shift']());}};_0xfee840(++_0x35f8e8);}(_0x0048,0xba));var _0x8004=function(_0x2d8864,_0x34171a){_0x2d8864=_0x2d8864-0x0;var _0x435a6a=_0x0048[_0x2d8864];return _0x435a6a;};'use strict';var _=require(_0x8004('0x0'));var util=require('util');var moment=require(_0x8004('0x1'));var BPromise=require('bluebird');var rs=require(_0x8004('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8004('0x3'))['db'];var utils=require(_0x8004('0x4'));var logger=require(_0x8004('0x5'))('rpc');var config=require(_0x8004('0x6'));var jayson=require(_0x8004('0x7'));var client=jayson[_0x8004('0x8')][_0x8004('0x9')]({'port':0x232a});config[_0x8004('0xa')]=_[_0x8004('0xb')](config['redis'],{'host':_0x8004('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8004('0xa')]));require('./whatsappQueue.socket')['register'](socket);function respondWithRpcPromise(_0x5419bb,_0x43fef9,_0x3ee328){return new BPromise(function(_0x1f612c,_0x3d7ef5){return client[_0x8004('0xd')](_0x5419bb,_0x3ee328)['then'](function(_0x512c97){logger[_0x8004('0xe')](_0x8004('0xf'),_0x43fef9,_0x8004('0x10'));logger[_0x8004('0x11')](_0x8004('0x12'),_0x43fef9,_0x8004('0x10'),JSON[_0x8004('0x13')](_0x512c97));if(_0x512c97[_0x8004('0x14')]){if(_0x512c97[_0x8004('0x14')][_0x8004('0x15')]===0x1f4){logger[_0x8004('0x14')](_0x8004('0xf'),_0x43fef9,_0x512c97[_0x8004('0x14')]['message']);return _0x3d7ef5(_0x512c97[_0x8004('0x14')][_0x8004('0x16')]);}logger['error'](_0x8004('0xf'),_0x43fef9,_0x512c97[_0x8004('0x14')][_0x8004('0x16')]);return _0x1f612c(_0x512c97['error'][_0x8004('0x16')]);}else{logger[_0x8004('0xe')](_0x8004('0xf'),_0x43fef9,_0x8004('0x10'));_0x1f612c(_0x512c97[_0x8004('0x17')][_0x8004('0x16')]);}})[_0x8004('0x18')](function(_0x45d587){logger['error'](_0x8004('0xf'),_0x43fef9,_0x45d587);_0x3d7ef5(_0x45d587);});});}exports['GetWhatsappQueue']=function(_0x5ea5d1){var _0x17bda3=this;return new Promise(function(_0x4e5d84,_0xf3dc9c){return db[_0x8004('0x19')][_0x8004('0x1a')]({'raw':_0x5ea5d1['options']?_0x5ea5d1['options']['raw']===undefined?!![]:![]:!![],'where':_0x5ea5d1[_0x8004('0x1b')]?_0x5ea5d1[_0x8004('0x1b')][_0x8004('0x1c')]||null:null,'attributes':_0x5ea5d1[_0x8004('0x1b')]?_0x5ea5d1[_0x8004('0x1b')]['attributes']||null:null,'limit':_0x5ea5d1[_0x8004('0x1b')]?_0x5ea5d1[_0x8004('0x1b')][_0x8004('0x1d')]||null:null,'include':_0x5ea5d1['options']?_0x5ea5d1[_0x8004('0x1b')][_0x8004('0x1e')]?_['map'](_0x5ea5d1[_0x8004('0x1b')][_0x8004('0x1e')],function(_0xcc5626){return{'model':db[_0xcc5626[_0x8004('0x1f')]],'as':_0xcc5626['as'],'attributes':_0xcc5626['attributes'],'include':_0xcc5626['include']?_[_0x8004('0x20')](_0xcc5626[_0x8004('0x1e')],function(_0x234ea3){return{'model':db[_0x234ea3[_0x8004('0x1f')]],'as':_0x234ea3['as'],'attributes':_0x234ea3[_0x8004('0x21')],'include':_0x234ea3[_0x8004('0x1e')]?_[_0x8004('0x20')](_0x234ea3[_0x8004('0x1e')],function(_0x1da6b9){return{'model':db[_0x1da6b9['model']],'as':_0x1da6b9['as'],'attributes':_0x1da6b9[_0x8004('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8004('0x22')](function(_0x39a183){logger[_0x8004('0xe')](_0x8004('0x23'),_0x5ea5d1);logger['debug'](_0x8004('0x23'),_0x5ea5d1,JSON['stringify'](_0x39a183));_0x4e5d84(_0x39a183);})['catch'](function(_0x599f7c){logger[_0x8004('0x14')]('GetWhatsappQueue',_0x599f7c[_0x8004('0x16')],_0x5ea5d1);_0xf3dc9c(_0x17bda3[_0x8004('0x14')](0x1f4,_0x599f7c[_0x8004('0x16')]));});});};exports[_0x8004('0x24')]=function(_0x25418a){var _0x49e117=this;return new Promise(function(_0x77127c,_0x336caa){return db[_0x8004('0x19')]['find']({'raw':_0x25418a[_0x8004('0x1b')]?_0x25418a['options'][_0x8004('0x25')]===undefined?!![]:![]:!![],'where':_0x25418a[_0x8004('0x1b')]?_0x25418a[_0x8004('0x1b')]['where']||null:null,'attributes':_0x25418a[_0x8004('0x1b')]?_0x25418a['options'][_0x8004('0x21')]||null:null,'include':_0x25418a[_0x8004('0x1b')]?_0x25418a[_0x8004('0x1b')]['include']?_[_0x8004('0x20')](_0x25418a[_0x8004('0x1b')][_0x8004('0x1e')],function(_0x2a7aa6){return{'model':db[_0x2a7aa6[_0x8004('0x1f')]],'as':_0x2a7aa6['as'],'attributes':_0x2a7aa6['attributes'],'include':_0x2a7aa6['include']?_['map'](_0x2a7aa6[_0x8004('0x1e')],function(_0xcd2e08){return{'model':db[_0xcd2e08[_0x8004('0x1f')]],'as':_0xcd2e08['as'],'attributes':_0xcd2e08['attributes'],'include':_0xcd2e08['include']?_['map'](_0xcd2e08['include'],function(_0x3bce93){return{'model':db[_0x3bce93[_0x8004('0x1f')]],'as':_0x3bce93['as'],'attributes':_0x3bce93[_0x8004('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8004('0x22')](function(_0x412047){logger[_0x8004('0xe')]('ShowWhatsappQueue',_0x25418a);logger[_0x8004('0x11')]('ShowWhatsappQueue',_0x25418a,JSON[_0x8004('0x13')](_0x412047));_0x77127c(_0x412047);})[_0x8004('0x18')](function(_0x96303c){logger[_0x8004('0x14')](_0x8004('0x24'),_0x96303c[_0x8004('0x16')],_0x25418a);_0x336caa(_0x49e117[_0x8004('0x14')](0x1f4,_0x96303c[_0x8004('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 386f66e..a50ed8e 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 _0xfb6d=['remove','update','register','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x569d32,_0x5ae90b){var _0x2de6ee=function(_0x122451){while(--_0x122451){_0x569d32['push'](_0x569d32['shift']());}};_0x2de6ee(++_0x5ae90b);}(_0xfb6d,0x124));var _0xdfb6=function(_0x7c2bb7,_0x4acc29){_0x7c2bb7=_0x7c2bb7-0x0;var _0x40040d=_0xfb6d[_0x7c2bb7];return _0x40040d;};'use strict';var WhatsappQueueEvents=require(_0xdfb6('0x0'));var events=[_0xdfb6('0x1'),_0xdfb6('0x2'),_0xdfb6('0x3')];function createListener(_0x22699e,_0x52d38d){return function(_0x1b1d74){_0x52d38d['emit'](_0x22699e,_0x1b1d74);};}function removeListener(_0x38991d,_0x4851ba){return function(){WhatsappQueueEvents['removeListener'](_0x38991d,_0x4851ba);};}exports[_0xdfb6('0x4')]=function(_0x14b3b8){for(var _0x2e916a=0x0,_0x2b4407=events['length'];_0x2e916a<_0x2b4407;_0x2e916a++){var _0x53a4da=events[_0x2e916a];var _0x3721bb=createListener(_0xdfb6('0x5')+_0x53a4da,_0x14b3b8);WhatsappQueueEvents['on'](_0x53a4da,_0x3721bb);}}; \ No newline at end of file +var _0x546c=['register','length','./whatsappQueue.events','save','remove','update','emit','removeListener'];(function(_0x27a45e,_0x556bb4){var _0x1fca64=function(_0x19fa4f){while(--_0x19fa4f){_0x27a45e['push'](_0x27a45e['shift']());}};_0x1fca64(++_0x556bb4);}(_0x546c,0x9a));var _0xc546=function(_0x21973d,_0x111877){_0x21973d=_0x21973d-0x0;var _0x283698=_0x546c[_0x21973d];return _0x283698;};'use strict';var WhatsappQueueEvents=require(_0xc546('0x0'));var events=[_0xc546('0x1'),_0xc546('0x2'),_0xc546('0x3')];function createListener(_0x1c049c,_0x5dbedb){return function(_0x17deea){_0x5dbedb[_0xc546('0x4')](_0x1c049c,_0x17deea);};}function removeListener(_0x255d33,_0x4b5fa9){return function(){WhatsappQueueEvents[_0xc546('0x5')](_0x255d33,_0x4b5fa9);};}exports[_0xc546('0x6')]=function(_0x141f1c){for(var _0x491886=0x0,_0x1c75b4=events[_0xc546('0x7')];_0x491886<_0x1c75b4;_0x491886++){var _0x5c889a=events[_0x491886];var _0xcdb317=createListener('whatsappQueue:'+_0x5c889a,_0x141f1c);WhatsappQueueEvents['on'](_0x5c889a,_0xcdb317);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 1ea7636..ced35f5 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 _0xd880=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id'];(function(_0x1e619d,_0x222b1e){var _0x3a6282=function(_0x12fa49){while(--_0x12fa49){_0x1e619d['push'](_0x1e619d['shift']());}};_0x3a6282(++_0x222b1e);}(_0xd880,0x7e));var _0x0d88=function(_0x35d493,_0x5d7597){_0x35d493=_0x35d493-0x0;var _0x4bd5d4=_0xd880[_0x35d493];return _0x4bd5d4;};'use strict';var multer=require(_0x0d88('0x0'));var util=require(_0x0d88('0x1'));var path=require(_0x0d88('0x2'));var timeout=require(_0x0d88('0x3'));var express=require(_0x0d88('0x4'));var router=express[_0x0d88('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0d88('0x6'));var config=require(_0x0d88('0x7'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x0d88('0x8')](),controller[_0x0d88('0x9')]);router['get'](_0x0d88('0xa'),auth[_0x0d88('0x8')](),controller[_0x0d88('0xb')]);router[_0x0d88('0xc')](_0x0d88('0xd'),auth[_0x0d88('0x8')](),controller['show']);router[_0x0d88('0xe')]('/',auth['isAuthenticated'](),controller[_0x0d88('0xf')]);router[_0x0d88('0x10')](_0x0d88('0xd'),auth[_0x0d88('0x8')](),controller[_0x0d88('0x11')]);router[_0x0d88('0x12')](_0x0d88('0xd'),auth[_0x0d88('0x8')](),controller['destroy']);module[_0x0d88('0x13')]=router; \ No newline at end of file +var _0x734d=['isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','../../config/environment','get','index','/describe'];(function(_0x384231,_0x50be41){var _0x2480bf=function(_0x1c4838){while(--_0x1c4838){_0x384231['push'](_0x384231['shift']());}};_0x2480bf(++_0x50be41);}(_0x734d,0x1d3));var _0xd734=function(_0x257401,_0x2b08b4){_0x257401=_0x257401-0x0;var _0x2b457a=_0x734d[_0x257401];return _0x2b457a;};'use strict';var multer=require('multer');var util=require(_0xd734('0x0'));var path=require(_0xd734('0x1'));var timeout=require(_0xd734('0x2'));var express=require(_0xd734('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd734('0x4'));var controller=require('./whatsappQueueReport.controller');router[_0xd734('0x5')]('/',auth['isAuthenticated'](),controller[_0xd734('0x6')]);router[_0xd734('0x5')](_0xd734('0x7'),auth[_0xd734('0x8')](),controller[_0xd734('0x9')]);router[_0xd734('0x5')]('/:id',auth[_0xd734('0x8')](),controller[_0xd734('0xa')]);router[_0xd734('0xb')]('/',auth[_0xd734('0x8')](),controller[_0xd734('0xc')]);router[_0xd734('0xd')](_0xd734('0xe'),auth[_0xd734('0x8')](),controller[_0xd734('0xf')]);router[_0xd734('0x10')](_0xd734('0xe'),auth[_0xd734('0x8')](),controller[_0xd734('0x11')]);module[_0xd734('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 06619de..36738e2 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['sequelize','exports','STRING','DATE'];(function(_0x3d680f,_0x1bcd97){var _0x5605e1=function(_0x15c8d3){while(--_0x15c8d3){_0x3d680f['push'](_0x3d680f['shift']());}};_0x5605e1(++_0x1bcd97);}(_0x34e8,0x12c));var _0x834e=function(_0x10286d,_0x1f72f7){_0x10286d=_0x10286d-0x0;var _0x111c1e=_0x34e8[_0x10286d];return _0x111c1e;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'uniqueid':{'type':Sequelize[_0x834e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x834e('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x834e('0x3')]},'acceptAt':{'type':Sequelize[_0x834e('0x3')]},'exitAt':{'type':Sequelize[_0x834e('0x3')]},'reason':{'type':Sequelize[_0x834e('0x2')]}}; \ No newline at end of file +var _0x8ef6=['STRING','DATE','sequelize','exports'];(function(_0x453607,_0x14217f){var _0x28eb77=function(_0x5c376d){while(--_0x5c376d){_0x453607['push'](_0x453607['shift']());}};_0x28eb77(++_0x14217f);}(_0x8ef6,0xf2));var _0x68ef=function(_0x54386d,_0x29343f){_0x54386d=_0x54386d-0x0;var _0x41c54d=_0x8ef6[_0x54386d];return _0x41c54d;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'uniqueid':{'type':Sequelize[_0x68ef('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x68ef('0x2')]},'joinAt':{'type':Sequelize[_0x68ef('0x3')]},'leaveAt':{'type':Sequelize[_0x68ef('0x3')]},'acceptAt':{'type':Sequelize[_0x68ef('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x68ef('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 83283da..747be99 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 _0x8a6c=['ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','count','offset','Content-Range','json','apply','save','update','then','destroy','end','error','name','send','index','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','params','create','body','find','describe','html-pdf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x8a6c,0x1a2));var _0xc8a6=function(_0x12315f,_0x4f8d2e){_0x12315f=_0x12315f-0x0;var _0x44eb16=_0x8a6c[_0x12315f];return _0x44eb16;};'use strict';var pdf=require(_0xc8a6('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc8a6('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc8a6('0x2'));var Mustache=require(_0xc8a6('0x3'));var util=require(_0xc8a6('0x4'));var path=require(_0xc8a6('0x5'));var sox=require(_0xc8a6('0x6'));var csv=require(_0xc8a6('0x7'));var ejs=require(_0xc8a6('0x8'));var fs=require('fs');var _=require(_0xc8a6('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc8a6('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xc8a6('0x7'));var querystring=require(_0xc8a6('0xb'));var Papa=require(_0xc8a6('0xc'));var Redis=require(_0xc8a6('0xd'));var authService=require(_0xc8a6('0xe'));var qs=require(_0xc8a6('0xf'));var as=require(_0xc8a6('0x10'));var hardwareService=require(_0xc8a6('0x11'));var logger=require('../../config/logger')(_0xc8a6('0x12'));var utils=require(_0xc8a6('0x13'));var config=require(_0xc8a6('0x14'));var licenseUtil=require(_0xc8a6('0x15'));var db=require(_0xc8a6('0x16'))['db'];function respondWithStatusCode(_0x7de531,_0x2de75c){_0x2de75c=_0x2de75c||0xcc;return function(_0x8769cd){if(_0x8769cd){return _0x7de531['sendStatus'](_0x2de75c);}return _0x7de531[_0xc8a6('0x17')](_0x2de75c)['end']();};}function respondWithResult(_0x528cab,_0x1b79cf){_0x1b79cf=_0x1b79cf||0xc8;return function(_0x510e8e){if(_0x510e8e){return _0x528cab[_0xc8a6('0x17')](_0x1b79cf)['json'](_0x510e8e);}};}function respondWithFilteredResult(_0x402837,_0x21a89b){return function(_0x10a103){if(_0x10a103){var _0x5758e3=_0x10a103[_0xc8a6('0x18')],_0x36975a=_0x21a89b[_0xc8a6('0x19')],_0xcc6d47=_0x21a89b[_0xc8a6('0x19')]+_0x21a89b['limit'],_0x5ad92e;if(_0xcc6d47>=_0x5758e3){_0xcc6d47=_0x5758e3;_0x5ad92e=0xc8;}else{_0x5ad92e=0xce;}_0x402837[_0xc8a6('0x17')](_0x5ad92e);return _0x402837['set'](_0xc8a6('0x1a'),_0x36975a+'-'+_0xcc6d47+'/'+_0x5758e3)[_0xc8a6('0x1b')](_0x10a103);}return null;};}function patchUpdates(_0x35764b){return function(_0x47a10c){try{jsonpatch[_0xc8a6('0x1c')](_0x47a10c,_0x35764b,!![]);}catch(_0x45e7e0){return BPromise['reject'](_0x45e7e0);}return _0x47a10c[_0xc8a6('0x1d')]();};}function saveUpdates(_0x2c7639,_0x25f5c6){return function(_0x18f5ca){if(_0x18f5ca){return _0x18f5ca[_0xc8a6('0x1e')](_0x2c7639)[_0xc8a6('0x1f')](function(_0x418d99){return _0x418d99;});}return null;};}function removeEntity(_0x11352d,_0x2ea53a){return function(_0x30f121){if(_0x30f121){return _0x30f121[_0xc8a6('0x20')]()[_0xc8a6('0x1f')](function(){_0x11352d[_0xc8a6('0x17')](0xcc)[_0xc8a6('0x21')]();});}};}function handleEntityNotFound(_0x283c4a,_0x5f1781){return function(_0x4ba640){if(!_0x4ba640){_0x283c4a['sendStatus'](0x194);}return _0x4ba640;};}function handleError(_0x44eba4,_0x4b4e76){_0x4b4e76=_0x4b4e76||0x1f4;return function(_0x3f3a8e){logger[_0xc8a6('0x22')](_0x3f3a8e['stack']);if(_0x3f3a8e[_0xc8a6('0x23')]){delete _0x3f3a8e['name'];}_0x44eba4[_0xc8a6('0x17')](_0x4b4e76)[_0xc8a6('0x24')](_0x3f3a8e);};}exports[_0xc8a6('0x25')]=function(_0x20dcea,_0x5f37e7){var _0x2a971d={},_0x3c43b1={},_0xd958a={'count':0x0,'rows':[]};var _0x56a3bb=_['map'](db[_0xc8a6('0x26')][_0xc8a6('0x27')],function(_0x4b3867){return{'name':_0x4b3867[_0xc8a6('0x28')],'type':_0x4b3867[_0xc8a6('0x29')][_0xc8a6('0x2a')]};});_0x3c43b1[_0xc8a6('0x2b')]=_[_0xc8a6('0x2c')](_0x56a3bb,_0xc8a6('0x23'));_0x3c43b1['query']=_[_0xc8a6('0x2d')](_0x20dcea[_0xc8a6('0x2e')]);_0x3c43b1[_0xc8a6('0x2f')]=_[_0xc8a6('0x30')](_0x3c43b1[_0xc8a6('0x2b')],_0x3c43b1['query']);_0x2a971d['attributes']=_['intersection'](_0x3c43b1[_0xc8a6('0x2b')],qs[_0xc8a6('0x31')](_0x20dcea[_0xc8a6('0x2e')][_0xc8a6('0x31')]));_0x2a971d['attributes']=_0x2a971d['attributes'][_0xc8a6('0x32')]?_0x2a971d[_0xc8a6('0x33')]:_0x3c43b1[_0xc8a6('0x2b')];if(!_0x20dcea[_0xc8a6('0x2e')][_0xc8a6('0x34')](_0xc8a6('0x35'))){_0x2a971d[_0xc8a6('0x36')]=qs['limit'](_0x20dcea['query'][_0xc8a6('0x36')]);_0x2a971d['offset']=qs[_0xc8a6('0x19')](_0x20dcea[_0xc8a6('0x2e')]['offset']);}_0x2a971d[_0xc8a6('0x37')]=qs[_0xc8a6('0x38')](_0x20dcea[_0xc8a6('0x2e')][_0xc8a6('0x38')]);_0x2a971d[_0xc8a6('0x39')]=qs[_0xc8a6('0x2f')](_[_0xc8a6('0x3a')](_0x20dcea['query'],_0x3c43b1[_0xc8a6('0x2f')]),_0x56a3bb);if(_0x20dcea['query'][_0xc8a6('0x3b')]){_0x2a971d[_0xc8a6('0x39')]=_[_0xc8a6('0x3c')](_0x2a971d[_0xc8a6('0x39')],{'$or':_['map'](_0x56a3bb,function(_0x2a98ab){if(_0x2a98ab['type']!=='VIRTUAL'){var _0x22a2c7={};_0x22a2c7[_0x2a98ab[_0xc8a6('0x23')]]={'$like':'%'+_0x20dcea[_0xc8a6('0x2e')]['filter']+'%'};return _0x22a2c7;}})});}_0x2a971d=_['merge']({},_0x2a971d,_0x20dcea[_0xc8a6('0x3d')]);var _0x139dd0={'where':_0x2a971d['where']};return db['WhatsappQueueReport'][_0xc8a6('0x18')](_0x139dd0)[_0xc8a6('0x1f')](function(_0x1f02e2){_0xd958a[_0xc8a6('0x18')]=_0x1f02e2;if(_0x20dcea[_0xc8a6('0x2e')][_0xc8a6('0x3e')]){_0x2a971d[_0xc8a6('0x3f')]=[{'all':!![]}];}return db[_0xc8a6('0x26')][_0xc8a6('0x40')](_0x2a971d);})['then'](function(_0x5b8b33){_0xd958a['rows']=_0x5b8b33;return _0xd958a;})[_0xc8a6('0x1f')](respondWithFilteredResult(_0x5f37e7,_0x2a971d))[_0xc8a6('0x41')](handleError(_0x5f37e7,null));};exports['show']=function(_0x5c9afc,_0x370df7){var _0x289591={'raw':!![],'where':{'id':_0x5c9afc[_0xc8a6('0x42')]['id']}},_0x3f593a={};_0x3f593a[_0xc8a6('0x2b')]=_['keys'](db[_0xc8a6('0x26')][_0xc8a6('0x27')]);_0x3f593a[_0xc8a6('0x2e')]=_[_0xc8a6('0x2d')](_0x5c9afc[_0xc8a6('0x2e')]);_0x3f593a[_0xc8a6('0x2f')]=_[_0xc8a6('0x30')](_0x3f593a['model'],_0x3f593a[_0xc8a6('0x2e')]);_0x289591[_0xc8a6('0x33')]=_[_0xc8a6('0x30')](_0x3f593a['model'],qs['fields'](_0x5c9afc[_0xc8a6('0x2e')][_0xc8a6('0x31')]));_0x289591[_0xc8a6('0x33')]=_0x289591[_0xc8a6('0x33')]['length']?_0x289591[_0xc8a6('0x33')]:_0x3f593a[_0xc8a6('0x2b')];if(_0x5c9afc[_0xc8a6('0x2e')]['includeAll']){_0x289591[_0xc8a6('0x3f')]=[{'all':!![]}];}_0x289591=_[_0xc8a6('0x3c')]({},_0x289591,_0x5c9afc['options']);return db['WhatsappQueueReport']['find'](_0x289591)['then'](handleEntityNotFound(_0x370df7,null))[_0xc8a6('0x1f')](respondWithResult(_0x370df7,null))[_0xc8a6('0x41')](handleError(_0x370df7,null));};exports[_0xc8a6('0x43')]=function(_0x1ea146,_0x1395ed){return db[_0xc8a6('0x26')][_0xc8a6('0x43')](_0x1ea146[_0xc8a6('0x44')],{})[_0xc8a6('0x1f')](respondWithResult(_0x1395ed,0xc9))[_0xc8a6('0x41')](handleError(_0x1395ed,null));};exports[_0xc8a6('0x1e')]=function(_0x12b3f2,_0x18016f){if(_0x12b3f2[_0xc8a6('0x44')]['id']){delete _0x12b3f2[_0xc8a6('0x44')]['id'];}return db[_0xc8a6('0x26')]['find']({'where':{'id':_0x12b3f2[_0xc8a6('0x42')]['id']}})[_0xc8a6('0x1f')](handleEntityNotFound(_0x18016f,null))[_0xc8a6('0x1f')](saveUpdates(_0x12b3f2[_0xc8a6('0x44')],null))[_0xc8a6('0x1f')](respondWithResult(_0x18016f,null))[_0xc8a6('0x41')](handleError(_0x18016f,null));};exports[_0xc8a6('0x20')]=function(_0x590926,_0x53e8c0){return db[_0xc8a6('0x26')][_0xc8a6('0x45')]({'where':{'id':_0x590926['params']['id']}})[_0xc8a6('0x1f')](handleEntityNotFound(_0x53e8c0,null))[_0xc8a6('0x1f')](removeEntity(_0x53e8c0,null))['catch'](handleError(_0x53e8c0,null));};exports[_0xc8a6('0x46')]=function(_0x4e55b0,_0x591f74){return db[_0xc8a6('0x26')][_0xc8a6('0x46')]()[_0xc8a6('0x1f')](respondWithResult(_0x591f74,null))[_0xc8a6('0x41')](handleError(_0x591f74,null));}; \ No newline at end of file +var _0x576e=['fieldName','type','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','options','WhatsappQueueReport','includeAll','findAll','rows','catch','params','rawAttributes','length','include','create','body','update','find','destroy','describe','eml-format','rimraf','request-promise','moment','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','set','Content-Range','apply','reject','then','end','sendStatus','error','stack','name','send','index','map'];(function(_0x23e6bb,_0x5c2d69){var _0x1e3b4c=function(_0x1afc46){while(--_0x1afc46){_0x23e6bb['push'](_0x23e6bb['shift']());}};_0x1e3b4c(++_0x5c2d69);}(_0x576e,0xb1));var _0xe576=function(_0x547456,_0x1de17e){_0x547456=_0x547456-0x0;var _0xc1fd7b=_0x576e[_0x547456];return _0xc1fd7b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe576('0x0'));var rimraf=require(_0xe576('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe576('0x2'));var moment=require(_0xe576('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe576('0x4'));var path=require(_0xe576('0x5'));var sox=require('sox');var csv=require(_0xe576('0x6'));var ejs=require(_0xe576('0x7'));var fs=require('fs');var _=require(_0xe576('0x8'));var squel=require(_0xe576('0x9'));var crypto=require('crypto');var jsforce=require(_0xe576('0xa'));var deskjs=require(_0xe576('0xb'));var toCsv=require('to-csv');var querystring=require(_0xe576('0xc'));var Papa=require('papaparse');var Redis=require(_0xe576('0xd'));var authService=require(_0xe576('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xe576('0xf'));var hardwareService=require(_0xe576('0x10'));var logger=require(_0xe576('0x11'))('api');var utils=require(_0xe576('0x12'));var config=require(_0xe576('0x13'));var licenseUtil=require(_0xe576('0x14'));var db=require(_0xe576('0x15'))['db'];function respondWithStatusCode(_0x33eaef,_0x3c3466){_0x3c3466=_0x3c3466||0xcc;return function(_0x309228){if(_0x309228){return _0x33eaef['sendStatus'](_0x3c3466);}return _0x33eaef[_0xe576('0x16')](_0x3c3466)['end']();};}function respondWithResult(_0x32fb43,_0x4cdcad){_0x4cdcad=_0x4cdcad||0xc8;return function(_0x456fbf){if(_0x456fbf){return _0x32fb43[_0xe576('0x16')](_0x4cdcad)[_0xe576('0x17')](_0x456fbf);}};}function respondWithFilteredResult(_0x40fd88,_0x8fc5bf){return function(_0x141ec6){if(_0x141ec6){var _0xe9f3dd=_0x141ec6[_0xe576('0x18')],_0x95469c=_0x8fc5bf[_0xe576('0x19')],_0x4d62ba=_0x8fc5bf['offset']+_0x8fc5bf['limit'],_0x2034b9;if(_0x4d62ba>=_0xe9f3dd){_0x4d62ba=_0xe9f3dd;_0x2034b9=0xc8;}else{_0x2034b9=0xce;}_0x40fd88['status'](_0x2034b9);return _0x40fd88[_0xe576('0x1a')](_0xe576('0x1b'),_0x95469c+'-'+_0x4d62ba+'/'+_0xe9f3dd)[_0xe576('0x17')](_0x141ec6);}return null;};}function patchUpdates(_0x58b6b5){return function(_0x121085){try{jsonpatch[_0xe576('0x1c')](_0x121085,_0x58b6b5,!![]);}catch(_0x55fa07){return BPromise[_0xe576('0x1d')](_0x55fa07);}return _0x121085['save']();};}function saveUpdates(_0x41fd6e,_0xa2b7cb){return function(_0x7bc4d0){if(_0x7bc4d0){return _0x7bc4d0['update'](_0x41fd6e)[_0xe576('0x1e')](function(_0x314cb1){return _0x314cb1;});}return null;};}function removeEntity(_0x25a353,_0x5c6728){return function(_0x4ed0b9){if(_0x4ed0b9){return _0x4ed0b9['destroy']()[_0xe576('0x1e')](function(){_0x25a353['status'](0xcc)[_0xe576('0x1f')]();});}};}function handleEntityNotFound(_0x33d5b6,_0x5d6b6c){return function(_0x161cf1){if(!_0x161cf1){_0x33d5b6[_0xe576('0x20')](0x194);}return _0x161cf1;};}function handleError(_0x33d45e,_0x42cdfe){_0x42cdfe=_0x42cdfe||0x1f4;return function(_0x5b4738){logger[_0xe576('0x21')](_0x5b4738[_0xe576('0x22')]);if(_0x5b4738[_0xe576('0x23')]){delete _0x5b4738[_0xe576('0x23')];}_0x33d45e['status'](_0x42cdfe)[_0xe576('0x24')](_0x5b4738);};}exports[_0xe576('0x25')]=function(_0x3a75e1,_0x1486a1){var _0x31f86e={},_0x311a2b={},_0x5f205c={'count':0x0,'rows':[]};var _0x190fbc=_[_0xe576('0x26')](db['WhatsappQueueReport']['rawAttributes'],function(_0x566628){return{'name':_0x566628[_0xe576('0x27')],'type':_0x566628[_0xe576('0x28')]['key']};});_0x311a2b['model']=_['map'](_0x190fbc,'name');_0x311a2b['query']=_[_0xe576('0x29')](_0x3a75e1[_0xe576('0x2a')]);_0x311a2b[_0xe576('0x2b')]=_[_0xe576('0x2c')](_0x311a2b[_0xe576('0x2d')],_0x311a2b[_0xe576('0x2a')]);_0x31f86e[_0xe576('0x2e')]=_['intersection'](_0x311a2b[_0xe576('0x2d')],qs[_0xe576('0x2f')](_0x3a75e1['query']['fields']));_0x31f86e['attributes']=_0x31f86e[_0xe576('0x2e')]['length']?_0x31f86e[_0xe576('0x2e')]:_0x311a2b[_0xe576('0x2d')];if(!_0x3a75e1[_0xe576('0x2a')][_0xe576('0x30')](_0xe576('0x31'))){_0x31f86e[_0xe576('0x32')]=qs[_0xe576('0x32')](_0x3a75e1[_0xe576('0x2a')][_0xe576('0x32')]);_0x31f86e[_0xe576('0x19')]=qs[_0xe576('0x19')](_0x3a75e1[_0xe576('0x2a')]['offset']);}_0x31f86e[_0xe576('0x33')]=qs[_0xe576('0x34')](_0x3a75e1[_0xe576('0x2a')][_0xe576('0x34')]);_0x31f86e[_0xe576('0x35')]=qs[_0xe576('0x2b')](_[_0xe576('0x36')](_0x3a75e1[_0xe576('0x2a')],_0x311a2b[_0xe576('0x2b')]),_0x190fbc);if(_0x3a75e1[_0xe576('0x2a')]['filter']){_0x31f86e[_0xe576('0x35')]=_['merge'](_0x31f86e[_0xe576('0x35')],{'$or':_[_0xe576('0x26')](_0x190fbc,function(_0x4acb0e){if(_0x4acb0e['type']!=='VIRTUAL'){var _0x151c0f={};_0x151c0f[_0x4acb0e[_0xe576('0x23')]]={'$like':'%'+_0x3a75e1['query']['filter']+'%'};return _0x151c0f;}})});}_0x31f86e=_[_0xe576('0x37')]({},_0x31f86e,_0x3a75e1[_0xe576('0x38')]);var _0x11bc6e={'where':_0x31f86e['where']};return db[_0xe576('0x39')][_0xe576('0x18')](_0x11bc6e)[_0xe576('0x1e')](function(_0x509196){_0x5f205c[_0xe576('0x18')]=_0x509196;if(_0x3a75e1[_0xe576('0x2a')][_0xe576('0x3a')]){_0x31f86e['include']=[{'all':!![]}];}return db['WhatsappQueueReport'][_0xe576('0x3b')](_0x31f86e);})['then'](function(_0x428e18){_0x5f205c[_0xe576('0x3c')]=_0x428e18;return _0x5f205c;})[_0xe576('0x1e')](respondWithFilteredResult(_0x1486a1,_0x31f86e))[_0xe576('0x3d')](handleError(_0x1486a1,null));};exports['show']=function(_0xd1f432,_0xbaf1f2){var _0x2f183d={'raw':!![],'where':{'id':_0xd1f432[_0xe576('0x3e')]['id']}},_0x16ad42={};_0x16ad42[_0xe576('0x2d')]=_[_0xe576('0x29')](db['WhatsappQueueReport'][_0xe576('0x3f')]);_0x16ad42[_0xe576('0x2a')]=_[_0xe576('0x29')](_0xd1f432[_0xe576('0x2a')]);_0x16ad42[_0xe576('0x2b')]=_['intersection'](_0x16ad42[_0xe576('0x2d')],_0x16ad42[_0xe576('0x2a')]);_0x2f183d['attributes']=_[_0xe576('0x2c')](_0x16ad42[_0xe576('0x2d')],qs[_0xe576('0x2f')](_0xd1f432[_0xe576('0x2a')]['fields']));_0x2f183d['attributes']=_0x2f183d[_0xe576('0x2e')][_0xe576('0x40')]?_0x2f183d[_0xe576('0x2e')]:_0x16ad42[_0xe576('0x2d')];if(_0xd1f432['query'][_0xe576('0x3a')]){_0x2f183d[_0xe576('0x41')]=[{'all':!![]}];}_0x2f183d=_[_0xe576('0x37')]({},_0x2f183d,_0xd1f432[_0xe576('0x38')]);return db[_0xe576('0x39')]['find'](_0x2f183d)[_0xe576('0x1e')](handleEntityNotFound(_0xbaf1f2,null))[_0xe576('0x1e')](respondWithResult(_0xbaf1f2,null))[_0xe576('0x3d')](handleError(_0xbaf1f2,null));};exports[_0xe576('0x42')]=function(_0x360f0,_0x3b6c10){return db[_0xe576('0x39')][_0xe576('0x42')](_0x360f0[_0xe576('0x43')],{})[_0xe576('0x1e')](respondWithResult(_0x3b6c10,0xc9))['catch'](handleError(_0x3b6c10,null));};exports[_0xe576('0x44')]=function(_0xe9f5e1,_0x594f92){if(_0xe9f5e1[_0xe576('0x43')]['id']){delete _0xe9f5e1['body']['id'];}return db['WhatsappQueueReport'][_0xe576('0x45')]({'where':{'id':_0xe9f5e1[_0xe576('0x3e')]['id']}})[_0xe576('0x1e')](handleEntityNotFound(_0x594f92,null))['then'](saveUpdates(_0xe9f5e1[_0xe576('0x43')],null))[_0xe576('0x1e')](respondWithResult(_0x594f92,null))['catch'](handleError(_0x594f92,null));};exports[_0xe576('0x46')]=function(_0x2fb233,_0x353279){return db[_0xe576('0x39')][_0xe576('0x45')]({'where':{'id':_0x2fb233[_0xe576('0x3e')]['id']}})[_0xe576('0x1e')](handleEntityNotFound(_0x353279,null))[_0xe576('0x1e')](removeEntity(_0x353279,null))[_0xe576('0x3d')](handleError(_0x353279,null));};exports[_0xe576('0x47')]=function(_0x1f5191,_0x5eee00){return db[_0xe576('0x39')][_0xe576('0x47')]()[_0xe576('0x1e')](respondWithResult(_0x5eee00,null))['catch'](handleError(_0x5eee00,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 61355a0..6a33c35 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 _0xd6b2=['report_whatsapp_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport'];(function(_0x1047e9,_0x37948e){var _0x15f50e=function(_0x455edb){while(--_0x455edb){_0x1047e9['push'](_0x1047e9['shift']());}};_0x15f50e(++_0x37948e);}(_0xd6b2,0xec));var _0x2d6b=function(_0x4a2e27,_0x6ecce){_0x4a2e27=_0x4a2e27-0x0;var _0xeec515=_0xd6b2[_0x4a2e27];return _0xeec515;};'use strict';var _=require('lodash');var util=require(_0x2d6b('0x0'));var logger=require(_0x2d6b('0x1'))(_0x2d6b('0x2'));var moment=require(_0x2d6b('0x3'));var BPromise=require(_0x2d6b('0x4'));var rp=require(_0x2d6b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2d6b('0x6'));var attributes=require(_0x2d6b('0x7'));module[_0x2d6b('0x8')]=function(_0xdd238f,_0x56a5ee){return _0xdd238f[_0x2d6b('0x9')](_0x2d6b('0xa'),attributes,{'tableName':_0x2d6b('0xb'),'paranoid':![],'indexes':[{'name':_0x2d6b('0xc'),'fields':[_0x2d6b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4b2c=['request-promise','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x218ba6,_0x19ffc1){var _0x1cc057=function(_0xd17b02){while(--_0xd17b02){_0x218ba6['push'](_0x218ba6['shift']());}};_0x1cc057(++_0x19ffc1);}(_0x4b2c,0x95));var _0xc4b2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b2c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc4b2('0x0'));var util=require(_0xc4b2('0x1'));var logger=require(_0xc4b2('0x2'))('api');var moment=require(_0xc4b2('0x3'));var BPromise=require(_0xc4b2('0x4'));var rp=require(_0xc4b2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc4b2('0x6'));var config=require(_0xc4b2('0x7'));var attributes=require(_0xc4b2('0x8'));module[_0xc4b2('0x9')]=function(_0xb6e9a3,_0x1cf643){return _0xb6e9a3[_0xc4b2('0xa')](_0xc4b2('0xb'),attributes,{'tableName':_0xc4b2('0xc'),'paranoid':![],'indexes':[{'name':_0xc4b2('0xd'),'fields':[_0xc4b2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 21bd9f9..1802097 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 _0xc502=['stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update','where','attributes','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','debug'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xc502,0x10a));var _0x2c50=function(_0x5ad4be,_0x357097){_0x5ad4be=_0x5ad4be-0x0;var _0x156465=_0xc502[_0x5ad4be];return _0x156465;};'use strict';var _=require(_0x2c50('0x0'));var util=require(_0x2c50('0x1'));var moment=require(_0x2c50('0x2'));var BPromise=require('bluebird');var rs=require(_0x2c50('0x3'));var fs=require('fs');var Redis=require(_0x2c50('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2c50('0x5'));var logger=require(_0x2c50('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2c50('0x7'));var client=jayson['client'][_0x2c50('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ed679,_0x5bb83e,_0x1d692a){return new BPromise(function(_0x52c51d,_0x5a9123){return client[_0x2c50('0x9')](_0x3ed679,_0x1d692a)[_0x2c50('0xa')](function(_0x37fccd){logger[_0x2c50('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5bb83e,'request\x20sent');logger[_0x2c50('0xc')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x5bb83e,'request\x20sent',JSON[_0x2c50('0xd')](_0x37fccd));if(_0x37fccd[_0x2c50('0xe')]){if(_0x37fccd['error'][_0x2c50('0xf')]===0x1f4){logger[_0x2c50('0xe')](_0x2c50('0x10'),_0x5bb83e,_0x37fccd[_0x2c50('0xe')][_0x2c50('0x11')]);return _0x5a9123(_0x37fccd[_0x2c50('0xe')]['message']);}logger['error'](_0x2c50('0x10'),_0x5bb83e,_0x37fccd['error'][_0x2c50('0x11')]);return _0x52c51d(_0x37fccd[_0x2c50('0xe')][_0x2c50('0x11')]);}else{logger['info'](_0x2c50('0x10'),_0x5bb83e,_0x2c50('0x12'));_0x52c51d(_0x37fccd[_0x2c50('0x13')][_0x2c50('0x11')]);}})[_0x2c50('0x14')](function(_0xcea716){logger['error'](_0x2c50('0x10'),_0x5bb83e,_0xcea716);_0x5a9123(_0xcea716);});});}exports[_0x2c50('0x15')]=function(_0x1b8e2c){var _0x4c62cc=this;return new Promise(function(_0xdec8d0,_0x1f769e){return db[_0x2c50('0x16')][_0x2c50('0x17')](_0x1b8e2c[_0x2c50('0x18')],{'raw':_0x1b8e2c[_0x2c50('0x19')]?_0x1b8e2c[_0x2c50('0x19')][_0x2c50('0x1a')]===undefined?!![]:![]:!![]})[_0x2c50('0xa')](function(_0x407f84){logger[_0x2c50('0xb')](_0x2c50('0x15'),_0x1b8e2c);logger[_0x2c50('0xc')](_0x2c50('0x15'),_0x1b8e2c,JSON[_0x2c50('0xd')](_0x407f84));_0xdec8d0(_0x407f84);})[_0x2c50('0x14')](function(_0x17373d){logger[_0x2c50('0xe')](_0x2c50('0x15'),_0x17373d[_0x2c50('0x11')],_0x1b8e2c);_0x1f769e(_0x4c62cc['error'](0x1f4,_0x17373d[_0x2c50('0x11')]));});});};exports[_0x2c50('0x1b')]=function(_0x5ab6b4){var _0x543437=this;return new Promise(function(_0x11efd3,_0x4e72dd){return db[_0x2c50('0x16')][_0x2c50('0x1c')](_0x5ab6b4[_0x2c50('0x18')],{'raw':_0x5ab6b4[_0x2c50('0x19')]?_0x5ab6b4[_0x2c50('0x19')][_0x2c50('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ab6b4[_0x2c50('0x19')]?_0x5ab6b4[_0x2c50('0x19')][_0x2c50('0x1d')]||null:null,'attributes':_0x5ab6b4[_0x2c50('0x19')]?_0x5ab6b4[_0x2c50('0x19')][_0x2c50('0x1e')]||null:null,'limit':_0x5ab6b4['options']?_0x5ab6b4[_0x2c50('0x19')]['limit']||null:null})[_0x2c50('0xa')](function(_0xb0492a){logger[_0x2c50('0xb')](_0x2c50('0x1b'),_0x5ab6b4);logger[_0x2c50('0xc')](_0x2c50('0x1b'),_0x5ab6b4,JSON[_0x2c50('0xd')](_0xb0492a));_0x11efd3(_0xb0492a);})['catch'](function(_0x595196){logger[_0x2c50('0xe')](_0x2c50('0x1b'),_0x595196[_0x2c50('0x11')],_0x5ab6b4);_0x4e72dd(_0x543437[_0x2c50('0xe')](0x1f4,_0x595196[_0x2c50('0x11')]));});});}; \ No newline at end of file +var _0xce94=['jayson/promise','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','update','body','where','limit','UpdateWhatsappQueueReport','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x2de020,_0x252df0){var _0x182b7c=function(_0xcbcdaa){while(--_0xcbcdaa){_0x2de020['push'](_0x2de020['shift']());}};_0x182b7c(++_0x252df0);}(_0xce94,0xf8));var _0x4ce9=function(_0x3e1fd8,_0x24f5d3){_0x3e1fd8=_0x3e1fd8-0x0;var _0x2ce64e=_0xce94[_0x3e1fd8];return _0x2ce64e;};'use strict';var _=require(_0x4ce9('0x0'));var util=require('util');var moment=require(_0x4ce9('0x1'));var BPromise=require(_0x4ce9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ce9('0x3'));var db=require(_0x4ce9('0x4'))['db'];var utils=require(_0x4ce9('0x5'));var logger=require('../../config/logger')(_0x4ce9('0x6'));var config=require(_0x4ce9('0x7'));var jayson=require(_0x4ce9('0x8'));var client=jayson['client'][_0x4ce9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e00f0,_0x5ad0db,_0x5d6827){return new BPromise(function(_0xa0fd37,_0x376a6b){return client['request'](_0x3e00f0,_0x5d6827)[_0x4ce9('0xa')](function(_0x44ddfe){logger[_0x4ce9('0xb')](_0x4ce9('0xc'),_0x5ad0db,_0x4ce9('0xd'));logger[_0x4ce9('0xe')](_0x4ce9('0xf'),_0x5ad0db,_0x4ce9('0xd'),JSON[_0x4ce9('0x10')](_0x44ddfe));if(_0x44ddfe[_0x4ce9('0x11')]){if(_0x44ddfe[_0x4ce9('0x11')][_0x4ce9('0x12')]===0x1f4){logger[_0x4ce9('0x11')](_0x4ce9('0xc'),_0x5ad0db,_0x44ddfe[_0x4ce9('0x11')]['message']);return _0x376a6b(_0x44ddfe[_0x4ce9('0x11')][_0x4ce9('0x13')]);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x5ad0db,_0x44ddfe['error']['message']);return _0xa0fd37(_0x44ddfe[_0x4ce9('0x11')][_0x4ce9('0x13')]);}else{logger[_0x4ce9('0xb')](_0x4ce9('0xc'),_0x5ad0db,_0x4ce9('0xd'));_0xa0fd37(_0x44ddfe[_0x4ce9('0x14')][_0x4ce9('0x13')]);}})[_0x4ce9('0x15')](function(_0x28b87a){logger['error'](_0x4ce9('0xc'),_0x5ad0db,_0x28b87a);_0x376a6b(_0x28b87a);});});}exports[_0x4ce9('0x16')]=function(_0xd6d1d1){var _0x27f2c9=this;return new Promise(function(_0x302bb3,_0xeae13f){return db[_0x4ce9('0x17')][_0x4ce9('0x18')](_0xd6d1d1['body'],{'raw':_0xd6d1d1['options']?_0xd6d1d1[_0x4ce9('0x19')][_0x4ce9('0x1a')]===undefined?!![]:![]:!![]})[_0x4ce9('0xa')](function(_0x27ebb7){logger[_0x4ce9('0xb')](_0x4ce9('0x16'),_0xd6d1d1);logger[_0x4ce9('0xe')](_0x4ce9('0x16'),_0xd6d1d1,JSON[_0x4ce9('0x10')](_0x27ebb7));_0x302bb3(_0x27ebb7);})[_0x4ce9('0x15')](function(_0x49631c){logger[_0x4ce9('0x11')](_0x4ce9('0x16'),_0x49631c[_0x4ce9('0x13')],_0xd6d1d1);_0xeae13f(_0x27f2c9[_0x4ce9('0x11')](0x1f4,_0x49631c[_0x4ce9('0x13')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x4817c3){var _0x4409d0=this;return new Promise(function(_0x4dcff5,_0x1520e8){return db[_0x4ce9('0x17')][_0x4ce9('0x1b')](_0x4817c3[_0x4ce9('0x1c')],{'raw':_0x4817c3[_0x4ce9('0x19')]?_0x4817c3[_0x4ce9('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4817c3[_0x4ce9('0x19')]?_0x4817c3[_0x4ce9('0x19')][_0x4ce9('0x1d')]||null:null,'attributes':_0x4817c3[_0x4ce9('0x19')]?_0x4817c3[_0x4ce9('0x19')]['attributes']||null:null,'limit':_0x4817c3[_0x4ce9('0x19')]?_0x4817c3['options'][_0x4ce9('0x1e')]||null:null})['then'](function(_0x181b1a){logger[_0x4ce9('0xb')](_0x4ce9('0x1f'),_0x4817c3);logger[_0x4ce9('0xe')](_0x4ce9('0x1f'),_0x4817c3,JSON[_0x4ce9('0x10')](_0x181b1a));_0x4dcff5(_0x181b1a);})[_0x4ce9('0x15')](function(_0xd59203){logger['error'](_0x4ce9('0x1f'),_0xd59203[_0x4ce9('0x13')],_0x4817c3);_0x1520e8(_0x4409d0['error'](0x1f4,_0xd59203[_0x4ce9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index c9b3fc6..33a4787 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 _0x23fa=['isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','index','describe','/:id'];(function(_0x39fbca,_0x16903a){var _0x295e34=function(_0x42dd79){while(--_0x42dd79){_0x39fbca['push'](_0x39fbca['shift']());}};_0x295e34(++_0x16903a);}(_0x23fa,0x183));var _0xa23f=function(_0x1f81ce,_0x37f3f2){_0x1f81ce=_0x1f81ce-0x0;var _0x2d1f73=_0x23fa[_0x1f81ce];return _0x2d1f73;};'use strict';var multer=require(_0xa23f('0x0'));var util=require(_0xa23f('0x1'));var path=require('path');var timeout=require(_0xa23f('0x2'));var express=require(_0xa23f('0x3'));var router=express[_0xa23f('0x4')]();var auth=require(_0xa23f('0x5'));var interaction=require(_0xa23f('0x6'));var config=require('../../config/environment');var controller=require(_0xa23f('0x7'));router[_0xa23f('0x8')]('/',auth['isAuthenticated'](),controller[_0xa23f('0x9')]);router[_0xa23f('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xa23f('0xa')]);router[_0xa23f('0x8')](_0xa23f('0xb'),auth[_0xa23f('0xc')](),controller[_0xa23f('0xd')]);router[_0xa23f('0xe')]('/',auth['isAuthenticated'](),controller[_0xa23f('0xf')]);router[_0xa23f('0x10')](_0xa23f('0xb'),auth[_0xa23f('0xc')](),controller[_0xa23f('0x11')]);router[_0xa23f('0x12')]('/:id',auth[_0xa23f('0xc')](),controller[_0xa23f('0x13')]);module[_0xa23f('0x14')]=router; \ No newline at end of file +var _0x6ca3=['index','get','/describe','/:id','post','create','put','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../config/environment','isAuthenticated'];(function(_0x1071ea,_0x590a76){var _0x4f6ffa=function(_0x315a6a){while(--_0x315a6a){_0x1071ea['push'](_0x1071ea['shift']());}};_0x4f6ffa(++_0x590a76);}(_0x6ca3,0xba));var _0x36ca=function(_0x1ec9d1,_0x35ecaf){_0x1ec9d1=_0x1ec9d1-0x0;var _0x4b6bc2=_0x6ca3[_0x1ec9d1];return _0x4b6bc2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x36ca('0x0'));var timeout=require(_0x36ca('0x1'));var express=require('express');var router=express[_0x36ca('0x2')]();var auth=require(_0x36ca('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x36ca('0x4'));var controller=require('./whatsappTransferReport.controller');router['get']('/',auth[_0x36ca('0x5')](),controller[_0x36ca('0x6')]);router[_0x36ca('0x7')](_0x36ca('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x36ca('0x7')](_0x36ca('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x36ca('0xa')]('/',auth[_0x36ca('0x5')](),controller[_0x36ca('0xb')]);router[_0x36ca('0xc')]('/:id',auth[_0x36ca('0x5')](),controller['update']);router[_0x36ca('0xd')](_0x36ca('0x9'),auth[_0x36ca('0x5')](),controller[_0x36ca('0xe')]);module[_0x36ca('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 2dc0375..eaa1fbd 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 _0x5f2f=['agent','queue','DATE','sequelize','exports','STRING','ENUM','account'];(function(_0x1bfc2d,_0x181462){var _0x501195=function(_0x184937){while(--_0x184937){_0x1bfc2d['push'](_0x1bfc2d['shift']());}};_0x501195(++_0x181462);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1e0065,_0x2ebf65){_0x1e0065=_0x1e0065-0x0;var _0x34b5e2=_0x5f2f[_0x1e0065];return _0x34b5e2;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'uniqueid':{'type':Sequelize[_0xf5f2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf5f2('0x3')](_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf5f2('0x7')]}}; \ No newline at end of file +var _0x2032=['agent','queue','exports','STRING','ENUM'];(function(_0x5f195e,_0x4fe9ca){var _0x3b55ab=function(_0x4e6c46){while(--_0x4e6c46){_0x5f195e['push'](_0x5f195e['shift']());}};_0x3b55ab(++_0x4fe9ca);}(_0x2032,0xd9));var _0x2203=function(_0x354dd8,_0x39300a){_0x354dd8=_0x354dd8-0x0;var _0x28e914=_0x2032[_0x354dd8];return _0x28e914;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'uniqueid':{'type':Sequelize[_0x2203('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2203('0x2')]('account',_0x2203('0x3'),_0x2203('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 2ad85c1..e6d0233 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 _0xba10=['map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','params','keys','WhatsappTransferReport','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','set','Content-Range','apply','reject','update','then','destroy','sendStatus','name','send','index'];(function(_0xa148b4,_0x5d1feb){var _0x18a6ba=function(_0x44fe73){while(--_0x44fe73){_0xa148b4['push'](_0xa148b4['shift']());}};_0x18a6ba(++_0x5d1feb);}(_0xba10,0x70));var _0x0ba1=function(_0x52ddf6,_0x21a24e){_0x52ddf6=_0x52ddf6-0x0;var _0x19f49b=_0xba10[_0x52ddf6];return _0x19f49b;};'use strict';var pdf=require(_0x0ba1('0x0'));var emlformat=require(_0x0ba1('0x1'));var rimraf=require(_0x0ba1('0x2'));var zipdir=require(_0x0ba1('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0ba1('0x4'));var BPromise=require(_0x0ba1('0x5'));var Mustache=require(_0x0ba1('0x6'));var util=require(_0x0ba1('0x7'));var path=require(_0x0ba1('0x8'));var sox=require(_0x0ba1('0x9'));var csv=require('to-csv');var ejs=require(_0x0ba1('0xa'));var fs=require('fs');var _=require(_0x0ba1('0xb'));var squel=require(_0x0ba1('0xc'));var crypto=require(_0x0ba1('0xd'));var jsforce=require(_0x0ba1('0xe'));var deskjs=require(_0x0ba1('0xf'));var toCsv=require(_0x0ba1('0x10'));var querystring=require(_0x0ba1('0x11'));var Papa=require(_0x0ba1('0x12'));var Redis=require('ioredis');var authService=require(_0x0ba1('0x13'));var qs=require(_0x0ba1('0x14'));var as=require(_0x0ba1('0x15'));var hardwareService=require(_0x0ba1('0x16'));var logger=require(_0x0ba1('0x17'))('api');var utils=require(_0x0ba1('0x18'));var config=require(_0x0ba1('0x19'));var licenseUtil=require(_0x0ba1('0x1a'));var db=require(_0x0ba1('0x1b'))['db'];function respondWithStatusCode(_0x3d665d,_0x1467ef){_0x1467ef=_0x1467ef||0xcc;return function(_0x580b65){if(_0x580b65){return _0x3d665d['sendStatus'](_0x1467ef);}return _0x3d665d[_0x0ba1('0x1c')](_0x1467ef)[_0x0ba1('0x1d')]();};}function respondWithResult(_0x22f00e,_0x4e76c9){_0x4e76c9=_0x4e76c9||0xc8;return function(_0x376fd1){if(_0x376fd1){return _0x22f00e['status'](_0x4e76c9)[_0x0ba1('0x1e')](_0x376fd1);}};}function respondWithFilteredResult(_0x359cc8,_0x5959a3){return function(_0x50dbed){if(_0x50dbed){var _0x102a64=_0x50dbed['count'],_0x2e8f6f=_0x5959a3['offset'],_0x2ea0f8=_0x5959a3['offset']+_0x5959a3['limit'],_0x1c8a57;if(_0x2ea0f8>=_0x102a64){_0x2ea0f8=_0x102a64;_0x1c8a57=0xc8;}else{_0x1c8a57=0xce;}_0x359cc8[_0x0ba1('0x1c')](_0x1c8a57);return _0x359cc8[_0x0ba1('0x1f')](_0x0ba1('0x20'),_0x2e8f6f+'-'+_0x2ea0f8+'/'+_0x102a64)[_0x0ba1('0x1e')](_0x50dbed);}return null;};}function patchUpdates(_0x573ae1){return function(_0x1073c5){try{jsonpatch[_0x0ba1('0x21')](_0x1073c5,_0x573ae1,!![]);}catch(_0x26cf1b){return BPromise[_0x0ba1('0x22')](_0x26cf1b);}return _0x1073c5['save']();};}function saveUpdates(_0x131cc5,_0x4b3925){return function(_0xf18461){if(_0xf18461){return _0xf18461[_0x0ba1('0x23')](_0x131cc5)[_0x0ba1('0x24')](function(_0x3b0db8){return _0x3b0db8;});}return null;};}function removeEntity(_0x502816,_0x29abcb){return function(_0x5070c7){if(_0x5070c7){return _0x5070c7[_0x0ba1('0x25')]()[_0x0ba1('0x24')](function(){_0x502816[_0x0ba1('0x1c')](0xcc)[_0x0ba1('0x1d')]();});}};}function handleEntityNotFound(_0x3ce879,_0x193b04){return function(_0x501aac){if(!_0x501aac){_0x3ce879[_0x0ba1('0x26')](0x194);}return _0x501aac;};}function handleError(_0x20484c,_0x54c144){_0x54c144=_0x54c144||0x1f4;return function(_0x390a1d){logger['error'](_0x390a1d['stack']);if(_0x390a1d['name']){delete _0x390a1d[_0x0ba1('0x27')];}_0x20484c[_0x0ba1('0x1c')](_0x54c144)[_0x0ba1('0x28')](_0x390a1d);};}exports[_0x0ba1('0x29')]=function(_0xd6df23,_0x2f0317){var _0x807740={},_0x137a42={},_0x3a0065={'count':0x0,'rows':[]};var _0x471c31=_[_0x0ba1('0x2a')](db['WhatsappTransferReport'][_0x0ba1('0x2b')],function(_0x2d6eaf){return{'name':_0x2d6eaf[_0x0ba1('0x2c')],'type':_0x2d6eaf[_0x0ba1('0x2d')][_0x0ba1('0x2e')]};});_0x137a42['model']=_[_0x0ba1('0x2a')](_0x471c31,_0x0ba1('0x27'));_0x137a42[_0x0ba1('0x2f')]=_['keys'](_0xd6df23[_0x0ba1('0x2f')]);_0x137a42['filters']=_[_0x0ba1('0x30')](_0x137a42[_0x0ba1('0x31')],_0x137a42['query']);_0x807740[_0x0ba1('0x32')]=_[_0x0ba1('0x30')](_0x137a42[_0x0ba1('0x31')],qs['fields'](_0xd6df23[_0x0ba1('0x2f')][_0x0ba1('0x33')]));_0x807740['attributes']=_0x807740[_0x0ba1('0x32')][_0x0ba1('0x34')]?_0x807740[_0x0ba1('0x32')]:_0x137a42[_0x0ba1('0x31')];if(!_0xd6df23['query'][_0x0ba1('0x35')](_0x0ba1('0x36'))){_0x807740[_0x0ba1('0x37')]=qs[_0x0ba1('0x37')](_0xd6df23[_0x0ba1('0x2f')]['limit']);_0x807740['offset']=qs[_0x0ba1('0x38')](_0xd6df23['query'][_0x0ba1('0x38')]);}_0x807740[_0x0ba1('0x39')]=qs['sort'](_0xd6df23['query']['sort']);_0x807740[_0x0ba1('0x3a')]=qs[_0x0ba1('0x3b')](_[_0x0ba1('0x3c')](_0xd6df23[_0x0ba1('0x2f')],_0x137a42[_0x0ba1('0x3b')]),_0x471c31);if(_0xd6df23['query'][_0x0ba1('0x3d')]){_0x807740[_0x0ba1('0x3a')]=_[_0x0ba1('0x3e')](_0x807740[_0x0ba1('0x3a')],{'$or':_[_0x0ba1('0x2a')](_0x471c31,function(_0x168653){if(_0x168653[_0x0ba1('0x2d')]!==_0x0ba1('0x3f')){var _0x274dd9={};_0x274dd9[_0x168653[_0x0ba1('0x27')]]={'$like':'%'+_0xd6df23[_0x0ba1('0x2f')]['filter']+'%'};return _0x274dd9;}})});}_0x807740=_[_0x0ba1('0x3e')]({},_0x807740,_0xd6df23[_0x0ba1('0x40')]);var _0xae1197={'where':_0x807740[_0x0ba1('0x3a')]};return db['WhatsappTransferReport'][_0x0ba1('0x41')](_0xae1197)[_0x0ba1('0x24')](function(_0x2d44da){_0x3a0065[_0x0ba1('0x41')]=_0x2d44da;if(_0xd6df23['query'][_0x0ba1('0x42')]){_0x807740[_0x0ba1('0x43')]=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x807740);})[_0x0ba1('0x24')](function(_0x3bd8ea){_0x3a0065[_0x0ba1('0x44')]=_0x3bd8ea;return _0x3a0065;})[_0x0ba1('0x24')](respondWithFilteredResult(_0x2f0317,_0x807740))[_0x0ba1('0x45')](handleError(_0x2f0317,null));};exports['show']=function(_0x58b24c,_0x42bf34){var _0x2fed24={'raw':!![],'where':{'id':_0x58b24c[_0x0ba1('0x46')]['id']}},_0x124c6c={};_0x124c6c[_0x0ba1('0x31')]=_[_0x0ba1('0x47')](db[_0x0ba1('0x48')][_0x0ba1('0x2b')]);_0x124c6c[_0x0ba1('0x2f')]=_[_0x0ba1('0x47')](_0x58b24c[_0x0ba1('0x2f')]);_0x124c6c[_0x0ba1('0x3b')]=_[_0x0ba1('0x30')](_0x124c6c[_0x0ba1('0x31')],_0x124c6c[_0x0ba1('0x2f')]);_0x2fed24[_0x0ba1('0x32')]=_['intersection'](_0x124c6c[_0x0ba1('0x31')],qs[_0x0ba1('0x33')](_0x58b24c[_0x0ba1('0x2f')][_0x0ba1('0x33')]));_0x2fed24[_0x0ba1('0x32')]=_0x2fed24[_0x0ba1('0x32')]['length']?_0x2fed24['attributes']:_0x124c6c[_0x0ba1('0x31')];if(_0x58b24c[_0x0ba1('0x2f')][_0x0ba1('0x42')]){_0x2fed24[_0x0ba1('0x43')]=[{'all':!![]}];}_0x2fed24=_[_0x0ba1('0x3e')]({},_0x2fed24,_0x58b24c[_0x0ba1('0x40')]);return db[_0x0ba1('0x48')][_0x0ba1('0x49')](_0x2fed24)[_0x0ba1('0x24')](handleEntityNotFound(_0x42bf34,null))[_0x0ba1('0x24')](respondWithResult(_0x42bf34,null))[_0x0ba1('0x45')](handleError(_0x42bf34,null));};exports['create']=function(_0x3bb424,_0xb36c11){return db[_0x0ba1('0x48')][_0x0ba1('0x4a')](_0x3bb424[_0x0ba1('0x4b')],{})[_0x0ba1('0x24')](respondWithResult(_0xb36c11,0xc9))['catch'](handleError(_0xb36c11,null));};exports['update']=function(_0x5f0173,_0x595923){if(_0x5f0173[_0x0ba1('0x4b')]['id']){delete _0x5f0173[_0x0ba1('0x4b')]['id'];}return db[_0x0ba1('0x48')][_0x0ba1('0x49')]({'where':{'id':_0x5f0173['params']['id']}})[_0x0ba1('0x24')](handleEntityNotFound(_0x595923,null))[_0x0ba1('0x24')](saveUpdates(_0x5f0173[_0x0ba1('0x4b')],null))[_0x0ba1('0x24')](respondWithResult(_0x595923,null))['catch'](handleError(_0x595923,null));};exports['destroy']=function(_0x34e9a5,_0x72f32e){return db[_0x0ba1('0x48')][_0x0ba1('0x49')]({'where':{'id':_0x34e9a5['params']['id']}})['then'](handleEntityNotFound(_0x72f32e,null))['then'](removeEntity(_0x72f32e,null))[_0x0ba1('0x45')](handleError(_0x72f32e,null));};exports[_0x0ba1('0x4c')]=function(_0x1da347,_0x143623){return db[_0x0ba1('0x48')][_0x0ba1('0x4c')]()['then'](respondWithResult(_0x143623,null))[_0x0ba1('0x45')](handleError(_0x143623,null));}; \ No newline at end of file +var _0x593e=['json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','send','index','map','WhatsappTransferReport','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','rows','catch','params','include','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x464f2d,_0x394f1b){var _0xd677b4=function(_0x483c39){while(--_0x483c39){_0x464f2d['push'](_0x464f2d['shift']());}};_0xd677b4(++_0x394f1b);}(_0x593e,0xcb));var _0xe593=function(_0x25d63b,_0x892c4e){_0x25d63b=_0x25d63b-0x0;var _0x122437=_0x593e[_0x25d63b];return _0x122437;};'use strict';var pdf=require(_0xe593('0x0'));var emlformat=require(_0xe593('0x1'));var rimraf=require(_0xe593('0x2'));var zipdir=require(_0xe593('0x3'));var jsonpatch=require(_0xe593('0x4'));var rp=require(_0xe593('0x5'));var moment=require(_0xe593('0x6'));var BPromise=require(_0xe593('0x7'));var Mustache=require('mustache');var util=require(_0xe593('0x8'));var path=require(_0xe593('0x9'));var sox=require(_0xe593('0xa'));var csv=require(_0xe593('0xb'));var ejs=require(_0xe593('0xc'));var fs=require('fs');var _=require(_0xe593('0xd'));var squel=require(_0xe593('0xe'));var crypto=require(_0xe593('0xf'));var jsforce=require(_0xe593('0x10'));var deskjs=require(_0xe593('0x11'));var toCsv=require('to-csv');var querystring=require(_0xe593('0x12'));var Papa=require(_0xe593('0x13'));var Redis=require(_0xe593('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe593('0x15'));var hardwareService=require(_0xe593('0x16'));var logger=require(_0xe593('0x17'))('api');var utils=require(_0xe593('0x18'));var config=require(_0xe593('0x19'));var licenseUtil=require(_0xe593('0x1a'));var db=require(_0xe593('0x1b'))['db'];function respondWithStatusCode(_0x8ee313,_0x31dad0){_0x31dad0=_0x31dad0||0xcc;return function(_0x24c9fd){if(_0x24c9fd){return _0x8ee313[_0xe593('0x1c')](_0x31dad0);}return _0x8ee313[_0xe593('0x1d')](_0x31dad0)[_0xe593('0x1e')]();};}function respondWithResult(_0x499819,_0x2907e4){_0x2907e4=_0x2907e4||0xc8;return function(_0x1de391){if(_0x1de391){return _0x499819['status'](_0x2907e4)[_0xe593('0x1f')](_0x1de391);}};}function respondWithFilteredResult(_0x44837b,_0x5d4c6a){return function(_0x2ae9b6){if(_0x2ae9b6){var _0x40416c=_0x2ae9b6[_0xe593('0x20')],_0x1c6de3=_0x5d4c6a['offset'],_0x2d525c=_0x5d4c6a[_0xe593('0x21')]+_0x5d4c6a[_0xe593('0x22')],_0x3408ec;if(_0x2d525c>=_0x40416c){_0x2d525c=_0x40416c;_0x3408ec=0xc8;}else{_0x3408ec=0xce;}_0x44837b['status'](_0x3408ec);return _0x44837b[_0xe593('0x23')](_0xe593('0x24'),_0x1c6de3+'-'+_0x2d525c+'/'+_0x40416c)['json'](_0x2ae9b6);}return null;};}function patchUpdates(_0x1c94aa){return function(_0x3dba1b){try{jsonpatch[_0xe593('0x25')](_0x3dba1b,_0x1c94aa,!![]);}catch(_0x321115){return BPromise[_0xe593('0x26')](_0x321115);}return _0x3dba1b[_0xe593('0x27')]();};}function saveUpdates(_0x3d2a51,_0x4ea53f){return function(_0x4af4c8){if(_0x4af4c8){return _0x4af4c8[_0xe593('0x28')](_0x3d2a51)['then'](function(_0x56c23f){return _0x56c23f;});}return null;};}function removeEntity(_0x1bb8e8,_0x3c65b5){return function(_0x57379d){if(_0x57379d){return _0x57379d[_0xe593('0x29')]()['then'](function(){_0x1bb8e8[_0xe593('0x1d')](0xcc)[_0xe593('0x1e')]();});}};}function handleEntityNotFound(_0x185cea,_0x44d997){return function(_0x39103d){if(!_0x39103d){_0x185cea[_0xe593('0x1c')](0x194);}return _0x39103d;};}function handleError(_0x20a098,_0xb7636c){_0xb7636c=_0xb7636c||0x1f4;return function(_0x4fc483){logger[_0xe593('0x2a')](_0x4fc483[_0xe593('0x2b')]);if(_0x4fc483['name']){delete _0x4fc483['name'];}_0x20a098[_0xe593('0x1d')](_0xb7636c)[_0xe593('0x2c')](_0x4fc483);};}exports[_0xe593('0x2d')]=function(_0x43699d,_0x3b66bc){var _0x27a3d2={},_0x5918cd={},_0x350e2b={'count':0x0,'rows':[]};var _0x54e5e2=_[_0xe593('0x2e')](db[_0xe593('0x2f')]['rawAttributes'],function(_0x337ee0){return{'name':_0x337ee0['fieldName'],'type':_0x337ee0[_0xe593('0x30')][_0xe593('0x31')]};});_0x5918cd[_0xe593('0x32')]=_['map'](_0x54e5e2,_0xe593('0x33'));_0x5918cd[_0xe593('0x34')]=_[_0xe593('0x35')](_0x43699d[_0xe593('0x34')]);_0x5918cd[_0xe593('0x36')]=_[_0xe593('0x37')](_0x5918cd[_0xe593('0x32')],_0x5918cd['query']);_0x27a3d2[_0xe593('0x38')]=_[_0xe593('0x37')](_0x5918cd['model'],qs[_0xe593('0x39')](_0x43699d['query'][_0xe593('0x39')]));_0x27a3d2[_0xe593('0x38')]=_0x27a3d2[_0xe593('0x38')][_0xe593('0x3a')]?_0x27a3d2[_0xe593('0x38')]:_0x5918cd[_0xe593('0x32')];if(!_0x43699d[_0xe593('0x34')][_0xe593('0x3b')](_0xe593('0x3c'))){_0x27a3d2[_0xe593('0x22')]=qs['limit'](_0x43699d[_0xe593('0x34')][_0xe593('0x22')]);_0x27a3d2[_0xe593('0x21')]=qs['offset'](_0x43699d['query'][_0xe593('0x21')]);}_0x27a3d2['order']=qs[_0xe593('0x3d')](_0x43699d[_0xe593('0x34')][_0xe593('0x3d')]);_0x27a3d2[_0xe593('0x3e')]=qs[_0xe593('0x36')](_[_0xe593('0x3f')](_0x43699d[_0xe593('0x34')],_0x5918cd['filters']),_0x54e5e2);if(_0x43699d['query'][_0xe593('0x40')]){_0x27a3d2['where']=_[_0xe593('0x41')](_0x27a3d2['where'],{'$or':_[_0xe593('0x2e')](_0x54e5e2,function(_0x5b9589){if(_0x5b9589['type']!==_0xe593('0x42')){var _0x1c7912={};_0x1c7912[_0x5b9589[_0xe593('0x33')]]={'$like':'%'+_0x43699d['query']['filter']+'%'};return _0x1c7912;}})});}_0x27a3d2=_['merge']({},_0x27a3d2,_0x43699d[_0xe593('0x43')]);var _0x584945={'where':_0x27a3d2[_0xe593('0x3e')]};return db[_0xe593('0x2f')][_0xe593('0x20')](_0x584945)[_0xe593('0x44')](function(_0x50249e){_0x350e2b[_0xe593('0x20')]=_0x50249e;if(_0x43699d['query'][_0xe593('0x45')]){_0x27a3d2['include']=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x27a3d2);})[_0xe593('0x44')](function(_0x5c2bd2){_0x350e2b[_0xe593('0x46')]=_0x5c2bd2;return _0x350e2b;})[_0xe593('0x44')](respondWithFilteredResult(_0x3b66bc,_0x27a3d2))[_0xe593('0x47')](handleError(_0x3b66bc,null));};exports['show']=function(_0x26f845,_0x3f9784){var _0x2cbcb3={'raw':!![],'where':{'id':_0x26f845[_0xe593('0x48')]['id']}},_0x4655dd={};_0x4655dd[_0xe593('0x32')]=_[_0xe593('0x35')](db[_0xe593('0x2f')]['rawAttributes']);_0x4655dd[_0xe593('0x34')]=_[_0xe593('0x35')](_0x26f845[_0xe593('0x34')]);_0x4655dd[_0xe593('0x36')]=_[_0xe593('0x37')](_0x4655dd['model'],_0x4655dd['query']);_0x2cbcb3[_0xe593('0x38')]=_[_0xe593('0x37')](_0x4655dd[_0xe593('0x32')],qs['fields'](_0x26f845[_0xe593('0x34')][_0xe593('0x39')]));_0x2cbcb3['attributes']=_0x2cbcb3['attributes'][_0xe593('0x3a')]?_0x2cbcb3[_0xe593('0x38')]:_0x4655dd[_0xe593('0x32')];if(_0x26f845['query'][_0xe593('0x45')]){_0x2cbcb3[_0xe593('0x49')]=[{'all':!![]}];}_0x2cbcb3=_[_0xe593('0x41')]({},_0x2cbcb3,_0x26f845[_0xe593('0x43')]);return db['WhatsappTransferReport']['find'](_0x2cbcb3)['then'](handleEntityNotFound(_0x3f9784,null))['then'](respondWithResult(_0x3f9784,null))[_0xe593('0x47')](handleError(_0x3f9784,null));};exports['create']=function(_0x248944,_0xd016b3){return db[_0xe593('0x2f')][_0xe593('0x4a')](_0x248944[_0xe593('0x4b')],{})[_0xe593('0x44')](respondWithResult(_0xd016b3,0xc9))[_0xe593('0x47')](handleError(_0xd016b3,null));};exports[_0xe593('0x28')]=function(_0x4c4f61,_0x3dbb46){if(_0x4c4f61[_0xe593('0x4b')]['id']){delete _0x4c4f61[_0xe593('0x4b')]['id'];}return db['WhatsappTransferReport'][_0xe593('0x4c')]({'where':{'id':_0x4c4f61['params']['id']}})[_0xe593('0x44')](handleEntityNotFound(_0x3dbb46,null))[_0xe593('0x44')](saveUpdates(_0x4c4f61[_0xe593('0x4b')],null))['then'](respondWithResult(_0x3dbb46,null))['catch'](handleError(_0x3dbb46,null));};exports[_0xe593('0x29')]=function(_0x45beb1,_0x53db18){return db['WhatsappTransferReport']['find']({'where':{'id':_0x45beb1['params']['id']}})['then'](handleEntityNotFound(_0x53db18,null))[_0xe593('0x44')](removeEntity(_0x53db18,null))[_0xe593('0x47')](handleError(_0x53db18,null));};exports[_0xe593('0x4d')]=function(_0x4045eb,_0x42ec06){return db[_0xe593('0x2f')][_0xe593('0x4d')]()[_0xe593('0x44')](respondWithResult(_0x42ec06,null))[_0xe593('0x47')](handleError(_0x42ec06,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 99c541a..056e72b 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 _0x3f77=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','uniqueid'];(function(_0x1b7611,_0x21db55){var _0x44bf5b=function(_0x5e1650){while(--_0x5e1650){_0x1b7611['push'](_0x1b7611['shift']());}};_0x44bf5b(++_0x21db55);}(_0x3f77,0xf0));var _0x73f7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f77[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x73f7('0x0'));var util=require(_0x73f7('0x1'));var logger=require(_0x73f7('0x2'))(_0x73f7('0x3'));var moment=require(_0x73f7('0x4'));var BPromise=require(_0x73f7('0x5'));var rp=require(_0x73f7('0x6'));var fs=require('fs');var path=require(_0x73f7('0x7'));var rimraf=require(_0x73f7('0x8'));var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module[_0x73f7('0x9')]=function(_0x5c5106,_0x56a744){return _0x5c5106[_0x73f7('0xa')]('WhatsappTransferReport',attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x73f7('0xb'),'fields':[_0x73f7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4893=['bluebird','path','rimraf','../../config/environment','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','api','moment'];(function(_0x3b9887,_0x23afe0){var _0x41f513=function(_0xa0081c){while(--_0xa0081c){_0x3b9887['push'](_0x3b9887['shift']());}};_0x41f513(++_0x23afe0);}(_0x4893,0x8d));var _0x3489=function(_0x257a28,_0x2cd00d){_0x257a28=_0x257a28-0x0;var _0x13bccc=_0x4893[_0x257a28];return _0x13bccc;};'use strict';var _=require(_0x3489('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3489('0x1'));var moment=require(_0x3489('0x2'));var BPromise=require(_0x3489('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3489('0x4'));var rimraf=require(_0x3489('0x5'));var config=require(_0x3489('0x6'));var attributes=require('./whatsappTransferReport.attributes');module[_0x3489('0x7')]=function(_0x4608d6,_0x4ca36d){return _0x4608d6[_0x3489('0x8')](_0x3489('0x9'),attributes,{'tableName':_0x3489('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3489('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 20fa759..639ba95 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(_0x5747ca,_0x31b427){var _0x5db802=function(_0x554ee7){while(--_0x554ee7){_0x5747ca['push'](_0x5747ca['shift']());}};_0x5db802(++_0x31b427);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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(_0x3ac18a,_0x5cf8ba){var _0x340dc2=function(_0x2c479a){while(--_0x2c479a){_0x3ac18a['push'](_0x3ac18a['shift']());}};_0x340dc2(++_0x5cf8ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 d51ea4a..8e29e74 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c2b=['./mysqldb','./config/environment','./config/logger','app','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','then','listen','info','start','Online\x20apps:','map','filter','online','name','join','Offline\x20apps:','./config/seedDB','default','./config/license','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c2b,0x194));var _0xb0c2=function(_0x3ae8f8,_0x2eadaf){_0x3ae8f8=_0x3ae8f8-0x0;var _0x25a2b1=_0x0c2b[_0x3ae8f8];return _0x25a2b1;};'use strict';var _=require(_0xb0c2('0x0'));var mysqldb=require(_0xb0c2('0x1'));var rpc=require('./rpc');var config=require(_0xb0c2('0x2'));var logger=require(_0xb0c2('0x3'))(_0xb0c2('0x4'));var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require(_0xb0c2('0x5'));var chat=require(_0xb0c2('0x6'));var whatsapp=require(_0xb0c2('0x7'));var transcribe=require(_0xb0c2('0x8'));function main(){return mysqldb['db'][_0xb0c2('0x9')]['sync']()[_0xb0c2('0xa')](function(){return rpc[_0xb0c2('0xb')]();})[_0xb0c2('0xa')](function(_0x5052b8){logger[_0xb0c2('0xc')](_0x5052b8);return chat[_0xb0c2('0xd')]();})[_0xb0c2('0xa')](function(){return whatsapp[_0xb0c2('0xd')]();})['then'](function(){return schedule['start']();})[_0xb0c2('0xa')](function(){return transcribe[_0xb0c2('0xd')]();})[_0xb0c2('0xa')](function(_0x4242f4){logger['info'](_0x4242f4);return pm2[_0xb0c2('0xd')](pm2Config);})[_0xb0c2('0xa')](function(_0x25872d){logger[_0xb0c2('0xc')](_0xb0c2('0xe'),_[_0xb0c2('0xf')](_[_0xb0c2('0x10')](_0x25872d,{'status':_0xb0c2('0x11')}),_0xb0c2('0x12'))[_0xb0c2('0x13')]());logger[_0xb0c2('0xc')](_0xb0c2('0x14'),_[_0xb0c2('0xf')](_[_0xb0c2('0x10')](_0x25872d,function(_0x6eb706){return _0x6eb706['status']!==_0xb0c2('0x11');}),_0xb0c2('0x12'))[_0xb0c2('0x13')]()||'None');config['seedDB']&&require(_0xb0c2('0x15'))[_0xb0c2('0x16')]();require(_0xb0c2('0x17'))['default']();})[_0xb0c2('0x18')](function(_0x5147fc){logger['error'](_0xb0c2('0x19'),_0x5147fc);process[_0xb0c2('0x1a')](0x1);});}main(); \ No newline at end of file +var _0xef0a=['online','name','join','Offline\x20apps:','status','None','seedDB','default','./config/license','catch','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sequelize','sync','then','listen','info','start','map','filter'];(function(_0x264b9b,_0xa1181e){var _0x4c7a0e=function(_0x4b77a0){while(--_0x4b77a0){_0x264b9b['push'](_0x264b9b['shift']());}};_0x4c7a0e(++_0xa1181e);}(_0xef0a,0xdd));var _0xaef0=function(_0x7f58af,_0x5787cc){_0x7f58af=_0x7f58af-0x0;var _0x47f99d=_0xef0a[_0x7f58af];return _0x47f99d;};'use strict';var _=require(_0xaef0('0x0'));var mysqldb=require(_0xaef0('0x1'));var rpc=require(_0xaef0('0x2'));var config=require(_0xaef0('0x3'));var logger=require(_0xaef0('0x4'))(_0xaef0('0x5'));var pm2=require(_0xaef0('0x6'));var pm2Config=require(_0xaef0('0x7'));var schedule=require(_0xaef0('0x8'));var chat=require(_0xaef0('0x9'));var whatsapp=require(_0xaef0('0xa'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0xaef0('0xb')][_0xaef0('0xc')]()[_0xaef0('0xd')](function(){return rpc[_0xaef0('0xe')]();})['then'](function(_0x47ba50){logger[_0xaef0('0xf')](_0x47ba50);return chat[_0xaef0('0x10')]();})[_0xaef0('0xd')](function(){return whatsapp[_0xaef0('0x10')]();})[_0xaef0('0xd')](function(){return schedule[_0xaef0('0x10')]();})[_0xaef0('0xd')](function(){return transcribe[_0xaef0('0x10')]();})[_0xaef0('0xd')](function(_0x5cc502){logger[_0xaef0('0xf')](_0x5cc502);return pm2[_0xaef0('0x10')](pm2Config);})['then'](function(_0x2dc290){logger['info']('Online\x20apps:',_[_0xaef0('0x11')](_[_0xaef0('0x12')](_0x2dc290,{'status':_0xaef0('0x13')}),_0xaef0('0x14'))[_0xaef0('0x15')]());logger[_0xaef0('0xf')](_0xaef0('0x16'),_[_0xaef0('0x11')](_[_0xaef0('0x12')](_0x2dc290,function(_0x426e82){return _0x426e82[_0xaef0('0x17')]!==_0xaef0('0x13');}),_0xaef0('0x14'))['join']()||_0xaef0('0x18'));config[_0xaef0('0x19')]&&require('./config/seedDB')[_0xaef0('0x1a')]();require(_0xaef0('0x1b'))['default']();})[_0xaef0('0x1c')](function(_0x2085e5){logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x2085e5);process[_0xaef0('0x1d')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 1b74052..f51f382 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 _0x2c06=['phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','authorization','startsWith','headers','User','find','authenticate','pass','Bearer','query','apikey','getUuid','sub','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','add','minutes','catch','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','splice','unshift','encryptString','join','promisify','secret','payload','options','verify','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','basic-auth','bluebird','util','secrets','session','role','name','internal','email','voicePause','chatPause','faxPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x2c06,0x1bb));var _0x62c0=function(_0x57507e,_0x1ceefb){_0x57507e=_0x57507e-0x0;var _0x54a5c0=_0x2c06[_0x57507e];return _0x54a5c0;};'use strict';var db=require(_0x62c0('0x0'))['db'];var config=require(_0x62c0('0x1'));var hardwareConf=require(_0x62c0('0x2'));var licenseUtil=require(_0x62c0('0x3'));var encryptor=require(_0x62c0('0x4'));var _=require(_0x62c0('0x5'));var jwt=require(_0x62c0('0x6'));var expressJwt=require(_0x62c0('0x7'));var compose=require('composable-middleware');var basicAuth=require(_0x62c0('0x8'));var crypto=require('crypto');var BPromise=require(_0x62c0('0x9'));var util=require(_0x62c0('0xa'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x62c0('0xb')][_0x62c0('0xc')]});var userAttributes=['id',_0x62c0('0xd'),'fullname',_0x62c0('0xe'),_0x62c0('0xf'),_0x62c0('0x10'),'userpic','permissions','md5secret',_0x62c0('0x11'),_0x62c0('0x12'),'mailPause',_0x62c0('0x13'),'smsPause','openchannelPause',_0x62c0('0x14'),_0x62c0('0x15'),_0x62c0('0x16'),_0x62c0('0x17'),_0x62c0('0x18'),'allowmessenger',_0x62c0('0x19'),_0x62c0('0x1a'),_0x62c0('0x1b'),_0x62c0('0x1c'),_0x62c0('0x1d'),_0x62c0('0x1e'),_0x62c0('0x1f'),_0x62c0('0x20'),_0x62c0('0x21'),_0x62c0('0x22'),_0x62c0('0x23'),_0x62c0('0x24'),_0x62c0('0x25'),_0x62c0('0x26'),_0x62c0('0x27'),'settingsEnabled'];exports[_0x62c0('0x28')]=function(){return this[_0x62c0('0x29')](!![])[_0x62c0('0x2a')](function(_0x22a739,_0x1a7d42,_0x31f75f){if(_0x22a739[_0x62c0('0x2b')]){_0x31f75f();}else{return db[_0x62c0('0x2c')][_0x62c0('0x2d')]({'where':{'id':_0x22a739[_0x62c0('0x2e')]['id']},'attributes':['id',_0x62c0('0x2f'),_0x62c0('0x30')],'raw':!![]})[_0x62c0('0x31')](function(_0x3c4dd2){if(_0x3c4dd2&&_0x3c4dd2[_0x62c0('0x2f')]){return _0x1a7d42[_0x62c0('0x32')](_0x3c4dd2[_0x62c0('0x30')]===_0x62c0('0x33')?0x195:0x193)[_0x62c0('0x34')]({'message':_0x3c4dd2[_0x62c0('0x30')]===_0x62c0('0x33')?_0x62c0('0x35'):_0x62c0('0x36')});}else{_0x31f75f();}})['catch'](function(_0x2ea033){_0x31f75f(_0x2ea033);});}});};exports['isAuthenticated']=function isAuthenticated(_0x5928e1){return compose()[_0x62c0('0x2a')](function(_0x222bab,_0x4ca8c8,_0x34afed){var _0x15322e;if(_0x222bab['headers'][_0x62c0('0x37')]){if(_[_0x62c0('0x38')](_0x222bab[_0x62c0('0x39')][_0x62c0('0x37')],'Basic')){var _0x564bd2=basicAuth(_0x222bab);db[_0x62c0('0x3a')][_0x62c0('0x3b')]({'where':{'name':_0x564bd2[_0x62c0('0xe')]}})[_0x62c0('0x31')](function(_0x1f4285){if(!_0x1f4285||!_0x1f4285[_0x62c0('0x3c')](_0x564bd2[_0x62c0('0x3d')])){return _0x4ca8c8[_0x62c0('0x32')](0x191)[_0x62c0('0x34')]({'message':'Wrong\x20credentials.'});}_0x222bab[_0x62c0('0x2b')]={'id':_0x1f4285['id']};_0x34afed();})['catch'](function(_0x525349){_0x34afed(_0x525349);});}else if(_[_0x62c0('0x38')](_0x222bab['headers'][_0x62c0('0x37')],_0x62c0('0x3e'))){validateJwt(_0x222bab,_0x4ca8c8,_0x34afed);}else{if(_0x5928e1){_0x34afed();}else{return _0x4ca8c8['status'](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x222bab[_0x62c0('0x3f')][_0x62c0('0x40')]){try{var _0x50caad={'audience':hardwareConf[_0x62c0('0x41')](),'issuer':hardwareConf[_0x62c0('0x41')]()};verifyJwt(_0x222bab['query'][_0x62c0('0x40')],_0x50caad)['then'](function(_0x31b672){return db[_0x62c0('0x3a')]['find']({'where':{'id':_0x31b672[_0x62c0('0x42')]}})[_0x62c0('0x31')](function(_0x5e47ef){_0x15322e=_0x5e47ef;return db['Setting'][_0x62c0('0x2d')]({'where':{'id':0x1},'attributes':[_0x62c0('0x43'),'blockDuration'],'raw':!![]});})[_0x62c0('0x31')](function(_0x347e9e){if(!_0x15322e||!_[_0x62c0('0x44')](_0x15322e[_0x62c0('0x45')],_0x31b672[_0x62c0('0x46')])){return _0x4ca8c8[_0x62c0('0x32')](0x191)[_0x62c0('0x34')]({'message':_0x62c0('0x47')});}if(_0x15322e[_0x62c0('0x48')]){return _0x4ca8c8[_0x62c0('0x32')](0x191)['json']({'message':_0x62c0('0x49')});}if(_0x15322e[_0x62c0('0x4a')]){if(_0x347e9e[_0x62c0('0x4b')]>0x0){if(moment(_0x15322e['blockedAt'])[_0x62c0('0x4c')](_0x347e9e[_0x62c0('0x4b')],_0x62c0('0x4d'))>moment()){return _0x4ca8c8[_0x62c0('0x32')](0x191)[_0x62c0('0x34')]({'message':_0x62c0('0x49')});}}else{return _0x4ca8c8[_0x62c0('0x32')](0x191)[_0x62c0('0x34')]({'message':_0x62c0('0x49')});}}_0x222bab[_0x62c0('0x2b')]={'id':_0x15322e['id']};_0x34afed();});})[_0x62c0('0x4e')](function(){return _0x4ca8c8[_0x62c0('0x32')](0x191)[_0x62c0('0x34')]({'message':_0x62c0('0x49')});});}catch(_0x425862){_0x34afed(_0x425862);}}else if(_0x5928e1){_0x34afed();}else{return _0x4ca8c8[_0x62c0('0x32')](0x193)[_0x62c0('0x34')]({'message':_0x62c0('0x4f')});}})[_0x62c0('0x2a')](function(_0xd224,_0x36a21c,_0x232b74){if(_0xd224[_0x62c0('0x2b')]){db['User'][_0x62c0('0x3b')]({'where':{'id':_0xd224[_0x62c0('0x2b')]['id']},'attributes':userAttributes})[_0x62c0('0x31')](function(_0x5211fb){if(!_0x5211fb){return _0x36a21c['status'](0x194)[_0x62c0('0x34')]({'message':_0x62c0('0x50')});}_0xd224[_0x62c0('0x2b')]=_0x5211fb;_0x232b74();})[_0x62c0('0x4e')](function(_0x1fcc85){_0x232b74(_0x1fcc85);});}else if(_0x5928e1){_0x232b74();}else{return _0x36a21c[_0x62c0('0x32')](0x194)['json']({'message':_0x62c0('0x51')});}});};exports[_0x62c0('0x52')]=function canUpdate(){return compose()[_0x62c0('0x2a')](function(_0x211c5a,_0x3e2cdf,_0x3da343){return licenseUtil[_0x62c0('0x53')]()[_0x62c0('0x31')](function(_0x1840b4){if(_0x1840b4[_0x62c0('0x54')]){_0x3da343();}else{return _0x3e2cdf[_0x62c0('0x32')](0x193)[_0x62c0('0x34')]({'message':_0x62c0('0x55')});}})[_0x62c0('0x4e')](function(_0x59b885){_0x3da343(_0x59b885);});});};exports[_0x62c0('0x56')]=function(_0xe09b97,_0x36636d,_0x1f4c18){_0xe09b97[_0x62c0('0x56')]=!![];return _0x1f4c18();};exports[_0x62c0('0x57')]=function signToken(_0x541e82){return signJwt(_0x541e82);};exports[_0x62c0('0x58')]=function(_0x53029c,_0x3a9532){if(!_0x53029c['user']){return _0x3a9532[_0x62c0('0x32')](0x194)[_0x62c0('0x34')]({'message':_0x62c0('0x59')});}var _0x412541={'payload':{'id':_0x53029c[_0x62c0('0x2b')]['id'],'role':_0x53029c[_0x62c0('0x2b')][_0x62c0('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x412541)[_0x62c0('0x31')](function(_0x21ad84){_0x3a9532['cookie'](_0x62c0('0x5a'),_0x21ad84);_0x3a9532[_0x62c0('0x5b')](_0x62c0('0x5c'));})['catch'](function(_0x4959d7){return _0x3a9532[_0x62c0('0x32')](0x1f4)[_0x62c0('0x5d')](_0x4959d7);});};exports[_0x62c0('0x5e')]=function(_0x1d0577){if(_['isNil'](_0x1d0577[_0x62c0('0x45')])||_[_0x62c0('0x5f')](_0x1d0577[_0x62c0('0x60')])){return null;}else{return createJwt(_0x1d0577);}};exports['generateApiKey']=function(_0x45ca26){_0x45ca26[_0x62c0('0x45')]=generateNonce();_0x45ca26[_0x62c0('0x60')]=generateIssuedAt();return createJwt(_0x45ca26);};exports[_0x62c0('0x61')]=function(_0xba15a4,_0x1c0ec6){var _0x2252b1=_0xba15a4[_0x62c0('0x3f')][_0x62c0('0x40')];if(_0x2252b1){var _0x5b4db3={'nonce':_0x1c0ec6['apiKeyNonce'],'iat':_0x1c0ec6[_0x62c0('0x60')],'audience':hardwareConf[_0x62c0('0x41')](),'issuer':hardwareConf[_0x62c0('0x41')]()};return verifyJwt(_0x2252b1,_0x5b4db3)[_0x62c0('0x31')](function(){return generateApiKey(_0x1c0ec6);});}else{throw{'message':_0x62c0('0x62')};}};exports[_0x62c0('0x63')]=function(_0x49f24f){var _0xf59580=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xf59580[_0x62c0('0x64')](_0x49f24f))throw new db[(_0x62c0('0x65'))]['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~!@#$%^&-_=+[{]}.');return;};exports['validatePasswordHistory']=function(_0x15c166,_0x1d3cd4,_0x47aa8a){var _0x51c96a=encryptor[_0x62c0('0x66')](_0x1d3cd4)[_0x62c0('0x67')](',');for(var _0x3f3562=0x0;_0x3f3562<_0x47aa8a;_0x3f3562++){if(!_0x51c96a[_0x3f3562])break;if(_0x15c166[_0x62c0('0x68')]()===_0x51c96a[_0x3f3562][_0x62c0('0x68')]()){var _0x546294=util['format'](_0x62c0('0x69'),_0x47aa8a);if(_0x47aa8a===0x1){_0x546294='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x62c0('0x65'))][(_0x62c0('0x6a'))](_0x546294);}}return;};exports[_0x62c0('0x6b')]=function(_0x5a833b,_0x4139ef){var _0x1ce1aa=_0x4139ef?encryptor['decryptString'](_0x4139ef)[_0x62c0('0x67')](','):[];if(_0x1ce1aa['length']===0x5){_0x1ce1aa[_0x62c0('0x6c')](-0x1,0x1);}_0x1ce1aa[_0x62c0('0x6d')](_0x5a833b);return encryptor[_0x62c0('0x6e')](_0x1ce1aa[_0x62c0('0x6f')](','));};function signJwt(_0x4e8d98){var _0x576d85=BPromise[_0x62c0('0x70')](jwt['sign'],{'context':jwt});var _0x3e3d1b=_0x4e8d98[_0x62c0('0x71')]||config[_0x62c0('0xb')][_0x62c0('0xc')];return new BPromise(function(_0x3b6288,_0x397152){_0x576d85(_0x4e8d98[_0x62c0('0x72')],_0x3e3d1b,_0x4e8d98[_0x62c0('0x73')])['then'](function(_0x5d336f){_0x3b6288(_0x5d336f);})[_0x62c0('0x4e')](function(_0x4da243){_0x397152(_0x4da243);});});}function verifyJwt(_0x46a4dd,_0x541e37,_0x127c09){var _0xfe0c27=BPromise['promisify'](jwt[_0x62c0('0x74')],{'context':jwt});var _0x37936f=_0x127c09||config[_0x62c0('0xb')]['session'];return new BPromise(function(_0x27676a,_0x5105bc){_0xfe0c27(_0x46a4dd,_0x37936f,_0x541e37)[_0x62c0('0x31')](function(_0x26810b){_0x27676a(_0x26810b);})[_0x62c0('0x4e')](function(_0xcaaa28){_0x5105bc(_0xcaaa28);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString']('hex');}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x62c0('0x75')]();}function createJwt(_0x818d2d){var _0x3ce479={'payload':{'iat':_0x818d2d['apiKeyIat'],'nonce':_0x818d2d[_0x62c0('0x45')]},'options':{'algorithm':_0x62c0('0x76'),'subject':_0x818d2d['id']['toString'](),'issuer':hardwareConf[_0x62c0('0x41')](),'audience':hardwareConf[_0x62c0('0x41')]()}};return signJwt(_0x3ce479)[_0x62c0('0x31')](function(_0x5587f9){return{'iat':_0x818d2d[_0x62c0('0x60')],'nonce':_0x818d2d[_0x62c0('0x45')],'token':_0x5587f9};});} \ No newline at end of file +var _0xc323=['The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','length','splice','unshift','encryptString','join','promisify','secret','secrets','session','payload','options','verify','randomBytes','hex','floor','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','express-jwt','composable-middleware','crypto','moment','role','name','internal','email','permissions','md5secret','voicePause','chatPause','mailPause','openchannelPause','pauseType','showWebBar','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','userProfileId','use','user','ChatInteraction','params','disposition','then','status','unmanaged','json','Unmanaged.','catch','isAuthenticated','headers','authorization','startsWith','Basic','find','authenticate','pass','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','sub','Setting','findOne','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format'];(function(_0xaa680,_0x3d36eb){var _0x4636ab=function(_0x1a2be3){while(--_0x1a2be3){_0xaa680['push'](_0xaa680['shift']());}};_0x4636ab(++_0x3d36eb);}(_0xc323,0x8c));var _0x3c32=function(_0xbdf83f,_0x1df507){_0xbdf83f=_0xbdf83f-0x0;var _0x6227ba=_0xc323[_0xbdf83f];return _0x6227ba;};'use strict';var db=require(_0x3c32('0x0'))['db'];var config=require(_0x3c32('0x1'));var hardwareConf=require(_0x3c32('0x2'));var licenseUtil=require(_0x3c32('0x3'));var encryptor=require('../encryptor');var _=require(_0x3c32('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x3c32('0x5'));var compose=require(_0x3c32('0x6'));var basicAuth=require('basic-auth');var crypto=require(_0x3c32('0x7'));var BPromise=require('bluebird');var util=require('util');var moment=require(_0x3c32('0x8'));var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0x3c32('0x9'),'fullname',_0x3c32('0xa'),_0x3c32('0xb'),_0x3c32('0xc'),'userpic',_0x3c32('0xd'),_0x3c32('0xe'),_0x3c32('0xf'),_0x3c32('0x10'),_0x3c32('0x11'),'faxPause','smsPause',_0x3c32('0x12'),_0x3c32('0x13'),_0x3c32('0x14'),'lastLoginAt','lastPauseAt','crudPermissions',_0x3c32('0x15'),_0x3c32('0x16'),_0x3c32('0x17'),_0x3c32('0x18'),_0x3c32('0x19'),'phoneBarDnd',_0x3c32('0x1a'),_0x3c32('0x1b'),_0x3c32('0x1c'),_0x3c32('0x1d'),_0x3c32('0x1e'),_0x3c32('0x1f'),'phoneBarRemoteControlPort',_0x3c32('0x20'),_0x3c32('0x21'),_0x3c32('0x22'),'settingsEnabled'];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0x3c32('0x23')](function(_0x4bb979,_0x5575b0,_0xd78395){if(_0x4bb979[_0x3c32('0x24')]){_0xd78395();}else{return db[_0x3c32('0x25')]['findOne']({'where':{'id':_0x4bb979[_0x3c32('0x26')]['id']},'attributes':['id','closed',_0x3c32('0x27')],'raw':!![]})[_0x3c32('0x28')](function(_0x5e368c){if(_0x5e368c&&_0x5e368c['closed']){return _0x5575b0[_0x3c32('0x29')](_0x5e368c[_0x3c32('0x27')]===_0x3c32('0x2a')?0x195:0x193)[_0x3c32('0x2b')]({'message':_0x5e368c[_0x3c32('0x27')]===_0x3c32('0x2a')?_0x3c32('0x2c'):'Forbidden.'});}else{_0xd78395();}})[_0x3c32('0x2d')](function(_0x5b2c34){_0xd78395(_0x5b2c34);});}});};exports[_0x3c32('0x2e')]=function isAuthenticated(_0x1c8318){return compose()[_0x3c32('0x23')](function(_0x497046,_0x322887,_0x570129){var _0x5a9688;if(_0x497046[_0x3c32('0x2f')][_0x3c32('0x30')]){if(_[_0x3c32('0x31')](_0x497046['headers'][_0x3c32('0x30')],_0x3c32('0x32'))){var _0x2a445a=basicAuth(_0x497046);db['User'][_0x3c32('0x33')]({'where':{'name':_0x2a445a['name']}})[_0x3c32('0x28')](function(_0x2d4c6c){if(!_0x2d4c6c||!_0x2d4c6c[_0x3c32('0x34')](_0x2a445a[_0x3c32('0x35')])){return _0x322887[_0x3c32('0x29')](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x497046[_0x3c32('0x24')]={'id':_0x2d4c6c['id']};_0x570129();})['catch'](function(_0x396e96){_0x570129(_0x396e96);});}else if(_[_0x3c32('0x31')](_0x497046['headers'][_0x3c32('0x30')],_0x3c32('0x36'))){validateJwt(_0x497046,_0x322887,_0x570129);}else{if(_0x1c8318){_0x570129();}else{return _0x322887['status'](0x193)[_0x3c32('0x2b')]({'message':_0x3c32('0x37')});}}}else if(_0x497046[_0x3c32('0x38')][_0x3c32('0x39')]){try{var _0x39dde8={'audience':hardwareConf[_0x3c32('0x3a')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x497046[_0x3c32('0x38')]['apikey'],_0x39dde8)['then'](function(_0x1a590c){return db[_0x3c32('0x3b')][_0x3c32('0x33')]({'where':{'id':_0x1a590c[_0x3c32('0x3c')]}})[_0x3c32('0x28')](function(_0x5b27e6){_0x5a9688=_0x5b27e6;return db[_0x3c32('0x3d')][_0x3c32('0x3e')]({'where':{'id':0x1},'attributes':[_0x3c32('0x3f'),_0x3c32('0x40')],'raw':!![]});})[_0x3c32('0x28')](function(_0x21fe5f){if(!_0x5a9688||!_[_0x3c32('0x41')](_0x5a9688[_0x3c32('0x42')],_0x1a590c['nonce'])){return _0x322887[_0x3c32('0x29')](0x191)[_0x3c32('0x2b')]({'message':_0x3c32('0x43')});}if(_0x5a9688[_0x3c32('0x44')]){return _0x322887[_0x3c32('0x29')](0x191)[_0x3c32('0x2b')]({'message':_0x3c32('0x45')});}if(_0x5a9688[_0x3c32('0x46')]){if(_0x21fe5f[_0x3c32('0x40')]>0x0){if(moment(_0x5a9688[_0x3c32('0x47')])[_0x3c32('0x48')](_0x21fe5f[_0x3c32('0x40')],'minutes')>moment()){return _0x322887[_0x3c32('0x29')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x322887['status'](0x191)[_0x3c32('0x2b')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x497046['user']={'id':_0x5a9688['id']};_0x570129();});})[_0x3c32('0x2d')](function(){return _0x322887[_0x3c32('0x29')](0x191)[_0x3c32('0x2b')]({'message':_0x3c32('0x45')});});}catch(_0x434af0){_0x570129(_0x434af0);}}else if(_0x1c8318){_0x570129();}else{return _0x322887['status'](0x193)[_0x3c32('0x2b')]({'message':'Unknown\x20authorization\x20format'});}})['use'](function(_0x43441d,_0xb87d6f,_0x2c4e59){if(_0x43441d['user']){db[_0x3c32('0x3b')][_0x3c32('0x33')]({'where':{'id':_0x43441d[_0x3c32('0x24')]['id']},'attributes':userAttributes})['then'](function(_0x2d87ac){if(!_0x2d87ac){return _0xb87d6f[_0x3c32('0x29')](0x194)['json']({'message':_0x3c32('0x49')});}_0x43441d[_0x3c32('0x24')]=_0x2d87ac;_0x2c4e59();})['catch'](function(_0x1415b0){_0x2c4e59(_0x1415b0);});}else if(_0x1c8318){_0x2c4e59();}else{return _0xb87d6f['status'](0x194)[_0x3c32('0x2b')]({'message':_0x3c32('0x4a')});}});};exports[_0x3c32('0x4b')]=function canUpdate(){return compose()[_0x3c32('0x23')](function(_0x384f20,_0x5117b1,_0x36357e){return licenseUtil[_0x3c32('0x4c')]()[_0x3c32('0x28')](function(_0x26230d){if(_0x26230d[_0x3c32('0x4d')]){_0x36357e();}else{return _0x5117b1['status'](0x193)[_0x3c32('0x2b')]({'message':_0x3c32('0x4e')});}})[_0x3c32('0x2d')](function(_0x4267f9){_0x36357e(_0x4267f9);});});};exports[_0x3c32('0x4f')]=function(_0x4e7878,_0x238568,_0x37cf45){_0x4e7878['isMiddleware']=!![];return _0x37cf45();};exports[_0x3c32('0x50')]=function signToken(_0x396960){return signJwt(_0x396960);};exports[_0x3c32('0x51')]=function(_0x4854d1,_0x2cb20a){if(!_0x4854d1[_0x3c32('0x24')]){return _0x2cb20a[_0x3c32('0x29')](0x194)[_0x3c32('0x2b')]({'message':_0x3c32('0x52')});}var _0x4770e9={'payload':{'id':_0x4854d1[_0x3c32('0x24')]['id'],'role':_0x4854d1[_0x3c32('0x24')][_0x3c32('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4770e9)['then'](function(_0x193312){_0x2cb20a[_0x3c32('0x53')](_0x3c32('0x54'),_0x193312);_0x2cb20a[_0x3c32('0x55')](_0x3c32('0x56'));})['catch'](function(_0x58a6ea){return _0x2cb20a[_0x3c32('0x29')](0x1f4)[_0x3c32('0x57')](_0x58a6ea);});};exports['retrieveApiKey']=function(_0x1b7292){if(_[_0x3c32('0x58')](_0x1b7292[_0x3c32('0x42')])||_['isNil'](_0x1b7292['apiKeyIat'])){return null;}else{return createJwt(_0x1b7292);}};exports[_0x3c32('0x59')]=function(_0x3489b4){_0x3489b4[_0x3c32('0x42')]=generateNonce();_0x3489b4[_0x3c32('0x5a')]=generateIssuedAt();return createJwt(_0x3489b4);};exports[_0x3c32('0x5b')]=function(_0x376aa6,_0x401bf9){var _0xfe702d=_0x376aa6[_0x3c32('0x38')][_0x3c32('0x39')];if(_0xfe702d){var _0x5dd439={'nonce':_0x401bf9[_0x3c32('0x42')],'iat':_0x401bf9[_0x3c32('0x5a')],'audience':hardwareConf[_0x3c32('0x3a')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0xfe702d,_0x5dd439)[_0x3c32('0x28')](function(){return generateApiKey(_0x401bf9);});}else{throw{'message':_0x3c32('0x5c')};}};exports[_0x3c32('0x5d')]=function(_0x189650){var _0x236a16=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x236a16[_0x3c32('0x5e')](_0x189650))throw new db[(_0x3c32('0x5f'))][(_0x3c32('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[_0x3c32('0x61')]=function(_0x209816,_0x2a16a9,_0x240300){var _0x38501c=encryptor[_0x3c32('0x62')](_0x2a16a9)[_0x3c32('0x63')](',');for(var _0x24189a=0x0;_0x24189a<_0x240300;_0x24189a++){if(!_0x38501c[_0x24189a])break;if(_0x209816[_0x3c32('0x64')]()===_0x38501c[_0x24189a][_0x3c32('0x64')]()){var _0x1b8bf2=util[_0x3c32('0x65')](_0x3c32('0x66'),_0x240300);if(_0x240300===0x1){_0x1b8bf2=_0x3c32('0x67');}throw new db[(_0x3c32('0x5f'))][(_0x3c32('0x60'))](_0x1b8bf2);}}return;};exports['updatePasswordsHistory']=function(_0x3bca18,_0x377c90){var _0x63c8f=_0x377c90?encryptor[_0x3c32('0x62')](_0x377c90)[_0x3c32('0x63')](','):[];if(_0x63c8f[_0x3c32('0x68')]===0x5){_0x63c8f[_0x3c32('0x69')](-0x1,0x1);}_0x63c8f[_0x3c32('0x6a')](_0x3bca18);return encryptor[_0x3c32('0x6b')](_0x63c8f[_0x3c32('0x6c')](','));};function signJwt(_0x298808){var _0x27e9b9=BPromise[_0x3c32('0x6d')](jwt['sign'],{'context':jwt});var _0x4edf6b=_0x298808[_0x3c32('0x6e')]||config[_0x3c32('0x6f')][_0x3c32('0x70')];return new BPromise(function(_0x3943d2,_0x5c9342){_0x27e9b9(_0x298808[_0x3c32('0x71')],_0x4edf6b,_0x298808[_0x3c32('0x72')])[_0x3c32('0x28')](function(_0x1eeaa8){_0x3943d2(_0x1eeaa8);})[_0x3c32('0x2d')](function(_0x546672){_0x5c9342(_0x546672);});});}function verifyJwt(_0x230227,_0x5db731,_0x2611b3){var _0x3d21bc=BPromise['promisify'](jwt[_0x3c32('0x73')],{'context':jwt});var _0x18ab74=_0x2611b3||config[_0x3c32('0x6f')][_0x3c32('0x70')];return new BPromise(function(_0x4bbb38,_0x2f84cf){_0x3d21bc(_0x230227,_0x18ab74,_0x5db731)['then'](function(_0x125f90){_0x4bbb38(_0x125f90);})[_0x3c32('0x2d')](function(_0x16d5bf){_0x2f84cf(_0x16d5bf);});});}function generateNonce(){return crypto[_0x3c32('0x74')](0x10)['toString'](_0x3c32('0x75'));}function generateIssuedAt(){return Math[_0x3c32('0x76')](Date['now']()/0x3e8)[_0x3c32('0x77')]();}function createJwt(_0x2344ad){var _0x2ec77c={'payload':{'iat':_0x2344ad[_0x3c32('0x5a')],'nonce':_0x2344ad['apiKeyNonce']},'options':{'algorithm':_0x3c32('0x78'),'subject':_0x2344ad['id'][_0x3c32('0x77')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x3c32('0x3a')]()}};return signJwt(_0x2ec77c)['then'](function(_0x8b5e46){return{'iat':_0x2344ad['apiKeyIat'],'nonce':_0x2344ad['apiKeyNonce'],'token':_0x8b5e46};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index a5142d0..290b9d7 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 _0x038b=['bluebird','../../config/environment','secrets','aes-256-ctr','hasOwnProperty','createWriteStream','createCipher','algorithm','data','update','binary','write','end','final','close','decryptFile','createReadStream','createDecipher','unlink','secret','utf8','base64','decryptString'];(function(_0x55b133,_0x252c39){var _0x55dfb2=function(_0x45ec67){while(--_0x45ec67){_0x55b133['push'](_0x55b133['shift']());}};_0x55dfb2(++_0x252c39);}(_0x038b,0x114));var _0xb038=function(_0x2b95d4,_0x42abab){_0x2b95d4=_0x2b95d4-0x0;var _0x358260=_0x038b[_0x2b95d4];return _0x358260;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xb038('0x0'));var config=require(_0xb038('0x1'));const stringOptions={'secret':config[_0xb038('0x2')]['session'],'algorithm':_0xb038('0x3')};const fileOptions={'algorithm':'aes192'};function combineOptions(_0x23574d){var _0x3d090b={};for(var _0x4a8a30 in fileOptions){if(fileOptions[_0xb038('0x4')](_0x4a8a30)){_0x3d090b[_0x4a8a30]=fileOptions[_0x4a8a30];}}if(_0x23574d){for(var _0x11da3a in _0x23574d){if(_0x23574d['hasOwnProperty'](_0x11da3a)){_0x3d090b[_0x11da3a]=_0x23574d[_0x11da3a];}}}return _0x3d090b;}exports['encryptFile']=function(_0x2e3e64,_0x1b077a,_0x1534a9,_0x4b4085){return new BPromise(function(_0x48a4d7,_0x462e8f){_0x4b4085=combineOptions(_0x4b4085);var _0x20c102=new Buffer(_0x1534a9);var _0x4d85b4=fs['createReadStream'](_0x2e3e64);var _0xe3d046=fs[_0xb038('0x5')](_0x1b077a);var _0x5c96b5=crypto[_0xb038('0x6')](_0x4b4085[_0xb038('0x7')],_0x20c102);_0x4d85b4['on'](_0xb038('0x8'),function(_0x3368c1){var _0x3a09a3=new Buffer(_0x5c96b5[_0xb038('0x9')](_0x3368c1),_0xb038('0xa'));_0xe3d046[_0xb038('0xb')](_0x3a09a3);});_0x4d85b4['on'](_0xb038('0xc'),function(){try{var _0x57acd8=new Buffer(_0x5c96b5[_0xb038('0xd')](_0xb038('0xa')),_0xb038('0xa'));_0xe3d046[_0xb038('0xb')](_0x57acd8);_0xe3d046[_0xb038('0xc')]();_0xe3d046['on'](_0xb038('0xe'),function(){return _0x48a4d7(_0x1b077a);});}catch(_0x13f893){fs['unlink'](_0x1b077a);return _0x462e8f(_0x13f893);}});});};exports[_0xb038('0xf')]=function(_0x26e4f2,_0x183141,_0x39323e,_0xdef213){return new BPromise(function(_0x2b4173,_0x5246c3){_0xdef213=combineOptions(_0xdef213);var _0x2a4134=new Buffer(_0x39323e);var _0x3039b0=fs[_0xb038('0x10')](_0x26e4f2);var _0x3b095a=fs['createWriteStream'](_0x183141);var _0x49b237=crypto[_0xb038('0x11')](_0xdef213[_0xb038('0x7')],_0x2a4134);_0x3039b0['on'](_0xb038('0x8'),function(_0x31c348){var _0x4fd2e8=new Buffer(_0x49b237[_0xb038('0x9')](_0x31c348),_0xb038('0xa'));_0x3b095a[_0xb038('0xb')](_0x4fd2e8);});_0x3039b0['on'](_0xb038('0xc'),function(){try{var _0xc6cd61=new Buffer(_0x49b237['final'](_0xb038('0xa')),_0xb038('0xa'));_0x3b095a[_0xb038('0xb')](_0xc6cd61);_0x3b095a[_0xb038('0xc')]();_0x3b095a['on']('close',function(){return _0x2b4173(_0x183141);});}catch(_0x2812c9){fs[_0xb038('0x12')](_0x183141);return _0x5246c3(_0x2812c9);}});});};exports['encryptString']=function(_0x1eb9cd,_0x43d403,_0x573f93){var _0x241329=_0x573f93||stringOptions['algorithm'];var _0x25ff46=_0x43d403||stringOptions[_0xb038('0x13')];var _0x27ff21=crypto[_0xb038('0x6')](_0x241329,_0x25ff46);var _0x5d4343=_0x27ff21[_0xb038('0x9')](_0x1eb9cd,_0xb038('0x14'),'base64');_0x5d4343+=_0x27ff21[_0xb038('0xd')](_0xb038('0x15'));return _0x5d4343;};exports[_0xb038('0x16')]=function(_0x5d18c8,_0xa8fe18,_0x3af191){var _0x1fa72d=_0x3af191||stringOptions['algorithm'];var _0x41abf4=_0xa8fe18||stringOptions[_0xb038('0x13')];var _0x28a6a9=crypto[_0xb038('0x11')](_0x1fa72d,_0x41abf4);var _0xc387d=_0x28a6a9['update'](_0x5d18c8,_0xb038('0x15'),_0xb038('0x14'));_0xc387d+=_0x28a6a9[_0xb038('0xd')](_0xb038('0x14'));return _0xc387d;}; \ No newline at end of file +var _0x277c=['binary','end','final','write','close','decryptFile','createDecipher','update','unlink','encryptString','createCipher','utf8','base64','decryptString','crypto','../../config/environment','secrets','session','aes-256-ctr','aes192','hasOwnProperty','createReadStream','createWriteStream','algorithm','data'];(function(_0x1fb4b3,_0x1bf882){var _0xc8f53c=function(_0x17f4ec){while(--_0x17f4ec){_0x1fb4b3['push'](_0x1fb4b3['shift']());}};_0xc8f53c(++_0x1bf882);}(_0x277c,0x153));var _0xc277=function(_0x38a75f,_0x29c1c2){_0x38a75f=_0x38a75f-0x0;var _0x3b3fb9=_0x277c[_0x38a75f];return _0x3b3fb9;};'use strict';var crypto=require(_0xc277('0x0'));var fs=require('fs');var BPromise=require('bluebird');var config=require(_0xc277('0x1'));const stringOptions={'secret':config[_0xc277('0x2')][_0xc277('0x3')],'algorithm':_0xc277('0x4')};const fileOptions={'algorithm':_0xc277('0x5')};function combineOptions(_0x1fcae3){var _0x72f952={};for(var _0x29f81d in fileOptions){if(fileOptions['hasOwnProperty'](_0x29f81d)){_0x72f952[_0x29f81d]=fileOptions[_0x29f81d];}}if(_0x1fcae3){for(var _0x4bfaeb in _0x1fcae3){if(_0x1fcae3[_0xc277('0x6')](_0x4bfaeb)){_0x72f952[_0x4bfaeb]=_0x1fcae3[_0x4bfaeb];}}}return _0x72f952;}exports['encryptFile']=function(_0x77e168,_0x54d634,_0x378158,_0x17a2fe){return new BPromise(function(_0x55be1f,_0x324ef7){_0x17a2fe=combineOptions(_0x17a2fe);var _0x30886d=new Buffer(_0x378158);var _0xfdf694=fs[_0xc277('0x7')](_0x77e168);var _0x3f766f=fs[_0xc277('0x8')](_0x54d634);var _0x4a4137=crypto['createCipher'](_0x17a2fe[_0xc277('0x9')],_0x30886d);_0xfdf694['on'](_0xc277('0xa'),function(_0x2df373){var _0xcad435=new Buffer(_0x4a4137['update'](_0x2df373),_0xc277('0xb'));_0x3f766f['write'](_0xcad435);});_0xfdf694['on'](_0xc277('0xc'),function(){try{var _0x2bba87=new Buffer(_0x4a4137[_0xc277('0xd')](_0xc277('0xb')),'binary');_0x3f766f[_0xc277('0xe')](_0x2bba87);_0x3f766f[_0xc277('0xc')]();_0x3f766f['on'](_0xc277('0xf'),function(){return _0x55be1f(_0x54d634);});}catch(_0x4de960){fs['unlink'](_0x54d634);return _0x324ef7(_0x4de960);}});});};exports[_0xc277('0x10')]=function(_0x5c212c,_0x46d20c,_0x5d73f8,_0x306046){return new BPromise(function(_0x1162b9,_0x15f560){_0x306046=combineOptions(_0x306046);var _0x4f522e=new Buffer(_0x5d73f8);var _0x5cdb4b=fs[_0xc277('0x7')](_0x5c212c);var _0x4d23a7=fs['createWriteStream'](_0x46d20c);var _0x1e1a9b=crypto[_0xc277('0x11')](_0x306046[_0xc277('0x9')],_0x4f522e);_0x5cdb4b['on'](_0xc277('0xa'),function(_0xe2b7c1){var _0x355eee=new Buffer(_0x1e1a9b[_0xc277('0x12')](_0xe2b7c1),'binary');_0x4d23a7['write'](_0x355eee);});_0x5cdb4b['on'](_0xc277('0xc'),function(){try{var _0x28900e=new Buffer(_0x1e1a9b[_0xc277('0xd')](_0xc277('0xb')),_0xc277('0xb'));_0x4d23a7[_0xc277('0xe')](_0x28900e);_0x4d23a7[_0xc277('0xc')]();_0x4d23a7['on'](_0xc277('0xf'),function(){return _0x1162b9(_0x46d20c);});}catch(_0x1bc888){fs[_0xc277('0x13')](_0x46d20c);return _0x15f560(_0x1bc888);}});});};exports[_0xc277('0x14')]=function(_0x57a198,_0x2b9936,_0x21af1b){var _0x54b2e1=_0x21af1b||stringOptions[_0xc277('0x9')];var _0x4820e1=_0x2b9936||stringOptions['secret'];var _0x3292ab=crypto[_0xc277('0x15')](_0x54b2e1,_0x4820e1);var _0x1583b6=_0x3292ab[_0xc277('0x12')](_0x57a198,_0xc277('0x16'),_0xc277('0x17'));_0x1583b6+=_0x3292ab[_0xc277('0xd')](_0xc277('0x17'));return _0x1583b6;};exports[_0xc277('0x18')]=function(_0x3e04cb,_0x40d17a,_0x5e480e){var _0x5f3933=_0x5e480e||stringOptions[_0xc277('0x9')];var _0x4318f4=_0x40d17a||stringOptions['secret'];var _0x4efc1e=crypto[_0xc277('0x11')](_0x5f3933,_0x4318f4);var _0x3bc773=_0x4efc1e[_0xc277('0x12')](_0x3e04cb,_0xc277('0x17'),_0xc277('0x16'));_0x3bc773+=_0x4efc1e['final'](_0xc277('0x16'));return _0x3bc773;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 3841351..61da86c 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 _0x5636=['mkdirSync','csv','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','num','%s\x20limit\x20%d\x20OFFSET\x20%d','push','.csv','join'];(function(_0x9c8c83,_0x16ebdd){var _0x4636ac=function(_0x5bacfc){while(--_0x5bacfc){_0x9c8c83['push'](_0x9c8c83['shift']());}};_0x4636ac(++_0x16ebdd);}(_0x5636,0x102));var _0x6563=function(_0xca31aa,_0x25bb9e){_0xca31aa=_0xca31aa-0x0;var _0x5f4e26=_0x5636[_0xca31aa];return _0x5f4e26;};'use strict';var util=require(_0x6563('0x0'));var path=require(_0x6563('0x1'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x6563('0x2'));var rimraf=require(_0x6563('0x3'));var db=require(_0x6563('0x4'))['db'];var dbH=require('../../mysqldb')[_0x6563('0x5')];var logger=require(_0x6563('0x6'))(_0x6563('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x6563('0x8')][0x2]);var QUERY=process[_0x6563('0x8')][0x3];var PATH=process[_0x6563('0x8')][0x4];function analyticExtractedReport(_0x9884a9,_0x2d57d5){var _0x2d0d5b={'status':_0x9884a9};var _0x98fcd4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2d57d5){_0x2d0d5b[_0x6563('0x9')]=_0x2d57d5;}return db[_0x6563('0xa')][_0x6563('0xb')](_0x2d0d5b,_0x98fcd4);}function main(){var _0x516d1a=0x1388;var _0x51fdc2;logger[_0x6563('0xc')](util[_0x6563('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0x6563('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6563('0xf'),_0x6563('0x10')]})[_0x6563('0x11')](function(_0x33816e){if(_0x33816e){_0x51fdc2=_0x33816e;_0x516d1a=_0x51fdc2[_0x6563('0x10')]||0x1388;}})[_0x6563('0x11')](function(){return dbH[_0x6563('0x12')][_0x6563('0x13')](util['format'](_0x6563('0x14'),QUERY),{'type':dbH['sequelize'][_0x6563('0x15')][_0x6563('0x16')]});})[_0x6563('0x11')](function(_0x10d08c){if(!_0x10d08c[0x0]['num']){return analyticExtractedReport(_0x6563('0x17'));}var _0x11baa2=[];var _0x477d9b=0x0;var _0xd398ce=!![];if(_0x10d08c&&_0x10d08c['length']){var _0x3563fd=_0x10d08c[0x0]['num']%(_0x477d9b+_0x516d1a);if(_0x51fdc2['split']){for(;_0xd398ce;_0x477d9b+=_0x516d1a,_0x3563fd=_0x10d08c[0x0]['num']%(_0x477d9b+_0x516d1a)){if(_0x3563fd==0x0||_0x3563fd==_0x10d08c[0x0][_0x6563('0x18')]){_0xd398ce=![];}_0x11baa2['push'](dbH['sequelize'][_0x6563('0x13')](util[_0x6563('0xd')](_0x6563('0x19'),QUERY,_0x516d1a,_0x477d9b),{'type':dbH[_0x6563('0x12')][_0x6563('0x15')][_0x6563('0x16')]}));}}else{_0x11baa2[_0x6563('0x1a')](dbH[_0x6563('0x12')][_0x6563('0x13')](QUERY,{'type':dbH['sequelize'][_0x6563('0x15')][_0x6563('0x16')]}));}}var _0x20b478=path['dirname'](PATH);var _0x293db2=path['basename'](PATH,_0x6563('0x1b'));var _0x105379=_0x51fdc2['split']&&_0x11baa2['length']>0x1;var _0x3ab7f6=[];if(!fs['existsSync'](path[_0x6563('0x1c')](_0x20b478,_0x293db2))&&_0x105379){fs[_0x6563('0x1d')](path[_0x6563('0x1c')](_0x20b478,_0x293db2));}return BPromise['each'](_0x11baa2,function(_0xd860d5){_0x3ab7f6['push'](_0xd860d5);})[_0x6563('0x11')](function(){for(var _0x1590e6=0x0;_0x1590e6<_0x3ab7f6['length'];_0x1590e6+=0x1){var _0x365b16;var _0x28252d=_0x3ab7f6[_0x1590e6];if(_0x105379){_0x365b16=path['join'](_0x20b478,_0x293db2,util[_0x6563('0xd')]('%s%d.%s',_0x293db2,_0x1590e6,_0x6563('0x1e')));}else{_0x365b16=path['join'](_0x20b478,util['format'](_0x6563('0x1f'),_0x293db2,_0x6563('0x1e')));}fs[_0x6563('0x20')](_0x365b16,csv(_0x28252d));}})[_0x6563('0x11')](function(){if(_0x105379){zipdir(path[_0x6563('0x1c')](_0x20b478,_0x293db2),{'saveTo':path['join'](_0x20b478,util[_0x6563('0xd')]('%s.%s',_0x293db2,'zip'))},function(_0x3582c9,_0x35af37){});rimraf(path[_0x6563('0x1c')](_0x20b478,_0x293db2),function(){});}})[_0x6563('0x11')](function(){logger[_0x6563('0xc')](util[_0x6563('0xd')](_0x6563('0x21'),EXTRACTED_REPORT_ID,_0x6563('0x22')));return analyticExtractedReport(_0x6563('0x23'),_0x105379?util[_0x6563('0xd')]('%s.%s',_0x293db2,_0x105379?_0x6563('0x24'):_0x6563('0x1e')):null);});})[_0x6563('0x25')](function(_0x1558fb){logger[_0x6563('0xc')](util[_0x6563('0xd')](_0x6563('0x26'),EXTRACTED_REPORT_ID,'CSV'),util[_0x6563('0x27')](_0x1558fb,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x6563('0x28'));});}main(); \ No newline at end of file +var _0x4ea3=['split','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','basename','.csv','join','mkdirSync','each','%s%d.%s','csv','writeFileSync','%s.%s','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','catch','inspect','util','path','lodash','to-csv','zip-dir','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting'];(function(_0x45bcd4,_0x393621){var _0x20767d=function(_0x491392){while(--_0x491392){_0x45bcd4['push'](_0x45bcd4['shift']());}};_0x20767d(++_0x393621);}(_0x4ea3,0x70));var _0x34ea=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4ea3[_0x1facfa];return _0x9ec701;};'use strict';var util=require(_0x34ea('0x0'));var path=require(_0x34ea('0x1'));var _=require(_0x34ea('0x2'));var csv=require(_0x34ea('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x34ea('0x4'));var rimraf=require('rimraf');var db=require(_0x34ea('0x5'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x34ea('0x6'))(_0x34ea('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x34ea('0x8')][0x2]);var QUERY=process[_0x34ea('0x8')][0x3];var PATH=process[_0x34ea('0x8')][0x4];function analyticExtractedReport(_0x18b461,_0x22b09e){var _0x5bec7c={'status':_0x18b461};var _0x341727={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x22b09e){_0x5bec7c[_0x34ea('0x9')]=_0x22b09e;}return db[_0x34ea('0xa')]['update'](_0x5bec7c,_0x341727);}function main(){var _0x301b98=0x1388;var _0xea1be2;logger['info'](util['format'](_0x34ea('0xb'),EXTRACTED_REPORT_ID,_0x34ea('0xc')));return db[_0x34ea('0xd')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x34ea('0xe'),_0x34ea('0xf')]})[_0x34ea('0x10')](function(_0x233b11){if(_0x233b11){_0xea1be2=_0x233b11;_0x301b98=_0xea1be2[_0x34ea('0xf')]||0x1388;}})[_0x34ea('0x10')](function(){return dbH[_0x34ea('0x11')][_0x34ea('0x12')](util[_0x34ea('0x13')](_0x34ea('0x14'),QUERY),{'type':dbH[_0x34ea('0x11')]['QueryTypes'][_0x34ea('0x15')]});})[_0x34ea('0x10')](function(_0x14ebb9){if(!_0x14ebb9[0x0][_0x34ea('0x16')]){return analyticExtractedReport(_0x34ea('0x17'));}var _0x56b2d7=[];var _0x6a84a7=0x0;var _0x18c013=!![];if(_0x14ebb9&&_0x14ebb9[_0x34ea('0x18')]){var _0x305576=_0x14ebb9[0x0]['num']%(_0x6a84a7+_0x301b98);if(_0xea1be2[_0x34ea('0xe')]){for(;_0x18c013;_0x6a84a7+=_0x301b98,_0x305576=_0x14ebb9[0x0][_0x34ea('0x16')]%(_0x6a84a7+_0x301b98)){if(_0x305576==0x0||_0x305576==_0x14ebb9[0x0][_0x34ea('0x16')]){_0x18c013=![];}_0x56b2d7['push'](dbH[_0x34ea('0x11')][_0x34ea('0x12')](util[_0x34ea('0x13')](_0x34ea('0x19'),QUERY,_0x301b98,_0x6a84a7),{'type':dbH['sequelize'][_0x34ea('0x1a')][_0x34ea('0x15')]}));}}else{_0x56b2d7[_0x34ea('0x1b')](dbH[_0x34ea('0x11')]['query'](QUERY,{'type':dbH['sequelize'][_0x34ea('0x1a')][_0x34ea('0x15')]}));}}var _0x151fae=path['dirname'](PATH);var _0x5197a2=path[_0x34ea('0x1c')](PATH,_0x34ea('0x1d'));var _0x2a0ec2=_0xea1be2[_0x34ea('0xe')]&&_0x56b2d7[_0x34ea('0x18')]>0x1;var _0x697475=[];if(!fs['existsSync'](path[_0x34ea('0x1e')](_0x151fae,_0x5197a2))&&_0x2a0ec2){fs[_0x34ea('0x1f')](path[_0x34ea('0x1e')](_0x151fae,_0x5197a2));}return BPromise[_0x34ea('0x20')](_0x56b2d7,function(_0x5b5885){_0x697475['push'](_0x5b5885);})['then'](function(){for(var _0x142709=0x0;_0x142709<_0x697475[_0x34ea('0x18')];_0x142709+=0x1){var _0x37c214;var _0x4204d7=_0x697475[_0x142709];if(_0x2a0ec2){_0x37c214=path['join'](_0x151fae,_0x5197a2,util[_0x34ea('0x13')](_0x34ea('0x21'),_0x5197a2,_0x142709,_0x34ea('0x22')));}else{_0x37c214=path['join'](_0x151fae,util['format']('%s.%s',_0x5197a2,'csv'));}fs[_0x34ea('0x23')](_0x37c214,csv(_0x4204d7));}})[_0x34ea('0x10')](function(){if(_0x2a0ec2){zipdir(path[_0x34ea('0x1e')](_0x151fae,_0x5197a2),{'saveTo':path[_0x34ea('0x1e')](_0x151fae,util['format'](_0x34ea('0x24'),_0x5197a2,'zip'))},function(_0x2c6de8,_0x4f2b77){});rimraf(path[_0x34ea('0x1e')](_0x151fae,_0x5197a2),function(){});}})[_0x34ea('0x10')](function(){logger[_0x34ea('0x25')](util['format'](_0x34ea('0x26'),EXTRACTED_REPORT_ID,_0x34ea('0xc')));return analyticExtractedReport('Completed',_0x2a0ec2?util[_0x34ea('0x13')]('%s.%s',_0x5197a2,_0x2a0ec2?_0x34ea('0x27'):_0x34ea('0x22')):null);});})[_0x34ea('0x28')](function(_0x5ead76){logger['info'](util[_0x34ea('0x13')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x34ea('0xc')),util[_0x34ea('0x29')](_0x5ead76,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index e334552..6651601 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 _0x5f2f=['hasOwnProperty','push','num','Empty','dirname','basename','Setting','find','split','splitSizePdf','then','length','query','format','QueryTypes','SELECT','sequelize','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','landscape','body','toString','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','%s.%s','createWriteStream','finish','err','end','info','CSV','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','lodash','bluebird','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport'];(function(_0x1a58ba,_0x28888c){var _0x231bed=function(_0x47e789){while(--_0x47e789){_0x1a58ba['push'](_0x1a58ba['shift']());}};_0x231bed(++_0x28888c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x720b50,_0x39fd7a){_0x720b50=_0x720b50-0x0;var _0x502e62=_0x5f2f[_0x720b50];return _0x502e62;};'use strict';var _=require(_0xf5f2('0x0'));var fs=require('fs');var BPromise=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var path=require(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var PdfPrinter=require(_0xf5f2('0x5'));var zipdir=require(_0xf5f2('0x6'));var rimraf=require(_0xf5f2('0x7'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xf5f2('0x8')];var logger=require(_0xf5f2('0x9'))(_0xf5f2('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xf5f2('0xb')][0x2]);var QUERY=process[_0xf5f2('0xb')][0x3];var PATH=process[_0xf5f2('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xf5f2('0xc');var _extractedReport;function analyticExtractedReport(_0x46cd9c,_0x2ec345){var _0x56a69f={'status':_0x46cd9c};var _0x375da4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ec345){_0x56a69f[_0xf5f2('0xd')]=_0x2ec345;}return db[_0xf5f2('0xe')]['update'](_0x56a69f,_0x375da4);}function getHeader(_0x977a59){var _0x4ebbbe=[];for(var _0x53fb33 in _0x977a59){if(_0x977a59[_0xf5f2('0xf')](_0x53fb33)){_0x4ebbbe[_0xf5f2('0x10')]({'text':_0x53fb33,'style':'tableHeader'});}}return _0x4ebbbe;}function extractReport(_0x336f6b){var _0x14b51f=0x1388;var _0x331482;if(!_0x336f6b[0x0][_0xf5f2('0x11')]){return analyticExtractedReport(_0xf5f2('0x12'));}var _0x3e5956=[];var _0x5c01b8=0x0;var _0x5850f4=!![];var _0xea612c=path[_0xf5f2('0x13')](PATH);var _0x1c1a5c=path[_0xf5f2('0x14')](PATH,'.pdf');var _0xafe430=![];var _0x286197=[];return db[_0xf5f2('0x15')][_0xf5f2('0x16')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf5f2('0x17'),_0xf5f2('0x18')]})[_0xf5f2('0x19')](function(_0x395a5a){if(_0x395a5a){_0x331482=_0x395a5a;_0x14b51f=_0x331482[_0xf5f2('0x18')]||0x3e8;}})[_0xf5f2('0x19')](function(){if(_0x336f6b&&_0x336f6b[_0xf5f2('0x1a')]){var _0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f);if(_0x331482[_0xf5f2('0x17')]){for(;_0x5850f4;_0x5c01b8+=_0x14b51f,_0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f)){if(_0x28e097==0x0||_0x28e097==_0x336f6b[0x0][_0xf5f2('0x11')]){_0x5850f4=![];}_0x3e5956[_0xf5f2('0x10')](dbH['sequelize'][_0xf5f2('0x1b')](util[_0xf5f2('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x14b51f,_0x5c01b8),{'type':dbH['sequelize'][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}else{_0x3e5956['push'](dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](QUERY,{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}_0xafe430=_0x331482['split']&&_0x3e5956[_0xf5f2('0x1a')]>0x1;if(!fs[_0xf5f2('0x20')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c))&&_0xafe430){fs[_0xf5f2('0x22')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c));}return BPromise['each'](_0x3e5956,function(_0x529f07){_0x286197[_0xf5f2('0x10')](_0x529f07);});})[_0xf5f2('0x19')](function(){return BPromise[_0xf5f2('0x23')](_0x3e5956,function(_0x1a5bb3,_0xf6c58d){var _0x788a8d;var _0x13a3be=util[_0xf5f2('0x1c')](_0xf5f2('0x24'),NAME,_extractedReport['name'],moment(_extractedReport[_0xf5f2('0x25')])[_0xf5f2('0x1c')](FORMAT),moment(_extractedReport[_0xf5f2('0x26')])[_0xf5f2('0x1c')](FORMAT));var _0x198c73={'pageSize':'A4','pageOrientation':_0xf5f2('0x27'),'content':[{'text':_0x13a3be,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'}}};var _0x22c826={'headerRows':0x1,'body':[]};_0x22c826[_0xf5f2('0x28')][_0xf5f2('0x10')](getHeader(_0x1a5bb3[0x0]));var _0x5027ab;for(var _0x5a2c7e=0x0;_0x5a2c7e<_0x1a5bb3[_0xf5f2('0x1a')];_0x5a2c7e+=0x1){_0x5027ab=[];for(var _0x50b8a2 in _0x1a5bb3[_0x5a2c7e]){if(_0x1a5bb3[_0x5a2c7e][_0xf5f2('0xf')](_0x50b8a2)){_0x5027ab[_0xf5f2('0x10')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]?_[_0xf5f2('0x29')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]):'');}}_0x22c826['body']['push'](_0x5027ab);}_0x198c73[_0xf5f2('0x2a')]['push']({'table':_0x22c826});return new BPromise(function(_0xb744b9,_0x58a4df){var _0x45b643=new PdfPrinter({'Roboto':{'normal':__dirname+_0xf5f2('0x2b'),'bold':__dirname+_0xf5f2('0x2c'),'italics':__dirname+_0xf5f2('0x2d'),'bolditalics':__dirname+_0xf5f2('0x2e')}});var _0x277eee=_0x45b643[_0xf5f2('0x2f')](_0x198c73);if(_0xafe430){_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c,util['format'](_0xf5f2('0x30'),_0x1c1a5c,_0xf6c58d,_0xf5f2('0x31')));}else{_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xf5f2('0x31')));}var _0x297c0c=_0x277eee['pipe'](fs[_0xf5f2('0x33')](_0x788a8d));_0x297c0c['on'](_0xf5f2('0x34'),function(){_0xb744b9();});_0x297c0c['on']('error',function(_0x3fc168){console['log'](_0xf5f2('0x35'),_0x3fc168);_0x58a4df(_0x3fc168);});_0x277eee[_0xf5f2('0x36')]();});});})[_0xf5f2('0x19')](function(){if(_0xafe430){return new BPromise(function(_0x2e3cca,_0x59a6dd){zipdir(path['join'](_0xea612c,_0x1c1a5c),{'saveTo':path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,'zip'))},function(_0x41447f){if(_0x41447f){_0x59a6dd(_0x41447f);}else{_0x2e3cca();}});});}})['then'](function(){if(_0xafe430){rimraf(path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c),function(){});}})['then'](function(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xf5f2('0x38')));return analyticExtractedReport(_0xf5f2('0x39'),_0xafe430?util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xafe430?'zip':'pdf'):null);});}function main(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')](_0xf5f2('0x3a'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')));return db[_0xf5f2('0xe')][_0xf5f2('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf5f2('0x19')](function(_0x4c0ac7){_extractedReport=_0x4c0ac7;return dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](util['format'](_0xf5f2('0x3d'),QUERY),{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]});})[_0xf5f2('0x19')](extractReport)[_0xf5f2('0x3e')](function(_0x462ea3){logger[_0xf5f2('0x37')](util['format'](_0xf5f2('0x3f'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')),util[_0xf5f2('0x40')](_0x462ea3,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}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(_0x5a34c6,_0x3ceb6f){var _0x437596=function(_0x16b571){while(--_0x16b571){_0x5a34c6['push'](_0x5a34c6['shift']());}};_0x437596(++_0x3ceb6f);}(_0xb10b,0x12a));var _0xbb10=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xb10b[_0x3511d3];return _0x5d6321;};'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 cfea593..b4abd9b 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 _0x8df6=['catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','util','path','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','push','dirname','basename','.xlsx','existsSync','join','mkdirSync','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed'];(function(_0x1296fe,_0x329852){var _0x10466e=function(_0x2b4b4d){while(--_0x2b4b4d){_0x1296fe['push'](_0x1296fe['shift']());}};_0x10466e(++_0x329852);}(_0x8df6,0xee));var _0x68df=function(_0xac89f9,_0x2f5de5){_0xac89f9=_0xac89f9-0x0;var _0x2eeb59=_0x8df6[_0xac89f9];return _0x2eeb59;};'use strict';var util=require(_0x68df('0x0'));var path=require(_0x68df('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x68df('0x2'));var BPromise=require(_0x68df('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x68df('0x4'));var db=require(_0x68df('0x5'))['db'];var dbH=require('../../mysqldb')[_0x68df('0x6')];var logger=require(_0x68df('0x7'))(_0x68df('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x68df('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x68df('0x9')][0x4];function analyticExtractedReport(_0x313251,_0x41bff5){var _0x7b6b14={'status':_0x313251};var _0x4572b6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x41bff5){_0x7b6b14[_0x68df('0xa')]=_0x41bff5;}return db[_0x68df('0xb')][_0x68df('0xc')](_0x7b6b14,_0x4572b6);}function main(){var _0x3d5aff=0x1388;var _0x2e8fa2;logger[_0x68df('0xd')](util[_0x68df('0xe')](_0x68df('0xf'),EXTRACTED_REPORT_ID,_0x68df('0x10')));return db[_0x68df('0x11')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x68df('0x12'),_0x68df('0x13')]})[_0x68df('0x14')](function(_0x3ee3d1){if(_0x3ee3d1){_0x2e8fa2=_0x3ee3d1;_0x3d5aff=_0x2e8fa2[_0x68df('0x13')]||0x1388;}})[_0x68df('0x14')](function(){return dbH[_0x68df('0x15')][_0x68df('0x16')](util[_0x68df('0xe')](_0x68df('0x17'),QUERY),{'type':dbH['sequelize'][_0x68df('0x18')][_0x68df('0x19')]});})[_0x68df('0x14')](function(_0x4e79aa){if(!_0x4e79aa[0x0][_0x68df('0x1a')]){return analyticExtractedReport(_0x68df('0x1b'));}var _0x19f726=[];var _0x4e1530=0x0;var _0x50273d=!![];if(_0x2e8fa2['split']){if(_0x4e79aa&&_0x4e79aa[_0x68df('0x1c')]){var _0x3f62e9=_0x4e79aa[0x0][_0x68df('0x1a')]%(_0x4e1530+_0x3d5aff);for(;_0x50273d;_0x4e1530+=_0x3d5aff,_0x3f62e9=_0x4e79aa[0x0][_0x68df('0x1a')]%(_0x4e1530+_0x3d5aff)){if(_0x3f62e9==0x0||_0x3f62e9==_0x4e79aa[0x0][_0x68df('0x1a')]){_0x50273d=![];}_0x19f726[_0x68df('0x1d')](dbH['sequelize'][_0x68df('0x16')](util[_0x68df('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3d5aff,_0x4e1530),{'type':dbH[_0x68df('0x15')]['QueryTypes'][_0x68df('0x19')]}));}}}else{_0x19f726[_0x68df('0x1d')](dbH[_0x68df('0x15')][_0x68df('0x16')](QUERY,{'type':dbH[_0x68df('0x15')][_0x68df('0x18')][_0x68df('0x19')]}));}var _0x3dc6f4=path[_0x68df('0x1e')](PATH);var _0x2c8f23=path[_0x68df('0x1f')](PATH,_0x68df('0x20'));var _0x186e4c=_0x2e8fa2[_0x68df('0x12')]&&_0x19f726[_0x68df('0x1c')]>0x1;var _0x423d41=[];if(!fs[_0x68df('0x21')](path[_0x68df('0x22')](_0x3dc6f4,_0x2c8f23))&&_0x186e4c){fs[_0x68df('0x23')](path[_0x68df('0x22')](_0x3dc6f4,_0x2c8f23));}return BPromise['each'](_0x19f726,function(_0x5cb1ea){_0x423d41['push'](_0x5cb1ea);})['then'](function(){for(var _0x483ebc=0x0;_0x483ebc<_0x423d41['length'];_0x483ebc+=0x1){var _0x519b0a;var _0x7a3d44=_0x423d41[_0x483ebc];if(_0x186e4c){_0x519b0a=path['join'](_0x3dc6f4,_0x2c8f23,util[_0x68df('0xe')](_0x68df('0x24'),_0x2c8f23,_0x483ebc,_0x68df('0x25')));}else{_0x519b0a=path[_0x68df('0x22')](_0x3dc6f4,util[_0x68df('0xe')](_0x68df('0x26'),_0x2c8f23,_0x68df('0x25')));}fs[_0x68df('0x27')](_0x519b0a,json2xls(_0x7a3d44),_0x68df('0x28'));}})['then'](function(){if(_0x186e4c){zipdir(path[_0x68df('0x22')](_0x3dc6f4,_0x2c8f23),{'saveTo':path[_0x68df('0x22')](_0x3dc6f4,util[_0x68df('0xe')]('%s.%s',_0x2c8f23,_0x68df('0x29')))},function(_0x3a6744,_0x4bf63a){});rimraf(path['join'](_0x3dc6f4,_0x2c8f23),function(){});}})[_0x68df('0x14')](function(){logger['info'](util[_0x68df('0xe')](_0x68df('0x2a'),EXTRACTED_REPORT_ID,_0x68df('0x10')));return analyticExtractedReport(_0x68df('0x2b'),_0x186e4c?util[_0x68df('0xe')](_0x68df('0x26'),_0x2c8f23,_0x186e4c?_0x68df('0x29'):_0x68df('0x25')):null);});})[_0x68df('0x2c')](function(_0x2e7840){logger['info'](util['format'](_0x68df('0x2d'),EXTRACTED_REPORT_ID,_0x68df('0x10')),util[_0x68df('0x2e')](_0x2e7840,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0x6a68=['QueryTypes','SELECT','num','Empty','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','length','existsSync','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0x405385,_0x56f573){var _0x43837b=function(_0x30e20e){while(--_0x30e20e){_0x405385['push'](_0x405385['shift']());}};_0x43837b(++_0x56f573);}(_0x6a68,0x138));var _0x86a6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x6a68[_0x4154a6];return _0x3b2786;};'use strict';var util=require(_0x86a6('0x0'));var path=require(_0x86a6('0x1'));var _=require(_0x86a6('0x2'));var fs=require('fs');var json2xls=require(_0x86a6('0x3'));var BPromise=require(_0x86a6('0x4'));var zipdir=require(_0x86a6('0x5'));var rimraf=require(_0x86a6('0x6'));var db=require(_0x86a6('0x7'))['db'];var dbH=require('../../mysqldb')[_0x86a6('0x8')];var logger=require(_0x86a6('0x9'))(_0x86a6('0xa'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x86a6('0xb')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x7b3081,_0x587e70){var _0x1d28a5={'status':_0x7b3081};var _0x584959={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x587e70){_0x1d28a5[_0x86a6('0xc')]=_0x587e70;}return db['AnalyticExtractedReport']['update'](_0x1d28a5,_0x584959);}function main(){var _0x588088=0x1388;var _0x5c16f2;logger[_0x86a6('0xd')](util[_0x86a6('0xe')](_0x86a6('0xf'),EXTRACTED_REPORT_ID,_0x86a6('0x10')));return db[_0x86a6('0x11')][_0x86a6('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x86a6('0x13'),_0x86a6('0x14')]})[_0x86a6('0x15')](function(_0x4257a6){if(_0x4257a6){_0x5c16f2=_0x4257a6;_0x588088=_0x5c16f2['splitSizeXlsx']||0x1388;}})[_0x86a6('0x15')](function(){return dbH[_0x86a6('0x16')]['query'](util[_0x86a6('0xe')](_0x86a6('0x17'),QUERY),{'type':dbH[_0x86a6('0x16')][_0x86a6('0x18')][_0x86a6('0x19')]});})[_0x86a6('0x15')](function(_0x49b570){if(!_0x49b570[0x0][_0x86a6('0x1a')]){return analyticExtractedReport(_0x86a6('0x1b'));}var _0x1c9786=[];var _0xae2e0c=0x0;var _0x3bbd22=!![];if(_0x5c16f2[_0x86a6('0x13')]){if(_0x49b570&&_0x49b570['length']){var _0x5aa42e=_0x49b570[0x0][_0x86a6('0x1a')]%(_0xae2e0c+_0x588088);for(;_0x3bbd22;_0xae2e0c+=_0x588088,_0x5aa42e=_0x49b570[0x0][_0x86a6('0x1a')]%(_0xae2e0c+_0x588088)){if(_0x5aa42e==0x0||_0x5aa42e==_0x49b570[0x0][_0x86a6('0x1a')]){_0x3bbd22=![];}_0x1c9786[_0x86a6('0x1c')](dbH[_0x86a6('0x16')][_0x86a6('0x1d')](util['format'](_0x86a6('0x1e'),QUERY,_0x588088,_0xae2e0c),{'type':dbH[_0x86a6('0x16')]['QueryTypes']['SELECT']}));}}}else{_0x1c9786[_0x86a6('0x1c')](dbH[_0x86a6('0x16')][_0x86a6('0x1d')](QUERY,{'type':dbH[_0x86a6('0x16')][_0x86a6('0x18')][_0x86a6('0x19')]}));}var _0x138a68=path[_0x86a6('0x1f')](PATH);var _0x4e29e5=path[_0x86a6('0x20')](PATH,_0x86a6('0x21'));var _0x3433c3=_0x5c16f2['split']&&_0x1c9786[_0x86a6('0x22')]>0x1;var _0x19cd4e=[];if(!fs[_0x86a6('0x23')](path[_0x86a6('0x24')](_0x138a68,_0x4e29e5))&&_0x3433c3){fs['mkdirSync'](path['join'](_0x138a68,_0x4e29e5));}return BPromise[_0x86a6('0x25')](_0x1c9786,function(_0xd8235a){_0x19cd4e[_0x86a6('0x1c')](_0xd8235a);})[_0x86a6('0x15')](function(){for(var _0x50a9e2=0x0;_0x50a9e2<_0x19cd4e['length'];_0x50a9e2+=0x1){var _0xeaf4c9;var _0x773b5b=_0x19cd4e[_0x50a9e2];if(_0x3433c3){_0xeaf4c9=path[_0x86a6('0x24')](_0x138a68,_0x4e29e5,util['format'](_0x86a6('0x26'),_0x4e29e5,_0x50a9e2,_0x86a6('0x27')));}else{_0xeaf4c9=path[_0x86a6('0x24')](_0x138a68,util['format'](_0x86a6('0x28'),_0x4e29e5,_0x86a6('0x27')));}fs[_0x86a6('0x29')](_0xeaf4c9,json2xls(_0x773b5b),'binary');}})['then'](function(){if(_0x3433c3){zipdir(path[_0x86a6('0x24')](_0x138a68,_0x4e29e5),{'saveTo':path[_0x86a6('0x24')](_0x138a68,util[_0x86a6('0xe')]('%s.%s',_0x4e29e5,'zip'))},function(_0x135cc2,_0x14c3ff){});rimraf(path['join'](_0x138a68,_0x4e29e5),function(){});}})[_0x86a6('0x15')](function(){logger[_0x86a6('0xd')](util[_0x86a6('0xe')](_0x86a6('0x2a'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x86a6('0x2b'),_0x3433c3?util['format'](_0x86a6('0x28'),_0x4e29e5,_0x3433c3?'zip':_0x86a6('0x27')):null);});})[_0x86a6('0x2c')](function(_0x14093b){logger['info'](util[_0x86a6('0xe')](_0x86a6('0x2d'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x86a6('0x2e')](_0x14093b,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x86a6('0x2f'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index debddec..4416973 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 _0x4de5=['filter','groupBy','playback','hasOwnProperty','extensions','extension','find','type','format','context','priority','outbound','push','CDR(destination)=','${EXTEN:','cutdigits','VoiceExtensionId','Set','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','tag','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','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','concat','Hangup','bulkCreate','sortBy','catch','error','rewrite','util','models','Interval','findAll','then','intervals','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)'];(function(_0x2e2fb3,_0x628269){var _0x42125a=function(_0x1e1a80){while(--_0x1e1a80){_0x2e2fb3['push'](_0x2e2fb3['shift']());}};_0x42125a(++_0x628269);}(_0x4de5,0xbb));var _0x54de=function(_0x5deea7,_0x122937){_0x5deea7=_0x5deea7-0x0;var _0x4e95eb=_0x4de5[_0x5deea7];return _0x4e95eb;};'use strict';var _=require('lodash');var util=require(_0x54de('0x0'));function rewrite(_0x4b5213,_0x143539){var _0x2a88a2=this;return _0x4b5213[_0x54de('0x1')][_0x54de('0x2')][_0x54de('0x3')]({'raw':!![]})[_0x54de('0x4')](function(_0x356ff6){_0x2a88a2[_0x54de('0x5')]=_0x356ff6;return _0x4b5213[_0x54de('0x1')]['VoiceExtension'][_0x54de('0x3')]({'where':{'IntervalId':_0x143539['IntervalId']},'raw':!![]});})[_0x54de('0x4')](function(_0x423a72){return _0x4b5213[_0x54de('0x1')][_0x54de('0x6')][_0x54de('0x3')]({'where':{'exten':{'$in':_[_0x54de('0x7')](_[_0x54de('0x8')](_0x423a72,_0x54de('0x9')))}},'order':[{'raw':_0x54de('0xa')}],'raw':!![]});})[_0x54de('0x4')](function(_0x31991e){var _0xdaf277=_['filter'](_0x31991e,{'priority':'1'});var _0x4484c5=_[_0x54de('0xb')](_0x31991e,{'isApp':0x1});var _0xd26666=_[_0x54de('0xc')](_0x4484c5,'exten');var _0x57d80f=['queue',_0x54de('0xd')];var _0x22ae74=[];var _0x22e3e3=[];for(var _0x43e2e9 in _0xd26666){if(_0xd26666[_0x54de('0xe')](_0x43e2e9)){_0x2a88a2['priority']=0x2;_0x2a88a2[_0x54de('0xf')]=[];_0x2a88a2[_0x54de('0x10')]=_[_0x54de('0x11')](_0xdaf277,{'exten':_0xd26666[_0x43e2e9][0x0][_0x54de('0x9')]});_0x2a88a2['extensions']['push']({'type':_0xd26666[_0x43e2e9][0x0][_0x54de('0x12')],'app':'Set','appdata':util[_0x54de('0x13')]('CDR(type)=%s',_0xd26666[_0x43e2e9][0x0][_0x54de('0x12')]),'context':_0xd26666[_0x43e2e9][0x0][_0x54de('0x14')],'exten':_0xd26666[_0x43e2e9][0x0][_0x54de('0x9')],'priority':_0x2a88a2[_0x54de('0x15')]++,'VoiceExtensionId':_0xd26666[_0x43e2e9][0x0]['VoiceExtensionId']});if(_0xd26666[_0x43e2e9][0x0][_0x54de('0x12')]===_0x54de('0x16')){if(_0x2a88a2[_0x54de('0x10')]){_0x2a88a2[_0x54de('0xf')][_0x54de('0x17')]({'type':_0xd26666[_0x43e2e9][0x0][_0x54de('0x12')],'app':'Set','appdata':_0x54de('0x18')+(_0x2a88a2['extension']['cutdigits']?_0x54de('0x19')+_0x2a88a2[_0x54de('0x10')][_0x54de('0x1a')]+'}':'${EXTEN}'),'context':_0xd26666[_0x43e2e9][0x0]['context'],'exten':_0xd26666[_0x43e2e9][0x0]['exten'],'priority':_0x2a88a2[_0x54de('0x15')]++,'VoiceExtensionId':_0xd26666[_0x43e2e9][0x0][_0x54de('0x1b')]});}_0x2a88a2['extensions'][_0x54de('0x17')]({'type':_0xd26666[_0x43e2e9][0x0][_0x54de('0x12')],'app':_0x54de('0x1c'),'appdata':_0x54de('0x1d')+_0xd26666[_0x43e2e9][0x0]['VoiceExtensionId'],'context':_0xd26666[_0x43e2e9][0x0][_0x54de('0x14')],'exten':_0xd26666[_0x43e2e9][0x0]['exten'],'priority':_0x2a88a2[_0x54de('0x15')]++,'VoiceExtensionId':_0xd26666[_0x43e2e9][0x0][_0x54de('0x1b')]});var _0x1bfeb8=_0x2a88a2[_0x54de('0x15')]++;_0x2a88a2[_0x54de('0xf')]['push']({'type':_0xd26666[_0x43e2e9][0x0]['type'],'app':_0x54de('0x1e'),'appdata':_0x54de('0x1f')+(_0x1bfeb8+0x2)+_0x54de('0x20')+(_0x1bfeb8+0x1)+')','context':_0xd26666[_0x43e2e9][0x0]['context'],'exten':_0xd26666[_0x43e2e9][0x0]['exten'],'priority':_0x1bfeb8,'VoiceExtensionId':_0xd26666[_0x43e2e9][0x0][_0x54de('0x1b')]});if(_0x2a88a2[_0x54de('0x10')]){_0x2a88a2[_0x54de('0xf')][_0x54de('0x17')]({'type':_0xd26666[_0x43e2e9][0x0][_0x54de('0x12')],'app':_0x54de('0x1c'),'appdata':_0x2a88a2['extension'][_0x54de('0x1a')]?'CDR(prefix)=${EXTEN:0:'+_0x2a88a2[_0x54de('0x10')][_0x54de('0x1a')]+'}':_0x54de('0x21'),'context':_0xd26666[_0x43e2e9][0x0][_0x54de('0x14')],'exten':_0xd26666[_0x43e2e9][0x0][_0x54de('0x9')],'priority':_0x2a88a2['priority']++,'VoiceExtensionId':_0xd26666[_0x43e2e9][0x0]['VoiceExtensionId']});}_0x2a88a2['extensions'][_0x54de('0x17')]({'type':_0xd26666[_0x43e2e9][0x0][_0x54de('0x12')],'app':_0x54de('0x1c'),'appdata':_0x54de('0x22')+_0xd26666[_0x43e2e9][0x0][_0x54de('0x1b')],'context':_0xd26666[_0x43e2e9][0x0][_0x54de('0x14')],'exten':_0xd26666[_0x43e2e9][0x0][_0x54de('0x9')],'priority':_0x2a88a2[_0x54de('0x15')]++,'VoiceExtensionId':_0xd26666[_0x43e2e9][0x0][_0x54de('0x1b')]});if(_0x2a88a2[_0x54de('0x10')]&&_0x2a88a2[_0x54de('0x10')][_0x54de('0xe')](_0x54de('0x23'))&&_0x2a88a2[_0x54de('0x10')]['recordingFormat']!=='none'){_0x2a88a2[_0x54de('0xf')][_0x54de('0x17')]({'type':_0xd26666[_0x43e2e9][0x0]['type'],'app':_0x54de('0x1c'),'appdata':_0x54de('0x24'),'context':_0xd26666[_0x43e2e9][0x0]['context'],'exten':_0xd26666[_0x43e2e9][0x0][_0x54de('0x9')],'priority':_0x2a88a2[_0x54de('0x15')]++,'VoiceExtensionId':_0xd26666[_0x43e2e9][0x0][_0x54de('0x1b')]});_0x2a88a2[_0x54de('0xf')][_0x54de('0x17')]({'type':_0xd26666[_0x43e2e9][0x0][_0x54de('0x12')],'app':_0x54de('0x1c'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x2a88a2[_0x54de('0x10')]['recordingFormat']||_0x54de('0x25'),'context':_0xd26666[_0x43e2e9][0x0]['context'],'exten':_0xd26666[_0x43e2e9][0x0][_0x54de('0x9')],'priority':_0x2a88a2['priority']++,'VoiceExtensionId':_0xd26666[_0x43e2e9][0x0][_0x54de('0x1b')]});}}_0x2a88a2[_0x54de('0xf')][_0x54de('0x17')]({'type':_0xd26666[_0x43e2e9][0x0][_0x54de('0x12')],'app':_0x54de('0x1c'),'appdata':_0x54de('0x26'),'context':_0xd26666[_0x43e2e9][0x0][_0x54de('0x14')],'exten':_0xd26666[_0x43e2e9][0x0]['exten'],'priority':_0x2a88a2['priority']++,'VoiceExtensionId':_0xd26666[_0x43e2e9][0x0]['VoiceExtensionId']});_0x2a88a2[_0x54de('0xf')]['push']({'type':_0xd26666[_0x43e2e9][0x0][_0x54de('0x12')],'app':_0x54de('0x1c'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0xd26666[_0x43e2e9][0x0][_0x54de('0x14')],'exten':_0xd26666[_0x43e2e9][0x0][_0x54de('0x9')],'priority':_0x2a88a2[_0x54de('0x15')]++,'VoiceExtensionId':_0xd26666[_0x43e2e9][0x0][_0x54de('0x1b')]});_0x2a88a2['extensions'][_0x54de('0x17')]({'type':_0xd26666[_0x43e2e9][0x0]['type'],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0xd26666[_0x43e2e9][0x0][_0x54de('0x14')],'exten':_0xd26666[_0x43e2e9][0x0]['exten'],'priority':_0x2a88a2[_0x54de('0x15')]++,'VoiceExtensionId':_0xd26666[_0x43e2e9][0x0][_0x54de('0x1b')]});for(var _0x429de6=0x0,_0x2f50b4=0x0;_0x429de6<_0xd26666[_0x43e2e9][_0x54de('0x27')];_0x429de6+=0x1,_0x2f50b4=0x0){var _0x3aa2e9=_0xd26666[_0x43e2e9][_0x429de6];if(_0x3aa2e9[_0x54de('0x12')]){_0x3aa2e9[_0x54de('0x12')]=_0x3aa2e9[_0x54de('0x12')][_0x54de('0x28')]();}var _0x1f5405=[];var _0xfe60d2=[];delete _0x3aa2e9['id'];delete _0x3aa2e9[_0x54de('0x29')];delete _0x3aa2e9[_0x54de('0x2a')];var _0x2b275a=_0x3aa2e9[_0x54de('0x2b')]!==_0x54de('0x2c')?[_0x3aa2e9[_0x54de('0x2b')]]:_0x3aa2e9['IntervalId']?_[_0x54de('0x8')](_[_0x54de('0xb')](_0x2a88a2[_0x54de('0x5')],{'IntervalId':_0x3aa2e9[_0x54de('0x2d')]}),_0x54de('0x2b')):[];if(_0x3aa2e9[_0x54de('0xe')](_0x54de('0x2e'))){if(_0x3aa2e9[_0x54de('0x2e')]&&_0x3aa2e9[_0x54de('0x2e')]!=='--'){_0x1f5405[_0x54de('0x17')]({'type':_0x3aa2e9[_0x54de('0x12')],'app':_0x54de('0x1c'),'appdata':'CDR(tag)='+_0x3aa2e9['tag'],'context':_0x3aa2e9['context'],'exten':_0x3aa2e9[_0x54de('0x9')],'priority':_0x2b275a[_0x54de('0x27')]+_0x2a88a2[_0x54de('0x15')]+_0x2f50b4++,'VoiceExtensionId':_0x3aa2e9[_0x54de('0x1b')]});}}if(_0x3aa2e9[_0x54de('0x12')]===_0x54de('0x16')&&_0x3aa2e9[_0x54de('0xe')](_0x54de('0x2f'))){if(_0x3aa2e9[_0x54de('0x2f')]){_0x1f5405['push']({'type':_0x3aa2e9[_0x54de('0x12')],'app':_0x54de('0x1e'),'appdata':_0x54de('0x30')+_0x3aa2e9[_0x54de('0x2f')]+')','context':_0x3aa2e9[_0x54de('0x14')],'exten':_0x3aa2e9[_0x54de('0x9')],'priority':_0x2b275a[_0x54de('0x27')]+_0x2a88a2[_0x54de('0x15')]+_0x2f50b4++,'VoiceExtensionId':_0x3aa2e9[_0x54de('0x1b')]});}else{_0x1f5405[_0x54de('0x17')]({'type':_0x3aa2e9[_0x54de('0x12')],'app':'ExecIf','appdata':_0x54de('0x31'),'context':_0x3aa2e9[_0x54de('0x14')],'exten':_0x3aa2e9['exten'],'priority':_0x2b275a['length']+_0x2a88a2[_0x54de('0x15')]+_0x2f50b4++,'VoiceExtensionId':_0x3aa2e9[_0x54de('0x1b')]});}}if(_0x3aa2e9[_0x54de('0xe')](_0x54de('0x32'))){if(_0x57d80f['indexOf'](_0x3aa2e9[_0x54de('0x33')][_0x54de('0x28')]())>=0x0&&_0x3aa2e9[_0x54de('0x34')]!==_0x54de('0x35')){if(_0x3aa2e9[_0x54de('0x32')]){_0x1f5405['push']({'type':_0x3aa2e9[_0x54de('0x12')],'app':'ExecIf','appdata':_0x54de('0x36'),'context':_0x3aa2e9[_0x54de('0x14')],'exten':_0x3aa2e9[_0x54de('0x9')],'priority':_0x2b275a[_0x54de('0x27')]+_0x2a88a2[_0x54de('0x15')]+_0x2f50b4++,'VoiceExtensionId':_0x3aa2e9[_0x54de('0x1b')]});_0x1f5405[_0x54de('0x17')]({'type':_0x3aa2e9[_0x54de('0x12')],'app':_0x54de('0x1c'),'appdata':_0x54de('0x37'),'context':_0x3aa2e9[_0x54de('0x14')],'exten':_0x3aa2e9['exten'],'priority':_0x2b275a[_0x54de('0x27')]+_0x2a88a2[_0x54de('0x15')]+_0x2f50b4++,'VoiceExtensionId':_0x3aa2e9[_0x54de('0x1b')]});}else{_0x1f5405[_0x54de('0x17')]({'type':_0x3aa2e9['type'],'app':_0x54de('0x1e'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x3aa2e9['context'],'exten':_0x3aa2e9[_0x54de('0x9')],'priority':_0x2b275a['length']+_0x2a88a2['priority']+_0x2f50b4++,'VoiceExtensionId':_0x3aa2e9[_0x54de('0x1b')]});_0x1f5405[_0x54de('0x17')]({'type':_0x3aa2e9['type'],'app':_0x54de('0x1c'),'appdata':_0x54de('0x38'),'context':_0x3aa2e9[_0x54de('0x14')],'exten':_0x3aa2e9['exten'],'priority':_0x2b275a[_0x54de('0x27')]+_0x2a88a2[_0x54de('0x15')]+_0x2f50b4++,'VoiceExtensionId':_0x3aa2e9['VoiceExtensionId']});}}}for(var _0x192ae8=0x0;_0x192ae8<_0x2b275a[_0x54de('0x27')];_0x192ae8+=0x1){var _0x4a9175=_0x2a88a2[_0x54de('0x15')]+_0x2b275a[_0x54de('0x27')];var _0x135f34=_0x192ae8===_0x2b275a[_0x54de('0x27')]-0x1?_0x2a88a2[_0x54de('0x15')]+_0x1f5405[_0x54de('0x27')]+_0xfe60d2[_0x54de('0x27')]+0x2:_0x2a88a2['priority']+_0x192ae8+0x1;_0x1f5405[_0x54de('0x39')](_0x192ae8,0x0,{'type':_0x3aa2e9[_0x54de('0x12')],'app':'GotoIfTime','appdata':_0x2b275a[_0x192ae8]+'?'+_0x3aa2e9['context']+_0x54de('0x3a')+_0x4a9175+':'+_0x3aa2e9[_0x54de('0x14')]+_0x54de('0x3a')+_0x135f34,'exten':_0x3aa2e9['exten'],'context':_0x3aa2e9[_0x54de('0x14')],'priority':_0x2a88a2[_0x54de('0x15')]+_0x192ae8,'VoiceExtensionId':_0xd26666[_0x43e2e9][0x0][_0x54de('0x1b')]});}_0x3aa2e9[_0x54de('0x15')]=_0x1f5405['length']?_['last'](_0x1f5405)[_0x54de('0x15')]+0x1:_0x2a88a2[_0x54de('0x15')];_0x2a88a2[_0x54de('0x15')]=(_0xfe60d2[_0x54de('0x27')]?_['last'](_0xfe60d2)[_0x54de('0x15')]:_0x3aa2e9['priority'])+0x1;_0x2a88a2[_0x54de('0xf')]=_[_0x54de('0x3b')](_0x2a88a2[_0x54de('0xf')],_0x1f5405,[_0x3aa2e9],_0xfe60d2);}_0x2a88a2[_0x54de('0xf')][_0x54de('0x17')]({'type':_0xd26666[_0x43e2e9][0x0][_0x54de('0x12')],'app':_0x54de('0x3c'),'exten':_0xd26666[_0x43e2e9][0x0][_0x54de('0x9')],'context':_0xd26666[_0x43e2e9][0x0]['context'],'priority':_0x2a88a2[_0x54de('0x15')],'VoiceExtensionId':_0xd26666[_0x43e2e9][0x0][_0x54de('0x1b')]});_0x22ae74[_0x54de('0x17')](_0xd26666[_0x43e2e9][0x0][_0x54de('0x1b')]);_0x22e3e3=_[_0x54de('0x3b')](_0x22e3e3,_0x2a88a2[_0x54de('0xf')]);}}return _0x4b5213['transaction'](function(_0x6a5fd1){return _0x4b5213[_0x54de('0x1')]['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x22ae74}},'transaction':_0x6a5fd1})['then'](function(_0x422794){return _0x4b5213['models'][_0x54de('0x6')][_0x54de('0x3d')](_[_0x54de('0x3e')](_0x22e3e3,_0x54de('0x15')),{'transaction':_0x6a5fd1});});});})[_0x54de('0x3f')](function(_0x1c3dbe){console[_0x54de('0x40')](_0x1c3dbe);});}exports[_0x54de('0x41')]=rewrite; \ No newline at end of file +var _0x0472=['push','Set','format','CDR(type)=%s','type','context','outbound','cutdigits','${EXTEN:','${EXTEN}','VoiceExtensionId','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','intervals','tag','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','catch','error','rewrite','models','Interval','findAll','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','then','filter','groupBy','queue','playback','hasOwnProperty','priority','extension','find','extensions'];(function(_0x20233c,_0x532072){var _0x530424=function(_0xc23cbe){while(--_0xc23cbe){_0x20233c['push'](_0x20233c['shift']());}};_0x530424(++_0x532072);}(_0x0472,0x197));var _0x2047=function(_0x1fc6fc,_0x108e05){_0x1fc6fc=_0x1fc6fc-0x0;var _0x278e54=_0x0472[_0x1fc6fc];return _0x278e54;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x4dda98,_0x4c972a){var _0x3d1aad=this;return _0x4dda98[_0x2047('0x0')][_0x2047('0x1')][_0x2047('0x2')]({'raw':!![]})['then'](function(_0x1c05af){_0x3d1aad['intervals']=_0x1c05af;return _0x4dda98[_0x2047('0x0')][_0x2047('0x3')][_0x2047('0x2')]({'where':{'IntervalId':_0x4c972a[_0x2047('0x4')]},'raw':!![]});})['then'](function(_0x8561de){return _0x4dda98[_0x2047('0x0')][_0x2047('0x3')][_0x2047('0x2')]({'where':{'exten':{'$in':_[_0x2047('0x5')](_[_0x2047('0x6')](_0x8561de,_0x2047('0x7')))}},'order':[{'raw':_0x2047('0x8')}],'raw':!![]});})[_0x2047('0x9')](function(_0x5e6bf2){var _0x17f863=_[_0x2047('0xa')](_0x5e6bf2,{'priority':'1'});var _0x5f2008=_[_0x2047('0xa')](_0x5e6bf2,{'isApp':0x1});var _0x3b11a8=_[_0x2047('0xb')](_0x5f2008,_0x2047('0x7'));var _0x1c4ac0=[_0x2047('0xc'),_0x2047('0xd')];var _0x4180f7=[];var _0xe066fd=[];for(var _0x21bc90 in _0x3b11a8){if(_0x3b11a8[_0x2047('0xe')](_0x21bc90)){_0x3d1aad[_0x2047('0xf')]=0x2;_0x3d1aad['extensions']=[];_0x3d1aad[_0x2047('0x10')]=_[_0x2047('0x11')](_0x17f863,{'exten':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x7')]});_0x3d1aad[_0x2047('0x12')][_0x2047('0x13')]({'type':_0x3b11a8[_0x21bc90][0x0]['type'],'app':_0x2047('0x14'),'appdata':util[_0x2047('0x15')](_0x2047('0x16'),_0x3b11a8[_0x21bc90][0x0][_0x2047('0x17')]),'context':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x18')],'exten':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x7')],'priority':_0x3d1aad[_0x2047('0xf')]++,'VoiceExtensionId':_0x3b11a8[_0x21bc90][0x0]['VoiceExtensionId']});if(_0x3b11a8[_0x21bc90][0x0]['type']===_0x2047('0x19')){if(_0x3d1aad[_0x2047('0x10')]){_0x3d1aad[_0x2047('0x12')]['push']({'type':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x17')],'app':_0x2047('0x14'),'appdata':'CDR(destination)='+(_0x3d1aad['extension'][_0x2047('0x1a')]?_0x2047('0x1b')+_0x3d1aad['extension'][_0x2047('0x1a')]+'}':_0x2047('0x1c')),'context':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x18')],'exten':_0x3b11a8[_0x21bc90][0x0]['exten'],'priority':_0x3d1aad['priority']++,'VoiceExtensionId':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x1d')]});}_0x3d1aad['extensions']['push']({'type':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x17')],'app':_0x2047('0x14'),'appdata':_0x2047('0x1e')+_0x3b11a8[_0x21bc90][0x0][_0x2047('0x1d')],'context':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x18')],'exten':_0x3b11a8[_0x21bc90][0x0]['exten'],'priority':_0x3d1aad[_0x2047('0xf')]++,'VoiceExtensionId':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x1d')]});var _0x40d6df=_0x3d1aad[_0x2047('0xf')]++;_0x3d1aad[_0x2047('0x12')][_0x2047('0x13')]({'type':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x17')],'app':'ExecIf','appdata':_0x2047('0x1f')+(_0x40d6df+0x2)+_0x2047('0x20')+(_0x40d6df+0x1)+')','context':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x18')],'exten':_0x3b11a8[_0x21bc90][0x0]['exten'],'priority':_0x40d6df,'VoiceExtensionId':_0x3b11a8[_0x21bc90][0x0]['VoiceExtensionId']});if(_0x3d1aad['extension']){_0x3d1aad[_0x2047('0x12')][_0x2047('0x13')]({'type':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x17')],'app':_0x2047('0x14'),'appdata':_0x3d1aad['extension'][_0x2047('0x1a')]?_0x2047('0x21')+_0x3d1aad[_0x2047('0x10')][_0x2047('0x1a')]+'}':_0x2047('0x22'),'context':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x18')],'exten':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x7')],'priority':_0x3d1aad[_0x2047('0xf')]++,'VoiceExtensionId':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x1d')]});}_0x3d1aad['extensions'][_0x2047('0x13')]({'type':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x17')],'app':_0x2047('0x14'),'appdata':_0x2047('0x23')+_0x3b11a8[_0x21bc90][0x0][_0x2047('0x1d')],'context':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x18')],'exten':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x7')],'priority':_0x3d1aad[_0x2047('0xf')]++,'VoiceExtensionId':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x1d')]});if(_0x3d1aad[_0x2047('0x10')]&&_0x3d1aad[_0x2047('0x10')][_0x2047('0xe')](_0x2047('0x24'))&&_0x3d1aad[_0x2047('0x10')]['recordingFormat']!==_0x2047('0x25')){_0x3d1aad[_0x2047('0x12')][_0x2047('0x13')]({'type':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x17')],'app':_0x2047('0x14'),'appdata':_0x2047('0x26'),'context':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x18')],'exten':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x7')],'priority':_0x3d1aad[_0x2047('0xf')]++,'VoiceExtensionId':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x1d')]});_0x3d1aad[_0x2047('0x12')][_0x2047('0x13')]({'type':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x17')],'app':_0x2047('0x14'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x3d1aad['extension'][_0x2047('0x24')]||_0x2047('0x27'),'context':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x18')],'exten':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x7')],'priority':_0x3d1aad[_0x2047('0xf')]++,'VoiceExtensionId':_0x3b11a8[_0x21bc90][0x0]['VoiceExtensionId']});}}_0x3d1aad['extensions'][_0x2047('0x13')]({'type':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x17')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x18')],'exten':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x7')],'priority':_0x3d1aad['priority']++,'VoiceExtensionId':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x1d')]});_0x3d1aad[_0x2047('0x12')][_0x2047('0x13')]({'type':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x17')],'app':_0x2047('0x14'),'appdata':_0x2047('0x28'),'context':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x18')],'exten':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x7')],'priority':_0x3d1aad['priority']++,'VoiceExtensionId':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x1d')]});_0x3d1aad[_0x2047('0x12')][_0x2047('0x13')]({'type':_0x3b11a8[_0x21bc90][0x0]['type'],'app':'Set','appdata':_0x2047('0x29'),'context':_0x3b11a8[_0x21bc90][0x0]['context'],'exten':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x7')],'priority':_0x3d1aad['priority']++,'VoiceExtensionId':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x1d')]});for(var _0x181867=0x0,_0x3fe0ac=0x0;_0x181867<_0x3b11a8[_0x21bc90][_0x2047('0x2a')];_0x181867+=0x1,_0x3fe0ac=0x0){var _0x149219=_0x3b11a8[_0x21bc90][_0x181867];if(_0x149219[_0x2047('0x17')]){_0x149219[_0x2047('0x17')]=_0x149219[_0x2047('0x17')][_0x2047('0x2b')]();}var _0x580f66=[];var _0x31475b=[];delete _0x149219['id'];delete _0x149219[_0x2047('0x2c')];delete _0x149219[_0x2047('0x2d')];var _0x511fa6=_0x149219[_0x2047('0x2e')]!==_0x2047('0x2f')?[_0x149219[_0x2047('0x2e')]]:_0x149219[_0x2047('0x4')]?_[_0x2047('0x6')](_[_0x2047('0xa')](_0x3d1aad[_0x2047('0x30')],{'IntervalId':_0x149219['IntervalId']}),_0x2047('0x2e')):[];if(_0x149219[_0x2047('0xe')](_0x2047('0x31'))){if(_0x149219[_0x2047('0x31')]&&_0x149219[_0x2047('0x31')]!=='--'){_0x580f66[_0x2047('0x13')]({'type':_0x149219[_0x2047('0x17')],'app':'Set','appdata':'CDR(tag)='+_0x149219['tag'],'context':_0x149219[_0x2047('0x18')],'exten':_0x149219[_0x2047('0x7')],'priority':_0x511fa6[_0x2047('0x2a')]+_0x3d1aad[_0x2047('0xf')]+_0x3fe0ac++,'VoiceExtensionId':_0x149219[_0x2047('0x1d')]});}}if(_0x149219[_0x2047('0x17')]===_0x2047('0x19')&&_0x149219[_0x2047('0xe')](_0x2047('0x32'))){if(_0x149219[_0x2047('0x32')]){_0x580f66['push']({'type':_0x149219[_0x2047('0x17')],'app':_0x2047('0x33'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x149219[_0x2047('0x32')]+')','context':_0x149219[_0x2047('0x18')],'exten':_0x149219[_0x2047('0x7')],'priority':_0x511fa6['length']+_0x3d1aad[_0x2047('0xf')]+_0x3fe0ac++,'VoiceExtensionId':_0x149219[_0x2047('0x1d')]});}else{_0x580f66[_0x2047('0x13')]({'type':_0x149219[_0x2047('0x17')],'app':_0x2047('0x33'),'appdata':_0x2047('0x34'),'context':_0x149219[_0x2047('0x18')],'exten':_0x149219[_0x2047('0x7')],'priority':_0x511fa6[_0x2047('0x2a')]+_0x3d1aad[_0x2047('0xf')]+_0x3fe0ac++,'VoiceExtensionId':_0x149219[_0x2047('0x1d')]});}}if(_0x149219[_0x2047('0xe')](_0x2047('0x35'))){if(_0x1c4ac0[_0x2047('0x36')](_0x149219[_0x2047('0x37')]['toLowerCase']())>=0x0&&_0x149219[_0x2047('0x38')]!=='custom'){if(_0x149219[_0x2047('0x35')]){_0x580f66[_0x2047('0x13')]({'type':_0x149219[_0x2047('0x17')],'app':_0x2047('0x33'),'appdata':_0x2047('0x39'),'context':_0x149219['context'],'exten':_0x149219[_0x2047('0x7')],'priority':_0x511fa6[_0x2047('0x2a')]+_0x3d1aad[_0x2047('0xf')]+_0x3fe0ac++,'VoiceExtensionId':_0x149219['VoiceExtensionId']});_0x580f66[_0x2047('0x13')]({'type':_0x149219[_0x2047('0x17')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x149219[_0x2047('0x18')],'exten':_0x149219['exten'],'priority':_0x511fa6['length']+_0x3d1aad[_0x2047('0xf')]+_0x3fe0ac++,'VoiceExtensionId':_0x149219[_0x2047('0x1d')]});}else{_0x580f66['push']({'type':_0x149219[_0x2047('0x17')],'app':_0x2047('0x33'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x149219['context'],'exten':_0x149219['exten'],'priority':_0x511fa6['length']+_0x3d1aad[_0x2047('0xf')]+_0x3fe0ac++,'VoiceExtensionId':_0x149219[_0x2047('0x1d')]});_0x580f66[_0x2047('0x13')]({'type':_0x149219['type'],'app':_0x2047('0x14'),'appdata':_0x2047('0x3a'),'context':_0x149219['context'],'exten':_0x149219['exten'],'priority':_0x511fa6['length']+_0x3d1aad['priority']+_0x3fe0ac++,'VoiceExtensionId':_0x149219[_0x2047('0x1d')]});}}}for(var _0x52e000=0x0;_0x52e000<_0x511fa6['length'];_0x52e000+=0x1){var _0x299da5=_0x3d1aad[_0x2047('0xf')]+_0x511fa6[_0x2047('0x2a')];var _0x2947af=_0x52e000===_0x511fa6[_0x2047('0x2a')]-0x1?_0x3d1aad[_0x2047('0xf')]+_0x580f66['length']+_0x31475b[_0x2047('0x2a')]+0x2:_0x3d1aad[_0x2047('0xf')]+_0x52e000+0x1;_0x580f66[_0x2047('0x3b')](_0x52e000,0x0,{'type':_0x149219[_0x2047('0x17')],'app':_0x2047('0x3c'),'appdata':_0x511fa6[_0x52e000]+'?'+_0x149219[_0x2047('0x18')]+_0x2047('0x3d')+_0x299da5+':'+_0x149219[_0x2047('0x18')]+_0x2047('0x3d')+_0x2947af,'exten':_0x149219[_0x2047('0x7')],'context':_0x149219[_0x2047('0x18')],'priority':_0x3d1aad[_0x2047('0xf')]+_0x52e000,'VoiceExtensionId':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x1d')]});}_0x149219[_0x2047('0xf')]=_0x580f66['length']?_[_0x2047('0x3e')](_0x580f66)[_0x2047('0xf')]+0x1:_0x3d1aad[_0x2047('0xf')];_0x3d1aad[_0x2047('0xf')]=(_0x31475b[_0x2047('0x2a')]?_['last'](_0x31475b)[_0x2047('0xf')]:_0x149219['priority'])+0x1;_0x3d1aad[_0x2047('0x12')]=_[_0x2047('0x3f')](_0x3d1aad[_0x2047('0x12')],_0x580f66,[_0x149219],_0x31475b);}_0x3d1aad[_0x2047('0x12')][_0x2047('0x13')]({'type':_0x3b11a8[_0x21bc90][0x0]['type'],'app':_0x2047('0x40'),'exten':_0x3b11a8[_0x21bc90][0x0][_0x2047('0x7')],'context':_0x3b11a8[_0x21bc90][0x0]['context'],'priority':_0x3d1aad[_0x2047('0xf')],'VoiceExtensionId':_0x3b11a8[_0x21bc90][0x0]['VoiceExtensionId']});_0x4180f7[_0x2047('0x13')](_0x3b11a8[_0x21bc90][0x0][_0x2047('0x1d')]);_0xe066fd=_[_0x2047('0x3f')](_0xe066fd,_0x3d1aad[_0x2047('0x12')]);}}return _0x4dda98[_0x2047('0x41')](function(_0x1a2604){return _0x4dda98[_0x2047('0x0')][_0x2047('0x3')][_0x2047('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x4180f7}},'transaction':_0x1a2604})[_0x2047('0x9')](function(_0x340dc1){return _0x4dda98['models'][_0x2047('0x3')]['bulkCreate'](_[_0x2047('0x43')](_0xe066fd,'priority'),{'transaction':_0x1a2604});});});})[_0x2047('0x44')](function(_0x4f4bdd){console[_0x2047('0x45')](_0x4f4bdd);});}exports[_0x2047('0x46')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 724440d..1d4b249 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 _0xbaf0=['YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','into','phone','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','fromQuery','cm_contacts','str','cm_hopper_final','\x20=\x20?','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','onlyIfOpen','catch','all','BlackLists','get','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','duplicate','pause','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate'];(function(_0x327ec2,_0x56195d){var _0x4e2ff7=function(_0x4d351f){while(--_0x4d351f){_0x327ec2['push'](_0x327ec2['shift']());}};_0x4e2ff7(++_0x56195d);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require('bluebird');var util=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var fs=require('fs');var squel=require(_0x0baf('0x2'));var Papa=require(_0x0baf('0x3'));var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));config[_0x0baf('0x8')]=_[_0x0baf('0x9')](config[_0x0baf('0x8')],{'host':_0x0baf('0xa'),'port':0x18eb});var socket=require(_0x0baf('0xb'))(new Redis(config[_0x0baf('0x8')]));require(_0x0baf('0xc'))['register'](socket);try{if(!process[_0x0baf('0xd')][0x2]||process['argv'][0x2]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x2]===_0x0baf('0xf')){throw new Error(_0x0baf('0x10'));}var FILEPATH=process[_0x0baf('0xd')][0x2];if(!process[_0x0baf('0xd')][0x3]||process[_0x0baf('0xd')][0x3]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x3]===_0x0baf('0xf')||!process[_0x0baf('0xd')][0x4]||process['argv'][0x4]==='undefined'||process[_0x0baf('0xd')][0x4]===_0x0baf('0xf')){throw new Error(_0x0baf('0x11'));}var FIELDS=_[_0x0baf('0x12')](process['argv'][0x3][_0x0baf('0x13')](','),process['argv'][0x4][_0x0baf('0x13')](','));if(!process[_0x0baf('0xd')][0x5]||process[_0x0baf('0xd')][0x5]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x5]===_0x0baf('0xf')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x0baf('0xd')][0x6]&&process[_0x0baf('0xd')][0x6]!==_0x0baf('0xe')&&process[_0x0baf('0xd')][0x6]!==_0x0baf('0xf')?process[_0x0baf('0xd')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x0baf('0xd')][0x7]!==_0x0baf('0xe')&&process[_0x0baf('0xd')][0x7]!==_0x0baf('0xf')?process[_0x0baf('0xd')][0x7]:null;if(!process[_0x0baf('0xd')][0x8]||process['argv'][0x8]==='undefined'||process[_0x0baf('0xd')][0x8]===_0x0baf('0xf')){throw new Error(_0x0baf('0x14'));}var SOCKET_TIMESTAMP=process[_0x0baf('0xd')][0x8];}catch(_0x1fa92b){logger[_0x0baf('0x15')](_0x1fa92b);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(_0x210cd8,_0x636a13,_0x2c42e2,_0x15a2c3){var _0x54f2fa={'message':_0x636a13};_0x54f2fa[_0x210cd8]=!![];if(_0x2c42e2){_0x54f2fa[_0x0baf('0x16')]=_0x2c42e2;}if(_0x15a2c3){_0x54f2fa['index']=_0x15a2c3;}return _0x54f2fa;}function isEmail(_0xf6c158){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'](_0xf6c158);}function checkRow(_0x4de74c,_0x2ef0aa,_0x48a0e9){return new BPromise(function(_0x4be1b9,_0x47c4b){if(_[_0x0baf('0x17')](_0x4de74c)){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x18'),null,_0x48a0e9));}if(_0x4de74c[_0x0baf('0x19')]&&_0x4de74c['errors'][_0x0baf('0x1a')]){var _0x4681c5=_[_0x0baf('0x1b')](_0x4de74c[_0x0baf('0x19')],_0x0baf('0x1c'))[_0x0baf('0x1d')](';');return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x4681c5,null,_0x48a0e9));}var _0x549fd0={};for(var _0x1590b4 in FIELDS){if(FIELDS[_0x0baf('0x1e')](_0x1590b4)&&FIELDS[_0x1590b4]){_0x549fd0[_0x1590b4]=_0x4de74c[_0x0baf('0x1f')][0x0][FIELDS[_0x1590b4]]||_0x4de74c[_0x0baf('0x1f')][0x0]['\ufeff'+FIELDS[_0x1590b4]];}}if(!_0x549fd0['firstName']){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x20'),null,_0x48a0e9));}if(!_0x549fd0['phone']){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x21'),null,_0x48a0e9));}if(_0x549fd0[_0x0baf('0x22')]){var _0xb4dbb1=moment(_0x549fd0[_0x0baf('0x22')],_0x0baf('0x23'));if(!_0xb4dbb1[_0x0baf('0x24')]()){return _0x47c4b(handleCheckRowError('error',_0x0baf('0x25'),null,_0x48a0e9));}}if(_0x549fd0[_0x0baf('0x26')]){if(!isEmail(_0x549fd0[_0x0baf('0x26')])){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x27'),null,_0x48a0e9));}}_0x549fd0[_0x0baf('0x28')]=LISTID;_0x549fd0[_0x0baf('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0baf('0x1a')]&&_0x2ef0aa){var _0x59431b={};for(var _0x3ded64=0x0,_0x2adfd7=DUPLICATES[_0x0baf('0x1a')];_0x3ded64<_0x2adfd7;_0x3ded64+=0x1){_0x59431b[DUPLICATES[_0x3ded64]]=_0x549fd0[DUPLICATES[_0x3ded64]];}var _0x45294a=_[_0x0baf('0x2a')](_0x2ef0aa,_0x59431b);if(_0x45294a){return _0x47c4b(handleCheckRowError('duplicate',_0x0baf('0x2b'),_0x45294a,_0x48a0e9));}}return db['CmContact'][_0x0baf('0x2c')](_0x549fd0,{'raw':!![],'hooks':![],'fields':_[_0x0baf('0x2d')](_0x549fd0)})[_0x0baf('0x2e')](function(_0x3d65f2){if(DUPLICATES&&DUPLICATES['length']&&_0x2ef0aa){_0x2ef0aa[_0x0baf('0x2f')](_[_0x0baf('0x30')](_0x549fd0,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3d65f2['id'];return _0x4be1b9();})['catch'](function(_0x23d890){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x31')+(_0x23d890[_0x0baf('0x1c')]||JSON[_0x0baf('0x32')](_0x23d890)),null,_0x48a0e9));});});}function checkHopper(){function _0x1b0991(){return function(_0xe03d82){logger[_0x0baf('0x15')]('cmContact',_0x0baf('0x33'),util[_0x0baf('0x34')](_0xe03d82,{'showHidden':![],'depth':null}));};}var _0x5b991f=function(_0x32c022,_0x57783c){var _0x5c545f=squel[_0x0baf('0x35')]()[_0x0baf('0x36')]('cm_hopper')['fromQuery']([_0x0baf('0x37'),_0x0baf('0x38'),_0x0baf('0x39'),_0x0baf('0x28'),_0x57783c,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),_0x0baf('0x37'))[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x38'))[_0x0baf('0x3d')]('id','ContactId')[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),'ListId')[_0x0baf('0x3d')](_0x32c022['id'][_0x0baf('0x3f')](),_0x57783c)[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3a'))[_0x0baf('0x3d')]('NOW()',_0x0baf('0x3b'))[_0x0baf('0x40')]('cm_contacts')[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')](_0x0baf('0x43'),LISTID['toString']())[_0x0baf('0x41')](_0x0baf('0x44'))[_0x0baf('0x41')](_0x0baf('0x45'),squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'))[_0x0baf('0x40')](_0x0baf('0x46'))[_0x0baf('0x41')](_0x57783c+'\x20=\x20?',_0x32c022['id'][_0x0baf('0x3f')]())))[_0x0baf('0x3f')]();return _0x5c545f;};var _0x1daf1d=function(_0x339aff,_0x22207a){var _0x55f4f8=squel[_0x0baf('0x35')]()[_0x0baf('0x36')](_0x0baf('0x46'))[_0x0baf('0x47')]([_0x0baf('0x37'),'scheduledAt',_0x0baf('0x39'),_0x0baf('0x28'),_0x22207a,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),'phone')[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x38'))['field']('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),_0x0baf('0x28'))[_0x0baf('0x3d')](_0x339aff['id'][_0x0baf('0x3f')](),_0x22207a)[_0x0baf('0x3d')]('NOW()',_0x0baf('0x3a'))[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')](_0x0baf('0x43'),LISTID[_0x0baf('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44'))[_0x0baf('0x41')](_0x0baf('0x45'),squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')]('calleridnum')[_0x0baf('0x40')](_0x0baf('0x4a'))[_0x0baf('0x41')](_0x22207a+_0x0baf('0x4b'),_0x339aff['id'][_0x0baf('0x3f')]()))[_0x0baf('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0baf('0x3c')]()['field'](_0x0baf('0x37'))['from'](_0x0baf('0x46'))['where'](_0x22207a+_0x0baf('0x4b'),_0x339aff['id']['toString']())))[_0x0baf('0x3f')]();return _0x55f4f8;};function _0xcf7b8d(_0x411c1f,_0x4520d1){var _0x42a68b=squel['insert']()[_0x0baf('0x36')](_0x0baf('0x46'))[_0x0baf('0x47')]([_0x0baf('0x37'),_0x0baf('0x38'),_0x0baf('0x39'),'ListId',_0x4520d1,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),_0x0baf('0x37'))[_0x0baf('0x3d')]('NOW()','scheduledAt')[_0x0baf('0x3d')]('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),_0x0baf('0x28'))[_0x0baf('0x3d')](_0x411c1f['id'][_0x0baf('0x3f')](),_0x4520d1)[_0x0baf('0x3d')](_0x0baf('0x3e'),'createdAt')[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))['where'](_0x0baf('0x43'),LISTID[_0x0baf('0x3f')]())[_0x0baf('0x41')](_0x0baf('0x4c'),squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44')))[_0x0baf('0x3f')]();return _0x42a68b;}function _0x498405(_0x178495,_0x5dc434){var _0x3c00e7=squel['insert']()['into'](_0x0baf('0x4d'))['fromQuery']([_0x0baf('0x37'),_0x0baf('0x39'),'ListId',_0x5dc434,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()['field']('phone',_0x0baf('0x37'))[_0x0baf('0x3d')]('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),'ListId')[_0x0baf('0x3d')](_0x178495['id']['toString'](),_0x5dc434)['field']('NOW()',_0x0baf('0x3a'))['field']('NOW()',_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')]('ListId\x20=\x20?',LISTID[_0x0baf('0x3f')]())[_0x0baf('0x41')](_0x0baf('0x4c'),squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44')))['toString']();return _0x3c00e7;}return db[_0x0baf('0x4e')][_0x0baf('0x4f')]({'where':{'type':_0x0baf('0x50')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x0baf('0x51')],'as':_0x0baf('0x52'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x2c20fe){var _0x125906=[];if(_0x2c20fe){var _0x27a959;for(var _0x4cc046=0x0,_0x5874cc;_0x4cc046<_0x2c20fe['length'];_0x4cc046+=0x1){_0x5874cc=_0x2c20fe[_0x4cc046]['get']({'plain':!![]});switch(_0x5874cc[_0x0baf('0x53')]){case _0x0baf('0x54'):_0x125906[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x1daf1d(_0x5874cc,_0x0baf('0x57')))['then'](function(){})['catch'](_0x1b0991()));break;case _0x0baf('0x58'):_0x125906['push'](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x5b991f(_0x5874cc,'VoiceQueueId'))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));break;default:_0x125906[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0xcf7b8d(_0x5874cc,_0x0baf('0x57')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}}return _0x125906;})[_0x0baf('0x5a')]()['then'](function(){return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0baf('0x5b'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x333b07){var _0x20a514=[];if(_0x333b07){var _0x5093f5;for(var _0x1be7f2=0x0,_0x410f6c;_0x1be7f2<_0x333b07['length'];_0x1be7f2+=0x1){_0x410f6c=_0x333b07[_0x1be7f2]['get']({'plain':!![]});_0x20a514[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x498405(_0x410f6c,_0x0baf('0x57')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}return _0x20a514;})[_0x0baf('0x5a')]();})[_0x0baf('0x2e')](function(){return db['Campaign'][_0x0baf('0x4f')]({'attributes':['id',_0x0baf('0x53')],'include':[{'model':db['CmList'],'as':_0x0baf('0x52'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x538f24){var _0x97d385=[];if(_0x538f24){for(var _0x4043d5=0x0,_0x421ca0;_0x4043d5<_0x538f24[_0x0baf('0x1a')];_0x4043d5+=0x1){_0x421ca0=_0x538f24[_0x4043d5][_0x0baf('0x5c')]({'plain':!![]});switch(_0x421ca0['dialCheckDuplicateType']){case'always':_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')]['query'](_0x1daf1d(_0x421ca0,_0x0baf('0x5d')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));break;case'onlyIfOpen':_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x5b991f(_0x421ca0,'CampaignId'))[_0x0baf('0x2e')](function(){})['catch'](_0x1b0991()));break;default:_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0xcf7b8d(_0x421ca0,_0x0baf('0x5d')))[_0x0baf('0x2e')](function(){})['catch'](_0x1b0991()));}}}return _0x97d385;})[_0x0baf('0x5a')]();})[_0x0baf('0x2e')](function(){return db['Campaign'][_0x0baf('0x4f')]({'attributes':['id'],'include':[{'model':db[_0x0baf('0x51')],'as':_0x0baf('0x5b'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x1cbbcc){var _0x250df2=[];if(_0x1cbbcc){for(var _0xa4fd1b=0x0,_0x1cda78;_0xa4fd1b<_0x1cbbcc[_0x0baf('0x1a')];_0xa4fd1b+=0x1){_0x1cda78=_0x1cbbcc[_0xa4fd1b][_0x0baf('0x5c')]({'plain':!![]});_0x250df2[_0x0baf('0x2f')](db[_0x0baf('0x55')]['query'](_0x498405(_0x1cda78,'CampaignId'))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}return _0x250df2;})[_0x0baf('0x5a')]();})['catch'](function(_0x507783){logger[_0x0baf('0x15')](_0x0baf('0x5e'),_0x0baf('0x5f'),_0x507783[_0x0baf('0x1c')]);});}var processPromises=function(_0x2dcdfe){return BPromise[_0x0baf('0x5a')](promises)[_0x0baf('0x2e')](function(_0xa2d315){})[_0x0baf('0x59')](function(_0x4e8e85){logger[_0x0baf('0x15')](_0x0baf('0x60'),JSON[_0x0baf('0x32')](_0x4e8e85));})[_0x0baf('0x61')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2dcdfe){return _0x2dcdfe['resume']();}});};var endCsv=function(){return BPromise[_0x0baf('0x62')]()[_0x0baf('0x2e')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit'](_0x0baf('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0baf('0x64')](FILEPATH);}catch(_0x52e0c4){logger[_0x0baf('0x15')](_0x0baf('0x65'),JSON[_0x0baf('0x32')](_0x52e0c4));}finally{process[_0x0baf('0x66')](0x0);}});};process['on'](_0x0baf('0x67'),function(){logger[_0x0baf('0x68')](_0x0baf('0x69'));endCsv();});function main(){return BPromise[_0x0baf('0x62')]()[_0x0baf('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0baf('0x13')](',');return db[_0x0baf('0x6a')][_0x0baf('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x1ed607){var _0xd0f63b=fs[_0x0baf('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0baf('0x6c')](_0xd0f63b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3c37b4,_0x195303){total+=0x1;var _0x49d411=total;promises[_0x0baf('0x2f')](checkRow(_0x3c37b4,_0x1ed607,_0x49d411)[_0x0baf('0x2e')](function(){success+=0x1;})[_0x0baf('0x59')](function(_0x457ae8){if(_0x457ae8[_0x0baf('0x15')]){errors+=0x1;delete _0x457ae8['error'];}else if(_0x457ae8[_0x0baf('0x6d')]){duplicates+=0x1;delete _0x457ae8[_0x0baf('0x6d')];}rows[_0x0baf('0x2f')](_0x457ae8);}));if(total%0xc8===0x0){_0x195303[_0x0baf('0x6e')]();return processPromises(_0x195303);}},'complete':function(){return processPromises()[_0x0baf('0x2e')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0xb5f4e5,_0x5a2454){logger[_0x0baf('0x68')]('CSV\x20parse\x20error',JSON[_0x0baf('0x32')](_0xb5f4e5));endCsv();}});})[_0x0baf('0x59')](function(_0x1ce7bb){logger[_0x0baf('0x15')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x0baf('0x32')](_0x1ce7bb));});}main(); \ No newline at end of file +var _0xa9e0=['CmContact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','catch','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','contact:csv_','emit','unlinkSync','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate'];(function(_0x9e24a,_0x1c1186){var _0x335cd1=function(_0x362c25){while(--_0x362c25){_0x9e24a['push'](_0x9e24a['shift']());}};_0x335cd1(++_0x1c1186);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0a9e('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var socket=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x0a9e('0xb')][0x2]||process['argv'][0x2]==='undefined'||process[_0x0a9e('0xb')][0x2]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xd'));}var FILEPATH=process[_0x0a9e('0xb')][0x2];if(!process[_0x0a9e('0xb')][0x3]||process[_0x0a9e('0xb')][0x3]==='undefined'||process['argv'][0x3]==='null'||!process['argv'][0x4]||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xf'));}var FIELDS=_[_0x0a9e('0x10')](process['argv'][0x3][_0x0a9e('0x11')](','),process[_0x0a9e('0xb')][0x4][_0x0a9e('0x11')](','));if(!process[_0x0a9e('0xb')][0x5]||process[_0x0a9e('0xb')][0x5]===_0x0a9e('0xe')||process['argv'][0x5]===_0x0a9e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x0a9e('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x0a9e('0xb')][0x6]!==_0x0a9e('0xe')&&process['argv'][0x6]!==_0x0a9e('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0x0a9e('0xb')][0x7]&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xe')&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xc')?process[_0x0a9e('0xb')][0x7]:null;if(!process[_0x0a9e('0xb')][0x8]||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2c3407){logger[_0x0a9e('0x13')](_0x2c3407);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x53682f,_0x20f109,_0x5a09ef,_0x588269){var _0x3a02e1={'message':_0x20f109};_0x3a02e1[_0x53682f]=!![];if(_0x5a09ef){_0x3a02e1[_0x0a9e('0x14')]=_0x5a09ef;}if(_0x588269){_0x3a02e1[_0x0a9e('0x15')]=_0x588269;}return _0x3a02e1;}function isEmail(_0x30bae6){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x30bae6);}function checkRow(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return new BPromise(function(_0x4d00e6,_0x370d86){if(_[_0x0a9e('0x16')](_0xfb6e48)){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3b45bc));}if(_0xfb6e48['errors']&&_0xfb6e48[_0x0a9e('0x17')][_0x0a9e('0x18')]){var _0x40c424=_[_0x0a9e('0x19')](_0xfb6e48['errors'],_0x0a9e('0x1a'))['join'](';');return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x40c424,null,_0x3b45bc));}var _0x5bfb33={};for(var _0x1dc186 in FIELDS){if(FIELDS[_0x0a9e('0x1b')](_0x1dc186)&&FIELDS[_0x1dc186]){_0x5bfb33[_0x1dc186]=_0xfb6e48[_0x0a9e('0x1c')][0x0][FIELDS[_0x1dc186]]||_0xfb6e48[_0x0a9e('0x1c')][0x0]['\ufeff'+FIELDS[_0x1dc186]];}}if(!_0x5bfb33[_0x0a9e('0x1d')]){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x1e'),null,_0x3b45bc));}if(!_0x5bfb33[_0x0a9e('0x1f')]){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x20'),null,_0x3b45bc));}if(_0x5bfb33[_0x0a9e('0x21')]){var _0x2b1f27=moment(_0x5bfb33[_0x0a9e('0x21')],'YYYY-MM-DD');if(!_0x2b1f27[_0x0a9e('0x22')]()){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x23'),null,_0x3b45bc));}}if(_0x5bfb33[_0x0a9e('0x24')]){if(!isEmail(_0x5bfb33[_0x0a9e('0x24')])){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x25'),null,_0x3b45bc));}}_0x5bfb33[_0x0a9e('0x26')]=LISTID;_0x5bfb33[_0x0a9e('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x2fb0e4){var _0x426950={};for(var _0x5d1e0e=0x0,_0x2407f9=DUPLICATES[_0x0a9e('0x18')];_0x5d1e0e<_0x2407f9;_0x5d1e0e+=0x1){_0x426950[DUPLICATES[_0x5d1e0e]]=_0x5bfb33[DUPLICATES[_0x5d1e0e]];}var _0x1122db=_[_0x0a9e('0x28')](_0x2fb0e4,_0x426950);if(_0x1122db){return _0x370d86(handleCheckRowError(_0x0a9e('0x29'),'Duplicate\x20Contact',_0x1122db,_0x3b45bc));}}return db[_0x0a9e('0x2a')][_0x0a9e('0x2b')](_0x5bfb33,{'raw':!![],'hooks':![],'fields':_[_0x0a9e('0x2c')](_0x5bfb33)})[_0x0a9e('0x2d')](function(_0x2b45ea){if(DUPLICATES&&DUPLICATES[_0x0a9e('0x18')]&&_0x2fb0e4){_0x2fb0e4[_0x0a9e('0x2e')](_[_0x0a9e('0x2f')](_0x5bfb33,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2b45ea['id'];return _0x4d00e6();})['catch'](function(_0x44295a){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x30')+(_0x44295a[_0x0a9e('0x1a')]||JSON[_0x0a9e('0x31')](_0x44295a)),null,_0x3b45bc));});});}function checkHopper(){function _0x3f3d41(){return function(_0x567193){logger[_0x0a9e('0x13')](_0x0a9e('0x32'),_0x0a9e('0x33'),util[_0x0a9e('0x34')](_0x567193,{'showHidden':![],'depth':null}));};}var _0x4853b1=function(_0x54135e,_0x1e8694){var _0x5640eb=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')](['phone',_0x0a9e('0x39'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x1e8694,'createdAt',_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')]('phone','phone')[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),'ListId')['field'](_0x54135e['id'][_0x0a9e('0x3f')](),_0x1e8694)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')](_0x0a9e('0x46'))[_0x0a9e('0x43')](_0x0a9e('0x47'),squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')['where'](_0x1e8694+_0x0a9e('0x48'),_0x54135e['id'][_0x0a9e('0x3f')]())))[_0x0a9e('0x3f')]();return _0x5640eb;};var _0x315881=function(_0x1a69dd,_0xc9a702){var _0x10b040=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),'scheduledAt',_0x0a9e('0x3a'),_0x0a9e('0x26'),_0xc9a702,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x1a69dd['id'][_0x0a9e('0x3f')](),_0xc9a702)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x3b'))[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')]('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x4a'))[_0x0a9e('0x41')](_0x0a9e('0x4b'))[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id'][_0x0a9e('0x3f')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id']['toString']())))['toString']();return _0x10b040;};function _0x2ef381(_0x59c6ff,_0x443e72){var _0x4c3845=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))['fromQuery']([_0x0a9e('0x1f'),_0x0a9e('0x39'),'ContactId','ListId',_0x443e72,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')]('phone',_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')['field']('id','ContactId')[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x59c6ff['id'][_0x0a9e('0x3f')](),_0x443e72)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID['toString']())[_0x0a9e('0x43')](_0x0a9e('0x4c'),squel['str'](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x0a9e('0x3f')]();return _0x4c3845;}function _0x5ba1f9(_0x4b3c1a,_0x5674ee){var _0x273cb5=squel['insert']()[_0x0a9e('0x36')](_0x0a9e('0x4d'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x5674ee,'createdAt',_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field']('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),_0x0a9e('0x26'))['field'](_0x4b3c1a['id'][_0x0a9e('0x3f')](),_0x5674ee)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x3b'))[_0x0a9e('0x41')]('cm_contacts')[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')]('ListId\x20=\x20?',LISTID[_0x0a9e('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')](_0x0a9e('0x46')))[_0x0a9e('0x3f')]();return _0x273cb5;}return db[_0x0a9e('0x4e')][_0x0a9e('0x4f')]({'where':{'type':_0x0a9e('0x50')},'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x53'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x19012b){var _0x2bbb86=[];if(_0x19012b){var _0x2b8192;for(var _0x320898=0x0,_0x412a72;_0x320898<_0x19012b[_0x0a9e('0x18')];_0x320898+=0x1){_0x412a72=_0x19012b[_0x320898][_0x0a9e('0x54')]({'plain':!![]});switch(_0x412a72['dialCheckDuplicateType']){case _0x0a9e('0x55'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x315881(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x4853b1(_0x412a72,_0x0a9e('0x57')))['then'](function(){})['catch'](_0x3f3d41()));break;default:_0x2bbb86['push'](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x2ef381(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}}return _0x2bbb86;})[_0x0a9e('0x5b')]()[_0x0a9e('0x2d')](function(){return db[_0x0a9e('0x4e')]['findAll']({'where':{'type':_0x0a9e('0x50')},'attributes':['id'],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x2bdc44){var _0x583b2e=[];if(_0x2bdc44){var _0x4437ff;for(var _0x44351d=0x0,_0x4c46c1;_0x44351d<_0x2bdc44[_0x0a9e('0x18')];_0x44351d+=0x1){_0x4c46c1=_0x2bdc44[_0x44351d][_0x0a9e('0x54')]({'plain':!![]});_0x583b2e[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x5ba1f9(_0x4c46c1,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x583b2e;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':'Lists','where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x3511c9){var _0x30a4c7=[];if(_0x3511c9){for(var _0xf410e5=0x0,_0x332367;_0xf410e5<_0x3511c9[_0x0a9e('0x18')];_0xf410e5+=0x1){_0x332367=_0x3511c9[_0xf410e5][_0x0a9e('0x54')]({'plain':!![]});switch(_0x332367[_0x0a9e('0x51')]){case _0x0a9e('0x55'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x315881(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x4853b1(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));break;default:_0x30a4c7[_0x0a9e('0x2e')](db['sequelize']['query'](_0x2ef381(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));}}}return _0x30a4c7;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x2d2286){var _0x42b959=[];if(_0x2d2286){for(var _0x3755fe=0x0,_0x1f42a0;_0x3755fe<_0x2d2286[_0x0a9e('0x18')];_0x3755fe+=0x1){_0x1f42a0=_0x2d2286[_0x3755fe]['get']({'plain':!![]});_0x42b959[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x5ba1f9(_0x1f42a0,_0x0a9e('0x5e')))['then'](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x42b959;})[_0x0a9e('0x5b')]();})['catch'](function(_0x1d6834){logger['error'](_0x0a9e('0x5f'),_0x0a9e('0x60'),_0x1d6834[_0x0a9e('0x1a')]);});}var processPromises=function(_0x385d52){return BPromise['all'](promises)['then'](function(_0x353384){})[_0x0a9e('0x5a')](function(_0x94dcf5){logger['error'](_0x0a9e('0x61'),JSON[_0x0a9e('0x31')](_0x94dcf5));})['finally'](function(){socket['emit'](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x385d52){return _0x385d52['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0a9e('0x2d')](function(){socket[_0x0a9e('0x63')](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0a9e('0x64')](FILEPATH);}catch(_0x3c6dd6){logger[_0x0a9e('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x0a9e('0x31')](_0x3c6dd6));}finally{process['exit'](0x0);}});};process['on'](_0x0a9e('0x65'),function(){logger[_0x0a9e('0x66')](_0x0a9e('0x67'));endCsv();});function main(){return BPromise[_0x0a9e('0x68')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0a9e('0x11')](',');return db[_0x0a9e('0x2a')][_0x0a9e('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xb6e411){var _0x21e592=fs[_0x0a9e('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0a9e('0x6a')](_0x21e592,{'header':!![],'skipEmptyLines':!![],'step':function(_0x255e49,_0x1910bf){total+=0x1;var _0x32b9bd=total;promises[_0x0a9e('0x2e')](checkRow(_0x255e49,_0xb6e411,_0x32b9bd)['then'](function(){success+=0x1;})[_0x0a9e('0x5a')](function(_0x3325c5){if(_0x3325c5['error']){errors+=0x1;delete _0x3325c5[_0x0a9e('0x13')];}else if(_0x3325c5[_0x0a9e('0x29')]){duplicates+=0x1;delete _0x3325c5[_0x0a9e('0x29')];}rows['push'](_0x3325c5);}));if(total%0xc8===0x0){_0x1910bf[_0x0a9e('0x6b')]();return processPromises(_0x1910bf);}},'complete':function(){return processPromises()['then'](function(){logger[_0x0a9e('0x66')](_0x0a9e('0x6c'));endCsv();});},'error':function(_0x558a87,_0x1f29bd){logger[_0x0a9e('0x66')](_0x0a9e('0x6d'),JSON[_0x0a9e('0x31')](_0x558a87));endCsv();}});})[_0x0a9e('0x5a')](function(_0x501050){logger[_0x0a9e('0x13')](_0x0a9e('0x6e'),JSON[_0x0a9e('0x31')](_0x501050));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 24fcfda..84e0a1d 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 _0xa478=['where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_hopper_black','.id\x20=\x20','ListId\x20=\x20?','\x20=\x20?','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','min_id','group','info','error','message','exit','errors','sequelize','catch','main','stringify','start','binding','root','.csv','writeFileSync','parse','length','rows','data','hasOwnProperty','trim','replace','isValid','push','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','firstName','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','format','scheduledat',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','each','finish','affectedRows','unlink','complete','argv','existsSync','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','No\x20agent\x20available','uncaughtException','lodash','moment','squel','ioredis','../../../mysqldb','../../../config/environment','import','defaults','localhost','socket.io-emitter','redis','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xa478,0x1da));var _0x8a47=function(_0x49b14d,_0x578d07){_0x49b14d=_0x49b14d-0x0;var _0x3d2488=_0xa478[_0x49b14d];return _0x3d2488;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x8a47('0x0'));var Papa=require('papaparse');var util=require('util');var BPromise=require('bluebird');var moment=require(_0x8a47('0x1'));var squel=require(_0x8a47('0x2'));var Redis=require(_0x8a47('0x3'));var db=require(_0x8a47('0x4'))['db'];var config=require(_0x8a47('0x5'));var logger=require('../../../config/logger')(_0x8a47('0x6'));config['redis']=_[_0x8a47('0x7')](config['redis'],{'host':_0x8a47('0x8'),'port':0x18eb});var socket=require(_0x8a47('0x9'))(new Redis(config[_0x8a47('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format'](_0x8a47('0xb'));function isEmail(_0x52ca7f){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))*$/[_0x8a47('0xc')](_0x52ca7f);}function selectNotIn(_0x493914,_0xe781ab,_0x4a473c,_0x45062d,_0x2025a8){return squel[_0x8a47('0xd')]()[_0x8a47('0xe')](_0x8a47('0xf'))[_0x8a47('0x10')](_0x45062d)[_0x8a47('0x11')](_0xe781ab,null,_0xe781ab+'.id\x20=\x20'+_0x45062d+'.'+_0x4a473c)[_0x8a47('0x12')](_0x45062d+'.'+_0x4a473c+_0x8a47('0x13')+_0x493914+'.'+_0x4a473c)['where'](_0xe781ab+_0x8a47('0x14')+_0x2025a8[_0x8a47('0x11')]()+')');}function insertCmHopper(_0x4a7766,_0x35cb02,_0x475956,_0x443ebf,_0x396d41){var _0x40d297=[_0x8a47('0x15'),_0x8a47('0x16'),_0x8a47('0x17'),_0x8a47('0x18'),_0x35cb02+'.'+_0x443ebf,_0x8a47('0x19'),_0x8a47('0x1a'),_0x8a47('0x1b'),_0x8a47('0x1c'),'\x22'+_0x396d41+'\x22'];return squel[_0x8a47('0x1d')]()[_0x8a47('0x1e')](_0x8a47('0x1f'))[_0x8a47('0x20')](['phone','scheduledat',_0x8a47('0x21'),_0x8a47('0x22'),_0x443ebf,_0x8a47('0x23'),_0x8a47('0x24'),_0x8a47('0x25'),'UserId',_0x8a47('0x26')],squel[_0x8a47('0xd')]()[_0x8a47('0x27')](_0x40d297)['from'](_0x35cb02)['join'](_0x8a47('0x28'),null,_0x8a47('0x29')+_0x35cb02+_0x8a47('0x2a'))[_0x8a47('0x11')](_0x475956,null,_0x475956+'.id\x20=\x20'+_0x35cb02+'.'+_0x443ebf)['where'](_0x35cb02+_0x8a47('0x2b'),_0x4a7766)[_0x8a47('0x12')](_0x8a47('0x2c'),NOW)['where'](_0x8a47('0x2d'),selectNotIn(_0x35cb02,_0x475956,_0x443ebf,_0x8a47('0x1f'),['\x22always\x22',_0x8a47('0x2e')]))[_0x8a47('0x12')](_0x8a47('0x2d'),selectNotIn(_0x35cb02,_0x475956,_0x443ebf,_0x8a47('0x1f'),[_0x8a47('0x2f')])))[_0x8a47('0x30')]();}function insertCmHopperBlack(_0x2ba6cf,_0x30efea,_0x20e6c0,_0x4567b2){var _0xe59694=[_0x8a47('0x15'),'cm_contacts.id',_0x8a47('0x18'),_0x30efea+'.'+_0x4567b2,_0x8a47('0x19'),'cm_contacts.updatedAt'];return squel[_0x8a47('0x1d')]()['into'](_0x8a47('0x31'))[_0x8a47('0x20')](['phone',_0x8a47('0x21'),_0x8a47('0x22'),_0x4567b2,_0x8a47('0x23'),_0x8a47('0x24')],squel[_0x8a47('0xd')]()['fields'](_0xe59694)['from'](_0x30efea)[_0x8a47('0x11')](_0x8a47('0x28'),null,_0x8a47('0x29')+_0x30efea+_0x8a47('0x2a'))['join'](_0x20e6c0,null,_0x20e6c0+_0x8a47('0x32')+_0x30efea+'.'+_0x4567b2)['where'](_0x30efea+_0x8a47('0x2b'),_0x2ba6cf)[_0x8a47('0x12')](_0x8a47('0x2c'),NOW)[_0x8a47('0x12')](_0x8a47('0x2d'),squel['select']()[_0x8a47('0xe')](_0x8a47('0xf'))[_0x8a47('0x10')]('cm_hopper_black')['where'](_0x8a47('0x33'),_0x2ba6cf)[_0x8a47('0x12')](_0x4567b2+_0x8a47('0x34'),_0x30efea+'.'+_0x4567b2)))[_0x8a47('0x30')]();}function insertCmContact(_0x1fdc43,_0x81aeb2,_0x54be27,_0x490446){var _0x28835f=_['concat'](_[_0x8a47('0x35')](_0x490446),['ListId',_0x8a47('0x36'),_0x8a47('0x23'),_0x8a47('0x24')]);return squel[_0x8a47('0x1d')]()[_0x8a47('0x1e')](_0x8a47('0x28'))[_0x8a47('0x20')](_0x28835f,squel['select']()[_0x8a47('0x27')](_0x28835f)['from'](_0x81aeb2)[_0x8a47('0x12')]('('+_0x54be27[_0x8a47('0x11')](',')+_0x8a47('0x37'),squel['select']()[_0x8a47('0x27')](_0x54be27)[_0x8a47('0x10')]('cm_contacts')[_0x8a47('0x12')]('ListId\x20=\x20?',_0x1fdc43)['where'](_0x8a47('0x38')))[_0x8a47('0x12')]('id\x20IN\x20?',squel[_0x8a47('0xd')]()['field']('MIN(id)',_0x8a47('0x39'))[_0x8a47('0x10')](_0x81aeb2)[_0x8a47('0x3a')](_0x54be27[_0x8a47('0x11')](','))))[_0x8a47('0x30')]();}function handleStop(){logger[_0x8a47('0x3b')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x596278){logger[_0x8a47('0x3c')](_0x596278[_0x8a47('0x3d')]);process[_0x8a47('0x3e')](0x1);}function handleError(_0x38c18c,_0x5787f3){stats[_0x8a47('0x3f')]['push']({'name':_0x5787f3['code'],'message':_0x5787f3['message'],'row':_0x38c18c});}function handleQuery(_0x51967e){logger[_0x8a47('0x3b')](_0x51967e);return db[_0x8a47('0x40')]['query'](_0x51967e)['spread'](function(_0x51f1a2){results['push'](_0x51f1a2);})[_0x8a47('0x41')](function(_0x3121a6){logger[_0x8a47('0x3c')](_0x3121a6[_0x8a47('0x3d')]);});}function main(_0xad78c5,_0x274948,_0x5d7308,_0x6347c7){logger['info'](_0x8a47('0x42'),_0xad78c5,JSON[_0x8a47('0x43')](_0x274948));process['send'](_0x8a47('0x44'));var _0x23b2d8=_0x274948[_0x8a47('0x45')];var _0x1a385f=_0x274948['socket_timestamp'];var _0x442321=path[_0x8a47('0x11')](config[_0x8a47('0x46')],'server/files/tmp',_0x1a385f+_0x8a47('0x47'));var _0x48097f=_['keys'](_0x23b2d8)[_0x8a47('0x11')]();logger[_0x8a47('0x3b')]('header',_0x48097f);fs[_0x8a47('0x48')](_0x442321,_0x48097f+'\x0a');Papa[_0x8a47('0x49')](fs['createReadStream'](_0xad78c5),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3d58e7,_0x38877e){try{for(var _0x4441a7=0x0,_0x10f8d4=[];_0x4441a7<_0x3d58e7['data'][_0x8a47('0x4a')];_0x4441a7++){stats[_0x8a47('0x4b')]+=0x1;if(_0x3d58e7[_0x8a47('0x3f')][_0x4441a7]){handleError(_0x3d58e7[_0x8a47('0x4c')][_0x4441a7],_0x3d58e7[_0x8a47('0x3f')][_0x4441a7]);}else{var _0x4853de=[];for(var _0x837177 in _0x23b2d8){if(_0x23b2d8[_0x8a47('0x4d')](_0x837177)){if(_0x3d58e7[_0x8a47('0x4c')][_0x4441a7][_0x23b2d8[_0x837177]]){var _0x5ed866=_[_0x8a47('0x4e')](_0x3d58e7[_0x8a47('0x4c')][_0x4441a7][_0x23b2d8[_0x837177]][_0x8a47('0x4f')](/"/g,'\x27'));switch(_0x837177){case'scheduledat':var _0xa2fe51=moment(_0x5ed866,_0x8a47('0xb'),!![]);if(_0xa2fe51[_0x8a47('0x50')]()){_0x10f8d4[_0x8a47('0x51')]('\x22'+_0x5ed866+'\x22');}else{_0x4853de[_0x8a47('0x51')](_0x8a47('0x52'));}break;case'priority':var _0x11a575=parseInt(_0x5ed866);_0x5ed866=_[_0x8a47('0x53')](_0x11a575)||_0x11a575<0x0||_0x11a575>0x4?_0x6347c7?0x3:0x2:_0x11a575;_0x10f8d4[_0x8a47('0x51')]('\x22'+_0x5ed866+'\x22');break;case _0x8a47('0x54'):var _0x42122d=parseInt(_0x5ed866);if(_['isNumber'](_0x42122d)&&_['includes'](_0x5d7308,_0x42122d)){_0x10f8d4[_0x8a47('0x51')]('\x22'+_0x42122d+'\x22');}else{_0x4853de[_0x8a47('0x51')](_0x8a47('0x55'));}break;case _0x8a47('0x56'):if(isEmail(_0x5ed866)){_0x10f8d4[_0x8a47('0x51')]('\x22'+_0x5ed866+'\x22');}else{_0x4853de[_0x8a47('0x51')]('email\x20wrong\x20format');}break;case _0x8a47('0x57'):var _0x2db110=moment(_0x5ed866,_0x8a47('0x58'),!![]);if(_0x2db110['isValid']()){_0x10f8d4[_0x8a47('0x51')]('\x22'+_0x5ed866+'\x22');}else{_0x4853de['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x10f8d4['push']('\x22'+_0x5ed866+'\x22');}}else{switch(_0x837177){case _0x8a47('0x59'):case _0x8a47('0xf'):_0x4853de[_0x8a47('0x51')](_0x837177+'\x20not\x20specified');break;default:_0x10f8d4[_0x8a47('0x51')]('\x22\x22');}}}}if(_0x4853de['length']){handleError(_0x3d58e7[_0x8a47('0x4c')][_0x4441a7],{'code':_0x8a47('0x5a'),'message':_0x4853de[_0x8a47('0x11')]()});}else{fs[_0x8a47('0x5b')](_0x442321,_0x10f8d4[_0x8a47('0x11')]()+'\x0a');}_0x10f8d4=[];}if(!(stats[_0x8a47('0x4b')]%0xc8)){socket[_0x8a47('0x5c')](_0x8a47('0x5d')+_0x1a385f,stats);stats[_0x8a47('0x3f')]=[];}}if(stopped){logger[_0x8a47('0x3b')](_0x8a47('0x5e'));_0x38877e[_0x8a47('0x5f')]();}}catch(_0x3836ba){handleError(_0x3d58e7[_0x8a47('0x4c')][_0x4441a7],{'code':_0x8a47('0x60'),'message':_0x3836ba['message']});logger['error'](_0x8a47('0x61'),_0x3836ba[_0x8a47('0x3d')]);}},'complete':function(){try{var _0x3f1a20=[];var _0x436fc9='cm_contacts';if(_0x274948[_0x8a47('0x62')]&&_0x274948[_0x8a47('0x62')][_0x8a47('0x4a')]){_0x436fc9=_0x8a47('0x63')+_0x1a385f;_0x3f1a20['push'](_0x8a47('0x64')+_0x436fc9+_0x8a47('0x65'));}var _0x1c2a4e=util[_0x8a47('0x66')]('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',_0x442321,_0x436fc9,_0x48097f,_0x274948[_0x8a47('0x22')],_0x274948[_0x8a47('0x36')]||null,NOW,NOW);if(_['isNil'](_0x23b2d8[_0x8a47('0x67')])){_0x1c2a4e+=_0x8a47('0x68');}_0x3f1a20['push'](_0x1c2a4e);if(_0x274948[_0x8a47('0x62')]&&_0x274948[_0x8a47('0x62')][_0x8a47('0x4a')]){_0x3f1a20['push'](insertCmContact(_0x274948[_0x8a47('0x22')],_0x436fc9,_0x274948[_0x8a47('0x62')],_0x23b2d8));_0x3f1a20[_0x8a47('0x51')](_0x8a47('0x69')+_0x436fc9+';');}_0x3f1a20[_0x8a47('0x51')](insertCmHopper(_0x274948['ListId'],_0x8a47('0x6a'),_0x8a47('0x6b'),_0x8a47('0x6c'),_0x6347c7));_0x3f1a20[_0x8a47('0x51')](insertCmHopperBlack(_0x274948[_0x8a47('0x22')],_0x8a47('0x6d'),_0x8a47('0x6b'),_0x8a47('0x6c')));_0x3f1a20[_0x8a47('0x51')](insertCmHopper(_0x274948[_0x8a47('0x22')],'campaigns_has_cm_lists','campaigns',_0x8a47('0x6e'),_0x6347c7));_0x3f1a20['push'](insertCmHopperBlack(_0x274948[_0x8a47('0x22')],'campaigns_has_cm_blacklists','campaigns',_0x8a47('0x6e')));BPromise[_0x8a47('0x6f')](_0x3f1a20,handleQuery)['then'](function(_0x42808c){stats[_0x8a47('0x70')]=!![];stats['affectedRows']=_0x274948['duplicates']&&_0x274948[_0x8a47('0x62')]['length']?results[0x2][_0x8a47('0x71')]:results[0x0]['affectedRows'];socket[_0x8a47('0x5c')](_0x8a47('0x5d')+_0x1a385f,stats);fs[_0x8a47('0x72')](_0xad78c5);fs[_0x8a47('0x72')](_0x442321);process[_0x8a47('0x3e')](0x0);})[_0x8a47('0x41')](function(_0x5c3c80){logger[_0x8a47('0x3c')](_0x5c3c80[_0x8a47('0x3d')]);process[_0x8a47('0x3e')](0x1);});}catch(_0x2a5a58){logger[_0x8a47('0x3c')](_0x8a47('0x73'),_0x2a5a58[_0x8a47('0x3d')]);process[_0x8a47('0x3e')](0x1);}},'error':function(_0x2f3a46,_0x55c52e,_0x32454e,_0x51fdab){throw new Error(_0x51fdab);}});}function validate(){if(process[_0x8a47('0x74')]&&process[_0x8a47('0x74')][_0x8a47('0x4a')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x4faa16=path[_0x8a47('0x11')](config[_0x8a47('0x46')],'server/files/tmp',process[_0x8a47('0x74')][0x2]);if(!fs[_0x8a47('0x75')](_0x4faa16)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x2fb700={};try{_0x2fb700=JSON[_0x8a47('0x49')](process[_0x8a47('0x74')][0x3]);if(!_0x2fb700[_0x8a47('0x45')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x2fb700[_0x8a47('0x45')][_0x8a47('0xf')]){throw new Error(_0x8a47('0x76'));}if(!_0x2fb700[_0x8a47('0x45')][_0x8a47('0x59')]){throw new Error(_0x8a47('0x77'));}var _0x36b7f4=0x0;if(_0x2fb700['binding'][_0x8a47('0x54')]){_0x36b7f4=0x1;}if(!_0x2fb700['ListId']){throw new Error(_0x8a47('0x78'));}}catch(_0x2826f8){throw new Error('body\x20id\x20mandatory');}var _0x7d5785=[];try{_0x7d5785=_['map'](JSON[_0x8a47('0x49')](process[_0x8a47('0x74')][0x4]),'id');}catch(_0x530bfa){logger[_0x8a47('0x3b')](_0x8a47('0x79'));}main(_0x4faa16,_0x2fb700,_0x7d5785,_0x36b7f4);}validate();process['on']('SIGINT',handleStop);process['on'](_0x8a47('0x7a'),handleUncaughtException); \ No newline at end of file +var _0x88eb=['fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.id','into','cm_hopper_black','select','.CmListId','ListId\x20=\x20?','\x20=\x20?','concat','CompanyId','createdAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','message','exit','push','sequelize','query','catch','error','stringify','send','binding','socket_timestamp','server/files/tmp','.csv','keys','writeFileSync','parse','createReadStream','length','errors','data','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','emit','contact:import:','Abort\x20parser','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','campaigns_has_cm_blacklists','each','then','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','root','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/logger','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','cm_hopper','fromQuery','scheduledat','ContactId','ListId','updatedAt','priority','UserId'];(function(_0x53b015,_0x43b391){var _0x4dca64=function(_0x1874ef){while(--_0x1874ef){_0x53b015['push'](_0x53b015['shift']());}};_0x4dca64(++_0x43b391);}(_0x88eb,0x1e0));var _0xb88e=function(_0x239d93,_0x17f0b3){_0x239d93=_0x239d93-0x0;var _0x5693ab=_0x88eb[_0x239d93];return _0x5693ab;};'use strict';var fs=require('fs');var path=require(_0xb88e('0x0'));var _=require('lodash');var Papa=require(_0xb88e('0x1'));var util=require(_0xb88e('0x2'));var BPromise=require(_0xb88e('0x3'));var moment=require(_0xb88e('0x4'));var squel=require(_0xb88e('0x5'));var Redis=require(_0xb88e('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0xb88e('0x7'));var logger=require(_0xb88e('0x8'))('import');config[_0xb88e('0x9')]=_['defaults'](config[_0xb88e('0x9')],{'host':_0xb88e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb88e('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xb88e('0xb')](_0xb88e('0xc'));function isEmail(_0xb605d6){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))*$/[_0xb88e('0xd')](_0xb605d6);}function selectNotIn(_0x2b5c9f,_0x2c2d85,_0x5b2e91,_0x47b0df,_0x458fc2){return squel['select']()[_0xb88e('0xe')](_0xb88e('0xf'))[_0xb88e('0x10')](_0x47b0df)[_0xb88e('0x11')](_0x2c2d85,null,_0x2c2d85+_0xb88e('0x12')+_0x47b0df+'.'+_0x5b2e91)['where'](_0x47b0df+'.'+_0x5b2e91+_0xb88e('0x13')+_0x2b5c9f+'.'+_0x5b2e91)[_0xb88e('0x14')](_0x2c2d85+'.dialCheckDuplicateType\x20IN\x20('+_0x458fc2[_0xb88e('0x11')]()+')');}function insertCmHopper(_0x3153b3,_0x158255,_0x212cca,_0x3245ea,_0x5d5e94){var _0x166ebd=[_0xb88e('0x15'),_0xb88e('0x16'),'cm_contacts.id',_0xb88e('0x17'),_0x158255+'.'+_0x3245ea,_0xb88e('0x18'),_0xb88e('0x19'),'cm_contacts.priority',_0xb88e('0x1a'),'\x22'+_0x5d5e94+'\x22'];return squel[_0xb88e('0x1b')]()['into'](_0xb88e('0x1c'))[_0xb88e('0x1d')](['phone',_0xb88e('0x1e'),_0xb88e('0x1f'),_0xb88e('0x20'),_0x3245ea,'createdAt',_0xb88e('0x21'),_0xb88e('0x22'),_0xb88e('0x23'),'recallme'],squel['select']()[_0xb88e('0x24')](_0x166ebd)[_0xb88e('0x10')](_0x158255)['join'](_0xb88e('0x25'),null,_0xb88e('0x26')+_0x158255+'.CmListId')['join'](_0x212cca,null,_0x212cca+_0xb88e('0x12')+_0x158255+'.'+_0x3245ea)['where'](_0x158255+_0xb88e('0x27'),_0x3153b3)[_0xb88e('0x14')](_0xb88e('0x28'),NOW)[_0xb88e('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x158255,_0x212cca,_0x3245ea,_0xb88e('0x1c'),[_0xb88e('0x29'),_0xb88e('0x2a')]))[_0xb88e('0x14')](_0xb88e('0x2b'),selectNotIn(_0x158255,_0x212cca,_0x3245ea,'cm_hopper',[_0xb88e('0x29')])))[_0xb88e('0x2c')]();}function insertCmHopperBlack(_0x5a406e,_0x186f4b,_0x5b3dd7,_0x4a2ae9){var _0x5b4242=['cm_contacts.phone',_0xb88e('0x2d'),'cm_contacts.ListId',_0x186f4b+'.'+_0x4a2ae9,_0xb88e('0x18'),'cm_contacts.updatedAt'];return squel[_0xb88e('0x1b')]()[_0xb88e('0x2e')](_0xb88e('0x2f'))[_0xb88e('0x1d')]([_0xb88e('0xf'),_0xb88e('0x1f'),_0xb88e('0x20'),_0x4a2ae9,'createdAt','updatedAt'],squel[_0xb88e('0x30')]()['fields'](_0x5b4242)[_0xb88e('0x10')](_0x186f4b)['join'](_0xb88e('0x25'),null,'cm_contacts.ListId\x20=\x20'+_0x186f4b+_0xb88e('0x31'))[_0xb88e('0x11')](_0x5b3dd7,null,_0x5b3dd7+_0xb88e('0x12')+_0x186f4b+'.'+_0x4a2ae9)[_0xb88e('0x14')](_0x186f4b+'.CmListId\x20=\x20?',_0x5a406e)[_0xb88e('0x14')](_0xb88e('0x28'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xb88e('0x30')]()[_0xb88e('0xe')](_0xb88e('0xf'))[_0xb88e('0x10')](_0xb88e('0x2f'))[_0xb88e('0x14')](_0xb88e('0x32'),_0x5a406e)[_0xb88e('0x14')](_0x4a2ae9+_0xb88e('0x33'),_0x186f4b+'.'+_0x4a2ae9)))[_0xb88e('0x2c')]();}function insertCmContact(_0x180d33,_0x6a6954,_0x58929c,_0x1ee359){var _0x326e80=_[_0xb88e('0x34')](_['keys'](_0x1ee359),[_0xb88e('0x20'),_0xb88e('0x35'),_0xb88e('0x36'),_0xb88e('0x21')]);return squel[_0xb88e('0x1b')]()['into'](_0xb88e('0x25'))['fromQuery'](_0x326e80,squel[_0xb88e('0x30')]()[_0xb88e('0x24')](_0x326e80)['from'](_0x6a6954)[_0xb88e('0x14')]('('+_0x58929c[_0xb88e('0x11')](',')+_0xb88e('0x37'),squel[_0xb88e('0x30')]()[_0xb88e('0x24')](_0x58929c)[_0xb88e('0x10')](_0xb88e('0x25'))[_0xb88e('0x14')](_0xb88e('0x32'),_0x180d33)['where'](_0xb88e('0x38')))[_0xb88e('0x14')](_0xb88e('0x39'),squel[_0xb88e('0x30')]()[_0xb88e('0xe')]('MIN(id)',_0xb88e('0x3a'))[_0xb88e('0x10')](_0x6a6954)[_0xb88e('0x3b')](_0x58929c[_0xb88e('0x11')](','))))[_0xb88e('0x2c')]();}function handleStop(){logger[_0xb88e('0x3c')](_0xb88e('0x3d'));stopped=!![];}function handleUncaughtException(_0x34f3ca){logger['error'](_0x34f3ca[_0xb88e('0x3e')]);process[_0xb88e('0x3f')](0x1);}function handleError(_0x5aa2d9,_0x12c310){stats['errors'][_0xb88e('0x40')]({'name':_0x12c310['code'],'message':_0x12c310[_0xb88e('0x3e')],'row':_0x5aa2d9});}function handleQuery(_0x3bb959){logger[_0xb88e('0x3c')](_0x3bb959);return db[_0xb88e('0x41')][_0xb88e('0x42')](_0x3bb959)['spread'](function(_0x1bef6e){results[_0xb88e('0x40')](_0x1bef6e);})[_0xb88e('0x43')](function(_0x5c73fa){logger[_0xb88e('0x44')](_0x5c73fa[_0xb88e('0x3e')]);});}function main(_0x843bcd,_0xe58a97,_0x447258,_0x555c41){logger[_0xb88e('0x3c')]('main',_0x843bcd,JSON[_0xb88e('0x45')](_0xe58a97));process[_0xb88e('0x46')]('start');var _0x3b7739=_0xe58a97[_0xb88e('0x47')];var _0x3df1b6=_0xe58a97[_0xb88e('0x48')];var _0x5f1169=path[_0xb88e('0x11')](config['root'],_0xb88e('0x49'),_0x3df1b6+_0xb88e('0x4a'));var _0x2f31ca=_[_0xb88e('0x4b')](_0x3b7739)[_0xb88e('0x11')]();logger[_0xb88e('0x3c')]('header',_0x2f31ca);fs[_0xb88e('0x4c')](_0x5f1169,_0x2f31ca+'\x0a');Papa[_0xb88e('0x4d')](fs[_0xb88e('0x4e')](_0x843bcd),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3b4e7d,_0x2fca04){try{for(var _0x55a3bf=0x0,_0x18b449=[];_0x55a3bf<_0x3b4e7d['data'][_0xb88e('0x4f')];_0x55a3bf++){stats['rows']+=0x1;if(_0x3b4e7d[_0xb88e('0x50')][_0x55a3bf]){handleError(_0x3b4e7d[_0xb88e('0x51')][_0x55a3bf],_0x3b4e7d[_0xb88e('0x50')][_0x55a3bf]);}else{var _0x22917a=[];for(var _0x15a177 in _0x3b7739){if(_0x3b7739[_0xb88e('0x52')](_0x15a177)){if(_0x3b4e7d[_0xb88e('0x51')][_0x55a3bf][_0x3b7739[_0x15a177]]){var _0x94877c=_['trim'](_0x3b4e7d[_0xb88e('0x51')][_0x55a3bf][_0x3b7739[_0x15a177]][_0xb88e('0x53')](/"/g,'\x27'));switch(_0x15a177){case'scheduledat':var _0x53f839=moment(_0x94877c,_0xb88e('0xc'),!![]);if(_0x53f839[_0xb88e('0x54')]()){_0x18b449['push']('\x22'+_0x94877c+'\x22');}else{_0x22917a[_0xb88e('0x40')](_0xb88e('0x55'));}break;case _0xb88e('0x22'):var _0x2f3fc4=parseInt(_0x94877c);_0x94877c=_[_0xb88e('0x56')](_0x2f3fc4)||_0x2f3fc4<0x0||_0x2f3fc4>0x4?_0x555c41?0x3:0x2:_0x2f3fc4;_0x18b449[_0xb88e('0x40')]('\x22'+_0x94877c+'\x22');break;case _0xb88e('0x23'):var _0xa5e9ac=parseInt(_0x94877c);if(_[_0xb88e('0x57')](_0xa5e9ac)&&_[_0xb88e('0x58')](_0x447258,_0xa5e9ac)){_0x18b449['push']('\x22'+_0xa5e9ac+'\x22');}else{_0x22917a['push']('agent\x20not\x20exists');}break;case _0xb88e('0x59'):if(isEmail(_0x94877c)){_0x18b449[_0xb88e('0x40')]('\x22'+_0x94877c+'\x22');}else{_0x22917a[_0xb88e('0x40')](_0xb88e('0x5a'));}break;case'dateOfBirth':var _0x3096f7=moment(_0x94877c,_0xb88e('0x5b'),!![]);if(_0x3096f7['isValid']()){_0x18b449[_0xb88e('0x40')]('\x22'+_0x94877c+'\x22');}else{_0x22917a[_0xb88e('0x40')](_0xb88e('0x5c'));}break;default:_0x18b449[_0xb88e('0x40')]('\x22'+_0x94877c+'\x22');}}else{switch(_0x15a177){case _0xb88e('0x5d'):case _0xb88e('0xf'):_0x22917a[_0xb88e('0x40')](_0x15a177+'\x20not\x20specified');break;default:_0x18b449[_0xb88e('0x40')]('\x22\x22');}}}}if(_0x22917a[_0xb88e('0x4f')]){handleError(_0x3b4e7d['data'][_0x55a3bf],{'code':'SystemRow','message':_0x22917a[_0xb88e('0x11')]()});}else{fs['appendFileSync'](_0x5f1169,_0x18b449[_0xb88e('0x11')]()+'\x0a');}_0x18b449=[];}if(!(stats['rows']%0xc8)){socket[_0xb88e('0x5e')](_0xb88e('0x5f')+_0x3df1b6,stats);stats[_0xb88e('0x50')]=[];}}if(stopped){logger[_0xb88e('0x3c')](_0xb88e('0x60'));_0x2fca04['abort']();}}catch(_0x4b3088){handleError(_0x3b4e7d[_0xb88e('0x51')][_0x55a3bf],{'code':_0xb88e('0x61'),'message':_0x4b3088[_0xb88e('0x3e')]});logger[_0xb88e('0x44')](_0xb88e('0x62'),_0x4b3088['message']);}},'complete':function(){try{var _0x352bc0=[];var _0xd7ebed=_0xb88e('0x25');if(_0xe58a97[_0xb88e('0x63')]&&_0xe58a97['duplicates'][_0xb88e('0x4f')]){_0xd7ebed=_0xb88e('0x64')+_0x3df1b6;_0x352bc0[_0xb88e('0x40')]('CREATE\x20TABLE\x20'+_0xd7ebed+_0xb88e('0x65'));}var _0x3460b7=util[_0xb88e('0xb')]('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',_0x5f1169,_0xd7ebed,_0x2f31ca,_0xe58a97[_0xb88e('0x20')],_0xe58a97['CompanyId']||null,NOW,NOW);if(_[_0xb88e('0x66')](_0x3b7739['scheduledat'])){_0x3460b7+=_0xb88e('0x67');}_0x352bc0[_0xb88e('0x40')](_0x3460b7);if(_0xe58a97[_0xb88e('0x63')]&&_0xe58a97[_0xb88e('0x63')][_0xb88e('0x4f')]){_0x352bc0[_0xb88e('0x40')](insertCmContact(_0xe58a97['ListId'],_0xd7ebed,_0xe58a97[_0xb88e('0x63')],_0x3b7739));_0x352bc0[_0xb88e('0x40')](_0xb88e('0x68')+_0xd7ebed+';');}_0x352bc0[_0xb88e('0x40')](insertCmHopper(_0xe58a97['ListId'],'voice_queues_has_cm_lists',_0xb88e('0x69'),_0xb88e('0x6a'),_0x555c41));_0x352bc0['push'](insertCmHopperBlack(_0xe58a97['ListId'],_0xb88e('0x6b'),_0xb88e('0x69'),_0xb88e('0x6a')));_0x352bc0[_0xb88e('0x40')](insertCmHopper(_0xe58a97[_0xb88e('0x20')],_0xb88e('0x6c'),_0xb88e('0x6d'),'CampaignId',_0x555c41));_0x352bc0[_0xb88e('0x40')](insertCmHopperBlack(_0xe58a97[_0xb88e('0x20')],_0xb88e('0x6e'),_0xb88e('0x6d'),'CampaignId'));BPromise[_0xb88e('0x6f')](_0x352bc0,handleQuery)[_0xb88e('0x70')](function(_0x462526){stats['finish']=!![];stats['affectedRows']=_0xe58a97['duplicates']&&_0xe58a97[_0xb88e('0x63')][_0xb88e('0x4f')]?results[0x2][_0xb88e('0x71')]:results[0x0]['affectedRows'];socket[_0xb88e('0x5e')](_0xb88e('0x5f')+_0x3df1b6,stats);fs[_0xb88e('0x72')](_0x843bcd);fs[_0xb88e('0x72')](_0x5f1169);process['exit'](0x0);})['catch'](function(_0x3fba6c){logger[_0xb88e('0x44')](_0x3fba6c[_0xb88e('0x3e')]);process[_0xb88e('0x3f')](0x1);});}catch(_0x129dde){logger[_0xb88e('0x44')](_0xb88e('0x73'),_0x129dde[_0xb88e('0x3e')]);process[_0xb88e('0x3f')](0x1);}},'error':function(_0x2a936f,_0x2f6a66,_0x4e0fb8,_0x377343){throw new Error(_0x377343);}});}function validate(){if(process[_0xb88e('0x74')]&&process[_0xb88e('0x74')]['length']<0x4){throw new Error(_0xb88e('0x75'));}var _0x2a74bc=path[_0xb88e('0x11')](config[_0xb88e('0x76')],_0xb88e('0x49'),process[_0xb88e('0x74')][0x2]);if(!fs['existsSync'](_0x2a74bc)){throw new Error(_0xb88e('0x77'));}var _0x540189={};try{_0x540189=JSON[_0xb88e('0x4d')](process[_0xb88e('0x74')][0x3]);if(!_0x540189['binding']){throw new Error(_0xb88e('0x78'));}if(!_0x540189[_0xb88e('0x47')][_0xb88e('0xf')]){throw new Error(_0xb88e('0x79'));}if(!_0x540189[_0xb88e('0x47')][_0xb88e('0x5d')]){throw new Error(_0xb88e('0x7a'));}var _0x1269b4=0x0;if(_0x540189[_0xb88e('0x47')][_0xb88e('0x23')]){_0x1269b4=0x1;}if(!_0x540189['ListId']){throw new Error(_0xb88e('0x7b'));}}catch(_0x2ab8b8){throw new Error(_0xb88e('0x7c'));}var _0x546ec9=[];try{_0x546ec9=_[_0xb88e('0x7d')](JSON[_0xb88e('0x4d')](process[_0xb88e('0x74')][0x4]),'id');}catch(_0x5d3903){logger['info'](_0xb88e('0x7e'));}main(_0x2a74bc,_0x540189,_0x546ec9,_0x1269b4);}validate();process['on'](_0xb88e('0x7f'),handleStop);process['on'](_0xb88e('0x80'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 88b0f75..0fd1834 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 _0x46bb=['CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','toString','info','Received\x20SIGINT','error','spread','main','stringify','send','start','clone','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','AdditionalPhones','header','writeFileSync','parse','data','rows','errors','find','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','dateOfBirth','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','abort','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','all','contact','contactTypeId','orderBy','DROP\x20TABLE\x20','finish','unlink','exit','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','bluebird','ioredis','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','cm_contacts_temp_','format','test','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','length','isNil','push','then','catch','message','split','findOne','CmContactHasItem','update','create','PHONE','inserted','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','fromQuery','scheduledat','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_hopper','\x22onlyIfOpen\x22','\x22always\x22','cm_contacts.ListId','cm_contacts.createdAt','into','cm_hopper_black','cm_contacts','cm_contacts.phone\x20NOT\x20IN\x20(?)','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','keys'];(function(_0x382ff3,_0x1a8673){var _0x322de4=function(_0x30d611){while(--_0x30d611){_0x382ff3['push'](_0x382ff3['shift']());}};_0x322de4(++_0x1a8673);}(_0x46bb,0x186));var _0xb46b=function(_0x58c239,_0x1788bc){_0x58c239=_0x58c239-0x0;var _0x1cd7cb=_0x46bb[_0x58c239];return _0x1cd7cb;};'use strict';var fs=require('fs');var path=require(_0xb46b('0x0'));var _=require('lodash');var Papa=require(_0xb46b('0x1'));var util=require(_0xb46b('0x2'));var BPromise=require(_0xb46b('0x3'));var moment=require('moment');var squel=require('squel');var Redis=require(_0xb46b('0x4'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0xb46b('0x5'))(_0xb46b('0x6'));config[_0xb46b('0x7')]=_[_0xb46b('0x8')](config[_0xb46b('0x7')],{'host':_0xb46b('0x9'),'port':0x18eb});var socket=require(_0xb46b('0xa'))(new Redis(config[_0xb46b('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xb46b('0xb')+moment()[_0xb46b('0xc')]('YYYYMMDDHHmmss');var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x43f066){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))*$/[_0xb46b('0xd')](_0x43f066);}function selectNotIn(_0x2263a9,_0x4e0b34,_0x185af2,_0x31f514,_0x2c73fe){return squel[_0xb46b('0xe')]()[_0xb46b('0xf')](_0xb46b('0x10'))[_0xb46b('0x11')](_0x31f514)[_0xb46b('0x12')](_0x4e0b34,null,_0x4e0b34+_0xb46b('0x13')+_0x31f514+'.'+_0x185af2)['where'](_0x31f514+'.'+_0x185af2+_0xb46b('0x14')+_0x2263a9+'.'+_0x185af2)[_0xb46b('0x15')](_0x4e0b34+_0xb46b('0x16')+_0x2c73fe['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x557b75,_0x22e16f){promisesAdditionalPhones=[];promisesContact=[];return db[_0xb46b('0x17')][_0xb46b('0x18')](_0xb46b('0x19')+tempTableName)['spread'](function(_0x320d0f){if(_0x320d0f!==null){var _0x2501a7=[];for(var _0x27977d=0x0;_0x27977d<_0x320d0f[_0xb46b('0x1a')];_0x27977d++){var _0x3b45a6=_0x320d0f[_0x27977d];if(!_[_0xb46b('0x1b')](_0x3b45a6[_0xb46b('0x10')])){if(!_[_0xb46b('0x1b')](_0x3b45a6['AdditionalPhones']))_0x2501a7[_0xb46b('0x1c')](insertAdditionalPhones(_0x3b45a6));promisesContact[_0xb46b('0x1c')]({'contact':_0x3b45a6});}}}Promise['all'](_0x2501a7)[_0xb46b('0x1d')](function(){_0x557b75({'val':0x1});});})[_0xb46b('0x1e')](function(_0x236b39){logger['error'](_0x236b39[_0xb46b('0x1f')]);});});}function insertAdditionalPhones(_0x133bb0){return new Promise(function(_0x393a69,_0x1af559){var _0x28dce0=_0x133bb0['AdditionalPhones'];if(_['isNil'](_0x28dce0))_0x1af559({'val':0x0});else{var _0x2a3969=_0x28dce0[_0xb46b('0x20')](';');var _0x3e5126=[];orderBy=0x0;for(var _0x3df386=0x0;_0x3df386<_0x2a3969['length'];_0x3df386++){_0x3e5126[_0xb46b('0x1c')](splitAdditionalPhone(_0x133bb0['id'],_0x2a3969[_0x3df386]));}Promise['all'](_0x3e5126)[_0xb46b('0x1d')](function(){_0x393a69({'val':_0x2a3969[_0xb46b('0x1a')]});});}});}function splitAdditionalPhone(_0x3a64a0,_0x5c080a){return new Promise(function(_0x3f48e7,_0x51f8f4){var _0x5f5a2e=_0x5c080a[_0xb46b('0x20')](':');var _0x37fd88=_0x5f5a2e[0x0];var _0x3a2ad6=_0x5f5a2e[0x1];if(_0x3a2ad6!==''){var _0x2451cd=_0x3a2ad6[_0xb46b('0x20')]('|');var _0x1102bb=[];for(var _0x5a7f5a=0x0;_0x5a7f5a<_0x2451cd[_0xb46b('0x1a')];_0x5a7f5a++){if(_0x2451cd[_0x5a7f5a]!==''){var _0x389334=_['filter'](promisesAdditionalPhones,{'contactId':_0x3a64a0,'phone':_0x2451cd[_0x5a7f5a]});if(_0x389334['length']==0x0){orderBy++;promisesAdditionalPhones[_0xb46b('0x1c')]({'contactId':_0x3a64a0,'contactTypeId':_0x37fd88,'phone':_0x2451cd[_0x5a7f5a],'orderBy':orderBy});}}}_0x3f48e7({'ok':0x1});}else _0x3f48e7({'res':0x0});});}function createAdditionalPhone(_0x54e843,_0x4771b4,_0x2e30de,_0x12feea){return new Promise(function(_0x4d6207,_0x303268){return db['CmContactHasItem'][_0xb46b('0x21')]({'where':{'CmContactId':_0x54e843,'item':_0x2e30de}})['then'](function(_0x1f874c){if(_0x1f874c){return db[_0xb46b('0x22')][_0xb46b('0x23')]({'ItemTypeId':_0x4771b4,'OrderBy':_0x12feea},{'where':{'CmContactId':_0x54e843,'item':_0x2e30de}})[_0xb46b('0x1d')](function(_0x227d2a){_0x4d6207({'res':'updated'});});}else{return db[_0xb46b('0x22')][_0xb46b('0x24')]({'CmContactId':_0x54e843,'item':_0x2e30de,'ItemTypeId':_0x4771b4,'OrderBy':_0x12feea,'ItemClass':_0xb46b('0x25')})[_0xb46b('0x1d')](function(_0x75f2bc){_0x4d6207({'res':_0xb46b('0x26')});});}});});}function updateContact(_0x38d676){return new Promise(function(_0x20f233,_0x4ad807){var _0x3b312c=_0x38d676['id'];delete _0x38d676['id'];return db['CmContact'][_0xb46b('0x23')](_0x38d676,{'where':{'id':_0x3b312c}})[_0xb46b('0x1d')](function(_0x42f83b){updatedRows+=0x1;return db[_0xb46b('0x27')][_0xb46b('0x23')]({'phone':_0x38d676['phone']},{'where':{'ContactId':_0x3b312c}})[_0xb46b('0x1d')](function(_0x475d74){_0x20f233({'ret':'OK'});});});});}function insertCmHopper(_0x30fed7,_0x215d0f,_0x35eb26,_0x30ea3b,_0x2c0889){var _0x3f18ce=[_0xb46b('0x28'),_0xb46b('0x29'),_0xb46b('0x2a'),'cm_contacts.ListId',_0x215d0f+'.'+_0x30ea3b,'cm_contacts.createdAt',_0xb46b('0x2b'),_0xb46b('0x2c'),_0xb46b('0x2d'),'\x22'+_0x2c0889+'\x22'];return squel[_0xb46b('0x2e')]()['into']('cm_hopper')[_0xb46b('0x2f')]([_0xb46b('0x10'),_0xb46b('0x30'),'ContactId',_0xb46b('0x31'),_0x30ea3b,_0xb46b('0x32'),_0xb46b('0x33'),_0xb46b('0x34'),_0xb46b('0x35'),_0xb46b('0x36')],squel['select']()[_0xb46b('0x37')](_0x3f18ce)[_0xb46b('0x11')](_0x215d0f)[_0xb46b('0x12')]('cm_contacts',null,_0xb46b('0x38')+_0x215d0f+_0xb46b('0x39'))['join'](_0x35eb26,null,_0x35eb26+_0xb46b('0x13')+_0x215d0f+'.'+_0x30ea3b)[_0xb46b('0x15')](_0x215d0f+_0xb46b('0x3a'),_0x30fed7)['where'](_0xb46b('0x3b'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x215d0f,_0x35eb26,_0x30ea3b,_0xb46b('0x3c'),['\x22always\x22',_0xb46b('0x3d')]))[_0xb46b('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x215d0f,_0x35eb26,_0x30ea3b,_0xb46b('0x3c'),[_0xb46b('0x3e')])))['toString']();}function insertCmHopperBlack(_0x327d7c,_0x3df353,_0x1ccded,_0x2f81f3){var _0x1b415b=[_0xb46b('0x28'),'cm_contacts.id',_0xb46b('0x3f'),_0x3df353+'.'+_0x2f81f3,_0xb46b('0x40'),_0xb46b('0x2b')];return squel[_0xb46b('0x2e')]()[_0xb46b('0x41')](_0xb46b('0x42'))[_0xb46b('0x2f')]([_0xb46b('0x10'),'ContactId',_0xb46b('0x31'),_0x2f81f3,_0xb46b('0x32'),'updatedAt'],squel['select']()[_0xb46b('0x37')](_0x1b415b)[_0xb46b('0x11')](_0x3df353)['join'](_0xb46b('0x43'),null,_0xb46b('0x38')+_0x3df353+_0xb46b('0x39'))['join'](_0x1ccded,null,_0x1ccded+'.id\x20=\x20'+_0x3df353+'.'+_0x2f81f3)[_0xb46b('0x15')](_0x3df353+_0xb46b('0x3a'),_0x327d7c)[_0xb46b('0x15')](_0xb46b('0x3b'),NOW)[_0xb46b('0x15')](_0xb46b('0x44'),squel['select']()[_0xb46b('0xf')](_0xb46b('0x10'))[_0xb46b('0x11')](_0xb46b('0x42'))[_0xb46b('0x15')](_0xb46b('0x45'),_0x327d7c)[_0xb46b('0x15')](_0x2f81f3+'\x20=\x20?',_0x3df353+'.'+_0x2f81f3)))['toString']();}function insertCmHopperAdditionalPhones(_0x2bc28d){var _0x3d2999=[_0xb46b('0x46'),_0xb46b('0x47'),_0xb46b('0x48'),_0xb46b('0x49'),_0xb46b('0x4a')];return squel[_0xb46b('0x2e')]()[_0xb46b('0x41')]('cm_hopper_additional_phones')[_0xb46b('0x2f')]([_0xb46b('0x4b'),_0xb46b('0x10'),_0xb46b('0x4c'),'createdAt',_0xb46b('0x33')],squel[_0xb46b('0xe')]()[_0xb46b('0x37')](_0x3d2999)[_0xb46b('0x11')]('cm_hopper')[_0xb46b('0x12')](_0xb46b('0x43'),null,_0xb46b('0x4d'))[_0xb46b('0x12')](_0xb46b('0x4e'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xb46b('0x15')](_0xb46b('0x4f'),_0x2bc28d)[_0xb46b('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x59da66,_0x3edc49,_0x1c5384,_0x3ea2d1){var _0x2df2ff=_['concat'](_[_0xb46b('0x50')](_0x3ea2d1),[_0xb46b('0x31'),_0xb46b('0x51'),_0xb46b('0x32'),_0xb46b('0x33')]);return squel[_0xb46b('0x2e')]()[_0xb46b('0x41')]('cm_contacts')['fromQuery'](_0x2df2ff,squel[_0xb46b('0xe')]()[_0xb46b('0x37')](_0x2df2ff)[_0xb46b('0x11')](_0x3edc49)['where']('('+_0x1c5384['join'](',')+_0xb46b('0x52'),squel[_0xb46b('0xe')]()['fields'](_0x1c5384)[_0xb46b('0x11')]('cm_contacts')[_0xb46b('0x15')](_0xb46b('0x45'),_0x59da66))[_0xb46b('0x15')](_0xb46b('0x53'),squel[_0xb46b('0xe')]()[_0xb46b('0xf')](_0xb46b('0x54'),_0xb46b('0x55'))['from'](_0x3edc49)[_0xb46b('0x56')](_0x1c5384[_0xb46b('0x12')](','))))[_0xb46b('0x57')]();}function handleStop(){logger[_0xb46b('0x58')](_0xb46b('0x59'));stopped=!![];}function handleUncaughtException(_0x40359d){logger[_0xb46b('0x5a')](_0x40359d[_0xb46b('0x1f')]);process['exit'](0x1);}function handleError(_0x41c99f,_0x434b82){stats['errors'][_0xb46b('0x1c')]({'name':_0x434b82['code'],'message':_0x434b82[_0xb46b('0x1f')],'row':_0x41c99f});}function handleQuery(_0x106fbd){logger[_0xb46b('0x58')](_0x106fbd);return db['sequelize']['query'](_0x106fbd)[_0xb46b('0x5b')](function(_0x1cc540){results['push'](_0x1cc540);})[_0xb46b('0x1e')](function(_0x14f331){logger['error'](_0x14f331[_0xb46b('0x1f')]);});}function main(_0x4d10c9,_0x3c8282,_0x5d2b90,_0x1b2d93){logger['info'](_0xb46b('0x5c'),_0x4d10c9,JSON[_0xb46b('0x5d')](_0x3c8282));process[_0xb46b('0x5e')](_0xb46b('0x5f'));var _0xe61fab=_0x3c8282['binding'];var _0xa6d5b1=_[_0xb46b('0x60')](_0xe61fab);var _0x13a42f=_0x3c8282[_0xb46b('0x61')];var _0x336a70=path[_0xb46b('0x12')](config[_0xb46b('0x62')],_0xb46b('0x63'),_0x13a42f+_0xb46b('0x64'));logger[_0xb46b('0x58')](_0xb46b('0x65'),_0x3c8282);db[_0xb46b('0x66')][_0xb46b('0x67')]({'raw':!![],'attributes':['id','name']})[_0xb46b('0x1d')](function(_0x451102){for(var _0x15f6b3=0x0;_0x15f6b3<_0x451102[_0xb46b('0x1a')];_0x15f6b3++){if(_0x451102[_0x15f6b3]['name']in _0xe61fab){contactItemTypes[_0xb46b('0x1c')](_0x451102[_0x15f6b3]);delete _0xa6d5b1[_0x451102[_0x15f6b3][_0xb46b('0x68')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0xa6d5b1[_0xb46b('0x69')]='';var _0x675633=_[_0xb46b('0x50')](_0xa6d5b1)[_0xb46b('0x12')]();logger['info'](_0xb46b('0x6a'),_0x675633);fs[_0xb46b('0x6b')](_0x336a70,_0x675633+'\x0a');Papa[_0xb46b('0x6c')](fs['createReadStream'](_0x4d10c9),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3ec07d,_0x350943){try{for(var _0x474f39=0x0,_0x2972bc=[];_0x474f39<_0x3ec07d[_0xb46b('0x6d')]['length'];_0x474f39++){stats[_0xb46b('0x6e')]+=0x1;if(_0x3ec07d[_0xb46b('0x6f')][_0x474f39]){handleError(_0x3ec07d[_0xb46b('0x6d')][_0x474f39],_0x3ec07d[_0xb46b('0x6f')][_0x474f39]);}else{var _0x2eec76=[];var _0x4e5352=[];for(var _0x43ef1 in _0xe61fab){let _0x5399b0=contactItemTypes[_0xb46b('0x70')](_0x566663=>_0x566663[_0xb46b('0x68')]===_0x43ef1);if(_[_0xb46b('0x1b')](_0x5399b0)){if(_0xe61fab[_0xb46b('0x71')](_0x43ef1)){if(_0x3ec07d[_0xb46b('0x6d')][_0x474f39][_0xe61fab[_0x43ef1]]){var _0x48edd2=_[_0xb46b('0x72')](_0x3ec07d[_0xb46b('0x6d')][_0x474f39][_0xe61fab[_0x43ef1]][_0xb46b('0x73')](/"/g,'\x27'));switch(_0x43ef1){case _0xb46b('0x30'):var _0x567bf2=moment(_0x48edd2,_0xb46b('0x74'),!![]);if(_0x567bf2[_0xb46b('0x75')]()){_0x2972bc[_0xb46b('0x1c')]('\x22'+_0x48edd2+'\x22');}else{_0x2eec76[_0xb46b('0x1c')](_0xb46b('0x76'));}break;case _0xb46b('0x34'):var _0x767a49=parseInt(_0x48edd2);_0x48edd2=_[_0xb46b('0x77')](_0x767a49)||_0x767a49<0x0||_0x767a49>0x4?_0x1b2d93?0x3:0x2:_0x767a49;_0x2972bc[_0xb46b('0x1c')]('\x22'+_0x48edd2+'\x22');break;case _0xb46b('0x35'):var _0x349ecc=parseInt(_0x48edd2);if(_[_0xb46b('0x78')](_0x349ecc)&&_[_0xb46b('0x79')](_0x5d2b90,_0x349ecc)){_0x2972bc[_0xb46b('0x1c')]('\x22'+_0x349ecc+'\x22');}else{_0x2eec76[_0xb46b('0x1c')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x48edd2)){_0x2972bc['push']('\x22'+_0x48edd2+'\x22');}else{_0x2eec76['push']('email\x20wrong\x20format');}break;case _0xb46b('0x7a'):var _0x2fa4f4=moment(_0x48edd2,'YYYY-MM-DD',!![]);if(_0x2fa4f4['isValid']()){_0x2972bc[_0xb46b('0x1c')]('\x22'+_0x48edd2+'\x22');}else{_0x2eec76[_0xb46b('0x1c')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x2972bc[_0xb46b('0x1c')]('\x22'+_0x48edd2+'\x22');}}else{switch(_0x43ef1){case _0xb46b('0x7b'):case _0xb46b('0x10'):_0x2eec76[_0xb46b('0x1c')](_0x43ef1+_0xb46b('0x7c'));break;default:_0x2972bc[_0xb46b('0x1c')]('\x22\x22');}}}}else{var _0x4833bf='';for(var _0x45e9b4=0x0;_0x45e9b4<_0xe61fab[_0x43ef1]['length'];_0x45e9b4++){var _0x48edd2=_[_0xb46b('0x72')](_0x3ec07d[_0xb46b('0x6d')][_0x474f39][_0xe61fab[_0x43ef1][_0x45e9b4]][_0xb46b('0x73')](/"/g,'\x27'));if(_0x4833bf=='')_0x4833bf=_0x48edd2;else _0x4833bf+='|'+_0x48edd2;}_0x4e5352[_0xb46b('0x1c')](_0x5399b0['id']+':'+_0x4833bf);}}if(hasAdditionalPhones){_0x2972bc['push']('\x22'+_0x4e5352[_0xb46b('0x12')](';')+'\x22');}if(_0x2eec76[_0xb46b('0x1a')]){handleError(_0x3ec07d[_0xb46b('0x6d')][_0x474f39],{'code':_0xb46b('0x7d'),'message':_0x2eec76[_0xb46b('0x12')]()});}else{fs[_0xb46b('0x7e')](_0x336a70,_0x2972bc['join']()+'\x0a');}_0x2972bc=[];}if(!(stats[_0xb46b('0x6e')]%0xc8)){socket[_0xb46b('0x7f')](_0xb46b('0x80')+_0x13a42f,stats);stats[_0xb46b('0x6f')]=[];}}if(stopped){logger[_0xb46b('0x58')]('Abort\x20parser');_0x350943[_0xb46b('0x81')]();}}catch(_0x5edb5d){handleError(_0x3ec07d[_0xb46b('0x6d')][_0x474f39],{'code':'SystemError','message':_0x5edb5d[_0xb46b('0x1f')]});logger[_0xb46b('0x5a')](_0xb46b('0x82'),_0x5edb5d[_0xb46b('0x1f')]);}},'complete':function(){try{var _0x463f63=[];var _0x1264c2=tempTableName;_0x463f63['push'](_0xb46b('0x83')+_0x1264c2+_0xb46b('0x84'));logger[_0xb46b('0x58')](_0xb46b('0x85'),contactItemTypes[_0xb46b('0x1a')]);var _0x3226f0=util[_0xb46b('0xc')](_0xb46b('0x86'),_0x336a70,_0x1264c2,_0x675633,_0x3c8282['ListId'],_0x3c8282[_0xb46b('0x51')]||null,NOW,NOW);if(_[_0xb46b('0x1b')](_0xe61fab['scheduledat'])){_0x3226f0+=_0xb46b('0x87');}_0x463f63[_0xb46b('0x1c')](_0x3226f0);BPromise[_0xb46b('0x88')](_0x463f63,handleQuery)['then'](function(_0x1d1790){BPromise[_0xb46b('0x89')]([handleAdditionalPhones()])[_0xb46b('0x1d')](function(){_0x463f63=[];for(var _0x349467=0x0;_0x349467\x20\x20','existsSync','parse','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYYMMDDHHmmss','test','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','spread','length','isNil','AdditionalPhones','push','all','catch','error','message','split','then','filter','CmContactHasItem','findOne','updated','PHONE','CmContact','update','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','into','cm_hopper','fromQuery','ContactId','ListId','updatedAt','UserId','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22'];(function(_0x1892c2,_0x30f95b){var _0x2c722a=function(_0x4a804d){while(--_0x4a804d){_0x1892c2['push'](_0x1892c2['shift']());}};_0x2c722a(++_0x30f95b);}(_0x1f08,0x192));var _0x81f0=function(_0x4a78a0,_0x2e6435){_0x4a78a0=_0x4a78a0-0x0;var _0x5d672c=_0x1f08[_0x4a78a0];return _0x5d672c;};'use strict';var fs=require('fs');var path=require(_0x81f0('0x0'));var _=require(_0x81f0('0x1'));var Papa=require(_0x81f0('0x2'));var util=require(_0x81f0('0x3'));var BPromise=require(_0x81f0('0x4'));var moment=require(_0x81f0('0x5'));var squel=require(_0x81f0('0x6'));var Redis=require(_0x81f0('0x7'));var db=require(_0x81f0('0x8'))['db'];var config=require(_0x81f0('0x9'));var logger=require(_0x81f0('0xa'))(_0x81f0('0xb'));config[_0x81f0('0xc')]=_[_0x81f0('0xd')](config['redis'],{'host':_0x81f0('0xe'),'port':0x18eb});var socket=require(_0x81f0('0xf'))(new Redis(config[_0x81f0('0xc')]));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()[_0x81f0('0x10')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName='cm_contacts_temp_'+moment()[_0x81f0('0x10')](_0x81f0('0x11'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x582902){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))*$/[_0x81f0('0x12')](_0x582902);}function selectNotIn(_0x4e139c,_0x1ffee2,_0x39d46c,_0xaff63f,_0x34f279){return squel[_0x81f0('0x13')]()[_0x81f0('0x14')](_0x81f0('0x15'))[_0x81f0('0x16')](_0xaff63f)[_0x81f0('0x17')](_0x1ffee2,null,_0x1ffee2+_0x81f0('0x18')+_0xaff63f+'.'+_0x39d46c)['where'](_0xaff63f+'.'+_0x39d46c+_0x81f0('0x19')+_0x4e139c+'.'+_0x39d46c)[_0x81f0('0x1a')](_0x1ffee2+_0x81f0('0x1b')+_0x34f279[_0x81f0('0x17')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3d866d,_0x31826c){promisesAdditionalPhones=[];promisesContact=[];return db[_0x81f0('0x1c')][_0x81f0('0x1d')]('select\x20*\x20from\x20'+tempTableName)[_0x81f0('0x1e')](function(_0x8d7404){if(_0x8d7404!==null){var _0x1c7205=[];for(var _0x2ab933=0x0;_0x2ab933<_0x8d7404[_0x81f0('0x1f')];_0x2ab933++){var _0x38cc15=_0x8d7404[_0x2ab933];if(!_[_0x81f0('0x20')](_0x38cc15[_0x81f0('0x15')])){if(!_[_0x81f0('0x20')](_0x38cc15[_0x81f0('0x21')]))_0x1c7205[_0x81f0('0x22')](insertAdditionalPhones(_0x38cc15));promisesContact[_0x81f0('0x22')]({'contact':_0x38cc15});}}}Promise[_0x81f0('0x23')](_0x1c7205)['then'](function(){_0x3d866d({'val':0x1});});})[_0x81f0('0x24')](function(_0x43b4a3){logger[_0x81f0('0x25')](_0x43b4a3[_0x81f0('0x26')]);});});}function insertAdditionalPhones(_0x4f2051){return new Promise(function(_0x58c463,_0x2e9af3){var _0x2c35c5=_0x4f2051[_0x81f0('0x21')];if(_[_0x81f0('0x20')](_0x2c35c5))_0x2e9af3({'val':0x0});else{var _0x779e35=_0x2c35c5[_0x81f0('0x27')](';');var _0x147667=[];orderBy=0x0;for(var _0x1b6b6c=0x0;_0x1b6b6c<_0x779e35[_0x81f0('0x1f')];_0x1b6b6c++){_0x147667[_0x81f0('0x22')](splitAdditionalPhone(_0x4f2051['id'],_0x779e35[_0x1b6b6c]));}Promise[_0x81f0('0x23')](_0x147667)[_0x81f0('0x28')](function(){_0x58c463({'val':_0x779e35[_0x81f0('0x1f')]});});}});}function splitAdditionalPhone(_0x34e0db,_0x279701){return new Promise(function(_0x32ff5c,_0x4a4c57){var _0x5ef11f=_0x279701[_0x81f0('0x27')](':');var _0x4363a8=_0x5ef11f[0x0];var _0x37edc7=_0x5ef11f[0x1];if(_0x37edc7!==''){var _0x50de6e=_0x37edc7[_0x81f0('0x27')]('|');var _0x1ba549=[];for(var _0x1dac9c=0x0;_0x1dac9c<_0x50de6e[_0x81f0('0x1f')];_0x1dac9c++){if(_0x50de6e[_0x1dac9c]!==''){var _0x56573a=_[_0x81f0('0x29')](promisesAdditionalPhones,{'contactId':_0x34e0db,'phone':_0x50de6e[_0x1dac9c]});if(_0x56573a['length']==0x0){orderBy++;promisesAdditionalPhones[_0x81f0('0x22')]({'contactId':_0x34e0db,'contactTypeId':_0x4363a8,'phone':_0x50de6e[_0x1dac9c],'orderBy':orderBy});}}}_0x32ff5c({'ok':0x1});}else _0x32ff5c({'res':0x0});});}function createAdditionalPhone(_0x188c9a,_0x5f2713,_0x1e2ba6,_0x1435d5){return new Promise(function(_0x23684d,_0x291fc3){return db[_0x81f0('0x2a')][_0x81f0('0x2b')]({'where':{'CmContactId':_0x188c9a,'item':_0x1e2ba6}})[_0x81f0('0x28')](function(_0x11996c){if(_0x11996c){return db[_0x81f0('0x2a')]['update']({'ItemTypeId':_0x5f2713,'OrderBy':_0x1435d5},{'where':{'CmContactId':_0x188c9a,'item':_0x1e2ba6}})[_0x81f0('0x28')](function(_0x117411){_0x23684d({'res':_0x81f0('0x2c')});});}else{return db[_0x81f0('0x2a')]['create']({'CmContactId':_0x188c9a,'item':_0x1e2ba6,'ItemTypeId':_0x5f2713,'OrderBy':_0x1435d5,'ItemClass':_0x81f0('0x2d')})[_0x81f0('0x28')](function(_0x49d7e5){_0x23684d({'res':'inserted'});});}});});}function updateContact(_0x7b2a04){return new Promise(function(_0x5220b1,_0x3e8f16){var _0x280502=_0x7b2a04['id'];delete _0x7b2a04['id'];return db[_0x81f0('0x2e')][_0x81f0('0x2f')](_0x7b2a04,{'where':{'id':_0x280502}})[_0x81f0('0x28')](function(_0x3770c5){updatedRows+=0x1;return db[_0x81f0('0x30')][_0x81f0('0x2f')]({'phone':_0x7b2a04['phone']},{'where':{'ContactId':_0x280502}})['then'](function(_0x3e42d9){_0x5220b1({'ret':'OK'});});});});}function insertCmHopper(_0x5d54a3,_0x5e6dc6,_0x5c55cd,_0x16d9b6,_0x3df272){var _0x5ca3b6=[_0x81f0('0x31'),_0x81f0('0x32'),_0x81f0('0x33'),_0x81f0('0x34'),_0x5e6dc6+'.'+_0x16d9b6,_0x81f0('0x35'),_0x81f0('0x36'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x3df272+'\x22'];return squel['insert']()[_0x81f0('0x37')](_0x81f0('0x38'))[_0x81f0('0x39')]([_0x81f0('0x15'),'scheduledat',_0x81f0('0x3a'),_0x81f0('0x3b'),_0x16d9b6,'createdAt',_0x81f0('0x3c'),'priority',_0x81f0('0x3d'),'recallme'],squel[_0x81f0('0x13')]()[_0x81f0('0x3e')](_0x5ca3b6)[_0x81f0('0x16')](_0x5e6dc6)[_0x81f0('0x17')](_0x81f0('0x3f'),null,_0x81f0('0x40')+_0x5e6dc6+'.CmListId')[_0x81f0('0x17')](_0x5c55cd,null,_0x5c55cd+_0x81f0('0x18')+_0x5e6dc6+'.'+_0x16d9b6)[_0x81f0('0x1a')](_0x5e6dc6+_0x81f0('0x41'),_0x5d54a3)[_0x81f0('0x1a')](_0x81f0('0x42'),NOW)['where'](_0x81f0('0x43'),selectNotIn(_0x5e6dc6,_0x5c55cd,_0x16d9b6,_0x81f0('0x38'),[_0x81f0('0x44'),_0x81f0('0x45')]))[_0x81f0('0x1a')](_0x81f0('0x43'),selectNotIn(_0x5e6dc6,_0x5c55cd,_0x16d9b6,'cm_hopper',[_0x81f0('0x44')])))[_0x81f0('0x46')]();}function insertCmHopperBlack(_0x4922d5,_0x308f89,_0x55c5e9,_0x5cdef9){var _0x5b5f9c=[_0x81f0('0x31'),_0x81f0('0x33'),_0x81f0('0x34'),_0x308f89+'.'+_0x5cdef9,_0x81f0('0x35'),_0x81f0('0x36')];return squel[_0x81f0('0x47')]()[_0x81f0('0x37')](_0x81f0('0x48'))[_0x81f0('0x39')]([_0x81f0('0x15'),_0x81f0('0x3a'),'ListId',_0x5cdef9,_0x81f0('0x49'),_0x81f0('0x3c')],squel['select']()[_0x81f0('0x3e')](_0x5b5f9c)[_0x81f0('0x16')](_0x308f89)['join'](_0x81f0('0x3f'),null,'cm_contacts.ListId\x20=\x20'+_0x308f89+_0x81f0('0x4a'))[_0x81f0('0x17')](_0x55c5e9,null,_0x55c5e9+_0x81f0('0x18')+_0x308f89+'.'+_0x5cdef9)[_0x81f0('0x1a')](_0x308f89+'.CmListId\x20=\x20?',_0x4922d5)[_0x81f0('0x1a')](_0x81f0('0x42'),NOW)[_0x81f0('0x1a')](_0x81f0('0x43'),squel[_0x81f0('0x13')]()['field'](_0x81f0('0x15'))['from'](_0x81f0('0x48'))['where'](_0x81f0('0x4b'),_0x4922d5)[_0x81f0('0x1a')](_0x5cdef9+_0x81f0('0x4c'),_0x308f89+'.'+_0x5cdef9)))['toString']();}function insertCmHopperAdditionalPhones(_0x39f9b9){var _0x2bab20=[_0x81f0('0x4d'),_0x81f0('0x4e'),'cm_contact_has_items.OrderBy',_0x81f0('0x4f'),_0x81f0('0x50')];return squel['insert']()[_0x81f0('0x37')](_0x81f0('0x51'))['fromQuery']([_0x81f0('0x52'),_0x81f0('0x15'),_0x81f0('0x53'),_0x81f0('0x49'),_0x81f0('0x3c')],squel[_0x81f0('0x13')]()[_0x81f0('0x3e')](_0x2bab20)['from'](_0x81f0('0x38'))['join'](_0x81f0('0x3f'),null,_0x81f0('0x54'))[_0x81f0('0x17')](_0x81f0('0x55'),null,_0x81f0('0x56'))['where'](_0x81f0('0x57'),_0x39f9b9)['where'](_0x81f0('0x42'),NOW))['toString']();}function insertCmContact(_0x347fd3,_0x365735,_0xf7b6af,_0x9fd766){var _0x43dc9a=_[_0x81f0('0x58')](_[_0x81f0('0x59')](_0x9fd766),['ListId',_0x81f0('0x5a'),'createdAt',_0x81f0('0x3c')]);return squel[_0x81f0('0x47')]()[_0x81f0('0x37')](_0x81f0('0x3f'))['fromQuery'](_0x43dc9a,squel[_0x81f0('0x13')]()[_0x81f0('0x3e')](_0x43dc9a)[_0x81f0('0x16')](_0x365735)['where']('('+_0xf7b6af[_0x81f0('0x17')](',')+_0x81f0('0x5b'),squel[_0x81f0('0x13')]()['fields'](_0xf7b6af)[_0x81f0('0x16')](_0x81f0('0x3f'))['where'](_0x81f0('0x4b'),_0x347fd3))[_0x81f0('0x1a')](_0x81f0('0x5c'),squel['select']()[_0x81f0('0x14')](_0x81f0('0x5d'),_0x81f0('0x5e'))[_0x81f0('0x16')](_0x365735)['group'](_0xf7b6af[_0x81f0('0x17')](','))))[_0x81f0('0x46')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x40bfef){logger[_0x81f0('0x25')](_0x40bfef[_0x81f0('0x26')]);process[_0x81f0('0x5f')](0x1);}function handleError(_0x132c2d,_0x2ccd25){stats[_0x81f0('0x60')]['push']({'name':_0x2ccd25[_0x81f0('0x61')],'message':_0x2ccd25[_0x81f0('0x26')],'row':_0x132c2d});}function handleQuery(_0x5ac4d6){logger['info'](_0x5ac4d6);return db[_0x81f0('0x1c')]['query'](_0x5ac4d6)[_0x81f0('0x1e')](function(_0x239d0f){results[_0x81f0('0x22')](_0x239d0f);})['catch'](function(_0x43335b){logger[_0x81f0('0x25')](_0x43335b[_0x81f0('0x26')]);});}function main(_0x57966b,_0x11493c,_0x87dd7a,_0x7d38c3){logger[_0x81f0('0x62')]('main',_0x57966b,JSON['stringify'](_0x11493c));process[_0x81f0('0x63')]('start');var _0x1cb1df=_0x11493c[_0x81f0('0x64')];var _0x1bab4e=_[_0x81f0('0x65')](_0x1cb1df);var _0xa02fe7=_0x11493c['socket_timestamp'];var _0x4065b2=path[_0x81f0('0x17')](config[_0x81f0('0x66')],_0x81f0('0x67'),_0xa02fe7+_0x81f0('0x68'));logger['info']('body',_0x11493c);db[_0x81f0('0x69')][_0x81f0('0x6a')]({'raw':!![],'attributes':['id','name']})['then'](function(_0x554515){for(var _0x22f620=0x0;_0x22f620<_0x554515[_0x81f0('0x1f')];_0x22f620++){if(_0x554515[_0x22f620][_0x81f0('0x6b')]in _0x1cb1df){contactItemTypes[_0x81f0('0x22')](_0x554515[_0x22f620]);delete _0x1bab4e[_0x554515[_0x22f620]['name']];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x1bab4e[_0x81f0('0x21')]='';var _0xf5e8b7=_[_0x81f0('0x59')](_0x1bab4e)[_0x81f0('0x17')]();logger[_0x81f0('0x62')](_0x81f0('0x6c'),_0xf5e8b7);fs['writeFileSync'](_0x4065b2,_0xf5e8b7+'\x0a');Papa['parse'](fs['createReadStream'](_0x57966b),{'header':!![],'skipEmptyLines':!![],'step':function(_0xce1313,_0xe08521){try{for(var _0x3d8edc=0x0,_0x1f0374=[];_0x3d8edc<_0xce1313[_0x81f0('0x6d')]['length'];_0x3d8edc++){stats[_0x81f0('0x6e')]+=0x1;if(_0xce1313[_0x81f0('0x60')][_0x3d8edc]){handleError(_0xce1313[_0x81f0('0x6d')][_0x3d8edc],_0xce1313['errors'][_0x3d8edc]);}else{var _0x4a55d0=[];var _0x407164=[];for(var _0x56f797 in _0x1cb1df){let _0x293233=contactItemTypes[_0x81f0('0x6f')](_0x30d70c=>_0x30d70c[_0x81f0('0x6b')]===_0x56f797);if(_[_0x81f0('0x20')](_0x293233)){if(_0x1cb1df[_0x81f0('0x70')](_0x56f797)){if(_0xce1313['data'][_0x3d8edc][_0x1cb1df[_0x56f797]]){var _0x56f45b=_[_0x81f0('0x71')](_0xce1313[_0x81f0('0x6d')][_0x3d8edc][_0x1cb1df[_0x56f797]][_0x81f0('0x72')](/"/g,'\x27'));switch(_0x56f797){case _0x81f0('0x73'):var _0x3d159b=moment(_0x56f45b,_0x81f0('0x74'),!![]);if(_0x3d159b[_0x81f0('0x75')]()){_0x1f0374[_0x81f0('0x22')]('\x22'+_0x56f45b+'\x22');}else{_0x4a55d0[_0x81f0('0x22')](_0x81f0('0x76'));}break;case _0x81f0('0x77'):var _0x39f484=parseInt(_0x56f45b);_0x56f45b=_[_0x81f0('0x78')](_0x39f484)||_0x39f484<0x0||_0x39f484>0x4?_0x7d38c3?0x3:0x2:_0x39f484;_0x1f0374[_0x81f0('0x22')]('\x22'+_0x56f45b+'\x22');break;case _0x81f0('0x3d'):var _0x4b3e83=parseInt(_0x56f45b);if(_[_0x81f0('0x79')](_0x4b3e83)&&_['includes'](_0x87dd7a,_0x4b3e83)){_0x1f0374['push']('\x22'+_0x4b3e83+'\x22');}else{_0x4a55d0['push'](_0x81f0('0x7a'));}break;case'email':if(isEmail(_0x56f45b)){_0x1f0374[_0x81f0('0x22')]('\x22'+_0x56f45b+'\x22');}else{_0x4a55d0['push'](_0x81f0('0x7b'));}break;case _0x81f0('0x7c'):var _0x4439f1=moment(_0x56f45b,_0x81f0('0x7d'),!![]);if(_0x4439f1[_0x81f0('0x75')]()){_0x1f0374['push']('\x22'+_0x56f45b+'\x22');}else{_0x4a55d0['push'](_0x81f0('0x7e'));}break;default:_0x1f0374[_0x81f0('0x22')]('\x22'+_0x56f45b+'\x22');}}else{switch(_0x56f797){case _0x81f0('0x7f'):case'phone':_0x4a55d0[_0x81f0('0x22')](_0x56f797+_0x81f0('0x80'));break;default:_0x1f0374['push']('\x22\x22');}}}}else{var _0x46e6a3='';for(var _0x7cf270=0x0;_0x7cf270<_0x1cb1df[_0x56f797][_0x81f0('0x1f')];_0x7cf270++){var _0x56f45b=_[_0x81f0('0x71')](_0xce1313[_0x81f0('0x6d')][_0x3d8edc][_0x1cb1df[_0x56f797][_0x7cf270]]['replace'](/"/g,'\x27'));if(_0x46e6a3=='')_0x46e6a3=_0x56f45b;else _0x46e6a3+='|'+_0x56f45b;}_0x407164[_0x81f0('0x22')](_0x293233['id']+':'+_0x46e6a3);}}if(hasAdditionalPhones){_0x1f0374[_0x81f0('0x22')]('\x22'+_0x407164[_0x81f0('0x17')](';')+'\x22');}if(_0x4a55d0[_0x81f0('0x1f')]){handleError(_0xce1313[_0x81f0('0x6d')][_0x3d8edc],{'code':_0x81f0('0x81'),'message':_0x4a55d0[_0x81f0('0x17')]()});}else{fs[_0x81f0('0x82')](_0x4065b2,_0x1f0374[_0x81f0('0x17')]()+'\x0a');}_0x1f0374=[];}if(!(stats[_0x81f0('0x6e')]%0xc8)){socket['emit']('contact:import:'+_0xa02fe7,stats);stats[_0x81f0('0x60')]=[];}}if(stopped){logger[_0x81f0('0x62')](_0x81f0('0x83'));_0xe08521[_0x81f0('0x84')]();}}catch(_0x17ff7e){handleError(_0xce1313['data'][_0x3d8edc],{'code':_0x81f0('0x85'),'message':_0x17ff7e['message']});logger[_0x81f0('0x25')](_0x81f0('0x86'),_0x17ff7e[_0x81f0('0x26')]);}},'complete':function(){try{var _0x2b0760=[];var _0x447f57=tempTableName;_0x2b0760['push']('CREATE\x20TABLE\x20'+_0x447f57+_0x81f0('0x87'));logger[_0x81f0('0x62')](_0x81f0('0x88'),contactItemTypes[_0x81f0('0x1f')]);var _0x2caa51=util[_0x81f0('0x10')]('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',_0x4065b2,_0x447f57,_0xf5e8b7,_0x11493c[_0x81f0('0x3b')],_0x11493c[_0x81f0('0x5a')]||null,NOW,NOW);if(_['isNil'](_0x1cb1df['scheduledat'])){_0x2caa51+=',\x20scheduledAt\x20=\x20NOW()';}_0x2b0760[_0x81f0('0x22')](_0x2caa51);BPromise[_0x81f0('0x89')](_0x2b0760,handleQuery)[_0x81f0('0x28')](function(_0x1b01ed){BPromise[_0x81f0('0x23')]([handleAdditionalPhones()])[_0x81f0('0x28')](function(){_0x2b0760=[];for(var _0x52d1cd=0x0;_0x52d1cd=_0x56c25f){return _0x48f429[_0xb075('0x14')](0x193)['json']({'message':util[_0xb075('0x15')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0xeb15c)});}_0x535669();})[_0xb075('0x16')](function(_0x48ca2b){_0x535669(_0x48ca2b);});});}function isUserLimit(){return isLimit(_0xb075('0x17'),0x1,db[_0xb075('0x18')],{'where':{'$or':[{'role':_0xb075('0x19')},{'role':_0xb075('0x1a')}]}});}exports[_0xb075('0x1b')]=isUserLimit; \ No newline at end of file +var _0xf48b=['count','status','json','catch','users','User','admin','user','composable-middleware','../../mysqldb','../../config/environment','license','split','createDecipher','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','License','findOne','then'];(function(_0x727f63,_0x260d0c){var _0x2325e4=function(_0x30b205){while(--_0x30b205){_0x727f63['push'](_0x727f63['shift']());}};_0x2325e4(++_0x260d0c);}(_0xf48b,0x1b1));var _0xbf48=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf48b[_0x59ee6f];return _0x4c0979;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require(_0xbf48('0x0'));var db=require(_0xbf48('0x1'))['db'];var config=require(_0xbf48('0x2'));function getValueFromLicense(_0x3425d3,_0x3401a4){if(_0x3425d3&&_0x3401a4){if(_0x3401a4['data1']&&_0x3401a4[_0xbf48('0x3')]){var _0x299988=_0x3401a4['data1'];var _0x20b27c=_0x3401a4['license'];var _0x21f778=_0x299988[_0xbf48('0x4')]('-')[0x4];var _0x299312=_0x299988[_0xbf48('0x4')]('-')[0x0];var _0x3d02fe=crypto[_0xbf48('0x5')]('aes-256-ctr',util[_0xbf48('0x6')](_0xbf48('0x7'),_0x21f778,_0x299988,_0x299312));var _0x4428a7=_0x3d02fe[_0xbf48('0x8')](_0x20b27c,_0xbf48('0x9'),_0xbf48('0xa'));_0x4428a7+=_0x3d02fe[_0xbf48('0xb')](_0xbf48('0xa'));var _0x42708f=JSON[_0xbf48('0xc')](_0x4428a7);return _0x42708f[_0xbf48('0xd')](_0x3425d3)?_0x42708f[_0x3425d3]:null;}}return null;}function isLimit(_0x14b7b7,_0x4a5b6d,_0x47adad,_0x2731e5){var _0x472542=_0x4a5b6d;return compose()['use'](function(_0x42608e,_0xd89bea,_0x3e49a1){return db[_0xbf48('0xe')][_0xbf48('0xf')]({'where':{'id':0x1},'raw':!![]})[_0xbf48('0x10')](function(_0x119ade){var _0x288fc2=getValueFromLicense(_0x14b7b7,_0x119ade);return _0x288fc2?_0x288fc2:_0x472542;})[_0xbf48('0x10')](function(_0x161e25){_0x472542=_0x161e25;return _0x47adad[_0xbf48('0x11')](_0x2731e5);})[_0xbf48('0x10')](function(_0x3bcccd){if(_0x3bcccd>=_0x472542){return _0xd89bea[_0xbf48('0x12')](0x193)[_0xbf48('0x13')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x14b7b7)});}_0x3e49a1();})[_0xbf48('0x14')](function(_0x46ab19){_0x3e49a1(_0x46ab19);});});}function isUserLimit(){return isLimit(_0xbf48('0x15'),0x1,db[_0xbf48('0x16')],{'where':{'$or':[{'role':_0xbf48('0x17')},{'role':_0xbf48('0x18')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 810e16d..270fe09 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 _0x4c75=['$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$startsWith','pop','hours','add','minutes','seconds','format','moment','parseSearch','sqlOperator','[$or]','and','replace','split','length','slice','forEach','match','filter','indexOf','conditions','push','buildExpression','DATE','operator','$eq','value','includes','$gt','$lte','days','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','$ne','$notIn','text','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring'];(function(_0x2f0b50,_0x26936d){var _0x38b09e=function(_0x418287){while(--_0x418287){_0x2f0b50['push'](_0x2f0b50['shift']());}};_0x38b09e(++_0x26936d);}(_0x4c75,0x1d9));var _0x54c7=function(_0x3cbba7,_0x23b17c){_0x3cbba7=_0x3cbba7-0x0;var _0x512e9b=_0x4c75[_0x3cbba7];return _0x512e9b;};'use strict';var _=require('lodash');var moment=require(_0x54c7('0x0'));exports[_0x54c7('0x1')]=function(_0x14c83e){var _0x3e297b={'conditions':[]};_0x3e297b[_0x54c7('0x2')]=_['startsWith'](_0x14c83e,_0x54c7('0x3'))?'or':_0x54c7('0x4');var _0x17fcc3=_0x14c83e[_0x54c7('0x5')]('[$and]','')[_0x54c7('0x5')]('[$or]','')[_0x54c7('0x6')]('||');for(var _0x3fd0d8=0x0;_0x3fd0d8<_0x17fcc3[_0x54c7('0x7')];_0x3fd0d8++){var _0x2afd29=_0x17fcc3[_0x3fd0d8][_0x54c7('0x6')](':=');var _0x1ce2a7=_0x2afd29[0x0];var _0x515550=_0x2afd29[_0x54c7('0x8')](0x1);_0x515550[_0x54c7('0x9')](function(_0x4fe70e){var _0x32512a=_0x4fe70e[_0x54c7('0x6')]('[')['shift']();var _0xf5aaad=_0x4fe70e[_0x54c7('0xa')](/\[(.*?)\]/g);_0xf5aaad['forEach'](function(_0x2f12e5){var _0x1e2517=_0x2f12e5[_0x54c7('0x6')]('[')[_0x54c7('0xb')](function(_0x5d6ab4){return _0x5d6ab4[_0x54c7('0xc')](']')>-0x1;})['map'](function(_0x25555f){return _0x25555f[_0x54c7('0x6')](']')[0x0];})[0x0];_0x3e297b[_0x54c7('0xd')][_0x54c7('0xe')]({'field':_0x1ce2a7,'operator':_0x32512a,'value':_0x1e2517});});});}return _0x3e297b;};exports[_0x54c7('0xf')]=function(_0x127da8,_0x268271,_0x306c17){var _0x2a805={};if(_0x268271===_0x54c7('0x10')){if(_0x306c17[_0x54c7('0x11')]===_0x54c7('0x12')){_0x306c17[_0x54c7('0x11')]='$between';_0x306c17[_0x54c7('0x13')]+=','+_0x306c17[_0x54c7('0x13')];}else if(_[_0x54c7('0x14')]([_0x54c7('0x15'),_0x54c7('0x16')],_0x306c17[_0x54c7('0x11')])){_0x306c17[_0x54c7('0x13')]=moment(_0x306c17[_0x54c7('0x13')])['add'](0x1,_0x54c7('0x17'))['format'](_0x54c7('0x18'));}}if(_0x306c17['castTo']){_0x268271=_0x306c17[_0x54c7('0x19')];_0x2a805['text']=_0x54c7('0x1a')+_0x127da8+'.'+_0x306c17[_0x54c7('0x1b')]+_0x54c7('0x1c')+_0x306c17['castTo']+')\x20'+parseOperator(_0x306c17[_0x54c7('0x11')]);}else{_0x2a805['text']=_0x127da8+'.'+_0x306c17[_0x54c7('0x1b')]+'\x20'+parseOperator(_0x306c17[_0x54c7('0x11')]);}if(_[_0x54c7('0x14')]([_0x54c7('0x1d'),_0x54c7('0x1e')],_0x306c17[_0x54c7('0x11')]))_0x2a805[_0x54c7('0x1f')]='('+_0x2a805[_0x54c7('0x1f')]+_0x54c7('0x20')+_0x127da8+'.'+_0x306c17[_0x54c7('0x1b')]+_0x54c7('0x21');_0x2a805[_0x54c7('0x13')]=parseValue(_0x268271,_0x306c17[_0x54c7('0x11')],_0x306c17[_0x54c7('0x13')]);return _0x2a805;};function parseOperator(_0x832a0d){var _0x29be82;switch(_0x832a0d){case _0x54c7('0x22'):_0x29be82=_0x54c7('0x23');break;case _0x54c7('0x1e'):_0x29be82=_0x54c7('0x24');break;case _0x54c7('0x12'):_0x29be82=_0x54c7('0x25');break;case _0x54c7('0x1d'):_0x29be82=_0x54c7('0x26');break;case _0x54c7('0x27'):case'$startsWith':case _0x54c7('0x28'):_0x29be82=_0x54c7('0x29');break;case _0x54c7('0x2a'):_0x29be82=_0x54c7('0x2b');break;case _0x54c7('0x15'):_0x29be82=_0x54c7('0x2c');break;case'$lte':_0x29be82=_0x54c7('0x2d');break;case _0x54c7('0x2e'):_0x29be82=_0x54c7('0x2f');break;case'$between':_0x29be82=_0x54c7('0x30');break;}return _0x29be82;}function parseValue(_0x5c40a8,_0x451f7e,_0x3f518e){var _0x2e6908={'start':undefined,'end':undefined};switch(_0x451f7e){case _0x54c7('0x22'):case _0x54c7('0x1e'):_0x2e6908[_0x54c7('0x31')]=_0x3f518e[_0x54c7('0x6')](',');break;case _0x54c7('0x27'):_0x2e6908['start']='%'+_0x3f518e+'%';break;case _0x54c7('0x32'):_0x2e6908[_0x54c7('0x31')]=_0x3f518e+'%';break;case _0x54c7('0x28'):_0x2e6908['start']='%'+_0x3f518e;break;case'$between':var _0x2e996c=_0x3f518e[_0x54c7('0x6')](',');var _0x3f518e=_0x2e996c['shift']();var _0xcc9365=_0x2e996c[_0x54c7('0x33')]();if(_0x5c40a8===_0x54c7('0x10')){_0x3f518e=moment(_0x3f518e)['utcOffset'](0x0,!![])['format']();_0xcc9365=moment(_0xcc9365)['utcOffset'](0x0,!![])['add'](0x17,_0x54c7('0x34'))[_0x54c7('0x35')](0x3b,_0x54c7('0x36'))[_0x54c7('0x35')](0x3b,_0x54c7('0x37'))[_0x54c7('0x38')]();}_0x2e6908={'start':_0x3f518e,'end':_0xcc9365};break;default:_0x2e6908[_0x54c7('0x31')]=_0x3f518e;break;}return _0x2e6908;} \ No newline at end of file +var _0x40fe=['>=\x20?','BETWEEN\x20?\x20AND\x20?','start','shift','utcOffset','hours','minutes','seconds','lodash','moment','sqlOperator','[$or]','and','replace','split','length','slice','forEach','match','filter','indexOf','push','buildExpression','DATE','operator','$eq','$between','value','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','$substring','$startsWith','LIKE\x20?','$lt','>\x20?','<=\x20?','$gte'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0x40fe,0xaa));var _0xe40f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x40fe[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xe40f('0x0'));var moment=require(_0xe40f('0x1'));exports['parseSearch']=function(_0x523e5a){var _0x37b84={'conditions':[]};_0x37b84[_0xe40f('0x2')]=_['startsWith'](_0x523e5a,_0xe40f('0x3'))?'or':_0xe40f('0x4');var _0x3c715e=_0x523e5a['replace']('[$and]','')[_0xe40f('0x5')]('[$or]','')[_0xe40f('0x6')]('||');for(var _0x517a36=0x0;_0x517a36<_0x3c715e[_0xe40f('0x7')];_0x517a36++){var _0x505e5f=_0x3c715e[_0x517a36][_0xe40f('0x6')](':=');var _0x424f5a=_0x505e5f[0x0];var _0x1a5f97=_0x505e5f[_0xe40f('0x8')](0x1);_0x1a5f97[_0xe40f('0x9')](function(_0x1d2496){var _0x5fff85=_0x1d2496[_0xe40f('0x6')]('[')['shift']();var _0x2475a6=_0x1d2496[_0xe40f('0xa')](/\[(.*?)\]/g);_0x2475a6[_0xe40f('0x9')](function(_0x574880){var _0x34736e=_0x574880['split']('[')[_0xe40f('0xb')](function(_0xa8a811){return _0xa8a811[_0xe40f('0xc')](']')>-0x1;})['map'](function(_0x199985){return _0x199985[_0xe40f('0x6')](']')[0x0];})[0x0];_0x37b84['conditions'][_0xe40f('0xd')]({'field':_0x424f5a,'operator':_0x5fff85,'value':_0x34736e});});});}return _0x37b84;};exports[_0xe40f('0xe')]=function(_0x3f976f,_0x23870a,_0x432e22){var _0x44870d={};if(_0x23870a===_0xe40f('0xf')){if(_0x432e22[_0xe40f('0x10')]===_0xe40f('0x11')){_0x432e22[_0xe40f('0x10')]=_0xe40f('0x12');_0x432e22[_0xe40f('0x13')]+=','+_0x432e22['value'];}else if(_['includes']([_0xe40f('0x14'),_0xe40f('0x15')],_0x432e22[_0xe40f('0x10')])){_0x432e22[_0xe40f('0x13')]=moment(_0x432e22[_0xe40f('0x13')])[_0xe40f('0x16')](0x1,_0xe40f('0x17'))[_0xe40f('0x18')](_0xe40f('0x19'));}}if(_0x432e22[_0xe40f('0x1a')]){_0x23870a=_0x432e22[_0xe40f('0x1a')];_0x44870d[_0xe40f('0x1b')]=_0xe40f('0x1c')+_0x3f976f+'.'+_0x432e22[_0xe40f('0x1d')]+_0xe40f('0x1e')+_0x432e22[_0xe40f('0x1a')]+')\x20'+parseOperator(_0x432e22['operator']);}else{_0x44870d[_0xe40f('0x1b')]=_0x3f976f+'.'+_0x432e22[_0xe40f('0x1d')]+'\x20'+parseOperator(_0x432e22[_0xe40f('0x10')]);}if(_[_0xe40f('0x1f')]([_0xe40f('0x20'),_0xe40f('0x21')],_0x432e22[_0xe40f('0x10')]))_0x44870d['text']='('+_0x44870d[_0xe40f('0x1b')]+_0xe40f('0x22')+_0x3f976f+'.'+_0x432e22[_0xe40f('0x1d')]+_0xe40f('0x23');_0x44870d[_0xe40f('0x13')]=parseValue(_0x23870a,_0x432e22[_0xe40f('0x10')],_0x432e22[_0xe40f('0x13')]);return _0x44870d;};function parseOperator(_0x5f4bd6){var _0x339af3;switch(_0x5f4bd6){case _0xe40f('0x24'):_0x339af3=_0xe40f('0x25');break;case _0xe40f('0x21'):_0x339af3='NOT\x20IN\x20?';break;case _0xe40f('0x11'):_0x339af3=_0xe40f('0x26');break;case _0xe40f('0x20'):_0x339af3='<>\x20?';break;case _0xe40f('0x27'):case _0xe40f('0x28'):case'$endsWith':_0x339af3=_0xe40f('0x29');break;case _0xe40f('0x2a'):_0x339af3='<\x20?';break;case _0xe40f('0x14'):_0x339af3=_0xe40f('0x2b');break;case _0xe40f('0x15'):_0x339af3=_0xe40f('0x2c');break;case _0xe40f('0x2d'):_0x339af3=_0xe40f('0x2e');break;case _0xe40f('0x12'):_0x339af3=_0xe40f('0x2f');break;}return _0x339af3;}function parseValue(_0xe3f2e2,_0x56ac1a,_0x4c7723){var _0x58dd7e={'start':undefined,'end':undefined};switch(_0x56ac1a){case _0xe40f('0x24'):case _0xe40f('0x21'):_0x58dd7e[_0xe40f('0x30')]=_0x4c7723['split'](',');break;case _0xe40f('0x27'):_0x58dd7e[_0xe40f('0x30')]='%'+_0x4c7723+'%';break;case'$startsWith':_0x58dd7e['start']=_0x4c7723+'%';break;case'$endsWith':_0x58dd7e[_0xe40f('0x30')]='%'+_0x4c7723;break;case _0xe40f('0x12'):var _0xe4e46e=_0x4c7723[_0xe40f('0x6')](',');var _0x4c7723=_0xe4e46e[_0xe40f('0x31')]();var _0x468ecb=_0xe4e46e['pop']();if(_0xe3f2e2==='DATE'){_0x4c7723=moment(_0x4c7723)[_0xe40f('0x32')](0x0,!![])[_0xe40f('0x18')]();_0x468ecb=moment(_0x468ecb)[_0xe40f('0x32')](0x0,!![])[_0xe40f('0x16')](0x17,_0xe40f('0x33'))['add'](0x3b,_0xe40f('0x34'))[_0xe40f('0x16')](0x3b,_0xe40f('0x35'))[_0xe40f('0x18')]();}_0x58dd7e={'start':_0x4c7723,'end':_0x468ecb};break;default:_0x58dd7e[_0xe40f('0x30')]=_0x4c7723;break;}return _0x58dd7e;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 1b1ff94..483dc02 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 _0xbd10=['sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','isObject','isString','length','hasOwnProperty','isNumeric','^[+]?[0-9]*$','isEmail','match','replace','includes','push','join','lodash','sequelize','moment','fields','split','isEmpty','forOwn','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','$lte','subtract','isArray','parse','limit','offset'];(function(_0x43c2e5,_0x588843){var _0x3a76cf=function(_0x2e5cdd){while(--_0x2e5cdd){_0x43c2e5['push'](_0x43c2e5['shift']());}};_0x3a76cf(++_0x588843);}(_0xbd10,0x191));var _0x0bd1=function(_0x486592,_0xf233c6){_0x486592=_0x486592-0x0;var _0x497a7d=_0xbd10[_0x486592];return _0x497a7d;};'use strict';var _=require(_0x0bd1('0x0'));var sequelize=require(_0x0bd1('0x1'));var moment=require(_0x0bd1('0x2'));var LIMIT_VALUE=0xfa;exports[_0x0bd1('0x3')]=function(_0x3930d2){var _0x5d39c4=null;if(_0x3930d2){_0x5d39c4=_0x3930d2[_0x0bd1('0x4')](',');}return _0x5d39c4;};exports['filters']=function(_0xa9e68e,_0x58dc9b){var _0x266358={};if(!_[_0x0bd1('0x5')](_0xa9e68e)){_[_0x0bd1('0x6')](_0xa9e68e,function(_0x146a04,_0x213b13){try{if(_0x58dc9b){var _0x2365c2=_['find'](_0x58dc9b,{'name':_0x213b13})||{};if(_0x2365c2['type']===_0x0bd1('0x7')&&_[_0x0bd1('0x8')](_0x146a04)){var _0x5ef169=JSON['parse'](_0x146a04);var _0x1ff5c1={'$gte':moment(moment(_0x5ef169[_0x0bd1('0x9')])['format'](_0x0bd1('0xa')))[_0x0bd1('0xb')]()[_0x0bd1('0xc')](),'$lte':moment(moment(_0x5ef169[_0x0bd1('0xd')])['format'](_0x0bd1('0xa')))[_0x0bd1('0xb')]()[_0x0bd1('0xe')](0x1,'s')[_0x0bd1('0xc')]()};_0x266358[_0x213b13]=_0x1ff5c1;}else{_0x266358[_0x213b13]=_[_0x0bd1('0xf')](_0x146a04)?_0x146a04:JSON[_0x0bd1('0x10')](_0x146a04);}}else{_0x266358[_0x213b13]=_[_0x0bd1('0xf')](_0x146a04)?_0x146a04:JSON['parse'](_0x146a04);}}catch(_0x499700){_0x266358[_0x213b13]=_0x146a04[_0x0bd1('0x4')](',');}});}return _0x266358;};exports[_0x0bd1('0x11')]=function(_0x4fa40e){_0x4fa40e=parseInt(_0x4fa40e,0xa);if(!_0x4fa40e||_0x4fa40e<0x0){_0x4fa40e=LIMIT_VALUE;}return _0x4fa40e;};exports[_0x0bd1('0x12')]=function(_0x4394d6){_0x4394d6=parseInt(_0x4394d6,0xa);if(!_0x4394d6||_0x4394d6<0x0){_0x4394d6=0x0;}return _0x4394d6;};exports[_0x0bd1('0x13')]=function(_0x43d552){var _0x226052,_0x5544df=null;if(_0x43d552){_0x226052=_0x43d552['split'](',');_0x5544df=_[_0x0bd1('0x14')](_0x226052,function(_0x39e68d){if(_0x39e68d[_0x0bd1('0x15')]('-')===0x0){return[_0x39e68d===_0x0bd1('0x16')?sequelize[_0x0bd1('0x17')](sequelize[_0x0bd1('0x18')](_0x0bd1('0x16')),_0x0bd1('0x19')):_0x39e68d[_0x0bd1('0x1a')](0x1),_0x0bd1('0x1b')];}else{return[_0x39e68d===_0x0bd1('0x16')?sequelize[_0x0bd1('0x17')](sequelize[_0x0bd1('0x18')](_0x0bd1('0x16')),'unsigned'):_0x39e68d,_0x0bd1('0x1c')];}});}return _0x5544df;};exports[_0x0bd1('0x1d')]=function(_0x3ff104,_0x2df1e2){if(_[_0x0bd1('0x5')](_0x3ff104)){return _0x3ff104;}if(_[_0x0bd1('0xf')](_0x3ff104)){for(var _0x1c0c7d=0x0;_0x1c0c7d<_0x3ff104['length'];_0x1c0c7d+=0x1){_0x3ff104[_0x1c0c7d]=this[_0x0bd1('0x1d')](_0x3ff104[_0x1c0c7d],_0x2df1e2);}return _0x3ff104;}if(!_[_0x0bd1('0x1e')](_0x3ff104)){return _0x3ff104;}if(_[_0x0bd1('0x1f')](_0x2df1e2)){_0x2df1e2=[_0x2df1e2];}if(!_[_0x0bd1('0xf')](_0x2df1e2)){return _0x3ff104;}for(var _0x2997f3=0x0;_0x2997f3<_0x2df1e2[_0x0bd1('0x20')];_0x2997f3+=0x1){_['unset'](_0x3ff104,_0x2df1e2[_0x2997f3]);}for(var _0x3e13c3 in _0x3ff104){if(_0x3ff104[_0x0bd1('0x21')](_0x3e13c3)){_0x3ff104[_0x3e13c3]=this[_0x0bd1('0x1d')](_0x3ff104[_0x3e13c3],_0x2df1e2);}}return _0x3ff104;};exports[_0x0bd1('0x22')]=function(_0x3fc8d4){return _0x3fc8d4['match'](RegExp(_0x0bd1('0x23')))?!![]:![];};exports[_0x0bd1('0x24')]=function(_0x36056e){return _0x36056e[_0x0bd1('0x25')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x35b0a0){var _0x1b106c=[];_0x35b0a0[_0x0bd1('0x4')](/[ ,]+/)['forEach'](function(_0x1aa119){_0x1aa119=_0x1aa119[_0x0bd1('0x26')](/([^:]")"+/g,'$1');_0x1aa119='+'+_0x1aa119+'*';if(_0x1aa119[_0x0bd1('0x27')]('@'))_0x1aa119='\x22'+_0x1aa119+'\x22';_0x1b106c[_0x0bd1('0x28')](_0x1aa119);});return _0x1b106c[_0x0bd1('0x29')]('\x20');}; \ No newline at end of file +var _0x994c=['find','type','DATE','isPlainObject','parse','$gte','format','$lte','utc','subtract','isArray','split','offset','sort','map','indexOf','priority','cast','col','unsigned','DESC','ASC','omit','length','isObject','isString','unset','isNumeric','match','^[+]?[0-9]*$','isEmail','forEach','replace','includes','push','lodash','sequelize','moment','fields','filters','isEmpty'];(function(_0x5e3f54,_0x2c3432){var _0x3d12da=function(_0x5607b3){while(--_0x5607b3){_0x5e3f54['push'](_0x5e3f54['shift']());}};_0x3d12da(++_0x2c3432);}(_0x994c,0xf0));var _0xc994=function(_0x3b228b,_0x1dfc9c){_0x3b228b=_0x3b228b-0x0;var _0x1d8d6b=_0x994c[_0x3b228b];return _0x1d8d6b;};'use strict';var _=require(_0xc994('0x0'));var sequelize=require(_0xc994('0x1'));var moment=require(_0xc994('0x2'));var LIMIT_VALUE=0xfa;exports[_0xc994('0x3')]=function(_0x3f7e75){var _0x786c34=null;if(_0x3f7e75){_0x786c34=_0x3f7e75['split'](',');}return _0x786c34;};exports[_0xc994('0x4')]=function(_0x56103f,_0x316571){var _0x48120b={};if(!_[_0xc994('0x5')](_0x56103f)){_['forOwn'](_0x56103f,function(_0x9c740,_0x5e0bf0){try{if(_0x316571){var _0x42848c=_[_0xc994('0x6')](_0x316571,{'name':_0x5e0bf0})||{};if(_0x42848c[_0xc994('0x7')]===_0xc994('0x8')&&_[_0xc994('0x9')](_0x9c740)){var _0x58f25a=JSON[_0xc994('0xa')](_0x9c740);var _0x4eeb16={'$gte':moment(moment(_0x58f25a[_0xc994('0xb')])[_0xc994('0xc')]('YYYY-MM-DD'))['utc']()['format'](),'$lte':moment(moment(_0x58f25a[_0xc994('0xd')])['format']('YYYY-MM-DD'))[_0xc994('0xe')]()[_0xc994('0xf')](0x1,'s')['format']()};_0x48120b[_0x5e0bf0]=_0x4eeb16;}else{_0x48120b[_0x5e0bf0]=_['isArray'](_0x9c740)?_0x9c740:JSON[_0xc994('0xa')](_0x9c740);}}else{_0x48120b[_0x5e0bf0]=_[_0xc994('0x10')](_0x9c740)?_0x9c740:JSON[_0xc994('0xa')](_0x9c740);}}catch(_0x13c258){_0x48120b[_0x5e0bf0]=_0x9c740[_0xc994('0x11')](',');}});}return _0x48120b;};exports['limit']=function(_0x5ac6ed){_0x5ac6ed=parseInt(_0x5ac6ed,0xa);if(!_0x5ac6ed||_0x5ac6ed<0x0){_0x5ac6ed=LIMIT_VALUE;}return _0x5ac6ed;};exports[_0xc994('0x12')]=function(_0x58a4ce){_0x58a4ce=parseInt(_0x58a4ce,0xa);if(!_0x58a4ce||_0x58a4ce<0x0){_0x58a4ce=0x0;}return _0x58a4ce;};exports[_0xc994('0x13')]=function(_0x58a44f){var _0x3e6cc1,_0x40d438=null;if(_0x58a44f){_0x3e6cc1=_0x58a44f[_0xc994('0x11')](',');_0x40d438=_[_0xc994('0x14')](_0x3e6cc1,function(_0x112ccb){if(_0x112ccb[_0xc994('0x15')]('-')===0x0){return[_0x112ccb===_0xc994('0x16')?sequelize[_0xc994('0x17')](sequelize[_0xc994('0x18')](_0xc994('0x16')),_0xc994('0x19')):_0x112ccb['substr'](0x1),_0xc994('0x1a')];}else{return[_0x112ccb===_0xc994('0x16')?sequelize[_0xc994('0x17')](sequelize[_0xc994('0x18')](_0xc994('0x16')),_0xc994('0x19')):_0x112ccb,_0xc994('0x1b')];}});}return _0x40d438;};exports[_0xc994('0x1c')]=function(_0x5c0a53,_0x5c4241){if(_['isEmpty'](_0x5c0a53)){return _0x5c0a53;}if(_[_0xc994('0x10')](_0x5c0a53)){for(var _0x2564d0=0x0;_0x2564d0<_0x5c0a53[_0xc994('0x1d')];_0x2564d0+=0x1){_0x5c0a53[_0x2564d0]=this[_0xc994('0x1c')](_0x5c0a53[_0x2564d0],_0x5c4241);}return _0x5c0a53;}if(!_[_0xc994('0x1e')](_0x5c0a53)){return _0x5c0a53;}if(_[_0xc994('0x1f')](_0x5c4241)){_0x5c4241=[_0x5c4241];}if(!_['isArray'](_0x5c4241)){return _0x5c0a53;}for(var _0x2cb522=0x0;_0x2cb522<_0x5c4241['length'];_0x2cb522+=0x1){_[_0xc994('0x20')](_0x5c0a53,_0x5c4241[_0x2cb522]);}for(var _0x444b92 in _0x5c0a53){if(_0x5c0a53['hasOwnProperty'](_0x444b92)){_0x5c0a53[_0x444b92]=this[_0xc994('0x1c')](_0x5c0a53[_0x444b92],_0x5c4241);}}return _0x5c0a53;};exports[_0xc994('0x21')]=function(_0x5001c2){return _0x5001c2[_0xc994('0x22')](RegExp(_0xc994('0x23')))?!![]:![];};exports[_0xc994('0x24')]=function(_0x2543a0){return _0x2543a0[_0xc994('0x22')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x508ba6){var _0x21d0cd=[];_0x508ba6[_0xc994('0x11')](/[ ,]+/)[_0xc994('0x25')](function(_0xb78f6){_0xb78f6=_0xb78f6[_0xc994('0x26')](/([^:]")"+/g,'$1');_0xb78f6='+'+_0xb78f6+'*';if(_0xb78f6[_0xc994('0x27')]('@'))_0xb78f6='\x22'+_0xb78f6+'\x22';_0x21d0cd[_0xc994('0x28')](_0xb78f6);});return _0x21d0cd['join']('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 355a018..bd1e415 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a2a=['views','root','/server/views','engine','html','ejs','renderFile','urlencoded','50mb','json','initialize','serve-favicon','body-parser','method-override','errorhandler','path','cors','./environment','default','get','env','production','set','appPath','join','public','development','test','json\x20replacer','split','use','static'];(function(_0x2a13b7,_0x4889b0){var _0x2057c1=function(_0x57d357){while(--_0x57d357){_0x2a13b7['push'](_0x2a13b7['shift']());}};_0x2057c1(++_0x4889b0);}(_0x8a2a,0x8b));var _0xa8a2=function(_0x351509,_0x54725c){_0x351509=_0x351509-0x0;var _0x4e9861=_0x8a2a[_0x351509];return _0x4e9861;};'use strict';var express=require('express');var favicon=require(_0xa8a2('0x0'));var bodyParser=require(_0xa8a2('0x1'));var methodOverride=require(_0xa8a2('0x2'));var cookieParser=require('cookie-parser');var errorHandler=require(_0xa8a2('0x3'));var path=require(_0xa8a2('0x4'));var passport=require('passport');var cors=require(_0xa8a2('0x5'));var moment=require('moment');var config=require(_0xa8a2('0x6'));var db=require('../mysqldb')['db'];exports[_0xa8a2('0x7')]=function(_0x1a2694){var _0x1f2646=_0x1a2694[_0xa8a2('0x8')](_0xa8a2('0x9'));if(_0x1f2646===_0xa8a2('0xa')){_0x1a2694[_0xa8a2('0xb')](_0xa8a2('0xc'),path[_0xa8a2('0xd')](config['root'],_0xa8a2('0xe')));}if(_0x1f2646===_0xa8a2('0xf')||_0x1f2646===_0xa8a2('0x10')){_0x1a2694[_0xa8a2('0xb')](_0xa8a2('0xc'),path['join'](config['root'],'client'));_0x1a2694['use'](errorHandler());}_0x1a2694[_0xa8a2('0xb')](_0xa8a2('0x11'),function(_0x10e14a,_0x4fc0cb){if(this[_0x10e14a]instanceof Date){_0x4fc0cb=this[_0x10e14a]['toISOString']()[_0xa8a2('0x12')]('.')[0x0]+'Z';}return _0x4fc0cb;});_0x1a2694[_0xa8a2('0x13')](express[_0xa8a2('0x14')](_0x1a2694[_0xa8a2('0x8')](_0xa8a2('0xc'))));_0x1a2694['set'](_0xa8a2('0x15'),config[_0xa8a2('0x16')]+_0xa8a2('0x17'));_0x1a2694[_0xa8a2('0x18')](_0xa8a2('0x19'),require(_0xa8a2('0x1a'))[_0xa8a2('0x1b')]);_0x1a2694[_0xa8a2('0xb')]('view\x20engine',_0xa8a2('0x19'));_0x1a2694[_0xa8a2('0x13')](bodyParser[_0xa8a2('0x1c')]({'limit':_0xa8a2('0x1d'),'extended':!![]}));_0x1a2694[_0xa8a2('0x13')](bodyParser[_0xa8a2('0x1e')]({'limit':_0xa8a2('0x1d')}));_0x1a2694['use'](cors());_0x1a2694['use'](methodOverride());_0x1a2694[_0xa8a2('0x13')](cookieParser());_0x1a2694[_0xa8a2('0x13')](passport[_0xa8a2('0x1f')]());}; \ No newline at end of file +var _0x947a=['cors','./environment','../mysqldb','get','env','production','set','join','root','public','test','client','use','split','static','appPath','views','/server/views','engine','html','urlencoded','50mb','json','serve-favicon','body-parser','method-override','path'];(function(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0x947a,0x9e));var _0xa947=function(_0x44784c,_0x4498c1){_0x44784c=_0x44784c-0x0;var _0x4bbfb1=_0x947a[_0x44784c];return _0x4bbfb1;};'use strict';var express=require('express');var favicon=require(_0xa947('0x0'));var bodyParser=require(_0xa947('0x1'));var methodOverride=require(_0xa947('0x2'));var cookieParser=require('cookie-parser');var errorHandler=require('errorhandler');var path=require(_0xa947('0x3'));var passport=require('passport');var cors=require(_0xa947('0x4'));var moment=require('moment');var config=require(_0xa947('0x5'));var db=require(_0xa947('0x6'))['db'];exports['default']=function(_0x1b8a09){var _0x5ac76f=_0x1b8a09[_0xa947('0x7')](_0xa947('0x8'));if(_0x5ac76f===_0xa947('0x9')){_0x1b8a09[_0xa947('0xa')]('appPath',path[_0xa947('0xb')](config[_0xa947('0xc')],_0xa947('0xd')));}if(_0x5ac76f==='development'||_0x5ac76f===_0xa947('0xe')){_0x1b8a09[_0xa947('0xa')]('appPath',path[_0xa947('0xb')](config['root'],_0xa947('0xf')));_0x1b8a09[_0xa947('0x10')](errorHandler());}_0x1b8a09[_0xa947('0xa')]('json\x20replacer',function(_0x2b4e02,_0x757bf5){if(this[_0x2b4e02]instanceof Date){_0x757bf5=this[_0x2b4e02]['toISOString']()[_0xa947('0x11')]('.')[0x0]+'Z';}return _0x757bf5;});_0x1b8a09[_0xa947('0x10')](express[_0xa947('0x12')](_0x1b8a09[_0xa947('0x7')](_0xa947('0x13'))));_0x1b8a09[_0xa947('0xa')](_0xa947('0x14'),config[_0xa947('0xc')]+_0xa947('0x15'));_0x1b8a09[_0xa947('0x16')](_0xa947('0x17'),require('ejs')['renderFile']);_0x1b8a09['set']('view\x20engine',_0xa947('0x17'));_0x1b8a09[_0xa947('0x10')](bodyParser[_0xa947('0x18')]({'limit':_0xa947('0x19'),'extended':!![]}));_0x1b8a09[_0xa947('0x10')](bodyParser[_0xa947('0x1a')]({'limit':_0xa947('0x19')}));_0x1b8a09[_0xa947('0x10')](cors());_0x1b8a09[_0xa947('0x10')](methodOverride());_0x1b8a09[_0xa947('0x10')](cookieParser());_0x1b8a09[_0xa947('0x10')](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 60ba5f8..7d63206 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 _0x9f5a=['filter','family','IPv4','internal','concat','mac','address','cpus','map','model','join','createHash','update','digest','win32','replace','macAddress','ipAddress','md5','hex','substring','lodash','crypto','bimedia-machine-uuid','child_process','networkInterfaces','orderBy','length'];(function(_0x2351b7,_0x669c2c){var _0x2d0032=function(_0x54a6d2){while(--_0x54a6d2){_0x2351b7['push'](_0x2351b7['shift']());}};_0x2d0032(++_0x669c2c);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x83751a,_0x5c9b18){_0x83751a=_0x83751a-0x0;var _0x511107=_0x9f5a[_0x83751a];return _0x511107;};'use strict';var _=require(_0xa9f5('0x0'));var os=require('os');var crypto=require(_0xa9f5('0x1'));var machine=require(_0xa9f5('0x2'));var exec=require(_0xa9f5('0x3'))['execSync'];function getInterfaces(){var _0x4268b0=[];var _0x45e3f5=os[_0xa9f5('0x4')]();var _0x4eeedd=_[_0xa9f5('0x5')](_['keys'](_0x45e3f5));for(var _0x1a2b95=0x0;_0x1a2b95<_0x4eeedd[_0xa9f5('0x6')];_0x1a2b95++){var _0x49e337=_0x45e3f5[_0x4eeedd[_0x1a2b95]][_0xa9f5('0x7')](function(_0x285dad){return _0x285dad[_0xa9f5('0x8')]===_0xa9f5('0x9')&&_0x285dad[_0xa9f5('0xa')]===![];});_0x4268b0=_0x4268b0[_0xa9f5('0xb')](_0x49e337);}return _0x4268b0;}function getFirstInterface(){var _0x189ef8=_['head'](getInterfaces());return{'macAddress':_0x189ef8&&_0x189ef8[_0xa9f5('0xc')]?_0x189ef8[_0xa9f5('0xc')]:'00:00:00:00:00:00','ipAddress':_0x189ef8&&_0x189ef8[_0xa9f5('0xd')]?_0x189ef8[_0xa9f5('0xd')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x418ba3=_[_0xa9f5('0x5')](os[_0xa9f5('0xe')]()[_0xa9f5('0xf')](function(_0x4c26a8){return _0x4c26a8[_0xa9f5('0x10')];}))[_0xa9f5('0x11')](':');return crypto[_0xa9f5('0x12')]('md5')[_0xa9f5('0x13')](_0x418ba3)[_0xa9f5('0x14')]('hex');}exports['getUuid']=function(){switch(os['platform']()){case _0xa9f5('0x15'):return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})[_0xa9f5('0x16')]('\x0d\x0a','');default:var _0x131ed6=getFirstInterface();var _0x44f5e4=getCPUhash();var _0x415f12=_0x44f5e4+'|'+os['hostname']()+'|'+_0x131ed6[_0xa9f5('0x17')]+'|'+_0x131ed6[_0xa9f5('0x18')];var _0x230fc2=crypto[_0xa9f5('0x12')](_0xa9f5('0x19'))[_0xa9f5('0x13')](_0x415f12)[_0xa9f5('0x14')](_0xa9f5('0x1a'));return _0x230fc2[_0xa9f5('0x1b')](0x0,0x8)+'-'+_0x230fc2[_0xa9f5('0x1b')](0x8,0xc)+'-'+_0x230fc2[_0xa9f5('0x1b')](0xc,0x10)+'-'+_0x230fc2[_0xa9f5('0x1b')](0x10,0x14)+'-'+_0x230fc2['substring'](0x14);}}; \ No newline at end of file +var _0x4fd7=['crypto','bimedia-machine-uuid','child_process','networkInterfaces','orderBy','filter','family','IPv4','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','createHash','md5','hex','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','update','digest','substring','lodash'];(function(_0x378c82,_0x37fbc5){var _0x157349=function(_0x3f28ae){while(--_0x3f28ae){_0x378c82['push'](_0x378c82['shift']());}};_0x157349(++_0x37fbc5);}(_0x4fd7,0xe6));var _0x74fd=function(_0x5030d8,_0x2d3ac1){_0x5030d8=_0x5030d8-0x0;var _0x3787af=_0x4fd7[_0x5030d8];return _0x3787af;};'use strict';var _=require(_0x74fd('0x0'));var os=require('os');var crypto=require(_0x74fd('0x1'));var machine=require(_0x74fd('0x2'));var exec=require(_0x74fd('0x3'))['execSync'];function getInterfaces(){var _0x4fba38=[];var _0xfa6318=os[_0x74fd('0x4')]();var _0x59e3f1=_[_0x74fd('0x5')](_['keys'](_0xfa6318));for(var _0xae1ea5=0x0;_0xae1ea5<_0x59e3f1['length'];_0xae1ea5++){var _0x1959e1=_0xfa6318[_0x59e3f1[_0xae1ea5]][_0x74fd('0x6')](function(_0x566a59){return _0x566a59[_0x74fd('0x7')]===_0x74fd('0x8')&&_0x566a59['internal']===![];});_0x4fba38=_0x4fba38[_0x74fd('0x9')](_0x1959e1);}return _0x4fba38;}function getFirstInterface(){var _0x2e20c2=_[_0x74fd('0xa')](getInterfaces());return{'macAddress':_0x2e20c2&&_0x2e20c2[_0x74fd('0xb')]?_0x2e20c2[_0x74fd('0xb')]:_0x74fd('0xc'),'ipAddress':_0x2e20c2&&_0x2e20c2[_0x74fd('0xd')]?_0x2e20c2[_0x74fd('0xd')]:_0x74fd('0xe')};}exports[_0x74fd('0xf')]=getFirstInterface;function getCPUhash(){var _0x321921=_[_0x74fd('0x5')](os[_0x74fd('0x10')]()[_0x74fd('0x11')](function(_0x3fd552){return _0x3fd552[_0x74fd('0x12')];}))['join'](':');return crypto[_0x74fd('0x13')](_0x74fd('0x14'))['update'](_0x321921)['digest'](_0x74fd('0x15'));}exports[_0x74fd('0x16')]=function(){switch(os[_0x74fd('0x17')]()){case _0x74fd('0x18'):return exec(_0x74fd('0x19'),{'encoding':_0x74fd('0x1a')})[_0x74fd('0x1b')]('\x0d\x0a','');default:var _0x127353=getFirstInterface();var _0x57a832=getCPUhash();var _0x4301a7=_0x57a832+'|'+os[_0x74fd('0x1c')]()+'|'+_0x127353['macAddress']+'|'+_0x127353[_0x74fd('0x1d')];var _0x2a166b=crypto['createHash'](_0x74fd('0x14'))[_0x74fd('0x1e')](_0x4301a7)[_0x74fd('0x1f')](_0x74fd('0x15'));return _0x2a166b[_0x74fd('0x20')](0x0,0x8)+'-'+_0x2a166b[_0x74fd('0x20')](0x8,0xc)+'-'+_0x2a166b[_0x74fd('0x20')](0xc,0x10)+'-'+_0x2a166b[_0x74fd('0x20')](0x10,0x14)+'-'+_0x2a166b[_0x74fd('0x20')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index f00ed70..dd3cfb4 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 _0x09b9=['../logger','../../api/jira/jira.controller','process','format','exports','GET','then','catch','User','findOne','fullname','|reason|','|uuid|','|email|','email','openIssue','Motion\x20License\x20Alert','Alert','license','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','data1','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','request-promise','bluebird','version','../../mysqldb','./hardware'];(function(_0x1fec0a,_0x55b45f){var _0x5341d1=function(_0x47ada5){while(--_0x47ada5){_0x1fec0a['push'](_0x1fec0a['shift']());}};_0x5341d1(++_0x55b45f);}(_0x09b9,0xbe));var _0x909b=function(_0x3cb169,_0x5c4d3a){_0x3cb169=_0x3cb169-0x0;var _0x3778d9=_0x09b9[_0x3cb169];return _0x3778d9;};'use strict';var util=require(_0x909b('0x0'));var moment=require('moment');var rp=require(_0x909b('0x1'));var BPromise=require(_0x909b('0x2'));var pkginfo=require('pkginfo')(module,_0x909b('0x3'));var db=require(_0x909b('0x4'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x909b('0x5'));var logger=require(_0x909b('0x6'))('license');var jira=require(_0x909b('0x7'));const {config}=require(_0x909b('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x239214){return new BPromise(function(_0x2da64d,_0x30fbb8){var _0x1ba8c0=util[_0x909b('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x239214,module[_0x909b('0xa')][_0x909b('0x3')]);if(oldToken){_0x1ba8c0=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x239214,module['exports'][_0x909b('0x3')],oldToken);}var _0x30771d={'uri':_0x1ba8c0,'method':_0x909b('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x30771d)[_0x909b('0xc')](function(_0x8de499){_0x2da64d(_0x8de499);})[_0x909b('0xd')](function(_0x1c47e2){_0x30fbb8(_0x1c47e2);});});}function sendJiraAlert(_0x5435ca,_0x6c92c9,_0x446de1){var _0x4c7471='||FIELD||VALUE||\x0a';return db[_0x909b('0xe')][_0x909b('0xf')]({'where':{'role':'admin'},'attributes':[_0x909b('0x10'),'email'],'raw':!![]})[_0x909b('0xc')](function(_0x4869c7){ADMIN=_0x4869c7;_0x4c7471+=_0x909b('0x11')+_0x446de1+'|\x0a';_0x4c7471+=_0x909b('0x12')+_0x5435ca+'|\x0a';_0x4c7471+='|machineUuid|'+_0x6c92c9+'|\x0a';_0x4c7471+='|name|'+ADMIN[_0x909b('0x10')]+'|\x0a';_0x4c7471+=_0x909b('0x13')+ADMIN[_0x909b('0x14')]+'|\x0a';return _0x4c7471;})[_0x909b('0xc')](function(_0x35c55c){var _0x5df0a6=hardware['getFirstInterface']()['ipAddress'];return jira[_0x909b('0x15')]({'key':'MOTLICENSE','summary':_0x909b('0x16'),'description':_0x35c55c,'issuetype':_0x909b('0x17'),'oldToken':_0x5435ca,'newToken':_0x6c92c9,'email':ADMIN[_0x909b('0x14')],'name':ADMIN[_0x909b('0x10')],'reason':GRAY_PERIOD_REASON,'ip':_0x5df0a6});});}function manageLicense(_0x5a5bbf,_0x5a8210){var _0x597d29=_0x5a8210['get']({'plain':!![]});httpRequest(_0x5a5bbf)['then'](function(_0x500dc1){if(oldToken){oldToken=undefined;}if(_0x500dc1['active']){if(!_0x597d29[_0x909b('0x18')]&&_0x597d29[_0x909b('0x18')]!=_0x500dc1[_0x909b('0x18')]||_0x597d29[_0x909b('0x18')]&&_0x597d29[_0x909b('0x19')]){logger['info'](_0x909b('0x1a'));}if(_0x597d29['license']&&!_0x597d29[_0x909b('0x19')]&&_0x597d29[_0x909b('0x18')]!=_0x500dc1[_0x909b('0x18')]){logger[_0x909b('0x1b')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x597d29['license']&&!_0x597d29['data2']&&_0x597d29[_0x909b('0x18')]==_0x500dc1[_0x909b('0x18')]){return _0x5a8210;}return _0x5a8210[_0x909b('0x1c')]({'data1':_0x5a5bbf,'data2':null,'license':_0x500dc1[_0x909b('0x18')]});}else{if(_0x500dc1['license']||_0x597d29[_0x909b('0x18')]){if(!_0x597d29[_0x909b('0x19')]){if(_0x597d29['data1']==_0x5a5bbf){GRAY_PERIOD_REASON='Disabled';logger[_0x909b('0x1b')](_0x909b('0x1d'));}else{GRAY_PERIOD_REASON='Changed';oldToken=_0x597d29[_0x909b('0x1e')];logger[_0x909b('0x1b')](_0x909b('0x1f'),_0x597d29[_0x909b('0x1e')],_0x5a5bbf);}sendJiraAlert(_0x597d29[_0x909b('0x1e')],_0x500dc1[_0x909b('0x20')],GRAY_PERIOD_REASON);logger['info'](_0x909b('0x21'),GRAY_PERIOD_REASON[_0x909b('0x22')](),moment()[_0x909b('0x9')](_0x909b('0x23')));return _0x5a8210[_0x909b('0x1c')]({'data2':encryptor[_0x909b('0x24')](moment()['format'](_0x909b('0x23')))});}else{if(moment()[_0x909b('0x25')](encryptor[_0x909b('0x26')](_0x597d29[_0x909b('0x19')]),_0x909b('0x27'))>DAYS){logger[_0x909b('0x1b')](_0x909b('0x28'),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x5a8210[_0x909b('0x1c')]({'data1':_0x5a5bbf,'data2':null,'license':null});}}}else{if(_0x597d29['data1']!=_0x5a5bbf){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x597d29[_0x909b('0x1e')],_0x5a5bbf);return _0x5a8210[_0x909b('0x1c')]({'data1':_0x5a5bbf,'data2':null,'license':null});}}}return _0x5a8210;})[_0x909b('0xc')](function(_0x4601ab){_0x5a8210=_0x4601ab;})[_0x909b('0xd')](function(_0x5dfcc2){logger[_0x909b('0x29')](_0x5dfcc2['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x909b('0x2a')](),_0x5a8210);},TIME);});}function defaultLicense(){var _0x3b86d3=hardware['getUuid']();if(_0x3b86d3){return db[_0x909b('0x2b')][_0x909b('0x2c')]({'where':{'id':0x1},'defaults':{'data1':_0x3b86d3}})[_0x909b('0x2d')](function(_0x1e3a82,_0xdb56bb){logger[_0x909b('0x1b')](_0x909b('0x2e'),_0x3b86d3);manageLicense(_0x3b86d3,_0x1e3a82);})['catch'](function(_0x5768ea){logger[_0x909b('0x29')](_0x5768ea[_0x909b('0x2f')]);});}}exports[_0x909b('0x30')]=defaultLicense; \ No newline at end of file +var _0xa461=['|machineUuid|','|name|','|email|','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data1','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','bluebird','pkginfo','version','../../mysqldb','./hardware','license','../../api/jira/jira.controller','https://www.xcallymotion.com','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','email','|reason|','|uuid|'];(function(_0x18b4e8,_0x30e9e1){var _0x4b6265=function(_0x46bc8b){while(--_0x46bc8b){_0x18b4e8['push'](_0x18b4e8['shift']());}};_0x4b6265(++_0x30e9e1);}(_0xa461,0x105));var _0x1a46=function(_0x442a41,_0x55a0d8){_0x442a41=_0x442a41-0x0;var _0x130ae7=_0xa461[_0x442a41];return _0x130ae7;};'use strict';var util=require(_0x1a46('0x0'));var moment=require(_0x1a46('0x1'));var rp=require('request-promise');var BPromise=require(_0x1a46('0x2'));var pkginfo=require(_0x1a46('0x3'))(module,_0x1a46('0x4'));var db=require(_0x1a46('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x1a46('0x6'));var logger=require('../logger')(_0x1a46('0x7'));var jira=require(_0x1a46('0x8'));const {config}=require('process');var HOST=_0x1a46('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x38b62b){return new BPromise(function(_0x461536,_0xa1a459){var _0x509ad3=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x38b62b,module[_0x1a46('0xa')][_0x1a46('0x4')]);if(oldToken){_0x509ad3=util[_0x1a46('0xb')](_0x1a46('0xc'),HOST,_0x38b62b,module['exports'][_0x1a46('0x4')],oldToken);}var _0x1e8a0e={'uri':_0x509ad3,'method':_0x1a46('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x1e8a0e)[_0x1a46('0xe')](function(_0xe78316){_0x461536(_0xe78316);})[_0x1a46('0xf')](function(_0x4d90dd){_0xa1a459(_0x4d90dd);});});}function sendJiraAlert(_0x256522,_0x46a9bb,_0x373dd5){var _0x4a369d=_0x1a46('0x10');return db[_0x1a46('0x11')][_0x1a46('0x12')]({'where':{'role':_0x1a46('0x13')},'attributes':[_0x1a46('0x14'),_0x1a46('0x15')],'raw':!![]})[_0x1a46('0xe')](function(_0x58626c){ADMIN=_0x58626c;_0x4a369d+=_0x1a46('0x16')+_0x373dd5+'|\x0a';_0x4a369d+=_0x1a46('0x17')+_0x256522+'|\x0a';_0x4a369d+=_0x1a46('0x18')+_0x46a9bb+'|\x0a';_0x4a369d+=_0x1a46('0x19')+ADMIN[_0x1a46('0x14')]+'|\x0a';_0x4a369d+=_0x1a46('0x1a')+ADMIN[_0x1a46('0x15')]+'|\x0a';return _0x4a369d;})[_0x1a46('0xe')](function(_0x3b72f2){var _0x421835=hardware[_0x1a46('0x1b')]()[_0x1a46('0x1c')];return jira[_0x1a46('0x1d')]({'key':_0x1a46('0x1e'),'summary':_0x1a46('0x1f'),'description':_0x3b72f2,'issuetype':_0x1a46('0x20'),'oldToken':_0x256522,'newToken':_0x46a9bb,'email':ADMIN[_0x1a46('0x15')],'name':ADMIN[_0x1a46('0x14')],'reason':GRAY_PERIOD_REASON,'ip':_0x421835});});}function manageLicense(_0x273807,_0x5249fb){var _0x1b8bd7=_0x5249fb['get']({'plain':!![]});httpRequest(_0x273807)[_0x1a46('0xe')](function(_0x2e3a0a){if(oldToken){oldToken=undefined;}if(_0x2e3a0a[_0x1a46('0x21')]){if(!_0x1b8bd7[_0x1a46('0x7')]&&_0x1b8bd7[_0x1a46('0x7')]!=_0x2e3a0a[_0x1a46('0x7')]||_0x1b8bd7[_0x1a46('0x7')]&&_0x1b8bd7[_0x1a46('0x22')]){logger[_0x1a46('0x23')](_0x1a46('0x24'));}if(_0x1b8bd7[_0x1a46('0x7')]&&!_0x1b8bd7[_0x1a46('0x22')]&&_0x1b8bd7[_0x1a46('0x7')]!=_0x2e3a0a[_0x1a46('0x7')]){logger[_0x1a46('0x23')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x1b8bd7['license']&&!_0x1b8bd7['data2']&&_0x1b8bd7[_0x1a46('0x7')]==_0x2e3a0a[_0x1a46('0x7')]){return _0x5249fb;}return _0x5249fb['update']({'data1':_0x273807,'data2':null,'license':_0x2e3a0a[_0x1a46('0x7')]});}else{if(_0x2e3a0a[_0x1a46('0x7')]||_0x1b8bd7[_0x1a46('0x7')]){if(!_0x1b8bd7['data2']){if(_0x1b8bd7[_0x1a46('0x25')]==_0x273807){GRAY_PERIOD_REASON='Disabled';logger[_0x1a46('0x23')](_0x1a46('0x26'));}else{GRAY_PERIOD_REASON=_0x1a46('0x27');oldToken=_0x1b8bd7[_0x1a46('0x25')];logger[_0x1a46('0x23')](_0x1a46('0x28'),_0x1b8bd7[_0x1a46('0x25')],_0x273807);}sendJiraAlert(_0x1b8bd7[_0x1a46('0x25')],_0x2e3a0a[_0x1a46('0x29')],GRAY_PERIOD_REASON);logger[_0x1a46('0x23')](_0x1a46('0x2a'),GRAY_PERIOD_REASON[_0x1a46('0x2b')](),moment()[_0x1a46('0xb')]('YYYY-MM-DD\x20HH:mm'));return _0x5249fb['update']({'data2':encryptor[_0x1a46('0x2c')](moment()[_0x1a46('0xb')](_0x1a46('0x2d')))});}else{if(moment()[_0x1a46('0x2e')](encryptor['decryptString'](_0x1b8bd7[_0x1a46('0x22')]),_0x1a46('0x2f'))>DAYS){logger[_0x1a46('0x23')](_0x1a46('0x30'),moment()['format'](_0x1a46('0x2d')));return _0x5249fb['update']({'data1':_0x273807,'data2':null,'license':null});}}}else{if(_0x1b8bd7[_0x1a46('0x25')]!=_0x273807){logger[_0x1a46('0x23')](_0x1a46('0x28'),_0x1b8bd7[_0x1a46('0x25')],_0x273807);return _0x5249fb['update']({'data1':_0x273807,'data2':null,'license':null});}}}return _0x5249fb;})[_0x1a46('0xe')](function(_0x46dbfd){_0x5249fb=_0x46dbfd;})[_0x1a46('0xf')](function(_0x480a2f){logger[_0x1a46('0x31')](_0x480a2f[_0x1a46('0x32')]);})[_0x1a46('0x33')](function(){setTimeout(function(){manageLicense(hardware[_0x1a46('0x34')](),_0x5249fb);},TIME);});}function defaultLicense(){var _0x440f01=hardware[_0x1a46('0x34')]();if(_0x440f01){return db[_0x1a46('0x35')][_0x1a46('0x36')]({'where':{'id':0x1},'defaults':{'data1':_0x440f01}})[_0x1a46('0x37')](function(_0x24b645,_0xbf0474){logger[_0x1a46('0x23')](_0x1a46('0x38'),_0x440f01);manageLicense(_0x440f01,_0x24b645);})[_0x1a46('0xf')](function(_0xa543e8){logger[_0x1a46('0x31')](_0xa543e8[_0x1a46('0x32')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index b054ea8..2626aef 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 _0x3c65=['uuid','split','%s:%s:%s','demo','decryptString','gray','deadline','add','days','format','grayReason','changed','disabled','data1','message','findAll','role','sequelize','COUNT','count','admin','user','telephone','users','telephones','forEach','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','find','defaults','then'];(function(_0x8df2d2,_0x590380){var _0xcdf8f3=function(_0x471b49){while(--_0x471b49){_0x8df2d2['push'](_0x8df2d2['shift']());}};_0xcdf8f3(++_0x590380);}(_0x3c65,0x122));var _0x53c6=function(_0x2dc343,_0xf015a2){_0x2dc343=_0x2dc343-0x0;var _0x51eac5=_0x3c65[_0x2dc343];return _0x51eac5;};'use strict';var util=require(_0x53c6('0x0'));var _=require('lodash');var moment=require(_0x53c6('0x1'));var BPromise=require('bluebird');var hardware=require('./hardware');var encryptor=require(_0x53c6('0x2'));var db=require(_0x53c6('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x53c6('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x53c6('0x5'),'machineUuid':hardware[_0x53c6('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x53c6('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x53c6('0x7'),'machineUuid':hardware[_0x53c6('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x369760){return new BPromise(function(_0x3924af,_0x34076e){return db['License'][_0x53c6('0x8')](_[_0x53c6('0x9')](_0x369760,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x4f27bf){return checkLicense(_0x4f27bf,null);})[_0x53c6('0xa')](function(_0x11ffe5){_0x3924af(_0x11ffe5);return;})['catch'](function(_0x115000){_0x34076e(_0x115000);});});}function checkLicense(_0x1db6cb,_0x2d7058){if(!_0x1db6cb){demoLicense[_0x53c6('0xb')]=_0x1db6cb['data1'];return demoLicense;}try{var _0xc4eab8=_0x2d7058||_0x1db6cb['license'];if(_['isEmpty'](_0xc4eab8)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x17ea24=_0x1db6cb['data1'];var _0xf92bfb=_0x1db6cb['data2'];var _0x10e116=_0x17ea24[_0x53c6('0xc')]('-')[0x4];var _0x459f6c=_0x17ea24[_0x53c6('0xc')]('-')[0x0];var _0x4df93a=encryptor['decryptString'](_0xc4eab8,util['format'](_0x53c6('0xd'),_0x10e116,_0x17ea24,_0x459f6c));var _0x29667f=JSON['parse'](_0x4df93a);_0x29667f[_0x53c6('0xe')]=![];_0x29667f[_0x53c6('0xb')]=_0x17ea24;_0x29667f['machineUuid']=hardware[_0x53c6('0x6')]();if(_0xf92bfb){var _0x511772=encryptor[_0x53c6('0xf')](_0xf92bfb);_0x29667f[_0x53c6('0x10')]=_0x511772;_0x29667f[_0x53c6('0x11')]=moment(_0x511772)[_0x53c6('0x12')](0x7,_0x53c6('0x13'))[_0x53c6('0x14')]();_0x29667f[_0x53c6('0x15')]=_0x29667f[_0x53c6('0xb')]!=_0x29667f['machineUuid']?_0x53c6('0x16'):_0x53c6('0x17');}return _0x29667f;}catch(_0x39dfd3){breakingLicense['uuid']=_0x1db6cb[_0x53c6('0x18')];breakingLicense[_0x53c6('0x19')]=_0x39dfd3[_0x53c6('0x19')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4f4cbe,_0x163712){getLicense()['then'](function(_0x50cbd3){return db['User'][_0x53c6('0x1a')]({'attributes':[_0x53c6('0x1b'),[db[_0x53c6('0x1c')]['fn'](_0x53c6('0x1d'),db[_0x53c6('0x1c')]['col']('role')),_0x53c6('0x1e')]],'group':'role','where':{'role':{'$or':[_0x53c6('0x1f'),_0x53c6('0x20'),_0x53c6('0x21')]}},'raw':!![]})[_0x53c6('0xa')](function(_0xcf2301){var _0x31a362={'user':_0x50cbd3[_0x53c6('0x22')]||0x0,'telephone':_0x50cbd3[_0x53c6('0x23')]||0x0};_0xcf2301[_0x53c6('0x24')](function(_0x380b28){var _0x185b0c=_0x380b28['role']==='admin'?_0x53c6('0x20'):_0x380b28['role'];_0x31a362[_0x185b0c]-=_0x380b28['count'];if(_0x31a362[_0x185b0c]<0x0)_0x31a362[_0x185b0c]=0x0;});_0x4f4cbe(_0x31a362);return;});})[_0x53c6('0x25')](function(_0x287db2){_0x163712(_0x287db2);});});}function checkUserLimits(_0x3e14d7){return new BPromise(function(_0x1536c4,_0x445ef3){getLimits()[_0x53c6('0xa')](function(_0x4facf2){var _0x15d52d=_[_0x53c6('0x26')](_[_0x53c6('0x27')](_0x3e14d7,_0x53c6('0x1b')),[_0x53c6('0x1f'),'user','telephone']);var _0xab950=(_0x15d52d[_0x53c6('0x1f')]||0x0)+(_0x15d52d[_0x53c6('0x20')]||0x0);var _0x17382c=_0x15d52d['telephone']||0x0;if(_0xab950>_0x4facf2['user'])return _0x445ef3(_0x53c6('0x28'));if(_0x17382c>_0x4facf2[_0x53c6('0x21')])return _0x445ef3(_0x53c6('0x29'));return _0x1536c4();})[_0x53c6('0x25')](function(_0x3e6239){_0x445ef3(_0x3e6239);});});}module[_0x53c6('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x3082=['demo','machineUuid','gray','deadline','add','days','uuid','message','User','role','COUNT','sequelize','col','count','telephone','users','telephones','admin','pick','countBy','user','License\x20limit\x20reached\x20for\x20users','util','moment','bluebird','./hardware','../../mysqldb','Demo\x20license','2027-01-01T00:00:00.000Z','Breaking\x20license','getUuid','find','then','catch','data1','license','isEmpty','data2','split','decryptString','format','%s:%s:%s','parse'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x3082,0x6c));var _0x2308=function(_0x3db219,_0x3b3f73){_0x3db219=_0x3db219-0x0;var _0x566686=_0x3082[_0x3db219];return _0x566686;};'use strict';var util=require(_0x2308('0x0'));var _=require('lodash');var moment=require(_0x2308('0x1'));var BPromise=require(_0x2308('0x2'));var hardware=require(_0x2308('0x3'));var encryptor=require('../../components/encryptor');var db=require(_0x2308('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x2308('0x5'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x2308('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x2308('0x7'),'machineUuid':hardware[_0x2308('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x35ab28){return new BPromise(function(_0x5f3a5,_0x272d94){return db['License'][_0x2308('0x9')](_['defaults'](_0x35ab28,{'raw':!![],'where':{'id':0x1}}))[_0x2308('0xa')](function(_0x4c9844){return checkLicense(_0x4c9844,null);})['then'](function(_0x1b3609){_0x5f3a5(_0x1b3609);return;})[_0x2308('0xb')](function(_0x5236bf){_0x272d94(_0x5236bf);});});}function checkLicense(_0x269420,_0x26d24d){if(!_0x269420){demoLicense['uuid']=_0x269420[_0x2308('0xc')];return demoLicense;}try{var _0x35dc31=_0x26d24d||_0x269420[_0x2308('0xd')];if(_[_0x2308('0xe')](_0x35dc31)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0xf6e8d7=_0x269420[_0x2308('0xc')];var _0x395639=_0x269420[_0x2308('0xf')];var _0x176cd0=_0xf6e8d7[_0x2308('0x10')]('-')[0x4];var _0x4531bb=_0xf6e8d7[_0x2308('0x10')]('-')[0x0];var _0x5d1c52=encryptor[_0x2308('0x11')](_0x35dc31,util[_0x2308('0x12')](_0x2308('0x13'),_0x176cd0,_0xf6e8d7,_0x4531bb));var _0x2d1d68=JSON[_0x2308('0x14')](_0x5d1c52);_0x2d1d68[_0x2308('0x15')]=![];_0x2d1d68['uuid']=_0xf6e8d7;_0x2d1d68[_0x2308('0x16')]=hardware[_0x2308('0x8')]();if(_0x395639){var _0x205bd6=encryptor[_0x2308('0x11')](_0x395639);_0x2d1d68[_0x2308('0x17')]=_0x205bd6;_0x2d1d68[_0x2308('0x18')]=moment(_0x205bd6)[_0x2308('0x19')](0x7,_0x2308('0x1a'))['format']();_0x2d1d68['grayReason']=_0x2d1d68['uuid']!=_0x2d1d68[_0x2308('0x16')]?'changed':'disabled';}return _0x2d1d68;}catch(_0x117b38){breakingLicense[_0x2308('0x1b')]=_0x269420['data1'];breakingLicense['message']=_0x117b38[_0x2308('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x34e1ec,_0xb4982a){getLicense()[_0x2308('0xa')](function(_0xfebe75){return db[_0x2308('0x1d')]['findAll']({'attributes':[_0x2308('0x1e'),[db['sequelize']['fn'](_0x2308('0x1f'),db[_0x2308('0x20')][_0x2308('0x21')](_0x2308('0x1e'))),_0x2308('0x22')]],'group':_0x2308('0x1e'),'where':{'role':{'$or':['admin','user',_0x2308('0x23')]}},'raw':!![]})[_0x2308('0xa')](function(_0x34fb6e){var _0x3f014d={'user':_0xfebe75[_0x2308('0x24')]||0x0,'telephone':_0xfebe75[_0x2308('0x25')]||0x0};_0x34fb6e['forEach'](function(_0x3b0901){var _0x2df6a0=_0x3b0901['role']===_0x2308('0x26')?'user':_0x3b0901['role'];_0x3f014d[_0x2df6a0]-=_0x3b0901[_0x2308('0x22')];if(_0x3f014d[_0x2df6a0]<0x0)_0x3f014d[_0x2df6a0]=0x0;});_0x34e1ec(_0x3f014d);return;});})[_0x2308('0xb')](function(_0x143664){_0xb4982a(_0x143664);});});}function checkUserLimits(_0x25f0f0){return new BPromise(function(_0x3f6812,_0xc1dbc1){getLimits()['then'](function(_0x8be4e4){var _0x18d42b=_[_0x2308('0x27')](_[_0x2308('0x28')](_0x25f0f0,_0x2308('0x1e')),[_0x2308('0x26'),'user',_0x2308('0x23')]);var _0x8e2740=(_0x18d42b[_0x2308('0x26')]||0x0)+(_0x18d42b['user']||0x0);var _0x57c4c7=_0x18d42b[_0x2308('0x23')]||0x0;if(_0x8e2740>_0x8be4e4[_0x2308('0x29')])return _0xc1dbc1(_0x2308('0x2a'));if(_0x57c4c7>_0x8be4e4[_0x2308('0x23')])return _0xc1dbc1('License\x20limit\x20reached\x20for\x20telephones');return _0x3f6812();})[_0x2308('0xb')](function(_0x27149e){_0xc1dbc1(_0x27149e);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index a7bbf94..5febd01 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 _0x82f4=['http://localhost:9000','app-id','secret','exports'];(function(_0x4ccdfb,_0x169b9e){var _0x32f147=function(_0x10d9e3){while(--_0x10d9e3){_0x4ccdfb['push'](_0x4ccdfb['shift']());}};_0x32f147(++_0x169b9e);}(_0x82f4,0x1bf));var _0x482f=function(_0xf17965,_0x31747d){_0xf17965=_0xf17965-0x0;var _0x398a12=_0x82f4[_0xf17965];return _0x398a12;};'use strict';module[_0x482f('0x0')]={'DOMAIN':_0x482f('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x482f('0x2'),'GOOGLE_SECRET':_0x482f('0x3'),'DEBUG':''}; \ No newline at end of file +var _0xaace=['exports','http://localhost:9000','app-id','secret'];(function(_0x529c53,_0x347b6f){var _0x30e414=function(_0x4e849f){while(--_0x4e849f){_0x529c53['push'](_0x529c53['shift']());}};_0x30e414(++_0x347b6f);}(_0xaace,0x78));var _0xeaac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaace[_0x3dd15e];return _0x231fd0;};'use strict';module[_0xeaac('0x0')]={'DOMAIN':_0xeaac('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xeaac('0x2'),'GOOGLE_SECRET':_0xeaac('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index f1a5db9..e6a4b83 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e2b=['Logger','transports','%s-%s','error','File','info','Console','moment','util','path','join','/var','format','message','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports'];(function(_0x30c5b3,_0x4c2174){var _0x58cbf5=function(_0x19840a){while(--_0x19840a){_0x30c5b3['push'](_0x30c5b3['shift']());}};_0x58cbf5(++_0x4c2174);}(_0x7e2b,0x1e7));var _0xb7e2=function(_0x3fb84f,_0x526d87){_0x3fb84f=_0x3fb84f-0x0;var _0x48975c=_0x7e2b[_0x3fb84f];return _0x48975c;};'use strict';var moment=require(_0xb7e2('0x0'));var winston=require('winston');var util=require(_0xb7e2('0x1'));var path=require(_0xb7e2('0x2'));var debugLevel='INFO';function filename(_0x292c3f,_0x2cbc75){return path[_0xb7e2('0x3')](_0xb7e2('0x4'),'log','xcally',util[_0xb7e2('0x5')]('%s-%s.log',_0x292c3f,_0x2cbc75));}function formatter(_0x2d3390,_0x24620d){_0x24620d[_0xb7e2('0x6')]=_0x24620d['message'][_0xb7e2('0x7')](/@@{/g,'{{{')['replace'](/}@@/g,'}}}')['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xb7e2('0x5')](_0xb7e2('0x8'),moment()['format'](_0xb7e2('0x9')),_0x24620d[_0xb7e2('0xa')][_0xb7e2('0xb')](),_0x2d3390,_0x24620d['message']);}module[_0xb7e2('0xc')]=function(_0x40e03b){return new winston[(_0xb7e2('0xd'))]({'transports':[new winston[(_0xb7e2('0xe'))]['File']({'name':util[_0xb7e2('0x5')](_0xb7e2('0xf'),_0x40e03b,_0xb7e2('0x10')),'filename':filename(_0x40e03b,'error'),'level':_0xb7e2('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4bfc3b){return formatter(_0x40e03b,_0x4bfc3b);}}),new winston[(_0xb7e2('0xe'))][(_0xb7e2('0x11'))]({'name':util[_0xb7e2('0x5')]('%s-%s',_0x40e03b,'info'),'filename':filename(_0x40e03b,_0xb7e2('0x12')),'level':_0xb7e2('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3632fc){return formatter(_0x40e03b,_0x3632fc);}}),new winston[(_0xb7e2('0xe'))][(_0xb7e2('0x13'))]({'level':process['env']['debugLevel']||debugLevel,'json':![],'formatter':function(_0xd33e54){return formatter(_0x40e03b,_0xd33e54);}})]});}; \ No newline at end of file +var _0x3e74=['Console','debugLevel','winston','util','path','INFO','xcally','%s-%s.log','message','replace','}}}','format','transports','File','%s-%s','error','info'];(function(_0x32d871,_0x432f11){var _0xa22ea2=function(_0x1990bc){while(--_0x1990bc){_0x32d871['push'](_0x32d871['shift']());}};_0xa22ea2(++_0x432f11);}(_0x3e74,0x156));var _0x43e7=function(_0x1a2ef3,_0x26480f){_0x1a2ef3=_0x1a2ef3-0x0;var _0x4a513b=_0x3e74[_0x1a2ef3];return _0x4a513b;};'use strict';var moment=require('moment');var winston=require(_0x43e7('0x0'));var util=require(_0x43e7('0x1'));var path=require(_0x43e7('0x2'));var debugLevel=_0x43e7('0x3');function filename(_0x222645,_0x152f07){return path['join']('/var','log',_0x43e7('0x4'),util['format'](_0x43e7('0x5'),_0x222645,_0x152f07));}function formatter(_0x420430,_0x426177){_0x426177[_0x43e7('0x6')]=_0x426177[_0x43e7('0x6')][_0x43e7('0x7')](/@@{/g,'{{{')[_0x43e7('0x7')](/}@@/g,_0x43e7('0x8'))[_0x43e7('0x7')](/@{/g,'{{')[_0x43e7('0x7')](/}@/g,'}}');return util[_0x43e7('0x9')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x43e7('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),_0x426177['level']['toUpperCase'](),_0x420430,_0x426177[_0x43e7('0x6')]);}module['exports']=function(_0x515fc0){return new winston['Logger']({'transports':[new winston[(_0x43e7('0xa'))][(_0x43e7('0xb'))]({'name':util[_0x43e7('0x9')](_0x43e7('0xc'),_0x515fc0,_0x43e7('0xd')),'filename':filename(_0x515fc0,'error'),'level':_0x43e7('0xd'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x41f3ed){return formatter(_0x515fc0,_0x41f3ed);}}),new winston[(_0x43e7('0xa'))][(_0x43e7('0xb'))]({'name':util['format'](_0x43e7('0xc'),_0x515fc0,_0x43e7('0xe')),'filename':filename(_0x515fc0,_0x43e7('0xe')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x53fb5e){return formatter(_0x515fc0,_0x53fb5e);}}),new winston[(_0x43e7('0xa'))][(_0x43e7('0xf'))]({'level':process['env'][_0x43e7('0x10')]||debugLevel,'json':![],'formatter':function(_0x51ddf6){return formatter(_0x515fc0,_0x51ddf6);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 4f2622e..5bcf4da 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 _0x3036=['../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports','join','../../services/express/index.js','ami','../../services/ami/index.js','email'];(function(_0x5d88c0,_0x5d7d83){var _0x1b40f0=function(_0x3fde10){while(--_0x3fde10){_0x5d88c0['push'](_0x5d88c0['shift']());}};_0x1b40f0(++_0x5d7d83);}(_0x3036,0x1a9));var _0x6303=function(_0x55beac,_0x4d19d3){_0x55beac=_0x55beac-0x0;var _0x3f0421=_0x3036[_0x55beac];return _0x3f0421;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':'express','script':path[_0x6303('0x0')](__dirname,_0x6303('0x1'))},{'name':_0x6303('0x2'),'script':path['join'](__dirname,_0x6303('0x3'))},{'name':'agi','script':path['join'](__dirname,'../../services/agi/index.js')},{'name':_0x6303('0x4'),'script':path['join'](__dirname,_0x6303('0x5'))},{'name':_0x6303('0x6'),'script':path[_0x6303('0x0')](__dirname,'../../services/routing/index.js')},{'name':_0x6303('0x7'),'script':path[_0x6303('0x0')](__dirname,_0x6303('0x8'))}]};module[_0x6303('0x9')]=config; \ No newline at end of file +var _0x0aaf=['../../services/ami/index.js','../../services/agi/index.js','routing','../../services/routing/index.js','xdr','exports','join','../../services/express/index.js','ami'];(function(_0xe94118,_0x5ddfde){var _0x5b9097=function(_0x570d49){while(--_0x570d49){_0xe94118['push'](_0xe94118['shift']());}};_0x5b9097(++_0x5ddfde);}(_0x0aaf,0x1c8));var _0xf0aa=function(_0x3fb07b,_0x2920ca){_0x3fb07b=_0x3fb07b-0x0;var _0x15cdb4=_0x0aaf[_0x3fb07b];return _0x15cdb4;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':'express','script':path[_0xf0aa('0x0')](__dirname,_0xf0aa('0x1'))},{'name':_0xf0aa('0x2'),'script':path[_0xf0aa('0x0')](__dirname,_0xf0aa('0x3'))},{'name':'agi','script':path[_0xf0aa('0x0')](__dirname,_0xf0aa('0x4'))},{'name':'email','script':path[_0xf0aa('0x0')](__dirname,'../../services/email/index.js')},{'name':_0xf0aa('0x5'),'script':path['join'](__dirname,_0xf0aa('0x6'))},{'name':_0xf0aa('0x7'),'script':path[_0xf0aa('0x0')](__dirname,'../../services/xdr/index.js')}]};module[_0xf0aa('0x8')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index b180b42..8e99a74 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 _0xb2f1=['describe','delete','dump','saved','pm2','bluebird','connected','then','start','disconnect','stop','restart','list'];(function(_0x386b03,_0x5d0000){var _0xd3d524=function(_0x474754){while(--_0x474754){_0x386b03['push'](_0x386b03['shift']());}};_0xd3d524(++_0x5d0000);}(_0xb2f1,0xee));var _0x1b2f=function(_0x7556b0,_0x300a5a){_0x7556b0=_0x7556b0-0x0;var _0x2a8880=_0xb2f1[_0x7556b0];return _0x2a8880;};'use strict';var pm2=require(_0x1b2f('0x0'));var BPromise=require(_0x1b2f('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x33346a,_0x421e82){return pm2['connect'](function(_0x23a24a){if(_0x23a24a){return _0x421e82(_0x23a24a);}return _0x33346a(_0x1b2f('0x2'));});});};exports['start']=function(_0x47a72f){return connect()[_0x1b2f('0x3')](function(){return new BPromise(function(_0x1934b5,_0xad728b){return pm2[_0x1b2f('0x4')](_0x47a72f,function(_0x57eed1,_0x532834){if(_0x57eed1){return _0xad728b(_0x57eed1);}pm2[_0x1b2f('0x5')]();return _0x1934b5(_0x532834);});});});};exports[_0x1b2f('0x6')]=function(_0x5627d3){return connect()[_0x1b2f('0x3')](function(){return new BPromise(function(_0x1c24c7,_0x5acb30){return pm2[_0x1b2f('0x6')](_0x5627d3,function(_0x2f3963,_0x402620){if(_0x2f3963){return _0x5acb30(_0x2f3963);}pm2[_0x1b2f('0x5')]();return _0x1c24c7(_0x402620);});});});};exports[_0x1b2f('0x7')]=function(_0x378ab8){return connect()[_0x1b2f('0x3')](function(){return new BPromise(function(_0x5cf8b8,_0x3bdf36){return pm2[_0x1b2f('0x7')](_0x378ab8,function(_0xd4c1bc,_0x4e708f){if(_0xd4c1bc){return _0x3bdf36(_0xd4c1bc);}pm2[_0x1b2f('0x5')]();return _0x5cf8b8(_0x4e708f);});});});};exports['list']=function(){return connect()[_0x1b2f('0x3')](function(){return new BPromise(function(_0x2f285a,_0x2d8645){return pm2[_0x1b2f('0x8')](function(_0xbf1b6c,_0x559ef2){if(_0xbf1b6c){return _0x2d8645(_0xbf1b6c);}pm2[_0x1b2f('0x5')]();return _0x2f285a(_0x559ef2);});});});};exports[_0x1b2f('0x9')]=function(_0x130219){return connect()[_0x1b2f('0x3')](function(){return new BPromise(function(_0x4c8497,_0x524fa0){return pm2[_0x1b2f('0x9')](_0x130219,function(_0x5d95d9,_0x4cdc0d){if(_0x5d95d9){return _0x524fa0(_0x5d95d9);}pm2['disconnect']();return _0x4c8497(_0x4cdc0d);});});});};exports[_0x1b2f('0xa')]=function(_0x184e31){return connect()['then'](function(){return new BPromise(function(_0x498928,_0x382594){return pm2[_0x1b2f('0xa')](_0x184e31,function(_0xc2aa72,_0x4cc527){if(_0xc2aa72){return _0x382594(_0xc2aa72);}pm2[_0x1b2f('0x5')]();return _0x498928(_0x4cc527);});});});};exports[_0x1b2f('0xb')]=function(){return connect()[_0x1b2f('0x3')](function(){return new BPromise(function(_0x3b8da6,_0x421919){return pm2[_0x1b2f('0xb')](function(_0xa1d86b){if(_0xa1d86b){return _0x421919(_0xa1d86b);}return _0x3b8da6(_0x1b2f('0xc'));});});});}; \ No newline at end of file +var _0x0389=['then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','./config','connect','connected','start'];(function(_0x550e4f,_0x17adb7){var _0x2c18e5=function(_0xed6cd3){while(--_0xed6cd3){_0x550e4f['push'](_0x550e4f['shift']());}};_0x2c18e5(++_0x17adb7);}(_0x0389,0x175));var _0x9038=function(_0x414655,_0x79d916){_0x414655=_0x414655-0x0;var _0x237884=_0x0389[_0x414655];return _0x237884;};'use strict';var pm2=require(_0x9038('0x0'));var BPromise=require('bluebird');var config=require(_0x9038('0x1'));function connect(){return new BPromise(function(_0x1479bf,_0xf42aed){return pm2[_0x9038('0x2')](function(_0x10bc52){if(_0x10bc52){return _0xf42aed(_0x10bc52);}return _0x1479bf(_0x9038('0x3'));});});};exports[_0x9038('0x4')]=function(_0x5739cc){return connect()[_0x9038('0x5')](function(){return new BPromise(function(_0x2fce92,_0x167367){return pm2['start'](_0x5739cc,function(_0x5be684,_0x5dea05){if(_0x5be684){return _0x167367(_0x5be684);}pm2[_0x9038('0x6')]();return _0x2fce92(_0x5dea05);});});});};exports[_0x9038('0x7')]=function(_0x23ab4a){return connect()[_0x9038('0x5')](function(){return new BPromise(function(_0x5e0b55,_0xbf1aea){return pm2['stop'](_0x23ab4a,function(_0x500fa1,_0x381b51){if(_0x500fa1){return _0xbf1aea(_0x500fa1);}pm2[_0x9038('0x6')]();return _0x5e0b55(_0x381b51);});});});};exports['restart']=function(_0x3f3b15){return connect()['then'](function(){return new BPromise(function(_0x3a3e30,_0x346aae){return pm2[_0x9038('0x8')](_0x3f3b15,function(_0x4f2c02,_0xf08dc7){if(_0x4f2c02){return _0x346aae(_0x4f2c02);}pm2[_0x9038('0x6')]();return _0x3a3e30(_0xf08dc7);});});});};exports[_0x9038('0x9')]=function(){return connect()[_0x9038('0x5')](function(){return new BPromise(function(_0x497a42,_0x1e33a1){return pm2[_0x9038('0x9')](function(_0x206047,_0x2ed249){if(_0x206047){return _0x1e33a1(_0x206047);}pm2['disconnect']();return _0x497a42(_0x2ed249);});});});};exports['describe']=function(_0x4e0c18){return connect()[_0x9038('0x5')](function(){return new BPromise(function(_0x1e8c47,_0x90e5b){return pm2[_0x9038('0xa')](_0x4e0c18,function(_0x1d9b9a,_0x9b0929){if(_0x1d9b9a){return _0x90e5b(_0x1d9b9a);}pm2[_0x9038('0x6')]();return _0x1e8c47(_0x9b0929);});});});};exports[_0x9038('0xb')]=function(_0x524578){return connect()[_0x9038('0x5')](function(){return new BPromise(function(_0x296da5,_0xea97b9){return pm2[_0x9038('0xb')](_0x524578,function(_0x1cbc93,_0x5d09e0){if(_0x1cbc93){return _0xea97b9(_0x1cbc93);}pm2[_0x9038('0x6')]();return _0x296da5(_0x5d09e0);});});});};exports['dump']=function(){return connect()[_0x9038('0x5')](function(){return new BPromise(function(_0x50f952,_0x3eb3c9){return pm2[_0x9038('0xc')](function(_0x4d7e55){if(_0x4d7e55){return _0x3eb3c9(_0x4d7e55);}return _0x50f952(_0x9038('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 0a5890a..b852a36 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 _0x6716=['chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x308122,_0x4a3141){var _0x5ccb2d=function(_0x19dc04){while(--_0x19dc04){_0x308122['push'](_0x308122['shift']());}};_0x5ccb2d(++_0x4a3141);}(_0x6716,0x115));var _0x6671=function(_0x3878bd,_0x51e3e5){_0x3878bd=_0x3878bd-0x0;var _0x359e60=_0x6716[_0x3878bd];return _0x359e60;};'use strict';var _=require(_0x6671('0x0'));var moment=require(_0x6671('0x1'));var Redis=require(_0x6671('0x2'));var util=require(_0x6671('0x3'));var config=require(_0x6671('0x4'));var db=require(_0x6671('0x5'))['db'];var logger=require(_0x6671('0x6'))(_0x6671('0x7'));config[_0x6671('0x8')]=_[_0x6671('0x9')](config[_0x6671('0x8')],{'host':_0x6671('0xa'),'port':0x18eb});var io=require(_0x6671('0xb'))(new Redis(config[_0x6671('0x8')]));function closeInteractions(){var _0x30cc07=0x0;var _0x2f2a5b=[];return db[_0x6671('0xc')][_0x6671('0xd')]({'raw':!![],'attributes':['id',_0x6671('0xe')],'where':{'id':0x1}})[_0x6671('0xf')](function(_0x283f57){_0x30cc07=_0x283f57['chatTimeout'];if(_0x30cc07){return db[_0x6671('0x10')][_0x6671('0x11')]({'raw':!![],'attributes':['id',_0x6671('0x12')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x6671('0x13')](_0x283f57[_0x6671('0xe')],_0x6671('0x14'))}}});}else{return[];}})[_0x6671('0xf')](function(_0x4cd0c7){if(_0x4cd0c7&&_0x4cd0c7[_0x6671('0x15')]){_0x2f2a5b=_[_0x6671('0x16')](_0x4cd0c7||[],'id');logger[_0x6671('0x17')]('[CHAT]\x20Interactions\x20to\x20close:',_0x2f2a5b[_0x6671('0x18')]());return db[_0x6671('0x10')]['update']({'closeReason':_0x6671('0x19'),'disposition':_0x6671('0x1a'),'closed':!![],'closedAt':moment()[_0x6671('0x1b')](_0x6671('0x1c'))},{'where':{'id':_0x2f2a5b}});}})[_0x6671('0xf')](function(){if(_0x2f2a5b&&_0x2f2a5b[_0x6671('0x15')]){logger[_0x6671('0x17')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x2f2a5b['join']());for(var _0x3b4a25=0x0;_0x3b4a25<_0x2f2a5b[_0x6671('0x15')];_0x3b4a25++){io['emit'](_0x6671('0x1d'),{'id':_0x2f2a5b[_0x3b4a25],'closed':!![]});}}})[_0x6671('0x1e')](function(_0x2f7589){logger[_0x6671('0x1f')](_0x6671('0x20'),_0x2f7589?util[_0x6671('0x21')](_0x2f7589,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x8e48=['redis','defaults','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','then','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','timeout','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','util','../logger','schedule'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x8e48,0x185));var _0x88e4=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8e48[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require('ioredis');var util=require(_0x88e4('0x0'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0x88e4('0x1'))(_0x88e4('0x2'));config[_0x88e4('0x3')]=_[_0x88e4('0x4')](config[_0x88e4('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x88e4('0x5'))(new Redis(config[_0x88e4('0x3')]));function closeInteractions(){var _0xeaa54e=0x0;var _0x209a79=[];return db[_0x88e4('0x6')][_0x88e4('0x7')]({'raw':!![],'attributes':['id',_0x88e4('0x8')],'where':{'id':0x1}})['then'](function(_0x2dfc93){_0xeaa54e=_0x2dfc93[_0x88e4('0x8')];if(_0xeaa54e){return db[_0x88e4('0x9')][_0x88e4('0xa')]({'raw':!![],'attributes':['id',_0x88e4('0xb')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x88e4('0xc')](_0x2dfc93[_0x88e4('0x8')],_0x88e4('0xd'))}}});}else{return[];}})[_0x88e4('0xe')](function(_0x2ed633){if(_0x2ed633&&_0x2ed633[_0x88e4('0xf')]){_0x209a79=_[_0x88e4('0x10')](_0x2ed633||[],'id');logger[_0x88e4('0x11')](_0x88e4('0x12'),_0x209a79[_0x88e4('0x13')]());return db['ChatInteraction']['update']({'closeReason':'system','disposition':_0x88e4('0x14'),'closed':!![],'closedAt':moment()[_0x88e4('0x15')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x209a79}});}})['then'](function(){if(_0x209a79&&_0x209a79[_0x88e4('0xf')]){logger[_0x88e4('0x11')](_0x88e4('0x16'),_0x209a79['join']());for(var _0x20b4b4=0x0;_0x20b4b4<_0x209a79[_0x88e4('0xf')];_0x20b4b4++){io['emit'](_0x88e4('0x17'),{'id':_0x209a79[_0x20b4b4],'closed':!![]});}}})['catch'](function(_0x2ebfbf){logger[_0x88e4('0x18')](_0x88e4('0x19'),_0x2ebfbf?util[_0x88e4('0x1a')](_0x2ebfbf,{'showHidden':![],'depth':null}):'');});}exports[_0x88e4('0x1b')]=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 da0c426..7178e2a 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 _0x304b=['stop','stop\x20cron','length','exists','update','update\x20cron','run','util','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','format','\x22%s\x22\x20<%s>','name','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','extname','zip','existsSync','status','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Sent','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','then','CustomReportId','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','jobs','toString','keyBy','difference','intersection','deleteJob','delete\x20cron','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron'];(function(_0x478927,_0x554534){var _0x3608d1=function(_0x449905){while(--_0x449905){_0x478927['push'](_0x478927['shift']());}};_0x3608d1(++_0x554534);}(_0x304b,0x65));var _0xb304=function(_0x19d93c,_0x47c8a7){_0x19d93c=_0x19d93c-0x0;var _0x57dcbc=_0x304b[_0x19d93c];return _0x57dcbc;};'use strict';var fs=require('fs');var util=require(_0xb304('0x0'));var path=require('path');var _=require(_0xb304('0x1'));var moment=require(_0xb304('0x2'));var CronJobManager=require(_0xb304('0x3'));var jayson=require(_0xb304('0x4'));var BPromise=require(_0xb304('0x5'));var logger=require(_0xb304('0x6'))(_0xb304('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xb304('0x8'));var analyticDefaultReportController=require(_0xb304('0x9'));var client=jayson[_0xb304('0xa')][_0xb304('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x326b57,_0xd8fe5c){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0x326b57[_0xb304('0xc')]);var _0x54cb15=!![];var _0x4b3c35={'tls':{'rejectUnauthorized':![]}};if(_0x326b57[_0xb304('0xd')][_0xb304('0xe')]['service']){_0x4b3c35[_0xb304('0xf')]=_0x326b57[_0xb304('0xd')][_0xb304('0xe')]['service'];}else{_0x4b3c35['host']=_0x326b57[_0xb304('0xd')]['Smtp'][_0xb304('0x10')];_0x4b3c35[_0xb304('0x11')]=_0x326b57[_0xb304('0xd')]['Smtp'][_0xb304('0x11')];_0x4b3c35[_0xb304('0x12')]=_0x326b57['MailAccount'][_0xb304('0xe')][_0xb304('0x12')];}if(_0x326b57[_0xb304('0xd')][_0xb304('0xe')][_0xb304('0x13')]){_0x4b3c35[_0xb304('0x14')]={'user':_0x326b57[_0xb304('0xd')][_0xb304('0xe')]['user'],'pass':_0x326b57[_0xb304('0xd')][_0xb304('0xe')]['pass']};}var _0x2def2a={'account':_0x4b3c35,'message':{'from':util[_0xb304('0x15')](_0xb304('0x16'),_0x326b57[_0xb304('0xd')][_0xb304('0x17')],_0x326b57[_0xb304('0xd')]['email']||_0x326b57[_0xb304('0xd')][_0xb304('0xe')][_0xb304('0x18')]),'to':_0x326b57[_0xb304('0xc')],'cc':_0x326b57['cc'],'bcc':_0x326b57[_0xb304('0x19')],'subject':util['format'](_0xb304('0x1a'),_0xd8fe5c[_0xb304('0x17')],_0x326b57['subtractNumber'],_0x326b57[_0xb304('0x1b')])}};var _0x5f204d=path[_0xb304('0x1c')](__dirname,_0xb304('0x1d'));var _0x295adf=_0xd8fe5c[_0xb304('0x1e')];var _0x25640d=util[_0xb304('0x15')](_0xb304('0x1f'),path['basename'](_0xd8fe5c[_0xb304('0x1e')],path[_0xb304('0x20')](_0xd8fe5c[_0xb304('0x1e')])),_0xb304('0x21'));var _0x4ab2ab=path[_0xb304('0x1c')](_0x5f204d,_0x295adf);var _0x155389=path[_0xb304('0x1c')](_0x5f204d,_0x25640d);if(fs[_0xb304('0x22')](_0x4ab2ab)){_0xd8fe5c[_0xb304('0x23')]='Sent';_0x2def2a[_0xb304('0x24')][_0xb304('0x25')]=[{'filename':_0x295adf,'path':_0x4ab2ab}];_0x2def2a[_0xb304('0x24')]['text']=util['format'](_0xb304('0x26'),JSON[_0xb304('0x27')](_0xd8fe5c,null,0x2));}else if(fs['existsSync'](_0x155389)){_0xd8fe5c[_0xb304('0x23')]=_0xb304('0x28');_0x2def2a[_0xb304('0x24')][_0xb304('0x25')]=[{'filename':_0x25640d,'path':_0x155389}];}else{_0x2def2a[_0xb304('0x24')][_0xb304('0x29')]=_0xb304('0x2a');if(!_0x326b57[_0xb304('0x2b')]){_0x54cb15=![];logger[_0xb304('0x2c')](_0xb304('0x2d'));}}if(_0x54cb15){return client[_0xb304('0x2e')](_0xb304('0x2f'),_0x2def2a)['then'](function(_0x5cdaaf){if(_0x5cdaaf[_0xb304('0x30')]){return logger['error'](_0xb304('0x31'),JSON['stringify'](_0x5cdaaf));}return logger['info'](_0xb304('0x32'));})[_0xb304('0x33')](function(_0x321676){return logger[_0xb304('0x30')](_0xb304('0x31'),JSON[_0xb304('0x27')](_0x321676));});}};}function handleError(){return function(_0x1bb4d1){return logger[_0xb304('0x30')](JSON[_0xb304('0x27')](_0x1bb4d1));};}function handleResult(_0x469777){return function(_0x25b1dd){logger['info'](_0xb304('0x34'),JSON[_0xb304('0x27')](_0x25b1dd));if(_0x469777[_0xb304('0xd')]&&_0x469777['MailAccount'][_0xb304('0xe')]&&!_[_0xb304('0x35')](_0x469777[_0xb304('0xc')])){setTimeout(handleSendEmail(_0x469777,_0x25b1dd),0x3c*0x3e8);}};}function handleJob(_0xf99df2){return function(){try{if(_[_0xb304('0x35')](_0xf99df2[_0xb304('0x36')])){return logger[_0xb304('0x2c')](_0xb304('0x37'));}if(_['isNil'](_0xf99df2[_0xb304('0x1b')])){return logger[_0xb304('0x2c')](_0xb304('0x38'));}var _0x1d9494={'startDate':moment()[_0xb304('0x39')](_0xf99df2[_0xb304('0x36')],_0xf99df2[_0xb304('0x1b')])[_0xb304('0x15')](_0xb304('0x3a')),'endDate':moment()[_0xb304('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0xf99df2[_0xb304('0x3b')],'name':_0xf99df2['name']};if(!_[_0xb304('0x35')](_0xf99df2[_0xb304('0x3c')])){logger[_0xb304('0x2c')]('exec\x20defaul\x20report\x20id:%s',_0xf99df2[_0xb304('0x3c')]);return analyticDefaultReportController['runReport']({'id':_0xf99df2[_0xb304('0x3c')]},_0x1d9494)[_0xb304('0x3d')](handleResult(_0xf99df2))['catch'](handleError());}if(!_['isNil'](_0xf99df2[_0xb304('0x3e')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0xf99df2[_0xb304('0x3e')]);return analyticCustomReportController[_0xb304('0x3f')]({'id':_0xf99df2[_0xb304('0x3e')]},_0x1d9494)[_0xb304('0x3d')](handleResult(_0xf99df2))['catch'](handleError());}}catch(_0x1f7216){logger[_0xb304('0x30')](JSON[_0xb304('0x27')](_0x1f7216));}return logger[_0xb304('0x2c')](_0xb304('0x40'));};}function getJobs(_0x8125bb){var _0x166922={};if(_0x8125bb){_0x166922['id']=_0x8125bb;}return db[_0xb304('0x41')][_0xb304('0x42')]({'where':_0x166922,'include':[{'model':db[_0xb304('0xd')],'attributes':['id',_0xb304('0x17'),_0xb304('0xc')],'include':[{'model':db[_0xb304('0x43')],'as':_0xb304('0xe')}]}]})['then'](function(_0x4e5f58){var _0x10d8d0=_['keys'](manager[_0xb304('0x44')]);var _0x439c3b=_['map'](_0x4e5f58,function(_0x2baeb4){return _0x2baeb4['id'][_0xb304('0x45')]();});var _0x5b957b=_[_0xb304('0x46')](_0x4e5f58,function(_0x434587){return _0x434587['id'][_0xb304('0x45')]();});var _0x1eb35f=_0x8125bb?_0x439c3b:_[_0xb304('0x47')](_0x439c3b,_0x10d8d0);var _0x341ea2=_[_0xb304('0x48')](_0x439c3b,_0x10d8d0);var _0x3838f4=_[_0xb304('0x47')](_0x10d8d0,_0x439c3b);var _0x4616e1;var _0x3cb852;for(_0x4616e1=0x0;_0x4616e1<_0x3838f4['length']&&!_0x8125bb;_0x4616e1+=0x1){_0x3cb852=_0x3838f4[_0x4616e1]['toString']();if(manager['exists'](_0x3cb852)){manager['stop'](_0x3cb852);manager[_0xb304('0x49')](_0x3cb852);logger[_0xb304('0x2c')](_0xb304('0x4a'),_0x3cb852);}}logger[_0xb304('0x2c')]('toRun',JSON[_0xb304('0x27')](_0x1eb35f));for(_0x4616e1=0x0;_0x4616e1<_0x1eb35f['length'];_0x4616e1+=0x1){_0x3cb852=_0x1eb35f[_0x4616e1][_0xb304('0x45')]();logger['info'](_0xb304('0x4b'),_0x3cb852);if(_0x8125bb){logger['info'](_0xb304('0x4c'),_0x8125bb);logger[_0xb304('0x2c')](JSON[_0xb304('0x27')](_0x5b957b[_0x3cb852]));BPromise[_0xb304('0x4d')]()[_0xb304('0x3d')](handleJob(_0x5b957b[_0x3cb852]));logger[_0xb304('0x2c')](_0xb304('0x4e'),_0x5b957b[_0x3cb852][_0xb304('0x17')],_0x5b957b[_0x3cb852]['cron']);}else if(_0x5b957b[_0x3cb852][_0xb304('0x4f')]&&_0x5b957b[_0x3cb852][_0xb304('0x50')]&&moment()[_0xb304('0x51')](_0x5b957b[_0x3cb852][_0xb304('0x52')],_0x5b957b[_0x3cb852][_0xb304('0x53')])){manager[_0xb304('0x54')](_0x3cb852,_0x5b957b[_0x3cb852][_0xb304('0x4f')],handleJob(_0x5b957b[_0x3cb852]));manager[_0xb304('0x55')](_0x3cb852);logger[_0xb304('0x2c')](_0xb304('0x56'),_0x5b957b[_0x3cb852][_0xb304('0x17')],_0x5b957b[_0x3cb852][_0xb304('0x4f')]);}else if(manager['exists'](_0x3cb852)){manager[_0xb304('0x57')](_0x3cb852);manager[_0xb304('0x49')](_0x3cb852);logger[_0xb304('0x2c')](_0xb304('0x58'),_0x5b957b[_0x3cb852][_0xb304('0x17')],_0x5b957b[_0x3cb852][_0xb304('0x4f')]);}}for(_0x4616e1=0x0,_0x3cb852;_0x4616e1<_0x341ea2[_0xb304('0x59')]&&!_0x8125bb;_0x4616e1+=0x1){_0x3cb852=_0x341ea2[_0x4616e1][_0xb304('0x45')]();if(manager[_0xb304('0x5a')](_0x3cb852)){if(_0x5b957b[_0x3cb852][_0xb304('0x4f')]&&_0x5b957b[_0x3cb852][_0xb304('0x50')]&&moment()['isBetween'](_0x5b957b[_0x3cb852][_0xb304('0x52')],_0x5b957b[_0x3cb852][_0xb304('0x53')])){manager[_0xb304('0x5b')](_0x3cb852,_0x5b957b[_0x3cb852][_0xb304('0x4f')],handleJob(_0x5b957b[_0x3cb852]));logger[_0xb304('0x2c')](_0xb304('0x5c'),_0x5b957b[_0x3cb852][_0xb304('0x17')],_0x5b957b[_0x3cb852][_0xb304('0x4f')]);}else{manager[_0xb304('0x57')](_0x3cb852);manager[_0xb304('0x49')](_0x3cb852);logger[_0xb304('0x2c')](_0xb304('0x58'),_0x5b957b[_0x3cb852][_0xb304('0x17')],_0x5b957b[_0x3cb852][_0xb304('0x4f')]);}}}})['catch'](function(_0x48e3b5){logger['error'](JSON[_0xb304('0x27')](_0x48e3b5));});}exports[_0xb304('0x5d')]=function(_0x1566c1){return getJobs(_0x1566c1);};exports[_0xb304('0x55')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x7042=['info','email','MailAccount','service','Smtp','host','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','message','attachments','text','stringify','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','then','error','error\x20mail','email\x20sent','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','no\x20report\x20id','Schedule','MailServerOut','keys','map','keyBy','toString','difference','intersection','length','exists','stop','delete\x20cron','toRun','my\x20id','resolve','run\x20job','cron','active','startAt','endAt','start','add\x20cron','deleteJob','stop\x20cron','isBetween','update','run','util','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http'];(function(_0xcb0cb4,_0xc812a5){var _0x7975c7=function(_0xeeb18b){while(--_0xeeb18b){_0xcb0cb4['push'](_0xcb0cb4['shift']());}};_0x7975c7(++_0xc812a5);}(_0x7042,0xa2));var _0x2704=function(_0xc206c0,_0x23d96d){_0xc206c0=_0xc206c0-0x0;var _0x19ba38=_0x7042[_0xc206c0];return _0x19ba38;};'use strict';var fs=require('fs');var util=require(_0x2704('0x0'));var path=require('path');var _=require(_0x2704('0x1'));var moment=require('moment');var CronJobManager=require(_0x2704('0x2'));var jayson=require(_0x2704('0x3'));var BPromise=require(_0x2704('0x4'));var logger=require(_0x2704('0x5'))(_0x2704('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x2704('0x7'));var analyticDefaultReportController=require(_0x2704('0x8'));var client=jayson['client'][_0x2704('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3f6383,_0x29c9d2){return function(){logger[_0x2704('0xa')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x3f6383[_0x2704('0xb')]);var _0x1dda12=!![];var _0x5c2782={'tls':{'rejectUnauthorized':![]}};if(_0x3f6383[_0x2704('0xc')]['Smtp'][_0x2704('0xd')]){_0x5c2782['service']=_0x3f6383[_0x2704('0xc')][_0x2704('0xe')][_0x2704('0xd')];}else{_0x5c2782[_0x2704('0xf')]=_0x3f6383['MailAccount']['Smtp'][_0x2704('0xf')];_0x5c2782['port']=_0x3f6383[_0x2704('0xc')][_0x2704('0xe')]['port'];_0x5c2782[_0x2704('0x10')]=_0x3f6383[_0x2704('0xc')][_0x2704('0xe')][_0x2704('0x10')];}if(_0x3f6383[_0x2704('0xc')][_0x2704('0xe')][_0x2704('0x11')]){_0x5c2782[_0x2704('0x12')]={'user':_0x3f6383[_0x2704('0xc')][_0x2704('0xe')][_0x2704('0x13')],'pass':_0x3f6383[_0x2704('0xc')][_0x2704('0xe')][_0x2704('0x14')]};}var _0x25fdfa={'account':_0x5c2782,'message':{'from':util[_0x2704('0x15')](_0x2704('0x16'),_0x3f6383['MailAccount'][_0x2704('0x17')],_0x3f6383['MailAccount'][_0x2704('0xb')]||_0x3f6383[_0x2704('0xc')]['Smtp']['user']),'to':_0x3f6383['email'],'cc':_0x3f6383['cc'],'bcc':_0x3f6383['bcc'],'subject':util[_0x2704('0x15')]('Report\x20%s\x20last\x20%s\x20%s',_0x29c9d2[_0x2704('0x17')],_0x3f6383[_0x2704('0x18')],_0x3f6383[_0x2704('0x19')])}};var _0x201960=path[_0x2704('0x1a')](__dirname,_0x2704('0x1b'));var _0x299fa0=_0x29c9d2[_0x2704('0x1c')];var _0x129b5b=util[_0x2704('0x15')](_0x2704('0x1d'),path[_0x2704('0x1e')](_0x29c9d2[_0x2704('0x1c')],path[_0x2704('0x1f')](_0x29c9d2[_0x2704('0x1c')])),_0x2704('0x20'));var _0x26ad77=path[_0x2704('0x1a')](_0x201960,_0x299fa0);var _0x14005f=path[_0x2704('0x1a')](_0x201960,_0x129b5b);if(fs[_0x2704('0x21')](_0x26ad77)){_0x29c9d2[_0x2704('0x22')]='Sent';_0x25fdfa[_0x2704('0x23')][_0x2704('0x24')]=[{'filename':_0x299fa0,'path':_0x26ad77}];_0x25fdfa[_0x2704('0x23')][_0x2704('0x25')]=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x2704('0x26')](_0x29c9d2,null,0x2));}else if(fs[_0x2704('0x21')](_0x14005f)){_0x29c9d2['status']=_0x2704('0x27');_0x25fdfa[_0x2704('0x23')][_0x2704('0x24')]=[{'filename':_0x129b5b,'path':_0x14005f}];}else{_0x25fdfa[_0x2704('0x23')][_0x2704('0x25')]=_0x2704('0x28');if(!_0x3f6383[_0x2704('0x29')]){_0x1dda12=![];logger[_0x2704('0xa')](_0x2704('0x2a'));}}if(_0x1dda12){return client[_0x2704('0x2b')]('SendMail',_0x25fdfa)[_0x2704('0x2c')](function(_0x5b97ab){if(_0x5b97ab[_0x2704('0x2d')]){return logger[_0x2704('0x2d')](_0x2704('0x2e'),JSON['stringify'](_0x5b97ab));}return logger[_0x2704('0xa')](_0x2704('0x2f'));})['catch'](function(_0xd4fac7){return logger[_0x2704('0x2d')](_0x2704('0x2e'),JSON['stringify'](_0xd4fac7));});}};}function handleError(){return function(_0x1f2c88){return logger[_0x2704('0x2d')](JSON[_0x2704('0x26')](_0x1f2c88));};}function handleResult(_0x232197){return function(_0x1890de){logger['info']('data',JSON['stringify'](_0x1890de));if(_0x232197['MailAccount']&&_0x232197[_0x2704('0xc')][_0x2704('0xe')]&&!_[_0x2704('0x30')](_0x232197[_0x2704('0xb')])){setTimeout(handleSendEmail(_0x232197,_0x1890de),0x3c*0x3e8);}};}function handleJob(_0x6315d6){return function(){try{if(_[_0x2704('0x30')](_0x6315d6[_0x2704('0x18')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x6315d6[_0x2704('0x19')])){return logger[_0x2704('0xa')](_0x2704('0x31'));}var _0x1148a7={'startDate':moment()[_0x2704('0x32')](_0x6315d6[_0x2704('0x18')],_0x6315d6[_0x2704('0x19')])[_0x2704('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x2704('0x15')](_0x2704('0x33')),'type':_0x2704('0x34'),'output':_0x6315d6['output'],'name':_0x6315d6[_0x2704('0x17')]};if(!_[_0x2704('0x30')](_0x6315d6[_0x2704('0x35')])){logger[_0x2704('0xa')](_0x2704('0x36'),_0x6315d6[_0x2704('0x35')]);return analyticDefaultReportController[_0x2704('0x37')]({'id':_0x6315d6['DefaultReportId']},_0x1148a7)[_0x2704('0x2c')](handleResult(_0x6315d6))[_0x2704('0x38')](handleError());}if(!_[_0x2704('0x30')](_0x6315d6['CustomReportId'])){logger[_0x2704('0xa')]('exec\x20custom\x20report\x20id:%s',_0x6315d6[_0x2704('0x39')]);return analyticCustomReportController[_0x2704('0x37')]({'id':_0x6315d6[_0x2704('0x39')]},_0x1148a7)['then'](handleResult(_0x6315d6))[_0x2704('0x38')](handleError());}}catch(_0x42a878){logger[_0x2704('0x2d')](JSON[_0x2704('0x26')](_0x42a878));}return logger['info'](_0x2704('0x3a'));};}function getJobs(_0x5681e4){var _0x27a163={};if(_0x5681e4){_0x27a163['id']=_0x5681e4;}return db[_0x2704('0x3b')]['findAll']({'where':_0x27a163,'include':[{'model':db[_0x2704('0xc')],'attributes':['id',_0x2704('0x17'),_0x2704('0xb')],'include':[{'model':db[_0x2704('0x3c')],'as':_0x2704('0xe')}]}]})[_0x2704('0x2c')](function(_0x30e59c){var _0x123b0f=_[_0x2704('0x3d')](manager['jobs']);var _0x56f8f7=_[_0x2704('0x3e')](_0x30e59c,function(_0x301122){return _0x301122['id']['toString']();});var _0x4222fe=_[_0x2704('0x3f')](_0x30e59c,function(_0x248797){return _0x248797['id'][_0x2704('0x40')]();});var _0x507595=_0x5681e4?_0x56f8f7:_[_0x2704('0x41')](_0x56f8f7,_0x123b0f);var _0x1f905e=_[_0x2704('0x42')](_0x56f8f7,_0x123b0f);var _0x3e8c87=_['difference'](_0x123b0f,_0x56f8f7);var _0x166303;var _0x3dd4a9;for(_0x166303=0x0;_0x166303<_0x3e8c87[_0x2704('0x43')]&&!_0x5681e4;_0x166303+=0x1){_0x3dd4a9=_0x3e8c87[_0x166303][_0x2704('0x40')]();if(manager[_0x2704('0x44')](_0x3dd4a9)){manager[_0x2704('0x45')](_0x3dd4a9);manager['deleteJob'](_0x3dd4a9);logger[_0x2704('0xa')](_0x2704('0x46'),_0x3dd4a9);}}logger[_0x2704('0xa')](_0x2704('0x47'),JSON[_0x2704('0x26')](_0x507595));for(_0x166303=0x0;_0x166303<_0x507595['length'];_0x166303+=0x1){_0x3dd4a9=_0x507595[_0x166303][_0x2704('0x40')]();logger[_0x2704('0xa')]('index',_0x3dd4a9);if(_0x5681e4){logger[_0x2704('0xa')](_0x2704('0x48'),_0x5681e4);logger[_0x2704('0xa')](JSON[_0x2704('0x26')](_0x4222fe[_0x3dd4a9]));BPromise[_0x2704('0x49')]()[_0x2704('0x2c')](handleJob(_0x4222fe[_0x3dd4a9]));logger['info'](_0x2704('0x4a'),_0x4222fe[_0x3dd4a9][_0x2704('0x17')],_0x4222fe[_0x3dd4a9][_0x2704('0x4b')]);}else if(_0x4222fe[_0x3dd4a9][_0x2704('0x4b')]&&_0x4222fe[_0x3dd4a9][_0x2704('0x4c')]&&moment()['isBetween'](_0x4222fe[_0x3dd4a9][_0x2704('0x4d')],_0x4222fe[_0x3dd4a9][_0x2704('0x4e')])){manager['add'](_0x3dd4a9,_0x4222fe[_0x3dd4a9][_0x2704('0x4b')],handleJob(_0x4222fe[_0x3dd4a9]));manager[_0x2704('0x4f')](_0x3dd4a9);logger['info'](_0x2704('0x50'),_0x4222fe[_0x3dd4a9][_0x2704('0x17')],_0x4222fe[_0x3dd4a9][_0x2704('0x4b')]);}else if(manager[_0x2704('0x44')](_0x3dd4a9)){manager[_0x2704('0x45')](_0x3dd4a9);manager[_0x2704('0x51')](_0x3dd4a9);logger[_0x2704('0xa')](_0x2704('0x52'),_0x4222fe[_0x3dd4a9]['name'],_0x4222fe[_0x3dd4a9][_0x2704('0x4b')]);}}for(_0x166303=0x0,_0x3dd4a9;_0x166303<_0x1f905e[_0x2704('0x43')]&&!_0x5681e4;_0x166303+=0x1){_0x3dd4a9=_0x1f905e[_0x166303][_0x2704('0x40')]();if(manager['exists'](_0x3dd4a9)){if(_0x4222fe[_0x3dd4a9]['cron']&&_0x4222fe[_0x3dd4a9][_0x2704('0x4c')]&&moment()[_0x2704('0x53')](_0x4222fe[_0x3dd4a9][_0x2704('0x4d')],_0x4222fe[_0x3dd4a9][_0x2704('0x4e')])){manager[_0x2704('0x54')](_0x3dd4a9,_0x4222fe[_0x3dd4a9][_0x2704('0x4b')],handleJob(_0x4222fe[_0x3dd4a9]));logger[_0x2704('0xa')]('update\x20cron',_0x4222fe[_0x3dd4a9][_0x2704('0x17')],_0x4222fe[_0x3dd4a9][_0x2704('0x4b')]);}else{manager[_0x2704('0x45')](_0x3dd4a9);manager[_0x2704('0x51')](_0x3dd4a9);logger[_0x2704('0xa')](_0x2704('0x52'),_0x4222fe[_0x3dd4a9][_0x2704('0x17')],_0x4222fe[_0x3dd4a9][_0x2704('0x4b')]);}}}})[_0x2704('0x38')](function(_0x4f3f5c){logger['error'](JSON[_0x2704('0x26')](_0x4f3f5c));});}exports[_0x2704('0x55')]=function(_0x486d9c){return getJobs(_0x486d9c);};exports[_0x2704('0x4f')]=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 3e58d54..b84902d 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 _0x1d42=['No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','all','start','aws-sdk','request-promise','util','bluebird','../../config/logger','transcribe','Comprehend','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','fileText','TranscriptionJobStatus','COMPLETED','TranscriptionJob','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Transcript\x20not\x20available','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll'];(function(_0x5e462b,_0x187b06){var _0xb01a65=function(_0x2cc9a3){while(--_0x2cc9a3){_0x5e462b['push'](_0x5e462b['shift']());}};_0xb01a65(++_0x187b06);}(_0x1d42,0xe0));var _0x21d4=function(_0x41c78d,_0x4c3628){_0x41c78d=_0x41c78d-0x0;var _0x26d028=_0x1d42[_0x41c78d];return _0x26d028;};var _=require('lodash');var AWS=require(_0x21d4('0x0'));var rp=require(_0x21d4('0x1'));var util=require(_0x21d4('0x2'));var BPromise=require(_0x21d4('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x21d4('0x4'))(_0x21d4('0x5'));function getTranscriptionJob(_0x586f03,_0x5c5ebb,_0x8dc1a0,_0x40328e){return new Promise(function(_0x3a5ead,_0x45d2ff){var _0x576a48=new AWS['TranscribeService']({'accessKeyId':_0x5c5ebb,'secretAccessKey':_0x586f03,'region':_0x8dc1a0});_0x576a48['getTranscriptionJob']({'TranscriptionJobName':_0x40328e},function(_0x303633,_0x171379){if(_0x303633){return _0x45d2ff(_0x303633);}else{return _0x3a5ead(_0x171379);}});});}function sentiment(_0x39dba5,_0x11df27,_0xd81d49,_0x5e5a83,_0xa08ccc){return new Promise(function(_0x3a96ea,_0x4820f3){var _0x39dc48=new AWS[(_0x21d4('0x6'))]({'accessKeyId':_0x11df27,'secretAccessKey':_0x39dba5,'region':_0xd81d49});_0x39dc48['detectSentiment']({'Text':_0x5e5a83,'LanguageCode':_0xa08ccc[_0x21d4('0x7')](0x0,0x2)},function(_0x3c1d1b,_0x4f3325){if(_0x3c1d1b){return _0x4820f3(_0x3c1d1b);}else{return _0x3a96ea(_0x4f3325);}});});}function checkTranscribeJob(_0x4c61d2,_0x3c4989,_0x420cd0){var _0x2a03e3;return new BPromise(function(_0x452ab1,_0x46c6fe){logger['info'](util[_0x21d4('0x8')](_0x21d4('0x9'),_0x4c61d2['id'],_0x4c61d2[_0x21d4('0xa')]));return getTranscriptionJob(_0x420cd0[_0x21d4('0xb')],_0x420cd0[_0x21d4('0xc')],_0x3c4989[_0x21d4('0xd')],_0x4c61d2[_0x21d4('0xa')])[_0x21d4('0xe')](function(_0x415fb8){logger[_0x21d4('0xf')](util[_0x21d4('0x8')](_0x21d4('0x10'),_0x4c61d2['id'],_0x4c61d2['transcribeName'],_0x415fb8['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x4c61d2[_0x21d4('0x11')]){switch(_0x415fb8['TranscriptionJob'][_0x21d4('0x12')]){case _0x21d4('0x13'):var _0x5670b2={'transcribeStatus':_0x415fb8['TranscriptionJob'][_0x21d4('0x12')],'fileUri':_0x415fb8[_0x21d4('0x14')][_0x21d4('0x15')]['TranscriptFileUri']};logger['info'](util[_0x21d4('0x8')](_0x21d4('0x16'),_0x4c61d2['id']));return rp({'uri':_0x415fb8[_0x21d4('0x14')][_0x21d4('0x15')][_0x21d4('0x17')],'json':!![]})[_0x21d4('0xe')](function(_0x30e65b){logger[_0x21d4('0xf')](util[_0x21d4('0x8')](_0x21d4('0x18'),_0x4c61d2['id']));if(_0x30e65b&&_0x30e65b[_0x21d4('0x19')]&&_0x30e65b[_0x21d4('0x19')][_0x21d4('0x1a')]&&_0x30e65b[_0x21d4('0x19')][_0x21d4('0x1a')][_0x21d4('0x1b')]){_0x5670b2[_0x21d4('0x11')]='';for(var _0x345b60=0x0;_0x345b60<_0x30e65b[_0x21d4('0x19')][_0x21d4('0x1a')]['length'];_0x345b60++){_0x5670b2[_0x21d4('0x11')]+=_0x30e65b[_0x21d4('0x19')][_0x21d4('0x1a')][_0x345b60][_0x21d4('0x1c')]+'';}}return _0x4c61d2[_0x21d4('0x1d')](_0x5670b2);})[_0x21d4('0xe')](function(){logger[_0x21d4('0xf')](util[_0x21d4('0x8')](_0x21d4('0x1e'),_0x4c61d2['id']));if(!_0x4c61d2[_0x21d4('0x1f')]){throw new db[(_0x21d4('0x20'))][(_0x21d4('0x21'))](_0x21d4('0x22'));}if(!_0x3c4989[_0x21d4('0x23')]||!_0x3c4989[_0x21d4('0x24')]||!_0x3c4989['sentimentRegion']||!_0x3c4989[_0x21d4('0x25')]||!_0x3c4989[_0x21d4('0x26')]){throw new db[(_0x21d4('0x20'))][(_0x21d4('0x21'))](_0x21d4('0x27'));}if(!_0x5670b2[_0x21d4('0x11')]){throw new Error('Transcript\x20not\x20available');}if(_0x3c4989[_0x21d4('0x24')]===_0x420cd0['id']){return _0x420cd0;}else{return db[_0x21d4('0x28')][_0x21d4('0x29')]({'where':{'id':_settings[_0x21d4('0x24')]}});}})[_0x21d4('0xe')](function(_0x59ed5e){if(!_0x59ed5e){throw new db[(_0x21d4('0x20'))]['ValidationError'](_0x21d4('0x2a'));}if(!_0x59ed5e[_0x21d4('0xb')]||!_0x59ed5e['data2']){throw new db['Sequelize'][(_0x21d4('0x21'))](_0x21d4('0x2b'));}_0x2a03e3=_0x59ed5e;logger[_0x21d4('0xf')](util[_0x21d4('0x8')](_0x21d4('0x2c'),_0x4c61d2['id']));return sentiment(_0x2a03e3[_0x21d4('0xb')],_0x2a03e3[_0x21d4('0xc')],_0x3c4989[_0x21d4('0x2d')],_0x5670b2[_0x21d4('0x11')],_0x3c4989[_0x21d4('0x25')]);})[_0x21d4('0xe')](function(_0x31a282){logger[_0x21d4('0xf')](util[_0x21d4('0x8')](_0x21d4('0x2e'),_0x4c61d2['id']));return _0x4c61d2['update']({'sentiment':_0x31a282[_0x21d4('0x2f')],'sPositive':_0x31a282[_0x21d4('0x30')][_0x21d4('0x31')],'sNegative':_0x31a282['SentimentScore'][_0x21d4('0x32')],'sMixed':_0x31a282['SentimentScore'][_0x21d4('0x33')],'sNeutral':_0x31a282[_0x21d4('0x30')]['Neutral']});})[_0x21d4('0xe')](function(){logger[_0x21d4('0xf')](util[_0x21d4('0x8')](_0x21d4('0x1e'),_0x4c61d2['id']));_0x452ab1();});case _0x21d4('0x34'):return _0x4c61d2[_0x21d4('0x1d')]({'transcribeStatus':_0x21d4('0x34'),'failureReason':_0x415fb8[_0x21d4('0x14')][_0x21d4('0x35')]})[_0x21d4('0xe')](function(){logger[_0x21d4('0xf')](util[_0x21d4('0x8')](_0x21d4('0x1e'),_0x4c61d2['id']));_0x452ab1();});default:logger['info'](util[_0x21d4('0x8')](_0x21d4('0x36'),_0x4c61d2['id']));break;}}else{return BPromise['resolve']()[_0x21d4('0xe')](function(){if(!_0x4c61d2['tempSentiment']){throw new db[(_0x21d4('0x20'))]['ValidationError'](_0x21d4('0x22'));}if(!_0x3c4989[_0x21d4('0x23')]||!_0x3c4989[_0x21d4('0x24')]||!_0x3c4989[_0x21d4('0x2d')]||!_0x3c4989[_0x21d4('0x25')]||!_0x3c4989[_0x21d4('0x26')]){throw new db[(_0x21d4('0x20'))][(_0x21d4('0x21'))](_0x21d4('0x27'));}if(!_0x4c61d2[_0x21d4('0x11')]){throw new Error(_0x21d4('0x37'));}if(_0x3c4989[_0x21d4('0x24')]===_0x420cd0['id']){return _0x420cd0;}else{return db[_0x21d4('0x28')][_0x21d4('0x29')]({'where':{'id':_settings[_0x21d4('0x24')]}});}})[_0x21d4('0xe')](function(_0x5d22ec){if(!_0x5d22ec){throw new db['Sequelize'][(_0x21d4('0x21'))](_0x21d4('0x2a'));}if(!_0x5d22ec['data1']||!_0x5d22ec[_0x21d4('0xc')]){throw new db[(_0x21d4('0x20'))][(_0x21d4('0x21'))](_0x21d4('0x2b'));}_0x2a03e3=_0x5d22ec;logger[_0x21d4('0xf')](util[_0x21d4('0x8')](_0x21d4('0x2c'),_0x4c61d2['id']));return sentiment(_0x2a03e3['data1'],_0x2a03e3['data2'],_0x3c4989['sentimentRegion'],_0x4c61d2[_0x21d4('0x11')],_0x3c4989[_0x21d4('0x25')]);})[_0x21d4('0xe')](function(_0x2f58fb){logger[_0x21d4('0xf')](util['format'](_0x21d4('0x2e'),_0x4c61d2['id']));return _0x4c61d2['update']({'sentiment':_0x2f58fb['Sentiment'],'sPositive':_0x2f58fb[_0x21d4('0x30')][_0x21d4('0x31')],'sNegative':_0x2f58fb['SentimentScore']['Negative'],'sMixed':_0x2f58fb[_0x21d4('0x30')]['Mixed'],'sNeutral':_0x2f58fb[_0x21d4('0x30')]['Neutral'],'transcribeStatus':'COMPLETED'});})[_0x21d4('0xe')](function(){logger['info'](util[_0x21d4('0x8')](_0x21d4('0x1e'),_0x4c61d2['id']));_0x452ab1();});}})[_0x21d4('0x38')](function(_0x43748c){if(_0x43748c){if(!_0x43748c['name']||_0x43748c[_0x21d4('0x39')]!==_0x21d4('0x3a')){logger[_0x21d4('0x3b')](util[_0x21d4('0x8')](_0x21d4('0x3c'),_0x4c61d2['id']),util[_0x21d4('0x3d')](_0x43748c,{'showHidden':![],'depth':null}));}}_0x452ab1();});});}function checkTranscribe(){var _0x18c369;var _0x1aaebf;var _0x208e03;return db[_0x21d4('0x3e')][_0x21d4('0x3f')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x21d4('0xe')](function(_0x4b61b8){if(!_0x4b61b8||!_0x4b61b8[_0x21d4('0x1b')]){throw new db[(_0x21d4('0x20'))]['ValidationError'](_0x21d4('0x40'));}_0x18c369=_0x4b61b8;return db['Setting'][_0x21d4('0x29')]({'where':{'id':0x1}});})[_0x21d4('0xe')](function(_0x338664){if(!_0x338664){throw new db[(_0x21d4('0x20'))][(_0x21d4('0x21'))](_0x21d4('0x41'));}_0x1aaebf=_0x338664;if(!_0x1aaebf['transcribe']||!_0x1aaebf['transcribeAccountId']||!_0x1aaebf['transcribeRegion']||!_0x1aaebf[_0x21d4('0x25')]||!_0x1aaebf[_0x21d4('0x26')]){throw new db[(_0x21d4('0x20'))][(_0x21d4('0x21'))](_0x21d4('0x42'));}return db[_0x21d4('0x28')][_0x21d4('0x29')]({'where':{'id':_0x1aaebf[_0x21d4('0x43')]}});})[_0x21d4('0xe')](function(_0x4100ac){if(!_0x4100ac){throw new db['Sequelize'][(_0x21d4('0x21'))](_0x21d4('0x2a'));}if(!_0x4100ac['data1']||!_0x4100ac[_0x21d4('0xc')]){throw new db['Sequelize']['ValidationError'](_0x21d4('0x2b'));}_0x208e03=_0x4100ac;var _0x1b6bfc=[];_0x18c369[_0x21d4('0x44')](function(_0x2cbf66){_0x1b6bfc[_0x21d4('0x45')](checkTranscribeJob(_0x2cbf66,_0x1aaebf,_0x208e03));});return BPromise[_0x21d4('0x46')](_0x1b6bfc);})['catch'](function(_0x27e36f){if(_0x27e36f){if(!_0x27e36f['name']||_0x27e36f[_0x21d4('0x39')]!=='SequelizeValidationError'){logger[_0x21d4('0x3b')](util[_0x21d4('0x3d')](_0x27e36f,{'showHidden':![],'depth':null}));}}});}exports[_0x21d4('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x7fc3=['Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','catch','name','SequelizeValidationError','error','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','all','start','lodash','aws-sdk','request-promise','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','update','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2'];(function(_0x1caba5,_0x39044f){var _0x32a19e=function(_0x4e9baf){while(--_0x4e9baf){_0x1caba5['push'](_0x1caba5['shift']());}};_0x32a19e(++_0x39044f);}(_0x7fc3,0x18b));var _0x37fc=function(_0x337e7d,_0x193fe2){_0x337e7d=_0x337e7d-0x0;var _0x558c2e=_0x7fc3[_0x337e7d];return _0x558c2e;};var _=require(_0x37fc('0x0'));var AWS=require(_0x37fc('0x1'));var rp=require(_0x37fc('0x2'));var util=require('util');var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0x37fc('0x3'))(_0x37fc('0x4'));function getTranscriptionJob(_0x18f2e0,_0x684ce3,_0x336c4d,_0x2fae22){return new Promise(function(_0x3b3f2d,_0x2176ae){var _0x244f22=new AWS[(_0x37fc('0x5'))]({'accessKeyId':_0x684ce3,'secretAccessKey':_0x18f2e0,'region':_0x336c4d});_0x244f22[_0x37fc('0x6')]({'TranscriptionJobName':_0x2fae22},function(_0x40aaf9,_0x1dfee3){if(_0x40aaf9){return _0x2176ae(_0x40aaf9);}else{return _0x3b3f2d(_0x1dfee3);}});});}function sentiment(_0x1fe1a1,_0x326670,_0x4f27b9,_0x12b7e0,_0x1f625b){return new Promise(function(_0x39672a,_0x108ed5){var _0x2ee5ea=new AWS[(_0x37fc('0x7'))]({'accessKeyId':_0x326670,'secretAccessKey':_0x1fe1a1,'region':_0x4f27b9});_0x2ee5ea[_0x37fc('0x8')]({'Text':_0x12b7e0,'LanguageCode':_0x1f625b[_0x37fc('0x9')](0x0,0x2)},function(_0x4a512f,_0x26b8e9){if(_0x4a512f){return _0x108ed5(_0x4a512f);}else{return _0x39672a(_0x26b8e9);}});});}function checkTranscribeJob(_0x48b7d3,_0xe91058,_0x24a8fe){var _0xe68929;return new BPromise(function(_0x1ca351,_0x483402){logger[_0x37fc('0xa')](util[_0x37fc('0xb')](_0x37fc('0xc'),_0x48b7d3['id'],_0x48b7d3[_0x37fc('0xd')]));return getTranscriptionJob(_0x24a8fe[_0x37fc('0xe')],_0x24a8fe['data2'],_0xe91058[_0x37fc('0xf')],_0x48b7d3[_0x37fc('0xd')])[_0x37fc('0x10')](function(_0x55adae){logger[_0x37fc('0xa')](util['format'](_0x37fc('0x11'),_0x48b7d3['id'],_0x48b7d3['transcribeName'],_0x55adae[_0x37fc('0x12')][_0x37fc('0x13')]));if(!_0x48b7d3[_0x37fc('0x14')]){switch(_0x55adae[_0x37fc('0x12')]['TranscriptionJobStatus']){case _0x37fc('0x15'):var _0x5c018d={'transcribeStatus':_0x55adae[_0x37fc('0x12')][_0x37fc('0x13')],'fileUri':_0x55adae[_0x37fc('0x12')]['Transcript'][_0x37fc('0x16')]};logger[_0x37fc('0xa')](util[_0x37fc('0xb')](_0x37fc('0x17'),_0x48b7d3['id']));return rp({'uri':_0x55adae[_0x37fc('0x12')]['Transcript'][_0x37fc('0x16')],'json':!![]})[_0x37fc('0x10')](function(_0x3e6cee){logger[_0x37fc('0xa')](util['format']('[RECORDING:%d]\x20Transcript\x20downloaded',_0x48b7d3['id']));if(_0x3e6cee&&_0x3e6cee['results']&&_0x3e6cee[_0x37fc('0x18')][_0x37fc('0x19')]&&_0x3e6cee['results'][_0x37fc('0x19')]['length']){_0x5c018d[_0x37fc('0x14')]='';for(var _0x5c4731=0x0;_0x5c4731<_0x3e6cee['results']['transcripts'][_0x37fc('0x1a')];_0x5c4731++){_0x5c018d[_0x37fc('0x14')]+=_0x3e6cee[_0x37fc('0x18')][_0x37fc('0x19')][_0x5c4731][_0x37fc('0x1b')]+'';}}return _0x48b7d3[_0x37fc('0x1c')](_0x5c018d);})[_0x37fc('0x10')](function(){logger[_0x37fc('0xa')](util[_0x37fc('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x48b7d3['id']));if(!_0x48b7d3['tempSentiment']){throw new db[(_0x37fc('0x1d'))][(_0x37fc('0x1e'))](_0x37fc('0x1f'));}if(!_0xe91058[_0x37fc('0x20')]||!_0xe91058[_0x37fc('0x21')]||!_0xe91058[_0x37fc('0x22')]||!_0xe91058[_0x37fc('0x23')]||!_0xe91058[_0x37fc('0x24')]){throw new db[(_0x37fc('0x1d'))][(_0x37fc('0x1e'))](_0x37fc('0x25'));}if(!_0x5c018d[_0x37fc('0x14')]){throw new Error(_0x37fc('0x26'));}if(_0xe91058[_0x37fc('0x21')]===_0x24a8fe['id']){return _0x24a8fe;}else{return db[_0x37fc('0x27')][_0x37fc('0x28')]({'where':{'id':_settings[_0x37fc('0x21')]}});}})['then'](function(_0x118a4d){if(!_0x118a4d){throw new db['Sequelize'][(_0x37fc('0x1e'))](_0x37fc('0x29'));}if(!_0x118a4d[_0x37fc('0xe')]||!_0x118a4d[_0x37fc('0x2a')]){throw new db[(_0x37fc('0x1d'))][(_0x37fc('0x1e'))](_0x37fc('0x2b'));}_0xe68929=_0x118a4d;logger[_0x37fc('0xa')](util[_0x37fc('0xb')](_0x37fc('0x2c'),_0x48b7d3['id']));return sentiment(_0xe68929['data1'],_0xe68929[_0x37fc('0x2a')],_0xe91058['sentimentRegion'],_0x5c018d[_0x37fc('0x14')],_0xe91058[_0x37fc('0x23')]);})[_0x37fc('0x10')](function(_0x21ef44){logger[_0x37fc('0xa')](util[_0x37fc('0xb')](_0x37fc('0x2d'),_0x48b7d3['id']));return _0x48b7d3['update']({'sentiment':_0x21ef44[_0x37fc('0x2e')],'sPositive':_0x21ef44[_0x37fc('0x2f')][_0x37fc('0x30')],'sNegative':_0x21ef44[_0x37fc('0x2f')][_0x37fc('0x31')],'sMixed':_0x21ef44[_0x37fc('0x2f')][_0x37fc('0x32')],'sNeutral':_0x21ef44['SentimentScore'][_0x37fc('0x33')]});})['then'](function(){logger[_0x37fc('0xa')](util['format'](_0x37fc('0x34'),_0x48b7d3['id']));_0x1ca351();});case _0x37fc('0x35'):return _0x48b7d3[_0x37fc('0x1c')]({'transcribeStatus':_0x37fc('0x35'),'failureReason':_0x55adae[_0x37fc('0x12')]['FailureReason']})[_0x37fc('0x10')](function(){logger[_0x37fc('0xa')](util[_0x37fc('0xb')](_0x37fc('0x34'),_0x48b7d3['id']));_0x1ca351();});default:logger[_0x37fc('0xa')](util[_0x37fc('0xb')](_0x37fc('0x36'),_0x48b7d3['id']));break;}}else{return BPromise[_0x37fc('0x37')]()[_0x37fc('0x10')](function(){if(!_0x48b7d3['tempSentiment']){throw new db[(_0x37fc('0x1d'))][(_0x37fc('0x1e'))](_0x37fc('0x1f'));}if(!_0xe91058[_0x37fc('0x20')]||!_0xe91058[_0x37fc('0x21')]||!_0xe91058[_0x37fc('0x22')]||!_0xe91058[_0x37fc('0x23')]||!_0xe91058[_0x37fc('0x24')]){throw new db[(_0x37fc('0x1d'))][(_0x37fc('0x1e'))](_0x37fc('0x25'));}if(!_0x48b7d3[_0x37fc('0x14')]){throw new Error('Transcript\x20not\x20available');}if(_0xe91058[_0x37fc('0x21')]===_0x24a8fe['id']){return _0x24a8fe;}else{return db[_0x37fc('0x27')][_0x37fc('0x28')]({'where':{'id':_settings[_0x37fc('0x21')]}});}})[_0x37fc('0x10')](function(_0x578f74){if(!_0x578f74){throw new db['Sequelize']['ValidationError'](_0x37fc('0x29'));}if(!_0x578f74[_0x37fc('0xe')]||!_0x578f74[_0x37fc('0x2a')]){throw new db[(_0x37fc('0x1d'))]['ValidationError'](_0x37fc('0x2b'));}_0xe68929=_0x578f74;logger[_0x37fc('0xa')](util[_0x37fc('0xb')](_0x37fc('0x2c'),_0x48b7d3['id']));return sentiment(_0xe68929[_0x37fc('0xe')],_0xe68929[_0x37fc('0x2a')],_0xe91058[_0x37fc('0x22')],_0x48b7d3[_0x37fc('0x14')],_0xe91058[_0x37fc('0x23')]);})[_0x37fc('0x10')](function(_0x55434b){logger[_0x37fc('0xa')](util[_0x37fc('0xb')](_0x37fc('0x2d'),_0x48b7d3['id']));return _0x48b7d3['update']({'sentiment':_0x55434b[_0x37fc('0x2e')],'sPositive':_0x55434b[_0x37fc('0x2f')]['Positive'],'sNegative':_0x55434b[_0x37fc('0x2f')][_0x37fc('0x31')],'sMixed':_0x55434b['SentimentScore'][_0x37fc('0x32')],'sNeutral':_0x55434b[_0x37fc('0x2f')][_0x37fc('0x33')],'transcribeStatus':_0x37fc('0x15')});})[_0x37fc('0x10')](function(){logger[_0x37fc('0xa')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x48b7d3['id']));_0x1ca351();});}})[_0x37fc('0x38')](function(_0x3a6e11){if(_0x3a6e11){if(!_0x3a6e11[_0x37fc('0x39')]||_0x3a6e11['name']!==_0x37fc('0x3a')){logger[_0x37fc('0x3b')](util[_0x37fc('0xb')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x48b7d3['id']),util[_0x37fc('0x3c')](_0x3a6e11,{'showHidden':![],'depth':null}));}}_0x1ca351();});});}function checkTranscribe(){var _0x22fac3;var _0x1e2b59;var _0x550918;return db[_0x37fc('0x3d')][_0x37fc('0x3e')]({'where':{'transcribeStatus':_0x37fc('0x3f')}})[_0x37fc('0x10')](function(_0x3157f4){if(!_0x3157f4||!_0x3157f4[_0x37fc('0x1a')]){throw new db[(_0x37fc('0x1d'))][(_0x37fc('0x1e'))](_0x37fc('0x40'));}_0x22fac3=_0x3157f4;return db[_0x37fc('0x41')][_0x37fc('0x28')]({'where':{'id':0x1}});})['then'](function(_0x5da1a9){if(!_0x5da1a9){throw new db[(_0x37fc('0x1d'))][(_0x37fc('0x1e'))](_0x37fc('0x42'));}_0x1e2b59=_0x5da1a9;if(!_0x1e2b59[_0x37fc('0x4')]||!_0x1e2b59['transcribeAccountId']||!_0x1e2b59[_0x37fc('0xf')]||!_0x1e2b59['language']||!_0x1e2b59[_0x37fc('0x24')]){throw new db[(_0x37fc('0x1d'))]['ValidationError'](_0x37fc('0x43'));}return db[_0x37fc('0x27')][_0x37fc('0x28')]({'where':{'id':_0x1e2b59[_0x37fc('0x44')]}});})[_0x37fc('0x10')](function(_0x47918f){if(!_0x47918f){throw new db[(_0x37fc('0x1d'))][(_0x37fc('0x1e'))](_0x37fc('0x29'));}if(!_0x47918f['data1']||!_0x47918f[_0x37fc('0x2a')]){throw new db[(_0x37fc('0x1d'))][(_0x37fc('0x1e'))](_0x37fc('0x2b'));}_0x550918=_0x47918f;var _0xb5c2e=[];_0x22fac3[_0x37fc('0x45')](function(_0x35d891){_0xb5c2e[_0x37fc('0x46')](checkTranscribeJob(_0x35d891,_0x1e2b59,_0x550918));});return BPromise[_0x37fc('0x47')](_0xb5c2e);})[_0x37fc('0x38')](function(_0x113bb2){if(_0x113bb2){if(!_0x113bb2['name']||_0x113bb2['name']!==_0x37fc('0x3a')){logger[_0x37fc('0x3b')](util[_0x37fc('0x3c')](_0x113bb2,{'showHidden':![],'depth':null}));}}});}exports[_0x37fc('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 1f2eae2..0bbf945 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 _0x773e=['WhatsappInteraction','lastMsgAt','subtract','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','error','start','moment','ioredis','util','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter'];(function(_0x46799e,_0x84a401){var _0x8d429e=function(_0x12cc2a){while(--_0x12cc2a){_0x46799e['push'](_0x46799e['shift']());}};_0x8d429e(++_0x84a401);}(_0x773e,0x10b));var _0xe773=function(_0x57e31f,_0x452ba4){_0x57e31f=_0x57e31f-0x0;var _0x511ffc=_0x773e[_0x57e31f];return _0x511ffc;};'use strict';var _=require('lodash');var moment=require(_0xe773('0x0'));var Redis=require(_0xe773('0x1'));var util=require(_0xe773('0x2'));var config=require('../../config/environment');var db=require(_0xe773('0x3'))['db'];var logger=require(_0xe773('0x4'))('schedule');config[_0xe773('0x5')]=_[_0xe773('0x6')](config['redis'],{'host':_0xe773('0x7'),'port':0x18eb});var io=require(_0xe773('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x295214=[];return db[_0xe773('0x9')]['findAll']({'raw':!![],'attributes':['id',_0xe773('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xe773('0xb')](0x18,'hours')}}})[_0xe773('0xc')](function(_0x5d1fd2){if(_0x5d1fd2&&_0x5d1fd2[_0xe773('0xd')]){_0x295214=_['map'](_0x5d1fd2||[],'id');logger[_0xe773('0xe')](_0xe773('0xf'),_0x295214[_0xe773('0x10')]());return db[_0xe773('0x9')][_0xe773('0x11')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0xe773('0x12'))},{'where':{'id':_0x295214}});}})[_0xe773('0xc')](function(){if(_0x295214&&_0x295214[_0xe773('0xd')]){logger[_0xe773('0xe')](_0xe773('0x13'),_0x295214[_0xe773('0x10')]());for(var _0x564131=0x0;_0x564131<_0x295214[_0xe773('0xd')];_0x564131++){io[_0xe773('0x14')]('whatsappInteraction:update',{'id':_0x295214[_0x564131],'closed':!![]});}}})['catch'](function(_0xbf8017){logger[_0xe773('0x15')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0xbf8017?util['inspect'](_0xbf8017,{'showHidden':![],'depth':null}):'');});}exports[_0xe773('0x16')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xe256=['update','system','timeout','format','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','../../config/environment','../../mysqldb','../logger','schedule','defaults','redis','localhost','WhatsappInteraction','findAll','subtract','hours','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:'];(function(_0x2408fb,_0x41d8d7){var _0x40dea0=function(_0x55461d){while(--_0x55461d){_0x2408fb['push'](_0x2408fb['shift']());}};_0x40dea0(++_0x41d8d7);}(_0xe256,0x175));var _0x6e25=function(_0xc651a4,_0x137606){_0xc651a4=_0xc651a4-0x0;var _0x3f2203=_0xe256[_0xc651a4];return _0x3f2203;};'use strict';var _=require(_0x6e25('0x0'));var moment=require(_0x6e25('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x6e25('0x2'));var db=require(_0x6e25('0x3'))['db'];var logger=require(_0x6e25('0x4'))(_0x6e25('0x5'));config['redis']=_[_0x6e25('0x6')](config[_0x6e25('0x7')],{'host':_0x6e25('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6e25('0x7')]));function closeInteractions(){var _0x315417=[];return db[_0x6e25('0x9')][_0x6e25('0xa')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x6e25('0xb')](0x18,_0x6e25('0xc'))}}})['then'](function(_0x330c80){if(_0x330c80&&_0x330c80[_0x6e25('0xd')]){_0x315417=_[_0x6e25('0xe')](_0x330c80||[],'id');logger[_0x6e25('0xf')](_0x6e25('0x10'),_0x315417['join']());return db['WhatsappInteraction'][_0x6e25('0x11')]({'closeReason':_0x6e25('0x12'),'disposition':_0x6e25('0x13'),'closed':!![],'closedAt':moment()[_0x6e25('0x14')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x315417}});}})[_0x6e25('0x15')](function(){if(_0x315417&&_0x315417[_0x6e25('0xd')]){logger[_0x6e25('0xf')](_0x6e25('0x16'),_0x315417[_0x6e25('0x17')]());for(var _0x244dc6=0x0;_0x244dc6<_0x315417[_0x6e25('0xd')];_0x244dc6++){io[_0x6e25('0x18')](_0x6e25('0x19'),{'id':_0x315417[_0x244dc6],'closed':!![]});}}})[_0x6e25('0x1a')](function(_0x3c86ad){logger['error'](_0x6e25('0x1b'),_0x3c86ad?util[_0x6e25('0x1c')](_0x3c86ad,{'showHidden':![],'depth':null}):'');});}exports[_0x6e25('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 bb39817..0ac4cd4 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ba6=['hopper2','catch','util','@xcally.com','push','now','Innocenzo','Biondo','innocenzo.biondo','CmContact','then','bulkCreate','log','finished\x20populating','contacts1','destroy','hopper1','contacts2'];(function(_0x5cfbe8,_0x5d9e19){var _0x3b045a=function(_0x38a512){while(--_0x38a512){_0x5cfbe8['push'](_0x5cfbe8['shift']());}};_0x3b045a(++_0x5d9e19);}(_0x1ba6,0xa4));var _0x61ba=function(_0x16da32,_0x34438e){_0x16da32=_0x16da32-0x0;var _0x4144d5=_0x1ba6[_0x16da32];return _0x4144d5;};'use strict';var util=require(_0x61ba('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x61ba('0x1')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x61ba('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x61ba('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x61ba('0x3')](),'updatedAt':Date[_0x61ba('0x3')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x61ba('0x4')+i,'lastName':_0x61ba('0x5')+i,'phone':0xf879fb460+i,'email':_0x61ba('0x6')+i+_0x61ba('0x1')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x61ba('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x61ba('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x61ba('0x3')](),'updatedAt':Date[_0x61ba('0x3')]()});}db[_0x61ba('0x7')]['destroy']({'where':{}})[_0x61ba('0x8')](function(){return db['CmContact'][_0x61ba('0x9')](contacts);})['then'](function(){console[_0x61ba('0xa')](_0x61ba('0xb'),_0x61ba('0xc'));return db['CmHopper'][_0x61ba('0xd')]({'where':{}});})[_0x61ba('0x8')](function(){return db['CmHopper'][_0x61ba('0x9')](hopper);})[_0x61ba('0x8')](function(){console['log'](_0x61ba('0xb'),_0x61ba('0xe'));return db[_0x61ba('0x7')][_0x61ba('0x9')](contacts2);})['then'](function(){console[_0x61ba('0xa')](_0x61ba('0xb'),_0x61ba('0xf'));return db['CmHopper']['bulkCreate'](hopper2);})['then'](function(){console[_0x61ba('0xa')]('finished\x20populating',_0x61ba('0x10'));})[_0x61ba('0x11')](function(_0x45e3b7){console['log'](_0x45e3b7);}); \ No newline at end of file +var _0x5f1d=['contacts1','CmHopper','contacts2','util','../mysqldb','push','Innocenzo','Biondo','@xcally.com','now','innocenzo.biondo','CmContact','destroy','then','bulkCreate','log','finished\x20populating'];(function(_0x25122c,_0x2cf555){var _0x2d23c6=function(_0x3ac0fc){while(--_0x3ac0fc){_0x25122c['push'](_0x25122c['shift']());}};_0x2d23c6(++_0x2cf555);}(_0x5f1d,0x1df));var _0xd5f1=function(_0x32374c,_0x3b3075){_0x32374c=_0x32374c-0x0;var _0x4107ed=_0x5f1d[_0x32374c];return _0x4107ed;};'use strict';var util=require(_0xd5f1('0x0'));var db=require(_0xd5f1('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xd5f1('0x2')]({'id':i,'firstName':_0xd5f1('0x3')+i,'lastName':_0xd5f1('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xd5f1('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xd5f1('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xd5f1('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xd5f1('0x6')](),'updatedAt':Date[_0xd5f1('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xd5f1('0x4')+i,'phone':0xf879fb460+i,'email':_0xd5f1('0x7')+i+_0xd5f1('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xd5f1('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xd5f1('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xd5f1('0x6')](),'updatedAt':Date[_0xd5f1('0x6')]()});}db[_0xd5f1('0x8')][_0xd5f1('0x9')]({'where':{}})[_0xd5f1('0xa')](function(){return db[_0xd5f1('0x8')][_0xd5f1('0xb')](contacts);})[_0xd5f1('0xa')](function(){console[_0xd5f1('0xc')](_0xd5f1('0xd'),_0xd5f1('0xe'));return db[_0xd5f1('0xf')][_0xd5f1('0x9')]({'where':{}});})[_0xd5f1('0xa')](function(){return db['CmHopper']['bulkCreate'](hopper);})[_0xd5f1('0xa')](function(){console[_0xd5f1('0xc')](_0xd5f1('0xd'),'hopper1');return db[_0xd5f1('0x8')][_0xd5f1('0xb')](contacts2);})[_0xd5f1('0xa')](function(){console['log'](_0xd5f1('0xd'),_0xd5f1('0x10'));return db[_0xd5f1('0xf')][_0xd5f1('0xb')](hopper2);})[_0xd5f1('0xa')](function(){console[_0xd5f1('0xc')](_0xd5f1('0xd'),'hopper2');})['catch'](function(_0x9aaf78){console[_0xd5f1('0xc')](_0x9aaf78);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 07fbbc1..28a62ac 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x13b4=['password','friend','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','then','log','add\x20user','util','push','format','%s%s','agent','%s%s@xcally.com'];(function(_0x286e12,_0x237677){var _0xd97fdd=function(_0x5b1f58){while(--_0x5b1f58){_0x286e12['push'](_0x286e12['shift']());}};_0xd97fdd(++_0x237677);}(_0x13b4,0xa5));var _0x413b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x13b4[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x413b('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x413b('0x1')]({'name':util[_0x413b('0x2')](_0x413b('0x3'),_0x413b('0x4'),i),'fullname':util['format'](_0x413b('0x3'),_0x413b('0x4'),i),'email':util[_0x413b('0x2')](_0x413b('0x5'),_0x413b('0x4'),i),'role':'agent','password':_0x413b('0x6'),'internal':0xfa0+i,'type':_0x413b('0x7'),'transport':[_0x413b('0x8'),'ws','wss'],'disallow':[_0x413b('0x9')],'allow':[_0x413b('0xa')],'defaultuser':util[_0x413b('0x2')](_0x413b('0x3'),_0x413b('0x4'),i),'encryption':_0x413b('0xb'),'avpf':_0x413b('0xb'),'force_avp':_0x413b('0xb'),'icesupport':'yes','dtlsenable':_0x413b('0xb'),'dtlsverify':'no','dtlscertfile':_0x413b('0xc'),'dtlsprivatekey':_0x413b('0xd'),'dtlssetup':'actpass','callerid':util[_0x413b('0x2')](_0x413b('0xe'),util[_0x413b('0x2')](_0x413b('0x3'),'agent',i),0xfa0+i)});}db[_0x413b('0xf')]['bulkCreate'](users)[_0x413b('0x10')](function(){console[_0x413b('0x11')](_0x413b('0x12'));})['catch'](function(_0x4612cb){console[_0x413b('0x11')](_0x4612cb);}); \ No newline at end of file +var _0x2931=['catch','util','../mysqldb','push','format','%s%s','agent','password','friend','udp','ulaw','yes','/etc/pki/tls/certs/motion.crt','\x22%s\x22\x20<%s>','User','then','log','add\x20user'];(function(_0x5ab165,_0x3cc018){var _0x5d1ee1=function(_0x1ca621){while(--_0x1ca621){_0x5ab165['push'](_0x5ab165['shift']());}};_0x5d1ee1(++_0x3cc018);}(_0x2931,0x7f));var _0x1293=function(_0x39bb48,_0x2ac32e){_0x39bb48=_0x39bb48-0x0;var _0x3ba4f7=_0x2931[_0x39bb48];return _0x3ba4f7;};'use strict';var util=require(_0x1293('0x0'));var db=require(_0x1293('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x1293('0x2')]({'name':util[_0x1293('0x3')](_0x1293('0x4'),_0x1293('0x5'),i),'fullname':util[_0x1293('0x3')]('%s%s','agent',i),'email':util[_0x1293('0x3')]('%s%s@xcally.com',_0x1293('0x5'),i),'role':'agent','password':_0x1293('0x6'),'internal':0xfa0+i,'type':_0x1293('0x7'),'transport':[_0x1293('0x8'),'ws','wss'],'disallow':['all'],'allow':[_0x1293('0x9')],'defaultuser':util[_0x1293('0x3')](_0x1293('0x4'),_0x1293('0x5'),i),'encryption':_0x1293('0xa'),'avpf':_0x1293('0xa'),'force_avp':_0x1293('0xa'),'icesupport':_0x1293('0xa'),'dtlsenable':_0x1293('0xa'),'dtlsverify':'no','dtlscertfile':_0x1293('0xb'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0x1293('0x3')](_0x1293('0xc'),util[_0x1293('0x3')](_0x1293('0x4'),'agent',i),0xfa0+i)});}db[_0x1293('0xd')]['bulkCreate'](users)[_0x1293('0xe')](function(){console[_0x1293('0xf')](_0x1293('0x10'));})[_0x1293('0x11')](function(_0x5061c0){console[_0x1293('0xf')](_0x5061c0);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 5e7e3ff..0e62fd1 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae88=['admin','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','Campaign','voice:inbound','WhatsappQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','sms','mail','openchannel','whatsapp','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','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','address','remoteAddress','request','connectedAt','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','Agents','name','agent','telephone','type','ivr','UserProfileSection','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','role','format','%s:queue:%s','user:%s','handshake','User','find','userProfileId','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions'];(function(_0x33e59a,_0x4d364d){var _0x1456c9=function(_0x327022){while(--_0x327022){_0x33e59a['push'](_0x33e59a['shift']());}};_0x1456c9(++_0x4d364d);}(_0xae88,0xa1));var _0x8ae8=function(_0x36ea55,_0x15caa6){_0x36ea55=_0x36ea55-0x0;var _0x3658dd=_0xae88[_0x36ea55];return _0x3658dd;};'use strict';var _=require(_0x8ae8('0x0'));var util=require(_0x8ae8('0x1'));var BPromise=require(_0x8ae8('0x2'));var db=require(_0x8ae8('0x3'))['db'];var config=require(_0x8ae8('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x8ae8('0x5'),'model':db['User'],'attributes':['id',_0x8ae8('0x6'),'role'],'raw':!![],'where':{'role':_0x8ae8('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x8ae8('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x8ae8('0x6')],'where':{'role':_0x8ae8('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x8ae8('0x9')],'where':{'type':_0x8ae8('0xa')}};function getAssociatedResources(_0x4dd3b1,_0x2fa9b6,_0x2aaade){return db[_0x8ae8('0xb')]['findOne']({'where':{'name':_0x4dd3b1,'userProfileId':_0x2fa9b6},'raw':!![]})[_0x8ae8('0xc')](function(_0x511f03){if(_0x511f03){if(_0x511f03['autoAssociation']){switch(_0x4dd3b1){case _0x8ae8('0xd'):case _0x8ae8('0xe'):case _0x8ae8('0xf'):case _0x8ae8('0x10'):case _0x8ae8('0x11'):case _0x8ae8('0x12'):case'WhatsappQueues':return db[_0x2aaade][_0x8ae8('0x13')](queryQueues);case _0x8ae8('0x14'):return db[_0x2aaade][_0x8ae8('0x13')](queryTelephones);case _0x8ae8('0x15'):return db[_0x2aaade]['findAll'](queryTrunks);case _0x8ae8('0x16'):return db[_0x2aaade][_0x8ae8('0x13')](queryCampaigns);}}else{return db[_0x8ae8('0x17')][_0x8ae8('0x13')]({'attributes':[_0x8ae8('0x18')],'where':{'sectionId':_0x511f03['id']},'raw':!![]})[_0x8ae8('0xc')](function(_0x2df77c){if(_0x2df77c){var _0x1eb2a9={'where':{'id':_[_0x8ae8('0x19')](_0x2df77c,'resourceId')},'raw':!![]};switch(_0x2aaade){case'User':_0x1eb2a9[_0x8ae8('0x1a')][_0x8ae8('0x1b')]=_0x8ae8('0x8');break;case'Campaign':_0x1eb2a9[_0x8ae8('0x1a')][_0x8ae8('0x9')]=_0x8ae8('0xa');break;}return db[_0x2aaade][_0x8ae8('0x13')](_0x1eb2a9);}else{return[];}});}}else{return[];}})['then'](function(_0x49d472){return _0x49d472;});}function joinOrLeaveQueues(_0x3c276c,_0x5c5dcc,_0x31e804,_0x85c632){_0x3c276c[_0x5c5dcc](util[_0x8ae8('0x1c')](_0x8ae8('0x1d'),_0x31e804,_0x85c632[_0x8ae8('0x6')]));if(_0x85c632['Agents']){for(var _0x9ec156=0x0;_0x9ec156<_0x85c632['Agents']['length'];_0x9ec156+=0x1){_0x3c276c[_0x5c5dcc](util[_0x8ae8('0x1c')](_0x8ae8('0x1e'),_0x85c632[_0x8ae8('0x5')][_0x9ec156]['name']));}}}function joinOrLeave(_0x2cee78,_0x5a3df6,_0x2136e0){var _0x2e46af;if(_0x2cee78[_0x8ae8('0x1f')]['query']['id']){db[_0x8ae8('0x20')][_0x8ae8('0x21')]({'attributes':['id','name',_0x8ae8('0x1b'),_0x8ae8('0x22')],'where':{'id':_0x2cee78[_0x8ae8('0x1f')]['query']['id']},'include':[{'model':db['ChatInteraction'],'as':_0x8ae8('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x8ae8('0x24')],'as':_0x8ae8('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x8ae8('0x26')],'as':_0x8ae8('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x8ae8('0x28')],'as':_0x8ae8('0x29'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x8ae8('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x8ae8('0x2b')],'as':_0x8ae8('0x2c'),'attributes':['id'],'raw':!![]}]})['then'](function(_0xf7dc9b){if(_0xf7dc9b){_0x2e46af=_0xf7dc9b;_0x2cee78[_0x5a3df6](util[_0x8ae8('0x1c')](_0x8ae8('0x1e'),_0xf7dc9b['name']));var _0x45cc3d=[];switch(_0xf7dc9b['role']){case _0x8ae8('0x2d'):_0x2cee78[_0x5a3df6]('voice:inbound');_0x2cee78[_0x5a3df6](_0x8ae8('0x2e'));if(queryQueues[_0x8ae8('0x2f')]('include')){delete queryQueues[_0x8ae8('0x30')];}_0x45cc3d[_0x8ae8('0x31')](db[_0x8ae8('0x32')]['findAll'](queryQueues));_0x45cc3d[_0x8ae8('0x31')](db[_0x8ae8('0x33')][_0x8ae8('0x13')](queryQueues));_0x45cc3d[_0x8ae8('0x31')](db[_0x8ae8('0x34')][_0x8ae8('0x13')](queryQueues));_0x45cc3d[_0x8ae8('0x31')](db[_0x8ae8('0x35')][_0x8ae8('0x13')](queryQueues));_0x45cc3d[_0x8ae8('0x31')](db[_0x8ae8('0x36')][_0x8ae8('0x13')](queryQueues));_0x45cc3d[_0x8ae8('0x31')](db[_0x8ae8('0x37')][_0x8ae8('0x13')](queryQueues));_0x45cc3d['push'](db['WhatsappQueue'][_0x8ae8('0x13')](queryQueues));_0x45cc3d[_0x8ae8('0x31')](db['User'][_0x8ae8('0x13')](queryTelephones));_0x45cc3d['push'](db[_0x8ae8('0x38')][_0x8ae8('0x13')](queryTrunks));_0x45cc3d[_0x8ae8('0x31')](db[_0x8ae8('0x39')]['findAll'](queryCampaigns));_0x45cc3d['push'](db[_0x8ae8('0x20')][_0x8ae8('0x13')](queryAgents));break;case'user':_0x2cee78[_0x5a3df6](_0x8ae8('0x3a'));_0x2cee78[_0x5a3df6](_0x8ae8('0x2e'));_0x45cc3d[_0x8ae8('0x31')](getAssociatedResources(_0x8ae8('0xd'),_0xf7dc9b[_0x8ae8('0x22')],_0x8ae8('0x32')));_0x45cc3d[_0x8ae8('0x31')](getAssociatedResources(_0x8ae8('0xe'),_0xf7dc9b[_0x8ae8('0x22')],_0x8ae8('0x33')));_0x45cc3d[_0x8ae8('0x31')](getAssociatedResources(_0x8ae8('0xf'),_0xf7dc9b['userProfileId'],'FaxQueue'));_0x45cc3d[_0x8ae8('0x31')](getAssociatedResources('SmsQueues',_0xf7dc9b[_0x8ae8('0x22')],_0x8ae8('0x35')));_0x45cc3d[_0x8ae8('0x31')](getAssociatedResources(_0x8ae8('0x11'),_0xf7dc9b[_0x8ae8('0x22')],'MailQueue'));_0x45cc3d[_0x8ae8('0x31')](getAssociatedResources(_0x8ae8('0x12'),_0xf7dc9b[_0x8ae8('0x22')],_0x8ae8('0x37')));_0x45cc3d[_0x8ae8('0x31')](getAssociatedResources(_0x8ae8('0x3b'),_0xf7dc9b[_0x8ae8('0x22')],'WhatsappQueue'));_0x45cc3d['push'](getAssociatedResources(_0x8ae8('0x14'),_0xf7dc9b[_0x8ae8('0x22')],_0x8ae8('0x20')));_0x45cc3d[_0x8ae8('0x31')](getAssociatedResources(_0x8ae8('0x15'),_0xf7dc9b['userProfileId'],'Trunk'));_0x45cc3d[_0x8ae8('0x31')](getAssociatedResources(_0x8ae8('0x16'),_0xf7dc9b[_0x8ae8('0x22')],_0x8ae8('0x39')));_0x45cc3d[_0x8ae8('0x31')](db[_0x8ae8('0x20')][_0x8ae8('0x13')](queryAgents));break;case _0x8ae8('0x7'):_0x2cee78[_0x5a3df6]('voice:inbound');_0x2cee78[_0x5a3df6](_0x8ae8('0x2e'));_0x45cc3d[_0x8ae8('0x31')](_0xf7dc9b[_0x8ae8('0x3c')]({'attributes':['id',_0x8ae8('0x6')]}));_0x45cc3d[_0x8ae8('0x31')](_0xf7dc9b[_0x8ae8('0x3d')]({'attributes':['id','name']}));_0x45cc3d[_0x8ae8('0x31')](_0xf7dc9b[_0x8ae8('0x3e')]({'attributes':['id',_0x8ae8('0x6')]}));_0x45cc3d['push'](_0xf7dc9b[_0x8ae8('0x3f')]({'attributes':['id',_0x8ae8('0x6')]}));_0x45cc3d[_0x8ae8('0x31')](_0xf7dc9b[_0x8ae8('0x40')]({'attributes':['id',_0x8ae8('0x6')]}));_0x45cc3d[_0x8ae8('0x31')](_0xf7dc9b[_0x8ae8('0x41')]({'attributes':['id',_0x8ae8('0x6')]}));_0x45cc3d[_0x8ae8('0x31')](_0xf7dc9b[_0x8ae8('0x42')]({'attributes':['id',_0x8ae8('0x6')]}));break;}return BPromise[_0x8ae8('0x43')](_0x45cc3d);}})['then'](function(_0xae1b62){if(_0xae1b62&&_0xae1b62['length']){for(var _0x59b162=0x0;_0x59b162<_0xae1b62[_0x8ae8('0x44')];_0x59b162+=0x1){for(var _0x554547=0x0;_0x554547<_0xae1b62[_0x59b162][_0x8ae8('0x44')];_0x554547+=0x1){switch(_0x59b162){case 0x0:joinOrLeaveQueues(_0x2cee78,_0x5a3df6,_0x8ae8('0x45'),_0xae1b62[_0x59b162][_0x554547]);break;case 0x1:joinOrLeaveQueues(_0x2cee78,_0x5a3df6,'chat',_0xae1b62[_0x59b162][_0x554547]);break;case 0x2:joinOrLeaveQueues(_0x2cee78,_0x5a3df6,'fax',_0xae1b62[_0x59b162][_0x554547]);break;case 0x3:joinOrLeaveQueues(_0x2cee78,_0x5a3df6,_0x8ae8('0x46'),_0xae1b62[_0x59b162][_0x554547]);break;case 0x4:joinOrLeaveQueues(_0x2cee78,_0x5a3df6,_0x8ae8('0x47'),_0xae1b62[_0x59b162][_0x554547]);break;case 0x5:joinOrLeaveQueues(_0x2cee78,_0x5a3df6,_0x8ae8('0x48'),_0xae1b62[_0x59b162][_0x554547]);break;case 0x6:joinOrLeaveQueues(_0x2cee78,_0x5a3df6,_0x8ae8('0x49'),_0xae1b62[_0x59b162][_0x554547]);break;case 0x7:_0x2cee78[_0x5a3df6](util[_0x8ae8('0x1c')](_0x8ae8('0x4a'),_0xae1b62[_0x59b162][_0x554547][_0x8ae8('0x6')]));break;case 0x8:_0x2cee78[_0x5a3df6](util['format'](_0x8ae8('0x4b'),_0xae1b62[_0x59b162][_0x554547][_0x8ae8('0x6')]));break;case 0x9:_0x2cee78[_0x5a3df6](util[_0x8ae8('0x1c')](_0x8ae8('0x4c'),_0xae1b62[_0x59b162][_0x554547][_0x8ae8('0x9')],_0xae1b62[_0x59b162][_0x554547][_0x8ae8('0x6')]));break;case 0xa:_0x2cee78[_0x5a3df6](util[_0x8ae8('0x1c')](_0x8ae8('0x1e'),_0xae1b62[_0x59b162][_0x554547][_0x8ae8('0x6')]));break;}}}}})[_0x8ae8('0xc')](function(){if(_0x5a3df6===_0x8ae8('0x4d')){var _0x1e3bd3=_[_0x8ae8('0x19')](_0x2e46af[_0x8ae8('0x23')],'id');return _0x2e46af[_0x8ae8('0x4e')](_0x1e3bd3)[_0x8ae8('0xc')](function(){for(var _0x5926e9=0x0;_0x5926e9<_0x1e3bd3[_0x8ae8('0x44')];_0x5926e9+=0x1){_0x2136e0[_0x8ae8('0x4f')](_0x8ae8('0x50'),{'ChatInteractionId':Number(_0x1e3bd3[_0x5926e9]),'UserId':Number(_0x2e46af['id'])});}});}})['then'](function(){if(_0x5a3df6===_0x8ae8('0x4d')){var _0x1b3d08=_['map'](_0x2e46af[_0x8ae8('0x25')],'id');return _0x2e46af['removeMailInteractions'](_0x1b3d08)[_0x8ae8('0xc')](function(){for(var _0x1cd108=0x0;_0x1cd108<_0x1b3d08[_0x8ae8('0x44')];_0x1cd108+=0x1){_0x2136e0[_0x8ae8('0x4f')](_0x8ae8('0x51'),{'MailInteractionId':Number(_0x1b3d08[_0x1cd108]),'UserId':Number(_0x2e46af['id'])});}});}})[_0x8ae8('0xc')](function(){if(_0x5a3df6==='leave'){var _0x12d376=_[_0x8ae8('0x19')](_0x2e46af['FaxInteractions'],'id');return _0x2e46af[_0x8ae8('0x52')](_0x12d376)[_0x8ae8('0xc')](function(){for(var _0x29079b=0x0;_0x29079b<_0x12d376[_0x8ae8('0x44')];_0x29079b+=0x1){_0x2136e0['emit'](_0x8ae8('0x53'),{'FaxInteractionId':Number(_0x12d376[_0x29079b]),'UserId':Number(_0x2e46af['id'])});}});}})['then'](function(){if(_0x5a3df6===_0x8ae8('0x4d')){var _0x20ee57=_[_0x8ae8('0x19')](_0x2e46af[_0x8ae8('0x29')],'id');return _0x2e46af[_0x8ae8('0x54')](_0x20ee57)[_0x8ae8('0xc')](function(){for(var _0x3dc61d=0x0;_0x3dc61d<_0x20ee57[_0x8ae8('0x44')];_0x3dc61d+=0x1){_0x2136e0[_0x8ae8('0x4f')](_0x8ae8('0x55'),{'SmsInteractionId':Number(_0x20ee57[_0x3dc61d]),'UserId':Number(_0x2e46af['id'])});}});}})[_0x8ae8('0xc')](function(){if(_0x5a3df6==='leave'){var _0x367b1a=_['map'](_0x2e46af[_0x8ae8('0x2a')],'id');return _0x2e46af[_0x8ae8('0x56')](_0x367b1a)[_0x8ae8('0xc')](function(){for(var _0x3d4987=0x0;_0x3d4987<_0x367b1a['length'];_0x3d4987+=0x1){_0x2136e0['emit'](_0x8ae8('0x57'),{'OpenchannelInteractionId':Number(_0x367b1a[_0x3d4987]),'UserId':Number(_0x2e46af['id'])});}});}})['then'](function(){if(_0x5a3df6===_0x8ae8('0x4d')){var _0x5a6f14=_[_0x8ae8('0x19')](_0x2e46af['WhatsappInteractions'],'id');return _0x2e46af[_0x8ae8('0x58')](_0x5a6f14)[_0x8ae8('0xc')](function(){for(var _0xebeed1=0x0;_0xebeed1<_0x5a6f14[_0x8ae8('0x44')];_0xebeed1+=0x1){_0x2136e0[_0x8ae8('0x4f')](_0x8ae8('0x59'),{'WhatsappInteractionId':Number(_0x5a6f14[_0xebeed1]),'UserId':Number(_0x2e46af['id'])});}});}})['catch'](function(_0x21f0c5){_0x2cee78[_0x8ae8('0x5a')](_0x21f0c5);});}}function onDisconnect(_0x1fc36a,_0x3f7593){joinOrLeave(_0x1fc36a,'leave',_0x3f7593);}function onConnect(_0x439643){joinOrLeave(_0x439643,_0x8ae8('0x5b'));}exports[_0x8ae8('0x5c')]=function(_0x5b1418){_0x5b1418['on'](_0x8ae8('0x5d'),function(_0x153fd9){_0x153fd9[_0x8ae8('0x5e')](0x0);_0x153fd9[_0x8ae8('0x5f')]=_0x153fd9['request'][_0x8ae8('0x5d')][_0x8ae8('0x60')]+':'+_0x153fd9[_0x8ae8('0x61')][_0x8ae8('0x5d')]['remotePort'];_0x153fd9[_0x8ae8('0x62')]=new Date();_0x153fd9['log']=function(_0x2cff1b){console[_0x8ae8('0x5a')](_0x8ae8('0x63')+_0x153fd9['nsp'][_0x8ae8('0x6')]+'['+_0x153fd9[_0x8ae8('0x5f')]+']',_0x2cff1b);};_0x153fd9['on'](_0x8ae8('0x64'),function(){onDisconnect(_0x153fd9,_0x5b1418);_0x153fd9[_0x8ae8('0x5a')](_0x8ae8('0x65'));});onConnect(_0x153fd9);_0x153fd9[_0x8ae8('0x5a')](_0x8ae8('0x66'));});}; \ No newline at end of file +var _0x25b0=['address','request','remoteAddress','remotePort','log','nsp','disconnect','DISCONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','telephone','agent','type','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','format','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:outbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','user','voice:inbound','OpenchannelQueues','WhatsappQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','length','voice','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','catch','default','connection','setMaxListeners'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x25b0,0x140));var _0x025b=function(_0xd3b0ac,_0x2f5065){_0xd3b0ac=_0xd3b0ac-0x0;var _0x3d773e=_0x25b0[_0xd3b0ac];return _0x3d773e;};'use strict';var _=require(_0x025b('0x0'));var util=require(_0x025b('0x1'));var BPromise=require(_0x025b('0x2'));var db=require(_0x025b('0x3'))['db'];var config=require(_0x025b('0x4'));var queryQueues={'attributes':['id',_0x025b('0x5')],'include':[{'as':_0x025b('0x6'),'model':db[_0x025b('0x7')],'attributes':['id',_0x025b('0x5'),_0x025b('0x8')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x025b('0x5')],'where':{'role':_0x025b('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x025b('0x5')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x025b('0xa')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x025b('0x5'),_0x025b('0xb')],'where':{'type':_0x025b('0xc')}};function getAssociatedResources(_0xf259e7,_0x4428c3,_0x3851d4){return db['UserProfileSection'][_0x025b('0xd')]({'where':{'name':_0xf259e7,'userProfileId':_0x4428c3},'raw':!![]})[_0x025b('0xe')](function(_0x3fb897){if(_0x3fb897){if(_0x3fb897[_0x025b('0xf')]){switch(_0xf259e7){case _0x025b('0x10'):case _0x025b('0x11'):case _0x025b('0x12'):case _0x025b('0x13'):case _0x025b('0x14'):case'OpenchannelQueues':case _0x025b('0x15'):return db[_0x3851d4][_0x025b('0x16')](queryQueues);case _0x025b('0x17'):return db[_0x3851d4][_0x025b('0x16')](queryTelephones);case _0x025b('0x18'):return db[_0x3851d4]['findAll'](queryTrunks);case _0x025b('0x19'):return db[_0x3851d4][_0x025b('0x16')](queryCampaigns);}}else{return db[_0x025b('0x1a')][_0x025b('0x16')]({'attributes':[_0x025b('0x1b')],'where':{'sectionId':_0x3fb897['id']},'raw':!![]})[_0x025b('0xe')](function(_0x41b189){if(_0x41b189){var _0x50d54b={'where':{'id':_[_0x025b('0x1c')](_0x41b189,_0x025b('0x1b'))},'raw':!![]};switch(_0x3851d4){case _0x025b('0x7'):_0x50d54b[_0x025b('0x1d')][_0x025b('0x8')]=_0x025b('0x9');break;case _0x025b('0x1e'):_0x50d54b['where'][_0x025b('0xb')]=_0x025b('0xc');break;}return db[_0x3851d4][_0x025b('0x16')](_0x50d54b);}else{return[];}});}}else{return[];}})[_0x025b('0xe')](function(_0x583f89){return _0x583f89;});}function joinOrLeaveQueues(_0x102b89,_0x384dba,_0x11ed23,_0x3613b0){_0x102b89[_0x384dba](util[_0x025b('0x1f')]('%s:queue:%s',_0x11ed23,_0x3613b0[_0x025b('0x5')]));if(_0x3613b0[_0x025b('0x6')]){for(var _0x7430fd=0x0;_0x7430fd<_0x3613b0[_0x025b('0x6')]['length'];_0x7430fd+=0x1){_0x102b89[_0x384dba](util['format'](_0x025b('0x20'),_0x3613b0[_0x025b('0x6')][_0x7430fd][_0x025b('0x5')]));}}}function joinOrLeave(_0xa47061,_0x4edb56,_0x1c65fc){var _0x2dd34b;if(_0xa47061[_0x025b('0x21')][_0x025b('0x22')]['id']){db[_0x025b('0x7')][_0x025b('0x23')]({'attributes':['id',_0x025b('0x5'),_0x025b('0x8'),_0x025b('0x24')],'where':{'id':_0xa47061[_0x025b('0x21')][_0x025b('0x22')]['id']},'include':[{'model':db[_0x025b('0x25')],'as':_0x025b('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x025b('0x27')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x025b('0x28')],'as':_0x025b('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x025b('0x2a')],'as':_0x025b('0x2b'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x025b('0x2c'),'attributes':['id'],'raw':!![]},{'model':db[_0x025b('0x2d')],'as':_0x025b('0x2e'),'attributes':['id'],'raw':!![]}]})[_0x025b('0xe')](function(_0x296de2){if(_0x296de2){_0x2dd34b=_0x296de2;_0xa47061[_0x4edb56](util[_0x025b('0x1f')](_0x025b('0x20'),_0x296de2[_0x025b('0x5')]));var _0x20d97e=[];switch(_0x296de2['role']){case _0x025b('0x2f'):_0xa47061[_0x4edb56]('voice:inbound');_0xa47061[_0x4edb56](_0x025b('0x30'));if(queryQueues[_0x025b('0x31')](_0x025b('0x32'))){delete queryQueues[_0x025b('0x32')];}_0x20d97e['push'](db[_0x025b('0x33')][_0x025b('0x16')](queryQueues));_0x20d97e[_0x025b('0x34')](db[_0x025b('0x35')][_0x025b('0x16')](queryQueues));_0x20d97e[_0x025b('0x34')](db[_0x025b('0x36')][_0x025b('0x16')](queryQueues));_0x20d97e['push'](db[_0x025b('0x37')][_0x025b('0x16')](queryQueues));_0x20d97e['push'](db[_0x025b('0x38')][_0x025b('0x16')](queryQueues));_0x20d97e[_0x025b('0x34')](db[_0x025b('0x39')][_0x025b('0x16')](queryQueues));_0x20d97e['push'](db['WhatsappQueue'][_0x025b('0x16')](queryQueues));_0x20d97e[_0x025b('0x34')](db[_0x025b('0x7')][_0x025b('0x16')](queryTelephones));_0x20d97e[_0x025b('0x34')](db[_0x025b('0x3a')][_0x025b('0x16')](queryTrunks));_0x20d97e['push'](db['Campaign']['findAll'](queryCampaigns));_0x20d97e['push'](db['User'][_0x025b('0x16')](queryAgents));break;case _0x025b('0x3b'):_0xa47061[_0x4edb56](_0x025b('0x3c'));_0xa47061[_0x4edb56]('voice:outbound');_0x20d97e[_0x025b('0x34')](getAssociatedResources('VoiceQueues',_0x296de2['userProfileId'],_0x025b('0x33')));_0x20d97e[_0x025b('0x34')](getAssociatedResources('ChatQueues',_0x296de2[_0x025b('0x24')],_0x025b('0x35')));_0x20d97e[_0x025b('0x34')](getAssociatedResources('FaxQueues',_0x296de2[_0x025b('0x24')],'FaxQueue'));_0x20d97e[_0x025b('0x34')](getAssociatedResources(_0x025b('0x13'),_0x296de2[_0x025b('0x24')],_0x025b('0x37')));_0x20d97e['push'](getAssociatedResources(_0x025b('0x14'),_0x296de2['userProfileId'],_0x025b('0x38')));_0x20d97e['push'](getAssociatedResources(_0x025b('0x3d'),_0x296de2[_0x025b('0x24')],_0x025b('0x39')));_0x20d97e[_0x025b('0x34')](getAssociatedResources(_0x025b('0x15'),_0x296de2['userProfileId'],_0x025b('0x3e')));_0x20d97e[_0x025b('0x34')](getAssociatedResources('Telephones',_0x296de2['userProfileId'],_0x025b('0x7')));_0x20d97e[_0x025b('0x34')](getAssociatedResources(_0x025b('0x18'),_0x296de2[_0x025b('0x24')],_0x025b('0x3a')));_0x20d97e['push'](getAssociatedResources(_0x025b('0x19'),_0x296de2['userProfileId'],_0x025b('0x1e')));_0x20d97e[_0x025b('0x34')](db[_0x025b('0x7')][_0x025b('0x16')](queryAgents));break;case _0x025b('0xa'):_0xa47061[_0x4edb56]('voice:inbound');_0xa47061[_0x4edb56](_0x025b('0x30'));_0x20d97e[_0x025b('0x34')](_0x296de2[_0x025b('0x3f')]({'attributes':['id',_0x025b('0x5')]}));_0x20d97e[_0x025b('0x34')](_0x296de2[_0x025b('0x40')]({'attributes':['id',_0x025b('0x5')]}));_0x20d97e[_0x025b('0x34')](_0x296de2[_0x025b('0x41')]({'attributes':['id',_0x025b('0x5')]}));_0x20d97e[_0x025b('0x34')](_0x296de2[_0x025b('0x42')]({'attributes':['id',_0x025b('0x5')]}));_0x20d97e[_0x025b('0x34')](_0x296de2[_0x025b('0x43')]({'attributes':['id','name']}));_0x20d97e['push'](_0x296de2['getOpenchannelQueues']({'attributes':['id','name']}));_0x20d97e[_0x025b('0x34')](_0x296de2[_0x025b('0x44')]({'attributes':['id',_0x025b('0x5')]}));break;}return BPromise[_0x025b('0x45')](_0x20d97e);}})[_0x025b('0xe')](function(_0x16c244){if(_0x16c244&&_0x16c244['length']){for(var _0x1a8ce0=0x0;_0x1a8ce0<_0x16c244[_0x025b('0x46')];_0x1a8ce0+=0x1){for(var _0x58a70f=0x0;_0x58a70f<_0x16c244[_0x1a8ce0][_0x025b('0x46')];_0x58a70f+=0x1){switch(_0x1a8ce0){case 0x0:joinOrLeaveQueues(_0xa47061,_0x4edb56,_0x025b('0x47'),_0x16c244[_0x1a8ce0][_0x58a70f]);break;case 0x1:joinOrLeaveQueues(_0xa47061,_0x4edb56,'chat',_0x16c244[_0x1a8ce0][_0x58a70f]);break;case 0x2:joinOrLeaveQueues(_0xa47061,_0x4edb56,_0x025b('0x48'),_0x16c244[_0x1a8ce0][_0x58a70f]);break;case 0x3:joinOrLeaveQueues(_0xa47061,_0x4edb56,_0x025b('0x49'),_0x16c244[_0x1a8ce0][_0x58a70f]);break;case 0x4:joinOrLeaveQueues(_0xa47061,_0x4edb56,_0x025b('0x4a'),_0x16c244[_0x1a8ce0][_0x58a70f]);break;case 0x5:joinOrLeaveQueues(_0xa47061,_0x4edb56,_0x025b('0x4b'),_0x16c244[_0x1a8ce0][_0x58a70f]);break;case 0x6:joinOrLeaveQueues(_0xa47061,_0x4edb56,_0x025b('0x4c'),_0x16c244[_0x1a8ce0][_0x58a70f]);break;case 0x7:_0xa47061[_0x4edb56](util['format'](_0x025b('0x4d'),_0x16c244[_0x1a8ce0][_0x58a70f][_0x025b('0x5')]));break;case 0x8:_0xa47061[_0x4edb56](util[_0x025b('0x1f')](_0x025b('0x4e'),_0x16c244[_0x1a8ce0][_0x58a70f]['name']));break;case 0x9:_0xa47061[_0x4edb56](util[_0x025b('0x1f')](_0x025b('0x4f'),_0x16c244[_0x1a8ce0][_0x58a70f][_0x025b('0xb')],_0x16c244[_0x1a8ce0][_0x58a70f][_0x025b('0x5')]));break;case 0xa:_0xa47061[_0x4edb56](util[_0x025b('0x1f')](_0x025b('0x20'),_0x16c244[_0x1a8ce0][_0x58a70f]['name']));break;}}}}})[_0x025b('0xe')](function(){if(_0x4edb56===_0x025b('0x50')){var _0x15c23f=_['map'](_0x2dd34b[_0x025b('0x26')],'id');return _0x2dd34b[_0x025b('0x51')](_0x15c23f)[_0x025b('0xe')](function(){for(var _0x4ca3fa=0x0;_0x4ca3fa<_0x15c23f['length'];_0x4ca3fa+=0x1){_0x1c65fc[_0x025b('0x52')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x15c23f[_0x4ca3fa]),'UserId':Number(_0x2dd34b['id'])});}});}})[_0x025b('0xe')](function(){if(_0x4edb56===_0x025b('0x50')){var _0x5a4554=_['map'](_0x2dd34b[_0x025b('0x53')],'id');return _0x2dd34b[_0x025b('0x54')](_0x5a4554)[_0x025b('0xe')](function(){for(var _0x193932=0x0;_0x193932<_0x5a4554['length'];_0x193932+=0x1){_0x1c65fc['emit'](_0x025b('0x55'),{'MailInteractionId':Number(_0x5a4554[_0x193932]),'UserId':Number(_0x2dd34b['id'])});}});}})[_0x025b('0xe')](function(){if(_0x4edb56===_0x025b('0x50')){var _0x1e09e2=_[_0x025b('0x1c')](_0x2dd34b[_0x025b('0x29')],'id');return _0x2dd34b[_0x025b('0x56')](_0x1e09e2)['then'](function(){for(var _0x23cc31=0x0;_0x23cc31<_0x1e09e2[_0x025b('0x46')];_0x23cc31+=0x1){_0x1c65fc['emit'](_0x025b('0x57'),{'FaxInteractionId':Number(_0x1e09e2[_0x23cc31]),'UserId':Number(_0x2dd34b['id'])});}});}})[_0x025b('0xe')](function(){if(_0x4edb56===_0x025b('0x50')){var _0x2a4ef6=_[_0x025b('0x1c')](_0x2dd34b[_0x025b('0x2b')],'id');return _0x2dd34b[_0x025b('0x58')](_0x2a4ef6)['then'](function(){for(var _0x47fddc=0x0;_0x47fddc<_0x2a4ef6['length'];_0x47fddc+=0x1){_0x1c65fc[_0x025b('0x52')](_0x025b('0x59'),{'SmsInteractionId':Number(_0x2a4ef6[_0x47fddc]),'UserId':Number(_0x2dd34b['id'])});}});}})[_0x025b('0xe')](function(){if(_0x4edb56===_0x025b('0x50')){var _0x4c6142=_['map'](_0x2dd34b[_0x025b('0x2c')],'id');return _0x2dd34b[_0x025b('0x5a')](_0x4c6142)[_0x025b('0xe')](function(){for(var _0x595e2e=0x0;_0x595e2e<_0x4c6142[_0x025b('0x46')];_0x595e2e+=0x1){_0x1c65fc[_0x025b('0x52')](_0x025b('0x5b'),{'OpenchannelInteractionId':Number(_0x4c6142[_0x595e2e]),'UserId':Number(_0x2dd34b['id'])});}});}})[_0x025b('0xe')](function(){if(_0x4edb56===_0x025b('0x50')){var _0x3b688f=_[_0x025b('0x1c')](_0x2dd34b['WhatsappInteractions'],'id');return _0x2dd34b['removeWhatsappInteractions'](_0x3b688f)['then'](function(){for(var _0x9ca7b6=0x0;_0x9ca7b6<_0x3b688f[_0x025b('0x46')];_0x9ca7b6+=0x1){_0x1c65fc['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x3b688f[_0x9ca7b6]),'UserId':Number(_0x2dd34b['id'])});}});}})[_0x025b('0x5c')](function(_0x552ff0){_0xa47061['log'](_0x552ff0);});}}function onDisconnect(_0xbb4997,_0x3390d1){joinOrLeave(_0xbb4997,_0x025b('0x50'),_0x3390d1);}function onConnect(_0x4e42bb){joinOrLeave(_0x4e42bb,'join');}exports[_0x025b('0x5d')]=function(_0x1cc3d5){_0x1cc3d5['on'](_0x025b('0x5e'),function(_0x4d6fe3){_0x4d6fe3[_0x025b('0x5f')](0x0);_0x4d6fe3[_0x025b('0x60')]=_0x4d6fe3[_0x025b('0x61')][_0x025b('0x5e')][_0x025b('0x62')]+':'+_0x4d6fe3[_0x025b('0x61')][_0x025b('0x5e')][_0x025b('0x63')];_0x4d6fe3['connectedAt']=new Date();_0x4d6fe3[_0x025b('0x64')]=function(_0x570694){console['log']('SocketIO\x20'+_0x4d6fe3[_0x025b('0x65')][_0x025b('0x5')]+'['+_0x4d6fe3[_0x025b('0x60')]+']',_0x570694);};_0x4d6fe3['on'](_0x025b('0x66'),function(){onDisconnect(_0x4d6fe3,_0x1cc3d5);_0x4d6fe3[_0x025b('0x64')](_0x025b('0x67'));});onConnect(_0x4d6fe3);_0x4d6fe3[_0x025b('0x64')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 8d9d2e3..3c35127 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 _0x4af7=['util','../../mysqldb','jayson/promise','../logger','triggers','http','Chat','ChatInteraction','closedinteraction','ChatMessage','afterCreate','newmessage','Sms','SmsInteraction','newinteraction','afterUpdate','Whatsapp','WhatsappMessage','FaxInteraction','FaxMessage','Mail','MailMessage','Openchannel','OpenchannelInteraction','request','EventManager','then','info','code','error','Trigger,\x20%s','catch','get','direction','UserId','User','name','interface','format','SIP/%s','channel','incomingmessage','outgoingmessage','event','opened','closed','default','length','model','callback','toLowerCase','condition'];(function(_0x1002c0,_0x44ec11){var _0x37527f=function(_0x559d5c){while(--_0x559d5c){_0x1002c0['push'](_0x1002c0['shift']());}};_0x37527f(++_0x44ec11);}(_0x4af7,0x104));var _0x74af=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x4af7[_0x18ab2a];return _0x16dcee;};'use strict';var util=require(_0x74af('0x0'));var db=require(_0x74af('0x1'))['db'];var jayson=require(_0x74af('0x2'));var logger=require(_0x74af('0x3'))(_0x74af('0x4'));var client=jayson['client'][_0x74af('0x5')]({'port':0x232a});var triggers=[{'channel':_0x74af('0x6'),'model':'ChatInteraction','event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x74af('0x6'),'model':_0x74af('0x7'),'event':'afterUpdate','condition':_0x74af('0x8'),'callback':afterUpdate},{'channel':_0x74af('0x6'),'model':_0x74af('0x9'),'event':_0x74af('0xa'),'condition':_0x74af('0xb'),'callback':afterCreateMessage},{'channel':_0x74af('0xc'),'model':_0x74af('0xd'),'event':_0x74af('0xa'),'condition':_0x74af('0xe'),'callback':afterCreate},{'channel':_0x74af('0xc'),'model':_0x74af('0xd'),'event':_0x74af('0xf'),'condition':_0x74af('0x8'),'callback':afterUpdate},{'channel':_0x74af('0xc'),'model':'SmsMessage','event':'afterCreate','condition':_0x74af('0xb'),'callback':afterCreateMessage},{'channel':_0x74af('0x10'),'model':'WhatsappInteraction','event':_0x74af('0xa'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x74af('0x10'),'model':'WhatsappInteraction','event':_0x74af('0xf'),'condition':_0x74af('0x8'),'callback':afterUpdate},{'channel':_0x74af('0x10'),'model':_0x74af('0x11'),'event':_0x74af('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Fax','model':_0x74af('0x12'),'event':'afterCreate','condition':_0x74af('0xe'),'callback':afterCreate},{'channel':'Fax','model':_0x74af('0x12'),'event':_0x74af('0xf'),'condition':_0x74af('0x8'),'callback':afterUpdate},{'channel':'Fax','model':_0x74af('0x13'),'event':_0x74af('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x74af('0x14'),'model':'MailInteraction','event':_0x74af('0xa'),'condition':_0x74af('0xe'),'callback':afterCreate},{'channel':_0x74af('0x14'),'model':'MailInteraction','event':_0x74af('0xf'),'condition':_0x74af('0x8'),'callback':afterUpdate},{'channel':_0x74af('0x14'),'model':_0x74af('0x15'),'event':_0x74af('0xa'),'condition':_0x74af('0xb'),'callback':afterCreateMessage},{'channel':_0x74af('0x16'),'model':_0x74af('0x17'),'event':_0x74af('0xa'),'condition':_0x74af('0xe'),'callback':afterCreate},{'channel':_0x74af('0x16'),'model':_0x74af('0x17'),'event':_0x74af('0xf'),'condition':_0x74af('0x8'),'callback':afterUpdate},{'channel':_0x74af('0x16'),'model':'OpenchannelMessage','event':_0x74af('0xa'),'condition':_0x74af('0xb'),'callback':afterCreateMessage}];function request(_0x1286f1){return client[_0x74af('0x18')](_0x74af('0x19'),_0x1286f1)[_0x74af('0x1a')](function(_0x318553){logger[_0x74af('0x1b')]('Trigger,\x20%s',_0x74af('0x19'),_0x318553);if(_0x318553['error']){if(_0x318553['error'][_0x74af('0x1c')]===0x1f4){logger[_0x74af('0x1d')](_0x74af('0x1e'),_0x74af('0x19'),_0x318553[_0x74af('0x1d')]);}}})[_0x74af('0x1f')](function(_0x5d0e09){logger[_0x74af('0x1d')](_0x74af('0x1e'),'EventManager',_0x5d0e09);});}function afterCreateMessage(_0x44b433,_0x530944){return function(_0x2c32c1,_0x1285b2){_0x2c32c1=_0x2c32c1[_0x74af('0x20')]({'plain':!![]});_0x2c32c1['channel']=_0x44b433;_0x2c32c1['event']=_0x2c32c1[_0x74af('0x21')];if(_0x2c32c1[_0x74af('0x22')]){return db[_0x74af('0x23')]['find']({'where':{'id':_0x2c32c1[_0x74af('0x22')]},'attributes':['id',_0x74af('0x24')],'raw':!![]})[_0x74af('0x1a')](function(_0x491069){_0x2c32c1[_0x74af('0x25')]=util[_0x74af('0x26')](_0x74af('0x27'),_0x491069['name']);_0x2c32c1[_0x74af('0x28')]=_0x44b433;return request({'event':_0x74af('0x29'),'message':_0x2c32c1});})['catch'](function(_0x2c73c7){console[_0x74af('0x1d')](_0x2c73c7);});}else{return request({'event':_0x74af('0x2a'),'message':_0x2c32c1});}};}function afterCreate(_0x117d53,_0x43708a){return function(_0x4f0f21,_0x5e321d){_0x4f0f21=_0x4f0f21[_0x74af('0x20')]({'plain':!![]});_0x4f0f21[_0x74af('0x28')]=_0x117d53;_0x4f0f21[_0x74af('0x2b')]=_0x74af('0x2c');return request({'event':_0x43708a,'message':_0x4f0f21});};}function afterUpdate(_0x2e25e2,_0x5c1997){return function(_0x3cf2a1,_0x1c899e){if(_0x3cf2a1['changed'](_0x74af('0x2d'))&&_0x3cf2a1[_0x74af('0x2d')]){_0x3cf2a1=_0x3cf2a1[_0x74af('0x20')]({'plain':!![]});_0x3cf2a1[_0x74af('0x28')]=_0x2e25e2;_0x3cf2a1[_0x74af('0x2b')]=_0x74af('0x2d');if(_0x3cf2a1['UserId']){return db['User']['find']({'where':{'id':_0x3cf2a1['UserId']},'attributes':['id',_0x74af('0x24')],'raw':!![]})[_0x74af('0x1a')](function(_0xf49b7b){_0x3cf2a1[_0x74af('0x25')]=util[_0x74af('0x26')](_0x74af('0x27'),_0xf49b7b['name']);return request({'event':_0x5c1997,'message':_0x3cf2a1});})[_0x74af('0x1f')](function(_0x217d50){console[_0x74af('0x1d')](_0x217d50);});}else{return request({'event':_0x5c1997,'message':_0x3cf2a1});}}};}exports[_0x74af('0x2e')]=function(){for(var _0x802a43=0x0;_0x802a43=_0x22543e['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x1f42f0(_0x4479ac);})[_0x7da6('0x14')](function(_0x480dd1){_0x3b2a31(_0x480dd1);});});}; \ No newline at end of file +var _0xc8e3=['isValidChannel','toLowerCase','includes','isUndefined','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','../mysqldb','./license/util','voice','chat','fax','sms','openchannel','getChannels'];(function(_0x5146a1,_0x5027bb){var _0x32629c=function(_0x850e53){while(--_0x850e53){_0x5146a1['push'](_0x5146a1['shift']());}};_0x32629c(++_0x5027bb);}(_0xc8e3,0x183));var _0x3c8e=function(_0x148551,_0x21f6f6){_0x148551=_0x148551-0x0;var _0xde403d=_0xc8e3[_0x148551];return _0xde403d;};'use strict';var _=require(_0x3c8e('0x0'));var BPromise=require('bluebird');var db=require(_0x3c8e('0x1'))['db'];var util=require(_0x3c8e('0x2'));var channels=[_0x3c8e('0x3'),'mail',_0x3c8e('0x4'),_0x3c8e('0x5'),_0x3c8e('0x6'),'whatsapp',_0x3c8e('0x7')];exports[_0x3c8e('0x8')]=function(){return channels;};exports[_0x3c8e('0x9')]=function(_0x153229){_0x153229=_0x153229[_0x3c8e('0xa')]();return _[_0x3c8e('0xb')](channels,_0x153229);};exports['clearBlockUser']=function(_0x1c3d22,_0x9c061f,_0x2eb0a7,_0x3c6a49){var _0x27200d={'loginAttempts':_0x9c061f,'blocked':_0x2eb0a7};if(!_[_0x3c8e('0xc')](_0x3c6a49)){_0x27200d['blockedAt']=_0x3c6a49;}return _0x1c3d22['updateAttributes'](_0x27200d);};exports[_0x3c8e('0xd')]=function(_0x328fd5){return new BPromise(function(_0x27e94a,_0x17b2b2){var _0xdf51be=0x0;if(_0x328fd5[_0x3c8e('0xe')]!==_0x3c8e('0xf')){_0x27e94a(_0x328fd5);}db[_0x3c8e('0x10')][_0x3c8e('0x11')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x328fd5['id']}}})[_0x3c8e('0x12')](function(_0x138db2){_0xdf51be=_0x138db2;return util[_0x3c8e('0xd')]();})[_0x3c8e('0x12')](function(_0xeb2d0b){if(_0xeb2d0b&&_0xeb2d0b[_0x3c8e('0x13')]&&_0xdf51be>=_0xeb2d0b[_0x3c8e('0x13')]){throw Error(_0x3c8e('0x14'));}_0x27e94a(_0x328fd5);})[_0x3c8e('0x15')](function(_0x289227){_0x17b2b2(_0x289227);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 24519f3..9360490 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c2f=['json','send','exports','status'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c2f,0x17a));var _0xf8c2=function(_0x5189d6,_0x557268){_0x5189d6=_0x5189d6-0x0;var _0xb04855=_0x8c2f[_0x5189d6];return _0xb04855;};'use strict';module[_0xf8c2('0x0')][0x194]=function pageNotFound(_0x144e25,_0x5ca8f0){var _0xc70d50='404';var _0x194fc7=0x194;var _0x3be60b={'status':_0x194fc7};_0x5ca8f0[_0xf8c2('0x1')](_0x3be60b[_0xf8c2('0x1')]);_0x5ca8f0['render'](_0xc70d50,{},function(_0x29412d,_0x436a34){if(_0x29412d){return _0x5ca8f0[_0xf8c2('0x1')](_0x3be60b['status'])[_0xf8c2('0x2')](_0x3be60b);}_0x5ca8f0[_0xf8c2('0x3')](_0x436a34);});}; \ No newline at end of file +var _0xdb0a=['404','status','render','json','send','exports'];(function(_0xf73390,_0x14c109){var _0x4b212f=function(_0x3e2b63){while(--_0x3e2b63){_0xf73390['push'](_0xf73390['shift']());}};_0x4b212f(++_0x14c109);}(_0xdb0a,0xe9));var _0xadb0=function(_0x4a88c7,_0x7ae69e){_0x4a88c7=_0x4a88c7-0x0;var _0x54f3c2=_0xdb0a[_0x4a88c7];return _0x54f3c2;};'use strict';module[_0xadb0('0x0')][0x194]=function pageNotFound(_0x114fcb,_0x4648a8){var _0x1cbe94=_0xadb0('0x1');var _0x1984bb=0x194;var _0x508da7={'status':_0x1984bb};_0x4648a8[_0xadb0('0x2')](_0x508da7[_0xadb0('0x2')]);_0x4648a8[_0xadb0('0x3')](_0x1cbe94,{},function(_0x11033c,_0x353d11){if(_0x11033c){return _0x4648a8['status'](_0x508da7[_0xadb0('0x2')])[_0xadb0('0x4')](_0x508da7);}_0x4648a8[_0xadb0('0x5')](_0x353d11);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 91cbab7..5ee9f7d 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9172=['../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/cmCompany/cmCompany.model','CmContact','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','../api/tag/tag.model','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappQueue/whatsappQueue.model','hasOne','cascade','UserId','User','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','ReportAgentPreview','ChatInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','Notifications','SenderId','UserNotification','UserNotifications','belongsTo','belongsToMany','ChatGroup','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_fax_interactions','SmsInteraction','user_has_sms_interactions','OpenchannelInteraction','OpenchannelInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','MailQueues','ChatQueues','FaxQueues','SmsQueue','SmsQueues','OpenchannelQueues','WhatsappQueue','UserWhatsappQueue','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','FaxAccounts','user_has_fax_accounts','MailAccounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','SpiedAgents','ChanSpyId','VoiceContext','Sounds','moh_has_sounds','VoiceQueue','UserVoiceQueueRt','Members','VoiceQueueId','Hoppers','HopperHistories','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','CmList','voice_queues_has_cm_lists','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','VoiceCallReport','VoiceQueueReport','QueueCalls','VoiceAgentReport','AgentReports','Contact','ContactId','MailServerOut','Imap','Smtp','Dispositions','Answers','MailAccountId','Applications','ListId','TemplateId','mandatoryDispositionPause','Agents','user_has_mail_accounts','team_has_mail_queues','Account','Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','restrict','TagId','List','Items','FaxAccountId','Interactions','Exntensions','FaxApplication','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsApplication','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','Interaction','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatQueueId','Website','chat_interaction_has_tags','user_has_chat_interactions','ChatInteractionId','team_has_chat_queues','ChatGroupId','CmCompany','Company','CompanyId','cm_contact_has_tags','CampaignId','OwnerId','All','AutomationAllId','Any','OneAny','AutomationAnyId','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','SmsApplications','AnalyticCustomReport','CustomReportId','Mohs','whatsapp_interaction_has_tags','Trigger','AllCondition','TriggerAllId','AnyCondition','TriggerAnyId','Actions','TriggerId','DefaultReportId','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','DescriptionId','FieldId','Subject','Description','Field','VariableId','SugarcrmAccount','SugarcrmConfiguration','Descriptions','DeskAccount','int_desk_configuration_has_tags','ZendeskField','int_freshdesk_configuration_has_tags','ServicenowConfiguration','Dynamics365Configuration','Dynamics365Field','Dynamics365Account','FromId','JscriptyQuestionReport','SessionId','ProjectId','user_has_square_projects','team_has_voice_queues','team_has_whatsapp_queues','WhatsappQueues','HopperBlacks','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','ToAgent','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','FromAgent','ToUserId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','userProfileId','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappApplication','WhatsappInteractionId','WhatsappQueueReport','WhatsappTransferReport','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','lodash','jstz','sequelize','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','database','username','options','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model'];(function(_0x1e1319,_0x4e40d1){var _0x591ef0=function(_0x265c16){while(--_0x265c16){_0x1e1319['push'](_0x1e1319['shift']());}};_0x591ef0(++_0x4e40d1);}(_0x9172,0x1a5));var _0x2917=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x9172[_0x4c12ec];return _0x3ae42c;};'use strict';var path=require('path');var config=require('../config/environment');var Sequelize=require('sequelize');var _=require(_0x2917('0x0'));var jstz=require(_0x2917('0x1'));var timezone=jstz['determine']();config[_0x2917('0x2')]=_['defaultsDeep'](config[_0x2917('0x2')],{'database':_0x2917('0x3'),'username':_0x2917('0x4'),'password':_0x2917('0x5'),'options':{'host':_0x2917('0x6'),'port':0xcea,'dialect':_0x2917('0x7'),'dialectOptions':{'charset':_0x2917('0x8')},'logging':![],'timezone':timezone[_0x2917('0x9')](),'define':{'charset':_0x2917('0xa'),'collate':_0x2917('0xb')}}});config[_0x2917('0xc')]=_[_0x2917('0xd')](config['sequelizeHistory'],{'database':_0x2917('0x3'),'username':'xcall','password':_0x2917('0x5'),'options':{'host':_0x2917('0x6'),'port':0xcea,'dialect':_0x2917('0x7'),'dialectOptions':{'charset':_0x2917('0x8')},'logging':![],'timezone':timezone[_0x2917('0x9')](),'define':{'charset':_0x2917('0xa'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2917('0x2')][_0x2917('0xe')],config[_0x2917('0x2')][_0x2917('0xf')],config[_0x2917('0x2')]['password'],config[_0x2917('0x2')][_0x2917('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x2917('0xe')],config[_0x2917('0xc')][_0x2917('0xf')],config[_0x2917('0xc')]['password'],config[_0x2917('0xc')][_0x2917('0x10')])};db['User']=db['sequelize'][_0x2917('0x11')](_0x2917('0x12'));db[_0x2917('0x13')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x14'));db['VoiceContext']=db[_0x2917('0x2')][_0x2917('0x11')]('../api/voiceContext/voiceContext.model');db[_0x2917('0x15')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x16'));db[_0x2917('0x17')]=db['sequelize'][_0x2917('0x11')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db['VoiceQueue']=db['sequelize']['import']('../api/voiceQueue/voiceQueue.model');db[_0x2917('0x18')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/voiceRecording/voiceRecording.model');db[_0x2917('0x19')]=db[_0x2917('0x2')]['import'](_0x2917('0x1a'));db[_0x2917('0x1b')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x1c'));db[_0x2917('0x1d')]=db[_0x2917('0x2')]['import'](_0x2917('0x1e'));db['VoiceCallReport']=db[_0x2917('0x2')]['import'](_0x2917('0x1f'));db[_0x2917('0x20')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x21'));db['VoiceAgentReport']=db[_0x2917('0x2')]['import'](_0x2917('0x22'));db['VoiceQueueReport']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x23'));db[_0x2917('0x24')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/memberReport/memberReport.model');db['Trunk']=db['sequelize'][_0x2917('0x11')](_0x2917('0x25'));db[_0x2917('0x26')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x27'));db['UserVoiceQueueRt']=db['sequelize'][_0x2917('0x11')](_0x2917('0x28'));db[_0x2917('0x29')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x2917('0x2a')]=db['sequelize'][_0x2917('0x11')](_0x2917('0x2b'));db['UserMailQueue']=db['sequelize'][_0x2917('0x11')](_0x2917('0x2c'));db[_0x2917('0x2d')]=db[_0x2917('0x2')]['import'](_0x2917('0x2e'));db[_0x2917('0x2f')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x30'));db[_0x2917('0x31')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x32'));db['UserWhatsappQueue']=db[_0x2917('0x2')]['import']('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x2917('0x33')]=db['sequelize']['import'](_0x2917('0x34'));db['MailServerOut']=db[_0x2917('0x2')]['import'](_0x2917('0x35'));db[_0x2917('0x36')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x37'));db[_0x2917('0x38')]=db['sequelize'][_0x2917('0x11')]('../api/mailQueue/mailQueue.model');db[_0x2917('0x39')]=db['sequelize'][_0x2917('0x11')](_0x2917('0x3a'));db[_0x2917('0x3b')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x3c'));db[_0x2917('0x3d')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x3e'));db[_0x2917('0x3f')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/mailApplication/mailApplication.model');db[_0x2917('0x40')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x41'));db[_0x2917('0x42')]=db['sequelize'][_0x2917('0x11')](_0x2917('0x43'));db[_0x2917('0x44')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x45'));db[_0x2917('0x46')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x47'));db['FaxApplication']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x48'));db['FaxInteraction']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x49'));db[_0x2917('0x4a')]=db['sequelize'][_0x2917('0x11')]('../api/faxMessage/faxMessage.model');db[_0x2917('0x4b')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/faxQueue/faxQueue.model');db[_0x2917('0x4c')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x4d'));db[_0x2917('0x4e')]=db['sequelize'][_0x2917('0x11')](_0x2917('0x4f'));db['SmsApplication']=db['sequelize']['import'](_0x2917('0x50'));db['SmsInteraction']=db[_0x2917('0x2')][_0x2917('0x11')]('../api/smsInteraction/smsInteraction.model');db[_0x2917('0x51')]=db['sequelize'][_0x2917('0x11')](_0x2917('0x52'));db['SmsQueue']=db[_0x2917('0x2')][_0x2917('0x11')]('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db['sequelize'][_0x2917('0x11')]('../api/openchannelAccount/openchannelAccount.model');db['OpenchannelApplication']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x53'));db['OpenchannelInteraction']=db[_0x2917('0x2')]['import'](_0x2917('0x54'));db[_0x2917('0x55')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/openchannelMessage/openchannelMessage.model');db[_0x2917('0x56')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x57'));db[_0x2917('0x58')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/chatWebsite/chatWebsite.model');db[_0x2917('0x59')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x5a'));db[_0x2917('0x5b')]=db[_0x2917('0x2')]['import'](_0x2917('0x5c'));db[_0x2917('0x5d')]=db['sequelize'][_0x2917('0x11')]('../api/chatInteraction/chatInteraction.model');db[_0x2917('0x5e')]=db['sequelize']['import'](_0x2917('0x5f'));db[_0x2917('0x60')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x61'));db[_0x2917('0x62')]=db['sequelize'][_0x2917('0x11')](_0x2917('0x63'));db['ChatGroup']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x64'));db[_0x2917('0x65')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/chatProactiveAction/chatProactiveAction.model');db['CmCompany']=db['sequelize'][_0x2917('0x11')](_0x2917('0x66'));db[_0x2917('0x67')]=db[_0x2917('0x2')]['import']('../api/cmContact/cmContact.model');db[_0x2917('0x68')]=db['sequelize'][_0x2917('0x11')]('../api/cmHopper/cmHopper.model');db[_0x2917('0x69')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x6a'));db[_0x2917('0x6b')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x6c'));db[_0x2917('0x6d')]=db[_0x2917('0x2')]['import'](_0x2917('0x6e'));db['ReportAgentPreview']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x6f'));db[_0x2917('0x70')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/cmCustomField/cmCustomField.model');db[_0x2917('0x71')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x72'));db[_0x2917('0x73')]=db['sequelize'][_0x2917('0x11')]('../api/automation/automation.model');db[_0x2917('0x74')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x75'));db[_0x2917('0x76')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x77'));db[_0x2917('0x78')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/condition/condition.model');db[_0x2917('0x79')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x7a'));db[_0x2917('0x7b')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x7c'));db[_0x2917('0x7d')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x7e'));db['VoiceQueuesLog']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x7f'));db[_0x2917('0x80')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x81'));db[_0x2917('0x82')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x83'));db['Tag']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x84'));db[_0x2917('0x85')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x86'));db['Trigger']=db[_0x2917('0x2')]['import'](_0x2917('0x87'));db[_0x2917('0x88')]=db[_0x2917('0x2')]['import']('../api/variable/variable.model');db['Integration']=db[_0x2917('0x2')][_0x2917('0x11')]('../api/integration/integration.model');db[_0x2917('0x89')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x8a'));db['AnalyticCustomReport']=db[_0x2917('0x2')][_0x2917('0x11')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x2917('0x8b')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x8c'));db[_0x2917('0x8d')]=db['sequelize'][_0x2917('0x11')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db[_0x2917('0x2')]['import'](_0x2917('0x8e'));db[_0x2917('0x8f')]=db['sequelize'][_0x2917('0x11')](_0x2917('0x90'));db[_0x2917('0x91')]=db[_0x2917('0x2')]['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0x2917('0x92')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x93'));db[_0x2917('0x94')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x2917('0x95')]=db[_0x2917('0x2')]['import'](_0x2917('0x96'));db['SugarcrmAccount']=db[_0x2917('0x2')]['import'](_0x2917('0x97'));db['SugarcrmConfiguration']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x98'));db[_0x2917('0x99')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x9a'));db['DeskAccount']=db[_0x2917('0x2')]['import'](_0x2917('0x9b'));db[_0x2917('0x9c')]=db[_0x2917('0x2')]['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x2917('0x9d')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/intDeskField/intDeskField.model');db[_0x2917('0x9e')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0x9f'));db[_0x2917('0xa0')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xa1'));db[_0x2917('0xa2')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xa3'));db[_0x2917('0xa4')]=db[_0x2917('0x2')]['import'](_0x2917('0xa5'));db[_0x2917('0xa6')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xa7'));db['ZendeskField']=db[_0x2917('0x2')][_0x2917('0x11')]('../api/intZendeskField/intZendeskField.model');db[_0x2917('0xa8')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xa9'));db[_0x2917('0xaa')]=db['sequelize']['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x2917('0xab')]=db[_0x2917('0x2')]['import'](_0x2917('0xac'));db[_0x2917('0xad')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xae'));db[_0x2917('0xaf')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x2917('0xb0')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xb1'));db[_0x2917('0xb2')]=db[_0x2917('0x2')]['import'](_0x2917('0xb3'));db['ServicenowConfiguration']=db[_0x2917('0x2')]['import'](_0x2917('0xb4'));db[_0x2917('0xb5')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xb6'));db['Dynamics365Account']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xb7'));db['Dynamics365Configuration']=db[_0x2917('0x2')]['import'](_0x2917('0xb8'));db['Dynamics365Field']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xb9'));db[_0x2917('0xba')]=db[_0x2917('0x2')]['import'](_0x2917('0xbb'));db[_0x2917('0xbc')]=db['sequelize']['import']('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x2917('0xbd')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xbe'));db['Integration']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xbf'));db[_0x2917('0xc0')]=db[_0x2917('0x2')]['import'](_0x2917('0xc1'));db[_0x2917('0xc2')]=db['sequelize'][_0x2917('0x11')](_0x2917('0xc3'));db[_0x2917('0xc4')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xc5'));db[_0x2917('0xc6')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xc7'));db['JscriptyQuestionReport']=db[_0x2917('0x2')][_0x2917('0x11')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x2917('0xc8')]=db['sequelize'][_0x2917('0x11')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x2917('0xc9')]=db['sequelize'][_0x2917('0x11')](_0x2917('0xca'));db[_0x2917('0xcb')]=db['sequelize'][_0x2917('0x11')](_0x2917('0xcc'));db[_0x2917('0xcd')]=db[_0x2917('0x2')]['import'](_0x2917('0xce'));db[_0x2917('0xcf')]=db[_0x2917('0x2')]['import'](_0x2917('0xd0'));db['Setting']=db['sequelize'][_0x2917('0x11')](_0x2917('0xd1'));db[_0x2917('0xd2')]=db['sequelize'][_0x2917('0x11')](_0x2917('0xd3'));db[_0x2917('0xd4')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/squareProject/squareProject.model');db['SquareRecording']=db[_0x2917('0x2')]['import'](_0x2917('0xd5'));db[_0x2917('0xd6')]=db['sequelize']['import']('../api/squareMessage/squareMessage.model');db[_0x2917('0xd7')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xd8'));db[_0x2917('0xd9')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/license/license.model');db[_0x2917('0xda')]=db[_0x2917('0x2')]['import'](_0x2917('0xdb'));db[_0x2917('0xdc')]=db[_0x2917('0x2')]['import']('../api/migration/migration.model');db[_0x2917('0xdd')]=db['sequelize'][_0x2917('0x11')](_0x2917('0xde'));db['Plugin']=db[_0x2917('0x2')][_0x2917('0x11')]('../api/plugin/plugin.model');db[_0x2917('0xdf')]=db['sequelize']['import'](_0x2917('0xe0'));db[_0x2917('0xe1')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xe2'));db[_0x2917('0xe3')]=db[_0x2917('0x2')]['import']('../api/faxTransferReport/faxTransferReport.model');db[_0x2917('0xe4')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xe5'));db[_0x2917('0xe6')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xe7'));db['CmList']=db[_0x2917('0x2')][_0x2917('0x11')]('../api/cmList/cmList.model');db[_0x2917('0xe8')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/voicePrefix/voicePrefix.model');db[_0x2917('0xe9')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/userProfile/userProfile.model');db[_0x2917('0xea')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/userProfileSection/userProfileSection.model');db[_0x2917('0xeb')]=db['sequelize'][_0x2917('0x11')](_0x2917('0xec'));db[_0x2917('0xed')]=db[_0x2917('0x2')][_0x2917('0x11')]('../api/notification/notification.model');db['UserNotification']=db['sequelize'][_0x2917('0x11')](_0x2917('0xee'));db[_0x2917('0xef')]=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xf0'));db['WhatsappApplication']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xf1'));db[_0x2917('0xf2')]=db['sequelize']['import']('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db[_0x2917('0x2')]['import'](_0x2917('0xf3'));db['WhatsappQueueReport']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xf4'));db['WhatsappTransferReport']=db['sequelize']['import']('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db[_0x2917('0x2')][_0x2917('0x11')](_0x2917('0xf5'));db['CloudProvider']=db[_0x2917('0x2')][_0x2917('0x11')]('../api/cloudProvider/cloudProvider.model');db['User'][_0x2917('0xf6')](db['VoiceMail'],{'as':_0x2917('0x1b'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0xf8')});db[_0x2917('0xf9')][_0x2917('0xfa')](db[_0x2917('0x18')],{'as':_0x2917('0xfb'),'foreignKey':_0x2917('0xf8')});db[_0x2917('0xf9')][_0x2917('0xfa')](db['UserVoiceQueueRt'],{'as':_0x2917('0xfc'),'foreignKey':_0x2917('0xf8')});db[_0x2917('0xf9')][_0x2917('0xfa')](db[_0x2917('0x15')],{'as':_0x2917('0xfd'),'onDelete':_0x2917('0xf7'),'hooks':!![]});db['User']['hasMany'](db[_0x2917('0x6b')],{'as':_0x2917('0xfe'),'foreignKey':_0x2917('0xf8')});db[_0x2917('0xf9')][_0x2917('0xfa')](db[_0x2917('0x6d')],{'as':_0x2917('0xff'),'foreignKey':_0x2917('0xf8')});db[_0x2917('0xf9')][_0x2917('0xfa')](db['ReportAgentPreview'],{'as':_0x2917('0x100'),'foreignKey':'UserId'});db['User']['hasMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0x2917('0xf8')});db['User'][_0x2917('0xfa')](db[_0x2917('0x5d')],{'as':_0x2917('0x101'),'foreignKey':_0x2917('0xf8')});db['User'][_0x2917('0xfa')](db['SmsInteraction'],{'as':_0x2917('0x102'),'foreignKey':_0x2917('0xf8')});db[_0x2917('0xf9')][_0x2917('0xfa')](db[_0x2917('0x103')],{'as':_0x2917('0x104'),'foreignKey':'UserId'});db[_0x2917('0xf9')][_0x2917('0xfa')](db[_0x2917('0x3b')],{'as':_0x2917('0x105'),'foreignKey':_0x2917('0xf8')});db[_0x2917('0xf9')][_0x2917('0xfa')](db['WhatsappInteraction'],{'as':_0x2917('0x106'),'foreignKey':_0x2917('0xf8')});db[_0x2917('0xf9')][_0x2917('0xfa')](db[_0x2917('0xed')],{'as':_0x2917('0x107'),'foreignKey':_0x2917('0x108')});db[_0x2917('0xf9')][_0x2917('0xfa')](db[_0x2917('0x109')],{'as':_0x2917('0x10a'),'foreignKey':_0x2917('0x108')});db['User'][_0x2917('0x10b')](db[_0x2917('0xe9')],{'as':_0x2917('0xe9'),'foreignKey':'userProfileId'});db[_0x2917('0xf9')][_0x2917('0x10c')](db[_0x2917('0x10d')],{'as':_0x2917('0x10e'),'through':_0x2917('0x10f')});db['User'][_0x2917('0x10c')](db[_0x2917('0x67')],{'as':_0x2917('0x110'),'through':_0x2917('0x111')});db[_0x2917('0xf9')]['belongsToMany'](db['CmList'],{'as':_0x2917('0x112'),'through':_0x2917('0x113')});db[_0x2917('0xf9')][_0x2917('0x10c')](db[_0x2917('0xd7')],{'through':_0x2917('0x114')});db['User']['belongsToMany'](db[_0x2917('0x3b')],{'as':_0x2917('0x105'),'through':_0x2917('0x115')});db[_0x2917('0xf9')]['belongsToMany'](db['ChatInteraction'],{'as':'ChatInteractions','through':'user_has_chat_interactions'});db[_0x2917('0xf9')]['belongsToMany'](db[_0x2917('0x103')],{'as':_0x2917('0x104'),'through':_0x2917('0x116')});db[_0x2917('0xf9')][_0x2917('0x10c')](db[_0x2917('0x117')],{'as':_0x2917('0x102'),'through':_0x2917('0x118')});db['User']['belongsToMany'](db[_0x2917('0x119')],{'as':_0x2917('0x11a'),'through':_0x2917('0x11b')});db[_0x2917('0xf9')][_0x2917('0x10c')](db[_0x2917('0xf2')],{'as':_0x2917('0x106'),'through':_0x2917('0x11c')});db[_0x2917('0xf9')][_0x2917('0x10c')](db['VoiceQueue'],{'as':'VoiceQueues','through':_0x2917('0x29'),'required':![]});db[_0x2917('0xf9')][_0x2917('0x10c')](db['MailQueue'],{'as':_0x2917('0x11d'),'through':'UserMailQueue','required':![]});db[_0x2917('0xf9')][_0x2917('0x10c')](db['ChatQueue'],{'as':_0x2917('0x11e'),'through':_0x2917('0x2a'),'required':![],'hooks':!![]});db[_0x2917('0xf9')][_0x2917('0x10c')](db[_0x2917('0x4b')],{'as':_0x2917('0x11f'),'through':'UserFaxQueue','required':![]});db[_0x2917('0xf9')][_0x2917('0x10c')](db[_0x2917('0x120')],{'as':_0x2917('0x121'),'through':_0x2917('0x2f'),'required':![]});db[_0x2917('0xf9')][_0x2917('0x10c')](db['OpenchannelQueue'],{'as':_0x2917('0x122'),'through':_0x2917('0x31'),'required':![]});db[_0x2917('0xf9')][_0x2917('0x10c')](db[_0x2917('0x123')],{'as':'WhatsappQueues','through':_0x2917('0x124'),'required':![]});db['User'][_0x2917('0x10c')](db['CmList'],{'through':_0x2917('0x113')});db['User'][_0x2917('0x10c')](db[_0x2917('0xe8')],{'as':_0x2917('0x125'),'through':_0x2917('0x126'),'required':![]});db[_0x2917('0xf9')][_0x2917('0x10c')](db[_0x2917('0x58')],{'as':_0x2917('0x127'),'through':'user_has_chat_websites'});db[_0x2917('0xf9')][_0x2917('0x10c')](db[_0x2917('0x46')],{'as':_0x2917('0x128'),'through':_0x2917('0x129')});db[_0x2917('0xf9')][_0x2917('0x10c')](db[_0x2917('0x36')],{'as':_0x2917('0x12a'),'through':'user_has_mail_accounts'});db[_0x2917('0xf9')][_0x2917('0x10c')](db[_0x2917('0x12b')],{'as':_0x2917('0x12c'),'through':_0x2917('0x12d')});db['User'][_0x2917('0x10c')](db['SmsAccount'],{'as':_0x2917('0x12e'),'through':'user_has_sms_accounts'});db['User'][_0x2917('0x10c')](db[_0x2917('0xef')],{'as':_0x2917('0x12f'),'through':_0x2917('0x130')});db[_0x2917('0xf9')][_0x2917('0x10c')](db[_0x2917('0xd4')],{'as':_0x2917('0x131'),'through':'user_has_square_projects'});db['VoiceChanSpy']['hasMany'](db[_0x2917('0x15')],{'as':_0x2917('0x132'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x133')});db[_0x2917('0x134')][_0x2917('0xfa')](db['VoiceExtension'],{'onDelete':_0x2917('0xf7')});db[_0x2917('0x15')][_0x2917('0xfa')](db[_0x2917('0x15')],{'as':'Applications','onDelete':_0x2917('0xf7')});db[_0x2917('0x17')][_0x2917('0x10c')](db[_0x2917('0x82')],{'as':_0x2917('0x135'),'through':_0x2917('0x136')});db[_0x2917('0x137')]['hasMany'](db[_0x2917('0x138')],{'as':_0x2917('0x139'),'foreignKey':_0x2917('0x13a')});db[_0x2917('0x137')]['hasMany'](db[_0x2917('0x68')],{'as':_0x2917('0x13b'),'foreignKey':'VoiceQueueId'});db[_0x2917('0x137')][_0x2917('0xfa')](db[_0x2917('0x6b')],{'as':_0x2917('0xfe'),'foreignKey':_0x2917('0x13a')});db['VoiceQueue']['hasMany'](db[_0x2917('0x6d')],{'as':_0x2917('0x13c'),'foreignKey':'VoiceQueueId'});db[_0x2917('0x137')][_0x2917('0xfa')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'VoiceQueueId'});db[_0x2917('0x137')][_0x2917('0xfa')](db[_0x2917('0x69')],{'as':'HopperBlacks','foreignKey':_0x2917('0x13a')});db['VoiceQueue']['hasMany'](db['JscriptySessionReport'],{'as':_0x2917('0x13d'),'foreignKey':_0x2917('0x13a')});db['VoiceQueue']['belongsTo'](db[_0x2917('0x13e')],{'as':'Trunk','foreignKey':_0x2917('0x13f')});db[_0x2917('0x137')][_0x2917('0x10b')](db[_0x2917('0x13e')],{'as':_0x2917('0x140'),'foreignKey':_0x2917('0x141')});db[_0x2917('0x137')]['belongsTo'](db[_0x2917('0x79')],{'as':_0x2917('0x79'),'foreignKey':_0x2917('0x142')});db['VoiceQueue'][_0x2917('0x10b')](db[_0x2917('0x7b')],{'as':'mandatoryDispositionPause','foreignKey':_0x2917('0x143')});db['VoiceQueue']['belongsToMany'](db[_0x2917('0x144')],{'as':_0x2917('0x112'),'through':_0x2917('0x145')});db[_0x2917('0x137')][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':'Agents','through':_0x2917('0x29')});db[_0x2917('0x137')][_0x2917('0x10c')](db[_0x2917('0xd7')],{'as':_0x2917('0x146'),'through':'team_has_voice_queues'});db[_0x2917('0x137')][_0x2917('0x10c')](db['CmList'],{'as':_0x2917('0x147'),'through':_0x2917('0x148')});db[_0x2917('0x18')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'as':_0x2917('0xf9'),'foreignKey':_0x2917('0xf8')});db[_0x2917('0x19')][_0x2917('0x10b')](db['User'],{'as':'User','foreignKey':_0x2917('0xf8')});db['VoiceMail']['hasMany'](db[_0x2917('0x1d')],{'as':_0x2917('0x149'),'onDelete':_0x2917('0xf7'),'foreignKey':'mailboxuser','sourceKey':_0x2917('0x14a')});db[_0x2917('0x1d')][_0x2917('0x10b')](db[_0x2917('0x1b')],{'foreignKey':'mailboxuser','targetKey':_0x2917('0x14a')});db[_0x2917('0x14b')][_0x2917('0xfa')](db[_0x2917('0x14c')],{'as':_0x2917('0x14d'),'foreignKey':'uniqueid','constraints':![]});db[_0x2917('0x14b')][_0x2917('0xfa')](db[_0x2917('0x14e')],{'as':_0x2917('0x14f'),'foreignKey':'uniqueid','constraints':![]});db[_0x2917('0x14b')][_0x2917('0x10b')](db['User'],{'as':'User','foreignKey':_0x2917('0xf8')});db[_0x2917('0x14b')][_0x2917('0x10b')](db[_0x2917('0x67')],{'as':_0x2917('0x150'),'foreignKey':_0x2917('0x151')});db[_0x2917('0x33')][_0x2917('0x10b')](db[_0x2917('0x36')],{'as':_0x2917('0x36'),'foreignKey':'MailAccountId'});db[_0x2917('0x152')][_0x2917('0x10b')](db[_0x2917('0x36')],{'as':_0x2917('0x36'),'foreignKey':'MailAccountId'});db[_0x2917('0x36')][_0x2917('0xf6')](db[_0x2917('0x33')],{'as':_0x2917('0x153'),'onDelete':_0x2917('0xf7')});db[_0x2917('0x36')][_0x2917('0xf6')](db[_0x2917('0x152')],{'as':_0x2917('0x154'),'onDelete':'cascade'});db[_0x2917('0x36')][_0x2917('0xfa')](db[_0x2917('0x76')],{'as':_0x2917('0x155'),'foreignKey':'MailAccountId'});db[_0x2917('0x36')][_0x2917('0xfa')](db['CannedAnswer'],{'as':_0x2917('0x156'),'foreignKey':_0x2917('0x157')});db[_0x2917('0x36')][_0x2917('0xfa')](db[_0x2917('0x3d')],{'as':_0x2917('0x149'),'foreignKey':_0x2917('0x157')});db[_0x2917('0x36')][_0x2917('0xfa')](db[_0x2917('0x3b')],{'as':'Interactions'});db[_0x2917('0x36')]['hasMany'](db[_0x2917('0x3f')],{'as':_0x2917('0x158')});db[_0x2917('0x36')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x2917('0x159')});db[_0x2917('0x36')][_0x2917('0x10b')](db[_0x2917('0x85')],{'as':_0x2917('0x85'),'foreignKey':_0x2917('0x15a')});db[_0x2917('0x36')]['belongsTo'](db['Pause'],{'as':_0x2917('0x15b'),'foreignKey':_0x2917('0x143')});db[_0x2917('0x36')]['belongsToMany'](db[_0x2917('0xf9')],{'as':_0x2917('0x15c'),'through':_0x2917('0x15d')});db['MailQueue'][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':'Agents','through':'UserMailQueue'});db['MailQueue'][_0x2917('0x10c')](db['Team'],{'through':_0x2917('0x15e'),'as':_0x2917('0x146')});db[_0x2917('0x3b')][_0x2917('0xfa')](db['MailMessage'],{'as':_0x2917('0x149'),'onDelete':_0x2917('0xf7'),'foreignKey':'MailInteractionId'});db['MailInteraction'][_0x2917('0x10b')](db[_0x2917('0x36')],{'as':_0x2917('0x15f'),'foreignKey':'MailAccountId'});db[_0x2917('0x3b')][_0x2917('0x10b')](db[_0x2917('0x67')],{'as':_0x2917('0x150'),'foreignKey':'ContactId'});db['MailInteraction'][_0x2917('0x10b')](db[_0x2917('0xf9')],{'as':_0x2917('0x160'),'foreignKey':'UserId'});db['MailInteraction'][_0x2917('0x10c')](db[_0x2917('0x161')],{'through':_0x2917('0x162'),'as':_0x2917('0x163')});db['MailInteraction'][_0x2917('0x10c')](db[_0x2917('0x161')],{'through':'mail_interaction_has_tags','as':_0x2917('0x164')});db[_0x2917('0x3b')][_0x2917('0x10c')](db['User'],{'as':_0x2917('0x165'),'through':'user_has_mail_interactions','foreignKey':_0x2917('0x166')});db['MailMessage'][_0x2917('0xfa')](db['Attachment'],{'as':_0x2917('0x167'),'onDelete':_0x2917('0xf7')});db[_0x2917('0x3d')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'as':_0x2917('0xf9')});db[_0x2917('0x3d')]['belongsTo'](db['CmContact'],{'onDelete':_0x2917('0xf7'),'as':_0x2917('0x150')});db[_0x2917('0x3d')]['belongsTo'](db[_0x2917('0x3b')],{'as':'Interaction','foreignKey':_0x2917('0x166')});db['MailMessage'][_0x2917('0x10b')](db[_0x2917('0x36')],{'as':'Account','foreignKey':'MailAccountId'});db[_0x2917('0x3f')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'onDelete':_0x2917('0x168')});db['MailApplication'][_0x2917('0x10b')](db[_0x2917('0x38')],{'onDelete':_0x2917('0x168')});db[_0x2917('0x3f')]['belongsTo'](db[_0x2917('0x36')],{'onDelete':_0x2917('0x168')});db[_0x2917('0x3f')]['belongsTo'](db['Interval'],{'onDelete':_0x2917('0x168'),'foreignKey':'IntervalId'});db[_0x2917('0x3f')][_0x2917('0x10b')](db[_0x2917('0x161')],{'onDelete':_0x2917('0x168'),'foreignKey':_0x2917('0x169')});db[_0x2917('0x40')][_0x2917('0x10b')](db['MailAccount'],{});db[_0x2917('0x40')][_0x2917('0x10b')](db[_0x2917('0x144')],{'as':_0x2917('0x16a'),'foreignKey':_0x2917('0x159')});db[_0x2917('0x40')][_0x2917('0x10b')](db[_0x2917('0x67')],{'as':_0x2917('0x150'),'foreignKey':'ContactId'});db[_0x2917('0x40')][_0x2917('0x10b')](db[_0x2917('0x3b')],{});db[_0x2917('0x40')][_0x2917('0x10b')](db[_0x2917('0x3d')],{});db[_0x2917('0x40')][_0x2917('0x10b')](db[_0x2917('0xf9')],{});db['MailQueueReport'][_0x2917('0x10b')](db['MailQueue'],{});db[_0x2917('0x42')][_0x2917('0xfa')](db[_0x2917('0x44')],{'as':_0x2917('0x16b'),'onDelete':_0x2917('0xf7')});db['FaxAccount'][_0x2917('0xfa')](db['Disposition'],{'as':_0x2917('0x155'),'foreignKey':_0x2917('0x16c')});db[_0x2917('0x46')][_0x2917('0xfa')](db[_0x2917('0x74')],{'as':_0x2917('0x156'),'foreignKey':_0x2917('0x16c')});db[_0x2917('0x46')][_0x2917('0xfa')](db['FaxInteraction'],{'as':_0x2917('0x16d')});db[_0x2917('0x46')][_0x2917('0xfa')](db['FaxApplication'],{'as':'Applications'});db['FaxAccount'][_0x2917('0xfa')](db[_0x2917('0x15')],{'as':_0x2917('0x16e'),'onDelete':_0x2917('0xf7')});db['FaxAccount'][_0x2917('0xfa')](db[_0x2917('0x4a')],{'as':'Messages'});db[_0x2917('0x46')][_0x2917('0x10b')](db['Trunk'],{'as':_0x2917('0x13e')});db['FaxAccount']['belongsTo'](db[_0x2917('0x144')],{'as':_0x2917('0x16a'),'foreignKey':_0x2917('0x159')});db[_0x2917('0x46')][_0x2917('0x10b')](db[_0x2917('0x7b')],{'as':_0x2917('0x15b'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x2917('0x46')][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':_0x2917('0x15c'),'through':_0x2917('0x129')});db[_0x2917('0x16f')]['belongsTo'](db[_0x2917('0xf9')],{'onDelete':_0x2917('0x168')});db[_0x2917('0x16f')][_0x2917('0x10b')](db[_0x2917('0x4b')],{'onDelete':_0x2917('0x168')});db[_0x2917('0x16f')]['belongsTo'](db[_0x2917('0x46')],{'onDelete':_0x2917('0x168')});db[_0x2917('0x16f')][_0x2917('0x10b')](db[_0x2917('0x161')],{'onDelete':_0x2917('0x168'),'foreignKey':_0x2917('0x169')});db[_0x2917('0x103')][_0x2917('0xfa')](db[_0x2917('0x4a')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x2917('0x170')});db[_0x2917('0x103')]['belongsTo'](db[_0x2917('0x46')],{'as':_0x2917('0x15f'),'foreignKey':'FaxAccountId'});db['FaxInteraction'][_0x2917('0x10b')](db['CmContact'],{'as':_0x2917('0x150'),'foreignKey':_0x2917('0x151')});db[_0x2917('0x103')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'as':_0x2917('0x160'),'foreignKey':_0x2917('0xf8')});db[_0x2917('0x103')][_0x2917('0x10c')](db[_0x2917('0x161')],{'through':_0x2917('0x171'),'as':_0x2917('0x163')});db[_0x2917('0x103')]['belongsToMany'](db[_0x2917('0x161')],{'through':_0x2917('0x171'),'as':_0x2917('0x164')});db['FaxInteraction'][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':_0x2917('0x165'),'through':'user_has_fax_interactions','foreignKey':_0x2917('0x170')});db[_0x2917('0x4a')]['belongsTo'](db[_0x2917('0xf9')],{'onDelete':_0x2917('0xf7'),'as':_0x2917('0xf9')});db[_0x2917('0x4a')][_0x2917('0x10b')](db[_0x2917('0x103')],{'as':'Interaction','foreignKey':_0x2917('0x170')});db['FaxMessage'][_0x2917('0x10b')](db[_0x2917('0x67')],{'onDelete':'cascade','as':'Contact'});db[_0x2917('0x4a')][_0x2917('0x10b')](db['Attachment'],{'as':_0x2917('0xdd'),'foreignKey':_0x2917('0x172')});db[_0x2917('0x4a')][_0x2917('0x10b')](db[_0x2917('0x46')],{'as':_0x2917('0x15f'),'foreignKey':_0x2917('0x16c')});db['FaxQueue'][_0x2917('0x10c')](db['User'],{'as':_0x2917('0x15c'),'through':'UserFaxQueue'});db[_0x2917('0x4b')][_0x2917('0x10c')](db[_0x2917('0xd7')],{'through':_0x2917('0x173'),'as':'Teams'});db[_0x2917('0x4c')][_0x2917('0x10b')](db['FaxAccount'],{});db[_0x2917('0x4c')][_0x2917('0x10b')](db[_0x2917('0x144')],{'as':_0x2917('0x16a'),'foreignKey':_0x2917('0x159')});db[_0x2917('0x4c')]['belongsTo'](db[_0x2917('0x67')],{'as':_0x2917('0x150'),'foreignKey':'ContactId'});db[_0x2917('0x4c')][_0x2917('0x10b')](db['FaxInteraction'],{});db['FaxQueueReport'][_0x2917('0x10b')](db[_0x2917('0x4a')],{});db[_0x2917('0x4c')][_0x2917('0x10b')](db[_0x2917('0xf9')],{});db[_0x2917('0x4c')][_0x2917('0x10b')](db[_0x2917('0x4b')],{});db[_0x2917('0x4e')][_0x2917('0xfa')](db[_0x2917('0x76')],{'as':_0x2917('0x155'),'foreignKey':'SmsAccountId'});db[_0x2917('0x4e')]['hasMany'](db[_0x2917('0x74')],{'as':_0x2917('0x156'),'foreignKey':_0x2917('0x174')});db['SmsAccount'][_0x2917('0xfa')](db[_0x2917('0x51')],{'as':_0x2917('0x149'),'foreignKey':_0x2917('0x174')});db[_0x2917('0x4e')][_0x2917('0xfa')](db[_0x2917('0x117')],{'as':_0x2917('0x16d')});db[_0x2917('0x4e')][_0x2917('0xfa')](db[_0x2917('0x175')],{'as':_0x2917('0x158')});db[_0x2917('0x4e')][_0x2917('0x10b')](db[_0x2917('0x144')],{'as':_0x2917('0x16a'),'foreignKey':'ListId'});db[_0x2917('0x4e')][_0x2917('0x10b')](db[_0x2917('0x7b')],{'as':_0x2917('0x15b'),'foreignKey':_0x2917('0x143')});db[_0x2917('0x4e')][_0x2917('0x10c')](db['User'],{'as':_0x2917('0x15c'),'through':_0x2917('0x176')});db[_0x2917('0x175')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'onDelete':'restrict'});db[_0x2917('0x175')][_0x2917('0x10b')](db[_0x2917('0x120')],{'onDelete':'restrict'});db[_0x2917('0x175')][_0x2917('0x10b')](db[_0x2917('0x4e')],{'onDelete':'restrict'});db['SmsApplication'][_0x2917('0x10b')](db['Interval'],{'onDelete':_0x2917('0x168'),'foreignKey':_0x2917('0x142')});db[_0x2917('0x175')][_0x2917('0x10b')](db['Tag'],{'onDelete':_0x2917('0x168'),'foreignKey':'TagId'});db[_0x2917('0x117')][_0x2917('0xfa')](db[_0x2917('0x51')],{'as':_0x2917('0x149'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x177')});db[_0x2917('0x117')]['belongsTo'](db[_0x2917('0x4e')],{'as':_0x2917('0x15f'),'foreignKey':_0x2917('0x174')});db[_0x2917('0x117')][_0x2917('0x10b')](db['CmContact'],{'as':'Contact','foreignKey':_0x2917('0x151')});db['SmsInteraction'][_0x2917('0x10b')](db[_0x2917('0xf9')],{'as':_0x2917('0x160'),'foreignKey':_0x2917('0xf8')});db['SmsInteraction'][_0x2917('0x10c')](db[_0x2917('0x161')],{'through':_0x2917('0x178'),'as':'Tags'});db[_0x2917('0x117')][_0x2917('0x10c')](db[_0x2917('0x161')],{'through':_0x2917('0x178'),'as':_0x2917('0x164')});db['SmsInteraction'][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':_0x2917('0x165'),'through':'user_has_sms_interactions','foreignKey':'SmsInteractionId'});db['SmsMessage']['belongsTo'](db[_0x2917('0xf9')],{'as':_0x2917('0xf9')});db['SmsMessage'][_0x2917('0x10b')](db['CmContact'],{'onDelete':'cascade','as':_0x2917('0x150')});db[_0x2917('0x51')][_0x2917('0x10b')](db[_0x2917('0x117')],{'onDelete':'cascade','as':_0x2917('0x179'),'foreignKey':_0x2917('0x177')});db[_0x2917('0x51')][_0x2917('0x10b')](db[_0x2917('0x4e')],{'as':_0x2917('0x15f'),'foreignKey':'SmsAccountId'});db[_0x2917('0x120')][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':'Agents','through':_0x2917('0x2f'),'foreignKey':_0x2917('0x17a')});db[_0x2917('0x120')][_0x2917('0x10c')](db[_0x2917('0xd7')],{'through':_0x2917('0x17b'),'as':_0x2917('0x146')});db['OpenchannelAccount'][_0x2917('0xfa')](db['Disposition'],{'as':_0x2917('0x155'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x2917('0xfa')](db['CannedAnswer'],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db[_0x2917('0x12b')][_0x2917('0xfa')](db[_0x2917('0x119')],{'as':'Interactions','foreignKey':_0x2917('0x17c')});db['OpenchannelAccount'][_0x2917('0xfa')](db['OpenchannelMessage'],{'as':_0x2917('0x149'),'foreignKey':'OpenchannelAccountId'});db[_0x2917('0x12b')][_0x2917('0xfa')](db['OpenchannelApplication'],{'as':_0x2917('0x158'),'foreignKey':'OpenchannelAccountId'});db[_0x2917('0x12b')][_0x2917('0x10b')](db['CmList'],{'as':_0x2917('0x16a'),'foreignKey':_0x2917('0x159')});db[_0x2917('0x12b')][_0x2917('0x10b')](db[_0x2917('0x7b')],{'as':_0x2917('0x15b'),'foreignKey':_0x2917('0x143')});db['OpenchannelAccount'][_0x2917('0x10c')](db['User'],{'as':_0x2917('0x15c'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x2917('0x10b')](db[_0x2917('0xf9')],{'onDelete':_0x2917('0x168')});db[_0x2917('0x17d')][_0x2917('0x10b')](db[_0x2917('0x56')],{'onDelete':_0x2917('0x168'),'foreignKey':_0x2917('0x17e')});db[_0x2917('0x17d')][_0x2917('0x10b')](db[_0x2917('0x12b')],{'onDelete':_0x2917('0x168'),'foreignKey':_0x2917('0x17c')});db[_0x2917('0x17d')][_0x2917('0x10b')](db[_0x2917('0x79')],{'onDelete':_0x2917('0x168'),'foreignKey':_0x2917('0x142')});db[_0x2917('0x17d')]['belongsTo'](db['Tag'],{'onDelete':_0x2917('0x168'),'foreignKey':_0x2917('0x169')});db[_0x2917('0x119')][_0x2917('0xfa')](db[_0x2917('0x55')],{'as':_0x2917('0x149'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x17f')});db[_0x2917('0x119')][_0x2917('0x10b')](db[_0x2917('0x12b')],{'as':_0x2917('0x15f'),'foreignKey':_0x2917('0x17c')});db[_0x2917('0x119')]['belongsTo'](db[_0x2917('0x67')],{'as':_0x2917('0x150'),'foreignKey':'ContactId'});db[_0x2917('0x119')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'as':'Owner','foreignKey':'UserId'});db[_0x2917('0x119')][_0x2917('0x10c')](db[_0x2917('0x161')],{'through':_0x2917('0x180'),'as':_0x2917('0x163')});db['OpenchannelInteraction'][_0x2917('0x10c')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x2917('0x164')});db[_0x2917('0x119')][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':'Users','through':_0x2917('0x11b'),'foreignKey':_0x2917('0x17f')});db['OpenchannelMessage']['belongsTo'](db[_0x2917('0xf9')],{'onDelete':_0x2917('0xf7'),'as':_0x2917('0xf9')});db[_0x2917('0x55')][_0x2917('0x10b')](db[_0x2917('0x67')],{'onDelete':_0x2917('0xf7'),'as':_0x2917('0x150')});db[_0x2917('0x55')]['belongsTo'](db[_0x2917('0x119')],{'onDelete':_0x2917('0xf7'),'as':_0x2917('0x179'),'foreignKey':_0x2917('0x17f')});db[_0x2917('0x55')][_0x2917('0x10b')](db[_0x2917('0xdd')],{'as':_0x2917('0xdd'),'foreignKey':'AttachmentId'});db[_0x2917('0x55')]['belongsTo'](db[_0x2917('0x12b')],{'as':_0x2917('0x15f'),'foreignKey':_0x2917('0x17c')});db[_0x2917('0x56')][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':_0x2917('0x15c'),'through':_0x2917('0x31'),'foreignKey':_0x2917('0x17e')});db[_0x2917('0x56')][_0x2917('0x10c')](db[_0x2917('0xd7')],{'through':_0x2917('0x181'),'as':_0x2917('0x146')});db[_0x2917('0x58')][_0x2917('0xfa')](db['Disposition'],{'as':_0x2917('0x155'),'foreignKey':'ChatWebsiteId'});db[_0x2917('0x58')][_0x2917('0xfa')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x2917('0x182')});db[_0x2917('0x58')]['hasMany'](db[_0x2917('0x65')],{'as':_0x2917('0x183')});db[_0x2917('0x58')][_0x2917('0xfa')](db[_0x2917('0x5d')],{'as':_0x2917('0x16d')});db[_0x2917('0x58')][_0x2917('0xfa')](db[_0x2917('0x5b')],{'as':_0x2917('0x158')});db['ChatWebsite'][_0x2917('0xfa')](db[_0x2917('0x5e')],{'as':'Messages'});db[_0x2917('0x58')][_0x2917('0x10b')](db['CmList'],{'as':_0x2917('0x16a'),'foreignKey':_0x2917('0x159')});db['ChatWebsite'][_0x2917('0x10b')](db['Interval'],{'as':_0x2917('0x79'),'foreignKey':_0x2917('0x142')});db[_0x2917('0x58')][_0x2917('0x10b')](db['Pause'],{'as':_0x2917('0x15b'),'foreignKey':_0x2917('0x143')});db[_0x2917('0x58')][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':'Agents','through':'user_has_chat_websites'});db[_0x2917('0x59')][_0x2917('0x10b')](db[_0x2917('0x12b')],{});db[_0x2917('0x59')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x2917('0x159')});db[_0x2917('0x59')][_0x2917('0x10b')](db[_0x2917('0x67')],{'as':_0x2917('0x150'),'foreignKey':_0x2917('0x151')});db[_0x2917('0x59')][_0x2917('0x10b')](db['OpenchannelInteraction'],{});db[_0x2917('0x59')][_0x2917('0x10b')](db[_0x2917('0x55')],{});db[_0x2917('0x59')]['belongsTo'](db[_0x2917('0xf9')],{});db[_0x2917('0x59')]['belongsTo'](db[_0x2917('0x56')],{});db[_0x2917('0x5b')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'as':_0x2917('0x184'),'foreignKey':_0x2917('0xf8'),'onDelete':'restrict'});db['ChatApplication'][_0x2917('0x10b')](db['ChatQueue'],{'as':_0x2917('0x185'),'foreignKey':_0x2917('0x186'),'onDelete':_0x2917('0x168')});db[_0x2917('0x5b')][_0x2917('0x10b')](db['ChatWebsite'],{'as':_0x2917('0x187'),'foreignKey':'ChatWebsiteId','onDelete':_0x2917('0x168')});db[_0x2917('0x5b')][_0x2917('0x10b')](db[_0x2917('0x161')],{'onDelete':_0x2917('0x168'),'foreignKey':'TagId'});db['ChatInteraction']['hasMany'](db[_0x2917('0x5e')],{'as':'Messages','onDelete':_0x2917('0xf7'),'foreignKey':'ChatInteractionId'});db[_0x2917('0x5d')][_0x2917('0x10b')](db['ChatWebsite'],{'as':_0x2917('0x15f'),'foreignKey':_0x2917('0x182')});db[_0x2917('0x5d')][_0x2917('0x10b')](db[_0x2917('0x67')],{'as':_0x2917('0x150'),'foreignKey':'ContactId'});db[_0x2917('0x5d')][_0x2917('0x10b')](db['User'],{'as':_0x2917('0x160'),'foreignKey':_0x2917('0xf8')});db['ChatInteraction'][_0x2917('0x10c')](db[_0x2917('0x161')],{'through':_0x2917('0x188'),'as':'Tags'});db[_0x2917('0x5d')]['belongsToMany'](db[_0x2917('0x161')],{'through':_0x2917('0x188'),'as':_0x2917('0x164')});db['ChatInteraction'][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':_0x2917('0x165'),'through':_0x2917('0x189'),'foreignKey':'ChatInteractionId'});db[_0x2917('0x5e')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'onDelete':_0x2917('0xf7'),'as':_0x2917('0xf9')});db[_0x2917('0x5e')][_0x2917('0x10b')](db[_0x2917('0x67')],{'onDelete':_0x2917('0xf7'),'as':'Contact','foreignKey':_0x2917('0x151')});db[_0x2917('0x5e')][_0x2917('0x10b')](db['ChatInteraction'],{'onDelete':_0x2917('0xf7'),'as':_0x2917('0x179'),'foreignKey':_0x2917('0x18a')});db[_0x2917('0x5e')][_0x2917('0x10b')](db[_0x2917('0xdd')],{'as':_0x2917('0xdd'),'foreignKey':_0x2917('0x172')});db[_0x2917('0x5e')][_0x2917('0x10b')](db[_0x2917('0x58')],{'as':_0x2917('0x15f'),'foreignKey':_0x2917('0x182')});db['ChatOfflineMessage'][_0x2917('0x10b')](db[_0x2917('0x67')],{'onDelete':_0x2917('0xf7'),'as':'Contact','foreignKey':_0x2917('0x151')});db[_0x2917('0x60')][_0x2917('0x10b')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x2917('0x182')});db['ChatQueue']['belongsToMany'](db['User'],{'as':_0x2917('0x15c'),'through':_0x2917('0x2a'),'hooks':!![]});db[_0x2917('0x62')]['belongsToMany'](db[_0x2917('0xd7')],{'through':_0x2917('0x18b'),'as':_0x2917('0x146')});db[_0x2917('0x10d')][_0x2917('0xfa')](db[_0x2917('0xc4')],{'as':'Messages','foreignKey':_0x2917('0x18c'),'onDelete':_0x2917('0xf7')});db[_0x2917('0x10d')]['belongsToMany'](db[_0x2917('0xf9')],{'as':_0x2917('0x139'),'through':_0x2917('0x10f')});db[_0x2917('0x65')]['belongsTo'](db[_0x2917('0x58')],{'as':_0x2917('0x187'),'foreignKey':_0x2917('0x182')});db[_0x2917('0x18d')][_0x2917('0xfa')](db[_0x2917('0x67')],{'as':_0x2917('0x110'),'foreignKey':'CompanyId'});db[_0x2917('0x67')][_0x2917('0xfa')](db[_0x2917('0x68')],{'as':_0x2917('0x13b'),'foreignKey':'ContactId'});db[_0x2917('0x67')]['hasMany'](db[_0x2917('0x6b')],{'as':_0x2917('0xfe'),'foreignKey':'ContactId'});db[_0x2917('0x67')]['hasMany'](db[_0x2917('0x6d')],{'as':_0x2917('0x13c'),'foreignKey':_0x2917('0x151')});db[_0x2917('0x67')]['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db['CmContact'][_0x2917('0xfa')](db[_0x2917('0xc8')],{'as':_0x2917('0x13d'),'foreignKey':_0x2917('0x151')});db[_0x2917('0x67')][_0x2917('0xfa')](db[_0x2917('0x119')],{'as':'OpenchannelInteractions','foreignKey':_0x2917('0x151'),'onDelete':'restrict'});db[_0x2917('0x67')][_0x2917('0xfa')](db[_0x2917('0x5d')],{'as':_0x2917('0x101'),'foreignKey':_0x2917('0x151'),'onDelete':'restrict'});db[_0x2917('0x67')][_0x2917('0xfa')](db[_0x2917('0x117')],{'as':_0x2917('0x102'),'foreignKey':_0x2917('0x151'),'onDelete':_0x2917('0x168')});db[_0x2917('0x67')][_0x2917('0xfa')](db[_0x2917('0x103')],{'as':_0x2917('0x104'),'foreignKey':_0x2917('0x151'),'onDelete':_0x2917('0x168')});db['CmContact']['hasMany'](db[_0x2917('0x3b')],{'as':'MailInteractions','foreignKey':_0x2917('0x151'),'onDelete':_0x2917('0x168')});db['CmContact'][_0x2917('0x10b')](db['CmCompany'],{'as':_0x2917('0x18e'),'foreignKey':_0x2917('0x18f')});db[_0x2917('0x67')]['belongsTo'](db[_0x2917('0x144')],{'as':'List','foreignKey':'ListId','onDelete':_0x2917('0xf7')});db[_0x2917('0x67')][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':'Users','through':_0x2917('0x111')});db[_0x2917('0x67')][_0x2917('0x10c')](db['Tag'],{'as':_0x2917('0x163'),'through':_0x2917('0x190')});db[_0x2917('0x67')][_0x2917('0x10c')](db[_0x2917('0x161')],{'through':_0x2917('0x190'),'as':'ThroughTags'});db[_0x2917('0x68')][_0x2917('0x10b')](db[_0x2917('0x67')],{'as':_0x2917('0x150'),'foreignKey':_0x2917('0x151'),'onDelete':_0x2917('0xf7')});db[_0x2917('0x68')][_0x2917('0x10b')](db['CmList'],{'as':'List','foreignKey':_0x2917('0x159'),'onDelete':'cascade'});db[_0x2917('0x68')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'as':'Agent','foreignKey':'UserId'});db[_0x2917('0x68')]['belongsTo'](db[_0x2917('0x137')],{'as':_0x2917('0x185'),'foreignKey':_0x2917('0x13a'),'onDelete':_0x2917('0xf7')});db[_0x2917('0x68')]['belongsTo'](db['Campaign'],{'as':_0x2917('0xda'),'foreignKey':_0x2917('0x191'),'onDelete':_0x2917('0xf7')});db[_0x2917('0x68')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'as':'Owner','foreignKey':_0x2917('0x192')});db[_0x2917('0x69')][_0x2917('0x10b')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId','onDelete':'cascade'});db[_0x2917('0x69')][_0x2917('0x10b')](db[_0x2917('0x144')],{'as':_0x2917('0x16a'),'foreignKey':_0x2917('0x159'),'onDelete':'cascade'});db['CmHopperBlack'][_0x2917('0x10b')](db[_0x2917('0x137')],{'as':_0x2917('0x185'),'foreignKey':_0x2917('0x13a'),'onDelete':_0x2917('0xf7')});db[_0x2917('0x69')]['belongsTo'](db[_0x2917('0xda')],{'as':'Campaign','foreignKey':_0x2917('0x191'),'onDelete':_0x2917('0xf7')});db[_0x2917('0x73')]['hasMany'](db[_0x2917('0x78')],{'as':{'plural':_0x2917('0x193'),'singular':'OneAll'},'foreignKey':_0x2917('0x194'),'onDelete':'cascade','hooks':!![]});db[_0x2917('0x73')][_0x2917('0xfa')](db[_0x2917('0x78')],{'as':{'plural':_0x2917('0x195'),'singular':_0x2917('0x196')},'foreignKey':_0x2917('0x197'),'onDelete':_0x2917('0xf7'),'hooks':!![]});db[_0x2917('0x73')][_0x2917('0xfa')](db[_0x2917('0x71')],{'as':'Actions','foreignKey':_0x2917('0x198'),'onDelete':_0x2917('0xf7'),'hooks':!![]});db[_0x2917('0x76')]['hasMany'](db[_0x2917('0x76')],{'as':_0x2917('0x155'),'foreignKey':_0x2917('0x199'),'onDelete':_0x2917('0xf7')});db['Interval'][_0x2917('0xfa')](db[_0x2917('0x79')],{'as':_0x2917('0x19a'),'foreignKey':_0x2917('0x142'),'onDelete':_0x2917('0xf7'),'hooks':!![],'required':![]});db[_0x2917('0x79')][_0x2917('0xfa')](db[_0x2917('0x15')],{'as':_0x2917('0xfd'),'foreignKey':_0x2917('0x142'),'onDelete':'restrict'});db['Interval'][_0x2917('0xfa')](db[_0x2917('0x3f')],{'as':_0x2917('0x19b'),'foreignKey':_0x2917('0x142')});db[_0x2917('0x79')][_0x2917('0xfa')](db['ChatApplication'],{'as':_0x2917('0x19c'),'foreignKey':_0x2917('0x142')});db[_0x2917('0x79')]['hasMany'](db[_0x2917('0x16f')],{'as':'FaxApplications','foreignKey':_0x2917('0x142')});db[_0x2917('0x79')]['hasMany'](db[_0x2917('0x175')],{'as':_0x2917('0x19d'),'foreignKey':_0x2917('0x142')});db[_0x2917('0x80')]['belongsTo'](db[_0x2917('0x36')],{});db['Schedule'][_0x2917('0x10b')](db[_0x2917('0x8b')],{'foreignKey':'DefaultReportId'});db[_0x2917('0x80')][_0x2917('0x10b')](db[_0x2917('0x19e')],{'foreignKey':_0x2917('0x19f')});db[_0x2917('0x82')][_0x2917('0x10c')](db[_0x2917('0x17')],{'as':_0x2917('0x1a0'),'through':'moh_has_sounds','onDelete':'restrict'});db[_0x2917('0x161')][_0x2917('0x10c')](db[_0x2917('0x67')],{'through':_0x2917('0x190')});db[_0x2917('0x161')][_0x2917('0x10c')](db['ChatInteraction'],{'through':_0x2917('0x188')});db[_0x2917('0x161')]['belongsToMany'](db[_0x2917('0x3b')],{'through':'mail_interaction_has_tags'});db[_0x2917('0x161')][_0x2917('0x10c')](db[_0x2917('0x117')],{'through':_0x2917('0x178')});db[_0x2917('0x161')][_0x2917('0x10c')](db[_0x2917('0x103')],{'through':'fax_interaction_has_tags'});db[_0x2917('0x161')]['belongsToMany'](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db[_0x2917('0x161')][_0x2917('0x10c')](db['WhatsappInteraction'],{'through':_0x2917('0x1a1')});db[_0x2917('0x1a2')]['hasMany'](db['Condition'],{'as':{'plural':'AllConditions','singular':_0x2917('0x1a3')},'foreignKey':_0x2917('0x1a4'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0x2917('0xfa')](db['Condition'],{'as':{'plural':'AnyConditions','singular':_0x2917('0x1a5')},'foreignKey':_0x2917('0x1a6'),'onDelete':_0x2917('0xf7'),'hooks':!![]});db['Trigger'][_0x2917('0xfa')](db['Action'],{'as':_0x2917('0x1a7'),'foreignKey':_0x2917('0x1a8'),'onDelete':_0x2917('0xf7'),'hooks':!![]});db[_0x2917('0x19e')]['hasMany'](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x19f'),'hooks':!![]});db[_0x2917('0x8b')][_0x2917('0xfa')](db[_0x2917('0x8f')],{'as':'Fields','onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1a9')});db['AnalyticMetric'][_0x2917('0xfa')](db[_0x2917('0x8f')],{'as':_0x2917('0x1aa'),'onDelete':_0x2917('0xf7'),'foreignKey':'MetricId'});db[_0x2917('0x8f')]['belongsTo'](db['AnalyticMetric'],{'foreignKey':_0x2917('0x1ab')});db[_0x2917('0x92')][_0x2917('0xfa')](db[_0x2917('0x94')],{'as':_0x2917('0x1ac'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1ad')});db['SalesforceConfiguration'][_0x2917('0xfa')](db[_0x2917('0x95')],{'as':_0x2917('0x1ae'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1af')});db[_0x2917('0x94')]['hasMany'](db[_0x2917('0x95')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x2917('0x1b0')});db[_0x2917('0x94')]['hasMany'](db['SalesforceField'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x2917('0x1b1')});db['SalesforceConfiguration'][_0x2917('0x10b')](db['SalesforceAccount'],{'as':_0x2917('0x15f'),'foreignKey':_0x2917('0x1ad')});db[_0x2917('0x95')][_0x2917('0xfa')](db['SalesforceField'],{'as':_0x2917('0x1b2'),'foreignKey':'SubjectId'});db[_0x2917('0x95')][_0x2917('0xfa')](db[_0x2917('0x95')],{'as':_0x2917('0x1b3'),'foreignKey':'DescriptionId'});db['SalesforceField'][_0x2917('0xfa')](db['SalesforceField'],{'as':_0x2917('0x1b4'),'foreignKey':_0x2917('0x1b1')});db[_0x2917('0x95')][_0x2917('0x10b')](db[_0x2917('0x88')],{'as':_0x2917('0x88'),'foreignKey':_0x2917('0x1b5')});db[_0x2917('0x1b6')]['hasMany'](db[_0x2917('0x1b7')],{'as':_0x2917('0x1ac'),'onDelete':_0x2917('0xf7'),'foreignKey':'AccountId'});db[_0x2917('0x1b7')][_0x2917('0xfa')](db[_0x2917('0x99')],{'as':_0x2917('0x1ae'),'onDelete':_0x2917('0xf7'),'foreignKey':'SubjectId'});db[_0x2917('0x1b7')][_0x2917('0xfa')](db[_0x2917('0x99')],{'as':_0x2917('0x1b8'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1b0')});db[_0x2917('0x1b7')]['hasMany'](db[_0x2917('0x99')],{'as':_0x2917('0x1aa'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1b1')});db[_0x2917('0x1b7')][_0x2917('0x10b')](db[_0x2917('0x1b6')],{'as':_0x2917('0x15f'),'foreignKey':_0x2917('0x1ad')});db['SugarcrmField'][_0x2917('0xfa')](db[_0x2917('0x99')],{'as':_0x2917('0x1b2'),'foreignKey':_0x2917('0x1af')});db['SugarcrmField']['hasMany'](db[_0x2917('0x99')],{'as':'Description','foreignKey':_0x2917('0x1b0')});db['SugarcrmField'][_0x2917('0xfa')](db[_0x2917('0x99')],{'as':'Field','foreignKey':_0x2917('0x1b1')});db['SugarcrmField'][_0x2917('0x10b')](db[_0x2917('0x88')],{'as':'Variable','foreignKey':_0x2917('0x1b5')});db[_0x2917('0x1b9')][_0x2917('0xfa')](db[_0x2917('0x9c')],{'as':_0x2917('0x1ac'),'onDelete':'cascade','foreignKey':_0x2917('0x1ad')});db[_0x2917('0x9c')]['hasMany'](db[_0x2917('0x9d')],{'as':'Subjects','onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1af')});db[_0x2917('0x9c')][_0x2917('0xfa')](db[_0x2917('0x9d')],{'as':_0x2917('0x1b8'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1b0')});db[_0x2917('0x9c')][_0x2917('0xfa')](db[_0x2917('0x9d')],{'as':_0x2917('0x1aa'),'onDelete':'cascade','foreignKey':_0x2917('0x1b1')});db[_0x2917('0x9c')][_0x2917('0x10b')](db[_0x2917('0x1b9')],{'as':_0x2917('0x15f'),'foreignKey':'AccountId'});db[_0x2917('0x9c')][_0x2917('0x10c')](db[_0x2917('0x161')],{'through':_0x2917('0x1ba')});db[_0x2917('0x9d')][_0x2917('0xfa')](db[_0x2917('0x9d')],{'as':'Subject','foreignKey':_0x2917('0x1af')});db['DeskField'][_0x2917('0xfa')](db[_0x2917('0x9d')],{'as':'Description','foreignKey':_0x2917('0x1b0')});db['DeskField'][_0x2917('0xfa')](db[_0x2917('0x9d')],{'as':_0x2917('0x1b4'),'foreignKey':'FieldId'});db['DeskField'][_0x2917('0x10b')](db[_0x2917('0x88')],{'as':'Variable','foreignKey':_0x2917('0x1b5')});db[_0x2917('0x9e')][_0x2917('0xfa')](db['ZohoConfiguration'],{'as':_0x2917('0x1ac'),'onDelete':'cascade','foreignKey':_0x2917('0x1ad')});db[_0x2917('0xa0')][_0x2917('0xfa')](db['ZohoField'],{'as':_0x2917('0x1ae'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1af')});db[_0x2917('0xa0')][_0x2917('0xfa')](db['ZohoField'],{'as':_0x2917('0x1b8'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1b0')});db[_0x2917('0xa0')][_0x2917('0xfa')](db[_0x2917('0xa2')],{'as':_0x2917('0x1aa'),'onDelete':_0x2917('0xf7'),'foreignKey':'FieldId'});db[_0x2917('0xa0')][_0x2917('0x10b')](db[_0x2917('0x9e')],{'as':_0x2917('0x15f'),'foreignKey':_0x2917('0x1ad')});db[_0x2917('0xa2')][_0x2917('0xfa')](db[_0x2917('0xa2')],{'as':_0x2917('0x1b2'),'foreignKey':_0x2917('0x1af')});db[_0x2917('0xa2')][_0x2917('0xfa')](db[_0x2917('0xa2')],{'as':_0x2917('0x1b3'),'foreignKey':_0x2917('0x1b0')});db['ZohoField']['hasMany'](db[_0x2917('0xa2')],{'as':_0x2917('0x1b4'),'foreignKey':_0x2917('0x1b1')});db['ZohoField']['belongsTo'](db[_0x2917('0x88')],{'as':_0x2917('0x88'),'foreignKey':_0x2917('0x1b5')});db[_0x2917('0xa4')][_0x2917('0xfa')](db[_0x2917('0xa6')],{'as':_0x2917('0x1ac'),'onDelete':_0x2917('0xf7'),'foreignKey':'AccountId'});db[_0x2917('0xa6')]['hasMany'](db['ZendeskField'],{'as':_0x2917('0x1ae'),'foreignKey':'SubjectId'});db[_0x2917('0xa6')][_0x2917('0xfa')](db[_0x2917('0x1bb')],{'as':_0x2917('0x1b8'),'foreignKey':'DescriptionId'});db[_0x2917('0xa6')][_0x2917('0xfa')](db[_0x2917('0x1bb')],{'as':'Fields','foreignKey':'FieldId'});db[_0x2917('0xa6')][_0x2917('0x10b')](db[_0x2917('0xa4')],{'as':'Account','foreignKey':'AccountId'});db[_0x2917('0xa6')][_0x2917('0x10c')](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db[_0x2917('0x1bb')][_0x2917('0xfa')](db['ZendeskField'],{'as':_0x2917('0x1b2'),'foreignKey':'SubjectId'});db[_0x2917('0x1bb')][_0x2917('0xfa')](db[_0x2917('0x1bb')],{'as':_0x2917('0x1b3'),'foreignKey':_0x2917('0x1b0')});db[_0x2917('0x1bb')][_0x2917('0xfa')](db['ZendeskField'],{'as':_0x2917('0x1b4'),'foreignKey':_0x2917('0x1b1')});db['ZendeskField'][_0x2917('0x10b')](db['Variable'],{'as':'Variable','foreignKey':_0x2917('0x1b5')});db[_0x2917('0xa8')][_0x2917('0xfa')](db['FreshdeskConfiguration'],{'as':_0x2917('0x1ac'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1ad')});db[_0x2917('0xaa')][_0x2917('0xfa')](db[_0x2917('0xab')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x2917('0x1af')});db[_0x2917('0xaa')][_0x2917('0xfa')](db[_0x2917('0xab')],{'as':_0x2917('0x1b8'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1b0')});db[_0x2917('0xaa')]['hasMany'](db[_0x2917('0xab')],{'as':_0x2917('0x1aa'),'onDelete':'cascade','foreignKey':_0x2917('0x1b1')});db[_0x2917('0xaa')][_0x2917('0x10b')](db[_0x2917('0xa8')],{'as':_0x2917('0x15f'),'foreignKey':_0x2917('0x1ad')});db[_0x2917('0xaa')]['belongsToMany'](db[_0x2917('0x161')],{'through':_0x2917('0x1bc')});db[_0x2917('0xab')][_0x2917('0xfa')](db[_0x2917('0xab')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x2917('0xab')][_0x2917('0xfa')](db[_0x2917('0xab')],{'as':_0x2917('0x1b3'),'foreignKey':'DescriptionId'});db[_0x2917('0xab')][_0x2917('0xfa')](db['FreshdeskField'],{'as':_0x2917('0x1b4'),'foreignKey':_0x2917('0x1b1')});db[_0x2917('0xab')][_0x2917('0x10b')](db[_0x2917('0x88')],{'as':_0x2917('0x88'),'foreignKey':_0x2917('0x1b5')});db[_0x2917('0xad')][_0x2917('0xfa')](db[_0x2917('0xaf')],{'as':_0x2917('0x1ac'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x2917('0xaf')][_0x2917('0xfa')](db[_0x2917('0xb0')],{'as':_0x2917('0x1ae'),'foreignKey':'SubjectId'});db[_0x2917('0xaf')]['hasMany'](db['VtigerField'],{'as':_0x2917('0x1b8'),'foreignKey':_0x2917('0x1b0')});db[_0x2917('0xaf')][_0x2917('0xfa')](db['VtigerField'],{'as':_0x2917('0x1aa'),'foreignKey':_0x2917('0x1b1')});db[_0x2917('0xaf')]['belongsTo'](db['VtigerAccount'],{'as':_0x2917('0x15f'),'foreignKey':_0x2917('0x1ad')});db[_0x2917('0xb0')][_0x2917('0xfa')](db[_0x2917('0xb0')],{'as':_0x2917('0x1b2'),'foreignKey':_0x2917('0x1af')});db[_0x2917('0xb0')]['hasMany'](db['VtigerField'],{'as':'Description','foreignKey':_0x2917('0x1b0')});db[_0x2917('0xb0')][_0x2917('0xfa')](db[_0x2917('0xb0')],{'as':_0x2917('0x1b4'),'foreignKey':_0x2917('0x1b1')});db['VtigerField'][_0x2917('0x10b')](db[_0x2917('0x88')],{'as':_0x2917('0x88'),'foreignKey':'VariableId'});db[_0x2917('0xb2')][_0x2917('0xfa')](db['ServicenowConfiguration'],{'as':_0x2917('0x1ac'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1ad')});db[_0x2917('0x1bd')]['hasMany'](db['ServicenowField'],{'as':_0x2917('0x1ae'),'foreignKey':_0x2917('0x1af')});db['ServicenowConfiguration']['hasMany'](db[_0x2917('0xb5')],{'as':_0x2917('0x1b8'),'foreignKey':_0x2917('0x1b0')});db[_0x2917('0x1bd')][_0x2917('0xfa')](db[_0x2917('0xb5')],{'as':'Fields','foreignKey':_0x2917('0x1b1')});db[_0x2917('0x1bd')][_0x2917('0x10b')](db[_0x2917('0xb2')],{'as':_0x2917('0x15f'),'foreignKey':_0x2917('0x1ad')});db[_0x2917('0xb5')][_0x2917('0xfa')](db[_0x2917('0xb5')],{'as':_0x2917('0x1b2'),'foreignKey':'SubjectId'});db[_0x2917('0xb5')][_0x2917('0xfa')](db[_0x2917('0xb5')],{'as':_0x2917('0x1b3'),'foreignKey':_0x2917('0x1b0')});db[_0x2917('0xb5')][_0x2917('0xfa')](db[_0x2917('0xb5')],{'as':_0x2917('0x1b4'),'foreignKey':'FieldId'});db[_0x2917('0xb5')][_0x2917('0x10b')](db[_0x2917('0x88')],{'as':_0x2917('0x88'),'foreignKey':_0x2917('0x1b5')});db['Dynamics365Account'][_0x2917('0xfa')](db['Dynamics365Configuration'],{'as':_0x2917('0x1ac'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1ad')});db[_0x2917('0x1be')][_0x2917('0xfa')](db['Dynamics365Field'],{'as':_0x2917('0x1ae'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1af')});db[_0x2917('0x1be')][_0x2917('0xfa')](db[_0x2917('0x1bf')],{'as':'Descriptions','onDelete':_0x2917('0xf7'),'foreignKey':'DescriptionId'});db[_0x2917('0x1be')][_0x2917('0xfa')](db[_0x2917('0x1bf')],{'as':_0x2917('0x1aa'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1b1')});db[_0x2917('0x1be')][_0x2917('0x10b')](db[_0x2917('0x1c0')],{'as':_0x2917('0x15f'),'foreignKey':_0x2917('0x1ad')});db[_0x2917('0x1bf')][_0x2917('0xfa')](db[_0x2917('0x1bf')],{'as':_0x2917('0x1b2'),'foreignKey':'SubjectId'});db[_0x2917('0x1bf')][_0x2917('0xfa')](db[_0x2917('0x1bf')],{'as':_0x2917('0x1b3'),'foreignKey':_0x2917('0x1b0')});db[_0x2917('0x1bf')]['hasMany'](db['Dynamics365Field'],{'as':_0x2917('0x1b4'),'foreignKey':_0x2917('0x1b1')});db[_0x2917('0x1bf')][_0x2917('0x10b')](db[_0x2917('0x88')],{'as':_0x2917('0x88'),'foreignKey':_0x2917('0x1b5')});db[_0x2917('0xba')]['hasMany'](db['FreshsalesConfiguration'],{'as':_0x2917('0x1ac'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1ad')});db['FreshsalesConfiguration'][_0x2917('0xfa')](db[_0x2917('0xbd')],{'as':_0x2917('0x1ae'),'foreignKey':_0x2917('0x1af')});db[_0x2917('0xbc')][_0x2917('0xfa')](db[_0x2917('0xbd')],{'as':_0x2917('0x1b8'),'foreignKey':_0x2917('0x1b0')});db[_0x2917('0xbc')]['hasMany'](db['FreshsalesField'],{'as':_0x2917('0x1aa'),'foreignKey':'FieldId'});db['FreshsalesConfiguration'][_0x2917('0x10b')](db[_0x2917('0xba')],{'as':'Account','foreignKey':_0x2917('0x1ad')});db[_0x2917('0xbd')]['hasMany'](db[_0x2917('0xbd')],{'as':_0x2917('0x1b2'),'foreignKey':_0x2917('0x1af')});db[_0x2917('0xbd')]['hasMany'](db[_0x2917('0xbd')],{'as':_0x2917('0x1b3'),'foreignKey':_0x2917('0x1b0')});db[_0x2917('0xbd')]['hasMany'](db[_0x2917('0xbd')],{'as':_0x2917('0x1b4'),'foreignKey':'FieldId'});db['FreshsalesField']['belongsTo'](db['Variable'],{'as':_0x2917('0x88'),'foreignKey':_0x2917('0x1b5')});db[_0x2917('0xc2')][_0x2917('0x10b')](db[_0x2917('0x58')],{});db['ChatQueueReport'][_0x2917('0x10b')](db['CmList'],{'as':_0x2917('0x16a'),'foreignKey':_0x2917('0x159')});db[_0x2917('0xc2')]['belongsTo'](db['CmContact'],{'as':_0x2917('0x150'),'foreignKey':_0x2917('0x151')});db[_0x2917('0xc2')][_0x2917('0x10b')](db[_0x2917('0x5d')],{});db[_0x2917('0xc2')][_0x2917('0x10b')](db[_0x2917('0x5e')],{});db[_0x2917('0xc2')]['belongsTo'](db[_0x2917('0xf9')],{});db[_0x2917('0xc2')]['belongsTo'](db[_0x2917('0x62')],{});db[_0x2917('0xc4')]['belongsTo'](db[_0x2917('0xf9')],{'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1c1')});db['ChatInternalMessage'][_0x2917('0x10b')](db[_0x2917('0xf9')],{'onDelete':'cascade','foreignKey':'ToId'});db[_0x2917('0xc8')][_0x2917('0xfa')](db[_0x2917('0x1c2')],{'foreignKey':_0x2917('0x1c3'),'onDelete':_0x2917('0xf7')});db[_0x2917('0xc8')][_0x2917('0xfa')](db[_0x2917('0xc6')],{'foreignKey':'SessionId','onDelete':_0x2917('0xf7')});db[_0x2917('0xc9')][_0x2917('0x10b')](db[_0x2917('0x4e')],{});db['SmsQueueReport'][_0x2917('0x10b')](db[_0x2917('0x144')],{'as':_0x2917('0x16a'),'foreignKey':'ListId'});db[_0x2917('0xc9')][_0x2917('0x10b')](db[_0x2917('0x67')],{'as':_0x2917('0x150'),'foreignKey':_0x2917('0x151')});db['SmsQueueReport']['belongsTo'](db[_0x2917('0x117')],{});db[_0x2917('0xc9')][_0x2917('0x10b')](db[_0x2917('0x51')],{});db[_0x2917('0xc9')][_0x2917('0x10b')](db[_0x2917('0xf9')],{});db[_0x2917('0xc9')][_0x2917('0x10b')](db[_0x2917('0x120')],{});db['JscriptyProject']['hasMany'](db[_0x2917('0xc8')],{'foreignKey':_0x2917('0x1c4')});db['JscriptyProject'][_0x2917('0xfa')](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db[_0x2917('0xcf')]['hasMany'](db[_0x2917('0xc6')],{'foreignKey':'ProjectId'});db[_0x2917('0xd4')][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':'Users','through':_0x2917('0x1c5')});db[_0x2917('0xd7')]['belongsToMany'](db[_0x2917('0xf9')],{'as':_0x2917('0x15c'),'through':_0x2917('0x114')});db[_0x2917('0xd7')][_0x2917('0x10c')](db['VoiceQueue'],{'through':_0x2917('0x1c6'),'as':'VoiceQueues'});db[_0x2917('0xd7')]['belongsToMany'](db['MailQueue'],{'through':'team_has_mail_queues','as':_0x2917('0x11d')});db[_0x2917('0xd7')]['belongsToMany'](db['ChatQueue'],{'through':_0x2917('0x18b'),'as':'ChatQueues'});db[_0x2917('0xd7')][_0x2917('0x10c')](db['FaxQueue'],{'through':'team_has_fax_queues','as':'FaxQueues'});db[_0x2917('0xd7')][_0x2917('0x10c')](db[_0x2917('0x120')],{'through':_0x2917('0x17b'),'as':_0x2917('0x121')});db['Team'][_0x2917('0x10c')](db[_0x2917('0x56')],{'through':_0x2917('0x181'),'as':'OpenchannelQueues'});db[_0x2917('0xd7')]['belongsToMany'](db['WhatsappQueue'],{'through':_0x2917('0x1c7'),'as':_0x2917('0x1c8')});db[_0x2917('0xda')]['hasMany'](db['CmHopper'],{'as':_0x2917('0x13b'),'foreignKey':'CampaignId'});db[_0x2917('0xda')]['hasMany'](db[_0x2917('0x6b')],{'as':_0x2917('0xfe'),'foreignKey':_0x2917('0x191')});db[_0x2917('0xda')][_0x2917('0xfa')](db[_0x2917('0x6d')],{'as':'HopperHistories','foreignKey':_0x2917('0x191')});db[_0x2917('0xda')][_0x2917('0xfa')](db[_0x2917('0x69')],{'as':_0x2917('0x1c9'),'foreignKey':_0x2917('0x191')});db[_0x2917('0xda')][_0x2917('0x10b')](db[_0x2917('0x13e')],{'as':'Trunk','foreignKey':_0x2917('0x13f')});db['Campaign'][_0x2917('0x10b')](db[_0x2917('0x13e')],{'as':_0x2917('0x140'),'foreignKey':_0x2917('0x141')});db[_0x2917('0xda')][_0x2917('0x10b')](db[_0x2917('0x79')],{'as':_0x2917('0x79'),'foreignKey':_0x2917('0x142')});db[_0x2917('0xda')][_0x2917('0x10b')](db[_0x2917('0xd4')],{'as':_0x2917('0xd4'),'foreignKey':_0x2917('0x1ca')});db[_0x2917('0xda')][_0x2917('0x10c')](db[_0x2917('0x144')],{'as':_0x2917('0x112'),'through':_0x2917('0x1cb')});db[_0x2917('0xda')][_0x2917('0x10c')](db[_0x2917('0x144')],{'as':'BlackLists','through':_0x2917('0x1cc')});db[_0x2917('0xdf')]['belongsTo'](db['MailMessage'],{});db[_0x2917('0xdf')][_0x2917('0x10b')](db[_0x2917('0x3b')],{});db['MailTransferReport'][_0x2917('0x10b')](db[_0x2917('0x36')],{'foreignKey':_0x2917('0x1cd'),'as':_0x2917('0x1ce')});db[_0x2917('0xdf')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x2917('0xdf')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'foreignKey':'ToUserId','as':_0x2917('0x1cf')});db['MailTransferReport']['belongsTo'](db[_0x2917('0x38')],{'foreignKey':'ToMailQueueId','as':_0x2917('0x1d0')});db['MailTransferReport'][_0x2917('0x10b')](db['MailAccount'],{'foreignKey':_0x2917('0x1d1'),'as':_0x2917('0x1d2')});db['ChatTransferReport']['belongsTo'](db[_0x2917('0x5e')],{});db['ChatTransferReport'][_0x2917('0x10b')](db[_0x2917('0x5d')],{});db[_0x2917('0xe1')][_0x2917('0x10b')](db[_0x2917('0x58')],{'foreignKey':_0x2917('0x1d3'),'as':_0x2917('0x1ce')});db[_0x2917('0xe1')]['belongsTo'](db['User'],{'foreignKey':_0x2917('0x1d4'),'as':_0x2917('0x1d5')});db[_0x2917('0xe1')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'foreignKey':_0x2917('0x1d6'),'as':'ToAgent'});db[_0x2917('0xe1')][_0x2917('0x10b')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0x2917('0x1d0')});db[_0x2917('0xe1')][_0x2917('0x10b')](db[_0x2917('0x58')],{'foreignKey':'ToChatWebsiteId','as':_0x2917('0x1d2')});db[_0x2917('0xe3')]['belongsTo'](db[_0x2917('0x4a')],{});db['FaxTransferReport'][_0x2917('0x10b')](db['FaxInteraction'],{});db[_0x2917('0xe3')][_0x2917('0x10b')](db[_0x2917('0x46')],{'foreignKey':_0x2917('0x1d7'),'as':_0x2917('0x1ce')});db[_0x2917('0xe3')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'foreignKey':_0x2917('0x1d4'),'as':_0x2917('0x1d5')});db[_0x2917('0xe3')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'foreignKey':'ToUserId','as':_0x2917('0x1cf')});db[_0x2917('0xe3')][_0x2917('0x10b')](db[_0x2917('0x4b')],{'foreignKey':_0x2917('0x1d8'),'as':_0x2917('0x1d0')});db[_0x2917('0xe3')][_0x2917('0x10b')](db[_0x2917('0x46')],{'foreignKey':_0x2917('0x1d9'),'as':'ToAccount'});db[_0x2917('0xe4')]['belongsTo'](db[_0x2917('0x55')],{});db[_0x2917('0xe4')][_0x2917('0x10b')](db[_0x2917('0x119')],{});db[_0x2917('0xe4')][_0x2917('0x10b')](db['OpenchannelAccount'],{'foreignKey':_0x2917('0x1da'),'as':_0x2917('0x1ce')});db['OpenchannelTransferReport'][_0x2917('0x10b')](db[_0x2917('0xf9')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x2917('0xe4')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'foreignKey':_0x2917('0x1d6'),'as':_0x2917('0x1cf')});db[_0x2917('0xe4')][_0x2917('0x10b')](db[_0x2917('0x56')],{'foreignKey':_0x2917('0x1db'),'as':'ToQueue'});db[_0x2917('0xe4')][_0x2917('0x10b')](db['OpenchannelAccount'],{'foreignKey':_0x2917('0x1dc'),'as':'ToAccount'});db[_0x2917('0xe6')]['belongsTo'](db['SmsMessage'],{});db[_0x2917('0xe6')]['belongsTo'](db[_0x2917('0x117')],{});db[_0x2917('0xe6')][_0x2917('0x10b')](db['SmsAccount'],{'foreignKey':_0x2917('0x1dd'),'as':_0x2917('0x1ce')});db[_0x2917('0xe6')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'foreignKey':'FromUserId','as':_0x2917('0x1d5')});db['SmsTransferReport'][_0x2917('0x10b')](db[_0x2917('0xf9')],{'foreignKey':_0x2917('0x1d6'),'as':_0x2917('0x1cf')});db[_0x2917('0xe6')]['belongsTo'](db['SmsQueue'],{'foreignKey':_0x2917('0x1de'),'as':_0x2917('0x1d0')});db['SmsTransferReport'][_0x2917('0x10b')](db[_0x2917('0x4e')],{'foreignKey':_0x2917('0x1df'),'as':_0x2917('0x1d2')});db[_0x2917('0x144')][_0x2917('0xfa')](db[_0x2917('0x76')],{'as':_0x2917('0x155'),'foreignKey':_0x2917('0x159')});db[_0x2917('0x144')][_0x2917('0xfa')](db[_0x2917('0x70')],{'as':'CustomFields','foreignKey':_0x2917('0x159')});db[_0x2917('0x144')][_0x2917('0xfa')](db[_0x2917('0x67')],{'as':_0x2917('0x110'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x159')});db[_0x2917('0x144')][_0x2917('0xfa')](db[_0x2917('0x6b')],{'as':_0x2917('0xfe'),'foreignKey':_0x2917('0x159')});db[_0x2917('0x144')][_0x2917('0xfa')](db[_0x2917('0x6d')],{'as':_0x2917('0xff'),'foreignKey':'ListId'});db[_0x2917('0x144')][_0x2917('0xfa')](db[_0x2917('0x100')],{'as':_0x2917('0x100'),'foreignKey':_0x2917('0x159')});db[_0x2917('0x144')][_0x2917('0x10c')](db['VoiceQueue'],{'as':_0x2917('0x1e0'),'through':_0x2917('0x145')});db[_0x2917('0x144')][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':_0x2917('0x15c'),'through':_0x2917('0x113')});db[_0x2917('0xe8')]['hasMany'](db['VoiceExtension'],{'as':_0x2917('0xfd'),'onDelete':_0x2917('0xf7')});db[_0x2917('0xe8')][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':_0x2917('0x15c'),'through':_0x2917('0x126')});db[_0x2917('0xe9')][_0x2917('0xfa')](db['User'],{'as':_0x2917('0x165'),'foreignKey':'userProfileId'});db[_0x2917('0xe9')][_0x2917('0xfa')](db[_0x2917('0xea')],{'as':'UserProfileSections','foreignKey':_0x2917('0x1e1'),'onDelete':_0x2917('0xf7')});db[_0x2917('0xea')][_0x2917('0xfa')](db[_0x2917('0xeb')],{'as':_0x2917('0x1e2'),'foreignKey':_0x2917('0x1e3'),'onDelete':_0x2917('0xf7')});db[_0x2917('0xef')]['hasMany'](db['Disposition'],{'as':_0x2917('0x155'),'foreignKey':_0x2917('0x1e4')});db[_0x2917('0xef')][_0x2917('0xfa')](db[_0x2917('0x74')],{'as':_0x2917('0x156'),'foreignKey':'WhatsappAccountId'});db[_0x2917('0xef')][_0x2917('0xfa')](db[_0x2917('0x1e5')],{'as':'Messages','foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x2917('0xfa')](db[_0x2917('0xf2')],{'as':'Interactions'});db[_0x2917('0xef')][_0x2917('0xfa')](db[_0x2917('0x1e6')],{'as':_0x2917('0x158')});db[_0x2917('0xef')][_0x2917('0x10b')](db['CmList'],{'as':_0x2917('0x16a'),'foreignKey':_0x2917('0x159')});db[_0x2917('0xef')][_0x2917('0x10b')](db[_0x2917('0x7b')],{'as':_0x2917('0x15b'),'foreignKey':_0x2917('0x143')});db['WhatsappAccount'][_0x2917('0x10c')](db[_0x2917('0xf9')],{'as':_0x2917('0x15c'),'through':'user_has_whatsapp_accounts'});db[_0x2917('0x1e6')]['belongsTo'](db[_0x2917('0xf9')],{'onDelete':_0x2917('0x168')});db['WhatsappApplication']['belongsTo'](db[_0x2917('0x123')],{'onDelete':_0x2917('0x168')});db['WhatsappApplication'][_0x2917('0x10b')](db[_0x2917('0xef')],{'onDelete':_0x2917('0x168')});db[_0x2917('0x1e6')]['belongsTo'](db[_0x2917('0x79')],{'onDelete':_0x2917('0x168'),'foreignKey':_0x2917('0x142')});db[_0x2917('0x1e6')][_0x2917('0x10b')](db['Tag'],{'onDelete':_0x2917('0x168'),'foreignKey':_0x2917('0x169')});db[_0x2917('0xf2')][_0x2917('0xfa')](db[_0x2917('0x1e5')],{'as':_0x2917('0x149'),'onDelete':_0x2917('0xf7'),'foreignKey':_0x2917('0x1e7')});db[_0x2917('0xf2')][_0x2917('0x10b')](db['WhatsappAccount'],{'as':_0x2917('0x15f'),'foreignKey':_0x2917('0x1e4')});db[_0x2917('0xf2')][_0x2917('0x10b')](db['CmContact'],{'as':_0x2917('0x150'),'foreignKey':_0x2917('0x151')});db[_0x2917('0xf2')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'as':_0x2917('0x160'),'foreignKey':_0x2917('0xf8')});db[_0x2917('0xf2')]['belongsToMany'](db[_0x2917('0x161')],{'through':_0x2917('0x1a1'),'as':_0x2917('0x163')});db['WhatsappInteraction'][_0x2917('0x10c')](db['Tag'],{'through':_0x2917('0x1a1'),'as':'ThroughTags'});db[_0x2917('0xf2')]['belongsToMany'](db['User'],{'as':_0x2917('0x165'),'through':_0x2917('0x11c'),'foreignKey':_0x2917('0x1e7')});db[_0x2917('0x1e5')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'as':_0x2917('0xf9')});db[_0x2917('0x1e5')][_0x2917('0x10b')](db['CmContact'],{'onDelete':_0x2917('0xf7'),'as':_0x2917('0x150')});db['WhatsappMessage'][_0x2917('0x10b')](db['WhatsappInteraction'],{'onDelete':_0x2917('0xf7'),'as':_0x2917('0x179'),'foreignKey':_0x2917('0x1e7')});db[_0x2917('0x1e5')][_0x2917('0x10b')](db[_0x2917('0xef')],{'as':'Account','foreignKey':_0x2917('0x1e4')});db['WhatsappQueueReport'][_0x2917('0x10b')](db['WhatsappAccount'],{});db[_0x2917('0x1e8')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x2917('0x159')});db[_0x2917('0x1e8')][_0x2917('0x10b')](db[_0x2917('0x67')],{'as':_0x2917('0x150'),'foreignKey':_0x2917('0x151')});db[_0x2917('0x1e8')][_0x2917('0x10b')](db[_0x2917('0xf2')],{});db[_0x2917('0x1e8')][_0x2917('0x10b')](db[_0x2917('0x123')],{});db[_0x2917('0x1e8')][_0x2917('0x10b')](db['WhatsappMessage'],{});db[_0x2917('0x1e8')][_0x2917('0x10b')](db['User'],{});db[_0x2917('0x1e9')][_0x2917('0x10b')](db['WhatsappMessage'],{});db['WhatsappTransferReport'][_0x2917('0x10b')](db[_0x2917('0xf2')],{});db[_0x2917('0x1e9')][_0x2917('0x10b')](db[_0x2917('0xef')],{'foreignKey':'FromWhatsappAccountId','as':_0x2917('0x1ce')});db['WhatsappTransferReport'][_0x2917('0x10b')](db[_0x2917('0xef')],{'foreignKey':_0x2917('0x1ea'),'as':_0x2917('0x1d2')});db[_0x2917('0x1e9')][_0x2917('0x10b')](db[_0x2917('0x123')],{'foreignKey':_0x2917('0x1eb'),'as':_0x2917('0x1d0')});db[_0x2917('0x1e9')][_0x2917('0x10b')](db[_0x2917('0xf9')],{'foreignKey':'FromUserId','as':_0x2917('0x1d5')});db[_0x2917('0x1e9')][_0x2917('0x10b')](db['User'],{'foreignKey':_0x2917('0x1d6'),'as':'ToAgent'});db['WhatsappQueue']['belongsToMany'](db[_0x2917('0xf9')],{'as':_0x2917('0x15c'),'through':'UserWhatsappQueue','foreignKey':_0x2917('0x1ec')});db[_0x2917('0x123')][_0x2917('0x10c')](db['Team'],{'through':_0x2917('0x1c7'),'as':_0x2917('0x146')});module[_0x2917('0x1ed')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xdc36=['../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','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','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','UserId','Recordings','hasMany','VoiceQueuesRt','VoiceExtension','Extensions','cascade','HopperFinals','HopperHistory','ReportAgentPreview','ChatInteractions','SmsInteractions','FaxInteraction','MailInteractions','WhatsappInteraction','WhatsappInteractions','Notifications','SenderId','UserNotifications','belongsTo','UserProfile','userProfileId','chat_group_has_users','belongsToMany','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_sms_interactions','OpenchannelInteractions','UserMailQueue','ChatQueue','ChatQueues','FaxQueue','FaxQueues','OpenchannelQueues','WhatsappQueues','VoicePrefixes','user_has_chat_websites','FaxAccounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Members','Hoppers','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','voice_queues_has_cm_lists','BlackLists','Messages','mailboxuser','mailbox','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','ContactId','MailServerIn','MailAccountId','MailServerOut','Answers','Interactions','List','TemplateId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','team_has_mail_queues','Teams','Contact','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','Account','restrict','MailQueue','TagId','Dispositions','FaxAccountId','FaxMessage','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','user_has_fax_interactions','ListId','SmsAccountId','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','AttachmentId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','ChatOfflineMessage','CompanyId','cm_contact_has_tags','OwnerId','Automation','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','ParentId','Intervals','MailApplications','ChatApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','Trigger','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','MetricId','Configurations','AccountId','Subjects','Descriptions','SubjectId','DescriptionId','Variable','Subject','Description','Field','FieldId','VariableId','DeskAccount','ZohoField','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerField','Dynamics365Account','Dynamics365Field','FromId','ToId','JscriptyQuestionReport','JscriptyAnswerReport','SessionId','ProjectId','team_has_voice_queues','VoiceQueues','MailQueues','team_has_chat_queues','team_has_fax_queues','SmsQueues','team_has_whatsapp_queues','CampaignId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ChatTransferReport','FromChatWebsiteId','FromAccount','ToChatQueueId','ToQueue','ToChatWebsiteId','ToAccount','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','user_has_voice_prefixes','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','user_has_whatsapp_interactions','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','path','sequelize','lodash','determine','defaultsDeep','motion2','xcall','xC@LL1234','mysql','utf8mb4','name','utf8','sequelizeHistory','127.0.0.1','utf8_general_ci','database','username','password','options','User','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','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','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmHopper'];(function(_0xe91fe7,_0x5682c8){var _0x5674db=function(_0x254b1b){while(--_0x254b1b){_0xe91fe7['push'](_0xe91fe7['shift']());}};_0x5674db(++_0x5682c8);}(_0xdc36,0x18c));var _0x6dc3=function(_0x285b48,_0x41b4c6){_0x285b48=_0x285b48-0x0;var _0x5020e9=_0xdc36[_0x285b48];return _0x5020e9;};'use strict';var path=require(_0x6dc3('0x0'));var config=require('../config/environment');var Sequelize=require(_0x6dc3('0x1'));var _=require(_0x6dc3('0x2'));var jstz=require('jstz');var timezone=jstz[_0x6dc3('0x3')]();config[_0x6dc3('0x1')]=_[_0x6dc3('0x4')](config['sequelize'],{'database':_0x6dc3('0x5'),'username':_0x6dc3('0x6'),'password':_0x6dc3('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x6dc3('0x8'),'dialectOptions':{'charset':_0x6dc3('0x9')},'logging':![],'timezone':timezone[_0x6dc3('0xa')](),'define':{'charset':_0x6dc3('0xb'),'collate':'utf8_general_ci'}}});config[_0x6dc3('0xc')]=_[_0x6dc3('0x4')](config['sequelizeHistory'],{'database':_0x6dc3('0x5'),'username':_0x6dc3('0x6'),'password':_0x6dc3('0x7'),'options':{'host':_0x6dc3('0xd'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x6dc3('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x6dc3('0xb'),'collate':_0x6dc3('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x6dc3('0x1')][_0x6dc3('0xf')],config[_0x6dc3('0x1')][_0x6dc3('0x10')],config[_0x6dc3('0x1')][_0x6dc3('0x11')],config['sequelize'][_0x6dc3('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x6dc3('0xc')][_0x6dc3('0xf')],config[_0x6dc3('0xc')]['username'],config[_0x6dc3('0xc')][_0x6dc3('0x11')],config[_0x6dc3('0xc')][_0x6dc3('0x12')])};db[_0x6dc3('0x13')]=db['sequelize']['import']('../api/user/user.model');db[_0x6dc3('0x14')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x16'));db[_0x6dc3('0x17')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x18'));db['VoiceExtension']=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x19'));db[_0x6dc3('0x1a')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x6dc3('0x1b')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x1c'));db[_0x6dc3('0x1d')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x1e'));db[_0x6dc3('0x1f')]=db[_0x6dc3('0x1')]['import'](_0x6dc3('0x20'));db[_0x6dc3('0x21')]=db['sequelize'][_0x6dc3('0x15')]('../api/voiceMail/voiceMail.model');db[_0x6dc3('0x22')]=db['sequelize']['import'](_0x6dc3('0x23'));db['VoiceCallReport']=db[_0x6dc3('0x1')][_0x6dc3('0x15')]('../api/voiceCallReport/voiceCallReport.model');db[_0x6dc3('0x24')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x25'));db['VoiceAgentReport']=db['sequelize'][_0x6dc3('0x15')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x6dc3('0x26')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x6dc3('0x27')]=db[_0x6dc3('0x1')]['import'](_0x6dc3('0x28'));db[_0x6dc3('0x29')]=db[_0x6dc3('0x1')]['import'](_0x6dc3('0x2a'));db['VoiceTransferReport']=db['sequelize'][_0x6dc3('0x15')](_0x6dc3('0x2b'));db[_0x6dc3('0x2c')]=db[_0x6dc3('0x1')]['import']('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x6dc3('0x2d')]=db['sequelize'][_0x6dc3('0x15')](_0x6dc3('0x2e'));db[_0x6dc3('0x2f')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x30'));db['UserMailQueue']=db['sequelize'][_0x6dc3('0x15')](_0x6dc3('0x31'));db[_0x6dc3('0x32')]=db['sequelize'][_0x6dc3('0x15')](_0x6dc3('0x33'));db[_0x6dc3('0x34')]=db[_0x6dc3('0x1')]['import'](_0x6dc3('0x35'));db[_0x6dc3('0x36')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x6dc3('0x37')]=db['sequelize'][_0x6dc3('0x15')](_0x6dc3('0x38'));db['MailServerIn']=db[_0x6dc3('0x1')][_0x6dc3('0x15')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db['sequelize'][_0x6dc3('0x15')](_0x6dc3('0x39'));db['MailAccount']=db[_0x6dc3('0x1')]['import'](_0x6dc3('0x3a'));db['MailQueue']=db['sequelize']['import'](_0x6dc3('0x3b'));db['MailSubstatus']=db[_0x6dc3('0x1')]['import'](_0x6dc3('0x3c'));db[_0x6dc3('0x3d')]=db[_0x6dc3('0x1')]['import'](_0x6dc3('0x3e'));db[_0x6dc3('0x3f')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x40'));db[_0x6dc3('0x41')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')]('../api/mailApplication/mailApplication.model');db[_0x6dc3('0x42')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x43'));db[_0x6dc3('0x44')]=db['sequelize'][_0x6dc3('0x15')]('../api/dashboard/dashboard.model');db[_0x6dc3('0x45')]=db['sequelize'][_0x6dc3('0x15')](_0x6dc3('0x46'));db[_0x6dc3('0x47')]=db[_0x6dc3('0x1')]['import']('../api/faxAccount/faxAccount.model');db[_0x6dc3('0x48')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x49'));db['FaxInteraction']=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x4a'));db['FaxMessage']=db[_0x6dc3('0x1')][_0x6dc3('0x15')]('../api/faxMessage/faxMessage.model');db['FaxQueue']=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x4b'));db[_0x6dc3('0x4c')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x4d'));db[_0x6dc3('0x4e')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x4f'));db[_0x6dc3('0x50')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x51'));db[_0x6dc3('0x52')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x53'));db[_0x6dc3('0x54')]=db[_0x6dc3('0x1')]['import'](_0x6dc3('0x55'));db[_0x6dc3('0x56')]=db[_0x6dc3('0x1')]['import'](_0x6dc3('0x57'));db[_0x6dc3('0x58')]=db['sequelize'][_0x6dc3('0x15')](_0x6dc3('0x59'));db['OpenchannelApplication']=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x5a'));db[_0x6dc3('0x5b')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x5c'));db[_0x6dc3('0x5d')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x5e'));db[_0x6dc3('0x5f')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x60'));db[_0x6dc3('0x61')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')]('../api/chatWebsite/chatWebsite.model');db[_0x6dc3('0x62')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x63'));db[_0x6dc3('0x64')]=db[_0x6dc3('0x1')]['import'](_0x6dc3('0x65'));db[_0x6dc3('0x66')]=db['sequelize']['import'](_0x6dc3('0x67'));db[_0x6dc3('0x68')]=db['sequelize'][_0x6dc3('0x15')](_0x6dc3('0x69'));db['ChatOfflineMessage']=db['sequelize']['import'](_0x6dc3('0x6a'));db['ChatQueue']=db[_0x6dc3('0x1')][_0x6dc3('0x15')]('../api/chatQueue/chatQueue.model');db[_0x6dc3('0x6b')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')]('../api/chatGroup/chatGroup.model');db[_0x6dc3('0x6c')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x6d'));db[_0x6dc3('0x6e')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x6f'));db['CmContact']=db['sequelize'][_0x6dc3('0x15')]('../api/cmContact/cmContact.model');db[_0x6dc3('0x70')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x71'));db[_0x6dc3('0x72')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x73'));db[_0x6dc3('0x74')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x6dc3('0x75')]=db[_0x6dc3('0x1')]['import'](_0x6dc3('0x76'));db['ReportAgentPreview']=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x77'));db[_0x6dc3('0x78')]=db['sequelize'][_0x6dc3('0x15')](_0x6dc3('0x79'));db[_0x6dc3('0x7a')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')]('../api/action/action.model');db['Automation']=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x7b'));db[_0x6dc3('0x7c')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x7d'));db[_0x6dc3('0x7e')]=db['sequelize'][_0x6dc3('0x15')](_0x6dc3('0x7f'));db[_0x6dc3('0x80')]=db[_0x6dc3('0x1')]['import'](_0x6dc3('0x81'));db[_0x6dc3('0x82')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x83'));db[_0x6dc3('0x84')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x85'));db[_0x6dc3('0x86')]=db[_0x6dc3('0x1')]['import'](_0x6dc3('0x87'));db['VoiceQueuesLog']=db['sequelize'][_0x6dc3('0x15')](_0x6dc3('0x88'));db[_0x6dc3('0x89')]=db[_0x6dc3('0x1')]['import'](_0x6dc3('0x8a'));db[_0x6dc3('0x8b')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x8c'));db[_0x6dc3('0x8d')]=db['sequelize'][_0x6dc3('0x15')](_0x6dc3('0x8e'));db[_0x6dc3('0x8f')]=db['sequelize'][_0x6dc3('0x15')]('../api/template/template.model');db['Trigger']=db[_0x6dc3('0x1')]['import'](_0x6dc3('0x90'));db['Variable']=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x91'));db[_0x6dc3('0x92')]=db['sequelize']['import'](_0x6dc3('0x93'));db[_0x6dc3('0x94')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x95'));db[_0x6dc3('0x96')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x97'));db[_0x6dc3('0x98')]=db['sequelize'][_0x6dc3('0x15')](_0x6dc3('0x99'));db[_0x6dc3('0x9a')]=db[_0x6dc3('0x1')]['import'](_0x6dc3('0x9b'));db[_0x6dc3('0x9c')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x9d'));db['AnalyticFieldReport']=db[_0x6dc3('0x1')][_0x6dc3('0x15')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x9e'));db[_0x6dc3('0x9f')]=db['sequelize'][_0x6dc3('0x15')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x6dc3('0xa0')]=db['sequelize'][_0x6dc3('0x15')](_0x6dc3('0xa1'));db[_0x6dc3('0xa2')]=db['sequelize'][_0x6dc3('0x15')](_0x6dc3('0xa3'));db[_0x6dc3('0xa4')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x6dc3('0xa5')]=db['sequelize']['import']('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x6dc3('0xa6')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xa7'));db['DeskAccount']=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xa8'));db[_0x6dc3('0xa9')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xaa'));db[_0x6dc3('0xab')]=db[_0x6dc3('0x1')]['import']('../api/intDeskField/intDeskField.model');db[_0x6dc3('0xac')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xad'));db[_0x6dc3('0xae')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xaf'));db['ZohoField']=db['sequelize']['import'](_0x6dc3('0xb0'));db['ZendeskAccount']=db['sequelize'][_0x6dc3('0x15')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x6dc3('0xb1')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xb2'));db[_0x6dc3('0xb3')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xb4'));db[_0x6dc3('0xb5')]=db['sequelize'][_0x6dc3('0x15')](_0x6dc3('0xb6'));db[_0x6dc3('0xb7')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xb8'));db['FreshdeskField']=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xb9'));db[_0x6dc3('0xba')]=db['sequelize'][_0x6dc3('0x15')](_0x6dc3('0xbb'));db[_0x6dc3('0xbc')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xbd'));db['VtigerField']=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xbe'));db[_0x6dc3('0xbf')]=db[_0x6dc3('0x1')]['import'](_0x6dc3('0xc0'));db[_0x6dc3('0xc1')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xc2'));db[_0x6dc3('0xc3')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xc4'));db['Dynamics365Account']=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xc5'));db[_0x6dc3('0xc6')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xc7'));db['Dynamics365Field']=db[_0x6dc3('0x1')]['import'](_0x6dc3('0xc8'));db[_0x6dc3('0xc9')]=db['sequelize']['import'](_0x6dc3('0xca'));db[_0x6dc3('0xcb')]=db['sequelize'][_0x6dc3('0x15')](_0x6dc3('0xcc'));db[_0x6dc3('0xcd')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xce'));db[_0x6dc3('0x92')]=db[_0x6dc3('0x1')]['import'](_0x6dc3('0x93'));db[_0x6dc3('0xcf')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xd0'));db[_0x6dc3('0xd1')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')]('../api/chatQueueReport/chatQueueReport.model');db[_0x6dc3('0xd2')]=db['sequelize'][_0x6dc3('0x15')](_0x6dc3('0xd3'));db['JscriptyAnswerReport']=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xd4'));db['JscriptyQuestionReport']=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xd5'));db[_0x6dc3('0xd6')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xd7'));db[_0x6dc3('0xd8')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xd9'));db[_0x6dc3('0xda')]=db['sequelize'][_0x6dc3('0x15')]('../api/squareReport/squareReport.model');db[_0x6dc3('0xdb')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xdc'));db[_0x6dc3('0xdd')]=db['sequelize'][_0x6dc3('0x15')](_0x6dc3('0xde'));db[_0x6dc3('0xdf')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xe0'));db[_0x6dc3('0xe1')]=db[_0x6dc3('0x1')]['import'](_0x6dc3('0xe2'));db[_0x6dc3('0xe3')]=db[_0x6dc3('0x1')]['import'](_0x6dc3('0xe4'));db[_0x6dc3('0xe5')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xe6'));db['SquareMessage']=db[_0x6dc3('0x1')]['import'](_0x6dc3('0xe7'));db[_0x6dc3('0xe8')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xe9'));db[_0x6dc3('0xea')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xeb'));db[_0x6dc3('0xec')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xed'));db[_0x6dc3('0xee')]=db[_0x6dc3('0x1')]['import']('../api/migration/migration.model');db[_0x6dc3('0xef')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xf0'));db[_0x6dc3('0xf1')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')]('../api/plugin/plugin.model');db[_0x6dc3('0xf2')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xf3'));db['ChatTransferReport']=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xf4'));db['FaxTransferReport']=db['sequelize']['import'](_0x6dc3('0xf5'));db[_0x6dc3('0xf6')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xf7'));db['SmsTransferReport']=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xf8'));db[_0x6dc3('0xf9')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xfa'));db[_0x6dc3('0xfb')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xfc'));db['UserProfile']=db['sequelize']['import']('../api/userProfile/userProfile.model');db['UserProfileSection']=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xfd'));db[_0x6dc3('0xfe')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0xff'));db[_0x6dc3('0x100')]=db[_0x6dc3('0x1')]['import']('../api/notification/notification.model');db['UserNotification']=db['sequelize'][_0x6dc3('0x15')](_0x6dc3('0x101'));db[_0x6dc3('0x102')]=db[_0x6dc3('0x1')]['import'](_0x6dc3('0x103'));db[_0x6dc3('0x104')]=db['sequelize'][_0x6dc3('0x15')](_0x6dc3('0x105'));db['WhatsappInteraction']=db[_0x6dc3('0x1')]['import'](_0x6dc3('0x106'));db[_0x6dc3('0x107')]=db['sequelize'][_0x6dc3('0x15')](_0x6dc3('0x108'));db['WhatsappQueueReport']=db['sequelize']['import'](_0x6dc3('0x109'));db[_0x6dc3('0x10a')]=db['sequelize']['import']('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x6dc3('0x10b')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')]('../api/whatsappQueue/whatsappQueue.model');db[_0x6dc3('0x10c')]=db[_0x6dc3('0x1')][_0x6dc3('0x15')](_0x6dc3('0x10d'));db['User'][_0x6dc3('0x10e')](db[_0x6dc3('0x21')],{'as':_0x6dc3('0x21'),'onDelete':'cascade','foreignKey':_0x6dc3('0x10f')});db[_0x6dc3('0x13')]['hasMany'](db['VoiceRecording'],{'as':_0x6dc3('0x110'),'foreignKey':_0x6dc3('0x10f')});db[_0x6dc3('0x13')][_0x6dc3('0x111')](db[_0x6dc3('0x2c')],{'as':_0x6dc3('0x112'),'foreignKey':_0x6dc3('0x10f')});db[_0x6dc3('0x13')]['hasMany'](db[_0x6dc3('0x113')],{'as':_0x6dc3('0x114'),'onDelete':_0x6dc3('0x115'),'hooks':!![]});db['User']['hasMany'](db['CmHopperFinal'],{'as':_0x6dc3('0x116'),'foreignKey':_0x6dc3('0x10f')});db['User'][_0x6dc3('0x111')](db[_0x6dc3('0x75')],{'as':_0x6dc3('0x117'),'foreignKey':_0x6dc3('0x10f')});db[_0x6dc3('0x13')][_0x6dc3('0x111')](db[_0x6dc3('0x118')],{'as':_0x6dc3('0x118'),'foreignKey':_0x6dc3('0x10f')});db['User'][_0x6dc3('0x111')](db[_0x6dc3('0x5b')],{'as':'OpenchannelInteractions','foreignKey':_0x6dc3('0x10f')});db[_0x6dc3('0x13')][_0x6dc3('0x111')](db[_0x6dc3('0x66')],{'as':_0x6dc3('0x119'),'foreignKey':_0x6dc3('0x10f')});db[_0x6dc3('0x13')][_0x6dc3('0x111')](db[_0x6dc3('0x52')],{'as':_0x6dc3('0x11a'),'foreignKey':_0x6dc3('0x10f')});db['User'][_0x6dc3('0x111')](db[_0x6dc3('0x11b')],{'as':'FaxInteractions','foreignKey':_0x6dc3('0x10f')});db['User']['hasMany'](db[_0x6dc3('0x3d')],{'as':_0x6dc3('0x11c'),'foreignKey':'UserId'});db[_0x6dc3('0x13')][_0x6dc3('0x111')](db[_0x6dc3('0x11d')],{'as':_0x6dc3('0x11e'),'foreignKey':_0x6dc3('0x10f')});db[_0x6dc3('0x13')][_0x6dc3('0x111')](db[_0x6dc3('0x100')],{'as':_0x6dc3('0x11f'),'foreignKey':_0x6dc3('0x120')});db[_0x6dc3('0x13')]['hasMany'](db['UserNotification'],{'as':_0x6dc3('0x121'),'foreignKey':_0x6dc3('0x120')});db[_0x6dc3('0x13')][_0x6dc3('0x122')](db[_0x6dc3('0x123')],{'as':_0x6dc3('0x123'),'foreignKey':_0x6dc3('0x124')});db[_0x6dc3('0x13')]['belongsToMany'](db[_0x6dc3('0x6b')],{'as':'Groups','through':_0x6dc3('0x125')});db[_0x6dc3('0x13')][_0x6dc3('0x126')](db[_0x6dc3('0x127')],{'as':_0x6dc3('0x128'),'through':_0x6dc3('0x129')});db[_0x6dc3('0x13')][_0x6dc3('0x126')](db[_0x6dc3('0xf9')],{'as':_0x6dc3('0x12a'),'through':_0x6dc3('0x12b')});db[_0x6dc3('0x13')][_0x6dc3('0x126')](db['Team'],{'through':_0x6dc3('0x12c')});db[_0x6dc3('0x13')][_0x6dc3('0x126')](db[_0x6dc3('0x3d')],{'as':_0x6dc3('0x11c'),'through':_0x6dc3('0x12d')});db[_0x6dc3('0x13')][_0x6dc3('0x126')](db['ChatInteraction'],{'as':_0x6dc3('0x119'),'through':_0x6dc3('0x12e')});db[_0x6dc3('0x13')]['belongsToMany'](db[_0x6dc3('0x11b')],{'as':_0x6dc3('0x12f'),'through':'user_has_fax_interactions'});db['User']['belongsToMany'](db[_0x6dc3('0x52')],{'as':_0x6dc3('0x11a'),'through':_0x6dc3('0x130')});db['User'][_0x6dc3('0x126')](db[_0x6dc3('0x5b')],{'as':_0x6dc3('0x131'),'through':'user_has_openchannel_interactions'});db[_0x6dc3('0x13')][_0x6dc3('0x126')](db[_0x6dc3('0x11d')],{'as':_0x6dc3('0x11e'),'through':'user_has_whatsapp_interactions'});db[_0x6dc3('0x13')][_0x6dc3('0x126')](db[_0x6dc3('0x1b')],{'as':'VoiceQueues','through':_0x6dc3('0x2d'),'required':![]});db[_0x6dc3('0x13')][_0x6dc3('0x126')](db['MailQueue'],{'as':'MailQueues','through':_0x6dc3('0x132'),'required':![]});db[_0x6dc3('0x13')][_0x6dc3('0x126')](db[_0x6dc3('0x133')],{'as':_0x6dc3('0x134'),'through':_0x6dc3('0x2f'),'required':![],'hooks':!![]});db[_0x6dc3('0x13')][_0x6dc3('0x126')](db[_0x6dc3('0x135')],{'as':_0x6dc3('0x136'),'through':'UserFaxQueue','required':![]});db['User'][_0x6dc3('0x126')](db[_0x6dc3('0x56')],{'as':'SmsQueues','through':_0x6dc3('0x34'),'required':![]});db[_0x6dc3('0x13')][_0x6dc3('0x126')](db[_0x6dc3('0x5f')],{'as':_0x6dc3('0x137'),'through':_0x6dc3('0x36'),'required':![]});db[_0x6dc3('0x13')][_0x6dc3('0x126')](db[_0x6dc3('0x10b')],{'as':_0x6dc3('0x138'),'through':'UserWhatsappQueue','required':![]});db[_0x6dc3('0x13')][_0x6dc3('0x126')](db['CmList'],{'through':'cm_user_has_lists'});db[_0x6dc3('0x13')][_0x6dc3('0x126')](db[_0x6dc3('0xfb')],{'as':_0x6dc3('0x139'),'through':'user_has_voice_prefixes','required':![]});db[_0x6dc3('0x13')][_0x6dc3('0x126')](db[_0x6dc3('0x61')],{'as':'ChatWebsites','through':_0x6dc3('0x13a')});db[_0x6dc3('0x13')]['belongsToMany'](db['FaxAccount'],{'as':_0x6dc3('0x13b'),'through':'user_has_fax_accounts'});db[_0x6dc3('0x13')][_0x6dc3('0x126')](db[_0x6dc3('0x13c')],{'as':_0x6dc3('0x13d'),'through':_0x6dc3('0x13e')});db[_0x6dc3('0x13')][_0x6dc3('0x126')](db['OpenchannelAccount'],{'as':_0x6dc3('0x13f'),'through':_0x6dc3('0x140')});db['User'][_0x6dc3('0x126')](db[_0x6dc3('0x4e')],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db[_0x6dc3('0x13')]['belongsToMany'](db[_0x6dc3('0x102')],{'as':'WhatsappAccounts','through':_0x6dc3('0x141')});db[_0x6dc3('0x13')]['belongsToMany'](db[_0x6dc3('0xe3')],{'as':_0x6dc3('0x142'),'through':_0x6dc3('0x143')});db[_0x6dc3('0x14')][_0x6dc3('0x111')](db['VoiceExtension'],{'as':_0x6dc3('0x144'),'onDelete':'cascade','foreignKey':_0x6dc3('0x145')});db['VoiceContext'][_0x6dc3('0x111')](db[_0x6dc3('0x113')],{'onDelete':_0x6dc3('0x115')});db[_0x6dc3('0x113')][_0x6dc3('0x111')](db[_0x6dc3('0x113')],{'as':_0x6dc3('0x146'),'onDelete':_0x6dc3('0x115')});db[_0x6dc3('0x1a')][_0x6dc3('0x126')](db['Sound'],{'as':'Sounds','through':'moh_has_sounds'});db['VoiceQueue'][_0x6dc3('0x111')](db['UserVoiceQueueRt'],{'as':_0x6dc3('0x147'),'foreignKey':'VoiceQueueId'});db[_0x6dc3('0x1b')][_0x6dc3('0x111')](db[_0x6dc3('0x70')],{'as':_0x6dc3('0x148'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x6dc3('0x111')](db[_0x6dc3('0x74')],{'as':_0x6dc3('0x116'),'foreignKey':_0x6dc3('0x149')});db[_0x6dc3('0x1b')][_0x6dc3('0x111')](db[_0x6dc3('0x75')],{'as':_0x6dc3('0x14a'),'foreignKey':_0x6dc3('0x149')});db['VoiceQueue']['hasMany'](db[_0x6dc3('0x118')],{'as':'ReportAgentPreview','foreignKey':_0x6dc3('0x149')});db[_0x6dc3('0x1b')]['hasMany'](db['CmHopperBlack'],{'as':_0x6dc3('0x14b'),'foreignKey':'VoiceQueueId'});db[_0x6dc3('0x1b')][_0x6dc3('0x111')](db[_0x6dc3('0xd6')],{'as':_0x6dc3('0x14c'),'foreignKey':_0x6dc3('0x149')});db[_0x6dc3('0x1b')]['belongsTo'](db[_0x6dc3('0x29')],{'as':_0x6dc3('0x29'),'foreignKey':_0x6dc3('0x14d')});db[_0x6dc3('0x1b')][_0x6dc3('0x122')](db['Trunk'],{'as':_0x6dc3('0x14e'),'foreignKey':_0x6dc3('0x14f')});db[_0x6dc3('0x1b')]['belongsTo'](db[_0x6dc3('0x82')],{'as':'Interval','foreignKey':_0x6dc3('0x150')});db[_0x6dc3('0x1b')][_0x6dc3('0x122')](db[_0x6dc3('0x84')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x6dc3('0x1b')][_0x6dc3('0x126')](db[_0x6dc3('0xf9')],{'as':'Lists','through':_0x6dc3('0x151')});db[_0x6dc3('0x1b')][_0x6dc3('0x126')](db[_0x6dc3('0x13')],{'as':'Agents','through':_0x6dc3('0x2d')});db[_0x6dc3('0x1b')][_0x6dc3('0x126')](db[_0x6dc3('0xe8')],{'as':'Teams','through':'team_has_voice_queues'});db[_0x6dc3('0x1b')][_0x6dc3('0x126')](db[_0x6dc3('0xf9')],{'as':_0x6dc3('0x152'),'through':'voice_queues_has_cm_blacklists'});db[_0x6dc3('0x1d')][_0x6dc3('0x122')](db[_0x6dc3('0x13')],{'as':_0x6dc3('0x13'),'foreignKey':_0x6dc3('0x10f')});db[_0x6dc3('0x1f')][_0x6dc3('0x122')](db['User'],{'as':'User','foreignKey':_0x6dc3('0x10f')});db[_0x6dc3('0x21')][_0x6dc3('0x111')](db[_0x6dc3('0x22')],{'as':_0x6dc3('0x153'),'onDelete':_0x6dc3('0x115'),'foreignKey':_0x6dc3('0x154'),'sourceKey':_0x6dc3('0x155')});db[_0x6dc3('0x22')][_0x6dc3('0x122')](db['VoiceMail'],{'foreignKey':_0x6dc3('0x154'),'targetKey':_0x6dc3('0x155')});db[_0x6dc3('0x156')][_0x6dc3('0x111')](db[_0x6dc3('0x26')],{'as':_0x6dc3('0x157'),'foreignKey':_0x6dc3('0x158'),'constraints':![]});db[_0x6dc3('0x156')][_0x6dc3('0x111')](db[_0x6dc3('0x159')],{'as':_0x6dc3('0x15a'),'foreignKey':_0x6dc3('0x158'),'constraints':![]});db[_0x6dc3('0x156')][_0x6dc3('0x122')](db['User'],{'as':'User','foreignKey':_0x6dc3('0x10f')});db['VoiceCallReport']['belongsTo'](db[_0x6dc3('0x127')],{'as':'Contact','foreignKey':_0x6dc3('0x15b')});db[_0x6dc3('0x15c')][_0x6dc3('0x122')](db[_0x6dc3('0x13c')],{'as':_0x6dc3('0x13c'),'foreignKey':_0x6dc3('0x15d')});db[_0x6dc3('0x15e')][_0x6dc3('0x122')](db[_0x6dc3('0x13c')],{'as':_0x6dc3('0x13c'),'foreignKey':_0x6dc3('0x15d')});db['MailAccount'][_0x6dc3('0x10e')](db['MailServerIn'],{'as':'Imap','onDelete':_0x6dc3('0x115')});db['MailAccount']['hasOne'](db[_0x6dc3('0x15e')],{'as':'Smtp','onDelete':'cascade'});db[_0x6dc3('0x13c')][_0x6dc3('0x111')](db[_0x6dc3('0x7e')],{'as':'Dispositions','foreignKey':'MailAccountId'});db[_0x6dc3('0x13c')][_0x6dc3('0x111')](db[_0x6dc3('0x7c')],{'as':_0x6dc3('0x15f'),'foreignKey':_0x6dc3('0x15d')});db[_0x6dc3('0x13c')]['hasMany'](db[_0x6dc3('0x3f')],{'as':_0x6dc3('0x153'),'foreignKey':_0x6dc3('0x15d')});db[_0x6dc3('0x13c')]['hasMany'](db['MailInteraction'],{'as':_0x6dc3('0x160')});db['MailAccount'][_0x6dc3('0x111')](db[_0x6dc3('0x41')],{'as':'Applications'});db[_0x6dc3('0x13c')][_0x6dc3('0x122')](db[_0x6dc3('0xf9')],{'as':_0x6dc3('0x161'),'foreignKey':'ListId'});db[_0x6dc3('0x13c')][_0x6dc3('0x122')](db['Template'],{'as':_0x6dc3('0x8f'),'foreignKey':_0x6dc3('0x162')});db[_0x6dc3('0x13c')][_0x6dc3('0x122')](db[_0x6dc3('0x84')],{'as':_0x6dc3('0x163'),'foreignKey':_0x6dc3('0x164')});db[_0x6dc3('0x13c')][_0x6dc3('0x126')](db[_0x6dc3('0x13')],{'as':_0x6dc3('0x165'),'through':'user_has_mail_accounts'});db['MailQueue'][_0x6dc3('0x126')](db[_0x6dc3('0x13')],{'as':_0x6dc3('0x165'),'through':_0x6dc3('0x132')});db['MailQueue'][_0x6dc3('0x126')](db[_0x6dc3('0xe8')],{'through':_0x6dc3('0x166'),'as':_0x6dc3('0x167')});db[_0x6dc3('0x3d')][_0x6dc3('0x111')](db[_0x6dc3('0x3f')],{'as':_0x6dc3('0x153'),'onDelete':_0x6dc3('0x115'),'foreignKey':'MailInteractionId'});db['MailInteraction'][_0x6dc3('0x122')](db[_0x6dc3('0x13c')],{'as':'Account','foreignKey':'MailAccountId'});db[_0x6dc3('0x3d')][_0x6dc3('0x122')](db['CmContact'],{'as':_0x6dc3('0x168'),'foreignKey':_0x6dc3('0x15b')});db[_0x6dc3('0x3d')]['belongsTo'](db[_0x6dc3('0x13')],{'as':_0x6dc3('0x169'),'foreignKey':_0x6dc3('0x10f')});db[_0x6dc3('0x3d')][_0x6dc3('0x126')](db[_0x6dc3('0x8d')],{'through':_0x6dc3('0x16a'),'as':_0x6dc3('0x16b')});db[_0x6dc3('0x3d')][_0x6dc3('0x126')](db[_0x6dc3('0x8d')],{'through':_0x6dc3('0x16a'),'as':_0x6dc3('0x16c')});db[_0x6dc3('0x3d')][_0x6dc3('0x126')](db[_0x6dc3('0x13')],{'as':_0x6dc3('0x16d'),'through':_0x6dc3('0x12d'),'foreignKey':_0x6dc3('0x16e')});db[_0x6dc3('0x3f')][_0x6dc3('0x111')](db[_0x6dc3('0xef')],{'as':_0x6dc3('0x16f'),'onDelete':_0x6dc3('0x115')});db['MailMessage']['belongsTo'](db[_0x6dc3('0x13')],{'as':_0x6dc3('0x13')});db['MailMessage']['belongsTo'](db[_0x6dc3('0x127')],{'onDelete':_0x6dc3('0x115'),'as':_0x6dc3('0x168')});db[_0x6dc3('0x3f')][_0x6dc3('0x122')](db[_0x6dc3('0x3d')],{'as':_0x6dc3('0x170'),'foreignKey':_0x6dc3('0x16e')});db[_0x6dc3('0x3f')][_0x6dc3('0x122')](db[_0x6dc3('0x13c')],{'as':_0x6dc3('0x171'),'foreignKey':_0x6dc3('0x15d')});db[_0x6dc3('0x41')][_0x6dc3('0x122')](db[_0x6dc3('0x13')],{'onDelete':_0x6dc3('0x172')});db[_0x6dc3('0x41')][_0x6dc3('0x122')](db[_0x6dc3('0x173')],{'onDelete':_0x6dc3('0x172')});db[_0x6dc3('0x41')][_0x6dc3('0x122')](db[_0x6dc3('0x13c')],{'onDelete':_0x6dc3('0x172')});db[_0x6dc3('0x41')]['belongsTo'](db[_0x6dc3('0x82')],{'onDelete':_0x6dc3('0x172'),'foreignKey':_0x6dc3('0x150')});db[_0x6dc3('0x41')][_0x6dc3('0x122')](db[_0x6dc3('0x8d')],{'onDelete':'restrict','foreignKey':_0x6dc3('0x174')});db[_0x6dc3('0x42')][_0x6dc3('0x122')](db[_0x6dc3('0x13c')],{});db[_0x6dc3('0x42')][_0x6dc3('0x122')](db['CmList'],{'as':_0x6dc3('0x161'),'foreignKey':'ListId'});db[_0x6dc3('0x42')][_0x6dc3('0x122')](db[_0x6dc3('0x127')],{'as':_0x6dc3('0x168'),'foreignKey':_0x6dc3('0x15b')});db[_0x6dc3('0x42')]['belongsTo'](db[_0x6dc3('0x3d')],{});db[_0x6dc3('0x42')]['belongsTo'](db[_0x6dc3('0x3f')],{});db['MailQueueReport'][_0x6dc3('0x122')](db[_0x6dc3('0x13')],{});db[_0x6dc3('0x42')][_0x6dc3('0x122')](db['MailQueue'],{});db[_0x6dc3('0x44')]['hasMany'](db[_0x6dc3('0x45')],{'as':'Items','onDelete':_0x6dc3('0x115')});db['FaxAccount'][_0x6dc3('0x111')](db['Disposition'],{'as':_0x6dc3('0x175'),'foreignKey':_0x6dc3('0x176')});db[_0x6dc3('0x47')]['hasMany'](db['CannedAnswer'],{'as':_0x6dc3('0x15f'),'foreignKey':'FaxAccountId'});db[_0x6dc3('0x47')][_0x6dc3('0x111')](db['FaxInteraction'],{'as':_0x6dc3('0x160')});db[_0x6dc3('0x47')][_0x6dc3('0x111')](db['FaxApplication'],{'as':_0x6dc3('0x146')});db['FaxAccount']['hasMany'](db[_0x6dc3('0x113')],{'as':'Exntensions','onDelete':_0x6dc3('0x115')});db[_0x6dc3('0x47')]['hasMany'](db[_0x6dc3('0x177')],{'as':_0x6dc3('0x153')});db[_0x6dc3('0x47')][_0x6dc3('0x122')](db['Trunk'],{'as':_0x6dc3('0x29')});db[_0x6dc3('0x47')][_0x6dc3('0x122')](db[_0x6dc3('0xf9')],{'as':'List','foreignKey':'ListId'});db[_0x6dc3('0x47')]['belongsTo'](db['Pause'],{'as':_0x6dc3('0x163'),'foreignKey':_0x6dc3('0x164')});db[_0x6dc3('0x47')][_0x6dc3('0x126')](db[_0x6dc3('0x13')],{'as':'Agents','through':_0x6dc3('0x178')});db['FaxApplication'][_0x6dc3('0x122')](db[_0x6dc3('0x13')],{'onDelete':_0x6dc3('0x172')});db[_0x6dc3('0x48')][_0x6dc3('0x122')](db[_0x6dc3('0x135')],{'onDelete':_0x6dc3('0x172')});db[_0x6dc3('0x48')][_0x6dc3('0x122')](db[_0x6dc3('0x47')],{'onDelete':_0x6dc3('0x172')});db['FaxApplication'][_0x6dc3('0x122')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x6dc3('0x174')});db['FaxInteraction'][_0x6dc3('0x111')](db['FaxMessage'],{'as':_0x6dc3('0x153'),'onDelete':'cascade','foreignKey':_0x6dc3('0x179')});db['FaxInteraction']['belongsTo'](db[_0x6dc3('0x47')],{'as':_0x6dc3('0x171'),'foreignKey':'FaxAccountId'});db[_0x6dc3('0x11b')][_0x6dc3('0x122')](db[_0x6dc3('0x127')],{'as':_0x6dc3('0x168'),'foreignKey':'ContactId'});db[_0x6dc3('0x11b')]['belongsTo'](db[_0x6dc3('0x13')],{'as':_0x6dc3('0x169'),'foreignKey':'UserId'});db['FaxInteraction'][_0x6dc3('0x126')](db[_0x6dc3('0x8d')],{'through':_0x6dc3('0x17a'),'as':_0x6dc3('0x16b')});db[_0x6dc3('0x11b')][_0x6dc3('0x126')](db[_0x6dc3('0x8d')],{'through':_0x6dc3('0x17a'),'as':_0x6dc3('0x16c')});db[_0x6dc3('0x11b')][_0x6dc3('0x126')](db[_0x6dc3('0x13')],{'as':'Users','through':_0x6dc3('0x17b'),'foreignKey':_0x6dc3('0x179')});db[_0x6dc3('0x177')][_0x6dc3('0x122')](db[_0x6dc3('0x13')],{'onDelete':'cascade','as':_0x6dc3('0x13')});db['FaxMessage']['belongsTo'](db['FaxInteraction'],{'as':_0x6dc3('0x170'),'foreignKey':'FaxInteractionId'});db[_0x6dc3('0x177')][_0x6dc3('0x122')](db[_0x6dc3('0x127')],{'onDelete':_0x6dc3('0x115'),'as':'Contact'});db[_0x6dc3('0x177')][_0x6dc3('0x122')](db['Attachment'],{'as':_0x6dc3('0xef'),'foreignKey':'AttachmentId'});db[_0x6dc3('0x177')][_0x6dc3('0x122')](db[_0x6dc3('0x47')],{'as':_0x6dc3('0x171'),'foreignKey':_0x6dc3('0x176')});db[_0x6dc3('0x135')][_0x6dc3('0x126')](db[_0x6dc3('0x13')],{'as':_0x6dc3('0x165'),'through':_0x6dc3('0x32')});db[_0x6dc3('0x135')][_0x6dc3('0x126')](db[_0x6dc3('0xe8')],{'through':'team_has_fax_queues','as':_0x6dc3('0x167')});db['FaxQueueReport'][_0x6dc3('0x122')](db[_0x6dc3('0x47')],{});db[_0x6dc3('0x4c')][_0x6dc3('0x122')](db[_0x6dc3('0xf9')],{'as':_0x6dc3('0x161'),'foreignKey':_0x6dc3('0x17c')});db[_0x6dc3('0x4c')]['belongsTo'](db[_0x6dc3('0x127')],{'as':_0x6dc3('0x168'),'foreignKey':_0x6dc3('0x15b')});db['FaxQueueReport'][_0x6dc3('0x122')](db[_0x6dc3('0x11b')],{});db[_0x6dc3('0x4c')][_0x6dc3('0x122')](db[_0x6dc3('0x177')],{});db[_0x6dc3('0x4c')][_0x6dc3('0x122')](db[_0x6dc3('0x13')],{});db[_0x6dc3('0x4c')][_0x6dc3('0x122')](db['FaxQueue'],{});db[_0x6dc3('0x4e')][_0x6dc3('0x111')](db['Disposition'],{'as':_0x6dc3('0x175'),'foreignKey':'SmsAccountId'});db[_0x6dc3('0x4e')][_0x6dc3('0x111')](db[_0x6dc3('0x7c')],{'as':_0x6dc3('0x15f'),'foreignKey':_0x6dc3('0x17d')});db[_0x6dc3('0x4e')]['hasMany'](db['SmsMessage'],{'as':_0x6dc3('0x153'),'foreignKey':_0x6dc3('0x17d')});db[_0x6dc3('0x4e')][_0x6dc3('0x111')](db[_0x6dc3('0x52')],{'as':_0x6dc3('0x160')});db[_0x6dc3('0x4e')][_0x6dc3('0x111')](db[_0x6dc3('0x50')],{'as':_0x6dc3('0x146')});db[_0x6dc3('0x4e')][_0x6dc3('0x122')](db[_0x6dc3('0xf9')],{'as':'List','foreignKey':_0x6dc3('0x17c')});db[_0x6dc3('0x4e')]['belongsTo'](db[_0x6dc3('0x84')],{'as':_0x6dc3('0x163'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x6dc3('0x4e')][_0x6dc3('0x126')](db[_0x6dc3('0x13')],{'as':_0x6dc3('0x165'),'through':_0x6dc3('0x17e')});db['SmsApplication'][_0x6dc3('0x122')](db[_0x6dc3('0x13')],{'onDelete':_0x6dc3('0x172')});db[_0x6dc3('0x50')]['belongsTo'](db[_0x6dc3('0x56')],{'onDelete':_0x6dc3('0x172')});db[_0x6dc3('0x50')]['belongsTo'](db[_0x6dc3('0x4e')],{'onDelete':_0x6dc3('0x172')});db[_0x6dc3('0x50')][_0x6dc3('0x122')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x6dc3('0x150')});db['SmsApplication'][_0x6dc3('0x122')](db[_0x6dc3('0x8d')],{'onDelete':_0x6dc3('0x172'),'foreignKey':_0x6dc3('0x174')});db[_0x6dc3('0x52')][_0x6dc3('0x111')](db['SmsMessage'],{'as':_0x6dc3('0x153'),'onDelete':'cascade','foreignKey':_0x6dc3('0x17f')});db[_0x6dc3('0x52')][_0x6dc3('0x122')](db[_0x6dc3('0x4e')],{'as':_0x6dc3('0x171'),'foreignKey':_0x6dc3('0x17d')});db[_0x6dc3('0x52')]['belongsTo'](db[_0x6dc3('0x127')],{'as':_0x6dc3('0x168'),'foreignKey':_0x6dc3('0x15b')});db[_0x6dc3('0x52')][_0x6dc3('0x122')](db['User'],{'as':'Owner','foreignKey':_0x6dc3('0x10f')});db[_0x6dc3('0x52')][_0x6dc3('0x126')](db[_0x6dc3('0x8d')],{'through':_0x6dc3('0x180'),'as':'Tags'});db['SmsInteraction']['belongsToMany'](db['Tag'],{'through':_0x6dc3('0x180'),'as':'ThroughTags'});db['SmsInteraction'][_0x6dc3('0x126')](db[_0x6dc3('0x13')],{'as':_0x6dc3('0x16d'),'through':_0x6dc3('0x130'),'foreignKey':_0x6dc3('0x17f')});db[_0x6dc3('0x54')]['belongsTo'](db[_0x6dc3('0x13')],{'as':_0x6dc3('0x13')});db[_0x6dc3('0x54')][_0x6dc3('0x122')](db['CmContact'],{'onDelete':_0x6dc3('0x115'),'as':_0x6dc3('0x168')});db[_0x6dc3('0x54')][_0x6dc3('0x122')](db[_0x6dc3('0x52')],{'onDelete':_0x6dc3('0x115'),'as':'Interaction','foreignKey':_0x6dc3('0x17f')});db[_0x6dc3('0x54')][_0x6dc3('0x122')](db[_0x6dc3('0x4e')],{'as':_0x6dc3('0x171'),'foreignKey':_0x6dc3('0x17d')});db['SmsQueue']['belongsToMany'](db[_0x6dc3('0x13')],{'as':_0x6dc3('0x165'),'through':_0x6dc3('0x34'),'foreignKey':_0x6dc3('0x181')});db['SmsQueue'][_0x6dc3('0x126')](db[_0x6dc3('0xe8')],{'through':_0x6dc3('0x182'),'as':_0x6dc3('0x167')});db[_0x6dc3('0x58')][_0x6dc3('0x111')](db['Disposition'],{'as':_0x6dc3('0x175'),'foreignKey':_0x6dc3('0x183')});db[_0x6dc3('0x58')][_0x6dc3('0x111')](db[_0x6dc3('0x7c')],{'as':'Answers','foreignKey':_0x6dc3('0x183')});db[_0x6dc3('0x58')]['hasMany'](db[_0x6dc3('0x5b')],{'as':_0x6dc3('0x160'),'foreignKey':_0x6dc3('0x183')});db[_0x6dc3('0x58')]['hasMany'](db['OpenchannelMessage'],{'as':_0x6dc3('0x153'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x6dc3('0x111')](db['OpenchannelApplication'],{'as':_0x6dc3('0x146'),'foreignKey':_0x6dc3('0x183')});db[_0x6dc3('0x58')][_0x6dc3('0x122')](db[_0x6dc3('0xf9')],{'as':'List','foreignKey':'ListId'});db[_0x6dc3('0x58')][_0x6dc3('0x122')](db[_0x6dc3('0x84')],{'as':_0x6dc3('0x163'),'foreignKey':_0x6dc3('0x164')});db[_0x6dc3('0x58')][_0x6dc3('0x126')](db['User'],{'as':'Agents','through':_0x6dc3('0x140')});db[_0x6dc3('0x184')][_0x6dc3('0x122')](db[_0x6dc3('0x13')],{'onDelete':'restrict'});db[_0x6dc3('0x184')]['belongsTo'](db[_0x6dc3('0x5f')],{'onDelete':_0x6dc3('0x172'),'foreignKey':_0x6dc3('0x185')});db['OpenchannelApplication']['belongsTo'](db[_0x6dc3('0x58')],{'onDelete':_0x6dc3('0x172'),'foreignKey':_0x6dc3('0x183')});db[_0x6dc3('0x184')][_0x6dc3('0x122')](db[_0x6dc3('0x82')],{'onDelete':_0x6dc3('0x172'),'foreignKey':_0x6dc3('0x150')});db['OpenchannelApplication'][_0x6dc3('0x122')](db[_0x6dc3('0x8d')],{'onDelete':_0x6dc3('0x172'),'foreignKey':_0x6dc3('0x174')});db[_0x6dc3('0x5b')][_0x6dc3('0x111')](db['OpenchannelMessage'],{'as':'Messages','onDelete':_0x6dc3('0x115'),'foreignKey':_0x6dc3('0x186')});db['OpenchannelInteraction'][_0x6dc3('0x122')](db['OpenchannelAccount'],{'as':_0x6dc3('0x171'),'foreignKey':_0x6dc3('0x183')});db['OpenchannelInteraction'][_0x6dc3('0x122')](db[_0x6dc3('0x127')],{'as':_0x6dc3('0x168'),'foreignKey':_0x6dc3('0x15b')});db[_0x6dc3('0x5b')][_0x6dc3('0x122')](db[_0x6dc3('0x13')],{'as':_0x6dc3('0x169'),'foreignKey':_0x6dc3('0x10f')});db[_0x6dc3('0x5b')][_0x6dc3('0x126')](db[_0x6dc3('0x8d')],{'through':_0x6dc3('0x187'),'as':_0x6dc3('0x16b')});db[_0x6dc3('0x5b')][_0x6dc3('0x126')](db['Tag'],{'through':_0x6dc3('0x187'),'as':_0x6dc3('0x16c')});db[_0x6dc3('0x5b')][_0x6dc3('0x126')](db[_0x6dc3('0x13')],{'as':_0x6dc3('0x16d'),'through':_0x6dc3('0x188'),'foreignKey':_0x6dc3('0x186')});db['OpenchannelMessage'][_0x6dc3('0x122')](db['User'],{'onDelete':_0x6dc3('0x115'),'as':_0x6dc3('0x13')});db[_0x6dc3('0x5d')][_0x6dc3('0x122')](db['CmContact'],{'onDelete':_0x6dc3('0x115'),'as':_0x6dc3('0x168')});db['OpenchannelMessage'][_0x6dc3('0x122')](db[_0x6dc3('0x5b')],{'onDelete':_0x6dc3('0x115'),'as':'Interaction','foreignKey':_0x6dc3('0x186')});db[_0x6dc3('0x5d')][_0x6dc3('0x122')](db[_0x6dc3('0xef')],{'as':_0x6dc3('0xef'),'foreignKey':_0x6dc3('0x189')});db[_0x6dc3('0x5d')]['belongsTo'](db[_0x6dc3('0x58')],{'as':'Account','foreignKey':_0x6dc3('0x183')});db['OpenchannelQueue'][_0x6dc3('0x126')](db[_0x6dc3('0x13')],{'as':_0x6dc3('0x165'),'through':_0x6dc3('0x36'),'foreignKey':_0x6dc3('0x185')});db[_0x6dc3('0x5f')][_0x6dc3('0x126')](db[_0x6dc3('0xe8')],{'through':_0x6dc3('0x18a'),'as':_0x6dc3('0x167')});db[_0x6dc3('0x61')]['hasMany'](db[_0x6dc3('0x7e')],{'as':_0x6dc3('0x175'),'foreignKey':_0x6dc3('0x18b')});db[_0x6dc3('0x61')][_0x6dc3('0x111')](db[_0x6dc3('0x7c')],{'as':_0x6dc3('0x15f'),'foreignKey':_0x6dc3('0x18b')});db[_0x6dc3('0x61')][_0x6dc3('0x111')](db[_0x6dc3('0x6c')],{'as':_0x6dc3('0x18c')});db[_0x6dc3('0x61')][_0x6dc3('0x111')](db['ChatInteraction'],{'as':_0x6dc3('0x160')});db[_0x6dc3('0x61')][_0x6dc3('0x111')](db[_0x6dc3('0x64')],{'as':_0x6dc3('0x146')});db[_0x6dc3('0x61')]['hasMany'](db[_0x6dc3('0x68')],{'as':_0x6dc3('0x153')});db[_0x6dc3('0x61')][_0x6dc3('0x122')](db['CmList'],{'as':_0x6dc3('0x161'),'foreignKey':_0x6dc3('0x17c')});db[_0x6dc3('0x61')]['belongsTo'](db[_0x6dc3('0x82')],{'as':_0x6dc3('0x82'),'foreignKey':'IntervalId'});db[_0x6dc3('0x61')][_0x6dc3('0x122')](db[_0x6dc3('0x84')],{'as':'mandatoryDispositionPause','foreignKey':_0x6dc3('0x164')});db['ChatWebsite'][_0x6dc3('0x126')](db[_0x6dc3('0x13')],{'as':_0x6dc3('0x165'),'through':_0x6dc3('0x13a')});db['OpenchannelQueueReport'][_0x6dc3('0x122')](db['OpenchannelAccount'],{});db[_0x6dc3('0x62')]['belongsTo'](db['CmList'],{'as':_0x6dc3('0x161'),'foreignKey':_0x6dc3('0x17c')});db[_0x6dc3('0x62')][_0x6dc3('0x122')](db[_0x6dc3('0x127')],{'as':_0x6dc3('0x168'),'foreignKey':_0x6dc3('0x15b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelInteraction'],{});db['OpenchannelQueueReport'][_0x6dc3('0x122')](db[_0x6dc3('0x5d')],{});db[_0x6dc3('0x62')][_0x6dc3('0x122')](db[_0x6dc3('0x13')],{});db['OpenchannelQueueReport'][_0x6dc3('0x122')](db['OpenchannelQueue'],{});db[_0x6dc3('0x64')][_0x6dc3('0x122')](db[_0x6dc3('0x13')],{'as':_0x6dc3('0x18d'),'foreignKey':'UserId','onDelete':'restrict'});db['ChatApplication'][_0x6dc3('0x122')](db['ChatQueue'],{'as':_0x6dc3('0x18e'),'foreignKey':_0x6dc3('0x18f'),'onDelete':'restrict'});db['ChatApplication'][_0x6dc3('0x122')](db[_0x6dc3('0x61')],{'as':_0x6dc3('0x190'),'foreignKey':'ChatWebsiteId','onDelete':_0x6dc3('0x172')});db[_0x6dc3('0x64')]['belongsTo'](db[_0x6dc3('0x8d')],{'onDelete':_0x6dc3('0x172'),'foreignKey':_0x6dc3('0x174')});db[_0x6dc3('0x66')][_0x6dc3('0x111')](db[_0x6dc3('0x68')],{'as':_0x6dc3('0x153'),'onDelete':_0x6dc3('0x115'),'foreignKey':'ChatInteractionId'});db[_0x6dc3('0x66')][_0x6dc3('0x122')](db[_0x6dc3('0x61')],{'as':_0x6dc3('0x171'),'foreignKey':_0x6dc3('0x18b')});db['ChatInteraction'][_0x6dc3('0x122')](db[_0x6dc3('0x127')],{'as':_0x6dc3('0x168'),'foreignKey':'ContactId'});db['ChatInteraction'][_0x6dc3('0x122')](db['User'],{'as':_0x6dc3('0x169'),'foreignKey':_0x6dc3('0x10f')});db[_0x6dc3('0x66')][_0x6dc3('0x126')](db[_0x6dc3('0x8d')],{'through':_0x6dc3('0x191'),'as':_0x6dc3('0x16b')});db[_0x6dc3('0x66')]['belongsToMany'](db[_0x6dc3('0x8d')],{'through':_0x6dc3('0x191'),'as':'ThroughTags'});db[_0x6dc3('0x66')]['belongsToMany'](db[_0x6dc3('0x13')],{'as':'Users','through':_0x6dc3('0x12e'),'foreignKey':_0x6dc3('0x192')});db[_0x6dc3('0x68')]['belongsTo'](db[_0x6dc3('0x13')],{'onDelete':_0x6dc3('0x115'),'as':_0x6dc3('0x13')});db[_0x6dc3('0x68')][_0x6dc3('0x122')](db[_0x6dc3('0x127')],{'onDelete':_0x6dc3('0x115'),'as':_0x6dc3('0x168'),'foreignKey':_0x6dc3('0x15b')});db[_0x6dc3('0x68')][_0x6dc3('0x122')](db[_0x6dc3('0x66')],{'onDelete':_0x6dc3('0x115'),'as':'Interaction','foreignKey':_0x6dc3('0x192')});db[_0x6dc3('0x68')][_0x6dc3('0x122')](db['Attachment'],{'as':'Attachment','foreignKey':_0x6dc3('0x189')});db[_0x6dc3('0x68')][_0x6dc3('0x122')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x6dc3('0x18b')});db[_0x6dc3('0x193')][_0x6dc3('0x122')](db[_0x6dc3('0x127')],{'onDelete':'cascade','as':_0x6dc3('0x168'),'foreignKey':_0x6dc3('0x15b')});db[_0x6dc3('0x193')][_0x6dc3('0x122')](db[_0x6dc3('0x61')],{'as':_0x6dc3('0x171'),'foreignKey':_0x6dc3('0x18b')});db['ChatQueue'][_0x6dc3('0x126')](db[_0x6dc3('0x13')],{'as':_0x6dc3('0x165'),'through':_0x6dc3('0x2f'),'hooks':!![]});db['ChatQueue']['belongsToMany'](db['Team'],{'through':'team_has_chat_queues','as':'Teams'});db[_0x6dc3('0x6b')][_0x6dc3('0x111')](db[_0x6dc3('0xd2')],{'as':'Messages','foreignKey':'ChatGroupId','onDelete':_0x6dc3('0x115')});db['ChatGroup']['belongsToMany'](db[_0x6dc3('0x13')],{'as':_0x6dc3('0x147'),'through':'chat_group_has_users'});db[_0x6dc3('0x6c')][_0x6dc3('0x122')](db[_0x6dc3('0x61')],{'as':'Website','foreignKey':_0x6dc3('0x18b')});db['CmCompany'][_0x6dc3('0x111')](db[_0x6dc3('0x127')],{'as':_0x6dc3('0x128'),'foreignKey':_0x6dc3('0x194')});db[_0x6dc3('0x127')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x6dc3('0x15b')});db['CmContact'][_0x6dc3('0x111')](db[_0x6dc3('0x74')],{'as':_0x6dc3('0x116'),'foreignKey':_0x6dc3('0x15b')});db[_0x6dc3('0x127')][_0x6dc3('0x111')](db[_0x6dc3('0x75')],{'as':'HopperHistories','foreignKey':_0x6dc3('0x15b')});db[_0x6dc3('0x127')][_0x6dc3('0x111')](db[_0x6dc3('0x118')],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db['CmContact']['hasMany'](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0x6dc3('0x15b')});db[_0x6dc3('0x127')]['hasMany'](db[_0x6dc3('0x5b')],{'as':_0x6dc3('0x131'),'foreignKey':_0x6dc3('0x15b'),'onDelete':_0x6dc3('0x172')});db[_0x6dc3('0x127')][_0x6dc3('0x111')](db[_0x6dc3('0x66')],{'as':_0x6dc3('0x119'),'foreignKey':_0x6dc3('0x15b'),'onDelete':_0x6dc3('0x172')});db['CmContact'][_0x6dc3('0x111')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x6dc3('0x15b'),'onDelete':_0x6dc3('0x172')});db[_0x6dc3('0x127')]['hasMany'](db['FaxInteraction'],{'as':_0x6dc3('0x12f'),'foreignKey':_0x6dc3('0x15b'),'onDelete':_0x6dc3('0x172')});db[_0x6dc3('0x127')][_0x6dc3('0x111')](db[_0x6dc3('0x3d')],{'as':_0x6dc3('0x11c'),'foreignKey':_0x6dc3('0x15b'),'onDelete':_0x6dc3('0x172')});db[_0x6dc3('0x127')][_0x6dc3('0x122')](db[_0x6dc3('0x6e')],{'as':'Company','foreignKey':_0x6dc3('0x194')});db[_0x6dc3('0x127')][_0x6dc3('0x122')](db[_0x6dc3('0xf9')],{'as':_0x6dc3('0x161'),'foreignKey':_0x6dc3('0x17c'),'onDelete':_0x6dc3('0x115')});db[_0x6dc3('0x127')][_0x6dc3('0x126')](db[_0x6dc3('0x13')],{'as':_0x6dc3('0x16d'),'through':'cm_user_has_contacts'});db[_0x6dc3('0x127')][_0x6dc3('0x126')](db[_0x6dc3('0x8d')],{'as':_0x6dc3('0x16b'),'through':_0x6dc3('0x195')});db[_0x6dc3('0x127')][_0x6dc3('0x126')](db[_0x6dc3('0x8d')],{'through':_0x6dc3('0x195'),'as':_0x6dc3('0x16c')});db[_0x6dc3('0x70')][_0x6dc3('0x122')](db[_0x6dc3('0x127')],{'as':_0x6dc3('0x168'),'foreignKey':_0x6dc3('0x15b'),'onDelete':'cascade'});db[_0x6dc3('0x70')][_0x6dc3('0x122')](db[_0x6dc3('0xf9')],{'as':'List','foreignKey':_0x6dc3('0x17c'),'onDelete':_0x6dc3('0x115')});db[_0x6dc3('0x70')][_0x6dc3('0x122')](db[_0x6dc3('0x13')],{'as':_0x6dc3('0x18d'),'foreignKey':'UserId'});db[_0x6dc3('0x70')][_0x6dc3('0x122')](db[_0x6dc3('0x1b')],{'as':_0x6dc3('0x18e'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db['CmHopper']['belongsTo'](db[_0x6dc3('0xec')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0x6dc3('0x115')});db[_0x6dc3('0x70')]['belongsTo'](db[_0x6dc3('0x13')],{'as':_0x6dc3('0x169'),'foreignKey':_0x6dc3('0x196')});db['CmHopperBlack'][_0x6dc3('0x122')](db[_0x6dc3('0x127')],{'as':_0x6dc3('0x168'),'foreignKey':_0x6dc3('0x15b'),'onDelete':_0x6dc3('0x115')});db[_0x6dc3('0x72')][_0x6dc3('0x122')](db[_0x6dc3('0xf9')],{'as':_0x6dc3('0x161'),'foreignKey':_0x6dc3('0x17c'),'onDelete':_0x6dc3('0x115')});db['CmHopperBlack']['belongsTo'](db['VoiceQueue'],{'as':_0x6dc3('0x18e'),'foreignKey':_0x6dc3('0x149'),'onDelete':_0x6dc3('0x115')});db[_0x6dc3('0x72')][_0x6dc3('0x122')](db['Campaign'],{'as':_0x6dc3('0xec'),'foreignKey':'CampaignId','onDelete':_0x6dc3('0x115')});db[_0x6dc3('0x197')][_0x6dc3('0x111')](db[_0x6dc3('0x80')],{'as':{'plural':_0x6dc3('0x198'),'singular':_0x6dc3('0x199')},'foreignKey':_0x6dc3('0x19a'),'onDelete':'cascade','hooks':!![]});db[_0x6dc3('0x197')][_0x6dc3('0x111')](db[_0x6dc3('0x80')],{'as':{'plural':_0x6dc3('0x19b'),'singular':_0x6dc3('0x19c')},'foreignKey':_0x6dc3('0x19d'),'onDelete':'cascade','hooks':!![]});db[_0x6dc3('0x197')][_0x6dc3('0x111')](db[_0x6dc3('0x7a')],{'as':_0x6dc3('0x19e'),'foreignKey':'AutomationId','onDelete':_0x6dc3('0x115'),'hooks':!![]});db[_0x6dc3('0x7e')]['hasMany'](db[_0x6dc3('0x7e')],{'as':'Dispositions','foreignKey':_0x6dc3('0x19f'),'onDelete':_0x6dc3('0x115')});db[_0x6dc3('0x82')]['hasMany'](db[_0x6dc3('0x82')],{'as':_0x6dc3('0x1a0'),'foreignKey':'IntervalId','onDelete':_0x6dc3('0x115'),'hooks':!![],'required':![]});db[_0x6dc3('0x82')][_0x6dc3('0x111')](db[_0x6dc3('0x113')],{'as':'Extensions','foreignKey':'IntervalId','onDelete':_0x6dc3('0x172')});db[_0x6dc3('0x82')][_0x6dc3('0x111')](db[_0x6dc3('0x41')],{'as':_0x6dc3('0x1a1'),'foreignKey':_0x6dc3('0x150')});db[_0x6dc3('0x82')]['hasMany'](db[_0x6dc3('0x64')],{'as':_0x6dc3('0x1a2'),'foreignKey':_0x6dc3('0x150')});db['Interval'][_0x6dc3('0x111')](db[_0x6dc3('0x48')],{'as':'FaxApplications','foreignKey':'IntervalId'});db['Interval'][_0x6dc3('0x111')](db[_0x6dc3('0x50')],{'as':_0x6dc3('0x1a3'),'foreignKey':_0x6dc3('0x150')});db['Schedule']['belongsTo'](db['MailAccount'],{});db['Schedule']['belongsTo'](db[_0x6dc3('0x98')],{'foreignKey':_0x6dc3('0x1a4')});db[_0x6dc3('0x89')]['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x6dc3('0x1a5')});db['Sound'][_0x6dc3('0x126')](db[_0x6dc3('0x1a')],{'as':_0x6dc3('0x1a6'),'through':'moh_has_sounds','onDelete':_0x6dc3('0x172')});db[_0x6dc3('0x8d')][_0x6dc3('0x126')](db[_0x6dc3('0x127')],{'through':_0x6dc3('0x195')});db['Tag'][_0x6dc3('0x126')](db[_0x6dc3('0x66')],{'through':_0x6dc3('0x191')});db[_0x6dc3('0x8d')][_0x6dc3('0x126')](db[_0x6dc3('0x3d')],{'through':_0x6dc3('0x16a')});db[_0x6dc3('0x8d')]['belongsToMany'](db[_0x6dc3('0x52')],{'through':_0x6dc3('0x180')});db[_0x6dc3('0x8d')][_0x6dc3('0x126')](db[_0x6dc3('0x11b')],{'through':_0x6dc3('0x17a')});db[_0x6dc3('0x8d')][_0x6dc3('0x126')](db[_0x6dc3('0x5b')],{'through':_0x6dc3('0x187')});db[_0x6dc3('0x8d')][_0x6dc3('0x126')](db['WhatsappInteraction'],{'through':_0x6dc3('0x1a7')});db['Trigger']['hasMany'](db[_0x6dc3('0x80')],{'as':{'plural':_0x6dc3('0x1a8'),'singular':_0x6dc3('0x1a9')},'foreignKey':'TriggerAllId','onDelete':_0x6dc3('0x115'),'hooks':!![]});db[_0x6dc3('0x1aa')][_0x6dc3('0x111')](db[_0x6dc3('0x80')],{'as':{'plural':'AnyConditions','singular':_0x6dc3('0x1ab')},'foreignKey':_0x6dc3('0x1ac'),'onDelete':_0x6dc3('0x115'),'hooks':!![]});db[_0x6dc3('0x1aa')]['hasMany'](db[_0x6dc3('0x7a')],{'as':_0x6dc3('0x19e'),'foreignKey':_0x6dc3('0x1ad'),'onDelete':_0x6dc3('0x115'),'hooks':!![]});db[_0x6dc3('0x96')]['hasMany'](db[_0x6dc3('0x1ae')],{'as':_0x6dc3('0x1af'),'onDelete':_0x6dc3('0x115'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x6dc3('0x98')][_0x6dc3('0x111')](db[_0x6dc3('0x1ae')],{'as':_0x6dc3('0x1af'),'onDelete':_0x6dc3('0x115'),'foreignKey':'DefaultReportId'});db[_0x6dc3('0x9c')][_0x6dc3('0x111')](db[_0x6dc3('0x1ae')],{'as':_0x6dc3('0x1af'),'onDelete':'cascade','foreignKey':_0x6dc3('0x1b0')});db[_0x6dc3('0x1ae')][_0x6dc3('0x122')](db[_0x6dc3('0x9c')],{'foreignKey':'MetricId'});db[_0x6dc3('0x9f')][_0x6dc3('0x111')](db['SalesforceConfiguration'],{'as':_0x6dc3('0x1b1'),'onDelete':_0x6dc3('0x115'),'foreignKey':_0x6dc3('0x1b2')});db[_0x6dc3('0xa0')]['hasMany'](db['SalesforceField'],{'as':_0x6dc3('0x1b3'),'onDelete':_0x6dc3('0x115'),'foreignKey':'SubjectId'});db[_0x6dc3('0xa0')][_0x6dc3('0x111')](db[_0x6dc3('0xa2')],{'as':_0x6dc3('0x1b4'),'onDelete':_0x6dc3('0x115'),'foreignKey':'DescriptionId'});db['SalesforceConfiguration'][_0x6dc3('0x111')](db[_0x6dc3('0xa2')],{'as':_0x6dc3('0x1af'),'onDelete':_0x6dc3('0x115'),'foreignKey':'FieldId'});db[_0x6dc3('0xa0')]['belongsTo'](db['SalesforceAccount'],{'as':_0x6dc3('0x171'),'foreignKey':'AccountId'});db[_0x6dc3('0xa2')][_0x6dc3('0x111')](db[_0x6dc3('0xa2')],{'as':'Subject','foreignKey':_0x6dc3('0x1b5')});db['SalesforceField'][_0x6dc3('0x111')](db['SalesforceField'],{'as':'Description','foreignKey':_0x6dc3('0x1b6')});db[_0x6dc3('0xa2')][_0x6dc3('0x111')](db[_0x6dc3('0xa2')],{'as':'Field','foreignKey':'FieldId'});db[_0x6dc3('0xa2')][_0x6dc3('0x122')](db[_0x6dc3('0x1b7')],{'as':_0x6dc3('0x1b7'),'foreignKey':'VariableId'});db[_0x6dc3('0xa4')][_0x6dc3('0x111')](db[_0x6dc3('0xa5')],{'as':_0x6dc3('0x1b1'),'onDelete':'cascade','foreignKey':_0x6dc3('0x1b2')});db['SugarcrmConfiguration'][_0x6dc3('0x111')](db[_0x6dc3('0xa6')],{'as':_0x6dc3('0x1b3'),'onDelete':'cascade','foreignKey':_0x6dc3('0x1b5')});db[_0x6dc3('0xa5')][_0x6dc3('0x111')](db[_0x6dc3('0xa6')],{'as':_0x6dc3('0x1b4'),'onDelete':_0x6dc3('0x115'),'foreignKey':_0x6dc3('0x1b6')});db[_0x6dc3('0xa5')][_0x6dc3('0x111')](db['SugarcrmField'],{'as':'Fields','onDelete':_0x6dc3('0x115'),'foreignKey':'FieldId'});db['SugarcrmConfiguration'][_0x6dc3('0x122')](db['SugarcrmAccount'],{'as':_0x6dc3('0x171'),'foreignKey':_0x6dc3('0x1b2')});db[_0x6dc3('0xa6')][_0x6dc3('0x111')](db[_0x6dc3('0xa6')],{'as':_0x6dc3('0x1b8'),'foreignKey':_0x6dc3('0x1b5')});db['SugarcrmField']['hasMany'](db[_0x6dc3('0xa6')],{'as':_0x6dc3('0x1b9'),'foreignKey':_0x6dc3('0x1b6')});db[_0x6dc3('0xa6')][_0x6dc3('0x111')](db[_0x6dc3('0xa6')],{'as':_0x6dc3('0x1ba'),'foreignKey':_0x6dc3('0x1bb')});db[_0x6dc3('0xa6')][_0x6dc3('0x122')](db[_0x6dc3('0x1b7')],{'as':_0x6dc3('0x1b7'),'foreignKey':_0x6dc3('0x1bc')});db[_0x6dc3('0x1bd')]['hasMany'](db['DeskConfiguration'],{'as':_0x6dc3('0x1b1'),'onDelete':_0x6dc3('0x115'),'foreignKey':_0x6dc3('0x1b2')});db[_0x6dc3('0xa9')][_0x6dc3('0x111')](db[_0x6dc3('0xab')],{'as':_0x6dc3('0x1b3'),'onDelete':_0x6dc3('0x115'),'foreignKey':_0x6dc3('0x1b5')});db[_0x6dc3('0xa9')][_0x6dc3('0x111')](db[_0x6dc3('0xab')],{'as':_0x6dc3('0x1b4'),'onDelete':_0x6dc3('0x115'),'foreignKey':_0x6dc3('0x1b6')});db[_0x6dc3('0xa9')][_0x6dc3('0x111')](db[_0x6dc3('0xab')],{'as':_0x6dc3('0x1af'),'onDelete':_0x6dc3('0x115'),'foreignKey':'FieldId'});db[_0x6dc3('0xa9')][_0x6dc3('0x122')](db['DeskAccount'],{'as':_0x6dc3('0x171'),'foreignKey':'AccountId'});db[_0x6dc3('0xa9')][_0x6dc3('0x126')](db['Tag'],{'through':'int_desk_configuration_has_tags'});db[_0x6dc3('0xab')][_0x6dc3('0x111')](db['DeskField'],{'as':'Subject','foreignKey':_0x6dc3('0x1b5')});db[_0x6dc3('0xab')]['hasMany'](db[_0x6dc3('0xab')],{'as':_0x6dc3('0x1b9'),'foreignKey':_0x6dc3('0x1b6')});db[_0x6dc3('0xab')]['hasMany'](db['DeskField'],{'as':_0x6dc3('0x1ba'),'foreignKey':_0x6dc3('0x1bb')});db[_0x6dc3('0xab')][_0x6dc3('0x122')](db[_0x6dc3('0x1b7')],{'as':_0x6dc3('0x1b7'),'foreignKey':_0x6dc3('0x1bc')});db[_0x6dc3('0xac')][_0x6dc3('0x111')](db[_0x6dc3('0xae')],{'as':_0x6dc3('0x1b1'),'onDelete':_0x6dc3('0x115'),'foreignKey':'AccountId'});db[_0x6dc3('0xae')][_0x6dc3('0x111')](db[_0x6dc3('0x1be')],{'as':_0x6dc3('0x1b3'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x6dc3('0xae')][_0x6dc3('0x111')](db['ZohoField'],{'as':_0x6dc3('0x1b4'),'onDelete':_0x6dc3('0x115'),'foreignKey':'DescriptionId'});db[_0x6dc3('0xae')][_0x6dc3('0x111')](db[_0x6dc3('0x1be')],{'as':'Fields','onDelete':_0x6dc3('0x115'),'foreignKey':'FieldId'});db[_0x6dc3('0xae')][_0x6dc3('0x122')](db[_0x6dc3('0xac')],{'as':_0x6dc3('0x171'),'foreignKey':_0x6dc3('0x1b2')});db[_0x6dc3('0x1be')][_0x6dc3('0x111')](db['ZohoField'],{'as':_0x6dc3('0x1b8'),'foreignKey':_0x6dc3('0x1b5')});db[_0x6dc3('0x1be')][_0x6dc3('0x111')](db[_0x6dc3('0x1be')],{'as':'Description','foreignKey':_0x6dc3('0x1b6')});db[_0x6dc3('0x1be')][_0x6dc3('0x111')](db[_0x6dc3('0x1be')],{'as':_0x6dc3('0x1ba'),'foreignKey':_0x6dc3('0x1bb')});db['ZohoField'][_0x6dc3('0x122')](db[_0x6dc3('0x1b7')],{'as':'Variable','foreignKey':_0x6dc3('0x1bc')});db['ZendeskAccount'][_0x6dc3('0x111')](db['ZendeskConfiguration'],{'as':'Configurations','onDelete':_0x6dc3('0x115'),'foreignKey':'AccountId'});db[_0x6dc3('0xb1')][_0x6dc3('0x111')](db[_0x6dc3('0xb3')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x6dc3('0xb1')][_0x6dc3('0x111')](db['ZendeskField'],{'as':_0x6dc3('0x1b4'),'foreignKey':_0x6dc3('0x1b6')});db[_0x6dc3('0xb1')][_0x6dc3('0x111')](db[_0x6dc3('0xb3')],{'as':_0x6dc3('0x1af'),'foreignKey':_0x6dc3('0x1bb')});db['ZendeskConfiguration']['belongsTo'](db[_0x6dc3('0x1bf')],{'as':'Account','foreignKey':_0x6dc3('0x1b2')});db[_0x6dc3('0xb1')][_0x6dc3('0x126')](db[_0x6dc3('0x8d')],{'through':_0x6dc3('0x1c0')});db[_0x6dc3('0xb3')][_0x6dc3('0x111')](db['ZendeskField'],{'as':_0x6dc3('0x1b8'),'foreignKey':'SubjectId'});db['ZendeskField'][_0x6dc3('0x111')](db[_0x6dc3('0xb3')],{'as':_0x6dc3('0x1b9'),'foreignKey':_0x6dc3('0x1b6')});db[_0x6dc3('0xb3')]['hasMany'](db[_0x6dc3('0xb3')],{'as':'Field','foreignKey':_0x6dc3('0x1bb')});db['ZendeskField'][_0x6dc3('0x122')](db[_0x6dc3('0x1b7')],{'as':'Variable','foreignKey':_0x6dc3('0x1bc')});db[_0x6dc3('0xb5')][_0x6dc3('0x111')](db[_0x6dc3('0xb7')],{'as':'Configurations','onDelete':_0x6dc3('0x115'),'foreignKey':_0x6dc3('0x1b2')});db[_0x6dc3('0xb7')][_0x6dc3('0x111')](db['FreshdeskField'],{'as':_0x6dc3('0x1b3'),'onDelete':_0x6dc3('0x115'),'foreignKey':'SubjectId'});db[_0x6dc3('0xb7')]['hasMany'](db[_0x6dc3('0x1c1')],{'as':_0x6dc3('0x1b4'),'onDelete':_0x6dc3('0x115'),'foreignKey':'DescriptionId'});db['FreshdeskConfiguration'][_0x6dc3('0x111')](db[_0x6dc3('0x1c1')],{'as':'Fields','onDelete':_0x6dc3('0x115'),'foreignKey':_0x6dc3('0x1bb')});db[_0x6dc3('0xb7')]['belongsTo'](db[_0x6dc3('0xb5')],{'as':_0x6dc3('0x171'),'foreignKey':_0x6dc3('0x1b2')});db[_0x6dc3('0xb7')][_0x6dc3('0x126')](db[_0x6dc3('0x8d')],{'through':_0x6dc3('0x1c2')});db[_0x6dc3('0x1c1')][_0x6dc3('0x111')](db[_0x6dc3('0x1c1')],{'as':_0x6dc3('0x1b8'),'foreignKey':_0x6dc3('0x1b5')});db[_0x6dc3('0x1c1')][_0x6dc3('0x111')](db[_0x6dc3('0x1c1')],{'as':_0x6dc3('0x1b9'),'foreignKey':_0x6dc3('0x1b6')});db[_0x6dc3('0x1c1')][_0x6dc3('0x111')](db['FreshdeskField'],{'as':'Field','foreignKey':_0x6dc3('0x1bb')});db[_0x6dc3('0x1c1')]['belongsTo'](db[_0x6dc3('0x1b7')],{'as':_0x6dc3('0x1b7'),'foreignKey':_0x6dc3('0x1bc')});db[_0x6dc3('0xba')][_0x6dc3('0x111')](db['VtigerConfiguration'],{'as':_0x6dc3('0x1b1'),'onDelete':_0x6dc3('0x115'),'foreignKey':_0x6dc3('0x1b2')});db['VtigerConfiguration'][_0x6dc3('0x111')](db[_0x6dc3('0x1c3')],{'as':_0x6dc3('0x1b3'),'foreignKey':_0x6dc3('0x1b5')});db['VtigerConfiguration'][_0x6dc3('0x111')](db['VtigerField'],{'as':_0x6dc3('0x1b4'),'foreignKey':_0x6dc3('0x1b6')});db[_0x6dc3('0xbc')][_0x6dc3('0x111')](db[_0x6dc3('0x1c3')],{'as':_0x6dc3('0x1af'),'foreignKey':'FieldId'});db['VtigerConfiguration']['belongsTo'](db['VtigerAccount'],{'as':_0x6dc3('0x171'),'foreignKey':_0x6dc3('0x1b2')});db[_0x6dc3('0x1c3')]['hasMany'](db[_0x6dc3('0x1c3')],{'as':_0x6dc3('0x1b8'),'foreignKey':_0x6dc3('0x1b5')});db['VtigerField'][_0x6dc3('0x111')](db['VtigerField'],{'as':_0x6dc3('0x1b9'),'foreignKey':'DescriptionId'});db['VtigerField'][_0x6dc3('0x111')](db[_0x6dc3('0x1c3')],{'as':_0x6dc3('0x1ba'),'foreignKey':'FieldId'});db['VtigerField'][_0x6dc3('0x122')](db[_0x6dc3('0x1b7')],{'as':_0x6dc3('0x1b7'),'foreignKey':_0x6dc3('0x1bc')});db[_0x6dc3('0xbf')][_0x6dc3('0x111')](db[_0x6dc3('0xc1')],{'as':_0x6dc3('0x1b1'),'onDelete':'cascade','foreignKey':_0x6dc3('0x1b2')});db[_0x6dc3('0xc1')][_0x6dc3('0x111')](db[_0x6dc3('0xc3')],{'as':_0x6dc3('0x1b3'),'foreignKey':_0x6dc3('0x1b5')});db['ServicenowConfiguration'][_0x6dc3('0x111')](db[_0x6dc3('0xc3')],{'as':'Descriptions','foreignKey':_0x6dc3('0x1b6')});db[_0x6dc3('0xc1')]['hasMany'](db[_0x6dc3('0xc3')],{'as':'Fields','foreignKey':'FieldId'});db['ServicenowConfiguration'][_0x6dc3('0x122')](db[_0x6dc3('0xbf')],{'as':'Account','foreignKey':_0x6dc3('0x1b2')});db['ServicenowField']['hasMany'](db[_0x6dc3('0xc3')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x6dc3('0xc3')]['hasMany'](db[_0x6dc3('0xc3')],{'as':_0x6dc3('0x1b9'),'foreignKey':_0x6dc3('0x1b6')});db[_0x6dc3('0xc3')]['hasMany'](db[_0x6dc3('0xc3')],{'as':_0x6dc3('0x1ba'),'foreignKey':_0x6dc3('0x1bb')});db[_0x6dc3('0xc3')]['belongsTo'](db[_0x6dc3('0x1b7')],{'as':_0x6dc3('0x1b7'),'foreignKey':_0x6dc3('0x1bc')});db[_0x6dc3('0x1c4')][_0x6dc3('0x111')](db[_0x6dc3('0xc6')],{'as':_0x6dc3('0x1b1'),'onDelete':_0x6dc3('0x115'),'foreignKey':'AccountId'});db[_0x6dc3('0xc6')]['hasMany'](db[_0x6dc3('0x1c5')],{'as':_0x6dc3('0x1b3'),'onDelete':_0x6dc3('0x115'),'foreignKey':_0x6dc3('0x1b5')});db[_0x6dc3('0xc6')][_0x6dc3('0x111')](db['Dynamics365Field'],{'as':_0x6dc3('0x1b4'),'onDelete':_0x6dc3('0x115'),'foreignKey':_0x6dc3('0x1b6')});db[_0x6dc3('0xc6')][_0x6dc3('0x111')](db['Dynamics365Field'],{'as':_0x6dc3('0x1af'),'onDelete':'cascade','foreignKey':_0x6dc3('0x1bb')});db[_0x6dc3('0xc6')]['belongsTo'](db[_0x6dc3('0x1c4')],{'as':_0x6dc3('0x171'),'foreignKey':_0x6dc3('0x1b2')});db[_0x6dc3('0x1c5')][_0x6dc3('0x111')](db[_0x6dc3('0x1c5')],{'as':_0x6dc3('0x1b8'),'foreignKey':_0x6dc3('0x1b5')});db[_0x6dc3('0x1c5')][_0x6dc3('0x111')](db['Dynamics365Field'],{'as':_0x6dc3('0x1b9'),'foreignKey':_0x6dc3('0x1b6')});db['Dynamics365Field'][_0x6dc3('0x111')](db[_0x6dc3('0x1c5')],{'as':_0x6dc3('0x1ba'),'foreignKey':'FieldId'});db['Dynamics365Field'][_0x6dc3('0x122')](db[_0x6dc3('0x1b7')],{'as':_0x6dc3('0x1b7'),'foreignKey':_0x6dc3('0x1bc')});db[_0x6dc3('0xc9')][_0x6dc3('0x111')](db[_0x6dc3('0xcb')],{'as':_0x6dc3('0x1b1'),'onDelete':_0x6dc3('0x115'),'foreignKey':_0x6dc3('0x1b2')});db[_0x6dc3('0xcb')][_0x6dc3('0x111')](db[_0x6dc3('0xcd')],{'as':_0x6dc3('0x1b3'),'foreignKey':_0x6dc3('0x1b5')});db[_0x6dc3('0xcb')][_0x6dc3('0x111')](db['FreshsalesField'],{'as':_0x6dc3('0x1b4'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration'][_0x6dc3('0x111')](db['FreshsalesField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x6dc3('0xcb')][_0x6dc3('0x122')](db[_0x6dc3('0xc9')],{'as':_0x6dc3('0x171'),'foreignKey':_0x6dc3('0x1b2')});db[_0x6dc3('0xcd')][_0x6dc3('0x111')](db['FreshsalesField'],{'as':_0x6dc3('0x1b8'),'foreignKey':_0x6dc3('0x1b5')});db[_0x6dc3('0xcd')][_0x6dc3('0x111')](db[_0x6dc3('0xcd')],{'as':'Description','foreignKey':_0x6dc3('0x1b6')});db[_0x6dc3('0xcd')][_0x6dc3('0x111')](db[_0x6dc3('0xcd')],{'as':_0x6dc3('0x1ba'),'foreignKey':_0x6dc3('0x1bb')});db[_0x6dc3('0xcd')][_0x6dc3('0x122')](db['Variable'],{'as':'Variable','foreignKey':_0x6dc3('0x1bc')});db[_0x6dc3('0xd1')][_0x6dc3('0x122')](db[_0x6dc3('0x61')],{});db[_0x6dc3('0xd1')]['belongsTo'](db[_0x6dc3('0xf9')],{'as':_0x6dc3('0x161'),'foreignKey':_0x6dc3('0x17c')});db[_0x6dc3('0xd1')][_0x6dc3('0x122')](db['CmContact'],{'as':_0x6dc3('0x168'),'foreignKey':_0x6dc3('0x15b')});db[_0x6dc3('0xd1')][_0x6dc3('0x122')](db[_0x6dc3('0x66')],{});db[_0x6dc3('0xd1')][_0x6dc3('0x122')](db[_0x6dc3('0x68')],{});db[_0x6dc3('0xd1')]['belongsTo'](db[_0x6dc3('0x13')],{});db['ChatQueueReport'][_0x6dc3('0x122')](db[_0x6dc3('0x133')],{});db[_0x6dc3('0xd2')]['belongsTo'](db['User'],{'onDelete':_0x6dc3('0x115'),'foreignKey':_0x6dc3('0x1c6')});db['ChatInternalMessage'][_0x6dc3('0x122')](db[_0x6dc3('0x13')],{'onDelete':_0x6dc3('0x115'),'foreignKey':_0x6dc3('0x1c7')});db['JscriptySessionReport'][_0x6dc3('0x111')](db[_0x6dc3('0x1c8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x6dc3('0xd6')]['hasMany'](db[_0x6dc3('0x1c9')],{'foreignKey':_0x6dc3('0x1ca'),'onDelete':_0x6dc3('0x115')});db[_0x6dc3('0xd8')][_0x6dc3('0x122')](db[_0x6dc3('0x4e')],{});db[_0x6dc3('0xd8')][_0x6dc3('0x122')](db['CmList'],{'as':_0x6dc3('0x161'),'foreignKey':_0x6dc3('0x17c')});db[_0x6dc3('0xd8')][_0x6dc3('0x122')](db[_0x6dc3('0x127')],{'as':_0x6dc3('0x168'),'foreignKey':_0x6dc3('0x15b')});db[_0x6dc3('0xd8')][_0x6dc3('0x122')](db[_0x6dc3('0x52')],{});db['SmsQueueReport'][_0x6dc3('0x122')](db[_0x6dc3('0x54')],{});db[_0x6dc3('0xd8')][_0x6dc3('0x122')](db[_0x6dc3('0x13')],{});db[_0x6dc3('0xd8')][_0x6dc3('0x122')](db[_0x6dc3('0x56')],{});db[_0x6dc3('0xdd')][_0x6dc3('0x111')](db[_0x6dc3('0xd6')],{'foreignKey':_0x6dc3('0x1cb')});db[_0x6dc3('0xdd')][_0x6dc3('0x111')](db[_0x6dc3('0x1c8')],{'foreignKey':_0x6dc3('0x1cb')});db['JscriptyProject'][_0x6dc3('0x111')](db[_0x6dc3('0x1c9')],{'foreignKey':_0x6dc3('0x1cb')});db[_0x6dc3('0xe3')][_0x6dc3('0x126')](db['User'],{'as':_0x6dc3('0x16d'),'through':'user_has_square_projects'});db[_0x6dc3('0xe8')][_0x6dc3('0x126')](db[_0x6dc3('0x13')],{'as':_0x6dc3('0x165'),'through':_0x6dc3('0x12c')});db[_0x6dc3('0xe8')][_0x6dc3('0x126')](db[_0x6dc3('0x1b')],{'through':_0x6dc3('0x1cc'),'as':_0x6dc3('0x1cd')});db[_0x6dc3('0xe8')][_0x6dc3('0x126')](db[_0x6dc3('0x173')],{'through':'team_has_mail_queues','as':_0x6dc3('0x1ce')});db['Team']['belongsToMany'](db[_0x6dc3('0x133')],{'through':_0x6dc3('0x1cf'),'as':'ChatQueues'});db[_0x6dc3('0xe8')]['belongsToMany'](db[_0x6dc3('0x135')],{'through':_0x6dc3('0x1d0'),'as':_0x6dc3('0x136')});db[_0x6dc3('0xe8')][_0x6dc3('0x126')](db[_0x6dc3('0x56')],{'through':'team_has_sms_queues','as':_0x6dc3('0x1d1')});db['Team'][_0x6dc3('0x126')](db[_0x6dc3('0x5f')],{'through':_0x6dc3('0x18a'),'as':_0x6dc3('0x137')});db[_0x6dc3('0xe8')][_0x6dc3('0x126')](db[_0x6dc3('0x10b')],{'through':_0x6dc3('0x1d2'),'as':_0x6dc3('0x138')});db['Campaign']['hasMany'](db[_0x6dc3('0x70')],{'as':_0x6dc3('0x148'),'foreignKey':_0x6dc3('0x1d3')});db['Campaign'][_0x6dc3('0x111')](db['CmHopperFinal'],{'as':_0x6dc3('0x116'),'foreignKey':'CampaignId'});db[_0x6dc3('0xec')]['hasMany'](db['CmHopperHistory'],{'as':_0x6dc3('0x14a'),'foreignKey':_0x6dc3('0x1d3')});db[_0x6dc3('0xec')]['hasMany'](db['CmHopperBlack'],{'as':_0x6dc3('0x14b'),'foreignKey':_0x6dc3('0x1d3')});db[_0x6dc3('0xec')][_0x6dc3('0x122')](db[_0x6dc3('0x29')],{'as':_0x6dc3('0x29'),'foreignKey':_0x6dc3('0x14d')});db['Campaign'][_0x6dc3('0x122')](db[_0x6dc3('0x29')],{'as':_0x6dc3('0x14e'),'foreignKey':'TrunkBackupId'});db[_0x6dc3('0xec')][_0x6dc3('0x122')](db[_0x6dc3('0x82')],{'as':_0x6dc3('0x82'),'foreignKey':_0x6dc3('0x150')});db['Campaign'][_0x6dc3('0x122')](db[_0x6dc3('0xe3')],{'as':_0x6dc3('0xe3'),'foreignKey':_0x6dc3('0x1d4')});db[_0x6dc3('0xec')][_0x6dc3('0x126')](db['CmList'],{'as':_0x6dc3('0x12a'),'through':_0x6dc3('0x1d5')});db[_0x6dc3('0xec')]['belongsToMany'](db[_0x6dc3('0xf9')],{'as':_0x6dc3('0x152'),'through':_0x6dc3('0x1d6')});db[_0x6dc3('0xf2')][_0x6dc3('0x122')](db[_0x6dc3('0x3f')],{});db[_0x6dc3('0xf2')][_0x6dc3('0x122')](db['MailInteraction'],{});db['MailTransferReport'][_0x6dc3('0x122')](db[_0x6dc3('0x13c')],{'foreignKey':_0x6dc3('0x1d7'),'as':'FromAccount'});db['MailTransferReport'][_0x6dc3('0x122')](db[_0x6dc3('0x13')],{'foreignKey':_0x6dc3('0x1d8'),'as':_0x6dc3('0x1d9')});db[_0x6dc3('0xf2')][_0x6dc3('0x122')](db['User'],{'foreignKey':_0x6dc3('0x1da'),'as':_0x6dc3('0x1db')});db[_0x6dc3('0xf2')][_0x6dc3('0x122')](db[_0x6dc3('0x173')],{'foreignKey':_0x6dc3('0x1dc'),'as':'ToQueue'});db[_0x6dc3('0xf2')]['belongsTo'](db[_0x6dc3('0x13c')],{'foreignKey':_0x6dc3('0x1dd'),'as':'ToAccount'});db['ChatTransferReport'][_0x6dc3('0x122')](db[_0x6dc3('0x68')],{});db[_0x6dc3('0x1de')][_0x6dc3('0x122')](db[_0x6dc3('0x66')],{});db[_0x6dc3('0x1de')][_0x6dc3('0x122')](db[_0x6dc3('0x61')],{'foreignKey':_0x6dc3('0x1df'),'as':_0x6dc3('0x1e0')});db[_0x6dc3('0x1de')][_0x6dc3('0x122')](db[_0x6dc3('0x13')],{'foreignKey':'FromUserId','as':_0x6dc3('0x1d9')});db['ChatTransferReport'][_0x6dc3('0x122')](db['User'],{'foreignKey':_0x6dc3('0x1da'),'as':'ToAgent'});db[_0x6dc3('0x1de')]['belongsTo'](db[_0x6dc3('0x133')],{'foreignKey':_0x6dc3('0x1e1'),'as':_0x6dc3('0x1e2')});db[_0x6dc3('0x1de')]['belongsTo'](db[_0x6dc3('0x61')],{'foreignKey':_0x6dc3('0x1e3'),'as':_0x6dc3('0x1e4')});db[_0x6dc3('0x1e5')]['belongsTo'](db['FaxMessage'],{});db[_0x6dc3('0x1e5')]['belongsTo'](db['FaxInteraction'],{});db['FaxTransferReport'][_0x6dc3('0x122')](db[_0x6dc3('0x47')],{'foreignKey':_0x6dc3('0x1e6'),'as':_0x6dc3('0x1e0')});db[_0x6dc3('0x1e5')][_0x6dc3('0x122')](db['User'],{'foreignKey':_0x6dc3('0x1d8'),'as':_0x6dc3('0x1d9')});db[_0x6dc3('0x1e5')][_0x6dc3('0x122')](db['User'],{'foreignKey':'ToUserId','as':_0x6dc3('0x1db')});db[_0x6dc3('0x1e5')]['belongsTo'](db[_0x6dc3('0x135')],{'foreignKey':_0x6dc3('0x1e7'),'as':_0x6dc3('0x1e2')});db[_0x6dc3('0x1e5')][_0x6dc3('0x122')](db[_0x6dc3('0x47')],{'foreignKey':_0x6dc3('0x1e8'),'as':_0x6dc3('0x1e4')});db['OpenchannelTransferReport'][_0x6dc3('0x122')](db['OpenchannelMessage'],{});db[_0x6dc3('0xf6')][_0x6dc3('0x122')](db['OpenchannelInteraction'],{});db[_0x6dc3('0xf6')][_0x6dc3('0x122')](db[_0x6dc3('0x58')],{'foreignKey':'FromOpenchannelAccountId','as':'FromAccount'});db[_0x6dc3('0xf6')]['belongsTo'](db[_0x6dc3('0x13')],{'foreignKey':_0x6dc3('0x1d8'),'as':_0x6dc3('0x1d9')});db[_0x6dc3('0xf6')]['belongsTo'](db[_0x6dc3('0x13')],{'foreignKey':_0x6dc3('0x1da'),'as':_0x6dc3('0x1db')});db['OpenchannelTransferReport'][_0x6dc3('0x122')](db[_0x6dc3('0x5f')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x6dc3('0xf6')][_0x6dc3('0x122')](db[_0x6dc3('0x58')],{'foreignKey':_0x6dc3('0x1e9'),'as':_0x6dc3('0x1e4')});db[_0x6dc3('0x1ea')][_0x6dc3('0x122')](db[_0x6dc3('0x54')],{});db[_0x6dc3('0x1ea')]['belongsTo'](db[_0x6dc3('0x52')],{});db[_0x6dc3('0x1ea')]['belongsTo'](db[_0x6dc3('0x4e')],{'foreignKey':_0x6dc3('0x1eb'),'as':'FromAccount'});db[_0x6dc3('0x1ea')][_0x6dc3('0x122')](db['User'],{'foreignKey':_0x6dc3('0x1d8'),'as':_0x6dc3('0x1d9')});db[_0x6dc3('0x1ea')][_0x6dc3('0x122')](db['User'],{'foreignKey':_0x6dc3('0x1da'),'as':_0x6dc3('0x1db')});db[_0x6dc3('0x1ea')][_0x6dc3('0x122')](db['SmsQueue'],{'foreignKey':_0x6dc3('0x1ec'),'as':_0x6dc3('0x1e2')});db[_0x6dc3('0x1ea')][_0x6dc3('0x122')](db['SmsAccount'],{'foreignKey':_0x6dc3('0x1ed'),'as':_0x6dc3('0x1e4')});db[_0x6dc3('0xf9')][_0x6dc3('0x111')](db['Disposition'],{'as':_0x6dc3('0x175'),'foreignKey':'ListId'});db[_0x6dc3('0xf9')]['hasMany'](db['CmCustomField'],{'as':'CustomFields','foreignKey':_0x6dc3('0x17c')});db['CmList'][_0x6dc3('0x111')](db['CmContact'],{'as':_0x6dc3('0x128'),'onDelete':'cascade','foreignKey':_0x6dc3('0x17c')});db[_0x6dc3('0xf9')][_0x6dc3('0x111')](db[_0x6dc3('0x74')],{'as':_0x6dc3('0x116'),'foreignKey':'ListId'});db[_0x6dc3('0xf9')][_0x6dc3('0x111')](db['CmHopperHistory'],{'as':_0x6dc3('0x117'),'foreignKey':_0x6dc3('0x17c')});db['CmList'][_0x6dc3('0x111')](db[_0x6dc3('0x118')],{'as':_0x6dc3('0x118'),'foreignKey':_0x6dc3('0x17c')});db[_0x6dc3('0xf9')]['belongsToMany'](db[_0x6dc3('0x1b')],{'as':_0x6dc3('0x1ee'),'through':'voice_queues_has_cm_lists'});db[_0x6dc3('0xf9')][_0x6dc3('0x126')](db[_0x6dc3('0x13')],{'as':'Agents','through':_0x6dc3('0x12b')});db[_0x6dc3('0xfb')][_0x6dc3('0x111')](db[_0x6dc3('0x113')],{'as':'Extensions','onDelete':'cascade'});db['VoicePrefix'][_0x6dc3('0x126')](db[_0x6dc3('0x13')],{'as':_0x6dc3('0x165'),'through':_0x6dc3('0x1ef')});db[_0x6dc3('0x123')][_0x6dc3('0x111')](db[_0x6dc3('0x13')],{'as':_0x6dc3('0x16d'),'foreignKey':_0x6dc3('0x124')});db[_0x6dc3('0x123')][_0x6dc3('0x111')](db[_0x6dc3('0x1f0')],{'as':_0x6dc3('0x1f1'),'foreignKey':_0x6dc3('0x124'),'onDelete':_0x6dc3('0x115')});db[_0x6dc3('0x1f0')][_0x6dc3('0x111')](db[_0x6dc3('0xfe')],{'as':_0x6dc3('0x1f2'),'foreignKey':_0x6dc3('0x1f3'),'onDelete':'cascade'});db['WhatsappAccount'][_0x6dc3('0x111')](db[_0x6dc3('0x7e')],{'as':_0x6dc3('0x175'),'foreignKey':_0x6dc3('0x1f4')});db[_0x6dc3('0x102')][_0x6dc3('0x111')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x6dc3('0x1f4')});db[_0x6dc3('0x102')]['hasMany'](db[_0x6dc3('0x107')],{'as':'Messages','foreignKey':_0x6dc3('0x1f4')});db[_0x6dc3('0x102')]['hasMany'](db[_0x6dc3('0x11d')],{'as':_0x6dc3('0x160')});db['WhatsappAccount'][_0x6dc3('0x111')](db['WhatsappApplication'],{'as':_0x6dc3('0x146')});db[_0x6dc3('0x102')]['belongsTo'](db['CmList'],{'as':_0x6dc3('0x161'),'foreignKey':_0x6dc3('0x17c')});db[_0x6dc3('0x102')][_0x6dc3('0x122')](db[_0x6dc3('0x84')],{'as':_0x6dc3('0x163'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x6dc3('0x102')][_0x6dc3('0x126')](db[_0x6dc3('0x13')],{'as':_0x6dc3('0x165'),'through':_0x6dc3('0x141')});db['WhatsappApplication'][_0x6dc3('0x122')](db[_0x6dc3('0x13')],{'onDelete':'restrict'});db[_0x6dc3('0x104')][_0x6dc3('0x122')](db[_0x6dc3('0x10b')],{'onDelete':'restrict'});db[_0x6dc3('0x104')][_0x6dc3('0x122')](db[_0x6dc3('0x102')],{'onDelete':_0x6dc3('0x172')});db['WhatsappApplication'][_0x6dc3('0x122')](db[_0x6dc3('0x82')],{'onDelete':_0x6dc3('0x172'),'foreignKey':_0x6dc3('0x150')});db['WhatsappApplication'][_0x6dc3('0x122')](db[_0x6dc3('0x8d')],{'onDelete':_0x6dc3('0x172'),'foreignKey':_0x6dc3('0x174')});db[_0x6dc3('0x11d')][_0x6dc3('0x111')](db['WhatsappMessage'],{'as':_0x6dc3('0x153'),'onDelete':'cascade','foreignKey':_0x6dc3('0x1f5')});db[_0x6dc3('0x11d')]['belongsTo'](db['WhatsappAccount'],{'as':_0x6dc3('0x171'),'foreignKey':_0x6dc3('0x1f4')});db[_0x6dc3('0x11d')][_0x6dc3('0x122')](db[_0x6dc3('0x127')],{'as':_0x6dc3('0x168'),'foreignKey':_0x6dc3('0x15b')});db['WhatsappInteraction'][_0x6dc3('0x122')](db[_0x6dc3('0x13')],{'as':'Owner','foreignKey':_0x6dc3('0x10f')});db['WhatsappInteraction']['belongsToMany'](db[_0x6dc3('0x8d')],{'through':_0x6dc3('0x1a7'),'as':'Tags'});db[_0x6dc3('0x11d')][_0x6dc3('0x126')](db['Tag'],{'through':_0x6dc3('0x1a7'),'as':'ThroughTags'});db['WhatsappInteraction'][_0x6dc3('0x126')](db[_0x6dc3('0x13')],{'as':'Users','through':_0x6dc3('0x1f6'),'foreignKey':_0x6dc3('0x1f5')});db[_0x6dc3('0x107')]['belongsTo'](db[_0x6dc3('0x13')],{'as':_0x6dc3('0x13')});db[_0x6dc3('0x107')][_0x6dc3('0x122')](db[_0x6dc3('0x127')],{'onDelete':_0x6dc3('0x115'),'as':'Contact'});db['WhatsappMessage'][_0x6dc3('0x122')](db[_0x6dc3('0x11d')],{'onDelete':_0x6dc3('0x115'),'as':'Interaction','foreignKey':_0x6dc3('0x1f5')});db['WhatsappMessage'][_0x6dc3('0x122')](db[_0x6dc3('0x102')],{'as':_0x6dc3('0x171'),'foreignKey':_0x6dc3('0x1f4')});db['WhatsappQueueReport']['belongsTo'](db['WhatsappAccount'],{});db[_0x6dc3('0x1f7')][_0x6dc3('0x122')](db['CmList'],{'as':_0x6dc3('0x161'),'foreignKey':_0x6dc3('0x17c')});db[_0x6dc3('0x1f7')]['belongsTo'](db['CmContact'],{'as':_0x6dc3('0x168'),'foreignKey':_0x6dc3('0x15b')});db[_0x6dc3('0x1f7')]['belongsTo'](db[_0x6dc3('0x11d')],{});db['WhatsappQueueReport'][_0x6dc3('0x122')](db[_0x6dc3('0x10b')],{});db[_0x6dc3('0x1f7')][_0x6dc3('0x122')](db[_0x6dc3('0x107')],{});db[_0x6dc3('0x1f7')]['belongsTo'](db[_0x6dc3('0x13')],{});db[_0x6dc3('0x10a')][_0x6dc3('0x122')](db[_0x6dc3('0x107')],{});db[_0x6dc3('0x10a')][_0x6dc3('0x122')](db['WhatsappInteraction'],{});db['WhatsappTransferReport'][_0x6dc3('0x122')](db['WhatsappAccount'],{'foreignKey':_0x6dc3('0x1f8'),'as':'FromAccount'});db['WhatsappTransferReport'][_0x6dc3('0x122')](db['WhatsappAccount'],{'foreignKey':_0x6dc3('0x1f9'),'as':_0x6dc3('0x1e4')});db['WhatsappTransferReport'][_0x6dc3('0x122')](db[_0x6dc3('0x10b')],{'foreignKey':_0x6dc3('0x1fa'),'as':_0x6dc3('0x1e2')});db[_0x6dc3('0x10a')]['belongsTo'](db['User'],{'foreignKey':_0x6dc3('0x1d8'),'as':_0x6dc3('0x1d9')});db['WhatsappTransferReport'][_0x6dc3('0x122')](db[_0x6dc3('0x13')],{'foreignKey':_0x6dc3('0x1da'),'as':_0x6dc3('0x1db')});db['WhatsappQueue'][_0x6dc3('0x126')](db[_0x6dc3('0x13')],{'as':_0x6dc3('0x165'),'through':_0x6dc3('0x37'),'foreignKey':_0x6dc3('0x1fb')});db['WhatsappQueue'][_0x6dc3('0x126')](db[_0x6dc3('0xe8')],{'through':_0x6dc3('0x1d2'),'as':_0x6dc3('0x167')});module[_0x6dc3('0x1fc')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 5b3bc8e..0735a97 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe02=['lodash','path','express','express-winston','./errors','./config/environment','./config/logger','api','auth','default','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','headers','x-forwarded-for','remoteAddress','url','statusCode','responseTime','user','name','role','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','method','connection','agent_name','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','./api/tag','/api/templates','/api/triggers','./api/trigger','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskConfiguration','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/campaign','/api/migrations','/api/attachments','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/cm/lists','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','/api/jira','./api/version','/api/system','/api/pm2','/api/webbar','./api/webbar','/apidoc','static','root','join','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','/index.html','username','password','firstName','lastName','street','phone','mobile','fax','email','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridnum','exten','vidaooApiKey','privateKey','key','accountSid','dsn','registry','oldPassword','length','isPlainObject','isString','replace','@@{','}@@'];(function(_0x38b50c,_0x1952dc){var _0x5806ad=function(_0x1c33c7){while(--_0x1c33c7){_0x38b50c['push'](_0x38b50c['shift']());}};_0x5806ad(++_0x1952dc);}(_0xbe02,0x146));var _0x2be0=function(_0x418ae4,_0x35892e){_0x418ae4=_0x418ae4-0x0;var _0x239825=_0xbe02[_0x418ae4];return _0x239825;};'use strict';var _=require(_0x2be0('0x0'));var path=require(_0x2be0('0x1'));var express=require(_0x2be0('0x2'));var ewinston=require(_0x2be0('0x3'));var util=require('util');var errors=require(_0x2be0('0x4'));var config=require(_0x2be0('0x5'));var logger=require(_0x2be0('0x6'))(_0x2be0('0x7'));var authLogger=require(_0x2be0('0x6'))(_0x2be0('0x8'));exports[_0x2be0('0x9')]=function(_0x474a35){_0x474a35[_0x2be0('0xa')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x4ca22f,_0x176f12){var _0xdfef68=_0x2be0('0xb');if(!_[_0x2be0('0xc')](_0x4ca22f[_0x2be0('0xd')])){_0xdfef68+=_0x2be0('0xe');var _0x5f54ac=_0x4ca22f['body'];maskSensitiveData(_0x5f54ac);}return util['format'](_0xdfef68,_0x4ca22f['method'],_0x4ca22f['headers']['x-forwarded-for']?_0x4ca22f[_0x2be0('0xf')][_0x2be0('0x10')]:_0x4ca22f['connection'][_0x2be0('0x11')]||_0x4ca22f['ip'],_0x4ca22f[_0x2be0('0x12')],_0x176f12[_0x2be0('0x13')],_0x176f12[_0x2be0('0x14')],_0x4ca22f[_0x2be0('0x15')]?_0x4ca22f[_0x2be0('0x15')]['id']:null,_0x4ca22f[_0x2be0('0x15')]?_0x4ca22f[_0x2be0('0x15')][_0x2be0('0x16')]:null,_0x4ca22f[_0x2be0('0x15')]?_0x4ca22f['user'][_0x2be0('0x17')]:null,_0x5f54ac?util[_0x2be0('0x18')](_0x5f54ac,![],null):'');}}));_0x474a35['use'](ewinston[_0x2be0('0x19')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x1e0c27,_0x5bcbc5){var _0x334070=_0x2be0('0x1a');if(_0x1e0c27[_0x2be0('0xd')]&&_0x1e0c27[_0x2be0('0xd')][_0x2be0('0x1b')]&&_0x1e0c27[_0x2be0('0xd')][_0x2be0('0x1c')]){_0x334070=_0x2be0('0x1d');}return util[_0x2be0('0x1e')](_0x334070,_0x1e0c27[_0x2be0('0x1f')],_0x1e0c27[_0x2be0('0xf')][_0x2be0('0x10')]?_0x1e0c27[_0x2be0('0xf')][_0x2be0('0x10')]:_0x1e0c27[_0x2be0('0x20')][_0x2be0('0x11')]||_0x1e0c27['ip'],_0x1e0c27[_0x2be0('0x12')],_0x5bcbc5['statusCode'],_0x5bcbc5['responseTime'],_0x1e0c27[_0x2be0('0x15')]?_0x1e0c27['user']['id']:null,_0x1e0c27['user']?_0x1e0c27[_0x2be0('0x15')][_0x2be0('0x16')]:null,_0x1e0c27[_0x2be0('0x15')]?_0x1e0c27[_0x2be0('0x15')][_0x2be0('0x17')]:null,_0x1e0c27[_0x2be0('0xd')]&&_0x1e0c27[_0x2be0('0xd')][_0x2be0('0x1b')]?_0x1e0c27['body'][_0x2be0('0x1b')]:'other',_0x1e0c27['body']&&_0x1e0c27[_0x2be0('0xd')][_0x2be0('0x1c')]?_0x1e0c27[_0x2be0('0xd')][_0x2be0('0x1c')]:'',_0x1e0c27[_0x2be0('0xd')]&&_0x1e0c27[_0x2be0('0xd')][_0x2be0('0x21')]?_0x1e0c27['body'][_0x2be0('0x21')]:'');},'ignoreRoute':function(_0x2a605b){var _0x559a66=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x559a66['test'](_0x2a605b[_0x2be0('0x12')]);}}));_0x474a35[_0x2be0('0xa')]('/api/users',require(_0x2be0('0x22')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x23'),require(_0x2be0('0x24')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x25'),require(_0x2be0('0x26')));_0x474a35['use'](_0x2be0('0x27'),require('./api/voiceExtension'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x28'),require(_0x2be0('0x29')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x2a'),require(_0x2be0('0x2b')));_0x474a35[_0x2be0('0xa')]('/api/voice/recordings',require(_0x2be0('0x2c')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x2d'),require(_0x2be0('0x2e')));_0x474a35[_0x2be0('0xa')]('/api/voice/mails',require(_0x2be0('0x2f')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x30'),require(_0x2be0('0x31')));_0x474a35[_0x2be0('0xa')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x32'),require(_0x2be0('0x33')));_0x474a35['use']('/api/voice/agents/reports',require('./api/voiceAgentReport'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x34'),require(_0x2be0('0x35')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x36'),require(_0x2be0('0x37')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x38'),require(_0x2be0('0x39')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x3a'),require('./api/voiceTransferReport'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x3b'),require(_0x2be0('0x3c')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x3d'),require('./api/mailAccount'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x3e'),require(_0x2be0('0x3f')));_0x474a35['use'](_0x2be0('0x40'),require('./api/mailSubstatus'));_0x474a35[_0x2be0('0xa')]('/api/mail/interactions',require('./api/mailInteraction'));_0x474a35[_0x2be0('0xa')]('/api/mail/messages',require(_0x2be0('0x41')));_0x474a35['use'](_0x2be0('0x42'),require('./api/mailApplication'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x43'),require(_0x2be0('0x44')));_0x474a35['use'](_0x2be0('0x45'),require('./api/dashboard'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x46'),require(_0x2be0('0x47')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x48'),require(_0x2be0('0x49')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x4a'),require(_0x2be0('0x4b')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x4c'),require(_0x2be0('0x4d')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x4e'),require(_0x2be0('0x4f')));_0x474a35['use'](_0x2be0('0x50'),require('./api/faxQueue'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x51'),require(_0x2be0('0x52')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x53'),require(_0x2be0('0x54')));_0x474a35[_0x2be0('0xa')]('/api/sms/applications',require(_0x2be0('0x55')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x56'),require(_0x2be0('0x57')));_0x474a35[_0x2be0('0xa')]('/api/sms/messages',require(_0x2be0('0x58')));_0x474a35['use'](_0x2be0('0x59'),require(_0x2be0('0x5a')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x5b'),require(_0x2be0('0x5c')));_0x474a35[_0x2be0('0xa')]('/api/openchannel/applications',require(_0x2be0('0x5d')));_0x474a35['use'](_0x2be0('0x5e'),require(_0x2be0('0x5f')));_0x474a35['use'](_0x2be0('0x60'),require(_0x2be0('0x61')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x62'),require(_0x2be0('0x63')));_0x474a35['use']('/api/chat/websites',require(_0x2be0('0x64')));_0x474a35[_0x2be0('0xa')]('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x65'),require(_0x2be0('0x66')));_0x474a35[_0x2be0('0xa')]('/api/chat/interactions',require(_0x2be0('0x67')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x68'),require(_0x2be0('0x69')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x6a'),require(_0x2be0('0x6b')));_0x474a35['use'](_0x2be0('0x6c'),require(_0x2be0('0x6d')));_0x474a35['use'](_0x2be0('0x6e'),require(_0x2be0('0x6f')));_0x474a35[_0x2be0('0xa')]('/api/chat/proactive_actions',require(_0x2be0('0x70')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x71'),require(_0x2be0('0x72')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x73'),require(_0x2be0('0x74')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x75'),require('./api/cmHopper'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x76'),require(_0x2be0('0x77')));_0x474a35[_0x2be0('0xa')]('/api/cm/hopper_final',require(_0x2be0('0x78')));_0x474a35['use'](_0x2be0('0x79'),require(_0x2be0('0x7a')));_0x474a35['use'](_0x2be0('0x7b'),require('./api/cmCustomField'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x7c'),require('./api/action'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x7d'),require(_0x2be0('0x7e')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x7f'),require(_0x2be0('0x80')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x81'),require(_0x2be0('0x82')));_0x474a35['use'](_0x2be0('0x83'),require(_0x2be0('0x84')));_0x474a35[_0x2be0('0xa')]('/api/intervals',require(_0x2be0('0x85')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x86'),require(_0x2be0('0x87')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x88'),require(_0x2be0('0x89')));_0x474a35['use'](_0x2be0('0x8a'),require(_0x2be0('0x8b')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x8c'),require(_0x2be0('0x8d')));_0x474a35[_0x2be0('0xa')]('/api/sounds',require(_0x2be0('0x8e')));_0x474a35['use']('/api/tags',require(_0x2be0('0x8f')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x90'),require('./api/template'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x91'),require(_0x2be0('0x92')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x93'),require('./api/variable'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x94'),require(_0x2be0('0x95')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x96'),require(_0x2be0('0x97')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x98'),require(_0x2be0('0x99')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x9a'),require('./api/analyticDefaultReport'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x9b'),require('./api/analyticExtractedReport'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x9c'),require(_0x2be0('0x9d')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x9e'),require('./api/analyticFieldReport'));_0x474a35['use'](_0x2be0('0x9f'),require(_0x2be0('0xa0')));_0x474a35[_0x2be0('0xa')]('/api/integrations/salesforce/accounts',require(_0x2be0('0xa1')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xa2'),require(_0x2be0('0xa3')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xa4'),require(_0x2be0('0xa5')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xa6'),require(_0x2be0('0xa7')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xa8'),require(_0x2be0('0xa9')));_0x474a35[_0x2be0('0xa')]('/api/integrations/sugarcrm/fields',require(_0x2be0('0xaa')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xab'),require(_0x2be0('0xac')));_0x474a35['use']('/api/integrations/desk/configurations',require(_0x2be0('0xad')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xae'),require(_0x2be0('0xaf')));_0x474a35['use'](_0x2be0('0xb0'),require(_0x2be0('0xb1')));_0x474a35['use'](_0x2be0('0xb2'),require(_0x2be0('0xb3')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xb4'),require(_0x2be0('0xb5')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xb6'),require('./api/intZendeskAccount'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xb7'),require(_0x2be0('0xb8')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xb9'),require(_0x2be0('0xba')));_0x474a35['use']('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x474a35[_0x2be0('0xa')]('/api/integrations/freshdesk/configurations',require(_0x2be0('0xbb')));_0x474a35[_0x2be0('0xa')]('/api/integrations/freshdesk/fields',require(_0x2be0('0xbc')));_0x474a35[_0x2be0('0xa')]('/api/integrations/vtiger/accounts',require(_0x2be0('0xbd')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xbe'),require(_0x2be0('0xbf')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xc0'),require('./api/intVtigerField'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xc1'),require(_0x2be0('0xc2')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xc3'),require(_0x2be0('0xc4')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xc5'),require(_0x2be0('0xc6')));_0x474a35[_0x2be0('0xa')]('/api/integrations/dynamics365/accounts',require(_0x2be0('0xc7')));_0x474a35[_0x2be0('0xa')]('/api/integrations/dynamics365/configurations',require(_0x2be0('0xc8')));_0x474a35['use'](_0x2be0('0xc9'),require(_0x2be0('0xca')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xcb'),require(_0x2be0('0xcc')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xcd'),require('./api/intFreshsalesConfiguration'));_0x474a35['use'](_0x2be0('0xce'),require('./api/intFreshsalesField'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xcf'),require(_0x2be0('0xd0')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xd1'),require(_0x2be0('0xd2')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xd3'),require('./api/chatInternalMessage'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xd4'),require(_0x2be0('0xd5')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xd6'),require(_0x2be0('0xd7')));_0x474a35['use'](_0x2be0('0xd8'),require('./api/jscriptySessionReport'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xd9'),require(_0x2be0('0xda')));_0x474a35['use'](_0x2be0('0xdb'),require('./api/squareReport'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xdc'),require(_0x2be0('0xdd')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xde'),require(_0x2be0('0xdf')));_0x474a35['use'](_0x2be0('0xe0'),require(_0x2be0('0xe1')));_0x474a35[_0x2be0('0xa')]('/api/square/odbc',require(_0x2be0('0xe2')));_0x474a35[_0x2be0('0xa')]('/api/square/projects',require('./api/squareProject'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xe3'),require(_0x2be0('0xe4')));_0x474a35['use'](_0x2be0('0xe5'),require(_0x2be0('0xe6')));_0x474a35['use'](_0x2be0('0xe7'),require(_0x2be0('0xe8')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xe9'),require('./api/license'));_0x474a35[_0x2be0('0xa')]('/api/campaigns',require(_0x2be0('0xea')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xeb'),require('./api/migration'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xec'),require('./api/attachment'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xed'),require('./api/plugin'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xee'),require(_0x2be0('0xef')));_0x474a35['use']('/api/chat/reports/transfer',require(_0x2be0('0xf0')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xf1'),require(_0x2be0('0xf2')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xf3'),require(_0x2be0('0xf4')));_0x474a35['use']('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xf5'),require('./api/cmList'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xf6'),require('./api/voicePrefix'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xf7'),require(_0x2be0('0xf8')));_0x474a35['use'](_0x2be0('0xf9'),require('./api/userProfileSection'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xfa'),require(_0x2be0('0xfb')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xfc'),require(_0x2be0('0xfd')));_0x474a35[_0x2be0('0xa')](_0x2be0('0xfe'),require('./api/userNotification'));_0x474a35[_0x2be0('0xa')](_0x2be0('0xff'),require(_0x2be0('0x100')));_0x474a35[_0x2be0('0xa')]('/api/whatsapp/applications',require(_0x2be0('0x101')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x102'),require('./api/whatsappInteraction'));_0x474a35['use']('/api/whatsapp/messages',require(_0x2be0('0x103')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x104'),require('./api/whatsappQueueReport'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x105'),require(_0x2be0('0x106')));_0x474a35[_0x2be0('0xa')]('/api/whatsapp/queues',require(_0x2be0('0x107')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x108'),require(_0x2be0('0x109')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x10a'),require(_0x2be0('0x10b')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x10c'),require('./api/authGoogle'));_0x474a35['use'](_0x2be0('0x10d'),require('./api/jira'));_0x474a35[_0x2be0('0xa')]('/api/rpc',require('./api/rpc'));_0x474a35['use']('/api/version',require(_0x2be0('0x10e')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x10f'),require('./api/system'));_0x474a35[_0x2be0('0xa')](_0x2be0('0x110'),require('./api/pm2'));_0x474a35['use'](_0x2be0('0x111'),require(_0x2be0('0x112')));_0x474a35['use'](_0x2be0('0x113'),express[_0x2be0('0x114')](path['join'](config[_0x2be0('0x115')],_0x2be0('0x113'))));_0x474a35[_0x2be0('0xa')]('/www',express[_0x2be0('0x114')](path[_0x2be0('0x116')](config[_0x2be0('0x115')],'/www')));_0x474a35[_0x2be0('0xa')]('/demo',express[_0x2be0('0x114')](path['join'](config[_0x2be0('0x115')],'/demo')));_0x474a35[_0x2be0('0xa')](_0x2be0('0x117'),express[_0x2be0('0x114')](path[_0x2be0('0x116')](config[_0x2be0('0x115')],_0x2be0('0x118'),_0x2be0('0x119'))));_0x474a35[_0x2be0('0xa')](_0x2be0('0x11a'),express[_0x2be0('0x114')](path[_0x2be0('0x116')](config[_0x2be0('0x115')],_0x2be0('0x11b'))));_0x474a35[_0x2be0('0x11c')](_0x2be0('0x11d'))[_0x2be0('0x11e')](errors[0x194]);_0x474a35[_0x2be0('0x11c')]('/*')['get'](function(_0x5c20ca,_0x212b55){_0x212b55['sendFile'](path[_0x2be0('0x11f')](_0x474a35[_0x2be0('0x11e')]('appPath')+_0x2be0('0x120')));});};var sensitiveFields=[_0x2be0('0x121'),_0x2be0('0x122'),'newPassword','apiKey',_0x2be0('0x123'),_0x2be0('0x124'),_0x2be0('0x125'),_0x2be0('0x126'),_0x2be0('0x127'),_0x2be0('0x128'),_0x2be0('0x129'),'clientId',_0x2be0('0x12a'),_0x2be0('0x12b'),_0x2be0('0x12c'),_0x2be0('0x12d'),_0x2be0('0x12e'),_0x2be0('0x12f'),_0x2be0('0x130'),_0x2be0('0x131'),_0x2be0('0x132'),_0x2be0('0x133'),_0x2be0('0x134'),_0x2be0('0x135'),_0x2be0('0x136'),'calleridname',_0x2be0('0x137'),_0x2be0('0x138'),_0x2be0('0x139'),'clientEmail',_0x2be0('0x13a'),'accesskeyid','secretaccesskey',_0x2be0('0x13b'),_0x2be0('0x15'),'pass',_0x2be0('0x13c'),'localstationid',_0x2be0('0x13d'),'secret',_0x2be0('0x13e'),_0x2be0('0x13f')];function maskSensitiveData(_0x53f049){var _0x5de3c3=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x53f049))return;for(var _0x579f3a in _0x53f049){if(_['isArray'](_0x53f049[_0x579f3a])){for(var _0xcf444e=0x0;_0xcf444e<_0x53f049[_0x579f3a][_0x2be0('0x140')];_0xcf444e++){maskSensitiveData(_0x53f049[_0x579f3a][_0xcf444e]);}}else if(_[_0x2be0('0x141')](_0x53f049[_0x579f3a])){maskSensitiveData(_0x53f049[_0x579f3a]);}else if(_[_0x2be0('0x142')](_0x53f049[_0x579f3a])){_0x53f049[_0x579f3a]=_0x53f049[_0x579f3a][_0x2be0('0x143')](/{{{/g,_0x2be0('0x144'))[_0x2be0('0x143')](/}}}/g,_0x2be0('0x145'))['replace'](/{{/g,'@{')[_0x2be0('0x143')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x579f3a)){_0x53f049[_0x579f3a]=_0x53f049[_0x579f3a][_0x2be0('0x143')](_0x5de3c3,'*');}}}} \ No newline at end of file +var _0xe7b9=['phone','mobile','fax','email','clientId','securityToken','accessKey','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','@@{','replace','}@@','includes','lodash','path','express','./errors','./config/environment','./config/logger','default','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','user','use','%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)','format','method','url','name','other','agent_id','agent_name','test','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceQueue','./api/voiceRecording','./api/screenRecording','./api/voiceMail','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','/api/mail/interactions','./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/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/tag','/api/templates','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/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/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/system','/api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','username','password','apiKey','firstName','street'];(function(_0x53e147,_0x299763){var _0x5f5c47=function(_0x1ce66b){while(--_0x1ce66b){_0x53e147['push'](_0x53e147['shift']());}};_0x5f5c47(++_0x299763);}(_0xe7b9,0x170));var _0x9e7b=function(_0x4fd606,_0x470329){_0x4fd606=_0x4fd606-0x0;var _0x4b5f13=_0xe7b9[_0x4fd606];return _0x4b5f13;};'use strict';var _=require(_0x9e7b('0x0'));var path=require(_0x9e7b('0x1'));var express=require(_0x9e7b('0x2'));var ewinston=require('express-winston');var util=require('util');var errors=require(_0x9e7b('0x3'));var config=require(_0x9e7b('0x4'));var logger=require('./config/logger')('api');var authLogger=require(_0x9e7b('0x5'))('auth');exports[_0x9e7b('0x6')]=function(_0x543b7e){_0x543b7e['use'](ewinston[_0x9e7b('0x7')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x377a75,_0x13a37d){var _0x5ed982=_0x9e7b('0x8');if(!_[_0x9e7b('0x9')](_0x377a75[_0x9e7b('0xa')])){_0x5ed982+=_0x9e7b('0xb');var _0xc8bbba=_0x377a75['body'];maskSensitiveData(_0xc8bbba);}return util['format'](_0x5ed982,_0x377a75['method'],_0x377a75[_0x9e7b('0xc')][_0x9e7b('0xd')]?_0x377a75[_0x9e7b('0xc')][_0x9e7b('0xd')]:_0x377a75[_0x9e7b('0xe')][_0x9e7b('0xf')]||_0x377a75['ip'],_0x377a75['url'],_0x13a37d[_0x9e7b('0x10')],_0x13a37d[_0x9e7b('0x11')],_0x377a75[_0x9e7b('0x12')]?_0x377a75[_0x9e7b('0x12')]['id']:null,_0x377a75['user']?_0x377a75[_0x9e7b('0x12')]['name']:null,_0x377a75[_0x9e7b('0x12')]?_0x377a75[_0x9e7b('0x12')]['role']:null,_0xc8bbba?util['inspect'](_0xc8bbba,![],null):'');}}));_0x543b7e[_0x9e7b('0x13')](ewinston[_0x9e7b('0x7')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0xfc0ea9,_0x59b4b3){var _0x2df22a=_0x9e7b('0x14');if(_0xfc0ea9[_0x9e7b('0xa')]&&_0xfc0ea9[_0x9e7b('0xa')][_0x9e7b('0x15')]&&_0xfc0ea9[_0x9e7b('0xa')]['agent_id']){_0x2df22a=_0x9e7b('0x16');}return util[_0x9e7b('0x17')](_0x2df22a,_0xfc0ea9[_0x9e7b('0x18')],_0xfc0ea9[_0x9e7b('0xc')][_0x9e7b('0xd')]?_0xfc0ea9[_0x9e7b('0xc')]['x-forwarded-for']:_0xfc0ea9['connection'][_0x9e7b('0xf')]||_0xfc0ea9['ip'],_0xfc0ea9[_0x9e7b('0x19')],_0x59b4b3['statusCode'],_0x59b4b3[_0x9e7b('0x11')],_0xfc0ea9[_0x9e7b('0x12')]?_0xfc0ea9[_0x9e7b('0x12')]['id']:null,_0xfc0ea9[_0x9e7b('0x12')]?_0xfc0ea9[_0x9e7b('0x12')][_0x9e7b('0x1a')]:null,_0xfc0ea9[_0x9e7b('0x12')]?_0xfc0ea9[_0x9e7b('0x12')]['role']:null,_0xfc0ea9[_0x9e7b('0xa')]&&_0xfc0ea9[_0x9e7b('0xa')][_0x9e7b('0x15')]?_0xfc0ea9[_0x9e7b('0xa')][_0x9e7b('0x15')]:_0x9e7b('0x1b'),_0xfc0ea9[_0x9e7b('0xa')]&&_0xfc0ea9['body']['agent_id']?_0xfc0ea9[_0x9e7b('0xa')][_0x9e7b('0x1c')]:'',_0xfc0ea9[_0x9e7b('0xa')]&&_0xfc0ea9['body'][_0x9e7b('0x1d')]?_0xfc0ea9['body']['agent_name']:'');},'ignoreRoute':function(_0x35147c){var _0x17292c=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x17292c[_0x9e7b('0x1e')](_0x35147c[_0x9e7b('0x19')]);}}));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x1f'),require(_0x9e7b('0x20')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x21'),require('./api/voiceChanSpy'));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x22'),require(_0x9e7b('0x23')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x24'),require(_0x9e7b('0x25')));_0x543b7e['use'](_0x9e7b('0x26'),require('./api/voiceMusicOnHold'));_0x543b7e[_0x9e7b('0x13')]('/api/voice/queues',require(_0x9e7b('0x27')));_0x543b7e[_0x9e7b('0x13')]('/api/voice/recordings',require(_0x9e7b('0x28')));_0x543b7e[_0x9e7b('0x13')]('/api/screen/recordings',require(_0x9e7b('0x29')));_0x543b7e['use']('/api/voice/mails',require(_0x9e7b('0x2a')));_0x543b7e[_0x9e7b('0x13')]('/api/voice/mails/messages',require(_0x9e7b('0x2b')));_0x543b7e['use']('/api/voice/calls/reports',require(_0x9e7b('0x2c')));_0x543b7e['use'](_0x9e7b('0x2d'),require(_0x9e7b('0x2e')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x2f'),require(_0x9e7b('0x30')));_0x543b7e[_0x9e7b('0x13')]('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x31'),require('./api/memberReport'));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x32'),require(_0x9e7b('0x33')));_0x543b7e['use'](_0x9e7b('0x34'),require(_0x9e7b('0x35')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x36'),require(_0x9e7b('0x37')));_0x543b7e[_0x9e7b('0x13')]('/api/mail/accounts',require(_0x9e7b('0x38')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x39'),require('./api/mailQueue'));_0x543b7e[_0x9e7b('0x13')]('/api/mail/substatuses',require('./api/mailSubstatus'));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x3a'),require(_0x9e7b('0x3b')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x3c'),require(_0x9e7b('0x3d')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x3e'),require(_0x9e7b('0x3f')));_0x543b7e['use']('/api/mail/reports/queue',require(_0x9e7b('0x40')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x41'),require(_0x9e7b('0x42')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x43'),require(_0x9e7b('0x44')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x45'),require(_0x9e7b('0x46')));_0x543b7e[_0x9e7b('0x13')]('/api/fax/applications',require(_0x9e7b('0x47')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x48'),require(_0x9e7b('0x49')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x4a'),require(_0x9e7b('0x4b')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x4c'),require(_0x9e7b('0x4d')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x4e'),require(_0x9e7b('0x4f')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x50'),require('./api/smsAccount'));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x51'),require(_0x9e7b('0x52')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x53'),require(_0x9e7b('0x54')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x55'),require(_0x9e7b('0x56')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x57'),require(_0x9e7b('0x58')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x59'),require('./api/openchannelAccount'));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x5a'),require(_0x9e7b('0x5b')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x5c'),require(_0x9e7b('0x5d')));_0x543b7e[_0x9e7b('0x13')]('/api/openchannel/messages',require(_0x9e7b('0x5e')));_0x543b7e[_0x9e7b('0x13')]('/api/openchannel/queues',require(_0x9e7b('0x5f')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x60'),require(_0x9e7b('0x61')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x62'),require(_0x9e7b('0x63')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x64'),require(_0x9e7b('0x65')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x66'),require(_0x9e7b('0x67')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x68'),require(_0x9e7b('0x69')));_0x543b7e['use'](_0x9e7b('0x6a'),require('./api/chatOfflineMessage'));_0x543b7e[_0x9e7b('0x13')]('/api/chat/queues',require(_0x9e7b('0x6b')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x6c'),require('./api/chatGroup'));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x6d'),require('./api/chatProactiveAction'));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x6e'),require(_0x9e7b('0x6f')));_0x543b7e['use'](_0x9e7b('0x70'),require(_0x9e7b('0x71')));_0x543b7e[_0x9e7b('0x13')]('/api/cm/hopper',require('./api/cmHopper'));_0x543b7e[_0x9e7b('0x13')]('/api/cm/hopper_black',require('./api/cmHopperBlack'));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x72'),require(_0x9e7b('0x73')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x74'),require(_0x9e7b('0x75')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x76'),require(_0x9e7b('0x77')));_0x543b7e['use'](_0x9e7b('0x78'),require(_0x9e7b('0x79')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x7a'),require('./api/automation'));_0x543b7e['use'](_0x9e7b('0x7b'),require(_0x9e7b('0x7c')));_0x543b7e[_0x9e7b('0x13')]('/api/dispositions',require(_0x9e7b('0x7d')));_0x543b7e['use'](_0x9e7b('0x7e'),require(_0x9e7b('0x7f')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x80'),require(_0x9e7b('0x81')));_0x543b7e[_0x9e7b('0x13')]('/api/pauses',require('./api/pause'));_0x543b7e['use'](_0x9e7b('0x82'),require(_0x9e7b('0x83')));_0x543b7e['use'](_0x9e7b('0x84'),require(_0x9e7b('0x85')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x86'),require(_0x9e7b('0x87')));_0x543b7e['use']('/api/sounds',require(_0x9e7b('0x88')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x89'),require(_0x9e7b('0x8a')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x8b'),require('./api/template'));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x8c'),require(_0x9e7b('0x8d')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x8e'),require(_0x9e7b('0x8f')));_0x543b7e['use'](_0x9e7b('0x90'),require(_0x9e7b('0x91')));_0x543b7e['use'](_0x9e7b('0x92'),require('./api/integrationReport'));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x93'),require(_0x9e7b('0x94')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x95'),require('./api/analyticDefaultReport'));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x96'),require('./api/analyticExtractedReport'));_0x543b7e['use'](_0x9e7b('0x97'),require(_0x9e7b('0x98')));_0x543b7e[_0x9e7b('0x13')]('/api/analytics/field_reports',require(_0x9e7b('0x99')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x9a'),require(_0x9e7b('0x9b')));_0x543b7e['use'](_0x9e7b('0x9c'),require(_0x9e7b('0x9d')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x9e'),require(_0x9e7b('0x9f')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xa0'),require(_0x9e7b('0xa1')));_0x543b7e[_0x9e7b('0x13')]('/api/integrations/sugarcrm/accounts',require(_0x9e7b('0xa2')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xa3'),require(_0x9e7b('0xa4')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xa5'),require(_0x9e7b('0xa6')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xa7'),require(_0x9e7b('0xa8')));_0x543b7e[_0x9e7b('0x13')]('/api/integrations/desk/configurations',require(_0x9e7b('0xa9')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xaa'),require(_0x9e7b('0xab')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xac'),require(_0x9e7b('0xad')));_0x543b7e[_0x9e7b('0x13')]('/api/integrations/zoho/configurations',require(_0x9e7b('0xae')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xaf'),require('./api/intZohoField'));_0x543b7e['use'](_0x9e7b('0xb0'),require(_0x9e7b('0xb1')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xb2'),require(_0x9e7b('0xb3')));_0x543b7e['use']('/api/integrations/zendesk/fields',require(_0x9e7b('0xb4')));_0x543b7e[_0x9e7b('0x13')]('/api/integrations/freshdesk/accounts',require(_0x9e7b('0xb5')));_0x543b7e['use'](_0x9e7b('0xb6'),require(_0x9e7b('0xb7')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xb8'),require(_0x9e7b('0xb9')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xba'),require(_0x9e7b('0xbb')));_0x543b7e['use'](_0x9e7b('0xbc'),require('./api/intVtigerConfiguration'));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xbd'),require(_0x9e7b('0xbe')));_0x543b7e[_0x9e7b('0x13')]('/api/integrations/servicenow/accounts',require(_0x9e7b('0xbf')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xc0'),require(_0x9e7b('0xc1')));_0x543b7e['use']('/api/integrations/servicenow/fields',require(_0x9e7b('0xc2')));_0x543b7e['use']('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x543b7e[_0x9e7b('0x13')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x543b7e['use'](_0x9e7b('0xc3'),require(_0x9e7b('0xc4')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xc5'),require(_0x9e7b('0xc6')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xc7'),require('./api/intFreshsalesConfiguration'));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xc8'),require(_0x9e7b('0xc9')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xca'),require(_0x9e7b('0xcb')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xcc'),require(_0x9e7b('0xcd')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xce'),require(_0x9e7b('0xcf')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xd0'),require(_0x9e7b('0xd1')));_0x543b7e[_0x9e7b('0x13')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x543b7e['use'](_0x9e7b('0xd2'),require(_0x9e7b('0xd3')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xd4'),require(_0x9e7b('0xd5')));_0x543b7e['use']('/api/square/reports',require('./api/squareReport'));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xd6'),require(_0x9e7b('0xd7')));_0x543b7e[_0x9e7b('0x13')]('/api/jscripty/projects',require(_0x9e7b('0xd8')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xd9'),require(_0x9e7b('0xda')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xdb'),require('./api/squareOdbc'));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xdc'),require('./api/squareProject'));_0x543b7e[_0x9e7b('0x13')]('/api/square/recordings',require(_0x9e7b('0xdd')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xde'),require(_0x9e7b('0xdf')));_0x543b7e[_0x9e7b('0x13')]('/api/teams',require(_0x9e7b('0xe0')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xe1'),require(_0x9e7b('0xe2')));_0x543b7e['use']('/api/campaigns',require(_0x9e7b('0xe3')));_0x543b7e['use'](_0x9e7b('0xe4'),require(_0x9e7b('0xe5')));_0x543b7e['use'](_0x9e7b('0xe6'),require(_0x9e7b('0xe7')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xe8'),require(_0x9e7b('0xe9')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xea'),require(_0x9e7b('0xeb')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xec'),require(_0x9e7b('0xed')));_0x543b7e[_0x9e7b('0x13')]('/api/fax/reports/transfer',require('./api/faxTransferReport'));_0x543b7e[_0x9e7b('0x13')]('/api/openchannel/reports/transfer',require(_0x9e7b('0xee')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xef'),require(_0x9e7b('0xf0')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xf1'),require('./api/cmList'));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xf2'),require(_0x9e7b('0xf3')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xf4'),require(_0x9e7b('0xf5')));_0x543b7e[_0x9e7b('0x13')]('/api/userProfile/sections',require(_0x9e7b('0xf6')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xf7'),require(_0x9e7b('0xf8')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xf9'),require(_0x9e7b('0xfa')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0xfb'),require('./api/userNotification'));_0x543b7e['use'](_0x9e7b('0xfc'),require(_0x9e7b('0xfd')));_0x543b7e['use'](_0x9e7b('0xfe'),require(_0x9e7b('0xff')));_0x543b7e[_0x9e7b('0x13')]('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x100'),require(_0x9e7b('0x101')));_0x543b7e[_0x9e7b('0x13')]('/api/whatsapp/reports/queue',require('./api/whatsappQueueReport'));_0x543b7e[_0x9e7b('0x13')]('/api/whatsapp/reports/transfer',require(_0x9e7b('0x102')));_0x543b7e['use']('/api/whatsapp/queues',require(_0x9e7b('0x103')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x104'),require(_0x9e7b('0x105')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x106'),require(_0x9e7b('0x107')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x108'),require(_0x9e7b('0x109')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x10a'),require(_0x9e7b('0x10b')));_0x543b7e['use'](_0x9e7b('0x10c'),require(_0x9e7b('0x10d')));_0x543b7e['use']('/api/version',require('./api/version'));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x10e'),require('./api/system'));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x10f'),require('./api/pm2'));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x110'),require(_0x9e7b('0x111')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x112'),express[_0x9e7b('0x113')](path[_0x9e7b('0x114')](config[_0x9e7b('0x115')],_0x9e7b('0x112'))));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x116'),express[_0x9e7b('0x113')](path[_0x9e7b('0x114')](config[_0x9e7b('0x115')],_0x9e7b('0x116'))));_0x543b7e[_0x9e7b('0x13')]('/demo',express[_0x9e7b('0x113')](path[_0x9e7b('0x114')](config[_0x9e7b('0x115')],'/demo')));_0x543b7e[_0x9e7b('0x13')](_0x9e7b('0x117'),express[_0x9e7b('0x113')](path[_0x9e7b('0x114')](config[_0x9e7b('0x115')],_0x9e7b('0x118'),_0x9e7b('0x119'))));_0x543b7e['use'](_0x9e7b('0x11a'),express[_0x9e7b('0x113')](path[_0x9e7b('0x114')](config['root'],_0x9e7b('0x11b'))));_0x543b7e[_0x9e7b('0x11c')](_0x9e7b('0x11d'))[_0x9e7b('0x11e')](errors[0x194]);_0x543b7e[_0x9e7b('0x11c')]('/*')[_0x9e7b('0x11e')](function(_0x4dadb9,_0x38ab58){_0x38ab58[_0x9e7b('0x11f')](path[_0x9e7b('0x120')](_0x543b7e[_0x9e7b('0x11e')](_0x9e7b('0x121'))+_0x9e7b('0x122')));});};var sensitiveFields=[_0x9e7b('0x123'),_0x9e7b('0x124'),'newPassword',_0x9e7b('0x125'),_0x9e7b('0x126'),'lastName',_0x9e7b('0x127'),_0x9e7b('0x128'),_0x9e7b('0x129'),_0x9e7b('0x12a'),_0x9e7b('0x12b'),_0x9e7b('0x12c'),'clientSecret',_0x9e7b('0x12d'),'code',_0x9e7b('0x12e'),_0x9e7b('0x12f'),'token',_0x9e7b('0x130'),_0x9e7b('0x131'),_0x9e7b('0x132'),_0x9e7b('0x133'),_0x9e7b('0x134'),_0x9e7b('0x135'),_0x9e7b('0x136'),_0x9e7b('0x137'),_0x9e7b('0x138'),_0x9e7b('0x139'),_0x9e7b('0x13a'),_0x9e7b('0x13b'),'privateKey',_0x9e7b('0x13c'),_0x9e7b('0x13d'),'key',_0x9e7b('0x12'),'pass',_0x9e7b('0x13e'),_0x9e7b('0x13f'),_0x9e7b('0x140'),_0x9e7b('0x141'),_0x9e7b('0x142'),_0x9e7b('0x143')];function maskSensitiveData(_0x595668){var _0x1a6e4e=/(?!^)[\s\S](?!$)/g;if(!_[_0x9e7b('0x144')](_0x595668))return;for(var _0xad0369 in _0x595668){if(_[_0x9e7b('0x145')](_0x595668[_0xad0369])){for(var _0x210186=0x0;_0x210186<_0x595668[_0xad0369][_0x9e7b('0x146')];_0x210186++){maskSensitiveData(_0x595668[_0xad0369][_0x210186]);}}else if(_[_0x9e7b('0x144')](_0x595668[_0xad0369])){maskSensitiveData(_0x595668[_0xad0369]);}else if(_[_0x9e7b('0x147')](_0x595668[_0xad0369])){_0x595668[_0xad0369]=_0x595668[_0xad0369]['replace'](/{{{/g,_0x9e7b('0x148'))[_0x9e7b('0x149')](/}}}/g,_0x9e7b('0x14a'))[_0x9e7b('0x149')](/{{/g,'@{')[_0x9e7b('0x149')](/}}/g,'}@');if(_[_0x9e7b('0x14b')](sensitiveFields,_0xad0369)){_0x595668[_0xad0369]=_0x595668[_0xad0369]['replace'](_0x1a6e4e,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 6a21801..3eeb851 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf522=['../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/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/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc'];(function(_0x5105ea,_0x11f948){var _0x4b31f3=function(_0x4dcca3){while(--_0x4dcca3){_0x5105ea['push'](_0x5105ea['shift']());}};_0x4b31f3(++_0x11f948);}(_0xf522,0x7b));var _0x2f52=function(_0x2ef5ec,_0x2e2117){_0x2ef5ec=_0x2ef5ec-0x0;var _0x125e79=_0xf522[_0x2ef5ec];return _0x125e79;};'use strict';var jayson=require(_0x2f52('0x0'));var BPromise=require(_0x2f52('0x1'));var _=require(_0x2f52('0x2'));var config=require(_0x2f52('0x3'));exports[_0x2f52('0x4')]=function(){return new BPromise(function(_0x1f4734,_0x217017){var _0x4f95c1={};_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x5')));_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x6')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x8')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x9')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0xa')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0xb')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0xc')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0xd')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0xe')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0xf')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x10')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x11')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require('../api/mailQueue/mailQueue.rpc'));_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x12')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x13')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x14')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require('../api/faxAccount/faxAccount.rpc'));_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x15')));_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x16')));_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x17')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x18')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x19')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require('../api/smsAccount/smsAccount.rpc'));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x1a')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x1b')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x1c')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x1d')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x1e')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x1f')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x20')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x21')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x22')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x23')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x24')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x25')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x26')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x27')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x28')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require('../api/interval/interval.rpc'));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x29')));_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x2a')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x2b')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x2c')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x2d')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x2e')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x2f')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x30')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x31')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x32')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x33')));_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x34')));_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x35')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x36')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x37')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x38')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x39')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x3a')));_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x3b')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x3c')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x3d')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x3e')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x3f')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require('../api/plugin/plugin.rpc'));_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x40')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x41')));_0x4f95c1=_[_0x2f52('0x7')](_0x4f95c1,require(_0x2f52('0x42')));_0x4f95c1=_['merge'](_0x4f95c1,require(_0x2f52('0x43')));var _0x480ec5=jayson[_0x2f52('0x44')](_0x4f95c1)['http']();var _0x598b3b=config[_0x2f52('0x45')]['port']||config[_0x2f52('0x46')]+0x1;var _0x79d979=config[_0x2f52('0x45')]['ip']||_0x2f52('0x47');_0x480ec5['on'](_0x2f52('0x48'),function(_0x5eb95e){return _0x217017(_0x5eb95e);});_0x480ec5[_0x2f52('0x4')](_0x598b3b,_0x79d979,function(){console['log'](_0x2f52('0x49'),_0x79d979,_0x598b3b);require(_0x2f52('0x4a'))[_0x2f52('0x4b')]();return _0x1f4734(_0x2f52('0x4c')+_0x79d979+':'+_0x598b3b);});});}; \ No newline at end of file +var _0x880e=['../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/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','rpc','port','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc'];(function(_0x3137f0,_0x509d52){var _0x4c12c4=function(_0x4b9be3){while(--_0x4b9be3){_0x3137f0['push'](_0x3137f0['shift']());}};_0x4c12c4(++_0x509d52);}(_0x880e,0x152));var _0xe880=function(_0x30abff,_0x5f2c5f){_0x30abff=_0x30abff-0x0;var _0x4c571e=_0x880e[_0x30abff];return _0x4c571e;};'use strict';var jayson=require(_0xe880('0x0'));var BPromise=require(_0xe880('0x1'));var _=require(_0xe880('0x2'));var config=require(_0xe880('0x3'));exports[_0xe880('0x4')]=function(){return new BPromise(function(_0x51993b,_0x3c6730){var _0x30e37e={};_0x30e37e=_['merge'](_0x30e37e,require(_0xe880('0x5')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x7')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x8')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x9')));_0x30e37e=_['merge'](_0x30e37e,require(_0xe880('0xa')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0xb')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0xc')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0xd')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require('../api/memberReport/memberReport.rpc'));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0xe')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0xf')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x10')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x11')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x12')));_0x30e37e=_['merge'](_0x30e37e,require(_0xe880('0x13')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x14')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x15')));_0x30e37e=_['merge'](_0x30e37e,require('../api/mailApplication/mailApplication.rpc'));_0x30e37e=_['merge'](_0x30e37e,require(_0xe880('0x16')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x17')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x18')));_0x30e37e=_['merge'](_0x30e37e,require(_0xe880('0x19')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x1a')));_0x30e37e=_['merge'](_0x30e37e,require(_0xe880('0x1b')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x1c')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x1d')));_0x30e37e=_['merge'](_0x30e37e,require(_0xe880('0x1e')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x1f')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x20')));_0x30e37e=_['merge'](_0x30e37e,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x30e37e=_['merge'](_0x30e37e,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x21')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require('../api/chatInteraction/chatInteraction.rpc'));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x22')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x23')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x24')));_0x30e37e=_['merge'](_0x30e37e,require(_0xe880('0x25')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x26')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x27')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x28')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x29')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require('../api/interval/interval.rpc'));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x2a')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require('../api/sound/sound.rpc'));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x2b')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x2c')));_0x30e37e=_['merge'](_0x30e37e,require('../api/variable/variable.rpc'));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x2d')));_0x30e37e=_['merge'](_0x30e37e,require(_0xe880('0x2e')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x2f')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x30')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x31')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x32')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x33')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x34')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x35')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require('../api/squareReport/squareReport.rpc'));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x36')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x37')));_0x30e37e=_['merge'](_0x30e37e,require(_0xe880('0x38')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require('../api/squareRecording/squareRecording.rpc'));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x39')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x3a')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require('../api/attachment/attachment.rpc'));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x3b')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x3c')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x3d')));_0x30e37e=_['merge'](_0x30e37e,require(_0xe880('0x3e')));_0x30e37e=_[_0xe880('0x6')](_0x30e37e,require(_0xe880('0x3f')));var _0x19db56=jayson['server'](_0x30e37e)['http']();var _0x4078e0=config[_0xe880('0x40')][_0xe880('0x41')]||config[_0xe880('0x41')]+0x1;var _0x24861f=config[_0xe880('0x40')]['ip']||_0xe880('0x42');_0x19db56['on']('error',function(_0x521db5){return _0x3c6730(_0x521db5);});_0x19db56[_0xe880('0x4')](_0x4078e0,_0x24861f,function(){console[_0xe880('0x43')](_0xe880('0x44'),_0x24861f,_0x4078e0);require(_0xe880('0x45'))[_0xe880('0x46')]();return _0x51993b(_0xe880('0x47')+_0x24861f+':'+_0x4078e0);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index b464d43..4a6f6a1 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 _0x9c44=['no\x20code','replace','result=','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sendRequest','sync','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','events','EventEmitter','./reply','./error','setEncoding','utf8','setTimeout','emit','ready','toLowerCase','hangup','substring','520\x20End\x20of\x20proper','function'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x9c44,0x178));var _0x49c4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x9c44[_0x1d1779];return _0x2377e9;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIReply=require(_0x49c4('0x2'));var AGIError=require(_0x49c4('0x3'));function AGIChannel(_0x455700){var _0x2ad237=this,_0x4e0313=new AGIReply(),_0x4941f1=![],_0x41a183={};EventEmitter['call'](_0x2ad237);_0x455700[_0x49c4('0x4')](_0x49c4('0x5'));_0x455700[_0x49c4('0x6')](0x8*0x3c*0x3c*0x3e8);_0x4e0313[_0x49c4('0x4')](_0x49c4('0x5'));_0x4e0313['on']('headers',function(_0x11c586){for(var _0x42e4f8 in _0x11c586){_0x2ad237[_0x42e4f8]=_0x11c586[_0x42e4f8];}_0x2ad237[_0x49c4('0x7')](_0x49c4('0x8'));});_0x4e0313['on']('line',function(_0x5ab4a3){if(_0x5ab4a3[_0x49c4('0x9')]()==_0x49c4('0xa')){_0x2ad237['emit'](_0x49c4('0xa'));return;}if(_0x5ab4a3[_0x49c4('0xb')](0x0,0xb)=='520-Invalid'){_0x4941f1=!![];}if(_0x4941f1){_0x41a183['rx']+=_0x5ab4a3+'\x0a';if(_0x5ab4a3['search'](_0x49c4('0xc'))!=-0x1){_0x4941f1=![];}}else{_0x41a183['rx']=_0x5ab4a3;}if(_0x4941f1){return;}if(typeof _0x41a183['cb']==_0x49c4('0xd')){var _0x5487cd=_0x41a183['rx']['substring'](0x0,0x3),_0x7df3a9=null,_0x403bfb=null;_0x5487cd=parseInt(_0x5487cd);if(isNaN(_0x5487cd)){_0x41a183['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x49c4('0xe')});return;}if(_0x5487cd!=0xc8){_0x41a183['cb'](null,{'code':_0x5487cd,'result':-0x1,'extra':'KO'});return;}_0x7df3a9=_0x41a183['rx'][_0x49c4('0xb')](0x4)[_0x49c4('0xf')](_0x49c4('0x10'),'');if(_0x7df3a9[_0x49c4('0x11')]('\x20')!=-0x1){_0x7df3a9=_0x7df3a9[_0x49c4('0x12')](0x0,_0x7df3a9[_0x49c4('0x11')]('\x20'));}if(_[_0x49c4('0x13')](_0x7df3a9,'-1')){_0x7df3a9=parseInt(_0x7df3a9);}_0x403bfb=_0x41a183['rx']['split']('\x20');if(_0x403bfb[_0x49c4('0x14')]==0x3){_0x403bfb=_0x403bfb[0x2][_0x49c4('0xb')](0x1,_0x403bfb[0x2][_0x49c4('0x14')]-0x1);}else if(_0x403bfb[_0x49c4('0x14')]>0x3){var _0x2abc78=/\((.+)\)/;var _0x53e3a2=_0x41a183['rx'][_0x49c4('0x15')](_0x2abc78);if(_0x53e3a2){_0x403bfb=_0x53e3a2[0x1];}else{_0x403bfb=null;}}else{_0x403bfb=null;}_0x41a183['cb'](null,{'code':_0x5487cd,'result':_0x7df3a9,'extra':_0x403bfb});}});_0x455700['on'](_0x49c4('0x16'),function(_0x4c3253){_0x2ad237['emit'](_0x49c4('0x16'),new AGIError(_0x49c4('0x17'),_0x4c3253[_0x49c4('0x18')]));});_0x455700['on']('close',function(){_0x2ad237[_0x49c4('0x7')]('close',new AGIError(_0x49c4('0x19')));});_0x455700['on'](_0x49c4('0x1a'),function(){_0x2ad237[_0x49c4('0x7')](_0x49c4('0x1a'),new AGIError(_0x49c4('0x1b')));_0x455700[_0x49c4('0x1c')]();});_0x455700[_0x49c4('0x1d')](_0x4e0313);this[_0x49c4('0x1e')]=function(_0x2197d2,_0x578447){var _0x2197d2=_0x2197d2||'',_0x578447=typeof _0x578447==_0x49c4('0xd')?_0x578447:new Function();_0x41a183={'tx':_0x2197d2,'rx':'','cb':_0x578447};_0x455700['write'](_0x2197d2+'\x0a');},this['close']=function(){_0x455700[_0x49c4('0x1c')]();};}util[_0x49c4('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x49c4('0x20')][_0x49c4('0x21')]=function(_0x4811c4){return this['command'][_0x49c4('0x22')](this,_0x4811c4);};AGIChannel[_0x49c4('0x20')]['answer']=function(){return this[_0x49c4('0x21')](_0x49c4('0x23'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x24')]=function(_0x531d92,_0x543ea2,_0x449960){_0x531d92=_0x531d92===undefined?'beep':_0x531d92;_0x543ea2=_0x543ea2===undefined?'5':_0x543ea2;_0x449960=_0x449960===undefined?'1':_0x449960;return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x26'),_0x531d92,_0x543ea2*0x3e8,_0x449960));};AGIChannel[_0x49c4('0x20')]['noop']=function(_0x889909){_0x889909=_0x889909||_0x49c4('0x27');return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x28'),_0x889909));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x29')]=function(_0x427b26,_0x17b50f){if(_[_0x49c4('0x2a')](_0x17b50f)){return this[_0x49c4('0x21')](util['format']('EXEC\x20%s\x20%s',_0x427b26,_0x17b50f['join'](',')));}return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2b'),_0x427b26,_0x17b50f));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2c')]=function(_0x574fd3){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2d'),_0x574fd3));};AGIChannel[_0x49c4('0x20')]['setExtension']=function(_0x57a29c){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2e'),_0x57a29c));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2f')]=function(_0x4a0c7a){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x30'),_0x4a0c7a));};AGIChannel['prototype']['hangup']=function(){return this[_0x49c4('0x21')](_0x49c4('0x31'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x32')]=function(_0x2b45a1,_0x2cf897){var _0x1d1557=_[_0x49c4('0x33')](_0x2cf897)||_[_0x49c4('0x34')](_0x2cf897)?_0x2cf897['toString']():_0x2cf897;return this[_0x49c4('0x21')](util['format'](_0x49c4('0x35'),_0x2b45a1,_0x1d1557?_0x1d1557[_0x49c4('0x36')]()[_0x49c4('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x49c4('0x20')]['sayNumber']=function(_0x335f0c,_0x31f3ff){return this[_0x49c4('0x21')](util['format'](_0x49c4('0x37'),_0x335f0c,_0x31f3ff));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x38')]=function(_0x5e5366,_0x1ba7a0){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x39'),_0x5e5366,_0x1ba7a0));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3a')]=function(_0x1e506a,_0x4e0663){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x3b'),_0x1e506a,_0x4e0663));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3c')]=function(_0x29dd5d,_0x1be62d,_0xc9722b){_0x1be62d=_0x1be62d||this[_0x49c4('0x3d')];_0xc9722b=_0xc9722b||0x1;this[_0x49c4('0x2c')](_0x29dd5d);this[_0x49c4('0x3e')](_0x1be62d);this[_0x49c4('0x2f')](_0xc9722b);return this[_0x49c4('0x3f')](util['format'](_0x49c4('0x40'),_0x29dd5d,_0x1be62d,_0xc9722b));};AGIChannel['prototype'][_0x49c4('0x41')]=function(_0x4915bc){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x42'),_0x4915bc));};AGIChannel[_0x49c4('0x20')]['recordFile']=function(_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x117151,_0x490823){_0x20490b=_0x20490b||_0x49c4('0x43');_0x1e7bdc=_0x1e7bdc||'';_0x38349b=_0x38349b===undefined?-0x1:_0x38349b==='-1'?-0x1:_0x38349b*0x3e8;_0x117151=_0x117151===undefined?'':'s='+_0x117151;_0x490823=_0x490823?_0x49c4('0x44'):'';return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x45'),_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x490823,_0x117151));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x46')]=function(_0x3351c1,_0x3c4a1d){_0x3c4a1d=_0x3c4a1d||'';return this['sendRequest'](util[_0x49c4('0x25')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x3351c1,_0x3c4a1d));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x47')]=function(_0x301def){return this[_0x49c4('0x29')](_0x49c4('0x48'),_0x301def);};AGIChannel['prototype'][_0x49c4('0x49')]=function(_0x15b674){return this[_0x49c4('0x29')](_0x49c4('0x4a'),_0x15b674);};AGIChannel[_0x49c4('0x20')][_0x49c4('0x16')]=function(_0x9779ef,_0x4d89e0){this[_0x49c4('0x3f')](util['format'](_0x49c4('0x4b'),_0x9779ef['id'],_0x9779ef[_0x49c4('0x4c')],_0x4d89e0));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x49c4('0x4d')]=AGIChannel; \ No newline at end of file +var _0x34e8=['toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','no\x20code','replace','indexOf','substr','startsWith','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','function','write','inherits','sendRequest','prototype','answer','beep','format','NO\x20MESSAGE','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','noop','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./error','call','utf8','setEncoding','headers','emit','ready','line'];(function(_0xb40155,_0x31e46a){var _0x898aa1=function(_0x2e102b){while(--_0x2e102b){_0xb40155['push'](_0xb40155['shift']());}};_0x898aa1(++_0x31e46a);}(_0x34e8,0x12c));var _0x834e=function(_0x33441e,_0x52ab45){_0x33441e=_0x33441e-0x0;var _0x39bf64=_0x34e8[_0x33441e];return _0x39bf64;};'use strict';var util=require(_0x834e('0x0'));var _=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIReply=require('./reply');var AGIError=require(_0x834e('0x4'));function AGIChannel(_0x21e2e0){var _0x472111=this,_0x31bf20=new AGIReply(),_0x289ef2=![],_0x19a3e0={};EventEmitter[_0x834e('0x5')](_0x472111);_0x21e2e0['setEncoding'](_0x834e('0x6'));_0x21e2e0['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x31bf20[_0x834e('0x7')](_0x834e('0x6'));_0x31bf20['on'](_0x834e('0x8'),function(_0x2e69e2){for(var _0x33ea05 in _0x2e69e2){_0x472111[_0x33ea05]=_0x2e69e2[_0x33ea05];}_0x472111[_0x834e('0x9')](_0x834e('0xa'));});_0x31bf20['on'](_0x834e('0xb'),function(_0x3bdda9){if(_0x3bdda9[_0x834e('0xc')]()==_0x834e('0xd')){_0x472111[_0x834e('0x9')](_0x834e('0xd'));return;}if(_0x3bdda9[_0x834e('0xe')](0x0,0xb)==_0x834e('0xf')){_0x289ef2=!![];}if(_0x289ef2){_0x19a3e0['rx']+=_0x3bdda9+'\x0a';if(_0x3bdda9[_0x834e('0x10')](_0x834e('0x11'))!=-0x1){_0x289ef2=![];}}else{_0x19a3e0['rx']=_0x3bdda9;}if(_0x289ef2){return;}if(typeof _0x19a3e0['cb']=='function'){var _0x5e5b6d=_0x19a3e0['rx'][_0x834e('0xe')](0x0,0x3),_0x6cd9b9=null,_0x58a27e=null;_0x5e5b6d=parseInt(_0x5e5b6d);if(isNaN(_0x5e5b6d)){_0x19a3e0['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x834e('0x12')});return;}if(_0x5e5b6d!=0xc8){_0x19a3e0['cb'](null,{'code':_0x5e5b6d,'result':-0x1,'extra':'KO'});return;}_0x6cd9b9=_0x19a3e0['rx'][_0x834e('0xe')](0x4)[_0x834e('0x13')]('result=','');if(_0x6cd9b9[_0x834e('0x14')]('\x20')!=-0x1){_0x6cd9b9=_0x6cd9b9[_0x834e('0x15')](0x0,_0x6cd9b9['indexOf']('\x20'));}if(_[_0x834e('0x16')](_0x6cd9b9,'-1')){_0x6cd9b9=parseInt(_0x6cd9b9);}_0x58a27e=_0x19a3e0['rx']['split']('\x20');if(_0x58a27e[_0x834e('0x17')]==0x3){_0x58a27e=_0x58a27e[0x2][_0x834e('0xe')](0x1,_0x58a27e[0x2]['length']-0x1);}else if(_0x58a27e[_0x834e('0x17')]>0x3){var _0x22106e=/\((.+)\)/;var _0x370fb5=_0x19a3e0['rx']['match'](_0x22106e);if(_0x370fb5){_0x58a27e=_0x370fb5[0x1];}else{_0x58a27e=null;}}else{_0x58a27e=null;}_0x19a3e0['cb'](null,{'code':_0x5e5b6d,'result':_0x6cd9b9,'extra':_0x58a27e});}});_0x21e2e0['on'](_0x834e('0x18'),function(_0x211e9a){_0x472111[_0x834e('0x9')](_0x834e('0x18'),new AGIError(_0x834e('0x19'),_0x211e9a[_0x834e('0x1a')]));});_0x21e2e0['on'](_0x834e('0x1b'),function(){_0x472111['emit'](_0x834e('0x1b'),new AGIError(_0x834e('0x1c')));});_0x21e2e0['on'](_0x834e('0x1d'),function(){_0x472111[_0x834e('0x9')]('timeout',new AGIError(_0x834e('0x1e')));_0x21e2e0[_0x834e('0x1f')]();});_0x21e2e0['pipe'](_0x31bf20);this[_0x834e('0x20')]=function(_0x28d687,_0x8d406e){var _0x28d687=_0x28d687||'',_0x8d406e=typeof _0x8d406e==_0x834e('0x21')?_0x8d406e:new Function();_0x19a3e0={'tx':_0x28d687,'rx':'','cb':_0x8d406e};_0x21e2e0[_0x834e('0x22')](_0x28d687+'\x0a');},this['close']=function(){_0x21e2e0[_0x834e('0x1f')]();};}util[_0x834e('0x23')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x834e('0x24')]=function(_0x2e1983){return this[_0x834e('0x20')]['sync'](this,_0x2e1983);};AGIChannel[_0x834e('0x25')][_0x834e('0x26')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x834e('0x25')]['getData']=function(_0x2826ec,_0x3f1b0b,_0x3db026){_0x2826ec=_0x2826ec===undefined?_0x834e('0x27'):_0x2826ec;_0x3f1b0b=_0x3f1b0b===undefined?'5':_0x3f1b0b;_0x3db026=_0x3db026===undefined?'1':_0x3db026;return this[_0x834e('0x24')](util[_0x834e('0x28')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x2826ec,_0x3f1b0b*0x3e8,_0x3db026));};AGIChannel['prototype']['noop']=function(_0x58c1d7){_0x58c1d7=_0x58c1d7||_0x834e('0x29');return this[_0x834e('0x24')](util[_0x834e('0x28')]('VERBOSE\x20\x22%s\x22',_0x58c1d7));};AGIChannel[_0x834e('0x25')][_0x834e('0x2a')]=function(_0x1f3671,_0x1e026a){if(_[_0x834e('0x2b')](_0x1e026a)){return this[_0x834e('0x24')](util[_0x834e('0x28')](_0x834e('0x2c'),_0x1f3671,_0x1e026a[_0x834e('0x2d')](',')));}return this['sendRequest'](util[_0x834e('0x28')]('EXEC\x20%s\x20%s',_0x1f3671,_0x1e026a));};AGIChannel[_0x834e('0x25')][_0x834e('0x2e')]=function(_0x9ab921){return this[_0x834e('0x24')](util[_0x834e('0x28')](_0x834e('0x2f'),_0x9ab921));};AGIChannel[_0x834e('0x25')][_0x834e('0x30')]=function(_0x358c31){return this[_0x834e('0x24')](util['format'](_0x834e('0x31'),_0x358c31));};AGIChannel[_0x834e('0x25')][_0x834e('0x32')]=function(_0xaf01f4){return this['sendRequest'](util[_0x834e('0x28')](_0x834e('0x33'),_0xaf01f4));};AGIChannel['prototype']['hangup']=function(){return this['sendRequest'](_0x834e('0x34'));};AGIChannel[_0x834e('0x25')][_0x834e('0x35')]=function(_0x34fefb,_0x339e28){var _0x1b76dd=_['isBoolean'](_0x339e28)||_[_0x834e('0x36')](_0x339e28)?_0x339e28['toString']():_0x339e28;return this[_0x834e('0x24')](util[_0x834e('0x28')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x34fefb,_0x1b76dd?_0x1b76dd[_0x834e('0x37')]()[_0x834e('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x388711,_0xd0d43a){return this[_0x834e('0x24')](util[_0x834e('0x28')](_0x834e('0x38'),_0x388711,_0xd0d43a));};AGIChannel['prototype'][_0x834e('0x39')]=function(_0x548d1d,_0x50c243){return this[_0x834e('0x24')](util['format'](_0x834e('0x3a'),_0x548d1d,_0x50c243));};AGIChannel[_0x834e('0x25')][_0x834e('0x3b')]=function(_0x3c59af,_0x2b7933){return this['sendRequest'](util[_0x834e('0x28')](_0x834e('0x3c'),_0x3c59af,_0x2b7933));};AGIChannel[_0x834e('0x25')]['continueAt']=function(_0x35380e,_0x16ac45,_0x57b89a){_0x16ac45=_0x16ac45||this[_0x834e('0x3d')];_0x57b89a=_0x57b89a||0x1;this['setContext'](_0x35380e);this[_0x834e('0x30')](_0x16ac45);this[_0x834e('0x32')](_0x57b89a);return this['noop'](util['format'](_0x834e('0x3e'),_0x35380e,_0x16ac45,_0x57b89a));};AGIChannel[_0x834e('0x25')][_0x834e('0x3f')]=function(_0xbc1571){return this[_0x834e('0x24')](util[_0x834e('0x28')](_0x834e('0x40'),_0xbc1571));};AGIChannel['prototype'][_0x834e('0x41')]=function(_0x5abb7a,_0x321efa,_0x540685,_0x1df5b0,_0x5a5807,_0x361f60){_0x321efa=_0x321efa||_0x834e('0x42');_0x540685=_0x540685||'';_0x1df5b0=_0x1df5b0===undefined?-0x1:_0x1df5b0==='-1'?-0x1:_0x1df5b0*0x3e8;_0x5a5807=_0x5a5807===undefined?'':'s='+_0x5a5807;_0x361f60=_0x361f60?'BEEP':'';return this[_0x834e('0x24')](util[_0x834e('0x28')](_0x834e('0x43'),_0x5abb7a,_0x321efa,_0x540685,_0x1df5b0,_0x361f60,_0x5a5807));};AGIChannel[_0x834e('0x25')][_0x834e('0x44')]=function(_0x1a7149,_0xfa28da){_0xfa28da=_0xfa28da||'';return this[_0x834e('0x24')](util[_0x834e('0x28')](_0x834e('0x45'),_0x1a7149,_0xfa28da));};AGIChannel['prototype'][_0x834e('0x46')]=function(_0x6fff27){return this['exec'](_0x834e('0x47'),_0x6fff27);};AGIChannel[_0x834e('0x25')][_0x834e('0x48')]=function(_0x2112d5){return this[_0x834e('0x2a')](_0x834e('0x49'),_0x2112d5);};AGIChannel['prototype']['error']=function(_0x954d4b,_0x1a5444){this[_0x834e('0x4a')](util[_0x834e('0x28')](_0x834e('0x4b'),_0x954d4b['id'],_0x954d4b[_0x834e('0x4c')],_0x1a5444));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x834e('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 466ee6f..4ee0254 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 _0x2a31=['[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2a31,0xe4));var _0x12a3=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x2a31[_0x18ab2a];return _0x16dcee;};'use strict';var util=require(_0x12a3('0x0'));var error={'E_AGI_UNDEFINED':_0x12a3('0x1'),'E_AGI_ARGUMENT_PORT':_0x12a3('0x2'),'E_AGI_SERVER_ERROR':_0x12a3('0x3'),'E_AGI_SERVER_CLOSE':_0x12a3('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x12a3('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x12a3('0x6'),'E_AGI_SOCKET_ERROR':_0x12a3('0x7'),'E_AGI_SOCKET_CLOSE':_0x12a3('0x8'),'E_AGI_SOCKET_TIMEOUT':_0x12a3('0x9'),'E_AGI_COMMAND_EMPTY':_0x12a3('0xa'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x12a3('0xb'),'E_AGI_IVR_ENTRY':_0x12a3('0xc')};function AGIError(_0x23df3e){var _0x23df3e=_0x23df3e||null,_0xcf401f=_0xcf401f||[],_0x5e24b3=0x1,_0x25703e='';if(!error[_0x23df3e]){_0x23df3e='E_AGI_UNDEFINED';}_0xcf401f[_0x12a3('0xd')](error[_0x23df3e]);while(arguments[_0x5e24b3]){_0xcf401f['push'](arguments[_0x5e24b3]);_0x5e24b3++;}_0x25703e=util[_0x12a3('0xe')]['apply'](util,_0xcf401f);this[_0x12a3('0xf')]=_0x25703e;this[_0x12a3('0x10')]=_0x23df3e;}module[_0x12a3('0x11')]=AGIError; \ No newline at end of file +var _0xb32d=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util','Undefined\x20error.'];(function(_0x5342aa,_0x49cc12){var _0xe5c110=function(_0x4063c4){while(--_0x4063c4){_0x5342aa['push'](_0x5342aa['shift']());}};_0xe5c110(++_0x49cc12);}(_0xb32d,0x1da));var _0xdb32=function(_0x1ac6e5,_0x40f47f){_0x1ac6e5=_0x1ac6e5-0x0;var _0x5877dc=_0xb32d[_0x1ac6e5];return _0x5877dc;};'use strict';var util=require(_0xdb32('0x0'));var error={'E_AGI_UNDEFINED':_0xdb32('0x1'),'E_AGI_ARGUMENT_PORT':_0xdb32('0x2'),'E_AGI_SERVER_ERROR':_0xdb32('0x3'),'E_AGI_SERVER_CLOSE':_0xdb32('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xdb32('0x5'),'E_AGI_SOCKET_CLOSE':_0xdb32('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xdb32('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xdb32('0x8'),'E_AGI_IVR_ENTRY':_0xdb32('0x9')};function AGIError(_0x1f4539){var _0x1f4539=_0x1f4539||null,_0x386309=_0x386309||[],_0x5bb076=0x1,_0x3b0995='';if(!error[_0x1f4539]){_0x1f4539=_0xdb32('0xa');}_0x386309[_0xdb32('0xb')](error[_0x1f4539]);while(arguments[_0x5bb076]){_0x386309[_0xdb32('0xb')](arguments[_0x5bb076]);_0x5bb076++;}_0x3b0995=util[_0xdb32('0xc')][_0xdb32('0xd')](util,_0x386309);this[_0xdb32('0xe')]=_0x3b0995;this[_0xdb32('0xf')]=_0x1f4539;}module[_0xdb32('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index a8a88bb..88462df 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 _0x0713=['agicommand','invalid','traverseBFS','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','exports','agi','menu','getdigits','getsecretdigits','vertices','numberOfEdges','prototype','addVertex','edges','addEdge','push','size','getVertex','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','vswitch','target','default'];(function(_0x5a3ee3,_0x417af3){var _0x6bfdea=function(_0x37fbcb){while(--_0x37fbcb){_0x5a3ee3['push'](_0x5a3ee3['shift']());}};_0x6bfdea(++_0x417af3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var logger=require('../../../config/logger')(_0x3071('0x0'));var verticesWithRetry=[_0x3071('0x1'),_0x3071('0x2'),_0x3071('0x3')];var Graph=function(){this[_0x3071('0x4')]={};this['edges']={};this[_0x3071('0x5')]=0x0;};Graph[_0x3071('0x6')][_0x3071('0x7')]=function(_0x3137c8){this[_0x3071('0x4')][_0x3137c8['id']]=_0x3137c8;this[_0x3071('0x8')][_0x3137c8['id']]=[];};Graph[_0x3071('0x6')][_0x3071('0x9')]=function(_0xbd737f,_0x22274c,_0x3e9a5e){this[_0x3071('0x8')][_0xbd737f][_0x3071('0xa')]({'target':_0x22274c,'condition':_0x3e9a5e});this['numberOfEdges']+=0x1;};Graph[_0x3071('0x6')][_0x3071('0xb')]=function(){return _[_0x3071('0xb')](this[_0x3071('0x4')]);};Graph[_0x3071('0x6')]['relations']=function(){return this[_0x3071('0x5')];};Graph[_0x3071('0x6')][_0x3071('0xc')]=function(_0x3ed4a0){return this[_0x3071('0x4')][_0x3ed4a0];};Graph['prototype']['traverseBFS']=function(_0x1826ca,_0x5dc13b){if(!this[_0x3071('0x4')][_0x1826ca]){return logger[_0x3071('0xd')]('no\x20vertex\x20found');}var _0x104e73=_0x5dc13b(this['vertices'][_0x1826ca]);if(!_0x104e73){return logger[_0x3071('0xd')](_0x3071('0xe'));}if(this[_0x3071('0x8')][_0x1826ca][_0x3071('0xf')]===0x0){return logger[_0x3071('0xd')](_0x3071('0x10'));}for(var _0x157a47=0x0,_0x11bdc9=[],_0x21aad3=![];_0x157a47\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','response','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','connection','xml2json','syncho','util','moment','../../config/logger','agi','../../config/license/util','./mailRpc','./graph','defaults','127.0.0.1','nextTick','error','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[%s]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','evtHangup','toJson','mxGraphModel','root','agicommand','retry','addVertex','omit','mxCell','hasOwnProperty','length','source','target','addEdge','value','getSquareProject','catch','createSquareReport','then','substring','inspect','debug'];(function(_0x4719b1,_0x4d3628){var _0x5cc325=function(_0x593a4d){while(--_0x593a4d){_0x4719b1['push'](_0x4719b1['shift']());}};_0x5cc325(++_0x4d3628);}(_0x4b19,0x195));var _0x94b1=function(_0x31f64e,_0x55888a){_0x31f64e=_0x31f64e-0x0;var _0x358617=_0x4b19[_0x31f64e];return _0x358617;};'use strict';var parser=require(_0x94b1('0x0'));var _=require('lodash');var syncho=require(_0x94b1('0x1'));var util=require(_0x94b1('0x2'));var moment=require(_0x94b1('0x3'));var config=require('../../config/environment');var logger=require(_0x94b1('0x4'))(_0x94b1('0x5'));var utilLicense=require(_0x94b1('0x6'));var rpc=require('./rpc');var mailRpc=require(_0x94b1('0x7'));var Graph=require(_0x94b1('0x8'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x94b1('0x5')]=_[_0x94b1('0x9')](config['agi'],{'ip':_0x94b1('0xa'),'port':0x11dd});function connectionHandler(_0x201a02){process[_0x94b1('0xb')](function(){syncho(function(){try{setChannelVariables(_0x201a02);agiHandler(_0x201a02);}catch(_0x5aee5f){logger[_0x94b1('0xc')](_0x5aee5f['stack']);}});});}function listeningHandler(){console['log'](_0x94b1('0xd'),config[_0x94b1('0x5')][_0x94b1('0xe')]);logger[_0x94b1('0xf')](util[_0x94b1('0x10')](_0x94b1('0x11'),config['agi']['ip'],config[_0x94b1('0x5')][_0x94b1('0xe')]));}function errorHandler(_0x340a29){if(_0x340a29&&_0x340a29[_0x94b1('0x12')]&&_0x340a29['message']){logger['error'](util[_0x94b1('0x10')](_0x94b1('0x13'),_0x340a29['name'],_0x340a29['message']));}else{logger[_0x94b1('0xc')](util[_0x94b1('0x10')]('[ERROR]\x20%s',_0x340a29[_0x94b1('0x14')]));}}function closeHandler(){logger['info'](util['format'](_0x94b1('0x15'),this[_0x94b1('0x16')],this[_0x94b1('0x17')],this[_0x94b1('0x18')],this['dnid'],this[_0x94b1('0x19')]));try{createSquareReport(this);}catch(_0x424c45){logger[_0x94b1('0xc')](_0x424c45[_0x94b1('0x14')]);}}function timeoutHandler(){logger[_0x94b1('0xf')](util[_0x94b1('0x10')](_0x94b1('0x1a'),this['arg_1'],this[_0x94b1('0x17')],this[_0x94b1('0x18')],this[_0x94b1('0x1b')],this['uniqueid']));}function hangupHandler(){logger[_0x94b1('0xf')](util[_0x94b1('0x10')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x94b1('0x16')],this[_0x94b1('0x17')],this[_0x94b1('0x18')],this[_0x94b1('0x1b')],this[_0x94b1('0x19')]));this[_0x94b1('0x1c')]=!![];}function getRoot(_0x36180a){return parser[_0x94b1('0x1d')](_0x36180a,{'object':!![]})[_0x94b1('0x1e')][_0x94b1('0x1f')];}function addVertex(_0x49c248,_0xa333a8,_0xa112b1){_0xa333a8[_0x94b1('0x20')]=_0xa112b1;if(_0xa333a8['hasOwnProperty'](_0x94b1('0x21'))){_0xa333a8['maxRetry']=parseInt(_0xa333a8[_0x94b1('0x21')],0xa);}_0x49c248[_0x94b1('0x22')](_[_0x94b1('0x23')](_0xa333a8,_0x94b1('0x24')));}function initGraph(_0x5ad3e4,_0x4ea6d9){var _0x1d6ea6=new Graph();for(var _0x4d5685 in _0x5ad3e4){if(_0x5ad3e4[_0x94b1('0x25')](_0x4d5685)){if(_['isArray'](_0x5ad3e4[_0x4d5685])){for(var _0x4694de=0x0;_0x4694de<_0x5ad3e4[_0x4d5685][_0x94b1('0x26')];_0x4694de+=0x1){addVertex(_0x1d6ea6,_0x5ad3e4[_0x4d5685][_0x4694de],_0x4d5685);}}else{addVertex(_0x1d6ea6,_0x5ad3e4[_0x4d5685],_0x4d5685);}}}for(var _0x1eda8c=0x0;_0x1eda8c<_0x4ea6d9['length'];_0x1eda8c+=0x1){if(_0x4ea6d9[_0x1eda8c][_0x94b1('0x27')]&&_0x4ea6d9[_0x1eda8c][_0x94b1('0x28')]){_0x1d6ea6[_0x94b1('0x29')](_0x4ea6d9[_0x1eda8c][_0x94b1('0x27')],_0x4ea6d9[_0x1eda8c][_0x94b1('0x28')],_0x4ea6d9[_0x1eda8c][_0x94b1('0x2a')]);}}return _0x1d6ea6;}function getSquareProject(_0x2661ca,_0xcd778f){rpc[_0x94b1('0x2b')](_0x2661ca)['then'](function(_0x2eb1fa){_0xcd778f(null,_0x2eb1fa);})[_0x94b1('0x2c')](function(_0x47f019){_0xcd778f(null,_0x47f019);});}function createSquareReport(_0x42630a,_0x1fe766){rpc[_0x94b1('0x2d')](_0x42630a)[_0x94b1('0x2e')](function(_0x28dc1d){if(_0x1fe766){_0x1fe766(null,_0x28dc1d);}})[_0x94b1('0x2c')](function(_0x5a5148){if(_0x1fe766){_0x1fe766(null,_0x5a5148);}});}function setChannelVariables(_0x1a26eb){for(var _0x5d765b in _0x1a26eb){if(_0x1a26eb[_0x94b1('0x25')](_0x5d765b)){if(_0x5d765b['indexOf']('agi_')===0x0){_0x1a26eb[_0x5d765b[_0x94b1('0x2f')](0x4)]=_0x1a26eb[_0x5d765b];delete _0x1a26eb[_0x5d765b];}}}}function getLogFromObject(_0x171d44){return util[_0x94b1('0x30')](_0x171d44,{'showHidden':![],'depth':null});}function agiHandler(_0x44e595){var _0x35b97c,_0x195514,_0x26f33d,_0x19511b,_0x288ae5;logger[_0x94b1('0x31')](_0x94b1('0x32'),JSON[_0x94b1('0x33')](_0x44e595,null,0x2));logger['info'](util['format'](_0x94b1('0x34'),_0x44e595[_0x94b1('0x16')],_0x44e595[_0x94b1('0x17')],_0x44e595[_0x94b1('0x18')],_0x44e595[_0x94b1('0x1b')],_0x44e595[_0x94b1('0x19')]));_0x44e595['on'](_0x94b1('0xc'),errorHandler);_0x44e595['on'](_0x94b1('0x35'),closeHandler);_0x44e595['on'](_0x94b1('0x36'),timeoutHandler);_0x44e595['evtHangup']=![];_0x44e595['on'](_0x94b1('0x37'),hangupHandler);var _0x4d18e8=getSquareProject[_0x94b1('0x38')](null,_0x44e595[_0x94b1('0x16')]);if(_0x4d18e8){if(_0x4d18e8[_0x94b1('0x39')]){_0x35b97c=getRoot(_0x4d18e8['production']);if(_0x35b97c&&_0x35b97c[_0x94b1('0x3a')]){logger[_0x94b1('0x31')](_0x94b1('0x1f'),JSON['stringify'](_0x35b97c,null,0x2));_0x44e595[_0x94b1('0x3b')]=moment()[_0x94b1('0x10')](_0x94b1('0x3c'));_0x195514=initGraph(_[_0x94b1('0x23')](_0x35b97c,_0x94b1('0x24')),_0x35b97c[_0x94b1('0x24')]);_0x26f33d=new Vertices(_0x44e595,rpc,mailRpc);logger[_0x94b1('0xf')](util[_0x94b1('0x10')](_0x94b1('0x3d'),_0x44e595[_0x94b1('0x16')],_0x44e595[_0x94b1('0x17')],_0x44e595[_0x94b1('0x18')],_0x44e595[_0x94b1('0x1b')],_0x44e595['uniqueid']));_0x195514[_0x94b1('0x3e')](_0x35b97c[_0x94b1('0x3a')]['id'],function(_0xf29a10){try{_0xf29a10=_0x26f33d[_0x94b1('0x3f')](_0xf29a10);logger[_0x94b1('0x31')]('vertex',JSON[_0x94b1('0x33')](_0xf29a10,null,0x2));if(_0xf29a10[_0x94b1('0x20')]===_0x94b1('0x40')){logger[_0x94b1('0xf')](_0x94b1('0x41'));_0x44e595[_0x94b1('0x42')]=_0xf29a10['context']||_0x44e595[_0x94b1('0x42')];_0x44e595[_0x94b1('0x43')]=_0xf29a10['extension'];_0x44e595[_0x94b1('0x44')]=_0xf29a10[_0x94b1('0x44')]?_0xf29a10['priority']-0x1:0x1;return null;}else if(_0xf29a10&&_0x26f33d[_0xf29a10[_0x94b1('0x20')]]){_0x288ae5=_0x26f33d[_0xf29a10[_0x94b1('0x20')]](_0xf29a10);logger[_0x94b1('0xf')]('response',JSON[_0x94b1('0x33')](_0x288ae5,null,0x2));if(_0x288ae5&&_0x288ae5[_0x94b1('0x45')]===AGI_CODE_SUCCESS&&_0x288ae5[_0x94b1('0x46')]!==AGI_RESULT_ERROR&&!_0x44e595[_0x94b1('0x1c')]){logger[_0x94b1('0x31')](_0x94b1('0x47'),getLogFromObject(_0x288ae5));return _[_0x94b1('0x48')](_0x288ae5['result'])?null:_0x288ae5[_0x94b1('0x46')][_0x94b1('0x49')]();}else{logger[_0x94b1('0xc')]('response',getLogFromObject(_0x288ae5));return null;}}else{logger[_0x94b1('0xc')](_0x94b1('0x4a'));return null;}}catch(_0x5323c2){logger[_0x94b1('0xc')](_0x5323c2[_0x94b1('0x14')]);return null;}});if(_0x35b97c[_0x94b1('0x4b')]){logger[_0x94b1('0xf')](util[_0x94b1('0x10')](_0x94b1('0x4c'),_0x44e595[_0x94b1('0x16')],_0x44e595[_0x94b1('0x17')],_0x44e595[_0x94b1('0x18')],_0x44e595[_0x94b1('0x1b')],_0x44e595[_0x94b1('0x19')]));_0x195514[_0x94b1('0x3e')](_0x35b97c[_0x94b1('0x4b')]['id'],function(_0x7753ff){try{_0x7753ff=_0x26f33d[_0x94b1('0x3f')](_0x7753ff);logger[_0x94b1('0x31')](_0x94b1('0x4d'),JSON[_0x94b1('0x33')](_0x7753ff,null,0x2));if(_0x7753ff&&_0x26f33d[_0x7753ff[_0x94b1('0x20')]]){_0x288ae5=_0x26f33d[_0x7753ff['agicommand']](_0x7753ff);if(_0x288ae5){logger[_0x94b1('0x31')]('response',getLogFromObject(_0x288ae5));return _[_0x94b1('0x48')](_0x288ae5[_0x94b1('0x46')])?null:_0x288ae5[_0x94b1('0x46')]['toString']();}else{logger['error']('response',getLogFromObject(_0x288ae5));return null;}}else{logger[_0x94b1('0xc')](_0x94b1('0x4a'));return null;}}catch(_0x276ab1){logger['error'](_0x276ab1['stack']);return null;}});}logger['info'](util[_0x94b1('0x10')](_0x94b1('0x4e'),_0x44e595[_0x94b1('0x16')],_0x44e595[_0x94b1('0x17')],_0x44e595[_0x94b1('0x18')],_0x44e595[_0x94b1('0x1b')],_0x44e595[_0x94b1('0x19')]));logger['info'](util[_0x94b1('0x10')](_0x94b1('0x4f'),_0x44e595[_0x94b1('0x42')],_0x44e595[_0x94b1('0x43')],parseInt(_0x44e595[_0x94b1('0x44')],0xa)+0x1));_0x44e595[_0x94b1('0x50')](_0x44e595[_0x94b1('0x42')],_0x44e595[_0x94b1('0x43')],parseInt(_0x44e595[_0x94b1('0x44')],0xa)+0x1);_0x44e595[_0x94b1('0x35')]();}}else{logger[_0x94b1('0xc')](util[_0x94b1('0x10')](_0x94b1('0x51'),_0x44e595[_0x94b1('0x16')]));_0x44e595['continueAt'](_0x44e595[_0x94b1('0x42')],_0x44e595[_0x94b1('0x43')],parseInt(_0x44e595[_0x94b1('0x44')],0xa)+0x1);_0x44e595[_0x94b1('0x35')]();}}else{logger[_0x94b1('0xc')](util[_0x94b1('0x10')](_0x94b1('0x52'),_0x44e595[_0x94b1('0x16')]));_0x44e595[_0x94b1('0x50')](_0x44e595['context'],_0x44e595[_0x94b1('0x43')],parseInt(_0x44e595[_0x94b1('0x44')],0xa)+0x1);_0x44e595[_0x94b1('0x35')]();}}function main(){var _0x29ccc4;return utilLicense[_0x94b1('0x53')]()[_0x94b1('0x2e')](function(_0x572657){if(_0x572657){if(_0x572657[_0x94b1('0x54')]){if(_0x572657[_0x94b1('0x55')]&&_0x572657[_0x94b1('0x55')]>0x0){logger[_0x94b1('0xf')](util[_0x94b1('0x10')](_0x94b1('0x56'),_0x572657[_0x94b1('0x55')]));_0x29ccc4=_0x572657[_0x94b1('0x55')];}else{logger[_0x94b1('0xf')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger['info'](_0x94b1('0x57'));_0x29ccc4=-0x1;}}})[_0x94b1('0x2c')](function(_0x13228e){logger[_0x94b1('0xc')](_0x94b1('0x58'),_0x13228e[_0x94b1('0x14')]);})[_0x94b1('0x4b')](function(){var _0xcdf3e8=require(_0x94b1('0x59'))(config[_0x94b1('0x5')][_0x94b1('0xe')],config[_0x94b1('0x5')]['ip'],_0x29ccc4);_0xcdf3e8['on'](_0x94b1('0xc'),errorHandler);_0xcdf3e8['on']('listening',listeningHandler);_0xcdf3e8['on'](_0x94b1('0x5a'),connectionHandler);_0xcdf3e8['on'](_0x94b1('0x35'),closeHandler);});}main(); \ No newline at end of file +var _0xf006=['name','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','uniqueid','toJson','mxGraphModel','root','agicommand','retry','maxRetry','omit','hasOwnProperty','isArray','length','source','target','addEdge','value','getSquareProject','then','catch','indexOf','agi_','substring','inspect','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','traverseBFS','clear','vertex','gotoc','context','extension','priority','code','result','evtHangup','debug','response','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','listening','syncho','util','../../config/environment','agi','./mailRpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d'];(function(_0x5b6880,_0x20d305){var _0x10a0f7=function(_0x54671f){while(--_0x54671f){_0x5b6880['push'](_0x5b6880['shift']());}};_0x10a0f7(++_0x20d305);}(_0xf006,0x146));var _0x6f00=function(_0x235bab,_0x944b63){_0x235bab=_0x235bab-0x0;var _0x4aa291=_0xf006[_0x235bab];return _0x4aa291;};'use strict';var parser=require('xml2json');var _=require('lodash');var syncho=require(_0x6f00('0x0'));var util=require(_0x6f00('0x1'));var moment=require('moment');var config=require(_0x6f00('0x2'));var logger=require('../../config/logger')(_0x6f00('0x3'));var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var mailRpc=require(_0x6f00('0x4'));var Graph=require(_0x6f00('0x5'));var Vertices=require(_0x6f00('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x6f00('0x7')](config['agi'],{'ip':_0x6f00('0x8'),'port':0x11dd});function connectionHandler(_0x3001b1){process[_0x6f00('0x9')](function(){syncho(function(){try{setChannelVariables(_0x3001b1);agiHandler(_0x3001b1);}catch(_0x2d2c55){logger[_0x6f00('0xa')](_0x2d2c55[_0x6f00('0xb')]);}});});}function listeningHandler(){console[_0x6f00('0xc')](_0x6f00('0xd'),config[_0x6f00('0x3')][_0x6f00('0xe')]);logger[_0x6f00('0xf')](util[_0x6f00('0x10')](_0x6f00('0x11'),config['agi']['ip'],config[_0x6f00('0x3')][_0x6f00('0xe')]));}function errorHandler(_0x158817){if(_0x158817&&_0x158817[_0x6f00('0x12')]&&_0x158817[_0x6f00('0x13')]){logger['error'](util[_0x6f00('0x10')]('[%s]\x20%s',_0x158817[_0x6f00('0x12')],_0x158817['message']));}else{logger[_0x6f00('0xa')](util[_0x6f00('0x10')](_0x6f00('0x14'),_0x158817[_0x6f00('0xb')]));}}function closeHandler(){logger[_0x6f00('0xf')](util[_0x6f00('0x10')](_0x6f00('0x15'),this[_0x6f00('0x16')],this[_0x6f00('0x17')],this['callerid'],this[_0x6f00('0x18')],this['uniqueid']));try{createSquareReport(this);}catch(_0x534275){logger[_0x6f00('0xa')](_0x534275[_0x6f00('0xb')]);}}function timeoutHandler(){logger[_0x6f00('0xf')](util[_0x6f00('0x10')](_0x6f00('0x19'),this[_0x6f00('0x16')],this[_0x6f00('0x17')],this[_0x6f00('0x1a')],this[_0x6f00('0x18')],this[_0x6f00('0x1b')]));}function hangupHandler(){logger[_0x6f00('0xf')](util[_0x6f00('0x10')]('[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[_0x6f00('0x1a')],this[_0x6f00('0x18')],this[_0x6f00('0x1b')]));this['evtHangup']=!![];}function getRoot(_0xe301e5){return parser[_0x6f00('0x1c')](_0xe301e5,{'object':!![]})[_0x6f00('0x1d')][_0x6f00('0x1e')];}function addVertex(_0x388983,_0x1cbf1c,_0x90d74c){_0x1cbf1c[_0x6f00('0x1f')]=_0x90d74c;if(_0x1cbf1c['hasOwnProperty'](_0x6f00('0x20'))){_0x1cbf1c[_0x6f00('0x21')]=parseInt(_0x1cbf1c[_0x6f00('0x20')],0xa);}_0x388983['addVertex'](_[_0x6f00('0x22')](_0x1cbf1c,'mxCell'));}function initGraph(_0x25c6a7,_0x511293){var _0x434735=new Graph();for(var _0x39375d in _0x25c6a7){if(_0x25c6a7[_0x6f00('0x23')](_0x39375d)){if(_[_0x6f00('0x24')](_0x25c6a7[_0x39375d])){for(var _0x375d76=0x0;_0x375d76<_0x25c6a7[_0x39375d]['length'];_0x375d76+=0x1){addVertex(_0x434735,_0x25c6a7[_0x39375d][_0x375d76],_0x39375d);}}else{addVertex(_0x434735,_0x25c6a7[_0x39375d],_0x39375d);}}}for(var _0x23a346=0x0;_0x23a346<_0x511293[_0x6f00('0x25')];_0x23a346+=0x1){if(_0x511293[_0x23a346][_0x6f00('0x26')]&&_0x511293[_0x23a346][_0x6f00('0x27')]){_0x434735[_0x6f00('0x28')](_0x511293[_0x23a346][_0x6f00('0x26')],_0x511293[_0x23a346][_0x6f00('0x27')],_0x511293[_0x23a346][_0x6f00('0x29')]);}}return _0x434735;}function getSquareProject(_0x22f107,_0x3f0b64){rpc[_0x6f00('0x2a')](_0x22f107)[_0x6f00('0x2b')](function(_0x29555d){_0x3f0b64(null,_0x29555d);})[_0x6f00('0x2c')](function(_0x5dde51){_0x3f0b64(null,_0x5dde51);});}function createSquareReport(_0x5775c5,_0x5d16ad){rpc['createSquareReport'](_0x5775c5)['then'](function(_0x4edc83){if(_0x5d16ad){_0x5d16ad(null,_0x4edc83);}})[_0x6f00('0x2c')](function(_0x56338c){if(_0x5d16ad){_0x5d16ad(null,_0x56338c);}});}function setChannelVariables(_0x3c0e5d){for(var _0x192bc1 in _0x3c0e5d){if(_0x3c0e5d[_0x6f00('0x23')](_0x192bc1)){if(_0x192bc1[_0x6f00('0x2d')](_0x6f00('0x2e'))===0x0){_0x3c0e5d[_0x192bc1[_0x6f00('0x2f')](0x4)]=_0x3c0e5d[_0x192bc1];delete _0x3c0e5d[_0x192bc1];}}}}function getLogFromObject(_0x599c67){return util[_0x6f00('0x30')](_0x599c67,{'showHidden':![],'depth':null});}function agiHandler(_0x1c5443){var _0x3cefb8,_0x526aa1,_0x4255e8,_0x4fed1c,_0x52274f;logger['debug'](_0x6f00('0x31'),JSON[_0x6f00('0x32')](_0x1c5443,null,0x2));logger[_0x6f00('0xf')](util[_0x6f00('0x10')](_0x6f00('0x33'),_0x1c5443['arg_1'],_0x1c5443[_0x6f00('0x17')],_0x1c5443[_0x6f00('0x1a')],_0x1c5443[_0x6f00('0x18')],_0x1c5443[_0x6f00('0x1b')]));_0x1c5443['on'](_0x6f00('0xa'),errorHandler);_0x1c5443['on'](_0x6f00('0x34'),closeHandler);_0x1c5443['on'](_0x6f00('0x35'),timeoutHandler);_0x1c5443['evtHangup']=![];_0x1c5443['on'](_0x6f00('0x36'),hangupHandler);var _0x1dee52=getSquareProject[_0x6f00('0x37')](null,_0x1c5443['arg_1']);if(_0x1dee52){if(_0x1dee52[_0x6f00('0x38')]){_0x3cefb8=getRoot(_0x1dee52[_0x6f00('0x38')]);if(_0x3cefb8&&_0x3cefb8[_0x6f00('0x39')]){logger['debug'](_0x6f00('0x1e'),JSON['stringify'](_0x3cefb8,null,0x2));_0x1c5443[_0x6f00('0x3a')]=moment()['format'](_0x6f00('0x3b'));_0x526aa1=initGraph(_[_0x6f00('0x22')](_0x3cefb8,_0x6f00('0x3c')),_0x3cefb8[_0x6f00('0x3c')]);_0x4255e8=new Vertices(_0x1c5443,rpc,mailRpc);logger['info'](util[_0x6f00('0x10')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1c5443[_0x6f00('0x16')],_0x1c5443['calleridname'],_0x1c5443[_0x6f00('0x1a')],_0x1c5443[_0x6f00('0x18')],_0x1c5443[_0x6f00('0x1b')]));_0x526aa1[_0x6f00('0x3d')](_0x3cefb8['start']['id'],function(_0x53dc8c){try{_0x53dc8c=_0x4255e8[_0x6f00('0x3e')](_0x53dc8c);logger['debug'](_0x6f00('0x3f'),JSON[_0x6f00('0x32')](_0x53dc8c,null,0x2));if(_0x53dc8c['agicommand']===_0x6f00('0x40')){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x1c5443[_0x6f00('0x41')]=_0x53dc8c[_0x6f00('0x41')]||_0x1c5443[_0x6f00('0x41')];_0x1c5443[_0x6f00('0x42')]=_0x53dc8c['extension'];_0x1c5443[_0x6f00('0x43')]=_0x53dc8c[_0x6f00('0x43')]?_0x53dc8c[_0x6f00('0x43')]-0x1:0x1;return null;}else if(_0x53dc8c&&_0x4255e8[_0x53dc8c[_0x6f00('0x1f')]]){_0x52274f=_0x4255e8[_0x53dc8c[_0x6f00('0x1f')]](_0x53dc8c);logger[_0x6f00('0xf')]('response',JSON[_0x6f00('0x32')](_0x52274f,null,0x2));if(_0x52274f&&_0x52274f[_0x6f00('0x44')]===AGI_CODE_SUCCESS&&_0x52274f[_0x6f00('0x45')]!==AGI_RESULT_ERROR&&!_0x1c5443[_0x6f00('0x46')]){logger[_0x6f00('0x47')](_0x6f00('0x48'),getLogFromObject(_0x52274f));return _['isUndefined'](_0x52274f[_0x6f00('0x45')])?null:_0x52274f[_0x6f00('0x45')][_0x6f00('0x49')]();}else{logger['error'](_0x6f00('0x48'),getLogFromObject(_0x52274f));return null;}}else{logger['error'](_0x6f00('0x4a'));return null;}}catch(_0x346c0c){logger['error'](_0x346c0c[_0x6f00('0xb')]);return null;}});if(_0x3cefb8['finally']){logger[_0x6f00('0xf')](util[_0x6f00('0x10')](_0x6f00('0x4b'),_0x1c5443[_0x6f00('0x16')],_0x1c5443['calleridname'],_0x1c5443[_0x6f00('0x1a')],_0x1c5443['dnid'],_0x1c5443[_0x6f00('0x1b')]));_0x526aa1['traverseBFS'](_0x3cefb8[_0x6f00('0x4c')]['id'],function(_0x22f492){try{_0x22f492=_0x4255e8[_0x6f00('0x3e')](_0x22f492);logger[_0x6f00('0x47')](_0x6f00('0x3f'),JSON[_0x6f00('0x32')](_0x22f492,null,0x2));if(_0x22f492&&_0x4255e8[_0x22f492[_0x6f00('0x1f')]]){_0x52274f=_0x4255e8[_0x22f492[_0x6f00('0x1f')]](_0x22f492);if(_0x52274f){logger['debug'](_0x6f00('0x48'),getLogFromObject(_0x52274f));return _['isUndefined'](_0x52274f[_0x6f00('0x45')])?null:_0x52274f[_0x6f00('0x45')][_0x6f00('0x49')]();}else{logger['error']('response',getLogFromObject(_0x52274f));return null;}}else{logger[_0x6f00('0xa')](_0x6f00('0x4a'));return null;}}catch(_0x494ba5){logger[_0x6f00('0xa')](_0x494ba5['stack']);return null;}});}logger[_0x6f00('0xf')](util['format'](_0x6f00('0x4d'),_0x1c5443[_0x6f00('0x16')],_0x1c5443['calleridname'],_0x1c5443['callerid'],_0x1c5443[_0x6f00('0x18')],_0x1c5443[_0x6f00('0x1b')]));logger['info'](util[_0x6f00('0x10')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x1c5443[_0x6f00('0x41')],_0x1c5443[_0x6f00('0x42')],parseInt(_0x1c5443[_0x6f00('0x43')],0xa)+0x1));_0x1c5443[_0x6f00('0x4e')](_0x1c5443[_0x6f00('0x41')],_0x1c5443[_0x6f00('0x42')],parseInt(_0x1c5443[_0x6f00('0x43')],0xa)+0x1);_0x1c5443[_0x6f00('0x34')]();}}else{logger[_0x6f00('0xa')](util[_0x6f00('0x10')](_0x6f00('0x4f'),_0x1c5443[_0x6f00('0x16')]));_0x1c5443[_0x6f00('0x4e')](_0x1c5443[_0x6f00('0x41')],_0x1c5443[_0x6f00('0x42')],parseInt(_0x1c5443[_0x6f00('0x43')],0xa)+0x1);_0x1c5443[_0x6f00('0x34')]();}}else{logger[_0x6f00('0xa')](util[_0x6f00('0x10')](_0x6f00('0x50'),_0x1c5443['arg_1']));_0x1c5443['continueAt'](_0x1c5443[_0x6f00('0x41')],_0x1c5443['extension'],parseInt(_0x1c5443[_0x6f00('0x43')],0xa)+0x1);_0x1c5443[_0x6f00('0x34')]();}}function main(){var _0x4edd9f;return utilLicense[_0x6f00('0x51')]()[_0x6f00('0x2b')](function(_0x2c87b5){if(_0x2c87b5){if(_0x2c87b5['voice']){if(_0x2c87b5[_0x6f00('0x52')]&&_0x2c87b5['callysquare']>0x0){logger[_0x6f00('0xf')](util[_0x6f00('0x10')]('[LICENSE]\x20CHANNELS:\x20%s',_0x2c87b5[_0x6f00('0x52')]));_0x4edd9f=_0x2c87b5[_0x6f00('0x52')];}else{logger[_0x6f00('0xf')](_0x6f00('0x53'));}}else{logger[_0x6f00('0xf')](_0x6f00('0x54'));_0x4edd9f=-0x1;}}})[_0x6f00('0x2c')](function(_0x4a4905){logger['error']('[LICENSE]',_0x4a4905['stack']);})[_0x6f00('0x4c')](function(){var _0x269753=require('./server')(config['agi'][_0x6f00('0xe')],config[_0x6f00('0x3')]['ip'],_0x4edd9f);_0x269753['on'](_0x6f00('0xa'),errorHandler);_0x269753['on'](_0x6f00('0x55'),listeningHandler);_0x269753['on']('connection',connectionHandler);_0x269753['on'](_0x6f00('0x34'),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 720472d..98fb7c6 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x57cb64,_0x27dcb8){var _0x308fdb=function(_0x249c8f){while(--_0x249c8f){_0x57cb64['push'](_0x57cb64['shift']());}};_0x308fdb(++_0x27dcb8);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x193219,_0x55ad54){var _0x153f33=function(_0x5540c7){while(--_0x5540c7){_0x193219['push'](_0x193219['shift']());}};_0x153f33(++_0x55ad54);}(_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/agi/reply.js b/server/services/agi/reply.js index b4c5a91..759d8f1 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(_0x35795f,_0x48b488){var _0x33faa4=function(_0x5db996){while(--_0x5db996){_0x35795f['push'](_0x35795f['shift']());}};_0x33faa4(++_0x48b488);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2d7efe,_0x53745b){_0x2d7efe=_0x2d7efe-0x0;var _0x52a346=_0x5f2f[_0x2d7efe];return _0x52a346;};'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(_0x5d3313,_0x39c46e){var _0x40b46c=function(_0x37e32a){while(--_0x37e32a){_0x5d3313['push'](_0x5d3313['shift']());}};_0x40b46c(++_0x39c46e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x42d533,_0x28a958){_0x42d533=_0x42d533-0x0;var _0x62e69f=_0x5f2f[_0x42d533];return _0x62e69f;};'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 b66115c..477a9bf 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 _0x3f9d=['getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','ShowSound','getIntervalById','ShowInterval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','bluebird','lodash','util','jayson/promise','client','http','request','then','error','message','result','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','ShowVoiceQueue','getVariableById'];(function(_0x3e8e79,_0x1c865c){var _0x4e2039=function(_0x47b214){while(--_0x47b214){_0x3e8e79['push'](_0x3e8e79['shift']());}};_0x4e2039(++_0x1c865c);}(_0x3f9d,0x12e));var _0xd3f9=function(_0x152ef7,_0x221f4c){_0x152ef7=_0x152ef7-0x0;var _0x33b535=_0x3f9d[_0x152ef7];return _0x33b535;};'use strict';var BPromise=require(_0xd3f9('0x0'));var moment=require('moment');var _=require(_0xd3f9('0x1'));var util=require(_0xd3f9('0x2'));var jayson=require(_0xd3f9('0x3'));var client=jayson[_0xd3f9('0x4')][_0xd3f9('0x5')]({'port':0x2329});function request(_0x10ffea,_0x4de754){return new BPromise(function(_0x507b8e,_0x2265c9){return client[_0xd3f9('0x6')](_0x10ffea,_0x4de754)[_0xd3f9('0x7')](function(_0x4d91b3){if(_0x4d91b3[_0xd3f9('0x8')]){return _0x2265c9(_0x4d91b3[_0xd3f9('0x8')][_0xd3f9('0x9')]);}else{return _0x507b8e(_0x4d91b3[_0xd3f9('0xa')]);}})['catch'](function(_0x56157e){return _0x2265c9(_0x56157e);});});}exports['getSquareProject']=function(_0x4ece98){return request(_0xd3f9('0xb'),{'options':{'raw':![],'where':{'name':_0x4ece98},'attributes':[_0xd3f9('0xc')]}});};exports[_0xd3f9('0xd')]=function(_0xfde804){return request(_0xd3f9('0xe'),{'options':{'raw':![],'where':{'id':_0xfde804},'include':[{'model':_0xd3f9('0xf'),'as':_0xd3f9('0x10')}],'attributes':['id',_0xd3f9('0x11'),_0xd3f9('0x12')]}});};exports[_0xd3f9('0x13')]=function(_0x526dd3){return request(_0xd3f9('0xb'),{'options':{'where':{'id':_0x526dd3},'attributes':[_0xd3f9('0x11')]}});};exports['getVoiceQueueById']=function(_0x5a8970){return request(_0xd3f9('0x14'),{'options':{'where':{'id':_0x5a8970},'attributes':[_0xd3f9('0x11')]}});};exports[_0xd3f9('0x15')]=function(_0x581d58){return request('ShowVariable',{'options':{'where':{'id':_0x581d58},'attributes':[_0xd3f9('0x11')]}});};exports[_0xd3f9('0x16')]=function(_0x59856c){return request(_0xd3f9('0x17'),{'options':{'where':{'id':_0x59856c},'attributes':['dsn']}});};exports[_0xd3f9('0x18')]=function(_0x231dc4){return request(_0xd3f9('0x19'),{'options':{'where':{'id':_0x231dc4},'attributes':[_0xd3f9('0x11')]}});};exports['getTrunkById']=function(_0x57ed1b){return request('ShowTrunk',{'options':{'where':{'id':_0x57ed1b},'attributes':[_0xd3f9('0x11')]}});};exports['getSoundById']=function(_0x2c0081){return request(_0xd3f9('0x1a'),{'options':{'where':{'id':_0x2c0081},'attributes':['save_name']}});};exports[_0xd3f9('0x1b')]=function(_0x1b0092){return request(_0xd3f9('0x1c'),{'options':{'raw':![],'where':{'id':_0x1b0092},'include':[{'model':'Interval','as':_0xd3f9('0x1d')}]}});};exports[_0xd3f9('0x1e')]=function(_0x1f58bc){return request('ShowSmsAccount',{'options':{'where':{'id':_0x1f58bc},'attributes':['id',_0xd3f9('0x11')]}});};exports[_0xd3f9('0x1f')]=function(_0xe78640){return request(_0xd3f9('0x20'),{'body':_0xe78640});};exports['createSquareDetailsReport']=function(_0xb6cdd5){return request('CreateSquareDetailsReport',{'body':_0xb6cdd5});};exports[_0xd3f9('0x21')]=function(_0x15e0a4){return request(_0xd3f9('0x22'),{'body':_[_0xd3f9('0x23')](_0x15e0a4,{'project_name':_0x15e0a4[_0xd3f9('0x24')],'prev_project_name':_0x15e0a4[_0xd3f9('0x25')]||'','is_subproject':_0x15e0a4[_0xd3f9('0x25')]?!![]:![],'leaveAt':moment()['format'](_0xd3f9('0x26'))})});};exports['createSquareRecording']=function(_0x589734){return request(_0xd3f9('0x27'),{'body':_0x589734});};exports[_0xd3f9('0x28')]=function(_0x2e2c8f){return request(_0xd3f9('0x29'),{'body':_0x2e2c8f});};exports[_0xd3f9('0x2a')]=function(_0x547f2c){return request(_0xd3f9('0x2b'),{'options':{'raw':![],'where':{'phone':_0x547f2c[_0xd3f9('0x2c')],'ListId':_0x547f2c[_0xd3f9('0x2d')]}}})['then'](function(_0x1f0d3c){if(_0x1f0d3c){return _0x1f0d3c;}return request(_0xd3f9('0x2e'),{'body':_0x547f2c});});};exports['getPauseById']=function(_0x5dd71c){return request(_0xd3f9('0x2f'),{'options':{'where':{'id':_0x5dd71c},'attributes':['name']}});};exports[_0xd3f9('0x30')]=function(_0x45a5c1,_0x3b7bd4){return request(_0xd3f9('0x31'),{'body':{'interface':_0x3b7bd4},'options':{'where':_0x45a5c1}});};exports[_0xd3f9('0x32')]=function(_0x3f3277,_0x1d0e23,_0x1ccf08){return request(_0xd3f9('0x33'),{'body':{'type':_0x1d0e23,'uniqueid':_0x1ccf08},'options':{'where':_0x3f3277}});};exports[_0xd3f9('0x34')]=function(_0x39d2b9){return request('UnpauseUser',{'body':{},'options':{'where':_0x39d2b9}});};exports[_0xd3f9('0x35')]=function(_0x1d4489){return request('LogoutUser',{'body':{},'options':{'where':_0x1d4489}});}; \ No newline at end of file +var _0x98ad=['getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','bluebird','lodash','jayson/promise','client','request','error','message','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','Smtp','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','name','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn'];(function(_0x265003,_0xf0f023){var _0x33c743=function(_0x326a5d){while(--_0x326a5d){_0x265003['push'](_0x265003['shift']());}};_0x33c743(++_0xf0f023);}(_0x98ad,0x1c1));var _0xd98a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x98ad[_0x2dafbe];return _0x58a45a;};'use strict';var BPromise=require(_0xd98a('0x0'));var moment=require('moment');var _=require(_0xd98a('0x1'));var util=require('util');var jayson=require(_0xd98a('0x2'));var client=jayson[_0xd98a('0x3')]['http']({'port':0x2329});function request(_0x262ca3,_0x3d85e9){return new BPromise(function(_0x1a6990,_0x5e7b8b){return client[_0xd98a('0x4')](_0x262ca3,_0x3d85e9)['then'](function(_0x14d7a4){if(_0x14d7a4[_0xd98a('0x5')]){return _0x5e7b8b(_0x14d7a4[_0xd98a('0x5')][_0xd98a('0x6')]);}else{return _0x1a6990(_0x14d7a4['result']);}})[_0xd98a('0x7')](function(_0x51a832){return _0x5e7b8b(_0x51a832);});});}exports[_0xd98a('0x8')]=function(_0x586b24){return request(_0xd98a('0x9'),{'options':{'raw':![],'where':{'name':_0x586b24},'attributes':[_0xd98a('0xa')]}});};exports[_0xd98a('0xb')]=function(_0x14537e){return request(_0xd98a('0xc'),{'options':{'raw':![],'where':{'id':_0x14537e},'include':[{'model':'MailServerOut','as':_0xd98a('0xd')}],'attributes':['id','name','email']}});};exports[_0xd98a('0xe')]=function(_0x189eb9){return request(_0xd98a('0x9'),{'options':{'where':{'id':_0x189eb9},'attributes':['name']}});};exports[_0xd98a('0xf')]=function(_0x1d6ef4){return request(_0xd98a('0x10'),{'options':{'where':{'id':_0x1d6ef4},'attributes':[_0xd98a('0x11')]}});};exports[_0xd98a('0x12')]=function(_0x49f5c7){return request(_0xd98a('0x13'),{'options':{'where':{'id':_0x49f5c7},'attributes':[_0xd98a('0x11')]}});};exports[_0xd98a('0x14')]=function(_0x59b9e9){return request(_0xd98a('0x15'),{'options':{'where':{'id':_0x59b9e9},'attributes':[_0xd98a('0x16')]}});};exports[_0xd98a('0x17')]=function(_0x19f5d3){return request(_0xd98a('0x18'),{'options':{'where':{'id':_0x19f5d3},'attributes':[_0xd98a('0x11')]}});};exports[_0xd98a('0x19')]=function(_0x592bd7){return request(_0xd98a('0x1a'),{'options':{'where':{'id':_0x592bd7},'attributes':['name']}});};exports[_0xd98a('0x1b')]=function(_0x495f30){return request(_0xd98a('0x1c'),{'options':{'where':{'id':_0x495f30},'attributes':[_0xd98a('0x1d')]}});};exports[_0xd98a('0x1e')]=function(_0x4c2914){return request(_0xd98a('0x1f'),{'options':{'raw':![],'where':{'id':_0x4c2914},'include':[{'model':_0xd98a('0x20'),'as':'Intervals'}]}});};exports[_0xd98a('0x21')]=function(_0xe653ee){return request(_0xd98a('0x22'),{'options':{'where':{'id':_0xe653ee},'attributes':['id',_0xd98a('0x11')]}});};exports['createSmsMessage']=function(_0x1fd991){return request(_0xd98a('0x23'),{'body':_0x1fd991});};exports['createSquareDetailsReport']=function(_0x3471cb){return request('CreateSquareDetailsReport',{'body':_0x3471cb});};exports[_0xd98a('0x24')]=function(_0x5ec1b2){return request(_0xd98a('0x25'),{'body':_[_0xd98a('0x26')](_0x5ec1b2,{'project_name':_0x5ec1b2[_0xd98a('0x27')],'prev_project_name':_0x5ec1b2[_0xd98a('0x28')]||'','is_subproject':_0x5ec1b2[_0xd98a('0x28')]?!![]:![],'leaveAt':moment()[_0xd98a('0x29')](_0xd98a('0x2a'))})});};exports['createSquareRecording']=function(_0x1d0c7d){return request(_0xd98a('0x2b'),{'body':_0x1d0c7d});};exports[_0xd98a('0x2c')]=function(_0x734f7b){return request('CreateSquareMessage',{'body':_0x734f7b});};exports[_0xd98a('0x2d')]=function(_0x20b1f2){return request(_0xd98a('0x2e'),{'options':{'raw':![],'where':{'phone':_0x20b1f2[_0xd98a('0x2f')],'ListId':_0x20b1f2[_0xd98a('0x30')]}}})['then'](function(_0xf6b210){if(_0xf6b210){return _0xf6b210;}return request(_0xd98a('0x31'),{'body':_0x20b1f2});});};exports[_0xd98a('0x32')]=function(_0x2e0b93){return request(_0xd98a('0x33'),{'options':{'where':{'id':_0x2e0b93},'attributes':[_0xd98a('0x11')]}});};exports[_0xd98a('0x34')]=function(_0x51a9e0,_0x316d71){return request(_0xd98a('0x35'),{'body':{'interface':_0x316d71},'options':{'where':_0x51a9e0}});};exports[_0xd98a('0x36')]=function(_0x2a7635,_0x178d68,_0x481d7c){return request(_0xd98a('0x37'),{'body':{'type':_0x178d68,'uniqueid':_0x481d7c},'options':{'where':_0x2a7635}});};exports[_0xd98a('0x38')]=function(_0x3e50ca){return request(_0xd98a('0x39'),{'body':{},'options':{'where':_0x3e50ca}});};exports[_0xd98a('0x3a')]=function(_0x2cd810){return request('LogoutUser',{'body':{},'options':{'where':_0x2cd810}});}; \ 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 52224f7..6cee5b5 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 _0x425d=['./polly','exports'];(function(_0x1bcce6,_0x2181ad){var _0x4fc30a=function(_0xbfc481){while(--_0xbfc481){_0x1bcce6['push'](_0x1bcce6['shift']());}};_0x4fc30a(++_0x2181ad);}(_0x425d,0x1e0));var _0xd425=function(_0x44770b,_0x292817){_0x44770b=_0x44770b-0x0;var _0x156812=_0x425d[_0x44770b];return _0x156812;};var polly=require(_0xd425('0x0'));var lex=require('./lex');module[_0xd425('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x3e74=['exports','./polly'];(function(_0x454773,_0x4d5291){var _0x3b4870=function(_0x5b2849){while(--_0x5b2849){_0x454773['push'](_0x454773['shift']());}};_0x3b4870(++_0x4d5291);}(_0x3e74,0x175));var _0x43e7=function(_0x4d500f,_0x89f6a){_0x4d500f=_0x4d500f-0x0;var _0x406f88=_0x3e74[_0x4d500f];return _0x406f88;};var polly=require(_0x43e7('0x0'));var lex=require('./lex');module[_0x43e7('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index a676565..dcf25ca 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 _0x5c37=['./lib/api','exports'];(function(_0x179c0c,_0x20fe42){var _0x2ab663=function(_0x3b9c1f){while(--_0x3b9c1f){_0x179c0c['push'](_0x179c0c['shift']());}};_0x2ab663(++_0x20fe42);}(_0x5c37,0x11e));var _0x75c3=function(_0x4c05da,_0x414720){_0x4c05da=_0x4c05da-0x0;var _0x1614db=_0x5c37[_0x4c05da];return _0x1614db;};'use strict';var lex=require(_0x75c3('0x0'));module[_0x75c3('0x1')]=function(_0x302a73,_0x43cf5a,_0x2a3a11,_0x79e9a5,_0x524eee,_0x1f0ee1){return lex(_0x302a73,_0x43cf5a,_0x2a3a11,_0x79e9a5,_0x524eee,_0x1f0ee1);}; \ No newline at end of file +var _0xfa20=['exports','./lib/api'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xfa20,0x141));var _0x0fa2=function(_0x4e697a,_0x56a14b){_0x4e697a=_0x4e697a-0x0;var _0x88850c=_0xfa20[_0x4e697a];return _0x88850c;};'use strict';var lex=require(_0x0fa2('0x0'));module[_0x0fa2('0x1')]=function(_0xe7fb6a,_0x105015,_0x22096a,_0x97b979,_0x10a7c4,_0x40c116){return lex(_0xe7fb6a,_0x105015,_0x22096a,_0x97b979,_0x10a7c4,_0x40c116);}; \ 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 69cdc6a..85c8ffa 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 _0xc001=['aws-sdk','postText','slots','hasOwnProperty','slot_','exports','$LATEST','bluebird'];(function(_0x1e0ca5,_0x57fd4f){var _0x410923=function(_0x5bd94d){while(--_0x5bd94d){_0x1e0ca5['push'](_0x1e0ca5['shift']());}};_0x410923(++_0x57fd4f);}(_0xc001,0x11f));var _0x1c00=function(_0x4b477a,_0x36997d){_0x4b477a=_0x4b477a-0x0;var _0x57e310=_0xc001[_0x4b477a];return _0x57e310;};'use strict';var BPromise=require(_0x1c00('0x0'));var AWS=require(_0x1c00('0x1'));function lexResult(_0x18ae14,_0x24ae54){return new BPromise(function(_0x40a43b,_0x1d14d4){_0x18ae14[_0x1c00('0x2')](_0x24ae54,function(_0x3c40c3,_0x439f08){if(_0x3c40c3){_0x1d14d4(_0x3c40c3);}if(_0x439f08[_0x1c00('0x3')]){for(const _0x256d3c in _0x439f08[_0x1c00('0x3')]){if(_0x439f08[_0x1c00('0x3')][_0x1c00('0x4')](_0x256d3c)){var _0x250be1=_0x439f08[_0x1c00('0x3')][_0x256d3c];_0x439f08[_0x1c00('0x5')+_0x256d3c]=_0x250be1;}}}_0x40a43b(_0x439f08);});});}module[_0x1c00('0x6')]=function(_0x687d4a,_0x51e54b,_0x28766b,_0x412680,_0x2e62d4,_0x3f9dc8){var _0x35c271=new AWS['LexRuntime']({'accessKeyId':_0x51e54b,'secretAccessKey':_0x28766b,'region':_0x412680});var _0x152d0a={'botAlias':_0x1c00('0x7'),'botName':_0x3f9dc8,'inputText':_0x2e62d4,'userId':_0x687d4a};return lexResult(_0x35c271,_0x152d0a);}; \ No newline at end of file +var _0x8e4f=['postText','slots','slot_','exports','LexRuntime','$LATEST','bluebird','aws-sdk'];(function(_0x1a9f6f,_0x73e636){var _0x38ae40=function(_0x1956c5){while(--_0x1956c5){_0x1a9f6f['push'](_0x1a9f6f['shift']());}};_0x38ae40(++_0x73e636);}(_0x8e4f,0x6e));var _0xf8e4=function(_0x37d76d,_0x14ab7e){_0x37d76d=_0x37d76d-0x0;var _0x486c89=_0x8e4f[_0x37d76d];return _0x486c89;};'use strict';var BPromise=require(_0xf8e4('0x0'));var AWS=require(_0xf8e4('0x1'));function lexResult(_0x2c1bd8,_0x48af92){return new BPromise(function(_0x1fe75b,_0x522d67){_0x2c1bd8[_0xf8e4('0x2')](_0x48af92,function(_0x345a98,_0xa136f){if(_0x345a98){_0x522d67(_0x345a98);}if(_0xa136f[_0xf8e4('0x3')]){for(const _0x408499 in _0xa136f[_0xf8e4('0x3')]){if(_0xa136f[_0xf8e4('0x3')]['hasOwnProperty'](_0x408499)){var _0xa3102d=_0xa136f[_0xf8e4('0x3')][_0x408499];_0xa136f[_0xf8e4('0x4')+_0x408499]=_0xa3102d;}}}_0x1fe75b(_0xa136f);});});}module[_0xf8e4('0x5')]=function(_0x4ad712,_0x2713b7,_0x31d0d6,_0xc2f4ad,_0x2311a5,_0x1a9c4e){var _0xde25ae=new AWS[(_0xf8e4('0x6'))]({'accessKeyId':_0x2713b7,'secretAccessKey':_0x31d0d6,'region':_0xc2f4ad});var _0x1a5dff={'botAlias':_0xf8e4('0x7'),'botName':_0x1a9c4e,'inputText':_0x2311a5,'userId':_0x4ad712};return lexResult(_0xde25ae,_0x1a5dff);}; \ 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 329ea92..bfc7fb8 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 _0xcb49=['./lib/api','exports'];(function(_0x5c7aa1,_0x2a9324){var _0x11a615=function(_0x3f75d4){while(--_0x3f75d4){_0x5c7aa1['push'](_0x5c7aa1['shift']());}};_0x11a615(++_0x2a9324);}(_0xcb49,0x134));var _0x9cb4=function(_0x4c1eec,_0x515aa1){_0x4c1eec=_0x4c1eec-0x0;var _0x5d8475=_0xcb49[_0x4c1eec];return _0x5d8475;};'use strict';var polly=require(_0x9cb4('0x0'));module[_0x9cb4('0x1')]=function(_0x52595d,_0x2f31e9,_0x16633a,_0x4df706,_0x48e003,_0xba8cd1,_0x1dcdb9){return polly(_0x52595d,_0x2f31e9,_0x16633a,_0x4df706,_0x48e003,_0xba8cd1,_0x1dcdb9);}; \ No newline at end of file +var _0x099f=['./lib/api','exports'];(function(_0x2cf777,_0x49d4ad){var _0xb82e09=function(_0x2cf01f){while(--_0x2cf01f){_0x2cf777['push'](_0x2cf777['shift']());}};_0xb82e09(++_0x49d4ad);}(_0x099f,0x176));var _0xf099=function(_0x40481b,_0x1d8354){_0x40481b=_0x40481b-0x0;var _0x56bebe=_0x099f[_0x40481b];return _0x56bebe;};'use strict';var polly=require(_0xf099('0x0'));module[_0xf099('0x1')]=function(_0x3b7084,_0x4e19ba,_0x491ce0,_0x38ac24,_0x1156dc,_0x56e105,_0x8c7d62){return polly(_0x3b7084,_0x4e19ba,_0x491ce0,_0x38ac24,_0x1156dc,_0x56e105,_0x8c7d62);}; \ 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 b2fbee9..45990ad 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 _0x732a=['aws-sdk','synthesizeSpeech','writeFile','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','mp3','path','bluebird'];(function(_0x6cb846,_0x289c00){var _0x1d1203=function(_0x502360){while(--_0x502360){_0x6cb846['push'](_0x6cb846['shift']());}};_0x1d1203(++_0x289c00);}(_0x732a,0xf6));var _0xa732=function(_0xcc6ce4,_0x2979cf){_0xcc6ce4=_0xcc6ce4-0x0;var _0x29566e=_0x732a[_0xcc6ce4];return _0x29566e;};'use strict';var fs=require('fs');var path=require(_0xa732('0x0'));var BPromise=require(_0xa732('0x1'));var rs=require('randomstring');var AWS=require(_0xa732('0x2'));function pollyResult(_0x3f1cbc,_0x1cc7f0,_0x470f5d){return new BPromise(function(_0x31620f,_0x45a973){_0x3f1cbc[_0xa732('0x3')](_0x1cc7f0,function(_0x483539,_0x45e2b4){if(_0x483539){_0x45a973(_0x483539);}else if(_0x45e2b4){if(_0x45e2b4['AudioStream']instanceof Buffer){fs[_0xa732('0x4')](_0x470f5d,_0x45e2b4[_0xa732('0x5')],function(_0xbb52ef){if(_0xbb52ef){_0x45a973(_0xbb52ef);}else{_0x31620f();}});}else{_0x45a973(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x45a973(new Error(_0xa732('0x6')));}});});}module['exports']=function(_0x1d751b,_0x441212,_0x31bcae,_0x287541,_0x5d456e,_0x3a64e7,_0x445d21){var _0x1df3b9=new AWS['Polly']({'accessKeyId':_0x1d751b,'secretAccessKey':_0x441212,'region':_0x31bcae});var _0x580857={'Text':_0x5d456e,'TextType':_0x3a64e7||'text','OutputFormat':_0xa732('0x7'),'VoiceId':_0x287541};return pollyResult(_0x1df3b9,_0x580857,_0x445d21);}; \ No newline at end of file +var _0xbaf8=['Polly','text','mp3','path','bluebird','synthesizeSpeech','AudioStream','exports'];(function(_0x54888e,_0x3b962f){var _0x2113ad=function(_0x563202){while(--_0x563202){_0x54888e['push'](_0x54888e['shift']());}};_0x2113ad(++_0x3b962f);}(_0xbaf8,0x11b));var _0x8baf=function(_0x153863,_0x41363d){_0x153863=_0x153863-0x0;var _0x3bfc32=_0xbaf8[_0x153863];return _0x3bfc32;};'use strict';var fs=require('fs');var path=require(_0x8baf('0x0'));var BPromise=require(_0x8baf('0x1'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x368213,_0x25edc3,_0x5c339e){return new BPromise(function(_0x1336ba,_0x379c34){_0x368213[_0x8baf('0x2')](_0x25edc3,function(_0x2736bb,_0x162ac7){if(_0x2736bb){_0x379c34(_0x2736bb);}else if(_0x162ac7){if(_0x162ac7[_0x8baf('0x3')]instanceof Buffer){fs['writeFile'](_0x5c339e,_0x162ac7['AudioStream'],function(_0x5a63b5){if(_0x5a63b5){_0x379c34(_0x5a63b5);}else{_0x1336ba();}});}else{_0x379c34(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x379c34(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x8baf('0x4')]=function(_0x582cbf,_0x21f7a9,_0x22bb59,_0x46637c,_0x562ca0,_0x250099,_0x4eb01a){var _0x1e4a69=new AWS[(_0x8baf('0x5'))]({'accessKeyId':_0x582cbf,'secretAccessKey':_0x21f7a9,'region':_0x22bb59});var _0x51f284={'Text':_0x562ca0,'TextType':_0x250099||_0x8baf('0x6'),'OutputFormat':_0x8baf('0x7'),'VoiceId':_0x46637c};return pollyResult(_0x1e4a69,_0x51f284,_0x4eb01a);}; \ 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 93b0d07..84095d0 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 _0x9f20=['./lib/api','exports'];(function(_0x5ecac8,_0x246286){var _0x255862=function(_0x1a2d83){while(--_0x1a2d83){_0x5ecac8['push'](_0x5ecac8['shift']());}};_0x255862(++_0x246286);}(_0x9f20,0xd2));var _0x09f2=function(_0x3b0881,_0x308388){_0x3b0881=_0x3b0881-0x0;var _0x55adf0=_0x9f20[_0x3b0881];return _0x55adf0;};'use strict';var asr=require(_0x09f2('0x0'));module[_0x09f2('0x1')]=function(_0x548d9b,_0x3348a2,_0x3f2da1,_0x3225db){return asr(_0x548d9b,_0x3348a2,_0x3f2da1);}; \ No newline at end of file +var _0x2d02=['exports','./lib/api'];(function(_0x212a37,_0xf35b2e){var _0x5d0bf9=function(_0x51850f){while(--_0x51850f){_0x212a37['push'](_0x212a37['shift']());}};_0x5d0bf9(++_0xf35b2e);}(_0x2d02,0x17b));var _0x22d0=function(_0x553ae3,_0x5b0679){_0x553ae3=_0x553ae3-0x0;var _0x4c350d=_0x2d02[_0x553ae3];return _0x4c350d;};'use strict';var asr=require(_0x22d0('0x0'));module[_0x22d0('0x1')]=function(_0x281ed8,_0x1028f4,_0xa92d96,_0x6c9a77){return asr(_0x281ed8,_0x1028f4,_0xa92d96);}; \ 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 3f59df4..e842fa6 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 _0x7dbf=['8000','url','exports','string','length','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key='];(function(_0x2f4f7a,_0x4b1579){var _0x2fccfc=function(_0x44fecc){while(--_0x44fecc){_0x2f4f7a['push'](_0x2f4f7a['shift']());}};_0x2fccfc(++_0x4b1579);}(_0x7dbf,0x1e1));var _0xf7db=function(_0x304548,_0x1784b2){_0x304548=_0x304548-0x0;var _0x5dd7ad=_0x7dbf[_0x304548];return _0x5dd7ad;};'use strict';var url=require(_0xf7db('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0xf7db('0x1')]=function(_0x4425c5,_0x44cf18,_0x275e0a){return new BPromise(function(_0x477e05,_0x5a371f){var _0x1cf293;if(typeof _0x4425c5!==_0xf7db('0x2')||_0x4425c5[_0xf7db('0x3')]===0x0){return _0x5a371f('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x44cf18!==_0xf7db('0x2')||_0x44cf18['length']===0x0){return _0x5a371f('key\x20should\x20be\x20a\x20string');}if(typeof _0x275e0a!==_0xf7db('0x4')&&(typeof _0x275e0a!==_0xf7db('0x2')||_0x275e0a[_0xf7db('0x3')]===0x0)){return _0x5a371f(_0xf7db('0x5'));}try{_0x1cf293=fs[_0xf7db('0x6')](_0x4425c5)[_0xf7db('0x7')](_0xf7db('0x8'));}catch(_0x543005){return _0x5a371f(_0x543005);}return _0x477e05({'method':_0xf7db('0x9'),'uri':host+_0xf7db('0xa')+_0x44cf18,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xf7db('0xb'),'languageCode':_0x275e0a},'audio':{'content':_0x1cf293}},'json':!![]});});}; \ No newline at end of file +var _0x93cb=['bluebird','exports','filepath\x20should\x20be\x20a\x20string','string','length','lang\x20should\x20be\x20a\x20string','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0x93cb,0xdc));var _0xb93c=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x93cb[_0x278e3c];return _0x3e2d9b;};'use strict';var url=require('url');var BPromise=require(_0xb93c('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xb93c('0x1')]=function(_0x1c63db,_0x1414bd,_0x44c61b){return new BPromise(function(_0x3fa2ad,_0x528118){var _0x1d8985;if(typeof _0x1c63db!=='string'||_0x1c63db['length']===0x0){return _0x528118(_0xb93c('0x2'));}if(typeof _0x1414bd!==_0xb93c('0x3')||_0x1414bd[_0xb93c('0x4')]===0x0){return _0x528118('key\x20should\x20be\x20a\x20string');}if(typeof _0x44c61b!=='undefined'&&(typeof _0x44c61b!==_0xb93c('0x3')||_0x44c61b[_0xb93c('0x4')]===0x0)){return _0x528118(_0xb93c('0x5'));}try{_0x1d8985=fs['readFileSync'](_0x1c63db)[_0xb93c('0x6')](_0xb93c('0x7'));}catch(_0x1fe334){return _0x528118(_0x1fe334);}return _0x3fa2ad({'method':'POST','uri':host+_0xb93c('0x8')+_0x1414bd,'body':{'config':{'encoding':_0xb93c('0x9'),'sampleRateHertz':_0xb93c('0xa'),'languageCode':_0x44c61b},'audio':{'content':_0x1d8985}},'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 bd1322c..34dbeeb 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 _0x6c79=['./asr','exports'];(function(_0x73387a,_0x1c7c0c){var _0x2a8f8b=function(_0x5ef4db){while(--_0x5ef4db){_0x73387a['push'](_0x73387a['shift']());}};_0x2a8f8b(++_0x1c7c0c);}(_0x6c79,0x184));var _0x96c7=function(_0x3b129e,_0x152436){_0x3b129e=_0x3b129e-0x0;var _0x59b675=_0x6c79[_0x3b129e];return _0x59b675;};var asr=require(_0x96c7('0x0'));module[_0x96c7('0x1')]={'asr':asr}; \ No newline at end of file +var _0x77cb=['./asr','exports'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x77cb,0x1b2));var _0xb77c=function(_0x2f1110,_0xb6649c){_0x2f1110=_0x2f1110-0x0;var _0x12cae4=_0x77cb[_0x2f1110];return _0x12cae4;};var asr=require(_0xb77c('0x0'));module[_0xb77c('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 75838ef..f8cad53 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 _0xb659=['allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','intent','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','fulfillmentText','awsPolly','polly','lex','ispeechTTS','format','ispeechASR','model=%s','freeform=3','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','bluebird','dialogflow','http','https','md5','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','./aws','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','get','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','close','error','unlink','download\x20error','pipe','path','WHAT_EVER','data','end','transcode','wav','error\x20convert','info','finish\x20to\x20convert','resolve','tmp','generate','.wav','base64','then','777','split','toString','googleCloudTTS','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','chmodSync','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','f.req=','stringify','slice','parse\x20response\x20failed:\x0a','length','lang\x20\x22','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','textRequest','source','result','actionIncomplete','fulfillment','speech','status','metadata','endConversation','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','queryResult','action'];(function(_0x229521,_0x577494){var _0x523a48=function(_0x3d3d18){while(--_0x3d3d18){_0x229521['push'](_0x229521['shift']());}};_0x523a48(++_0x577494);}(_0xb659,0x124));var _0x9b65=function(_0x3512c3,_0x346843){_0x3512c3=_0x3512c3-0x0;var _0x3b2842=_0xb659[_0x3512c3];return _0x3b2842;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x9b65('0x0'));var dialogflow=require(_0x9b65('0x1'));var fs=require('fs');var http=require(_0x9b65('0x2'));var https=require(_0x9b65('0x3'));var md5=require(_0x9b65('0x4'));var path=require('path');var querystring=require(_0x9b65('0x5'));var rp=require(_0x9b65('0x6'));var rs=require(_0x9b65('0x7'));var sox=require(_0x9b65('0x8'));var tts=require(_0x9b65('0x9'));var urlParse=require(_0x9b65('0xa'))[_0x9b65('0xb')];var util=require('util');var aws=require(_0x9b65('0xc'));var google=require('./google');var sestek=require('./sestek');var tilde=require(_0x9b65('0xd'));var logger=require(_0x9b65('0xe'))(_0x9b65('0xf'));var ISPEECH_API=_0x9b65('0x10');function downloadFile(_0x49b5d3,_0x118ab5){return new BPromise(function(_0x3314c6,_0x4b5fec){var _0x1fff69=urlParse(_0x49b5d3);var _0x224fcc=_0x1fff69[_0x9b65('0x11')]===_0x9b65('0x12')?https:http;var _0x4ea530={'host':_0x1fff69[_0x9b65('0x13')],'path':_0x1fff69['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x224fcc[_0x9b65('0x14')](_0x4ea530,function(_0x70d282){if(_0x70d282['statusCode']!==0xc8){logger['error'](_0x9b65('0x15')+_0x49b5d3+_0x9b65('0x16')+_0x70d282[_0x9b65('0x17')]+'\x20('+_0x70d282[_0x9b65('0x18')]+')');_0x4b5fec(new Error('request\x20to\x20'+_0x49b5d3+'\x20failed,\x20status\x20code\x20=\x20'+_0x70d282['statusCode']+'\x20('+_0x70d282[_0x9b65('0x18')]+')'));return;}var _0x360353=fs[_0x9b65('0x19')](_0x118ab5);_0x360353['on']('finish',function(){logger['info']('finish\x20download\x20file');_0x360353[_0x9b65('0x1a')](_0x3314c6);});_0x360353['on'](_0x9b65('0x1b'),function(_0xd644e){fs[_0x9b65('0x1c')](_0x118ab5);logger[_0x9b65('0x1b')](_0x9b65('0x1d'),_0xd644e);_0x4b5fec(_0xd644e);});_0x70d282[_0x9b65('0x1e')](_0x360353);})['on']('error',function(_0xa3dd31){logger[_0x9b65('0x1b')](_0xa3dd31);_0x4b5fec(_0xa3dd31);})['end']();});}function uploadFile(_0x42daf8){return new BPromise(function(_0x51be59,_0x2d9d3a){var _0x419971=urlParse(_0x42daf8);var _0x46a100=_0x419971['protocol']==='https:'?https:http;var _0x3780ca={'host':_0x419971['host'],'path':_0x419971[_0x9b65('0x1f')],'headers':{'user-agent':_0x9b65('0x20')}};_0x46a100['get'](_0x3780ca,function(_0x359b43){if(_0x359b43[_0x9b65('0x17')]!==0xc8){_0x2d9d3a(new Error(_0x9b65('0x15')+_0x42daf8+_0x9b65('0x16')+_0x359b43[_0x9b65('0x17')]+'\x20('+_0x359b43[_0x9b65('0x18')]+')'));return;}var _0x1217f2='';_0x359b43['on'](_0x9b65('0x21'),function(_0x345962){_0x1217f2+=_0x345962;});_0x359b43['on'](_0x9b65('0x22'),function(){_0x51be59(_0x1217f2);});})['on'](_0x9b65('0x1b'),function(_0x45e1a8){_0x2d9d3a(_0x45e1a8);})['end']();});}function convertFile(_0x2bcf82,_0x46d8f8){return new BPromise(function(_0x12760e,_0x5dcd49){var _0x42c6da=sox[_0x9b65('0x23')](_0x2bcf82,_0x46d8f8,{'sampleRate':0x1f40,'format':_0x9b65('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x42c6da['on'](_0x9b65('0x1b'),function(_0x380aee){logger[_0x9b65('0x1b')](_0x9b65('0x25'),_0x380aee);_0x5dcd49(_0x380aee);});_0x42c6da['on'](_0x9b65('0x22'),function(){logger[_0x9b65('0x26')](_0x9b65('0x27'));_0x12760e();});_0x42c6da['start']();});}function base64Decode(_0x33672e,_0x13f53a){var _0x5545d7=path[_0x9b65('0x28')](__dirname,_0x9b65('0x29'),rs[_0x9b65('0x2a')](0x4)+_0x9b65('0x2b'));fs['writeFileSync'](_0x5545d7,_0x33672e,_0x9b65('0x2c'));return convertFile(_0x5545d7,_0x13f53a)[_0x9b65('0x2d')](function(){try{fs[_0x9b65('0x1c')](_0x5545d7);fs['chmodSync'](_0x13f53a,_0x9b65('0x2e'));}catch(_0x25b4e5){logger[_0x9b65('0x1b')](_0x25b4e5);}return _0x13f53a[_0x9b65('0x2f')]('.')[0x0];});}function base64Encode(_0x2c613e){var _0x561a45=fs['readFileSync'](_0x2c613e);return new Buffer(_0x561a45)[_0x9b65('0x30')](_0x9b65('0x2c'));}exports[_0x9b65('0x31')]=function(_0x4b9d6f,_0x2e2810,_0x3adc02,_0x5aabd2,_0x1444ab,_0x310269){var _0x55b619,_0x5e9c62;var _0x2cceb7='https://texttospeech.googleapis.com/v1/';var _0x215820=_0x9b65('0x32')+_0x4b9d6f;var _0xf2a54f={};if(_0x2e2810===_0x9b65('0x33')){_0xf2a54f[_0x9b65('0x34')]={'ssml':_0x3adc02};}else{_0xf2a54f[_0x9b65('0x34')]={'text':_0x3adc02};};_0xf2a54f[_0x9b65('0x35')]={'languageCode':_0x5aabd2,'ssmlGender':_0x1444ab};_0xf2a54f[_0x9b65('0x36')]={'audioEncoding':_0x9b65('0x37'),'sampleRateHertz':0x1f40};var _0x331e3d={'url':_0x2cceb7+_0x9b65('0x38')+_0x215820,'method':_0x9b65('0x39'),'json':!![],'body':_0xf2a54f};return rp(_0x331e3d)[_0x9b65('0x2d')](function(_0xbed7ef){return new BPromise(function(_0x5d6d3f,_0x45ed1c){_0x55b619=path[_0x9b65('0x28')](__dirname,_0x9b65('0x29'),rs['generate'](0x4)+_0x9b65('0x3a'));var _0xd7e4d=Buffer[_0x9b65('0x3b')](_0xbed7ef[_0x9b65('0x3c')],_0x9b65('0x2c'));return fs['writeFile'](_0x55b619,_0xd7e4d,function(_0x14daaa){_0x45ed1c(_0x14daaa);},function(_0x3032d3){fs[_0x9b65('0x3d')](_0x55b619,_0x9b65('0x2e'));_0x5d6d3f(_0x3032d3);});});})[_0x9b65('0x2d')](function(_0x1cbf73){_0x5e9c62=path[_0x9b65('0x28')](__dirname,'tmp',rs[_0x9b65('0x2a')](0x4)+_0x9b65('0x2b'));return convertFile(_0x55b619,_0x5e9c62);})[_0x9b65('0x2d')](function(){try{fs['unlink'](_0x55b619);fs[_0x9b65('0x3d')](_0x5e9c62,_0x9b65('0x2e'));}catch(_0x1664b7){logger[_0x9b65('0x1b')](_0x1664b7);}logger[_0x9b65('0x26')](_0x9b65('0x3e'),_0x5e9c62[_0x9b65('0x2f')]('.')[0x0]);return _0x5e9c62[_0x9b65('0x2f')]('.')[0x0];});};exports[_0x9b65('0x3f')]=function(_0x5d0d73,_0x1e6793){var _0x48f9f7=_0x9b65('0x40');var _0x5d28cf,_0x6e4045;var _0x517a2d;var _0x2f2e4c={'encoding':_0x9b65('0x41'),'method':_0x9b65('0x39'),'timeout':0x2710,'url':_0x48f9f7,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x9b65('0x42')+encodeURIComponent(JSON[_0x9b65('0x43')]([[['jQ1olc',JSON['stringify']([_0x5d0d73,_0x1e6793||'en',![],'null']),null,'generic']]]))};return rp(_0x2f2e4c)['then'](function(_0x19614a){try{_0x517a2d=eval(_0x19614a[_0x9b65('0x44')](0x5))[0x0][0x2];}catch(_0x599770){throw new Error(_0x9b65('0x45')+_0x19614a[_0x9b65('0x21')]);}if(!_0x517a2d){if(_0x5d0d73[_0x9b65('0x46')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x9b65('0x47')+_0x1e6793+'\x22\x20might\x20not\x20exist');}}try{_0x517a2d=eval(_0x517a2d)[0x0];}catch(_0x5303a4){throw new Error(_0x9b65('0x45')+res[_0x9b65('0x21')]);}const _0x12f6ed=_0x517a2d;_0x5d28cf=path[_0x9b65('0x28')](__dirname,_0x9b65('0x29'),rs[_0x9b65('0x2a')](0x4)+_0x9b65('0x3a'));fs['writeFileSync'](_0x5d28cf,_0x517a2d,{'encoding':_0x9b65('0x2c')});_0x6e4045=path[_0x9b65('0x28')](__dirname,_0x9b65('0x29'),rs[_0x9b65('0x2a')](0x4)+_0x9b65('0x2b'));return convertFile(_0x5d28cf,_0x6e4045);})[_0x9b65('0x2d')](function(){try{fs[_0x9b65('0x1c')](_0x5d28cf);fs['chmodSync'](_0x6e4045,'777');}catch(_0x130554){logger[_0x9b65('0x1b')](_0x130554);}logger['info'](_0x9b65('0x48'),_0x6e4045[_0x9b65('0x2f')]('.')[0x0]);return _0x6e4045['split']('.')[0x0];});};exports[_0x9b65('0x49')]=function(_0x1c52b7,_0x455d95,_0x5d1865){return google[_0x9b65('0x4a')](_0x1c52b7,_0x455d95,_0x5d1865)[_0x9b65('0x2d')](function(_0x5e4642){logger[_0x9b65('0x26')](_0x5e4642[_0x9b65('0x4b')]);return rp(_0x5e4642);})['then'](function(_0x2e5653){var _0x4de9ae='';var _0x4c86e5=0x0;try{fs[_0x9b65('0x1c')](_0x1c52b7);}catch(_0x1c9f7f){logger['error'](_0x1c9f7f);}if(_0x2e5653&&_0x2e5653[_0x9b65('0x4c')]){_0x4de9ae=_0x2e5653[_0x9b65('0x4c')][_0x9b65('0x4d')](function(_0x71e515){return _0x71e515&&_0x71e515[_0x9b65('0x4e')][0x0]&&_0x71e515[_0x9b65('0x4e')][0x0][_0x9b65('0x4f')]?_0x71e515['alternatives'][0x0][_0x9b65('0x4f')]:'';})[_0x9b65('0x50')]('\x0a');_0x4c86e5=_0x2e5653[_0x9b65('0x4c')][_0x9b65('0x4d')](function(_0x1fc3ca){return _0x1fc3ca&&_0x1fc3ca[_0x9b65('0x4e')][0x0]&&_0x1fc3ca[_0x9b65('0x4e')][0x0][_0x9b65('0x51')]?_0x1fc3ca[_0x9b65('0x4e')][0x0][_0x9b65('0x51')]:0x0;})[_0x9b65('0x50')]('\x0a');}logger[_0x9b65('0x26')](_0x9b65('0x52'),_0x4de9ae);logger['info'](_0x9b65('0x53'),_0x4c86e5);return{'transcript':_0x4de9ae,'confidence':_0x4c86e5};})[_0x9b65('0x54')](function(_0x2e9d02){logger[_0x9b65('0x1b')](_0x9b65('0x55'),_0x2e9d02[_0x9b65('0x17')],_0x2e9d02[_0x9b65('0x56')],_0x2e9d02[_0x9b65('0x57')]);});};exports['googleDialogflow']=function(_0x4b9bc0,_0x7b61e6,_0x56b8e2,_0x3ed4a0){var _0x3a26c7=apiai(_0x7b61e6,{'language':_0x3ed4a0||'en'});return _0x3a26c7[_0x9b65('0x58')](_0x56b8e2,{'sessionId':md5(_0x4b9bc0)})[_0x9b65('0x2d')](function(_0x56b0d9){logger['info'](JSON[_0x9b65('0x43')](_0x56b0d9));return{'source':_0x56b0d9['result'][_0x9b65('0x59')],'resolvedQuery':_0x56b0d9[_0x9b65('0x5a')]['resolvedQuery'],'action':_0x56b0d9[_0x9b65('0x5a')]['action'],'actionIncomplete':_0x56b0d9['result'][_0x9b65('0x5b')],'speech':_0x56b0d9['result'][_0x9b65('0x5c')][_0x9b65('0x5d')],'score':_0x56b0d9['result']['score'],'statusCode':_0x56b0d9[_0x9b65('0x5e')]['code'],'endConversation':_0x56b0d9[_0x9b65('0x5a')][_0x9b65('0x5f')][_0x9b65('0x60')]||![],'isFallbackIntent':_0x56b0d9[_0x9b65('0x5a')][_0x9b65('0x5f')][_0x9b65('0x61')]};});};exports['googleDialogflowV2']=function(_0x22abee,_0x21d8ed,_0x545395,_0x4e9c33,_0x1025ad,_0x4756a6){var _0x1f6747=_0x4e9c33[_0x9b65('0x62')](/\\n/g,'\x0a');var _0x163639={'credentials':{'private_key':_0x1f6747,'client_email':_0x545395}};var _0x2c18a9=new dialogflow[(_0x9b65('0x63'))](_0x163639);var _0x33e876=_0x2c18a9[_0x9b65('0x64')](_0x21d8ed,md5(_0x22abee));var _0x4247d3={'session':_0x33e876,'queryInput':{'text':{'text':_0x1025ad,'languageCode':_0x4756a6}}};return _0x2c18a9[_0x9b65('0x65')](_0x4247d3)[_0x9b65('0x2d')](function(_0x130c97){if(_0x130c97&&_0x130c97[_0x9b65('0x46')]){logger[_0x9b65('0x26')]('Dialogflow\x20V2\x20response:',JSON[_0x9b65('0x43')](_0x130c97));var _0x40bbaf=_0x130c97[0x0];if(_0x40bbaf){var _0x46341b={'action':_0x40bbaf[_0x9b65('0x66')][_0x9b65('0x67')],'allRequiredParamsPresent':_0x40bbaf[_0x9b65('0x66')][_0x9b65('0x68')],'endConversation':_0x40bbaf['queryResult'][_0x9b65('0x69')]&&_0x40bbaf[_0x9b65('0x66')][_0x9b65('0x69')][_0x9b65('0x6a')]?_0x40bbaf[_0x9b65('0x66')][_0x9b65('0x69')][_0x9b65('0x6a')][_0x9b65('0x6b')]['boolValue']:![],'fulfillmentText':_0x40bbaf[_0x9b65('0x66')]['fulfillmentText'],'intentName':_0x40bbaf[_0x9b65('0x66')][_0x9b65('0x6c')][_0x9b65('0x56')],'intentDisplayName':_0x40bbaf[_0x9b65('0x66')][_0x9b65('0x6c')]['displayName'],'isFallbackIntent':_0x40bbaf[_0x9b65('0x66')][_0x9b65('0x6c')][_0x9b65('0x6d')],'languageCode':_0x40bbaf['queryResult'][_0x9b65('0x6e')],'queryText':_0x40bbaf[_0x9b65('0x66')][_0x9b65('0x6f')],'responseId':_0x40bbaf[_0x9b65('0x70')],'score':_0x40bbaf[_0x9b65('0x66')][_0x9b65('0x71')],'speech':_0x40bbaf[_0x9b65('0x66')][_0x9b65('0x72')],'providerResponse':JSON[_0x9b65('0x43')](_0x130c97)};return _0x46341b;}}});};exports['tildeASR']=function(_0x40b120,_0x207caa,_0x471df8,_0x25b2cc){return tilde[_0x9b65('0x4a')](_0x40b120,_0x207caa,_0x471df8,_0x25b2cc)[_0x9b65('0x2d')](function(_0xa31943){try{fs[_0x9b65('0x1c')](_0x40b120);}catch(_0x36b65b){logger['error'](_0x36b65b);}logger[_0x9b65('0x26')]('Tilde\x20ASR\x20transcription',_0xa31943[_0x9b65('0x4f')]);logger[_0x9b65('0x26')]('Tilde\x20ASR\x20confidence',_0xa31943[_0x9b65('0x51')]);return _0xa31943;});};exports[_0x9b65('0x73')]=function(_0x380a8f,_0x42acf9,_0x3cdebf,_0x596680,_0x532466,_0x4769c4){var _0xb87422=path['resolve'](__dirname,_0x9b65('0x29'),rs[_0x9b65('0x2a')](0x4)+_0x9b65('0x3a'));var _0x51cca2;return aws[_0x9b65('0x74')](_0x380a8f,_0x42acf9,_0x3cdebf,_0x596680,_0x532466,_0x4769c4,_0xb87422)[_0x9b65('0x2d')](function(){_0x51cca2=path[_0x9b65('0x28')](__dirname,'tmp',rs[_0x9b65('0x2a')](0x4)+_0x9b65('0x2b'));return convertFile(_0xb87422,_0x51cca2);})[_0x9b65('0x2d')](function(){try{fs[_0x9b65('0x1c')](_0xb87422);fs[_0x9b65('0x3d')](_0x51cca2,_0x9b65('0x2e'));}catch(_0x3aa368){logger[_0x9b65('0x1b')](_0x3aa368);}return _0x51cca2['split']('.')[0x0];});};exports['awsLex']=function(_0x46ec8c,_0x3cc46e,_0x153574,_0x2641c6,_0x19ba66,_0xac7cf5){return aws[_0x9b65('0x75')](_0x46ec8c,_0x3cc46e,_0x153574,_0x2641c6,_0x19ba66,_0xac7cf5)[_0x9b65('0x2d')](function(_0x32994c){logger['info'](JSON['stringify'](_0x32994c));return _0x32994c;});};exports[_0x9b65('0x76')]=function(_0x545e3c,_0x72ff5b,_0x41f7c0,_0x46b2aa){var _0x2dfca4=util[_0x9b65('0x77')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x545e3c,encodeURIComponent(_0x72ff5b),_0x41f7c0,_0x46b2aa);var _0x43ab0f=path['resolve'](__dirname,'tmp',rs[_0x9b65('0x2a')](0x4)+_0x9b65('0x3a'));var _0x4a72ba;return downloadFile(_0x2dfca4,_0x43ab0f)[_0x9b65('0x2d')](function(){_0x4a72ba=path[_0x9b65('0x28')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x43ab0f,_0x4a72ba);})[_0x9b65('0x2d')](function(){try{fs[_0x9b65('0x1c')](_0x43ab0f);fs['chmodSync'](_0x4a72ba,_0x9b65('0x2e'));}catch(_0x27f07b){logger[_0x9b65('0x1b')](_0x27f07b);}return _0x4a72ba[_0x9b65('0x2f')]('.')[0x0];});};exports[_0x9b65('0x78')]=function(_0x47e88a,_0xa12557,_0x3bcc67,_0x4932dd){var _0x108a72=util[_0x9b65('0x77')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0xa12557,_0x3bcc67,base64Encode(_0x47e88a),_0x4932dd?util['format'](_0x9b65('0x79'),encodeURIComponent(_0x4932dd)):_0x9b65('0x7a'));return uploadFile(_0x108a72)[_0x9b65('0x2d')](function(_0x5498ae){return querystring['parse'](_0x5498ae);});};exports[_0x9b65('0x7b')]=function(_0x250d66,_0x2feda5){return sestek[_0x9b65('0x7c')](_0x250d66,_0x2feda5)[_0x9b65('0x2d')](function(_0x5a82c5){logger[_0x9b65('0x26')](JSON['stringify'](_0x5a82c5));var _0x437338={'speech':_0x5a82c5['text'],'action':_0x5a82c5[_0x9b65('0x7d')]?_0x5a82c5[_0x9b65('0x7d')][_0x9b65('0x7e')]:undefined,'actiondata':_0x5a82c5[_0x9b65('0x7d')]?_0x5a82c5[_0x9b65('0x7d')][_0x9b65('0x7f')]:undefined};if(_0x5a82c5[_0x9b65('0x7d')]&&_0x5a82c5[_0x9b65('0x7d')][_0x9b65('0x80')]){return base64Decode(_0x5a82c5['channelData'][_0x9b65('0x80')][_0x9b65('0x81')],path[_0x9b65('0x28')](__dirname,_0x9b65('0x29'),rs[_0x9b65('0x2a')](0x4)+_0x9b65('0x2b')))[_0x9b65('0x2d')](function(_0xa785e){_0x437338[_0x9b65('0x82')]=_0xa785e;return _0x437338;});}return _0x437338;});};exports[_0x9b65('0x83')]=function(){return __dirname;}; \ No newline at end of file +var _0x193b=['googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','MP3','text:synthesize','POST','writeFile','chmodSync','then','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','jQ1olc','stringify','null','generic','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','.wav','goggleTTS\x20path','split','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','result','source','resolvedQuery','actionIncomplete','fulfillment','score','status','code','metadata','endConversation','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','action','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','queryText','responseId','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','md5','path','request-promise','randomstring','sox','url','util','./aws','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','host','WHAT_EVER','error','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','end','protocol','get','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','writeFileSync','base64','777','readFileSync','toString'];(function(_0x524fac,_0x28553f){var _0x572f6b=function(_0x573e03){while(--_0x573e03){_0x524fac['push'](_0x524fac['shift']());}};_0x572f6b(++_0x28553f);}(_0x193b,0x169));var _0xb193=function(_0x479978,_0x46ab1e){_0x479978=_0x479978-0x0;var _0x567a9f=_0x193b[_0x479978];return _0x567a9f;};'use strict';var apiai=require(_0xb193('0x0'));var BPromise=require(_0xb193('0x1'));var dialogflow=require(_0xb193('0x2'));var fs=require('fs');var http=require(_0xb193('0x3'));var https=require('https');var md5=require(_0xb193('0x4'));var path=require(_0xb193('0x5'));var querystring=require('querystring');var rp=require(_0xb193('0x6'));var rs=require(_0xb193('0x7'));var sox=require(_0xb193('0x8'));var tts=require('google-tts-api');var urlParse=require(_0xb193('0x9'))['parse'];var util=require(_0xb193('0xa'));var aws=require(_0xb193('0xb'));var google=require('./google');var sestek=require(_0xb193('0xc'));var tilde=require(_0xb193('0xd'));var logger=require(_0xb193('0xe'))(_0xb193('0xf'));var ISPEECH_API=_0xb193('0x10');function downloadFile(_0x1eb799,_0x5632d0){return new BPromise(function(_0x559ebb,_0x30d70e){var _0x1dd7f2=urlParse(_0x1eb799);var _0x2a831f=_0x1dd7f2['protocol']===_0xb193('0x11')?https:http;var _0x2315ab={'host':_0x1dd7f2[_0xb193('0x12')],'path':_0x1dd7f2[_0xb193('0x5')],'headers':{'user-agent':_0xb193('0x13')}};_0x2a831f['get'](_0x2315ab,function(_0x1291aa){if(_0x1291aa['statusCode']!==0xc8){logger[_0xb193('0x14')]('request\x20to\x20'+_0x1eb799+_0xb193('0x15')+_0x1291aa[_0xb193('0x16')]+'\x20('+_0x1291aa[_0xb193('0x17')]+')');_0x30d70e(new Error('request\x20to\x20'+_0x1eb799+_0xb193('0x15')+_0x1291aa['statusCode']+'\x20('+_0x1291aa[_0xb193('0x17')]+')'));return;}var _0x3174dc=fs[_0xb193('0x18')](_0x5632d0);_0x3174dc['on'](_0xb193('0x19'),function(){logger[_0xb193('0x1a')](_0xb193('0x1b'));_0x3174dc[_0xb193('0x1c')](_0x559ebb);});_0x3174dc['on']('error',function(_0x5a963b){fs[_0xb193('0x1d')](_0x5632d0);logger[_0xb193('0x14')](_0xb193('0x1e'),_0x5a963b);_0x30d70e(_0x5a963b);});_0x1291aa['pipe'](_0x3174dc);})['on'](_0xb193('0x14'),function(_0xb928dd){logger['error'](_0xb928dd);_0x30d70e(_0xb928dd);})[_0xb193('0x1f')]();});}function uploadFile(_0x43ebc4){return new BPromise(function(_0xc52c71,_0x5ce60e){var _0xa005e9=urlParse(_0x43ebc4);var _0xdf0463=_0xa005e9[_0xb193('0x20')]===_0xb193('0x11')?https:http;var _0x2ba1dd={'host':_0xa005e9[_0xb193('0x12')],'path':_0xa005e9['path'],'headers':{'user-agent':_0xb193('0x13')}};_0xdf0463[_0xb193('0x21')](_0x2ba1dd,function(_0xa5639d){if(_0xa5639d['statusCode']!==0xc8){_0x5ce60e(new Error('request\x20to\x20'+_0x43ebc4+_0xb193('0x15')+_0xa5639d[_0xb193('0x16')]+'\x20('+_0xa5639d[_0xb193('0x17')]+')'));return;}var _0x515782='';_0xa5639d['on'](_0xb193('0x22'),function(_0x1074f7){_0x515782+=_0x1074f7;});_0xa5639d['on'](_0xb193('0x1f'),function(){_0xc52c71(_0x515782);});})['on'](_0xb193('0x14'),function(_0x44d38a){_0x5ce60e(_0x44d38a);})[_0xb193('0x1f')]();});}function convertFile(_0x2fa009,_0x3f289c){return new BPromise(function(_0x40c4fc,_0x19dfe0){var _0x12d754=sox[_0xb193('0x23')](_0x2fa009,_0x3f289c,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x12d754['on']('error',function(_0x1bdff8){logger[_0xb193('0x14')](_0xb193('0x24'),_0x1bdff8);_0x19dfe0(_0x1bdff8);});_0x12d754['on']('end',function(){logger['info'](_0xb193('0x25'));_0x40c4fc();});_0x12d754[_0xb193('0x26')]();});}function base64Decode(_0x15991e,_0x528fa4){var _0x482cf7=path[_0xb193('0x27')](__dirname,_0xb193('0x28'),rs[_0xb193('0x29')](0x4)+'.wav');fs[_0xb193('0x2a')](_0x482cf7,_0x15991e,_0xb193('0x2b'));return convertFile(_0x482cf7,_0x528fa4)['then'](function(){try{fs[_0xb193('0x1d')](_0x482cf7);fs['chmodSync'](_0x528fa4,_0xb193('0x2c'));}catch(_0x5f0d4a){logger[_0xb193('0x14')](_0x5f0d4a);}return _0x528fa4['split']('.')[0x0];});}function base64Encode(_0x2ff073){var _0x32decb=fs[_0xb193('0x2d')](_0x2ff073);return new Buffer(_0x32decb)[_0xb193('0x2e')]('base64');}exports[_0xb193('0x2f')]=function(_0x257bde,_0x37c7bb,_0x2f7647,_0x3ad791,_0x5e8d4e,_0x26117c){var _0x465c75,_0xf492d8;var _0x3aed6c=_0xb193('0x30');var _0x30c527=_0xb193('0x31')+_0x257bde;var _0x10d508={};if(_0x37c7bb===_0xb193('0x32')){_0x10d508[_0xb193('0x33')]={'ssml':_0x2f7647};}else{_0x10d508[_0xb193('0x33')]={'text':_0x2f7647};};_0x10d508['voice']={'languageCode':_0x3ad791,'ssmlGender':_0x5e8d4e};_0x10d508['audioConfig']={'audioEncoding':_0xb193('0x34'),'sampleRateHertz':0x1f40};var _0x2924be={'url':_0x3aed6c+_0xb193('0x35')+_0x30c527,'method':_0xb193('0x36'),'json':!![],'body':_0x10d508};return rp(_0x2924be)['then'](function(_0x2eb41c){return new BPromise(function(_0xaf4853,_0x1b4ca6){_0x465c75=path[_0xb193('0x27')](__dirname,'tmp',rs[_0xb193('0x29')](0x4)+'.mp3');var _0x1bed07=Buffer['from'](_0x2eb41c['audioContent'],_0xb193('0x2b'));return fs[_0xb193('0x37')](_0x465c75,_0x1bed07,function(_0x93693c){_0x1b4ca6(_0x93693c);},function(_0x5d71ff){fs[_0xb193('0x38')](_0x465c75,_0xb193('0x2c'));_0xaf4853(_0x5d71ff);});});})[_0xb193('0x39')](function(_0x615377){_0xf492d8=path[_0xb193('0x27')](__dirname,'tmp',rs[_0xb193('0x29')](0x4)+'.wav');return convertFile(_0x465c75,_0xf492d8);})[_0xb193('0x39')](function(){try{fs[_0xb193('0x1d')](_0x465c75);fs[_0xb193('0x38')](_0xf492d8,_0xb193('0x2c'));}catch(_0x57321e){logger[_0xb193('0x14')](_0x57321e);}logger['info'](_0xb193('0x3a'),_0xf492d8['split']('.')[0x0]);return _0xf492d8['split']('.')[0x0];});};exports[_0xb193('0x3b')]=function(_0x130e71,_0x55f061){var _0x16c3c0=_0xb193('0x3c');var _0x273ac8,_0x1c61ff;var _0x228bea;var _0x30b38c={'encoding':_0xb193('0x3d'),'method':_0xb193('0x36'),'timeout':0x2710,'url':_0x16c3c0,'headers':{'Content-Type':_0xb193('0x3e')},'body':'f.req='+encodeURIComponent(JSON['stringify']([[[_0xb193('0x3f'),JSON[_0xb193('0x40')]([_0x130e71,_0x55f061||'en',![],_0xb193('0x41')]),null,_0xb193('0x42')]]]))};return rp(_0x30b38c)[_0xb193('0x39')](function(_0x578406){try{_0x228bea=eval(_0x578406['slice'](0x5))[0x0][0x2];}catch(_0x6d4239){throw new Error(_0xb193('0x43')+_0x578406[_0xb193('0x22')]);}if(!_0x228bea){if(_0x130e71[_0xb193('0x44')]>0xc8){throw new Error(_0xb193('0x45'));}else{throw new Error(_0xb193('0x46')+_0x55f061+_0xb193('0x47'));}}try{_0x228bea=eval(_0x228bea)[0x0];}catch(_0x23a11b){throw new Error(_0xb193('0x43')+res[_0xb193('0x22')]);}const _0x5edfe1=_0x228bea;_0x273ac8=path[_0xb193('0x27')](__dirname,_0xb193('0x28'),rs[_0xb193('0x29')](0x4)+_0xb193('0x48'));fs[_0xb193('0x2a')](_0x273ac8,_0x228bea,{'encoding':_0xb193('0x2b')});_0x1c61ff=path[_0xb193('0x27')](__dirname,_0xb193('0x28'),rs['generate'](0x4)+_0xb193('0x49'));return convertFile(_0x273ac8,_0x1c61ff);})[_0xb193('0x39')](function(){try{fs[_0xb193('0x1d')](_0x273ac8);fs[_0xb193('0x38')](_0x1c61ff,'777');}catch(_0x9d266e){logger[_0xb193('0x14')](_0x9d266e);}logger[_0xb193('0x1a')](_0xb193('0x4a'),_0x1c61ff[_0xb193('0x4b')]('.')[0x0]);return _0x1c61ff[_0xb193('0x4b')]('.')[0x0];});};exports['googleASR']=function(_0x338b73,_0x274c29,_0x48a219){return google[_0xb193('0x4c')](_0x338b73,_0x274c29,_0x48a219)['then'](function(_0x498cee){logger[_0xb193('0x1a')](_0x498cee[_0xb193('0x4d')]);return rp(_0x498cee);})[_0xb193('0x39')](function(_0x2be49c){var _0x313254='';var _0x4533de=0x0;try{fs[_0xb193('0x1d')](_0x338b73);}catch(_0x570706){logger[_0xb193('0x14')](_0x570706);}if(_0x2be49c&&_0x2be49c[_0xb193('0x4e')]){_0x313254=_0x2be49c[_0xb193('0x4e')][_0xb193('0x4f')](function(_0x42b9cb){return _0x42b9cb&&_0x42b9cb[_0xb193('0x50')][0x0]&&_0x42b9cb[_0xb193('0x50')][0x0]['transcript']?_0x42b9cb['alternatives'][0x0][_0xb193('0x51')]:'';})[_0xb193('0x52')]('\x0a');_0x4533de=_0x2be49c[_0xb193('0x4e')][_0xb193('0x4f')](function(_0x21c8be){return _0x21c8be&&_0x21c8be[_0xb193('0x50')][0x0]&&_0x21c8be[_0xb193('0x50')][0x0][_0xb193('0x53')]?_0x21c8be['alternatives'][0x0][_0xb193('0x53')]:0x0;})[_0xb193('0x52')]('\x0a');}logger[_0xb193('0x1a')](_0xb193('0x54'),_0x313254);logger[_0xb193('0x1a')](_0xb193('0x55'),_0x4533de);return{'transcript':_0x313254,'confidence':_0x4533de};})[_0xb193('0x56')](function(_0x12e0ba){logger[_0xb193('0x14')](_0xb193('0x57'),_0x12e0ba[_0xb193('0x16')],_0x12e0ba[_0xb193('0x58')],_0x12e0ba[_0xb193('0x59')]);});};exports[_0xb193('0x5a')]=function(_0x5dac62,_0x38b5c7,_0x263f39,_0x1cf65d){var _0x4ed665=apiai(_0x38b5c7,{'language':_0x1cf65d||'en'});return _0x4ed665['textRequest'](_0x263f39,{'sessionId':md5(_0x5dac62)})[_0xb193('0x39')](function(_0x39aaf4){logger[_0xb193('0x1a')](JSON[_0xb193('0x40')](_0x39aaf4));return{'source':_0x39aaf4[_0xb193('0x5b')][_0xb193('0x5c')],'resolvedQuery':_0x39aaf4[_0xb193('0x5b')][_0xb193('0x5d')],'action':_0x39aaf4[_0xb193('0x5b')]['action'],'actionIncomplete':_0x39aaf4[_0xb193('0x5b')][_0xb193('0x5e')],'speech':_0x39aaf4[_0xb193('0x5b')][_0xb193('0x5f')]['speech'],'score':_0x39aaf4['result'][_0xb193('0x60')],'statusCode':_0x39aaf4[_0xb193('0x61')][_0xb193('0x62')],'endConversation':_0x39aaf4[_0xb193('0x5b')][_0xb193('0x63')][_0xb193('0x64')]||![],'isFallbackIntent':_0x39aaf4[_0xb193('0x5b')][_0xb193('0x63')]['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x290ce5,_0x1c41f6,_0x33d77f,_0x1fb460,_0xe89337,_0x3bff26){var _0x746678=_0x1fb460[_0xb193('0x65')](/\\n/g,'\x0a');var _0x4a4a8a={'credentials':{'private_key':_0x746678,'client_email':_0x33d77f}};var _0x5b597f=new dialogflow[(_0xb193('0x66'))](_0x4a4a8a);var _0x4bc97b=_0x5b597f[_0xb193('0x67')](_0x1c41f6,md5(_0x290ce5));var _0x3a14bc={'session':_0x4bc97b,'queryInput':{'text':{'text':_0xe89337,'languageCode':_0x3bff26}}};return _0x5b597f['detectIntent'](_0x3a14bc)['then'](function(_0x2ad69d){if(_0x2ad69d&&_0x2ad69d['length']){logger[_0xb193('0x1a')](_0xb193('0x68'),JSON[_0xb193('0x40')](_0x2ad69d));var _0x2b9508=_0x2ad69d[0x0];if(_0x2b9508){var _0x72897f={'action':_0x2b9508['queryResult'][_0xb193('0x69')],'allRequiredParamsPresent':_0x2b9508[_0xb193('0x6a')]['allRequiredParamsPresent'],'endConversation':_0x2b9508[_0xb193('0x6a')]['diagnosticInfo']&&_0x2b9508[_0xb193('0x6a')][_0xb193('0x6b')][_0xb193('0x6c')]?_0x2b9508[_0xb193('0x6a')][_0xb193('0x6b')]['fields'][_0xb193('0x6d')][_0xb193('0x6e')]:![],'fulfillmentText':_0x2b9508[_0xb193('0x6a')][_0xb193('0x6f')],'intentName':_0x2b9508[_0xb193('0x6a')][_0xb193('0x70')][_0xb193('0x58')],'intentDisplayName':_0x2b9508[_0xb193('0x6a')][_0xb193('0x70')][_0xb193('0x71')],'isFallbackIntent':_0x2b9508[_0xb193('0x6a')]['intent']['isFallback'],'languageCode':_0x2b9508['queryResult']['languageCode'],'queryText':_0x2b9508[_0xb193('0x6a')][_0xb193('0x72')],'responseId':_0x2b9508[_0xb193('0x73')],'score':_0x2b9508[_0xb193('0x6a')]['intentDetectionConfidence'],'speech':_0x2b9508[_0xb193('0x6a')][_0xb193('0x6f')],'providerResponse':JSON['stringify'](_0x2ad69d)};return _0x72897f;}}});};exports[_0xb193('0x74')]=function(_0x4c1d88,_0x8d0ad1,_0x542724,_0x43e95a){return tilde[_0xb193('0x4c')](_0x4c1d88,_0x8d0ad1,_0x542724,_0x43e95a)[_0xb193('0x39')](function(_0x59c765){try{fs['unlink'](_0x4c1d88);}catch(_0x16c88d){logger[_0xb193('0x14')](_0x16c88d);}logger[_0xb193('0x1a')](_0xb193('0x75'),_0x59c765[_0xb193('0x51')]);logger[_0xb193('0x1a')](_0xb193('0x76'),_0x59c765[_0xb193('0x53')]);return _0x59c765;});};exports['awsPolly']=function(_0x4e5ea8,_0x334586,_0x32a91c,_0x5860f6,_0x5a7fbb,_0x41da66){var _0x5cdfef=path['resolve'](__dirname,_0xb193('0x28'),rs['generate'](0x4)+_0xb193('0x48'));var _0x31a1c1;return aws[_0xb193('0x77')](_0x4e5ea8,_0x334586,_0x32a91c,_0x5860f6,_0x5a7fbb,_0x41da66,_0x5cdfef)['then'](function(){_0x31a1c1=path[_0xb193('0x27')](__dirname,_0xb193('0x28'),rs[_0xb193('0x29')](0x4)+_0xb193('0x49'));return convertFile(_0x5cdfef,_0x31a1c1);})[_0xb193('0x39')](function(){try{fs[_0xb193('0x1d')](_0x5cdfef);fs[_0xb193('0x38')](_0x31a1c1,'777');}catch(_0xe9ee61){logger[_0xb193('0x14')](_0xe9ee61);}return _0x31a1c1['split']('.')[0x0];});};exports[_0xb193('0x78')]=function(_0x23cb0f,_0x2d718c,_0x4ba386,_0x98ea9d,_0x1e63fb,_0x11761c){return aws[_0xb193('0x79')](_0x23cb0f,_0x2d718c,_0x4ba386,_0x98ea9d,_0x1e63fb,_0x11761c)['then'](function(_0x283131){logger['info'](JSON[_0xb193('0x40')](_0x283131));return _0x283131;});};exports[_0xb193('0x7a')]=function(_0x470ed8,_0x423aa6,_0x92f5a3,_0x45f5ef){var _0x4c0923=util['format'](_0xb193('0x7b'),ISPEECH_API,_0x470ed8,encodeURIComponent(_0x423aa6),_0x92f5a3,_0x45f5ef);var _0x2a2bdc=path[_0xb193('0x27')](__dirname,'tmp',rs['generate'](0x4)+'.mp3');var _0x2ffef7;return downloadFile(_0x4c0923,_0x2a2bdc)[_0xb193('0x39')](function(){_0x2ffef7=path[_0xb193('0x27')](__dirname,'tmp',rs[_0xb193('0x29')](0x4)+_0xb193('0x49'));return convertFile(_0x2a2bdc,_0x2ffef7);})[_0xb193('0x39')](function(){try{fs[_0xb193('0x1d')](_0x2a2bdc);fs[_0xb193('0x38')](_0x2ffef7,_0xb193('0x2c'));}catch(_0x4b8f84){logger[_0xb193('0x14')](_0x4b8f84);}return _0x2ffef7[_0xb193('0x4b')]('.')[0x0];});};exports['ispeechASR']=function(_0x2796fa,_0x8e9758,_0x47ca62,_0x54225a){var _0x3f33c9=util[_0xb193('0x7c')](_0xb193('0x7d'),ISPEECH_API,_0x8e9758,_0x47ca62,base64Encode(_0x2796fa),_0x54225a?util[_0xb193('0x7c')](_0xb193('0x7e'),encodeURIComponent(_0x54225a)):_0xb193('0x7f'));return uploadFile(_0x3f33c9)[_0xb193('0x39')](function(_0x2bd343){return querystring['parse'](_0x2bd343);});};exports[_0xb193('0x80')]=function(_0x23d2c5,_0x5b10dc){return sestek['nda'](_0x23d2c5,_0x5b10dc)[_0xb193('0x39')](function(_0x44a242){logger[_0xb193('0x1a')](JSON[_0xb193('0x40')](_0x44a242));var _0x4c162e={'speech':_0x44a242['text'],'action':_0x44a242[_0xb193('0x81')]?_0x44a242['channelData'][_0xb193('0x82')]:undefined,'actiondata':_0x44a242['channelData']?_0x44a242[_0xb193('0x81')][_0xb193('0x83')]:undefined};if(_0x44a242[_0xb193('0x81')]&&_0x44a242[_0xb193('0x81')]['AudioFromTts']){return base64Decode(_0x44a242[_0xb193('0x81')][_0xb193('0x84')][_0xb193('0x85')],path['resolve'](__dirname,_0xb193('0x28'),rs[_0xb193('0x29')](0x4)+_0xb193('0x49')))[_0xb193('0x39')](function(_0x350de8){_0x4c162e[_0xb193('0x86')]=_0x350de8;return _0x4c162e;});}return _0x4c162e;});};exports[_0xb193('0x87')]=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 7e16972..c6a6e8d 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 _0x333e=['./nda','exports'];(function(_0x46efd7,_0x43f84d){var _0x5637e4=function(_0x54e078){while(--_0x54e078){_0x46efd7['push'](_0x46efd7['shift']());}};_0x5637e4(++_0x43f84d);}(_0x333e,0x84));var _0xe333=function(_0x2b7e9c,_0x236531){_0x2b7e9c=_0x2b7e9c-0x0;var _0x39ac82=_0x333e[_0x2b7e9c];return _0x39ac82;};var nda=require(_0xe333('0x0'));module[_0xe333('0x1')]={'nda':nda}; \ No newline at end of file +var _0x4b39=['exports','./nda'];(function(_0x503564,_0x55867e){var _0x4be9fd=function(_0x41c543){while(--_0x41c543){_0x503564['push'](_0x503564['shift']());}};_0x4be9fd(++_0x55867e);}(_0x4b39,0x183));var _0x94b3=function(_0x3d1b7d,_0x195c66){_0x3d1b7d=_0x3d1b7d-0x0;var _0x2d3879=_0x4b39[_0x3d1b7d];return _0x2d3879;};var nda=require(_0x94b3('0x0'));module[_0x94b3('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index ddeb461..a45d566 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 _0xfd60=['AudioOutputSettings','audio/wav','custom_action','CustomActionData','stringify','request-promise','url','exports','POST','ndauth_url','/token','password','then','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio'];(function(_0x16eb13,_0x3d592f){var _0x2b6230=function(_0x1f963a){while(--_0x1f963a){_0x16eb13['push'](_0x16eb13['shift']());}};_0x2b6230(++_0x3d592f);}(_0xfd60,0x113));var _0x0fd6=function(_0x3f3bad,_0x193f06){_0x3f3bad=_0x3f3bad-0x0;var _0x4f0801=_0xfd60[_0x3f3bad];return _0x4f0801;};'use strict';var rp=require(_0x0fd6('0x0'));var url=require(_0x0fd6('0x1'));var logger=require('../../../../../config/logger')('agi');module[_0x0fd6('0x2')]=function(_0x1831e5,_0x10e718){var _0xdaf573={'method':_0x0fd6('0x3'),'uri':url['resolve'](_0x10e718[_0x0fd6('0x4')],_0x0fd6('0x5')),'form':{'grant_type':_0x0fd6('0x6'),'username':_0x10e718['username'],'password':_0x10e718[_0x0fd6('0x6')]},'json':!![]};return rp(_0xdaf573)[_0x0fd6('0x7')](function(_0x151510){var _0x1071b1={'method':_0x0fd6('0x3'),'uri':url['resolve'](_0x10e718[_0x0fd6('0x8')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x10e718[_0x0fd6('0x9')]||_0x0fd6('0xa'),'channelId':_0x0fd6('0xb'),'conversation':{'id':_0x1831e5[_0x0fd6('0xc')]},'from':{'id':_0x1831e5[_0x0fd6('0xd')],'name':_0x1831e5[_0x0fd6('0xe')]},'recipient':{'id':_0x1831e5[_0x0fd6('0xf')],'name':_0x1831e5[_0x0fd6('0x10')]},'text':_0x10e718[_0x0fd6('0x11')],'channelData':{}},'headers':{'Authorization':_0x0fd6('0x12')+_0x151510[_0x0fd6('0x13')]},'json':!![]};if(_0x10e718[_0x0fd6('0x14')]){_0x1071b1[_0x0fd6('0x15')][_0x0fd6('0x16')][_0x0fd6('0x17')]=_0x10e718[_0x0fd6('0x14')];}if(_0x10e718[_0x0fd6('0x18')]=='1'){_0x1071b1[_0x0fd6('0x15')][_0x0fd6('0x16')][_0x0fd6('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x0fd6('0x1a')};}if(_0x10e718[_0x0fd6('0x1b')]){_0x1071b1[_0x0fd6('0x15')][_0x0fd6('0x16')]['CustomAction']=_0x10e718[_0x0fd6('0x1b')];if(_0x10e718['custom_action_data']){_0x1071b1[_0x0fd6('0x15')][_0x0fd6('0x16')][_0x0fd6('0x1c')]=_0x10e718['custom_action_data'];}}logger['info'](JSON[_0x0fd6('0x1d')](_0x1071b1));return rp(_0x1071b1);});}; \ No newline at end of file +var _0xa884=['extension','text','access_token','channelData','project','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','body','CustomAction','CustomActionData','custom_action_data','info','stringify','request-promise','../../../../../config/logger','agi','POST','resolve','password','username','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','dnid'];(function(_0x18209f,_0x28f5e1){var _0x24f85d=function(_0x1532a4){while(--_0x1532a4){_0x18209f['push'](_0x18209f['shift']());}};_0x24f85d(++_0x28f5e1);}(_0xa884,0x15f));var _0x4a88=function(_0x6f1a87,_0x5d5bcf){_0x6f1a87=_0x6f1a87-0x0;var _0x2495c7=_0xa884[_0x6f1a87];return _0x2495c7;};'use strict';var rp=require(_0x4a88('0x0'));var url=require('url');var logger=require(_0x4a88('0x1'))(_0x4a88('0x2'));module['exports']=function(_0xd9c729,_0x9f6474){var _0xcabe63={'method':_0x4a88('0x3'),'uri':url[_0x4a88('0x4')](_0x9f6474['ndauth_url'],'/token'),'form':{'grant_type':_0x4a88('0x5'),'username':_0x9f6474[_0x4a88('0x6')],'password':_0x9f6474['password']},'json':!![]};return rp(_0xcabe63)[_0x4a88('0x7')](function(_0x2d0a97){var _0x5a05a1={'method':_0x4a88('0x3'),'uri':url[_0x4a88('0x4')](_0x9f6474['ndassistant_url'],_0x4a88('0x8')),'body':{'type':_0x9f6474[_0x4a88('0x9')]||'message','channelId':_0x4a88('0xa'),'conversation':{'id':_0xd9c729[_0x4a88('0xb')]},'from':{'id':_0xd9c729['callerid'],'name':_0xd9c729['calleridname']},'recipient':{'id':_0xd9c729[_0x4a88('0xc')],'name':_0xd9c729[_0x4a88('0xd')]},'text':_0x9f6474[_0x4a88('0xe')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x2d0a97[_0x4a88('0xf')]},'json':!![]};if(_0x9f6474['project']){_0x5a05a1['body'][_0x4a88('0x10')]['ProjectName']=_0x9f6474[_0x4a88('0x11')];}if(_0x9f6474[_0x4a88('0x12')]=='1'){_0x5a05a1['body']['channelData'][_0x4a88('0x13')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x4a88('0x14')};}if(_0x9f6474[_0x4a88('0x15')]){_0x5a05a1[_0x4a88('0x16')][_0x4a88('0x10')][_0x4a88('0x17')]=_0x9f6474[_0x4a88('0x15')];if(_0x9f6474['custom_action_data']){_0x5a05a1['body'][_0x4a88('0x10')][_0x4a88('0x18')]=_0x9f6474[_0x4a88('0x19')];}}logger[_0x4a88('0x1a')](JSON[_0x4a88('0x1b')](_0x5a05a1));return rp(_0x5a05a1);});}; \ 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 1bd2efc..1d55d2c 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 _0x2091=['./lib/api'];(function(_0x56fb43,_0x170198){var _0x7816ff=function(_0x11facc){while(--_0x11facc){_0x56fb43['push'](_0x56fb43['shift']());}};_0x7816ff(++_0x170198);}(_0x2091,0x1cc));var _0x1209=function(_0x54b3bc,_0x1880ea){_0x54b3bc=_0x54b3bc-0x0;var _0x38a050=_0x2091[_0x54b3bc];return _0x38a050;};'use strict';var asr=require(_0x1209('0x0'));module['exports']=function(_0x4279d0,_0x1b8d19,_0x3cd653,_0x35f942){return asr(_0x4279d0,_0x1b8d19,_0x3cd653,_0x35f942);}; \ No newline at end of file +var _0xf9d2=['./lib/api'];(function(_0x405836,_0x6958e4){var _0xa0b7db=function(_0x2f3c1f){while(--_0x2f3c1f){_0x405836['push'](_0x405836['shift']());}};_0xa0b7db(++_0x6958e4);}(_0xf9d2,0x17c));var _0x2f9d=function(_0x1df1b3,_0x16b8c6){_0x1df1b3=_0x1df1b3-0x0;var _0x368ac6=_0xf9d2[_0x1df1b3];return _0x368ac6;};'use strict';var asr=require(_0x2f9d('0x0'));module['exports']=function(_0x2fefaf,_0x26eff9,_0x2daf3f,_0x29cef3){return asr(_0x2fefaf,_0x26eff9,_0x2daf3f,_0x29cef3);}; \ 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 b225d8d..b0033f9 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 _0x7e22=['Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','digest','hex','stringify','createReadStream','data','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood'];(function(_0x23c6f2,_0x4e033c){var _0x4c270b=function(_0x4913f0){while(--_0x4913f0){_0x23c6f2['push'](_0x23c6f2['shift']());}};_0x4c270b(++_0x4e033c);}(_0x7e22,0x19c));var _0x27e2=function(_0x36e4e5,_0x147710){_0x36e4e5=_0x36e4e5-0x0;var _0x419ffd=_0x7e22[_0x36e4e5];return _0x419ffd;};'use strict';var BPromise=require(_0x27e2('0x0'));var _=require(_0x27e2('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x27e2('0x2'));var crypto=require('crypto');var logger=require(_0x27e2('0x3'))(_0x27e2('0x4'));module[_0x27e2('0x5')]=function(_0x59be38,_0x1f74fc,_0x6a632c,_0x311cfe){return new BPromise(function(_0x249351,_0x1f4419){logger[_0x27e2('0x6')]('Tilde\x20URI',_0x311cfe||_0x27e2('0x7'));var _0x4e7dac=new WebSocket(_0x311cfe||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x4790c6='';var _0x18f972='0';var _0x263034='1';var _0x4d2759=_0x27e2('0x8');function _0x3792cc(_0x180522){var _0x360014=crypto['createHash']('sha1');_0x360014['update'](_0x180522);return _0x360014[_0x27e2('0x9')](_0x27e2('0xa'));}function _0x2d22a3(){try{logger[_0x27e2('0x6')]('Open\x20Tilde\x20ASR\x20socket');var _0x1d93f3=moment()['unix']();var _0x478d63=_0x3792cc(_0x1d93f3+_0x1f74fc+_0x6a632c);_0x4e7dac['send'](JSON[_0x27e2('0xb')]({'appID':_0x1f74fc,'timestamp':_0x1d93f3,'appKey':_0x478d63}));var _0x2e7049=fs[_0x27e2('0xc')](_0x59be38);_0x2e7049['on'](_0x27e2('0xd'),function(_0x2d98d6){_0x4e7dac[_0x27e2('0xe')](_0x2d98d6);});_0x2e7049['on'](_0x27e2('0xf'),function(){_0x4e7dac[_0x27e2('0xe')](_0x27e2('0x10'));});}catch(_0x362ba9){logger[_0x27e2('0x11')](_0x27e2('0x12'),JSON['stringify'](_0x362ba9));_0x4e7dac[_0x27e2('0x13')]();}}function _0x5e49e8(_0x87ba6f){try{if(_0x87ba6f){var _0x18db09=JSON[_0x27e2('0x14')](_0x87ba6f);switch(_0x18db09[_0x27e2('0x15')]){case 0x0:if(_0x18db09[_0x27e2('0x16')]){if(_0x18db09['result'][_0x27e2('0x17')]){logger[_0x27e2('0x6')](_0x27e2('0x18'),JSON[_0x27e2('0xb')](_0x18db09[_0x27e2('0x16')]['hypotheses']));_0x4790c6=_0x18db09[_0x27e2('0x16')][_0x27e2('0x19')][0x0][_0x27e2('0x1a')];_0x18f972=_0x18db09[_0x27e2('0x16')][_0x27e2('0x19')][0x0][_0x27e2('0x1b')];_0x263034='0';_0x4d2759=_0x27e2('0x1c');_0x4e7dac[_0x27e2('0x13')]();}}break;case 0x1:logger[_0x27e2('0x6')](_0x27e2('0x8'));_0x263034='1';_0x4d2759=_0x27e2('0x8');break;case 0x2:logger[_0x27e2('0x6')](_0x27e2('0x1d'));_0x263034='2';_0x4d2759=_0x27e2('0x1d');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x263034='9';_0x4d2759=_0x27e2('0x1e');break;case 0xa:logger['info'](_0x27e2('0x1f'));_0x263034='10';_0x4d2759='Authentication\x20failed.';break;case 0xb:logger[_0x27e2('0x6')](_0x27e2('0x20'));_0x263034='11';_0x4d2759=_0x27e2('0x20');}}}catch(_0x399c3a){logger[_0x27e2('0x11')](_0x27e2('0x21'),JSON[_0x27e2('0xb')](_0x399c3a));_0x4e7dac[_0x27e2('0x13')]();}}function _0x34c99d(){logger[_0x27e2('0x6')](_0x27e2('0x22'));_0x249351({'transcript':_0x4790c6,'confidence':_0x18f972,'status':_0x263034,'status_message':_0x4d2759});}function _0x53af6c(_0x1efa77){logger[_0x27e2('0x11')](_0x27e2('0x23'));if(!_[_0x27e2('0x24')](_0x1efa77)){logger[_0x27e2('0x11')](_[_0x27e2('0x25')](_0x1efa77)?JSON[_0x27e2('0xb')](_0x1efa77):_0x1efa77);}}_0x4e7dac['on'](_0x27e2('0x26'),_0x2d22a3);_0x4e7dac['on'](_0x27e2('0x27'),_0x5e49e8);_0x4e7dac['on'](_0x27e2('0xf'),_0x34c99d);_0x4e7dac['on']('error',_0x53af6c);});}; \ No newline at end of file +var _0x3f54=['unix','send','createReadStream','data','close','EOS','error','terminate','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','stringify','isNil','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','hex'];(function(_0x349b97,_0x151f26){var _0x28ae6c=function(_0x34e4c2){while(--_0x34e4c2){_0x349b97['push'](_0x349b97['shift']());}};_0x28ae6c(++_0x151f26);}(_0x3f54,0xf4));var _0x43f5=function(_0x11ba46,_0x1d6752){_0x11ba46=_0x11ba46-0x0;var _0x1c8c6f=_0x3f54[_0x11ba46];return _0x1c8c6f;};'use strict';var BPromise=require(_0x43f5('0x0'));var _=require(_0x43f5('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x43f5('0x2'));var crypto=require(_0x43f5('0x3'));var logger=require(_0x43f5('0x4'))(_0x43f5('0x5'));module[_0x43f5('0x6')]=function(_0x7c6e03,_0x51cb02,_0x110c75,_0x1b2271){return new BPromise(function(_0x4338b2,_0x57dca9){logger[_0x43f5('0x7')](_0x43f5('0x8'),_0x1b2271||_0x43f5('0x9'));var _0x14be42=new WebSocket(_0x1b2271||_0x43f5('0x9'),{'perMessageDeflate':![]});var _0x3207f4='';var _0x27c8fd='0';var _0x2ef9d6='1';var _0x19717e=_0x43f5('0xa');function _0x5b9f25(_0x3d526e){var _0x85c17=crypto[_0x43f5('0xb')](_0x43f5('0xc'));_0x85c17[_0x43f5('0xd')](_0x3d526e);return _0x85c17['digest'](_0x43f5('0xe'));}function _0x5dbb8c(){try{logger[_0x43f5('0x7')]('Open\x20Tilde\x20ASR\x20socket');var _0x397f92=moment()[_0x43f5('0xf')]();var _0x59f97d=_0x5b9f25(_0x397f92+_0x51cb02+_0x110c75);_0x14be42[_0x43f5('0x10')](JSON['stringify']({'appID':_0x51cb02,'timestamp':_0x397f92,'appKey':_0x59f97d}));var _0x186922=fs[_0x43f5('0x11')](_0x7c6e03);_0x186922['on'](_0x43f5('0x12'),function(_0x334df4){_0x14be42[_0x43f5('0x10')](_0x334df4);});_0x186922['on'](_0x43f5('0x13'),function(){_0x14be42[_0x43f5('0x10')](_0x43f5('0x14'));});}catch(_0x2ebe90){logger[_0x43f5('0x15')]('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x2ebe90));_0x14be42[_0x43f5('0x16')]();}}function _0x28e90f(_0x351a0a){try{if(_0x351a0a){var _0x4fd8fe=JSON['parse'](_0x351a0a);switch(_0x4fd8fe['status']){case 0x0:if(_0x4fd8fe[_0x43f5('0x17')]){if(_0x4fd8fe[_0x43f5('0x17')][_0x43f5('0x18')]){logger[_0x43f5('0x7')](_0x43f5('0x19'),JSON['stringify'](_0x4fd8fe['result'][_0x43f5('0x1a')]));_0x3207f4=_0x4fd8fe[_0x43f5('0x17')][_0x43f5('0x1a')][0x0]['transcript'];_0x27c8fd=_0x4fd8fe[_0x43f5('0x17')][_0x43f5('0x1a')][0x0]['likelihood'];_0x2ef9d6='0';_0x19717e=_0x43f5('0x1b');_0x14be42[_0x43f5('0x16')]();}}break;case 0x1:logger['info'](_0x43f5('0xa'));_0x2ef9d6='1';_0x19717e=_0x43f5('0xa');break;case 0x2:logger[_0x43f5('0x7')](_0x43f5('0x1c'));_0x2ef9d6='2';_0x19717e=_0x43f5('0x1c');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x2ef9d6='9';_0x19717e=_0x43f5('0x1d');break;case 0xa:logger[_0x43f5('0x7')](_0x43f5('0x1e'));_0x2ef9d6='10';_0x19717e=_0x43f5('0x1e');break;case 0xb:logger[_0x43f5('0x7')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x2ef9d6='11';_0x19717e=_0x43f5('0x1f');}}}catch(_0x2a45ea){logger[_0x43f5('0x15')](_0x43f5('0x20'),JSON[_0x43f5('0x21')](_0x2a45ea));_0x14be42[_0x43f5('0x16')]();}}function _0x1cf012(){logger[_0x43f5('0x7')]('Close\x20Tilde\x20ASR\x20socket');_0x4338b2({'transcript':_0x3207f4,'confidence':_0x27c8fd,'status':_0x2ef9d6,'status_message':_0x19717e});}function _0x272395(_0x5ff308){logger[_0x43f5('0x15')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x43f5('0x22')](_0x5ff308)){logger['error'](_['isObject'](_0x5ff308)?JSON[_0x43f5('0x21')](_0x5ff308):_0x5ff308);}}_0x14be42['on'](_0x43f5('0x23'),_0x5dbb8c);_0x14be42['on'](_0x43f5('0x24'),_0x28e90f);_0x14be42['on'](_0x43f5('0x13'),_0x1cf012);_0x14be42['on'](_0x43f5('0x15'),_0x272395);});}; \ 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 ea69813..39da148 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 _0x2480=['exports'];(function(_0x2e93d0,_0x5d6526){var _0x2a88a6=function(_0x9bcb0f){while(--_0x9bcb0f){_0x2e93d0['push'](_0x2e93d0['shift']());}};_0x2a88a6(++_0x5d6526);}(_0x2480,0x1c9));var _0x0248=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2480[_0x2dafbe];return _0x58a45a;};var asr=require('./asr');module[_0x0248('0x0')]={'asr':asr}; \ No newline at end of file +var _0xc217=['./asr'];(function(_0x470d22,_0x1b6a4f){var _0x3cc44d=function(_0x4a3749){while(--_0x4a3749){_0x470d22['push'](_0x470d22['shift']());}};_0x3cc44d(++_0x1b6a4f);}(_0xc217,0x15d));var _0x7c21=function(_0x2f57b2,_0xa8e91a){_0x2f57b2=_0x2f57b2-0x0;var _0x5ace77=_0xc217[_0x2f57b2];return _0x5ace77;};var asr=require(_0x7c21('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 261105a..fcc5dcc 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 _0xa73a=['E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','destroy','ready','connection','code','close','E_AGI_SERVER_CLOSE','inherits','exports','net','events','EventEmitter','./error','./channel','127.0.0.1','call','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','emit','E_AGI_SERVER_ERROR'];(function(_0x484cc5,_0x496ea2){var _0x571f71=function(_0x596563){while(--_0x596563){_0x484cc5['push'](_0x484cc5['shift']());}};_0x571f71(++_0x496ea2);}(_0xa73a,0x82));var _0xaa73=function(_0x474e22,_0x5d5515){_0x474e22=_0x474e22-0x0;var _0x76a179=_0xa73a[_0x474e22];return _0x76a179;};'use strict';var util=require('util');var net=require(_0xaa73('0x0'));var EventEmitter=require(_0xaa73('0x1'))[_0xaa73('0x2')];var AGIError=require(_0xaa73('0x3'));var AGIChannel=require(_0xaa73('0x4'));var AGIServer=function(_0x4b1260,_0x479a54,_0x512616){var _0x35025d=this,_0x4b1260=_0x4b1260||0x11dd,_0x479a54=_0x479a54||_0xaa73('0x5'),_0x15d1c6=null,_0xf84c2e=0x0;EventEmitter[_0xaa73('0x6')](_0x35025d);function _0x52dea4(){if(!_0x4b1260){_0x35025d['emit'](_0xaa73('0x7'),new AGIError(_0xaa73('0x8')));return![];}_0x15d1c6=net[_0xaa73('0x9')]();_0x15d1c6[_0xaa73('0xa')](_0x4b1260,_0x479a54);_0x15d1c6['on'](_0xaa73('0xb'),function(){_0x35025d[_0xaa73('0xc')]('listening');});_0x15d1c6['on']('connection',function(_0xe0006a){_0x15d1c6['getConnections'](function(_0x3bd70d,_0x4b53cb){if(_0x3bd70d){_0x35025d[_0xaa73('0xc')](_0xaa73('0x7'),new AGIError(_0xaa73('0xd'),_0x3bd70d));}else if(_0x512616&&_0x512616<0x0){_0x35025d[_0xaa73('0xc')](_0xaa73('0x7'),new AGIError(_0xaa73('0xe')));_0xe0006a['destroy']();}else if(_0x512616&&_0x512616>0x0&&_0x512616<_0x4b53cb){_0xf84c2e+=0x1;_0x35025d[_0xaa73('0xc')](_0xaa73('0x7'),new AGIError(_0xaa73('0xf'),_0xf84c2e));_0xe0006a[_0xaa73('0x10')]();}else{var _0xc4a8e=new AGIChannel(_0xe0006a);_0xc4a8e['on'](_0xaa73('0x11'),function(){_0x35025d[_0xaa73('0xc')](_0xaa73('0x12'),_0xc4a8e);});}});});_0x15d1c6['on'](_0xaa73('0x7'),function(_0x5a4174){_0x35025d[_0xaa73('0xc')]('error',new AGIError(_0xaa73('0xd'),_0x5a4174[_0xaa73('0x13')]));});_0x15d1c6['on'](_0xaa73('0x14'),function(){_0x35025d['emit']('close',new AGIError(_0xaa73('0x15')));});}process['nextTick'](function(){_0x52dea4();});};util[_0xaa73('0x16')](AGIServer,EventEmitter);module[_0xaa73('0x17')]=function(_0x4d97fe,_0x12a8ab,_0x48420a){return new AGIServer(_0x4d97fe,_0x12a8ab,_0x48420a);}; \ No newline at end of file +var _0xca2b=['code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','events','EventEmitter','./error','./channel','127.0.0.1','call','E_AGI_ARGUMENT_PORT','listening','emit','connection','getConnections','error','E_AGI_SERVER_ERROR','destroy','E_AGI_SERVER_MAXCONNECTION','ready'];(function(_0x34f6e2,_0x1d4e94){var _0x43f76f=function(_0xfbdb6c){while(--_0xfbdb6c){_0x34f6e2['push'](_0x34f6e2['shift']());}};_0x43f76f(++_0x1d4e94);}(_0xca2b,0x156));var _0xbca2=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xca2b[_0x13d07a];return _0x5ee0ee;};'use strict';var util=require(_0xbca2('0x0'));var net=require(_0xbca2('0x1'));var EventEmitter=require(_0xbca2('0x2'))[_0xbca2('0x3')];var AGIError=require(_0xbca2('0x4'));var AGIChannel=require(_0xbca2('0x5'));var AGIServer=function(_0x438250,_0x180a93,_0x48a06a){var _0x24af48=this,_0x438250=_0x438250||0x11dd,_0x180a93=_0x180a93||_0xbca2('0x6'),_0x17439f=null,_0x56d486=0x0;EventEmitter[_0xbca2('0x7')](_0x24af48);function _0x226fca(){if(!_0x438250){_0x24af48['emit']('error',new AGIError(_0xbca2('0x8')));return![];}_0x17439f=net['createServer']();_0x17439f['listen'](_0x438250,_0x180a93);_0x17439f['on'](_0xbca2('0x9'),function(){_0x24af48[_0xbca2('0xa')](_0xbca2('0x9'));});_0x17439f['on'](_0xbca2('0xb'),function(_0x1172e8){_0x17439f[_0xbca2('0xc')](function(_0x20759f,_0x3b0f66){if(_0x20759f){_0x24af48[_0xbca2('0xa')](_0xbca2('0xd'),new AGIError(_0xbca2('0xe'),_0x20759f));}else if(_0x48a06a&&_0x48a06a<0x0){_0x24af48[_0xbca2('0xa')](_0xbca2('0xd'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x1172e8[_0xbca2('0xf')]();}else if(_0x48a06a&&_0x48a06a>0x0&&_0x48a06a<_0x3b0f66){_0x56d486+=0x1;_0x24af48[_0xbca2('0xa')](_0xbca2('0xd'),new AGIError(_0xbca2('0x10'),_0x56d486));_0x1172e8[_0xbca2('0xf')]();}else{var _0x170913=new AGIChannel(_0x1172e8);_0x170913['on'](_0xbca2('0x11'),function(){_0x24af48[_0xbca2('0xa')](_0xbca2('0xb'),_0x170913);});}});});_0x17439f['on']('error',function(_0x4dadaf){_0x24af48[_0xbca2('0xa')](_0xbca2('0xd'),new AGIError('E_AGI_SERVER_ERROR',_0x4dadaf[_0xbca2('0x12')]));});_0x17439f['on'](_0xbca2('0x13'),function(){_0x24af48[_0xbca2('0xa')]('close',new AGIError(_0xbca2('0x14')));});}process[_0xbca2('0x15')](function(){_0x226fca();});};util[_0xbca2('0x16')](AGIServer,EventEmitter);module[_0xbca2('0x17')]=function(_0x22445a,_0x479b1f,_0x595030){return new AGIServer(_0x22445a,_0x479b1f,_0x595030);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 27dc25f..678539f 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 _0xfb89=['Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','phone','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','variable_id','getData','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\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','.wav','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','message','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','beep','NOBEEP','recordFile','intKey','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','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','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','Executed\x20command\x20%s\x20%s','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','record','recordingFormat','%s_%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','port','secure','authentication','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','system','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','join','exports','util','lodash','shelljs','odbc','randomstring','mustache','request-promise','agi','../../config/environment','./scripts','rawHeaders','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','catch','getVoiceQueueById','then','name','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','isNil','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','LOCAL','shellCommand','exec','trim','googleCloudTTS','apiKey','text','languageCode','en-US','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','POST','PUT','toUpperCase','body','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','sync','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','replace','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2'];(function(_0x127266,_0x520df0){var _0x7c0e4=function(_0x184c52){while(--_0x184c52){_0x127266['push'](_0x127266['shift']());}};_0x7c0e4(++_0x520df0);}(_0xfb89,0xe9));var _0x9fb8=function(_0x49aa7d,_0x5d46d8){_0x49aa7d=_0x49aa7d-0x0;var _0xdd0d26=_0xfb89[_0x49aa7d];return _0xdd0d26;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x9fb8('0x0'));var _=require(_0x9fb8('0x1'));var sh=require(_0x9fb8('0x2'));var odbc=require(_0x9fb8('0x3'))();var rs=require(_0x9fb8('0x4'));var moment=require('moment');var Mustache=require(_0x9fb8('0x5'));var rp=require(_0x9fb8('0x6'));var logger=require('../../config/logger')(_0x9fb8('0x7'));var config=require(_0x9fb8('0x8'));var scripts=require(_0x9fb8('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x9fb8('0xa'),'rawBody'];var verticesWithRetry=[_0x9fb8('0xb'),_0x9fb8('0xc'),_0x9fb8('0xd')];var AGIVertices=function(_0x430f01,_0x5586d9,_0x108365){this[_0x9fb8('0xe')]=_0x430f01;this[_0x9fb8('0xf')]=_0x5586d9;this[_0x9fb8('0x10')]=_0x108365;};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x12')]=function(_0x4e2232,_0x202d1a){this[_0x9fb8('0xf')][_0x9fb8('0x13')](_0x4e2232)['then'](function(_0x47470e){_0x202d1a(null,_0x47470e?_0x47470e['name']:![]);})[_0x9fb8('0x14')](function(_0x28ad61){_0x202d1a(_0x28ad61);});};AGIVertices[_0x9fb8('0x11')]['getVoiceQueue']=function(_0x582508,_0x5d4497){this[_0x9fb8('0xf')][_0x9fb8('0x15')](_0x582508)[_0x9fb8('0x16')](function(_0x20788c){_0x5d4497(null,_0x20788c?_0x20788c[_0x9fb8('0x17')]:![]);})['catch'](function(_0x323396){_0x5d4497(_0x323396);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x18')]=function(_0x2f432f,_0x321187){this['rpc'][_0x9fb8('0x19')](_0x2f432f)[_0x9fb8('0x16')](function(_0x8ed023){_0x321187(null,_0x8ed023?_0x8ed023[_0x9fb8('0x17')]:![]);})[_0x9fb8('0x14')](function(_0x3abb56){_0x321187(_0x3abb56);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x1a')]=function(_0x3eb8cf,_0x9245bc){this[_0x9fb8('0xf')][_0x9fb8('0x1b')](_0x3eb8cf)[_0x9fb8('0x16')](function(_0x3952bf){_0x9245bc(null,_0x3952bf?_0x3952bf[_0x9fb8('0x1c')]:![]);})[_0x9fb8('0x14')](function(_0x284a6c){_0x9245bc(_0x284a6c);});};AGIVertices[_0x9fb8('0x11')]['getUser']=function(_0x544ac8,_0x5ef5f6){this[_0x9fb8('0xf')][_0x9fb8('0x1d')](_0x544ac8)[_0x9fb8('0x16')](function(_0x3506d6){_0x5ef5f6(null,_0x3506d6?_0x3506d6[_0x9fb8('0x17')]:![]);})[_0x9fb8('0x14')](function(_0x35cc1c){_0x5ef5f6(_0x35cc1c);});};AGIVertices['prototype'][_0x9fb8('0x1e')]=function(_0x4969e6,_0x286b48){this[_0x9fb8('0xf')][_0x9fb8('0x1f')](_0x4969e6)[_0x9fb8('0x16')](function(_0x22d639){_0x286b48(null,_0x22d639?_0x22d639[_0x9fb8('0x17')]:![]);})[_0x9fb8('0x14')](function(_0x341e3d){_0x286b48(_0x341e3d);});};AGIVertices[_0x9fb8('0x11')]['getSound']=function(_0x23b5d2,_0x1b7210){var _0xdeb8b1=this;this[_0x9fb8('0xf')][_0x9fb8('0x20')](_0x23b5d2)['then'](function(_0x5056dc){_0x1b7210(null,_0x5056dc?_0xdeb8b1[_0x9fb8('0x21')](_0x5056dc[_0x9fb8('0x22')]):![]);})[_0x9fb8('0x14')](function(_0x21dcd7){_0x1b7210(_0x21dcd7);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x23')]=function(_0x194d9f,_0x3658b5){this[_0x9fb8('0xf')][_0x9fb8('0x24')](_0x194d9f)[_0x9fb8('0x16')](function(_0x4f3983){_0x3658b5(null,_0x4f3983?_0x4f3983:![]);})[_0x9fb8('0x14')](function(_0x25c583){_0x3658b5(_0x25c583);});};AGIVertices[_0x9fb8('0x11')]['sendMailMessage']=function(_0x210ba6,_0x4719f1,_0x5cc81d){this['mailRpc'][_0x9fb8('0x25')](_0x210ba6,_0x4719f1)[_0x9fb8('0x16')](function(){_0x5cc81d(null);})[_0x9fb8('0x14')](function(_0x79fca5){_0x5cc81d(_0x79fca5);});};AGIVertices['prototype'][_0x9fb8('0x26')]=function(_0x350366,_0x1e6e99){this[_0x9fb8('0xf')][_0x9fb8('0x27')](_0x350366)[_0x9fb8('0x16')](function(_0x1acd6d){if(_0x1acd6d){if(_0x1acd6d[_0x9fb8('0x28')]){_0x1e6e99(null,[_0x1acd6d[_0x9fb8('0x29')]]);}else{_0x1e6e99(null,_[_0x9fb8('0x2a')](_0x1acd6d[_0x9fb8('0x2b')],_0x9fb8('0x29')));}}else{_0x1e6e99(null,![]);}})[_0x9fb8('0x14')](function(_0x25c4bc){_0x1e6e99(_0x25c4bc);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x21')]=function(_0x1863bd){return util[_0x9fb8('0x2c')](_0x9fb8('0x2d'),FILES_PATH,_0x1863bd);};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x2e')]=function(_0x47b282,_0x32f872,_0x3f59d4){odbc[_0x9fb8('0x2f')](_0x47b282,function(_0x35c1c0){if(_0x35c1c0){logger['error'](_0x9fb8('0x30'),_0x35c1c0);_0x3f59d4(_0x35c1c0);}else{logger[_0x9fb8('0x31')]('ODBC\x20connection\x20successfully');odbc[_0x9fb8('0x32')](_0x32f872,function(_0x12bd96,_0x1f54be){if(_0x12bd96){logger[_0x9fb8('0x31')](_0x9fb8('0x33'),_0x32f872);_0x3f59d4(_0x12bd96);}else{logger['info'](_0x9fb8('0x34'),_0x32f872);odbc[_0x9fb8('0x35')](function(_0x538729){if(_0x538729){logger[_0x9fb8('0x36')](_0x9fb8('0x37'),_0x538729);}_0x3f59d4(null,_0x1f54be);});}});}});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x38')]=function(_0x559568,_0x4ded54){this['rpc'][_0x9fb8('0x39')](_0x559568)[_0x9fb8('0x16')](function(_0x421d8c){_0x4ded54(null,_0x421d8c?_0x421d8c:![]);})[_0x9fb8('0x14')](function(_0x1a6d90){_0x4ded54(_0x1a6d90);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x3a')]=function(_0x5b759e,_0x9390b9){this[_0x9fb8('0xf')][_0x9fb8('0x3a')](_0x5b759e)[_0x9fb8('0x16')](function(_0x557e23){_0x9390b9(null,_0x557e23);})['catch'](function(_0x2b5af7){_0x9390b9(_0x2b5af7);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x3b')]=function(_0x55d884,_0xae1e39,_0x277366){this['rpc'][_0x9fb8('0x3b')]({'uniqueid':this[_0x9fb8('0xe')][_0x9fb8('0x3c')],'node':_0x55d884[_0x9fb8('0x3d')],'application':_0x55d884[_0x9fb8('0x3e')],'data':_0xae1e39||null,'project_name':this[_0x9fb8('0xe')][_0x9fb8('0x3f')],'callerid':this[_0x9fb8('0xe')][_0x9fb8('0x40')]})[_0x9fb8('0x16')](function(_0x2fcbf9){if(_0x277366){_0x277366(null,_0x2fcbf9);}})[_0x9fb8('0x14')](function(_0x1cf4a){if(_0x277366){_0x277366(_0x1cf4a);}});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x41')]=function(_0x3bd70f,_0x1d0209,_0x3c4a19,_0x4d63ac){this[_0x9fb8('0xf')][_0x9fb8('0x41')]({'uniqueid':this[_0x9fb8('0xe')]['uniqueid'],'callerid':this[_0x9fb8('0xe')][_0x9fb8('0x40')],'calleridname':this[_0x9fb8('0xe')][_0x9fb8('0x42')],'context':this[_0x9fb8('0xe')][_0x9fb8('0x43')],'extension':this['channel'][_0x9fb8('0x44')],'priority':this[_0x9fb8('0xe')]['priority'],'accountcode':this[_0x9fb8('0xe')][_0x9fb8('0x45')],'dnid':this[_0x9fb8('0xe')][_0x9fb8('0x46')],'projectName':this[_0x9fb8('0xe')][_0x9fb8('0x3f')],'saveName':_0x1d0209,'filename':_0x3bd70f[_0x9fb8('0x47')]||_0x1d0209,'savePath':_0x3c4a19})['then'](function(_0x207fdd){_0x4d63ac(null,_0x207fdd);})[_0x9fb8('0x14')](function(_0x31bad2){_0x4d63ac(_0x31bad2);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x48')]=function(_0x507283,_0x32f782,_0x427d05,_0x1cd3c7,_0x59ef9c){this[_0x9fb8('0xf')][_0x9fb8('0x48')]({'uniqueid':this['channel'][_0x9fb8('0x3c')],'body':_0x507283,'direction':_0x32f782,'providerName':_0x427d05,'providerResponse':_0x1cd3c7})[_0x9fb8('0x16')](function(_0x388ed3){if(_0x59ef9c){_0x59ef9c(null,_0x388ed3);}})[_0x9fb8('0x14')](function(_0x5707ff){if(_0x59ef9c){_0x59ef9c(_0x5707ff);}});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x49')]=function(_0x3c455c,_0x10fcb7){this['rpc'][_0x9fb8('0x49')]({'firstName':_[_0x9fb8('0x4a')](_0x3c455c[_0x9fb8('0x17')])||_['isNil'](_0x3c455c['name'])?_0x9fb8('0x4b')+Math[_0x9fb8('0x4c')]():_0x3c455c[_0x9fb8('0x17')],'lastName':_[_0x9fb8('0x4a')](_0x3c455c[_0x9fb8('0x4d')])||_[_0x9fb8('0x4e')](_0x3c455c['lastName'])?null:_0x3c455c['lastName'],'phone':_0x3c455c['phone'],'ListId':_0x3c455c[_0x9fb8('0x4f')],'scheduledat':_0x3c455c[_0x9fb8('0x50')],'callbackUniqueid':this[_0x9fb8('0xe')][_0x9fb8('0x3c')],'tags':'callback','description':_0x9fb8('0x51')+_0x3c455c[_0x9fb8('0x50')][_0x9fb8('0x52')](),'priority':_0x3c455c[_0x9fb8('0x53')]})[_0x9fb8('0x16')](function(_0x479ac0){_0x10fcb7(null,_0x479ac0);})[_0x9fb8('0x14')](function(_0x34327d){_0x10fcb7(_0x34327d);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x54')]=function(_0x1c7590,_0x5ef806){this['rpc']['getPauseById'](_0x1c7590)[_0x9fb8('0x16')](function(_0xc6b66e){_0x5ef806(null,_0xc6b66e?_0xc6b66e[_0x9fb8('0x17')]:![]);})['catch'](function(_0x36c993){_0x5ef806(_0x36c993);});};AGIVertices['prototype'][_0x9fb8('0x55')]=function(_0x4b1a93,_0x5f4843,_0x504585){var _0x326498={'role':_0x9fb8('0x56')};_0x326498[_0x4b1a93]=this[_0x9fb8('0xe')]['callerid'];this[_0x9fb8('0xf')]['agentPause'](_0x326498,_0x5f4843,this[_0x9fb8('0xe')]['uniqueid'])[_0x9fb8('0x16')](function(_0x59adce){_0x504585(null,_[_0x9fb8('0x4e')](_0x59adce)?![]:!![]);})['catch'](function(_0x5c5f88){logger[_0x9fb8('0x36')](_0x5c5f88);_0x504585(null,![]);});};AGIVertices['prototype'][_0x9fb8('0x57')]=function(_0x537546,_0x3b2fba){var _0x3a0a3b={'role':'agent'};_0x3a0a3b[_0x537546]=this[_0x9fb8('0xe')][_0x9fb8('0x40')];this[_0x9fb8('0xf')]['agentUnpause'](_0x3a0a3b)[_0x9fb8('0x16')](function(_0x4f7de8){_0x3b2fba(null,_['isNil'](_0x4f7de8)?![]:!![]);})[_0x9fb8('0x14')](function(_0x20ce6a){logger[_0x9fb8('0x36')](_0x20ce6a);_0x3b2fba(null,![]);});};AGIVertices['prototype'][_0x9fb8('0x58')]=function(_0xcc8bb2,_0x218b8){var _0x8f4b30={'role':_0x9fb8('0x56')};_0x8f4b30[_0xcc8bb2]=this[_0x9fb8('0xe')][_0x9fb8('0x40')];this['rpc'][_0x9fb8('0x58')](_0x8f4b30)[_0x9fb8('0x16')](function(_0x28d2fd){_0x218b8(null,_['isNil'](_0x28d2fd)?![]:!![]);})[_0x9fb8('0x14')](function(_0x523bdd){logger[_0x9fb8('0x36')](_0x523bdd);_0x218b8(null,![]);});};AGIVertices['prototype'][_0x9fb8('0x59')]=function(_0x47711f,_0x474035){var _0x58e1d5={'role':'agent'};_0x58e1d5[_0x47711f]=this[_0x9fb8('0xe')][_0x9fb8('0x40')];var _0x179910=_0x47711f!=_0x9fb8('0x5a')?util['format']('%s/%s@from-sip/n',_0x9fb8('0x5b'),this[_0x9fb8('0xe')]['callerid']):undefined;this[_0x9fb8('0xf')][_0x9fb8('0x59')](_0x58e1d5,_0x179910)['then'](function(_0x31bd98){_0x474035(null,_[_0x9fb8('0x4e')](_0x31bd98)?![]:!![]);})[_0x9fb8('0x14')](function(_0x28e040){logger[_0x9fb8('0x36')](_0x28e040);_0x474035(null,![]);});};AGIVertices['prototype'][_0x9fb8('0x5c')]=function(_0x48b813,_0x547a06){sh[_0x9fb8('0x5d')](_[_0x9fb8('0x5e')](_0x48b813),function(_0x5e7482,_0x4fd771){var _0x4b60ac=_0x4fd771['replace'](/(\r\n|\n|\r)/gm,'');_0x547a06(null,_0x4b60ac);});};AGIVertices[_0x9fb8('0x11')]['googleCloudTTS']=function(_0xb8f035,_0xdeafac){scripts[_0x9fb8('0x5f')](_0xb8f035[_0x9fb8('0x60')],_0xb8f035['google_cloud_tts_text_type']||'text',_0xb8f035[_0x9fb8('0x61')],_0xb8f035[_0x9fb8('0x62')]||_0x9fb8('0x63'),_0xb8f035['ssmlGender']||'MALE',_0xb8f035['audioEncoding']||_0x9fb8('0x64'))[_0x9fb8('0x16')](function(_0x8c99ef){_0xdeafac(null,_0x8c99ef);})['catch'](function(_0x2d5bfb){_0xdeafac(_0x2d5bfb);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x65')]=function(_0xd509de,_0x2e1b4c){scripts[_0x9fb8('0x65')](_0xd509de[_0x9fb8('0x61')],_0xd509de[_0x9fb8('0x66')]||'en',0x1)[_0x9fb8('0x16')](function(_0x93d5b8){_0x2e1b4c(null,_0x93d5b8);})[_0x9fb8('0x14')](function(_0x192c87){_0x2e1b4c(_0x192c87);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x67')]=function(_0x10e87f,_0x3d8e34){var _0x55758e={'uri':_0x10e87f[_0x9fb8('0x68')],'method':_0x10e87f[_0x9fb8('0x69')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x10e87f[_0x9fb8('0x6a')])===_0x9fb8('0x6b')&&parseInt(_0x10e87f['timeout'])>=0x1?parseInt(_0x10e87f['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0x9fb8('0x6c'),_0x9fb8('0x6d')],_0x55758e[_0x9fb8('0x69')][_0x9fb8('0x6e')]())){try{_0x55758e[_0x9fb8('0x6f')]=_0x10e87f[_0x9fb8('0x70')]?JSON[_0x9fb8('0x71')](_0x10e87f[_0x9fb8('0x70')]):{};}catch(_0x116f18){logger[_0x9fb8('0x36')](_0x9fb8('0x72'),_0x116f18);}}try{_0x55758e['headers']=_0x10e87f[_0x9fb8('0xa')]?JSON['parse'](_0x10e87f['rawHeaders']):{};}catch(_0x870ad8){logger['error'](_0x9fb8('0x73'),_0x870ad8);}if(_0x10e87f['computedVariables']){try{var _0x1ac398=require(_0x10e87f[_0x9fb8('0x74')])['sync'](this,_0x55758e);_0x55758e[_0x9fb8('0x75')]=Mustache[_0x9fb8('0x76')](_0x10e87f['url'],_0x1ac398,{},['$$','$$']);if(_0x55758e[_0x9fb8('0x77')]){_0x55758e['headers']=JSON['parse'](Mustache[_0x9fb8('0x76')](JSON[_0x9fb8('0x78')](_0x55758e['headers']),_0x1ac398,{},['$$','$$']));}if(_0x55758e['body']){_0x55758e[_0x9fb8('0x6f')]=JSON[_0x9fb8('0x71')](Mustache[_0x9fb8('0x76')](JSON[_0x9fb8('0x78')](_0x55758e[_0x9fb8('0x6f')]),_0x1ac398,{},['$$','$$']));}}catch(_0x289bde){logger[_0x9fb8('0x36')](_0x9fb8('0x79'),_0x289bde);}}rp(_0x55758e)[_0x9fb8('0x16')](function(_0x4cf2e2){var _0x1c587e={'statusCode':_0x4cf2e2[_0x9fb8('0x7a')]||0xc8,'statusMessage':_0x4cf2e2['statusMessage']||'OK','headers':_0x4cf2e2[_0x9fb8('0x77')]||{},'body':_0x4cf2e2['body']||{}};_0x3d8e34(null,_0x1c587e);})[_0x9fb8('0x14')](function(_0x59b343){var _0x2e4fe3={'statusCode':_0x59b343[_0x9fb8('0x7a')]||0x1f4,'statusMessage':_0x59b343['message']||_0x9fb8('0x7b'),'headers':_0x59b343['options'][_0x9fb8('0x77')]||{},'body':_0x59b343[_0x9fb8('0x7c')][_0x9fb8('0x6f')]||{}};_0x3d8e34(null,_0x2e4fe3);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x7d')]=function(_0xb38d09,_0x161483){scripts['googleDialogflow'](this[_0x9fb8('0xe')][_0x9fb8('0x3c')],_0xb38d09[_0x9fb8('0x7e')],_0xb38d09['text'],_0xb38d09['dialogflow_language']||'en')[_0x9fb8('0x16')](function(_0x5afe15){_0x161483(null,_0x5afe15);})[_0x9fb8('0x14')](function(_0x2a7694){_0x161483(_0x2a7694);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x7f')]=function(_0x2f9711,_0x211c57){scripts['googleDialogflowV2'](this[_0x9fb8('0xe')][_0x9fb8('0x3c')],_0x2f9711[_0x9fb8('0x80')],_0x2f9711[_0x9fb8('0x81')],_0x2f9711['private_key'],_0x2f9711['text'],_0x2f9711[_0x9fb8('0x82')]||'en')[_0x9fb8('0x16')](function(_0x352991){_0x211c57(null,_0x352991);})['catch'](function(_0x2e7a96){_0x211c57(_0x2e7a96);});};AGIVertices[_0x9fb8('0x11')]['sestekNDA']=function(_0x5cf794,_0x48a897){scripts[_0x9fb8('0x83')](this['channel'],_0x5cf794)[_0x9fb8('0x16')](function(_0x3e86c9){_0x48a897(null,_0x3e86c9);})['catch'](function(_0x522c58){_0x48a897(_0x522c58);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x84')]=function(_0xb3fc7f,_0xbe13a5){scripts[_0x9fb8('0x84')](_0xb3fc7f['key'],_0xb3fc7f[_0x9fb8('0x61')],_0xb3fc7f[_0x9fb8('0x85')]||_0x9fb8('0x63'),_0xb3fc7f[_0x9fb8('0x86')])[_0x9fb8('0x16')](function(_0x104c6a){_0xbe13a5(null,_0x104c6a);})[_0x9fb8('0x14')](function(_0x4d7e02){_0xbe13a5(_0x4d7e02);});};AGIVertices[_0x9fb8('0x11')]['ispeechASR']=function(_0x4ae09e,_0x7b92f5,_0x5ed0c0){scripts[_0x9fb8('0x87')](_0x7b92f5,_0x4ae09e[_0x9fb8('0x7e')],_0x4ae09e[_0x9fb8('0x88')]||'en-US',this[_0x9fb8('0x89')](_0x4ae09e[_0x9fb8('0x8a')])?_0x4ae09e[_0x9fb8('0x8a')]:undefined)[_0x9fb8('0x16')](function(_0x232834){_0x5ed0c0(null,_0x232834);})['catch'](function(_0x4e57de){_0x5ed0c0(_0x4e57de);});};AGIVertices['prototype']['awsPolly']=function(_0x2d4bbc,_0x35883e){scripts[_0x9fb8('0x8b')](_0x2d4bbc[_0x9fb8('0x8c')],_0x2d4bbc['aws_secret_access_key'],_0x2d4bbc[_0x9fb8('0x8d')],_0x2d4bbc[_0x9fb8('0x8e')]||_0x9fb8('0x8f'),_0x2d4bbc['text'],_0x2d4bbc[_0x9fb8('0x90')]||_0x9fb8('0x61'))[_0x9fb8('0x16')](function(_0x3e8b60){_0x35883e(null,_0x3e8b60);})['catch'](function(_0x33230e){_0x35883e(_0x33230e);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x91')]=function(_0x1925ce,_0x3b79f){scripts[_0x9fb8('0x91')](this[_0x9fb8('0xe')]['uniqueid'],_0x1925ce[_0x9fb8('0x8c')],_0x1925ce[_0x9fb8('0x92')],_0x1925ce[_0x9fb8('0x93')],_0x1925ce[_0x9fb8('0x61')],_0x1925ce[_0x9fb8('0x94')])[_0x9fb8('0x16')](function(_0xbcb0fa){_0x3b79f(null,_0xbcb0fa);})[_0x9fb8('0x14')](function(_0x3f1eda){_0x3b79f(_0x3f1eda);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x95')]=function(_0xc287e9,_0x137e5d,_0x49ef32){scripts[_0x9fb8('0x95')](_0x137e5d,_0xc287e9[_0x9fb8('0x7e')],_0xc287e9['google_asr_language']||_0x9fb8('0x63'))[_0x9fb8('0x16')](function(_0x33c1f2){_0x49ef32(null,_0x33c1f2);})[_0x9fb8('0x14')](function(_0x22655f){_0x49ef32(_0x22655f);});};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x96')]=function(_0xc91ee5,_0x499716,_0x2b4d24){scripts[_0x9fb8('0x96')](_0x499716,_0xc91ee5[_0x9fb8('0x97')],_0xc91ee5[_0x9fb8('0x98')],_0xc91ee5['uri'])[_0x9fb8('0x16')](function(_0x1e13a8){_0x2b4d24(null,_0x1e13a8);})[_0x9fb8('0x14')](function(_0x41e553){_0x2b4d24(_0x41e553);});};AGIVertices[_0x9fb8('0x11')]['clear']=function(_0xd0057b){var _0x119e7c=_[_0x9fb8('0x99')](verticesWithRetry,_0xd0057b['agicommand'])?_0xd0057b:_[_0x9fb8('0x9a')](_0xd0057b);for(var _0x4dc474 in _0x119e7c){if(_0x119e7c[_0x9fb8('0x9b')](_0x4dc474)){if(_0x119e7c[_0x4dc474]&&_[_0x9fb8('0x9c')](_0x119e7c[_0x4dc474])){if(_[_0x9fb8('0x99')](recursiveMapAttributes,_0x4dc474)){_0x119e7c[_0x4dc474]=this[_0x9fb8('0x9d')](_0x119e7c[_0x4dc474]);}else{_0x119e7c[_0x4dc474]=this[_0x9fb8('0x9e')](_0x119e7c[_0x4dc474]);}}}}return _0x119e7c;};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x9f')]=function(_0x11d425){for(var _0x52ec50 in _0x11d425){if(_0x11d425[_0x9fb8('0x9b')](_0x52ec50)){if(_[_0x9fb8('0xa0')](_0x11d425[_0x52ec50])){this['recursiveNodeIndex'](_0x11d425[_0x52ec50]);}else if(_[_0x9fb8('0xa1')](_0x11d425[_0x52ec50])){for(var _0x456d4c=0x0;_0x456d4c<_0x11d425[_0x52ec50][_0x9fb8('0xa2')];_0x456d4c++){this[_0x9fb8('0x9f')](_0x11d425[_0x52ec50][_0x456d4c]);}}else if(_[_0x9fb8('0x9c')](_0x11d425[_0x52ec50])){_0x11d425[_0x52ec50]=this[_0x9fb8('0x9e')](_0x11d425[_0x52ec50]);}}}};AGIVertices['prototype'][_0x9fb8('0xa3')]=function(_0x1357f0,_0x3f8383){for(var _0x45dccf in _0x1357f0){if(_0x1357f0['hasOwnProperty'](_0x45dccf)){if(_['isPlainObject'](_0x1357f0[_0x45dccf])){if(!_[_0x9fb8('0x4a')](_0x1357f0[_0x45dccf])){this[_0x9fb8('0xa3')](_0x1357f0[_0x45dccf],util['format'](_0x9fb8('0xa4'),_0x3f8383,_0x45dccf));}}else if(_[_0x9fb8('0xa1')](_0x1357f0[_0x45dccf])){for(var _0x46e4fa=0x0;_0x46e4fa<_0x1357f0[_0x45dccf][_0x9fb8('0xa2')];_0x46e4fa++){this[_0x9fb8('0xa3')](_0x1357f0[_0x45dccf][_0x46e4fa],util[_0x9fb8('0x2c')](_0x9fb8('0xa4'),_0x3f8383,_0x45dccf+'['+_0x46e4fa+']'));}}else{if(!_[_0x9fb8('0x4e')](_0x1357f0[_0x45dccf])){this[_0x9fb8('0xe')][_0x9fb8('0xa5')](util[_0x9fb8('0x2c')](_0x9fb8('0xa4'),_0x3f8383,_0x45dccf),_0x1357f0[_0x45dccf]);}}}}};AGIVertices['prototype'][_0x9fb8('0x9d')]=function(_0x3cf4a9){try{var _0x154107=JSON['parse'](_0x3cf4a9);this[_0x9fb8('0x9f')](_0x154107);return JSON[_0x9fb8('0x78')](_0x154107);}catch(_0x579281){return this[_0x9fb8('0x9e')](_0x3cf4a9);}};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x9e')]=function(_0x5e2da6){var _0x47b93f=_0x5e2da6['split']('{');for(var _0x990cd5=0x1;_0x990cd5<_0x47b93f[_0x9fb8('0xa2')];_0x990cd5+=0x1){var _0x2e1ccf=_0x47b93f[_0x990cd5][_0x9fb8('0xa6')]('}');if(_0x2e1ccf['length']>0x1){_0x5e2da6=_0x5e2da6[_0x9fb8('0xa7')]('{'+_0x2e1ccf[0x0]+'}',this[_0x9fb8('0xe')][_0x9fb8('0x12')](_0x2e1ccf[0x0])['extra']||_0x2e1ccf[0x0]);}}if(_0x47b93f[_0x9fb8('0xa2')]===0x1){return _0x5e2da6['toString']();}return this[_0x9fb8('0x9e')](_0x5e2da6);};AGIVertices['prototype'][_0x9fb8('0xa8')]=function(_0x294f85,_0xedc456){var _0x210f4e=this[_0x9fb8('0xe')]['getVariable'](_0x294f85);if(_0x210f4e[_0x9fb8('0xa9')]===-0x1){return _0x210f4e;}logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0xaa'),_0xedc456,_0x210f4e[_0x9fb8('0xab')]));return this['channel'][_0x9fb8('0xa5')](_0xedc456,_0x210f4e[_0x9fb8('0xab')]);};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x89')]=function(_0x37d0b3){return _0x37d0b3&&_0x37d0b3!=='0'&&_0x37d0b3!=='-1'&&_0x37d0b3!=='';};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0xac')]=function(_0x58a132){this['createSquareDetailsReport']['sync'](this,_0x58a132,'-');_0x58a132[_0x9fb8('0xad')]=_0x58a132['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0xae')]=function(_0x14b218){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x14b218[_0x9fb8('0x3d')]));if(!this[_0x9fb8('0x89')](_0x14b218[_0x9fb8('0x61')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0xb0'));}var _0x9a1b0='\x22'+_0x14b218[_0x9fb8('0x61')]+'\x22';if(this[_0x9fb8('0x89')](_0x14b218[_0x9fb8('0x7c')])){_0x9a1b0+=','+_0x14b218[_0x9fb8('0x7c')];}var _0x4f68db=this[_0x9fb8('0xe')][_0x9fb8('0x5d')](_0x9fb8('0xb1'),_0x9a1b0);if(_0x4f68db[_0x9fb8('0xa9')]===-0x1){return _0x4f68db;}return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0xb2'),_0x9a1b0));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0xb3')]=function(_0x510d8a){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0xb4'),_0x510d8a[_0x9fb8('0x3d')]));if(!this[_0x9fb8('0x89')](_0x510d8a[_0x9fb8('0xb5')])){return this['channel'][_0x9fb8('0xaf')](_0x9fb8('0xb6'));}var _0x2f5231=_0x510d8a[_0x9fb8('0xb5')];if(this[_0x9fb8('0x89')](_0x510d8a['options'])){_0x2f5231+=','+_0x510d8a[_0x9fb8('0x7c')];}var _0xf56d91=this[_0x9fb8('0xe')][_0x9fb8('0x5d')](_0x9fb8('0xb7'),_0x2f5231);if(_0xf56d91[_0x9fb8('0xa9')]===-0x1){return _0xf56d91;}var _0x56de00=this[_0x9fb8('0xa8')](_0x9fb8('0xb8'),_0x9fb8('0xb9'));if(_0x56de00['result']===-0x1){return _0x56de00;}var _0x1c2fdb=this[_0x9fb8('0xa8')](_0x9fb8('0xba'),_0x9fb8('0xbb'));if(_0x1c2fdb['result']===-0x1){return _0x1c2fdb;}var _0x450993=this['getAndSetVariable'](_0x9fb8('0xbc'),_0x9fb8('0xbd'));if(_0x450993[_0x9fb8('0xa9')]===-0x1){return _0x450993;}return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0xbe'),_0x2f5231));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x7')]=function(_0x407464){logger['info'](util[_0x9fb8('0x2c')](_0x9fb8('0xbf'),_0x407464[_0x9fb8('0x3d')]));return this[_0x9fb8('0xe')][_0x9fb8('0x7')]([_0x407464[_0x9fb8('0xc0')],_0x407464[_0x9fb8('0xc1')]]);};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0xc2')]=function(_0x146c25){logger['info'](util[_0x9fb8('0x2c')](_0x9fb8('0xc3'),_0x146c25[_0x9fb8('0x3d')]));if(this[_0x9fb8('0x89')](_0x146c25[_0x9fb8('0x6a')])){logger['info'](util[_0x9fb8('0x2c')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x146c25[_0x9fb8('0x6a')]));var _0x4383d1=this[_0x9fb8('0xe')]['wait'](_0x146c25[_0x9fb8('0x6a')]);if(_0x4383d1[_0x9fb8('0xa9')]===-0x1){return _0x4383d1;}}return this[_0x9fb8('0xe')][_0x9fb8('0xc2')]();};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0xc4')]=function(_0x49dbcf){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0xc5'),_0x49dbcf['label']));if(!this[_0x9fb8('0x89')](_0x49dbcf[_0x9fb8('0x4f')])){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x49dbcf,_0x9fb8('0xc6'));}_0x49dbcf[_0x9fb8('0x50')]=moment();if(this[_0x9fb8('0x89')](_0x49dbcf['delay'])){_0x49dbcf[_0x9fb8('0x50')]=moment()[_0x9fb8('0xc7')](_0x49dbcf[_0x9fb8('0xc8')],'minutes');}if(!this[_0x9fb8('0x89')](_0x49dbcf['callback_priority'])){_0x49dbcf[_0x9fb8('0x53')]=0x2;}this[_0x9fb8('0x49')][_0x9fb8('0xc9')](this,_0x49dbcf);return this[_0x9fb8('0xe')]['noop'](util[_0x9fb8('0x2c')](_0x9fb8('0xca'),_0x49dbcf['phone'],_0x49dbcf[_0x9fb8('0x4f')],_0x49dbcf[_0x9fb8('0x50')]));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0xcb')]=function(_0x2e3300){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0xcc'),_0x2e3300[_0x9fb8('0x3d')]));var _0x239045=this[_0x9fb8('0xe')][_0x9fb8('0x5d')](_0x2e3300[_0x9fb8('0xcd')],_0x2e3300['options']);if(_0x239045['result']===-0x1){return _0x239045;}return this['channel']['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0x2e3300[_0x9fb8('0xcd')],_0x2e3300[_0x9fb8('0x7c')]));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0xce')]=function(_0x2ac158){logger[_0x9fb8('0x31')](util['format']('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x2ac158[_0x9fb8('0x3d')]));if(!this[_0x9fb8('0x89')](_0x2ac158['text'])){return this[_0x9fb8('0xe')]['noop'](_0x9fb8('0xb0'));}var _0x438b7f='\x22'+_0x2ac158[_0x9fb8('0x61')]+'\x22';if(this[_0x9fb8('0x89')](_0x2ac158['options'])){_0x438b7f+=','+_0x2ac158[_0x9fb8('0x7c')];}var _0x32acb4=this[_0x9fb8('0xe')]['exec']('MRCPSynth',_0x438b7f);if(_0x32acb4[_0x9fb8('0xa9')]===-0x1){return _0x32acb4;}return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0xb2'),_0x438b7f));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0xcf')]=function(_0x5c6259){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0xd0'),_0x5c6259[_0x9fb8('0x3d')]));if(!this['isConfigured'](_0x5c6259['text'])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0xb0'));}var _0x157136='\x22'+_0x5c6259['text']+'\x22';if(this[_0x9fb8('0x89')](_0x5c6259[_0x9fb8('0x7c')])){_0x157136+=','+_0x5c6259[_0x9fb8('0x7c')];}var _0x57181b=this[_0x9fb8('0xe')][_0x9fb8('0x5d')](_0x9fb8('0xb1'),_0x157136);if(_0x57181b[_0x9fb8('0xa9')]===-0x1){return _0x57181b;}return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0xb2'),_0x157136));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0xd1')]=function(_0x530afe){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0xd2'),_0x530afe[_0x9fb8('0x3d')]));if(!this[_0x9fb8('0x89')](_0x530afe[_0x9fb8('0xb5')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0xb6'));}var _0xaf52f7=_0x530afe[_0x9fb8('0xb5')];if(this[_0x9fb8('0x89')](_0x530afe[_0x9fb8('0x7c')])){_0xaf52f7+=','+_0x530afe[_0x9fb8('0x7c')];}var _0x4dba4a=this[_0x9fb8('0xe')][_0x9fb8('0x5d')]('MRCPRecog',_0xaf52f7);if(_0x4dba4a[_0x9fb8('0xa9')]===-0x1){return _0x4dba4a;}var _0x31bea9=this['getAndSetVariable'](_0x9fb8('0xb8'),_0x9fb8('0xd3'));if(_0x31bea9['result']===-0x1){return _0x31bea9;}var _0xc8dfe1=this[_0x9fb8('0xa8')](_0x9fb8('0xba'),_0x9fb8('0xd4'));if(_0xc8dfe1[_0x9fb8('0xa9')]===-0x1){return _0xc8dfe1;}var _0x2b1e08=this[_0x9fb8('0xa8')](_0x9fb8('0xbc'),_0x9fb8('0xd5'));if(_0x2b1e08[_0x9fb8('0xa9')]===-0x1){return _0x2b1e08;}return this['channel'][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0xbe'),_0xaf52f7));};AGIVertices['prototype'][_0x9fb8('0xd6')]=function(_0x4b1b7a){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0xd7'),_0x4b1b7a['label']));if(!this['isConfigured'](_0x4b1b7a['grammar'])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')]('no\x20grammar\x20configured');}var _0x24b592=_0x4b1b7a[_0x9fb8('0xb5')];if(this[_0x9fb8('0x89')](_0x4b1b7a[_0x9fb8('0x7c')])){_0x24b592+=','+_0x4b1b7a[_0x9fb8('0x7c')];}var _0x5883e1=this[_0x9fb8('0xe')][_0x9fb8('0x5d')](_0x9fb8('0xb7'),_0x24b592);if(_0x5883e1[_0x9fb8('0xa9')]===-0x1){return _0x5883e1;}var _0x5afd5a=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x9fb8('0xd8'));if(_0x5afd5a[_0x9fb8('0xa9')]===-0x1){return _0x5afd5a;}var _0x3514c1=this[_0x9fb8('0xa8')]('RECOG_INPUT()',_0x9fb8('0xd9'));if(_0x3514c1[_0x9fb8('0xa9')]===-0x1){return _0x3514c1;}var _0x463b7a=this[_0x9fb8('0xa8')](_0x9fb8('0xbc'),_0x9fb8('0xda'));if(_0x463b7a[_0x9fb8('0xa9')]===-0x1){return _0x463b7a;}return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0xbe'),_0x24b592));};AGIVertices['prototype'][_0x9fb8('0xdb')]=function(_0x1f3cf0){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0xdc'),_0x1f3cf0[_0x9fb8('0x3d')]));if(!this['isConfigured'](_0x1f3cf0[_0x9fb8('0xdd')])){return this['channel'][_0x9fb8('0x36')](_0x1f3cf0,_0x9fb8('0xde'));}var _0x1d3683=this[_0x9fb8('0x1a')][_0x9fb8('0xc9')](this,_0x1f3cf0[_0x9fb8('0xdd')]);if(!_0x1d3683){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x1f3cf0,'no\x20odbc\x20database\x20found');}if(!this[_0x9fb8('0x89')](_0x1f3cf0[_0x9fb8('0x32')])){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x1f3cf0,_0x9fb8('0xdf'));}var _0x3d57b8=_0x1f3cf0['query'][_0x9fb8('0xe0')](/(\r\n|\n|\r)/gm,'\x20');this[_0x9fb8('0xe')]['noop'](util['format'](_0x9fb8('0xe1'),_0x3d57b8));var _0x10cde2=this[_0x9fb8('0x2e')][_0x9fb8('0xc9')](this,_0x1d3683,_0x3d57b8);this['createSquareDetailsReport'][_0x9fb8('0xc9')](this,_0x1f3cf0,_0x3d57b8);if(!this[_0x9fb8('0x89')](_0x1f3cf0['variable_id'])){return this['channel'][_0x9fb8('0xaf')](_0x9fb8('0xe2'));}var _0x105dbb=this[_0x9fb8('0x12')]['sync'](this,_0x1f3cf0['variable_id']);if(!_0x105dbb){return this[_0x9fb8('0xe')]['error'](_0x1f3cf0,_0x9fb8('0xe3'));}var _0x810d2e=this;_0x10cde2['forEach'](function(_0x2ca635,_0x13402a){Object['keys'](_0x2ca635)[_0x9fb8('0xe4')](function(_0x29dcaa){_0x810d2e[_0x9fb8('0xe')][_0x9fb8('0xa5')](util[_0x9fb8('0x2c')]('%s[%s][%s]',_0x105dbb,_0x13402a,_0x29dcaa),_0x2ca635[_0x29dcaa]);});});this[_0x9fb8('0xe')][_0x9fb8('0xa5')](util[_0x9fb8('0x2c')](_0x9fb8('0xe5'),_0x105dbb),_0x10cde2[_0x9fb8('0xa2')]);return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util['format'](_0x9fb8('0xe6'),_0x105dbb));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0xe7')]=function(_0x36b465){logger[_0x9fb8('0xe8')](util[_0x9fb8('0x2c')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x36b465[_0x9fb8('0x3d')]));if(!this[_0x9fb8('0x89')](_0x36b465[_0x9fb8('0xe9')])){return this[_0x9fb8('0xe')]['error'](_0x36b465,_0x9fb8('0xea'));}var _0x353c3a=this[_0x9fb8('0xeb')][_0x9fb8('0xc9')](this,_0x36b465[_0x9fb8('0xe9')]);if(!_0x353c3a){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x36b465,_0x9fb8('0xec'));}var _0x685248=this[_0x9fb8('0xe')][_0x9fb8('0x5d')](_0x9fb8('0xed'),[util['format'](_0x9fb8('0xee'),_0x353c3a),_0x36b465[_0x9fb8('0x6a')],_0x36b465[_0x9fb8('0xef')],_0x36b465[_0x9fb8('0x68')]]);if(_0x685248[_0x9fb8('0xa9')]===-0x1){return _0x685248;}return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0xf0'),_0x9fb8('0xed')));};AGIVertices[_0x9fb8('0x11')]['dialogflow']=function(_0x2fc65c){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0xf1'),_0x2fc65c[_0x9fb8('0x3d')]));if(!this[_0x9fb8('0x89')](_0x2fc65c[_0x9fb8('0x7e')])){return this[_0x9fb8('0xe')]['noop']('no\x20key\x20configured');}if(!this[_0x9fb8('0x89')](_0x2fc65c[_0x9fb8('0x61')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')]('no\x20text\x20configured');}this[_0x9fb8('0xe')][_0x9fb8('0xf2')]=!![];this[_0x9fb8('0x3b')](_0x2fc65c);this[_0x9fb8('0x48')](_0x2fc65c[_0x9fb8('0x61')],'in','','');this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0xf3'),_0x2fc65c[_0x9fb8('0x61')]));var _0x3ead53=this[_0x9fb8('0x7d')][_0x9fb8('0xc9')](this,_0x2fc65c);if(_0x3ead53){for(var _0x3d0d01 in _0x3ead53){if(_0x3ead53['hasOwnProperty'](_0x3d0d01)){this['channel'][_0x9fb8('0xa5')](util[_0x9fb8('0x2c')](_0x9fb8('0xf4'),_0x3d0d01[_0x9fb8('0x6e')]()),_0x3ead53[_0x3d0d01]);}}this['createSquareMessage'](_0x3ead53[_0x9fb8('0xf5')],_0x9fb8('0xf6'),_0x9fb8('0xf7'),'');return this['channel'][_0x9fb8('0xaf')](util['format'](_0x9fb8('0xf8'),_0x3ead53[_0x9fb8('0xf5')]));}return this[_0x9fb8('0xe')]['error'](_0x2fc65c,_0x9fb8('0xf9'));};AGIVertices['prototype'][_0x9fb8('0xfa')]=function(_0x4534ca){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0xfb'),_0x4534ca[_0x9fb8('0x3d')]));if(!this['isConfigured'](_0x4534ca[_0x9fb8('0x80')])){return this['channel'][_0x9fb8('0xaf')](_0x9fb8('0xfc'));}if(!this[_0x9fb8('0x89')](_0x4534ca[_0x9fb8('0x81')])){return this[_0x9fb8('0xe')]['noop'](_0x9fb8('0xfd'));}if(!this[_0x9fb8('0x89')](_0x4534ca[_0x9fb8('0xfe')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0xff'));}if(!this[_0x9fb8('0x89')](_0x4534ca[_0x9fb8('0x82')])){return this[_0x9fb8('0xe')]['noop'](_0x9fb8('0x100'));}if(!this['isConfigured'](_0x4534ca['text'])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')]('no\x20text\x20configured');}this[_0x9fb8('0xe')]['bot']=!![];this[_0x9fb8('0x3b')](_0x4534ca);this[_0x9fb8('0x48')](_0x4534ca[_0x9fb8('0x61')],'in','','');this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util['format'](_0x9fb8('0x101'),_0x4534ca[_0x9fb8('0x61')]));var _0x47dcd3=this[_0x9fb8('0x7f')][_0x9fb8('0xc9')](this,_0x4534ca);if(_0x47dcd3){for(var _0x55eff5 in _0x47dcd3){if(_0x47dcd3['hasOwnProperty'](_0x55eff5)){if(_0x55eff5!=='providerResponse'){this[_0x9fb8('0xe')][_0x9fb8('0xa5')](util['format'](_0x9fb8('0xf4'),_0x55eff5[_0x9fb8('0x6e')]()),_0x47dcd3[_0x55eff5]);}}}this[_0x9fb8('0x48')](_0x47dcd3['speech'],_0x9fb8('0xf6'),_0x9fb8('0xfa'),_0x47dcd3[_0x9fb8('0x102')]);return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0x103'),_0x47dcd3[_0x9fb8('0xf5')]));}return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x4534ca,_0x9fb8('0x104'));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x105')]=function(_0x29a607){logger[_0x9fb8('0x31')](util['format'](_0x9fb8('0x106'),_0x29a607[_0x9fb8('0x3d')]));if(!this[_0x9fb8('0x89')](_0x29a607[_0x9fb8('0x107')])){return this[_0x9fb8('0xe')]['noop'](_0x9fb8('0x108'));}if(!this[_0x9fb8('0x89')](_0x29a607[_0x9fb8('0x109')])){return this[_0x9fb8('0xe')]['noop']('no\x20username\x20configured');}if(!this[_0x9fb8('0x89')](_0x29a607[_0x9fb8('0x10a')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0x10b'));}if(!this[_0x9fb8('0x89')](_0x29a607[_0x9fb8('0x10c')])){return this['channel'][_0x9fb8('0xaf')]('no\x20text\x20configured');}this[_0x9fb8('0xe')][_0x9fb8('0xf2')]=!![];this[_0x9fb8('0x3b')](_0x29a607);this['createSquareMessage'](_0x29a607[_0x9fb8('0x61')],'in','','');this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util['format'](_0x9fb8('0x10d'),_0x29a607[_0x9fb8('0x61')]));var _0x4a588e=this[_0x9fb8('0x83')][_0x9fb8('0xc9')](this,_0x29a607);if(_0x4a588e){for(var _0x542b69 in _0x4a588e){if(_0x4a588e[_0x9fb8('0x9b')](_0x542b69)){this[_0x9fb8('0xe')]['setVariable'](util['format']('SESTEK_NDA_%s',_0x542b69[_0x9fb8('0x6e')]()),_0x4a588e[_0x542b69]);}}this[_0x9fb8('0x48')](_0x4a588e[_0x9fb8('0xf5')],_0x9fb8('0xf6'),_0x9fb8('0x105'),'');if(_0x4a588e['audiofile']){this[_0x9fb8('0xe')]['noop'](util['format'](_0x9fb8('0x10e'),_0x4a588e[_0x9fb8('0x10f')]));var _0x3e9d83=this[_0x9fb8('0xe')]['streamFile'](_0x4a588e[_0x9fb8('0x10f')]);try{fs[_0x9fb8('0x110')](_0x4a588e[_0x9fb8('0x10f')]+'.wav');}catch(_0x27ec04){logger['error'](_0x27ec04);}return _0x3e9d83;}else{return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0x111'),_0x4a588e['speech']));}}return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x29a607,_0x9fb8('0x112'));};AGIVertices[_0x9fb8('0x11')]['end']=function(_0x1733e1){logger[_0x9fb8('0x31')](util['format'](_0x9fb8('0x113'),_0x1733e1[_0x9fb8('0x3d')]));return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0x114'));};AGIVertices[_0x9fb8('0x11')]['ext_dial']=function(_0xd645bc){logger[_0x9fb8('0x31')](util['format'](_0x9fb8('0x115'),_0xd645bc[_0x9fb8('0x3d')]));var _0x56d8f4='';if(_0xd645bc[_0x9fb8('0x116')]){if(!this[_0x9fb8('0x89')](_0xd645bc[_0x9fb8('0x116')])){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0xd645bc,'no\x20trunk\x20selected');}else{var _0x5b07d4=parseInt(_0xd645bc['trunk_id'],0xa);if(isNaN(_0x5b07d4)){_0x56d8f4=_0xd645bc[_0x9fb8('0x116')];}else{_0x56d8f4=this[_0x9fb8('0x1e')][_0x9fb8('0xc9')](this,_0xd645bc[_0x9fb8('0x116')]);if(!_0x56d8f4){return this[_0x9fb8('0xe')]['error'](_0xd645bc,_0x9fb8('0x117'));}}}}else if(_0xd645bc[_0x9fb8('0x118')]){_0x56d8f4=_0xd645bc['trunk_name'];}else{return this[_0x9fb8('0xe')]['error'](_0xd645bc,_0x9fb8('0x119'));}var _0x4a05d0=this[_0x9fb8('0xe')]['exec'](_0x9fb8('0xed'),[util[_0x9fb8('0x2c')]('SIP/%s/%s',_0x56d8f4,_0xd645bc[_0x9fb8('0x11a')]),_0xd645bc['timeout'],_0xd645bc['opts'],_0xd645bc[_0x9fb8('0x68')]]);if(_0x4a05d0[_0x9fb8('0xa9')]===-0x1){return _0x4a05d0;}return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util['format'](_0x9fb8('0xf0'),_0x9fb8('0xed')));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x11b')]=function(_0x2ed134){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x11c'),_0x2ed134[_0x9fb8('0x3d')]));return this[_0x9fb8('0xe')][_0x9fb8('0xaf')]('finally');};AGIVertices['prototype'][_0x9fb8('0xc')]=function(_0x4a26de){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x11d'),_0x4a26de[_0x9fb8('0x3d')]));if(_0x4a26de[_0x9fb8('0xad')]===0x0){return this[_0x9fb8('0xac')](_0x4a26de);}_0x4a26de[_0x9fb8('0xad')]-=0x1;if(!this[_0x9fb8('0x89')](_0x4a26de[_0x9fb8('0x11e')])){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x4a26de,_0x9fb8('0x11f'));}var _0x561f57=this[_0x9fb8('0x120')][_0x9fb8('0xc9')](this,_0x4a26de[_0x9fb8('0x11e')]);if(!_0x561f57){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x4a26de,_0x9fb8('0x121'));}if(!this[_0x9fb8('0x89')](_0x4a26de[_0x9fb8('0x122')])){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x9fb8('0xe2'));}var _0x122f00=this[_0x9fb8('0xe')][_0x9fb8('0x123')](_0x561f57,_0x4a26de['response'],_0x4a26de[_0x9fb8('0x124')]);var _0x30f2c6=_0x122f00[_0x9fb8('0xa9')]?_0x122f00[_0x9fb8('0xa9')][_0x9fb8('0x52')]():'';logger[_0x9fb8('0x31')](_0x9fb8('0x125'),JSON[_0x9fb8('0x78')](_0x122f00));if(_0x122f00['result']===-0x1){this[_0x9fb8('0x3b')][_0x9fb8('0xc9')](this,_0x4a26de,_0x30f2c6);return _0x122f00;}else if(_0x122f00[_0x9fb8('0xab')]===_0x9fb8('0x6a')){_0x122f00[_0x9fb8('0xa9')]=_0x30f2c6[_0x9fb8('0xa2')]>=parseInt(_0x4a26de[_0x9fb8('0x126')])?'x':'i';}else{_0x122f00['result']=_0x30f2c6[_0x9fb8('0xa2')]>=parseInt(_0x4a26de[_0x9fb8('0x126')])&&_0x30f2c6[_0x9fb8('0xa2')]<=parseInt(_0x4a26de[_0x9fb8('0x124')])?'x':'i';}var _0x3e4b05=this[_0x9fb8('0x12')][_0x9fb8('0xc9')](this,_0x4a26de[_0x9fb8('0x122')]);if(!_0x3e4b05){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x4a26de,_0x9fb8('0xe3'));}this[_0x9fb8('0xe')][_0x9fb8('0xa5')](_0x3e4b05,_0x30f2c6);if(this[_0x9fb8('0x89')](_0x4a26de[_0x9fb8('0x127')])){var _0x3af9ac=parseInt(_0x4a26de[_0x9fb8('0x127')],0xa);var _0x3a46fa=rs['generate']({'charset':'*','length':_0x3af9ac});var _0x221f72=_0x30f2c6[_0x9fb8('0xa2')];if(_0x221f72>0x0){if(_0x221f72>_0x3af9ac){this[_0x9fb8('0x3b')]['sync'](this,_0x4a26de,_0x4a26de[_0x9fb8('0x128')]===_0x9fb8('0x129')?_0x3a46fa+_0x30f2c6[_0x9fb8('0x12a')](_0x3af9ac):_0x30f2c6[_0x9fb8('0x12a')](0x0,_0x221f72-_0x3af9ac)+_0x3a46fa);}else{this[_0x9fb8('0x3b')][_0x9fb8('0xc9')](this,_0x4a26de,rs[_0x9fb8('0x12b')]({'charset':'*','length':_0x221f72}));}}else{this['createSquareDetailsReport'][_0x9fb8('0xc9')](this,_0x4a26de,'');}}else{this[_0x9fb8('0x3b')][_0x9fb8('0xc9')](this,_0x4a26de,_0x30f2c6);}return _0x122f00;};AGIVertices['prototype'][_0x9fb8('0xd')]=function(_0x319e02){logger[_0x9fb8('0x31')](util['format'](_0x9fb8('0x12c'),_0x319e02['label']));return this['getdigits'](_0x319e02);};AGIVertices[_0x9fb8('0x11')]['goal']=function(_0x282bde){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x12d'),_0x282bde['label']));this[_0x9fb8('0x3b')][_0x9fb8('0xc9')](this,_0x282bde,_0x282bde[_0x9fb8('0x12e')]);return this['channel'][_0x9fb8('0xaf')](util['format'](_0x9fb8('0x12f'),_0x282bde[_0x9fb8('0x12e')]));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x130')]=function(_0x384775){logger[_0x9fb8('0x31')](util['format'](_0x9fb8('0x131'),_0x384775[_0x9fb8('0x3d')]));if(!this[_0x9fb8('0x89')](_0x384775[_0x9fb8('0x8c')])||!this[_0x9fb8('0x89')](_0x384775[_0x9fb8('0x92')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0x132'));}if(!this[_0x9fb8('0x89')](_0x384775[_0x9fb8('0x61')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0xb0'));}this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')]('Trying\x20aws\x20Polly\x20%s',_0x384775[_0x9fb8('0x61')]));var _0x5da7ef=this[_0x9fb8('0x8b')][_0x9fb8('0xc9')](this,_0x384775);if(_0x5da7ef){this[_0x9fb8('0xe')]['noop'](util[_0x9fb8('0x2c')](_0x9fb8('0x133'),_0x5da7ef));var _0x166cc9=this[_0x9fb8('0xe')][_0x9fb8('0x134')](_0x5da7ef);try{fs[_0x9fb8('0x110')](_0x5da7ef+_0x9fb8('0x135'));}catch(_0x5e344b){logger[_0x9fb8('0x36')](_0x5e344b);}return _0x166cc9;}return this[_0x9fb8('0xe')]['error'](_0x384775,_0x9fb8('0x136'));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x137')]=function(_0x5efb44){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x138'),_0x5efb44[_0x9fb8('0x3d')]));if(!this[_0x9fb8('0x89')](_0x5efb44[_0x9fb8('0x8c')])||!this['isConfigured'](_0x5efb44[_0x9fb8('0x92')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0x132'));}if(!this[_0x9fb8('0x89')](_0x5efb44[_0x9fb8('0x94')])){return this[_0x9fb8('0xe')]['noop'](_0x9fb8('0x139'));}if(!this[_0x9fb8('0x89')](_0x5efb44[_0x9fb8('0x61')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0xb0'));}this[_0x9fb8('0xe')][_0x9fb8('0xf2')]=!![];this[_0x9fb8('0x3b')](_0x5efb44);this[_0x9fb8('0x48')](_0x5efb44[_0x9fb8('0x61')],'in','','');this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0x13a'),_0x5efb44[_0x9fb8('0x61')]));var _0xa650c6=this[_0x9fb8('0x91')]['sync'](this,_0x5efb44);if(_0xa650c6){for(var _0x4a6527 in _0xa650c6){if(_0xa650c6[_0x9fb8('0x9b')](_0x4a6527)&&_[_0x9fb8('0x9c')](_0xa650c6[_0x4a6527])){this[_0x9fb8('0xe')][_0x9fb8('0xa5')](util[_0x9fb8('0x2c')](_0x9fb8('0x13b'),_0x4a6527[_0x9fb8('0x6e')]()),_0xa650c6[_0x4a6527]);}}if(_[_0x9fb8('0x4e')](_0xa650c6['message'])){return this['channel'][_0x9fb8('0xaf')](_0x9fb8('0x13c'));}else{this[_0x9fb8('0x48')](_0xa650c6[_0x9fb8('0x13d')],_0x9fb8('0xf6'),_0x9fb8('0x13e'),'');return this[_0x9fb8('0xe')]['noop'](util[_0x9fb8('0x2c')](_0x9fb8('0x13f'),_0xa650c6['message']));}}return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x5efb44,_0x9fb8('0x140'));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x141')]=function(_0x29f07e){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x142'),_0x29f07e[_0x9fb8('0x3d')],_0x29f07e['timeout']));if(!this['isConfigured'](_0x29f07e[_0x9fb8('0x7e')])){return this[_0x9fb8('0xe')]['noop'](_0x9fb8('0x143'));}var _0x5824a5=_0x9fb8('0x144');var _0x5db766=util[_0x9fb8('0x2c')](_0x9fb8('0x145'),FILES_PATH,rs['generate'](0x4));var _0x5a60a2=util[_0x9fb8('0x2c')]('%s.%s',_0x5db766,_0x5824a5);var _0x5a71d7=!![];if(_0x29f07e[_0x9fb8('0x146')]===_0x9fb8('0x147')){_0x5a71d7=![];}var _0x55f120=this[_0x9fb8('0xe')][_0x9fb8('0x148')](_0x5db766,_0x5824a5,_0x29f07e[_0x9fb8('0x149')],_0x29f07e[_0x9fb8('0x6a')],undefined,_0x5a71d7);if(_0x55f120[_0x9fb8('0xa9')]!==-0x1){this[_0x9fb8('0xe')]['noop'](util[_0x9fb8('0x2c')]('google\x20%s\x20file\x20created',_0x5a60a2));var _0x4fed8c=this['googleASR'][_0x9fb8('0xc9')](this,_0x29f07e,_0x5a60a2);if(_0x4fed8c){for(var _0x382536 in _0x4fed8c){if(_0x4fed8c[_0x9fb8('0x9b')](_0x382536)){this[_0x9fb8('0xe')][_0x9fb8('0xa5')](util[_0x9fb8('0x2c')]('GOOGLE_ASR_%s',_0x382536[_0x9fb8('0x6e')]()),_0x4fed8c[_0x382536]);}}return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util['format'](_0x9fb8('0x14a'),JSON[_0x9fb8('0x78')](_0x4fed8c)));}}return _0x55f120;};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x14b')]=function(_0x41d87f){logger[_0x9fb8('0x31')](util['format'](_0x9fb8('0x14c'),_0x41d87f[_0x9fb8('0x3d')]));if(!this[_0x9fb8('0x89')](_0x41d87f[_0x9fb8('0x97')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0x14d'));}if(!this[_0x9fb8('0x89')](_0x41d87f[_0x9fb8('0x98')])){return this[_0x9fb8('0xe')]['noop'](_0x9fb8('0x14e'));}var _0x4dc6cb=_0x9fb8('0x144');var _0x1ffb61=util[_0x9fb8('0x2c')](_0x9fb8('0x145'),FILES_PATH,rs['generate'](0x4));var _0x241a9d=util['format'](_0x9fb8('0xa4'),_0x1ffb61,_0x4dc6cb);var _0x198c1f=!![];if(_0x41d87f[_0x9fb8('0x146')]===_0x9fb8('0x147')){_0x198c1f=![];}var _0x54032f=this[_0x9fb8('0xe')][_0x9fb8('0x148')](_0x1ffb61,_0x4dc6cb,_0x41d87f['intKey'],_0x41d87f['timeout'],undefined,_0x198c1f);if(_0x54032f[_0x9fb8('0xa9')]!==-0x1){this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util['format'](_0x9fb8('0x14f'),_0x241a9d));var _0xfe0994=this[_0x9fb8('0x96')][_0x9fb8('0xc9')](this,_0x41d87f,_0x241a9d);if(_0xfe0994){for(var _0x2fda8b in _0xfe0994){if(_0xfe0994[_0x9fb8('0x9b')](_0x2fda8b)){this['channel']['setVariable'](util['format'](_0x9fb8('0x150'),_0x2fda8b[_0x9fb8('0x6e')]()),_0xfe0994[_0x2fda8b]);}}return this['channel'][_0x9fb8('0xaf')](util['format'](_0x9fb8('0x151'),JSON[_0x9fb8('0x78')](_0xfe0994)));}}return _0x54032f;};AGIVertices['prototype'][_0x9fb8('0x152')]=function(_0x3b76d3){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x153'),_0x3b76d3['label']));return this[_0x9fb8('0xe')][_0x9fb8('0x154')](_0x3b76d3[_0x9fb8('0x43')],_0x3b76d3[_0x9fb8('0x44')],_0x3b76d3['priority']);};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x155')]=function(_0x788de5){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x156'),_0x788de5[_0x9fb8('0x3d')]));if(!this['isConfigured'](_0x788de5[_0x9fb8('0x157')])){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x788de5,_0x9fb8('0x158'));}try{var _0x5b7108=eval(_0x788de5[_0x9fb8('0x157')])?_0x9fb8('0x159'):_0x9fb8('0x15a');this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util['format'](_0x9fb8('0x15b'),_0x788de5[_0x9fb8('0x157')],_0x5b7108));return{'code':0xc8,'result':_0x5b7108};}catch(_0x417551){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x9fb8('0x11')]['gotoiftime']=function(_0x5348d1){logger['info'](util[_0x9fb8('0x2c')](_0x9fb8('0x15c'),_0x5348d1['label']));if(!this['isConfigured'](_0x5348d1[_0x9fb8('0x15d')])){return this['channel'][_0x9fb8('0x36')](_0x5348d1,'no\x20interval\x20configured');}var _0x1cf48a=this[_0x9fb8('0x26')][_0x9fb8('0xc9')](this,_0x5348d1[_0x9fb8('0x15d')]);if(!_0x1cf48a){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x5348d1,'no\x20intervals\x20found');}for(var _0x51948b=0x0;_0x51948b<_0x1cf48a[_0x9fb8('0xa2')];_0x51948b+=0x1){var _0x1dad6f=this[_0x9fb8('0xe')]['getVariable'](util[_0x9fb8('0x2c')]('IFTIME(%s?true:false)',_0x1cf48a[_0x51948b]));if(_0x1dad6f[_0x9fb8('0xa9')]===-0x1){return _0x1dad6f;}logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x15e'),_0x1cf48a[_0x51948b],_0x1dad6f['extra']));if(_0x1dad6f[_0x9fb8('0xab')]===_0x9fb8('0x159')){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x15e'),_0x1cf48a[_0x51948b],_0x9fb8('0x159')));this['channel']['noop'](util[_0x9fb8('0x2c')](_0x9fb8('0x15e'),_0x1cf48a[_0x51948b],_0x9fb8('0x159')));return{'code':0xc8,'result':_0x9fb8('0x159')};}else{logger['info'](util[_0x9fb8('0x2c')](_0x9fb8('0x15e'),_0x1cf48a[_0x51948b],_0x9fb8('0x15a')));this['channel'][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')]('IFTIME\x20%s\x20%s',_0x1cf48a[_0x51948b],_0x9fb8('0x15a')));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0x9fb8('0x15f')]=function(_0x51de4d){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x160'),_0x51de4d[_0x9fb8('0x3d')]));return this[_0x9fb8('0xe')][_0x9fb8('0x15f')]();};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x161')]=function(_0x487fa1){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x162'),_0x487fa1[_0x9fb8('0x3d')]));if(!this['isConfigured'](_0x487fa1[_0x9fb8('0x7e')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0x143'));}var _0x4bb84d=_0x9fb8('0x144');var _0x3ebed0=util[_0x9fb8('0x2c')]('%s/recordings/%s',FILES_PATH,rs[_0x9fb8('0x12b')](0x4));var _0x4ff215=util[_0x9fb8('0x2c')](_0x9fb8('0xa4'),_0x3ebed0,_0x4bb84d);var _0x53446f=!![];if(_0x487fa1[_0x9fb8('0x146')]===_0x9fb8('0x147')){_0x53446f=![];}var _0x422d74=this[_0x9fb8('0xe')][_0x9fb8('0x148')](_0x3ebed0,_0x4bb84d,_0x487fa1[_0x9fb8('0x149')],_0x487fa1[_0x9fb8('0x6a')],undefined,_0x53446f);if(_0x422d74[_0x9fb8('0xa9')]!==-0x1){this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0x163'),_0x4ff215));var _0x2dd47e=this['ispeechASR']['sync'](this,_0x487fa1,_0x4ff215);if(_0x2dd47e){for(var _0x5289f9 in _0x2dd47e){if(_0x2dd47e['hasOwnProperty'](_0x5289f9)){this['channel'][_0x9fb8('0xa5')](util['format'](_0x9fb8('0x164'),_0x5289f9['toUpperCase']()),_0x2dd47e[_0x5289f9]);}}return this['channel']['noop'](util[_0x9fb8('0x2c')]('IspeechASR\x20Result\x20%s',JSON[_0x9fb8('0x78')](_0x2dd47e)));}}return _0x422d74;};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x165')]=function(_0x6c7102){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x166'),_0x6c7102[_0x9fb8('0x3d')]));if(!this[_0x9fb8('0x89')](_0x6c7102[_0x9fb8('0x7e')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0x143'));}if(!this['isConfigured'](_0x6c7102[_0x9fb8('0x61')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0xb0'));}this['channel'][_0x9fb8('0xaf')](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x6c7102[_0x9fb8('0x61')]));var _0xa218aa=this[_0x9fb8('0x84')][_0x9fb8('0xc9')](this,_0x6c7102);if(_0xa218aa){this['channel'][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')]('ispeech\x20%s\x20file\x20created',_0xa218aa));var _0x15975f=this[_0x9fb8('0xe')][_0x9fb8('0x134')](_0xa218aa,_0x6c7102[_0x9fb8('0x149')]);try{fs['unlink'](_0xa218aa+_0x9fb8('0x135'));}catch(_0x515930){logger[_0x9fb8('0x36')](_0x515930);}return _0x15975f;}return this['channel'][_0x9fb8('0x36')](_0x6c7102,_0x9fb8('0x167'));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x168')]=function(_0x32198d){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x32198d['label']));if(!this[_0x9fb8('0x89')](_0x32198d[_0x9fb8('0x169')])){return this[_0x9fb8('0xe')]['error'](_0x32198d,_0x9fb8('0x16a'));}logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x9fb8('0xe')][_0x9fb8('0x40')],_0x32198d[_0x9fb8('0x169')]));var _0x37ce8c=this['agentLogin'][_0x9fb8('0xc9')](this,_0x32198d[_0x9fb8('0x169')]);if(_0x37ce8c){logger[_0x9fb8('0x31')](util['format'](_0x9fb8('0x16b'),this[_0x9fb8('0xe')][_0x9fb8('0x40')],_0x32198d[_0x9fb8('0x169')]));this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x9fb8('0xe')][_0x9fb8('0x40')],_0x32198d[_0x9fb8('0x169')]));return{'code':0xc8,'result':'success'};}else{logger[_0x9fb8('0x31')](util['format'](_0x9fb8('0x16c'),this[_0x9fb8('0xe')][_0x9fb8('0x40')],_0x32198d['findBy']));this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0x16c'),this[_0x9fb8('0xe')][_0x9fb8('0x40')],_0x32198d[_0x9fb8('0x169')]));return{'code':0xc8,'result':_0x9fb8('0x16d')};}};AGIVertices['prototype'][_0x9fb8('0x16e')]=function(_0x4c1076){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x16f'),_0x4c1076[_0x9fb8('0x3d')]));if(!this[_0x9fb8('0x89')](_0x4c1076[_0x9fb8('0x169')])){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x4c1076,_0x9fb8('0x16a'));}logger['info'](util['format'](_0x9fb8('0x170'),this[_0x9fb8('0xe')][_0x9fb8('0x40')],_0x4c1076['findBy']));var _0x21625e=this[_0x9fb8('0x58')][_0x9fb8('0xc9')](this,_0x4c1076[_0x9fb8('0x169')]);if(_0x21625e){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x16b'),this['channel'][_0x9fb8('0x40')],_0x4c1076[_0x9fb8('0x169')]));this['channel'][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0x16b'),this['channel'][_0x9fb8('0x40')],_0x4c1076[_0x9fb8('0x169')]));return{'code':0xc8,'result':_0x9fb8('0x171')};}else{logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9fb8('0xe')][_0x9fb8('0x40')],_0x4c1076['findBy']));this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9fb8('0xe')][_0x9fb8('0x40')],_0x4c1076[_0x9fb8('0x169')]));return{'code':0xc8,'result':_0x9fb8('0x16d')};}};AGIVertices['prototype'][_0x9fb8('0x172')]=function(_0x120638){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x173'),_0x120638['label']));if(!this[_0x9fb8('0x89')](_0x120638[_0x9fb8('0x174')])){return this['channel']['error'](_0x120638,_0x9fb8('0x175'));}this[_0x9fb8('0xe')]['noop'](util[_0x9fb8('0x2c')](_0x9fb8('0x176'),_0x120638['operation']));var _0x2867c8=eval(_0x120638[_0x9fb8('0x174')]);if(!this[_0x9fb8('0x89')](_0x120638[_0x9fb8('0x122')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0xe2'));}var _0x20c850=this['getVariable'][_0x9fb8('0xc9')](this,_0x120638[_0x9fb8('0x122')]);if(!_0x20c850){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x120638,'no\x20variable\x20found');}if(_[_0x9fb8('0xa1')](_0x2867c8)){var _0x5f4842=this;_0x2867c8[_0x9fb8('0xe4')](function(_0x13da77,_0x36b851){_0x5f4842[_0x9fb8('0xe')][_0x9fb8('0xa5')](util[_0x9fb8('0x2c')](_0x9fb8('0x177'),_0x20c850,_0x36b851),_0x13da77);});return this[_0x9fb8('0xe')]['noop'](util[_0x9fb8('0x2c')](_0x9fb8('0x178'),_0x20c850));}else{return this[_0x9fb8('0xe')][_0x9fb8('0xa5')](_0x20c850,_0x2867c8);}};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0xb')]=function(_0x3a6189){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x179'),_0x3a6189[_0x9fb8('0x3d')]));if(_0x3a6189[_0x9fb8('0xad')]===0x0){return this['maxRetry'](_0x3a6189);}_0x3a6189['retry']-=0x1;if(!this[_0x9fb8('0x89')](_0x3a6189[_0x9fb8('0x11e')])){return this['channel'][_0x9fb8('0x36')](_0x3a6189,_0x9fb8('0x11f'));}var _0x4f48b9=this[_0x9fb8('0x120')]['sync'](this,_0x3a6189[_0x9fb8('0x11e')]);if(!_0x4f48b9){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x3a6189,_0x9fb8('0x121'));}var _0x3d166b=this[_0x9fb8('0xe')]['getData'](_0x4f48b9,_0x3a6189[_0x9fb8('0x17a')],_0x3a6189[_0x9fb8('0x17b')]);var _0x30f265=_0x3d166b[_0x9fb8('0xa9')];if(_0x3d166b[_0x9fb8('0xa9')]===-0x1){this[_0x9fb8('0x3b')][_0x9fb8('0xc9')](this,_0x3a6189,'-1');return _0x3d166b;}else if(_0x3d166b[_0x9fb8('0xab')]===_0x9fb8('0x6a')){_0x3d166b[_0x9fb8('0xa9')]=_0x3d166b[_0x9fb8('0xa9')]['length']>0x0?_0x3d166b[_0x9fb8('0xa9')]:'t';}else if(_[_0x9fb8('0x4a')](_0x3d166b[_0x9fb8('0xa9')])){_0x3d166b['result']='#';_0x30f265='#';}if(!this[_0x9fb8('0x89')](_0x3a6189[_0x9fb8('0x122')])){this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0xe2'));}else{var _0x2afee7=this['getVariable']['sync'](this,_0x3a6189[_0x9fb8('0x122')]);if(!_0x2afee7){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x3a6189,_0x9fb8('0xe3'));}this[_0x9fb8('0xe')][_0x9fb8('0xa5')](_0x2afee7,_0x30f265);}this['createSquareDetailsReport'][_0x9fb8('0xc9')](this,_0x3a6189,_0x30f265);return _0x3d166b;};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0xaf')]=function(_0x5069b5){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x17c'),_0x5069b5[_0x9fb8('0x3d')]));return this[_0x9fb8('0xe')]['noop'](_0x5069b5[_0x9fb8('0x17d')]||_0x5069b5[_0x9fb8('0x3d')]);};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x17e')]=function(_0x2d3eb9){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x17f'),_0x2d3eb9[_0x9fb8('0x3d')]));if(!this[_0x9fb8('0x89')](_0x2d3eb9[_0x9fb8('0x169')])){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x2d3eb9,_0x9fb8('0x16a'));}logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x9fb8('0xe')][_0x9fb8('0x40')],_0x2d3eb9[_0x9fb8('0x169')]));var _0x5e671d=this[_0x9fb8('0x54')][_0x9fb8('0xc9')](this,_0x2d3eb9[_0x9fb8('0x180')]);var _0x50f21a=this['agentPause'][_0x9fb8('0xc9')](this,_0x2d3eb9['findBy'],_0x5e671d);if(_0x50f21a){logger['info'](util[_0x9fb8('0x2c')](_0x9fb8('0x16b'),this[_0x9fb8('0xe')][_0x9fb8('0x40')],_0x2d3eb9[_0x9fb8('0x169')]));this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0x16b'),this[_0x9fb8('0xe')][_0x9fb8('0x40')],_0x2d3eb9[_0x9fb8('0x169')]));return{'code':0xc8,'result':_0x9fb8('0x171')};}else{logger['info'](util[_0x9fb8('0x2c')](_0x9fb8('0x16c'),this[_0x9fb8('0xe')][_0x9fb8('0x40')],_0x2d3eb9['findBy']));this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0x16b'),this['channel'][_0x9fb8('0x40')],_0x2d3eb9[_0x9fb8('0x169')]));return{'code':0xc8,'result':_0x9fb8('0x16d')};}};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x181')]=function(_0x502254){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x502254['label']));if(!this['isConfigured'](_0x502254[_0x9fb8('0x11e')])){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x502254,'no\x20file\x20audio\x20selected');}var _0x29aea4=this[_0x9fb8('0x120')][_0x9fb8('0xc9')](this,_0x502254[_0x9fb8('0x11e')]);if(!_0x29aea4){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x502254,'no\x20file\x20audio\x20found');}var _0x10c43e=this[_0x9fb8('0xe')][_0x9fb8('0x5d')](_0x9fb8('0x182'),[_0x29aea4,_0x502254[_0x9fb8('0xef')]]);if(_0x10c43e[_0x9fb8('0xa9')]===-0x1){return _0x10c43e;}return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0x183'),_0x9fb8('0x182'),_0x29aea4));};AGIVertices['prototype']['queue']=function(_0x20d142){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x184'),_0x20d142['label']));if(!this[_0x9fb8('0x89')](_0x20d142[_0x9fb8('0x185')])){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x20d142,_0x9fb8('0x186'));}var _0x550696='';var _0x18ba07=parseInt(_0x20d142['queue_id'],0xa);if(isNaN(_0x18ba07)){_0x550696=_0x20d142[_0x9fb8('0x185')];}else{_0x550696=this[_0x9fb8('0x187')][_0x9fb8('0xc9')](this,_0x20d142[_0x9fb8('0x185')]);if(!_0x550696){return this['channel'][_0x9fb8('0x36')](_0x20d142,_0x9fb8('0x188'));}}var _0x25058f='';if(this[_0x9fb8('0x89')](_0x20d142['file_id'])){var _0x2e314d=this['getSound']['sync'](this,_0x20d142[_0x9fb8('0x11e')]);if(_0x2e314d){_0x25058f=_0x2e314d;}}this[_0x9fb8('0x3b')][_0x9fb8('0xc9')](this,_0x20d142,_0x550696);if(_0x20d142[_0x9fb8('0xef')][_0x9fb8('0x189')]('x')<0x0){_0x20d142[_0x9fb8('0xef')]+='x';}if(_0x20d142[_0x9fb8('0xef')][_0x9fb8('0x189')]('X')<0x0){_0x20d142[_0x9fb8('0xef')]+='X';}this[_0x9fb8('0xe')][_0x9fb8('0xa5')](_0x9fb8('0x18a'),_0x550696?_0x550696[_0x9fb8('0x18b')]():'');var _0x498565=this['channel'][_0x9fb8('0x5d')](_0x9fb8('0x18c'),[_0x550696,_0x20d142[_0x9fb8('0xef')],_0x20d142[_0x9fb8('0x68')],_0x25058f,_0x20d142[_0x9fb8('0x6a')],_0x20d142[_0x9fb8('0x7')],_0x20d142[_0x9fb8('0x18d')],_0x20d142['gosub'],'',_0x20d142[_0x9fb8('0x18e')]]);if(_0x498565[_0x9fb8('0xa9')]===-0x1){return _0x498565;}return this['channel'][_0x9fb8('0xaf')](util['format'](_0x9fb8('0x183'),'QUEUE',_0x550696));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x18f')]=function(_0x53477b){logger[_0x9fb8('0x31')](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x53477b[_0x9fb8('0x3d')]));var _0x39a6c3=_0x53477b[_0x9fb8('0x190')]||_0x9fb8('0x144');var _0x31ed88=util[_0x9fb8('0x2c')](_0x9fb8('0x191'),this[_0x9fb8('0xe')][_0x9fb8('0x3c')],rs['generate'](0x5));var _0x4e1eef=util[_0x9fb8('0x2c')]('%s/recordings/%s.%s',FILES_PATH,_0x31ed88,_0x39a6c3);var _0x338fe1=util['format'](_0x9fb8('0x145'),FILES_PATH,_0x31ed88);this[_0x9fb8('0x41')][_0x9fb8('0xc9')](this,_0x53477b,_0x31ed88,_0x4e1eef);this[_0x9fb8('0xe')][_0x9fb8('0xa5')]('RECORDING_SAVENAME',_0x31ed88);logger[_0x9fb8('0x31')](_0x9fb8('0x192'),_0x338fe1,_0x39a6c3,_0x53477b[_0x9fb8('0x193')],_0x53477b['timeout']);return this['channel'][_0x9fb8('0x148')](_0x338fe1,_0x39a6c3,_0x53477b['escape_digits'],_0x53477b[_0x9fb8('0x6a')],undefined,!![]);};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x194')]=function(_0x4e2960){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x195'),_0x4e2960[_0x9fb8('0x3d')]));if(!this[_0x9fb8('0x89')](_0x4e2960['url'])){return this['channel']['noop'](_0x9fb8('0x196'));}var _0x3364b6=this[_0x9fb8('0x67')][_0x9fb8('0xc9')](this,_0x4e2960);logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x197'),util['inspect'](_0x3364b6,{'showHidden':![],'depth':null})));if(!this[_0x9fb8('0x89')](_0x4e2960[_0x9fb8('0x122')])){return this['channel']['noop'](_0x9fb8('0x198'));}var _0xf0521=this[_0x9fb8('0x12')][_0x9fb8('0xc9')](this,_0x4e2960[_0x9fb8('0x122')]);if(!_0xf0521){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x4e2960,_0x9fb8('0xe3'));}this[_0x9fb8('0xe')][_0x9fb8('0xa5')](util[_0x9fb8('0x2c')](_0x9fb8('0x199'),_0xf0521),_0x3364b6[_0x9fb8('0x7a')]?_0x3364b6[_0x9fb8('0x7a')]:_0x9fb8('0x19a'));this['channel']['setVariable'](util[_0x9fb8('0x2c')](_0x9fb8('0x19b'),_0xf0521),_0x3364b6[_0x9fb8('0x19c')]?_0x3364b6[_0x9fb8('0x19c')]:'OK');if(_0x3364b6[_0x9fb8('0x6f')]){try{this['saveRestApiResult'](_0x3364b6[_0x9fb8('0x6f')],_0xf0521);}catch(_0x201773){logger[_0x9fb8('0x36')](util[_0x9fb8('0x2c')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0xf0521));}}return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0xe6'),_0xf0521));};AGIVertices['prototype'][_0x9fb8('0x19d')]=function(_0x30087e){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x19e'),_0x30087e[_0x9fb8('0x3d')]));return this[_0x9fb8('0xe')][_0x9fb8('0x19f')](_0x30087e[_0x9fb8('0x1a0')][_0x9fb8('0xe0')](/\s+/g,''),_0x30087e[_0x9fb8('0x193')]);};AGIVertices['prototype'][_0x9fb8('0x1a1')]=function(_0x325483){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x1a2'),_0x325483[_0x9fb8('0x3d')]));return this[_0x9fb8('0xe')][_0x9fb8('0x1a3')](_0x325483[_0x9fb8('0x6b')][_0x9fb8('0xe0')](/\s+/g,''),_0x325483[_0x9fb8('0x193')]);};AGIVertices['prototype'][_0x9fb8('0x1a4')]=function(_0x187c11){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x187c11[_0x9fb8('0x3d')]));return this['channel'][_0x9fb8('0x1a5')](_0x187c11['text'],_0x187c11['escape_digits']);};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x1a6')]=function(_0x22a077){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x1a7'),_0x22a077[_0x9fb8('0x3d')]));if(!this['isConfigured'](_0x22a077[_0x9fb8('0x1a8')])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0x1a9'));}var _0x7a1738=this['getMailAccount']['sync'](this,_0x22a077[_0x9fb8('0x1a8')]);if(!_0x7a1738||!_0x7a1738[_0x9fb8('0x1aa')]){return this[_0x9fb8('0xe')]['error'](_0x22a077,'no\x20mail\x20account\x20found');}var _0x3f8d96={'from':util[_0x9fb8('0x2c')](_0x9fb8('0x1ab'),_0x7a1738[_0x9fb8('0x17')],_0x7a1738[_0x9fb8('0x1ac')]||_0x7a1738['Smtp'][_0x9fb8('0x1ad')]),'to':_0x22a077['to']||'','cc':_0x22a077['cc']||'','bcc':_0x22a077[_0x9fb8('0x1ae')]||'','subject':_0x22a077[_0x9fb8('0x1af')],'html':_0x22a077[_0x9fb8('0x61')],'text':_0x22a077[_0x9fb8('0x61')]};var _0x11614d={'tls':{'rejectUnauthorized':![]}};if(_0x7a1738[_0x9fb8('0x1aa')][_0x9fb8('0x1b0')]){_0x11614d[_0x9fb8('0x1b0')]=_0x7a1738[_0x9fb8('0x1aa')]['service'];}else{_0x11614d['host']=_0x7a1738[_0x9fb8('0x1aa')]['host'];_0x11614d[_0x9fb8('0x1b1')]=_0x7a1738['Smtp'][_0x9fb8('0x1b1')];_0x11614d[_0x9fb8('0x1b2')]=_0x7a1738['Smtp'][_0x9fb8('0x1b2')];}if(_0x7a1738[_0x9fb8('0x1aa')][_0x9fb8('0x1b3')]){_0x11614d['auth']={'user':_0x7a1738['Smtp']['user'],'pass':_0x7a1738[_0x9fb8('0x1aa')][_0x9fb8('0x1b4')]};}if(this[_0x9fb8('0x89')](_0x22a077[_0x9fb8('0x1b5')])){}logger[_0x9fb8('0xe8')](_0x9fb8('0x1b6'),JSON['stringify'](_0x3f8d96));this['createSquareDetailsReport'][_0x9fb8('0xc9')](this,_0x22a077,_0x22a077[_0x9fb8('0x1a8')]);this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0x1b7'),_0x7a1738[_0x9fb8('0x17')]));this[_0x9fb8('0x25')]['sync'](this,_0x11614d,_0x3f8d96);return this[_0x9fb8('0xe')]['noop'](_0x9fb8('0x1b8'));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x1b9')]=function(_0x34c220){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x1ba'),_0x34c220[_0x9fb8('0x3d')]));return this['channel'][_0x9fb8('0xaf')](_0x9fb8('0x1bb'));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x1bc')]=function(_0x5f50ea){logger['info'](util[_0x9fb8('0x2c')](_0x9fb8('0x1bd'),_0x5f50ea[_0x9fb8('0x3d')]));if(!this['isConfigured'](_0x5f50ea['sms_account_id'])){return this['channel'][_0x9fb8('0xaf')](_0x9fb8('0x1be'));}var _0x2dbdc7=this[_0x9fb8('0x38')][_0x9fb8('0xc9')](this,_0x5f50ea[_0x9fb8('0x1bf')]);if(!_0x2dbdc7){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x5f50ea,_0x9fb8('0x1c0'));}var _0x40a6c7={'body':_0x5f50ea['sms_text'],'phone':_0x5f50ea['to']||'','SmsAccountId':_0x2dbdc7['id']};logger[_0x9fb8('0xe8')](_0x9fb8('0x1c1'),JSON['stringify'](_0x40a6c7));this[_0x9fb8('0x3b')]['sync'](this,_0x5f50ea,_0x5f50ea[_0x9fb8('0x1bf')]);this[_0x9fb8('0xe')]['noop'](util[_0x9fb8('0x2c')](_0x9fb8('0x1c2'),_0x2dbdc7[_0x9fb8('0x17')]));this['createSmsMessage'][_0x9fb8('0xc9')](this,_0x40a6c7);return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0x1c3'));};AGIVertices['prototype'][_0x9fb8('0x1c4')]=function(_0x2f8751){logger['info'](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x2f8751[_0x9fb8('0x3d')]));if(!this['isConfigured'](_0x2f8751['variable_id'])){return this[_0x9fb8('0xe')]['error'](_0x2f8751,_0x9fb8('0x1c5'));}var _0x408087=this[_0x9fb8('0x12')][_0x9fb8('0xc9')](this,_0x2f8751[_0x9fb8('0x122')]);if(!_0x408087){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x2f8751,'no\x20variable\x20found');}return this[_0x9fb8('0xe')][_0x9fb8('0xa5')](_0x408087,_0x2f8751[_0x9fb8('0x1c6')]);};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x1c7')]=function(_0x400970){logger[_0x9fb8('0x31')](util['format'](_0x9fb8('0x1c8'),_0x400970['label']));this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0x1c9'));if(_0x400970[_0x9fb8('0xc2')]===_0x9fb8('0x1ca')){this[_0x9fb8('0xe')]['noop'](_0x9fb8('0x1cb'));return this['channel']['answer']();}return this['channel'][_0x9fb8('0xaf')]('Skipped\x20Answer');};AGIVertices['prototype']['subproject']=function(_0x276e76){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x276e76[_0x9fb8('0x3d')]));if(!this['isConfigured'](_0x276e76[_0x9fb8('0x1cc')])){return this['channel']['error'](_0x276e76,'no\x20subproject\x20selected');}var _0x5b7465=this[_0x9fb8('0x18')][_0x9fb8('0xc9')](this,_0x276e76[_0x9fb8('0x1cc')]);if(!this[_0x9fb8('0x89')](_0x5b7465)){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x276e76,util[_0x9fb8('0x2c')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x276e76['project_id']));}if(_0x5b7465===this[_0x9fb8('0xe')][_0x9fb8('0x3f')]){return this['channel'][_0x9fb8('0x36')](_0x276e76,_0x9fb8('0x1cd'));}this['createSquareDetailsReport'][_0x9fb8('0xc9')](this,_0x276e76,_0x5b7465);var _0x430323=this[_0x9fb8('0xe')]['exec'](_0x9fb8('0x1ce'),util[_0x9fb8('0x2c')](_0x9fb8('0x1cf'),config[_0x9fb8('0x7')][_0x9fb8('0x1d0')]||'127.0.0.1',_0x5b7465,this[_0x9fb8('0xe')][_0x9fb8('0x3f')]));if(_0x430323[_0x9fb8('0xa9')]===-0x1){return _0x430323;}return this[_0x9fb8('0xe')]['noop'](util[_0x9fb8('0x2c')](_0x9fb8('0x183'),_0x9fb8('0x1ce'),_0x5b7465));};AGIVertices['prototype'][_0x9fb8('0x1d1')]=function(_0x27792f){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x27792f[_0x9fb8('0x3d')]));var _0x558f0b=this[_0x9fb8('0x5c')]['sync'](this,_0x27792f['command']);this['createSquareDetailsReport'][_0x9fb8('0xc9')](this,_0x27792f,_0x27792f['command']);if(this[_0x9fb8('0x89')](_0x27792f['variable_id'])){var _0x4a4cdd=this[_0x9fb8('0x12')][_0x9fb8('0xc9')](this,_0x27792f[_0x9fb8('0x122')]);if(_0x4a4cdd){this[_0x9fb8('0xe')][_0x9fb8('0xa5')](_0x4a4cdd,_0x558f0b);return this[_0x9fb8('0xe')]['noop'](util[_0x9fb8('0x2c')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x27792f[_0x9fb8('0xc0')],_0x4a4cdd));}}return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0x1d2'),_0x27792f[_0x9fb8('0xc0')]));};AGIVertices['prototype'][_0x9fb8('0x1d3')]=function(_0x549d2e){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x549d2e[_0x9fb8('0x3d')]));_0x549d2e[_0x9fb8('0x61')]=_0x549d2e[_0x9fb8('0x61')][_0x9fb8('0xe0')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x549d2e[_0x9fb8('0x60')])){return this[_0x9fb8('0xe')]['noop'](_0x9fb8('0x1d4'));}if(!this[_0x9fb8('0x89')](_0x549d2e['text'])){return this[_0x9fb8('0xe')][_0x9fb8('0xaf')](_0x9fb8('0xb0'));}this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util['format'](_0x9fb8('0x1d5'),_0x549d2e[_0x9fb8('0x61')]));var _0x11cc4a=this[_0x9fb8('0x5f')]['sync'](this,_0x549d2e);if(_0x11cc4a){this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0x1d6'),_0x11cc4a));var _0x31b18d=this[_0x9fb8('0xe')]['streamFile'](_0x11cc4a);try{fs['unlink'](_0x11cc4a+'.wav');}catch(_0x258201){logger[_0x9fb8('0x36')](_0x258201);}return _0x31b18d;}return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x549d2e,_0x9fb8('0x1d7'));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x1d8')]=function(_0x504c58){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x1d9'),_0x504c58['label']));_0x504c58[_0x9fb8('0x61')]=_0x504c58[_0x9fb8('0x61')][_0x9fb8('0xe0')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9fb8('0x89')](_0x504c58['text'])){return this[_0x9fb8('0xe')]['noop']('no\x20text\x20configured');}this[_0x9fb8('0xe')]['noop'](util[_0x9fb8('0x2c')](_0x9fb8('0x1da'),_0x504c58[_0x9fb8('0x61')]));var _0x1c462a=this[_0x9fb8('0x65')][_0x9fb8('0xc9')](this,_0x504c58);if(_0x1c462a){this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0x1db'),_0x1c462a));var _0x3ad668=this[_0x9fb8('0xe')]['streamFile'](_0x1c462a);try{fs[_0x9fb8('0x110')](_0x1c462a+_0x9fb8('0x135'));}catch(_0x11ad39){logger['error'](_0x11ad39);}return _0x3ad668;}return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x504c58,_0x9fb8('0x1dc'));};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x1dd')]=function(_0x508686){logger['info'](util['format'](_0x9fb8('0x1de'),_0x508686[_0x9fb8('0x3d')]));if(!this['isConfigured'](_0x508686[_0x9fb8('0x169')])){return this[_0x9fb8('0xe')]['error'](_0x508686,'no\x20find\x20by\x20configured');}logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x170'),this[_0x9fb8('0xe')][_0x9fb8('0x40')],_0x508686[_0x9fb8('0x169')]));var _0x24060e=this[_0x9fb8('0x57')][_0x9fb8('0xc9')](this,_0x508686[_0x9fb8('0x169')]);if(_0x24060e){logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x16b'),this['channel'][_0x9fb8('0x40')],_0x508686[_0x9fb8('0x169')]));this[_0x9fb8('0xe')][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x9fb8('0x40')],_0x508686[_0x9fb8('0x169')]));return{'code':0xc8,'result':_0x9fb8('0x171')};}else{logger[_0x9fb8('0x31')](util[_0x9fb8('0x2c')](_0x9fb8('0x16c'),this[_0x9fb8('0xe')][_0x9fb8('0x40')],_0x508686[_0x9fb8('0x169')]));this['channel'][_0x9fb8('0xaf')](util[_0x9fb8('0x2c')](_0x9fb8('0x16c'),this['channel'][_0x9fb8('0x40')],_0x508686['findBy']));return{'code':0xc8,'result':_0x9fb8('0x16d')};}};AGIVertices[_0x9fb8('0x11')][_0x9fb8('0x1df')]=function(_0x30582d){logger['info'](util[_0x9fb8('0x2c')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x30582d[_0x9fb8('0x3d')]));var _0x1c78b3=this[_0x9fb8('0xe')]['exec'](_0x9fb8('0x1e0'),[_0x30582d['mailbox'],_0x30582d[_0x9fb8('0x7c')]]);if(_0x1c78b3[_0x9fb8('0xa9')]===-0x1){return _0x1c78b3;}return this[_0x9fb8('0xe')]['noop'](util['format'](_0x9fb8('0x183'),'VOICEMAIL',_0x30582d[_0x9fb8('0x1e1')]));};AGIVertices[_0x9fb8('0x11')]['vswitch']=function(_0x3f1d79){logger[_0x9fb8('0x31')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x3f1d79[_0x9fb8('0x3d')]));if(!this['isConfigured'](_0x3f1d79[_0x9fb8('0x122')])){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x3f1d79,'no\x20variable\x20selected');}var _0x3837d9=this['getVariable'][_0x9fb8('0xc9')](this,_0x3f1d79[_0x9fb8('0x122')]);if(!_0x3837d9){return this[_0x9fb8('0xe')][_0x9fb8('0x36')](_0x3f1d79,'no\x20variable\x20found');}var _0x1b8ddf=this[_0x9fb8('0xe')][_0x9fb8('0x12')](_0x3837d9);return{'code':0xc8,'result':_0x1b8ddf[_0x9fb8('0xab')]?_0x1b8ddf['extra']:'-'};};String[_0x9fb8('0x11')][_0x9fb8('0xa7')]=function(_0x3ba801,_0x3f76eb){return this['split'](_0x3ba801)[_0x9fb8('0x1e2')](_0x3f76eb);};module[_0x9fb8('0x1e3')]=AGIVertices; \ No newline at end of file +var _0x0131=['createSquareDetailsReport','channel','uniqueid','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agentUnpause','isNil','agentLogout','agent','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','PUT','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','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_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','uri','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','saveRestApiResult','length','%s.%s','split','replaceAll','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','sync','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','result','noop','Executed\x20command\x20MRCPSynth\x20%s','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','label','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','callback','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','query','no\x20query\x20configured','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','no\x20key\x20configured','bot','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\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','toUpperCase','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','retry','file_id','no\x20file\x20audio\x20selected','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','intKey','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','recordFile','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','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','isArray','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','FIND\x20AGENT\x20%s\x20BY\x20%s','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','subject','service','host','port','secure','auth','user','pass','template_id','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','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','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','yes','subproject','project_id','getSquareProject','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','AGI','system','command','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','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','path','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','/var/opt/motion2/server/files','rawHeaders','rawBody','getsecretdigits','rpc','mailRpc','prototype','getVariable','then','name','catch','getVoiceQueueById','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage'];(function(_0x1c7e42,_0x17d603){var _0x1142d9=function(_0x12c2b0){while(--_0x12c2b0){_0x1c7e42['push'](_0x1c7e42['shift']());}};_0x1142d9(++_0x17d603);}(_0x0131,0x1a4));var _0x1013=function(_0x3f1710,_0x3877a2){_0x3f1710=_0x3f1710-0x0;var _0x528458=_0x0131[_0x3f1710];return _0x528458;};'use strict';var fs=require('fs');var path=require(_0x1013('0x0'));var util=require(_0x1013('0x1'));var _=require(_0x1013('0x2'));var sh=require(_0x1013('0x3'));var odbc=require(_0x1013('0x4'))();var rs=require(_0x1013('0x5'));var moment=require(_0x1013('0x6'));var Mustache=require(_0x1013('0x7'));var rp=require(_0x1013('0x8'));var logger=require('../../config/logger')('agi');var config=require('../../config/environment');var scripts=require('./scripts');var FILES_PATH=_0x1013('0x9');var recursiveMapAttributes=[_0x1013('0xa'),_0x1013('0xb')];var verticesWithRetry=['menu','getdigits',_0x1013('0xc')];var AGIVertices=function(_0x3240f8,_0x3efbcf,_0x52b18e){this['channel']=_0x3240f8;this[_0x1013('0xd')]=_0x3efbcf;this[_0x1013('0xe')]=_0x52b18e;};AGIVertices[_0x1013('0xf')][_0x1013('0x10')]=function(_0x5289ca,_0x3dba02){this['rpc']['getVariableById'](_0x5289ca)[_0x1013('0x11')](function(_0x4a7bd6){_0x3dba02(null,_0x4a7bd6?_0x4a7bd6[_0x1013('0x12')]:![]);})[_0x1013('0x13')](function(_0x215cd1){_0x3dba02(_0x215cd1);});};AGIVertices[_0x1013('0xf')]['getVoiceQueue']=function(_0xcf13ec,_0x23f3c7){this[_0x1013('0xd')][_0x1013('0x14')](_0xcf13ec)[_0x1013('0x11')](function(_0x12f5ff){_0x23f3c7(null,_0x12f5ff?_0x12f5ff['name']:![]);})[_0x1013('0x13')](function(_0x3c9b78){_0x23f3c7(_0x3c9b78);});};AGIVertices[_0x1013('0xf')]['getSquareProject']=function(_0x19b98d,_0x4d50c6){this['rpc'][_0x1013('0x15')](_0x19b98d)[_0x1013('0x11')](function(_0x751c44){_0x4d50c6(null,_0x751c44?_0x751c44['name']:![]);})[_0x1013('0x13')](function(_0x2cef1b){_0x4d50c6(_0x2cef1b);});};AGIVertices[_0x1013('0xf')][_0x1013('0x16')]=function(_0x456aba,_0xb89669){this[_0x1013('0xd')][_0x1013('0x17')](_0x456aba)['then'](function(_0x314015){_0xb89669(null,_0x314015?_0x314015['dsn']:![]);})[_0x1013('0x13')](function(_0x1bb0b3){_0xb89669(_0x1bb0b3);});};AGIVertices[_0x1013('0xf')][_0x1013('0x18')]=function(_0x46fb32,_0x2a4037){this['rpc'][_0x1013('0x19')](_0x46fb32)[_0x1013('0x11')](function(_0x8f3da8){_0x2a4037(null,_0x8f3da8?_0x8f3da8[_0x1013('0x12')]:![]);})[_0x1013('0x13')](function(_0x262192){_0x2a4037(_0x262192);});};AGIVertices[_0x1013('0xf')][_0x1013('0x1a')]=function(_0x3d39bb,_0x2505e4){this[_0x1013('0xd')][_0x1013('0x1b')](_0x3d39bb)[_0x1013('0x11')](function(_0xc2fc29){_0x2505e4(null,_0xc2fc29?_0xc2fc29[_0x1013('0x12')]:![]);})[_0x1013('0x13')](function(_0x4cb4c1){_0x2505e4(_0x4cb4c1);});};AGIVertices[_0x1013('0xf')][_0x1013('0x1c')]=function(_0x18ed42,_0x5889ce){var _0x372516=this;this[_0x1013('0xd')][_0x1013('0x1d')](_0x18ed42)['then'](function(_0x4f2bb2){_0x5889ce(null,_0x4f2bb2?_0x372516['getSoundPath'](_0x4f2bb2['save_name']):![]);})[_0x1013('0x13')](function(_0x9c445e){_0x5889ce(_0x9c445e);});};AGIVertices[_0x1013('0xf')][_0x1013('0x1e')]=function(_0x56b6e7,_0x26642d){this[_0x1013('0xd')][_0x1013('0x1f')](_0x56b6e7)[_0x1013('0x11')](function(_0x3a89d8){_0x26642d(null,_0x3a89d8?_0x3a89d8:![]);})[_0x1013('0x13')](function(_0x4b76b3){_0x26642d(_0x4b76b3);});};AGIVertices[_0x1013('0xf')][_0x1013('0x20')]=function(_0x42bd64,_0x5b294a,_0x288985){this[_0x1013('0xe')]['sendMailMessage'](_0x42bd64,_0x5b294a)[_0x1013('0x11')](function(){_0x288985(null);})[_0x1013('0x13')](function(_0x3abb22){_0x288985(_0x3abb22);});};AGIVertices[_0x1013('0xf')][_0x1013('0x21')]=function(_0x3f1f84,_0x270e63){this['rpc']['getIntervalById'](_0x3f1f84)[_0x1013('0x11')](function(_0x46599e){if(_0x46599e){if(_0x46599e[_0x1013('0x22')]){_0x270e63(null,[_0x46599e[_0x1013('0x23')]]);}else{_0x270e63(null,_['map'](_0x46599e['Intervals'],'interval'));}}else{_0x270e63(null,![]);}})[_0x1013('0x13')](function(_0x34ad52){_0x270e63(_0x34ad52);});};AGIVertices[_0x1013('0xf')][_0x1013('0x24')]=function(_0x3f0884){return util[_0x1013('0x25')](_0x1013('0x26'),FILES_PATH,_0x3f0884);};AGIVertices['prototype'][_0x1013('0x27')]=function(_0x79c944,_0x1e22dc,_0x3726fd){odbc[_0x1013('0x28')](_0x79c944,function(_0x457c4d){if(_0x457c4d){logger[_0x1013('0x29')](_0x1013('0x2a'),_0x457c4d);_0x3726fd(_0x457c4d);}else{logger[_0x1013('0x2b')]('ODBC\x20connection\x20successfully');odbc['query'](_0x1e22dc,function(_0x9c7ccf,_0x4c2751){if(_0x9c7ccf){logger[_0x1013('0x2b')](_0x1013('0x2c'),_0x1e22dc);_0x3726fd(_0x9c7ccf);}else{logger[_0x1013('0x2b')](_0x1013('0x2d'),_0x1e22dc);odbc[_0x1013('0x2e')](function(_0x34db8e){if(_0x34db8e){logger['error'](_0x1013('0x2f'),_0x34db8e);}_0x3726fd(null,_0x4c2751);});}});}});};AGIVertices[_0x1013('0xf')]['getSmsAccount']=function(_0x53aa72,_0x35e096){this[_0x1013('0xd')][_0x1013('0x30')](_0x53aa72)['then'](function(_0x3c6373){_0x35e096(null,_0x3c6373?_0x3c6373:![]);})[_0x1013('0x13')](function(_0x5d4e76){_0x35e096(_0x5d4e76);});};AGIVertices[_0x1013('0xf')][_0x1013('0x31')]=function(_0x4d852c,_0x31e8f6){this[_0x1013('0xd')][_0x1013('0x31')](_0x4d852c)['then'](function(_0xc7c4f2){_0x31e8f6(null,_0xc7c4f2);})[_0x1013('0x13')](function(_0x31eede){_0x31e8f6(_0x31eede);});};AGIVertices['prototype'][_0x1013('0x32')]=function(_0xbf46ba,_0x301238,_0x5d4bb4){this[_0x1013('0xd')][_0x1013('0x32')]({'uniqueid':this[_0x1013('0x33')][_0x1013('0x34')],'node':_0xbf46ba['label'],'application':_0xbf46ba[_0x1013('0x35')],'data':_0x301238||null,'project_name':this[_0x1013('0x33')][_0x1013('0x36')],'callerid':this['channel'][_0x1013('0x37')]})[_0x1013('0x11')](function(_0x5e7dfd){if(_0x5d4bb4){_0x5d4bb4(null,_0x5e7dfd);}})[_0x1013('0x13')](function(_0xa1b629){if(_0x5d4bb4){_0x5d4bb4(_0xa1b629);}});};AGIVertices[_0x1013('0xf')]['createSquareRecording']=function(_0x57aaf7,_0x44708b,_0x2621b8,_0x5a9158){this['rpc'][_0x1013('0x38')]({'uniqueid':this[_0x1013('0x33')][_0x1013('0x34')],'callerid':this['channel'][_0x1013('0x37')],'calleridname':this[_0x1013('0x33')][_0x1013('0x39')],'context':this[_0x1013('0x33')][_0x1013('0x3a')],'extension':this[_0x1013('0x33')][_0x1013('0x3b')],'priority':this[_0x1013('0x33')][_0x1013('0x3c')],'accountcode':this['channel'][_0x1013('0x3d')],'dnid':this['channel']['dnid'],'projectName':this[_0x1013('0x33')][_0x1013('0x36')],'saveName':_0x44708b,'filename':_0x57aaf7[_0x1013('0x3e')]||_0x44708b,'savePath':_0x2621b8})['then'](function(_0x29835e){_0x5a9158(null,_0x29835e);})['catch'](function(_0x54f4e5){_0x5a9158(_0x54f4e5);});};AGIVertices[_0x1013('0xf')][_0x1013('0x3f')]=function(_0x2982c6,_0xbc5305,_0xc355c1,_0x5a2f78,_0x3548b5){this['rpc'][_0x1013('0x3f')]({'uniqueid':this[_0x1013('0x33')][_0x1013('0x34')],'body':_0x2982c6,'direction':_0xbc5305,'providerName':_0xc355c1,'providerResponse':_0x5a2f78})[_0x1013('0x11')](function(_0x36187e){if(_0x3548b5){_0x3548b5(null,_0x36187e);}})['catch'](function(_0x5318f4){if(_0x3548b5){_0x3548b5(_0x5318f4);}});};AGIVertices[_0x1013('0xf')]['createCmContact']=function(_0x55898e,_0x25d70b){this[_0x1013('0xd')][_0x1013('0x40')]({'firstName':_[_0x1013('0x41')](_0x55898e['name'])||_['isNil'](_0x55898e[_0x1013('0x12')])?_0x1013('0x42')+Math[_0x1013('0x43')]():_0x55898e[_0x1013('0x12')],'lastName':_['isEmpty'](_0x55898e[_0x1013('0x44')])||_['isNil'](_0x55898e[_0x1013('0x44')])?null:_0x55898e['lastName'],'phone':_0x55898e[_0x1013('0x45')],'ListId':_0x55898e[_0x1013('0x46')],'scheduledat':_0x55898e[_0x1013('0x47')],'callbackUniqueid':this[_0x1013('0x33')][_0x1013('0x34')],'tags':'callback','description':_0x1013('0x48')+_0x55898e[_0x1013('0x47')][_0x1013('0x49')](),'priority':_0x55898e[_0x1013('0x4a')]})[_0x1013('0x11')](function(_0x1780ba){_0x25d70b(null,_0x1780ba);})[_0x1013('0x13')](function(_0x564e09){_0x25d70b(_0x564e09);});};AGIVertices[_0x1013('0xf')][_0x1013('0x4b')]=function(_0x165730,_0x129587){this[_0x1013('0xd')][_0x1013('0x4c')](_0x165730)[_0x1013('0x11')](function(_0x45be58){_0x129587(null,_0x45be58?_0x45be58[_0x1013('0x12')]:![]);})[_0x1013('0x13')](function(_0x4c960c){_0x129587(_0x4c960c);});};AGIVertices['prototype'][_0x1013('0x4d')]=function(_0x4b274c,_0x392013,_0x2cb287){var _0x2f9bf2={'role':'agent'};_0x2f9bf2[_0x4b274c]=this[_0x1013('0x33')]['callerid'];this[_0x1013('0xd')][_0x1013('0x4d')](_0x2f9bf2,_0x392013,this[_0x1013('0x33')]['uniqueid'])[_0x1013('0x11')](function(_0x48b22c){_0x2cb287(null,_['isNil'](_0x48b22c)?![]:!![]);})[_0x1013('0x13')](function(_0x297fdd){logger['error'](_0x297fdd);_0x2cb287(null,![]);});};AGIVertices['prototype'][_0x1013('0x4e')]=function(_0x1c4642,_0x34c935){var _0x533fed={'role':'agent'};_0x533fed[_0x1c4642]=this[_0x1013('0x33')][_0x1013('0x37')];this['rpc'][_0x1013('0x4e')](_0x533fed)[_0x1013('0x11')](function(_0x67a459){_0x34c935(null,_[_0x1013('0x4f')](_0x67a459)?![]:!![]);})[_0x1013('0x13')](function(_0x492e6e){logger['error'](_0x492e6e);_0x34c935(null,![]);});};AGIVertices[_0x1013('0xf')][_0x1013('0x50')]=function(_0x234a55,_0x4e8a09){var _0x2bf8c9={'role':_0x1013('0x51')};_0x2bf8c9[_0x234a55]=this[_0x1013('0x33')]['callerid'];this[_0x1013('0xd')]['agentLogout'](_0x2bf8c9)[_0x1013('0x11')](function(_0x53c855){_0x4e8a09(null,_[_0x1013('0x4f')](_0x53c855)?![]:!![]);})[_0x1013('0x13')](function(_0x16eb8b){logger[_0x1013('0x29')](_0x16eb8b);_0x4e8a09(null,![]);});};AGIVertices[_0x1013('0xf')][_0x1013('0x52')]=function(_0x5620f7,_0x55bda7){var _0x11be18={'role':_0x1013('0x51')};_0x11be18[_0x5620f7]=this[_0x1013('0x33')]['callerid'];var _0x3d67bf=_0x5620f7!=_0x1013('0x53')?util['format'](_0x1013('0x54'),_0x1013('0x55'),this[_0x1013('0x33')][_0x1013('0x37')]):undefined;this[_0x1013('0xd')]['agentLogin'](_0x11be18,_0x3d67bf)[_0x1013('0x11')](function(_0x2acd3f){_0x55bda7(null,_[_0x1013('0x4f')](_0x2acd3f)?![]:!![]);})[_0x1013('0x13')](function(_0x40ec3){logger[_0x1013('0x29')](_0x40ec3);_0x55bda7(null,![]);});};AGIVertices[_0x1013('0xf')][_0x1013('0x56')]=function(_0x20b6b6,_0x4559f6){sh[_0x1013('0x57')](_['trim'](_0x20b6b6),function(_0x2a2d1a,_0xf700c3){var _0x465fd7=_0xf700c3[_0x1013('0x58')](/(\r\n|\n|\r)/gm,'');_0x4559f6(null,_0x465fd7);});};AGIVertices[_0x1013('0xf')][_0x1013('0x59')]=function(_0x380853,_0x589361){scripts[_0x1013('0x59')](_0x380853['apiKey'],_0x380853[_0x1013('0x5a')]||_0x1013('0x5b'),_0x380853[_0x1013('0x5b')],_0x380853[_0x1013('0x5c')]||_0x1013('0x5d'),_0x380853[_0x1013('0x5e')]||_0x1013('0x5f'),_0x380853['audioEncoding']||'MP3')[_0x1013('0x11')](function(_0x32d0c1){_0x589361(null,_0x32d0c1);})[_0x1013('0x13')](function(_0x16bf9f){_0x589361(_0x16bf9f);});};AGIVertices['prototype'][_0x1013('0x60')]=function(_0x5513bf,_0x3d844e){scripts['googleTTS'](_0x5513bf[_0x1013('0x5b')],_0x5513bf[_0x1013('0x61')]||'en',0x1)[_0x1013('0x11')](function(_0x5f64d9){_0x3d844e(null,_0x5f64d9);})[_0x1013('0x13')](function(_0x5ccdd5){_0x3d844e(_0x5ccdd5);});};AGIVertices[_0x1013('0xf')][_0x1013('0x62')]=function(_0x173a6e,_0x28b1cd){var _0x5da5ab={'uri':_0x173a6e[_0x1013('0x63')],'method':_0x173a6e[_0x1013('0x64')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x173a6e[_0x1013('0x65')])===_0x1013('0x66')&&parseInt(_0x173a6e[_0x1013('0x65')])>=0x1?parseInt(_0x173a6e[_0x1013('0x65')])*0x3e8:0x5*0x3e8};if(_[_0x1013('0x67')](['POST',_0x1013('0x68')],_0x5da5ab[_0x1013('0x64')]['toUpperCase']())){try{_0x5da5ab[_0x1013('0x69')]=_0x173a6e[_0x1013('0xb')]?JSON[_0x1013('0x6a')](_0x173a6e[_0x1013('0xb')]):{};}catch(_0x136c9f){logger[_0x1013('0x29')](_0x1013('0x6b'),_0x136c9f);}}try{_0x5da5ab[_0x1013('0x6c')]=_0x173a6e[_0x1013('0xa')]?JSON[_0x1013('0x6a')](_0x173a6e[_0x1013('0xa')]):{};}catch(_0x405270){logger[_0x1013('0x29')](_0x1013('0x6d'),_0x405270);}if(_0x173a6e[_0x1013('0x6e')]){try{var _0x53b918=require(_0x173a6e[_0x1013('0x6e')])['sync'](this,_0x5da5ab);_0x5da5ab['uri']=Mustache[_0x1013('0x6f')](_0x173a6e[_0x1013('0x63')],_0x53b918,{},['$$','$$']);if(_0x5da5ab[_0x1013('0x6c')]){_0x5da5ab['headers']=JSON['parse'](Mustache[_0x1013('0x6f')](JSON[_0x1013('0x70')](_0x5da5ab[_0x1013('0x6c')]),_0x53b918,{},['$$','$$']));}if(_0x5da5ab[_0x1013('0x69')]){_0x5da5ab['body']=JSON[_0x1013('0x6a')](Mustache['render'](JSON['stringify'](_0x5da5ab['body']),_0x53b918,{},['$$','$$']));}}catch(_0xf6d0c0){logger[_0x1013('0x29')](_0x1013('0x71'),_0xf6d0c0);}}rp(_0x5da5ab)[_0x1013('0x11')](function(_0x18a5f0){var _0x4a6b2b={'statusCode':_0x18a5f0[_0x1013('0x72')]||0xc8,'statusMessage':_0x18a5f0[_0x1013('0x73')]||'OK','headers':_0x18a5f0[_0x1013('0x6c')]||{},'body':_0x18a5f0[_0x1013('0x69')]||{}};_0x28b1cd(null,_0x4a6b2b);})[_0x1013('0x13')](function(_0x527d1c){var _0x55bdee={'statusCode':_0x527d1c[_0x1013('0x72')]||0x1f4,'statusMessage':_0x527d1c[_0x1013('0x74')]||_0x1013('0x75'),'headers':_0x527d1c['options'][_0x1013('0x6c')]||{},'body':_0x527d1c[_0x1013('0x76')][_0x1013('0x69')]||{}};_0x28b1cd(null,_0x55bdee);});};AGIVertices[_0x1013('0xf')][_0x1013('0x77')]=function(_0x3bc8da,_0x5ebcac){scripts['googleDialogflow'](this['channel'][_0x1013('0x34')],_0x3bc8da[_0x1013('0x78')],_0x3bc8da['text'],_0x3bc8da[_0x1013('0x79')]||'en')[_0x1013('0x11')](function(_0x4611e7){_0x5ebcac(null,_0x4611e7);})[_0x1013('0x13')](function(_0x512b27){_0x5ebcac(_0x512b27);});};AGIVertices[_0x1013('0xf')][_0x1013('0x7a')]=function(_0x571941,_0x42467d){scripts[_0x1013('0x7a')](this[_0x1013('0x33')][_0x1013('0x34')],_0x571941[_0x1013('0x7b')],_0x571941[_0x1013('0x7c')],_0x571941[_0x1013('0x7d')],_0x571941[_0x1013('0x5b')],_0x571941[_0x1013('0x7e')]||'en')[_0x1013('0x11')](function(_0x59bf65){_0x42467d(null,_0x59bf65);})['catch'](function(_0x2be83a){_0x42467d(_0x2be83a);});};AGIVertices[_0x1013('0xf')][_0x1013('0x7f')]=function(_0x257ebe,_0x5b391d){scripts['sestekNDA'](this['channel'],_0x257ebe)[_0x1013('0x11')](function(_0x632c96){_0x5b391d(null,_0x632c96);})[_0x1013('0x13')](function(_0x10aff8){_0x5b391d(_0x10aff8);});};AGIVertices['prototype'][_0x1013('0x80')]=function(_0x3add1b,_0x14844a){scripts[_0x1013('0x80')](_0x3add1b[_0x1013('0x78')],_0x3add1b[_0x1013('0x5b')],_0x3add1b[_0x1013('0x81')]||_0x1013('0x5d'),_0x3add1b[_0x1013('0x82')])['then'](function(_0x1e4492){_0x14844a(null,_0x1e4492);})[_0x1013('0x13')](function(_0x29f3e){_0x14844a(_0x29f3e);});};AGIVertices[_0x1013('0xf')]['ispeechASR']=function(_0x26c9c3,_0x3cb2b2,_0x4e050c){scripts[_0x1013('0x83')](_0x3cb2b2,_0x26c9c3['key'],_0x26c9c3[_0x1013('0x84')]||'en-US',this[_0x1013('0x85')](_0x26c9c3['model'])?_0x26c9c3[_0x1013('0x86')]:undefined)[_0x1013('0x11')](function(_0x53d9a7){_0x4e050c(null,_0x53d9a7);})[_0x1013('0x13')](function(_0x518c4a){_0x4e050c(_0x518c4a);});};AGIVertices[_0x1013('0xf')][_0x1013('0x87')]=function(_0x289406,_0x32bba4){scripts[_0x1013('0x87')](_0x289406[_0x1013('0x88')],_0x289406[_0x1013('0x89')],_0x289406[_0x1013('0x8a')],_0x289406[_0x1013('0x8b')]||_0x1013('0x8c'),_0x289406[_0x1013('0x5b')],_0x289406[_0x1013('0x8d')]||'text')['then'](function(_0x371db6){_0x32bba4(null,_0x371db6);})[_0x1013('0x13')](function(_0x4d25c8){_0x32bba4(_0x4d25c8);});};AGIVertices[_0x1013('0xf')]['awsLex']=function(_0x4c4083,_0x202c1c){scripts[_0x1013('0x8e')](this['channel'][_0x1013('0x34')],_0x4c4083['aws_access_key_id'],_0x4c4083[_0x1013('0x89')],_0x4c4083[_0x1013('0x8f')],_0x4c4083[_0x1013('0x5b')],_0x4c4083[_0x1013('0x90')])['then'](function(_0x44801f){_0x202c1c(null,_0x44801f);})['catch'](function(_0x181339){_0x202c1c(_0x181339);});};AGIVertices[_0x1013('0xf')][_0x1013('0x91')]=function(_0x46da1b,_0x33d0bc,_0xc4dec0){scripts[_0x1013('0x91')](_0x33d0bc,_0x46da1b['key'],_0x46da1b[_0x1013('0x92')]||_0x1013('0x5d'))[_0x1013('0x11')](function(_0x221bad){_0xc4dec0(null,_0x221bad);})[_0x1013('0x13')](function(_0x170fe6){_0xc4dec0(_0x170fe6);});};AGIVertices[_0x1013('0xf')][_0x1013('0x93')]=function(_0x10067d,_0x382a99,_0x57f5fb){scripts['tildeASR'](_0x382a99,_0x10067d['appid'],_0x10067d[_0x1013('0x94')],_0x10067d[_0x1013('0x95')])[_0x1013('0x11')](function(_0x11c2de){_0x57f5fb(null,_0x11c2de);})['catch'](function(_0x12e264){_0x57f5fb(_0x12e264);});};AGIVertices['prototype'][_0x1013('0x96')]=function(_0x4c20db){var _0x17a81a=_[_0x1013('0x67')](verticesWithRetry,_0x4c20db[_0x1013('0x35')])?_0x4c20db:_[_0x1013('0x97')](_0x4c20db);for(var _0x6e3b10 in _0x17a81a){if(_0x17a81a[_0x1013('0x98')](_0x6e3b10)){if(_0x17a81a[_0x6e3b10]&&_[_0x1013('0x99')](_0x17a81a[_0x6e3b10])){if(_['includes'](recursiveMapAttributes,_0x6e3b10)){_0x17a81a[_0x6e3b10]=this[_0x1013('0x9a')](_0x17a81a[_0x6e3b10]);}else{_0x17a81a[_0x6e3b10]=this[_0x1013('0x9b')](_0x17a81a[_0x6e3b10]);}}}}return _0x17a81a;};AGIVertices[_0x1013('0xf')][_0x1013('0x9c')]=function(_0x5365a8){for(var _0x472077 in _0x5365a8){if(_0x5365a8[_0x1013('0x98')](_0x472077)){if(_[_0x1013('0x9d')](_0x5365a8[_0x472077])){this[_0x1013('0x9c')](_0x5365a8[_0x472077]);}else if(_['isArray'](_0x5365a8[_0x472077])){for(var _0x50ba3f=0x0;_0x50ba3f<_0x5365a8[_0x472077]['length'];_0x50ba3f++){this[_0x1013('0x9c')](_0x5365a8[_0x472077][_0x50ba3f]);}}else if(_[_0x1013('0x99')](_0x5365a8[_0x472077])){_0x5365a8[_0x472077]=this[_0x1013('0x9b')](_0x5365a8[_0x472077]);}}}};AGIVertices['prototype'][_0x1013('0x9e')]=function(_0x11be29,_0x4de87b){for(var _0x32c006 in _0x11be29){if(_0x11be29[_0x1013('0x98')](_0x32c006)){if(_[_0x1013('0x9d')](_0x11be29[_0x32c006])){if(!_[_0x1013('0x41')](_0x11be29[_0x32c006])){this[_0x1013('0x9e')](_0x11be29[_0x32c006],util[_0x1013('0x25')]('%s.%s',_0x4de87b,_0x32c006));}}else if(_['isArray'](_0x11be29[_0x32c006])){for(var _0x52fdc0=0x0;_0x52fdc0<_0x11be29[_0x32c006][_0x1013('0x9f')];_0x52fdc0++){this[_0x1013('0x9e')](_0x11be29[_0x32c006][_0x52fdc0],util[_0x1013('0x25')](_0x1013('0xa0'),_0x4de87b,_0x32c006+'['+_0x52fdc0+']'));}}else{if(!_['isNil'](_0x11be29[_0x32c006])){this[_0x1013('0x33')]['setVariable'](util[_0x1013('0x25')]('%s.%s',_0x4de87b,_0x32c006),_0x11be29[_0x32c006]);}}}}};AGIVertices[_0x1013('0xf')][_0x1013('0x9a')]=function(_0x1b412b){try{var _0x1008a9=JSON[_0x1013('0x6a')](_0x1b412b);this[_0x1013('0x9c')](_0x1008a9);return JSON[_0x1013('0x70')](_0x1008a9);}catch(_0x39323b){return this[_0x1013('0x9b')](_0x1b412b);}};AGIVertices[_0x1013('0xf')][_0x1013('0x9b')]=function(_0x445cbc){var _0x2ea69d=_0x445cbc['split']('{');for(var _0x2c4068=0x1;_0x2c4068<_0x2ea69d[_0x1013('0x9f')];_0x2c4068+=0x1){var _0x4f88e7=_0x2ea69d[_0x2c4068][_0x1013('0xa1')]('}');if(_0x4f88e7[_0x1013('0x9f')]>0x1){_0x445cbc=_0x445cbc[_0x1013('0xa2')]('{'+_0x4f88e7[0x0]+'}',this['channel']['getVariable'](_0x4f88e7[0x0])[_0x1013('0xa3')]||_0x4f88e7[0x0]);}}if(_0x2ea69d[_0x1013('0x9f')]===0x1){return _0x445cbc[_0x1013('0x49')]();}return this[_0x1013('0x9b')](_0x445cbc);};AGIVertices['prototype'][_0x1013('0xa4')]=function(_0x188b42,_0x366107){var _0xa5df62=this[_0x1013('0x33')]['getVariable'](_0x188b42);if(_0xa5df62['result']===-0x1){return _0xa5df62;}logger['info'](util[_0x1013('0x25')](_0x1013('0xa5'),_0x366107,_0xa5df62[_0x1013('0xa3')]));return this[_0x1013('0x33')][_0x1013('0xa6')](_0x366107,_0xa5df62[_0x1013('0xa3')]);};AGIVertices[_0x1013('0xf')][_0x1013('0x85')]=function(_0xafb79f){return _0xafb79f&&_0xafb79f!=='0'&&_0xafb79f!=='-1'&&_0xafb79f!=='';};AGIVertices['prototype']['maxRetry']=function(_0x2c4920){this[_0x1013('0x32')][_0x1013('0xa7')](this,_0x2c4920,'-');_0x2c4920['retry']=_0x2c4920[_0x1013('0xa8')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x1013('0xf')][_0x1013('0xa9')]=function(_0x24ae57){logger['info'](util['format'](_0x1013('0xaa'),_0x24ae57['label']));if(!this[_0x1013('0x85')](_0x24ae57[_0x1013('0x5b')])){return this['channel']['noop'](_0x1013('0xab'));}var _0x18ea3c='\x22'+_0x24ae57['text']+'\x22';if(this[_0x1013('0x85')](_0x24ae57[_0x1013('0x76')])){_0x18ea3c+=','+_0x24ae57[_0x1013('0x76')];}var _0xe85f6c=this[_0x1013('0x33')][_0x1013('0x57')](_0x1013('0xac'),_0x18ea3c);if(_0xe85f6c[_0x1013('0xad')]===-0x1){return _0xe85f6c;}return this[_0x1013('0x33')][_0x1013('0xae')](util['format'](_0x1013('0xaf'),_0x18ea3c));};AGIVertices['prototype']['mrcprecog']=function(_0xad60f4){logger['info'](util[_0x1013('0x25')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0xad60f4['label']));if(!this[_0x1013('0x85')](_0xad60f4[_0x1013('0xb0')])){return this[_0x1013('0x33')][_0x1013('0xae')](_0x1013('0xb1'));}var _0xb31f99=_0xad60f4[_0x1013('0xb0')];if(this[_0x1013('0x85')](_0xad60f4['options'])){_0xb31f99+=','+_0xad60f4[_0x1013('0x76')];}var _0x22eeac=this['channel'][_0x1013('0x57')](_0x1013('0xb2'),_0xb31f99);if(_0x22eeac[_0x1013('0xad')]===-0x1){return _0x22eeac;}var _0x161390=this[_0x1013('0xa4')](_0x1013('0xb3'),_0x1013('0xb4'));if(_0x161390[_0x1013('0xad')]===-0x1){return _0x161390;}var _0x2b4513=this[_0x1013('0xa4')](_0x1013('0xb5'),_0x1013('0xb6'));if(_0x2b4513[_0x1013('0xad')]===-0x1){return _0x2b4513;}var _0x44c8e9=this['getAndSetVariable'](_0x1013('0xb7'),_0x1013('0xb8'));if(_0x44c8e9[_0x1013('0xad')]===-0x1){return _0x44c8e9;}return this[_0x1013('0x33')]['noop'](util[_0x1013('0x25')](_0x1013('0xb9'),_0xb31f99));};AGIVertices['prototype'][_0x1013('0xba')]=function(_0x5edbe7){logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0xbb'),_0x5edbe7[_0x1013('0xbc')]));return this[_0x1013('0x33')][_0x1013('0xba')]([_0x5edbe7['command'],_0x5edbe7[_0x1013('0xbd')]]);};AGIVertices[_0x1013('0xf')][_0x1013('0xbe')]=function(_0xe9fa8c){logger['info'](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0xe9fa8c[_0x1013('0xbc')]));if(this[_0x1013('0x85')](_0xe9fa8c[_0x1013('0x65')])){logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0xbf'),_0xe9fa8c['timeout']));var _0x2921b5=this['channel']['wait'](_0xe9fa8c[_0x1013('0x65')]);if(_0x2921b5[_0x1013('0xad')]===-0x1){return _0x2921b5;}}return this[_0x1013('0x33')][_0x1013('0xbe')]();};AGIVertices[_0x1013('0xf')][_0x1013('0xc0')]=function(_0x154902){logger[_0x1013('0x2b')](util[_0x1013('0x25')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x154902[_0x1013('0xbc')]));if(!this[_0x1013('0x85')](_0x154902['list_id'])){return this['channel'][_0x1013('0x29')](_0x154902,'no\x20list\x20selected');}_0x154902[_0x1013('0x47')]=moment();if(this['isConfigured'](_0x154902[_0x1013('0xc1')])){_0x154902['scheduledAt']=moment()[_0x1013('0xc2')](_0x154902[_0x1013('0xc1')],_0x1013('0xc3'));}if(!this[_0x1013('0x85')](_0x154902['callback_priority'])){_0x154902['callback_priority']=0x2;}this[_0x1013('0x40')]['sync'](this,_0x154902);return this[_0x1013('0x33')][_0x1013('0xae')](util[_0x1013('0x25')](_0x1013('0xc4'),_0x154902[_0x1013('0x45')],_0x154902[_0x1013('0x46')],_0x154902[_0x1013('0x47')]));};AGIVertices[_0x1013('0xf')][_0x1013('0xc5')]=function(_0x91e6d7){logger[_0x1013('0x2b')](util[_0x1013('0x25')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x91e6d7[_0x1013('0xbc')]));var _0x213f69=this['channel'][_0x1013('0x57')](_0x91e6d7[_0x1013('0xc6')],_0x91e6d7['options']);if(_0x213f69[_0x1013('0xad')]===-0x1){return _0x213f69;}return this[_0x1013('0x33')][_0x1013('0xae')](util[_0x1013('0x25')](_0x1013('0xc7'),_0x91e6d7[_0x1013('0xc6')],_0x91e6d7['options']));};AGIVertices[_0x1013('0xf')][_0x1013('0xc8')]=function(_0x4a04b9){logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0xc9'),_0x4a04b9[_0x1013('0xbc')]));if(!this[_0x1013('0x85')](_0x4a04b9['text'])){return this[_0x1013('0x33')]['noop'](_0x1013('0xab'));}var _0x11f6fe='\x22'+_0x4a04b9[_0x1013('0x5b')]+'\x22';if(this['isConfigured'](_0x4a04b9['options'])){_0x11f6fe+=','+_0x4a04b9[_0x1013('0x76')];}var _0x51b48d=this['channel']['exec'](_0x1013('0xac'),_0x11f6fe);if(_0x51b48d['result']===-0x1){return _0x51b48d;}return this[_0x1013('0x33')]['noop'](util[_0x1013('0x25')]('Executed\x20command\x20MRCPSynth\x20%s',_0x11f6fe));};AGIVertices[_0x1013('0xf')][_0x1013('0xca')]=function(_0x1217ec){logger['info'](util['format'](_0x1013('0xcb'),_0x1217ec[_0x1013('0xbc')]));if(!this['isConfigured'](_0x1217ec['text'])){return this['channel'][_0x1013('0xae')](_0x1013('0xab'));}var _0x82b2aa='\x22'+_0x1217ec[_0x1013('0x5b')]+'\x22';if(this['isConfigured'](_0x1217ec[_0x1013('0x76')])){_0x82b2aa+=','+_0x1217ec[_0x1013('0x76')];}var _0x5c4659=this['channel'][_0x1013('0x57')](_0x1013('0xac'),_0x82b2aa);if(_0x5c4659[_0x1013('0xad')]===-0x1){return _0x5c4659;}return this[_0x1013('0x33')][_0x1013('0xae')](util[_0x1013('0x25')](_0x1013('0xaf'),_0x82b2aa));};AGIVertices[_0x1013('0xf')][_0x1013('0xcc')]=function(_0x4003f9){logger[_0x1013('0x2b')](util['format'](_0x1013('0xcd'),_0x4003f9[_0x1013('0xbc')]));if(!this[_0x1013('0x85')](_0x4003f9[_0x1013('0xb0')])){return this[_0x1013('0x33')][_0x1013('0xae')](_0x1013('0xb1'));}var _0x237b1d=_0x4003f9[_0x1013('0xb0')];if(this[_0x1013('0x85')](_0x4003f9[_0x1013('0x76')])){_0x237b1d+=','+_0x4003f9[_0x1013('0x76')];}var _0x8a925c=this['channel']['exec']('MRCPRecog',_0x237b1d);if(_0x8a925c['result']===-0x1){return _0x8a925c;}var _0x26ea4e=this[_0x1013('0xa4')]('RECOG_CONFIDENCE()',_0x1013('0xce'));if(_0x26ea4e[_0x1013('0xad')]===-0x1){return _0x26ea4e;}var _0x56227f=this[_0x1013('0xa4')]('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x56227f[_0x1013('0xad')]===-0x1){return _0x56227f;}var _0x2fb602=this[_0x1013('0xa4')](_0x1013('0xb7'),_0x1013('0xcf'));if(_0x2fb602[_0x1013('0xad')]===-0x1){return _0x2fb602;}return this['channel']['noop'](util[_0x1013('0x25')](_0x1013('0xb9'),_0x237b1d));};AGIVertices[_0x1013('0xf')][_0x1013('0xd0')]=function(_0x115054){logger['info'](util[_0x1013('0x25')](_0x1013('0xd1'),_0x115054[_0x1013('0xbc')]));if(!this[_0x1013('0x85')](_0x115054[_0x1013('0xb0')])){return this['channel'][_0x1013('0xae')]('no\x20grammar\x20configured');}var _0x2ef2c6=_0x115054[_0x1013('0xb0')];if(this[_0x1013('0x85')](_0x115054['options'])){_0x2ef2c6+=','+_0x115054['options'];}var _0x1c9738=this[_0x1013('0x33')][_0x1013('0x57')](_0x1013('0xb2'),_0x2ef2c6);if(_0x1c9738['result']===-0x1){return _0x1c9738;}var _0x283a8b=this[_0x1013('0xa4')](_0x1013('0xb3'),_0x1013('0xd2'));if(_0x283a8b[_0x1013('0xad')]===-0x1){return _0x283a8b;}var _0x2284a9=this[_0x1013('0xa4')](_0x1013('0xb5'),_0x1013('0xd3'));if(_0x2284a9[_0x1013('0xad')]===-0x1){return _0x2284a9;}var _0xce3d11=this[_0x1013('0xa4')](_0x1013('0xb7'),_0x1013('0xd4'));if(_0xce3d11[_0x1013('0xad')]===-0x1){return _0xce3d11;}return this['channel'][_0x1013('0xae')](util['format'](_0x1013('0xb9'),_0x2ef2c6));};AGIVertices['prototype'][_0x1013('0xd5')]=function(_0xa001f5){logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0xd6'),_0xa001f5[_0x1013('0xbc')]));if(!this[_0x1013('0x85')](_0xa001f5[_0x1013('0xd7')])){return this[_0x1013('0x33')][_0x1013('0x29')](_0xa001f5,_0x1013('0xd8'));}var _0x2d9e3d=this['getSquareOdbc'][_0x1013('0xa7')](this,_0xa001f5[_0x1013('0xd7')]);if(!_0x2d9e3d){return this[_0x1013('0x33')][_0x1013('0x29')](_0xa001f5,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0xa001f5[_0x1013('0xd9')])){return this[_0x1013('0x33')][_0x1013('0x29')](_0xa001f5,_0x1013('0xda'));}var _0x17327f=_0xa001f5['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x1013('0x33')][_0x1013('0xae')](util[_0x1013('0x25')]('query:\x20%s',_0x17327f));var _0x19da18=this[_0x1013('0x27')]['sync'](this,_0x2d9e3d,_0x17327f);this['createSquareDetailsReport']['sync'](this,_0xa001f5,_0x17327f);if(!this['isConfigured'](_0xa001f5[_0x1013('0xdb')])){return this[_0x1013('0x33')][_0x1013('0xae')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x157914=this[_0x1013('0x10')][_0x1013('0xa7')](this,_0xa001f5['variable_id']);if(!_0x157914){return this[_0x1013('0x33')][_0x1013('0x29')](_0xa001f5,_0x1013('0xdc'));}var _0x1de7c6=this;_0x19da18[_0x1013('0xdd')](function(_0x5e11d7,_0x172099){Object[_0x1013('0xde')](_0x5e11d7)[_0x1013('0xdd')](function(_0x1df86c){_0x1de7c6[_0x1013('0x33')][_0x1013('0xa6')](util['format'](_0x1013('0xdf'),_0x157914,_0x172099,_0x1df86c),_0x5e11d7[_0x1df86c]);});});this[_0x1013('0x33')][_0x1013('0xa6')](util[_0x1013('0x25')]('%s_ROWS_COUNT',_0x157914),_0x19da18['length']);return this['channel'][_0x1013('0xae')](util[_0x1013('0x25')](_0x1013('0xe0'),_0x157914));};AGIVertices[_0x1013('0xf')][_0x1013('0xe1')]=function(_0x5ba343){logger[_0x1013('0xe2')](util[_0x1013('0x25')](_0x1013('0xe3'),_0x5ba343[_0x1013('0xbc')]));if(!this[_0x1013('0x85')](_0x5ba343[_0x1013('0xe4')])){return this[_0x1013('0x33')][_0x1013('0x29')](_0x5ba343,'no\x20user\x20selected');}var _0x1bd0f2=this[_0x1013('0x18')][_0x1013('0xa7')](this,_0x5ba343[_0x1013('0xe4')]);if(!_0x1bd0f2){return this['channel'][_0x1013('0x29')](_0x5ba343,_0x1013('0xe5'));}var _0x24aa48=this[_0x1013('0x33')][_0x1013('0x57')](_0x1013('0xe6'),[util[_0x1013('0x25')](_0x1013('0xe7'),_0x1bd0f2),_0x5ba343['timeout'],_0x5ba343[_0x1013('0xe8')],_0x5ba343[_0x1013('0x63')]]);if(_0x24aa48[_0x1013('0xad')]===-0x1){return _0x24aa48;}return this[_0x1013('0x33')]['noop'](util['format']('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x1013('0xf')][_0x1013('0xe9')]=function(_0x41a9be){logger[_0x1013('0x2b')](util[_0x1013('0x25')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x41a9be[_0x1013('0xbc')]));if(!this[_0x1013('0x85')](_0x41a9be['key'])){return this[_0x1013('0x33')]['noop'](_0x1013('0xea'));}if(!this['isConfigured'](_0x41a9be['text'])){return this[_0x1013('0x33')]['noop'](_0x1013('0xab'));}this['channel'][_0x1013('0xeb')]=!![];this[_0x1013('0x32')](_0x41a9be);this[_0x1013('0x3f')](_0x41a9be['text'],'in','','');this[_0x1013('0x33')][_0x1013('0xae')](util['format'](_0x1013('0xec'),_0x41a9be[_0x1013('0x5b')]));var _0x3e83ca=this[_0x1013('0x77')][_0x1013('0xa7')](this,_0x41a9be);if(_0x3e83ca){for(var _0x40eebb in _0x3e83ca){if(_0x3e83ca[_0x1013('0x98')](_0x40eebb)){this[_0x1013('0x33')][_0x1013('0xa6')](util[_0x1013('0x25')](_0x1013('0xed'),_0x40eebb['toUpperCase']()),_0x3e83ca[_0x40eebb]);}}this[_0x1013('0x3f')](_0x3e83ca[_0x1013('0xee')],_0x1013('0xef'),_0x1013('0xe9'),'');return this['channel']['noop'](util['format'](_0x1013('0xf0'),_0x3e83ca[_0x1013('0xee')]));}return this[_0x1013('0x33')][_0x1013('0x29')](_0x41a9be,_0x1013('0xf1'));};AGIVertices['prototype'][_0x1013('0xf2')]=function(_0xed6c1b){logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0xf3'),_0xed6c1b[_0x1013('0xbc')]));if(!this['isConfigured'](_0xed6c1b[_0x1013('0x7b')])){return this[_0x1013('0x33')][_0x1013('0xae')](_0x1013('0xf4'));}if(!this[_0x1013('0x85')](_0xed6c1b[_0x1013('0x7c')])){return this[_0x1013('0x33')][_0x1013('0xae')](_0x1013('0xf5'));}if(!this[_0x1013('0x85')](_0xed6c1b[_0x1013('0x7d')])){return this[_0x1013('0x33')][_0x1013('0xae')](_0x1013('0xf6'));}if(!this['isConfigured'](_0xed6c1b[_0x1013('0x7e')])){return this[_0x1013('0x33')][_0x1013('0xae')](_0x1013('0xf7'));}if(!this[_0x1013('0x85')](_0xed6c1b[_0x1013('0x5b')])){return this[_0x1013('0x33')][_0x1013('0xae')](_0x1013('0xab'));}this[_0x1013('0x33')][_0x1013('0xeb')]=!![];this[_0x1013('0x32')](_0xed6c1b);this[_0x1013('0x3f')](_0xed6c1b[_0x1013('0x5b')],'in','','');this['channel'][_0x1013('0xae')](util[_0x1013('0x25')](_0x1013('0xf8'),_0xed6c1b['text']));var _0x18fb59=this['googleDialogflowV2'][_0x1013('0xa7')](this,_0xed6c1b);if(_0x18fb59){for(var _0x460c1f in _0x18fb59){if(_0x18fb59[_0x1013('0x98')](_0x460c1f)){if(_0x460c1f!=='providerResponse'){this[_0x1013('0x33')][_0x1013('0xa6')](util[_0x1013('0x25')](_0x1013('0xed'),_0x460c1f[_0x1013('0xf9')]()),_0x18fb59[_0x460c1f]);}}}this['createSquareMessage'](_0x18fb59['speech'],_0x1013('0xef'),_0x1013('0xf2'),_0x18fb59[_0x1013('0xfa')]);return this[_0x1013('0x33')][_0x1013('0xae')](util['format'](_0x1013('0xfb'),_0x18fb59['speech']));}return this[_0x1013('0x33')]['error'](_0xed6c1b,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x1013('0xf')][_0x1013('0xfc')]=function(_0x5a0588){logger[_0x1013('0x2b')](util[_0x1013('0x25')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x5a0588[_0x1013('0xbc')]));if(!this[_0x1013('0x85')](_0x5a0588[_0x1013('0xfd')])){return this[_0x1013('0x33')]['noop'](_0x1013('0xfe'));}if(!this[_0x1013('0x85')](_0x5a0588[_0x1013('0xff')])){return this[_0x1013('0x33')][_0x1013('0xae')]('no\x20username\x20configured');}if(!this[_0x1013('0x85')](_0x5a0588[_0x1013('0x100')])){return this[_0x1013('0x33')]['noop'](_0x1013('0x101'));}if(!this[_0x1013('0x85')](_0x5a0588[_0x1013('0x102')])){return this[_0x1013('0x33')][_0x1013('0xae')](_0x1013('0xab'));}this[_0x1013('0x33')][_0x1013('0xeb')]=!![];this[_0x1013('0x32')](_0x5a0588);this[_0x1013('0x3f')](_0x5a0588[_0x1013('0x5b')],'in','','');this[_0x1013('0x33')]['noop'](util[_0x1013('0x25')](_0x1013('0x103'),_0x5a0588[_0x1013('0x5b')]));var _0x1dd653=this['sestekNDA'][_0x1013('0xa7')](this,_0x5a0588);if(_0x1dd653){for(var _0x221387 in _0x1dd653){if(_0x1dd653[_0x1013('0x98')](_0x221387)){this[_0x1013('0x33')][_0x1013('0xa6')](util['format'](_0x1013('0x104'),_0x221387['toUpperCase']()),_0x1dd653[_0x221387]);}}this['createSquareMessage'](_0x1dd653[_0x1013('0xee')],'out',_0x1013('0xfc'),'');if(_0x1dd653['audiofile']){this['channel'][_0x1013('0xae')](util[_0x1013('0x25')](_0x1013('0x105'),_0x1dd653[_0x1013('0x106')]));var _0x329083=this[_0x1013('0x33')][_0x1013('0x107')](_0x1dd653[_0x1013('0x106')]);try{fs[_0x1013('0x108')](_0x1dd653[_0x1013('0x106')]+_0x1013('0x109'));}catch(_0x4eeecf){logger[_0x1013('0x29')](_0x4eeecf);}return _0x329083;}else{return this[_0x1013('0x33')][_0x1013('0xae')](util[_0x1013('0x25')](_0x1013('0x10a'),_0x1dd653[_0x1013('0xee')]));}}return this[_0x1013('0x33')]['error'](_0x5a0588,_0x1013('0x10b'));};AGIVertices[_0x1013('0xf')][_0x1013('0x10c')]=function(_0xbe3bc5){logger['info'](util[_0x1013('0x25')](_0x1013('0x10d'),_0xbe3bc5[_0x1013('0xbc')]));return this[_0x1013('0x33')][_0x1013('0xae')]('end');};AGIVertices[_0x1013('0xf')]['ext_dial']=function(_0x16a4b1){logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0x10e'),_0x16a4b1[_0x1013('0xbc')]));var _0x2cbba0='';if(_0x16a4b1[_0x1013('0x10f')]){if(!this['isConfigured'](_0x16a4b1[_0x1013('0x10f')])){return this[_0x1013('0x33')][_0x1013('0x29')](_0x16a4b1,'no\x20trunk\x20selected');}else{var _0x101086=parseInt(_0x16a4b1[_0x1013('0x10f')],0xa);if(isNaN(_0x101086)){_0x2cbba0=_0x16a4b1[_0x1013('0x10f')];}else{_0x2cbba0=this['getTrunk']['sync'](this,_0x16a4b1[_0x1013('0x10f')]);if(!_0x2cbba0){return this[_0x1013('0x33')][_0x1013('0x29')](_0x16a4b1,'no\x20trunk\x20found');}}}}else if(_0x16a4b1['trunk_name']){_0x2cbba0=_0x16a4b1[_0x1013('0x110')];}else{return this['channel'][_0x1013('0x29')](_0x16a4b1,_0x1013('0x111'));}var _0x52a2aa=this[_0x1013('0x33')][_0x1013('0x57')](_0x1013('0xe6'),[util[_0x1013('0x25')](_0x1013('0x112'),_0x2cbba0,_0x16a4b1['phone']),_0x16a4b1[_0x1013('0x65')],_0x16a4b1[_0x1013('0xe8')],_0x16a4b1['url']]);if(_0x52a2aa[_0x1013('0xad')]===-0x1){return _0x52a2aa;}return this[_0x1013('0x33')][_0x1013('0xae')](util['format'](_0x1013('0x113'),_0x1013('0xe6')));};AGIVertices[_0x1013('0xf')][_0x1013('0x114')]=function(_0x47b683){logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0x115'),_0x47b683['label']));return this[_0x1013('0x33')]['noop'](_0x1013('0x114'));};AGIVertices[_0x1013('0xf')][_0x1013('0x116')]=function(_0x548fa3){logger[_0x1013('0x2b')](util[_0x1013('0x25')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x548fa3[_0x1013('0xbc')]));if(_0x548fa3[_0x1013('0x117')]===0x0){return this[_0x1013('0xa8')](_0x548fa3);}_0x548fa3[_0x1013('0x117')]-=0x1;if(!this[_0x1013('0x85')](_0x548fa3[_0x1013('0x118')])){return this[_0x1013('0x33')]['error'](_0x548fa3,_0x1013('0x119'));}var _0xc621a5=this[_0x1013('0x1c')][_0x1013('0xa7')](this,_0x548fa3['file_id']);if(!_0xc621a5){return this[_0x1013('0x33')]['error'](_0x548fa3,'no\x20file\x20audio\x20found');}if(!this['isConfigured'](_0x548fa3['variable_id'])){return this[_0x1013('0x33')][_0x1013('0x29')](_0x1013('0x11a'));}var _0x34e805=this[_0x1013('0x33')][_0x1013('0x11b')](_0xc621a5,_0x548fa3[_0x1013('0x11c')],_0x548fa3[_0x1013('0x11d')]);var _0x5122c2=_0x34e805['result']?_0x34e805[_0x1013('0xad')][_0x1013('0x49')]():'';logger[_0x1013('0x2b')](_0x1013('0x11e'),JSON[_0x1013('0x70')](_0x34e805));if(_0x34e805['result']===-0x1){this[_0x1013('0x32')]['sync'](this,_0x548fa3,_0x5122c2);return _0x34e805;}else if(_0x34e805[_0x1013('0xa3')]===_0x1013('0x65')){_0x34e805['result']=_0x5122c2[_0x1013('0x9f')]>=parseInt(_0x548fa3['mindigit'])?'x':'i';}else{_0x34e805[_0x1013('0xad')]=_0x5122c2[_0x1013('0x9f')]>=parseInt(_0x548fa3[_0x1013('0x11f')])&&_0x5122c2['length']<=parseInt(_0x548fa3[_0x1013('0x11d')])?'x':'i';}var _0x5499aa=this[_0x1013('0x10')][_0x1013('0xa7')](this,_0x548fa3[_0x1013('0xdb')]);if(!_0x5499aa){return this[_0x1013('0x33')][_0x1013('0x29')](_0x548fa3,'no\x20variable\x20found');}this['channel'][_0x1013('0xa6')](_0x5499aa,_0x5122c2);if(this[_0x1013('0x85')](_0x548fa3['hiddendigitsnum'])){var _0x3a96cf=parseInt(_0x548fa3[_0x1013('0x120')],0xa);var _0x56749d=rs[_0x1013('0x121')]({'charset':'*','length':_0x3a96cf});var _0x26abe1=_0x5122c2[_0x1013('0x9f')];if(_0x26abe1>0x0){if(_0x26abe1>_0x3a96cf){this[_0x1013('0x32')]['sync'](this,_0x548fa3,_0x548fa3[_0x1013('0x122')]===_0x1013('0x123')?_0x56749d+_0x5122c2[_0x1013('0x124')](_0x3a96cf):_0x5122c2['substr'](0x0,_0x26abe1-_0x3a96cf)+_0x56749d);}else{this[_0x1013('0x32')]['sync'](this,_0x548fa3,rs[_0x1013('0x121')]({'charset':'*','length':_0x26abe1}));}}else{this[_0x1013('0x32')][_0x1013('0xa7')](this,_0x548fa3,'');}}else{this['createSquareDetailsReport'][_0x1013('0xa7')](this,_0x548fa3,_0x5122c2);}return _0x34e805;};AGIVertices['prototype'][_0x1013('0xc')]=function(_0xdebf1c){logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0x125'),_0xdebf1c[_0x1013('0xbc')]));return this[_0x1013('0x116')](_0xdebf1c);};AGIVertices[_0x1013('0xf')][_0x1013('0x126')]=function(_0x10008b){logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0x127'),_0x10008b[_0x1013('0xbc')]));this['createSquareDetailsReport'][_0x1013('0xa7')](this,_0x10008b,_0x10008b[_0x1013('0x128')]);return this[_0x1013('0x33')][_0x1013('0xae')](util[_0x1013('0x25')](_0x1013('0x129'),_0x10008b[_0x1013('0x128')]));};AGIVertices[_0x1013('0xf')][_0x1013('0x12a')]=function(_0xcc30b1){logger['info'](util[_0x1013('0x25')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0xcc30b1[_0x1013('0xbc')]));if(!this[_0x1013('0x85')](_0xcc30b1[_0x1013('0x88')])||!this[_0x1013('0x85')](_0xcc30b1[_0x1013('0x89')])){return this['channel'][_0x1013('0xae')](_0x1013('0x12b'));}if(!this[_0x1013('0x85')](_0xcc30b1[_0x1013('0x5b')])){return this[_0x1013('0x33')][_0x1013('0xae')]('no\x20text\x20configured');}this[_0x1013('0x33')][_0x1013('0xae')](util[_0x1013('0x25')]('Trying\x20aws\x20Polly\x20%s',_0xcc30b1['text']));var _0x208988=this[_0x1013('0x87')][_0x1013('0xa7')](this,_0xcc30b1);if(_0x208988){this['channel']['noop'](util['format'](_0x1013('0x12c'),_0x208988));var _0x2ee6f4=this[_0x1013('0x33')][_0x1013('0x107')](_0x208988);try{fs[_0x1013('0x108')](_0x208988+'.wav');}catch(_0x33ef33){logger[_0x1013('0x29')](_0x33ef33);}return _0x2ee6f4;}return this[_0x1013('0x33')][_0x1013('0x29')](_0xcc30b1,_0x1013('0x12d'));};AGIVertices[_0x1013('0xf')][_0x1013('0x12e')]=function(_0x4273f2){logger[_0x1013('0x2b')](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x4273f2[_0x1013('0xbc')]));if(!this[_0x1013('0x85')](_0x4273f2[_0x1013('0x88')])||!this['isConfigured'](_0x4273f2[_0x1013('0x89')])){return this[_0x1013('0x33')][_0x1013('0xae')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x1013('0x85')](_0x4273f2[_0x1013('0x90')])){return this['channel'][_0x1013('0xae')](_0x1013('0x12f'));}if(!this[_0x1013('0x85')](_0x4273f2[_0x1013('0x5b')])){return this[_0x1013('0x33')]['noop'](_0x1013('0xab'));}this[_0x1013('0x33')][_0x1013('0xeb')]=!![];this['createSquareDetailsReport'](_0x4273f2);this[_0x1013('0x3f')](_0x4273f2['text'],'in','','');this['channel'][_0x1013('0xae')](util['format'](_0x1013('0x130'),_0x4273f2[_0x1013('0x5b')]));var _0x4dd1d2=this[_0x1013('0x8e')][_0x1013('0xa7')](this,_0x4273f2);if(_0x4dd1d2){for(var _0x55a834 in _0x4dd1d2){if(_0x4dd1d2['hasOwnProperty'](_0x55a834)&&_[_0x1013('0x99')](_0x4dd1d2[_0x55a834])){this[_0x1013('0x33')][_0x1013('0xa6')](util[_0x1013('0x25')](_0x1013('0x131'),_0x55a834[_0x1013('0xf9')]()),_0x4dd1d2[_0x55a834]);}}if(_[_0x1013('0x4f')](_0x4dd1d2[_0x1013('0x74')])){return this[_0x1013('0x33')][_0x1013('0xae')](_0x1013('0x132'));}else{this['createSquareMessage'](_0x4dd1d2[_0x1013('0x74')],'out',_0x1013('0x133'),'');return this[_0x1013('0x33')][_0x1013('0xae')](util['format'](_0x1013('0x134'),_0x4dd1d2[_0x1013('0x74')]));}}return this['channel'][_0x1013('0x29')](_0x4273f2,_0x1013('0x135'));};AGIVertices[_0x1013('0xf')][_0x1013('0x136')]=function(_0xed5aee){logger[_0x1013('0x2b')](util['format'](_0x1013('0x137'),_0xed5aee[_0x1013('0xbc')],_0xed5aee[_0x1013('0x65')]));if(!this['isConfigured'](_0xed5aee[_0x1013('0x78')])){return this[_0x1013('0x33')][_0x1013('0xae')](_0x1013('0xea'));}var _0x277869=_0x1013('0x138');var _0x33dbde=util[_0x1013('0x25')](_0x1013('0x139'),FILES_PATH,rs['generate'](0x4));var _0x1d9123=util[_0x1013('0x25')]('%s.%s',_0x33dbde,_0x277869);var _0x25acf7=!![];if(_0xed5aee[_0x1013('0x13a')]===_0x1013('0x13b')){_0x25acf7=![];}var _0x4496f5=this[_0x1013('0x33')]['recordFile'](_0x33dbde,_0x277869,_0xed5aee[_0x1013('0x13c')],_0xed5aee['timeout'],undefined,_0x25acf7);if(_0x4496f5[_0x1013('0xad')]!==-0x1){this[_0x1013('0x33')][_0x1013('0xae')](util[_0x1013('0x25')]('google\x20%s\x20file\x20created',_0x1d9123));var _0x1d1021=this[_0x1013('0x91')][_0x1013('0xa7')](this,_0xed5aee,_0x1d9123);if(_0x1d1021){for(var _0x177705 in _0x1d1021){if(_0x1d1021[_0x1013('0x98')](_0x177705)){this[_0x1013('0x33')][_0x1013('0xa6')](util[_0x1013('0x25')]('GOOGLE_ASR_%s',_0x177705[_0x1013('0xf9')]()),_0x1d1021[_0x177705]);}}return this[_0x1013('0x33')]['noop'](util['format'](_0x1013('0x13d'),JSON[_0x1013('0x70')](_0x1d1021)));}}return _0x4496f5;};AGIVertices[_0x1013('0xf')][_0x1013('0x13e')]=function(_0x1a2746){logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0x13f'),_0x1a2746[_0x1013('0xbc')]));if(!this[_0x1013('0x85')](_0x1a2746[_0x1013('0x140')])){return this[_0x1013('0x33')][_0x1013('0xae')](_0x1013('0x141'));}if(!this[_0x1013('0x85')](_0x1a2746[_0x1013('0x94')])){return this['channel']['noop'](_0x1013('0x142'));}var _0x947e09=_0x1013('0x138');var _0x25661b=util[_0x1013('0x25')](_0x1013('0x139'),FILES_PATH,rs[_0x1013('0x121')](0x4));var _0x581b66=util['format'](_0x1013('0xa0'),_0x25661b,_0x947e09);var _0x55bed4=!![];if(_0x1a2746['beep']===_0x1013('0x13b')){_0x55bed4=![];}var _0x10b73e=this[_0x1013('0x33')][_0x1013('0x143')](_0x25661b,_0x947e09,_0x1a2746[_0x1013('0x13c')],_0x1a2746['timeout'],undefined,_0x55bed4);if(_0x10b73e[_0x1013('0xad')]!==-0x1){this[_0x1013('0x33')][_0x1013('0xae')](util[_0x1013('0x25')](_0x1013('0x144'),_0x581b66));var _0x2a2472=this['tildeASR']['sync'](this,_0x1a2746,_0x581b66);if(_0x2a2472){for(var _0x5f5c8f in _0x2a2472){if(_0x2a2472[_0x1013('0x98')](_0x5f5c8f)){this[_0x1013('0x33')]['setVariable'](util[_0x1013('0x25')](_0x1013('0x145'),_0x5f5c8f['toUpperCase']()),_0x2a2472[_0x5f5c8f]);}}return this[_0x1013('0x33')][_0x1013('0xae')](util[_0x1013('0x25')](_0x1013('0x146'),JSON[_0x1013('0x70')](_0x2a2472)));}}return _0x10b73e;};AGIVertices[_0x1013('0xf')][_0x1013('0x147')]=function(_0x2cb679){logger['info'](util['format'](_0x1013('0x148'),_0x2cb679[_0x1013('0xbc')]));return this[_0x1013('0x33')][_0x1013('0x149')](_0x2cb679[_0x1013('0x3a')],_0x2cb679[_0x1013('0x3b')],_0x2cb679[_0x1013('0x3c')]);};AGIVertices[_0x1013('0xf')][_0x1013('0x14a')]=function(_0xf1d074){logger[_0x1013('0x2b')](util['format'](_0x1013('0x14b'),_0xf1d074[_0x1013('0xbc')]));if(!this[_0x1013('0x85')](_0xf1d074[_0x1013('0x14c')])){return this[_0x1013('0x33')][_0x1013('0x29')](_0xf1d074,_0x1013('0x14d'));}try{var _0x590ca4=eval(_0xf1d074[_0x1013('0x14c')])?'true':_0x1013('0x14e');this['channel'][_0x1013('0xae')](util[_0x1013('0x25')](_0x1013('0x14f'),_0xf1d074['condition'],_0x590ca4));return{'code':0xc8,'result':_0x590ca4};}catch(_0x5b29a7){return{'code':0xc8,'result':_0x1013('0x14e')};}};AGIVertices[_0x1013('0xf')][_0x1013('0x150')]=function(_0x20e16f){logger[_0x1013('0x2b')](util['format'](_0x1013('0x151'),_0x20e16f[_0x1013('0xbc')]));if(!this['isConfigured'](_0x20e16f[_0x1013('0x152')])){return this[_0x1013('0x33')][_0x1013('0x29')](_0x20e16f,_0x1013('0x153'));}var _0x48142b=this['getIntervals'][_0x1013('0xa7')](this,_0x20e16f['interval_id']);if(!_0x48142b){return this[_0x1013('0x33')][_0x1013('0x29')](_0x20e16f,'no\x20intervals\x20found');}for(var _0x3e3adb=0x0;_0x3e3adb<_0x48142b[_0x1013('0x9f')];_0x3e3adb+=0x1){var _0x53e648=this['channel'][_0x1013('0x10')](util['format']('IFTIME(%s?true:false)',_0x48142b[_0x3e3adb]));if(_0x53e648[_0x1013('0xad')]===-0x1){return _0x53e648;}logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0x154'),_0x48142b[_0x3e3adb],_0x53e648['extra']));if(_0x53e648[_0x1013('0xa3')]===_0x1013('0x155')){logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0x154'),_0x48142b[_0x3e3adb],_0x1013('0x155')));this['channel']['noop'](util[_0x1013('0x25')]('IFTIME\x20%s\x20%s',_0x48142b[_0x3e3adb],_0x1013('0x155')));return{'code':0xc8,'result':_0x1013('0x155')};}else{logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0x154'),_0x48142b[_0x3e3adb],_0x1013('0x14e')));this[_0x1013('0x33')][_0x1013('0xae')](util[_0x1013('0x25')](_0x1013('0x154'),_0x48142b[_0x3e3adb],_0x1013('0x14e')));}}return{'code':0xc8,'result':_0x1013('0x14e')};};AGIVertices[_0x1013('0xf')][_0x1013('0x156')]=function(_0xd3313){logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0x157'),_0xd3313[_0x1013('0xbc')]));return this[_0x1013('0x33')][_0x1013('0x156')]();};AGIVertices[_0x1013('0xf')]['ispeechasr']=function(_0xeaded){logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0x158'),_0xeaded[_0x1013('0xbc')]));if(!this[_0x1013('0x85')](_0xeaded[_0x1013('0x78')])){return this[_0x1013('0x33')]['noop']('no\x20key\x20configured');}var _0x5eff26=_0x1013('0x138');var _0x44dd81=util[_0x1013('0x25')](_0x1013('0x139'),FILES_PATH,rs[_0x1013('0x121')](0x4));var _0x179fc=util[_0x1013('0x25')]('%s.%s',_0x44dd81,_0x5eff26);var _0x1eac16=!![];if(_0xeaded[_0x1013('0x13a')]==='NOBEEP'){_0x1eac16=![];}var _0x13f146=this[_0x1013('0x33')][_0x1013('0x143')](_0x44dd81,_0x5eff26,_0xeaded[_0x1013('0x13c')],_0xeaded[_0x1013('0x65')],undefined,_0x1eac16);if(_0x13f146[_0x1013('0xad')]!==-0x1){this[_0x1013('0x33')][_0x1013('0xae')](util['format'](_0x1013('0x159'),_0x179fc));var _0x11200a=this['ispeechASR'][_0x1013('0xa7')](this,_0xeaded,_0x179fc);if(_0x11200a){for(var _0x327a18 in _0x11200a){if(_0x11200a['hasOwnProperty'](_0x327a18)){this[_0x1013('0x33')]['setVariable'](util[_0x1013('0x25')]('ISPEECH_ASR_%s',_0x327a18[_0x1013('0xf9')]()),_0x11200a[_0x327a18]);}}return this[_0x1013('0x33')][_0x1013('0xae')](util[_0x1013('0x25')](_0x1013('0x15a'),JSON['stringify'](_0x11200a)));}}return _0x13f146;};AGIVertices['prototype']['ispeechtts']=function(_0xa80562){logger[_0x1013('0x2b')](util[_0x1013('0x25')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0xa80562[_0x1013('0xbc')]));if(!this[_0x1013('0x85')](_0xa80562[_0x1013('0x78')])){return this[_0x1013('0x33')][_0x1013('0xae')]('no\x20key\x20configured');}if(!this[_0x1013('0x85')](_0xa80562[_0x1013('0x5b')])){return this[_0x1013('0x33')][_0x1013('0xae')]('no\x20text\x20configured');}this['channel']['noop'](util['format'](_0x1013('0x15b'),_0xa80562[_0x1013('0x5b')]));var _0x55e949=this[_0x1013('0x80')][_0x1013('0xa7')](this,_0xa80562);if(_0x55e949){this[_0x1013('0x33')][_0x1013('0xae')](util[_0x1013('0x25')]('ispeech\x20%s\x20file\x20created',_0x55e949));var _0x178f88=this['channel'][_0x1013('0x107')](_0x55e949,_0xa80562[_0x1013('0x13c')]);try{fs['unlink'](_0x55e949+_0x1013('0x109'));}catch(_0x2d7387){logger[_0x1013('0x29')](_0x2d7387);}return _0x178f88;}return this[_0x1013('0x33')][_0x1013('0x29')](_0xa80562,_0x1013('0x15c'));};AGIVertices['prototype'][_0x1013('0x15d')]=function(_0x45a988){logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0x15e'),_0x45a988[_0x1013('0xbc')]));if(!this['isConfigured'](_0x45a988['findBy'])){return this[_0x1013('0x33')][_0x1013('0x29')](_0x45a988,_0x1013('0x15f'));}logger[_0x1013('0x2b')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x1013('0x33')][_0x1013('0x37')],_0x45a988[_0x1013('0x160')]));var _0x2ad9b0=this[_0x1013('0x52')][_0x1013('0xa7')](this,_0x45a988['findBy']);if(_0x2ad9b0){logger[_0x1013('0x2b')](util[_0x1013('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x1013('0x33')]['callerid'],_0x45a988['findBy']));this[_0x1013('0x33')][_0x1013('0xae')](util[_0x1013('0x25')](_0x1013('0x161'),this['channel'][_0x1013('0x37')],_0x45a988[_0x1013('0x160')]));return{'code':0xc8,'result':'success'};}else{logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0x162'),this[_0x1013('0x33')][_0x1013('0x37')],_0x45a988['findBy']));this['channel'][_0x1013('0xae')](util[_0x1013('0x25')](_0x1013('0x162'),this[_0x1013('0x33')][_0x1013('0x37')],_0x45a988[_0x1013('0x160')]));return{'code':0xc8,'result':_0x1013('0x163')};}};AGIVertices[_0x1013('0xf')][_0x1013('0x164')]=function(_0x54b109){logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0x165'),_0x54b109['label']));if(!this[_0x1013('0x85')](_0x54b109[_0x1013('0x160')])){return this[_0x1013('0x33')]['error'](_0x54b109,_0x1013('0x15f'));}logger[_0x1013('0x2b')](util[_0x1013('0x25')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x1013('0x37')],_0x54b109[_0x1013('0x160')]));var _0x1f4aad=this[_0x1013('0x50')]['sync'](this,_0x54b109[_0x1013('0x160')]);if(_0x1f4aad){logger[_0x1013('0x2b')](util[_0x1013('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x1013('0x37')],_0x54b109[_0x1013('0x160')]));this[_0x1013('0x33')]['noop'](util[_0x1013('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x1013('0x33')][_0x1013('0x37')],_0x54b109[_0x1013('0x160')]));return{'code':0xc8,'result':_0x1013('0x166')};}else{logger['info'](util[_0x1013('0x25')](_0x1013('0x162'),this[_0x1013('0x33')][_0x1013('0x37')],_0x54b109[_0x1013('0x160')]));this[_0x1013('0x33')][_0x1013('0xae')](util['format'](_0x1013('0x162'),this[_0x1013('0x33')][_0x1013('0x37')],_0x54b109['findBy']));return{'code':0xc8,'result':_0x1013('0x163')};}};AGIVertices[_0x1013('0xf')][_0x1013('0x167')]=function(_0x390b35){logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0x168'),_0x390b35[_0x1013('0xbc')]));if(!this[_0x1013('0x85')](_0x390b35[_0x1013('0x169')])){return this['channel'][_0x1013('0x29')](_0x390b35,_0x1013('0x16a'));}this['channel']['noop'](util['format'](_0x1013('0x16b'),_0x390b35[_0x1013('0x169')]));var _0x10c260=eval(_0x390b35[_0x1013('0x169')]);if(!this[_0x1013('0x85')](_0x390b35[_0x1013('0xdb')])){return this['channel']['noop'](_0x1013('0x11a'));}var _0x292230=this['getVariable'][_0x1013('0xa7')](this,_0x390b35[_0x1013('0xdb')]);if(!_0x292230){return this[_0x1013('0x33')]['error'](_0x390b35,_0x1013('0xdc'));}if(_[_0x1013('0x16c')](_0x10c260)){var _0x29d665=this;_0x10c260[_0x1013('0xdd')](function(_0x30afa5,_0xa2615){_0x29d665[_0x1013('0x33')][_0x1013('0xa6')](util[_0x1013('0x25')](_0x1013('0x16d'),_0x292230,_0xa2615),_0x30afa5);});return this[_0x1013('0x33')]['noop'](util[_0x1013('0x25')](_0x1013('0x16e'),_0x292230));}else{return this['channel'][_0x1013('0xa6')](_0x292230,_0x10c260);}};AGIVertices[_0x1013('0xf')][_0x1013('0x16f')]=function(_0x134e1d){logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0x170'),_0x134e1d[_0x1013('0xbc')]));if(_0x134e1d['retry']===0x0){return this[_0x1013('0xa8')](_0x134e1d);}_0x134e1d[_0x1013('0x117')]-=0x1;if(!this[_0x1013('0x85')](_0x134e1d[_0x1013('0x118')])){return this['channel'][_0x1013('0x29')](_0x134e1d,_0x1013('0x119'));}var _0xe253e0=this['getSound'][_0x1013('0xa7')](this,_0x134e1d[_0x1013('0x118')]);if(!_0xe253e0){return this[_0x1013('0x33')][_0x1013('0x29')](_0x134e1d,_0x1013('0x171'));}var _0x3d6e4c=this[_0x1013('0x33')][_0x1013('0x11b')](_0xe253e0,_0x134e1d[_0x1013('0x11c')],_0x134e1d['digit']);var _0x45684b=_0x3d6e4c[_0x1013('0xad')];if(_0x3d6e4c[_0x1013('0xad')]===-0x1){this[_0x1013('0x32')][_0x1013('0xa7')](this,_0x134e1d,'-1');return _0x3d6e4c;}else if(_0x3d6e4c[_0x1013('0xa3')]===_0x1013('0x65')){_0x3d6e4c[_0x1013('0xad')]=_0x3d6e4c['result']['length']>0x0?_0x3d6e4c[_0x1013('0xad')]:'t';}else if(_[_0x1013('0x41')](_0x3d6e4c[_0x1013('0xad')])){_0x3d6e4c[_0x1013('0xad')]='#';_0x45684b='#';}if(!this['isConfigured'](_0x134e1d[_0x1013('0xdb')])){this[_0x1013('0x33')][_0x1013('0xae')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x15223f=this[_0x1013('0x10')]['sync'](this,_0x134e1d[_0x1013('0xdb')]);if(!_0x15223f){return this['channel'][_0x1013('0x29')](_0x134e1d,_0x1013('0xdc'));}this[_0x1013('0x33')][_0x1013('0xa6')](_0x15223f,_0x45684b);}this[_0x1013('0x32')][_0x1013('0xa7')](this,_0x134e1d,_0x45684b);return _0x3d6e4c;};AGIVertices[_0x1013('0xf')]['noop']=function(_0x4f2732){logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0x172'),_0x4f2732[_0x1013('0xbc')]));return this[_0x1013('0x33')][_0x1013('0xae')](_0x4f2732['output']||_0x4f2732[_0x1013('0xbc')]);};AGIVertices[_0x1013('0xf')][_0x1013('0x173')]=function(_0x563559){logger[_0x1013('0x2b')](util[_0x1013('0x25')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x563559[_0x1013('0xbc')]));if(!this[_0x1013('0x85')](_0x563559[_0x1013('0x160')])){return this[_0x1013('0x33')][_0x1013('0x29')](_0x563559,_0x1013('0x15f'));}logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0x174'),this[_0x1013('0x33')][_0x1013('0x37')],_0x563559['findBy']));var _0x4c9249=this[_0x1013('0x4b')][_0x1013('0xa7')](this,_0x563559[_0x1013('0x175')]);var _0x4d2dea=this[_0x1013('0x4d')]['sync'](this,_0x563559['findBy'],_0x4c9249);if(_0x4d2dea){logger[_0x1013('0x2b')](util[_0x1013('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x1013('0x33')][_0x1013('0x37')],_0x563559[_0x1013('0x160')]));this[_0x1013('0x33')][_0x1013('0xae')](util[_0x1013('0x25')](_0x1013('0x161'),this[_0x1013('0x33')][_0x1013('0x37')],_0x563559[_0x1013('0x160')]));return{'code':0xc8,'result':_0x1013('0x166')};}else{logger['info'](util[_0x1013('0x25')](_0x1013('0x162'),this['channel']['callerid'],_0x563559[_0x1013('0x160')]));this[_0x1013('0x33')][_0x1013('0xae')](util[_0x1013('0x25')](_0x1013('0x161'),this[_0x1013('0x33')][_0x1013('0x37')],_0x563559['findBy']));return{'code':0xc8,'result':_0x1013('0x163')};}};AGIVertices[_0x1013('0xf')][_0x1013('0x176')]=function(_0x339a3b){logger[_0x1013('0x2b')](util['format'](_0x1013('0x177'),_0x339a3b[_0x1013('0xbc')]));if(!this[_0x1013('0x85')](_0x339a3b[_0x1013('0x118')])){return this[_0x1013('0x33')][_0x1013('0x29')](_0x339a3b,_0x1013('0x119'));}var _0x15caea=this['getSound']['sync'](this,_0x339a3b[_0x1013('0x118')]);if(!_0x15caea){return this['channel'][_0x1013('0x29')](_0x339a3b,_0x1013('0x171'));}var _0x2c5cf7=this[_0x1013('0x33')][_0x1013('0x57')](_0x1013('0x178'),[_0x15caea,_0x339a3b[_0x1013('0xe8')]]);if(_0x2c5cf7['result']===-0x1){return _0x2c5cf7;}return this['channel']['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0x1013('0x178'),_0x15caea));};AGIVertices[_0x1013('0xf')][_0x1013('0x179')]=function(_0x38e703){logger[_0x1013('0x2b')](util['format'](_0x1013('0x17a'),_0x38e703[_0x1013('0xbc')]));if(!this[_0x1013('0x85')](_0x38e703['queue_id'])){return this[_0x1013('0x33')][_0x1013('0x29')](_0x38e703,_0x1013('0x17b'));}var _0xf124ef='';var _0xef6a0=parseInt(_0x38e703[_0x1013('0x17c')],0xa);if(isNaN(_0xef6a0)){_0xf124ef=_0x38e703[_0x1013('0x17c')];}else{_0xf124ef=this[_0x1013('0x17d')]['sync'](this,_0x38e703[_0x1013('0x17c')]);if(!_0xf124ef){return this[_0x1013('0x33')][_0x1013('0x29')](_0x38e703,_0x1013('0x17e'));}}var _0x4c46a9='';if(this[_0x1013('0x85')](_0x38e703['file_id'])){var _0x546411=this[_0x1013('0x1c')][_0x1013('0xa7')](this,_0x38e703['file_id']);if(_0x546411){_0x4c46a9=_0x546411;}}this[_0x1013('0x32')][_0x1013('0xa7')](this,_0x38e703,_0xf124ef);if(_0x38e703[_0x1013('0xe8')]['indexOf']('x')<0x0){_0x38e703[_0x1013('0xe8')]+='x';}if(_0x38e703[_0x1013('0xe8')][_0x1013('0x17f')]('X')<0x0){_0x38e703[_0x1013('0xe8')]+='X';}this[_0x1013('0x33')][_0x1013('0xa6')](_0x1013('0x180'),_0xf124ef?_0xf124ef[_0x1013('0x181')]():'');var _0x188aee=this[_0x1013('0x33')][_0x1013('0x57')](_0x1013('0x182'),[_0xf124ef,_0x38e703[_0x1013('0xe8')],_0x38e703[_0x1013('0x63')],_0x4c46a9,_0x38e703[_0x1013('0x65')],_0x38e703[_0x1013('0xba')],_0x38e703[_0x1013('0x183')],_0x38e703[_0x1013('0x184')],'',_0x38e703['position']]);if(_0x188aee[_0x1013('0xad')]===-0x1){return _0x188aee;}return this['channel'][_0x1013('0xae')](util[_0x1013('0x25')](_0x1013('0xc7'),'QUEUE',_0xf124ef));};AGIVertices['prototype'][_0x1013('0x185')]=function(_0x3c888d){logger['info'](util[_0x1013('0x25')](_0x1013('0x186'),_0x3c888d[_0x1013('0xbc')]));var _0x158c97=_0x3c888d[_0x1013('0x187')]||_0x1013('0x138');var _0x1029fe=util['format']('%s_%s',this[_0x1013('0x33')]['uniqueid'],rs[_0x1013('0x121')](0x5));var _0x4e9f0c=util[_0x1013('0x25')](_0x1013('0x188'),FILES_PATH,_0x1029fe,_0x158c97);var _0x48e065=util['format'](_0x1013('0x139'),FILES_PATH,_0x1029fe);this[_0x1013('0x38')][_0x1013('0xa7')](this,_0x3c888d,_0x1029fe,_0x4e9f0c);this['channel'][_0x1013('0xa6')](_0x1013('0x189'),_0x1029fe);logger[_0x1013('0x2b')](_0x1013('0x18a'),_0x48e065,_0x158c97,_0x3c888d[_0x1013('0x18b')],_0x3c888d[_0x1013('0x65')]);return this[_0x1013('0x33')][_0x1013('0x143')](_0x48e065,_0x158c97,_0x3c888d['escape_digits'],_0x3c888d[_0x1013('0x65')],undefined,!![]);};AGIVertices[_0x1013('0xf')][_0x1013('0x18c')]=function(_0x3308d7){logger['info'](util[_0x1013('0x25')](_0x1013('0x18d'),_0x3308d7[_0x1013('0xbc')]));if(!this[_0x1013('0x85')](_0x3308d7[_0x1013('0x63')])){return this[_0x1013('0x33')][_0x1013('0xae')]('no\x20url\x20configured');}var _0x1bbfd3=this[_0x1013('0x62')][_0x1013('0xa7')](this,_0x3308d7);logger[_0x1013('0x2b')](util[_0x1013('0x25')]('Response:',util[_0x1013('0x18e')](_0x1bbfd3,{'showHidden':![],'depth':null})));if(!this[_0x1013('0x85')](_0x3308d7[_0x1013('0xdb')])){return this[_0x1013('0x33')]['noop'](_0x1013('0x18f'));}var _0x4d675c=this[_0x1013('0x10')][_0x1013('0xa7')](this,_0x3308d7['variable_id']);if(!_0x4d675c){return this[_0x1013('0x33')][_0x1013('0x29')](_0x3308d7,_0x1013('0xdc'));}this[_0x1013('0x33')][_0x1013('0xa6')](util['format'](_0x1013('0x190'),_0x4d675c),_0x1bbfd3[_0x1013('0x72')]?_0x1bbfd3[_0x1013('0x72')]:'200');this['channel']['setVariable'](util['format'](_0x1013('0x191'),_0x4d675c),_0x1bbfd3[_0x1013('0x73')]?_0x1bbfd3[_0x1013('0x73')]:'OK');if(_0x1bbfd3['body']){try{this[_0x1013('0x9e')](_0x1bbfd3[_0x1013('0x69')],_0x4d675c);}catch(_0x16041c){logger[_0x1013('0x29')](util[_0x1013('0x25')](_0x1013('0x192'),_0x4d675c));}}return this[_0x1013('0x33')][_0x1013('0xae')](util['format'](_0x1013('0xe0'),_0x4d675c));};AGIVertices['prototype'][_0x1013('0x193')]=function(_0x1b1f66){logger[_0x1013('0x2b')](util[_0x1013('0x25')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x1b1f66[_0x1013('0xbc')]));return this['channel'][_0x1013('0x194')](_0x1b1f66[_0x1013('0x195')][_0x1013('0x58')](/\s+/g,''),_0x1b1f66[_0x1013('0x18b')]);};AGIVertices[_0x1013('0xf')][_0x1013('0x196')]=function(_0x3a232a){logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0x197'),_0x3a232a[_0x1013('0xbc')]));return this['channel']['sayNumber'](_0x3a232a[_0x1013('0x66')][_0x1013('0x58')](/\s+/g,''),_0x3a232a[_0x1013('0x18b')]);};AGIVertices['prototype'][_0x1013('0x198')]=function(_0x499a25){logger[_0x1013('0x2b')](util['format'](_0x1013('0x199'),_0x499a25[_0x1013('0xbc')]));return this[_0x1013('0x33')][_0x1013('0x19a')](_0x499a25[_0x1013('0x5b')],_0x499a25[_0x1013('0x18b')]);};AGIVertices[_0x1013('0xf')][_0x1013('0x19b')]=function(_0x5794db){logger[_0x1013('0x2b')](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x5794db[_0x1013('0xbc')]));if(!this[_0x1013('0x85')](_0x5794db[_0x1013('0x19c')])){return this[_0x1013('0x33')]['noop'](_0x1013('0x19d'));}var _0xce750d=this['getMailAccount'][_0x1013('0xa7')](this,_0x5794db[_0x1013('0x19c')]);if(!_0xce750d||!_0xce750d[_0x1013('0x19e')]){return this[_0x1013('0x33')][_0x1013('0x29')](_0x5794db,_0x1013('0x19f'));}var _0x1e2b35={'from':util[_0x1013('0x25')](_0x1013('0x1a0'),_0xce750d[_0x1013('0x12')],_0xce750d[_0x1013('0x1a1')]||_0xce750d[_0x1013('0x19e')]['user']),'to':_0x5794db['to']||'','cc':_0x5794db['cc']||'','bcc':_0x5794db[_0x1013('0x1a2')]||'','subject':_0x5794db[_0x1013('0x1a3')],'html':_0x5794db['text'],'text':_0x5794db['text']};var _0x6765c={'tls':{'rejectUnauthorized':![]}};if(_0xce750d[_0x1013('0x19e')][_0x1013('0x1a4')]){_0x6765c[_0x1013('0x1a4')]=_0xce750d['Smtp'][_0x1013('0x1a4')];}else{_0x6765c[_0x1013('0x1a5')]=_0xce750d[_0x1013('0x19e')]['host'];_0x6765c[_0x1013('0x1a6')]=_0xce750d[_0x1013('0x19e')][_0x1013('0x1a6')];_0x6765c[_0x1013('0x1a7')]=_0xce750d['Smtp']['secure'];}if(_0xce750d[_0x1013('0x19e')]['authentication']){_0x6765c[_0x1013('0x1a8')]={'user':_0xce750d[_0x1013('0x19e')][_0x1013('0x1a9')],'pass':_0xce750d[_0x1013('0x19e')][_0x1013('0x1aa')]};}if(this[_0x1013('0x85')](_0x5794db[_0x1013('0x1ab')])){}logger[_0x1013('0xe2')]('sendMail\x20message',JSON[_0x1013('0x70')](_0x1e2b35));this[_0x1013('0x32')][_0x1013('0xa7')](this,_0x5794db,_0x5794db[_0x1013('0x19c')]);this[_0x1013('0x33')]['noop'](util['format'](_0x1013('0x1ac'),_0xce750d[_0x1013('0x12')]));this[_0x1013('0x20')]['sync'](this,_0x6765c,_0x1e2b35);return this[_0x1013('0x33')][_0x1013('0xae')](_0x1013('0x1ad'));};AGIVertices[_0x1013('0xf')]['sendFax']=function(_0x3a85f2){logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0x1ae'),_0x3a85f2[_0x1013('0xbc')]));return this['channel']['noop'](_0x1013('0x1af'));};AGIVertices[_0x1013('0xf')][_0x1013('0x1b0')]=function(_0x51f817){logger['info'](util[_0x1013('0x25')](_0x1013('0x1b1'),_0x51f817['label']));if(!this[_0x1013('0x85')](_0x51f817[_0x1013('0x1b2')])){return this[_0x1013('0x33')]['noop'](_0x1013('0x1b3'));}var _0x28cd8e=this[_0x1013('0x1b4')]['sync'](this,_0x51f817[_0x1013('0x1b2')]);if(!_0x28cd8e){return this[_0x1013('0x33')][_0x1013('0x29')](_0x51f817,_0x1013('0x1b5'));}var _0x578147={'body':_0x51f817[_0x1013('0x1b6')],'phone':_0x51f817['to']||'','SmsAccountId':_0x28cd8e['id']};logger[_0x1013('0xe2')]('sendSMS\x20message',JSON[_0x1013('0x70')](_0x578147));this[_0x1013('0x32')][_0x1013('0xa7')](this,_0x51f817,_0x51f817[_0x1013('0x1b2')]);this[_0x1013('0x33')][_0x1013('0xae')](util[_0x1013('0x25')](_0x1013('0x1b7'),_0x28cd8e[_0x1013('0x12')]));this[_0x1013('0x31')][_0x1013('0xa7')](this,_0x578147);return this[_0x1013('0x33')]['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x1013('0x1b8')]=function(_0x27788e){logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0x1b9'),_0x27788e[_0x1013('0xbc')]));if(!this[_0x1013('0x85')](_0x27788e[_0x1013('0xdb')])){return this[_0x1013('0x33')][_0x1013('0x29')](_0x27788e,_0x1013('0x1ba'));}var _0x5d4ad=this[_0x1013('0x10')][_0x1013('0xa7')](this,_0x27788e[_0x1013('0xdb')]);if(!_0x5d4ad){return this[_0x1013('0x33')]['error'](_0x27788e,'no\x20variable\x20found');}return this[_0x1013('0x33')]['setVariable'](_0x5d4ad,_0x27788e[_0x1013('0x1bb')]);};AGIVertices['prototype'][_0x1013('0x1bc')]=function(_0x2b732f){logger[_0x1013('0x2b')](util[_0x1013('0x25')]('Enter\x20in\x20START\x20(%s)\x20block',_0x2b732f[_0x1013('0xbc')]));this['channel'][_0x1013('0xae')](_0x1013('0x1bd'));if(_0x2b732f[_0x1013('0xbe')]===_0x1013('0x1be')){this['channel'][_0x1013('0xae')]('Answer');return this[_0x1013('0x33')][_0x1013('0xbe')]();}return this['channel'][_0x1013('0xae')]('Skipped\x20Answer');};AGIVertices[_0x1013('0xf')][_0x1013('0x1bf')]=function(_0x4a1330){logger[_0x1013('0x2b')](util[_0x1013('0x25')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x4a1330[_0x1013('0xbc')]));if(!this['isConfigured'](_0x4a1330[_0x1013('0x1c0')])){return this[_0x1013('0x33')][_0x1013('0x29')](_0x4a1330,'no\x20subproject\x20selected');}var _0x49440e=this[_0x1013('0x1c1')][_0x1013('0xa7')](this,_0x4a1330[_0x1013('0x1c0')]);if(!this[_0x1013('0x85')](_0x49440e)){return this[_0x1013('0x33')][_0x1013('0x29')](_0x4a1330,util[_0x1013('0x25')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x4a1330['project_id']));}if(_0x49440e===this[_0x1013('0x33')]['arg_1']){return this[_0x1013('0x33')][_0x1013('0x29')](_0x4a1330,_0x1013('0x1c2'));}this[_0x1013('0x32')][_0x1013('0xa7')](this,_0x4a1330,_0x49440e);var _0x5861d4=this[_0x1013('0x33')][_0x1013('0x57')]('AGI',util[_0x1013('0x25')](_0x1013('0x1c3'),config['agi']['host']||_0x1013('0x1c4'),_0x49440e,this['channel']['arg_1']));if(_0x5861d4['result']===-0x1){return _0x5861d4;}return this[_0x1013('0x33')][_0x1013('0xae')](util['format']('Executed\x20command\x20%s\x20%s',_0x1013('0x1c5'),_0x49440e));};AGIVertices[_0x1013('0xf')][_0x1013('0x1c6')]=function(_0x1b6e10){logger[_0x1013('0x2b')](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x1b6e10['label']));var _0x2d220f=this[_0x1013('0x56')][_0x1013('0xa7')](this,_0x1b6e10['command']);this['createSquareDetailsReport'][_0x1013('0xa7')](this,_0x1b6e10,_0x1b6e10[_0x1013('0x1c7')]);if(this[_0x1013('0x85')](_0x1b6e10[_0x1013('0xdb')])){var _0x280026=this[_0x1013('0x10')][_0x1013('0xa7')](this,_0x1b6e10[_0x1013('0xdb')]);if(_0x280026){this['channel'][_0x1013('0xa6')](_0x280026,_0x2d220f);return this[_0x1013('0x33')][_0x1013('0xae')](util['format'](_0x1013('0x1c8'),_0x1b6e10['command'],_0x280026));}}return this[_0x1013('0x33')][_0x1013('0xae')](util[_0x1013('0x25')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x1b6e10[_0x1013('0x1c7')]));};AGIVertices[_0x1013('0xf')][_0x1013('0x1c9')]=function(_0xc71073){logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0x1ca'),_0xc71073[_0x1013('0xbc')]));_0xc71073[_0x1013('0x5b')]=_0xc71073[_0x1013('0x5b')][_0x1013('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0xc71073['apiKey'])){return this[_0x1013('0x33')][_0x1013('0xae')](_0x1013('0x1cb'));}if(!this[_0x1013('0x85')](_0xc71073[_0x1013('0x5b')])){return this[_0x1013('0x33')][_0x1013('0xae')](_0x1013('0xab'));}this[_0x1013('0x33')][_0x1013('0xae')](util['format'](_0x1013('0x1cc'),_0xc71073[_0x1013('0x5b')]));var _0x48871e=this['googleCloudTTS'][_0x1013('0xa7')](this,_0xc71073);if(_0x48871e){this['channel'][_0x1013('0xae')](util[_0x1013('0x25')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x48871e));var _0x308639=this[_0x1013('0x33')][_0x1013('0x107')](_0x48871e);try{fs[_0x1013('0x108')](_0x48871e+_0x1013('0x109'));}catch(_0x1f178d){logger['error'](_0x1f178d);}return _0x308639;}return this[_0x1013('0x33')]['error'](_0xc71073,_0x1013('0x1cd'));};AGIVertices[_0x1013('0xf')]['tts']=function(_0x250ef4){logger[_0x1013('0x2b')](util['format'](_0x1013('0x1ce'),_0x250ef4[_0x1013('0xbc')]));_0x250ef4[_0x1013('0x5b')]=_0x250ef4[_0x1013('0x5b')][_0x1013('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x1013('0x85')](_0x250ef4[_0x1013('0x5b')])){return this[_0x1013('0x33')][_0x1013('0xae')](_0x1013('0xab'));}this[_0x1013('0x33')][_0x1013('0xae')](util[_0x1013('0x25')]('Trying\x20Google\x20TTS\x20%s',_0x250ef4['text']));var _0x4679d2=this[_0x1013('0x60')][_0x1013('0xa7')](this,_0x250ef4);if(_0x4679d2){this['channel']['noop'](util['format'](_0x1013('0x1cf'),_0x4679d2));var _0x21cce9=this[_0x1013('0x33')]['streamFile'](_0x4679d2);try{fs['unlink'](_0x4679d2+'.wav');}catch(_0x14d348){logger['error'](_0x14d348);}return _0x21cce9;}return this[_0x1013('0x33')][_0x1013('0x29')](_0x250ef4,_0x1013('0x1d0'));};AGIVertices[_0x1013('0xf')]['unpause']=function(_0x1a49ab){logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0x1d1'),_0x1a49ab[_0x1013('0xbc')]));if(!this[_0x1013('0x85')](_0x1a49ab[_0x1013('0x160')])){return this[_0x1013('0x33')][_0x1013('0x29')](_0x1a49ab,_0x1013('0x15f'));}logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0x174'),this[_0x1013('0x33')][_0x1013('0x37')],_0x1a49ab[_0x1013('0x160')]));var _0x57be80=this[_0x1013('0x4e')][_0x1013('0xa7')](this,_0x1a49ab[_0x1013('0x160')]);if(_0x57be80){logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0x161'),this[_0x1013('0x33')][_0x1013('0x37')],_0x1a49ab['findBy']));this['channel'][_0x1013('0xae')](util['format'](_0x1013('0x161'),this[_0x1013('0x33')][_0x1013('0x37')],_0x1a49ab[_0x1013('0x160')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x1013('0x25')](_0x1013('0x162'),this[_0x1013('0x33')][_0x1013('0x37')],_0x1a49ab['findBy']));this[_0x1013('0x33')][_0x1013('0xae')](util[_0x1013('0x25')](_0x1013('0x162'),this[_0x1013('0x33')][_0x1013('0x37')],_0x1a49ab['findBy']));return{'code':0xc8,'result':_0x1013('0x163')};}};AGIVertices[_0x1013('0xf')]['voicemail']=function(_0x5c60aa){logger[_0x1013('0x2b')](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x5c60aa[_0x1013('0xbc')]));var _0x19a161=this[_0x1013('0x33')][_0x1013('0x57')](_0x1013('0x1d2'),[_0x5c60aa[_0x1013('0x1d3')],_0x5c60aa['options']]);if(_0x19a161['result']===-0x1){return _0x19a161;}return this['channel'][_0x1013('0xae')](util['format']('Executed\x20command\x20%s\x20%s',_0x1013('0x1d2'),_0x5c60aa[_0x1013('0x1d3')]));};AGIVertices[_0x1013('0xf')][_0x1013('0x1d4')]=function(_0x416751){logger[_0x1013('0x2b')](util[_0x1013('0x25')](_0x1013('0x1d5'),_0x416751[_0x1013('0xbc')]));if(!this[_0x1013('0x85')](_0x416751[_0x1013('0xdb')])){return this['channel']['error'](_0x416751,'no\x20variable\x20selected');}var _0x2fd62f=this[_0x1013('0x10')]['sync'](this,_0x416751[_0x1013('0xdb')]);if(!_0x2fd62f){return this['channel'][_0x1013('0x29')](_0x416751,'no\x20variable\x20found');}var _0x27c6a1=this[_0x1013('0x33')][_0x1013('0x10')](_0x2fd62f);return{'code':0xc8,'result':_0x27c6a1[_0x1013('0xa3')]?_0x27c6a1[_0x1013('0xa3')]:'-'};};String[_0x1013('0xf')][_0x1013('0xa2')]=function(_0x10d075,_0x291647){return this[_0x1013('0xa1')](_0x10d075)['join'](_0x291647);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 58dfdaa..41d50cd 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 _0x17ba=['exports','util','lodash','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','diff','seconds','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','attended','destlinkedid','savePause','stopAcw','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','prototype','[TIMER][STOP][AGENT:%s]','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','autopause','all','[ACW][syncAgentRingNoAnswer]\x20%s'];(function(_0x14674d,_0x88c7ff){var _0x556c64=function(_0x1fa01a){while(--_0x1fa01a){_0x14674d['push'](_0x14674d['shift']());}};_0x556c64(++_0x88c7ff);}(_0x17ba,0xab));var _0xa17b=function(_0x428619,_0x2fe490){_0x428619=_0x428619-0x0;var _0x5d1770=_0x17ba[_0x428619];return _0x5d1770;};'use strict';var util=require(_0xa17b('0x0'));var _=require(_0xa17b('0x1'));var moment=require('moment');var ami=require(_0xa17b('0x2'));var logger=require(_0xa17b('0x3'))(_0xa17b('0x4'));var RpcUser=require(_0xa17b('0x5'));var RpcVoiceAgentReport=require(_0xa17b('0x6'));function Acw(_0x38c13c){this[_0xa17b('0x7')]=_0x38c13c[_0xa17b('0x7')];this[_0xa17b('0x8')]=_0x38c13c[_0xa17b('0x8')];this[_0xa17b('0x9')]=_0x38c13c[_0xa17b('0x9')];this[_0xa17b('0xa')]={};ami['on'](_0xa17b('0xb'),this[_0xa17b('0xc')][_0xa17b('0xd')](this));ami['on'](_0xa17b('0xe'),this[_0xa17b('0xf')][_0xa17b('0xd')](this));ami['on']('hangup',this[_0xa17b('0x10')][_0xa17b('0xd')](this));ami['on'](_0xa17b('0x11'),this[_0xa17b('0x12')][_0xa17b('0xd')](this));ami['on'](_0xa17b('0x13'),this[_0xa17b('0x14')]['bind'](this));ami['on'](_0xa17b('0x15'),this[_0xa17b('0x16')][_0xa17b('0xd')](this));ami['on']('custom:agentConnectPreview',this[_0xa17b('0x17')][_0xa17b('0xd')](this));}function getDiff(_0x30236c){var _0xeeacaa=moment()['milliseconds'](0x0);var _0x117ad9=moment(_0x30236c)['milliseconds'](0x0);return _0xeeacaa[_0xa17b('0x18')](_0x117ad9,_0xa17b('0x19'));}Acw['prototype'][_0xa17b('0x1a')]=function(_0x3c63e3){try{var _0x1c0578=this;var _0x1f8141=this['channels'][_0x3c63e3][_0xa17b('0x1b')];var _0x5e21c2=this['channels'][_0x3c63e3]['queue'];var _0x36f985=this[_0xa17b('0x7')][_0x5e21c2];var _0x53a0f7=![];var _0x2ceafa=_0xa17b('0x1c');if(_0x36f985[_0xa17b('0x1d')]){if(_0x36f985[_0xa17b('0x1e')][_0xa17b('0x1f')]){_0x53a0f7=!![];_0x2ceafa=_0x36f985[_0xa17b('0x1e')][_0xa17b('0x1f')];}}ami['Action']({'action':_0xa17b('0x20'),'interface':_0x1f8141,'paused':!![],'reason':_0x2ceafa})[_0xa17b('0x21')](function(_0x45bd0c){if(_0x1c0578['agents'][_0x1f8141]){return RpcUser[_0xa17b('0x22')](_0x1c0578[_0xa17b('0x8')][_0x1f8141]['id'])[_0xa17b('0x21')](function(_0xbbbb62){if(_0xbbbb62&&!_0xbbbb62[_0xa17b('0x23')]){logger[_0xa17b('0x24')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x3c63e3,_0x1f8141,_0x5e21c2);var _0x3df11f=_0x1c0578['channels'][_0x3c63e3][_0xa17b('0x25')]&&_0x1c0578[_0xa17b('0xa')][_0x3c63e3]['destlinkedid']?_0x1c0578['channels'][_0x3c63e3][_0xa17b('0x26')]:_0x3c63e3;return RpcUser[_0xa17b('0x27')](_0x1c0578[_0xa17b('0x8')][_0x1f8141],_0x2ceafa,_0x3df11f)[_0xa17b('0x21')](function(_0x3c32a5){if(!_0x53a0f7){_0x1c0578[_0xa17b('0x9')][_0x1f8141]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x3c63e3,_0x1c0578['voiceQueues'][_0x5e21c2]['acwTimeout'],_0x1f8141,_0x5e21c2);_0x1c0578[_0xa17b('0x9')][_0x1f8141]['timer']=setTimeout(_0x1c0578[_0xa17b('0x28')]['bind'](_0x1c0578,_0x1f8141),_0x1c0578[_0xa17b('0x7')][_0x5e21c2][_0xa17b('0x29')]*0x3e8);_0x1c0578[_0xa17b('0x9')][_0x1f8141][_0xa17b('0x2a')]=moment()[_0xa17b('0x2b')](_0xa17b('0x2c'));_0x1c0578[_0xa17b('0x9')][_0x1f8141][_0xa17b('0x2d')]=_0x3c63e3;_0x1c0578[_0xa17b('0x9')][_0x1f8141][_0xa17b('0x2e')]=_0x5e21c2;_0x1c0578[_0xa17b('0x9')][_0x1f8141]['updateAcw']=function(){var _0x57a2c4=getDiff(_0x1c0578['timers'][_0x1f8141][_0xa17b('0x2a')]);clearTimeout(_0x1c0578[_0xa17b('0x9')][_0x1f8141][_0xa17b('0x2f')]);_0x1c0578[_0xa17b('0x9')][_0x1f8141][_0xa17b('0x2f')]=![];RpcVoiceAgentReport[_0xa17b('0x30')]({'acwtime':_0x57a2c4},_0x1c0578[_0xa17b('0x9')][_0x1f8141][_0xa17b('0x2d')],_0x1f8141)['then'](function(_0x1e33bf){logger['info'](_0xa17b('0x31'),_0x3c63e3,_0x57a2c4,_0x1e33bf);})[_0xa17b('0x32')](function(_0x198ceb){logger[_0xa17b('0x33')](_0xa17b('0x34'),_0x3c63e3,_0x198ceb);});delete _0x1c0578[_0xa17b('0x9')][_0x1f8141];};}});}else{logger['info'](_0xa17b('0x35'),_0x3c63e3,_0x1f8141,_0x5e21c2);}});}})[_0xa17b('0x32')](function(_0x323e0e){logger[_0xa17b('0x33')](_0xa17b('0x36'),_0x3c63e3,_0x1c0578['voiceQueues'][_0x5e21c2][_0xa17b('0x29')],_0x1f8141,_0x5e21c2);})['finally'](function(){delete _0x1c0578[_0xa17b('0xa')][_0x3c63e3];});}catch(_0x5a0b00){logger[_0xa17b('0x33')](_0xa17b('0x37'),_0x5a0b00['message']);}};Acw[_0xa17b('0x38')][_0xa17b('0x28')]=function(_0x487e9a){try{var _0x2fb380=this;if(_0x2fb380[_0xa17b('0x9')][_0x487e9a]){_0x2fb380[_0xa17b('0x9')][_0x487e9a][_0xa17b('0x2f')]=![];var _0xd71efd=_0x2fb380['timers'][_0x487e9a][_0xa17b('0x2d')];var _0x506488=_0x2fb380[_0xa17b('0x9')][_0x487e9a]['queue'];var _0x118ad9=_0x2fb380['voiceQueues'][_0x506488][_0xa17b('0x29')];logger['info'](_0xa17b('0x39'),_0x487e9a);RpcUser['saveUnpause'](this[_0xa17b('0x8')][_0x487e9a]);RpcVoiceAgentReport[_0xa17b('0x30')]({'acwtime':_0x118ad9,'agentacw':!![]},_0xd71efd,_0x487e9a)[_0xa17b('0x21')](function(_0x318b1c){logger[_0xa17b('0x24')](_0xa17b('0x31'),_0xd71efd,_0x118ad9,_0x318b1c);})[_0xa17b('0x32')](function(_0xe57f94){logger['error'](_0xa17b('0x34'),_0xd71efd,_0xe57f94);});}else{logger[_0xa17b('0x33')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x487e9a);if(_0x2fb380[_0xa17b('0x9')]){logger[_0xa17b('0x24')](_0xa17b('0x3a'),JSON[_0xa17b('0x3b')](_0x2fb380[_0xa17b('0x9')]));}}}catch(_0x2fe669){logger['error'](_0xa17b('0x3c'),_0x2fe669[_0xa17b('0x3d')]);}};Acw[_0xa17b('0x38')]['syncAgentConnect']=function(_0x54b65c){try{if(this['voiceQueues'][_0x54b65c[_0xa17b('0x2e')]]&&(this[_0xa17b('0x7')][_0x54b65c[_0xa17b('0x2e')]][_0xa17b('0x4')]||this[_0xa17b('0x7')][_0x54b65c[_0xa17b('0x2e')]][_0xa17b('0x1d')])){if(this[_0xa17b('0x8')][_0x54b65c[_0xa17b('0x1b')]]){this[_0xa17b('0xa')][_0x54b65c[_0xa17b('0x2d')]]={'queue':_0x54b65c[_0xa17b('0x2e')],'interface':_0x54b65c['interface'],'destlinkedid':_0x54b65c[_0xa17b('0x26')]};}}}catch(_0x16db4a){logger[_0xa17b('0x33')](_0xa17b('0x3e'),_0x16db4a[_0xa17b('0x3d')]);}};Acw[_0xa17b('0x38')]['syncAgentConnectPreview']=function(_0x43d6d6){try{if(this[_0xa17b('0x7')][_0x43d6d6[_0xa17b('0x2e')]]&&(this[_0xa17b('0x7')][_0x43d6d6[_0xa17b('0x2e')]]['acw']||this[_0xa17b('0x7')][_0x43d6d6[_0xa17b('0x2e')]][_0xa17b('0x1d')])){if(this[_0xa17b('0x8')][_0x43d6d6['interface']]){this[_0xa17b('0xa')][_0x43d6d6[_0xa17b('0x2d')]]={'queue':_0x43d6d6[_0xa17b('0x2e')],'interface':_0x43d6d6[_0xa17b('0x1b')]};}}}catch(_0x11b256){logger[_0xa17b('0x33')](_0xa17b('0x3f'),_0x11b256['message']);}};Acw[_0xa17b('0x38')][_0xa17b('0xf')]=function(_0x4ffe5a){try{if(this[_0xa17b('0xa')][_0x4ffe5a[_0xa17b('0x2d')]]&&_[_0xa17b('0x40')](this['channels'][_0x4ffe5a[_0xa17b('0x2d')]][_0xa17b('0x25')])){logger['info'](_0xa17b('0x41'),_0x4ffe5a[_0xa17b('0x2d')]);this['startAcw'](_0x4ffe5a[_0xa17b('0x2d')]);}else if(this[_0xa17b('0xa')][_0x4ffe5a['linkedid']]&&_[_0xa17b('0x40')](this[_0xa17b('0xa')][_0x4ffe5a[_0xa17b('0x42')]][_0xa17b('0x25')])){logger[_0xa17b('0x24')](_0xa17b('0x43'),_0x4ffe5a[_0xa17b('0x42')]);this['startAcw'](_0x4ffe5a[_0xa17b('0x42')]);}}catch(_0x3ff07a){logger[_0xa17b('0x33')](_0xa17b('0x44'),_0x3ff07a[_0xa17b('0x3d')]);}};Acw[_0xa17b('0x38')][_0xa17b('0x10')]=function(_0x100d14){try{if(this[_0xa17b('0xa')][_0x100d14[_0xa17b('0x2d')]]&&this[_0xa17b('0xa')][_0x100d14[_0xa17b('0x2d')]][_0xa17b('0x25')]){logger['info'](_0xa17b('0x45'),_0x100d14[_0xa17b('0x2d')]);this[_0xa17b('0x1a')](_0x100d14[_0xa17b('0x2d')]);}else if(this[_0xa17b('0xa')][_0x100d14[_0xa17b('0x42')]]&&this[_0xa17b('0xa')][_0x100d14[_0xa17b('0x42')]][_0xa17b('0x25')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x100d14[_0xa17b('0x42')]);this[_0xa17b('0x1a')](_0x100d14['linkedid']);}}catch(_0x568f27){logger['error'](_0xa17b('0x46'),_0x568f27[_0xa17b('0x3d')]);}};Acw[_0xa17b('0x38')][_0xa17b('0x14')]=function(_0x301019){try{if(!_[_0xa17b('0x47')](this['channels'][_0x301019['transfereeuniqueid']])){this['startAcw'](_0x301019['transfereeuniqueid']);if(this['channels'][_0x301019[_0xa17b('0x48')]]){this[_0xa17b('0xa')][_0x301019[_0xa17b('0x48')]][_0xa17b('0x25')]=!![];this[_0xa17b('0xa')][_0x301019[_0xa17b('0x49')]]=this[_0xa17b('0xa')][_0x301019['secondtransfereruniqueid']];delete this[_0xa17b('0xa')][_0x301019[_0xa17b('0x48')]];}}else if(!_[_0xa17b('0x47')](this[_0xa17b('0xa')][_0x301019[_0xa17b('0x49')]])){this[_0xa17b('0x1a')](_0x301019[_0xa17b('0x49')]);if(this[_0xa17b('0xa')][_0x301019[_0xa17b('0x4a')]]){this[_0xa17b('0xa')][_0x301019[_0xa17b('0x4a')]][_0xa17b('0x25')]=!![];this['channels'][_0x301019[_0xa17b('0x4b')]]=this['channels'][_0x301019[_0xa17b('0x4a')]];delete this[_0xa17b('0xa')][_0x301019[_0xa17b('0x4a')]];}}}catch(_0x2ac414){logger['error'](_0xa17b('0x4c'),_0x2ac414['message']);}};Acw[_0xa17b('0x38')]['syncBlindTransfer']=function(_0x5be3d1){try{if(this[_0xa17b('0xa')][_0x5be3d1[_0xa17b('0x4d')]]){logger['info'](_0xa17b('0x4e'),JSON[_0xa17b('0x3b')](_0x5be3d1['transfereruniqueid']));this['startAcw'](_0x5be3d1[_0xa17b('0x4d')]);}else if(this[_0xa17b('0xa')][_0x5be3d1['transfererlinkedid']]){logger[_0xa17b('0x24')](_0xa17b('0x4f'),JSON['stringify'](_0x5be3d1[_0xa17b('0x50')]));this[_0xa17b('0x1a')](_0x5be3d1[_0xa17b('0x50')]);}}catch(_0x7b5a5d){logger[_0xa17b('0x33')]('[ACW][syncBlindTransfer]\x20%s',_0x7b5a5d[_0xa17b('0x3d')]);}};Acw[_0xa17b('0x38')][_0xa17b('0x12')]=function(_0x29cdfc){try{if(this[_0xa17b('0x7')][_0x29cdfc[_0xa17b('0x2e')]]&&this[_0xa17b('0x7')][_0x29cdfc[_0xa17b('0x2e')]][_0xa17b('0x51')]===_0xa17b('0x52')){if(this['agents'][_0x29cdfc[_0xa17b('0x1b')]]){logger[_0xa17b('0x24')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x29cdfc['uniqueid'],_0x29cdfc[_0xa17b('0x1b')],_0x29cdfc[_0xa17b('0x2e')]);return RpcUser[_0xa17b('0x27')](this[_0xa17b('0x8')][_0x29cdfc[_0xa17b('0x1b')]],'Auto-Pause',_0x29cdfc[_0xa17b('0x2d')]);}}}catch(_0x469ecd){logger[_0xa17b('0x33')](_0xa17b('0x53'),_0x469ecd['message']);}};module[_0xa17b('0x54')]=Acw; \ No newline at end of file +var _0x55ca=['error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','stopAcw','[TIMER][STOP][AGENT:%s]','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','message','destlinkedid','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','attended','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','util','lodash','acw','../rpc/user','voiceQueues','agents','timers','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','syncHangup','bind','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','channels','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','lastPauseAt','update','[%s][UPDATE][ACWTIME:%s]','catch'];(function(_0x1bdfac,_0xf59382){var _0xb6808c=function(_0x3a0970){while(--_0x3a0970){_0x1bdfac['push'](_0x1bdfac['shift']());}};_0xb6808c(++_0xf59382);}(_0x55ca,0x126));var _0xa55c=function(_0x467d3b,_0x4225ba){_0x467d3b=_0x467d3b-0x0;var _0x1a35ec=_0x55ca[_0x467d3b];return _0x1a35ec;};'use strict';var util=require(_0xa55c('0x0'));var _=require(_0xa55c('0x1'));var moment=require('moment');var ami=require('../ami');var logger=require('../../../config/logger')(_0xa55c('0x2'));var RpcUser=require(_0xa55c('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x3b478a){this[_0xa55c('0x4')]=_0x3b478a[_0xa55c('0x4')];this[_0xa55c('0x5')]=_0x3b478a[_0xa55c('0x5')];this[_0xa55c('0x6')]=_0x3b478a[_0xa55c('0x6')];this['channels']={};ami['on'](_0xa55c('0x7'),this[_0xa55c('0x8')]['bind'](this));ami['on'](_0xa55c('0x9'),this[_0xa55c('0xa')]['bind'](this));ami['on']('hangup',this[_0xa55c('0xb')][_0xa55c('0xc')](this));ami['on'](_0xa55c('0xd'),this[_0xa55c('0xe')][_0xa55c('0xc')](this));ami['on'](_0xa55c('0xf'),this[_0xa55c('0x10')][_0xa55c('0xc')](this));ami['on'](_0xa55c('0x11'),this[_0xa55c('0x12')]['bind'](this));ami['on']('custom:agentConnectPreview',this[_0xa55c('0x13')]['bind'](this));}function getDiff(_0x5a3672){var _0x59ea8d=moment()[_0xa55c('0x14')](0x0);var _0x3930e4=moment(_0x5a3672)[_0xa55c('0x14')](0x0);return _0x59ea8d[_0xa55c('0x15')](_0x3930e4,_0xa55c('0x16'));}Acw[_0xa55c('0x17')]['startAcw']=function(_0x3ccf65){try{var _0x3dcf4f=this;var _0x25934f=this[_0xa55c('0x18')][_0x3ccf65][_0xa55c('0x19')];var _0x3ae86b=this[_0xa55c('0x18')][_0x3ccf65][_0xa55c('0x1a')];var _0x24783b=this['voiceQueues'][_0x3ae86b];var _0x3d4c9e=![];var _0x104a99=_0xa55c('0x1b');if(_0x24783b[_0xa55c('0x1c')]){if(_0x24783b[_0xa55c('0x1d')][_0xa55c('0x1e')]){_0x3d4c9e=!![];_0x104a99=_0x24783b['mandatoryDispositionPause']['name'];}}ami[_0xa55c('0x1f')]({'action':_0xa55c('0x20'),'interface':_0x25934f,'paused':!![],'reason':_0x104a99})[_0xa55c('0x21')](function(_0x4cfe10){if(_0x3dcf4f[_0xa55c('0x5')][_0x25934f]){return RpcUser[_0xa55c('0x22')](_0x3dcf4f['agents'][_0x25934f]['id'])[_0xa55c('0x21')](function(_0x133096){if(_0x133096&&!_0x133096[_0xa55c('0x23')]){logger[_0xa55c('0x24')](_0xa55c('0x25'),_0x3ccf65,_0x25934f,_0x3ae86b);var _0x49ed04=_0x3dcf4f[_0xa55c('0x18')][_0x3ccf65]['attended']&&_0x3dcf4f['channels'][_0x3ccf65]['destlinkedid']?_0x3dcf4f[_0xa55c('0x18')][_0x3ccf65]['destlinkedid']:_0x3ccf65;return RpcUser[_0xa55c('0x26')](_0x3dcf4f[_0xa55c('0x5')][_0x25934f],_0x104a99,_0x49ed04)[_0xa55c('0x21')](function(_0xf0e574){if(!_0x3d4c9e){_0x3dcf4f[_0xa55c('0x6')][_0x25934f]={};logger[_0xa55c('0x24')](_0xa55c('0x27'),_0x3ccf65,_0x3dcf4f[_0xa55c('0x4')][_0x3ae86b][_0xa55c('0x28')],_0x25934f,_0x3ae86b);_0x3dcf4f[_0xa55c('0x6')][_0x25934f][_0xa55c('0x29')]=setTimeout(_0x3dcf4f['stopAcw'][_0xa55c('0xc')](_0x3dcf4f,_0x25934f),_0x3dcf4f[_0xa55c('0x4')][_0x3ae86b][_0xa55c('0x28')]*0x3e8);_0x3dcf4f[_0xa55c('0x6')][_0x25934f]['lastPauseAt']=moment()[_0xa55c('0x2a')](_0xa55c('0x2b'));_0x3dcf4f[_0xa55c('0x6')][_0x25934f][_0xa55c('0x2c')]=_0x3ccf65;_0x3dcf4f[_0xa55c('0x6')][_0x25934f][_0xa55c('0x1a')]=_0x3ae86b;_0x3dcf4f['timers'][_0x25934f][_0xa55c('0x2d')]=function(){var _0x490b7d=getDiff(_0x3dcf4f[_0xa55c('0x6')][_0x25934f][_0xa55c('0x2e')]);clearTimeout(_0x3dcf4f[_0xa55c('0x6')][_0x25934f][_0xa55c('0x29')]);_0x3dcf4f['timers'][_0x25934f][_0xa55c('0x29')]=![];RpcVoiceAgentReport[_0xa55c('0x2f')]({'acwtime':_0x490b7d},_0x3dcf4f[_0xa55c('0x6')][_0x25934f][_0xa55c('0x2c')],_0x25934f)[_0xa55c('0x21')](function(_0x1225c3){logger[_0xa55c('0x24')](_0xa55c('0x30'),_0x3ccf65,_0x490b7d,_0x1225c3);})[_0xa55c('0x31')](function(_0xcbaf2e){logger[_0xa55c('0x32')]('[%s][UPDATE][ERRORS:%s]',_0x3ccf65,_0xcbaf2e);});delete _0x3dcf4f['timers'][_0x25934f];};}});}else{logger[_0xa55c('0x24')](_0xa55c('0x33'),_0x3ccf65,_0x25934f,_0x3ae86b);}});}})['catch'](function(_0x30fadd){logger[_0xa55c('0x32')](_0xa55c('0x27'),_0x3ccf65,_0x3dcf4f[_0xa55c('0x4')][_0x3ae86b][_0xa55c('0x28')],_0x25934f,_0x3ae86b);})[_0xa55c('0x34')](function(){delete _0x3dcf4f[_0xa55c('0x18')][_0x3ccf65];});}catch(_0x222d4b){logger[_0xa55c('0x32')]('[ACW][START]\x20%s',_0x222d4b['message']);}};Acw['prototype'][_0xa55c('0x35')]=function(_0x18e00e){try{var _0x2bb4f0=this;if(_0x2bb4f0['timers'][_0x18e00e]){_0x2bb4f0[_0xa55c('0x6')][_0x18e00e]['timer']=![];var _0x119220=_0x2bb4f0['timers'][_0x18e00e][_0xa55c('0x2c')];var _0x39267c=_0x2bb4f0[_0xa55c('0x6')][_0x18e00e]['queue'];var _0x7c4a47=_0x2bb4f0[_0xa55c('0x4')][_0x39267c]['acwTimeout'];logger[_0xa55c('0x24')](_0xa55c('0x36'),_0x18e00e);RpcUser['saveUnpause'](this['agents'][_0x18e00e]);RpcVoiceAgentReport[_0xa55c('0x2f')]({'acwtime':_0x7c4a47,'agentacw':!![]},_0x119220,_0x18e00e)['then'](function(_0x1e75dc){logger[_0xa55c('0x24')]('[%s][UPDATE][ACWTIME:%s]',_0x119220,_0x7c4a47,_0x1e75dc);})['catch'](function(_0x5e50b6){logger['error'](_0xa55c('0x37'),_0x119220,_0x5e50b6);});}else{logger[_0xa55c('0x32')](_0xa55c('0x38'),_0x18e00e);if(_0x2bb4f0[_0xa55c('0x6')]){logger[_0xa55c('0x24')]('[ACW][TIMERS]',JSON[_0xa55c('0x39')](_0x2bb4f0[_0xa55c('0x6')]));}}}catch(_0x77d623){logger[_0xa55c('0x32')](_0xa55c('0x3a'),_0x77d623[_0xa55c('0x3b')]);}};Acw['prototype'][_0xa55c('0x8')]=function(_0x5ee63d){try{if(this['voiceQueues'][_0x5ee63d[_0xa55c('0x1a')]]&&(this[_0xa55c('0x4')][_0x5ee63d['queue']][_0xa55c('0x2')]||this['voiceQueues'][_0x5ee63d['queue']][_0xa55c('0x1c')])){if(this[_0xa55c('0x5')][_0x5ee63d[_0xa55c('0x19')]]){this['channels'][_0x5ee63d[_0xa55c('0x2c')]]={'queue':_0x5ee63d[_0xa55c('0x1a')],'interface':_0x5ee63d['interface'],'destlinkedid':_0x5ee63d[_0xa55c('0x3c')]};}}}catch(_0x514661){logger[_0xa55c('0x32')](_0xa55c('0x3d'),_0x514661['message']);}};Acw[_0xa55c('0x17')][_0xa55c('0x13')]=function(_0x5d834d){try{if(this[_0xa55c('0x4')][_0x5d834d[_0xa55c('0x1a')]]&&(this[_0xa55c('0x4')][_0x5d834d['queue']][_0xa55c('0x2')]||this['voiceQueues'][_0x5d834d[_0xa55c('0x1a')]][_0xa55c('0x1c')])){if(this[_0xa55c('0x5')][_0x5d834d['interface']]){this[_0xa55c('0x18')][_0x5d834d[_0xa55c('0x2c')]]={'queue':_0x5d834d['queue'],'interface':_0x5d834d[_0xa55c('0x19')]};}}}catch(_0x931907){logger['error'](_0xa55c('0x3e'),_0x931907[_0xa55c('0x3b')]);}};Acw['prototype'][_0xa55c('0xa')]=function(_0x81cee8){try{if(this[_0xa55c('0x18')][_0x81cee8[_0xa55c('0x2c')]]&&_['isUndefined'](this[_0xa55c('0x18')][_0x81cee8['uniqueid']][_0xa55c('0x3f')])){logger[_0xa55c('0x24')](_0xa55c('0x40'),_0x81cee8['uniqueid']);this[_0xa55c('0x41')](_0x81cee8[_0xa55c('0x2c')]);}else if(this['channels'][_0x81cee8[_0xa55c('0x42')]]&&_[_0xa55c('0x43')](this[_0xa55c('0x18')][_0x81cee8[_0xa55c('0x42')]][_0xa55c('0x3f')])){logger[_0xa55c('0x24')](_0xa55c('0x44'),_0x81cee8[_0xa55c('0x42')]);this[_0xa55c('0x41')](_0x81cee8[_0xa55c('0x42')]);}}catch(_0x4fc0a9){logger[_0xa55c('0x32')](_0xa55c('0x45'),_0x4fc0a9[_0xa55c('0x3b')]);}};Acw['prototype'][_0xa55c('0xb')]=function(_0x35bf0a){try{if(this['channels'][_0x35bf0a[_0xa55c('0x2c')]]&&this['channels'][_0x35bf0a[_0xa55c('0x2c')]][_0xa55c('0x3f')]){logger[_0xa55c('0x24')](_0xa55c('0x46'),_0x35bf0a[_0xa55c('0x2c')]);this['startAcw'](_0x35bf0a[_0xa55c('0x2c')]);}else if(this[_0xa55c('0x18')][_0x35bf0a['linkedid']]&&this[_0xa55c('0x18')][_0x35bf0a[_0xa55c('0x42')]][_0xa55c('0x3f')]){logger[_0xa55c('0x24')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x35bf0a['linkedid']);this[_0xa55c('0x41')](_0x35bf0a[_0xa55c('0x42')]);}}catch(_0x3ca5b8){logger[_0xa55c('0x32')]('[ACW][syncHangup]\x20%s',_0x3ca5b8[_0xa55c('0x3b')]);}};Acw['prototype'][_0xa55c('0x10')]=function(_0x437ced){try{if(!_[_0xa55c('0x47')](this[_0xa55c('0x18')][_0x437ced[_0xa55c('0x48')]])){this['startAcw'](_0x437ced[_0xa55c('0x48')]);if(this['channels'][_0x437ced[_0xa55c('0x49')]]){this[_0xa55c('0x18')][_0x437ced[_0xa55c('0x49')]][_0xa55c('0x3f')]=!![];this[_0xa55c('0x18')][_0x437ced[_0xa55c('0x4a')]]=this[_0xa55c('0x18')][_0x437ced['secondtransfereruniqueid']];delete this[_0xa55c('0x18')][_0x437ced[_0xa55c('0x49')]];}}else if(!_[_0xa55c('0x47')](this[_0xa55c('0x18')][_0x437ced[_0xa55c('0x4a')]])){this['startAcw'](_0x437ced[_0xa55c('0x4a')]);if(this[_0xa55c('0x18')][_0x437ced[_0xa55c('0x4b')]]){this[_0xa55c('0x18')][_0x437ced[_0xa55c('0x4b')]]['attended']=!![];this[_0xa55c('0x18')][_0x437ced[_0xa55c('0x48')]]=this[_0xa55c('0x18')][_0x437ced[_0xa55c('0x4b')]];delete this[_0xa55c('0x18')][_0x437ced['origtransfereruniqueid']];}}}catch(_0x419fc3){logger['error'](_0xa55c('0x4c'),_0x419fc3['message']);}};Acw[_0xa55c('0x17')]['syncBlindTransfer']=function(_0x34edc5){try{if(this[_0xa55c('0x18')][_0x34edc5[_0xa55c('0x4d')]]){logger[_0xa55c('0x24')](_0xa55c('0x4e'),JSON[_0xa55c('0x39')](_0x34edc5[_0xa55c('0x4d')]));this[_0xa55c('0x41')](_0x34edc5[_0xa55c('0x4d')]);}else if(this[_0xa55c('0x18')][_0x34edc5['transfererlinkedid']]){logger[_0xa55c('0x24')](_0xa55c('0x4f'),JSON['stringify'](_0x34edc5[_0xa55c('0x50')]));this[_0xa55c('0x41')](_0x34edc5[_0xa55c('0x50')]);}}catch(_0x9fe234){logger[_0xa55c('0x32')](_0xa55c('0x51'),_0x9fe234[_0xa55c('0x3b')]);}};Acw[_0xa55c('0x17')]['syncAgentRingNoAnswer']=function(_0x1dfaf7){try{if(this[_0xa55c('0x4')][_0x1dfaf7[_0xa55c('0x1a')]]&&this[_0xa55c('0x4')][_0x1dfaf7[_0xa55c('0x1a')]][_0xa55c('0x52')]===_0xa55c('0x53')){if(this[_0xa55c('0x5')][_0x1dfaf7[_0xa55c('0x19')]]){logger['info'](_0xa55c('0x54'),_0x1dfaf7[_0xa55c('0x2c')],_0x1dfaf7[_0xa55c('0x19')],_0x1dfaf7[_0xa55c('0x1a')]);return RpcUser[_0xa55c('0x26')](this[_0xa55c('0x5')][_0x1dfaf7[_0xa55c('0x19')]],_0xa55c('0x55'),_0x1dfaf7[_0xa55c('0x2c')]);}}}catch(_0x3178a6){logger[_0xa55c('0x32')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x3178a6[_0xa55c('0x3b')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 31e15eb..4cb134a 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 _0x1d57=['port','username','keepConnected','Action','action','error','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','devicestatelist','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','format','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','actionSipPeerStatus','catch','log','bluebird','moment','lodash','ami','../../config/environment','asterisk'];(function(_0x596e98,_0xc326c9){var _0x1c09ac=function(_0x3d839d){while(--_0x3d839d){_0x596e98['push'](_0x596e98['shift']());}};_0x1c09ac(++_0xc326c9);}(_0x1d57,0x10a));var _0x71d5=function(_0x27cfdc,_0x484964){_0x27cfdc=_0x27cfdc-0x0;var _0x3a5be2=_0x1d57[_0x27cfdc];return _0x3a5be2;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x71d5('0x0'));var moment=require(_0x71d5('0x1'));var util=require('util');var _=require(_0x71d5('0x2'));var logger=require('../../config/logger')(_0x71d5('0x3'));var config=require(_0x71d5('0x4'));var ami=new Manager(config[_0x71d5('0x5')][_0x71d5('0x6')],config['asterisk']['ip'],config[_0x71d5('0x5')][_0x71d5('0x7')],config['asterisk']['password'],!![]);ami[_0x71d5('0x8')]();ami[_0x71d5('0x9')]=BPromise['promisify'](ami[_0x71d5('0xa')]);function error(_0x51c6f1){logger[_0x71d5('0xb')](util['format'](_0x71d5('0xc'),config[_0x71d5('0x5')][_0x71d5('0x7')],config[_0x71d5('0x5')]['ip'],config[_0x71d5('0x5')][_0x71d5('0x6')],util[_0x71d5('0xd')](_0x51c6f1,![],null)));}function close(){logger[_0x71d5('0xb')](util['format'](_0x71d5('0xe'),config['asterisk'][_0x71d5('0x7')],config[_0x71d5('0x5')]['ip'],config[_0x71d5('0x5')][_0x71d5('0x6')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x71d5('0x9')]({'action':_0x71d5('0xf')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x71d5('0x9')]({'action':_0x71d5('0x10')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x71d5('0x9')]({'action':'sippeerstatus'});};};ami[_0x71d5('0x11')]=function(){return function(){return ami[_0x71d5('0x9')]({'action':'queuesummary'});};};ami[_0x71d5('0x12')]=function(){return function(){return ami[_0x71d5('0x9')]({'action':_0x71d5('0x13')});};};function connect(_0x2e05d6){logger[_0x71d5('0x14')](util['format'](_0x71d5('0x15'),config['asterisk'][_0x71d5('0x7')],config[_0x71d5('0x5')]['ip'],config[_0x71d5('0x5')][_0x71d5('0x6')]));ami[_0x71d5('0x16')]('error',error);ami[_0x71d5('0x16')](_0x71d5('0x17'),close);}ami['on'](_0x71d5('0x18'),connect);ami['on']('shutdown',function(_0x176bd4){logger['info'](util[_0x71d5('0x19')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x71d5('0x5')]['username'],config[_0x71d5('0x5')]['ip'],config[_0x71d5('0x5')][_0x71d5('0x6')],util[_0x71d5('0xd')](_0x176bd4,![],null)));});ami['on'](_0x71d5('0x1a'),function(_0x18e333){logger[_0x71d5('0x14')](util[_0x71d5('0x19')](_0x71d5('0x1b'),config[_0x71d5('0x5')]['username'],config['asterisk']['ip'],config[_0x71d5('0x5')][_0x71d5('0x6')]));return BPromise[_0x71d5('0x1c')]()[_0x71d5('0x1d')](ami['actionSipShowRegistry']())['then'](ami[_0x71d5('0x1e')]())[_0x71d5('0x1d')](ami[_0x71d5('0x1f')]())['then'](ami[_0x71d5('0x11')]())[_0x71d5('0x1d')](ami['actionCoreShowChannels']())[_0x71d5('0x20')](function(_0x5c8cdd){console[_0x71d5('0x21')](_0x5c8cdd);});});ami[_0x71d5('0x16')](_0x71d5('0xb'),error);ami[_0x71d5('0x16')](_0x71d5('0x17'),close);module['exports']=ami; \ No newline at end of file +var _0x391b=['asterisk-manager','bluebird','moment','lodash','../../config/logger','ami','asterisk','username','Action','promisify','error','format','port','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionCoreShowChannels','catch','exports'];(function(_0x34361b,_0x9642d4){var _0x1de9c5=function(_0x41bc3f){while(--_0x41bc3f){_0x34361b['push'](_0x34361b['shift']());}};_0x1de9c5(++_0x9642d4);}(_0x391b,0x197));var _0xb391=function(_0x455c0f,_0x2f211f){_0x455c0f=_0x455c0f-0x0;var _0x1b906d=_0x391b[_0x455c0f];return _0x1b906d;};'use strict';var Manager=require(_0xb391('0x0'));var BPromise=require(_0xb391('0x1'));var moment=require(_0xb391('0x2'));var util=require('util');var _=require(_0xb391('0x3'));var logger=require(_0xb391('0x4'))(_0xb391('0x5'));var config=require('../../config/environment');var ami=new Manager(config[_0xb391('0x6')]['port'],config[_0xb391('0x6')]['ip'],config[_0xb391('0x6')][_0xb391('0x7')],config[_0xb391('0x6')]['password'],!![]);ami['keepConnected']();ami[_0xb391('0x8')]=BPromise[_0xb391('0x9')](ami['action']);function error(_0x260e29){logger[_0xb391('0xa')](util[_0xb391('0xb')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0xb391('0x7')],config['asterisk']['ip'],config['asterisk'][_0xb391('0xc')],util[_0xb391('0xd')](_0x260e29,![],null)));}function close(){logger[_0xb391('0xa')](util[_0xb391('0xb')](_0xb391('0xe'),config[_0xb391('0x6')][_0xb391('0x7')],config[_0xb391('0x6')]['ip'],config[_0xb391('0x6')]['port']));}ami[_0xb391('0xf')]=function(){return function(){return ami[_0xb391('0x8')]({'action':_0xb391('0x10')});};};ami[_0xb391('0x11')]=function(){return function(){return ami[_0xb391('0x8')]({'action':_0xb391('0x12')});};};ami[_0xb391('0x13')]=function(){return function(){return ami[_0xb391('0x8')]({'action':_0xb391('0x14')});};};ami[_0xb391('0x15')]=function(){return function(){return ami[_0xb391('0x8')]({'action':_0xb391('0x16')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xb391('0x8')]({'action':_0xb391('0x17')});};};function connect(_0x5abadc){logger[_0xb391('0x18')](util['format'](_0xb391('0x19'),config[_0xb391('0x6')]['username'],config[_0xb391('0x6')]['ip'],config[_0xb391('0x6')][_0xb391('0xc')]));ami[_0xb391('0x1a')]('error',error);ami[_0xb391('0x1a')](_0xb391('0x1b'),close);}ami['on'](_0xb391('0x1c'),connect);ami['on'](_0xb391('0x1d'),function(_0x219c3c){logger[_0xb391('0x18')](util[_0xb391('0xb')](_0xb391('0x1e'),config['asterisk'][_0xb391('0x7')],config[_0xb391('0x6')]['ip'],config[_0xb391('0x6')][_0xb391('0xc')],util[_0xb391('0xd')](_0x219c3c,![],null)));});ami['on'](_0xb391('0x1f'),function(_0x12bec2){logger[_0xb391('0x18')](util[_0xb391('0xb')](_0xb391('0x20'),config['asterisk']['username'],config[_0xb391('0x6')]['ip'],config[_0xb391('0x6')][_0xb391('0xc')]));return BPromise['resolve']()[_0xb391('0x21')](ami[_0xb391('0xf')]())[_0xb391('0x21')](ami[_0xb391('0x11')]())[_0xb391('0x21')](ami['actionSipPeerStatus']())[_0xb391('0x21')](ami[_0xb391('0x15')]())[_0xb391('0x21')](ami[_0xb391('0x22')]())[_0xb391('0x23')](function(_0x4b6f2a){console['log'](_0x4b6f2a);});});ami[_0xb391('0x1a')](_0xb391('0xa'),error);ami[_0xb391('0x1a')]('close',close);module[_0xb391('0x24')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index bca245e..0b4f870 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 _0xf438=['Request','then','debug','rpc','memberReport','error','message','result','catch','bluebird','../../config/logger','ami','client','http'];(function(_0x2ff127,_0x3d6e2b){var _0x53af48=function(_0x4a0c47){while(--_0x4a0c47){_0x2ff127['push'](_0x2ff127['shift']());}};_0x53af48(++_0x3d6e2b);}(_0xf438,0x121));var _0x8f43=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf438[_0x2641f9];return _0x585741;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x8f43('0x0'));var logger=require(_0x8f43('0x1'))(_0x8f43('0x2'));var client=jayson[_0x8f43('0x3')][_0x8f43('0x4')]({'port':0x2329});client[_0x8f43('0x5')]=function(_0x4eb64e,_0x38b966){return new BPromise(function(_0x1d1604,_0x247380){return client['request'](_0x4eb64e,_0x38b966)[_0x8f43('0x6')](function(_0x1f00b3){logger[_0x8f43('0x7')](_0x8f43('0x8'),_0x8f43('0x9'),_0x4eb64e,_0x38b966,_0x1f00b3);if(_0x1f00b3[_0x8f43('0xa')]){logger['error'](_0x8f43('0x8'),_0x8f43('0x9'),_0x4eb64e,_0x1f00b3[_0x8f43('0xa')]['message'],_0x38b966);return _0x247380(_0x1f00b3[_0x8f43('0xa')][_0x8f43('0xb')]);}else{return _0x1d1604(_0x1f00b3[_0x8f43('0xc')]);}})[_0x8f43('0xd')](function(_0x2e4d7d){logger[_0x8f43('0xa')](_0x8f43('0x8'),_0x8f43('0x9'),_0x4eb64e,_0x2e4d7d,_0x38b966);return _0x247380(_0x2e4d7d);});});};module['exports']=client; \ No newline at end of file +var _0x1461=['bluebird','ami','client','http','Request','request','then','debug','memberReport','error','message','catch','rpc','jayson/promise'];(function(_0x32673f,_0x18cd46){var _0x308a58=function(_0x397af8){while(--_0x397af8){_0x32673f['push'](_0x32673f['shift']());}};_0x308a58(++_0x18cd46);}(_0x1461,0x1cd));var _0x1146=function(_0x350396,_0x391ad2){_0x350396=_0x350396-0x0;var _0xf306b1=_0x1461[_0x350396];return _0xf306b1;};'use strict';var jayson=require(_0x1146('0x0'));var BPromise=require(_0x1146('0x1'));var logger=require('../../config/logger')(_0x1146('0x2'));var client=jayson[_0x1146('0x3')][_0x1146('0x4')]({'port':0x2329});client[_0x1146('0x5')]=function(_0x30bfe3,_0x13368b){return new BPromise(function(_0x166f77,_0x399f0a){return client[_0x1146('0x6')](_0x30bfe3,_0x13368b)[_0x1146('0x7')](function(_0x3c9fff){logger[_0x1146('0x8')]('rpc',_0x1146('0x9'),_0x30bfe3,_0x13368b,_0x3c9fff);if(_0x3c9fff[_0x1146('0xa')]){logger[_0x1146('0xa')]('rpc',_0x1146('0x9'),_0x30bfe3,_0x3c9fff[_0x1146('0xa')][_0x1146('0xb')],_0x13368b);return _0x399f0a(_0x3c9fff[_0x1146('0xa')][_0x1146('0xb')]);}else{return _0x166f77(_0x3c9fff['result']);}})[_0x1146('0xc')](function(_0x4e4d43){logger['error'](_0x1146('0xd'),_0x1146('0x9'),_0x30bfe3,_0x4e4d43,_0x13368b);return _0x399f0a(_0x4e4d43);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 99384b3..9803eb0 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 _0xf46a=['voiceQueue','uniqueid','name','Contact','phone','firstName','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','number','substring','dialCutDigit','getQueue','queue','util','moment','isNil','string'];(function(_0xbc2974,_0xec3342){var _0x3a5b4f=function(_0x5ec5b5){while(--_0x5ec5b5){_0xbc2974['push'](_0xbc2974['shift']());}};_0x3a5b4f(++_0xec3342);}(_0xf46a,0xa4));var _0xaf46=function(_0x3101ba,_0x62b768){_0x3101ba=_0x3101ba-0x0;var _0x122e9c=_0xf46a[_0x3101ba];return _0x122e9c;};'use strict';var util=require(_0xaf46('0x0'));var _=require('lodash');var moment=require(_0xaf46('0x1'));function checkNameSurname(_0x417747,_0x571132,_0xf4ff9e){var _0x3a7936='';if(!_[_0xaf46('0x2')](_0x571132)&&_0xaf46('0x3')===typeof _0x571132){_0x3a7936+=_0x571132;}if(!_[_0xaf46('0x2')](_0xf4ff9e)&&_0xaf46('0x3')===typeof _0xf4ff9e){_0x3a7936+='\x20'+_0xf4ff9e;}if(_0x3a7936!==''){return _0x3a7936;}return _0x417747;}function Action(_0x35f997,_0x399251,_0x3aef9c){this[_0xaf46('0x4')]=_0x35f997;this[_0xaf46('0x5')]=_0x3aef9c||undefined;this[_0xaf46('0x6')]=checkNameSurname(_0x399251[_0xaf46('0x7')][_0xaf46('0x8')],_0x399251['Contact'][_0xaf46('0x9')],_0x399251['Contact']['lastName']);this['number']=_0x399251[_0xaf46('0x7')][_0xaf46('0x8')];this['queue']=_0x35f997[_0xaf46('0x6')];this[_0xaf46('0xa')]=_0x399251[_0xaf46('0xa')]||![];this['type']=_0x35f997[_0xaf46('0xb')];this['dialQueueTimeout']=_0x35f997[_0xaf46('0xc')]||0x3;this['scheduledat']=_0x399251[_0xaf46('0xd')];this['countbusyretry']=_0x399251[_0xaf46('0xe')];this[_0xaf46('0xf')]=_0x399251[_0xaf46('0xf')];this[_0xaf46('0x10')]=_0x399251[_0xaf46('0x10')];this[_0xaf46('0x11')]=_0x399251[_0xaf46('0x11')];this[_0xaf46('0x12')]=_0x399251['countdropretry'];this['countabandonedretry']=_0x399251['countabandonedretry'];this[_0xaf46('0x13')]=_0x399251['countmachineretry'];this['countagentrejectretry']=_0x399251[_0xaf46('0x14')];this[_0xaf46('0x15')]=_0x399251['ContactId'];this[_0xaf46('0x16')]=_0x399251[_0xaf46('0x16')];this[_0xaf46('0x17')]=_0x399251[_0xaf46('0x17')];this[_0xaf46('0x18')]=_0x399251[_0xaf46('0x18')];this['CampaignId']=_0x399251[_0xaf46('0x19')];this[_0xaf46('0x1a')]=_0x399251['id'];this['ContactFirstName']=_0x399251[_0xaf46('0x7')][_0xaf46('0x9')]||'';this['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xaf46('0x1b')]=_0x399251[_0xaf46('0x1b')];this['callbackuniqueid']=_0x399251[_0xaf46('0x1c')];this['callbackat']=_0x399251[_0xaf46('0x1d')];this[_0xaf46('0x1e')]=_0x399251[_0xaf46('0x1e')];this[_0xaf46('0x1f')]='';this[_0xaf46('0x20')]='';}Action[_0xaf46('0x21')][_0xaf46('0x22')]=function(){return util[_0xaf46('0x23')](_0xaf46('0x24'),this[_0xaf46('0x6')],this['voiceQueue']['dialCutDigit']>0x0?this[_0xaf46('0x25')][_0xaf46('0x26')](this[_0xaf46('0x4')][_0xaf46('0x27')]):this[_0xaf46('0x25')]);};Action[_0xaf46('0x21')][_0xaf46('0x28')]=function(){return this[_0xaf46('0x29')];};module['exports']=Action; \ No newline at end of file +var _0x057f=['callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','util','moment','isNil','string','voiceQueue','uniqueid','name','Contact','firstName','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x057f,0x1d7));var _0xf057=function(_0x2bd6a9,_0x4df0ff){_0x2bd6a9=_0x2bd6a9-0x0;var _0x2d7c73=_0x057f[_0x2bd6a9];return _0x2d7c73;};'use strict';var util=require(_0xf057('0x0'));var _=require('lodash');var moment=require(_0xf057('0x1'));function checkNameSurname(_0x12e6e0,_0x39647e,_0x55a972){var _0x9d106f='';if(!_[_0xf057('0x2')](_0x39647e)&&_0xf057('0x3')===typeof _0x39647e){_0x9d106f+=_0x39647e;}if(!_[_0xf057('0x2')](_0x55a972)&&_0xf057('0x3')===typeof _0x55a972){_0x9d106f+='\x20'+_0x55a972;}if(_0x9d106f!==''){return _0x9d106f;}return _0x12e6e0;}function Action(_0x3f1bde,_0x42f720,_0x1b099b){this[_0xf057('0x4')]=_0x3f1bde;this[_0xf057('0x5')]=_0x1b099b||undefined;this[_0xf057('0x6')]=checkNameSurname(_0x42f720[_0xf057('0x7')]['phone'],_0x42f720['Contact'][_0xf057('0x8')],_0x42f720[_0xf057('0x7')]['lastName']);this[_0xf057('0x9')]=_0x42f720['Contact'][_0xf057('0xa')];this[_0xf057('0xb')]=_0x3f1bde[_0xf057('0x6')];this[_0xf057('0xc')]=_0x42f720['active']||![];this[_0xf057('0xd')]=_0x3f1bde[_0xf057('0xd')];this[_0xf057('0xe')]=_0x3f1bde[_0xf057('0xe')]||0x3;this['scheduledat']=_0x42f720[_0xf057('0xf')];this['countbusyretry']=_0x42f720[_0xf057('0x10')];this['countcongestionretry']=_0x42f720[_0xf057('0x11')];this[_0xf057('0x12')]=_0x42f720[_0xf057('0x12')];this[_0xf057('0x13')]=_0x42f720[_0xf057('0x13')];this[_0xf057('0x14')]=_0x42f720[_0xf057('0x14')];this[_0xf057('0x15')]=_0x42f720['countabandonedretry'];this[_0xf057('0x16')]=_0x42f720['countmachineretry'];this[_0xf057('0x17')]=_0x42f720[_0xf057('0x17')];this['ContactId']=_0x42f720[_0xf057('0x18')];this[_0xf057('0x19')]=_0x42f720[_0xf057('0x19')];this[_0xf057('0x1a')]=_0x42f720[_0xf057('0x1a')];this[_0xf057('0x1b')]=_0x42f720['VoiceQueueId'];this[_0xf057('0x1c')]=_0x42f720['CampaignId'];this[_0xf057('0x1d')]=_0x42f720['id'];this[_0xf057('0x1e')]=_0x42f720[_0xf057('0x7')]['firstName']||'';this[_0xf057('0x1f')]=moment()[_0xf057('0x20')](_0xf057('0x21'));this[_0xf057('0x22')]=_0x42f720[_0xf057('0x22')];this['callbackuniqueid']=_0x42f720[_0xf057('0x23')];this[_0xf057('0x24')]=_0x42f720[_0xf057('0x24')];this[_0xf057('0x25')]=_0x42f720[_0xf057('0x25')];this[_0xf057('0x26')]='';this[_0xf057('0x27')]='';}Action[_0xf057('0x28')][_0xf057('0x29')]=function(){return util[_0xf057('0x20')](_0xf057('0x2a'),this[_0xf057('0x6')],this[_0xf057('0x4')][_0xf057('0x2b')]>0x0?this[_0xf057('0x9')][_0xf057('0x2c')](this[_0xf057('0x4')][_0xf057('0x2b')]):this[_0xf057('0x9')]);};Action['prototype'][_0xf057('0x2d')]=function(){return this[_0xf057('0xb')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index 0cbd7d2..e1ef94c 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 _0x4757=['diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','util','lodash'];(function(_0x51cebf,_0x307dd2){var _0x3881d8=function(_0x5344f5){while(--_0x5344f5){_0x51cebf['push'](_0x51cebf['shift']());}};_0x3881d8(++_0x307dd2);}(_0x4757,0x1df));var _0x7475=function(_0x3d5f84,_0x569548){_0x3d5f84=_0x3d5f84-0x0;var _0x1981b8=_0x4757[_0x3d5f84];return _0x1981b8;};'use strict';var util=require(_0x7475('0x0'));var _=require(_0x7475('0x1'));var moment=require('moment');function getSeconds(_0x37e4cb,_0x10e47d){var _0x56b57c=moment(_0x37e4cb)['milliseconds'](0x0);var _0x551c39=moment(_0x10e47d)['milliseconds'](0x0);return _0x56b57c[_0x7475('0x2')](_0x551c39,_0x7475('0x3'));}function AdditionalPhone(_0x48623c){this[_0x7475('0x4')]=_0x48623c['uniqueid'];this['scheduledat']=_0x48623c[_0x7475('0x5')]||undefined;this['type']=_0x48623c[_0x7475('0x6')];this[_0x7475('0x7')]=_0x48623c[_0x7475('0x6')]===_0x7475('0x8')?_0x7475('0x9'):_0x48623c[_0x7475('0x6')];this[_0x7475('0xa')]=_0x48623c[_0x7475('0xa')];this['countcongestionretry']=_0x48623c[_0x7475('0xb')];this[_0x7475('0xc')]=_0x48623c['countnoanswerretry'];this['countglobal']=_0x48623c[_0x7475('0xa')]+_0x48623c[_0x7475('0xb')]+_0x48623c[_0x7475('0xc')]+_0x48623c['countnosuchnumberretry']+_0x48623c[_0x7475('0xd')]+_0x48623c[_0x7475('0xe')]+_0x48623c[_0x7475('0xf')]+_0x48623c[_0x7475('0x10')];this[_0x7475('0x11')]=_0x48623c[_0x7475('0x11')];this[_0x7475('0xd')]=_0x48623c[_0x7475('0xd')];this[_0x7475('0xe')]=_0x48623c[_0x7475('0xe')];this[_0x7475('0xf')]=_0x48623c[_0x7475('0xf')];this[_0x7475('0x10')]=_0x48623c['countagentrejectretry'];this[_0x7475('0x9')]=_0x48623c[_0x7475('0x9')];this[_0x7475('0x12')]=_0x48623c[_0x7475('0x13')];this[_0x7475('0x14')]=_0x48623c[_0x7475('0x15')];this[_0x7475('0x16')]=_0x48623c['starttime'];this['responsetime']=_0x48623c[_0x7475('0x17')];this[_0x7475('0x18')]=_0x48623c[_0x7475('0x17')];this[_0x7475('0x19')]=getSeconds(_0x48623c['responsetime'],_0x48623c[_0x7475('0x16')]);this['holdtime']=0x0;this[_0x7475('0x1a')]=0x0;this[_0x7475('0x1b')]=_0x48623c[_0x7475('0x1b')];this[_0x7475('0x1c')]=_0x48623c[_0x7475('0x1c')];this[_0x7475('0x1d')]=_0x48623c[_0x7475('0x1d')];this[_0x7475('0x1e')]=_0x48623c['recallme'];this[_0x7475('0x1f')]=_0x48623c[_0x7475('0x1f')];this[_0x7475('0x20')]=_0x48623c['ListId'];this['UserId']=_0x48623c[_0x7475('0x21')];this[_0x7475('0x22')]=_0x48623c[_0x7475('0x22')];this['CampaignId']=_0x48623c['CampaignId'];this[_0x7475('0x23')]=_0x48623c[_0x7475('0x23')]||'';this[_0x7475('0x24')]=_0x48623c[_0x7475('0x24')]||'';}module['exports']=History; \ No newline at end of file +var _0xeef5=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','number','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x2cd8a4,_0x51fb40){var _0x375630=function(_0x89a898){while(--_0x89a898){_0x2cd8a4['push'](_0x2cd8a4['shift']());}};_0x375630(++_0x51fb40);}(_0xeef5,0x8a));var _0x5eef=function(_0xb67ecc,_0x1c86ec){_0xb67ecc=_0xb67ecc-0x0;var _0x4c974b=_0xeef5[_0xb67ecc];return _0x4c974b;};'use strict';var util=require(_0x5eef('0x0'));var _=require(_0x5eef('0x1'));var moment=require(_0x5eef('0x2'));function getSeconds(_0x27edc0,_0x1922e0){var _0x5a1fcb=moment(_0x27edc0)['milliseconds'](0x0);var _0x2f5ecb=moment(_0x1922e0)[_0x5eef('0x3')](0x0);return _0x5a1fcb[_0x5eef('0x4')](_0x2f5ecb,_0x5eef('0x5'));}function AdditionalPhone(_0x4f1ff4){this['uniqueid']=_0x4f1ff4[_0x5eef('0x6')];this[_0x5eef('0x7')]=_0x4f1ff4[_0x5eef('0x7')]||undefined;this[_0x5eef('0x8')]=_0x4f1ff4[_0x5eef('0x8')];this['campaigntype']=_0x4f1ff4[_0x5eef('0x8')]===_0x5eef('0x9')?'queue':_0x4f1ff4[_0x5eef('0x8')];this['countbusyretry']=_0x4f1ff4[_0x5eef('0xa')];this['countcongestionretry']=_0x4f1ff4[_0x5eef('0xb')];this[_0x5eef('0xc')]=_0x4f1ff4[_0x5eef('0xc')];this[_0x5eef('0xd')]=_0x4f1ff4[_0x5eef('0xa')]+_0x4f1ff4['countcongestionretry']+_0x4f1ff4[_0x5eef('0xc')]+_0x4f1ff4[_0x5eef('0xe')]+_0x4f1ff4[_0x5eef('0xf')]+_0x4f1ff4[_0x5eef('0x10')]+_0x4f1ff4[_0x5eef('0x11')]+_0x4f1ff4[_0x5eef('0x12')];this[_0x5eef('0xe')]=_0x4f1ff4['countnosuchnumberretry'];this['countdropretry']=_0x4f1ff4[_0x5eef('0xf')];this[_0x5eef('0x10')]=_0x4f1ff4['countabandonedretry'];this['countmachineretry']=_0x4f1ff4[_0x5eef('0x11')];this[_0x5eef('0x12')]=_0x4f1ff4[_0x5eef('0x12')];this[_0x5eef('0x13')]=_0x4f1ff4[_0x5eef('0x13')];this[_0x5eef('0x14')]=_0x4f1ff4['name'];this[_0x5eef('0x15')]=_0x4f1ff4[_0x5eef('0x16')];this[_0x5eef('0x17')]=_0x4f1ff4[_0x5eef('0x17')];this[_0x5eef('0x18')]=_0x4f1ff4[_0x5eef('0x18')];this[_0x5eef('0x19')]=_0x4f1ff4[_0x5eef('0x18')];this['ringtime']=getSeconds(_0x4f1ff4[_0x5eef('0x18')],_0x4f1ff4[_0x5eef('0x17')]);this[_0x5eef('0x1a')]=0x0;this[_0x5eef('0x1b')]=0x0;this['callback']=_0x4f1ff4[_0x5eef('0x1c')];this[_0x5eef('0x1d')]=_0x4f1ff4[_0x5eef('0x1d')];this[_0x5eef('0x1e')]=_0x4f1ff4[_0x5eef('0x1e')];this[_0x5eef('0x1f')]=_0x4f1ff4[_0x5eef('0x1f')];this['ContactId']=_0x4f1ff4[_0x5eef('0x20')];this['ListId']=_0x4f1ff4['ListId'];this[_0x5eef('0x21')]=_0x4f1ff4[_0x5eef('0x21')];this['VoiceQueueId']=_0x4f1ff4['VoiceQueueId'];this['CampaignId']=_0x4f1ff4[_0x5eef('0x22')];this[_0x5eef('0x23')]=_0x4f1ff4[_0x5eef('0x23')]||'';this[_0x5eef('0x24')]=_0x4f1ff4[_0x5eef('0x24')]||'';}module[_0x5eef('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 395beb5..d1d9335 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 _0xbce9=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','talktime','queue','membername','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','campaigntype','countbusyretry','countcongestionretry'];(function(_0xcec3d0,_0xd9cb55){var _0x4545b7=function(_0x359123){while(--_0x359123){_0xcec3d0['push'](_0xcec3d0['shift']());}};_0x4545b7(++_0xd9cb55);}(_0xbce9,0x102));var _0x9bce=function(_0x2d8db5,_0x3c9c8d){_0x2d8db5=_0x2d8db5-0x0;var _0xdc5579=_0xbce9[_0x2d8db5];return _0xdc5579;};'use strict';var util=require(_0x9bce('0x0'));var _=require(_0x9bce('0x1'));var moment=require('moment');function getSeconds(_0x51fea0,_0x4ab1d9){var _0xf72d0d=moment(_0x51fea0)[_0x9bce('0x2')](0x0);var _0x230ddb=moment(_0x4ab1d9)[_0x9bce('0x2')](0x0);return _0xf72d0d[_0x9bce('0x3')](_0x230ddb,_0x9bce('0x4'));}function AgentComplete(_0x49f8f5,_0x37ac79){this['state']=0x4;this[_0x9bce('0x5')]=_0x9bce('0x6');this[_0x9bce('0x7')]=_0x49f8f5[_0x9bce('0x7')];this[_0x9bce('0x8')]=_0x49f8f5[_0x9bce('0x8')];this[_0x9bce('0x9')]=_0x49f8f5[_0x9bce('0x8')]==='outbound'?'queue':_0x49f8f5[_0x9bce('0x8')];this['countbusyretry']=_0x49f8f5[_0x9bce('0xa')];this[_0x9bce('0xb')]=_0x49f8f5[_0x9bce('0xb')];this['countnoanswerretry']=_0x49f8f5[_0x9bce('0xc')];this[_0x9bce('0xd')]=_0x49f8f5[_0x9bce('0xa')]+_0x49f8f5[_0x9bce('0xb')]+_0x49f8f5[_0x9bce('0xc')]+_0x49f8f5[_0x9bce('0xe')]+_0x49f8f5[_0x9bce('0xf')]+_0x49f8f5[_0x9bce('0x10')]+_0x49f8f5[_0x9bce('0x11')]+_0x49f8f5[_0x9bce('0x12')];this[_0x9bce('0xe')]=_0x49f8f5[_0x9bce('0xe')];this[_0x9bce('0xf')]=_0x49f8f5['countdropretry'];this[_0x9bce('0x10')]=_0x49f8f5[_0x9bce('0x10')];this[_0x9bce('0x11')]=_0x49f8f5[_0x9bce('0x11')];this[_0x9bce('0x12')]=_0x49f8f5[_0x9bce('0x12')];this[_0x9bce('0x13')]=_0x37ac79[_0x9bce('0x13')];this[_0x9bce('0x14')]=_0x49f8f5[_0x9bce('0x15')];this[_0x9bce('0x16')]=_0x49f8f5[_0x9bce('0x17')];this['starttime']=_0x49f8f5[_0x9bce('0x18')];this[_0x9bce('0x19')]=_0x49f8f5[_0x9bce('0x19')];this[_0x9bce('0x1a')]=_0x49f8f5[_0x9bce('0x1a')];this[_0x9bce('0x1b')]=moment()[_0x9bce('0x1c')](_0x9bce('0x1d'));this['ringtime']=getSeconds(_0x49f8f5[_0x9bce('0x19')],_0x49f8f5[_0x9bce('0x18')]);this['holdtime']=getSeconds(_0x49f8f5[_0x9bce('0x1a')],_0x49f8f5[_0x9bce('0x19')]);this[_0x9bce('0x1e')]=getSeconds(this[_0x9bce('0x1b')],_0x49f8f5[_0x9bce('0x1a')]);this[_0x9bce('0x1f')]=_0x37ac79[_0x9bce('0x1f')];this['membername']=_0x37ac79[_0x9bce('0x20')];this['reason']=_0x37ac79['reason'];this[_0x9bce('0x21')]=_0x49f8f5['callback'];this[_0x9bce('0x22')]=_0x49f8f5[_0x9bce('0x22')];this['callbackat']=_0x49f8f5[_0x9bce('0x23')];this[_0x9bce('0x24')]=_0x49f8f5['recallme'];this[_0x9bce('0x25')]=_0x49f8f5['ContactId'];this[_0x9bce('0x26')]=_0x49f8f5['ListId'];this[_0x9bce('0x27')]=_0x49f8f5[_0x9bce('0x27')];this[_0x9bce('0x28')]=_0x49f8f5[_0x9bce('0x28')];this[_0x9bce('0x29')]=_0x49f8f5[_0x9bce('0x29')];this[_0x9bce('0x2a')]=_0x49f8f5[_0x9bce('0x2a')]||'';this['originatecalleridname']=_0x49f8f5[_0x9bce('0x2b')]||'';}module[_0x9bce('0x2c')]=AgentComplete; \ No newline at end of file +var _0xf928=['countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','outbound','queue'];(function(_0x13647c,_0x4822a7){var _0x341ecb=function(_0x79eb2){while(--_0x79eb2){_0x13647c['push'](_0x13647c['shift']());}};_0x341ecb(++_0x4822a7);}(_0xf928,0x1d3));var _0x8f92=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf928[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x8f92('0x0'));var _=require(_0x8f92('0x1'));var moment=require(_0x8f92('0x2'));function getSeconds(_0x1761e2,_0x455416){var _0x17138a=moment(_0x1761e2)[_0x8f92('0x3')](0x0);var _0x103a77=moment(_0x455416)['milliseconds'](0x0);return _0x17138a[_0x8f92('0x4')](_0x103a77,_0x8f92('0x5'));}function AgentComplete(_0x1b565f,_0x59f8f3){this[_0x8f92('0x6')]=0x4;this[_0x8f92('0x7')]=_0x8f92('0x8');this['scheduledat']=_0x1b565f[_0x8f92('0x9')];this[_0x8f92('0xa')]=_0x1b565f[_0x8f92('0xa')];this['campaigntype']=_0x1b565f[_0x8f92('0xa')]===_0x8f92('0xb')?_0x8f92('0xc'):_0x1b565f[_0x8f92('0xa')];this[_0x8f92('0xd')]=_0x1b565f[_0x8f92('0xd')];this[_0x8f92('0xe')]=_0x1b565f[_0x8f92('0xe')];this['countnoanswerretry']=_0x1b565f['countnoanswerretry'];this[_0x8f92('0xf')]=_0x1b565f[_0x8f92('0xd')]+_0x1b565f['countcongestionretry']+_0x1b565f[_0x8f92('0x10')]+_0x1b565f[_0x8f92('0x11')]+_0x1b565f[_0x8f92('0x12')]+_0x1b565f[_0x8f92('0x13')]+_0x1b565f[_0x8f92('0x14')]+_0x1b565f[_0x8f92('0x15')];this['countnosuchnumberretry']=_0x1b565f[_0x8f92('0x11')];this[_0x8f92('0x12')]=_0x1b565f[_0x8f92('0x12')];this[_0x8f92('0x13')]=_0x1b565f[_0x8f92('0x13')];this[_0x8f92('0x14')]=_0x1b565f[_0x8f92('0x14')];this[_0x8f92('0x15')]=_0x1b565f[_0x8f92('0x15')];this[_0x8f92('0x16')]=_0x59f8f3[_0x8f92('0x16')];this[_0x8f92('0x17')]=_0x1b565f[_0x8f92('0x18')];this[_0x8f92('0x19')]=_0x1b565f[_0x8f92('0x1a')];this['starttime']=_0x1b565f[_0x8f92('0x1b')];this['responsetime']=_0x1b565f[_0x8f92('0x1c')];this['answertime']=_0x1b565f[_0x8f92('0x1d')];this[_0x8f92('0x1e')]=moment()[_0x8f92('0x1f')](_0x8f92('0x20'));this[_0x8f92('0x21')]=getSeconds(_0x1b565f[_0x8f92('0x1c')],_0x1b565f[_0x8f92('0x1b')]);this[_0x8f92('0x22')]=getSeconds(_0x1b565f['answertime'],_0x1b565f[_0x8f92('0x1c')]);this[_0x8f92('0x23')]=getSeconds(this[_0x8f92('0x1e')],_0x1b565f[_0x8f92('0x1d')]);this[_0x8f92('0xc')]=_0x59f8f3[_0x8f92('0xc')];this[_0x8f92('0x24')]=_0x59f8f3[_0x8f92('0x24')];this['reason']=_0x59f8f3['reason'];this[_0x8f92('0x25')]=_0x1b565f[_0x8f92('0x25')];this[_0x8f92('0x26')]=_0x1b565f[_0x8f92('0x26')];this[_0x8f92('0x27')]=_0x1b565f[_0x8f92('0x27')];this[_0x8f92('0x28')]=_0x1b565f['recallme'];this['ContactId']=_0x1b565f[_0x8f92('0x29')];this[_0x8f92('0x2a')]=_0x1b565f[_0x8f92('0x2a')];this[_0x8f92('0x2b')]=_0x1b565f['UserId'];this['VoiceQueueId']=_0x1b565f['VoiceQueueId'];this[_0x8f92('0x2c')]=_0x1b565f[_0x8f92('0x2c')];this['originatecalleridnum']=_0x1b565f[_0x8f92('0x2d')]||'';this['originatecalleridname']=_0x1b565f[_0x8f92('0x2e')]||'';}module[_0x8f92('0x2f')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 3a50513..bfe1f9f 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 _0x8719=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countnoanswerretry','countglobal','countcongestionretry'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x8719,0x1ed));var _0x9871=function(_0x11f898,_0x5e1c47){_0x11f898=_0x11f898-0x0;var _0x1f78f0=_0x8719[_0x11f898];return _0x1f78f0;};'use strict';var util=require(_0x9871('0x0'));var _=require(_0x9871('0x1'));var moment=require('moment');function getSeconds(_0x5a66e8,_0x4ae343){var _0x5a8049=moment(_0x5a66e8)['milliseconds'](0x0);var _0x26117c=moment(_0x4ae343)[_0x9871('0x2')](0x0);return _0x5a8049[_0x9871('0x3')](_0x26117c,_0x9871('0x4'));}function Final(_0x5d6ffd){this[_0x9871('0x5')]=_0x5d6ffd['uniqueid'];this['scheduledat']=_0x5d6ffd[_0x9871('0x6')];this['type']=_0x5d6ffd[_0x9871('0x7')];this[_0x9871('0x8')]=_0x5d6ffd[_0x9871('0x7')]===_0x9871('0x9')?'queue':_0x5d6ffd[_0x9871('0x7')];this[_0x9871('0xa')]=_0x5d6ffd[_0x9871('0xa')];this['countcongestionretry']=_0x5d6ffd['countcongestionretry'];this[_0x9871('0xb')]=_0x5d6ffd['countnoanswerretry'];this[_0x9871('0xc')]=_0x5d6ffd[_0x9871('0xa')]+_0x5d6ffd[_0x9871('0xd')]+_0x5d6ffd[_0x9871('0xb')]+_0x5d6ffd[_0x9871('0xe')]+_0x5d6ffd[_0x9871('0xf')]+_0x5d6ffd[_0x9871('0x10')]+_0x5d6ffd[_0x9871('0x11')]+_0x5d6ffd['countagentrejectretry'];this[_0x9871('0xe')]=_0x5d6ffd[_0x9871('0xe')];this['countdropretry']=_0x5d6ffd[_0x9871('0xf')];this[_0x9871('0x10')]=_0x5d6ffd[_0x9871('0x10')];this[_0x9871('0x11')]=_0x5d6ffd[_0x9871('0x11')];this[_0x9871('0x12')]=_0x5d6ffd[_0x9871('0x12')];this[_0x9871('0x13')]=_0x5d6ffd[_0x9871('0x13')];this[_0x9871('0x14')]=_0x5d6ffd[_0x9871('0x14')];this[_0x9871('0x15')]=_0x5d6ffd[_0x9871('0x15')];this[_0x9871('0x16')]=_0x5d6ffd[_0x9871('0x16')];this[_0x9871('0x17')]=_0x5d6ffd[_0x9871('0x17')];this[_0x9871('0x18')]=_0x5d6ffd['responsetime'];this[_0x9871('0x19')]=_0x5d6ffd[_0x9871('0x19')]||0x0;this[_0x9871('0x1a')]=_0x5d6ffd[_0x9871('0x1a')]||0x0;this['talktime']=_0x5d6ffd['talktime']||0x0;this[_0x9871('0x1b')]=_0x5d6ffd['callback'];this[_0x9871('0x1c')]=_0x5d6ffd[_0x9871('0x1c')];this[_0x9871('0x1d')]=_0x5d6ffd[_0x9871('0x1d')];this[_0x9871('0x1e')]=_0x5d6ffd[_0x9871('0x1e')];this[_0x9871('0x1f')]=_0x5d6ffd[_0x9871('0x1f')];this[_0x9871('0x20')]=_0x5d6ffd[_0x9871('0x20')];this[_0x9871('0x21')]=_0x5d6ffd[_0x9871('0x21')];this['VoiceQueueId']=_0x5d6ffd[_0x9871('0x22')];this[_0x9871('0x23')]=_0x5d6ffd[_0x9871('0x23')];this[_0x9871('0x24')]=_0x5d6ffd['originatecalleridnum']||'';this[_0x9871('0x25')]=_0x5d6ffd[_0x9871('0x25')]||'';}module[_0x9871('0x26')]=Final; \ No newline at end of file +var _0x1a94=['moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash'];(function(_0x3c4e27,_0x481e0c){var _0x724fe7=function(_0x2c4920){while(--_0x2c4920){_0x3c4e27['push'](_0x3c4e27['shift']());}};_0x724fe7(++_0x481e0c);}(_0x1a94,0x154));var _0x41a9=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x1a94[_0x187ee1];return _0x388160;};'use strict';var util=require(_0x41a9('0x0'));var _=require(_0x41a9('0x1'));var moment=require(_0x41a9('0x2'));function getSeconds(_0x885a3,_0x34367d){var _0x1d4612=moment(_0x885a3)[_0x41a9('0x3')](0x0);var _0x12a23a=moment(_0x34367d)[_0x41a9('0x3')](0x0);return _0x1d4612[_0x41a9('0x4')](_0x12a23a,_0x41a9('0x5'));}function Final(_0x244ef2){this['uniqueid']=_0x244ef2[_0x41a9('0x6')];this['scheduledat']=_0x244ef2[_0x41a9('0x7')];this[_0x41a9('0x8')]=_0x244ef2[_0x41a9('0x8')];this[_0x41a9('0x9')]=_0x244ef2[_0x41a9('0x8')]===_0x41a9('0xa')?'queue':_0x244ef2[_0x41a9('0x8')];this[_0x41a9('0xb')]=_0x244ef2['countbusyretry'];this['countcongestionretry']=_0x244ef2[_0x41a9('0xc')];this[_0x41a9('0xd')]=_0x244ef2[_0x41a9('0xd')];this[_0x41a9('0xe')]=_0x244ef2[_0x41a9('0xb')]+_0x244ef2['countcongestionretry']+_0x244ef2[_0x41a9('0xd')]+_0x244ef2['countnosuchnumberretry']+_0x244ef2[_0x41a9('0xf')]+_0x244ef2[_0x41a9('0x10')]+_0x244ef2['countmachineretry']+_0x244ef2[_0x41a9('0x11')];this[_0x41a9('0x12')]=_0x244ef2[_0x41a9('0x12')];this['countdropretry']=_0x244ef2['countdropretry'];this[_0x41a9('0x10')]=_0x244ef2['countabandonedretry'];this[_0x41a9('0x13')]=_0x244ef2[_0x41a9('0x13')];this[_0x41a9('0x11')]=_0x244ef2[_0x41a9('0x11')];this['queue']=_0x244ef2['queue'];this['calleridname']=_0x244ef2[_0x41a9('0x14')];this['calleridnum']=_0x244ef2[_0x41a9('0x15')];this[_0x41a9('0x16')]=_0x244ef2[_0x41a9('0x16')];this[_0x41a9('0x17')]=_0x244ef2[_0x41a9('0x17')];this['endtime']=_0x244ef2[_0x41a9('0x17')];this[_0x41a9('0x18')]=_0x244ef2[_0x41a9('0x18')]||0x0;this[_0x41a9('0x19')]=_0x244ef2['holdtime']||0x0;this['talktime']=_0x244ef2[_0x41a9('0x1a')]||0x0;this[_0x41a9('0x1b')]=_0x244ef2[_0x41a9('0x1b')];this[_0x41a9('0x1c')]=_0x244ef2['callbackuniqueid'];this[_0x41a9('0x1d')]=_0x244ef2[_0x41a9('0x1d')];this[_0x41a9('0x1e')]=_0x244ef2[_0x41a9('0x1e')];this[_0x41a9('0x1f')]=_0x244ef2['ContactId'];this[_0x41a9('0x20')]=_0x244ef2[_0x41a9('0x20')];this['UserId']=_0x244ef2['UserId'];this[_0x41a9('0x21')]=_0x244ef2[_0x41a9('0x21')];this[_0x41a9('0x22')]=_0x244ef2[_0x41a9('0x22')];this[_0x41a9('0x23')]=_0x244ef2['originatecalleridnum']||'';this[_0x41a9('0x24')]=_0x244ef2[_0x41a9('0x24')]||'';}module[_0x41a9('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 43f396f..b62e7e8 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 _0xea52=['format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','cause-txt','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','number','starttime','responsetime','endtime'];(function(_0x249f58,_0x5b7462){var _0x36ba17=function(_0x4c8738){while(--_0x4c8738){_0x249f58['push'](_0x249f58['shift']());}};_0x36ba17(++_0x5b7462);}(_0xea52,0x13d));var _0x2ea5=function(_0x4d45cc,_0x5139b7){_0x4d45cc=_0x4d45cc-0x0;var _0x5b6795=_0xea52[_0x4d45cc];return _0x5b6795;};'use strict';var util=require(_0x2ea5('0x0'));var _=require(_0x2ea5('0x1'));var moment=require(_0x2ea5('0x2'));function getSeconds(_0x5a1622,_0x454f22){var _0x38a649=moment(_0x5a1622)[_0x2ea5('0x3')](0x0);var _0x5762f6=moment(_0x454f22)[_0x2ea5('0x3')](0x0);return _0x38a649[_0x2ea5('0x4')](_0x5762f6,_0x2ea5('0x5'));}function Hangup(_0x2cf708,_0x26dbde){this[_0x2ea5('0x6')]=0x4;this[_0x2ea5('0x7')]=_0x2ea5('0x8');this[_0x2ea5('0x9')]=_0x2cf708[_0x2ea5('0x9')];this[_0x2ea5('0xa')]=_0x2cf708[_0x2ea5('0xa')];this['campaigntype']=_0x2cf708[_0x2ea5('0xa')]==='outbound'?_0x2ea5('0xb'):_0x2cf708[_0x2ea5('0xa')];this['countbusyretry']=_0x2cf708['countbusyretry'];this[_0x2ea5('0xc')]=_0x2cf708[_0x2ea5('0xc')];this[_0x2ea5('0xd')]=_0x2cf708[_0x2ea5('0xd')];this[_0x2ea5('0xe')]=_0x2cf708[_0x2ea5('0xf')]+_0x2cf708['countcongestionretry']+_0x2cf708[_0x2ea5('0xd')]+_0x2cf708[_0x2ea5('0x10')]+_0x2cf708[_0x2ea5('0x11')]+_0x2cf708['countabandonedretry']+_0x2cf708['countmachineretry']+_0x2cf708['countagentrejectretry'];this['countnosuchnumberretry']=_0x2cf708[_0x2ea5('0x10')];this[_0x2ea5('0x11')]=_0x2cf708['countdropretry'];this[_0x2ea5('0x12')]=_0x2cf708[_0x2ea5('0x12')];this['countmachineretry']=_0x2cf708[_0x2ea5('0x13')];this[_0x2ea5('0x14')]=_0x2cf708[_0x2ea5('0x14')];this[_0x2ea5('0x15')]=_0x26dbde[_0x2ea5('0x15')];this[_0x2ea5('0x16')]=_0x2cf708['name'];this['calleridnum']=_0x2cf708[_0x2ea5('0x17')];this[_0x2ea5('0x18')]=_0x2cf708[_0x2ea5('0x18')];this['responsetime']=_0x2cf708[_0x2ea5('0x19')];this[_0x2ea5('0x1a')]=moment()[_0x2ea5('0x1b')](_0x2ea5('0x1c'));this[_0x2ea5('0x1d')]=getSeconds(_0x2cf708['responsetime'],_0x2cf708[_0x2ea5('0x18')]);this[_0x2ea5('0x1e')]=0x0;this[_0x2ea5('0x1f')]=getSeconds(this[_0x2ea5('0x1a')],_0x2cf708['responsetime']);this[_0x2ea5('0xb')]=_0x2cf708['queue'];this[_0x2ea5('0x20')]=_0x2ea5('0x21');this['reason']=_0x26dbde[_0x2ea5('0x22')];this['callback']=_0x2cf708['callback'];this[_0x2ea5('0x23')]=_0x2cf708[_0x2ea5('0x23')];this[_0x2ea5('0x24')]=_0x2cf708['callbackat'];this[_0x2ea5('0x25')]=_0x2cf708[_0x2ea5('0x25')];this['ContactId']=_0x2cf708[_0x2ea5('0x26')];this[_0x2ea5('0x27')]=_0x2cf708[_0x2ea5('0x27')];this[_0x2ea5('0x28')]=_0x2cf708['UserId'];this[_0x2ea5('0x29')]=_0x2cf708[_0x2ea5('0x29')];this['CampaignId']=_0x2cf708['CampaignId'];}module[_0x2ea5('0x2a')]=Hangup; \ No newline at end of file +var _0xc8dd=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','IVR','reason','cause-txt','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','Answer','scheduledat','type','campaigntype'];(function(_0x5da0d9,_0x49ee54){var _0x4b6d2f=function(_0x9832cf){while(--_0x9832cf){_0x5da0d9['push'](_0x5da0d9['shift']());}};_0x4b6d2f(++_0x49ee54);}(_0xc8dd,0xad));var _0xdc8d=function(_0x4164f2,_0x38669f){_0x4164f2=_0x4164f2-0x0;var _0x2575c7=_0xc8dd[_0x4164f2];return _0x2575c7;};'use strict';var util=require(_0xdc8d('0x0'));var _=require(_0xdc8d('0x1'));var moment=require(_0xdc8d('0x2'));function getSeconds(_0x1fca2e,_0x556700){var _0x44db64=moment(_0x1fca2e)[_0xdc8d('0x3')](0x0);var _0x3297a6=moment(_0x556700)['milliseconds'](0x0);return _0x44db64[_0xdc8d('0x4')](_0x3297a6,_0xdc8d('0x5'));}function Hangup(_0x379c0d,_0x1e85cd){this[_0xdc8d('0x6')]=0x4;this['statedesc']=_0xdc8d('0x7');this['scheduledat']=_0x379c0d[_0xdc8d('0x8')];this[_0xdc8d('0x9')]=_0x379c0d[_0xdc8d('0x9')];this[_0xdc8d('0xa')]=_0x379c0d[_0xdc8d('0x9')]===_0xdc8d('0xb')?_0xdc8d('0xc'):_0x379c0d[_0xdc8d('0x9')];this[_0xdc8d('0xd')]=_0x379c0d['countbusyretry'];this[_0xdc8d('0xe')]=_0x379c0d[_0xdc8d('0xe')];this[_0xdc8d('0xf')]=_0x379c0d[_0xdc8d('0xf')];this['countglobal']=_0x379c0d[_0xdc8d('0xd')]+_0x379c0d['countcongestionretry']+_0x379c0d['countnoanswerretry']+_0x379c0d[_0xdc8d('0x10')]+_0x379c0d[_0xdc8d('0x11')]+_0x379c0d[_0xdc8d('0x12')]+_0x379c0d[_0xdc8d('0x13')]+_0x379c0d[_0xdc8d('0x14')];this[_0xdc8d('0x10')]=_0x379c0d[_0xdc8d('0x10')];this[_0xdc8d('0x11')]=_0x379c0d[_0xdc8d('0x11')];this['countabandonedretry']=_0x379c0d[_0xdc8d('0x12')];this[_0xdc8d('0x13')]=_0x379c0d['countmachineretry'];this[_0xdc8d('0x14')]=_0x379c0d[_0xdc8d('0x14')];this[_0xdc8d('0x15')]=_0x1e85cd[_0xdc8d('0x15')];this[_0xdc8d('0x16')]=_0x379c0d[_0xdc8d('0x17')];this[_0xdc8d('0x18')]=_0x379c0d[_0xdc8d('0x19')];this[_0xdc8d('0x1a')]=_0x379c0d['starttime'];this[_0xdc8d('0x1b')]=_0x379c0d[_0xdc8d('0x1b')];this[_0xdc8d('0x1c')]=moment()[_0xdc8d('0x1d')](_0xdc8d('0x1e'));this[_0xdc8d('0x1f')]=getSeconds(_0x379c0d[_0xdc8d('0x1b')],_0x379c0d[_0xdc8d('0x1a')]);this[_0xdc8d('0x20')]=0x0;this[_0xdc8d('0x21')]=getSeconds(this['endtime'],_0x379c0d[_0xdc8d('0x1b')]);this[_0xdc8d('0xc')]=_0x379c0d[_0xdc8d('0xc')];this['membername']=_0xdc8d('0x22');this[_0xdc8d('0x23')]=_0x1e85cd[_0xdc8d('0x24')];this['callback']=_0x379c0d['callback'];this['callbackuniqueid']=_0x379c0d[_0xdc8d('0x25')];this[_0xdc8d('0x26')]=_0x379c0d['callbackat'];this[_0xdc8d('0x27')]=_0x379c0d[_0xdc8d('0x27')];this[_0xdc8d('0x28')]=_0x379c0d[_0xdc8d('0x28')];this[_0xdc8d('0x29')]=_0x379c0d[_0xdc8d('0x29')];this[_0xdc8d('0x2a')]=_0x379c0d[_0xdc8d('0x2a')];this[_0xdc8d('0x2b')]=_0x379c0d[_0xdc8d('0x2b')];this[_0xdc8d('0x2c')]=_0x379c0d[_0xdc8d('0x2c')];}module[_0xdc8d('0x2d')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index cefb73c..ae8fe5e 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 _0x2b44=['starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countdropretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','countmachineretry','queue','calleridname','name','calleridnum'];(function(_0x265550,_0x232be3){var _0x290952=function(_0x3d8dd3){while(--_0x3d8dd3){_0x265550['push'](_0x265550['shift']());}};_0x290952(++_0x232be3);}(_0x2b44,0x1d7));var _0x42b4=function(_0x232127,_0x1acc42){_0x232127=_0x232127-0x0;var _0xc3064f=_0x2b44[_0x232127];return _0xc3064f;};'use strict';var util=require(_0x42b4('0x0'));var _=require('lodash');var moment=require(_0x42b4('0x1'));function getSeconds(_0x3eaacf,_0x6e82ac){var _0xb143b=moment(_0x3eaacf)[_0x42b4('0x2')](0x0);var _0x1cab7d=moment(_0x6e82ac)[_0x42b4('0x2')](0x0);return _0xb143b[_0x42b4('0x3')](_0x1cab7d,_0x42b4('0x4'));}function History(_0x454a93){this['uniqueid']=_0x454a93[_0x42b4('0x5')];this[_0x42b4('0x6')]=_0x454a93[_0x42b4('0x6')]||undefined;this[_0x42b4('0x7')]=_0x454a93[_0x42b4('0x7')];this[_0x42b4('0x8')]=_0x454a93[_0x42b4('0x7')]===_0x42b4('0x9')?'queue':_0x454a93['type'];this[_0x42b4('0xa')]=_0x454a93[_0x42b4('0xa')];this[_0x42b4('0xb')]=_0x454a93['countcongestionretry'];this['countnoanswerretry']=_0x454a93['countnoanswerretry'];this[_0x42b4('0xc')]=_0x454a93[_0x42b4('0xa')]+_0x454a93[_0x42b4('0xb')]+_0x454a93[_0x42b4('0xd')]+_0x454a93['countnosuchnumberretry']+_0x454a93[_0x42b4('0xe')]+_0x454a93['countabandonedretry']+_0x454a93['countmachineretry']+_0x454a93[_0x42b4('0xf')];this[_0x42b4('0x10')]=_0x454a93[_0x42b4('0x10')];this['countdropretry']=_0x454a93[_0x42b4('0xe')];this[_0x42b4('0x11')]=_0x454a93[_0x42b4('0x11')];this[_0x42b4('0x12')]=_0x454a93[_0x42b4('0x12')];this[_0x42b4('0xf')]=_0x454a93['countagentrejectretry'];this[_0x42b4('0x13')]=_0x454a93['queue'];this[_0x42b4('0x14')]=_0x454a93[_0x42b4('0x15')];this[_0x42b4('0x16')]=_0x454a93['number'];this[_0x42b4('0x17')]=_0x454a93[_0x42b4('0x17')];this[_0x42b4('0x18')]=_0x454a93['responsetime'];this[_0x42b4('0x19')]=_0x454a93[_0x42b4('0x18')];this[_0x42b4('0x1a')]=getSeconds(_0x454a93[_0x42b4('0x18')],_0x454a93['starttime']);this[_0x42b4('0x1b')]=0x0;this[_0x42b4('0x1c')]=0x0;this['callback']=_0x454a93[_0x42b4('0x1d')];this[_0x42b4('0x1e')]=_0x454a93[_0x42b4('0x1e')];this['callbackat']=_0x454a93[_0x42b4('0x1f')];this[_0x42b4('0x20')]=_0x454a93[_0x42b4('0x20')];this['ContactId']=_0x454a93['ContactId'];this['ListId']=_0x454a93[_0x42b4('0x21')];this['UserId']=_0x454a93['UserId'];this[_0x42b4('0x22')]=_0x454a93[_0x42b4('0x22')];this[_0x42b4('0x23')]=_0x454a93[_0x42b4('0x23')];this[_0x42b4('0x24')]=_0x454a93[_0x42b4('0x24')]||'';this[_0x42b4('0x25')]=_0x454a93[_0x42b4('0x25')]||'';}module['exports']=History; \ No newline at end of file +var _0xd1d4=['outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','queue','number','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type'];(function(_0x1bfd95,_0x325fdd){var _0x3878e6=function(_0x1326cf){while(--_0x1326cf){_0x1bfd95['push'](_0x1bfd95['shift']());}};_0x3878e6(++_0x325fdd);}(_0xd1d4,0xfb));var _0x4d1d=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xd1d4[_0x1b828b];return _0x98da1a;};'use strict';var util=require(_0x4d1d('0x0'));var _=require(_0x4d1d('0x1'));var moment=require('moment');function getSeconds(_0x33a9f8,_0x54f44c){var _0x5ed209=moment(_0x33a9f8)[_0x4d1d('0x2')](0x0);var _0xb64ee=moment(_0x54f44c)[_0x4d1d('0x2')](0x0);return _0x5ed209[_0x4d1d('0x3')](_0xb64ee,_0x4d1d('0x4'));}function History(_0x288739){this[_0x4d1d('0x5')]=_0x288739[_0x4d1d('0x5')];this[_0x4d1d('0x6')]=_0x288739[_0x4d1d('0x6')]||undefined;this[_0x4d1d('0x7')]=_0x288739['type'];this['campaigntype']=_0x288739[_0x4d1d('0x7')]===_0x4d1d('0x8')?'queue':_0x288739[_0x4d1d('0x7')];this[_0x4d1d('0x9')]=_0x288739[_0x4d1d('0x9')];this[_0x4d1d('0xa')]=_0x288739[_0x4d1d('0xa')];this[_0x4d1d('0xb')]=_0x288739[_0x4d1d('0xb')];this[_0x4d1d('0xc')]=_0x288739[_0x4d1d('0x9')]+_0x288739[_0x4d1d('0xa')]+_0x288739[_0x4d1d('0xb')]+_0x288739[_0x4d1d('0xd')]+_0x288739[_0x4d1d('0xe')]+_0x288739['countabandonedretry']+_0x288739[_0x4d1d('0xf')]+_0x288739[_0x4d1d('0x10')];this[_0x4d1d('0xd')]=_0x288739[_0x4d1d('0xd')];this['countdropretry']=_0x288739['countdropretry'];this[_0x4d1d('0x11')]=_0x288739[_0x4d1d('0x11')];this[_0x4d1d('0xf')]=_0x288739['countmachineretry'];this[_0x4d1d('0x10')]=_0x288739[_0x4d1d('0x10')];this[_0x4d1d('0x12')]=_0x288739[_0x4d1d('0x12')];this['calleridname']=_0x288739['name'];this['calleridnum']=_0x288739[_0x4d1d('0x13')];this[_0x4d1d('0x14')]=_0x288739[_0x4d1d('0x14')];this[_0x4d1d('0x15')]=_0x288739[_0x4d1d('0x15')];this['endtime']=_0x288739[_0x4d1d('0x15')];this[_0x4d1d('0x16')]=getSeconds(_0x288739[_0x4d1d('0x15')],_0x288739[_0x4d1d('0x14')]);this[_0x4d1d('0x17')]=0x0;this[_0x4d1d('0x18')]=0x0;this[_0x4d1d('0x19')]=_0x288739['callback'];this[_0x4d1d('0x1a')]=_0x288739['callbackuniqueid'];this[_0x4d1d('0x1b')]=_0x288739[_0x4d1d('0x1b')];this[_0x4d1d('0x1c')]=_0x288739[_0x4d1d('0x1c')];this[_0x4d1d('0x1d')]=_0x288739[_0x4d1d('0x1d')];this[_0x4d1d('0x1e')]=_0x288739['ListId'];this[_0x4d1d('0x1f')]=_0x288739[_0x4d1d('0x1f')];this[_0x4d1d('0x20')]=_0x288739[_0x4d1d('0x20')];this[_0x4d1d('0x21')]=_0x288739['CampaignId'];this[_0x4d1d('0x22')]=_0x288739[_0x4d1d('0x22')]||'';this[_0x4d1d('0x23')]=_0x288739[_0x4d1d('0x23')]||'';}module[_0x4d1d('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index be37704..3c42571 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 _0x3d50=['paused','stateinterface','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','syncQueueStatusComplete','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','run','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','push','command','iftime\x20%s,%s','interval','content','indexOf','true','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Timezone:\x20','progressive','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','checkDialMethod','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','getQueue','isSuccess','callProgressDetecting','[callProgressDetecting]\x20','countbusyretry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','buildObj','nosuchnumber','checkRetriveMax','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','getDataPredictive','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','floor','[handlePredictive]','fail\x20to\x20scheduled\x20calls','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','Queue:\x20','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','RUNNING','[actionOriginate]\x20','checkIsBlackListIvr','Contact.phone','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','not_inuse','[countReScheduled]\x20','dialLimitQueue','tryOriginatePredictive','[handlePredictive][limitChannel]','[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','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Error','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','exports','util','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','isUndefined','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','\x20NOT\x20Active','name','\x20INTERVAL_IS_NULL','Interval','Intervals','INTERVAL_IS_NULL','[ifTime][Action]','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumHoldTime','talking','total','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','voice:queue:%s','voice_queue:save','campaign:ivr:%s','campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','waiting','sendMessageOneNotActive','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','state','endtime','starttime','clearZombieChannels','[uniqueid]','actions','[actions]','sequence','enqueue','isNil','Action','status','channel','No\x20such\x20channel','ivr','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','catch','checkIsBlackList','resolve','then','[checkIsBlackList]\x20','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','saveInDb','merge','pick','ContactId','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','Success','isTrunkReachable','reachable','SIP/%s','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','HangupInAMD','membername','[syncHangupInAMD][createHistory]','value','MACHINE','statedesc','Machine','AMD','countglobal','amd','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','countmachineretry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','CampaignId','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countcongestionretry','add','[syncHangupIvr]','AnswerAGI','AGI','[syncHangupIvr][createHistory]','dialQueueProject','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dropreason','TIMEOUT','dialDropRetryFrequency','[rescheduleContact][Drop]','Drop','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','CALLEREXIT','dialAbandonedMaxRetry','Abandoned','calleridname','syncNewExten','syncQueueMember','actionid','locked'];(function(_0x4104bb,_0xed252){var _0x206c58=function(_0x302528){while(--_0x302528){_0x4104bb['push'](_0x4104bb['shift']());}};_0x206c58(++_0xed252);}(_0x3d50,0xf1));var _0x03d5=function(_0x2828e7,_0x1809c2){_0x2828e7=_0x2828e7-0x0;var _0x5a3076=_0x3d50[_0x2828e7];return _0x5a3076;};'use strict';var util=require(_0x03d5('0x0'));var _=require('lodash');var BPromise=require(_0x03d5('0x1'));var uuid=require(_0x03d5('0x2'));var moment=require(_0x03d5('0x3'));var rr=require('rr');var md5=require(_0x03d5('0x4'));var Redis=require(_0x03d5('0x5'));var ut=require(_0x03d5('0x6'));var config=require('../../../config/environment/');var logger=require(_0x03d5('0x7'))(_0x03d5('0x8'));var loggerBooked=require(_0x03d5('0x7'))(_0x03d5('0x9'));var loggerPredictive=require(_0x03d5('0x7'))(_0x03d5('0xa'));var loggerPredictiveCalls=require(_0x03d5('0x7'))('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')(_0x03d5('0xb'));var ami=require(_0x03d5('0xc'));config['redis']=_['defaults'](config[_0x03d5('0xd')],{'host':_0x03d5('0xe'),'port':0x18eb});var io=require(_0x03d5('0xf'))(new Redis(config['redis']));var cmHopper=require(_0x03d5('0x10'));var cmHopperHistory=require(_0x03d5('0x11'));var cmHopperBlack=require(_0x03d5('0x12'));var voiceQueueRt=require(_0x03d5('0x13'));var Action=require(_0x03d5('0x14'));var History=require(_0x03d5('0x15'));var Final=require(_0x03d5('0x16'));var AgentComplete=require(_0x03d5('0x17'));var QueueCallerAbandon=require(_0x03d5('0x18'));var Hangup=require(_0x03d5('0x19'));var ipAgi=process[_0x03d5('0x1a')][_0x03d5('0x1b')]||_0x03d5('0x1c');var strategy={'rrmemory':_0x03d5('0x1d'),'roundrobin':_0x03d5('0x1e')};var Sequence=function(){};Sequence[_0x03d5('0x1f')]['enqueue']=function(_0x159130){this[_0x03d5('0x20')]=this[_0x03d5('0x20')]?this['tail'][_0x03d5('0x21')](_0x159130):_0x159130();};function Dialer(_0x44e25d,_0x169060){this['sequence']=new Sequence();this[_0x03d5('0x22')]=_0x169060;this[_0x03d5('0x23')]=_0x44e25d[_0x03d5('0x23')];this[_0x03d5('0x24')]=_0x44e25d[_0x03d5('0x24')];this[_0x03d5('0x25')]=_0x44e25d[_0x03d5('0x25')];this[_0x03d5('0x26')]=_0x44e25d['trunks'];this[_0x03d5('0x27')]=config[_0x03d5('0x27')]||0x2;this[_0x03d5('0x28')]={};this['actions']={};this[_0x03d5('0x29')]={};this[_0x03d5('0x2a')]={};this[_0x03d5('0x2b')]={};this[_0x03d5('0x2c')]={};this['startProgressive']={};this[_0x03d5('0x2d')]={};this[_0x03d5('0x2e')]={};this['queueBookedRR']={};ami['on'](_0x03d5('0x2f'),this[_0x03d5('0x30')][_0x03d5('0x31')](this));ami['on'](_0x03d5('0x32'),this[_0x03d5('0x33')][_0x03d5('0x31')](this));ami['on']('originateresponse',this[_0x03d5('0x34')][_0x03d5('0x31')](this));ami['on'](_0x03d5('0x35'),this[_0x03d5('0x36')][_0x03d5('0x31')](this));ami['on'](_0x03d5('0x37'),this['syncQueueSummary'][_0x03d5('0x31')](this));ami['on'](_0x03d5('0x38'),this[_0x03d5('0x39')][_0x03d5('0x31')](this));ami['on'](_0x03d5('0x3a'),this['syncNewExten'][_0x03d5('0x31')](this));ami['on']('varset',this['syncVarSet'][_0x03d5('0x31')](this));ami['on']('queuemember',this['syncQueueMember']['bind'](this));ami['on'](_0x03d5('0x3b'),this['syncQueueStatusComplete']['bind'](this));this[_0x03d5('0x3c')]();this[_0x03d5('0x3d')]();}function isNotNull(_0x15f22e){return _0x15f22e!==null&&!_[_0x03d5('0x3e')](_0x15f22e);}function checkIsLoggedIn(_0x3ee25d,_0x5a0a2c){return function(){if(_0x5a0a2c<=0x0){_0x3ee25d['message']='AGENTS_NOT_LOGGED';throw _0x3ee25d['name']+_0x03d5('0x3f');}};}function isActive(_0x138eaa){return _0x138eaa;}function checkIsActive(_0x48d49a,_0x20aec7){return function(){if(!isActive(_0x20aec7)){_0x48d49a[_0x03d5('0x40')]=_0x03d5('0x41');throw _0x48d49a['name']+_0x03d5('0x42');}};}function checkInterval(_0x29829a){return function(){if(!isNotNull(_0x29829a['Interval'])){_0x29829a[_0x03d5('0x40')]='INTERVAL_IS_NULL';throw _0x29829a[_0x03d5('0x43')]+_0x03d5('0x44');}if(!isNotNull(_0x29829a[_0x03d5('0x45')][_0x03d5('0x46')])){_0x29829a[_0x03d5('0x40')]=_0x03d5('0x47');throw _0x29829a['name']+_0x03d5('0x44');}if(!isNotNull(_['isEmpty'](_0x29829a[_0x03d5('0x45')][_0x03d5('0x46')]))){_0x29829a[_0x03d5('0x40')]=_0x03d5('0x47');throw _0x29829a['name']+_0x03d5('0x44');}};}function msgResponse(_0x5c0185,_0x28c910,_0x3b0d26){return{'action':_0x5c0185,'response':_0x28c910,'message':_0x3b0d26,'stack':_0x3b0d26};}function myreject(_0x96c488){return function(_0x5d3e3f){return _0x96c488(msgResponse(_0x03d5('0x48'),'Error',JSON[_0x03d5('0x49')](_0x5d3e3f)));};}function getSeconds(_0x3ef486,_0x57af77){var _0x112197=moment(_0x3ef486)[_0x03d5('0x4a')](0x0);var _0x449c23=moment(_0x57af77)[_0x03d5('0x4a')](0x0);return _0x112197[_0x03d5('0x4b')](_0x449c23,_0x03d5('0x4c'));}function emit(_0x2f0bb0,_0xc593bf,_0x5de666){io['to'](_0x2f0bb0)[_0x03d5('0x4d')](_0xc593bf,_0x5de666);}function emitVoiceQueueSummary(_0xfa2fe2){if(_0xfa2fe2[_0x03d5('0x4e')]===_0x03d5('0x4f')){var _0x309982={'id':_0xfa2fe2['id'],'name':_0xfa2fe2['name'],'strategy':_0xfa2fe2[_0x03d5('0x50')],'answered':_0xfa2fe2[_0x03d5('0x51')],'available':_0xfa2fe2[_0x03d5('0x52')],'loggedIn':_0xfa2fe2[_0x03d5('0x53')],'pTalking':_0xfa2fe2[_0x03d5('0x54')],'sumBillable':_0xfa2fe2['sumBillable'],'sumDuration':_0xfa2fe2['sumDuration'],'sumHoldTime':_0xfa2fe2[_0x03d5('0x55')]||0x0,'talking':_0xfa2fe2[_0x03d5('0x56')],'total':_0xfa2fe2[_0x03d5('0x57')],'type':_0xfa2fe2[_0x03d5('0x4e')],'unmanaged':_0xfa2fe2['unmanaged'],'abandoned':_0xfa2fe2[_0x03d5('0x58')],'waiting':_0xfa2fe2['waiting'],'loggedInDb':_0xfa2fe2[_0x03d5('0x59')],'dialActive':_0xfa2fe2[_0x03d5('0x5a')],'dialMethod':_0xfa2fe2[_0x03d5('0x5b')],'dialOriginateCallerIdName':_0xfa2fe2[_0x03d5('0x5c')],'dialOriginateCallerIdNumber':_0xfa2fe2[_0x03d5('0x5d')],'dialOriginateTimeout':_0xfa2fe2[_0x03d5('0x5e')],'dialPrefix':_0xfa2fe2[_0x03d5('0x5f')],'outboundAnswerAgiCallsDay':_0xfa2fe2[_0x03d5('0x60')],'outboundAnswerCallsDay':_0xfa2fe2[_0x03d5('0x61')],'outboundBlacklistCallsDay':_0xfa2fe2[_0x03d5('0x62')],'outboundBusyCallsDay':_0xfa2fe2['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0xfa2fe2[_0x03d5('0x63')],'outboundDropCallsDayACS':_0xfa2fe2[_0x03d5('0x64')],'outboundDropCallsDayCallersExit':_0xfa2fe2['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0xfa2fe2[_0x03d5('0x65')],'outboundNoAnswerCallsDay':_0xfa2fe2['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0xfa2fe2[_0x03d5('0x66')],'outboundOriginateFailureCallsDay':_0xfa2fe2['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0xfa2fe2[_0x03d5('0x67')],'outboundRejectCallsDay':_0xfa2fe2[_0x03d5('0x68')],'outboundUnknownCallsDay':_0xfa2fe2[_0x03d5('0x69')],'predictiveIntervalAnsweredCalls':_0xfa2fe2[_0x03d5('0x6a')],'predictiveIntervalAvgHoldtime':_0xfa2fe2[_0x03d5('0x6b')],'predictiveIntervalAvgTalktime':_0xfa2fe2[_0x03d5('0x6c')],'predictiveIntervalDroppedCallsCallersExit':_0xfa2fe2['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0xfa2fe2[_0x03d5('0x6d')],'predictiveIntervalErlangCalls':_0xfa2fe2[_0x03d5('0x6e')],'predictiveIntervalErlangCallsDroppedCalls':_0xfa2fe2[_0x03d5('0x6f')],'predictiveIntervalHitRate':_0xfa2fe2['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0xfa2fe2['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0xfa2fe2[_0x03d5('0x70')],'predictiveIntervalAvailable':_0xfa2fe2[_0x03d5('0x71')],'predictiveIntervalTotalCalls':_0xfa2fe2['predictiveIntervalTotalCalls'],'message':_0xfa2fe2['message'],'originated':_0xfa2fe2[_0x03d5('0x72')],'erlangCalls':_0xfa2fe2[_0x03d5('0x73')],'erlangCallToSecond':_0xfa2fe2[_0x03d5('0x74')],'erlangAbandonmentRate':_0xfa2fe2[_0x03d5('0x75')],'erlangBusyFactor':_0xfa2fe2[_0x03d5('0x76')],'startPredictive':_0xfa2fe2[_0x03d5('0x2c')],'startProgressive':_0xfa2fe2[_0x03d5('0x77')]};if(_0xfa2fe2[_0x03d5('0x78')]){_0x309982['Trunk']={'id':_0xfa2fe2['Trunk']['id'],'name':_0xfa2fe2[_0x03d5('0x78')][_0x03d5('0x43')],'active':_0xfa2fe2[_0x03d5('0x78')][_0x03d5('0x79')],'callerid':_0xfa2fe2[_0x03d5('0x78')]['callerid']};}if(_0xfa2fe2[_0x03d5('0x45')]){_0x309982[_0x03d5('0x45')]={'id':_0xfa2fe2['Interval']['id'],'name':_0xfa2fe2[_0x03d5('0x45')][_0x03d5('0x43')]};}var _0x41f4b5=md5(JSON[_0x03d5('0x49')](_0x309982));if(_0xfa2fe2[_0x03d5('0x4')]!==_0x41f4b5){_0xfa2fe2[_0x03d5('0x4')]=_0x41f4b5;emit(util['format'](_0x03d5('0x7a'),_0x309982[_0x03d5('0x43')]),_0x03d5('0x7b'),_0x309982);}}}function emitCampaignSummary(_0x317878){if(_0x317878['type']==='ivr'){emit(util['format'](_0x03d5('0x7c'),_0x317878[_0x03d5('0x43')]),_0x03d5('0x7d'),_0x317878);}}function checkGetDataPredictive(_0x5064df){if(isNotNull(_0x5064df)&&!_['isEmpty'](_0x5064df)){loggerPredictive[_0x03d5('0x7e')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x7f'),_0x5064df[_0x03d5('0x80')]);loggerPredictive['info'](_0x03d5('0x81'),_0x5064df[_0x03d5('0x6a')]);loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x82'),_0x5064df['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x83'),_0x5064df[_0x03d5('0x84')]);loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x85'),_0x5064df[_0x03d5('0x6b')]);loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x86'),_0x5064df['predictiveIntervalAvgTalktime']);loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x87'));if(_0x5064df[_0x03d5('0x80')]>0x0){if(!_[_0x03d5('0x3e')](_0x5064df[_0x03d5('0x6c')])&&_0x5064df[_0x03d5('0x6c')]>0x0){return!![];}loggerPredictive['info'](_0x03d5('0x88'));if(!_[_0x03d5('0x3e')](_0x5064df[_0x03d5('0x6b')])&&_0x5064df[_0x03d5('0x6b')]>0x0){return!![];}loggerPredictive[_0x03d5('0x7e')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info'](_0x03d5('0x89'));}}else{loggerPredictive[_0x03d5('0x7e')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0xed30f){return function(_0x185a42){loggerPredictive[_0x03d5('0x7e')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x8a'),_0x185a42[_0x03d5('0x73')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x185a42[_0x03d5('0x74')]);loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x8b'),_0x185a42[_0x03d5('0x75')]);loggerPredictive[_0x03d5('0x7e')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x185a42[_0x03d5('0x76')]);loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x8b'),_0x185a42[_0x03d5('0x75')]);loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x87'));_['merge'](_0xed30f,_0x185a42);};}function getDiff(_0xd6b899){var _0x3eb225=moment()[_0x03d5('0x4a')](0x0);var _0x2c0a1d=moment(_0xd6b899)['milliseconds'](0x0);return _0x3eb225[_0x03d5('0x4b')](_0x2c0a1d,'seconds');}function ifInterval(_0x4ca518,_0x438417){if(_['isUndefined'](_0x438417)){return![];}return getDiff(_0x438417)<_0x4ca518*0x3c;}function freeVariablesPredictive(_0xa6a317){if(isNotNull(_0xa6a317)){if(!_[_0x03d5('0x3e')](_0xa6a317[_0x03d5('0x77')])){_0xa6a317[_0x03d5('0x77')]=undefined;loggerPredictive[_0x03d5('0x7e')](_0xa6a317['name'],_0x03d5('0x8c'));}if(!_['isUndefined'](_0xa6a317[_0x03d5('0x2c')])){_0xa6a317[_0x03d5('0x2c')]=undefined;loggerPredictive[_0x03d5('0x7e')](_0xa6a317[_0x03d5('0x43')],_0x03d5('0x8d'));}if(!_[_0x03d5('0x3e')](_0xa6a317[_0x03d5('0x8e')])){clearInterval(_0xa6a317[_0x03d5('0x8e')]);_0xa6a317[_0x03d5('0x8e')]=undefined;loggerPredictive['info'](_0xa6a317[_0x03d5('0x43')],_0x03d5('0x8f'));}}}function erlangb(_0xbc8cbb,_0x3ca70b){if(_0x3ca70b===0x0){return 0x0;}var _0x5139e0=0x1;for(var _0x453d81=0x1;_0x453d81<=_0x3ca70b;_0x453d81+=0x1){_0x5139e0=0x1+_0x5139e0*_0x453d81/_0xbc8cbb;}return 0x1/_0x5139e0;}function isVoiceQueueOutbound(_0x4a9086){return _0x4a9086===_0x03d5('0x4f');}function isNotPreview(_0xbb3479){return _0xbb3479!==_0x03d5('0x22');}function isCampaignIvr(_0x3294ac){return _0x3294ac==='ivr';}function getCallerId(_0x2c4ad9,_0x141659,_0x9bafa2){if(!_[_0x03d5('0x3e')](_0x9bafa2)&&typeof _0x9bafa2===_0x03d5('0x90')&&!_[_0x03d5('0x91')](_0x9bafa2)){if(!_[_0x03d5('0x3e')](_0x141659)&&typeof _0x141659===_0x03d5('0x90')&&!_[_0x03d5('0x91')](_0x141659)){return util[_0x03d5('0x92')](_0x03d5('0x93'),_0x141659,_0x9bafa2);}return util[_0x03d5('0x92')](_0x03d5('0x93'),_0x9bafa2,_0x9bafa2);}if(!_[_0x03d5('0x3e')](_0x2c4ad9)&&typeof _0x2c4ad9===_0x03d5('0x90')&&!_[_0x03d5('0x91')](_0x2c4ad9)){return _0x2c4ad9;}return _0x03d5('0x94');}function loggerCatchQueueSummary(_0x45f02f,_0x377489){return function(_0x49f671){freeVariablesPredictive(_0x377489);emitVoiceQueueSummary(_0x377489);emitCampaignSummary(_0x377489);loggerSyncQueueSummary[_0x03d5('0x95')](_0x45f02f,util[_0x03d5('0x96')](_0x49f671,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x11bea5,_0xa6a04d){return function(_0x2a34df){loggerPredictive[_0x03d5('0x95')](_0xa6a04d[_0x03d5('0x43')],_0x11bea5);loggerPredictive['error'](_0x2a34df['stack']);freeVariablesPredictive(_0xa6a04d);};}function loggerCatch(_0x447fd7){return function(_0x28d612){logger[_0x03d5('0x95')](_0x447fd7,util[_0x03d5('0x96')](_0x28d612,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0xca95a7){return _0xca95a7&&!_['isUndefined'](_0xca95a7)&&_0xca95a7[_0x03d5('0x97')]>0x0;}function decremetOriginate(_0x5680e5){if(!_['isUndefined'](_0x5680e5)&&_0x5680e5!==null){if(typeof _0x5680e5[_0x03d5('0x72')]!==_0x03d5('0x98')){if(_0x5680e5[_0x03d5('0x72')]>0x0){_0x5680e5[_0x03d5('0x72')]-=0x1;}else{logger['error'](_0x03d5('0x99'));}}}else{logger[_0x03d5('0x95')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x2344a2,_0x5015c8,_0xdcd4c2){if(_0x5015c8>_0xdcd4c2){for(var _0x285a48=0x0;_0x285a48<_0x5015c8-_0xdcd4c2;_0x285a48+=0x1){decremetOriginate(_0x2344a2);}}}function loggerGetContactDialer(_0x2fec75,_0x561b39,_0x2e221b){return function(_0xdd7578){checkContactLowerLimitOriginate(_0x561b39,_0x2e221b,0x0);logger['error'](_0x2fec75,util['inspect'](_0xdd7578,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x525762){return function(_0x4c09ae){if(isNotNull(_0x4c09ae)&&isNotNull(_0x4c09ae[0x0])){if(_0x4c09ae[0x0]['contactsRescheduled']>0x0){_0x525762[_0x03d5('0x40')]=_0x03d5('0x9a');logger[_0x03d5('0x7e')](_0x03d5('0x9b')+_0x525762[_0x03d5('0x43')],_0x4c09ae[0x0][_0x03d5('0x9c')],_0x03d5('0x9d'));}else{_0x525762[_0x03d5('0x40')]=_0x03d5('0x9e');logger[_0x03d5('0x7e')]('[getContactDialer2][Empty]'+_0x525762[_0x03d5('0x43')]);}}};}function notSendMessagesQueue(_0x10be75){if(_0x10be75['sendMessageOneNotActive']){freeVariablesPredictive(_0x10be75);if(_0x10be75['originated']===0x0&&_0x10be75[_0x03d5('0x56')]===0x0&&_0x10be75[_0x03d5('0x9f')]===0x0&&(_0x10be75['pTalking']||0x0)===0x0){_0x10be75[_0x03d5('0xa0')]=![];_0x10be75['available']=0x0;_0x10be75[_0x03d5('0x40')]=_0x03d5('0x41');loggerSyncQueueSummary[_0x03d5('0x95')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x10be75[_0x03d5('0x43')],'is\x20not\x20active');}else{_0x10be75[_0x03d5('0x40')]=_0x03d5('0xa1');loggerSyncQueueSummary['error'](_0x03d5('0xa2'),_0x10be75[_0x03d5('0x43')],_0x03d5('0xa3'));}emitVoiceQueueSummary(_0x10be75);}}function notSendMessagesCampaign(_0x2a9a20){if(_0x2a9a20['sendMessageOneNotActive']){if(_0x2a9a20[_0x03d5('0x72')]===0x0){_0x2a9a20[_0x03d5('0xa0')]=![];_0x2a9a20[_0x03d5('0x40')]=_0x03d5('0x41');loggerSyncQueueSummary['error'](_0x03d5('0xa4'),_0x2a9a20['name'],_0x03d5('0xa5'));}else{_0x2a9a20[_0x03d5('0x40')]=_0x03d5('0xa1');loggerSyncQueueSummary[_0x03d5('0x95')](_0x03d5('0xa4'),_0x2a9a20['name'],_0x03d5('0xa3'));}emitCampaignSummary(_0x2a9a20);}}function createObjHistory(_0x3e92d6,_0x86f5d3,_0x2ddc1a,_0x546c3a,_0x11f8ff){_0x3e92d6[_0x03d5('0x40')]=_0x2ddc1a;var _0x442004=new Action(_0x3e92d6,_0x86f5d3);var _0x462821=new History(_0x442004);_0x462821[_0x03d5('0xa6')]=_0x546c3a;_0x462821['statedesc']=_0x11f8ff;_0x462821[_0x03d5('0xa7')]=_0x442004[_0x03d5('0xa8')];return _0x462821;}Dialer['prototype'][_0x03d5('0x3d')]=function(){var _0x142bd9=this;setInterval(function(){_0x142bd9[_0x03d5('0xa9')](_0x142bd9[_0x03d5('0x2a')],_0x03d5('0xaa'));_0x142bd9['clearZombieChannels'](_0x142bd9[_0x03d5('0xab')],_0x03d5('0xac'));},0x32c8);};Dialer[_0x03d5('0x1f')][_0x03d5('0xa9')]=function(_0x5bc7ca,_0x54b5be){var _0x1b6041=this;for(var _0x3d877c in _0x5bc7ca){if(typeof _0x5bc7ca[_0x3d877c]!==_0x03d5('0x98')){this[_0x03d5('0xad')][_0x03d5('0xae')](function(){if(!_[_0x03d5('0xaf')](_0x5bc7ca[_0x3d877c])){return ami[_0x03d5('0xb0')]({'action':_0x03d5('0xb1'),'channel':_0x5bc7ca[_0x3d877c][_0x03d5('0xb2')]})['catch'](function(_0x2fa42c){if(_0x2fa42c[_0x03d5('0x40')]===_0x03d5('0xb3')){setTimeout(function(){if(_0x5bc7ca[_0x3d877c]&&_0x5bc7ca[_0x3d877c]['type']!==_0x03d5('0xb4')){_0x1b6041['updateOriginated'](_0x1b6041['voiceQueues'][_0x5bc7ca[_0x3d877c][_0x03d5('0xb5')]]);logger[_0x03d5('0x95')](_0x03d5('0xb6'),_0x54b5be,_0x3d877c,_0x5bc7ca[_0x3d877c][_0x03d5('0xb5')]);delete _0x5bc7ca[_0x3d877c];}if(_0x5bc7ca[_0x3d877c]&&_0x5bc7ca[_0x3d877c][_0x03d5('0x4e')]===_0x03d5('0xb4')){_0x1b6041[_0x03d5('0xb7')](_0x1b6041[_0x03d5('0x24')][_0x5bc7ca[_0x3d877c]['queue']]);logger[_0x03d5('0x95')](_0x03d5('0xb8'),_0x54b5be,_0x3d877c,_0x5bc7ca[_0x3d877c][_0x03d5('0xb5')]);delete _0x5bc7ca[_0x3d877c];}},0x2328);}});}});}}};Dialer[_0x03d5('0x1f')][_0x03d5('0xb9')]=function(_0x4040de){return BPromise['resolve']()['then'](cmHopper[_0x03d5('0xb9')](_0x4040de))[_0x03d5('0xba')](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype'][_0x03d5('0xbb')]=function(_0x1922b2){return BPromise[_0x03d5('0xbc')]()[_0x03d5('0xbd')](cmHopperBlack[_0x03d5('0xbb')](_0x1922b2))[_0x03d5('0xba')](loggerCatch(_0x03d5('0xbe')));};Dialer[_0x03d5('0x1f')]['checkIsBlackListIvr']=function(_0x26a69c){return BPromise[_0x03d5('0xbc')]()[_0x03d5('0xbd')](cmHopperBlack['checkIsBlackListIvr'](_0x26a69c))[_0x03d5('0xba')](loggerCatch(_0x03d5('0xbf')));};Dialer[_0x03d5('0x1f')][_0x03d5('0xc0')]=function(_0x979d49){return BPromise[_0x03d5('0xbc')]()[_0x03d5('0xbd')](cmHopperHistory[_0x03d5('0xc1')](_0x979d49))['catch'](loggerCatch(_0x03d5('0xc2')));};Dialer['prototype'][_0x03d5('0xc3')]=function(_0x18a6b5){return BPromise[_0x03d5('0xbc')]()[_0x03d5('0xbd')](cmHopper[_0x03d5('0xc3')](_0x18a6b5))[_0x03d5('0xba')](loggerCatch(_0x03d5('0xc4')));};Dialer[_0x03d5('0x1f')]['unlockContact']=function(_0x4d4e91,_0xaea31f,_0x153bdc){return BPromise[_0x03d5('0xbc')]()[_0x03d5('0xbd')](cmHopper[_0x03d5('0xc5')](_0x4d4e91,_0xaea31f,_0x153bdc))[_0x03d5('0xba')](loggerCatch(_0x03d5('0xc6')));};Dialer[_0x03d5('0x1f')][_0x03d5('0xc7')]=function(_0x3722ba,_0x4e209a,_0x69012a,_0x2e225e){return BPromise[_0x03d5('0xbc')]()[_0x03d5('0xbd')](cmHopper[_0x03d5('0xc7')](_0x3722ba,_0x4e209a,_0x69012a,_0x2e225e))[_0x03d5('0xba')](loggerCatch(_0x03d5('0xc8')));};Dialer['prototype'][_0x03d5('0xc9')]=function(_0x43e0a3,_0x54b6ab,_0x422ac4){return BPromise[_0x03d5('0xbc')]()['then'](cmHopper['getContactDialerIvr'](_0x43e0a3,_0x54b6ab,_0x422ac4))[_0x03d5('0xba')](loggerCatch(_0x03d5('0xc8')));};Dialer[_0x03d5('0x1f')][_0x03d5('0xca')]=function(_0x3f76fd){return BPromise[_0x03d5('0xbc')]()[_0x03d5('0xbd')](voiceQueueRt[_0x03d5('0xca')](_0x3f76fd))[_0x03d5('0xba')](loggerCatch(_0x03d5('0xcb')));};Dialer[_0x03d5('0x1f')]['moveContactManagedDialer']=function(_0x506936){return BPromise[_0x03d5('0xbc')]()[_0x03d5('0xbd')](cmHopper[_0x03d5('0xcc')](_0x506936))[_0x03d5('0xba')](loggerCatch(_0x03d5('0xcd')));};Dialer['prototype'][_0x03d5('0xce')]=function(_0x1bf225){return BPromise[_0x03d5('0xbc')]()[_0x03d5('0xbd')](cmHopperHistory[_0x03d5('0xce')](_0x1bf225))[_0x03d5('0xba')](loggerCatch(_0x03d5('0xcf')));};Dialer['prototype'][_0x03d5('0xb7')]=function(_0x297ee2){if(!_[_0x03d5('0x3e')](_0x297ee2)&&_0x297ee2!==null){if(typeof _0x297ee2[_0x03d5('0x72')]!==_0x03d5('0x98')){if(_0x297ee2[_0x03d5('0x72')]>0x0){_0x297ee2[_0x03d5('0x72')]-=0x1;}else{logger[_0x03d5('0x95')](_0x03d5('0xd0'));}}}else{logger[_0x03d5('0x95')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x03d5('0x1f')][_0x03d5('0xd1')]=function(_0x15bede,_0x1661f0){var _0x462ee6=this;return function(_0x220693){_0x462ee6['updateOriginated'](_0x1661f0);logger['error'](_0x15bede,util[_0x03d5('0x96')](_0x220693,{'showHidden':![],'depth':null}));};};Dialer[_0x03d5('0x1f')][_0x03d5('0xd2')]=function(_0x53771f,_0x436e4b,_0x2e838f){var _0x4a1e30={'state':0x19,'statedesc':_0x03d5('0xd3')};this['updateOriginated'](_0x436e4b);this[_0x03d5('0xd4')](_[_0x03d5('0xd5')](_0x4a1e30,_[_0x03d5('0xd6')](_0x2e838f,[_0x03d5('0xd7'),_0x03d5('0xd8'),_0x03d5('0xd9'),_0x03d5('0xda'),'CampaignId'])),_0x03d5('0xdb'),_0x03d5('0xdc'));logger[_0x03d5('0x95')](_0x53771f);};Dialer[_0x03d5('0x1f')]['isSuccess']=function(_0x1a0a49){return _0x1a0a49===_0x03d5('0xdd');};Dialer[_0x03d5('0x1f')][_0x03d5('0xde')]=function(_0x572a15){return!_[_0x03d5('0x3e')](_0x572a15)&&_0x572a15&&!_['isUndefined'](_0x572a15['name'])&&!_[_0x03d5('0x3e')](_0x572a15[_0x03d5('0x79')])&&_0x572a15[_0x03d5('0x79')]&&(this[_0x03d5('0x26')][util['format']('SIP/%s',_0x572a15[_0x03d5('0x43')])][_0x03d5('0xb1')]===_0x03d5('0xdf')||this[_0x03d5('0x26')][util['format'](_0x03d5('0xe0'),_0x572a15[_0x03d5('0x43')])][_0x03d5('0xb1')]==='unmonitored');};Dialer[_0x03d5('0x1f')][_0x03d5('0xd4')]=function(_0x25511e,_0xe409bc,_0x5200eb){this['createHistory'](_0x25511e)[_0x03d5('0xba')](loggerCatch(_0xe409bc));this[_0x03d5('0xcc')](_0x25511e)['catch'](loggerCatch(_0x5200eb));};Dialer[_0x03d5('0x1f')]['syncVarSet']=function(_0x1f9b9c){var _0x5aea9a=this[_0x03d5('0x2a')][_0x1f9b9c[_0x03d5('0xe1')]];var _0x2392ef;if(!_['isNil'](_0x1f9b9c)&&!_[_0x03d5('0xaf')](_0x1f9b9c[_0x03d5('0xe2')])&&!_[_0x03d5('0xaf')](_0x1f9b9c['variable'][_0x03d5('0xe3')])&&_0x1f9b9c[_0x03d5('0xe4')]===_0x03d5('0xe5')&&_0x5aea9a){if(_0x5aea9a['type']!==_0x03d5('0xb4')&&this[_0x03d5('0x23')][_0x5aea9a[_0x03d5('0xb5')]][_0x03d5('0xe6')]&&_0x1f9b9c['value']===_0x03d5('0xe7')){delete this[_0x03d5('0x2a')][_0x1f9b9c['uniqueid']];this[_0x03d5('0xb7')](this['voiceQueues'][_0x5aea9a[_0x03d5('0xb5')]]);this['voiceQueues'][_0x5aea9a[_0x03d5('0xb5')]][_0x03d5('0x61')]+=0x1;this[_0x03d5('0x23')][_0x5aea9a[_0x03d5('0xb5')]][_0x03d5('0x60')]+=0x1;_0x2392ef=new Hangup(_0x5aea9a,_0x1f9b9c);_0x2392ef['state']=0x12;_0x2392ef['statedesc']=_0x03d5('0xe8');_0x2392ef[_0x03d5('0xe9')]='AMD';this[_0x03d5('0xd4')](_0x2392ef,_0x03d5('0xea'),'[syncHangupInAMD]');}if(_0x5aea9a[_0x03d5('0x4e')]!==_0x03d5('0xb4')&&this[_0x03d5('0x23')][_0x5aea9a['queue']][_0x03d5('0xe6')]&&_0x1f9b9c[_0x03d5('0xeb')]===_0x03d5('0xec')){var _0x172062=this;return new BPromise(function(_0x3ac200,_0x38ae25){delete _0x172062['uniqueId'][_0x1f9b9c['uniqueid']];_0x172062['updateOriginated'](_0x172062[_0x03d5('0x23')][_0x5aea9a[_0x03d5('0xb5')]]);_0x172062[_0x03d5('0x23')][_0x5aea9a[_0x03d5('0xb5')]][_0x03d5('0x61')]+=0x1;_0x172062[_0x03d5('0x23')][_0x5aea9a[_0x03d5('0xb5')]][_0x03d5('0x60')]+=0x1;var _0x49f3ae=_0x172062[_0x03d5('0x23')][_0x5aea9a['queue']];var _0x4136b7=new Hangup(_0x5aea9a,_0x1f9b9c);_0x4136b7[_0x03d5('0xa6')]=0x13;_0x4136b7[_0x03d5('0xed')]=_0x03d5('0xee');_0x4136b7['membername']=_0x03d5('0xef');_0x4136b7['countmachineretry']+=0x1;_0x4136b7[_0x03d5('0xf0')]+=0x1;_0x4136b7[_0x03d5('0xf1')]=!![];_0x172062['createHistory'](_0x4136b7)[_0x03d5('0xba')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x4136b7['countbusyretry']+_0x4136b7['countcongestionretry']+_0x4136b7[_0x03d5('0xf2')]+_0x4136b7[_0x03d5('0xf3')]+_0x4136b7[_0x03d5('0xf4')]+_0x4136b7[_0x03d5('0xf5')]+_0x4136b7['countmachineretry']+_0x4136b7[_0x03d5('0xf6')]>=_0x49f3ae[_0x03d5('0xf7')]){_0x172062[_0x03d5('0xf8')](_0x4136b7,_0x3ac200,_0x38ae25,_0x03d5('0xf9'));}else{if(_0x4136b7[_0x03d5('0xfa')]>=_0x49f3ae[_0x03d5('0xfb')]){_0x172062[_0x03d5('0xfc')](_0x4136b7,_0x3ac200,_0x38ae25,_0x03d5('0xfd'));}else{_0x172062[_0x03d5('0xc3')]({'active':![],'countmachineretry':_0x4136b7[_0x03d5('0xfa')],'scheduledat':moment()['add'](_0x49f3ae[_0x03d5('0xfe')],_0x03d5('0xff'))[_0x03d5('0x92')](_0x03d5('0x100')),'ContactId':_0x4136b7[_0x03d5('0xd7')],'ListId':_0x4136b7[_0x03d5('0xd8')],'VoiceQueueId':_0x4136b7[_0x03d5('0xda')]||undefined,'CampaignId':_0x4136b7[_0x03d5('0x101')]||undefined})['catch'](loggerCatch(_0x03d5('0x102')));_0x3ac200({'reschedule':0x1});}}});}if(_0x5aea9a['type']===_0x03d5('0xb4')&&this[_0x03d5('0x24')][_0x5aea9a['queue']][_0x03d5('0xe6')]&&_0x1f9b9c[_0x03d5('0xeb')]==='HANGUP'){delete this[_0x03d5('0x2a')][_0x1f9b9c[_0x03d5('0xe1')]];this[_0x03d5('0xb7')](this[_0x03d5('0x24')][_0x5aea9a[_0x03d5('0xb5')]]);_0x2392ef=new Hangup(_0x5aea9a,_0x1f9b9c);_0x2392ef[_0x03d5('0xa6')]=0x12;_0x2392ef[_0x03d5('0xed')]=_0x03d5('0xe8');_0x2392ef[_0x03d5('0xe9')]=_0x03d5('0xef');this[_0x03d5('0xd4')](_0x2392ef,'[syncHangupInAMDIvr][createHistory]',_0x03d5('0x103'));}if(_0x5aea9a['type']===_0x03d5('0xb4')&&this[_0x03d5('0x24')][_0x5aea9a[_0x03d5('0xb5')]]['dialAMDActive']&&_0x1f9b9c[_0x03d5('0xeb')]===_0x03d5('0xec')){var _0x172062=this;return new BPromise(function(_0x5762bb,_0x262570){delete _0x172062[_0x03d5('0x2a')][_0x1f9b9c['uniqueid']];_0x172062[_0x03d5('0xb7')](_0x172062['campaigns'][_0x5aea9a[_0x03d5('0xb5')]]);_0x172062['campaigns'][_0x5aea9a[_0x03d5('0xb5')]]['outboundAnswerCallsDay']+=0x1;_0x172062[_0x03d5('0x24')][_0x5aea9a[_0x03d5('0xb5')]][_0x03d5('0x60')]+=0x1;var _0x31766d=_0x172062['campaigns'][_0x5aea9a['queue']];var _0x150e66=new Hangup(_0x5aea9a,_0x1f9b9c);_0x150e66[_0x03d5('0xa6')]=0x13;_0x150e66[_0x03d5('0xed')]=_0x03d5('0xee');_0x150e66['membername']=_0x03d5('0xef');_0x150e66[_0x03d5('0xfa')]+=0x1;_0x150e66[_0x03d5('0xf0')]+=0x1;_0x150e66['amd']=!![];_0x172062[_0x03d5('0xce')](_0x150e66)['catch'](loggerCatch(_0x03d5('0x104')));if(_0x150e66['countbusyretry']+_0x150e66[_0x03d5('0x105')]+_0x150e66['countnoanswerretry']+_0x150e66[_0x03d5('0xf3')]+_0x150e66[_0x03d5('0xf4')]+_0x150e66[_0x03d5('0xf5')]+_0x150e66[_0x03d5('0xfa')]+_0x150e66[_0x03d5('0xf6')]>=_0x31766d[_0x03d5('0xf7')]){_0x172062['stateGlobal'](_0x150e66,_0x5762bb,_0x262570,_0x03d5('0xf9'));}else{if(_0x150e66[_0x03d5('0xfa')]>=_0x31766d['dialMachineMaxRetry']){_0x172062[_0x03d5('0xfc')](_0x150e66,_0x5762bb,_0x262570,'reason\x2019\x20machine....');}else{_0x172062[_0x03d5('0xc3')]({'active':![],'countmachineretry':_0x150e66[_0x03d5('0xfa')],'scheduledat':moment()[_0x03d5('0x106')](_0x31766d[_0x03d5('0xfe')],_0x03d5('0xff'))[_0x03d5('0x92')](_0x03d5('0x100')),'ContactId':_0x150e66[_0x03d5('0xd7')],'ListId':_0x150e66['ListId'],'VoiceQueueId':_0x150e66['VoiceQueueId']||undefined,'CampaignId':_0x150e66[_0x03d5('0x101')]||undefined})[_0x03d5('0xba')](loggerCatch(_0x03d5('0x102')));_0x5762bb({'reschedule':0x1});}}});}}};Dialer[_0x03d5('0x1f')][_0x03d5('0x39')]=function(_0x563685){var _0x21430e=this['uniqueId'][_0x563685[_0x03d5('0xe1')]];var _0x455664=this;var _0x5377c2;if(_0x21430e&&_0x21430e['type']===_0x03d5('0xb4')){delete this[_0x03d5('0x2a')][_0x563685[_0x03d5('0xe1')]];this[_0x03d5('0xb7')](this['campaigns'][_0x21430e['queue']]);this[_0x03d5('0x24')][_0x21430e[_0x03d5('0xb5')]]['ivrAnswerCallsDay']+=0x1;_0x5377c2=new Hangup(_0x21430e,_0x563685);this[_0x03d5('0xce')](_0x5377c2)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x03d5('0xcc')](_0x5377c2)['catch'](loggerCatch(_0x03d5('0x107')));}if(_0x21430e&&_0x21430e[_0x03d5('0x4e')]!=='ivr'&&isNotNull(this[_0x03d5('0x23')][_0x21430e[_0x03d5('0xb5')]]['dialQueueProject'])){delete this['uniqueId'][_0x563685[_0x03d5('0xe1')]];this['updateOriginated'](this[_0x03d5('0x23')][_0x21430e[_0x03d5('0xb5')]]);this[_0x03d5('0x23')][_0x21430e[_0x03d5('0xb5')]][_0x03d5('0x61')]+=0x1;this['voiceQueues'][_0x21430e[_0x03d5('0xb5')]][_0x03d5('0x60')]+=0x1;_0x5377c2=new Hangup(_0x21430e,_0x563685);_0x5377c2['state']=0x10;_0x5377c2[_0x03d5('0xed')]=_0x03d5('0x108');_0x5377c2[_0x03d5('0xe9')]=_0x03d5('0x109');this[_0x03d5('0xce')](_0x5377c2)['catch'](loggerCatch(_0x03d5('0x10a')));this[_0x03d5('0xcc')](_0x5377c2)[_0x03d5('0xba')](loggerCatch(_0x03d5('0x107')));}if(_0x21430e&&_0x21430e['type']!=='ivr'&&!isNotNull(this['voiceQueues'][_0x21430e[_0x03d5('0xb5')]][_0x03d5('0x10b')])){delete this[_0x03d5('0x2a')][_0x563685[_0x03d5('0xe1')]];this[_0x03d5('0xb7')](this['voiceQueues'][_0x21430e[_0x03d5('0xb5')]]);this[_0x03d5('0x23')][_0x21430e['queue']]['outboundUnknownCallsDay']+=0x1;_0x5377c2=new Hangup(_0x21430e,_0x563685);_0x5377c2[_0x03d5('0xa6')]=0xc;_0x5377c2[_0x03d5('0xed')]=_0x563685[_0x03d5('0x10c')];_0x5377c2['membername']=_0x03d5('0x10d');this[_0x03d5('0xce')](_0x5377c2)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x03d5('0xcc')](_0x5377c2)[_0x03d5('0xba')](loggerCatch(_0x03d5('0x107')));}};Dialer[_0x03d5('0x1f')]['syncAgentComplete']=function(_0x5f05dc){var _0x24c79a=this[_0x03d5('0x2a')][_0x5f05dc[_0x03d5('0xe1')]];var _0x5e88a4=this;if(this[_0x03d5('0x23')][_0x5f05dc[_0x03d5('0xb5')]]){if(_0x24c79a&&_0x24c79a[_0x03d5('0x4e')]!==_0x03d5('0xb4')){delete this[_0x03d5('0x2a')][_0x5f05dc[_0x03d5('0xe1')]];this['voiceQueues'][_0x5f05dc[_0x03d5('0xb5')]][_0x03d5('0x61')]+=0x1;var _0x4f3f6b=new AgentComplete(_0x24c79a,_0x5f05dc);if(_0x5f05dc[_0x03d5('0x10e')]===_0x03d5('0x10f')){_0x4f3f6b[_0x03d5('0x110')]=this['voiceQueues'][_0x5f05dc[_0x03d5('0xb5')]][_0x03d5('0x111')]&&this['voiceQueues'][_0x5f05dc[_0x03d5('0xb5')]][_0x03d5('0x112')]?moment()[_0x03d5('0x92')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x03d5('0xce')](_0x4f3f6b)[_0x03d5('0xba')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x03d5('0xcc')](_0x4f3f6b)['catch'](loggerCatch(_0x03d5('0x113')));}}};Dialer[_0x03d5('0x1f')][_0x03d5('0x30')]=function(_0x2cf3a2){if(this[_0x03d5('0x23')][_0x2cf3a2['queue']]){if(this['uniqueId'][_0x2cf3a2[_0x03d5('0xe1')]]&&this[_0x03d5('0x2a')][_0x2cf3a2[_0x03d5('0xe1')]][_0x03d5('0x4e')]!=='ivr'){this['updateOriginated'](this[_0x03d5('0x23')][_0x2cf3a2[_0x03d5('0xb5')]]);this['uniqueId'][_0x2cf3a2[_0x03d5('0xe1')]][_0x03d5('0x114')]=moment()[_0x03d5('0x92')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x03d5('0x1f')][_0x03d5('0x115')]=function(_0x1339c2){this['createHistory'](_0x1339c2)['catch'](loggerCatch(_0x03d5('0x116')));this[_0x03d5('0xcc')](_0x1339c2)[_0x03d5('0xba')](loggerCatch(_0x03d5('0x117')));};Dialer['prototype'][_0x03d5('0x33')]=function(_0x5b8364){var _0xb47f5d=this['uniqueId'][_0x5b8364['uniqueid']];var _0x2f43ed=this;if(this['voiceQueues'][_0x5b8364['queue']]){if(_0xb47f5d&&_0xb47f5d[_0x03d5('0x4e')]!==_0x03d5('0xb4')){delete this[_0x03d5('0x2a')][_0x5b8364[_0x03d5('0xe1')]];this[_0x03d5('0xb7')](this[_0x03d5('0x23')][_0x5b8364[_0x03d5('0xb5')]]);_0xb47f5d[_0x03d5('0x118')]=moment()[_0x03d5('0x92')](_0x03d5('0x100'));var _0x29de6a=new QueueCallerAbandon(_0xb47f5d,_0x5b8364);if(getSeconds(_0xb47f5d[_0x03d5('0x118')],_0xb47f5d[_0x03d5('0x119')])>=_0xb47f5d['dialQueueTimeout']){this[_0x03d5('0x23')][_0x5b8364[_0x03d5('0xb5')]][_0x03d5('0x6d')]+=0x1;this['voiceQueues'][_0x5b8364[_0x03d5('0xb5')]][_0x03d5('0x65')]+=0x1;this[_0x03d5('0x23')][_0x5b8364[_0x03d5('0xb5')]][_0x03d5('0x6f')]+=0x1;_0x29de6a[_0x03d5('0xa6')]=0xa;_0x29de6a['statedesc']='Drop';_0x29de6a[_0x03d5('0x11a')]=_0x03d5('0x11b');_0x29de6a[_0x03d5('0x110')]=this[_0x03d5('0x23')][_0x5b8364[_0x03d5('0xb5')]][_0x03d5('0x111')]?moment()[_0x03d5('0x92')](_0x03d5('0x100')):undefined;_0x29de6a[_0x03d5('0xf4')]+=0x1;_0x29de6a[_0x03d5('0xf0')]+=0x1;if(_0x29de6a[_0x03d5('0xf4')]>=this[_0x03d5('0x23')][_0x5b8364[_0x03d5('0xb5')]]['dialDropMaxRetry']){this[_0x03d5('0x115')](_0x29de6a);}else{this[_0x03d5('0xc3')]({'active':![],'countdropretry':_0x29de6a[_0x03d5('0xf4')],'scheduledat':moment()[_0x03d5('0x106')](this['voiceQueues'][_0x5b8364[_0x03d5('0xb5')]][_0x03d5('0x11c')],_0x03d5('0xff'))['format'](_0x03d5('0x100')),'ContactId':_0xb47f5d[_0x03d5('0xd7')],'ListId':_0xb47f5d[_0x03d5('0xd8')],'VoiceQueueId':_0xb47f5d[_0x03d5('0xda')]||undefined,'CampaignId':_0xb47f5d[_0x03d5('0x101')]||undefined})[_0x03d5('0xba')](loggerCatch(_0x03d5('0x11d')));var _0x3728f9=new History(_0x29de6a);_0x3728f9[_0x03d5('0xa6')]=0xa;_0x3728f9['statedesc']=_0x03d5('0x11e');_0x3728f9[_0x03d5('0xa8')]=moment()['format'](_0x03d5('0x100'));_0x3728f9[_0x03d5('0xa7')]=_0x3728f9[_0x03d5('0xa8')];_0x3728f9['calleridname']=_0x29de6a['calleridname'];_0x3728f9[_0x03d5('0x11f')]=_0x29de6a[_0x03d5('0x11f')];this['createHistory'](_0x3728f9)[_0x03d5('0xba')](loggerCatch(_0x03d5('0x120')));}}else{this[_0x03d5('0x23')][_0x5b8364['queue']][_0x03d5('0x84')]+=0x1;this[_0x03d5('0x23')][_0x5b8364[_0x03d5('0xb5')]][_0x03d5('0x121')]+=0x1;_0x29de6a[_0x03d5('0xa6')]=0xb;_0x29de6a[_0x03d5('0xed')]='Abandoned';_0x29de6a[_0x03d5('0x11a')]=_0x03d5('0x122');_0x29de6a[_0x03d5('0xf5')]+=0x1;_0x29de6a[_0x03d5('0xf0')]+=0x1;if(_0x29de6a[_0x03d5('0xf5')]>=this[_0x03d5('0x23')][_0x5b8364[_0x03d5('0xb5')]][_0x03d5('0x123')]){this[_0x03d5('0x115')](_0x29de6a);}else{this[_0x03d5('0xc3')]({'active':![],'countabandonedretry':_0x29de6a[_0x03d5('0xf5')],'scheduledat':moment()[_0x03d5('0x106')](this[_0x03d5('0x23')][_0x5b8364[_0x03d5('0xb5')]]['dialAbandonedRetryFrequency'],_0x03d5('0xff'))[_0x03d5('0x92')](_0x03d5('0x100')),'ContactId':_0xb47f5d['ContactId'],'ListId':_0xb47f5d[_0x03d5('0xd8')],'VoiceQueueId':_0xb47f5d[_0x03d5('0xda')]||undefined,'CampaignId':_0xb47f5d[_0x03d5('0x101')]||undefined})[_0x03d5('0xba')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x3728f9=new History(_0x29de6a);_0x3728f9[_0x03d5('0xa6')]=0xb;_0x3728f9[_0x03d5('0xed')]=_0x03d5('0x124');_0x3728f9['starttime']=moment()[_0x03d5('0x92')](_0x03d5('0x100'));_0x3728f9[_0x03d5('0xa7')]=_0x3728f9[_0x03d5('0xa8')];_0x3728f9[_0x03d5('0x125')]=_0x29de6a[_0x03d5('0x125')];_0x3728f9[_0x03d5('0x11f')]=_0x29de6a[_0x03d5('0x11f')];this[_0x03d5('0xce')](_0x3728f9)[_0x03d5('0xba')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x03d5('0x1f')][_0x03d5('0x126')]=function(_0x3ce08f){if(this[_0x03d5('0xab')][_0x3ce08f[_0x03d5('0xe1')]]){this['actions'][_0x3ce08f[_0x03d5('0xe1')]][_0x03d5('0xb2')]=_0x3ce08f[_0x03d5('0xb2')];}if(this['uniqueId'][_0x3ce08f[_0x03d5('0xe1')]]){this[_0x03d5('0x2a')][_0x3ce08f[_0x03d5('0xe1')]]['channel']=_0x3ce08f[_0x03d5('0xb2')];}};Dialer[_0x03d5('0x1f')][_0x03d5('0x127')]=function(_0x4809c0){if(strategy[this[_0x03d5('0x23')][this[_0x03d5('0xab')][_0x4809c0[_0x03d5('0x128')]]['queue']][_0x03d5('0x50')]]===_0x03d5('0x1e')){if(this[_0x03d5('0xab')][_0x4809c0['actionid']]&&_['isNil'](this[_0x03d5('0xab')][_0x4809c0[_0x03d5('0x128')]][_0x03d5('0x129')])&&_0x4809c0[_0x03d5('0xb1')]==='1'&&_0x4809c0[_0x03d5('0x12a')]==='0'){if(this[_0x03d5('0x25')][_0x4809c0[_0x03d5('0x12b')]]){if(!this[_0x03d5('0x25')][_0x4809c0['stateinterface']][_0x03d5('0x129')]){this['agents'][_0x4809c0[_0x03d5('0x12b')]][_0x03d5('0x129')]=!![];this[_0x03d5('0xab')][_0x4809c0['actionid']][_0x03d5('0x129')]=!![];this[_0x03d5('0xab')][_0x4809c0[_0x03d5('0x128')]]['stateinterface']=_0x4809c0['stateinterface'];}}}}else if((strategy[this['voiceQueues'][this[_0x03d5('0xab')][_0x4809c0[_0x03d5('0x128')]][_0x03d5('0xb5')]][_0x03d5('0x50')]]||_0x03d5('0x1d'))===_0x03d5('0x1d')){if(this[_0x03d5('0xab')][_0x4809c0['actionid']]){if(this['agents'][_0x4809c0[_0x03d5('0x12b')]]){this['actions'][_0x4809c0[_0x03d5('0x128')]][_0x03d5('0x12b')]=_0x4809c0[_0x03d5('0x12b')];if(_['isNil'](this['queueBooked'][this[_0x03d5('0xab')][_0x4809c0[_0x03d5('0x128')]][_0x03d5('0xb5')]])){this['queueBooked'][this[_0x03d5('0xab')][_0x4809c0['actionid']][_0x03d5('0xb5')]]=[];}this['queueBooked'][this[_0x03d5('0xab')][_0x4809c0['actionid']][_0x03d5('0xb5')]]['push'](_[_0x03d5('0xd5')](_['pick'](this[_0x03d5('0xab')][_0x4809c0[_0x03d5('0x128')]],[_0x03d5('0x12c'),_0x03d5('0x12b')]),{'status':_0x4809c0[_0x03d5('0xb1')],'paused':_0x4809c0[_0x03d5('0x12a')]}));}}}};function unlockQueueStatus(_0x118bf3,_0x2b7e6d){setTimeout(function(){if(_['isUndefined'](_0x118bf3[_0x03d5('0x12d')])){loggerBooked[_0x03d5('0x95')](_0x03d5('0x12e'),_0x2b7e6d);}_0x118bf3[_0x03d5('0x12d')]=!![];loggerBooked['info'](_0x03d5('0x12f'),_0x2b7e6d,JSON[_0x03d5('0x49')](_[_0x03d5('0xd6')](_0x118bf3,['name',_0x03d5('0x12d')])));},0x1f3);}Dialer[_0x03d5('0x1f')][_0x03d5('0x130')]=function(_0x465330){var _0x2e9b8f=this;var _0x4ad82a=_0x2e9b8f['voiceQueues'][_0x2e9b8f[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]]['queue']];if(strategy[this[_0x03d5('0x23')][this[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]][_0x03d5('0xb5')]][_0x03d5('0x50')]]===_0x03d5('0x1e')){if(this[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]]&&this[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]][_0x03d5('0x12b')]){this[_0x03d5('0x22')]['run'](this[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]][_0x03d5('0x12c')],this[_0x03d5('0xab')][_0x465330['actionid']][_0x03d5('0x12b')])['catch'](function(_0xa0df13){logger[_0x03d5('0x95')](_0x03d5('0x131'),util[_0x03d5('0x96')](_0xa0df13,{'showHidden':![],'depth':null}));})[_0x03d5('0x21')](function(){_0x2e9b8f['updateOriginated'](_0x2e9b8f[_0x03d5('0x23')][_0x2e9b8f[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]]['queue']]);_0x2e9b8f[_0x03d5('0x25')][_0x2e9b8f[_0x03d5('0xab')][_0x465330['actionid']][_0x03d5('0x12b')]]['locked']=![];delete _0x2e9b8f['actions'][_0x465330[_0x03d5('0x128')]];unlockQueueStatus(_0x4ad82a);});}else{this[_0x03d5('0xb7')](this[_0x03d5('0x23')][this[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]][_0x03d5('0xb5')]]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x465330[_0x03d5('0x128')]]['ContactId'],'ListId':this['actions'][_0x465330[_0x03d5('0x128')]][_0x03d5('0xd8')],'VoiceQueueId':this['actions'][_0x465330[_0x03d5('0x128')]][_0x03d5('0xda')]||undefined,'CampaignId':this[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]][_0x03d5('0x101')]||undefined})[_0x03d5('0xba')](loggerCatch(_0x03d5('0x132')));delete this[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]];unlockQueueStatus(_0x4ad82a);}}else if((strategy[this['voiceQueues'][this[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]][_0x03d5('0xb5')]][_0x03d5('0x50')]]||_0x03d5('0x1d'))===_0x03d5('0x1d')){var _0x3fb2f6;if(this['actions'][_0x465330[_0x03d5('0x128')]]&&!_['isEmpty'](this[_0x03d5('0x2e')][this[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]][_0x03d5('0xb5')]])){if(this['queueBookedRR'][_0x2e9b8f[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]][_0x03d5('0xb5')]]){this['queueBookedRR'][_0x2e9b8f[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]][_0x03d5('0xb5')]]=this[_0x03d5('0x133')][this[_0x03d5('0xab')][_0x465330['actionid']][_0x03d5('0xb5')]]?this['queueBookedRR'][this['actions'][_0x465330[_0x03d5('0x128')]][_0x03d5('0xb5')]]:this[_0x03d5('0x2e')][this[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]][_0x03d5('0xb5')]]?this['queueBooked'][this[_0x03d5('0xab')][_0x465330['actionid']]['queue']][_0x03d5('0x134')]||0x0:0x0;}this[_0x03d5('0x2e')][this[_0x03d5('0xab')][_0x465330[_0x03d5('0x128')]][_0x03d5('0xb5')]][_0x03d5('0x134')]=this['queueBookedRR'][this[_0x03d5('0xab')][_0x465330['actionid']][_0x03d5('0xb5')]];for(var _0x461d6e=0x0;_0x461d6e=0x0;})['catch'](myreject(_0xc15904)));}}else{_0x5bae7d['push'](ami[_0x03d5('0xb0')]({'action':_0x03d5('0x14e'),'command':util[_0x03d5('0x92')](_0x03d5('0x14f'),_0x3952cc,!_[_0x03d5('0x3e')](config['timezones'][_0x3b3f00])?_0x3b3f00:'')})['then'](function(_0x3bc47b){return _0x3bc47b[_0x03d5('0x151')][_0x03d5('0x152')](_0x03d5('0x153'))>=0x0;})['catch'](myreject(_0xc15904)));}BPromise[_0x03d5('0x154')](_0x5bae7d)['then'](function(_0x503dc5){var _0x33a688=_['some'](_0x503dc5);if(_0x33a688){return _0x437527(_0x33a688);}else{_0x4d9894[_0x03d5('0x40')]=_0x1b9a31?_0x03d5('0x155'):_0x03d5('0x156');return _0xc15904(msgResponse(_0x03d5('0x157'),_0x03d5('0x145'),'Global:\x20'+_0x1b9a31+'\x20'+_0x25b357+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x3952cc,{'showHidden':![],'depth':null})+_0x03d5('0x158')+_0x3b3f00));}})['catch'](function(_0x2d946b){return _0xc15904(msgResponse(_0x03d5('0x144'),_0x03d5('0x145'),JSON[_0x03d5('0x49')](_0x2d946b)));});});};Dialer[_0x03d5('0x1f')]['checkDialMethod']=function(_0x491e4c){var _0x212866=this;return function(){switch(_0x491e4c['dialMethod']){case _0x03d5('0x159'):freeVariablesPredictive(_0x491e4c);_0x212866['handlePower'](_0x491e4c,0x1);break;case'power':freeVariablesPredictive(_0x491e4c);_0x212866[_0x03d5('0x15a')](_0x491e4c,_0x491e4c[_0x03d5('0x15b')]);break;case'predictive':_0x212866[_0x03d5('0xa')](_0x491e4c);break;case _0x03d5('0x9'):freeVariablesPredictive(_0x491e4c);_0x212866[_0x03d5('0x15a')](_0x491e4c,0x1);break;default:freeVariablesPredictive(_0x491e4c);logger[_0x03d5('0x95')](_0x03d5('0x15c'),_0x491e4c[_0x03d5('0x43')],_0x03d5('0x15d'));}};};Dialer[_0x03d5('0x1f')][_0x03d5('0x15e')]=function(_0x2abe58){var _0x175eb4=this;return function(){_0x175eb4[_0x03d5('0x15f')](_0x2abe58);};};Dialer[_0x03d5('0x1f')]['syncQueueSummary']=function(_0x455024){var _0x397a44=this;if(isNotPreview(_0x455024[_0x03d5('0x5b')])){if(isVoiceQueueOutbound(_0x455024[_0x03d5('0x4e')])&&isActive(_0x455024[_0x03d5('0x5a')])){_0x455024['sendMessageOneNotActive']=!![];BPromise['resolve']()[_0x03d5('0xbd')](checkIsLoggedIn(_0x455024,_0x455024[_0x03d5('0x53')]))[_0x03d5('0xbd')](checkIsActive(_0x455024,_0x455024['dialActive']))[_0x03d5('0xbd')](checkInterval(_0x455024))[_0x03d5('0xbd')](_0x397a44[_0x03d5('0x140')](_0x455024))[_0x03d5('0xbd')](_0x397a44[_0x03d5('0x143')](_0x455024[_0x03d5('0x160')],_0x455024[_0x03d5('0x161')],_0x455024[_0x03d5('0x43')],_0x455024))['then'](_0x397a44[_0x03d5('0x162')](_0x455024[_0x03d5('0x45')],_0x455024['dialTimezone'],_0x455024['name'],_0x455024))[_0x03d5('0xbd')](_0x397a44[_0x03d5('0x163')](_0x455024))[_0x03d5('0xba')](loggerCatchQueueSummary('[syncQueueSummary]',_0x455024));}else{notSendMessagesQueue(_0x455024);}}else{freeVariablesPredictive(_0x455024);}};Dialer[_0x03d5('0x1f')][_0x03d5('0x13f')]=function(){var _0x574ab5=this;var _0x500ca0;for(var _0x28e977 in this['campaigns']){if(typeof this[_0x03d5('0x24')][_0x28e977]!==_0x03d5('0x98')){_0x500ca0=this[_0x03d5('0x24')][_0x28e977];if(isCampaignIvr(_0x500ca0['type'])&&isActive(_0x500ca0[_0x03d5('0x79')])){_0x500ca0[_0x03d5('0xa0')]=!![];BPromise[_0x03d5('0xbc')]()[_0x03d5('0xbd')](checkIsActive(_0x500ca0,_0x500ca0['active']))['then'](checkInterval(_0x500ca0))[_0x03d5('0xbd')](_0x574ab5[_0x03d5('0x140')](_0x500ca0))[_0x03d5('0xbd')](_0x574ab5[_0x03d5('0x143')](_0x500ca0[_0x03d5('0x160')],_0x500ca0['dialTimezone'],_0x500ca0[_0x03d5('0x43')],_0x500ca0))['then'](_0x574ab5['checkIfTimeIntervals'](_0x500ca0[_0x03d5('0x45')],_0x500ca0[_0x03d5('0x161')],_0x500ca0['name'],_0x500ca0))[_0x03d5('0xbd')](_0x574ab5[_0x03d5('0x15e')](_0x500ca0))[_0x03d5('0xba')](loggerCatchQueueSummary('[syncCampaigns]',_0x500ca0));}else{notSendMessagesCampaign(_0x500ca0);}}}};function getCallerIdRandom(_0x419065,_0x4b887f){var _0x2e57ce;var _0x1d918a;var _0x49bef3;if(_0x4b887f<=0x0){_0x4b887f=0x1;}_0x2e57ce=new RegExp(_0x03d5('0x164')+_0x4b887f+'}$');_0x1d918a=Math[_0x03d5('0x165')](0xa,_0x4b887f-0x1);_0x49bef3=Math['pow'](0xa,_0x4b887f)-0x1;return util[_0x03d5('0x92')]('%s',_[_0x03d5('0x166')](_0x419065,_0x2e57ce,_[_0x03d5('0x167')](_0x1d918a,_0x49bef3)));}function extractCalleridName(_0x1f030f){var _0x5c88b9=_0x1f030f[_0x03d5('0x168')](/"(.*?)"/);return _0x5c88b9?_0x5c88b9[0x1]:_0x1f030f;}function extractCalleridNumber(_0x36132c){var _0x1408ef=_0x36132c[_0x03d5('0x168')](/<(.*?)>/);return _0x1408ef?_0x1408ef[0x1]:_0x36132c;}Dialer[_0x03d5('0x1f')][_0x03d5('0x169')]=function(_0x5a89fc,_0xddecc7){var _0x4d2b86=this;var _0x7f19fd=uuid['v4']();this[_0x03d5('0xab')][_0x7f19fd]=new Action(_0x5a89fc,_0xddecc7,_0x7f19fd);return new BPromise(function(_0x588b9a,_0x59b0cf){if(_[_0x03d5('0x3e')](_0x5a89fc)&&typeof _0x5a89fc!==_0x03d5('0x16a')){return _0x59b0cf(msgResponse(_0x03d5('0x16b'),_0x03d5('0x145'),_0x03d5('0x16c')));}if(_[_0x03d5('0x3e')](_0xddecc7[_0x03d5('0x16d')][_0x03d5('0x16e')])||_0xddecc7[_0x03d5('0x16d')]['phone']===null){return _0x59b0cf(msgResponse(_0x03d5('0x16b'),'Failure','contact\x20is\x20undefine'));}var _0x30611d={'XMD-CALLERID':_0x4d2b86[_0x03d5('0xab')][_0x7f19fd][_0x03d5('0x16f')](),'XMD-AGI':_0x5a89fc['dialQueueProject']?util[_0x03d5('0x92')](_0x03d5('0x170'),ipAgi,_0x5a89fc['dialQueueProject']):_0x03d5('0x171'),'XMD-AGIAFTER':_0x5a89fc[_0x03d5('0x111')]?util['format'](_0x03d5('0x170'),ipAgi,_0x5a89fc[_0x03d5('0x111')]):_0x03d5('0x171'),'XMD-QUEUE':_0x5a89fc[_0x03d5('0x4e')]===_0x03d5('0x4f')?util['format'](_0x03d5('0x172'),_0x5a89fc[_0x03d5('0x43')],_0x5a89fc[_0x03d5('0x173')]||'',_0x5a89fc['dialAgiAfterHangupAgent']?'c':'',_0x5a89fc['dialQueueTimeout']||0x3):_0x03d5('0x171'),'XMD-CONTACTID':_0xddecc7[_0x03d5('0xd7')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x4d2b86['actions'][_0x7f19fd][_0x03d5('0x16f')](),'XMD-AMD':_0x5a89fc[_0x03d5('0xe6')]?'ACTIVE':_0x03d5('0x171'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x5a89fc[_0x03d5('0xe6')]){_0x30611d[_0x03d5('0x174')]=_0x5a89fc['dialAMDInitialSilence']||0x9c4;_0x30611d[_0x03d5('0x175')]=_0x5a89fc['dialAMDGreeting']||0x5dc;_0x30611d[_0x03d5('0x176')]=_0x5a89fc[_0x03d5('0x177')]||0x320;_0x30611d['XMD-AMDTOTALANALYSISTIME']=_0x5a89fc[_0x03d5('0x178')]||0x1388;_0x30611d[_0x03d5('0x179')]=_0x5a89fc[_0x03d5('0x17a')]||0x64;_0x30611d[_0x03d5('0x17b')]=_0x5a89fc[_0x03d5('0x17c')]||0x32;_0x30611d[_0x03d5('0x17d')]=_0x5a89fc['dialAMDMaximumNumberOfWords']||0x3;_0x30611d[_0x03d5('0x17e')]=_0x5a89fc[_0x03d5('0x17f')]||0x100;_0x30611d['XMD-AMDMAXIMUMWORDLENGTH']=_0x5a89fc[_0x03d5('0x180')]||0x1388;}if(_0x5a89fc[_0x03d5('0x4e')]===_0x03d5('0x4f')){_0x30611d[_0x03d5('0x181')]=_0xddecc7[_0x03d5('0xda')];}else{_0x30611d[_0x03d5('0x182')]=_0xddecc7[_0x03d5('0x101')];}for(var _0x12bc05 in _0xddecc7[_0x03d5('0x16d')]){if(typeof _0xddecc7[_0x03d5('0x16d')][_0x12bc05]!=='undefined'){if(isNotNull(_0xddecc7['Contact'][_0x12bc05])&&_0x12bc05!=='id'&&_0x12bc05!==_0x03d5('0x183')&&_0x12bc05!==_0x03d5('0x184')&&_0x12bc05!=='updatedAt'){_0x30611d[util[_0x03d5('0x92')](_0x03d5('0x185'),_0x03d5('0x186'),_[_0x03d5('0x187')](_0x12bc05))]=_0xddecc7['Contact'][_0x12bc05];}}}var _0x4589a6=_0x4d2b86[_0x03d5('0xde')](_0x5a89fc[_0x03d5('0x78')])?getCallerId(_0x5a89fc['Trunk']['callerid'],_0x5a89fc[_0x03d5('0x5c')],_0x5a89fc[_0x03d5('0x188')]>0x0?getCallerIdRandom(_0x5a89fc[_0x03d5('0x5d')],_0x5a89fc[_0x03d5('0x188')]):_0x5a89fc[_0x03d5('0x5d')]):getCallerId(_[_0x03d5('0xaf')](_0x5a89fc[_0x03d5('0x141')])?_0x5a89fc[_0x03d5('0x78')][_0x03d5('0x189')]:_0x5a89fc[_0x03d5('0x141')]['callerid'],_0x5a89fc[_0x03d5('0x5c')],_0x5a89fc[_0x03d5('0x188')]>0x0?getCallerIdRandom(_0x5a89fc[_0x03d5('0x5d')],_0x5a89fc[_0x03d5('0x188')]):_0x5a89fc[_0x03d5('0x5d')]);if(_0x4589a6){_0x30611d[_0x03d5('0x18a')]=_0x4d2b86['actions'][_0x7f19fd][_0x03d5('0x18b')]=extractCalleridName(_0x4589a6);_0x30611d[_0x03d5('0x18c')]=_0x4d2b86[_0x03d5('0xab')][_0x7f19fd][_0x03d5('0x18d')]=extractCalleridNumber(_0x4589a6);}return ami[_0x03d5('0xb0')]({'actionid':_0x7f19fd,'action':_0x03d5('0x16b'),'channel':_0x4d2b86['isTrunkReachable'](_0x5a89fc[_0x03d5('0x78')])?util[_0x03d5('0x92')](_0x03d5('0x18e'),_0x5a89fc[_0x03d5('0x78')][_0x03d5('0x43')],isNotNull(_0x5a89fc['dialPrefix'])?_0x5a89fc[_0x03d5('0x5f')][_0x03d5('0x18f')]()||'':'',_0x5a89fc[_0x03d5('0x190')]>0x0?_0xddecc7[_0x03d5('0x16d')][_0x03d5('0x16e')][_0x03d5('0x191')](_0x5a89fc['dialCutDigit']):_0xddecc7[_0x03d5('0x16d')][_0x03d5('0x16e')]):util[_0x03d5('0x92')]('SIP/%s/%s%s',_[_0x03d5('0xaf')](_0x5a89fc[_0x03d5('0x141')])?_0x5a89fc[_0x03d5('0x78')]['name']:_0x5a89fc[_0x03d5('0x141')][_0x03d5('0x43')],isNotNull(_0x5a89fc[_0x03d5('0x5f')])?_0x5a89fc[_0x03d5('0x5f')][_0x03d5('0x18f')]()||'':'',_0x5a89fc[_0x03d5('0x190')]>0x0?_0xddecc7['Contact']['phone'][_0x03d5('0x191')](_0x5a89fc[_0x03d5('0x190')]):_0xddecc7[_0x03d5('0x16d')]['phone']),'callerid':_0x4589a6,'Exten':_0x03d5('0xe5'),'Context':_0x03d5('0x192'),'Priority':'1','variable':_0x30611d,'timeout':(_0x5a89fc['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x7f19fd})[_0x03d5('0xbd')](function(_0x312d5f){return _0x588b9a(_0x312d5f);})['catch'](function(_0x5983af){_0x5a89fc['outboundOriginateFailureCallsDay']+=0x1;var _0x14fc1f=new History(_0x4d2b86['actions'][_0x7f19fd]);logger[_0x03d5('0x95')](util[_0x03d5('0x92')](_0x03d5('0x193'),JSON[_0x03d5('0x49')](_0x5983af)));_0x14fc1f['state']=0xe;_0x14fc1f[_0x03d5('0xed')]='OriginateError';_0x14fc1f[_0x03d5('0xa8')]=moment()['format'](_0x03d5('0x100'));_0x14fc1f['endtime']=_0x14fc1f[_0x03d5('0xa8')];_0x4d2b86[_0x03d5('0xce')](_0x14fc1f)[_0x03d5('0xba')](loggerCatch(_0x03d5('0x194')));_0x4d2b86[_0x03d5('0xcc')](_0x14fc1f)[_0x03d5('0xba')](loggerCatch(_0x03d5('0x194')))['finally'](function(){delete _0x4d2b86[_0x03d5('0xab')][_0x7f19fd];return _0x59b0cf(msgResponse('originate','Error',_0x03d5('0x195')));});});});};Dialer[_0x03d5('0x1f')]['syncOriginateResponse']=function(_0x1f1bc8){var _0x48f1d6=this[_0x03d5('0xab')][_0x1f1bc8[_0x03d5('0x128')]];if(_0x48f1d6){delete this[_0x03d5('0xab')][_0x1f1bc8[_0x03d5('0x128')]];_0x48f1d6[_0x03d5('0x119')]=moment()['format'](_0x03d5('0x100'));var _0x22ffdc=_0x48f1d6[_0x03d5('0x4e')]==='ivr'?this[_0x03d5('0x24')][_0x48f1d6[_0x03d5('0xb5')]]:this['voiceQueues'][_0x48f1d6[_0x03d5('0x196')]()];if(!this[_0x03d5('0x197')](_0x1f1bc8['response'])){this['updateOriginated'](_0x22ffdc);return this[_0x03d5('0x198')](_0x48f1d6,_0x22ffdc,_0x1f1bc8)[_0x03d5('0xba')](loggerCatch(_0x03d5('0x199')));}this['uniqueId'][_0x1f1bc8[_0x03d5('0xe1')]]=_0x48f1d6;}};Dialer['prototype']['checkRetriveMax']=function(_0x4bcdf3,_0x12c713,_0x1433f0){var _0x149b1d=new History(_0x12c713);if(_0x149b1d[_0x03d5('0x19a')]+_0x149b1d[_0x03d5('0x105')]+_0x149b1d[_0x03d5('0xf2')]+_0x149b1d[_0x03d5('0xf3')]+_0x149b1d[_0x03d5('0xf4')]+_0x149b1d['countabandonedretry']+_0x149b1d['countmachineretry']+_0x149b1d['countagentrejectretry']>=_0x1433f0[_0x03d5('0xf7')]-0x1){return!![];}switch(_0x4bcdf3){case 0x3:if(_0x149b1d[_0x03d5('0xf2')]>=_0x1433f0['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0x03d5('0xc3')]({'active':![],'countnoanswerretry':_0x149b1d['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x1433f0[_0x03d5('0x19b')],_0x03d5('0xff'))[_0x03d5('0x92')](_0x03d5('0x100')),'ContactId':_0x149b1d[_0x03d5('0xd7')],'ListId':_0x149b1d[_0x03d5('0xd8')],'VoiceQueueId':_0x149b1d['VoiceQueueId']||undefined,'CampaignId':_0x149b1d[_0x03d5('0x101')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x149b1d[_0x03d5('0x19a')]>=_0x1433f0[_0x03d5('0x19c')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x149b1d[_0x03d5('0x19a')]+=0x1,'scheduledat':moment()[_0x03d5('0x106')](_0x1433f0[_0x03d5('0x19d')],'minutes')[_0x03d5('0x92')](_0x03d5('0x100')),'ContactId':_0x149b1d['ContactId'],'ListId':_0x149b1d['ListId'],'VoiceQueueId':_0x149b1d[_0x03d5('0xda')]||undefined,'CampaignId':_0x149b1d[_0x03d5('0x101')]||undefined})[_0x03d5('0xba')](loggerCatch(_0x03d5('0x19e')));break;case 0x8:if(_0x149b1d[_0x03d5('0x105')]>=_0x1433f0[_0x03d5('0x19f')]-0x1){return!![];}this[_0x03d5('0xc3')]({'active':![],'countcongestionretry':_0x149b1d[_0x03d5('0x105')]+=0x1,'scheduledat':moment()[_0x03d5('0x106')](_0x1433f0['dialCongestionRetryFrequency'],_0x03d5('0xff'))['format'](_0x03d5('0x100')),'ContactId':_0x149b1d[_0x03d5('0xd7')],'ListId':_0x149b1d[_0x03d5('0xd8')],'VoiceQueueId':_0x149b1d[_0x03d5('0xda')]||undefined,'CampaignId':_0x149b1d['CampaignId']||undefined})['catch'](loggerCatch(_0x03d5('0x1a0')));break;case 0x0:if(_0x149b1d['countnosuchnumberretry']>=_0x1433f0['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x03d5('0xc3')]({'active':![],'countnosuchnumberretry':_0x149b1d['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x03d5('0x106')](_0x1433f0[_0x03d5('0x1a1')],_0x03d5('0xff'))['format'](_0x03d5('0x100')),'ContactId':_0x149b1d['ContactId'],'ListId':_0x149b1d[_0x03d5('0xd8')],'VoiceQueueId':_0x149b1d['VoiceQueueId']||undefined,'CampaignId':_0x149b1d[_0x03d5('0x101')]||undefined})[_0x03d5('0xba')](loggerCatch(_0x03d5('0x1a2')));}break;case 0xa:if(_0x149b1d[_0x03d5('0xf4')]>=_0x1433f0[_0x03d5('0x1a3')]-0x1){return!![];}this[_0x03d5('0xc3')]({'active':![],'countdropretry':_0x149b1d[_0x03d5('0xf4')]+=0x1,'scheduledat':moment()['add'](_0x1433f0[_0x03d5('0x11c')],_0x03d5('0xff'))[_0x03d5('0x92')](_0x03d5('0x100')),'ContactId':_0x149b1d[_0x03d5('0xd7')],'ListId':_0x149b1d[_0x03d5('0xd8')],'VoiceQueueId':_0x149b1d['VoiceQueueId']||undefined,'CampaignId':_0x149b1d[_0x03d5('0x101')]||undefined})[_0x03d5('0xba')](loggerCatch(_0x03d5('0x11d')));break;case 0xb:if(_0x149b1d[_0x03d5('0xf5')]>=_0x1433f0['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x03d5('0xc3')]({'active':![],'countabandonedretry':_0x149b1d[_0x03d5('0xf5')]+=0x1,'scheduledat':moment()[_0x03d5('0x106')](_0x1433f0['dialAbandonedRetryFrequency'],'minutes')[_0x03d5('0x92')](_0x03d5('0x100')),'ContactId':_0x149b1d[_0x03d5('0xd7')],'ListId':_0x149b1d[_0x03d5('0xd8')],'VoiceQueueId':_0x149b1d[_0x03d5('0xda')]||undefined,'CampaignId':_0x149b1d[_0x03d5('0x101')]||undefined})[_0x03d5('0xba')](loggerCatch(_0x03d5('0x1a4')));break;case 0x13:if(_0x149b1d[_0x03d5('0xfa')]>=_0x1433f0['dialMachineMaxRetry']-0x1){return!![];}this[_0x03d5('0xc3')]({'active':![],'countmachineretry':_0x149b1d[_0x03d5('0xfa')]+=0x1,'scheduledat':moment()[_0x03d5('0x106')](_0x1433f0['dialMachineRetryFrequency'],'minutes')[_0x03d5('0x92')](_0x03d5('0x100')),'ContactId':_0x149b1d[_0x03d5('0xd7')],'ListId':_0x149b1d[_0x03d5('0xd8')],'VoiceQueueId':_0x149b1d['VoiceQueueId']||undefined,'CampaignId':_0x149b1d[_0x03d5('0x101')]||undefined})[_0x03d5('0xba')](loggerCatch(_0x03d5('0x102')));break;case 0x14:if(_0x149b1d[_0x03d5('0xf6')]>=_0x1433f0[_0x03d5('0x1a5')]-0x1){return!![];}this[_0x03d5('0xc3')]({'active':![],'countagentrejectretry':_0x149b1d['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x03d5('0x106')](_0x1433f0['dialAgentRejectRetryFrequency'],_0x03d5('0xff'))[_0x03d5('0x92')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x149b1d[_0x03d5('0xd7')],'ListId':_0x149b1d[_0x03d5('0xd8')],'VoiceQueueId':_0x149b1d[_0x03d5('0xda')]||undefined,'CampaignId':_0x149b1d[_0x03d5('0x101')]||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x03d5('0x1f')][_0x03d5('0x198')]=function(_0x110b43,_0xbd4acf,_0xc69aaa){var _0x7c556f=this;var _0x520f19=new History(_0x110b43);return new BPromise(function(_0x18efbd,_0x562a78){if(_[_0x03d5('0x3e')](_0xbd4acf)&&typeof _0xbd4acf!==_0x03d5('0x16a')){return _0x562a78(msgResponse(_0x03d5('0x1a6'),'Failure',_0x03d5('0x1a7')));}if(_[_0x03d5('0x3e')](_0xc69aaa)&&typeof _0xc69aaa!==_0x03d5('0x16a')){return _0x562a78(msgResponse(_0x03d5('0x1a6'),_0x03d5('0x145'),_0x03d5('0x1a8')));}switch(_0xc69aaa[_0x03d5('0x10e')]){case'0':_0xbd4acf['outboundNoSuchCallsDay']+=0x1;_0x520f19[_0x03d5('0xa6')]=0x0;_0x520f19[_0x03d5('0xed')]=_0x03d5('0x1a9');_0x520f19[_0x03d5('0xf3')]+=0x1;_0x520f19['countglobal']+=0x1;ami[_0x03d5('0x4d')]('custom:agentnosuchnumber',ut[_0x03d5('0x1aa')](_0x110b43,_0x03d5('0x1ab')));_0x7c556f[_0x03d5('0xce')](_0x520f19)[_0x03d5('0xba')](loggerCatch(_0x03d5('0x104')));if(_0x7c556f[_0x03d5('0x1ac')](0x0,_0x110b43,_0xbd4acf)){if(_0x520f19[_0x03d5('0xf3')]>=_0xbd4acf[_0x03d5('0x1ad')]){_0x7c556f[_0x03d5('0xfc')](_0x520f19,_0x18efbd,_0x562a78,_0x03d5('0x1ae'));}else{_0x7c556f[_0x03d5('0xf8')](_0x520f19,_0x18efbd,_0x562a78,_0x03d5('0x1ae'));}}break;case'3':_0xbd4acf[_0x03d5('0x1af')]+=0x1;_0x520f19['state']=0x3;_0x520f19[_0x03d5('0xed')]=_0x03d5('0x1b0');_0x520f19[_0x03d5('0xf2')]+=0x1;_0x520f19['countglobal']+=0x1;ami[_0x03d5('0x4d')](_0x03d5('0x1b1'),ut[_0x03d5('0x1aa')](_0x110b43,_0x03d5('0x1b2')));_0x7c556f['createHistory'](_0x520f19)[_0x03d5('0xba')](loggerCatch(_0x03d5('0x1b3')));if(_0x7c556f[_0x03d5('0x1ac')](0x3,_0x110b43,_0xbd4acf)){if(_0x520f19[_0x03d5('0xf2')]>=_0xbd4acf[_0x03d5('0x1b4')]){_0x7c556f['createStateFinal'](_0x520f19,_0x18efbd,_0x562a78,'reason\x203\x20ringing\x20no\x20answer');}else{_0x7c556f['stateGlobal'](_0x520f19,_0x18efbd,_0x562a78,_0x03d5('0x1b5'));}}break;case'5':_0xbd4acf[_0x03d5('0x1b6')]+=0x1;_0x520f19[_0x03d5('0xa6')]=0x5;_0x520f19[_0x03d5('0xed')]=_0x03d5('0x1b7');_0x520f19[_0x03d5('0x19a')]+=0x1;_0x520f19[_0x03d5('0xf0')]+=0x1;ami[_0x03d5('0x4d')](_0x03d5('0x1b8'),ut['buildObj'](_0x110b43,_0x03d5('0x1b9')));_0x7c556f['createHistory'](_0x520f19)[_0x03d5('0xba')](loggerCatch(_0x03d5('0x1ba')));if(_0x7c556f[_0x03d5('0x1ac')](0x5,_0x110b43,_0xbd4acf)){if(_0x520f19[_0x03d5('0x19a')]>=_0xbd4acf['dialBusyMaxRetry']){_0x7c556f[_0x03d5('0xfc')](_0x520f19,_0x18efbd,_0x562a78,_0x03d5('0x1bb'));}else{_0x7c556f[_0x03d5('0xf8')](_0x520f19,_0x18efbd,_0x562a78,_0x03d5('0x1bb'));}}break;case'8':_0xbd4acf[_0x03d5('0x63')]+=0x1;_0x520f19[_0x03d5('0xa6')]=0x8;_0x520f19['statedesc']=_0x03d5('0x1bc');_0x520f19[_0x03d5('0x105')]+=0x1;_0x520f19[_0x03d5('0xf0')]+=0x1;ami['emit'](_0x03d5('0x1bd'),ut[_0x03d5('0x1aa')](_0x110b43,'congestion'));_0x7c556f['createHistory'](_0x520f19)[_0x03d5('0xba')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x7c556f[_0x03d5('0x1ac')](0x8,_0x110b43,_0xbd4acf)){if(_0x520f19[_0x03d5('0x105')]>=_0xbd4acf['dialCongestionMaxRetry']){_0x7c556f[_0x03d5('0xfc')](_0x520f19,_0x18efbd,_0x562a78,'reason\x208\x20congestion');}else{_0x7c556f[_0x03d5('0xf8')](_0x520f19,_0x18efbd,_0x562a78,_0x03d5('0x1be'));}}break;case'11':_0xbd4acf[_0x03d5('0x1bf')]+=0x1;_0x520f19[_0x03d5('0xa6')]=0xb;_0x520f19['statedesc']=_0x03d5('0x124');_0x520f19['countabandonedretry']+=0x1;_0x520f19[_0x03d5('0xf0')]+=0x1;_0x7c556f[_0x03d5('0xce')](_0x520f19)[_0x03d5('0xba')](loggerCatch(_0x03d5('0x1c0')));if(_0x7c556f[_0x03d5('0x1ac')](0xb,_0x110b43,_0xbd4acf)){if(_0x520f19[_0x03d5('0xf5')]>=_0xbd4acf[_0x03d5('0x123')]){_0x7c556f[_0x03d5('0xfc')](_0x520f19,_0x18efbd,_0x562a78,'reason\x2011\x20abandoned');}else{_0x7c556f[_0x03d5('0xf8')](_0x520f19,_0x18efbd,_0x562a78,_0x03d5('0x1c1'));}}break;case'20':_0xbd4acf[_0x03d5('0x68')]+=0x1;_0x520f19['state']=0x14;_0x520f19[_0x03d5('0xed')]='AgentReject';_0x520f19['countagentrejectretry']+=0x1;_0x520f19[_0x03d5('0xf0')]+=0x1;ami[_0x03d5('0x4d')](_0x03d5('0x1c2'),ut[_0x03d5('0x1aa')](_0x110b43,_0x03d5('0x1c3')));_0x7c556f[_0x03d5('0xce')](_0x520f19)[_0x03d5('0xba')](loggerCatch(_0x03d5('0x1c4')));if(_0x7c556f[_0x03d5('0x1ac')](0x14,_0x110b43,_0xbd4acf)){if(_0x520f19[_0x03d5('0xf6')]>=_0xbd4acf[_0x03d5('0x1a5')]){_0x7c556f[_0x03d5('0xfc')](_0x520f19,_0x18efbd,_0x562a78,'reason\x2020\x20agentreject');}else{_0x7c556f['stateGlobal'](_0x520f19,_0x18efbd,_0x562a78,_0x03d5('0x1c5'));}}break;default:_0xbd4acf['outboundUnknownCallsDay']+=0x1;_0x520f19[_0x03d5('0xa6')]=0xc;_0x520f19[_0x03d5('0xed')]=_0xc69aaa[_0x03d5('0x10e')];_0x7c556f[_0x03d5('0xce')](_0x520f19)[_0x03d5('0xba')](loggerCatch(_0x03d5('0x1c6')));if(_0x7c556f[_0x03d5('0x1ac')](_0xc69aaa['reason'],_0x110b43,_0xbd4acf)){if(_0x520f19[_0x03d5('0x19a')]+_0x520f19['countcongestionretry']+_0x520f19[_0x03d5('0xf2')]+_0x520f19[_0x03d5('0xf3')]+_0x520f19[_0x03d5('0xf4')]+_0x520f19['countabandonedretry']+_0x520f19[_0x03d5('0xfa')]+_0x520f19[_0x03d5('0xf6')]>=_0xbd4acf[_0x03d5('0xf7')]){_0x7c556f[_0x03d5('0xf8')](_0x520f19,_0x18efbd,_0x562a78,_0xc69aaa[_0x03d5('0x10e')]);}else{_0x7c556f[_0x03d5('0xfc')](_0x520f19,_0x18efbd,_0x562a78,_0xc69aaa[_0x03d5('0x10e')]);}}}});};Dialer[_0x03d5('0x1f')][_0x03d5('0xf8')]=function(_0x5f3481,_0x5f5c5d,_0xa008ed,_0x4ac4a1){var _0xb75f5a=new Final(_0x5f3481);_0xb75f5a[_0x03d5('0xa6')]=0xf;_0xb75f5a['statedesc']='Global';this[_0x03d5('0xfc')](_0xb75f5a,_0x5f5c5d,_0xa008ed,_0x4ac4a1);};Dialer[_0x03d5('0x1f')][_0x03d5('0xfc')]=function(_0x4fe73c,_0x2b69df,_0x49383d,_0x264730){this[_0x03d5('0xcc')](_0x4fe73c)[_0x03d5('0xbd')](function(){return _0x2b69df(msgResponse(_0x03d5('0x1a6'),_0x03d5('0xdd'),_0x264730));})[_0x03d5('0xba')](function(){return _0x49383d(msgResponse(_0x03d5('0x1c7'),_0x03d5('0x145'),_0x03d5('0x1c8')));});};Dialer[_0x03d5('0x1f')][_0x03d5('0xa')]=function(_0x1c67f4){var _0x199889=_0x1c67f4[_0x03d5('0x1c9')]/0x64;var _0x73a53c=_0x1c67f4[_0x03d5('0x65')]/(_0x1c67f4[_0x03d5('0x65')]+_0x1c67f4[_0x03d5('0x61')]);var _0x259163=Math[_0x03d5('0x1ca')](_0x1c67f4[_0x03d5('0x71')]*(_0x1c67f4['predictiveIntervalMaxThreshold']/0x64));var _0x37bc8c=Math[_0x03d5('0x1ca')](_0x1c67f4['predictiveIntervalAvailable']*(_0x1c67f4[_0x03d5('0x1cb')]/0x64));var _0x3dad9b=_0x1c67f4[_0x03d5('0x52')]+_0x1c67f4['talking'];var _0x26331e=Math['floor'](_0x1c67f4[_0x03d5('0x73')]*_0x1c67f4[_0x03d5('0x75')]*_0x1c67f4[_0x03d5('0x1cc')]*_0x1c67f4[_0x03d5('0x1cd')]);if(_[_0x03d5('0x3e')](_0x1c67f4['startProgressive'])){if(!_[_0x03d5('0x3e')](_0x1c67f4[_0x03d5('0x2c')])){_0x1c67f4[_0x03d5('0x2c')]=undefined;loggerPredictive[_0x03d5('0x95')]('[startMethodPredictive][StartProgressive]',_0x03d5('0x1ce'));}if(!_[_0x03d5('0x3e')](_0x1c67f4['handlePredictive'])){loggerPredictive[_0x03d5('0x95')](_0x03d5('0x1cf'),_0x03d5('0x1d0'));clearInterval(_0x1c67f4[_0x03d5('0x8e')]);_0x1c67f4['handlePredictive']=undefined;}_0x1c67f4[_0x03d5('0x77')]=moment()['format'](_0x03d5('0x100'));loggerPredictive['info'](_0x1c67f4[_0x03d5('0x43')],'collection\x20data\x20in\x20progressive\x20at',_0x1c67f4[_0x03d5('0x77')]);this[_0x03d5('0x15a')](_0x1c67f4,0x1);}else if(ifInterval(_0x1c67f4[_0x03d5('0x1d1')],_0x1c67f4[_0x03d5('0x77')])){this[_0x03d5('0x15a')](_0x1c67f4,0x1);loggerPredictiveCalls['info'](_0x03d5('0x1d2'),_0x1c67f4[_0x03d5('0x77')],_0x1c67f4[_0x03d5('0x43')]);_0x1c67f4['erlangCalls']=0x0;_0x1c67f4[_0x03d5('0x6f')]=0x0;}else if(_0x199889<_0x73a53c&&_0x1c67f4[_0x03d5('0x1d3')]===_0x03d5('0x1d4')){freeVariablesPredictive(_0x1c67f4);loggerPredictive['info'](_0x03d5('0x1d5'),'Dropped\x20calls\x20day',_0x73a53c,'startProgressive',_0x1c67f4[_0x03d5('0x43')]);}else if(_0x26331e<_0x1c67f4[_0x03d5('0x6f')]&&_0x1c67f4[_0x03d5('0x1d3')]===_0x03d5('0x1d4')){freeVariablesPredictive(_0x1c67f4);loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x1d6'),_0x03d5('0x1d7'),_0x26331e,_0x03d5('0x1d8'),_0x1c67f4[_0x03d5('0x6f')],_0x03d5('0x77'),_0x1c67f4[_0x03d5('0x43')]);}else if(!ifInterval(_0x1c67f4[_0x03d5('0x1d1')],_0x1c67f4[_0x03d5('0x77')])&&_['isUndefined'](_0x1c67f4[_0x03d5('0x2c')])&&!_[_0x03d5('0x3e')](_0x1c67f4[_0x03d5('0x77')])){_0x1c67f4[_0x03d5('0x2c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x03d5('0x7e')](_0x1c67f4[_0x03d5('0x43')],'started\x20in\x20predictive\x20at',_0x1c67f4[_0x03d5('0x2c')]);this[_0x03d5('0xc0')](_0x1c67f4['dialPredictiveInterval'])[_0x03d5('0xbd')](this[_0x03d5('0x1d9')](_0x1c67f4))[_0x03d5('0xbd')](mergeDataErlangB(_0x1c67f4))['then'](this[_0x03d5('0x1da')](_0x1c67f4))[_0x03d5('0xba')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x1c67f4));}else if(!ifInterval(_0x1c67f4[_0x03d5('0x1d1')],_0x1c67f4['startPredictive'])){_0x1c67f4['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x1c67f4[_0x03d5('0x2c')]=moment()[_0x03d5('0x92')](_0x03d5('0x100'));loggerPredictive['info'](_0x1c67f4[_0x03d5('0x43')],'recalculate\x20predictive\x20at',_0x1c67f4[_0x03d5('0x2c')]);clearInterval(_0x1c67f4[_0x03d5('0x8e')]);_0x1c67f4[_0x03d5('0x8e')]=undefined;this[_0x03d5('0xc0')](_0x1c67f4[_0x03d5('0x1d1')])[_0x03d5('0xbd')](this[_0x03d5('0x1d9')](_0x1c67f4))[_0x03d5('0xbd')](mergeDataErlangB(_0x1c67f4))['then'](this['startMethodPredictive'](_0x1c67f4))['catch'](loggerCatchPredictive(_0x03d5('0x1db'),_0x1c67f4));}else if(_0x1c67f4[_0x03d5('0x71')]&&_0x3dad9b<_0x1c67f4[_0x03d5('0x71')]-_0x37bc8c){freeVariablesPredictive(_0x1c67f4);loggerPredictive[_0x03d5('0x7e')](_0x1c67f4[_0x03d5('0x43')],_0x03d5('0x1dc'),_0x3dad9b,_0x03d5('0x1dd'),_0x1c67f4[_0x03d5('0x71')],'-',_0x37bc8c,'=',_0x1c67f4['predictiveIntervalAvailable']-_0x37bc8c,')');}else if(_0x1c67f4[_0x03d5('0x71')]&&_0x3dad9b>_0x1c67f4['predictiveIntervalAvailable']+_0x259163){freeVariablesPredictive(_0x1c67f4);loggerPredictive[_0x03d5('0x7e')](_0x1c67f4['name'],_0x03d5('0x1dc'),_0x3dad9b,')\x20are\x20more\x20than\x20threshold\x20(',_0x1c67f4[_0x03d5('0x71')],'+',_0x259163,'=',_0x1c67f4[_0x03d5('0x71')]+_0x259163,')');}};Dialer[_0x03d5('0x1f')][_0x03d5('0x1d9')]=function(_0x18712e){var _0x31a6fe=this;return function(_0x2b3172){return new BPromise(function(_0x50f6b9,_0x4f3186){_[_0x03d5('0xd5')](_0x18712e,_0x2b3172[0x0]);if(checkGetDataPredictive(_0x2b3172[0x0])){var _0x5c2449=_0x18712e[_0x03d5('0x71')]=_0x18712e['talking']+_0x18712e[_0x03d5('0x52')];var _0x1758c2=_0x18712e[_0x03d5('0x1d1')]*0x3c;var _0x20a959=_0x2b3172[0x0][_0x03d5('0x6c')]+_0x2b3172[0x0]['predictiveIntervalAvgHoldtime'];var _0x1f18ce=(_0x2b3172[0x0][_0x03d5('0x6a')]+_0x2b3172[0x0][_0x03d5('0x6d')]+_0x2b3172[0x0][_0x03d5('0x84')])/_0x2b3172[0x0][_0x03d5('0x80')];_0x18712e[_0x03d5('0x1cc')]=_0x1f18ce>0x0?_0x1f18ce:0x1;switch(_0x18712e[_0x03d5('0x1d3')]){case _0x03d5('0x1d4'):var _0x54838d=_0x18712e['dialPredictiveOptimizationPercentage']/0x64;return _0x31a6fe[_0x03d5('0x1de')](_0x5c2449,_0x1758c2,_0x20a959,_0x1f18ce,_0x54838d)['then'](function(_0x36e0cb){return _0x50f6b9(_0x36e0cb);});case'agentBusyFactor':var _0x5c6fd7=_0x18712e[_0x03d5('0x1c9')]/0x64;return _0x31a6fe[_0x03d5('0x1df')](_0x5c2449,_0x1758c2,_0x20a959,_0x1f18ce,_0x5c6fd7)[_0x03d5('0xbd')](function(_0x3694ce){return _0x50f6b9(_0x3694ce);});default:return _0x4f3186(msgResponse(_0x03d5('0x1e0'),_0x03d5('0x145'),'Unknown\x20Predictive'));}}else{return _0x4f3186(msgResponse(_0x03d5('0x1e0'),_0x03d5('0x145'),_0x03d5('0x1e1')));}});};};Dialer[_0x03d5('0x1f')][_0x03d5('0x1e2')]=function(_0x4b79c9){var _0x2dc52e=this;return function(_0x1bb8d7){return new BPromise(function(_0x43f943,_0x381152){_[_0x03d5('0xd5')](_0x4b79c9,_0x1bb8d7[0x0]);if(checkGetDataPredictive(_0x1bb8d7[0x0])){loggerPredictive[_0x03d5('0x7e')](JSON[_0x03d5('0x49')](_0x1bb8d7[0x0]));if(_0x4b79c9[_0x03d5('0x1d3')]===_0x03d5('0x1d4')){return _0x2dc52e[_0x03d5('0xca')](_0x4b79c9['id'])['then'](function(_0x2ce82e){var _0x57b651=_0x4b79c9[_0x03d5('0x53')]-_0x2ce82e[0x0][_0x03d5('0x1e3')];var _0x521700=_0x4b79c9[_0x03d5('0x1d1')]*0x3c;var _0x257f44=_0x1bb8d7[0x0][_0x03d5('0x6c')]+_0x1bb8d7[0x0][_0x03d5('0x6b')];var _0x4d20c8=(_0x1bb8d7[0x0]['predictiveIntervalAnsweredCalls']+_0x1bb8d7[0x0][_0x03d5('0x6d')]+_0x1bb8d7[0x0][_0x03d5('0x84')])/_0x1bb8d7[0x0]['predictiveIntervalTotalCalls'];var _0x507144=_0x4b79c9[_0x03d5('0x1c9')]/0x64;_0x4b79c9['predictiveIntervalPauses']=_0x2ce82e[0x0][_0x03d5('0x1e3')]||0x0;_0x4b79c9['predictiveIntervalHitRate']=_0x4d20c8>0x0?_0x4d20c8:0x1;return _0x2dc52e[_0x03d5('0x1de')](_0x57b651,_0x521700,_0x257f44,_0x4d20c8,_0x507144);})[_0x03d5('0xbd')](function(_0xfe53e9){return _0x43f943(_0xfe53e9);})[_0x03d5('0xba')](function(_0x17b475){return _0x381152(msgResponse(_0x03d5('0x1e4'),_0x03d5('0x145'),JSON[_0x03d5('0x49')](_0x17b475)));});}if(_0x4b79c9['dialPredictiveOptimization']==='agentBusyFactor'){return _0x2dc52e[_0x03d5('0xca')](_0x4b79c9['id'])[_0x03d5('0xbd')](function(_0x16ec67){var _0x1bef13=_0x4b79c9['loggedIn']-_0x16ec67[0x0][_0x03d5('0x1e3')];var _0x2515e0=_0x4b79c9[_0x03d5('0x1d1')]*0x3c;var _0x1918af=_0x1bb8d7[0x0][_0x03d5('0x6c')]+_0x1bb8d7[0x0][_0x03d5('0x6b')];var _0x2e17ed=(_0x1bb8d7[0x0][_0x03d5('0x6a')]+_0x1bb8d7[0x0][_0x03d5('0x6d')]+_0x1bb8d7[0x0][_0x03d5('0x84')])/_0x1bb8d7[0x0][_0x03d5('0x80')];var _0x10caa9=_0x4b79c9[_0x03d5('0x1c9')]/0x64;_0x4b79c9[_0x03d5('0x70')]=_0x16ec67[0x0][_0x03d5('0x1e3')]||0x0;_0x4b79c9[_0x03d5('0x1cc')]=_0x2e17ed>0x0?_0x2e17ed:0x1;return _0x2dc52e['busyFactor'](_0x1bef13,_0x2515e0,_0x1918af,_0x2e17ed,_0x10caa9);})[_0x03d5('0xbd')](function(_0x949b9a){return _0x43f943(_0x949b9a);})[_0x03d5('0xba')](function(_0x271246){return _0x381152(msgResponse('[CatchErlangB]',_0x03d5('0x145'),JSON['stringify'](_0x271246)));});}}else{return _0x381152(msgResponse(_0x03d5('0x1e0'),'Failure',_0x03d5('0x1e1')));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x4945d7){var _0x1d94db=this;return function(){var _0x453df3=0x0;var _0xdf00ba=Math[_0x03d5('0x1e5')](_0x4945d7['erlangCallToSecond']*0x3e8);if(_0xdf00ba>0x0){_0xdf00ba=_0xdf00ba<0x64?0x64:_0xdf00ba;loggerPredictive[_0x03d5('0x7e')](_0x4945d7[_0x03d5('0x43')],'one\x20call\x20every:',_0xdf00ba,_0x03d5('0x4a'));_0x4945d7['handlePredictive']=setInterval(function(){_0x1d94db[_0x03d5('0x8e')](_0x4945d7);loggerPredictiveCalls['info'](_0x03d5('0x1e6'),_0x453df3+=0x1);},_0xdf00ba);}else{loggerPredictive['info'](_0x4945d7[_0x03d5('0x43')],_0x03d5('0x1e7'));}};};Dialer[_0x03d5('0x1f')]['checkContactBlack']=function(_0x118e57,_0x120bd1){var _0x221490=this;return function(_0x34f752){if(_[_0x03d5('0x91')](_0x34f752)){if(_[_0x03d5('0xaf')](_0x120bd1[_0x03d5('0xd9')])||!_0x120bd1['recallme']){if(_0x118e57[_0x03d5('0x5b')]===_0x03d5('0x9')){_0x118e57[_0x03d5('0x12d')]=_['isUndefined'](_0x118e57[_0x03d5('0x12d')])?!![]:_0x118e57[_0x03d5('0x12d')];var _0x4cadde=uuid['v4']();_0x221490['actions'][_0x4cadde]=new Action(_0x118e57,_0x120bd1,_0x4cadde);loggerBooked[_0x03d5('0x7e')]('[booked][checkContactBlack]',_0x4cadde,_0x03d5('0x1e8'),JSON[_0x03d5('0x49')](_0x118e57[_0x03d5('0x12d')]),'Queue:\x20',_0x118e57['name']);if(_0x118e57[_0x03d5('0x12d')]){_0x118e57[_0x03d5('0x12d')]=![];_0x221490[_0x03d5('0x2e')][_0x221490[_0x03d5('0xab')][_0x4cadde][_0x03d5('0xb5')]]=[];ami[_0x03d5('0xb0')]({'actionid':_0x4cadde,'action':_0x03d5('0x1e9'),'queue':_0x118e57[_0x03d5('0x43')]})[_0x03d5('0xba')](function(){_0x221490[_0x03d5('0xb7')](_0x118e57);_0x221490[_0x03d5('0xc3')]({'active':![],'ContactId':_0x221490[_0x03d5('0xab')][_0x4cadde][_0x03d5('0xd7')],'ListId':_0x221490['actions'][_0x4cadde][_0x03d5('0xd8')],'VoiceQueueId':_0x221490[_0x03d5('0xab')][_0x4cadde][_0x03d5('0xda')]||undefined,'CampaignId':_0x221490['actions'][_0x4cadde][_0x03d5('0x101')]||undefined})[_0x03d5('0xba')](loggerCatch(_0x03d5('0x1ea')));delete _0x221490[_0x03d5('0xab')][_0x4cadde];});}else{loggerBooked[_0x03d5('0x7e')]('[booked][checkContactBlack][else]',JSON[_0x03d5('0x49')](_0x118e57['queueStatusComplete']),_0x03d5('0x1eb'),_0x118e57[_0x03d5('0x43')]);_0x221490[_0x03d5('0xb7')](_0x118e57);_0x221490[_0x03d5('0xc3')]({'active':![],'ContactId':_0x221490['actions'][_0x4cadde]['ContactId'],'ListId':_0x221490['actions'][_0x4cadde][_0x03d5('0xd8')],'VoiceQueueId':_0x221490[_0x03d5('0xab')][_0x4cadde][_0x03d5('0xda')]||undefined,'CampaignId':_0x221490[_0x03d5('0xab')][_0x4cadde][_0x03d5('0x101')]||undefined})['catch'](loggerCatch(_0x03d5('0x1ea')));delete _0x221490[_0x03d5('0xab')][_0x4cadde];}}else{return _0x221490[_0x03d5('0x169')](_0x118e57,_0x120bd1);}}else{if(getDiff(_0x120bd1['scheduledat'])<_0x118e57[_0x03d5('0x1ec')]*0x3c){if(_0x120bd1[_0x03d5('0x1ed')]&&!_0x120bd1[_0x03d5('0x1ed')][_0x03d5('0x1ee')]){_0x221490[_0x03d5('0x22')][_0x03d5('0x138')](_0x120bd1['id'])['finally'](function(){_0x221490[_0x03d5('0xb7')](_0x118e57);});}else{_0x221490['unlockContact']({'active':![]},_0x120bd1['id'],0x1)[_0x03d5('0x21')](function(){_0x221490[_0x03d5('0xb7')](_0x118e57);});}}else{_0x118e57['outboundReCallsDay']+=0x1;_0x221490[_0x03d5('0xb7')](_0x118e57);if(_0x118e57[_0x03d5('0x1ef')]){_0x221490[_0x03d5('0xc3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x120bd1[_0x03d5('0xd7')],'ListId':_0x120bd1[_0x03d5('0xd8')],'VoiceQueueId':_0x120bd1[_0x03d5('0xda')]||undefined,'CampaignId':_0x120bd1[_0x03d5('0x101')]||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x221490[_0x03d5('0xce')](createObjHistory(_0x118e57,_0x120bd1,_0x03d5('0x1f0'),0x17,_0x03d5('0x1f1')))[_0x03d5('0xba')](loggerCatch(_0x03d5('0x1f2')));}else{_0x221490[_0x03d5('0xd4')](createObjHistory(_0x118e57,_0x120bd1,_0x03d5('0x1f3'),0x16,_0x03d5('0x1f4')),_0x03d5('0x1f5'),'[Originate][HistoryRecallClose]');}}}}else{_0x118e57['outboundBlacklistCallsDay']+=0x1;_0x221490['saveInDb'](createObjHistory(_0x118e57,_0x120bd1,_0x03d5('0x1f6'),0xd,_0x03d5('0x1f7')),_0x03d5('0x1f8'),_0x03d5('0x1f9'));throw _0x03d5('0x1fa');}};};Dialer['prototype']['handleIvr']=function(_0x34ad09){var _0xc4657d=this;var _0x5b2618=_0x34ad09[_0x03d5('0x1fb')]-_0x34ad09[_0x03d5('0x72')]-_0x34ad09[_0x03d5('0x1fc')];emitCampaignSummary(_0x34ad09);if(_0x5b2618>0x0){if(_0x5b2618>this[_0x03d5('0x27')]){_0x5b2618=this[_0x03d5('0x27')];}_0x34ad09[_0x03d5('0x1fc')]+=_0x5b2618;this[_0x03d5('0xc9')](_0x34ad09['id'],_0x5b2618,_0x34ad09[_0x03d5('0x1fd')])[_0x03d5('0xbd')](function(_0x116762){_0x34ad09[_0x03d5('0x1fc')]-=_0x5b2618;_0x34ad09[_0x03d5('0x1fc')]=_0x34ad09[_0x03d5('0x1fc')]>0x0?_0x34ad09['temp']:0x0;if(!checkContactEmpty(_0x116762)){_0x34ad09[_0x03d5('0x40')]=_0x03d5('0x9e');logger['info']('[getContactCampaign2][Empty]'+_0x34ad09['name']);}else{_0x34ad09['originated']+=_0x116762['length'];_0x34ad09['message']=_0x03d5('0x1fe');for(var _0x2a289a=0x0;_0x2a289a<_0x116762[_0x03d5('0x97')];_0x2a289a+=0x1){_0x34ad09['ivrTotalCallsDays']+=0x1;if(_[_0x03d5('0xaf')](_0x116762[_0x2a289a])||_[_0x03d5('0xaf')](_0x116762[_0x2a289a][_0x03d5('0x16d')])||_[_0x03d5('0xaf')](_0x116762[_0x2a289a][_0x03d5('0x16d')][_0x03d5('0x16e')])){_0xc4657d[_0x03d5('0xd2')](_0x03d5('0x1ff'),_0x34ad09,_0x116762[_0x2a289a]);}else{_0xc4657d[_0x03d5('0x200')](_['pick'](_0x116762[_0x2a289a],[_0x03d5('0x101'),_0x03d5('0x201')]))['then'](_0xc4657d[_0x03d5('0x202')](_0x34ad09,_0x116762[_0x2a289a]))[_0x03d5('0xba')](_0xc4657d[_0x03d5('0xd1')](_0x03d5('0x203'),_0x34ad09));}}}})['catch'](loggerGetContactDialer(_0x03d5('0x204'),_0x34ad09,_0x5b2618));}};Dialer[_0x03d5('0x1f')]['handlePower']=function(_0xefdd37,_0x1b0126){var _0x4ce947=this;var _0x1a22c7=[];var _0x189be1=_0x1b0126>=0x1?_0x1b0126:0x1;if(_0xefdd37[_0x03d5('0x5b')]==='booked'){_0x189be1=0x1;}var _0x698ded=Math['floor'](_0xefdd37[_0x03d5('0x52')]*_0x189be1)-_0xefdd37[_0x03d5('0x72')]-_0xefdd37[_0x03d5('0x1fc')];emitVoiceQueueSummary(_0xefdd37);if(_0xefdd37['dialLimitQueue']>0x0){var _0x28396b=_0xefdd37['dialLimitQueue']-_0xefdd37[_0x03d5('0x72')]-_0xefdd37[_0x03d5('0x56')]-_0xefdd37[_0x03d5('0x1fc')]-_0xefdd37[_0x03d5('0x54')];if(_0x698ded>_0x28396b){_0x698ded=_0x28396b;}}if(_0x698ded>0x0){if(_0xefdd37[_0x03d5('0x5b')]===_0x03d5('0x9')){_0x698ded=0x1;}if(_0x698ded>this[_0x03d5('0x27')]){_0x698ded=this[_0x03d5('0x27')];}_0xefdd37[_0x03d5('0x1fc')]+=_0x698ded;for(var _0x18d7e8 in this[_0x03d5('0x25')]){if(typeof this[_0x03d5('0x25')][_0x18d7e8]!==_0x03d5('0x98')){if(this[_0x03d5('0x25')][_0x18d7e8]['state']===_0x03d5('0x205')&&this['agents'][_0x18d7e8][_0x03d5('0xb1')]==='reachable'){_0x1a22c7[_0x03d5('0x14d')](this[_0x03d5('0x25')][_0x18d7e8]['id']);}}}this[_0x03d5('0xc7')](_0xefdd37['id'],_0x1a22c7,_0x698ded,_0xefdd37[_0x03d5('0x1fd')])[_0x03d5('0xbd')](function(_0x1a517b){_0xefdd37['temp']-=_0x698ded;_0xefdd37[_0x03d5('0x1fc')]=_0xefdd37[_0x03d5('0x1fc')]>0x0?_0xefdd37['temp']:0x0;if(!checkContactEmpty(_0x1a517b)){_0x4ce947[_0x03d5('0xb9')](_0xefdd37)['then'](sendMessageReschedule(_0xefdd37))['catch'](loggerCatch(_0x03d5('0x206')));}else{_0xefdd37[_0x03d5('0x72')]+=_0x1a517b[_0x03d5('0x97')];_0xefdd37['message']=_0xefdd37[_0x03d5('0x5b')]===_0x03d5('0x9')?'ACTIVE':_0x03d5('0x1fe');for(var _0x8ac9ce=0x0;_0x8ac9ce<_0x1a517b[_0x03d5('0x97')];_0x8ac9ce+=0x1){if(_[_0x03d5('0xaf')](_0x1a517b[_0x8ac9ce])||_['isNil'](_0x1a517b[_0x8ac9ce][_0x03d5('0x16d')])||_['isNil'](_0x1a517b[_0x8ac9ce][_0x03d5('0x16d')][_0x03d5('0x16e')])){_0x4ce947[_0x03d5('0xd2')]('[actionOriginate]\x20',_0xefdd37,_0x1a517b[_0x8ac9ce]);}else{_0x4ce947[_0x03d5('0xbb')](_[_0x03d5('0xd6')](_0x1a517b[_0x8ac9ce],['VoiceQueueId','Contact.phone']))['then'](_0x4ce947[_0x03d5('0x202')](_0xefdd37,_0x1a517b[_0x8ac9ce]))['catch'](_0x4ce947['loggerHandler'](_0x03d5('0x1ff'),_0xefdd37));}}}})[_0x03d5('0xba')](loggerGetContactDialer('[getContactDialer2]',_0xefdd37,_0x698ded));}};Dialer['prototype'][_0x03d5('0x8e')]=function(_0x3c4591){if(_0x3c4591['dialLimitQueue']>0x0){var _0x606119=_0x3c4591[_0x03d5('0x207')]-_0x3c4591['originated']-_0x3c4591['talking'];if(_0x606119>0x0){this[_0x03d5('0x208')](_0x3c4591);}else{loggerPredictiveCalls['info'](_0x03d5('0x209'));}}else{this[_0x03d5('0x208')](_0x3c4591);}};Dialer[_0x03d5('0x1f')]['tryOriginatePredictive']=function(_0x5e655f){var _0x41c7fa=this;var _0x54cb4a=[];_0x5e655f['originated']+=0x1;for(var _0x346fa3 in this[_0x03d5('0x25')]){if(typeof this[_0x03d5('0x25')][_0x346fa3]!==_0x03d5('0x98')){if(this['agents'][_0x346fa3]['state']===_0x03d5('0x205')&&this[_0x03d5('0x25')][_0x346fa3][_0x03d5('0xb1')]===_0x03d5('0xdf')){_0x54cb4a[_0x03d5('0x14d')](this['agents'][_0x346fa3]['id']);}}}this['getContactDialer'](_0x5e655f['id'],_0x54cb4a,0x1,_0x5e655f[_0x03d5('0x1fd')])[_0x03d5('0xbd')](function(_0x6f87cc){if(!checkContactEmpty(_0x6f87cc)){checkContactLowerLimitOriginate(_0x5e655f,0x1,0x0);_0x41c7fa[_0x03d5('0xb9')](_0x5e655f)['then'](sendMessageReschedule(_0x5e655f))[_0x03d5('0xba')](loggerCatch('[countReScheduled]\x20'));}else{_0x5e655f[_0x03d5('0x40')]=_0x03d5('0x1fe');if(_['isNil'](_0x6f87cc[0x0])||_[_0x03d5('0xaf')](_0x6f87cc[0x0][_0x03d5('0x16d')])||_[_0x03d5('0xaf')](_0x6f87cc[0x0]['Contact'][_0x03d5('0x16e')])){_0x41c7fa['emptyContact'](_0x03d5('0x1ff'),_0x5e655f,_0x6f87cc[0x0]);}else{_0x41c7fa['checkIsBlackList'](_[_0x03d5('0xd6')](_0x6f87cc[0x0],[_0x03d5('0xda'),_0x03d5('0x201')]))[_0x03d5('0xbd')](_0x41c7fa[_0x03d5('0x202')](_0x5e655f,_0x6f87cc[0x0]))['catch'](_0x41c7fa[_0x03d5('0xd1')]('[actionOriginatePredictive]\x20',_0x5e655f));}}})[_0x03d5('0xba')](loggerGetContactDialer(_0x03d5('0x20a'),_0x5e655f,0x1));emitVoiceQueueSummary(_0x5e655f);};Dialer[_0x03d5('0x1f')][_0x03d5('0x1de')]=function(_0x4dd7d1,_0x3d8c8c,_0x174b72,_0x1ebca9,_0x526a0e,_0x4b99a8){loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x20b'));loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x20c'),_0x4dd7d1);loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x20d'),_0x3d8c8c);loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x20e'),_0x174b72);loggerPredictive[_0x03d5('0x7e')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1ebca9);loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x20f'),_0x526a0e);loggerPredictive[_0x03d5('0x7e')]('---------------------------');return new BPromise(function(_0x1c3c57,_0x279f66){if(_0x4dd7d1<=0x0||isNaN(_0x4dd7d1)){return _0x279f66(msgResponse(_0x03d5('0x210'),_0x03d5('0x211'),_0x03d5('0x212')+_0x4dd7d1));}if(_0x174b72<=0x0||isNaN(_0x174b72)){return _0x279f66(msgResponse(_0x03d5('0x210'),_0x03d5('0x211'),_0x03d5('0x213')+_0x174b72));}if(_0x1ebca9<=0x0||isNaN(_0x1ebca9)){return _0x279f66(msgResponse(_0x03d5('0x210'),'Error',_0x03d5('0x214')+_0x1ebca9));}if(_0x3d8c8c<=0x0||isNaN(_0x3d8c8c)){return _0x279f66(msgResponse(_0x03d5('0x210'),_0x03d5('0x211'),'interval\x20=\x20'+_0x3d8c8c));}if(_0x526a0e<=0x0||isNaN(_0x526a0e)){return _0x279f66(msgResponse(_0x03d5('0x210'),_0x03d5('0x211'),_0x03d5('0x215')+_0x526a0e));}_0x4b99a8=_0x4b99a8||0x0;var _0x347d7b=0x1/_0x174b72;var _0x5d13d9=0x0;var _0x471953=0x0;var _0x296cef=0x0;var _0x22c028=0x0;for(var _0x15604b=0x0;_0x296cef<_0x526a0e;_0x15604b+=0x1){_0x471953=_0x15604b/_0x3d8c8c;_0x5d13d9=(_0x1ebca9*_0x471953+_0x4b99a8)/_0x347d7b;_0x296cef=erlangb(_0x5d13d9,_0x4dd7d1);_0x22c028=_0x5d13d9/_0x4dd7d1*(0x1-erlangb(_0x5d13d9,_0x4dd7d1));}return _0x1c3c57({'erlangCalls':_0x15604b,'erlangCallToSecond':_0x3d8c8c/_0x15604b,'erlangAbandonmentRate':_0x296cef,'erlangBusyFactor':_0x22c028});});};Dialer[_0x03d5('0x1f')]['busyFactor']=function(_0x24efc4,_0x296137,_0x4d43dc,_0x4d40d4,_0x3c4a47,_0x4886d7){loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x216'));loggerPredictive[_0x03d5('0x7e')]('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',_0x24efc4);loggerPredictive[_0x03d5('0x7e')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x296137);loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x20e'),_0x4d43dc);loggerPredictive[_0x03d5('0x7e')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4d40d4);loggerPredictive['info']('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3c4a47);loggerPredictive[_0x03d5('0x7e')](_0x03d5('0x87'));return new BPromise(function(_0x3572ee,_0x2ddd29){if(_0x24efc4<=0x0||isNaN(_0x24efc4)){return _0x2ddd29(msgResponse(_0x03d5('0x217'),_0x03d5('0x211'),_0x03d5('0x212')+_0x24efc4));}if(_0x4d43dc<=0x0||isNaN(_0x4d43dc)){return _0x2ddd29(msgResponse(_0x03d5('0x217'),_0x03d5('0x211'),_0x03d5('0x213')+_0x4d43dc));}if(_0x4d40d4<=0x0||isNaN(_0x4d40d4)){return _0x2ddd29(msgResponse(_0x03d5('0x217'),'Error',_0x03d5('0x214')+_0x4d40d4));}if(_0x296137<=0x0||isNaN(_0x296137)){return _0x2ddd29(msgResponse(_0x03d5('0x217'),'Error',_0x03d5('0x218')+_0x296137));}if(_0x3c4a47<=0x0||isNaN(_0x3c4a47)){return _0x2ddd29(msgResponse(_0x03d5('0x217'),_0x03d5('0x211'),_0x03d5('0x219')+_0x3c4a47));}_0x4886d7=_0x4886d7||0x0;var _0x5e482f=0x1/_0x4d43dc;var _0x744ae6=0x0;var _0x544c20=0x0;var _0x4e7972=0x0;var _0x2c5df6=0x0;for(var _0x281d1b=0x0;_0x2c5df6<_0x3c4a47;_0x281d1b+=0x1){_0x544c20=_0x281d1b/_0x296137;_0x744ae6=(_0x4d40d4*_0x544c20+_0x4886d7)/_0x5e482f;_0x4e7972=erlangb(_0x744ae6,_0x24efc4);_0x2c5df6=_0x744ae6/_0x24efc4*(0x1-erlangb(_0x744ae6,_0x24efc4));}return _0x3572ee({'erlangCalls':_0x281d1b,'erlangCallToSecond':_0x296137/_0x281d1b,'erlangAbandonmentRate':_0x4e7972,'erlangBusyFactor':_0x2c5df6});});};module[_0x03d5('0x21a')]=Dialer; \ No newline at end of file +var _0x3514=['[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','queueCallerAbandonCreateState','dialDropRetryFrequency','[rescheduleContact][Drop]','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','CALLEREXIT','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','Abandoned','syncQueueMember','actionid','strategy','locked','stateinterface','queueBooked','pick','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','preview','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','push','command','iftime\x20%s,%s','content','indexOf','true','all','GLOBAL_INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','checkDialMethod','handlePower','power','dialPowerLevel','method\x20not\x20recognized','launchHandleIvr','dialActive','dialTimezone','dialGlobalInterval','[syncCampaigns]','\x5cw{0,','pow','replace','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','dialQueueTimeout','getCaller','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','entity\x20is\x20undefine','NoSuchNumber','buildObj','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','congestion','reason\x208\x20congestion','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[callProgressDetecting]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','Dropped\x20calls\x20day','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','predictiveIntervalAvailable','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','temp','getContactDialerIvr','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','Amax\x20=\x20','busyFactor','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','moment','md5','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./final','./agentComplete','env','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuestatuscomplete','loopClearZombieChannels','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','Intervals','[ifTime][Action]','Error','stringify','milliseconds','emit','outbound','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','type','unmanaged','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startProgressive','Trunk','callerid','format','voice:queue:%s','voice_queue:save','campaign:ivr:%s','campaign:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\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','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','diff','seconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','NOT_ACTIVE','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','statedesc','starttime','clearZombieChannels','[uniqueid]','actions','[actions]','isNil','Action','status','channel','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','saveInDb','UserId','VoiceQueueId','CampaignId','isSuccess','Success','isTrunkReachable','active','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','HANGUP','membername','AMD','[syncHangupInAMD]','dialAMDActive','value','MACHINE','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','dialGlobalMaxRetry','reason19\x20machine....','reason\x2019\x20machine....','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','ContactId','ListId','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countcongestionretry','countagentrejectretry','stateGlobal','dialMachineMaxRetry','createStateFinal','minutes','[syncHangupIvr][createHistory]'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3514,0x118));var _0x4351=function(_0x47f7d1,_0x45fece){_0x47f7d1=_0x47f7d1-0x0;var _0x475b83=_0x3514[_0x47f7d1];return _0x475b83;};'use strict';var util=require(_0x4351('0x0'));var _=require(_0x4351('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x4351('0x2'));var rr=require('rr');var md5=require(_0x4351('0x3'));var Redis=require('ioredis');var ut=require(_0x4351('0x4'));var config=require(_0x4351('0x5'));var logger=require(_0x4351('0x6'))(_0x4351('0x7'));var loggerBooked=require(_0x4351('0x6'))(_0x4351('0x8'));var loggerPredictive=require(_0x4351('0x6'))(_0x4351('0x9'));var loggerPredictiveCalls=require(_0x4351('0x6'))(_0x4351('0xa'));var loggerSyncQueueSummary=require(_0x4351('0x6'))('syncQueueSummary');var ami=require(_0x4351('0xb'));config[_0x4351('0xc')]=_[_0x4351('0xd')](config[_0x4351('0xc')],{'host':_0x4351('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4351('0xc')]));var cmHopper=require(_0x4351('0xf'));var cmHopperHistory=require(_0x4351('0x10'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x4351('0x11'));var Action=require('./action');var History=require('./history');var Final=require(_0x4351('0x12'));var AgentComplete=require(_0x4351('0x13'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require('./hangup');var ipAgi=process[_0x4351('0x14')]['XCALLY_IP_AGI']||'127.0.0.1';var strategy={'rrmemory':_0x4351('0x15'),'roundrobin':_0x4351('0x16')};var Sequence=function(){};Sequence[_0x4351('0x17')][_0x4351('0x18')]=function(_0x387cea){this['tail']=this[_0x4351('0x19')]?this[_0x4351('0x19')][_0x4351('0x1a')](_0x387cea):_0x387cea();};function Dialer(_0x10f641,_0x555b9f){this[_0x4351('0x1b')]=new Sequence();this['preview']=_0x555b9f;this[_0x4351('0x1c')]=_0x10f641[_0x4351('0x1c')];this[_0x4351('0x1d')]=_0x10f641['campaigns'];this[_0x4351('0x1e')]=_0x10f641['agents'];this['trunks']=_0x10f641[_0x4351('0x1f')];this[_0x4351('0x20')]=config[_0x4351('0x20')]||0x2;this[_0x4351('0x21')]={};this['actions']={};this[_0x4351('0x22')]={};this[_0x4351('0x23')]={};this[_0x4351('0x24')]={};this[_0x4351('0x25')]={};this['startProgressive']={};this['ivrOriginated']={};this['queueBooked']={};this[_0x4351('0x26')]={};ami['on']('agentconnect',this[_0x4351('0x27')][_0x4351('0x28')](this));ami['on'](_0x4351('0x29'),this[_0x4351('0x2a')]['bind'](this));ami['on'](_0x4351('0x2b'),this[_0x4351('0x2c')][_0x4351('0x28')](this));ami['on'](_0x4351('0x2d'),this[_0x4351('0x2e')][_0x4351('0x28')](this));ami['on'](_0x4351('0x2f'),this[_0x4351('0x30')][_0x4351('0x28')](this));ami['on'](_0x4351('0x31'),this[_0x4351('0x32')][_0x4351('0x28')](this));ami['on'](_0x4351('0x33'),this[_0x4351('0x34')][_0x4351('0x28')](this));ami['on'](_0x4351('0x35'),this[_0x4351('0x36')][_0x4351('0x28')](this));ami['on']('queuemember',this['syncQueueMember']['bind'](this));ami['on'](_0x4351('0x37'),this['syncQueueStatusComplete'][_0x4351('0x28')](this));this['loopCampaigns']();this[_0x4351('0x38')]();}function isNotNull(_0x23a951){return _0x23a951!==null&&!_['isUndefined'](_0x23a951);}function checkIsLoggedIn(_0x3bd8b6,_0x3673e5){return function(){if(_0x3673e5<=0x0){_0x3bd8b6[_0x4351('0x39')]=_0x4351('0x3a');throw _0x3bd8b6[_0x4351('0x3b')]+_0x4351('0x3c');}};}function isActive(_0x1981b3){return _0x1981b3;}function checkIsActive(_0x4bdc6b,_0x1ef615){return function(){if(!isActive(_0x1ef615)){_0x4bdc6b[_0x4351('0x39')]='NOT_ACTIVE';throw _0x4bdc6b['name']+_0x4351('0x3d');}};}function checkInterval(_0x13ca25){return function(){if(!isNotNull(_0x13ca25[_0x4351('0x3e')])){_0x13ca25['message']=_0x4351('0x3f');throw _0x13ca25[_0x4351('0x3b')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x13ca25[_0x4351('0x3e')][_0x4351('0x40')])){_0x13ca25['message']='INTERVAL_IS_NULL';throw _0x13ca25[_0x4351('0x3b')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x13ca25[_0x4351('0x3e')]['Intervals']))){_0x13ca25[_0x4351('0x39')]='INTERVAL_IS_NULL';throw _0x13ca25[_0x4351('0x3b')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x45e2da,_0x2149c0,_0x32e127){return{'action':_0x45e2da,'response':_0x2149c0,'message':_0x32e127,'stack':_0x32e127};}function myreject(_0x536101){return function(_0x507062){return _0x536101(msgResponse(_0x4351('0x41'),_0x4351('0x42'),JSON[_0x4351('0x43')](_0x507062)));};}function getSeconds(_0x554aec,_0x714267){var _0x3a4d4e=moment(_0x554aec)['milliseconds'](0x0);var _0x227936=moment(_0x714267)[_0x4351('0x44')](0x0);return _0x3a4d4e['diff'](_0x227936,'seconds');}function emit(_0x3c5693,_0x5399db,_0x200693){io['to'](_0x3c5693)[_0x4351('0x45')](_0x5399db,_0x200693);}function emitVoiceQueueSummary(_0x446748){if(_0x446748['type']===_0x4351('0x46')){var _0x37d5fb={'id':_0x446748['id'],'name':_0x446748[_0x4351('0x3b')],'strategy':_0x446748['strategy'],'answered':_0x446748[_0x4351('0x47')],'available':_0x446748[_0x4351('0x48')],'loggedIn':_0x446748[_0x4351('0x49')],'pTalking':_0x446748[_0x4351('0x4a')],'sumBillable':_0x446748[_0x4351('0x4b')],'sumDuration':_0x446748[_0x4351('0x4c')],'sumHoldTime':_0x446748[_0x4351('0x4d')]||0x0,'talking':_0x446748['talking'],'total':_0x446748['total'],'type':_0x446748[_0x4351('0x4e')],'unmanaged':_0x446748[_0x4351('0x4f')],'abandoned':_0x446748['abandoned'],'waiting':_0x446748[_0x4351('0x50')],'loggedInDb':_0x446748[_0x4351('0x51')],'dialActive':_0x446748['dialActive'],'dialMethod':_0x446748[_0x4351('0x52')],'dialOriginateCallerIdName':_0x446748[_0x4351('0x53')],'dialOriginateCallerIdNumber':_0x446748[_0x4351('0x54')],'dialOriginateTimeout':_0x446748[_0x4351('0x55')],'dialPrefix':_0x446748[_0x4351('0x56')],'outboundAnswerAgiCallsDay':_0x446748[_0x4351('0x57')],'outboundAnswerCallsDay':_0x446748[_0x4351('0x58')],'outboundBlacklistCallsDay':_0x446748[_0x4351('0x59')],'outboundBusyCallsDay':_0x446748[_0x4351('0x5a')],'outboundCongestionCallsDay':_0x446748['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x446748[_0x4351('0x5b')],'outboundDropCallsDayCallersExit':_0x446748['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x446748[_0x4351('0x5c')],'outboundNoAnswerCallsDay':_0x446748['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x446748[_0x4351('0x5d')],'outboundOriginateFailureCallsDay':_0x446748[_0x4351('0x5e')],'outboundReCallsDay':_0x446748[_0x4351('0x5f')],'outboundRejectCallsDay':_0x446748[_0x4351('0x60')],'outboundUnknownCallsDay':_0x446748[_0x4351('0x61')],'predictiveIntervalAnsweredCalls':_0x446748[_0x4351('0x62')],'predictiveIntervalAvgHoldtime':_0x446748[_0x4351('0x63')],'predictiveIntervalAvgTalktime':_0x446748[_0x4351('0x64')],'predictiveIntervalDroppedCallsCallersExit':_0x446748[_0x4351('0x65')],'predictiveIntervalDroppedCallsTimeout':_0x446748[_0x4351('0x66')],'predictiveIntervalErlangCalls':_0x446748[_0x4351('0x67')],'predictiveIntervalErlangCallsDroppedCalls':_0x446748['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x446748[_0x4351('0x68')],'predictiveIntervalMultiplicativeFactor':_0x446748[_0x4351('0x69')],'predictiveIntervalPauses':_0x446748[_0x4351('0x6a')],'predictiveIntervalAvailable':_0x446748['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x446748[_0x4351('0x6b')],'message':_0x446748['message'],'originated':_0x446748[_0x4351('0x6c')],'erlangCalls':_0x446748[_0x4351('0x6d')],'erlangCallToSecond':_0x446748[_0x4351('0x6e')],'erlangAbandonmentRate':_0x446748[_0x4351('0x6f')],'erlangBusyFactor':_0x446748['erlangBusyFactor'],'startPredictive':_0x446748['startPredictive'],'startProgressive':_0x446748[_0x4351('0x70')]};if(_0x446748[_0x4351('0x71')]){_0x37d5fb['Trunk']={'id':_0x446748[_0x4351('0x71')]['id'],'name':_0x446748['Trunk'][_0x4351('0x3b')],'active':_0x446748['Trunk']['active'],'callerid':_0x446748[_0x4351('0x71')][_0x4351('0x72')]};}if(_0x446748[_0x4351('0x3e')]){_0x37d5fb[_0x4351('0x3e')]={'id':_0x446748[_0x4351('0x3e')]['id'],'name':_0x446748['Interval'][_0x4351('0x3b')]};}var _0x1f8e5d=md5(JSON[_0x4351('0x43')](_0x37d5fb));if(_0x446748[_0x4351('0x3')]!==_0x1f8e5d){_0x446748[_0x4351('0x3')]=_0x1f8e5d;emit(util[_0x4351('0x73')](_0x4351('0x74'),_0x37d5fb[_0x4351('0x3b')]),_0x4351('0x75'),_0x37d5fb);}}}function emitCampaignSummary(_0x50fcac){if(_0x50fcac[_0x4351('0x4e')]==='ivr'){emit(util[_0x4351('0x73')](_0x4351('0x76'),_0x50fcac['name']),_0x4351('0x77'),_0x50fcac);}}function checkGetDataPredictive(_0xb932d5){if(isNotNull(_0xb932d5)&&!_[_0x4351('0x78')](_0xb932d5)){loggerPredictive[_0x4351('0x79')](_0x4351('0x7a'));loggerPredictive[_0x4351('0x79')](_0x4351('0x7b'),_0xb932d5['predictiveIntervalTotalCalls']);loggerPredictive[_0x4351('0x79')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xb932d5[_0x4351('0x62')]);loggerPredictive[_0x4351('0x79')](_0x4351('0x7c'),_0xb932d5[_0x4351('0x66')]);loggerPredictive[_0x4351('0x79')](_0x4351('0x7d'),_0xb932d5[_0x4351('0x65')]);loggerPredictive[_0x4351('0x79')](_0x4351('0x7e'),_0xb932d5['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0x4351('0x7f'),_0xb932d5['predictiveIntervalAvgTalktime']);loggerPredictive[_0x4351('0x79')](_0x4351('0x80'));if(_0xb932d5[_0x4351('0x6b')]>0x0){if(!_[_0x4351('0x81')](_0xb932d5['predictiveIntervalAvgTalktime'])&&_0xb932d5['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x4351('0x79')](_0x4351('0x82'));if(!_[_0x4351('0x81')](_0xb932d5['predictiveIntervalAvgHoldtime'])&&_0xb932d5[_0x4351('0x63')]>0x0){return!![];}loggerPredictive[_0x4351('0x79')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x4351('0x79')](_0x4351('0x83'));}}else{loggerPredictive[_0x4351('0x79')](_0x4351('0x84'));}return![];}function mergeDataErlangB(_0x242369){return function(_0xc3e4c8){loggerPredictive[_0x4351('0x79')](_0x4351('0x85'));loggerPredictive[_0x4351('0x79')](_0x4351('0x86'),_0xc3e4c8[_0x4351('0x6d')]);loggerPredictive[_0x4351('0x79')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xc3e4c8[_0x4351('0x6e')]);loggerPredictive[_0x4351('0x79')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xc3e4c8[_0x4351('0x6f')]);loggerPredictive[_0x4351('0x79')](_0x4351('0x87'),_0xc3e4c8[_0x4351('0x88')]);loggerPredictive[_0x4351('0x79')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xc3e4c8[_0x4351('0x6f')]);loggerPredictive[_0x4351('0x79')](_0x4351('0x80'));_[_0x4351('0x89')](_0x242369,_0xc3e4c8);};}function getDiff(_0x2fd6b2){var _0x5bfb7d=moment()[_0x4351('0x44')](0x0);var _0x16b9ea=moment(_0x2fd6b2)['milliseconds'](0x0);return _0x5bfb7d[_0x4351('0x8a')](_0x16b9ea,_0x4351('0x8b'));}function ifInterval(_0x23f572,_0x47fe81){if(_[_0x4351('0x81')](_0x47fe81)){return![];}return getDiff(_0x47fe81)<_0x23f572*0x3c;}function freeVariablesPredictive(_0x265b33){if(isNotNull(_0x265b33)){if(!_['isUndefined'](_0x265b33[_0x4351('0x70')])){_0x265b33['startProgressive']=undefined;loggerPredictive[_0x4351('0x79')](_0x265b33[_0x4351('0x3b')],_0x4351('0x8c'));}if(!_['isUndefined'](_0x265b33[_0x4351('0x25')])){_0x265b33[_0x4351('0x25')]=undefined;loggerPredictive[_0x4351('0x79')](_0x265b33[_0x4351('0x3b')],_0x4351('0x8d'));}if(!_[_0x4351('0x81')](_0x265b33[_0x4351('0x8e')])){clearInterval(_0x265b33[_0x4351('0x8e')]);_0x265b33[_0x4351('0x8e')]=undefined;loggerPredictive[_0x4351('0x79')](_0x265b33[_0x4351('0x3b')],_0x4351('0x8f'));}}}function erlangb(_0x1bd827,_0x323906){if(_0x323906===0x0){return 0x0;}var _0x2cd693=0x1;for(var _0x4feec9=0x1;_0x4feec9<=_0x323906;_0x4feec9+=0x1){_0x2cd693=0x1+_0x2cd693*_0x4feec9/_0x1bd827;}return 0x1/_0x2cd693;}function isVoiceQueueOutbound(_0x33074a){return _0x33074a===_0x4351('0x46');}function isNotPreview(_0x19c5c2){return _0x19c5c2!=='preview';}function isCampaignIvr(_0x520bf9){return _0x520bf9===_0x4351('0x90');}function getCallerId(_0x5562d0,_0x857f03,_0x77fc7b){if(!_[_0x4351('0x81')](_0x77fc7b)&&typeof _0x77fc7b==='string'&&!_[_0x4351('0x78')](_0x77fc7b)){if(!_[_0x4351('0x81')](_0x857f03)&&typeof _0x857f03===_0x4351('0x91')&&!_['isEmpty'](_0x857f03)){return util[_0x4351('0x73')]('\x22%s\x22\x20<%s>',_0x857f03,_0x77fc7b);}return util[_0x4351('0x73')](_0x4351('0x92'),_0x77fc7b,_0x77fc7b);}if(!_[_0x4351('0x81')](_0x5562d0)&&typeof _0x5562d0==='string'&&!_['isEmpty'](_0x5562d0)){return _0x5562d0;}return _0x4351('0x93');}function loggerCatchQueueSummary(_0x36a98a,_0x2a2358){return function(_0x9e1b03){freeVariablesPredictive(_0x2a2358);emitVoiceQueueSummary(_0x2a2358);emitCampaignSummary(_0x2a2358);loggerSyncQueueSummary[_0x4351('0x94')](_0x36a98a,util[_0x4351('0x95')](_0x9e1b03,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x16691e,_0x5081be){return function(_0x3bbafb){loggerPredictive[_0x4351('0x94')](_0x5081be[_0x4351('0x3b')],_0x16691e);loggerPredictive[_0x4351('0x94')](_0x3bbafb[_0x4351('0x96')]);freeVariablesPredictive(_0x5081be);};}function loggerCatch(_0x3d77a5){return function(_0x74dda9){logger[_0x4351('0x94')](_0x3d77a5,util[_0x4351('0x95')](_0x74dda9,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x78e876){return _0x78e876&&!_[_0x4351('0x81')](_0x78e876)&&_0x78e876[_0x4351('0x97')]>0x0;}function decremetOriginate(_0x2efe54){if(!_['isUndefined'](_0x2efe54)&&_0x2efe54!==null){if(typeof _0x2efe54[_0x4351('0x6c')]!==_0x4351('0x98')){if(_0x2efe54[_0x4351('0x6c')]>0x0){_0x2efe54[_0x4351('0x6c')]-=0x1;}else{logger['error'](_0x4351('0x99'));}}}else{logger[_0x4351('0x94')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x39ae18,_0x29938c,_0x2788d9){if(_0x29938c>_0x2788d9){for(var _0x418355=0x0;_0x418355<_0x29938c-_0x2788d9;_0x418355+=0x1){decremetOriginate(_0x39ae18);}}}function loggerGetContactDialer(_0x4bfb43,_0x2cba6c,_0x3a5dbb){return function(_0x5afd73){checkContactLowerLimitOriginate(_0x2cba6c,_0x3a5dbb,0x0);logger[_0x4351('0x94')](_0x4bfb43,util[_0x4351('0x95')](_0x5afd73,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5efb1a){return function(_0x13e948){if(isNotNull(_0x13e948)&&isNotNull(_0x13e948[0x0])){if(_0x13e948[0x0][_0x4351('0x9a')]>0x0){_0x5efb1a['message']='RESCHEDULED_CONTACTS';logger[_0x4351('0x79')](_0x4351('0x9b')+_0x5efb1a[_0x4351('0x3b')],_0x13e948[0x0]['contactsRescheduled'],_0x4351('0x9c'));}else{_0x5efb1a[_0x4351('0x39')]=_0x4351('0x9d');logger['info'](_0x4351('0x9e')+_0x5efb1a['name']);}}};}function notSendMessagesQueue(_0x116681){if(_0x116681[_0x4351('0x9f')]){freeVariablesPredictive(_0x116681);if(_0x116681[_0x4351('0x6c')]===0x0&&_0x116681[_0x4351('0xa0')]===0x0&&_0x116681[_0x4351('0x50')]===0x0&&(_0x116681[_0x4351('0x4a')]||0x0)===0x0){_0x116681[_0x4351('0x9f')]=![];_0x116681[_0x4351('0x48')]=0x0;_0x116681[_0x4351('0x39')]=_0x4351('0xa1');loggerSyncQueueSummary[_0x4351('0x94')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x116681[_0x4351('0x3b')],'is\x20not\x20active');}else{_0x116681['message']=_0x4351('0xa2');loggerSyncQueueSummary[_0x4351('0x94')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x116681[_0x4351('0x3b')],'is\x20disactive');}emitVoiceQueueSummary(_0x116681);}}function notSendMessagesCampaign(_0x4a5e9e){if(_0x4a5e9e[_0x4351('0x9f')]){if(_0x4a5e9e[_0x4351('0x6c')]===0x0){_0x4a5e9e[_0x4351('0x9f')]=![];_0x4a5e9e[_0x4351('0x39')]=_0x4351('0xa1');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x4a5e9e[_0x4351('0x3b')],'is\x20not\x20active');}else{_0x4a5e9e[_0x4351('0x39')]=_0x4351('0xa2');loggerSyncQueueSummary[_0x4351('0x94')](_0x4351('0xa3'),_0x4a5e9e[_0x4351('0x3b')],_0x4351('0xa4'));}emitCampaignSummary(_0x4a5e9e);}}function createObjHistory(_0x33f6a6,_0x13ea48,_0x252e10,_0x19b709,_0x4b9398){_0x33f6a6[_0x4351('0x39')]=_0x252e10;var _0x37f8da=new Action(_0x33f6a6,_0x13ea48);var _0x489c5f=new History(_0x37f8da);_0x489c5f[_0x4351('0xa5')]=_0x19b709;_0x489c5f[_0x4351('0xa6')]=_0x4b9398;_0x489c5f['endtime']=_0x37f8da[_0x4351('0xa7')];return _0x489c5f;}Dialer[_0x4351('0x17')][_0x4351('0x38')]=function(){var _0x441509=this;setInterval(function(){_0x441509[_0x4351('0xa8')](_0x441509[_0x4351('0x23')],_0x4351('0xa9'));_0x441509[_0x4351('0xa8')](_0x441509[_0x4351('0xaa')],_0x4351('0xab'));},0x32c8);};Dialer[_0x4351('0x17')][_0x4351('0xa8')]=function(_0x4db5d0,_0x350208){var _0x375bf3=this;for(var _0x546d1b in _0x4db5d0){if(typeof _0x4db5d0[_0x546d1b]!==_0x4351('0x98')){this[_0x4351('0x1b')][_0x4351('0x18')](function(){if(!_[_0x4351('0xac')](_0x4db5d0[_0x546d1b])){return ami[_0x4351('0xad')]({'action':_0x4351('0xae'),'channel':_0x4db5d0[_0x546d1b][_0x4351('0xaf')]})[_0x4351('0xb0')](function(_0x557704){if(_0x557704['message']===_0x4351('0xb1')){setTimeout(function(){if(_0x4db5d0[_0x546d1b]&&_0x4db5d0[_0x546d1b]['type']!=='ivr'){_0x375bf3['updateOriginated'](_0x375bf3[_0x4351('0x1c')][_0x4db5d0[_0x546d1b][_0x4351('0xb2')]]);logger[_0x4351('0x94')](_0x4351('0xb3'),_0x350208,_0x546d1b,_0x4db5d0[_0x546d1b][_0x4351('0xb2')]);delete _0x4db5d0[_0x546d1b];}if(_0x4db5d0[_0x546d1b]&&_0x4db5d0[_0x546d1b][_0x4351('0x4e')]===_0x4351('0x90')){_0x375bf3[_0x4351('0xb4')](_0x375bf3[_0x4351('0x1d')][_0x4db5d0[_0x546d1b][_0x4351('0xb2')]]);logger['error'](_0x4351('0xb5'),_0x350208,_0x546d1b,_0x4db5d0[_0x546d1b][_0x4351('0xb2')]);delete _0x4db5d0[_0x546d1b];}},0x2328);}});}});}}};Dialer[_0x4351('0x17')][_0x4351('0xb6')]=function(_0x5df659){return BPromise[_0x4351('0xb7')]()[_0x4351('0xb8')](cmHopper[_0x4351('0xb6')](_0x5df659))[_0x4351('0xb0')](loggerCatch(_0x4351('0xb9')));};Dialer['prototype'][_0x4351('0xba')]=function(_0xac14ac){return BPromise[_0x4351('0xb7')]()[_0x4351('0xb8')](cmHopperBlack[_0x4351('0xba')](_0xac14ac))[_0x4351('0xb0')](loggerCatch('[checkIsBlackList]\x20'));};Dialer['prototype'][_0x4351('0xbb')]=function(_0x15e094){return BPromise[_0x4351('0xb7')]()[_0x4351('0xb8')](cmHopperBlack['checkIsBlackListIvr'](_0x15e094))[_0x4351('0xb0')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x4351('0x17')][_0x4351('0xbc')]=function(_0x309028){return BPromise[_0x4351('0xb7')]()['then'](cmHopperHistory['avgHandleTime'](_0x309028))[_0x4351('0xb0')](loggerCatch(_0x4351('0xbd')));};Dialer[_0x4351('0x17')][_0x4351('0xbe')]=function(_0x4ddd75){return BPromise['resolve']()['then'](cmHopper[_0x4351('0xbe')](_0x4ddd75))[_0x4351('0xb0')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x4351('0x17')][_0x4351('0xbf')]=function(_0x1e4285,_0x56279c,_0x3efb0b){return BPromise[_0x4351('0xb7')]()['then'](cmHopper[_0x4351('0xbf')](_0x1e4285,_0x56279c,_0x3efb0b))[_0x4351('0xb0')](loggerCatch(_0x4351('0xc0')));};Dialer[_0x4351('0x17')][_0x4351('0xc1')]=function(_0xbf0955,_0x5baeee,_0xcde75c,_0x464f8b){return BPromise[_0x4351('0xb7')]()[_0x4351('0xb8')](cmHopper[_0x4351('0xc1')](_0xbf0955,_0x5baeee,_0xcde75c,_0x464f8b))[_0x4351('0xb0')](loggerCatch(_0x4351('0xc2')));};Dialer[_0x4351('0x17')]['getContactDialerIvr']=function(_0x44d28a,_0x3cd92f,_0x5e4039){return BPromise['resolve']()[_0x4351('0xb8')](cmHopper['getContactDialerIvr'](_0x44d28a,_0x3cd92f,_0x5e4039))[_0x4351('0xb0')](loggerCatch(_0x4351('0xc2')));};Dialer[_0x4351('0x17')][_0x4351('0xc3')]=function(_0x59b30d){return BPromise[_0x4351('0xb7')]()[_0x4351('0xb8')](voiceQueueRt[_0x4351('0xc3')](_0x59b30d))[_0x4351('0xb0')](loggerCatch(_0x4351('0xc4')));};Dialer[_0x4351('0x17')]['moveContactManagedDialer']=function(_0x3b71e4){return BPromise[_0x4351('0xb7')]()[_0x4351('0xb8')](cmHopper[_0x4351('0xc5')](_0x3b71e4))[_0x4351('0xb0')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x4351('0x17')][_0x4351('0xc6')]=function(_0x542b89){return BPromise['resolve']()[_0x4351('0xb8')](cmHopperHistory['createHistory'](_0x542b89))[_0x4351('0xb0')](loggerCatch('[createHistory]\x20'));};Dialer[_0x4351('0x17')][_0x4351('0xb4')]=function(_0x5076fe){if(!_[_0x4351('0x81')](_0x5076fe)&&_0x5076fe!==null){if(typeof _0x5076fe[_0x4351('0x6c')]!==_0x4351('0x98')){if(_0x5076fe['originated']>0x0){_0x5076fe[_0x4351('0x6c')]-=0x1;}else{logger[_0x4351('0x94')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x4351('0x94')](_0x4351('0xc7'));}};Dialer[_0x4351('0x17')]['loggerHandler']=function(_0x5f9b7f,_0x5a4030){var _0x5c81b2=this;return function(_0x36e7be){_0x5c81b2[_0x4351('0xb4')](_0x5a4030);logger['error'](_0x5f9b7f,util[_0x4351('0x95')](_0x36e7be,{'showHidden':![],'depth':null}));};};Dialer[_0x4351('0x17')][_0x4351('0xc8')]=function(_0x21ab7a,_0x54fc8d,_0x1149ad){var _0x5ed066={'state':0x19,'statedesc':_0x4351('0xc9')};this[_0x4351('0xb4')](_0x54fc8d);this[_0x4351('0xca')](_['merge'](_0x5ed066,_['pick'](_0x1149ad,['ContactId','ListId',_0x4351('0xcb'),_0x4351('0xcc'),_0x4351('0xcd')])),'[emptyContact][createHistory]','[emptyContact]');logger[_0x4351('0x94')](_0x21ab7a);};Dialer[_0x4351('0x17')][_0x4351('0xce')]=function(_0x39c373){return _0x39c373===_0x4351('0xcf');};Dialer['prototype'][_0x4351('0xd0')]=function(_0x3b0a30){return!_[_0x4351('0x81')](_0x3b0a30)&&_0x3b0a30&&!_['isUndefined'](_0x3b0a30['name'])&&!_[_0x4351('0x81')](_0x3b0a30[_0x4351('0xd1')])&&_0x3b0a30[_0x4351('0xd1')]&&(this[_0x4351('0x1f')][util[_0x4351('0x73')](_0x4351('0xd2'),_0x3b0a30[_0x4351('0x3b')])]['status']===_0x4351('0xd3')||this[_0x4351('0x1f')][util[_0x4351('0x73')](_0x4351('0xd2'),_0x3b0a30[_0x4351('0x3b')])]['status']===_0x4351('0xd4'));};Dialer[_0x4351('0x17')][_0x4351('0xca')]=function(_0x4dfc29,_0x35c464,_0x24202e){this[_0x4351('0xc6')](_0x4dfc29)['catch'](loggerCatch(_0x35c464));this[_0x4351('0xc5')](_0x4dfc29)[_0x4351('0xb0')](loggerCatch(_0x24202e));};Dialer[_0x4351('0x17')]['syncVarSet']=function(_0x1e1ed4){var _0x163250=this[_0x4351('0x23')][_0x1e1ed4[_0x4351('0xd5')]];var _0x5082ea;if(!_['isNil'](_0x1e1ed4)&&!_[_0x4351('0xac')](_0x1e1ed4[_0x4351('0xd6')])&&!_[_0x4351('0xac')](_0x1e1ed4[_0x4351('0xd6')][_0x4351('0xd7')])&&_0x1e1ed4[_0x4351('0xd8')]===_0x4351('0xd9')&&_0x163250){if(_0x163250[_0x4351('0x4e')]!==_0x4351('0x90')&&this[_0x4351('0x1c')][_0x163250[_0x4351('0xb2')]]['dialAMDActive']&&_0x1e1ed4['value']===_0x4351('0xda')){delete this[_0x4351('0x23')][_0x1e1ed4['uniqueid']];this[_0x4351('0xb4')](this[_0x4351('0x1c')][_0x163250[_0x4351('0xb2')]]);this[_0x4351('0x1c')][_0x163250[_0x4351('0xb2')]][_0x4351('0x58')]+=0x1;this[_0x4351('0x1c')][_0x163250['queue']][_0x4351('0x57')]+=0x1;_0x5082ea=new Hangup(_0x163250,_0x1e1ed4);_0x5082ea[_0x4351('0xa5')]=0x12;_0x5082ea['statedesc']='HangupInAMD';_0x5082ea[_0x4351('0xdb')]=_0x4351('0xdc');this['saveInDb'](_0x5082ea,'[syncHangupInAMD][createHistory]',_0x4351('0xdd'));}if(_0x163250[_0x4351('0x4e')]!==_0x4351('0x90')&&this[_0x4351('0x1c')][_0x163250['queue']][_0x4351('0xde')]&&_0x1e1ed4[_0x4351('0xdf')]===_0x4351('0xe0')){var _0x190956=this;return new BPromise(function(_0x23285b,_0x173139){delete _0x190956[_0x4351('0x23')][_0x1e1ed4[_0x4351('0xd5')]];_0x190956[_0x4351('0xb4')](_0x190956[_0x4351('0x1c')][_0x163250[_0x4351('0xb2')]]);_0x190956[_0x4351('0x1c')][_0x163250[_0x4351('0xb2')]][_0x4351('0x58')]+=0x1;_0x190956['voiceQueues'][_0x163250[_0x4351('0xb2')]][_0x4351('0x57')]+=0x1;var _0x5b99a1=_0x190956['voiceQueues'][_0x163250[_0x4351('0xb2')]];var _0x4f0d1d=new Hangup(_0x163250,_0x1e1ed4);_0x4f0d1d[_0x4351('0xa5')]=0x13;_0x4f0d1d[_0x4351('0xa6')]='Machine';_0x4f0d1d['membername']=_0x4351('0xdc');_0x4f0d1d[_0x4351('0xe1')]+=0x1;_0x4f0d1d[_0x4351('0xe2')]+=0x1;_0x4f0d1d[_0x4351('0xe3')]=!![];_0x190956[_0x4351('0xc6')](_0x4f0d1d)[_0x4351('0xb0')](loggerCatch(_0x4351('0xe4')));if(_0x4f0d1d[_0x4351('0xe5')]+_0x4f0d1d['countcongestionretry']+_0x4f0d1d[_0x4351('0xe6')]+_0x4f0d1d[_0x4351('0xe7')]+_0x4f0d1d[_0x4351('0xe8')]+_0x4f0d1d[_0x4351('0xe9')]+_0x4f0d1d[_0x4351('0xe1')]+_0x4f0d1d['countagentrejectretry']>=_0x5b99a1[_0x4351('0xea')]){_0x190956['stateGlobal'](_0x4f0d1d,_0x23285b,_0x173139,_0x4351('0xeb'));}else{if(_0x4f0d1d['countmachineretry']>=_0x5b99a1['dialMachineMaxRetry']){_0x190956['createStateFinal'](_0x4f0d1d,_0x23285b,_0x173139,_0x4351('0xec'));}else{_0x190956[_0x4351('0xbe')]({'active':![],'countmachineretry':_0x4f0d1d['countmachineretry'],'scheduledat':moment()[_0x4351('0xed')](_0x5b99a1[_0x4351('0xee')],'minutes')['format'](_0x4351('0xef')),'ContactId':_0x4f0d1d[_0x4351('0xf0')],'ListId':_0x4f0d1d[_0x4351('0xf1')],'VoiceQueueId':_0x4f0d1d['VoiceQueueId']||undefined,'CampaignId':_0x4f0d1d[_0x4351('0xcd')]||undefined})[_0x4351('0xb0')](loggerCatch(_0x4351('0xf2')));_0x23285b({'reschedule':0x1});}}});}if(_0x163250['type']===_0x4351('0x90')&&this[_0x4351('0x1d')][_0x163250['queue']]['dialAMDActive']&&_0x1e1ed4[_0x4351('0xdf')]===_0x4351('0xda')){delete this[_0x4351('0x23')][_0x1e1ed4['uniqueid']];this[_0x4351('0xb4')](this[_0x4351('0x1d')][_0x163250[_0x4351('0xb2')]]);_0x5082ea=new Hangup(_0x163250,_0x1e1ed4);_0x5082ea[_0x4351('0xa5')]=0x12;_0x5082ea[_0x4351('0xa6')]=_0x4351('0xf3');_0x5082ea[_0x4351('0xdb')]=_0x4351('0xdc');this[_0x4351('0xca')](_0x5082ea,_0x4351('0xf4'),_0x4351('0xf5'));}if(_0x163250['type']===_0x4351('0x90')&&this['campaigns'][_0x163250[_0x4351('0xb2')]]['dialAMDActive']&&_0x1e1ed4['value']==='MACHINE'){var _0x190956=this;return new BPromise(function(_0x432e4f,_0x24bb1){delete _0x190956['uniqueId'][_0x1e1ed4[_0x4351('0xd5')]];_0x190956[_0x4351('0xb4')](_0x190956[_0x4351('0x1d')][_0x163250[_0x4351('0xb2')]]);_0x190956[_0x4351('0x1d')][_0x163250['queue']][_0x4351('0x58')]+=0x1;_0x190956[_0x4351('0x1d')][_0x163250[_0x4351('0xb2')]][_0x4351('0x57')]+=0x1;var _0x481d92=_0x190956[_0x4351('0x1d')][_0x163250[_0x4351('0xb2')]];var _0x8343bb=new Hangup(_0x163250,_0x1e1ed4);_0x8343bb[_0x4351('0xa5')]=0x13;_0x8343bb['statedesc']='Machine';_0x8343bb[_0x4351('0xdb')]=_0x4351('0xdc');_0x8343bb[_0x4351('0xe1')]+=0x1;_0x8343bb[_0x4351('0xe2')]+=0x1;_0x8343bb[_0x4351('0xe3')]=!![];_0x190956['createHistory'](_0x8343bb)['catch'](loggerCatch(_0x4351('0xe4')));if(_0x8343bb[_0x4351('0xe5')]+_0x8343bb[_0x4351('0xf6')]+_0x8343bb['countnoanswerretry']+_0x8343bb[_0x4351('0xe7')]+_0x8343bb[_0x4351('0xe8')]+_0x8343bb[_0x4351('0xe9')]+_0x8343bb[_0x4351('0xe1')]+_0x8343bb[_0x4351('0xf7')]>=_0x481d92[_0x4351('0xea')]){_0x190956[_0x4351('0xf8')](_0x8343bb,_0x432e4f,_0x24bb1,_0x4351('0xeb'));}else{if(_0x8343bb[_0x4351('0xe1')]>=_0x481d92[_0x4351('0xf9')]){_0x190956[_0x4351('0xfa')](_0x8343bb,_0x432e4f,_0x24bb1,_0x4351('0xec'));}else{_0x190956[_0x4351('0xbe')]({'active':![],'countmachineretry':_0x8343bb['countmachineretry'],'scheduledat':moment()[_0x4351('0xed')](_0x481d92[_0x4351('0xee')],_0x4351('0xfb'))[_0x4351('0x73')](_0x4351('0xef')),'ContactId':_0x8343bb[_0x4351('0xf0')],'ListId':_0x8343bb[_0x4351('0xf1')],'VoiceQueueId':_0x8343bb[_0x4351('0xcc')]||undefined,'CampaignId':_0x8343bb['CampaignId']||undefined})[_0x4351('0xb0')](loggerCatch('[rescheduleContact][Machine]'));_0x432e4f({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x4351('0x32')]=function(_0x5a15fb){var _0x37d56e=this['uniqueId'][_0x5a15fb['uniqueid']];var _0x2e3fc6=this;var _0x284a34;if(_0x37d56e&&_0x37d56e[_0x4351('0x4e')]===_0x4351('0x90')){delete this[_0x4351('0x23')][_0x5a15fb['uniqueid']];this[_0x4351('0xb4')](this['campaigns'][_0x37d56e[_0x4351('0xb2')]]);this[_0x4351('0x1d')][_0x37d56e[_0x4351('0xb2')]]['ivrAnswerCallsDay']+=0x1;_0x284a34=new Hangup(_0x37d56e,_0x5a15fb);this[_0x4351('0xc6')](_0x284a34)[_0x4351('0xb0')](loggerCatch(_0x4351('0xfc')));this[_0x4351('0xc5')](_0x284a34)[_0x4351('0xb0')](loggerCatch(_0x4351('0xfd')));}if(_0x37d56e&&_0x37d56e[_0x4351('0x4e')]!==_0x4351('0x90')&&isNotNull(this[_0x4351('0x1c')][_0x37d56e[_0x4351('0xb2')]][_0x4351('0xfe')])){delete this[_0x4351('0x23')][_0x5a15fb[_0x4351('0xd5')]];this[_0x4351('0xb4')](this[_0x4351('0x1c')][_0x37d56e[_0x4351('0xb2')]]);this[_0x4351('0x1c')][_0x37d56e['queue']][_0x4351('0x58')]+=0x1;this[_0x4351('0x1c')][_0x37d56e[_0x4351('0xb2')]][_0x4351('0x57')]+=0x1;_0x284a34=new Hangup(_0x37d56e,_0x5a15fb);_0x284a34[_0x4351('0xa5')]=0x10;_0x284a34[_0x4351('0xa6')]=_0x4351('0xff');_0x284a34['membername']=_0x4351('0x100');this['createHistory'](_0x284a34)['catch'](loggerCatch(_0x4351('0xfc')));this[_0x4351('0xc5')](_0x284a34)[_0x4351('0xb0')](loggerCatch(_0x4351('0xfd')));}if(_0x37d56e&&_0x37d56e[_0x4351('0x4e')]!==_0x4351('0x90')&&!isNotNull(this['voiceQueues'][_0x37d56e['queue']][_0x4351('0xfe')])){delete this[_0x4351('0x23')][_0x5a15fb['uniqueid']];this[_0x4351('0xb4')](this['voiceQueues'][_0x37d56e['queue']]);this[_0x4351('0x1c')][_0x37d56e['queue']][_0x4351('0x61')]+=0x1;_0x284a34=new Hangup(_0x37d56e,_0x5a15fb);_0x284a34[_0x4351('0xa5')]=0xc;_0x284a34[_0x4351('0xa6')]=_0x5a15fb[_0x4351('0x101')];_0x284a34[_0x4351('0xdb')]=_0x4351('0x102');this['createHistory'](_0x284a34)[_0x4351('0xb0')](loggerCatch(_0x4351('0xfc')));this['moveContactManagedDialer'](_0x284a34)[_0x4351('0xb0')](loggerCatch('[syncHangupIvr]'));}};Dialer['prototype'][_0x4351('0x2e')]=function(_0x3a8b40){var _0x19f414=this[_0x4351('0x23')][_0x3a8b40[_0x4351('0xd5')]];var _0x20160d=this;if(this[_0x4351('0x1c')][_0x3a8b40[_0x4351('0xb2')]]){if(_0x19f414&&_0x19f414[_0x4351('0x4e')]!==_0x4351('0x90')){delete this[_0x4351('0x23')][_0x3a8b40[_0x4351('0xd5')]];this['voiceQueues'][_0x3a8b40[_0x4351('0xb2')]][_0x4351('0x58')]+=0x1;var _0x143e7e=new AgentComplete(_0x19f414,_0x3a8b40);if(_0x3a8b40[_0x4351('0x103')]===_0x4351('0x104')){_0x143e7e[_0x4351('0x105')]=this[_0x4351('0x1c')][_0x3a8b40[_0x4351('0xb2')]][_0x4351('0x106')]&&this[_0x4351('0x1c')][_0x3a8b40[_0x4351('0xb2')]]['dialAgiAfterHangupAgent']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x4351('0xc6')](_0x143e7e)['catch'](loggerCatch(_0x4351('0x107')));this['moveContactManagedDialer'](_0x143e7e)[_0x4351('0xb0')](loggerCatch(_0x4351('0x108')));}}};Dialer[_0x4351('0x17')][_0x4351('0x27')]=function(_0x5a5c89){if(this['voiceQueues'][_0x5a5c89['queue']]){if(this[_0x4351('0x23')][_0x5a5c89[_0x4351('0xd5')]]&&this[_0x4351('0x23')][_0x5a5c89[_0x4351('0xd5')]][_0x4351('0x4e')]!=='ivr'){this[_0x4351('0xb4')](this[_0x4351('0x1c')][_0x5a5c89[_0x4351('0xb2')]]);this[_0x4351('0x23')][_0x5a5c89[_0x4351('0xd5')]][_0x4351('0x109')]=moment()[_0x4351('0x73')](_0x4351('0xef'));}}};Dialer[_0x4351('0x17')]['queueCallerAbandonCreateState']=function(_0x1c7c32){this[_0x4351('0xc6')](_0x1c7c32)[_0x4351('0xb0')](loggerCatch(_0x4351('0x107')));this['moveContactManagedDialer'](_0x1c7c32)[_0x4351('0xb0')](loggerCatch(_0x4351('0x10a')));};Dialer[_0x4351('0x17')][_0x4351('0x2a')]=function(_0x51c4f9){var _0x33ccf5=this[_0x4351('0x23')][_0x51c4f9[_0x4351('0xd5')]];var _0x4b9a08=this;if(this[_0x4351('0x1c')][_0x51c4f9['queue']]){if(_0x33ccf5&&_0x33ccf5['type']!=='ivr'){delete this[_0x4351('0x23')][_0x51c4f9[_0x4351('0xd5')]];this[_0x4351('0xb4')](this['voiceQueues'][_0x51c4f9[_0x4351('0xb2')]]);_0x33ccf5[_0x4351('0x10b')]=moment()[_0x4351('0x73')](_0x4351('0xef'));var _0x34f3dc=new QueueCallerAbandon(_0x33ccf5,_0x51c4f9);if(getSeconds(_0x33ccf5[_0x4351('0x10b')],_0x33ccf5[_0x4351('0x10c')])>=_0x33ccf5['dialQueueTimeout']){this[_0x4351('0x1c')][_0x51c4f9[_0x4351('0xb2')]][_0x4351('0x66')]+=0x1;this['voiceQueues'][_0x51c4f9[_0x4351('0xb2')]][_0x4351('0x5c')]+=0x1;this[_0x4351('0x1c')][_0x51c4f9['queue']][_0x4351('0x10d')]+=0x1;_0x34f3dc[_0x4351('0xa5')]=0xa;_0x34f3dc[_0x4351('0xa6')]=_0x4351('0x10e');_0x34f3dc[_0x4351('0x10f')]=_0x4351('0x110');_0x34f3dc[_0x4351('0x105')]=this[_0x4351('0x1c')][_0x51c4f9[_0x4351('0xb2')]][_0x4351('0x106')]?moment()['format'](_0x4351('0xef')):undefined;_0x34f3dc[_0x4351('0xe8')]+=0x1;_0x34f3dc[_0x4351('0xe2')]+=0x1;if(_0x34f3dc[_0x4351('0xe8')]>=this['voiceQueues'][_0x51c4f9[_0x4351('0xb2')]]['dialDropMaxRetry']){this[_0x4351('0x111')](_0x34f3dc);}else{this[_0x4351('0xbe')]({'active':![],'countdropretry':_0x34f3dc['countdropretry'],'scheduledat':moment()[_0x4351('0xed')](this['voiceQueues'][_0x51c4f9['queue']][_0x4351('0x112')],_0x4351('0xfb'))[_0x4351('0x73')](_0x4351('0xef')),'ContactId':_0x33ccf5[_0x4351('0xf0')],'ListId':_0x33ccf5[_0x4351('0xf1')],'VoiceQueueId':_0x33ccf5['VoiceQueueId']||undefined,'CampaignId':_0x33ccf5[_0x4351('0xcd')]||undefined})[_0x4351('0xb0')](loggerCatch(_0x4351('0x113')));var _0x490b00=new History(_0x34f3dc);_0x490b00[_0x4351('0xa5')]=0xa;_0x490b00['statedesc']=_0x4351('0x10e');_0x490b00[_0x4351('0xa7')]=moment()[_0x4351('0x73')](_0x4351('0xef'));_0x490b00[_0x4351('0x114')]=_0x490b00[_0x4351('0xa7')];_0x490b00['calleridname']=_0x34f3dc[_0x4351('0x115')];_0x490b00[_0x4351('0x116')]=_0x34f3dc['calleridnum'];this[_0x4351('0xc6')](_0x490b00)[_0x4351('0xb0')](loggerCatch(_0x4351('0x117')));}}else{this[_0x4351('0x1c')][_0x51c4f9[_0x4351('0xb2')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x4351('0x1c')][_0x51c4f9[_0x4351('0xb2')]][_0x4351('0x118')]+=0x1;_0x34f3dc[_0x4351('0xa5')]=0xb;_0x34f3dc['statedesc']='Abandoned';_0x34f3dc['dropreason']=_0x4351('0x119');_0x34f3dc['countabandonedretry']+=0x1;_0x34f3dc[_0x4351('0xe2')]+=0x1;if(_0x34f3dc[_0x4351('0xe9')]>=this[_0x4351('0x1c')][_0x51c4f9[_0x4351('0xb2')]][_0x4351('0x11a')]){this['queueCallerAbandonCreateState'](_0x34f3dc);}else{this[_0x4351('0xbe')]({'active':![],'countabandonedretry':_0x34f3dc[_0x4351('0xe9')],'scheduledat':moment()['add'](this[_0x4351('0x1c')][_0x51c4f9[_0x4351('0xb2')]]['dialAbandonedRetryFrequency'],'minutes')[_0x4351('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x33ccf5[_0x4351('0xf0')],'ListId':_0x33ccf5[_0x4351('0xf1')],'VoiceQueueId':_0x33ccf5[_0x4351('0xcc')]||undefined,'CampaignId':_0x33ccf5[_0x4351('0xcd')]||undefined})[_0x4351('0xb0')](loggerCatch(_0x4351('0x11b')));var _0x490b00=new History(_0x34f3dc);_0x490b00[_0x4351('0xa5')]=0xb;_0x490b00[_0x4351('0xa6')]=_0x4351('0x11c');_0x490b00[_0x4351('0xa7')]=moment()[_0x4351('0x73')](_0x4351('0xef'));_0x490b00[_0x4351('0x114')]=_0x490b00['starttime'];_0x490b00[_0x4351('0x115')]=_0x34f3dc[_0x4351('0x115')];_0x490b00[_0x4351('0x116')]=_0x34f3dc[_0x4351('0x116')];this['createHistory'](_0x490b00)[_0x4351('0xb0')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x4351('0x17')][_0x4351('0x34')]=function(_0x1a2b80){if(this[_0x4351('0xaa')][_0x1a2b80[_0x4351('0xd5')]]){this[_0x4351('0xaa')][_0x1a2b80['uniqueid']]['channel']=_0x1a2b80['channel'];}if(this[_0x4351('0x23')][_0x1a2b80[_0x4351('0xd5')]]){this[_0x4351('0x23')][_0x1a2b80[_0x4351('0xd5')]][_0x4351('0xaf')]=_0x1a2b80[_0x4351('0xaf')];}};Dialer[_0x4351('0x17')][_0x4351('0x11d')]=function(_0x4c0955){if(strategy[this[_0x4351('0x1c')][this[_0x4351('0xaa')][_0x4c0955[_0x4351('0x11e')]][_0x4351('0xb2')]][_0x4351('0x11f')]]===_0x4351('0x16')){if(this[_0x4351('0xaa')][_0x4c0955[_0x4351('0x11e')]]&&_[_0x4351('0xac')](this[_0x4351('0xaa')][_0x4c0955[_0x4351('0x11e')]][_0x4351('0x120')])&&_0x4c0955[_0x4351('0xae')]==='1'&&_0x4c0955['paused']==='0'){if(this[_0x4351('0x1e')][_0x4c0955[_0x4351('0x121')]]){if(!this[_0x4351('0x1e')][_0x4c0955[_0x4351('0x121')]][_0x4351('0x120')]){this[_0x4351('0x1e')][_0x4c0955[_0x4351('0x121')]][_0x4351('0x120')]=!![];this['actions'][_0x4c0955['actionid']][_0x4351('0x120')]=!![];this[_0x4351('0xaa')][_0x4c0955[_0x4351('0x11e')]]['stateinterface']=_0x4c0955[_0x4351('0x121')];}}}}else if((strategy[this['voiceQueues'][this[_0x4351('0xaa')][_0x4c0955[_0x4351('0x11e')]][_0x4351('0xb2')]][_0x4351('0x11f')]]||_0x4351('0x15'))==='rrmemory'){if(this[_0x4351('0xaa')][_0x4c0955[_0x4351('0x11e')]]){if(this[_0x4351('0x1e')][_0x4c0955[_0x4351('0x121')]]){this[_0x4351('0xaa')][_0x4c0955[_0x4351('0x11e')]]['stateinterface']=_0x4c0955['stateinterface'];if(_[_0x4351('0xac')](this[_0x4351('0x122')][this[_0x4351('0xaa')][_0x4c0955['actionid']][_0x4351('0xb2')]])){this[_0x4351('0x122')][this['actions'][_0x4c0955[_0x4351('0x11e')]][_0x4351('0xb2')]]=[];}this[_0x4351('0x122')][this[_0x4351('0xaa')][_0x4c0955[_0x4351('0x11e')]][_0x4351('0xb2')]]['push'](_[_0x4351('0x89')](_[_0x4351('0x123')](this[_0x4351('0xaa')][_0x4c0955[_0x4351('0x11e')]],[_0x4351('0x124'),_0x4351('0x121')]),{'status':_0x4c0955['status'],'paused':_0x4c0955[_0x4351('0x125')]}));}}}};function unlockQueueStatus(_0x3c9b3c,_0x315938){setTimeout(function(){if(_['isUndefined'](_0x3c9b3c[_0x4351('0x126')])){loggerBooked['error'](_0x4351('0x127'),_0x315938);}_0x3c9b3c[_0x4351('0x126')]=!![];loggerBooked['info'](_0x4351('0x128'),_0x315938,JSON[_0x4351('0x43')](_[_0x4351('0x123')](_0x3c9b3c,[_0x4351('0x3b'),_0x4351('0x126')])));},0x1f3);}Dialer['prototype'][_0x4351('0x129')]=function(_0x54fe64){var _0x59f7db=this;var _0x3c7065=_0x59f7db[_0x4351('0x1c')][_0x59f7db[_0x4351('0xaa')][_0x54fe64['actionid']][_0x4351('0xb2')]];if(strategy[this[_0x4351('0x1c')][this[_0x4351('0xaa')][_0x54fe64['actionid']][_0x4351('0xb2')]][_0x4351('0x11f')]]==='roundrobin'){if(this[_0x4351('0xaa')][_0x54fe64['actionid']]&&this['actions'][_0x54fe64['actionid']]['stateinterface']){this['preview'][_0x4351('0x12a')](this[_0x4351('0xaa')][_0x54fe64[_0x4351('0x11e')]][_0x4351('0x124')],this['actions'][_0x54fe64['actionid']][_0x4351('0x121')])[_0x4351('0xb0')](function(_0x58093a){logger['error'](_0x4351('0x12b'),util[_0x4351('0x95')](_0x58093a,{'showHidden':![],'depth':null}));})[_0x4351('0x1a')](function(){_0x59f7db['updateOriginated'](_0x59f7db[_0x4351('0x1c')][_0x59f7db[_0x4351('0xaa')][_0x54fe64['actionid']]['queue']]);_0x59f7db[_0x4351('0x1e')][_0x59f7db[_0x4351('0xaa')][_0x54fe64[_0x4351('0x11e')]][_0x4351('0x121')]][_0x4351('0x120')]=![];delete _0x59f7db[_0x4351('0xaa')][_0x54fe64[_0x4351('0x11e')]];unlockQueueStatus(_0x3c7065);});}else{this[_0x4351('0xb4')](this[_0x4351('0x1c')][this['actions'][_0x54fe64['actionid']][_0x4351('0xb2')]]);this[_0x4351('0xbe')]({'active':![],'ContactId':this[_0x4351('0xaa')][_0x54fe64['actionid']][_0x4351('0xf0')],'ListId':this[_0x4351('0xaa')][_0x54fe64['actionid']][_0x4351('0xf1')],'VoiceQueueId':this['actions'][_0x54fe64[_0x4351('0x11e')]]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x54fe64['actionid']][_0x4351('0xcd')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x54fe64[_0x4351('0x11e')]];unlockQueueStatus(_0x3c7065);}}else if((strategy[this[_0x4351('0x1c')][this[_0x4351('0xaa')][_0x54fe64['actionid']][_0x4351('0xb2')]][_0x4351('0x11f')]]||_0x4351('0x15'))===_0x4351('0x15')){var _0x114177;if(this['actions'][_0x54fe64[_0x4351('0x11e')]]&&!_[_0x4351('0x78')](this[_0x4351('0x122')][this[_0x4351('0xaa')][_0x54fe64[_0x4351('0x11e')]]['queue']])){if(this[_0x4351('0x26')][_0x59f7db[_0x4351('0xaa')][_0x54fe64['actionid']][_0x4351('0xb2')]]){this[_0x4351('0x26')][_0x59f7db['actions'][_0x54fe64[_0x4351('0x11e')]][_0x4351('0xb2')]]=this['queueBookedRR'][this[_0x4351('0xaa')][_0x54fe64[_0x4351('0x11e')]][_0x4351('0xb2')]]?this[_0x4351('0x26')][this['actions'][_0x54fe64[_0x4351('0x11e')]][_0x4351('0xb2')]]:this['queueBooked'][this[_0x4351('0xaa')][_0x54fe64[_0x4351('0x11e')]]['queue']]?this[_0x4351('0x122')][this[_0x4351('0xaa')][_0x54fe64[_0x4351('0x11e')]][_0x4351('0xb2')]][_0x4351('0x12c')]||0x0:0x0;}this[_0x4351('0x122')][this['actions'][_0x54fe64[_0x4351('0x11e')]][_0x4351('0xb2')]][_0x4351('0x12c')]=this[_0x4351('0x26')][this['actions'][_0x54fe64[_0x4351('0x11e')]]['queue']];for(var _0x54803a=0x0;_0x54803a=0x0;})[_0x4351('0xb0')](myreject(_0x323379)));}}else{_0x2e476c[_0x4351('0x147')](ami[_0x4351('0xad')]({'action':_0x4351('0x148'),'command':util['format'](_0x4351('0x149'),_0x4cfcb2,!_['isUndefined'](config['timezones'][_0x8dc3cc])?_0x8dc3cc:'')})[_0x4351('0xb8')](function(_0x127a67){return _0x127a67['content'][_0x4351('0x14b')](_0x4351('0x14c'))>=0x0;})[_0x4351('0xb0')](myreject(_0x323379)));}BPromise[_0x4351('0x14d')](_0x2e476c)[_0x4351('0xb8')](function(_0x1a38a){var _0x442c3a=_['some'](_0x1a38a);if(_0x442c3a){return _0x1aa46e(_0x442c3a);}else{_0x2e0c8e[_0x4351('0x39')]=_0x265eb0?_0x4351('0x14e'):'INTERVAL_IS_OVERTIME';return _0x323379(msgResponse('[ifTime][promiseAll]',_0x4351('0x142'),_0x4351('0x14f')+_0x265eb0+'\x20'+_0x4d6615+_0x4351('0x150')+util[_0x4351('0x95')](_0x4cfcb2,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x8dc3cc));}})[_0x4351('0xb0')](function(_0x5201c5){return _0x323379(msgResponse(_0x4351('0x141'),_0x4351('0x142'),JSON['stringify'](_0x5201c5)));});});};Dialer[_0x4351('0x17')][_0x4351('0x151')]=function(_0x3f4de3){var _0x46395b=this;return function(){switch(_0x3f4de3[_0x4351('0x52')]){case'progressive':freeVariablesPredictive(_0x3f4de3);_0x46395b[_0x4351('0x152')](_0x3f4de3,0x1);break;case _0x4351('0x153'):freeVariablesPredictive(_0x3f4de3);_0x46395b['handlePower'](_0x3f4de3,_0x3f4de3[_0x4351('0x154')]);break;case'predictive':_0x46395b[_0x4351('0x9')](_0x3f4de3);break;case _0x4351('0x8'):freeVariablesPredictive(_0x3f4de3);_0x46395b[_0x4351('0x152')](_0x3f4de3,0x1);break;default:freeVariablesPredictive(_0x3f4de3);logger[_0x4351('0x94')]('Queue',_0x3f4de3[_0x4351('0x3b')],_0x4351('0x155'));}};};Dialer['prototype'][_0x4351('0x156')]=function(_0x59d9c8){var _0x19a6e5=this;return function(){_0x19a6e5['handleIvr'](_0x59d9c8);};};Dialer['prototype'][_0x4351('0x30')]=function(_0x2acd33){var _0x1140f1=this;if(isNotPreview(_0x2acd33[_0x4351('0x52')])){if(isVoiceQueueOutbound(_0x2acd33[_0x4351('0x4e')])&&isActive(_0x2acd33[_0x4351('0x157')])){_0x2acd33[_0x4351('0x9f')]=!![];BPromise[_0x4351('0xb7')]()[_0x4351('0xb8')](checkIsLoggedIn(_0x2acd33,_0x2acd33[_0x4351('0x49')]))[_0x4351('0xb8')](checkIsActive(_0x2acd33,_0x2acd33[_0x4351('0x157')]))[_0x4351('0xb8')](checkInterval(_0x2acd33))['then'](_0x1140f1[_0x4351('0x13b')](_0x2acd33))[_0x4351('0xb8')](_0x1140f1[_0x4351('0x13f')](_0x2acd33['dialGlobalInterval'],_0x2acd33[_0x4351('0x158')],_0x2acd33[_0x4351('0x3b')],_0x2acd33))[_0x4351('0xb8')](_0x1140f1[_0x4351('0x140')](_0x2acd33[_0x4351('0x3e')],_0x2acd33[_0x4351('0x158')],_0x2acd33[_0x4351('0x3b')],_0x2acd33))[_0x4351('0xb8')](_0x1140f1[_0x4351('0x151')](_0x2acd33))[_0x4351('0xb0')](loggerCatchQueueSummary('[syncQueueSummary]',_0x2acd33));}else{notSendMessagesQueue(_0x2acd33);}}else{freeVariablesPredictive(_0x2acd33);}};Dialer[_0x4351('0x17')][_0x4351('0x13a')]=function(){var _0x4d429b=this;var _0x3b6a48;for(var _0x477e7f in this[_0x4351('0x1d')]){if(typeof this[_0x4351('0x1d')][_0x477e7f]!=='undefined'){_0x3b6a48=this[_0x4351('0x1d')][_0x477e7f];if(isCampaignIvr(_0x3b6a48[_0x4351('0x4e')])&&isActive(_0x3b6a48[_0x4351('0xd1')])){_0x3b6a48[_0x4351('0x9f')]=!![];BPromise[_0x4351('0xb7')]()[_0x4351('0xb8')](checkIsActive(_0x3b6a48,_0x3b6a48[_0x4351('0xd1')]))['then'](checkInterval(_0x3b6a48))[_0x4351('0xb8')](_0x4d429b[_0x4351('0x13b')](_0x3b6a48))[_0x4351('0xb8')](_0x4d429b[_0x4351('0x13f')](_0x3b6a48[_0x4351('0x159')],_0x3b6a48[_0x4351('0x158')],_0x3b6a48[_0x4351('0x3b')],_0x3b6a48))[_0x4351('0xb8')](_0x4d429b[_0x4351('0x140')](_0x3b6a48[_0x4351('0x3e')],_0x3b6a48[_0x4351('0x158')],_0x3b6a48[_0x4351('0x3b')],_0x3b6a48))[_0x4351('0xb8')](_0x4d429b[_0x4351('0x156')](_0x3b6a48))[_0x4351('0xb0')](loggerCatchQueueSummary(_0x4351('0x15a'),_0x3b6a48));}else{notSendMessagesCampaign(_0x3b6a48);}}}};function getCallerIdRandom(_0x1f8f0c,_0x26f4eb){var _0x1ba626;var _0x4117cc;var _0x55754e;if(_0x26f4eb<=0x0){_0x26f4eb=0x1;}_0x1ba626=new RegExp(_0x4351('0x15b')+_0x26f4eb+'}$');_0x4117cc=Math[_0x4351('0x15c')](0xa,_0x26f4eb-0x1);_0x55754e=Math[_0x4351('0x15c')](0xa,_0x26f4eb)-0x1;return util[_0x4351('0x73')]('%s',_[_0x4351('0x15d')](_0x1f8f0c,_0x1ba626,_['random'](_0x4117cc,_0x55754e)));}function extractCalleridName(_0x536492){var _0x5d687f=_0x536492['match'](/"(.*?)"/);return _0x5d687f?_0x5d687f[0x1]:_0x536492;}function extractCalleridNumber(_0x3b8a5c){var _0x318d72=_0x3b8a5c[_0x4351('0x15e')](/<(.*?)>/);return _0x318d72?_0x318d72[0x1]:_0x3b8a5c;}Dialer[_0x4351('0x17')][_0x4351('0x15f')]=function(_0x5eeec3,_0x2e2baa){var _0x3fce87=this;var _0x3f0614=uuid['v4']();this[_0x4351('0xaa')][_0x3f0614]=new Action(_0x5eeec3,_0x2e2baa,_0x3f0614);return new BPromise(function(_0x37b2d0,_0x5e5573){if(_[_0x4351('0x81')](_0x5eeec3)&&typeof _0x5eeec3!==_0x4351('0x160')){return _0x5e5573(msgResponse(_0x4351('0x161'),_0x4351('0x142'),_0x4351('0x162')));}if(_[_0x4351('0x81')](_0x2e2baa[_0x4351('0x163')][_0x4351('0x164')])||_0x2e2baa[_0x4351('0x163')][_0x4351('0x164')]===null){return _0x5e5573(msgResponse(_0x4351('0x161'),_0x4351('0x142'),_0x4351('0x165')));}var _0x3892ce={'XMD-CALLERID':_0x3fce87['actions'][_0x3f0614]['getCaller'](),'XMD-AGI':_0x5eeec3[_0x4351('0xfe')]?util[_0x4351('0x73')](_0x4351('0x166'),ipAgi,_0x5eeec3['dialQueueProject']):_0x4351('0x167'),'XMD-AGIAFTER':_0x5eeec3[_0x4351('0x106')]?util[_0x4351('0x73')](_0x4351('0x166'),ipAgi,_0x5eeec3[_0x4351('0x106')]):'NONE','XMD-QUEUE':_0x5eeec3[_0x4351('0x4e')]===_0x4351('0x46')?util['format'](_0x4351('0x168'),_0x5eeec3[_0x4351('0x3b')],_0x5eeec3[_0x4351('0x169')]||'',_0x5eeec3[_0x4351('0x16a')]?'c':'',_0x5eeec3[_0x4351('0x16b')]||0x3):'NONE','XMD-CONTACTID':_0x2e2baa[_0x4351('0xf0')],'XMD-CDRTYPE':_0x4351('0x7'),'CALLERID(all)':_0x3fce87[_0x4351('0xaa')][_0x3f0614][_0x4351('0x16c')](),'XMD-AMD':_0x5eeec3[_0x4351('0xde')]?_0x4351('0x16d'):_0x4351('0x167'),'XMD-DESTINATION':_0x4351('0xd9')};if(_0x5eeec3[_0x4351('0xde')]){_0x3892ce[_0x4351('0x16e')]=_0x5eeec3['dialAMDInitialSilence']||0x9c4;_0x3892ce[_0x4351('0x16f')]=_0x5eeec3[_0x4351('0x170')]||0x5dc;_0x3892ce[_0x4351('0x171')]=_0x5eeec3[_0x4351('0x172')]||0x320;_0x3892ce[_0x4351('0x173')]=_0x5eeec3[_0x4351('0x174')]||0x1388;_0x3892ce['XMD-AMDMINWORDLENGTH']=_0x5eeec3[_0x4351('0x175')]||0x64;_0x3892ce['XMD-AMDBETWEENWORDSSILENCE']=_0x5eeec3[_0x4351('0x176')]||0x32;_0x3892ce['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x5eeec3[_0x4351('0x177')]||0x3;_0x3892ce[_0x4351('0x178')]=_0x5eeec3[_0x4351('0x179')]||0x100;_0x3892ce[_0x4351('0x17a')]=_0x5eeec3[_0x4351('0x17b')]||0x1388;}if(_0x5eeec3[_0x4351('0x4e')]===_0x4351('0x46')){_0x3892ce[_0x4351('0x17c')]=_0x2e2baa[_0x4351('0xcc')];}else{_0x3892ce['XMD-CAMPAIGNID']=_0x2e2baa[_0x4351('0xcd')];}for(var _0x10ac56 in _0x2e2baa[_0x4351('0x163')]){if(typeof _0x2e2baa[_0x4351('0x163')][_0x10ac56]!==_0x4351('0x98')){if(isNotNull(_0x2e2baa['Contact'][_0x10ac56])&&_0x10ac56!=='id'&&_0x10ac56!=='tags'&&_0x10ac56!==_0x4351('0x17d')&&_0x10ac56!==_0x4351('0x17e')){_0x3892ce[util[_0x4351('0x73')](_0x4351('0x17f'),_0x4351('0x180'),_[_0x4351('0x181')](_0x10ac56))]=_0x2e2baa[_0x4351('0x163')][_0x10ac56];}}}var _0xee907d=_0x3fce87['isTrunkReachable'](_0x5eeec3[_0x4351('0x71')])?getCallerId(_0x5eeec3[_0x4351('0x71')]['callerid'],_0x5eeec3[_0x4351('0x53')],_0x5eeec3['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x5eeec3[_0x4351('0x54')],_0x5eeec3[_0x4351('0x182')]):_0x5eeec3[_0x4351('0x54')]):getCallerId(_[_0x4351('0xac')](_0x5eeec3[_0x4351('0x13c')])?_0x5eeec3[_0x4351('0x71')][_0x4351('0x72')]:_0x5eeec3[_0x4351('0x13c')][_0x4351('0x72')],_0x5eeec3[_0x4351('0x53')],_0x5eeec3['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x5eeec3['dialOriginateCallerIdNumber'],_0x5eeec3[_0x4351('0x182')]):_0x5eeec3['dialOriginateCallerIdNumber']);if(_0xee907d){_0x3892ce[_0x4351('0x183')]=_0x3fce87[_0x4351('0xaa')][_0x3f0614][_0x4351('0x184')]=extractCalleridName(_0xee907d);_0x3892ce[_0x4351('0x185')]=_0x3fce87[_0x4351('0xaa')][_0x3f0614][_0x4351('0x186')]=extractCalleridNumber(_0xee907d);}return ami[_0x4351('0xad')]({'actionid':_0x3f0614,'action':_0x4351('0x161'),'channel':_0x3fce87['isTrunkReachable'](_0x5eeec3[_0x4351('0x71')])?util[_0x4351('0x73')](_0x4351('0x187'),_0x5eeec3[_0x4351('0x71')][_0x4351('0x3b')],isNotNull(_0x5eeec3['dialPrefix'])?_0x5eeec3[_0x4351('0x56')][_0x4351('0x188')]()||'':'',_0x5eeec3[_0x4351('0x189')]>0x0?_0x2e2baa[_0x4351('0x163')][_0x4351('0x164')][_0x4351('0x18a')](_0x5eeec3['dialCutDigit']):_0x2e2baa[_0x4351('0x163')][_0x4351('0x164')]):util[_0x4351('0x73')](_0x4351('0x187'),_['isNil'](_0x5eeec3[_0x4351('0x13c')])?_0x5eeec3[_0x4351('0x71')][_0x4351('0x3b')]:_0x5eeec3[_0x4351('0x13c')]['name'],isNotNull(_0x5eeec3[_0x4351('0x56')])?_0x5eeec3[_0x4351('0x56')][_0x4351('0x188')]()||'':'',_0x5eeec3[_0x4351('0x189')]>0x0?_0x2e2baa[_0x4351('0x163')][_0x4351('0x164')][_0x4351('0x18a')](_0x5eeec3[_0x4351('0x189')]):_0x2e2baa[_0x4351('0x163')][_0x4351('0x164')]),'callerid':_0xee907d,'Exten':_0x4351('0xd9'),'Context':_0x4351('0x18b'),'Priority':'1','variable':_0x3892ce,'timeout':(_0x5eeec3[_0x4351('0x55')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3f0614})[_0x4351('0xb8')](function(_0x80d125){return _0x37b2d0(_0x80d125);})['catch'](function(_0x58b0b0){_0x5eeec3[_0x4351('0x5e')]+=0x1;var _0x1356a6=new History(_0x3fce87[_0x4351('0xaa')][_0x3f0614]);logger[_0x4351('0x94')](util['format'](_0x4351('0x18c'),JSON[_0x4351('0x43')](_0x58b0b0)));_0x1356a6['state']=0xe;_0x1356a6['statedesc']=_0x4351('0x18d');_0x1356a6[_0x4351('0xa7')]=moment()[_0x4351('0x73')](_0x4351('0xef'));_0x1356a6['endtime']=_0x1356a6[_0x4351('0xa7')];_0x3fce87[_0x4351('0xc6')](_0x1356a6)['catch'](loggerCatch('[originate][error]'));_0x3fce87[_0x4351('0xc5')](_0x1356a6)[_0x4351('0xb0')](loggerCatch(_0x4351('0x18e')))[_0x4351('0x1a')](function(){delete _0x3fce87[_0x4351('0xaa')][_0x3f0614];return _0x5e5573(msgResponse(_0x4351('0x161'),_0x4351('0x42'),_0x4351('0x18f')));});});});};Dialer['prototype'][_0x4351('0x2c')]=function(_0x11da55){var _0x358cda=this[_0x4351('0xaa')][_0x11da55[_0x4351('0x11e')]];if(_0x358cda){delete this[_0x4351('0xaa')][_0x11da55[_0x4351('0x11e')]];_0x358cda[_0x4351('0x10c')]=moment()['format'](_0x4351('0xef'));var _0x37417b=_0x358cda[_0x4351('0x4e')]===_0x4351('0x90')?this[_0x4351('0x1d')][_0x358cda[_0x4351('0xb2')]]:this['voiceQueues'][_0x358cda['getQueue']()];if(!this[_0x4351('0xce')](_0x11da55['response'])){this['updateOriginated'](_0x37417b);return this['callProgressDetecting'](_0x358cda,_0x37417b,_0x11da55)['catch'](loggerCatch(_0x4351('0x190')));}this[_0x4351('0x23')][_0x11da55[_0x4351('0xd5')]]=_0x358cda;}};Dialer[_0x4351('0x17')][_0x4351('0x191')]=function(_0x181369,_0x302018,_0x28012e){var _0x410bde=new History(_0x302018);if(_0x410bde['countbusyretry']+_0x410bde[_0x4351('0xf6')]+_0x410bde['countnoanswerretry']+_0x410bde[_0x4351('0xe7')]+_0x410bde[_0x4351('0xe8')]+_0x410bde['countabandonedretry']+_0x410bde['countmachineretry']+_0x410bde['countagentrejectretry']>=_0x28012e[_0x4351('0xea')]-0x1){return!![];}switch(_0x181369){case 0x3:if(_0x410bde[_0x4351('0xe6')]>=_0x28012e[_0x4351('0x192')]-0x1){return!![];}this[_0x4351('0xbe')]({'active':![],'countnoanswerretry':_0x410bde[_0x4351('0xe6')]+=0x1,'scheduledat':moment()[_0x4351('0xed')](_0x28012e[_0x4351('0x193')],_0x4351('0xfb'))[_0x4351('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x410bde[_0x4351('0xf0')],'ListId':_0x410bde['ListId'],'VoiceQueueId':_0x410bde[_0x4351('0xcc')]||undefined,'CampaignId':_0x410bde['CampaignId']||undefined})[_0x4351('0xb0')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x410bde[_0x4351('0xe5')]>=_0x28012e[_0x4351('0x194')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x410bde[_0x4351('0xe5')]+=0x1,'scheduledat':moment()[_0x4351('0xed')](_0x28012e[_0x4351('0x195')],_0x4351('0xfb'))[_0x4351('0x73')](_0x4351('0xef')),'ContactId':_0x410bde['ContactId'],'ListId':_0x410bde['ListId'],'VoiceQueueId':_0x410bde['VoiceQueueId']||undefined,'CampaignId':_0x410bde[_0x4351('0xcd')]||undefined})[_0x4351('0xb0')](loggerCatch(_0x4351('0x196')));break;case 0x8:if(_0x410bde['countcongestionretry']>=_0x28012e[_0x4351('0x197')]-0x1){return!![];}this[_0x4351('0xbe')]({'active':![],'countcongestionretry':_0x410bde[_0x4351('0xf6')]+=0x1,'scheduledat':moment()[_0x4351('0xed')](_0x28012e[_0x4351('0x198')],_0x4351('0xfb'))[_0x4351('0x73')](_0x4351('0xef')),'ContactId':_0x410bde[_0x4351('0xf0')],'ListId':_0x410bde['ListId'],'VoiceQueueId':_0x410bde['VoiceQueueId']||undefined,'CampaignId':_0x410bde['CampaignId']||undefined})[_0x4351('0xb0')](loggerCatch(_0x4351('0x199')));break;case 0x0:if(_0x410bde[_0x4351('0xe7')]>=_0x28012e[_0x4351('0x19a')]-0x1){return!![];}else{this[_0x4351('0xbe')]({'active':![],'countnosuchnumberretry':_0x410bde[_0x4351('0xe7')]+=0x1,'scheduledat':moment()[_0x4351('0xed')](_0x28012e[_0x4351('0x19b')],_0x4351('0xfb'))[_0x4351('0x73')](_0x4351('0xef')),'ContactId':_0x410bde[_0x4351('0xf0')],'ListId':_0x410bde['ListId'],'VoiceQueueId':_0x410bde[_0x4351('0xcc')]||undefined,'CampaignId':_0x410bde[_0x4351('0xcd')]||undefined})[_0x4351('0xb0')](loggerCatch(_0x4351('0x19c')));}break;case 0xa:if(_0x410bde[_0x4351('0xe8')]>=_0x28012e[_0x4351('0x19d')]-0x1){return!![];}this[_0x4351('0xbe')]({'active':![],'countdropretry':_0x410bde['countdropretry']+=0x1,'scheduledat':moment()[_0x4351('0xed')](_0x28012e[_0x4351('0x112')],_0x4351('0xfb'))[_0x4351('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x410bde[_0x4351('0xf0')],'ListId':_0x410bde['ListId'],'VoiceQueueId':_0x410bde[_0x4351('0xcc')]||undefined,'CampaignId':_0x410bde[_0x4351('0xcd')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x410bde[_0x4351('0xe9')]>=_0x28012e[_0x4351('0x11a')]-0x1){return!![];}this[_0x4351('0xbe')]({'active':![],'countabandonedretry':_0x410bde[_0x4351('0xe9')]+=0x1,'scheduledat':moment()['add'](_0x28012e[_0x4351('0x19e')],_0x4351('0xfb'))[_0x4351('0x73')](_0x4351('0xef')),'ContactId':_0x410bde[_0x4351('0xf0')],'ListId':_0x410bde['ListId'],'VoiceQueueId':_0x410bde[_0x4351('0xcc')]||undefined,'CampaignId':_0x410bde[_0x4351('0xcd')]||undefined})[_0x4351('0xb0')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x410bde[_0x4351('0xe1')]>=_0x28012e[_0x4351('0xf9')]-0x1){return!![];}this[_0x4351('0xbe')]({'active':![],'countmachineretry':_0x410bde['countmachineretry']+=0x1,'scheduledat':moment()[_0x4351('0xed')](_0x28012e[_0x4351('0xee')],_0x4351('0xfb'))['format'](_0x4351('0xef')),'ContactId':_0x410bde[_0x4351('0xf0')],'ListId':_0x410bde['ListId'],'VoiceQueueId':_0x410bde[_0x4351('0xcc')]||undefined,'CampaignId':_0x410bde[_0x4351('0xcd')]||undefined})[_0x4351('0xb0')](loggerCatch(_0x4351('0xf2')));break;case 0x14:if(_0x410bde[_0x4351('0xf7')]>=_0x28012e[_0x4351('0x19f')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x410bde[_0x4351('0xf7')]+=0x1,'scheduledat':moment()[_0x4351('0xed')](_0x28012e[_0x4351('0x1a0')],'minutes')[_0x4351('0x73')](_0x4351('0xef')),'ContactId':_0x410bde[_0x4351('0xf0')],'ListId':_0x410bde[_0x4351('0xf1')],'VoiceQueueId':_0x410bde[_0x4351('0xcc')]||undefined,'CampaignId':_0x410bde[_0x4351('0xcd')]||undefined})[_0x4351('0xb0')](loggerCatch(_0x4351('0x1a1')));break;default:return!![];}};Dialer[_0x4351('0x17')][_0x4351('0x1a2')]=function(_0x314bb1,_0x3b9587,_0x4ff721){var _0x34ef94=this;var _0x1cd787=new History(_0x314bb1);return new BPromise(function(_0x39fea9,_0x456db3){if(_[_0x4351('0x81')](_0x3b9587)&&typeof _0x3b9587!==_0x4351('0x160')){return _0x456db3(msgResponse('[callProgressDetecting]',_0x4351('0x142'),_0x4351('0x1a3')));}if(_[_0x4351('0x81')](_0x4ff721)&&typeof _0x4ff721!==_0x4351('0x160')){return _0x456db3(msgResponse('[callProgressDetecting]',_0x4351('0x142'),'evt\x20is\x20undefine'));}switch(_0x4ff721[_0x4351('0x103')]){case'0':_0x3b9587['outboundNoSuchCallsDay']+=0x1;_0x1cd787['state']=0x0;_0x1cd787[_0x4351('0xa6')]=_0x4351('0x1a4');_0x1cd787[_0x4351('0xe7')]+=0x1;_0x1cd787['countglobal']+=0x1;ami[_0x4351('0x45')]('custom:agentnosuchnumber',ut[_0x4351('0x1a5')](_0x314bb1,'nosuchnumber'));_0x34ef94['createHistory'](_0x1cd787)[_0x4351('0xb0')](loggerCatch(_0x4351('0xe4')));if(_0x34ef94['checkRetriveMax'](0x0,_0x314bb1,_0x3b9587)){if(_0x1cd787[_0x4351('0xe7')]>=_0x3b9587[_0x4351('0x19a')]){_0x34ef94['createStateFinal'](_0x1cd787,_0x39fea9,_0x456db3,_0x4351('0x1a6'));}else{_0x34ef94[_0x4351('0xf8')](_0x1cd787,_0x39fea9,_0x456db3,_0x4351('0x1a6'));}}break;case'3':_0x3b9587['outboundNoAnswerCallsDay']+=0x1;_0x1cd787[_0x4351('0xa5')]=0x3;_0x1cd787[_0x4351('0xa6')]=_0x4351('0x1a7');_0x1cd787[_0x4351('0xe6')]+=0x1;_0x1cd787[_0x4351('0xe2')]+=0x1;ami[_0x4351('0x45')](_0x4351('0x1a8'),ut[_0x4351('0x1a5')](_0x314bb1,_0x4351('0x1a9')));_0x34ef94[_0x4351('0xc6')](_0x1cd787)[_0x4351('0xb0')](loggerCatch(_0x4351('0x1aa')));if(_0x34ef94[_0x4351('0x191')](0x3,_0x314bb1,_0x3b9587)){if(_0x1cd787[_0x4351('0xe6')]>=_0x3b9587['dialNoAnswerMaxRetry']){_0x34ef94[_0x4351('0xfa')](_0x1cd787,_0x39fea9,_0x456db3,'reason\x203\x20ringing\x20no\x20answer');}else{_0x34ef94[_0x4351('0xf8')](_0x1cd787,_0x39fea9,_0x456db3,_0x4351('0x1ab'));}}break;case'5':_0x3b9587[_0x4351('0x5a')]+=0x1;_0x1cd787[_0x4351('0xa5')]=0x5;_0x1cd787[_0x4351('0xa6')]='Busy';_0x1cd787['countbusyretry']+=0x1;_0x1cd787[_0x4351('0xe2')]+=0x1;ami[_0x4351('0x45')](_0x4351('0x1ac'),ut[_0x4351('0x1a5')](_0x314bb1,_0x4351('0x1ad')));_0x34ef94[_0x4351('0xc6')](_0x1cd787)[_0x4351('0xb0')](loggerCatch(_0x4351('0x1ae')));if(_0x34ef94[_0x4351('0x191')](0x5,_0x314bb1,_0x3b9587)){if(_0x1cd787['countbusyretry']>=_0x3b9587[_0x4351('0x194')]){_0x34ef94[_0x4351('0xfa')](_0x1cd787,_0x39fea9,_0x456db3,_0x4351('0x1af'));}else{_0x34ef94['stateGlobal'](_0x1cd787,_0x39fea9,_0x456db3,_0x4351('0x1af'));}}break;case'8':_0x3b9587['outboundCongestionCallsDay']+=0x1;_0x1cd787[_0x4351('0xa5')]=0x8;_0x1cd787[_0x4351('0xa6')]=_0x4351('0x1b0');_0x1cd787[_0x4351('0xf6')]+=0x1;_0x1cd787['countglobal']+=0x1;ami['emit']('custom:agentcongestion',ut[_0x4351('0x1a5')](_0x314bb1,_0x4351('0x1b1')));_0x34ef94['createHistory'](_0x1cd787)[_0x4351('0xb0')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x34ef94[_0x4351('0x191')](0x8,_0x314bb1,_0x3b9587)){if(_0x1cd787[_0x4351('0xf6')]>=_0x3b9587['dialCongestionMaxRetry']){_0x34ef94[_0x4351('0xfa')](_0x1cd787,_0x39fea9,_0x456db3,_0x4351('0x1b2'));}else{_0x34ef94[_0x4351('0xf8')](_0x1cd787,_0x39fea9,_0x456db3,_0x4351('0x1b2'));}}break;case'11':_0x3b9587['outboundAbandonedCallsDay']+=0x1;_0x1cd787[_0x4351('0xa5')]=0xb;_0x1cd787[_0x4351('0xa6')]=_0x4351('0x11c');_0x1cd787[_0x4351('0xe9')]+=0x1;_0x1cd787[_0x4351('0xe2')]+=0x1;_0x34ef94[_0x4351('0xc6')](_0x1cd787)[_0x4351('0xb0')](loggerCatch(_0x4351('0x1b3')));if(_0x34ef94[_0x4351('0x191')](0xb,_0x314bb1,_0x3b9587)){if(_0x1cd787['countabandonedretry']>=_0x3b9587[_0x4351('0x11a')]){_0x34ef94[_0x4351('0xfa')](_0x1cd787,_0x39fea9,_0x456db3,_0x4351('0x1b4'));}else{_0x34ef94['stateGlobal'](_0x1cd787,_0x39fea9,_0x456db3,_0x4351('0x1b4'));}}break;case'20':_0x3b9587[_0x4351('0x60')]+=0x1;_0x1cd787['state']=0x14;_0x1cd787[_0x4351('0xa6')]='AgentReject';_0x1cd787[_0x4351('0xf7')]+=0x1;_0x1cd787['countglobal']+=0x1;ami[_0x4351('0x45')](_0x4351('0x1b5'),ut[_0x4351('0x1a5')](_0x314bb1,_0x4351('0x1b6')));_0x34ef94['createHistory'](_0x1cd787)[_0x4351('0xb0')](loggerCatch(_0x4351('0x1b7')));if(_0x34ef94[_0x4351('0x191')](0x14,_0x314bb1,_0x3b9587)){if(_0x1cd787[_0x4351('0xf7')]>=_0x3b9587[_0x4351('0x19f')]){_0x34ef94[_0x4351('0xfa')](_0x1cd787,_0x39fea9,_0x456db3,_0x4351('0x1b8'));}else{_0x34ef94[_0x4351('0xf8')](_0x1cd787,_0x39fea9,_0x456db3,_0x4351('0x1b8'));}}break;default:_0x3b9587[_0x4351('0x61')]+=0x1;_0x1cd787['state']=0xc;_0x1cd787[_0x4351('0xa6')]=_0x4ff721['reason'];_0x34ef94['createHistory'](_0x1cd787)['catch'](loggerCatch(_0x4351('0x1b9')));if(_0x34ef94[_0x4351('0x191')](_0x4ff721[_0x4351('0x103')],_0x314bb1,_0x3b9587)){if(_0x1cd787['countbusyretry']+_0x1cd787[_0x4351('0xf6')]+_0x1cd787['countnoanswerretry']+_0x1cd787[_0x4351('0xe7')]+_0x1cd787['countdropretry']+_0x1cd787[_0x4351('0xe9')]+_0x1cd787[_0x4351('0xe1')]+_0x1cd787['countagentrejectretry']>=_0x3b9587[_0x4351('0xea')]){_0x34ef94[_0x4351('0xf8')](_0x1cd787,_0x39fea9,_0x456db3,_0x4ff721[_0x4351('0x103')]);}else{_0x34ef94[_0x4351('0xfa')](_0x1cd787,_0x39fea9,_0x456db3,_0x4ff721[_0x4351('0x103')]);}}}});};Dialer['prototype'][_0x4351('0xf8')]=function(_0xabf6a8,_0x707793,_0x5d694e,_0x2147d2){var _0x2840fc=new Final(_0xabf6a8);_0x2840fc['state']=0xf;_0x2840fc[_0x4351('0xa6')]='Global';this['createStateFinal'](_0x2840fc,_0x707793,_0x5d694e,_0x2147d2);};Dialer['prototype']['createStateFinal']=function(_0x5687d1,_0x1fb7c7,_0x13392e,_0x5dbdbd){this[_0x4351('0xc5')](_0x5687d1)[_0x4351('0xb8')](function(){return _0x1fb7c7(msgResponse(_0x4351('0x1ba'),'Success',_0x5dbdbd));})[_0x4351('0xb0')](function(){return _0x13392e(msgResponse(_0x4351('0x1bb'),_0x4351('0x142'),_0x4351('0x1bc')));});};Dialer[_0x4351('0x17')][_0x4351('0x9')]=function(_0xd332e9){var _0x6d8904=_0xd332e9[_0x4351('0x1bd')]/0x64;var _0x4815f0=_0xd332e9[_0x4351('0x5c')]/(_0xd332e9[_0x4351('0x5c')]+_0xd332e9[_0x4351('0x58')]);var _0x5193f0=Math[_0x4351('0x1be')](_0xd332e9['predictiveIntervalAvailable']*(_0xd332e9[_0x4351('0x1bf')]/0x64));var _0x351bbd=Math[_0x4351('0x1be')](_0xd332e9['predictiveIntervalAvailable']*(_0xd332e9[_0x4351('0x1c0')]/0x64));var _0x1e71ec=_0xd332e9[_0x4351('0x48')]+_0xd332e9[_0x4351('0xa0')];var _0x27993d=Math[_0x4351('0x1c1')](_0xd332e9[_0x4351('0x6d')]*_0xd332e9[_0x4351('0x6f')]*_0xd332e9[_0x4351('0x68')]*_0xd332e9[_0x4351('0x69')]);if(_[_0x4351('0x81')](_0xd332e9[_0x4351('0x70')])){if(!_['isUndefined'](_0xd332e9[_0x4351('0x25')])){_0xd332e9['startPredictive']=undefined;loggerPredictive[_0x4351('0x94')](_0x4351('0x1c2'),_0x4351('0x1c3'));}if(!_[_0x4351('0x81')](_0xd332e9[_0x4351('0x8e')])){loggerPredictive[_0x4351('0x94')](_0x4351('0x1c2'),_0x4351('0x1c4'));clearInterval(_0xd332e9[_0x4351('0x8e')]);_0xd332e9[_0x4351('0x8e')]=undefined;}_0xd332e9['startProgressive']=moment()[_0x4351('0x73')](_0x4351('0xef'));loggerPredictive[_0x4351('0x79')](_0xd332e9[_0x4351('0x3b')],_0x4351('0x1c5'),_0xd332e9[_0x4351('0x70')]);this[_0x4351('0x152')](_0xd332e9,0x1);}else if(ifInterval(_0xd332e9[_0x4351('0x1c6')],_0xd332e9[_0x4351('0x70')])){this[_0x4351('0x152')](_0xd332e9,0x1);loggerPredictiveCalls[_0x4351('0x79')]('[startMethodPredictive][StartProgressive][Loop]',_0xd332e9[_0x4351('0x70')],_0xd332e9[_0x4351('0x3b')]);_0xd332e9[_0x4351('0x6d')]=0x0;_0xd332e9['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x6d8904<_0x4815f0&&_0xd332e9['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0xd332e9);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x4351('0x1c7'),_0x4815f0,_0x4351('0x70'),_0xd332e9[_0x4351('0x3b')]);}else if(_0x27993d<_0xd332e9[_0x4351('0x10d')]&&_0xd332e9[_0x4351('0x1c8')]===_0x4351('0x1c9')){freeVariablesPredictive(_0xd332e9);loggerPredictive['info'](_0x4351('0x1ca'),_0x4351('0x1cb'),_0x27993d,_0x4351('0x1cc'),_0xd332e9[_0x4351('0x10d')],_0x4351('0x70'),_0xd332e9[_0x4351('0x3b')]);}else if(!ifInterval(_0xd332e9[_0x4351('0x1c6')],_0xd332e9[_0x4351('0x70')])&&_[_0x4351('0x81')](_0xd332e9[_0x4351('0x25')])&&!_[_0x4351('0x81')](_0xd332e9[_0x4351('0x70')])){_0xd332e9[_0x4351('0x25')]=moment()[_0x4351('0x73')](_0x4351('0xef'));loggerPredictive['info'](_0xd332e9['name'],_0x4351('0x1cd'),_0xd332e9[_0x4351('0x25')]);this['averageHandleTime'](_0xd332e9['dialPredictiveInterval'])[_0x4351('0xb8')](this[_0x4351('0x1ce')](_0xd332e9))[_0x4351('0xb8')](mergeDataErlangB(_0xd332e9))[_0x4351('0xb8')](this[_0x4351('0x1cf')](_0xd332e9))['catch'](loggerCatchPredictive(_0x4351('0x1d0'),_0xd332e9));}else if(!ifInterval(_0xd332e9[_0x4351('0x1c6')],_0xd332e9[_0x4351('0x25')])){_0xd332e9['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0xd332e9[_0x4351('0x25')]=moment()[_0x4351('0x73')](_0x4351('0xef'));loggerPredictive[_0x4351('0x79')](_0xd332e9[_0x4351('0x3b')],_0x4351('0x1d1'),_0xd332e9[_0x4351('0x25')]);clearInterval(_0xd332e9['handlePredictive']);_0xd332e9[_0x4351('0x8e')]=undefined;this['averageHandleTime'](_0xd332e9[_0x4351('0x1c6')])[_0x4351('0xb8')](this[_0x4351('0x1ce')](_0xd332e9))[_0x4351('0xb8')](mergeDataErlangB(_0xd332e9))[_0x4351('0xb8')](this[_0x4351('0x1cf')](_0xd332e9))[_0x4351('0xb0')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0xd332e9));}else if(_0xd332e9[_0x4351('0x1d2')]&&_0x1e71ec<_0xd332e9['predictiveIntervalAvailable']-_0x351bbd){freeVariablesPredictive(_0xd332e9);loggerPredictive[_0x4351('0x79')](_0xd332e9[_0x4351('0x3b')],_0x4351('0x1d3'),_0x1e71ec,_0x4351('0x1d4'),_0xd332e9['predictiveIntervalAvailable'],'-',_0x351bbd,'=',_0xd332e9[_0x4351('0x1d2')]-_0x351bbd,')');}else if(_0xd332e9[_0x4351('0x1d2')]&&_0x1e71ec>_0xd332e9[_0x4351('0x1d2')]+_0x5193f0){freeVariablesPredictive(_0xd332e9);loggerPredictive[_0x4351('0x79')](_0xd332e9['name'],_0x4351('0x1d3'),_0x1e71ec,_0x4351('0x1d5'),_0xd332e9[_0x4351('0x1d2')],'+',_0x5193f0,'=',_0xd332e9[_0x4351('0x1d2')]+_0x5193f0,')');}};Dialer[_0x4351('0x17')]['getDataPredictive']=function(_0x51c9f3){var _0x39a926=this;return function(_0x39a40d){return new BPromise(function(_0x2a1d8d,_0x5029d0){_[_0x4351('0x89')](_0x51c9f3,_0x39a40d[0x0]);if(checkGetDataPredictive(_0x39a40d[0x0])){var _0x1c1428=_0x51c9f3[_0x4351('0x1d2')]=_0x51c9f3[_0x4351('0xa0')]+_0x51c9f3[_0x4351('0x48')];var _0x4ed333=_0x51c9f3[_0x4351('0x1c6')]*0x3c;var _0x400a68=_0x39a40d[0x0][_0x4351('0x64')]+_0x39a40d[0x0]['predictiveIntervalAvgHoldtime'];var _0x225715=(_0x39a40d[0x0][_0x4351('0x62')]+_0x39a40d[0x0][_0x4351('0x66')]+_0x39a40d[0x0][_0x4351('0x65')])/_0x39a40d[0x0][_0x4351('0x6b')];_0x51c9f3[_0x4351('0x68')]=_0x225715>0x0?_0x225715:0x1;switch(_0x51c9f3[_0x4351('0x1c8')]){case _0x4351('0x1c9'):var _0x42c999=_0x51c9f3[_0x4351('0x1bd')]/0x64;return _0x39a926[_0x4351('0x1d6')](_0x1c1428,_0x4ed333,_0x400a68,_0x225715,_0x42c999)[_0x4351('0xb8')](function(_0x49417f){return _0x2a1d8d(_0x49417f);});case _0x4351('0x1d7'):var _0x5af493=_0x51c9f3['dialPredictiveOptimizationPercentage']/0x64;return _0x39a926['busyFactor'](_0x1c1428,_0x4ed333,_0x400a68,_0x225715,_0x5af493)['then'](function(_0x5ed18a){return _0x2a1d8d(_0x5ed18a);});default:return _0x5029d0(msgResponse(_0x4351('0x1d8'),_0x4351('0x142'),_0x4351('0x1d9')));}}else{return _0x5029d0(msgResponse(_0x4351('0x1d8'),_0x4351('0x142'),_0x4351('0x1da')));}});};};Dialer[_0x4351('0x17')][_0x4351('0x1db')]=function(_0x3b3e3d){var _0x20b796=this;return function(_0x50746c){return new BPromise(function(_0x3140d0,_0x50f91f){_[_0x4351('0x89')](_0x3b3e3d,_0x50746c[0x0]);if(checkGetDataPredictive(_0x50746c[0x0])){loggerPredictive['info'](JSON[_0x4351('0x43')](_0x50746c[0x0]));if(_0x3b3e3d[_0x4351('0x1c8')]===_0x4351('0x1c9')){return _0x20b796[_0x4351('0xc3')](_0x3b3e3d['id'])[_0x4351('0xb8')](function(_0x5c6ce3){var _0x3de794=_0x3b3e3d['loggedIn']-_0x5c6ce3[0x0][_0x4351('0x1dc')];var _0x17b993=_0x3b3e3d[_0x4351('0x1c6')]*0x3c;var _0x5d8204=_0x50746c[0x0]['predictiveIntervalAvgTalktime']+_0x50746c[0x0]['predictiveIntervalAvgHoldtime'];var _0x15d918=(_0x50746c[0x0][_0x4351('0x62')]+_0x50746c[0x0][_0x4351('0x66')]+_0x50746c[0x0][_0x4351('0x65')])/_0x50746c[0x0][_0x4351('0x6b')];var _0x242873=_0x3b3e3d[_0x4351('0x1bd')]/0x64;_0x3b3e3d['predictiveIntervalPauses']=_0x5c6ce3[0x0]['outboundQueuePauses']||0x0;_0x3b3e3d[_0x4351('0x68')]=_0x15d918>0x0?_0x15d918:0x1;return _0x20b796[_0x4351('0x1d6')](_0x3de794,_0x17b993,_0x5d8204,_0x15d918,_0x242873);})['then'](function(_0x48db56){return _0x3140d0(_0x48db56);})[_0x4351('0xb0')](function(_0x1e674b){return _0x50f91f(msgResponse('[CatchErlangB]',_0x4351('0x142'),JSON[_0x4351('0x43')](_0x1e674b)));});}if(_0x3b3e3d[_0x4351('0x1c8')]===_0x4351('0x1d7')){return _0x20b796['getVoiceQueueRtPauses'](_0x3b3e3d['id'])[_0x4351('0xb8')](function(_0x2adb0a){var _0x1e3672=_0x3b3e3d[_0x4351('0x49')]-_0x2adb0a[0x0]['outboundQueuePauses'];var _0x1c4a6b=_0x3b3e3d[_0x4351('0x1c6')]*0x3c;var _0x4220b7=_0x50746c[0x0][_0x4351('0x64')]+_0x50746c[0x0][_0x4351('0x63')];var _0x3b976f=(_0x50746c[0x0][_0x4351('0x62')]+_0x50746c[0x0][_0x4351('0x66')]+_0x50746c[0x0][_0x4351('0x65')])/_0x50746c[0x0][_0x4351('0x6b')];var _0x2565c2=_0x3b3e3d[_0x4351('0x1bd')]/0x64;_0x3b3e3d['predictiveIntervalPauses']=_0x2adb0a[0x0][_0x4351('0x1dc')]||0x0;_0x3b3e3d['predictiveIntervalHitRate']=_0x3b976f>0x0?_0x3b976f:0x1;return _0x20b796['busyFactor'](_0x1e3672,_0x1c4a6b,_0x4220b7,_0x3b976f,_0x2565c2);})[_0x4351('0xb8')](function(_0x52d891){return _0x3140d0(_0x52d891);})['catch'](function(_0x215d06){return _0x50f91f(msgResponse(_0x4351('0x1dd'),_0x4351('0x142'),JSON[_0x4351('0x43')](_0x215d06)));});}}else{return _0x50f91f(msgResponse(_0x4351('0x1d8'),_0x4351('0x142'),_0x4351('0x1da')));}});};};Dialer[_0x4351('0x17')][_0x4351('0x1cf')]=function(_0x16d3f6){var _0x151e77=this;return function(){var _0x484868=0x0;var _0x2d1cb4=Math[_0x4351('0x1c1')](_0x16d3f6[_0x4351('0x6e')]*0x3e8);if(_0x2d1cb4>0x0){_0x2d1cb4=_0x2d1cb4<0x64?0x64:_0x2d1cb4;loggerPredictive[_0x4351('0x79')](_0x16d3f6[_0x4351('0x3b')],_0x4351('0x1de'),_0x2d1cb4,'milliseconds');_0x16d3f6[_0x4351('0x8e')]=setInterval(function(){_0x151e77[_0x4351('0x8e')](_0x16d3f6);loggerPredictiveCalls['info'](_0x4351('0x1df'),_0x484868+=0x1);},_0x2d1cb4);}else{loggerPredictive[_0x4351('0x79')](_0x16d3f6[_0x4351('0x3b')],_0x4351('0x1e0'));}};};Dialer[_0x4351('0x17')][_0x4351('0x1e1')]=function(_0x481f7e,_0x593c00){var _0x479a91=this;return function(_0xecc5c5){if(_[_0x4351('0x78')](_0xecc5c5)){if(_[_0x4351('0xac')](_0x593c00[_0x4351('0xcb')])||!_0x593c00[_0x4351('0x1e2')]){if(_0x481f7e['dialMethod']===_0x4351('0x8')){_0x481f7e[_0x4351('0x126')]=_[_0x4351('0x81')](_0x481f7e[_0x4351('0x126')])?!![]:_0x481f7e[_0x4351('0x126')];var _0xec36d9=uuid['v4']();_0x479a91['actions'][_0xec36d9]=new Action(_0x481f7e,_0x593c00,_0xec36d9);loggerBooked[_0x4351('0x79')](_0x4351('0x1e3'),_0xec36d9,'queueStatusComplete:\x20',JSON[_0x4351('0x43')](_0x481f7e[_0x4351('0x126')]),_0x4351('0x1e4'),_0x481f7e['name']);if(_0x481f7e[_0x4351('0x126')]){_0x481f7e['queueStatusComplete']=![];_0x479a91[_0x4351('0x122')][_0x479a91[_0x4351('0xaa')][_0xec36d9]['queue']]=[];ami[_0x4351('0xad')]({'actionid':_0xec36d9,'action':_0x4351('0x1e5'),'queue':_0x481f7e[_0x4351('0x3b')]})['catch'](function(){_0x479a91[_0x4351('0xb4')](_0x481f7e);_0x479a91[_0x4351('0xbe')]({'active':![],'ContactId':_0x479a91[_0x4351('0xaa')][_0xec36d9][_0x4351('0xf0')],'ListId':_0x479a91[_0x4351('0xaa')][_0xec36d9][_0x4351('0xf1')],'VoiceQueueId':_0x479a91[_0x4351('0xaa')][_0xec36d9][_0x4351('0xcc')]||undefined,'CampaignId':_0x479a91[_0x4351('0xaa')][_0xec36d9][_0x4351('0xcd')]||undefined})[_0x4351('0xb0')](loggerCatch(_0x4351('0x1e6')));delete _0x479a91[_0x4351('0xaa')][_0xec36d9];});}else{loggerBooked[_0x4351('0x79')](_0x4351('0x1e7'),JSON[_0x4351('0x43')](_0x481f7e[_0x4351('0x126')]),_0x4351('0x1e4'),_0x481f7e['name']);_0x479a91[_0x4351('0xb4')](_0x481f7e);_0x479a91[_0x4351('0xbe')]({'active':![],'ContactId':_0x479a91[_0x4351('0xaa')][_0xec36d9][_0x4351('0xf0')],'ListId':_0x479a91[_0x4351('0xaa')][_0xec36d9][_0x4351('0xf1')],'VoiceQueueId':_0x479a91[_0x4351('0xaa')][_0xec36d9]['VoiceQueueId']||undefined,'CampaignId':_0x479a91['actions'][_0xec36d9][_0x4351('0xcd')]||undefined})[_0x4351('0xb0')](loggerCatch(_0x4351('0x1e6')));delete _0x479a91[_0x4351('0xaa')][_0xec36d9];}}else{return _0x479a91['actionOriginate'](_0x481f7e,_0x593c00);}}else{if(getDiff(_0x593c00[_0x4351('0x1e8')])<_0x481f7e['dialRecallMeTimeout']*0x3c){if(_0x593c00['Agent']&&!_0x593c00['Agent']['voicePause']){_0x479a91[_0x4351('0x130')][_0x4351('0x12a')](_0x593c00['id'])['finally'](function(){_0x479a91[_0x4351('0xb4')](_0x481f7e);});}else{_0x479a91[_0x4351('0xbf')]({'active':![]},_0x593c00['id'],0x1)[_0x4351('0x1a')](function(){_0x479a91['updateOriginated'](_0x481f7e);});}}else{_0x481f7e[_0x4351('0x5f')]+=0x1;_0x479a91['updateOriginated'](_0x481f7e);if(_0x481f7e[_0x4351('0x1e9')]){_0x479a91[_0x4351('0xbe')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x593c00[_0x4351('0xf0')],'ListId':_0x593c00[_0x4351('0xf1')],'VoiceQueueId':_0x593c00[_0x4351('0xcc')]||undefined,'CampaignId':_0x593c00['CampaignId']||undefined})[_0x4351('0xb0')](loggerCatch(_0x4351('0x1ea')));_0x479a91[_0x4351('0xc6')](createObjHistory(_0x481f7e,_0x593c00,_0x4351('0x1eb'),0x17,'RecallInQueue'))[_0x4351('0xb0')](loggerCatch(_0x4351('0x1ec')));}else{_0x479a91[_0x4351('0xca')](createObjHistory(_0x481f7e,_0x593c00,'RECALLFAILEDTIMEOUT',0x16,_0x4351('0x1ed')),_0x4351('0x1ee'),'[Originate][HistoryRecallClose]');}}}}else{_0x481f7e[_0x4351('0x59')]+=0x1;_0x479a91[_0x4351('0xca')](createObjHistory(_0x481f7e,_0x593c00,_0x4351('0x1ef'),0xd,_0x4351('0x1f0')),_0x4351('0x1f1'),_0x4351('0x1f2'));throw'inBlackList';}};};Dialer[_0x4351('0x17')]['handleIvr']=function(_0xb047d5){var _0x41ecaa=this;var _0xa8dba8=_0xb047d5[_0x4351('0x1f3')]-_0xb047d5[_0x4351('0x6c')]-_0xb047d5[_0x4351('0x1f4')];emitCampaignSummary(_0xb047d5);if(_0xa8dba8>0x0){if(_0xa8dba8>this[_0x4351('0x20')]){_0xa8dba8=this[_0x4351('0x20')];}_0xb047d5[_0x4351('0x1f4')]+=_0xa8dba8;this[_0x4351('0x1f5')](_0xb047d5['id'],_0xa8dba8,_0xb047d5[_0x4351('0x1f6')])[_0x4351('0xb8')](function(_0xb6b9d1){_0xb047d5['temp']-=_0xa8dba8;_0xb047d5[_0x4351('0x1f4')]=_0xb047d5[_0x4351('0x1f4')]>0x0?_0xb047d5[_0x4351('0x1f4')]:0x0;if(!checkContactEmpty(_0xb6b9d1)){_0xb047d5[_0x4351('0x39')]=_0x4351('0x9d');logger['info'](_0x4351('0x1f7')+_0xb047d5[_0x4351('0x3b')]);}else{_0xb047d5[_0x4351('0x6c')]+=_0xb6b9d1[_0x4351('0x97')];_0xb047d5[_0x4351('0x39')]=_0x4351('0x1f8');for(var _0x28a247=0x0;_0x28a247<_0xb6b9d1[_0x4351('0x97')];_0x28a247+=0x1){_0xb047d5[_0x4351('0x1f9')]+=0x1;if(_['isNil'](_0xb6b9d1[_0x28a247])||_[_0x4351('0xac')](_0xb6b9d1[_0x28a247][_0x4351('0x163')])||_[_0x4351('0xac')](_0xb6b9d1[_0x28a247]['Contact'][_0x4351('0x164')])){_0x41ecaa[_0x4351('0xc8')]('[actionOriginate]\x20',_0xb047d5,_0xb6b9d1[_0x28a247]);}else{_0x41ecaa['checkIsBlackListIvr'](_[_0x4351('0x123')](_0xb6b9d1[_0x28a247],[_0x4351('0xcd'),_0x4351('0x1fa')]))[_0x4351('0xb8')](_0x41ecaa[_0x4351('0x1e1')](_0xb047d5,_0xb6b9d1[_0x28a247]))[_0x4351('0xb0')](_0x41ecaa['loggerHandler'](_0x4351('0x1fb'),_0xb047d5));}}}})['catch'](loggerGetContactDialer(_0x4351('0x1fc'),_0xb047d5,_0xa8dba8));}};Dialer[_0x4351('0x17')][_0x4351('0x152')]=function(_0x1063ee,_0x54bf1e){var _0x20c2aa=this;var _0x3e9eb2=[];var _0x214185=_0x54bf1e>=0x1?_0x54bf1e:0x1;if(_0x1063ee['dialMethod']==='booked'){_0x214185=0x1;}var _0x5927bd=Math[_0x4351('0x1c1')](_0x1063ee[_0x4351('0x48')]*_0x214185)-_0x1063ee[_0x4351('0x6c')]-_0x1063ee[_0x4351('0x1f4')];emitVoiceQueueSummary(_0x1063ee);if(_0x1063ee[_0x4351('0x1fd')]>0x0){var _0x38521c=_0x1063ee['dialLimitQueue']-_0x1063ee['originated']-_0x1063ee[_0x4351('0xa0')]-_0x1063ee[_0x4351('0x1f4')]-_0x1063ee[_0x4351('0x4a')];if(_0x5927bd>_0x38521c){_0x5927bd=_0x38521c;}}if(_0x5927bd>0x0){if(_0x1063ee['dialMethod']===_0x4351('0x8')){_0x5927bd=0x1;}if(_0x5927bd>this[_0x4351('0x20')]){_0x5927bd=this[_0x4351('0x20')];}_0x1063ee['temp']+=_0x5927bd;for(var _0x4fbc25 in this[_0x4351('0x1e')]){if(typeof this['agents'][_0x4fbc25]!=='undefined'){if(this[_0x4351('0x1e')][_0x4fbc25][_0x4351('0xa5')]==='not_inuse'&&this[_0x4351('0x1e')][_0x4fbc25][_0x4351('0xae')]===_0x4351('0xd3')){_0x3e9eb2[_0x4351('0x147')](this['agents'][_0x4fbc25]['id']);}}}this['getContactDialer'](_0x1063ee['id'],_0x3e9eb2,_0x5927bd,_0x1063ee[_0x4351('0x1f6')])[_0x4351('0xb8')](function(_0x56a282){_0x1063ee[_0x4351('0x1f4')]-=_0x5927bd;_0x1063ee['temp']=_0x1063ee[_0x4351('0x1f4')]>0x0?_0x1063ee['temp']:0x0;if(!checkContactEmpty(_0x56a282)){_0x20c2aa['countReScheduled'](_0x1063ee)[_0x4351('0xb8')](sendMessageReschedule(_0x1063ee))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x1063ee['originated']+=_0x56a282[_0x4351('0x97')];_0x1063ee[_0x4351('0x39')]=_0x1063ee[_0x4351('0x52')]==='booked'?_0x4351('0x16d'):_0x4351('0x1f8');for(var _0x1557d6=0x0;_0x1557d6<_0x56a282[_0x4351('0x97')];_0x1557d6+=0x1){if(_['isNil'](_0x56a282[_0x1557d6])||_[_0x4351('0xac')](_0x56a282[_0x1557d6][_0x4351('0x163')])||_[_0x4351('0xac')](_0x56a282[_0x1557d6][_0x4351('0x163')][_0x4351('0x164')])){_0x20c2aa[_0x4351('0xc8')](_0x4351('0x1fe'),_0x1063ee,_0x56a282[_0x1557d6]);}else{_0x20c2aa[_0x4351('0xba')](_[_0x4351('0x123')](_0x56a282[_0x1557d6],[_0x4351('0xcc'),_0x4351('0x1fa')]))['then'](_0x20c2aa[_0x4351('0x1e1')](_0x1063ee,_0x56a282[_0x1557d6]))[_0x4351('0xb0')](_0x20c2aa['loggerHandler'](_0x4351('0x1fe'),_0x1063ee));}}}})[_0x4351('0xb0')](loggerGetContactDialer(_0x4351('0x1ff'),_0x1063ee,_0x5927bd));}};Dialer['prototype']['handlePredictive']=function(_0x383f17){if(_0x383f17[_0x4351('0x1fd')]>0x0){var _0x87b32=_0x383f17[_0x4351('0x1fd')]-_0x383f17[_0x4351('0x6c')]-_0x383f17[_0x4351('0xa0')];if(_0x87b32>0x0){this[_0x4351('0x200')](_0x383f17);}else{loggerPredictiveCalls[_0x4351('0x79')](_0x4351('0x201'));}}else{this[_0x4351('0x200')](_0x383f17);}};Dialer[_0x4351('0x17')]['tryOriginatePredictive']=function(_0x3ff00d){var _0x1d52fa=this;var _0x26b2a3=[];_0x3ff00d[_0x4351('0x6c')]+=0x1;for(var _0x16efac in this[_0x4351('0x1e')]){if(typeof this[_0x4351('0x1e')][_0x16efac]!==_0x4351('0x98')){if(this[_0x4351('0x1e')][_0x16efac][_0x4351('0xa5')]==='not_inuse'&&this[_0x4351('0x1e')][_0x16efac]['status']===_0x4351('0xd3')){_0x26b2a3['push'](this[_0x4351('0x1e')][_0x16efac]['id']);}}}this['getContactDialer'](_0x3ff00d['id'],_0x26b2a3,0x1,_0x3ff00d['dialOrderByScheduledAt'])['then'](function(_0x5c80a3){if(!checkContactEmpty(_0x5c80a3)){checkContactLowerLimitOriginate(_0x3ff00d,0x1,0x0);_0x1d52fa[_0x4351('0xb6')](_0x3ff00d)['then'](sendMessageReschedule(_0x3ff00d))[_0x4351('0xb0')](loggerCatch('[countReScheduled]\x20'));}else{_0x3ff00d[_0x4351('0x39')]=_0x4351('0x1f8');if(_[_0x4351('0xac')](_0x5c80a3[0x0])||_[_0x4351('0xac')](_0x5c80a3[0x0][_0x4351('0x163')])||_[_0x4351('0xac')](_0x5c80a3[0x0]['Contact'][_0x4351('0x164')])){_0x1d52fa[_0x4351('0xc8')](_0x4351('0x1fe'),_0x3ff00d,_0x5c80a3[0x0]);}else{_0x1d52fa[_0x4351('0xba')](_[_0x4351('0x123')](_0x5c80a3[0x0],[_0x4351('0xcc'),'Contact.phone']))[_0x4351('0xb8')](_0x1d52fa[_0x4351('0x1e1')](_0x3ff00d,_0x5c80a3[0x0]))[_0x4351('0xb0')](_0x1d52fa['loggerHandler'](_0x4351('0x202'),_0x3ff00d));}}})[_0x4351('0xb0')](loggerGetContactDialer('[getContactDialerPredictive]',_0x3ff00d,0x1));emitVoiceQueueSummary(_0x3ff00d);};Dialer[_0x4351('0x17')][_0x4351('0x1d6')]=function(_0x175e2d,_0x194db0,_0x246035,_0x3f6436,_0x45f63f,_0x28f2fd){loggerPredictive['info'](_0x4351('0x203'));loggerPredictive[_0x4351('0x79')](_0x4351('0x204'),_0x175e2d);loggerPredictive[_0x4351('0x79')](_0x4351('0x205'),_0x194db0);loggerPredictive['info'](_0x4351('0x206'),_0x246035);loggerPredictive[_0x4351('0x79')](_0x4351('0x207'),_0x3f6436);loggerPredictive['info'](_0x4351('0x208'),_0x45f63f);loggerPredictive[_0x4351('0x79')](_0x4351('0x80'));return new BPromise(function(_0x518103,_0x15df26){if(_0x175e2d<=0x0||isNaN(_0x175e2d)){return _0x15df26(msgResponse(_0x4351('0x209'),_0x4351('0x42'),_0x4351('0x20a')+_0x175e2d));}if(_0x246035<=0x0||isNaN(_0x246035)){return _0x15df26(msgResponse(_0x4351('0x209'),_0x4351('0x42'),_0x4351('0x20b')+_0x246035));}if(_0x3f6436<=0x0||isNaN(_0x3f6436)){return _0x15df26(msgResponse(_0x4351('0x209'),'Error','p\x20=\x20'+_0x3f6436));}if(_0x194db0<=0x0||isNaN(_0x194db0)){return _0x15df26(msgResponse(_0x4351('0x209'),'Error','interval\x20=\x20'+_0x194db0));}if(_0x45f63f<=0x0||isNaN(_0x45f63f)){return _0x15df26(msgResponse(_0x4351('0x209'),_0x4351('0x42'),_0x4351('0x20c')+_0x45f63f));}_0x28f2fd=_0x28f2fd||0x0;var _0x45f864=0x1/_0x246035;var _0xbceefa=0x0;var _0x1376a9=0x0;var _0x55d7b7=0x0;var _0x5f0709=0x0;for(var _0xce598a=0x0;_0x55d7b7<_0x45f63f;_0xce598a+=0x1){_0x1376a9=_0xce598a/_0x194db0;_0xbceefa=(_0x3f6436*_0x1376a9+_0x28f2fd)/_0x45f864;_0x55d7b7=erlangb(_0xbceefa,_0x175e2d);_0x5f0709=_0xbceefa/_0x175e2d*(0x1-erlangb(_0xbceefa,_0x175e2d));}return _0x518103({'erlangCalls':_0xce598a,'erlangCallToSecond':_0x194db0/_0xce598a,'erlangAbandonmentRate':_0x55d7b7,'erlangBusyFactor':_0x5f0709});});};Dialer['prototype'][_0x4351('0x20d')]=function(_0x5354e2,_0x69cda6,_0x51309b,_0x4082d7,_0x5c54a8,_0x92363c){loggerPredictive[_0x4351('0x79')](_0x4351('0x20e'));loggerPredictive[_0x4351('0x79')]('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',_0x5354e2);loggerPredictive[_0x4351('0x79')](_0x4351('0x205'),_0x69cda6);loggerPredictive[_0x4351('0x79')]('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',_0x51309b);loggerPredictive['info'](_0x4351('0x207'),_0x4082d7);loggerPredictive['info'](_0x4351('0x20f'),_0x5c54a8);loggerPredictive[_0x4351('0x79')](_0x4351('0x80'));return new BPromise(function(_0x267326,_0x1cbab7){if(_0x5354e2<=0x0||isNaN(_0x5354e2)){return _0x1cbab7(msgResponse(_0x4351('0x210'),_0x4351('0x42'),_0x4351('0x20a')+_0x5354e2));}if(_0x51309b<=0x0||isNaN(_0x51309b)){return _0x1cbab7(msgResponse(_0x4351('0x210'),_0x4351('0x42'),_0x4351('0x20b')+_0x51309b));}if(_0x4082d7<=0x0||isNaN(_0x4082d7)){return _0x1cbab7(msgResponse(_0x4351('0x210'),_0x4351('0x42'),_0x4351('0x211')+_0x4082d7));}if(_0x69cda6<=0x0||isNaN(_0x69cda6)){return _0x1cbab7(msgResponse(_0x4351('0x210'),_0x4351('0x42'),_0x4351('0x212')+_0x69cda6));}if(_0x5c54a8<=0x0||isNaN(_0x5c54a8)){return _0x1cbab7(msgResponse(_0x4351('0x210'),_0x4351('0x42'),_0x4351('0x213')+_0x5c54a8));}_0x92363c=_0x92363c||0x0;var _0x35a57c=0x1/_0x51309b;var _0x45279f=0x0;var _0x3da747=0x0;var _0x349179=0x0;var _0x29e27f=0x0;for(var _0x2d60fa=0x0;_0x29e27f<_0x5c54a8;_0x2d60fa+=0x1){_0x3da747=_0x2d60fa/_0x69cda6;_0x45279f=(_0x4082d7*_0x3da747+_0x92363c)/_0x35a57c;_0x349179=erlangb(_0x45279f,_0x5354e2);_0x29e27f=_0x45279f/_0x5354e2*(0x1-erlangb(_0x45279f,_0x5354e2));}return _0x267326({'erlangCalls':_0x2d60fa,'erlangCallToSecond':_0x69cda6/_0x2d60fa,'erlangAbandonmentRate':_0x349179,'erlangBusyFactor':_0x29e27f});});};module[_0x4351('0x214')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index e795707..75fad33 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 _0x017b=['CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','name','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x1877e0,_0x5f111a){var _0x52408a=function(_0x52baa8){while(--_0x52baa8){_0x1877e0['push'](_0x1877e0['shift']());}};_0x52408a(++_0x5f111a);}(_0x017b,0x1a8));var _0xb017=function(_0x4b343b,_0x1215b0){_0x4b343b=_0x4b343b-0x0;var _0x455b3a=_0x017b[_0x4b343b];return _0x455b3a;};'use strict';var util=require('util');var _=require(_0xb017('0x0'));var moment=require(_0xb017('0x1'));function getSeconds(_0x583fad,_0x37df7e){var _0x5eac2c=moment(_0x583fad)['milliseconds'](0x0);var _0x1536ae=moment(_0x37df7e)[_0xb017('0x2')](0x0);return _0x5eac2c[_0xb017('0x3')](_0x1536ae,'seconds');}function QueueCallerAbandon(_0x16047d,_0xb89c8a){this[_0xb017('0x4')]=_0x16047d[_0xb017('0x4')];this[_0xb017('0x5')]=_0x16047d['type'];this[_0xb017('0x6')]=_0x16047d['type']===_0xb017('0x7')?_0xb017('0x8'):_0x16047d[_0xb017('0x5')];this[_0xb017('0x9')]=_0x16047d[_0xb017('0x9')];this[_0xb017('0xa')]=_0x16047d[_0xb017('0xa')];this[_0xb017('0xb')]=_0x16047d[_0xb017('0xb')];this[_0xb017('0xc')]=_0x16047d[_0xb017('0x9')]+_0x16047d[_0xb017('0xa')]+_0x16047d['countnoanswerretry']+_0x16047d['countnosuchnumberretry']+_0x16047d[_0xb017('0xd')]+_0x16047d[_0xb017('0xe')]+_0x16047d[_0xb017('0xf')]+_0x16047d[_0xb017('0x10')];this[_0xb017('0x11')]=_0x16047d[_0xb017('0x11')];this[_0xb017('0xd')]=_0x16047d[_0xb017('0xd')];this[_0xb017('0xe')]=_0x16047d[_0xb017('0xe')];this[_0xb017('0xf')]=_0x16047d[_0xb017('0xf')];this[_0xb017('0x10')]=_0x16047d[_0xb017('0x10')];this[_0xb017('0x12')]=_0xb89c8a['uniqueid'];this['calleridname']=_0x16047d[_0xb017('0x13')];this['calleridnum']=_0x16047d[_0xb017('0x14')];this[_0xb017('0x15')]=_0x16047d[_0xb017('0x15')];this[_0xb017('0x16')]=_0x16047d['responsetime'];this[_0xb017('0x17')]=_0x16047d[_0xb017('0x17')];this[_0xb017('0x18')]=this[_0xb017('0x17')];this[_0xb017('0x19')]=getSeconds(_0x16047d['responsetime'],_0x16047d[_0xb017('0x15')]);this[_0xb017('0x1a')]=getSeconds(this['droptime'],_0x16047d[_0xb017('0x16')]);this[_0xb017('0x1b')]=0x0;this[_0xb017('0x8')]=_0xb89c8a[_0xb017('0x8')];this[_0xb017('0x1c')]=_0xb89c8a[_0xb017('0x1d')];this[_0xb017('0x1e')]=_0xb89c8a['reason'];this['callback']=_0x16047d['callback'];this['callbackuniqueid']=_0x16047d[_0xb017('0x1f')];this['callbackat']=_0x16047d[_0xb017('0x20')];this['recallme']=_0x16047d[_0xb017('0x21')];this['ContactId']=_0x16047d[_0xb017('0x22')];this['ListId']=_0x16047d[_0xb017('0x23')];this[_0xb017('0x24')]=_0x16047d['UserId'];this['VoiceQueueId']=_0x16047d[_0xb017('0x25')];this[_0xb017('0x26')]=_0x16047d[_0xb017('0x26')];this['originatecalleridnum']=_0x16047d[_0xb017('0x27')]||'';this[_0xb017('0x28')]=_0x16047d['originatecalleridname']||'';}module[_0xb017('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x3833=['endtime','ringtime','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime'];(function(_0x38cf28,_0x13b832){var _0x4d7929=function(_0x162198){while(--_0x162198){_0x38cf28['push'](_0x38cf28['shift']());}};_0x4d7929(++_0x13b832);}(_0x3833,0x194));var _0x3383=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x3833[_0x1c8c28];return _0x1f59b4;};'use strict';var util=require(_0x3383('0x0'));var _=require(_0x3383('0x1'));var moment=require(_0x3383('0x2'));function getSeconds(_0x4e6ed2,_0x8b0446){var _0x2c2316=moment(_0x4e6ed2)[_0x3383('0x3')](0x0);var _0x1391a0=moment(_0x8b0446)[_0x3383('0x3')](0x0);return _0x2c2316[_0x3383('0x4')](_0x1391a0,_0x3383('0x5'));}function QueueCallerAbandon(_0x186965,_0x532ec0){this[_0x3383('0x6')]=_0x186965[_0x3383('0x6')];this['type']=_0x186965['type'];this['campaigntype']=_0x186965[_0x3383('0x7')]===_0x3383('0x8')?_0x3383('0x9'):_0x186965[_0x3383('0x7')];this[_0x3383('0xa')]=_0x186965[_0x3383('0xa')];this['countcongestionretry']=_0x186965[_0x3383('0xb')];this[_0x3383('0xc')]=_0x186965[_0x3383('0xc')];this[_0x3383('0xd')]=_0x186965[_0x3383('0xa')]+_0x186965[_0x3383('0xb')]+_0x186965[_0x3383('0xc')]+_0x186965[_0x3383('0xe')]+_0x186965[_0x3383('0xf')]+_0x186965[_0x3383('0x10')]+_0x186965[_0x3383('0x11')]+_0x186965[_0x3383('0x12')];this[_0x3383('0xe')]=_0x186965[_0x3383('0xe')];this[_0x3383('0xf')]=_0x186965[_0x3383('0xf')];this['countabandonedretry']=_0x186965[_0x3383('0x10')];this[_0x3383('0x11')]=_0x186965[_0x3383('0x11')];this[_0x3383('0x12')]=_0x186965[_0x3383('0x12')];this[_0x3383('0x13')]=_0x532ec0[_0x3383('0x13')];this[_0x3383('0x14')]=_0x186965[_0x3383('0x15')];this['calleridnum']=_0x186965[_0x3383('0x16')];this[_0x3383('0x17')]=_0x186965[_0x3383('0x17')];this['responsetime']=_0x186965[_0x3383('0x18')];this['droptime']=_0x186965[_0x3383('0x19')];this[_0x3383('0x1a')]=this[_0x3383('0x19')];this[_0x3383('0x1b')]=getSeconds(_0x186965[_0x3383('0x18')],_0x186965[_0x3383('0x17')]);this[_0x3383('0x1c')]=getSeconds(this[_0x3383('0x19')],_0x186965[_0x3383('0x18')]);this['talktime']=0x0;this['queue']=_0x532ec0[_0x3383('0x9')];this[_0x3383('0x1d')]=_0x532ec0[_0x3383('0x1e')];this[_0x3383('0x1f')]=_0x532ec0[_0x3383('0x1f')];this[_0x3383('0x20')]=_0x186965[_0x3383('0x20')];this[_0x3383('0x21')]=_0x186965[_0x3383('0x21')];this[_0x3383('0x22')]=_0x186965['callbackat'];this[_0x3383('0x23')]=_0x186965[_0x3383('0x23')];this[_0x3383('0x24')]=_0x186965['ContactId'];this[_0x3383('0x25')]=_0x186965[_0x3383('0x25')];this[_0x3383('0x26')]=_0x186965[_0x3383('0x26')];this['VoiceQueueId']=_0x186965['VoiceQueueId'];this[_0x3383('0x27')]=_0x186965[_0x3383('0x27')];this[_0x3383('0x28')]=_0x186965['originatecalleridnum']||'';this[_0x3383('0x29')]=_0x186965[_0x3383('0x29')]||'';}module[_0x3383('0x2a')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index b95cf24..62a075d 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 _0x2835=['AttachmentId','util','lodash','moment','uniqueid','channel','%s/%s/%s','tech','Trunk','name','fax','localstationid','headerinfo','path'];(function(_0x1b842f,_0x27a979){var _0x27a559=function(_0x91cd73){while(--_0x91cd73){_0x1b842f['push'](_0x1b842f['shift']());}};_0x27a559(++_0x27a979);}(_0x2835,0x1dd));var _0x5283=function(_0x107c01,_0x40606f){_0x107c01=_0x107c01-0x0;var _0x4cce69=_0x2835[_0x107c01];return _0x4cce69;};'use strict';var util=require(_0x5283('0x0'));var _=require(_0x5283('0x1'));var moment=require(_0x5283('0x2'));function Action(_0x3df00f,_0x3893b9,_0x294b40){this[_0x5283('0x3')]=_0x3df00f||undefined;this[_0x5283('0x4')]=util['format'](_0x5283('0x5'),_0x3893b9[_0x5283('0x6')],_0x3893b9[_0x5283('0x7')][_0x5283('0x8')],_0x294b40[_0x5283('0x9')]);this['localstationid']=_0x3893b9[_0x5283('0xa')];this[_0x5283('0xb')]=_0x3893b9[_0x5283('0xb')];this[_0x5283('0xc')]=_0x294b40['path'];this[_0x5283('0xd')]=_0x294b40['AttachmentId'];}module['exports']=Action; \ No newline at end of file +var _0xb9c6=['headerinfo','path','AttachmentId','exports','util','lodash','uniqueid','%s/%s/%s','name','fax','localstationid'];(function(_0x3e6edc,_0x49e5f9){var _0x44e461=function(_0x142805){while(--_0x142805){_0x3e6edc['push'](_0x3e6edc['shift']());}};_0x44e461(++_0x49e5f9);}(_0xb9c6,0x138));var _0x6b9c=function(_0x390b11,_0x438ced){_0x390b11=_0x390b11-0x0;var _0x23b3f8=_0xb9c6[_0x390b11];return _0x23b3f8;};'use strict';var util=require(_0x6b9c('0x0'));var _=require(_0x6b9c('0x1'));var moment=require('moment');function Action(_0x5a4343,_0x222275,_0x2c2fda){this[_0x6b9c('0x2')]=_0x5a4343||undefined;this['channel']=util['format'](_0x6b9c('0x3'),_0x222275['tech'],_0x222275['Trunk'][_0x6b9c('0x4')],_0x2c2fda[_0x6b9c('0x5')]);this['localstationid']=_0x222275[_0x6b9c('0x6')];this[_0x6b9c('0x7')]=_0x222275['headerinfo'];this[_0x6b9c('0x8')]=_0x2c2fda[_0x6b9c('0x8')];this[_0x6b9c('0x9')]=_0x2c2fda[_0x6b9c('0x9')];}module[_0x6b9c('0xa')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 36e0be3..0e37207 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 _0x2ab6=['prototype','syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','finally','syncHangup','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','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','format','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','uuid','moment','path','tiff2pdf','fax','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','bind','newstate','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','context','from-voip-provider','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty','value','syncNewState','channelstate','channelstatedesc'];(function(_0x1d3019,_0x8dbbd5){var _0x36458e=function(_0x5d60db){while(--_0x5d60db){_0x1d3019['push'](_0x1d3019['shift']());}};_0x36458e(++_0x8dbbd5);}(_0x2ab6,0x12d));var _0x62ab=function(_0x547348,_0x39abaa){_0x547348=_0x547348-0x0;var _0x369bec=_0x2ab6[_0x547348];return _0x369bec;};'use strict';var util=require(_0x62ab('0x0'));var _=require(_0x62ab('0x1'));var BPromise=require('bluebird');var uuid=require(_0x62ab('0x2'));var moment=require(_0x62ab('0x3'));var path=require(_0x62ab('0x4'));var tiff2pdf=require(_0x62ab('0x5'));var gs=require('./util/gs');var logger=require('../../../config/logger')(_0x62ab('0x6'));var ami=require(_0x62ab('0x7'));var rpcDb=require('./rpcDb');var Channel=require(_0x62ab('0x8'));var ut=require(_0x62ab('0x9'));var Action=require(_0x62ab('0xa'));var faxAccount=require(_0x62ab('0xb'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x62ab('0xc'));function Fax(_0x1c62ce){this[_0x62ab('0xd')]={};this[_0x62ab('0xe')]=_0x1c62ce['faxAccounts'];this[_0x62ab('0xf')]=_0x1c62ce[_0x62ab('0xf')];this[_0x62ab('0x10')]={};ami['on'](_0x62ab('0x11'),this[_0x62ab('0x12')]['bind'](this));ami['on'](_0x62ab('0x13'),this[_0x62ab('0x14')][_0x62ab('0x15')](this));ami['on'](_0x62ab('0x16'),this['syncNewState'][_0x62ab('0x15')](this));ami['on'](_0x62ab('0x17'),this['syncNewExten'][_0x62ab('0x15')](this));ami['on'](_0x62ab('0x18'),this[_0x62ab('0x19')][_0x62ab('0x15')](this));ami['on'](_0x62ab('0x1a'),this[_0x62ab('0x1b')][_0x62ab('0x15')](this));ami['on'](_0x62ab('0x1c'),this['syncHangup'][_0x62ab('0x15')](this));ami['on'](_0x62ab('0x1d'),this['syncOriginateResponse'][_0x62ab('0x15')](this));}Fax['prototype'][_0x62ab('0x12')]=function(_0x32ac7d){if(_0x32ac7d[_0x62ab('0x1e')]===_0x62ab('0x1f')){for(var _0x2cccf5 in this['faxAccounts']){if(this['faxAccounts']['hasOwnProperty'](_0x2cccf5)){if(_0x32ac7d['exten']===this['faxAccounts'][_0x2cccf5][_0x62ab('0x20')]){this['channels'][_0x32ac7d[_0x62ab('0x21')]]={};this[_0x62ab('0xd')][_0x32ac7d[_0x62ab('0x21')]][_0x62ab('0x22')]=_0x32ac7d[_0x62ab('0x22')];this['channels'][_0x32ac7d[_0x62ab('0x21')]]['id']=this[_0x62ab('0xe')][_0x2cccf5]['id'];this[_0x62ab('0xd')][_0x32ac7d[_0x62ab('0x21')]][_0x62ab('0x23')]=this[_0x62ab('0xe')][_0x2cccf5]['name'];logger[_0x62ab('0x24')](_0x32ac7d[_0x62ab('0x21')],_0x62ab('0x25'));}}}}if(this[_0x62ab('0x10')][_0x32ac7d[_0x62ab('0x21')]]){this[_0x62ab('0xd')][_0x32ac7d[_0x62ab('0x21')]]={};this[_0x62ab('0xd')][_0x32ac7d['uniqueid']][_0x62ab('0x22')]=_0x32ac7d[_0x62ab('0x22')];logger[_0x62ab('0x24')](_0x32ac7d[_0x62ab('0x21')],'\x20syncNewchannel\x20');}};Fax['prototype'][_0x62ab('0x14')]=function(_0x9eccc3){if(this[_0x62ab('0xd')][_0x9eccc3[_0x62ab('0x21')]]){for(var _0x56fcb9 in _0x9eccc3[_0x62ab('0x26')]){if(_0x9eccc3[_0x62ab('0x26')][_0x62ab('0x27')](_0x56fcb9)){this[_0x62ab('0xd')][_0x9eccc3['uniqueid']][_0x56fcb9]=_0x9eccc3[_0x62ab('0x28')];}}}};Fax['prototype'][_0x62ab('0x29')]=function(_0x2e03b6){if(this[_0x62ab('0xd')][_0x2e03b6[_0x62ab('0x21')]]){this[_0x62ab('0xd')][_0x2e03b6[_0x62ab('0x21')]]['channelstate']=_0x2e03b6[_0x62ab('0x2a')];this[_0x62ab('0xd')][_0x2e03b6['uniqueid']][_0x62ab('0x2b')]=_0x2e03b6[_0x62ab('0x2b')];}};Fax[_0x62ab('0x2c')][_0x62ab('0x2d')]=function(_0x5a5d0b){if(this[_0x62ab('0xd')][_0x5a5d0b[_0x62ab('0x21')]]){for(var _0x4fbd9a in _0x5a5d0b[_0x62ab('0x26')]){if(_0x5a5d0b['variable']['hasOwnProperty'](_0x4fbd9a)){this[_0x62ab('0xd')][_0x5a5d0b['uniqueid']][_0x4fbd9a]=_0x5a5d0b[_0x62ab('0x28')];}}}};Fax[_0x62ab('0x2c')]['syncFaxStatus']=function(_0x3aead0){if(this['channels'][_0x3aead0[_0x62ab('0x21')]]){this[_0x62ab('0xd')][_0x3aead0[_0x62ab('0x21')]][_0x62ab('0x2e')]=_0x3aead0[_0x62ab('0x2e')];this[_0x62ab('0xd')][_0x3aead0[_0x62ab('0x21')]]['status']=_0x3aead0[_0x62ab('0x2f')];this['channels'][_0x3aead0[_0x62ab('0x21')]][_0x62ab('0x20')]=_0x3aead0[_0x62ab('0x20')];this[_0x62ab('0xd')][_0x3aead0[_0x62ab('0x21')]]['filename']=_0x3aead0[_0x62ab('0x30')];logger[_0x62ab('0x24')](_0x3aead0[_0x62ab('0x21')],_0x62ab('0x31'));}};Fax[_0x62ab('0x2c')][_0x62ab('0x1b')]=function(_0x48a7ec){var _0x565236=this;if(this['channels'][_0x48a7ec[_0x62ab('0x21')]]){var _0x1b2098=this[_0x62ab('0xd')][_0x48a7ec['uniqueid']]['id'];this[_0x62ab('0xd')][_0x48a7ec[_0x62ab('0x21')]][_0x62ab('0x32')]=_0x48a7ec[_0x62ab('0x32')];this[_0x62ab('0xd')][_0x48a7ec['uniqueid']][_0x62ab('0x33')]=_0x48a7ec[_0x62ab('0x33')];this[_0x62ab('0xd')][_0x48a7ec['uniqueid']][_0x62ab('0x20')]=_0x48a7ec['localstationid'];this['channels'][_0x48a7ec[_0x62ab('0x21')]]['resolution']=_0x48a7ec[_0x62ab('0x34')];this[_0x62ab('0xd')][_0x48a7ec['uniqueid']][_0x62ab('0x35')]=_0x48a7ec[_0x62ab('0x35')];this[_0x62ab('0xd')][_0x48a7ec['uniqueid']]['filename']=_0x48a7ec[_0x62ab('0x30')];this['channels'][_0x48a7ec[_0x62ab('0x21')]][_0x62ab('0x36')]=_0x48a7ec[_0x62ab('0x36')];if(this['channels'][_0x48a7ec['uniqueid']][_0x62ab('0x33')]>0x0){tiff2pdf(_0x48a7ec[_0x62ab('0x30')],'/var/opt/motion2/server/files/attachments/',function(_0x47983a){logger[_0x62ab('0x24')](_0x48a7ec[_0x62ab('0x21')],_0x62ab('0x37'),_0x47983a[_0x62ab('0x38')]);attachment[_0x62ab('0x39')]({'name':path[_0x62ab('0x3a')](_0x48a7ec['filename'])[_0x62ab('0x23')],'basename':path[_0x62ab('0x3a')](_0x48a7ec[_0x62ab('0x30')])[_0x62ab('0x23')]+_0x62ab('0x3b'),'type':_0x62ab('0x3c')})[_0x62ab('0x3d')](function(_0x3b8874){faxAccount[_0x62ab('0x3e')](_0x1b2098,{'from':_0x48a7ec[_0x62ab('0x36')],'mapKey':_0x62ab('0x6'),'body':path[_0x62ab('0x3a')](_0x48a7ec[_0x62ab('0x30')])[_0x62ab('0x23')]+_0x62ab('0x3b'),'AttachmentId':_0x3b8874['id']})[_0x62ab('0x3f')](function(_0x247dd9){logger[_0x62ab('0x40')](_0x48a7ec[_0x62ab('0x21')],_0x62ab('0x41'),JSON[_0x62ab('0x42')](_0x247dd9));});})[_0x62ab('0x3f')](function(_0x418184){logger['error'](_0x48a7ec[_0x62ab('0x21')],_0x62ab('0x43'),JSON[_0x62ab('0x42')](_0x418184));});});}logger[_0x62ab('0x24')](_0x48a7ec[_0x62ab('0x21')],_0x62ab('0x43'));}};Fax[_0x62ab('0x2c')][_0x62ab('0x44')]=function(_0x1a4d71){if(this['actions'][_0x1a4d71[_0x62ab('0x21')]]){_[_0x62ab('0x45')](this['channels'][_0x1a4d71['uniqueid']],_[_0x62ab('0x46')](_0x1a4d71,[_0x62ab('0x47'),_0x62ab('0x48')]));}};function updateStatus(_0x14b430){if(_0x14b430['AttachmentId']){faxMessage['update'](_0x14b430[_0x62ab('0x49')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x62ab('0x3d')](function(_0x84bcaa){ut[_0x62ab('0x4a')]('[Fax][Message][Error][Updated]',_0x84bcaa);})[_0x62ab('0x3f')](function(_0xac3736){ut[_0x62ab('0x4a')](_0x62ab('0x4b'),_0xac3736);});}else{ut[_0x62ab('0x4a')](_0x62ab('0x4c'));}}Fax['prototype'][_0x62ab('0x4d')]=function(_0x45b6ba,_0x2b7cd9,_0x2139c0){var _0x39125f=this;var _0x5656cf={};if(_0x2b7cd9){_0x5656cf={'read':_0x2b7cd9};}else{_0x5656cf={'failMessage':_0x2139c0};}if(this[_0x62ab('0x10')][_0x45b6ba][_0x62ab('0x49')]){faxMessage[_0x62ab('0x4e')](this[_0x62ab('0x10')][_0x45b6ba]['AttachmentId'],_0x5656cf)[_0x62ab('0x3d')](function(_0x47c588){ut[_0x62ab('0x4a')](_0x62ab('0x4f'),_0x47c588);})[_0x62ab('0x3f')](function(_0x3e39cc){ut['logger']('[Fax][Message][NoUpdate1]',_0x3e39cc);})[_0x62ab('0x50')](function(){delete _0x39125f[_0x62ab('0xd')][_0x45b6ba];delete _0x39125f[_0x62ab('0x10')][_0x45b6ba];});}else{ut[_0x62ab('0x4a')]('[Fax][Message][NoUpdate2]');delete this[_0x62ab('0xd')][_0x45b6ba];delete this[_0x62ab('0x10')][_0x45b6ba];}};Fax[_0x62ab('0x2c')][_0x62ab('0x51')]=function(_0x2fc2a2){var _0x37e713=this;if(this[_0x62ab('0xd')][_0x2fc2a2[_0x62ab('0x21')]]){if(this[_0x62ab('0x10')][_0x2fc2a2[_0x62ab('0x21')]]){this[_0x62ab('0xd')][_0x2fc2a2[_0x62ab('0x21')]]['id']=this[_0x62ab('0x10')][_0x2fc2a2[_0x62ab('0x21')]]['id'];this[_0x62ab('0xd')][_0x2fc2a2['uniqueid']]['name']=this[_0x62ab('0x10')][_0x2fc2a2[_0x62ab('0x21')]][_0x62ab('0x23')];}logger[_0x62ab('0x24')](_0x2fc2a2[_0x62ab('0x21')],this[_0x62ab('0x10')][_0x2fc2a2['uniqueid']]?'\x20hangup\x20sendFile\x20':_0x62ab('0x52'),JSON[_0x62ab('0x42')](this[_0x62ab('0xd')][_0x2fc2a2[_0x62ab('0x21')]]));if(this[_0x62ab('0x10')][_0x2fc2a2[_0x62ab('0x21')]]){if(this[_0x62ab('0xd')][_0x2fc2a2['uniqueid']]['faxpages']>0x0&&this[_0x62ab('0xd')][_0x2fc2a2['uniqueid']][_0x62ab('0x18')]===_0x62ab('0x53')){this[_0x62ab('0x4d')](_0x2fc2a2['uniqueid'],!![]);}else{this[_0x62ab('0x4d')](_0x2fc2a2['uniqueid'],![],this[_0x62ab('0xd')][_0x2fc2a2[_0x62ab('0x21')]][_0x62ab('0x54')]?_0x62ab('0x55')+this[_0x62ab('0xd')][_0x2fc2a2['uniqueid']]['faxstatusstring']:_0x62ab('0x56'));}}}};Fax[_0x62ab('0x2c')][_0x62ab('0x57')]=function(_0x22107a){var _0x3f3f6f=this;return new BPromise(function(_0x5934e5,_0x438b75){_0x3f3f6f[_0x62ab('0x58')](_0x22107a,_0x3f3f6f['faxAccounts'][_0x22107a['FaxAccountId']])['then'](function(_0x292b9d){ut[_0x62ab('0x4a')](_0x62ab('0x59'),_0x292b9d);_0x5934e5(ut[_0x62ab('0x38')]('Fax\x20received'));})[_0x62ab('0x3f')](function(_0x209b89){ut[_0x62ab('0x4a')](_0x62ab('0x5a'),_0x209b89);updateStatus(_0x22107a);_0x438b75(ut[_0x62ab('0x38')](_0x62ab('0x5b')));});});};Fax[_0x62ab('0x2c')][_0x62ab('0x5c')]=function(_0x26ed6a){var _0x2cc1a9=this;return new BPromise(function(_0x31ad4a,_0x31b53f){var _0x1ea9db=_0x2cc1a9[_0x62ab('0x5d')](_0x2cc1a9[_0x62ab('0xe')][_0x26ed6a[_0x62ab('0x5e')]][_0x62ab('0x5f')],_0x26ed6a);if(_0x1ea9db[_0x62ab('0x60')]){_0x31ad4a(ut['message']('Trunk\x20Reachable'));}else{_0x31b53f(ut[_0x62ab('0x38')](_0x1ea9db[_0x62ab('0x38')]));}});};function originate(_0x1ed062,_0x4db811,_0x1ed649){return new BPromise(function(_0x15611f,_0x3527e9){if(_0x1ed649){var _0x42ba2f=util['format'](_0x62ab('0x61'),path[_0x62ab('0x3a')](_0x1ed062[_0x62ab('0x4')])['name'],_0x1ed062['path']);gs['execute'](_0x42ba2f)[_0x62ab('0x3d')](function(){_0x1ed062[_0x62ab('0x4')]=util[_0x62ab('0x62')]('%s/%s.tif',path[_0x62ab('0x3a')](_0x1ed062[_0x62ab('0x4')])[_0x62ab('0x63')],path[_0x62ab('0x3a')](_0x1ed062[_0x62ab('0x4')])['name']);_0x4db811['XMF-PATH']=_0x1ed062[_0x62ab('0x4')];ut[_0x62ab('0x4a')](_0x62ab('0x64'),'');ami[_0x62ab('0x65')](ut['variablesAction'](_0x1ed062,_0x4db811))[_0x62ab('0x3d')](function(_0x34d95f){_0x15611f(_0x34d95f);})[_0x62ab('0x3f')](function(_0x5db7b0){_0x3527e9(_0x5db7b0);});})[_0x62ab('0x3f')](function(_0x3a20a5){_0x3527e9(_0x3a20a5);});}else{ami[_0x62ab('0x65')](ut[_0x62ab('0x66')](_0x1ed062,_0x4db811))[_0x62ab('0x3d')](function(_0x20e60e){_0x15611f(_0x20e60e);})[_0x62ab('0x3f')](function(_0xced11){_0x3527e9(_0xced11);});}});}Fax['prototype'][_0x62ab('0x58')]=function(_0x340a57,_0x2676d0){var _0x35a1d6=this;return new BPromise(function(_0xdfdca9,_0x33ce98){var _0x2b664a=uuid['v4']();var _0x101224=ut[_0x62ab('0x67')](_0x340a57,_0x2676d0);_0x35a1d6['actions'][_0x2b664a]=new Action(_0x2b664a,_0x2676d0,_0x340a57);var _0x9e506e=_0x35a1d6[_0x62ab('0x10')][_0x2b664a];if(path['parse'](_0x340a57[_0x62ab('0x4')])['ext']===_0x62ab('0x3b')){originate(_0x9e506e,_0x101224,!![])[_0x62ab('0x3d')](function(_0x1a27ae){_0xdfdca9(_0x1a27ae);})[_0x62ab('0x3f')](function(_0x431686){_0x33ce98(_0x431686);});}else{originate(_0x9e506e,_0x101224,![])[_0x62ab('0x3d')](function(_0x353494){_0xdfdca9(_0x353494);})[_0x62ab('0x3f')](function(_0x2332cf){_0x33ce98(_0x2332cf);});}});};Fax[_0x62ab('0x2c')][_0x62ab('0x68')]=function(_0x1d46a7){return!_['isNil'](_0x1d46a7)&&!_['isNil'](_0x1d46a7['name'])&&!_[_0x62ab('0x69')](_0x1d46a7[_0x62ab('0x6a')])&&_0x1d46a7[_0x62ab('0x6a')]&&!_['isNil'](this['trunks'][util['format'](_0x62ab('0x6b'),_0x1d46a7[_0x62ab('0x23')])])&&!_[_0x62ab('0x69')](this['trunks'][util[_0x62ab('0x62')](_0x62ab('0x6b'),_0x1d46a7['name'])][_0x62ab('0x2f')])&&(this[_0x62ab('0xf')][util[_0x62ab('0x62')](_0x62ab('0x6b'),_0x1d46a7[_0x62ab('0x23')])][_0x62ab('0x2f')]===_0x62ab('0x6c')||this[_0x62ab('0xf')][util[_0x62ab('0x62')](_0x62ab('0x6b'),_0x1d46a7[_0x62ab('0x23')])]['status']===_0x62ab('0x6d'));};Fax[_0x62ab('0x2c')]['checkTrunk']=function(_0x110161,_0x5c5c88){if(!this[_0x62ab('0x68')](_0x110161)){ut['logger'](_0x62ab('0x6e'),_[_0x62ab('0x69')](_0x110161)?'':_0x110161[_0x62ab('0x23')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x62ab('0x69')](_0x5c5c88[_0x62ab('0x6')])){ut[_0x62ab('0x4a')](_0x62ab('0x6f'),JSON[_0x62ab('0x42')](_0x5c5c88));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x62ab('0x69')](_0x5c5c88[_0x62ab('0x4')])){ut[_0x62ab('0x4a')](_0x62ab('0x70'),JSON[_0x62ab('0x42')](_0x5c5c88));return{'isValid':![],'message':_0x62ab('0x71')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x62ab('0x72')]=Fax; \ No newline at end of file +var _0x74d1=['SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','util','lodash','bluebird','uuid','moment','tiff2pdf','./util/gs','../ami','./rpcDb','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncHangup','originateresponse','prototype','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','syncNewExten','value','operation','status','filename','syncReceiveFax','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','fax','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','syncOriginateResponse','pick','response','reason','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','Trunk\x20Reachable','format','path','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active'];(function(_0x2288e9,_0x15e163){var _0x24bec9=function(_0xf4dd47){while(--_0xf4dd47){_0x2288e9['push'](_0x2288e9['shift']());}};_0x24bec9(++_0x15e163);}(_0x74d1,0xf3));var _0x174d=function(_0x37f07d,_0x17c557){_0x37f07d=_0x37f07d-0x0;var _0x4adfba=_0x74d1[_0x37f07d];return _0x4adfba;};'use strict';var util=require(_0x174d('0x0'));var _=require(_0x174d('0x1'));var BPromise=require(_0x174d('0x2'));var uuid=require(_0x174d('0x3'));var moment=require(_0x174d('0x4'));var path=require('path');var tiff2pdf=require(_0x174d('0x5'));var gs=require(_0x174d('0x6'));var logger=require('../../../config/logger')('fax');var ami=require(_0x174d('0x7'));var rpcDb=require(_0x174d('0x8'));var Channel=require('./channel');var ut=require(_0x174d('0x9'));var Action=require('./action');var faxAccount=require(_0x174d('0xa'));var attachment=require(_0x174d('0xb'));var faxMessage=require(_0x174d('0xc'));function Fax(_0x6f5abe){this['channels']={};this[_0x174d('0xd')]=_0x6f5abe[_0x174d('0xd')];this[_0x174d('0xe')]=_0x6f5abe[_0x174d('0xe')];this[_0x174d('0xf')]={};ami['on'](_0x174d('0x10'),this['syncNewchannel'][_0x174d('0x11')](this));ami['on'](_0x174d('0x12'),this[_0x174d('0x13')][_0x174d('0x11')](this));ami['on'](_0x174d('0x14'),this[_0x174d('0x15')][_0x174d('0x11')](this));ami['on'](_0x174d('0x16'),this['syncNewExten'][_0x174d('0x11')](this));ami['on'](_0x174d('0x17'),this[_0x174d('0x18')][_0x174d('0x11')](this));ami['on'](_0x174d('0x19'),this['syncReceiveFax'][_0x174d('0x11')](this));ami['on']('hangup',this[_0x174d('0x1a')][_0x174d('0x11')](this));ami['on'](_0x174d('0x1b'),this['syncOriginateResponse'][_0x174d('0x11')](this));}Fax[_0x174d('0x1c')]['syncNewchannel']=function(_0x158667){if(_0x158667['context']==='from-voip-provider'){for(var _0x1d341f in this[_0x174d('0xd')]){if(this[_0x174d('0xd')][_0x174d('0x1d')](_0x1d341f)){if(_0x158667[_0x174d('0x1e')]===this[_0x174d('0xd')][_0x1d341f][_0x174d('0x1f')]){this[_0x174d('0x20')][_0x158667['uniqueid']]={};this[_0x174d('0x20')][_0x158667[_0x174d('0x21')]][_0x174d('0x22')]=_0x158667[_0x174d('0x22')];this['channels'][_0x158667[_0x174d('0x21')]]['id']=this['faxAccounts'][_0x1d341f]['id'];this[_0x174d('0x20')][_0x158667[_0x174d('0x21')]][_0x174d('0x23')]=this[_0x174d('0xd')][_0x1d341f]['name'];logger[_0x174d('0x24')](_0x158667[_0x174d('0x21')],_0x174d('0x25'));}}}}if(this['actions'][_0x158667[_0x174d('0x21')]]){this[_0x174d('0x20')][_0x158667[_0x174d('0x21')]]={};this[_0x174d('0x20')][_0x158667['uniqueid']][_0x174d('0x22')]=_0x158667[_0x174d('0x22')];logger[_0x174d('0x24')](_0x158667[_0x174d('0x21')],_0x174d('0x25'));}};Fax['prototype']['syncVarSet']=function(_0x38b36d){if(this[_0x174d('0x20')][_0x38b36d[_0x174d('0x21')]]){for(var _0x4766d6 in _0x38b36d[_0x174d('0x26')]){if(_0x38b36d[_0x174d('0x26')]['hasOwnProperty'](_0x4766d6)){this[_0x174d('0x20')][_0x38b36d[_0x174d('0x21')]][_0x4766d6]=_0x38b36d['value'];}}}};Fax['prototype'][_0x174d('0x15')]=function(_0x3087dd){if(this[_0x174d('0x20')][_0x3087dd[_0x174d('0x21')]]){this[_0x174d('0x20')][_0x3087dd['uniqueid']][_0x174d('0x27')]=_0x3087dd[_0x174d('0x27')];this[_0x174d('0x20')][_0x3087dd[_0x174d('0x21')]][_0x174d('0x28')]=_0x3087dd['channelstatedesc'];}};Fax[_0x174d('0x1c')][_0x174d('0x29')]=function(_0x560cd9){if(this[_0x174d('0x20')][_0x560cd9[_0x174d('0x21')]]){for(var _0x223525 in _0x560cd9['variable']){if(_0x560cd9[_0x174d('0x26')][_0x174d('0x1d')](_0x223525)){this['channels'][_0x560cd9[_0x174d('0x21')]][_0x223525]=_0x560cd9[_0x174d('0x2a')];}}}};Fax[_0x174d('0x1c')][_0x174d('0x18')]=function(_0x28547b){if(this['channels'][_0x28547b[_0x174d('0x21')]]){this['channels'][_0x28547b[_0x174d('0x21')]][_0x174d('0x2b')]=_0x28547b['operation'];this['channels'][_0x28547b[_0x174d('0x21')]][_0x174d('0x2c')]=_0x28547b[_0x174d('0x2c')];this['channels'][_0x28547b[_0x174d('0x21')]][_0x174d('0x1f')]=_0x28547b[_0x174d('0x1f')];this[_0x174d('0x20')][_0x28547b[_0x174d('0x21')]][_0x174d('0x2d')]=_0x28547b[_0x174d('0x2d')];logger[_0x174d('0x24')](_0x28547b[_0x174d('0x21')],'\x20syncFaxStatus\x20');}};Fax[_0x174d('0x1c')][_0x174d('0x2e')]=function(_0x5b8dc0){var _0x4c2c70=this;if(this['channels'][_0x5b8dc0[_0x174d('0x21')]]){var _0x3b8edf=this[_0x174d('0x20')][_0x5b8dc0['uniqueid']]['id'];this[_0x174d('0x20')][_0x5b8dc0[_0x174d('0x21')]]['remotestationid']=_0x5b8dc0['remotestationid'];this['channels'][_0x5b8dc0[_0x174d('0x21')]]['pagestransferred']=_0x5b8dc0[_0x174d('0x2f')];this['channels'][_0x5b8dc0[_0x174d('0x21')]][_0x174d('0x1f')]=_0x5b8dc0[_0x174d('0x1f')];this[_0x174d('0x20')][_0x5b8dc0[_0x174d('0x21')]][_0x174d('0x30')]=_0x5b8dc0[_0x174d('0x30')];this[_0x174d('0x20')][_0x5b8dc0[_0x174d('0x21')]][_0x174d('0x31')]=_0x5b8dc0['transferrate'];this[_0x174d('0x20')][_0x5b8dc0['uniqueid']][_0x174d('0x2d')]=_0x5b8dc0[_0x174d('0x2d')];this[_0x174d('0x20')][_0x5b8dc0[_0x174d('0x21')]][_0x174d('0x32')]=_0x5b8dc0[_0x174d('0x32')];if(this[_0x174d('0x20')][_0x5b8dc0['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x5b8dc0[_0x174d('0x2d')],_0x174d('0x33'),function(_0x3a3938){logger[_0x174d('0x24')](_0x5b8dc0[_0x174d('0x21')],_0x174d('0x34'),_0x3a3938[_0x174d('0x35')]);attachment[_0x174d('0x36')]({'name':path[_0x174d('0x37')](_0x5b8dc0['filename'])['name'],'basename':path['parse'](_0x5b8dc0[_0x174d('0x2d')])[_0x174d('0x23')]+_0x174d('0x38'),'type':_0x174d('0x39')})[_0x174d('0x3a')](function(_0x44e2bf){faxAccount['notify'](_0x3b8edf,{'from':_0x5b8dc0[_0x174d('0x32')],'mapKey':_0x174d('0x3b'),'body':path[_0x174d('0x37')](_0x5b8dc0[_0x174d('0x2d')])[_0x174d('0x23')]+_0x174d('0x38'),'AttachmentId':_0x44e2bf['id']})[_0x174d('0x3c')](function(_0x30ef06){logger['error'](_0x5b8dc0[_0x174d('0x21')],_0x174d('0x3d'),JSON[_0x174d('0x3e')](_0x30ef06));});})[_0x174d('0x3c')](function(_0x3f38dd){logger[_0x174d('0x3f')](_0x5b8dc0[_0x174d('0x21')],_0x174d('0x40'),JSON[_0x174d('0x3e')](_0x3f38dd));});});}logger[_0x174d('0x24')](_0x5b8dc0[_0x174d('0x21')],_0x174d('0x40'));}};Fax[_0x174d('0x1c')][_0x174d('0x41')]=function(_0x128da4){if(this[_0x174d('0xf')][_0x128da4[_0x174d('0x21')]]){_['merge'](this[_0x174d('0x20')][_0x128da4[_0x174d('0x21')]],_[_0x174d('0x42')](_0x128da4,[_0x174d('0x43'),_0x174d('0x44')]));}};function updateStatus(_0x12d395){if(_0x12d395[_0x174d('0x45')]){faxMessage[_0x174d('0x46')](_0x12d395[_0x174d('0x45')],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x58a810){ut[_0x174d('0x47')](_0x174d('0x48'),_0x58a810);})['catch'](function(_0x2fc606){ut['logger'](_0x174d('0x49'),_0x2fc606);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x174d('0x1c')][_0x174d('0x4a')]=function(_0xd23b36,_0x46dc2f,_0x5629b0){var _0x1e7ee6=this;var _0x1b2898={};if(_0x46dc2f){_0x1b2898={'read':_0x46dc2f};}else{_0x1b2898={'failMessage':_0x5629b0};}if(this[_0x174d('0xf')][_0xd23b36][_0x174d('0x45')]){faxMessage[_0x174d('0x46')](this[_0x174d('0xf')][_0xd23b36][_0x174d('0x45')],_0x1b2898)[_0x174d('0x3a')](function(_0x3e0018){ut[_0x174d('0x47')](_0x174d('0x4b'),_0x3e0018);})[_0x174d('0x3c')](function(_0x4b2071){ut[_0x174d('0x47')](_0x174d('0x4c'),_0x4b2071);})[_0x174d('0x4d')](function(){delete _0x1e7ee6[_0x174d('0x20')][_0xd23b36];delete _0x1e7ee6[_0x174d('0xf')][_0xd23b36];});}else{ut[_0x174d('0x47')](_0x174d('0x4e'));delete this[_0x174d('0x20')][_0xd23b36];delete this['actions'][_0xd23b36];}};Fax[_0x174d('0x1c')][_0x174d('0x1a')]=function(_0x2f8ae9){var _0x33ab76=this;if(this[_0x174d('0x20')][_0x2f8ae9[_0x174d('0x21')]]){if(this[_0x174d('0xf')][_0x2f8ae9[_0x174d('0x21')]]){this[_0x174d('0x20')][_0x2f8ae9['uniqueid']]['id']=this['actions'][_0x2f8ae9[_0x174d('0x21')]]['id'];this['channels'][_0x2f8ae9[_0x174d('0x21')]]['name']=this[_0x174d('0xf')][_0x2f8ae9[_0x174d('0x21')]]['name'];}logger['info'](_0x2f8ae9[_0x174d('0x21')],this[_0x174d('0xf')][_0x2f8ae9[_0x174d('0x21')]]?_0x174d('0x4f'):_0x174d('0x50'),JSON[_0x174d('0x3e')](this[_0x174d('0x20')][_0x2f8ae9['uniqueid']]));if(this[_0x174d('0xf')][_0x2f8ae9['uniqueid']]){if(this[_0x174d('0x20')][_0x2f8ae9[_0x174d('0x21')]]['faxpages']>0x0&&this[_0x174d('0x20')][_0x2f8ae9[_0x174d('0x21')]]['faxstatus']===_0x174d('0x51')){this[_0x174d('0x4a')](_0x2f8ae9[_0x174d('0x21')],!![]);}else{this[_0x174d('0x4a')](_0x2f8ae9[_0x174d('0x21')],![],this[_0x174d('0x20')][_0x2f8ae9[_0x174d('0x21')]]['faxstatusstring']?_0x174d('0x52')+this[_0x174d('0x20')][_0x2f8ae9[_0x174d('0x21')]][_0x174d('0x53')]:_0x174d('0x54'));}}}};Fax['prototype'][_0x174d('0x55')]=function(_0xa1633c){var _0x4049cb=this;return new BPromise(function(_0x2cf5fe,_0x8bfe89){_0x4049cb[_0x174d('0x56')](_0xa1633c,_0x4049cb[_0x174d('0xd')][_0xa1633c['FaxAccountId']])[_0x174d('0x3a')](function(_0x79fc4f){ut[_0x174d('0x47')](_0x174d('0x57'),_0x79fc4f);_0x2cf5fe(ut[_0x174d('0x35')](_0x174d('0x58')));})['catch'](function(_0xcbe11){ut[_0x174d('0x47')](_0x174d('0x59'),_0xcbe11);updateStatus(_0xa1633c);_0x8bfe89(ut[_0x174d('0x35')](_0x174d('0x5a')));});});};Fax[_0x174d('0x1c')][_0x174d('0x5b')]=function(_0x131fe4){var _0x367623=this;return new BPromise(function(_0x1b777b,_0x2ed07e){var _0x367b99=_0x367623[_0x174d('0x5c')](_0x367623[_0x174d('0xd')][_0x131fe4[_0x174d('0x5d')]][_0x174d('0x5e')],_0x131fe4);if(_0x367b99['isValid']){_0x1b777b(ut[_0x174d('0x35')](_0x174d('0x5f')));}else{_0x2ed07e(ut[_0x174d('0x35')](_0x367b99[_0x174d('0x35')]));}});};function originate(_0x397cbb,_0x4de137,_0x3879be){return new BPromise(function(_0x16dc0c,_0x2f98cc){if(_0x3879be){var _0x543b96=util[_0x174d('0x60')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x174d('0x37')](_0x397cbb[_0x174d('0x61')])['name'],_0x397cbb['path']);gs['execute'](_0x543b96)[_0x174d('0x3a')](function(){_0x397cbb[_0x174d('0x61')]=util[_0x174d('0x60')](_0x174d('0x62'),path[_0x174d('0x37')](_0x397cbb[_0x174d('0x61')])[_0x174d('0x63')],path['parse'](_0x397cbb[_0x174d('0x61')])[_0x174d('0x23')]);_0x4de137[_0x174d('0x64')]=_0x397cbb[_0x174d('0x61')];ut[_0x174d('0x47')](_0x174d('0x65'),'');ami[_0x174d('0x66')](ut[_0x174d('0x67')](_0x397cbb,_0x4de137))[_0x174d('0x3a')](function(_0x5f29d2){_0x16dc0c(_0x5f29d2);})['catch'](function(_0x426544){_0x2f98cc(_0x426544);});})[_0x174d('0x3c')](function(_0x1feff2){_0x2f98cc(_0x1feff2);});}else{ami[_0x174d('0x66')](ut[_0x174d('0x67')](_0x397cbb,_0x4de137))['then'](function(_0x226742){_0x16dc0c(_0x226742);})[_0x174d('0x3c')](function(_0x85c2a4){_0x2f98cc(_0x85c2a4);});}});}Fax[_0x174d('0x1c')][_0x174d('0x56')]=function(_0x3b0078,_0x150ee4){var _0x4d1966=this;return new BPromise(function(_0x5e7a44,_0xcac81){var _0x9f2595=uuid['v4']();var _0x35ee21=ut[_0x174d('0x68')](_0x3b0078,_0x150ee4);_0x4d1966[_0x174d('0xf')][_0x9f2595]=new Action(_0x9f2595,_0x150ee4,_0x3b0078);var _0x46908c=_0x4d1966[_0x174d('0xf')][_0x9f2595];if(path[_0x174d('0x37')](_0x3b0078[_0x174d('0x61')])['ext']===_0x174d('0x38')){originate(_0x46908c,_0x35ee21,!![])[_0x174d('0x3a')](function(_0x2b475e){_0x5e7a44(_0x2b475e);})[_0x174d('0x3c')](function(_0x186104){_0xcac81(_0x186104);});}else{originate(_0x46908c,_0x35ee21,![])[_0x174d('0x3a')](function(_0x3be052){_0x5e7a44(_0x3be052);})[_0x174d('0x3c')](function(_0xc39a88){_0xcac81(_0xc39a88);});}});};Fax[_0x174d('0x1c')][_0x174d('0x69')]=function(_0x1357a8){return!_[_0x174d('0x6a')](_0x1357a8)&&!_['isNil'](_0x1357a8[_0x174d('0x23')])&&!_[_0x174d('0x6a')](_0x1357a8['active'])&&_0x1357a8[_0x174d('0x6b')]&&!_[_0x174d('0x6a')](this[_0x174d('0xe')][util['format']('SIP/%s',_0x1357a8[_0x174d('0x23')])])&&!_[_0x174d('0x6a')](this[_0x174d('0xe')][util['format'](_0x174d('0x6c'),_0x1357a8['name'])][_0x174d('0x2c')])&&(this[_0x174d('0xe')][util[_0x174d('0x60')](_0x174d('0x6c'),_0x1357a8[_0x174d('0x23')])]['status']==='reachable'||this[_0x174d('0xe')][util[_0x174d('0x60')](_0x174d('0x6c'),_0x1357a8[_0x174d('0x23')])][_0x174d('0x2c')]===_0x174d('0x6d'));};Fax[_0x174d('0x1c')]['checkTrunk']=function(_0x1cafa4,_0x3fd1c1){if(!this['isTrunkReachable'](_0x1cafa4)){ut[_0x174d('0x47')](_0x174d('0x6e'),_[_0x174d('0x6a')](_0x1cafa4)?'':_0x1cafa4[_0x174d('0x23')]+_0x174d('0x6f'));return{'isValid':![],'message':_0x174d('0x70')};}if(_[_0x174d('0x6a')](_0x3fd1c1['fax'])){ut[_0x174d('0x47')](_0x174d('0x71'),JSON['stringify'](_0x3fd1c1));return{'isValid':![],'message':_0x174d('0x72')};}if(_[_0x174d('0x6a')](_0x3fd1c1[_0x174d('0x61')])){ut[_0x174d('0x47')](_0x174d('0x73'),JSON[_0x174d('0x3e')](_0x3fd1c1));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x174d('0x74')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index a3d48c3..ffa3296 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 _0x83d1=['catch','util','../../../config/logger','preview','lodash','../rpc/faxAccount','error','notify','resolve','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x83d1,0x187));var _0x183d=function(_0x4763e0,_0x4c6d52){_0x4763e0=_0x4763e0-0x0;var _0x2f955b=_0x83d1[_0x4763e0];return _0x2f955b;};'use strict';var util=require(_0x183d('0x0'));var BPromise=require('bluebird');var logger=require(_0x183d('0x1'))(_0x183d('0x2'));var _=require(_0x183d('0x3'));var faxAccount=require(_0x183d('0x4'));function loggerCatch(_0x45366d){return function(_0x547e42){logger[_0x183d('0x5')](_0x45366d,util['inspect'](_0x547e42,{'showHidden':![],'depth':null}));};}exports[_0x183d('0x6')]=function(_0x2a621b,_0x3341a7){return BPromise[_0x183d('0x7')]()[_0x183d('0x8')](faxAccount[_0x183d('0x6')](_0x2a621b,_0x3341a7))[_0x183d('0x9')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x7ffe=['notify','catch','[Notify]\x20','bluebird','preview','lodash','inspect'];(function(_0x1cb30f,_0x26305c){var _0x20f7d7=function(_0x2f84c2){while(--_0x2f84c2){_0x1cb30f['push'](_0x1cb30f['shift']());}};_0x20f7d7(++_0x26305c);}(_0x7ffe,0xe3));var _0xe7ff=function(_0x213502,_0x22ede6){_0x213502=_0x213502-0x0;var _0x40abef=_0x7ffe[_0x213502];return _0x40abef;};'use strict';var util=require('util');var BPromise=require(_0xe7ff('0x0'));var logger=require('../../../config/logger')(_0xe7ff('0x1'));var _=require(_0xe7ff('0x2'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x4595a1){return function(_0x38f98c){logger['error'](_0x4595a1,util[_0xe7ff('0x3')](_0x38f98c,{'showHidden':![],'depth':null}));};}exports[_0xe7ff('0x4')]=function(_0x286746,_0x28c100){return BPromise['resolve']()['then'](faxAccount['notify'](_0x286746,_0x28c100))[_0xe7ff('0x5')](loggerCatch(_0xe7ff('0x6')));}; \ 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 c145cc6..dc9cbcf 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 _0x6790=['\x20Error\x20:','inspect','util','../../../../config/logger','fax','child_process','exec','execute','info','Exec\x20gs'];(function(_0x338224,_0x1fb425){var _0x1d5fc5=function(_0x27cc96){while(--_0x27cc96){_0x338224['push'](_0x338224['shift']());}};_0x1d5fc5(++_0x1fb425);}(_0x6790,0xd4));var _0x0679=function(_0x3e4d85,_0x216dde){_0x3e4d85=_0x3e4d85-0x0;var _0x2e8e37=_0x6790[_0x3e4d85];return _0x2e8e37;};'use strict';var util=require(_0x0679('0x0'));var logger=require(_0x0679('0x1'))(_0x0679('0x2'));var BPromise=require('bluebird');var exec=require(_0x0679('0x3'))[_0x0679('0x4')];exports[_0x0679('0x5')]=function(_0x545511){return new BPromise(function(_0x1f565f,_0x1b248b){exec(_0x545511,function(_0x14b5f5,_0x389f0e,_0x599bbb){logger[_0x0679('0x6')](_0x0679('0x7'),_0x389f0e);if(_0x14b5f5){logger[_0x0679('0x6')](_0x0679('0x7'),_0x0679('0x8'),util[_0x0679('0x9')](_0x14b5f5,{'showHidden':![],'depth':null}),_0x389f0e,_0x599bbb);_0x1b248b(_0x14b5f5);}_0x1f565f(_0x389f0e);});});}; \ No newline at end of file +var _0x088e=['fax','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger'];(function(_0x1b39eb,_0xe33080){var _0x4fe80e=function(_0x97a66d){while(--_0x97a66d){_0x1b39eb['push'](_0x1b39eb['shift']());}};_0x4fe80e(++_0xe33080);}(_0x088e,0x19e));var _0xe088=function(_0x3d413e,_0x171704){_0x3d413e=_0x3d413e-0x0;var _0xdd0519=_0x088e[_0x3d413e];return _0xdd0519;};'use strict';var util=require(_0xe088('0x0'));var logger=require(_0xe088('0x1'))(_0xe088('0x2'));var BPromise=require('bluebird');var exec=require('child_process')['exec'];exports[_0xe088('0x3')]=function(_0x5d1c77){return new BPromise(function(_0x3bcad2,_0x3ec94b){exec(_0x5d1c77,function(_0xe5792d,_0x1d1720,_0x48c517){logger[_0xe088('0x4')](_0xe088('0x5'),_0x1d1720);if(_0xe5792d){logger[_0xe088('0x4')](_0xe088('0x5'),_0xe088('0x6'),util[_0xe088('0x7')](_0xe5792d,{'showHidden':![],'depth':null}),_0x1d1720,_0x48c517);_0x3ec94b(_0xe5792d);}_0x3bcad2(_0x1d1720);});});}; \ 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 5afdbe4..0542e7b 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 _0x57f8=['path','variablesAction','uniqueid','originate','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','minrate','maxrate','format','modem','gateway','faxdetect','localstationid'];(function(_0x5a4373,_0x41f540){var _0x36f89c=function(_0x2a8ef1){while(--_0x2a8ef1){_0x5a4373['push'](_0x5a4373['shift']());}};_0x36f89c(++_0x41f540);}(_0x57f8,0x198));var _0x857f=function(_0x4f6037,_0x8e0a90){_0x4f6037=_0x4f6037-0x0;var _0x2542e2=_0x57f8[_0x4f6037];return _0x2542e2;};'use strict';var util=require('util');var _=require(_0x857f('0x0'));var moment=require(_0x857f('0x1'));var logger=require(_0x857f('0x2'))(_0x857f('0x3'));exports[_0x857f('0x4')]=function(_0x27b98d){return{'message':_0x27b98d};};exports[_0x857f('0x5')]=function(_0x6f054b,_0x318050){logger[_0x857f('0x6')](_0x6f054b,util[_0x857f('0x7')](_0x318050,{'showHidden':![],'depth':null}));};exports[_0x857f('0x8')]=function(_0x5d22e4,_0x8380e8){var _0x197098={'XMF-ECM':_0x8380e8[_0x857f('0x9')],'XMF-HEADERINFO':_0x8380e8['headerinfo'],'XMF-MINRATE':_0x8380e8[_0x857f('0xa')],'XMF-MAXRATE':_0x8380e8[_0x857f('0xb')],'XMF-MODEM':util[_0x857f('0xc')]('\x22%s\x22',_0x8380e8[_0x857f('0xd')]),'XMF-GATEWAY':_0x8380e8[_0x857f('0xe')],'XMF-FAXDETECT':_0x8380e8[_0x857f('0xf')],'XMF-T38TIMEOUT':_0x8380e8['t38timeout'],'XMF-LOCALSTATIONID':_0x8380e8[_0x857f('0x10')],'XMF-PATH':_0x5d22e4[_0x857f('0x11')]};return _0x197098;};exports[_0x857f('0x12')]=function(_0x11adfd,_0x268f9d){return{'actionid':_0x11adfd[_0x857f('0x13')],'action':_0x857f('0x14'),'channel':_0x11adfd['channel'],'Exten':_0x857f('0x15'),'Context':_0x857f('0x16'),'Priority':'1','callerid':util[_0x857f('0xc')](_0x857f('0x17'),_0x11adfd[_0x857f('0x18')]?_0x11adfd['headerinfo']:'',_0x11adfd['localstationid']),'variable':_0x268f9d,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x11adfd[_0x857f('0x13')]};}; \ No newline at end of file +var _0x9c44=['variablesAction','uniqueid','originate','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','localstationid','moment','../../../../config/logger','fax','message','logger','info','addVariables','ecm','minrate','maxrate','format','\x22%s\x22','faxdetect','t38timeout','path'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x49c4('0x0'));var logger=require(_0x49c4('0x1'))(_0x49c4('0x2'));exports[_0x49c4('0x3')]=function(_0x455700){return{'message':_0x455700};};exports[_0x49c4('0x4')]=function(_0x4e0313,_0x4941f1){logger[_0x49c4('0x5')](_0x4e0313,util['inspect'](_0x4941f1,{'showHidden':![],'depth':null}));};exports[_0x49c4('0x6')]=function(_0x6030ae,_0x69bc41){var _0x2c4e2e={'XMF-ECM':_0x69bc41[_0x49c4('0x7')],'XMF-HEADERINFO':_0x69bc41['headerinfo'],'XMF-MINRATE':_0x69bc41[_0x49c4('0x8')],'XMF-MAXRATE':_0x69bc41[_0x49c4('0x9')],'XMF-MODEM':util[_0x49c4('0xa')](_0x49c4('0xb'),_0x69bc41['modem']),'XMF-GATEWAY':_0x69bc41['gateway'],'XMF-FAXDETECT':_0x69bc41[_0x49c4('0xc')],'XMF-T38TIMEOUT':_0x69bc41[_0x49c4('0xd')],'XMF-LOCALSTATIONID':_0x69bc41['localstationid'],'XMF-PATH':_0x6030ae[_0x49c4('0xe')]};return _0x2c4e2e;};exports[_0x49c4('0xf')]=function(_0x4adb3c,_0x536d42){return{'actionid':_0x4adb3c[_0x49c4('0x10')],'action':_0x49c4('0x11'),'channel':_0x4adb3c['channel'],'Exten':_0x49c4('0x12'),'Context':_0x49c4('0x13'),'Priority':'1','callerid':util['format'](_0x49c4('0x14'),_0x4adb3c[_0x49c4('0x15')]?_0x4adb3c[_0x49c4('0x15')]:'',_0x4adb3c[_0x49c4('0x16')]),'variable':_0x536d42,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4adb3c[_0x49c4('0x10')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index a58d1aa..970a7b5 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 _0x33f8=['getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','get','hour','resolve','then','initAgents','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts'];(function(_0x182416,_0x5874bc){var _0x5b4e3d=function(_0x980316){while(--_0x980316){_0x182416['push'](_0x182416['shift']());}};_0x5b4e3d(++_0x5874bc);}(_0x33f8,0x172));var _0x833f=function(_0x5c3d46,_0x459758){_0x5c3d46=_0x5c3d46-0x0;var _0x2f279e=_0x33f8[_0x5c3d46];return _0x2f279e;};'use strict';var BPromise=require(_0x833f('0x0'));var util=require(_0x833f('0x1'));var moment=require(_0x833f('0x2'));var server=require(_0x833f('0x3'));var Realtime=require(_0x833f('0x4'));var Report=require(_0x833f('0x5'));var Acw=require(_0x833f('0x6'));var Trigger=require(_0x833f('0x7'));var Dialer=require(_0x833f('0x8'));var Preview=require(_0x833f('0x9'));var Fax=require('./fax');var user=require(_0x833f('0xa'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x833f('0xb'));var voiceCallReport=require(_0x833f('0xc'));var trunk=require(_0x833f('0xd'));var trigger=require('./rpc/trigger');var template=require(_0x833f('0xe'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0x833f('0xf'));var faxAccount=require(_0x833f('0x10'));var zendesk=require(_0x833f('0x11'));var salesforce=require(_0x833f('0x12'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x833f('0x13'));var desk=require(_0x833f('0x14'));var zoho=require(_0x833f('0x15'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x833f('0x16'));var servicenow=require(_0x833f('0x17'));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()[_0x833f('0x18')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x833f('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x833f('0x1a')]()[_0x833f('0x1b')](user['getAgents']())[_0x833f('0x1b')](realtime[_0x833f('0x1c')]())[_0x833f('0x1b')](user['getTelephones']())[_0x833f('0x1b')](realtime[_0x833f('0x1d')]())['then'](trunk[_0x833f('0x1e')]())[_0x833f('0x1b')](realtime[_0x833f('0x1f')]())['then'](voiceQueue['getVoiceQueues']())[_0x833f('0x1b')](realtime[_0x833f('0x20')]())[_0x833f('0x1b')](trigger[_0x833f('0x21')]())[_0x833f('0x1b')](realtime[_0x833f('0x22')]())['then'](template[_0x833f('0x23')]())[_0x833f('0x1b')](realtime[_0x833f('0x24')]())['then'](zendesk['getZendeskAccounts']())[_0x833f('0x1b')](realtime[_0x833f('0x25')]())['then'](salesforce[_0x833f('0x26')]())[_0x833f('0x1b')](realtime[_0x833f('0x27')]())[_0x833f('0x1b')](sugarcrm[_0x833f('0x28')]())[_0x833f('0x1b')](realtime[_0x833f('0x29')]())[_0x833f('0x1b')](freshdesk[_0x833f('0x2a')]())[_0x833f('0x1b')](realtime[_0x833f('0x2b')]())[_0x833f('0x1b')](desk[_0x833f('0x2c')]())[_0x833f('0x1b')](realtime[_0x833f('0x2d')]())[_0x833f('0x1b')](zoho[_0x833f('0x2e')]())[_0x833f('0x1b')](realtime[_0x833f('0x2f')]())[_0x833f('0x1b')](vtiger[_0x833f('0x30')]())[_0x833f('0x1b')](realtime[_0x833f('0x31')]())[_0x833f('0x1b')](freshsales[_0x833f('0x32')]())[_0x833f('0x1b')](realtime[_0x833f('0x33')]())[_0x833f('0x1b')](servicenow[_0x833f('0x34')]())['then'](realtime[_0x833f('0x35')]())[_0x833f('0x1b')](dynamics365['getDynamics365Accounts']())['then'](realtime[_0x833f('0x36')]())['then'](campaign[_0x833f('0x37')]())['then'](realtime[_0x833f('0x38')]())[_0x833f('0x1b')](voiceExtension['getVoiceExtensions']())[_0x833f('0x1b')](realtime[_0x833f('0x39')]())[_0x833f('0x1b')](faxAccount[_0x833f('0x3a')]())[_0x833f('0x1b')](realtime[_0x833f('0x3b')]())[_0x833f('0x1b')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x833f('0x1b')](voiceQueueReport[_0x833f('0x3c')]())['then'](realtime[_0x833f('0x3d')]())[_0x833f('0x1b')](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime[_0x833f('0x3e')]())[_0x833f('0x1b')](cmHopperHistory[_0x833f('0x3f')]())[_0x833f('0x1b')](realtime[_0x833f('0x40')]())[_0x833f('0x1b')](voiceCallReport['getVoiceCallReports']())['then'](realtime[_0x833f('0x41')]())[_0x833f('0x1b')](function(_0x25343e){})[_0x833f('0x42')](function(_0x11b059){console[_0x833f('0x43')](_0x11b059);});}function main(){return server[_0x833f('0x44')](realtime,preview,fax)[_0x833f('0x1b')](function(_0x176c19){return initRealtime();})[_0x833f('0x1b')](function(){return initParams();})[_0x833f('0x1b')](function(){report[_0x833f('0x45')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x19197d){console[_0x833f('0x43')](_0x19197d);});}main(); \ No newline at end of file +var _0x4054=['initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','listen','sync','log','bluebird','util','moment','./server','./report','./acw','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/vtiger','get','hour','then','getAgents','initAgents','getTelephones','getTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts'];(function(_0x135040,_0x56930a){var _0x1ad9b9=function(_0x26aaef){while(--_0x26aaef){_0x135040['push'](_0x135040['shift']());}};_0x1ad9b9(++_0x56930a);}(_0x4054,0x1c3));var _0x4405=function(_0x2a184c,_0x23a7fb){_0x2a184c=_0x2a184c-0x0;var _0x2b65ac=_0x4054[_0x2a184c];return _0x2b65ac;};'use strict';var BPromise=require(_0x4405('0x0'));var util=require(_0x4405('0x1'));var moment=require(_0x4405('0x2'));var server=require(_0x4405('0x3'));var Realtime=require('./realtime');var Report=require(_0x4405('0x4'));var Acw=require(_0x4405('0x5'));var Trigger=require(_0x4405('0x6'));var Dialer=require(_0x4405('0x7'));var Preview=require('./preview');var Fax=require(_0x4405('0x8'));var user=require(_0x4405('0x9'));var voiceQueue=require(_0x4405('0xa'));var voiceQueueReport=require(_0x4405('0xb'));var voiceCallReport=require(_0x4405('0xc'));var trunk=require(_0x4405('0xd'));var trigger=require(_0x4405('0xe'));var template=require(_0x4405('0xf'));var cmHopperHistory=require(_0x4405('0x10'));var campaign=require(_0x4405('0x11'));var voiceExtension=require(_0x4405('0x12'));var faxAccount=require(_0x4405('0x13'));var zendesk=require(_0x4405('0x14'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x4405('0x15'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x4405('0x16'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x4405('0x17'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');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()[_0x4405('0x18')](_0x4405('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x4405('0x18')](_0x4405('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x4405('0x1a')](user[_0x4405('0x1b')]())['then'](realtime[_0x4405('0x1c')]())['then'](user[_0x4405('0x1d')]())[_0x4405('0x1a')](realtime['initTelephones']())[_0x4405('0x1a')](trunk[_0x4405('0x1e')]())[_0x4405('0x1a')](realtime['initTrunks']())[_0x4405('0x1a')](voiceQueue[_0x4405('0x1f')]())[_0x4405('0x1a')](realtime['initVoiceQueues']())[_0x4405('0x1a')](trigger[_0x4405('0x20')]())['then'](realtime[_0x4405('0x21')]())['then'](template[_0x4405('0x22')]())[_0x4405('0x1a')](realtime[_0x4405('0x23')]())['then'](zendesk[_0x4405('0x24')]())[_0x4405('0x1a')](realtime[_0x4405('0x25')]())[_0x4405('0x1a')](salesforce[_0x4405('0x26')]())[_0x4405('0x1a')](realtime[_0x4405('0x27')]())[_0x4405('0x1a')](sugarcrm['getSugarcrmAccounts']())[_0x4405('0x1a')](realtime[_0x4405('0x28')]())['then'](freshdesk[_0x4405('0x29')]())[_0x4405('0x1a')](realtime[_0x4405('0x2a')]())[_0x4405('0x1a')](desk[_0x4405('0x2b')]())['then'](realtime['initDeskAccounts']())[_0x4405('0x1a')](zoho['getZohoAccounts']())[_0x4405('0x1a')](realtime[_0x4405('0x2c')]())['then'](vtiger[_0x4405('0x2d')]())[_0x4405('0x1a')](realtime[_0x4405('0x2e')]())['then'](freshsales[_0x4405('0x2f')]())[_0x4405('0x1a')](realtime['initFreshsalesAccounts']())[_0x4405('0x1a')](servicenow[_0x4405('0x30')]())[_0x4405('0x1a')](realtime[_0x4405('0x31')]())[_0x4405('0x1a')](dynamics365[_0x4405('0x32')]())[_0x4405('0x1a')](realtime[_0x4405('0x33')]())['then'](campaign[_0x4405('0x34')]())['then'](realtime[_0x4405('0x35')]())[_0x4405('0x1a')](voiceExtension['getVoiceExtensions']())[_0x4405('0x1a')](realtime[_0x4405('0x36')]())['then'](faxAccount[_0x4405('0x37')]())[_0x4405('0x1a')](realtime[_0x4405('0x38')]())[_0x4405('0x1a')](function(){return realtime;});}function initParams(){return BPromise[_0x4405('0x39')]()[_0x4405('0x1a')](voiceQueueReport[_0x4405('0x3a')]())[_0x4405('0x1a')](realtime[_0x4405('0x3b')]())[_0x4405('0x1a')](cmHopperHistory[_0x4405('0x3c')]())[_0x4405('0x1a')](realtime[_0x4405('0x3d')]())[_0x4405('0x1a')](cmHopperHistory[_0x4405('0x3e')]())['then'](realtime[_0x4405('0x3f')]())['then'](voiceCallReport[_0x4405('0x40')]())[_0x4405('0x1a')](realtime[_0x4405('0x41')]())[_0x4405('0x1a')](function(_0x4250c7){})[_0x4405('0x42')](function(_0x5c1eb6){console['log'](_0x5c1eb6);});}function main(){return server[_0x4405('0x43')](realtime,preview,fax)['then'](function(_0x2e6801){return initRealtime();})[_0x4405('0x1a')](function(){return initParams();})[_0x4405('0x1a')](function(){report[_0x4405('0x44')]();setInterval(initRealtime,0x1388);})[_0x4405('0x42')](function(_0x54d90b){console[_0x4405('0x45')](_0x54d90b);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index c67462d..4983575 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 _0x85b1=['idle','inuse','talking','statePause','voiceStatusTime','voiceStatusQueue','interface','stringify','format','user:%s','emit','exports','lodash','util','moment','md5','ioredis','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','stateTime','status','unknown','address','phone','mobile','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','state','not_inuse'];(function(_0x4a09c6,_0x54ce5e){var _0x25d834=function(_0x272ccc){while(--_0x272ccc){_0x4a09c6['push'](_0x4a09c6['shift']());}};_0x25d834(++_0x54ce5e);}(_0x85b1,0x1e0));var _0x185b=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x85b1[_0x5627e1];return _0x2f013f;};'use strict';var _=require(_0x185b('0x0'));var util=require(_0x185b('0x1'));var moment=require(_0x185b('0x2'));var md5=require(_0x185b('0x3'));var Redis=require(_0x185b('0x4'));var config=require('../../../config/environment');config[_0x185b('0x5')]=_['defaults'](config['redis'],{'host':_0x185b('0x6'),'port':0x18eb});var io=require(_0x185b('0x7'))(new Redis(config[_0x185b('0x5')]));function Agent(_0x49f914){this['id']=_0x49f914['id']||0x0;this[_0x185b('0x8')]=_0x49f914[_0x185b('0x8')]||'';this[_0x185b('0x9')]=_0x49f914[_0x185b('0x9')]||'';this[_0x185b('0xa')]=_0x49f914[_0x185b('0xa')]||'';this[_0x185b('0xb')]=_0x49f914['fullname']||'';this['state']='unknown';this[_0x185b('0xc')]=0x0;this[_0x185b('0xd')]=_0x185b('0xe');this[_0x185b('0xf')]='';this[_0x185b('0x10')]='';this[_0x185b('0x11')]='';this['interface']='';this[_0x185b('0x12')]=_0x49f914[_0x185b('0x12')]||![];this[_0x185b('0x13')]=_0x185b('0xe');this['voiceStatusTime']=0x0;this[_0x185b('0x14')]='';this['voiceStatusQueue']='';this[_0x185b('0x15')]=![];this[_0x185b('0x16')]=![];this[_0x185b('0x3')]='';}Agent[_0x185b('0x17')][_0x185b('0x18')]=function(_0x58a32c){var _0x51c4f1;if(_0x58a32c&&_0x58a32c[_0x185b('0x19')]){_0x51c4f1=_0x58a32c['state']['toLowerCase']();switch(_0x51c4f1){case _0x185b('0x1a'):_0x51c4f1=_0x185b('0x1b');break;case _0x185b('0x1c'):_0x51c4f1=_0x185b('0x1d');break;}}if(_0x51c4f1&&this[_0x185b('0x13')]!==_0x51c4f1||_0x58a32c[_0x185b('0x1e')]){this[_0x185b('0x1f')]=_['toNumber'](moment()['format']('x'));}if(_0x51c4f1){this[_0x185b('0x13')]=_0x51c4f1;}var _0x45008b={'id':this['id'],'name':this[_0x185b('0x8')],'email':this[_0x185b('0x9')],'accountcode':this[_0x185b('0xa')],'fullname':this[_0x185b('0xb')],'state':this[_0x185b('0x19')],'stateTime':this[_0x185b('0xc')],'status':this[_0x185b('0xd')],'address':this['address'],'online':this[_0x185b('0x12')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x185b('0x1f')],'voiceStatusCallerIdNumber':this[_0x185b('0x14')],'voiceStatusQueue':this[_0x185b('0x20')],'interface':this[_0x185b('0x21')],'onhold':this[_0x185b('0x15')]};var _0x56c1de=md5(JSON[_0x185b('0x22')](_0x45008b));if(this[_0x185b('0x3')]!==_0x56c1de){this[_0x185b('0x3')]=_0x56c1de;io['to'](util[_0x185b('0x23')](_0x185b('0x24'),_0x45008b[_0x185b('0x8')]))[_0x185b('0x25')]('user:save',_0x45008b);}};module[_0x185b('0x26')]=Agent; \ No newline at end of file +var _0x67a4=['onhold','local','prototype','updateStatusRealtime','state','not_inuse','inuse','talking','toNumber','format','online','voiceStatusQueue','interface','stringify','user:%s','exports','lodash','moment','md5','ioredis','redis','defaults','localhost','name','email','accountcode','fullname','stateTime','status','unknown','address','phone','mobile','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber'];(function(_0x5df952,_0x3940da){var _0xf5400a=function(_0x882913){while(--_0x882913){_0x5df952['push'](_0x5df952['shift']());}};_0xf5400a(++_0x3940da);}(_0x67a4,0x10c));var _0x467a=function(_0x2fd160,_0x53c0d6){_0x2fd160=_0x2fd160-0x0;var _0x5c2031=_0x67a4[_0x2fd160];return _0x5c2031;};'use strict';var _=require(_0x467a('0x0'));var util=require('util');var moment=require(_0x467a('0x1'));var md5=require(_0x467a('0x2'));var Redis=require(_0x467a('0x3'));var config=require('../../../config/environment');config[_0x467a('0x4')]=_[_0x467a('0x5')](config[_0x467a('0x4')],{'host':_0x467a('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x467a('0x4')]));function Agent(_0x291c2f){this['id']=_0x291c2f['id']||0x0;this[_0x467a('0x7')]=_0x291c2f[_0x467a('0x7')]||'';this[_0x467a('0x8')]=_0x291c2f[_0x467a('0x8')]||'';this[_0x467a('0x9')]=_0x291c2f[_0x467a('0x9')]||'';this[_0x467a('0xa')]=_0x291c2f[_0x467a('0xa')]||'';this['state']='unknown';this[_0x467a('0xb')]=0x0;this[_0x467a('0xc')]=_0x467a('0xd');this[_0x467a('0xe')]='';this[_0x467a('0xf')]='';this[_0x467a('0x10')]='';this['interface']='';this['online']=_0x291c2f['online']||![];this[_0x467a('0x11')]=_0x467a('0xd');this[_0x467a('0x12')]=0x0;this[_0x467a('0x13')]='';this['voiceStatusQueue']='';this[_0x467a('0x14')]=![];this[_0x467a('0x15')]=![];this[_0x467a('0x2')]='';}Agent[_0x467a('0x16')][_0x467a('0x17')]=function(_0x1b6fbe){var _0x385b9e;if(_0x1b6fbe&&_0x1b6fbe['state']){_0x385b9e=_0x1b6fbe[_0x467a('0x18')]['toLowerCase']();switch(_0x385b9e){case _0x467a('0x19'):_0x385b9e='idle';break;case _0x467a('0x1a'):_0x385b9e=_0x467a('0x1b');break;}}if(_0x385b9e&&this[_0x467a('0x11')]!==_0x385b9e||_0x1b6fbe['statePause']){this[_0x467a('0x12')]=_[_0x467a('0x1c')](moment()[_0x467a('0x1d')]('x'));}if(_0x385b9e){this[_0x467a('0x11')]=_0x385b9e;}var _0x41d452={'id':this['id'],'name':this[_0x467a('0x7')],'email':this['email'],'accountcode':this[_0x467a('0x9')],'fullname':this[_0x467a('0xa')],'state':this[_0x467a('0x18')],'stateTime':this[_0x467a('0xb')],'status':this['status'],'address':this[_0x467a('0xe')],'online':this[_0x467a('0x1e')],'voiceStatus':this[_0x467a('0x11')],'voiceStatusTime':this[_0x467a('0x12')],'voiceStatusCallerIdNumber':this[_0x467a('0x13')],'voiceStatusQueue':this[_0x467a('0x1f')],'interface':this[_0x467a('0x20')],'onhold':this[_0x467a('0x14')]};var _0x53ba72=md5(JSON[_0x467a('0x21')](_0x41d452));if(this[_0x467a('0x2')]!==_0x53ba72){this['md5']=_0x53ba72;io['to'](util['format'](_0x467a('0x22'),_0x41d452[_0x467a('0x7')]))['emit']('user:save',_0x41d452);}};module[_0x467a('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 284da7f..f0556d6 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 _0x654a=['dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','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','name','type','campaign','originated','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0x654a,0xe8));var _0xa654=function(_0x18c2e7,_0x34bb35){_0x18c2e7=_0x18c2e7-0x0;var _0x3889ec=_0x654a[_0x18c2e7];return _0x3889ec;};'use strict';function Campaign(_0x50ce98){this['id']=_0x50ce98['id']||0x0;this[_0xa654('0x0')]=_0x50ce98[_0xa654('0x0')]||'';this[_0xa654('0x1')]=_0x50ce98[_0xa654('0x1')]||_0xa654('0x2');this[_0xa654('0x3')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0xa654('0x4')]='';this[_0xa654('0x5')]=!![];this[_0xa654('0x6')]=_0x50ce98[_0xa654('0x6')];this[_0xa654('0x7')]=_0x50ce98[_0xa654('0x7')];this[_0xa654('0x8')]=_0x50ce98[_0xa654('0x8')]||null;this[_0xa654('0x9')]=_0x50ce98['dialGlobalInterval']?_0x50ce98['dialGlobalInterval']:null;this[_0xa654('0xa')]=_0x50ce98['dialOriginateCallerIdName'];this[_0xa654('0xb')]=_0x50ce98[_0xa654('0xb')];this['dialOriginateTimeout']=_0x50ce98[_0xa654('0xc')]||0x1e;this['dialCongestionMaxRetry']=_0x50ce98[_0xa654('0xd')];this[_0xa654('0xe')]=_0x50ce98[_0xa654('0xe')];this[_0xa654('0xf')]=_0x50ce98[_0xa654('0xf')];this[_0xa654('0x10')]=_0x50ce98[_0xa654('0x10')];this['dialNoAnswerMaxRetry']=_0x50ce98[_0xa654('0x11')];this[_0xa654('0x12')]=_0x50ce98[_0xa654('0x12')];this[_0xa654('0x13')]=_0x50ce98[_0xa654('0x13')];this[_0xa654('0x14')]=_0x50ce98['dialNoSuchNumberMaxRetry']||0x3;this[_0xa654('0x15')]=_0x50ce98[_0xa654('0x15')]||0x96;this[_0xa654('0x16')]=_0x50ce98[_0xa654('0x16')]||0x3;this[_0xa654('0x17')]=_0x50ce98[_0xa654('0x17')]||0x96;this[_0xa654('0x18')]=_0x50ce98[_0xa654('0x18')]||0x3;this[_0xa654('0x19')]=_0x50ce98[_0xa654('0x19')]||0x96;this[_0xa654('0x1a')]=_0x50ce98['dialMachineMaxRetry']||0x3;this[_0xa654('0x1b')]=_0x50ce98['dialMachineRetryFrequency']||0x96;this[_0xa654('0x1c')]=_0x50ce98[_0xa654('0x1c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x50ce98[_0xa654('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x50ce98[_0xa654('0x1e')]||_0xa654('0x1f');this[_0xa654('0x20')]=_0x50ce98[_0xa654('0x20')]||undefined;this[_0xa654('0x21')]=_0x50ce98[_0xa654('0x21')]||undefined;this[_0xa654('0x22')]=_0x50ce98['dialCutDigit']||undefined;this[_0xa654('0x23')]=_0x50ce98[_0xa654('0x23')]?_0x50ce98[_0xa654('0x23')]:undefined;this[_0xa654('0x24')]=_0x50ce98[_0xa654('0x24')]?_0x50ce98[_0xa654('0x24')]:undefined;this['Interval']=_0x50ce98[_0xa654('0x25')]?_0x50ce98[_0xa654('0x25')]:undefined;this['SquareProject']=_0x50ce98[_0xa654('0x26')]?_0x50ce98[_0xa654('0x26')]:undefined;this['dialQueueProject']=_0x50ce98[_0xa654('0x26')]?_0x50ce98[_0xa654('0x26')][_0xa654('0x0')]:undefined;this[_0xa654('0x27')]=_0x50ce98[_0xa654('0x27')]||![];this[_0xa654('0x28')]=_0x50ce98[_0xa654('0x28')];this[_0xa654('0x29')]=_0x50ce98['dialAMDGreeting'];this[_0xa654('0x2a')]=_0x50ce98['dialAMDAfterGreetingSilence'];this[_0xa654('0x2b')]=_0x50ce98[_0xa654('0x2b')];this[_0xa654('0x2c')]=_0x50ce98[_0xa654('0x2c')];this[_0xa654('0x2d')]=_0x50ce98[_0xa654('0x2d')];this[_0xa654('0x2e')]=_0x50ce98[_0xa654('0x2e')];this[_0xa654('0x2f')]=_0x50ce98[_0xa654('0x2f')];this[_0xa654('0x30')]=_0x50ce98['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file +var _0xbaf0=['dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','name'];(function(_0x4ef403,_0x5d4dff){var _0x467aa7=function(_0x2fcfbc){while(--_0x2fcfbc){_0x4ef403['push'](_0x4ef403['shift']());}};_0x467aa7(++_0x5d4dff);}(_0xbaf0,0x1e7));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';function Campaign(_0x29edbf){this['id']=_0x29edbf['id']||0x0;this['name']=_0x29edbf['name']||'';this['type']=_0x29edbf[_0x0baf('0x0')]||_0x0baf('0x1');this[_0x0baf('0x2')]=0x0;this[_0x0baf('0x3')]=0x0;this[_0x0baf('0x4')]=0x0;this[_0x0baf('0x5')]=0x0;this[_0x0baf('0x6')]='';this[_0x0baf('0x7')]=!![];this[_0x0baf('0x8')]=_0x29edbf[_0x0baf('0x8')];this[_0x0baf('0x9')]=_0x29edbf['limitCalls'];this[_0x0baf('0xa')]=_0x29edbf[_0x0baf('0xa')]||null;this[_0x0baf('0xb')]=_0x29edbf[_0x0baf('0xb')]?_0x29edbf[_0x0baf('0xb')]:null;this[_0x0baf('0xc')]=_0x29edbf[_0x0baf('0xc')];this[_0x0baf('0xd')]=_0x29edbf[_0x0baf('0xd')];this['dialOriginateTimeout']=_0x29edbf[_0x0baf('0xe')]||0x1e;this[_0x0baf('0xf')]=_0x29edbf[_0x0baf('0xf')];this[_0x0baf('0x10')]=_0x29edbf[_0x0baf('0x10')];this[_0x0baf('0x11')]=_0x29edbf[_0x0baf('0x11')];this[_0x0baf('0x12')]=_0x29edbf[_0x0baf('0x12')];this[_0x0baf('0x13')]=_0x29edbf[_0x0baf('0x13')];this[_0x0baf('0x14')]=_0x29edbf[_0x0baf('0x14')];this[_0x0baf('0x15')]=_0x29edbf['dialGlobalMaxRetry'];this[_0x0baf('0x16')]=_0x29edbf['dialNoSuchNumberMaxRetry']||0x3;this[_0x0baf('0x17')]=_0x29edbf[_0x0baf('0x17')]||0x96;this[_0x0baf('0x18')]=_0x29edbf['dialDropMaxRetry']||0x3;this[_0x0baf('0x19')]=_0x29edbf['dialDropRetryFrequency']||0x96;this[_0x0baf('0x1a')]=_0x29edbf[_0x0baf('0x1a')]||0x3;this[_0x0baf('0x1b')]=_0x29edbf[_0x0baf('0x1b')]||0x96;this[_0x0baf('0x1c')]=_0x29edbf[_0x0baf('0x1c')]||0x3;this[_0x0baf('0x1d')]=_0x29edbf[_0x0baf('0x1d')]||0x96;this[_0x0baf('0x1e')]=_0x29edbf[_0x0baf('0x1e')]||0x3;this[_0x0baf('0x1f')]=_0x29edbf[_0x0baf('0x1f')]||0x96;this[_0x0baf('0x20')]=_0x29edbf[_0x0baf('0x20')]||_0x0baf('0x21');this['dialPrefix']=_0x29edbf[_0x0baf('0x22')]||undefined;this[_0x0baf('0x23')]=_0x29edbf[_0x0baf('0x23')]||undefined;this[_0x0baf('0x24')]=_0x29edbf[_0x0baf('0x24')]||undefined;this[_0x0baf('0x25')]=_0x29edbf['TrunkBackup']?_0x29edbf[_0x0baf('0x25')]:undefined;this[_0x0baf('0x26')]=_0x29edbf[_0x0baf('0x26')]?_0x29edbf[_0x0baf('0x26')]:undefined;this[_0x0baf('0x27')]=_0x29edbf[_0x0baf('0x27')]?_0x29edbf[_0x0baf('0x27')]:undefined;this['SquareProject']=_0x29edbf[_0x0baf('0x28')]?_0x29edbf[_0x0baf('0x28')]:undefined;this[_0x0baf('0x29')]=_0x29edbf[_0x0baf('0x28')]?_0x29edbf['SquareProject'][_0x0baf('0x2a')]:undefined;this['dialAMDActive']=_0x29edbf[_0x0baf('0x2b')]||![];this[_0x0baf('0x2c')]=_0x29edbf[_0x0baf('0x2c')];this[_0x0baf('0x2d')]=_0x29edbf[_0x0baf('0x2d')];this[_0x0baf('0x2e')]=_0x29edbf['dialAMDAfterGreetingSilence'];this[_0x0baf('0x2f')]=_0x29edbf['dialAMDTotalAnalysisTime'];this[_0x0baf('0x30')]=_0x29edbf[_0x0baf('0x30')];this['dialAMDBetweenWordsSilence']=_0x29edbf['dialAMDBetweenWordsSilence'];this[_0x0baf('0x31')]=_0x29edbf[_0x0baf('0x31')];this[_0x0baf('0x32')]=_0x29edbf[_0x0baf('0x32')];this['dialAMDMaximumWordLength']=_0x29edbf[_0x0baf('0x33')];}module[_0x0baf('0x34')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index dc7ba3a..895558b 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 _0xafa7=['exten','answered','answertime','endtime','unmanaged','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','calleridnum','connectedlinenum','connectedlinename','accountcode','linkedid'];(function(_0x30399b,_0x3fdbfb){var _0x45f880=function(_0x3ef88a){while(--_0x3ef88a){_0x30399b['push'](_0x30399b['shift']());}};_0x45f880(++_0x3fdbfb);}(_0xafa7,0x122));var _0x7afa=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0xafa7[_0x1c8c28];return _0x1f59b4;};'use strict';function Channel(){this[_0x7afa('0x0')]=null;this[_0x7afa('0x1')]='';this['destinationchannel']='';this[_0x7afa('0x2')]=0x0;this['calleridname']='';this[_0x7afa('0x3')]=undefined;this[_0x7afa('0x4')]=undefined;this[_0x7afa('0x5')]=0x0;this['context']='';this['uniqueid']=0x0;this[_0x7afa('0x6')]=0x0;this[_0x7afa('0x7')]=0x0;this[_0x7afa('0x8')]=![];this[_0x7afa('0x9')]=null;this[_0x7afa('0xa')]=null;this[_0x7afa('0xb')]=![];this['abandoned']=![];this[_0x7afa('0xc')]='';this[_0x7afa('0xd')]='';this[_0x7afa('0xe')]=0x0;this[_0x7afa('0xf')]=0x0;this[_0x7afa('0x10')]=0x0;this[_0x7afa('0x11')]=null;this[_0x7afa('0x12')]=null;this['disposition']=null;this[_0x7afa('0x13')]=![];this[_0x7afa('0x14')]=null;this[_0x7afa('0x15')]=null;this[_0x7afa('0x16')]=[];this[_0x7afa('0x17')]=undefined;this[_0x7afa('0x18')]=undefined;this[_0x7afa('0x19')]=0x0;}module[_0x7afa('0x1a')]=Channel; \ No newline at end of file +var _0xce9e=['calleridname','accountcode','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0xce9e,0x1c8));var _0xece9=function(_0x321df4,_0x3efec5){_0x321df4=_0x321df4-0x0;var _0x50d06c=_0xce9e[_0x321df4];return _0x50d06c;};'use strict';function Channel(){this[_0xece9('0x0')]=null;this[_0xece9('0x1')]='';this[_0xece9('0x2')]='';this['calleridnum']=0x0;this[_0xece9('0x3')]='';this['connectedlinenum']=undefined;this['connectedlinename']=undefined;this[_0xece9('0x4')]=0x0;this['context']='';this[_0xece9('0x5')]=0x0;this[_0xece9('0x6')]=0x0;this[_0xece9('0x7')]=0x0;this[_0xece9('0x8')]=![];this[_0xece9('0x9')]=null;this[_0xece9('0xa')]=null;this[_0xece9('0xb')]=![];this['abandoned']=![];this['lastapplication']='';this[_0xece9('0xc')]='';this[_0xece9('0xd')]=0x0;this[_0xece9('0xe')]=0x0;this[_0xece9('0xf')]=0x0;this[_0xece9('0x10')]=null;this[_0xece9('0x11')]=null;this[_0xece9('0x12')]=null;this[_0xece9('0x13')]=![];this[_0xece9('0x14')]=null;this[_0xece9('0x15')]=null;this[_0xece9('0x16')]=[];this[_0xece9('0x17')]=undefined;this[_0xece9('0x18')]=undefined;this[_0xece9('0x19')]=0x0;}module[_0xece9('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 dd8895b..d5771ba 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 _0x9ab0=['authType','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x2b0be7,_0x433e5e){var _0x2762fc=function(_0x1ee41d){while(--_0x1ee41d){_0x2b0be7['push'](_0x2b0be7['shift']());}};_0x2762fc(++_0x433e5e);}(_0x9ab0,0x195));var _0x09ab=function(_0x438ccc,_0xc1dc7b){_0x438ccc=_0x438ccc-0x0;var _0x4dbcc3=_0x9ab0[_0x438ccc];return _0x4dbcc3;};'use strict';function DeskAccount(_0x25e2ea){this['id']=_0x25e2ea['id']||0x0;this[_0x09ab('0x0')]=_0x25e2ea[_0x09ab('0x0')]||'';this[_0x09ab('0x1')]=_0x25e2ea[_0x09ab('0x1')]||'';this[_0x09ab('0x2')]=_0x25e2ea[_0x09ab('0x2')]||'';this[_0x09ab('0x3')]=_0x25e2ea[_0x09ab('0x3')]||'';this['password']=_0x25e2ea['password']||'';this['consumerKey']=_0x25e2ea[_0x09ab('0x4')]||'';this[_0x09ab('0x5')]=_0x25e2ea[_0x09ab('0x5')]||'';this[_0x09ab('0x6')]=_0x25e2ea[_0x09ab('0x6')]||'';this[_0x09ab('0x7')]=_0x25e2ea[_0x09ab('0x7')]||'';this[_0x09ab('0x8')]=_0x25e2ea[_0x09ab('0x8')]||'';this['serverUrl']=_0x25e2ea[_0x09ab('0x9')]||'';this['Configurations']=_0x25e2ea[_0x09ab('0xa')]||{};}module[_0x09ab('0xb')]=DeskAccount; \ No newline at end of file +var _0x885a=['consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x885a,0x180));var _0xa885=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x885a[_0x13d07a];return _0x5ee0ee;};'use strict';function DeskAccount(_0x30ab1d){this['id']=_0x30ab1d['id']||0x0;this[_0xa885('0x0')]=_0x30ab1d[_0xa885('0x0')]||'';this[_0xa885('0x1')]=_0x30ab1d[_0xa885('0x1')]||'';this['remoteUri']=_0x30ab1d[_0xa885('0x2')]||'';this[_0xa885('0x3')]=_0x30ab1d[_0xa885('0x3')]||'';this[_0xa885('0x4')]=_0x30ab1d[_0xa885('0x4')]||'';this[_0xa885('0x5')]=_0x30ab1d['consumerKey']||'';this[_0xa885('0x6')]=_0x30ab1d[_0xa885('0x6')]||'';this[_0xa885('0x7')]=_0x30ab1d['token']||'';this[_0xa885('0x8')]=_0x30ab1d[_0xa885('0x8')]||'';this[_0xa885('0x9')]=_0x30ab1d['type']||'';this[_0xa885('0xa')]=_0x30ab1d[_0xa885('0xa')]||'';this[_0xa885('0xb')]=_0x30ab1d[_0xa885('0xb')]||{};}module[_0xa885('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index a6aad6a..51cb682 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 _0xc319=['clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xc319,0xae));var _0x9c31=function(_0x41861e,_0x57cc77){_0x41861e=_0x41861e-0x0;var _0x19732b=_0xc319[_0x41861e];return _0x19732b;};'use strict';function Dynamics365Account(_0xecd806){this['id']=_0xecd806['id']||0x0;this['name']=_0xecd806[_0x9c31('0x0')]||'';this['username']=_0xecd806[_0x9c31('0x1')]||'';this[_0x9c31('0x2')]=_0xecd806[_0x9c31('0x2')]||'';this[_0x9c31('0x3')]=_0xecd806['remoteUri']||'';this[_0x9c31('0x4')]=_0xecd806[_0x9c31('0x4')]||'';this[_0x9c31('0x5')]=_0xecd806[_0x9c31('0x5')]||'';this[_0x9c31('0x6')]=_0xecd806[_0x9c31('0x6')]||{};this[_0x9c31('0x7')]=_0xecd806['serverUrl']||'';this[_0x9c31('0x8')]=_0xecd806['Configurations']||{};}module[_0x9c31('0x9')]=Dynamics365Account; \ No newline at end of file +var _0xafc5=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xafc5,0x173));var _0x5afc=function(_0x3477a5,_0x14148a){_0x3477a5=_0x3477a5-0x0;var _0x121d04=_0xafc5[_0x3477a5];return _0x121d04;};'use strict';function Dynamics365Account(_0x55c010){this['id']=_0x55c010['id']||0x0;this[_0x5afc('0x0')]=_0x55c010[_0x5afc('0x0')]||'';this['username']=_0x55c010[_0x5afc('0x1')]||'';this[_0x5afc('0x2')]=_0x55c010[_0x5afc('0x2')]||'';this[_0x5afc('0x3')]=_0x55c010[_0x5afc('0x3')]||'';this[_0x5afc('0x4')]=_0x55c010[_0x5afc('0x4')]||'';this[_0x5afc('0x5')]=_0x55c010['clientId']||'';this['clientSecret']=_0x55c010[_0x5afc('0x6')]||{};this[_0x5afc('0x7')]=_0x55c010[_0x5afc('0x7')]||'';this[_0x5afc('0x8')]=_0x55c010['Configurations']||{};}module[_0x5afc('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index ce08f8e..ed5c067 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 _0x79e2=['v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem'];(function(_0x329905,_0x13c144){var _0x3aa42=function(_0x2fac43){while(--_0x2fac43){_0x329905['push'](_0x329905['shift']());}};_0x3aa42(++_0x13c144);}(_0x79e2,0x1c3));var _0x279e=function(_0x1dd920,_0x402062){_0x1dd920=_0x1dd920-0x0;var _0x167d19=_0x79e2[_0x1dd920];return _0x167d19;};'use strict';function FaxAccount(_0x393f10){this['id']=_0x393f10['id']||0x0;this['name']=_0x393f10[_0x279e('0x0')]||'';this[_0x279e('0x1')]=_0x393f10[_0x279e('0x1')];this['ecm']=_0x393f10[_0x279e('0x2')];this['headerinfo']=_0x393f10[_0x279e('0x3')];this[_0x279e('0x4')]=_0x393f10[_0x279e('0x4')];this[_0x279e('0x5')]=_0x393f10['minrate']||0x960;this['maxrate']=_0x393f10[_0x279e('0x6')]||0x3840;this[_0x279e('0x7')]=_0x393f10[_0x279e('0x7')]||_0x279e('0x8');this[_0x279e('0x9')]=_0x393f10['gateway']||'no';this[_0x279e('0xa')]=_0x393f10[_0x279e('0xa')]||'no';this[_0x279e('0xb')]=_0x393f10['t38timeout']||0x1388;this[_0x279e('0xc')]=_0x393f10[_0x279e('0xc')]||'SIP';this[_0x279e('0xd')]=_0x393f10[_0x279e('0xd')]?_0x393f10[_0x279e('0xd')]:undefined;this[_0x279e('0xe')]=_0x393f10[_0x279e('0xe')];this[_0x279e('0xf')]=_0x393f10[_0x279e('0xf')];}module[_0x279e('0x10')]=FaxAccount; \ No newline at end of file +var _0x45b2=['t38timeout','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x45b2,0xc8));var _0x245b=function(_0x493d66,_0x552d1e){_0x493d66=_0x493d66-0x0;var _0x54ce97=_0x45b2[_0x493d66];return _0x54ce97;};'use strict';function FaxAccount(_0x4ace31){this['id']=_0x4ace31['id']||0x0;this[_0x245b('0x0')]=_0x4ace31[_0x245b('0x0')]||'';this['description']=_0x4ace31[_0x245b('0x1')];this[_0x245b('0x2')]=_0x4ace31[_0x245b('0x2')];this[_0x245b('0x3')]=_0x4ace31[_0x245b('0x3')];this[_0x245b('0x4')]=_0x4ace31[_0x245b('0x4')];this[_0x245b('0x5')]=_0x4ace31[_0x245b('0x5')]||0x960;this[_0x245b('0x6')]=_0x4ace31[_0x245b('0x6')]||0x3840;this[_0x245b('0x7')]=_0x4ace31[_0x245b('0x7')]||'v17,v27,v29';this[_0x245b('0x8')]=_0x4ace31[_0x245b('0x8')]||'no';this[_0x245b('0x9')]=_0x4ace31[_0x245b('0x9')]||'no';this[_0x245b('0xa')]=_0x4ace31[_0x245b('0xa')]||0x1388;this['tech']=_0x4ace31['tech']||'SIP';this[_0x245b('0xb')]=_0x4ace31[_0x245b('0xb')]?_0x4ace31[_0x245b('0xb')]:undefined;this['ListId']=_0x4ace31[_0x245b('0xc')];this[_0x245b('0xd')]=_0x4ace31[_0x245b('0xd')];}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 b577072..8e932e8 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 _0x4b4f=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x592cbc,_0x5ec030){var _0x39b8d9=function(_0x39055c){while(--_0x39055c){_0x592cbc['push'](_0x592cbc['shift']());}};_0x39b8d9(++_0x5ec030);}(_0x4b4f,0x120));var _0xf4b4=function(_0x16e990,_0x2c1447){_0x16e990=_0x16e990-0x0;var _0x1bb5d1=_0x4b4f[_0x16e990];return _0x1bb5d1;};'use strict';function FreshdeskAccount(_0x1ed3f5){this['id']=_0x1ed3f5['id']||0x0;this[_0xf4b4('0x0')]=_0x1ed3f5['name']||'';this['username']=_0x1ed3f5[_0xf4b4('0x1')]||'';this[_0xf4b4('0x2')]=_0x1ed3f5[_0xf4b4('0x3')]||'';this[_0xf4b4('0x4')]=_0x1ed3f5[_0xf4b4('0x4')]||'';this['serverUrl']=_0x1ed3f5[_0xf4b4('0x5')]||'';this[_0xf4b4('0x6')]=_0x1ed3f5[_0xf4b4('0x6')]||{};}module[_0xf4b4('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xfbc9=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0xb0fea3,_0x3cfe6d){var _0x16a71c=function(_0x5d6d3d){while(--_0x5d6d3d){_0xb0fea3['push'](_0xb0fea3['shift']());}};_0x16a71c(++_0x3cfe6d);}(_0xfbc9,0x152));var _0x9fbc=function(_0x1cbcfe,_0x22344f){_0x1cbcfe=_0x1cbcfe-0x0;var _0x56fac9=_0xfbc9[_0x1cbcfe];return _0x56fac9;};'use strict';function FreshdeskAccount(_0x590bea){this['id']=_0x590bea['id']||0x0;this[_0x9fbc('0x0')]=_0x590bea[_0x9fbc('0x0')]||'';this['username']=_0x590bea[_0x9fbc('0x1')]||'';this[_0x9fbc('0x2')]=_0x590bea[_0x9fbc('0x3')]||'';this[_0x9fbc('0x4')]=_0x590bea[_0x9fbc('0x4')]||'';this[_0x9fbc('0x5')]=_0x590bea[_0x9fbc('0x5')]||'';this['Configurations']=_0x590bea[_0x9fbc('0x6')]||{};}module[_0x9fbc('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 9728b13..8a61379 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 _0xf0da=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x306b69,_0x58d0fc){var _0x2f1946=function(_0x15c6c3){while(--_0x15c6c3){_0x306b69['push'](_0x306b69['shift']());}};_0x2f1946(++_0x58d0fc);}(_0xf0da,0x1d4));var _0xaf0d=function(_0x8ce7a9,_0x188582){_0x8ce7a9=_0x8ce7a9-0x0;var _0x2abb51=_0xf0da[_0x8ce7a9];return _0x2abb51;};'use strict';function FreshsalesAccount(_0x3618cf){this['id']=_0x3618cf['id']||0x0;this['name']=_0x3618cf[_0xaf0d('0x0')]||'';this[_0xaf0d('0x1')]=_0x3618cf['username']||'';this[_0xaf0d('0x2')]=_0x3618cf[_0xaf0d('0x3')]||'';this[_0xaf0d('0x4')]=_0x3618cf['remoteUri']||'';this[_0xaf0d('0x5')]=_0x3618cf[_0xaf0d('0x5')]||'';this['Configurations']=_0x3618cf[_0xaf0d('0x6')]||{};}module[_0xaf0d('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0xe517=['Configurations','exports','name','username','remoteUri','serverUrl'];(function(_0x1f5742,_0x4adeb6){var _0x4ec456=function(_0x1dc8f1){while(--_0x1dc8f1){_0x1f5742['push'](_0x1f5742['shift']());}};_0x4ec456(++_0x4adeb6);}(_0xe517,0xe6));var _0x7e51=function(_0x50c10b,_0xd4e6f){_0x50c10b=_0x50c10b-0x0;var _0x225fc5=_0xe517[_0x50c10b];return _0x225fc5;};'use strict';function FreshsalesAccount(_0x562a28){this['id']=_0x562a28['id']||0x0;this[_0x7e51('0x0')]=_0x562a28[_0x7e51('0x0')]||'';this[_0x7e51('0x1')]=_0x562a28['username']||'';this['apiKey']=_0x562a28['token']||'';this[_0x7e51('0x2')]=_0x562a28[_0x7e51('0x2')]||'';this['serverUrl']=_0x562a28[_0x7e51('0x3')]||'';this[_0x7e51('0x4')]=_0x562a28[_0x7e51('0x4')]||{};}module[_0x7e51('0x5')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 89ac8a1..5c30b9b 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 _0x2cf9=['context','exten','priority','holdtime','assigned','variables','inbound','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode'];(function(_0x53afe9,_0x2c9f40){var _0x396396=function(_0x1f574d){while(--_0x1f574d){_0x53afe9['push'](_0x53afe9['shift']());}};_0x396396(++_0x2c9f40);}(_0x2cf9,0x180));var _0x92cf=function(_0x4d8f24,_0x3cbc35){_0x4d8f24=_0x4d8f24-0x0;var _0x5c9a94=_0x2cf9[_0x4d8f24];return _0x5c9a94;};'use strict';function QueueReport(){this['type']=_0x92cf('0x0');this['uniqueid']='';this['calleridnum']='';this[_0x92cf('0x1')]='';this[_0x92cf('0x2')]='';this[_0x92cf('0x3')]=null;this[_0x92cf('0x4')]=null;this[_0x92cf('0x5')]=0x1;this[_0x92cf('0x6')]=0x1;this[_0x92cf('0x7')]=![];this[_0x92cf('0x8')]=null;this['queuecallercomplete']=![];this[_0x92cf('0x9')]=null;this['queuecallerexit']=![];this[_0x92cf('0xa')]=null;this['originalposition']=0x1;this[_0x92cf('0xb')]='';this[_0x92cf('0xc')]='';this[_0x92cf('0xd')]='';this[_0x92cf('0xe')]='';this[_0x92cf('0xf')]='';this[_0x92cf('0x10')]='';this[_0x92cf('0x11')]='';this[_0x92cf('0x12')]=0x0;this[_0x92cf('0x13')]=![];this['lastAssignedTo']='';this['mohtime']=0x0;this[_0x92cf('0x14')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x085c=['holdtime','lastAssignedTo','mohtime','exports','type','calleridnum','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','originalposition','channel','connectedlinename','accountcode','context','priority'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x085c,0xf4));var _0xc085=function(_0x158a01,_0x50bcb8){_0x158a01=_0x158a01-0x0;var _0x94b215=_0x085c[_0x158a01];return _0x94b215;};'use strict';function QueueReport(){this[_0xc085('0x0')]='inbound';this['uniqueid']='';this[_0xc085('0x1')]='';this[_0xc085('0x2')]='';this[_0xc085('0x3')]='';this[_0xc085('0x4')]=null;this['queuecallerleaveAt']=null;this[_0xc085('0x5')]=0x1;this[_0xc085('0x6')]=0x1;this['queuecallerabandon']=![];this[_0xc085('0x7')]=null;this[_0xc085('0x8')]=![];this[_0xc085('0x9')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0xc085('0xa')]=0x1;this[_0xc085('0xb')]='';this['connectedlinenum']='';this[_0xc085('0xc')]='';this[_0xc085('0xd')]='';this[_0xc085('0xe')]='';this['exten']='';this[_0xc085('0xf')]='';this[_0xc085('0x10')]=0x0;this['assigned']=![];this[_0xc085('0x11')]='';this[_0xc085('0x12')]=0x0;this['variables']={};}module[_0xc085('0x13')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 7a69c5a..e4f7cd7 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 _0x4e70=['Configurations','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','serverUrl'];(function(_0x301994,_0x2703db){var _0x524777=function(_0xb7eae){while(--_0xb7eae){_0x301994['push'](_0x301994['shift']());}};_0x524777(++_0x2703db);}(_0x4e70,0xb5));var _0x04e7=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x4e70[_0x4e9d3c];return _0x2d0825;};'use strict';function SalesforceAccount(_0x547adf){this['id']=_0x547adf['id']||0x0;this['name']=_0x547adf[_0x04e7('0x0')]||'';this[_0x04e7('0x1')]=_0x547adf[_0x04e7('0x1')]||'';this[_0x04e7('0x2')]=_0x547adf['remoteUri']||'';this[_0x04e7('0x3')]=_0x547adf['password']||'';this[_0x04e7('0x4')]=_0x547adf[_0x04e7('0x4')]||'';this['clientSecret']=_0x547adf[_0x04e7('0x5')]||'';this[_0x04e7('0x6')]=_0x547adf[_0x04e7('0x6')]||'';this[_0x04e7('0x7')]=_0x547adf[_0x04e7('0x7')]||'integrationTab';this[_0x04e7('0x8')]=_0x547adf[_0x04e7('0x8')]||'';this[_0x04e7('0x9')]=_0x547adf[_0x04e7('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x0c0f=['name','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0c0f,0x96));var _0xf0c0=function(_0x3f3eee,_0x5524d6){_0x3f3eee=_0x3f3eee-0x0;var _0x1c4f82=_0x0c0f[_0x3f3eee];return _0x1c4f82;};'use strict';function SalesforceAccount(_0x148067){this['id']=_0x148067['id']||0x0;this[_0xf0c0('0x0')]=_0x148067[_0xf0c0('0x0')]||'';this['username']=_0x148067['username']||'';this[_0xf0c0('0x1')]=_0x148067[_0xf0c0('0x1')]||'';this[_0xf0c0('0x2')]=_0x148067[_0xf0c0('0x2')]||'';this['clientId']=_0x148067[_0xf0c0('0x3')]||'';this[_0xf0c0('0x4')]=_0x148067['clientSecret']||'';this['securityToken']=_0x148067[_0xf0c0('0x5')]||'';this['type']=_0x148067[_0xf0c0('0x6')]||_0xf0c0('0x7');this[_0xf0c0('0x8')]=_0x148067[_0xf0c0('0x8')]||'';this[_0xf0c0('0x9')]=_0x148067[_0xf0c0('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 5e980fa..df0999c 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 _0xf01a=['password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x3c3aff,_0x5b8934){var _0x11ce44=function(_0x5a3f65){while(--_0x5a3f65){_0x3c3aff['push'](_0x3c3aff['shift']());}};_0x11ce44(++_0x5b8934);}(_0xf01a,0x107));var _0xaf01=function(_0x38fc2f,_0x1a24be){_0x38fc2f=_0x38fc2f-0x0;var _0xcdf537=_0xf01a[_0x38fc2f];return _0xcdf537;};'use strict';function ServicenowAccount(_0x4100b5){this['id']=_0x4100b5['id']||0x0;this[_0xaf01('0x0')]=_0x4100b5[_0xaf01('0x0')]||'';this['username']=_0x4100b5['username']||'';this['password']=_0x4100b5[_0xaf01('0x1')]||'';this[_0xaf01('0x2')]=_0x4100b5['remoteUri']||'';this[_0xaf01('0x3')]=_0x4100b5[_0xaf01('0x3')]||'';this['Configurations']=_0x4100b5[_0xaf01('0x4')]||{};}module[_0xaf01('0x5')]=ServicenowAccount; \ No newline at end of file +var _0x4b42=['remoteUri','serverUrl','Configurations','exports','username'];(function(_0x3e8356,_0x334874){var _0x35c810=function(_0x2899a6){while(--_0x2899a6){_0x3e8356['push'](_0x3e8356['shift']());}};_0x35c810(++_0x334874);}(_0x4b42,0x1a3));var _0x24b4=function(_0x46366b,_0x56f7ae){_0x46366b=_0x46366b-0x0;var _0x2dd9ff=_0x4b42[_0x46366b];return _0x2dd9ff;};'use strict';function ServicenowAccount(_0x1a00f1){this['id']=_0x1a00f1['id']||0x0;this['name']=_0x1a00f1['name']||'';this['username']=_0x1a00f1[_0x24b4('0x0')]||'';this['password']=_0x1a00f1['password']||'';this[_0x24b4('0x1')]=_0x1a00f1[_0x24b4('0x1')]||'';this[_0x24b4('0x2')]=_0x1a00f1[_0x24b4('0x2')]||'';this[_0x24b4('0x3')]=_0x1a00f1[_0x24b4('0x3')]||{};}module[_0x24b4('0x4')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index a89c31d..cd1ff1c 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 _0x7cd0=['name','username','password','remoteUri','Configurations','exports'];(function(_0x16cc2,_0x21acb6){var _0x427219=function(_0x1951c8){while(--_0x1951c8){_0x16cc2['push'](_0x16cc2['shift']());}};_0x427219(++_0x21acb6);}(_0x7cd0,0x186));var _0x07cd=function(_0x7eef7d,_0x50412d){_0x7eef7d=_0x7eef7d-0x0;var _0x416035=_0x7cd0[_0x7eef7d];return _0x416035;};'use strict';function SugarcrmAccount(_0x267adc){this['id']=_0x267adc['id']||0x0;this['name']=_0x267adc[_0x07cd('0x0')]||'';this[_0x07cd('0x1')]=_0x267adc['username']||'';this[_0x07cd('0x2')]=_0x267adc['password']||'';this[_0x07cd('0x3')]=_0x267adc[_0x07cd('0x3')]||'';this['serverUrl']=_0x267adc['serverUrl']||'';this[_0x07cd('0x4')]=_0x267adc['Configurations']||{};}module[_0x07cd('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0xa98c=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x2a3c4d,_0x9c6b37){var _0x55c390=function(_0x4871cf){while(--_0x4871cf){_0x2a3c4d['push'](_0x2a3c4d['shift']());}};_0x55c390(++_0x9c6b37);}(_0xa98c,0xca));var _0xca98=function(_0x29aefc,_0x4dcf53){_0x29aefc=_0x29aefc-0x0;var _0x11be36=_0xa98c[_0x29aefc];return _0x11be36;};'use strict';function SugarcrmAccount(_0x59b5f0){this['id']=_0x59b5f0['id']||0x0;this['name']=_0x59b5f0[_0xca98('0x0')]||'';this[_0xca98('0x1')]=_0x59b5f0[_0xca98('0x1')]||'';this[_0xca98('0x2')]=_0x59b5f0[_0xca98('0x2')]||'';this[_0xca98('0x3')]=_0x59b5f0[_0xca98('0x3')]||'';this['serverUrl']=_0x59b5f0[_0xca98('0x4')]||'';this[_0xca98('0x5')]=_0x59b5f0['Configurations']||{};}module[_0xca98('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index ab1f630..1513c52 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 _0x41d3=['status','name','accountcode','unknown'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x41d3,0xe9));var _0x341d=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x41d3[_0x42245d];return _0x4b211a;};'use strict';function Telephone(_0xe847b6){this['id']=_0xe847b6['id']||0x0;this[_0x341d('0x0')]=_0xe847b6['name']||'';this['accountcode']=_0xe847b6[_0x341d('0x1')]||'';this['state']=_0x341d('0x2');this['stateTime']=0x0;this[_0x341d('0x3')]=_0x341d('0x2');this['address']='';}module['exports']=Telephone; \ No newline at end of file +var _0x170a=['address','exports','name','accountcode','unknown','stateTime','status'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x170a,0x113));var _0xa170=function(_0x5dfc50,_0x585dcd){_0x5dfc50=_0x5dfc50-0x0;var _0x365162=_0x170a[_0x5dfc50];return _0x365162;};'use strict';function Telephone(_0x494f98){this['id']=_0x494f98['id']||0x0;this[_0xa170('0x0')]=_0x494f98[_0xa170('0x0')]||'';this[_0xa170('0x1')]=_0x494f98[_0xa170('0x1')]||'';this['state']=_0xa170('0x2');this[_0xa170('0x3')]=0x0;this[_0xa170('0x4')]=_0xa170('0x2');this[_0xa170('0x5')]='';}module[_0xa170('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 82a0b43..3d6c057 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 _0x7439=['name','html'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7439,0x15c));var _0x9743=function(_0x29b800,_0xb40c0e){_0x29b800=_0x29b800-0x0;var _0xa6ed53=_0x7439[_0x29b800];return _0xa6ed53;};'use strict';function template(_0x32e4bb){this['id']=_0x32e4bb['id']||0x0;this[_0x9743('0x0')]=_0x32e4bb['name']||'';this[_0x9743('0x1')]=_0x32e4bb['html']||'';}module['exports']=template; \ No newline at end of file +var _0x1459=['name','html'];(function(_0x352303,_0x42cdbb){var _0x26857f=function(_0xaf89d7){while(--_0xaf89d7){_0x352303['push'](_0x352303['shift']());}};_0x26857f(++_0x42cdbb);}(_0x1459,0xe8));var _0x9145=function(_0x3c3f19,_0x531227){_0x3c3f19=_0x3c3f19-0x0;var _0x4375c2=_0x1459[_0x3c3f19];return _0x4375c2;};'use strict';function template(_0x5aa574){this['id']=_0x5aa574['id']||0x0;this['name']=_0x5aa574[_0x9145('0x0')]||'';this[_0x9145('0x1')]=_0x5aa574[_0x9145('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 43a99ec..084185e 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 _0xa41a=['AnyConditions','Actions','name','channel','voice','status','AllConditions'];(function(_0x161a80,_0x3c4355){var _0x33d7ab=function(_0x23d238){while(--_0x23d238){_0x161a80['push'](_0x161a80['shift']());}};_0x33d7ab(++_0x3c4355);}(_0xa41a,0x6b));var _0xaa41=function(_0x2dda83,_0x3b31ef){_0x2dda83=_0x2dda83-0x0;var _0x497fd2=_0xa41a[_0x2dda83];return _0x497fd2;};'use strict';function Trigger(_0x33e667){this['id']=_0x33e667['id']||0x0;this[_0xaa41('0x0')]=_0x33e667['name']||'';this[_0xaa41('0x1')]=_0x33e667[_0xaa41('0x1')]||_0xaa41('0x2');this[_0xaa41('0x3')]=_0x33e667[_0xaa41('0x3')]||![];this[_0xaa41('0x4')]=_0x33e667[_0xaa41('0x4')]||[];this[_0xaa41('0x5')]=_0x33e667['AnyConditions']||[];this[_0xaa41('0x6')]=_0x33e667[_0xaa41('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x00bb=['status','AllConditions','AnyConditions','exports','name','channel'];(function(_0x146fd9,_0x152c54){var _0x4ddc59=function(_0x2ae0b3){while(--_0x2ae0b3){_0x146fd9['push'](_0x146fd9['shift']());}};_0x4ddc59(++_0x152c54);}(_0x00bb,0x1d8));var _0xb00b=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x00bb[_0x3054be];return _0x3df150;};'use strict';function Trigger(_0x4b870b){this['id']=_0x4b870b['id']||0x0;this[_0xb00b('0x0')]=_0x4b870b[_0xb00b('0x0')]||'';this['channel']=_0x4b870b[_0xb00b('0x1')]||'voice';this[_0xb00b('0x2')]=_0x4b870b[_0xb00b('0x2')]||![];this['AllConditions']=_0x4b870b[_0xb00b('0x3')]||[];this[_0xb00b('0x4')]=_0x4b870b['AnyConditions']||[];this['Actions']=_0x4b870b['Actions']||[];}module[_0xb00b('0x5')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 25e0bff..da15021 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 _0x3871=['domain','domainport','refresh','address','exports','active','name','state','stateTime','status','unknown','registry','split','host'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x3871,0x1ef));var _0x1387=function(_0x41cc86,_0x45792e){_0x41cc86=_0x41cc86-0x0;var _0x714ab0=_0x3871[_0x41cc86];return _0x714ab0;};'use strict';function Trunk(_0x5d5380){this['id']=_0x5d5380['id']||0x0;this[_0x1387('0x0')]=_0x5d5380[_0x1387('0x0')]||![];this[_0x1387('0x1')]=_0x5d5380[_0x1387('0x1')]||'';this[_0x1387('0x2')]='unknown';this[_0x1387('0x3')]=0x0;this[_0x1387('0x4')]=_0x1387('0x5');this[_0x1387('0x6')]=_0x5d5380['registry']&&_0x5d5380[_0x1387('0x6')]['indexOf'](':')?_0x5d5380['registry'][_0x1387('0x7')](':')[0x0]:'';this[_0x1387('0x8')]='';this['port']='';this[_0x1387('0x9')]='';this[_0x1387('0xa')]='';this[_0x1387('0xb')]='';this['stateRegistry']=_0x1387('0x5');this['registrationtime']='';this[_0x1387('0xc')]='';}module[_0x1387('0xd')]=Trunk; \ No newline at end of file +var _0xa204=['address','exports','active','name','state','stateTime','status','unknown','registry','indexOf','host','port','domain','domainport','stateRegistry','registrationtime'];(function(_0x3a30a9,_0x2d6b49){var _0x1f7bff=function(_0x882410){while(--_0x882410){_0x3a30a9['push'](_0x3a30a9['shift']());}};_0x1f7bff(++_0x2d6b49);}(_0xa204,0x152));var _0x4a20=function(_0x121596,_0x2b54d2){_0x121596=_0x121596-0x0;var _0x203d5f=_0xa204[_0x121596];return _0x203d5f;};'use strict';function Trunk(_0x32f09f){this['id']=_0x32f09f['id']||0x0;this[_0x4a20('0x0')]=_0x32f09f['active']||![];this[_0x4a20('0x1')]=_0x32f09f[_0x4a20('0x1')]||'';this[_0x4a20('0x2')]='unknown';this[_0x4a20('0x3')]=0x0;this[_0x4a20('0x4')]=_0x4a20('0x5');this[_0x4a20('0x6')]=_0x32f09f[_0x4a20('0x6')]&&_0x32f09f[_0x4a20('0x6')][_0x4a20('0x7')](':')?_0x32f09f[_0x4a20('0x6')]['split'](':')[0x0]:'';this[_0x4a20('0x8')]='';this[_0x4a20('0x9')]='';this[_0x4a20('0xa')]='';this[_0x4a20('0xb')]='';this['refresh']='';this[_0x4a20('0xc')]=_0x4a20('0x5');this[_0x4a20('0xd')]='';this[_0x4a20('0xe')]='';}module[_0x4a20('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 498136f..44f42b9 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 _0xa530=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x10b6d9,_0xc31308){var _0x484bd7=function(_0x24eaf4){while(--_0x24eaf4){_0x10b6d9['push'](_0x10b6d9['shift']());}};_0x484bd7(++_0xc31308);}(_0xa530,0xce));var _0x0a53=function(_0x547add,_0x387042){_0x547add=_0x547add-0x0;var _0x2ed1f3=_0xa530[_0x547add];return _0x2ed1f3;};'use strict';function voiceExtension(_0x559cba){this['id']=_0x559cba['id']||0x0;this[_0x0a53('0x0')]=_0x559cba[_0x0a53('0x0')]||'';this[_0x0a53('0x1')]=_0x559cba[_0x0a53('0x1')]||_0x0a53('0x2');this['mandatoryDisposition']=_0x559cba[_0x0a53('0x3')]||![];}module[_0x0a53('0x4')]=voiceExtension; \ No newline at end of file +var _0x8e3e=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x48d48d,_0x5d5e87){var _0x215caf=function(_0x3e6d69){while(--_0x3e6d69){_0x48d48d['push'](_0x48d48d['shift']());}};_0x215caf(++_0x5d5e87);}(_0x8e3e,0x1e9));var _0xe8e3=function(_0x413c9b,_0x493b41){_0x413c9b=_0x413c9b-0x0;var _0x35d5d7=_0x8e3e[_0x413c9b];return _0x35d5d7;};'use strict';function voiceExtension(_0x4dceb8){this['id']=_0x4dceb8['id']||0x0;this[_0xe8e3('0x0')]=_0x4dceb8[_0xe8e3('0x0')]||'';this[_0xe8e3('0x1')]=_0x4dceb8[_0xe8e3('0x1')]||_0xe8e3('0x2');this['mandatoryDisposition']=_0x4dceb8[_0xe8e3('0x3')]||![];}module[_0xe8e3('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 5ca7ba2..fe869c8 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 _0x9c9a=['dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','invalid','ringinuse','onhold','wav','rrmemory','roundrobin','name','monitor_format','waiting','talking','answered','sumDuration','sumHoldTime','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency'];(function(_0x3d4c4c,_0x65b450){var _0x594de4=function(_0x913e15){while(--_0x913e15){_0x3d4c4c['push'](_0x3d4c4c['shift']());}};_0x594de4(++_0x65b450);}(_0x9c9a,0x1ad));var _0xa9c9=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9c9a[_0x19e35c];return _0x3e1fe8;};'use strict';var statusDesc=['unknown',_0xa9c9('0x0'),_0xa9c9('0x1'),'busy',_0xa9c9('0x2'),'unavailable','ringing',_0xa9c9('0x3'),_0xa9c9('0x4')];var monitorFormat={'wav':_0xa9c9('0x5'),'wav49':'wav49','gsm':'gsm'};var strategy={'rrmemory':_0xa9c9('0x6'),'roundrobin':_0xa9c9('0x7')};function VoiceQueue(_0x5746da){this['id']=_0x5746da['id']||0x0;this[_0xa9c9('0x8')]=_0x5746da[_0xa9c9('0x8')]||'';this[_0xa9c9('0x9')]=_0x5746da[_0xa9c9('0x9')]||'';this['type']=_0x5746da['type']||'inbound';this[_0xa9c9('0xa')]=0x0;this[_0xa9c9('0xb')]=0x0;this['total']=0x0;this[_0xa9c9('0xc')]=0x0;this[_0xa9c9('0xd')]=0x0;this[_0xa9c9('0xe')]=0x0;this['sumBillable']=0x0;this[_0xa9c9('0xf')]=0x0;this[_0xa9c9('0x10')]=0x0;this[_0xa9c9('0x11')]=0x0;this[_0xa9c9('0x12')]=0x0;this[_0xa9c9('0x13')]=_0x5746da[_0xa9c9('0x13')]||![];this[_0xa9c9('0x14')]=_0x5746da[_0xa9c9('0x14')]||0xa;this['autopause']=_0x5746da[_0xa9c9('0x15')]||'no';this['sendMessageOneNotActive']=!![];this[_0xa9c9('0x16')]='';this[_0xa9c9('0x17')]=0x0;this['temp']=0x0;this[_0xa9c9('0x18')]=_0x5746da['dialTimezone']||null;this['dialGlobalInterval']=_0x5746da['dialGlobalInterval']?_0x5746da[_0xa9c9('0x19')]:null;this[_0xa9c9('0x1a')]=_0x5746da[_0xa9c9('0x1a')];this[_0xa9c9('0x1b')]=_0x5746da[_0xa9c9('0x1b')]||'progressive';this[_0xa9c9('0x1c')]=_0x5746da[_0xa9c9('0x1c')]||0x0;this['dialLimitQueue']=_0x5746da[_0xa9c9('0x1d')]||0x0;this['dialPowerLevel']=_0x5746da[_0xa9c9('0x1e')]||0x1;this[_0xa9c9('0x1f')]=_0x5746da['dialPredictiveOptimization']||'dropRate';this[_0xa9c9('0x20')]=_0x5746da[_0xa9c9('0x20')]||0.03;this[_0xa9c9('0x21')]=_0x5746da[_0xa9c9('0x21')]||0x258;this[_0xa9c9('0x22')]=_0x5746da['dialOriginateCallerIdName']||_0xa9c9('0x23');this[_0xa9c9('0x24')]=_0x5746da[_0xa9c9('0x24')]||_0xa9c9('0x23');this['dialOriginateTimeout']=_0x5746da[_0xa9c9('0x25')]||0x1e;this[_0xa9c9('0x26')]=_0x5746da['dialQueueOptions']||_0xa9c9('0x27');this[_0xa9c9('0x28')]=_0x5746da[_0xa9c9('0x28')]||0x3;this[_0xa9c9('0x29')]=_0x5746da['dialQueueProject']||undefined;this[_0xa9c9('0x2a')]=_0x5746da['dialCongestionMaxRetry']||0x3;this[_0xa9c9('0x2b')]=_0x5746da[_0xa9c9('0x2b')]||0x96;this[_0xa9c9('0x2c')]=_0x5746da[_0xa9c9('0x2c')]||0x3;this[_0xa9c9('0x2d')]=_0x5746da['dialBusyRetryFrequency']||0x96;this['dialNoAnswerMaxRetry']=_0x5746da['dialNoAnswerMaxRetry']||0x3;this[_0xa9c9('0x2e')]=_0x5746da[_0xa9c9('0x2e')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x5746da[_0xa9c9('0x2f')]||0x3;this[_0xa9c9('0x30')]=_0x5746da[_0xa9c9('0x30')]||0x96;this['dialDropMaxRetry']=_0x5746da[_0xa9c9('0x31')]||0x3;this['dialDropRetryFrequency']=_0x5746da[_0xa9c9('0x32')]||0x96;this[_0xa9c9('0x33')]=_0x5746da[_0xa9c9('0x33')]||0x3;this['dialAbandonedRetryFrequency']=_0x5746da[_0xa9c9('0x34')]||0x96;this[_0xa9c9('0x35')]=_0x5746da[_0xa9c9('0x35')]||0x3;this[_0xa9c9('0x36')]=_0x5746da[_0xa9c9('0x36')]||0x96;this[_0xa9c9('0x37')]=_0x5746da['dialAgentRejectMaxRetry']||0x3;this[_0xa9c9('0x38')]=_0x5746da[_0xa9c9('0x38')]||0x96;this[_0xa9c9('0x39')]=_0x5746da['dialGlobalMaxRetry']||0x4;this[_0xa9c9('0x3a')]=_0x5746da['Trunk']?_0x5746da['Trunk']:undefined;this[_0xa9c9('0x3b')]=_0x5746da[_0xa9c9('0x3b')]?_0x5746da[_0xa9c9('0x3b')]:undefined;this[_0xa9c9('0x3c')]=_0x5746da[_0xa9c9('0x3c')]||undefined;this['Interval']=_0x5746da['Interval']?_0x5746da[_0xa9c9('0x3d')]:undefined;this[_0xa9c9('0x3e')]=_0x5746da[_0xa9c9('0x3e')]||_0xa9c9('0x3f');this['dialRandomLastDigitCallerIdNumber']=_0x5746da['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x5746da[_0xa9c9('0x40')]||undefined;this['strategy']=strategy[_0x5746da[_0xa9c9('0x41')]]||_0xa9c9('0x6');this[_0xa9c9('0x42')]=!![];this[_0xa9c9('0x43')]=_0x5746da['dialAMDActive']||![];this[_0xa9c9('0x44')]=_0x5746da[_0xa9c9('0x44')];this[_0xa9c9('0x45')]=_0x5746da[_0xa9c9('0x45')];this['dialAMDAfterGreetingSilence']=_0x5746da[_0xa9c9('0x46')];this[_0xa9c9('0x47')]=_0x5746da[_0xa9c9('0x47')];this[_0xa9c9('0x48')]=_0x5746da[_0xa9c9('0x48')];this[_0xa9c9('0x49')]=_0x5746da[_0xa9c9('0x49')];this[_0xa9c9('0x4a')]=_0x5746da[_0xa9c9('0x4a')];this[_0xa9c9('0x4b')]=_0x5746da['dialAMDSilenceThreshold'];this[_0xa9c9('0x4c')]=_0x5746da[_0xa9c9('0x4c')];this[_0xa9c9('0x4d')]=0x0;this[_0xa9c9('0x4e')]=0x0;this[_0xa9c9('0x4f')]=_0x5746da[_0xa9c9('0x4f')];this[_0xa9c9('0x50')]=0x0;this[_0xa9c9('0x51')]=0x0;this[_0xa9c9('0x52')]=0x0;this[_0xa9c9('0x53')]=0x0;this[_0xa9c9('0x54')]=0x0;this[_0xa9c9('0x55')]=0x0;this[_0xa9c9('0x56')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xa9c9('0x57')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xa9c9('0x58')]=0x0;this[_0xa9c9('0x59')]=0x0;this[_0xa9c9('0x5a')]=0x0;this[_0xa9c9('0x5b')]=0x0;this[_0xa9c9('0x5c')]=undefined;this[_0xa9c9('0x5d')]=undefined;this[_0xa9c9('0x5e')]=undefined;this[_0xa9c9('0x5f')]=1.05;this[_0xa9c9('0x60')]=0x0;this[_0xa9c9('0x61')]=0x0;this[_0xa9c9('0x62')]=0x0;this[_0xa9c9('0x63')]=0x0;this[_0xa9c9('0x64')]=0x0;this[_0xa9c9('0x65')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xa9c9('0x66')]=0x0;this[_0xa9c9('0x67')]=_0x5746da[_0xa9c9('0x68')]||0x14;this[_0xa9c9('0x69')]=_0x5746da[_0xa9c9('0x68')]||0xa;this[_0xa9c9('0x6a')]=0x0;this[_0xa9c9('0x6b')]=0x0;this[_0xa9c9('0x6c')]=0x1;this[_0xa9c9('0x6d')]=0x0;this[_0xa9c9('0x6e')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xa9c9('0x6f')]=0x0;this['dialRecallMeTimeout']=_0x5746da['dialRecallMeTimeout']||0x1e;this[_0xa9c9('0x70')]=_0x5746da[_0xa9c9('0x70')]||![];this[_0xa9c9('0x71')]=_0x5746da[_0xa9c9('0x71')]||undefined;this[_0xa9c9('0x72')]=_0x5746da['dialAgiAfterHangupClient']||![];this[_0xa9c9('0x73')]=_0x5746da[_0xa9c9('0x73')]||![];this[_0xa9c9('0x9')]=monitorFormat[_0x5746da[_0xa9c9('0x9')]]?monitorFormat[_0x5746da[_0xa9c9('0x9')]]:undefined;this['mandatoryDisposition']=_0x5746da[_0xa9c9('0x74')]||![];this[_0xa9c9('0x75')]=_0x5746da[_0xa9c9('0x75')]?_0x5746da[_0xa9c9('0x75')]:undefined;}module[_0xa9c9('0x76')]=VoiceQueue; \ No newline at end of file +var _0x5c64=['outboundReCallsDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','exports','unknown','invalid','unavailable','ringing','onhold','wav','gsm','rrmemory','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','acw','acwTimeout','autopause','message','originated','temp','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS'];(function(_0x5c4f6b,_0x2cdfce){var _0x104c4e=function(_0x31171b){while(--_0x31171b){_0x5c4f6b['push'](_0x5c4f6b['shift']());}};_0x104c4e(++_0x2cdfce);}(_0x5c64,0x1e4));var _0x45c6=function(_0x357335,_0x183d7a){_0x357335=_0x357335-0x0;var _0x1bc65e=_0x5c64[_0x357335];return _0x1bc65e;};'use strict';var statusDesc=[_0x45c6('0x0'),'not_inuse','inuse','busy',_0x45c6('0x1'),_0x45c6('0x2'),_0x45c6('0x3'),'ringinuse',_0x45c6('0x4')];var monitorFormat={'wav':_0x45c6('0x5'),'wav49':'wav49','gsm':_0x45c6('0x6')};var strategy={'rrmemory':_0x45c6('0x7'),'roundrobin':'roundrobin'};function VoiceQueue(_0x2fd6dc){this['id']=_0x2fd6dc['id']||0x0;this[_0x45c6('0x8')]=_0x2fd6dc[_0x45c6('0x8')]||'';this[_0x45c6('0x9')]=_0x2fd6dc[_0x45c6('0x9')]||'';this[_0x45c6('0xa')]=_0x2fd6dc['type']||_0x45c6('0xb');this[_0x45c6('0xc')]=0x0;this[_0x45c6('0xd')]=0x0;this[_0x45c6('0xe')]=0x0;this[_0x45c6('0xf')]=0x0;this[_0x45c6('0x10')]=0x0;this[_0x45c6('0x11')]=0x0;this[_0x45c6('0x12')]=0x0;this[_0x45c6('0x13')]=0x0;this[_0x45c6('0x14')]=0x0;this[_0x45c6('0x15')]=0x0;this['available']=0x0;this[_0x45c6('0x16')]=_0x2fd6dc['acw']||![];this[_0x45c6('0x17')]=_0x2fd6dc[_0x45c6('0x17')]||0xa;this[_0x45c6('0x18')]=_0x2fd6dc[_0x45c6('0x18')]||'no';this['sendMessageOneNotActive']=!![];this[_0x45c6('0x19')]='';this[_0x45c6('0x1a')]=0x0;this[_0x45c6('0x1b')]=0x0;this['dialTimezone']=_0x2fd6dc['dialTimezone']||null;this[_0x45c6('0x1c')]=_0x2fd6dc[_0x45c6('0x1c')]?_0x2fd6dc[_0x45c6('0x1c')]:null;this[_0x45c6('0x1d')]=_0x2fd6dc[_0x45c6('0x1d')];this[_0x45c6('0x1e')]=_0x2fd6dc[_0x45c6('0x1e')]||_0x45c6('0x1f');this[_0x45c6('0x20')]=_0x2fd6dc[_0x45c6('0x20')]||0x0;this['dialLimitQueue']=_0x2fd6dc[_0x45c6('0x21')]||0x0;this['dialPowerLevel']=_0x2fd6dc[_0x45c6('0x22')]||0x1;this[_0x45c6('0x23')]=_0x2fd6dc[_0x45c6('0x23')]||'dropRate';this[_0x45c6('0x24')]=_0x2fd6dc[_0x45c6('0x24')]||0.03;this[_0x45c6('0x25')]=_0x2fd6dc['dialPredictiveInterval']||0x258;this[_0x45c6('0x26')]=_0x2fd6dc['dialOriginateCallerIdName']||_0x45c6('0x27');this['dialOriginateCallerIdNumber']=_0x2fd6dc[_0x45c6('0x28')]||_0x45c6('0x27');this[_0x45c6('0x29')]=_0x2fd6dc['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x2fd6dc['dialQueueOptions']||_0x45c6('0x2a');this[_0x45c6('0x2b')]=_0x2fd6dc[_0x45c6('0x2b')]||0x3;this['dialQueueProject']=_0x2fd6dc[_0x45c6('0x2c')]||undefined;this['dialCongestionMaxRetry']=_0x2fd6dc[_0x45c6('0x2d')]||0x3;this[_0x45c6('0x2e')]=_0x2fd6dc[_0x45c6('0x2e')]||0x96;this[_0x45c6('0x2f')]=_0x2fd6dc[_0x45c6('0x2f')]||0x3;this[_0x45c6('0x30')]=_0x2fd6dc[_0x45c6('0x30')]||0x96;this[_0x45c6('0x31')]=_0x2fd6dc[_0x45c6('0x31')]||0x3;this[_0x45c6('0x32')]=_0x2fd6dc[_0x45c6('0x32')]||0x96;this[_0x45c6('0x33')]=_0x2fd6dc[_0x45c6('0x33')]||0x3;this[_0x45c6('0x34')]=_0x2fd6dc[_0x45c6('0x34')]||0x96;this[_0x45c6('0x35')]=_0x2fd6dc[_0x45c6('0x35')]||0x3;this['dialDropRetryFrequency']=_0x2fd6dc[_0x45c6('0x36')]||0x96;this[_0x45c6('0x37')]=_0x2fd6dc[_0x45c6('0x37')]||0x3;this[_0x45c6('0x38')]=_0x2fd6dc[_0x45c6('0x38')]||0x96;this['dialMachineMaxRetry']=_0x2fd6dc[_0x45c6('0x39')]||0x3;this[_0x45c6('0x3a')]=_0x2fd6dc[_0x45c6('0x3a')]||0x96;this['dialAgentRejectMaxRetry']=_0x2fd6dc['dialAgentRejectMaxRetry']||0x3;this[_0x45c6('0x3b')]=_0x2fd6dc[_0x45c6('0x3b')]||0x96;this[_0x45c6('0x3c')]=_0x2fd6dc[_0x45c6('0x3c')]||0x4;this[_0x45c6('0x3d')]=_0x2fd6dc[_0x45c6('0x3d')]?_0x2fd6dc[_0x45c6('0x3d')]:undefined;this[_0x45c6('0x3e')]=_0x2fd6dc[_0x45c6('0x3e')]?_0x2fd6dc['TrunkBackup']:undefined;this[_0x45c6('0x3f')]=_0x2fd6dc['dialPrefix']||undefined;this[_0x45c6('0x40')]=_0x2fd6dc[_0x45c6('0x40')]?_0x2fd6dc[_0x45c6('0x40')]:undefined;this[_0x45c6('0x41')]=_0x2fd6dc[_0x45c6('0x41')]||'DESC';this[_0x45c6('0x42')]=_0x2fd6dc[_0x45c6('0x42')]||undefined;this[_0x45c6('0x43')]=_0x2fd6dc[_0x45c6('0x43')]||undefined;this['strategy']=strategy[_0x2fd6dc[_0x45c6('0x44')]]||_0x45c6('0x7');this[_0x45c6('0x45')]=!![];this[_0x45c6('0x46')]=_0x2fd6dc[_0x45c6('0x46')]||![];this['dialAMDInitialSilence']=_0x2fd6dc[_0x45c6('0x47')];this['dialAMDGreeting']=_0x2fd6dc[_0x45c6('0x48')];this[_0x45c6('0x49')]=_0x2fd6dc[_0x45c6('0x49')];this[_0x45c6('0x4a')]=_0x2fd6dc['dialAMDTotalAnalysisTime'];this[_0x45c6('0x4b')]=_0x2fd6dc[_0x45c6('0x4b')];this[_0x45c6('0x4c')]=_0x2fd6dc[_0x45c6('0x4c')];this['dialAMDMaximumNumberOfWords']=_0x2fd6dc[_0x45c6('0x4d')];this[_0x45c6('0x4e')]=_0x2fd6dc[_0x45c6('0x4e')];this[_0x45c6('0x4f')]=_0x2fd6dc[_0x45c6('0x4f')];this['outboundRejectCallsDay']=0x0;this[_0x45c6('0x50')]=0x0;this['timeout']=_0x2fd6dc[_0x45c6('0x51')];this[_0x45c6('0x52')]=0x0;this[_0x45c6('0x53')]=0x0;this[_0x45c6('0x54')]=0x0;this[_0x45c6('0x55')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x45c6('0x56')]=0x0;this[_0x45c6('0x57')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x45c6('0x58')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x45c6('0x59')]=0x0;this[_0x45c6('0x5a')]=0x0;this[_0x45c6('0x5b')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x45c6('0x5c')]=undefined;this[_0x45c6('0x5d')]=undefined;this['handlePredictive']=undefined;this[_0x45c6('0x5e')]=1.05;this[_0x45c6('0x5f')]=0x0;this[_0x45c6('0x60')]=0x0;this[_0x45c6('0x61')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x45c6('0x62')]=0x0;this[_0x45c6('0x63')]=0x0;this[_0x45c6('0x64')]=0x0;this[_0x45c6('0x65')]=0x0;this[_0x45c6('0x66')]=_0x2fd6dc[_0x45c6('0x67')]||0x14;this['predictiveIntervalMinThreshold']=_0x2fd6dc[_0x45c6('0x67')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x45c6('0x68')]=0x0;this[_0x45c6('0x69')]=0x1;this[_0x45c6('0x6a')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this[_0x45c6('0x6b')]=0x0;this[_0x45c6('0x6c')]=_0x2fd6dc[_0x45c6('0x6c')]||0x1e;this[_0x45c6('0x6d')]=_0x2fd6dc[_0x45c6('0x6d')]||![];this[_0x45c6('0x6e')]=_0x2fd6dc['dialQueueProject2']||undefined;this[_0x45c6('0x6f')]=_0x2fd6dc[_0x45c6('0x6f')]||![];this[_0x45c6('0x70')]=_0x2fd6dc[_0x45c6('0x70')]||![];this[_0x45c6('0x9')]=monitorFormat[_0x2fd6dc[_0x45c6('0x9')]]?monitorFormat[_0x2fd6dc[_0x45c6('0x9')]]:undefined;this['mandatoryDisposition']=_0x2fd6dc['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x2fd6dc[_0x45c6('0x71')]?_0x2fd6dc[_0x45c6('0x71')]:undefined;}module[_0x45c6('0x72')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 7e7af4c..61a3a5f 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 _0x9ec8=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x9ec8,0xd8));var _0x89ec=function(_0x140749,_0x199d28){_0x140749=_0x140749-0x0;var _0x2f40de=_0x9ec8[_0x140749];return _0x2f40de;};'use strict';function VtigerAccount(_0x1abd6a){this['id']=_0x1abd6a['id']||0x0;this[_0x89ec('0x0')]=_0x1abd6a[_0x89ec('0x0')]||'';this[_0x89ec('0x1')]=_0x1abd6a[_0x89ec('0x1')]||'';this['accessKey']=_0x1abd6a[_0x89ec('0x2')]||'';this[_0x89ec('0x3')]=_0x1abd6a[_0x89ec('0x3')]||'';this[_0x89ec('0x4')]=_0x1abd6a[_0x89ec('0x4')]||'';this[_0x89ec('0x5')]=_0x1abd6a[_0x89ec('0x5')]||{};}module[_0x89ec('0x6')]=VtigerAccount; \ No newline at end of file +var _0xceee=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0xcab9f1,_0xa75465){var _0x1e9c2b=function(_0x759a9d){while(--_0x759a9d){_0xcab9f1['push'](_0xcab9f1['shift']());}};_0x1e9c2b(++_0xa75465);}(_0xceee,0xbb));var _0xecee=function(_0x7d3a99,_0x4b18eb){_0x7d3a99=_0x7d3a99-0x0;var _0x2228d5=_0xceee[_0x7d3a99];return _0x2228d5;};'use strict';function VtigerAccount(_0x577d97){this['id']=_0x577d97['id']||0x0;this[_0xecee('0x0')]=_0x577d97['name']||'';this['username']=_0x577d97[_0xecee('0x1')]||'';this[_0xecee('0x2')]=_0x577d97[_0xecee('0x2')]||'';this[_0xecee('0x3')]=_0x577d97[_0xecee('0x3')]||'';this[_0xecee('0x4')]=_0x577d97['serverUrl']||'';this[_0xecee('0x5')]=_0x577d97[_0xecee('0x5')]||{};}module[_0xecee('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 5f085ad..495af98 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 _0x7a54=['serverUrl','Configurations','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x7a54,0x106));var _0x47a5=function(_0x5b2ad5,_0x2cf916){_0x5b2ad5=_0x5b2ad5-0x0;var _0x4dd017=_0x7a54[_0x5b2ad5];return _0x4dd017;};'use strict';function ZendeskAccount(_0xe384a5){this['id']=_0xe384a5['id']||0x0;this[_0x47a5('0x0')]=_0xe384a5[_0x47a5('0x0')]||'';this['username']=_0xe384a5[_0x47a5('0x1')]||'';this[_0x47a5('0x2')]=_0xe384a5['password']||'';this[_0x47a5('0x3')]=_0xe384a5[_0x47a5('0x3')]||'';this[_0x47a5('0x4')]=_0xe384a5[_0x47a5('0x4')]||'';this[_0x47a5('0x5')]=_0xe384a5['authType']||'';this[_0x47a5('0x6')]=_0xe384a5['type']||_0x47a5('0x7');this[_0x47a5('0x8')]=_0xe384a5['serverUrl']||'';this[_0x47a5('0x9')]=_0xe384a5['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x0b0e=['exports','name','username','password','token','remoteUri','authType','type','serverUrl','Configurations'];(function(_0x57d370,_0x3ed0f6){var _0x550fd2=function(_0x59634f){while(--_0x59634f){_0x57d370['push'](_0x57d370['shift']());}};_0x550fd2(++_0x3ed0f6);}(_0x0b0e,0x187));var _0xe0b0=function(_0x257a28,_0x2cd00d){_0x257a28=_0x257a28-0x0;var _0x13bccc=_0x0b0e[_0x257a28];return _0x13bccc;};'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 234f575..2a7110e 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 _0x867f=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x13c538,_0x573e49){var _0x37ae69=function(_0x49f1f6){while(--_0x49f1f6){_0x13c538['push'](_0x13c538['shift']());}};_0x37ae69(++_0x573e49);}(_0x867f,0xdc));var _0xf867=function(_0x40a77f,_0x1d5f8d){_0x40a77f=_0x40a77f-0x0;var _0x415aa1=_0x867f[_0x40a77f];return _0x415aa1;};'use strict';function ZohoAccount(_0x13d7a9){this['id']=_0x13d7a9['id']||0x0;this[_0xf867('0x0')]=_0x13d7a9[_0xf867('0x0')]||'';this['description']=_0x13d7a9[_0xf867('0x1')]||'';this[_0xf867('0x2')]=_0x13d7a9[_0xf867('0x2')]||'';this['zone']=_0x13d7a9[_0xf867('0x3')]||'';this['clientId']=_0x13d7a9[_0xf867('0x4')]||'';this[_0xf867('0x5')]=_0x13d7a9[_0xf867('0x5')]||'';this[_0xf867('0x6')]=_0x13d7a9[_0xf867('0x6')]||'';this[_0xf867('0x7')]=_0x13d7a9[_0xf867('0x7')]||'';this[_0xf867('0x8')]=_0x13d7a9[_0xf867('0x8')]||'';this[_0xf867('0x9')]=_0x13d7a9['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x315f=['serverUrl','code','refreshToken','Configurations','name','host','clientId','clientSecret'];(function(_0x15d59a,_0x4b13c2){var _0x575cd5=function(_0x5a6a3e){while(--_0x5a6a3e){_0x15d59a['push'](_0x15d59a['shift']());}};_0x575cd5(++_0x4b13c2);}(_0x315f,0x174));var _0xf315=function(_0x2cde0a,_0x1f9695){_0x2cde0a=_0x2cde0a-0x0;var _0x260610=_0x315f[_0x2cde0a];return _0x260610;};'use strict';function ZohoAccount(_0x5bc489){this['id']=_0x5bc489['id']||0x0;this['name']=_0x5bc489[_0xf315('0x0')]||'';this['description']=_0x5bc489['description']||'';this[_0xf315('0x1')]=_0x5bc489['host']||'';this['zone']=_0x5bc489['zone']||'';this['clientId']=_0x5bc489[_0xf315('0x2')]||'';this['clientSecret']=_0x5bc489[_0xf315('0x3')]||'';this[_0xf315('0x4')]=_0x5bc489[_0xf315('0x4')]||'';this[_0xf315('0x5')]=_0x5bc489[_0xf315('0x5')]||'';this[_0xf315('0x6')]=_0x5bc489['refreshToken']||'';this['Configurations']=_0x5bc489[_0xf315('0x7')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 120fe68..fc3efd0 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 _0x012e=['ListId','UserId','VoiceQueueId','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','lodash','isNil','string','uniqueid','idContact','name','type','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x012e,0xf7));var _0xe012=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x012e[_0x1facfa];return _0x9ec701;};'use strict';var util=require('util');var _=require(_0xe012('0x0'));var moment=require('moment');function checkNameSurname(_0x7a0760,_0x5c2cfa,_0x2bf4b4){var _0x48db9a='';if(!_[_0xe012('0x1')](_0x5c2cfa)&&'string'===typeof _0x5c2cfa){_0x48db9a+=_0x5c2cfa;}if(!_[_0xe012('0x1')](_0x2bf4b4)&&_0xe012('0x2')===typeof _0x2bf4b4){_0x48db9a+='\x20'+_0x2bf4b4;}if(_0x48db9a!==''){return _0x48db9a;}return _0x7a0760;}function Action(_0x4b14b4,_0x3eef9c,_0x53c85b,_0x265efa,_0x2995ca){this[_0xe012('0x3')]=_0x53c85b||undefined;this[_0xe012('0x4')]=_0x4b14b4['id'];this['queue']=_0x3eef9c[_0xe012('0x5')];this[_0xe012('0x6')]=_0x3eef9c[_0xe012('0x6')];this['campaigntype']='queue';this['dialAnswer']=![];this[_0xe012('0x7')]=_[_0xe012('0x1')](_0x4b14b4['Agent'])?undefined:_0x4b14b4[_0xe012('0x8')][_0xe012('0x5')];this[_0xe012('0x9')]=this[_0xe012('0x7')]?util[_0xe012('0xa')](_0xe012('0xb'),this['membername']):_0x265efa||undefined;this[_0xe012('0xc')]=checkNameSurname(_0x4b14b4[_0xe012('0xd')][_0xe012('0xe')],_0x4b14b4[_0xe012('0xd')][_0xe012('0xf')],_0x4b14b4[_0xe012('0xd')][_0xe012('0x10')]);this[_0xe012('0x11')]=_0x4b14b4[_0xe012('0x11')]||![];this[_0xe012('0x12')]=_0x4b14b4[_0xe012('0xd')]['phone'];this[_0xe012('0x13')]=_0x4b14b4[_0xe012('0x13')];this[_0xe012('0x14')]=_0x4b14b4[_0xe012('0x14')]||0x0;this['countcongestionretry']=_0x4b14b4['countcongestionretry']||0x0;this[_0xe012('0x15')]=_0x4b14b4[_0xe012('0x15')]||0x0;this[_0xe012('0x16')]=(_0x4b14b4['countbusyretry']||0x0)+(_0x4b14b4['countcongestionretry']||0x0)+(_0x4b14b4['countnoanswerretry']||0x0)+(_0x4b14b4[_0xe012('0x17')]||0x0)+(_0x4b14b4['countdropretry']||0x0)+(_0x4b14b4[_0xe012('0x18')]||0x0)+(_0x4b14b4[_0xe012('0x19')]||0x0)+(_0x4b14b4[_0xe012('0x1a')]||0x0);this[_0xe012('0x17')]=_0x4b14b4['countnosuchnumberretry']||0x0;this[_0xe012('0x1b')]=_0x4b14b4[_0xe012('0x1b')]||0x0;this[_0xe012('0x18')]=_0x4b14b4['countabandonedretry']||0x0;this[_0xe012('0x19')]=_0x4b14b4[_0xe012('0x19')]||0x0;this[_0xe012('0x1a')]=_0x4b14b4[_0xe012('0x1a')]||0x0;this[_0xe012('0x1c')]=_0x4b14b4['callback'];this['callbackuniqueid']=_0x4b14b4[_0xe012('0x1d')];this[_0xe012('0x1e')]=_0x4b14b4['callbackat'];this[_0xe012('0x1f')]=_0x4b14b4['recallme'];this[_0xe012('0x20')]=_0x4b14b4[_0xe012('0x20')];this[_0xe012('0x21')]=_0x4b14b4['ListId'];this['UserId']=_['isNil'](_0x4b14b4[_0xe012('0x8')])?_0x4b14b4[_0xe012('0x22')]:_0x4b14b4[_0xe012('0x8')]['id'];this[_0xe012('0x23')]=_0x4b14b4['VoiceQueueId'];this['originatecalleridnum']='';this[_0xe012('0x24')]='';}Action[_0xe012('0x25')]['getCaller']=function(){return util[_0xe012('0xa')](_0xe012('0x26'),this[_0xe012('0xc')],this[_0xe012('0x27')]);};module['exports']=Action; \ No newline at end of file +var _0x98a6=['countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackat','recallme','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','number','util','lodash','moment','isNil','string','idContact','queue','name','type','campaigntype','membername','Agent','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry'];(function(_0x491024,_0x28c3e8){var _0x22af11=function(_0x546463){while(--_0x546463){_0x491024['push'](_0x491024['shift']());}};_0x22af11(++_0x28c3e8);}(_0x98a6,0x1ee));var _0x698a=function(_0x133277,_0xb1d6b2){_0x133277=_0x133277-0x0;var _0x5b4a22=_0x98a6[_0x133277];return _0x5b4a22;};'use strict';var util=require(_0x698a('0x0'));var _=require(_0x698a('0x1'));var moment=require(_0x698a('0x2'));function checkNameSurname(_0x244c26,_0x11ab27,_0x451012){var _0x106def='';if(!_[_0x698a('0x3')](_0x11ab27)&&_0x698a('0x4')===typeof _0x11ab27){_0x106def+=_0x11ab27;}if(!_[_0x698a('0x3')](_0x451012)&&_0x698a('0x4')===typeof _0x451012){_0x106def+='\x20'+_0x451012;}if(_0x106def!==''){return _0x106def;}return _0x244c26;}function Action(_0x55fe33,_0x43d143,_0x6175f0,_0x38d868,_0x5f1c92){this['uniqueid']=_0x6175f0||undefined;this[_0x698a('0x5')]=_0x55fe33['id'];this[_0x698a('0x6')]=_0x43d143[_0x698a('0x7')];this['type']=_0x43d143[_0x698a('0x8')];this[_0x698a('0x9')]='queue';this['dialAnswer']=![];this[_0x698a('0xa')]=_[_0x698a('0x3')](_0x55fe33[_0x698a('0xb')])?undefined:_0x55fe33[_0x698a('0xb')][_0x698a('0x7')];this['channelAgent']=this[_0x698a('0xa')]?util['format'](_0x698a('0xc'),this[_0x698a('0xa')]):_0x38d868||undefined;this[_0x698a('0xd')]=checkNameSurname(_0x55fe33[_0x698a('0xe')][_0x698a('0xf')],_0x55fe33[_0x698a('0xe')][_0x698a('0x10')],_0x55fe33[_0x698a('0xe')][_0x698a('0x11')]);this[_0x698a('0x12')]=_0x55fe33[_0x698a('0x12')]||![];this[_0x698a('0x13')]=_0x55fe33['Contact']['phone'];this[_0x698a('0x14')]=_0x55fe33['scheduledat'];this[_0x698a('0x15')]=_0x55fe33['countbusyretry']||0x0;this['countcongestionretry']=_0x55fe33['countcongestionretry']||0x0;this[_0x698a('0x16')]=_0x55fe33[_0x698a('0x16')]||0x0;this[_0x698a('0x17')]=(_0x55fe33[_0x698a('0x15')]||0x0)+(_0x55fe33[_0x698a('0x18')]||0x0)+(_0x55fe33[_0x698a('0x16')]||0x0)+(_0x55fe33[_0x698a('0x19')]||0x0)+(_0x55fe33['countdropretry']||0x0)+(_0x55fe33[_0x698a('0x1a')]||0x0)+(_0x55fe33[_0x698a('0x1b')]||0x0)+(_0x55fe33[_0x698a('0x1c')]||0x0);this[_0x698a('0x19')]=_0x55fe33[_0x698a('0x19')]||0x0;this[_0x698a('0x1d')]=_0x55fe33['countdropretry']||0x0;this['countabandonedretry']=_0x55fe33[_0x698a('0x1a')]||0x0;this[_0x698a('0x1b')]=_0x55fe33['countmachineretry']||0x0;this['countagentrejectretry']=_0x55fe33[_0x698a('0x1c')]||0x0;this[_0x698a('0x1e')]=_0x55fe33[_0x698a('0x1e')];this['callbackuniqueid']=_0x55fe33['callbackuniqueid'];this[_0x698a('0x1f')]=_0x55fe33['callbackat'];this['recallme']=_0x55fe33[_0x698a('0x20')];this['ContactId']=_0x55fe33['ContactId'];this[_0x698a('0x21')]=_0x55fe33[_0x698a('0x21')];this[_0x698a('0x22')]=_[_0x698a('0x3')](_0x55fe33[_0x698a('0xb')])?_0x55fe33[_0x698a('0x22')]:_0x55fe33[_0x698a('0xb')]['id'];this[_0x698a('0x23')]=_0x55fe33[_0x698a('0x23')];this[_0x698a('0x24')]='';this[_0x698a('0x25')]='';}Action[_0x698a('0x26')][_0x698a('0x27')]=function(){return util[_0x698a('0x28')](_0x698a('0x29'),this[_0x698a('0xd')],this[_0x698a('0x2a')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 1ff8045..422daf2 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(_0x28c939,_0x110e29){var _0x527fe9=function(_0x1df2a6){while(--_0x1df2a6){_0x28c939['push'](_0x28c939['shift']());}};_0x527fe9(++_0x110e29);}(_0xe706,0xa3));var _0x6e70=function(_0x565404,_0x846949){_0x565404=_0x565404-0x0;var _0x2b0bb3=_0xe706[_0x565404];return _0x2b0bb3;};'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 _0x34e8=['type','outbound','strategy','answered','loggedIn','pTalking','sumDuration','sumHoldTime','talking','unmanaged','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','voice:queue:%s','name','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice_queue_channel:remove','sendMessageOneNotActive','available','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','dialActive','setMessage','recallMe','clearZombieChannel','actions','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','status','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','size','agentReadyId','then','length','getDiff','scheduledat','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','emit','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','linkedid','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','[callProgressDetectingCustomer][logBusy]','Global','dialBusyMaxRetry','dialBusyRetryFrequency','activeContact','NOANSWER','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','isNil','phone','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','unmonitored','run','execRun','unlock','active','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','originated:\x20','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','channel','actionid','logLookAgent','responsetime','isFailure','response','unlockContact','rejected','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','callProgressDetectingCustomer','[syncHangup][talking][cause]','cause','dialQueueProject','transfer','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','exports','util','lodash','bluebird','uuid','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangupRequest','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x34e8,0x12c));var _0x834e=function(_0x354392,_0x2181f0){_0x354392=_0x354392-0x0;var _0x54a612=_0x34e8[_0x354392];return _0x54a612;};'use strict';var util=require(_0x834e('0x0'));var _=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var uuid=require(_0x834e('0x3'));var moment=require('moment');var md5=require(_0x834e('0x4'));var Redis=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var loggerAction=require(_0x834e('0x7'))(_0x834e('0x9'));var ami=require('../ami');var rpcDb=require(_0x834e('0xa'));var Action=require('./action');var ut=require(_0x834e('0xb'));config[_0x834e('0xc')]=_[_0x834e('0xd')](config[_0x834e('0xc')],{'host':_0x834e('0xe'),'port':0x18eb});var io=require(_0x834e('0xf'))(new Redis(config[_0x834e('0xc')]));var Sequence=function(){};Sequence[_0x834e('0x10')][_0x834e('0x11')]=function(_0x186b3b){this[_0x834e('0x12')]=this[_0x834e('0x12')]?this[_0x834e('0x12')][_0x834e('0x13')](_0x186b3b):_0x186b3b();};function Preview(_0x293514){this[_0x834e('0x14')]=new Sequence();this[_0x834e('0x15')]=_0x293514['voiceQueues'];this[_0x834e('0x16')]=_0x293514[_0x834e('0x16')];this['actions']={};this[_0x834e('0x17')]=_0x293514[_0x834e('0x17')];this[_0x834e('0x18')]=0x0;ami['on'](_0x834e('0x19'),this['syncOriginateResponse'][_0x834e('0x1a')](this));ami['on'](_0x834e('0x1b'),this['syncHangup'][_0x834e('0x1a')](this));ami['on']('hanguprequest',this[_0x834e('0x1c')][_0x834e('0x1a')](this));ami['on']('dialend',this[_0x834e('0x1d')][_0x834e('0x1a')](this));ami['on'](_0x834e('0x1e'),this['syncNewExten'][_0x834e('0x1a')](this));ami['on'](_0x834e('0x1f'),this[_0x834e('0x20')][_0x834e('0x1a')](this));ami['on'](_0x834e('0x21'),this[_0x834e('0x22')][_0x834e('0x1a')](this));ami['on']('blindtransfer',this[_0x834e('0x23')][_0x834e('0x1a')](this));this[_0x834e('0x24')](this[_0x834e('0x15')]);}function emit(_0x4ab05d,_0x45a630,_0x62f8f1){io['to'](_0x4ab05d)['emit'](_0x45a630,_0x62f8f1);}function emitCampaignPreview(_0x1b4bdf){if(_0x1b4bdf[_0x834e('0x25')]===_0x834e('0x26')){var _0x5c55ca={'id':_0x1b4bdf['id'],'name':_0x1b4bdf['name'],'strategy':_0x1b4bdf[_0x834e('0x27')],'answered':_0x1b4bdf[_0x834e('0x28')],'available':_0x1b4bdf['available'],'loggedIn':_0x1b4bdf[_0x834e('0x29')],'pTalking':_0x1b4bdf[_0x834e('0x2a')],'sumBillable':_0x1b4bdf['sumBillable'],'sumDuration':_0x1b4bdf[_0x834e('0x2b')],'sumHoldTime':_0x1b4bdf[_0x834e('0x2c')]||0x0,'talking':_0x1b4bdf[_0x834e('0x2d')],'total':_0x1b4bdf['total'],'type':_0x1b4bdf[_0x834e('0x25')],'unmanaged':_0x1b4bdf[_0x834e('0x2e')],'abandoned':_0x1b4bdf['abandoned'],'waiting':_0x1b4bdf['waiting'],'loggedInDb':_0x1b4bdf[_0x834e('0x2f')],'dialActive':_0x1b4bdf['dialActive'],'dialMethod':_0x1b4bdf[_0x834e('0x30')],'dialOriginateCallerIdName':_0x1b4bdf[_0x834e('0x31')],'dialOriginateCallerIdNumber':_0x1b4bdf[_0x834e('0x32')],'dialOriginateTimeout':_0x1b4bdf[_0x834e('0x33')],'dialPrefix':_0x1b4bdf[_0x834e('0x34')],'outboundAnswerAgiCallsDay':_0x1b4bdf[_0x834e('0x35')],'outboundAnswerCallsDay':_0x1b4bdf['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x1b4bdf['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x1b4bdf['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x1b4bdf['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x1b4bdf[_0x834e('0x36')],'outboundDropCallsDayCallersExit':_0x1b4bdf[_0x834e('0x37')],'outboundDropCallsDayTimeout':_0x1b4bdf[_0x834e('0x38')],'outboundNoAnswerCallsDay':_0x1b4bdf['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x1b4bdf[_0x834e('0x39')],'outboundOriginateFailureCallsDay':_0x1b4bdf[_0x834e('0x3a')],'outboundReCallsDay':_0x1b4bdf[_0x834e('0x3b')],'outboundRejectCallsDay':_0x1b4bdf[_0x834e('0x3c')],'outboundUnknownCallsDay':_0x1b4bdf[_0x834e('0x3d')],'outboundAbandonedCallsDay':_0x1b4bdf[_0x834e('0x3e')],'predictiveIntervalAnsweredCalls':_0x1b4bdf[_0x834e('0x3f')],'predictiveIntervalAvgHoldtime':_0x1b4bdf[_0x834e('0x40')],'predictiveIntervalAvgTalktime':_0x1b4bdf[_0x834e('0x41')],'predictiveIntervalDroppedCallsCallersExit':_0x1b4bdf['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x1b4bdf[_0x834e('0x42')],'predictiveIntervalErlangCalls':_0x1b4bdf['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x1b4bdf[_0x834e('0x43')],'predictiveIntervalHitRate':_0x1b4bdf[_0x834e('0x44')],'predictiveIntervalMultiplicativeFactor':_0x1b4bdf[_0x834e('0x45')],'predictiveIntervalPauses':_0x1b4bdf[_0x834e('0x46')],'predictiveIntervalAvailable':_0x1b4bdf[_0x834e('0x47')],'predictiveIntervalTotalCalls':_0x1b4bdf[_0x834e('0x48')],'message':_0x1b4bdf[_0x834e('0x49')],'originated':_0x1b4bdf[_0x834e('0x4a')],'erlangCalls':_0x1b4bdf[_0x834e('0x4b')],'erlangCallToSecond':_0x1b4bdf[_0x834e('0x4c')],'erlangAbandonmentRate':_0x1b4bdf['erlangAbandonmentRate'],'erlangBusyFactor':_0x1b4bdf[_0x834e('0x4d')],'startPredictive':_0x1b4bdf[_0x834e('0x4e')],'startProgressive':_0x1b4bdf[_0x834e('0x4f')]};if(_0x1b4bdf[_0x834e('0x50')]){_0x5c55ca['Trunk']={'id':_0x1b4bdf[_0x834e('0x50')]['id'],'name':_0x1b4bdf[_0x834e('0x50')]['name'],'active':_0x1b4bdf['Trunk']['active'],'callerid':_0x1b4bdf[_0x834e('0x50')][_0x834e('0x51')]};}if(_0x1b4bdf[_0x834e('0x52')]){_0x5c55ca[_0x834e('0x52')]={'id':_0x1b4bdf[_0x834e('0x52')]['id'],'name':_0x1b4bdf[_0x834e('0x52')]['name']};}var _0x2c2d94=md5(JSON['stringify'](_0x5c55ca));if(_0x1b4bdf[_0x834e('0x4')]!==_0x2c2d94){_0x1b4bdf[_0x834e('0x4')]=_0x2c2d94;emit(util['format'](_0x834e('0x53'),_0x5c55ca[_0x834e('0x54')]),'voice_queue:save',_0x5c55ca);}}}function emitVoiceQueueChannelRemove(_0x481f70){logger[_0x834e('0x55')](_0x834e('0x56'),JSON[_0x834e('0x57')](_0x481f70));emit(util[_0x834e('0x58')](_0x834e('0x53'),_0x481f70['name']),_0x834e('0x59'),_0x481f70);}function notSendMessagesQueue(_0x548d1d){if(_0x548d1d['sendMessageOneNotActive']){if(_0x548d1d[_0x834e('0x4a')]===0x0&&_0x548d1d['pTalking']===0x0){_0x548d1d[_0x834e('0x5a')]=![];_0x548d1d[_0x834e('0x5b')]=0x0;_0x548d1d[_0x834e('0x5c')]=0x0;_0x548d1d[_0x834e('0x49')]=_0x834e('0x5d');ut['logger'](_0x834e('0x5e'),_0x548d1d[_0x834e('0x54')]+_0x834e('0x5f'));}else{_0x548d1d['message']=_0x834e('0x60');ut[_0x834e('0x61')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x548d1d[_0x834e('0x54')]+'\x20is\x20disactive');}emitCampaignPreview(_0x548d1d);}}Preview[_0x834e('0x10')][_0x834e('0x24')]=function(){var _0x4a18bb=this;setInterval(function(){_0x4a18bb['syncCampaigns']();},0x7cf);};Preview[_0x834e('0x10')][_0x834e('0x62')]=function(){var _0x3bcbf4=this[_0x834e('0x15')];this[_0x834e('0x18')]+=0x1;for(var _0x23feea in _0x3bcbf4){if(_0x3bcbf4[_0x834e('0x63')](_0x23feea)&&(_0x3bcbf4[_0x23feea]['dialMethod']===_0x834e('0x8')||_0x3bcbf4[_0x23feea]['dialMethod']===_0x834e('0x64'))&&_0x3bcbf4[_0x23feea]['type']===_0x834e('0x26')){if(this['clockClearZombieChannels']>0x7){this[_0x834e('0x18')]=0x0;this[_0x834e('0x65')]();}}if(_0x3bcbf4['hasOwnProperty'](_0x23feea)&&_0x3bcbf4[_0x23feea][_0x834e('0x30')]===_0x834e('0x8')&&_0x3bcbf4[_0x23feea][_0x834e('0x25')]===_0x834e('0x26')){if(_0x3bcbf4[_0x23feea][_0x834e('0x66')]){this[_0x834e('0x67')](_0x3bcbf4[_0x23feea]);this[_0x834e('0x68')](_0x3bcbf4[_0x23feea]);}else{notSendMessagesQueue(_0x3bcbf4[_0x23feea]);}}}};Preview[_0x834e('0x10')][_0x834e('0x69')]=function(_0x279ea1){var _0x5f3943=this;this[_0x834e('0x14')][_0x834e('0x11')](function(){if(!_['isNil'](_0x5f3943[_0x834e('0x6a')][_0x279ea1])){loggerAction[_0x834e('0x55')](_0x834e('0x6b'),_0x279ea1,_0x834e('0x6c'),_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6d')],'originated:\x20',JSON['stringify'](_0x5f3943[_0x834e('0x15')][_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6d')]][_0x834e('0x4a')]),_0x834e('0x6e'),JSON[_0x834e('0x57')](_0x5f3943[_0x834e('0x15')][_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6d')]][_0x834e('0x2a')]),JSON[_0x834e('0x57')](_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6f')]),JSON[_0x834e('0x57')](_[_0x834e('0x70')](_0x5f3943[_0x834e('0x6a')][_0x279ea1],[_0x834e('0x71'),_0x834e('0x72'),_0x834e('0x73'),_0x834e('0x74')])));return ami['Action']({'action':_0x834e('0x75'),'channel':_0x5f3943[_0x834e('0x6a')][_0x279ea1]['channel']})[_0x834e('0x76')](function(_0x3b0988){if(_0x3b0988['message']===_0x834e('0x77')){setTimeout(function(){if(_0x5f3943[_0x834e('0x6a')][_0x279ea1]){ut[_0x834e('0x78')](_0x5f3943[_0x834e('0x15')][_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6d')]],_0x834e('0x79'));if(_0x5f3943['actions'][_0x279ea1][_0x834e('0x6f')]===!![]){ut[_0x834e('0x7a')](_0x5f3943[_0x834e('0x15')][_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6d')]],_0x834e('0x79'));ut[_0x834e('0x7b')](_0x834e('0x7c')+_0x279ea1,_0x5f3943['actions'][_0x279ea1][_0x834e('0x6d')]);}ut['loggerError'](_0x834e('0x7d')+_0x279ea1,_0x5f3943['actions'][_0x279ea1][_0x834e('0x6d')]);delete _0x5f3943['actions'][_0x279ea1];}},0x2328);}});}});};Preview['prototype'][_0x834e('0x65')]=function(){var _0x3e1bee=this;loggerAction['info']('[action]',_[_0x834e('0x7e')](this[_0x834e('0x6a')]));for(var _0x138ed2 in this[_0x834e('0x6a')]){if(_0x3e1bee[_0x834e('0x6a')][_0x834e('0x63')](_0x138ed2)){_0x3e1bee[_0x834e('0x69')](_0x138ed2);}}};Preview[_0x834e('0x10')]['recallMe']=function(_0x142334){var _0x3c70bf=this;rpcDb['getContactRecallMe'](_0x142334['id'],ut[_0x834e('0x7f')](this['agents']))[_0x834e('0x80')](function(_0x45eceb){if(!_['isNil'](_0x45eceb)){for(var _0x41ef86=0x0;_0x41ef86<_0x45eceb[_0x834e('0x81')];_0x41ef86+=0x1){if(ut[_0x834e('0x82')](_0x45eceb[_0x41ef86][_0x834e('0x83')])<_0x142334['dialRecallMeTimeout']*0x3c){if(_0x45eceb[_0x41ef86][_0x834e('0x84')]&&!_0x45eceb[_0x41ef86][_0x834e('0x84')][_0x834e('0x85')]){_0x3c70bf['run'](_0x45eceb[_0x41ef86]['id'])[_0x834e('0x80')](ut[_0x834e('0x86')](_0x834e('0x87')))[_0x834e('0x76')](ut[_0x834e('0x86')](_0x834e('0x87')));}else{rpcDb[_0x834e('0x88')](_0x45eceb[_0x41ef86]['id']);}}else{var _0x1def00=new Action(_0x45eceb[_0x41ef86],_0x142334);_0x1def00[_0x834e('0x89')]=moment()[_0x834e('0x58')](_0x834e('0x8a'));_0x142334[_0x834e('0x3b')]+=0x1;ut[_0x834e('0x8b')](_0x1def00,0x17,_0x834e('0x8c'));if(_0x142334[_0x834e('0x8d')]){rpcDb[_0x834e('0x8e')](ut[_0x834e('0x8f')](_0x45eceb[_0x41ef86]));rpcDb[_0x834e('0x90')](_0x1def00,_0x834e('0x91'));}else{ut[_0x834e('0x8b')](_0x1def00,0x16,_0x834e('0x92'));rpcDb[_0x834e('0x90')](_0x1def00,'[HistoryRecallClose]');rpcDb[_0x834e('0x93')](_0x1def00,_0x834e('0x94'));}}}}})[_0x834e('0x76')](ut[_0x834e('0x86')]('[getContactRecallMe]'));};Preview[_0x834e('0x10')]['setMessage']=function(_0x56a152){_0x56a152[_0x834e('0x5a')]=!![];if(ut[_0x834e('0x95')](_0x56a152[_0x834e('0x29')])){_0x56a152[_0x834e('0x49')]=_0x834e('0x96');}else if(!ut[_0x834e('0x97')](_0x56a152[_0x834e('0x66')])){_0x56a152[_0x834e('0x49')]='NOT_ACTIVE';}else if(!this[_0x834e('0x98')](_0x56a152['Trunk'])){if(!this[_0x834e('0x98')](_0x56a152[_0x834e('0x99')])){_0x56a152['message']='TRUNK_IS_NOT_REACHABLE';}else{_0x56a152[_0x834e('0x49')]=_0x834e('0x9a');}}else{_0x56a152[_0x834e('0x49')]=_0x834e('0x9a');}emitCampaignPreview(_0x56a152);};Preview[_0x834e('0x10')]['callProgressDetectingCustomer']=function(_0x2b0d93,_0x15018f,_0x2df64f){var _0x228a60=this;var _0x3181af=this[_0x834e('0x6a')][_0x15018f];var _0x87818b=this[_0x834e('0x15')][_0x3181af[_0x834e('0x6d')]];var _0x324f67;if(_0x87818b){switch(_0x2df64f){case'1':_0x87818b['outboundNoSuchCallsDay']+=0x1;_0x3181af[_0x834e('0x9b')]+=0x1;_0x3181af[_0x834e('0x9c')]=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x0,'NoSuchNumber');ami[_0x834e('0x9e')]('custom:agentnosuchnumber',ut['buildObj'](_0x3181af,'nosuchnumber'));rpcDb[_0x834e('0x90')](_0x3181af,_0x834e('0x9f'));if(ut['totalGlobal'](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,'Global');rpcDb[_0x834e('0x93')](_0x324f67,_0x834e('0xa2'));}else{if(_0x3181af['countnosuchnumberretry']>=_0x87818b['dialNoSuchNumberMaxRetry']){rpcDb[_0x834e('0x93')](_0x3181af,_0x834e('0xa2'));}else{rpcDb[_0x834e('0xa3')](ut[_0x834e('0xa4')](_0x3181af,_0x834e('0x9b'),_0x87818b['dialNoSuchNumberRetryFrequency']),_0x3181af[_0x834e('0xa5')],_0x3181af['activeContact']);}}delete this[_0x834e('0x6a')][_0x2b0d93[_0x834e('0xa6')]];break;case _0x834e('0xa7'):var _0x5afb41=moment()[_0x834e('0x58')](_0x834e('0x8a'));_0x3181af['responsetime']=_0x5afb41;_0x3181af[_0x834e('0xa8')]=_0x5afb41;_0x3181af[_0x834e('0x6f')]=!![];_0x87818b[_0x834e('0x2a')]+=0x1;logger['info'](_0x834e('0xa9'),_0x3181af[_0x834e('0xaa')],_0x834e('0xab'),_0x87818b[_0x834e('0x54')],_0x834e('0x6e'),_0x87818b[_0x834e('0x2a')]);ami[_0x834e('0x9e')](_0x834e('0xac'),ut[_0x834e('0xad')](_0x3181af,_0x834e('0xae'),this['campaignsPreview'][_0x3181af['queue']]));if(_0x87818b['acw']){ami[_0x834e('0x9e')](_0x834e('0xaf'),ut[_0x834e('0xb0')](_0x3181af));}break;case'16':ami[_0x834e('0x9e')](_0x834e('0xb1'),ut['buildObj'](_0x3181af,'complete',this[_0x834e('0x15')][_0x3181af[_0x834e('0x6d')]]));emitVoiceQueueChannelRemove(ut[_0x834e('0xad')](_0x3181af,_0x834e('0xb2')));_0x87818b[_0x834e('0xb3')]+=0x1;_0x87818b['total']+=0x1;_0x87818b[_0x834e('0x28')]+=0x1;ut[_0x834e('0x7a')](_0x87818b,_0x834e('0xb4'));_0x3181af['countglobal']=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x4,_0x834e('0xb5'));rpcDb[_0x834e('0x90')](_0x3181af,_0x834e('0xb6'));rpcDb['createCustomerFinal'](_0x3181af,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x834e('0xb7')](_0x3181af);_0x87818b[_0x834e('0x2b')]+=_0x3181af['talktime'];_0x87818b[_0x834e('0xb8')]+=_0x3181af['talktime'];logger[_0x834e('0x55')](_0x834e('0xb9'),_0x3181af[_0x834e('0xaa')],'\x20Queue',_0x87818b[_0x834e('0x54')],'pTalking:\x20',_0x87818b['pTalking']);delete this['actions'][_0x2b0d93[_0x834e('0xa6')]];break;case _0x834e('0xba'):_0x87818b[_0x834e('0xbb')]+=0x1;_0x3181af[_0x834e('0xbc')]+=0x1;_0x3181af[_0x834e('0x9c')]=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x5,_0x834e('0xbd'));ami[_0x834e('0x9e')]('custom:agentbusy',ut[_0x834e('0xad')](_0x3181af,'busy'));rpcDb[_0x834e('0x90')](_0x3181af,_0x834e('0xbe'));if(ut[_0x834e('0x9d')](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,_0x834e('0xbf'));rpcDb['createCustomerFinal'](_0x324f67,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x3181af[_0x834e('0xbc')]>=_0x87818b[_0x834e('0xc0')]){rpcDb['createCustomerFinal'](_0x3181af,_0x834e('0xbe'));}else{rpcDb[_0x834e('0xa3')](ut[_0x834e('0xa4')](_0x3181af,_0x834e('0xbc'),_0x87818b[_0x834e('0xc1')]),_0x3181af['unlockAgent'],_0x3181af[_0x834e('0xc2')]);}}break;case _0x834e('0xc3'):_0x87818b['outboundNoAnswerCallsDay']+=0x1;_0x3181af['countnoanswerretry']+=0x1;_0x3181af['countglobal']=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x3,'NoAnswer');ami[_0x834e('0x9e')](_0x834e('0xc4'),ut['buildObj'](_0x3181af,_0x834e('0xc5')));rpcDb['createCustomerHistory'](_0x3181af,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x834e('0x9d')](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,_0x834e('0xbf'));rpcDb['createCustomerFinal'](_0x324f67,_0x834e('0xc6'));}else{if(_0x3181af[_0x834e('0xc7')]>=_0x87818b[_0x834e('0xc8')]){rpcDb[_0x834e('0x93')](_0x3181af,_0x834e('0xc9'));}else{rpcDb[_0x834e('0xa3')](ut[_0x834e('0xa4')](_0x3181af,_0x834e('0xc7'),_0x87818b[_0x834e('0xca')]),_0x3181af[_0x834e('0xa5')],_0x3181af[_0x834e('0xc2')]);}}break;case _0x834e('0xcb'):_0x87818b[_0x834e('0xcc')]+=0x1;_0x3181af[_0x834e('0xcd')]+=0x1;_0x3181af[_0x834e('0x9c')]=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x8,_0x834e('0xce'));ami[_0x834e('0x9e')](_0x834e('0xcf'),ut[_0x834e('0xad')](_0x3181af,_0x834e('0xd0')));rpcDb['createCustomerHistory'](_0x3181af,_0x834e('0xd1'));if(ut[_0x834e('0x9d')](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,_0x834e('0xbf'));rpcDb[_0x834e('0x93')](_0x324f67,_0x834e('0xd2'));}else{if(_0x3181af[_0x834e('0xcd')]>=_0x87818b[_0x834e('0xd3')]){rpcDb['createCustomerFinal'](_0x3181af,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut[_0x834e('0xa4')](_0x3181af,'countcongestionretry',_0x87818b[_0x834e('0xc1')]),_0x3181af[_0x834e('0xa5')],_0x3181af[_0x834e('0xc2')]);}}break;case'CANCEL':_0x87818b[_0x834e('0x3c')]+=0x1;_0x3181af[_0x834e('0xd4')]+=0x1;_0x3181af[_0x834e('0x9c')]=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x14,_0x834e('0xd5'));ami['emit'](_0x834e('0xd6'),ut[_0x834e('0xad')](_0x3181af,_0x834e('0xd7')));rpcDb[_0x834e('0x90')](_0x3181af,_0x834e('0xd8'));if(ut['totalGlobal'](_0x3181af)>=_0x87818b['dialGlobalMaxRetry']){_0x324f67=ut['cloneAction'](_0x3181af,0x14,'AgentReject');rpcDb[_0x834e('0x93')](_0x324f67,_0x834e('0xd9'));}else{if(_0x3181af['countagentrejectretry']>=_0x87818b[_0x834e('0xda')]){rpcDb[_0x834e('0x93')](_0x3181af,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x834e('0xa3')](ut[_0x834e('0xa4')](_0x3181af,_0x834e('0xd4'),_0x87818b[_0x834e('0xdb')]),_0x3181af[_0x834e('0xa5')],_0x3181af[_0x834e('0xc2')]);}}break;case'ABANDONED':_0x87818b['outboundAbandonedCallsDay']+=0x1;_0x3181af[_0x834e('0xdc')]+=0x1;_0x3181af[_0x834e('0x9c')]=ut[_0x834e('0x9d')](_0x3181af);ut['logCustomer'](_0x3181af,0xb,_0x834e('0xdd'));rpcDb[_0x834e('0x90')](_0x3181af,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x834e('0x9d')](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,_0x834e('0xbf'));rpcDb['createCustomerFinal'](_0x324f67,_0x834e('0xde'));}else{if(_0x3181af['countabandonedetry']>=_0x87818b['dialAbandonedMaxRety']){rpcDb[_0x834e('0x93')](_0x3181af,_0x834e('0xde'));}else{rpcDb[_0x834e('0xa3')](ut[_0x834e('0xa4')](_0x3181af,_0x834e('0xdc'),_0x87818b[_0x834e('0xdf')]),_0x3181af['unlockAgent'],_0x3181af['activeContact']);}}break;default:if(_0x3181af[_0x834e('0x6f')]){ut[_0x834e('0x7a')](_0x87818b,_0x834e('0xe0'));ut[_0x834e('0x7b')](_0x834e('0xe1')+_0x87818b[_0x834e('0x54')],_0x2b0d93);}_0x87818b[_0x834e('0x3d')]+=0x1;_0x3181af['countglobal']=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0xc,_0x2b0d93['cause-txt']||_0x2b0d93[_0x834e('0xe2')]);rpcDb[_0x834e('0x90')](_0x3181af,_0x834e('0xe3'));if(ut[_0x834e('0x9d')](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,_0x834e('0xbf'));rpcDb[_0x834e('0x93')](_0x324f67,_0x834e('0xe4'));}else{rpcDb[_0x834e('0x93')](_0x3181af,_0x834e('0xe4'));}delete this[_0x834e('0x6a')][_0x2b0d93[_0x834e('0xa6')]];}if(!(_0x3181af[_0x834e('0x6f')]&&_0x2df64f==='16')){ut['updateOriginated'](_0x87818b,_0x834e('0xe5'));logger[_0x834e('0x55')]('[originated][decrement][callProgressDetectingCustomer]',_0x3181af[_0x834e('0xaa')],'\x20Queue',_0x87818b[_0x834e('0x54')],'originated:\x20',_0x87818b[_0x834e('0x4a')]);}if(_0x2df64f!=='ANSWER'){delete this[_0x834e('0x6a')][_0x2b0d93[_0x834e('0xa6')]];delete this[_0x834e('0x6a')][_0x2b0d93[_0x834e('0xe6')]];}}};Preview['prototype'][_0x834e('0xe7')]=function(_0x38085e,_0x375fec,_0x2247f7){if(_[_0x834e('0xe8')](_0x375fec)&&_0x834e('0xe9')!==typeof _0x375fec){return;}if(_[_0x834e('0xe8')](_0x2247f7)&&_0x834e('0xe9')!==typeof _0x2247f7){return;}switch(_0x2247f7[_0x834e('0xea')]){case'0':ut[_0x834e('0xeb')](_0x38085e,0x0,_0x834e('0xec'));rpcDb[_0x834e('0xed')](_0x38085e,_0x834e('0xee'));break;case'3':ut[_0x834e('0xeb')](_0x38085e,0x3,_0x834e('0xef'));rpcDb[_0x834e('0xed')](_0x38085e,_0x834e('0xf0'));break;case'5':ut['logAgent'](_0x38085e,0x5,'Busy');rpcDb[_0x834e('0xed')](_0x38085e,_0x834e('0xf1'));break;case'8':ut[_0x834e('0xeb')](_0x38085e,0x8,_0x834e('0xce'));rpcDb[_0x834e('0xed')](_0x38085e,_0x834e('0xf2'));break;case'22':ut[_0x834e('0xeb')](_0x38085e,0x16,_0x834e('0xf3'));rpcDb[_0x834e('0xed')](_0x38085e,_0x834e('0xf4'));break;default:ut[_0x834e('0xeb')](_0x38085e,0xc,_0x2247f7[_0x834e('0xea')]);rpcDb['createAgentHistory'](_0x38085e,_0x834e('0xf2'));}ut['updateOriginated'](_0x375fec,_0x834e('0xf5'));logger[_0x834e('0x55')](_0x834e('0xf6'),_0x38085e['uniqueid'],_0x834e('0xab'),_0x375fec[_0x834e('0x54')],'originated:\x20',_0x375fec['originated']);delete this[_0x834e('0x6a')][_0x38085e[_0x834e('0xaa')]];};Preview['prototype'][_0x834e('0xf7')]=function(_0x132edd,_0x4643d9,_0x135219,_0x170ec2,_0x5e6fff){var _0x4e7545=this;return new BPromise(function(_0x453e58,_0x5dd31e){if(_['isNil'](_0x4643d9)||_['isNil'](_0x4643d9[_0x834e('0xf8')])||_[_0x834e('0xf9')](_0x4643d9['Contact'][_0x834e('0xfa')])||_[_0x834e('0xf9')](_0x4643d9[_0x834e('0x73')])){_0x5dd31e(ut[_0x834e('0x49')]('Contact\x20is\x20undefined',_0x170ec2,_0x5e6fff));return;}var _0x1998ba=uuid['v4']();var _0x288eb1=_0x4e7545[_0x834e('0x15')][_0x4643d9['Queue'][_0x834e('0x54')]];var _0x5f3b7d=_0x135219?_0x4e7545[_0x834e('0x17')][_0x135219]['id']:undefined;_0x4e7545['actions'][_0x1998ba]=new Action(_0x4643d9,_0x288eb1,_0x1998ba,_0x135219,_0x5f3b7d);var _0x461420=_0x4e7545[_0x834e('0x6a')][_0x1998ba];_0x461420['unlockAgent']=_0x170ec2;_0x461420[_0x834e('0xc2')]=_0x5e6fff;_0x461420[_0x834e('0xfb')]=_0x135219;if(_[_0x834e('0xfc')](_0x132edd)){_0x4e7545[_0x834e('0xfd')](_0x461420,_0x288eb1,_0x4643d9,_0x135219)[_0x834e('0x80')](function(_0x24d77c){logger['info'](_0x834e('0xfe'),_0x834e('0xff')+_0x461420[_0x834e('0x6d')]+_0x834e('0x100')+_0x461420[_0x834e('0x101')],JSON[_0x834e('0x57')](_0x24d77c));ami['emit'](_0x834e('0x102'),ut['buildObj'](_0x461420,'called',_0x4e7545[_0x834e('0x15')][_0x461420['queue']]));_0x453e58(ut['message'](_0x834e('0x103')));})[_0x834e('0x76')](function(_0x257fed){ut[_0x834e('0x61')](_0x834e('0x104'),_0x257fed);_0x5dd31e(ut[_0x834e('0x49')](_0x834e('0x105'),_0x170ec2,_0x5e6fff));});}else{_0x288eb1[_0x834e('0x106')]+=0x1;ut[_0x834e('0x107')](_0x461420);rpcDb[_0x834e('0x108')](_0x461420,_0x834e('0x109'));delete _0x4e7545[_0x834e('0x6a')][_0x1998ba];_0x5dd31e(ut[_0x834e('0x49')](_0x834e('0x10a'),_0x170ec2,_0x5e6fff));}});};Preview['prototype'][_0x834e('0x98')]=function(_0x4874e1){return!_[_0x834e('0xf9')](_0x4874e1)&&!_[_0x834e('0xf9')](_0x4874e1[_0x834e('0x54')])&&!_[_0x834e('0xf9')](_0x4874e1['active'])&&_0x4874e1['active']&&!_[_0x834e('0xf9')](this[_0x834e('0x16')][util['format'](_0x834e('0x10b'),_0x4874e1[_0x834e('0x54')])])&&!_['isNil'](this[_0x834e('0x16')][util[_0x834e('0x58')](_0x834e('0x10b'),_0x4874e1[_0x834e('0x54')])]['status'])&&(this['trunks'][util['format']('SIP/%s',_0x4874e1[_0x834e('0x54')])][_0x834e('0x75')]==='reachable'||this[_0x834e('0x16')][util['format'](_0x834e('0x10b'),_0x4874e1[_0x834e('0x54')])][_0x834e('0x75')]===_0x834e('0x10c'));};Preview[_0x834e('0x10')][_0x834e('0x10d')]=function(_0x3c775f,_0x4fc61d){var _0x12a0f3=this;return new BPromise(function(_0x20d52f,_0x59ac23){_0x12a0f3[_0x834e('0x10e')](_0x3c775f,_0x4fc61d)[_0x834e('0x80')](function(_0x536f66){_0x20d52f(_['pick'](_0x536f66,['message']));})[_0x834e('0x76')](function(_0x19e17b){if(_0x19e17b[_0x834e('0x10f')]){rpcDb['unlockContact'](_0x3c775f);}if(_0x19e17b[_0x834e('0x110')]){rpcDb[_0x834e('0x88')](_0x3c775f);}_0x59ac23(_[_0x834e('0x70')](_0x19e17b,[_0x834e('0x49')]));});});};Preview[_0x834e('0x10')][_0x834e('0x10e')]=function(_0x19cb0b,_0x13af70){var _0x8804a8=this;return new BPromise(function(_0x102640,_0x48b6c4){var _0x5d6b66,_0x117e8f;rpcDb[_0x834e('0x111')](_0x19cb0b)[_0x834e('0x80')](function(_0x3eda93){if(!_[_0x834e('0xf9')](_0x3eda93[0x0])){_0x117e8f=_0x3eda93[0x0][_0x834e('0x112')]?![]:!![];_0x5d6b66=_0x3eda93[0x0][_0x834e('0x112')]?!![]:![];_0x5d6b66=_0x13af70?!![]:_0x5d6b66;}var _0x39210f=_0x8804a8[_0x834e('0x113')](_0x3eda93);if(_0x39210f[_0x834e('0x114')]){rpcDb[_0x834e('0x115')](_[_0x834e('0x70')](_0x3eda93[0x0],[_0x834e('0x73'),'Contact.phone']))[_0x834e('0x80')](function(_0x3b13be){_0x8804a8[_0x834e('0xf7')](_0x3b13be,_0x3eda93[0x0],_0x13af70,_0x117e8f,_0x5d6b66)[_0x834e('0x80')](function(_0x495697){_0x102640(_0x495697);})['catch'](function(_0x4e7c43){_0x48b6c4(_0x4e7c43);});})[_0x834e('0x76')](function(_0xf98fb4){ut[_0x834e('0x61')](_0x834e('0x116'),_0xf98fb4);_0x48b6c4(ut[_0x834e('0x49')](_0x834e('0x117'),_0x117e8f,_0x5d6b66));});}else{_0x48b6c4(ut[_0x834e('0x49')](_0x39210f[_0x834e('0x49')],_0x117e8f,_0x5d6b66));}})['catch'](function(_0x58ff66){ut['logger']('[Preview][getContactPreview]',_0x58ff66);_0x48b6c4(ut[_0x834e('0x49')](_0x834e('0x117'),![],!![]));});});};Preview[_0x834e('0x10')][_0x834e('0x113')]=function(_0x72f950){if(_[_0x834e('0xf9')](_0x72f950)||_[_0x834e('0xfc')](_0x72f950)||!_[_0x834e('0xf9')](_0x72f950[0x0][_0x834e('0x84')])&&_['isNil'](_0x72f950[0x0]['Agent']['name'])){ut['logger'](_0x834e('0x118'),_0x72f950);return{'isValid':![],'message':_0x834e('0x119')};}var _0x284183=this[_0x834e('0x15')][_0x72f950[0x0][_0x834e('0x6c')][_0x834e('0x54')]];_0x284183[_0x834e('0x49')]=_0x834e('0x9a');if(_[_0x834e('0xf9')](_0x284183)){ut[_0x834e('0x61')](_0x834e('0x11a'),_0x284183);return{'isValid':![],'message':_0x834e('0x11b')};}if(!this[_0x834e('0x98')](_0x284183[_0x834e('0x50')])){ut[_0x834e('0x61')](_0x834e('0x11c'),'campaign\x20Name:\x20'+_0x284183[_0x834e('0x54')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x834e('0x98')](_0x284183[_0x834e('0x99')])){ut[_0x834e('0x61')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x284183[_0x834e('0x54')]+_0x834e('0x11d'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut['isActive'](_0x284183[_0x834e('0x66')])){ut[_0x834e('0x61')](_0x834e('0x11e'),_0x284183[_0x834e('0x54')]+_0x834e('0x11f'));return{'isValid':![],'message':_0x834e('0x120')+_0x284183[_0x834e('0x54')]+_0x834e('0x11f')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x834e('0x10')][_0x834e('0xfd')]=function(_0x375e40,_0x1d4947,_0x1912e6,_0x614e15){var _0x17aaae=this;return new BPromise(function(_0x58ebc8,_0x40a92a){var _0x59e298=_0x375e40['uniqueid'];var _0x1115b7=_0x17aaae[_0x834e('0x98')](_0x1d4947['Trunk'])?util[_0x834e('0x58')](_0x834e('0x121'),_0x1d4947['Trunk'][_0x834e('0x54')],_[_0x834e('0xf9')](_0x1d4947['dialPrefix'])?'':_0x1d4947['dialPrefix'][_0x834e('0x122')]()||'',_0x1d4947[_0x834e('0x123')]>0x0?_0x1912e6['Contact']['phone'][_0x834e('0x124')](_0x1d4947[_0x834e('0x123')]):_0x1912e6['Contact']['phone']):util['format']('SIP/%s/%s%s',_[_0x834e('0xf9')](_0x1d4947['TrunkBackup'])?_0x1d4947[_0x834e('0x50')]['name']:_0x1d4947[_0x834e('0x99')][_0x834e('0x54')],_[_0x834e('0xf9')](_0x1d4947[_0x834e('0x34')])?'':_0x1d4947['dialPrefix'][_0x834e('0x122')]()||'',_0x1d4947[_0x834e('0x123')]>0x0?_0x1912e6[_0x834e('0xf8')][_0x834e('0xfa')][_0x834e('0x124')](_0x1d4947[_0x834e('0x123')]):_0x1912e6[_0x834e('0xf8')][_0x834e('0xfa')]);var _0x464ae6=_0x17aaae[_0x834e('0x98')](_0x1d4947['Trunk'])?ut[_0x834e('0x125')](_0x1d4947['Trunk'][_0x834e('0x51')],_0x1d4947[_0x834e('0x31')],_0x1d4947[_0x834e('0x126')]>0x0?ut[_0x834e('0x127')](_0x1d4947[_0x834e('0x32')],_0x1d4947['dialRandomLastDigitCallerIdNumber']):_0x1d4947[_0x834e('0x32')]):ut['getCallerId'](_['isNil'](_0x1d4947[_0x834e('0x99')])?_0x1d4947[_0x834e('0x50')][_0x834e('0x51')]:_0x1d4947['TrunkBackup'][_0x834e('0x51')],_0x1d4947[_0x834e('0x31')],_0x1d4947[_0x834e('0x126')]>0x0?ut[_0x834e('0x127')](_0x1d4947[_0x834e('0x32')],_0x1d4947[_0x834e('0x126')]):_0x1d4947[_0x834e('0x32')]);if(_0x464ae6){_0x375e40[_0x834e('0x128')]=ut[_0x834e('0x129')](_0x464ae6);_0x375e40[_0x834e('0x12a')]=ut[_0x834e('0x12b')](_0x464ae6);}var _0x578204=ut[_0x834e('0x12c')](_0x1d4947,_0x1912e6,_0x1115b7,_0x464ae6,_0x59e298,_0x375e40);_[_0x834e('0x12d')](_0x375e40,ut[_0x834e('0x12e')](_0x578204));_0x375e40[_0x834e('0x89')]=moment()[_0x834e('0x58')](_0x834e('0x8a'));ami['Action'](ut[_0x834e('0x12f')](_0x375e40,_0x1d4947,_0x578204,_0x375e40[_0x834e('0xc2')],_0x614e15))[_0x834e('0x80')](function(_0x37dea1){_0x1d4947[_0x834e('0x4a')]+=0x1;logger[_0x834e('0x55')](_0x834e('0x130'),_0x59e298,_0x834e('0xab'),_0x1d4947[_0x834e('0x54')],_0x834e('0x131'),_0x1d4947['originated']);_0x58ebc8(_0x37dea1);})['catch'](function(_0x5f339f){ut['logAgent'](_0x375e40,0xe,_0x834e('0x132'));rpcDb[_0x834e('0xed')](_0x375e40,_0x834e('0x133'));_0x40a92a(_0x5f339f);});});};Preview[_0x834e('0x10')][_0x834e('0x134')]=function(_0x1d53c6){if(this['actions'][_0x1d53c6[_0x834e('0xa6')]]){this['actions'][_0x1d53c6['linkedid']]['channel']=_0x1d53c6[_0x834e('0x135')];}};Preview[_0x834e('0x10')]['syncOriginateResponse']=function(_0x5cb379){var _0x494e08=this;var _0x2515f6=this[_0x834e('0x6a')][_0x5cb379[_0x834e('0x136')]];if(_0x2515f6){if(_0x2515f6['lookAgent']&&this[_0x834e('0x17')][_0x2515f6[_0x834e('0xfb')]]){ut[_0x834e('0x137')](_0x2515f6,this[_0x834e('0x17')][_0x2515f6[_0x834e('0xfb')]][_0x834e('0x54')],this['agents'][_0x2515f6['lookAgent']]['id']);}var _0x5c7fe3=_['clone'](_0x2515f6);_0x5c7fe3[_0x834e('0x138')]=moment()[_0x834e('0x58')](_0x834e('0x8a'));var _0xfa95ad=_0x494e08[_0x834e('0x15')][_0x2515f6[_0x834e('0x6d')]];if(ut[_0x834e('0x139')](_0x5cb379[_0x834e('0x13a')])){if(_0x2515f6[_0x834e('0xa5')]){rpcDb[_0x834e('0x13b')](_0x2515f6[_0x834e('0x101')]);}if(_0x2515f6[_0x834e('0xc2')]){rpcDb[_0x834e('0x88')](_0x2515f6[_0x834e('0x101')]);}ami[_0x834e('0x9e')]('custom:agentringnoanswer',ut['buildObj'](_0x2515f6,_0x834e('0x13c'),this[_0x834e('0x15')][_0x2515f6[_0x834e('0x6d')]]));this['callProgressDetectingAgent'](_0x5c7fe3,_0xfa95ad,_0x5cb379);}else{_0x2515f6[_0x834e('0x89')]=moment()[_0x834e('0x58')](_0x834e('0x8a'));ut[_0x834e('0xeb')](_0x5c7fe3,0x4,_0x834e('0xb5'));rpcDb[_0x834e('0xed')](_0x5c7fe3,_0x834e('0x13d'));}}};Preview[_0x834e('0x10')][_0x834e('0x13e')]=function(_0x53850c){var _0x1785ca=this;var _0x2e0674=this[_0x834e('0x6a')][_0x53850c[_0x834e('0xa6')]];var _0x4b6834;if(_0x2e0674){_0x4b6834=this[_0x834e('0x15')][_0x2e0674[_0x834e('0x6d')]];logger[_0x834e('0x55')](_0x834e('0x13f'),_0x53850c[_0x834e('0xa6')],_0x834e('0xab'),_0x4b6834[_0x834e('0x54')],_0x834e('0x6e'),_0x4b6834[_0x834e('0x2a')]);}if(this['actions'][_0x53850c[_0x834e('0xa6')]]&&_0x53850c['linkedid']!==_0x53850c[_0x834e('0xaa')]){if(_0x53850c['cause']==='16'&&this[_0x834e('0x6a')][_0x53850c[_0x834e('0xa6')]][_0x834e('0x6f')]){this[_0x834e('0x140')](_0x53850c,_0x53850c[_0x834e('0xa6')],_0x53850c['cause']);}else if(this[_0x834e('0x6a')][_0x53850c[_0x834e('0xa6')]]['dialAnswer']){logger['info'](_0x834e('0x141'),_0x53850c['linkedid'],_0x53850c['cause'],'\x20Queue',_0x4b6834[_0x834e('0x54')],_0x834e('0x6e'),_0x4b6834[_0x834e('0x2a')]);this[_0x834e('0x140')](_0x53850c,_0x53850c[_0x834e('0xa6')],_0x53850c[_0x834e('0x142')]);}}else if(_0x2e0674&&_[_0x834e('0xf9')](_0x2e0674['statedesc'])&&_0x4b6834[_0x834e('0x143')]&&_0x53850c[_0x834e('0xa6')]===_0x53850c['uniqueid']&&_['isNil'](_0x53850c[_0x834e('0xea')])&&_0x53850c[_0x834e('0x142')]==='16'&&_0x53850c['channelstate']==='6'&&_['isUndefined'](_0x2e0674[_0x834e('0x144')])){if(_0x2e0674[_0x834e('0xa5')]){rpcDb[_0x834e('0x13b')](_0x2e0674['idContact']);}if(_0x2e0674[_0x834e('0xc2')]){rpcDb[_0x834e('0x88')](_0x2e0674[_0x834e('0x101')]);}_0x53850c['reason']='22';this[_0x834e('0xe7')](_0x2e0674,_0x4b6834,_0x53850c);}else if(_0x2e0674&&_0x2e0674['transfer']){if(_0x53850c[_0x834e('0x142')]==='16'&&this[_0x834e('0x6a')][_0x53850c[_0x834e('0xa6')]][_0x834e('0x6f')]){logger[_0x834e('0x55')]('[syncHangup][talking][transfer]',_0x53850c[_0x834e('0xa6')],_0x53850c[_0x834e('0x142')],_0x834e('0xab'),_0x4b6834[_0x834e('0x54')],_0x834e('0x6e'),_0x4b6834['pTalking']);this['callProgressDetectingCustomer'](_0x53850c,_0x53850c[_0x834e('0xa6')],_0x53850c[_0x834e('0x142')]);}else if(this[_0x834e('0x6a')][_0x53850c['linkedid']][_0x834e('0x6f')]){logger[_0x834e('0x55')](_0x834e('0x141'),_0x53850c[_0x834e('0xa6')],_0x53850c['cause'],_0x834e('0xab'),_0x4b6834[_0x834e('0x54')],'pTalking:\x20',_0x4b6834[_0x834e('0x2a')]);this[_0x834e('0x140')](_0x53850c,_0x53850c[_0x834e('0xa6')],_0x53850c[_0x834e('0x142')]);}}};Preview['prototype'][_0x834e('0x1d')]=function(_0x52a673){if(this[_0x834e('0x6a')][_0x52a673[_0x834e('0xe6')]]&&_0x52a673[_0x834e('0xe6')]!==_0x52a673[_0x834e('0x145')]){this[_0x834e('0x140')](_0x52a673,_0x52a673[_0x834e('0xe6')],_0x52a673['dialstatus']);}};Preview['prototype'][_0x834e('0x1c')]=function(_0x3f2c59){if(this['actions'][_0x3f2c59[_0x834e('0xa6')]]&&_0x3f2c59['linkedid']!==_0x3f2c59[_0x834e('0xaa')]&&!this[_0x834e('0x6a')][_0x3f2c59[_0x834e('0xa6')]][_0x834e('0x6f')]){if(_0x3f2c59[_0x834e('0x142')]==='1'){this[_0x834e('0x140')](_0x3f2c59,_0x3f2c59[_0x834e('0xa6')],_0x3f2c59['cause']);}}};Preview[_0x834e('0x10')][_0x834e('0x146')]=function(_0x2a6bca,_0x223d48,_0x1c03bc){if(this['actions'][_0x2a6bca]){if(_[_0x834e('0xf9')](this[_0x834e('0x6a')][_0x2a6bca][_0x834e('0x147')])){this['actions'][_0x2a6bca]['variables']={};}this['actions'][_0x2a6bca][_0x834e('0x147')][_0x223d48]=_0x1c03bc;}};Preview[_0x834e('0x10')][_0x834e('0x20')]=function(_0xd6f2cc){try{if(!_[_0x834e('0xf9')](_0xd6f2cc)){if(ut[_0x834e('0x148')](_[_0x834e('0x149')](_0xd6f2cc[_0x834e('0x14a')])[0x0])){this[_0x834e('0x146')](_0xd6f2cc[_0x834e('0xaa')],_[_0x834e('0x149')](_0xd6f2cc['variable'])[0x0],_0xd6f2cc[_0x834e('0x14b')]);}}}catch(_0x3552b1){logger[_0x834e('0x14c')](_0x834e('0x14d'),util[_0x834e('0x14e')](_0x3552b1,{'showHidden':![],'depth':null}));}};Preview[_0x834e('0x10')][_0x834e('0x22')]=function(_0xa4bb26){if(_0xa4bb26){if(this['actions'][_0xa4bb26[_0x834e('0x14f')]]){this[_0x834e('0x6a')][_0xa4bb26['transfertargetlinkedid']][_0x834e('0x144')]=!![];}}};Preview[_0x834e('0x10')][_0x834e('0x23')]=function(_0x3fba1d){if(_0x3fba1d){if(this['actions'][_0x3fba1d['transfererlinkedid']]){this[_0x834e('0x6a')][_0x3fba1d['transfererlinkedid']][_0x834e('0x144')]=!![];}}};module[_0x834e('0x150')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 93877d7..328cd5c 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 _0x8958=['catch','[createHistory]\x20','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercompleteAt','connectedlinename','membername','context','from-sip','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','inspect','then','createHistory'];(function(_0x3c7347,_0x3aebf2){var _0x4c78cb=function(_0x43f589){while(--_0x43f589){_0x3c7347['push'](_0x3c7347['shift']());}};_0x4c78cb(++_0x3aebf2);}(_0x8958,0x93));var _0x8895=function(_0xb56705,_0x45c970){_0xb56705=_0xb56705-0x0;var _0x5eb94a=_0x8958[_0xb56705];return _0x5eb94a;};'use strict';var util=require('util');var BPromise=require(_0x8895('0x0'));var logger=require('../../../config/logger')('preview');var _=require('lodash');var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x8895('0x1'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x8895('0x2'));var voiceQueueRt=require(_0x8895('0x3'));var agentReportPreview=require(_0x8895('0x4'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x22fa52){return function(_0x2f03ad){logger[_0x8895('0x5')](_0x22fa52,util[_0x8895('0x6')](_0x2f03ad,{'showHidden':![],'depth':null}));};}function create(_0x33013a){return BPromise['resolve']()[_0x8895('0x7')](cmHopperHistory[_0x8895('0x8')](_0x33013a))[_0x8895('0x9')](loggerCatch(_0x8895('0xa')));}function createAgent(_0x6eab1e){return BPromise[_0x8895('0xb')]()[_0x8895('0x7')](agentReportPreview[_0x8895('0x8')](_0x6eab1e))[_0x8895('0x9')](loggerCatch(_0x8895('0xa')));}function moveContact(_0x4d1358){return BPromise[_0x8895('0xb')]()[_0x8895('0x7')](cmHopper[_0x8895('0xc')](_0x4d1358,!![]))[_0x8895('0x9')](loggerCatch(_0x8895('0xd')));}exports[_0x8895('0xe')]=function(_0x5af0ef){return BPromise[_0x8895('0xb')]()[_0x8895('0x7')](cmHopperBlack[_0x8895('0xe')](_0x5af0ef))['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x8895('0xf')]=function(_0x4e8f53){return BPromise[_0x8895('0xb')]()[_0x8895('0x7')](cmHopper[_0x8895('0xf')](_0x4e8f53))[_0x8895('0x9')](loggerCatch(_0x8895('0x10')));};exports['createHistory']=function(_0x4128e2,_0x100fc8){create(_0x4128e2)[_0x8895('0x9')](loggerCatch(_0x100fc8));moveContact(_0x4128e2)[_0x8895('0x9')](loggerCatch(_0x100fc8));};exports[_0x8895('0x11')]=function(_0x1b5c82,_0x304be6){createAgent(_0x1b5c82)[_0x8895('0x9')](loggerCatch(_0x304be6));};exports[_0x8895('0x12')]=function(_0x2da618,_0x24fef0){create(_0x2da618)[_0x8895('0x9')](loggerCatch(_0x24fef0));};exports[_0x8895('0x13')]=function(_0x54e6d4,_0x522a4e){moveContact(_0x54e6d4)['catch'](loggerCatch(_0x522a4e));};exports[_0x8895('0x14')]=function(_0x456282,_0x2d189c,_0x29449a){if(_0x2d189c){_0x456282[_0x8895('0x15')]=null;}if(_0x29449a){_0x456282[_0x8895('0x16')]=![];}return BPromise[_0x8895('0xb')]()[_0x8895('0x7')](cmHopper['rescheduleContact'](_0x456282))[_0x8895('0x9')](loggerCatch(_0x8895('0x17')));};exports[_0x8895('0x18')]=function(_0x1f71f3){return BPromise[_0x8895('0xb')]()['then'](cmHopper['countReScheduled'](_0x1f71f3))[_0x8895('0x9')](loggerCatch(_0x8895('0x19')));};exports[_0x8895('0x1a')]=function(_0x24a376){return BPromise['resolve']()[_0x8895('0x7')](cmHopper[_0x8895('0x1a')]({'UserId':null},_0x24a376,0x1))[_0x8895('0x9')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x78b57){return BPromise['resolve']()[_0x8895('0x7')](cmHopper[_0x8895('0x1a')]({'active':![]},_0x78b57,0x1))[_0x8895('0x9')](loggerCatch(_0x8895('0x1b')));};exports[_0x8895('0x1c')]=function(_0x5c03ea){var _0x4d567a={};_0x4d567a[_0x8895('0x1d')]=_0x5c03ea[_0x8895('0x1d')];_0x4d567a[_0x8895('0x1e')]=_0x5c03ea[_0x8895('0x1e')];_0x4d567a[_0x8895('0x1f')]=_0x5c03ea['calleridnum'];_0x4d567a['calleridname']=_0x5c03ea[_0x8895('0x20')];_0x4d567a[_0x8895('0x21')]=_0x5c03ea[_0x8895('0x21')];_0x4d567a[_0x8895('0x22')]=_0x5c03ea[_0x8895('0x23')];_0x4d567a['queuecallerleaveAt']=_0x5c03ea[_0x8895('0x23')];_0x4d567a['queuecallercomplete']=0x1;_0x4d567a[_0x8895('0x24')]=_0x5c03ea['endtime'];_0x4d567a[_0x8895('0x25')]=_0x5c03ea[_0x8895('0x26')];_0x4d567a[_0x8895('0x27')]=_0x8895('0x28');_0x4d567a[_0x8895('0x29')]='xcally-motion-preview';_0x4d567a[_0x8895('0x2a')]=0x0;_0x4d567a[_0x8895('0x2b')]=0x1;_0x4d567a[_0x8895('0x2c')]=_0x5c03ea[_0x8895('0x26')];_0x4d567a[_0x8895('0x2d')]='COMPLETED';return BPromise[_0x8895('0xb')]()['then'](voiceQueueReport[_0x8895('0x2e')](_0x4d567a))['catch'](loggerCatch(_0x8895('0x2f')));};exports[_0x8895('0x30')]=function(_0x20907a,_0x418e53){return BPromise[_0x8895('0xb')]()['then'](cmHopper[_0x8895('0x30')](_0x20907a,_0x418e53))['catch'](loggerCatch(_0x8895('0x31')));};exports[_0x8895('0x32')]=function(_0x36e13b){return BPromise[_0x8895('0xb')]()[_0x8895('0x7')](cmHopper[_0x8895('0x14')](_0x36e13b,!![],!![]))['catch'](loggerCatch(_0x8895('0x33')));}; \ No newline at end of file +var _0x5334=['[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','resolve','then','createHistory','catch','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[countReScheduled]\x20','unlockContact'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5334,0x84));var _0x4533=function(_0x25364f,_0xe9d4ba){_0x25364f=_0x25364f-0x0;var _0x111f90=_0x5334[_0x25364f];return _0x111f90;};'use strict';var util=require(_0x4533('0x0'));var BPromise=require(_0x4533('0x1'));var logger=require(_0x4533('0x2'))(_0x4533('0x3'));var _=require(_0x4533('0x4'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x4533('0x5'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x4533('0x6'));var voiceQueueRt=require(_0x4533('0x7'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x51b4ce){return function(_0x201673){logger['error'](_0x51b4ce,util['inspect'](_0x201673,{'showHidden':![],'depth':null}));};}function create(_0x487906){return BPromise[_0x4533('0x8')]()[_0x4533('0x9')](cmHopperHistory[_0x4533('0xa')](_0x487906))[_0x4533('0xb')](loggerCatch(_0x4533('0xc')));}function createAgent(_0x21b22f){return BPromise[_0x4533('0x8')]()['then'](agentReportPreview[_0x4533('0xa')](_0x21b22f))[_0x4533('0xb')](loggerCatch(_0x4533('0xc')));}function moveContact(_0x12131a){return BPromise['resolve']()[_0x4533('0x9')](cmHopper['moveContactManagedDialer'](_0x12131a,!![]))[_0x4533('0xb')](loggerCatch(_0x4533('0xd')));}exports[_0x4533('0xe')]=function(_0x19b74e){return BPromise['resolve']()[_0x4533('0x9')](cmHopperBlack[_0x4533('0xe')](_0x19b74e))[_0x4533('0xb')](loggerCatch(_0x4533('0xf')));};exports['getContactPreview']=function(_0xe47213){return BPromise['resolve']()['then'](cmHopper[_0x4533('0x10')](_0xe47213))[_0x4533('0xb')](loggerCatch('[getContactPreview]\x20'));};exports[_0x4533('0xa')]=function(_0x1e6a1a,_0x2a9877){create(_0x1e6a1a)['catch'](loggerCatch(_0x2a9877));moveContact(_0x1e6a1a)[_0x4533('0xb')](loggerCatch(_0x2a9877));};exports['createAgentHistory']=function(_0x3ddb36,_0x3d16a2){createAgent(_0x3ddb36)['catch'](loggerCatch(_0x3d16a2));};exports[_0x4533('0x11')]=function(_0x5a4e8f,_0x5c2c9c){create(_0x5a4e8f)[_0x4533('0xb')](loggerCatch(_0x5c2c9c));};exports[_0x4533('0x12')]=function(_0x49fb91,_0x53fe43){moveContact(_0x49fb91)[_0x4533('0xb')](loggerCatch(_0x53fe43));};exports[_0x4533('0x13')]=function(_0x3467ba,_0x1b08fa,_0x6766eb){if(_0x1b08fa){_0x3467ba[_0x4533('0x14')]=null;}if(_0x6766eb){_0x3467ba[_0x4533('0x15')]=![];}return BPromise['resolve']()[_0x4533('0x9')](cmHopper[_0x4533('0x13')](_0x3467ba))[_0x4533('0xb')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x138fd9){return BPromise[_0x4533('0x8')]()['then'](cmHopper['countReScheduled'](_0x138fd9))[_0x4533('0xb')](loggerCatch(_0x4533('0x16')));};exports[_0x4533('0x17')]=function(_0x4d8189){return BPromise[_0x4533('0x8')]()[_0x4533('0x9')](cmHopper[_0x4533('0x17')]({'UserId':null},_0x4d8189,0x1))[_0x4533('0xb')](loggerCatch(_0x4533('0x18')));};exports[_0x4533('0x19')]=function(_0x474c64){return BPromise[_0x4533('0x8')]()[_0x4533('0x9')](cmHopper['unlockContact']({'active':![]},_0x474c64,0x1))['catch'](loggerCatch(_0x4533('0x1a')));};exports['crateCustomerReportQueue']=function(_0x3fd76a){var _0x4e2b80={};_0x4e2b80[_0x4533('0x1b')]=_0x3fd76a[_0x4533('0x1b')];_0x4e2b80[_0x4533('0x1c')]=_0x3fd76a[_0x4533('0x1c')];_0x4e2b80[_0x4533('0x1d')]=_0x3fd76a[_0x4533('0x1d')];_0x4e2b80[_0x4533('0x1e')]=_0x3fd76a[_0x4533('0x1e')];_0x4e2b80[_0x4533('0x1f')]=_0x3fd76a[_0x4533('0x1f')];_0x4e2b80[_0x4533('0x20')]=_0x3fd76a[_0x4533('0x21')];_0x4e2b80[_0x4533('0x22')]=_0x3fd76a['answertime'];_0x4e2b80[_0x4533('0x23')]=0x1;_0x4e2b80['queuecallercompleteAt']=_0x3fd76a[_0x4533('0x24')];_0x4e2b80[_0x4533('0x25')]=_0x3fd76a[_0x4533('0x26')];_0x4e2b80[_0x4533('0x27')]=_0x4533('0x28');_0x4e2b80[_0x4533('0x29')]=_0x4533('0x2a');_0x4e2b80[_0x4533('0x2b')]=0x0;_0x4e2b80[_0x4533('0x2c')]=0x1;_0x4e2b80[_0x4533('0x2d')]=_0x3fd76a[_0x4533('0x26')];_0x4e2b80[_0x4533('0x2e')]='COMPLETED';return BPromise[_0x4533('0x8')]()[_0x4533('0x9')](voiceQueueReport[_0x4533('0x2f')](_0x4e2b80))[_0x4533('0xb')](loggerCatch(_0x4533('0x30')));};exports['getContactRecallMe']=function(_0x86c14d,_0x35aefe){return BPromise[_0x4533('0x8')]()[_0x4533('0x9')](cmHopper[_0x4533('0x31')](_0x86c14d,_0x35aefe))[_0x4533('0xb')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x4533('0x32')]=function(_0x36c289){return BPromise['resolve']()[_0x4533('0x9')](cmHopper[_0x4533('0x13')](_0x36c289,!![],!![]))[_0x4533('0xb')](loggerCatch(_0x4533('0x33')));}; \ 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 bf18364..4f32f00 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 _0x056a=['clone','statedesc','Global','scheduledat','minutes','ListId','VoiceQueueId','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','lastevent','queue','interface','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','createBody','filterKey','idContact','campaigntype','dialAnswer','active','countglobal','callback','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','pow','replace','random','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','milliseconds','diff','seconds','loggerCatch','inspect','logger','loggerError','error','logger2','info','message','getCallerId','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','responsetime','logAgent','ringtime','starttime','logLookAgent','membername','logCustomer','endtime','answertime','isFailure','variablesAction','RECALL','BOOKED','channelAgent','xcally-motion-preview','timeout','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x056a,0x15a));var _0xa056=function(_0x2e6422,_0x47c0ed){_0x2e6422=_0x2e6422-0x0;var _0x2fbf89=_0x056a[_0x2e6422];return _0x2fbf89;};'use strict';var util=require(_0xa056('0x0'));var _=require(_0xa056('0x1'));var moment=require(_0xa056('0x2'));var logger=require(_0xa056('0x3'))(_0xa056('0x4'));var ipAgi=process[_0xa056('0x5')]['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0x336591,_0x2fbd26){var _0x323367=moment(_0x336591)[_0xa056('0x6')](0x0);var _0x374846=moment(_0x2fbd26)[_0xa056('0x6')](0x0);return _0x323367[_0xa056('0x7')](_0x374846,_0xa056('0x8'));}exports[_0xa056('0x9')]=function(_0x48e968){return function(_0x50b126){logger['error'](_0x48e968,util[_0xa056('0xa')](_0x50b126,{'showHidden':![],'depth':null}));};};exports[_0xa056('0xb')]=function(_0xeafe35,_0x51ee85){logger['info'](_0xeafe35,util[_0xa056('0xa')](_0x51ee85,{'showHidden':![],'depth':null}));};exports[_0xa056('0xc')]=function(_0x2bb2ba,_0x366c3d){logger[_0xa056('0xd')](_0x2bb2ba,util[_0xa056('0xa')](_0x366c3d,{'showHidden':![],'depth':null}));};exports[_0xa056('0xe')]=function(_0x258c50){return function(_0x264f0a){logger[_0xa056('0xf')](_0x258c50,util[_0xa056('0xa')](_0x264f0a,{'showHidden':![],'depth':null}));};};exports[_0xa056('0x10')]=function(_0x4b3c28,_0x1a643e,_0x50755c){return{'message':_0x4b3c28,'unlock':_0x1a643e,'active':_0x50755c};};exports[_0xa056('0x11')]=function(_0x579bc4,_0x5eea3c,_0x35f562){if(!_[_0xa056('0x12')](_0x35f562)&&'string'===typeof _0x35f562&&!_[_0xa056('0x13')](_0x35f562)){if(!_[_0xa056('0x12')](_0x5eea3c)&&_0xa056('0x14')===typeof _0x5eea3c&&!_['isEmpty'](_0x5eea3c)){return util[_0xa056('0x15')]('\x22%s\x22\x20<%s>',_0x5eea3c,_0x35f562);}return util[_0xa056('0x15')](_0xa056('0x16'),_0x35f562,_0x35f562);}if(!_[_0xa056('0x12')](_0x579bc4)&&'string'===typeof _0x579bc4&&!_[_0xa056('0x13')](_0x579bc4)){return _0x579bc4;}return _0xa056('0x17');};exports[_0xa056('0x18')]=function(_0xab2803){if(_[_0xa056('0x19')](_0xab2803)){return![];}return _0xab2803;};exports[_0xa056('0x1a')]=function(_0x17b6b0,_0x1297a5,_0x5c74ee,_0x2ba0f7,_0x30269d,_0xc77a67){var _0x44c99f={'XMD-QUEUE':_0x1297a5[_0xa056('0x1b')]?_0x1297a5['Queue'][_0xa056('0x1c')]:'','XMD-CALLERID':_0x2ba0f7,'XMD-CALLERID-PREVIEW':_0xc77a67?util[_0xa056('0x15')](_0xa056('0x16'),_0xc77a67[_0xa056('0x1d')],_0xc77a67[_0xa056('0x1e')]):_0x2ba0f7,'XMD-DIALID':_0x30269d,'XMD-CONTACTID':_0x1297a5[_0xa056('0x1f')],'XMD-CDRTYPE':_0xa056('0x20'),'CALLERID(all)':_0x2ba0f7,'XMD-VOICEQUEUEID':_0x1297a5['VoiceQueueId'],'XMD-DIALCHANNEL':_0x5c74ee,'XMD-DIALTIMEOUT':_0x17b6b0[_0xa056('0x21')]||0x1e,'XMD-DIALOPTIONS':util[_0xa056('0x15')](_0xa056('0x22'),_0x17b6b0['dialQueueProject2']?'g':'',_[_0xa056('0x13')](_0x17b6b0['monitor_format'])?'':_0xa056('0x23')),'XMD-DIALURL':_0x17b6b0[_0xa056('0x24')]||'','XMD-AGI':_0x17b6b0[_0xa056('0x25')]?util[_0xa056('0x15')](_0xa056('0x26'),ipAgi,_0x17b6b0[_0xa056('0x25')]):_0xa056('0x27'),'XMD-AGIAFTER':_0x17b6b0['dialQueueProject2']?util[_0xa056('0x15')](_0xa056('0x26'),ipAgi,_0x17b6b0['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0xc77a67?_0xc77a67[_0xa056('0x28')]:'','XMD-ORIGINATECALLERIDNAME':_0xc77a67?_0xc77a67['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_['isEmpty'](_0x17b6b0[_0xa056('0x29')])){_0x44c99f[util[_0xa056('0x15')]('%s',_0xa056('0x2a'))]=_0x17b6b0['monitor_format'];_0x44c99f[util[_0xa056('0x15')]('%s',_0xa056('0x2b'))]=_0x30269d;}if(_0x1297a5&&_0x1297a5['Contact']){for(var _0x4f0df9 in _0x1297a5[_0xa056('0x2c')]){if(_0x1297a5[_0xa056('0x2c')][_0xa056('0x2d')](_0x4f0df9)){if(!_[_0xa056('0x19')](_0x1297a5[_0xa056('0x2c')][_0x4f0df9])&&_0x4f0df9!=='id'&&_0x4f0df9!==_0xa056('0x2e')&&_0x4f0df9!==_0xa056('0x2f')&&_0x4f0df9!==_0xa056('0x30')){_0x44c99f[util['format'](_0xa056('0x31'),_0xa056('0x32'),_[_0xa056('0x33')](_0x4f0df9))]=_0x1297a5[_0xa056('0x2c')][_0x4f0df9];}}}}return _0x44c99f;};exports[_0xa056('0x34')]=function(_0x420ffe){var _0x3f66a6={};for(var _0x45ba8c in _0x420ffe){if(_0x420ffe['hasOwnProperty'](_0x45ba8c)){_0x3f66a6[util['format']('%s',_['toLower'](_0x45ba8c))]=_0x420ffe[_0x45ba8c];}}return{'variables':_0x3f66a6};};exports[_0xa056('0x35')]=function(_0x2b9e56,_0x3fddc4){if(!_['isNil'](_0x2b9e56)){if(_0x2b9e56[_0xa056('0x2d')]('originated')){if(_0x2b9e56[_0xa056('0x36')]>0x0){_0x2b9e56[_0xa056('0x36')]-=0x1;}else{logger[_0xa056('0xd')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x3fddc4);}}}else{logger[_0xa056('0xd')](_0xa056('0x37'),_0x3fddc4);}};exports[_0xa056('0x38')]=function(_0x559b86){var _0xc350db=moment()['format'](_0xa056('0x39'));_0x559b86[_0xa056('0x3a')]=0xd;_0x559b86['statedesc']='Blacklist';_0x559b86['starttime']=_0xc350db;_0x559b86[_0xa056('0x3b')]=_0xc350db;_0x559b86['endtime']=_0xc350db;};exports[_0xa056('0x3c')]=function(_0x2dd57d,_0x4cf25d,_0x475c0d){var _0x3ce7c1=moment()[_0xa056('0x15')](_0xa056('0x39'));_0x2dd57d['state']=_0x4cf25d;_0x2dd57d['statedesc']=_0x475c0d;_0x2dd57d[_0xa056('0x3b')]=_0x3ce7c1;_0x2dd57d[_0xa056('0x3d')]=getSeconds(_0x2dd57d['responsetime'],_0x2dd57d[_0xa056('0x3e')]);};exports[_0xa056('0x3f')]=function(_0x3fa97d,_0x20d45a,_0x26619b){_0x3fa97d[_0xa056('0x40')]=_0x20d45a;_0x3fa97d['UserId']=_0x26619b;};exports[_0xa056('0x41')]=function(_0x3049a4,_0x3d603b,_0x7a5197){var _0x1212e4=moment()[_0xa056('0x15')](_0xa056('0x39'));_0x3049a4[_0xa056('0x3a')]=_0x3d603b;_0x3049a4['statedesc']=_0x7a5197;_0x3049a4[_0xa056('0x3b')]=_0x3049a4[_0xa056('0x3b')]?_0x3049a4['responsetime']:_0x1212e4;_0x3049a4['endtime']=_0x3049a4[_0xa056('0x42')]?_0x3049a4[_0xa056('0x42')]:_0x1212e4;_0x3049a4[_0xa056('0x3d')]=getSeconds(_0x3049a4[_0xa056('0x3b')]||0x0,_0x3049a4[_0xa056('0x3e')]||0x0);_0x3049a4['talktime']=_0x3049a4['answertime']?getSeconds(_0x3049a4[_0xa056('0x42')],_0x3049a4[_0xa056('0x43')]):0x0;};exports[_0xa056('0x44')]=function(_0x50550a){return _0x50550a==='Failure';};exports[_0xa056('0x45')]=function(_0x2e3c6d,_0x31e901,_0x18bea4,_0x4458d7,_0x103b80){var _0x37d814=_0x4458d7?_0xa056('0x46'):_0x2e3c6d[_0xa056('0x1d')];_0x37d814=_0x103b80?_0xa056('0x47'):_0x37d814;return{'actionid':_0x2e3c6d['uniqueid'],'action':'originate','channel':_0x2e3c6d[_0xa056('0x48')],'callerid':util['format'](_0xa056('0x16'),_0x37d814,_0x2e3c6d[_0xa056('0x1e')]),'Exten':_0xa056('0x49'),'Context':'from-sip','Priority':'1','variable':_0x18bea4,'timeout':(_0x31e901[_0xa056('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2e3c6d[_0xa056('0x4b')]};};exports[_0xa056('0x4c')]=function(_0x1cecb7){return _0x1cecb7[_0xa056('0x4d')]+_0x1cecb7[_0xa056('0x4e')]+_0x1cecb7[_0xa056('0x4f')]+_0x1cecb7[_0xa056('0x50')]+_0x1cecb7[_0xa056('0x51')];};exports[_0xa056('0x52')]=function(_0x250050){var _0x27a1e2=_[_0xa056('0x53')](_0x250050);_0x27a1e2['state']=0xf;_0x27a1e2[_0xa056('0x54')]=_0xa056('0x55');return _0x27a1e2;};exports['scheduledAt']=function(_0x17e07e,_0xe26e35,_0x3e36bd){var _0x530052={};_0x530052[_0xe26e35]=_0x17e07e[_0xe26e35];_0x530052['active']=![];_0x530052[_0xa056('0x56')]=moment()['add'](_0x3e36bd,_0xa056('0x57'))['format'](_0xa056('0x39'));_0x530052[_0xa056('0x1f')]=_0x17e07e['ContactId'];_0x530052[_0xa056('0x58')]=_0x17e07e[_0xa056('0x58')];_0x530052[_0xa056('0x59')]=_0x17e07e[_0xa056('0x59')]||undefined;return _0x530052;};exports['decrementTalkink']=function(_0x1bea53,_0x331cc4){if(!_['isNil'](_0x1bea53)){if(_0x1bea53[_0xa056('0x5a')]>0x0){_0x1bea53[_0xa056('0x5a')]-=0x1;}else{logger[_0xa056('0xd')](_0x331cc4,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x331cc4,_0xa056('0x5b'));}};exports['IsNotLoggedIn']=function(_0x2e5773){if(_0x2e5773<=0x0){return!![];}return![];};exports[_0xa056('0x5c')]=function(_0x2fba4b,_0xf703b5,_0x10be42){_0x2fba4b[_0xa056('0x5d')]=_0xf703b5;_0x2fba4b['name']=_0x2fba4b[_0xa056('0x5e')];_0x2fba4b[_0xa056('0x5f')]=_0x2fba4b[_0xa056('0x48')];if(_0x10be42){_0x2fba4b[_0xa056('0x60')]=_0x10be42[_0xa056('0x60')];}return _0x2fba4b;};exports[_0xa056('0x61')]=function(_0x5263c2){var _0x5837cb={};_0x5837cb[_0xa056('0x5e')]=_0x5263c2[_0xa056('0x5e')];_0x5837cb[_0xa056('0x5f')]=_0x5263c2[_0xa056('0x48')];_0x5837cb[_0xa056('0x4b')]=_0x5263c2[_0xa056('0x4b')];return _0x5837cb;};exports[_0xa056('0x62')]=function(_0x3ff0db){var _0x4f2ebc=[];for(var _0x2fecf6 in _0x3ff0db){if(_0x3ff0db[_0xa056('0x2d')](_0x2fecf6)){if(!_[_0xa056('0x19')](_0x3ff0db[_0x2fecf6])&&_0x3ff0db[_0x2fecf6]['state']===_0xa056('0x63')&&_0x3ff0db[_0x2fecf6][_0xa056('0x64')]===_0xa056('0x65')){_0x4f2ebc[_0xa056('0x66')](_0x3ff0db[_0x2fecf6]['id']);}}}return _0x4f2ebc;};exports[_0xa056('0x67')]=function(_0x22627b){var _0x361522=moment()[_0xa056('0x6')](0x0);var _0x3b6508=moment(_0x22627b)[_0xa056('0x6')](0x0);return _0x361522[_0xa056('0x7')](_0x3b6508,_0xa056('0x8'));};exports[_0xa056('0x68')]=function(_0x24478f){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x24478f[_0xa056('0x1f')],'ListId':_0x24478f[_0xa056('0x58')],'VoiceQueueId':_0x24478f['VoiceQueueId']||undefined,'CampaignId':_0x24478f['CampaignId']||undefined};};exports[_0xa056('0x69')]=function(_0x58a877){if(_0x58a877==='uniqueid'||_0x58a877===_0xa056('0x6a')||_0x58a877===_0xa056('0x5e')||_0x58a877==='type'||_0x58a877===_0xa056('0x6b')||_0x58a877===_0xa056('0x6c')||_0x58a877===_0xa056('0x40')||_0x58a877==='channelAgent'||_0x58a877===_0xa056('0x1d')||_0x58a877===_0xa056('0x6d')||_0x58a877==='calleridnum'||_0x58a877===_0xa056('0x56')||_0x58a877==='countbusyretry'||_0x58a877==='countcongestionretry'||_0x58a877===_0xa056('0x4f')||_0x58a877===_0xa056('0x6e')||_0x58a877===_0xa056('0x6f')||_0x58a877==='callbackuniqueid'||_0x58a877===_0xa056('0x70')||_0x58a877===_0xa056('0x71')||_0x58a877===_0xa056('0x1f')||_0x58a877==='ListId'||_0x58a877==='UserId'||_0x58a877===_0xa056('0x59')||_0x58a877===_0xa056('0x72')||_0x58a877===_0xa056('0x73')||_0x58a877===_0xa056('0x74')||_0x58a877===_0xa056('0x75')||_0x58a877===_0xa056('0x76')||_0x58a877===_0xa056('0x77')||_0x58a877===_0xa056('0x78')||_0x58a877===_0xa056('0x79')||_0x58a877===_0xa056('0x7a')||_0x58a877===_0xa056('0x7b')||_0x58a877===_0xa056('0x7c')||_0x58a877===_0xa056('0x7d')||_0x58a877==='xmd-callerid'||_0x58a877===_0xa056('0x7e')||_0x58a877===_0xa056('0x7f')||_0x58a877===_0xa056('0x80')||_0x58a877===_0xa056('0x81')||_0x58a877===_0xa056('0x82')||_0x58a877==='rtpaudioqosjitterbridged'||_0x58a877===_0xa056('0x83')||_0x58a877==='rtpaudioqoslossbridged'||_0x58a877===_0xa056('0x84')||_0x58a877===_0xa056('0x85')||_0x58a877==='rtpaudioqos'||_0x58a877===_0xa056('0x81')||_0x58a877==='rtpaudioqosjitter'||_0x58a877===_0xa056('0x86')||_0x58a877==='rtpaudioqosloss'||_0x58a877===_0xa056('0x87')||_0x58a877===_0xa056('0x84')||_0x58a877===_0xa056('0x85')||_0x58a877===_0xa056('0x88')||_0x58a877===_0xa056('0x89')||_0x58a877==='state'||_0x58a877===_0xa056('0x54')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x1a7971,_0x2a80b7){var _0x201495,_0x2d3fb3,_0x2d6871;if(_0x2a80b7<=0x0){_0x2a80b7=0x1;}_0x201495=new RegExp('\x5cw{0,'+_0x2a80b7+'}$');_0x2d3fb3=Math[_0xa056('0x8a')](0xa,_0x2a80b7-0x1);_0x2d6871=Math[_0xa056('0x8a')](0xa,_0x2a80b7)-0x1;return util[_0xa056('0x15')]('%s',_[_0xa056('0x8b')](_0x1a7971,_0x201495,_[_0xa056('0x8c')](_0x2d3fb3,_0x2d6871)));};exports['extractCalleridName']=function(_0x5198d8){var _0x2e0e97=_0x5198d8[_0xa056('0x8d')](/"(.*?)"/);return _0x2e0e97?_0x2e0e97[0x1]:_0x5198d8;};exports[_0xa056('0x8e')]=function(_0x1e8b4b){var _0x3a69ed=_0x1e8b4b[_0xa056('0x8d')](/<(.*?)>/);return _0x3a69ed?_0x3a69ed[0x1]:_0x1e8b4b;}; \ No newline at end of file +var _0x77ed=['[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','diff','seconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','active','countglobal','callback','callbackuniqueid','recallme','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqosrtt','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','env','milliseconds','loggerCatch','error','inspect','logger','info','logger2','message','getCallerId','string','isEmpty','format','isUndefined','\x22\x22\x20<>','isActive','isNil','Queue','name','\x22%s\x22\x20<%s>','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','\x22agi://%s/square,%s\x22','NONE','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','createdAt','updatedAt','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','hasOwnProperty','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','endtime','logAgent','ringtime','membername','logCustomer','talktime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','scheduledAt','scheduledat','add','ListId','decrementTalkink','pTalking'];(function(_0x18c2f0,_0x112756){var _0x47431c=function(_0x297d5a){while(--_0x297d5a){_0x18c2f0['push'](_0x18c2f0['shift']());}};_0x47431c(++_0x112756);}(_0x77ed,0x151));var _0xd77e=function(_0x47c66c,_0x11a01b){_0x47c66c=_0x47c66c-0x0;var _0x273720=_0x77ed[_0x47c66c];return _0x273720;};'use strict';var util=require(_0xd77e('0x0'));var _=require(_0xd77e('0x1'));var moment=require(_0xd77e('0x2'));var logger=require(_0xd77e('0x3'))('preview');var ipAgi=process[_0xd77e('0x4')]['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0x4b7ce1,_0x1a1d8d){var _0x9ce160=moment(_0x4b7ce1)[_0xd77e('0x5')](0x0);var _0x161f70=moment(_0x1a1d8d)[_0xd77e('0x5')](0x0);return _0x9ce160['diff'](_0x161f70,'seconds');}exports[_0xd77e('0x6')]=function(_0x3f72a3){return function(_0x194a4d){logger[_0xd77e('0x7')](_0x3f72a3,util[_0xd77e('0x8')](_0x194a4d,{'showHidden':![],'depth':null}));};};exports[_0xd77e('0x9')]=function(_0x56af59,_0x351102){logger[_0xd77e('0xa')](_0x56af59,util[_0xd77e('0x8')](_0x351102,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0xa236be,_0x462e54){logger['error'](_0xa236be,util[_0xd77e('0x8')](_0x462e54,{'showHidden':![],'depth':null}));};exports[_0xd77e('0xb')]=function(_0x594394){return function(_0x18c984){logger[_0xd77e('0xa')](_0x594394,util[_0xd77e('0x8')](_0x18c984,{'showHidden':![],'depth':null}));};};exports[_0xd77e('0xc')]=function(_0x4877f8,_0x57d07e,_0x16fa4c){return{'message':_0x4877f8,'unlock':_0x57d07e,'active':_0x16fa4c};};exports[_0xd77e('0xd')]=function(_0x1709f4,_0x2665ea,_0xb0c6e5){if(!_['isUndefined'](_0xb0c6e5)&&_0xd77e('0xe')===typeof _0xb0c6e5&&!_[_0xd77e('0xf')](_0xb0c6e5)){if(!_['isUndefined'](_0x2665ea)&&_0xd77e('0xe')===typeof _0x2665ea&&!_[_0xd77e('0xf')](_0x2665ea)){return util[_0xd77e('0x10')]('\x22%s\x22\x20<%s>',_0x2665ea,_0xb0c6e5);}return util[_0xd77e('0x10')]('\x22%s\x22\x20<%s>',_0xb0c6e5,_0xb0c6e5);}if(!_[_0xd77e('0x11')](_0x1709f4)&&_0xd77e('0xe')===typeof _0x1709f4&&!_[_0xd77e('0xf')](_0x1709f4)){return _0x1709f4;}return _0xd77e('0x12');};exports[_0xd77e('0x13')]=function(_0x47e5f8){if(_[_0xd77e('0x14')](_0x47e5f8)){return![];}return _0x47e5f8;};exports['addVariables']=function(_0x4a8852,_0x5b8bf5,_0x520566,_0x1e6cf7,_0x126fe9,_0x4cc91e){var _0x2a2b03={'XMD-QUEUE':_0x5b8bf5['Queue']?_0x5b8bf5[_0xd77e('0x15')][_0xd77e('0x16')]:'','XMD-CALLERID':_0x1e6cf7,'XMD-CALLERID-PREVIEW':_0x4cc91e?util[_0xd77e('0x10')](_0xd77e('0x17'),_0x4cc91e[_0xd77e('0x18')],_0x4cc91e[_0xd77e('0x19')]):_0x1e6cf7,'XMD-DIALID':_0x126fe9,'XMD-CONTACTID':_0x5b8bf5[_0xd77e('0x1a')],'XMD-CDRTYPE':_0xd77e('0x1b'),'CALLERID(all)':_0x1e6cf7,'XMD-VOICEQUEUEID':_0x5b8bf5[_0xd77e('0x1c')],'XMD-DIALCHANNEL':_0x520566,'XMD-DIALTIMEOUT':_0x4a8852['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xd77e('0x10')](_0xd77e('0x1d'),_0x4a8852[_0xd77e('0x1e')]?'g':'',_['isEmpty'](_0x4a8852[_0xd77e('0x1f')])?'':_0xd77e('0x20')),'XMD-DIALURL':_0x4a8852['dialPreviewUrl']||'','XMD-AGI':_0x4a8852['dialQueueProject']?util[_0xd77e('0x10')](_0xd77e('0x21'),ipAgi,_0x4a8852['dialQueueProject']):_0xd77e('0x22'),'XMD-AGIAFTER':_0x4a8852[_0xd77e('0x1e')]?util[_0xd77e('0x10')](_0xd77e('0x21'),ipAgi,_0x4a8852[_0xd77e('0x1e')]):_0xd77e('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x4cc91e?_0x4cc91e['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x4cc91e?_0x4cc91e['originatecalleridname']:'','XMD-DESTINATION':_0xd77e('0x23')};if(!_[_0xd77e('0xf')](_0x4a8852[_0xd77e('0x1f')])){_0x2a2b03[util[_0xd77e('0x10')]('%s',_0xd77e('0x24'))]=_0x4a8852[_0xd77e('0x1f')];_0x2a2b03[util[_0xd77e('0x10')]('%s',_0xd77e('0x25'))]=_0x126fe9;}if(_0x5b8bf5&&_0x5b8bf5[_0xd77e('0x26')]){for(var _0x43a4c1 in _0x5b8bf5['Contact']){if(_0x5b8bf5[_0xd77e('0x26')]['hasOwnProperty'](_0x43a4c1)){if(!_[_0xd77e('0x14')](_0x5b8bf5[_0xd77e('0x26')][_0x43a4c1])&&_0x43a4c1!=='id'&&_0x43a4c1!==_0xd77e('0x27')&&_0x43a4c1!==_0xd77e('0x28')&&_0x43a4c1!==_0xd77e('0x29')){_0x2a2b03[util[_0xd77e('0x10')]('%s%s',_0xd77e('0x2a'),_[_0xd77e('0x2b')](_0x43a4c1))]=_0x5b8bf5[_0xd77e('0x26')][_0x43a4c1];}}}}return _0x2a2b03;};exports[_0xd77e('0x2c')]=function(_0x9ea2a6){var _0xc65ef8={};for(var _0x4a848e in _0x9ea2a6){if(_0x9ea2a6['hasOwnProperty'](_0x4a848e)){_0xc65ef8[util[_0xd77e('0x10')]('%s',_[_0xd77e('0x2d')](_0x4a848e))]=_0x9ea2a6[_0x4a848e];}}return{'variables':_0xc65ef8};};exports[_0xd77e('0x2e')]=function(_0x31634a,_0x1afd88){if(!_[_0xd77e('0x14')](_0x31634a)){if(_0x31634a[_0xd77e('0x2f')](_0xd77e('0x30'))){if(_0x31634a[_0xd77e('0x30')]>0x0){_0x31634a[_0xd77e('0x30')]-=0x1;}else{logger[_0xd77e('0x7')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x1afd88);}}}else{logger[_0xd77e('0x7')](_0xd77e('0x31'),_0x1afd88);}};exports['logBlacklist']=function(_0x325f10){var _0x2a2ad3=moment()['format'](_0xd77e('0x32'));_0x325f10[_0xd77e('0x33')]=0xd;_0x325f10[_0xd77e('0x34')]='Blacklist';_0x325f10[_0xd77e('0x35')]=_0x2a2ad3;_0x325f10[_0xd77e('0x36')]=_0x2a2ad3;_0x325f10[_0xd77e('0x37')]=_0x2a2ad3;};exports[_0xd77e('0x38')]=function(_0x7a2175,_0x1585a4,_0x29c83c){var _0x18694a=moment()[_0xd77e('0x10')](_0xd77e('0x32'));_0x7a2175[_0xd77e('0x33')]=_0x1585a4;_0x7a2175['statedesc']=_0x29c83c;_0x7a2175['responsetime']=_0x18694a;_0x7a2175[_0xd77e('0x39')]=getSeconds(_0x7a2175['responsetime'],_0x7a2175[_0xd77e('0x35')]);};exports['logLookAgent']=function(_0x1deac5,_0x1ca370,_0x14bfd9){_0x1deac5[_0xd77e('0x3a')]=_0x1ca370;_0x1deac5['UserId']=_0x14bfd9;};exports[_0xd77e('0x3b')]=function(_0x528a44,_0x2413f9,_0x1376c7){var _0x1fe2b0=moment()[_0xd77e('0x10')](_0xd77e('0x32'));_0x528a44[_0xd77e('0x33')]=_0x2413f9;_0x528a44[_0xd77e('0x34')]=_0x1376c7;_0x528a44[_0xd77e('0x36')]=_0x528a44[_0xd77e('0x36')]?_0x528a44['responsetime']:_0x1fe2b0;_0x528a44[_0xd77e('0x37')]=_0x528a44[_0xd77e('0x37')]?_0x528a44['endtime']:_0x1fe2b0;_0x528a44[_0xd77e('0x39')]=getSeconds(_0x528a44[_0xd77e('0x36')]||0x0,_0x528a44[_0xd77e('0x35')]||0x0);_0x528a44[_0xd77e('0x3c')]=_0x528a44['answertime']?getSeconds(_0x528a44[_0xd77e('0x37')],_0x528a44['answertime']):0x0;};exports[_0xd77e('0x3d')]=function(_0x2f6286){return _0x2f6286===_0xd77e('0x3e');};exports[_0xd77e('0x3f')]=function(_0x295830,_0x1faf4a,_0x154b6e,_0x5946e9,_0x27cc4d){var _0x4dcd80=_0x5946e9?_0xd77e('0x40'):_0x295830[_0xd77e('0x18')];_0x4dcd80=_0x27cc4d?_0xd77e('0x41'):_0x4dcd80;return{'actionid':_0x295830[_0xd77e('0x42')],'action':_0xd77e('0x43'),'channel':_0x295830[_0xd77e('0x44')],'callerid':util['format'](_0xd77e('0x17'),_0x4dcd80,_0x295830[_0xd77e('0x19')]),'Exten':_0xd77e('0x23'),'Context':_0xd77e('0x45'),'Priority':'1','variable':_0x154b6e,'timeout':(_0x1faf4a[_0xd77e('0x46')]||0x1e)*0x3e8,'async':!![],'channelid':_0x295830[_0xd77e('0x42')]};};exports[_0xd77e('0x47')]=function(_0x5d2ae5){return _0x5d2ae5['countbusyretry']+_0x5d2ae5[_0xd77e('0x48')]+_0x5d2ae5[_0xd77e('0x49')]+_0x5d2ae5[_0xd77e('0x4a')]+_0x5d2ae5[_0xd77e('0x4b')];};exports[_0xd77e('0x4c')]=function(_0x4a24a0){var _0x19f70c=_['clone'](_0x4a24a0);_0x19f70c[_0xd77e('0x33')]=0xf;_0x19f70c[_0xd77e('0x34')]='Global';return _0x19f70c;};exports[_0xd77e('0x4d')]=function(_0x465510,_0x17cd9f,_0x51ac7c){var _0x4cf956={};_0x4cf956[_0x17cd9f]=_0x465510[_0x17cd9f];_0x4cf956['active']=![];_0x4cf956[_0xd77e('0x4e')]=moment()[_0xd77e('0x4f')](_0x51ac7c,'minutes')['format'](_0xd77e('0x32'));_0x4cf956[_0xd77e('0x1a')]=_0x465510[_0xd77e('0x1a')];_0x4cf956[_0xd77e('0x50')]=_0x465510[_0xd77e('0x50')];_0x4cf956[_0xd77e('0x1c')]=_0x465510[_0xd77e('0x1c')]||undefined;return _0x4cf956;};exports[_0xd77e('0x51')]=function(_0x3c5fde,_0x5b9733){if(!_[_0xd77e('0x14')](_0x3c5fde)){if(_0x3c5fde[_0xd77e('0x52')]>0x0){_0x3c5fde[_0xd77e('0x52')]-=0x1;}else{logger['error'](_0x5b9733,_0xd77e('0x53'));}}else{logger[_0xd77e('0x7')](_0x5b9733,_0xd77e('0x54'));}};exports[_0xd77e('0x55')]=function(_0x286e47){if(_0x286e47<=0x0){return!![];}return![];};exports[_0xd77e('0x56')]=function(_0xb4998d,_0x2acdc0,_0x13b9cb){_0xb4998d[_0xd77e('0x57')]=_0x2acdc0;_0xb4998d[_0xd77e('0x16')]=_0xb4998d[_0xd77e('0x58')];_0xb4998d[_0xd77e('0x59')]=_0xb4998d[_0xd77e('0x44')];if(_0x13b9cb){_0xb4998d[_0xd77e('0x5a')]=_0x13b9cb[_0xd77e('0x5a')];}return _0xb4998d;};exports[_0xd77e('0x5b')]=function(_0x40712e){var _0x352aca={};_0x352aca[_0xd77e('0x58')]=_0x40712e[_0xd77e('0x58')];_0x352aca[_0xd77e('0x59')]=_0x40712e[_0xd77e('0x44')];_0x352aca[_0xd77e('0x42')]=_0x40712e['uniqueid'];return _0x352aca;};exports[_0xd77e('0x5c')]=function(_0x27b77b){var _0x264282=[];for(var _0x17cec8 in _0x27b77b){if(_0x27b77b['hasOwnProperty'](_0x17cec8)){if(!_[_0xd77e('0x14')](_0x27b77b[_0x17cec8])&&_0x27b77b[_0x17cec8][_0xd77e('0x33')]===_0xd77e('0x5d')&&_0x27b77b[_0x17cec8][_0xd77e('0x5e')]===_0xd77e('0x5f')){_0x264282[_0xd77e('0x60')](_0x27b77b[_0x17cec8]['id']);}}}return _0x264282;};exports[_0xd77e('0x61')]=function(_0x51c791){var _0x43bdd6=moment()['milliseconds'](0x0);var _0x25526b=moment(_0x51c791)['milliseconds'](0x0);return _0x43bdd6[_0xd77e('0x62')](_0x25526b,_0xd77e('0x63'));};exports[_0xd77e('0x64')]=function(_0x3a1aed){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3a1aed['ContactId'],'ListId':_0x3a1aed[_0xd77e('0x50')],'VoiceQueueId':_0x3a1aed[_0xd77e('0x1c')]||undefined,'CampaignId':_0x3a1aed[_0xd77e('0x65')]||undefined};};exports[_0xd77e('0x66')]=function(_0x588fba){if(_0x588fba==='uniqueid'||_0x588fba===_0xd77e('0x67')||_0x588fba==='queue'||_0x588fba===_0xd77e('0x68')||_0x588fba===_0xd77e('0x69')||_0x588fba===_0xd77e('0x6a')||_0x588fba===_0xd77e('0x3a')||_0x588fba===_0xd77e('0x44')||_0x588fba===_0xd77e('0x18')||_0x588fba===_0xd77e('0x6b')||_0x588fba==='calleridnum'||_0x588fba===_0xd77e('0x4e')||_0x588fba==='countbusyretry'||_0x588fba===_0xd77e('0x48')||_0x588fba===_0xd77e('0x49')||_0x588fba===_0xd77e('0x6c')||_0x588fba===_0xd77e('0x6d')||_0x588fba===_0xd77e('0x6e')||_0x588fba==='callbackat'||_0x588fba===_0xd77e('0x6f')||_0x588fba===_0xd77e('0x1a')||_0x588fba===_0xd77e('0x50')||_0x588fba==='UserId'||_0x588fba===_0xd77e('0x1c')||_0x588fba===_0xd77e('0x70')||_0x588fba==='xmd-voicequeueid'||_0x588fba===_0xd77e('0x71')||_0x588fba===_0xd77e('0x72')||_0x588fba===_0xd77e('0x73')||_0x588fba===_0xd77e('0x74')||_0x588fba===_0xd77e('0x75')||_0x588fba===_0xd77e('0x76')||_0x588fba===_0xd77e('0x77')||_0x588fba===_0xd77e('0x78')||_0x588fba===_0xd77e('0x79')||_0x588fba===_0xd77e('0x7a')||_0x588fba==='xmd-callerid'||_0x588fba===_0xd77e('0x7b')||_0x588fba==='xmd-agi'||_0x588fba===_0xd77e('0x7c')||_0x588fba===_0xd77e('0x7d')||_0x588fba==='rtpaudioqosjitter'||_0x588fba===_0xd77e('0x7e')||_0x588fba===_0xd77e('0x7f')||_0x588fba===_0xd77e('0x80')||_0x588fba==='rtpaudioqosrtt'||_0x588fba===_0xd77e('0x81')||_0x588fba==='rtpaudioqos'||_0x588fba==='rtpaudioqosbridged'||_0x588fba===_0xd77e('0x82')||_0x588fba===_0xd77e('0x7e')||_0x588fba===_0xd77e('0x7f')||_0x588fba==='rtpaudioqoslossbridged'||_0x588fba===_0xd77e('0x83')||_0x588fba==='rtpaudioqosrttbridged'||_0x588fba==='bridgepeer'||_0x588fba===_0xd77e('0x84')||_0x588fba==='state'||_0x588fba==='statedesc'){return![];}return!![];};exports[_0xd77e('0x85')]=function(_0x1b1b3b,_0x45a135){var _0xae4985,_0x5e0d8e,_0x3371e6;if(_0x45a135<=0x0){_0x45a135=0x1;}_0xae4985=new RegExp(_0xd77e('0x86')+_0x45a135+'}$');_0x5e0d8e=Math[_0xd77e('0x87')](0xa,_0x45a135-0x1);_0x3371e6=Math[_0xd77e('0x87')](0xa,_0x45a135)-0x1;return util[_0xd77e('0x10')]('%s',_[_0xd77e('0x88')](_0x1b1b3b,_0xae4985,_['random'](_0x5e0d8e,_0x3371e6)));};exports[_0xd77e('0x89')]=function(_0x20b9b1){var _0x2cbc89=_0x20b9b1[_0xd77e('0x8a')](/"(.*?)"/);return _0x2cbc89?_0x2cbc89[0x1]:_0x20b9b1;};exports[_0xd77e('0x8b')]=function(_0x3fa4d6){var _0x1cf720=_0x3fa4d6[_0xd77e('0x8a')](/<(.*?)>/);return _0x1cf720?_0x1cf720[0x1]:_0x3fa4d6;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 41e734b..237098f 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['number','boolean','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x361939,_0x8e80f1){var _0x692ba9=function(_0x527172){while(--_0x527172){_0x361939['push'](_0x361939['shift']());}};_0x692ba9(++_0x8e80f1);}(_0x7a54,0x106));var _0x47a5=function(_0x3e8947,_0x3027d4){_0x3e8947=_0x3e8947-0x0;var _0x197d14=_0x7a54[_0x3e8947];return _0x197d14;};'use strict';exports[_0x47a5('0x0')]={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x47a5('0x2'),'required':![]},'paused':{'type':_0x47a5('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]}};exports[_0x47a5('0x4')]={'interface':{'type':_0x47a5('0x1'),'required':!![]},'paused':{'type':_0x47a5('0x3')},'reason':{'type':'string','required':![]}};exports[_0x47a5('0x5')]={'module':{'type':'string','required':![]}};exports[_0x47a5('0x6')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x47a5('0x7')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x274621,_0x4f5519){var _0x30eda1=function(_0x356cee){while(--_0x356cee){_0x274621['push'](_0x274621['shift']());}};_0x30eda1(++_0x4f5519);}(_0x5f2f,0x73));var _0xf5f2=function(_0x413914,_0x2d641a){_0x413914=_0x413914-0x0;var _0x1cc5c7=_0x5f2f[_0x413914];return _0x1cc5c7;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 4d51faa..e01bb9c 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 _0x1663=['initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','deskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','merge','initVoiceQueueReports','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','queuecallerabandonAt','queuecallerexitAt','diff','seconds','queuecallercomplete','queuecallercompleteAt','sumDuration','initVoiceCallReports','duration','disposition','ANSWERED','outbound','billableseconds','initCampaigns','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','util','moment','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','campaigns','templates','channels','queueChannels','outboundChannels','salesforceAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','format','SIP/%s','name','interface','total','answered','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','initTrunks','initVoiceQueues','initTriggers','triggers','initTemplates','zendeskAccounts'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x1663,0x95));var _0x3166=function(_0x644fcc,_0x337d0d){_0x644fcc=_0x644fcc-0x0;var _0x1e148c=_0x1663[_0x644fcc];return _0x1e148c;};'use strict';var BPromise=require('bluebird');var util=require(_0x3166('0x0'));var _=require('lodash');var moment=require(_0x3166('0x1'));var Agent=require('../model/agent');var Telephone=require(_0x3166('0x2'));var Trunk=require(_0x3166('0x3'));var VoiceQueue=require(_0x3166('0x4'));var Trigger=require(_0x3166('0x5'));var Template=require(_0x3166('0x6'));var Campaign=require(_0x3166('0x7'));var VoiceExtension=require(_0x3166('0x8'));var ZendeskAccount=require(_0x3166('0x9'));var SalesforceAccount=require(_0x3166('0xa'));var FreshdeskAccount=require(_0x3166('0xb'));var SugarcrmAccount=require(_0x3166('0xc'));var ZohoAccount=require(_0x3166('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x3166('0xe'));var Dynamics365Account=require(_0x3166('0xf'));var FreshsalesAccount=require(_0x3166('0x10'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x3166('0x11')]={};this[_0x3166('0x12')]={};this[_0x3166('0x13')]={};this[_0x3166('0x14')]={};this['triggers']={};this[_0x3166('0x15')]={};this[_0x3166('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x3166('0x17')]={};this[_0x3166('0x18')]={};this[_0x3166('0x19')]={};this['timers']={};this['zendeskAccounts']={};this[_0x3166('0x1a')]={};this['sugarcrmAccounts']={};this[_0x3166('0x1b')]={};this[_0x3166('0x1c')]={};this['deskAccounts']={};this[_0x3166('0x1d')]={};this[_0x3166('0x1e')]={};this['dynamics365Accounts']={};this[_0x3166('0x1f')]={};this[_0x3166('0x20')]={};};function freeIsNotKey(_0x572f51,_0x4a40f0,_0x5489b1){var _0x3603e8=_['mapKeys'](_0x572f51,function(_0x224930,_0x8e7cb5){return _0x224930[_0x5489b1];});for(var _0x3e11ed in _0x4a40f0){if(_0x4a40f0[_0x3166('0x21')](_0x3e11ed)){if(!_0x3603e8[_0x3e11ed]){delete _0x4a40f0[_0x3e11ed];}}}}function freeIsNotKeySip(_0xae0868,_0x317a62){var _0x3aeabf=_[_0x3166('0x22')](_0xae0868,function(_0x10c2a9,_0x2f983d){return util[_0x3166('0x23')](_0x3166('0x24'),_0x10c2a9[_0x3166('0x25')]);});for(var _0x396c6a in _0x317a62){if(_0x317a62[_0x3166('0x21')](_0x396c6a)){if(!_0x3aeabf[_0x396c6a]){delete _0x317a62[_0x396c6a];}}}}function freeIsNotKeyAgent(_0x1d0b61,_0x36174d){var _0x28995c=_['mapKeys'](_0x1d0b61,function(_0x3ece7f,_0x41958f){var _0x9b587d=_['isNil'](_0x3ece7f['interface'])?util[_0x3166('0x23')](_0x3166('0x24'),_0x3ece7f[_0x3166('0x25')]):_0x3ece7f[_0x3166('0x26')];return _0x9b587d;});for(var _0x537884 in _0x36174d){if(_0x36174d[_0x3166('0x21')](_0x537884)){if(!_0x28995c[_0x537884]){delete _0x36174d[_0x537884];}}}}function clearVoiceCallReports(_0x306d30){_0x306d30[_0x3166('0x27')]=0x0;_0x306d30[_0x3166('0x28')]=0x0;_0x306d30['sumHoldTime']=0x0;_0x306d30['sumDuration']=0x0;_0x306d30[_0x3166('0x29')]=0x0;}function clearCampaigns(_0x403e23){if(!_[_0x3166('0x2a')](_0x403e23)){for(var _0x4dfc84 in _0x403e23){if(_0x403e23['hasOwnProperty'](_0x4dfc84)){_0x403e23[_0x4dfc84]['ivrTotalCallsDays']=0x0;_0x403e23[_0x4dfc84][_0x3166('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x33fed5){if(!_[_0x3166('0x2a')](_0x33fed5)){for(var _0x14bd96 in _0x33fed5){if(_0x33fed5['hasOwnProperty'](_0x14bd96)){_0x33fed5[_0x14bd96][_0x3166('0x27')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x28')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x2c')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x2d')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x2e')]=0x0;_0x33fed5[_0x14bd96]['sumDuration']=0x0;_0x33fed5[_0x14bd96][_0x3166('0x29')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x2f')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x30')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x31')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x32')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x33')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x34')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x35')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x36')]=0x0;_0x33fed5[_0x14bd96]['outboundBlacklistCallsDay']=0x0;_0x33fed5[_0x14bd96][_0x3166('0x37')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x38')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x39')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x2f')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x3a')]=0x0;_0x33fed5[_0x14bd96][_0x3166('0x3b')]=!![];}}}}Realtime['prototype'][_0x3166('0x3c')]=function(_0x1b7ab8,_0x3b067a){for(var _0x50e714 in _0x3b067a){if(_0x1b7ab8[_0x3166('0x21')](_0x50e714)){_0x1b7ab8[_0x50e714]=_0x3b067a[_0x50e714];}}};Realtime[_0x3166('0x3d')][_0x3166('0x3e')]=function(){var _0x2b8a53=this;return function(_0x3fdb4a){if(_0x3fdb4a){freeIsNotKeyAgent(_0x3fdb4a,_0x2b8a53[_0x3166('0x11')]);for(var _0x452f06=0x0,_0x117a98={},_0x58b035={};_0x452f06<_0x3fdb4a[_0x3166('0x3f')];_0x452f06+=0x1){_0x117a98=_0x3fdb4a[_0x452f06];var _0x565fea=_[_0x3166('0x40')](_0x117a98[_0x3166('0x26')])?util[_0x3166('0x23')]('SIP/%s',_0x117a98['name']):_0x117a98['interface'];if(_[_0x3166('0x41')](_0x2b8a53['agents'][_0x565fea])){_0x2b8a53[_0x3166('0x11')][_0x565fea]=new Agent(_0x117a98);}else{_0x2b8a53[_0x3166('0x3c')](_0x2b8a53['agents'][_0x565fea],_0x117a98);}}}return _0x2b8a53[_0x3166('0x11')];};};Realtime[_0x3166('0x3d')][_0x3166('0x42')]=function(){var _0x7a8ffc=this;return function(_0x2c6ef0){if(_0x2c6ef0){freeIsNotKeySip(_0x2c6ef0,_0x7a8ffc[_0x3166('0x12')]);for(var _0x3a03dd=0x0,_0x2c0380={},_0x194f95={};_0x3a03dd<_0x2c6ef0[_0x3166('0x3f')];_0x3a03dd+=0x1){_0x2c0380=_0x2c6ef0[_0x3a03dd];if(_['isUndefined'](_0x7a8ffc[_0x3166('0x12')][util[_0x3166('0x23')](_0x3166('0x24'),_0x2c0380[_0x3166('0x25')])])){_0x7a8ffc[_0x3166('0x12')][util[_0x3166('0x23')](_0x3166('0x24'),_0x2c0380[_0x3166('0x25')])]=new Telephone(_0x2c0380);}else{_0x7a8ffc['mergeFromDatabase'](_0x7a8ffc[_0x3166('0x12')][util[_0x3166('0x23')](_0x3166('0x24'),_0x2c0380['name'])],_0x2c0380);}}}return _0x7a8ffc[_0x3166('0x12')];};};Realtime['prototype'][_0x3166('0x43')]=function(){var _0x270e36=this;return function(_0xdebf79){if(_0xdebf79){freeIsNotKeySip(_0xdebf79,_0x270e36[_0x3166('0x13')]);for(var _0x915e22=0x0,_0x588b99={},_0xa93109={};_0x915e22<_0xdebf79[_0x3166('0x3f')];_0x915e22+=0x1){_0x588b99=_0xdebf79[_0x915e22];if(_[_0x3166('0x41')](_0x270e36[_0x3166('0x13')][util['format'](_0x3166('0x24'),_0x588b99[_0x3166('0x25')])])){_0x270e36['trunks'][util[_0x3166('0x23')](_0x3166('0x24'),_0x588b99[_0x3166('0x25')])]=new Trunk(_0x588b99);}else{_0x270e36['mergeFromDatabase'](_0x270e36[_0x3166('0x13')][util['format'](_0x3166('0x24'),_0x588b99[_0x3166('0x25')])],_0x588b99);}}}return _0x270e36[_0x3166('0x13')];};};Realtime[_0x3166('0x3d')][_0x3166('0x44')]=function(){var _0x37b3b2=this;return function(_0x44dc8b){if(_0x44dc8b){freeIsNotKey(_0x44dc8b,_0x37b3b2['voiceQueues'],_0x3166('0x25'));for(var _0x36b466=0x0,_0x54aea1={},_0x293360={};_0x36b466<_0x44dc8b[_0x3166('0x3f')];_0x36b466+=0x1){_0x54aea1=_0x44dc8b[_0x36b466];if(_[_0x3166('0x41')](_0x37b3b2[_0x3166('0x14')][_0x54aea1[_0x3166('0x25')]])){_0x37b3b2[_0x3166('0x14')][_0x54aea1[_0x3166('0x25')]]=new VoiceQueue(_0x54aea1);}else{_0x37b3b2[_0x3166('0x3c')](_0x37b3b2[_0x3166('0x14')][_0x54aea1[_0x3166('0x25')]],_0x54aea1);}}}return _0x37b3b2[_0x3166('0x14')];};};Realtime[_0x3166('0x3d')][_0x3166('0x45')]=function(){var _0x86f676=this;return function(_0x480cef){if(_0x480cef){freeIsNotKey(_0x480cef,_0x86f676[_0x3166('0x46')],'id');for(var _0x3ee4f1=0x0,_0x4a432a={},_0x18f460={};_0x3ee4f1<_0x480cef[_0x3166('0x3f')];_0x3ee4f1+=0x1){_0x4a432a=_0x480cef[_0x3ee4f1];if(_[_0x3166('0x41')](_0x86f676[_0x3166('0x46')][_0x4a432a['id']])){_0x86f676[_0x3166('0x46')][_0x4a432a['id']]=new Trigger(_0x4a432a);}else{_0x86f676['mergeFromDatabase'](_0x86f676[_0x3166('0x46')][_0x4a432a['id']],_0x4a432a);}}}return _0x86f676[_0x3166('0x46')];};};Realtime[_0x3166('0x3d')][_0x3166('0x47')]=function(){var _0x911d40=this;return function(_0x237b5b){if(_0x237b5b){freeIsNotKey(_0x237b5b,_0x911d40[_0x3166('0x16')],'id');for(var _0x3e4738=0x0,_0x5a4878={},_0x15f83e={};_0x3e4738<_0x237b5b[_0x3166('0x3f')];_0x3e4738+=0x1){_0x5a4878=_0x237b5b[_0x3e4738];if(_[_0x3166('0x41')](_0x911d40[_0x3166('0x16')][_0x5a4878['id']])){_0x911d40[_0x3166('0x16')][_0x5a4878['id']]=new Template(_0x5a4878);}else{_0x911d40[_0x3166('0x3c')](_0x911d40[_0x3166('0x16')][_0x5a4878['id']],_0x5a4878);}}}return _0x911d40[_0x3166('0x16')];};};Realtime[_0x3166('0x3d')]['initZendeskAccounts']=function(){var _0x897dc1=this;return function(_0x1268b3){if(_0x1268b3){freeIsNotKey(_0x1268b3,_0x897dc1[_0x3166('0x48')],'id');for(var _0xd57433=0x0,_0x5f1ef3={},_0x282c88={};_0xd57433<_0x1268b3[_0x3166('0x3f')];_0xd57433+=0x1){_0x5f1ef3=_0x1268b3[_0xd57433];if(_[_0x3166('0x41')](_0x897dc1[_0x3166('0x48')][_0x5f1ef3['id']])){_0x897dc1[_0x3166('0x48')][_0x5f1ef3['id']]=new ZendeskAccount(_0x5f1ef3);}else{_0x897dc1[_0x3166('0x3c')](_0x897dc1[_0x3166('0x48')][_0x5f1ef3['id']],_0x5f1ef3);}}}return _0x897dc1[_0x3166('0x48')];};};Realtime[_0x3166('0x3d')][_0x3166('0x49')]=function(){var _0x3da1b3=this;return function(_0x2322fe){if(_0x2322fe){freeIsNotKey(_0x2322fe,_0x3da1b3[_0x3166('0x1a')],'id');for(var _0x237fe6=0x0,_0x4892a6={},_0x369908={};_0x237fe6<_0x2322fe[_0x3166('0x3f')];_0x237fe6+=0x1){_0x4892a6=_0x2322fe[_0x237fe6];if(_[_0x3166('0x41')](_0x3da1b3[_0x3166('0x1a')][_0x4892a6['id']])){_0x3da1b3[_0x3166('0x1a')][_0x4892a6['id']]=new SalesforceAccount(_0x4892a6);}else{_0x3da1b3['mergeFromDatabase'](_0x3da1b3[_0x3166('0x1a')][_0x4892a6['id']],_0x4892a6);}}}return _0x3da1b3['salesforceAccounts'];};};Realtime[_0x3166('0x3d')][_0x3166('0x4a')]=function(){var _0x1f4ba4=this;return function(_0x4f56ed){if(_0x4f56ed){freeIsNotKey(_0x4f56ed,_0x1f4ba4['freshdeskAccounts'],'id');for(var _0x239b52=0x0,_0x539240={},_0x443a85={};_0x239b52<_0x4f56ed[_0x3166('0x3f')];_0x239b52+=0x1){_0x539240=_0x4f56ed[_0x239b52];if(_[_0x3166('0x41')](_0x1f4ba4[_0x3166('0x1b')][_0x539240['id']])){_0x1f4ba4['freshdeskAccounts'][_0x539240['id']]=new FreshdeskAccount(_0x539240);}else{_0x1f4ba4[_0x3166('0x3c')](_0x1f4ba4[_0x3166('0x1b')][_0x539240['id']],_0x539240);}}}return _0x1f4ba4[_0x3166('0x1b')];};};Realtime[_0x3166('0x3d')][_0x3166('0x4b')]=function(){var _0x5850e8=this;return function(_0x5b70f8){if(_0x5b70f8){freeIsNotKey(_0x5b70f8,_0x5850e8[_0x3166('0x1c')],'id');for(var _0x4b86bd=0x0,_0x4471ed={},_0x1c17ba={};_0x4b86bd<_0x5b70f8[_0x3166('0x3f')];_0x4b86bd+=0x1){_0x4471ed=_0x5b70f8[_0x4b86bd];if(_[_0x3166('0x41')](_0x5850e8[_0x3166('0x1c')][_0x4471ed['id']])){_0x5850e8[_0x3166('0x1c')][_0x4471ed['id']]=new ZohoAccount(_0x4471ed);}else{_0x5850e8[_0x3166('0x3c')](_0x5850e8['zohoAccounts'][_0x4471ed['id']],_0x4471ed);}}}return _0x5850e8[_0x3166('0x1c')];};};Realtime[_0x3166('0x3d')]['initDeskAccounts']=function(){var _0x48e747=this;return function(_0x1f470a){if(_0x1f470a){freeIsNotKey(_0x1f470a,_0x48e747[_0x3166('0x4c')],'id');for(var _0x217571=0x0,_0x45e3a4={},_0x1867ba={};_0x217571<_0x1f470a[_0x3166('0x3f')];_0x217571+=0x1){_0x45e3a4=_0x1f470a[_0x217571];if(_[_0x3166('0x41')](_0x48e747[_0x3166('0x4c')][_0x45e3a4['id']])){_0x48e747[_0x3166('0x4c')][_0x45e3a4['id']]=new DeskAccount(_0x45e3a4);}else{_0x48e747[_0x3166('0x3c')](_0x48e747['deskAccounts'][_0x45e3a4['id']],_0x45e3a4);}}}return _0x48e747[_0x3166('0x4c')];};};Realtime[_0x3166('0x3d')][_0x3166('0x4d')]=function(){var _0x548b11=this;return function(_0x3e164c){if(_0x3e164c){freeIsNotKey(_0x3e164c,_0x548b11['sugarcrmAccounts'],'id');for(var _0x3651fb=0x0,_0x32596f={},_0xd25035={};_0x3651fb<_0x3e164c[_0x3166('0x3f')];_0x3651fb+=0x1){_0x32596f=_0x3e164c[_0x3651fb];if(_[_0x3166('0x41')](_0x548b11[_0x3166('0x4e')][_0x32596f['id']])){_0x548b11[_0x3166('0x4e')][_0x32596f['id']]=new SugarcrmAccount(_0x32596f);}else{_0x548b11[_0x3166('0x3c')](_0x548b11[_0x3166('0x4e')][_0x32596f['id']],_0x32596f);}}}return _0x548b11['sugarcrmAccounts'];};};Realtime[_0x3166('0x3d')][_0x3166('0x4f')]=function(){var _0x585809=this;return function(_0x2ca67d){if(_0x2ca67d){freeIsNotKey(_0x2ca67d,_0x585809[_0x3166('0x1d')],'id');for(var _0x10f2d1=0x0,_0x56454b={},_0x7920ec={};_0x10f2d1<_0x2ca67d[_0x3166('0x3f')];_0x10f2d1+=0x1){_0x56454b=_0x2ca67d[_0x10f2d1];if(_[_0x3166('0x41')](_0x585809[_0x3166('0x1d')][_0x56454b['id']])){_0x585809[_0x3166('0x1d')][_0x56454b['id']]=new VtigerAccount(_0x56454b);}else{_0x585809[_0x3166('0x3c')](_0x585809[_0x3166('0x1d')][_0x56454b['id']],_0x56454b);}}}return _0x585809[_0x3166('0x1d')];};};Realtime[_0x3166('0x3d')][_0x3166('0x50')]=function(){var _0x54d044=this;return function(_0x4ed3a1){if(_0x4ed3a1){freeIsNotKey(_0x4ed3a1,_0x54d044['servicenowAccounts'],'id');for(var _0x42e428=0x0,_0x2eb6a3={},_0x468676={};_0x42e428<_0x4ed3a1[_0x3166('0x3f')];_0x42e428+=0x1){_0x2eb6a3=_0x4ed3a1[_0x42e428];if(_[_0x3166('0x41')](_0x54d044[_0x3166('0x1e')][_0x2eb6a3['id']])){_0x54d044[_0x3166('0x1e')][_0x2eb6a3['id']]=new ServicenowAccount(_0x2eb6a3);}else{_0x54d044[_0x3166('0x3c')](_0x54d044[_0x3166('0x1e')][_0x2eb6a3['id']],_0x2eb6a3);}}}return _0x54d044[_0x3166('0x1e')];};};Realtime['prototype'][_0x3166('0x51')]=function(){var _0x2f09a0=this;return function(_0x4fe5d2){if(_0x4fe5d2){freeIsNotKey(_0x4fe5d2,_0x2f09a0[_0x3166('0x52')],'id');for(var _0x439606=0x0,_0x375697={},_0x45ad89={};_0x439606<_0x4fe5d2[_0x3166('0x3f')];_0x439606+=0x1){_0x375697=_0x4fe5d2[_0x439606];if(_[_0x3166('0x41')](_0x2f09a0[_0x3166('0x52')][_0x375697['id']])){_0x2f09a0[_0x3166('0x52')][_0x375697['id']]=new Dynamics365Account(_0x375697);}else{_0x2f09a0['mergeFromDatabase'](_0x2f09a0[_0x3166('0x52')][_0x375697['id']],_0x375697);}}}return _0x2f09a0[_0x3166('0x52')];};};Realtime['prototype']['initFreshsalesAccounts']=function(){var _0x229829=this;return function(_0x2fe38e){if(_0x2fe38e){freeIsNotKey(_0x2fe38e,_0x229829[_0x3166('0x1f')],'id');for(var _0x4b9a23=0x0,_0x540920={},_0xf02273={};_0x4b9a23<_0x2fe38e[_0x3166('0x3f')];_0x4b9a23+=0x1){_0x540920=_0x2fe38e[_0x4b9a23];if(_[_0x3166('0x41')](_0x229829[_0x3166('0x1f')][_0x540920['id']])){_0x229829[_0x3166('0x1f')][_0x540920['id']]=new FreshsalesAccount(_0x540920);}else{_0x229829['mergeFromDatabase'](_0x229829[_0x3166('0x1f')][_0x540920['id']],_0x540920);}}}return _0x229829[_0x3166('0x1f')];};};Realtime[_0x3166('0x3d')]['initVoiceQueueHopperHistory']=function(){var _0x2fbb26=this;return function(_0x4d10e7){for(var _0x167f3c=0x0;_0x167f3c<_0x4d10e7['length'];_0x167f3c+=0x1){_[_0x3166('0x53')](_0x2fbb26[_0x3166('0x14')][_0x4d10e7[_0x167f3c][_0x3166('0x25')]],_0x4d10e7[_0x167f3c]);}return _0x2fbb26[_0x3166('0x14')];};};Realtime['prototype'][_0x3166('0x54')]=function(){var _0x2033eb=this;return function(_0x232a2e){clearVoiceQueues(_0x2033eb['voiceQueues']);if(_0x232a2e){_0x232a2e=_[_0x3166('0x55')](_0x232a2e,_0x3166('0x56'));for(var _0x122d7a in _0x232a2e){if(_0x232a2e[_0x3166('0x21')](_0x122d7a)){var _0x3fa549={};for(var _0x364d1e=0x0;_0x364d1e<_0x232a2e[_0x122d7a][_0x3166('0x3f')];_0x364d1e+=0x1){var _0x39cfc1=_0x232a2e[_0x122d7a][_0x364d1e]['queue'];if(_0x2033eb[_0x3166('0x14')][_0x39cfc1]){if(_0x232a2e[_0x122d7a][_0x364d1e][_0x3166('0x57')]){_0x2033eb[_0x3166('0x14')][_0x39cfc1][_0x3166('0x2c')]+=0x1;}if(_0x232a2e[_0x122d7a][_0x364d1e][_0x3166('0x58')]){_0x2033eb[_0x3166('0x14')][_0x39cfc1][_0x3166('0x2d')]+=0x1;}_0x2033eb[_0x3166('0x14')][_0x39cfc1][_0x3166('0x2e')]+=moment(_0x232a2e[_0x122d7a][_0x364d1e][_0x3166('0x59')])['diff'](moment(_0x232a2e[_0x122d7a][_0x364d1e][_0x3166('0x5a')]),'seconds')||0x0;if(_0x364d1e===_0x232a2e[_0x122d7a][_0x3166('0x3f')]-0x1){_0x2033eb[_0x3166('0x14')][_0x39cfc1]['sumDuration']+=moment(_0x232a2e[_0x122d7a][_0x364d1e]['queuecallercompleteAt']||_0x232a2e[_0x122d7a][_0x364d1e][_0x3166('0x5b')]||_0x232a2e[_0x122d7a][_0x364d1e][_0x3166('0x5c')])[_0x3166('0x5d')](moment(_0x232a2e[_0x122d7a][_0x364d1e]['queuecallerjoinAt']),_0x3166('0x5e'))||0x0;_0x2033eb[_0x3166('0x14')][_0x39cfc1][_0x3166('0x27')]+=0x1;if(_0x232a2e[_0x122d7a][_0x364d1e][_0x3166('0x5f')]){_0x2033eb[_0x3166('0x14')][_0x39cfc1][_0x3166('0x28')]+=0x1;_0x2033eb['voiceQueues'][_0x39cfc1][_0x3166('0x29')]+=moment(_0x232a2e[_0x122d7a][_0x364d1e][_0x3166('0x60')])[_0x3166('0x5d')](moment(_0x232a2e[_0x122d7a][_0x364d1e][_0x3166('0x59')]),'seconds')||0x0;}}else{_0x2033eb['voiceQueues'][_0x39cfc1][_0x3166('0x61')]+=_0x2033eb[_0x3166('0x14')][_0x39cfc1][_0x3166('0x2e')]||0x0;}}}}}}return _0x2033eb[_0x3166('0x14')];};};Realtime[_0x3166('0x3d')][_0x3166('0x62')]=function(){var _0x2cb1bc=this;return function(_0x3b83ee){clearVoiceCallReports(_0x2cb1bc['outbound']);if(_0x3b83ee){for(var _0x42fab0=0x0;_0x42fab0<_0x3b83ee['length'];_0x42fab0+=0x1){_0x2cb1bc['outbound'][_0x3166('0x27')]+=0x1;_0x2cb1bc['outbound']['sumDuration']+=_0x3b83ee[_0x42fab0][_0x3166('0x63')];if(_0x3b83ee[_0x42fab0][_0x3166('0x64')]===_0x3166('0x65')){_0x2cb1bc[_0x3166('0x66')][_0x3166('0x28')]+=0x1;_0x2cb1bc[_0x3166('0x66')][_0x3166('0x2e')]+=_0x3b83ee[_0x42fab0]['duration']-_0x3b83ee[_0x42fab0][_0x3166('0x67')]||0x0;_0x2cb1bc[_0x3166('0x66')]['sumBillable']+=_0x3b83ee[_0x42fab0][_0x3166('0x67')];}}}return _0x2cb1bc[_0x3166('0x66')];};};Realtime[_0x3166('0x3d')][_0x3166('0x68')]=function(){var _0xcc5533=this;return function(_0x1183b9){if(_0x1183b9){freeIsNotKey(_0x1183b9,_0xcc5533[_0x3166('0x15')],'name');for(var _0x39eec4=0x0,_0x17cc50={};_0x39eec4<_0x1183b9[_0x3166('0x3f')];_0x39eec4+=0x1){_0x17cc50=_0x1183b9[_0x39eec4];if(_['isUndefined'](_0xcc5533[_0x3166('0x15')][_0x17cc50[_0x3166('0x25')]])){_0xcc5533[_0x3166('0x15')][_0x17cc50[_0x3166('0x25')]]=new Campaign(_0x17cc50);}else{_0xcc5533['mergeFromDatabase'](_0xcc5533[_0x3166('0x15')][_0x17cc50[_0x3166('0x25')]],_0x17cc50);_0xcc5533[_0x3166('0x15')][_0x17cc50[_0x3166('0x25')]]['dialQueueProject']=_0x17cc50[_0x3166('0x69')]?_0x17cc50['SquareProject'][_0x3166('0x25')]:undefined;}}}return _0xcc5533['campaigns'];};};Realtime['prototype'][_0x3166('0x6a')]=function(){var _0x5a33ea=this;return function(_0xfd2cf6){if(_0xfd2cf6){freeIsNotKey(_0xfd2cf6,_0x5a33ea['voiceExtensions'],'id');for(var _0x420ccd=0x0,_0x5bd115={};_0x420ccd<_0xfd2cf6[_0x3166('0x3f')];_0x420ccd+=0x1){_0x5bd115=_0xfd2cf6[_0x420ccd];if(_[_0x3166('0x41')](_0x5a33ea[_0x3166('0x6b')][_0x5bd115['id']])){_0x5a33ea[_0x3166('0x6b')][_0x5bd115['id']]=new VoiceExtension(_0x5bd115);}else{_0x5a33ea[_0x3166('0x3c')](_0x5a33ea[_0x3166('0x6b')][_0x5bd115['id']],_0x5bd115);}}}return _0x5a33ea['voiceExtensions'];};};Realtime['prototype'][_0x3166('0x6c')]=function(){var _0x5a4889=this;return function(_0x59baf4){clearCampaigns(_0x5a4889['campaigns']);for(var _0x576ce2=0x0;_0x576ce2<_0x59baf4[_0x3166('0x3f')];_0x576ce2+=0x1){_['merge'](_0x5a4889[_0x3166('0x15')][_0x59baf4[_0x576ce2][_0x3166('0x25')]],_0x59baf4[_0x576ce2]);}return _0x5a4889[_0x3166('0x15')];};};Realtime[_0x3166('0x3d')][_0x3166('0x6d')]=function(){var _0x120fe5=this;return function(_0xad0d7f){if(_0xad0d7f){freeIsNotKey(_0xad0d7f,_0x120fe5[_0x3166('0x20')],'id');for(var _0x28adac=0x0,_0x179624={},_0x22b458={};_0x28adac<_0xad0d7f['length'];_0x28adac+=0x1){_0x179624=_0xad0d7f[_0x28adac];if(_[_0x3166('0x41')](_0x120fe5[_0x3166('0x20')][_0x179624['id']])){_0x120fe5[_0x3166('0x20')][_0x179624['id']]=new FaxAccount(_0x179624);}else{_0x120fe5[_0x3166('0x3c')](_0x120fe5[_0x3166('0x20')][_0x179624['id']],_0x179624);}}}return _0x120fe5[_0x3166('0x20')];};};module[_0x3166('0x6e')]=Realtime; \ No newline at end of file +var _0x9652=['deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty','ivrTotalCallsDays','unmanaged','abandoned','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','length','initTrunks','trunks','isUndefined','initVoiceQueues','initTriggers','initTemplates','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerabandon','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','moment','../model/agent','../model/telephone','../model/trunk','../model/template','../model/campaign','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts'];(function(_0x39eee5,_0x22efe6){var _0x36ad23=function(_0x269f13){while(--_0x269f13){_0x39eee5['push'](_0x39eee5['shift']());}};_0x36ad23(++_0x22efe6);}(_0x9652,0xaf));var _0x2965=function(_0x143565,_0x54d887){_0x143565=_0x143565-0x0;var _0x4dc1d9=_0x9652[_0x143565];return _0x4dc1d9;};'use strict';var BPromise=require(_0x2965('0x0'));var util=require(_0x2965('0x1'));var _=require('lodash');var moment=require(_0x2965('0x2'));var Agent=require(_0x2965('0x3'));var Telephone=require(_0x2965('0x4'));var Trunk=require(_0x2965('0x5'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require('../model/trigger');var Template=require(_0x2965('0x6'));var Campaign=require(_0x2965('0x7'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x2965('0x8'));var SugarcrmAccount=require(_0x2965('0x9'));var ZohoAccount=require(_0x2965('0xa'));var DeskAccount=require(_0x2965('0xb'));var VtigerAccount=require(_0x2965('0xc'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x2965('0xd'));var FreshsalesAccount=require(_0x2965('0xe'));var FaxAccount=require(_0x2965('0xf'));var Realtime=function(){this[_0x2965('0x10')]={};this[_0x2965('0x11')]={};this['trunks']={};this[_0x2965('0x12')]={};this[_0x2965('0x13')]={};this['campaigns']={};this[_0x2965('0x14')]={};this[_0x2965('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x2965('0x16')]={};this[_0x2965('0x17')]={};this[_0x2965('0x18')]={};this[_0x2965('0x19')]={};this[_0x2965('0x1a')]={};this['zendeskAccounts']={};this[_0x2965('0x1b')]={};this[_0x2965('0x1c')]={};this[_0x2965('0x1d')]={};this[_0x2965('0x1e')]={};this[_0x2965('0x1f')]={};this[_0x2965('0x20')]={};this[_0x2965('0x21')]={};this['dynamics365Accounts']={};this[_0x2965('0x22')]={};this[_0x2965('0x23')]={};};function freeIsNotKey(_0x563ff5,_0x1547d0,_0x3d043c){var _0x3409b1=_[_0x2965('0x24')](_0x563ff5,function(_0x1253af,_0x1caeb5){return _0x1253af[_0x3d043c];});for(var _0x469877 in _0x1547d0){if(_0x1547d0[_0x2965('0x25')](_0x469877)){if(!_0x3409b1[_0x469877]){delete _0x1547d0[_0x469877];}}}}function freeIsNotKeySip(_0x2d9a99,_0x3d986f){var _0x1df73b=_[_0x2965('0x24')](_0x2d9a99,function(_0xeee09b,_0xfb9c36){return util[_0x2965('0x26')]('SIP/%s',_0xeee09b[_0x2965('0x27')]);});for(var _0x3b619c in _0x3d986f){if(_0x3d986f[_0x2965('0x25')](_0x3b619c)){if(!_0x1df73b[_0x3b619c]){delete _0x3d986f[_0x3b619c];}}}}function freeIsNotKeyAgent(_0x4a0617,_0x23d263){var _0x5d261f=_[_0x2965('0x24')](_0x4a0617,function(_0x101980,_0x3e3e2b){var _0x2f2776=_[_0x2965('0x28')](_0x101980[_0x2965('0x29')])?util[_0x2965('0x26')](_0x2965('0x2a'),_0x101980['name']):_0x101980[_0x2965('0x29')];return _0x2f2776;});for(var _0x25043a in _0x23d263){if(_0x23d263['hasOwnProperty'](_0x25043a)){if(!_0x5d261f[_0x25043a]){delete _0x23d263[_0x25043a];}}}}function clearVoiceCallReports(_0x13b03b){_0x13b03b[_0x2965('0x2b')]=0x0;_0x13b03b[_0x2965('0x2c')]=0x0;_0x13b03b[_0x2965('0x2d')]=0x0;_0x13b03b[_0x2965('0x2e')]=0x0;_0x13b03b['sumBillable']=0x0;}function clearCampaigns(_0x10bcc2){if(!_[_0x2965('0x2f')](_0x10bcc2)){for(var _0x22c67b in _0x10bcc2){if(_0x10bcc2[_0x2965('0x25')](_0x22c67b)){_0x10bcc2[_0x22c67b][_0x2965('0x30')]=0x0;_0x10bcc2[_0x22c67b]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x3dd20f){if(!_['isEmpty'](_0x3dd20f)){for(var _0x1b98d4 in _0x3dd20f){if(_0x3dd20f[_0x2965('0x25')](_0x1b98d4)){_0x3dd20f[_0x1b98d4][_0x2965('0x2b')]=0x0;_0x3dd20f[_0x1b98d4][_0x2965('0x2c')]=0x0;_0x3dd20f[_0x1b98d4][_0x2965('0x31')]=0x0;_0x3dd20f[_0x1b98d4][_0x2965('0x32')]=0x0;_0x3dd20f[_0x1b98d4][_0x2965('0x2d')]=0x0;_0x3dd20f[_0x1b98d4][_0x2965('0x2e')]=0x0;_0x3dd20f[_0x1b98d4][_0x2965('0x33')]=0x0;_0x3dd20f[_0x1b98d4][_0x2965('0x34')]=0x0;_0x3dd20f[_0x1b98d4][_0x2965('0x35')]=0x0;_0x3dd20f[_0x1b98d4]['outboundBusyCallsDay']=0x0;_0x3dd20f[_0x1b98d4][_0x2965('0x36')]=0x0;_0x3dd20f[_0x1b98d4]['outboundNoSuchCallsDay']=0x0;_0x3dd20f[_0x1b98d4]['outboundUnknownCallsDay']=0x0;_0x3dd20f[_0x1b98d4][_0x2965('0x37')]=0x0;_0x3dd20f[_0x1b98d4]['outboundDropCallsDayCallersExit']=0x0;_0x3dd20f[_0x1b98d4][_0x2965('0x38')]=0x0;_0x3dd20f[_0x1b98d4][_0x2965('0x39')]=0x0;_0x3dd20f[_0x1b98d4][_0x2965('0x3a')]=0x0;_0x3dd20f[_0x1b98d4][_0x2965('0x3b')]=0x0;_0x3dd20f[_0x1b98d4][_0x2965('0x34')]=0x0;_0x3dd20f[_0x1b98d4][_0x2965('0x3c')]=0x0;_0x3dd20f[_0x1b98d4]['queueStatusComplete']=!![];}}}}Realtime[_0x2965('0x3d')][_0x2965('0x3e')]=function(_0x8ed836,_0x713d99){for(var _0x300eaf in _0x713d99){if(_0x8ed836[_0x2965('0x25')](_0x300eaf)){_0x8ed836[_0x300eaf]=_0x713d99[_0x300eaf];}}};Realtime[_0x2965('0x3d')]['initAgents']=function(){var _0x213d9f=this;return function(_0x3dc2b3){if(_0x3dc2b3){freeIsNotKeyAgent(_0x3dc2b3,_0x213d9f[_0x2965('0x10')]);for(var _0x3e733e=0x0,_0x5cc73b={},_0x21c0d2={};_0x3e733e<_0x3dc2b3[_0x2965('0x3f')];_0x3e733e+=0x1){_0x5cc73b=_0x3dc2b3[_0x3e733e];var _0x3b6447=_[_0x2965('0x28')](_0x5cc73b[_0x2965('0x29')])?util[_0x2965('0x26')]('SIP/%s',_0x5cc73b[_0x2965('0x27')]):_0x5cc73b['interface'];if(_['isUndefined'](_0x213d9f[_0x2965('0x10')][_0x3b6447])){_0x213d9f[_0x2965('0x10')][_0x3b6447]=new Agent(_0x5cc73b);}else{_0x213d9f[_0x2965('0x3e')](_0x213d9f[_0x2965('0x10')][_0x3b6447],_0x5cc73b);}}}return _0x213d9f[_0x2965('0x10')];};};Realtime[_0x2965('0x3d')]['initTelephones']=function(){var _0x72643d=this;return function(_0x285563){if(_0x285563){freeIsNotKeySip(_0x285563,_0x72643d['telephones']);for(var _0x922f6=0x0,_0x57a738={},_0x8857fc={};_0x922f6<_0x285563[_0x2965('0x3f')];_0x922f6+=0x1){_0x57a738=_0x285563[_0x922f6];if(_['isUndefined'](_0x72643d['telephones'][util[_0x2965('0x26')](_0x2965('0x2a'),_0x57a738[_0x2965('0x27')])])){_0x72643d[_0x2965('0x11')][util['format'](_0x2965('0x2a'),_0x57a738['name'])]=new Telephone(_0x57a738);}else{_0x72643d[_0x2965('0x3e')](_0x72643d['telephones'][util[_0x2965('0x26')](_0x2965('0x2a'),_0x57a738[_0x2965('0x27')])],_0x57a738);}}}return _0x72643d[_0x2965('0x11')];};};Realtime[_0x2965('0x3d')][_0x2965('0x40')]=function(){var _0x30c062=this;return function(_0x290d50){if(_0x290d50){freeIsNotKeySip(_0x290d50,_0x30c062[_0x2965('0x41')]);for(var _0x2ace4d=0x0,_0x4b46aa={},_0x449946={};_0x2ace4d<_0x290d50[_0x2965('0x3f')];_0x2ace4d+=0x1){_0x4b46aa=_0x290d50[_0x2ace4d];if(_[_0x2965('0x42')](_0x30c062[_0x2965('0x41')][util['format'](_0x2965('0x2a'),_0x4b46aa['name'])])){_0x30c062[_0x2965('0x41')][util[_0x2965('0x26')](_0x2965('0x2a'),_0x4b46aa['name'])]=new Trunk(_0x4b46aa);}else{_0x30c062['mergeFromDatabase'](_0x30c062[_0x2965('0x41')][util[_0x2965('0x26')]('SIP/%s',_0x4b46aa[_0x2965('0x27')])],_0x4b46aa);}}}return _0x30c062['trunks'];};};Realtime[_0x2965('0x3d')][_0x2965('0x43')]=function(){var _0x5f46c8=this;return function(_0x113150){if(_0x113150){freeIsNotKey(_0x113150,_0x5f46c8[_0x2965('0x12')],_0x2965('0x27'));for(var _0x2c6cec=0x0,_0x5c4011={},_0x5eb51f={};_0x2c6cec<_0x113150[_0x2965('0x3f')];_0x2c6cec+=0x1){_0x5c4011=_0x113150[_0x2c6cec];if(_[_0x2965('0x42')](_0x5f46c8['voiceQueues'][_0x5c4011[_0x2965('0x27')]])){_0x5f46c8['voiceQueues'][_0x5c4011[_0x2965('0x27')]]=new VoiceQueue(_0x5c4011);}else{_0x5f46c8[_0x2965('0x3e')](_0x5f46c8[_0x2965('0x12')][_0x5c4011['name']],_0x5c4011);}}}return _0x5f46c8[_0x2965('0x12')];};};Realtime['prototype'][_0x2965('0x44')]=function(){var _0x2de16d=this;return function(_0x5bf130){if(_0x5bf130){freeIsNotKey(_0x5bf130,_0x2de16d['triggers'],'id');for(var _0x485aa2=0x0,_0x2a76ad={},_0x3bbeb7={};_0x485aa2<_0x5bf130[_0x2965('0x3f')];_0x485aa2+=0x1){_0x2a76ad=_0x5bf130[_0x485aa2];if(_[_0x2965('0x42')](_0x2de16d['triggers'][_0x2a76ad['id']])){_0x2de16d['triggers'][_0x2a76ad['id']]=new Trigger(_0x2a76ad);}else{_0x2de16d[_0x2965('0x3e')](_0x2de16d[_0x2965('0x13')][_0x2a76ad['id']],_0x2a76ad);}}}return _0x2de16d[_0x2965('0x13')];};};Realtime[_0x2965('0x3d')][_0x2965('0x45')]=function(){var _0x307e74=this;return function(_0x5ca262){if(_0x5ca262){freeIsNotKey(_0x5ca262,_0x307e74[_0x2965('0x14')],'id');for(var _0x41332e=0x0,_0x42d321={},_0x4aeefe={};_0x41332e<_0x5ca262['length'];_0x41332e+=0x1){_0x42d321=_0x5ca262[_0x41332e];if(_[_0x2965('0x42')](_0x307e74[_0x2965('0x14')][_0x42d321['id']])){_0x307e74[_0x2965('0x14')][_0x42d321['id']]=new Template(_0x42d321);}else{_0x307e74[_0x2965('0x3e')](_0x307e74[_0x2965('0x14')][_0x42d321['id']],_0x42d321);}}}return _0x307e74[_0x2965('0x14')];};};Realtime[_0x2965('0x3d')]['initZendeskAccounts']=function(){var _0x43b84d=this;return function(_0x16b4a0){if(_0x16b4a0){freeIsNotKey(_0x16b4a0,_0x43b84d[_0x2965('0x46')],'id');for(var _0x6839c6=0x0,_0x159785={},_0x278951={};_0x6839c6<_0x16b4a0[_0x2965('0x3f')];_0x6839c6+=0x1){_0x159785=_0x16b4a0[_0x6839c6];if(_['isUndefined'](_0x43b84d['zendeskAccounts'][_0x159785['id']])){_0x43b84d[_0x2965('0x46')][_0x159785['id']]=new ZendeskAccount(_0x159785);}else{_0x43b84d[_0x2965('0x3e')](_0x43b84d['zendeskAccounts'][_0x159785['id']],_0x159785);}}}return _0x43b84d['zendeskAccounts'];};};Realtime['prototype'][_0x2965('0x47')]=function(){var _0x4d878b=this;return function(_0x388c35){if(_0x388c35){freeIsNotKey(_0x388c35,_0x4d878b[_0x2965('0x1b')],'id');for(var _0x14f9c4=0x0,_0x46b906={},_0x35e426={};_0x14f9c4<_0x388c35[_0x2965('0x3f')];_0x14f9c4+=0x1){_0x46b906=_0x388c35[_0x14f9c4];if(_['isUndefined'](_0x4d878b[_0x2965('0x1b')][_0x46b906['id']])){_0x4d878b[_0x2965('0x1b')][_0x46b906['id']]=new SalesforceAccount(_0x46b906);}else{_0x4d878b['mergeFromDatabase'](_0x4d878b[_0x2965('0x1b')][_0x46b906['id']],_0x46b906);}}}return _0x4d878b[_0x2965('0x1b')];};};Realtime[_0x2965('0x3d')][_0x2965('0x48')]=function(){var _0x46db39=this;return function(_0x13ab4b){if(_0x13ab4b){freeIsNotKey(_0x13ab4b,_0x46db39[_0x2965('0x1d')],'id');for(var _0x5004a1=0x0,_0x8a582e={},_0x330caa={};_0x5004a1<_0x13ab4b['length'];_0x5004a1+=0x1){_0x8a582e=_0x13ab4b[_0x5004a1];if(_['isUndefined'](_0x46db39[_0x2965('0x1d')][_0x8a582e['id']])){_0x46db39[_0x2965('0x1d')][_0x8a582e['id']]=new FreshdeskAccount(_0x8a582e);}else{_0x46db39['mergeFromDatabase'](_0x46db39[_0x2965('0x1d')][_0x8a582e['id']],_0x8a582e);}}}return _0x46db39[_0x2965('0x1d')];};};Realtime[_0x2965('0x3d')]['initZohoAccounts']=function(){var _0x4c7a5a=this;return function(_0x1a70f7){if(_0x1a70f7){freeIsNotKey(_0x1a70f7,_0x4c7a5a['zohoAccounts'],'id');for(var _0x3610ba=0x0,_0x539fce={},_0x340880={};_0x3610ba<_0x1a70f7[_0x2965('0x3f')];_0x3610ba+=0x1){_0x539fce=_0x1a70f7[_0x3610ba];if(_[_0x2965('0x42')](_0x4c7a5a[_0x2965('0x1e')][_0x539fce['id']])){_0x4c7a5a[_0x2965('0x1e')][_0x539fce['id']]=new ZohoAccount(_0x539fce);}else{_0x4c7a5a[_0x2965('0x3e')](_0x4c7a5a[_0x2965('0x1e')][_0x539fce['id']],_0x539fce);}}}return _0x4c7a5a['zohoAccounts'];};};Realtime[_0x2965('0x3d')]['initDeskAccounts']=function(){var _0x399700=this;return function(_0xa6d63f){if(_0xa6d63f){freeIsNotKey(_0xa6d63f,_0x399700[_0x2965('0x1f')],'id');for(var _0x1e9364=0x0,_0x4acc8d={},_0x146206={};_0x1e9364<_0xa6d63f[_0x2965('0x3f')];_0x1e9364+=0x1){_0x4acc8d=_0xa6d63f[_0x1e9364];if(_[_0x2965('0x42')](_0x399700['deskAccounts'][_0x4acc8d['id']])){_0x399700[_0x2965('0x1f')][_0x4acc8d['id']]=new DeskAccount(_0x4acc8d);}else{_0x399700[_0x2965('0x3e')](_0x399700[_0x2965('0x1f')][_0x4acc8d['id']],_0x4acc8d);}}}return _0x399700[_0x2965('0x1f')];};};Realtime[_0x2965('0x3d')]['initSugarcrmAccounts']=function(){var _0x498a3f=this;return function(_0x5c5d16){if(_0x5c5d16){freeIsNotKey(_0x5c5d16,_0x498a3f[_0x2965('0x1c')],'id');for(var _0x57be44=0x0,_0x3bdf7b={},_0x124636={};_0x57be44<_0x5c5d16[_0x2965('0x3f')];_0x57be44+=0x1){_0x3bdf7b=_0x5c5d16[_0x57be44];if(_[_0x2965('0x42')](_0x498a3f[_0x2965('0x1c')][_0x3bdf7b['id']])){_0x498a3f[_0x2965('0x1c')][_0x3bdf7b['id']]=new SugarcrmAccount(_0x3bdf7b);}else{_0x498a3f[_0x2965('0x3e')](_0x498a3f['sugarcrmAccounts'][_0x3bdf7b['id']],_0x3bdf7b);}}}return _0x498a3f[_0x2965('0x1c')];};};Realtime[_0x2965('0x3d')][_0x2965('0x49')]=function(){var _0x555fa3=this;return function(_0x44df75){if(_0x44df75){freeIsNotKey(_0x44df75,_0x555fa3[_0x2965('0x20')],'id');for(var _0x472326=0x0,_0xfe1aa={},_0x32ed7b={};_0x472326<_0x44df75['length'];_0x472326+=0x1){_0xfe1aa=_0x44df75[_0x472326];if(_['isUndefined'](_0x555fa3[_0x2965('0x20')][_0xfe1aa['id']])){_0x555fa3[_0x2965('0x20')][_0xfe1aa['id']]=new VtigerAccount(_0xfe1aa);}else{_0x555fa3[_0x2965('0x3e')](_0x555fa3['vtigerAccounts'][_0xfe1aa['id']],_0xfe1aa);}}}return _0x555fa3[_0x2965('0x20')];};};Realtime['prototype'][_0x2965('0x4a')]=function(){var _0x5df6a4=this;return function(_0x7c05e6){if(_0x7c05e6){freeIsNotKey(_0x7c05e6,_0x5df6a4[_0x2965('0x21')],'id');for(var _0x4af17b=0x0,_0x1f508b={},_0x2c5e37={};_0x4af17b<_0x7c05e6['length'];_0x4af17b+=0x1){_0x1f508b=_0x7c05e6[_0x4af17b];if(_[_0x2965('0x42')](_0x5df6a4[_0x2965('0x21')][_0x1f508b['id']])){_0x5df6a4[_0x2965('0x21')][_0x1f508b['id']]=new ServicenowAccount(_0x1f508b);}else{_0x5df6a4[_0x2965('0x3e')](_0x5df6a4[_0x2965('0x21')][_0x1f508b['id']],_0x1f508b);}}}return _0x5df6a4[_0x2965('0x21')];};};Realtime[_0x2965('0x3d')][_0x2965('0x4b')]=function(){var _0x385469=this;return function(_0x22cc3d){if(_0x22cc3d){freeIsNotKey(_0x22cc3d,_0x385469['dynamics365Accounts'],'id');for(var _0x20e9de=0x0,_0x11bfee={},_0x1401ec={};_0x20e9de<_0x22cc3d[_0x2965('0x3f')];_0x20e9de+=0x1){_0x11bfee=_0x22cc3d[_0x20e9de];if(_[_0x2965('0x42')](_0x385469['dynamics365Accounts'][_0x11bfee['id']])){_0x385469[_0x2965('0x4c')][_0x11bfee['id']]=new Dynamics365Account(_0x11bfee);}else{_0x385469[_0x2965('0x3e')](_0x385469[_0x2965('0x4c')][_0x11bfee['id']],_0x11bfee);}}}return _0x385469[_0x2965('0x4c')];};};Realtime[_0x2965('0x3d')][_0x2965('0x4d')]=function(){var _0x19a016=this;return function(_0x9e954e){if(_0x9e954e){freeIsNotKey(_0x9e954e,_0x19a016['freshsalesAccounts'],'id');for(var _0x260961=0x0,_0xc3b162={},_0x50139c={};_0x260961<_0x9e954e['length'];_0x260961+=0x1){_0xc3b162=_0x9e954e[_0x260961];if(_['isUndefined'](_0x19a016[_0x2965('0x22')][_0xc3b162['id']])){_0x19a016[_0x2965('0x22')][_0xc3b162['id']]=new FreshsalesAccount(_0xc3b162);}else{_0x19a016[_0x2965('0x3e')](_0x19a016[_0x2965('0x22')][_0xc3b162['id']],_0xc3b162);}}}return _0x19a016[_0x2965('0x22')];};};Realtime[_0x2965('0x3d')][_0x2965('0x4e')]=function(){var _0x5f743a=this;return function(_0x25c3cb){for(var _0x2a4793=0x0;_0x2a4793<_0x25c3cb[_0x2965('0x3f')];_0x2a4793+=0x1){_[_0x2965('0x4f')](_0x5f743a['voiceQueues'][_0x25c3cb[_0x2a4793]['name']],_0x25c3cb[_0x2a4793]);}return _0x5f743a['voiceQueues'];};};Realtime[_0x2965('0x3d')][_0x2965('0x50')]=function(){var _0x55e491=this;return function(_0x56f2f2){clearVoiceQueues(_0x55e491['voiceQueues']);if(_0x56f2f2){_0x56f2f2=_[_0x2965('0x51')](_0x56f2f2,_0x2965('0x52'));for(var _0x461c44 in _0x56f2f2){if(_0x56f2f2[_0x2965('0x25')](_0x461c44)){var _0x1b3ebb={};for(var _0x4451bf=0x0;_0x4451bf<_0x56f2f2[_0x461c44]['length'];_0x4451bf+=0x1){var _0x474281=_0x56f2f2[_0x461c44][_0x4451bf][_0x2965('0x53')];if(_0x55e491[_0x2965('0x12')][_0x474281]){if(_0x56f2f2[_0x461c44][_0x4451bf]['queuecallerexit']){_0x55e491[_0x2965('0x12')][_0x474281][_0x2965('0x31')]+=0x1;}if(_0x56f2f2[_0x461c44][_0x4451bf][_0x2965('0x54')]){_0x55e491['voiceQueues'][_0x474281][_0x2965('0x32')]+=0x1;}_0x55e491[_0x2965('0x12')][_0x474281][_0x2965('0x2d')]+=moment(_0x56f2f2[_0x461c44][_0x4451bf][_0x2965('0x55')])[_0x2965('0x56')](moment(_0x56f2f2[_0x461c44][_0x4451bf]['queuecallerjoinAt']),_0x2965('0x57'))||0x0;if(_0x4451bf===_0x56f2f2[_0x461c44][_0x2965('0x3f')]-0x1){_0x55e491[_0x2965('0x12')][_0x474281][_0x2965('0x2e')]+=moment(_0x56f2f2[_0x461c44][_0x4451bf][_0x2965('0x58')]||_0x56f2f2[_0x461c44][_0x4451bf]['queuecallerabandonAt']||_0x56f2f2[_0x461c44][_0x4451bf][_0x2965('0x59')])[_0x2965('0x56')](moment(_0x56f2f2[_0x461c44][_0x4451bf]['queuecallerjoinAt']),_0x2965('0x57'))||0x0;_0x55e491['voiceQueues'][_0x474281][_0x2965('0x2b')]+=0x1;if(_0x56f2f2[_0x461c44][_0x4451bf]['queuecallercomplete']){_0x55e491[_0x2965('0x12')][_0x474281]['answered']+=0x1;_0x55e491[_0x2965('0x12')][_0x474281][_0x2965('0x33')]+=moment(_0x56f2f2[_0x461c44][_0x4451bf][_0x2965('0x58')])[_0x2965('0x56')](moment(_0x56f2f2[_0x461c44][_0x4451bf][_0x2965('0x55')]),'seconds')||0x0;}}else{_0x55e491[_0x2965('0x12')][_0x474281][_0x2965('0x2e')]+=_0x55e491['voiceQueues'][_0x474281][_0x2965('0x2d')]||0x0;}}}}}}return _0x55e491[_0x2965('0x12')];};};Realtime[_0x2965('0x3d')][_0x2965('0x5a')]=function(){var _0x45959b=this;return function(_0x2c804e){clearVoiceCallReports(_0x45959b['outbound']);if(_0x2c804e){for(var _0x48a1ef=0x0;_0x48a1ef<_0x2c804e[_0x2965('0x3f')];_0x48a1ef+=0x1){_0x45959b[_0x2965('0x15')][_0x2965('0x2b')]+=0x1;_0x45959b['outbound'][_0x2965('0x2e')]+=_0x2c804e[_0x48a1ef][_0x2965('0x5b')];if(_0x2c804e[_0x48a1ef][_0x2965('0x5c')]===_0x2965('0x5d')){_0x45959b['outbound'][_0x2965('0x2c')]+=0x1;_0x45959b[_0x2965('0x15')][_0x2965('0x2d')]+=_0x2c804e[_0x48a1ef][_0x2965('0x5b')]-_0x2c804e[_0x48a1ef][_0x2965('0x5e')]||0x0;_0x45959b[_0x2965('0x15')][_0x2965('0x33')]+=_0x2c804e[_0x48a1ef][_0x2965('0x5e')];}}}return _0x45959b[_0x2965('0x15')];};};Realtime[_0x2965('0x3d')][_0x2965('0x5f')]=function(){var _0x55bee8=this;return function(_0x4389d7){if(_0x4389d7){freeIsNotKey(_0x4389d7,_0x55bee8[_0x2965('0x60')],_0x2965('0x27'));for(var _0x1df94b=0x0,_0x3d58c0={};_0x1df94b<_0x4389d7[_0x2965('0x3f')];_0x1df94b+=0x1){_0x3d58c0=_0x4389d7[_0x1df94b];if(_[_0x2965('0x42')](_0x55bee8[_0x2965('0x60')][_0x3d58c0[_0x2965('0x27')]])){_0x55bee8[_0x2965('0x60')][_0x3d58c0[_0x2965('0x27')]]=new Campaign(_0x3d58c0);}else{_0x55bee8[_0x2965('0x3e')](_0x55bee8[_0x2965('0x60')][_0x3d58c0[_0x2965('0x27')]],_0x3d58c0);_0x55bee8[_0x2965('0x60')][_0x3d58c0['name']][_0x2965('0x61')]=_0x3d58c0['SquareProject']?_0x3d58c0[_0x2965('0x62')][_0x2965('0x27')]:undefined;}}}return _0x55bee8[_0x2965('0x60')];};};Realtime[_0x2965('0x3d')][_0x2965('0x63')]=function(){var _0x205105=this;return function(_0x5c43e0){if(_0x5c43e0){freeIsNotKey(_0x5c43e0,_0x205105[_0x2965('0x16')],'id');for(var _0x47aa24=0x0,_0x13eb51={};_0x47aa24<_0x5c43e0[_0x2965('0x3f')];_0x47aa24+=0x1){_0x13eb51=_0x5c43e0[_0x47aa24];if(_[_0x2965('0x42')](_0x205105[_0x2965('0x16')][_0x13eb51['id']])){_0x205105[_0x2965('0x16')][_0x13eb51['id']]=new VoiceExtension(_0x13eb51);}else{_0x205105[_0x2965('0x3e')](_0x205105[_0x2965('0x16')][_0x13eb51['id']],_0x13eb51);}}}return _0x205105[_0x2965('0x16')];};};Realtime[_0x2965('0x3d')][_0x2965('0x64')]=function(){var _0x33d9be=this;return function(_0x530b89){clearCampaigns(_0x33d9be[_0x2965('0x60')]);for(var _0x69fe07=0x0;_0x69fe07<_0x530b89[_0x2965('0x3f')];_0x69fe07+=0x1){_[_0x2965('0x4f')](_0x33d9be[_0x2965('0x60')][_0x530b89[_0x69fe07][_0x2965('0x27')]],_0x530b89[_0x69fe07]);}return _0x33d9be[_0x2965('0x60')];};};Realtime['prototype'][_0x2965('0x65')]=function(){var _0x3608d7=this;return function(_0x4ddfbe){if(_0x4ddfbe){freeIsNotKey(_0x4ddfbe,_0x3608d7[_0x2965('0x23')],'id');for(var _0x4d06f4=0x0,_0x322c36={},_0x4bf51c={};_0x4d06f4<_0x4ddfbe[_0x2965('0x3f')];_0x4d06f4+=0x1){_0x322c36=_0x4ddfbe[_0x4d06f4];if(_[_0x2965('0x42')](_0x3608d7[_0x2965('0x23')][_0x322c36['id']])){_0x3608d7[_0x2965('0x23')][_0x322c36['id']]=new FaxAccount(_0x322c36);}else{_0x3608d7[_0x2965('0x3e')](_0x3608d7[_0x2965('0x23')][_0x322c36['id']],_0x322c36);}}}return _0x3608d7[_0x2965('0x23')];};};module[_0x2965('0x66')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 95d3a7d..776e3b7 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 _0x6167=['from-voip-provider','callerid','context','from-sip','calleridpreview','calleridnum','channel','originatecalleridnum','ANSWERED','calleridname','transfers','linkedid','monitor','monitors','monitorFilename','filename','createdAt','xcally-motion-preview','connectedlinename','xcally-motion-dialer','voiceAgentReport','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','attendedTransfer','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','agents','prototype','sync','realtime','xdr','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','findAgent','find','accountcode','name','isNil','telephones','interface','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','destination','exten','type','lastapplication','queue','lastdata'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x6167,0x120));var _0x7616=function(_0x216970,_0x5e5d98){_0x216970=_0x216970-0x0;var _0x34be29=_0x6167[_0x216970];return _0x34be29;};'use strict';var _=require(_0x7616('0x0'));var moment=require(_0x7616('0x1'));var util=require(_0x7616('0x2'));var config=require(_0x7616('0x3'));var ami=require(_0x7616('0x4'));var RpcVoiceAgentReport=require(_0x7616('0x5'));var RpcVoiceCallReport=require(_0x7616('0x6'));var RpcVoiceDialReport=require(_0x7616('0x7'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x7616('0x8'));var RpcVoiceRecording=require(_0x7616('0x9'));var RpcVoiceTransferReport=require(_0x7616('0xa'));var VoiceQueueReport=require(_0x7616('0xb'));var VoiceCallReport=require(_0x7616('0xc'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x7616('0xd'));var UserReport=require(_0x7616('0xe'));function Report(_0x4613e6){this['realtime']=_0x4613e6;this[_0x7616('0xf')]=_0x4613e6[_0x7616('0xf')];this['telephones']=_0x4613e6['telephones'];}Report[_0x7616('0x10')][_0x7616('0x11')]=function(_0x506055){var _0x283611=new VoiceQueueReport(this[_0x7616('0x12')]);var _0x37da67=new VoiceAgentReport(this[_0x7616('0x12')]);var _0x2f6d49=new VoiceDialReport(this[_0x7616('0x12')]);var _0x4661b9=new VoiceCallReport(this['realtime']);var _0x72cd78=new UserReport(this[_0x7616('0x12')]);if(config[_0x7616('0x13')]&&config[_0x7616('0x13')]['disabled']){ami['on'](_0x7616('0x14'),this[_0x7616('0x15')]['bind'](this));ami['on'](_0x7616('0x16'),this[_0x7616('0x17')][_0x7616('0x18')](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport'][_0x7616('0x18')](this));ami['on']('custom:voiceDialReport',this[_0x7616('0x19')][_0x7616('0x18')](this));ami['on'](_0x7616('0x1a'),this[_0x7616('0x1b')][_0x7616('0x18')](this));ami['on'](_0x7616('0x1c'),this['attendedTransfer'][_0x7616('0x18')](this));}};Report[_0x7616('0x10')][_0x7616('0x1d')]=function(_0x4ca0ba){var _0x1af5ee;_0x1af5ee=_[_0x7616('0x1e')](this[_0x7616('0xf')],function(_0x44fbe4){return _0x44fbe4[_0x7616('0x1f')]==_0x4ca0ba||_0x44fbe4[_0x7616('0x20')]==_0x4ca0ba;});if(_[_0x7616('0x21')](_0x1af5ee)){var _0x411137=_[_0x7616('0x1e')](this[_0x7616('0x22')],function(_0x1e6797){return _0x1e6797[_0x7616('0x1f')]==_0x4ca0ba||_0x1e6797['name']==_0x4ca0ba;});if(_0x411137){_0x1af5ee=_[_0x7616('0x1e')](this[_0x7616('0xf')],function(_0x352bc0){return _0x352bc0[_0x7616('0x23')]==util[_0x7616('0x24')](_0x7616('0x25'),_0x411137[_0x7616('0x20')]);});}}return _0x1af5ee;};Report[_0x7616('0x10')]['voiceQueueReport']=function(_0x5eb65a){for(var _0x189306=0x0;_0x189306<_0x5eb65a[_0x7616('0x26')];_0x189306+=0x1){var _0xc85160=this[_0x7616('0x1d')](_0x5eb65a[_0x189306][_0x7616('0x27')]);if(_0xc85160){_0x5eb65a[_0x189306][_0x7616('0x1f')]=_0xc85160[_0x7616('0x1f')];_0x5eb65a[_0x189306][_0x7616('0x28')]=!![];_0x5eb65a[_0x189306][_0x7616('0x29')]=_0xc85160[_0x7616('0x20')];_0x5eb65a[_0x189306][_0x7616('0x23')]=_[_0x7616('0x21')](_0xc85160[_0x7616('0x23')])?util[_0x7616('0x24')]('SIP/%s',_0xc85160['name']):_0xc85160[_0x7616('0x23')];if(_0x5eb65a[_0x189306]['queuecallercomplete']){_0x5eb65a[_0x189306]['queuecallercompleteAt']=moment()[_0x7616('0x24')](_0x7616('0x2a'));}if(_0x5eb65a[_0x189306]['queuecallerexit']){_0x5eb65a[_0x189306][_0x7616('0x2b')]=moment()['format'](_0x7616('0x2a'));}RpcMemberReport[_0x7616('0x15')](_0x5eb65a[_0x189306]);}RpcVoiceQueueReport[_0x7616('0x2c')](_0x5eb65a[_0x189306]);}};function extractCalleridNumber(_0x39c6bf){var _0x34af76=_0x39c6bf[_0x7616('0x2d')](/<(.*?)>/);return _0x34af76?_0x34af76[0x1]:_0x39c6bf;}Report[_0x7616('0x10')][_0x7616('0x17')]=function(_0x172aa2){_0x172aa2[_0x7616('0x2e')]=_0x172aa2[_0x7616('0x2e')]||_0x172aa2[_0x7616('0x2f')];if(_0x172aa2[_0x7616('0x30')]=='dialer'){_0x172aa2[_0x7616('0x31')]=_0x7616('0x32');_0x172aa2[_0x7616('0x33')]=_0x172aa2['queue'];if(_0x172aa2['context']==_0x7616('0x34')){_0x172aa2[_0x7616('0x1f')]='';_0x172aa2[_0x7616('0x2e')]=extractCalleridNumber(_0x172aa2[_0x7616('0x35')]);}else if(_0x172aa2[_0x7616('0x36')]==_0x7616('0x37')){if(_0x172aa2[_0x7616('0x2e')]=='xcally-motion-preview'){_0x172aa2[_0x7616('0x2e')]=extractCalleridNumber(_0x172aa2[_0x7616('0x38')]);_0x172aa2[_0x7616('0x39')]=_0x172aa2['originatecalleridnum'];_0x172aa2['destinationchannel']=[_0x172aa2[_0x7616('0x3a')],_0x172aa2['channel']=_0x172aa2['destinationchannel']][0x0];_0x172aa2['callerid']=_0x172aa2[_0x7616('0x38')];}else{_0x172aa2['destination']=_0x172aa2[_0x7616('0x39')];_0x172aa2['calleridnum']=_0x172aa2[_0x7616('0x3b')];if(_0x172aa2['disposition']==_0x7616('0x3c')){_0x172aa2[_0x7616('0x1f')]=_0x172aa2['connectedlinenum'];}else{_0x172aa2[_0x7616('0x1f')]='';}}}}else{_0x172aa2[_0x7616('0x35')]=util['format']('\x22%s\x22\x20<%s>',_0x172aa2[_0x7616('0x3d')],_0x172aa2[_0x7616('0x39')]);}if(RpcVoiceTransferReport[_0x7616('0x3e')][_0x172aa2[_0x7616('0x3f')]]){var _0x24d6bc=RpcVoiceTransferReport[_0x7616('0x3e')][_0x172aa2[_0x7616('0x3f')]];_0x24d6bc['transfereelinkedid']=_0x172aa2['uniqueid'];RpcVoiceTransferReport[_0x7616('0x1b')](_0x24d6bc);delete RpcVoiceTransferReport['transfers'][_0x172aa2['linkedid']];}RpcVoiceCallReport[_0x7616('0x2c')](_0x172aa2);if(_0x172aa2[_0x7616('0x40')]){for(var _0x339733=0x0;_0x339733<_0x172aa2[_0x7616('0x41')][_0x7616('0x26')];_0x339733+=0x1){_0x172aa2[_0x7616('0x42')]=_0x172aa2[_0x7616('0x41')][_0x339733][_0x7616('0x43')];_0x172aa2[_0x7616('0x44')]=_0x172aa2[_0x7616('0x41')][_0x339733][_0x7616('0x44')];if(_0x172aa2['exten']==_0x7616('0x45')){_0x172aa2[_0x7616('0x39')]=_0x172aa2[_0x7616('0x27')];_0x172aa2[_0x7616('0x3d')]=_0x172aa2[_0x7616('0x46')];_0x172aa2[_0x7616('0x27')]=_0x172aa2['accountcode'];_0x172aa2[_0x7616('0x46')]=_0x172aa2['membername'];_0x172aa2[_0x7616('0x2f')]=_0x172aa2['originatecalleridnum'];}else if(_0x172aa2[_0x7616('0x2f')]==_0x7616('0x47')){_0x172aa2[_0x7616('0x39')]=_0x172aa2['destination'];_0x172aa2[_0x7616('0x2f')]=_0x172aa2[_0x7616('0x3b')];}RpcVoiceRecording[_0x7616('0x2c')](_0x172aa2);}}};Report[_0x7616('0x10')][_0x7616('0x48')]=function(_0x5cc526){if(_[_0x7616('0x49')](_0x5cc526)){_0x5cc526[_0x7616('0x4a')](function(_0x48b8e9){RpcVoiceAgentReport['create'](_0x48b8e9);});}else{RpcVoiceAgentReport[_0x7616('0x2c')](_0x5cc526);}};Report[_0x7616('0x10')]['voiceDialReport']=function(_0x417f81){RpcVoiceDialReport['create'](_0x417f81);var _0x4e94de;var _0x269a8f;var _0x79270b=_0x417f81[_0x7616('0x3a')];if(_[_0x7616('0x4b')](_0x79270b,_0x7616('0x4c'))){_0x269a8f=_0x79270b[_0x7616('0x4d')](_0x79270b['indexOf']('/')+0x1,_0x79270b[_0x7616('0x4e')]('@'));_0x4e94de=_[_0x7616('0x1e')](this['agents'],function(_0x15b14a){return _0x15b14a[_0x7616('0x4f')]==_0x269a8f||_0x15b14a[_0x7616('0x50')]==_0x269a8f||_0x15b14a['accountcode']==_0x269a8f;});}else{_0x269a8f=_0x79270b['substring'](_0x79270b['indexOf']('/')+0x1,_0x79270b[_0x7616('0x51')]('-'));_0x4e94de=this[_0x7616('0x1d')](_0x269a8f);}if(_0x4e94de){_0x417f81[_0x7616('0x23')]=_[_0x7616('0x21')](_0x4e94de['interface'])?util['format']('SIP/%s',_0x4e94de[_0x7616('0x20')]):_0x4e94de[_0x7616('0x23')];_0x417f81['membername']=_0x4e94de[_0x7616('0x20')];_0x417f81[_0x7616('0x1f')]=_0x4e94de[_0x7616('0x1f')];RpcMemberReport[_0x7616('0x19')](_0x417f81);}};Report[_0x7616('0x10')][_0x7616('0x1b')]=function(_0x5617a9){RpcVoiceTransferReport[_0x7616('0x3e')][_0x5617a9[_0x7616('0x52')]]=_0x5617a9;};Report['prototype'][_0x7616('0x53')]=function(_0x4f3623){RpcVoiceTransferReport[_0x7616('0x53')](_0x4f3623);};module[_0x7616('0x54')]=Report; \ No newline at end of file +var _0xa4c6=['forEach','voiceDialReport','startsWith','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','attendedTransfer','exports','lodash','moment','util','../../../config/environment','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','prototype','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','connectedlinenum','assigned','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','voiceCallReport','destination','exten','type','dialer','lastapplication','queue','from-voip-provider','from-sip','xcally-motion-preview','calleridnum','originatecalleridnum','destinationchannel','channel','callerid','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','linkedid','transfers','transfereelinkedid','uniqueid','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','membername','xcally-motion-dialer'];(function(_0x3c8594,_0x4615dd){var _0x2a47fa=function(_0x25901e){while(--_0x25901e){_0x3c8594['push'](_0x3c8594['shift']());}};_0x2a47fa(++_0x4615dd);}(_0xa4c6,0x1be));var _0x6a4c=function(_0x2576d4,_0x5603b2){_0x2576d4=_0x2576d4-0x0;var _0x358f95=_0xa4c6[_0x2576d4];return _0x358f95;};'use strict';var _=require(_0x6a4c('0x0'));var moment=require(_0x6a4c('0x1'));var util=require(_0x6a4c('0x2'));var config=require(_0x6a4c('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x6a4c('0x4'));var RpcVoiceDialReport=require(_0x6a4c('0x5'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x6a4c('0x6'));var RpcVoiceRecording=require(_0x6a4c('0x7'));var RpcVoiceTransferReport=require(_0x6a4c('0x8'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x6a4c('0x9'));var VoiceAgentReport=require(_0x6a4c('0xa'));var VoiceDialReport=require(_0x6a4c('0xb'));var UserReport=require(_0x6a4c('0xc'));function Report(_0x1765d2){this[_0x6a4c('0xd')]=_0x1765d2;this[_0x6a4c('0xe')]=_0x1765d2[_0x6a4c('0xe')];this[_0x6a4c('0xf')]=_0x1765d2['telephones'];}Report['prototype'][_0x6a4c('0x10')]=function(_0x472b3b){var _0x292878=new VoiceQueueReport(this[_0x6a4c('0xd')]);var _0x2fb786=new VoiceAgentReport(this[_0x6a4c('0xd')]);var _0x38c8db=new VoiceDialReport(this['realtime']);var _0x206cb0=new VoiceCallReport(this[_0x6a4c('0xd')]);var _0x1f6733=new UserReport(this[_0x6a4c('0xd')]);if(config[_0x6a4c('0x11')]&&config['xdr'][_0x6a4c('0x12')]){ami['on']('custom:voiceQueueReport',this[_0x6a4c('0x13')][_0x6a4c('0x14')](this));ami['on'](_0x6a4c('0x15'),this['voiceCallReport'][_0x6a4c('0x14')](this));ami['on'](_0x6a4c('0x16'),this[_0x6a4c('0x17')][_0x6a4c('0x14')](this));ami['on'](_0x6a4c('0x18'),this['voiceDialReport'][_0x6a4c('0x14')](this));ami['on'](_0x6a4c('0x19'),this[_0x6a4c('0x1a')][_0x6a4c('0x14')](this));ami['on'](_0x6a4c('0x1b'),this['attendedTransfer'][_0x6a4c('0x14')](this));}};Report[_0x6a4c('0x1c')][_0x6a4c('0x1d')]=function(_0x2e64cf){var _0x573193;_0x573193=_[_0x6a4c('0x1e')](this[_0x6a4c('0xe')],function(_0x1c6949){return _0x1c6949[_0x6a4c('0x1f')]==_0x2e64cf||_0x1c6949[_0x6a4c('0x20')]==_0x2e64cf;});if(_[_0x6a4c('0x21')](_0x573193)){var _0x20b26c=_[_0x6a4c('0x1e')](this[_0x6a4c('0xf')],function(_0x4b3aca){return _0x4b3aca['accountcode']==_0x2e64cf||_0x4b3aca['name']==_0x2e64cf;});if(_0x20b26c){_0x573193=_[_0x6a4c('0x1e')](this[_0x6a4c('0xe')],function(_0x21491c){return _0x21491c[_0x6a4c('0x22')]==util[_0x6a4c('0x23')](_0x6a4c('0x24'),_0x20b26c[_0x6a4c('0x20')]);});}}return _0x573193;};Report[_0x6a4c('0x1c')][_0x6a4c('0x13')]=function(_0xbf73d9){for(var _0xd1f144=0x0;_0xd1f144<_0xbf73d9[_0x6a4c('0x25')];_0xd1f144+=0x1){var _0x1baa48=this[_0x6a4c('0x1d')](_0xbf73d9[_0xd1f144][_0x6a4c('0x26')]);if(_0x1baa48){_0xbf73d9[_0xd1f144][_0x6a4c('0x1f')]=_0x1baa48[_0x6a4c('0x1f')];_0xbf73d9[_0xd1f144][_0x6a4c('0x27')]=!![];_0xbf73d9[_0xd1f144]['lastAssignedTo']=_0x1baa48[_0x6a4c('0x20')];_0xbf73d9[_0xd1f144][_0x6a4c('0x22')]=_[_0x6a4c('0x21')](_0x1baa48[_0x6a4c('0x22')])?util[_0x6a4c('0x23')]('SIP/%s',_0x1baa48['name']):_0x1baa48[_0x6a4c('0x22')];if(_0xbf73d9[_0xd1f144][_0x6a4c('0x28')]){_0xbf73d9[_0xd1f144]['queuecallercompleteAt']=moment()['format'](_0x6a4c('0x29'));}if(_0xbf73d9[_0xd1f144]['queuecallerexit']){_0xbf73d9[_0xd1f144][_0x6a4c('0x2a')]=moment()[_0x6a4c('0x23')](_0x6a4c('0x29'));}RpcMemberReport[_0x6a4c('0x13')](_0xbf73d9[_0xd1f144]);}RpcVoiceQueueReport[_0x6a4c('0x2b')](_0xbf73d9[_0xd1f144]);}};function extractCalleridNumber(_0x4cabde){var _0x497adc=_0x4cabde[_0x6a4c('0x2c')](/<(.*?)>/);return _0x497adc?_0x497adc[0x1]:_0x4cabde;}Report[_0x6a4c('0x1c')][_0x6a4c('0x2d')]=function(_0x4577b0){_0x4577b0[_0x6a4c('0x2e')]=_0x4577b0[_0x6a4c('0x2e')]||_0x4577b0[_0x6a4c('0x2f')];if(_0x4577b0[_0x6a4c('0x30')]==_0x6a4c('0x31')){_0x4577b0[_0x6a4c('0x32')]='queue';_0x4577b0['lastdata']=_0x4577b0[_0x6a4c('0x33')];if(_0x4577b0['context']==_0x6a4c('0x34')){_0x4577b0['accountcode']='';_0x4577b0[_0x6a4c('0x2e')]=extractCalleridNumber(_0x4577b0['callerid']);}else if(_0x4577b0['context']==_0x6a4c('0x35')){if(_0x4577b0[_0x6a4c('0x2e')]==_0x6a4c('0x36')){_0x4577b0[_0x6a4c('0x2e')]=extractCalleridNumber(_0x4577b0['calleridpreview']);_0x4577b0[_0x6a4c('0x37')]=_0x4577b0[_0x6a4c('0x38')];_0x4577b0[_0x6a4c('0x39')]=[_0x4577b0[_0x6a4c('0x3a')],_0x4577b0[_0x6a4c('0x3a')]=_0x4577b0[_0x6a4c('0x39')]][0x0];_0x4577b0[_0x6a4c('0x3b')]=_0x4577b0['calleridpreview'];}else{_0x4577b0[_0x6a4c('0x2e')]=_0x4577b0['calleridnum'];_0x4577b0[_0x6a4c('0x37')]=_0x4577b0[_0x6a4c('0x38')];if(_0x4577b0[_0x6a4c('0x3c')]==_0x6a4c('0x3d')){_0x4577b0[_0x6a4c('0x1f')]=_0x4577b0[_0x6a4c('0x26')];}else{_0x4577b0[_0x6a4c('0x1f')]='';}}}}else{_0x4577b0['callerid']=util[_0x6a4c('0x23')](_0x6a4c('0x3e'),_0x4577b0[_0x6a4c('0x3f')],_0x4577b0['calleridnum']);}if(RpcVoiceTransferReport['transfers'][_0x4577b0[_0x6a4c('0x40')]]){var _0x23d1b8=RpcVoiceTransferReport[_0x6a4c('0x41')][_0x4577b0['linkedid']];_0x23d1b8[_0x6a4c('0x42')]=_0x4577b0[_0x6a4c('0x43')];RpcVoiceTransferReport[_0x6a4c('0x1a')](_0x23d1b8);delete RpcVoiceTransferReport['transfers'][_0x4577b0[_0x6a4c('0x40')]];}RpcVoiceCallReport['create'](_0x4577b0);if(_0x4577b0[_0x6a4c('0x44')]){for(var _0x5d63d3=0x0;_0x5d63d3<_0x4577b0[_0x6a4c('0x45')]['length'];_0x5d63d3+=0x1){_0x4577b0[_0x6a4c('0x46')]=_0x4577b0[_0x6a4c('0x45')][_0x5d63d3][_0x6a4c('0x47')];_0x4577b0['createdAt']=_0x4577b0[_0x6a4c('0x45')][_0x5d63d3][_0x6a4c('0x48')];if(_0x4577b0[_0x6a4c('0x2f')]==_0x6a4c('0x36')){_0x4577b0[_0x6a4c('0x37')]=_0x4577b0['connectedlinenum'];_0x4577b0[_0x6a4c('0x3f')]=_0x4577b0['connectedlinename'];_0x4577b0[_0x6a4c('0x26')]=_0x4577b0[_0x6a4c('0x1f')];_0x4577b0[_0x6a4c('0x49')]=_0x4577b0[_0x6a4c('0x4a')];_0x4577b0[_0x6a4c('0x2f')]=_0x4577b0[_0x6a4c('0x38')];}else if(_0x4577b0[_0x6a4c('0x2f')]==_0x6a4c('0x4b')){_0x4577b0[_0x6a4c('0x37')]=_0x4577b0['destination'];_0x4577b0[_0x6a4c('0x2f')]=_0x4577b0[_0x6a4c('0x38')];}RpcVoiceRecording['create'](_0x4577b0);}}};Report['prototype'][_0x6a4c('0x17')]=function(_0x1efa89){if(_['isArray'](_0x1efa89)){_0x1efa89[_0x6a4c('0x4c')](function(_0x4eba74){RpcVoiceAgentReport[_0x6a4c('0x2b')](_0x4eba74);});}else{RpcVoiceAgentReport[_0x6a4c('0x2b')](_0x1efa89);}};Report[_0x6a4c('0x1c')][_0x6a4c('0x4d')]=function(_0x2903e3){RpcVoiceDialReport[_0x6a4c('0x2b')](_0x2903e3);var _0x521c50;var _0x17fbf5;var _0x1bd630=_0x2903e3['channel'];if(_[_0x6a4c('0x4e')](_0x1bd630,'Local')){_0x17fbf5=_0x1bd630[_0x6a4c('0x4f')](_0x1bd630['indexOf']('/')+0x1,_0x1bd630[_0x6a4c('0x50')]('@'));_0x521c50=_[_0x6a4c('0x1e')](this[_0x6a4c('0xe')],function(_0x338c31){return _0x338c31[_0x6a4c('0x51')]==_0x17fbf5||_0x338c31[_0x6a4c('0x52')]==_0x17fbf5||_0x338c31[_0x6a4c('0x1f')]==_0x17fbf5;});}else{_0x17fbf5=_0x1bd630['substring'](_0x1bd630[_0x6a4c('0x50')]('/')+0x1,_0x1bd630[_0x6a4c('0x53')]('-'));_0x521c50=this['findAgent'](_0x17fbf5);}if(_0x521c50){_0x2903e3[_0x6a4c('0x22')]=_[_0x6a4c('0x21')](_0x521c50[_0x6a4c('0x22')])?util[_0x6a4c('0x23')](_0x6a4c('0x24'),_0x521c50[_0x6a4c('0x20')]):_0x521c50['interface'];_0x2903e3[_0x6a4c('0x4a')]=_0x521c50[_0x6a4c('0x20')];_0x2903e3[_0x6a4c('0x1f')]=_0x521c50['accountcode'];RpcMemberReport[_0x6a4c('0x4d')](_0x2903e3);}};Report[_0x6a4c('0x1c')][_0x6a4c('0x1a')]=function(_0x333c12){RpcVoiceTransferReport[_0x6a4c('0x41')][_0x333c12[_0x6a4c('0x54')]]=_0x333c12;};Report[_0x6a4c('0x1c')][_0x6a4c('0x55')]=function(_0x18c7b2){RpcVoiceTransferReport[_0x6a4c('0x55')](_0x18c7b2);};module[_0x6a4c('0x56')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 30e7e39..ec9dc29 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 _0x3c50=['substring','indexOf','find','mobile','accountcode','info','peer','[userReport][peerstatus]','registered','address','telephone:%s','telephone:save','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','util','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','socket.io-emitter','trunks','telephones','registryentry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','error','[userReport][devicestatelist]','inspect','actionSipPeerStatus','catch','[userReport][sippeerstatus]','prototype','isNotNull','emit','syncRegistry','username','state','[userReport][registry]','stateRegistry','merge','omit','event','actionid','debug','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','name','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','agents','device','local','toLowerCase','inuse','toNumber','updateStatusRealtime','stateTime','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:%s','trunk:save','startsWith','Local'];(function(_0x1e1bb5,_0x23b4e9){var _0x413b4c=function(_0x1483c1){while(--_0x1483c1){_0x1e1bb5['push'](_0x1e1bb5['shift']());}};_0x413b4c(++_0x23b4e9);}(_0x3c50,0x132));var _0x03c5=function(_0x3eeefc,_0x24f005){_0x3eeefc=_0x3eeefc-0x0;var _0x2303d0=_0x3c50[_0x3eeefc];return _0x2303d0;};'use strict';var _=require(_0x03c5('0x0'));var moment=require('moment');var util=require(_0x03c5('0x1'));var Redis=require('ioredis');var BPromise=require(_0x03c5('0x2'));var config=require(_0x03c5('0x3'));var logger=require(_0x03c5('0x4'))(_0x03c5('0x5'));var ami=require(_0x03c5('0x6'));config[_0x03c5('0x7')]=_['defaults'](config[_0x03c5('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x03c5('0x8'))(new Redis(config[_0x03c5('0x7')]));function UserReport(_0x2f856a){this['trunks']=_0x2f856a[_0x03c5('0x9')];this['agents']=_0x2f856a['agents'];this[_0x03c5('0xa')]=_0x2f856a['telephones'];ami['on'](_0x03c5('0xb'),this['syncRegistry'][_0x03c5('0xc')](this));ami['on'](_0x03c5('0xd'),this['syncRegistry'][_0x03c5('0xc')](this));ami['on'](_0x03c5('0xe'),this[_0x03c5('0xf')][_0x03c5('0xc')](this));ami['on'](_0x03c5('0x10'),this[_0x03c5('0x11')]['bind'](this));return this[_0x03c5('0x12')]();}function showSipRegistrations(){Promise[_0x03c5('0x13')]()[_0x03c5('0x14')](ami[_0x03c5('0x15')]())['catch'](function(_0x39bbb7){logger[_0x03c5('0x16')]('[userReport][sipshowregistry]',util['inspect'](_0x39bbb7,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x03c5('0x13')]()[_0x03c5('0x14')](ami['actionDeviceStateList']())['catch'](function(_0xc23735){logger['error'](_0x03c5('0x17'),util[_0x03c5('0x18')](_0xc23735,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0x03c5('0x14')](ami[_0x03c5('0x19')]())[_0x03c5('0x1a')](function(_0x47dd55){logger[_0x03c5('0x16')](_0x03c5('0x1b'),util['inspect'](_0x47dd55,{'showHidden':![],'depth':null}));});}UserReport['prototype'][_0x03c5('0x12')]=function(){setInterval(function(){BPromise[_0x03c5('0x13')]()['then'](showSipRegistrations())['then'](listDeviceStates())[_0x03c5('0x14')](showPeersStatus());},0x32c8);};UserReport[_0x03c5('0x1c')][_0x03c5('0x1d')]=function(_0x41eb78){return _0x41eb78!==null&&!_['isUndefined'](_0x41eb78);};UserReport[_0x03c5('0x1c')]['emit']=function(_0x273bc1,_0x435a0d,_0x5acdbb){io['to'](_0x273bc1)[_0x03c5('0x1e')](_0x435a0d,_0x5acdbb);};UserReport[_0x03c5('0x1c')][_0x03c5('0x1f')]=function(_0x114308){try{if(this[_0x03c5('0x1d')](_0x114308)){logger['info']('[userReport][registry]\x20registry:%s\x20state:%s',_0x114308[_0x03c5('0x20')],_0x114308[_0x03c5('0x21')]);logger['debug'](_0x03c5('0x22'),util[_0x03c5('0x18')](_0x114308,{'showHidden':![],'depth':null}));var _0x59f9ce=_['find'](this[_0x03c5('0x9')],{'registry':_0x114308[_0x03c5('0x20')]});if(_0x59f9ce){_0x114308[_0x03c5('0x23')]=_0x114308['state'];_[_0x03c5('0x24')](_0x59f9ce,_[_0x03c5('0x25')](_0x114308,[_0x03c5('0x26'),_0x03c5('0x27'),_0x03c5('0x20'),_0x03c5('0x21')]));logger[_0x03c5('0x28')](_0x03c5('0x29'),util['inspect'](_0x59f9ce,{'showHidden':![],'depth':null}));this[_0x03c5('0x1e')](util[_0x03c5('0x2a')]('trunk:%s',_0x59f9ce[_0x03c5('0x2b')]),'trunk:save',_0x59f9ce);}}}catch(_0x55b04c){logger['error'](_0x03c5('0x22'),util[_0x03c5('0x18')](_0x55b04c,{'showHidden':![],'depth':null}));}};UserReport[_0x03c5('0x1c')]['syncDeviceState']=function(_0x4ac8d1){try{if(this[_0x03c5('0x1d')](_0x4ac8d1)){logger['info'](_0x03c5('0x2c'),_0x4ac8d1['device'],_0x4ac8d1['state']);logger[_0x03c5('0x28')](_0x03c5('0x2d'),util['inspect'](_0x4ac8d1,{'showHidden':![],'depth':null}));if(this[_0x03c5('0x2e')][_0x4ac8d1['device']]){if(!this[_0x03c5('0x2e')][_0x4ac8d1[_0x03c5('0x2f')]][_0x03c5('0x30')]||_0x4ac8d1[_0x03c5('0x21')][_0x03c5('0x31')]()==_0x03c5('0x32')){this[_0x03c5('0x2e')][_0x4ac8d1[_0x03c5('0x2f')]]['local']=![];if(this[_0x03c5('0x2e')][_0x4ac8d1['device']][_0x03c5('0x21')]!==_0x4ac8d1[_0x03c5('0x21')]['toLowerCase']()){this['agents'][_0x4ac8d1[_0x03c5('0x2f')]]['stateTime']=_[_0x03c5('0x33')](moment()[_0x03c5('0x2a')]('x'));}this[_0x03c5('0x2e')][_0x4ac8d1['device']][_0x03c5('0x21')]=_0x4ac8d1[_0x03c5('0x21')][_0x03c5('0x31')]();this[_0x03c5('0x2e')][_0x4ac8d1[_0x03c5('0x2f')]][_0x03c5('0x34')](_0x4ac8d1);}}else if(this['telephones'][_0x4ac8d1['device']]){if(this[_0x03c5('0xa')][_0x4ac8d1['device']][_0x03c5('0x21')]!==_0x4ac8d1['state'][_0x03c5('0x31')]()){this[_0x03c5('0xa')][_0x4ac8d1[_0x03c5('0x2f')]]['stateTime']=_[_0x03c5('0x33')](moment()['format']('x'));}this['telephones'][_0x4ac8d1[_0x03c5('0x2f')]][_0x03c5('0x21')]=_0x4ac8d1['state']['toLowerCase']();logger['debug']('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0x03c5('0xa')][_0x4ac8d1[_0x03c5('0x2f')]],{'showHidden':![],'depth':null}));this[_0x03c5('0x1e')](util[_0x03c5('0x2a')]('telephone:%s',this[_0x03c5('0xa')][_0x4ac8d1['device']][_0x03c5('0x2b')]),'telephone:save',this[_0x03c5('0xa')][_0x4ac8d1['device']]);}else if(this['trunks'][_0x4ac8d1['device']]){if(this[_0x03c5('0x9')][_0x4ac8d1['device']]['state']!==_0x4ac8d1[_0x03c5('0x21')][_0x03c5('0x31')]()){this[_0x03c5('0x9')][_0x4ac8d1[_0x03c5('0x2f')]][_0x03c5('0x35')]=_[_0x03c5('0x33')](moment()[_0x03c5('0x2a')]('x'));}this[_0x03c5('0x9')][_0x4ac8d1[_0x03c5('0x2f')]][_0x03c5('0x21')]=_0x4ac8d1[_0x03c5('0x21')][_0x03c5('0x31')]();logger[_0x03c5('0x28')](_0x03c5('0x36'),util['inspect'](this['trunks'][_0x4ac8d1[_0x03c5('0x2f')]],{'showHidden':![],'depth':null}));this[_0x03c5('0x1e')](util[_0x03c5('0x2a')](_0x03c5('0x37'),this['trunks'][_0x4ac8d1[_0x03c5('0x2f')]]['name']),_0x03c5('0x38'),this[_0x03c5('0x9')][_0x4ac8d1['device']]);}else if(_[_0x03c5('0x39')](_0x4ac8d1[_0x03c5('0x2f')],_0x03c5('0x3a'))){var _0x5e6929=_0x4ac8d1['device'];var _0x248d24=_0x5e6929[_0x03c5('0x3b')](_0x5e6929['indexOf']('/')+0x1,_0x5e6929[_0x03c5('0x3c')]('@'));var _0x2578f3=_[_0x03c5('0x3d')](this[_0x03c5('0x2e')],function(_0x9316fa){return _0x9316fa[_0x03c5('0x3e')]==_0x248d24||_0x9316fa['phone']==_0x248d24||_0x9316fa[_0x03c5('0x3f')]==_0x248d24;});if(_0x2578f3){if(_0x2578f3['state']!==_0x4ac8d1[_0x03c5('0x21')][_0x03c5('0x31')]()){_0x2578f3[_0x03c5('0x35')]=_['toNumber'](moment()[_0x03c5('0x2a')]('x'));}_0x2578f3[_0x03c5('0x21')]=_0x4ac8d1['state']['toLowerCase']();_0x2578f3[_0x03c5('0x30')]=!![];_0x2578f3['updateStatusRealtime'](_0x4ac8d1);}}}}catch(_0x5b47f1){logger[_0x03c5('0x16')](_0x03c5('0x2d'),util[_0x03c5('0x18')](_0x5b47f1,{'showHidden':![],'depth':null}));}};UserReport[_0x03c5('0x1c')][_0x03c5('0x11')]=function(_0xb09440){try{if(this['isNotNull'](_0xb09440)&&this[_0x03c5('0x1d')](_0xb09440['peerstatus'])){logger[_0x03c5('0x40')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0xb09440[_0x03c5('0x41')],_0xb09440['address'],_0xb09440['peerstatus']);logger[_0x03c5('0x28')](_0x03c5('0x42'),util[_0x03c5('0x18')](_0xb09440,{'showHidden':![],'depth':null}));if(this[_0x03c5('0x2e')][_0xb09440[_0x03c5('0x41')]]){if(!this[_0x03c5('0x2e')][_0xb09440['peer']]['local']||_0xb09440[_0x03c5('0x10')][_0x03c5('0x31')]()==_0x03c5('0x43')){this['agents'][_0xb09440[_0x03c5('0x41')]][_0x03c5('0x30')]=![];this[_0x03c5('0x2e')][_0xb09440[_0x03c5('0x41')]]['status']=_0xb09440[_0x03c5('0x10')]['toLowerCase']();this['agents'][_0xb09440[_0x03c5('0x41')]][_0x03c5('0x44')]=_0xb09440[_0x03c5('0x44')];this[_0x03c5('0x2e')][_0xb09440[_0x03c5('0x41')]][_0x03c5('0x34')](_0xb09440);}}else if(this[_0x03c5('0xa')][_0xb09440[_0x03c5('0x41')]]){this[_0x03c5('0xa')][_0xb09440[_0x03c5('0x41')]]['status']=_0xb09440[_0x03c5('0x10')][_0x03c5('0x31')]();this['telephones'][_0xb09440['peer']]['address']=_0xb09440[_0x03c5('0x44')];logger[_0x03c5('0x28')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0x03c5('0x18')](this['telephones'][_0xb09440[_0x03c5('0x41')]],{'showHidden':![],'depth':null}));this[_0x03c5('0x1e')](util[_0x03c5('0x2a')](_0x03c5('0x45'),this[_0x03c5('0xa')][_0xb09440[_0x03c5('0x41')]][_0x03c5('0x2b')]),_0x03c5('0x46'),this[_0x03c5('0xa')][_0xb09440['peer']]);}else if(this['trunks'][_0xb09440[_0x03c5('0x41')]]){this[_0x03c5('0x9')][_0xb09440[_0x03c5('0x41')]]['status']=_0xb09440[_0x03c5('0x10')][_0x03c5('0x31')]();this[_0x03c5('0x9')][_0xb09440[_0x03c5('0x41')]]['address']=_0xb09440[_0x03c5('0x44')];logger[_0x03c5('0x28')](_0x03c5('0x47'),util[_0x03c5('0x18')](this['trunks'][_0xb09440[_0x03c5('0x41')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x03c5('0x2a')](_0x03c5('0x37'),this[_0x03c5('0x9')][_0xb09440[_0x03c5('0x41')]]['name']),'trunk:save',this['trunks'][_0xb09440[_0x03c5('0x41')]]);}}}catch(_0x4d62ca){logger['error'](_0x03c5('0x42'),util[_0x03c5('0x18')](_0x4d62ca,{'showHidden':![],'depth':null}));}};module[_0x03c5('0x48')]=UserReport; \ No newline at end of file +var _0x6dc0=['info','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','inuse','stateTime','toNumber','telephones','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','find','mobile','phone','peer','address','[userReport][peerstatus]','registered','status','updateStatusRealtime','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','bluebird','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','trunks','agents','registryentry','syncRegistry','registry','bind','devicestatechange','peerstatus','then','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','catch','[userReport][devicestatelist]','resolve','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','syncRealtimeShow','isUndefined','emit','isNotNull','[userReport][registry]','username','stateRegistry','omit','actionid','state','debug','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','syncDeviceState'];(function(_0x4c21c6,_0x15272c){var _0x28c910=function(_0x1b2f4b){while(--_0x1b2f4b){_0x4c21c6['push'](_0x4c21c6['shift']());}};_0x28c910(++_0x15272c);}(_0x6dc0,0xb6));var _0x06dc=function(_0x4550e3,_0x1148a5){_0x4550e3=_0x4550e3-0x0;var _0x1809f0=_0x6dc0[_0x4550e3];return _0x1809f0;};'use strict';var _=require(_0x06dc('0x0'));var moment=require(_0x06dc('0x1'));var util=require(_0x06dc('0x2'));var Redis=require('ioredis');var BPromise=require(_0x06dc('0x3'));var config=require(_0x06dc('0x4'));var logger=require(_0x06dc('0x5'))(_0x06dc('0x6'));var ami=require('../ami');config[_0x06dc('0x7')]=_[_0x06dc('0x8')](config['redis'],{'host':_0x06dc('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x06dc('0x7')]));function UserReport(_0x3212ca){this[_0x06dc('0xa')]=_0x3212ca[_0x06dc('0xa')];this[_0x06dc('0xb')]=_0x3212ca['agents'];this['telephones']=_0x3212ca['telephones'];ami['on'](_0x06dc('0xc'),this[_0x06dc('0xd')]['bind'](this));ami['on'](_0x06dc('0xe'),this[_0x06dc('0xd')][_0x06dc('0xf')](this));ami['on'](_0x06dc('0x10'),this['syncDeviceState'][_0x06dc('0xf')](this));ami['on'](_0x06dc('0x11'),this['syncPeerStatus']['bind'](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise['resolve']()[_0x06dc('0x12')](ami['actionSipShowRegistry']())['catch'](function(_0x4874ce){logger[_0x06dc('0x13')](_0x06dc('0x14'),util[_0x06dc('0x15')](_0x4874ce,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0x06dc('0x12')](ami[_0x06dc('0x16')]())[_0x06dc('0x17')](function(_0x3da2c5){logger['error'](_0x06dc('0x18'),util[_0x06dc('0x15')](_0x3da2c5,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x06dc('0x19')]()[_0x06dc('0x12')](ami[_0x06dc('0x1a')]())['catch'](function(_0x1daaa8){logger[_0x06dc('0x13')](_0x06dc('0x1b'),util[_0x06dc('0x15')](_0x1daaa8,{'showHidden':![],'depth':null}));});}UserReport[_0x06dc('0x1c')][_0x06dc('0x1d')]=function(){setInterval(function(){BPromise['resolve']()['then'](showSipRegistrations())[_0x06dc('0x12')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0x06dc('0x1c')]['isNotNull']=function(_0x23d1c3){return _0x23d1c3!==null&&!_[_0x06dc('0x1e')](_0x23d1c3);};UserReport[_0x06dc('0x1c')][_0x06dc('0x1f')]=function(_0x8aaf2,_0x427f39,_0x577284){io['to'](_0x8aaf2)['emit'](_0x427f39,_0x577284);};UserReport[_0x06dc('0x1c')][_0x06dc('0xd')]=function(_0x56c345){try{if(this[_0x06dc('0x20')](_0x56c345)){logger['info']('[userReport][registry]\x20registry:%s\x20state:%s',_0x56c345['username'],_0x56c345['state']);logger['debug'](_0x06dc('0x21'),util['inspect'](_0x56c345,{'showHidden':![],'depth':null}));var _0xfa043e=_['find'](this['trunks'],{'registry':_0x56c345[_0x06dc('0x22')]});if(_0xfa043e){_0x56c345[_0x06dc('0x23')]=_0x56c345['state'];_['merge'](_0xfa043e,_[_0x06dc('0x24')](_0x56c345,['event',_0x06dc('0x25'),_0x06dc('0x22'),_0x06dc('0x26')]));logger[_0x06dc('0x27')](_0x06dc('0x28'),util[_0x06dc('0x15')](_0xfa043e,{'showHidden':![],'depth':null}));this[_0x06dc('0x1f')](util[_0x06dc('0x29')](_0x06dc('0x2a'),_0xfa043e[_0x06dc('0x2b')]),_0x06dc('0x2c'),_0xfa043e);}}}catch(_0x285bb4){logger[_0x06dc('0x13')]('[userReport][registry]',util['inspect'](_0x285bb4,{'showHidden':![],'depth':null}));}};UserReport[_0x06dc('0x1c')][_0x06dc('0x2d')]=function(_0x250a96){try{if(this[_0x06dc('0x20')](_0x250a96)){logger[_0x06dc('0x2e')](_0x06dc('0x2f'),_0x250a96[_0x06dc('0x30')],_0x250a96[_0x06dc('0x26')]);logger[_0x06dc('0x27')](_0x06dc('0x31'),util['inspect'](_0x250a96,{'showHidden':![],'depth':null}));if(this[_0x06dc('0xb')][_0x250a96[_0x06dc('0x30')]]){if(!this[_0x06dc('0xb')][_0x250a96[_0x06dc('0x30')]][_0x06dc('0x32')]||_0x250a96['state'][_0x06dc('0x33')]()==_0x06dc('0x34')){this[_0x06dc('0xb')][_0x250a96['device']][_0x06dc('0x32')]=![];if(this[_0x06dc('0xb')][_0x250a96['device']][_0x06dc('0x26')]!==_0x250a96[_0x06dc('0x26')]['toLowerCase']()){this[_0x06dc('0xb')][_0x250a96[_0x06dc('0x30')]][_0x06dc('0x35')]=_[_0x06dc('0x36')](moment()[_0x06dc('0x29')]('x'));}this[_0x06dc('0xb')][_0x250a96[_0x06dc('0x30')]][_0x06dc('0x26')]=_0x250a96[_0x06dc('0x26')][_0x06dc('0x33')]();this['agents'][_0x250a96['device']]['updateStatusRealtime'](_0x250a96);}}else if(this[_0x06dc('0x37')][_0x250a96[_0x06dc('0x30')]]){if(this[_0x06dc('0x37')][_0x250a96[_0x06dc('0x30')]]['state']!==_0x250a96['state'][_0x06dc('0x33')]()){this[_0x06dc('0x37')][_0x250a96[_0x06dc('0x30')]][_0x06dc('0x35')]=_[_0x06dc('0x36')](moment()[_0x06dc('0x29')]('x'));}this[_0x06dc('0x37')][_0x250a96[_0x06dc('0x30')]][_0x06dc('0x26')]=_0x250a96[_0x06dc('0x26')][_0x06dc('0x33')]();logger[_0x06dc('0x27')](_0x06dc('0x38'),util[_0x06dc('0x15')](this[_0x06dc('0x37')][_0x250a96[_0x06dc('0x30')]],{'showHidden':![],'depth':null}));this[_0x06dc('0x1f')](util[_0x06dc('0x29')](_0x06dc('0x39'),this[_0x06dc('0x37')][_0x250a96['device']]['name']),_0x06dc('0x3a'),this[_0x06dc('0x37')][_0x250a96[_0x06dc('0x30')]]);}else if(this[_0x06dc('0xa')][_0x250a96[_0x06dc('0x30')]]){if(this['trunks'][_0x250a96[_0x06dc('0x30')]][_0x06dc('0x26')]!==_0x250a96[_0x06dc('0x26')]['toLowerCase']()){this[_0x06dc('0xa')][_0x250a96[_0x06dc('0x30')]]['stateTime']=_[_0x06dc('0x36')](moment()[_0x06dc('0x29')]('x'));}this[_0x06dc('0xa')][_0x250a96[_0x06dc('0x30')]]['state']=_0x250a96['state'][_0x06dc('0x33')]();logger[_0x06dc('0x27')](_0x06dc('0x3b'),util['inspect'](this[_0x06dc('0xa')][_0x250a96[_0x06dc('0x30')]],{'showHidden':![],'depth':null}));this[_0x06dc('0x1f')](util[_0x06dc('0x29')](_0x06dc('0x2a'),this['trunks'][_0x250a96[_0x06dc('0x30')]]['name']),'trunk:save',this[_0x06dc('0xa')][_0x250a96[_0x06dc('0x30')]]);}else if(_[_0x06dc('0x3c')](_0x250a96[_0x06dc('0x30')],_0x06dc('0x3d'))){var _0x4e316d=_0x250a96[_0x06dc('0x30')];var _0x13ba4b=_0x4e316d[_0x06dc('0x3e')](_0x4e316d[_0x06dc('0x3f')]('/')+0x1,_0x4e316d[_0x06dc('0x3f')]('@'));var _0x1536d3=_[_0x06dc('0x40')](this[_0x06dc('0xb')],function(_0x1081a9){return _0x1081a9[_0x06dc('0x41')]==_0x13ba4b||_0x1081a9[_0x06dc('0x42')]==_0x13ba4b||_0x1081a9['accountcode']==_0x13ba4b;});if(_0x1536d3){if(_0x1536d3[_0x06dc('0x26')]!==_0x250a96[_0x06dc('0x26')]['toLowerCase']()){_0x1536d3[_0x06dc('0x35')]=_[_0x06dc('0x36')](moment()[_0x06dc('0x29')]('x'));}_0x1536d3['state']=_0x250a96[_0x06dc('0x26')][_0x06dc('0x33')]();_0x1536d3['local']=!![];_0x1536d3['updateStatusRealtime'](_0x250a96);}}}}catch(_0x5a7b20){logger[_0x06dc('0x13')](_0x06dc('0x31'),util[_0x06dc('0x15')](_0x5a7b20,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncPeerStatus']=function(_0x1d759b){try{if(this[_0x06dc('0x20')](_0x1d759b)&&this[_0x06dc('0x20')](_0x1d759b[_0x06dc('0x11')])){logger[_0x06dc('0x2e')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x1d759b[_0x06dc('0x43')],_0x1d759b[_0x06dc('0x44')],_0x1d759b[_0x06dc('0x11')]);logger['debug'](_0x06dc('0x45'),util[_0x06dc('0x15')](_0x1d759b,{'showHidden':![],'depth':null}));if(this[_0x06dc('0xb')][_0x1d759b[_0x06dc('0x43')]]){if(!this[_0x06dc('0xb')][_0x1d759b[_0x06dc('0x43')]][_0x06dc('0x32')]||_0x1d759b[_0x06dc('0x11')]['toLowerCase']()==_0x06dc('0x46')){this['agents'][_0x1d759b[_0x06dc('0x43')]]['local']=![];this[_0x06dc('0xb')][_0x1d759b['peer']][_0x06dc('0x47')]=_0x1d759b[_0x06dc('0x11')][_0x06dc('0x33')]();this[_0x06dc('0xb')][_0x1d759b[_0x06dc('0x43')]][_0x06dc('0x44')]=_0x1d759b[_0x06dc('0x44')];this['agents'][_0x1d759b[_0x06dc('0x43')]][_0x06dc('0x48')](_0x1d759b);}}else if(this[_0x06dc('0x37')][_0x1d759b['peer']]){this['telephones'][_0x1d759b[_0x06dc('0x43')]][_0x06dc('0x47')]=_0x1d759b[_0x06dc('0x11')]['toLowerCase']();this[_0x06dc('0x37')][_0x1d759b[_0x06dc('0x43')]][_0x06dc('0x44')]=_0x1d759b[_0x06dc('0x44')];logger['debug'](_0x06dc('0x49'),util[_0x06dc('0x15')](this[_0x06dc('0x37')][_0x1d759b[_0x06dc('0x43')]],{'showHidden':![],'depth':null}));this[_0x06dc('0x1f')](util[_0x06dc('0x29')](_0x06dc('0x39'),this[_0x06dc('0x37')][_0x1d759b[_0x06dc('0x43')]][_0x06dc('0x2b')]),'telephone:save',this[_0x06dc('0x37')][_0x1d759b[_0x06dc('0x43')]]);}else if(this[_0x06dc('0xa')][_0x1d759b['peer']]){this['trunks'][_0x1d759b[_0x06dc('0x43')]][_0x06dc('0x47')]=_0x1d759b[_0x06dc('0x11')][_0x06dc('0x33')]();this[_0x06dc('0xa')][_0x1d759b[_0x06dc('0x43')]][_0x06dc('0x44')]=_0x1d759b[_0x06dc('0x44')];logger[_0x06dc('0x27')](_0x06dc('0x4a'),util[_0x06dc('0x15')](this[_0x06dc('0xa')][_0x1d759b[_0x06dc('0x43')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x06dc('0x2a'),this['trunks'][_0x1d759b[_0x06dc('0x43')]][_0x06dc('0x2b')]),_0x06dc('0x2c'),this['trunks'][_0x1d759b[_0x06dc('0x43')]]);}}}catch(_0x152cd4){logger[_0x06dc('0x13')](_0x06dc('0x45'),util[_0x06dc('0x15')](_0x152cd4,{'showHidden':![],'depth':null}));}};module[_0x06dc('0x4b')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 48b883d..297913d 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 _0xb3bc=['memberdynamic','memberpenalty','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','values','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','agentconnectAt','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','lastIndexOf','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','substring','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','bind','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','varset','syncVarSet','syncHangup','musiconholdstart','syncMusicOnHoldStop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','syncAgentCalled','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','omit','event','privilege','debug','inspect','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','error','[%s][voiceAgentReport][agentconnect]\x20event:','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','merge','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:%s','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','agentringnoanswerAt','reason','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','hasOwnProperty','agentcompleteAt','complete','transfer','agent','talktime','acw','acwTimeout','agentacw','interface','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','value','[%s][voiceAgentReport][varset]','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer'];(function(_0x5ee71e,_0x28e6bf){var _0x1675b1=function(_0x5f543c){while(--_0x5f543c){_0x5ee71e['push'](_0x5ee71e['shift']());}};_0x1675b1(++_0x28e6bf);}(_0xb3bc,0x146));var _0xcb3b=function(_0x58e682,_0x685656){_0x58e682=_0x58e682-0x0;var _0x1d7902=_0xb3bc[_0x58e682];return _0x1d7902;};'use strict';var _=require(_0xcb3b('0x0'));var moment=require(_0xcb3b('0x1'));var util=require(_0xcb3b('0x2'));var Redis=require(_0xcb3b('0x3'));var config=require(_0xcb3b('0x4'));var logger=require(_0xcb3b('0x5'))(_0xcb3b('0x6'));var ami=require(_0xcb3b('0x7'));config[_0xcb3b('0x8')]=_[_0xcb3b('0x9')](config[_0xcb3b('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xcb3b('0xa'))(new Redis(config[_0xcb3b('0x8')]));function VoiceAgentReport(_0x115ada){this[_0xcb3b('0xb')]={};this[_0xcb3b('0xc')]=_0x115ada[_0xcb3b('0xc')];this['agents']=_0x115ada[_0xcb3b('0xd')];this[_0xcb3b('0xe')]={};ami['on'](_0xcb3b('0xf'),this['syncAgentCalled'][_0xcb3b('0x10')](this));ami['on']('agentconnect',this[_0xcb3b('0x11')][_0xcb3b('0x10')](this));ami['on'](_0xcb3b('0x12'),this[_0xcb3b('0x13')][_0xcb3b('0x10')](this));ami['on'](_0xcb3b('0x14'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0xcb3b('0x15'),this['syncAgentComplete']['bind'](this));ami['on'](_0xcb3b('0x16'),this[_0xcb3b('0x17')]['bind'](this));ami['on']('hangup',this[_0xcb3b('0x18')][_0xcb3b('0x10')](this));ami['on'](_0xcb3b('0x19'),this['syncMusicOnHoldStart'][_0xcb3b('0x10')](this));ami['on']('musiconholdstop',this[_0xcb3b('0x1a')]['bind'](this));ami['on'](_0xcb3b('0x1b'),this['syncAttendedTransfer'][_0xcb3b('0x10')](this));ami['on']('blindtransfer',this[_0xcb3b('0x1c')][_0xcb3b('0x10')](this));}VoiceAgentReport[_0xcb3b('0x1d')][_0xcb3b('0x1e')]=function(_0x3fc7c4,_0x697715,_0x20ff46){io['to'](_0x3fc7c4)[_0xcb3b('0x1e')](_0x697715,_0x20ff46);};VoiceAgentReport[_0xcb3b('0x1d')][_0xcb3b('0x1f')]=function(_0x2929ff){return _0x2929ff!==null&&!_[_0xcb3b('0x20')](_0x2929ff);};VoiceAgentReport[_0xcb3b('0x1d')][_0xcb3b('0x21')]=function(_0x263884){try{if(this['isNotNull'](_0x263884)){logger[_0xcb3b('0x22')](_0xcb3b('0x23'),_0x263884[_0xcb3b('0x24')],_0x263884[_0xcb3b('0x25')],_0x263884[_0xcb3b('0x26')]);logger['debug'](_0xcb3b('0x27'),_0x263884['uniqueid'],util['inspect'](_0x263884,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xcb3b('0xb')][_0x263884[_0xcb3b('0x24')]])){this['channels'][_0x263884[_0xcb3b('0x24')]]={};}if(_[_0xcb3b('0x20')](this[_0xcb3b('0xb')][_0x263884[_0xcb3b('0x24')]][_0x263884[_0xcb3b('0x26')]])){this[_0xcb3b('0xb')][_0x263884[_0xcb3b('0x24')]][_0x263884[_0xcb3b('0x26')]]={'agentcalledAt':moment()['format'](_0xcb3b('0x28')),'lastevent':_0xcb3b('0x29'),'mandatoryDisposition':this['voiceQueues'][_0x263884[_0xcb3b('0x2a')]]?this[_0xcb3b('0xc')][_0x263884[_0xcb3b('0x2a')]][_0xcb3b('0x2b')]||![]:![],'type':this[_0xcb3b('0xc')][_0x263884['queue']]?this[_0xcb3b('0xc')][_0x263884[_0xcb3b('0x2a')]][_0xcb3b('0x2c')]||_0xcb3b('0x2d'):_0xcb3b('0x2d'),'variables':this[_0xcb3b('0xe')][_0x263884['uniqueid']]};}_['merge'](this[_0xcb3b('0xb')][_0x263884[_0xcb3b('0x24')]][_0x263884[_0xcb3b('0x26')]],_[_0xcb3b('0x2e')](_0x263884,[_0xcb3b('0x2f'),_0xcb3b('0x30')]));logger[_0xcb3b('0x31')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x263884['uniqueid'],util[_0xcb3b('0x32')](this[_0xcb3b('0xb')][_0x263884['uniqueid']][_0x263884[_0xcb3b('0x26')]],{'showHidden':![],'depth':null}));ami[_0xcb3b('0x1e')](_0xcb3b('0x33'),this['channels'][_0x263884['uniqueid']][_0x263884['destuniqueid']]);logger[_0xcb3b('0x31')](_0xcb3b('0x34'),_0x263884[_0xcb3b('0x24')],util[_0xcb3b('0x32')](this['channels'][_0x263884[_0xcb3b('0x24')]][_0x263884['destuniqueid']],{'showHidden':![],'depth':null}));this[_0xcb3b('0x1e')](util[_0xcb3b('0x35')]('user:%s',_0x263884['membername']),'user:called',this[_0xcb3b('0xb')][_0x263884[_0xcb3b('0x24')]][_0x263884['destuniqueid']]);}}catch(_0x19bc95){logger[_0xcb3b('0x36')]('[%s][voiceAgentReport][agentcalled]',_0x263884[_0xcb3b('0x24')],util[_0xcb3b('0x32')](_0x19bc95,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcb3b('0x1d')][_0xcb3b('0x11')]=function(_0x54d62a){try{if(this[_0xcb3b('0x1f')](_0x54d62a)){if(this[_0xcb3b('0xb')][_0x54d62a[_0xcb3b('0x24')]]){logger[_0xcb3b('0x31')](_0xcb3b('0x37'),_0x54d62a[_0xcb3b('0x24')],util[_0xcb3b('0x32')](_0x54d62a,{'showHidden':![],'depth':null}));for(var _0x543917 in this['channels'][_0x54d62a[_0xcb3b('0x24')]]){if(this[_0xcb3b('0xb')][_0x54d62a['uniqueid']]['hasOwnProperty'](_0x543917)){if(_0x54d62a[_0xcb3b('0x26')]===_0x543917){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x54d62a[_0xcb3b('0x24')],_0x54d62a[_0xcb3b('0x25')],_0x54d62a[_0xcb3b('0x26')]);this[_0xcb3b('0xb')][_0x54d62a[_0xcb3b('0x24')]][_0x543917]['agentconnectAt']=moment()[_0xcb3b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xcb3b('0xb')][_0x54d62a['uniqueid']][_0x543917][_0xcb3b('0x38')]=_0x54d62a[_0xcb3b('0x38')];this[_0xcb3b('0xb')][_0x54d62a[_0xcb3b('0x24')]][_0x543917]['connectedlinenum']=_0x54d62a[_0xcb3b('0x39')];this[_0xcb3b('0xb')][_0x54d62a[_0xcb3b('0x24')]][_0x543917][_0xcb3b('0x3a')]=_0x54d62a[_0xcb3b('0x3a')];this['channels'][_0x54d62a[_0xcb3b('0x24')]][_0x543917][_0xcb3b('0x3b')]=_0x54d62a[_0xcb3b('0x3b')];this[_0xcb3b('0xb')][_0x54d62a[_0xcb3b('0x24')]][_0x543917]['holdtime']=_0x54d62a[_0xcb3b('0x3c')];this[_0xcb3b('0xb')][_0x54d62a['uniqueid']][_0x543917][_0xcb3b('0x3d')]='connect';_[_0xcb3b('0x3e')](this[_0xcb3b('0xd')][_0x54d62a['interface']],_['pick'](_0x54d62a,[_0xcb3b('0x2a'),_0xcb3b('0x3f')]));logger['debug'](_0xcb3b('0x40'),_0x54d62a[_0xcb3b('0x24')],util['inspect'](this['channels'][_0x54d62a[_0xcb3b('0x24')]][_0x54d62a[_0xcb3b('0x26')]],{'showHidden':![],'depth':null}));ami[_0xcb3b('0x1e')](_0xcb3b('0x41'),this[_0xcb3b('0xb')][_0x54d62a[_0xcb3b('0x24')]][_0x54d62a[_0xcb3b('0x26')]]);logger[_0xcb3b('0x31')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x54d62a['uniqueid'],util[_0xcb3b('0x32')](this[_0xcb3b('0xb')][_0x54d62a['uniqueid']][_0x54d62a[_0xcb3b('0x26')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xcb3b('0x35')](_0xcb3b('0x42'),_0x54d62a[_0xcb3b('0x25')]),'user:agentconnect',this[_0xcb3b('0xb')][_0x54d62a[_0xcb3b('0x24')]][_0x54d62a['destuniqueid']]);}else if(!this['channels'][_0x54d62a[_0xcb3b('0x24')]][_0x543917][_0xcb3b('0x12')]&&!this[_0xcb3b('0xb')][_0x54d62a[_0xcb3b('0x24')]][_0x543917][_0xcb3b('0x15')]){logger['info'](_0xcb3b('0x43'),_0x54d62a[_0xcb3b('0x24')],this[_0xcb3b('0xb')][_0x54d62a[_0xcb3b('0x24')]][_0x543917][_0xcb3b('0x25')],_0x543917);this[_0xcb3b('0xb')][_0x54d62a['uniqueid']][_0x543917][_0xcb3b('0x12')]=!![];this[_0xcb3b('0xb')][_0x54d62a[_0xcb3b('0x24')]][_0x543917]['agentringnoanswerAt']=moment()[_0xcb3b('0x35')](_0xcb3b('0x28'));this[_0xcb3b('0xb')][_0x54d62a['uniqueid']][_0x543917][_0xcb3b('0x44')]=_0x54d62a[_0xcb3b('0x26')];this[_0xcb3b('0xb')][_0x54d62a[_0xcb3b('0x24')]][_0x543917][_0xcb3b('0x45')]=_0x54d62a[_0xcb3b('0x25')];this['channels'][_0x54d62a[_0xcb3b('0x24')]][_0x543917][_0xcb3b('0x3d')]=_0xcb3b('0x46');this['channels'][_0x54d62a[_0xcb3b('0x24')]][_0x543917]['reason']=_0xcb3b('0x46');logger['debug'](_0xcb3b('0x47'),_0x54d62a[_0xcb3b('0x24')],util['inspect'](this[_0xcb3b('0xb')][_0x54d62a[_0xcb3b('0x24')]][_0x543917],{'showHidden':![],'depth':null}));ami[_0xcb3b('0x1e')]('custom:agentansweredelsewhere',this['channels'][_0x54d62a[_0xcb3b('0x24')]][_0x543917]);}}}}}}catch(_0x33a77f){logger[_0xcb3b('0x36')](_0xcb3b('0x48'),_0x54d62a[_0xcb3b('0x24')],util[_0xcb3b('0x32')](_0x33a77f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcb3b('0x1d')][_0xcb3b('0x13')]=function(_0x207dfa){try{if(this[_0xcb3b('0x1f')](_0x207dfa)){logger[_0xcb3b('0x31')](_0xcb3b('0x49'),_0x207dfa[_0xcb3b('0x24')],util['inspect'](_0x207dfa,{'showHidden':![],'depth':null}));if(this[_0xcb3b('0xb')][_0x207dfa[_0xcb3b('0x24')]]&&this[_0xcb3b('0xb')][_0x207dfa[_0xcb3b('0x24')]][_0x207dfa[_0xcb3b('0x26')]]){logger[_0xcb3b('0x22')](_0xcb3b('0x4a'),_0x207dfa[_0xcb3b('0x24')],_0x207dfa[_0xcb3b('0x25')],_0x207dfa[_0xcb3b('0x26')]);this[_0xcb3b('0xb')][_0x207dfa[_0xcb3b('0x24')]][_0x207dfa[_0xcb3b('0x26')]]['agentringnoanswer']=!![];this[_0xcb3b('0xb')][_0x207dfa[_0xcb3b('0x24')]][_0x207dfa[_0xcb3b('0x26')]][_0xcb3b('0x4b')]=moment()[_0xcb3b('0x35')](_0xcb3b('0x28'));this[_0xcb3b('0xb')][_0x207dfa[_0xcb3b('0x24')]][_0x207dfa['destuniqueid']][_0xcb3b('0x3d')]='rejected';this[_0xcb3b('0xb')][_0x207dfa[_0xcb3b('0x24')]][_0x207dfa[_0xcb3b('0x26')]][_0xcb3b('0x4c')]=_0xcb3b('0x4d');logger['debug'](_0xcb3b('0x4e'),_0x207dfa['uniqueid'],util[_0xcb3b('0x32')](this[_0xcb3b('0xb')][_0x207dfa[_0xcb3b('0x24')]][_0x207dfa[_0xcb3b('0x26')]],{'showHidden':![],'depth':null}));ami[_0xcb3b('0x1e')](_0xcb3b('0x4f'),this[_0xcb3b('0xb')][_0x207dfa[_0xcb3b('0x24')]][_0x207dfa['destuniqueid']]);}}}catch(_0x31e30e){logger[_0xcb3b('0x36')](_0xcb3b('0x50'),_0x207dfa['uniqueid'],util[_0xcb3b('0x32')](_0x31e30e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcb3b('0x1d')][_0xcb3b('0x51')]=function(_0x2e0d39){try{if(this[_0xcb3b('0x1f')](_0x2e0d39)){logger[_0xcb3b('0x31')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x2e0d39[_0xcb3b('0x24')],util['inspect'](_0x2e0d39,{'showHidden':![],'depth':null}));if(this[_0xcb3b('0xb')][_0x2e0d39[_0xcb3b('0x24')]]){for(var _0x4c932e in this[_0xcb3b('0xb')][_0x2e0d39[_0xcb3b('0x24')]]){if(this[_0xcb3b('0xb')][_0x2e0d39['uniqueid']]['hasOwnProperty'](_0x4c932e)&&!this[_0xcb3b('0xb')][_0x2e0d39['uniqueid']][_0x4c932e][_0xcb3b('0x12')]&&!this[_0xcb3b('0xb')][_0x2e0d39[_0xcb3b('0x24')]][_0x4c932e][_0xcb3b('0x15')]){logger[_0xcb3b('0x22')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2e0d39[_0xcb3b('0x24')],this[_0xcb3b('0xb')][_0x2e0d39[_0xcb3b('0x24')]][_0x4c932e]['membername'],_0x4c932e);this[_0xcb3b('0xb')][_0x2e0d39[_0xcb3b('0x24')]][_0x4c932e][_0xcb3b('0x12')]=!![];this[_0xcb3b('0xb')][_0x2e0d39[_0xcb3b('0x24')]][_0x4c932e]['agentringnoanswerAt']=moment()[_0xcb3b('0x35')](_0xcb3b('0x28'));this[_0xcb3b('0xb')][_0x2e0d39['uniqueid']][_0x4c932e]['lastevent']=_0xcb3b('0x52');this[_0xcb3b('0xb')][_0x2e0d39['uniqueid']][_0x4c932e][_0xcb3b('0x4c')]=_0xcb3b('0x52');logger[_0xcb3b('0x31')](_0xcb3b('0x53'),_0x2e0d39[_0xcb3b('0x24')],util[_0xcb3b('0x32')](this[_0xcb3b('0xb')][_0x2e0d39[_0xcb3b('0x24')]][_0x4c932e],{'showHidden':![],'depth':null}));ami[_0xcb3b('0x1e')](_0xcb3b('0x54'),this[_0xcb3b('0xb')][_0x2e0d39[_0xcb3b('0x24')]][_0x4c932e]);}}}}}catch(_0xc308c6){logger['error'](_0xcb3b('0x55'),_0x2e0d39[_0xcb3b('0x24')],util[_0xcb3b('0x32')](_0xc308c6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcb3b('0x1d')]['syncAgentComplete']=function(_0x2f2fc6){try{if(this[_0xcb3b('0x1f')](_0x2f2fc6)){logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x2f2fc6[_0xcb3b('0x24')],util['inspect'](_0x2f2fc6,{'showHidden':![],'depth':null}));if(this[_0xcb3b('0xb')][_0x2f2fc6[_0xcb3b('0x24')]]){for(var _0x4ed5f7 in this[_0xcb3b('0xb')][_0x2f2fc6['uniqueid']]){if(this['channels'][_0x2f2fc6[_0xcb3b('0x24')]][_0xcb3b('0x56')](_0x4ed5f7)){if(this[_0xcb3b('0xb')][_0x2f2fc6[_0xcb3b('0x24')]][_0x4ed5f7]['agentconnectAt']&&!this[_0xcb3b('0xb')][_0x2f2fc6[_0xcb3b('0x24')]][_0x4ed5f7][_0xcb3b('0x15')]){logger[_0xcb3b('0x22')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2f2fc6[_0xcb3b('0x24')],this[_0xcb3b('0xb')][_0x2f2fc6[_0xcb3b('0x24')]][_0x4ed5f7]['membername'],_0x4ed5f7);this['channels'][_0x2f2fc6['uniqueid']][_0x4ed5f7][_0xcb3b('0x15')]=!![];this[_0xcb3b('0xb')][_0x2f2fc6[_0xcb3b('0x24')]][_0x4ed5f7][_0xcb3b('0x57')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xcb3b('0xb')][_0x2f2fc6[_0xcb3b('0x24')]][_0x4ed5f7][_0xcb3b('0x3d')]=_0xcb3b('0x58');this[_0xcb3b('0xb')][_0x2f2fc6[_0xcb3b('0x24')]][_0x4ed5f7]['reason']=_0x2f2fc6[_0xcb3b('0x4c')]==_0xcb3b('0x59')?_0xcb3b('0x5a'):_0x2f2fc6['reason'];this[_0xcb3b('0xb')][_0x2f2fc6['uniqueid']][_0x4ed5f7]['talktime']=_0x2f2fc6[_0xcb3b('0x5b')];if(this[_0xcb3b('0xc')][_0x2f2fc6['queue']]&&this[_0xcb3b('0xc')][_0x2f2fc6[_0xcb3b('0x2a')]][_0xcb3b('0x5c')]){this[_0xcb3b('0xb')][_0x2f2fc6[_0xcb3b('0x24')]][_0x4ed5f7]['acwtime']=this[_0xcb3b('0xc')][_0x2f2fc6[_0xcb3b('0x2a')]][_0xcb3b('0x5d')];this['channels'][_0x2f2fc6[_0xcb3b('0x24')]][_0x4ed5f7][_0xcb3b('0x5e')]=!![];}this[_0xcb3b('0xd')][_0x2f2fc6[_0xcb3b('0x5f')]]=_[_0xcb3b('0x2e')](this[_0xcb3b('0xd')][_0x2f2fc6[_0xcb3b('0x5f')]],[_0xcb3b('0x2a'),'destconnectedlinenum']);logger['debug'](_0xcb3b('0x60'),_0x2f2fc6[_0xcb3b('0x24')],util[_0xcb3b('0x32')](this[_0xcb3b('0xb')][_0x2f2fc6[_0xcb3b('0x24')]][_0x4ed5f7],{'showHidden':![],'depth':null}));ami[_0xcb3b('0x1e')](_0xcb3b('0x61'),this['channels'][_0x2f2fc6[_0xcb3b('0x24')]][_0x4ed5f7]);logger[_0xcb3b('0x31')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x2f2fc6[_0xcb3b('0x24')],util['inspect'](this['channels'][_0x2f2fc6['uniqueid']][_0x4ed5f7],{'showHidden':![],'depth':null}));this[_0xcb3b('0x1e')](util[_0xcb3b('0x35')](_0xcb3b('0x42'),_0x2f2fc6[_0xcb3b('0x25')]),_0xcb3b('0x62'),this[_0xcb3b('0xb')][_0x2f2fc6[_0xcb3b('0x24')]][_0x4ed5f7]);}}}}}}catch(_0x28f387){logger[_0xcb3b('0x36')](_0xcb3b('0x63'),_0x2f2fc6[_0xcb3b('0x24')],util[_0xcb3b('0x32')](_0x28f387,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcb3b('0x1d')][_0xcb3b('0x17')]=function(_0x3d1612){try{if(this['isNotNull'](_0x3d1612)){logger[_0xcb3b('0x31')](_0xcb3b('0x64'),_0x3d1612[_0xcb3b('0x24')],util['inspect'](_0x3d1612,{'showHidden':![],'depth':null}));this[_0xcb3b('0x65')](_0x3d1612['uniqueid'],_[_0xcb3b('0x66')](_0x3d1612[_0xcb3b('0x67')])[0x0],_0x3d1612['value']);if(this[_0xcb3b('0xb')][_0x3d1612['uniqueid']]){for(var _0x46e96c in this[_0xcb3b('0xb')][_0x3d1612[_0xcb3b('0x24')]]){if(this[_0xcb3b('0xb')][_0x3d1612[_0xcb3b('0x24')]][_0xcb3b('0x56')](_0x46e96c)){logger[_0xcb3b('0x22')](_0xcb3b('0x68'),_0x3d1612[_0xcb3b('0x24')],_0x46e96c,_[_0xcb3b('0x66')](_0x3d1612[_0xcb3b('0x67')])[0x0],_0x3d1612[_0xcb3b('0x69')]);if(_['isUndefined'](this[_0xcb3b('0xb')][_0x3d1612['uniqueid']][_0x46e96c][_0xcb3b('0xe')])){this[_0xcb3b('0xb')][_0x3d1612[_0xcb3b('0x24')]][_0x46e96c]['variables']={};}this[_0xcb3b('0xb')][_0x3d1612['uniqueid']][_0x46e96c]['variables']=this[_0xcb3b('0xe')][_0x3d1612[_0xcb3b('0x24')]];}}}}}catch(_0x3069bc){logger[_0xcb3b('0x36')](_0xcb3b('0x6a'),_0x3d1612[_0xcb3b('0x24')],util[_0xcb3b('0x32')](_0x3069bc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcb3b('0x1d')][_0xcb3b('0x65')]=function(_0x454f05,_0x4eb16c,_0xfbe012){var _0x2abc99=['rtpaudioqos',_0xcb3b('0x6b'),'rtpaudioqosjitter',_0xcb3b('0x6c'),_0xcb3b('0x6d'),_0xcb3b('0x6e'),'rtpaudioqosrtt',_0xcb3b('0x6f'),_0xcb3b('0x70'),_0xcb3b('0x71'),_0xcb3b('0x72'),'bridgepvtcallid','membercalls',_0xcb3b('0x73'),'memberinterface','memberlastcall',_0xcb3b('0x25'),_0xcb3b('0x74'),'memberrealtime'];if(!_[_0xcb3b('0x75')](_0x4eb16c)&&!_[_0xcb3b('0x76')](_0x2abc99,_0x4eb16c)){if(_[_0xcb3b('0x20')](this[_0xcb3b('0xe')][_0x454f05])){this[_0xcb3b('0xe')][_0x454f05]={};}this[_0xcb3b('0xe')][_0x454f05][_0x4eb16c]=_0xfbe012;}};VoiceAgentReport[_0xcb3b('0x1d')][_0xcb3b('0x18')]=function(_0x5c5cb5){try{if(this[_0xcb3b('0x1f')](_0x5c5cb5)){logger['debug'](_0xcb3b('0x77'),_0x5c5cb5[_0xcb3b('0x24')],util[_0xcb3b('0x32')](_0x5c5cb5,{'showHidden':![],'depth':null}));if(this[_0xcb3b('0xb')][_0x5c5cb5[_0xcb3b('0x24')]]){for(var _0x13d3b9 in this[_0xcb3b('0xb')][_0x5c5cb5[_0xcb3b('0x24')]]){if(this['channels'][_0x5c5cb5[_0xcb3b('0x24')]][_0xcb3b('0x56')](_0x13d3b9)){if(this[_0xcb3b('0xb')][_0x5c5cb5[_0xcb3b('0x24')]][_0x13d3b9]['reason']==_0xcb3b('0x59')&&this[_0xcb3b('0xb')][_0x5c5cb5[_0xcb3b('0x24')]][_0x13d3b9][_0xcb3b('0x15')]){logger['info'](_0xcb3b('0x78'),_0x5c5cb5[_0xcb3b('0x24')],_0x13d3b9);this[_0xcb3b('0xb')][_0x5c5cb5[_0xcb3b('0x24')]][_0x13d3b9][_0xcb3b('0x57')]=moment()[_0xcb3b('0x35')](_0xcb3b('0x28'));}}}logger[_0xcb3b('0x31')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x5c5cb5[_0xcb3b('0x24')],util[_0xcb3b('0x32')](_[_0xcb3b('0x79')](this[_0xcb3b('0xb')][_0x5c5cb5['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0xcb3b('0x1e')]('custom:voiceAgentReport',_[_0xcb3b('0x79')](this['channels'][_0x5c5cb5[_0xcb3b('0x24')]]));delete this['channels'][_0x5c5cb5[_0xcb3b('0x24')]];}if(this[_0xcb3b('0xe')][_0x5c5cb5[_0xcb3b('0x24')]]){delete this['variables'][_0x5c5cb5['uniqueid']];}}}catch(_0x34e2c5){logger[_0xcb3b('0x36')](_0xcb3b('0x7a'),_0x5c5cb5[_0xcb3b('0x24')],util[_0xcb3b('0x32')](_0x34e2c5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcb3b('0x1d')][_0xcb3b('0x7b')]=function(_0x3d6539){try{if(this[_0xcb3b('0x1f')](_0x3d6539)){logger[_0xcb3b('0x31')](_0xcb3b('0x7c'),_0x3d6539[_0xcb3b('0x24')],util[_0xcb3b('0x32')](_0x3d6539,{'showHidden':![],'depth':null}));if(this[_0xcb3b('0xb')][_0x3d6539[_0xcb3b('0x7d')]]){for(var _0x2d6d3d in this['channels'][_0x3d6539[_0xcb3b('0x7d')]]){if(this[_0xcb3b('0xb')][_0x3d6539[_0xcb3b('0x7d')]][_0xcb3b('0x56')](_0x2d6d3d)){if(_0x3d6539[_0xcb3b('0x7e')]===_0x2d6d3d){logger[_0xcb3b('0x22')](_0xcb3b('0x7f'),_0x3d6539[_0xcb3b('0x24')],this[_0xcb3b('0xb')][_0x3d6539[_0xcb3b('0x7d')]][_0x2d6d3d][_0xcb3b('0x25')],_0x2d6d3d);var _0x59ae87=moment();this[_0xcb3b('0xb')][_0x3d6539[_0xcb3b('0x7d')]][_0x2d6d3d][_0xcb3b('0x15')]=!![];this[_0xcb3b('0xb')][_0x3d6539[_0xcb3b('0x7d')]][_0x2d6d3d][_0xcb3b('0x57')]=moment()[_0xcb3b('0x35')](_0xcb3b('0x28'));this[_0xcb3b('0xb')][_0x3d6539[_0xcb3b('0x7d')]][_0x2d6d3d][_0xcb3b('0x3d')]='complete';this['channels'][_0x3d6539['transfereeuniqueid']][_0x2d6d3d][_0xcb3b('0x4c')]=_0xcb3b('0x59');this[_0xcb3b('0xb')][_0x3d6539[_0xcb3b('0x7d')]][_0x2d6d3d][_0xcb3b('0x5b')]=_0x59ae87[_0xcb3b('0x80')](this[_0xcb3b('0xb')][_0x3d6539[_0xcb3b('0x7d')]][_0x2d6d3d][_0xcb3b('0x81')],'seconds');}}}}if(this['channels'][_0x3d6539[_0xcb3b('0x82')]]){var _0x933230=this['channels'][_0x3d6539['secondtransfereruniqueid']];this[_0xcb3b('0xb')][_0x3d6539['secondtransfereruniqueid']]=this[_0xcb3b('0xb')][_0x3d6539['transfereeuniqueid']];this[_0xcb3b('0xb')][_0x3d6539[_0xcb3b('0x7d')]]=_0x933230;}}}catch(_0x336d67){logger[_0xcb3b('0x36')](_0xcb3b('0x83'),_0x3d6539[_0xcb3b('0x24')],util['inspect'](_0x336d67,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcb3b('0x1d')]['syncBlindTransfer']=function(_0x1077c4){try{if(this[_0xcb3b('0x1f')](_0x1077c4)){logger[_0xcb3b('0x31')]('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x1077c4['uniqueid'],util[_0xcb3b('0x32')](_0x1077c4,{'showHidden':![],'depth':null}));if(this['channels'][_0x1077c4[_0xcb3b('0x7d')]]){for(var _0x45fedf in this[_0xcb3b('0xb')][_0x1077c4['transfereeuniqueid']]){if(this[_0xcb3b('0xb')][_0x1077c4[_0xcb3b('0x7d')]][_0xcb3b('0x56')](_0x45fedf)){if(_0x1077c4[_0xcb3b('0x84')]===_0x45fedf){logger[_0xcb3b('0x22')](_0xcb3b('0x85'),_0x1077c4[_0xcb3b('0x24')],this[_0xcb3b('0xb')][_0x1077c4[_0xcb3b('0x7d')]][_0x45fedf]['membername'],_0x45fedf);var _0x4f4ffd=moment();this[_0xcb3b('0xb')][_0x1077c4['transfereeuniqueid']][_0x45fedf][_0xcb3b('0x15')]=!![];this['channels'][_0x1077c4[_0xcb3b('0x7d')]][_0x45fedf][_0xcb3b('0x57')]=_0x4f4ffd;this[_0xcb3b('0xb')][_0x1077c4[_0xcb3b('0x7d')]][_0x45fedf][_0xcb3b('0x3d')]=_0xcb3b('0x58');this['channels'][_0x1077c4['transfereeuniqueid']][_0x45fedf][_0xcb3b('0x4c')]=_0xcb3b('0x59');this['channels'][_0x1077c4['transfereeuniqueid']][_0x45fedf]['talktime']=_0x4f4ffd[_0xcb3b('0x80')](this[_0xcb3b('0xb')][_0x1077c4[_0xcb3b('0x7d')]][_0x45fedf][_0xcb3b('0x81')],_0xcb3b('0x86'));}}}}}}catch(_0x10b56f){logger[_0xcb3b('0x36')](_0xcb3b('0x87'),_0x1077c4[_0xcb3b('0x24')],util[_0xcb3b('0x32')](_0x10b56f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcb3b('0x1d')][_0xcb3b('0x88')]=function(_0x45202c){var _0x33c5e4='';try{if(this[_0xcb3b('0x1f')](_0x45202c)){logger[_0xcb3b('0x31')](_0xcb3b('0x89'),_0x45202c['uniqueid'],util[_0xcb3b('0x32')](_0x45202c,{'showHidden':![],'depth':null}));if(_0x45202c[_0xcb3b('0x8a')]){_0x33c5e4=_0x45202c[_0xcb3b('0x8a')]['substring'](0x0,_0x45202c['channel'][_0xcb3b('0x8b')]('-'));if(this[_0xcb3b('0xd')][_0x33c5e4]){logger[_0xcb3b('0x22')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x45202c['uniqueid'],_0x33c5e4);this[_0xcb3b('0xd')][_0x33c5e4][_0xcb3b('0x8c')]=!![];}}}}catch(_0x119602){logger['error'](_0xcb3b('0x8d'),_0x45202c[_0xcb3b('0x24')],util[_0xcb3b('0x32')](_0x119602,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcb3b('0x1d')][_0xcb3b('0x1a')]=function(_0x5e3c61){var _0x429abf='';try{if(this[_0xcb3b('0x1f')](_0x5e3c61)){logger[_0xcb3b('0x31')](_0xcb3b('0x8e'),_0x5e3c61[_0xcb3b('0x24')],util[_0xcb3b('0x32')](_0x5e3c61,{'showHidden':![],'depth':null}));if(_0x5e3c61[_0xcb3b('0x8a')]){_0x429abf=_0x5e3c61[_0xcb3b('0x8a')][_0xcb3b('0x8f')](0x0,_0x5e3c61[_0xcb3b('0x8a')]['lastIndexOf']('-'));if(this[_0xcb3b('0xd')][_0x429abf]){logger[_0xcb3b('0x22')](_0xcb3b('0x90'),_0x5e3c61['uniqueid'],_0x429abf);this[_0xcb3b('0xd')][_0x429abf]['onhold']=![];}}}}catch(_0xa6cbb){logger[_0xcb3b('0x36')](_0xcb3b('0x91'),_0x5e3c61['uniqueid'],util[_0xcb3b('0x32')](_0xa6cbb,{'showHidden':![],'depth':null}));}};module[_0xcb3b('0x92')]=VoiceAgentReport; \ No newline at end of file +var _0x9e43=['agentacw','interface','omit','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','syncBlindTransfer','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','../../../config/environment','ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncAgentComplete','varset','syncVarSet','syncHangup','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','prototype','emit','isNotNull','info','membername','debug','[%s][voiceAgentReport][agentcalled]\x20event:','uniqueid','inspect','isUndefined','destuniqueid','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','merge','event','privilege','custom:agentcalled','format','user:called','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:%s','user:agentconnect','agentcomplete','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','error','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%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:','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','acwTimeout'];(function(_0x213093,_0x2fcc60){var _0x3b2146=function(_0x4e93ce){while(--_0x4e93ce){_0x213093['push'](_0x213093['shift']());}};_0x3b2146(++_0x2fcc60);}(_0x9e43,0x1e1));var _0x39e4=function(_0x5f0c76,_0x44b266){_0x5f0c76=_0x5f0c76-0x0;var _0x308606=_0x9e43[_0x5f0c76];return _0x308606;};'use strict';var _=require(_0x39e4('0x0'));var moment=require('moment');var util=require('util');var Redis=require('ioredis');var config=require(_0x39e4('0x1'));var logger=require('../../../config/logger')(_0x39e4('0x2'));var ami=require('../ami');config[_0x39e4('0x3')]=_[_0x39e4('0x4')](config[_0x39e4('0x3')],{'host':_0x39e4('0x5'),'port':0x18eb});var io=require(_0x39e4('0x6'))(new Redis(config[_0x39e4('0x3')]));function VoiceAgentReport(_0x5123ec){this[_0x39e4('0x7')]={};this[_0x39e4('0x8')]=_0x5123ec['voiceQueues'];this[_0x39e4('0x9')]=_0x5123ec[_0x39e4('0x9')];this[_0x39e4('0xa')]={};ami['on'](_0x39e4('0xb'),this[_0x39e4('0xc')][_0x39e4('0xd')](this));ami['on'](_0x39e4('0xe'),this[_0x39e4('0xf')][_0x39e4('0xd')](this));ami['on'](_0x39e4('0x10'),this[_0x39e4('0x11')][_0x39e4('0xd')](this));ami['on'](_0x39e4('0x12'),this['syncQueueCallerAbandon'][_0x39e4('0xd')](this));ami['on']('agentcomplete',this[_0x39e4('0x13')][_0x39e4('0xd')](this));ami['on'](_0x39e4('0x14'),this[_0x39e4('0x15')]['bind'](this));ami['on']('hangup',this[_0x39e4('0x16')][_0x39e4('0xd')](this));ami['on'](_0x39e4('0x17'),this['syncMusicOnHoldStart'][_0x39e4('0xd')](this));ami['on'](_0x39e4('0x18'),this[_0x39e4('0x19')][_0x39e4('0xd')](this));ami['on'](_0x39e4('0x1a'),this[_0x39e4('0x1b')][_0x39e4('0xd')](this));ami['on'](_0x39e4('0x1c'),this['syncBlindTransfer'][_0x39e4('0xd')](this));}VoiceAgentReport[_0x39e4('0x1d')][_0x39e4('0x1e')]=function(_0x15abf9,_0x3c8754,_0x2cddd2){io['to'](_0x15abf9)[_0x39e4('0x1e')](_0x3c8754,_0x2cddd2);};VoiceAgentReport['prototype'][_0x39e4('0x1f')]=function(_0x3a2b14){return _0x3a2b14!==null&&!_['isUndefined'](_0x3a2b14);};VoiceAgentReport[_0x39e4('0x1d')][_0x39e4('0xc')]=function(_0x118a1a){try{if(this[_0x39e4('0x1f')](_0x118a1a)){logger[_0x39e4('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x118a1a['uniqueid'],_0x118a1a[_0x39e4('0x21')],_0x118a1a['destuniqueid']);logger[_0x39e4('0x22')](_0x39e4('0x23'),_0x118a1a[_0x39e4('0x24')],util[_0x39e4('0x25')](_0x118a1a,{'showHidden':![],'depth':null}));if(_[_0x39e4('0x26')](this[_0x39e4('0x7')][_0x118a1a[_0x39e4('0x24')]])){this[_0x39e4('0x7')][_0x118a1a[_0x39e4('0x24')]]={};}if(_[_0x39e4('0x26')](this['channels'][_0x118a1a['uniqueid']][_0x118a1a[_0x39e4('0x27')]])){this[_0x39e4('0x7')][_0x118a1a[_0x39e4('0x24')]][_0x118a1a[_0x39e4('0x27')]]={'agentcalledAt':moment()['format'](_0x39e4('0x28')),'lastevent':_0x39e4('0x29'),'mandatoryDisposition':this[_0x39e4('0x8')][_0x118a1a[_0x39e4('0x2a')]]?this['voiceQueues'][_0x118a1a['queue']]['mandatoryDisposition']||![]:![],'type':this[_0x39e4('0x8')][_0x118a1a['queue']]?this['voiceQueues'][_0x118a1a[_0x39e4('0x2a')]][_0x39e4('0x2b')]||_0x39e4('0x2c'):_0x39e4('0x2c'),'variables':this['variables'][_0x118a1a[_0x39e4('0x24')]]};}_[_0x39e4('0x2d')](this[_0x39e4('0x7')][_0x118a1a['uniqueid']][_0x118a1a['destuniqueid']],_['omit'](_0x118a1a,[_0x39e4('0x2e'),_0x39e4('0x2f')]));logger[_0x39e4('0x22')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x118a1a[_0x39e4('0x24')],util[_0x39e4('0x25')](this[_0x39e4('0x7')][_0x118a1a[_0x39e4('0x24')]][_0x118a1a[_0x39e4('0x27')]],{'showHidden':![],'depth':null}));ami['emit'](_0x39e4('0x30'),this['channels'][_0x118a1a['uniqueid']][_0x118a1a[_0x39e4('0x27')]]);logger[_0x39e4('0x22')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x118a1a['uniqueid'],util[_0x39e4('0x25')](this[_0x39e4('0x7')][_0x118a1a['uniqueid']][_0x118a1a[_0x39e4('0x27')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x39e4('0x31')]('user:%s',_0x118a1a[_0x39e4('0x21')]),_0x39e4('0x32'),this[_0x39e4('0x7')][_0x118a1a[_0x39e4('0x24')]][_0x118a1a[_0x39e4('0x27')]]);}}catch(_0x16ae48){logger['error']('[%s][voiceAgentReport][agentcalled]',_0x118a1a[_0x39e4('0x24')],util['inspect'](_0x16ae48,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x39e4('0x1d')][_0x39e4('0xf')]=function(_0x2ae3bd){try{if(this['isNotNull'](_0x2ae3bd)){if(this[_0x39e4('0x7')][_0x2ae3bd['uniqueid']]){logger[_0x39e4('0x22')]('[%s][voiceAgentReport][agentconnect]\x20event:',_0x2ae3bd[_0x39e4('0x24')],util[_0x39e4('0x25')](_0x2ae3bd,{'showHidden':![],'depth':null}));for(var _0x2d2d73 in this['channels'][_0x2ae3bd[_0x39e4('0x24')]]){if(this['channels'][_0x2ae3bd[_0x39e4('0x24')]][_0x39e4('0x33')](_0x2d2d73)){if(_0x2ae3bd[_0x39e4('0x27')]===_0x2d2d73){logger[_0x39e4('0x20')](_0x39e4('0x34'),_0x2ae3bd[_0x39e4('0x24')],_0x2ae3bd[_0x39e4('0x21')],_0x2ae3bd[_0x39e4('0x27')]);this[_0x39e4('0x7')][_0x2ae3bd[_0x39e4('0x24')]][_0x2d2d73][_0x39e4('0x35')]=moment()[_0x39e4('0x31')](_0x39e4('0x28'));this[_0x39e4('0x7')][_0x2ae3bd[_0x39e4('0x24')]][_0x2d2d73]['connectedlinename']=_0x2ae3bd['connectedlinename'];this['channels'][_0x2ae3bd[_0x39e4('0x24')]][_0x2d2d73][_0x39e4('0x36')]=_0x2ae3bd['connectedlinenum'];this['channels'][_0x2ae3bd['uniqueid']][_0x2d2d73][_0x39e4('0x37')]=_0x2ae3bd[_0x39e4('0x37')];this['channels'][_0x2ae3bd['uniqueid']][_0x2d2d73][_0x39e4('0x38')]=_0x2ae3bd[_0x39e4('0x38')];this[_0x39e4('0x7')][_0x2ae3bd[_0x39e4('0x24')]][_0x2d2d73][_0x39e4('0x39')]=_0x2ae3bd['holdtime'];this['channels'][_0x2ae3bd[_0x39e4('0x24')]][_0x2d2d73][_0x39e4('0x3a')]='connect';_[_0x39e4('0x2d')](this[_0x39e4('0x9')][_0x2ae3bd['interface']],_[_0x39e4('0x3b')](_0x2ae3bd,['queue',_0x39e4('0x3c')]));logger[_0x39e4('0x22')](_0x39e4('0x3d'),_0x2ae3bd['uniqueid'],util[_0x39e4('0x25')](this[_0x39e4('0x7')][_0x2ae3bd[_0x39e4('0x24')]][_0x2ae3bd[_0x39e4('0x27')]],{'showHidden':![],'depth':null}));ami[_0x39e4('0x1e')](_0x39e4('0x3e'),this[_0x39e4('0x7')][_0x2ae3bd[_0x39e4('0x24')]][_0x2ae3bd['destuniqueid']]);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x2ae3bd[_0x39e4('0x24')],util[_0x39e4('0x25')](this[_0x39e4('0x7')][_0x2ae3bd['uniqueid']][_0x2ae3bd[_0x39e4('0x27')]],{'showHidden':![],'depth':null}));this[_0x39e4('0x1e')](util[_0x39e4('0x31')](_0x39e4('0x3f'),_0x2ae3bd['membername']),_0x39e4('0x40'),this[_0x39e4('0x7')][_0x2ae3bd[_0x39e4('0x24')]][_0x2ae3bd[_0x39e4('0x27')]]);}else if(!this[_0x39e4('0x7')][_0x2ae3bd[_0x39e4('0x24')]][_0x2d2d73]['agentringnoanswer']&&!this[_0x39e4('0x7')][_0x2ae3bd[_0x39e4('0x24')]][_0x2d2d73][_0x39e4('0x41')]){logger[_0x39e4('0x20')](_0x39e4('0x42'),_0x2ae3bd[_0x39e4('0x24')],this[_0x39e4('0x7')][_0x2ae3bd['uniqueid']][_0x2d2d73][_0x39e4('0x21')],_0x2d2d73);this[_0x39e4('0x7')][_0x2ae3bd[_0x39e4('0x24')]][_0x2d2d73][_0x39e4('0x10')]=!![];this[_0x39e4('0x7')][_0x2ae3bd[_0x39e4('0x24')]][_0x2d2d73][_0x39e4('0x43')]=moment()[_0x39e4('0x31')](_0x39e4('0x28'));this[_0x39e4('0x7')][_0x2ae3bd[_0x39e4('0x24')]][_0x2d2d73][_0x39e4('0x44')]=_0x2ae3bd[_0x39e4('0x27')];this[_0x39e4('0x7')][_0x2ae3bd[_0x39e4('0x24')]][_0x2d2d73][_0x39e4('0x45')]=_0x2ae3bd['membername'];this[_0x39e4('0x7')][_0x2ae3bd[_0x39e4('0x24')]][_0x2d2d73][_0x39e4('0x3a')]=_0x39e4('0x46');this['channels'][_0x2ae3bd[_0x39e4('0x24')]][_0x2d2d73][_0x39e4('0x47')]='answered_elsewhere';logger[_0x39e4('0x22')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x2ae3bd[_0x39e4('0x24')],util[_0x39e4('0x25')](this[_0x39e4('0x7')][_0x2ae3bd[_0x39e4('0x24')]][_0x2d2d73],{'showHidden':![],'depth':null}));ami[_0x39e4('0x1e')]('custom:agentansweredelsewhere',this[_0x39e4('0x7')][_0x2ae3bd['uniqueid']][_0x2d2d73]);}}}}}}catch(_0x561c9c){logger['error'](_0x39e4('0x48'),_0x2ae3bd[_0x39e4('0x24')],util[_0x39e4('0x25')](_0x561c9c,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x39e4('0x11')]=function(_0xec7f55){try{if(this['isNotNull'](_0xec7f55)){logger[_0x39e4('0x22')](_0x39e4('0x49'),_0xec7f55['uniqueid'],util[_0x39e4('0x25')](_0xec7f55,{'showHidden':![],'depth':null}));if(this[_0x39e4('0x7')][_0xec7f55['uniqueid']]&&this[_0x39e4('0x7')][_0xec7f55[_0x39e4('0x24')]][_0xec7f55[_0x39e4('0x27')]]){logger['info'](_0x39e4('0x4a'),_0xec7f55[_0x39e4('0x24')],_0xec7f55['membername'],_0xec7f55['destuniqueid']);this[_0x39e4('0x7')][_0xec7f55[_0x39e4('0x24')]][_0xec7f55['destuniqueid']][_0x39e4('0x10')]=!![];this[_0x39e4('0x7')][_0xec7f55[_0x39e4('0x24')]][_0xec7f55[_0x39e4('0x27')]][_0x39e4('0x43')]=moment()[_0x39e4('0x31')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0xec7f55[_0x39e4('0x24')]][_0xec7f55[_0x39e4('0x27')]][_0x39e4('0x3a')]='rejected';this[_0x39e4('0x7')][_0xec7f55[_0x39e4('0x24')]][_0xec7f55[_0x39e4('0x27')]]['reason']=_0x39e4('0x4b');logger[_0x39e4('0x22')](_0x39e4('0x4c'),_0xec7f55[_0x39e4('0x24')],util[_0x39e4('0x25')](this['channels'][_0xec7f55['uniqueid']][_0xec7f55['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x39e4('0x1e')](_0x39e4('0x4d'),this['channels'][_0xec7f55[_0x39e4('0x24')]][_0xec7f55['destuniqueid']]);}}}catch(_0x121889){logger[_0x39e4('0x4e')](_0x39e4('0x4f'),_0xec7f55[_0x39e4('0x24')],util[_0x39e4('0x25')](_0x121889,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x39e4('0x50')]=function(_0x3f784c){try{if(this[_0x39e4('0x1f')](_0x3f784c)){logger[_0x39e4('0x22')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x3f784c[_0x39e4('0x24')],util['inspect'](_0x3f784c,{'showHidden':![],'depth':null}));if(this[_0x39e4('0x7')][_0x3f784c[_0x39e4('0x24')]]){for(var _0x3b00ac in this[_0x39e4('0x7')][_0x3f784c[_0x39e4('0x24')]]){if(this[_0x39e4('0x7')][_0x3f784c[_0x39e4('0x24')]]['hasOwnProperty'](_0x3b00ac)&&!this[_0x39e4('0x7')][_0x3f784c[_0x39e4('0x24')]][_0x3b00ac][_0x39e4('0x10')]&&!this[_0x39e4('0x7')][_0x3f784c[_0x39e4('0x24')]][_0x3b00ac][_0x39e4('0x41')]){logger[_0x39e4('0x20')](_0x39e4('0x51'),_0x3f784c['uniqueid'],this[_0x39e4('0x7')][_0x3f784c[_0x39e4('0x24')]][_0x3b00ac][_0x39e4('0x21')],_0x3b00ac);this[_0x39e4('0x7')][_0x3f784c['uniqueid']][_0x3b00ac][_0x39e4('0x10')]=!![];this[_0x39e4('0x7')][_0x3f784c[_0x39e4('0x24')]][_0x3b00ac][_0x39e4('0x43')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x39e4('0x7')][_0x3f784c[_0x39e4('0x24')]][_0x3b00ac]['lastevent']=_0x39e4('0x52');this[_0x39e4('0x7')][_0x3f784c[_0x39e4('0x24')]][_0x3b00ac][_0x39e4('0x47')]=_0x39e4('0x52');logger[_0x39e4('0x22')](_0x39e4('0x53'),_0x3f784c[_0x39e4('0x24')],util[_0x39e4('0x25')](this[_0x39e4('0x7')][_0x3f784c[_0x39e4('0x24')]][_0x3b00ac],{'showHidden':![],'depth':null}));ami[_0x39e4('0x1e')](_0x39e4('0x54'),this[_0x39e4('0x7')][_0x3f784c[_0x39e4('0x24')]][_0x3b00ac]);}}}}}catch(_0x11c51d){logger[_0x39e4('0x4e')](_0x39e4('0x55'),_0x3f784c[_0x39e4('0x24')],util[_0x39e4('0x25')](_0x11c51d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x39e4('0x1d')][_0x39e4('0x13')]=function(_0x4d9eca){try{if(this[_0x39e4('0x1f')](_0x4d9eca)){logger[_0x39e4('0x22')](_0x39e4('0x56'),_0x4d9eca['uniqueid'],util[_0x39e4('0x25')](_0x4d9eca,{'showHidden':![],'depth':null}));if(this['channels'][_0x4d9eca[_0x39e4('0x24')]]){for(var _0x414894 in this['channels'][_0x4d9eca[_0x39e4('0x24')]]){if(this['channels'][_0x4d9eca['uniqueid']][_0x39e4('0x33')](_0x414894)){if(this[_0x39e4('0x7')][_0x4d9eca['uniqueid']][_0x414894]['agentconnectAt']&&!this['channels'][_0x4d9eca[_0x39e4('0x24')]][_0x414894][_0x39e4('0x41')]){logger[_0x39e4('0x20')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x4d9eca[_0x39e4('0x24')],this[_0x39e4('0x7')][_0x4d9eca[_0x39e4('0x24')]][_0x414894][_0x39e4('0x21')],_0x414894);this[_0x39e4('0x7')][_0x4d9eca[_0x39e4('0x24')]][_0x414894][_0x39e4('0x41')]=!![];this[_0x39e4('0x7')][_0x4d9eca[_0x39e4('0x24')]][_0x414894][_0x39e4('0x57')]=moment()[_0x39e4('0x31')](_0x39e4('0x28'));this[_0x39e4('0x7')][_0x4d9eca[_0x39e4('0x24')]][_0x414894][_0x39e4('0x3a')]=_0x39e4('0x58');this[_0x39e4('0x7')][_0x4d9eca['uniqueid']][_0x414894][_0x39e4('0x47')]=_0x4d9eca[_0x39e4('0x47')]==_0x39e4('0x59')?_0x39e4('0x5a'):_0x4d9eca['reason'];this[_0x39e4('0x7')][_0x4d9eca[_0x39e4('0x24')]][_0x414894][_0x39e4('0x5b')]=_0x4d9eca[_0x39e4('0x5b')];if(this[_0x39e4('0x8')][_0x4d9eca[_0x39e4('0x2a')]]&&this[_0x39e4('0x8')][_0x4d9eca[_0x39e4('0x2a')]][_0x39e4('0x5c')]){this[_0x39e4('0x7')][_0x4d9eca['uniqueid']][_0x414894][_0x39e4('0x5d')]=this['voiceQueues'][_0x4d9eca[_0x39e4('0x2a')]][_0x39e4('0x5e')];this[_0x39e4('0x7')][_0x4d9eca['uniqueid']][_0x414894][_0x39e4('0x5f')]=!![];}this['agents'][_0x4d9eca[_0x39e4('0x60')]]=_[_0x39e4('0x61')](this['agents'][_0x4d9eca['interface']],[_0x39e4('0x2a'),_0x39e4('0x3c')]);logger[_0x39e4('0x22')](_0x39e4('0x62'),_0x4d9eca[_0x39e4('0x24')],util[_0x39e4('0x25')](this['channels'][_0x4d9eca['uniqueid']][_0x414894],{'showHidden':![],'depth':null}));ami[_0x39e4('0x1e')](_0x39e4('0x63'),this[_0x39e4('0x7')][_0x4d9eca[_0x39e4('0x24')]][_0x414894]);logger[_0x39e4('0x22')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x4d9eca[_0x39e4('0x24')],util['inspect'](this['channels'][_0x4d9eca['uniqueid']][_0x414894],{'showHidden':![],'depth':null}));this[_0x39e4('0x1e')](util[_0x39e4('0x31')](_0x39e4('0x3f'),_0x4d9eca['membername']),_0x39e4('0x64'),this['channels'][_0x4d9eca[_0x39e4('0x24')]][_0x414894]);}}}}}}catch(_0x3310d8){logger[_0x39e4('0x4e')]('[%s][voiceAgentReport][agentcomplete]',_0x4d9eca['uniqueid'],util['inspect'](_0x3310d8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x39e4('0x1d')]['syncVarSet']=function(_0x4e6edf){try{if(this[_0x39e4('0x1f')](_0x4e6edf)){logger[_0x39e4('0x22')](_0x39e4('0x65'),_0x4e6edf[_0x39e4('0x24')],util['inspect'](_0x4e6edf,{'showHidden':![],'depth':null}));this[_0x39e4('0x66')](_0x4e6edf[_0x39e4('0x24')],_[_0x39e4('0x67')](_0x4e6edf[_0x39e4('0x68')])[0x0],_0x4e6edf[_0x39e4('0x69')]);if(this['channels'][_0x4e6edf[_0x39e4('0x24')]]){for(var _0x4d0e91 in this[_0x39e4('0x7')][_0x4e6edf[_0x39e4('0x24')]]){if(this[_0x39e4('0x7')][_0x4e6edf[_0x39e4('0x24')]][_0x39e4('0x33')](_0x4d0e91)){logger[_0x39e4('0x20')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x4e6edf['uniqueid'],_0x4d0e91,_[_0x39e4('0x67')](_0x4e6edf[_0x39e4('0x68')])[0x0],_0x4e6edf['value']);if(_[_0x39e4('0x26')](this[_0x39e4('0x7')][_0x4e6edf['uniqueid']][_0x4d0e91][_0x39e4('0xa')])){this[_0x39e4('0x7')][_0x4e6edf[_0x39e4('0x24')]][_0x4d0e91][_0x39e4('0xa')]={};}this['channels'][_0x4e6edf[_0x39e4('0x24')]][_0x4d0e91][_0x39e4('0xa')]=this[_0x39e4('0xa')][_0x4e6edf['uniqueid']];}}}}}catch(_0x182831){logger['error'](_0x39e4('0x6a'),_0x4e6edf[_0x39e4('0x24')],util[_0x39e4('0x25')](_0x182831,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x39e4('0x1d')]['addVariable']=function(_0x204a1b,_0x1fb200,_0x35f061){var _0x21dba3=['rtpaudioqos','rtpaudioqosbridged',_0x39e4('0x6b'),'rtpaudioqosjitterbridged',_0x39e4('0x6c'),_0x39e4('0x6d'),_0x39e4('0x6e'),_0x39e4('0x6f'),'sipcallid','sipuri',_0x39e4('0x70'),_0x39e4('0x71'),_0x39e4('0x72'),_0x39e4('0x73'),_0x39e4('0x74'),'memberlastcall',_0x39e4('0x21'),_0x39e4('0x75'),_0x39e4('0x76')];if(!_[_0x39e4('0x77')](_0x1fb200)&&!_[_0x39e4('0x78')](_0x21dba3,_0x1fb200)){if(_[_0x39e4('0x26')](this[_0x39e4('0xa')][_0x204a1b])){this[_0x39e4('0xa')][_0x204a1b]={};}this[_0x39e4('0xa')][_0x204a1b][_0x1fb200]=_0x35f061;}};VoiceAgentReport[_0x39e4('0x1d')][_0x39e4('0x16')]=function(_0x578113){try{if(this['isNotNull'](_0x578113)){logger['debug'](_0x39e4('0x79'),_0x578113[_0x39e4('0x24')],util['inspect'](_0x578113,{'showHidden':![],'depth':null}));if(this[_0x39e4('0x7')][_0x578113[_0x39e4('0x24')]]){for(var _0x1c53b1 in this[_0x39e4('0x7')][_0x578113['uniqueid']]){if(this[_0x39e4('0x7')][_0x578113['uniqueid']][_0x39e4('0x33')](_0x1c53b1)){if(this[_0x39e4('0x7')][_0x578113[_0x39e4('0x24')]][_0x1c53b1][_0x39e4('0x47')]=='transfer'&&this[_0x39e4('0x7')][_0x578113[_0x39e4('0x24')]][_0x1c53b1][_0x39e4('0x41')]){logger['info'](_0x39e4('0x7a'),_0x578113['uniqueid'],_0x1c53b1);this['channels'][_0x578113['uniqueid']][_0x1c53b1][_0x39e4('0x57')]=moment()[_0x39e4('0x31')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x39e4('0x22')](_0x39e4('0x7b'),_0x578113[_0x39e4('0x24')],util[_0x39e4('0x25')](_[_0x39e4('0x7c')](this[_0x39e4('0x7')][_0x578113[_0x39e4('0x24')]]),{'showHidden':![],'depth':null}));ami[_0x39e4('0x1e')]('custom:voiceAgentReport',_[_0x39e4('0x7c')](this[_0x39e4('0x7')][_0x578113[_0x39e4('0x24')]]));delete this['channels'][_0x578113[_0x39e4('0x24')]];}if(this[_0x39e4('0xa')][_0x578113[_0x39e4('0x24')]]){delete this[_0x39e4('0xa')][_0x578113[_0x39e4('0x24')]];}}}catch(_0x157423){logger['error']('[%s][voiceAgentReport][hangup]',_0x578113[_0x39e4('0x24')],util['inspect'](_0x157423,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x39e4('0x1d')][_0x39e4('0x1b')]=function(_0x58c3a0){try{if(this[_0x39e4('0x1f')](_0x58c3a0)){logger[_0x39e4('0x22')](_0x39e4('0x7d'),_0x58c3a0[_0x39e4('0x24')],util[_0x39e4('0x25')](_0x58c3a0,{'showHidden':![],'depth':null}));if(this[_0x39e4('0x7')][_0x58c3a0[_0x39e4('0x7e')]]){for(var _0x3d02e0 in this[_0x39e4('0x7')][_0x58c3a0[_0x39e4('0x7e')]]){if(this['channels'][_0x58c3a0[_0x39e4('0x7e')]][_0x39e4('0x33')](_0x3d02e0)){if(_0x58c3a0[_0x39e4('0x7f')]===_0x3d02e0){logger[_0x39e4('0x20')](_0x39e4('0x80'),_0x58c3a0[_0x39e4('0x24')],this[_0x39e4('0x7')][_0x58c3a0[_0x39e4('0x7e')]][_0x3d02e0][_0x39e4('0x21')],_0x3d02e0);var _0x32abdb=moment();this[_0x39e4('0x7')][_0x58c3a0[_0x39e4('0x7e')]][_0x3d02e0][_0x39e4('0x41')]=!![];this['channels'][_0x58c3a0['transfereeuniqueid']][_0x3d02e0][_0x39e4('0x57')]=moment()[_0x39e4('0x31')](_0x39e4('0x28'));this[_0x39e4('0x7')][_0x58c3a0[_0x39e4('0x7e')]][_0x3d02e0][_0x39e4('0x3a')]=_0x39e4('0x58');this[_0x39e4('0x7')][_0x58c3a0[_0x39e4('0x7e')]][_0x3d02e0][_0x39e4('0x47')]='transfer';this[_0x39e4('0x7')][_0x58c3a0[_0x39e4('0x7e')]][_0x3d02e0]['talktime']=_0x32abdb[_0x39e4('0x81')](this[_0x39e4('0x7')][_0x58c3a0[_0x39e4('0x7e')]][_0x3d02e0]['agentconnectAt'],_0x39e4('0x82'));}}}}if(this[_0x39e4('0x7')][_0x58c3a0[_0x39e4('0x83')]]){var _0x156c91=this[_0x39e4('0x7')][_0x58c3a0[_0x39e4('0x83')]];this['channels'][_0x58c3a0[_0x39e4('0x83')]]=this[_0x39e4('0x7')][_0x58c3a0[_0x39e4('0x7e')]];this[_0x39e4('0x7')][_0x58c3a0[_0x39e4('0x7e')]]=_0x156c91;}}}catch(_0x213ccb){logger[_0x39e4('0x4e')]('[%s][voiceAgentReport][attendedtransfer]',_0x58c3a0[_0x39e4('0x24')],util[_0x39e4('0x25')](_0x213ccb,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x39e4('0x1d')][_0x39e4('0x84')]=function(_0x5b4ffa){try{if(this[_0x39e4('0x1f')](_0x5b4ffa)){logger[_0x39e4('0x22')](_0x39e4('0x85'),_0x5b4ffa[_0x39e4('0x24')],util['inspect'](_0x5b4ffa,{'showHidden':![],'depth':null}));if(this[_0x39e4('0x7')][_0x5b4ffa[_0x39e4('0x7e')]]){for(var _0x15df2f in this['channels'][_0x5b4ffa[_0x39e4('0x7e')]]){if(this['channels'][_0x5b4ffa[_0x39e4('0x7e')]][_0x39e4('0x33')](_0x15df2f)){if(_0x5b4ffa['transfereruniqueid']===_0x15df2f){logger['info'](_0x39e4('0x86'),_0x5b4ffa[_0x39e4('0x24')],this[_0x39e4('0x7')][_0x5b4ffa[_0x39e4('0x7e')]][_0x15df2f][_0x39e4('0x21')],_0x15df2f);var _0x5b5c15=moment();this['channels'][_0x5b4ffa['transfereeuniqueid']][_0x15df2f][_0x39e4('0x41')]=!![];this['channels'][_0x5b4ffa[_0x39e4('0x7e')]][_0x15df2f][_0x39e4('0x57')]=_0x5b5c15;this[_0x39e4('0x7')][_0x5b4ffa[_0x39e4('0x7e')]][_0x15df2f][_0x39e4('0x3a')]='complete';this['channels'][_0x5b4ffa[_0x39e4('0x7e')]][_0x15df2f][_0x39e4('0x47')]=_0x39e4('0x59');this['channels'][_0x5b4ffa[_0x39e4('0x7e')]][_0x15df2f][_0x39e4('0x5b')]=_0x5b5c15[_0x39e4('0x81')](this['channels'][_0x5b4ffa[_0x39e4('0x7e')]][_0x15df2f][_0x39e4('0x35')],_0x39e4('0x82'));}}}}}}catch(_0x2aef02){logger[_0x39e4('0x4e')](_0x39e4('0x87'),_0x5b4ffa[_0x39e4('0x24')],util[_0x39e4('0x25')](_0x2aef02,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x39e4('0x88')]=function(_0x45f236){var _0x45e32d='';try{if(this[_0x39e4('0x1f')](_0x45f236)){logger[_0x39e4('0x22')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x45f236['uniqueid'],util[_0x39e4('0x25')](_0x45f236,{'showHidden':![],'depth':null}));if(_0x45f236[_0x39e4('0x89')]){_0x45e32d=_0x45f236[_0x39e4('0x89')][_0x39e4('0x8a')](0x0,_0x45f236['channel'][_0x39e4('0x8b')]('-'));if(this['agents'][_0x45e32d]){logger[_0x39e4('0x20')](_0x39e4('0x8c'),_0x45f236[_0x39e4('0x24')],_0x45e32d);this[_0x39e4('0x9')][_0x45e32d]['onhold']=!![];}}}}catch(_0x2a7a0e){logger[_0x39e4('0x4e')]('[%s][voiceAgentReport][musiconholdstart]',_0x45f236['uniqueid'],util[_0x39e4('0x25')](_0x2a7a0e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x39e4('0x19')]=function(_0x542309){var _0x57dc54='';try{if(this[_0x39e4('0x1f')](_0x542309)){logger[_0x39e4('0x22')](_0x39e4('0x8d'),_0x542309['uniqueid'],util['inspect'](_0x542309,{'showHidden':![],'depth':null}));if(_0x542309['channel']){_0x57dc54=_0x542309['channel'][_0x39e4('0x8a')](0x0,_0x542309[_0x39e4('0x89')]['lastIndexOf']('-'));if(this[_0x39e4('0x9')][_0x57dc54]){logger[_0x39e4('0x20')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x542309[_0x39e4('0x24')],_0x57dc54);this[_0x39e4('0x9')][_0x57dc54]['onhold']=![];}}}}catch(_0x2fa366){logger[_0x39e4('0x4e')](_0x39e4('0x8e'),_0x542309['uniqueid'],util[_0x39e4('0x25')](_0x2fa366,{'showHidden':![],'depth':null}));}};module[_0x39e4('0x8f')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index fb68c66..e4855ab 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 _0xb032=['starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','from-sip','split','agents','channel','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','includes','lastapplication','lastdata','startsWith','cdr(','match','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','xcally-motion-preview','connectedlinenum','destinationchannel','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','monitorFilename','monitors','push','rec','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','[%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','originatecalleridnum','xmd-destination','xmd-callerid-preview','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','diff','billableseconds','omit','user:agentcomplete','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','exports','lodash','moment','path','ioredis','../../../config/environment','../../../config/logger','../model/channel','unknown','not_inuse','inuse','busy','invalid','ringing','ringinuse','set','queue','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','redis','defaults','localhost','socket.io-emitter','channels','blindTransfers','coreshowchannel','bind','newexten','syncNewExten','newchannel','syncNewChannel','newstate','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','musiconholdstop','[voiceCallReport][coreshowchannels]\x20started','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','info','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','[%s][voiceCallReport][newcallerid]','debug','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','context','exten'];(function(_0x3e3a7e,_0xde5148){var _0x310739=function(_0x2dd325){while(--_0x2dd325){_0x3e3a7e['push'](_0x3e3a7e['shift']());}};_0x310739(++_0xde5148);}(_0xb032,0x75));var _0x2b03=function(_0x20d435,_0x1c5415){_0x20d435=_0x20d435-0x0;var _0x54288d=_0xb032[_0x20d435];return _0x54288d;};'use strict';var BPromise=require('bluebird');var _=require(_0x2b03('0x0'));var moment=require(_0x2b03('0x1'));var util=require('util');var path=require(_0x2b03('0x2'));var Redis=require(_0x2b03('0x3'));var config=require(_0x2b03('0x4'));var logger=require(_0x2b03('0x5'))('ami');var ami=require('../ami');var Channel=require(_0x2b03('0x6'));var statusDesc=[_0x2b03('0x7'),_0x2b03('0x8'),_0x2b03('0x9'),_0x2b03('0xa'),_0x2b03('0xb'),'unavailable',_0x2b03('0xc'),_0x2b03('0xd'),'onhold'];var applications=[_0x2b03('0xe'),_0x2b03('0xf'),'agi',_0x2b03('0x10'),_0x2b03('0x11'),_0x2b03('0x12')];var dispositions=[_0x2b03('0x13'),_0x2b03('0x14'),_0x2b03('0x14'),_0x2b03('0x13'),'NO\x20ANSWER',_0x2b03('0x13'),_0x2b03('0x15'),'BUSY','FAILED',_0x2b03('0x14'),_0x2b03('0x14')];var actions={};config[_0x2b03('0x16')]=_[_0x2b03('0x17')](config['redis'],{'host':_0x2b03('0x18'),'port':0x18eb});var io=require(_0x2b03('0x19'))(new Redis(config[_0x2b03('0x16')]));function VoiceCallReport(_0x2d1547){this['channels']=_0x2d1547[_0x2b03('0x1a')];this['agents']=_0x2d1547['agents'];this[_0x2b03('0x1b')]={};ami['on'](_0x2b03('0x1c'),this['syncNewExten'][_0x2b03('0x1d')](this));ami['on'](_0x2b03('0x1e'),this[_0x2b03('0x1f')]['bind'](this));ami['on'](_0x2b03('0x20'),this[_0x2b03('0x21')][_0x2b03('0x1d')](this));ami['on'](_0x2b03('0x22'),this['syncNewState']['bind'](this));ami['on'](_0x2b03('0x23'),this[_0x2b03('0x24')][_0x2b03('0x1d')](this));ami['on'](_0x2b03('0x25'),this[_0x2b03('0x26')][_0x2b03('0x1d')](this));ami['on'](_0x2b03('0x27'),this[_0x2b03('0x28')]['bind'](this));ami['on'](_0x2b03('0x29'),this[_0x2b03('0x2a')][_0x2b03('0x1d')](this));ami['on'](_0x2b03('0x2b'),this[_0x2b03('0x2c')][_0x2b03('0x1d')](this));ami['on']('musiconholdstart',this[_0x2b03('0x2d')][_0x2b03('0x1d')](this));ami['on'](_0x2b03('0x2e'),this['syncMusicOnHoldStop'][_0x2b03('0x1d')](this));try{logger['info'](_0x2b03('0x2f'));ami['actionCoreShowChannels']();}catch(_0x25da94){logger[_0x2b03('0x30')](_0x2b03('0x31'),util[_0x2b03('0x32')](_0x25da94,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x2b03('0x33')][_0x2b03('0x34')]=function(_0x10d945){return _0x10d945!==null&&!_[_0x2b03('0x35')](_0x10d945);};VoiceCallReport[_0x2b03('0x33')][_0x2b03('0x36')]=function(_0x39811f,_0x4f96a0,_0xe9b557){io['to'](_0x39811f)[_0x2b03('0x36')](_0x4f96a0,_0xe9b557);};VoiceCallReport[_0x2b03('0x33')][_0x2b03('0x28')]=function(_0xe2cdb6){try{if(this[_0x2b03('0x34')](_0xe2cdb6)){logger[_0x2b03('0x37')](_0x2b03('0x38'),_0xe2cdb6[_0x2b03('0x39')],_0xe2cdb6[_0x2b03('0x3a')],_0xe2cdb6[_0x2b03('0x3b')]);logger['debug'](_0x2b03('0x3c'),_0xe2cdb6[_0x2b03('0x39')],util['inspect'](_0xe2cdb6,{'showHidden':![],'depth':null}));if(_0xe2cdb6['uniqueid']===_0xe2cdb6[_0x2b03('0x3d')]){if(!_[_0x2b03('0x35')](this[_0x2b03('0x1a')][_0xe2cdb6[_0x2b03('0x39')]])){_[_0x2b03('0x3e')](this[_0x2b03('0x1a')][_0xe2cdb6[_0x2b03('0x39')]],_[_0x2b03('0x3f')](_0xe2cdb6,_[_0x2b03('0x40')](this[_0x2b03('0x1a')][_0xe2cdb6[_0x2b03('0x39')]])));}}}}catch(_0x41a846){logger[_0x2b03('0x30')](_0x2b03('0x41'),_0xe2cdb6[_0x2b03('0x39')],util[_0x2b03('0x32')](_0x41a846,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2b03('0x33')][_0x2b03('0x21')]=function(_0x151b57){try{if(this[_0x2b03('0x34')](_0x151b57)){logger[_0x2b03('0x42')](_0x2b03('0x43'),_0x151b57['uniqueid'],util[_0x2b03('0x32')](_0x151b57,{'showHidden':![],'depth':null}));if(_0x151b57['uniqueid']===_0x151b57[_0x2b03('0x3d')]&&_0x151b57['channel']!=_0x2b03('0x44')){if(_[_0x2b03('0x35')](this['channels'][_0x151b57[_0x2b03('0x39')]])){logger[_0x2b03('0x37')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x151b57[_0x2b03('0x39')],_0x151b57[_0x2b03('0x45')],_0x151b57[_0x2b03('0x46')]);this[_0x2b03('0x1a')][_0x151b57[_0x2b03('0x39')]]=new Channel();this['channels'][_0x151b57[_0x2b03('0x39')]][_0x2b03('0x47')]=moment()[_0x2b03('0x48')](_0x2b03('0x49'));this[_0x2b03('0x1a')][_0x151b57[_0x2b03('0x39')]][_0x2b03('0x4a')]=dispositions[_[_0x2b03('0x4b')](_0x151b57[_0x2b03('0x4c')])];_[_0x2b03('0x3e')](this[_0x2b03('0x1a')][_0x151b57[_0x2b03('0x39')]],_['pick'](_0x151b57,_[_0x2b03('0x40')](this[_0x2b03('0x1a')][_0x151b57[_0x2b03('0x39')]])));if(_0x151b57[_0x2b03('0x45')]===_0x2b03('0x4d')){if(this['agents'][_0x151b57['channel'][_0x2b03('0x4e')]('-')[0x0]]){this[_0x2b03('0x4f')][_0x151b57[_0x2b03('0x50')][_0x2b03('0x4e')]('-')[0x0]][_0x2b03('0x51')]=_0x151b57['exten'];logger[_0x2b03('0x42')](_0x2b03('0x52'),_0x151b57[_0x2b03('0x39')],util[_0x2b03('0x32')]({'destaccountcode':this[_0x2b03('0x4f')][_0x151b57[_0x2b03('0x50')][_0x2b03('0x4e')]('-')[0x0]][_0x2b03('0x53')],'destconnectedlinenum':_0x151b57[_0x2b03('0x46')]},{'showHidden':![],'depth':null}));this[_0x2b03('0x36')](util[_0x2b03('0x48')](_0x2b03('0x54'),this[_0x2b03('0x4f')][_0x151b57[_0x2b03('0x50')][_0x2b03('0x4e')]('-')[0x0]][_0x2b03('0x55')]),_0x2b03('0x56'),{'destaccountcode':this['agents'][_0x151b57[_0x2b03('0x50')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x151b57['exten']});}}}}}}catch(_0xed9602){logger['error'](_0x2b03('0x57'),_0x151b57[_0x2b03('0x39')],util[_0x2b03('0x32')](_0xed9602,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2b03('0x33')][_0x2b03('0x1f')]=function(_0x56480c){try{if(this['isNotNull'](_0x56480c)){logger[_0x2b03('0x42')]('[%s][voiceCallReport][newexten]\x20event:',_0x56480c[_0x2b03('0x39')],util[_0x2b03('0x32')](_0x56480c,{'showHidden':![],'depth':null}));if(_0x56480c[_0x2b03('0x39')]===_0x56480c[_0x2b03('0x3d')]&&_0x56480c[_0x2b03('0x46')]!='h'&&_0x56480c[_0x2b03('0x50')]!='OutgoingSpoolFailed'){_0x56480c[_0x2b03('0x58')]=_0x56480c[_0x2b03('0x58')][_0x2b03('0x59')]();_0x56480c[_0x2b03('0x5a')]=(_0x56480c[_0x2b03('0x5b')]||_0x56480c[_0x2b03('0x5a')])[_0x2b03('0x59')]();logger[_0x2b03('0x37')](_0x2b03('0x5c'),_0x56480c['uniqueid'],_0x56480c['application'],_0x56480c[_0x2b03('0x5a')]);if(_['isUndefined'](this['channels'][_0x56480c['uniqueid']])){this[_0x2b03('0x1a')][_0x56480c[_0x2b03('0x39')]]=new Channel();this[_0x2b03('0x1a')][_0x56480c[_0x2b03('0x39')]][_0x2b03('0x47')]=_0x56480c[_0x2b03('0x5d')]?moment()['subtract'](moment[_0x2b03('0x5d')](_0x56480c[_0x2b03('0x5d')])[_0x2b03('0x5e')](),_0x2b03('0x5e'))[_0x2b03('0x48')](_0x2b03('0x49')):moment()[_0x2b03('0x48')](_0x2b03('0x49'));this['channels'][_0x56480c[_0x2b03('0x39')]][_0x2b03('0x4a')]=_0x2b03('0x13');}_[_0x2b03('0x3e')](this['channels'][_0x56480c['uniqueid']],_[_0x2b03('0x3f')](_0x56480c,_[_0x2b03('0x40')](this[_0x2b03('0x1a')][_0x56480c['uniqueid']])));if(_[_0x2b03('0x5f')](applications,_0x56480c[_0x2b03('0x58')])){this[_0x2b03('0x1a')][_0x56480c[_0x2b03('0x39')]][_0x2b03('0x60')]=_0x56480c['application'];this[_0x2b03('0x1a')][_0x56480c[_0x2b03('0x39')]][_0x2b03('0x61')]=_0x56480c['applicationdata'];if(_0x56480c['application']===_0x2b03('0xe')&&_[_0x2b03('0x62')](_0x56480c['applicationdata'],_0x2b03('0x63'))){var _0x342b07=_0x56480c['applicationdata']['split']('=');var _0x5b4e34=_0x342b07[0x0][_0x2b03('0x64')](/cdr\((.*)\)/);if(_0x5b4e34){this[_0x2b03('0x1a')][_0x56480c[_0x2b03('0x39')]][_0x5b4e34[0x1]]=_0x342b07[0x1];}}else if(_0x56480c[_0x2b03('0x58')]===_0x2b03('0xf')){this[_0x2b03('0x1a')][_0x56480c['uniqueid']][_0x2b03('0xf')]=_0x56480c[_0x2b03('0x5a')][_0x2b03('0x4e')](',')[0x0];}}}}}catch(_0x52a43f){logger['error'](_0x2b03('0x65'),_0x56480c[_0x2b03('0x39')],util['inspect'](_0x52a43f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2b03('0x33')][_0x2b03('0x66')]=function(_0x66775e){try{if(this[_0x2b03('0x34')](_0x66775e)){logger['info'](_0x2b03('0x67'),_0x66775e[_0x2b03('0x39')],_0x66775e[_0x2b03('0x3d')],_0x66775e[_0x2b03('0x3a')],_0x66775e[_0x2b03('0x3b')]);logger['debug'](_0x2b03('0x68'),_0x66775e['uniqueid'],util[_0x2b03('0x32')](_0x66775e,{'showHidden':![],'depth':null}));if(_0x66775e['uniqueid']!==_0x66775e['linkedid']){if(this[_0x2b03('0x1a')][_0x66775e[_0x2b03('0x3d')]]){if(_0x66775e[_0x2b03('0x4c')]==='6'){if(!this[_0x2b03('0x1a')][_0x66775e[_0x2b03('0x3d')]][_0x2b03('0x69')]){var _0x469141=moment();this['channels'][_0x66775e[_0x2b03('0x3d')]][_0x2b03('0x69')]=!![];this[_0x2b03('0x1a')][_0x66775e[_0x2b03('0x3d')]][_0x2b03('0x6a')]=_0x469141[_0x2b03('0x48')](_0x2b03('0x49'));if(this['channels'][_0x66775e[_0x2b03('0x3d')]][_0x2b03('0x47')]){this[_0x2b03('0x1a')][_0x66775e[_0x2b03('0x3d')]][_0x2b03('0x6b')]=_0x469141['diff'](this[_0x2b03('0x1a')][_0x66775e[_0x2b03('0x3d')]][_0x2b03('0x47')],_0x2b03('0x5e'));}}this['channels'][_0x66775e[_0x2b03('0x3d')]][_0x2b03('0x3d')]=_0x66775e[_0x2b03('0x39')];if(_0x66775e[_0x2b03('0x3b')]!==_0x2b03('0x6c')){this['channels'][_0x66775e[_0x2b03('0x3d')]][_0x2b03('0x6d')]=_0x66775e[_0x2b03('0x3b')];}this[_0x2b03('0x1a')][_0x66775e['linkedid']]['connectedlinename']=_0x66775e['calleridname'];this[_0x2b03('0x1a')][_0x66775e[_0x2b03('0x3d')]][_0x2b03('0x6e')]=_0x66775e[_0x2b03('0x50')];this[_0x2b03('0x1a')][_0x66775e[_0x2b03('0x3d')]][_0x2b03('0x4a')]=dispositions[_[_0x2b03('0x4b')](_0x66775e['channelstate'])];if(this[_0x2b03('0x4f')][_0x66775e['channel'][_0x2b03('0x4e')]('-')[0x0]]){this['channels'][_0x66775e[_0x2b03('0x3d')]][_0x2b03('0x6f')]=this[_0x2b03('0x4f')][_0x66775e[_0x2b03('0x50')][_0x2b03('0x4e')]('-')[0x0]]['id'];this[_0x2b03('0x1a')][_0x66775e[_0x2b03('0x3d')]][_0x2b03('0x70')]=this[_0x2b03('0x4f')][_0x66775e[_0x2b03('0x50')]['split']('-')[0x0]][_0x2b03('0x55')];}}}}else{if(this['channels'][_0x66775e['uniqueid']]){if(_0x66775e[_0x2b03('0x4c')]==='6'){if(this['agents'][_0x66775e['channel'][_0x2b03('0x4e')]('-')[0x0]]){this[_0x2b03('0x1a')][_0x66775e[_0x2b03('0x39')]][_0x2b03('0x6f')]=this[_0x2b03('0x4f')][_0x66775e['channel'][_0x2b03('0x4e')]('-')[0x0]]['id'];this[_0x2b03('0x1a')][_0x66775e[_0x2b03('0x39')]]['membername']=this['agents'][_0x66775e[_0x2b03('0x50')][_0x2b03('0x4e')]('-')[0x0]][_0x2b03('0x55')];}}}}}}catch(_0x16ec86){logger[_0x2b03('0x30')](_0x2b03('0x71'),_0x66775e['uniqueid'],util['inspect'](_0x16ec86,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x2b03('0x72')]=function(_0x8c8c37,_0xdb6c19){try{if(this['channels'][_0x8c8c37]){logger[_0x2b03('0x37')](_0x2b03('0x73'),_0x8c8c37,_0xdb6c19);this[_0x2b03('0x1a')][_0x8c8c37][_0x2b03('0x74')]=!![];if(_[_0x2b03('0x75')](_0xdb6c19,_0x2b03('0x76'))){_0xdb6c19=_0xdb6c19[_0x2b03('0x77')](_0x2b03('0x76'),'.WAV');}this[_0x2b03('0x1a')][_0x8c8c37][_0x2b03('0x78')]=_0xdb6c19;var _0x271401=_['find'](this[_0x2b03('0x1a')][_0x8c8c37][_0x2b03('0x79')],{'filename':_0xdb6c19});if(_['isNil'](_0x271401)){this[_0x2b03('0x1a')][_0x8c8c37][_0x2b03('0x79')][_0x2b03('0x7a')]({'filename':_0xdb6c19,'createdAt':moment()[_0x2b03('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x2b03('0x7b')});}}}catch(_0x33d624){logger[_0x2b03('0x30')]('[%s][voiceCallReport][mixMonitorFilename]',_0x8c8c37,util[_0x2b03('0x32')](_0x33d624,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2b03('0x33')][_0x2b03('0x24')]=function(_0x16476f){try{if(this[_0x2b03('0x34')](_0x16476f)){logger['debug'](_0x2b03('0x7c'),_0x16476f[_0x2b03('0x39')],util[_0x2b03('0x32')](_0x16476f,{'showHidden':![],'depth':null}));if(this[_0x2b03('0x1a')][_0x16476f[_0x2b03('0x39')]]&&_0x16476f[_0x2b03('0x50')]!=_0x2b03('0x44')){if(this[_0x2b03('0x34')](_0x16476f[_0x2b03('0x7d')])){if(this[_0x2b03('0x34')](_0x16476f[_0x2b03('0x7d')][_0x2b03('0x7e')])){logger[_0x2b03('0x37')](_0x2b03('0x7f'),_0x16476f[_0x2b03('0x39')],_0x16476f[_0x2b03('0x80')]);this[_0x2b03('0x72')](_0x16476f[_0x2b03('0x39')],_0x16476f[_0x2b03('0x80')]);}else if(this[_0x2b03('0x34')](_0x16476f[_0x2b03('0x7d')]['xmd-phone'])){logger['info'](_0x2b03('0x81'),_0x16476f[_0x2b03('0x39')],_0x16476f[_0x2b03('0x80')]);this[_0x2b03('0x1a')][_0x16476f[_0x2b03('0x39')]][_0x2b03('0x3b')]=_0x16476f[_0x2b03('0x80')];}else if(this[_0x2b03('0x34')](_0x16476f[_0x2b03('0x7d')]['xmd-callerid'])){logger[_0x2b03('0x37')](_0x2b03('0x82'),_0x16476f[_0x2b03('0x39')],_0x16476f['value']);this['channels'][_0x16476f['uniqueid']][_0x2b03('0x83')]=_0x16476f[_0x2b03('0x80')];}else if(this[_0x2b03('0x34')](_0x16476f['variable']['xmd-cdrtype'])){logger[_0x2b03('0x37')](_0x2b03('0x84'),_0x16476f[_0x2b03('0x39')],_0x16476f['value']);this[_0x2b03('0x1a')][_0x16476f[_0x2b03('0x39')]][_0x2b03('0x85')]=_0x16476f[_0x2b03('0x80')];}else if(this['isNotNull'](_0x16476f[_0x2b03('0x7d')][_0x2b03('0x86')])){logger[_0x2b03('0x37')](_0x2b03('0x87'),_0x16476f[_0x2b03('0x39')],_0x16476f[_0x2b03('0x80')][_0x2b03('0x4e')](',')[0x0]);this['channels'][_0x16476f[_0x2b03('0x39')]][_0x2b03('0xf')]=_0x16476f['value'][_0x2b03('0x4e')](',')[0x0];}else if(this['isNotNull'](_0x16476f[_0x2b03('0x7d')][_0x2b03('0x88')])){logger[_0x2b03('0x37')](_0x2b03('0x89'),_0x16476f[_0x2b03('0x39')],_0x16476f[_0x2b03('0x80')]);this[_0x2b03('0x1a')][_0x16476f[_0x2b03('0x39')]][_0x2b03('0x8a')]=_0x16476f['value'];}else if(this[_0x2b03('0x34')](_0x16476f[_0x2b03('0x7d')][_0x2b03('0x8b')])){logger[_0x2b03('0x37')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x16476f[_0x2b03('0x39')],_0x16476f[_0x2b03('0x80')]);this['channels'][_0x16476f[_0x2b03('0x39')]]['destination']=_0x16476f[_0x2b03('0x80')];}else if(this['isNotNull'](_0x16476f[_0x2b03('0x7d')][_0x2b03('0x8c')])){logger[_0x2b03('0x37')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x16476f[_0x2b03('0x39')],_0x16476f[_0x2b03('0x80')]);this[_0x2b03('0x1a')][_0x16476f[_0x2b03('0x39')]][_0x2b03('0x8d')]=_0x16476f[_0x2b03('0x80')];}else if(this[_0x2b03('0x34')](_0x16476f[_0x2b03('0x7d')][_0x2b03('0x8e')])){logger['info'](_0x2b03('0x8f'),_0x16476f[_0x2b03('0x39')],_0x16476f[_0x2b03('0x80')]);this[_0x2b03('0x1a')][_0x16476f[_0x2b03('0x39')]]['queue']=_0x16476f[_0x2b03('0x80')];}else if(this[_0x2b03('0x34')](_0x16476f[_0x2b03('0x7d')][_0x2b03('0x90')])){logger['info'](_0x2b03('0x91'),_0x16476f[_0x2b03('0x39')],_0x16476f[_0x2b03('0x80')]);this[_0x2b03('0x1a')][_0x16476f['uniqueid']][_0x2b03('0x92')]=_0x16476f['value'];}}}else if(this[_0x2b03('0x34')](_0x16476f[_0x2b03('0x7d')][_0x2b03('0x7e')])){if(_0x16476f[_0x2b03('0x80')]){var _0x20882c=path['parse'](_0x16476f[_0x2b03('0x80')])['name'];logger[_0x2b03('0x37')](_0x2b03('0x7f'),_0x20882c,_0x16476f['value']);this[_0x2b03('0x72')](_0x20882c,_0x16476f[_0x2b03('0x80')]);}}else if(this['channels'][_0x16476f['linkedid']]){if(this[_0x2b03('0x34')](_0x16476f['variable'])){if(this[_0x2b03('0x34')](_0x16476f[_0x2b03('0x7d')]['sipcallid'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x16476f[_0x2b03('0x3d')],_0x16476f[_0x2b03('0x80')]);this['channels'][_0x16476f['linkedid']]['sipcalllinkedid']=_0x16476f['value'];}}}}}catch(_0x38d79c){logger['error'](_0x2b03('0x93'),_0x16476f[_0x2b03('0x39')],util[_0x2b03('0x32')](_0x38d79c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2b03('0x33')]['syncHangup']=function(_0x431e80){try{if(this[_0x2b03('0x34')](_0x431e80)){logger[_0x2b03('0x42')](_0x2b03('0x94'),_0x431e80[_0x2b03('0x39')],util[_0x2b03('0x32')](_0x431e80,{'showHidden':![],'depth':null}));if(this[_0x2b03('0x1a')][_0x431e80[_0x2b03('0x39')]]){logger[_0x2b03('0x37')](_0x2b03('0x95'),_0x431e80['uniqueid'],_0x431e80[_0x2b03('0x96')]);var _0x38d9a5=moment();this[_0x2b03('0x1a')][_0x431e80[_0x2b03('0x39')]][_0x2b03('0x97')]=_0x38d9a5[_0x2b03('0x48')](_0x2b03('0x49'));this[_0x2b03('0x1a')][_0x431e80[_0x2b03('0x39')]][_0x2b03('0x5d')]=_0x38d9a5[_0x2b03('0x98')](this[_0x2b03('0x1a')][_0x431e80[_0x2b03('0x39')]][_0x2b03('0x47')],_0x2b03('0x5e'));if(this[_0x2b03('0x1a')][_0x431e80[_0x2b03('0x39')]]['answered']){this['channels'][_0x431e80[_0x2b03('0x39')]][_0x2b03('0x99')]=_0x38d9a5['diff'](this[_0x2b03('0x1a')][_0x431e80['uniqueid']]['answertime'],_0x2b03('0x5e'));this['channels'][_0x431e80[_0x2b03('0x39')]]['holdtime']=this[_0x2b03('0x1a')][_0x431e80[_0x2b03('0x39')]][_0x2b03('0x5d')]-this[_0x2b03('0x1a')][_0x431e80[_0x2b03('0x39')]]['billableseconds'];}if(_0x431e80[_0x2b03('0x45')]===_0x2b03('0x4d')){if(this[_0x2b03('0x4f')][_0x431e80[_0x2b03('0x50')][_0x2b03('0x4e')]('-')[0x0]]){this['agents'][_0x431e80['channel'][_0x2b03('0x4e')]('-')[0x0]]=_[_0x2b03('0x9a')](this[_0x2b03('0x4f')][_0x431e80[_0x2b03('0x50')][_0x2b03('0x4e')]('-')[0x0]],[_0x2b03('0x51')]);logger[_0x2b03('0x42')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x431e80[_0x2b03('0x39')],util['inspect']({'destaccountcode':this[_0x2b03('0x4f')][_0x431e80[_0x2b03('0x50')][_0x2b03('0x4e')]('-')[0x0]][_0x2b03('0x53')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x2b03('0x48')](_0x2b03('0x54'),this['agents'][_0x431e80['channel'][_0x2b03('0x4e')]('-')[0x0]]['name']),_0x2b03('0x9b'),{'destaccountcode':this['agents'][_0x431e80['channel']['split']('-')[0x0]][_0x2b03('0x53')]});}}if(_0x431e80[_0x2b03('0x9c')]===_0x2b03('0x9d')){this['blindTransfers'][_0x431e80[_0x2b03('0x39')]]=this[_0x2b03('0x1a')][_0x431e80[_0x2b03('0x39')]];}else{if(this[_0x2b03('0x1a')][_0x431e80[_0x2b03('0x39')]][_0x2b03('0x85')]===_0x2b03('0x9e')&&this[_0x2b03('0x1b')][_0x431e80[_0x2b03('0x39')]]){this[_0x2b03('0x1a')][_0x431e80[_0x2b03('0x39')]][_0x2b03('0x39')]=[this[_0x2b03('0x1a')][_0x431e80['uniqueid']][_0x2b03('0x3d')],this[_0x2b03('0x1a')][_0x431e80[_0x2b03('0x39')]][_0x2b03('0x3d')]=this[_0x2b03('0x1a')][_0x431e80[_0x2b03('0x39')]][_0x2b03('0x39')]][0x0];delete this[_0x2b03('0x1b')][_0x431e80[_0x2b03('0x39')]];}}logger[_0x2b03('0x42')](_0x2b03('0x9f'),_0x431e80[_0x2b03('0x39')],util[_0x2b03('0x32')](this['channels'][_0x431e80[_0x2b03('0x39')]],{'showHidden':![],'depth':null}));ami['emit'](_0x2b03('0xa0'),this['channels'][_0x431e80[_0x2b03('0x39')]]);delete this[_0x2b03('0x1a')][_0x431e80[_0x2b03('0x39')]];}}}catch(_0x3b6d47){logger[_0x2b03('0x30')](_0x2b03('0xa1'),_0x431e80[_0x2b03('0x39')],util['inspect'](_0x3b6d47,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2b03('0x33')]['syncAttendedTransfer']=function(_0x3482bc){try{if(this[_0x2b03('0x34')](_0x3482bc)){logger[_0x2b03('0x37')](_0x2b03('0xa2'),_0x3482bc[_0x2b03('0x39')],_0x3482bc['origtransferercalleridnum'],_0x3482bc[_0x2b03('0xa3')]);logger[_0x2b03('0x42')](_0x2b03('0xa4'),_0x3482bc[_0x2b03('0x39')],util[_0x2b03('0x32')](_0x3482bc,{'showHidden':![],'depth':null}));if(this[_0x2b03('0x1a')][_0x3482bc[_0x2b03('0xa5')]]){this[_0x2b03('0x1a')][_0x3482bc[_0x2b03('0xa5')]][_0x2b03('0xa6')]=_0x3482bc[_0x2b03('0xa7')];this[_0x2b03('0x1a')][_0x3482bc[_0x2b03('0xa5')]]['transferconnectedlinenum']=_0x3482bc[_0x2b03('0xa3')];if(this[_0x2b03('0x1a')][_0x3482bc[_0x2b03('0xa8')]]){var _0x4f915b=this[_0x2b03('0x1a')][_0x3482bc[_0x2b03('0xa8')]];this[_0x2b03('0x1a')][_0x3482bc['secondtransfereruniqueid']]=this[_0x2b03('0x1a')][_0x3482bc[_0x2b03('0xa5')]];this['channels'][_0x3482bc['transfereeuniqueid']]=_0x4f915b;}}else if(this[_0x2b03('0x1a')][_0x3482bc[_0x2b03('0xa9')]]){this[_0x2b03('0x1a')][_0x3482bc[_0x2b03('0xa9')]][_0x2b03('0xa6')]=_0x3482bc[_0x2b03('0xa7')];this[_0x2b03('0x1a')][_0x3482bc[_0x2b03('0xa9')]][_0x2b03('0xaa')]=_0x3482bc[_0x2b03('0xa3')];if(this[_0x2b03('0x1a')][_0x3482bc['origtransfereruniqueid']]){var _0x4f915b=this[_0x2b03('0x1a')][_0x3482bc[_0x2b03('0xab')]];this[_0x2b03('0x1a')][_0x3482bc[_0x2b03('0xab')]]=this[_0x2b03('0x1a')][_0x3482bc[_0x2b03('0xa9')]];this[_0x2b03('0x1a')][_0x3482bc[_0x2b03('0xa9')]]=_0x4f915b;}}}}catch(_0x1cfc66){logger[_0x2b03('0x30')](_0x2b03('0xac'),_0x3482bc[_0x2b03('0x39')],util[_0x2b03('0x32')](_0x1cfc66,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2b03('0x33')]['syncBlindTransfer']=function(_0x4d24d6){try{if(this['isNotNull'](_0x4d24d6)){logger[_0x2b03('0x37')](_0x2b03('0xad'),_0x4d24d6[_0x2b03('0x39')],_0x4d24d6[_0x2b03('0xae')],_0x4d24d6[_0x2b03('0xaf')]);logger['debug'](_0x2b03('0xb0'),_0x4d24d6[_0x2b03('0x39')],util[_0x2b03('0x32')](_0x4d24d6,{'showHidden':![],'depth':null}));if(this['channels'][_0x4d24d6[_0x2b03('0xa5')]]){this[_0x2b03('0x1a')][_0x4d24d6['transfereeuniqueid']][_0x2b03('0xa6')]=_0x4d24d6['transfereecalleridnum'];this['channels'][_0x4d24d6[_0x2b03('0xa5')]][_0x2b03('0xaa')]=_0x4d24d6[_0x2b03('0xaf')];this['syncHangup']({'event':_0x2b03('0x9d'),'uniqueid':_0x4d24d6[_0x2b03('0xa5')],'context':_0x4d24d6[_0x2b03('0x45')],'channel':_0x4d24d6['transfererchannel']});}}}catch(_0x314581){logger[_0x2b03('0x30')](_0x2b03('0xb1'),_0x4d24d6[_0x2b03('0x39')],util[_0x2b03('0x32')](_0x314581,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x2b03('0x2d')]=function(_0x6e0022){try{if(this[_0x2b03('0x34')](_0x6e0022)){logger[_0x2b03('0x42')](_0x2b03('0xb2'),_0x6e0022['uniqueid'],util['inspect'](_0x6e0022,{'showHidden':![],'depth':null}));if(this['channels'][_0x6e0022[_0x2b03('0x39')]]){if(!_['isNil'](this[_0x2b03('0x1a')][_0x6e0022[_0x2b03('0x39')]][_0x2b03('0x6a')])){this[_0x2b03('0x1a')][_0x6e0022[_0x2b03('0x39')]][_0x2b03('0xb3')]=moment()[_0x2b03('0x48')](_0x2b03('0x49'));logger[_0x2b03('0x37')](_0x2b03('0xb4'),_0x6e0022[_0x2b03('0x39')],this['channels'][_0x6e0022[_0x2b03('0x39')]][_0x2b03('0xb3')]);}}}}catch(_0x35f95f){logger[_0x2b03('0x30')](_0x2b03('0xb5'),_0x6e0022[_0x2b03('0x39')],util[_0x2b03('0x32')](_0x35f95f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2b03('0x33')][_0x2b03('0xb6')]=function(_0x41c62c){try{if(this[_0x2b03('0x34')](_0x41c62c)){logger[_0x2b03('0x42')](_0x2b03('0xb7'),_0x41c62c[_0x2b03('0x39')],util[_0x2b03('0x32')](_0x41c62c,{'showHidden':![],'depth':null}));if(this[_0x2b03('0x1a')][_0x41c62c['uniqueid']]){if(!_['isNil'](this[_0x2b03('0x1a')][_0x41c62c[_0x2b03('0x39')]][_0x2b03('0xb3')])){this[_0x2b03('0x1a')][_0x41c62c[_0x2b03('0x39')]][_0x2b03('0xb8')]+=moment()[_0x2b03('0xb9')](0x0)[_0x2b03('0x98')](this[_0x2b03('0x1a')][_0x41c62c['uniqueid']][_0x2b03('0xb3')],_0x2b03('0x5e'));logger[_0x2b03('0x37')](_0x2b03('0xba'),_0x41c62c[_0x2b03('0x39')],this[_0x2b03('0x1a')][_0x41c62c[_0x2b03('0x39')]][_0x2b03('0xb8')]);delete this[_0x2b03('0x1a')][_0x41c62c['uniqueid']][_0x2b03('0xb3')];}}}}catch(_0x103771){logger[_0x2b03('0x30')]('[%s][voiceCallReport][musiconholdstop]',_0x41c62c[_0x2b03('0x39')],util[_0x2b03('0x32')](_0x103771,{'showHidden':![],'depth':null}));}};module[_0x2b03('0xbb')]=VoiceCallReport; \ No newline at end of file +var _0xa1a8=['user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','toLowerCase','applicationdata','appdata','duration','subtract','seconds','includes','lastdata','startsWith','cdr(','match','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','answertime','diff','connectedlinename','destinationchannel','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','.wav49','.WAV','monitorFilename','monitors','isNil','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','[%s][voiceCallReport][varset]\x20event:','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','variable','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\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','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','sipcalluniqueid','parse','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','endtime','answered','billableseconds','holdtime','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','emit','user:agentcomplete','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','moment','util','path','../../../config/environment','../../../config/logger','../model/channel','unknown','inuse','busy','onhold','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','newexten','bind','newchannel','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','uniqueid','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','merge','pick','error','[%s][voiceCallReport][newcallerid]','debug','[%s][voiceCallReport][newchannel]\x20event:','linkedid','channel','info','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','exten','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','keys','context','from-sip','split','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode'];(function(_0x30d5ec,_0x152aba){var _0x5d2c89=function(_0x13ece1){while(--_0x13ece1){_0x30d5ec['push'](_0x30d5ec['shift']());}};_0x5d2c89(++_0x152aba);}(_0xa1a8,0x6a));var _0x8a1a=function(_0x266a4c,_0x456f9d){_0x266a4c=_0x266a4c-0x0;var _0xf5abf9=_0xa1a8[_0x266a4c];return _0xf5abf9;};'use strict';var BPromise=require(_0x8a1a('0x0'));var _=require(_0x8a1a('0x1'));var moment=require(_0x8a1a('0x2'));var util=require(_0x8a1a('0x3'));var path=require(_0x8a1a('0x4'));var Redis=require('ioredis');var config=require(_0x8a1a('0x5'));var logger=require(_0x8a1a('0x6'))('ami');var ami=require('../ami');var Channel=require(_0x8a1a('0x7'));var statusDesc=[_0x8a1a('0x8'),'not_inuse',_0x8a1a('0x9'),_0x8a1a('0xa'),'invalid','unavailable','ringing','ringinuse',_0x8a1a('0xb')];var applications=[_0x8a1a('0xc'),_0x8a1a('0xd'),_0x8a1a('0xe'),_0x8a1a('0xf'),_0x8a1a('0x10'),_0x8a1a('0x11')];var dispositions=[_0x8a1a('0x12'),'FAILED',_0x8a1a('0x13'),_0x8a1a('0x12'),'NO\x20ANSWER',_0x8a1a('0x12'),_0x8a1a('0x14'),_0x8a1a('0x15'),_0x8a1a('0x13'),_0x8a1a('0x13'),_0x8a1a('0x13')];var actions={};config[_0x8a1a('0x16')]=_[_0x8a1a('0x17')](config[_0x8a1a('0x16')],{'host':'localhost','port':0x18eb});var io=require(_0x8a1a('0x18'))(new Redis(config['redis']));function VoiceCallReport(_0x54df2e){this[_0x8a1a('0x19')]=_0x54df2e[_0x8a1a('0x19')];this[_0x8a1a('0x1a')]=_0x54df2e[_0x8a1a('0x1a')];this[_0x8a1a('0x1b')]={};ami['on'](_0x8a1a('0x1c'),this[_0x8a1a('0x1d')]['bind'](this));ami['on'](_0x8a1a('0x1e'),this[_0x8a1a('0x1d')][_0x8a1a('0x1f')](this));ami['on'](_0x8a1a('0x20'),this['syncNewChannel'][_0x8a1a('0x1f')](this));ami['on']('newstate',this['syncNewState'][_0x8a1a('0x1f')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0x8a1a('0x21'),this[_0x8a1a('0x22')][_0x8a1a('0x1f')](this));ami['on'](_0x8a1a('0x23'),this[_0x8a1a('0x24')]['bind'](this));ami['on'](_0x8a1a('0x25'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0x8a1a('0x26'),this['syncBlindTransfer'][_0x8a1a('0x1f')](this));ami['on'](_0x8a1a('0x27'),this[_0x8a1a('0x28')][_0x8a1a('0x1f')](this));ami['on'](_0x8a1a('0x29'),this[_0x8a1a('0x2a')][_0x8a1a('0x1f')](this));try{logger['info'](_0x8a1a('0x2b'));ami['actionCoreShowChannels']();}catch(_0x24cc85){logger['error'](_0x8a1a('0x2c'),util[_0x8a1a('0x2d')](_0x24cc85,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x8a1a('0x2e')][_0x8a1a('0x2f')]=function(_0x32e66b){return _0x32e66b!==null&&!_[_0x8a1a('0x30')](_0x32e66b);};VoiceCallReport['prototype']['emit']=function(_0x2dbaee,_0x4e89cb,_0x4ff323){io['to'](_0x2dbaee)['emit'](_0x4e89cb,_0x4ff323);};VoiceCallReport[_0x8a1a('0x2e')][_0x8a1a('0x24')]=function(_0x20e159){try{if(this[_0x8a1a('0x2f')](_0x20e159)){logger['info']('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x20e159[_0x8a1a('0x31')],_0x20e159[_0x8a1a('0x32')],_0x20e159[_0x8a1a('0x33')]);logger['debug'](_0x8a1a('0x34'),_0x20e159[_0x8a1a('0x31')],util[_0x8a1a('0x2d')](_0x20e159,{'showHidden':![],'depth':null}));if(_0x20e159[_0x8a1a('0x31')]===_0x20e159['linkedid']){if(!_[_0x8a1a('0x30')](this['channels'][_0x20e159['uniqueid']])){_[_0x8a1a('0x35')](this[_0x8a1a('0x19')][_0x20e159[_0x8a1a('0x31')]],_[_0x8a1a('0x36')](_0x20e159,_['keys'](this[_0x8a1a('0x19')][_0x20e159[_0x8a1a('0x31')]])));}}}}catch(_0x1c77ba){logger[_0x8a1a('0x37')](_0x8a1a('0x38'),_0x20e159[_0x8a1a('0x31')],util['inspect'](_0x1c77ba,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8a1a('0x2e')]['syncNewChannel']=function(_0x46f80c){try{if(this['isNotNull'](_0x46f80c)){logger[_0x8a1a('0x39')](_0x8a1a('0x3a'),_0x46f80c[_0x8a1a('0x31')],util[_0x8a1a('0x2d')](_0x46f80c,{'showHidden':![],'depth':null}));if(_0x46f80c[_0x8a1a('0x31')]===_0x46f80c[_0x8a1a('0x3b')]&&_0x46f80c[_0x8a1a('0x3c')]!='OutgoingSpoolFailed'){if(_[_0x8a1a('0x30')](this[_0x8a1a('0x19')][_0x46f80c[_0x8a1a('0x31')]])){logger[_0x8a1a('0x3d')](_0x8a1a('0x3e'),_0x46f80c['uniqueid'],_0x46f80c['context'],_0x46f80c[_0x8a1a('0x3f')]);this['channels'][_0x46f80c[_0x8a1a('0x31')]]=new Channel();this[_0x8a1a('0x19')][_0x46f80c[_0x8a1a('0x31')]][_0x8a1a('0x40')]=moment()[_0x8a1a('0x41')](_0x8a1a('0x42'));this[_0x8a1a('0x19')][_0x46f80c[_0x8a1a('0x31')]][_0x8a1a('0x43')]=dispositions[_[_0x8a1a('0x44')](_0x46f80c[_0x8a1a('0x45')])];_[_0x8a1a('0x35')](this[_0x8a1a('0x19')][_0x46f80c[_0x8a1a('0x31')]],_[_0x8a1a('0x36')](_0x46f80c,_[_0x8a1a('0x46')](this[_0x8a1a('0x19')][_0x46f80c[_0x8a1a('0x31')]])));if(_0x46f80c[_0x8a1a('0x47')]===_0x8a1a('0x48')){if(this[_0x8a1a('0x1a')][_0x46f80c[_0x8a1a('0x3c')][_0x8a1a('0x49')]('-')[0x0]]){this[_0x8a1a('0x1a')][_0x46f80c['channel'][_0x8a1a('0x49')]('-')[0x0]][_0x8a1a('0x4a')]=_0x46f80c['exten'];logger[_0x8a1a('0x39')](_0x8a1a('0x4b'),_0x46f80c[_0x8a1a('0x31')],util[_0x8a1a('0x2d')]({'destaccountcode':this[_0x8a1a('0x1a')][_0x46f80c['channel'][_0x8a1a('0x49')]('-')[0x0]][_0x8a1a('0x4c')],'destconnectedlinenum':_0x46f80c[_0x8a1a('0x3f')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x8a1a('0x41')](_0x8a1a('0x4d'),this[_0x8a1a('0x1a')][_0x46f80c['channel'][_0x8a1a('0x49')]('-')[0x0]][_0x8a1a('0x4e')]),_0x8a1a('0x4f'),{'destaccountcode':this[_0x8a1a('0x1a')][_0x46f80c[_0x8a1a('0x3c')]['split']('-')[0x0]][_0x8a1a('0x4c')],'destconnectedlinenum':_0x46f80c[_0x8a1a('0x3f')]});}}}}}}catch(_0x3575e4){logger[_0x8a1a('0x37')](_0x8a1a('0x50'),_0x46f80c[_0x8a1a('0x31')],util['inspect'](_0x3575e4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8a1a('0x2e')]['syncNewExten']=function(_0x9f6650){try{if(this[_0x8a1a('0x2f')](_0x9f6650)){logger['debug'](_0x8a1a('0x51'),_0x9f6650[_0x8a1a('0x31')],util[_0x8a1a('0x2d')](_0x9f6650,{'showHidden':![],'depth':null}));if(_0x9f6650[_0x8a1a('0x31')]===_0x9f6650['linkedid']&&_0x9f6650[_0x8a1a('0x3f')]!='h'&&_0x9f6650[_0x8a1a('0x3c')]!=_0x8a1a('0x52')){_0x9f6650[_0x8a1a('0x53')]=_0x9f6650['application'][_0x8a1a('0x54')]();_0x9f6650[_0x8a1a('0x55')]=(_0x9f6650[_0x8a1a('0x56')]||_0x9f6650['applicationdata'])[_0x8a1a('0x54')]();logger[_0x8a1a('0x3d')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x9f6650[_0x8a1a('0x31')],_0x9f6650[_0x8a1a('0x53')],_0x9f6650[_0x8a1a('0x55')]);if(_[_0x8a1a('0x30')](this[_0x8a1a('0x19')][_0x9f6650[_0x8a1a('0x31')]])){this[_0x8a1a('0x19')][_0x9f6650[_0x8a1a('0x31')]]=new Channel();this[_0x8a1a('0x19')][_0x9f6650[_0x8a1a('0x31')]]['starttime']=_0x9f6650[_0x8a1a('0x57')]?moment()[_0x8a1a('0x58')](moment[_0x8a1a('0x57')](_0x9f6650['duration'])['seconds'](),_0x8a1a('0x59'))[_0x8a1a('0x41')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0x8a1a('0x41')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x9f6650[_0x8a1a('0x31')]][_0x8a1a('0x43')]=_0x8a1a('0x12');}_['merge'](this[_0x8a1a('0x19')][_0x9f6650['uniqueid']],_[_0x8a1a('0x36')](_0x9f6650,_[_0x8a1a('0x46')](this[_0x8a1a('0x19')][_0x9f6650[_0x8a1a('0x31')]])));if(_[_0x8a1a('0x5a')](applications,_0x9f6650['application'])){this['channels'][_0x9f6650[_0x8a1a('0x31')]]['lastapplication']=_0x9f6650[_0x8a1a('0x53')];this[_0x8a1a('0x19')][_0x9f6650['uniqueid']][_0x8a1a('0x5b')]=_0x9f6650['applicationdata'];if(_0x9f6650[_0x8a1a('0x53')]===_0x8a1a('0xc')&&_[_0x8a1a('0x5c')](_0x9f6650['applicationdata'],_0x8a1a('0x5d'))){var _0x12418a=_0x9f6650['applicationdata'][_0x8a1a('0x49')]('=');var _0x4b22c4=_0x12418a[0x0][_0x8a1a('0x5e')](/cdr\((.*)\)/);if(_0x4b22c4){this[_0x8a1a('0x19')][_0x9f6650[_0x8a1a('0x31')]][_0x4b22c4[0x1]]=_0x12418a[0x1];}}else if(_0x9f6650[_0x8a1a('0x53')]===_0x8a1a('0xd')){this[_0x8a1a('0x19')][_0x9f6650[_0x8a1a('0x31')]]['queue']=_0x9f6650['applicationdata']['split'](',')[0x0];}}}}}catch(_0x3bec2c){logger['error'](_0x8a1a('0x5f'),_0x9f6650['uniqueid'],util[_0x8a1a('0x2d')](_0x3bec2c,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x8a1a('0x60')]=function(_0x254a26){try{if(this[_0x8a1a('0x2f')](_0x254a26)){logger[_0x8a1a('0x3d')](_0x8a1a('0x61'),_0x254a26[_0x8a1a('0x31')],_0x254a26[_0x8a1a('0x3b')],_0x254a26[_0x8a1a('0x32')],_0x254a26[_0x8a1a('0x33')]);logger[_0x8a1a('0x39')]('[%s][voiceCallReport][newstate]\x20event:',_0x254a26[_0x8a1a('0x31')],util['inspect'](_0x254a26,{'showHidden':![],'depth':null}));if(_0x254a26['uniqueid']!==_0x254a26['linkedid']){if(this[_0x8a1a('0x19')][_0x254a26['linkedid']]){if(_0x254a26[_0x8a1a('0x45')]==='6'){if(!this[_0x8a1a('0x19')][_0x254a26[_0x8a1a('0x3b')]]['answered']){var _0x34d231=moment();this[_0x8a1a('0x19')][_0x254a26[_0x8a1a('0x3b')]]['answered']=!![];this[_0x8a1a('0x19')][_0x254a26[_0x8a1a('0x3b')]][_0x8a1a('0x62')]=_0x34d231[_0x8a1a('0x41')]('YYYY-MM-DD\x20HH:mm:ss');if(this['channels'][_0x254a26[_0x8a1a('0x3b')]][_0x8a1a('0x40')]){this[_0x8a1a('0x19')][_0x254a26[_0x8a1a('0x3b')]]['holdtime']=_0x34d231[_0x8a1a('0x63')](this[_0x8a1a('0x19')][_0x254a26[_0x8a1a('0x3b')]]['starttime'],_0x8a1a('0x59'));}}this[_0x8a1a('0x19')][_0x254a26[_0x8a1a('0x3b')]][_0x8a1a('0x3b')]=_0x254a26[_0x8a1a('0x31')];if(_0x254a26[_0x8a1a('0x33')]!=='xcally-motion-preview'){this[_0x8a1a('0x19')][_0x254a26[_0x8a1a('0x3b')]]['connectedlinenum']=_0x254a26[_0x8a1a('0x33')];}this[_0x8a1a('0x19')][_0x254a26['linkedid']][_0x8a1a('0x64')]=_0x254a26[_0x8a1a('0x32')];this['channels'][_0x254a26[_0x8a1a('0x3b')]][_0x8a1a('0x65')]=_0x254a26[_0x8a1a('0x3c')];this[_0x8a1a('0x19')][_0x254a26[_0x8a1a('0x3b')]][_0x8a1a('0x43')]=dispositions[_[_0x8a1a('0x44')](_0x254a26[_0x8a1a('0x45')])];if(this[_0x8a1a('0x1a')][_0x254a26[_0x8a1a('0x3c')][_0x8a1a('0x49')]('-')[0x0]]){this[_0x8a1a('0x19')][_0x254a26[_0x8a1a('0x3b')]]['UserId']=this[_0x8a1a('0x1a')][_0x254a26[_0x8a1a('0x3c')][_0x8a1a('0x49')]('-')[0x0]]['id'];this[_0x8a1a('0x19')][_0x254a26[_0x8a1a('0x3b')]][_0x8a1a('0x66')]=this['agents'][_0x254a26[_0x8a1a('0x3c')]['split']('-')[0x0]][_0x8a1a('0x4e')];}}}}else{if(this[_0x8a1a('0x19')][_0x254a26[_0x8a1a('0x31')]]){if(_0x254a26[_0x8a1a('0x45')]==='6'){if(this[_0x8a1a('0x1a')][_0x254a26[_0x8a1a('0x3c')][_0x8a1a('0x49')]('-')[0x0]]){this[_0x8a1a('0x19')][_0x254a26[_0x8a1a('0x31')]]['UserId']=this['agents'][_0x254a26[_0x8a1a('0x3c')][_0x8a1a('0x49')]('-')[0x0]]['id'];this[_0x8a1a('0x19')][_0x254a26[_0x8a1a('0x31')]][_0x8a1a('0x66')]=this[_0x8a1a('0x1a')][_0x254a26['channel'][_0x8a1a('0x49')]('-')[0x0]]['name'];}}}}}}catch(_0x13d2ee){logger[_0x8a1a('0x37')](_0x8a1a('0x67'),_0x254a26[_0x8a1a('0x31')],util[_0x8a1a('0x2d')](_0x13d2ee,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8a1a('0x2e')][_0x8a1a('0x68')]=function(_0x23d2f3,_0x41b012){try{if(this[_0x8a1a('0x19')][_0x23d2f3]){logger[_0x8a1a('0x3d')](_0x8a1a('0x69'),_0x23d2f3,_0x41b012);this[_0x8a1a('0x19')][_0x23d2f3]['monitor']=!![];if(_[_0x8a1a('0x6a')](_0x41b012,_0x8a1a('0x6b'))){_0x41b012=_0x41b012['replace'](_0x8a1a('0x6b'),_0x8a1a('0x6c'));}this[_0x8a1a('0x19')][_0x23d2f3][_0x8a1a('0x6d')]=_0x41b012;var _0x193b75=_['find'](this[_0x8a1a('0x19')][_0x23d2f3][_0x8a1a('0x6e')],{'filename':_0x41b012});if(_[_0x8a1a('0x6f')](_0x193b75)){this[_0x8a1a('0x19')][_0x23d2f3]['monitors']['push']({'filename':_0x41b012,'createdAt':moment()['format'](_0x8a1a('0x42')),'mixmonitorid':'','status':_0x8a1a('0x70')});}}}catch(_0x35bd42){logger['error'](_0x8a1a('0x71'),_0x23d2f3,util[_0x8a1a('0x2d')](_0x35bd42,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8a1a('0x2e')][_0x8a1a('0x72')]=function(_0x1565c2){try{if(this[_0x8a1a('0x2f')](_0x1565c2)){logger[_0x8a1a('0x39')](_0x8a1a('0x73'),_0x1565c2['uniqueid'],util[_0x8a1a('0x2d')](_0x1565c2,{'showHidden':![],'depth':null}));if(this['channels'][_0x1565c2[_0x8a1a('0x31')]]&&_0x1565c2[_0x8a1a('0x3c')]!=_0x8a1a('0x52')){if(this[_0x8a1a('0x2f')](_0x1565c2['variable'])){if(this[_0x8a1a('0x2f')](_0x1565c2['variable'][_0x8a1a('0x74')])){logger['info'](_0x8a1a('0x75'),_0x1565c2[_0x8a1a('0x31')],_0x1565c2[_0x8a1a('0x76')]);this[_0x8a1a('0x68')](_0x1565c2[_0x8a1a('0x31')],_0x1565c2['value']);}else if(this[_0x8a1a('0x2f')](_0x1565c2[_0x8a1a('0x77')][_0x8a1a('0x78')])){logger[_0x8a1a('0x3d')](_0x8a1a('0x79'),_0x1565c2[_0x8a1a('0x31')],_0x1565c2['value']);this['channels'][_0x1565c2[_0x8a1a('0x31')]][_0x8a1a('0x33')]=_0x1565c2[_0x8a1a('0x76')];}else if(this[_0x8a1a('0x2f')](_0x1565c2['variable'][_0x8a1a('0x7a')])){logger['info'](_0x8a1a('0x7b'),_0x1565c2[_0x8a1a('0x31')],_0x1565c2['value']);this['channels'][_0x1565c2['uniqueid']][_0x8a1a('0x7c')]=_0x1565c2['value'];}else if(this[_0x8a1a('0x2f')](_0x1565c2[_0x8a1a('0x77')][_0x8a1a('0x7d')])){logger['info'](_0x8a1a('0x7e'),_0x1565c2['uniqueid'],_0x1565c2[_0x8a1a('0x76')]);this[_0x8a1a('0x19')][_0x1565c2[_0x8a1a('0x31')]][_0x8a1a('0x7f')]=_0x1565c2[_0x8a1a('0x76')];}else if(this['isNotNull'](_0x1565c2[_0x8a1a('0x77')][_0x8a1a('0x80')])){logger['info'](_0x8a1a('0x81'),_0x1565c2[_0x8a1a('0x31')],_0x1565c2['value'][_0x8a1a('0x49')](',')[0x0]);this[_0x8a1a('0x19')][_0x1565c2[_0x8a1a('0x31')]][_0x8a1a('0xd')]=_0x1565c2[_0x8a1a('0x76')][_0x8a1a('0x49')](',')[0x0];}else if(this[_0x8a1a('0x2f')](_0x1565c2[_0x8a1a('0x77')][_0x8a1a('0x82')])){logger[_0x8a1a('0x3d')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x1565c2['uniqueid'],_0x1565c2[_0x8a1a('0x76')]);this[_0x8a1a('0x19')][_0x1565c2['uniqueid']]['originatecalleridnum']=_0x1565c2[_0x8a1a('0x76')];}else if(this[_0x8a1a('0x2f')](_0x1565c2['variable'][_0x8a1a('0x83')])){logger[_0x8a1a('0x3d')](_0x8a1a('0x84'),_0x1565c2[_0x8a1a('0x31')],_0x1565c2[_0x8a1a('0x76')]);this[_0x8a1a('0x19')][_0x1565c2['uniqueid']][_0x8a1a('0x85')]=_0x1565c2[_0x8a1a('0x76')];}else if(this[_0x8a1a('0x2f')](_0x1565c2[_0x8a1a('0x77')][_0x8a1a('0x86')])){logger[_0x8a1a('0x3d')](_0x8a1a('0x87'),_0x1565c2[_0x8a1a('0x31')],_0x1565c2[_0x8a1a('0x76')]);this[_0x8a1a('0x19')][_0x1565c2['uniqueid']][_0x8a1a('0x88')]=_0x1565c2[_0x8a1a('0x76')];}else if(this[_0x8a1a('0x2f')](_0x1565c2[_0x8a1a('0x77')][_0x8a1a('0x89')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x1565c2[_0x8a1a('0x31')],_0x1565c2['value']);this['channels'][_0x1565c2[_0x8a1a('0x31')]]['queue']=_0x1565c2[_0x8a1a('0x76')];}else if(this['isNotNull'](_0x1565c2[_0x8a1a('0x77')]['sipcallid'])){logger[_0x8a1a('0x3d')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x1565c2[_0x8a1a('0x31')],_0x1565c2[_0x8a1a('0x76')]);this[_0x8a1a('0x19')][_0x1565c2['uniqueid']][_0x8a1a('0x8a')]=_0x1565c2[_0x8a1a('0x76')];}}}else if(this[_0x8a1a('0x2f')](_0x1565c2['variable'][_0x8a1a('0x74')])){if(_0x1565c2[_0x8a1a('0x76')]){var _0x384239=path[_0x8a1a('0x8b')](_0x1565c2[_0x8a1a('0x76')])[_0x8a1a('0x4e')];logger[_0x8a1a('0x3d')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x384239,_0x1565c2[_0x8a1a('0x76')]);this['syncMixMonitorFilename'](_0x384239,_0x1565c2[_0x8a1a('0x76')]);}}else if(this[_0x8a1a('0x19')][_0x1565c2[_0x8a1a('0x3b')]]){if(this[_0x8a1a('0x2f')](_0x1565c2[_0x8a1a('0x77')])){if(this[_0x8a1a('0x2f')](_0x1565c2[_0x8a1a('0x77')][_0x8a1a('0x8c')])){logger[_0x8a1a('0x3d')](_0x8a1a('0x8d'),_0x1565c2[_0x8a1a('0x3b')],_0x1565c2[_0x8a1a('0x76')]);this[_0x8a1a('0x19')][_0x1565c2[_0x8a1a('0x3b')]][_0x8a1a('0x8e')]=_0x1565c2[_0x8a1a('0x76')];}}}}}catch(_0x4bbbc5){logger[_0x8a1a('0x37')]('[%s][voiceCallReport][varset]',_0x1565c2[_0x8a1a('0x31')],util['inspect'](_0x4bbbc5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8a1a('0x2e')][_0x8a1a('0x22')]=function(_0x291ff7){try{if(this[_0x8a1a('0x2f')](_0x291ff7)){logger['debug'](_0x8a1a('0x8f'),_0x291ff7[_0x8a1a('0x31')],util[_0x8a1a('0x2d')](_0x291ff7,{'showHidden':![],'depth':null}));if(this[_0x8a1a('0x19')][_0x291ff7[_0x8a1a('0x31')]]){logger[_0x8a1a('0x3d')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x291ff7[_0x8a1a('0x31')],_0x291ff7['cause-txt']);var _0x28fd72=moment();this[_0x8a1a('0x19')][_0x291ff7[_0x8a1a('0x31')]][_0x8a1a('0x90')]=_0x28fd72[_0x8a1a('0x41')](_0x8a1a('0x42'));this[_0x8a1a('0x19')][_0x291ff7[_0x8a1a('0x31')]][_0x8a1a('0x57')]=_0x28fd72[_0x8a1a('0x63')](this[_0x8a1a('0x19')][_0x291ff7[_0x8a1a('0x31')]][_0x8a1a('0x40')],_0x8a1a('0x59'));if(this[_0x8a1a('0x19')][_0x291ff7[_0x8a1a('0x31')]][_0x8a1a('0x91')]){this[_0x8a1a('0x19')][_0x291ff7[_0x8a1a('0x31')]][_0x8a1a('0x92')]=_0x28fd72['diff'](this[_0x8a1a('0x19')][_0x291ff7[_0x8a1a('0x31')]][_0x8a1a('0x62')],'seconds');this['channels'][_0x291ff7[_0x8a1a('0x31')]][_0x8a1a('0x93')]=this[_0x8a1a('0x19')][_0x291ff7[_0x8a1a('0x31')]][_0x8a1a('0x57')]-this[_0x8a1a('0x19')][_0x291ff7[_0x8a1a('0x31')]]['billableseconds'];}if(_0x291ff7[_0x8a1a('0x47')]===_0x8a1a('0x48')){if(this['agents'][_0x291ff7['channel'][_0x8a1a('0x49')]('-')[0x0]]){this['agents'][_0x291ff7[_0x8a1a('0x3c')][_0x8a1a('0x49')]('-')[0x0]]=_['omit'](this[_0x8a1a('0x1a')][_0x291ff7[_0x8a1a('0x3c')]['split']('-')[0x0]],[_0x8a1a('0x4a')]);logger['debug'](_0x8a1a('0x94'),_0x291ff7[_0x8a1a('0x31')],util[_0x8a1a('0x2d')]({'destaccountcode':this[_0x8a1a('0x1a')][_0x291ff7['channel']['split']('-')[0x0]][_0x8a1a('0x4c')]},{'showHidden':![],'depth':null}));this[_0x8a1a('0x95')](util[_0x8a1a('0x41')](_0x8a1a('0x4d'),this[_0x8a1a('0x1a')][_0x291ff7[_0x8a1a('0x3c')][_0x8a1a('0x49')]('-')[0x0]][_0x8a1a('0x4e')]),_0x8a1a('0x96'),{'destaccountcode':this[_0x8a1a('0x1a')][_0x291ff7[_0x8a1a('0x3c')][_0x8a1a('0x49')]('-')[0x0]][_0x8a1a('0x4c')]});}}if(_0x291ff7[_0x8a1a('0x97')]===_0x8a1a('0x98')){this[_0x8a1a('0x1b')][_0x291ff7['uniqueid']]=this['channels'][_0x291ff7[_0x8a1a('0x31')]];}else{if(this[_0x8a1a('0x19')][_0x291ff7[_0x8a1a('0x31')]][_0x8a1a('0x7f')]===_0x8a1a('0x99')&&this[_0x8a1a('0x1b')][_0x291ff7[_0x8a1a('0x31')]]){this[_0x8a1a('0x19')][_0x291ff7[_0x8a1a('0x31')]][_0x8a1a('0x31')]=[this[_0x8a1a('0x19')][_0x291ff7['uniqueid']][_0x8a1a('0x3b')],this['channels'][_0x291ff7[_0x8a1a('0x31')]][_0x8a1a('0x3b')]=this[_0x8a1a('0x19')][_0x291ff7['uniqueid']][_0x8a1a('0x31')]][0x0];delete this[_0x8a1a('0x1b')][_0x291ff7[_0x8a1a('0x31')]];}}logger['debug'](_0x8a1a('0x9a'),_0x291ff7[_0x8a1a('0x31')],util['inspect'](this[_0x8a1a('0x19')][_0x291ff7[_0x8a1a('0x31')]],{'showHidden':![],'depth':null}));ami[_0x8a1a('0x95')](_0x8a1a('0x9b'),this[_0x8a1a('0x19')][_0x291ff7[_0x8a1a('0x31')]]);delete this['channels'][_0x291ff7[_0x8a1a('0x31')]];}}}catch(_0x562def){logger['error'](_0x8a1a('0x9c'),_0x291ff7[_0x8a1a('0x31')],util[_0x8a1a('0x2d')](_0x562def,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncAttendedTransfer']=function(_0x418d82){try{if(this[_0x8a1a('0x2f')](_0x418d82)){logger[_0x8a1a('0x3d')](_0x8a1a('0x9d'),_0x418d82[_0x8a1a('0x31')],_0x418d82[_0x8a1a('0x9e')],_0x418d82[_0x8a1a('0x9f')]);logger['debug']('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x418d82['uniqueid'],util[_0x8a1a('0x2d')](_0x418d82,{'showHidden':![],'depth':null}));if(this[_0x8a1a('0x19')][_0x418d82['transfereeuniqueid']]){this[_0x8a1a('0x19')][_0x418d82[_0x8a1a('0xa0')]][_0x8a1a('0xa1')]=_0x418d82['origtransferercalleridnum'];this['channels'][_0x418d82[_0x8a1a('0xa0')]][_0x8a1a('0xa2')]=_0x418d82[_0x8a1a('0x9f')];if(this['channels'][_0x418d82[_0x8a1a('0xa3')]]){var _0xaab966=this['channels'][_0x418d82[_0x8a1a('0xa3')]];this['channels'][_0x418d82['secondtransfereruniqueid']]=this[_0x8a1a('0x19')][_0x418d82[_0x8a1a('0xa0')]];this[_0x8a1a('0x19')][_0x418d82[_0x8a1a('0xa0')]]=_0xaab966;}}else if(this[_0x8a1a('0x19')][_0x418d82[_0x8a1a('0xa4')]]){this[_0x8a1a('0x19')][_0x418d82['transfertargetuniqueid']][_0x8a1a('0xa1')]=_0x418d82[_0x8a1a('0x9e')];this['channels'][_0x418d82[_0x8a1a('0xa4')]][_0x8a1a('0xa2')]=_0x418d82[_0x8a1a('0x9f')];if(this[_0x8a1a('0x19')][_0x418d82[_0x8a1a('0xa5')]]){var _0xaab966=this[_0x8a1a('0x19')][_0x418d82['origtransfereruniqueid']];this[_0x8a1a('0x19')][_0x418d82[_0x8a1a('0xa5')]]=this[_0x8a1a('0x19')][_0x418d82[_0x8a1a('0xa4')]];this[_0x8a1a('0x19')][_0x418d82[_0x8a1a('0xa4')]]=_0xaab966;}}}}catch(_0x3cf050){logger[_0x8a1a('0x37')](_0x8a1a('0xa6'),_0x418d82[_0x8a1a('0x31')],util['inspect'](_0x3cf050,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8a1a('0x2e')][_0x8a1a('0xa7')]=function(_0x1bfe29){try{if(this[_0x8a1a('0x2f')](_0x1bfe29)){logger[_0x8a1a('0x3d')](_0x8a1a('0xa8'),_0x1bfe29['uniqueid'],_0x1bfe29[_0x8a1a('0xa9')],_0x1bfe29[_0x8a1a('0xaa')]);logger['debug'](_0x8a1a('0xab'),_0x1bfe29['uniqueid'],util[_0x8a1a('0x2d')](_0x1bfe29,{'showHidden':![],'depth':null}));if(this[_0x8a1a('0x19')][_0x1bfe29[_0x8a1a('0xa0')]]){this[_0x8a1a('0x19')][_0x1bfe29[_0x8a1a('0xa0')]][_0x8a1a('0xa1')]=_0x1bfe29[_0x8a1a('0xa9')];this['channels'][_0x1bfe29[_0x8a1a('0xa0')]][_0x8a1a('0xa2')]=_0x1bfe29['extension'];this[_0x8a1a('0x22')]({'event':_0x8a1a('0x98'),'uniqueid':_0x1bfe29[_0x8a1a('0xa0')],'context':_0x1bfe29[_0x8a1a('0x47')],'channel':_0x1bfe29[_0x8a1a('0xac')]});}}}catch(_0x1134be){logger[_0x8a1a('0x37')](_0x8a1a('0xad'),_0x1bfe29['uniqueid'],util[_0x8a1a('0x2d')](_0x1134be,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8a1a('0x2e')][_0x8a1a('0x28')]=function(_0x575e22){try{if(this[_0x8a1a('0x2f')](_0x575e22)){logger[_0x8a1a('0x39')](_0x8a1a('0xae'),_0x575e22[_0x8a1a('0x31')],util['inspect'](_0x575e22,{'showHidden':![],'depth':null}));if(this[_0x8a1a('0x19')][_0x575e22[_0x8a1a('0x31')]]){if(!_[_0x8a1a('0x6f')](this['channels'][_0x575e22[_0x8a1a('0x31')]][_0x8a1a('0x62')])){this['channels'][_0x575e22[_0x8a1a('0x31')]][_0x8a1a('0xaf')]=moment()[_0x8a1a('0x41')](_0x8a1a('0x42'));logger[_0x8a1a('0x3d')](_0x8a1a('0xb0'),_0x575e22[_0x8a1a('0x31')],this[_0x8a1a('0x19')][_0x575e22[_0x8a1a('0x31')]]['mohstarttime']);}}}}catch(_0x561ba1){logger[_0x8a1a('0x37')]('[%s][voiceCallReport][musiconholdstart]',_0x575e22['uniqueid'],util[_0x8a1a('0x2d')](_0x561ba1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8a1a('0x2e')][_0x8a1a('0x2a')]=function(_0x53fa24){try{if(this['isNotNull'](_0x53fa24)){logger[_0x8a1a('0x39')](_0x8a1a('0xb1'),_0x53fa24['uniqueid'],util['inspect'](_0x53fa24,{'showHidden':![],'depth':null}));if(this[_0x8a1a('0x19')][_0x53fa24['uniqueid']]){if(!_[_0x8a1a('0x6f')](this['channels'][_0x53fa24[_0x8a1a('0x31')]][_0x8a1a('0xaf')])){this[_0x8a1a('0x19')][_0x53fa24[_0x8a1a('0x31')]][_0x8a1a('0xb2')]+=moment()[_0x8a1a('0xb3')](0x0)[_0x8a1a('0x63')](this[_0x8a1a('0x19')][_0x53fa24[_0x8a1a('0x31')]][_0x8a1a('0xaf')],_0x8a1a('0x59'));logger[_0x8a1a('0x3d')](_0x8a1a('0xb4'),_0x53fa24['uniqueid'],this[_0x8a1a('0x19')][_0x53fa24[_0x8a1a('0x31')]][_0x8a1a('0xb2')]);delete this['channels'][_0x53fa24[_0x8a1a('0x31')]][_0x8a1a('0xaf')];}}}}catch(_0x21b111){logger[_0x8a1a('0x37')](_0x8a1a('0xb5'),_0x53fa24[_0x8a1a('0x31')],util[_0x8a1a('0x2d')](_0x21b111,{'showHidden':![],'depth':null}));}};module[_0x8a1a('0xb6')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 7b3244a..12eb33f 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 _0x9193=['destuniqueid','[%s][voiceDialReport][hangup]','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','syncDialBegin','bind','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','called','channel','substring','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','inspect','voice:outbound','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','syncDialEnd','dialstatus','connectedlinename','format','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','lastIndexOf','custom:dialconnect','voice_outbound_channel:save','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','keys','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','addVariable','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','starttime','seconds','complete','total','answertime','holdtime','diff','billableseconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid'];(function(_0x352256,_0x447d72){var _0x309795=function(_0x5e1efa){while(--_0x5e1efa){_0x352256['push'](_0x352256['shift']());}};_0x309795(++_0x447d72);}(_0x9193,0x138));var _0x3919=function(_0x329d13,_0x1aff27){_0x329d13=_0x329d13-0x0;var _0x33efd9=_0x9193[_0x329d13];return _0x33efd9;};'use strict';var _=require(_0x3919('0x0'));var moment=require(_0x3919('0x1'));var util=require('util');var Redis=require(_0x3919('0x2'));var config=require(_0x3919('0x3'));var logger=require(_0x3919('0x4'))(_0x3919('0x5'));var ami=require(_0x3919('0x6'));config[_0x3919('0x7')]=_['defaults'](config[_0x3919('0x7')],{'host':_0x3919('0x8'),'port':0x18eb});var io=require(_0x3919('0x9'))(new Redis(config[_0x3919('0x7')]));function VoiceDialReport(_0xebf2ef){this[_0x3919('0xa')]=_0xebf2ef[_0x3919('0xb')];this['outbound']=_0xebf2ef[_0x3919('0xc')];this[_0x3919('0xd')]={};ami['on']('dialbegin',this[_0x3919('0xe')][_0x3919('0xf')](this));ami['on']('dialend',this['syncDialEnd'][_0x3919('0xf')](this));ami['on'](_0x3919('0x10'),this[_0x3919('0x11')][_0x3919('0xf')](this));ami['on'](_0x3919('0x12'),this[_0x3919('0x13')][_0x3919('0xf')](this));}VoiceDialReport[_0x3919('0x14')][_0x3919('0x15')]=function(_0x573483){return _0x573483!==null&&!_[_0x3919('0x16')](_0x573483);};VoiceDialReport[_0x3919('0x14')]['emit']=function(_0x2b6c6f,_0x2924a0,_0x25b4a5){io['to'](_0x2b6c6f)[_0x3919('0x17')](_0x2924a0,_0x25b4a5);};VoiceDialReport['prototype']['syncDialBegin']=function(_0x121e6e){try{if(this[_0x3919('0x15')](_0x121e6e)){logger[_0x3919('0x18')](_0x3919('0x19'),_0x121e6e[_0x3919('0x1a')],util['inspect'](_0x121e6e,{'showHidden':![],'depth':null}));if(this[_0x3919('0xa')][_0x121e6e['uniqueid']]){_['merge'](this[_0x3919('0xa')][_0x121e6e[_0x3919('0x1a')]],{'starttime':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x3919('0x1b'),'interface':_0x121e6e[_0x3919('0x1c')][_0x3919('0x1d')](0x0,_0x121e6e[_0x3919('0x1c')]['lastIndexOf']('-')),'membername':_0x121e6e[_0x3919('0x1c')][_0x3919('0x1d')](_0x121e6e[_0x3919('0x1c')]['lastIndexOf']('/')+0x1,_0x121e6e[_0x3919('0x1c')]['lastIndexOf']('-'))},_['omit'](_0x121e6e,[_0x3919('0x1e'),_0x3919('0x1f')]));logger['info'](_0x3919('0x20'),_0x121e6e['uniqueid'],this['channels'][_0x121e6e[_0x3919('0x1a')]][_0x3919('0x21')],this[_0x3919('0xa')][_0x121e6e[_0x3919('0x1a')]][_0x3919('0x22')]);logger['debug']('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x121e6e[_0x3919('0x1a')],util[_0x3919('0x23')](this[_0x3919('0xa')][_0x121e6e[_0x3919('0x1a')]],{'showHidden':![],'depth':null}));this[_0x3919('0x17')](_0x3919('0x24'),'voice_outbound_channel:save',this[_0x3919('0xa')][_0x121e6e[_0x3919('0x1a')]]);logger[_0x3919('0x18')](_0x3919('0x25'),_0x121e6e['uniqueid'],util[_0x3919('0x23')](this[_0x3919('0xa')][_0x121e6e[_0x3919('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x3919('0x17')](_0x3919('0x26'),this[_0x3919('0xa')][_0x121e6e[_0x3919('0x1a')]]);}}}catch(_0x22f277){logger[_0x3919('0x27')](_0x3919('0x28'),_0x121e6e[_0x3919('0x1a')],util[_0x3919('0x23')](_0x22f277,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x3919('0x14')][_0x3919('0x29')]=function(_0x3180f4){try{if(this[_0x3919('0x15')](_0x3180f4)){logger[_0x3919('0x18')]('[%s][voiceDialReport][dialend]\x20event:',_0x3180f4['uniqueid'],util['inspect'](_0x3180f4,{'showHidden':![],'depth':null}));if(this[_0x3919('0xa')][_0x3180f4['uniqueid']]){this[_0x3919('0xa')][_0x3180f4[_0x3919('0x1a')]][_0x3919('0x2a')]=_0x3180f4[_0x3919('0x2a')];if(_0x3180f4[_0x3919('0x2a')]==='ANSWER'){this[_0x3919('0xa')][_0x3180f4[_0x3919('0x1a')]]['connectedlinenum']=_0x3180f4['connectedlinenum'];this[_0x3919('0xa')][_0x3180f4[_0x3919('0x1a')]][_0x3919('0x2b')]=_0x3180f4[_0x3919('0x2b')];this[_0x3919('0xa')][_0x3180f4[_0x3919('0x1a')]]['answertime']=moment()[_0x3919('0x2c')](_0x3919('0x2d'));this[_0x3919('0xa')][_0x3180f4[_0x3919('0x1a')]][_0x3919('0x2e')]=_0x3919('0x2f');logger[_0x3919('0x30')](_0x3919('0x31'),_0x3180f4[_0x3919('0x1a')],_0x3180f4[_0x3919('0x1c')]['substring'](_0x3180f4[_0x3919('0x1c')][_0x3919('0x32')]('/')+0x1,_0x3180f4[_0x3919('0x1c')][_0x3919('0x32')]('-')));logger[_0x3919('0x18')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x3180f4['uniqueid'],util[_0x3919('0x23')](this[_0x3919('0xa')][_0x3180f4[_0x3919('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x3919('0x17')](_0x3919('0x33'),this[_0x3919('0xa')][_0x3180f4[_0x3919('0x1a')]]);}logger['debug']('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x3180f4[_0x3919('0x1a')],util[_0x3919('0x23')](this['channels'][_0x3180f4[_0x3919('0x1a')]],{'showHidden':![],'depth':null}));this[_0x3919('0x17')](_0x3919('0x24'),_0x3919('0x34'),this[_0x3919('0xa')][_0x3180f4[_0x3919('0x1a')]]);}}}catch(_0x2a08ac){logger[_0x3919('0x27')](_0x3919('0x35'),_0x3180f4[_0x3919('0x1a')],util['inspect'](_0x2a08ac,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x3919('0x14')]['syncVarSet']=function(_0x2142f4){try{if(this[_0x3919('0x15')](_0x2142f4)){logger['debug'](_0x3919('0x36'),_0x2142f4['uniqueid'],util['inspect'](_0x2142f4,{'showHidden':![],'depth':null}));this['addVariable'](_0x2142f4[_0x3919('0x1a')],_[_0x3919('0x37')](_0x2142f4[_0x3919('0x38')])[0x0],_0x2142f4[_0x3919('0x39')]);if(this[_0x3919('0x15')](_0x2142f4[_0x3919('0x38')])&&this[_0x3919('0x15')](_0x2142f4[_0x3919('0x38')][_0x3919('0x3a')])){if(_[_0x3919('0x16')](this[_0x3919('0xa')][_0x2142f4[_0x3919('0x1a')]])){this[_0x3919('0xa')][_0x2142f4[_0x3919('0x1a')]]={'routeId':_0x2142f4[_0x3919('0x39')],'variables':this['variables'][_0x2142f4[_0x3919('0x1a')]]};logger[_0x3919('0x30')](_0x3919('0x3b'),_0x2142f4[_0x3919('0x1a')],_0x2142f4[_0x3919('0x38')][_0x3919('0x3a')],_[_0x3919('0x37')](_0x2142f4[_0x3919('0x38')])[0x0],_0x2142f4[_0x3919('0x39')]);logger[_0x3919('0x18')](_0x3919('0x3c'),_0x2142f4['uniqueid'],util[_0x3919('0x23')](this[_0x3919('0xa')][_0x2142f4[_0x3919('0x1a')]],{'showHidden':![],'depth':null}));this[_0x3919('0x17')](_0x3919('0x24'),_0x3919('0x34'),this[_0x3919('0xa')][_0x2142f4[_0x3919('0x1a')]]);}}}}catch(_0x31d4a5){logger[_0x3919('0x27')](_0x3919('0x3d'),_0x2142f4[_0x3919('0x1a')],util[_0x3919('0x23')](_0x31d4a5,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x3919('0x14')][_0x3919('0x3e')]=function(_0x5272b5,_0x553583,_0x338d80){var _0x5b728a=['rtpaudioqos',_0x3919('0x3f'),_0x3919('0x40'),_0x3919('0x41'),_0x3919('0x42'),'rtpaudioqoslossbridged',_0x3919('0x43'),'rtpaudioqosrttbridged',_0x3919('0x44'),'sipuri',_0x3919('0x45'),_0x3919('0x46'),'membercalls','memberdynamic',_0x3919('0x47'),_0x3919('0x48'),_0x3919('0x21'),_0x3919('0x49'),_0x3919('0x4a')];if(!_['isNil'](_0x553583)&&!_[_0x3919('0x4b')](_0x5b728a,_0x553583)){if(_[_0x3919('0x16')](this[_0x3919('0xd')][_0x5272b5])){this[_0x3919('0xd')][_0x5272b5]={};}this[_0x3919('0xd')][_0x5272b5][_0x553583]=_0x338d80;}};VoiceDialReport['prototype'][_0x3919('0x13')]=function(_0x4a079c){try{if(this[_0x3919('0x15')](_0x4a079c)){logger[_0x3919('0x18')]('[%s][voiceDialReport][hangup]\x20event:',_0x4a079c[_0x3919('0x1a')],util[_0x3919('0x23')](_0x4a079c,{'showHidden':![],'depth':null}));if(this[_0x3919('0xa')][_0x4a079c[_0x3919('0x1a')]]){logger['info'](_0x3919('0x4c'),_0x4a079c['uniqueid'],_0x4a079c[_0x3919('0x4d')]);this[_0x3919('0xa')][_0x4a079c[_0x3919('0x1a')]][_0x3919('0x4e')]=moment()['format'](_0x3919('0x2d'));this[_0x3919('0xa')][_0x4a079c['uniqueid']][_0x3919('0x4f')]=moment(this[_0x3919('0xa')][_0x4a079c[_0x3919('0x1a')]][_0x3919('0x4e')])['diff'](this[_0x3919('0xa')][_0x4a079c[_0x3919('0x1a')]][_0x3919('0x50')],_0x3919('0x51'));this['channels'][_0x4a079c[_0x3919('0x1a')]][_0x3919('0x2e')]=_0x3919('0x52');this['outbound'][_0x3919('0x53')]+=0x1;if(this[_0x3919('0xa')][_0x4a079c['uniqueid']][_0x3919('0x54')]){this[_0x3919('0xc')]['answered']+=0x1;this[_0x3919('0xa')][_0x4a079c[_0x3919('0x1a')]][_0x3919('0x55')]=moment(this[_0x3919('0xa')][_0x4a079c[_0x3919('0x1a')]][_0x3919('0x54')])[_0x3919('0x56')](this[_0x3919('0xa')][_0x4a079c['uniqueid']][_0x3919('0x50')],_0x3919('0x51'));this[_0x3919('0xa')][_0x4a079c[_0x3919('0x1a')]][_0x3919('0x57')]=moment(this['channels'][_0x4a079c[_0x3919('0x1a')]][_0x3919('0x4e')])[_0x3919('0x56')](this[_0x3919('0xa')][_0x4a079c[_0x3919('0x1a')]][_0x3919('0x54')],_0x3919('0x51'));this['outbound'][_0x3919('0x58')]+=this[_0x3919('0xa')][_0x4a079c['uniqueid']][_0x3919('0x55')]||0x0;this[_0x3919('0xc')][_0x3919('0x59')]+=this['channels'][_0x4a079c[_0x3919('0x1a')]][_0x3919('0x57')];}this[_0x3919('0xc')][_0x3919('0x5a')]+=this[_0x3919('0xa')][_0x4a079c['uniqueid']][_0x3919('0x4f')];logger[_0x3919('0x18')](_0x3919('0x5b'),_0x4a079c[_0x3919('0x1a')],util[_0x3919('0x23')](this[_0x3919('0xa')][_0x4a079c[_0x3919('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x3919('0x17')](_0x3919('0x5c'),this[_0x3919('0xa')][_0x4a079c[_0x3919('0x1a')]]);logger[_0x3919('0x18')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x4a079c[_0x3919('0x1a')],util[_0x3919('0x23')](this[_0x3919('0xa')][_0x4a079c[_0x3919('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x3919('0x17')](_0x3919('0x5d'),this[_0x3919('0xa')][_0x4a079c[_0x3919('0x1a')]]);logger['debug'](_0x3919('0x5e'),_0x4a079c[_0x3919('0x1a')],util[_0x3919('0x23')](this['channels'][_0x4a079c[_0x3919('0x1a')]],{'showHidden':![],'depth':null}));this[_0x3919('0x17')](_0x3919('0x24'),'voice_outbound:save',this[_0x3919('0xc')]);logger[_0x3919('0x30')](_0x3919('0x5f'),JSON[_0x3919('0x60')](this[_0x3919('0xa')][_0x4a079c['uniqueid']]));logger[_0x3919('0x18')](_0x3919('0x61'),_0x4a079c['uniqueid'],util[_0x3919('0x23')](this[_0x3919('0xa')][_0x4a079c[_0x3919('0x1a')]],{'showHidden':![],'depth':null}));this[_0x3919('0x17')](_0x3919('0x24'),_0x3919('0x62'),this[_0x3919('0xa')][_0x4a079c[_0x3919('0x1a')]]);delete this['channels'][_0x4a079c['uniqueid']];}else if(this['channels'][_0x4a079c[_0x3919('0x63')]]){this[_0x3919('0xa')][_0x4a079c[_0x3919('0x63')]][_0x3919('0x1a')]=this[_0x3919('0xa')][_0x4a079c[_0x3919('0x63')]][_0x3919('0x64')];}if(this[_0x3919('0xd')][_0x4a079c['uniqueid']]){delete this['variables'][_0x4a079c[_0x3919('0x1a')]];}}}catch(_0x5736a0){logger[_0x3919('0x27')](_0x3919('0x65'),_0x4a079c[_0x3919('0x1a')],util[_0x3919('0x23')](_0x5736a0,{'showHidden':![],'depth':null}));}};module[_0x3919('0x66')]=VoiceDialReport; \ No newline at end of file +var _0x4810=['starttime','seconds','complete','total','answered','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','custom:voiceDialReport','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','exports','lodash','moment','ioredis','../../../config/environment','ami','../ami','redis','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','varset','syncVarSet','prototype','isNotNull','isUndefined','emit','merge','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','interface','inspect','voice:outbound','voice_outbound_channel:save','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','membercalls','memberdynamic','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration'];(function(_0xe16ca2,_0xfdad2){var _0x578c8a=function(_0x9d766a){while(--_0x9d766a){_0xe16ca2['push'](_0xe16ca2['shift']());}};_0x578c8a(++_0xfdad2);}(_0x4810,0x1c1));var _0x0481=function(_0x256360,_0x5175c5){_0x256360=_0x256360-0x0;var _0x295b1f=_0x4810[_0x256360];return _0x295b1f;};'use strict';var _=require(_0x0481('0x0'));var moment=require(_0x0481('0x1'));var util=require('util');var Redis=require(_0x0481('0x2'));var config=require(_0x0481('0x3'));var logger=require('../../../config/logger')(_0x0481('0x4'));var ami=require(_0x0481('0x5'));config[_0x0481('0x6')]=_['defaults'](config[_0x0481('0x6')],{'host':_0x0481('0x7'),'port':0x18eb});var io=require(_0x0481('0x8'))(new Redis(config[_0x0481('0x6')]));function VoiceDialReport(_0x248711){this[_0x0481('0x9')]=_0x248711[_0x0481('0xa')];this[_0x0481('0xb')]=_0x248711[_0x0481('0xb')];this[_0x0481('0xc')]={};ami['on'](_0x0481('0xd'),this[_0x0481('0xe')][_0x0481('0xf')](this));ami['on']('dialend',this['syncDialEnd'][_0x0481('0xf')](this));ami['on'](_0x0481('0x10'),this[_0x0481('0x11')]['bind'](this));ami['on']('hangup',this['syncHangup'][_0x0481('0xf')](this));}VoiceDialReport[_0x0481('0x12')][_0x0481('0x13')]=function(_0xcb4cbf){return _0xcb4cbf!==null&&!_[_0x0481('0x14')](_0xcb4cbf);};VoiceDialReport[_0x0481('0x12')]['emit']=function(_0x4cde39,_0xf1183a,_0x4e0e48){io['to'](_0x4cde39)[_0x0481('0x15')](_0xf1183a,_0x4e0e48);};VoiceDialReport[_0x0481('0x12')][_0x0481('0xe')]=function(_0xf83b93){try{if(this[_0x0481('0x13')](_0xf83b93)){logger['debug']('[%s][voiceDialReport][dialbegin]\x20event:',_0xf83b93['uniqueid'],util['inspect'](_0xf83b93,{'showHidden':![],'depth':null}));if(this['channels'][_0xf83b93['uniqueid']]){_[_0x0481('0x16')](this['channels'][_0xf83b93[_0x0481('0x17')]],{'starttime':moment()[_0x0481('0x18')](_0x0481('0x19')),'lastevent':_0x0481('0x1a'),'interface':_0xf83b93[_0x0481('0x1b')][_0x0481('0x1c')](0x0,_0xf83b93[_0x0481('0x1b')][_0x0481('0x1d')]('-')),'membername':_0xf83b93[_0x0481('0x1b')][_0x0481('0x1c')](_0xf83b93['channel'][_0x0481('0x1d')]('/')+0x1,_0xf83b93[_0x0481('0x1b')][_0x0481('0x1d')]('-'))},_[_0x0481('0x1e')](_0xf83b93,['event',_0x0481('0x1f')]));logger[_0x0481('0x20')](_0x0481('0x21'),_0xf83b93[_0x0481('0x17')],this[_0x0481('0x9')][_0xf83b93[_0x0481('0x17')]]['membername'],this[_0x0481('0x9')][_0xf83b93[_0x0481('0x17')]][_0x0481('0x22')]);logger['debug']('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0xf83b93[_0x0481('0x17')],util[_0x0481('0x23')](this[_0x0481('0x9')][_0xf83b93[_0x0481('0x17')]],{'showHidden':![],'depth':null}));this[_0x0481('0x15')](_0x0481('0x24'),_0x0481('0x25'),this['channels'][_0xf83b93[_0x0481('0x17')]]);logger[_0x0481('0x26')](_0x0481('0x27'),_0xf83b93[_0x0481('0x17')],util[_0x0481('0x23')](this[_0x0481('0x9')][_0xf83b93[_0x0481('0x17')]],{'showHidden':![],'depth':null}));ami[_0x0481('0x15')](_0x0481('0x28'),this[_0x0481('0x9')][_0xf83b93[_0x0481('0x17')]]);}}}catch(_0x42efee){logger[_0x0481('0x29')](_0x0481('0x2a'),_0xf83b93['uniqueid'],util[_0x0481('0x23')](_0x42efee,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0481('0x12')][_0x0481('0x2b')]=function(_0x455d4d){try{if(this[_0x0481('0x13')](_0x455d4d)){logger[_0x0481('0x26')](_0x0481('0x2c'),_0x455d4d[_0x0481('0x17')],util[_0x0481('0x23')](_0x455d4d,{'showHidden':![],'depth':null}));if(this[_0x0481('0x9')][_0x455d4d[_0x0481('0x17')]]){this[_0x0481('0x9')][_0x455d4d['uniqueid']][_0x0481('0x2d')]=_0x455d4d[_0x0481('0x2d')];if(_0x455d4d[_0x0481('0x2d')]===_0x0481('0x2e')){this[_0x0481('0x9')][_0x455d4d[_0x0481('0x17')]][_0x0481('0x2f')]=_0x455d4d[_0x0481('0x2f')];this[_0x0481('0x9')][_0x455d4d[_0x0481('0x17')]][_0x0481('0x30')]=_0x455d4d[_0x0481('0x30')];this[_0x0481('0x9')][_0x455d4d[_0x0481('0x17')]][_0x0481('0x31')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0481('0x9')][_0x455d4d[_0x0481('0x17')]][_0x0481('0x32')]=_0x0481('0x33');logger[_0x0481('0x20')](_0x0481('0x34'),_0x455d4d[_0x0481('0x17')],_0x455d4d[_0x0481('0x1b')][_0x0481('0x1c')](_0x455d4d[_0x0481('0x1b')][_0x0481('0x1d')]('/')+0x1,_0x455d4d[_0x0481('0x1b')][_0x0481('0x1d')]('-')));logger[_0x0481('0x26')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x455d4d['uniqueid'],util['inspect'](this[_0x0481('0x9')][_0x455d4d[_0x0481('0x17')]],{'showHidden':![],'depth':null}));ami[_0x0481('0x15')](_0x0481('0x35'),this['channels'][_0x455d4d[_0x0481('0x17')]]);}logger[_0x0481('0x26')](_0x0481('0x36'),_0x455d4d[_0x0481('0x17')],util[_0x0481('0x23')](this['channels'][_0x455d4d['uniqueid']],{'showHidden':![],'depth':null}));this[_0x0481('0x15')](_0x0481('0x24'),_0x0481('0x25'),this[_0x0481('0x9')][_0x455d4d[_0x0481('0x17')]]);}}}catch(_0xb5d1fa){logger[_0x0481('0x29')](_0x0481('0x37'),_0x455d4d[_0x0481('0x17')],util['inspect'](_0xb5d1fa,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0481('0x12')]['syncVarSet']=function(_0x2a6836){try{if(this[_0x0481('0x13')](_0x2a6836)){logger[_0x0481('0x26')](_0x0481('0x38'),_0x2a6836[_0x0481('0x17')],util[_0x0481('0x23')](_0x2a6836,{'showHidden':![],'depth':null}));this[_0x0481('0x39')](_0x2a6836['uniqueid'],_['keys'](_0x2a6836[_0x0481('0x3a')])[0x0],_0x2a6836[_0x0481('0x3b')]);if(this['isNotNull'](_0x2a6836[_0x0481('0x3a')])&&this[_0x0481('0x13')](_0x2a6836[_0x0481('0x3a')][_0x0481('0x3c')])){if(_[_0x0481('0x14')](this[_0x0481('0x9')][_0x2a6836['uniqueid']])){this[_0x0481('0x9')][_0x2a6836[_0x0481('0x17')]]={'routeId':_0x2a6836[_0x0481('0x3b')],'variables':this['variables'][_0x2a6836[_0x0481('0x17')]]};logger['info'](_0x0481('0x3d'),_0x2a6836['uniqueid'],_0x2a6836['variable'][_0x0481('0x3c')],_[_0x0481('0x3e')](_0x2a6836[_0x0481('0x3a')])[0x0],_0x2a6836[_0x0481('0x3b')]);logger[_0x0481('0x26')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x2a6836[_0x0481('0x17')],util['inspect'](this[_0x0481('0x9')][_0x2a6836[_0x0481('0x17')]],{'showHidden':![],'depth':null}));this[_0x0481('0x15')](_0x0481('0x24'),_0x0481('0x25'),this[_0x0481('0x9')][_0x2a6836[_0x0481('0x17')]]);}}}}catch(_0xcf7889){logger[_0x0481('0x29')](_0x0481('0x3f'),_0x2a6836[_0x0481('0x17')],util[_0x0481('0x23')](_0xcf7889,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0481('0x12')]['addVariable']=function(_0x20f526,_0x3efa5f,_0x508ea4){var _0x52efed=[_0x0481('0x40'),_0x0481('0x41'),_0x0481('0x42'),_0x0481('0x43'),_0x0481('0x44'),_0x0481('0x45'),_0x0481('0x46'),_0x0481('0x47'),_0x0481('0x48'),'sipuri',_0x0481('0x49'),'bridgepvtcallid',_0x0481('0x4a'),_0x0481('0x4b'),'memberinterface',_0x0481('0x4c'),_0x0481('0x4d'),_0x0481('0x4e'),_0x0481('0x4f')];if(!_[_0x0481('0x50')](_0x3efa5f)&&!_[_0x0481('0x51')](_0x52efed,_0x3efa5f)){if(_[_0x0481('0x14')](this[_0x0481('0xc')][_0x20f526])){this[_0x0481('0xc')][_0x20f526]={};}this[_0x0481('0xc')][_0x20f526][_0x3efa5f]=_0x508ea4;}};VoiceDialReport[_0x0481('0x12')]['syncHangup']=function(_0x512b7b){try{if(this['isNotNull'](_0x512b7b)){logger['debug']('[%s][voiceDialReport][hangup]\x20event:',_0x512b7b[_0x0481('0x17')],util[_0x0481('0x23')](_0x512b7b,{'showHidden':![],'depth':null}));if(this['channels'][_0x512b7b['uniqueid']]){logger[_0x0481('0x20')](_0x0481('0x52'),_0x512b7b['uniqueid'],_0x512b7b[_0x0481('0x53')]);this[_0x0481('0x9')][_0x512b7b[_0x0481('0x17')]][_0x0481('0x54')]=moment()[_0x0481('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x0481('0x9')][_0x512b7b[_0x0481('0x17')]][_0x0481('0x55')]=moment(this[_0x0481('0x9')][_0x512b7b[_0x0481('0x17')]][_0x0481('0x54')])['diff'](this[_0x0481('0x9')][_0x512b7b[_0x0481('0x17')]][_0x0481('0x56')],_0x0481('0x57'));this[_0x0481('0x9')][_0x512b7b[_0x0481('0x17')]][_0x0481('0x32')]=_0x0481('0x58');this[_0x0481('0xb')][_0x0481('0x59')]+=0x1;if(this[_0x0481('0x9')][_0x512b7b[_0x0481('0x17')]][_0x0481('0x31')]){this[_0x0481('0xb')][_0x0481('0x5a')]+=0x1;this[_0x0481('0x9')][_0x512b7b[_0x0481('0x17')]][_0x0481('0x5b')]=moment(this['channels'][_0x512b7b[_0x0481('0x17')]]['answertime'])['diff'](this[_0x0481('0x9')][_0x512b7b['uniqueid']][_0x0481('0x56')],_0x0481('0x57'));this[_0x0481('0x9')][_0x512b7b[_0x0481('0x17')]][_0x0481('0x5c')]=moment(this[_0x0481('0x9')][_0x512b7b['uniqueid']][_0x0481('0x54')])['diff'](this['channels'][_0x512b7b[_0x0481('0x17')]][_0x0481('0x31')],_0x0481('0x57'));this['outbound'][_0x0481('0x5d')]+=this[_0x0481('0x9')][_0x512b7b['uniqueid']][_0x0481('0x5b')]||0x0;this[_0x0481('0xb')][_0x0481('0x5e')]+=this[_0x0481('0x9')][_0x512b7b[_0x0481('0x17')]][_0x0481('0x5c')];}this[_0x0481('0xb')][_0x0481('0x5f')]+=this[_0x0481('0x9')][_0x512b7b[_0x0481('0x17')]][_0x0481('0x55')];logger[_0x0481('0x26')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x512b7b[_0x0481('0x17')],util['inspect'](this['channels'][_0x512b7b[_0x0481('0x17')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0481('0x60'),this[_0x0481('0x9')][_0x512b7b[_0x0481('0x17')]]);logger[_0x0481('0x26')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x512b7b[_0x0481('0x17')],util[_0x0481('0x23')](this[_0x0481('0x9')][_0x512b7b[_0x0481('0x17')]],{'showHidden':![],'depth':null}));ami[_0x0481('0x15')](_0x0481('0x61'),this['channels'][_0x512b7b['uniqueid']]);logger[_0x0481('0x26')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x512b7b[_0x0481('0x17')],util[_0x0481('0x23')](this[_0x0481('0x9')][_0x512b7b[_0x0481('0x17')]],{'showHidden':![],'depth':null}));this[_0x0481('0x15')](_0x0481('0x24'),_0x0481('0x62'),this[_0x0481('0xb')]);logger[_0x0481('0x20')](_0x0481('0x63'),JSON[_0x0481('0x64')](this[_0x0481('0x9')][_0x512b7b[_0x0481('0x17')]]));logger['debug'](_0x0481('0x65'),_0x512b7b[_0x0481('0x17')],util[_0x0481('0x23')](this[_0x0481('0x9')][_0x512b7b[_0x0481('0x17')]],{'showHidden':![],'depth':null}));this['emit'](_0x0481('0x24'),_0x0481('0x66'),this['channels'][_0x512b7b[_0x0481('0x17')]]);delete this[_0x0481('0x9')][_0x512b7b[_0x0481('0x17')]];}else if(this[_0x0481('0x9')][_0x512b7b['linkedid']]){this[_0x0481('0x9')][_0x512b7b[_0x0481('0x67')]][_0x0481('0x17')]=this[_0x0481('0x9')][_0x512b7b[_0x0481('0x67')]][_0x0481('0x68')];}if(this[_0x0481('0xc')][_0x512b7b['uniqueid']]){delete this['variables'][_0x512b7b[_0x0481('0x17')]];}}}catch(_0x5c8629){logger['error'](_0x0481('0x69'),_0x512b7b[_0x0481('0x17')],util[_0x0481('0x23')](_0x5c8629,{'showHidden':![],'depth':null}));}};module[_0x0481('0x6a')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 88546ca..44e34cf 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 _0x2c95=['linkedid','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','reason','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','keys','variable','value','queuestatus','CONTINUE','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','EXITWITHKEY','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','includes','isUndefined','[%s][voiceQueueReport][hangup]','length','diff','milliseconds','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','syncAttendedTransfer','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','ATTENDEDTRANSFER','origtransfereruniqueid','transfertargetuniqueid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','mohstarttime','exports','moment','util','md5','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','defaults','localhost','redis','prototype','tail','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','bind','syncQueueSummaryComplete','syncQueueCallerJoin','queuecallerabandon','queuecallerleave','syncQueueCallerLeave','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','queueStatusComplete','unlockRR','clearZombieChannels','switch','sequence','enqueue','isNil','Action','status','channel','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][','uniqueid','format','voice:queue:%s','voice_queue_channel:save','emitVoiceQueueChannelRemove',']\x20sending\x20voice_queue_channel:remove\x20event:','name','type','inbound','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','Trunk','active','callerid','Interval','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','queues','[voiceQueueReport][queues]','then','[voiceQueueReport][queuesummary]','isNotNull','queue','countBy','callers','toNumber','loggedin','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','position','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','push','last','queuecallercompleteAt','originalposition','queuecallerabandonAt','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerabandon]','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinenum','queuecallercomplete','queuecallerexitreason','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','[%s][voiceQueueReport][agentcomplete]','membername','holdtime','queuecallerexit','queuecallerexitAt','transfer','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase'];(function(_0x29a7d1,_0x513ff3){var _0x408c79=function(_0x40b470){while(--_0x40b470){_0x29a7d1['push'](_0x29a7d1['shift']());}};_0x408c79(++_0x513ff3);}(_0x2c95,0x12b));var _0x52c9=function(_0x242a98,_0x13988e){_0x242a98=_0x242a98-0x0;var _0x580999=_0x2c95[_0x242a98];return _0x580999;};'use strict';var _=require('lodash');var moment=require(_0x52c9('0x0'));var util=require(_0x52c9('0x1'));var md5=require(_0x52c9('0x2'));var Redis=require(_0x52c9('0x3'));var config=require(_0x52c9('0x4'));var logger=require(_0x52c9('0x5'))(_0x52c9('0x6'));var ami=require(_0x52c9('0x7'));var QueueReport=require(_0x52c9('0x8'));config['redis']=_[_0x52c9('0x9')](config['redis'],{'host':_0x52c9('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x52c9('0xb')]));var Sequence=function(){};Sequence[_0x52c9('0xc')]['enqueue']=function(_0x1b7a81){this[_0x52c9('0xd')]=this['tail']?this[_0x52c9('0xd')]['finally'](_0x1b7a81):_0x1b7a81();};function VoiceQueueReport(_0x8aad86){this['sequence']=new Sequence();this[_0x52c9('0xe')]={};this[_0x52c9('0xf')]=_0x8aad86[_0x52c9('0xf')];this[_0x52c9('0x10')]=_0x8aad86[_0x52c9('0x11')];this[_0x52c9('0x12')]=_0x8aad86[_0x52c9('0x12')];this[_0x52c9('0x13')]=!![];this[_0x52c9('0x14')]=_0x8aad86['campaigns'];this[_0x52c9('0x15')]={};ami['on'](_0x52c9('0x16'),this[_0x52c9('0x17')][_0x52c9('0x18')](this));ami['on']('queuesummarycomplete',this[_0x52c9('0x19')][_0x52c9('0x18')](this));ami['on']('queuecallerjoin',this[_0x52c9('0x1a')][_0x52c9('0x18')](this));ami['on'](_0x52c9('0x1b'),this['syncQueueCallerAbandon'][_0x52c9('0x18')](this));ami['on'](_0x52c9('0x1c'),this[_0x52c9('0x1d')]['bind'](this));ami['on']('agentcomplete',this[_0x52c9('0x1e')][_0x52c9('0x18')](this));ami['on'](_0x52c9('0x1f'),this[_0x52c9('0x20')][_0x52c9('0x18')](this));ami['on'](_0x52c9('0x21'),this[_0x52c9('0x22')][_0x52c9('0x18')](this));ami['on'](_0x52c9('0x23'),this[_0x52c9('0x24')][_0x52c9('0x18')](this));ami['on'](_0x52c9('0x25'),this[_0x52c9('0x26')][_0x52c9('0x18')](this));ami['on'](_0x52c9('0x27'),this[_0x52c9('0x28')]['bind'](this));ami['on'](_0x52c9('0x29'),this['syncMusicOnHoldStop']['bind'](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x52c9('0x18')](this));ami['on'](_0x52c9('0x2a'),this[_0x52c9('0x2b')]['bind'](this));this[_0x52c9('0x2c')]();this[_0x52c9('0x2d')]();}function clearChannels(_0x5584ed){if(!_[_0x52c9('0x2e')](_0x5584ed)){for(var _0x4ebfd7 in _0x5584ed){if(_0x5584ed[_0x52c9('0x2f')](_0x4ebfd7)){delete _0x5584ed[_0x4ebfd7];}}}}function clearCampaigns(_0x1897c9){if(!_[_0x52c9('0x2e')](_0x1897c9)){for(var _0x2f5b1a in _0x1897c9){if(_0x1897c9[_0x52c9('0x2f')](_0x2f5b1a)){_0x1897c9[_0x2f5b1a][_0x52c9('0x30')]=0x0;}}}}function clearVoiceQueues(_0x15a01d){if(!_[_0x52c9('0x2e')](_0x15a01d)){for(var _0x514b79 in _0x15a01d){if(_0x15a01d[_0x52c9('0x2f')](_0x514b79)){_0x15a01d[_0x514b79]['originated']=0x0;_0x15a01d[_0x514b79][_0x52c9('0x31')]=0x0;_0x15a01d[_0x514b79][_0x52c9('0x32')]=0x0;_0x15a01d[_0x514b79]['waiting']=0x0;_0x15a01d[_0x514b79][_0x52c9('0x33')]=!![];}}}}function clearAgentBooked(_0x51d45f){if(!_[_0x52c9('0x2e')](_0x51d45f)){for(var _0x148c4d in _0x51d45f){if(_0x51d45f[_0x52c9('0x2f')](_0x148c4d)){_0x51d45f[_0x148c4d][_0x52c9('0x34')]=!![];}}}}VoiceQueueReport[_0x52c9('0xc')][_0x52c9('0x35')]=function(){var _0x53ead5=this;for(var _0x4983d6 in this[_0x52c9('0x10')]){if(this['channels']['hasOwnProperty'](_0x4983d6)&&!this[_0x52c9('0x10')][_0x4983d6][_0x52c9('0x36')]){this[_0x52c9('0x37')][_0x52c9('0x38')](function(){if(!_[_0x52c9('0x39')](_0x53ead5['channels'][_0x4983d6])){return ami[_0x52c9('0x3a')]({'action':_0x52c9('0x3b'),'channel':_0x53ead5[_0x52c9('0x10')][_0x4983d6][_0x52c9('0x3c')]})[_0x52c9('0x3d')](function(_0x37c2cd){if(_0x37c2cd[_0x52c9('0x3e')]===_0x52c9('0x3f')){setTimeout(function(){if(_0x53ead5[_0x52c9('0x10')][_0x4983d6]){delete _0x53ead5[_0x52c9('0x10')][_0x4983d6];logger[_0x52c9('0x40')](_0x52c9('0x41'),_0x4983d6,util[_0x52c9('0x42')](_0x37c2cd,{'showHidden':![],'depth':null}));}if(_0x53ead5[_0x52c9('0xe')][_0x4983d6]){delete _0x53ead5[_0x52c9('0xe')][_0x4983d6];logger['error']('[%s][voiceQueueReport][checkQueueReport]',_0x4983d6,util['inspect'](_0x37c2cd,{'showHidden':![],'depth':null}));}if(_0x53ead5[_0x52c9('0x15')][_0x4983d6]){delete _0x53ead5[_0x52c9('0x15')][_0x4983d6];logger['error'](_0x52c9('0x43'),_0x4983d6,util[_0x52c9('0x42')](_0x37c2cd,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x52c9('0xc')]['syncFullyBooted']=function(){logger[_0x52c9('0x40')](_0x52c9('0x44'));clearChannels(this[_0x52c9('0x10')]);this[_0x52c9('0x45')](this[_0x52c9('0xe')]);clearAgentBooked(this[_0x52c9('0xf')]);clearVoiceQueues(this[_0x52c9('0x12')]);clearCampaigns(this['campaigns']);};VoiceQueueReport[_0x52c9('0xc')]['clearQueueReport']=function(_0x79f91d){var _0x3d6341=this;if(!_[_0x52c9('0x2e')](_0x79f91d)){for(var _0x40c05a in _0x79f91d){if(_0x79f91d[_0x52c9('0x2f')](_0x40c05a)){_0x3d6341['emitVoiceQueueChannelRemove'](_0x79f91d[_0x40c05a],_0x52c9('0x46'));delete _0x79f91d[_0x40c05a];}}}};VoiceQueueReport[_0x52c9('0xc')][_0x52c9('0x47')]=function(_0x1e9ac2,_0x2c21a5,_0x528a47){io['to'](_0x1e9ac2)['emit'](_0x2c21a5,_0x528a47);};VoiceQueueReport[_0x52c9('0xc')][_0x52c9('0x48')]=function(_0x382f38,_0x5f5d92){logger[_0x52c9('0x49')](_0x52c9('0x4a')+_0x5f5d92+']\x20sending\x20voice_queue_channel:save\x20event:',_0x382f38[_0x52c9('0x4b')],util[_0x52c9('0x42')](_0x382f38,{'showHidden':![],'depth':null}));this[_0x52c9('0x47')](util[_0x52c9('0x4c')](_0x52c9('0x4d'),_0x382f38['name']),_0x52c9('0x4e'),_0x382f38);};VoiceQueueReport[_0x52c9('0xc')][_0x52c9('0x4f')]=function(_0x3f8e55,_0x30ecc0){logger[_0x52c9('0x49')](_0x52c9('0x4a')+_0x30ecc0+_0x52c9('0x50'),_0x3f8e55[_0x52c9('0x4b')],util[_0x52c9('0x42')](_0x3f8e55,{'showHidden':![],'depth':null}));this[_0x52c9('0x47')](util[_0x52c9('0x4c')](_0x52c9('0x4d'),_0x3f8e55[_0x52c9('0x51')]),'voice_queue_channel:remove',_0x3f8e55);};VoiceQueueReport[_0x52c9('0xc')]['emitVoiceQueueSummary']=function(_0x127b9f,_0x4670fe){if(_0x127b9f[_0x52c9('0x52')]===_0x52c9('0x53')){var _0x3d886c={'id':_0x127b9f['id'],'name':_0x127b9f[_0x52c9('0x51')],'strategy':_0x127b9f[_0x52c9('0x54')],'answered':_0x127b9f[_0x52c9('0x55')],'available':_0x127b9f[_0x52c9('0x56')],'loggedIn':_0x127b9f[_0x52c9('0x57')],'pTalking':_0x127b9f[_0x52c9('0x32')],'sumBillable':_0x127b9f[_0x52c9('0x58')],'sumDuration':_0x127b9f[_0x52c9('0x59')],'sumHoldTime':_0x127b9f[_0x52c9('0x5a')]||0x0,'talking':_0x127b9f[_0x52c9('0x31')],'total':_0x127b9f[_0x52c9('0x5b')],'type':_0x127b9f[_0x52c9('0x52')],'unmanaged':_0x127b9f[_0x52c9('0x5c')],'abandoned':_0x127b9f[_0x52c9('0x5d')],'waiting':_0x127b9f[_0x52c9('0x5e')]};if(_0x127b9f[_0x52c9('0x5f')]){_0x3d886c[_0x52c9('0x5f')]={'id':_0x127b9f[_0x52c9('0x5f')]['id'],'name':_0x127b9f['Trunk'][_0x52c9('0x51')],'active':_0x127b9f['Trunk'][_0x52c9('0x60')],'callerid':_0x127b9f[_0x52c9('0x5f')][_0x52c9('0x61')]};}if(_0x127b9f['Interval']){_0x3d886c[_0x52c9('0x62')]={'id':_0x127b9f[_0x52c9('0x62')]['id'],'name':_0x127b9f[_0x52c9('0x62')][_0x52c9('0x51')]};}var _0x518e15=md5(JSON['stringify'](_0x3d886c));if(_0x127b9f[_0x52c9('0x2')]!==_0x518e15){_0x127b9f['md5']=_0x518e15;logger[_0x52c9('0x49')](_0x52c9('0x63')+_0x4670fe+_0x52c9('0x64'),util[_0x52c9('0x42')](_0x3d886c,{'showHidden':![],'depth':null}));this[_0x52c9('0x47')](util[_0x52c9('0x4c')](_0x52c9('0x4d'),_0x3d886c[_0x52c9('0x51')]),_0x52c9('0x65'),_0x3d886c);}}};VoiceQueueReport['prototype']['isNotNull']=function(_0x42a6cb){return _0x42a6cb!==null&&!_['isUndefined'](_0x42a6cb);};VoiceQueueReport[_0x52c9('0xc')][_0x52c9('0x2d')]=function(){var _0x214e74=this;setInterval(function(){_0x214e74[_0x52c9('0x35')]();ami[_0x52c9('0x3a')]({'action':_0x52c9('0x66')})[_0x52c9('0x3d')](function(_0x48614a){logger[_0x52c9('0x40')](_0x52c9('0x67'),util[_0x52c9('0x42')](_0x48614a,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x52c9('0xc')][_0x52c9('0x2c')]=function(){var _0x3d7240=this;setInterval(function(){if(_0x3d7240[_0x52c9('0x13')]){return ami[_0x52c9('0x3a')]({'action':_0x52c9('0x16')})[_0x52c9('0x68')](function(_0x31f79f){_0x3d7240['flagQueueSummary']=![];})[_0x52c9('0x3d')](function(_0xe0a23d){logger['error'](_0x52c9('0x69'),util[_0x52c9('0x42')](_0xe0a23d,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x52c9('0xc')][_0x52c9('0x17')]=function(_0x533762){try{if(this['isNotNull'](_0x533762)&&this[_0x52c9('0x6a')](_0x533762[_0x52c9('0x6b')])){logger[_0x52c9('0x49')]('[voiceQueueReport][queuesummary]\x20event:',util[_0x52c9('0x42')](_0x533762,{'showHidden':![],'depth':null}));if(this[_0x52c9('0x12')][_0x533762[_0x52c9('0x6b')]]){logger['info']('[voiceQueueReport][queuesummary]\x20name:%s',_0x533762[_0x52c9('0x6b')]);var _0x129273=_[_0x52c9('0x6c')](this[_0x52c9('0x10')],_0x52c9('0x6b'))[_0x533762[_0x52c9('0x6b')]]||0x0;var _0x55adbc=_0x129273-_0x533762[_0x52c9('0x6d')];if(this[_0x52c9('0x12')][_0x533762['queue']][_0x52c9('0x5e')]!==_['toNumber'](_0x533762[_0x52c9('0x6d')])||this[_0x52c9('0x12')][_0x533762[_0x52c9('0x6b')]]['loggedIn']!==_[_0x52c9('0x6e')](_0x533762[_0x52c9('0x6f')])||this[_0x52c9('0x12')][_0x533762[_0x52c9('0x6b')]][_0x52c9('0x56')]!==_[_0x52c9('0x6e')](_0x533762[_0x52c9('0x56')])||this[_0x52c9('0x12')][_0x533762[_0x52c9('0x6b')]][_0x52c9('0x31')]!==_0x55adbc){this[_0x52c9('0x12')][_0x533762['queue']][_0x52c9('0x5e')]=_['toNumber'](_0x533762[_0x52c9('0x6d')]);this['voiceQueues'][_0x533762[_0x52c9('0x6b')]][_0x52c9('0x57')]=_['toNumber'](_0x533762[_0x52c9('0x6f')]);this[_0x52c9('0x12')][_0x533762[_0x52c9('0x6b')]][_0x52c9('0x56')]=_[_0x52c9('0x6e')](_0x533762[_0x52c9('0x56')]);this['voiceQueues'][_0x533762[_0x52c9('0x6b')]]['talking']=_0x55adbc>0x0?_0x55adbc:0x0;this['voiceQueues'][_0x533762[_0x52c9('0x6b')]][_0x52c9('0x31')]=this['voiceQueues'][_0x533762['queue']][_0x52c9('0x31')]>_[_0x52c9('0x6e')](_0x533762['loggedin'])?_['toNumber'](_0x533762[_0x52c9('0x6f')]):this[_0x52c9('0x12')][_0x533762[_0x52c9('0x6b')]][_0x52c9('0x31')];this['emitVoiceQueueSummary'](this[_0x52c9('0x12')][_0x533762['queue']],_0x52c9('0x16'));}logger[_0x52c9('0x49')](_0x52c9('0x70'),util[_0x52c9('0x42')](this[_0x52c9('0x12')][_0x533762[_0x52c9('0x6b')]],{'showHidden':![],'depth':null}));ami[_0x52c9('0x47')](_0x52c9('0x71'),this[_0x52c9('0x12')][_0x533762['queue']]);}}}catch(_0x2aebf1){logger['error'](_0x52c9('0x69'),util[_0x52c9('0x42')](_0x2aebf1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x52c9('0xc')][_0x52c9('0x19')]=function(_0x55c399){logger[_0x52c9('0x49')](_0x52c9('0x72'),util[_0x52c9('0x42')](_0x55c399,{'showHidden':![],'depth':null}));this[_0x52c9('0x13')]=!![];};VoiceQueueReport[_0x52c9('0xc')][_0x52c9('0x1a')]=function(_0x3e223b){try{if(this[_0x52c9('0x6a')](_0x3e223b)){logger[_0x52c9('0x49')](_0x52c9('0x73'),_0x3e223b['uniqueid'],util[_0x52c9('0x42')](_0x3e223b,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x52c9('0xe')][_0x3e223b[_0x52c9('0x4b')]])){this['queueReports'][_0x3e223b[_0x52c9('0x4b')]]=[];this[_0x52c9('0x10')][_0x3e223b['uniqueid']]={};}var _0x123e8b=new QueueReport();_0x123e8b[_0x52c9('0x51')]=_0x3e223b[_0x52c9('0x6b')];_0x123e8b[_0x52c9('0x52')]=this['voiceQueues'][_0x123e8b[_0x52c9('0x51')]]&&this[_0x52c9('0x12')][_0x123e8b[_0x52c9('0x51')]]['type']?this[_0x52c9('0x12')][_0x123e8b[_0x52c9('0x51')]][_0x52c9('0x52')]||_0x52c9('0x53'):'inbound';_0x123e8b[_0x52c9('0x6b')]=_0x3e223b[_0x52c9('0x6b')];_0x123e8b[_0x52c9('0x74')]=moment()[_0x52c9('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x123e8b[_0x52c9('0x75')]=_0x3e223b['position'];_0x123e8b[_0x52c9('0x76')]=_0x3e223b[_0x52c9('0x76')];_0x123e8b['uniqueid']=_0x3e223b[_0x52c9('0x4b')];logger[_0x52c9('0x77')](_0x52c9('0x78'),_0x123e8b[_0x52c9('0x51')],_0x123e8b['type']);_['merge'](_0x123e8b,_[_0x52c9('0x79')](_0x3e223b,_['keys'](_0x123e8b)));this['queueReports'][_0x3e223b[_0x52c9('0x4b')]][_0x52c9('0x7a')](_0x123e8b);this[_0x52c9('0x10')][_0x3e223b[_0x52c9('0x4b')]]=_0x123e8b;this['emitVoiceQueueChannelSave'](_0x123e8b,'queuecallerjoin');}}catch(_0x14a7c0){logger[_0x52c9('0x40')](_0x52c9('0x73'),_0x3e223b[_0x52c9('0x4b')],util[_0x52c9('0x42')](_0x14a7c0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x52c9('0xc')]['syncQueueCallerAbandon']=function(_0x8d69cc){try{if(this[_0x52c9('0x6a')](_0x8d69cc)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x8d69cc['uniqueid'],util[_0x52c9('0x42')](_0x8d69cc,{'showHidden':![],'depth':null}));if(this[_0x52c9('0xe')][_0x8d69cc[_0x52c9('0x4b')]]){var _0x429b81=_[_0x52c9('0x7b')](this['queueReports'][_0x8d69cc[_0x52c9('0x4b')]]);_0x429b81['queuecallercomplete']=![];_0x429b81[_0x52c9('0x7c')]=null;_0x429b81['holdtime']=_0x8d69cc['holdtime'];_0x429b81[_0x52c9('0x7d')]=_0x8d69cc[_0x52c9('0x7d')];_0x429b81[_0x52c9('0x1b')]=!![];_0x429b81[_0x52c9('0x7e')]=moment()[_0x52c9('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x429b81['queuecallerexitreason']='ABANDONED';_0x429b81[_0x52c9('0x7f')]=null;logger[_0x52c9('0x77')](_0x52c9('0x80'),_0x429b81['name'],_0x429b81[_0x52c9('0x52')]);this['channels'][_0x8d69cc[_0x52c9('0x4b')]]=_0x429b81;this[_0x52c9('0x4f')](_0x429b81,'queuecallerabandon');}}}catch(_0x2ecd59){logger[_0x52c9('0x40')](_0x52c9('0x81'),_0x8d69cc[_0x52c9('0x4b')],util['inspect'](_0x2ecd59,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x52c9('0xc')][_0x52c9('0x1d')]=function(_0x491363){try{if(this[_0x52c9('0x6a')](_0x491363)){logger['debug'](_0x52c9('0x82'),_0x491363[_0x52c9('0x4b')],util[_0x52c9('0x42')](_0x491363,{'showHidden':![],'depth':null}));if(this[_0x52c9('0xe')][_0x491363[_0x52c9('0x4b')]]){var _0x5cce39=_[_0x52c9('0x7b')](this[_0x52c9('0xe')][_0x491363[_0x52c9('0x4b')]]);_0x5cce39[_0x52c9('0x83')]=moment()['format'](_0x52c9('0x84'));_0x5cce39[_0x52c9('0x85')]=_0x491363[_0x52c9('0x85')];_0x5cce39['connectedlinename']=_0x491363['connectedlinename'];logger[_0x52c9('0x77')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x5cce39['name'],_0x5cce39['type'],_0x491363[_0x52c9('0x85')],_0x491363['connectedlinename']);this['channels'][_0x491363[_0x52c9('0x4b')]]=_0x5cce39;this[_0x52c9('0x48')](_0x5cce39,_0x52c9('0x1c'));}}}catch(_0x7cb5c5){logger[_0x52c9('0x40')](_0x52c9('0x82'),_0x491363[_0x52c9('0x4b')],util[_0x52c9('0x42')](_0x7cb5c5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x52c9('0xc')]['syncAgentConnect']=function(_0x35b41b){try{if(this[_0x52c9('0x6a')](_0x35b41b)){logger[_0x52c9('0x49')]('[%s][voiceQueueReport][agentconnect]',_0x35b41b[_0x52c9('0x4b')],util[_0x52c9('0x42')](_0x35b41b,{'showHidden':![],'depth':null}));if(this[_0x52c9('0xe')][_0x35b41b[_0x52c9('0x4b')]]){var _0xcc4f47=_[_0x52c9('0x7b')](this[_0x52c9('0xe')][_0x35b41b[_0x52c9('0x4b')]]);_0xcc4f47[_0x52c9('0x86')]=!![];_0xcc4f47[_0x52c9('0x87')]=_0x52c9('0x88');logger[_0x52c9('0x77')](_0x52c9('0x89'),_0xcc4f47['name'],_0xcc4f47[_0x52c9('0x52')]);}}}catch(_0x5a4b56){logger[_0x52c9('0x40')](_0x52c9('0x8a'),_0x35b41b['uniqueid'],util[_0x52c9('0x42')](_0x5a4b56,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x52c9('0xc')][_0x52c9('0x1e')]=function(_0x44e1ff){try{if(this[_0x52c9('0x6a')](_0x44e1ff)){logger[_0x52c9('0x49')](_0x52c9('0x8b'),_0x44e1ff['uniqueid'],util['inspect'](_0x44e1ff,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x44e1ff[_0x52c9('0x4b')]]){var _0x28026d=_[_0x52c9('0x7b')](this[_0x52c9('0xe')][_0x44e1ff[_0x52c9('0x4b')]]);_0x28026d['queuecallerabandon']=![];_0x28026d['queuecallerabandonAt']=null;_0x28026d['assigned']=!![];_0x28026d[_0x52c9('0x7f')]=_0x44e1ff[_0x52c9('0x8c')];_0x28026d[_0x52c9('0x8d')]=_0x44e1ff[_0x52c9('0x8d')];_0x28026d['queuecallercomplete']=!![];_0x28026d[_0x52c9('0x8e')]=![];_0x28026d[_0x52c9('0x8f')]=null;if(!_0x28026d['transfer']){if(_0x44e1ff['reason']==_0x52c9('0x90')){_0x28026d[_0x52c9('0x87')]=_0x52c9('0x91');logger['info'](_0x52c9('0x92'),_0x28026d[_0x52c9('0x51')],_0x28026d[_0x52c9('0x52')]);}else{if(_[_0x52c9('0x93')](_0x44e1ff['channel'][_0x52c9('0x94')](),'local/')){if(this[_0x52c9('0xe')][_0x44e1ff[_0x52c9('0x95')]]){var _0x56c2b9=_[_0x52c9('0x7b')](this[_0x52c9('0xe')][_0x44e1ff[_0x52c9('0x95')]]);_0x56c2b9[_0x52c9('0x86')]=![];_0x56c2b9['queuecallerexit']=!![];_0x56c2b9[_0x52c9('0x8f')]=moment(_0x28026d['queuecallerjoinAt'])[_0x52c9('0x96')](_0x44e1ff[_0x52c9('0x8d')],_0x52c9('0x97'))[_0x52c9('0x4c')](_0x52c9('0x84'));_0x56c2b9['queuecallerexitreason']=_0x52c9('0x98');_0x56c2b9[_0x52c9('0x90')]=!![];_0x56c2b9[_0x52c9('0x99')]=_0x52c9('0x9a');_0x56c2b9[_0x52c9('0x9b')]=_0x44e1ff['destexten'];_0x56c2b9[_0x52c9('0x9c')]=_0x44e1ff['uniqueid'];logger[_0x52c9('0x77')](_0x52c9('0x9d'),_0x56c2b9['name'],_0x56c2b9['type']);var _0x2560fd=this[_0x52c9('0xe')][_0x44e1ff[_0x52c9('0x95')]];this[_0x52c9('0xe')][_0x44e1ff[_0x52c9('0x95')]]=this[_0x52c9('0xe')][_0x44e1ff[_0x52c9('0x4b')]];this['queueReports'][_0x44e1ff['uniqueid']]=_0x2560fd;}}else{_0x28026d[_0x52c9('0x87')]='COMPLETEDBY'+_0x44e1ff[_0x52c9('0x9e')][_0x52c9('0x9f')]();logger[_0x52c9('0x77')](_0x52c9('0xa0'),_0x28026d[_0x52c9('0x51')],_0x28026d['type'],_0x28026d[_0x52c9('0x87')]);}}}this[_0x52c9('0x10')][_0x44e1ff[_0x52c9('0x4b')]]=_0x28026d;this['emitVoiceQueueChannelRemove'](_0x28026d,'agentcomplete');}}}catch(_0x2d5cca){logger['error'](_0x52c9('0x8b'),_0x44e1ff[_0x52c9('0x4b')],util['inspect'](_0x2d5cca,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x52c9('0x22')]=function(_0x414d07){try{if(this[_0x52c9('0x6a')](_0x414d07)){logger[_0x52c9('0x49')](_0x52c9('0xa1'),_0x414d07['uniqueid'],util[_0x52c9('0x42')](_0x414d07,{'showHidden':![],'depth':null}));this[_0x52c9('0xa2')](_0x414d07[_0x52c9('0x4b')],_[_0x52c9('0xa3')](_0x414d07[_0x52c9('0xa4')])[0x0],_0x414d07[_0x52c9('0xa5')]);if(this[_0x52c9('0xe')][_0x414d07[_0x52c9('0x4b')]]){var _0x3bae76=_[_0x52c9('0x7b')](this[_0x52c9('0xe')][_0x414d07[_0x52c9('0x4b')]]);if(_0x3bae76){if(this[_0x52c9('0x6a')](_0x414d07[_0x52c9('0xa4')])&&this[_0x52c9('0x6a')](_0x414d07['variable'][_0x52c9('0xa6')])){switch(_0x414d07['value']){case _0x52c9('0xa7'):_0x3bae76['queuecallerexit']=![];_0x3bae76['queuecallerexitAt']=null;break;case'TIMEOUT':_0x3bae76[_0x52c9('0xa8')]=_0x52c9('0xa9');_0x3bae76[_0x52c9('0x8e')]=!![];_0x3bae76[_0x52c9('0x8f')]=moment()[_0x52c9('0x4c')](_0x52c9('0x84'));_0x3bae76[_0x52c9('0x83')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0x52c9('0x49')](_0x52c9('0xaa'),_0x414d07[_0x52c9('0x4b')],util[_0x52c9('0x42')](_0x3bae76,{'showHidden':![],'depth':null}));ami[_0x52c9('0x47')](_0x52c9('0xab'),_0x3bae76);break;default:_0x3bae76[_0x52c9('0x8e')]=!![];_0x3bae76['queuecallerexitAt']=moment()[_0x52c9('0x4c')](_0x52c9('0x84'));_0x3bae76[_0x52c9('0x83')]=moment()[_0x52c9('0x4c')](_0x52c9('0x84'));}_0x3bae76[_0x52c9('0x1b')]=![];_0x3bae76['queuecallerabandonAt']=null;_0x3bae76['queuecallerexitreason']=_0x414d07[_0x52c9('0xa5')];this[_0x52c9('0x10')][_0x414d07[_0x52c9('0x4b')]]=_0x3bae76;this[_0x52c9('0x4f')](_0x3bae76,_0x52c9('0x21'));}else if(this['isNotNull'](_0x414d07[_0x52c9('0xa4')])&&this[_0x52c9('0x6a')](_0x414d07['variable'][_0x52c9('0xac')])){if(!_0x3bae76['queuecallerabandon']){_0x3bae76['queuecallerexit']=!![];_0x3bae76[_0x52c9('0x8f')]=moment()[_0x52c9('0x4c')](_0x52c9('0x84'));_0x3bae76[_0x52c9('0x87')]=_0x52c9('0xad');_0x3bae76[_0x52c9('0x83')]=moment()[_0x52c9('0x4c')](_0x52c9('0x84'));this[_0x52c9('0x10')][_0x414d07[_0x52c9('0x4b')]]=_0x3bae76;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x414d07[_0x52c9('0x4b')],_0x3bae76['name'],_0x3bae76[_0x52c9('0x52')],_[_0x52c9('0xa3')](_0x414d07['variable'])[0x0],_0x414d07[_0x52c9('0xa5')]);_0x3bae76['variables']=this[_0x52c9('0x15')][_0x414d07['uniqueid']];}}}}catch(_0x1b1af4){logger[_0x52c9('0x40')](_0x52c9('0xa1'),_0x414d07[_0x52c9('0x4b')],util[_0x52c9('0x42')](_0x1b1af4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x52c9('0xc')][_0x52c9('0xa2')]=function(_0x45801,_0x68c38e,_0x59a542){var _0x40dd55=[_0x52c9('0xae'),_0x52c9('0xaf'),_0x52c9('0xb0'),_0x52c9('0xb1'),_0x52c9('0xb2'),_0x52c9('0xb3'),_0x52c9('0xb4'),'rtpaudioqosrttbridged',_0x52c9('0xb5'),_0x52c9('0xb6'),_0x52c9('0xb7'),_0x52c9('0xb8'),_0x52c9('0xb9'),'memberdynamic','memberinterface',_0x52c9('0xba'),_0x52c9('0x8c'),_0x52c9('0xbb'),'memberrealtime'];if(!_[_0x52c9('0x39')](_0x68c38e)&&!_[_0x52c9('0xbc')](_0x40dd55,_0x68c38e)){if(_[_0x52c9('0xbd')](this['variables'][_0x45801])){this[_0x52c9('0x15')][_0x45801]={};}this[_0x52c9('0x15')][_0x45801][_0x68c38e]=_0x59a542;}};VoiceQueueReport[_0x52c9('0xc')][_0x52c9('0x24')]=function(_0x5b8965){try{if(this['isNotNull'](_0x5b8965)){logger['debug'](_0x52c9('0xbe'),_0x5b8965[_0x52c9('0x4b')],util[_0x52c9('0x42')](_0x5b8965,{'showHidden':![],'depth':null}));if(this[_0x52c9('0xe')][_0x5b8965[_0x52c9('0x4b')]]){for(var _0x1fb1bd=0x0,_0x4daa14={};_0x1fb1bd0x0?_0x322ef8:0x0;this[_0x163b('0x12')][_0x3b4f77[_0x163b('0x64')]][_0x163b('0x2d')]=this[_0x163b('0x12')][_0x3b4f77[_0x163b('0x64')]][_0x163b('0x2d')]>_[_0x163b('0x6a')](_0x3b4f77[_0x163b('0x6b')])?_[_0x163b('0x6a')](_0x3b4f77[_0x163b('0x6b')]):this['voiceQueues'][_0x3b4f77[_0x163b('0x64')]][_0x163b('0x2d')];this[_0x163b('0x6c')](this[_0x163b('0x12')][_0x3b4f77[_0x163b('0x64')]],_0x163b('0x62'));}logger[_0x163b('0x45')](_0x163b('0x6d'),util[_0x163b('0x3c')](this[_0x163b('0x12')][_0x3b4f77[_0x163b('0x64')]],{'showHidden':![],'depth':null}));ami[_0x163b('0x43')]('custom:queuesummary',this[_0x163b('0x12')][_0x3b4f77[_0x163b('0x64')]]);}}}catch(_0x9b7756){logger[_0x163b('0x3b')]('[voiceQueueReport][queuesummary]',util[_0x163b('0x3c')](_0x9b7756,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x163b('0xb')][_0x163b('0x18')]=function(_0x2e8acf){logger['debug'](_0x163b('0x6e'),util['inspect'](_0x2e8acf,{'showHidden':![],'depth':null}));this[_0x163b('0x13')]=!![];};VoiceQueueReport['prototype'][_0x163b('0x1a')]=function(_0x3c4b9f){try{if(this['isNotNull'](_0x3c4b9f)){logger[_0x163b('0x45')](_0x163b('0x6f'),_0x3c4b9f[_0x163b('0x47')],util[_0x163b('0x3c')](_0x3c4b9f,{'showHidden':![],'depth':null}));if(_[_0x163b('0x5f')](this['queueReports'][_0x3c4b9f['uniqueid']])){this[_0x163b('0xf')][_0x3c4b9f[_0x163b('0x47')]]=[];this['channels'][_0x3c4b9f[_0x163b('0x47')]]={};}var _0x470d33=new QueueReport();_0x470d33[_0x163b('0x49')]=_0x3c4b9f[_0x163b('0x64')];_0x470d33[_0x163b('0x4d')]=this[_0x163b('0x12')][_0x470d33[_0x163b('0x49')]]&&this[_0x163b('0x12')][_0x470d33[_0x163b('0x49')]]['type']?this[_0x163b('0x12')][_0x470d33[_0x163b('0x49')]]['type']||_0x163b('0x4e'):'inbound';_0x470d33[_0x163b('0x64')]=_0x3c4b9f[_0x163b('0x64')];_0x470d33[_0x163b('0x70')]=moment()['format'](_0x163b('0x71'));_0x470d33[_0x163b('0x72')]=_0x3c4b9f['position'];_0x470d33[_0x163b('0x73')]=_0x3c4b9f['count'];_0x470d33[_0x163b('0x47')]=_0x3c4b9f[_0x163b('0x47')];logger[_0x163b('0x66')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x470d33['name'],_0x470d33[_0x163b('0x4d')]);_[_0x163b('0x74')](_0x470d33,_[_0x163b('0x75')](_0x3c4b9f,_[_0x163b('0x76')](_0x470d33)));this[_0x163b('0xf')][_0x3c4b9f[_0x163b('0x47')]]['push'](_0x470d33);this['channels'][_0x3c4b9f[_0x163b('0x47')]]=_0x470d33;this[_0x163b('0x44')](_0x470d33,'queuecallerjoin');}}catch(_0x2c2327){logger[_0x163b('0x3b')](_0x163b('0x6f'),_0x3c4b9f['uniqueid'],util[_0x163b('0x3c')](_0x2c2327,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x163b('0xb')]['syncQueueCallerAbandon']=function(_0x186079){try{if(this[_0x163b('0x5e')](_0x186079)){logger[_0x163b('0x45')]('[%s][voiceQueueReport][queuecallerabandon]',_0x186079['uniqueid'],util[_0x163b('0x3c')](_0x186079,{'showHidden':![],'depth':null}));if(this[_0x163b('0xf')][_0x186079[_0x163b('0x47')]]){var _0x1b702a=_[_0x163b('0x77')](this[_0x163b('0xf')][_0x186079[_0x163b('0x47')]]);_0x1b702a[_0x163b('0x78')]=![];_0x1b702a[_0x163b('0x79')]=null;_0x1b702a[_0x163b('0x7a')]=_0x186079['holdtime'];_0x1b702a[_0x163b('0x7b')]=_0x186079[_0x163b('0x7b')];_0x1b702a[_0x163b('0x7c')]=!![];_0x1b702a[_0x163b('0x7d')]=moment()[_0x163b('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x1b702a[_0x163b('0x7e')]=_0x163b('0x7f');_0x1b702a[_0x163b('0x80')]=null;logger[_0x163b('0x66')](_0x163b('0x81'),_0x1b702a['name'],_0x1b702a['type']);this[_0x163b('0x11')][_0x186079[_0x163b('0x47')]]=_0x1b702a;this[_0x163b('0x41')](_0x1b702a,_0x163b('0x7c'));}}}catch(_0x3aaeb6){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0x186079[_0x163b('0x47')],util['inspect'](_0x3aaeb6,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x163b('0x82')]=function(_0xaf4cb6){try{if(this[_0x163b('0x5e')](_0xaf4cb6)){logger[_0x163b('0x45')](_0x163b('0x83'),_0xaf4cb6[_0x163b('0x47')],util[_0x163b('0x3c')](_0xaf4cb6,{'showHidden':![],'depth':null}));if(this[_0x163b('0xf')][_0xaf4cb6[_0x163b('0x47')]]){var _0x14b0ff=_[_0x163b('0x77')](this[_0x163b('0xf')][_0xaf4cb6[_0x163b('0x47')]]);_0x14b0ff[_0x163b('0x84')]=moment()['format'](_0x163b('0x71'));_0x14b0ff[_0x163b('0x85')]=_0xaf4cb6['connectedlinenum'];_0x14b0ff[_0x163b('0x86')]=_0xaf4cb6[_0x163b('0x86')];logger[_0x163b('0x66')](_0x163b('0x87'),_0x14b0ff[_0x163b('0x49')],_0x14b0ff[_0x163b('0x4d')],_0xaf4cb6[_0x163b('0x85')],_0xaf4cb6[_0x163b('0x86')]);this['channels'][_0xaf4cb6[_0x163b('0x47')]]=_0x14b0ff;this[_0x163b('0x44')](_0x14b0ff,_0x163b('0x1b'));}}}catch(_0x1ee762){logger['error'](_0x163b('0x83'),_0xaf4cb6[_0x163b('0x47')],util['inspect'](_0x1ee762,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x163b('0x1f')]=function(_0x4679c9){try{if(this[_0x163b('0x5e')](_0x4679c9)){logger[_0x163b('0x45')]('[%s][voiceQueueReport][agentconnect]',_0x4679c9[_0x163b('0x47')],util[_0x163b('0x3c')](_0x4679c9,{'showHidden':![],'depth':null}));if(this[_0x163b('0xf')][_0x4679c9[_0x163b('0x47')]]){var _0x311420=_['last'](this['queueReports'][_0x4679c9[_0x163b('0x47')]]);_0x311420[_0x163b('0x78')]=!![];_0x311420['queuecallerexitreason']='COMPLETEDBYAGENT';logger[_0x163b('0x66')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x311420[_0x163b('0x49')],_0x311420['type']);}}}catch(_0x322dfc){logger[_0x163b('0x3b')](_0x163b('0x88'),_0x4679c9['uniqueid'],util[_0x163b('0x3c')](_0x322dfc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x163b('0xb')]['syncAgentComplete']=function(_0x5d6908){try{if(this[_0x163b('0x5e')](_0x5d6908)){logger[_0x163b('0x45')](_0x163b('0x89'),_0x5d6908[_0x163b('0x47')],util['inspect'](_0x5d6908,{'showHidden':![],'depth':null}));if(this[_0x163b('0xf')][_0x5d6908['uniqueid']]){var _0x11a7ad=_['last'](this['queueReports'][_0x5d6908[_0x163b('0x47')]]);_0x11a7ad['queuecallerabandon']=![];_0x11a7ad[_0x163b('0x7d')]=null;_0x11a7ad[_0x163b('0x8a')]=!![];_0x11a7ad[_0x163b('0x80')]=_0x5d6908[_0x163b('0x8b')];_0x11a7ad[_0x163b('0x7a')]=_0x5d6908[_0x163b('0x7a')];_0x11a7ad['queuecallercomplete']=!![];_0x11a7ad[_0x163b('0x8c')]=![];_0x11a7ad[_0x163b('0x8d')]=null;if(!_0x11a7ad[_0x163b('0x8e')]){if(_0x5d6908[_0x163b('0x8f')]==_0x163b('0x8e')){_0x11a7ad['queuecallerexitreason']=_0x163b('0x90');logger[_0x163b('0x66')](_0x163b('0x91'),_0x11a7ad[_0x163b('0x49')],_0x11a7ad[_0x163b('0x4d')]);}else{if(_[_0x163b('0x92')](_0x5d6908[_0x163b('0x37')][_0x163b('0x93')](),_0x163b('0x94'))){if(this['queueReports'][_0x5d6908['linkedid']]){var _0x62287e=_[_0x163b('0x77')](this[_0x163b('0xf')][_0x5d6908[_0x163b('0x95')]]);_0x62287e[_0x163b('0x78')]=![];_0x62287e[_0x163b('0x8c')]=!![];_0x62287e[_0x163b('0x8d')]=moment(_0x11a7ad[_0x163b('0x70')])['add'](_0x5d6908[_0x163b('0x7a')],_0x163b('0x96'))[_0x163b('0x4b')](_0x163b('0x71'));_0x62287e[_0x163b('0x7e')]=_0x163b('0x97');_0x62287e[_0x163b('0x8e')]=!![];_0x62287e[_0x163b('0x98')]=_0x163b('0x99');_0x62287e[_0x163b('0x9a')]=_0x5d6908[_0x163b('0x9b')];_0x62287e[_0x163b('0x9c')]=_0x5d6908[_0x163b('0x47')];logger[_0x163b('0x66')](_0x163b('0x9d'),_0x62287e[_0x163b('0x49')],_0x62287e['type']);var _0x5b13ce=this[_0x163b('0xf')][_0x5d6908[_0x163b('0x95')]];this[_0x163b('0xf')][_0x5d6908[_0x163b('0x95')]]=this[_0x163b('0xf')][_0x5d6908[_0x163b('0x47')]];this[_0x163b('0xf')][_0x5d6908[_0x163b('0x47')]]=_0x5b13ce;}}else{_0x11a7ad[_0x163b('0x7e')]=_0x163b('0x9e')+_0x5d6908[_0x163b('0x8f')][_0x163b('0x9f')]();logger[_0x163b('0x66')](_0x163b('0xa0'),_0x11a7ad[_0x163b('0x49')],_0x11a7ad['type'],_0x11a7ad[_0x163b('0x7e')]);}}}this[_0x163b('0x11')][_0x5d6908[_0x163b('0x47')]]=_0x11a7ad;this[_0x163b('0x41')](_0x11a7ad,_0x163b('0x1c'));}}}catch(_0x20d921){logger[_0x163b('0x3b')](_0x163b('0x89'),_0x5d6908[_0x163b('0x47')],util[_0x163b('0x3c')](_0x20d921,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x163b('0xb')][_0x163b('0x20')]=function(_0x2d516b){try{if(this[_0x163b('0x5e')](_0x2d516b)){logger[_0x163b('0x45')](_0x163b('0xa1'),_0x2d516b[_0x163b('0x47')],util[_0x163b('0x3c')](_0x2d516b,{'showHidden':![],'depth':null}));this[_0x163b('0xa2')](_0x2d516b['uniqueid'],_['keys'](_0x2d516b[_0x163b('0xa3')])[0x0],_0x2d516b[_0x163b('0xa4')]);if(this['queueReports'][_0x2d516b[_0x163b('0x47')]]){var _0x40c36b=_[_0x163b('0x77')](this[_0x163b('0xf')][_0x2d516b[_0x163b('0x47')]]);if(_0x40c36b){if(this[_0x163b('0x5e')](_0x2d516b[_0x163b('0xa3')])&&this[_0x163b('0x5e')](_0x2d516b[_0x163b('0xa3')]['queuestatus'])){switch(_0x2d516b['value']){case _0x163b('0xa5'):_0x40c36b[_0x163b('0x8c')]=![];_0x40c36b[_0x163b('0x8d')]=null;break;case'TIMEOUT':_0x40c36b[_0x163b('0xa6')]='timeout';_0x40c36b['queuecallerexit']=!![];_0x40c36b['queuecallerexitAt']=moment()[_0x163b('0x4b')](_0x163b('0x71'));_0x40c36b[_0x163b('0x84')]=moment()[_0x163b('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x163b('0x45')](_0x163b('0xa7'),_0x2d516b[_0x163b('0x47')],util[_0x163b('0x3c')](_0x40c36b,{'showHidden':![],'depth':null}));ami[_0x163b('0x43')]('custom:timeout',_0x40c36b);break;default:_0x40c36b[_0x163b('0x8c')]=!![];_0x40c36b[_0x163b('0x8d')]=moment()[_0x163b('0x4b')](_0x163b('0x71'));_0x40c36b['queuecallerleaveAt']=moment()['format'](_0x163b('0x71'));}_0x40c36b['queuecallerabandon']=![];_0x40c36b[_0x163b('0x7d')]=null;_0x40c36b[_0x163b('0x7e')]=_0x2d516b[_0x163b('0xa4')];this[_0x163b('0x11')][_0x2d516b[_0x163b('0x47')]]=_0x40c36b;this[_0x163b('0x41')](_0x40c36b,_0x163b('0xa8'));}else if(this[_0x163b('0x5e')](_0x2d516b['variable'])&&this[_0x163b('0x5e')](_0x2d516b[_0x163b('0xa3')]['queueposition'])){if(!_0x40c36b['queuecallerabandon']){_0x40c36b['queuecallerexit']=!![];_0x40c36b['queuecallerexitAt']=moment()[_0x163b('0x4b')](_0x163b('0x71'));_0x40c36b[_0x163b('0x7e')]=_0x163b('0xa9');_0x40c36b[_0x163b('0x84')]=moment()['format'](_0x163b('0x71'));this[_0x163b('0x11')][_0x2d516b['uniqueid']]=_0x40c36b;}}logger[_0x163b('0x66')](_0x163b('0xaa'),_0x2d516b['uniqueid'],_0x40c36b['name'],_0x40c36b[_0x163b('0x4d')],_['keys'](_0x2d516b[_0x163b('0xa3')])[0x0],_0x2d516b['value']);_0x40c36b[_0x163b('0x15')]=this[_0x163b('0x15')][_0x2d516b[_0x163b('0x47')]];}}}}catch(_0x42dcb8){logger['error'](_0x163b('0xa1'),_0x2d516b[_0x163b('0x47')],util[_0x163b('0x3c')](_0x42dcb8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x163b('0xb')][_0x163b('0xa2')]=function(_0x5080ed,_0x2a1c75,_0x410baf){var _0x381825=[_0x163b('0xab'),_0x163b('0xac'),_0x163b('0xad'),_0x163b('0xae'),'rtpaudioqosloss',_0x163b('0xaf'),_0x163b('0xb0'),_0x163b('0xb1'),_0x163b('0xb2'),_0x163b('0xb3'),_0x163b('0xb4'),_0x163b('0xb5'),_0x163b('0xb6'),_0x163b('0xb7'),'memberinterface',_0x163b('0xb8'),_0x163b('0x8b'),_0x163b('0xb9'),_0x163b('0xba')];if(!_['isNil'](_0x2a1c75)&&!_[_0x163b('0xbb')](_0x381825,_0x2a1c75)){if(_[_0x163b('0x5f')](this['variables'][_0x5080ed])){this[_0x163b('0x15')][_0x5080ed]={};}this[_0x163b('0x15')][_0x5080ed][_0x2a1c75]=_0x410baf;}};VoiceQueueReport[_0x163b('0xb')][_0x163b('0x21')]=function(_0x1dcf12){try{if(this[_0x163b('0x5e')](_0x1dcf12)){logger[_0x163b('0x45')](_0x163b('0xbc'),_0x1dcf12[_0x163b('0x47')],util[_0x163b('0x3c')](_0x1dcf12,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1dcf12[_0x163b('0x47')]]){for(var _0x532aab=0x0,_0x4dc105={};_0x532aab=0x0?moment(_0x2835a8['endtime'])['diff'](_0x2835a8[_0xb825('0x1b')],_0xb825('0xc')):null,'data1':_0xb825('0x1c'),'data2':_0x2835a8[_0xb825('0x12')],'data3':_0x2835a8[_0xb825('0xf')],'data4':_0x2835a8[_0xb825('0x1d')]||null,'role':_0xb825('0x11'),'internal':_0x2835a8[_0xb825('0x12')]?_[_0xb825('0x13')](_0x2835a8[_0xb825('0x12')]):undefined,'uniqueid':_0x2835a8[_0xb825('0x14')]},'log':_0xb825('0x15')});}; \ No newline at end of file +var _0x3615=['uniqueid','voice','starttime','endtime','diff','outbound','dialstring','moment','lodash','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','CreateMemberReport','lastAssignedTo','isNil','interface','SIP/%s','TALKING','queuecallerleaveAt','seconds','inbound','calleridnum','exten','queue','agent','accountcode','toNumber'];(function(_0x59d678,_0xb86fa9){var _0x378539=function(_0x56304e){while(--_0x56304e){_0x59d678['push'](_0x59d678['shift']());}};_0x378539(++_0xb86fa9);}(_0x3615,0x77));var _0x5361=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x3615[_0x4bfac3];return _0x15f0f2;};'use strict';var moment=require(_0x5361('0x0'));var _=require(_0x5361('0x1'));var util=require('util');var client=require(_0x5361('0x2'));exports[_0x5361('0x3')]=function(_0x13580e){var _0x4b8edd=_0x13580e[_0x5361('0x4')]||_0x13580e[_0x5361('0x5')];return client['Request'](_0x5361('0x6'),{'body':{'channel':'voice','membername':_0x13580e[_0x5361('0x7')],'interface':_[_0x5361('0x8')](_0x13580e[_0x5361('0x9')])?util['format'](_0x5361('0xa'),_0x13580e['lastAssignedTo']):_0x13580e[_0x5361('0x9')],'type':_0x5361('0xb'),'enterAt':_0x13580e[_0x5361('0xc')],'exitAt':_0x4b8edd,'duration':moment(_0x4b8edd)['diff'](_0x13580e[_0x5361('0xc')],_0x5361('0xd')),'data1':_0x5361('0xe'),'data2':_0x13580e[_0x5361('0xf')],'data3':_0x13580e[_0x5361('0x10')],'data4':null,'data5':_0x13580e[_0x5361('0x11')],'role':_0x5361('0x12'),'internal':_0x13580e[_0x5361('0x13')]?_[_0x5361('0x14')](_0x13580e[_0x5361('0x13')]):undefined,'uniqueid':_0x13580e[_0x5361('0x15')]},'log':_0x5361('0x6')});};exports['voiceDialReport']=function(_0x1d8687){return client['Request'](_0x5361('0x6'),{'body':{'channel':_0x5361('0x16'),'membername':_0x1d8687['membername'],'interface':_0x1d8687[_0x5361('0x9')],'type':'TALKING','enterAt':_0x1d8687[_0x5361('0x17')],'exitAt':_0x1d8687['endtime'],'duration':moment(_0x1d8687[_0x5361('0x18')])[_0x5361('0x19')](_0x1d8687[_0x5361('0x17')],_0x5361('0xd'))>=0x0?moment(_0x1d8687[_0x5361('0x18')])[_0x5361('0x19')](_0x1d8687['starttime'],_0x5361('0xd')):null,'data1':_0x5361('0x1a'),'data2':_0x1d8687[_0x5361('0x13')],'data3':_0x1d8687['exten'],'data4':_0x1d8687[_0x5361('0x1b')]||null,'role':_0x5361('0x12'),'internal':_0x1d8687['accountcode']?_['toNumber'](_0x1d8687[_0x5361('0x13')]):undefined,'uniqueid':_0x1d8687['uniqueid']},'log':_0x5361('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index bae6a62..db2693f 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 _0x153f=['GetTemplate','name','../client','getTemplates','Request'];(function(_0x1788d4,_0x14a03a){var _0x203b5c=function(_0x2e411a){while(--_0x2e411a){_0x1788d4['push'](_0x1788d4['shift']());}};_0x203b5c(++_0x14a03a);}(_0x153f,0x15b));var _0xf153=function(_0x2f7c74,_0x1835a6){_0x2f7c74=_0x2f7c74-0x0;var _0x4f4af5=_0x153f[_0x2f7c74];return _0x4f4af5;};'use strict';var client=require(_0xf153('0x0'));exports[_0xf153('0x1')]=function(_0xde7eae){return function(_0x44cea3){return client[_0xf153('0x2')](_0xf153('0x3'),{'options':{'raw':!![],'attributes':['id',_0xf153('0x4'),'html']},'log':_0xf153('0x3')});};}; \ No newline at end of file +var _0x536f=['../client','GetTemplate','name','html'];(function(_0x2af1a8,_0x2151ab){var _0x488f5b=function(_0x21ef73){while(--_0x21ef73){_0x2af1a8['push'](_0x2af1a8['shift']());}};_0x488f5b(++_0x2151ab);}(_0x536f,0x70));var _0xf536=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x536f[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xf536('0x0'));exports['getTemplates']=function(_0x4e4212){return function(_0x4c2e7e){return client['Request'](_0xf536('0x1'),{'options':{'raw':!![],'attributes':['id',_0xf536('0x2'),_0xf536('0x3')]},'log':_0xf536('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 0644e8f..17c121a 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 _0xca1d=['data2','data3','data4','data6','data7','getTriggers','Request','GetTrigger','name','channel','Condition','AllConditions','value','AnyConditions','field','Action','Actions','data1'];(function(_0x4ee355,_0x4beb49){var _0x23c901=function(_0x401ac4){while(--_0x401ac4){_0x4ee355['push'](_0x4ee355['shift']());}};_0x23c901(++_0x4beb49);}(_0xca1d,0xdd));var _0xdca1=function(_0x2c9111,_0x4a5757){_0x2c9111=_0x2c9111-0x0;var _0x590a56=_0xca1d[_0x2c9111];return _0x590a56;};'use strict';var client=require('../client');exports[_0xdca1('0x0')]=function(_0x390943){return function(_0x50bd31){return client[_0xdca1('0x1')](_0xdca1('0x2'),{'options':{'raw':![],'attributes':['id',_0xdca1('0x3'),_0xdca1('0x4'),'status'],'include':[{'model':_0xdca1('0x5'),'as':_0xdca1('0x6'),'attributes':['id','field','operator',_0xdca1('0x7')]},{'model':_0xdca1('0x5'),'as':_0xdca1('0x8'),'attributes':['id',_0xdca1('0x9'),'operator',_0xdca1('0x7')]},{'model':_0xdca1('0xa'),'as':_0xdca1('0xb'),'attributes':['id','action',_0xdca1('0xc'),_0xdca1('0xd'),_0xdca1('0xe'),_0xdca1('0xf'),'data5',_0xdca1('0x10'),_0xdca1('0x11')]}]},'log':_0xdca1('0x2')});};}; \ No newline at end of file +var _0xd2ae=['field','operator','AnyConditions','value','Action','action','data1','data2','data3','data5','data6','data7','getTriggers','Request','GetTrigger','name','status','Condition','AllConditions'];(function(_0x38d1ae,_0x5d2459){var _0x371fe3=function(_0x103c96){while(--_0x103c96){_0x38d1ae['push'](_0x38d1ae['shift']());}};_0x371fe3(++_0x5d2459);}(_0xd2ae,0x162));var _0xed2a=function(_0x43480b,_0x253501){_0x43480b=_0x43480b-0x0;var _0x4526d0=_0xd2ae[_0x43480b];return _0x4526d0;};'use strict';var client=require('../client');exports[_0xed2a('0x0')]=function(_0x484bcd){return function(_0x381ab3){return client[_0xed2a('0x1')](_0xed2a('0x2'),{'options':{'raw':![],'attributes':['id',_0xed2a('0x3'),'channel',_0xed2a('0x4')],'include':[{'model':_0xed2a('0x5'),'as':_0xed2a('0x6'),'attributes':['id',_0xed2a('0x7'),_0xed2a('0x8'),'value']},{'model':_0xed2a('0x5'),'as':_0xed2a('0x9'),'attributes':['id','field',_0xed2a('0x8'),_0xed2a('0xa')]},{'model':_0xed2a('0xb'),'as':'Actions','attributes':['id',_0xed2a('0xc'),_0xed2a('0xd'),_0xed2a('0xe'),_0xed2a('0xf'),'data4',_0xed2a('0x10'),_0xed2a('0x11'),_0xed2a('0x12')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index c3151ca..7ff0219 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 _0xdd37=['GetTrunk','name','registry','../client'];(function(_0x47b282,_0x1b96d2){var _0xccd534=function(_0x547293){while(--_0x547293){_0x47b282['push'](_0x47b282['shift']());}};_0xccd534(++_0x1b96d2);}(_0xdd37,0xef));var _0x7dd3=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xdd37[_0x5b561d];return _0x431060;};'use strict';var client=require(_0x7dd3('0x0'));exports['getTrunks']=function(_0x975169){return function(_0x445fe3){return client['Request'](_0x7dd3('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x7dd3('0x2'),_0x7dd3('0x3')]},'log':_0x7dd3('0x1')});};}; \ No newline at end of file +var _0xbc13=['Request','name','registry','../client','getTrunks'];(function(_0x33376f,_0x389dd8){var _0xf924ae=function(_0xd5dfa1){while(--_0xd5dfa1){_0x33376f['push'](_0x33376f['shift']());}};_0xf924ae(++_0x389dd8);}(_0xbc13,0x9e));var _0x3bc1=function(_0x8c8176,_0x5360a1){_0x8c8176=_0x8c8176-0x0;var _0x4dc47b=_0xbc13[_0x8c8176];return _0x4dc47b;};'use strict';var client=require(_0x3bc1('0x0'));exports[_0x3bc1('0x1')]=function(_0x53f056){return function(_0x313b82){return client[_0x3bc1('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x3bc1('0x3'),_0x3bc1('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 8842ede..4be6699 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 _0xdbb2=['saveUnpause','UnpauseUser','ShowUser','interface','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','pauseType','lastPauseAt','voicePause','phone','mobile','getTelephones','internal','savePause','PauseUser'];(function(_0x40128d,_0x429c3a){var _0x2df122=function(_0x48d48c){while(--_0x48d48c){_0x40128d['push'](_0x40128d['shift']());}};_0x2df122(++_0x429c3a);}(_0xdbb2,0xd4));var _0x2dbb=function(_0x3a73bc,_0x550aef){_0x3a73bc=_0x3a73bc-0x0;var _0x32891b=_0xdbb2[_0x3a73bc];return _0x32891b;};'use strict';var client=require(_0x2dbb('0x0'));exports[_0x2dbb('0x1')]=function(){return function(){return client[_0x2dbb('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x2dbb('0x3')},'attributes':['id',_0x2dbb('0x4'),_0x2dbb('0x5'),_0x2dbb('0x6'),_0x2dbb('0x7'),_0x2dbb('0x8'),'lastLoginAt',_0x2dbb('0x9'),_0x2dbb('0xa'),_0x2dbb('0xb'),_0x2dbb('0xc'),_0x2dbb('0xd'),'interface']},'log':_0x2dbb('0x1')});};};exports[_0x2dbb('0xe')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x2dbb('0x4'),_0x2dbb('0x6'),_0x2dbb('0xf')]},'log':_0x2dbb('0xe')});};};exports[_0x2dbb('0x10')]=function(_0x291aea,_0x1b0672,_0x4a4814){return client['Request'](_0x2dbb('0x11'),{'body':{'type':_0x1b0672,'uniqueid':_0x4a4814},'options':{'where':{'id':_0x291aea['id']}},'log':_0x2dbb('0x10')});};exports[_0x2dbb('0x12')]=function(_0x2f5316){return client[_0x2dbb('0x2')](_0x2dbb('0x13'),{'body':{},'options':{'where':{'id':_0x2f5316['id']}},'log':_0x2dbb('0x10')});};exports['getAgent']=function(_0x371eed){return client['Request'](_0x2dbb('0x14'),{'options':{'raw':![],'where':{'role':'agent','id':_0x371eed},'attributes':['id','name',_0x2dbb('0x5'),_0x2dbb('0x6'),_0x2dbb('0x7'),_0x2dbb('0x8'),'lastLoginAt',_0x2dbb('0x9'),_0x2dbb('0xa'),_0x2dbb('0xb'),_0x2dbb('0x15')]},'log':_0x2dbb('0x16')});}; \ No newline at end of file +var _0x4860=['email','voicePause','../client','Request','GetUser','name','accountcode','online','lastLoginAt','pauseType','mobile','interface','getAgents','getTelephones','internal','savePause','saveUnpause','getAgent','ShowUser','agent'];(function(_0x283cf6,_0x14e096){var _0x4b40e5=function(_0xd340e5){while(--_0xd340e5){_0x283cf6['push'](_0x283cf6['shift']());}};_0x4b40e5(++_0x14e096);}(_0x4860,0xf2));var _0x0486=function(_0x56a0ff,_0x5c8f39){_0x56a0ff=_0x56a0ff-0x0;var _0x4763ca=_0x4860[_0x56a0ff];return _0x4763ca;};'use strict';var client=require(_0x0486('0x0'));exports['getAgents']=function(){return function(){return client[_0x0486('0x1')](_0x0486('0x2'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0486('0x3'),'email',_0x0486('0x4'),'fullname',_0x0486('0x5'),_0x0486('0x6'),_0x0486('0x7'),'lastPauseAt','voicePause','phone',_0x0486('0x8'),_0x0486('0x9')]},'log':_0x0486('0xa')});};};exports[_0x0486('0xb')]=function(){return function(){return client[_0x0486('0x1')](_0x0486('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id','name',_0x0486('0x4'),_0x0486('0xc')]},'log':'getTelephones'});};};exports[_0x0486('0xd')]=function(_0x295487,_0x35142d,_0x14b76c){return client['Request']('PauseUser',{'body':{'type':_0x35142d,'uniqueid':_0x14b76c},'options':{'where':{'id':_0x295487['id']}},'log':_0x0486('0xd')});};exports[_0x0486('0xe')]=function(_0x1059aa){return client[_0x0486('0x1')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x1059aa['id']}},'log':_0x0486('0xd')});};exports[_0x0486('0xf')]=function(_0x5249b4){return client[_0x0486('0x1')](_0x0486('0x10'),{'options':{'raw':![],'where':{'role':_0x0486('0x11'),'id':_0x5249b4},'attributes':['id',_0x0486('0x3'),_0x0486('0x12'),'accountcode','fullname',_0x0486('0x5'),_0x0486('0x6'),_0x0486('0x7'),'lastPauseAt',_0x0486('0x13'),'interface']},'log':_0x0486('0xf')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index bde2d76..51e4fc7 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 _0x0cee=['create','Request','CreateVoiceAgentReport','update','../client'];(function(_0x4cf944,_0x1d22e2){var _0x2f14fe=function(_0x5d840f){while(--_0x5d840f){_0x4cf944['push'](_0x4cf944['shift']());}};_0x2f14fe(++_0x1d22e2);}(_0x0cee,0x185));var _0xe0ce=function(_0x221936,_0x45db93){_0x221936=_0x221936-0x0;var _0xa869a5=_0x0cee[_0x221936];return _0xa869a5;};'use strict';var client=require(_0xe0ce('0x0'));exports[_0xe0ce('0x1')]=function(_0x146690){return client[_0xe0ce('0x2')](_0xe0ce('0x3'),{'body':_0x146690,'log':_0xe0ce('0x3')});};exports[_0xe0ce('0x4')]=function(_0x802261,_0x597802,_0x1e4818){return client['Request']('UpdateVoiceAgentReport',{'body':_0x802261,'options':{'where':{'uniqueid':_0x597802,'interface':_0x1e4818,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x2d6a=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x52b28f,_0xbd8bcb){var _0x51851c=function(_0x53433c){while(--_0x53433c){_0x52b28f['push'](_0x52b28f['shift']());}};_0x51851c(++_0xbd8bcb);}(_0x2d6a,0x16a));var _0xa2d6=function(_0x43a4f0,_0x5a43f3){_0x43a4f0=_0x43a4f0-0x0;var _0x365c48=_0x2d6a[_0x43a4f0];return _0x365c48;};'use strict';var client=require(_0xa2d6('0x0'));exports[_0xa2d6('0x1')]=function(_0xba1381){return client[_0xa2d6('0x2')](_0xa2d6('0x3'),{'body':_0xba1381,'log':'CreateVoiceAgentReport'});};exports[_0xa2d6('0x4')]=function(_0x373ffa,_0x13d93d,_0xc802a1){return client[_0xa2d6('0x2')](_0xa2d6('0x5'),{'body':_0x373ffa,'options':{'where':{'uniqueid':_0x13d93d,'interface':_0xc802a1,'agentcomplete':!![]}},'log':_0xa2d6('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 5d9ef09..d7a66c3 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 _0xeb2d=['DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','duration','GetVoiceCallReports','moment','lodash','Request','CreateVoiceCallReport','merge','calleridnum','callerid'];(function(_0x329f9b,_0x236f00){var _0x39059a=function(_0x4d527d){while(--_0x4d527d){_0x329f9b['push'](_0x329f9b['shift']());}};_0x39059a(++_0x236f00);}(_0xeb2d,0x13c));var _0xdeb2=function(_0x400e1c,_0x2408d3){_0x400e1c=_0x400e1c-0x0;var _0x188184=_0xeb2d[_0x400e1c];return _0x188184;};'use strict';var moment=require(_0xdeb2('0x0'));var util=require('util');var _=require(_0xdeb2('0x1'));var client=require('../client');exports['create']=function(_0x1bf09f){return client[_0xdeb2('0x2')](_0xdeb2('0x3'),{'body':_[_0xdeb2('0x4')](_0x1bf09f,{'source':_0x1bf09f[_0xdeb2('0x5')],'destinationcontext':_0x1bf09f['context'],'callerid':_0x1bf09f[_0xdeb2('0x6')],'amaflags':_0xdeb2('0x7')}),'log':_0xdeb2('0x3')});};exports[_0xdeb2('0x8')]=function(){return function(){return client[_0xdeb2('0x2')](_0xdeb2('0x9'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf'](_0xdeb2('0xa'))[_0xdeb2('0xb')](_0xdeb2('0xc')),moment()[_0xdeb2('0xd')](_0xdeb2('0xa'))[_0xdeb2('0xb')](_0xdeb2('0xc'))]}},'attributes':[_0xdeb2('0xe'),'disposition',_0xdeb2('0xf'),'billableseconds']},'log':_0xdeb2('0x10')});};}; \ No newline at end of file +var _0xf0b8=['GetVoiceCallReports','moment','util','create','Request','calleridnum','context','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','outbound','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','disposition','billableseconds'];(function(_0x241207,_0x39a50c){var _0x26f4ce=function(_0x5b9184){while(--_0x5b9184){_0x241207['push'](_0x241207['shift']());}};_0x26f4ce(++_0x39a50c);}(_0xf0b8,0x65));var _0x8f0b=function(_0x23cb43,_0xaea40b){_0x23cb43=_0x23cb43-0x0;var _0x3987c6=_0xf0b8[_0x23cb43];return _0x3987c6;};'use strict';var moment=require(_0x8f0b('0x0'));var util=require(_0x8f0b('0x1'));var _=require('lodash');var client=require('../client');exports[_0x8f0b('0x2')]=function(_0x4311d9){return client[_0x8f0b('0x3')]('CreateVoiceCallReport',{'body':_['merge'](_0x4311d9,{'source':_0x4311d9[_0x8f0b('0x4')],'destinationcontext':_0x4311d9[_0x8f0b('0x5')],'callerid':_0x4311d9[_0x8f0b('0x6')],'amaflags':_0x8f0b('0x7')}),'log':_0x8f0b('0x8')});};exports[_0x8f0b('0x9')]=function(){return function(){return client[_0x8f0b('0x3')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x8f0b('0xa')],'createdAt':{'$between':[moment()[_0x8f0b('0xb')]('day')[_0x8f0b('0xc')](_0x8f0b('0xd')),moment()[_0x8f0b('0xe')](_0x8f0b('0xf'))[_0x8f0b('0xc')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x8f0b('0x10'),_0x8f0b('0x11'),'duration',_0x8f0b('0x12')]},'log':_0x8f0b('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index b9c398e..cc11453 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 _0x4725=['Request','CreateVoiceDialReport','../client','create'];(function(_0x552da1,_0x167baf){var _0x546470=function(_0x44fe07){while(--_0x44fe07){_0x552da1['push'](_0x552da1['shift']());}};_0x546470(++_0x167baf);}(_0x4725,0x106));var _0x5472=function(_0x5a738f,_0x299280){_0x5a738f=_0x5a738f-0x0;var _0x230c6d=_0x4725[_0x5a738f];return _0x230c6d;};'use strict';var client=require(_0x5472('0x0'));exports[_0x5472('0x1')]=function(_0x3e68ab){return client[_0x5472('0x2')](_0x5472('0x3'),{'body':_0x3e68ab,'log':_0x5472('0x3')});}; \ No newline at end of file +var _0xf50d=['create','Request','CreateVoiceDialReport','../client'];(function(_0x357862,_0x33c087){var _0x2858ae=function(_0x58c53c){while(--_0x58c53c){_0x357862['push'](_0x357862['shift']());}};_0x2858ae(++_0x33c087);}(_0xf50d,0x83));var _0xdf50=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0xf50d[_0x39c734];return _0xb2a2f9;};'use strict';var client=require(_0xdf50('0x0'));exports[_0xdf50('0x1')]=function(_0x24c951){return client[_0xdf50('0x2')](_0xdf50('0x3'),{'body':_0x24c951,'log':_0xdf50('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index e88fa65..da12f9d 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 _0xbc6f=['recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension','exten'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xbc6f,0x127));var _0xfbc6=function(_0x2081aa,_0x31d653){_0x2081aa=_0x2081aa-0x0;var _0x36485d=_0xbc6f[_0x2081aa];return _0x36485d;};'use strict';var client=require(_0xfbc6('0x0'));exports[_0xfbc6('0x1')]=function(){return function(){return client[_0xfbc6('0x2')](_0xfbc6('0x3'),{'options':{'raw':!![],'attributes':['id',_0xfbc6('0x4'),_0xfbc6('0x5')],'where':{'VoiceExtensionId':null}},'log':_0xfbc6('0x1')});};}; \ No newline at end of file +var _0x1c7c=['recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x31ccd1,_0x106ce5){var _0x36f09b=function(_0x15796a){while(--_0x15796a){_0x31ccd1['push'](_0x31ccd1['shift']());}};_0x36f09b(++_0x106ce5);}(_0x1c7c,0x164));var _0xc1c7=function(_0x329eb9,_0x19ef2b){_0x329eb9=_0x329eb9-0x0;var _0x11d741=_0x1c7c[_0x329eb9];return _0x11d741;};'use strict';var client=require(_0xc1c7('0x0'));exports[_0xc1c7('0x1')]=function(){return function(){return client[_0xc1c7('0x2')](_0xc1c7('0x3'),{'options':{'raw':!![],'attributes':['id','exten',_0xc1c7('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 bfbe79e..df127fe 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 _0x7d73=['dialDropMaxRetry','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','Trunk','active','Pause','mandatoryDispositionPause','TrunkBackup','callerid','Interval','Intervals','interval','getVoiceQueues','../client','GetVoiceQueue','name','acw','autopause','monitor_format','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x7d73,0xc5));var _0x37d7=function(_0x41c381,_0x1176bd){_0x41c381=_0x41c381-0x0;var _0x427981=_0x7d73[_0x41c381];return _0x427981;};'use strict';var client=require(_0x37d7('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request'](_0x37d7('0x1'),{'options':{'raw':![],'attributes':['id',_0x37d7('0x2'),_0x37d7('0x3'),'acwTimeout',_0x37d7('0x4'),_0x37d7('0x5'),'type','dialActive',_0x37d7('0x6'),_0x37d7('0x7'),_0x37d7('0x8'),_0x37d7('0x9'),_0x37d7('0xa'),_0x37d7('0xb'),_0x37d7('0xc'),_0x37d7('0xd'),_0x37d7('0xe'),_0x37d7('0xf'),_0x37d7('0x10'),_0x37d7('0x11'),_0x37d7('0x12'),_0x37d7('0x13'),'dialCongestionRetryFrequency','dialBusyMaxRetry',_0x37d7('0x14'),_0x37d7('0x15'),_0x37d7('0x16'),_0x37d7('0x17'),_0x37d7('0x18'),_0x37d7('0x19'),_0x37d7('0x1a'),_0x37d7('0x1b'),_0x37d7('0x1c'),_0x37d7('0x1d'),'dialAMDGreeting',_0x37d7('0x1e'),_0x37d7('0x1f'),_0x37d7('0x20'),'dialAMDBetweenWordsSilence',_0x37d7('0x21'),_0x37d7('0x22'),_0x37d7('0x23'),'timeout',_0x37d7('0x24'),'dialRecallInQueue','dialOrderByScheduledAt',_0x37d7('0x25'),_0x37d7('0x26'),_0x37d7('0x27'),_0x37d7('0x5'),'strategy',_0x37d7('0x28'),'dialCutDigit',_0x37d7('0x29'),_0x37d7('0x2a'),_0x37d7('0x2b'),'dialDropRetryFrequency',_0x37d7('0x2c'),'dialAbandonedRetryFrequency',_0x37d7('0x2d'),_0x37d7('0x2e'),'dialAgentRejectMaxRetry',_0x37d7('0x2f'),_0x37d7('0x30'),'dialPredictiveIntervalMaxThreshold',_0x37d7('0x31')],'include':[{'model':_0x37d7('0x32'),'as':_0x37d7('0x32'),'attributes':['id',_0x37d7('0x2'),'callerid',_0x37d7('0x33')]},{'model':_0x37d7('0x34'),'as':_0x37d7('0x35'),'attributes':['id',_0x37d7('0x2')]},{'model':_0x37d7('0x32'),'as':_0x37d7('0x36'),'attributes':['id',_0x37d7('0x2'),_0x37d7('0x37'),_0x37d7('0x33')]},{'model':_0x37d7('0x38'),'as':_0x37d7('0x38'),'attributes':['id',_0x37d7('0x2')],'include':[{'model':'Interval','as':_0x37d7('0x39'),'attributes':['id','name',_0x37d7('0x3a')]}]}]},'log':_0x37d7('0x3b')});};}; \ No newline at end of file +var _0xb072=['dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','callerid','active','Pause','TrunkBackup','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency'];(function(_0x5835d6,_0x3f4368){var _0x28c897=function(_0x176c85){while(--_0x176c85){_0x5835d6['push'](_0x5835d6['shift']());}};_0x28c897(++_0x3f4368);}(_0xb072,0xd9));var _0x2b07=function(_0x219cd8,_0x3d26e7){_0x219cd8=_0x219cd8-0x0;var _0x339d00=_0xb072[_0x219cd8];return _0x339d00;};'use strict';var client=require(_0x2b07('0x0'));exports[_0x2b07('0x1')]=function(){return function(){return client[_0x2b07('0x2')](_0x2b07('0x3'),{'options':{'raw':![],'attributes':['id',_0x2b07('0x4'),_0x2b07('0x5'),_0x2b07('0x6'),_0x2b07('0x7'),_0x2b07('0x8'),_0x2b07('0x9'),_0x2b07('0xa'),_0x2b07('0xb'),'dialLimitChannel',_0x2b07('0xc'),_0x2b07('0xd'),_0x2b07('0xe'),_0x2b07('0xf'),'dialPredictiveInterval',_0x2b07('0x10'),_0x2b07('0x11'),_0x2b07('0x12'),_0x2b07('0x13'),_0x2b07('0x14'),_0x2b07('0x15'),_0x2b07('0x16'),_0x2b07('0x17'),_0x2b07('0x18'),'dialBusyRetryFrequency',_0x2b07('0x19'),_0x2b07('0x1a'),'dialGlobalMaxRetry',_0x2b07('0x1b'),_0x2b07('0x1c'),_0x2b07('0x1d'),'dialCheckDuplicateType',_0x2b07('0x1e'),_0x2b07('0x1f'),'dialAMDGreeting','dialAMDAfterGreetingSilence',_0x2b07('0x20'),_0x2b07('0x21'),_0x2b07('0x22'),_0x2b07('0x23'),_0x2b07('0x24'),'dialAMDMaximumWordLength','timeout','dialRecallMeTimeout',_0x2b07('0x25'),_0x2b07('0x26'),_0x2b07('0x27'),'dialAgiAfterHangupClient','dialQueueProject2',_0x2b07('0x8'),_0x2b07('0x28'),_0x2b07('0x29'),_0x2b07('0x2a'),_0x2b07('0x2b'),_0x2b07('0x2c'),_0x2b07('0x2d'),_0x2b07('0x2e'),'dialAbandonedMaxRetry',_0x2b07('0x2f'),_0x2b07('0x30'),_0x2b07('0x31'),_0x2b07('0x32'),_0x2b07('0x33'),_0x2b07('0x34'),_0x2b07('0x35'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0x2b07('0x36'),'as':_0x2b07('0x36'),'attributes':['id',_0x2b07('0x4'),_0x2b07('0x37'),_0x2b07('0x38')]},{'model':_0x2b07('0x39'),'as':'mandatoryDispositionPause','attributes':['id',_0x2b07('0x4')]},{'model':_0x2b07('0x36'),'as':_0x2b07('0x3a'),'attributes':['id',_0x2b07('0x4'),_0x2b07('0x37'),_0x2b07('0x38')]},{'model':_0x2b07('0x3b'),'as':_0x2b07('0x3b'),'attributes':['id',_0x2b07('0x4')],'include':[{'model':_0x2b07('0x3b'),'as':_0x2b07('0x3c'),'attributes':['id',_0x2b07('0x4'),'interval']}]}]},'log':_0x2b07('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index e9db92d..5f8e243 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 _0xe408=['GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandonAt','GetVoiceQueueReports','moment','Request','CreateVoiceQueueReport'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0xe408,0x74));var _0x8e40=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0xe408[_0x4a3898];return _0x25ceb0;};'use strict';var moment=require(_0x8e40('0x0'));var _=require('lodash');var client=require('../client');exports['create']=function(_0x294b0e){return client[_0x8e40('0x1')](_0x8e40('0x2'),{'body':_0x294b0e,'log':'CreateVoiceQueueReport'});};exports['getVoiceQueueReports']=function(){return function(){return client[_0x8e40('0x1')](_0x8e40('0x3'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x8e40('0x4')]('day')[_0x8e40('0x5')](_0x8e40('0x6')),moment()[_0x8e40('0x7')]('day')[_0x8e40('0x5')](_0x8e40('0x6'))]}},'attributes':[_0x8e40('0x8'),_0x8e40('0x9'),_0x8e40('0xa'),_0x8e40('0xb'),'queuecallercomplete',_0x8e40('0xc'),_0x8e40('0xd'),_0x8e40('0xe'),'queuecallerabandon',_0x8e40('0xf')]},'log':_0x8e40('0x10')});};}; \ No newline at end of file +var _0x7b37=['queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','moment','lodash','../client','getVoiceQueueReports','Request','GetVoiceQueueReport','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queuecallerjoinAt','queuecallerleaveAt'];(function(_0x1daafe,_0x267d1f){var _0x3c9b42=function(_0x2cc364){while(--_0x2cc364){_0x1daafe['push'](_0x1daafe['shift']());}};_0x3c9b42(++_0x267d1f);}(_0x7b37,0xf6));var _0x77b3=function(_0x5aefb7,_0x5b771e){_0x5aefb7=_0x5aefb7-0x0;var _0x1f2ad=_0x7b37[_0x5aefb7];return _0x1f2ad;};'use strict';var moment=require(_0x77b3('0x0'));var _=require(_0x77b3('0x1'));var client=require(_0x77b3('0x2'));exports['create']=function(_0x15150e){return client['Request']('CreateVoiceQueueReport',{'body':_0x15150e,'log':'CreateVoiceQueueReport'});};exports[_0x77b3('0x3')]=function(){return function(){return client[_0x77b3('0x4')](_0x77b3('0x5'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x77b3('0x6')](_0x77b3('0x7'))[_0x77b3('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x77b3('0x9')]('day')['format'](_0x77b3('0xa'))]}},'attributes':[_0x77b3('0xb'),'queue',_0x77b3('0xc'),_0x77b3('0xd'),_0x77b3('0xe'),_0x77b3('0xf'),_0x77b3('0x10'),_0x77b3('0x11'),_0x77b3('0x12'),_0x77b3('0x13')]},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 7d4b546..1ed9365 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 _0xef15=['getVoiceQueueRtPauses'];(function(_0x1e54a7,_0x4e7ea3){var _0x41d78e=function(_0xbf0801){while(--_0xbf0801){_0x1e54a7['push'](_0x1e54a7['shift']());}};_0x41d78e(++_0x4e7ea3);}(_0xef15,0x1c1));var _0x5ef1=function(_0x5497d3,_0x193adf){_0x5497d3=_0x5497d3-0x0;var _0x42f1ef=_0xef15[_0x5497d3];return _0x42f1ef;};'use strict';var client=require('../client');exports[_0x5ef1('0x0')]=function(_0x1251c0){return function(){return client['Request']('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x1251c0,'paused':!![]},'raw':!![]},'log':_0x5ef1('0x0')});};}; \ No newline at end of file +var _0xd227=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','Request'];(function(_0x9d67fa,_0x1dd6de){var _0x5ed4ac=function(_0x1073f2){while(--_0x1073f2){_0x9d67fa['push'](_0x9d67fa['shift']());}};_0x5ed4ac(++_0x1dd6de);}(_0xd227,0xa6));var _0x7d22=function(_0x1c8c07,_0x2579af){_0x1c8c07=_0x1c8c07-0x0;var _0x4aa88f=_0xd227[_0x1c8c07];return _0x4aa88f;};'use strict';var client=require('../client');exports[_0x7d22('0x0')]=function(_0x3adc7f){return function(){return client[_0x7d22('0x1')](_0x7d22('0x2'),{'options':{'where':{'VoiceQueueId':_0x3adc7f,'paused':!![]},'raw':!![]},'log':_0x7d22('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index fb79db7..d123440 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 _0xa1a8=['Request','CreateVoiceRecording','merge','lodash','../client'];(function(_0x23dc02,_0x55ceaf){var _0x3d4bff=function(_0x131ab5){while(--_0x131ab5){_0x23dc02['push'](_0x23dc02['shift']());}};_0x3d4bff(++_0x55ceaf);}(_0xa1a8,0x1ac));var _0x8a1a=function(_0x8bca06,_0x3ff897){_0x8bca06=_0x8bca06-0x0;var _0x3cc8a3=_0xa1a8[_0x8bca06];return _0x3cc8a3;};'use strict';var _=require(_0x8a1a('0x0'));var client=require(_0x8a1a('0x1'));exports['create']=function(_0xe95082){return client[_0x8a1a('0x2')](_0x8a1a('0x3'),{'body':_[_0x8a1a('0x4')](_0xe95082,{'value':_0xe95082['monitorFilename']}),'log':_0x8a1a('0x3')});}; \ No newline at end of file +var _0xe0d5=['CreateVoiceRecording','merge','monitorFilename','../client','Request'];(function(_0x390545,_0x3d45f4){var _0x42d036=function(_0x4e8abe){while(--_0x4e8abe){_0x390545['push'](_0x390545['shift']());}};_0x42d036(++_0x3d45f4);}(_0xe0d5,0x107));var _0x5e0d=function(_0x1908b8,_0x3f079c){_0x1908b8=_0x1908b8-0x0;var _0x28a5fa=_0xe0d5[_0x1908b8];return _0x28a5fa;};'use strict';var _=require('lodash');var client=require(_0x5e0d('0x0'));exports['create']=function(_0x5252f9){return client[_0x5e0d('0x1')](_0x5e0d('0x2'),{'body':_[_0x5e0d('0x3')](_0x5252f9,{'value':_0x5252f9[_0x5e0d('0x4')]}),'log':_0x5e0d('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 5e3a131..dc4788a 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 _0x41c5=['origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridname','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','Request','CreateVoiceTransferReport','transferercalleridnum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeexten','transfereelinkedid','isexternal','extension','blind','attendedTransfer','result','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename'];(function(_0x37fdd2,_0x44e51e){var _0x5c6b7c=function(_0x476757){while(--_0x476757){_0x37fdd2['push'](_0x37fdd2['shift']());}};_0x5c6b7c(++_0x44e51e);}(_0x41c5,0x1d8));var _0x541c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x41c5[_0x42cae2];return _0x5f256f;};'use strict';var client=require(_0x541c('0x0'));exports[_0x541c('0x1')]={};exports['blindTransfer']=function(_0x8036b){return client[_0x541c('0x2')](_0x541c('0x3'),{'body':{'result':_0x8036b['result'],'transfererchannel':_0x8036b['transfererchannel'],'transferercalleridnum':_0x8036b[_0x541c('0x4')],'transferercalleridname':_0x8036b['transferercalleridname'],'transfererconnectedlinenum':_0x8036b['transfererconnectedlinenum'],'transfererconnectedlinename':_0x8036b[_0x541c('0x5')],'transfereraccountcode':_0x8036b[_0x541c('0x6')],'transferercontext':_0x8036b[_0x541c('0x7')],'transfererexten':_0x8036b[_0x541c('0x8')],'transfererlinkedid':_0x8036b['transfererlinkedid'],'transfereechannel':_0x8036b[_0x541c('0x9')],'transfereecalleridnum':_0x8036b[_0x541c('0xa')],'transfereecalleridname':_0x8036b[_0x541c('0xb')],'transfereeconnectedlinenum':_0x8036b['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x8036b['transfereeconnectedlinename'],'transfereeaccountcode':_0x8036b['transfereeaccountcode'],'transfereecontext':_0x8036b['transfereecontext'],'transfereeexten':_0x8036b[_0x541c('0xc')],'transfereelinkedid':_0x8036b[_0x541c('0xd')],'isexternal':_0x8036b[_0x541c('0xe')],'context':_0x8036b['context'],'extension':_0x8036b[_0x541c('0xf')],'type':_0x541c('0x10')},'log':_0x541c('0x3')});};exports[_0x541c('0x11')]=function(_0x136ec7){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x136ec7[_0x541c('0x12')],'transfererchannel':_0x136ec7[_0x541c('0x13')],'transferercalleridnum':_0x136ec7['origtransferercalleridnum'],'transferercalleridname':_0x136ec7[_0x541c('0x14')],'transfererconnectedlinenum':_0x136ec7[_0x541c('0x15')],'transfererconnectedlinename':_0x136ec7[_0x541c('0x16')],'transfereraccountcode':_0x136ec7[_0x541c('0x17')],'transferercontext':_0x136ec7['secondtransferercontext'],'transfererexten':_0x136ec7[_0x541c('0x18')],'transfererlinkedid':_0x136ec7[_0x541c('0x19')],'transfereechannel':_0x136ec7['transfertargetchannel'],'transfereecalleridnum':_0x136ec7['transfertargetcalleridnum'],'transfereecalleridname':_0x136ec7[_0x541c('0x1a')],'transfereeconnectedlinenum':_0x136ec7['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x136ec7['transfertargetconnectedlinename'],'transfereeaccountcode':_0x136ec7['transfertargetaccountcode'],'transfereecontext':_0x136ec7[_0x541c('0x1b')],'transfereeexten':_0x136ec7[_0x541c('0x1c')],'transfereelinkedid':_0x136ec7[_0x541c('0x1d')],'isexternal':_0x136ec7['isexternal'],'context':_0x136ec7[_0x541c('0x1e')],'extension':_0x136ec7[_0x541c('0x1f')],'type':_0x541c('0x20')},'log':_0x541c('0x3')});}; \ No newline at end of file +var _0x9733=['transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','transfers','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','context','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum'];(function(_0x3a6d15,_0x2d4ba9){var _0x591ad8=function(_0x4a8336){while(--_0x4a8336){_0x3a6d15['push'](_0x3a6d15['shift']());}};_0x591ad8(++_0x2d4ba9);}(_0x9733,0x1dc));var _0x3973=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9733[_0x321bb2];return _0x9c12ed;};'use strict';var client=require('../client');exports[_0x3973('0x0')]={};exports['blindTransfer']=function(_0xa78832){return client[_0x3973('0x1')](_0x3973('0x2'),{'body':{'result':_0xa78832[_0x3973('0x3')],'transfererchannel':_0xa78832[_0x3973('0x4')],'transferercalleridnum':_0xa78832[_0x3973('0x5')],'transferercalleridname':_0xa78832['transferercalleridname'],'transfererconnectedlinenum':_0xa78832[_0x3973('0x6')],'transfererconnectedlinename':_0xa78832[_0x3973('0x7')],'transfereraccountcode':_0xa78832['transfereraccountcode'],'transferercontext':_0xa78832['transferercontext'],'transfererexten':_0xa78832[_0x3973('0x8')],'transfererlinkedid':_0xa78832[_0x3973('0x9')],'transfereechannel':_0xa78832[_0x3973('0xa')],'transfereecalleridnum':_0xa78832[_0x3973('0xb')],'transfereecalleridname':_0xa78832[_0x3973('0xc')],'transfereeconnectedlinenum':_0xa78832[_0x3973('0xd')],'transfereeconnectedlinename':_0xa78832[_0x3973('0xe')],'transfereeaccountcode':_0xa78832['transfereeaccountcode'],'transfereecontext':_0xa78832[_0x3973('0xf')],'transfereeexten':_0xa78832[_0x3973('0x10')],'transfereelinkedid':_0xa78832[_0x3973('0x11')],'isexternal':_0xa78832['isexternal'],'context':_0xa78832[_0x3973('0x12')],'extension':_0xa78832['extension'],'type':_0x3973('0x13')},'log':_0x3973('0x2')});};exports[_0x3973('0x14')]=function(_0x27f3e0){return client[_0x3973('0x1')](_0x3973('0x2'),{'body':{'result':_0x27f3e0['result'],'transfererchannel':_0x27f3e0[_0x3973('0x15')],'transferercalleridnum':_0x27f3e0[_0x3973('0x16')],'transferercalleridname':_0x27f3e0['origtransferercalleridname'],'transfererconnectedlinenum':_0x27f3e0['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x27f3e0['secondtransfererconnectedlinename'],'transfereraccountcode':_0x27f3e0['origtransfereraccountcode'],'transferercontext':_0x27f3e0[_0x3973('0x17')],'transfererexten':_0x27f3e0[_0x3973('0x18')],'transfererlinkedid':_0x27f3e0[_0x3973('0x19')],'transfereechannel':_0x27f3e0[_0x3973('0x1a')],'transfereecalleridnum':_0x27f3e0[_0x3973('0x1b')],'transfereecalleridname':_0x27f3e0['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x27f3e0['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x27f3e0[_0x3973('0x1c')],'transfereeaccountcode':_0x27f3e0[_0x3973('0x1d')],'transfereecontext':_0x27f3e0[_0x3973('0x1e')],'transfereeexten':_0x27f3e0[_0x3973('0x1f')],'transfereelinkedid':_0x27f3e0[_0x3973('0x20')],'isexternal':_0x27f3e0[_0x3973('0x21')],'context':_0x27f3e0[_0x3973('0x22')],'extension':_0x27f3e0[_0x3973('0x23')],'type':'attended'},'log':_0x3973('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 36f6b94..185996c 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 _0x3a4b=['telephones','trunks','campaigns','run','event','emit','custom:','faxAccounts','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','jayson/promise','bluebird','moment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','error','asterisk','username','join','pick','keys','action','Reload','Action','message','catch','command','Command','then','content','voiceQueues','hasOwnProperty','strategy','answered','available','pTalking','sumDuration','sumHoldTime','talking','type','waiting','loggedInDb','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','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','values','ami\x20disconnected','validate','map','find','channels','%s.%s','filename','uniqueid','wav','MixMonitor','channel','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','isConnected','resolve','StopMixMonitor','destinationchannel','status','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','Hangup','voicequeuechannelredirect','context'];(function(_0x1148f8,_0x5d1b06){var _0x54f0c7=function(_0x26ebe3){while(--_0x26ebe3){_0x1148f8['push'](_0x1148f8['shift']());}};_0x54f0c7(++_0x5d1b06);}(_0x3a4b,0x1a1));var _0xb3a4=function(_0x336b71,_0x450b8e){_0x336b71=_0x336b71-0x0;var _0x417ca0=_0x3a4b[_0x336b71];return _0x417ca0;};'use strict';var _=require('lodash');var util=require(_0xb3a4('0x0'));var jayson=require(_0xb3a4('0x1'));var schema=require('validate');var BPromise=require(_0xb3a4('0x2'));var moment=require(_0xb3a4('0x3'));var config=require('../../../config/environment');var properties=require(_0xb3a4('0x4'));var ami=require(_0xb3a4('0x5'));exports[_0xb3a4('0x6')]=function(_0xfdb443,_0x36bba0,_0x341e46){return new BPromise(function(_0x2bd75f,_0x1ec4de){var _0x1c40ab={'QueuePause':function(_0x5355fc){return new Promise(function(_0x231009,_0x441fd8){var _0x568a72=util[_0xb3a4('0x7')](_0xb3a4('0x8'),_0xb3a4('0x9'),_0x5355fc[_0xb3a4('0xa')]);if(_0xfdb443[_0xb3a4('0xb')]&&_0xfdb443[_0xb3a4('0xb')][_0x568a72]&&_0xfdb443[_0xb3a4('0xb')][_0x568a72]['timer']){_0xfdb443[_0xb3a4('0xb')][_0x568a72][_0xb3a4('0xc')]();}if(_0xfdb443[_0xb3a4('0xd')][_0x568a72]){_0xfdb443[_0xb3a4('0xd')][_0x568a72][_0xb3a4('0xe')]({'statePause':_0x5355fc[_0xb3a4('0xf')]?!![]:![]});}_0x231009({'code':0xc8,'message':_0xb3a4('0x10')});});},'Reload':function(_0x39453f){var _0xc2a03c=this;return new Promise(function(_0xe2688a,_0x6d159c){if(ami['isConnected']()==![]){return _0x6d159c(_0xc2a03c[_0xb3a4('0x11')](0x1f4,[config[_0xb3a4('0x12')]['ip'],config[_0xb3a4('0x12')][_0xb3a4('0x13')],'ami\x20disconnected'][_0xb3a4('0x14')]('\x20')));}_0x39453f=_[_0xb3a4('0x15')](_0x39453f,_[_0xb3a4('0x16')](properties['module']));_0x39453f[_0xb3a4('0x17')]=_0xb3a4('0x18');return ami[_0xb3a4('0x19')](_0x39453f)['then'](function(_0x446db8){_0xe2688a({'code':0xc8,'message':_0x446db8[_0xb3a4('0x1a')]});})[_0xb3a4('0x1b')](function(_0x4d11c9){_0x6d159c(_0xc2a03c[_0xb3a4('0x11')](0x1f5,_0x4d11c9['message']));});});},'Command':function(_0x226307){var _0x480f30=this;return new Promise(function(_0x1880ff,_0x495ffd){if(ami['isConnected']()==![]){return _0x495ffd(_0x480f30[_0xb3a4('0x11')](0x1f4,[config[_0xb3a4('0x12')]['ip'],config[_0xb3a4('0x12')][_0xb3a4('0x13')],'ami\x20disconnected']['join']('\x20')));}_0x226307=_[_0xb3a4('0x15')](_0x226307,_0xb3a4('0x1c'));_0x226307['action']=_0xb3a4('0x1d');return ami[_0xb3a4('0x19')](_0x226307)[_0xb3a4('0x1e')](function(_0x3f3a80){_0x1880ff({'code':0xc8,'message':_0x3f3a80[_0xb3a4('0x1f')]});})[_0xb3a4('0x1b')](function(_0x166ac8){_0x495ffd(_0x480f30['error'](0x1f5,_0x166ac8['message']));});});},'VoiceQueues':function(_0x1a73ca){return new Promise(function(_0x4dba04,_0xba25c6){var _0x243191=[];for(var _0x274eb5 in _0xfdb443[_0xb3a4('0x20')]){if(_0xfdb443[_0xb3a4('0x20')][_0xb3a4('0x21')](_0x274eb5)){var _0x17b519=_0xfdb443[_0xb3a4('0x20')][_0x274eb5];var _0x3a55be={'id':_0x17b519['id'],'name':_0x17b519['name'],'strategy':_0x17b519[_0xb3a4('0x22')],'answered':_0x17b519[_0xb3a4('0x23')],'available':_0x17b519[_0xb3a4('0x24')],'loggedIn':_0x17b519['loggedIn'],'pTalking':_0x17b519[_0xb3a4('0x25')],'sumBillable':_0x17b519['sumBillable'],'sumDuration':_0x17b519[_0xb3a4('0x26')],'sumHoldTime':_0x17b519[_0xb3a4('0x27')]||0x0,'talking':_0x17b519[_0xb3a4('0x28')],'total':_0x17b519['total'],'type':_0x17b519[_0xb3a4('0x29')],'unmanaged':_0x17b519['unmanaged'],'abandoned':_0x17b519['abandoned'],'waiting':_0x17b519[_0xb3a4('0x2a')],'loggedInDb':_0x17b519[_0xb3a4('0x2b')]};if(_0x17b519[_0xb3a4('0x29')]===_0xb3a4('0x2c')){_0x3a55be['dialActive']=_0x17b519[_0xb3a4('0x2d')];_0x3a55be[_0xb3a4('0x2e')]=_0x17b519['dialMethod'];_0x3a55be[_0xb3a4('0x2f')]=_0x17b519[_0xb3a4('0x2f')];_0x3a55be[_0xb3a4('0x30')]=_0x17b519[_0xb3a4('0x30')];_0x3a55be[_0xb3a4('0x31')]=_0x17b519[_0xb3a4('0x31')];_0x3a55be[_0xb3a4('0x32')]=_0x17b519[_0xb3a4('0x32')];_0x3a55be[_0xb3a4('0x33')]=_0x17b519['outboundAnswerAgiCallsDay'];_0x3a55be[_0xb3a4('0x34')]=_0x17b519[_0xb3a4('0x34')];_0x3a55be[_0xb3a4('0x35')]=_0x17b519[_0xb3a4('0x35')];_0x3a55be['outboundBusyCallsDay']=_0x17b519[_0xb3a4('0x36')];_0x3a55be[_0xb3a4('0x37')]=_0x17b519[_0xb3a4('0x37')];_0x3a55be[_0xb3a4('0x38')]=_0x17b519[_0xb3a4('0x38')];_0x3a55be[_0xb3a4('0x39')]=_0x17b519[_0xb3a4('0x39')];_0x3a55be[_0xb3a4('0x3a')]=_0x17b519['outboundDropCallsDayTimeout'];_0x3a55be[_0xb3a4('0x3b')]=_0x17b519[_0xb3a4('0x3b')];_0x3a55be[_0xb3a4('0x3c')]=_0x17b519[_0xb3a4('0x3c')];_0x3a55be[_0xb3a4('0x3d')]=_0x17b519[_0xb3a4('0x3d')];_0x3a55be['outboundReCallsDay']=_0x17b519[_0xb3a4('0x3e')];_0x3a55be[_0xb3a4('0x3f')]=_0x17b519[_0xb3a4('0x3f')];_0x3a55be[_0xb3a4('0x40')]=_0x17b519[_0xb3a4('0x40')];_0x3a55be[_0xb3a4('0x41')]=_0x17b519[_0xb3a4('0x41')];_0x3a55be[_0xb3a4('0x42')]=_0x17b519[_0xb3a4('0x42')];_0x3a55be[_0xb3a4('0x43')]=_0x17b519[_0xb3a4('0x43')];_0x3a55be['predictiveIntervalDroppedCallsCallersExit']=_0x17b519[_0xb3a4('0x44')];_0x3a55be[_0xb3a4('0x45')]=_0x17b519[_0xb3a4('0x45')];_0x3a55be['predictiveIntervalErlangCalls']=_0x17b519[_0xb3a4('0x46')];_0x3a55be[_0xb3a4('0x47')]=_0x17b519[_0xb3a4('0x47')];_0x3a55be[_0xb3a4('0x48')]=_0x17b519[_0xb3a4('0x48')];_0x3a55be['predictiveIntervalMultiplicativeFactor']=_0x17b519[_0xb3a4('0x49')];_0x3a55be[_0xb3a4('0x4a')]=_0x17b519['predictiveIntervalPauses'];_0x3a55be[_0xb3a4('0x4b')]=_0x17b519[_0xb3a4('0x4b')];_0x3a55be['predictiveIntervalTotalCalls']=_0x17b519[_0xb3a4('0x4c')];_0x3a55be[_0xb3a4('0x1a')]=_0x17b519[_0xb3a4('0x1a')];_0x3a55be[_0xb3a4('0x4d')]=_0x17b519['originated'];_0x3a55be[_0xb3a4('0x4e')]=_0x17b519[_0xb3a4('0x4e')];_0x3a55be[_0xb3a4('0x4f')]=_0x17b519[_0xb3a4('0x4f')];_0x3a55be[_0xb3a4('0x50')]=_0x17b519[_0xb3a4('0x50')];_0x3a55be[_0xb3a4('0x51')]=_0x17b519['erlangBusyFactor'];_0x3a55be['startPredictive']=_0x17b519[_0xb3a4('0x52')];_0x3a55be[_0xb3a4('0x53')]=_0x17b519['startProgressive'];}if(_0x17b519[_0xb3a4('0x54')]){_0x3a55be[_0xb3a4('0x54')]={'id':_0x17b519['Trunk']['id'],'name':_0x17b519[_0xb3a4('0x54')][_0xb3a4('0xa')],'active':_0x17b519['Trunk'][_0xb3a4('0x55')],'callerid':_0x17b519[_0xb3a4('0x54')][_0xb3a4('0x56')]};}if(_0x17b519[_0xb3a4('0x57')]){_0x3a55be[_0xb3a4('0x57')]={'id':_0x17b519[_0xb3a4('0x57')]['id'],'name':_0x17b519[_0xb3a4('0x57')][_0xb3a4('0xa')]};}_0x243191[_0xb3a4('0x58')](_0x3a55be);}}_0x4dba04({'count':_0x243191[_0xb3a4('0x59')],'rows':_0x243191});});},'VoiceChannels':function(_0x3876fd){return new Promise(function(_0x479df5,_0x54c910){var _0xa41d44=_[_0xb3a4('0x5a')](_0xfdb443['channels']);_0x479df5({'count':_0xa41d44['length'],'rows':_0xa41d44});});},'VoiceChannelMixMonitor':function(_0x518f53){var _0x316415=this;return new Promise(function(_0x4f6fd5,_0x37c48a){if(ami['isConnected']()==![]){return _0x37c48a(_0x316415['error'](0x1f4,[config[_0xb3a4('0x12')]['ip'],config[_0xb3a4('0x12')][_0xb3a4('0x13')],_0xb3a4('0x5b')][_0xb3a4('0x14')]('\x20')));}var _0x58ff34=schema(properties['voicechannel'])[_0xb3a4('0x5c')](_0x518f53);if(_0x58ff34['length']>0x0){return _0x37c48a(_0x316415['error'](0x1f4,_[_0xb3a4('0x5d')](_0x58ff34,_0xb3a4('0x1a'))[_0xb3a4('0x14')](',\x20')));}var _0x58cce6=_[_0xb3a4('0x5e')](_0xfdb443[_0xb3a4('0x5f')],{'uniqueid':_0x518f53['uniqueid']});if(_0x58cce6&&_0x58cce6['channel']){var _0x5e19b5=util['format'](_0xb3a4('0x60'),_0x518f53[_0xb3a4('0x61')]||_0x518f53[_0xb3a4('0x62')],_0x518f53['format']||_0xb3a4('0x63'));return ami[_0xb3a4('0x19')]({'action':_0xb3a4('0x64'),'channel':_0x58cce6[_0xb3a4('0x65')],'file':_0x5e19b5,'options':_0xb3a4('0x66')})[_0xb3a4('0x1e')](function(_0x5387ae){var _0x13418d=_[_0xb3a4('0x5e')](_0x58cce6[_0xb3a4('0x67')],{'filename':_0xb3a4('0x68')+_0x5e19b5[_0xb3a4('0x69')]()});if(_[_0xb3a4('0x6a')](_0x13418d)){_0x58cce6['monitors'][_0xb3a4('0x58')]({'filename':_0xb3a4('0x68')+_0x5e19b5['toLowerCase'](),'createdAt':moment()[_0xb3a4('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x5387ae[_0xb3a4('0x6b')],'status':'rec'});}else{_0x13418d[_0xb3a4('0x6b')]=_0x5387ae['mixmonitorid'];_0x13418d['status']=_0xb3a4('0x6c');}_0x4f6fd5({'code':0xc8,'message':[_0x518f53[_0xb3a4('0x62')],_0xb3a4('0x6d'),_0x5387ae[_0xb3a4('0x6b')]]['join']('\x20'),'mixmonitorid':_0x5387ae[_0xb3a4('0x6b')]});})[_0xb3a4('0x1b')](function(_0x1cc9bf){_0x37c48a(_0x316415[_0xb3a4('0x11')](0x1f5,[_0x518f53[_0xb3a4('0x62')],_0x1cc9bf[_0xb3a4('0x1a')][_0xb3a4('0x69')]()]['join']('\x20')));});}else{return _0x37c48a(_0x316415[_0xb3a4('0x11')](0x1f5,_0xb3a4('0x6e')));}});},'VoiceChannelStopMixMonitor':function(_0x18f447){var _0x4e75bc=this;return new Promise(function(_0x36543b,_0x30f995){if(ami[_0xb3a4('0x6f')]()==![]){return _0x30f995(_0x4e75bc[_0xb3a4('0x11')](0x1f4,[config[_0xb3a4('0x12')]['ip'],config[_0xb3a4('0x12')][_0xb3a4('0x13')],_0xb3a4('0x5b')][_0xb3a4('0x14')]('\x20')));}var _0x468aad=schema(properties['voicechannel'])[_0xb3a4('0x5c')](_0x18f447);if(_0x468aad['length']>0x0){return _0x30f995(_0x4e75bc[_0xb3a4('0x11')](0x1f4,_[_0xb3a4('0x5d')](_0x468aad,'message')[_0xb3a4('0x14')](',\x20')));}var _0x3aef7d=_[_0xb3a4('0x5e')](_0xfdb443[_0xb3a4('0x5f')],{'uniqueid':_0x18f447[_0xb3a4('0x62')]});if(_0x3aef7d){return BPromise[_0xb3a4('0x70')]()[_0xb3a4('0x1e')](function(){if(_0x3aef7d[_0xb3a4('0x65')]){return ami[_0xb3a4('0x19')]({'action':_0xb3a4('0x71'),'channel':_0x3aef7d[_0xb3a4('0x65')],'mixmonitorid':_0x18f447[_0xb3a4('0x6b')]})[_0xb3a4('0x1b')](function(_0x3027f8){});}})['then'](function(){if(_0x3aef7d['destinationchannel']){return ami[_0xb3a4('0x19')]({'action':'StopMixMonitor','channel':_0x3aef7d[_0xb3a4('0x72')],'mixmonitorid':_0x18f447['mixmonitorid']})['catch'](function(_0x448f98){});}})[_0xb3a4('0x1e')](function(_0x5dcb76){var _0xa218e3=_['find'](_0x3aef7d[_0xb3a4('0x67')],{'mixmonitorid':_0x18f447['mixmonitorid']});if(_0xa218e3){_0xa218e3[_0xb3a4('0x73')]='stop';}})[_0xb3a4('0x1e')](function(){var _0x4cc7ff=util[_0xb3a4('0x7')](_0xb3a4('0x60'),_0x18f447['filename']||_0x18f447[_0xb3a4('0x62')],_0x18f447[_0xb3a4('0x7')]||_0xb3a4('0x63'));var _0x2a0f90=_[_0xb3a4('0x5e')](_0x3aef7d[_0xb3a4('0x67')],{'filename':_0xb3a4('0x68')+_0x4cc7ff[_0xb3a4('0x69')]()});if(_0x2a0f90){_0x2a0f90[_0xb3a4('0x73')]=_0xb3a4('0x74');}})['then'](function(){_0x36543b({'code':0xc8,'message':[_0x18f447[_0xb3a4('0x62')],_0xb3a4('0x75')][_0xb3a4('0x14')]('\x20')});})[_0xb3a4('0x1b')](function(_0x54cd59){_0x30f995(_0x4e75bc['error'](0x1f5,[_0x18f447[_0xb3a4('0x62')],_0x54cd59[_0xb3a4('0x1a')][_0xb3a4('0x69')]()][_0xb3a4('0x14')]('\x20')));});}else{return _0x30f995(_0x4e75bc[_0xb3a4('0x11')](0x1f5,_0xb3a4('0x6e')));}});},'VoiceQueuesChannels':function(_0x7e5f42){return new Promise(function(_0x456913,_0xebff0f){var _0xdaf65=_[_0xb3a4('0x5a')](_0xfdb443[_0xb3a4('0x76')]);_0x456913({'count':_0xdaf65[_0xb3a4('0x59')],'rows':_0xdaf65});});},'VoiceQueuesChannel':function(_0x4d49a5){var _0x4a6e5f=this;return new Promise(function(_0x523fdb,_0x5b567d){var _0x4bb23e=schema(properties[_0xb3a4('0x77')])[_0xb3a4('0x5c')](_0x4d49a5);if(_0x4bb23e[_0xb3a4('0x59')]>0x0){return _0x5b567d(_0x4a6e5f[_0xb3a4('0x11')](0x1f4,_[_0xb3a4('0x5d')](_0x4bb23e,_0xb3a4('0x1a'))['join'](',\x20')));}var _0x4e7124=_['find'](_0xfdb443[_0xb3a4('0x76')],{'uniqueid':_0x4d49a5[_0xb3a4('0x62')]});if(_0x4e7124){_0x523fdb(_0x4e7124);}else{return _0x5b567d(_0x4a6e5f['error'](0x1f5,_0xb3a4('0x6e')));}});},'VoiceQueuesChannelHangup':function(_0x4aaea4){var _0x69c1dd=this;return new Promise(function(_0x10782f,_0x124243){if(ami[_0xb3a4('0x6f')]()==![]){return _0x124243(_0x69c1dd[_0xb3a4('0x11')](0x1f4,[config[_0xb3a4('0x12')]['ip'],config[_0xb3a4('0x12')][_0xb3a4('0x13')],'ami\x20disconnected'][_0xb3a4('0x14')]('\x20')));}var _0x19e418=schema(properties['voicequeuechannelhangup'])[_0xb3a4('0x5c')](_0x4aaea4);if(_0x19e418['length']>0x0){return _0x124243(_0x69c1dd[_0xb3a4('0x11')](0x1f4,_[_0xb3a4('0x5d')](_0x19e418,_0xb3a4('0x1a'))[_0xb3a4('0x14')](',\x20')));}var _0x3db619=_['find'](_0xfdb443[_0xb3a4('0x76')],{'uniqueid':_0x4aaea4[_0xb3a4('0x62')]});if(_0x3db619&&_0x3db619[_0xb3a4('0x65')]){return ami[_0xb3a4('0x19')]({'action':_0xb3a4('0x78'),'channel':_0x3db619[_0xb3a4('0x65')]})[_0xb3a4('0x1e')](function(_0x39ac21){_0x10782f({'code':0xc8,'message':[_0x4aaea4[_0xb3a4('0x62')],_0x39ac21['message'][_0xb3a4('0x69')]()][_0xb3a4('0x14')]('\x20')});})['catch'](function(_0x5e76cb){_0x124243(_0x69c1dd[_0xb3a4('0x11')](0x1f5,[_0x4aaea4[_0xb3a4('0x62')],_0x5e76cb['message'][_0xb3a4('0x69')]()][_0xb3a4('0x14')]('\x20')));});}else{return _0x124243(_0x69c1dd[_0xb3a4('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0xe3988c){var _0x2b37d4=this;return new Promise(function(_0xb8a4fd,_0x15467d){if(ami[_0xb3a4('0x6f')]()==![]){return _0x15467d(_0x2b37d4['error'](0x1f4,[config['asterisk']['ip'],config[_0xb3a4('0x12')]['username'],_0xb3a4('0x5b')][_0xb3a4('0x14')]('\x20')));}var _0x59adb2=schema(properties[_0xb3a4('0x79')])[_0xb3a4('0x5c')](_0xe3988c);if(_0x59adb2['length']>0x0){return _0x15467d(_0x2b37d4[_0xb3a4('0x11')](0x1f4,_[_0xb3a4('0x5d')](_0x59adb2,'message')[_0xb3a4('0x14')](',\x20')));}var _0x3278bb=_[_0xb3a4('0x5e')](_0xfdb443[_0xb3a4('0x76')],{'uniqueid':_0xe3988c[_0xb3a4('0x62')]});if(_0x3278bb&&_0x3278bb[_0xb3a4('0x65')]){return ami[_0xb3a4('0x19')]({'action':'Redirect','channel':_0x3278bb[_0xb3a4('0x65')],'exten':_0xe3988c['exten'],'context':_0xe3988c['context']||_0x3278bb[_0xb3a4('0x7a')],'priority':0x1})[_0xb3a4('0x1e')](function(_0x97a9b2){_0xb8a4fd({'code':0xc8,'message':[_0xe3988c[_0xb3a4('0x62')],_0x97a9b2[_0xb3a4('0x1a')]['toLowerCase']()][_0xb3a4('0x14')]('\x20')});})['catch'](function(_0x20306b){_0x15467d(_0x2b37d4[_0xb3a4('0x11')](0x1f5,[_0xe3988c[_0xb3a4('0x62')],_0x20306b[_0xb3a4('0x1a')][_0xb3a4('0x69')]()]['join']('\x20')));});}else{return _0x15467d(_0x2b37d4[_0xb3a4('0x11')](0x1f5,_0xb3a4('0x6e')));}});},'Agents':function(_0x5d986f){return new Promise(function(_0x5e1b4d,_0xf6759d){var _0x3bef92=_[_0xb3a4('0x5a')](_0xfdb443[_0xb3a4('0xd')]);_0x5e1b4d({'count':_0x3bef92['length'],'rows':_0x3bef92});});},'Telephones':function(_0x12e8a2){return new Promise(function(_0x1ea599,_0x8d32e1){var _0x25bbd2=_[_0xb3a4('0x5a')](_0xfdb443[_0xb3a4('0x7b')]);_0x1ea599({'count':_0x25bbd2[_0xb3a4('0x59')],'rows':_0x25bbd2});});},'Trunks':function(_0x452d5c){return new Promise(function(_0x394f41,_0x537c03){var _0xc6666c=_[_0xb3a4('0x5a')](_0xfdb443[_0xb3a4('0x7c')]);_0x394f41({'count':_0xc6666c['length'],'rows':_0xc6666c});});},'OutboundChannels':function(_0x41b457){return new Promise(function(_0x210978,_0x29412c){var _0xb82204=_[_0xb3a4('0x5a')](_0xfdb443['outboundChannels']);_0x210978({'count':_0xb82204[_0xb3a4('0x59')],'rows':_0xb82204});});},'Outbound':function(_0x597fde){return new Promise(function(_0x51fcdd,_0x1bf7fc){_0x51fcdd(_0xfdb443['outbound']);});},'Campaigns':function(_0x2a52af){return new Promise(function(_0x3ef8dd,_0x194674){var _0x3cf149=_[_0xb3a4('0x5a')](_0xfdb443[_0xb3a4('0x7d')]);_0x3ef8dd({'count':_0x3cf149[_0xb3a4('0x59')],'rows':_0x3cf149});});},'VoiceQueuesPreview':function(_0x537c54){var _0x24f2db=this;return new Promise(function(_0x398a9f,_0x56bc20){_0x36bba0[_0xb3a4('0x7e')](_0x537c54['id'])[_0xb3a4('0x1e')](function(_0x302064){_0x398a9f({'code':0xc8,'message':_0x302064[_0xb3a4('0x1a')]});})[_0xb3a4('0x1b')](function(_0x42a898){_0x56bc20(_0x24f2db['error'](0x1f4,_0x42a898[_0xb3a4('0x1a')]));});});},'EventManager':function(_0x4703bb){var _0x5ae1fd=this;return new Promise(function(_0x4cead5,_0x43921b){if(!_0x4703bb[_0xb3a4('0x7f')]){return _0x43921b(_0x5ae1fd['error'](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xb3a4('0x80')](_0xb3a4('0x81')+_0x4703bb['event'],_0x4703bb[_0xb3a4('0x1a')]);_0x4cead5({'code':0xc8,'message':_0x4703bb});});},'FaxAccounts':function(_0x41158c){return new Promise(function(_0x589de5,_0x13b651){var _0x495b1e=_['values'](_0xfdb443[_0xb3a4('0x82')]);_0x589de5({'count':_0x495b1e[_0xb3a4('0x59')],'rows':_0x495b1e});});},'SendFax':function(_0x43835d){var _0x459a56=this;return new Promise(function(_0xd06ffe,_0x3500f3){_0x341e46['send'](_0x43835d)[_0xb3a4('0x1e')](function(_0x2ac4e4){_0xd06ffe({'code':0xc8,'message':_0x2ac4e4['message']});})[_0xb3a4('0x1b')](function(_0x29ad20){_0x3500f3(_0x459a56[_0xb3a4('0x11')](0x1f4,_0x29ad20[_0xb3a4('0x1a')]));});});},'CheckAfterSend':function(_0x8bb5a9){var _0x1496fb=this;return new Promise(function(_0x1adb11,_0xa3532c){_0x341e46['checkAfterSend'](_0x8bb5a9)['then'](function(_0x5ec097){_0x1adb11({'code':0xc8,'message':_0x5ec097['message']});})['catch'](function(_0x33b150){_0xa3532c(_0x1496fb[_0xb3a4('0x11')](0x1f4,_0x33b150['message']));});});}};var _0x3a3ad5=jayson['server'](_0x1c40ab)[_0xb3a4('0x83')]();_0x3a3ad5['on'](_0xb3a4('0x11'),function(_0x45db34){return _0x1ec4de(_0x45db34);});_0x3a3ad5[_0xb3a4('0x6')](0x232a,_0xb3a4('0x84'),function(){console[_0xb3a4('0x85')](_0xb3a4('0x86'),0x232a);return _0x2bd75f('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x6d3d=['uniqueid','channel','%s.%s','filename','wav','MixMonitor','then','find','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicechannel','resolve','StopMixMonitor','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','values','telephones','outboundChannels','campaigns','run','Event\x20name\x20mandatory','emit','faxAccounts','send','checkAfterSend','server','127.0.0.1','log','RPC\x20listening\x20on\x20port:','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','name','timers','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','username','join','keys','action','Reload','Action','message','catch','ami\x20disconnected','pick','command','content','hasOwnProperty','voiceQueues','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','length','channels','map'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x6d3d,0x134));var _0xd6d3=function(_0xe6b23e,_0x25bafa){_0xe6b23e=_0xe6b23e-0x0;var _0x1f9428=_0x6d3d[_0xe6b23e];return _0x1f9428;};'use strict';var _=require('lodash');var util=require(_0xd6d3('0x0'));var jayson=require(_0xd6d3('0x1'));var schema=require(_0xd6d3('0x2'));var BPromise=require(_0xd6d3('0x3'));var moment=require(_0xd6d3('0x4'));var config=require(_0xd6d3('0x5'));var properties=require(_0xd6d3('0x6'));var ami=require(_0xd6d3('0x7'));exports[_0xd6d3('0x8')]=function(_0x5eec4d,_0x11f945,_0x11b54f){return new BPromise(function(_0x3d5565,_0x4b3232){var _0xd4332a={'QueuePause':function(_0x173a22){return new Promise(function(_0x3bc717,_0x98c598){var _0x1c1027=util[_0xd6d3('0x9')](_0xd6d3('0xa'),'SIP',_0x173a22[_0xd6d3('0xb')]);if(_0x5eec4d['timers']&&_0x5eec4d[_0xd6d3('0xc')][_0x1c1027]&&_0x5eec4d[_0xd6d3('0xc')][_0x1c1027]['timer']){_0x5eec4d[_0xd6d3('0xc')][_0x1c1027]['updateAcw']();}if(_0x5eec4d['agents'][_0x1c1027]){_0x5eec4d[_0xd6d3('0xd')][_0x1c1027][_0xd6d3('0xe')]({'statePause':_0x173a22['pause']?!![]:![]});}_0x3bc717({'code':0xc8,'message':_0xd6d3('0xf')});});},'Reload':function(_0x5de8ab){var _0x5c9649=this;return new Promise(function(_0x454d7a,_0x35306f){if(ami[_0xd6d3('0x10')]()==![]){return _0x35306f(_0x5c9649[_0xd6d3('0x11')](0x1f4,[config[_0xd6d3('0x12')]['ip'],config[_0xd6d3('0x12')][_0xd6d3('0x13')],'ami\x20disconnected'][_0xd6d3('0x14')]('\x20')));}_0x5de8ab=_['pick'](_0x5de8ab,_[_0xd6d3('0x15')](properties['module']));_0x5de8ab[_0xd6d3('0x16')]=_0xd6d3('0x17');return ami[_0xd6d3('0x18')](_0x5de8ab)['then'](function(_0x234e72){_0x454d7a({'code':0xc8,'message':_0x234e72[_0xd6d3('0x19')]});})[_0xd6d3('0x1a')](function(_0x2b7d0c){_0x35306f(_0x5c9649['error'](0x1f5,_0x2b7d0c[_0xd6d3('0x19')]));});});},'Command':function(_0x746322){var _0x378456=this;return new Promise(function(_0x4d606f,_0x30f74f){if(ami[_0xd6d3('0x10')]()==![]){return _0x30f74f(_0x378456[_0xd6d3('0x11')](0x1f4,[config['asterisk']['ip'],config[_0xd6d3('0x12')][_0xd6d3('0x13')],_0xd6d3('0x1b')][_0xd6d3('0x14')]('\x20')));}_0x746322=_[_0xd6d3('0x1c')](_0x746322,_0xd6d3('0x1d'));_0x746322[_0xd6d3('0x16')]='Command';return ami[_0xd6d3('0x18')](_0x746322)['then'](function(_0xcde34a){_0x4d606f({'code':0xc8,'message':_0xcde34a[_0xd6d3('0x1e')]});})[_0xd6d3('0x1a')](function(_0x34abb1){_0x30f74f(_0x378456[_0xd6d3('0x11')](0x1f5,_0x34abb1[_0xd6d3('0x19')]));});});},'VoiceQueues':function(_0x58db31){return new Promise(function(_0x245df4,_0x1feab6){var _0x2d6d34=[];for(var _0x5e67bc in _0x5eec4d['voiceQueues']){if(_0x5eec4d['voiceQueues'][_0xd6d3('0x1f')](_0x5e67bc)){var _0x42dd21=_0x5eec4d[_0xd6d3('0x20')][_0x5e67bc];var _0x34afdb={'id':_0x42dd21['id'],'name':_0x42dd21[_0xd6d3('0xb')],'strategy':_0x42dd21['strategy'],'answered':_0x42dd21[_0xd6d3('0x21')],'available':_0x42dd21[_0xd6d3('0x22')],'loggedIn':_0x42dd21[_0xd6d3('0x23')],'pTalking':_0x42dd21[_0xd6d3('0x24')],'sumBillable':_0x42dd21[_0xd6d3('0x25')],'sumDuration':_0x42dd21[_0xd6d3('0x26')],'sumHoldTime':_0x42dd21[_0xd6d3('0x27')]||0x0,'talking':_0x42dd21[_0xd6d3('0x28')],'total':_0x42dd21[_0xd6d3('0x29')],'type':_0x42dd21[_0xd6d3('0x2a')],'unmanaged':_0x42dd21['unmanaged'],'abandoned':_0x42dd21['abandoned'],'waiting':_0x42dd21[_0xd6d3('0x2b')],'loggedInDb':_0x42dd21['loggedInDb']};if(_0x42dd21[_0xd6d3('0x2a')]===_0xd6d3('0x2c')){_0x34afdb[_0xd6d3('0x2d')]=_0x42dd21[_0xd6d3('0x2d')];_0x34afdb[_0xd6d3('0x2e')]=_0x42dd21[_0xd6d3('0x2e')];_0x34afdb[_0xd6d3('0x2f')]=_0x42dd21['dialOriginateCallerIdName'];_0x34afdb[_0xd6d3('0x30')]=_0x42dd21[_0xd6d3('0x30')];_0x34afdb['dialOriginateTimeout']=_0x42dd21[_0xd6d3('0x31')];_0x34afdb[_0xd6d3('0x32')]=_0x42dd21[_0xd6d3('0x32')];_0x34afdb['outboundAnswerAgiCallsDay']=_0x42dd21['outboundAnswerAgiCallsDay'];_0x34afdb[_0xd6d3('0x33')]=_0x42dd21[_0xd6d3('0x33')];_0x34afdb[_0xd6d3('0x34')]=_0x42dd21[_0xd6d3('0x34')];_0x34afdb[_0xd6d3('0x35')]=_0x42dd21['outboundBusyCallsDay'];_0x34afdb[_0xd6d3('0x36')]=_0x42dd21['outboundCongestionCallsDay'];_0x34afdb['outboundDropCallsDayACS']=_0x42dd21[_0xd6d3('0x37')];_0x34afdb['outboundDropCallsDayCallersExit']=_0x42dd21['outboundDropCallsDayCallersExit'];_0x34afdb[_0xd6d3('0x38')]=_0x42dd21[_0xd6d3('0x38')];_0x34afdb[_0xd6d3('0x39')]=_0x42dd21[_0xd6d3('0x39')];_0x34afdb[_0xd6d3('0x3a')]=_0x42dd21[_0xd6d3('0x3a')];_0x34afdb[_0xd6d3('0x3b')]=_0x42dd21['outboundOriginateFailureCallsDay'];_0x34afdb[_0xd6d3('0x3c')]=_0x42dd21[_0xd6d3('0x3c')];_0x34afdb[_0xd6d3('0x3d')]=_0x42dd21[_0xd6d3('0x3d')];_0x34afdb[_0xd6d3('0x3e')]=_0x42dd21[_0xd6d3('0x3e')];_0x34afdb[_0xd6d3('0x3f')]=_0x42dd21['predictiveIntervalAnsweredCalls'];_0x34afdb[_0xd6d3('0x40')]=_0x42dd21[_0xd6d3('0x40')];_0x34afdb[_0xd6d3('0x41')]=_0x42dd21[_0xd6d3('0x41')];_0x34afdb['predictiveIntervalDroppedCallsCallersExit']=_0x42dd21[_0xd6d3('0x42')];_0x34afdb[_0xd6d3('0x43')]=_0x42dd21['predictiveIntervalDroppedCallsTimeout'];_0x34afdb['predictiveIntervalErlangCalls']=_0x42dd21[_0xd6d3('0x44')];_0x34afdb['predictiveIntervalErlangCallsDroppedCalls']=_0x42dd21[_0xd6d3('0x45')];_0x34afdb[_0xd6d3('0x46')]=_0x42dd21[_0xd6d3('0x46')];_0x34afdb['predictiveIntervalMultiplicativeFactor']=_0x42dd21[_0xd6d3('0x47')];_0x34afdb[_0xd6d3('0x48')]=_0x42dd21[_0xd6d3('0x48')];_0x34afdb[_0xd6d3('0x49')]=_0x42dd21[_0xd6d3('0x49')];_0x34afdb[_0xd6d3('0x4a')]=_0x42dd21[_0xd6d3('0x4a')];_0x34afdb['message']=_0x42dd21[_0xd6d3('0x19')];_0x34afdb[_0xd6d3('0x4b')]=_0x42dd21[_0xd6d3('0x4b')];_0x34afdb[_0xd6d3('0x4c')]=_0x42dd21[_0xd6d3('0x4c')];_0x34afdb['erlangCallToSecond']=_0x42dd21[_0xd6d3('0x4d')];_0x34afdb[_0xd6d3('0x4e')]=_0x42dd21['erlangAbandonmentRate'];_0x34afdb[_0xd6d3('0x4f')]=_0x42dd21[_0xd6d3('0x4f')];_0x34afdb['startPredictive']=_0x42dd21[_0xd6d3('0x50')];_0x34afdb[_0xd6d3('0x51')]=_0x42dd21[_0xd6d3('0x51')];}if(_0x42dd21['Trunk']){_0x34afdb['Trunk']={'id':_0x42dd21['Trunk']['id'],'name':_0x42dd21['Trunk']['name'],'active':_0x42dd21[_0xd6d3('0x52')][_0xd6d3('0x53')],'callerid':_0x42dd21[_0xd6d3('0x52')]['callerid']};}if(_0x42dd21[_0xd6d3('0x54')]){_0x34afdb[_0xd6d3('0x54')]={'id':_0x42dd21['Interval']['id'],'name':_0x42dd21['Interval'][_0xd6d3('0xb')]};}_0x2d6d34['push'](_0x34afdb);}}_0x245df4({'count':_0x2d6d34[_0xd6d3('0x55')],'rows':_0x2d6d34});});},'VoiceChannels':function(_0x300b55){return new Promise(function(_0x305616,_0xa51331){var _0x3a141c=_['values'](_0x5eec4d[_0xd6d3('0x56')]);_0x305616({'count':_0x3a141c[_0xd6d3('0x55')],'rows':_0x3a141c});});},'VoiceChannelMixMonitor':function(_0x50e60f){var _0x51a605=this;return new Promise(function(_0x1558b4,_0x47c13e){if(ami[_0xd6d3('0x10')]()==![]){return _0x47c13e(_0x51a605[_0xd6d3('0x11')](0x1f4,[config[_0xd6d3('0x12')]['ip'],config[_0xd6d3('0x12')][_0xd6d3('0x13')],_0xd6d3('0x1b')][_0xd6d3('0x14')]('\x20')));}var _0x48e838=schema(properties['voicechannel'])['validate'](_0x50e60f);if(_0x48e838[_0xd6d3('0x55')]>0x0){return _0x47c13e(_0x51a605[_0xd6d3('0x11')](0x1f4,_[_0xd6d3('0x57')](_0x48e838,'message')[_0xd6d3('0x14')](',\x20')));}var _0x1c49be=_['find'](_0x5eec4d[_0xd6d3('0x56')],{'uniqueid':_0x50e60f[_0xd6d3('0x58')]});if(_0x1c49be&&_0x1c49be[_0xd6d3('0x59')]){var _0x3dcb63=util['format'](_0xd6d3('0x5a'),_0x50e60f[_0xd6d3('0x5b')]||_0x50e60f[_0xd6d3('0x58')],_0x50e60f[_0xd6d3('0x9')]||_0xd6d3('0x5c'));return ami[_0xd6d3('0x18')]({'action':_0xd6d3('0x5d'),'channel':_0x1c49be[_0xd6d3('0x59')],'file':_0x3dcb63,'options':'ai(mixmonitorid)'})[_0xd6d3('0x5e')](function(_0x5d2703){var _0x4704f7=_[_0xd6d3('0x5f')](_0x1c49be['monitors'],{'filename':_0xd6d3('0x60')+_0x3dcb63[_0xd6d3('0x61')]()});if(_[_0xd6d3('0x62')](_0x4704f7)){_0x1c49be[_0xd6d3('0x63')][_0xd6d3('0x64')]({'filename':_0xd6d3('0x60')+_0x3dcb63[_0xd6d3('0x61')](),'createdAt':moment()[_0xd6d3('0x9')](_0xd6d3('0x65')),'mixmonitorid':_0x5d2703[_0xd6d3('0x66')],'status':'rec'});}else{_0x4704f7[_0xd6d3('0x66')]=_0x5d2703[_0xd6d3('0x66')];_0x4704f7[_0xd6d3('0x67')]=_0xd6d3('0x68');}_0x1558b4({'code':0xc8,'message':[_0x50e60f['uniqueid'],_0xd6d3('0x69'),_0x5d2703[_0xd6d3('0x66')]][_0xd6d3('0x14')]('\x20'),'mixmonitorid':_0x5d2703[_0xd6d3('0x66')]});})['catch'](function(_0x2d9bf9){_0x47c13e(_0x51a605['error'](0x1f5,[_0x50e60f[_0xd6d3('0x58')],_0x2d9bf9[_0xd6d3('0x19')]['toLowerCase']()][_0xd6d3('0x14')]('\x20')));});}else{return _0x47c13e(_0x51a605[_0xd6d3('0x11')](0x1f5,_0xd6d3('0x6a')));}});},'VoiceChannelStopMixMonitor':function(_0x1bdb24){var _0x27e22b=this;return new Promise(function(_0xd63624,_0x535a8b){if(ami[_0xd6d3('0x10')]()==![]){return _0x535a8b(_0x27e22b['error'](0x1f4,[config[_0xd6d3('0x12')]['ip'],config['asterisk'][_0xd6d3('0x13')],_0xd6d3('0x1b')][_0xd6d3('0x14')]('\x20')));}var _0x338aa5=schema(properties[_0xd6d3('0x6b')])[_0xd6d3('0x2')](_0x1bdb24);if(_0x338aa5[_0xd6d3('0x55')]>0x0){return _0x535a8b(_0x27e22b[_0xd6d3('0x11')](0x1f4,_[_0xd6d3('0x57')](_0x338aa5,_0xd6d3('0x19'))[_0xd6d3('0x14')](',\x20')));}var _0x486b48=_['find'](_0x5eec4d['channels'],{'uniqueid':_0x1bdb24[_0xd6d3('0x58')]});if(_0x486b48){return BPromise[_0xd6d3('0x6c')]()[_0xd6d3('0x5e')](function(){if(_0x486b48['channel']){return ami[_0xd6d3('0x18')]({'action':'StopMixMonitor','channel':_0x486b48[_0xd6d3('0x59')],'mixmonitorid':_0x1bdb24['mixmonitorid']})[_0xd6d3('0x1a')](function(_0x5a6e1e){});}})[_0xd6d3('0x5e')](function(){if(_0x486b48['destinationchannel']){return ami[_0xd6d3('0x18')]({'action':_0xd6d3('0x6d'),'channel':_0x486b48['destinationchannel'],'mixmonitorid':_0x1bdb24['mixmonitorid']})[_0xd6d3('0x1a')](function(_0x4f827f){});}})[_0xd6d3('0x5e')](function(_0x50722f){var _0x225788=_['find'](_0x486b48['monitors'],{'mixmonitorid':_0x1bdb24[_0xd6d3('0x66')]});if(_0x225788){_0x225788[_0xd6d3('0x67')]='stop';}})[_0xd6d3('0x5e')](function(){var _0x3243a0=util[_0xd6d3('0x9')](_0xd6d3('0x5a'),_0x1bdb24[_0xd6d3('0x5b')]||_0x1bdb24['uniqueid'],_0x1bdb24[_0xd6d3('0x9')]||_0xd6d3('0x5c'));var _0x41a8e3=_[_0xd6d3('0x5f')](_0x486b48['monitors'],{'filename':_0xd6d3('0x60')+_0x3243a0['toLowerCase']()});if(_0x41a8e3){_0x41a8e3[_0xd6d3('0x67')]=_0xd6d3('0x6e');}})['then'](function(){_0xd63624({'code':0xc8,'message':[_0x1bdb24[_0xd6d3('0x58')],_0xd6d3('0x6f')][_0xd6d3('0x14')]('\x20')});})[_0xd6d3('0x1a')](function(_0x3d2a8e){_0x535a8b(_0x27e22b[_0xd6d3('0x11')](0x1f5,[_0x1bdb24[_0xd6d3('0x58')],_0x3d2a8e[_0xd6d3('0x19')][_0xd6d3('0x61')]()][_0xd6d3('0x14')]('\x20')));});}else{return _0x535a8b(_0x27e22b['error'](0x1f5,_0xd6d3('0x6a')));}});},'VoiceQueuesChannels':function(_0x1404ac){return new Promise(function(_0x44db3a,_0x579ecb){var _0xbc656=_['values'](_0x5eec4d['queueChannels']);_0x44db3a({'count':_0xbc656[_0xd6d3('0x55')],'rows':_0xbc656});});},'VoiceQueuesChannel':function(_0x1251ce){var _0x30c01b=this;return new Promise(function(_0x2cff31,_0x51e1e2){var _0x397521=schema(properties['voicequeuechannel'])[_0xd6d3('0x2')](_0x1251ce);if(_0x397521[_0xd6d3('0x55')]>0x0){return _0x51e1e2(_0x30c01b[_0xd6d3('0x11')](0x1f4,_[_0xd6d3('0x57')](_0x397521,_0xd6d3('0x19'))[_0xd6d3('0x14')](',\x20')));}var _0xe9f6a9=_[_0xd6d3('0x5f')](_0x5eec4d[_0xd6d3('0x70')],{'uniqueid':_0x1251ce[_0xd6d3('0x58')]});if(_0xe9f6a9){_0x2cff31(_0xe9f6a9);}else{return _0x51e1e2(_0x30c01b['error'](0x1f5,_0xd6d3('0x6a')));}});},'VoiceQueuesChannelHangup':function(_0x298e50){var _0x13bcf3=this;return new Promise(function(_0x28f507,_0x67ff67){if(ami[_0xd6d3('0x10')]()==![]){return _0x67ff67(_0x13bcf3['error'](0x1f4,[config[_0xd6d3('0x12')]['ip'],config[_0xd6d3('0x12')][_0xd6d3('0x13')],_0xd6d3('0x1b')][_0xd6d3('0x14')]('\x20')));}var _0xb53100=schema(properties[_0xd6d3('0x71')])['validate'](_0x298e50);if(_0xb53100['length']>0x0){return _0x67ff67(_0x13bcf3[_0xd6d3('0x11')](0x1f4,_['map'](_0xb53100,_0xd6d3('0x19'))[_0xd6d3('0x14')](',\x20')));}var _0x55d148=_['find'](_0x5eec4d[_0xd6d3('0x70')],{'uniqueid':_0x298e50[_0xd6d3('0x58')]});if(_0x55d148&&_0x55d148[_0xd6d3('0x59')]){return ami['Action']({'action':'Hangup','channel':_0x55d148[_0xd6d3('0x59')]})[_0xd6d3('0x5e')](function(_0x44c1cb){_0x28f507({'code':0xc8,'message':[_0x298e50[_0xd6d3('0x58')],_0x44c1cb[_0xd6d3('0x19')][_0xd6d3('0x61')]()][_0xd6d3('0x14')]('\x20')});})[_0xd6d3('0x1a')](function(_0x15d9c0){_0x67ff67(_0x13bcf3[_0xd6d3('0x11')](0x1f5,[_0x298e50[_0xd6d3('0x58')],_0x15d9c0[_0xd6d3('0x19')][_0xd6d3('0x61')]()]['join']('\x20')));});}else{return _0x67ff67(_0x13bcf3[_0xd6d3('0x11')](0x1f5,_0xd6d3('0x6a')));}});},'VoiceQueuesChannelRedirect':function(_0xf9380e){var _0x4114fa=this;return new Promise(function(_0x2b25c1,_0x336e70){if(ami['isConnected']()==![]){return _0x336e70(_0x4114fa[_0xd6d3('0x11')](0x1f4,[config[_0xd6d3('0x12')]['ip'],config[_0xd6d3('0x12')][_0xd6d3('0x13')],_0xd6d3('0x1b')][_0xd6d3('0x14')]('\x20')));}var _0x176559=schema(properties[_0xd6d3('0x72')])['validate'](_0xf9380e);if(_0x176559[_0xd6d3('0x55')]>0x0){return _0x336e70(_0x4114fa[_0xd6d3('0x11')](0x1f4,_[_0xd6d3('0x57')](_0x176559,_0xd6d3('0x19'))[_0xd6d3('0x14')](',\x20')));}var _0x4e0a91=_[_0xd6d3('0x5f')](_0x5eec4d[_0xd6d3('0x70')],{'uniqueid':_0xf9380e[_0xd6d3('0x58')]});if(_0x4e0a91&&_0x4e0a91[_0xd6d3('0x59')]){return ami['Action']({'action':_0xd6d3('0x73'),'channel':_0x4e0a91[_0xd6d3('0x59')],'exten':_0xf9380e[_0xd6d3('0x74')],'context':_0xf9380e[_0xd6d3('0x75')]||_0x4e0a91[_0xd6d3('0x75')],'priority':0x1})['then'](function(_0x415a43){_0x2b25c1({'code':0xc8,'message':[_0xf9380e[_0xd6d3('0x58')],_0x415a43[_0xd6d3('0x19')][_0xd6d3('0x61')]()][_0xd6d3('0x14')]('\x20')});})[_0xd6d3('0x1a')](function(_0x488990){_0x336e70(_0x4114fa['error'](0x1f5,[_0xf9380e['uniqueid'],_0x488990['message']['toLowerCase']()]['join']('\x20')));});}else{return _0x336e70(_0x4114fa['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x402554){return new Promise(function(_0x165f85,_0x41ea8a){var _0x3456d8=_[_0xd6d3('0x76')](_0x5eec4d[_0xd6d3('0xd')]);_0x165f85({'count':_0x3456d8['length'],'rows':_0x3456d8});});},'Telephones':function(_0x55ff49){return new Promise(function(_0x30340b,_0x208eb1){var _0x1c04b4=_['values'](_0x5eec4d[_0xd6d3('0x77')]);_0x30340b({'count':_0x1c04b4[_0xd6d3('0x55')],'rows':_0x1c04b4});});},'Trunks':function(_0x1c48b8){return new Promise(function(_0x59279e,_0x20422e){var _0xbe2599=_[_0xd6d3('0x76')](_0x5eec4d['trunks']);_0x59279e({'count':_0xbe2599['length'],'rows':_0xbe2599});});},'OutboundChannels':function(_0x326387){return new Promise(function(_0x434df2,_0x2de1c2){var _0x17f8bf=_[_0xd6d3('0x76')](_0x5eec4d[_0xd6d3('0x78')]);_0x434df2({'count':_0x17f8bf[_0xd6d3('0x55')],'rows':_0x17f8bf});});},'Outbound':function(_0x5c36d7){return new Promise(function(_0x2b165b,_0x2698a9){_0x2b165b(_0x5eec4d[_0xd6d3('0x2c')]);});},'Campaigns':function(_0x565ae4){return new Promise(function(_0x23c4f1,_0x2a2d39){var _0x11f7a5=_[_0xd6d3('0x76')](_0x5eec4d[_0xd6d3('0x79')]);_0x23c4f1({'count':_0x11f7a5[_0xd6d3('0x55')],'rows':_0x11f7a5});});},'VoiceQueuesPreview':function(_0x4163a7){var _0x57107f=this;return new Promise(function(_0x5f302b,_0x5e813d){_0x11f945[_0xd6d3('0x7a')](_0x4163a7['id'])['then'](function(_0x30c9e8){_0x5f302b({'code':0xc8,'message':_0x30c9e8[_0xd6d3('0x19')]});})['catch'](function(_0x2e3e76){_0x5e813d(_0x57107f[_0xd6d3('0x11')](0x1f4,_0x2e3e76[_0xd6d3('0x19')]));});});},'EventManager':function(_0x51098e){var _0x17b33c=this;return new Promise(function(_0x568f23,_0x22826d){if(!_0x51098e['event']){return _0x22826d(_0x17b33c[_0xd6d3('0x11')](0x1f4,_0xd6d3('0x7b')));}ami[_0xd6d3('0x7c')]('custom:'+_0x51098e['event'],_0x51098e[_0xd6d3('0x19')]);_0x568f23({'code':0xc8,'message':_0x51098e});});},'FaxAccounts':function(_0x277a5d){return new Promise(function(_0x442169,_0x35ae9e){var _0x27a585=_['values'](_0x5eec4d[_0xd6d3('0x7d')]);_0x442169({'count':_0x27a585[_0xd6d3('0x55')],'rows':_0x27a585});});},'SendFax':function(_0x5407a7){var _0xcb895f=this;return new Promise(function(_0x9b7140,_0x5e0ab6){_0x11b54f[_0xd6d3('0x7e')](_0x5407a7)[_0xd6d3('0x5e')](function(_0x24c50){_0x9b7140({'code':0xc8,'message':_0x24c50[_0xd6d3('0x19')]});})[_0xd6d3('0x1a')](function(_0x1ed8a4){_0x5e0ab6(_0xcb895f[_0xd6d3('0x11')](0x1f4,_0x1ed8a4['message']));});});},'CheckAfterSend':function(_0x7af116){var _0x289a32=this;return new Promise(function(_0x177832,_0x109076){_0x11b54f[_0xd6d3('0x7f')](_0x7af116)[_0xd6d3('0x5e')](function(_0x536ad0){_0x177832({'code':0xc8,'message':_0x536ad0[_0xd6d3('0x19')]});})[_0xd6d3('0x1a')](function(_0x4d44d4){_0x109076(_0x289a32[_0xd6d3('0x11')](0x1f4,_0x4d44d4['message']));});});}};var _0xf34465=jayson[_0xd6d3('0x80')](_0xd4332a)['http']();_0xf34465['on'](_0xd6d3('0x11'),function(_0x38d356){return _0x4b3232(_0x38d356);});_0xf34465['listen'](0x232a,_0xd6d3('0x81'),function(){console[_0xd6d3('0x82')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5565(_0xd6d3('0x83')+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 84cd38d..e8c00bc 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 _0x7f7b=['redis','info','[CM][%s][%s]','exec','data1','data2','xmd-contactid','ListId','data3','split','phone','$or','routeId','firstName','lastName','fax','createdAt','scheduledAt','updatedAt','union','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridnum','destcalleridnum','calleridname','Unknown','destcalleridname','[CM][%s][%s]\x20Contact\x20created:%s','','push','format','name','trigger:%s','action','merge','lodash','bluebird','ioredis','util','../../rpc/cmContact','defaults','localhost','socket.io-emitter'];(function(_0x580c77,_0x3e6e60){var _0x3ce3d9=function(_0x37ceec){while(--_0x37ceec){_0x580c77['push'](_0x580c77['shift']());}};_0x3ce3d9(++_0x3e6e60);}(_0x7f7b,0x64));var _0xb7f7=function(_0x2e1d28,_0x19bc3a){_0x2e1d28=_0x2e1d28-0x0;var _0x2dab38=_0x7f7b[_0x2e1d28];return _0x2dab38;};'use strict';var _=require(_0xb7f7('0x0'));var BPromise=require(_0xb7f7('0x1'));var Redis=require(_0xb7f7('0x2'));var util=require(_0xb7f7('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0xb7f7('0x4'));config['redis']=_[_0xb7f7('0x5')](config['redis'],{'host':_0xb7f7('0x6'),'port':0x18eb});var io=require(_0xb7f7('0x7'))(new Redis(config[_0xb7f7('0x8')]));function emit(_0x5aaecb,_0x686dea,_0xe06beb,_0x39baa3,_0x31a31c){logger[_0xb7f7('0x9')](_0xb7f7('0xa'),_0x5aaecb,_0x686dea['id'],_0xe06beb,_0x39baa3,JSON['stringify'](_0x31a31c));io['to'](_0xe06beb)['emit'](_0x39baa3,_0x31a31c);}exports[_0xb7f7('0xb')]=function(_0x496e5f,_0x39e49a,_0x1402e3,_0xe549c5){var _0x3c4ef5,_0x1dae92;var _0x44700b={};var _0x337c1c=Number(_0x1402e3[_0xb7f7('0xc')]);var _0x18eb55=_0x1402e3['data2']?Boolean(Number(_0x1402e3[_0xb7f7('0xd')])):![];var _0x12b39f;if(_0xe549c5[_0xb7f7('0xe')]){_0x44700b['id']=_0xe549c5[_0xb7f7('0xe')];}if(!_0x44700b['id']){_0x44700b[_0xb7f7('0xf')]=_0x337c1c;_0x12b39f=_0x1402e3[_0xb7f7('0x10')]&&_0x1402e3[_0xb7f7('0x10')]!=='0'?_0x1402e3[_0xb7f7('0x10')][_0xb7f7('0x11')](','):[_0xb7f7('0x12')];_0x44700b[_0xb7f7('0x13')]=_['map'](_0x12b39f,function(_0x834aed){var _0x1940ee={};_0x1940ee[_0x834aed]=_0xe549c5[_0xb7f7('0x14')]?_0xe549c5['destcalleridnum']:_0xe549c5['calleridnum'];return _0x1940ee;});}var _0x3e75af=['id',_0xb7f7('0x15'),_0xb7f7('0x16'),_0xb7f7('0x12'),'mobile',_0xb7f7('0x17'),_0xb7f7('0xf'),_0xb7f7('0x18'),_0xb7f7('0x19'),_0xb7f7('0x1a')];var _0x1e2993=_[_0xb7f7('0x1b')](_0x3e75af,_0x12b39f);BPromise['resolve']()[_0xb7f7('0x1c')](cmContactRpc[_0xb7f7('0x1d')]({'attributes':_0x1e2993,'where':_0x44700b}))[_0xb7f7('0x1c')](function(_0x599533){_0x1dae92=_0x599533;if(!_[_0xb7f7('0x1e')](_0x1dae92)){if(_0x1dae92[_0xb7f7('0x1f')]===0x1){_0x3c4ef5=_0x1dae92[0x0];logger[_0xb7f7('0x9')](_0xb7f7('0x20'),_0xe549c5[_0xb7f7('0x21')],_0x39e49a['id'],_0x3c4ef5['id']);}else{logger[_0xb7f7('0x9')](_0xb7f7('0x22'),_0xe549c5[_0xb7f7('0x21')],_0x39e49a['id'],_[_0xb7f7('0x23')](_0x1dae92,'id')[_0xb7f7('0x24')](','));}return;}else{logger[_0xb7f7('0x9')](_0xb7f7('0x25'),_0xe549c5[_0xb7f7('0x21')],_0x39e49a['id']);var _0x3be995={'ListId':_0x337c1c};var _0x5919ba=_0x1402e3[_0xb7f7('0x26')]&&_0x1402e3['data4']!=='0'?_0x1402e3[_0xb7f7('0x26')]:_0xb7f7('0x12');if(_0x18eb55){logger['info'](_0xb7f7('0x27'),_0xe549c5[_0xb7f7('0x21')],_0x39e49a['id']);_0x3be995[_0x5919ba]=_[_0xb7f7('0x28')](_0xe549c5[_0xb7f7('0x14')])?_0xe549c5[_0xb7f7('0x29')]:_0xe549c5[_0xb7f7('0x2a')];if(_[_0xb7f7('0x28')](_0xe549c5['routeId'])){_0x3be995[_0xb7f7('0x15')]=_0xe549c5['calleridname']&&_0xe549c5[_0xb7f7('0x2b')]!==''?_0xe549c5['calleridname']:_0xb7f7('0x2c');}else{_0x3be995[_0xb7f7('0x15')]=_0xe549c5[_0xb7f7('0x2d')]&&_0xe549c5[_0xb7f7('0x2d')]!==''?_0xe549c5[_0xb7f7('0x2d')]:_0xb7f7('0x2c');}return BPromise['resolve']()[_0xb7f7('0x1c')](cmContactRpc['createContact'](_0x3be995))[_0xb7f7('0x1c')](function(_0x465b81){_0x3c4ef5=_0x465b81;_0x1dae92['push'](_0x465b81);if(_0x3c4ef5){logger['info'](_0xb7f7('0x2e'),_0xe549c5[_0xb7f7('0x21')],_0x39e49a['id'],_0x3c4ef5['id']);}return;});}else{logger[_0xb7f7('0x9')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0xe549c5[_0xb7f7('0x21')],_0x39e49a['id']);_0x3be995[_0x5919ba]=_[_0xb7f7('0x28')](_0xe549c5[_0xb7f7('0x14')])?_0xe549c5['calleridnum']:_0xe549c5[_0xb7f7('0x2a')];if(_['isNil'](_0xe549c5[_0xb7f7('0x14')])){_0x3be995[_0xb7f7('0x15')]=_0xe549c5[_0xb7f7('0x2b')]&&_0xe549c5[_0xb7f7('0x2b')]!==_0xb7f7('0x2f')?_0xe549c5[_0xb7f7('0x2b')]:_0xb7f7('0x2c');}else{_0x3be995[_0xb7f7('0x15')]=_0xe549c5[_0xb7f7('0x2d')]&&_0xe549c5['destcalleridname']!==_0xb7f7('0x2f')?_0xe549c5[_0xb7f7('0x2d')]:_0xb7f7('0x2c');}_0x3c4ef5=_0x3be995;_0x1dae92[_0xb7f7('0x30')](_0x3be995);return;}}})[_0xb7f7('0x1c')](function(){if(_0x496e5f){emit(_0xe549c5[_0xb7f7('0x21')],_0x39e49a,util[_0xb7f7('0x31')]('user:%s',_0x496e5f[_0xb7f7('0x32')]),util[_0xb7f7('0x31')](_0xb7f7('0x33'),_0x1402e3[_0xb7f7('0x34')]['toLowerCase']()),{'evt':_[_0xb7f7('0x35')](_0xe549c5,{'autoCreate':_0x18eb55}),'contact':_0x3c4ef5===undefined?{}:_0x3c4ef5,'contacts':_0x1dae92[_0xb7f7('0x1f')]===0x0?undefined:_0x1dae92});}});}; \ No newline at end of file +var _0xfcd8=['user:%s','trigger:%s','action','toLowerCase','merge','lodash','bluebird','util','../../../../config/logger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','stringify','exec','data2','xmd-contactid','ListId','data3','split','$or','map','routeId','destcalleridnum','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','getContacts','then','length','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridnum','firstName','calleridname','','Unknown','destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format'];(function(_0x301902,_0x3d828b){var _0x2c0346=function(_0x54954b){while(--_0x54954b){_0x301902['push'](_0x301902['shift']());}};_0x2c0346(++_0x3d828b);}(_0xfcd8,0x113));var _0x8fcd=function(_0x4d0b53,_0x3138a3){_0x4d0b53=_0x4d0b53-0x0;var _0x12eb7d=_0xfcd8[_0x4d0b53];return _0x12eb7d;};'use strict';var _=require(_0x8fcd('0x0'));var BPromise=require(_0x8fcd('0x1'));var Redis=require('ioredis');var util=require(_0x8fcd('0x2'));var config=require('../../../../config/environment');var logger=require(_0x8fcd('0x3'))('trigger');var cmContactRpc=require(_0x8fcd('0x4'));config[_0x8fcd('0x5')]=_[_0x8fcd('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8fcd('0x7'))(new Redis(config[_0x8fcd('0x5')]));function emit(_0x29cafb,_0x17f765,_0x25a638,_0x5ebc76,_0x4f7a05){logger[_0x8fcd('0x8')](_0x8fcd('0x9'),_0x29cafb,_0x17f765['id'],_0x25a638,_0x5ebc76,JSON[_0x8fcd('0xa')](_0x4f7a05));io['to'](_0x25a638)['emit'](_0x5ebc76,_0x4f7a05);}exports[_0x8fcd('0xb')]=function(_0xf8fbf5,_0x515c4e,_0x397666,_0x231b6f){var _0x5cee40,_0x191dc1;var _0x3a8f84={};var _0x2ce3c2=Number(_0x397666['data1']);var _0x537e11=_0x397666[_0x8fcd('0xc')]?Boolean(Number(_0x397666[_0x8fcd('0xc')])):![];var _0x5c2143;if(_0x231b6f[_0x8fcd('0xd')]){_0x3a8f84['id']=_0x231b6f[_0x8fcd('0xd')];}if(!_0x3a8f84['id']){_0x3a8f84[_0x8fcd('0xe')]=_0x2ce3c2;_0x5c2143=_0x397666[_0x8fcd('0xf')]&&_0x397666[_0x8fcd('0xf')]!=='0'?_0x397666['data3'][_0x8fcd('0x10')](','):['phone'];_0x3a8f84[_0x8fcd('0x11')]=_[_0x8fcd('0x12')](_0x5c2143,function(_0x1d2615){var _0x1a1cb9={};_0x1a1cb9[_0x1d2615]=_0x231b6f[_0x8fcd('0x13')]?_0x231b6f[_0x8fcd('0x14')]:_0x231b6f['calleridnum'];return _0x1a1cb9;});}var _0x467370=['id','firstName',_0x8fcd('0x15'),'phone',_0x8fcd('0x16'),_0x8fcd('0x17'),_0x8fcd('0xe'),_0x8fcd('0x18'),_0x8fcd('0x19'),_0x8fcd('0x1a')];var _0x45160f=_[_0x8fcd('0x1b')](_0x467370,_0x5c2143);BPromise['resolve']()['then'](cmContactRpc[_0x8fcd('0x1c')]({'attributes':_0x45160f,'where':_0x3a8f84}))[_0x8fcd('0x1d')](function(_0x5bfc90){_0x191dc1=_0x5bfc90;if(!_['isEmpty'](_0x191dc1)){if(_0x191dc1[_0x8fcd('0x1e')]===0x1){_0x5cee40=_0x191dc1[0x0];logger[_0x8fcd('0x8')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x231b6f[_0x8fcd('0x1f')],_0x515c4e['id'],_0x5cee40['id']);}else{logger[_0x8fcd('0x8')](_0x8fcd('0x20'),_0x231b6f[_0x8fcd('0x1f')],_0x515c4e['id'],_[_0x8fcd('0x12')](_0x191dc1,'id')[_0x8fcd('0x21')](','));}return;}else{logger[_0x8fcd('0x8')](_0x8fcd('0x22'),_0x231b6f[_0x8fcd('0x1f')],_0x515c4e['id']);var _0x65f185={'ListId':_0x2ce3c2};var _0x44867e=_0x397666[_0x8fcd('0x23')]&&_0x397666[_0x8fcd('0x23')]!=='0'?_0x397666[_0x8fcd('0x23')]:'phone';if(_0x537e11){logger['info'](_0x8fcd('0x24'),_0x231b6f[_0x8fcd('0x1f')],_0x515c4e['id']);_0x65f185[_0x44867e]=_[_0x8fcd('0x25')](_0x231b6f[_0x8fcd('0x13')])?_0x231b6f[_0x8fcd('0x26')]:_0x231b6f[_0x8fcd('0x14')];if(_[_0x8fcd('0x25')](_0x231b6f['routeId'])){_0x65f185[_0x8fcd('0x27')]=_0x231b6f[_0x8fcd('0x28')]&&_0x231b6f['calleridname']!==_0x8fcd('0x29')?_0x231b6f[_0x8fcd('0x28')]:_0x8fcd('0x2a');}else{_0x65f185[_0x8fcd('0x27')]=_0x231b6f[_0x8fcd('0x2b')]&&_0x231b6f[_0x8fcd('0x2b')]!==_0x8fcd('0x29')?_0x231b6f[_0x8fcd('0x2b')]:_0x8fcd('0x2a');}return BPromise[_0x8fcd('0x2c')]()[_0x8fcd('0x1d')](cmContactRpc[_0x8fcd('0x2d')](_0x65f185))[_0x8fcd('0x1d')](function(_0x5cfd9e){_0x5cee40=_0x5cfd9e;_0x191dc1[_0x8fcd('0x2e')](_0x5cfd9e);if(_0x5cee40){logger[_0x8fcd('0x8')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x231b6f[_0x8fcd('0x1f')],_0x515c4e['id'],_0x5cee40['id']);}return;});}else{logger[_0x8fcd('0x8')](_0x8fcd('0x2f'),_0x231b6f[_0x8fcd('0x1f')],_0x515c4e['id']);_0x65f185[_0x44867e]=_['isNil'](_0x231b6f['routeId'])?_0x231b6f[_0x8fcd('0x26')]:_0x231b6f['destcalleridnum'];if(_[_0x8fcd('0x25')](_0x231b6f['routeId'])){_0x65f185['firstName']=_0x231b6f[_0x8fcd('0x28')]&&_0x231b6f[_0x8fcd('0x28')]!==''?_0x231b6f[_0x8fcd('0x28')]:'Unknown';}else{_0x65f185[_0x8fcd('0x27')]=_0x231b6f['destcalleridname']&&_0x231b6f[_0x8fcd('0x2b')]!==_0x8fcd('0x29')?_0x231b6f[_0x8fcd('0x2b')]:_0x8fcd('0x2a');}_0x5cee40=_0x65f185;_0x191dc1['push'](_0x65f185);return;}}})[_0x8fcd('0x1d')](function(){if(_0xf8fbf5){emit(_0x231b6f[_0x8fcd('0x1f')],_0x515c4e,util[_0x8fcd('0x30')](_0x8fcd('0x31'),_0xf8fbf5['name']),util[_0x8fcd('0x30')](_0x8fcd('0x32'),_0x397666[_0x8fcd('0x33')][_0x8fcd('0x34')]()),{'evt':_[_0x8fcd('0x35')](_0x231b6f,{'autoCreate':_0x537e11}),'contact':_0x5cee40===undefined?{}:_0x5cee40,'contacts':_0x191dc1[_0x8fcd('0x1e')]===0x0?undefined:_0x191dc1});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 9ea342c..484ebc3 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 _0xa7dc=['custom:rejectmessage','stringify','prototype','clone','checkTriggers','status','checkTrigger','merge','variables','length','Actions','interface','toLowerCase','contactmanager','motionbar','browser','data2','html','render','template\x20not\x20found','uri','data3','data4','uriLocation','windowWidth','800','data5','data6','600','winArguments','emit','user:%s','name','format','trigger:%s:%s','action','data1','jscripty','exec','queue','routeId','urlforward','script','parse','query','search','replace','checkConditions','some','account','channel','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','membername','lastevent','exports','util','lodash','url','ioredis','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','localhost','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:dialend','custom:newinteraction','custom:incomingmessage','custom:outgoingmessage'];(function(_0x1d1534,_0x15cd4a){var _0x35fbca=function(_0x978e98){while(--_0x978e98){_0x1d1534['push'](_0x1d1534['shift']());}};_0x35fbca(++_0x15cd4a);}(_0xa7dc,0x11d));var _0xca7d=function(_0x25b0ef,_0x2c70e1){_0x25b0ef=_0x25b0ef-0x0;var _0xa44ba8=_0xa7dc[_0x25b0ef];return _0xa44ba8;};'use strict';var util=require(_0xca7d('0x0'));var _=require(_0xca7d('0x1'));var url=require(_0xca7d('0x2'));var Mustache=require('mustache');var Redis=require(_0xca7d('0x3'));var urlforward=require('./urlforward');var integration=require(_0xca7d('0x4'));var cmContact=require(_0xca7d('0x5'));var script=require(_0xca7d('0x6'));var config=require(_0xca7d('0x7'));var logger=require(_0xca7d('0x8'))(_0xca7d('0x9'));var ami=require(_0xca7d('0xa'));config[_0xca7d('0xb')]=_['defaults'](config[_0xca7d('0xb')],{'host':_0xca7d('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xca7d('0xb')]));var operators={'equals':function(_0x52d84f,_0x194d7f){return _0x52d84f==_0x194d7f;},'not_equals':function(_0x5236ce,_0x2c4f91){return _0x5236ce!=_0x2c4f91;}};var barAndWebActions=[_0xca7d('0xd'),_0xca7d('0x2'),_0xca7d('0xe')];function Trigger(_0x38ce56){this['triggers']=_0x38ce56[_0xca7d('0xf')];this['agents']=_0x38ce56[_0xca7d('0x10')];this['voiceQueues']=_0x38ce56[_0xca7d('0x11')];this[_0xca7d('0x12')]=_0x38ce56[_0xca7d('0x12')];this[_0xca7d('0x13')]=_0x38ce56['voiceExtensions'];this['zendeskAccounts']=_0x38ce56['zendeskAccounts'];this[_0xca7d('0x14')]=_0x38ce56[_0xca7d('0x14')];this[_0xca7d('0x15')]=_0x38ce56[_0xca7d('0x15')];this[_0xca7d('0x16')]=_0x38ce56[_0xca7d('0x16')];this[_0xca7d('0x17')]=_0x38ce56[_0xca7d('0x17')];this[_0xca7d('0x18')]=_0x38ce56[_0xca7d('0x18')];this[_0xca7d('0x19')]=_0x38ce56[_0xca7d('0x19')];this['servicenowAccounts']=_0x38ce56['servicenowAccounts'];this[_0xca7d('0x1a')]=_0x38ce56[_0xca7d('0x1a')];this[_0xca7d('0x1b')]=_0x38ce56[_0xca7d('0x1b')];this[_0xca7d('0x1c')]={'zendesk':this['zendeskAccounts'],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0xca7d('0x14')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0xca7d('0x17')],'desk':this[_0xca7d('0x18')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0xca7d('0x1a')],'freshsales':this['freshsalesAccounts'],'servicenow':this['servicenowAccounts']};ami['on'](_0xca7d('0x1d'),this[_0xca7d('0x1e')][_0xca7d('0x1f')](this));ami['on'](_0xca7d('0x20'),this['syncCustomEvent'][_0xca7d('0x1f')](this));ami['on'](_0xca7d('0x21'),this[_0xca7d('0x1e')][_0xca7d('0x1f')](this));ami['on'](_0xca7d('0x22'),this[_0xca7d('0x1e')][_0xca7d('0x1f')](this));ami['on'](_0xca7d('0x23'),this[_0xca7d('0x1e')][_0xca7d('0x1f')](this));ami['on']('custom:agentnoanswer',this[_0xca7d('0x1e')][_0xca7d('0x1f')](this));ami['on'](_0xca7d('0x24'),this[_0xca7d('0x1e')][_0xca7d('0x1f')](this));ami['on'](_0xca7d('0x25'),this[_0xca7d('0x1e')][_0xca7d('0x1f')](this));ami['on'](_0xca7d('0x26'),this[_0xca7d('0x1e')]['bind'](this));ami['on'](_0xca7d('0x27'),this[_0xca7d('0x1e')]['bind'](this));ami['on'](_0xca7d('0x28'),this['syncCustomEvent']['bind'](this));ami['on'](_0xca7d('0x29'),this['syncAgentDial'][_0xca7d('0x1f')](this));ami['on'](_0xca7d('0x2a'),this[_0xca7d('0x2b')][_0xca7d('0x1f')](this));ami['on'](_0xca7d('0x2c'),this[_0xca7d('0x2b')]['bind'](this));ami['on'](_0xca7d('0x2d'),this[_0xca7d('0x1e')][_0xca7d('0x1f')](this));ami['on']('custom:closedinteraction',this[_0xca7d('0x1e')][_0xca7d('0x1f')](this));ami['on'](_0xca7d('0x2e'),this[_0xca7d('0x1e')][_0xca7d('0x1f')](this));ami['on'](_0xca7d('0x2f'),this[_0xca7d('0x1e')][_0xca7d('0x1f')](this));ami['on']('custom:acceptmessage',this['syncCustomEvent'][_0xca7d('0x1f')](this));ami['on'](_0xca7d('0x30'),this[_0xca7d('0x1e')][_0xca7d('0x1f')](this));}Trigger['prototype']['emit']=function(_0x38f3a0,_0x5acb63,_0x509f3a){logger['info'](_0x38f3a0,_0x5acb63,JSON[_0xca7d('0x31')](_0x509f3a));io['to'](_0x38f3a0)['emit'](_0x5acb63,_0x509f3a);};Trigger[_0xca7d('0x32')][_0xca7d('0x1e')]=function(_0x2835e9){var _0x545767=_[_0xca7d('0x33')](_0x2835e9);this[_0xca7d('0x34')](_0x545767);};Trigger[_0xca7d('0x32')]['syncAgentDial']=function(_0x3da961){if(this[_0xca7d('0x10')][_0x3da961['interface']]){this[_0xca7d('0x1e')](_0x3da961);}};Trigger['prototype'][_0xca7d('0x34')]=function(_0x4a86d1){var _0x4d2d29;for(var _0x1195c9 in this[_0xca7d('0xf')]){if(this[_0xca7d('0xf')]['hasOwnProperty'](_0x1195c9)){if(this[_0xca7d('0xf')][_0x1195c9][_0xca7d('0x35')]){_0x4d2d29=this[_0xca7d('0x36')](this[_0xca7d('0xf')][_0x1195c9],_0x4a86d1);if(_0x4d2d29){_[_0xca7d('0x37')](_0x4a86d1,_0x4a86d1[_0xca7d('0x38')]);for(var _0x1b9ff0=0x0,_0x59d25d,_0x5ee41d,_0x4ef772;_0x1b9ff00x0){_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(_0x3a0c4f,_0x5dd1a3){var _0x247049=function(_0x144695){while(--_0x144695){_0x3a0c4f['push'](_0x3a0c4f['shift']());}};_0x247049(++_0x5dd1a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 61f35f1..2245abc 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 _0xee55=[']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','dynamics365','../../../../config/environment','redis','defaults','localhost','clientId','remoteUri','username','password','catch','error','toUpperCase','message','4.0','then','value','isNil','validateEmail','email','userEmail',']\x20Agent\x20found\x20','systemuserid','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','calleridnum','POST','contacts','/systemusers(','userId','substring','lastIndexOf','enduserId','GET','contacts?$select=telephone1','Bearer\x20','length','destcalleridnum','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','type','string','nameField','customField','indexOf','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecalls','callDirection','queue','headers','odata-entityid','ticketId','format','emit','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','name'];(function(_0x42146d,_0x5daba1){var _0x354548=function(_0x4cc1bb){while(--_0x4cc1bb){_0x42146d['push'](_0x42146d['shift']());}};_0x354548(++_0x5daba1);}(_0xee55,0x1ce));var _0x5ee5=function(_0x687ddc,_0x2092fa){_0x687ddc=_0x687ddc-0x0;var _0x441991=_0xee55[_0x687ddc];return _0x441991;};'use strict';var _=require(_0x5ee5('0x0'));var BPromise=require(_0x5ee5('0x1'));var rp=require(_0x5ee5('0x2'));var util=require(_0x5ee5('0x3'));var intUtil=require('./util');var md5=require(_0x5ee5('0x4'));var Redis=require(_0x5ee5('0x5'));var logger=require('../../../../config/logger')(_0x5ee5('0x6'));var config=require(_0x5ee5('0x7'));config[_0x5ee5('0x8')]=_[_0x5ee5('0x9')](config[_0x5ee5('0x8')],{'host':_0x5ee5('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5ee5('0x8')]));function getAuthToken(_0x572b7a,_0x54efb7,_0x359efc){var _0x27e8fd={'method':'POST','uri':_0x54efb7,'form':{'client_id':_0x572b7a[_0x5ee5('0xb')],'resource':_0x572b7a[_0x5ee5('0xc')],'username':_0x572b7a[_0x5ee5('0xd')],'password':_0x572b7a['password'],'grant_type':_0x5ee5('0xe'),'client_secret':_0x572b7a['clientSecret']},'json':!![]};return rp(_0x27e8fd)['then'](function(_0x138443){return _0x138443['access_token'];})[_0x5ee5('0xf')](function(_0x38f237){logger[_0x5ee5('0x10')]('['+[_0x359efc[_0x5ee5('0x11')]()]+']\x20Wrong\x20credentials!');return _0x38f237[_0x5ee5('0x12')];});}function getUser(_0x1e97a8,_0x23ecac,_0x14e7ca,_0x39818c,_0x5451b5,_0x46c929){return new BPromise(function(_0x9bdf5e,_0xe5f542){return getAuthToken(_0x23ecac,_0x39818c,_0x46c929)['then'](function(_0x15865f){var _0x1aa125={'method':'GET','uri':_0x5451b5+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x15865f,'OData-Version':_0x5ee5('0x13')},'json':!![]};return rp(_0x1aa125);})[_0x5ee5('0x14')](function(_0x24a7be){var _0xc9d33d=_0x24a7be[_0x5ee5('0x15')];var _0x450297=![];var _0x313282=null;if(!_[_0x5ee5('0x16')](_0x14e7ca)){if(intUtil[_0x5ee5('0x17')](_0x14e7ca[_0x5ee5('0x18')])){_0x1e97a8[_0x5ee5('0x19')]=_0x14e7ca[_0x5ee5('0x18')];for(_0x313282=0x0;_0x313282<_0xc9d33d['length'];_0x313282++){if(_0xc9d33d[_0x313282]['internalemailaddress']===_0x14e7ca[_0x5ee5('0x18')]&&!_0xc9d33d[_0x313282]['isdisabled']){_0x450297=!![];logger['info']('['+[_0x46c929[_0x5ee5('0x11')]()]+_0x5ee5('0x1a')+_0xc9d33d[_0x313282][_0x5ee5('0x1b')]+'!');_0x1e97a8['userId']=_0xc9d33d[_0x313282]['systemuserid'];}}}}if(!_0x450297){logger[_0x5ee5('0x1c')]('['+[_0x46c929[_0x5ee5('0x11')]()]+_0x5ee5('0x1d'));_0x1e97a8['userEmail']=_0x23ecac[_0x5ee5('0xd')];for(_0x313282=0x0;_0x313282<_0xc9d33d['length'];_0x313282++){if(_0xc9d33d[_0x313282]['internalemailaddress']===_0x23ecac[_0x5ee5('0xd')]){_0x1e97a8['userId']=_0xc9d33d[_0x313282]['systemuserid'];}}}_0x9bdf5e(_0x1e97a8);})[_0x5ee5('0xf')](function(_0x9f8183){_0xe5f542(_0x9f8183[_0x5ee5('0x12')]);});});}function createEndUser(_0x3e45d5,_0x511d04,_0xade350,_0x790e46,_0x69cdf3,_0x166e35){return new BPromise(function(_0x528359,_0x4ecde5){return getAuthToken(_0x511d04,_0xade350,_0x166e35)['then'](function(_0x124279){var _0x3916de=_0x166e35[_0x5ee5('0x1e')]()===_0x5ee5('0x1f')?_0x69cdf3['destcalleridnum']:_0x69cdf3[_0x5ee5('0x20')];var _0xa543bb={'method':_0x5ee5('0x21'),'uri':_0x790e46+_0x5ee5('0x22'),'body':{'telephone1':_0x3916de,'fullname':_0x3916de,'firstname':_0x3916de,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x5ee5('0x23')+_0x3e45d5[_0x5ee5('0x24')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x124279,'OData-Version':_0x5ee5('0x13')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0xa543bb);})[_0x5ee5('0x14')](function(_0x2902d1){var _0x34f98d=_0x2902d1['headers']['odata-entityid'];var _0x3c076f=_0x34f98d[_0x5ee5('0x25')](_0x34f98d[_0x5ee5('0x26')]('(')+0x1,_0x34f98d[_0x5ee5('0x26')](')'));_0x3e45d5[_0x5ee5('0x27')]=_0x3c076f;_0x528359(_0x3e45d5);})['catch'](function(_0x3b4f95){_0x4ecde5(_0x3b4f95[_0x5ee5('0x12')]);});});}function getEndUser(_0x47f13f,_0x49f5ac,_0x445515,_0x489c40,_0x51f4fe,_0x33e211){return new BPromise(function(_0x3ca748,_0x4c433e){return getAuthToken(_0x49f5ac,_0x445515,_0x33e211)[_0x5ee5('0x14')](function(_0x54f383){var _0x17ee73={'method':_0x5ee5('0x28'),'uri':_0x489c40+_0x5ee5('0x29'),'headers':{'Authorization':_0x5ee5('0x2a')+_0x54f383,'If-None-Match':null,'OData-Version':_0x5ee5('0x13')},'json':!![]};return rp(_0x17ee73);})[_0x5ee5('0x14')](function(_0x1a89ef){var _0x1c9108=null;if(_0x1a89ef){var _0x3a80fd=_0x1a89ef[_0x5ee5('0x15')];var _0x1766e7=![];for(_0x1c9108=0x0;_0x1c9108<_0x3a80fd[_0x5ee5('0x2b')];_0x1c9108++){var _0x3c38f6=_0x33e211[_0x5ee5('0x1e')]()===_0x5ee5('0x1f')?_0x51f4fe[_0x5ee5('0x2c')]:_0x51f4fe['calleridnum'];if(_0x3a80fd[_0x1c9108][_0x5ee5('0x2d')]===_0x3c38f6){_0x1766e7=!![];_0x47f13f[_0x5ee5('0x27')]=_0x3a80fd[_0x1c9108][_0x5ee5('0x2e')];}}if(_0x1766e7){_0x3ca748(_0x47f13f);}else{return createEndUser(_0x47f13f,_0x49f5ac,_0x445515,_0x489c40,_0x51f4fe,_0x33e211)[_0x5ee5('0x14')](function(_0x450efe){logger[_0x5ee5('0x1c')]('['+[_0x33e211[_0x5ee5('0x11')]()]+_0x5ee5('0x2f'),_0x450efe[_0x5ee5('0x27')]);_0x3ca748(_0x450efe);});}}else{return createEndUser(_0x47f13f,_0x49f5ac,_0x445515,_0x489c40,_0x51f4fe,_0x33e211)[_0x5ee5('0x14')](function(_0x1f0462){logger[_0x5ee5('0x1c')]('['+[_0x33e211['toUpperCase']()]+_0x5ee5('0x30'),_0x1f0462['enduserId']);_0x3ca748(_0x1f0462);});}});});}function getCustomFields(_0x37f769,_0xc532f7,_0x400ec9){var _0x308a65={};if(_0x37f769[_0x5ee5('0x2b')]>0x0){_['forEach'](_0x37f769,function(_0x5b2bda){if(_0x5b2bda[_0x5ee5('0x31')]===_0x5ee5('0x32')&&_0x5b2bda[_0x5ee5('0x33')]&&!_0x5b2bda[_0x5ee5('0x34')]){var _0x2c2f37=_0x5b2bda['idField'][_0x5ee5('0x1e')]();var _0x565dbc=_0x2c2f37[_0x5ee5('0x25')](0x0,_0x2c2f37[_0x5ee5('0x35')]('_'));var _0x2984cb=_0x2c2f37[_0x5ee5('0x25')](_0x2c2f37['indexOf']('_')+0x1);if(_0x565dbc===_0x400ec9){_0x308a65[_0x2984cb]=_0x5b2bda['content'];}}});}return _0x308a65;}function getTicket(_0x53d3ce,_0x13f7ed,_0x5879aa,_0x53793e,_0x1e6530,_0x5228eb,_0x561a32){return new BPromise(function(_0x436357,_0xe0a942){var _0x2c1d19;return getAuthToken(_0x13f7ed,_0x5879aa,_0x561a32)[_0x5ee5('0x14')](function(_0x22ba7e){if(_0x5228eb[_0x5ee5('0x36')]===_0x5ee5('0x37')){_0x2c1d19={'method':_0x5ee5('0x21'),'uri':_0x53793e+_0x5ee5('0x38'),'body':Object[_0x5ee5('0x39')]({},{'title':intUtil[_0x5ee5('0x3a')](_0x5228eb[_0x5ee5('0x3b')],_0x1e6530,'\x20'),'description':intUtil[_0x5ee5('0x3a')](_0x5228eb[_0x5ee5('0x3c')],_0x1e6530,'\x0a'),'customerid_contact@odata.bind':_0x5ee5('0x3d')+_0x53d3ce[_0x5ee5('0x27')]+')','ownerid@odata.bind':_0x5ee5('0x23')+_0x53d3ce[_0x5ee5('0x24')]+')','caseorigincode':'1'},getCustomFields(_0x5228eb[_0x5ee5('0x3e')],_0x1e6530,_0x5228eb[_0x5ee5('0x36')])),'headers':{'Authorization':_0x5ee5('0x2a')+_0x22ba7e,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5228eb[_0x5ee5('0x36')]==='phonecall'){_0x2c1d19={'method':'POST','uri':_0x53793e+_0x5ee5('0x3f'),'body':Object[_0x5ee5('0x39')]({},{'subject':intUtil[_0x5ee5('0x3a')](_0x5228eb['Subjects'],_0x1e6530,'\x20'),'phonenumber':String(_0x1e6530[_0x5ee5('0x20')]),'description':intUtil[_0x5ee5('0x3a')](_0x5228eb[_0x5ee5('0x3c')],_0x1e6530,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x53d3ce['enduserId']+')','ownerid@odata.bind':_0x5ee5('0x23')+_0x53d3ce[_0x5ee5('0x24')]+')','directioncode':_0x53d3ce[_0x5ee5('0x40')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x5ee5('0x23')+_0x53d3ce[_0x5ee5('0x24')]+')','participationtypemask':_0x53d3ce[_0x5ee5('0x40')]===_0x5ee5('0x41')?0x2:0x1},{'partyid_contact@odata.bind':_0x5ee5('0x3d')+_0x53d3ce[_0x5ee5('0x27')]+')','participationtypemask':_0x53d3ce[_0x5ee5('0x40')]===_0x5ee5('0x41')?0x1:0x2}]},getCustomFields(_0x5228eb[_0x5ee5('0x3e')],_0x1e6530,_0x5228eb[_0x5ee5('0x36')])),'headers':{'Authorization':_0x5ee5('0x2a')+_0x22ba7e,'OData-Version':_0x5ee5('0x13')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2c1d19);})[_0x5ee5('0x14')](function(_0x219593){var _0x3ee739=_0x219593[_0x5ee5('0x42')][_0x5ee5('0x43')];var _0x4f4a66=_0x3ee739['substring'](_0x3ee739[_0x5ee5('0x26')]('(')+0x1,_0x3ee739[_0x5ee5('0x26')](')'));_0x53d3ce[_0x5ee5('0x44')]=_0x4f4a66;_0x436357(_0x53d3ce);})['catch'](function(_0x2d97f5){_0xe0a942(_0x2d97f5[_0x5ee5('0x12')]);});});}function emit(_0x40ea46,_0x10890c,_0xf961d8,_0x27f44b){var _0x18768b={'uri':util[_0x5ee5('0x45')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x40ea46,_0xf961d8,_0x27f44b)};io['to'](util[_0x5ee5('0x45')]('user:%s',_0x10890c))[_0x5ee5('0x46')]('trigger:browser:url',_0x18768b);}exports['cs']=function(_0xb98f06,_0x2b5df4,_0x38d842,_0x50ddf6,_0x3e77c5,_0x202c4f,_0x4b74b8,_0x35ccfc){var _0x1eff53={};_0x202c4f[_0x5ee5('0xc')]=intUtil[_0x5ee5('0x47')](_0x202c4f[_0x5ee5('0xc')]);_0x202c4f[_0x5ee5('0x48')]=intUtil['stripTrailingSlash'](_0x202c4f[_0x5ee5('0x48')]);_0x1eff53[_0x5ee5('0x40')]=_0x35ccfc===_0x5ee5('0x41')||_0x35ccfc==='unmanaged'?_0x5ee5('0x41'):_0x5ee5('0x1f');var _0x29b9bc=util['format'](_0x5ee5('0x49'),_0x202c4f[_0x5ee5('0xc')]);var _0x2a4b3a=util[_0x5ee5('0x45')](_0x5ee5('0x4a'),_0x202c4f['tenantId']);var _0x5eabcd=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x202c4f[_0x5ee5('0x48')],_0x2b5df4[_0x5ee5('0x4b')],md5(_0x2b5df4['uniqueid']));if(_0x3e77c5&&_0x3e77c5[_0x5ee5('0x4c')]){logger[_0x5ee5('0x1c')](_0x5ee5('0x4d'),_0x5ee5('0x4e'));_0x2b5df4[_0x5ee5('0x4f')]=_0x5eabcd;}else if(_0x4b74b8&&_0x4b74b8[_0x5ee5('0x50')]&&_0x4b74b8[_0x5ee5('0x50')]!==_0x5ee5('0x51')){logger[_0x5ee5('0x1c')](_0x5ee5('0x52'),_0x5ee5('0x4e'));_0x2b5df4[_0x5ee5('0x4f')]=_0x5eabcd;}else{_0x2b5df4['recordingURL']='';}return getUser(_0x1eff53,_0x202c4f,_0x50ddf6,_0x2a4b3a,_0x29b9bc,_0x35ccfc)[_0x5ee5('0x14')](function(_0x26746f){logger[_0x5ee5('0x1c')]('['+_0x35ccfc[_0x5ee5('0x11')]()+']\x20The\x20User\x20ID\x20is:',_0x26746f[_0x5ee5('0x24')]);logger['info']('['+_0x35ccfc[_0x5ee5('0x11')]()+_0x5ee5('0x53'),_0x26746f[_0x5ee5('0x19')]);return getEndUser(_0x26746f,_0x202c4f,_0x2a4b3a,_0x29b9bc,_0x2b5df4,_0x35ccfc);})[_0x5ee5('0x14')](function(_0x357179){logger[_0x5ee5('0x1c')]('['+_0x35ccfc[_0x5ee5('0x11')]()+_0x5ee5('0x54'),_0x357179[_0x5ee5('0x27')]);logger[_0x5ee5('0x1c')]('['+_0x35ccfc['toUpperCase']()+_0x5ee5('0x55'),_0x2b5df4[_0x5ee5('0x20')]);return getTicket(_0x357179,_0x202c4f,_0x2a4b3a,_0x29b9bc,_0x2b5df4,_0x38d842,_0x35ccfc);})[_0x5ee5('0x14')](function(_0x31b09e){logger[_0x5ee5('0x1c')](util[_0x5ee5('0x45')]('['+_0x35ccfc[_0x5ee5('0x11')]()+_0x5ee5('0x56'),_0x38d842['ticketType'],_0x31b09e[_0x5ee5('0x44')]));logger[_0x5ee5('0x1c')](util['format']('['+_0x35ccfc[_0x5ee5('0x11')]()+_0x5ee5('0x57'),_0x35ccfc));if(_0x35ccfc!==_0x5ee5('0x58')){logger['info']('['+_0x35ccfc['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x202c4f[_0x5ee5('0xc')],_0x50ddf6[_0x5ee5('0x59')],_0x38d842[_0x5ee5('0x36')],_0x31b09e[_0x5ee5('0x44')]);}})[_0x5ee5('0xf')](function(_0x459e59){logger[_0x5ee5('0x10')]('['+_0x35ccfc[_0x5ee5('0x11')]()+_0x5ee5('0x5a'),util[_0x5ee5('0x5b')](_0x459e59,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x234e=['userEmail','length','internalemailaddress','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','toLowerCase','outbound','calleridnum','POST','contacts','/systemusers(','4.0','headers','odata-entityid','lastIndexOf','enduserId','contacts?$select=telephone1','destcalleridnum',']\x20Enduser\x20Created!','type','string','nameField','customField','idField','substring','indexOf','content','ticketType','incident','incidents','assign','getString','Descriptions','/contacts(','phonecalls','Subjects','callDirection','queue','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','stripTrailingSlash','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','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','./util','md5','ioredis','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','clientId','remoteUri','password','access_token','catch','error',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','email'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x234e,0xa8));var _0xe234=function(_0x5435c2,_0x393b27){_0x5435c2=_0x5435c2-0x0;var _0x5e1a77=_0x234e[_0x5435c2];return _0x5e1a77;};'use strict';var _=require(_0xe234('0x0'));var BPromise=require(_0xe234('0x1'));var rp=require('request-promise');var util=require('util');var intUtil=require(_0xe234('0x2'));var md5=require(_0xe234('0x3'));var Redis=require(_0xe234('0x4'));var logger=require('../../../../config/logger')(_0xe234('0x5'));var config=require(_0xe234('0x6'));config[_0xe234('0x7')]=_['defaults'](config[_0xe234('0x7')],{'host':_0xe234('0x8'),'port':0x18eb});var io=require(_0xe234('0x9'))(new Redis(config[_0xe234('0x7')]));function getAuthToken(_0x48e560,_0x46b05b,_0x4e286f){var _0x27c3eb={'method':'POST','uri':_0x46b05b,'form':{'client_id':_0x48e560[_0xe234('0xa')],'resource':_0x48e560[_0xe234('0xb')],'username':_0x48e560['username'],'password':_0x48e560[_0xe234('0xc')],'grant_type':'password','client_secret':_0x48e560['clientSecret']},'json':!![]};return rp(_0x27c3eb)['then'](function(_0x433fea){return _0x433fea[_0xe234('0xd')];})[_0xe234('0xe')](function(_0x521c15){logger[_0xe234('0xf')]('['+[_0x4e286f['toUpperCase']()]+_0xe234('0x10'));return _0x521c15[_0xe234('0x11')];});}function getUser(_0x4b902e,_0xba3673,_0x1b7fb8,_0x1c6811,_0x2d8d7f,_0x4d99e3){return new BPromise(function(_0x397685,_0x1e422a){return getAuthToken(_0xba3673,_0x1c6811,_0x4d99e3)[_0xe234('0x12')](function(_0x6ff88e){var _0x3e2bf3={'method':_0xe234('0x13'),'uri':_0x2d8d7f+_0xe234('0x14'),'headers':{'Authorization':_0xe234('0x15')+_0x6ff88e,'OData-Version':'4.0'},'json':!![]};return rp(_0x3e2bf3);})['then'](function(_0x56f2c0){var _0x544421=_0x56f2c0[_0xe234('0x16')];var _0x3e56e3=![];var _0x4ff5dc=null;if(!_[_0xe234('0x17')](_0x1b7fb8)){if(intUtil[_0xe234('0x18')](_0x1b7fb8[_0xe234('0x19')])){_0x4b902e[_0xe234('0x1a')]=_0x1b7fb8[_0xe234('0x19')];for(_0x4ff5dc=0x0;_0x4ff5dc<_0x544421[_0xe234('0x1b')];_0x4ff5dc++){if(_0x544421[_0x4ff5dc][_0xe234('0x1c')]===_0x1b7fb8['email']&&!_0x544421[_0x4ff5dc][_0xe234('0x1d')]){_0x3e56e3=!![];logger[_0xe234('0x1e')]('['+[_0x4d99e3[_0xe234('0x1f')]()]+_0xe234('0x20')+_0x544421[_0x4ff5dc][_0xe234('0x21')]+'!');_0x4b902e[_0xe234('0x22')]=_0x544421[_0x4ff5dc]['systemuserid'];}}}}if(!_0x3e56e3){logger[_0xe234('0x1e')]('['+[_0x4d99e3[_0xe234('0x1f')]()]+_0xe234('0x23'));_0x4b902e[_0xe234('0x1a')]=_0xba3673[_0xe234('0x24')];for(_0x4ff5dc=0x0;_0x4ff5dc<_0x544421[_0xe234('0x1b')];_0x4ff5dc++){if(_0x544421[_0x4ff5dc][_0xe234('0x1c')]===_0xba3673[_0xe234('0x24')]){_0x4b902e['userId']=_0x544421[_0x4ff5dc][_0xe234('0x21')];}}}_0x397685(_0x4b902e);})[_0xe234('0xe')](function(_0x36f569){_0x1e422a(_0x36f569[_0xe234('0x11')]);});});}function createEndUser(_0x910163,_0x870614,_0x346c20,_0x375d44,_0x359a2a,_0x3597da){return new BPromise(function(_0x1a992d,_0x5290b0){return getAuthToken(_0x870614,_0x346c20,_0x3597da)[_0xe234('0x12')](function(_0x410c62){var _0x1f23ab=_0x3597da[_0xe234('0x25')]()===_0xe234('0x26')?_0x359a2a['destcalleridnum']:_0x359a2a[_0xe234('0x27')];var _0x53fa60={'method':_0xe234('0x28'),'uri':_0x375d44+_0xe234('0x29'),'body':{'telephone1':_0x1f23ab,'fullname':_0x1f23ab,'firstname':_0x1f23ab,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xe234('0x2a')+_0x910163[_0xe234('0x22')]+')'},'headers':{'Authorization':_0xe234('0x15')+_0x410c62,'OData-Version':_0xe234('0x2b')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x53fa60);})[_0xe234('0x12')](function(_0x4b88ef){var _0x34b859=_0x4b88ef[_0xe234('0x2c')][_0xe234('0x2d')];var _0x4c0395=_0x34b859['substring'](_0x34b859[_0xe234('0x2e')]('(')+0x1,_0x34b859[_0xe234('0x2e')](')'));_0x910163[_0xe234('0x2f')]=_0x4c0395;_0x1a992d(_0x910163);})[_0xe234('0xe')](function(_0x4004ad){_0x5290b0(_0x4004ad[_0xe234('0x11')]);});});}function getEndUser(_0x413d89,_0x213195,_0x55e9ab,_0x2770dc,_0x54c601,_0x1989f1){return new BPromise(function(_0xe76382,_0x55d924){return getAuthToken(_0x213195,_0x55e9ab,_0x1989f1)[_0xe234('0x12')](function(_0x3e6018){var _0x67d90e={'method':_0xe234('0x13'),'uri':_0x2770dc+_0xe234('0x30'),'headers':{'Authorization':_0xe234('0x15')+_0x3e6018,'If-None-Match':null,'OData-Version':_0xe234('0x2b')},'json':!![]};return rp(_0x67d90e);})[_0xe234('0x12')](function(_0x1a0bb7){var _0x385672=null;if(_0x1a0bb7){var _0x4abf91=_0x1a0bb7[_0xe234('0x16')];var _0x45be94=![];for(_0x385672=0x0;_0x385672<_0x4abf91[_0xe234('0x1b')];_0x385672++){var _0x502fe2=_0x1989f1[_0xe234('0x25')]()===_0xe234('0x26')?_0x54c601[_0xe234('0x31')]:_0x54c601[_0xe234('0x27')];if(_0x4abf91[_0x385672]['telephone1']===_0x502fe2){_0x45be94=!![];_0x413d89[_0xe234('0x2f')]=_0x4abf91[_0x385672]['contactid'];}}if(_0x45be94){_0xe76382(_0x413d89);}else{return createEndUser(_0x413d89,_0x213195,_0x55e9ab,_0x2770dc,_0x54c601,_0x1989f1)[_0xe234('0x12')](function(_0x15aaa9){logger['info']('['+[_0x1989f1[_0xe234('0x1f')]()]+']\x20Enduser\x20created!',_0x15aaa9[_0xe234('0x2f')]);_0xe76382(_0x15aaa9);});}}else{return createEndUser(_0x413d89,_0x213195,_0x55e9ab,_0x2770dc,_0x54c601,_0x1989f1)[_0xe234('0x12')](function(_0x15c4c6){logger['info']('['+[_0x1989f1[_0xe234('0x1f')]()]+_0xe234('0x32'),_0x15c4c6[_0xe234('0x2f')]);_0xe76382(_0x15c4c6);});}});});}function getCustomFields(_0x533d93,_0x30fbc3,_0x1d1a0e){var _0x2f6a99={};if(_0x533d93['length']>0x0){_['forEach'](_0x533d93,function(_0x5776e3){if(_0x5776e3[_0xe234('0x33')]===_0xe234('0x34')&&_0x5776e3[_0xe234('0x35')]&&!_0x5776e3[_0xe234('0x36')]){var _0x302d97=_0x5776e3[_0xe234('0x37')][_0xe234('0x25')]();var _0x13c24a=_0x302d97[_0xe234('0x38')](0x0,_0x302d97[_0xe234('0x39')]('_'));var _0x11a8f4=_0x302d97[_0xe234('0x38')](_0x302d97[_0xe234('0x39')]('_')+0x1);if(_0x13c24a===_0x1d1a0e){_0x2f6a99[_0x11a8f4]=_0x5776e3[_0xe234('0x3a')];}}});}return _0x2f6a99;}function getTicket(_0xe7c271,_0x506703,_0x4794c3,_0x5281d4,_0x5be269,_0x5c34de,_0x2a507d){return new BPromise(function(_0x211bd5,_0x33ad85){var _0x40e430;return getAuthToken(_0x506703,_0x4794c3,_0x2a507d)[_0xe234('0x12')](function(_0x4f497f){if(_0x5c34de[_0xe234('0x3b')]===_0xe234('0x3c')){_0x40e430={'method':_0xe234('0x28'),'uri':_0x5281d4+_0xe234('0x3d'),'body':Object[_0xe234('0x3e')]({},{'title':intUtil[_0xe234('0x3f')](_0x5c34de['Subjects'],_0x5be269,'\x20'),'description':intUtil[_0xe234('0x3f')](_0x5c34de[_0xe234('0x40')],_0x5be269,'\x0a'),'customerid_contact@odata.bind':_0xe234('0x41')+_0xe7c271['enduserId']+')','ownerid@odata.bind':_0xe234('0x2a')+_0xe7c271['userId']+')','caseorigincode':'1'},getCustomFields(_0x5c34de['Fields'],_0x5be269,_0x5c34de[_0xe234('0x3b')])),'headers':{'Authorization':_0xe234('0x15')+_0x4f497f,'OData-Version':_0xe234('0x2b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5c34de[_0xe234('0x3b')]==='phonecall'){_0x40e430={'method':'POST','uri':_0x5281d4+_0xe234('0x42'),'body':Object[_0xe234('0x3e')]({},{'subject':intUtil[_0xe234('0x3f')](_0x5c34de[_0xe234('0x43')],_0x5be269,'\x20'),'phonenumber':String(_0x5be269['calleridnum']),'description':intUtil[_0xe234('0x3f')](_0x5c34de[_0xe234('0x40')],_0x5be269,'\x0a'),'regardingobjectid_contact@odata.bind':_0xe234('0x41')+_0xe7c271[_0xe234('0x2f')]+')','ownerid@odata.bind':'/systemusers('+_0xe7c271[_0xe234('0x22')]+')','directioncode':_0xe7c271[_0xe234('0x44')]===_0xe234('0x45')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0xe7c271[_0xe234('0x22')]+')','participationtypemask':_0xe7c271['callDirection']===_0xe234('0x45')?0x2:0x1},{'partyid_contact@odata.bind':_0xe234('0x41')+_0xe7c271[_0xe234('0x2f')]+')','participationtypemask':_0xe7c271[_0xe234('0x44')]===_0xe234('0x45')?0x1:0x2}]},getCustomFields(_0x5c34de['Fields'],_0x5be269,_0x5c34de[_0xe234('0x3b')])),'headers':{'Authorization':_0xe234('0x15')+_0x4f497f,'OData-Version':_0xe234('0x2b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x40e430);})['then'](function(_0xa17420){var _0x5a8344=_0xa17420['headers'][_0xe234('0x2d')];var _0x5685f9=_0x5a8344[_0xe234('0x38')](_0x5a8344[_0xe234('0x2e')]('(')+0x1,_0x5a8344['lastIndexOf'](')'));_0xe7c271[_0xe234('0x46')]=_0x5685f9;_0x211bd5(_0xe7c271);})[_0xe234('0xe')](function(_0x406f17){_0x33ad85(_0x406f17[_0xe234('0x11')]);});});}function emit(_0x44a8dd,_0x31579c,_0x2a8b16,_0x528ef5){var _0x58f6b4={'uri':util['format'](_0xe234('0x47'),_0x44a8dd,_0x2a8b16,_0x528ef5)};io['to'](util[_0xe234('0x48')](_0xe234('0x49'),_0x31579c))['emit']('trigger:browser:url',_0x58f6b4);}exports['cs']=function(_0x44adbd,_0x5afb2d,_0x5d877b,_0x2e5d7,_0x100e9d,_0x2f4190,_0x1fe308,_0x197ce8){var _0x4add41={};_0x2f4190['remoteUri']=intUtil[_0xe234('0x4a')](_0x2f4190[_0xe234('0xb')]);_0x2f4190[_0xe234('0x4b')]=intUtil[_0xe234('0x4a')](_0x2f4190[_0xe234('0x4b')]);_0x4add41[_0xe234('0x44')]=_0x197ce8===_0xe234('0x45')||_0x197ce8===_0xe234('0x4c')?_0xe234('0x45'):_0xe234('0x26');var _0x4d87fb=util[_0xe234('0x48')](_0xe234('0x4d'),_0x2f4190[_0xe234('0xb')]);var _0x35273c=util[_0xe234('0x48')](_0xe234('0x4e'),_0x2f4190[_0xe234('0x4f')]);var _0x395b04=util['format'](_0xe234('0x50'),_0x2f4190[_0xe234('0x4b')],_0x5afb2d['uniqueid'],md5(_0x5afb2d[_0xe234('0x51')]));if(_0x100e9d&&_0x100e9d['monitor_format']){logger[_0xe234('0x1e')](_0xe234('0x52'),_0xe234('0x53'));_0x5afb2d[_0xe234('0x54')]=_0x395b04;}else if(_0x1fe308&&_0x1fe308[_0xe234('0x55')]&&_0x1fe308[_0xe234('0x55')]!==_0xe234('0x56')){logger[_0xe234('0x1e')]('[OUTBOUND]',_0xe234('0x53'));_0x5afb2d[_0xe234('0x54')]=_0x395b04;}else{_0x5afb2d[_0xe234('0x54')]='';}return getUser(_0x4add41,_0x2f4190,_0x2e5d7,_0x35273c,_0x4d87fb,_0x197ce8)[_0xe234('0x12')](function(_0x4d8d14){logger['info']('['+_0x197ce8[_0xe234('0x1f')]()+_0xe234('0x57'),_0x4d8d14['userId']);logger[_0xe234('0x1e')]('['+_0x197ce8[_0xe234('0x1f')]()+_0xe234('0x58'),_0x4d8d14[_0xe234('0x1a')]);return getEndUser(_0x4d8d14,_0x2f4190,_0x35273c,_0x4d87fb,_0x5afb2d,_0x197ce8);})[_0xe234('0x12')](function(_0x6cff79){logger[_0xe234('0x1e')]('['+_0x197ce8[_0xe234('0x1f')]()+_0xe234('0x59'),_0x6cff79[_0xe234('0x2f')]);logger[_0xe234('0x1e')]('['+_0x197ce8[_0xe234('0x1f')]()+_0xe234('0x5a'),_0x5afb2d['calleridnum']);return getTicket(_0x6cff79,_0x2f4190,_0x35273c,_0x4d87fb,_0x5afb2d,_0x5d877b,_0x197ce8);})[_0xe234('0x12')](function(_0x56d0cf){logger[_0xe234('0x1e')](util[_0xe234('0x48')]('['+_0x197ce8[_0xe234('0x1f')]()+_0xe234('0x5b'),_0x5d877b[_0xe234('0x3b')],_0x56d0cf[_0xe234('0x46')]));logger[_0xe234('0x1e')](util[_0xe234('0x48')]('['+_0x197ce8['toUpperCase']()+_0xe234('0x5c'),_0x197ce8));if(_0x197ce8!=='unmanaged'){logger[_0xe234('0x1e')]('['+_0x197ce8[_0xe234('0x1f')]()+']',_0xe234('0x5d'));emit(_0x2f4190[_0xe234('0xb')],_0x2e5d7[_0xe234('0x5e')],_0x5d877b[_0xe234('0x3b')],_0x56d0cf[_0xe234('0x46')]);}})[_0xe234('0xe')](function(_0x31f05d){logger[_0xe234('0xf')]('['+_0x197ce8['toUpperCase']()+_0xe234('0x5f'),util[_0xe234('0x60')](_0x31f05d,{'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 e469f7b..4827aac 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 _0x097c=['push','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','trigger:browser:url','catch','error','outbound','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]','user:%s','lastevent','toUpperCase','recordingURL','md5','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','remoteUri','POST','Ticket\x20created!','validateEmail','then','length','Agent\x20found!','contact','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!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','apiKey','toString','base64','[HTTP]','stringify','GET','map','forEach','type','string','nameField','customField','content','idField'];(function(_0x54ee2b,_0x4f882a){var _0x2dff26=function(_0x3302fe){while(--_0x3302fe){_0x54ee2b['push'](_0x54ee2b['shift']());}};_0x2dff26(++_0x4f882a);}(_0x097c,0xdb));var _0xc097=function(_0x2b26fb,_0x34a3d8){_0x2b26fb=_0x2b26fb-0x0;var _0x4d6628=_0x097c[_0x2b26fb];return _0x4d6628;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xc097('0x0'));var util=require(_0xc097('0x1'));var Redis=require(_0xc097('0x2'));var intUtil=require('./util');var config=require(_0xc097('0x3'));var logger=require(_0xc097('0x4'))(_0xc097('0x5'));config[_0xc097('0x6')]=_['defaults'](config[_0xc097('0x6')],{'host':_0xc097('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0xc097('0x8'),'Accept':'application/json'};function emit(_0x10fd2c,_0x124583,_0x15dad9){io['to'](_0x10fd2c)[_0xc097('0x9')](_0x124583,_0x15dad9);}function getTicket(_0x379382,_0x1f1e10,_0x4e734d,_0x45c617,_0x3e2513){logger[_0xc097('0xa')](_0xc097('0xb'));var _0x581795=_[_0xc097('0xc')]({'responder_id':_0x1f1e10['id'],'requester_id':_0x4e734d['id'],'name':util['format'](_0xc097('0xd'),_0x3e2513[_0xc097('0xe')]),'phone':_0x3e2513['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xc097('0xf')](_0x45c617[_0xc097('0x10')],_0x3e2513,'\x20'),'description':intUtil[_0xc097('0xf')](_0x45c617[_0xc097('0x11')],_0x3e2513,_0xc097('0x12')),'tags':getTags(_0x45c617[_0xc097('0x13')],_0xc097('0x14'))},getCustomFields(_0x45c617[_0xc097('0x15')],_0x3e2513));_0x581795[_0xc097('0x16')]=_[_0xc097('0x17')](_[_0xc097('0x18')](_0x581795['custom_fields'],'id'),_0xc097('0x19'));return request({'uri':util[_0xc097('0x1a')](_0xc097('0x1b'),_0x379382[_0xc097('0x1c')]),'method':_0xc097('0x1d'),'body':_0x581795})['then'](function(_0x4bda2d){logger[_0xc097('0xa')](_0xc097('0x1e'));return _0x4bda2d;});}function getUser(_0x497b93,_0x55270e){if(intUtil[_0xc097('0x1f')](_0x55270e)){return request({'uri':util[_0xc097('0x1a')]('%s/api/v2/agents',_0x497b93[_0xc097('0x1c')]),'qs':{'email':_0x55270e}})[_0xc097('0x20')](function(_0x4b4485){if(_0x4b4485[_0xc097('0x21')]){logger['info'](_0xc097('0x22'));return _['find'](_0x4b4485,function(_0x384946){return _0x384946[_0xc097('0x23')]['email']===_0x55270e;});}else{logger[_0xc097('0xa')](_0xc097('0x24'));return request({'uri':util[_0xc097('0x1a')](_0xc097('0x25'),_0x497b93[_0xc097('0x1c')])})[_0xc097('0x20')](function(_0x5da8ed){logger[_0xc097('0xa')](_0xc097('0x26'));return _0x5da8ed;});}});}else{logger[_0xc097('0xa')](_0xc097('0x27'));return request({'uri':util['format'](_0xc097('0x25'),_0x497b93['remoteUri'])})['then'](function(_0x24de80){logger[_0xc097('0xa')](_0xc097('0x26'));return _0x24de80;});}}function getEndUser(_0x3618d7,_0x10057b,_0x39b837){logger['info'](_0xc097('0x28'),_0x39b837);return request({'uri':util[_0xc097('0x1a')]('%s/api/v2/contacts',_0x3618d7[_0xc097('0x1c')]),'qs':{'phone':_0x39b837}})['then'](function(_0x4af70d){if(_0x4af70d['length']){logger[_0xc097('0xa')](_0xc097('0x29'));return _[_0xc097('0x2a')](_0x4af70d,{'phone':_0x39b837});}else{logger[_0xc097('0xa')](_0xc097('0x2b'));return request({'uri':util['format'](_0xc097('0x2c'),_0x3618d7[_0xc097('0x1c')]),'method':'POST','body':{'name':_0x10057b,'phone':_0x39b837}})[_0xc097('0x20')](function(_0x4c90e1){logger[_0xc097('0xa')](_0xc097('0x2d'));return _0x4c90e1;});}});}function getAuth(_0x5011f5){return util[_0xc097('0x1a')]('Basic\x20%s',new Buffer(_0x5011f5[_0xc097('0x2e')]+':X')[_0xc097('0x2f')](_0xc097('0x30')));}function request(_0x674f37){logger['debug'](_0xc097('0x31'),JSON[_0xc097('0x32')](_0x674f37));return rp(_['defaults'](_0x674f37,{'method':_0xc097('0x33'),'headers':headers,'json':!![]}));}function getTags(_0xe3272c,_0x2de90e){var _0xca009c=[];if(_0xe3272c&&_0xe3272c[_0xc097('0x21')]>0x0){_0xca009c=_[_0xc097('0x34')](_0xe3272c,_0x2de90e);}return _0xca009c;}function getCustomFields(_0x40add1,_0x57bf99){var _0x1933c6=[];var _0x187e83={'custom_fields':[]};if(_0x40add1[_0xc097('0x21')]>0x0){_[_0xc097('0x35')](_0x40add1,function(_0x424fa4){if(_0x424fa4[_0xc097('0x36')]===_0xc097('0x37')&&_0x424fa4[_0xc097('0x38')]&&!_0x424fa4[_0xc097('0x39')]){_0x187e83[_0x424fa4[_0xc097('0x38')]['toLowerCase']()]=_0x424fa4[_0xc097('0x3a')][_0xc097('0x2f')]();}else if(_0x424fa4['type']===_0xc097('0x37')&&_0x424fa4[_0xc097('0x3b')]&&_0x424fa4[_0xc097('0x39')]){_0x187e83[_0xc097('0x16')][_0xc097('0x3c')]({'id':_0x424fa4[_0xc097('0x3b')],'value':_0x424fa4[_0xc097('0x3a')][_0xc097('0x2f')]()});}else if(_0x424fa4[_0xc097('0x36')]===_0xc097('0x3d')&&_0x424fa4[_0xc097('0x3e')]&&_0x424fa4[_0xc097('0x3b')]&&_0x424fa4[_0xc097('0x39')]){_0x57bf99[_0x424fa4[_0xc097('0x3e')]]&&_0x187e83['custom_fields'][_0xc097('0x3c')]({'id':_0x424fa4[_0xc097('0x3b')],'value':_0x57bf99[_0x424fa4[_0xc097('0x3e')]][_0xc097('0x2f')]()});}else if(_0x424fa4['type']===_0xc097('0x3f')&&_0x424fa4[_0xc097('0x40')]&&_0x424fa4['Variable'][_0xc097('0x14')]&&_0x424fa4[_0xc097('0x3b')]&&_0x424fa4[_0xc097('0x39')]){_0x57bf99[_0x424fa4[_0xc097('0x40')][_0xc097('0x14')][_0xc097('0x41')]()]&&_0x187e83[_0xc097('0x16')]['push']({'id':_0x424fa4['idField'],'value':_0x57bf99[_0x424fa4[_0xc097('0x40')][_0xc097('0x14')][_0xc097('0x41')]()]['toString']()});}});}return _0x187e83;}exports[_0xc097('0x42')]=function(_0x6a5117,_0xc7181a,_0x26c08b,_0x1fbdf6,_0xf8e632,_0x36ff3e){var _0x4ac98d,_0x58169e;_0x36ff3e[_0xc097('0x1c')]=intUtil[_0xc097('0x43')](_0x36ff3e[_0xc097('0x1c')]);_0x36ff3e[_0xc097('0x44')]=intUtil['stripTrailingSlash'](_0x36ff3e[_0xc097('0x44')]);if(_0xf8e632&&_0xf8e632[_0xc097('0x45')]){logger[_0xc097('0xa')]('[QUEUE]',_0xc097('0x46'));_0xc7181a['recordingURL']=util['format'](_0xc097('0x47'),_0x36ff3e[_0xc097('0x44')],_0xc7181a[_0xc097('0x48')],md5(_0xc7181a[_0xc097('0x48')]));}else{_0xc7181a['recordingURL']='';}headers[_0xc097('0x49')]=getAuth(_0x36ff3e);return getUser(_0x36ff3e,_0x1fbdf6[_0xc097('0x4a')])[_0xc097('0x20')](function(_0xe0ce89){_0x4ac98d=_0xe0ce89;logger['info'](_0xc097('0x4b'),_0x4ac98d['id']);return getEndUser(_0x36ff3e,_0xc7181a['calleridname'],_0xc7181a[_0xc097('0x4c')]);})[_0xc097('0x20')](function(_0x3c165b){_0x58169e=_0x3c165b;logger['info'](_0xc097('0x4d'),_0x58169e['id']);return getTicket(_0x36ff3e,_0x4ac98d,_0x58169e,_0x26c08b,_0xc7181a);})['then'](function(_0x44f0ff){if(_0x44f0ff&&_0x44f0ff['id']){logger[_0xc097('0xa')](_0xc097('0x1e'));logger[_0xc097('0xa')](_0xc097('0x4e'),_0x44f0ff['id']);logger['info'](_0xc097('0x4f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc097('0x1a')]('user:%s',_0x1fbdf6[_0xc097('0x14')]),_0xc097('0x50'),{'uri':util[_0xc097('0x1a')]('%s/helpdesk/tickets/%d',_0x36ff3e[_0xc097('0x1c')],_0x44f0ff['id'])});}})[_0xc097('0x51')](function(_0x58e32b){logger[_0xc097('0x52')]('[QUEUE]',JSON[_0xc097('0x32')](_0x58e32b));});};exports[_0xc097('0x53')]=function(_0x183da8,_0x6871ce,_0x475e83,_0xc0d01f,_0x3347a1,_0x36f2e3,_0x4c7050){var _0x3ca1c6,_0x42d365;_0x36f2e3[_0xc097('0x1c')]=intUtil[_0xc097('0x43')](_0x36f2e3['remoteUri']);_0x36f2e3[_0xc097('0x44')]=intUtil[_0xc097('0x43')](_0x36f2e3[_0xc097('0x44')]);if(_0x4c7050&&_0x4c7050[_0xc097('0x54')]&&_0x4c7050['recordingFormat']!==_0xc097('0x55')){logger['info']('[OUTBOUND]',_0xc097('0x46'));_0x6871ce['recordingURL']=util[_0xc097('0x1a')](_0xc097('0x47'),_0x36f2e3['serverUrl'],_0x6871ce[_0xc097('0x48')],md5(_0x6871ce['uniqueid']));}headers[_0xc097('0x49')]=getAuth(_0x36f2e3);return getUser(_0x36f2e3,_0xc0d01f[_0xc097('0x4a')])[_0xc097('0x20')](function(_0x42dbb1){_0x3ca1c6=_0x42dbb1;logger[_0xc097('0xa')](_0xc097('0x4b'),_0x3ca1c6['id']);return getEndUser(_0x36f2e3,_0x6871ce[_0xc097('0x56')],_0x6871ce[_0xc097('0x57')]);})[_0xc097('0x20')](function(_0x208543){_0x42d365=_0x208543;logger[_0xc097('0xa')](_0xc097('0x4d'),_0x42d365['id']);return getTicket(_0x36f2e3,_0x3ca1c6,_0x42d365,_0x475e83,_0x6871ce);})[_0xc097('0x20')](function(_0x90d475){if(_0x90d475&&_0x90d475['id']){logger[_0xc097('0xa')](_0xc097('0x1e'));logger['info'](_0xc097('0x4e'),_0x90d475['id']);logger[_0xc097('0xa')](_0xc097('0x58'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc097('0x1a')](_0xc097('0x59'),_0xc0d01f[_0xc097('0x14')]),'trigger:browser:url',{'uri':util[_0xc097('0x1a')]('%s/helpdesk/tickets/%d',_0x36f2e3[_0xc097('0x1c')],_0x90d475['id'])});}})[_0xc097('0x51')](function(_0x331ed1){logger['error']('[OUTBOUND]',JSON[_0xc097('0x32')](_0x331ed1));});};exports['unmanaged']=function(_0x2d0b3c,_0x39e931,_0x33fc40,_0x54760a,_0x383cc1,_0x3d2172){var _0x5b4089,_0x4c7ffa;_0x3d2172[_0xc097('0x1c')]=intUtil[_0xc097('0x43')](_0x3d2172[_0xc097('0x1c')]);_0x3d2172[_0xc097('0x44')]=intUtil[_0xc097('0x43')](_0x3d2172[_0xc097('0x44')]);if(_0x383cc1&&_0x383cc1[_0xc097('0x45')]){logger[_0xc097('0xa')]('['+_0x39e931[_0xc097('0x5a')][_0xc097('0x5b')]()+']',_0xc097('0x46'));_0x39e931[_0xc097('0x5c')]=util[_0xc097('0x1a')](_0xc097('0x47'),_0x3d2172['serverUrl'],_0x39e931['uniqueid'],md5(_0x39e931['uniqueid']));}else{_0x39e931['recordingURL']='';}headers['Authorization']=getAuth(_0x3d2172);return getUser(_0x3d2172,'')['then'](function(_0x21cd92){_0x5b4089=_0x21cd92;logger[_0xc097('0xa')]('The\x20User\x20ID\x20is:',_0x5b4089['id']);return getEndUser(_0x3d2172,_0x39e931[_0xc097('0xe')],_0x39e931['calleridnum']);})[_0xc097('0x20')](function(_0x41dedb){_0x4c7ffa=_0x41dedb;logger['info'](_0xc097('0x4d'),_0x4c7ffa['id']);return getTicket(_0x3d2172,_0x5b4089,_0x4c7ffa,_0x33fc40,_0x39e931);})[_0xc097('0x20')](function(_0x1d226c){if(_0x1d226c){logger[_0xc097('0xa')](_0xc097('0x1e'));logger['info'](_0xc097('0x4e'),_0x1d226c['id']);}})['catch'](function(_0xdc0034){logger[_0xc097('0x52')]('['+_0x39e931[_0xc097('0x5a')][_0xc097('0x5b')]()+']',JSON[_0xc097('0x32')](_0xdc0034));});}; \ No newline at end of file +var _0x2906=['redis','localhost','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','POST','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','then','Agent\x20found!','find','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','defaults','map','forEach','type','string','nameField','toLowerCase','content','customField','push','idField','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','Authorization','email','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','error','unmanaged','toUpperCase','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','freshdesk'];(function(_0x261a87,_0x523c80){var _0x2047e6=function(_0x355119){while(--_0x355119){_0x261a87['push'](_0x261a87['shift']());}};_0x2047e6(++_0x523c80);}(_0x2906,0x1c5));var _0x6290=function(_0x17eec6,_0x54a955){_0x17eec6=_0x17eec6-0x0;var _0x1e4d32=_0x2906[_0x17eec6];return _0x1e4d32;};'use strict';var _=require('lodash');var rp=require(_0x6290('0x0'));var md5=require(_0x6290('0x1'));var util=require(_0x6290('0x2'));var Redis=require('ioredis');var intUtil=require(_0x6290('0x3'));var config=require(_0x6290('0x4'));var logger=require(_0x6290('0x5'))(_0x6290('0x6'));config['redis']=_['defaults'](config[_0x6290('0x7')],{'host':_0x6290('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0x6290('0x9'),'Accept':_0x6290('0x9')};function emit(_0x21ef66,_0x27a843,_0x514886){io['to'](_0x21ef66)[_0x6290('0xa')](_0x27a843,_0x514886);}function getTicket(_0x6f1f11,_0x1364ef,_0x50edb5,_0x2c1915,_0x52d65d){logger[_0x6290('0xb')]('Creating\x20new\x20ticket...');var _0x436735=_[_0x6290('0xc')]({'responder_id':_0x1364ef['id'],'requester_id':_0x50edb5['id'],'name':util[_0x6290('0xd')](_0x6290('0xe'),_0x52d65d[_0x6290('0xf')]),'phone':_0x52d65d[_0x6290('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x6290('0x11')](_0x2c1915['Subjects'],_0x52d65d,'\x20'),'description':intUtil[_0x6290('0x11')](_0x2c1915[_0x6290('0x12')],_0x52d65d,_0x6290('0x13')),'tags':getTags(_0x2c1915[_0x6290('0x14')],_0x6290('0x15'))},getCustomFields(_0x2c1915[_0x6290('0x16')],_0x52d65d));_0x436735[_0x6290('0x17')]=_[_0x6290('0x18')](_[_0x6290('0x19')](_0x436735[_0x6290('0x17')],'id'),_0x6290('0x1a'));return request({'uri':util[_0x6290('0xd')](_0x6290('0x1b'),_0x6f1f11['remoteUri']),'method':_0x6290('0x1c'),'body':_0x436735})['then'](function(_0x4396ad){logger[_0x6290('0xb')](_0x6290('0x1d'));return _0x4396ad;});}function getUser(_0x5e219d,_0x2fc36b){if(intUtil[_0x6290('0x1e')](_0x2fc36b)){return request({'uri':util[_0x6290('0xd')](_0x6290('0x1f'),_0x5e219d[_0x6290('0x20')]),'qs':{'email':_0x2fc36b}})[_0x6290('0x21')](function(_0x447757){if(_0x447757['length']){logger[_0x6290('0xb')](_0x6290('0x22'));return _[_0x6290('0x23')](_0x447757,function(_0x124d89){return _0x124d89['contact']['email']===_0x2fc36b;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x6290('0xd')]('%s/api/v2/agents/me',_0x5e219d['remoteUri'])})['then'](function(_0x392ee8){logger[_0x6290('0xb')](_0x6290('0x24'));return _0x392ee8;});}});}else{logger[_0x6290('0xb')](_0x6290('0x25'));return request({'uri':util[_0x6290('0xd')](_0x6290('0x26'),_0x5e219d['remoteUri'])})[_0x6290('0x21')](function(_0x247d02){logger[_0x6290('0xb')](_0x6290('0x24'));return _0x247d02;});}}function getEndUser(_0x5d6a59,_0x301d34,_0x278171){logger[_0x6290('0xb')](_0x6290('0x27'),_0x278171);return request({'uri':util[_0x6290('0xd')](_0x6290('0x28'),_0x5d6a59[_0x6290('0x20')]),'qs':{'phone':_0x278171}})['then'](function(_0x1f3e38){if(_0x1f3e38[_0x6290('0x29')]){logger[_0x6290('0xb')](_0x6290('0x2a'));return _[_0x6290('0x23')](_0x1f3e38,{'phone':_0x278171});}else{logger[_0x6290('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x6290('0x28'),_0x5d6a59[_0x6290('0x20')]),'method':'POST','body':{'name':_0x301d34,'phone':_0x278171}})[_0x6290('0x21')](function(_0x3b94bc){logger[_0x6290('0xb')]('Enduser\x20created.');return _0x3b94bc;});}});}function getAuth(_0x421adb){return util['format'](_0x6290('0x2b'),new Buffer(_0x421adb[_0x6290('0x2c')]+':X')[_0x6290('0x2d')](_0x6290('0x2e')));}function request(_0x526ce3){logger[_0x6290('0x2f')](_0x6290('0x30'),JSON[_0x6290('0x31')](_0x526ce3));return rp(_[_0x6290('0x32')](_0x526ce3,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x3fae6e,_0xbb4b48){var _0x2bd5bc=[];if(_0x3fae6e&&_0x3fae6e[_0x6290('0x29')]>0x0){_0x2bd5bc=_[_0x6290('0x33')](_0x3fae6e,_0xbb4b48);}return _0x2bd5bc;}function getCustomFields(_0x569b34,_0x25a19a){var _0x49637a=[];var _0x2d5404={'custom_fields':[]};if(_0x569b34[_0x6290('0x29')]>0x0){_[_0x6290('0x34')](_0x569b34,function(_0x18bc1b){if(_0x18bc1b[_0x6290('0x35')]===_0x6290('0x36')&&_0x18bc1b[_0x6290('0x37')]&&!_0x18bc1b['customField']){_0x2d5404[_0x18bc1b[_0x6290('0x37')][_0x6290('0x38')]()]=_0x18bc1b[_0x6290('0x39')][_0x6290('0x2d')]();}else if(_0x18bc1b[_0x6290('0x35')]==='string'&&_0x18bc1b['idField']&&_0x18bc1b[_0x6290('0x3a')]){_0x2d5404[_0x6290('0x17')][_0x6290('0x3b')]({'id':_0x18bc1b[_0x6290('0x3c')],'value':_0x18bc1b[_0x6290('0x39')][_0x6290('0x2d')]()});}else if(_0x18bc1b[_0x6290('0x35')]===_0x6290('0x3d')&&_0x18bc1b['variableName']&&_0x18bc1b[_0x6290('0x3c')]&&_0x18bc1b[_0x6290('0x3a')]){_0x25a19a[_0x18bc1b[_0x6290('0x3e')]]&&_0x2d5404[_0x6290('0x17')][_0x6290('0x3b')]({'id':_0x18bc1b[_0x6290('0x3c')],'value':_0x25a19a[_0x18bc1b[_0x6290('0x3e')]][_0x6290('0x2d')]()});}else if(_0x18bc1b['type']===_0x6290('0x3f')&&_0x18bc1b[_0x6290('0x40')]&&_0x18bc1b[_0x6290('0x40')][_0x6290('0x15')]&&_0x18bc1b['idField']&&_0x18bc1b[_0x6290('0x3a')]){_0x25a19a[_0x18bc1b[_0x6290('0x40')][_0x6290('0x15')][_0x6290('0x38')]()]&&_0x2d5404[_0x6290('0x17')][_0x6290('0x3b')]({'id':_0x18bc1b[_0x6290('0x3c')],'value':_0x25a19a[_0x18bc1b['Variable'][_0x6290('0x15')][_0x6290('0x38')]()][_0x6290('0x2d')]()});}});}return _0x2d5404;}exports[_0x6290('0x41')]=function(_0x2192b7,_0x3b607f,_0x515277,_0x1ae7b0,_0x3aca1e,_0x4b82a7){var _0x2e1ccd,_0x47e0b8;_0x4b82a7[_0x6290('0x20')]=intUtil[_0x6290('0x42')](_0x4b82a7[_0x6290('0x20')]);_0x4b82a7[_0x6290('0x43')]=intUtil[_0x6290('0x42')](_0x4b82a7[_0x6290('0x43')]);if(_0x3aca1e&&_0x3aca1e[_0x6290('0x44')]){logger[_0x6290('0xb')](_0x6290('0x45'),_0x6290('0x46'));_0x3b607f[_0x6290('0x47')]=util[_0x6290('0xd')](_0x6290('0x48'),_0x4b82a7['serverUrl'],_0x3b607f[_0x6290('0x49')],md5(_0x3b607f[_0x6290('0x49')]));}else{_0x3b607f[_0x6290('0x47')]='';}headers[_0x6290('0x4a')]=getAuth(_0x4b82a7);return getUser(_0x4b82a7,_0x1ae7b0[_0x6290('0x4b')])['then'](function(_0xd3e90){_0x2e1ccd=_0xd3e90;logger[_0x6290('0xb')](_0x6290('0x4c'),_0x2e1ccd['id']);return getEndUser(_0x4b82a7,_0x3b607f[_0x6290('0xf')],_0x3b607f['calleridnum']);})['then'](function(_0x2124cc){_0x47e0b8=_0x2124cc;logger[_0x6290('0xb')]('The\x20Enduser\x20ID\x20is:',_0x47e0b8['id']);return getTicket(_0x4b82a7,_0x2e1ccd,_0x47e0b8,_0x515277,_0x3b607f);})[_0x6290('0x21')](function(_0x18279d){if(_0x18279d&&_0x18279d['id']){logger[_0x6290('0xb')]('Ticket\x20created!');logger[_0x6290('0xb')](_0x6290('0x4d'),_0x18279d['id']);logger['info'](_0x6290('0x45'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x6290('0x4e'),_0x1ae7b0['name']),_0x6290('0x4f'),{'uri':util[_0x6290('0xd')](_0x6290('0x50'),_0x4b82a7[_0x6290('0x20')],_0x18279d['id'])});}})['catch'](function(_0x45611d){logger['error'](_0x6290('0x45'),JSON[_0x6290('0x31')](_0x45611d));});};exports[_0x6290('0x51')]=function(_0x10d676,_0x539985,_0x5f30f3,_0x30a7fd,_0x2442ad,_0x6075b1,_0x473023){var _0x546d69,_0x30d152;_0x6075b1[_0x6290('0x20')]=intUtil[_0x6290('0x42')](_0x6075b1[_0x6290('0x20')]);_0x6075b1[_0x6290('0x43')]=intUtil[_0x6290('0x42')](_0x6075b1[_0x6290('0x43')]);if(_0x473023&&_0x473023[_0x6290('0x52')]&&_0x473023[_0x6290('0x52')]!=='none'){logger['info'](_0x6290('0x53'),_0x6290('0x46'));_0x539985[_0x6290('0x47')]=util[_0x6290('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x6075b1[_0x6290('0x43')],_0x539985[_0x6290('0x49')],md5(_0x539985['uniqueid']));}headers[_0x6290('0x4a')]=getAuth(_0x6075b1);return getUser(_0x6075b1,_0x30a7fd[_0x6290('0x4b')])[_0x6290('0x21')](function(_0x33805c){_0x546d69=_0x33805c;logger['info'](_0x6290('0x4c'),_0x546d69['id']);return getEndUser(_0x6075b1,_0x539985[_0x6290('0x54')],_0x539985[_0x6290('0x55')]);})[_0x6290('0x21')](function(_0x17d955){_0x30d152=_0x17d955;logger['info'](_0x6290('0x56'),_0x30d152['id']);return getTicket(_0x6075b1,_0x546d69,_0x30d152,_0x5f30f3,_0x539985);})[_0x6290('0x21')](function(_0x511f12){if(_0x511f12&&_0x511f12['id']){logger[_0x6290('0xb')]('Ticket\x20created!');logger[_0x6290('0xb')](_0x6290('0x4d'),_0x511f12['id']);logger[_0x6290('0xb')](_0x6290('0x53'),_0x6290('0x57'));emit(util[_0x6290('0xd')](_0x6290('0x4e'),_0x30a7fd[_0x6290('0x15')]),'trigger:browser:url',{'uri':util[_0x6290('0xd')](_0x6290('0x50'),_0x6075b1['remoteUri'],_0x511f12['id'])});}})[_0x6290('0x58')](function(_0xc72c8){logger[_0x6290('0x59')](_0x6290('0x53'),JSON[_0x6290('0x31')](_0xc72c8));});};exports[_0x6290('0x5a')]=function(_0x34f1c3,_0x2df09b,_0x183407,_0xb82141,_0x138714,_0x2bb892){var _0x3b54d5,_0x4d279c;_0x2bb892['remoteUri']=intUtil[_0x6290('0x42')](_0x2bb892[_0x6290('0x20')]);_0x2bb892['serverUrl']=intUtil[_0x6290('0x42')](_0x2bb892['serverUrl']);if(_0x138714&&_0x138714['monitor_format']){logger[_0x6290('0xb')]('['+_0x2df09b['lastevent'][_0x6290('0x5b')]()+']','Recording\x20is\x20enabled!');_0x2df09b['recordingURL']=util['format'](_0x6290('0x48'),_0x2bb892['serverUrl'],_0x2df09b['uniqueid'],md5(_0x2df09b[_0x6290('0x49')]));}else{_0x2df09b[_0x6290('0x47')]='';}headers[_0x6290('0x4a')]=getAuth(_0x2bb892);return getUser(_0x2bb892,'')[_0x6290('0x21')](function(_0x45d179){_0x3b54d5=_0x45d179;logger[_0x6290('0xb')](_0x6290('0x4c'),_0x3b54d5['id']);return getEndUser(_0x2bb892,_0x2df09b['calleridname'],_0x2df09b[_0x6290('0x10')]);})['then'](function(_0x51786f){_0x4d279c=_0x51786f;logger[_0x6290('0xb')]('The\x20Enduser\x20ID\x20is:',_0x4d279c['id']);return getTicket(_0x2bb892,_0x3b54d5,_0x4d279c,_0x183407,_0x2df09b);})[_0x6290('0x21')](function(_0x3e13dc){if(_0x3e13dc){logger['info'](_0x6290('0x1d'));logger[_0x6290('0xb')](_0x6290('0x4d'),_0x3e13dc['id']);}})[_0x6290('0x58')](function(_0x3e86bb){logger[_0x6290('0x59')]('['+_0x2df09b['lastevent']['toUpperCase']()+']',JSON[_0x6290('0x31')](_0x3e86bb));});}; \ 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 53fb792..0d4f3e7 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 _0x7c1f=['then','users','email','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','headers','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','length','userId','User\x20found:','Admin\x20selected','userEmail','adminEmail','message','/api/lookup?q=','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','task','Task\x20created:','user:%s','emit','Token\x20token=','apiKey','remoteUri','serverUrl','username','toLowerCase','destcalleridnum','callDirection','unmanaged','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','ticketId','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','ioredis','./util','../../../../config/environment','freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information'];(function(_0x31d209,_0x2698eb){var _0xebfcbf=function(_0x399f9a){while(--_0x399f9a){_0x31d209['push'](_0x31d209['shift']());}};_0xebfcbf(++_0x2698eb);}(_0x7c1f,0x194));var _0xf7c1=function(_0x5b75ae,_0x135e49){_0x5b75ae=_0x5b75ae-0x0;var _0x4b66a7=_0x7c1f[_0x5b75ae];return _0x4b66a7;};'use strict';var _=require(_0xf7c1('0x0'));var rp=require(_0xf7c1('0x1'));var md5=require(_0xf7c1('0x2'));var util=require(_0xf7c1('0x3'));var moment=require(_0xf7c1('0x4'));var Promise=require('bluebird');var Redis=require(_0xf7c1('0x5'));var intUtil=require(_0xf7c1('0x6'));var config=require(_0xf7c1('0x7'));var logger=require('../../../../config/logger')(_0xf7c1('0x8'));config[_0xf7c1('0x9')]=_[_0xf7c1('0xa')](config[_0xf7c1('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xf7c1('0xb'))(new Redis(config[_0xf7c1('0x9')]));function getAdminId(_0x329050,_0x418f9a,_0x30be4a,_0x346575){return new Promise(function(_0x4279ea,_0x211033){var _0x118dfb=![];var _0x1a4415={'method':_0xf7c1('0xc'),'uri':_0x346575+_0xf7c1('0xd'),'json':!![]};_0x1a4415['headers']=_0x30be4a;logger[_0xf7c1('0xe')](_0xf7c1('0xf'));return rp(_0x1a4415)[_0xf7c1('0x10')](function(_0xd4d9b6){if(_0xd4d9b6){var _0xab8f8c=_0xd4d9b6[_0xf7c1('0x11')];var _0x4ffd9a=null;for(_0x4ffd9a=0x0;_0x4ffd9a<_0xab8f8c['length'];_0x4ffd9a++){if(_0xab8f8c[_0x4ffd9a][_0xf7c1('0x12')]===_0x329050['adminEmail']){_0x329050[_0xf7c1('0x13')]=_0xab8f8c[_0x4ffd9a]['id'];_0x118dfb=!![];}}if(_0x118dfb){logger[_0xf7c1('0xe')]('Admin\x20found:',_0x329050[_0xf7c1('0x13')]);_0x4279ea(_0x329050);}else{_0x211033({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x211033({'statusCode':0x194,'message':_0xf7c1('0x14')});}})[_0xf7c1('0x15')](function(_0x315424){logger[_0xf7c1('0x16')]('['+[_0x418f9a[_0xf7c1('0x17')]()]+']',_0x315424['message']);_0x211033(_0x315424);});});}function getUser(_0xcef462,_0x5b5786,_0x298d23){return function(_0x4f0a0a){return new Promise(function(_0x115010,_0x20e3f8){var _0x153861={'method':_0xf7c1('0xc'),'uri':_0x298d23+_0xf7c1('0xd'),'json':!![]};_0x153861[_0xf7c1('0x18')]=_0x5b5786;logger[_0xf7c1('0xe')](_0xf7c1('0x19'));return rp(_0x153861)['then'](function(_0x59f0d2){if(_0x59f0d2){var _0x151b11=_0x59f0d2[_0xf7c1('0x11')];var _0x4ee91e=![];var _0x16d8a1=null;if(_0x4f0a0a[_0xf7c1('0x1a')]!==null){logger['info'](_0xf7c1('0x1b'),_0x4f0a0a['agentEmail']);_0x4f0a0a['userEmail']=_0x4f0a0a['agentEmail'];for(_0x16d8a1=0x0;_0x16d8a1<_0x151b11[_0xf7c1('0x1c')];_0x16d8a1++){if(_0x151b11[_0x16d8a1][_0xf7c1('0x12')]===_0x4f0a0a['agentEmail']){_0x4ee91e=!![];_0x4f0a0a[_0xf7c1('0x1d')]=_0x151b11[_0x16d8a1]['id'];logger[_0xf7c1('0xe')](_0xf7c1('0x1e'),_0x4f0a0a[_0xf7c1('0x1d')]);}}}if(!_0x4ee91e){logger[_0xf7c1('0xe')](_0xf7c1('0x1f'));_0x4f0a0a[_0xf7c1('0x20')]=_0x4f0a0a[_0xf7c1('0x21')];_0x4f0a0a['userId']=_0x4f0a0a['adminId'];_0x4ee91e=!![];}if(_0x4ee91e){_0x115010(_0x4f0a0a);}else{_0x20e3f8({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x20e3f8({'statusCode':0x194,'message':_0xf7c1('0x14')});}})[_0xf7c1('0x15')](function(_0x14ecef){logger[_0xf7c1('0x16')]('['+[_0xcef462[_0xf7c1('0x17')]()]+']',_0x14ecef[_0xf7c1('0x22')]);_0x20e3f8(_0x14ecef);});});};}function searchContact(_0x3d83b0,_0x19af4d,_0x457212,_0x549c29){return new Promise(function(_0x6d74a1,_0x37c472){var _0x4f68c6={'method':_0xf7c1('0xc'),'headers':_0x19af4d,'uri':_0x3d83b0+_0xf7c1('0x23')+_0x549c29+_0xf7c1('0x24')+_0x457212+_0xf7c1('0x25'),'json':!![]};rp(_0x4f68c6)[_0xf7c1('0x10')](function(_0x4acfc4){var _0x1b353e=_['find'](_0x4acfc4[_0xf7c1('0x26')][_0xf7c1('0x26')],[_0x457212,_0x549c29]);_0x6d74a1(_0x1b353e);})[_0xf7c1('0x15')](function(_0x5236cb){_0x37c472(_0x5236cb);});});}function getEndUser(_0x2bd6cb,_0x22ca7a,_0x59c534){return function(_0x48e179){return new Promise(function(_0x44079a,_0x45fc44){logger[_0xf7c1('0xe')](util[_0xf7c1('0x27')](_0xf7c1('0x28'),_0x48e179['contactNumber']));searchContact(_0x59c534,_0x22ca7a,_0xf7c1('0x29'),_0x48e179[_0xf7c1('0x2a')])[_0xf7c1('0x10')](function(_0x285926){if(_0x285926){_0x48e179[_0xf7c1('0x2b')]=_0x285926['id'];logger['info']('Contact\x20found\x20mobile_number:',_0x48e179[_0xf7c1('0x2b')]);return _0x44079a(_0x48e179);}searchContact(_0x59c534,_0x22ca7a,_0xf7c1('0x2c'),_0x48e179[_0xf7c1('0x2a')])[_0xf7c1('0x10')](function(_0x3f7b56){if(_0x3f7b56){_0x48e179['endUserId']=_0x3f7b56['id'];logger['info'](_0xf7c1('0x2d'),_0x48e179[_0xf7c1('0x2b')]);return _0x44079a(_0x48e179);}createEndUser(_0x48e179,_0x2bd6cb,_0x22ca7a,_0x59c534)[_0xf7c1('0x10')](function(_0x20e94e){logger['info'](_0xf7c1('0x2e'),_0x20e94e['endUserId']);return _0x44079a(_0x20e94e);});});})[_0xf7c1('0x15')](function(_0x368e33){_0x45fc44(_0x368e33);});});};}function createEndUser(_0x1f2141,_0x1341ae,_0xcfc71e,_0x137bd7){return new Promise(function(_0x1d9472,_0x5497e4){var _0x530f2b=moment();var _0x21bed5={'method':'POST','uri':_0x137bd7+_0xf7c1('0x2f'),'body':{'contact':{'last_name':_0x1f2141[_0xf7c1('0x2a')],'work_number':_0x1f2141['contactNumber'],'mobile_number':_0x1f2141[_0xf7c1('0x2a')],'owner_id':_0x1f2141['userId'],'created_at':_0x530f2b['format'](_0xf7c1('0x30'))}},'json':!![]};_0x21bed5[_0xf7c1('0x18')]=_0xcfc71e;logger[_0xf7c1('0xe')](_0xf7c1('0x31'));return rp(_0x21bed5)['then'](function(_0x4e12e4){_0x1f2141[_0xf7c1('0x2b')]=_0x4e12e4[_0xf7c1('0x32')]['id'];_0x1d9472(_0x1f2141);})[_0xf7c1('0x15')](function(_0x3903f7){logger[_0xf7c1('0x16')]('['+[_0x1341ae[_0xf7c1('0x17')]()]+']',_0x3903f7['message']);_0x5497e4(_0x3903f7[_0xf7c1('0x22')]);});});}function getTicket(_0x1a876c,_0x538c90,_0x54eb13,_0x3d204f,_0x89897){return function(_0xa059be){logger[_0xf7c1('0xe')](_0xf7c1('0x33'));return new Promise(function(_0x5f011e,_0x50597a){var _0x4f40ed=moment();var _0x3f2204={'method':'POST','uri':_0x54eb13+_0xf7c1('0x34'),'body':{'title':intUtil[_0xf7c1('0x35')](_0x3d204f[_0xf7c1('0x36')],_0x89897,'\x20'),'description':intUtil[_0xf7c1('0x35')](_0x3d204f[_0xf7c1('0x37')],_0x89897,'\x0a'),'owner_id':_0xa059be['userId'],'creater_id':_0xa059be[_0xf7c1('0x13')],'targetable_id':_0xa059be['endUserId'],'targetable_type':'Contact','created_at':_0x4f40ed[_0xf7c1('0x27')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x4f40ed['add'](0x1e,'m')[_0xf7c1('0x27')](_0xf7c1('0x30'))},'json':!![]};_0x3f2204[_0xf7c1('0x18')]=_0x538c90;return rp(_0x3f2204)[_0xf7c1('0x10')](function(_0x35b7a4){_0xa059be['ticketId']=_0x35b7a4[_0xf7c1('0x38')]['id'];logger[_0xf7c1('0xe')](_0xf7c1('0x39'),_0xa059be['ticketId']);_0x5f011e(_0xa059be);})[_0xf7c1('0x15')](function(_0x241f37){logger[_0xf7c1('0x16')]('['+[_0x1a876c[_0xf7c1('0x17')]()]+']',_0x241f37[_0xf7c1('0x22')]);_0x50597a(_0x241f37['message']);});});};}function emit(_0x1d8dcf,_0x59082b,_0x3198e3){var _0x42b46f={'uri':_0x1d8dcf+'/contacts/'+_0x3198e3};io['to'](util[_0xf7c1('0x27')](_0xf7c1('0x3a'),_0x59082b))[_0xf7c1('0x3b')]('trigger:browser:url',_0x42b46f);}exports['cs']=function(_0x2c107a,_0x6c77d6,_0xce9bb,_0x5473df,_0x2a9d28,_0x99e4cf,_0x3d2ec5,_0x5eb40a){var _0xd08daa={};var _0x4e7bfc={'Authorization':_0xf7c1('0x3c')+_0x99e4cf[_0xf7c1('0x3d')]};_0x99e4cf['remoteUri']=intUtil['stripTrailingSlash'](_0x99e4cf[_0xf7c1('0x3e')]);_0x99e4cf['serverUrl']=intUtil['stripTrailingSlash'](_0x99e4cf[_0xf7c1('0x3f')]);var _0x4ae101=_0x99e4cf[_0xf7c1('0x3e')];_0xd08daa[_0xf7c1('0x21')]=_0x99e4cf[_0xf7c1('0x40')];_0xd08daa[_0xf7c1('0x2a')]=_0x5eb40a[_0xf7c1('0x41')]()==='outbound'?_0x6c77d6[_0xf7c1('0x42')]:_0x6c77d6['calleridnum'];_0xd08daa[_0xf7c1('0x43')]=_0x5eb40a==='queue'||_0x5eb40a===_0xf7c1('0x44')?_0xf7c1('0x45'):_0xf7c1('0x46');if(_0x5473df){_0xd08daa[_0xf7c1('0x1a')]=_0x5473df[_0xf7c1('0x12')];}var _0x4ca2da=util['format'](_0xf7c1('0x47'),_0x99e4cf[_0xf7c1('0x3f')],_0x6c77d6[_0xf7c1('0x48')],md5(_0x6c77d6[_0xf7c1('0x48')]));if(_0x2a9d28&&_0x2a9d28[_0xf7c1('0x49')]){logger[_0xf7c1('0xe')](_0xf7c1('0x4a'),_0xf7c1('0x4b'));_0x6c77d6[_0xf7c1('0x4c')]=_0x4ca2da;}else if(_0x3d2ec5&&_0x3d2ec5[_0xf7c1('0x4d')]&&_0x3d2ec5[_0xf7c1('0x4d')]!==_0xf7c1('0x4e')){logger[_0xf7c1('0xe')]('[OUTBOUND]',_0xf7c1('0x4b'));_0x6c77d6[_0xf7c1('0x4c')]=_0x4ca2da;}else{_0x6c77d6[_0xf7c1('0x4c')]='';}return getAdminId(_0xd08daa,_0x5eb40a,_0x4e7bfc,_0x4ae101)[_0xf7c1('0x10')](getUser(_0x5eb40a,_0x4e7bfc,_0x4ae101))[_0xf7c1('0x10')](getEndUser(_0x5eb40a,_0x4e7bfc,_0x4ae101))['then'](getTicket(_0x5eb40a,_0x4e7bfc,_0x4ae101,_0xce9bb,_0x6c77d6))[_0xf7c1('0x10')](function(_0x5920f3){logger[_0xf7c1('0xe')](util[_0xf7c1('0x27')]('The\x20ticket\x20ID\x20is:\x20%s',_0x5920f3[_0xf7c1('0x4f')]));if(_0x5eb40a!==_0xf7c1('0x44')){logger[_0xf7c1('0xe')]('['+[_0x5eb40a[_0xf7c1('0x17')]()]+']',_0xf7c1('0x50'));emit(_0x4ae101,_0x5473df[_0xf7c1('0x51')],_0x5920f3[_0xf7c1('0x2b')]);}})[_0xf7c1('0x15')](function(_0x3ab98a){logger[_0xf7c1('0x16')]('['+[_0x5eb40a[_0xf7c1('0x17')]()]+_0xf7c1('0x52'),util[_0xf7c1('0x53')](_0x3ab98a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7c09=['outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','name','inspect','request-promise','md5','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','localhost','socket.io-emitter','redis','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','GET','Getting\x20user\x20list','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','/api/lookup?q=','&entities=contact','find','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Contact','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','calleridnum','callDirection','queue','unmanaged'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7c09,0x102));var _0x97c0=function(_0x1b5e54,_0x25821a){_0x1b5e54=_0x1b5e54-0x0;var _0x48bdad=_0x7c09[_0x1b5e54];return _0x48bdad;};'use strict';var _=require('lodash');var rp=require(_0x97c0('0x0'));var md5=require(_0x97c0('0x1'));var util=require('util');var moment=require(_0x97c0('0x2'));var Promise=require(_0x97c0('0x3'));var Redis=require(_0x97c0('0x4'));var intUtil=require(_0x97c0('0x5'));var config=require(_0x97c0('0x6'));var logger=require(_0x97c0('0x7'))(_0x97c0('0x8'));config['redis']=_['defaults'](config['redis'],{'host':_0x97c0('0x9'),'port':0x18eb});var io=require(_0x97c0('0xa'))(new Redis(config[_0x97c0('0xb')]));function getAdminId(_0x109bc8,_0x293785,_0x57661a,_0x205520){return new Promise(function(_0x4ac5f1,_0x2d5507){var _0x28cac4=![];var _0x52bce2={'method':'GET','uri':_0x205520+_0x97c0('0xc'),'json':!![]};_0x52bce2[_0x97c0('0xd')]=_0x57661a;logger[_0x97c0('0xe')](_0x97c0('0xf'));return rp(_0x52bce2)[_0x97c0('0x10')](function(_0x3811c5){if(_0x3811c5){var _0x7fc93=_0x3811c5[_0x97c0('0x11')];var _0x9ca3c1=null;for(_0x9ca3c1=0x0;_0x9ca3c1<_0x7fc93[_0x97c0('0x12')];_0x9ca3c1++){if(_0x7fc93[_0x9ca3c1][_0x97c0('0x13')]===_0x109bc8[_0x97c0('0x14')]){_0x109bc8[_0x97c0('0x15')]=_0x7fc93[_0x9ca3c1]['id'];_0x28cac4=!![];}}if(_0x28cac4){logger['info'](_0x97c0('0x16'),_0x109bc8[_0x97c0('0x15')]);_0x4ac5f1(_0x109bc8);}else{_0x2d5507({'statusCode':0x194,'message':_0x97c0('0x17')});}}else{_0x2d5507({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x97c0('0x18')](function(_0x9ca6a8){logger[_0x97c0('0x19')]('['+[_0x293785[_0x97c0('0x1a')]()]+']',_0x9ca6a8[_0x97c0('0x1b')]);_0x2d5507(_0x9ca6a8);});});}function getUser(_0x13d46e,_0x49c0d9,_0x16fea6){return function(_0x3ae7c4){return new Promise(function(_0x51180e,_0x560ac0){var _0x16918b={'method':_0x97c0('0x1c'),'uri':_0x16fea6+_0x97c0('0xc'),'json':!![]};_0x16918b[_0x97c0('0xd')]=_0x49c0d9;logger[_0x97c0('0xe')](_0x97c0('0x1d'));return rp(_0x16918b)[_0x97c0('0x10')](function(_0x432705){if(_0x432705){var _0x323863=_0x432705['users'];var _0x554122=![];var _0x2b74a2=null;if(_0x3ae7c4[_0x97c0('0x1e')]!==null){logger[_0x97c0('0xe')]('Getting\x20user\x20with\x20email',_0x3ae7c4[_0x97c0('0x1e')]);_0x3ae7c4[_0x97c0('0x1f')]=_0x3ae7c4[_0x97c0('0x1e')];for(_0x2b74a2=0x0;_0x2b74a2<_0x323863[_0x97c0('0x12')];_0x2b74a2++){if(_0x323863[_0x2b74a2][_0x97c0('0x13')]===_0x3ae7c4[_0x97c0('0x1e')]){_0x554122=!![];_0x3ae7c4[_0x97c0('0x20')]=_0x323863[_0x2b74a2]['id'];logger['info'](_0x97c0('0x21'),_0x3ae7c4[_0x97c0('0x20')]);}}}if(!_0x554122){logger[_0x97c0('0xe')](_0x97c0('0x22'));_0x3ae7c4['userEmail']=_0x3ae7c4[_0x97c0('0x14')];_0x3ae7c4[_0x97c0('0x20')]=_0x3ae7c4['adminId'];_0x554122=!![];}if(_0x554122){_0x51180e(_0x3ae7c4);}else{_0x560ac0({'statusCode':0x194,'message':_0x97c0('0x17')});}}else{_0x560ac0({'statusCode':0x194,'message':_0x97c0('0x17')});}})[_0x97c0('0x18')](function(_0x4af5a5){logger['error']('['+[_0x13d46e['toUpperCase']()]+']',_0x4af5a5[_0x97c0('0x1b')]);_0x560ac0(_0x4af5a5);});});};}function searchContact(_0x8e3ee7,_0x3a744c,_0x225e43,_0x26939e){return new Promise(function(_0x153b14,_0x4a3645){var _0x10e47e={'method':_0x97c0('0x1c'),'headers':_0x3a744c,'uri':_0x8e3ee7+_0x97c0('0x23')+_0x26939e+'&f='+_0x225e43+_0x97c0('0x24'),'json':!![]};rp(_0x10e47e)[_0x97c0('0x10')](function(_0x21ba0d){var _0x23d2af=_[_0x97c0('0x25')](_0x21ba0d['contacts']['contacts'],[_0x225e43,_0x26939e]);_0x153b14(_0x23d2af);})[_0x97c0('0x18')](function(_0x353fc9){_0x4a3645(_0x353fc9);});});}function getEndUser(_0x23080c,_0x58f2e8,_0xdedd82){return function(_0x1cebe7){return new Promise(function(_0x52bdfe,_0x30147b){logger[_0x97c0('0xe')](util[_0x97c0('0x26')](_0x97c0('0x27'),_0x1cebe7[_0x97c0('0x28')]));searchContact(_0xdedd82,_0x58f2e8,_0x97c0('0x29'),_0x1cebe7[_0x97c0('0x28')])[_0x97c0('0x10')](function(_0x30b927){if(_0x30b927){_0x1cebe7[_0x97c0('0x2a')]=_0x30b927['id'];logger[_0x97c0('0xe')](_0x97c0('0x2b'),_0x1cebe7[_0x97c0('0x2a')]);return _0x52bdfe(_0x1cebe7);}searchContact(_0xdedd82,_0x58f2e8,_0x97c0('0x2c'),_0x1cebe7[_0x97c0('0x28')])['then'](function(_0x292560){if(_0x292560){_0x1cebe7[_0x97c0('0x2a')]=_0x292560['id'];logger[_0x97c0('0xe')](_0x97c0('0x2d'),_0x1cebe7[_0x97c0('0x2a')]);return _0x52bdfe(_0x1cebe7);}createEndUser(_0x1cebe7,_0x23080c,_0x58f2e8,_0xdedd82)[_0x97c0('0x10')](function(_0x40a780){logger[_0x97c0('0xe')]('Contact\x20created:',_0x40a780[_0x97c0('0x2a')]);return _0x52bdfe(_0x40a780);});});})['catch'](function(_0x23e482){_0x30147b(_0x23e482);});});};}function createEndUser(_0x20291,_0xc4c795,_0x3988d3,_0x41e360){return new Promise(function(_0x2a613a,_0x13252f){var _0x225ca4=moment();var _0x38f37a={'method':_0x97c0('0x2e'),'uri':_0x41e360+_0x97c0('0x2f'),'body':{'contact':{'last_name':_0x20291['contactNumber'],'work_number':_0x20291[_0x97c0('0x28')],'mobile_number':_0x20291[_0x97c0('0x28')],'owner_id':_0x20291['userId'],'created_at':_0x225ca4[_0x97c0('0x26')](_0x97c0('0x30'))}},'json':!![]};_0x38f37a[_0x97c0('0xd')]=_0x3988d3;logger[_0x97c0('0xe')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x38f37a)[_0x97c0('0x10')](function(_0x4f1629){_0x20291[_0x97c0('0x2a')]=_0x4f1629[_0x97c0('0x31')]['id'];_0x2a613a(_0x20291);})['catch'](function(_0x3a706e){logger[_0x97c0('0x19')]('['+[_0xc4c795[_0x97c0('0x1a')]()]+']',_0x3a706e[_0x97c0('0x1b')]);_0x13252f(_0x3a706e[_0x97c0('0x1b')]);});});}function getTicket(_0x2121e8,_0x36b3d0,_0x239be6,_0x1fd594,_0x2d4c25){return function(_0x25e099){logger[_0x97c0('0xe')](_0x97c0('0x32'));return new Promise(function(_0x5da697,_0x1abfa7){var _0x90bfbb=moment();var _0x1dc6ff={'method':_0x97c0('0x2e'),'uri':_0x239be6+_0x97c0('0x33'),'body':{'title':intUtil[_0x97c0('0x34')](_0x1fd594[_0x97c0('0x35')],_0x2d4c25,'\x20'),'description':intUtil['getString'](_0x1fd594['Descriptions'],_0x2d4c25,'\x0a'),'owner_id':_0x25e099[_0x97c0('0x20')],'creater_id':_0x25e099[_0x97c0('0x15')],'targetable_id':_0x25e099[_0x97c0('0x2a')],'targetable_type':_0x97c0('0x36'),'created_at':_0x90bfbb[_0x97c0('0x26')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x90bfbb['add'](0x1e,'m')['format'](_0x97c0('0x30'))},'json':!![]};_0x1dc6ff['headers']=_0x36b3d0;return rp(_0x1dc6ff)['then'](function(_0x1d0e94){_0x25e099[_0x97c0('0x37')]=_0x1d0e94[_0x97c0('0x38')]['id'];logger[_0x97c0('0xe')](_0x97c0('0x39'),_0x25e099['ticketId']);_0x5da697(_0x25e099);})[_0x97c0('0x18')](function(_0x16f0fb){logger[_0x97c0('0x19')]('['+[_0x2121e8[_0x97c0('0x1a')]()]+']',_0x16f0fb[_0x97c0('0x1b')]);_0x1abfa7(_0x16f0fb[_0x97c0('0x1b')]);});});};}function emit(_0x444e41,_0x2538f0,_0x2c50ff){var _0x8a952c={'uri':_0x444e41+'/contacts/'+_0x2c50ff};io['to'](util[_0x97c0('0x26')](_0x97c0('0x3a'),_0x2538f0))[_0x97c0('0x3b')](_0x97c0('0x3c'),_0x8a952c);}exports['cs']=function(_0x4ff0a5,_0x597a0f,_0x207620,_0x2b54fb,_0x2c26b9,_0x4a54e8,_0x3e09d5,_0xac56ac){var _0x240f68={};var _0x2fc02f={'Authorization':_0x97c0('0x3d')+_0x4a54e8['apiKey']};_0x4a54e8[_0x97c0('0x3e')]=intUtil[_0x97c0('0x3f')](_0x4a54e8[_0x97c0('0x3e')]);_0x4a54e8['serverUrl']=intUtil['stripTrailingSlash'](_0x4a54e8[_0x97c0('0x40')]);var _0x5b6831=_0x4a54e8['remoteUri'];_0x240f68[_0x97c0('0x14')]=_0x4a54e8[_0x97c0('0x41')];_0x240f68[_0x97c0('0x28')]=_0xac56ac['toLowerCase']()==='outbound'?_0x597a0f['destcalleridnum']:_0x597a0f[_0x97c0('0x42')];_0x240f68[_0x97c0('0x43')]=_0xac56ac===_0x97c0('0x44')||_0xac56ac===_0x97c0('0x45')?_0x97c0('0x44'):_0x97c0('0x46');if(_0x2b54fb){_0x240f68[_0x97c0('0x1e')]=_0x2b54fb['email'];}var _0x1f28b2=util[_0x97c0('0x26')](_0x97c0('0x47'),_0x4a54e8[_0x97c0('0x40')],_0x597a0f[_0x97c0('0x48')],md5(_0x597a0f[_0x97c0('0x48')]));if(_0x2c26b9&&_0x2c26b9['monitor_format']){logger[_0x97c0('0xe')](_0x97c0('0x49'),'Recording\x20is\x20enabled!');_0x597a0f[_0x97c0('0x4a')]=_0x1f28b2;}else if(_0x3e09d5&&_0x3e09d5[_0x97c0('0x4b')]&&_0x3e09d5[_0x97c0('0x4b')]!==_0x97c0('0x4c')){logger[_0x97c0('0xe')](_0x97c0('0x4d'),_0x97c0('0x4e'));_0x597a0f['recordingURL']=_0x1f28b2;}else{_0x597a0f[_0x97c0('0x4a')]='';}return getAdminId(_0x240f68,_0xac56ac,_0x2fc02f,_0x5b6831)[_0x97c0('0x10')](getUser(_0xac56ac,_0x2fc02f,_0x5b6831))[_0x97c0('0x10')](getEndUser(_0xac56ac,_0x2fc02f,_0x5b6831))[_0x97c0('0x10')](getTicket(_0xac56ac,_0x2fc02f,_0x5b6831,_0x207620,_0x597a0f))[_0x97c0('0x10')](function(_0x2f1571){logger[_0x97c0('0xe')](util[_0x97c0('0x26')](_0x97c0('0x4f'),_0x2f1571[_0x97c0('0x37')]));if(_0xac56ac!==_0x97c0('0x45')){logger[_0x97c0('0xe')]('['+[_0xac56ac[_0x97c0('0x1a')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x5b6831,_0x2b54fb[_0x97c0('0x50')],_0x2f1571[_0x97c0('0x2a')]);}})[_0x97c0('0x18')](function(_0x3dfce8){logger[_0x97c0('0x19')]('['+[_0xac56ac[_0x97c0('0x1a')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x97c0('0x51')](_0x3dfce8,{'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 598fce0..e1f8a59 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 _0x5f66=['dynamics365','freshsales','toLowerCase','data1','data2','find','Configurations','data3','queue','outbound','unmanaged','salesforce','sugarcrm','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','util','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./servicenow','./freshsales','zendesk','freshdesk','zoho','desk','vtiger'];(function(_0x306069,_0x1806d2){var _0x26a6b7=function(_0x2062df){while(--_0x2062df){_0x306069['push'](_0x306069['shift']());}};_0x26a6b7(++_0x1806d2);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var zendesk=require('./zendesk');var salesforce=require(_0x65f6('0x1'));var sugarcrm=require(_0x65f6('0x2'));var freshdesk=require(_0x65f6('0x3'));var zoho=require(_0x65f6('0x4'));var desk=require(_0x65f6('0x5'));var vtiger=require('./vtiger');var servicenow=require(_0x65f6('0x6'));var dynamics365=require('./dynamics365');var freshsales=require(_0x65f6('0x7'));var integrations=[_0x65f6('0x8'),'salesforce','sugarcrm',_0x65f6('0x9'),_0x65f6('0xa'),_0x65f6('0xb'),_0x65f6('0xc'),_0x65f6('0xd'),_0x65f6('0xe'),'servicenow'];exports['exec']=function(_0x18fea1,_0x2f6d5b,_0x264647,_0x25c416,_0x50d26d,_0x41a7fd){if(_0x264647){if(_['includes'](integrations,_0x18fea1['data1'][_0x65f6('0xf')]())){try{var _0x576875=null;var _0x419819='';var _0x4862a5=_0x264647[_0x18fea1[_0x65f6('0x10')][_0x65f6('0xf')]()];if(_0x4862a5){var _0x2c4ee5=_0x4862a5[_0x18fea1[_0x65f6('0x11')]];if(_0x2c4ee5){var _0x369f96=_[_0x65f6('0x12')](_0x2c4ee5[_0x65f6('0x13')],{'id':parseInt(_0x18fea1[_0x65f6('0x14')],0xa)});if(_0x369f96){if(_0x25c416){if(_0x50d26d&&_0x2f6d5b[_0x65f6('0x15')]){_0x419819=_0x65f6('0x15');}else if(_0x2f6d5b['routeId']){_0x419819=_0x65f6('0x16');}else{console['log']('EVENT\x20UNKNOWN',_0x2f6d5b);}}else{_0x419819=_0x65f6('0x17');}switch(_0x18fea1[_0x65f6('0x10')][_0x65f6('0xf')]()){case _0x65f6('0x8'):zendesk[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case _0x65f6('0x18'):salesforce[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case _0x65f6('0x19'):sugarcrm[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case _0x65f6('0x9'):freshdesk[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case _0x65f6('0xa'):zoho[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case'desk':desk[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case'vtiger':vtiger[_0x419819](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd);break;case _0x65f6('0xe'):freshsales['cs'](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd,_0x419819);break;case'servicenow':servicenow['cs'](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd,_0x419819);break;case'dynamics365':dynamics365['cs'](_0x18fea1,_0x2f6d5b,_0x369f96,_0x25c416,_0x50d26d,_0x2c4ee5,_0x41a7fd,_0x419819);break;default:console['log'](_0x65f6('0x1a'));}}else{_0x576875=require(_0x65f6('0x1b'))(_0x18fea1['data1'][_0x65f6('0xf')]());_0x576875[_0x65f6('0x1c')](_0x65f6('0x1d'),util[_0x65f6('0x1e')](_0x65f6('0x1f'),_0x18fea1[_0x65f6('0x10')]['toLowerCase'](),_0x18fea1[_0x65f6('0x14')]));}}else{_0x576875=require('../../../../config/logger')(_0x18fea1['data1'][_0x65f6('0xf')]());_0x576875[_0x65f6('0x1c')]('[EXEC]',util[_0x65f6('0x1e')](_0x65f6('0x20'),_0x18fea1[_0x65f6('0x10')][_0x65f6('0xf')](),_0x18fea1['data2']));}}else{}}catch(_0x9d7bb0){console[_0x65f6('0x1c')](_0x9d7bb0);}}}}; \ No newline at end of file +var _0x3423=['./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','includes','toLowerCase','data2','find','Configurations','data3','queue','routeId','log','EVENT\x20UNKNOWN','unknown\x20integration','data1','[EXEC]','format','../../../../config/logger','error','%s\x20account\x20#%s\x20not\x20found','./zendesk','./salesforce','./sugarcrm','./freshdesk'];(function(_0x273958,_0x36f7db){var _0x34531c=function(_0x50043b){while(--_0x50043b){_0x273958['push'](_0x273958['shift']());}};_0x34531c(++_0x36f7db);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require(_0x3342('0x0'));var salesforce=require(_0x3342('0x1'));var sugarcrm=require(_0x3342('0x2'));var freshdesk=require(_0x3342('0x3'));var zoho=require(_0x3342('0x4'));var desk=require(_0x3342('0x5'));var vtiger=require(_0x3342('0x6'));var servicenow=require(_0x3342('0x7'));var dynamics365=require(_0x3342('0x8'));var freshsales=require(_0x3342('0x9'));var integrations=[_0x3342('0xa'),_0x3342('0xb'),_0x3342('0xc'),_0x3342('0xd'),_0x3342('0xe'),_0x3342('0xf'),_0x3342('0x10'),_0x3342('0x11'),_0x3342('0x12'),'servicenow'];exports['exec']=function(_0x2d0cb0,_0x481a17,_0x5a1fba,_0x51b276,_0x4f85e3,_0xb11eb9){if(_0x5a1fba){if(_[_0x3342('0x13')](integrations,_0x2d0cb0['data1'][_0x3342('0x14')]())){try{var _0x5a3cb1=null;var _0x716d80='';var _0x36e1f4=_0x5a1fba[_0x2d0cb0['data1'][_0x3342('0x14')]()];if(_0x36e1f4){var _0x334f0e=_0x36e1f4[_0x2d0cb0[_0x3342('0x15')]];if(_0x334f0e){var _0xe4689e=_[_0x3342('0x16')](_0x334f0e[_0x3342('0x17')],{'id':parseInt(_0x2d0cb0[_0x3342('0x18')],0xa)});if(_0xe4689e){if(_0x51b276){if(_0x4f85e3&&_0x481a17['queue']){_0x716d80=_0x3342('0x19');}else if(_0x481a17[_0x3342('0x1a')]){_0x716d80='outbound';}else{console[_0x3342('0x1b')](_0x3342('0x1c'),_0x481a17);}}else{_0x716d80='unmanaged';}switch(_0x2d0cb0['data1'][_0x3342('0x14')]()){case _0x3342('0xa'):zendesk[_0x716d80](_0x2d0cb0,_0x481a17,_0xe4689e,_0x51b276,_0x4f85e3,_0x334f0e,_0xb11eb9);break;case _0x3342('0xb'):salesforce[_0x716d80](_0x2d0cb0,_0x481a17,_0xe4689e,_0x51b276,_0x4f85e3,_0x334f0e,_0xb11eb9);break;case _0x3342('0xc'):sugarcrm[_0x716d80](_0x2d0cb0,_0x481a17,_0xe4689e,_0x51b276,_0x4f85e3,_0x334f0e,_0xb11eb9);break;case _0x3342('0xd'):freshdesk[_0x716d80](_0x2d0cb0,_0x481a17,_0xe4689e,_0x51b276,_0x4f85e3,_0x334f0e,_0xb11eb9);break;case _0x3342('0xe'):zoho[_0x716d80](_0x2d0cb0,_0x481a17,_0xe4689e,_0x51b276,_0x4f85e3,_0x334f0e,_0xb11eb9);break;case _0x3342('0xf'):desk[_0x716d80](_0x2d0cb0,_0x481a17,_0xe4689e,_0x51b276,_0x4f85e3,_0x334f0e,_0xb11eb9);break;case _0x3342('0x10'):vtiger[_0x716d80](_0x2d0cb0,_0x481a17,_0xe4689e,_0x51b276,_0x4f85e3,_0x334f0e,_0xb11eb9);break;case _0x3342('0x12'):freshsales['cs'](_0x2d0cb0,_0x481a17,_0xe4689e,_0x51b276,_0x4f85e3,_0x334f0e,_0xb11eb9,_0x716d80);break;case'servicenow':servicenow['cs'](_0x2d0cb0,_0x481a17,_0xe4689e,_0x51b276,_0x4f85e3,_0x334f0e,_0xb11eb9,_0x716d80);break;case _0x3342('0x11'):dynamics365['cs'](_0x2d0cb0,_0x481a17,_0xe4689e,_0x51b276,_0x4f85e3,_0x334f0e,_0xb11eb9,_0x716d80);break;default:console[_0x3342('0x1b')](_0x3342('0x1d'));}}else{_0x5a3cb1=require('../../../../config/logger')(_0x2d0cb0[_0x3342('0x1e')][_0x3342('0x14')]());_0x5a3cb1['error'](_0x3342('0x1f'),util[_0x3342('0x20')]('%s\x20configuration\x20#%s\x20not\x20found',_0x2d0cb0[_0x3342('0x1e')]['toLowerCase'](),_0x2d0cb0[_0x3342('0x18')]));}}else{_0x5a3cb1=require(_0x3342('0x21'))(_0x2d0cb0[_0x3342('0x1e')][_0x3342('0x14')]());_0x5a3cb1[_0x3342('0x22')](_0x3342('0x1f'),util[_0x3342('0x20')](_0x3342('0x23'),_0x2d0cb0['data1'][_0x3342('0x14')](),_0x2d0cb0['data2']));}}else{}}catch(_0x51cf45){console[_0x3342('0x22')](_0x51cf45);}}}}; \ 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 63721ca..64681e4 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 _0x7c4e=['[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','stringify','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','emit','ticketType','Task','assign','Subjects','getString','Descriptions','WhoId','Case','ContactId','sobject','create','isNil','User','length','find','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','identity','then','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','Contact','Lead','execute','lead','contact','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.','No\x20Company','upperFirst','forEach','type','string','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','login','username','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','recordingURL','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created'];(function(_0x1cb278,_0x337e36){var _0x2a414e=function(_0x1eef59){while(--_0x1eef59){_0x1cb278['push'](_0x1cb278['shift']());}};_0x2a414e(++_0x337e36);}(_0x7c4e,0x104));var _0xe7c4=function(_0x4e1ef7,_0x349fa5){_0x4e1ef7=_0x4e1ef7-0x0;var _0x20f191=_0x7c4e[_0x4e1ef7];return _0x20f191;};'use strict';var _=require(_0xe7c4('0x0'));var rp=require(_0xe7c4('0x1'));var moment=require(_0xe7c4('0x2'));var BPromise=require(_0xe7c4('0x3'));var md5=require(_0xe7c4('0x4'));var jsforce=require(_0xe7c4('0x5'));var util=require('util');var Redis=require(_0xe7c4('0x6'));var intUtil=require(_0xe7c4('0x7'));var config=require(_0xe7c4('0x8'));var logger=require(_0xe7c4('0x9'))(_0xe7c4('0xa'));config[_0xe7c4('0xb')]=_[_0xe7c4('0xc')](config[_0xe7c4('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xe7c4('0xd'))(new Redis(config[_0xe7c4('0xb')]));function emit(_0x4e8707,_0x5193a1,_0x1ac0c0){io['to'](_0x4e8707)[_0xe7c4('0xe')](_0x5193a1,_0x1ac0c0);}function getTicket(_0x3c20c6,_0x456c1b,_0x54984e,_0x2a4ee0,_0x5bacee,_0x1b73ea,_0x24f94f,_0x419d22){var _0x433d24={};if(_0x2a4ee0[_0xe7c4('0xf')]===_0xe7c4('0x10')){_0x433d24=Object[_0xe7c4('0x11')]({},{'OwnerId':_0x456c1b['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x2a4ee0[_0xe7c4('0x12')],_0x5bacee,'\x20'),'Description':intUtil[_0xe7c4('0x13')](_0x2a4ee0[_0xe7c4('0x14')],_0x5bacee,'\x0a')},getCustomFields(_0x1b73ea,_0x5bacee));if(_0x54984e){_0x433d24[_0xe7c4('0x15')]=_0x54984e['id'];}}else if(_0x2a4ee0[_0xe7c4('0xf')]===_0xe7c4('0x16')){_0x433d24=Object[_0xe7c4('0x11')]({},{'OwnerId':_0x456c1b['id'],'Subject':intUtil[_0xe7c4('0x13')](_0x2a4ee0[_0xe7c4('0x12')],_0x5bacee,'\x20'),'Description':intUtil[_0xe7c4('0x13')](_0x2a4ee0[_0xe7c4('0x14')],_0x5bacee,'\x0a')},getCustomFields(_0x1b73ea,_0x5bacee));if(_0x54984e){_0x433d24[_0xe7c4('0x17')]=_0x54984e['id'];}}return _0x24f94f[_0xe7c4('0x18')](_0x2a4ee0[_0xe7c4('0xf')])[_0xe7c4('0x19')](_0x433d24);}function getUser(_0x18037f,_0xd2a86f,_0x2b0dfb){if(!_[_0xe7c4('0x1a')](_0xd2a86f)&&intUtil['validateEmail'](_0xd2a86f)){var _0x6715b3={'Email':_0xd2a86f};var _0xbbbfe7={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2b0dfb['sobject'](_0xe7c4('0x1b'))['find'](_0x6715b3,_0xbbbfe7)['execute']()['then'](function(_0x18904a){if(_0x18904a[_0xe7c4('0x1c')]){var _0x32d242=_[_0xe7c4('0x1d')](_0x18904a,function(_0x1b494d){return _0x1b494d[_0xe7c4('0x1e')]===_0xd2a86f;});if(_0x32d242){logger[_0xe7c4('0x1f')](_0xe7c4('0x20'),_0xd2a86f);return BPromise[_0xe7c4('0x21')]({'id':_0x32d242['Id'],'name':_0x32d242[_0xe7c4('0x22')]});}}else{logger[_0xe7c4('0x1f')](_0xe7c4('0x23'),_0xd2a86f);return _0x2b0dfb['identity']()['then'](function(_0x422130){return BPromise['resolve']({'id':_0x422130[_0xe7c4('0x24')],'name':_0x422130[_0xe7c4('0x25')]});});}});}else{logger[_0xe7c4('0x1f')](_0xe7c4('0x23'),_0xd2a86f);return _0x2b0dfb[_0xe7c4('0x26')]()[_0xe7c4('0x27')](function(_0x4562da){return BPromise['resolve']({'id':_0x4562da[_0xe7c4('0x24')],'name':_0x4562da[_0xe7c4('0x25')]});});}}function getEndUser(_0x21be32,_0x4585c4,_0x9f6118,_0x5d354d,_0xf61bec){var _0x21cc70={'Phone':_0x5d354d};var _0x19d0f9={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xe7c4('0x21')]()[_0xe7c4('0x27')](function(){if(_0x4585c4[_0xe7c4('0xf')]===_0xe7c4('0x10')){logger[_0xe7c4('0x1f')](_0xe7c4('0x28'),_0x5d354d,_0x4585c4[_0xe7c4('0x29')]);switch(_0x4585c4[_0xe7c4('0x29')]){case'contact_lead':return _0xf61bec['sobject'](_0xe7c4('0x2a'))['find'](_0x21cc70,_0x19d0f9)['execute']()['then'](function(_0x558089){if(_0x558089&&_0x558089[_0xe7c4('0x1c')]){return _0x558089;}else{return _0xf61bec[_0xe7c4('0x18')](_0xe7c4('0x2b'))[_0xe7c4('0x1d')](_0x21cc70,_0x19d0f9);}});case'contact':return _0xf61bec['sobject'](_0xe7c4('0x2a'))['find'](_0x21cc70,_0x19d0f9)[_0xe7c4('0x2c')]();case _0xe7c4('0x2d'):return _0xf61bec[_0xe7c4('0x18')]('Lead')['find'](_0x21cc70,_0x19d0f9);default:return null;}}else if(_0x4585c4[_0xe7c4('0xf')]==='Case'){logger[_0xe7c4('0x1f')](_0xe7c4('0x28'),_0x5d354d,_0xe7c4('0x2e'));return _0xf61bec[_0xe7c4('0x18')](_0xe7c4('0x2a'))[_0xe7c4('0x1d')](_0x21cc70,_0x19d0f9)[_0xe7c4('0x2c')]();}})[_0xe7c4('0x27')](function(_0x43e358){if(_0x43e358&&_0x43e358[_0xe7c4('0x1c')]){var _0x4b3edc=_['find'](_0x43e358,function(_0x2eb1eb){return _0x2eb1eb[_0xe7c4('0x2f')]===_0x5d354d;});if(_0x4b3edc){return BPromise[_0xe7c4('0x21')]({'id':_0x4b3edc['Id'],'name':_0x4b3edc['Name'],'phone':_0x4b3edc['Phone']});}}})[_0xe7c4('0x27')](function(_0x3f9104){if(_0x3f9104){logger[_0xe7c4('0x1f')](_0xe7c4('0x30'),_0x5d354d);return BPromise[_0xe7c4('0x21')](_0x3f9104);}else{logger[_0xe7c4('0x1f')](_0xe7c4('0x31'),_0x5d354d);var _0x3017f5={'LastName':_0x9f6118!==''?_0x9f6118:util['format'](_0xe7c4('0x32'),_0x5d354d),'Phone':_0x5d354d};if(_0x4585c4[_0xe7c4('0x33')]){if(_0x4585c4[_0xe7c4('0x33')]===_0xe7c4('0x2e')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5d354d,_0x4585c4['moduleCreate']);}else if(_0x4585c4[_0xe7c4('0x33')]===_0xe7c4('0x2d')&&_0x4585c4['ticketType']===_0xe7c4('0x10')){logger[_0xe7c4('0x1f')](_0xe7c4('0x34'),_0x5d354d,_0x4585c4[_0xe7c4('0x33')]);_0x3017f5['Company']=_0xe7c4('0x35');}else{return null;}}return _0xf61bec[_0xe7c4('0x18')](_[_0xe7c4('0x36')](_0x4585c4[_0xe7c4('0x33')]))['create'](_0x3017f5);}});}function getCustomFields(_0x3c4386,_0x24a347){var _0x3f0792={};if(_0x3c4386[_0xe7c4('0x1c')]>0x0){_[_0xe7c4('0x37')](_0x3c4386,function(_0x312bef){if(_0x312bef[_0xe7c4('0x38')]===_0xe7c4('0x39')&&_0x312bef[_0xe7c4('0x3a')]){_0x3f0792[_0x312bef[_0xe7c4('0x3a')]]=_0x312bef[_0xe7c4('0x3b')]['toString']();}else if(_0x312bef[_0xe7c4('0x38')]===_0xe7c4('0x3c')&&_0x312bef[_0xe7c4('0x3d')]&&_0x312bef[_0xe7c4('0x3a')]){_0x24a347[_0x312bef['variableName']]&&(_0x3f0792[_0x312bef[_0xe7c4('0x3a')]]=_0x24a347[_0x312bef[_0xe7c4('0x3d')]][_0xe7c4('0x3e')]());}else if(_0x312bef[_0xe7c4('0x38')]===_0xe7c4('0x3f')&&_0x312bef[_0xe7c4('0x40')]&&_0x312bef['Variable']['name']&&_0x312bef['idField']){_0x24a347[_0x312bef[_0xe7c4('0x40')][_0xe7c4('0x41')][_0xe7c4('0x42')]()]&&(_0x3f0792[_0x312bef['idField']]=_0x24a347[_0x312bef[_0xe7c4('0x40')]['name']['toLowerCase']()][_0xe7c4('0x3e')]());}});}return _0x3f0792;}function getConnection(_0x40e4c1){var _0x3c4400=_0x40e4c1[_0xe7c4('0x43')][_0xe7c4('0x44')](_0x40e4c1[_0xe7c4('0x45')]);var _0x4155ae=new jsforce[(_0xe7c4('0x46'))]({'oauth2':{'loginUrl':_0x40e4c1['remoteUri']||_0xe7c4('0x47'),'clientId':_0x40e4c1[_0xe7c4('0x48')],'clientSecret':_0x40e4c1[_0xe7c4('0x49')]}});return _0x4155ae[_0xe7c4('0x4a')](_0x40e4c1[_0xe7c4('0x4b')],_0x3c4400)[_0xe7c4('0x27')](function(){logger[_0xe7c4('0x1f')]('Connection\x20established.');return _0x4155ae;});}exports['queue']=function(_0x4c21ad,_0x376104,_0x4648dd,_0x3514a8,_0x5e9bfa,_0x5f05aa){var _0x4b850f,_0x491276,_0x4cb462,_0x1a48b1;_0x5f05aa[_0xe7c4('0x4c')]=intUtil[_0xe7c4('0x4d')](_0x5f05aa['serverUrl']);_0x5f05aa[_0xe7c4('0x4e')]=intUtil[_0xe7c4('0x4d')](_0x5f05aa[_0xe7c4('0x4e')]);if(_0x5e9bfa&&_0x5e9bfa[_0xe7c4('0x4f')]){logger[_0xe7c4('0x1f')](_0xe7c4('0x50'),'Recording\x20is\x20enabled!');_0x376104[_0xe7c4('0x51')]=util[_0xe7c4('0x52')](_0xe7c4('0x53'),_0x5f05aa['serverUrl'],_0x376104[_0xe7c4('0x54')],md5(_0x376104[_0xe7c4('0x54')]));}else{_0x376104[_0xe7c4('0x51')]='';}return getConnection(_0x5f05aa)['then'](function(_0x44f7fb){_0x1a48b1=_0x44f7fb;return getUser(_0x5f05aa,_0x3514a8[_0xe7c4('0x55')],_0x1a48b1);})['then'](function(_0x41dec0){_0x4b850f=_0x41dec0;return getEndUser(_0x5f05aa,_0x4648dd,_0x376104[_0xe7c4('0x56')],_0x376104[_0xe7c4('0x57')],_0x1a48b1);})[_0xe7c4('0x27')](function(_0x1fd1c3){_0x491276=_0x1fd1c3;return getTicket(_0x5f05aa,_0x4b850f,_0x491276,_0x4648dd,_0x376104,_0x4648dd[_0xe7c4('0x58')],_0x1a48b1,_0xe7c4('0x59'));})[_0xe7c4('0x27')](function(_0xdce79){_0x4cb462=_0xdce79;logger['info'](_0xe7c4('0x5a'),_0x4cb462['id']);logger['info'](_0xe7c4('0x5b'),_0x4cb462['id'],_0x3514a8[_0xe7c4('0x41')],_0x5f05aa[_0xe7c4('0x38')]);switch(_0x5f05aa[_0xe7c4('0x38')]){case'integrationTab':emit(util['format'](_0xe7c4('0x5c'),_0x3514a8[_0xe7c4('0x41')]),_0xe7c4('0x5d'),{'recordId':_0x4cb462['id']});break;case _0xe7c4('0x5e'):emit(util[_0xe7c4('0x52')]('user:%s',_0x3514a8['name']),_0xe7c4('0x5f'),{'uri':util['format'](_0xe7c4('0x60'),_0x1a48b1[_0xe7c4('0x61')],_0x4cb462['id'])});break;default:logger['error'](_0xe7c4('0x62'));}})[_0xe7c4('0x63')](function(_0x33e0c4){logger[_0xe7c4('0x64')]('[QUEUE]',JSON[_0xe7c4('0x65')](_0x33e0c4));});};exports[_0xe7c4('0x66')]=function(_0x595284,_0x422b4a,_0x550bad,_0x3ed4ba,_0x2c266e,_0x4b3425,_0x5131f0){var _0x3378bf,_0x4b3d42,_0x309a01,_0x28ca8b;_0x4b3425['serverUrl']=intUtil[_0xe7c4('0x4d')](_0x4b3425[_0xe7c4('0x4c')]);_0x4b3425['remoteUri']=intUtil[_0xe7c4('0x4d')](_0x4b3425['remoteUri']);if(_0x5131f0&&_0x5131f0[_0xe7c4('0x67')]&&_0x5131f0[_0xe7c4('0x67')]!=='none'){logger[_0xe7c4('0x1f')](_0xe7c4('0x68'),_0xe7c4('0x69'));_0x422b4a[_0xe7c4('0x51')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4b3425[_0xe7c4('0x4c')],_0x422b4a[_0xe7c4('0x54')],md5(_0x422b4a[_0xe7c4('0x54')]));}return getConnection(_0x4b3425)['then'](function(_0x2c3ceb){_0x28ca8b=_0x2c3ceb;return getUser(_0x4b3425,_0x3ed4ba[_0xe7c4('0x55')],_0x28ca8b);})['then'](function(_0x1765e4){_0x3378bf=_0x1765e4;return getEndUser(_0x4b3425,_0x550bad,_0x422b4a[_0xe7c4('0x6a')],_0x422b4a[_0xe7c4('0x6b')],_0x28ca8b);})[_0xe7c4('0x27')](function(_0x3274d9){_0x4b3d42=_0x3274d9;return getTicket(_0x4b3425,_0x3378bf,_0x4b3d42,_0x550bad,_0x422b4a,_0x550bad[_0xe7c4('0x58')],_0x28ca8b,_0xe7c4('0x66'));})[_0xe7c4('0x27')](function(_0x4f41b8){_0x309a01=_0x4f41b8;logger[_0xe7c4('0x1f')](_0xe7c4('0x6c'),_0x309a01['id']);logger[_0xe7c4('0x1f')](_0xe7c4('0x6d'),_0x309a01['id'],_0x3ed4ba[_0xe7c4('0x41')],_0x4b3425[_0xe7c4('0x38')]);switch(_0x4b3425['type']){case _0xe7c4('0x6e'):emit(util['format']('user:%s',_0x3ed4ba[_0xe7c4('0x41')]),'trigger:salesforce:display',{'recordId':_0x309a01['id']});break;case _0xe7c4('0x5e'):emit(util[_0xe7c4('0x52')]('user:%s',_0x3ed4ba[_0xe7c4('0x41')]),_0xe7c4('0x5f'),{'uri':util[_0xe7c4('0x52')]('%s/%s/e',_0x28ca8b[_0xe7c4('0x61')],_0x309a01['id'])});break;default:logger['error'](_0xe7c4('0x68'),_0xe7c4('0x6f'));}})[_0xe7c4('0x63')](function(_0x350fcd){logger[_0xe7c4('0x64')]('[OUTBOUND]',JSON['stringify'](_0x350fcd));});};exports[_0xe7c4('0x70')]=function(_0xece3a7,_0x362367,_0x30e529,_0x43edf4,_0x1d4034,_0x49d253){var _0x4859c1,_0x1bd97d,_0x441805,_0x3025cd;_0x49d253[_0xe7c4('0x4c')]=intUtil['stripTrailingSlash'](_0x49d253[_0xe7c4('0x4c')]);_0x49d253['remoteUri']=intUtil[_0xe7c4('0x4d')](_0x49d253[_0xe7c4('0x4e')]);if(_0x1d4034&&_0x1d4034[_0xe7c4('0x4f')]){logger['info']('['+_0x362367[_0xe7c4('0x71')][_0xe7c4('0x72')]()+']','Recording\x20is\x20enabled!');_0x362367['recordingURL']=util['format'](_0xe7c4('0x53'),_0x49d253[_0xe7c4('0x4c')],_0x362367['uniqueid'],md5(_0x362367[_0xe7c4('0x54')]));}else{_0x362367['recordingURL']='';}return getConnection(_0x49d253)[_0xe7c4('0x27')](function(_0x1e6ca8){_0x3025cd=_0x1e6ca8;if(!_[_0xe7c4('0x1a')](_0x43edf4)){return getUser(_0x49d253,_0x43edf4['name'],_0x3025cd);}else{return getUser(_0x49d253,null,_0x3025cd);}})[_0xe7c4('0x27')](function(_0x1fdf10){_0x4859c1=_0x1fdf10;return getEndUser(_0x49d253,_0x30e529,_0x362367[_0xe7c4('0x56')],_0x362367['calleridnum'],_0x3025cd);})[_0xe7c4('0x27')](function(_0x59753d){_0x1bd97d=_0x59753d;return getTicket(_0x49d253,_0x4859c1,_0x1bd97d,_0x30e529,_0x362367,_0x30e529[_0xe7c4('0x58')],_0x3025cd);})['then'](function(_0x5eedc1){_0x441805=_0x5eedc1;logger['info']('['+_0x362367[_0xe7c4('0x71')]['toUpperCase']()+_0xe7c4('0x73'),_0x441805['id']);logger[_0xe7c4('0x1f')]('['+_0x362367[_0xe7c4('0x71')][_0xe7c4('0x72')]()+_0xe7c4('0x74'),_0x49d253[_0xe7c4('0x38')]);})[_0xe7c4('0x63')](function(_0xb87e66){logger[_0xe7c4('0x64')]('['+_0x362367[_0xe7c4('0x71')]['toUpperCase']()+']',JSON[_0xe7c4('0x65')](_0xb87e66));});}; \ No newline at end of file +var _0x01be=['[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stringify','outbound','recordingFormat','[OUTBOUND]','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','integrationTab','trigger:salesforce:display','newTab','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','recordingURL',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','emit','ticketType','Task','assign','utc','getString','Subjects','Descriptions','Case','ContactId','isNil','validateEmail','sobject','User','find','execute','then','length','Agent\x20%s\x20found.','resolve','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','contact','lead','Lead','Phone','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','No\x20Company','upperFirst','create','forEach','type','string','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:browser:url','instanceUrl','error'];(function(_0x294a72,_0x599c75){var _0x1177da=function(_0x25ab32){while(--_0x25ab32){_0x294a72['push'](_0x294a72['shift']());}};_0x1177da(++_0x599c75);}(_0x01be,0x1d3));var _0xe01b=function(_0x209b66,_0x2ee33b){_0x209b66=_0x209b66-0x0;var _0x54d024=_0x01be[_0x209b66];return _0x54d024;};'use strict';var _=require(_0xe01b('0x0'));var rp=require(_0xe01b('0x1'));var moment=require(_0xe01b('0x2'));var BPromise=require(_0xe01b('0x3'));var md5=require(_0xe01b('0x4'));var jsforce=require(_0xe01b('0x5'));var util=require(_0xe01b('0x6'));var Redis=require(_0xe01b('0x7'));var intUtil=require(_0xe01b('0x8'));var config=require(_0xe01b('0x9'));var logger=require(_0xe01b('0xa'))('salesforce');config['redis']=_[_0xe01b('0xb')](config[_0xe01b('0xc')],{'host':_0xe01b('0xd'),'port':0x18eb});var io=require(_0xe01b('0xe'))(new Redis(config[_0xe01b('0xc')]));function emit(_0xef82c8,_0x5f2d42,_0x11bb75){io['to'](_0xef82c8)[_0xe01b('0xf')](_0x5f2d42,_0x11bb75);}function getTicket(_0xe9e6e3,_0x2d5e2a,_0x21a54d,_0x19f53e,_0x2e1645,_0x5637cb,_0x12ffb8,_0x372165){var _0x2e47c0={};if(_0x19f53e[_0xe01b('0x10')]===_0xe01b('0x11')){_0x2e47c0=Object[_0xe01b('0x12')]({},{'OwnerId':_0x2d5e2a['id'],'ActivityDate':moment[_0xe01b('0x13')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xe01b('0x14')](_0x19f53e[_0xe01b('0x15')],_0x2e1645,'\x20'),'Description':intUtil['getString'](_0x19f53e[_0xe01b('0x16')],_0x2e1645,'\x0a')},getCustomFields(_0x5637cb,_0x2e1645));if(_0x21a54d){_0x2e47c0['WhoId']=_0x21a54d['id'];}}else if(_0x19f53e[_0xe01b('0x10')]===_0xe01b('0x17')){_0x2e47c0=Object[_0xe01b('0x12')]({},{'OwnerId':_0x2d5e2a['id'],'Subject':intUtil[_0xe01b('0x14')](_0x19f53e[_0xe01b('0x15')],_0x2e1645,'\x20'),'Description':intUtil[_0xe01b('0x14')](_0x19f53e[_0xe01b('0x16')],_0x2e1645,'\x0a')},getCustomFields(_0x5637cb,_0x2e1645));if(_0x21a54d){_0x2e47c0[_0xe01b('0x18')]=_0x21a54d['id'];}}return _0x12ffb8['sobject'](_0x19f53e[_0xe01b('0x10')])['create'](_0x2e47c0);}function getUser(_0x5e55ca,_0x95a867,_0x3f5272){if(!_[_0xe01b('0x19')](_0x95a867)&&intUtil[_0xe01b('0x1a')](_0x95a867)){var _0x1e5346={'Email':_0x95a867};var _0x44f37c={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3f5272[_0xe01b('0x1b')](_0xe01b('0x1c'))[_0xe01b('0x1d')](_0x1e5346,_0x44f37c)[_0xe01b('0x1e')]()[_0xe01b('0x1f')](function(_0x2a627b){if(_0x2a627b[_0xe01b('0x20')]){var _0x2567e3=_['find'](_0x2a627b,function(_0x542701){return _0x542701['Email']===_0x95a867;});if(_0x2567e3){logger['info'](_0xe01b('0x21'),_0x95a867);return BPromise[_0xe01b('0x22')]({'id':_0x2567e3['Id'],'name':_0x2567e3[_0xe01b('0x23')]});}}else{logger[_0xe01b('0x24')](_0xe01b('0x25'),_0x95a867);return _0x3f5272['identity']()[_0xe01b('0x1f')](function(_0xaea908){return BPromise[_0xe01b('0x22')]({'id':_0xaea908[_0xe01b('0x26')],'name':_0xaea908[_0xe01b('0x27')]});});}});}else{logger[_0xe01b('0x24')](_0xe01b('0x25'),_0x95a867);return _0x3f5272[_0xe01b('0x28')]()[_0xe01b('0x1f')](function(_0x2153b9){return BPromise['resolve']({'id':_0x2153b9[_0xe01b('0x26')],'name':_0x2153b9[_0xe01b('0x27')]});});}}function getEndUser(_0xc0ed8e,_0x48f2a1,_0x294e90,_0x1ce6f2,_0xcae25c){var _0x3ed54d={'Phone':_0x1ce6f2};var _0x5a2115={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xe01b('0x1f')](function(){if(_0x48f2a1[_0xe01b('0x10')]==='Task'){logger[_0xe01b('0x24')](_0xe01b('0x29'),_0x1ce6f2,_0x48f2a1['moduleSearch']);switch(_0x48f2a1[_0xe01b('0x2a')]){case _0xe01b('0x2b'):return _0xcae25c[_0xe01b('0x1b')](_0xe01b('0x2c'))['find'](_0x3ed54d,_0x5a2115)[_0xe01b('0x1e')]()[_0xe01b('0x1f')](function(_0x38d7e9){if(_0x38d7e9&&_0x38d7e9[_0xe01b('0x20')]){return _0x38d7e9;}else{return _0xcae25c[_0xe01b('0x1b')]('Lead')[_0xe01b('0x1d')](_0x3ed54d,_0x5a2115);}});case _0xe01b('0x2d'):return _0xcae25c[_0xe01b('0x1b')](_0xe01b('0x2c'))[_0xe01b('0x1d')](_0x3ed54d,_0x5a2115)['execute']();case _0xe01b('0x2e'):return _0xcae25c['sobject'](_0xe01b('0x2f'))[_0xe01b('0x1d')](_0x3ed54d,_0x5a2115);default:return null;}}else if(_0x48f2a1[_0xe01b('0x10')]===_0xe01b('0x17')){logger['info'](_0xe01b('0x29'),_0x1ce6f2,_0xe01b('0x2d'));return _0xcae25c[_0xe01b('0x1b')](_0xe01b('0x2c'))[_0xe01b('0x1d')](_0x3ed54d,_0x5a2115)[_0xe01b('0x1e')]();}})[_0xe01b('0x1f')](function(_0x2230a4){if(_0x2230a4&&_0x2230a4[_0xe01b('0x20')]){var _0x4ee8eb=_[_0xe01b('0x1d')](_0x2230a4,function(_0x23beda){return _0x23beda[_0xe01b('0x30')]===_0x1ce6f2;});if(_0x4ee8eb){return BPromise[_0xe01b('0x22')]({'id':_0x4ee8eb['Id'],'name':_0x4ee8eb[_0xe01b('0x23')],'phone':_0x4ee8eb[_0xe01b('0x30')]});}}})[_0xe01b('0x1f')](function(_0x1cd938){if(_0x1cd938){logger[_0xe01b('0x24')]('Enduser\x20with\x20phone\x20%s\x20found.',_0x1ce6f2);return BPromise[_0xe01b('0x22')](_0x1cd938);}else{logger[_0xe01b('0x24')](_0xe01b('0x31'),_0x1ce6f2);var _0x33912c={'LastName':_0x294e90!==_0xe01b('0x32')?_0x294e90:util[_0xe01b('0x33')](_0xe01b('0x34'),_0x1ce6f2),'Phone':_0x1ce6f2};if(_0x48f2a1['moduleCreate']){if(_0x48f2a1[_0xe01b('0x35')]===_0xe01b('0x2d')){logger[_0xe01b('0x24')](_0xe01b('0x36'),_0x1ce6f2,_0x48f2a1[_0xe01b('0x35')]);}else if(_0x48f2a1['moduleCreate']===_0xe01b('0x2e')&&_0x48f2a1[_0xe01b('0x10')]===_0xe01b('0x11')){logger[_0xe01b('0x24')](_0xe01b('0x36'),_0x1ce6f2,_0x48f2a1[_0xe01b('0x35')]);_0x33912c['Company']=_0xe01b('0x37');}else{return null;}}return _0xcae25c[_0xe01b('0x1b')](_[_0xe01b('0x38')](_0x48f2a1[_0xe01b('0x35')]))[_0xe01b('0x39')](_0x33912c);}});}function getCustomFields(_0xd48b1b,_0x206940){var _0x9c0512={};if(_0xd48b1b['length']>0x0){_[_0xe01b('0x3a')](_0xd48b1b,function(_0x10f80c){if(_0x10f80c[_0xe01b('0x3b')]===_0xe01b('0x3c')&&_0x10f80c['idField']){_0x9c0512[_0x10f80c[_0xe01b('0x3d')]]=_0x10f80c['content'][_0xe01b('0x3e')]();}else if(_0x10f80c[_0xe01b('0x3b')]===_0xe01b('0x3f')&&_0x10f80c['variableName']&&_0x10f80c[_0xe01b('0x3d')]){_0x206940[_0x10f80c[_0xe01b('0x40')]]&&(_0x9c0512[_0x10f80c[_0xe01b('0x3d')]]=_0x206940[_0x10f80c['variableName']][_0xe01b('0x3e')]());}else if(_0x10f80c[_0xe01b('0x3b')]===_0xe01b('0x41')&&_0x10f80c[_0xe01b('0x42')]&&_0x10f80c[_0xe01b('0x42')][_0xe01b('0x43')]&&_0x10f80c[_0xe01b('0x3d')]){_0x206940[_0x10f80c[_0xe01b('0x42')][_0xe01b('0x43')][_0xe01b('0x44')]()]&&(_0x9c0512[_0x10f80c[_0xe01b('0x3d')]]=_0x206940[_0x10f80c[_0xe01b('0x42')][_0xe01b('0x43')]['toLowerCase']()]['toString']());}});}return _0x9c0512;}function getConnection(_0xe5ced5){var _0x20f081=_0xe5ced5[_0xe01b('0x45')][_0xe01b('0x46')](_0xe5ced5['securityToken']);var _0x5b95e1=new jsforce[(_0xe01b('0x47'))]({'oauth2':{'loginUrl':_0xe5ced5[_0xe01b('0x48')]||_0xe01b('0x49'),'clientId':_0xe5ced5['clientId'],'clientSecret':_0xe5ced5[_0xe01b('0x4a')]}});return _0x5b95e1[_0xe01b('0x4b')](_0xe5ced5['username'],_0x20f081)[_0xe01b('0x1f')](function(){logger[_0xe01b('0x24')]('Connection\x20established.');return _0x5b95e1;});}exports['queue']=function(_0x252b6d,_0x35636b,_0x4d8c8a,_0x53c6ac,_0x380102,_0x115b91){var _0x507cb6,_0x87e1d0,_0x151b0f,_0x2376e6;_0x115b91[_0xe01b('0x4c')]=intUtil[_0xe01b('0x4d')](_0x115b91['serverUrl']);_0x115b91['remoteUri']=intUtil['stripTrailingSlash'](_0x115b91[_0xe01b('0x48')]);if(_0x380102&&_0x380102[_0xe01b('0x4e')]){logger[_0xe01b('0x24')](_0xe01b('0x4f'),_0xe01b('0x50'));_0x35636b['recordingURL']=util[_0xe01b('0x33')](_0xe01b('0x51'),_0x115b91['serverUrl'],_0x35636b[_0xe01b('0x52')],md5(_0x35636b[_0xe01b('0x52')]));}else{_0x35636b['recordingURL']='';}return getConnection(_0x115b91)['then'](function(_0x411d5c){_0x2376e6=_0x411d5c;return getUser(_0x115b91,_0x53c6ac[_0xe01b('0x53')],_0x2376e6);})[_0xe01b('0x1f')](function(_0x3693a1){_0x507cb6=_0x3693a1;return getEndUser(_0x115b91,_0x4d8c8a,_0x35636b[_0xe01b('0x54')],_0x35636b['calleridnum'],_0x2376e6);})[_0xe01b('0x1f')](function(_0x308324){_0x87e1d0=_0x308324;return getTicket(_0x115b91,_0x507cb6,_0x87e1d0,_0x4d8c8a,_0x35636b,_0x4d8c8a[_0xe01b('0x55')],_0x2376e6,_0xe01b('0x56'));})[_0xe01b('0x1f')](function(_0x1ddaf0){_0x151b0f=_0x1ddaf0;logger[_0xe01b('0x24')](_0xe01b('0x57'),_0x151b0f['id']);logger[_0xe01b('0x24')](_0xe01b('0x58'),_0x151b0f['id'],_0x53c6ac[_0xe01b('0x43')],_0x115b91[_0xe01b('0x3b')]);switch(_0x115b91[_0xe01b('0x3b')]){case'integrationTab':emit(util[_0xe01b('0x33')](_0xe01b('0x59'),_0x53c6ac['name']),'trigger:salesforce:display',{'recordId':_0x151b0f['id']});break;case'newTab':emit(util[_0xe01b('0x33')](_0xe01b('0x59'),_0x53c6ac['name']),_0xe01b('0x5a'),{'uri':util[_0xe01b('0x33')]('%s/%s/e',_0x2376e6[_0xe01b('0x5b')],_0x151b0f['id'])});break;default:logger[_0xe01b('0x5c')](_0xe01b('0x5d'));}})[_0xe01b('0x5e')](function(_0x5f366a){logger['error'](_0xe01b('0x4f'),JSON[_0xe01b('0x5f')](_0x5f366a));});};exports[_0xe01b('0x60')]=function(_0x10e688,_0x4e065a,_0x3b0986,_0x563f4f,_0x1e418d,_0x12c2c0,_0x15ef1e){var _0xd477a,_0x2afe10,_0x302759,_0x1b4d80;_0x12c2c0[_0xe01b('0x4c')]=intUtil[_0xe01b('0x4d')](_0x12c2c0[_0xe01b('0x4c')]);_0x12c2c0['remoteUri']=intUtil['stripTrailingSlash'](_0x12c2c0['remoteUri']);if(_0x15ef1e&&_0x15ef1e[_0xe01b('0x61')]&&_0x15ef1e['recordingFormat']!=='none'){logger[_0xe01b('0x24')](_0xe01b('0x62'),'Recording\x20is\x20enabled!');_0x4e065a['recordingURL']=util[_0xe01b('0x33')](_0xe01b('0x51'),_0x12c2c0[_0xe01b('0x4c')],_0x4e065a[_0xe01b('0x52')],md5(_0x4e065a['uniqueid']));}return getConnection(_0x12c2c0)[_0xe01b('0x1f')](function(_0x58abf9){_0x1b4d80=_0x58abf9;return getUser(_0x12c2c0,_0x563f4f[_0xe01b('0x53')],_0x1b4d80);})[_0xe01b('0x1f')](function(_0x901519){_0xd477a=_0x901519;return getEndUser(_0x12c2c0,_0x3b0986,_0x4e065a[_0xe01b('0x63')],_0x4e065a['destcalleridnum'],_0x1b4d80);})[_0xe01b('0x1f')](function(_0x4159fc){_0x2afe10=_0x4159fc;return getTicket(_0x12c2c0,_0xd477a,_0x2afe10,_0x3b0986,_0x4e065a,_0x3b0986['Fields'],_0x1b4d80,_0xe01b('0x60'));})[_0xe01b('0x1f')](function(_0x18bb45){_0x302759=_0x18bb45;logger[_0xe01b('0x24')](_0xe01b('0x64'),_0x302759['id']);logger[_0xe01b('0x24')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x302759['id'],_0x563f4f['name'],_0x12c2c0[_0xe01b('0x3b')]);switch(_0x12c2c0[_0xe01b('0x3b')]){case _0xe01b('0x65'):emit(util['format'](_0xe01b('0x59'),_0x563f4f['name']),_0xe01b('0x66'),{'recordId':_0x302759['id']});break;case _0xe01b('0x67'):emit(util['format'](_0xe01b('0x59'),_0x563f4f[_0xe01b('0x43')]),'trigger:browser:url',{'uri':util[_0xe01b('0x33')](_0xe01b('0x68'),_0x1b4d80[_0xe01b('0x5b')],_0x302759['id'])});break;default:logger[_0xe01b('0x5c')]('[OUTBOUND]',_0xe01b('0x69'));}})[_0xe01b('0x5e')](function(_0x1486c9){logger['error'](_0xe01b('0x62'),JSON['stringify'](_0x1486c9));});};exports[_0xe01b('0x6a')]=function(_0x54f683,_0x12bf46,_0x2a8a5c,_0x33c2e0,_0x349bf1,_0x44072c){var _0x12968e,_0x3d3b27,_0x40abb3,_0x52017e;_0x44072c['serverUrl']=intUtil['stripTrailingSlash'](_0x44072c[_0xe01b('0x4c')]);_0x44072c['remoteUri']=intUtil[_0xe01b('0x4d')](_0x44072c[_0xe01b('0x48')]);if(_0x349bf1&&_0x349bf1['monitor_format']){logger[_0xe01b('0x24')]('['+_0x12bf46[_0xe01b('0x6b')][_0xe01b('0x6c')]()+']',_0xe01b('0x50'));_0x12bf46[_0xe01b('0x6d')]=util[_0xe01b('0x33')](_0xe01b('0x51'),_0x44072c[_0xe01b('0x4c')],_0x12bf46['uniqueid'],md5(_0x12bf46[_0xe01b('0x52')]));}else{_0x12bf46[_0xe01b('0x6d')]='';}return getConnection(_0x44072c)['then'](function(_0x4984d3){_0x52017e=_0x4984d3;if(!_['isNil'](_0x33c2e0)){return getUser(_0x44072c,_0x33c2e0[_0xe01b('0x43')],_0x52017e);}else{return getUser(_0x44072c,null,_0x52017e);}})[_0xe01b('0x1f')](function(_0x590075){_0x12968e=_0x590075;return getEndUser(_0x44072c,_0x2a8a5c,_0x12bf46['calleridname'],_0x12bf46['calleridnum'],_0x52017e);})[_0xe01b('0x1f')](function(_0x12c847){_0x3d3b27=_0x12c847;return getTicket(_0x44072c,_0x12968e,_0x3d3b27,_0x2a8a5c,_0x12bf46,_0x2a8a5c[_0xe01b('0x55')],_0x52017e);})[_0xe01b('0x1f')](function(_0x43b8c7){_0x40abb3=_0x43b8c7;logger[_0xe01b('0x24')]('['+_0x12bf46['lastevent'][_0xe01b('0x6c')]()+_0xe01b('0x6e'),_0x40abb3['id']);logger[_0xe01b('0x24')]('['+_0x12bf46[_0xe01b('0x6b')]['toUpperCase']()+_0xe01b('0x6f'),_0x44072c[_0xe01b('0x3b')]);})['catch'](function(_0x5d57c7){logger['error']('['+_0x12bf46[_0xe01b('0x6b')][_0xe01b('0x6c')]()+']',JSON[_0xe01b('0x5f')](_0x5d57c7));});}; \ 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 5120897..e26e96b 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 _0x814b=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','],\x20getUser\x20entity','length','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','Variable','name','POST','incident','assign','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number','label','?sysparm_query=name%3D','ticketId','Incident\x20-\x20','forEach','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','unmanaged'];(function(_0x149115,_0x1c8b5e){var _0x2353af=function(_0x1fffbe){while(--_0x1fffbe){_0x149115['push'](_0x149115['shift']());}};_0x2353af(++_0x1c8b5e);}(_0x814b,0x1a2));var _0xb814=function(_0x22b39b,_0x2b7d63){_0x22b39b=_0x22b39b-0x0;var _0x280e1d=_0x814b[_0x22b39b];return _0x280e1d;};'use strict';var _=require(_0xb814('0x0'));var Promise=require(_0xb814('0x1'));var rp=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var md5=require(_0xb814('0x4'));var Redis=require(_0xb814('0x5'));var intUtil=require('./util');var config=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));config[_0xb814('0x9')]=_[_0xb814('0xa')](config[_0xb814('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xb814('0xb'))(new Redis(config[_0xb814('0x9')]));function getAdminUser(_0x5c8539,_0x271af9,_0x2913a6,_0x186d5a,_0x41166c,_0x1fea33){return new Promise(function(_0x21d4a5,_0x1086f8){var _0x19aad8={'method':_0xb814('0xc'),'uri':_0x186d5a+_0xb814('0xd')+'&'+_0x41166c+'&'+_0x1fea33,'auth':_0x271af9,'json':!![]};return rp(_0x19aad8)[_0xb814('0xe')](function(_0x4b5f14){if(_0x4b5f14[_0xb814('0xf')]['length']>0x0){_0x2913a6[_0xb814('0x10')]=_0x4b5f14[_0xb814('0xf')][0x0][_0xb814('0x11')];}logger[_0xb814('0x12')]('['+[_0x5c8539[_0xb814('0x13')]()]+_0xb814('0x14'),_0x2913a6);_0x21d4a5(_0x2913a6);})[_0xb814('0x15')](function(_0x41ed7b){logger[_0xb814('0x16')]('['+[_0x5c8539[_0xb814('0x13')]()]+']',_0x41ed7b[_0xb814('0x17')]);_0x1086f8(_0x41ed7b[_0xb814('0x17')]);});});}function getUser(_0x17f5bd,_0x39bfcf,_0x303aca,_0x3a71d6,_0x45e0d0){return function(_0x265a83){logger[_0xb814('0x12')]('['+[_0x17f5bd[_0xb814('0x13')]()]+_0xb814('0x18'),_0x265a83);return new Promise(function(_0x48c9df,_0x168a48){if(intUtil['validateEmail'](_0x265a83[_0xb814('0x19')])){var _0xfac75b={'method':'GET','uri':_0x303aca+'sys_user?sysparm_query=email%3D'+_0x265a83['userEmail']+'&'+_0x3a71d6+'&'+_0x45e0d0,'auth':_0x39bfcf,'json':!![]};logger[_0xb814('0x12')]('['+[_0x17f5bd['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0xfac75b);return rp(_0xfac75b)[_0xb814('0xe')](function(_0x24211d){logger[_0xb814('0x12')]('['+[_0x17f5bd['toUpperCase']()]+_0xb814('0x1a'),_0x24211d);if(_0x24211d['result'][_0xb814('0x1b')]>0x0&&String(_0x24211d[_0xb814('0xf')][0x0][_0xb814('0x1c')])===_0xb814('0x1d')){_0x265a83[_0xb814('0x1e')]=_0x24211d[_0xb814('0xf')][0x0][_0xb814('0x11')];}else{_0x265a83['userId']=_0x265a83[_0xb814('0x10')];_0x265a83['userEmail']=_0x265a83[_0xb814('0x1f')];}logger[_0xb814('0x12')]('['+[_0x17f5bd[_0xb814('0x13')]()]+_0xb814('0x20'),_0x265a83);_0x48c9df(_0x265a83);})[_0xb814('0x15')](function(_0xb9e57d){logger[_0xb814('0x16')]('['+[_0x17f5bd['toUpperCase']()]+']',_0xb9e57d[_0xb814('0x17')]);_0x168a48(_0xb9e57d[_0xb814('0x17')]);});}else{logger[_0xb814('0x12')]('['+[_0x17f5bd[_0xb814('0x13')]()]+_0xb814('0x21'));_0x265a83[_0xb814('0x1e')]=_0x265a83[_0xb814('0x10')];_0x265a83[_0xb814('0x19')]=_0x265a83['adminEmail'];_0x48c9df(_0x265a83);}});};}function createEndUser(_0x271aa8,_0x328a08,_0x52ed64,_0x9008b2,_0x37d24d){logger[_0xb814('0x12')]('['+[_0x271aa8['toUpperCase']()]+_0xb814('0x22'),_0x52ed64);return new Promise(function(_0x2051d0,_0x58c3ca){var _0x338a28={'method':'POST','uri':_0x9008b2+_0xb814('0x23')+_0x37d24d,'body':{'user_name':_0x52ed64['endUserNumber'],'roles':'user','first_name':_0x52ed64[_0xb814('0x24')],'active':'true','date_format':_0xb814('0x25'),'phone':_0x52ed64[_0xb814('0x24')]},'auth':_0x328a08,'json':!![]};return rp(_0x338a28)[_0xb814('0xe')](function(_0x599f9f){logger['info']('['+[_0x271aa8[_0xb814('0x13')]()]+_0xb814('0x26'),_0x599f9f['result']);_0x52ed64[_0xb814('0x27')]=_0x599f9f[_0xb814('0xf')][_0xb814('0x11')];_0x2051d0(_0x52ed64);})[_0xb814('0x15')](function(_0x1b78de){logger[_0xb814('0x16')]('['+[_0x271aa8[_0xb814('0x13')]()]+']',_0x1b78de['message']);_0x58c3ca(_0x1b78de[_0xb814('0x17')]);});});}function getEndUser(_0x2263f6,_0x30de5a,_0x424e2b,_0x14100d,_0x4ff31a){return function(_0x16ef82){logger['info']('['+[_0x2263f6[_0xb814('0x13')]()]+_0xb814('0x28'),_0x16ef82);return new Promise(function(_0xe0f509,_0x492d5e){var _0x40b885={'method':_0xb814('0xc'),'uri':_0x424e2b+'sys_user?sysparm_query=phone%3D'+_0x16ef82[_0xb814('0x24')]+'&'+_0x14100d+'&'+_0x4ff31a,'auth':_0x30de5a,'json':!![]};return rp(_0x40b885)[_0xb814('0xe')](function(_0x1a8bd0){if(_0x1a8bd0[_0xb814('0xf')][_0xb814('0x1b')]>0x0){_0x16ef82[_0xb814('0x27')]=_0x1a8bd0['result'][0x0][_0xb814('0x11')];logger['info']('['+[_0x2263f6[_0xb814('0x13')]()]+'],\x20getEndUser\x20crm',_0x16ef82);_0xe0f509(_0x16ef82);}else{return createEndUser(_0x2263f6,_0x30de5a,_0x16ef82,_0x424e2b,_0x14100d)[_0xb814('0xe')](function(_0x4b9233){logger[_0xb814('0x12')]('['+[_0x2263f6[_0xb814('0x13')]()]+'],\x20createEndUser\x20crm',_0x4b9233);_0xe0f509(_0x4b9233);});}})['catch'](function(_0x5dd6bc){logger['error']('['+[_0x2263f6[_0xb814('0x13')]()]+']',_0x5dd6bc[_0xb814('0x17')]);_0x492d5e(_0x5dd6bc[_0xb814('0x17')]);});});};}function getCustomFields(_0x42c2ed,_0x51cdba){var _0x47d782={};if(_0x42c2ed[_0xb814('0x1b')]>0x0){_['forEach'](_0x42c2ed,function(_0x2a93da){if(_0x2a93da[_0xb814('0x29')]===_0xb814('0x2a')&&_0x2a93da[_0xb814('0x2b')]&&!_0x2a93da[_0xb814('0x2c')]){_0x47d782[_0x2a93da[_0xb814('0x2d')][_0xb814('0x2e')]()]=_0x2a93da[_0xb814('0x2f')][_0xb814('0x30')]();}else if(_0x2a93da['type']==='string'&&_0x2a93da['idField']&&_0x2a93da[_0xb814('0x2c')]){_0x47d782[_0x2a93da['idField'][_0xb814('0x2e')]()]=_0x2a93da['content'][_0xb814('0x30')]();}else if(_0x2a93da[_0xb814('0x29')]===_0xb814('0x31')&&_0x2a93da[_0xb814('0x32')]&&_0x2a93da['idField']&&_0x2a93da[_0xb814('0x2c')]){_0x47d782[_0x2a93da[_0xb814('0x2d')][_0xb814('0x2e')]()]=_0x51cdba[_0x2a93da[_0xb814('0x32')]][_0xb814('0x30')]();}else if(_0x2a93da[_0xb814('0x29')]==='customVariable'&&_0x2a93da[_0xb814('0x33')]&&_0x2a93da[_0xb814('0x33')][_0xb814('0x34')]&&_0x2a93da[_0xb814('0x2d')]&&_0x2a93da[_0xb814('0x2c')]){_0x47d782[_0x2a93da[_0xb814('0x2d')][_0xb814('0x2e')]()]=_0x51cdba[_0x2a93da['Variable']['name'][_0xb814('0x2e')]()][_0xb814('0x30')]();}});}return _0x47d782;}function getTicket(_0x4c08d6,_0x2bf906,_0x43f1b,_0x40e627,_0x24b697,_0x40af85){return function(_0x2eb9b6){logger[_0xb814('0x12')]('['+[_0x4c08d6[_0xb814('0x13')]()]+']\x20getTicket\x20input\x20crm',_0x2eb9b6);return new Promise(function(_0x37800a,_0x17510c){var _0x4a76bb=_0x4c08d6[_0xb814('0x2e')]()==='outbound'?_0x2eb9b6[_0xb814('0x1e')]:_0x2eb9b6[_0xb814('0x27')];var _0xc71270={'method':_0xb814('0x35'),'uri':_0x43f1b+_0xb814('0x36')+'?'+_0x40af85,'body':Object[_0xb814('0x37')]({},{'active':_0xb814('0x1d'),'caller_id':_0x4a76bb,'assigned_to':_0x2eb9b6[_0xb814('0x1e')],'short_description':intUtil[_0xb814('0x38')](_0x40e627[_0xb814('0x39')],_0x24b697,'\x20'),'description':intUtil['getString'](_0x40e627['Descriptions'],_0x24b697,'\x0a')},getCustomFields(_0x40e627[_0xb814('0x3a')],_0x24b697)),'auth':_0x2bf906,'json':!![]};return rp(_0xc71270)[_0xb814('0xe')](function(_0x4156d8){logger[_0xb814('0x12')]('['+[_0x4c08d6[_0xb814('0x13')]()]+_0xb814('0x3b'),_0x4156d8[_0xb814('0xf')]);_0x2eb9b6['ticketId']=_0x4156d8[_0xb814('0xf')][_0xb814('0x11')];_0x2eb9b6[_0xb814('0x3c')]=_0x4156d8['result'][_0xb814('0x3d')];logger['info']('['+[_0x4c08d6[_0xb814('0x13')]()]+']\x20getTicket\x20crm',_0x2eb9b6);_0x37800a(_0x2eb9b6);})[_0xb814('0x15')](function(_0x3cf8f8){logger['error']('['+[_0x4c08d6[_0xb814('0x13')]()]+']',_0x3cf8f8[_0xb814('0x17')]);_0x17510c(_0x3cf8f8[_0xb814('0x17')]);});});};}function createRemoteTag(_0x5209d1,_0x3da050,_0x5f0e58,_0x13bdcf){return new Promise(function(_0x158893,_0x4aed78){var _0x39952d={'method':'POST','uri':_0x5f0e58+'label'+'?'+_0x13bdcf,'body':{'short_description':_0x5209d1,'global':!![],'active':!![],'name':_0x5209d1},'auth':_0x3da050,'json':!![]};return rp(_0x39952d)[_0xb814('0xe')](function(_0x35f59a){var _0x34935b=_0x35f59a['result'][_0xb814('0x11')];_0x158893(_0x34935b);});});}function getRemoteTag(_0x538b0f,_0xf88d23,_0x2174e5,_0x58d6e5,_0x2db5a6){return new Promise(function(_0x5c32c2,_0x25a607){var _0x1656ed={'method':_0xb814('0xc'),'uri':_0x2174e5+_0xb814('0x3e')+_0xb814('0x3f')+_0x538b0f+'&'+_0x58d6e5,'auth':_0xf88d23,'json':!![]};return rp(_0x1656ed)[_0xb814('0xe')](function(_0x21d3e9){if(_0x21d3e9[_0xb814('0xf')]['length']>0x0){var _0x374532=_0x21d3e9[_0xb814('0xf')][0x0]['sys_id'];_0x5c32c2(_0x374532);}else{return createRemoteTag(_0x538b0f,_0xf88d23,_0x2174e5,_0x58d6e5)[_0xb814('0xe')](function(_0xe14249){_0x5c32c2(_0xe14249);});}});});}function assignTagToIncident(_0x4d13db,_0x371000,_0x58b9a6,_0x48362c,_0x2114ca){return new Promise(function(_0x5257be,_0x3ff213){var _0xd1cd8b={'method':_0xb814('0x35'),'uri':_0x58b9a6+'label_entry'+'?'+_0x2114ca,'body':{'label':_0x4d13db,'table':_0xb814('0x36'),'id_type':'Incident','table_key':_0x48362c[_0xb814('0x40')],'title':_0xb814('0x41')+_0x48362c[_0xb814('0x3c')],'id_display':_0x48362c[_0xb814('0x3c')]},'auth':_0x371000,'json':!![]};return rp(_0xd1cd8b)[_0xb814('0xe')](function(_0x3b374b){_0x5257be();})[_0xb814('0x15')](function(){_0x5257be();});});}function manageTags(_0x113350,_0x46014f,_0x4d611d,_0x211194,_0x111884,_0x3852ae,_0x1ac6d0){return new Promise(function(_0x3b35a8,_0x3d4843){var _0x52edfa=[];_0x46014f[_0xb814('0x42')](function(_0x4ccd94){_0x52edfa[_0xb814('0x43')](getRemoteTag(_0x4ccd94,_0x4d611d,_0x211194,_0x3852ae,_0x1ac6d0));});return Promise[_0xb814('0x44')](_0x52edfa)[_0xb814('0xe')](function(_0x4c884c){if(_0x4c884c[_0xb814('0x1b')]){logger['info']('['+[_0x113350[_0xb814('0x13')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x4c884c);var _0x2f0c94=[];_0x4c884c[_0xb814('0x42')](function(_0xa03cd2){_0x2f0c94[_0xb814('0x43')](assignTagToIncident(_0xa03cd2,_0x4d611d,_0x211194,_0x111884,_0x3852ae));});return Promise[_0xb814('0x44')](_0x2f0c94)[_0xb814('0xe')](function(){_0x3b35a8();})[_0xb814('0x15')](function(){_0x3b35a8();});}else{_0x3b35a8();}});});}function getTags(_0x4d44e3,_0x44088d,_0x51ca51,_0x255047,_0x22c73f,_0x1b989d){return function(_0x3dcaeb){return new Promise(function(_0x19fa45,_0x139531){var _0x514dab=[];var _0x12882a=_0x255047[_0xb814('0x45')];if(_0x12882a&&_0x12882a['length']>0x0){_0x514dab=_[_0xb814('0x46')](_0x12882a,_0xb814('0x34'));}if(_0x514dab[_0xb814('0x1b')]>0x0){return manageTags(_0x4d44e3,_0x514dab,_0x44088d,_0x51ca51,_0x3dcaeb,_0x22c73f,_0x1b989d)[_0xb814('0xe')](function(){_0x19fa45(_0x3dcaeb);});}else{_0x19fa45(_0x3dcaeb);}});};}function emit(_0x2161eb,_0x51d834,_0x3a4d4b){var _0x5e8e8e=_0xb814('0x47')+_0xb814('0x48')+_0xb814('0x49')+_0xb814('0x4a');var _0x2e39b1={'uri':_0x2161eb+_0xb814('0x4b')+_0x3a4d4b+_0x5e8e8e};io['to'](util['format']('user:%s',_0x51d834))['emit'](_0xb814('0x4c'),_0x2e39b1);}exports['cs']=function(_0x490e5c,_0x45a8b9,_0x1d3954,_0x25db89,_0x5e966c,_0x1b76fa,_0x3e5ce8,_0xee204){var _0x5aabbe={};var _0x30f717={'user':_0x1b76fa[_0xb814('0x4d')],'pass':_0x1b76fa[_0xb814('0x4e')]};var _0x3564e0='sysparm_limit=1';var _0x5dedd7=_0xb814('0x4f');_0x1b76fa[_0xb814('0x50')]=intUtil[_0xb814('0x51')](_0x1b76fa[_0xb814('0x50')]);_0x1b76fa[_0xb814('0x52')]=intUtil[_0xb814('0x51')](_0x1b76fa[_0xb814('0x52')]);var _0xe47442=util[_0xb814('0x53')](_0xb814('0x54'),_0x1b76fa[_0xb814('0x50')]);_0x5aabbe[_0xb814('0x19')]=!_[_0xb814('0x55')](_0x25db89)?_0x25db89[_0xb814('0x56')]:null;_0x5aabbe[_0xb814('0x1f')]=_0x1b76fa['email'];_0x5aabbe[_0xb814('0x24')]=_0xee204[_0xb814('0x2e')]()===_0xb814('0x57')?_0x45a8b9[_0xb814('0x58')]:_0x45a8b9[_0xb814('0x59')];_0x5aabbe[_0xb814('0x5a')]=_0xee204==='queue'||_0xee204===_0xb814('0x5b')?'queue':_0xb814('0x57');var _0x39aa00=util[_0xb814('0x53')](_0xb814('0x5c'),_0x1b76fa[_0xb814('0x52')],_0x45a8b9['uniqueid'],md5(_0x45a8b9['uniqueid']));if(_0x5e966c&&_0x5e966c[_0xb814('0x5d')]){logger[_0xb814('0x12')](_0xb814('0x5e'),_0xb814('0x5f'));_0x45a8b9['recordingURL']=_0x39aa00;}else if(_0x3e5ce8&&_0x3e5ce8[_0xb814('0x60')]&&_0x3e5ce8['recordingFormat']!==_0xb814('0x61')){logger[_0xb814('0x12')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x45a8b9[_0xb814('0x62')]=_0x39aa00;}else{_0x45a8b9['recordingURL']='';}return getAdminUser(_0xee204,_0x30f717,_0x5aabbe,_0xe47442,_0x5dedd7,_0x3564e0)[_0xb814('0xe')](getUser(_0xee204,_0x30f717,_0xe47442,_0x5dedd7,_0x3564e0))[_0xb814('0xe')](getEndUser(_0xee204,_0x30f717,_0xe47442,_0x5dedd7,_0x3564e0))[_0xb814('0xe')](getTicket(_0xee204,_0x30f717,_0xe47442,_0x1d3954,_0x45a8b9,_0x5dedd7))[_0xb814('0xe')](function(_0x46784f){logger[_0xb814('0x12')](util[_0xb814('0x53')]('The\x20ticket\x20ID\x20is:\x20%s',_0x46784f[_0xb814('0x40')]));logger['info'](util[_0xb814('0x53')]('call\x20direction:\x20%s',_0xee204));if(_0xee204!==_0xb814('0x5b')){logger[_0xb814('0x12')]('['+[_0xee204['toUpperCase']()]+']',_0xb814('0x63'));emit(_0x1b76fa['remoteUri'],_0x25db89[_0xb814('0x34')],_0x46784f[_0xb814('0x40')]);}})['catch'](function(_0x5a0c4a){logger[_0xb814('0x16')]('['+[_0xee204[_0xb814('0x13')]()]+_0xb814('0x64'),util[_0xb814('0x65')](_0x5a0c4a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5fc3=['],\x20EndUser\x20schema','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','nameField','customField','idField','content','toString','string','toLowerCase','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','incident','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','socket.io-emitter','GET','then','length','adminId','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','userEmail','],\x20getUser\x20entity','result','active','true','sys_id','userId','message','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System'];(function(_0x4e502e,_0x2a7c94){var _0x25c957=function(_0x2f6f74){while(--_0x2f6f74){_0x4e502e['push'](_0x4e502e['shift']());}};_0x25c957(++_0x2a7c94);}(_0x5fc3,0xa8));var _0x35fc=function(_0x555069,_0x23d66a){_0x555069=_0x555069-0x0;var _0x100af7=_0x5fc3[_0x555069];return _0x100af7;};'use strict';var _=require(_0x35fc('0x0'));var Promise=require(_0x35fc('0x1'));var rp=require('request-promise');var util=require(_0x35fc('0x2'));var md5=require(_0x35fc('0x3'));var Redis=require(_0x35fc('0x4'));var intUtil=require(_0x35fc('0x5'));var config=require(_0x35fc('0x6'));var logger=require('../../../../config/logger')(_0x35fc('0x7'));config[_0x35fc('0x8')]=_[_0x35fc('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0xa'))(new Redis(config['redis']));function getAdminUser(_0x16e153,_0x27524f,_0xc72d93,_0x1e5f90,_0x34ff19,_0xf9d3a6){return new Promise(function(_0x2051ab,_0x565f95){var _0x1083a9={'method':_0x35fc('0xb'),'uri':_0x1e5f90+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x34ff19+'&'+_0xf9d3a6,'auth':_0x27524f,'json':!![]};return rp(_0x1083a9)[_0x35fc('0xc')](function(_0x33f491){if(_0x33f491['result'][_0x35fc('0xd')]>0x0){_0xc72d93[_0x35fc('0xe')]=_0x33f491['result'][0x0]['sys_id'];}logger[_0x35fc('0xf')]('['+[_0x16e153['toUpperCase']()]+_0x35fc('0x10'),_0xc72d93);_0x2051ab(_0xc72d93);})[_0x35fc('0x11')](function(_0x2a6ad2){logger[_0x35fc('0x12')]('['+[_0x16e153[_0x35fc('0x13')]()]+']',_0x2a6ad2['message']);_0x565f95(_0x2a6ad2['message']);});});}function getUser(_0x5eac0f,_0x558364,_0x398b67,_0x229d56,_0x53b898){return function(_0x154958){logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x154958);return new Promise(function(_0x26ba54,_0x45c8b7){if(intUtil['validateEmail'](_0x154958[_0x35fc('0x14')])){var _0x363e47={'method':_0x35fc('0xb'),'uri':_0x398b67+'sys_user?sysparm_query=email%3D'+_0x154958[_0x35fc('0x14')]+'&'+_0x229d56+'&'+_0x53b898,'auth':_0x558364,'json':!![]};logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20rp\x20obj',_0x363e47);return rp(_0x363e47)[_0x35fc('0xc')](function(_0x350a27){logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+_0x35fc('0x15'),_0x350a27);if(_0x350a27[_0x35fc('0x16')][_0x35fc('0xd')]>0x0&&String(_0x350a27[_0x35fc('0x16')][0x0][_0x35fc('0x17')])===_0x35fc('0x18')){_0x154958['userId']=_0x350a27[_0x35fc('0x16')][0x0][_0x35fc('0x19')];}else{_0x154958[_0x35fc('0x1a')]=_0x154958[_0x35fc('0xe')];_0x154958[_0x35fc('0x14')]=_0x154958['adminEmail'];}logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20crm',_0x154958);_0x26ba54(_0x154958);})[_0x35fc('0x11')](function(_0x5a93df){logger[_0x35fc('0x12')]('['+[_0x5eac0f['toUpperCase']()]+']',_0x5a93df[_0x35fc('0x1b')]);_0x45c8b7(_0x5a93df['message']);});}else{logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+']\x20using\x20admin\x20profile');_0x154958['userId']=_0x154958[_0x35fc('0xe')];_0x154958['userEmail']=_0x154958[_0x35fc('0x1c')];_0x26ba54(_0x154958);}});};}function createEndUser(_0x1a5d92,_0x57001c,_0x26b7cb,_0x645eac,_0x383837){logger[_0x35fc('0xf')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+_0x35fc('0x1d'),_0x26b7cb);return new Promise(function(_0x11ccdb,_0x451f0c){var _0x54aedc={'method':_0x35fc('0x1e'),'uri':_0x645eac+_0x35fc('0x1f')+_0x383837,'body':{'user_name':_0x26b7cb[_0x35fc('0x20')],'roles':'user','first_name':_0x26b7cb[_0x35fc('0x20')],'active':_0x35fc('0x18'),'date_format':_0x35fc('0x21'),'phone':_0x26b7cb[_0x35fc('0x20')]},'auth':_0x57001c,'json':!![]};return rp(_0x54aedc)[_0x35fc('0xc')](function(_0x103181){logger[_0x35fc('0xf')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+_0x35fc('0x22'),_0x103181[_0x35fc('0x16')]);_0x26b7cb['endUserId']=_0x103181['result'][_0x35fc('0x19')];_0x11ccdb(_0x26b7cb);})['catch'](function(_0x37b394){logger[_0x35fc('0x12')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+']',_0x37b394[_0x35fc('0x1b')]);_0x451f0c(_0x37b394[_0x35fc('0x1b')]);});});}function getEndUser(_0x12e78f,_0x4e43b4,_0x3fe193,_0x330a14,_0x46b9ef){return function(_0x4441d8){logger[_0x35fc('0xf')]('['+[_0x12e78f[_0x35fc('0x13')]()]+'],\x20getEndUser\x20input\x20crm',_0x4441d8);return new Promise(function(_0x2483be,_0x38193d){var _0x1fecdf={'method':'GET','uri':_0x3fe193+_0x35fc('0x23')+_0x4441d8['endUserNumber']+'&'+_0x330a14+'&'+_0x46b9ef,'auth':_0x4e43b4,'json':!![]};return rp(_0x1fecdf)[_0x35fc('0xc')](function(_0x33a377){if(_0x33a377[_0x35fc('0x16')][_0x35fc('0xd')]>0x0){_0x4441d8['endUserId']=_0x33a377['result'][0x0]['sys_id'];logger[_0x35fc('0xf')]('['+[_0x12e78f['toUpperCase']()]+_0x35fc('0x24'),_0x4441d8);_0x2483be(_0x4441d8);}else{return createEndUser(_0x12e78f,_0x4e43b4,_0x4441d8,_0x3fe193,_0x330a14)['then'](function(_0x9c6b65){logger[_0x35fc('0xf')]('['+[_0x12e78f[_0x35fc('0x13')]()]+_0x35fc('0x25'),_0x9c6b65);_0x2483be(_0x9c6b65);});}})[_0x35fc('0x11')](function(_0x3313fa){logger[_0x35fc('0x12')]('['+[_0x12e78f['toUpperCase']()]+']',_0x3313fa[_0x35fc('0x1b')]);_0x38193d(_0x3313fa[_0x35fc('0x1b')]);});});};}function getCustomFields(_0x4e0ce3,_0x1feda5){var _0x1ccc41={};if(_0x4e0ce3[_0x35fc('0xd')]>0x0){_[_0x35fc('0x26')](_0x4e0ce3,function(_0x813866){if(_0x813866[_0x35fc('0x27')]==='string'&&_0x813866[_0x35fc('0x28')]&&!_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866[_0x35fc('0x2a')]['toLowerCase']()]=_0x813866[_0x35fc('0x2b')][_0x35fc('0x2c')]();}else if(_0x813866['type']===_0x35fc('0x2d')&&_0x813866[_0x35fc('0x2a')]&&_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866[_0x35fc('0x2a')][_0x35fc('0x2e')]()]=_0x813866[_0x35fc('0x2b')][_0x35fc('0x2c')]();}else if(_0x813866[_0x35fc('0x27')]==='variable'&&_0x813866['variableName']&&_0x813866[_0x35fc('0x2a')]&&_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866['idField']['toLowerCase']()]=_0x1feda5[_0x813866['variableName']][_0x35fc('0x2c')]();}else if(_0x813866[_0x35fc('0x27')]==='customVariable'&&_0x813866[_0x35fc('0x2f')]&&_0x813866[_0x35fc('0x2f')][_0x35fc('0x30')]&&_0x813866[_0x35fc('0x2a')]&&_0x813866['customField']){_0x1ccc41[_0x813866['idField']['toLowerCase']()]=_0x1feda5[_0x813866['Variable']['name'][_0x35fc('0x2e')]()][_0x35fc('0x2c')]();}});}return _0x1ccc41;}function getTicket(_0x4fc5bc,_0x119925,_0x56cf1f,_0x13d16c,_0x40797d,_0x350237){return function(_0x2de5d1){logger[_0x35fc('0xf')]('['+[_0x4fc5bc['toUpperCase']()]+_0x35fc('0x31'),_0x2de5d1);return new Promise(function(_0x2c25d5,_0x4fd3d8){var _0x18181b=_0x4fc5bc[_0x35fc('0x2e')]()===_0x35fc('0x32')?_0x2de5d1[_0x35fc('0x1a')]:_0x2de5d1['endUserId'];var _0x3666a5={'method':'POST','uri':_0x56cf1f+'incident'+'?'+_0x350237,'body':Object[_0x35fc('0x33')]({},{'active':_0x35fc('0x18'),'caller_id':_0x18181b,'assigned_to':_0x2de5d1[_0x35fc('0x1a')],'short_description':intUtil[_0x35fc('0x34')](_0x13d16c[_0x35fc('0x35')],_0x40797d,'\x20'),'description':intUtil[_0x35fc('0x34')](_0x13d16c[_0x35fc('0x36')],_0x40797d,'\x0a')},getCustomFields(_0x13d16c[_0x35fc('0x37')],_0x40797d)),'auth':_0x119925,'json':!![]};return rp(_0x3666a5)['then'](function(_0x3e2961){logger[_0x35fc('0xf')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+_0x35fc('0x38'),_0x3e2961[_0x35fc('0x16')]);_0x2de5d1[_0x35fc('0x39')]=_0x3e2961[_0x35fc('0x16')][_0x35fc('0x19')];_0x2de5d1[_0x35fc('0x3a')]=_0x3e2961[_0x35fc('0x16')][_0x35fc('0x3b')];logger[_0x35fc('0xf')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+_0x35fc('0x3c'),_0x2de5d1);_0x2c25d5(_0x2de5d1);})['catch'](function(_0x553ed6){logger[_0x35fc('0x12')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+']',_0x553ed6[_0x35fc('0x1b')]);_0x4fd3d8(_0x553ed6[_0x35fc('0x1b')]);});});};}function createRemoteTag(_0x3ee296,_0x3e6494,_0x4a4798,_0x4f024c){return new Promise(function(_0x388521,_0x19b2ce){var _0x395d63={'method':_0x35fc('0x1e'),'uri':_0x4a4798+'label'+'?'+_0x4f024c,'body':{'short_description':_0x3ee296,'global':!![],'active':!![],'name':_0x3ee296},'auth':_0x3e6494,'json':!![]};return rp(_0x395d63)[_0x35fc('0xc')](function(_0x13281f){var _0x4965d2=_0x13281f[_0x35fc('0x16')][_0x35fc('0x19')];_0x388521(_0x4965d2);});});}function getRemoteTag(_0x590faa,_0x3e12e4,_0x1ab472,_0x26118e,_0x18f18b){return new Promise(function(_0x5e4018,_0x4de34b){var _0x502a15={'method':_0x35fc('0xb'),'uri':_0x1ab472+_0x35fc('0x3d')+'?sysparm_query=name%3D'+_0x590faa+'&'+_0x26118e,'auth':_0x3e12e4,'json':!![]};return rp(_0x502a15)[_0x35fc('0xc')](function(_0x1f89b3){if(_0x1f89b3[_0x35fc('0x16')][_0x35fc('0xd')]>0x0){var _0x46c59b=_0x1f89b3['result'][0x0][_0x35fc('0x19')];_0x5e4018(_0x46c59b);}else{return createRemoteTag(_0x590faa,_0x3e12e4,_0x1ab472,_0x26118e)[_0x35fc('0xc')](function(_0x39d470){_0x5e4018(_0x39d470);});}});});}function assignTagToIncident(_0x509e77,_0x304dba,_0x1dbf5a,_0x47fb1a,_0x35a676){return new Promise(function(_0x164c7b,_0x1c46b1){var _0x1c4c33={'method':_0x35fc('0x1e'),'uri':_0x1dbf5a+_0x35fc('0x3e')+'?'+_0x35a676,'body':{'label':_0x509e77,'table':_0x35fc('0x3f'),'id_type':_0x35fc('0x40'),'table_key':_0x47fb1a['ticketId'],'title':_0x35fc('0x41')+_0x47fb1a[_0x35fc('0x3a')],'id_display':_0x47fb1a[_0x35fc('0x3a')]},'auth':_0x304dba,'json':!![]};return rp(_0x1c4c33)['then'](function(_0x243871){_0x164c7b();})['catch'](function(){_0x164c7b();});});}function manageTags(_0x4ceacc,_0x5d4a39,_0x23b54f,_0xb1c68a,_0x39a1ee,_0x13901c,_0x3d06b8){return new Promise(function(_0x4bbea0,_0x579f5a){var _0x5353ea=[];_0x5d4a39['forEach'](function(_0x51d231){_0x5353ea[_0x35fc('0x42')](getRemoteTag(_0x51d231,_0x23b54f,_0xb1c68a,_0x13901c,_0x3d06b8));});return Promise[_0x35fc('0x43')](_0x5353ea)[_0x35fc('0xc')](function(_0x3ef680){if(_0x3ef680['length']){logger[_0x35fc('0xf')]('['+[_0x4ceacc[_0x35fc('0x13')]()]+_0x35fc('0x44'),_0x3ef680);var _0x1b0063=[];_0x3ef680[_0x35fc('0x26')](function(_0x1d0e53){_0x1b0063[_0x35fc('0x42')](assignTagToIncident(_0x1d0e53,_0x23b54f,_0xb1c68a,_0x39a1ee,_0x13901c));});return Promise[_0x35fc('0x43')](_0x1b0063)[_0x35fc('0xc')](function(){_0x4bbea0();})['catch'](function(){_0x4bbea0();});}else{_0x4bbea0();}});});}function getTags(_0x35d7c8,_0x47c75f,_0xfbd737,_0x9029e3,_0x2ac8e1,_0x2bc76c){return function(_0x4bdde7){return new Promise(function(_0x465c14,_0x4af592){var _0x4e2835=[];var _0x5f1d4a=_0x9029e3[_0x35fc('0x45')];if(_0x5f1d4a&&_0x5f1d4a['length']>0x0){_0x4e2835=_[_0x35fc('0x46')](_0x5f1d4a,'name');}if(_0x4e2835[_0x35fc('0xd')]>0x0){return manageTags(_0x35d7c8,_0x4e2835,_0x47c75f,_0xfbd737,_0x4bdde7,_0x2ac8e1,_0x2bc76c)['then'](function(){_0x465c14(_0x4bdde7);});}else{_0x465c14(_0x4bdde7);}});};}function emit(_0x42a53a,_0x455b84,_0x3400f0){var _0x1d81a5='%26sysparm_record_target%3Dincident'+_0x35fc('0x47')+_0x35fc('0x48')+_0x35fc('0x49');var _0x5df92d={'uri':_0x42a53a+_0x35fc('0x4a')+_0x3400f0+_0x1d81a5};io['to'](util[_0x35fc('0x4b')](_0x35fc('0x4c'),_0x455b84))[_0x35fc('0x4d')](_0x35fc('0x4e'),_0x5df92d);}exports['cs']=function(_0x2c4309,_0x2ee98b,_0x4464d5,_0x5159a0,_0x28a44b,_0x2008b3,_0x2600d2,_0x4a926d){var _0x1c88d8={};var _0x1b76f0={'user':_0x2008b3['username'],'pass':_0x2008b3['password']};var _0x3969d3='sysparm_limit=1';var _0x223ad3=_0x35fc('0x4f');_0x2008b3[_0x35fc('0x50')]=intUtil[_0x35fc('0x51')](_0x2008b3[_0x35fc('0x50')]);_0x2008b3[_0x35fc('0x52')]=intUtil[_0x35fc('0x51')](_0x2008b3[_0x35fc('0x52')]);var _0x10b725=util[_0x35fc('0x4b')](_0x35fc('0x53'),_0x2008b3[_0x35fc('0x50')]);_0x1c88d8[_0x35fc('0x14')]=!_[_0x35fc('0x54')](_0x5159a0)?_0x5159a0[_0x35fc('0x55')]:null;_0x1c88d8[_0x35fc('0x1c')]=_0x2008b3[_0x35fc('0x55')];_0x1c88d8[_0x35fc('0x20')]=_0x4a926d[_0x35fc('0x2e')]()===_0x35fc('0x32')?_0x2ee98b['destcalleridnum']:_0x2ee98b[_0x35fc('0x56')];_0x1c88d8['callDirection']=_0x4a926d===_0x35fc('0x57')||_0x4a926d===_0x35fc('0x58')?_0x35fc('0x57'):_0x35fc('0x32');var _0x25af78=util[_0x35fc('0x4b')](_0x35fc('0x59'),_0x2008b3[_0x35fc('0x52')],_0x2ee98b[_0x35fc('0x5a')],md5(_0x2ee98b[_0x35fc('0x5a')]));if(_0x28a44b&&_0x28a44b[_0x35fc('0x5b')]){logger['info'](_0x35fc('0x5c'),_0x35fc('0x5d'));_0x2ee98b[_0x35fc('0x5e')]=_0x25af78;}else if(_0x2600d2&&_0x2600d2[_0x35fc('0x5f')]&&_0x2600d2[_0x35fc('0x5f')]!==_0x35fc('0x60')){logger['info'](_0x35fc('0x61'),_0x35fc('0x5d'));_0x2ee98b[_0x35fc('0x5e')]=_0x25af78;}else{_0x2ee98b[_0x35fc('0x5e')]='';}return getAdminUser(_0x4a926d,_0x1b76f0,_0x1c88d8,_0x10b725,_0x223ad3,_0x3969d3)[_0x35fc('0xc')](getUser(_0x4a926d,_0x1b76f0,_0x10b725,_0x223ad3,_0x3969d3))[_0x35fc('0xc')](getEndUser(_0x4a926d,_0x1b76f0,_0x10b725,_0x223ad3,_0x3969d3))[_0x35fc('0xc')](getTicket(_0x4a926d,_0x1b76f0,_0x10b725,_0x4464d5,_0x2ee98b,_0x223ad3))[_0x35fc('0xc')](function(_0xa92234){logger['info'](util[_0x35fc('0x4b')]('The\x20ticket\x20ID\x20is:\x20%s',_0xa92234[_0x35fc('0x39')]));logger[_0x35fc('0xf')](util['format'](_0x35fc('0x62'),_0x4a926d));if(_0x4a926d!==_0x35fc('0x58')){logger[_0x35fc('0xf')]('['+[_0x4a926d[_0x35fc('0x13')]()]+']',_0x35fc('0x63'));emit(_0x2008b3[_0x35fc('0x50')],_0x5159a0[_0x35fc('0x30')],_0xa92234[_0x35fc('0x39')]);}})[_0x35fc('0x11')](function(_0x5806bf){logger['error']('['+[_0x4a926d['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x35fc('0x64')](_0x5806bf,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index 12cc4ea..ff65e91 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 _0xa664=['get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','entry_list','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','format','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','type','string','nameField','toLowerCase','content','customField','custom_fields','variable','Variable','POST','login','password','PLAIN','sessionID','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','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','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','recordingFormat','[OUTBOUND]','destcalleridname','Outbound','monitor_format','toUpperCase','request-promise','bluebird','md5','util','./util','sugarcrm','redis','defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','push','idField','variableName','JSON','stringify','Calls','Basic\x20%s','apiKey','toString','base64'];(function(_0x376db5,_0x2b8874){var _0x304c17=function(_0x2dd9ba){while(--_0x2dd9ba){_0x376db5['push'](_0x376db5['shift']());}};_0x304c17(++_0x2b8874);}(_0xa664,0x132));var _0x4a66=function(_0x449062,_0x5cb7d6){_0x449062=_0x449062-0x0;var _0x585486=_0xa664[_0x449062];return _0x585486;};'use strict';var _=require('lodash');var rp=require(_0x4a66('0x0'));var BPromise=require(_0x4a66('0x1'));var md5=require(_0x4a66('0x2'));var util=require(_0x4a66('0x3'));var Redis=require('ioredis');var intUtil=require(_0x4a66('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x4a66('0x5'));config[_0x4a66('0x6')]=_[_0x4a66('0x7')](config[_0x4a66('0x6')],{'host':_0x4a66('0x8'),'port':0x18eb});var io=require(_0x4a66('0x9'))(new Redis(config[_0x4a66('0x6')]));var def={'method':'POST','json':!![]};function emit(_0x4484c5,_0x3d51bf,_0x20376e){io['to'](_0x4484c5)[_0x4a66('0xa')](_0x3d51bf,_0x20376e);}function getTicket(_0x4a3c4c,_0x1f553d,_0x124ed0,_0x5b7ccd,_0x11b0b7,_0x33430f,_0x42a9fc,_0x75fd00){logger[_0x4a66('0xb')](_0x4a66('0xc'));var _0x2c2523=new Date();var _0x3f662e=[{'name':_0x4a66('0xd'),'value':intUtil[_0x4a66('0xe')](_0x5b7ccd[_0x4a66('0xf')],_0x11b0b7,'\x20')},{'name':_0x4a66('0x10'),'value':_0x1f553d['id']},{'name':_0x4a66('0x11'),'value':_0x1f553d['id']},{'name':_0x4a66('0x12'),'value':intUtil[_0x4a66('0xe')](_0x5b7ccd[_0x4a66('0x13')],_0x11b0b7,'\x0a')},{'name':_0x4a66('0x14'),'value':_0x2c2523['toISOString']()[_0x4a66('0x15')](0x0,0x13)[_0x4a66('0x16')]('T','\x20')},{'name':_0x4a66('0x17'),'value':'0'},{'name':_0x4a66('0x18'),'value':'15'},{'name':_0x4a66('0x19'),'value':_0x124ed0['id']},{'name':_0x4a66('0x1a'),'value':_0x4a66('0x1b')},{'name':_0x4a66('0x1c'),'value':_0x124ed0['name']},{'name':_0x4a66('0x1d'),'value':_0x75fd00}];if(_0x33430f[_0x4a66('0x1e')]){_[_0x4a66('0x1f')](_0x33430f,function(_0x33703f){if(_0x11b0b7[_0x33703f['variableName']]){_0x3f662e[_0x4a66('0x20')]({'name':_0x33703f[_0x4a66('0x21')],'value':_0x11b0b7[_0x33703f[_0x4a66('0x22')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x4a66('0x23'),'rest_data':JSON[_0x4a66('0x24')]({'session':_0x42a9fc['id'],'module_name':_0x4a66('0x25'),'name_value_list':_0x3f662e})}});}function getAuth(_0x4c78e1){return util['format'](_0x4a66('0x26'),new Buffer(_0x4c78e1[_0x4a66('0x27')]+':X')[_0x4a66('0x28')](_0x4a66('0x29')));}function getServerInfo(_0x18ec8e){return request({'form':{'method':_0x4a66('0x2a'),'input_type':_0x4a66('0x23'),'response_type':_0x4a66('0x23'),'rest_data':JSON[_0x4a66('0x24')]({'session':_0x18ec8e['id']})}});}function getUser(_0x2c0a0d,_0x10274a,_0x3052cc){if(!_[_0x4a66('0x2b')](_0x10274a)){logger[_0x4a66('0xb')](_0x4a66('0x2c'),_0x10274a);return request({'form':{'method':_0x4a66('0x2d'),'input_type':_0x4a66('0x23'),'response_type':'JSON','rest_data':JSON[_0x4a66('0x24')]({'session':_0x3052cc['id'],'module_name':_0x4a66('0x2e'),'query':util['format'](_0x4a66('0x2f'),_0x10274a),'order_by':'','offset':'0','select_fields':['id',_0x4a66('0xd'),_0x4a66('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4a66('0x31')](function(_0x3260d4){if(_0x3260d4['entry_list']['length']){var _0x38328d=_[_0x4a66('0x32')](_0x3260d4[_0x4a66('0x33')],function(_0x257485){return _0x257485[_0x4a66('0x34')][_0x4a66('0x30')][_0x4a66('0x35')]===_0x10274a;});if(_0x38328d){logger[_0x4a66('0xb')](_0x4a66('0x36'));return BPromise[_0x4a66('0x37')]({'id':_0x38328d[_0x4a66('0x34')]['id'][_0x4a66('0x35')],'name':_0x38328d['name_value_list']['name'][_0x4a66('0x35')]});}}logger['info'](_0x4a66('0x38'));return BPromise[_0x4a66('0x37')]({'id':_0x3052cc[_0x4a66('0x34')][_0x4a66('0x39')]['value'],'name':_0x3052cc[_0x4a66('0x34')][_0x4a66('0x30')][_0x4a66('0x35')]});});}else{logger[_0x4a66('0xb')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x3052cc[_0x4a66('0x34')][_0x4a66('0x39')][_0x4a66('0x35')],'name':_0x3052cc[_0x4a66('0x34')][_0x4a66('0x30')][_0x4a66('0x35')]});}}function getEndUser(_0x3e0b86,_0xee22c4,_0x378cdf,_0x1a8fbd){logger['info']('Searching\x20enduser\x20with\x20phone',_0x378cdf);return request({'form':{'method':'get_entry_list','input_type':_0x4a66('0x23'),'response_type':_0x4a66('0x23'),'rest_data':JSON[_0x4a66('0x24')]({'session':_0x1a8fbd['id'],'module_name':_0x4a66('0x1b'),'query':util[_0x4a66('0x3a')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x378cdf),'order_by':'','offset':'0','select_fields':['id',_0x4a66('0xd'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x2be88a){if(_0x2be88a[_0x4a66('0x33')][_0x4a66('0x1e')]){var _0x3f9add=_['find'](_0x2be88a[_0x4a66('0x33')],function(_0x57ed4e){return _0x57ed4e[_0x4a66('0x34')][_0x4a66('0x3b')][_0x4a66('0x35')]===_0x378cdf;});if(_0x3f9add){logger[_0x4a66('0xb')](_0x4a66('0x3c'));return BPromise[_0x4a66('0x37')]({'id':_0x3f9add[_0x4a66('0x34')]['id'][_0x4a66('0x35')],'name':_0x3f9add[_0x4a66('0x34')][_0x4a66('0xd')][_0x4a66('0x35')],'phone':_0x3f9add[_0x4a66('0x34')][_0x4a66('0x3b')][_0x4a66('0x35')]});}}else{logger[_0x4a66('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0x4a66('0x23'),'response_type':_0x4a66('0x23'),'rest_data':JSON[_0x4a66('0x24')]({'session':_0x1a8fbd['id'],'module_name':_0x4a66('0x1b'),'name_value_list':[{'name':_0x4a66('0x3d'),'value':_0xee22c4!==_0x4a66('0x3e')?_0xee22c4:util[_0x4a66('0x3a')](_0x4a66('0x3f'),_0x378cdf)},{'name':_0x4a66('0x3b'),'value':_0x378cdf}]})}})[_0x4a66('0x31')](function(_0x9178f6){logger[_0x4a66('0xb')](_0x4a66('0x40'));return BPromise[_0x4a66('0x37')]({'id':_0x9178f6['id'],'name':_0x9178f6[_0x4a66('0x33')]['first_name'][_0x4a66('0x35')],'phone':_0x9178f6[_0x4a66('0x33')]['phone_home'][_0x4a66('0x35')]});});}});}function request(_0x1ecd9e){logger[_0x4a66('0x41')]('[HTTP]',JSON[_0x4a66('0x24')](_0x1ecd9e));return rp(_[_0x4a66('0x42')](def,_0x1ecd9e));}function getTags(_0x1353ba,_0x54e5a6){var _0x3bd9f7=[];if(_0x1353ba&&_0x1353ba[_0x4a66('0x1e')]>0x0){_0x3bd9f7=_['map'](_0x1353ba,_0x54e5a6);}return _0x3bd9f7;}function getCustomFields(_0x452bf0,_0x481cd2){var _0xb1c357=[];var _0x51be62={'custom_fields':[]};if(_0x452bf0[_0x4a66('0x1e')]>0x0){_[_0x4a66('0x1f')](_0x452bf0,function(_0x2689d5){if(_0x2689d5[_0x4a66('0x43')]===_0x4a66('0x44')&&_0x2689d5['nameField']&&!_0x2689d5['customField']){_0x51be62[_0x2689d5[_0x4a66('0x45')][_0x4a66('0x46')]()]=_0x2689d5[_0x4a66('0x47')][_0x4a66('0x28')]();}else if(_0x2689d5[_0x4a66('0x43')]==='string'&&_0x2689d5['idField']&&_0x2689d5[_0x4a66('0x48')]){_0x51be62[_0x4a66('0x49')][_0x4a66('0x20')]({'id':_0x2689d5['idField'],'value':_0x2689d5[_0x4a66('0x47')]['toString']()});}else if(_0x2689d5['type']===_0x4a66('0x4a')&&_0x2689d5[_0x4a66('0x22')]&&_0x2689d5['idField']&&_0x2689d5[_0x4a66('0x48')]){_0x481cd2[_0x2689d5[_0x4a66('0x22')]]&&_0x51be62['custom_fields'][_0x4a66('0x20')]({'id':_0x2689d5[_0x4a66('0x21')],'value':_0x481cd2[_0x2689d5[_0x4a66('0x22')]][_0x4a66('0x28')]()});}else if(_0x2689d5[_0x4a66('0x43')]==='customVariable'&&_0x2689d5[_0x4a66('0x4b')]&&_0x2689d5[_0x4a66('0x4b')][_0x4a66('0xd')]&&_0x2689d5[_0x4a66('0x21')]&&_0x2689d5[_0x4a66('0x48')]){_0x481cd2[_0x2689d5[_0x4a66('0x4b')][_0x4a66('0xd')][_0x4a66('0x46')]()]&&_0x51be62[_0x4a66('0x49')][_0x4a66('0x20')]({'id':_0x2689d5[_0x4a66('0x21')],'value':_0x481cd2[_0x2689d5[_0x4a66('0x4b')][_0x4a66('0xd')]['toLowerCase']()]['toString']()});}});}return _0x51be62;}function getConnection(_0x1a7abe){return request({'method':_0x4a66('0x4c'),'form':{'method':_0x4a66('0x4d'),'input_type':_0x4a66('0x23'),'response_type':_0x4a66('0x23'),'rest_data':JSON[_0x4a66('0x24')]({'user_auth':{'user_name':_0x1a7abe['username'],'password':_0x1a7abe[_0x4a66('0x4e')],'encryption':_0x4a66('0x4f')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x4a66('0x31')](function(_0x8589b4){var _0x5ecb9d=_0x8589b4;if(_0x5ecb9d['id']){def[_0x4a66('0x50')]=_0x5ecb9d['id'];return BPromise['resolve'](_0x5ecb9d);}else{throw new Error(util[_0x4a66('0x3a')]('Account\x20%d\x20is\x20not\x20valid',_0x1a7abe['id']));}});}function setRelationship(_0x569d21,_0x150ffa,_0x7f9ab1,_0x4c83b8){return request({'form':{'method':'set_relationship','input_type':_0x4a66('0x23'),'response_type':_0x4a66('0x23'),'rest_data':JSON['stringify']({'session':_0x569d21['id'],'module_name':_0x4a66('0x25'),'module_id':_0x7f9ab1['id'],'link_field_name':_0x4c83b8,'related_ids':[_0x150ffa['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x4a66('0x51')]=function(_0x2816a9,_0x29b1ab,_0x1b9f2b,_0x149b13,_0x5c2768,_0x197fde){var _0xec48df,_0x2e010e,_0x40c3e7,_0x82ebe0;_0x197fde['remoteUri']=intUtil[_0x4a66('0x52')](_0x197fde[_0x4a66('0x53')]);_0x197fde[_0x4a66('0x54')]=intUtil[_0x4a66('0x52')](_0x197fde['serverUrl']);def[_0x4a66('0x55')]=util[_0x4a66('0x3a')](_0x4a66('0x56'),_0x197fde[_0x4a66('0x53')]);if(_0x5c2768&&_0x5c2768['monitor_format']){logger[_0x4a66('0xb')](_0x4a66('0x57'),_0x4a66('0x58'));_0x29b1ab[_0x4a66('0x59')]=util[_0x4a66('0x3a')](_0x4a66('0x5a'),_0x197fde[_0x4a66('0x54')],_0x29b1ab[_0x4a66('0x5b')],md5(_0x29b1ab['uniqueid']));}else{_0x29b1ab[_0x4a66('0x59')]='';}return getConnection(_0x197fde)[_0x4a66('0x31')](function(_0x35cb93){_0x82ebe0=_0x35cb93;return getUser(_0x197fde,_0x149b13[_0x4a66('0xd')],_0x82ebe0);})[_0x4a66('0x31')](function(_0x2fb369){_0xec48df=_0x2fb369;logger['info'](_0x4a66('0x5c'),_0xec48df['id']);return getEndUser(_0x197fde,_0x29b1ab[_0x4a66('0x5d')],_0x29b1ab['calleridnum'],_0x82ebe0);})['then'](function(_0x47fba7){_0x2e010e=_0x47fba7;logger[_0x4a66('0xb')](_0x4a66('0x5e'),_0x2e010e['id']);return getTicket(_0x197fde,_0xec48df,_0x2e010e,_0x1b9f2b,_0x29b1ab,_0x1b9f2b[_0x4a66('0x5f')],_0x82ebe0,_0x4a66('0x60'));})[_0x4a66('0x31')](function(_0x5dd372){_0x40c3e7=_0x5dd372;logger[_0x4a66('0xb')](_0x4a66('0x61'));logger['info'](_0x4a66('0x62'),_0x40c3e7['id']);return setRelationship(_0x82ebe0,_0xec48df,_0x40c3e7,_0x4a66('0x63'));})[_0x4a66('0x31')](function(){return setRelationship(_0x82ebe0,_0x2e010e,_0x40c3e7,_0x4a66('0x64'));})[_0x4a66('0x31')](function(){return getServerInfo(_0x82ebe0);})['then'](function(_0xc01192){var _0xf1aad=parseInt(_0xc01192[_0x4a66('0x65')][_0x4a66('0x66')](0x0));var _0x49e248=util['format'](_0x4a66('0x67'),_0x197fde[_0x4a66('0x53')],_0x40c3e7['id']);if(_0xf1aad>0x6){_0x49e248=util[_0x4a66('0x3a')](_0x4a66('0x68'),_0x197fde[_0x4a66('0x53')],_0x40c3e7['id']);}logger['info']('[QUEUE]',_0x4a66('0x69'));emit(util[_0x4a66('0x3a')](_0x4a66('0x6a'),_0x149b13[_0x4a66('0xd')]),'trigger:browser:url',{'uri':_0x49e248});})[_0x4a66('0x6b')](function(_0x35de1c){logger[_0x4a66('0x6c')](_0x4a66('0x57'),JSON[_0x4a66('0x24')](_0x35de1c));});};exports[_0x4a66('0x6d')]=function(_0x2b9860,_0x1c256a,_0x190541,_0x17ce9d,_0x7fec46,_0x11b1fd,_0x2c8c0a){var _0x1b2571,_0x204778,_0x169123,_0x43eb7a;_0x11b1fd[_0x4a66('0x53')]=intUtil[_0x4a66('0x52')](_0x11b1fd['remoteUri']);_0x11b1fd[_0x4a66('0x54')]=intUtil[_0x4a66('0x52')](_0x11b1fd['serverUrl']);def[_0x4a66('0x55')]=util[_0x4a66('0x3a')](_0x4a66('0x56'),_0x11b1fd[_0x4a66('0x53')]);if(_0x2c8c0a&&_0x2c8c0a[_0x4a66('0x6e')]&&_0x2c8c0a[_0x4a66('0x6e')]!=='none'){logger[_0x4a66('0xb')](_0x4a66('0x6f'),_0x4a66('0x58'));_0x1c256a[_0x4a66('0x59')]=util['format'](_0x4a66('0x5a'),_0x11b1fd['serverUrl'],_0x1c256a['uniqueid'],md5(_0x1c256a[_0x4a66('0x5b')]));}return getConnection(_0x11b1fd)[_0x4a66('0x31')](function(_0x4c8a99){_0x43eb7a=_0x4c8a99;return getUser(_0x11b1fd,_0x17ce9d[_0x4a66('0xd')],_0x43eb7a);})[_0x4a66('0x31')](function(_0x4902d9){_0x1b2571=_0x4902d9;logger[_0x4a66('0xb')](_0x4a66('0x5c'),_0x1b2571['id']);return getEndUser(_0x11b1fd,_0x1c256a[_0x4a66('0x70')],_0x1c256a['destcalleridnum'],_0x43eb7a);})['then'](function(_0xb28e5f){_0x204778=_0xb28e5f;logger[_0x4a66('0xb')]('The\x20Enduser\x20ID\x20is:',_0x204778['id']);return getTicket(_0x11b1fd,_0x1b2571,_0x204778,_0x190541,_0x1c256a,_0x190541['Fields'],_0x43eb7a,_0x4a66('0x71'));})[_0x4a66('0x31')](function(_0x13e896){_0x169123=_0x13e896;logger[_0x4a66('0xb')](_0x4a66('0x61'));logger[_0x4a66('0xb')](_0x4a66('0x62'),_0x169123['id']);return setRelationship(_0x43eb7a,_0x1b2571,_0x169123,_0x4a66('0x63'));})['then'](function(){return setRelationship(_0x43eb7a,_0x204778,_0x169123,_0x4a66('0x64'));})[_0x4a66('0x31')](function(){return getServerInfo(_0x43eb7a);})['then'](function(_0x51a208){var _0x4a5e19=parseInt(_0x51a208[_0x4a66('0x65')][_0x4a66('0x66')](0x0));var _0x2f4a3a=util[_0x4a66('0x3a')](_0x4a66('0x67'),_0x11b1fd[_0x4a66('0x53')],_0x169123['id']);if(_0x4a5e19>0x6){_0x2f4a3a=util[_0x4a66('0x3a')](_0x4a66('0x68'),_0x11b1fd[_0x4a66('0x53')],_0x169123['id']);}logger[_0x4a66('0xb')]('[OUTBOUND]',_0x4a66('0x69'));emit(util[_0x4a66('0x3a')]('user:%s',_0x17ce9d['name']),'trigger:browser:url',{'uri':_0x2f4a3a});})['catch'](function(_0x2cb695){logger[_0x4a66('0x6c')]('[OUTBOUND]',JSON[_0x4a66('0x24')](_0x2cb695));});};exports['unmanaged']=function(_0xd135d0,_0x4ae6e3,_0x55c0f1,_0x333b13,_0x4916af,_0x940395){var _0x4c3d79,_0x17408a,_0x23110c,_0x58337d;_0x940395[_0x4a66('0x53')]=intUtil['stripTrailingSlash'](_0x940395['remoteUri']);_0x940395[_0x4a66('0x54')]=intUtil[_0x4a66('0x52')](_0x940395[_0x4a66('0x54')]);def['uri']=util[_0x4a66('0x3a')](_0x4a66('0x56'),_0x940395[_0x4a66('0x53')]);if(_0x4916af&&_0x4916af[_0x4a66('0x72')]){logger['info']('['+_0x4ae6e3['lastevent'][_0x4a66('0x73')]()+']',_0x4a66('0x58'));_0x4ae6e3['recordingURL']=util[_0x4a66('0x3a')](_0x4a66('0x5a'),_0x940395[_0x4a66('0x54')],_0x4ae6e3[_0x4a66('0x5b')],md5(_0x4ae6e3[_0x4a66('0x5b')]));}else{_0x4ae6e3[_0x4a66('0x59')]='';}return getConnection(_0x940395)[_0x4a66('0x31')](function(_0x353e24){_0x58337d=_0x353e24;if(!_[_0x4a66('0x2b')](_0x333b13)){return getUser(_0x940395,_0x333b13[_0x4a66('0xd')],_0x58337d);}else{return getUser(_0x940395,null,_0x58337d);}})[_0x4a66('0x31')](function(_0x4d47c3){_0x4c3d79=_0x4d47c3;logger['info'](_0x4a66('0x5c'),_0x4c3d79['id']);return getEndUser(_0x940395,_0x4ae6e3[_0x4a66('0x5d')],_0x4ae6e3['calleridnum'],_0x58337d);})[_0x4a66('0x31')](function(_0x4293ec){_0x17408a=_0x4293ec;logger[_0x4a66('0xb')](_0x4a66('0x5e'),_0x17408a['id']);return getTicket(_0x940395,_0x4c3d79,_0x17408a,_0x55c0f1,_0x4ae6e3,_0x55c0f1[_0x4a66('0x5f')],_0x58337d,'Inbound');})[_0x4a66('0x31')](function(_0x6a7a8c){_0x23110c=_0x6a7a8c;logger[_0x4a66('0xb')](_0x4a66('0x61'));logger[_0x4a66('0xb')](_0x4a66('0x62'),_0x23110c['id']);return setRelationship(_0x58337d,_0x4c3d79,_0x23110c,_0x4a66('0x63'));})['then'](function(){return setRelationship(_0x58337d,_0x17408a,_0x23110c,_0x4a66('0x64'));})['then'](function(){return getServerInfo(_0x58337d);})[_0x4a66('0x6b')](function(_0x166a18){logger[_0x4a66('0x6c')]('['+_0x4ae6e3['lastevent'][_0x4a66('0x73')]()+']',JSON[_0x4a66('0x24')](_0x166a18));});}; \ No newline at end of file +var _0xe8cd=['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','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20Enduser\x20ID\x20is:','Outbound','catch','unmanaged','lastevent','toUpperCase','Ticket\x20created!','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','emit','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','Contacts','parent_name','direction','forEach','variableName','idField','JSON','stringify','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','format','user_name','then','entry_list','length','find','name_value_list','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','toLowerCase','content','customField','custom_fields','push','variable','Variable','login','username','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts'];(function(_0x5ca57f,_0xeb3f8){var _0x251392=function(_0xc5d89f){while(--_0xc5d89f){_0x5ca57f['push'](_0x5ca57f['shift']());}};_0x251392(++_0xeb3f8);}(_0xe8cd,0x106));var _0xde8c=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xe8cd[_0x3054be];return _0x3df150;};'use strict';var _=require('lodash');var rp=require(_0xde8c('0x0'));var BPromise=require(_0xde8c('0x1'));var md5=require(_0xde8c('0x2'));var util=require(_0xde8c('0x3'));var Redis=require(_0xde8c('0x4'));var intUtil=require(_0xde8c('0x5'));var config=require(_0xde8c('0x6'));var logger=require(_0xde8c('0x7'))(_0xde8c('0x8'));config[_0xde8c('0x9')]=_[_0xde8c('0xa')](config[_0xde8c('0x9')],{'host':_0xde8c('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':_0xde8c('0xc'),'json':!![]};function emit(_0x43c135,_0x4e3ad3,_0x22e8d5){io['to'](_0x43c135)[_0xde8c('0xd')](_0x4e3ad3,_0x22e8d5);}function getTicket(_0x9f31eb,_0x1f0a81,_0x3cc5a9,_0x30e3f1,_0x2669c8,_0x59f073,_0x525f38,_0x17687a){logger['info'](_0xde8c('0xe'));var _0x547cc3=new Date();var _0xcbaf35=[{'name':_0xde8c('0xf'),'value':intUtil['getString'](_0x30e3f1[_0xde8c('0x10')],_0x2669c8,'\x20')},{'name':_0xde8c('0x11'),'value':_0x1f0a81['id']},{'name':_0xde8c('0x12'),'value':_0x1f0a81['id']},{'name':'description','value':intUtil['getString'](_0x30e3f1[_0xde8c('0x13')],_0x2669c8,'\x0a')},{'name':_0xde8c('0x14'),'value':_0x547cc3[_0xde8c('0x15')]()[_0xde8c('0x16')](0x0,0x13)[_0xde8c('0x17')]('T','\x20')},{'name':_0xde8c('0x18'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xde8c('0x19'),'value':_0x3cc5a9['id']},{'name':'parent_type','value':_0xde8c('0x1a')},{'name':_0xde8c('0x1b'),'value':_0x3cc5a9[_0xde8c('0xf')]},{'name':_0xde8c('0x1c'),'value':_0x17687a}];if(_0x59f073['length']){_[_0xde8c('0x1d')](_0x59f073,function(_0x541e55){if(_0x2669c8[_0x541e55[_0xde8c('0x1e')]]){_0xcbaf35['push']({'name':_0x541e55[_0xde8c('0x1f')],'value':_0x2669c8[_0x541e55['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':_0xde8c('0x20'),'response_type':'JSON','rest_data':JSON[_0xde8c('0x21')]({'session':_0x525f38['id'],'module_name':'Calls','name_value_list':_0xcbaf35})}});}function getAuth(_0x9a3bf7){return util['format'](_0xde8c('0x22'),new Buffer(_0x9a3bf7[_0xde8c('0x23')]+':X')[_0xde8c('0x24')](_0xde8c('0x25')));}function getServerInfo(_0x4e3bd1){return request({'form':{'method':_0xde8c('0x26'),'input_type':_0xde8c('0x20'),'response_type':_0xde8c('0x20'),'rest_data':JSON['stringify']({'session':_0x4e3bd1['id']})}});}function getUser(_0x54bc3e,_0x1838d3,_0x5e89d2){if(!_[_0xde8c('0x27')](_0x1838d3)){logger[_0xde8c('0x28')](_0xde8c('0x29'),_0x1838d3);return request({'form':{'method':_0xde8c('0x2a'),'input_type':_0xde8c('0x20'),'response_type':_0xde8c('0x20'),'rest_data':JSON[_0xde8c('0x21')]({'session':_0x5e89d2['id'],'module_name':'Employees','query':util[_0xde8c('0x2b')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x1838d3),'order_by':'','offset':'0','select_fields':['id',_0xde8c('0xf'),_0xde8c('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xde8c('0x2d')](function(_0x2d335e){if(_0x2d335e[_0xde8c('0x2e')][_0xde8c('0x2f')]){var _0x6a19ed=_[_0xde8c('0x30')](_0x2d335e['entry_list'],function(_0x2e54c7){return _0x2e54c7[_0xde8c('0x31')]['user_name'][_0xde8c('0x32')]===_0x1838d3;});if(_0x6a19ed){logger[_0xde8c('0x28')]('Agent\x20found!');return BPromise['resolve']({'id':_0x6a19ed[_0xde8c('0x31')]['id'][_0xde8c('0x32')],'name':_0x6a19ed[_0xde8c('0x31')]['name'][_0xde8c('0x32')]});}}logger['info'](_0xde8c('0x33'));return BPromise[_0xde8c('0x34')]({'id':_0x5e89d2[_0xde8c('0x31')][_0xde8c('0x35')][_0xde8c('0x32')],'name':_0x5e89d2[_0xde8c('0x31')]['user_name']['value']});});}else{logger[_0xde8c('0x28')](_0xde8c('0x36'));return BPromise[_0xde8c('0x34')]({'id':_0x5e89d2[_0xde8c('0x31')]['user_id']['value'],'name':_0x5e89d2['name_value_list'][_0xde8c('0x2c')]['value']});}}function getEndUser(_0x42b35f,_0x29641a,_0x5a935f,_0x603ab){logger['info'](_0xde8c('0x37'),_0x5a935f);return request({'form':{'method':_0xde8c('0x2a'),'input_type':_0xde8c('0x20'),'response_type':_0xde8c('0x20'),'rest_data':JSON[_0xde8c('0x21')]({'session':_0x603ab['id'],'module_name':_0xde8c('0x1a'),'query':util[_0xde8c('0x2b')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x5a935f),'order_by':'','offset':'0','select_fields':['id','name',_0xde8c('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xde8c('0x2d')](function(_0x1ac7d9){if(_0x1ac7d9[_0xde8c('0x2e')][_0xde8c('0x2f')]){var _0x3462bc=_['find'](_0x1ac7d9[_0xde8c('0x2e')],function(_0x56edbc){return _0x56edbc['name_value_list'][_0xde8c('0x38')]['value']===_0x5a935f;});if(_0x3462bc){logger['info'](_0xde8c('0x39'));return BPromise[_0xde8c('0x34')]({'id':_0x3462bc[_0xde8c('0x31')]['id'][_0xde8c('0x32')],'name':_0x3462bc[_0xde8c('0x31')][_0xde8c('0xf')][_0xde8c('0x32')],'phone':_0x3462bc[_0xde8c('0x31')][_0xde8c('0x38')][_0xde8c('0x32')]});}}else{logger['info'](_0xde8c('0x3a'));return request({'form':{'method':_0xde8c('0x3b'),'input_type':_0xde8c('0x20'),'response_type':'JSON','rest_data':JSON[_0xde8c('0x21')]({'session':_0x603ab['id'],'module_name':'Contacts','name_value_list':[{'name':_0xde8c('0x3c'),'value':_0x29641a!==''?_0x29641a:util[_0xde8c('0x2b')](_0xde8c('0x3d'),_0x5a935f)},{'name':'phone_home','value':_0x5a935f}]})}})[_0xde8c('0x2d')](function(_0x1388c3){logger[_0xde8c('0x28')](_0xde8c('0x3e'));return BPromise['resolve']({'id':_0x1388c3['id'],'name':_0x1388c3['entry_list'][_0xde8c('0x3c')][_0xde8c('0x32')],'phone':_0x1388c3[_0xde8c('0x2e')][_0xde8c('0x38')]['value']});});}});}function request(_0x599ca3){logger[_0xde8c('0x3f')](_0xde8c('0x40'),JSON[_0xde8c('0x21')](_0x599ca3));return rp(_[_0xde8c('0x41')](def,_0x599ca3));}function getTags(_0x4b7dd2,_0x5e07aa){var _0x512c79=[];if(_0x4b7dd2&&_0x4b7dd2[_0xde8c('0x2f')]>0x0){_0x512c79=_[_0xde8c('0x42')](_0x4b7dd2,_0x5e07aa);}return _0x512c79;}function getCustomFields(_0x12bcbd,_0x144535){var _0x47bb6a=[];var _0x2accf5={'custom_fields':[]};if(_0x12bcbd[_0xde8c('0x2f')]>0x0){_[_0xde8c('0x1d')](_0x12bcbd,function(_0x39ddbe){if(_0x39ddbe[_0xde8c('0x43')]===_0xde8c('0x44')&&_0x39ddbe[_0xde8c('0x45')]&&!_0x39ddbe['customField']){_0x2accf5[_0x39ddbe[_0xde8c('0x45')][_0xde8c('0x46')]()]=_0x39ddbe[_0xde8c('0x47')]['toString']();}else if(_0x39ddbe[_0xde8c('0x43')]===_0xde8c('0x44')&&_0x39ddbe['idField']&&_0x39ddbe[_0xde8c('0x48')]){_0x2accf5[_0xde8c('0x49')][_0xde8c('0x4a')]({'id':_0x39ddbe['idField'],'value':_0x39ddbe[_0xde8c('0x47')]['toString']()});}else if(_0x39ddbe['type']===_0xde8c('0x4b')&&_0x39ddbe['variableName']&&_0x39ddbe[_0xde8c('0x1f')]&&_0x39ddbe[_0xde8c('0x48')]){_0x144535[_0x39ddbe[_0xde8c('0x1e')]]&&_0x2accf5[_0xde8c('0x49')][_0xde8c('0x4a')]({'id':_0x39ddbe[_0xde8c('0x1f')],'value':_0x144535[_0x39ddbe['variableName']][_0xde8c('0x24')]()});}else if(_0x39ddbe['type']==='customVariable'&&_0x39ddbe['Variable']&&_0x39ddbe[_0xde8c('0x4c')][_0xde8c('0xf')]&&_0x39ddbe['idField']&&_0x39ddbe[_0xde8c('0x48')]){_0x144535[_0x39ddbe[_0xde8c('0x4c')][_0xde8c('0xf')][_0xde8c('0x46')]()]&&_0x2accf5[_0xde8c('0x49')][_0xde8c('0x4a')]({'id':_0x39ddbe[_0xde8c('0x1f')],'value':_0x144535[_0x39ddbe[_0xde8c('0x4c')][_0xde8c('0xf')]['toLowerCase']()]['toString']()});}});}return _0x2accf5;}function getConnection(_0x2e2fe9){return request({'method':_0xde8c('0xc'),'form':{'method':_0xde8c('0x4d'),'input_type':_0xde8c('0x20'),'response_type':'JSON','rest_data':JSON[_0xde8c('0x21')]({'user_auth':{'user_name':_0x2e2fe9[_0xde8c('0x4e')],'password':_0x2e2fe9['password'],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})['then'](function(_0x23f328){var _0x1de9da=_0x23f328;if(_0x1de9da['id']){def[_0xde8c('0x4f')]=_0x1de9da['id'];return BPromise['resolve'](_0x1de9da);}else{throw new Error(util[_0xde8c('0x2b')](_0xde8c('0x50'),_0x2e2fe9['id']));}});}function setRelationship(_0x4869cf,_0x59525b,_0x304b8d,_0x3f49e2){return request({'form':{'method':_0xde8c('0x51'),'input_type':'JSON','response_type':_0xde8c('0x20'),'rest_data':JSON[_0xde8c('0x21')]({'session':_0x4869cf['id'],'module_name':'Calls','module_id':_0x304b8d['id'],'link_field_name':_0x3f49e2,'related_ids':[_0x59525b['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xde8c('0x52')]=function(_0x1f23f2,_0x370d78,_0x27400b,_0x18fc3d,_0x19d466,_0x518624){var _0x198c2a,_0x1fbcf0,_0x3c489f,_0x2a58a7;_0x518624[_0xde8c('0x53')]=intUtil[_0xde8c('0x54')](_0x518624[_0xde8c('0x53')]);_0x518624[_0xde8c('0x55')]=intUtil[_0xde8c('0x54')](_0x518624[_0xde8c('0x55')]);def[_0xde8c('0x56')]=util[_0xde8c('0x2b')](_0xde8c('0x57'),_0x518624['remoteUri']);if(_0x19d466&&_0x19d466[_0xde8c('0x58')]){logger['info'](_0xde8c('0x59'),'Recording\x20is\x20enabled!');_0x370d78['recordingURL']=util[_0xde8c('0x2b')](_0xde8c('0x5a'),_0x518624[_0xde8c('0x55')],_0x370d78[_0xde8c('0x5b')],md5(_0x370d78[_0xde8c('0x5b')]));}else{_0x370d78[_0xde8c('0x5c')]='';}return getConnection(_0x518624)['then'](function(_0x212939){_0x2a58a7=_0x212939;return getUser(_0x518624,_0x18fc3d[_0xde8c('0xf')],_0x2a58a7);})[_0xde8c('0x2d')](function(_0x57b11a){_0x198c2a=_0x57b11a;logger[_0xde8c('0x28')](_0xde8c('0x5d'),_0x198c2a['id']);return getEndUser(_0x518624,_0x370d78[_0xde8c('0x5e')],_0x370d78[_0xde8c('0x5f')],_0x2a58a7);})[_0xde8c('0x2d')](function(_0x3eede6){_0x1fbcf0=_0x3eede6;logger['info']('The\x20Enduser\x20ID\x20is:',_0x1fbcf0['id']);return getTicket(_0x518624,_0x198c2a,_0x1fbcf0,_0x27400b,_0x370d78,_0x27400b[_0xde8c('0x60')],_0x2a58a7,_0xde8c('0x61'));})[_0xde8c('0x2d')](function(_0x54c69f){_0x3c489f=_0x54c69f;logger['info']('Ticket\x20created!');logger['info'](_0xde8c('0x62'),_0x3c489f['id']);return setRelationship(_0x2a58a7,_0x198c2a,_0x3c489f,_0xde8c('0x63'));})[_0xde8c('0x2d')](function(){return setRelationship(_0x2a58a7,_0x1fbcf0,_0x3c489f,_0xde8c('0x64'));})[_0xde8c('0x2d')](function(){return getServerInfo(_0x2a58a7);})['then'](function(_0x1cc86a){var _0x5b3f6c=parseInt(_0x1cc86a[_0xde8c('0x65')][_0xde8c('0x66')](0x0));var _0x184fa0=util[_0xde8c('0x2b')](_0xde8c('0x67'),_0x518624[_0xde8c('0x53')],_0x3c489f['id']);if(_0x5b3f6c>0x6){_0x184fa0=util['format'](_0xde8c('0x68'),_0x518624[_0xde8c('0x53')],_0x3c489f['id']);}logger[_0xde8c('0x28')](_0xde8c('0x59'),_0xde8c('0x69'));emit(util[_0xde8c('0x2b')](_0xde8c('0x6a'),_0x18fc3d[_0xde8c('0xf')]),_0xde8c('0x6b'),{'uri':_0x184fa0});})['catch'](function(_0x55c97a){logger[_0xde8c('0x6c')](_0xde8c('0x59'),JSON[_0xde8c('0x21')](_0x55c97a));});};exports[_0xde8c('0x6d')]=function(_0x37e875,_0x3d2293,_0x3a5478,_0x37d14e,_0x194f25,_0x2648b7,_0x5899e1){var _0x4d1737,_0x196f3b,_0x36920c,_0x503f3c;_0x2648b7[_0xde8c('0x53')]=intUtil['stripTrailingSlash'](_0x2648b7[_0xde8c('0x53')]);_0x2648b7[_0xde8c('0x55')]=intUtil[_0xde8c('0x54')](_0x2648b7[_0xde8c('0x55')]);def['uri']=util[_0xde8c('0x2b')](_0xde8c('0x57'),_0x2648b7[_0xde8c('0x53')]);if(_0x5899e1&&_0x5899e1[_0xde8c('0x6e')]&&_0x5899e1['recordingFormat']!==_0xde8c('0x6f')){logger[_0xde8c('0x28')](_0xde8c('0x70'),_0xde8c('0x71'));_0x3d2293[_0xde8c('0x5c')]=util[_0xde8c('0x2b')](_0xde8c('0x5a'),_0x2648b7[_0xde8c('0x55')],_0x3d2293[_0xde8c('0x5b')],md5(_0x3d2293['uniqueid']));}return getConnection(_0x2648b7)['then'](function(_0x35c252){_0x503f3c=_0x35c252;return getUser(_0x2648b7,_0x37d14e[_0xde8c('0xf')],_0x503f3c);})[_0xde8c('0x2d')](function(_0x44616e){_0x4d1737=_0x44616e;logger[_0xde8c('0x28')](_0xde8c('0x5d'),_0x4d1737['id']);return getEndUser(_0x2648b7,_0x3d2293['destcalleridname'],_0x3d2293['destcalleridnum'],_0x503f3c);})[_0xde8c('0x2d')](function(_0x2e2f38){_0x196f3b=_0x2e2f38;logger[_0xde8c('0x28')](_0xde8c('0x72'),_0x196f3b['id']);return getTicket(_0x2648b7,_0x4d1737,_0x196f3b,_0x3a5478,_0x3d2293,_0x3a5478[_0xde8c('0x60')],_0x503f3c,_0xde8c('0x73'));})[_0xde8c('0x2d')](function(_0x4eafa2){_0x36920c=_0x4eafa2;logger[_0xde8c('0x28')]('Ticket\x20created!');logger[_0xde8c('0x28')]('The\x20Ticket\x20ID\x20is:',_0x36920c['id']);return setRelationship(_0x503f3c,_0x4d1737,_0x36920c,_0xde8c('0x63'));})[_0xde8c('0x2d')](function(){return setRelationship(_0x503f3c,_0x196f3b,_0x36920c,_0xde8c('0x64'));})['then'](function(){return getServerInfo(_0x503f3c);})['then'](function(_0x1bdfa0){var _0x58afa3=parseInt(_0x1bdfa0[_0xde8c('0x65')]['charAt'](0x0));var _0x2708af=util[_0xde8c('0x2b')](_0xde8c('0x67'),_0x2648b7[_0xde8c('0x53')],_0x36920c['id']);if(_0x58afa3>0x6){_0x2708af=util[_0xde8c('0x2b')](_0xde8c('0x68'),_0x2648b7[_0xde8c('0x53')],_0x36920c['id']);}logger[_0xde8c('0x28')](_0xde8c('0x70'),_0xde8c('0x69'));emit(util[_0xde8c('0x2b')]('user:%s',_0x37d14e['name']),_0xde8c('0x6b'),{'uri':_0x2708af});})[_0xde8c('0x74')](function(_0x4dedb2){logger[_0xde8c('0x6c')](_0xde8c('0x70'),JSON['stringify'](_0x4dedb2));});};exports[_0xde8c('0x75')]=function(_0x25aa41,_0x20fb49,_0x18615e,_0x337942,_0x35a53d,_0x29a6c7){var _0x3882be,_0x13dad4,_0x3f678c,_0x13ac98;_0x29a6c7[_0xde8c('0x53')]=intUtil['stripTrailingSlash'](_0x29a6c7[_0xde8c('0x53')]);_0x29a6c7[_0xde8c('0x55')]=intUtil[_0xde8c('0x54')](_0x29a6c7[_0xde8c('0x55')]);def[_0xde8c('0x56')]=util[_0xde8c('0x2b')](_0xde8c('0x57'),_0x29a6c7[_0xde8c('0x53')]);if(_0x35a53d&&_0x35a53d[_0xde8c('0x58')]){logger['info']('['+_0x20fb49[_0xde8c('0x76')][_0xde8c('0x77')]()+']','Recording\x20is\x20enabled!');_0x20fb49[_0xde8c('0x5c')]=util[_0xde8c('0x2b')](_0xde8c('0x5a'),_0x29a6c7['serverUrl'],_0x20fb49[_0xde8c('0x5b')],md5(_0x20fb49[_0xde8c('0x5b')]));}else{_0x20fb49['recordingURL']='';}return getConnection(_0x29a6c7)[_0xde8c('0x2d')](function(_0x247c54){_0x13ac98=_0x247c54;if(!_[_0xde8c('0x27')](_0x337942)){return getUser(_0x29a6c7,_0x337942[_0xde8c('0xf')],_0x13ac98);}else{return getUser(_0x29a6c7,null,_0x13ac98);}})[_0xde8c('0x2d')](function(_0x4cc62b){_0x3882be=_0x4cc62b;logger[_0xde8c('0x28')](_0xde8c('0x5d'),_0x3882be['id']);return getEndUser(_0x29a6c7,_0x20fb49['calleridname'],_0x20fb49[_0xde8c('0x5f')],_0x13ac98);})[_0xde8c('0x2d')](function(_0x58ea0e){_0x13dad4=_0x58ea0e;logger['info'](_0xde8c('0x72'),_0x13dad4['id']);return getTicket(_0x29a6c7,_0x3882be,_0x13dad4,_0x18615e,_0x20fb49,_0x18615e[_0xde8c('0x60')],_0x13ac98,_0xde8c('0x61'));})[_0xde8c('0x2d')](function(_0x1fe28d){_0x3f678c=_0x1fe28d;logger['info'](_0xde8c('0x78'));logger[_0xde8c('0x28')](_0xde8c('0x62'),_0x3f678c['id']);return setRelationship(_0x13ac98,_0x3882be,_0x3f678c,'users');})[_0xde8c('0x2d')](function(){return setRelationship(_0x13ac98,_0x13dad4,_0x3f678c,_0xde8c('0x64'));})[_0xde8c('0x2d')](function(){return getServerInfo(_0x13ac98);})[_0xde8c('0x74')](function(_0xb4649f){logger['error']('['+_0x20fb49[_0xde8c('0x76')][_0xde8c('0x77')]()+']',JSON[_0xde8c('0x21')](_0xb4649f));});}; \ 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 03c95e1..e8597da 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 _0xb651=['sortBy','type','string','push','content','variable','variableName','toString','Variable','name','toLowerCase','keyType','format','%s:\x20%s','key','keyContent','customVariable','stripTrailingSlash','lastIndexOf','isNil','test','lodash','util','getString','length'];(function(_0x309d93,_0x157662){var _0x2dd61d=function(_0x25ff34){while(--_0x25ff34){_0x309d93['push'](_0x309d93['shift']());}};_0x2dd61d(++_0x157662);}(_0xb651,0x10f));var _0x1b65=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xb651[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x1b65('0x0'));var util=require(_0x1b65('0x1'));exports[_0x1b65('0x2')]=function(_0x578271,_0x4fc995,_0x33008e){var _0x1e478e=[];if(_0x578271[_0x1b65('0x3')]>0x0){var _0x3d693e=_[_0x1b65('0x4')](_0x578271,['id']);for(var _0x237b0a=0x0;_0x237b0a<_0x3d693e[_0x1b65('0x3')];_0x237b0a++){var _0x34e2c9=_0x3d693e[_0x237b0a];if(_0x34e2c9[_0x1b65('0x5')]===_0x1b65('0x6')){_0x1e478e[_0x1b65('0x7')](_0x34e2c9[_0x1b65('0x8')]);}else if(_0x34e2c9[_0x1b65('0x5')]===_0x1b65('0x9')&&_0x34e2c9[_0x1b65('0xa')]){_0x4fc995[_0x34e2c9[_0x1b65('0xa')]]&&_0x1e478e[_0x1b65('0x7')](_0x4fc995[_0x34e2c9[_0x1b65('0xa')]][_0x1b65('0xb')]());}else if(_0x34e2c9[_0x1b65('0x5')]==='customVariable'&&_0x34e2c9[_0x1b65('0xc')]&&_0x34e2c9[_0x1b65('0xc')][_0x1b65('0xd')]){_0x4fc995[_0x34e2c9[_0x1b65('0xc')][_0x1b65('0xd')][_0x1b65('0xe')]()]&&_0x1e478e[_0x1b65('0x7')](_0x4fc995[_0x34e2c9[_0x1b65('0xc')][_0x1b65('0xd')]['toLowerCase']()][_0x1b65('0xb')]());}else if(_0x34e2c9[_0x1b65('0x5')]==='keyValue'){if(_0x34e2c9[_0x1b65('0xf')]==='string'&&_0x34e2c9['key']){_0x1e478e[_0x1b65('0x7')](util[_0x1b65('0x10')](_0x1b65('0x11'),_0x34e2c9[_0x1b65('0x12')],_0x34e2c9[_0x1b65('0x13')]));}else if(_0x34e2c9['keyType']===_0x1b65('0x9')&&_0x34e2c9[_0x1b65('0xa')]&&_0x34e2c9[_0x1b65('0x12')]){_0x4fc995[_0x34e2c9[_0x1b65('0xa')]]&&_0x1e478e['push'](util[_0x1b65('0x10')](_0x1b65('0x11'),_0x34e2c9[_0x1b65('0x12')],_0x4fc995[_0x34e2c9[_0x1b65('0xa')]]));}else if(_0x34e2c9[_0x1b65('0xf')]===_0x1b65('0x14')&&_0x34e2c9[_0x1b65('0xc')]&&_0x34e2c9[_0x1b65('0xc')][_0x1b65('0xd')]&&_0x34e2c9[_0x1b65('0x12')]){_0x4fc995[_0x34e2c9[_0x1b65('0xc')][_0x1b65('0xd')][_0x1b65('0xe')]()]&&_0x1e478e[_0x1b65('0x7')](util[_0x1b65('0x10')]('%s:\x20%s',_0x34e2c9[_0x1b65('0x12')],_0x4fc995[_0x34e2c9[_0x1b65('0xc')][_0x1b65('0xd')][_0x1b65('0xe')]()]));}}}}return _0x1e478e['join'](_0x33008e);};exports[_0x1b65('0x15')]=function(_0x14ceb9){var _0x88a079=_0x14ceb9['slice'](-0x1);if(_0x88a079==='/'){_0x14ceb9=_0x14ceb9['substring'](0x0,_0x14ceb9[_0x1b65('0x16')](_0x88a079));}return _0x14ceb9;};exports['validateEmail']=function(_0x38304e){if(!_[_0x1b65('0x17')](_0x38304e)&&_0x38304e!==''){var _0x4fc3ba=/^(([^<>()\[\]\\.,;:\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 _0x4fc3ba[_0x1b65('0x18')](String(_0x38304e)[_0x1b65('0xe')]());}else{return![];}}; \ No newline at end of file +var _0x2ee6=['format','%s:\x20%s','keyContent','variable','customVariable','join','stripTrailingSlash','slice','substring','lastIndexOf','isNil','util','getString','length','sortBy','type','string','push','content','variableName','Variable','name','toLowerCase','toString','keyValue','keyType','key'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2ee6,0x16a));var _0x62ee=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0x2ee6[_0x65c50e];return _0x4573e7;};'use strict';var _=require('lodash');var util=require(_0x62ee('0x0'));exports[_0x62ee('0x1')]=function(_0x448085,_0x5aad4f,_0x211179){var _0x5163c5=[];if(_0x448085[_0x62ee('0x2')]>0x0){var _0x4d6843=_[_0x62ee('0x3')](_0x448085,['id']);for(var _0x47301f=0x0;_0x47301f<_0x4d6843[_0x62ee('0x2')];_0x47301f++){var _0x21a606=_0x4d6843[_0x47301f];if(_0x21a606[_0x62ee('0x4')]===_0x62ee('0x5')){_0x5163c5[_0x62ee('0x6')](_0x21a606[_0x62ee('0x7')]);}else if(_0x21a606[_0x62ee('0x4')]==='variable'&&_0x21a606[_0x62ee('0x8')]){_0x5aad4f[_0x21a606[_0x62ee('0x8')]]&&_0x5163c5[_0x62ee('0x6')](_0x5aad4f[_0x21a606[_0x62ee('0x8')]]['toString']());}else if(_0x21a606[_0x62ee('0x4')]==='customVariable'&&_0x21a606[_0x62ee('0x9')]&&_0x21a606['Variable'][_0x62ee('0xa')]){_0x5aad4f[_0x21a606[_0x62ee('0x9')][_0x62ee('0xa')][_0x62ee('0xb')]()]&&_0x5163c5[_0x62ee('0x6')](_0x5aad4f[_0x21a606[_0x62ee('0x9')]['name'][_0x62ee('0xb')]()][_0x62ee('0xc')]());}else if(_0x21a606['type']===_0x62ee('0xd')){if(_0x21a606[_0x62ee('0xe')]==='string'&&_0x21a606[_0x62ee('0xf')]){_0x5163c5['push'](util[_0x62ee('0x10')](_0x62ee('0x11'),_0x21a606['key'],_0x21a606[_0x62ee('0x12')]));}else if(_0x21a606['keyType']===_0x62ee('0x13')&&_0x21a606['variableName']&&_0x21a606[_0x62ee('0xf')]){_0x5aad4f[_0x21a606[_0x62ee('0x8')]]&&_0x5163c5[_0x62ee('0x6')](util['format']('%s:\x20%s',_0x21a606[_0x62ee('0xf')],_0x5aad4f[_0x21a606['variableName']]));}else if(_0x21a606['keyType']===_0x62ee('0x14')&&_0x21a606[_0x62ee('0x9')]&&_0x21a606[_0x62ee('0x9')][_0x62ee('0xa')]&&_0x21a606[_0x62ee('0xf')]){_0x5aad4f[_0x21a606[_0x62ee('0x9')][_0x62ee('0xa')][_0x62ee('0xb')]()]&&_0x5163c5[_0x62ee('0x6')](util[_0x62ee('0x10')](_0x62ee('0x11'),_0x21a606['key'],_0x5aad4f[_0x21a606[_0x62ee('0x9')][_0x62ee('0xa')][_0x62ee('0xb')]()]));}}}}return _0x5163c5[_0x62ee('0x15')](_0x211179);};exports[_0x62ee('0x16')]=function(_0x4a632f){var _0x2c92b1=_0x4a632f[_0x62ee('0x17')](-0x1);if(_0x2c92b1==='/'){_0x4a632f=_0x4a632f[_0x62ee('0x18')](0x0,_0x4a632f[_0x62ee('0x19')](_0x2c92b1));}return _0x4a632f;};exports['validateEmail']=function(_0x2eb1c6){if(!_[_0x62ee('0x1a')](_0x2eb1c6)&&_0x2eb1c6!==''){var _0x51db0f=/^(([^<>()\[\]\\.,;:\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 _0x51db0f['test'](String(_0x2eb1c6)[_0x62ee('0xb')]());}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 4d1e06e..56b02fc 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 _0x2a52=['firstname','POST','Contacts','Enduser\x20created.','phone','getEndUser','getchallenge','login','token','getConnection','[HTTP]','queue','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','lastevent','toUpperCase','calleridnum','lodash','util','ioredis','./util','../../../../config/logger','redis','defaults','localhost','emit','length','forEach','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','info','merge','Normal','getString','Descriptions','format','%s/webservice.php','remoteUri','create','sessionName','HelpDesk','stringify','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','error','getUser','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!'];(function(_0xbe3ef8,_0x2a9242){var _0x191461=function(_0x2dcabf){while(--_0x2dcabf){_0xbe3ef8['push'](_0xbe3ef8['shift']());}};_0x191461(++_0x2a9242);}(_0x2a52,0x142));var _0x22a5=function(_0x238bd3,_0x18fff0){_0x238bd3=_0x238bd3-0x0;var _0x3dda51=_0x2a52[_0x238bd3];return _0x3dda51;};'use strict';var _=require(_0x22a5('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require('md5');var util=require(_0x22a5('0x1'));var Redis=require(_0x22a5('0x2'));var intUtil=require(_0x22a5('0x3'));var config=require('../../../../config/environment');var logger=require(_0x22a5('0x4'))('vTiger');config[_0x22a5('0x5')]=_[_0x22a5('0x6')](config['redis'],{'host':_0x22a5('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x22a5('0x5')]));function emit(_0xc4a914,_0x530720,_0x928ab8){io['to'](_0xc4a914)[_0x22a5('0x8')](_0x530720,_0x928ab8);}function getCustomFields(_0x2a7a17,_0x5ece60){var _0x36d2dc={};if(_0x2a7a17[_0x22a5('0x9')]>0x0){_[_0x22a5('0xa')](_0x2a7a17,function(_0x172073){if(_0x172073[_0x22a5('0xb')]==='string'&&_0x172073[_0x22a5('0xc')]){_0x36d2dc[_0x172073[_0x22a5('0xc')]]=_0x172073['content'][_0x22a5('0xd')]();}else if(_0x172073[_0x22a5('0xb')]===_0x22a5('0xe')&&_0x172073[_0x22a5('0xf')]&&_0x172073[_0x22a5('0xc')]&&_0x5ece60[_0x172073[_0x22a5('0xf')]]){_0x36d2dc[_0x172073['idField']]=_0x5ece60[_0x172073[_0x22a5('0xf')]][_0x22a5('0xd')]();}else if(_0x172073[_0x22a5('0xb')]===_0x22a5('0x10')&&_0x172073[_0x22a5('0x11')]&&_0x172073[_0x22a5('0x11')][_0x22a5('0x12')]&&_0x172073[_0x22a5('0xc')]&&_0x5ece60[_0x172073[_0x22a5('0x11')][_0x22a5('0x12')][_0x22a5('0x13')]()]){_0x36d2dc[_0x172073[_0x22a5('0xc')]]=_0x5ece60[_0x172073[_0x22a5('0x11')]['name'][_0x22a5('0x13')]()][_0x22a5('0xd')]();}});}return _0x36d2dc;}function createTicket(_0x5e7543,_0x724205,_0x531e1c,_0x476dd1,_0x2390bd,_0x1bdbe1,_0x34b1f8){logger[_0x22a5('0x14')]('Creating\x20new\x20ticket...');var _0x1287c8=_[_0x22a5('0x15')]({'parent_id':'','assigned_user_id':_0x724205['id'],'ticketpriorities':_0x22a5('0x16'),'ticketstatus':'Open','ticket_title':intUtil[_0x22a5('0x17')](_0x476dd1['Subjects'],_0x2390bd,'\x20'),'description':intUtil[_0x22a5('0x17')](_0x476dd1[_0x22a5('0x18')],_0x2390bd,'\x0a'),'contact_id':_0x531e1c['id']},getCustomFields(_0x1bdbe1,_0x2390bd));var _0x20463c={'method':'POST','uri':util[_0x22a5('0x19')](_0x22a5('0x1a'),_0x5e7543[_0x22a5('0x1b')]),'form':{'operation':_0x22a5('0x1c'),'username':_0x5e7543['username'],'sessionName':_0x34b1f8[_0x22a5('0x1d')],'elementType':_0x22a5('0x1e'),'element':JSON[_0x22a5('0x1f')](_0x1287c8)},'json':!![]};return request(_0x20463c)[_0x22a5('0x20')](function(_0x27cae6){if(_0x27cae6[_0x22a5('0x21')]){return BPromise[_0x22a5('0x22')]({'id':_0x27cae6[_0x22a5('0x23')]['id']});}else{throw new Error(util[_0x22a5('0x19')](_0x22a5('0x24'),JSON[_0x22a5('0x1f')](_0x27cae6['error'])));}})[_0x22a5('0x25')](function(_0x82029d){var _0xef97b8=_0x82029d['statusCode']||0x1f4;logger['error'](_0x22a5('0x26'),_0x22a5('0x27'),_0xef97b8,JSON[_0x22a5('0x1f')](_0x82029d));});}function getUser(_0x2eb6ac,_0x1496b8,_0x42695e){if(intUtil[_0x22a5('0x28')](_0x1496b8)){logger['info'](_0x22a5('0x29'),_0x1496b8);return request({'method':_0x22a5('0x2a'),'uri':util[_0x22a5('0x19')](_0x22a5('0x1a'),_0x2eb6ac[_0x22a5('0x1b')]),'qs':{'operation':_0x22a5('0x2b'),'username':_0x2eb6ac[_0x22a5('0x2c')],'sessionName':_0x42695e['sessionName'],'query':util[_0x22a5('0x19')](_0x22a5('0x2d'),_0x1496b8)},'json':!![]})['then'](function(_0x1b0ed4){if(_0x1b0ed4['success']&&_0x1b0ed4[_0x22a5('0x23')]['length']){logger[_0x22a5('0x14')]('Agent\x20found!');return BPromise['resolve']({'id':_0x1b0ed4[_0x22a5('0x23')][0x0]['id'],'email':_0x1b0ed4[_0x22a5('0x23')][0x0]['email1'],'name':_0x1b0ed4[_0x22a5('0x23')][0x0]['first_name']+'\x20'+_0x1b0ed4[_0x22a5('0x23')]['last_name']});}else{logger['info'](_0x22a5('0x2e'));return BPromise['resolve']({'id':_0x42695e[_0x22a5('0x2f')],'email':_0x2eb6ac['username'],'name':_0x22a5('0x30')});}})[_0x22a5('0x25')](function(_0x3a5be7){var _0x11d313=_0x3a5be7[_0x22a5('0x31')]||0x1f4;logger[_0x22a5('0x32')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x22a5('0x33'),_0x11d313,JSON[_0x22a5('0x1f')](_0x3a5be7));});}else{logger[_0x22a5('0x14')](_0x22a5('0x2e'));return BPromise[_0x22a5('0x22')]({'id':_0x42695e[_0x22a5('0x2f')],'email':_0x2eb6ac[_0x22a5('0x2c')],'name':_0x22a5('0x30')})['catch'](function(_0x405150){var _0x26d3dc=_0x405150[_0x22a5('0x31')]||0x1f4;logger[_0x22a5('0x32')](_0x22a5('0x26'),_0x22a5('0x33'),_0x26d3dc,JSON['stringify'](_0x405150));});}}function getEndUser(_0x2407e0,_0x4f514f,_0x18192f,_0x5b09d5){logger[_0x22a5('0x14')]('Searching\x20end\x20user\x20with\x20phone',_0x18192f);return request({'method':'GET','uri':util['format'](_0x22a5('0x1a'),_0x2407e0[_0x22a5('0x1b')]),'qs':{'operation':_0x22a5('0x2b'),'username':_0x2407e0[_0x22a5('0x2c')],'sessionName':_0x5b09d5[_0x22a5('0x1d')],'query':util['format'](_0x22a5('0x34'),_0x18192f,_0x18192f,_0x18192f,_0x18192f,_0x18192f)},'json':!![]})[_0x22a5('0x20')](function(_0x3da6d){if(_0x3da6d['success']&&_0x3da6d['result'][_0x22a5('0x9')]){logger[_0x22a5('0x14')](_0x22a5('0x35'));return BPromise[_0x22a5('0x22')]({'id':_0x3da6d[_0x22a5('0x23')][0x0]['id'],'name':_0x3da6d['result'][0x0][_0x22a5('0x36')]+'\x20'+_0x3da6d['result'][0x0]['lastname'],'phone':_0x18192f});}else{logger[_0x22a5('0x14')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0x22a5('0x37'),'uri':util['format'](_0x22a5('0x1a'),_0x2407e0[_0x22a5('0x1b')]),'form':{'operation':_0x22a5('0x1c'),'sessionName':_0x5b09d5[_0x22a5('0x1d')],'elementType':_0x22a5('0x38'),'element':JSON[_0x22a5('0x1f')]({'lastname':_0x4f514f,'phone':_0x18192f,'assigned_user_id':'\x20'})},'json':!![]})[_0x22a5('0x20')](function(_0x10f8b3){logger[_0x22a5('0x14')](_0x22a5('0x39'));return BPromise[_0x22a5('0x22')]({'id':_0x10f8b3[_0x22a5('0x23')]['id'],'name':_0x10f8b3['result']['lastname'],'phone':_0x10f8b3[_0x22a5('0x23')][_0x22a5('0x3a')]});})['catch'](function(_0x33a5f7){var _0x131854=_0x33a5f7['statusCode']||0x1f4;logger[_0x22a5('0x32')](_0x22a5('0x26'),_0x22a5('0x3b'),_0x131854,JSON[_0x22a5('0x1f')](_0x33a5f7));});}});}function getConnection(_0x47a524){var _0x33fceb=_0x47a524[_0x22a5('0x2c')];var _0x5b9d3f=_0x47a524['accessKey'];return request({'method':_0x22a5('0x2a'),'uri':util[_0x22a5('0x19')](_0x22a5('0x1a'),_0x47a524[_0x22a5('0x1b')]),'qs':{'operation':_0x22a5('0x3c'),'username':_0x33fceb},'json':!![]})[_0x22a5('0x20')](function(_0x586cfd){if(_0x586cfd[_0x22a5('0x21')]){return request({'method':_0x22a5('0x37'),'uri':util['format'](_0x22a5('0x1a'),_0x47a524[_0x22a5('0x1b')]),'form':{'operation':_0x22a5('0x3d'),'username':_0x33fceb,'accessKey':md5(_0x586cfd['result'][_0x22a5('0x3e')]+_0x5b9d3f)},'json':!![]});}})['then'](function(_0x33e0d4){if(_0x33e0d4[_0x22a5('0x21')]){return BPromise[_0x22a5('0x22')](_0x33e0d4[_0x22a5('0x23')]);}else{throw new Error(util[_0x22a5('0x19')]('Account\x20%d\x20is\x20not\x20valid',_0x47a524['id']));}})[_0x22a5('0x25')](function(_0x3028f1){var _0x1742fd=_0x3028f1['statusCode']||0x1f4;logger[_0x22a5('0x32')](_0x22a5('0x26'),_0x22a5('0x3f'),_0x1742fd,JSON[_0x22a5('0x1f')](_0x3028f1));});}function request(_0x533b4d){logger[_0x22a5('0x14')](_0x22a5('0x40'),JSON[_0x22a5('0x1f')](_0x533b4d));return rp(_0x533b4d);}exports[_0x22a5('0x41')]=function(_0x1193d9,_0x4bab76,_0xd00364,_0x413d52,_0x4e2748,_0x4c7196){var _0x2b7db1,_0x3c3265,_0x9815b2,_0x5bf08e;_0x4c7196[_0x22a5('0x1b')]=intUtil['stripTrailingSlash'](_0x4c7196[_0x22a5('0x1b')]);if(_0x4e2748&&_0x4e2748[_0x22a5('0x42')]){logger[_0x22a5('0x14')](_0x22a5('0x43'),_0x22a5('0x44'));_0x4bab76[_0x22a5('0x45')]=util[_0x22a5('0x19')](_0x22a5('0x46'),_0x4c7196[_0x22a5('0x47')],_0x4bab76['uniqueid'],md5(_0x4bab76[_0x22a5('0x48')]));}else{_0x4bab76[_0x22a5('0x45')]='';}return getConnection(_0x4c7196)['then'](function(_0x61fad2){_0x5bf08e=_0x61fad2;return getUser(_0x4c7196,_0x413d52[_0x22a5('0x49')],_0x5bf08e);})['then'](function(_0x588ac8){_0x2b7db1=_0x588ac8;logger[_0x22a5('0x14')](_0x22a5('0x4a'),_0x2b7db1['id']);return getEndUser(_0x4c7196,_0x4bab76[_0x22a5('0x4b')],_0x4bab76['calleridnum'],_0x5bf08e);})[_0x22a5('0x20')](function(_0xf46d20){_0x3c3265=_0xf46d20;logger['info'](_0x22a5('0x4c'),_0x3c3265['id']);return createTicket(_0x4c7196,_0x2b7db1,_0x3c3265,_0xd00364,_0x4bab76,_0xd00364[_0x22a5('0x4d')],_0x5bf08e);})[_0x22a5('0x20')](function(_0x3efc94){_0x9815b2=_0x3efc94;logger[_0x22a5('0x14')](_0x22a5('0x4e'));logger['info'](_0x22a5('0x4f'),_0x9815b2['id']);var _0x12e20=util[_0x22a5('0x19')](_0x22a5('0x50'),_0x4c7196['remoteUri'],_[_0x22a5('0x51')](_0x9815b2['id'],'x')[0x1]);logger['info'](_0x22a5('0x43'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x22a5('0x19')](_0x22a5('0x52'),_0x413d52['name']),_0x22a5('0x53'),{'uri':_0x12e20});})[_0x22a5('0x25')](function(_0x4a1a3f){logger[_0x22a5('0x32')](_0x22a5('0x43'),JSON['stringify'](_0x4a1a3f));});};exports[_0x22a5('0x54')]=function(_0x5e3813,_0x29dea9,_0x2bb585,_0x267601,_0x4f7608,_0x1d7546,_0x4840a4){var _0x1cbb43,_0x15fd10,_0x4e4233,_0xa661d7;_0x1d7546[_0x22a5('0x1b')]=intUtil['stripTrailingSlash'](_0x1d7546[_0x22a5('0x1b')]);_0x1d7546[_0x22a5('0x47')]=intUtil[_0x22a5('0x55')](_0x1d7546[_0x22a5('0x47')]);if(_0x4840a4&&_0x4840a4[_0x22a5('0x56')]&&_0x4840a4[_0x22a5('0x56')]!==_0x22a5('0x57')){logger[_0x22a5('0x14')](_0x22a5('0x58'),_0x22a5('0x44'));_0x29dea9[_0x22a5('0x45')]=util[_0x22a5('0x19')](_0x22a5('0x46'),_0x1d7546[_0x22a5('0x47')],_0x29dea9[_0x22a5('0x48')],md5(_0x29dea9['uniqueid']));}return getConnection(_0x1d7546)[_0x22a5('0x20')](function(_0x2a24d2){_0xa661d7=_0x2a24d2;return getUser(_0x1d7546,_0x267601[_0x22a5('0x49')],_0xa661d7);})[_0x22a5('0x20')](function(_0x2c22aa){_0x1cbb43=_0x2c22aa;logger[_0x22a5('0x14')](_0x22a5('0x4a'),_0x1cbb43['id']);return getEndUser(_0x1d7546,_0x29dea9[_0x22a5('0x59')],_0x29dea9[_0x22a5('0x5a')],_0xa661d7);})[_0x22a5('0x20')](function(_0x223921){_0x15fd10=_0x223921;logger[_0x22a5('0x14')](_0x22a5('0x4c'),_0x15fd10['id']);return createTicket(_0x1d7546,_0x1cbb43,_0x15fd10,_0x2bb585,_0x29dea9,_0x2bb585[_0x22a5('0x4d')],_0xa661d7);})[_0x22a5('0x20')](function(_0x37c2a0){_0x4e4233=_0x37c2a0;logger[_0x22a5('0x14')]('Ticket\x20created!');logger[_0x22a5('0x14')](_0x22a5('0x4f'),_0x4e4233['id']);var _0x44ae0f=util[_0x22a5('0x19')](_0x22a5('0x50'),_0x1d7546['remoteUri'],_[_0x22a5('0x51')](_0x4e4233['id'],'x')[0x1]);logger[_0x22a5('0x14')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x22a5('0x19')](_0x22a5('0x52'),_0x267601[_0x22a5('0x12')]),_0x22a5('0x53'),{'uri':_0x44ae0f});})[_0x22a5('0x25')](function(_0x3da621){logger[_0x22a5('0x32')]('[OUTBOUND]',JSON[_0x22a5('0x1f')](_0x3da621));});};exports['unmanaged']=function(_0x5bb195,_0x5a0686,_0x20bc49,_0x1415cd,_0x5caeba,_0x1ec795){var _0x5dd796,_0x390216,_0x37c2c8,_0x2ffd5d;_0x1ec795['remoteUri']=intUtil[_0x22a5('0x55')](_0x1ec795[_0x22a5('0x1b')]);_0x1ec795[_0x22a5('0x47')]=intUtil[_0x22a5('0x55')](_0x1ec795[_0x22a5('0x47')]);if(_0x5caeba&&_0x5caeba['monitor_format']){logger[_0x22a5('0x14')]('['+_0x5a0686[_0x22a5('0x5b')][_0x22a5('0x5c')]()+']',_0x22a5('0x44'));_0x5a0686[_0x22a5('0x45')]=util[_0x22a5('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1ec795[_0x22a5('0x47')],_0x5a0686[_0x22a5('0x48')],md5(_0x5a0686[_0x22a5('0x48')]));}else{_0x5a0686[_0x22a5('0x45')]='';}return getConnection(_0x1ec795)[_0x22a5('0x20')](function(_0x2b40a7){_0x2ffd5d=_0x2b40a7;return getUser(_0x1ec795,'',_0x2ffd5d);})[_0x22a5('0x20')](function(_0x2627ea){_0x5dd796=_0x2627ea;logger[_0x22a5('0x14')](_0x22a5('0x4a'),_0x5dd796['id']);return getEndUser(_0x1ec795,_0x5a0686['calleridname'],_0x5a0686[_0x22a5('0x5d')],_0x2ffd5d);})[_0x22a5('0x20')](function(_0x9c07e2){_0x390216=_0x9c07e2;logger['info']('The\x20Enduser\x20ID\x20is:',_0x390216['id']);return createTicket(_0x1ec795,_0x5dd796,_0x390216,_0x20bc49,_0x5a0686,_0x20bc49[_0x22a5('0x4d')],_0x2ffd5d);})[_0x22a5('0x20')](function(_0x45768e){_0x37c2c8=_0x45768e;logger[_0x22a5('0x14')](_0x22a5('0x4e'));logger[_0x22a5('0x14')](_0x22a5('0x4f'),_0x37c2c8['id']);})[_0x22a5('0x25')](function(_0x3c3b9a){logger[_0x22a5('0x32')]('['+_0x5a0686[_0x22a5('0x5b')][_0x22a5('0x5c')]()+']',JSON['stringify'](_0x3c3b9a));});}; \ No newline at end of file +var _0xcf33=['toLowerCase','Creating\x20new\x20ticket...','Normal','Open','getString','Descriptions','%s/webservice.php','remoteUri','create','sessionName','stringify','then','success','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','createTicket','validateEmail','info','GET','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','first_name','admin','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','getUser','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','Searching\x20end\x20user\x20with\x20phone','query','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','[HTTP]','stripTrailingSlash','monitor_format','[QUEUE]','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','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','recordingFormat','none','destcalleridname','The\x20Ticket\x20ID\x20is:','split','[OUTBOUND]','unmanaged','toUpperCase','lastevent','lodash','ioredis','./util','../../../../config/logger','vTiger','redis','socket.io-emitter','length','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name'];(function(_0x21ef85,_0x2e92ec){var _0x53a3e6=function(_0xe21035){while(--_0xe21035){_0x21ef85['push'](_0x21ef85['shift']());}};_0x53a3e6(++_0x2e92ec);}(_0xcf33,0x10d));var _0x3cf3=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xcf33[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0x3cf3('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x3cf3('0x1'));var intUtil=require(_0x3cf3('0x2'));var config=require('../../../../config/environment');var logger=require(_0x3cf3('0x3'))(_0x3cf3('0x4'));config[_0x3cf3('0x5')]=_['defaults'](config[_0x3cf3('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x3cf3('0x6'))(new Redis(config[_0x3cf3('0x5')]));function emit(_0x5b1a90,_0x336725,_0xeb2ea3){io['to'](_0x5b1a90)['emit'](_0x336725,_0xeb2ea3);}function getCustomFields(_0x561fe2,_0x183167){var _0x5dcc3b={};if(_0x561fe2[_0x3cf3('0x7')]>0x0){_[_0x3cf3('0x8')](_0x561fe2,function(_0x27e552){if(_0x27e552[_0x3cf3('0x9')]===_0x3cf3('0xa')&&_0x27e552[_0x3cf3('0xb')]){_0x5dcc3b[_0x27e552[_0x3cf3('0xb')]]=_0x27e552[_0x3cf3('0xc')][_0x3cf3('0xd')]();}else if(_0x27e552[_0x3cf3('0x9')]===_0x3cf3('0xe')&&_0x27e552[_0x3cf3('0xf')]&&_0x27e552[_0x3cf3('0xb')]&&_0x183167[_0x27e552[_0x3cf3('0xf')]]){_0x5dcc3b[_0x27e552[_0x3cf3('0xb')]]=_0x183167[_0x27e552[_0x3cf3('0xf')]][_0x3cf3('0xd')]();}else if(_0x27e552['type']===_0x3cf3('0x10')&&_0x27e552[_0x3cf3('0x11')]&&_0x27e552[_0x3cf3('0x11')][_0x3cf3('0x12')]&&_0x27e552['idField']&&_0x183167[_0x27e552[_0x3cf3('0x11')]['name'][_0x3cf3('0x13')]()]){_0x5dcc3b[_0x27e552[_0x3cf3('0xb')]]=_0x183167[_0x27e552[_0x3cf3('0x11')]['name'][_0x3cf3('0x13')]()][_0x3cf3('0xd')]();}});}return _0x5dcc3b;}function createTicket(_0xf82d9,_0x239c57,_0x38ab01,_0xcf90e4,_0x4562bf,_0x377221,_0x2161cf){logger['info'](_0x3cf3('0x14'));var _0x56b27e=_['merge']({'parent_id':'','assigned_user_id':_0x239c57['id'],'ticketpriorities':_0x3cf3('0x15'),'ticketstatus':_0x3cf3('0x16'),'ticket_title':intUtil[_0x3cf3('0x17')](_0xcf90e4['Subjects'],_0x4562bf,'\x20'),'description':intUtil[_0x3cf3('0x17')](_0xcf90e4[_0x3cf3('0x18')],_0x4562bf,'\x0a'),'contact_id':_0x38ab01['id']},getCustomFields(_0x377221,_0x4562bf));var _0x2648b6={'method':'POST','uri':util['format'](_0x3cf3('0x19'),_0xf82d9[_0x3cf3('0x1a')]),'form':{'operation':_0x3cf3('0x1b'),'username':_0xf82d9['username'],'sessionName':_0x2161cf[_0x3cf3('0x1c')],'elementType':'HelpDesk','element':JSON[_0x3cf3('0x1d')](_0x56b27e)},'json':!![]};return request(_0x2648b6)[_0x3cf3('0x1e')](function(_0x46d15e){if(_0x46d15e[_0x3cf3('0x1f')]){return BPromise[_0x3cf3('0x20')]({'id':_0x46d15e[_0x3cf3('0x21')]['id']});}else{throw new Error(util[_0x3cf3('0x22')](_0x3cf3('0x23'),JSON['stringify'](_0x46d15e['error'])));}})[_0x3cf3('0x24')](function(_0x9e4a04){var _0x26349a=_0x9e4a04['statusCode']||0x1f4;logger[_0x3cf3('0x25')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x3cf3('0x26'),_0x26349a,JSON[_0x3cf3('0x1d')](_0x9e4a04));});}function getUser(_0x3126a7,_0x148754,_0x4f45f8){if(intUtil[_0x3cf3('0x27')](_0x148754)){logger[_0x3cf3('0x28')]('Getting\x20agent\x20with\x20email',_0x148754);return request({'method':_0x3cf3('0x29'),'uri':util[_0x3cf3('0x22')](_0x3cf3('0x19'),_0x3126a7[_0x3cf3('0x1a')]),'qs':{'operation':'query','username':_0x3126a7[_0x3cf3('0x2a')],'sessionName':_0x4f45f8['sessionName'],'query':util[_0x3cf3('0x22')](_0x3cf3('0x2b'),_0x148754)},'json':!![]})['then'](function(_0x23cf2a){if(_0x23cf2a[_0x3cf3('0x1f')]&&_0x23cf2a[_0x3cf3('0x21')][_0x3cf3('0x7')]){logger['info'](_0x3cf3('0x2c'));return BPromise[_0x3cf3('0x20')]({'id':_0x23cf2a[_0x3cf3('0x21')][0x0]['id'],'email':_0x23cf2a[_0x3cf3('0x21')][0x0]['email1'],'name':_0x23cf2a['result'][0x0][_0x3cf3('0x2d')]+'\x20'+_0x23cf2a[_0x3cf3('0x21')]['last_name']});}else{logger[_0x3cf3('0x28')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x4f45f8['userId'],'email':_0x3126a7[_0x3cf3('0x2a')],'name':_0x3cf3('0x2e')});}})[_0x3cf3('0x24')](function(_0x4b3dba){var _0x9342ff=_0x4b3dba[_0x3cf3('0x2f')]||0x1f4;logger[_0x3cf3('0x25')](_0x3cf3('0x30'),_0x3cf3('0x31'),_0x9342ff,JSON['stringify'](_0x4b3dba));});}else{logger[_0x3cf3('0x28')](_0x3cf3('0x32'));return BPromise['resolve']({'id':_0x4f45f8[_0x3cf3('0x33')],'email':_0x3126a7['username'],'name':'admin'})[_0x3cf3('0x24')](function(_0x300cd0){var _0x3842ab=_0x300cd0['statusCode']||0x1f4;logger[_0x3cf3('0x25')](_0x3cf3('0x30'),_0x3cf3('0x31'),_0x3842ab,JSON[_0x3cf3('0x1d')](_0x300cd0));});}}function getEndUser(_0x26df4b,_0x454d15,_0xeedfa1,_0x2d2df3){logger['info'](_0x3cf3('0x34'),_0xeedfa1);return request({'method':'GET','uri':util[_0x3cf3('0x22')](_0x3cf3('0x19'),_0x26df4b[_0x3cf3('0x1a')]),'qs':{'operation':_0x3cf3('0x35'),'username':_0x26df4b['username'],'sessionName':_0x2d2df3['sessionName'],'query':util[_0x3cf3('0x22')](_0x3cf3('0x36'),_0xeedfa1,_0xeedfa1,_0xeedfa1,_0xeedfa1,_0xeedfa1)},'json':!![]})[_0x3cf3('0x1e')](function(_0xe76a60){if(_0xe76a60[_0x3cf3('0x1f')]&&_0xe76a60[_0x3cf3('0x21')][_0x3cf3('0x7')]){logger[_0x3cf3('0x28')](_0x3cf3('0x37'));return BPromise[_0x3cf3('0x20')]({'id':_0xe76a60[_0x3cf3('0x21')][0x0]['id'],'name':_0xe76a60[_0x3cf3('0x21')][0x0][_0x3cf3('0x38')]+'\x20'+_0xe76a60[_0x3cf3('0x21')][0x0][_0x3cf3('0x39')],'phone':_0xeedfa1});}else{logger[_0x3cf3('0x28')](_0x3cf3('0x3a'));return request({'method':_0x3cf3('0x3b'),'uri':util[_0x3cf3('0x22')](_0x3cf3('0x19'),_0x26df4b['remoteUri']),'form':{'operation':_0x3cf3('0x1b'),'sessionName':_0x2d2df3[_0x3cf3('0x1c')],'elementType':_0x3cf3('0x3c'),'element':JSON[_0x3cf3('0x1d')]({'lastname':_0x454d15,'phone':_0xeedfa1,'assigned_user_id':'\x20'})},'json':!![]})[_0x3cf3('0x1e')](function(_0xae7303){logger[_0x3cf3('0x28')](_0x3cf3('0x3d'));return BPromise[_0x3cf3('0x20')]({'id':_0xae7303['result']['id'],'name':_0xae7303['result'][_0x3cf3('0x39')],'phone':_0xae7303[_0x3cf3('0x21')][_0x3cf3('0x3e')]});})[_0x3cf3('0x24')](function(_0x342436){var _0x86230b=_0x342436[_0x3cf3('0x2f')]||0x1f4;logger[_0x3cf3('0x25')](_0x3cf3('0x30'),_0x3cf3('0x3f'),_0x86230b,JSON[_0x3cf3('0x1d')](_0x342436));});}});}function getConnection(_0x21cc52){var _0x53f8d1=_0x21cc52[_0x3cf3('0x2a')];var _0x5eb592=_0x21cc52[_0x3cf3('0x40')];return request({'method':'GET','uri':util[_0x3cf3('0x22')](_0x3cf3('0x19'),_0x21cc52[_0x3cf3('0x1a')]),'qs':{'operation':_0x3cf3('0x41'),'username':_0x53f8d1},'json':!![]})[_0x3cf3('0x1e')](function(_0x289cba){if(_0x289cba[_0x3cf3('0x1f')]){return request({'method':_0x3cf3('0x3b'),'uri':util[_0x3cf3('0x22')]('%s/webservice.php',_0x21cc52['remoteUri']),'form':{'operation':_0x3cf3('0x42'),'username':_0x53f8d1,'accessKey':md5(_0x289cba[_0x3cf3('0x21')][_0x3cf3('0x43')]+_0x5eb592)},'json':!![]});}})[_0x3cf3('0x1e')](function(_0x41efce){if(_0x41efce[_0x3cf3('0x1f')]){return BPromise[_0x3cf3('0x20')](_0x41efce['result']);}else{throw new Error(util[_0x3cf3('0x22')]('Account\x20%d\x20is\x20not\x20valid',_0x21cc52['id']));}})[_0x3cf3('0x24')](function(_0x27acb7){var _0x2ab8dd=_0x27acb7[_0x3cf3('0x2f')]||0x1f4;logger[_0x3cf3('0x25')]('[vTiger],\x20%s,\x20%s,\x20%s','getConnection',_0x2ab8dd,JSON[_0x3cf3('0x1d')](_0x27acb7));});}function request(_0x41f1fd){logger[_0x3cf3('0x28')](_0x3cf3('0x44'),JSON[_0x3cf3('0x1d')](_0x41f1fd));return rp(_0x41f1fd);}exports['queue']=function(_0x34c446,_0x39cee7,_0x58b771,_0x3cba38,_0x4da0da,_0xad91b1){var _0x2776cb,_0x376089,_0x4dd1b1,_0x295624;_0xad91b1[_0x3cf3('0x1a')]=intUtil[_0x3cf3('0x45')](_0xad91b1[_0x3cf3('0x1a')]);if(_0x4da0da&&_0x4da0da[_0x3cf3('0x46')]){logger[_0x3cf3('0x28')](_0x3cf3('0x47'),_0x3cf3('0x48'));_0x39cee7[_0x3cf3('0x49')]=util['format'](_0x3cf3('0x4a'),_0xad91b1[_0x3cf3('0x4b')],_0x39cee7['uniqueid'],md5(_0x39cee7[_0x3cf3('0x4c')]));}else{_0x39cee7[_0x3cf3('0x49')]='';}return getConnection(_0xad91b1)[_0x3cf3('0x1e')](function(_0x2c1db7){_0x295624=_0x2c1db7;return getUser(_0xad91b1,_0x3cba38['email'],_0x295624);})[_0x3cf3('0x1e')](function(_0xe88b6c){_0x2776cb=_0xe88b6c;logger[_0x3cf3('0x28')](_0x3cf3('0x4d'),_0x2776cb['id']);return getEndUser(_0xad91b1,_0x39cee7[_0x3cf3('0x4e')],_0x39cee7[_0x3cf3('0x4f')],_0x295624);})[_0x3cf3('0x1e')](function(_0x4d55c2){_0x376089=_0x4d55c2;logger[_0x3cf3('0x28')](_0x3cf3('0x50'),_0x376089['id']);return createTicket(_0xad91b1,_0x2776cb,_0x376089,_0x58b771,_0x39cee7,_0x58b771[_0x3cf3('0x51')],_0x295624);})[_0x3cf3('0x1e')](function(_0x33d8ef){_0x4dd1b1=_0x33d8ef;logger['info'](_0x3cf3('0x52'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x4dd1b1['id']);var _0x5f516c=util[_0x3cf3('0x22')](_0x3cf3('0x53'),_0xad91b1[_0x3cf3('0x1a')],_['split'](_0x4dd1b1['id'],'x')[0x1]);logger['info'](_0x3cf3('0x47'),_0x3cf3('0x54'));emit(util[_0x3cf3('0x22')](_0x3cf3('0x55'),_0x3cba38[_0x3cf3('0x12')]),_0x3cf3('0x56'),{'uri':_0x5f516c});})[_0x3cf3('0x24')](function(_0x2c9cc5){logger[_0x3cf3('0x25')](_0x3cf3('0x47'),JSON[_0x3cf3('0x1d')](_0x2c9cc5));});};exports['outbound']=function(_0x594629,_0x47e183,_0x3350c9,_0xc98b55,_0x3a202e,_0x5bb8e4,_0x99bb6c){var _0x2c87b2,_0x12fde6,_0x51e591,_0xc1912f;_0x5bb8e4[_0x3cf3('0x1a')]=intUtil[_0x3cf3('0x45')](_0x5bb8e4[_0x3cf3('0x1a')]);_0x5bb8e4[_0x3cf3('0x4b')]=intUtil[_0x3cf3('0x45')](_0x5bb8e4[_0x3cf3('0x4b')]);if(_0x99bb6c&&_0x99bb6c[_0x3cf3('0x57')]&&_0x99bb6c[_0x3cf3('0x57')]!==_0x3cf3('0x58')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x47e183[_0x3cf3('0x49')]=util[_0x3cf3('0x22')](_0x3cf3('0x4a'),_0x5bb8e4[_0x3cf3('0x4b')],_0x47e183[_0x3cf3('0x4c')],md5(_0x47e183[_0x3cf3('0x4c')]));}return getConnection(_0x5bb8e4)[_0x3cf3('0x1e')](function(_0x3d32d8){_0xc1912f=_0x3d32d8;return getUser(_0x5bb8e4,_0xc98b55['email'],_0xc1912f);})[_0x3cf3('0x1e')](function(_0xea3063){_0x2c87b2=_0xea3063;logger[_0x3cf3('0x28')](_0x3cf3('0x4d'),_0x2c87b2['id']);return getEndUser(_0x5bb8e4,_0x47e183[_0x3cf3('0x59')],_0x47e183['destcalleridnum'],_0xc1912f);})[_0x3cf3('0x1e')](function(_0x324822){_0x12fde6=_0x324822;logger[_0x3cf3('0x28')](_0x3cf3('0x50'),_0x12fde6['id']);return createTicket(_0x5bb8e4,_0x2c87b2,_0x12fde6,_0x3350c9,_0x47e183,_0x3350c9['Fields'],_0xc1912f);})[_0x3cf3('0x1e')](function(_0x434bda){_0x51e591=_0x434bda;logger['info']('Ticket\x20created!');logger[_0x3cf3('0x28')](_0x3cf3('0x5a'),_0x51e591['id']);var _0x40f6fc=util[_0x3cf3('0x22')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x5bb8e4[_0x3cf3('0x1a')],_[_0x3cf3('0x5b')](_0x51e591['id'],'x')[0x1]);logger[_0x3cf3('0x28')](_0x3cf3('0x5c'),_0x3cf3('0x54'));emit(util[_0x3cf3('0x22')]('user:%s',_0xc98b55[_0x3cf3('0x12')]),_0x3cf3('0x56'),{'uri':_0x40f6fc});})['catch'](function(_0x286bf1){logger['error'](_0x3cf3('0x5c'),JSON[_0x3cf3('0x1d')](_0x286bf1));});};exports[_0x3cf3('0x5d')]=function(_0x580d16,_0x32c04e,_0x3e3a92,_0x52b203,_0x5e506f,_0x4f6e97){var _0xd7fa56,_0x328193,_0x20374c,_0x91b9be;_0x4f6e97[_0x3cf3('0x1a')]=intUtil['stripTrailingSlash'](_0x4f6e97[_0x3cf3('0x1a')]);_0x4f6e97[_0x3cf3('0x4b')]=intUtil[_0x3cf3('0x45')](_0x4f6e97[_0x3cf3('0x4b')]);if(_0x5e506f&&_0x5e506f['monitor_format']){logger[_0x3cf3('0x28')]('['+_0x32c04e['lastevent'][_0x3cf3('0x5e')]()+']',_0x3cf3('0x48'));_0x32c04e[_0x3cf3('0x49')]=util['format'](_0x3cf3('0x4a'),_0x4f6e97['serverUrl'],_0x32c04e[_0x3cf3('0x4c')],md5(_0x32c04e[_0x3cf3('0x4c')]));}else{_0x32c04e['recordingURL']='';}return getConnection(_0x4f6e97)[_0x3cf3('0x1e')](function(_0x210ac6){_0x91b9be=_0x210ac6;return getUser(_0x4f6e97,'',_0x91b9be);})[_0x3cf3('0x1e')](function(_0x209bca){_0xd7fa56=_0x209bca;logger[_0x3cf3('0x28')](_0x3cf3('0x4d'),_0xd7fa56['id']);return getEndUser(_0x4f6e97,_0x32c04e[_0x3cf3('0x4e')],_0x32c04e[_0x3cf3('0x4f')],_0x91b9be);})[_0x3cf3('0x1e')](function(_0x14a370){_0x328193=_0x14a370;logger[_0x3cf3('0x28')](_0x3cf3('0x50'),_0x328193['id']);return createTicket(_0x4f6e97,_0xd7fa56,_0x328193,_0x3e3a92,_0x32c04e,_0x3e3a92[_0x3cf3('0x51')],_0x91b9be);})[_0x3cf3('0x1e')](function(_0x149e2b){_0x20374c=_0x149e2b;logger['info'](_0x3cf3('0x52'));logger[_0x3cf3('0x28')](_0x3cf3('0x5a'),_0x20374c['id']);})[_0x3cf3('0x24')](function(_0x2eb1a8){logger[_0x3cf3('0x25')]('['+_0x32c04e[_0x3cf3('0x5f')][_0x3cf3('0x5e')]()+']',JSON[_0x3cf3('0x1d')](_0x2eb1a8));});}; \ 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 e6d8828..e388e2e 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 _0x982c=['content','string','idField','customField','push','variableName','custom_fields','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','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...','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','lastevent','\x20Error\x20running\x20Zendesk\x20integration','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','results','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','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','token','%s/token:%s','username','toString','[HTTP]','GET','map','forEach','type','nameField'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x982c,0x1e1));var _0xc982=function(_0x8f33b0,_0x824f0b){_0x8f33b0=_0x8f33b0-0x0;var _0x207208=_0x982c[_0x8f33b0];return _0x207208;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xc982('0x0'));var util=require(_0xc982('0x1'));var Redis=require(_0xc982('0x2'));var intUtil=require(_0xc982('0x3'));var config=require(_0xc982('0x4'));var logger=require(_0xc982('0x5'))(_0xc982('0x6'));config['redis']=_[_0xc982('0x7')](config[_0xc982('0x8')],{'host':_0xc982('0x9'),'port':0x18eb});var io=require(_0xc982('0xa'))(new Redis(config[_0xc982('0x8')]));function emit(_0x5be803,_0x45c6f4,_0x3f0e68){io['to'](_0x5be803)[_0xc982('0xb')](_0x45c6f4,_0x3f0e68);}var headers={'Content-Type':'application/json','Accept':_0xc982('0xc')};function getTicket(_0x1a6390,_0x30110e,_0x5d5c57,_0x116111,_0x7adeb8){logger[_0xc982('0xd')](_0xc982('0xe'));return request({'uri':util[_0xc982('0xf')](_0xc982('0x10'),_0x1a6390[_0xc982('0x11')]),'method':'POST','body':{'ticket':_[_0xc982('0x12')]({'requester_id':_0x5d5c57['id'],'submitter_id':_0x30110e?_0x30110e['id']:undefined,'assignee_id':_0x30110e?_0x30110e['id']:undefined,'tags':getTags(_0x116111['Tags'],_0xc982('0x13')),'subject':intUtil[_0xc982('0x14')](_0x116111[_0xc982('0x15')],_0x7adeb8,'\x20'),'description':intUtil[_0xc982('0x14')](_0x116111[_0xc982('0x16')],_0x7adeb8,'\x0a'),'comment':{'public':![],'body':intUtil[_0xc982('0x14')](_0x116111['Descriptions'],_0x7adeb8,'\x0a')}},getCustomFields(_0x116111['Fields'],_0x7adeb8))}})[_0xc982('0x17')](function(_0x243f64){logger[_0xc982('0xd')](_0xc982('0x18'));return _0x243f64[_0xc982('0x19')];});}function getUser(_0x228c74,_0x23182f){if(intUtil[_0xc982('0x1a')](_0x23182f)){logger[_0xc982('0xd')](_0xc982('0x1b'),_0x23182f);return request({'uri':util['format'](_0xc982('0x1c'),_0x228c74[_0xc982('0x11')]),'qs':{'query':util[_0xc982('0xf')](_0xc982('0x1d'),_0x23182f)}})[_0xc982('0x17')](function(_0x389947){if(_0x389947[_0xc982('0x1e')]){logger[_0xc982('0xd')]('Agent\x20found!');return _[_0xc982('0x1f')](_0x389947[_0xc982('0x20')],{'email':_0x23182f,'role':'agent'});}else{logger[_0xc982('0xd')](_0xc982('0x21'));return request({'uri':util[_0xc982('0xf')](_0xc982('0x22'),_0x228c74[_0xc982('0x11')])})[_0xc982('0x17')](function(_0x177d90){logger[_0xc982('0xd')](_0xc982('0x23'));return _0x177d90[_0xc982('0x24')];});}});}else{logger[_0xc982('0xd')](_0xc982('0x21'));return request({'uri':util['format']('%s/users/me.json',_0x228c74[_0xc982('0x11')])})[_0xc982('0x17')](function(_0x1b785d){logger[_0xc982('0xd')](_0xc982('0x23'));return _0x1b785d[_0xc982('0x24')];});}}function getEndUser(_0x4836cd,_0xd95c24,_0x812fb1){logger[_0xc982('0xd')](_0xc982('0x25'),_0x812fb1);return request({'uri':util[_0xc982('0xf')](_0xc982('0x1c'),_0x4836cd[_0xc982('0x11')]),'qs':{'query':util['format'](_0xc982('0x26'),_0x812fb1)}})['then'](function(_0x2a488c){var _0x2b2af5;if(_0x2a488c[_0xc982('0x20')]['length']){_0x2a488c[_0xc982('0x20')]=_[_0xc982('0x27')](_0x2a488c[_0xc982('0x20')],{'suspended':![],'role':_0xc982('0x28')});if(_0x2a488c['results'][_0xc982('0x29')]){_0x2b2af5=_[_0xc982('0x2a')](_0x2a488c[_0xc982('0x20')]);}}if(_0x2b2af5){logger[_0xc982('0xd')](_0xc982('0x2b'));return _0x2b2af5;}else{logger['info'](_0xc982('0x2c'));return request({'uri':util[_0xc982('0xf')]('%s/users.json',_0x4836cd[_0xc982('0x11')]),'method':_0xc982('0x2d'),'body':{'user':{'role':_0xc982('0x28'),'name':util[_0xc982('0xf')](_0xc982('0x2e'),_0xd95c24||_0x812fb1),'phone':_0x812fb1}}})[_0xc982('0x17')](function(_0x2eac83){logger[_0xc982('0xd')](_0xc982('0x2f'));return _0x2eac83['user'];});}});}function getAuth(_0x169c61){var _0x20ea0b;if(_0x169c61[_0xc982('0x30')]==='password'){_0x20ea0b=util[_0xc982('0xf')]('%s:%s',_0x169c61['username'],_0x169c61['password']);}else if(_0x169c61[_0xc982('0x30')]===_0xc982('0x31')){_0x20ea0b=util['format'](_0xc982('0x32'),_0x169c61[_0xc982('0x33')],_0x169c61[_0xc982('0x31')]);}return util[_0xc982('0xf')]('Basic\x20%s',new Buffer(_0x20ea0b)[_0xc982('0x34')]('base64'));}function request(_0x2af520){logger['debug'](_0xc982('0x35'),JSON['stringify'](_0x2af520));return rp(_[_0xc982('0x7')](_0x2af520,{'method':_0xc982('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x1cf8fc,_0x2d7276){var _0x2db06e=[];if(_0x1cf8fc&&_0x1cf8fc[_0xc982('0x29')]>0x0){_0x2db06e=_[_0xc982('0x37')](_0x1cf8fc,_0x2d7276);}return _0x2db06e;}function getCustomFields(_0xa208e1,_0x37cfba){var _0x2a1fd6=[];var _0x2b5dd3={'custom_fields':[]};if(_0xa208e1[_0xc982('0x29')]>0x0){_[_0xc982('0x38')](_0xa208e1,function(_0x4b596c){if(_0x4b596c[_0xc982('0x39')]==='string'&&_0x4b596c[_0xc982('0x3a')]&&!_0x4b596c['customField']){_0x2b5dd3[_0x4b596c[_0xc982('0x3a')]['toLowerCase']()]=_0x4b596c[_0xc982('0x3b')][_0xc982('0x34')]();}else if(_0x4b596c[_0xc982('0x39')]===_0xc982('0x3c')&&_0x4b596c[_0xc982('0x3d')]&&_0x4b596c[_0xc982('0x3e')]){_0x2b5dd3['custom_fields'][_0xc982('0x3f')]({'id':_0x4b596c['idField'],'value':_0x4b596c[_0xc982('0x3b')][_0xc982('0x34')]()});}else if(_0x4b596c[_0xc982('0x39')]==='variable'&&_0x4b596c[_0xc982('0x40')]&&_0x4b596c[_0xc982('0x3d')]&&_0x4b596c['customField']){_0x37cfba[_0x4b596c[_0xc982('0x40')]]&&_0x2b5dd3[_0xc982('0x41')][_0xc982('0x3f')]({'id':_0x4b596c[_0xc982('0x3d')],'value':_0x37cfba[_0x4b596c['variableName']][_0xc982('0x34')]()});}else if(_0x4b596c[_0xc982('0x39')]===_0xc982('0x42')&&_0x4b596c[_0xc982('0x43')]&&_0x4b596c['Variable'][_0xc982('0x13')]&&_0x4b596c[_0xc982('0x3d')]&&_0x4b596c[_0xc982('0x3e')]){_0x37cfba[_0x4b596c[_0xc982('0x43')][_0xc982('0x13')][_0xc982('0x44')]()]&&_0x2b5dd3[_0xc982('0x41')][_0xc982('0x3f')]({'id':_0x4b596c[_0xc982('0x3d')],'value':_0x37cfba[_0x4b596c['Variable'][_0xc982('0x13')][_0xc982('0x44')]()][_0xc982('0x34')]()});}});}return _0x2b5dd3;}exports[_0xc982('0x45')]=function(_0x2cd43f,_0x5b5bcd,_0x307a42,_0x5970bd,_0x3e3142,_0x143b87){var _0x2992c5,_0x35c052;_0x143b87[_0xc982('0x11')]=intUtil['stripTrailingSlash'](_0x143b87['remoteUri']);_0x143b87['serverUrl']=intUtil[_0xc982('0x46')](_0x143b87[_0xc982('0x47')]);if(_0x3e3142&&_0x3e3142['monitor_format']){logger['info'](_0xc982('0x48'),_0xc982('0x49'));_0x5b5bcd['recordingURL']=util[_0xc982('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x143b87['serverUrl'],_0x5b5bcd[_0xc982('0x4a')],md5(_0x5b5bcd[_0xc982('0x4a')]));}else{_0x5b5bcd[_0xc982('0x4b')]='';}headers[_0xc982('0x4c')]=getAuth(_0x143b87);return getUser(_0x143b87,_0x5970bd[_0xc982('0x4d')])[_0xc982('0x17')](function(_0x527150){_0x2992c5=_0x527150;logger[_0xc982('0xd')](_0xc982('0x4e'),_0x2992c5['id']);return getEndUser(_0x143b87,_0x5b5bcd[_0xc982('0x4f')],_0x5b5bcd[_0xc982('0x50')]);})[_0xc982('0x17')](function(_0x1c7bf1){_0x35c052=_0x1c7bf1;logger[_0xc982('0xd')]('The\x20Enduser\x20ID\x20is:',_0x35c052['id']);return getTicket(_0x143b87,_0x2992c5,_0x35c052,_0x307a42,_0x5b5bcd);})[_0xc982('0x17')](function(_0x21044c){if(_0x21044c){logger[_0xc982('0xd')](_0xc982('0x51'),_0x21044c['id']);switch(_0x143b87['type']){case _0xc982('0x52'):logger[_0xc982('0xd')]('[QUEUE]',_0xc982('0x53'));return request({'uri':util[_0xc982('0xf')](_0xc982('0x54'),_0x143b87[_0xc982('0x11')],_0x2992c5['id'],_0x21044c['id']),'method':_0xc982('0x2d')});case _0xc982('0x55'):logger[_0xc982('0xd')](_0xc982('0x48'),_0xc982('0x56'));emit(util[_0xc982('0xf')]('user:%s',_0x5970bd[_0xc982('0x13')]),_0xc982('0x57'),{'uri':util[_0xc982('0xf')](_0xc982('0x58'),_0x143b87[_0xc982('0x11')][_0xc982('0x59')](_0xc982('0x5a'),''),_0x21044c['id'])});break;default:logger['error'](_0xc982('0x48'),_0xc982('0x5b'));}}})[_0xc982('0x5c')](function(_0x42c759){logger[_0xc982('0x5d')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xc982('0x5e')](_0x42c759,{'showHidden':!![],'depth':null}));});};exports[_0xc982('0x5f')]=function(_0x4dabe3,_0x4f5f29,_0x5a7bfc,_0x356134,_0x53d129,_0x249e9e,_0x25d3bf){var _0x59d8f3,_0x47994b;_0x249e9e['remoteUri']=intUtil['stripTrailingSlash'](_0x249e9e[_0xc982('0x11')]);_0x249e9e[_0xc982('0x47')]=intUtil[_0xc982('0x46')](_0x249e9e[_0xc982('0x47')]);if(_0x25d3bf&&_0x25d3bf[_0xc982('0x60')]&&_0x25d3bf[_0xc982('0x60')]!==_0xc982('0x61')){logger[_0xc982('0xd')](_0xc982('0x62'),'Recording\x20is\x20enabled!');_0x4f5f29[_0xc982('0x4b')]=util[_0xc982('0xf')](_0xc982('0x63'),_0x249e9e[_0xc982('0x47')],_0x4f5f29[_0xc982('0x4a')],md5(_0x4f5f29[_0xc982('0x4a')]));}headers['Authorization']=getAuth(_0x249e9e);return getUser(_0x249e9e,_0x356134[_0xc982('0x4d')])[_0xc982('0x17')](function(_0x1443a8){_0x59d8f3=_0x1443a8;logger['info'](_0xc982('0x4e'),_0x59d8f3['id']);return getEndUser(_0x249e9e,_0x4f5f29[_0xc982('0x64')],_0x4f5f29[_0xc982('0x65')]);})[_0xc982('0x17')](function(_0x3cd257){_0x47994b=_0x3cd257;logger[_0xc982('0xd')](_0xc982('0x66'),_0x47994b['id']);return getTicket(_0x249e9e,_0x59d8f3,_0x47994b,_0x5a7bfc,_0x4f5f29);})[_0xc982('0x17')](function(_0x298f90){if(_0x298f90){logger[_0xc982('0xd')](_0xc982('0x51'),_0x298f90['id']);switch(_0x249e9e[_0xc982('0x39')]){case _0xc982('0x52'):logger[_0xc982('0xd')]('[OUTBOUND]',_0xc982('0x53'));return request({'uri':util['format'](_0xc982('0x54'),_0x249e9e[_0xc982('0x11')],_0x59d8f3['id'],_0x298f90['id']),'method':_0xc982('0x2d')});case _0xc982('0x55'):logger['info']('[OUTBOUND]',_0xc982('0x56'));emit(util[_0xc982('0xf')]('user:%s',_0x356134[_0xc982('0x13')]),_0xc982('0x57'),{'uri':util[_0xc982('0xf')](_0xc982('0x58'),_0x249e9e[_0xc982('0x11')][_0xc982('0x59')]('/api/v2',''),_0x298f90['id'])});break;default:logger[_0xc982('0x5d')](_0xc982('0x62'),_0xc982('0x5b'));}}})[_0xc982('0x5c')](function(_0x4d55b3){logger[_0xc982('0x5d')](_0xc982('0x67'),util[_0xc982('0x5e')](_0x4d55b3,{'showHidden':!![],'depth':null}));});};exports[_0xc982('0x68')]=function(_0x2b67d1,_0x4fd182,_0x1aae01,_0xcde30b,_0x17f1fd,_0x5a5c10){var _0x28976d,_0x56e679;_0x5a5c10['remoteUri']=intUtil[_0xc982('0x46')](_0x5a5c10[_0xc982('0x11')]);_0x5a5c10[_0xc982('0x47')]=intUtil[_0xc982('0x46')](_0x5a5c10[_0xc982('0x47')]);if(_0x17f1fd&&_0x17f1fd[_0xc982('0x69')]){logger[_0xc982('0xd')]('['+_0x4fd182[_0xc982('0x6a')]['toUpperCase']()+']',_0xc982('0x49'));_0x4fd182[_0xc982('0x4b')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5a5c10[_0xc982('0x47')],_0x4fd182[_0xc982('0x4a')],md5(_0x4fd182[_0xc982('0x4a')]));}else{_0x4fd182['recordingURL']='';}headers[_0xc982('0x4c')]=getAuth(_0x5a5c10);return getUser(_0x5a5c10)[_0xc982('0x17')](function(_0x1f9e78){_0x28976d=_0x1f9e78;logger[_0xc982('0xd')](_0xc982('0x4e'),_0x28976d['id']);return getEndUser(_0x5a5c10,_0x4fd182['calleridname'],_0x4fd182[_0xc982('0x50')]);})[_0xc982('0x17')](function(_0x23d95b){_0x56e679=_0x23d95b;logger['info']('The\x20Enduser\x20ID\x20is:',_0x56e679['id']);return getTicket(_0x5a5c10,_0x28976d,_0x56e679,_0x1aae01,_0x4fd182);})['then'](function(_0x5681df){if(_0x5681df){logger[_0xc982('0xd')](_0xc982('0x51'),_0x5681df['id']);}})[_0xc982('0x5c')](function(_0x15ecef){logger[_0xc982('0x5d')]('['+_0x4fd182[_0xc982('0x6a')]['toUpperCase']()+']'+_0xc982('0x6b'),util[_0xc982('0x5e')](_0x15ecef,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe81f=['type','idField','custom_fields','variable','variableName','push','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','replace','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','Tags','Subjects','getString','Descriptions','Fields','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','length','map','forEach','string','nameField','customField','toLowerCase','content'];(function(_0x50a02f,_0x1e8dcf){var _0x5159ff=function(_0x1dd0ac){while(--_0x1dd0ac){_0x50a02f['push'](_0x50a02f['shift']());}};_0x5159ff(++_0x1e8dcf);}(_0xe81f,0x1f4));var _0xfe81=function(_0x13b79a,_0x56ef21){_0x13b79a=_0x13b79a-0x0;var _0x37e0fe=_0xe81f[_0x13b79a];return _0x37e0fe;};'use strict';var _=require(_0xfe81('0x0'));var rp=require(_0xfe81('0x1'));var md5=require('md5');var util=require(_0xfe81('0x2'));var Redis=require(_0xfe81('0x3'));var intUtil=require(_0xfe81('0x4'));var config=require(_0xfe81('0x5'));var logger=require(_0xfe81('0x6'))(_0xfe81('0x7'));config[_0xfe81('0x8')]=_[_0xfe81('0x9')](config[_0xfe81('0x8')],{'host':_0xfe81('0xa'),'port':0x18eb});var io=require(_0xfe81('0xb'))(new Redis(config[_0xfe81('0x8')]));function emit(_0x3cb083,_0x363dda,_0x4473f8){io['to'](_0x3cb083)[_0xfe81('0xc')](_0x363dda,_0x4473f8);}var headers={'Content-Type':_0xfe81('0xd'),'Accept':_0xfe81('0xd')};function getTicket(_0x205a0f,_0x29f127,_0x17a70c,_0x35b15e,_0x3d6b2f){logger[_0xfe81('0xe')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xfe81('0xf')](_0xfe81('0x10'),_0x205a0f[_0xfe81('0x11')]),'method':_0xfe81('0x12'),'body':{'ticket':_[_0xfe81('0x13')]({'requester_id':_0x17a70c['id'],'submitter_id':_0x29f127?_0x29f127['id']:undefined,'assignee_id':_0x29f127?_0x29f127['id']:undefined,'tags':getTags(_0x35b15e[_0xfe81('0x14')],'name'),'subject':intUtil['getString'](_0x35b15e[_0xfe81('0x15')],_0x3d6b2f,'\x20'),'description':intUtil[_0xfe81('0x16')](_0x35b15e[_0xfe81('0x17')],_0x3d6b2f,'\x0a'),'comment':{'public':![],'body':intUtil[_0xfe81('0x16')](_0x35b15e['Descriptions'],_0x3d6b2f,'\x0a')}},getCustomFields(_0x35b15e[_0xfe81('0x18')],_0x3d6b2f))}})[_0xfe81('0x19')](function(_0xfe9404){logger['info']('Ticket\x20created!');return _0xfe9404[_0xfe81('0x1a')];});}function getUser(_0x30b825,_0x1d5848){if(intUtil[_0xfe81('0x1b')](_0x1d5848)){logger['info'](_0xfe81('0x1c'),_0x1d5848);return request({'uri':util[_0xfe81('0xf')](_0xfe81('0x1d'),_0x30b825[_0xfe81('0x11')]),'qs':{'query':util[_0xfe81('0xf')](_0xfe81('0x1e'),_0x1d5848)}})[_0xfe81('0x19')](function(_0x9b0849){if(_0x9b0849[_0xfe81('0x1f')]){logger[_0xfe81('0xe')](_0xfe81('0x20'));return _[_0xfe81('0x21')](_0x9b0849[_0xfe81('0x22')],{'email':_0x1d5848,'role':'agent'});}else{logger[_0xfe81('0xe')](_0xfe81('0x23'));return request({'uri':util['format'](_0xfe81('0x24'),_0x30b825[_0xfe81('0x11')])})['then'](function(_0x488094){logger[_0xfe81('0xe')]('Admin\x20account\x20selected.');return _0x488094['user'];});}});}else{logger[_0xfe81('0xe')](_0xfe81('0x23'));return request({'uri':util[_0xfe81('0xf')](_0xfe81('0x24'),_0x30b825['remoteUri'])})[_0xfe81('0x19')](function(_0xd0db90){logger[_0xfe81('0xe')](_0xfe81('0x25'));return _0xd0db90['user'];});}}function getEndUser(_0x2e2633,_0x4b835c,_0x16071b){logger[_0xfe81('0xe')](_0xfe81('0x26'),_0x16071b);return request({'uri':util[_0xfe81('0xf')]('%s/search.json',_0x2e2633['remoteUri']),'qs':{'query':util[_0xfe81('0xf')](_0xfe81('0x27'),_0x16071b)}})[_0xfe81('0x19')](function(_0x1eef0a){var _0x3cd268;if(_0x1eef0a[_0xfe81('0x22')]['length']){_0x1eef0a[_0xfe81('0x22')]=_[_0xfe81('0x28')](_0x1eef0a[_0xfe81('0x22')],{'suspended':![],'role':_0xfe81('0x29')});if(_0x1eef0a[_0xfe81('0x22')]['length']){_0x3cd268=_['first'](_0x1eef0a[_0xfe81('0x22')]);}}if(_0x3cd268){logger[_0xfe81('0xe')](_0xfe81('0x2a'));return _0x3cd268;}else{logger[_0xfe81('0xe')](_0xfe81('0x2b'));return request({'uri':util[_0xfe81('0xf')]('%s/users.json',_0x2e2633[_0xfe81('0x11')]),'method':'POST','body':{'user':{'role':_0xfe81('0x29'),'name':util[_0xfe81('0xf')](_0xfe81('0x2c'),_0x4b835c||_0x16071b),'phone':_0x16071b}}})['then'](function(_0x398889){logger[_0xfe81('0xe')]('Enduser\x20created.');return _0x398889['user'];});}});}function getAuth(_0x9ac682){var _0xd8d775;if(_0x9ac682[_0xfe81('0x2d')]===_0xfe81('0x2e')){_0xd8d775=util[_0xfe81('0xf')](_0xfe81('0x2f'),_0x9ac682[_0xfe81('0x30')],_0x9ac682[_0xfe81('0x2e')]);}else if(_0x9ac682[_0xfe81('0x2d')]===_0xfe81('0x31')){_0xd8d775=util[_0xfe81('0xf')](_0xfe81('0x32'),_0x9ac682[_0xfe81('0x30')],_0x9ac682['token']);}return util[_0xfe81('0xf')](_0xfe81('0x33'),new Buffer(_0xd8d775)[_0xfe81('0x34')](_0xfe81('0x35')));}function request(_0x2c0435){logger[_0xfe81('0x36')](_0xfe81('0x37'),JSON[_0xfe81('0x38')](_0x2c0435));return rp(_[_0xfe81('0x9')](_0x2c0435,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4cf9bf,_0x4cf8e3){var _0x16c583=[];if(_0x4cf9bf&&_0x4cf9bf[_0xfe81('0x39')]>0x0){_0x16c583=_[_0xfe81('0x3a')](_0x4cf9bf,_0x4cf8e3);}return _0x16c583;}function getCustomFields(_0x3940ad,_0x365278){var _0x528bd7=[];var _0x3ff903={'custom_fields':[]};if(_0x3940ad[_0xfe81('0x39')]>0x0){_[_0xfe81('0x3b')](_0x3940ad,function(_0x220166){if(_0x220166['type']===_0xfe81('0x3c')&&_0x220166[_0xfe81('0x3d')]&&!_0x220166[_0xfe81('0x3e')]){_0x3ff903[_0x220166[_0xfe81('0x3d')][_0xfe81('0x3f')]()]=_0x220166[_0xfe81('0x40')][_0xfe81('0x34')]();}else if(_0x220166[_0xfe81('0x41')]==='string'&&_0x220166[_0xfe81('0x42')]&&_0x220166[_0xfe81('0x3e')]){_0x3ff903[_0xfe81('0x43')]['push']({'id':_0x220166[_0xfe81('0x42')],'value':_0x220166[_0xfe81('0x40')][_0xfe81('0x34')]()});}else if(_0x220166['type']===_0xfe81('0x44')&&_0x220166[_0xfe81('0x45')]&&_0x220166[_0xfe81('0x42')]&&_0x220166[_0xfe81('0x3e')]){_0x365278[_0x220166['variableName']]&&_0x3ff903[_0xfe81('0x43')][_0xfe81('0x46')]({'id':_0x220166[_0xfe81('0x42')],'value':_0x365278[_0x220166[_0xfe81('0x45')]][_0xfe81('0x34')]()});}else if(_0x220166[_0xfe81('0x41')]===_0xfe81('0x47')&&_0x220166[_0xfe81('0x48')]&&_0x220166[_0xfe81('0x48')][_0xfe81('0x49')]&&_0x220166[_0xfe81('0x42')]&&_0x220166['customField']){_0x365278[_0x220166[_0xfe81('0x48')][_0xfe81('0x49')]['toLowerCase']()]&&_0x3ff903[_0xfe81('0x43')]['push']({'id':_0x220166[_0xfe81('0x42')],'value':_0x365278[_0x220166['Variable']['name'][_0xfe81('0x3f')]()]['toString']()});}});}return _0x3ff903;}exports[_0xfe81('0x4a')]=function(_0x43fa7f,_0x164b1f,_0x513cdf,_0x4f07bd,_0x16ac88,_0x2dc7a4){var _0x4e967e,_0x3e4abf;_0x2dc7a4['remoteUri']=intUtil[_0xfe81('0x4b')](_0x2dc7a4['remoteUri']);_0x2dc7a4[_0xfe81('0x4c')]=intUtil[_0xfe81('0x4b')](_0x2dc7a4[_0xfe81('0x4c')]);if(_0x16ac88&&_0x16ac88[_0xfe81('0x4d')]){logger[_0xfe81('0xe')](_0xfe81('0x4e'),_0xfe81('0x4f'));_0x164b1f[_0xfe81('0x50')]=util[_0xfe81('0xf')](_0xfe81('0x51'),_0x2dc7a4[_0xfe81('0x4c')],_0x164b1f['uniqueid'],md5(_0x164b1f['uniqueid']));}else{_0x164b1f['recordingURL']='';}headers[_0xfe81('0x52')]=getAuth(_0x2dc7a4);return getUser(_0x2dc7a4,_0x4f07bd[_0xfe81('0x53')])[_0xfe81('0x19')](function(_0x390f75){_0x4e967e=_0x390f75;logger[_0xfe81('0xe')](_0xfe81('0x54'),_0x4e967e['id']);return getEndUser(_0x2dc7a4,_0x164b1f[_0xfe81('0x55')],_0x164b1f[_0xfe81('0x56')]);})['then'](function(_0x58c115){_0x3e4abf=_0x58c115;logger['info']('The\x20Enduser\x20ID\x20is:',_0x3e4abf['id']);return getTicket(_0x2dc7a4,_0x4e967e,_0x3e4abf,_0x513cdf,_0x164b1f);})[_0xfe81('0x19')](function(_0x550074){if(_0x550074){logger[_0xfe81('0xe')](_0xfe81('0x57'),_0x550074['id']);switch(_0x2dc7a4['type']){case _0xfe81('0x58'):logger[_0xfe81('0xe')](_0xfe81('0x4e'),_0xfe81('0x59'));return request({'uri':util[_0xfe81('0xf')](_0xfe81('0x5a'),_0x2dc7a4['remoteUri'],_0x4e967e['id'],_0x550074['id']),'method':_0xfe81('0x12')});case _0xfe81('0x5b'):logger[_0xfe81('0xe')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfe81('0xf')](_0xfe81('0x5c'),_0x4f07bd[_0xfe81('0x49')]),_0xfe81('0x5d'),{'uri':util[_0xfe81('0xf')](_0xfe81('0x5e'),_0x2dc7a4['remoteUri']['replace'](_0xfe81('0x5f'),''),_0x550074['id'])});break;default:logger[_0xfe81('0x60')](_0xfe81('0x4e'),_0xfe81('0x61'));}}})['catch'](function(_0x4288fb){logger[_0xfe81('0x60')](_0xfe81('0x62'),util[_0xfe81('0x63')](_0x4288fb,{'showHidden':!![],'depth':null}));});};exports[_0xfe81('0x64')]=function(_0x58e833,_0x11930d,_0x18ee2a,_0x127737,_0x2d5d31,_0xefe0e0,_0x17586a){var _0x73ac67,_0xac4487;_0xefe0e0['remoteUri']=intUtil['stripTrailingSlash'](_0xefe0e0[_0xfe81('0x11')]);_0xefe0e0[_0xfe81('0x4c')]=intUtil['stripTrailingSlash'](_0xefe0e0[_0xfe81('0x4c')]);if(_0x17586a&&_0x17586a['recordingFormat']&&_0x17586a[_0xfe81('0x65')]!=='none'){logger[_0xfe81('0xe')](_0xfe81('0x66'),_0xfe81('0x4f'));_0x11930d['recordingURL']=util[_0xfe81('0xf')](_0xfe81('0x51'),_0xefe0e0['serverUrl'],_0x11930d['uniqueid'],md5(_0x11930d[_0xfe81('0x67')]));}headers[_0xfe81('0x52')]=getAuth(_0xefe0e0);return getUser(_0xefe0e0,_0x127737['email'])['then'](function(_0x4360d8){_0x73ac67=_0x4360d8;logger[_0xfe81('0xe')](_0xfe81('0x54'),_0x73ac67['id']);return getEndUser(_0xefe0e0,_0x11930d[_0xfe81('0x68')],_0x11930d[_0xfe81('0x69')]);})[_0xfe81('0x19')](function(_0x2d74a9){_0xac4487=_0x2d74a9;logger[_0xfe81('0xe')](_0xfe81('0x6a'),_0xac4487['id']);return getTicket(_0xefe0e0,_0x73ac67,_0xac4487,_0x18ee2a,_0x11930d);})[_0xfe81('0x19')](function(_0x205a48){if(_0x205a48){logger[_0xfe81('0xe')](_0xfe81('0x57'),_0x205a48['id']);switch(_0xefe0e0[_0xfe81('0x41')]){case _0xfe81('0x58'):logger[_0xfe81('0xe')](_0xfe81('0x66'),_0xfe81('0x59'));return request({'uri':util['format'](_0xfe81('0x5a'),_0xefe0e0[_0xfe81('0x11')],_0x73ac67['id'],_0x205a48['id']),'method':_0xfe81('0x12')});case _0xfe81('0x5b'):logger[_0xfe81('0xe')](_0xfe81('0x66'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfe81('0xf')](_0xfe81('0x5c'),_0x127737[_0xfe81('0x49')]),_0xfe81('0x5d'),{'uri':util[_0xfe81('0xf')]('%s/agent/tickets/%s',_0xefe0e0[_0xfe81('0x11')][_0xfe81('0x6b')](_0xfe81('0x5f'),''),_0x205a48['id'])});break;default:logger[_0xfe81('0x60')](_0xfe81('0x66'),_0xfe81('0x61'));}}})[_0xfe81('0x6c')](function(_0x5f1739){logger['error'](_0xfe81('0x6d'),util[_0xfe81('0x63')](_0x5f1739,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x3f3039,_0x85738c,_0x3187fd,_0x2cb876,_0x53d5c0,_0x5ceceb){var _0x456ec0,_0x1e2749;_0x5ceceb[_0xfe81('0x11')]=intUtil[_0xfe81('0x4b')](_0x5ceceb[_0xfe81('0x11')]);_0x5ceceb[_0xfe81('0x4c')]=intUtil[_0xfe81('0x4b')](_0x5ceceb[_0xfe81('0x4c')]);if(_0x53d5c0&&_0x53d5c0[_0xfe81('0x4d')]){logger[_0xfe81('0xe')]('['+_0x85738c['lastevent'][_0xfe81('0x6e')]()+']',_0xfe81('0x4f'));_0x85738c[_0xfe81('0x50')]=util[_0xfe81('0xf')](_0xfe81('0x51'),_0x5ceceb[_0xfe81('0x4c')],_0x85738c[_0xfe81('0x67')],md5(_0x85738c[_0xfe81('0x67')]));}else{_0x85738c[_0xfe81('0x50')]='';}headers[_0xfe81('0x52')]=getAuth(_0x5ceceb);return getUser(_0x5ceceb)[_0xfe81('0x19')](function(_0x2898f7){_0x456ec0=_0x2898f7;logger[_0xfe81('0xe')]('The\x20User\x20ID\x20is:',_0x456ec0['id']);return getEndUser(_0x5ceceb,_0x85738c[_0xfe81('0x55')],_0x85738c[_0xfe81('0x56')]);})[_0xfe81('0x19')](function(_0x494fdf){_0x1e2749=_0x494fdf;logger[_0xfe81('0xe')]('The\x20Enduser\x20ID\x20is:',_0x1e2749['id']);return getTicket(_0x5ceceb,_0x456ec0,_0x1e2749,_0x3187fd,_0x85738c);})['then'](function(_0x724087){if(_0x724087){logger['info'](_0xfe81('0x57'),_0x724087['id']);}})[_0xfe81('0x6c')](function(_0x239ac4){logger['error']('['+_0x85738c[_0xfe81('0x6f')]['toUpperCase']()+']'+_0xfe81('0x70'),util[_0xfe81('0x63')](_0x239ac4,{'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 b8bd5de..a9b1aa3 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 _0x7582=['outbound','agentcalledAt','Inbound','merge','Fields','/crm/v2/Calls','SUCCESS','err','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','host','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','uniqueid','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','unmanaged','toUpperCase','/api/voice/recordings/','request-promise','md5','util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','socket.io-emitter','emit','debug','[HTTP]','length','forEach','type','content','toString','variable','variableName','idField','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','refreshToken','clientId','clientSecret','refresh_token','then','seconds','catch','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','profile','Administrator','user','Using\x20the\x20admin\x20account!','error','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','POST','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','data','code','details','enduserType','startCase','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','lead','Leads','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','What_Id','First_Name','Last_Name','$se_module','Call_Duration','utc','talktime','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','timeout','Timeout','Call_Start_Time'];(function(_0x15f94f,_0x146f29){var _0x13f182=function(_0x250937){while(--_0x250937){_0x15f94f['push'](_0x15f94f['shift']());}};_0x13f182(++_0x146f29);}(_0x7582,0x167));var _0x2758=function(_0x5be795,_0x1cb1b8){_0x5be795=_0x5be795-0x0;var _0x4e8a3b=_0x7582[_0x5be795];return _0x4e8a3b;};'use strict';var _=require('lodash');var rp=require(_0x2758('0x0'));var md5=require(_0x2758('0x1'));var util=require(_0x2758('0x2'));var intUtil=require('./util');var moment=require(_0x2758('0x3'));var Redis=require('ioredis');var BPromise=require(_0x2758('0x4'));var config=require(_0x2758('0x5'));var logger=require(_0x2758('0x6'))(_0x2758('0x7'));config['redis']=_[_0x2758('0x8')](config[_0x2758('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x2758('0xa'))(new Redis(config[_0x2758('0x9')]));function emit(_0x556f88,_0x32a69c,_0x17af0b){io['to'](_0x556f88)[_0x2758('0xb')](_0x32a69c,_0x17af0b);}function request(_0x505c46){logger[_0x2758('0xc')](_0x2758('0xd'),JSON['stringify'](_0x505c46));return rp(_0x505c46);}function getCustomFields(_0x51fd3c,_0x32cf1a){var _0x1a9a45={};if(_0x51fd3c[_0x2758('0xe')]>0x0){_[_0x2758('0xf')](_0x51fd3c,function(_0x36cefd){if(_0x36cefd[_0x2758('0x10')]==='string'&&_0x36cefd['idField']){_0x1a9a45[_0x36cefd['idField']]=_0x36cefd[_0x2758('0x11')][_0x2758('0x12')]();}else if(_0x36cefd[_0x2758('0x10')]===_0x2758('0x13')&&_0x36cefd[_0x2758('0x14')]&&_0x36cefd[_0x2758('0x15')]&&_0x32cf1a[_0x36cefd[_0x2758('0x14')]]){_0x1a9a45[_0x36cefd[_0x2758('0x15')]]=_0x32cf1a[_0x36cefd[_0x2758('0x14')]][_0x2758('0x12')]();}else if(_0x36cefd[_0x2758('0x10')]===_0x2758('0x16')&&_0x36cefd[_0x2758('0x17')]&&_0x36cefd[_0x2758('0x17')]['name']&&_0x36cefd['idField']&&_0x32cf1a[_0x36cefd['Variable'][_0x2758('0x18')][_0x2758('0x19')]()]){_0x1a9a45[_0x36cefd[_0x2758('0x15')]]=_0x32cf1a[_0x36cefd[_0x2758('0x17')][_0x2758('0x18')][_0x2758('0x19')]()]['toString']();}});}return _0x1a9a45;}function getName(_0x15f7b7){if(_0x15f7b7[_0x2758('0x1a')]('\x20')>0x0){var _0x596ca1=_0x15f7b7[_0x2758('0x1b')](/ (.+)/);if(_0x596ca1[0x1]){return _0x596ca1;}}return[_0x15f7b7,_0x15f7b7];}var accountsTokens={};function getAccessToken(_0x1cdc63){return new Promise(function(_0x8cfe47,_0x4100a0){if(!_['isNil'](accountsTokens[_0x1cdc63['id']])&&!_[_0x2758('0x1c')](accountsTokens[_0x1cdc63['id']]['access_token'])){if(moment()[_0x2758('0x1d')](accountsTokens[_0x1cdc63['id']][_0x2758('0x1e')])){_0x8cfe47(accountsTokens[_0x1cdc63['id']][_0x2758('0x1f')]);}}var _0x2797fe;switch(_0x1cdc63[_0x2758('0x20')]){case'US':_0x2797fe=_0x2758('0x21');break;case'AU':_0x2797fe=_0x2758('0x22');break;case'EU':_0x2797fe=_0x2758('0x23');break;case'IN':_0x2797fe=_0x2758('0x24');break;case'CN':_0x2797fe=_0x2758('0x25');break;default:_0x2797fe=_0x2758('0x23');break;}var _0x43e8ef={'method':'POST','uri':_0x2797fe+'/oauth/v2/token','qs':{'refresh_token':_0x1cdc63[_0x2758('0x26')],'client_id':_0x1cdc63[_0x2758('0x27')],'client_secret':_0x1cdc63[_0x2758('0x28')],'grant_type':_0x2758('0x29')},'json':!![]};return rp(_0x43e8ef)[_0x2758('0x2a')](function(_0x38f67d){accountsTokens[_0x1cdc63['id']]={'access_token':_0x38f67d['access_token'],'expires_in':moment()['add'](_0x38f67d[_0x2758('0x1e')],_0x2758('0x2b'))};_0x8cfe47(_0x38f67d[_0x2758('0x1f')]);})[_0x2758('0x2c')](function(_0x4d96d5){logger['error'](_0x2758('0x2d'),_0x4d96d5[_0x2758('0x2e')]);_0x4100a0(_0x4d96d5);});});}function getUser(_0x46498b,_0x5179ef,_0x1d5f88,_0x4b20ee){logger[_0x2758('0x2f')](_0x2758('0x30'));return request({'method':_0x2758('0x31'),'uri':util[_0x2758('0x32')](_0x2758('0x33'),_0x5179ef),'qs':{'type':_0x2758('0x34')},'headers':{'Authorization':_0x2758('0x35')+_0x46498b},'json':!![]})[_0x2758('0x2a')](function(_0x225f6f){if(_0x225f6f[_0x2758('0x36')]){var _0x4f48f9=-0x1;if(_[_0x2758('0x37')](_0x225f6f[_0x2758('0x36')])){if(!_[_0x2758('0x1c')](_0x4b20ee)){_0x4f48f9=_[_0x2758('0x38')](_0x225f6f['users'],function(_0x5f105f){return _0x5f105f[_0x2758('0x39')]===_0x4b20ee;});}if(_0x4f48f9>=0x0){logger[_0x2758('0x2f')]('Agent\x20found!');}else{logger[_0x2758('0x2f')]('Using\x20the\x20admin\x20account!');_0x4f48f9=_[_0x2758('0x38')](_0x225f6f['users'],function(_0x2952ad){return _0x2952ad[_0x2758('0x3a')]['name']===_0x2758('0x3b');});}return _0x225f6f[_0x2758('0x36')][_0x4f48f9];}else{if(_0x225f6f[_0x2758('0x3c')][_0x2758('0x3a')][_0x2758('0x18')]===_0x2758('0x3b')){logger[_0x2758('0x2f')](_0x2758('0x3d'));user=_0x225f6f['user'];return user;}else{logger[_0x2758('0x3e')](_0x2758('0x3f'),JSON[_0x2758('0x40')](_0x225f6f));throw new Error(_0x2758('0x41')+JSON[_0x2758('0x40')](_0x225f6f));}}}else{logger[_0x2758('0x3e')](_0x2758('0x3f'),JSON[_0x2758('0x40')](_0x225f6f));throw new Error(_0x2758('0x41')+JSON['stringify'](_0x225f6f));}})['catch'](function(_0x162244){console[_0x2758('0x3e')](_0x162244);});}function getZohoUser(_0x25d115,_0x2c3aab){return new BPromise(function(_0x40e2a5,_0x33c595){request(_0x25d115)['then'](function(_0x2c3acf){var _0x22be65=null;if(_0x2c3acf){_0x22be65=_0x2c3acf['data'][0x0];_0x22be65['enduserType']=_0x2c3aab;}_0x40e2a5(_0x22be65);})['catch'](function(_0x17fa30){_0x33c595(_0x17fa30);});});}function createEndUser(_0x30f463,_0x1c4c0d,_0x44d6e5,_0x564462,_0x345e02,_0x914b53){var _0x44d6e5=getName(_0x44d6e5);return request({'method':_0x2758('0x42'),'uri':_0x2758('0x43')+_0x1c4c0d+_0x2758('0x44')+_['startCase'](_0x914b53[_0x2758('0x45')])+'s','body':{'data':[{'Last_Name':_0x44d6e5[0x1],'First_Name':_0x44d6e5[0x0],'Phone':_0x564462,'Owner':{'name':!_[_0x2758('0x1c')](_0x345e02[_0x2758('0x46')][_0x2758('0x18')])?_0x345e02[_0x2758('0x46')][_0x2758('0x18')]:!_[_0x2758('0x1c')](_0x345e02[_0x2758('0x47')])?_0x345e02[_0x2758('0x47')]+'\x20'+_0x345e02['last_name']:_0x345e02['last_name'],'id':_0x345e02['id']}}]},'headers':{'Authorization':_0x2758('0x35')+_0x30f463},'json':!![]})[_0x2758('0x2a')](function(_0x562b0b){if(_0x562b0b&&_0x562b0b[_0x2758('0x48')][0x0][_0x2758('0x49')]==='SUCCESS'){var _0x86c3a8=_0x562b0b[_0x2758('0x48')][0x0][_0x2758('0x4a')];_0x86c3a8[_0x2758('0x4b')]=_[_0x2758('0x4c')](_0x914b53['moduleCreate'])+'s';return _0x86c3a8;}logger['error']('The\x20failing\x20result\x20is',JSON[_0x2758('0x40')](data));throw new Error(_0x2758('0x4d')+JSON[_0x2758('0x40')](data));})[_0x2758('0x2c')](function(_0x336cf7){console[_0x2758('0x4e')](_0x2758('0x4f'),_0x336cf7);});}function getEndUser(_0x375020,_0x4da662,_0x57f265,_0xf1539c,_0x4e7365,_0xcc9538,_0x4ffcff){var _0x4f0fe5={'method':_0x2758('0x31'),'uri':'','headers':{'Authorization':_0x2758('0x35')+_0x375020},'json':!![]};switch(_0x4ffcff['moduleSearch']){case _0x2758('0x50'):_0x4f0fe5[_0x2758('0x51')]=_0x2758('0x43')+_0x4da662+_0x2758('0x52')+_0x4e7365+'))';return getZohoUser(_0x4f0fe5,_0x2758('0x53'))[_0x2758('0x2a')](function(_0x2ad215){if(_0x2ad215)return _0x2ad215;_0x4f0fe5[_0x2758('0x51')]=_0x2758('0x43')+_0x4da662+_0x2758('0x54')+_0x4e7365+'))';return getZohoUser(_0x4f0fe5,'Leads')['then'](function(_0x23e880){if(_0x23e880)return _0x23e880;if(_0x4ffcff[_0x2758('0x45')]!=_0x2758('0x55')){return createEndUser(_0x375020,_0x4da662,_0xf1539c,_0x4e7365,_0xcc9538,_0x4ffcff);}else{return{};}});});break;case _0x2758('0x56'):_0x4f0fe5[_0x2758('0x51')]='https://www.zohoapis.'+_0x4da662+_0x2758('0x52')+_0x4e7365+'))';return getZohoUser(_0x4f0fe5,'Contacts')[_0x2758('0x2a')](function(_0x264a11){if(_0x264a11)return _0x264a11;if(_0x4ffcff[_0x2758('0x45')]!=_0x2758('0x55')){return createEndUser(_0x375020,_0x4da662,_0xf1539c,_0x4e7365,_0xcc9538,_0x4ffcff);}else{return{};}});break;case _0x2758('0x57'):_0x4f0fe5['uri']=_0x2758('0x43')+_0x4da662+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4e7365+'))';return getZohoUser(_0x4f0fe5,_0x2758('0x58'))[_0x2758('0x2a')](function(_0x514e96){if(_0x514e96)return _0x514e96;if(_0x4ffcff[_0x2758('0x45')]!=_0x2758('0x55')){return createEndUser(_0x375020,_0x4da662,_0xf1539c,_0x4e7365,_0xcc9538,_0x4ffcff);}else{return{};}});break;}}function getCall(_0x1c2e2c,_0x1ff3b2,_0x20649c,_0x2b0366,_0x2496bc,_0x5ced39,_0x287f16,_0xa72f96){logger[_0x2758('0x2f')]('Creating\x20new\x20call...');var _0x5b1b01={};_0x5b1b01[_0x2758('0x59')]={'name':!_[_0x2758('0x1c')](_0x2b0366[_0x2758('0x46')]['name'])&&!_[_0x2758('0x1c')](_0x2b0366[_0x2758('0x3a')]['name'])&&_0x2b0366[_0x2758('0x3a')][_0x2758('0x18')]===_0x2758('0x5a')?_0x2b0366['role'][_0x2758('0x18')]:!_[_0x2758('0x1c')](_0x2b0366[_0x2758('0x47')])?_0x2b0366[_0x2758('0x47')]+'\x20'+_0x2b0366['last_name']:_0x2b0366['last_name'],'id':_0x2b0366['id']};_0x5b1b01[_0x2758('0x5b')]=intUtil[_0x2758('0x5c')](_0x5ced39[_0x2758('0x5d')],_0x287f16,'\x20');_0x5b1b01[_0x2758('0x5e')]=intUtil[_0x2758('0x5c')](_0x5ced39[_0x2758('0x5f')],_0x287f16,'\x0a');if(_0x2496bc[_0x2758('0x4b')]==='Contacts'){_0x5b1b01[_0x2758('0x60')]={'name':!_[_0x2758('0x1c')](_0x2496bc[_0x2758('0x61')])?_0x2496bc[_0x2758('0x61')]:!_[_0x2758('0x1c')](_0x2496bc['First_Name'])?_0x2496bc['First_Name']+'\x20'+_0x2496bc['Last_Name']:_0x2496bc['Last_Name'],'id':_0x2496bc['id']};}if(_0x2496bc['enduserType']===_0x2758('0x58')){_0x5b1b01[_0x2758('0x62')]={'name':!_['isNil'](_0x2496bc[_0x2758('0x61')])?_0x2496bc[_0x2758('0x61')]:!_[_0x2758('0x1c')](_0x2496bc['First_Name'])?_0x2496bc[_0x2758('0x63')]+'\x20'+_0x2496bc[_0x2758('0x64')]:_0x2496bc[_0x2758('0x64')],'id':_0x2496bc['id']};_0x5b1b01[_0x2758('0x65')]=_['startCase'](_0x2496bc['enduserType']);}if(_0x287f16['talktime']){_0x5b1b01[_0x2758('0x66')]=moment[_0x2758('0x67')](parseInt(_0x287f16[_0x2758('0x68')])*0x3e8)[_0x2758('0x32')]('mm:ss');}else if(_0x287f16[_0x2758('0x69')]&&_0x287f16[_0x2758('0x6a')]){_0x5b1b01[_0x2758('0x66')]=moment['utc'](moment(_0x287f16[_0x2758('0x6a')],_0x2758('0x6b'))[_0x2758('0x6c')](moment(_0x287f16[_0x2758('0x6d')],'YYYY-MM-DDTHH:mm:ss')))[_0x2758('0x32')](_0x2758('0x6e'));}switch(_0x287f16[_0x2758('0x6f')]){case _0x2758('0x70'):_0x5b1b01[_0x2758('0x71')]=_0x2758('0x72');break;case _0x2758('0x73'):case _0x2758('0x74'):_0x5b1b01[_0x2758('0x71')]=_0x2758('0x75');break;case _0x2758('0x76'):_0x5b1b01[_0x2758('0x71')]=_0x2758('0x77');break;case _0x2758('0x78'):_0x5b1b01[_0x2758('0x71')]='Abandoned';break;case _0x2758('0x79'):_0x5b1b01[_0x2758('0x71')]=_0x2758('0x7a');default:}_0x5b1b01[_0x2758('0x7b')]=(_0xa72f96===_0x2758('0x7c')?moment(_0x287f16['starttime'])[_0x2758('0x32')](_0x2758('0x6b')):moment(_0x287f16[_0x2758('0x7d')])[_0x2758('0x32')](_0x2758('0x6b')))||moment()[_0x2758('0x32')](_0x2758('0x6b'));_0x5b1b01['Call_Type']=_0xa72f96||_0x2758('0x7e');_0x5b1b01=_[_0x2758('0x7f')](_0x5b1b01,getCustomFields(_0x5ced39[_0x2758('0x80')],_0x287f16));return request({'method':_0x2758('0x42'),'uri':_0x2758('0x43')+_0x1ff3b2+_0x2758('0x81'),'headers':{'Authorization':_0x2758('0x35')+_0x1c2e2c},'body':{'data':[_0x5b1b01]},'json':!![]})[_0x2758('0x2a')](function(_0x4d739c){if(_0x4d739c&&_0x4d739c[_0x2758('0x48')][0x0][_0x2758('0x49')]===_0x2758('0x82')){logger[_0x2758('0x2f')]('Call\x20created!');return{'id':_0x4d739c[_0x2758('0x48')][0x0][_0x2758('0x4a')]['id']};}})['catch'](function(_0x7e53c3){logger[_0x2758('0x2f')]('err',_0x7e53c3[_0x2758('0x2e')]);console[_0x2758('0x4e')](_0x2758('0x83'),_0x7e53c3);});}exports[_0x2758('0x84')]=function(_0x56a84c,_0x134c04,_0x4a65ef,_0x54d466,_0x4538ed,_0x3e5f5f){var _0x1c3cc2,_0x21d601,_0x4191c3;_0x3e5f5f['host']=intUtil[_0x2758('0x85')](_0x3e5f5f['host']);_0x3e5f5f[_0x2758('0x86')]=intUtil[_0x2758('0x85')](_0x3e5f5f[_0x2758('0x86')]);if(_0x4538ed&&_0x4538ed[_0x2758('0x87')]){logger[_0x2758('0x2f')](_0x2758('0x88'),_0x2758('0x89'));_0x134c04[_0x2758('0x8a')]=_0x3e5f5f['serverUrl']+'/api/voice/recordings/'+_0x134c04['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x134c04['uniqueid']);}else{_0x134c04[_0x2758('0x8a')]='';}var _0x3f4eaf=_0x3e5f5f[_0x2758('0x8b')]===_0x2758('0x8c')?'eu':_0x2758('0x8d');return getAccessToken(_0x3e5f5f)[_0x2758('0x2a')](function(_0x3ccffc){_0x4191c3=_0x3ccffc;return getUser(_0x4191c3,_0x3f4eaf,_0x3e5f5f,_0x54d466[_0x2758('0x39')]);})['then'](function(_0x1cdb9e){_0x1c3cc2=_0x1cdb9e;logger[_0x2758('0x2f')](_0x2758('0x8e'),_0x1c3cc2['id']);return getEndUser(_0x4191c3,_0x3f4eaf,_0x3e5f5f,_0x134c04[_0x2758('0x8f')],_0x134c04[_0x2758('0x90')],_0x1c3cc2,_0x4a65ef);})[_0x2758('0x2a')](function(_0x217724){_0x21d601=_0x217724;return getCall(_0x4191c3,_0x3f4eaf,_0x3e5f5f,_0x1c3cc2,_0x21d601,_0x4a65ef,_0x134c04,_0x2758('0x7e'));})[_0x2758('0x2a')](function(_0x1b72d5){if(_0x1b72d5){logger[_0x2758('0x2f')](_0x2758('0x91'),_0x1b72d5['id']);logger[_0x2758('0x2f')]('[QUEUE]',_0x2758('0x92'));emit(util[_0x2758('0x32')](_0x2758('0x93'),_0x54d466['name']),_0x2758('0x94'),{'uri':_0x2758('0x95')+_0x3e5f5f[_0x2758('0x8b')]+_0x2758('0x96')+_0x1b72d5['id']});}})[_0x2758('0x2c')](function(_0x3363b8){logger[_0x2758('0x3e')](_0x2758('0x88'),JSON[_0x2758('0x40')](_0x3363b8));});};exports[_0x2758('0x7c')]=function(_0x33ba1c,_0xee0b0a,_0x497684,_0xb51edc,_0x37ff42,_0x31292c,_0x1517c6){var _0x4e658c,_0x472068,_0x432fff;_0x31292c['host']=intUtil[_0x2758('0x85')](_0x31292c[_0x2758('0x8b')]);_0x31292c[_0x2758('0x86')]=intUtil[_0x2758('0x85')](_0x31292c[_0x2758('0x86')]);if(_0x1517c6&&_0x1517c6[_0x2758('0x97')]&&_0x1517c6[_0x2758('0x97')]!==_0x2758('0x98')){logger[_0x2758('0x2f')](_0x2758('0x99'),_0x2758('0x89'));_0xee0b0a[_0x2758('0x8a')]=_0x31292c[_0x2758('0x86')]+'/api/voice/recordings/'+_0xee0b0a[_0x2758('0x9a')]+_0x2758('0x9b')+md5(_0xee0b0a['uniqueid']);}var _0x1a0895=_0x31292c[_0x2758('0x8b')]===_0x2758('0x8c')?'eu':_0x2758('0x8d');return getAccessToken(_0x31292c)[_0x2758('0x2a')](function(_0x3f7978){_0x432fff=_0x3f7978;return getUser(_0x432fff,_0x1a0895,_0x31292c,_0xb51edc[_0x2758('0x39')]);})[_0x2758('0x2a')](function(_0x6c2fe8){_0x4e658c=_0x6c2fe8;logger[_0x2758('0x2f')](_0x2758('0x8e'),_0x4e658c['id']);return getEndUser(_0x432fff,_0x1a0895,_0x31292c,_0xee0b0a[_0x2758('0x9c')],_0xee0b0a[_0x2758('0x9d')],_0x4e658c,_0x497684);})[_0x2758('0x2a')](function(_0x308234){_0x472068=_0x308234;return getCall(_0x432fff,_0x1a0895,_0x31292c,_0x4e658c,_0x472068,_0x497684,_0xee0b0a,'Outbound');})[_0x2758('0x2a')](function(_0xae741c){if(_0xae741c){logger[_0x2758('0x2f')](_0x2758('0x91'),_0xae741c['id']);logger[_0x2758('0x2f')](_0x2758('0x99'),_0x2758('0x92'));emit(util['format']('user:%s',_0xb51edc[_0x2758('0x18')]),_0x2758('0x94'),{'uri':_0x2758('0x95')+_0x31292c[_0x2758('0x8b')]+_0x2758('0x96')+_0xae741c['id']});}})['catch'](function(_0x1ea861){logger[_0x2758('0x3e')](_0x2758('0x99'),JSON['stringify'](_0x1ea861));});};exports[_0x2758('0x9e')]=function(_0x5ea530,_0x29cddf,_0x165b8f,_0x888e1a,_0x2fff8b,_0x8519b3){var _0x10f4e6,_0x4003ae,_0x50f743;_0x8519b3[_0x2758('0x8b')]=intUtil[_0x2758('0x85')](_0x8519b3[_0x2758('0x8b')]);_0x8519b3[_0x2758('0x86')]=intUtil['stripTrailingSlash'](_0x8519b3[_0x2758('0x86')]);if(_0x2fff8b&&_0x2fff8b[_0x2758('0x87')]){logger[_0x2758('0x2f')]('['+_0x29cddf[_0x2758('0x6f')][_0x2758('0x9f')]()+']',_0x2758('0x89'));_0x29cddf['recordingURL']=_0x8519b3[_0x2758('0x86')]+_0x2758('0xa0')+_0x29cddf['uniqueid']+_0x2758('0x9b')+md5(_0x29cddf[_0x2758('0x9a')]);}else{_0x29cddf[_0x2758('0x8a')]='';}var _0x36c849=_0x8519b3['host']===_0x2758('0x8c')?'eu':_0x2758('0x8d');return getAccessToken(_0x8519b3)['then'](function(_0x1301a2){_0x50f743=_0x1301a2;return getUser(_0x50f743,_0x36c849,_0x8519b3);})['then'](function(_0x3edb50){_0x10f4e6=_0x3edb50;logger['info'](_0x2758('0x8e'),_0x10f4e6['id']);return getEndUser(_0x50f743,_0x36c849,_0x8519b3,_0x29cddf['calleridname'],_0x29cddf[_0x2758('0x90')],_0x10f4e6,_0x165b8f);})[_0x2758('0x2a')](function(_0x41f63e){_0x4003ae=_0x41f63e;return getCall(_0x50f743,_0x36c849,_0x8519b3,_0x10f4e6,_0x4003ae,_0x165b8f,_0x29cddf,_0x2758('0x7e'));})[_0x2758('0x2a')](function(_0x43e530){if(_0x43e530){logger[_0x2758('0x2f')](_0x2758('0x91'),_0x43e530['id']);}})[_0x2758('0x2c')](function(_0x22e8bb){logger[_0x2758('0x3e')]('['+_0x29cddf[_0x2758('0x6f')][_0x2758('0x9f')]()+']',JSON['stringify'](_0x22e8bb));});}; \ No newline at end of file +var _0x29b1=['Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','connect','Answered','rejected','Rejected','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','merge','Fields','/crm/v2/Calls','SUCCESS','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','unmanaged','toUpperCase','lodash','request-promise','md5','util','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','[HTTP]','forEach','type','string','toString','variable','variableName','idField','customVariable','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','/oauth/v2/token','refreshToken','refresh_token','then','add','seconds','error','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','profile','Administrator','user','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','stringify','catch','data','enduserType','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','details','log','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','administrator','Subject','getString','Subjects','Description'];(function(_0xd3f921,_0x2cf698){var _0x21a715=function(_0x4796d4){while(--_0x4796d4){_0xd3f921['push'](_0xd3f921['shift']());}};_0x21a715(++_0x2cf698);}(_0x29b1,0x16d));var _0x129b=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x29b1[_0x3c4737];return _0x2bb926;};'use strict';var _=require(_0x129b('0x0'));var rp=require(_0x129b('0x1'));var md5=require(_0x129b('0x2'));var util=require(_0x129b('0x3'));var intUtil=require(_0x129b('0x4'));var moment=require('moment');var Redis=require(_0x129b('0x5'));var BPromise=require(_0x129b('0x6'));var config=require(_0x129b('0x7'));var logger=require(_0x129b('0x8'))(_0x129b('0x9'));config[_0x129b('0xa')]=_[_0x129b('0xb')](config[_0x129b('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x129b('0xc'))(new Redis(config['redis']));function emit(_0x2c99a1,_0x1e29d6,_0x5f384b){io['to'](_0x2c99a1)[_0x129b('0xd')](_0x1e29d6,_0x5f384b);}function request(_0x1abf45){logger['debug'](_0x129b('0xe'),JSON['stringify'](_0x1abf45));return rp(_0x1abf45);}function getCustomFields(_0x1ce048,_0x2f1137){var _0x376bb3={};if(_0x1ce048['length']>0x0){_[_0x129b('0xf')](_0x1ce048,function(_0x443edf){if(_0x443edf[_0x129b('0x10')]===_0x129b('0x11')&&_0x443edf['idField']){_0x376bb3[_0x443edf['idField']]=_0x443edf['content'][_0x129b('0x12')]();}else if(_0x443edf['type']===_0x129b('0x13')&&_0x443edf[_0x129b('0x14')]&&_0x443edf[_0x129b('0x15')]&&_0x2f1137[_0x443edf['variableName']]){_0x376bb3[_0x443edf[_0x129b('0x15')]]=_0x2f1137[_0x443edf['variableName']][_0x129b('0x12')]();}else if(_0x443edf[_0x129b('0x10')]===_0x129b('0x16')&&_0x443edf['Variable']&&_0x443edf[_0x129b('0x17')][_0x129b('0x18')]&&_0x443edf[_0x129b('0x15')]&&_0x2f1137[_0x443edf[_0x129b('0x17')][_0x129b('0x18')][_0x129b('0x19')]()]){_0x376bb3[_0x443edf[_0x129b('0x15')]]=_0x2f1137[_0x443edf[_0x129b('0x17')][_0x129b('0x18')][_0x129b('0x19')]()][_0x129b('0x12')]();}});}return _0x376bb3;}function getName(_0xc60027){if(_0xc60027['indexOf']('\x20')>0x0){var _0x2c2990=_0xc60027[_0x129b('0x1a')](/ (.+)/);if(_0x2c2990[0x1]){return _0x2c2990;}}return[_0xc60027,_0xc60027];}var accountsTokens={};function getAccessToken(_0x15a5cb){return new Promise(function(_0x338428,_0x2dcaa1){if(!_[_0x129b('0x1b')](accountsTokens[_0x15a5cb['id']])&&!_[_0x129b('0x1b')](accountsTokens[_0x15a5cb['id']][_0x129b('0x1c')])){if(moment()[_0x129b('0x1d')](accountsTokens[_0x15a5cb['id']][_0x129b('0x1e')])){_0x338428(accountsTokens[_0x15a5cb['id']][_0x129b('0x1c')]);}}var _0x19b23b;switch(_0x15a5cb['zone']){case'US':_0x19b23b=_0x129b('0x1f');break;case'AU':_0x19b23b=_0x129b('0x20');break;case'EU':_0x19b23b=_0x129b('0x21');break;case'IN':_0x19b23b=_0x129b('0x22');break;case'CN':_0x19b23b='https://accounts.zoho.com.cn';break;default:_0x19b23b='https://accounts.zoho.eu';break;}var _0x31bccc={'method':'POST','uri':_0x19b23b+_0x129b('0x23'),'qs':{'refresh_token':_0x15a5cb[_0x129b('0x24')],'client_id':_0x15a5cb['clientId'],'client_secret':_0x15a5cb['clientSecret'],'grant_type':_0x129b('0x25')},'json':!![]};return rp(_0x31bccc)[_0x129b('0x26')](function(_0x2c7243){accountsTokens[_0x15a5cb['id']]={'access_token':_0x2c7243[_0x129b('0x1c')],'expires_in':moment()[_0x129b('0x27')](_0x2c7243[_0x129b('0x1e')],_0x129b('0x28'))};_0x338428(_0x2c7243[_0x129b('0x1c')]);})['catch'](function(_0x275ff0){logger[_0x129b('0x29')]('Failing\x20creating\x20the\x20access_token',_0x275ff0[_0x129b('0x2a')]);_0x2dcaa1(_0x275ff0);});});}function getUser(_0x519053,_0x4179e1,_0x4d1017,_0x204e67){logger[_0x129b('0x2b')](_0x129b('0x2c'));return request({'method':_0x129b('0x2d'),'uri':util[_0x129b('0x2e')](_0x129b('0x2f'),_0x4179e1),'qs':{'type':_0x129b('0x30')},'headers':{'Authorization':_0x129b('0x31')+_0x519053},'json':!![]})[_0x129b('0x26')](function(_0x501e01){if(_0x501e01[_0x129b('0x32')]){var _0x1eaa39=-0x1;if(_['isArrayLikeObject'](_0x501e01[_0x129b('0x32')])){if(!_[_0x129b('0x1b')](_0x204e67)){_0x1eaa39=_[_0x129b('0x33')](_0x501e01['users'],function(_0x17e5ed){return _0x17e5ed[_0x129b('0x34')]===_0x204e67;});}if(_0x1eaa39>=0x0){logger['info']('Agent\x20found!');}else{logger[_0x129b('0x2b')]('Using\x20the\x20admin\x20account!');_0x1eaa39=_[_0x129b('0x33')](_0x501e01['users'],function(_0x15b01c){return _0x15b01c[_0x129b('0x35')]['name']===_0x129b('0x36');});}return _0x501e01[_0x129b('0x32')][_0x1eaa39];}else{if(_0x501e01[_0x129b('0x37')]['profile'][_0x129b('0x18')]===_0x129b('0x36')){logger[_0x129b('0x2b')](_0x129b('0x38'));user=_0x501e01['user'];return user;}else{logger['error'](_0x129b('0x39'),JSON[_0x129b('0x3a')](_0x501e01));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x129b('0x3a')](_0x501e01));}}}else{logger[_0x129b('0x29')](_0x129b('0x39'),JSON['stringify'](_0x501e01));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x129b('0x3a')](_0x501e01));}})[_0x129b('0x3b')](function(_0x38ffba){console['error'](_0x38ffba);});}function getZohoUser(_0x25569f,_0x2588e3){return new BPromise(function(_0x536aa3,_0xf2da76){request(_0x25569f)[_0x129b('0x26')](function(_0x4e5410){var _0x4b4b8b=null;if(_0x4e5410){_0x4b4b8b=_0x4e5410[_0x129b('0x3c')][0x0];_0x4b4b8b[_0x129b('0x3d')]=_0x2588e3;}_0x536aa3(_0x4b4b8b);})[_0x129b('0x3b')](function(_0x2169b3){_0xf2da76(_0x2169b3);});});}function createEndUser(_0x40421d,_0x38cdd6,_0x3a33d7,_0x5700b3,_0x52d05b,_0x529c92){var _0x3a33d7=getName(_0x3a33d7);return request({'method':_0x129b('0x3e'),'uri':_0x129b('0x3f')+_0x38cdd6+_0x129b('0x40')+_[_0x129b('0x41')](_0x529c92[_0x129b('0x42')])+'s','body':{'data':[{'Last_Name':_0x3a33d7[0x1],'First_Name':_0x3a33d7[0x0],'Phone':_0x5700b3,'Owner':{'name':!_[_0x129b('0x1b')](_0x52d05b['role']['name'])?_0x52d05b[_0x129b('0x43')]['name']:!_[_0x129b('0x1b')](_0x52d05b[_0x129b('0x44')])?_0x52d05b[_0x129b('0x44')]+'\x20'+_0x52d05b[_0x129b('0x45')]:_0x52d05b['last_name'],'id':_0x52d05b['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x40421d},'json':!![]})['then'](function(_0x40f8ab){if(_0x40f8ab&&_0x40f8ab['data'][0x0][_0x129b('0x46')]==='SUCCESS'){var _0x3ffe01=_0x40f8ab['data'][0x0][_0x129b('0x47')];_0x3ffe01[_0x129b('0x3d')]=_[_0x129b('0x41')](_0x529c92[_0x129b('0x42')])+'s';return _0x3ffe01;}logger[_0x129b('0x29')](_0x129b('0x39'),JSON['stringify'](data));throw new Error('Error:\x20'+JSON['stringify'](data));})[_0x129b('0x3b')](function(_0x115918){console[_0x129b('0x48')]('CREATE\x20ERROR',_0x115918);});}function getEndUser(_0x4be890,_0x41ef9e,_0x2233da,_0x3b9251,_0x403d6b,_0x37943f,_0x123562){var _0x4ca77b={'method':_0x129b('0x2d'),'uri':'','headers':{'Authorization':_0x129b('0x31')+_0x4be890},'json':!![]};switch(_0x123562['moduleSearch']){case _0x129b('0x49'):_0x4ca77b[_0x129b('0x4a')]=_0x129b('0x3f')+_0x41ef9e+_0x129b('0x4b')+_0x403d6b+'))';return getZohoUser(_0x4ca77b,_0x129b('0x4c'))[_0x129b('0x26')](function(_0x42ba1e){if(_0x42ba1e)return _0x42ba1e;_0x4ca77b[_0x129b('0x4a')]=_0x129b('0x3f')+_0x41ef9e+_0x129b('0x4d')+_0x403d6b+'))';return getZohoUser(_0x4ca77b,_0x129b('0x4e'))[_0x129b('0x26')](function(_0xef06f){if(_0xef06f)return _0xef06f;if(_0x123562[_0x129b('0x42')]!=_0x129b('0x4f')){return createEndUser(_0x4be890,_0x41ef9e,_0x3b9251,_0x403d6b,_0x37943f,_0x123562);}else{return{};}});});break;case _0x129b('0x50'):_0x4ca77b[_0x129b('0x4a')]=_0x129b('0x3f')+_0x41ef9e+_0x129b('0x4b')+_0x403d6b+'))';return getZohoUser(_0x4ca77b,_0x129b('0x4c'))['then'](function(_0xb1e56e){if(_0xb1e56e)return _0xb1e56e;if(_0x123562[_0x129b('0x42')]!=_0x129b('0x4f')){return createEndUser(_0x4be890,_0x41ef9e,_0x3b9251,_0x403d6b,_0x37943f,_0x123562);}else{return{};}});break;case _0x129b('0x51'):_0x4ca77b['uri']='https://www.zohoapis.'+_0x41ef9e+_0x129b('0x4d')+_0x403d6b+'))';return getZohoUser(_0x4ca77b,_0x129b('0x4e'))[_0x129b('0x26')](function(_0x5a5cb4){if(_0x5a5cb4)return _0x5a5cb4;if(_0x123562['moduleCreate']!=_0x129b('0x4f')){return createEndUser(_0x4be890,_0x41ef9e,_0x3b9251,_0x403d6b,_0x37943f,_0x123562);}else{return{};}});break;}}function getCall(_0x2c8b9c,_0x59e7ed,_0x2cdfd4,_0x2a77d1,_0x42c103,_0x527cb5,_0x2ef589,_0x4590a9){logger[_0x129b('0x2b')](_0x129b('0x52'));var _0x49bda0={};_0x49bda0['Owner']={'name':!_[_0x129b('0x1b')](_0x2a77d1[_0x129b('0x43')][_0x129b('0x18')])&&!_[_0x129b('0x1b')](_0x2a77d1[_0x129b('0x35')]['name'])&&_0x2a77d1[_0x129b('0x35')][_0x129b('0x18')]===_0x129b('0x53')?_0x2a77d1[_0x129b('0x43')][_0x129b('0x18')]:!_[_0x129b('0x1b')](_0x2a77d1[_0x129b('0x44')])?_0x2a77d1[_0x129b('0x44')]+'\x20'+_0x2a77d1[_0x129b('0x45')]:_0x2a77d1[_0x129b('0x45')],'id':_0x2a77d1['id']};_0x49bda0[_0x129b('0x54')]=intUtil[_0x129b('0x55')](_0x527cb5[_0x129b('0x56')],_0x2ef589,'\x20');_0x49bda0[_0x129b('0x57')]=intUtil[_0x129b('0x55')](_0x527cb5[_0x129b('0x58')],_0x2ef589,'\x0a');if(_0x42c103[_0x129b('0x3d')]==='Contacts'){_0x49bda0[_0x129b('0x59')]={'name':!_[_0x129b('0x1b')](_0x42c103[_0x129b('0x5a')])?_0x42c103[_0x129b('0x5a')]:!_[_0x129b('0x1b')](_0x42c103[_0x129b('0x5b')])?_0x42c103[_0x129b('0x5b')]+'\x20'+_0x42c103[_0x129b('0x5c')]:_0x42c103['Last_Name'],'id':_0x42c103['id']};}if(_0x42c103[_0x129b('0x3d')]==='Leads'){_0x49bda0[_0x129b('0x5d')]={'name':!_['isNil'](_0x42c103['Full_Name'])?_0x42c103['Full_Name']:!_[_0x129b('0x1b')](_0x42c103['First_Name'])?_0x42c103[_0x129b('0x5b')]+'\x20'+_0x42c103[_0x129b('0x5c')]:_0x42c103[_0x129b('0x5c')],'id':_0x42c103['id']};_0x49bda0[_0x129b('0x5e')]=_[_0x129b('0x41')](_0x42c103[_0x129b('0x3d')]);}if(_0x2ef589[_0x129b('0x5f')]){_0x49bda0[_0x129b('0x60')]=moment[_0x129b('0x61')](parseInt(_0x2ef589[_0x129b('0x5f')])*0x3e8)['format'](_0x129b('0x62'));}else if(_0x2ef589[_0x129b('0x63')]&&_0x2ef589[_0x129b('0x64')]){_0x49bda0['Call_Duration']=moment['utc'](moment(_0x2ef589[_0x129b('0x64')],_0x129b('0x65'))[_0x129b('0x66')](moment(_0x2ef589[_0x129b('0x67')],_0x129b('0x65'))))[_0x129b('0x2e')]('mm:ss');}switch(_0x2ef589[_0x129b('0x68')]){case _0x129b('0x69'):_0x49bda0[_0x129b('0x6a')]=_0x129b('0x6b');break;case'complete':case _0x129b('0x6c'):_0x49bda0[_0x129b('0x6a')]=_0x129b('0x6d');break;case _0x129b('0x6e'):_0x49bda0[_0x129b('0x6a')]=_0x129b('0x6f');break;case'abandoned':_0x49bda0[_0x129b('0x6a')]='Abandoned';break;case _0x129b('0x70'):_0x49bda0['Call_Result']=_0x129b('0x71');default:}_0x49bda0[_0x129b('0x72')]=(_0x4590a9===_0x129b('0x73')?moment(_0x2ef589['starttime'])[_0x129b('0x2e')](_0x129b('0x65')):moment(_0x2ef589[_0x129b('0x74')])['format']('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x129b('0x2e')](_0x129b('0x65'));_0x49bda0['Call_Type']=_0x4590a9||_0x129b('0x75');_0x49bda0=_[_0x129b('0x76')](_0x49bda0,getCustomFields(_0x527cb5[_0x129b('0x77')],_0x2ef589));return request({'method':'POST','uri':_0x129b('0x3f')+_0x59e7ed+_0x129b('0x78'),'headers':{'Authorization':_0x129b('0x31')+_0x2c8b9c},'body':{'data':[_0x49bda0]},'json':!![]})['then'](function(_0x17b879){if(_0x17b879&&_0x17b879[_0x129b('0x3c')][0x0][_0x129b('0x46')]===_0x129b('0x79')){logger[_0x129b('0x2b')]('Call\x20created!');return{'id':_0x17b879[_0x129b('0x3c')][0x0]['details']['id']};}})[_0x129b('0x3b')](function(_0x5a34a6){logger[_0x129b('0x2b')](_0x129b('0x7a'),_0x5a34a6[_0x129b('0x2a')]);console[_0x129b('0x48')]('err',_0x5a34a6);});}exports['queue']=function(_0x4a073c,_0x24fc30,_0xb8601f,_0x2539ff,_0x5c4fba,_0x391165){var _0x78f097,_0x23bf7b,_0x429a1a;_0x391165[_0x129b('0x7b')]=intUtil[_0x129b('0x7c')](_0x391165[_0x129b('0x7b')]);_0x391165['serverUrl']=intUtil['stripTrailingSlash'](_0x391165[_0x129b('0x7d')]);if(_0x5c4fba&&_0x5c4fba[_0x129b('0x7e')]){logger['info'](_0x129b('0x7f'),_0x129b('0x80'));_0x24fc30[_0x129b('0x81')]=_0x391165[_0x129b('0x7d')]+_0x129b('0x82')+_0x24fc30[_0x129b('0x83')]+_0x129b('0x84')+md5(_0x24fc30[_0x129b('0x83')]);}else{_0x24fc30['recordingURL']='';}var _0x5789a2=_0x391165[_0x129b('0x7b')]==='zoho.eu'?'eu':_0x129b('0x85');return getAccessToken(_0x391165)['then'](function(_0x2fd6f2){_0x429a1a=_0x2fd6f2;return getUser(_0x429a1a,_0x5789a2,_0x391165,_0x2539ff[_0x129b('0x34')]);})[_0x129b('0x26')](function(_0x461722){_0x78f097=_0x461722;logger[_0x129b('0x2b')](_0x129b('0x86'),_0x78f097['id']);return getEndUser(_0x429a1a,_0x5789a2,_0x391165,_0x24fc30[_0x129b('0x87')],_0x24fc30[_0x129b('0x88')],_0x78f097,_0xb8601f);})['then'](function(_0x80579b){_0x23bf7b=_0x80579b;return getCall(_0x429a1a,_0x5789a2,_0x391165,_0x78f097,_0x23bf7b,_0xb8601f,_0x24fc30,_0x129b('0x75'));})[_0x129b('0x26')](function(_0x2410d4){if(_0x2410d4){logger[_0x129b('0x2b')]('The\x20Call\x20ID\x20is:',_0x2410d4['id']);logger['info']('[QUEUE]',_0x129b('0x89'));emit(util[_0x129b('0x2e')](_0x129b('0x8a'),_0x2539ff[_0x129b('0x18')]),_0x129b('0x8b'),{'uri':_0x129b('0x8c')+_0x391165[_0x129b('0x7b')]+_0x129b('0x8d')+_0x2410d4['id']});}})[_0x129b('0x3b')](function(_0x3b2b2d){logger[_0x129b('0x29')](_0x129b('0x7f'),JSON['stringify'](_0x3b2b2d));});};exports['outbound']=function(_0x1c4169,_0x5465e5,_0x5ea7d3,_0x4f9258,_0x306947,_0x248d36,_0x508a74){var _0x8482c,_0x300b28,_0x29ef72;_0x248d36[_0x129b('0x7b')]=intUtil[_0x129b('0x7c')](_0x248d36[_0x129b('0x7b')]);_0x248d36[_0x129b('0x7d')]=intUtil[_0x129b('0x7c')](_0x248d36[_0x129b('0x7d')]);if(_0x508a74&&_0x508a74['recordingFormat']&&_0x508a74[_0x129b('0x8e')]!==_0x129b('0x8f')){logger['info'](_0x129b('0x90'),_0x129b('0x80'));_0x5465e5[_0x129b('0x81')]=_0x248d36[_0x129b('0x7d')]+_0x129b('0x82')+_0x5465e5[_0x129b('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x5465e5[_0x129b('0x83')]);}var _0x8922c6=_0x248d36[_0x129b('0x7b')]==='zoho.eu'?'eu':_0x129b('0x85');return getAccessToken(_0x248d36)['then'](function(_0x261acd){_0x29ef72=_0x261acd;return getUser(_0x29ef72,_0x8922c6,_0x248d36,_0x4f9258[_0x129b('0x34')]);})[_0x129b('0x26')](function(_0x2e3de0){_0x8482c=_0x2e3de0;logger['info'](_0x129b('0x86'),_0x8482c['id']);return getEndUser(_0x29ef72,_0x8922c6,_0x248d36,_0x5465e5[_0x129b('0x91')],_0x5465e5[_0x129b('0x92')],_0x8482c,_0x5ea7d3);})[_0x129b('0x26')](function(_0x173d94){_0x300b28=_0x173d94;return getCall(_0x29ef72,_0x8922c6,_0x248d36,_0x8482c,_0x300b28,_0x5ea7d3,_0x5465e5,_0x129b('0x93'));})[_0x129b('0x26')](function(_0x143c29){if(_0x143c29){logger['info'](_0x129b('0x94'),_0x143c29['id']);logger['info'](_0x129b('0x90'),_0x129b('0x89'));emit(util['format'](_0x129b('0x8a'),_0x4f9258[_0x129b('0x18')]),_0x129b('0x8b'),{'uri':_0x129b('0x8c')+_0x248d36[_0x129b('0x7b')]+_0x129b('0x8d')+_0x143c29['id']});}})[_0x129b('0x3b')](function(_0x3999d7){logger[_0x129b('0x29')](_0x129b('0x90'),JSON[_0x129b('0x3a')](_0x3999d7));});};exports[_0x129b('0x95')]=function(_0x320c1e,_0x16d373,_0x4505a8,_0x21d6d1,_0x17f766,_0x2ddfcd){var _0x5cf5ab,_0x291957,_0x479fda;_0x2ddfcd['host']=intUtil[_0x129b('0x7c')](_0x2ddfcd[_0x129b('0x7b')]);_0x2ddfcd[_0x129b('0x7d')]=intUtil[_0x129b('0x7c')](_0x2ddfcd[_0x129b('0x7d')]);if(_0x17f766&&_0x17f766[_0x129b('0x7e')]){logger[_0x129b('0x2b')]('['+_0x16d373[_0x129b('0x68')][_0x129b('0x96')]()+']','Recording\x20is\x20enabled!');_0x16d373[_0x129b('0x81')]=_0x2ddfcd[_0x129b('0x7d')]+'/api/voice/recordings/'+_0x16d373[_0x129b('0x83')]+_0x129b('0x84')+md5(_0x16d373[_0x129b('0x83')]);}else{_0x16d373[_0x129b('0x81')]='';}var _0x2afd6d=_0x2ddfcd[_0x129b('0x7b')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x2ddfcd)[_0x129b('0x26')](function(_0x458777){_0x479fda=_0x458777;return getUser(_0x479fda,_0x2afd6d,_0x2ddfcd);})[_0x129b('0x26')](function(_0x4cc49b){_0x5cf5ab=_0x4cc49b;logger['info']('The\x20User\x20ID\x20is:',_0x5cf5ab['id']);return getEndUser(_0x479fda,_0x2afd6d,_0x2ddfcd,_0x16d373[_0x129b('0x87')],_0x16d373[_0x129b('0x88')],_0x5cf5ab,_0x4505a8);})[_0x129b('0x26')](function(_0x1f30e6){_0x291957=_0x1f30e6;return getCall(_0x479fda,_0x2afd6d,_0x2ddfcd,_0x5cf5ab,_0x291957,_0x4505a8,_0x16d373,_0x129b('0x75'));})[_0x129b('0x26')](function(_0x3a80ab){if(_0x3a80ab){logger[_0x129b('0x2b')]('The\x20Call\x20ID\x20is:',_0x3a80ab['id']);}})[_0x129b('0x3b')](function(_0x114160){logger[_0x129b('0x29')]('['+_0x16d373[_0x129b('0x68')][_0x129b('0x96')]()+']',JSON[_0x129b('0x3a')](_0x114160));});}; \ 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 9048bc4..3ae2eef 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(_0x23ea27,_0x5c7eb4){var _0x1895f3=function(_0x472cd3){while(--_0x472cd3){_0x23ea27['push'](_0x23ea27['shift']());}};_0x1895f3(++_0x5c7eb4);}(_0x7a54,0x106));var _0x47a5=function(_0x2e8dc5,_0x3ab08e){_0x2e8dc5=_0x2e8dc5-0x0;var _0x2c4e7c=_0x7a54[_0x2e8dc5];return _0x2c4e7c;};'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(_0x22c957,_0x6b570){var _0xf776d1=function(_0x4b689b){while(--_0x4b689b){_0x22c957['push'](_0x22c957['shift']());}};_0xf776d1(++_0x6b570);}(_0x7a54,0x106));var _0x47a5=function(_0x344023,_0x478084){_0x344023=_0x344023-0x0;var _0x8b7ab=_0x7a54[_0x344023];return _0x8b7ab;};'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 a12eeea..01ce0af 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0xf9a309,_0x1be54d){var _0x3a99d7=function(_0x2e46e6){while(--_0x2e46e6){_0xf9a309['push'](_0xf9a309['shift']());}};_0x3a99d7(++_0x1be54d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x449799,_0x2c4c3d){_0x449799=_0x449799-0x0;var _0x32f84d=_0x5f2f[_0x449799];return _0x32f84d;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file +var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x3e48f6,_0x254eac){var _0x5c3f56=function(_0x27113b){while(--_0x27113b){_0x3e48f6['push'](_0x3e48f6['shift']());}};_0x5c3f56(++_0x254eac);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5a9c42,_0x1522a0){_0x5a9c42=_0x5a9c42-0x0;var _0x36d349=_0x5f2f[_0x5a9c42];return _0x36d349;};'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 e647f55..8c95932 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 _0x7250=['error','message','catch','exports','jayson/promise','bluebird','routing','client','http','Request','rpc'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x7250,0x1b1));var _0x0725=function(_0x5a6705,_0x1e3bbd){_0x5a6705=_0x5a6705-0x0;var _0x32f17a=_0x7250[_0x5a6705];return _0x32f17a;};'use strict';var jayson=require(_0x0725('0x0'));var BPromise=require(_0x0725('0x1'));var logger=require('../../config/logger')(_0x0725('0x2'));var client=jayson[_0x0725('0x3')][_0x0725('0x4')]({'port':0x2329});client[_0x0725('0x5')]=function(_0x425376,_0x4724ef){return new BPromise(function(_0x53cc59,_0x34a7d5){return client['request'](_0x425376,_0x4724ef)['then'](function(_0xa32c3f){logger['debug'](_0x0725('0x6'),_0x0725('0x2'),_0x425376,_0x4724ef,_0xa32c3f);if(_0xa32c3f['error']){logger[_0x0725('0x7')](_0x0725('0x6'),_0x0725('0x2'),_0x425376,_0xa32c3f[_0x0725('0x7')][_0x0725('0x8')],_0x4724ef);return _0x34a7d5(_0xa32c3f[_0x0725('0x7')][_0x0725('0x8')]);}else{return _0x53cc59(_0xa32c3f['result']);}})[_0x0725('0x9')](function(_0x10a203){logger[_0x0725('0x7')]('rpc','routing',_0x425376,_0x10a203,_0x4724ef);return _0x34a7d5(_0x10a203);});});};module[_0x0725('0xa')]=client; \ No newline at end of file +var _0x39d9=['request','rpc','error','message','result','catch','jayson/promise','bluebird','../../config/logger','routing','client','http','Request'];(function(_0x53ae66,_0x4d00fc){var _0x446592=function(_0x3467da){while(--_0x3467da){_0x53ae66['push'](_0x53ae66['shift']());}};_0x446592(++_0x4d00fc);}(_0x39d9,0x17f));var _0x939d=function(_0x159fd1,_0x73b713){_0x159fd1=_0x159fd1-0x0;var _0x5c85b1=_0x39d9[_0x159fd1];return _0x5c85b1;};'use strict';var jayson=require(_0x939d('0x0'));var BPromise=require(_0x939d('0x1'));var logger=require(_0x939d('0x2'))(_0x939d('0x3'));var client=jayson[_0x939d('0x4')][_0x939d('0x5')]({'port':0x2329});client[_0x939d('0x6')]=function(_0x470ba7,_0x57ab6c){return new BPromise(function(_0x2a9e29,_0x2730aa){return client[_0x939d('0x7')](_0x470ba7,_0x57ab6c)['then'](function(_0x41c89f){logger['debug'](_0x939d('0x8'),_0x939d('0x3'),_0x470ba7,_0x57ab6c,_0x41c89f);if(_0x41c89f[_0x939d('0x9')]){logger[_0x939d('0x9')](_0x939d('0x8'),_0x939d('0x3'),_0x470ba7,_0x41c89f[_0x939d('0x9')]['message'],_0x57ab6c);return _0x2730aa(_0x41c89f['error'][_0x939d('0xa')]);}else{return _0x2a9e29(_0x41c89f[_0x939d('0xb')]);}})[_0x939d('0xc')](function(_0x1e736a){logger[_0x939d('0x9')]('rpc','routing',_0x470ba7,_0x1e736a,_0x57ab6c);return _0x2730aa(_0x1e736a);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index df50542..8557c32 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 _0x9b8e=['mailAccounts','listen','Setting','findOne','loginMailFrequency','log','bluebird','./realtime','./lib/email','resolve','getMailAccounts','then','refresh'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9b8e,0x158));var _0xe9b8=function(_0x4e2f56,_0x5b996c){_0x4e2f56=_0x4e2f56-0x0;var _0x4882c0=_0x9b8e[_0x4e2f56];return _0x4882c0;};'use strict';var BPromise=require(_0xe9b8('0x0'));var server=require('./server');var Realtime=require(_0xe9b8('0x1'));var EmailChannel=require(_0xe9b8('0x2'));var mailAccount=require('./rpc/mailAccount');var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise[_0xe9b8('0x3')]()['then'](mailAccount[_0xe9b8('0x4')]())[_0xe9b8('0x5')](realtime['initMailAccounts']())[_0xe9b8('0x5')](function(){email[_0xe9b8('0x6')](realtime[_0xe9b8('0x7')]);return realtime;});}function main(){return server[_0xe9b8('0x8')](realtime,email)[_0xe9b8('0x5')](function(_0x3b67fe){return initRealtime();})['then'](function(_0x536372){return db[_0xe9b8('0x9')][_0xe9b8('0xa')]({'attributes':['id',_0xe9b8('0xb')],'raw':!![]});})[_0xe9b8('0x5')](function(_0x4aab24){return setInterval(initRealtime,_0x4aab24[_0xe9b8('0xb')]*0x3e8);})['catch'](function(_0x23244f){console[_0xe9b8('0xc')](_0x23244f);});}main(); \ No newline at end of file +var _0x5e8d=['./rpc/mailAccount','../../mysqldb','resolve','getMailAccounts','then','refresh','mailAccounts','loginMailFrequency','log','bluebird','./server','./realtime','./lib/email'];(function(_0x36bbe8,_0x843e32){var _0xaf1d86=function(_0x459f3e){while(--_0x459f3e){_0x36bbe8['push'](_0x36bbe8['shift']());}};_0xaf1d86(++_0x843e32);}(_0x5e8d,0x11a));var _0xd5e8=function(_0x9f61bf,_0x40521a){_0x9f61bf=_0x9f61bf-0x0;var _0x10f8e9=_0x5e8d[_0x9f61bf];return _0x10f8e9;};'use strict';var BPromise=require(_0xd5e8('0x0'));var server=require(_0xd5e8('0x1'));var Realtime=require(_0xd5e8('0x2'));var EmailChannel=require(_0xd5e8('0x3'));var mailAccount=require(_0xd5e8('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xd5e8('0x5'))['db'];function initRealtime(){return BPromise[_0xd5e8('0x6')]()['then'](mailAccount[_0xd5e8('0x7')]())[_0xd5e8('0x8')](realtime['initMailAccounts']())[_0xd5e8('0x8')](function(){email[_0xd5e8('0x9')](realtime[_0xd5e8('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xd5e8('0x8')](function(_0x4196e2){return initRealtime();})[_0xd5e8('0x8')](function(_0x37ad2a){return db['Setting']['findOne']({'attributes':['id',_0xd5e8('0xb')],'raw':!![]});})[_0xd5e8('0x8')](function(_0x3422fb){return setInterval(initRealtime,_0x3422fb[_0xd5e8('0xb')]*0x3e8);})['catch'](function(_0x1470cb){console[_0xd5e8('0xc')](_0x1470cb);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 73a6369..d283b4b 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 _0x64e9=['error','handleImapError','disabled','handleImapBox','connected','messages','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','Smtp','verify','verified','moment','md5','ioredis','../../../config/environment','email','redis','localhost','socket.io-emitter','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','box','bind','handleImapEmail','end','handleImapEnd'];(function(_0x458a2e,_0x31f0d7){var _0x26590e=function(_0xf06a51){while(--_0xf06a51){_0x458a2e['push'](_0x458a2e['shift']());}};_0x26590e(++_0x31f0d7);}(_0x64e9,0x117));var _0x964e=function(_0x1aa3ce,_0x453b5a){_0x1aa3ce=_0x1aa3ce-0x0;var _0x3fb000=_0x64e9[_0x1aa3ce];return _0x3fb000;};'use strict';var _=require('lodash');var moment=require(_0x964e('0x0'));var BPromise=require('bluebird');var md5=require(_0x964e('0x1'));var Redis=require(_0x964e('0x2'));var config=require(_0x964e('0x3'));var logger=require('../../../config/logger')(_0x964e('0x4'));config[_0x964e('0x5')]=_['defaults'](config[_0x964e('0x5')],{'host':_0x964e('0x6'),'port':0x18eb});var io=require(_0x964e('0x7'))(new Redis(config['redis']));var EmailImap=require(_0x964e('0x8'));var EmailSmtp=require(_0x964e('0x9'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x2fe9c6){logger[_0x964e('0xa')](_0x964e('0xb'));this[_0x964e('0xc')]=_0x2fe9c6[_0x964e('0xc')];this[_0x964e('0xd')]={};this[_0x964e('0xe')]=new EmailSmtp();}EmailChannel[_0x964e('0xf')][_0x964e('0x10')]=function(_0x21d972){var _0x5ee80a=this['mailAccounts'][_0x21d972];var _0x16436f={'id':_0x5ee80a['id'],'name':_0x5ee80a[_0x964e('0x11')],'key':_0x5ee80a['key'],'active':_0x5ee80a[_0x964e('0x12')],'Imap':{'status':_0x5ee80a[_0x964e('0x13')][_0x964e('0x14')],'messageStatus':_0x5ee80a[_0x964e('0x13')][_0x964e('0x15')],'total':_0x5ee80a[_0x964e('0x13')][_0x964e('0x16')]}};if(_[_0x964e('0x17')](md5Accounts[_0x21d972])){md5Accounts[_0x21d972]={};}var _0x41c59f=md5(JSON[_0x964e('0x18')](_0x16436f));if(md5Accounts[_0x21d972][_0x964e('0x1')]!==_0x41c59f){md5Accounts[_0x21d972][_0x964e('0x1')]=_0x41c59f;io[_0x964e('0x10')](_0x964e('0x19'),_0x16436f);}};EmailChannel[_0x964e('0xf')][_0x964e('0x1a')]=function(_0x113dc0){for(var _0x9eb31e in _0x113dc0){if(_0x113dc0[_0x964e('0x1b')](_0x9eb31e)){if(_0x113dc0[_0x9eb31e][_0x964e('0x13')]&&_0x113dc0[_0x9eb31e]['active']){var _0xb30eb8=_0x113dc0[_0x9eb31e][_0x964e('0x13')];if(!this[_0x964e('0xd')][_0x964e('0x1b')](_0xb30eb8['id'])){this[_0x964e('0xd')][_0xb30eb8['id']]=new EmailImap(_0xb30eb8,_0x113dc0[_0x9eb31e]['email']);this[_0x964e('0xd')][_0xb30eb8['id']]['on'](_0x964e('0x1c'),this['handleImapBox'][_0x964e('0x1d')](this,_0x9eb31e));this[_0x964e('0xd')][_0xb30eb8['id']]['on'](_0x964e('0x4'),this[_0x964e('0x1e')][_0x964e('0x1d')](this,_0x9eb31e));this[_0x964e('0xd')][_0xb30eb8['id']]['on'](_0x964e('0x1f'),this[_0x964e('0x20')]['bind'](this,_0x9eb31e));this['imapAccounts'][_0xb30eb8['id']]['on'](_0x964e('0x21'),this[_0x964e('0x22')][_0x964e('0x1d')](this,_0x9eb31e));}}else{if(_[_0x964e('0x17')](this[_0x964e('0xc')][_0x9eb31e][_0x964e('0x13')])){this[_0x964e('0xc')][_0x9eb31e]['Imap']={};}this[_0x964e('0xc')][_0x9eb31e]['Imap'][_0x964e('0x14')]=_0x964e('0x23');this[_0x964e('0xc')][_0x9eb31e]['Imap']['messageStatus']='';this['emit'](_0x9eb31e);}}}};EmailChannel[_0x964e('0xf')][_0x964e('0x24')]=function(_0x38fe15,_0x57513a){if(this[_0x964e('0xc')][_0x38fe15]){this[_0x964e('0xc')][_0x38fe15][_0x964e('0x13')][_0x964e('0x14')]=_0x964e('0x25');this[_0x964e('0xc')][_0x38fe15][_0x964e('0x13')][_0x964e('0x15')]=_0x57513a[_0x964e('0x11')];if(_0x57513a[_0x964e('0x26')]){this[_0x964e('0xc')][_0x38fe15][_0x964e('0x13')][_0x964e('0x16')]=_0x57513a[_0x964e('0x26')][_0x964e('0x16')];}return this['emit'](_0x38fe15);}};EmailChannel[_0x964e('0xf')]['handleImapEmail']=function(_0x121426,_0x1b82a7){logger[_0x964e('0xa')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x1b82a7['firstName'],_0x1b82a7[_0x964e('0x27')],_0x1b82a7[_0x964e('0x28')],_0x121426);if(this[_0x964e('0xc')][_0x121426]){return mailAccount[_0x964e('0x29')](_0x121426,_0x1b82a7)[_0x964e('0x2a')](function(_0x5158f4){if(_0x5158f4){logger[_0x964e('0xa')](_0x964e('0x2b'));}})[_0x964e('0x2c')](function(_0x5b3489){logger[_0x964e('0x21')](_0x964e('0x2d'),JSON[_0x964e('0x18')](_0x5b3489));});}};EmailChannel[_0x964e('0xf')]['handleImapEnd']=function(_0x1ea678){if(this[_0x964e('0xc')][_0x1ea678]&&this[_0x964e('0xc')][_0x1ea678][_0x964e('0x13')]){if(this[_0x964e('0xd')][this[_0x964e('0xc')][_0x1ea678]['Imap']['id']]){delete this['imapAccounts'][this[_0x964e('0xc')][_0x1ea678]['Imap']['id']];}this[_0x964e('0xc')][_0x1ea678][_0x964e('0x13')][_0x964e('0x2e')]=moment();this[_0x964e('0x10')](_0x1ea678);}};EmailChannel['prototype'][_0x964e('0x22')]=function(_0x4a9b7f,_0x11c636){if(this['mailAccounts'][_0x4a9b7f]){this[_0x964e('0xc')][_0x4a9b7f][_0x964e('0x13')][_0x964e('0x14')]=_0x964e('0x21');this[_0x964e('0xc')][_0x4a9b7f][_0x964e('0x13')][_0x964e('0x15')]=_0x11c636;return this[_0x964e('0x10')](_0x4a9b7f);}};EmailChannel[_0x964e('0xf')][_0x964e('0x2f')]=function(_0x7e255,_0x4d1920){return this[_0x964e('0xe')][_0x964e('0x30')](_0x7e255,_0x4d1920);};EmailChannel[_0x964e('0xf')]['verifySmtp']=function(_0x3dbc2a){var _0x3c6c84=this;if(this[_0x964e('0xc')][_0x3dbc2a['id']]){if(_[_0x964e('0x17')](this[_0x964e('0xc')][_0x3dbc2a['id']][_0x964e('0x31')])){this[_0x964e('0xc')][_0x3dbc2a['id']]['Smtp']={};}this['mailAccounts'][_0x3dbc2a['id']]['Smtp'][_0x964e('0x2e')]=moment();return new BPromise(function(_0x46e7c5,_0x30a412){return _0x3c6c84['smtp'][_0x964e('0x32')](_0x3dbc2a)['then'](function(_0x2fcb14){_0x3c6c84[_0x964e('0xc')][_0x3dbc2a['id']]['Smtp'][_0x964e('0x14')]=_0x964e('0x33');_0x3c6c84[_0x964e('0xc')][_0x3dbc2a['id']][_0x964e('0x31')]['messageStatus']='';_0x3c6c84[_0x964e('0x10')](_0x3dbc2a['id']);_0x46e7c5(_0x2fcb14);})['catch'](function(_0x3ead93){_0x3c6c84['mailAccounts'][_0x3dbc2a['id']]['Smtp']['status']=_0x964e('0x21');_0x3c6c84[_0x964e('0xc')][_0x3dbc2a['id']][_0x964e('0x31')]['messageStatus']=_0x3ead93;_0x3c6c84[_0x964e('0x10')](_0x3dbc2a['id']);_0x30a412(_0x3ead93);});});}return this['smtp']['verify'](_0x3dbc2a);};module['exports']=EmailChannel; \ No newline at end of file +var _0xc36c=['notify','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','verifySmtp','Smtp','lastSync','verify','then','exports','moment','bluebird','md5','ioredis','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','start\x20email\x20channel','smtp','prototype','emit','mailAccounts','name','active','Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','imapAccounts','email','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','status','disabled','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from'];(function(_0x268111,_0x31c1f9){var _0x54e72a=function(_0x16e79c){while(--_0x16e79c){_0x268111['push'](_0x268111['shift']());}};_0x54e72a(++_0x31c1f9);}(_0xc36c,0x149));var _0xcc36=function(_0x14e080,_0x1ecc4b){_0x14e080=_0x14e080-0x0;var _0x5b37b4=_0xc36c[_0x14e080];return _0x5b37b4;};'use strict';var _=require('lodash');var moment=require(_0xcc36('0x0'));var BPromise=require(_0xcc36('0x1'));var md5=require(_0xcc36('0x2'));var Redis=require(_0xcc36('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('email');config[_0xcc36('0x4')]=_[_0xcc36('0x5')](config[_0xcc36('0x4')],{'host':_0xcc36('0x6'),'port':0x18eb});var io=require(_0xcc36('0x7'))(new Redis(config[_0xcc36('0x4')]));var EmailImap=require(_0xcc36('0x8'));var EmailSmtp=require(_0xcc36('0x9'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x12526a){logger['info'](_0xcc36('0xa'));this['mailAccounts']=_0x12526a['mailAccounts'];this['imapAccounts']={};this[_0xcc36('0xb')]=new EmailSmtp();}EmailChannel[_0xcc36('0xc')][_0xcc36('0xd')]=function(_0x12e3ec){var _0x406a5e=this[_0xcc36('0xe')][_0x12e3ec];var _0x255ea2={'id':_0x406a5e['id'],'name':_0x406a5e[_0xcc36('0xf')],'key':_0x406a5e['key'],'active':_0x406a5e[_0xcc36('0x10')],'Imap':{'status':_0x406a5e[_0xcc36('0x11')]['status'],'messageStatus':_0x406a5e[_0xcc36('0x11')][_0xcc36('0x12')],'total':_0x406a5e['Imap'][_0xcc36('0x13')]}};if(_[_0xcc36('0x14')](md5Accounts[_0x12e3ec])){md5Accounts[_0x12e3ec]={};}var _0x45c371=md5(JSON[_0xcc36('0x15')](_0x255ea2));if(md5Accounts[_0x12e3ec]['md5']!==_0x45c371){md5Accounts[_0x12e3ec][_0xcc36('0x2')]=_0x45c371;io['emit'](_0xcc36('0x16'),_0x255ea2);}};EmailChannel[_0xcc36('0xc')][_0xcc36('0x17')]=function(_0x7c1e6d){for(var _0x52977b in _0x7c1e6d){if(_0x7c1e6d[_0xcc36('0x18')](_0x52977b)){if(_0x7c1e6d[_0x52977b][_0xcc36('0x11')]&&_0x7c1e6d[_0x52977b][_0xcc36('0x10')]){var _0x50fff9=_0x7c1e6d[_0x52977b][_0xcc36('0x11')];if(!this['imapAccounts'][_0xcc36('0x18')](_0x50fff9['id'])){this[_0xcc36('0x19')][_0x50fff9['id']]=new EmailImap(_0x50fff9,_0x7c1e6d[_0x52977b][_0xcc36('0x1a')]);this['imapAccounts'][_0x50fff9['id']]['on']('box',this[_0xcc36('0x1b')][_0xcc36('0x1c')](this,_0x52977b));this['imapAccounts'][_0x50fff9['id']]['on']('email',this[_0xcc36('0x1d')]['bind'](this,_0x52977b));this[_0xcc36('0x19')][_0x50fff9['id']]['on'](_0xcc36('0x1e'),this[_0xcc36('0x1f')][_0xcc36('0x1c')](this,_0x52977b));this[_0xcc36('0x19')][_0x50fff9['id']]['on'](_0xcc36('0x20'),this[_0xcc36('0x21')][_0xcc36('0x1c')](this,_0x52977b));}}else{if(_[_0xcc36('0x14')](this[_0xcc36('0xe')][_0x52977b][_0xcc36('0x11')])){this['mailAccounts'][_0x52977b]['Imap']={};}this['mailAccounts'][_0x52977b][_0xcc36('0x11')][_0xcc36('0x22')]=_0xcc36('0x23');this[_0xcc36('0xe')][_0x52977b][_0xcc36('0x11')]['messageStatus']='';this[_0xcc36('0xd')](_0x52977b);}}}};EmailChannel[_0xcc36('0xc')]['handleImapBox']=function(_0x63a9c3,_0x2b2575){if(this['mailAccounts'][_0x63a9c3]){this[_0xcc36('0xe')][_0x63a9c3][_0xcc36('0x11')][_0xcc36('0x22')]='connected';this[_0xcc36('0xe')][_0x63a9c3]['Imap']['messageStatus']=_0x2b2575[_0xcc36('0xf')];if(_0x2b2575[_0xcc36('0x24')]){this[_0xcc36('0xe')][_0x63a9c3][_0xcc36('0x11')][_0xcc36('0x13')]=_0x2b2575[_0xcc36('0x24')][_0xcc36('0x13')];}return this[_0xcc36('0xd')](_0x63a9c3);}};EmailChannel[_0xcc36('0xc')][_0xcc36('0x1d')]=function(_0xda546b,_0x441e38){logger[_0xcc36('0x25')](_0xcc36('0x26'),_0x441e38[_0xcc36('0x27')],_0x441e38[_0xcc36('0x28')],_0x441e38[_0xcc36('0x29')],_0xda546b);if(this[_0xcc36('0xe')][_0xda546b]){return mailAccount[_0xcc36('0x2a')](_0xda546b,_0x441e38)['then'](function(_0x5497df){if(_0x5497df){logger['info']('Mail\x20accepted\x20from\x20routing');}})[_0xcc36('0x2b')](function(_0x5b8080){logger[_0xcc36('0x20')](_0xcc36('0x2c'),JSON[_0xcc36('0x15')](_0x5b8080));});}};EmailChannel[_0xcc36('0xc')][_0xcc36('0x1f')]=function(_0x50a30d){if(this[_0xcc36('0xe')][_0x50a30d]&&this[_0xcc36('0xe')][_0x50a30d][_0xcc36('0x11')]){if(this[_0xcc36('0x19')][this[_0xcc36('0xe')][_0x50a30d]['Imap']['id']]){delete this['imapAccounts'][this[_0xcc36('0xe')][_0x50a30d][_0xcc36('0x11')]['id']];}this[_0xcc36('0xe')][_0x50a30d][_0xcc36('0x11')]['lastSync']=moment();this[_0xcc36('0xd')](_0x50a30d);}};EmailChannel[_0xcc36('0xc')][_0xcc36('0x21')]=function(_0x151aae,_0x11c837){if(this[_0xcc36('0xe')][_0x151aae]){this[_0xcc36('0xe')][_0x151aae][_0xcc36('0x11')][_0xcc36('0x22')]='error';this[_0xcc36('0xe')][_0x151aae][_0xcc36('0x11')][_0xcc36('0x12')]=_0x11c837;return this[_0xcc36('0xd')](_0x151aae);}};EmailChannel['prototype'][_0xcc36('0x2d')]=function(_0x38c58e,_0x1827b9){return this['smtp'][_0xcc36('0x2e')](_0x38c58e,_0x1827b9);};EmailChannel[_0xcc36('0xc')][_0xcc36('0x2f')]=function(_0x252936){var _0x236895=this;if(this[_0xcc36('0xe')][_0x252936['id']]){if(_[_0xcc36('0x14')](this[_0xcc36('0xe')][_0x252936['id']]['Smtp'])){this[_0xcc36('0xe')][_0x252936['id']][_0xcc36('0x30')]={};}this[_0xcc36('0xe')][_0x252936['id']][_0xcc36('0x30')][_0xcc36('0x31')]=moment();return new BPromise(function(_0x201a7e,_0x589244){return _0x236895[_0xcc36('0xb')][_0xcc36('0x32')](_0x252936)[_0xcc36('0x33')](function(_0x223cff){_0x236895[_0xcc36('0xe')][_0x252936['id']][_0xcc36('0x30')][_0xcc36('0x22')]='verified';_0x236895['mailAccounts'][_0x252936['id']][_0xcc36('0x30')][_0xcc36('0x12')]='';_0x236895[_0xcc36('0xd')](_0x252936['id']);_0x201a7e(_0x223cff);})['catch'](function(_0x2add79){_0x236895[_0xcc36('0xe')][_0x252936['id']][_0xcc36('0x30')][_0xcc36('0x22')]=_0xcc36('0x20');_0x236895['mailAccounts'][_0x252936['id']][_0xcc36('0x30')]['messageStatus']=_0x2add79;_0x236895['emit'](_0x252936['id']);_0x589244(_0x2add79);});});}return this[_0xcc36('0xb')][_0xcc36('0x32')](_0x252936);};module[_0xcc36('0x34')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index fa2f3eb..5b77e4d 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 _0x1e7c=['handleCloseBox','stringify','textCode','hasOwnProperty','upperFirst','exports','path','imap','randomstring','mailparser','simpleParser','iconv','events','./utils','../../../config/logger','email','INBOX','account','ready','handleReady','bind','once','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','autotls','tls','anonymous@xcally.com','handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','closeBox','handleFetchError'];(function(_0x235884,_0x1c4355){var _0x211158=function(_0x3d620c){while(--_0x3d620c){_0x235884['push'](_0x235884['shift']());}};_0x211158(++_0x1c4355);}(_0x1e7c,0x132));var _0xc1e7=function(_0x147b9c,_0x258636){_0x147b9c=_0x147b9c-0x0;var _0x5b8691=_0x1e7c[_0x147b9c];return _0x5b8691;};'use strict';var fs=require('fs');var path=require(_0xc1e7('0x0'));var util=require('util');var Imap=require(_0xc1e7('0x1'));var _=require('lodash');var rs=require(_0xc1e7('0x2'));var simpleParser=require(_0xc1e7('0x3'))[_0xc1e7('0x4')];var Iconv=require(_0xc1e7('0x5'))['Iconv'];var EventEmitter=require(_0xc1e7('0x6'))['EventEmitter'];var utils=require(_0xc1e7('0x7'));var logger=require(_0xc1e7('0x8'))(_0xc1e7('0x9'));function EmailImap(_0x96cbc6,_0x588a66){this['mailbox']=_0xc1e7('0xa');this['account']=this['getAccount'](_0x96cbc6,_0x588a66);this[_0xc1e7('0x1')]=new Imap(this[_0xc1e7('0xb')]);this['imap']['once'](_0xc1e7('0xc'),this[_0xc1e7('0xd')][_0xc1e7('0xe')](this));this[_0xc1e7('0x1')][_0xc1e7('0xf')](_0xc1e7('0x10'),this[_0xc1e7('0x11')][_0xc1e7('0xe')](this));this[_0xc1e7('0x1')]['on'](_0xc1e7('0x12'),this[_0xc1e7('0x13')][_0xc1e7('0xe')](this));this[_0xc1e7('0x1')][_0xc1e7('0x14')]();}util[_0xc1e7('0x15')](EmailImap,EventEmitter);EmailImap[_0xc1e7('0x16')]['getAccount']=function(_0x4f4f15,_0x21418f){var _0x428e81={'connTimeout':_0x4f4f15[_0xc1e7('0x17')]?_0x4f4f15['connTimeout']*0x3e8:0x2710,'authTimeout':_0x4f4f15[_0xc1e7('0x18')]?_0x4f4f15[_0xc1e7('0x18')]*0x3e8:0x1388};if(_[_0xc1e7('0x19')](_0x4f4f15[_0xc1e7('0x1a')])){if(_0x4f4f15[_0xc1e7('0x1b')]){_0x428e81[_0xc1e7('0x1c')]=_0x4f4f15[_0xc1e7('0x1c')];_0x428e81[_0xc1e7('0x1d')]=_0x4f4f15[_0xc1e7('0x1d')];}_0x428e81[_0xc1e7('0x1e')]=_0x4f4f15['host'];_0x428e81[_0xc1e7('0x1f')]=_0x4f4f15[_0xc1e7('0x1f')]||0x3e1;if(_0x4f4f15['tls']){_0x428e81['tls']=!![];}else{_0x428e81['tls']=![];_0x428e81[_0xc1e7('0x20')]='required';}}else{_0x428e81['user']=_0x4f4f15[_0xc1e7('0x1c')];_0x428e81[_0xc1e7('0x1d')]=_0x4f4f15[_0xc1e7('0x1d')];_0x428e81[_0xc1e7('0x1e')]=utils['getHost'](_0x4f4f15['service']);_0x428e81[_0xc1e7('0x1f')]=0x3e1;_0x428e81[_0xc1e7('0x21')]=!![];}_0x428e81['email']=_0x21418f||_0x4f4f15[_0xc1e7('0x1c')]||_0xc1e7('0x22');return _0x428e81;};EmailImap[_0xc1e7('0x16')][_0xc1e7('0xd')]=function(){this[_0xc1e7('0x1')]['openBox'](this['mailbox'],![],this[_0xc1e7('0x23')][_0xc1e7('0xe')](this));};EmailImap[_0xc1e7('0x16')][_0xc1e7('0x23')]=function(_0x240f0,_0x548fe0){if(_0x240f0){this[_0xc1e7('0x13')](_0x240f0,!![]);}else{this[_0xc1e7('0x24')](_0xc1e7('0x25'),_0x548fe0);this[_0xc1e7('0x26')]();}};EmailImap['prototype']['handleCloseBox']=function(_0x1b6c5e){if(_0x1b6c5e){this[_0xc1e7('0x13')](_0x1b6c5e,!![]);}else{this[_0xc1e7('0x1')][_0xc1e7('0x10')]();}};EmailImap[_0xc1e7('0x16')][_0xc1e7('0x26')]=function(){this['imap'][_0xc1e7('0x27')]([_0xc1e7('0x28')],this['handleReadUnseen'][_0xc1e7('0xe')](this));};EmailImap[_0xc1e7('0x16')][_0xc1e7('0x29')]=function(_0xce254b,_0x1fd083){if(_0xce254b){this[_0xc1e7('0x13')](_0xce254b,!![]);}else{if(_0x1fd083[_0xc1e7('0x2a')]){try{var _0xf0dba6=this[_0xc1e7('0x1')][_0xc1e7('0x2b')](_0x1fd083,{'bodies':'','markSeen':!![]});_0xf0dba6['on']('message',this[_0xc1e7('0x2c')][_0xc1e7('0xe')](this));_0xf0dba6['once']('error',this['handleFetchError'][_0xc1e7('0xe')](this));_0xf0dba6[_0xc1e7('0xf')](_0xc1e7('0x10'),this['handleFetchEnd']['bind'](this));}catch(_0x180c6c){logger['error'](_0x180c6c);}}else{this[_0xc1e7('0x1')]['closeBox'](!![],this['handleCloseBox'][_0xc1e7('0xe')](this));}}};EmailImap[_0xc1e7('0x16')][_0xc1e7('0x2c')]=function(_0x5aad83,_0x283147){_0x5aad83['on'](_0xc1e7('0x2d'),this[_0xc1e7('0x2e')][_0xc1e7('0xe')](this));_0x5aad83[_0xc1e7('0xf')](_0xc1e7('0x2f'),this[_0xc1e7('0x30')][_0xc1e7('0xe')](this));_0x5aad83[_0xc1e7('0xf')](_0xc1e7('0x10'),this[_0xc1e7('0x31')][_0xc1e7('0xe')](this));};EmailImap['prototype'][_0xc1e7('0x2e')]=function(_0x196b05,_0x360295){simpleParser(_0x196b05,{'Iconv':Iconv},this[_0xc1e7('0x32')][_0xc1e7('0xe')](this));};EmailImap['prototype'][_0xc1e7('0x30')]=function(_0xc4430e){};EmailImap[_0xc1e7('0x16')]['handleMessageEnd']=function(){};EmailImap[_0xc1e7('0x16')][_0xc1e7('0x32')]=function(_0x34e93f,_0x2bbb6c){if(_0x34e93f){logger[_0xc1e7('0x12')](_0x34e93f);}else{var _0x716099=this;utils[_0xc1e7('0x33')](this[_0xc1e7('0xb')],_0x2bbb6c,function(_0x30f8ca){_0x716099[_0xc1e7('0x24')](_0xc1e7('0x9'),_0x30f8ca);});}};EmailImap[_0xc1e7('0x16')]['handleFetchEnd']=function(){this[_0xc1e7('0x1')][_0xc1e7('0x34')](!![],this['handleCloseBox'][_0xc1e7('0xe')](this));};EmailImap[_0xc1e7('0x16')][_0xc1e7('0x35')]=function(_0x5bc843){this[_0xc1e7('0x13')](_0x5bc843);this[_0xc1e7('0x1')][_0xc1e7('0x34')](!![],this[_0xc1e7('0x36')]['bind'](this));};EmailImap[_0xc1e7('0x16')][_0xc1e7('0x11')]=function(){this['emit'](_0xc1e7('0x10'));};EmailImap[_0xc1e7('0x16')]['handleError']=function(_0x497853,_0x4d06af){logger[_0xc1e7('0x12')](_0xc1e7('0x13'),this[_0xc1e7('0xb')][_0xc1e7('0x9')],JSON[_0xc1e7('0x37')](_0x497853));var _0x24f05c='';if(_0x497853){if(_0x497853[_0xc1e7('0x38')]){_0x24f05c=_0x497853['textCode'];}else{for(var _0x3c6373 in _0x497853){if(_0x497853[_0xc1e7('0x39')](_0x3c6373)){_0x24f05c+=_[_0xc1e7('0x3a')](_0x3c6373)+':\x20'+_0x497853[_0x3c6373]+'\x0a';}}}}if(_0x4d06af){this['imap'][_0xc1e7('0x10')]();}else{this['emit']('error',_0x24f05c);this['emit']('end');}};module[_0xc1e7('0x3b')]=EmailImap; \ No newline at end of file +var _0x7191=['util','imap','randomstring','mailparser','simpleParser','iconv','Iconv','EventEmitter','./utils','../../../config/logger','email','account','getAccount','once','ready','handleReady','bind','end','handleEnd','connect','prototype','service','user','password','host','port','tls','required','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','box','handleCloseBox','handleError','readUnseen','length','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','error','parser','stringify','textCode','hasOwnProperty','upperFirst','exports','path'];(function(_0x3e237f,_0x5c0069){var _0x16fdd2=function(_0x387a59){while(--_0x387a59){_0x3e237f['push'](_0x3e237f['shift']());}};_0x16fdd2(++_0x5c0069);}(_0x7191,0x1bf));var _0x1719=function(_0x360703,_0x48890a){_0x360703=_0x360703-0x0;var _0x129fca=_0x7191[_0x360703];return _0x129fca;};'use strict';var fs=require('fs');var path=require(_0x1719('0x0'));var util=require(_0x1719('0x1'));var Imap=require(_0x1719('0x2'));var _=require('lodash');var rs=require(_0x1719('0x3'));var simpleParser=require(_0x1719('0x4'))[_0x1719('0x5')];var Iconv=require(_0x1719('0x6'))[_0x1719('0x7')];var EventEmitter=require('events')[_0x1719('0x8')];var utils=require(_0x1719('0x9'));var logger=require(_0x1719('0xa'))(_0x1719('0xb'));function EmailImap(_0xe0c73f,_0x9895f7){this['mailbox']='INBOX';this[_0x1719('0xc')]=this[_0x1719('0xd')](_0xe0c73f,_0x9895f7);this['imap']=new Imap(this['account']);this[_0x1719('0x2')][_0x1719('0xe')](_0x1719('0xf'),this[_0x1719('0x10')][_0x1719('0x11')](this));this['imap'][_0x1719('0xe')](_0x1719('0x12'),this[_0x1719('0x13')]['bind'](this));this[_0x1719('0x2')]['on']('error',this['handleError'][_0x1719('0x11')](this));this[_0x1719('0x2')][_0x1719('0x14')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x1719('0x15')][_0x1719('0xd')]=function(_0x5235cb,_0x1a20cd){var _0x143a7f={'connTimeout':_0x5235cb['connTimeout']?_0x5235cb['connTimeout']*0x3e8:0x2710,'authTimeout':_0x5235cb['authTimeout']?_0x5235cb['authTimeout']*0x3e8:0x1388};if(_['isNil'](_0x5235cb[_0x1719('0x16')])){if(_0x5235cb['authentication']){_0x143a7f[_0x1719('0x17')]=_0x5235cb[_0x1719('0x17')];_0x143a7f[_0x1719('0x18')]=_0x5235cb[_0x1719('0x18')];}_0x143a7f[_0x1719('0x19')]=_0x5235cb['host'];_0x143a7f['port']=_0x5235cb[_0x1719('0x1a')]||0x3e1;if(_0x5235cb[_0x1719('0x1b')]){_0x143a7f[_0x1719('0x1b')]=!![];}else{_0x143a7f['tls']=![];_0x143a7f['autotls']=_0x1719('0x1c');}}else{_0x143a7f['user']=_0x5235cb[_0x1719('0x17')];_0x143a7f[_0x1719('0x18')]=_0x5235cb[_0x1719('0x18')];_0x143a7f[_0x1719('0x19')]=utils[_0x1719('0x1d')](_0x5235cb[_0x1719('0x16')]);_0x143a7f[_0x1719('0x1a')]=0x3e1;_0x143a7f[_0x1719('0x1b')]=!![];}_0x143a7f[_0x1719('0xb')]=_0x1a20cd||_0x5235cb[_0x1719('0x17')]||_0x1719('0x1e');return _0x143a7f;};EmailImap[_0x1719('0x15')][_0x1719('0x10')]=function(){this[_0x1719('0x2')][_0x1719('0x1f')](this['mailbox'],![],this[_0x1719('0x20')][_0x1719('0x11')](this));};EmailImap[_0x1719('0x15')][_0x1719('0x20')]=function(_0x5ee26f,_0x5796ec){if(_0x5ee26f){this['handleError'](_0x5ee26f,!![]);}else{this[_0x1719('0x21')](_0x1719('0x22'),_0x5796ec);this['readUnseen']();}};EmailImap[_0x1719('0x15')][_0x1719('0x23')]=function(_0x90e7d2){if(_0x90e7d2){this[_0x1719('0x24')](_0x90e7d2,!![]);}else{this[_0x1719('0x2')][_0x1719('0x12')]();}};EmailImap['prototype'][_0x1719('0x25')]=function(){this[_0x1719('0x2')]['search'](['UNSEEN'],this['handleReadUnseen'][_0x1719('0x11')](this));};EmailImap[_0x1719('0x15')]['handleReadUnseen']=function(_0x1c2bcd,_0x373820){if(_0x1c2bcd){this[_0x1719('0x24')](_0x1c2bcd,!![]);}else{if(_0x373820[_0x1719('0x26')]){try{var _0x1e3690=this[_0x1719('0x2')]['fetch'](_0x373820,{'bodies':'','markSeen':!![]});_0x1e3690['on'](_0x1719('0x27'),this[_0x1719('0x28')][_0x1719('0x11')](this));_0x1e3690[_0x1719('0xe')]('error',this[_0x1719('0x29')][_0x1719('0x11')](this));_0x1e3690[_0x1719('0xe')](_0x1719('0x12'),this[_0x1719('0x2a')]['bind'](this));}catch(_0x1c5de6){logger['error'](_0x1c5de6);}}else{this[_0x1719('0x2')][_0x1719('0x2b')](!![],this[_0x1719('0x23')][_0x1719('0x11')](this));}}};EmailImap[_0x1719('0x15')][_0x1719('0x28')]=function(_0x29fdce,_0x1dfcd1){_0x29fdce['on'](_0x1719('0x2c'),this[_0x1719('0x2d')][_0x1719('0x11')](this));_0x29fdce[_0x1719('0xe')]('attributes',this[_0x1719('0x2e')][_0x1719('0x11')](this));_0x29fdce[_0x1719('0xe')](_0x1719('0x12'),this[_0x1719('0x2f')]['bind'](this));};EmailImap[_0x1719('0x15')]['handleMessageBody']=function(_0x572d89,_0x2e15f6){simpleParser(_0x572d89,{'Iconv':Iconv},this[_0x1719('0x30')][_0x1719('0x11')](this));};EmailImap['prototype'][_0x1719('0x2e')]=function(_0x56a1e4){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0x1719('0x15')][_0x1719('0x30')]=function(_0xc02c49,_0x48e03c){if(_0xc02c49){logger[_0x1719('0x31')](_0xc02c49);}else{var _0x5e0f07=this;utils[_0x1719('0x32')](this[_0x1719('0xc')],_0x48e03c,function(_0x2c4b33){_0x5e0f07[_0x1719('0x21')](_0x1719('0xb'),_0x2c4b33);});}};EmailImap[_0x1719('0x15')]['handleFetchEnd']=function(){this['imap'][_0x1719('0x2b')](!![],this[_0x1719('0x23')][_0x1719('0x11')](this));};EmailImap[_0x1719('0x15')]['handleFetchError']=function(_0x3e25e8){this['handleError'](_0x3e25e8);this[_0x1719('0x2')]['closeBox'](!![],this[_0x1719('0x23')][_0x1719('0x11')](this));};EmailImap[_0x1719('0x15')][_0x1719('0x13')]=function(){this['emit'](_0x1719('0x12'));};EmailImap[_0x1719('0x15')][_0x1719('0x24')]=function(_0x42cd21,_0x5814f9){logger['error'](_0x1719('0x24'),this[_0x1719('0xc')][_0x1719('0xb')],JSON[_0x1719('0x33')](_0x42cd21));var _0x3b624c='';if(_0x42cd21){if(_0x42cd21[_0x1719('0x34')]){_0x3b624c=_0x42cd21[_0x1719('0x34')];}else{for(var _0x1d2ad6 in _0x42cd21){if(_0x42cd21[_0x1719('0x35')](_0x1d2ad6)){_0x3b624c+=_[_0x1719('0x36')](_0x1d2ad6)+':\x20'+_0x42cd21[_0x1d2ad6]+'\x0a';}}}}if(_0x5814f9){this[_0x1719('0x2')][_0x1719('0x12')]();}else{this[_0x1719('0x21')](_0x1719('0x31'),_0x3b624c);this[_0x1719('0x21')](_0x1719('0x12'));}};module[_0x1719('0x37')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index af773e2..10ae18e 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 _0x0d6a=['Not\x20verifired','exports','bluebird','nodemailer-plugin-inline-base64','prototype','use','compile','toString','createTransport','verify'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0d6a,0x1ba));var _0xa0d6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x0d6a[_0x5d4607];return _0x5e4a86;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0xa0d6('0x0'));var inlineBase64=require(_0xa0d6('0x1'));function EmailSmtp(){}EmailSmtp[_0xa0d6('0x2')]['send']=function(_0x5f1cae,_0x102d4c){return new BPromise(function(_0x207701,_0x44c812){var _0x324c85=nodemailer['createTransport'](_0x5f1cae);_0x324c85[_0xa0d6('0x3')](_0xa0d6('0x4'),inlineBase64());_0x324c85['sendMail'](_0x102d4c,function(_0x27c860,_0x339f77){if(_0x27c860){_0x44c812(_0x27c860[_0xa0d6('0x5')]());}else{_0x207701(_0x339f77);}});});};EmailSmtp[_0xa0d6('0x2')]['verify']=function(_0x28d672){return new BPromise(function(_0x4ca716,_0x2ef604){var _0x5dfc0a=nodemailer[_0xa0d6('0x6')](_0x28d672);_0x5dfc0a[_0xa0d6('0x7')](function(_0x762b77,_0x128a80){if(_0x762b77){_0x2ef604(_0x762b77['toString']());}else{if(_0x128a80){_0x4ca716(_0x128a80);}else{_0x2ef604(_0xa0d6('0x8'));}}});});};module[_0xa0d6('0x9')]=EmailSmtp; \ No newline at end of file +var _0x4ac2=['createTransport','toString','Not\x20verifired','exports','bluebird','nodemailer-plugin-inline-base64','prototype','send','use','verify'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x4ac2,0x130));var _0x24ac=function(_0x219291,_0x1aea39){_0x219291=_0x219291-0x0;var _0x5a61ec=_0x4ac2[_0x219291];return _0x5a61ec;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x24ac('0x0'));var inlineBase64=require(_0x24ac('0x1'));function EmailSmtp(){}EmailSmtp[_0x24ac('0x2')][_0x24ac('0x3')]=function(_0x151886,_0x37b9cf){return new BPromise(function(_0x54ab79,_0x460fbe){var _0x4e2dcf=nodemailer['createTransport'](_0x151886);_0x4e2dcf[_0x24ac('0x4')]('compile',inlineBase64());_0x4e2dcf['sendMail'](_0x37b9cf,function(_0x3aafad,_0x2d7d0b){if(_0x3aafad){_0x460fbe(_0x3aafad['toString']());}else{_0x54ab79(_0x2d7d0b);}});});};EmailSmtp[_0x24ac('0x2')][_0x24ac('0x5')]=function(_0x23c0ee){return new BPromise(function(_0x249d20,_0x1a724b){var _0x5abd4c=nodemailer[_0x24ac('0x6')](_0x23c0ee);_0x5abd4c[_0x24ac('0x5')](function(_0x303e0b,_0x1b64df){if(_0x303e0b){_0x1a724b(_0x303e0b[_0x24ac('0x7')]());}else{if(_0x1b64df){_0x249d20(_0x1b64df);}else{_0x1a724b(_0x24ac('0x8'));}}});});};module[_0x24ac('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index b3c71ee..b00e293 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 _0x9b4e=['test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','split','slice','join','length','isEmpty','html'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9b4e,0x117));var _0xe9b4=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9b4e[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xe9b4('0x0'));var moment=require(_0xe9b4('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0xe9b4('0x2'));var util=require(_0xe9b4('0x3'));var tnef=require(_0xe9b4('0x4'));var logger=require(_0xe9b4('0x5'))(_0xe9b4('0x6'));var config=require(_0xe9b4('0x7'));function getAddress(_0x2a00ba){var _0x181954=_[_0xe9b4('0x8')](_0x2a00ba[_0xe9b4('0x9')]);return _0x181954&&_0x181954[_0xe9b4('0xa')]?_0x181954['address']:_0xe9b4('0xb')+random[_0xe9b4('0xc')](0x6)+_0xe9b4('0xd');}function getFirstName(_0xb3b4ea){var _0x1bd9be=_['head'](_0xb3b4ea[_0xe9b4('0x9')]);if(_0x1bd9be&&_0x1bd9be[_0xe9b4('0xe')]){var _0x3305c6=_0x1bd9be[_0xe9b4('0xe')][_0xe9b4('0xf')](/\s+/);return _0x3305c6['length']?_0x3305c6[_0xe9b4('0x10')](0x0,-0x1)[_0xe9b4('0x11')]('\x20'):_0x1bd9be['name'];}return'Anonymous';}function getLastName(_0x41bc3d){var _0x30c3b4=_[_0xe9b4('0x8')](_0x41bc3d[_0xe9b4('0x9')]);if(_0x30c3b4&&_0x30c3b4['name']){var _0x365ed0=_0x30c3b4[_0xe9b4('0xe')][_0xe9b4('0xf')](/\s+/);return _0x365ed0[_0xe9b4('0x12')]>0x1?_0x365ed0['pop']():'';}return'';}function getMails(_0x436357,_0x206ed6){var _0xc619d8='';for(var _0x479b54=0x0;_0x479b54<_0x206ed6['value'][_0xe9b4('0x12')];_0x479b54+=0x1){if(_0x206ed6['value'][_0x479b54]['address']!==_0x436357){if(!_[_0xe9b4('0x13')](_0xc619d8)){_0xc619d8+=',';}_0xc619d8+=_0x206ed6['value'][_0x479b54][_0xe9b4('0xe')]||_0x206ed6[_0xe9b4('0x9')][_0x479b54]['address']||'';_0xc619d8+='\x20<';_0xc619d8+=_0x206ed6['value'][_0x479b54]['address']?_0x206ed6['value'][_0x479b54][_0xe9b4('0xa')]:_0xe9b4('0xb')+random[_0xe9b4('0xc')](0x6)+'@xcally.com';_0xc619d8+='>';}}return _0xc619d8;}function parseEmail(_0x581f53,_0xe1a3e3,_0x4ed2a4){if(_0xe1a3e3[_0xe9b4('0x14')]){var _0xdd0959=/)<[^<]*)*<\/script>/gi;while(_0xdd0959[_0xe9b4('0x15')](_0xe1a3e3[_0xe9b4('0x14')])){_0xe1a3e3[_0xe9b4('0x14')]=_0xe1a3e3[_0xe9b4('0x14')][_0xe9b4('0x16')](_0xdd0959,'');}if(_0xe1a3e3['html'][_0xe9b4('0x17')](_0xe9b4('0x18'))){var _0x53aef9=[];_0xe1a3e3['attachments'][_0xe9b4('0x19')](_0x3e35d1=>{_0x53aef9[_0xe9b4('0x1a')](_0x3e35d1['filename']);});var _0x15fa16=/]+>/g;var _0x1f5c08=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x5e17f4=_0xe1a3e3[_0xe9b4('0x14')][_0xe9b4('0x16')](_0x1f5c08,_0xe9b4('0x1b'));var _0x4331d3=_0x5e17f4['replace'](_0x15fa16,_0xe9b4('0x1c'));for(let _0x50ffe0=0x0;_0x50ffe0<_0x53aef9[_0xe9b4('0x12')];_0x50ffe0++){var _0x289a21=_0x4331d3['replace'](_0xe9b4('0x1c'),_0xe9b4('0x1d')+_0x53aef9[_0x50ffe0]+_0xe9b4('0x1e'));_0x4331d3=_0x289a21;}_0xe1a3e3[_0xe9b4('0x14')]=_0x4331d3;}_0x4ed2a4['body']=_0xe1a3e3[_0xe9b4('0x14')];}else{_0x4ed2a4[_0xe9b4('0x1f')]=_0xe1a3e3[_0xe9b4('0x20')];}if(_0x4ed2a4['body']){_0x4ed2a4[_0xe9b4('0x1f')]=_0x4ed2a4['body'][_0xe9b4('0x16')](/Empty\x20message

','gmail','imap.mail.yahoo.com','imap-mail.outlook.com','outlook.office365.com','127.0.0.1','randomstring','path','util','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','length','join','Anonymous','split','pop','html','test','\x20[Attachment:\x20','\x20]','body','0x1?_0x4d71ef[_0x2291('0x11')]():'';}return'';}function getMails(_0x1289fa,_0x592377){var _0xca4031='';for(var _0x1206ea=0x0;_0x1206ea<_0x592377[_0x2291('0x7')][_0x2291('0xd')];_0x1206ea+=0x1){if(_0x592377[_0x2291('0x7')][_0x1206ea][_0x2291('0x8')]!==_0x1289fa){if(!_['isEmpty'](_0xca4031)){_0xca4031+=',';}_0xca4031+=_0x592377['value'][_0x1206ea][_0x2291('0xc')]||_0x592377[_0x2291('0x7')][_0x1206ea][_0x2291('0x8')]||'';_0xca4031+='\x20<';_0xca4031+=_0x592377[_0x2291('0x7')][_0x1206ea][_0x2291('0x8')]?_0x592377[_0x2291('0x7')][_0x1206ea][_0x2291('0x8')]:'anonymous'+random[_0x2291('0xa')](0x6)+_0x2291('0xb');_0xca4031+='>';}}return _0xca4031;}function parseEmail(_0x593dbb,_0x3d2d03,_0x6d2470){if(_0x3d2d03[_0x2291('0x12')]){var _0x2289c0=/)<[^<]*)*<\/script>/gi;while(_0x2289c0[_0x2291('0x13')](_0x3d2d03['html'])){_0x3d2d03[_0x2291('0x12')]=_0x3d2d03[_0x2291('0x12')]['replace'](_0x2289c0,'');}if(_0x3d2d03[_0x2291('0x12')]['includes'](_0x2291('0x14'))){var _0x55af33=[];_0x3d2d03[_0x2291('0x15')][_0x2291('0x16')](_0x1105f4=>{_0x55af33[_0x2291('0x17')](_0x1105f4[_0x2291('0x18')]);});var _0x5d25f2=/]+>/g;var _0x50dc37=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0xae32be=_0x3d2d03[_0x2291('0x12')]['replace'](_0x50dc37,_0x2291('0x19'));var _0x405697=_0xae32be[_0x2291('0x1a')](_0x5d25f2,'_IMG');for(let _0x4343ff=0x0;_0x4343ff<_0x55af33[_0x2291('0xd')];_0x4343ff++){var _0x2d18c0=_0x405697[_0x2291('0x1a')]('_IMG',_0x2291('0x1b')+_0x55af33[_0x4343ff]+_0x2291('0x1c'));_0x405697=_0x2d18c0;}_0x3d2d03[_0x2291('0x12')]=_0x405697;}_0x6d2470[_0x2291('0x1d')]=_0x3d2d03[_0x2291('0x12')];}else{_0x6d2470[_0x2291('0x1d')]=_0x3d2d03['textAsHtml'];}if(_0x6d2470[_0x2291('0x1d')]){_0x6d2470['body']=_0x6d2470[_0x2291('0x1d')][_0x2291('0x1a')](/Empty\x20message

';if(_0x3fa60a[_0x2291('0x38')]){for(var _0x13c4b4=0x0;_0x13c4b4<_0x3fa60a[_0x2291('0x38')][_0x2291('0xd')];_0x13c4b4++){var _0x273302=_0x3fa60a[_0x2291('0x38')][_0x13c4b4];_0x376d82[_0x2291('0x1f')][_0x2291('0x15')][_0x2291('0x17')]({'filename':_0x273302[_0x2291('0x39')],'content':new Buffer(_0x273302[_0x2291('0x3a')])});}}}_0x581966(parseEmail(_0x27bab4,_0x4f8154,_0x376d82));});}else{_0x4f8154['html']=_0x2291('0x3b');_0x581966(parseEmail(_0x27bab4,_0x4f8154,_0x376d82));}}else{_0x581966(parseEmail(_0x27bab4,_0x4f8154,_0x376d82));}};exports['getHost']=function(_0x2031a7){switch(_0x2031a7){case _0x2291('0x3c'):return'imap.gmail.com';case'yahoo':return _0x2291('0x3d');case'hotmail':return _0x2291('0x3e');case'outlook365':return _0x2291('0x3f');}return _0x2291('0x40');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 18cfda5..c16b40d 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 _0xb78d=['lodash','name','Service','key','SERV','active','Imap','Smtp','exports'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xb78d,0x1cb));var _0xdb78=function(_0x376545,_0x59cb03){_0x376545=_0x376545-0x0;var _0x4932c7=_0xb78d[_0x376545];return _0x4932c7;};'use strict';var _=require(_0xdb78('0x0'));function MailAccount(_0x4ee40d){this['id']=_0x4ee40d['id']||0x0;this['name']=_0x4ee40d[_0xdb78('0x1')]||_0xdb78('0x2');this['key']=_0x4ee40d[_0xdb78('0x3')]||_0xdb78('0x4');this[_0xdb78('0x5')]=_0x4ee40d['active']||![];this[_0xdb78('0x6')]=_0x4ee40d[_0xdb78('0x6')]||[];this[_0xdb78('0x7')]=_0x4ee40d[_0xdb78('0x7')]||[];}module[_0xdb78('0x8')]=MailAccount; \ No newline at end of file +var _0xc111=['key','SERV','active','Imap','Smtp','exports','lodash','name','Service'];(function(_0x2e31d7,_0x3c688b){var _0x19d428=function(_0xbb828a){while(--_0xbb828a){_0x2e31d7['push'](_0x2e31d7['shift']());}};_0x19d428(++_0x3c688b);}(_0xc111,0x12f));var _0x1c11=function(_0xff7496,_0x1e6921){_0xff7496=_0xff7496-0x0;var _0x4c9363=_0xc111[_0xff7496];return _0x4c9363;};'use strict';var _=require(_0x1c11('0x0'));function MailAccount(_0x5d7382){this['id']=_0x5d7382['id']||0x0;this['name']=_0x5d7382[_0x1c11('0x1')]||_0x1c11('0x2');this[_0x1c11('0x3')]=_0x5d7382['key']||_0x1c11('0x4');this[_0x1c11('0x5')]=_0x5d7382[_0x1c11('0x5')]||![];this[_0x1c11('0x6')]=_0x5d7382[_0x1c11('0x6')]||[];this[_0x1c11('0x7')]=_0x5d7382[_0x1c11('0x7')]||[];}module[_0x1c11('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 57e346c..a2f635b 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 _0xd865=['mailAccounts','mergeFromDatabase','hasOwnProperty','initMailAccounts','length','isUndefined','merge','../model/mailAccount'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xd865,0xef));var _0x5d86=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd865[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var MailAccount=require(_0x5d86('0x0'));var Realtime=function(){this[_0x5d86('0x1')]={};};function freeIsNotKey(_0x5e71d0,_0x302506,_0x29c0db){var _0x550ad2=_['mapKeys'](_0x5e71d0,function(_0x5f1d74,_0x50c144){return _0x5f1d74[_0x29c0db];});for(var _0x533137 in _0x302506){if(_0x302506['hasOwnProperty'](_0x533137)){if(!_0x550ad2[_0x533137]){delete _0x302506[_0x533137];}}}}Realtime['prototype'][_0x5d86('0x2')]=function(_0x2c0f35,_0x12c15d){for(var _0x111407 in _0x12c15d){if(_0x2c0f35[_0x5d86('0x3')](_0x111407)){_0x2c0f35[_0x111407]=_0x12c15d[_0x111407];}}};Realtime['prototype'][_0x5d86('0x4')]=function(){var _0x1ef442=this;return function(_0xad91f8){if(_0xad91f8){freeIsNotKey(_0xad91f8,_0x1ef442[_0x5d86('0x1')],'id');for(var _0x1b4c1b=0x0,_0x2edd1a={},_0xd4b844={};_0x1b4c1b<_0xad91f8[_0x5d86('0x5')];_0x1b4c1b+=0x1){_0x2edd1a=_0xad91f8[_0x1b4c1b];if(_[_0x5d86('0x6')](_0x1ef442[_0x5d86('0x1')][_0x2edd1a['id']])){_0x1ef442['mailAccounts'][_0x2edd1a['id']]=new MailAccount(_0x2edd1a);}else{_[_0x5d86('0x7')](_0x1ef442[_0x5d86('0x1')][_0x2edd1a['id']],_0x2edd1a);}}}return _0x1ef442[_0x5d86('0x1')];};};module['exports']=Realtime; \ No newline at end of file +var _0xe64f=['mergeFromDatabase','initMailAccounts','length','isUndefined','merge','exports','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype'];(function(_0x480d7d,_0x13dff3){var _0x497ad6=function(_0x9b5e20){while(--_0x9b5e20){_0x480d7d['push'](_0x480d7d['shift']());}};_0x497ad6(++_0x13dff3);}(_0xe64f,0x1b3));var _0xfe64=function(_0x5e0206,_0x19a6a9){_0x5e0206=_0x5e0206-0x0;var _0x112de4=_0xe64f[_0x5e0206];return _0x112de4;};'use strict';var _=require('lodash');var MailAccount=require(_0xfe64('0x0'));var Realtime=function(){this[_0xfe64('0x1')]={};};function freeIsNotKey(_0x3917a4,_0x321f1c,_0x47f4fc){var _0x4bf972=_[_0xfe64('0x2')](_0x3917a4,function(_0x47316b,_0x544018){return _0x47316b[_0x47f4fc];});for(var _0x3407e3 in _0x321f1c){if(_0x321f1c[_0xfe64('0x3')](_0x3407e3)){if(!_0x4bf972[_0x3407e3]){delete _0x321f1c[_0x3407e3];}}}}Realtime[_0xfe64('0x4')][_0xfe64('0x5')]=function(_0x22b2fd,_0x1a56b8){for(var _0x54ddbb in _0x1a56b8){if(_0x22b2fd[_0xfe64('0x3')](_0x54ddbb)){_0x22b2fd[_0x54ddbb]=_0x1a56b8[_0x54ddbb];}}};Realtime['prototype'][_0xfe64('0x6')]=function(){var _0x253522=this;return function(_0x565076){if(_0x565076){freeIsNotKey(_0x565076,_0x253522[_0xfe64('0x1')],'id');for(var _0x3dfc81=0x0,_0x1d60a8={},_0x319436={};_0x3dfc81<_0x565076[_0xfe64('0x7')];_0x3dfc81+=0x1){_0x1d60a8=_0x565076[_0x3dfc81];if(_[_0xfe64('0x8')](_0x253522[_0xfe64('0x1')][_0x1d60a8['id']])){_0x253522[_0xfe64('0x1')][_0x1d60a8['id']]=new MailAccount(_0x1d60a8);}else{_[_0xfe64('0x9')](_0x253522['mailAccounts'][_0x1d60a8['id']],_0x1d60a8);}}}return _0x253522[_0xfe64('0x1')];};};module[_0xfe64('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 85e0438..29166f5 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 _0x3a0f=['Request','service','email','active','key','ListId','TemplateId','MailServerIn','Imap','Smtp','getMailAccount','notify','NotifyMailAccount'];(function(_0x340ddf,_0xa59cd){var _0x5042ff=function(_0x46f0bb){while(--_0x46f0bb){_0x340ddf['push'](_0x340ddf['shift']());}};_0x5042ff(++_0xa59cd);}(_0x3a0f,0x145));var _0xf3a0=function(_0x3f3b3f,_0x118ef1){_0x3f3b3f=_0x3f3b3f-0x0;var _0x59c79a=_0x3a0f[_0x3f3b3f];return _0x59c79a;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client[_0xf3a0('0x0')]('GetMailAccount',{'options':{'attributes':['id','name',_0xf3a0('0x1'),_0xf3a0('0x2'),_0xf3a0('0x3'),_0xf3a0('0x4'),_0xf3a0('0x5'),_0xf3a0('0x6')],'raw':![],'include':[{'model':_0xf3a0('0x7'),'as':_0xf3a0('0x8')},{'model':'MailServerOut','as':_0xf3a0('0x9')}]},'log':_0xf3a0('0xa')});};};exports[_0xf3a0('0xb')]=function(_0xb2784d,_0x5d64bc){return client[_0xf3a0('0x0')](_0xf3a0('0xc'),{'account':{'id':_0xb2784d},'body':_0x5d64bc,'log':_0xf3a0('0xc')});}; \ No newline at end of file +var _0xf693=['NotifyMailAccount','getMailAccounts','Request','GetMailAccount','name','service','email','active','ListId','TemplateId','MailServerIn','Imap','MailServerOut','Smtp','getMailAccount','notify'];(function(_0xdc244,_0x440bc1){var _0x5a65f9=function(_0x25ff9f){while(--_0x25ff9f){_0xdc244['push'](_0xdc244['shift']());}};_0x5a65f9(++_0x440bc1);}(_0xf693,0x181));var _0x3f69=function(_0x14c2f8,_0x5ae52d){_0x14c2f8=_0x14c2f8-0x0;var _0x3d7eb9=_0xf693[_0x14c2f8];return _0x3d7eb9;};'use strict';var client=require('../client');exports[_0x3f69('0x0')]=function(){return function(){return client[_0x3f69('0x1')](_0x3f69('0x2'),{'options':{'attributes':['id',_0x3f69('0x3'),_0x3f69('0x4'),_0x3f69('0x5'),_0x3f69('0x6'),'key',_0x3f69('0x7'),_0x3f69('0x8')],'raw':![],'include':[{'model':_0x3f69('0x9'),'as':_0x3f69('0xa')},{'model':_0x3f69('0xb'),'as':_0x3f69('0xc')}]},'log':_0x3f69('0xd')});};};exports[_0x3f69('0xe')]=function(_0x1ac268,_0xad860e){return client[_0x3f69('0x1')](_0x3f69('0xf'),{'account':{'id':_0x1ac268},'body':_0xad860e,'log':_0x3f69('0xf')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 8df2254..c68a409 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 _0xaeaf=['RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','../../../config/logger','email','sendMail','account','then','catch','error','verifySmtp','Verified','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!'];(function(_0x2e9ca2,_0x35dcea){var _0x269542=function(_0x2ed5b0){while(--_0x2ed5b0){_0x2e9ca2['push'](_0x2e9ca2['shift']());}};_0x269542(++_0x35dcea);}(_0xaeaf,0x139));var _0xfaea=function(_0x202c61,_0x3673e0){_0x202c61=_0x202c61-0x0;var _0x540691=_0xaeaf[_0x202c61];return _0x540691;};'use strict';var jayson=require(_0xfaea('0x0'));var BPromise=require(_0xfaea('0x1'));var _=require(_0xfaea('0x2'));var logger=require(_0xfaea('0x3'))(_0xfaea('0x4'));exports['listen']=function(_0x1be538,_0x241ae9){return new BPromise(function(_0xf2077c,_0x3359d2){var _0x41e716={'SendMail':function(_0x486a51){var _0x3d6f3e=this;return new Promise(function(_0x4db267,_0x417e9d){_0x241ae9[_0xfaea('0x5')](_0x486a51[_0xfaea('0x6')],_0x486a51['message'])[_0xfaea('0x7')](function(_0x51112b){_0x4db267({'code':0xc8,'message':_0x51112b});})[_0xfaea('0x8')](function(_0x58f73b){_0x417e9d(_0x3d6f3e[_0xfaea('0x9')](0x1f4,_0x58f73b));});});},'VerifySmtp':function(_0xdff476){var _0x45cbbe=this;return new Promise(function(_0x533559,_0x494349){_0x241ae9[_0xfaea('0xa')](_0xdff476[_0xfaea('0x6')])[_0xfaea('0x7')](function(_0x1b8839){_0x533559({'code':0xc8,'message':_0xfaea('0xb')});})['catch'](function(_0x422a64){_0x494349(_0x45cbbe['error'](0x1f4,_0x422a64));});});},'MailAccounts':function(_0x34ef51){return new Promise(function(_0x59e559,_0x317455){var _0x52706a=_['values'](_0x1be538['mailAccounts']);for(var _0x4c89b3=0x0;_0x4c89b3<_0x52706a[_0xfaea('0xc')];_0x4c89b3+=0x1){if(_0x52706a[_0x4c89b3]['Imap']&&_0x52706a[_0x4c89b3][_0xfaea('0xd')][_0xfaea('0xe')]){delete _0x52706a[_0x4c89b3][_0xfaea('0xd')][_0xfaea('0xe')];}if(_0x52706a[_0x4c89b3][_0xfaea('0xf')]&&_0x52706a[_0x4c89b3]['Smtp'][_0xfaea('0x10')]){delete _0x52706a[_0x4c89b3][_0xfaea('0xf')][_0xfaea('0x10')];}}_0x59e559({'count':_0x52706a[_0xfaea('0xc')],'rows':_0x52706a});});}};var _0x3abf7e=jayson[_0xfaea('0x11')](_0x41e716)[_0xfaea('0x12')]();_0x3abf7e['on'](_0xfaea('0x9'),function(_0x4cf972){logger[_0xfaea('0x9')](JSON[_0xfaea('0x13')](_0x4cf972));return _0x3359d2(_0x4cf972);});_0x3abf7e['listen'](0x232b,_0xfaea('0x14'),function(){console[_0xfaea('0x15')](_0xfaea('0x16'),0x232b);return _0xf2077c(_0xfaea('0x17')+0x232b);});});}; \ No newline at end of file +var _0x4ee1=['stringify','log','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','../../../config/logger','email','listen','sendMail','account','message','then','catch','verifySmtp','Verified','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','error'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x4ee1,0x148));var _0x14ee=function(_0x52d01e,_0x221eb7){_0x52d01e=_0x52d01e-0x0;var _0x105dc0=_0x4ee1[_0x52d01e];return _0x105dc0;};'use strict';var jayson=require(_0x14ee('0x0'));var BPromise=require(_0x14ee('0x1'));var _=require('lodash');var logger=require(_0x14ee('0x2'))(_0x14ee('0x3'));exports[_0x14ee('0x4')]=function(_0x3fdef4,_0x218fc5){return new BPromise(function(_0x2ea588,_0x17108c){var _0x48d644={'SendMail':function(_0x4640b0){var _0x1e188a=this;return new Promise(function(_0x343bad,_0x582c40){_0x218fc5[_0x14ee('0x5')](_0x4640b0[_0x14ee('0x6')],_0x4640b0[_0x14ee('0x7')])[_0x14ee('0x8')](function(_0x11873f){_0x343bad({'code':0xc8,'message':_0x11873f});})[_0x14ee('0x9')](function(_0x446272){_0x582c40(_0x1e188a['error'](0x1f4,_0x446272));});});},'VerifySmtp':function(_0x2cf49b){var _0x4f5c86=this;return new Promise(function(_0x566cfb,_0x202eab){_0x218fc5[_0x14ee('0xa')](_0x2cf49b[_0x14ee('0x6')])[_0x14ee('0x8')](function(_0x5ec350){_0x566cfb({'code':0xc8,'message':_0x14ee('0xb')});})[_0x14ee('0x9')](function(_0x4658c4){_0x202eab(_0x4f5c86['error'](0x1f4,_0x4658c4));});});},'MailAccounts':function(_0x502b72){return new Promise(function(_0x4afb4d,_0x39b2fd){var _0x30b060=_[_0x14ee('0xc')](_0x3fdef4[_0x14ee('0xd')]);for(var _0x322395=0x0;_0x322395<_0x30b060[_0x14ee('0xe')];_0x322395+=0x1){if(_0x30b060[_0x322395]['Imap']&&_0x30b060[_0x322395][_0x14ee('0xf')][_0x14ee('0x10')]){delete _0x30b060[_0x322395][_0x14ee('0xf')][_0x14ee('0x10')];}if(_0x30b060[_0x322395][_0x14ee('0x11')]&&_0x30b060[_0x322395][_0x14ee('0x11')][_0x14ee('0x12')]){delete _0x30b060[_0x322395][_0x14ee('0x11')]['pass'];}}_0x4afb4d({'count':_0x30b060['length'],'rows':_0x30b060});});}};var _0x2fa36b=jayson[_0x14ee('0x13')](_0x48d644)[_0x14ee('0x14')]();_0x2fa36b['on'](_0x14ee('0x15'),function(_0x140e5b){logger[_0x14ee('0x15')](JSON[_0x14ee('0x16')](_0x140e5b));return _0x17108c(_0x140e5b);});_0x2fa36b[_0x14ee('0x4')](0x232b,'127.0.0.1',function(){console[_0x14ee('0x17')]('Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232b);return _0x2ea588(_0x14ee('0x18')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index b03d7de..7a2254f 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 _0x0c33=['socket.io-redis','../../config/triggers','../../config/socketio','default','../../config/express','../../routes','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','express','sticky-session','ioredis','createServer','timeout','listen','port','polling','redis','defaults'];(function(_0x3cdb91,_0x26f11e){var _0x332bfe=function(_0x8e9bb5){while(--_0x8e9bb5){_0x3cdb91['push'](_0x3cdb91['shift']());}};_0x332bfe(++_0x26f11e);}(_0x0c33,0x1c3));var _0x30c3=function(_0x255c48,_0x2a4449){_0x255c48=_0x255c48-0x0;var _0xaebda3=_0x0c33[_0x255c48];return _0xaebda3;};'use strict';var _=require('lodash');var http=require(_0x30c3('0x0'));var express=require(_0x30c3('0x1'));var sticky=require(_0x30c3('0x2'));var Redis=require(_0x30c3('0x3'));var config=require('../../config/environment');var app=express();var server=http[_0x30c3('0x4')](app);server[_0x30c3('0x5')]=0xdbba0;if(sticky[_0x30c3('0x6')](server,config[_0x30c3('0x7')])){var socketio=require('socket.io')(server,{'transports':['websocket',_0x30c3('0x8')]});config[_0x30c3('0x9')]=_[_0x30c3('0xa')](config[_0x30c3('0x9')],{'host':'localhost','port':0x18eb});socketio['adapter'](require(_0x30c3('0xb'))({'pubClient':new Redis(config[_0x30c3('0x9')]),'subClient':new Redis(config['redis'])}));require(_0x30c3('0xc'))['default']();require(_0x30c3('0xd'))[_0x30c3('0xe')](socketio);require(_0x30c3('0xf'))[_0x30c3('0xe')](app);require(_0x30c3('0x10'))[_0x30c3('0xe')](app);}else{server['once'](_0x30c3('0x11'),function(){console[_0x30c3('0x12')](_0x30c3('0x13'),config[_0x30c3('0x7')]);});}exports=module[_0x30c3('0x14')]=app; \ No newline at end of file +var _0xed6d=['listening','log','port','exports','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','socket.io','websocket','polling','redis','localhost','adapter','socket.io-redis','default','../../config/socketio','../../routes'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0xed6d,0x12a));var _0xded6=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xed6d[_0x2235bf];return _0x4c3a64;};'use strict';var _=require('lodash');var http=require(_0xded6('0x0'));var express=require(_0xded6('0x1'));var sticky=require(_0xded6('0x2'));var Redis=require(_0xded6('0x3'));var config=require(_0xded6('0x4'));var app=express();var server=http[_0xded6('0x5')](app);server[_0xded6('0x6')]=0xdbba0;if(sticky['listen'](server,config['port'])){var socketio=require(_0xded6('0x7'))(server,{'transports':[_0xded6('0x8'),_0xded6('0x9')]});config[_0xded6('0xa')]=_['defaults'](config['redis'],{'host':_0xded6('0xb'),'port':0x18eb});socketio[_0xded6('0xc')](require(_0xded6('0xd'))({'pubClient':new Redis(config[_0xded6('0xa')]),'subClient':new Redis(config[_0xded6('0xa')])}));require('../../config/triggers')[_0xded6('0xe')]();require(_0xded6('0xf'))['default'](socketio);require('../../config/express')[_0xded6('0xe')](app);require(_0xded6('0x10'))[_0xded6('0xe')](app);}else{server['once'](_0xded6('0x11'),function(){console[_0xded6('0x12')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0xded6('0x13')]);});}exports=module[_0xded6('0x14')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 0b22c50..2d3b19b 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 _0x1b69=['error','message','result','exports','routing','client','http','request','then','debug','rpc'];(function(_0x3a1e95,_0x15a2c2){var _0x219501=function(_0x3df3bc){while(--_0x3df3bc){_0x3a1e95['push'](_0x3a1e95['shift']());}};_0x219501(++_0x15a2c2);}(_0x1b69,0x190));var _0x91b6=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x1b69[_0x11ce46];return _0x368a1e;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require('../../config/logger')(_0x91b6('0x0'));var client=jayson[_0x91b6('0x1')][_0x91b6('0x2')]({'port':0x2329});client['Request']=function(_0x4663d3,_0xbbd6b7){return new BPromise(function(_0x35a742,_0x5f1514){return client[_0x91b6('0x3')](_0x4663d3,_0xbbd6b7)[_0x91b6('0x4')](function(_0x264272){logger[_0x91b6('0x5')](_0x91b6('0x6'),_0x91b6('0x0'),_0x4663d3,_0xbbd6b7,_0x264272);if(_0x264272[_0x91b6('0x7')]){logger[_0x91b6('0x7')](_0x91b6('0x6'),_0x91b6('0x0'),_0x4663d3,_0x264272['error']['message'],_0xbbd6b7);return _0x5f1514(_0x264272[_0x91b6('0x7')][_0x91b6('0x8')]);}else{return _0x35a742(_0x264272[_0x91b6('0x9')]);}})['catch'](function(_0x37376c){logger[_0x91b6('0x7')](_0x91b6('0x6'),_0x91b6('0x0'),_0x4663d3,_0x37376c,_0xbbd6b7);return _0x5f1514(_0x37376c);});});};module[_0x91b6('0xa')]=client; \ No newline at end of file +var _0xd6d2=['then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','routing','client','Request'];(function(_0x2a32ca,_0x23c129){var _0x44767a=function(_0x31ffd3){while(--_0x31ffd3){_0x2a32ca['push'](_0x2a32ca['shift']());}};_0x44767a(++_0x23c129);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x38941a,_0x3a26ef){_0x38941a=_0x38941a-0x0;var _0x5dff6a=_0xd6d2[_0x38941a];return _0x5dff6a;};'use strict';var jayson=require(_0x2d6d('0x0'));var BPromise=require(_0x2d6d('0x1'));var logger=require('../../config/logger')(_0x2d6d('0x2'));var client=jayson[_0x2d6d('0x3')]['http']({'port':0x2329});client[_0x2d6d('0x4')]=function(_0x482d86,_0x1c5e54){return new BPromise(function(_0x3ee519,_0x168531){return client['request'](_0x482d86,_0x1c5e54)[_0x2d6d('0x5')](function(_0x132361){logger[_0x2d6d('0x6')](_0x2d6d('0x7'),_0x2d6d('0x2'),_0x482d86,_0x1c5e54,_0x132361);if(_0x132361[_0x2d6d('0x8')]){logger[_0x2d6d('0x8')](_0x2d6d('0x7'),_0x2d6d('0x2'),_0x482d86,_0x132361[_0x2d6d('0x8')][_0x2d6d('0x9')],_0x1c5e54);return _0x168531(_0x132361['error'][_0x2d6d('0x9')]);}else{return _0x3ee519(_0x132361[_0x2d6d('0xa')]);}})[_0x2d6d('0xb')](function(_0x3cc2fa){logger[_0x2d6d('0x8')]('rpc',_0x2d6d('0x2'),_0x482d86,_0x3cc2fa,_0x1c5e54);return _0x168531(_0x3cc2fa);});});};module[_0x2d6d('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 80bf6a7..7a22f36 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 _0xf88d=['./rpc/mailQueue','./rpc/faxQueue','then','initAgents','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','log','bluebird','./server','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue'];(function(_0x391295,_0x133a70){var _0x50b4c6=function(_0x2f125f){while(--_0x2f125f){_0x391295['push'](_0x391295['shift']());}};_0x50b4c6(++_0x133a70);}(_0xf88d,0x198));var _0xdf88=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0xf88d[_0x576170];return _0x397c70;};'use strict';var BPromise=require(_0xdf88('0x0'));var server=require(_0xdf88('0x1'));var Realtime=require('./realtime');var user=require(_0xdf88('0x2'));var interval=require(_0xdf88('0x3'));var openchannelQueue=require(_0xdf88('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xdf88('0x5'));var mailQueue=require(_0xdf88('0x6'));var faxQueue=require(_0xdf88('0x7'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xdf88('0x8')](user['getAgents']())[_0xdf88('0x8')](realtime[_0xdf88('0x9')]())['then'](interval[_0xdf88('0xa')]())[_0xdf88('0x8')](realtime[_0xdf88('0xb')]())[_0xdf88('0x8')](openchannelQueue['getOpenchannelQueues']())[_0xdf88('0x8')](realtime[_0xdf88('0xc')]())[_0xdf88('0x8')](chatQueue[_0xdf88('0xd')]())[_0xdf88('0x8')](realtime[_0xdf88('0xe')]())[_0xdf88('0x8')](smsQueue['getSmsQueues']())[_0xdf88('0x8')](realtime[_0xdf88('0xf')]())[_0xdf88('0x8')](mailQueue['getMailQueues']())[_0xdf88('0x8')](realtime[_0xdf88('0x10')]())['then'](faxQueue[_0xdf88('0x11')]())[_0xdf88('0x8')](realtime[_0xdf88('0x12')]())[_0xdf88('0x8')](whatsappQueue[_0xdf88('0x13')]())['then'](realtime[_0xdf88('0x14')]())[_0xdf88('0x8')](function(){return realtime;});}function main(){return server[_0xdf88('0x15')](realtime)[_0xdf88('0x8')](function(_0x5d13d1){return initRealtime();})[_0xdf88('0x8')](function(_0x369ff9){return setInterval(initRealtime,0x1388);})['catch'](function(_0x43d5fa){console[_0xdf88('0x16')](_0x43d5fa);});}main(); \ No newline at end of file +var _0xc415=['initAgents','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc415,0x176));var _0x5c41=function(_0x2a840a,_0x3812ab){_0x2a840a=_0x2a840a-0x0;var _0x3ba2de=_0xc415[_0x2a840a];return _0x3ba2de;};'use strict';var BPromise=require('bluebird');var server=require(_0x5c41('0x0'));var Realtime=require(_0x5c41('0x1'));var user=require(_0x5c41('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x5c41('0x3'));var chatQueue=require(_0x5c41('0x4'));var smsQueue=require(_0x5c41('0x5'));var mailQueue=require(_0x5c41('0x6'));var faxQueue=require(_0x5c41('0x7'));var whatsappQueue=require(_0x5c41('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x5c41('0x9')](user['getAgents']())[_0x5c41('0x9')](realtime[_0x5c41('0xa')]())[_0x5c41('0x9')](interval[_0x5c41('0xb')]())[_0x5c41('0x9')](realtime[_0x5c41('0xc')]())[_0x5c41('0x9')](openchannelQueue[_0x5c41('0xd')]())['then'](realtime['initOpenchannelQueues']())['then'](chatQueue[_0x5c41('0xe')]())[_0x5c41('0x9')](realtime[_0x5c41('0xf')]())[_0x5c41('0x9')](smsQueue[_0x5c41('0x10')]())[_0x5c41('0x9')](realtime[_0x5c41('0x11')]())[_0x5c41('0x9')](mailQueue[_0x5c41('0x12')]())[_0x5c41('0x9')](realtime['initMailQueues']())[_0x5c41('0x9')](faxQueue[_0x5c41('0x13')]())[_0x5c41('0x9')](realtime[_0x5c41('0x14')]())[_0x5c41('0x9')](whatsappQueue[_0x5c41('0x15')]())[_0x5c41('0x9')](realtime[_0x5c41('0x16')]())[_0x5c41('0x9')](function(){return realtime;});}function main(){return server[_0x5c41('0x17')](realtime)[_0x5c41('0x9')](function(_0x5597aa){return initRealtime();})[_0x5c41('0x9')](function(_0x475c14){return setInterval(initRealtime,0x1388);})['catch'](function(_0x557902){console['log'](_0x557902);});}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 2ddfd05..3cb3777 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 _0x9d28=['consequence','ruleRef','name','call','nextTick','next','length','condition','matchPath','noop','findRules','turn','prioritize','priority','map','toString','isNil','fromJSON','parse','object','register','exports','lodash','util','events','init','ignoreFactChanges','prototype','rules','activeRules','isArray','push','sync','orderBy','execute','result','clone'];(function(_0xf44591,_0x326271){var _0x203c91=function(_0x2d8868){while(--_0x2d8868){_0xf44591['push'](_0xf44591['shift']());}};_0x203c91(++_0x326271);}(_0x9d28,0x163));var _0x89d2=function(_0x4f6d08,_0x1b3dd0){_0x4f6d08=_0x4f6d08-0x0;var _0x53a9c6=_0x9d28[_0x4f6d08];return _0x53a9c6;};'use strict';var _=require(_0x89d2('0x0'));var util=require(_0x89d2('0x1'));var EventEmitter=require(_0x89d2('0x2'))['EventEmitter'];function RuleEngine(_0x2f9f9e,_0x238fbd){this[_0x89d2('0x3')]();if(!_['isNil'](_0x2f9f9e)){this['register'](_0x2f9f9e);}if(_0x238fbd){this[_0x89d2('0x4')]=_0x238fbd['ignoreFactChanges'];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine[_0x89d2('0x5')][_0x89d2('0x3')]=function(_0x1c7565){this[_0x89d2('0x6')]=[];this[_0x89d2('0x7')]=[];};RuleEngine['prototype']['register']=function(_0x90b389){if(Array[_0x89d2('0x8')](_0x90b389)){this[_0x89d2('0x6')]=this[_0x89d2('0x6')]['concat'](_0x90b389);}else if(_0x90b389!==null&&_['isObject'](_0x90b389)){this[_0x89d2('0x6')][_0x89d2('0x9')](_0x90b389);}this[_0x89d2('0xa')]();};RuleEngine['prototype']['sync']=function(){this[_0x89d2('0x7')]=this[_0x89d2('0x6')]['filter'](function(_0x355784){if(_['isNil'](_0x355784['on'])){_0x355784['on']=!![];}if(_0x355784['on']===!![]){return _0x355784;}});this[_0x89d2('0x7')]=_[_0x89d2('0xb')](this[_0x89d2('0x7')],['p'],['asc']);};RuleEngine[_0x89d2('0x5')][_0x89d2('0xc')]=function(_0x5216ec,_0x18ecd1){var _0x3b5c04=![];_0x5216ec[_0x89d2('0xd')]=!![];var _0x360875=_['clone'](_0x5216ec);var _0x25fd96=_[_0x89d2('0xe')](_0x5216ec);var _0x3f1cdb=this[_0x89d2('0x7')];var _0x3556e4=[];var _0xaf9e2=this[_0x89d2('0x4')];(function FnRuleLoop(_0x55bdf7){var _0x412de7={'rules':function(){return _0x3f1cdb;},'rule':function(){return _0x3f1cdb[_0x55bdf7];},'when':function(_0x53df98){if(_0x53df98){var _0x507971=_0x3f1cdb[_0x55bdf7][_0x89d2('0xf')];_0x507971[_0x89d2('0x10')]=_0x3f1cdb[_0x55bdf7]['id']||_0x3f1cdb[_0x55bdf7][_0x89d2('0x11')]||'index_'+_0x55bdf7;process['nextTick'](function(){_0x3556e4[_0x89d2('0x9')](_0x507971[_0x89d2('0x10')]);_0x507971[_0x89d2('0x12')](_0x360875,_0x412de7);});}else{process[_0x89d2('0x13')](function(){_0x412de7[_0x89d2('0x14')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x3b5c04=!![];return FnRuleLoop(0x0);},'next':function(_0x1a9e69){if(!_0xaf9e2&&!_['isEqual'](_0x25fd96,_0x360875)){_0x25fd96=_[_0x89d2('0xe')](_0x360875);process[_0x89d2('0x13')](function(){_0x412de7['restart']();});}else{process[_0x89d2('0x13')](function(){if(_['isNil'](_0x1a9e69)){return FnRuleLoop(_0x55bdf7+0x1);}else{return FnRuleLoop(_0x1a9e69);}});}}};if(_0x55bdf7<_0x3f1cdb[_0x89d2('0x15')]&&_0x3b5c04===![]){var _0x250bd2=_0x3f1cdb[_0x55bdf7][_0x89d2('0x16')];_0x250bd2[_0x89d2('0x12')](_0x360875,_0x412de7);}else{process[_0x89d2('0x13')](function(){_0x360875[_0x89d2('0x17')]=_0x3556e4;return _0x18ecd1?_0x18ecd1(_0x360875):_[_0x89d2('0x18')]();});}}(0x0));};RuleEngine[_0x89d2('0x5')][_0x89d2('0x19')]=function(_0x5a5b91){if(_['isNil'](_0x5a5b91)){return this[_0x89d2('0x6')];}else{var _0x53bb5a=_['matches'](_0x5a5b91);return _['filter'](this[_0x89d2('0x6')],_0x53bb5a);}};RuleEngine[_0x89d2('0x5')][_0x89d2('0x1a')]=function(_0x387965,_0x17a133){var _0x1ec212=_0x387965==='on'||_0x387965==='ON'?!![]:![];var _0x3da086=this[_0x89d2('0x19')](_0x17a133);for(var _0x419ff0=0x0,_0x31188f=_0x3da086[_0x89d2('0x15')];_0x419ff0<_0x31188f;_0x419ff0+=0x1){_0x3da086[_0x419ff0]['on']=_0x1ec212;}this[_0x89d2('0xa')]();};RuleEngine[_0x89d2('0x5')][_0x89d2('0x1b')]=function(_0x4b34ed,_0x17732e){_0x4b34ed=parseInt(_0x4b34ed,0xa);var _0x2dff6f=this[_0x89d2('0x19')](_0x17732e);for(var _0x5092e2=0x0,_0x43713a=_0x2dff6f[_0x89d2('0x15')];_0x5092e2<_0x43713a;_0x5092e2+=0x1){_0x2dff6f[_0x5092e2][_0x89d2('0x1c')]=_0x4b34ed;}this[_0x89d2('0xa')]();};RuleEngine[_0x89d2('0x5')]['toJSON']=function(){var _0x2bb425=this[_0x89d2('0x6')];if(_0x2bb425 instanceof Array){_0x2bb425=_0x2bb425[_0x89d2('0x1d')](function(_0x275437){_0x275437[_0x89d2('0x16')]=_0x275437[_0x89d2('0x16')][_0x89d2('0x1e')]();_0x275437[_0x89d2('0xf')]=_0x275437[_0x89d2('0xf')]['toString']();return _0x275437;});}else if(!_[_0x89d2('0x1f')](_0x2bb425)){_0x2bb425[_0x89d2('0x16')]=_0x2bb425[_0x89d2('0x16')][_0x89d2('0x1e')]();_0x2bb425[_0x89d2('0xf')]=_0x2bb425[_0x89d2('0xf')]['toString']();}return _0x2bb425;};RuleEngine[_0x89d2('0x5')][_0x89d2('0x20')]=function(_0x4e7bc0){this['init']();if(_['isString'](_0x4e7bc0)){_0x4e7bc0=JSON[_0x89d2('0x21')](_0x4e7bc0);}if(_0x4e7bc0 instanceof Array){_0x4e7bc0=_0x4e7bc0['map'](function(_0x446475){_0x446475[_0x89d2('0x16')]=eval('('+_0x446475[_0x89d2('0x16')]+')');_0x446475['consequence']=eval('('+_0x446475['consequence']+')');return _0x446475;});}else if(_0x4e7bc0!==null&&typeof _0x4e7bc0==_0x89d2('0x22')){_0x4e7bc0['condition']=eval('('+_0x4e7bc0[_0x89d2('0x16')]+')');_0x4e7bc0['consequence']=eval('('+_0x4e7bc0['consequence']+')');}this[_0x89d2('0x23')](_0x4e7bc0);};module[_0x89d2('0x24')]=RuleEngine; \ No newline at end of file +var _0x765d=['findRules','matches','turn','prioritize','toJSON','toString','fromJSON','isString','map','exports','lodash','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','isArray','concat','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','push','call','next','isEqual','nextTick','restart','length','condition','matchPath'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x765d,0xae));var _0xd765=function(_0x4ae00a,_0x2f3aa5){_0x4ae00a=_0x4ae00a-0x0;var _0x539df7=_0x765d[_0x4ae00a];return _0x539df7;};'use strict';var _=require(_0xd765('0x0'));var util=require('util');var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x748d07,_0x247551){this[_0xd765('0x1')]();if(!_[_0xd765('0x2')](_0x748d07)){this[_0xd765('0x3')](_0x748d07);}if(_0x247551){this['ignoreFactChanges']=_0x247551[_0xd765('0x4')];}return this;}util[_0xd765('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xd765('0x6')][_0xd765('0x1')]=function(_0x284ec4){this[_0xd765('0x7')]=[];this[_0xd765('0x8')]=[];};RuleEngine[_0xd765('0x6')][_0xd765('0x3')]=function(_0x34109a){if(Array[_0xd765('0x9')](_0x34109a)){this[_0xd765('0x7')]=this[_0xd765('0x7')][_0xd765('0xa')](_0x34109a);}else if(_0x34109a!==null&&_['isObject'](_0x34109a)){this[_0xd765('0x7')]['push'](_0x34109a);}this['sync']();};RuleEngine['prototype'][_0xd765('0xb')]=function(){this[_0xd765('0x8')]=this[_0xd765('0x7')][_0xd765('0xc')](function(_0x4f84ea){if(_[_0xd765('0x2')](_0x4f84ea['on'])){_0x4f84ea['on']=!![];}if(_0x4f84ea['on']===!![]){return _0x4f84ea;}});this[_0xd765('0x8')]=_[_0xd765('0xd')](this[_0xd765('0x8')],['p'],[_0xd765('0xe')]);};RuleEngine[_0xd765('0x6')][_0xd765('0xf')]=function(_0x45acbd,_0x1ccefa){var _0x16fe09=![];_0x45acbd[_0xd765('0x10')]=!![];var _0x51cddf=_[_0xd765('0x11')](_0x45acbd);var _0x29fc3f=_[_0xd765('0x11')](_0x45acbd);var _0x3eceac=this['activeRules'];var _0xadf38a=[];var _0x12f99b=this[_0xd765('0x4')];(function FnRuleLoop(_0x27524c){var _0x30fa22={'rules':function(){return _0x3eceac;},'rule':function(){return _0x3eceac[_0x27524c];},'when':function(_0x2dd74e){if(_0x2dd74e){var _0x46e273=_0x3eceac[_0x27524c][_0xd765('0x12')];_0x46e273[_0xd765('0x13')]=_0x3eceac[_0x27524c]['id']||_0x3eceac[_0x27524c][_0xd765('0x14')]||_0xd765('0x15')+_0x27524c;process['nextTick'](function(){_0xadf38a[_0xd765('0x16')](_0x46e273[_0xd765('0x13')]);_0x46e273[_0xd765('0x17')](_0x51cddf,_0x30fa22);});}else{process['nextTick'](function(){_0x30fa22[_0xd765('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x16fe09=!![];return FnRuleLoop(0x0);},'next':function(_0x15c9fd){if(!_0x12f99b&&!_[_0xd765('0x19')](_0x29fc3f,_0x51cddf)){_0x29fc3f=_[_0xd765('0x11')](_0x51cddf);process[_0xd765('0x1a')](function(){_0x30fa22[_0xd765('0x1b')]();});}else{process[_0xd765('0x1a')](function(){if(_['isNil'](_0x15c9fd)){return FnRuleLoop(_0x27524c+0x1);}else{return FnRuleLoop(_0x15c9fd);}});}}};if(_0x27524c<_0x3eceac[_0xd765('0x1c')]&&_0x16fe09===![]){var _0x1935d5=_0x3eceac[_0x27524c][_0xd765('0x1d')];_0x1935d5[_0xd765('0x17')](_0x51cddf,_0x30fa22);}else{process[_0xd765('0x1a')](function(){_0x51cddf[_0xd765('0x1e')]=_0xadf38a;return _0x1ccefa?_0x1ccefa(_0x51cddf):_['noop']();});}}(0x0));};RuleEngine[_0xd765('0x6')][_0xd765('0x1f')]=function(_0x1a901e){if(_[_0xd765('0x2')](_0x1a901e)){return this[_0xd765('0x7')];}else{var _0x4b6d03=_[_0xd765('0x20')](_0x1a901e);return _[_0xd765('0xc')](this[_0xd765('0x7')],_0x4b6d03);}};RuleEngine[_0xd765('0x6')][_0xd765('0x21')]=function(_0x3787d9,_0x1eeb7e){var _0x2408bd=_0x3787d9==='on'||_0x3787d9==='ON'?!![]:![];var _0x505cd1=this[_0xd765('0x1f')](_0x1eeb7e);for(var _0x602a1f=0x0,_0x58b2af=_0x505cd1['length'];_0x602a1f<_0x58b2af;_0x602a1f+=0x1){_0x505cd1[_0x602a1f]['on']=_0x2408bd;}this[_0xd765('0xb')]();};RuleEngine[_0xd765('0x6')][_0xd765('0x22')]=function(_0x329c66,_0x4653a0){_0x329c66=parseInt(_0x329c66,0xa);var _0x58ea11=this[_0xd765('0x1f')](_0x4653a0);for(var _0x149578=0x0,_0x4087d2=_0x58ea11[_0xd765('0x1c')];_0x149578<_0x4087d2;_0x149578+=0x1){_0x58ea11[_0x149578]['priority']=_0x329c66;}this[_0xd765('0xb')]();};RuleEngine[_0xd765('0x6')][_0xd765('0x23')]=function(){var _0x31b438=this[_0xd765('0x7')];if(_0x31b438 instanceof Array){_0x31b438=_0x31b438['map'](function(_0x5259e3){_0x5259e3[_0xd765('0x1d')]=_0x5259e3[_0xd765('0x1d')][_0xd765('0x24')]();_0x5259e3['consequence']=_0x5259e3[_0xd765('0x12')][_0xd765('0x24')]();return _0x5259e3;});}else if(!_[_0xd765('0x2')](_0x31b438)){_0x31b438[_0xd765('0x1d')]=_0x31b438[_0xd765('0x1d')][_0xd765('0x24')]();_0x31b438[_0xd765('0x12')]=_0x31b438[_0xd765('0x12')][_0xd765('0x24')]();}return _0x31b438;};RuleEngine[_0xd765('0x6')][_0xd765('0x25')]=function(_0x3854a5){this[_0xd765('0x1')]();if(_[_0xd765('0x26')](_0x3854a5)){_0x3854a5=JSON['parse'](_0x3854a5);}if(_0x3854a5 instanceof Array){_0x3854a5=_0x3854a5[_0xd765('0x27')](function(_0x3555cf){_0x3555cf[_0xd765('0x1d')]=eval('('+_0x3555cf[_0xd765('0x1d')]+')');_0x3555cf[_0xd765('0x12')]=eval('('+_0x3555cf['consequence']+')');return _0x3555cf;});}else if(_0x3854a5!==null&&typeof _0x3854a5=='object'){_0x3854a5[_0xd765('0x1d')]=eval('('+_0x3854a5['condition']+')');_0x3854a5[_0xd765('0x12')]=eval('('+_0x3854a5[_0xd765('0x12')]+')');}this[_0xd765('0x3')](_0x3854a5);};module[_0xd765('0x28')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index bb8d34d..7acb963 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 _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x399242,_0x2c1cc9){var _0x5b69a5=function(_0x34e3dd){while(--_0x34e3dd){_0x399242['push'](_0x399242['shift']());}};_0x5b69a5(++_0x2c1cc9);}(_0x34e8,0x12c));var _0x834e=function(_0x47a179,_0x39f667){_0x47a179=_0x47a179-0x0;var _0x490859=_0x34e8[_0x47a179];return _0x490859;};'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 _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x2be236,_0x205740){var _0x1f3380=function(_0x4fa181){while(--_0x4fa181){_0x2be236['push'](_0x2be236['shift']());}};_0x1f3380(++_0x205740);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index ceb8f25..132d725 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 _0xc35f=['socket.io-emitter','name','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity','idle','mail','openchannel','fax','sms','whatsapp','length','getChannelStatus','Status','toNumber','format','online','chatStatus','mailCurrentCapacity','whatsappCurrentCapacity','user:save','lodash','moment','md5','ioredis','redis','defaults'];(function(_0x581e01,_0x241cbd){var _0x558b54=function(_0x22a370){while(--_0x22a370){_0x581e01['push'](_0x581e01['shift']());}};_0x558b54(++_0x241cbd);}(_0xc35f,0x1ca));var _0xfc35=function(_0xf3c6b6,_0x15fc11){_0xf3c6b6=_0xf3c6b6-0x0;var _0x3a02a8=_0xc35f[_0xf3c6b6];return _0x3a02a8;};'use strict';var _=require(_0xfc35('0x0'));var moment=require(_0xfc35('0x1'));var md5=require(_0xfc35('0x2'));var Redis=require(_0xfc35('0x3'));var config=require('../../../config/environment');config[_0xfc35('0x4')]=_[_0xfc35('0x5')](config[_0xfc35('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xfc35('0x6'))(new Redis(config['redis']));function Agent(_0x4bd1ea){this['id']=_0x4bd1ea['id']||0x0;this[_0xfc35('0x7')]=_0x4bd1ea[_0xfc35('0x7')]||'';this['online']=_0x4bd1ea['online']||!![];this[_0xfc35('0x8')]=_0x4bd1ea[_0xfc35('0x8')]||![];this[_0xfc35('0x9')]=_0x4bd1ea['chatPause']||![];this[_0xfc35('0xa')]=_0x4bd1ea[_0xfc35('0xa')]||![];this[_0xfc35('0xb')]=_0x4bd1ea['faxPause']||![];this[_0xfc35('0xc')]=_0x4bd1ea[_0xfc35('0xc')]||![];this[_0xfc35('0xd')]=_0x4bd1ea[_0xfc35('0xd')]||![];this['chatStatus']=_0xfc35('0xe');this[_0xfc35('0xf')]=0x0;this['chatCapacity']=_0x4bd1ea[_0xfc35('0x10')]||0x0;this[_0xfc35('0x11')]=0x0;this[_0xfc35('0x12')]='unknown';this[_0xfc35('0x13')]=0x0;this['mailCapacity']=_0x4bd1ea[_0xfc35('0x14')]||0x0;this['mailCurrentCapacity']=0x0;this[_0xfc35('0x15')]=_0xfc35('0xe');this['faxStatusTime']=0x0;this['faxCapacity']=_0x4bd1ea[_0xfc35('0x16')]||0x0;this[_0xfc35('0x17')]=0x0;this[_0xfc35('0x18')]=_0xfc35('0xe');this[_0xfc35('0x19')]=0x0;this[_0xfc35('0x1a')]=_0x4bd1ea['smsCapacity']||0x0;this[_0xfc35('0x1b')]=0x0;this[_0xfc35('0x1c')]='unknown';this[_0xfc35('0x1d')]=0x0;this[_0xfc35('0x1e')]=_0x4bd1ea[_0xfc35('0x1e')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xfc35('0x1f')]=_0xfc35('0xe');this[_0xfc35('0x20')]=0x0;this[_0xfc35('0x21')]=_0x4bd1ea['openchannelCapacity']||0x0;this[_0xfc35('0x22')]=0x0;this[_0xfc35('0x23')]=![];this[_0xfc35('0x24')]=undefined;this['md5']='';this[_0xfc35('0x25')]();}Agent[_0xfc35('0x26')]['getChannelStatus']=function(_0x4f50ec){if(this[_0x4f50ec+_0xfc35('0x27')]>0x0){if(this[_0x4f50ec+_0xfc35('0x28')]>0x0&&this[_0x4f50ec+'CurrentCapacity']>=this[_0x4f50ec+_0xfc35('0x28')]){return _0xfc35('0x29');}else{return'working';}}else{return _0xfc35('0x2a');}};Agent[_0xfc35('0x26')][_0xfc35('0x25')]=function(){var _0x53024c=[_0xfc35('0x2b'),'chat',_0xfc35('0x2c'),_0xfc35('0x2d'),_0xfc35('0x2e'),_0xfc35('0x2f')];for(var _0x306d6f=0x0;_0x306d6f<_0x53024c[_0xfc35('0x30')];_0x306d6f+=0x1){var _0x37cfd1=this[_0xfc35('0x31')](_0x53024c[_0x306d6f]);if(this[_0x53024c[_0x306d6f]+_0xfc35('0x32')]!==_0x37cfd1){this[_0x53024c[_0x306d6f]+'StatusTime']=_[_0xfc35('0x33')](moment()[_0xfc35('0x34')]('x'));}this[_0x53024c[_0x306d6f]+_0xfc35('0x32')]=_0x37cfd1;}var _0x4bedfe={'id':this['id'],'name':this['name'],'online':this[_0xfc35('0x35')],'voicePause':this[_0xfc35('0x8')],'chatPause':this[_0xfc35('0x9')],'mailPause':this[_0xfc35('0xa')],'smsPause':this[_0xfc35('0xc')],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xfc35('0x36')],'chatStatusTime':this[_0xfc35('0xf')],'chatCapacity':this[_0xfc35('0x10')],'chatCurrentCapacity':this[_0xfc35('0x11')],'mailStatus':this[_0xfc35('0x12')],'mailStatusTime':this[_0xfc35('0x13')],'mailCapacity':this[_0xfc35('0x14')],'mailCurrentCapacity':this[_0xfc35('0x37')],'faxStatus':this[_0xfc35('0x15')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xfc35('0x16')],'faxCurrentCapacity':this[_0xfc35('0x17')],'smsStatus':this[_0xfc35('0x18')],'smsStatusTime':this[_0xfc35('0x19')],'smsCapacity':this[_0xfc35('0x1a')],'smsCurrentCapacity':this[_0xfc35('0x1b')],'whatsappStatus':this[_0xfc35('0x1c')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xfc35('0x1e')],'whatsappCurrentCapacity':this[_0xfc35('0x38')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xfc35('0x20')],'openchannelCapacity':this[_0xfc35('0x21')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xfc35('0x23')],'busyQueue':this[_0xfc35('0x24')]};var _0x59f59d=md5(JSON['stringify'](_0x4bedfe));if(this[_0xfc35('0x2')]!==_0x59f59d){this[_0xfc35('0x2')]=_0x59f59d;io['emit'](_0xfc35('0x39'),_0x4bedfe);}};module['exports']=Agent; \ No newline at end of file +var _0xc5c0=['faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','working','prototype','mail','chat','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','faxStatusTime','faxCurrentCapacity','smsStatusTime','whatsappStatusTime','stringify','emit','lodash','moment','md5','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause'];(function(_0x213c03,_0x22ba9d){var _0x478e2d=function(_0x1e505b){while(--_0x1e505b){_0x213c03['push'](_0x213c03['shift']());}};_0x478e2d(++_0x22ba9d);}(_0xc5c0,0x6c));var _0x0c5c=function(_0x3759c5,_0x43771d){_0x3759c5=_0x3759c5-0x0;var _0x15e452=_0xc5c0[_0x3759c5];return _0x15e452;};'use strict';var _=require(_0x0c5c('0x0'));var moment=require(_0x0c5c('0x1'));var md5=require(_0x0c5c('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0c5c('0x3')]=_[_0x0c5c('0x4')](config['redis'],{'host':_0x0c5c('0x5'),'port':0x18eb});var io=require(_0x0c5c('0x6'))(new Redis(config[_0x0c5c('0x3')]));function Agent(_0x26e819){this['id']=_0x26e819['id']||0x0;this[_0x0c5c('0x7')]=_0x26e819[_0x0c5c('0x7')]||'';this[_0x0c5c('0x8')]=_0x26e819['online']||!![];this[_0x0c5c('0x9')]=_0x26e819[_0x0c5c('0x9')]||![];this['chatPause']=_0x26e819[_0x0c5c('0xa')]||![];this[_0x0c5c('0xb')]=_0x26e819[_0x0c5c('0xb')]||![];this[_0x0c5c('0xc')]=_0x26e819['faxPause']||![];this[_0x0c5c('0xd')]=_0x26e819[_0x0c5c('0xd')]||![];this[_0x0c5c('0xe')]=_0x26e819[_0x0c5c('0xe')]||![];this[_0x0c5c('0xf')]='unknown';this[_0x0c5c('0x10')]=0x0;this['chatCapacity']=_0x26e819[_0x0c5c('0x11')]||0x0;this[_0x0c5c('0x12')]=0x0;this[_0x0c5c('0x13')]=_0x0c5c('0x14');this[_0x0c5c('0x15')]=0x0;this[_0x0c5c('0x16')]=_0x26e819[_0x0c5c('0x16')]||0x0;this[_0x0c5c('0x17')]=0x0;this[_0x0c5c('0x18')]=_0x0c5c('0x14');this['faxStatusTime']=0x0;this[_0x0c5c('0x19')]=_0x26e819['faxCapacity']||0x0;this['faxCurrentCapacity']=0x0;this[_0x0c5c('0x1a')]=_0x0c5c('0x14');this['smsStatusTime']=0x0;this[_0x0c5c('0x1b')]=_0x26e819['smsCapacity']||0x0;this[_0x0c5c('0x1c')]=0x0;this[_0x0c5c('0x1d')]=_0x0c5c('0x14');this['whatsappStatusTime']=0x0;this[_0x0c5c('0x1e')]=_0x26e819[_0x0c5c('0x1e')]||0x0;this[_0x0c5c('0x1f')]=0x0;this[_0x0c5c('0x20')]='unknown';this[_0x0c5c('0x21')]=0x0;this[_0x0c5c('0x22')]=_0x26e819[_0x0c5c('0x22')]||0x0;this[_0x0c5c('0x23')]=0x0;this[_0x0c5c('0x24')]=![];this[_0x0c5c('0x25')]=undefined;this[_0x0c5c('0x2')]='';this[_0x0c5c('0x26')]();}Agent['prototype'][_0x0c5c('0x27')]=function(_0x34e983){if(this[_0x34e983+_0x0c5c('0x28')]>0x0){if(this[_0x34e983+_0x0c5c('0x29')]>0x0&&this[_0x34e983+_0x0c5c('0x28')]>=this[_0x34e983+_0x0c5c('0x29')]){return'maxcapacity';}else{return _0x0c5c('0x2a');}}else{return'idle';}};Agent[_0x0c5c('0x2b')][_0x0c5c('0x26')]=function(){var _0x1f8704=[_0x0c5c('0x2c'),_0x0c5c('0x2d'),'openchannel',_0x0c5c('0x2e'),_0x0c5c('0x2f'),_0x0c5c('0x30')];for(var _0x8477c3=0x0;_0x8477c3<_0x1f8704[_0x0c5c('0x31')];_0x8477c3+=0x1){var _0x2fa786=this[_0x0c5c('0x27')](_0x1f8704[_0x8477c3]);if(this[_0x1f8704[_0x8477c3]+_0x0c5c('0x32')]!==_0x2fa786){this[_0x1f8704[_0x8477c3]+_0x0c5c('0x33')]=_[_0x0c5c('0x34')](moment()[_0x0c5c('0x35')]('x'));}this[_0x1f8704[_0x8477c3]+_0x0c5c('0x32')]=_0x2fa786;}var _0x4d9741={'id':this['id'],'name':this['name'],'online':this[_0x0c5c('0x8')],'voicePause':this[_0x0c5c('0x9')],'chatPause':this[_0x0c5c('0xa')],'mailPause':this[_0x0c5c('0xb')],'smsPause':this[_0x0c5c('0xd')],'faxPause':this[_0x0c5c('0xc')],'openchannelPause':this[_0x0c5c('0xe')],'chatStatus':this[_0x0c5c('0xf')],'chatStatusTime':this[_0x0c5c('0x10')],'chatCapacity':this[_0x0c5c('0x11')],'chatCurrentCapacity':this[_0x0c5c('0x12')],'mailStatus':this[_0x0c5c('0x13')],'mailStatusTime':this[_0x0c5c('0x15')],'mailCapacity':this[_0x0c5c('0x16')],'mailCurrentCapacity':this[_0x0c5c('0x17')],'faxStatus':this[_0x0c5c('0x18')],'faxStatusTime':this[_0x0c5c('0x36')],'faxCapacity':this[_0x0c5c('0x19')],'faxCurrentCapacity':this[_0x0c5c('0x37')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x0c5c('0x38')],'smsCapacity':this[_0x0c5c('0x1b')],'smsCurrentCapacity':this[_0x0c5c('0x1c')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x0c5c('0x39')],'whatsappCapacity':this[_0x0c5c('0x1e')],'whatsappCurrentCapacity':this[_0x0c5c('0x1f')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x0c5c('0x21')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x0c5c('0x23')],'busy':this['busy'],'busyQueue':this[_0x0c5c('0x25')]};var _0x18b722=md5(JSON[_0x0c5c('0x3a')](_0x4d9741));if(this[_0x0c5c('0x2')]!==_0x18b722){this['md5']=_0x18b722;io[_0x0c5c('0x3b')]('user:save',_0x4d9741);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 2136951..baf6517 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 _0xfe1a=['chatPause','available','stringify','format','emit','chat_queue:save','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','_rr','map','prototype','loggedIn','paused','length','online'];(function(_0x2dae1c,_0x32c3a7){var _0x31a468=function(_0x779fb){while(--_0x779fb){_0x2dae1c['push'](_0x2dae1c['shift']());}};_0x31a468(++_0x32c3a7);}(_0xfe1a,0x156));var _0xafe1=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xfe1a[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0xafe1('0x0'));var md5=require(_0xafe1('0x1'));var util=require('util');var Redis=require(_0xafe1('0x2'));var config=require(_0xafe1('0x3'));config[_0xafe1('0x4')]=_[_0xafe1('0x5')](config[_0xafe1('0x4')],{'host':_0xafe1('0x6'),'port':0x18eb});var io=require(_0xafe1('0x7'))(new Redis(config['redis']));function ChatQueue(_0x4b5964){this['id']=_0x4b5964['id']||0x0;this[_0xafe1('0x8')]=_0x4b5964[_0xafe1('0x8')]||'';this[_0xafe1('0x9')]=_0x4b5964[_0xafe1('0x9')]||0xa;this[_0xafe1('0xa')]=_0x4b5964[_0xafe1('0xa')]||'beepall';this[_0xafe1('0xb')]=_0x4b5964[_0xafe1('0xb')];this[_0xafe1('0xc')]={};this[_0xafe1('0xd')]=0x0;this['md5']='';this[_0xafe1('0xe')]();this['updateRealtime']();}ChatQueue['prototype']['updateRouting']=function(){var _0x185871=this[_0xafe1('0xc')][_0xafe1('0xf')];this[_0xafe1('0xc')]=_[_0xafe1('0x10')](this[_0xafe1('0xb')],'id');this['mapAgentsId'][_0xafe1('0xf')]=_0x185871;};ChatQueue[_0xafe1('0x11')]['updateRealtime']=function(){this[_0xafe1('0x12')]=0x0;this[_0xafe1('0x13')]=0x0;for(var _0x298f01=0x0;_0x298f01=0x0?this[_0xafe1('0x17')]:0x0;var _0x4e5e71={'id':this['id'],'available':this[_0xafe1('0x17')],'loggedIn':this['loggedIn'],'name':this[_0xafe1('0x8')],'paused':this['paused'],'waiting':this['waiting']};var _0x241036=md5(JSON[_0xafe1('0x18')](_0x4e5e71));if(this[_0xafe1('0x1')]!==_0x241036){this['md5']=_0x241036;io['to'](util[_0xafe1('0x19')]('chat:queue:%s',_0x4e5e71[_0xafe1('0x8')]))[_0xafe1('0x1a')](_0xafe1('0x1b'),_0x4e5e71);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x7add=['name','timeout','strategy','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','updateRealtime','loggedIn','paused','length','online','chatPause','available','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x5b15fe,_0x5578f9){var _0x2f70d5=function(_0xe232dc){while(--_0xe232dc){_0x5b15fe['push'](_0x5b15fe['shift']());}};_0x2f70d5(++_0x5578f9);}(_0x7add,0x6f));var _0xd7ad=function(_0x4d810a,_0x67955a){_0x4d810a=_0x4d810a-0x0;var _0x327101=_0x7add[_0x4d810a];return _0x327101;};'use strict';var _=require(_0xd7ad('0x0'));var md5=require(_0xd7ad('0x1'));var util=require(_0xd7ad('0x2'));var Redis=require(_0xd7ad('0x3'));var config=require(_0xd7ad('0x4'));config[_0xd7ad('0x5')]=_[_0xd7ad('0x6')](config[_0xd7ad('0x5')],{'host':_0xd7ad('0x7'),'port':0x18eb});var io=require(_0xd7ad('0x8'))(new Redis(config[_0xd7ad('0x5')]));function ChatQueue(_0x161f82){this['id']=_0x161f82['id']||0x0;this[_0xd7ad('0x9')]=_0x161f82[_0xd7ad('0x9')]||'';this['timeout']=_0x161f82[_0xd7ad('0xa')]||0xa;this['strategy']=_0x161f82[_0xd7ad('0xb')]||'beepall';this[_0xd7ad('0xc')]=_0x161f82[_0xd7ad('0xc')];this[_0xd7ad('0xd')]={};this[_0xd7ad('0xe')]=0x0;this[_0xd7ad('0x1')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0xd7ad('0xf')][_0xd7ad('0x10')]=function(){var _0x886fcc=this[_0xd7ad('0xd')]['_rr'];this[_0xd7ad('0xd')]=_['map'](this[_0xd7ad('0xc')],'id');this[_0xd7ad('0xd')][_0xd7ad('0x11')]=_0x886fcc;};ChatQueue[_0xd7ad('0xf')][_0xd7ad('0x12')]=function(){this[_0xd7ad('0x13')]=0x0;this[_0xd7ad('0x14')]=0x0;for(var _0x2766f9=0x0;_0x2766f9=0x0?this[_0xd7ad('0x18')]:0x0;var _0x1f16df={'id':this['id'],'available':this['available'],'loggedIn':this[_0xd7ad('0x13')],'name':this['name'],'paused':this[_0xd7ad('0x14')],'waiting':this[_0xd7ad('0xe')]};var _0x58b5b7=md5(JSON['stringify'](_0x1f16df));if(this['md5']!==_0x58b5b7){this[_0xd7ad('0x1')]=_0x58b5b7;io['to'](util[_0xd7ad('0x19')](_0xd7ad('0x1a'),_0x1f16df[_0xd7ad('0x9')]))[_0xd7ad('0x1b')](_0xd7ad('0x1c'),_0x1f16df);}};module[_0xd7ad('0x1d')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 3b60a5d..695c4a1 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(_0x1f6745,_0x302406){var _0x3a03ba=function(_0x551330){while(--_0x551330){_0x1f6745['push'](_0x1f6745['shift']());}};_0x3a03ba(++_0x302406);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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(_0x1f2b54,_0x273caa){var _0x56c112=function(_0x4815aa){while(--_0x4815aa){_0x1f2b54['push'](_0x1f2b54['shift']());}};_0x56c112(++_0x273caa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 56fcdff..21420b1 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 _0xd89b=['name','exports'];(function(_0x31f095,_0x4ef11d){var _0xc7f71c=function(_0x58a5b1){while(--_0x58a5b1){_0x31f095['push'](_0x31f095['shift']());}};_0xc7f71c(++_0x4ef11d);}(_0xd89b,0x18c));var _0xbd89=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xd89b[_0x288f5e];return _0x476cc9;};'use strict';function Interval(_0x56a0f8){this['id']=_0x56a0f8['id']||0x0;this[_0xbd89('0x0')]=_0x56a0f8['name']||'';this['Intervals']=_0x56a0f8['Intervals']||{};}module[_0xbd89('0x1')]=Interval; \ No newline at end of file +var _0xd247=['Intervals','exports','name'];(function(_0x2c96f6,_0x877207){var _0x6d4808=function(_0x567e0c){while(--_0x567e0c){_0x2c96f6['push'](_0x2c96f6['shift']());}};_0x6d4808(++_0x877207);}(_0xd247,0x188));var _0x7d24=function(_0x8d5844,_0x48eb67){_0x8d5844=_0x8d5844-0x0;var _0x56726c=_0xd247[_0x8d5844];return _0x56726c;};'use strict';function Interval(_0x381bb1){this['id']=_0x381bb1['id']||0x0;this['name']=_0x381bb1[_0x7d24('0x0')]||'';this[_0x7d24('0x1')]=_0x381bb1[_0x7d24('0x1')]||{};}module[_0x7d24('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 434ef8f..33a961a 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 _0x4004=['beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','mailPause','available','format','exports','lodash','md5','util','ioredis','../../../config/environment','redis','name','timeout','strategy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4004,0x9f));var _0x4400=function(_0x172133,_0x10246b){_0x172133=_0x172133-0x0;var _0x2460e5=_0x4004[_0x172133];return _0x2460e5;};'use strict';var _=require(_0x4400('0x0'));var md5=require(_0x4400('0x1'));var util=require(_0x4400('0x2'));var Redis=require(_0x4400('0x3'));var config=require(_0x4400('0x4'));config[_0x4400('0x5')]=_['defaults'](config[_0x4400('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4400('0x5')]));function MailQueue(_0x1b9ada){this['id']=_0x1b9ada['id']||0x0;this[_0x4400('0x6')]=_0x1b9ada[_0x4400('0x6')]||'';this[_0x4400('0x7')]=_0x1b9ada[_0x4400('0x7')]||0xa;this[_0x4400('0x8')]=_0x1b9ada['strategy']||_0x4400('0x9');this[_0x4400('0xa')]=_0x1b9ada[_0x4400('0xa')];this[_0x4400('0xb')]={};this[_0x4400('0xc')]=0x0;this[_0x4400('0x1')]='';this[_0x4400('0xd')]();this[_0x4400('0xe')]();}MailQueue[_0x4400('0xf')][_0x4400('0xd')]=function(){var _0xfa66e8=this[_0x4400('0xb')]['_rr'];this[_0x4400('0xb')]=_[_0x4400('0x10')](this[_0x4400('0xa')],'id');this[_0x4400('0xb')][_0x4400('0x11')]=_0xfa66e8;};MailQueue['prototype'][_0x4400('0xe')]=function(){this[_0x4400('0x12')]=0x0;this[_0x4400('0x13')]=0x0;for(var _0x4a3886=0x0;_0x4a3886=0x0?this['available']:0x0;var _0x290de1={'id':this['id'],'available':this[_0x4400('0x15')],'loggedIn':this[_0x4400('0x12')],'name':this[_0x4400('0x6')],'paused':this['paused'],'waiting':this[_0x4400('0xc')]};var _0x4e6841=md5(JSON['stringify'](_0x290de1));if(this[_0x4400('0x1')]!==_0x4e6841){this[_0x4400('0x1')]=_0x4e6841;io['to'](util[_0x4400('0x16')]('mail:queue:%s',_0x290de1[_0x4400('0x6')]))['emit']('mail_queue:save',_0x290de1);}};module[_0x4400('0x17')]=MailQueue; \ No newline at end of file +var _0x32bb=['md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','prototype','paused','online','loggedIn','mailPause','available','waiting','stringify','format','emit','mail_queue:save'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x32bb,0x87));var _0xb32b=function(_0x3f7598,_0x212e37){_0x3f7598=_0x3f7598-0x0;var _0x51fb16=_0x32bb[_0x3f7598];return _0x51fb16;};'use strict';var _=require('lodash');var md5=require(_0xb32b('0x0'));var util=require(_0xb32b('0x1'));var Redis=require(_0xb32b('0x2'));var config=require(_0xb32b('0x3'));config[_0xb32b('0x4')]=_[_0xb32b('0x5')](config[_0xb32b('0x4')],{'host':_0xb32b('0x6'),'port':0x18eb});var io=require(_0xb32b('0x7'))(new Redis(config[_0xb32b('0x4')]));function MailQueue(_0x5bedba){this['id']=_0x5bedba['id']||0x0;this[_0xb32b('0x8')]=_0x5bedba[_0xb32b('0x8')]||'';this[_0xb32b('0x9')]=_0x5bedba[_0xb32b('0x9')]||0xa;this[_0xb32b('0xa')]=_0x5bedba['strategy']||'beepall';this[_0xb32b('0xb')]=_0x5bedba['Agents'];this[_0xb32b('0xc')]={};this['waiting']=0x0;this[_0xb32b('0x0')]='';this[_0xb32b('0xd')]();this[_0xb32b('0xe')]();}MailQueue['prototype'][_0xb32b('0xd')]=function(){var _0xa14118=this['mapAgentsId'][_0xb32b('0xf')];this[_0xb32b('0xc')]=_['map'](this[_0xb32b('0xb')],'id');this['mapAgentsId']['_rr']=_0xa14118;};MailQueue[_0xb32b('0x10')][_0xb32b('0xe')]=function(){this['loggedIn']=0x0;this[_0xb32b('0x11')]=0x0;for(var _0x1d54f1=0x0;_0x1d54f1=0x0?this[_0xb32b('0x15')]:0x0;var _0xfdcc87={'id':this['id'],'available':this[_0xb32b('0x15')],'loggedIn':this['loggedIn'],'name':this[_0xb32b('0x8')],'paused':this['paused'],'waiting':this[_0xb32b('0x16')]};var _0x1d77e1=md5(JSON[_0xb32b('0x17')](_0xfdcc87));if(this[_0xb32b('0x0')]!==_0x1d77e1){this[_0xb32b('0x0')]=_0x1d77e1;io['to'](util[_0xb32b('0x18')]('mail:queue:%s',_0xfdcc87[_0xb32b('0x8')]))[_0xb32b('0x19')](_0xb32b('0x1a'),_0xfdcc87);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 13fb456..d31a972 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 _0x09ef=['stringify','openchannel:queue:%s','emit','openchannel_queue:save','lodash','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','mapAgentsId','_rr','updateRealtime','loggedIn','openchannelPause','paused','available'];(function(_0x34ea22,_0x1270b3){var _0x1ca470=function(_0xf63cf4){while(--_0xf63cf4){_0x34ea22['push'](_0x34ea22['shift']());}};_0x1ca470(++_0x1270b3);}(_0x09ef,0x1be));var _0xf09e=function(_0x3b462e,_0x5e482e){_0x3b462e=_0x3b462e-0x0;var _0x2ebe54=_0x09ef[_0x3b462e];return _0x2ebe54;};'use strict';var _=require(_0xf09e('0x0'));var md5=require('md5');var util=require(_0xf09e('0x1'));var Redis=require(_0xf09e('0x2'));var config=require(_0xf09e('0x3'));config['redis']=_['defaults'](config[_0xf09e('0x4')],{'host':_0xf09e('0x5'),'port':0x18eb});var io=require(_0xf09e('0x6'))(new Redis(config[_0xf09e('0x4')]));function OpenchannelQueue(_0x4da558){this['id']=_0x4da558['id']||0x0;this[_0xf09e('0x7')]=_0x4da558[_0xf09e('0x7')]||'';this[_0xf09e('0x8')]=_0x4da558[_0xf09e('0x8')]||0xa;this[_0xf09e('0x9')]=_0x4da558[_0xf09e('0x9')]||_0xf09e('0xa');this[_0xf09e('0xb')]=_0x4da558[_0xf09e('0xb')];this['mapAgentsId']={};this[_0xf09e('0xc')]=0x0;this[_0xf09e('0xd')]='';this[_0xf09e('0xe')]();this['updateRealtime']();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x959c28=this[_0xf09e('0xf')][_0xf09e('0x10')];this['mapAgentsId']=_['map'](this[_0xf09e('0xb')],'id');this['mapAgentsId'][_0xf09e('0x10')]=_0x959c28;};OpenchannelQueue['prototype'][_0xf09e('0x11')]=function(){this[_0xf09e('0x12')]=0x0;this['paused']=0x0;for(var _0x11e083=0x0;_0x11e083=0x0?this['available']:0x0;var _0x2385ef={'id':this['id'],'available':this[_0xf09e('0x15')],'loggedIn':this[_0xf09e('0x12')],'name':this['name'],'paused':this[_0xf09e('0x14')],'waiting':this[_0xf09e('0xc')]};var _0x5f4903=md5(JSON[_0xf09e('0x16')](_0x2385ef));if(this['md5']!==_0x5f4903){this[_0xf09e('0xd')]=_0x5f4903;io['to'](util['format'](_0xf09e('0x17'),_0x2385ef[_0xf09e('0x7')]))[_0xf09e('0x18')](_0xf09e('0x19'),_0x2385ef);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0xd276=['waiting','updateRouting','prototype','_rr','mapAgentsId','updateRealtime','paused','length','online','openchannelPause','available','loggedIn','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','strategy','beepall','Agents'];(function(_0x3f1f25,_0x2da388){var _0x21ffe2=function(_0x531642){while(--_0x531642){_0x3f1f25['push'](_0x3f1f25['shift']());}};_0x21ffe2(++_0x2da388);}(_0xd276,0x17a));var _0x6d27=function(_0x286726,_0x20a337){_0x286726=_0x286726-0x0;var _0xcd4fe9=_0xd276[_0x286726];return _0xcd4fe9;};'use strict';var _=require(_0x6d27('0x0'));var md5=require(_0x6d27('0x1'));var util=require('util');var Redis=require(_0x6d27('0x2'));var config=require(_0x6d27('0x3'));config[_0x6d27('0x4')]=_[_0x6d27('0x5')](config[_0x6d27('0x4')],{'host':_0x6d27('0x6'),'port':0x18eb});var io=require(_0x6d27('0x7'))(new Redis(config[_0x6d27('0x4')]));function OpenchannelQueue(_0x2c0398){this['id']=_0x2c0398['id']||0x0;this[_0x6d27('0x8')]=_0x2c0398[_0x6d27('0x8')]||'';this['timeout']=_0x2c0398['timeout']||0xa;this[_0x6d27('0x9')]=_0x2c0398[_0x6d27('0x9')]||_0x6d27('0xa');this[_0x6d27('0xb')]=_0x2c0398['Agents'];this['mapAgentsId']={};this[_0x6d27('0xc')]=0x0;this[_0x6d27('0x1')]='';this[_0x6d27('0xd')]();this['updateRealtime']();}OpenchannelQueue[_0x6d27('0xe')][_0x6d27('0xd')]=function(){var _0x2dd7ea=this['mapAgentsId'][_0x6d27('0xf')];this[_0x6d27('0x10')]=_['map'](this[_0x6d27('0xb')],'id');this[_0x6d27('0x10')]['_rr']=_0x2dd7ea;};OpenchannelQueue[_0x6d27('0xe')][_0x6d27('0x11')]=function(){this['loggedIn']=0x0;this[_0x6d27('0x12')]=0x0;for(var _0x537441=0x0;_0x537441=0x0?this['available']:0x0;var _0x47afee={'id':this['id'],'available':this[_0x6d27('0x16')],'loggedIn':this[_0x6d27('0x17')],'name':this[_0x6d27('0x8')],'paused':this['paused'],'waiting':this[_0x6d27('0xc')]};var _0x27c432=md5(JSON[_0x6d27('0x18')](_0x47afee));if(this[_0x6d27('0x1')]!==_0x27c432){this[_0x6d27('0x1')]=_0x27c432;io['to'](util[_0x6d27('0x19')](_0x6d27('0x1a'),_0x47afee['name']))[_0x6d27('0x1b')](_0x6d27('0x1c'),_0x47afee);}};module[_0x6d27('0x1d')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index d96aeef..41ddc76 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 _0xe706=['prototype','_rr','map','online','loggedIn','smsPause','available','paused','stringify','format','sms:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x41b654,_0x39239c){var _0x55c219=function(_0x1f55c0){while(--_0x1f55c0){_0x41b654['push'](_0x41b654['shift']());}};_0x55c219(++_0x39239c);}(_0xe706,0xa3));var _0x6e70=function(_0x2633c7,_0x4db8b3){_0x2633c7=_0x2633c7-0x0;var _0xbb644=_0xe706[_0x2633c7];return _0xbb644;};'use strict';var _=require(_0x6e70('0x0'));var md5=require(_0x6e70('0x1'));var util=require(_0x6e70('0x2'));var Redis=require('ioredis');var config=require(_0x6e70('0x3'));config[_0x6e70('0x4')]=_[_0x6e70('0x5')](config[_0x6e70('0x4')],{'host':_0x6e70('0x6'),'port':0x18eb});var io=require(_0x6e70('0x7'))(new Redis(config[_0x6e70('0x4')]));function SmsQueue(_0x506db9){this['id']=_0x506db9['id']||0x0;this[_0x6e70('0x8')]=_0x506db9[_0x6e70('0x8')]||'';this[_0x6e70('0x9')]=_0x506db9[_0x6e70('0x9')]||0xa;this[_0x6e70('0xa')]=_0x506db9[_0x6e70('0xa')]||_0x6e70('0xb');this[_0x6e70('0xc')]=_0x506db9[_0x6e70('0xc')];this[_0x6e70('0xd')]={};this[_0x6e70('0xe')]=0x0;this[_0x6e70('0x1')]='';this[_0x6e70('0xf')]();this[_0x6e70('0x10')]();}SmsQueue[_0x6e70('0x11')][_0x6e70('0xf')]=function(){var _0x5b3d07=this['mapAgentsId'][_0x6e70('0x12')];this[_0x6e70('0xd')]=_[_0x6e70('0x13')](this[_0x6e70('0xc')],'id');this[_0x6e70('0xd')][_0x6e70('0x12')]=_0x5b3d07;};SmsQueue[_0x6e70('0x11')][_0x6e70('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x48bc72=0x0;_0x48bc72=0x0?this['available']:0x0;var _0x28a21f={'id':this['id'],'available':this[_0x6e70('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x6e70('0x18')],'waiting':this[_0x6e70('0xe')]};var _0x2368eb=md5(JSON[_0x6e70('0x19')](_0x28a21f));if(this[_0x6e70('0x1')]!==_0x2368eb){this[_0x6e70('0x1')]=_0x2368eb;io['to'](util[_0x6e70('0x1a')](_0x6e70('0x1b'),_0x28a21f[_0x6e70('0x8')]))[_0x6e70('0x1c')]('sms_queue:save',_0x28a21f);}};module[_0x6e70('0x1d')]=SmsQueue; \ No newline at end of file +var _0xb10b=['length','online','loggedIn','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','prototype','updateRouting','_rr','map','updateRealtime','paused'];(function(_0x43a6cd,_0x503d1a){var _0x5acb36=function(_0x2dd95e){while(--_0x2dd95e){_0x43a6cd['push'](_0x43a6cd['shift']());}};_0x5acb36(++_0x503d1a);}(_0xb10b,0x12a));var _0xbb10=function(_0x143ca0,_0x586bd3){_0x143ca0=_0x143ca0-0x0;var _0x11f1c5=_0xb10b[_0x143ca0];return _0x11f1c5;};'use strict';var _=require(_0xbb10('0x0'));var md5=require('md5');var util=require(_0xbb10('0x1'));var Redis=require(_0xbb10('0x2'));var config=require(_0xbb10('0x3'));config['redis']=_[_0xbb10('0x4')](config[_0xbb10('0x5')],{'host':_0xbb10('0x6'),'port':0x18eb});var io=require(_0xbb10('0x7'))(new Redis(config[_0xbb10('0x5')]));function SmsQueue(_0x312b72){this['id']=_0x312b72['id']||0x0;this['name']=_0x312b72[_0xbb10('0x8')]||'';this[_0xbb10('0x9')]=_0x312b72['timeout']||0xa;this[_0xbb10('0xa')]=_0x312b72[_0xbb10('0xa')]||_0xbb10('0xb');this[_0xbb10('0xc')]=_0x312b72[_0xbb10('0xc')];this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]=0x0;this[_0xbb10('0xf')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0xbb10('0x10')][_0xbb10('0x11')]=function(){var _0xce64f3=this['mapAgentsId'][_0xbb10('0x12')];this['mapAgentsId']=_[_0xbb10('0x13')](this[_0xbb10('0xc')],'id');this[_0xbb10('0xd')][_0xbb10('0x12')]=_0xce64f3;};SmsQueue[_0xbb10('0x10')][_0xbb10('0x14')]=function(){this['loggedIn']=0x0;this[_0xbb10('0x15')]=0x0;for(var _0x42d7e4=0x0;_0x42d7e4=0x0?this[_0xbb10('0x1a')]:0x0;var _0x1682a4={'id':this['id'],'available':this[_0xbb10('0x1a')],'loggedIn':this[_0xbb10('0x18')],'name':this[_0xbb10('0x8')],'paused':this[_0xbb10('0x15')],'waiting':this['waiting']};var _0x5ff0cf=md5(JSON[_0xbb10('0x1b')](_0x1682a4));if(this[_0xbb10('0xf')]!==_0x5ff0cf){this[_0xbb10('0xf')]=_0x5ff0cf;io['to'](util[_0xbb10('0x1c')](_0xbb10('0x1d'),_0x1682a4['name']))[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x1682a4);}};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 cd73f0c..489e0bf 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 _0x2ae3=['length','online','loggedIn','paused','available','stringify','format','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','updateRouting','_rr','Agents','prototype','updateRealtime'];(function(_0x5ba114,_0x5bf5ad){var _0x655476=function(_0x3a2305){while(--_0x3a2305){_0x5ba114['push'](_0x5ba114['shift']());}};_0x655476(++_0x5bf5ad);}(_0x2ae3,0xe9));var _0x32ae=function(_0x2ed22a,_0xec1e33){_0x2ed22a=_0x2ed22a-0x0;var _0x832116=_0x2ae3[_0x2ed22a];return _0x832116;};'use strict';var _=require(_0x32ae('0x0'));var md5=require(_0x32ae('0x1'));var util=require(_0x32ae('0x2'));var Redis=require(_0x32ae('0x3'));var config=require(_0x32ae('0x4'));config[_0x32ae('0x5')]=_[_0x32ae('0x6')](config[_0x32ae('0x5')],{'host':_0x32ae('0x7'),'port':0x18eb});var io=require(_0x32ae('0x8'))(new Redis(config['redis']));function WhatsappQueue(_0x165ad5){this['id']=_0x165ad5['id']||0x0;this[_0x32ae('0x9')]=_0x165ad5[_0x32ae('0x9')]||'';this[_0x32ae('0xa')]=_0x165ad5[_0x32ae('0xa')]||0xa;this['strategy']=_0x165ad5[_0x32ae('0xb')]||'beepall';this['Agents']=_0x165ad5['Agents'];this[_0x32ae('0xc')]={};this[_0x32ae('0xd')]=0x0;this['md5']='';this[_0x32ae('0xe')]();this['updateRealtime']();}WhatsappQueue['prototype'][_0x32ae('0xe')]=function(){var _0x319a45=this[_0x32ae('0xc')][_0x32ae('0xf')];this[_0x32ae('0xc')]=_['map'](this[_0x32ae('0x10')],'id');this['mapAgentsId']['_rr']=_0x319a45;};WhatsappQueue[_0x32ae('0x11')][_0x32ae('0x12')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x4f6b36=0x0;_0x4f6b36=0x0?this[_0x32ae('0x17')]:0x0;var _0xca8462={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x32ae('0x9')],'paused':this[_0x32ae('0x16')],'waiting':this[_0x32ae('0xd')]};var _0x15f0bb=md5(JSON[_0x32ae('0x18')](_0xca8462));if(this['md5']!==_0x15f0bb){this[_0x32ae('0x1')]=_0x15f0bb;io['to'](util[_0x32ae('0x19')]('whatsapp:queue:%s',_0xca8462['name']))['emit'](_0x32ae('0x1a'),_0xca8462);}};module[_0x32ae('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0x90c0=['redis','defaults','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','whatsappPause','available','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','util','ioredis','../../../config/environment'];(function(_0x53b93b,_0x1bfab1){var _0x485761=function(_0x41592e){while(--_0x41592e){_0x53b93b['push'](_0x53b93b['shift']());}};_0x485761(++_0x1bfab1);}(_0x90c0,0xec));var _0x090c=function(_0x32cf96,_0x7502d5){_0x32cf96=_0x32cf96-0x0;var _0x125cc1=_0x90c0[_0x32cf96];return _0x125cc1;};'use strict';var _=require(_0x090c('0x0'));var md5=require('md5');var util=require(_0x090c('0x1'));var Redis=require(_0x090c('0x2'));var config=require(_0x090c('0x3'));config[_0x090c('0x4')]=_[_0x090c('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x090c('0x4')]));function WhatsappQueue(_0x3f1980){this['id']=_0x3f1980['id']||0x0;this['name']=_0x3f1980[_0x090c('0x6')]||'';this[_0x090c('0x7')]=_0x3f1980['timeout']||0xa;this[_0x090c('0x8')]=_0x3f1980[_0x090c('0x8')]||_0x090c('0x9');this[_0x090c('0xa')]=_0x3f1980[_0x090c('0xa')];this[_0x090c('0xb')]={};this[_0x090c('0xc')]=0x0;this[_0x090c('0xd')]='';this[_0x090c('0xe')]();this[_0x090c('0xf')]();}WhatsappQueue[_0x090c('0x10')][_0x090c('0xe')]=function(){var _0x39dc2c=this[_0x090c('0xb')][_0x090c('0x11')];this[_0x090c('0xb')]=_[_0x090c('0x12')](this['Agents'],'id');this[_0x090c('0xb')][_0x090c('0x11')]=_0x39dc2c;};WhatsappQueue['prototype'][_0x090c('0xf')]=function(){this[_0x090c('0x13')]=0x0;this[_0x090c('0x14')]=0x0;for(var _0x7f4133=0x0;_0x7f4133=0x0?this[_0x090c('0x18')]:0x0;var _0xd685ad={'id':this['id'],'available':this[_0x090c('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x090c('0x6')],'paused':this[_0x090c('0x14')],'waiting':this['waiting']};var _0x42804c=md5(JSON[_0x090c('0x19')](_0xd685ad));if(this[_0x090c('0xd')]!==_0x42804c){this[_0x090c('0xd')]=_0x42804c;io['to'](util['format'](_0x090c('0x1a'),_0xd685ad[_0x090c('0x6')]))[_0x090c('0x1b')](_0x090c('0x1c'),_0xd685ad);}};module[_0x090c('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 3e7d996..39e140b 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['openchannelQueues','chatQueues','smsQueues','mailQueues','faxQueues','whatsappQueues','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','length','isUndefined','agents','intervals','updateRealtime','initSmsQueues','updateRouting','initMailQueues','initWhatsappQueues','exports','bluebird','util','lodash','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/mailQueue','../model/faxQueue'];(function(_0xfd437d,_0x27e6e3){var _0x1ac3e1=function(_0x4596f5){while(--_0x4596f5){_0xfd437d['push'](_0xfd437d['shift']());}};_0x1ac3e1(++_0x27e6e3);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x00bb[_0x4e9628];return _0x27bc8c;};'use strict';var BPromise=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var _=require(_0xb00b('0x2'));var moment=require('moment');var Agent=require(_0xb00b('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xb00b('0x4'));var ChatQueue=require(_0xb00b('0x5'));var SmsQueue=require('../model/smsQueue');var MailQueue=require(_0xb00b('0x6'));var FaxQueue=require(_0xb00b('0x7'));var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this['agents']={};this['intervals']={};this[_0xb00b('0x8')]={};this[_0xb00b('0x9')]={};this[_0xb00b('0xa')]={};this[_0xb00b('0xb')]={};this[_0xb00b('0xc')]={};this[_0xb00b('0xd')]={};this['chatQueuesWaitingInteractions']={};this['mailQueuesWaitingInteractions']={};this[_0xb00b('0xe')]={};this[_0xb00b('0xf')]={};this[_0xb00b('0x10')]={};this[_0xb00b('0x11')]={};};function freeIsNotKey(_0x28d3cc,_0x48e125,_0x3182db){var _0x5a63ed=_['mapKeys'](_0x28d3cc,function(_0x594075,_0x4ff792){return _0x594075[_0x3182db];});for(var _0x2d8ddf in _0x48e125){if(_0x48e125[_0xb00b('0x12')](_0x2d8ddf)){if(!_0x5a63ed[_0x2d8ddf]){delete _0x48e125[_0x2d8ddf];}}}}Realtime[_0xb00b('0x13')][_0xb00b('0x14')]=function(_0x1f1c1d,_0x4ada81){for(var _0x218de2 in _0x4ada81){if(_0x1f1c1d[_0xb00b('0x12')](_0x218de2)){_0x1f1c1d[_0x218de2]=_0x4ada81[_0x218de2];}}};Realtime['prototype'][_0xb00b('0x15')]=function(){var _0x1084a6=this;return function(_0x540b79){if(_0x540b79){freeIsNotKey(_0x540b79,_0x1084a6['agents'],'id');for(var _0x9b471e=0x0,_0x4dcd45={},_0x51d136={};_0x9b471e<_0x540b79[_0xb00b('0x16')];_0x9b471e+=0x1){_0x4dcd45=_0x540b79[_0x9b471e];if(_[_0xb00b('0x17')](_0x1084a6[_0xb00b('0x18')][_0x4dcd45['id']])){_0x1084a6[_0xb00b('0x18')][_0x4dcd45['id']]=new Agent(_0x4dcd45);}else{_0x1084a6['mergeFromDatabase'](_0x1084a6[_0xb00b('0x18')][_0x4dcd45['id']],_0x4dcd45);}}}return _0x1084a6['agents'];};};Realtime[_0xb00b('0x13')]['initIntervals']=function(){var _0x25d7a0=this;return function(_0x5e8d7b){if(_0x5e8d7b){freeIsNotKey(_0x5e8d7b,_0x25d7a0[_0xb00b('0x19')],'id');for(var _0x3355a3=0x0,_0x53ee68={},_0x55770c={};_0x3355a3<_0x5e8d7b[_0xb00b('0x16')];_0x3355a3+=0x1){_0x53ee68=_0x5e8d7b[_0x3355a3];if(_['isUndefined'](_0x25d7a0[_0xb00b('0x19')][_0x53ee68['id']])){_0x25d7a0[_0xb00b('0x19')][_0x53ee68['id']]=new Interval(_0x53ee68);}else{_0x25d7a0[_0xb00b('0x14')](_0x25d7a0[_0xb00b('0x19')][_0x53ee68['id']],_0x53ee68);}}}return _0x25d7a0['intervals'];};};Realtime[_0xb00b('0x13')]['initOpenchannelQueues']=function(){var _0x25a973=this;return function(_0x121ec7){if(_0x121ec7){freeIsNotKey(_0x121ec7,_0x25a973['openchannelQueues'],'id');for(var _0x231293=0x0,_0x2896d1={},_0x520444={};_0x231293<_0x121ec7[_0xb00b('0x16')];_0x231293+=0x1){_0x2896d1=_0x121ec7[_0x231293];if(_[_0xb00b('0x17')](_0x25a973['openchannelQueues'][_0x2896d1['id']])){_0x25a973[_0xb00b('0x8')][_0x2896d1['id']]=new OpenchannelQueue(_0x2896d1);}else{_0x25a973[_0xb00b('0x14')](_0x25a973[_0xb00b('0x8')][_0x2896d1['id']],_0x2896d1);}_0x25a973[_0xb00b('0x8')][_0x2896d1['id']]['updateRouting']();_0x25a973['openchannelQueues'][_0x2896d1['id']][_0xb00b('0x1a')]();}}return _0x25a973['openchannelQueues'];};};Realtime['prototype']['initChatQueues']=function(){var _0x16ac55=this;return function(_0x73b6b0){if(_0x73b6b0){freeIsNotKey(_0x73b6b0,_0x16ac55[_0xb00b('0x9')],'id');for(var _0x3825af=0x0,_0x1f14fa={},_0x197379={};_0x3825af<_0x73b6b0[_0xb00b('0x16')];_0x3825af+=0x1){_0x1f14fa=_0x73b6b0[_0x3825af];if(_['isUndefined'](_0x16ac55[_0xb00b('0x9')][_0x1f14fa['id']])){_0x16ac55['chatQueues'][_0x1f14fa['id']]=new ChatQueue(_0x1f14fa);}else{_0x16ac55[_0xb00b('0x14')](_0x16ac55[_0xb00b('0x9')][_0x1f14fa['id']],_0x1f14fa);}_0x16ac55[_0xb00b('0x9')][_0x1f14fa['id']]['updateRouting']();_0x16ac55[_0xb00b('0x9')][_0x1f14fa['id']][_0xb00b('0x1a')]();}}return _0x16ac55[_0xb00b('0x9')];};};Realtime[_0xb00b('0x13')][_0xb00b('0x1b')]=function(){var _0x2b9824=this;return function(_0x2e160a){if(_0x2e160a){freeIsNotKey(_0x2e160a,_0x2b9824[_0xb00b('0xa')],'id');for(var _0x149c1a=0x0,_0x54e247={},_0x2b5f41={};_0x149c1a<_0x2e160a[_0xb00b('0x16')];_0x149c1a+=0x1){_0x54e247=_0x2e160a[_0x149c1a];if(_['isUndefined'](_0x2b9824[_0xb00b('0xa')][_0x54e247['id']])){_0x2b9824[_0xb00b('0xa')][_0x54e247['id']]=new SmsQueue(_0x54e247);}else{_0x2b9824['mergeFromDatabase'](_0x2b9824[_0xb00b('0xa')][_0x54e247['id']],_0x54e247);}_0x2b9824['smsQueues'][_0x54e247['id']][_0xb00b('0x1c')]();_0x2b9824[_0xb00b('0xa')][_0x54e247['id']][_0xb00b('0x1a')]();}}return _0x2b9824[_0xb00b('0xa')];};};Realtime[_0xb00b('0x13')][_0xb00b('0x1d')]=function(){var _0x17f613=this;return function(_0x594840){if(_0x594840){freeIsNotKey(_0x594840,_0x17f613['mailQueues'],'id');for(var _0x5b04c2=0x0,_0x347e73={},_0xc21102={};_0x5b04c2<_0x594840[_0xb00b('0x16')];_0x5b04c2+=0x1){_0x347e73=_0x594840[_0x5b04c2];if(_[_0xb00b('0x17')](_0x17f613['mailQueues'][_0x347e73['id']])){_0x17f613[_0xb00b('0xb')][_0x347e73['id']]=new MailQueue(_0x347e73);}else{_0x17f613[_0xb00b('0x14')](_0x17f613[_0xb00b('0xb')][_0x347e73['id']],_0x347e73);}_0x17f613[_0xb00b('0xb')][_0x347e73['id']][_0xb00b('0x1c')]();_0x17f613[_0xb00b('0xb')][_0x347e73['id']][_0xb00b('0x1a')]();}}return _0x17f613[_0xb00b('0xb')];};};Realtime['prototype']['initFaxQueues']=function(){var _0x2ea41d=this;return function(_0x56022e){if(_0x56022e){freeIsNotKey(_0x56022e,_0x2ea41d[_0xb00b('0xc')],'id');for(var _0x1c5400=0x0,_0x29579b={},_0x45ca74={};_0x1c5400<_0x56022e[_0xb00b('0x16')];_0x1c5400+=0x1){_0x29579b=_0x56022e[_0x1c5400];if(_[_0xb00b('0x17')](_0x2ea41d[_0xb00b('0xc')][_0x29579b['id']])){_0x2ea41d['faxQueues'][_0x29579b['id']]=new FaxQueue(_0x29579b);}else{_0x2ea41d[_0xb00b('0x14')](_0x2ea41d[_0xb00b('0xc')][_0x29579b['id']],_0x29579b);}_0x2ea41d[_0xb00b('0xc')][_0x29579b['id']][_0xb00b('0x1c')]();_0x2ea41d[_0xb00b('0xc')][_0x29579b['id']][_0xb00b('0x1a')]();}}return _0x2ea41d['faxQueues'];};};Realtime[_0xb00b('0x13')][_0xb00b('0x1e')]=function(){var _0x4801e7=this;return function(_0x17ff34){if(_0x17ff34){freeIsNotKey(_0x17ff34,_0x4801e7[_0xb00b('0xd')],'id');for(var _0xa2ae04=0x0,_0x2d8620={},_0x2954e8={};_0xa2ae04<_0x17ff34['length'];_0xa2ae04+=0x1){_0x2d8620=_0x17ff34[_0xa2ae04];if(_[_0xb00b('0x17')](_0x4801e7[_0xb00b('0xd')][_0x2d8620['id']])){_0x4801e7[_0xb00b('0xd')][_0x2d8620['id']]=new WhatsappQueue(_0x2d8620);}else{_0x4801e7[_0xb00b('0x14')](_0x4801e7['whatsappQueues'][_0x2d8620['id']],_0x2d8620);}_0x4801e7['whatsappQueues'][_0x2d8620['id']][_0xb00b('0x1c')]();_0x4801e7[_0xb00b('0xd')][_0x2d8620['id']][_0xb00b('0x1a')]();}}return _0x4801e7[_0xb00b('0xd')];};};module[_0xb00b('0x1f')]=Realtime; \ No newline at end of file +var _0x008c=['faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','mergeFromDatabase','updateRealtime','chatQueues','updateRouting','initSmsQueues','initMailQueues','mailQueues','initFaxQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','smsQueues'];(function(_0x6e3c48,_0x24dbc8){var _0x1998fb=function(_0x30baec){while(--_0x30baec){_0x6e3c48['push'](_0x6e3c48['shift']());}};_0x1998fb(++_0x24dbc8);}(_0x008c,0x188));var _0xc008=function(_0x229d7c,_0x2e8fd1){_0x229d7c=_0x229d7c-0x0;var _0x35c63b=_0x008c[_0x229d7c];return _0x35c63b;};'use strict';var BPromise=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var _=require(_0xc008('0x2'));var moment=require(_0xc008('0x3'));var Agent=require(_0xc008('0x4'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xc008('0x5'));var ChatQueue=require(_0xc008('0x6'));var SmsQueue=require(_0xc008('0x7'));var MailQueue=require(_0xc008('0x8'));var FaxQueue=require(_0xc008('0x9'));var WhatsappQueue=require(_0xc008('0xa'));var Realtime=function(){this[_0xc008('0xb')]={};this[_0xc008('0xc')]={};this[_0xc008('0xd')]={};this['chatQueues']={};this[_0xc008('0xe')]={};this['mailQueues']={};this[_0xc008('0xf')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0xc008('0x10')]={};this[_0xc008('0x11')]={};this['smsQueuesWaitingInteractions']={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x1eacfa,_0xc881aa,_0x5b2004){var _0xae2dab=_[_0xc008('0x12')](_0x1eacfa,function(_0x2ea200,_0x2a5b4e){return _0x2ea200[_0x5b2004];});for(var _0x9ffa93 in _0xc881aa){if(_0xc881aa[_0xc008('0x13')](_0x9ffa93)){if(!_0xae2dab[_0x9ffa93]){delete _0xc881aa[_0x9ffa93];}}}}Realtime[_0xc008('0x14')]['mergeFromDatabase']=function(_0x560e28,_0x33f44c){for(var _0x50c1ab in _0x33f44c){if(_0x560e28[_0xc008('0x13')](_0x50c1ab)){_0x560e28[_0x50c1ab]=_0x33f44c[_0x50c1ab];}}};Realtime[_0xc008('0x14')][_0xc008('0x15')]=function(){var _0x339ffc=this;return function(_0x3f0ecf){if(_0x3f0ecf){freeIsNotKey(_0x3f0ecf,_0x339ffc['agents'],'id');for(var _0x5e894e=0x0,_0x4bd0f4={},_0x11ef38={};_0x5e894e<_0x3f0ecf[_0xc008('0x16')];_0x5e894e+=0x1){_0x4bd0f4=_0x3f0ecf[_0x5e894e];if(_[_0xc008('0x17')](_0x339ffc[_0xc008('0xb')][_0x4bd0f4['id']])){_0x339ffc['agents'][_0x4bd0f4['id']]=new Agent(_0x4bd0f4);}else{_0x339ffc['mergeFromDatabase'](_0x339ffc['agents'][_0x4bd0f4['id']],_0x4bd0f4);}}}return _0x339ffc['agents'];};};Realtime[_0xc008('0x14')][_0xc008('0x18')]=function(){var _0x501137=this;return function(_0x813397){if(_0x813397){freeIsNotKey(_0x813397,_0x501137['intervals'],'id');for(var _0x4bd611=0x0,_0x543e5d={},_0x50261c={};_0x4bd611<_0x813397[_0xc008('0x16')];_0x4bd611+=0x1){_0x543e5d=_0x813397[_0x4bd611];if(_['isUndefined'](_0x501137['intervals'][_0x543e5d['id']])){_0x501137['intervals'][_0x543e5d['id']]=new Interval(_0x543e5d);}else{_0x501137['mergeFromDatabase'](_0x501137['intervals'][_0x543e5d['id']],_0x543e5d);}}}return _0x501137[_0xc008('0xc')];};};Realtime[_0xc008('0x14')][_0xc008('0x19')]=function(){var _0x415af3=this;return function(_0x11cc75){if(_0x11cc75){freeIsNotKey(_0x11cc75,_0x415af3[_0xc008('0xd')],'id');for(var _0x4f43e2=0x0,_0x459fd9={},_0x5c85f2={};_0x4f43e2<_0x11cc75['length'];_0x4f43e2+=0x1){_0x459fd9=_0x11cc75[_0x4f43e2];if(_[_0xc008('0x17')](_0x415af3[_0xc008('0xd')][_0x459fd9['id']])){_0x415af3[_0xc008('0xd')][_0x459fd9['id']]=new OpenchannelQueue(_0x459fd9);}else{_0x415af3[_0xc008('0x1a')](_0x415af3['openchannelQueues'][_0x459fd9['id']],_0x459fd9);}_0x415af3['openchannelQueues'][_0x459fd9['id']]['updateRouting']();_0x415af3[_0xc008('0xd')][_0x459fd9['id']][_0xc008('0x1b')]();}}return _0x415af3[_0xc008('0xd')];};};Realtime[_0xc008('0x14')]['initChatQueues']=function(){var _0x5e2aca=this;return function(_0x4fce9c){if(_0x4fce9c){freeIsNotKey(_0x4fce9c,_0x5e2aca['chatQueues'],'id');for(var _0x4caaf4=0x0,_0x3865c0={},_0x29ba43={};_0x4caaf4<_0x4fce9c[_0xc008('0x16')];_0x4caaf4+=0x1){_0x3865c0=_0x4fce9c[_0x4caaf4];if(_['isUndefined'](_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']])){_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']]=new ChatQueue(_0x3865c0);}else{_0x5e2aca[_0xc008('0x1a')](_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']],_0x3865c0);}_0x5e2aca['chatQueues'][_0x3865c0['id']][_0xc008('0x1d')]();_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']]['updateRealtime']();}}return _0x5e2aca['chatQueues'];};};Realtime['prototype'][_0xc008('0x1e')]=function(){var _0x267abd=this;return function(_0xf831f2){if(_0xf831f2){freeIsNotKey(_0xf831f2,_0x267abd[_0xc008('0xe')],'id');for(var _0x1de04b=0x0,_0xceebc3={},_0x294f97={};_0x1de04b<_0xf831f2[_0xc008('0x16')];_0x1de04b+=0x1){_0xceebc3=_0xf831f2[_0x1de04b];if(_[_0xc008('0x17')](_0x267abd[_0xc008('0xe')][_0xceebc3['id']])){_0x267abd[_0xc008('0xe')][_0xceebc3['id']]=new SmsQueue(_0xceebc3);}else{_0x267abd[_0xc008('0x1a')](_0x267abd['smsQueues'][_0xceebc3['id']],_0xceebc3);}_0x267abd[_0xc008('0xe')][_0xceebc3['id']][_0xc008('0x1d')]();_0x267abd['smsQueues'][_0xceebc3['id']][_0xc008('0x1b')]();}}return _0x267abd[_0xc008('0xe')];};};Realtime[_0xc008('0x14')][_0xc008('0x1f')]=function(){var _0xd0e05a=this;return function(_0x3cd878){if(_0x3cd878){freeIsNotKey(_0x3cd878,_0xd0e05a[_0xc008('0x20')],'id');for(var _0x470e79=0x0,_0x29d4b3={},_0x4f14d2={};_0x470e79<_0x3cd878[_0xc008('0x16')];_0x470e79+=0x1){_0x29d4b3=_0x3cd878[_0x470e79];if(_[_0xc008('0x17')](_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']])){_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']]=new MailQueue(_0x29d4b3);}else{_0xd0e05a[_0xc008('0x1a')](_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']],_0x29d4b3);}_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']]['updateRouting']();_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']][_0xc008('0x1b')]();}}return _0xd0e05a['mailQueues'];};};Realtime[_0xc008('0x14')][_0xc008('0x21')]=function(){var _0x5e38d5=this;return function(_0x263473){if(_0x263473){freeIsNotKey(_0x263473,_0x5e38d5[_0xc008('0xf')],'id');for(var _0x280e9b=0x0,_0x55ff48={},_0x53b353={};_0x280e9b<_0x263473['length'];_0x280e9b+=0x1){_0x55ff48=_0x263473[_0x280e9b];if(_[_0xc008('0x17')](_0x5e38d5['faxQueues'][_0x55ff48['id']])){_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']]=new FaxQueue(_0x55ff48);}else{_0x5e38d5[_0xc008('0x1a')](_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']],_0x55ff48);}_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']][_0xc008('0x1d')]();_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']][_0xc008('0x1b')]();}}return _0x5e38d5[_0xc008('0xf')];};};Realtime[_0xc008('0x14')][_0xc008('0x22')]=function(){var _0x3ebb83=this;return function(_0xdfca2e){if(_0xdfca2e){freeIsNotKey(_0xdfca2e,_0x3ebb83[_0xc008('0x23')],'id');for(var _0x2bf3fd=0x0,_0x4cace5={},_0x3238b4={};_0x2bf3fd<_0xdfca2e[_0xc008('0x16')];_0x2bf3fd+=0x1){_0x4cace5=_0xdfca2e[_0x2bf3fd];if(_[_0xc008('0x17')](_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']])){_0x3ebb83['whatsappQueues'][_0x4cace5['id']]=new WhatsappQueue(_0x4cace5);}else{_0x3ebb83[_0xc008('0x1a')](_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']],_0x4cace5);}_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']][_0xc008('0x1d')]();_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']]['updateRealtime']();}}return _0x3ebb83[_0xc008('0x23')];};};module[_0xc008('0x24')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index b94306b..31a29d4 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 _0x1318=['Request','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update'];(function(_0x3d372a,_0x114db8){var _0x210a44=function(_0x1acac6){while(--_0x1acac6){_0x3d372a['push'](_0x3d372a['shift']());}};_0x210a44(++_0x114db8);}(_0x1318,0x1be));var _0x8131=function(_0x5bcf77,_0x338187){_0x5bcf77=_0x5bcf77-0x0;var _0x1f95f6=_0x1318[_0x5bcf77];return _0x1f95f6;};'use strict';var client=require(_0x8131('0x0'));exports[_0x8131('0x1')]=function(_0x15c1de,_0x3c7805){return client[_0x8131('0x2')]('UpdateChatInteraction',{'body':_0x3c7805,'options':{'where':{'id':_0x15c1de}},'log':_0x8131('0x3')});};exports[_0x8131('0x4')]=function(_0x24afda,_0x53ae98){return client[_0x8131('0x2')](_0x8131('0x5'),{'body':_0x53ae98,'options':{'where':{'id':_0x24afda}},'log':_0x8131('0x6')});}; \ No newline at end of file +var _0xd1fb=['AddTagsToChatInteraction','../client','update','UpdateChatInteraction','updateChatInteraction','Request'];(function(_0x22f85a,_0x195ed5){var _0xaa717=function(_0xe9828e){while(--_0xe9828e){_0x22f85a['push'](_0x22f85a['shift']());}};_0xaa717(++_0x195ed5);}(_0xd1fb,0x181));var _0xbd1f=function(_0x54e2f2,_0x1751a3){_0x54e2f2=_0x54e2f2-0x0;var _0x1f2020=_0xd1fb[_0x54e2f2];return _0x1f2020;};'use strict';var client=require(_0xbd1f('0x0'));exports[_0xbd1f('0x1')]=function(_0x8c861e,_0x5da723){return client['Request'](_0xbd1f('0x2'),{'body':_0x5da723,'options':{'where':{'id':_0x8c861e}},'log':_0xbd1f('0x3')});};exports['addTags']=function(_0x528662,_0x35e7ca){return client[_0xbd1f('0x4')](_0xbd1f('0x5'),{'body':_0x35e7ca,'options':{'where':{'id':_0x528662}},'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 622dacb..b9069cd 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 _0xcb9c=['../client','create','Request','createChatMessage'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xcb9c,0xf8));var _0xccb9=function(_0x1c8f0d,_0x4fef6c){_0x1c8f0d=_0x1c8f0d-0x0;var _0x4022f0=_0xcb9c[_0x1c8f0d];return _0x4022f0;};'use strict';var client=require(_0xccb9('0x0'));exports[_0xccb9('0x1')]=function(_0x522faa){return client[_0xccb9('0x2')]('CreateChatMessage',{'body':_0x522faa,'log':_0xccb9('0x3')});}; \ No newline at end of file +var _0x80f6=['createChatMessage','../client','create','CreateChatMessage'];(function(_0x162780,_0x47f2e2){var _0x1ea2dc=function(_0x123898){while(--_0x123898){_0x162780['push'](_0x162780['shift']());}};_0x1ea2dc(++_0x47f2e2);}(_0x80f6,0x189));var _0x680f=function(_0x5801bd,_0x52a547){_0x5801bd=_0x5801bd-0x0;var _0x3c5f82=_0x80f6[_0x5801bd];return _0x3c5f82;};'use strict';var client=require(_0x680f('0x0'));exports[_0x680f('0x1')]=function(_0x12892e){return client['Request'](_0x680f('0x2'),{'body':_0x12892e,'log':_0x680f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index dd6d646..351ae7f 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 _0xb0ec=['strategy','User','Agents','online','chatPause','getChatQueues','GetChatQueue','name','timeout'];(function(_0x86849d,_0x2471be){var _0x13006f=function(_0x22864d){while(--_0x22864d){_0x86849d['push'](_0x86849d['shift']());}};_0x13006f(++_0x2471be);}(_0xb0ec,0xb0));var _0xcb0e=function(_0x1730ce,_0x4fd5f3){_0x1730ce=_0x1730ce-0x0;var _0x2c7715=_0xb0ec[_0x1730ce];return _0x2c7715;};'use strict';var client=require('../client');exports[_0xcb0e('0x0')]=function(){return function(){return client['Request'](_0xcb0e('0x1'),{'options':{'raw':![],'attributes':['id',_0xcb0e('0x2'),_0xcb0e('0x3'),_0xcb0e('0x4')],'include':[{'model':_0xcb0e('0x5'),'as':_0xcb0e('0x6'),'attributes':['id',_0xcb0e('0x2'),_0xcb0e('0x7'),_0xcb0e('0x8')]}]},'log':_0xcb0e('0x0')});};}; \ No newline at end of file +var _0xc155=['timeout','strategy','User','chatPause','../client','getChatQueues','Request','name'];(function(_0x43b5a2,_0x19b10f){var _0x2dc8e0=function(_0x170de2){while(--_0x170de2){_0x43b5a2['push'](_0x43b5a2['shift']());}};_0x2dc8e0(++_0x19b10f);}(_0xc155,0xd4));var _0x5c15=function(_0x25fab3,_0x43d24c){_0x25fab3=_0x25fab3-0x0;var _0x4fa330=_0xc155[_0x25fab3];return _0x4fa330;};'use strict';var client=require(_0x5c15('0x0'));exports[_0x5c15('0x1')]=function(){return function(){return client[_0x5c15('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x5c15('0x3'),_0x5c15('0x4'),_0x5c15('0x5')],'include':[{'model':_0x5c15('0x6'),'as':'Agents','attributes':['id',_0x5c15('0x3'),'online',_0x5c15('0x7')]}]},'log':_0x5c15('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 659f0b8..aa1edff 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 _0x4156=['update','UpdateChatQueueReport','DESC','../client','create','Request','CreateChatQueueReport'];(function(_0x36dbfe,_0x37a44b){var _0xd7b914=function(_0x2c2182){while(--_0x2c2182){_0x36dbfe['push'](_0x36dbfe['shift']());}};_0xd7b914(++_0x37a44b);}(_0x4156,0xf1));var _0x6415=function(_0x358f34,_0x14355c){_0x358f34=_0x358f34-0x0;var _0x17f2b1=_0x4156[_0x358f34];return _0x17f2b1;};'use strict';var client=require(_0x6415('0x0'));exports[_0x6415('0x1')]=function(_0x283016){return client[_0x6415('0x2')](_0x6415('0x3'),{'body':_0x283016,'log':'CreateChatQueueReport'});};exports[_0x6415('0x4')]=function(_0x4d8c74,_0xfd06c2){return client[_0x6415('0x2')](_0x6415('0x5'),{'body':_0xfd06c2,'options':{'where':{'uniqueid':_0x4d8c74},'order':[['id',_0x6415('0x6')]],'limit':0x1},'log':_0x6415('0x5')});}; \ No newline at end of file +var _0x4ea3=['Request','CreateChatQueueReport','UpdateChatQueueReport','DESC','../client','create'];(function(_0x44a428,_0x504568){var _0x3597e6=function(_0x3335e0){while(--_0x3335e0){_0x44a428['push'](_0x44a428['shift']());}};_0x3597e6(++_0x504568);}(_0x4ea3,0x70));var _0x34ea=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4ea3[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x34ea('0x0'));exports[_0x34ea('0x1')]=function(_0x324f65){return client[_0x34ea('0x2')]('CreateChatQueueReport',{'body':_0x324f65,'log':_0x34ea('0x3')});};exports['update']=function(_0x269d4c,_0x571f1b){return client['Request'](_0x34ea('0x4'),{'body':_0x571f1b,'options':{'where':{'uniqueid':_0x269d4c},'order':[['id',_0x34ea('0x5')]],'limit':0x1},'log':_0x34ea('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 6242682..938f7c8 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 _0x5d64=['Request','UpdateFaxInteraction','updateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x306dcc,_0x5cb45b){var _0x85c4b4=function(_0x5590c0){while(--_0x5590c0){_0x306dcc['push'](_0x306dcc['shift']());}};_0x85c4b4(++_0x5cb45b);}(_0x5d64,0x1da));var _0x45d6=function(_0xb04a79,_0x485a98){_0xb04a79=_0xb04a79-0x0;var _0x4eb4f5=_0x5d64[_0xb04a79];return _0x4eb4f5;};'use strict';var client=require(_0x45d6('0x0'));exports[_0x45d6('0x1')]=function(_0x1759e3,_0x508d66){return client[_0x45d6('0x2')](_0x45d6('0x3'),{'body':_0x508d66,'options':{'where':{'id':_0x1759e3}},'log':_0x45d6('0x4')});};exports[_0x45d6('0x5')]=function(_0x456fd3,_0x2e3f97){return client['Request'](_0x45d6('0x6'),{'body':_0x2e3f97,'options':{'where':{'id':_0x456fd3}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0xdf1f=['../client','update','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction'];(function(_0x5f1ca7,_0x42c21e){var _0x3ee471=function(_0x4b7a9b){while(--_0x4b7a9b){_0x5f1ca7['push'](_0x5f1ca7['shift']());}};_0x3ee471(++_0x42c21e);}(_0xdf1f,0x13e));var _0xfdf1=function(_0x47e661,_0x324878){_0x47e661=_0x47e661-0x0;var _0x11591f=_0xdf1f[_0x47e661];return _0x11591f;};'use strict';var client=require(_0xfdf1('0x0'));exports[_0xfdf1('0x1')]=function(_0x1950f9,_0x39028b){return client['Request'](_0xfdf1('0x2'),{'body':_0x39028b,'options':{'where':{'id':_0x1950f9}},'log':'updateFaxInteraction'});};exports[_0xfdf1('0x3')]=function(_0x150982,_0x3283fe){return client['Request'](_0xfdf1('0x4'),{'body':_0x3283fe,'options':{'where':{'id':_0x150982}},'log':_0xfdf1('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index bad3f11..a05495a 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 _0x0dd3=['CreateFaxMessage','../client','create','Request'];(function(_0x1e3c02,_0x5c07a2){var _0x4d26d7=function(_0x367ed9){while(--_0x367ed9){_0x1e3c02['push'](_0x1e3c02['shift']());}};_0x4d26d7(++_0x5c07a2);}(_0x0dd3,0x125));var _0x30dd=function(_0x1fb61a,_0x30c65c){_0x1fb61a=_0x1fb61a-0x0;var _0x10a10d=_0x0dd3[_0x1fb61a];return _0x10a10d;};'use strict';var client=require(_0x30dd('0x0'));exports[_0x30dd('0x1')]=function(_0x5c9b88){return client[_0x30dd('0x2')](_0x30dd('0x3'),{'body':_0x5c9b88,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x298f=['create','Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x4531ac,_0x440420){var _0x406d96=function(_0x35b7dc){while(--_0x35b7dc){_0x4531ac['push'](_0x4531ac['shift']());}};_0x406d96(++_0x440420);}(_0x298f,0x1bc));var _0xf298=function(_0x1635c6,_0x4ab0a2){_0x1635c6=_0x1635c6-0x0;var _0x32c096=_0x298f[_0x1635c6];return _0x32c096;};'use strict';var client=require(_0xf298('0x0'));exports[_0xf298('0x1')]=function(_0x5993e3){return client[_0xf298('0x2')](_0xf298('0x3'),{'body':_0x5993e3,'log':_0xf298('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 1719b46..9d54a1c 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 _0x1a0e=['GetFaxQueue','name','timeout','strategy','User','online','../client','getFaxQueues','Request'];(function(_0x2f219a,_0x2c5ac0){var _0x5afcc1=function(_0x4fcdd1){while(--_0x4fcdd1){_0x2f219a['push'](_0x2f219a['shift']());}};_0x5afcc1(++_0x2c5ac0);}(_0x1a0e,0x180));var _0xe1a0=function(_0x3d368b,_0xbbc5db){_0x3d368b=_0x3d368b-0x0;var _0x579af1=_0x1a0e[_0x3d368b];return _0x579af1;};'use strict';var client=require(_0xe1a0('0x0'));exports[_0xe1a0('0x1')]=function(){return function(){return client[_0xe1a0('0x2')](_0xe1a0('0x3'),{'options':{'raw':![],'attributes':['id',_0xe1a0('0x4'),_0xe1a0('0x5'),_0xe1a0('0x6')],'include':[{'model':_0xe1a0('0x7'),'as':'Agents','attributes':['id',_0xe1a0('0x4'),_0xe1a0('0x8'),'faxPause']}]},'log':_0xe1a0('0x1')});};}; \ No newline at end of file +var _0x8b9c=['../client','Request','GetFaxQueue','name','strategy','User','online','getFaxQueues'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x8b9c,0x1d8));var _0xc8b9=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x8b9c[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require(_0xc8b9('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0xc8b9('0x1')](_0xc8b9('0x2'),{'options':{'raw':![],'attributes':['id',_0xc8b9('0x3'),'timeout',_0xc8b9('0x4')],'include':[{'model':_0xc8b9('0x5'),'as':'Agents','attributes':['id',_0xc8b9('0x3'),_0xc8b9('0x6'),'faxPause']}]},'log':_0xc8b9('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 2637af7..c56f318 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 _0x032f=['Request','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x3005d5,_0xf588c7){var _0x547c7e=function(_0x4514dc){while(--_0x4514dc){_0x3005d5['push'](_0x3005d5['shift']());}};_0x547c7e(++_0xf588c7);}(_0x032f,0x7b));var _0xf032=function(_0x270933,_0x5da193){_0x270933=_0x270933-0x0;var _0x5c1497=_0x032f[_0x270933];return _0x5c1497;};'use strict';var client=require(_0xf032('0x0'));exports[_0xf032('0x1')]=function(_0x4dff3a){return client[_0xf032('0x2')]('CreateFaxQueueReport',{'body':_0x4dff3a,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x4556c4,_0x1881ce){return client[_0xf032('0x2')](_0xf032('0x3'),{'body':_0x1881ce,'options':{'where':{'uniqueid':_0x4556c4},'order':[['id',_0xf032('0x4')]],'limit':0x1},'log':_0xf032('0x3')});}; \ No newline at end of file +var _0x9d92=['DESC','../client','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x3fbfe1,_0x15c654){var _0x32e04b=function(_0x461c1f){while(--_0x461c1f){_0x3fbfe1['push'](_0x3fbfe1['shift']());}};_0x32e04b(++_0x15c654);}(_0x9d92,0xdf));var _0x29d9=function(_0x3ebb69,_0x3e612e){_0x3ebb69=_0x3ebb69-0x0;var _0x421e59=_0x9d92[_0x3ebb69];return _0x421e59;};'use strict';var client=require(_0x29d9('0x0'));exports['create']=function(_0x57b238){return client[_0x29d9('0x1')](_0x29d9('0x2'),{'body':_0x57b238,'log':'CreateFaxQueueReport'});};exports[_0x29d9('0x3')]=function(_0x1664bf,_0x18371b){return client[_0x29d9('0x1')](_0x29d9('0x4'),{'body':_0x18371b,'options':{'where':{'uniqueid':_0x1664bf},'order':[['id',_0x29d9('0x5')]],'limit':0x1},'log':_0x29d9('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index e34a81a..5e0be47 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 _0xbaf0=['name','Interval','Intervals','interval','getIntervals','Request','GetInterval'];(function(_0x4828b1,_0x5c8cf3){var _0x1fec1b=function(_0x3f2e5a){while(--_0x3f2e5a){_0x4828b1['push'](_0x4828b1['shift']());}};_0x1fec1b(++_0x5c8cf3);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var client=require('../client');exports[_0x0baf('0x0')]=function(){return function(){return client[_0x0baf('0x1')](_0x0baf('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x0baf('0x3')],'include':[{'model':_0x0baf('0x4'),'as':_0x0baf('0x5'),'attributes':['id','name',_0x0baf('0x6')]}]},'log':_0x0baf('0x0')});};}; \ No newline at end of file +var _0x7916=['name','interval','../client','Request','GetInterval','Interval','Intervals'];(function(_0xf0ac17,_0x5c85de){var _0xd428cf=function(_0x9ee6){while(--_0x9ee6){_0xf0ac17['push'](_0xf0ac17['shift']());}};_0xd428cf(++_0x5c85de);}(_0x7916,0x128));var _0x6791=function(_0x3a038b,_0x472807){_0x3a038b=_0x3a038b-0x0;var _0x331b5e=_0x7916[_0x3a038b];return _0x331b5e;};'use strict';var client=require(_0x6791('0x0'));exports['getIntervals']=function(){return function(){return client[_0x6791('0x1')](_0x6791('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x6791('0x3'),'as':_0x6791('0x4'),'attributes':['id',_0x6791('0x5'),_0x6791('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 68083a4..3734e62 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 _0x6bbd=['update','updateMailInteraction','addTags','Request','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6bbd,0x15c));var _0xd6bb=function(_0x259a42,_0x2b4483){_0x259a42=_0x259a42-0x0;var _0x548d68=_0x6bbd[_0x259a42];return _0x548d68;};'use strict';var client=require('../client');exports[_0xd6bb('0x0')]=function(_0xf15d13,_0x5a03af){return client['Request']('UpdateMailInteraction',{'body':_0x5a03af,'options':{'where':{'id':_0xf15d13}},'log':_0xd6bb('0x1')});};exports[_0xd6bb('0x2')]=function(_0x2d24d3,_0x5a9bfb){return client[_0xd6bb('0x3')](_0xd6bb('0x4'),{'body':_0x5a9bfb,'options':{'where':{'id':_0x2d24d3}},'log':_0xd6bb('0x5')});}; \ No newline at end of file +var _0xb84b=['AddTagsToMailInteraction','../client','update','updateMailInteraction','addTags','Request'];(function(_0x1e69ed,_0x26879f){var _0x215adc=function(_0xcd5a96){while(--_0xcd5a96){_0x1e69ed['push'](_0x1e69ed['shift']());}};_0x215adc(++_0x26879f);}(_0xb84b,0x151));var _0xbb84=function(_0xfe5cfe,_0x1d7bc9){_0xfe5cfe=_0xfe5cfe-0x0;var _0x6897d7=_0xb84b[_0xfe5cfe];return _0x6897d7;};'use strict';var client=require(_0xbb84('0x0'));exports[_0xbb84('0x1')]=function(_0x5ef902,_0xbbddcd){return client['Request']('UpdateMailInteraction',{'body':_0xbbddcd,'options':{'where':{'id':_0x5ef902}},'log':_0xbb84('0x2')});};exports[_0xbb84('0x3')]=function(_0x2a7a7a,_0x17d073){return client[_0xbb84('0x4')](_0xbb84('0x5'),{'body':_0x17d073,'options':{'where':{'id':_0x2a7a7a}},'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 4700034..6f1873b 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 _0x0047=['../client','create','Request','CreateMailMessage'];(function(_0x4bc6f5,_0xe1b220){var _0x2be1c8=function(_0x4ecebc){while(--_0x4ecebc){_0x4bc6f5['push'](_0x4bc6f5['shift']());}};_0x2be1c8(++_0xe1b220);}(_0x0047,0x144));var _0x7004=function(_0x2a1b33,_0x409f50){_0x2a1b33=_0x2a1b33-0x0;var _0x4c50e7=_0x0047[_0x2a1b33];return _0x4c50e7;};'use strict';var client=require(_0x7004('0x0'));exports[_0x7004('0x1')]=function(_0x434231){return client[_0x7004('0x2')](_0x7004('0x3'),{'body':_0x434231,'log':'createMailMessage'});}; \ No newline at end of file +var _0x75f3=['createMailMessage','../client','create','CreateMailMessage'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x75f3,0xbd));var _0x375f=function(_0x5883ef,_0x1ea49e){_0x5883ef=_0x5883ef-0x0;var _0x838fd5=_0x75f3[_0x5883ef];return _0x838fd5;};'use strict';var client=require(_0x375f('0x0'));exports[_0x375f('0x1')]=function(_0x3a2589){return client['Request'](_0x375f('0x2'),{'body':_0x3a2589,'log':_0x375f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index b21d79d..2c82df7 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 _0x08cd=['Agents','online','../client','getMailQueues','Request','GetMailQueue','name','strategy'];(function(_0x3f2cd5,_0x5bd3e7){var _0x1492b6=function(_0x2c94e8){while(--_0x2c94e8){_0x3f2cd5['push'](_0x3f2cd5['shift']());}};_0x1492b6(++_0x5bd3e7);}(_0x08cd,0x1aa));var _0xd08c=function(_0x1c2eaf,_0x118525){_0x1c2eaf=_0x1c2eaf-0x0;var _0x4865ac=_0x08cd[_0x1c2eaf];return _0x4865ac;};'use strict';var client=require(_0xd08c('0x0'));exports[_0xd08c('0x1')]=function(){return function(){return client[_0xd08c('0x2')](_0xd08c('0x3'),{'options':{'raw':![],'attributes':['id',_0xd08c('0x4'),'timeout',_0xd08c('0x5')],'include':[{'model':'User','as':_0xd08c('0x6'),'attributes':['id',_0xd08c('0x4'),_0xd08c('0x7'),'mailPause']}]},'log':_0xd08c('0x1')});};}; \ No newline at end of file +var _0x2b8e=['GetMailQueue','timeout','strategy','User','Agents','name','online','mailPause','../client','getMailQueues','Request'];(function(_0x207846,_0x404d19){var _0x59aa70=function(_0x460bd6){while(--_0x460bd6){_0x207846['push'](_0x207846['shift']());}};_0x59aa70(++_0x404d19);}(_0x2b8e,0xad));var _0xe2b8=function(_0x414dfc,_0x5e9726){_0x414dfc=_0x414dfc-0x0;var _0x48d595=_0x2b8e[_0x414dfc];return _0x48d595;};'use strict';var client=require(_0xe2b8('0x0'));exports[_0xe2b8('0x1')]=function(){return function(){return client[_0xe2b8('0x2')](_0xe2b8('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xe2b8('0x4'),_0xe2b8('0x5')],'include':[{'model':_0xe2b8('0x6'),'as':_0xe2b8('0x7'),'attributes':['id',_0xe2b8('0x8'),_0xe2b8('0x9'),_0xe2b8('0xa')]}]},'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 ab704c0..7fe817a 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 _0x68d6=['update','UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport'];(function(_0x26bcec,_0xe13f50){var _0x1049dc=function(_0x4c0d9b){while(--_0x4c0d9b){_0x26bcec['push'](_0x26bcec['shift']());}};_0x1049dc(++_0xe13f50);}(_0x68d6,0x122));var _0x668d=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x68d6[_0x4a9fb1];return _0x348672;};'use strict';var client=require(_0x668d('0x0'));exports[_0x668d('0x1')]=function(_0x40dc80){return client[_0x668d('0x2')](_0x668d('0x3'),{'body':_0x40dc80,'log':_0x668d('0x3')});};exports[_0x668d('0x4')]=function(_0x561eff,_0x48cde0){return client[_0x668d('0x2')](_0x668d('0x5'),{'body':_0x48cde0,'options':{'where':{'uniqueid':_0x561eff},'order':[['id',_0x668d('0x6')]],'limit':0x1},'log':_0x668d('0x5')});}; \ No newline at end of file +var _0xffb9=['create','CreateMailQueueReport','update','Request','UpdateMailQueueReport','DESC','../client'];(function(_0x1e23b8,_0x4690f9){var _0x11f0f3=function(_0x4f2718){while(--_0x4f2718){_0x1e23b8['push'](_0x1e23b8['shift']());}};_0x11f0f3(++_0x4690f9);}(_0xffb9,0x1b1));var _0x9ffb=function(_0x420e97,_0xb0ef){_0x420e97=_0x420e97-0x0;var _0x49356a=_0xffb9[_0x420e97];return _0x49356a;};'use strict';var client=require(_0x9ffb('0x0'));exports[_0x9ffb('0x1')]=function(_0x57fcdd){return client['Request'](_0x9ffb('0x2'),{'body':_0x57fcdd,'log':_0x9ffb('0x2')});};exports[_0x9ffb('0x3')]=function(_0x1cdf35,_0x542f66){return client[_0x9ffb('0x4')](_0x9ffb('0x5'),{'body':_0x542f66,'options':{'where':{'uniqueid':_0x1cdf35},'order':[['id',_0x9ffb('0x6')]],'limit':0x1},'log':_0x9ffb('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 4b65eaa..6d0c43d 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 _0x7e59=['addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x479f1a,_0x55e6f4){var _0x547801=function(_0x54b21d){while(--_0x54b21d){_0x479f1a['push'](_0x479f1a['shift']());}};_0x547801(++_0x55e6f4);}(_0x7e59,0xd3));var _0x97e5=function(_0x2ca247,_0x2a8dd1){_0x2ca247=_0x2ca247-0x0;var _0x26747d=_0x7e59[_0x2ca247];return _0x26747d;};'use strict';var client=require(_0x97e5('0x0'));exports[_0x97e5('0x1')]=function(_0x49a311,_0x112f0f){return client[_0x97e5('0x2')](_0x97e5('0x3'),{'body':_0x112f0f,'options':{'where':{'id':_0x49a311}},'log':'updateOpenchannelInteraction'});};exports[_0x97e5('0x4')]=function(_0x3426e1,_0xbf78aa){return client['Request'](_0x97e5('0x5'),{'body':_0xbf78aa,'options':{'where':{'id':_0x3426e1}},'log':_0x97e5('0x6')});}; \ No newline at end of file +var _0xb2d4=['addTagsToChatInteraction','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x1a4e55,_0x19dabc){var _0xb8edb1=function(_0x4ad493){while(--_0x4ad493){_0x1a4e55['push'](_0x1a4e55['shift']());}};_0xb8edb1(++_0x19dabc);}(_0xb2d4,0x139));var _0x4b2d=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xb2d4[_0x24237f];return _0x48298e;};'use strict';var client=require('../client');exports[_0x4b2d('0x0')]=function(_0x342109,_0x5e115b){return client[_0x4b2d('0x1')](_0x4b2d('0x2'),{'body':_0x5e115b,'options':{'where':{'id':_0x342109}},'log':_0x4b2d('0x3')});};exports[_0x4b2d('0x4')]=function(_0x21dd9d,_0xd403b2){return client[_0x4b2d('0x1')]('AddTagsToOpenchannelInteraction',{'body':_0xd403b2,'options':{'where':{'id':_0x21dd9d}},'log':_0x4b2d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 24bf3bd..77d2174 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 _0x153f=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x58175c,_0x2d9373){var _0x55b88f=function(_0x13ed84){while(--_0x13ed84){_0x58175c['push'](_0x58175c['shift']());}};_0x55b88f(++_0x2d9373);}(_0x153f,0x15b));var _0xf153=function(_0x30ad3e,_0x3016f9){_0x30ad3e=_0x30ad3e-0x0;var _0x185e30=_0x153f[_0x30ad3e];return _0x185e30;};'use strict';var client=require(_0xf153('0x0'));exports[_0xf153('0x1')]=function(_0xde7eae){return client[_0xf153('0x2')](_0xf153('0x3'),{'body':_0xde7eae,'log':_0xf153('0x4')});}; \ No newline at end of file +var _0x34e8=['../client','create','Request','createOpenchannelMessage'];(function(_0xd6d1b1,_0x361056){var _0x3a6200=function(_0x177dbf){while(--_0x177dbf){_0xd6d1b1['push'](_0xd6d1b1['shift']());}};_0x3a6200(++_0x361056);}(_0x34e8,0x12c));var _0x834e=function(_0x50502f,_0x5a95c8){_0x50502f=_0x50502f-0x0;var _0x135dc9=_0x34e8[_0x50502f];return _0x135dc9;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateOpenchannelMessage',{'body':_0x8b339,'log':_0x834e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index e7a9643..1ab1fee 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 _0x3192=['User','online','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy'];(function(_0x1a4eeb,_0x18e28f){var _0x16ef95=function(_0x5ca165){while(--_0x5ca165){_0x1a4eeb['push'](_0x1a4eeb['shift']());}};_0x16ef95(++_0x18e28f);}(_0x3192,0x122));var _0x2319=function(_0xa14fc0,_0x3d95a9){_0xa14fc0=_0xa14fc0-0x0;var _0xf3ee81=_0x3192[_0xa14fc0];return _0xf3ee81;};'use strict';var client=require(_0x2319('0x0'));exports[_0x2319('0x1')]=function(){return function(){return client[_0x2319('0x2')](_0x2319('0x3'),{'options':{'raw':![],'attributes':['id',_0x2319('0x4'),_0x2319('0x5'),_0x2319('0x6')],'include':[{'model':_0x2319('0x7'),'as':'Agents','attributes':['id','name',_0x2319('0x8'),'openchannelPause']}]},'log':_0x2319('0x1')});};}; \ No newline at end of file +var _0x81e7=['User','Agents','name','online','getOpenchannelQueues','Request','GetOpenchannelQueue','timeout','strategy'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x81e7,0x13f));var _0x781e=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x81e7[_0x5f309e];return _0x487b5e;};'use strict';var client=require('../client');exports[_0x781e('0x0')]=function(){return function(){return client[_0x781e('0x1')](_0x781e('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x781e('0x3'),_0x781e('0x4')],'include':[{'model':_0x781e('0x5'),'as':_0x781e('0x6'),'attributes':['id',_0x781e('0x7'),_0x781e('0x8'),'openchannelPause']}]},'log':_0x781e('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 5cfcdf2..9b6a955 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 _0x8046=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0xf93076,_0x1acb30){var _0x33d1da=function(_0x29e6bf){while(--_0x29e6bf){_0xf93076['push'](_0xf93076['shift']());}};_0x33d1da(++_0x1acb30);}(_0x8046,0x1c5));var _0x6804=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x8046[_0x13d07a];return _0x5ee0ee;};'use strict';var client=require(_0x6804('0x0'));exports[_0x6804('0x1')]=function(_0xf04712){return client[_0x6804('0x2')](_0x6804('0x3'),{'body':_0xf04712,'log':'CreateOpenchannelQueueReport'});};exports[_0x6804('0x4')]=function(_0x402e50,_0x20f8f2){return client[_0x6804('0x2')](_0x6804('0x5'),{'body':_0x20f8f2,'options':{'where':{'uniqueid':_0x402e50},'order':[['id',_0x6804('0x6')]],'limit':0x1},'log':_0x6804('0x5')});}; \ No newline at end of file +var _0x48c2=['update','DESC','../client','create','CreateOpenchannelQueueReport'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x48c2,0xf7));var _0x248c=function(_0x5b8b97,_0x6b4dfa){_0x5b8b97=_0x5b8b97-0x0;var _0x1fdf84=_0x48c2[_0x5b8b97];return _0x1fdf84;};'use strict';var client=require(_0x248c('0x0'));exports[_0x248c('0x1')]=function(_0x4991ae){return client['Request'](_0x248c('0x2'),{'body':_0x4991ae,'log':_0x248c('0x2')});};exports[_0x248c('0x3')]=function(_0x36784c,_0x89c5de){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x89c5de,'options':{'where':{'uniqueid':_0x36784c},'order':[['id',_0x248c('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 0bc52ab..4695658 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 _0x4975=['addTags','AddTagsToSmsInteraction','../client','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4975,0x86));var _0x5497=function(_0x3eab15,_0x3f4330){_0x3eab15=_0x3eab15-0x0;var _0x3b655a=_0x4975[_0x3eab15];return _0x3b655a;};'use strict';var client=require(_0x5497('0x0'));exports['update']=function(_0x474989,_0x3f9e37){return client[_0x5497('0x1')](_0x5497('0x2'),{'body':_0x3f9e37,'options':{'where':{'id':_0x474989}},'log':_0x5497('0x3')});};exports[_0x5497('0x4')]=function(_0x14cecb,_0xeb31af){return client[_0x5497('0x1')](_0x5497('0x5'),{'body':_0xeb31af,'options':{'where':{'id':_0x14cecb}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x30d7=['update','Request','updateSmsInteraction','addTags','addTagsToSmsInteraction','../client'];(function(_0x1e7701,_0x13fd0f){var _0x3ab707=function(_0x3c5242){while(--_0x3c5242){_0x1e7701['push'](_0x1e7701['shift']());}};_0x3ab707(++_0x13fd0f);}(_0x30d7,0x173));var _0x730d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x30d7[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x730d('0x0'));exports[_0x730d('0x1')]=function(_0x423ef8,_0x4684f3){return client[_0x730d('0x2')]('UpdateSmsInteraction',{'body':_0x4684f3,'options':{'where':{'id':_0x423ef8}},'log':_0x730d('0x3')});};exports[_0x730d('0x4')]=function(_0x41494d,_0x1be387){return client[_0x730d('0x2')]('AddTagsToSmsInteraction',{'body':_0x1be387,'options':{'where':{'id':_0x41494d}},'log':_0x730d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index f6dd734..d68e814 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 _0xca8e=['Request'];(function(_0xac3328,_0x23745a){var _0x33aec4=function(_0x476d1a){while(--_0x476d1a){_0xac3328['push'](_0xac3328['shift']());}};_0x33aec4(++_0x23745a);}(_0xca8e,0xbd));var _0xeca8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xca8e[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['create']=function(_0xf1f225){return client[_0xeca8('0x0')]('CreateSmsMessage',{'body':_0xf1f225,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x49cb=['createSmsMessage','../client','create','Request','CreateSmsMessage'];(function(_0x5b73ff,_0x1cba4d){var _0x1c4ba4=function(_0x319db1){while(--_0x319db1){_0x5b73ff['push'](_0x5b73ff['shift']());}};_0x1c4ba4(++_0x1cba4d);}(_0x49cb,0x1e6));var _0xb49c=function(_0xdc6179,_0x228c8d){_0xdc6179=_0xdc6179-0x0;var _0x3c24c4=_0x49cb[_0xdc6179];return _0x3c24c4;};'use strict';var client=require(_0xb49c('0x0'));exports[_0xb49c('0x1')]=function(_0x113db1){return client[_0xb49c('0x2')](_0xb49c('0x3'),{'body':_0x113db1,'log':_0xb49c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 1045212..636e82a 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 _0x307e=['smsPause','../client','getSmsQueues','Request','GetSmsQueue','name','strategy','User'];(function(_0x55c06b,_0x1ab2da){var _0x12eb36=function(_0x4acd90){while(--_0x4acd90){_0x55c06b['push'](_0x55c06b['shift']());}};_0x12eb36(++_0x1ab2da);}(_0x307e,0xc9));var _0xe307=function(_0x73ded,_0x127047){_0x73ded=_0x73ded-0x0;var _0x21cc28=_0x307e[_0x73ded];return _0x21cc28;};'use strict';var client=require(_0xe307('0x0'));exports[_0xe307('0x1')]=function(){return function(){return client[_0xe307('0x2')](_0xe307('0x3'),{'options':{'raw':![],'attributes':['id',_0xe307('0x4'),'timeout',_0xe307('0x5')],'include':[{'model':_0xe307('0x6'),'as':'Agents','attributes':['id',_0xe307('0x4'),'online',_0xe307('0x7')]}]},'log':_0xe307('0x1')});};}; \ No newline at end of file +var _0xc27c=['../client','getSmsQueues','Request','timeout','strategy','User','Agents','online','smsPause'];(function(_0x29f60e,_0x295358){var _0x587be1=function(_0x15607e){while(--_0x15607e){_0x29f60e['push'](_0x29f60e['shift']());}};_0x587be1(++_0x295358);}(_0xc27c,0x129));var _0xcc27=function(_0x44f030,_0x28993e){_0x44f030=_0x44f030-0x0;var _0x2c6b70=_0xc27c[_0x44f030];return _0x2c6b70;};'use strict';var client=require(_0xcc27('0x0'));exports[_0xcc27('0x1')]=function(){return function(){return client[_0xcc27('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0xcc27('0x3'),_0xcc27('0x4')],'include':[{'model':_0xcc27('0x5'),'as':_0xcc27('0x6'),'attributes':['id','name',_0xcc27('0x7'),_0xcc27('0x8')]}]},'log':_0xcc27('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index cd7795f..3bb2a42 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 _0x7ebf=['update','UpdateSmsQueueReport','DESC','../client','create','Request','CreateSmsQueueReport'];(function(_0x5c6fdb,_0xeb3523){var _0x4d0f90=function(_0x3a981c){while(--_0x3a981c){_0x5c6fdb['push'](_0x5c6fdb['shift']());}};_0x4d0f90(++_0xeb3523);}(_0x7ebf,0x153));var _0xf7eb=function(_0x2f46e6,_0x1b50ec){_0x2f46e6=_0x2f46e6-0x0;var _0x51ec1d=_0x7ebf[_0x2f46e6];return _0x51ec1d;};'use strict';var client=require(_0xf7eb('0x0'));exports[_0xf7eb('0x1')]=function(_0x526b69){return client[_0xf7eb('0x2')](_0xf7eb('0x3'),{'body':_0x526b69,'log':_0xf7eb('0x3')});};exports[_0xf7eb('0x4')]=function(_0x13e0ce,_0x32a84b){return client[_0xf7eb('0x2')](_0xf7eb('0x5'),{'body':_0x32a84b,'options':{'where':{'uniqueid':_0x13e0ce},'order':[['id',_0xf7eb('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0xc16f=['UpdateSmsQueueReport','DESC','../client','create','Request','CreateSmsQueueReport'];(function(_0xc0cb13,_0x59ee07){var _0x11cd94=function(_0xf2d56c){while(--_0xf2d56c){_0xc0cb13['push'](_0xc0cb13['shift']());}};_0x11cd94(++_0x59ee07);}(_0xc16f,0xe6));var _0xfc16=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc16f[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xfc16('0x0'));exports[_0xfc16('0x1')]=function(_0x5e456c){return client[_0xfc16('0x2')](_0xfc16('0x3'),{'body':_0x5e456c,'log':_0xfc16('0x3')});};exports['update']=function(_0x5d0e86,_0x2d277f){return client['Request'](_0xfc16('0x4'),{'body':_0x2d277f,'options':{'where':{'uniqueid':_0x5d0e86},'order':[['id',_0xfc16('0x5')]],'limit':0x1},'log':_0xfc16('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 0b2505c..e0a5649 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 _0x4ee6=['agent','name','pauseType','voicePause','chatPause','mailPause','faxPause','whatsappPause','openchannelPause','mailCapacity','faxCapacity','smsCapacity','openchannelCapacity','getAgents','../client','Request','GetUser'];(function(_0xee383f,_0x4137fc){var _0x1c048f=function(_0x2fee91){while(--_0x2fee91){_0xee383f['push'](_0xee383f['shift']());}};_0x1c048f(++_0x4137fc);}(_0x4ee6,0x1d9));var _0x64ee=function(_0x493cc9,_0x5caa65){_0x493cc9=_0x493cc9-0x0;var _0x214774=_0x4ee6[_0x493cc9];return _0x214774;};'use strict';var client=require(_0x64ee('0x0'));exports['getAgents']=function(){return function(){return client[_0x64ee('0x1')](_0x64ee('0x2'),{'options':{'raw':!![],'where':{'role':_0x64ee('0x3')},'attributes':['id',_0x64ee('0x4'),'online',_0x64ee('0x5'),'lastPauseAt',_0x64ee('0x6'),_0x64ee('0x7'),_0x64ee('0x8'),_0x64ee('0x9'),'smsPause',_0x64ee('0xa'),_0x64ee('0xb'),'chatCapacity',_0x64ee('0xc'),_0x64ee('0xd'),_0x64ee('0xe'),'whatsappCapacity',_0x64ee('0xf')]},'log':_0x64ee('0x10')});};}; \ No newline at end of file +var _0x8a5b=['getAgents','GetUser','agent','online','pauseType','voicePause','chatPause','mailPause','faxPause','smsPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','openchannelCapacity'];(function(_0x2b1989,_0x281abc){var _0x505dfb=function(_0x130eb6){while(--_0x130eb6){_0x2b1989['push'](_0x2b1989['shift']());}};_0x505dfb(++_0x281abc);}(_0x8a5b,0x121));var _0xb8a5=function(_0x6944bf,_0x103e89){_0x6944bf=_0x6944bf-0x0;var _0x64c6d9=_0x8a5b[_0x6944bf];return _0x64c6d9;};'use strict';var client=require('../client');exports[_0xb8a5('0x0')]=function(){return function(){return client['Request'](_0xb8a5('0x1'),{'options':{'raw':!![],'where':{'role':_0xb8a5('0x2')},'attributes':['id','name',_0xb8a5('0x3'),_0xb8a5('0x4'),'lastPauseAt',_0xb8a5('0x5'),_0xb8a5('0x6'),_0xb8a5('0x7'),_0xb8a5('0x8'),_0xb8a5('0x9'),_0xb8a5('0xa'),_0xb8a5('0xb'),_0xb8a5('0xc'),_0xb8a5('0xd'),_0xb8a5('0xe'),_0xb8a5('0xf'),'whatsappCapacity',_0xb8a5('0x10')]},'log':_0xb8a5('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index e82190c..01dbe7a 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 _0x7846=['UpdateWhatsappInteraction','updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','Request'];(function(_0x212394,_0x185eec){var _0x4c6b07=function(_0xce5652){while(--_0xce5652){_0x212394['push'](_0x212394['shift']());}};_0x4c6b07(++_0x185eec);}(_0x7846,0xf4));var _0x6784=function(_0x2df387,_0x1d3ea1){_0x2df387=_0x2df387-0x0;var _0x3b1708=_0x7846[_0x2df387];return _0x3b1708;};'use strict';var client=require('../client');exports[_0x6784('0x0')]=function(_0x2c4fd7,_0x3bc014){return client[_0x6784('0x1')](_0x6784('0x2'),{'body':_0x3bc014,'options':{'where':{'id':_0x2c4fd7}},'log':_0x6784('0x3')});};exports['addTags']=function(_0x13ba3e,_0x24c16b){return client[_0x6784('0x1')](_0x6784('0x4'),{'body':_0x24c16b,'options':{'where':{'id':_0x13ba3e}},'log':_0x6784('0x5')});}; \ No newline at end of file +var _0xd847=['updateWhatsappInteraction','addTags','Request','addTagsToWhatsappInteraction','../client','update'];(function(_0x279da9,_0x4e72a6){var _0x285d04=function(_0x326886){while(--_0x326886){_0x279da9['push'](_0x279da9['shift']());}};_0x285d04(++_0x4e72a6);}(_0xd847,0x18a));var _0x7d84=function(_0x4566b8,_0x40a546){_0x4566b8=_0x4566b8-0x0;var _0xf73e97=_0xd847[_0x4566b8];return _0xf73e97;};'use strict';var client=require(_0x7d84('0x0'));exports[_0x7d84('0x1')]=function(_0x3e5e53,_0x1d94dd){return client['Request']('UpdateWhatsappInteraction',{'body':_0x1d94dd,'options':{'where':{'id':_0x3e5e53}},'log':_0x7d84('0x2')});};exports[_0x7d84('0x3')]=function(_0x207e6f,_0x15f200){return client[_0x7d84('0x4')]('AddTagsToWhatsappInteraction',{'body':_0x15f200,'options':{'where':{'id':_0x207e6f}},'log':_0x7d84('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index c1d89a0..7b81991 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 _0xbf43=['CreateWhatsappMessage','Request'];(function(_0x5960d3,_0x948e4a){var _0x233f9e=function(_0x4a1c48){while(--_0x4a1c48){_0x5960d3['push'](_0x5960d3['shift']());}};_0x233f9e(++_0x948e4a);}(_0xbf43,0x12d));var _0x3bf4=function(_0x59740a,_0x1721a9){_0x59740a=_0x59740a-0x0;var _0x771004=_0xbf43[_0x59740a];return _0x771004;};'use strict';var client=require('../client');exports['create']=function(_0x2d18d9){return client[_0x3bf4('0x0')](_0x3bf4('0x1'),{'body':_0x2d18d9,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xf8fa=['CreateWhatsappMessage','createWhatsappMessage','../client','create','Request'];(function(_0x5cf99f,_0x450e05){var _0xeedf3a=function(_0x21f600){while(--_0x21f600){_0x5cf99f['push'](_0x5cf99f['shift']());}};_0xeedf3a(++_0x450e05);}(_0xf8fa,0x66));var _0xaf8f=function(_0x551b39,_0x10e9b7){_0x551b39=_0x551b39-0x0;var _0x5ea501=_0xf8fa[_0x551b39];return _0x5ea501;};'use strict';var client=require(_0xaf8f('0x0'));exports[_0xaf8f('0x1')]=function(_0x1a4b2e){return client[_0xaf8f('0x2')](_0xaf8f('0x3'),{'body':_0x1a4b2e,'log':_0xaf8f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 5e4db54..3adfd4a 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 _0xa699=['GetWhatsappQueue','name','timeout','strategy','User','Agents','online','whatsappPause','../client','getWhatsappQueues','Request'];(function(_0xd1fd13,_0x47e0ca){var _0x3590de=function(_0x5b6e7b){while(--_0x5b6e7b){_0xd1fd13['push'](_0xd1fd13['shift']());}};_0x3590de(++_0x47e0ca);}(_0xa699,0x6b));var _0x9a69=function(_0x15f3c0,_0x165a64){_0x15f3c0=_0x15f3c0-0x0;var _0x1adfe0=_0xa699[_0x15f3c0];return _0x1adfe0;};'use strict';var client=require(_0x9a69('0x0'));exports[_0x9a69('0x1')]=function(){return function(){return client[_0x9a69('0x2')](_0x9a69('0x3'),{'options':{'raw':![],'attributes':['id',_0x9a69('0x4'),_0x9a69('0x5'),_0x9a69('0x6')],'include':[{'model':_0x9a69('0x7'),'as':_0x9a69('0x8'),'attributes':['id',_0x9a69('0x4'),_0x9a69('0x9'),_0x9a69('0xa')]}]},'log':_0x9a69('0x1')});};}; \ No newline at end of file +var _0x93e6=['timeout','User','Agents','name','whatsappPause','getWhatsappQueues','../client','GetWhatsappQueue'];(function(_0x262224,_0x4c1df){var _0x53362f=function(_0x3b8d61){while(--_0x3b8d61){_0x262224['push'](_0x262224['shift']());}};_0x53362f(++_0x4c1df);}(_0x93e6,0x11e));var _0x693e=function(_0x1269c6,_0x1c8942){_0x1269c6=_0x1269c6-0x0;var _0x4868c7=_0x93e6[_0x1269c6];return _0x4868c7;};'use strict';var client=require(_0x693e('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x693e('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x693e('0x2'),'strategy'],'include':[{'model':_0x693e('0x3'),'as':_0x693e('0x4'),'attributes':['id',_0x693e('0x5'),'online',_0x693e('0x6')]}]},'log':_0x693e('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 04939a4..915302d 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 _0xe240=['DESC','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x243aca,_0x272cb3){var _0x4a586d=function(_0x388d8b){while(--_0x388d8b){_0x243aca['push'](_0x243aca['shift']());}};_0x4a586d(++_0x272cb3);}(_0xe240,0x13f));var _0x0e24=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xe240[_0x3d42d8];return _0x27fc41;};'use strict';var client=require('../client');exports[_0x0e24('0x0')]=function(_0x5f23bf){return client[_0x0e24('0x1')](_0x0e24('0x2'),{'body':_0x5f23bf,'log':'CreateWhatsappQueueReport'});};exports[_0x0e24('0x3')]=function(_0x1dd7f2,_0x2305f8){return client['Request'](_0x0e24('0x4'),{'body':_0x2305f8,'options':{'where':{'uniqueid':_0x1dd7f2},'order':[['id',_0x0e24('0x5')]],'limit':0x1},'log':_0x0e24('0x4')});}; \ No newline at end of file +var _0x1eab=['UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport','update'];(function(_0x17b0d4,_0x377add){var _0x2d02c7=function(_0x56e627){while(--_0x56e627){_0x17b0d4['push'](_0x17b0d4['shift']());}};_0x2d02c7(++_0x377add);}(_0x1eab,0xe9));var _0xb1ea=function(_0x3a0def,_0x58c8ac){_0x3a0def=_0x3a0def-0x0;var _0x2511f0=_0x1eab[_0x3a0def];return _0x2511f0;};'use strict';var client=require(_0xb1ea('0x0'));exports[_0xb1ea('0x1')]=function(_0x42a41d){return client[_0xb1ea('0x2')](_0xb1ea('0x3'),{'body':_0x42a41d,'log':_0xb1ea('0x3')});};exports[_0xb1ea('0x4')]=function(_0x2ac8f8,_0x1dcbee){return client[_0xb1ea('0x2')](_0xb1ea('0x5'),{'body':_0x1dcbee,'options':{'where':{'uniqueid':_0x2ac8f8},'order':[['id',_0xb1ea('0x6')]],'limit':0x1},'log':_0xb1ea('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 6c1565d..b197532 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 _0x545d=['toLowerCase','validate','length','error','map','join','find','agents','timeout','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','../../../../config/logger','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','name'];(function(_0x21e2ea,_0x52661f){var _0x526033=function(_0x916338){while(--_0x916338){_0x21e2ea['push'](_0x21e2ea['shift']());}};_0x526033(++_0x52661f);}(_0x545d,0xe4));var _0xd545=function(_0x86231e,_0x50c1d8){_0x86231e=_0x86231e-0x0;var _0x2745e3=_0x545d[_0x86231e];return _0x2745e3;};'use strict';var schema=require('validate');var _=require(_0xd545('0x0'));var util=require(_0xd545('0x1'));var seqqueue=require(_0xd545('0x2'));var logger=require(_0xd545('0x3'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':_0xd545('0x4'),'required':!![],'message':_0xd545('0x5')},'timeout':{'type':_0xd545('0x6'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x2599c7,_0x47b3f4,_0x45e77c){return logger[_0xd545('0x7')](util[_0xd545('0x8')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x2599c7,_0x47b3f4[_0xd545('0x9')],_0x45e77c));}function handleFindAgent(_0x21d4cf){return function(_0x5a1687){return _0x5a1687[_0xd545('0x9')][_0xd545('0xa')]()===_0x21d4cf[_0xd545('0xa')]();};}exports['consequence']=function(_0x406126,_0xc9eb38,_0x29ba00,_0x43276){return function(_0x41b337){try{var _0x2d81a2={'name':_0xc9eb38[0x0],'timeout':_0xc9eb38[0x1]};var _0x5ebcf4=queue[_0xd545('0xb')](_0x2d81a2,{'typecast':!![]});if(_0x5ebcf4[_0xd545('0xc')]){logger[_0xd545('0xd')]('[%s][AGENT]\x20%s',_0x406126,_[_0xd545('0xe')](_0x5ebcf4,'message')[_0xd545('0xf')](',\x20'));_0x41b337['stop']();}else{var _0x5438f6=_[_0xd545('0x10')](_0x29ba00[_0xd545('0x11')],handleFindAgent(_0x2d81a2[_0xd545('0x9')]));if(_0x5438f6){var _0x439a60=(_0x2d81a2[_0xd545('0x12')]||0xa)*0x3e8;var _0x5ddc3e,_0x25f210;var _0x1f6848=seqqueue['createQueue'](_0x439a60);_0x1f6848['id']=_0x406126;_0x1f6848[_0xd545('0x13')]=_0x439a60;_0x1f6848['channel']=_0x43276[_0xd545('0x14')];writeLog(_0x406126,_0x5438f6,util[_0xd545('0x8')](_0xd545('0x15'),_0x439a60));_0x29ba00[_0xd545('0x16')][_0x406126]['on'](_0xd545('0x17'),function(){logger[_0xd545('0x7')](_0xd545('0x18'),_0x406126);clearTimeout(_0x25f210);_0x25f210=undefined;_0x1f6848[_0xd545('0x19')]();if(_0x29ba00[_0xd545('0x16')][_0x406126]){delete _0x29ba00[_0xd545('0x16')][_0x406126];}_0x41b337[_0xd545('0x1a')]();});_0x29ba00[_0xd545('0x16')][_0x406126]['on'](_0xd545('0x1b'),function(){if(_0x29ba00[_0xd545('0x16')][_0x406126]){delete _0x29ba00[_0xd545('0x16')][_0x406126];}});_0x25f210=setTimeout(function(){logger[_0xd545('0x7')](_0xd545('0x1c'),_0x406126);clearTimeout(_0x25f210);_0x1f6848['close']();_0x41b337['next']();},_0x439a60);strategy[_0xd545('0x1d')](_0x1f6848,_0x5438f6,_0x29ba00,_0x43276);}else{logger[_0xd545('0xd')](_0xd545('0x1e'),_0x406126,_0x2d81a2[_0xd545('0x9')]);_0x41b337['stop']();}}}catch(_0x3c7391){console[_0xd545('0x1f')](_0x3c7391);logger[_0xd545('0xd')](_0xd545('0x20'),_0x406126,_0x3c7391[_0xd545('0x21')]);_0x41b337['stop']();}};}; \ No newline at end of file +var _0xc6c6=['length','[%s][AGENT]\x20%s','map','message','join','stop','find','timeout','atimeout','channel','format','START:%s','end','info','close','rules','complete','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','error','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','../../../../config/logger','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc6c6,0x16a));var _0x6c6c=function(_0x53f964,_0x3b52b8){_0x53f964=_0x53f964-0x0;var _0x17be6c=_0xc6c6[_0x53f964];return _0x17be6c;};'use strict';var schema=require(_0x6c6c('0x0'));var _=require(_0x6c6c('0x1'));var util=require(_0x6c6c('0x2'));var seqqueue=require(_0x6c6c('0x3'));var logger=require(_0x6c6c('0x4'))('routing');var strategy=require(_0x6c6c('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x6c6c('0x6')},'timeout':{'type':_0x6c6c('0x7'),'message':_0x6c6c('0x8')}});function writeLog(_0x1901a6,_0x2e5a54,_0x3bb4ac){return logger['info'](util['format'](_0x6c6c('0x9'),_0x1901a6,_0x2e5a54[_0x6c6c('0xa')],_0x3bb4ac));}function handleFindAgent(_0x79deff){return function(_0x55a182){return _0x55a182['name']['toLowerCase']()===_0x79deff[_0x6c6c('0xb')]();};}exports['consequence']=function(_0x1c066d,_0x4b04d4,_0x211dde,_0x2d23c3){return function(_0x29032){try{var _0x50e7c6={'name':_0x4b04d4[0x0],'timeout':_0x4b04d4[0x1]};var _0x1fdedb=queue['validate'](_0x50e7c6,{'typecast':!![]});if(_0x1fdedb[_0x6c6c('0xc')]){logger['error'](_0x6c6c('0xd'),_0x1c066d,_[_0x6c6c('0xe')](_0x1fdedb,_0x6c6c('0xf'))[_0x6c6c('0x10')](',\x20'));_0x29032[_0x6c6c('0x11')]();}else{var _0x4a2b95=_[_0x6c6c('0x12')](_0x211dde['agents'],handleFindAgent(_0x50e7c6['name']));if(_0x4a2b95){var _0x5d8dbb=(_0x50e7c6[_0x6c6c('0x13')]||0xa)*0x3e8;var _0x30da67,_0x10dbcf;var _0x9e7fa0=seqqueue['createQueue'](_0x5d8dbb);_0x9e7fa0['id']=_0x1c066d;_0x9e7fa0[_0x6c6c('0x14')]=_0x5d8dbb;_0x9e7fa0['channel']=_0x2d23c3[_0x6c6c('0x15')];writeLog(_0x1c066d,_0x4a2b95,util[_0x6c6c('0x16')](_0x6c6c('0x17'),_0x5d8dbb));_0x211dde['rules'][_0x1c066d]['on'](_0x6c6c('0x18'),function(){logger[_0x6c6c('0x19')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x1c066d);clearTimeout(_0x10dbcf);_0x10dbcf=undefined;_0x9e7fa0[_0x6c6c('0x1a')]();if(_0x211dde[_0x6c6c('0x1b')][_0x1c066d]){delete _0x211dde['rules'][_0x1c066d];}_0x29032['stop']();});_0x211dde[_0x6c6c('0x1b')][_0x1c066d]['on'](_0x6c6c('0x1c'),function(){if(_0x211dde[_0x6c6c('0x1b')][_0x1c066d]){delete _0x211dde['rules'][_0x1c066d];}});_0x10dbcf=setTimeout(function(){logger[_0x6c6c('0x19')]('[%s][AGENT]\x20ROUTING\x20END',_0x1c066d);clearTimeout(_0x10dbcf);_0x9e7fa0[_0x6c6c('0x1a')]();_0x29032[_0x6c6c('0x1d')]();},_0x5d8dbb);strategy['agent'](_0x9e7fa0,_0x4a2b95,_0x211dde,_0x2d23c3);}else{logger['error'](_0x6c6c('0x1e'),_0x1c066d,_0x50e7c6[_0x6c6c('0xa')]);_0x29032[_0x6c6c('0x11')]();}}}catch(_0x212a46){console[_0x6c6c('0x1f')](_0x212a46);logger[_0x6c6c('0x20')](_0x6c6c('0x21'),_0x1c066d,_0x212a46['stack']);_0x29032[_0x6c6c('0x11')]();}};}; \ 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 e81cf80..e7e567b 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 _0x7e7d=['Failed','stringify','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','account','AccountId','upperFirst','InteractionId','created','isEmpty','Message','create','[%s][AMAZONLEX]\x20%s','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','body','postText','amazonlex','providerName','providerResponse','then','dialogState'];(function(_0x504a3c,_0x2bca40){var _0x6d2388=function(_0x5f2d9c){while(--_0x5f2d9c){_0x504a3c['push'](_0x504a3c['shift']());}};_0x6d2388(++_0x2bca40);}(_0x7e7d,0x66));var _0xd7e7=function(_0x3b1eee,_0x202fa6){_0x3b1eee=_0x3b1eee-0x0;var _0x293461=_0x7e7d[_0x3b1eee];return _0x293461;};'use strict';var _=require('lodash');var moment=require(_0xd7e7('0x0'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0xd7e7('0x1'))(_0xd7e7('0x2'));var rpc={'chatMessage':require(_0xd7e7('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xd7e7('0x4')),'smsMessage':require(_0xd7e7('0x5')),'faxMessage':require(_0xd7e7('0x6')),'whatsappMessage':require(_0xd7e7('0x7'))};exports[_0xd7e7('0x8')]=function(_0x52c890,_0x217d79){return function(_0x26e2b7){try{if(!_[_0xd7e7('0x9')](this[_0xd7e7('0xa')]['UserId'])){logger[_0xd7e7('0xb')]('[%s][AMAZONLEX]\x20%s',_0x52c890,_0xd7e7('0xc'));return _0x26e2b7[_0xd7e7('0xd')]();}var _0xb67482={'ContactId':this[_0xd7e7('0xe')]['id'],'sentAt':moment()[_0xd7e7('0xf')](_0xd7e7('0x10')),'direction':_0xd7e7('0x11')};if(this['channel']===_0xd7e7('0x12')||this[_0xd7e7('0x13')]===_0xd7e7('0x14')){_0xb67482[_0xd7e7('0x15')]=this[_0xd7e7('0xa')][_0xd7e7('0x15')];}var _0x88e280=this[_0xd7e7('0x13')];if(_0x88e280===_0xd7e7('0x16')){_0xb67482['ChatWebsiteId']=this[_0xd7e7('0x17')]['id'];}else{_0xb67482[_['upperFirst'](_0x88e280)+_0xd7e7('0x18')]=this[_0xd7e7('0x17')]['id'];}_0xb67482[_[_0xd7e7('0x19')](_0x88e280)+_0xd7e7('0x1a')]=this[_0xd7e7('0xa')]['id'];if(this[_0xd7e7('0xa')][_0xd7e7('0x1b')]){var _0x35c5de=_0x217d79[0x4];if(!_[_0xd7e7('0x1c')](_0x35c5de)){_0xb67482['body']=utils['getMustacheRender'](_0x35c5de,this);return rpc[_0x88e280+_0xd7e7('0x1d')][_0xd7e7('0x1e')](_0xb67482)['then'](function(_0x54cd63){logger[_0xd7e7('0xb')](_0xd7e7('0x1f'),_0x52c890,_0xb67482['body']);})[_0xd7e7('0x20')](function(_0x3faf6b){logger[_0xd7e7('0x21')]('[%s][AMAZONLEX]\x20%s',_0x52c890,JSON['stringify'](_0x3faf6b));})[_0xd7e7('0x22')](function(){logger['info'](_0xd7e7('0x23'),_0x52c890);_0x26e2b7[_0xd7e7('0x24')]();});}else{logger[_0xd7e7('0xb')](_0xd7e7('0x25'),_0x52c890);_0x26e2b7['stop']();}}else{var _0x2ff7ea=this;var _0x5e752c=new AWS[(_0xd7e7('0x26'))]({'accessKeyId':_0x217d79[0x0],'secretAccessKey':_0x217d79[0x1],'region':_0x217d79[0x2]});var _0x11b551={'botAlias':_0xd7e7('0x27'),'botName':_0x217d79[0x3],'inputText':this[_0xd7e7('0x28')][_0xd7e7('0x29')],'userId':this[_0xd7e7('0x13')]+':'+this[_0xd7e7('0xa')]['id']['toString']()};_0x5e752c[_0xd7e7('0x2a')](_0x11b551,function(_0x43faab,_0x1cd973){if(_0x43faab){logger['error'](_0xd7e7('0x1f'),_0x52c890,_0x43faab[_0xd7e7('0x28')]);_0x26e2b7[_0xd7e7('0xd')]();}else if(_0x1cd973&&_0x1cd973[_0xd7e7('0x28')]){_0x2ff7ea[_0xd7e7('0x29')][_0xd7e7('0x2b')]=_0x1cd973;_0xb67482['body']=_0x1cd973[_0xd7e7('0x28')];_0xb67482[_0xd7e7('0x2c')]=_0xd7e7('0x2b');_0xb67482[_0xd7e7('0x2d')]=JSON['stringify'](_0x1cd973);return rpc[_0x88e280+_0xd7e7('0x1d')]['create'](_0xb67482)[_0xd7e7('0x2e')](function(_0x14b652){logger[_0xd7e7('0xb')](_0xd7e7('0x1f'),_0x52c890,_0xb67482['body']);if(_0x1cd973[_0xd7e7('0x2f')]==_0xd7e7('0x30')){_0x26e2b7[_0xd7e7('0xd')]();}else{_0x26e2b7[_0xd7e7('0x24')]();}})['catch'](function(_0x5a90c0){logger[_0xd7e7('0x21')](_0xd7e7('0x1f'),_0x52c890,JSON[_0xd7e7('0x31')](_0x5a90c0));_0x26e2b7[_0xd7e7('0xd')]();});}else{_0x26e2b7[_0xd7e7('0xd')]();}});}}catch(_0x9334a8){logger['error'](_0xd7e7('0x1f'),_0x52c890,JSON['stringify'](_0x9334a8));_0x26e2b7['stop']();}};}; \ No newline at end of file +var _0x6e46=['postText','error','message','next','amazonlex','providerName','providerResponse','create','then','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','interaction','UserId','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','phone','upperFirst','account','created','isEmpty','body','Message','info','[%s][AMAZONLEX]\x20%s','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'];(function(_0x5312a6,_0x5228ac){var _0x27e13f=function(_0x499987){while(--_0x499987){_0x5312a6['push'](_0x5312a6['shift']());}};_0x27e13f(++_0x5228ac);}(_0x6e46,0x1ef));var _0x66e4=function(_0x505886,_0x55d445){_0x505886=_0x505886-0x0;var _0x198628=_0x6e46[_0x505886];return _0x198628;};'use strict';var _=require(_0x66e4('0x0'));var moment=require(_0x66e4('0x1'));var AWS=require(_0x66e4('0x2'));var utils=require(_0x66e4('0x3'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x66e4('0x4')),'openchannelMessage':require(_0x66e4('0x5')),'mailMessage':require(_0x66e4('0x6')),'smsMessage':require(_0x66e4('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x66e4('0x8'))};exports['consequence']=function(_0x501dda,_0x4f1fdc){return function(_0x18c26a){try{if(!_['isNil'](this[_0x66e4('0x9')][_0x66e4('0xa')])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x501dda,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x18c26a['next']();}var _0x43a953={'ContactId':this['contact']['id'],'sentAt':moment()[_0x66e4('0xb')](_0x66e4('0xc')),'direction':_0x66e4('0xd')};if(this['channel']===_0x66e4('0xe')||this[_0x66e4('0xf')]==='whatsapp'){_0x43a953[_0x66e4('0x10')]=this[_0x66e4('0x9')][_0x66e4('0x10')];}var _0x1291e1=this[_0x66e4('0xf')];if(_0x1291e1==='chat'){_0x43a953['ChatWebsiteId']=this['account']['id'];}else{_0x43a953[_[_0x66e4('0x11')](_0x1291e1)+'AccountId']=this[_0x66e4('0x12')]['id'];}_0x43a953[_[_0x66e4('0x11')](_0x1291e1)+'InteractionId']=this[_0x66e4('0x9')]['id'];if(this['interaction'][_0x66e4('0x13')]){var _0x4f086e=_0x4f1fdc[0x4];if(!_[_0x66e4('0x14')](_0x4f086e)){_0x43a953[_0x66e4('0x15')]=utils['getMustacheRender'](_0x4f086e,this);return rpc[_0x1291e1+_0x66e4('0x16')]['create'](_0x43a953)['then'](function(_0x29bf6a){logger[_0x66e4('0x17')](_0x66e4('0x18'),_0x501dda,_0x43a953['body']);})[_0x66e4('0x19')](function(_0x487d14){logger['error'](_0x66e4('0x18'),_0x501dda,JSON[_0x66e4('0x1a')](_0x487d14));})['finally'](function(){logger[_0x66e4('0x17')](_0x66e4('0x1b'),_0x501dda);_0x18c26a[_0x66e4('0x1c')]();});}else{logger[_0x66e4('0x17')](_0x66e4('0x1d'),_0x501dda);_0x18c26a[_0x66e4('0x1c')]();}}else{var _0x37b4ef=this;var _0x175cfe=new AWS[(_0x66e4('0x1e'))]({'accessKeyId':_0x4f1fdc[0x0],'secretAccessKey':_0x4f1fdc[0x1],'region':_0x4f1fdc[0x2]});var _0x35ac09={'botAlias':_0x66e4('0x1f'),'botName':_0x4f1fdc[0x3],'inputText':this['message'][_0x66e4('0x15')],'userId':this[_0x66e4('0xf')]+':'+this['interaction']['id'][_0x66e4('0x20')]()};_0x175cfe[_0x66e4('0x21')](_0x35ac09,function(_0x2091e6,_0x698ff2){if(_0x2091e6){logger[_0x66e4('0x22')](_0x66e4('0x18'),_0x501dda,_0x2091e6[_0x66e4('0x23')]);_0x18c26a[_0x66e4('0x24')]();}else if(_0x698ff2&&_0x698ff2[_0x66e4('0x23')]){_0x37b4ef[_0x66e4('0x15')][_0x66e4('0x25')]=_0x698ff2;_0x43a953['body']=_0x698ff2['message'];_0x43a953[_0x66e4('0x26')]=_0x66e4('0x25');_0x43a953[_0x66e4('0x27')]=JSON[_0x66e4('0x1a')](_0x698ff2);return rpc[_0x1291e1+_0x66e4('0x16')][_0x66e4('0x28')](_0x43a953)[_0x66e4('0x29')](function(_0x54914c){logger[_0x66e4('0x17')]('[%s][AMAZONLEX]\x20%s',_0x501dda,_0x43a953['body']);if(_0x698ff2[_0x66e4('0x2a')]==_0x66e4('0x2b')){_0x18c26a[_0x66e4('0x24')]();}else{_0x18c26a[_0x66e4('0x1c')]();}})['catch'](function(_0x4351f5){logger[_0x66e4('0x22')](_0x66e4('0x18'),_0x501dda,JSON['stringify'](_0x4351f5));_0x18c26a['next']();});}else{_0x18c26a[_0x66e4('0x24')]();}});}}catch(_0x186018){logger[_0x66e4('0x22')](_0x66e4('0x18'),_0x501dda,JSON[_0x66e4('0x1a')](_0x186018));_0x18c26a['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 104c64c..d406a5f 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 _0x1349=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','interaction','created','info','Autoreply\x20already\x20sent','next','channel','contact','YYYY-MM-DD\x20HH:mm:ss','out','body','getMustacheRender','message','from','mail','phone','subject','startsWith','Re:','Re:\x20','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Smtp','service','port','secure','authentication','auth','user','pass','messageId','','replace','','headers','All','auto_reply','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','then','[%s][AUTOREPLY]\x20%s','catch','error','stringify','finally','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage'];(function(_0x37d839,_0x2cf4a5){var _0x4bb011=function(_0x2212f6){while(--_0x2212f6){_0x37d839['push'](_0x37d839['shift']());}};_0x4bb011(++_0x2cf4a5);}(_0x1349,0x1ac));var _0x9134=function(_0x8b201,_0x1c8499){_0x8b201=_0x8b201-0x0;var _0x267c7d=_0x1349[_0x8b201];return _0x267c7d;};'use strict';var _=require(_0x9134('0x0'));var moment=require(_0x9134('0x1'));var utils=require(_0x9134('0x2'));var logger=require(_0x9134('0x3'))(_0x9134('0x4'));var rpc={'chatMessage':require(_0x9134('0x5')),'openchannelMessage':require(_0x9134('0x6')),'mailMessage':require(_0x9134('0x7')),'smsMessage':require(_0x9134('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x9134('0x9'))};var mailRpc=require('../../mailRpc');exports[_0x9134('0xa')]=function(_0x16b31e,_0x23eb8e){return function(_0x51e360){try{if(_0x23eb8e[0x0]==='1'&&(_['isNil'](this[_0x9134('0xb')]['created'])||!this[_0x9134('0xb')][_0x9134('0xc')])){logger[_0x9134('0xd')]('[%s][AUTOREPLY]\x20%s',_0x16b31e,_0x9134('0xe'));return _0x51e360[_0x9134('0xf')]();}var _0x6e4a2e=this[_0x9134('0x10')];var _0x3366f7={'ContactId':this[_0x9134('0x11')]['id'],'sentAt':moment()['format'](_0x9134('0x12')),'direction':_0x9134('0x13')};if(this[_0x9134('0x10')]==='mail'){_0x3366f7[_0x9134('0x14')]=utils[_0x9134('0x15')](_0x23eb8e[0x2],this);}else{_0x3366f7[_0x9134('0x14')]=utils[_0x9134('0x15')](_0x23eb8e[0x1],this);}if(this[_0x9134('0x16')]){_0x3366f7['to']=this[_0x9134('0x16')][_0x9134('0x17')]||'';if(this[_0x9134('0x10')]===_0x9134('0x18')&&_0x23eb8e[0x1]==='1'){_0x3366f7['cc']=this[_0x9134('0x16')]['cc']||'';}_0x3366f7['from']=this['message']['to']||'';_0x3366f7[_0x9134('0x19')]=this[_0x9134('0x16')][_0x9134('0x19')]||'';_0x3366f7['read']=!![];if(this['message']['subject']){_0x3366f7[_0x9134('0x1a')]='';_0x3366f7[_0x9134('0x1a')]+=_[_0x9134('0x1b')](this[_0x9134('0x16')][_0x9134('0x1a')],_0x9134('0x1c'))?'':_0x9134('0x1d');_0x3366f7[_0x9134('0x1a')]+=this[_0x9134('0x16')][_0x9134('0x1a')];}}if(this[_0x9134('0x10')]==='chat'){_0x3366f7[_0x9134('0x1e')]=this[_0x9134('0x1f')]['id'];}else{_0x3366f7[_[_0x9134('0x20')](this['channel'])+_0x9134('0x21')]=this[_0x9134('0x1f')]['id'];}_0x3366f7[_['upperFirst'](this[_0x9134('0x10')])+_0x9134('0x22')]=this['interaction']['id'];if(rpc[this[_0x9134('0x10')]+'Message']){if(this[_0x9134('0x10')]===_0x9134('0x18')){var _0x50b0e5={'tls':{'rejectUnauthorized':![]}};if(this[_0x9134('0x1f')][_0x9134('0x23')][_0x9134('0x24')]){_0x50b0e5[_0x9134('0x24')]=this[_0x9134('0x1f')][_0x9134('0x23')]['service'];}else{_0x50b0e5['host']=this[_0x9134('0x1f')][_0x9134('0x23')]['host'];_0x50b0e5['port']=this[_0x9134('0x1f')][_0x9134('0x23')][_0x9134('0x25')];_0x50b0e5['secure']=this[_0x9134('0x1f')][_0x9134('0x23')][_0x9134('0x26')];}if(this['account'][_0x9134('0x23')][_0x9134('0x27')]){_0x50b0e5[_0x9134('0x28')]={'user':this[_0x9134('0x1f')]['Smtp'][_0x9134('0x29')],'pass':this[_0x9134('0x1f')][_0x9134('0x23')][_0x9134('0x2a')]};}_0x3366f7['inReplyTo']=this[_0x9134('0x16')][_0x9134('0x2b')];_0x3366f7['html']=_0x9134('0x2c')+_[_0x9134('0x2d')](_0x3366f7[_0x9134('0x14')],_0x9134('0x2e'),_0x9134('0x2f'))+_0x9134('0x30');_0x3366f7[_0x9134('0x31')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x9134('0x32'),'Precedence':_0x9134('0x33')};return mailRpc['sendMailMessage'](_0x50b0e5,_0x3366f7)['then'](function(_0x4517e7){logger[_0x9134('0xd')](_0x9134('0x34'),_0x16b31e);_0x3366f7[_0x9134('0x2b')]=_0x4517e7[_0x9134('0x16')][_0x9134('0x2b')];return rpc[_0x6e4a2e+_0x9134('0x35')][_0x9134('0x36')](_0x3366f7);})[_0x9134('0x37')](function(_0x3ac88a){logger[_0x9134('0xd')](_0x9134('0x38'),_0x16b31e,JSON['stringify'](_0x3ac88a));})[_0x9134('0x39')](function(_0x287d51){logger[_0x9134('0x3a')]('[RPC][%s][AUTOREPLY]\x20%s',_0x16b31e,JSON[_0x9134('0x3b')](_0x287d51));})[_0x9134('0x3c')](function(){_0x51e360[_0x9134('0xf')]();});}else{return rpc[this['channel']+_0x9134('0x35')][_0x9134('0x36')](_0x3366f7)['then'](function(_0x4ed7ba){logger[_0x9134('0xd')](_0x9134('0x38'),_0x16b31e,_0x3366f7[_0x9134('0x14')]);})[_0x9134('0x39')](function(_0x3152ca){logger[_0x9134('0x3a')](_0x9134('0x38'),_0x16b31e,JSON[_0x9134('0x3b')](_0x3152ca));})[_0x9134('0x3c')](function(){_0x51e360[_0x9134('0xf')]();});}}}catch(_0x158a86){logger[_0x9134('0x3a')](_0x9134('0x38'),_0x16b31e,JSON[_0x9134('0x3b')](_0x158a86));_0x51e360[_0x9134('0x3d')]();}};}; \ No newline at end of file +var _0xb7ae=['out','mail','body','getMustacheRender','message','from','phone','read','subject','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','Smtp','service','host','port','secure','authentication','auth','user','pass','inReplyTo','messageId','html','','replace','','headers','All','auto_reply','sendMailMessage','then','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','channel','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5b6fc7,_0xedd793){var _0x32bde0=function(_0xd3d68f){while(--_0xd3d68f){_0x5b6fc7['push'](_0x5b6fc7['shift']());}};_0x32bde0(++_0xedd793);}(_0xb7ae,0xf3));var _0xeb7a=function(_0x11b508,_0x43b4fe){_0x11b508=_0x11b508-0x0;var _0x19c9a4=_0xb7ae[_0x11b508];return _0x19c9a4;};'use strict';var _=require(_0xeb7a('0x0'));var moment=require(_0xeb7a('0x1'));var utils=require(_0xeb7a('0x2'));var logger=require(_0xeb7a('0x3'))(_0xeb7a('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xeb7a('0x5')),'mailMessage':require(_0xeb7a('0x6')),'smsMessage':require(_0xeb7a('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xeb7a('0x8'))};var mailRpc=require(_0xeb7a('0x9'));exports[_0xeb7a('0xa')]=function(_0x2564ab,_0x365bc0){return function(_0x5eeb35){try{if(_0x365bc0[0x0]==='1'&&(_[_0xeb7a('0xb')](this[_0xeb7a('0xc')][_0xeb7a('0xd')])||!this['interaction'][_0xeb7a('0xd')])){logger[_0xeb7a('0xe')](_0xeb7a('0xf'),_0x2564ab,_0xeb7a('0x10'));return _0x5eeb35[_0xeb7a('0x11')]();}var _0x275d58=this[_0xeb7a('0x12')];var _0x4e6734={'ContactId':this['contact']['id'],'sentAt':moment()[_0xeb7a('0x13')](_0xeb7a('0x14')),'direction':_0xeb7a('0x15')};if(this[_0xeb7a('0x12')]===_0xeb7a('0x16')){_0x4e6734[_0xeb7a('0x17')]=utils[_0xeb7a('0x18')](_0x365bc0[0x2],this);}else{_0x4e6734['body']=utils[_0xeb7a('0x18')](_0x365bc0[0x1],this);}if(this[_0xeb7a('0x19')]){_0x4e6734['to']=this['message'][_0xeb7a('0x1a')]||'';if(this[_0xeb7a('0x12')]==='mail'&&_0x365bc0[0x1]==='1'){_0x4e6734['cc']=this[_0xeb7a('0x19')]['cc']||'';}_0x4e6734['from']=this['message']['to']||'';_0x4e6734[_0xeb7a('0x1b')]=this['message']['phone']||'';_0x4e6734[_0xeb7a('0x1c')]=!![];if(this[_0xeb7a('0x19')][_0xeb7a('0x1d')]){_0x4e6734[_0xeb7a('0x1d')]='';_0x4e6734['subject']+=_['startsWith'](this[_0xeb7a('0x19')][_0xeb7a('0x1d')],'Re:')?'':'Re:\x20';_0x4e6734[_0xeb7a('0x1d')]+=this[_0xeb7a('0x19')][_0xeb7a('0x1d')];}}if(this[_0xeb7a('0x12')]===_0xeb7a('0x1e')){_0x4e6734[_0xeb7a('0x1f')]=this[_0xeb7a('0x20')]['id'];}else{_0x4e6734[_[_0xeb7a('0x21')](this['channel'])+_0xeb7a('0x22')]=this[_0xeb7a('0x20')]['id'];}_0x4e6734[_['upperFirst'](this['channel'])+_0xeb7a('0x23')]=this[_0xeb7a('0xc')]['id'];if(rpc[this[_0xeb7a('0x12')]+_0xeb7a('0x24')]){if(this[_0xeb7a('0x12')]===_0xeb7a('0x16')){var _0xfb62a5={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0xeb7a('0x25')][_0xeb7a('0x26')]){_0xfb62a5[_0xeb7a('0x26')]=this['account'][_0xeb7a('0x25')][_0xeb7a('0x26')];}else{_0xfb62a5[_0xeb7a('0x27')]=this[_0xeb7a('0x20')]['Smtp'][_0xeb7a('0x27')];_0xfb62a5['port']=this[_0xeb7a('0x20')][_0xeb7a('0x25')][_0xeb7a('0x28')];_0xfb62a5[_0xeb7a('0x29')]=this[_0xeb7a('0x20')][_0xeb7a('0x25')][_0xeb7a('0x29')];}if(this[_0xeb7a('0x20')][_0xeb7a('0x25')][_0xeb7a('0x2a')]){_0xfb62a5[_0xeb7a('0x2b')]={'user':this['account'][_0xeb7a('0x25')][_0xeb7a('0x2c')],'pass':this[_0xeb7a('0x20')][_0xeb7a('0x25')][_0xeb7a('0x2d')]};}_0x4e6734[_0xeb7a('0x2e')]=this[_0xeb7a('0x19')][_0xeb7a('0x2f')];_0x4e6734[_0xeb7a('0x30')]=_0xeb7a('0x31')+_[_0xeb7a('0x32')](_0x4e6734['body'],_0xeb7a('0x33'),_0xeb7a('0x34'))+_0xeb7a('0x35');_0x4e6734[_0xeb7a('0x36')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0xeb7a('0x37'),'Precedence':_0xeb7a('0x38')};return mailRpc[_0xeb7a('0x39')](_0xfb62a5,_0x4e6734)[_0xeb7a('0x3a')](function(_0x3a67de){logger[_0xeb7a('0xe')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x2564ab);_0x4e6734[_0xeb7a('0x2f')]=_0x3a67de[_0xeb7a('0x19')][_0xeb7a('0x2f')];return rpc[_0x275d58+_0xeb7a('0x24')][_0xeb7a('0x3b')](_0x4e6734);})[_0xeb7a('0x3a')](function(_0x47ba59){logger[_0xeb7a('0xe')]('[%s][AUTOREPLY]\x20%s',_0x2564ab,JSON[_0xeb7a('0x3c')](_0x47ba59));})[_0xeb7a('0x3d')](function(_0x500254){logger[_0xeb7a('0x3e')](_0xeb7a('0x3f'),_0x2564ab,JSON[_0xeb7a('0x3c')](_0x500254));})[_0xeb7a('0x40')](function(){_0x5eeb35[_0xeb7a('0x11')]();});}else{return rpc[this[_0xeb7a('0x12')]+_0xeb7a('0x24')][_0xeb7a('0x3b')](_0x4e6734)['then'](function(_0x38f456){logger[_0xeb7a('0xe')]('[%s][AUTOREPLY]\x20%s',_0x2564ab,_0x4e6734[_0xeb7a('0x17')]);})[_0xeb7a('0x3d')](function(_0x20b1d4){logger[_0xeb7a('0x3e')](_0xeb7a('0xf'),_0x2564ab,JSON[_0xeb7a('0x3c')](_0x20b1d4));})[_0xeb7a('0x40')](function(){_0x5eeb35['next']();});}}}catch(_0x356bbc){logger[_0xeb7a('0x3e')](_0xeb7a('0xf'),_0x2564ab,JSON[_0xeb7a('0x3c')](_0x356bbc));_0x5eeb35[_0xeb7a('0x41')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 139ef6c..850443a 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb65=['../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','error','[%s][CLOSE]\x20%s','stringify','finally','stop','../../../../config/logger','routing'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xfb65,0x82));var _0x5fb6=function(_0x18caac,_0x21caf4){_0x18caac=_0x18caac-0x0;var _0x14ac14=_0xfb65[_0x18caac];return _0x14ac14;};'use strict';var moment=require('moment');var logger=require(_0x5fb6('0x0'))(_0x5fb6('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x5fb6('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x5fb6('0x3')),'faxInteraction':require(_0x5fb6('0x4')),'whatsappInteraction':require(_0x5fb6('0x5'))};exports[_0x5fb6('0x6')]=function(_0x3a3b1b,_0x1fefe3,_0x4dec8f,_0x50782b){return function(_0x238914){try{logger[_0x5fb6('0x7')](_0x5fb6('0x8'),_0x3a3b1b,_0x1fefe3[0x0]);var _0x840390={'closed':0x1,'closedAt':moment()['format'](_0x5fb6('0x9')),'closeReason':_0x5fb6('0xa'),'disposition':_0x1fefe3[0x0]};if(rpc[_0x50782b[_0x5fb6('0xb')]+_0x5fb6('0xc')]){rpc[_0x50782b['channel']+_0x5fb6('0xc')][_0x5fb6('0xd')](_0x50782b['interaction']['id'],_0x840390)[_0x5fb6('0xe')](function(_0x19387c){logger[_0x5fb6('0x7')](_0x5fb6('0xf'),_0x3a3b1b,_0x50782b[_0x5fb6('0x10')]['id']);})['catch'](function(_0x1927d0){logger[_0x5fb6('0x11')](_0x5fb6('0x12'),_0x3a3b1b,JSON[_0x5fb6('0x13')](_0x1927d0));})[_0x5fb6('0x14')](function(){_0x238914[_0x5fb6('0x15')]();});}}catch(_0x1a391f){logger[_0x5fb6('0x11')]('[%s][CLOSE]\x20%s',_0x3a3b1b,JSON['stringify'](_0x1a391f));_0x238914[_0x5fb6('0x15')]();}};}; \ No newline at end of file +var _0x0b3d=['[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','routing','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','info','format','channel','Interaction','then'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0b3d,0x76));var _0xd0b3=function(_0x58f8a7,_0xbd36a7){_0x58f8a7=_0x58f8a7-0x0;var _0x149b97=_0x0b3d[_0x58f8a7];return _0x149b97;};'use strict';var moment=require(_0xd0b3('0x0'));var logger=require('../../../../config/logger')(_0xd0b3('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xd0b3('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xd0b3('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xd0b3('0x4'))};exports['consequence']=function(_0x371869,_0x9cb1c8,_0x5b80df,_0x2968c9){return function(_0x5bc883){try{logger[_0xd0b3('0x5')]('[%s][CLOSE]\x20reason\x20%s',_0x371869,_0x9cb1c8[0x0]);var _0x5ab5b2={'closed':0x1,'closedAt':moment()[_0xd0b3('0x6')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':'system','disposition':_0x9cb1c8[0x0]};if(rpc[_0x2968c9[_0xd0b3('0x7')]+'Interaction']){rpc[_0x2968c9[_0xd0b3('0x7')]+_0xd0b3('0x8')]['update'](_0x2968c9['interaction']['id'],_0x5ab5b2)[_0xd0b3('0x9')](function(_0xbf2123){logger[_0xd0b3('0x5')](_0xd0b3('0xa'),_0x371869,_0x2968c9['interaction']['id']);})['catch'](function(_0x97ca75){logger[_0xd0b3('0xb')](_0xd0b3('0xc'),_0x371869,JSON[_0xd0b3('0xd')](_0x97ca75));})[_0xd0b3('0xe')](function(){_0x5bc883[_0xd0b3('0xf')]();});}}catch(_0x2e4734){logger['error'](_0xd0b3('0xc'),_0x371869,JSON[_0xd0b3('0xd')](_0x2e4734));_0x5bc883[_0xd0b3('0xf')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 1519f41..19454b8 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1093=['contact','format','out','sms','channel','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','interaction','created','body','getMustacheRender','Message','create','info','error','stringify','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','then','dialogflow','fulfillment','speech','providerName','providerResponse','endConversation','next','catch','moment','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x1093,0xa5));var _0x3109=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x1093[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var moment=require(_0x3109('0x0'));var apiai=require('apiai-promise');var md5=require(_0x3109('0x1'));var utils=require('./utils');var logger=require(_0x3109('0x2'))(_0x3109('0x3'));var rpc={'chatMessage':require(_0x3109('0x4')),'openchannelMessage':require(_0x3109('0x5')),'mailMessage':require(_0x3109('0x6')),'smsMessage':require(_0x3109('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x3109('0x8'))};exports['consequence']=function(_0x2e9874,_0x561ac4){return function(_0x36145f){try{if(!_['isNil'](this['interaction']['UserId'])){logger['info'](_0x3109('0x9'),_0x2e9874,_0x3109('0xa'));return _0x36145f['next']();}var _0x5691c6={'ContactId':this[_0x3109('0xb')]['id'],'sentAt':moment()[_0x3109('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x3109('0xd')};if(this['channel']===_0x3109('0xe')||this[_0x3109('0xf')]==='whatsapp'){_0x5691c6[_0x3109('0x10')]=this['interaction'][_0x3109('0x10')];}var _0x4c65dc=this['channel'];if(_0x4c65dc===_0x3109('0x11')){_0x5691c6[_0x3109('0x12')]=this[_0x3109('0x13')]['id'];}else{_0x5691c6[_[_0x3109('0x14')](_0x4c65dc)+_0x3109('0x15')]=this[_0x3109('0x13')]['id'];}_0x5691c6[_[_0x3109('0x14')](_0x4c65dc)+'InteractionId']=this[_0x3109('0x16')]['id'];if(this[_0x3109('0x16')][_0x3109('0x17')]){var _0x25ccff=_0x561ac4[0x2];if(!_['isEmpty'](_0x25ccff)){_0x5691c6[_0x3109('0x18')]=utils[_0x3109('0x19')](_0x25ccff,this);return rpc[_0x4c65dc+_0x3109('0x1a')][_0x3109('0x1b')](_0x5691c6)['then'](function(_0x44da35){logger[_0x3109('0x1c')](_0x3109('0x9'),_0x2e9874,_0x5691c6[_0x3109('0x18')]);})['catch'](function(_0x171c98){logger[_0x3109('0x1d')]('[%s][DIALOGFLOW]\x20%s',_0x2e9874,JSON[_0x3109('0x1e')](_0x171c98));})['finally'](function(){logger[_0x3109('0x1c')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2e9874);_0x36145f[_0x3109('0x1f')]();});}else{logger[_0x3109('0x1c')](_0x3109('0x20'),_0x2e9874);_0x36145f['stop']();}}else{var _0x4aa1f9=this;var _0x545068=apiai(_0x561ac4[0x0],{'language':_0x561ac4[0x1]||'en'});return _0x545068[_0x3109('0x21')](this[_0x3109('0x22')][_0x3109('0x18')],{'sessionId':md5(this[_0x3109('0x16')]['id'])})[_0x3109('0x23')](function(_0x5b5d76){_0x4aa1f9[_0x3109('0x18')][_0x3109('0x24')]=_0x5b5d76;_0x5691c6[_0x3109('0x18')]=_0x5b5d76['result'][_0x3109('0x25')][_0x3109('0x26')];_0x5691c6[_0x3109('0x27')]=_0x3109('0x24');_0x5691c6[_0x3109('0x28')]=JSON[_0x3109('0x1e')](_0x5b5d76);return rpc[_0x4c65dc+_0x3109('0x1a')][_0x3109('0x1b')](_0x5691c6)['then'](function(_0x54c956){logger[_0x3109('0x1c')](_0x3109('0x9'),_0x2e9874,_0x5691c6[_0x3109('0x18')]);if(_0x5b5d76['result']['metadata'][_0x3109('0x29')]){_0x36145f[_0x3109('0x2a')]();}else{_0x36145f[_0x3109('0x1f')]();}})['catch'](function(_0x296bf7){logger[_0x3109('0x1d')]('[%s][DIALOGFLOW]\x20%s',_0x2e9874,JSON['stringify'](_0x296bf7));_0x36145f['next']();});})[_0x3109('0x2b')](function(_0xbd4fb1){logger[_0x3109('0x1d')]('[%s][DIALOGFLOW]\x20%s',_0x2e9874,_0xbd4fb1['message']);_0x36145f[_0x3109('0x2a')]();});}}catch(_0x3a184b){logger['error'](_0x3109('0x9'),_0x2e9874,JSON['stringify'](_0x3a184b));_0x36145f['stop']();}};}; \ No newline at end of file +var _0x3db6=['apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','getMustacheRender','create','then','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','providerName','providerResponse','Message','metadata','endConversation','catch','lodash','moment'];(function(_0x371feb,_0x6fdf8b){var _0x574aa9=function(_0x2175b5){while(--_0x2175b5){_0x371feb['push'](_0x371feb['shift']());}};_0x574aa9(++_0x6fdf8b);}(_0x3db6,0x14e));var _0x63db=function(_0x145e08,_0x21f70b){_0x145e08=_0x145e08-0x0;var _0x511c64=_0x3db6[_0x145e08];return _0x511c64;};'use strict';var _=require(_0x63db('0x0'));var moment=require(_0x63db('0x1'));var apiai=require(_0x63db('0x2'));var md5=require(_0x63db('0x3'));var utils=require(_0x63db('0x4'));var logger=require(_0x63db('0x5'))(_0x63db('0x6'));var rpc={'chatMessage':require(_0x63db('0x7')),'openchannelMessage':require(_0x63db('0x8')),'mailMessage':require(_0x63db('0x9')),'smsMessage':require(_0x63db('0xa')),'faxMessage':require(_0x63db('0xb')),'whatsappMessage':require(_0x63db('0xc'))};exports[_0x63db('0xd')]=function(_0x1d29af,_0x511e65){return function(_0x5bf8ca){try{if(!_[_0x63db('0xe')](this[_0x63db('0xf')][_0x63db('0x10')])){logger[_0x63db('0x11')](_0x63db('0x12'),_0x1d29af,_0x63db('0x13'));return _0x5bf8ca[_0x63db('0x14')]();}var _0x46123f={'ContactId':this[_0x63db('0x15')]['id'],'sentAt':moment()[_0x63db('0x16')](_0x63db('0x17')),'direction':_0x63db('0x18')};if(this['channel']===_0x63db('0x19')||this[_0x63db('0x1a')]===_0x63db('0x1b')){_0x46123f[_0x63db('0x1c')]=this[_0x63db('0xf')][_0x63db('0x1c')];}var _0x3a5475=this[_0x63db('0x1a')];if(_0x3a5475==='chat'){_0x46123f[_0x63db('0x1d')]=this[_0x63db('0x1e')]['id'];}else{_0x46123f[_[_0x63db('0x1f')](_0x3a5475)+_0x63db('0x20')]=this[_0x63db('0x1e')]['id'];}_0x46123f[_['upperFirst'](_0x3a5475)+_0x63db('0x21')]=this['interaction']['id'];if(this[_0x63db('0xf')]['created']){var _0x301942=_0x511e65[0x2];if(!_[_0x63db('0x22')](_0x301942)){_0x46123f[_0x63db('0x23')]=utils[_0x63db('0x24')](_0x301942,this);return rpc[_0x3a5475+'Message'][_0x63db('0x25')](_0x46123f)[_0x63db('0x26')](function(_0x3a54d3){logger[_0x63db('0x11')](_0x63db('0x12'),_0x1d29af,_0x46123f[_0x63db('0x23')]);})['catch'](function(_0x22255a){logger[_0x63db('0x27')](_0x63db('0x12'),_0x1d29af,JSON[_0x63db('0x28')](_0x22255a));})[_0x63db('0x29')](function(){logger[_0x63db('0x11')](_0x63db('0x2a'),_0x1d29af);_0x5bf8ca[_0x63db('0x2b')]();});}else{logger[_0x63db('0x11')](_0x63db('0x2c'),_0x1d29af);_0x5bf8ca[_0x63db('0x2b')]();}}else{var _0x15af86=this;var _0x410ba8=apiai(_0x511e65[0x0],{'language':_0x511e65[0x1]||'en'});return _0x410ba8[_0x63db('0x2d')](this[_0x63db('0x2e')][_0x63db('0x23')],{'sessionId':md5(this[_0x63db('0xf')]['id'])})[_0x63db('0x26')](function(_0x47867a){_0x15af86[_0x63db('0x23')][_0x63db('0x2f')]=_0x47867a;_0x46123f['body']=_0x47867a[_0x63db('0x30')][_0x63db('0x31')]['speech'];_0x46123f[_0x63db('0x32')]='dialogflow';_0x46123f[_0x63db('0x33')]=JSON[_0x63db('0x28')](_0x47867a);return rpc[_0x3a5475+_0x63db('0x34')]['create'](_0x46123f)[_0x63db('0x26')](function(_0x4be1b3){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x1d29af,_0x46123f[_0x63db('0x23')]);if(_0x47867a['result'][_0x63db('0x35')][_0x63db('0x36')]){_0x5bf8ca[_0x63db('0x14')]();}else{_0x5bf8ca['stop']();}})[_0x63db('0x37')](function(_0x1626ad){logger[_0x63db('0x27')]('[%s][DIALOGFLOW]\x20%s',_0x1d29af,JSON[_0x63db('0x28')](_0x1626ad));_0x5bf8ca[_0x63db('0x14')]();});})[_0x63db('0x37')](function(_0x2c60b7){logger[_0x63db('0x27')](_0x63db('0x12'),_0x1d29af,_0x2c60b7[_0x63db('0x2e')]);_0x5bf8ca[_0x63db('0x14')]();});}}catch(_0x59d533){logger['error'](_0x63db('0x12'),_0x1d29af,JSON['stringify'](_0x59d533));_0x5bf8ca['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 0787901..181e64b 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf60b=['SessionsClient','sessionPath','message','detectIntent','diagnosticInfo','fields','queryResult','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','isFallback','DIALOGFLOWV2_LANGUAGECODE','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','dialogflowV2','providerResponse','length','fulfillmentText','push','all','dialogflow','md5','moment','bluebird','../../../../config/logger','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','create','then','info','catch','error','stringify','isNil','UserId','[%s][DIALOGFLOWV2]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','interaction','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','Message','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace'];(function(_0xbe2d32,_0xc7312a){var _0x770cd1=function(_0x1b44ba){while(--_0x1b44ba){_0xbe2d32['push'](_0xbe2d32['shift']());}};_0x770cd1(++_0xc7312a);}(_0xf60b,0x183));var _0xbf60=function(_0x58eec7,_0x2353db){_0x58eec7=_0x58eec7-0x0;var _0x25c5d3=_0xf60b[_0x58eec7];return _0x25c5d3;};'use strict';var _=require('lodash');var dialogflow=require(_0xbf60('0x0'));var md5=require(_0xbf60('0x1'));var moment=require(_0xbf60('0x2'));var Promise=require(_0xbf60('0x3'));var logger=require(_0xbf60('0x4'))('routing');var utils=require(_0xbf60('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xbf60('0x6')),'mailMessage':require(_0xbf60('0x7')),'smsMessage':require(_0xbf60('0x8')),'faxMessage':require(_0xbf60('0x9')),'whatsappMessage':require(_0xbf60('0xa'))};function createMessage(_0x4430e3,_0x48dfc6,_0x5980bc,_0xa71139){return new Promise(function(_0x1256b0,_0x34e7ef){var _0x28325a=_[_0xbf60('0xb')](_0x5980bc);_0x28325a[_0xbf60('0xc')]=_0xa71139;return rpc[_0x48dfc6+'Message'][_0xbf60('0xd')](_0x28325a)[_0xbf60('0xe')](function(){logger[_0xbf60('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x4430e3,_0x28325a[_0xbf60('0xc')]);_0x1256b0();})[_0xbf60('0x10')](function(_0xae772e){logger[_0xbf60('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x4430e3,JSON[_0xbf60('0x12')](_0xae772e));_0x34e7ef(_0xae772e);});});}exports['consequence']=function(_0x286108,_0x29cc8c){return function(_0x5554c1){try{if(!_[_0xbf60('0x13')](this['interaction'][_0xbf60('0x14')])){logger['info'](_0xbf60('0x15'),_0x286108,_0xbf60('0x16'));return _0x5554c1[_0xbf60('0x17')]();}var _0x22ca80={'ContactId':this['contact']['id'],'sentAt':moment()[_0xbf60('0x18')](_0xbf60('0x19')),'direction':_0xbf60('0x1a')};if(this[_0xbf60('0x1b')]===_0xbf60('0x1c')||this[_0xbf60('0x1b')]===_0xbf60('0x1d')){_0x22ca80['phone']=this[_0xbf60('0x1e')][_0xbf60('0x1f')];}var _0x317b78=this[_0xbf60('0x1b')];if(_0x317b78===_0xbf60('0x20')){_0x22ca80[_0xbf60('0x21')]=this[_0xbf60('0x22')]['id'];}else{_0x22ca80[_[_0xbf60('0x23')](_0x317b78)+_0xbf60('0x24')]=this[_0xbf60('0x22')]['id'];}_0x22ca80[_[_0xbf60('0x23')](_0x317b78)+_0xbf60('0x25')]=this[_0xbf60('0x1e')]['id'];if(this[_0xbf60('0x1e')][_0xbf60('0x26')]){var _0x24a2f6=_0x29cc8c[0x4];if(!_['isEmpty'](_0x24a2f6)){_0x22ca80[_0xbf60('0xc')]=utils[_0xbf60('0x27')](_0x24a2f6,this);return rpc[_0x317b78+_0xbf60('0x28')][_0xbf60('0xd')](_0x22ca80)['then'](function(_0x51a69f){logger[_0xbf60('0xf')](_0xbf60('0x15'),_0x286108,_0x22ca80['body']);})['catch'](function(_0x487e1e){logger[_0xbf60('0x11')](_0xbf60('0x15'),_0x286108,JSON[_0xbf60('0x12')](_0x487e1e));})['finally'](function(){logger['info'](_0xbf60('0x29'),_0x286108);_0x5554c1['stop']();});}else{logger[_0xbf60('0xf')](_0xbf60('0x2a'),_0x286108);_0x5554c1[_0xbf60('0x2b')]();}}else{var _0x1420e0=this;var _0x3184c0=_0x29cc8c[0x2][_0xbf60('0x2c')](/\\n/g,'\x0a');var _0x5bd5a8={'credentials':{'private_key':_0x3184c0,'client_email':_0x29cc8c[0x1]}};var _0xe5313=new dialogflow[(_0xbf60('0x2d'))](_0x5bd5a8);var _0x4a0f73=_0xe5313[_0xbf60('0x2e')](_0x29cc8c[0x0],md5(_0x1420e0['interaction']['id']));var _0xea2270={'session':_0x4a0f73,'queryInput':{'text':{'text':_0x1420e0[_0xbf60('0x2f')][_0xbf60('0xc')],'languageCode':_0x29cc8c[0x3]||'en'}}};return _0xe5313[_0xbf60('0x30')](_0xea2270)['then'](function(_0x5646a0){if(_0x5646a0&&_0x5646a0['length']){_0x1420e0[_0xbf60('0xc')]['dialogflowV2']=_0x5646a0;var _0x2fffbb=_0x5646a0[0x0];var _0x38904d=_0x2fffbb['queryResult'][_0xbf60('0x31')]&&_0x2fffbb['queryResult'][_0xbf60('0x31')][_0xbf60('0x32')]?_0x2fffbb[_0xbf60('0x33')][_0xbf60('0x31')][_0xbf60('0x32')][_0xbf60('0x34')][_0xbf60('0x35')]:![];_0x1420e0['body'][_0xbf60('0x36')]=_0x2fffbb['queryResult'][_0xbf60('0x37')];_0x1420e0[_0xbf60('0xc')][_0xbf60('0x38')]=_0x2fffbb['queryResult']['allRequiredParamsPresent'];_0x1420e0[_0xbf60('0xc')][_0xbf60('0x39')]=_0x2fffbb[_0xbf60('0x33')][_0xbf60('0x31')]&&_0x2fffbb[_0xbf60('0x33')]['diagnosticInfo']['fields']?_0x2fffbb[_0xbf60('0x33')][_0xbf60('0x31')][_0xbf60('0x32')][_0xbf60('0x34')][_0xbf60('0x35')]:![];_0x1420e0['body'][_0xbf60('0x3a')]=_0x2fffbb['queryResult']['intent']['name'];_0x1420e0[_0xbf60('0xc')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x2fffbb[_0xbf60('0x33')][_0xbf60('0x3b')]['displayName'];_0x1420e0['body']['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x2fffbb[_0xbf60('0x33')][_0xbf60('0x3b')][_0xbf60('0x3c')];_0x1420e0['body'][_0xbf60('0x3d')]=_0x2fffbb[_0xbf60('0x33')]['languageCode'];_0x1420e0['body']['DIALOGFLOWV2_QUERYTEXT']=_0x2fffbb[_0xbf60('0x33')][_0xbf60('0x3e')];_0x1420e0[_0xbf60('0xc')][_0xbf60('0x3f')]=_0x2fffbb[_0xbf60('0x33')][_0xbf60('0x40')];_0x22ca80[_0xbf60('0x41')]=_0xbf60('0x42');_0x22ca80[_0xbf60('0x43')]=JSON[_0xbf60('0x12')](_0x5646a0);var _0x40d08f=[];for(var _0x1910c6=0x0;_0x1910c6<_0x5646a0[_0xbf60('0x44')];_0x1910c6++){var _0x396723=_0x5646a0[_0x1910c6];if(_0x396723&&_0x396723[_0xbf60('0x33')]&&_0x396723[_0xbf60('0x33')][_0xbf60('0x45')]){_0x40d08f[_0xbf60('0x46')](createMessage(_0x286108,_0x317b78,_0x22ca80,_0x396723[_0xbf60('0x33')][_0xbf60('0x45')]));}}return Promise[_0xbf60('0x47')](_0x40d08f)[_0xbf60('0xe')](function(){if(_0x38904d){_0x5554c1[_0xbf60('0x17')]();}else{_0x5554c1[_0xbf60('0x2b')]();}})['catch'](function(_0x435f3e){logger[_0xbf60('0x11')](_0xbf60('0x15'),_0x286108,JSON[_0xbf60('0x12')](_0x435f3e));_0x5554c1[_0xbf60('0x17')]();});}})['catch'](function(_0x34ccc9){logger[_0xbf60('0x11')](_0xbf60('0x15'),_0x286108,_0x34ccc9[_0xbf60('0x2f')]);_0x5554c1[_0xbf60('0x17')]();});}}catch(_0x5f2df9){logger[_0xbf60('0x11')](_0xbf60('0x15'),_0x286108,JSON['stringify'](_0x5f2df9));_0x5554c1[_0xbf60('0x2b')]();}};}; \ No newline at end of file +var _0xff4b=['created','isEmpty','getMustacheRender','create','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','intent','name','DIALOGFLOWV2_ISFALLBACKINTENT','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerName','providerResponse','push','fulfillmentText','all','next','dialogflow','md5','moment','bluebird','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','then','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','ChatWebsiteId','account','AccountId','InteractionId'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xff4b,0x1b5));var _0xbff4=function(_0x247c37,_0x4038e4){_0x247c37=_0x247c37-0x0;var _0x358eb4=_0xff4b[_0x247c37];return _0x358eb4;};'use strict';var _=require('lodash');var dialogflow=require(_0xbff4('0x0'));var md5=require(_0xbff4('0x1'));var moment=require(_0xbff4('0x2'));var Promise=require(_0xbff4('0x3'));var logger=require('../../../../config/logger')(_0xbff4('0x4'));var utils=require('./utils');var rpc={'chatMessage':require(_0xbff4('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xbff4('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xbff4('0x7')),'whatsappMessage':require(_0xbff4('0x8'))};function createMessage(_0xe6df83,_0x4fd7a8,_0x1d223e,_0x1f6b60){return new Promise(function(_0xc7482a,_0x5976e9){var _0x32c30b=_[_0xbff4('0x9')](_0x1d223e);_0x32c30b[_0xbff4('0xa')]=_0x1f6b60;return rpc[_0x4fd7a8+_0xbff4('0xb')]['create'](_0x32c30b)[_0xbff4('0xc')](function(){logger['info'](_0xbff4('0xd'),_0xe6df83,_0x32c30b[_0xbff4('0xa')]);_0xc7482a();})[_0xbff4('0xe')](function(_0x5a2544){logger[_0xbff4('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0xe6df83,JSON[_0xbff4('0x10')](_0x5a2544));_0x5976e9(_0x5a2544);});});}exports[_0xbff4('0x11')]=function(_0x2590af,_0x2d27e4){return function(_0x2f909d){try{if(!_[_0xbff4('0x12')](this[_0xbff4('0x13')][_0xbff4('0x14')])){logger[_0xbff4('0x15')]('[%s][DIALOGFLOWV2]\x20%s',_0x2590af,_0xbff4('0x16'));return _0x2f909d['next']();}var _0x1dd0d4={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0xbff4('0x17')),'direction':_0xbff4('0x18')};if(this[_0xbff4('0x19')]==='sms'||this[_0xbff4('0x19')]===_0xbff4('0x1a')){_0x1dd0d4[_0xbff4('0x1b')]=this[_0xbff4('0x13')][_0xbff4('0x1b')];}var _0x2a9ddf=this[_0xbff4('0x19')];if(_0x2a9ddf==='chat'){_0x1dd0d4[_0xbff4('0x1c')]=this[_0xbff4('0x1d')]['id'];}else{_0x1dd0d4[_['upperFirst'](_0x2a9ddf)+_0xbff4('0x1e')]=this[_0xbff4('0x1d')]['id'];}_0x1dd0d4[_['upperFirst'](_0x2a9ddf)+_0xbff4('0x1f')]=this['interaction']['id'];if(this[_0xbff4('0x13')][_0xbff4('0x20')]){var _0x582e33=_0x2d27e4[0x4];if(!_[_0xbff4('0x21')](_0x582e33)){_0x1dd0d4['body']=utils[_0xbff4('0x22')](_0x582e33,this);return rpc[_0x2a9ddf+_0xbff4('0xb')][_0xbff4('0x23')](_0x1dd0d4)[_0xbff4('0xc')](function(_0x5be7b1){logger[_0xbff4('0x15')]('[%s][DIALOGFLOWV2]\x20%s',_0x2590af,_0x1dd0d4[_0xbff4('0xa')]);})['catch'](function(_0x1f35fd){logger[_0xbff4('0xf')](_0xbff4('0xd'),_0x2590af,JSON[_0xbff4('0x10')](_0x1f35fd));})[_0xbff4('0x24')](function(){logger[_0xbff4('0x15')](_0xbff4('0x25'),_0x2590af);_0x2f909d[_0xbff4('0x26')]();});}else{logger[_0xbff4('0x15')](_0xbff4('0x27'),_0x2590af);_0x2f909d['stop']();}}else{var _0x1a7e2c=this;var _0x3ee03c=_0x2d27e4[0x2][_0xbff4('0x28')](/\\n/g,'\x0a');var _0x4e85c8={'credentials':{'private_key':_0x3ee03c,'client_email':_0x2d27e4[0x1]}};var _0x7cae=new dialogflow[(_0xbff4('0x29'))](_0x4e85c8);var _0x119423=_0x7cae['sessionPath'](_0x2d27e4[0x0],md5(_0x1a7e2c[_0xbff4('0x13')]['id']));var _0x29ff46={'session':_0x119423,'queryInput':{'text':{'text':_0x1a7e2c[_0xbff4('0x2a')]['body'],'languageCode':_0x2d27e4[0x3]||'en'}}};return _0x7cae[_0xbff4('0x2b')](_0x29ff46)[_0xbff4('0xc')](function(_0x432d52){if(_0x432d52&&_0x432d52[_0xbff4('0x2c')]){_0x1a7e2c['body'][_0xbff4('0x2d')]=_0x432d52;var _0x2d53d8=_0x432d52[0x0];var _0xd50373=_0x2d53d8[_0xbff4('0x2e')]['diagnosticInfo']&&_0x2d53d8[_0xbff4('0x2e')][_0xbff4('0x2f')][_0xbff4('0x30')]?_0x2d53d8[_0xbff4('0x2e')][_0xbff4('0x2f')][_0xbff4('0x30')][_0xbff4('0x31')][_0xbff4('0x32')]:![];_0x1a7e2c[_0xbff4('0xa')][_0xbff4('0x33')]=_0x2d53d8[_0xbff4('0x2e')]['action'];_0x1a7e2c[_0xbff4('0xa')][_0xbff4('0x34')]=_0x2d53d8[_0xbff4('0x2e')]['allRequiredParamsPresent'];_0x1a7e2c[_0xbff4('0xa')][_0xbff4('0x35')]=_0x2d53d8[_0xbff4('0x2e')][_0xbff4('0x2f')]&&_0x2d53d8[_0xbff4('0x2e')][_0xbff4('0x2f')]['fields']?_0x2d53d8['queryResult'][_0xbff4('0x2f')]['fields'][_0xbff4('0x31')][_0xbff4('0x32')]:![];_0x1a7e2c[_0xbff4('0xa')]['DIALOGFLOWV2_INTENTNAME']=_0x2d53d8[_0xbff4('0x2e')][_0xbff4('0x36')][_0xbff4('0x37')];_0x1a7e2c[_0xbff4('0xa')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x2d53d8['queryResult'][_0xbff4('0x36')]['displayName'];_0x1a7e2c[_0xbff4('0xa')][_0xbff4('0x38')]=_0x2d53d8[_0xbff4('0x2e')]['intent']['isFallback'];_0x1a7e2c[_0xbff4('0xa')]['DIALOGFLOWV2_LANGUAGECODE']=_0x2d53d8[_0xbff4('0x2e')][_0xbff4('0x39')];_0x1a7e2c[_0xbff4('0xa')][_0xbff4('0x3a')]=_0x2d53d8[_0xbff4('0x2e')][_0xbff4('0x3b')];_0x1a7e2c[_0xbff4('0xa')]['DIALOGFLOWV2_SCORE']=_0x2d53d8[_0xbff4('0x2e')][_0xbff4('0x3c')];_0x1dd0d4[_0xbff4('0x3d')]=_0xbff4('0x2d');_0x1dd0d4[_0xbff4('0x3e')]=JSON['stringify'](_0x432d52);var _0xa08643=[];for(var _0x5718c8=0x0;_0x5718c8<_0x432d52['length'];_0x5718c8++){var _0x3acb86=_0x432d52[_0x5718c8];if(_0x3acb86&&_0x3acb86[_0xbff4('0x2e')]&&_0x3acb86[_0xbff4('0x2e')]['fulfillmentText']){_0xa08643[_0xbff4('0x3f')](createMessage(_0x2590af,_0x2a9ddf,_0x1dd0d4,_0x3acb86[_0xbff4('0x2e')][_0xbff4('0x40')]));}}return Promise[_0xbff4('0x41')](_0xa08643)['then'](function(){if(_0xd50373){_0x2f909d[_0xbff4('0x42')]();}else{_0x2f909d[_0xbff4('0x26')]();}})[_0xbff4('0xe')](function(_0x1b0f40){logger[_0xbff4('0xf')](_0xbff4('0xd'),_0x2590af,JSON[_0xbff4('0x10')](_0x1b0f40));_0x2f909d[_0xbff4('0x42')]();});}})[_0xbff4('0xe')](function(_0x25960d){logger['error'](_0xbff4('0xd'),_0x2590af,_0x25960d[_0xbff4('0x2a')]);_0x2f909d[_0xbff4('0x42')]();});}}catch(_0x501eb7){logger[_0xbff4('0xf')](_0xbff4('0xd'),_0x2590af,JSON[_0xbff4('0x10')](_0x501eb7));_0x2f909d[_0xbff4('0x26')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 023b6db..37ff858 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x90fe=['[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stop','stringify','validate','lodash','html-to-text','./utils','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','join','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x90fe,0x138));var _0xe90f=function(_0x6ea431,_0x2c15e9){_0x6ea431=_0x6ea431-0x0;var _0x2e816f=_0x90fe[_0x6ea431];return _0x2e816f;};'use strict';var schema=require(_0xe90f('0x0'));var _=require(_0xe90f('0x1'));var htmlToText=require(_0xe90f('0x2'));var utils=require(_0xe90f('0x3'));var logger=require('../../../../config/logger')('routing');var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0xe90f('0x4')},'priorityTrue':{'type':_0xe90f('0x5'),'message':_0xe90f('0x6')},'priorityFalse':{'type':'number','message':_0xe90f('0x7')}});exports[_0xe90f('0x8')]=function(_0x3a400b,_0x256fc4){return function(_0x3ddf8d){try{var _0x1569af={'condition':htmlToText[_0xe90f('0x9')](utils[_0xe90f('0xa')](_0x256fc4[0x0],this),{'wordwrap':![]})[_0xe90f('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x256fc4[0x1],'priorityFalse':_0x256fc4[0x2]};var _0x9e53e=gotoif[_0xe90f('0x0')](_0x1569af,{'typecast':!![]});if(_0x9e53e[_0xe90f('0xc')]){logger[_0xe90f('0xd')](_0xe90f('0xe'),_0x3a400b,_['map'](_0x9e53e,'message')[_0xe90f('0xf')](',\x20'));_0x3ddf8d['stop']();}else{try{var _0x3a26f3=eval('('+_0x1569af[_0xe90f('0x10')]+')');var _0xa1cd59=_0x3a26f3?_0x1569af['priorityTrue']:_0x1569af[_0xe90f('0x11')];logger[_0xe90f('0x12')](_0xe90f('0x13'),_0x3a400b,_0x1569af[_0xe90f('0x10')],_0x3a26f3,_0xa1cd59||_0xe90f('0x14'));if(_0xa1cd59){var _0x550f8a=_[_0xe90f('0x15')](_0x3ddf8d['rules'](),{'p':_0xa1cd59});if(_0x550f8a>=0x0){logger[_0xe90f('0x12')](_0xe90f('0x16'),_0x3a400b,_0xa1cd59||_0xe90f('0x14'),_0x550f8a);_0x3ddf8d[_0xe90f('0x14')](_0x550f8a);}else{logger[_0xe90f('0x12')](_0xe90f('0x17'),_0x3a400b,_0xa1cd59||_0xe90f('0x14'));_0x3ddf8d['stop']();}}else{_0x3ddf8d[_0xe90f('0x14')]();}}catch(_0x3df267){logger['error'](_0xe90f('0x18'),_0x3a400b,_0x3df267[_0xe90f('0x19')]);_0x3ddf8d[_0xe90f('0x1a')]();}}}catch(_0x15f429){logger[_0xe90f('0xd')](_0xe90f('0xe'),_0x3a400b,JSON[_0xe90f('0x1b')](_0x15f429));_0x3ddf8d['stop']();}};}; \ No newline at end of file +var _0x2c69=['length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','replace'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0x2c69,0x1a7));var _0x92c6=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x2c69[_0x4e7d25];return _0x526fe6;};'use strict';var schema=require(_0x92c6('0x0'));var _=require(_0x92c6('0x1'));var htmlToText=require(_0x92c6('0x2'));var utils=require(_0x92c6('0x3'));var logger=require(_0x92c6('0x4'))(_0x92c6('0x5'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x92c6('0x6')},'priorityTrue':{'type':_0x92c6('0x7'),'message':_0x92c6('0x8')},'priorityFalse':{'type':_0x92c6('0x7'),'message':_0x92c6('0x9')}});exports['consequence']=function(_0x85d6a5,_0x1caac6){return function(_0x29719a){try{var _0x2958ae={'condition':htmlToText[_0x92c6('0xa')](utils['getMustacheRender'](_0x1caac6[0x0],this),{'wordwrap':![]})[_0x92c6('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1caac6[0x1],'priorityFalse':_0x1caac6[0x2]};var _0x23bfec=gotoif[_0x92c6('0x0')](_0x2958ae,{'typecast':!![]});if(_0x23bfec[_0x92c6('0xc')]){logger[_0x92c6('0xd')](_0x92c6('0xe'),_0x85d6a5,_[_0x92c6('0xf')](_0x23bfec,_0x92c6('0x10'))[_0x92c6('0x11')](',\x20'));_0x29719a[_0x92c6('0x12')]();}else{try{var _0x4e4d09=eval('('+_0x2958ae[_0x92c6('0x13')]+')');var _0x460104=_0x4e4d09?_0x2958ae[_0x92c6('0x14')]:_0x2958ae['priorityFalse'];logger['info'](_0x92c6('0x15'),_0x85d6a5,_0x2958ae[_0x92c6('0x13')],_0x4e4d09,_0x460104||_0x92c6('0x16'));if(_0x460104){var _0x21ad07=_[_0x92c6('0x17')](_0x29719a[_0x92c6('0x18')](),{'p':_0x460104});if(_0x21ad07>=0x0){logger['info'](_0x92c6('0x19'),_0x85d6a5,_0x460104||_0x92c6('0x16'),_0x21ad07);_0x29719a['next'](_0x21ad07);}else{logger[_0x92c6('0x1a')](_0x92c6('0x1b'),_0x85d6a5,_0x460104||_0x92c6('0x16'));_0x29719a['stop']();}}else{_0x29719a[_0x92c6('0x16')]();}}catch(_0xbc56ea){logger[_0x92c6('0xd')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x85d6a5,_0xbc56ea[_0x92c6('0x10')]);_0x29719a[_0x92c6('0x12')]();}}}catch(_0x23022b){logger[_0x92c6('0xd')](_0x92c6('0xe'),_0x85d6a5,JSON[_0x92c6('0x1c')](_0x23022b));_0x29719a[_0x92c6('0x12')]();}};}; \ 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 5ebd02a..2d3fdd5 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 _0x8a8a=['length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence'];(function(_0x42b202,_0x424a07){var _0x1aeee7=function(_0x7c9806){while(--_0x7c9806){_0x42b202['push'](_0x42b202['shift']());}};_0x1aeee7(++_0x424a07);}(_0x8a8a,0xaf));var _0xa8a8=function(_0x5ed36e,_0x18630f){_0x5ed36e=_0x5ed36e-0x0;var _0x16d657=_0x8a8a[_0x5ed36e];return _0x16d657;};'use strict';var schema=require('validate');var _=require(_0xa8a8('0x0'));var logger=require(_0xa8a8('0x1'))('routing');var gotop=schema({'priority':{'type':_0xa8a8('0x2'),'required':!![],'message':_0xa8a8('0x3')}});exports[_0xa8a8('0x4')]=function(_0x193200,_0x107054){return function(_0x2217b3){try{var _0x2a55f1={'priority':_0x107054[0x0]};var _0x25ad80=gotop['validate'](_0x2a55f1,{'typecast':!![]});if(_0x25ad80[_0xa8a8('0x5')]){logger[_0xa8a8('0x6')](_0xa8a8('0x7'),_0x193200,_[_0xa8a8('0x8')](_0x25ad80,_0xa8a8('0x9'))[_0xa8a8('0xa')](',\x20'));_0x2217b3[_0xa8a8('0xb')]();}else{logger[_0xa8a8('0xc')](_0xa8a8('0xd'),_0x193200,_0x2a55f1[_0xa8a8('0xe')]);if(_0x2a55f1['priority']){var _0x129ad9=_[_0xa8a8('0xf')](_0x2217b3[_0xa8a8('0x10')](),{'p':_0x2a55f1[_0xa8a8('0xe')]});if(_0x129ad9>=0x0){logger[_0xa8a8('0xc')](_0xa8a8('0x11'),_0x193200,_0x2a55f1[_0xa8a8('0xe')]||'next',_0x129ad9);_0x2217b3[_0xa8a8('0x12')](_0x129ad9);}else{logger[_0xa8a8('0xc')](_0xa8a8('0x13'),_0x193200,_0x2a55f1[_0xa8a8('0xe')]||'next');_0x2217b3[_0xa8a8('0xb')]();}}else{_0x2217b3[_0xa8a8('0x12')]();}}}catch(_0xc315d3){logger[_0xa8a8('0x6')]('[%s][GOTOP]\x20%s',_0x193200,JSON['stringify'](_0xc315d3));_0x2217b3['stop']();}};}; \ No newline at end of file +var _0xba3c=['error','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','stringify','validate','lodash','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length'];(function(_0x1773b8,_0x508e34){var _0x123602=function(_0x4a07e0){while(--_0x4a07e0){_0x1773b8['push'](_0x1773b8['shift']());}};_0x123602(++_0x508e34);}(_0xba3c,0x1d5));var _0xcba3=function(_0x522176,_0x497f70){_0x522176=_0x522176-0x0;var _0x279cdb=_0xba3c[_0x522176];return _0x279cdb;};'use strict';var schema=require(_0xcba3('0x0'));var _=require(_0xcba3('0x1'));var logger=require('../../../../config/logger')(_0xcba3('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xcba3('0x3')}});exports[_0xcba3('0x4')]=function(_0x453fa1,_0x1d8f51){return function(_0x309f54){try{var _0x2e0d42={'priority':_0x1d8f51[0x0]};var _0x198a5c=gotop[_0xcba3('0x0')](_0x2e0d42,{'typecast':!![]});if(_0x198a5c[_0xcba3('0x5')]){logger[_0xcba3('0x6')]('[%s][GOTOP]\x20%s',_0x453fa1,_[_0xcba3('0x7')](_0x198a5c,_0xcba3('0x8'))[_0xcba3('0x9')](',\x20'));_0x309f54[_0xcba3('0xa')]();}else{logger[_0xcba3('0xb')](_0xcba3('0xc'),_0x453fa1,_0x2e0d42[_0xcba3('0xd')]);if(_0x2e0d42['priority']){var _0x52dcb2=_[_0xcba3('0xe')](_0x309f54['rules'](),{'p':_0x2e0d42[_0xcba3('0xd')]});if(_0x52dcb2>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x453fa1,_0x2e0d42[_0xcba3('0xd')]||_0xcba3('0xf'),_0x52dcb2);_0x309f54[_0xcba3('0xf')](_0x52dcb2);}else{logger[_0xcba3('0xb')](_0xcba3('0x10'),_0x453fa1,_0x2e0d42[_0xcba3('0xd')]||_0xcba3('0xf'));_0x309f54['stop']();}}else{_0x309f54[_0xcba3('0xf')]();}}}catch(_0x30d21a){logger[_0xcba3('0x6')](_0xcba3('0x11'),_0x453fa1,JSON[_0xcba3('0x12')](_0x30d21a));_0x309f54[_0xcba3('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 8bb94bd..e1deb9c 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 _0x3c00=['../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','channel','chat','account','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','routing','../../rpc/openchannelMessage'];(function(_0x4de9e8,_0x565ffa){var _0x4db0de=function(_0x12279d){while(--_0x12279d){_0x4de9e8['push'](_0x4de9e8['shift']());}};_0x4db0de(++_0x565ffa);}(_0x3c00,0x135));var _0x03c0=function(_0x1b150a,_0x19e8b8){_0x1b150a=_0x1b150a-0x0;var _0x1cc157=_0x3c00[_0x1b150a];return _0x1cc157;};'use strict';var _=require(_0x03c0('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x03c0('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x03c0('0x2')),'mailMessage':require(_0x03c0('0x3')),'smsMessage':require(_0x03c0('0x4')),'faxMessage':require(_0x03c0('0x5')),'whatsappMessage':require(_0x03c0('0x6'))};exports[_0x03c0('0x7')]=function(_0x57afc6,_0xd7485b){return function(_0x553ccb){try{var _0x1d3119={'body':utils[_0x03c0('0x8')](_0xd7485b[0x0],this),'ContactId':this['contact']['id']};if(this[_0x03c0('0x9')]===_0x03c0('0xa')){_0x1d3119['ChatWebsiteId']=this[_0x03c0('0xb')]['id'];}else{_0x1d3119[_[_0x03c0('0xc')](this[_0x03c0('0x9')])+'AccountId']=this['account']['id'];}_0x1d3119[_[_0x03c0('0xc')](this['channel'])+_0x03c0('0xd')]=this[_0x03c0('0xe')]['id'];if(rpc[this[_0x03c0('0x9')]+_0x03c0('0xf')]){return rpc[this[_0x03c0('0x9')]+_0x03c0('0xf')][_0x03c0('0x10')](_0x1d3119)[_0x03c0('0x11')](function(_0x2216fc){logger[_0x03c0('0x12')](_0x03c0('0x13'),_0x57afc6,_0x1d3119[_0x03c0('0x14')]);_0x553ccb[_0x03c0('0x15')]();})[_0x03c0('0x16')](function(_0x2eef7e){logger[_0x03c0('0x17')](_0x03c0('0x13'),_0x57afc6,JSON[_0x03c0('0x18')](_0x2eef7e));_0x553ccb[_0x03c0('0x19')]();});}}catch(_0x5c6c6f){logger[_0x03c0('0x17')](_0x03c0('0x13'),_0x57afc6,JSON[_0x03c0('0x18')](_0x5c6c6f));_0x553ccb['stop']();}};}; \ No newline at end of file +var _0x07ea=['consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage'];(function(_0x2adae0,_0x4fa150){var _0x4bbb68=function(_0x5952bb){while(--_0x5952bb){_0x2adae0['push'](_0x2adae0['shift']());}};_0x4bbb68(++_0x4fa150);}(_0x07ea,0x69));var _0xa07e=function(_0x29e25c,_0x2d67ea){_0x29e25c=_0x29e25c-0x0;var _0x23bb56=_0x07ea[_0x29e25c];return _0x23bb56;};'use strict';var _=require(_0xa07e('0x0'));var utils=require(_0xa07e('0x1'));var logger=require('../../../../config/logger')(_0xa07e('0x2'));var rpc={'chatMessage':require(_0xa07e('0x3')),'openchannelMessage':require(_0xa07e('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xa07e('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xa07e('0x6'))};exports[_0xa07e('0x7')]=function(_0x45dffa,_0x568b39){return function(_0x352e0c){try{var _0x371729={'body':utils[_0xa07e('0x8')](_0x568b39[0x0],this),'ContactId':this[_0xa07e('0x9')]['id']};if(this[_0xa07e('0xa')]===_0xa07e('0xb')){_0x371729[_0xa07e('0xc')]=this[_0xa07e('0xd')]['id'];}else{_0x371729[_[_0xa07e('0xe')](this[_0xa07e('0xa')])+_0xa07e('0xf')]=this[_0xa07e('0xd')]['id'];}_0x371729[_[_0xa07e('0xe')](this[_0xa07e('0xa')])+_0xa07e('0x10')]=this['interaction']['id'];if(rpc[this[_0xa07e('0xa')]+_0xa07e('0x11')]){return rpc[this['channel']+_0xa07e('0x11')][_0xa07e('0x12')](_0x371729)[_0xa07e('0x13')](function(_0x1b3379){logger[_0xa07e('0x14')](_0xa07e('0x15'),_0x45dffa,_0x371729[_0xa07e('0x16')]);_0x352e0c[_0xa07e('0x17')]();})[_0xa07e('0x18')](function(_0x1662c8){logger[_0xa07e('0x19')](_0xa07e('0x15'),_0x45dffa,JSON[_0xa07e('0x1a')](_0x1662c8));_0x352e0c[_0xa07e('0x1b')]();});}}catch(_0x461aaf){logger['error'](_0xa07e('0x15'),_0x45dffa,JSON[_0xa07e('0x1a')](_0x461aaf));_0x352e0c[_0xa07e('0x1b')]();}};}; \ 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 01717fa..91bfa68 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 _0xe8b1=['info','getMustacheRender','error','[%s][NOOP]\x20%s','stringify','stop','../../../../config/logger'];(function(_0x899fda,_0x39e464){var _0x4ef383=function(_0x3a4de7){while(--_0x3a4de7){_0x899fda['push'](_0x899fda['shift']());}};_0x4ef383(++_0x39e464);}(_0xe8b1,0x18e));var _0x1e8b=function(_0x4f526c,_0x6c4dbe){_0x4f526c=_0x4f526c-0x0;var _0x38a51e=_0xe8b1[_0x4f526c];return _0x38a51e;};'use strict';var utils=require('./utils');var logger=require(_0x1e8b('0x0'))('routing');exports['consequence']=function(_0x4067b2,_0x584cb5){return function(_0x76772c){try{logger[_0x1e8b('0x1')]('[%s][NOOP]\x20%s',_0x4067b2,utils[_0x1e8b('0x2')](_0x584cb5[0x0],this));_0x76772c['next']();}catch(_0x33d0e4){logger[_0x1e8b('0x3')](_0x1e8b('0x4'),_0x4067b2,JSON[_0x1e8b('0x5')](_0x33d0e4));_0x76772c[_0x1e8b('0x6')]();}};}; \ No newline at end of file +var _0xafa7=['error','stringify','stop','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next'];(function(_0x5a02e6,_0x1d825c){var _0x121785=function(_0x3f93f3){while(--_0x3f93f3){_0x5a02e6['push'](_0x5a02e6['shift']());}};_0x121785(++_0x1d825c);}(_0xafa7,0xdf));var _0x7afa=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0xafa7[_0x29db36];return _0x234e87;};'use strict';var utils=require(_0x7afa('0x0'));var logger=require(_0x7afa('0x1'))(_0x7afa('0x2'));exports[_0x7afa('0x3')]=function(_0x95651,_0x458fc7){return function(_0x5ceeff){try{logger[_0x7afa('0x4')](_0x7afa('0x5'),_0x95651,utils[_0x7afa('0x6')](_0x458fc7[0x0],this));_0x5ceeff[_0x7afa('0x7')]();}catch(_0x4a07fa){logger[_0x7afa('0x8')](_0x7afa('0x5'),_0x95651,JSON[_0x7afa('0x9')](_0x4a07fa));_0x5ceeff[_0x7afa('0xa')]();}};}; \ 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 ad0f495..59ea9cb 100644 --- a/server/services/routing/server/applications/queue.js +++ b/server/services/routing/server/applications/queue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['beepall','log','stack','validate','util','seq-queue','moment','../../../../config/logger','./strategy','redis','defaults','localhost','queue_id','account','queue','from','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','MessageId','message','channel','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','find','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','next','strategy','rrmemory'];(function(_0x53b53e,_0x498437){var _0xbb6179=function(_0x3975eb){while(--_0x3975eb){_0x53b53e['push'](_0x53b53e['shift']());}};_0xbb6179(++_0x498437);}(_0x3e74,0x175));var _0x43e7=function(_0x173737,_0x1550d1){_0x173737=_0x173737-0x0;var _0x2cf9b0=_0x3e74[_0x173737];return _0x2cf9b0;};'use strict';var schema=require(_0x43e7('0x0'));var _=require('lodash');var util=require(_0x43e7('0x1'));var seqqueue=require(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('routing');var strategy=require(_0x43e7('0x5'));config[_0x43e7('0x6')]=_[_0x43e7('0x7')](config[_0x43e7('0x6')],{'host':_0x43e7('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x43e7('0x6')]));var attributes=['id',_0x43e7('0x9'),_0x43e7('0xa'),_0x43e7('0xb'),_0x43e7('0xc'),'joinAt'];function emit(_0x212c6c,_0x554d44,_0x54948c){io['to'](_0x212c6c)[_0x43e7('0xd')](_0x554d44,_0x54948c);}function emitChannelQueueInteraction(_0x4139c9,_0x5c34f4,_0x2803d9,_0x513707,_0xf7c520,_0x37302c,_0x4ebc8e,_0x3eb206){var _0xc960ea=_[_0x43e7('0xe')](_0x2803d9);_0xc960ea[_0x43e7('0x9')]=_0x3eb206;_0xc960ea['queue']=_0x5c34f4;_0xc960ea['account']=_0x513707;_0xc960ea['id']=_0xf7c520;if(_0x37302c){_0x4ebc8e[util[_0x43e7('0xf')](_0x43e7('0x10'),_0x4139c9)][_0xf7c520]=_[_0x43e7('0x11')](_0xc960ea,attributes);}else{delete _0x4ebc8e[util['format']('%sQueuesWaitingInteractions',_0x4139c9)][_0xf7c520];}emit(util[_0x43e7('0xf')](_0x43e7('0x12'),_0x4139c9,_0x5c34f4),util[_0x43e7('0xf')](_0x43e7('0x13'),_0x4139c9,_0x37302c?'save':'remove'),_[_0x43e7('0x11')](_0xc960ea,attributes));}var rpc={'openchannelQueueReport':require(_0x43e7('0x14')),'mailQueueReport':require(_0x43e7('0x15')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x43e7('0x16')),'whatsappQueueReport':require(_0x43e7('0x17'))};var queue=schema({'name':{'type':_0x43e7('0x18'),'required':!![],'message':_0x43e7('0x19')},'timeout':{'type':_0x43e7('0x1a'),'message':_0x43e7('0x1b')}});function startRouting(_0x619236,_0x1441ef,_0x2377a3,_0xab63cf){if(_0x619236&&_0x1441ef&&_0x2377a3){_0x1441ef[_0x43e7('0x1c')]+=0x1;var _0x177ee1={'uniqueid':_0x619236,'from':_0x2377a3['body']?_0x2377a3[_0x43e7('0x1d')][_0x43e7('0xc')]:'','joinAt':moment()['format'](_0x43e7('0x1e')),'ContactId':_0x2377a3[_0x43e7('0x1f')]?_0x2377a3[_0x43e7('0x1f')]['id']:null,'ListId':_0x2377a3[_0x43e7('0x20')]?_0x2377a3[_0x43e7('0x20')]['id']:null};_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x22')]=_0x1441ef['id']||null;_0x177ee1[_['upperFirst'](_0x2377a3['channel'])+_0x43e7('0x23')]=_0x2377a3[_0x43e7('0x24')]?_0x2377a3['interaction']['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x25')]=_0x2377a3['message']?_0x2377a3[_0x43e7('0x26')]['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3[_0x43e7('0x27')])+(_0x2377a3[_0x43e7('0x27')]!=='chat'?'AccountId':_0x43e7('0x28'))]=_0x2377a3['account']?_0x2377a3[_0x43e7('0xa')]['id']:null;logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x2a'),_0x619236,_0x1441ef['name']));emitChannelQueueInteraction(_0x2377a3[_0x43e7('0x27')],_0x1441ef[_0x43e7('0x2b')],_0x177ee1,_0x2377a3[_0x43e7('0xa')][_0x43e7('0x2b')],_0x2377a3[_0x43e7('0x26')]['id'],!![],_0xab63cf,_0x1441ef['id']);if(rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')]){return rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x2d')](_0x177ee1)[_0x43e7('0x2e')](function(_0x19725a){logger[_0x43e7('0x2f')](_0x43e7('0x30'));});}}}function stopRouting(_0x4bdb17,_0x238321,_0x44f6b0,_0x3b8f78){if(_0x4bdb17&&_0x238321){_0x238321[_0x43e7('0x1c')]-=0x1;var _0x4251c8={'leaveAt':moment()['format'](_0x43e7('0x1e')),'acceptAt':moment()[_0x43e7('0xf')](_0x43e7('0x1e')),'reason':_0x43e7('0x31')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x4bdb17,_0x238321[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x44f6b0[_0x43e7('0x27')],_0x238321[_0x43e7('0x2b')],_0x44f6b0[_0x43e7('0x1d')],_0x44f6b0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x44f6b0['message']['id'],![],_0x3b8f78,_0x238321['id']);if(rpc[_0x44f6b0['channel']+'QueueReport']){return rpc[_0x44f6b0['channel']+'QueueReport']['update'](_0x4bdb17,_0x4251c8)['catch'](function(_0x14d888){logger['error'](_0x43e7('0x32'));});}}}function endRouting(_0x8e9f40,_0x31bc78,_0x50a2d0,_0x40f72f){if(_0x8e9f40&&_0x31bc78){_0x31bc78[_0x43e7('0x1c')]-=0x1;var _0x101d45={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x43e7('0x1e')),'reason':_0x43e7('0x33')};logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x34'),_0x8e9f40,_0x31bc78[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x50a2d0[_0x43e7('0x27')],_0x31bc78[_0x43e7('0x2b')],_0x50a2d0['body'],_0x50a2d0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x50a2d0['message']['id'],![],_0x40f72f);if(rpc[_0x50a2d0[_0x43e7('0x27')]+'QueueReport']){return rpc[_0x50a2d0[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x35')](_0x8e9f40,_0x101d45)[_0x43e7('0x2e')](function(_0x35ac85){logger[_0x43e7('0x2f')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x574a93){return function(_0x30dfa9){return _0x30dfa9[_0x43e7('0x2b')][_0x43e7('0x36')]()===_0x574a93[_0x43e7('0x36')]();};}exports[_0x43e7('0x37')]=function(_0x4a4a85,_0x32a451,_0x4227c4,_0x575439){return function(_0x3628e0){try{var _0x51a69c={'name':_0x32a451[0x0],'timeout':_0x32a451[0x1]};var _0x2ad8ef=queue['validate'](_0x51a69c,{'typecast':!![]});if(_0x2ad8ef[_0x43e7('0x38')]){logger[_0x43e7('0x2f')](_0x43e7('0x39'),_0x4a4a85,_[_0x43e7('0x3a')](_0x2ad8ef,'message')['join'](',\x20'));_0x3628e0[_0x43e7('0x3b')]();}else{var _0x40c509=_[_0x43e7('0x3c')](_0x4227c4[_0x575439[_0x43e7('0x27')]+'Queues'],handleFindQueue(_0x51a69c['name']));if(_0x40c509){startRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);var _0x5dd988=(_0x40c509[_0x43e7('0x33')]||0xa)*0x3e8;var _0x57f5d0=(_0x51a69c[_0x43e7('0x33')]||0x14)*0x3e8;var _0x4b3a59,_0x5b28db;if(_0x5dd988>_0x57f5d0){_0x57f5d0=_0x5dd988;}var _0x46b2e6=seqqueue['createQueue'](_0x5dd988);_0x46b2e6['id']=_0x4a4a85;_0x46b2e6[_0x43e7('0x3d')]=_0x5dd988;_0x46b2e6[_0x43e7('0x3e')]=_0x57f5d0;_0x46b2e6[_0x43e7('0x27')]=_0x575439[_0x43e7('0x27')];_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x3f'),function(){logger[_0x43e7('0x29')](_0x43e7('0x40'),_0x4a4a85);stopRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x4b3a59=undefined;_0x46b2e6[_0x43e7('0x41')](!![]);if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}_0x3628e0['stop']();});_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x43'),function(){if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}});_0x4b3a59=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x4a4a85);endRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x46b2e6['close'](!![]);_0x3628e0[_0x43e7('0x44')]();},_0x57f5d0);switch(_0x40c509[_0x43e7('0x45')]){case'rrmemory':strategy[_0x43e7('0x46')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);break;default:strategy[_0x43e7('0x47')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);}}else{logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4a4a85,_0x51a69c['name']);_0x3628e0['stop']();}}}catch(_0x4de644){console[_0x43e7('0x48')](_0x4de644);logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20%s',_0x4a4a85,_0x4de644[_0x43e7('0x49')]);_0x3628e0[_0x43e7('0x3b')]();}};}; \ No newline at end of file +var _0x008c=['contact','list','upperFirst','QueueId','InteractionId','interaction','message','channel','info','[%s][START:QUEUE][NAME:%s]','name','account','QueueReport','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','body','update','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','find','timeout','createQueue','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','rrmemory','beepall','log','stack','validate','lodash','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','queue','clone','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1c8537,_0x3c92c2){var _0x3947d7=function(_0x565ba5){while(--_0x565ba5){_0x1c8537['push'](_0x1c8537['shift']());}};_0x3947d7(++_0x3c92c2);}(_0x008c,0x188));var _0xc008=function(_0x2f037f,_0x2958c5){_0x2f037f=_0x2f037f-0x0;var _0x2d1573=_0x008c[_0x2f037f];return _0x2d1573;};'use strict';var schema=require(_0xc008('0x0'));var _=require(_0xc008('0x1'));var util=require(_0xc008('0x2'));var seqqueue=require(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var Redis=require('ioredis');var config=require(_0xc008('0x5'));var logger=require(_0xc008('0x6'))(_0xc008('0x7'));var strategy=require(_0xc008('0x8'));config[_0xc008('0x9')]=_[_0xc008('0xa')](config[_0xc008('0x9')],{'host':_0xc008('0xb'),'port':0x18eb});var io=require(_0xc008('0xc'))(new Redis(config['redis']));var attributes=['id',_0xc008('0xd'),'account',_0xc008('0xe'),'from','joinAt'];function emit(_0x27830d,_0x7231b4,_0x57c46d){io['to'](_0x27830d)['emit'](_0x7231b4,_0x57c46d);}function emitChannelQueueInteraction(_0x543eb8,_0x1eacfa,_0xc881aa,_0x5b2004,_0xae2dab,_0x332fd4,_0x2ea200,_0x2a5b4e){var _0x9ffa93=_[_0xc008('0xf')](_0xc881aa);_0x9ffa93[_0xc008('0xd')]=_0x2a5b4e;_0x9ffa93['queue']=_0x1eacfa;_0x9ffa93['account']=_0x5b2004;_0x9ffa93['id']=_0xae2dab;if(_0x332fd4){_0x2ea200[util[_0xc008('0x10')]('%sQueuesWaitingInteractions',_0x543eb8)][_0xae2dab]=_[_0xc008('0x11')](_0x9ffa93,attributes);}else{delete _0x2ea200[util[_0xc008('0x10')](_0xc008('0x12'),_0x543eb8)][_0xae2dab];}emit(util[_0xc008('0x10')](_0xc008('0x13'),_0x543eb8,_0x1eacfa),util['format']('%s_queue_waiting_interaction:%s',_0x543eb8,_0x332fd4?'save':_0xc008('0x14')),_[_0xc008('0x11')](_0x9ffa93,attributes));}var rpc={'openchannelQueueReport':require(_0xc008('0x15')),'mailQueueReport':require(_0xc008('0x16')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xc008('0x17'),'required':!![],'message':_0xc008('0x18')},'timeout':{'type':'number','message':_0xc008('0x19')}});function startRouting(_0x5906e6,_0x4bd611,_0x543e5d,_0x50261c){if(_0x5906e6&&_0x4bd611&&_0x543e5d){_0x4bd611[_0xc008('0x1a')]+=0x1;var _0x4b9726={'uniqueid':_0x5906e6,'from':_0x543e5d['body']?_0x543e5d['body']['from']:'','joinAt':moment()['format'](_0xc008('0x1b')),'ContactId':_0x543e5d[_0xc008('0x1c')]?_0x543e5d[_0xc008('0x1c')]['id']:null,'ListId':_0x543e5d[_0xc008('0x1d')]?_0x543e5d[_0xc008('0x1d')]['id']:null};_0x4b9726[_[_0xc008('0x1e')](_0x543e5d['channel'])+_0xc008('0x1f')]=_0x4bd611['id']||null;_0x4b9726[_['upperFirst'](_0x543e5d['channel'])+_0xc008('0x20')]=_0x543e5d[_0xc008('0x21')]?_0x543e5d[_0xc008('0x21')]['id']:null;_0x4b9726[_[_0xc008('0x1e')](_0x543e5d['channel'])+'MessageId']=_0x543e5d['message']?_0x543e5d[_0xc008('0x22')]['id']:null;_0x4b9726[_[_0xc008('0x1e')](_0x543e5d[_0xc008('0x23')])+(_0x543e5d[_0xc008('0x23')]!=='chat'?'AccountId':'WebsiteId')]=_0x543e5d['account']?_0x543e5d['account']['id']:null;logger[_0xc008('0x24')](util[_0xc008('0x10')](_0xc008('0x25'),_0x5906e6,_0x4bd611['name']));emitChannelQueueInteraction(_0x543e5d[_0xc008('0x23')],_0x4bd611[_0xc008('0x26')],_0x4b9726,_0x543e5d[_0xc008('0x27')][_0xc008('0x26')],_0x543e5d['message']['id'],!![],_0x50261c,_0x4bd611['id']);if(rpc[_0x543e5d[_0xc008('0x23')]+_0xc008('0x28')]){return rpc[_0x543e5d['channel']+'QueueReport']['create'](_0x4b9726)[_0xc008('0x29')](function(_0x267abd){logger[_0xc008('0x2a')](_0xc008('0x2b'));});}}}function stopRouting(_0x1de04b,_0xceebc3,_0x294f97,_0x22d8e8){if(_0x1de04b&&_0xceebc3){_0xceebc3[_0xc008('0x1a')]-=0x1;var _0x2b862d={'leaveAt':moment()[_0xc008('0x10')](_0xc008('0x1b')),'acceptAt':moment()['format'](_0xc008('0x1b')),'reason':_0xc008('0x2c')};logger['info'](util[_0xc008('0x10')](_0xc008('0x2d'),_0x1de04b,_0xceebc3[_0xc008('0x26')]));emitChannelQueueInteraction(_0x294f97[_0xc008('0x23')],_0xceebc3[_0xc008('0x26')],_0x294f97[_0xc008('0x2e')],_0x294f97[_0xc008('0x27')][_0xc008('0x26')],_0x294f97[_0xc008('0x22')]['id'],![],_0x22d8e8,_0xceebc3['id']);if(rpc[_0x294f97['channel']+_0xc008('0x28')]){return rpc[_0x294f97[_0xc008('0x23')]+_0xc008('0x28')][_0xc008('0x2f')](_0x1de04b,_0x2b862d)[_0xc008('0x29')](function(_0x315562){logger[_0xc008('0x2a')]('update\x20queue\x20report');});}}}function endRouting(_0x35f360,_0x21763f,_0x50e1d4,_0x399b64){if(_0x35f360&&_0x21763f){_0x21763f[_0xc008('0x1a')]-=0x1;var _0x5e38d5={'leaveAt':moment()[_0xc008('0x10')](_0xc008('0x1b')),'exitAt':moment()[_0xc008('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger['info'](util[_0xc008('0x10')]('[%s][END:QUEUE][NAME:%s]',_0x35f360,_0x21763f[_0xc008('0x26')]));emitChannelQueueInteraction(_0x50e1d4[_0xc008('0x23')],_0x21763f[_0xc008('0x26')],_0x50e1d4[_0xc008('0x2e')],_0x50e1d4[_0xc008('0x27')][_0xc008('0x26')],_0x50e1d4[_0xc008('0x22')]['id'],![],_0x399b64);if(rpc[_0x50e1d4[_0xc008('0x23')]+_0xc008('0x28')]){return rpc[_0x50e1d4[_0xc008('0x23')]+_0xc008('0x28')][_0xc008('0x2f')](_0x35f360,_0x5e38d5)[_0xc008('0x29')](function(_0x2bf3fd){logger['error'](_0xc008('0x30'));});}}}function handleFindQueue(_0x23c4db){return function(_0x30b7df){return _0x30b7df[_0xc008('0x26')]['toLowerCase']()===_0x23c4db[_0xc008('0x31')]();};}exports[_0xc008('0x32')]=function(_0xc8cb91,_0x36e7ae,_0x2d142d,_0x5706bb){return function(_0x398cdd){try{var _0x3323f4={'name':_0x36e7ae[0x0],'timeout':_0x36e7ae[0x1]};var _0x3794b0=queue[_0xc008('0x0')](_0x3323f4,{'typecast':!![]});if(_0x3794b0[_0xc008('0x33')]){logger['error'](_0xc008('0x34'),_0xc8cb91,_[_0xc008('0x35')](_0x3794b0,_0xc008('0x22'))[_0xc008('0x36')](',\x20'));_0x398cdd['stop']();}else{var _0x26cd05=_[_0xc008('0x37')](_0x2d142d[_0x5706bb[_0xc008('0x23')]+'Queues'],handleFindQueue(_0x3323f4[_0xc008('0x26')]));if(_0x26cd05){startRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);var _0x49a176=(_0x26cd05[_0xc008('0x38')]||0xa)*0x3e8;var _0x5d3a72=(_0x3323f4[_0xc008('0x38')]||0x14)*0x3e8;var _0x213014,_0x5a5d85;if(_0x49a176>_0x5d3a72){_0x5d3a72=_0x49a176;}var _0x31007c=seqqueue[_0xc008('0x39')](_0x49a176);_0x31007c['id']=_0xc8cb91;_0x31007c[_0xc008('0x3a')]=_0x49a176;_0x31007c['qtimeout']=_0x5d3a72;_0x31007c[_0xc008('0x23')]=_0x5706bb[_0xc008('0x23')];_0x2d142d[_0xc008('0x3b')][_0xc8cb91]['on'](_0xc008('0x3c'),function(){logger[_0xc008('0x24')](_0xc008('0x3d'),_0xc8cb91);stopRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);clearTimeout(_0x213014);_0x213014=undefined;_0x31007c['close'](!![]);if(_0x2d142d['rules'][_0xc8cb91]){delete _0x2d142d['rules'][_0xc8cb91];}_0x398cdd[_0xc008('0x3e')]();});_0x2d142d[_0xc008('0x3b')][_0xc8cb91]['on'](_0xc008('0x3f'),function(){if(_0x2d142d[_0xc008('0x3b')][_0xc8cb91]){delete _0x2d142d[_0xc008('0x3b')][_0xc8cb91];}});_0x213014=setTimeout(function(){logger[_0xc008('0x24')](_0xc008('0x40'),_0xc8cb91);endRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);clearTimeout(_0x213014);_0x31007c[_0xc008('0x41')](!![]);_0x398cdd['next']();},_0x5d3a72);switch(_0x26cd05['strategy']){case'rrmemory':strategy[_0xc008('0x42')](_0x31007c,_0x26cd05,_0x2d142d,_0x5706bb);break;default:strategy[_0xc008('0x43')](_0x31007c,_0x26cd05,_0x2d142d,_0x5706bb);}}else{logger[_0xc008('0x2a')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0xc8cb91,_0x3323f4[_0xc008('0x26')]);_0x398cdd[_0xc008('0x3e')]();}}}catch(_0x17ab1a){console[_0xc008('0x44')](_0x17ab1a);logger[_0xc008('0x2a')](_0xc008('0x34'),_0xc8cb91,_0x17ab1a[_0xc008('0x45')]);_0x398cdd[_0xc008('0x3e')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 8196569..7930c31 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 _0xcc66=['agents','forcedOwnership','isAgentAvailable','channel','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','busy','busyQueue','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','agent','realtime','squeue','push','handleRun','handleTimeout','bind','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil'];(function(_0x389569,_0x53297b){var _0xde2b5b=function(_0x52c9a1){while(--_0x52c9a1){_0x389569['push'](_0x389569['shift']());}};_0xde2b5b(++_0x53297b);}(_0xcc66,0x163));var _0x6cc6=function(_0x1c56b1,_0x12b079){_0x1c56b1=_0x1c56b1-0x0;var _0x137e84=_0xcc66[_0x1c56b1];return _0x137e84;};'use strict';var _=require(_0x6cc6('0x0'));var uuid=require(_0x6cc6('0x1'));var util=require(_0x6cc6('0x2'));var logger=require(_0x6cc6('0x3'))(_0x6cc6('0x4'));var Agent=function(_0x221f22,_0x3b5d6a,_0xfd5ed,_0x144747){this[_0x6cc6('0x5')]=uuid['v4']();this['squeue']=_0x221f22;this[_0x6cc6('0x6')]=_0x3b5d6a;this[_0x6cc6('0x7')]=_0xfd5ed;this[_0x6cc6('0x4')]=_0x144747;this[_0x6cc6('0x8')][_0x6cc6('0x9')](this[_0x6cc6('0xa')]['bind'](this),this[_0x6cc6('0xb')][_0x6cc6('0xc')](this));this[_0x6cc6('0x8')]['on']('timeout',this['handleTimeout']['bind'](this));this[_0x6cc6('0x8')]['on'](_0x6cc6('0xd'),this[_0x6cc6('0xe')]['bind'](this));};Agent[_0x6cc6('0xf')]['push']=function(){this[_0x6cc6('0x8')][_0x6cc6('0x9')](this[_0x6cc6('0xa')][_0x6cc6('0xc')](this),this[_0x6cc6('0xb')][_0x6cc6('0xc')](this));};Agent['prototype'][_0x6cc6('0xe')]=function(){this[_0x6cc6('0xb')](!![]);};Agent[_0x6cc6('0xf')][_0x6cc6('0xa')]=function(_0x44513d){logger[_0x6cc6('0x10')](_0x6cc6('0x11'),this['squeue']['id'],this['agent']['id']);if(_[_0x6cc6('0x12')](this[_0x6cc6('0x7')][_0x6cc6('0x13')][this[_0x6cc6('0x6')]['id']])){logger[_0x6cc6('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x6cc6('0x6')]['id']);setTimeout(this[_0x6cc6('0x9')]['bind'](this),0x3e8);}else{if(this['routing'][_0x6cc6('0x14')]||util[_0x6cc6('0x15')](this[_0x6cc6('0x8')]['id'],this[_0x6cc6('0x7')]['agents'][this['agent']['id']],this['squeue'][_0x6cc6('0x16')],![])){this[_0x6cc6('0x7')][_0x6cc6('0x13')][this[_0x6cc6('0x6')]['id']]['busy']=!![];this[_0x6cc6('0x7')][_0x6cc6('0x13')][this[_0x6cc6('0x6')]['id']]['busyQueue']=undefined;util['showNotification'](this['notificationId'],this['squeue']['id'],this[_0x6cc6('0x7')][_0x6cc6('0x13')][this[_0x6cc6('0x6')]['id']],null,this[_0x6cc6('0x4')]);util[_0x6cc6('0x17')](this['squeue']['id'],this[_0x6cc6('0x7')][_0x6cc6('0x13')][this['agent']['id']],_0x6cc6('0x18')+(this[_0x6cc6('0x4')]['forcedOwnership']?_0x6cc6('0x19'):''));}else{logger['info'](_0x6cc6('0x1a'),this[_0x6cc6('0x8')]['id'],this[_0x6cc6('0x6')]['id']);setTimeout(this[_0x6cc6('0x9')][_0x6cc6('0xc')](this),0x3e8);}}};Agent[_0x6cc6('0xf')][_0x6cc6('0xb')]=function(_0x4f9234){if(_[_0x6cc6('0x12')](this[_0x6cc6('0x7')][_0x6cc6('0x13')][this[_0x6cc6('0x6')]['id']])){return logger[_0x6cc6('0x10')](_0x6cc6('0x1b'),this['squeue']['id'],this[_0x6cc6('0x6')]['id']);}else{logger[_0x6cc6('0x10')](_0x6cc6('0x1c'),this[_0x6cc6('0x8')]['id'],this[_0x6cc6('0x6')]['id']);util['hideNotification'](this[_0x6cc6('0x5')],this[_0x6cc6('0x8')]['id'],this[_0x6cc6('0x7')]['agents'][this[_0x6cc6('0x6')]['id']],null,this['routing']);this['realtime']['agents'][this['agent']['id']][_0x6cc6('0x1d')]=![];this[_0x6cc6('0x7')][_0x6cc6('0x13')][this['agent']['id']][_0x6cc6('0x1e')]=undefined;util[_0x6cc6('0x17')](this[_0x6cc6('0x8')]['id'],this[_0x6cc6('0x7')][_0x6cc6('0x13')][this[_0x6cc6('0x6')]['id']],_0x4f9234?_0x6cc6('0x1f'):_0x6cc6('0x20'));}if(!_0x4f9234){setTimeout(this[_0x6cc6('0x9')]['bind'](this),0x3e8);}};function agent(_0xf1746,_0x41d3f8,_0x26d7d2,_0x20d2a0){return new Agent(_0xf1746,_0x41d3f8,_0x26d7d2,_0x20d2a0);}module[_0x6cc6('0x21')]=agent; \ No newline at end of file +var _0x0f54=['notificationId','squeue','agent','push','bind','timeout','handleTimeout','handleDrained','prototype','handleRun','info','[%s][AGENT]\x20try\x20with\x20%s','agents','realtime','busy','busyQueue','showNotification','writeLog','RINGING','forcedOwnership','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','exports','lodash','uuid','../../../../../config/logger','routing'];(function(_0x44a85f,_0x3322b0){var _0x27676c=function(_0x41de41){while(--_0x41de41){_0x44a85f['push'](_0x44a85f['shift']());}};_0x27676c(++_0x3322b0);}(_0x0f54,0x13b));var _0x40f5=function(_0x1680a8,_0xdc661e){_0x1680a8=_0x1680a8-0x0;var _0x534303=_0x0f54[_0x1680a8];return _0x534303;};'use strict';var _=require(_0x40f5('0x0'));var uuid=require(_0x40f5('0x1'));var util=require('./util');var logger=require(_0x40f5('0x2'))(_0x40f5('0x3'));var Agent=function(_0x453f44,_0xc153fb,_0x6adc47,_0x168da7){this[_0x40f5('0x4')]=uuid['v4']();this[_0x40f5('0x5')]=_0x453f44;this[_0x40f5('0x6')]=_0xc153fb;this['realtime']=_0x6adc47;this['routing']=_0x168da7;this[_0x40f5('0x5')][_0x40f5('0x7')](this['handleRun'][_0x40f5('0x8')](this),this['handleTimeout'][_0x40f5('0x8')](this));this['squeue']['on'](_0x40f5('0x9'),this[_0x40f5('0xa')]['bind'](this));this['squeue']['on']('drained',this[_0x40f5('0xb')][_0x40f5('0x8')](this));};Agent[_0x40f5('0xc')][_0x40f5('0x7')]=function(){this[_0x40f5('0x5')]['push'](this[_0x40f5('0xd')][_0x40f5('0x8')](this),this['handleTimeout'][_0x40f5('0x8')](this));};Agent[_0x40f5('0xc')][_0x40f5('0xb')]=function(){this[_0x40f5('0xa')](!![]);};Agent[_0x40f5('0xc')]['handleRun']=function(_0x36a147){logger[_0x40f5('0xe')](_0x40f5('0xf'),this[_0x40f5('0x5')]['id'],this[_0x40f5('0x6')]['id']);if(_['isNil'](this['realtime'][_0x40f5('0x10')][this[_0x40f5('0x6')]['id']])){logger[_0x40f5('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x40f5('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x40f5('0x7')]['bind'](this),0x3e8);}else{if(this[_0x40f5('0x3')]['forcedOwnership']||util['isAgentAvailable'](this[_0x40f5('0x5')]['id'],this['realtime'][_0x40f5('0x10')][this[_0x40f5('0x6')]['id']],this[_0x40f5('0x5')]['channel'],![])){this[_0x40f5('0x11')][_0x40f5('0x10')][this[_0x40f5('0x6')]['id']][_0x40f5('0x12')]=!![];this[_0x40f5('0x11')][_0x40f5('0x10')][this[_0x40f5('0x6')]['id']][_0x40f5('0x13')]=undefined;util[_0x40f5('0x14')](this['notificationId'],this[_0x40f5('0x5')]['id'],this['realtime'][_0x40f5('0x10')][this['agent']['id']],null,this[_0x40f5('0x3')]);util[_0x40f5('0x15')](this[_0x40f5('0x5')]['id'],this[_0x40f5('0x11')]['agents'][this['agent']['id']],_0x40f5('0x16')+(this[_0x40f5('0x3')][_0x40f5('0x17')]?':FORCED':''));}else{logger[_0x40f5('0xe')](_0x40f5('0x18'),this['squeue']['id'],this[_0x40f5('0x6')]['id']);setTimeout(this[_0x40f5('0x7')][_0x40f5('0x8')](this),0x3e8);}}};Agent[_0x40f5('0xc')][_0x40f5('0xa')]=function(_0x2a945c){if(_['isNil'](this['realtime'][_0x40f5('0x10')][this[_0x40f5('0x6')]['id']])){return logger[_0x40f5('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x40f5('0x5')]['id'],this[_0x40f5('0x6')]['id']);}else{logger['info'](_0x40f5('0x19'),this['squeue']['id'],this[_0x40f5('0x6')]['id']);util[_0x40f5('0x1a')](this['notificationId'],this[_0x40f5('0x5')]['id'],this[_0x40f5('0x11')]['agents'][this['agent']['id']],null,this['routing']);this[_0x40f5('0x11')][_0x40f5('0x10')][this[_0x40f5('0x6')]['id']][_0x40f5('0x12')]=![];this['realtime']['agents'][this[_0x40f5('0x6')]['id']][_0x40f5('0x13')]=undefined;util['writeLog'](this[_0x40f5('0x5')]['id'],this[_0x40f5('0x11')]['agents'][this[_0x40f5('0x6')]['id']],_0x2a945c?_0x40f5('0x1b'):'TIMEOUT');}if(!_0x2a945c){setTimeout(this[_0x40f5('0x7')][_0x40f5('0x8')](this),0x3e8);}};function agent(_0x99e638,_0x37f163,_0x10f059,_0x2fc04c){return new Agent(_0x99e638,_0x37f163,_0x10f059,_0x2fc04c);}module[_0x40f5('0x1c')]=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 4aa3157..ebf6e25 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 _0x8161=['busyQueue','name','showNotification','notificationId','TIMEOUT','busy','exports','lodash','uuid','./util','routing','queue','realtime','squeue','push','handleRun','handleTimeout','bind','timeout','drained','handleDrained','prototype','isNil','Agents','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0x8161,0xc1));var _0x1816=function(_0x573862,_0x3959c0){_0x573862=_0x573862-0x0;var _0x10203c=_0x8161[_0x573862];return _0x10203c;};'use strict';var _=require(_0x1816('0x0'));var uuid=require(_0x1816('0x1'));var util=require(_0x1816('0x2'));var logger=require('../../../../../config/logger')(_0x1816('0x3'));var Beepall=function(_0x33990a,_0x33b54f,_0x247388,_0x58c962){this['notificationId']=uuid['v4']();this['squeue']=_0x33990a;this[_0x1816('0x4')]=_0x33b54f;this[_0x1816('0x5')]=_0x247388;this[_0x1816('0x3')]=_0x58c962;this[_0x1816('0x6')][_0x1816('0x7')](this[_0x1816('0x8')]['bind'](this),this[_0x1816('0x9')][_0x1816('0xa')](this));this[_0x1816('0x6')]['on'](_0x1816('0xb'),this[_0x1816('0x9')]['bind'](this));this['squeue']['on'](_0x1816('0xc'),this[_0x1816('0xd')][_0x1816('0xa')](this));};Beepall[_0x1816('0xe')][_0x1816('0x7')]=function(){this[_0x1816('0x6')][_0x1816('0x7')](this[_0x1816('0x8')]['bind'](this),this[_0x1816('0x9')][_0x1816('0xa')](this));};Beepall[_0x1816('0xe')][_0x1816('0xd')]=function(_0x21d78d){this[_0x1816('0x9')](!![]);};Beepall['prototype'][_0x1816('0x8')]=function(_0x254a02){var _0x5dc0be=!![];if(!_[_0x1816('0xf')](this[_0x1816('0x4')])&&!_[_0x1816('0xf')](this[_0x1816('0x4')]['Agents'])&&this[_0x1816('0x4')]['Agents']['length']>0x0){for(var _0x71b001=0x0,_0x501e0e;_0x71b0010x0){for(var _0x9430fd=0x0,_0x5046ea;_0x9430fd0x0&&_0x2a5e50[_0x41af22+_0x9582('0x27')]>=_0x2a5e50[_0x41af22+'Capacity']){writeLog(_0x331c26,_0x2a5e50,_0x41af22[_0x9582('0x28')]()+_0x9582('0x29'));return![];}}return!![];};exports[_0x9582('0x2a')]=function(_0x577cca,_0x5a0824,_0x10d2cd,_0x6b31ef,_0x4d1710){return sendNotification(!![],_0x577cca,_0x5a0824,_0x10d2cd,_0x6b31ef,_0x4d1710);};exports[_0x9582('0x2b')]=function(_0x588841,_0x354eec,_0x3d1c5a,_0x8c5c40,_0x5f409a){return sendNotification(![],_0x588841,_0x354eec,_0x3d1c5a,_0x8c5c40,_0x5f409a);};exports[_0x9582('0x2c')]=writeLog; \ No newline at end of file +var _0x7269=['socket.io-emitter','format','user:%s','name','user:save','split','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','error','[%s][QUEUE]\x20%s','message','emit','save','remove','info','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','lodash','util','../utils','../../../../../config/environment','../../../../../config/logger','redis','defaults','localhost'];(function(_0x3d4027,_0x2a2944){var _0x323cc2=function(_0xe8902d){while(--_0xe8902d){_0x3d4027['push'](_0x3d4027['shift']());}};_0x323cc2(++_0x2a2944);}(_0x7269,0x76));var _0x9726=function(_0xcae26e,_0x4b5a46){_0xcae26e=_0xcae26e-0x0;var _0x427edd=_0x7269[_0xcae26e];return _0x427edd;};'use strict';var _=require(_0x9726('0x0'));var util=require(_0x9726('0x1'));var utils=require(_0x9726('0x2'));var Mustache=require('mustache');var Redis=require('ioredis');var config=require(_0x9726('0x3'));var logger=require(_0x9726('0x4'))('routing');config[_0x9726('0x5')]=_[_0x9726('0x6')](config[_0x9726('0x5')],{'host':_0x9726('0x7'),'port':0x18eb});var io=require(_0x9726('0x8'))(new Redis(config[_0x9726('0x5')]));function emit(_0x1982d3,_0x381bb2,_0x1a5e03){io['to'](_0x1982d3)['emit'](_0x381bb2,_0x1a5e03);}function sendNotification(_0xcbdb72,_0x5bd816,_0x3ddc54,_0x3e72b0,_0x4e0f91,_0x5b56ac){io['to'](util[_0x9726('0x9')](_0x9726('0xa'),_0x3e72b0[_0x9726('0xb')]))['emit'](_0x9726('0xc'),_0x3e72b0);var _0x181144=_0x5b56ac||{};var _0x312b26=_0x3ddc54[_0x9726('0xd')]('.');var _0x2aa7ed={'uniqueid':_0x5bd816,'channel':_0x312b26[0x0],'id':_0x312b26[0x1],'title':_0x312b26[0x0]+'\x20interaction','interactionId':_0x312b26[0x2],'queue':_0x4e0f91?_0x4e0f91['name']:null,'sound':_0x181144[_0x9726('0xe')][_0x9726('0xf')],'shake':_0x181144['account'][_0x9726('0x10')]};try{if(!_0x181144[_0x9726('0x11')]){_0x181144[_0x9726('0x11')]={};}if(_0x4e0f91){_0x181144[_0x9726('0x11')]['queue']=_0x4e0f91;}else if(_0x181144[_0x9726('0x11')][_0x9726('0x12')]){delete _0x181144[_0x9726('0x11')][_0x9726('0x12')];}_0x2aa7ed[_0x9726('0x13')]=utils[_0x9726('0x14')](_0x181144[_0x9726('0xe')][_0x9726('0x15')],_0x181144);}catch(_0x5c705f){_0x2aa7ed[_0x9726('0x13')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x9726('0x16')](util[_0x9726('0x9')](_0x9726('0x17'),_0x5bd816,_0x5c705f[_0x9726('0x18')]));}io['to'](util['format'](_0x9726('0xa'),_0x3e72b0[_0x9726('0xb')]))[_0x9726('0x19')](util[_0x9726('0x9')]('notification:%s',_0xcbdb72?_0x9726('0x1a'):_0x9726('0x1b')),_0x2aa7ed);}function writeLog(_0x47cff6,_0xc937a1,_0x61aa92){return logger[_0x9726('0x1c')](util[_0x9726('0x9')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x47cff6,_0xc937a1[_0x9726('0xb')],_0x61aa92));}exports[_0x9726('0x1d')]=function(_0x1a8ced,_0x2325c0,_0x5e05de,_0x24097a){if(_0x2325c0[_0x9726('0x1e')]){writeLog(_0x1a8ced,_0x2325c0,_0x9726('0x1f'));return![];}if(!_0x2325c0[_0x9726('0x20')]){writeLog(_0x1a8ced,_0x2325c0,_0x9726('0x21'));return![];}if(_0x2325c0[_0x5e05de+_0x9726('0x22')]){writeLog(_0x1a8ced,_0x2325c0,_0x9726('0x23'));return![];}if(_0x24097a&&_0x2325c0[_0x9726('0x24')](_0x5e05de+_0x9726('0x25'))&&_0x2325c0['hasOwnProperty'](_0x5e05de+_0x9726('0x26'))){if(_0x2325c0[_0x5e05de+'Capacity']>0x0&&_0x2325c0[_0x5e05de+_0x9726('0x26')]>=_0x2325c0[_0x5e05de+_0x9726('0x25')]){writeLog(_0x1a8ced,_0x2325c0,_0x5e05de[_0x9726('0x27')]()+_0x9726('0x28'));return![];}}return!![];};exports[_0x9726('0x29')]=function(_0x100de3,_0x55af40,_0x173a1d,_0x4dba6a,_0x5cc55b){return sendNotification(!![],_0x100de3,_0x55af40,_0x173a1d,_0x4dba6a,_0x5cc55b);};exports['hideNotification']=function(_0x79ea9,_0xad574c,_0x2854e0,_0x392fd3,_0x11bbd5){return sendNotification(![],_0x79ea9,_0xad574c,_0x2854e0,_0x392fd3,_0x11bbd5);};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index ff39fd6..1521b88 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 _0x87de=['string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','\x20cris\x20consequence','log','cris\x20in\x20function','length','error','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','trim','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing'];(function(_0x3c7d86,_0x386b47){var _0x6874f0=function(_0x4b6949){while(--_0x4b6949){_0x3c7d86['push'](_0x3c7d86['shift']());}};_0x6874f0(++_0x386b47);}(_0x87de,0x1f2));var _0xe87d=function(_0x50e121,_0x365047){_0x50e121=_0x50e121-0x0;var _0x458811=_0x87de[_0x50e121];return _0x458811;};'use strict';var schema=require(_0xe87d('0x0'));var sh=require(_0xe87d('0x1'));var _=require(_0xe87d('0x2'));var utils=require(_0xe87d('0x3'));var logger=require(_0xe87d('0x4'))(_0xe87d('0x5'));var system=schema({'command':{'type':_0xe87d('0x6'),'required':!![],'message':_0xe87d('0x7')}});exports[_0xe87d('0x8')]=function(_0x1677a4,_0x422ae2){console['log'](_0xe87d('0x9'),_0x422ae2);return function(_0x3a9074){try{var _0x28bf81={'command':_0x422ae2[0x0]};console[_0xe87d('0xa')](_0xe87d('0xb'),_0x28bf81);var _0x4303e3=system[_0xe87d('0x0')](_0x28bf81,{'typecast':!![]});if(_0x4303e3[_0xe87d('0xc')]){logger[_0xe87d('0xd')](_0xe87d('0xe'),_0x1677a4,_['map'](_0x4303e3,_0xe87d('0xf'))[_0xe87d('0x10')](',\x20'));logger[_0xe87d('0x11')](_0xe87d('0x12'),_0x1677a4);_0x3a9074[_0xe87d('0x13')]();}else{var _0x1f274a=this;var _0x3563f7=utils[_0xe87d('0x14')](_0x422ae2[0x0],this);logger[_0xe87d('0x11')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x1677a4,_0x3563f7);sh['exec'](_[_0xe87d('0x15')](_0x3563f7),function(_0xb6fb58,_0x167af7){logger[_0xe87d('0x11')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x1677a4,_0xb6fb58);if(_0xb6fb58==0x0){var _0x3a1b64=_0x167af7['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xe87d('0x16')](_0x422ae2[0x1])||_['isEmpty'](_0x422ae2[0x1])){logger[_0xe87d('0x11')](_0xe87d('0x17'),_0x1677a4);_0x1f274a[_0xe87d('0x18')][_0x422ae2[0x1]]=_0x3a1b64;}else{logger[_0xe87d('0x11')](_0xe87d('0x19'),_0x1677a4,_0x422ae2[0x1],_0x3a1b64);_0x1f274a[_0xe87d('0x18')][_0x422ae2[0x1]]=_0x3a1b64;}}_0x3a9074[_0xe87d('0x13')]();});}}catch(_0x2033ec){logger[_0xe87d('0xd')](_0xe87d('0xe'),_0x1677a4,_[_0xe87d('0x1a')](_0x2033ec)?JSON[_0xe87d('0x1b')](_0x2033ec):_0x2033ec);logger[_0xe87d('0x11')](_0xe87d('0x12'),_0x1677a4);_0x3a9074[_0xe87d('0x13')]();}};}; \ No newline at end of file +var _0x2cd2=['validate','shelljs','lodash','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','log','\x20cris\x20consequence','cris\x20in\x20function','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify'];(function(_0x13cf63,_0x209279){var _0x569447=function(_0x52560e){while(--_0x52560e){_0x13cf63['push'](_0x13cf63['shift']());}};_0x569447(++_0x209279);}(_0x2cd2,0x82));var _0x22cd=function(_0x8f9825,_0x4033d3){_0x8f9825=_0x8f9825-0x0;var _0x130835=_0x2cd2[_0x8f9825];return _0x130835;};'use strict';var schema=require(_0x22cd('0x0'));var sh=require(_0x22cd('0x1'));var _=require(_0x22cd('0x2'));var utils=require(_0x22cd('0x3'));var logger=require(_0x22cd('0x4'))('routing');var system=schema({'command':{'type':_0x22cd('0x5'),'required':!![],'message':_0x22cd('0x6')}});exports[_0x22cd('0x7')]=function(_0x366c8a,_0x51c5ae){console[_0x22cd('0x8')](_0x22cd('0x9'),_0x51c5ae);return function(_0x300ccf){try{var _0x51580b={'command':_0x51c5ae[0x0]};console[_0x22cd('0x8')](_0x22cd('0xa'),_0x51580b);var _0xb6a560=system[_0x22cd('0x0')](_0x51580b,{'typecast':!![]});if(_0xb6a560[_0x22cd('0xb')]){logger[_0x22cd('0xc')](_0x22cd('0xd'),_0x366c8a,_[_0x22cd('0xe')](_0xb6a560,_0x22cd('0xf'))[_0x22cd('0x10')](',\x20'));logger[_0x22cd('0x11')](_0x22cd('0x12'),_0x366c8a);_0x300ccf[_0x22cd('0x13')]();}else{var _0x569840=this;var _0xf6d989=utils['getMustacheRender'](_0x51c5ae[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x366c8a,_0xf6d989);sh['exec'](_[_0x22cd('0x14')](_0xf6d989),function(_0x7fa0e,_0x5c2564){logger[_0x22cd('0x11')](_0x22cd('0x15'),_0x366c8a,_0x7fa0e);if(_0x7fa0e==0x0){var _0x2c7cc8=_0x5c2564['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x22cd('0x16')](_0x51c5ae[0x1])||_[_0x22cd('0x17')](_0x51c5ae[0x1])){logger[_0x22cd('0x11')]('[%s][SYSTEM]\x20no\x20variable',_0x366c8a);_0x569840['body'][_0x51c5ae[0x1]]=_0x2c7cc8;}else{logger[_0x22cd('0x11')](_0x22cd('0x18'),_0x366c8a,_0x51c5ae[0x1],_0x2c7cc8);_0x569840['body'][_0x51c5ae[0x1]]=_0x2c7cc8;}}_0x300ccf[_0x22cd('0x13')]();});}}catch(_0x221c2e){logger['error'](_0x22cd('0xd'),_0x366c8a,_['isObject'](_0x221c2e)?JSON[_0x22cd('0x19')](_0x221c2e):_0x221c2e);logger['info'](_0x22cd('0x12'),_0x366c8a);_0x300ccf[_0x22cd('0x13')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 76c6dfd..5f9914b 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 _0xe115=['message','join','info','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s','map'];(function(_0x442390,_0x45a437){var _0x23078c=function(_0x97e8f8){while(--_0x97e8f8){_0x442390['push'](_0x442390['shift']());}};_0x23078c(++_0x45a437);}(_0xe115,0x151));var _0x5e11=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xe115[_0x92c450];return _0x2a9599;};'use strict';var schema=require(_0x5e11('0x0'));var _=require(_0x5e11('0x1'));var rpc={'chatInteraction':require(_0x5e11('0x2')),'openchannelInteraction':require(_0x5e11('0x3')),'smsInteraction':require(_0x5e11('0x4')),'mailInteraction':require(_0x5e11('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x5e11('0x6'))};var logger=require('../../../../config/logger')(_0x5e11('0x7'));var tag=schema({'tag':{'type':_0x5e11('0x8'),'required':!![],'message':_0x5e11('0x9')}});exports[_0x5e11('0xa')]=function(_0x45cffe,_0x1fc422,_0x8f0119,_0x46402b){return function(_0x37e214){try{var _0x24355a={'tag':_0x1fc422[0x0]};var _0x3e7c59=tag[_0x5e11('0x0')](_0x24355a,{'typecast':!![]});if(_0x3e7c59['length']){logger[_0x5e11('0xb')](_0x5e11('0xc'),_0x45cffe,_[_0x5e11('0xd')](_0x3e7c59,_0x5e11('0xe'))[_0x5e11('0xf')](',\x20'));logger[_0x5e11('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x45cffe);_0x37e214['next']();}else{var _0x5320bc={'ids':[_0x1fc422[0x0]]};if(rpc[_0x46402b[_0x5e11('0x11')]+'Interaction']){rpc[_0x46402b[_0x5e11('0x11')]+_0x5e11('0x12')][_0x5e11('0x13')](_0x46402b[_0x5e11('0x14')]['id'],_0x5320bc)[_0x5e11('0x15')](function(_0x101162){logger[_0x5e11('0x10')](_0x5e11('0x16'),_0x45cffe,_0x1fc422[0x1],_0x46402b[_0x5e11('0x11')],_0x46402b[_0x5e11('0x14')]['id']);})[_0x5e11('0x17')](function(_0x3ed84a){logger[_0x5e11('0xb')](_0x5e11('0xc'),_0x45cffe,JSON[_0x5e11('0x18')](_0x3ed84a));logger[_0x5e11('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x45cffe);})[_0x5e11('0x19')](function(){_0x37e214['next']();});}}}catch(_0x494d73){logger[_0x5e11('0xb')](_0x5e11('0xc'),_0x45cffe,_[_0x5e11('0x1a')](_0x494d73)?JSON[_0x5e11('0x18')](_0x494d73):_0x494d73);logger[_0x5e11('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x45cffe);_0x37e214['next']();}};}; \ No newline at end of file +var _0x5058=['interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction'];(function(_0x41699c,_0x317092){var _0xb1e0ad=function(_0x205f83){while(--_0x205f83){_0x41699c['push'](_0x41699c['shift']());}};_0xb1e0ad(++_0x317092);}(_0x5058,0xca));var _0x8505=function(_0x3e25c1,_0x1d15f9){_0x3e25c1=_0x3e25c1-0x0;var _0x52e7f2=_0x5058[_0x3e25c1];return _0x52e7f2;};'use strict';var schema=require('validate');var _=require(_0x8505('0x0'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x8505('0x1')),'smsInteraction':require(_0x8505('0x2')),'mailInteraction':require(_0x8505('0x3')),'faxInteraction':require(_0x8505('0x4')),'whatsappInteraction':require(_0x8505('0x5'))};var logger=require(_0x8505('0x6'))(_0x8505('0x7'));var tag=schema({'tag':{'type':_0x8505('0x8'),'required':!![],'message':_0x8505('0x9')}});exports[_0x8505('0xa')]=function(_0x4ab64d,_0x33e1ee,_0x49d960,_0x480ecd){return function(_0x5ab43e){try{var _0x513da2={'tag':_0x33e1ee[0x0]};var _0x3fd06f=tag[_0x8505('0xb')](_0x513da2,{'typecast':!![]});if(_0x3fd06f[_0x8505('0xc')]){logger[_0x8505('0xd')](_0x8505('0xe'),_0x4ab64d,_[_0x8505('0xf')](_0x3fd06f,_0x8505('0x10'))['join'](',\x20'));logger[_0x8505('0x11')](_0x8505('0x12'),_0x4ab64d);_0x5ab43e[_0x8505('0x13')]();}else{var _0x2531ab={'ids':[_0x33e1ee[0x0]]};if(rpc[_0x480ecd[_0x8505('0x14')]+_0x8505('0x15')]){rpc[_0x480ecd[_0x8505('0x14')]+_0x8505('0x15')]['addTags'](_0x480ecd[_0x8505('0x16')]['id'],_0x2531ab)[_0x8505('0x17')](function(_0x4f2cfc){logger[_0x8505('0x11')](_0x8505('0x18'),_0x4ab64d,_0x33e1ee[0x1],_0x480ecd[_0x8505('0x14')],_0x480ecd[_0x8505('0x16')]['id']);})[_0x8505('0x19')](function(_0x150e41){logger[_0x8505('0xd')]('[%s][TAG]\x20%s',_0x4ab64d,JSON[_0x8505('0x1a')](_0x150e41));logger['info'](_0x8505('0x12'),_0x4ab64d);})[_0x8505('0x1b')](function(){_0x5ab43e[_0x8505('0x13')]();});}}}catch(_0xadbe20){logger[_0x8505('0xd')](_0x8505('0xe'),_0x4ab64d,_['isObject'](_0xadbe20)?JSON[_0x8505('0x1a')](_0xadbe20):_0xadbe20);logger[_0x8505('0x11')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4ab64d);_0x5ab43e[_0x8505('0x13')]();}};}; \ 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 8b3dddc..65e493d 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 _0x0b40=['merge','body','contact','message','interaction','list','lodash','exports','render'];(function(_0x497d6d,_0xff7558){var _0x4a1d9a=function(_0x2d2fdf){while(--_0x2d2fdf){_0x497d6d['push'](_0x497d6d['shift']());}};_0x4a1d9a(++_0xff7558);}(_0x0b40,0xba));var _0x00b4=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0x0b40[_0x209fcd];return _0x501d5e;};'use strict';var Mustache=require('mustache');var _=require(_0x00b4('0x0'));module[_0x00b4('0x1')]={'getMustacheRender':function(_0x53b8fd,_0x2a5a0f){return Mustache[_0x00b4('0x2')](_0x53b8fd,_[_0x00b4('0x3')](_0x2a5a0f[_0x00b4('0x4')],{'contact':_0x2a5a0f[_0x00b4('0x5')],'message':_0x2a5a0f[_0x00b4('0x6')],'account':_0x2a5a0f['account'],'interaction':_0x2a5a0f[_0x00b4('0x7')],'list':_0x2a5a0f[_0x00b4('0x8')]}))||'';}}; \ No newline at end of file +var _0x92f0=['contact','message','account','interaction','list','lodash','exports','render'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x92f0,0x10d));var _0x092f=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x92f0[_0x3ea913];return _0x2b4f28;};'use strict';var Mustache=require('mustache');var _=require(_0x092f('0x0'));module[_0x092f('0x1')]={'getMustacheRender':function(_0x5085b3,_0x6d6daa){return Mustache[_0x092f('0x2')](_0x5085b3,_['merge'](_0x6d6daa['body'],{'contact':_0x6d6daa[_0x092f('0x3')],'message':_0x6d6daa[_0x092f('0x4')],'account':_0x6d6daa[_0x092f('0x5')],'interaction':_0x6d6daa[_0x092f('0x6')],'list':_0x6d6daa[_0x092f('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index b9ef663..c209915 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 _0x98d3=['applications','isArray','length','existsSync','join','app','toLowerCase','autoreply','mail','push','slice','dialogflow','appdata','dialogflowv2','split','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','available','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','lodash','util','jayson/promise','uuid','../../../config/logger','routing','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x98d3,0x173));var _0x398d=function(_0x12efc7,_0x855855){_0x12efc7=_0x12efc7-0x0;var _0x50803f=_0x98d3[_0x12efc7];return _0x50803f;};'use strict';var _=require(_0x398d('0x0'));var util=require(_0x398d('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x398d('0x2'));var BPromise=require('bluebird');var uuid=require(_0x398d('0x3'));var config=require('../../../config/environment');var logger=require(_0x398d('0x4'))(_0x398d('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x398d('0x6')),'smsQueueReport':require(_0x398d('0x7')),'faxQueueReport':require(_0x398d('0x8')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x398d('0x9'));function getId(_0x391d99,_0x3029f3,_0x399598){return util[_0x398d('0xa')]('%s.%s.%s',_0x391d99,_0x3029f3||0x0,_0x399598||0x0);}function getIntervals(_0x3a1934,_0x147aec){var _0x45d5e3=[];if(!_[_0x398d('0xb')](_0x147aec[_0x398d('0xc')])&&!_[_0x398d('0xb')](_0x3a1934[_0x147aec[_0x398d('0xc')]])&&!_[_0x398d('0xb')](_0x3a1934[_0x147aec['IntervalId']][_0x398d('0xd')])){_0x45d5e3=_[_0x398d('0xe')](_0x3a1934[_0x147aec[_0x398d('0xc')]][_0x398d('0xd')],_0x398d('0xf'));}else if(!_[_0x398d('0xb')](_0x147aec[_0x398d('0xf')])){_0x45d5e3=[_0x147aec[_0x398d('0xf')]];}return _0x45d5e3;}exports[_0x398d('0x10')]=function(_0x396015){_0x396015[_0x398d('0x11')]={};return new BPromise(function(_0x537bb6,_0x50a3f9){var _0x3d424f={'Start':function(_0x36cde2){var _0x347508=this;return new Promise(function(_0x2197b4,_0x278004){if(_0x36cde2){try{var _0x4099a5=[];var _0x3ff03c=getId(_0x36cde2[_0x398d('0x12')],_0x36cde2['message']?_0x36cde2[_0x398d('0x13')]['id']:0x0,_0x36cde2['interaction']?_0x36cde2[_0x398d('0x14')]['id']:0x0);if(_0x36cde2[_0x398d('0x15')]&&_[_0x398d('0x16')](_0x36cde2['applications'])&&_0x36cde2['applications']['length']){for(var _0x28b124=0x0;_0x28b124<_0x36cde2[_0x398d('0x15')][_0x398d('0x17')];_0x28b124+=0x1){var _0x1c526f=_0x36cde2[_0x398d('0x15')][_0x28b124];if(fs[_0x398d('0x18')](path[_0x398d('0x19')](__dirname,'applications',_0x1c526f['app']+'.js'))){var _0x16e580=[];switch(_0x1c526f[_0x398d('0x1a')][_0x398d('0x1b')]()){case _0x398d('0x1c'):var _0x19fa69=_0x1c526f['appdata']['split'](',');if(_0x36cde2[_0x398d('0x12')]===_0x398d('0x1d')){_0x16e580['push'](_0x19fa69[0x0]);_0x16e580[_0x398d('0x1e')](_0x19fa69[0x1]);_0x16e580[_0x398d('0x1e')](_0x19fa69['slice'](0x2,_0x19fa69['length'])['join'](','));}else{_0x16e580[_0x398d('0x1e')](_0x19fa69[0x0]);_0x16e580[_0x398d('0x1e')](_0x19fa69[_0x398d('0x1f')](0x1,_0x19fa69[_0x398d('0x17')])[_0x398d('0x19')](','));}break;case _0x398d('0x20'):var _0xc9c9b7=_0x1c526f[_0x398d('0x21')]['split'](',');_0x16e580[_0x398d('0x1e')](_0xc9c9b7[0x0]);_0x16e580['push'](_0xc9c9b7[0x1]);_0x16e580['push'](_0xc9c9b7[_0x398d('0x1f')](0x2,_0xc9c9b7[_0x398d('0x17')])['join'](','));break;case _0x398d('0x22'):var _0x558249=_0x1c526f[_0x398d('0x21')][_0x398d('0x23')](',');_0x16e580['push'](_0x558249[0x0]);_0x16e580['push'](_0x558249[0x1]);_0x16e580[_0x398d('0x1e')](_0x558249[0x2]);_0x16e580[_0x398d('0x1e')](_0x558249[0x3]);_0x16e580['push'](_0x558249[_0x398d('0x1f')](0x4,_0x558249[_0x398d('0x17')])[_0x398d('0x19')](','));break;case _0x398d('0x24'):var _0x1e84ac=_0x1c526f[_0x398d('0x21')]['split'](',');_0x16e580['push'](_0x1e84ac[0x0]);_0x16e580[_0x398d('0x1e')](_0x1e84ac[0x1]);_0x16e580[_0x398d('0x1e')](_0x1e84ac[0x2]);_0x16e580[_0x398d('0x1e')](_0x1e84ac[0x3]);_0x16e580[_0x398d('0x1e')](_0x1e84ac[_0x398d('0x1f')](0x4,_0x1e84ac[_0x398d('0x17')])[_0x398d('0x19')](','));break;case _0x398d('0x13'):_0x16e580[_0x398d('0x1e')](_0x1c526f['appdata']);break;case _0x398d('0x25'):_0x16e580[_0x398d('0x1e')](_0x1c526f[_0x398d('0x26')]);_0x16e580['push'](_0x1c526f['appdata']);break;default:_0x16e580=_[_0x398d('0xb')](_0x1c526f[_0x398d('0x21')])?[]:_0x1c526f[_0x398d('0x21')][_0x398d('0x23')](',');}var _0x20fe0d={'id':util[_0x398d('0xa')](_0x398d('0x27'),_0x3ff03c,_0x1c526f['id'],_0x1c526f[_0x398d('0x1a')]),'condition':require(_0x398d('0x28'))[_0x398d('0x29')](_0x3ff03c,getIntervals(_0x396015[_0x398d('0x2a')],_0x1c526f),_0x396015),'consequence':require(_0x398d('0x2b')+_0x1c526f[_0x398d('0x1a')])[_0x398d('0x2c')](_0x3ff03c,_0x16e580,_0x396015,_0x36cde2),'p':_0x1c526f[_0x398d('0x2d')]||0x0};logger[_0x398d('0x2e')](_0x398d('0x2f'),_0x20fe0d['id'],_0x398d('0x30'),getIntervals(_0x396015[_0x398d('0x2a')],_0x1c526f)['join'](_0x398d('0x31')));_0x4099a5[_0x398d('0x1e')](_0x20fe0d);}else{logger[_0x398d('0x32')](_0x398d('0x33'),path[_0x398d('0x19')](__dirname,_0x398d('0x15'),_0x1c526f[_0x398d('0x1a')]+'.js'));}}_0x396015[_0x398d('0x11')][_0x3ff03c]=new RuleEngine(_0x4099a5);_0x396015[_0x398d('0x11')][_0x3ff03c][_0x398d('0x34')](_0x36cde2,function(_0x3b7acc){logger[_0x398d('0x2e')](_0x398d('0x35'),JSON[_0x398d('0x36')](_0x3b7acc[_0x398d('0x37')]));if(_0x396015['rules'][_0x3ff03c]){_0x396015[_0x398d('0x11')][_0x3ff03c][_0x398d('0x38')](_0x398d('0x39'));}});return _0x2197b4({'code':0xc8,'message':_0x36cde2});}else{logger[_0x398d('0x2e')](_0x398d('0x3a'));return _0x2197b4({'code':0xc8,'message':_0x36cde2});}}catch(_0x5229c2){logger[_0x398d('0x32')](_0x5229c2[_0x398d('0x3b')]);return _0x278004(_0x347508['error'](0x1f4,_0x5229c2));}}return _0x278004(_0x398d('0x3c'));});},'AcceptMessage':function(_0x8707f4){var _0x3d72ee=this;return new Promise(function(_0x24a9eb,_0x217fc0){if(_0x8707f4[_0x398d('0x3d')]&&_0x8707f4[_0x398d('0x3d')]['id']){if(_0x396015[_0x398d('0x3e')][_0x8707f4[_0x398d('0x3d')]['id']]){_0x396015['agents'][_0x8707f4[_0x398d('0x3d')]['id']][_0x398d('0x3f')]=![];_0x396015[_0x398d('0x3e')][_0x8707f4[_0x398d('0x3d')]['id']][_0x398d('0x40')]=undefined;}}if(_0x8707f4[_0x398d('0x13')]&&_0x8707f4['message']['id']){try{var _0x26b0c6=getId(_0x8707f4[_0x398d('0x12')],_0x8707f4['message']?_0x8707f4[_0x398d('0x13')]['id']:0x0,_0x8707f4[_0x398d('0x14')]?_0x8707f4[_0x398d('0x14')]['id']:0x0);if(_0x396015['rules'][_0x26b0c6]){_0x396015[_0x398d('0x11')][_0x26b0c6][_0x398d('0x38')](_0x398d('0x41'));if(rpc[_0x8707f4[_0x398d('0x12')]+_0x398d('0x42')]){rpc[_0x8707f4['channel']+_0x398d('0x42')][_0x398d('0x43')](_0x26b0c6,{'UserId':_0x8707f4[_0x398d('0x13')]['UserId']})[_0x398d('0x44')](function(_0x3f9fb2){logger['error'](_0x398d('0x45'));});}}return _0x24a9eb({'code':0xc8,'message':_0x8707f4});}catch(_0x28240b){logger[_0x398d('0x32')](_0x28240b[_0x398d('0x3b')]);return _0x217fc0(_0x3d72ee[_0x398d('0x32')](0x1f4,_0x28240b));}}logger[_0x398d('0x32')](_0x398d('0x46'));return _0x217fc0(_0x3d72ee[_0x398d('0x32')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x34c0fc){var _0x3f146c=this;return new Promise(function(_0x4d16ef,_0x5f4aef){if(_0x34c0fc[_0x398d('0x3d')]&&_0x34c0fc[_0x398d('0x3d')]['id']){try{if(_0x396015[_0x398d('0x3e')][_0x34c0fc[_0x398d('0x3d')]['id']]){_0x396015['agents'][_0x34c0fc[_0x398d('0x3d')]['id']]['busy']=![];_0x396015[_0x398d('0x3e')][_0x34c0fc['agent']['id']][_0x398d('0x40')]=undefined;}return _0x4d16ef({'code':0xc8,'message':_0x34c0fc});}catch(_0x588548){logger['error'](_0x588548['stack']);return _0x5f4aef(_0x3f146c[_0x398d('0x32')](0x1f4,_0x588548));}}logger[_0x398d('0x32')](_0x398d('0x46'));return _0x5f4aef(_0x3f146c[_0x398d('0x32')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x5d864a){var _0x339f55=this;return new Promise(function(_0x12613c,_0x1615ee){if(_0x5d864a['channel']&&_0x5d864a[_0x398d('0x14')]&&_0x5d864a[_0x398d('0x14')]['id']){try{var _0x2376c3=getId(_0x5d864a[_0x398d('0x12')],_0x5d864a[_0x398d('0x13')]?_0x5d864a[_0x398d('0x13')]['id']:0x0,_0x5d864a['interaction']?_0x5d864a[_0x398d('0x14')]['id']:0x0);if(_0x396015[_0x398d('0x11')][_0x2376c3]){_0x396015[_0x398d('0x11')][_0x2376c3][_0x398d('0x38')]('end');}return _0x12613c({'code':0xc8,'message':_0x5d864a});}catch(_0x3bbd2e){logger[_0x398d('0x32')](_0x3bbd2e[_0x398d('0x3b')]);return _0x1615ee(_0x339f55[_0x398d('0x32')](0x1f4,_0x3bbd2e));}}logger['error']('message\x20is\x20empty');return _0x1615ee(_0x339f55[_0x398d('0x32')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0xc7b543){var _0x2de5cc=this;return new Promise(function(_0x4887fd,_0x86b133){if(_0x396015['agents'][_0x398d('0x47')](_0xc7b543['id'])){for(var _0x185df4 in _0xc7b543[_0x398d('0x48')]){if(_0xc7b543[_0x398d('0x48')][_0x398d('0x47')](_0x185df4)){if(_0x396015[_0x398d('0x3e')][_0xc7b543['id']][_0x398d('0x47')](_0x185df4+_0x398d('0x49'))){_0x396015[_0x398d('0x3e')][_0xc7b543['id']][_0x185df4+_0x398d('0x49')]=parseInt(_0xc7b543[_0x398d('0x48')][_0x185df4],0xa);}}}_0x396015[_0x398d('0x3e')][_0xc7b543['id']][_0x398d('0x4a')]();return _0x4887fd({'code':0xc8,'message':_0x396015[_0x398d('0x3e')][_0xc7b543['id']]});}else{return _0x86b133(_0x2de5cc[_0x398d('0x32')](0x1f4,_0x398d('0x4b')));}});},'Agents':function(_0x20b5e1){return new Promise(function(_0x31e977,_0x4717cf){var _0xb25709=_[_0x398d('0x4c')](_0x396015[_0x398d('0x3e')]);_0x31e977({'count':_0xb25709['length'],'rows':_0xb25709});});},'ChatQueues':function(_0x12ef87){return new Promise(function(_0x26d6f8,_0x2e51b1){var _0x10ca36=[];for(var _0x1dda79 in _0x396015[_0x398d('0x4d')]){if(_0x396015[_0x398d('0x4d')][_0x398d('0x47')](_0x1dda79)){var _0xe6cf33=_0x396015[_0x398d('0x4d')][_0x1dda79];var _0x363097={'id':_0xe6cf33['id'],'available':_0xe6cf33['available'],'loggedIn':_0xe6cf33[_0x398d('0x4e')],'name':_0xe6cf33[_0x398d('0x4f')],'paused':_0xe6cf33['paused'],'waiting':_0xe6cf33[_0x398d('0x50')]};_0x10ca36['push'](_0x363097);}}_0x26d6f8({'count':_0x10ca36['length'],'rows':_0x10ca36});});},'MailQueues':function(_0x4ae456){return new Promise(function(_0x37646f,_0x38970c){var _0x4fc42f=[];for(var _0x17c11e in _0x396015[_0x398d('0x51')]){if(_0x396015[_0x398d('0x51')]['hasOwnProperty'](_0x17c11e)){var _0x2c8f2d=_0x396015[_0x398d('0x51')][_0x17c11e];var _0xf582f2={'id':_0x2c8f2d['id'],'available':_0x2c8f2d['available'],'loggedIn':_0x2c8f2d[_0x398d('0x4e')],'name':_0x2c8f2d['name'],'paused':_0x2c8f2d[_0x398d('0x52')],'waiting':_0x2c8f2d['waiting']};_0x4fc42f[_0x398d('0x1e')](_0xf582f2);}}_0x37646f({'count':_0x4fc42f['length'],'rows':_0x4fc42f});});},'OpenchannelQueues':function(_0x35c204){return new Promise(function(_0x1b5929,_0x318e5b){var _0x322eec=[];for(var _0x2938d7 in _0x396015['openchannelQueues']){if(_0x396015[_0x398d('0x53')][_0x398d('0x47')](_0x2938d7)){var _0x1e150f=_0x396015[_0x398d('0x53')][_0x2938d7];var _0x21026={'id':_0x1e150f['id'],'available':_0x1e150f[_0x398d('0x54')],'loggedIn':_0x1e150f[_0x398d('0x4e')],'name':_0x1e150f['name'],'paused':_0x1e150f[_0x398d('0x52')],'waiting':_0x1e150f[_0x398d('0x50')]};_0x322eec[_0x398d('0x1e')](_0x21026);}}_0x1b5929({'count':_0x322eec['length'],'rows':_0x322eec});});},'SmsQueues':function(_0x47e2db){return new Promise(function(_0x1e5e84,_0x26ed40){var _0x540121=[];for(var _0x5272b3 in _0x396015[_0x398d('0x55')]){if(_0x396015['smsQueues'][_0x398d('0x47')](_0x5272b3)){var _0x575f13=_0x396015[_0x398d('0x55')][_0x5272b3];var _0x557799={'id':_0x575f13['id'],'available':_0x575f13['available'],'loggedIn':_0x575f13['loggedIn'],'name':_0x575f13[_0x398d('0x4f')],'paused':_0x575f13[_0x398d('0x52')],'waiting':_0x575f13[_0x398d('0x50')]};_0x540121[_0x398d('0x1e')](_0x557799);}}_0x1e5e84({'count':_0x540121[_0x398d('0x17')],'rows':_0x540121});});},'FaxQueues':function(_0x496796){return new Promise(function(_0x4d0a11,_0x5b0ec5){var _0x57267a=[];for(var _0x423232 in _0x396015['faxQueues']){if(_0x396015[_0x398d('0x56')][_0x398d('0x47')](_0x423232)){var _0x6fc4e3=_0x396015[_0x398d('0x56')][_0x423232];var _0x5312bf={'id':_0x6fc4e3['id'],'available':_0x6fc4e3[_0x398d('0x54')],'loggedIn':_0x6fc4e3['loggedIn'],'name':_0x6fc4e3['name'],'paused':_0x6fc4e3[_0x398d('0x52')],'waiting':_0x6fc4e3[_0x398d('0x50')]};_0x57267a['push'](_0x5312bf);}}_0x4d0a11({'count':_0x57267a[_0x398d('0x17')],'rows':_0x57267a});});},'WhatsappQueues':function(_0x4fbf02){return new Promise(function(_0x1491d0,_0x101d87){var _0x17075f=[];for(var _0xaa4021 in _0x396015['whatsappQueues']){if(_0x396015[_0x398d('0x57')][_0x398d('0x47')](_0xaa4021)){var _0x2ed343=_0x396015[_0x398d('0x57')][_0xaa4021];var _0x18e1de={'id':_0x2ed343['id'],'available':_0x2ed343['available'],'loggedIn':_0x2ed343[_0x398d('0x4e')],'name':_0x2ed343['name'],'paused':_0x2ed343[_0x398d('0x52')],'waiting':_0x2ed343[_0x398d('0x50')]};_0x17075f[_0x398d('0x1e')](_0x18e1de);}}_0x1491d0({'count':_0x17075f['length'],'rows':_0x17075f});});},'ChatQueuesWaitingInteractions':function(_0x135d5d){return new Promise(function(_0x15be8d,_0x5492b6){var _0x37c9e2=_[_0x398d('0x4c')](_0x396015[_0x398d('0x58')]);_0x15be8d({'count':_0x37c9e2['length'],'rows':_0x37c9e2});});},'MailQueuesWaitingInteractions':function(_0x57af50){return new Promise(function(_0x4b1d15,_0x4bc424){var _0x441f3b=_['values'](_0x396015[_0x398d('0x59')]);_0x4b1d15({'count':_0x441f3b[_0x398d('0x17')],'rows':_0x441f3b});});},'OpenchannelQueuesWaitingInteractions':function(_0x352bf3){return new Promise(function(_0x1ccd23,_0x19f1c6){var _0x1ea377=_['values'](_0x396015[_0x398d('0x5a')]);_0x1ccd23({'count':_0x1ea377[_0x398d('0x17')],'rows':_0x1ea377});});},'SmsQueuesWaitingInteractions':function(_0x5881f7){return new Promise(function(_0x1b6175,_0x2d8aad){var _0x24debd=_[_0x398d('0x4c')](_0x396015[_0x398d('0x5b')]);_0x1b6175({'count':_0x24debd[_0x398d('0x17')],'rows':_0x24debd});});},'FaxQueuesWaitingInteractions':function(_0x460617){return new Promise(function(_0x37f224,_0xcf117b){var _0x1721aa=_['values'](_0x396015[_0x398d('0x5c')]);_0x37f224({'count':_0x1721aa[_0x398d('0x17')],'rows':_0x1721aa});});},'WhatsappQueuesWaitingInteractions':function(_0x6076ea){return new Promise(function(_0x5bd2cf,_0x356a2d){var _0x2ab8a6=_[_0x398d('0x4c')](_0x396015[_0x398d('0x5d')]);_0x5bd2cf({'count':_0x2ab8a6[_0x398d('0x17')],'rows':_0x2ab8a6});});}};var _0x2ba660=jayson[_0x398d('0x5e')](_0x3d424f)[_0x398d('0x5f')]();_0x2ba660['on']('error',function(_0x30394c){logger[_0x398d('0x32')](JSON[_0x398d('0x36')](_0x30394c));return _0x50a3f9(_0x30394c);});_0x2ba660[_0x398d('0x10')](0x232c,_0x398d('0x60'),function(){console[_0x398d('0x61')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x537bb6('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x0bde=['intervals','Please\x20create\x20a\x20new\x20file\x20under','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','error','routing\x20is\x20empty','agents','agent','busyQueue','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','end','stack','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','map','IntervalId','interval','listen','rules','channel','message','interaction','isArray','applications','length','existsSync','join','.js','app','autoreply','appdata','split','mail','push','slice','dialogflowv2','tag','TagId','%s:%s:%s','./interval','./applications/','consequence','info'];(function(_0x5390c5,_0x739265){var _0x580849=function(_0x450a01){while(--_0x450a01){_0x5390c5['push'](_0x5390c5['shift']());}};_0x580849(++_0x739265);}(_0x0bde,0xe7));var _0xe0bd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0bde[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0xe0bd('0x0'));var path=require('path');var fs=require('fs');var jayson=require(_0xe0bd('0x1'));var BPromise=require(_0xe0bd('0x2'));var uuid=require(_0xe0bd('0x3'));var config=require(_0xe0bd('0x4'));var logger=require(_0xe0bd('0x5'))('routing');var rpc={'openchannelQueueReport':require(_0xe0bd('0x6')),'mailQueueReport':require(_0xe0bd('0x7')),'chatQueueReport':require(_0xe0bd('0x8')),'smsQueueReport':require(_0xe0bd('0x9')),'faxQueueReport':require(_0xe0bd('0xa')),'whatsappQueueReport':require(_0xe0bd('0xb'))};var RuleEngine=require(_0xe0bd('0xc'));function getId(_0x491dc7,_0x40b36a,_0x44cb0b){return util[_0xe0bd('0xd')](_0xe0bd('0xe'),_0x491dc7,_0x40b36a||0x0,_0x44cb0b||0x0);}function getIntervals(_0x393379,_0x3c47c4){var _0x475265=[];if(!_[_0xe0bd('0xf')](_0x3c47c4['IntervalId'])&&!_['isNil'](_0x393379[_0x3c47c4['IntervalId']])&&!_[_0xe0bd('0xf')](_0x393379[_0x3c47c4['IntervalId']]['Intervals'])){_0x475265=_[_0xe0bd('0x10')](_0x393379[_0x3c47c4[_0xe0bd('0x11')]]['Intervals'],_0xe0bd('0x12'));}else if(!_['isNil'](_0x3c47c4[_0xe0bd('0x12')])){_0x475265=[_0x3c47c4[_0xe0bd('0x12')]];}return _0x475265;}exports[_0xe0bd('0x13')]=function(_0x20ab47){_0x20ab47[_0xe0bd('0x14')]={};return new BPromise(function(_0x335f17,_0x342a68){var _0x210f20={'Start':function(_0x4f63fa){var _0x50891d=this;return new Promise(function(_0x4fb006,_0x2ff887){if(_0x4f63fa){try{var _0x8179fb=[];var _0x2cd832=getId(_0x4f63fa[_0xe0bd('0x15')],_0x4f63fa[_0xe0bd('0x16')]?_0x4f63fa['message']['id']:0x0,_0x4f63fa['interaction']?_0x4f63fa[_0xe0bd('0x17')]['id']:0x0);if(_0x4f63fa['applications']&&_[_0xe0bd('0x18')](_0x4f63fa[_0xe0bd('0x19')])&&_0x4f63fa[_0xe0bd('0x19')][_0xe0bd('0x1a')]){for(var _0x5f22e2=0x0;_0x5f22e2<_0x4f63fa[_0xe0bd('0x19')][_0xe0bd('0x1a')];_0x5f22e2+=0x1){var _0x2b9f93=_0x4f63fa['applications'][_0x5f22e2];if(fs[_0xe0bd('0x1b')](path[_0xe0bd('0x1c')](__dirname,_0xe0bd('0x19'),_0x2b9f93['app']+_0xe0bd('0x1d')))){var _0xdd7d30=[];switch(_0x2b9f93[_0xe0bd('0x1e')]['toLowerCase']()){case _0xe0bd('0x1f'):var _0x58e8f3=_0x2b9f93[_0xe0bd('0x20')][_0xe0bd('0x21')](',');if(_0x4f63fa['channel']===_0xe0bd('0x22')){_0xdd7d30[_0xe0bd('0x23')](_0x58e8f3[0x0]);_0xdd7d30[_0xe0bd('0x23')](_0x58e8f3[0x1]);_0xdd7d30[_0xe0bd('0x23')](_0x58e8f3[_0xe0bd('0x24')](0x2,_0x58e8f3[_0xe0bd('0x1a')])[_0xe0bd('0x1c')](','));}else{_0xdd7d30[_0xe0bd('0x23')](_0x58e8f3[0x0]);_0xdd7d30['push'](_0x58e8f3['slice'](0x1,_0x58e8f3[_0xe0bd('0x1a')])[_0xe0bd('0x1c')](','));}break;case'dialogflow':var _0x4e8f11=_0x2b9f93[_0xe0bd('0x20')][_0xe0bd('0x21')](',');_0xdd7d30[_0xe0bd('0x23')](_0x4e8f11[0x0]);_0xdd7d30[_0xe0bd('0x23')](_0x4e8f11[0x1]);_0xdd7d30['push'](_0x4e8f11[_0xe0bd('0x24')](0x2,_0x4e8f11['length'])[_0xe0bd('0x1c')](','));break;case _0xe0bd('0x25'):var _0x42bea7=_0x2b9f93[_0xe0bd('0x20')][_0xe0bd('0x21')](',');_0xdd7d30[_0xe0bd('0x23')](_0x42bea7[0x0]);_0xdd7d30[_0xe0bd('0x23')](_0x42bea7[0x1]);_0xdd7d30[_0xe0bd('0x23')](_0x42bea7[0x2]);_0xdd7d30[_0xe0bd('0x23')](_0x42bea7[0x3]);_0xdd7d30[_0xe0bd('0x23')](_0x42bea7[_0xe0bd('0x24')](0x4,_0x42bea7[_0xe0bd('0x1a')])[_0xe0bd('0x1c')](','));break;case'amazonlex':var _0x3edd71=_0x2b9f93[_0xe0bd('0x20')][_0xe0bd('0x21')](',');_0xdd7d30[_0xe0bd('0x23')](_0x3edd71[0x0]);_0xdd7d30[_0xe0bd('0x23')](_0x3edd71[0x1]);_0xdd7d30[_0xe0bd('0x23')](_0x3edd71[0x2]);_0xdd7d30['push'](_0x3edd71[0x3]);_0xdd7d30['push'](_0x3edd71[_0xe0bd('0x24')](0x4,_0x3edd71[_0xe0bd('0x1a')])[_0xe0bd('0x1c')](','));break;case _0xe0bd('0x16'):_0xdd7d30[_0xe0bd('0x23')](_0x2b9f93[_0xe0bd('0x20')]);break;case _0xe0bd('0x26'):_0xdd7d30['push'](_0x2b9f93[_0xe0bd('0x27')]);_0xdd7d30[_0xe0bd('0x23')](_0x2b9f93[_0xe0bd('0x20')]);break;default:_0xdd7d30=_[_0xe0bd('0xf')](_0x2b9f93[_0xe0bd('0x20')])?[]:_0x2b9f93[_0xe0bd('0x20')]['split'](',');}var _0xd82ced={'id':util[_0xe0bd('0xd')](_0xe0bd('0x28'),_0x2cd832,_0x2b9f93['id'],_0x2b9f93[_0xe0bd('0x1e')]),'condition':require(_0xe0bd('0x29'))['condition'](_0x2cd832,getIntervals(_0x20ab47['intervals'],_0x2b9f93),_0x20ab47),'consequence':require(_0xe0bd('0x2a')+_0x2b9f93[_0xe0bd('0x1e')])[_0xe0bd('0x2b')](_0x2cd832,_0xdd7d30,_0x20ab47,_0x4f63fa),'p':_0x2b9f93['priority']||0x0};logger[_0xe0bd('0x2c')]('Push\x20new\x20rule',_0xd82ced['id'],'on\x20interval',getIntervals(_0x20ab47[_0xe0bd('0x2d')],_0x2b9f93)[_0xe0bd('0x1c')]('\x20|\x20'));_0x8179fb['push'](_0xd82ced);}else{logger['error'](_0xe0bd('0x2e'),path[_0xe0bd('0x1c')](__dirname,_0xe0bd('0x19'),_0x2b9f93['app']+_0xe0bd('0x1d')));}}_0x20ab47[_0xe0bd('0x14')][_0x2cd832]=new RuleEngine(_0x8179fb);_0x20ab47[_0xe0bd('0x14')][_0x2cd832]['execute'](_0x4f63fa,function(_0x5b9c9f){logger[_0xe0bd('0x2c')]('Applications\x20executed',JSON[_0xe0bd('0x2f')](_0x5b9c9f[_0xe0bd('0x30')]));if(_0x20ab47['rules'][_0x2cd832]){_0x20ab47[_0xe0bd('0x14')][_0x2cd832][_0xe0bd('0x31')](_0xe0bd('0x32'));}});return _0x4fb006({'code':0xc8,'message':_0x4f63fa});}else{logger[_0xe0bd('0x2c')](_0xe0bd('0x33'));return _0x4fb006({'code':0xc8,'message':_0x4f63fa});}}catch(_0x188394){logger[_0xe0bd('0x34')](_0x188394['stack']);return _0x2ff887(_0x50891d[_0xe0bd('0x34')](0x1f4,_0x188394));}}return _0x2ff887(_0xe0bd('0x35'));});},'AcceptMessage':function(_0x15b884){var _0x3c138e=this;return new Promise(function(_0x243641,_0x5adee4){if(_0x15b884['agent']&&_0x15b884['agent']['id']){if(_0x20ab47[_0xe0bd('0x36')][_0x15b884[_0xe0bd('0x37')]['id']]){_0x20ab47[_0xe0bd('0x36')][_0x15b884[_0xe0bd('0x37')]['id']]['busy']=![];_0x20ab47['agents'][_0x15b884[_0xe0bd('0x37')]['id']][_0xe0bd('0x38')]=undefined;}}if(_0x15b884[_0xe0bd('0x16')]&&_0x15b884[_0xe0bd('0x16')]['id']){try{var _0x33e597=getId(_0x15b884[_0xe0bd('0x15')],_0x15b884[_0xe0bd('0x16')]?_0x15b884['message']['id']:0x0,_0x15b884[_0xe0bd('0x17')]?_0x15b884['interaction']['id']:0x0);if(_0x20ab47[_0xe0bd('0x14')][_0x33e597]){_0x20ab47[_0xe0bd('0x14')][_0x33e597]['emit']('end');if(rpc[_0x15b884[_0xe0bd('0x15')]+_0xe0bd('0x39')]){rpc[_0x15b884[_0xe0bd('0x15')]+_0xe0bd('0x39')][_0xe0bd('0x3a')](_0x33e597,{'UserId':_0x15b884[_0xe0bd('0x16')][_0xe0bd('0x3b')]})[_0xe0bd('0x3c')](function(_0x2fbe0e){logger['error'](_0xe0bd('0x3d'));});}}return _0x243641({'code':0xc8,'message':_0x15b884});}catch(_0x4dcbc6){logger[_0xe0bd('0x34')](_0x4dcbc6['stack']);return _0x5adee4(_0x3c138e[_0xe0bd('0x34')](0x1f4,_0x4dcbc6));}}logger[_0xe0bd('0x34')]('message\x20is\x20empty');return _0x5adee4(_0x3c138e[_0xe0bd('0x34')](0x1f4,_0xe0bd('0x3e')));});},'RejectMessage':function(_0x578792){var _0xd14c1d=this;return new Promise(function(_0x45ed55,_0x182f89){if(_0x578792['agent']&&_0x578792[_0xe0bd('0x37')]['id']){try{if(_0x20ab47[_0xe0bd('0x36')][_0x578792[_0xe0bd('0x37')]['id']]){_0x20ab47[_0xe0bd('0x36')][_0x578792[_0xe0bd('0x37')]['id']][_0xe0bd('0x3f')]=![];_0x20ab47[_0xe0bd('0x36')][_0x578792[_0xe0bd('0x37')]['id']][_0xe0bd('0x38')]=undefined;}return _0x45ed55({'code':0xc8,'message':_0x578792});}catch(_0x50497d){logger['error'](_0x50497d['stack']);return _0x182f89(_0xd14c1d[_0xe0bd('0x34')](0x1f4,_0x50497d));}}logger[_0xe0bd('0x34')]('message\x20is\x20empty');return _0x182f89(_0xd14c1d[_0xe0bd('0x34')](0x1f4,_0xe0bd('0x3e')));});},'AbandonInteraction':function(_0x1ab9b0){var _0x334d63=this;return new Promise(function(_0x2f19ec,_0x5643eb){if(_0x1ab9b0[_0xe0bd('0x15')]&&_0x1ab9b0[_0xe0bd('0x17')]&&_0x1ab9b0[_0xe0bd('0x17')]['id']){try{var _0x2631f5=getId(_0x1ab9b0['channel'],_0x1ab9b0[_0xe0bd('0x16')]?_0x1ab9b0[_0xe0bd('0x16')]['id']:0x0,_0x1ab9b0[_0xe0bd('0x17')]?_0x1ab9b0['interaction']['id']:0x0);if(_0x20ab47[_0xe0bd('0x14')][_0x2631f5]){_0x20ab47[_0xe0bd('0x14')][_0x2631f5][_0xe0bd('0x31')](_0xe0bd('0x40'));}return _0x2f19ec({'code':0xc8,'message':_0x1ab9b0});}catch(_0x2aa0e3){logger[_0xe0bd('0x34')](_0x2aa0e3[_0xe0bd('0x41')]);return _0x5643eb(_0x334d63[_0xe0bd('0x34')](0x1f4,_0x2aa0e3));}}logger[_0xe0bd('0x34')]('message\x20is\x20empty');return _0x5643eb(_0x334d63[_0xe0bd('0x34')](0x1f4,_0xe0bd('0x3e')));});},'AgentCapacity':function(_0x414e7d){var _0x24cdb8=this;return new Promise(function(_0x508a33,_0x355725){if(_0x20ab47[_0xe0bd('0x36')][_0xe0bd('0x42')](_0x414e7d['id'])){for(var _0x48bb5c in _0x414e7d['capacity']){if(_0x414e7d[_0xe0bd('0x43')][_0xe0bd('0x42')](_0x48bb5c)){if(_0x20ab47['agents'][_0x414e7d['id']][_0xe0bd('0x42')](_0x48bb5c+_0xe0bd('0x44'))){_0x20ab47[_0xe0bd('0x36')][_0x414e7d['id']][_0x48bb5c+_0xe0bd('0x44')]=parseInt(_0x414e7d['capacity'][_0x48bb5c],0xa);}}}_0x20ab47[_0xe0bd('0x36')][_0x414e7d['id']][_0xe0bd('0x45')]();return _0x508a33({'code':0xc8,'message':_0x20ab47[_0xe0bd('0x36')][_0x414e7d['id']]});}else{return _0x355725(_0x24cdb8[_0xe0bd('0x34')](0x1f4,_0xe0bd('0x46')));}});},'Agents':function(_0x189ce8){return new Promise(function(_0xadef32,_0x52e79a){var _0x3e5153=_[_0xe0bd('0x47')](_0x20ab47[_0xe0bd('0x36')]);_0xadef32({'count':_0x3e5153[_0xe0bd('0x1a')],'rows':_0x3e5153});});},'ChatQueues':function(_0x304ede){return new Promise(function(_0x1a2de2,_0x128ad9){var _0x1f995c=[];for(var _0x41412a in _0x20ab47[_0xe0bd('0x48')]){if(_0x20ab47[_0xe0bd('0x48')][_0xe0bd('0x42')](_0x41412a)){var _0x31ab5a=_0x20ab47[_0xe0bd('0x48')][_0x41412a];var _0x410783={'id':_0x31ab5a['id'],'available':_0x31ab5a[_0xe0bd('0x49')],'loggedIn':_0x31ab5a[_0xe0bd('0x4a')],'name':_0x31ab5a[_0xe0bd('0x4b')],'paused':_0x31ab5a[_0xe0bd('0x4c')],'waiting':_0x31ab5a[_0xe0bd('0x4d')]};_0x1f995c[_0xe0bd('0x23')](_0x410783);}}_0x1a2de2({'count':_0x1f995c[_0xe0bd('0x1a')],'rows':_0x1f995c});});},'MailQueues':function(_0x289ab1){return new Promise(function(_0x552d67,_0x4b461a){var _0x3265d6=[];for(var _0x1c088d in _0x20ab47[_0xe0bd('0x4e')]){if(_0x20ab47['mailQueues']['hasOwnProperty'](_0x1c088d)){var _0x57c44e=_0x20ab47[_0xe0bd('0x4e')][_0x1c088d];var _0x209880={'id':_0x57c44e['id'],'available':_0x57c44e['available'],'loggedIn':_0x57c44e[_0xe0bd('0x4a')],'name':_0x57c44e['name'],'paused':_0x57c44e[_0xe0bd('0x4c')],'waiting':_0x57c44e[_0xe0bd('0x4d')]};_0x3265d6[_0xe0bd('0x23')](_0x209880);}}_0x552d67({'count':_0x3265d6['length'],'rows':_0x3265d6});});},'OpenchannelQueues':function(_0x50d740){return new Promise(function(_0x4823ea,_0x13a86e){var _0x1c9407=[];for(var _0xbdf45b in _0x20ab47[_0xe0bd('0x4f')]){if(_0x20ab47[_0xe0bd('0x4f')][_0xe0bd('0x42')](_0xbdf45b)){var _0x4d49ad=_0x20ab47[_0xe0bd('0x4f')][_0xbdf45b];var _0x40a584={'id':_0x4d49ad['id'],'available':_0x4d49ad['available'],'loggedIn':_0x4d49ad[_0xe0bd('0x4a')],'name':_0x4d49ad[_0xe0bd('0x4b')],'paused':_0x4d49ad[_0xe0bd('0x4c')],'waiting':_0x4d49ad[_0xe0bd('0x4d')]};_0x1c9407[_0xe0bd('0x23')](_0x40a584);}}_0x4823ea({'count':_0x1c9407[_0xe0bd('0x1a')],'rows':_0x1c9407});});},'SmsQueues':function(_0x1dd38e){return new Promise(function(_0x3eec2f,_0x50c2e7){var _0x277cca=[];for(var _0x233ef7 in _0x20ab47[_0xe0bd('0x50')]){if(_0x20ab47['smsQueues'][_0xe0bd('0x42')](_0x233ef7)){var _0x26d673=_0x20ab47[_0xe0bd('0x50')][_0x233ef7];var _0x4c7b03={'id':_0x26d673['id'],'available':_0x26d673['available'],'loggedIn':_0x26d673[_0xe0bd('0x4a')],'name':_0x26d673[_0xe0bd('0x4b')],'paused':_0x26d673[_0xe0bd('0x4c')],'waiting':_0x26d673['waiting']};_0x277cca[_0xe0bd('0x23')](_0x4c7b03);}}_0x3eec2f({'count':_0x277cca[_0xe0bd('0x1a')],'rows':_0x277cca});});},'FaxQueues':function(_0x29bbde){return new Promise(function(_0x5215e2,_0x2d60d2){var _0x4b1985=[];for(var _0x52237d in _0x20ab47['faxQueues']){if(_0x20ab47[_0xe0bd('0x51')][_0xe0bd('0x42')](_0x52237d)){var _0x13afd8=_0x20ab47[_0xe0bd('0x51')][_0x52237d];var _0x4ce196={'id':_0x13afd8['id'],'available':_0x13afd8['available'],'loggedIn':_0x13afd8[_0xe0bd('0x4a')],'name':_0x13afd8[_0xe0bd('0x4b')],'paused':_0x13afd8[_0xe0bd('0x4c')],'waiting':_0x13afd8[_0xe0bd('0x4d')]};_0x4b1985[_0xe0bd('0x23')](_0x4ce196);}}_0x5215e2({'count':_0x4b1985[_0xe0bd('0x1a')],'rows':_0x4b1985});});},'WhatsappQueues':function(_0x306b67){return new Promise(function(_0x324ef3,_0x38b0b5){var _0x24ab07=[];for(var _0x49fe83 in _0x20ab47[_0xe0bd('0x52')]){if(_0x20ab47['whatsappQueues'][_0xe0bd('0x42')](_0x49fe83)){var _0x1370ff=_0x20ab47[_0xe0bd('0x52')][_0x49fe83];var _0x38f313={'id':_0x1370ff['id'],'available':_0x1370ff[_0xe0bd('0x49')],'loggedIn':_0x1370ff[_0xe0bd('0x4a')],'name':_0x1370ff[_0xe0bd('0x4b')],'paused':_0x1370ff['paused'],'waiting':_0x1370ff[_0xe0bd('0x4d')]};_0x24ab07[_0xe0bd('0x23')](_0x38f313);}}_0x324ef3({'count':_0x24ab07['length'],'rows':_0x24ab07});});},'ChatQueuesWaitingInteractions':function(_0x4303ec){return new Promise(function(_0x2acb14,_0x1f230d){var _0x4fb0cb=_['values'](_0x20ab47[_0xe0bd('0x53')]);_0x2acb14({'count':_0x4fb0cb[_0xe0bd('0x1a')],'rows':_0x4fb0cb});});},'MailQueuesWaitingInteractions':function(_0x51621e){return new Promise(function(_0x1e5747,_0x435d68){var _0x502d03=_['values'](_0x20ab47[_0xe0bd('0x54')]);_0x1e5747({'count':_0x502d03[_0xe0bd('0x1a')],'rows':_0x502d03});});},'OpenchannelQueuesWaitingInteractions':function(_0x213400){return new Promise(function(_0x6e9712,_0x4e3815){var _0x2a1c72=_['values'](_0x20ab47[_0xe0bd('0x55')]);_0x6e9712({'count':_0x2a1c72[_0xe0bd('0x1a')],'rows':_0x2a1c72});});},'SmsQueuesWaitingInteractions':function(_0x21101a){return new Promise(function(_0x8ca1e0,_0x17a19a){var _0x169cf7=_[_0xe0bd('0x47')](_0x20ab47[_0xe0bd('0x56')]);_0x8ca1e0({'count':_0x169cf7[_0xe0bd('0x1a')],'rows':_0x169cf7});});},'FaxQueuesWaitingInteractions':function(_0x351f37){return new Promise(function(_0x4c7dea,_0x37fbd8){var _0x31b4ee=_[_0xe0bd('0x47')](_0x20ab47['faxQueuesWaitingInteractions']);_0x4c7dea({'count':_0x31b4ee[_0xe0bd('0x1a')],'rows':_0x31b4ee});});},'WhatsappQueuesWaitingInteractions':function(_0xc963ba){return new Promise(function(_0x6a6012,_0x403212){var _0xa1e41b=_[_0xe0bd('0x47')](_0x20ab47['whatsappQueuesWaitingInteractions']);_0x6a6012({'count':_0xa1e41b[_0xe0bd('0x1a')],'rows':_0xa1e41b});});}};var _0x378034=jayson[_0xe0bd('0x57')](_0x210f20)[_0xe0bd('0x58')]();_0x378034['on']('error',function(_0x296324){logger[_0xe0bd('0x34')](JSON[_0xe0bd('0x2f')](_0x296324));return _0x342a68(_0x296324);});_0x378034[_0xe0bd('0x13')](0x232c,_0xe0bd('0x59'),function(){console['log'](_0xe0bd('0x5a'),0x232c);return _0x335f17(_0xe0bd('0x5b')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 88aa2ee..c1b9b5b 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 _0x65ac=['Command','format','iftime\x20%s','then','indexOf','catch','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','stop','util','bluebird','jayson/promise','lodash','../../../config/logger','client','http','request','error','message','result','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','push'];(function(_0x479509,_0x1daf8a){var _0x382da8=function(_0x39d77c){while(--_0x39d77c){_0x479509['push'](_0x479509['shift']());}};_0x382da8(++_0x1daf8a);}(_0x65ac,0x82));var _0xc65a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x65ac[_0x1d1779];return _0x2377e9;};'use strict';var util=require(_0xc65a('0x0'));var BPromise=require(_0xc65a('0x1'));var jayson=require(_0xc65a('0x2'));var _=require(_0xc65a('0x3'));var logger=require(_0xc65a('0x4'))('routing');var client=jayson[_0xc65a('0x5')][_0xc65a('0x6')]({'port':0x232a});function request(_0x1de178,_0x3c9fd0){return new BPromise(function(_0x1149d8,_0x7d63a8){return client[_0xc65a('0x7')](_0x1de178,_0x3c9fd0)['then'](function(_0x2d5e12){if(_0x2d5e12[_0xc65a('0x8')]){return _0x7d63a8(_0x2d5e12[_0xc65a('0x8')][_0xc65a('0x9')]);}else{return _0x1149d8(_0x2d5e12[_0xc65a('0xa')]);}})['catch'](function(_0x4cfc47){return _0x7d63a8(_0x4cfc47);});});}exports['condition']=function(_0x1ccc6f,_0x44185c,_0x233fcb){return function(_0x3949ee){if(_0x233fcb[_0xc65a('0xb')]&&!_0x233fcb[_0xc65a('0xb')][_0x1ccc6f]){logger[_0xc65a('0xc')](_0xc65a('0xd'),_0x1ccc6f);return _0x3949ee['stop']();}var _0x2e4ad2=[];for(var _0x31471e=0x0;_0x31471e<_0x44185c['length'];_0x31471e+=0x1){_0x2e4ad2[_0xc65a('0xe')](request(_0xc65a('0xf'),{'command':util[_0xc65a('0x10')](_0xc65a('0x11'),_0x44185c[_0x31471e])})[_0xc65a('0x12')](function(_0x401600){return _0x401600&&_0x401600[_0xc65a('0x9')]&&_0x401600['message'][_0xc65a('0x13')]('true')>=0x0?!![]:![];})[_0xc65a('0x14')](function(_0x252e09){logger[_0xc65a('0x8')](_0xc65a('0x15'),_0x1ccc6f,_0x44185c[_0x31471e]);}));}BPromise['all'](_0x2e4ad2)[_0xc65a('0x12')](function(_0x5d4c39){var _0x20d2dd=_[_0xc65a('0x16')](_0x5d4c39);logger['info'](_0xc65a('0x17'),_0x1ccc6f,_0x44185c[_0xc65a('0x18')]('\x20|\x20'),_0x20d2dd);_0x3949ee[_0xc65a('0x19')](_0x20d2dd);})[_0xc65a('0x14')](function(_0x124a18){console[_0xc65a('0x1a')](_0x124a18);logger[_0xc65a('0x8')](_0xc65a('0x17'),_0x1ccc6f,_0x44185c[_0xc65a('0x18')](_0xc65a('0x1b')),_0x124a18['stack']);_0x3949ee[_0xc65a('0x1c')]();});};}; \ No newline at end of file +var _0x6b4b=['[%s][INTERVAL]\x20%s','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log','join','stack','util','jayson/promise','lodash','routing','client','http','request','then','error','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','format','iftime\x20%s','message','indexOf','true'];(function(_0x70a208,_0x5487d2){var _0x3a2442=function(_0x45979f){while(--_0x45979f){_0x70a208['push'](_0x70a208['shift']());}};_0x3a2442(++_0x5487d2);}(_0x6b4b,0xd2));var _0xb6b4=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x6b4b[_0x5834bc];return _0x3e183a;};'use strict';var util=require(_0xb6b4('0x0'));var BPromise=require('bluebird');var jayson=require(_0xb6b4('0x1'));var _=require(_0xb6b4('0x2'));var logger=require('../../../config/logger')(_0xb6b4('0x3'));var client=jayson[_0xb6b4('0x4')][_0xb6b4('0x5')]({'port':0x232a});function request(_0x5d1d04,_0x291b72){return new BPromise(function(_0x580a42,_0x3ba6c3){return client[_0xb6b4('0x6')](_0x5d1d04,_0x291b72)[_0xb6b4('0x7')](function(_0x4568f3){if(_0x4568f3['error']){return _0x3ba6c3(_0x4568f3[_0xb6b4('0x8')]['message']);}else{return _0x580a42(_0x4568f3['result']);}})[_0xb6b4('0x9')](function(_0x27e08d){return _0x3ba6c3(_0x27e08d);});});}exports[_0xb6b4('0xa')]=function(_0x2089e1,_0x554064,_0x2e7164){return function(_0x51f352){if(_0x2e7164[_0xb6b4('0xb')]&&!_0x2e7164['rules'][_0x2089e1]){logger[_0xb6b4('0xc')](_0xb6b4('0xd'),_0x2089e1);return _0x51f352[_0xb6b4('0xe')]();}var _0x403c5f=[];for(var _0x45b7e6=0x0;_0x45b7e6<_0x554064[_0xb6b4('0xf')];_0x45b7e6+=0x1){_0x403c5f['push'](request(_0xb6b4('0x10'),{'command':util[_0xb6b4('0x11')](_0xb6b4('0x12'),_0x554064[_0x45b7e6])})[_0xb6b4('0x7')](function(_0x324c5f){return _0x324c5f&&_0x324c5f['message']&&_0x324c5f[_0xb6b4('0x13')][_0xb6b4('0x14')](_0xb6b4('0x15'))>=0x0?!![]:![];})[_0xb6b4('0x9')](function(_0x29a1af){logger['error'](_0xb6b4('0x16'),_0x2089e1,_0x554064[_0x45b7e6]);}));}BPromise['all'](_0x403c5f)[_0xb6b4('0x7')](function(_0x52119e){var _0x103b8c=_['some'](_0x52119e);logger[_0xb6b4('0xc')](_0xb6b4('0x17'),_0x2089e1,_0x554064['join'](_0xb6b4('0x18')),_0x103b8c);_0x51f352[_0xb6b4('0x19')](_0x103b8c);})[_0xb6b4('0x9')](function(_0x9511a7){console[_0xb6b4('0x1a')](_0x9511a7);logger[_0xb6b4('0x8')](_0xb6b4('0x17'),_0x2089e1,_0x554064[_0xb6b4('0x1b')](_0xb6b4('0x18')),_0x9511a7[_0xb6b4('0x1c')]);_0x51f352[_0xb6b4('0xe')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 38b13f1..94a650b 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 _0x4ff4=['secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agentcompleteAt','agent','lodash','util','./utils','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentcomplete','acw','acwtime','acwTimeout','request','destuniqueid','agentcalled','debug','format','[%s][agents][agentcalled]','now','lastevent','called','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnectAt','connectedlinename','connect','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','calleridname','agentcalledAt','secondtransfererlinkedid','ATTENDED'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x4ff4,0x64));var _0x44ff=function(_0x19d24c,_0x62bc50){_0x19d24c=_0x19d24c-0x0;var _0x2fae8d=_0x4ff4[_0x19d24c];return _0x2fae8d;};'use strict';var _=require(_0x44ff('0x0'));var util=require(_0x44ff('0x1'));var utils=require(_0x44ff('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x58aef1,_0xe5165b){utils['info'](util['format'](_0x44ff('0x3'),_0x58aef1[_0x44ff('0x4')],_0x58aef1['channel'],_0x58aef1[_0x44ff('0x5')],_0x58aef1[_0x44ff('0x6')],_0x58aef1['interface'],_0x58aef1[_0x44ff('0x7')],_0x58aef1[_0x44ff('0x8')],_0x58aef1['lastevent']));if(_0x58aef1[_0x44ff('0x5')]){utils[_0x44ff('0x9')](_0x58aef1[_0x44ff('0x5')])[_0x44ff('0xa')](function(_0x3c86e8){if(_0x3c86e8){_0x58aef1[_0x44ff('0xb')]=_0x3c86e8[_0x44ff('0xb')];_0x58aef1['agentacw']=_0x58aef1[_0x44ff('0xc')]?_0x3c86e8[_0x44ff('0xd')]:![];_0x58aef1[_0x44ff('0xe')]=_0x58aef1['agentacw']?_0x3c86e8[_0x44ff('0xf')]:0x0;}utils[_0x44ff('0x10')]('CreateVoiceAgentReport',_0x58aef1);});}else{utils[_0x44ff('0x10')]('CreateVoiceAgentReport',_0x58aef1);}if(_0xe5165b){delete transfers[_0x58aef1['uniqueid']];}else{delete agents[_0x58aef1[_0x44ff('0x11')]];}}exports[_0x44ff('0x12')]=function(_0x4b18c3){try{utils[_0x44ff('0x13')](util[_0x44ff('0x14')](_0x44ff('0x15'),_0x4b18c3[_0x44ff('0x4')]),_0x4b18c3);agents[_0x4b18c3['destuniqueid']]=_0x4b18c3;agents[_0x4b18c3[_0x44ff('0x11')]]['agentcalledAt']=utils[_0x44ff('0x16')]();agents[_0x4b18c3['destuniqueid']][_0x44ff('0x17')]=_0x44ff('0x18');agents[_0x4b18c3[_0x44ff('0x11')]][_0x44ff('0x8')]=null;agents[_0x4b18c3[_0x44ff('0x11')]]['connectedlinename']=null;utils[_0x44ff('0x19')](util[_0x44ff('0x14')](_0x44ff('0x1a'),_0x4b18c3['uniqueid'],agents[_0x4b18c3[_0x44ff('0x11')]]['membername'],_0x4b18c3[_0x44ff('0x11')]));}catch(_0x27cfa1){utils[_0x44ff('0x1b')](util[_0x44ff('0x14')](_0x44ff('0x15'),_0x4b18c3[_0x44ff('0x4')]),_0x27cfa1);}};exports[_0x44ff('0x1c')]=function(_0xbf4580){try{if(!_['isNil'](agents[_0xbf4580[_0x44ff('0x11')]])){utils['debug'](util[_0x44ff('0x14')](_0x44ff('0x1d'),_0xbf4580[_0x44ff('0x4')]),_0xbf4580);utils['info'](util['format'](_0x44ff('0x1e'),_0xbf4580[_0x44ff('0x4')],agents[_0xbf4580[_0x44ff('0x11')]]['membername'],_0xbf4580[_0x44ff('0x11')]));agents[_0xbf4580['destuniqueid']][_0x44ff('0x1c')]=!![];agents[_0xbf4580[_0x44ff('0x11')]][_0x44ff('0x1f')]=utils[_0x44ff('0x16')]();agents[_0xbf4580[_0x44ff('0x11')]][_0x44ff('0x17')]=_0x44ff('0x20');agents[_0xbf4580['destuniqueid']][_0x44ff('0x21')]=_0x44ff('0x20');agents[_0xbf4580[_0x44ff('0x11')]][_0x44ff('0x22')]=_0xbf4580['ringtime']?parseInt(_0xbf4580[_0x44ff('0x23')])/0x3e8:0x0;agents[_0xbf4580[_0x44ff('0x11')]][_0x44ff('0x24')]=0x0;unanswered[_0x44ff('0x25')](_0xbf4580['destuniqueid']);}}catch(_0x26b5f0){utils[_0x44ff('0x1b')](util['format']('[%s][agents][agentringnoanswer]',_0xbf4580[_0x44ff('0x4')]),_0x26b5f0);}};exports[_0x44ff('0x26')]=function(_0x261096){try{_['forIn'](agents,function(_0x3a0d61,_0x26dc71){if(_0x3a0d61[_0x44ff('0x4')]==_0x261096[_0x44ff('0x4')]&&!_['includes'](unanswered,_0x3a0d61[_0x44ff('0x11')])){utils['debug'](util[_0x44ff('0x14')](_0x44ff('0x27'),_0x261096[_0x44ff('0x4')]),_0x261096);utils[_0x44ff('0x19')](util['format'](_0x44ff('0x28'),_0x261096['uniqueid'],_0x3a0d61['membername'],_0x3a0d61[_0x44ff('0x11')]));_0x3a0d61[_0x44ff('0x1c')]=!![];_0x3a0d61[_0x44ff('0x1f')]=utils[_0x44ff('0x16')]();_0x3a0d61[_0x44ff('0x17')]=_0x44ff('0x29');_0x3a0d61[_0x44ff('0x21')]='abandoned';_0x3a0d61['holdtime']=_0x261096[_0x44ff('0x22')];_0x3a0d61['talktime']=0x0;writeDB(_0x3a0d61);}});}catch(_0x26049d){utils[_0x44ff('0x1b')](util[_0x44ff('0x14')](_0x44ff('0x27'),_0x261096[_0x44ff('0x4')]),_0x26049d);}};exports['agentconnect']=function(_0x2f2270){try{if(agents[_0x2f2270[_0x44ff('0x11')]]){utils['debug'](util[_0x44ff('0x14')]('[%s][agents][agentconnect]',_0x2f2270[_0x44ff('0x4')]),_0x2f2270);utils[_0x44ff('0x19')](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x2f2270[_0x44ff('0x4')],agents[_0x2f2270[_0x44ff('0x11')]]['membername'],_0x2f2270['destuniqueid']));agents[_0x2f2270[_0x44ff('0x11')]][_0x44ff('0x2a')]=utils[_0x44ff('0x16')]();agents[_0x2f2270[_0x44ff('0x11')]][_0x44ff('0x8')]=_0x2f2270[_0x44ff('0x8')];agents[_0x2f2270[_0x44ff('0x11')]][_0x44ff('0x2b')]=_0x2f2270[_0x44ff('0x2b')];agents[_0x2f2270[_0x44ff('0x11')]][_0x44ff('0x22')]=_0x2f2270[_0x44ff('0x23')];agents[_0x2f2270['destuniqueid']][_0x44ff('0x17')]=_0x44ff('0x2c');_[_0x44ff('0x2d')](agents,function(_0x5d37bd,_0xd1ceef){if(_0x5d37bd[_0x44ff('0x11')]!=_0x2f2270[_0x44ff('0x11')]&&_0x5d37bd['uniqueid']==_0x2f2270[_0x44ff('0x4')]){_0x5d37bd[_0x44ff('0x24')]=0x0;_0x5d37bd['holdtime']=_0x2f2270[_0x44ff('0x23')];_0x5d37bd['agentringnoanswer']=!![];_0x5d37bd[_0x44ff('0x1f')]=utils[_0x44ff('0x16')]();_0x5d37bd[_0x44ff('0x17')]='answered_elsewhere';_0x5d37bd[_0x44ff('0x21')]=_0x44ff('0x2e');_0x5d37bd[_0x44ff('0x2f')]=_0x2f2270[_0x44ff('0x11')];_0x5d37bd[_0x44ff('0x30')]=_0x2f2270[_0x44ff('0x6')];writeDB(_0x5d37bd);}});}}catch(_0x591bb9){utils[_0x44ff('0x1b')](util['format'](_0x44ff('0x31'),_0x2f2270['uniqueid']),_0x591bb9);}};exports[_0x44ff('0xc')]=function(_0x298712){try{if(!_[_0x44ff('0x32')](agents[_0x298712['destuniqueid']])){utils[_0x44ff('0x13')](util[_0x44ff('0x14')](_0x44ff('0x33'),_0x298712[_0x44ff('0x4')]),_0x298712);utils['info'](util[_0x44ff('0x14')](_0x44ff('0x34'),_0x298712['uniqueid'],agents[_0x298712[_0x44ff('0x11')]][_0x44ff('0x6')],_0x298712[_0x44ff('0x11')]));agents[_0x298712[_0x44ff('0x11')]]['agentcomplete']=!![];agents[_0x298712[_0x44ff('0x11')]]['agentcompleteAt']=utils[_0x44ff('0x16')]();agents[_0x298712[_0x44ff('0x11')]][_0x44ff('0x24')]=utils['diffTime'](agents[_0x298712['destuniqueid']]['agentcompleteAt'],agents[_0x298712['destuniqueid']]['agentconnectAt']);agents[_0x298712['destuniqueid']][_0x44ff('0x21')]=_0x298712[_0x44ff('0x21')];agents[_0x298712[_0x44ff('0x11')]][_0x44ff('0x17')]=_0x44ff('0x35');writeDB(agents[_0x298712[_0x44ff('0x11')]]);}}catch(_0x7d0a39){utils[_0x44ff('0x1b')](util[_0x44ff('0x14')](_0x44ff('0x33'),_0x298712[_0x44ff('0x4')]),_0x7d0a39);}};exports[_0x44ff('0x36')]=function(_0x436274){try{if(!_[_0x44ff('0x32')](agents[_0x436274[_0x44ff('0x37')]])){utils[_0x44ff('0x13')](util[_0x44ff('0x14')]('[%s][agents][blindtransfer]',_0x436274['uniqueid']),_0x436274);utils[_0x44ff('0x19')](util[_0x44ff('0x14')](_0x44ff('0x38'),_0x436274['uniqueid'],agents[_0x436274[_0x44ff('0x37')]][_0x44ff('0x6')],agents[_0x436274[_0x44ff('0x37')]]['uniqueid']));agents[_0x436274[_0x44ff('0x37')]][_0x44ff('0x39')]=!![];agents[_0x436274[_0x44ff('0x37')]][_0x44ff('0x3a')]=_0x44ff('0x3b');agents[_0x436274['transfereruniqueid']][_0x44ff('0x3c')]=_0x436274[_0x44ff('0x3d')];agents[_0x436274[_0x44ff('0x37')]]['transferuniqueid']=agents[_0x436274[_0x44ff('0x37')]][_0x44ff('0x4')];}}catch(_0x13bc0e){utils[_0x44ff('0x1b')](util[_0x44ff('0x14')](_0x44ff('0x3e'),_0x436274[_0x44ff('0x4')]),_0x13bc0e);}};exports[_0x44ff('0x3f')]=function(_0x30fee4){try{utils['debug'](util[_0x44ff('0x14')](_0x44ff('0x40'),_0x30fee4[_0x44ff('0x41')]),_0x30fee4);if(_0x30fee4[_0x44ff('0x41')]==_0x30fee4['origtransfererlinkedid']){if(!_['isNil'](agents[_0x30fee4[_0x44ff('0x42')]])){utils[_0x44ff('0x19')](util[_0x44ff('0x14')](_0x44ff('0x43'),_0x30fee4[_0x44ff('0x41')],agents[_0x30fee4['secondtransfereruniqueid']]['membername']));agents[_0x30fee4[_0x44ff('0x42')]][_0x44ff('0x39')]=!![];agents[_0x30fee4[_0x44ff('0x42')]][_0x44ff('0x3a')]='ATTENDED';agents[_0x30fee4[_0x44ff('0x42')]][_0x44ff('0x3c')]=_0x30fee4[_0x44ff('0x44')];agents[_0x30fee4[_0x44ff('0x42')]][_0x44ff('0x45')]=_0x30fee4[_0x44ff('0x41')];}if(_0x30fee4[_0x44ff('0x46')]&&agents[_0x30fee4[_0x44ff('0x46')]]){agents[_0x30fee4[_0x44ff('0x46')]][_0x44ff('0x47')]=0x1;transfers[_0x30fee4['transfereeuniqueid']]=_['clone'](agents[_0x30fee4[_0x44ff('0x46')]]);transfers[_0x30fee4[_0x44ff('0x46')]][_0x44ff('0x7')]=agents[_0x30fee4['secondtransfereruniqueid']][_0x44ff('0x7')];transfers[_0x30fee4[_0x44ff('0x46')]][_0x44ff('0x48')]=agents[_0x30fee4[_0x44ff('0x42')]][_0x44ff('0x48')];transfers[_0x30fee4['transfereeuniqueid']][_0x44ff('0x49')]=utils[_0x44ff('0x16')]();transfers[_0x30fee4[_0x44ff('0x46')]]['agentconnectAt']=utils[_0x44ff('0x16')]();transfers[_0x30fee4[_0x44ff('0x46')]][_0x44ff('0x22')]=0x0;transfers[_0x30fee4[_0x44ff('0x46')]]['agententerreason']=0x2;}}else if(_0x30fee4[_0x44ff('0x42')]==_0x30fee4[_0x44ff('0x4a')]){if(!_['isNil'](agents[_0x30fee4[_0x44ff('0x41')]])){utils['info'](util[_0x44ff('0x14')](_0x44ff('0x43'),_0x30fee4[_0x44ff('0x41')],agents[_0x30fee4[_0x44ff('0x41')]]['membername']));agents[_0x30fee4[_0x44ff('0x41')]][_0x44ff('0x39')]=!![];agents[_0x30fee4[_0x44ff('0x41')]][_0x44ff('0x3a')]=_0x44ff('0x4b');agents[_0x30fee4['origtransfereruniqueid']]['transferexten']=_0x30fee4[_0x44ff('0x4c')];agents[_0x30fee4[_0x44ff('0x41')]]['transferuniqueid']=_0x30fee4[_0x44ff('0x42')];}if(_0x30fee4['transfertargetuniqueid']&&agents[_0x30fee4[_0x44ff('0x4d')]]){agents[_0x30fee4[_0x44ff('0x4d')]][_0x44ff('0x47')]=0x1;transfers[_0x30fee4[_0x44ff('0x4d')]]=_['clone'](agents[_0x30fee4[_0x44ff('0x4d')]]);transfers[_0x30fee4[_0x44ff('0x4d')]][_0x44ff('0x7')]=agents[_0x30fee4['origtransfereruniqueid']][_0x44ff('0x7')];transfers[_0x30fee4['transfertargetuniqueid']][_0x44ff('0x48')]=agents[_0x30fee4[_0x44ff('0x41')]][_0x44ff('0x48')];transfers[_0x30fee4[_0x44ff('0x4d')]][_0x44ff('0x49')]=utils[_0x44ff('0x16')]();transfers[_0x30fee4[_0x44ff('0x4d')]][_0x44ff('0x2a')]=utils[_0x44ff('0x16')]();transfers[_0x30fee4[_0x44ff('0x4d')]][_0x44ff('0x22')]=0x0;transfers[_0x30fee4[_0x44ff('0x4d')]][_0x44ff('0x47')]=0x2;}}}catch(_0x2a1b04){utils[_0x44ff('0x1b')](util['format']('[%s][agents][attendedtransfer]',_0x30fee4[_0x44ff('0x41')]),_0x2a1b04);}};exports[_0x44ff('0x4e')]=function(_0x35aaae){try{utils[_0x44ff('0x13')](util[_0x44ff('0x14')](_0x44ff('0x4f'),_0x35aaae[_0x44ff('0x4')]),_0x35aaae);if(agents[_0x35aaae['uniqueid']]&&agents[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x21')]==='timeout'){if(_0x35aaae[_0x44ff('0x50')]==='21'){agents[_0x35aaae[_0x44ff('0x4')]]['reason']=_0x44ff('0x51');agents[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x17')]=_0x44ff('0x51');}utils[_0x44ff('0x19')](util[_0x44ff('0x14')](_0x44ff('0x52'),_0x35aaae[_0x44ff('0x4')],agents[_0x35aaae['uniqueid']][_0x44ff('0x6')],agents[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x21')],agents[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x17')]));writeDB(agents[_0x35aaae[_0x44ff('0x4')]]);var _0x5ace85=unanswered[_0x44ff('0x53')](_0x35aaae[_0x44ff('0x4')]);if(_0x5ace85>-0x1){unanswered[_0x44ff('0x54')](_0x5ace85,0x1);}}if(transfers[_0x35aaae[_0x44ff('0x4')]]){transfers[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0xc')]=!![];transfers[_0x35aaae[_0x44ff('0x4')]]['agentcompleteAt']=utils[_0x44ff('0x16')]();transfers[_0x35aaae[_0x44ff('0x4')]]['talktime']=utils[_0x44ff('0x55')](transfers[_0x35aaae[_0x44ff('0x4')]]['agentcompleteAt'],transfers[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x2a')]);transfers[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x21')]='agent';transfers[_0x35aaae[_0x44ff('0x4')]]['lastevent']=_0x44ff('0x35');utils[_0x44ff('0x19')](util[_0x44ff('0x14')](_0x44ff('0x52'),_0x35aaae[_0x44ff('0x4')],transfers[_0x35aaae['uniqueid']][_0x44ff('0x6')],transfers[_0x35aaae['uniqueid']][_0x44ff('0x21')],transfers[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x17')]));writeDB(transfers[_0x35aaae[_0x44ff('0x4')]],!![]);}if(agents[_0x35aaae[_0x44ff('0x4')]]&&agents[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x2a')]){agents[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0xc')]=!![];agents[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x56')]=utils[_0x44ff('0x16')]();agents[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x24')]=utils['diffTime'](agents[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x56')],agents[_0x35aaae[_0x44ff('0x4')]]['agentconnectAt']);agents[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x21')]=agents[_0x35aaae[_0x44ff('0x4')]]['transfer']?_0x44ff('0x39'):_0x44ff('0x57');agents[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x17')]=_0x44ff('0x35');utils['info'](util[_0x44ff('0x14')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x35aaae[_0x44ff('0x4')],agents[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x6')],agents[_0x35aaae[_0x44ff('0x4')]][_0x44ff('0x21')],agents[_0x35aaae[_0x44ff('0x4')]]['lastevent']));writeDB(agents[_0x35aaae[_0x44ff('0x4')]]);}}catch(_0xc20ed1){utils[_0x44ff('0x1b')](util[_0x44ff('0x14')](_0x44ff('0x4f'),_0x35aaae[_0x44ff('0x4')]),_0xc20ed1);}}; \ No newline at end of file +var _0xc0a9=['[%s][agents][agentcalled]','agentcalledAt','now','connectedlinename','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','lastevent','reason','timeout','holdtime','ringtime','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','diffTime','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','calleridnum','connectedlinenum','queue','getVoiceQueueByName','then','type','agentacw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug'];(function(_0x2b406c,_0x4730ca){var _0x40680e=function(_0x559899){while(--_0x559899){_0x2b406c['push'](_0x2b406c['shift']());}};_0x40680e(++_0x4730ca);}(_0xc0a9,0x1c5));var _0x9c0a=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0xc0a9[_0x2f45ea];return _0x485a84;};'use strict';var _=require(_0x9c0a('0x0'));var util=require(_0x9c0a('0x1'));var utils=require(_0x9c0a('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5d0f07,_0x4e7157){utils[_0x9c0a('0x3')](util[_0x9c0a('0x4')](_0x9c0a('0x5'),_0x5d0f07[_0x9c0a('0x6')],_0x5d0f07['channel'],_0x5d0f07['queue'],_0x5d0f07['membername'],_0x5d0f07['interface'],_0x5d0f07[_0x9c0a('0x7')],_0x5d0f07[_0x9c0a('0x8')],_0x5d0f07['lastevent']));if(_0x5d0f07[_0x9c0a('0x9')]){utils[_0x9c0a('0xa')](_0x5d0f07['queue'])[_0x9c0a('0xb')](function(_0x5dd4b3){if(_0x5dd4b3){_0x5d0f07[_0x9c0a('0xc')]=_0x5dd4b3['type'];_0x5d0f07[_0x9c0a('0xd')]=_0x5d0f07['agentcomplete']?_0x5dd4b3['acw']:![];_0x5d0f07[_0x9c0a('0xe')]=_0x5d0f07[_0x9c0a('0xd')]?_0x5dd4b3[_0x9c0a('0xf')]:0x0;}utils[_0x9c0a('0x10')](_0x9c0a('0x11'),_0x5d0f07);});}else{utils[_0x9c0a('0x10')](_0x9c0a('0x11'),_0x5d0f07);}if(_0x4e7157){delete transfers[_0x5d0f07['uniqueid']];}else{delete agents[_0x5d0f07[_0x9c0a('0x12')]];}}exports[_0x9c0a('0x13')]=function(_0x5af79c){try{utils[_0x9c0a('0x14')](util['format'](_0x9c0a('0x15'),_0x5af79c[_0x9c0a('0x6')]),_0x5af79c);agents[_0x5af79c[_0x9c0a('0x12')]]=_0x5af79c;agents[_0x5af79c[_0x9c0a('0x12')]][_0x9c0a('0x16')]=utils[_0x9c0a('0x17')]();agents[_0x5af79c['destuniqueid']]['lastevent']='called';agents[_0x5af79c['destuniqueid']]['connectedlinenum']=null;agents[_0x5af79c[_0x9c0a('0x12')]][_0x9c0a('0x18')]=null;utils[_0x9c0a('0x3')](util[_0x9c0a('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x5af79c[_0x9c0a('0x6')],agents[_0x5af79c[_0x9c0a('0x12')]][_0x9c0a('0x19')],_0x5af79c[_0x9c0a('0x12')]));}catch(_0x477571){utils[_0x9c0a('0x1a')](util['format'](_0x9c0a('0x15'),_0x5af79c[_0x9c0a('0x6')]),_0x477571);}};exports[_0x9c0a('0x1b')]=function(_0x55ba02){try{if(!_[_0x9c0a('0x1c')](agents[_0x55ba02['destuniqueid']])){utils[_0x9c0a('0x14')](util[_0x9c0a('0x4')](_0x9c0a('0x1d'),_0x55ba02[_0x9c0a('0x6')]),_0x55ba02);utils['info'](util[_0x9c0a('0x4')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x55ba02[_0x9c0a('0x6')],agents[_0x55ba02[_0x9c0a('0x12')]][_0x9c0a('0x19')],_0x55ba02[_0x9c0a('0x12')]));agents[_0x55ba02['destuniqueid']][_0x9c0a('0x1b')]=!![];agents[_0x55ba02['destuniqueid']][_0x9c0a('0x1e')]=utils[_0x9c0a('0x17')]();agents[_0x55ba02['destuniqueid']][_0x9c0a('0x1f')]='timeout';agents[_0x55ba02['destuniqueid']][_0x9c0a('0x20')]=_0x9c0a('0x21');agents[_0x55ba02[_0x9c0a('0x12')]][_0x9c0a('0x22')]=_0x55ba02[_0x9c0a('0x23')]?parseInt(_0x55ba02[_0x9c0a('0x23')])/0x3e8:0x0;agents[_0x55ba02[_0x9c0a('0x12')]]['talktime']=0x0;unanswered['push'](_0x55ba02[_0x9c0a('0x12')]);}}catch(_0x579039){utils[_0x9c0a('0x1a')](util[_0x9c0a('0x4')]('[%s][agents][agentringnoanswer]',_0x55ba02['uniqueid']),_0x579039);}};exports['queuecallerabandon']=function(_0x2713f6){try{_[_0x9c0a('0x24')](agents,function(_0x53ccc9,_0x2eb0eb){if(_0x53ccc9[_0x9c0a('0x6')]==_0x2713f6['uniqueid']&&!_[_0x9c0a('0x25')](unanswered,_0x53ccc9[_0x9c0a('0x12')])){utils[_0x9c0a('0x14')](util[_0x9c0a('0x4')](_0x9c0a('0x26'),_0x2713f6[_0x9c0a('0x6')]),_0x2713f6);utils[_0x9c0a('0x3')](util['format']('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2713f6[_0x9c0a('0x6')],_0x53ccc9['membername'],_0x53ccc9['destuniqueid']));_0x53ccc9[_0x9c0a('0x1b')]=!![];_0x53ccc9[_0x9c0a('0x1e')]=utils[_0x9c0a('0x17')]();_0x53ccc9[_0x9c0a('0x1f')]=_0x9c0a('0x27');_0x53ccc9['reason']=_0x9c0a('0x27');_0x53ccc9[_0x9c0a('0x22')]=_0x2713f6[_0x9c0a('0x22')];_0x53ccc9[_0x9c0a('0x28')]=0x0;writeDB(_0x53ccc9);}});}catch(_0x4ea3c1){utils[_0x9c0a('0x1a')](util[_0x9c0a('0x4')](_0x9c0a('0x26'),_0x2713f6[_0x9c0a('0x6')]),_0x4ea3c1);}};exports[_0x9c0a('0x29')]=function(_0x1da7fe){try{if(agents[_0x1da7fe[_0x9c0a('0x12')]]){utils[_0x9c0a('0x14')](util[_0x9c0a('0x4')](_0x9c0a('0x2a'),_0x1da7fe[_0x9c0a('0x6')]),_0x1da7fe);utils[_0x9c0a('0x3')](util[_0x9c0a('0x4')](_0x9c0a('0x2b'),_0x1da7fe[_0x9c0a('0x6')],agents[_0x1da7fe['destuniqueid']]['membername'],_0x1da7fe[_0x9c0a('0x12')]));agents[_0x1da7fe[_0x9c0a('0x12')]][_0x9c0a('0x2c')]=utils[_0x9c0a('0x17')]();agents[_0x1da7fe[_0x9c0a('0x12')]]['connectedlinenum']=_0x1da7fe[_0x9c0a('0x8')];agents[_0x1da7fe[_0x9c0a('0x12')]][_0x9c0a('0x18')]=_0x1da7fe['connectedlinename'];agents[_0x1da7fe[_0x9c0a('0x12')]]['holdtime']=_0x1da7fe['ringtime'];agents[_0x1da7fe[_0x9c0a('0x12')]]['lastevent']=_0x9c0a('0x2d');_['forIn'](agents,function(_0x524f08,_0x30c9ff){if(_0x524f08[_0x9c0a('0x12')]!=_0x1da7fe['destuniqueid']&&_0x524f08[_0x9c0a('0x6')]==_0x1da7fe[_0x9c0a('0x6')]){_0x524f08[_0x9c0a('0x28')]=0x0;_0x524f08[_0x9c0a('0x22')]=_0x1da7fe[_0x9c0a('0x23')];_0x524f08['agentringnoanswer']=!![];_0x524f08['agentringnoanswerAt']=utils['now']();_0x524f08[_0x9c0a('0x1f')]=_0x9c0a('0x2e');_0x524f08[_0x9c0a('0x20')]='answered_elsewhere';_0x524f08['answeredelsewheredestinationuniqueid']=_0x1da7fe[_0x9c0a('0x12')];_0x524f08[_0x9c0a('0x2f')]=_0x1da7fe['membername'];writeDB(_0x524f08);}});}}catch(_0x4df659){utils[_0x9c0a('0x1a')](util[_0x9c0a('0x4')](_0x9c0a('0x2a'),_0x1da7fe[_0x9c0a('0x6')]),_0x4df659);}};exports[_0x9c0a('0x30')]=function(_0x2c2e75){try{if(!_[_0x9c0a('0x1c')](agents[_0x2c2e75[_0x9c0a('0x12')]])){utils[_0x9c0a('0x14')](util['format']('[%s][agents][agentcomplete]',_0x2c2e75[_0x9c0a('0x6')]),_0x2c2e75);utils[_0x9c0a('0x3')](util['format'](_0x9c0a('0x31'),_0x2c2e75[_0x9c0a('0x6')],agents[_0x2c2e75[_0x9c0a('0x12')]][_0x9c0a('0x19')],_0x2c2e75[_0x9c0a('0x12')]));agents[_0x2c2e75[_0x9c0a('0x12')]][_0x9c0a('0x30')]=!![];agents[_0x2c2e75[_0x9c0a('0x12')]][_0x9c0a('0x32')]=utils[_0x9c0a('0x17')]();agents[_0x2c2e75[_0x9c0a('0x12')]]['talktime']=utils['diffTime'](agents[_0x2c2e75[_0x9c0a('0x12')]]['agentcompleteAt'],agents[_0x2c2e75[_0x9c0a('0x12')]][_0x9c0a('0x2c')]);agents[_0x2c2e75[_0x9c0a('0x12')]][_0x9c0a('0x20')]=_0x2c2e75['reason'];agents[_0x2c2e75[_0x9c0a('0x12')]]['lastevent']=_0x9c0a('0x33');writeDB(agents[_0x2c2e75[_0x9c0a('0x12')]]);}}catch(_0x1e2ea0){utils[_0x9c0a('0x1a')](util[_0x9c0a('0x4')]('[%s][agents][agentcomplete]',_0x2c2e75['uniqueid']),_0x1e2ea0);}};exports['blindtransfer']=function(_0x428f74){try{if(!_['isNil'](agents[_0x428f74[_0x9c0a('0x34')]])){utils[_0x9c0a('0x14')](util[_0x9c0a('0x4')](_0x9c0a('0x35'),_0x428f74[_0x9c0a('0x6')]),_0x428f74);utils[_0x9c0a('0x3')](util['format'](_0x9c0a('0x36'),_0x428f74['uniqueid'],agents[_0x428f74['transfereruniqueid']][_0x9c0a('0x19')],agents[_0x428f74[_0x9c0a('0x34')]][_0x9c0a('0x6')]));agents[_0x428f74[_0x9c0a('0x34')]][_0x9c0a('0x37')]=!![];agents[_0x428f74[_0x9c0a('0x34')]][_0x9c0a('0x38')]='blind';agents[_0x428f74[_0x9c0a('0x34')]][_0x9c0a('0x39')]=_0x428f74[_0x9c0a('0x3a')];agents[_0x428f74[_0x9c0a('0x34')]][_0x9c0a('0x3b')]=agents[_0x428f74[_0x9c0a('0x34')]][_0x9c0a('0x6')];}}catch(_0xc84415){utils['error'](util[_0x9c0a('0x4')](_0x9c0a('0x35'),_0x428f74[_0x9c0a('0x6')]),_0xc84415);}};exports[_0x9c0a('0x3c')]=function(_0xb1944b){try{utils[_0x9c0a('0x14')](util[_0x9c0a('0x4')](_0x9c0a('0x3d'),_0xb1944b[_0x9c0a('0x3e')]),_0xb1944b);if(_0xb1944b[_0x9c0a('0x3e')]==_0xb1944b[_0x9c0a('0x3f')]){if(!_[_0x9c0a('0x1c')](agents[_0xb1944b[_0x9c0a('0x40')]])){utils['info'](util[_0x9c0a('0x4')](_0x9c0a('0x41'),_0xb1944b[_0x9c0a('0x3e')],agents[_0xb1944b[_0x9c0a('0x40')]][_0x9c0a('0x19')]));agents[_0xb1944b[_0x9c0a('0x40')]][_0x9c0a('0x37')]=!![];agents[_0xb1944b['secondtransfereruniqueid']][_0x9c0a('0x38')]=_0x9c0a('0x42');agents[_0xb1944b[_0x9c0a('0x40')]][_0x9c0a('0x39')]=_0xb1944b['origtransfererexten'];agents[_0xb1944b[_0x9c0a('0x40')]][_0x9c0a('0x3b')]=_0xb1944b[_0x9c0a('0x3e')];}if(_0xb1944b[_0x9c0a('0x43')]&&agents[_0xb1944b[_0x9c0a('0x43')]]){agents[_0xb1944b[_0x9c0a('0x43')]]['agententerreason']=0x1;transfers[_0xb1944b[_0x9c0a('0x43')]]=_[_0x9c0a('0x44')](agents[_0xb1944b[_0x9c0a('0x43')]]);transfers[_0xb1944b['transfereeuniqueid']][_0x9c0a('0x7')]=agents[_0xb1944b[_0x9c0a('0x40')]][_0x9c0a('0x7')];transfers[_0xb1944b[_0x9c0a('0x43')]][_0x9c0a('0x45')]=agents[_0xb1944b[_0x9c0a('0x40')]][_0x9c0a('0x45')];transfers[_0xb1944b[_0x9c0a('0x43')]][_0x9c0a('0x16')]=utils[_0x9c0a('0x17')]();transfers[_0xb1944b[_0x9c0a('0x43')]][_0x9c0a('0x2c')]=utils['now']();transfers[_0xb1944b[_0x9c0a('0x43')]]['holdtime']=0x0;transfers[_0xb1944b[_0x9c0a('0x43')]][_0x9c0a('0x46')]=0x2;}}else if(_0xb1944b[_0x9c0a('0x40')]==_0xb1944b['secondtransfererlinkedid']){if(!_[_0x9c0a('0x1c')](agents[_0xb1944b[_0x9c0a('0x3e')]])){utils[_0x9c0a('0x3')](util['format'](_0x9c0a('0x41'),_0xb1944b[_0x9c0a('0x3e')],agents[_0xb1944b[_0x9c0a('0x3e')]][_0x9c0a('0x19')]));agents[_0xb1944b['origtransfereruniqueid']][_0x9c0a('0x37')]=!![];agents[_0xb1944b['origtransfereruniqueid']]['transfertype']=_0x9c0a('0x42');agents[_0xb1944b[_0x9c0a('0x3e')]]['transferexten']=_0xb1944b[_0x9c0a('0x47')];agents[_0xb1944b[_0x9c0a('0x3e')]]['transferuniqueid']=_0xb1944b[_0x9c0a('0x40')];}if(_0xb1944b['transfertargetuniqueid']&&agents[_0xb1944b[_0x9c0a('0x48')]]){agents[_0xb1944b[_0x9c0a('0x48')]][_0x9c0a('0x46')]=0x1;transfers[_0xb1944b[_0x9c0a('0x48')]]=_['clone'](agents[_0xb1944b[_0x9c0a('0x48')]]);transfers[_0xb1944b[_0x9c0a('0x48')]][_0x9c0a('0x7')]=agents[_0xb1944b['origtransfereruniqueid']][_0x9c0a('0x7')];transfers[_0xb1944b[_0x9c0a('0x48')]][_0x9c0a('0x45')]=agents[_0xb1944b['origtransfereruniqueid']][_0x9c0a('0x45')];transfers[_0xb1944b['transfertargetuniqueid']]['agentcalledAt']=utils[_0x9c0a('0x17')]();transfers[_0xb1944b['transfertargetuniqueid']][_0x9c0a('0x2c')]=utils[_0x9c0a('0x17')]();transfers[_0xb1944b[_0x9c0a('0x48')]][_0x9c0a('0x22')]=0x0;transfers[_0xb1944b['transfertargetuniqueid']][_0x9c0a('0x46')]=0x2;}}}catch(_0x4f19b2){utils[_0x9c0a('0x1a')](util['format'](_0x9c0a('0x3d'),_0xb1944b['origtransfereruniqueid']),_0x4f19b2);}};exports['hangup']=function(_0x176ffd){try{utils['debug'](util[_0x9c0a('0x4')](_0x9c0a('0x49'),_0x176ffd['uniqueid']),_0x176ffd);if(agents[_0x176ffd[_0x9c0a('0x6')]]&&agents[_0x176ffd[_0x9c0a('0x6')]][_0x9c0a('0x20')]===_0x9c0a('0x21')){if(_0x176ffd['cause']==='21'){agents[_0x176ffd[_0x9c0a('0x6')]]['reason']='rejected';agents[_0x176ffd[_0x9c0a('0x6')]]['lastevent']=_0x9c0a('0x4a');}utils[_0x9c0a('0x3')](util[_0x9c0a('0x4')](_0x9c0a('0x4b'),_0x176ffd['uniqueid'],agents[_0x176ffd[_0x9c0a('0x6')]][_0x9c0a('0x19')],agents[_0x176ffd[_0x9c0a('0x6')]][_0x9c0a('0x20')],agents[_0x176ffd[_0x9c0a('0x6')]][_0x9c0a('0x1f')]));writeDB(agents[_0x176ffd[_0x9c0a('0x6')]]);var _0x54ca32=unanswered[_0x9c0a('0x4c')](_0x176ffd[_0x9c0a('0x6')]);if(_0x54ca32>-0x1){unanswered['splice'](_0x54ca32,0x1);}}if(transfers[_0x176ffd[_0x9c0a('0x6')]]){transfers[_0x176ffd[_0x9c0a('0x6')]][_0x9c0a('0x30')]=!![];transfers[_0x176ffd[_0x9c0a('0x6')]][_0x9c0a('0x32')]=utils[_0x9c0a('0x17')]();transfers[_0x176ffd[_0x9c0a('0x6')]][_0x9c0a('0x28')]=utils[_0x9c0a('0x4d')](transfers[_0x176ffd[_0x9c0a('0x6')]][_0x9c0a('0x32')],transfers[_0x176ffd[_0x9c0a('0x6')]][_0x9c0a('0x2c')]);transfers[_0x176ffd[_0x9c0a('0x6')]][_0x9c0a('0x20')]=_0x9c0a('0x4e');transfers[_0x176ffd[_0x9c0a('0x6')]][_0x9c0a('0x1f')]=_0x9c0a('0x33');utils[_0x9c0a('0x3')](util[_0x9c0a('0x4')](_0x9c0a('0x4b'),_0x176ffd[_0x9c0a('0x6')],transfers[_0x176ffd[_0x9c0a('0x6')]][_0x9c0a('0x19')],transfers[_0x176ffd['uniqueid']]['reason'],transfers[_0x176ffd[_0x9c0a('0x6')]][_0x9c0a('0x1f')]));writeDB(transfers[_0x176ffd[_0x9c0a('0x6')]],!![]);}if(agents[_0x176ffd['uniqueid']]&&agents[_0x176ffd['uniqueid']][_0x9c0a('0x2c')]){agents[_0x176ffd[_0x9c0a('0x6')]]['agentcomplete']=!![];agents[_0x176ffd[_0x9c0a('0x6')]][_0x9c0a('0x32')]=utils['now']();agents[_0x176ffd[_0x9c0a('0x6')]][_0x9c0a('0x28')]=utils[_0x9c0a('0x4d')](agents[_0x176ffd[_0x9c0a('0x6')]][_0x9c0a('0x32')],agents[_0x176ffd[_0x9c0a('0x6')]][_0x9c0a('0x2c')]);agents[_0x176ffd[_0x9c0a('0x6')]]['reason']=agents[_0x176ffd[_0x9c0a('0x6')]][_0x9c0a('0x37')]?_0x9c0a('0x37'):_0x9c0a('0x4e');agents[_0x176ffd[_0x9c0a('0x6')]][_0x9c0a('0x1f')]=_0x9c0a('0x33');utils[_0x9c0a('0x3')](util['format'](_0x9c0a('0x4b'),_0x176ffd['uniqueid'],agents[_0x176ffd[_0x9c0a('0x6')]][_0x9c0a('0x19')],agents[_0x176ffd[_0x9c0a('0x6')]]['reason'],agents[_0x176ffd[_0x9c0a('0x6')]][_0x9c0a('0x1f')]));writeDB(agents[_0x176ffd[_0x9c0a('0x6')]]);}}catch(_0x1607f5){utils['error'](util[_0x9c0a('0x4')](_0x9c0a('0x49'),_0x176ffd[_0x9c0a('0x6')]),_0x1607f5);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 5713261..c303a8f 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 _0xf5c3=['xmd-queue','xmcs-queue','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','includes','hangup','noop','execif','gotoif','lastapplication','[%s][calls][newexten]','lodash','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','context','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','debug','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','destinationchannel','secondtransfererchannel','_attended','transfertargetchannel','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','variable','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-callerid'];(function(_0x28578d,_0xcf5cf0){var _0x524826=function(_0x4a51b7){while(--_0x4a51b7){_0x28578d['push'](_0x28578d['shift']());}};_0x524826(++_0xcf5cf0);}(_0xf5c3,0x8a));var _0x3f5c=function(_0x4c56af,_0x462937){_0x4c56af=_0x4c56af-0x0;var _0x56658d=_0xf5c3[_0x4c56af];return _0x56658d;};'use strict';var _=require(_0x3f5c('0x0'));var util=require('util');var utils=require(_0x3f5c('0x1'));var dispositions=[_0x3f5c('0x2'),_0x3f5c('0x3'),'FAILED',_0x3f5c('0x2'),_0x3f5c('0x2'),_0x3f5c('0x2'),_0x3f5c('0x4'),_0x3f5c('0x5'),_0x3f5c('0x3'),_0x3f5c('0x3'),'FAILED'];var channels={};function writeDB(_0x380ee6){utils[_0x3f5c('0x6')](util[_0x3f5c('0x7')](_0x3f5c('0x8'),_0x380ee6[_0x3f5c('0x9')],_0x380ee6[_0x3f5c('0xa')],_0x380ee6[_0x3f5c('0xb')],_0x380ee6[_0x3f5c('0xc')],_0x380ee6[_0x3f5c('0xd')],_0x380ee6[_0x3f5c('0xe')],_0x380ee6[_0x3f5c('0xf')],_0x380ee6[_0x3f5c('0x10')]));if(_0x380ee6[_0x3f5c('0x11')]){utils[_0x3f5c('0x12')](_0x380ee6[_0x3f5c('0x11')])[_0x3f5c('0x13')](function(_0x1c0488){if(_0x1c0488){_0x380ee6[_0x3f5c('0x14')]=_0x1c0488['id'];}utils[_0x3f5c('0x15')](_0x3f5c('0x16'),_0x380ee6);});}else{utils[_0x3f5c('0x15')](_0x3f5c('0x16'),_0x380ee6);}if(channels[_0x380ee6[_0x3f5c('0x9')]]){delete channels[_0x380ee6[_0x3f5c('0x9')]];}}exports[_0x3f5c('0x17')]=function(_0x3d3985){try{utils['debug'](util[_0x3f5c('0x7')](_0x3f5c('0x18'),_0x3d3985['uniqueid']),_0x3d3985);if(_0x3d3985['uniqueid']==_0x3d3985[_0x3f5c('0x19')]&&_0x3d3985[_0x3f5c('0xa')]!=_0x3f5c('0x1a')){utils[_0x3f5c('0x6')](util['format'](_0x3f5c('0x1b'),_0x3d3985[_0x3f5c('0x9')],_0x3d3985['context'],_0x3d3985[_0x3f5c('0x1c')]));channels[_0x3d3985[_0x3f5c('0x9')]]={'uniqueid':_0x3d3985['uniqueid'],'accountcode':_0x3d3985[_0x3f5c('0x11')],'source':_0x3d3985[_0x3f5c('0xe')],'destination':_0x3d3985[_0x3f5c('0x1c')],'destinationcontext':_0x3d3985['context'],'channel':_0x3d3985['channel'],'starttime':utils[_0x3f5c('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x3f5c('0x2'),'amaflags':_0x3f5c('0x1e')};}}catch(_0x201827){utils[_0x3f5c('0x1f')](util[_0x3f5c('0x7')]('[%s][calls][newchannel]',_0x3d3985[_0x3f5c('0x9')]),_0x201827);}};exports[_0x3f5c('0x20')]=function(_0x2971b0){try{utils['debug'](util[_0x3f5c('0x7')](_0x3f5c('0x21'),_0x2971b0[_0x3f5c('0x9')]),_0x2971b0);if(!_[_0x3f5c('0x22')](channels[_0x2971b0['uniqueid']])&&_0x2971b0[_0x3f5c('0x23')]==0x6){utils['info'](util[_0x3f5c('0x7')](_0x3f5c('0x24'),_0x2971b0['uniqueid'],_0x2971b0['context'],_0x2971b0[_0x3f5c('0xa')]));if(_['isNil'](channels[_0x2971b0[_0x3f5c('0x9')]][_0x3f5c('0x25')])){channels[_0x2971b0['uniqueid']]['systemanswertime']=utils[_0x3f5c('0x1d')]();}}else if(!_[_0x3f5c('0x22')](channels[_0x2971b0[_0x3f5c('0x19')]])&&_0x2971b0['channelstate']==0x6&&_0x2971b0[_0x3f5c('0x26')]!=_0x3f5c('0x27')){utils[_0x3f5c('0x6')](util['format'](_0x3f5c('0x28'),_0x2971b0[_0x3f5c('0x9')],_0x2971b0['linkedid'],_0x2971b0['context'],_0x2971b0[_0x3f5c('0xa')]));channels[_0x2971b0['linkedid']][_0x3f5c('0x11')]=_0x2971b0['accountcode'];channels[_0x2971b0[_0x3f5c('0x19')]]['destinationchannel']=_0x2971b0[_0x3f5c('0xa')];if(_[_0x3f5c('0x22')](channels[_0x2971b0[_0x3f5c('0x19')]][_0x3f5c('0x29')])){channels[_0x2971b0[_0x3f5c('0x19')]][_0x3f5c('0x29')]=utils[_0x3f5c('0x1d')]();}channels[_0x2971b0['linkedid']][_0x3f5c('0x2a')]=dispositions[_['toNumber'](_0x2971b0[_0x3f5c('0x23')])]||'ANSWERED';}}catch(_0x491f32){utils[_0x3f5c('0x1f')](util[_0x3f5c('0x7')](_0x3f5c('0x21'),_0x2971b0[_0x3f5c('0x9')]),_0x491f32);}};exports['hangup']=function(_0x5e1eb2){try{if(!_[_0x3f5c('0x22')](channels[_0x5e1eb2[_0x3f5c('0x9')]])){utils['debug'](util[_0x3f5c('0x7')](_0x3f5c('0x2b'),_0x5e1eb2['uniqueid']),_0x5e1eb2);if(_[_0x3f5c('0x22')](channels[_0x5e1eb2[_0x3f5c('0x9')]][_0x3f5c('0x2c')])){channels[_0x5e1eb2['uniqueid']]['callerid']=_0x5e1eb2[_0x3f5c('0x2d')]+'\x20<'+_0x5e1eb2[_0x3f5c('0xe')]+'>';}utils[_0x3f5c('0x6')](util[_0x3f5c('0x7')](_0x3f5c('0x2e'),_0x5e1eb2['uniqueid'],channels[_0x5e1eb2[_0x3f5c('0x9')]][_0x3f5c('0x2c')],_0x5e1eb2[_0x3f5c('0x2f')]));channels[_0x5e1eb2[_0x3f5c('0x9')]][_0x3f5c('0x30')]=utils[_0x3f5c('0x1d')]();channels[_0x5e1eb2[_0x3f5c('0x9')]][_0x3f5c('0x31')]=utils[_0x3f5c('0x32')](channels[_0x5e1eb2[_0x3f5c('0x9')]][_0x3f5c('0x30')],channels[_0x5e1eb2[_0x3f5c('0x9')]][_0x3f5c('0x33')]);channels[_0x5e1eb2[_0x3f5c('0x9')]][_0x3f5c('0x34')]=channels[_0x5e1eb2[_0x3f5c('0x9')]][_0x3f5c('0x29')]?utils['diffTime'](channels[_0x5e1eb2[_0x3f5c('0x9')]]['endtime'],channels[_0x5e1eb2['uniqueid']][_0x3f5c('0x29')]):0x0;writeDB(channels[_0x5e1eb2[_0x3f5c('0x9')]]);}}catch(_0x11aa01){utils[_0x3f5c('0x1f')](util['format'](_0x3f5c('0x2b'),_0x5e1eb2[_0x3f5c('0x9')]),_0x11aa01);}};exports[_0x3f5c('0x35')]=function(_0x18126b){try{if(!_[_0x3f5c('0x22')](channels[_0x18126b[_0x3f5c('0x36')]])){utils[_0x3f5c('0x37')](util['format'](_0x3f5c('0x38'),_0x18126b[_0x3f5c('0x39')]),_0x18126b);if(channels[_0x18126b[_0x3f5c('0x36')]]['channel']==_0x18126b[_0x3f5c('0x3a')]){utils['info'](util[_0x3f5c('0x7')](_0x3f5c('0x3b'),_0x18126b['origtransfereruniqueid'],_0x18126b['localtwolinkedid'],_0x18126b['secondtransfererchannel']));channels[_0x18126b['localtwolinkedid']][_0x3f5c('0x3c')]=_0x18126b[_0x3f5c('0x3d')];channels[_0x18126b[_0x3f5c('0x36')]]['userfield']=_0x3f5c('0x3e');}else if(channels[_0x18126b['localtwolinkedid']]['channel']=_0x18126b[_0x3f5c('0x3f')]){utils['info'](util[_0x3f5c('0x7')](_0x3f5c('0x3b'),_0x18126b[_0x3f5c('0x39')],_0x18126b[_0x3f5c('0x36')],_0x18126b['origtransfererchannel']));channels[_0x18126b[_0x3f5c('0x36')]][_0x3f5c('0x3c')]=_0x18126b['origtransfererchannel'];channels[_0x18126b[_0x3f5c('0x36')]]['userfield']=_0x3f5c('0x3e');}}}catch(_0x30b600){utils[_0x3f5c('0x1f')](util[_0x3f5c('0x7')](_0x3f5c('0x38'),_0x18126b[_0x3f5c('0x39')]),_0x30b600);}};exports['musiconholdstart']=function(_0x57f168){try{if(!_['isNil'](channels[_0x57f168[_0x3f5c('0x9')]])){utils[_0x3f5c('0x37')](util['format'](_0x3f5c('0x40'),_0x57f168[_0x3f5c('0x9')]),_0x57f168);channels[_0x57f168[_0x3f5c('0x9')]]['musiconholdstartAt']=utils[_0x3f5c('0x1d')]();utils[_0x3f5c('0x6')](util['format'](_0x3f5c('0x41'),_0x57f168[_0x3f5c('0x9')],channels[_0x57f168[_0x3f5c('0x9')]][_0x3f5c('0x42')]));}}catch(_0xe7a6f0){utils[_0x3f5c('0x1f')](util['format'](_0x3f5c('0x40'),_0x57f168[_0x3f5c('0x9')]),_0xe7a6f0);}};exports[_0x3f5c('0x43')]=function(_0x5824b2){try{if(!_[_0x3f5c('0x22')](channels[_0x5824b2[_0x3f5c('0x9')]])){utils[_0x3f5c('0x37')](util['format'](_0x3f5c('0x44'),_0x5824b2[_0x3f5c('0x9')]),_0x5824b2);if(!_[_0x3f5c('0x22')](channels[_0x5824b2['uniqueid']]['musiconholdstartAt'])){channels[_0x5824b2[_0x3f5c('0x9')]][_0x3f5c('0x45')]+=utils['diffTime'](utils[_0x3f5c('0x1d')](),channels[_0x5824b2[_0x3f5c('0x9')]][_0x3f5c('0x42')]);utils[_0x3f5c('0x6')](util[_0x3f5c('0x7')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x5824b2[_0x3f5c('0x9')],channels[_0x5824b2[_0x3f5c('0x9')]]['mohtime']));delete channels[_0x5824b2[_0x3f5c('0x9')]][_0x3f5c('0x42')];}}}catch(_0x35f92f){utils[_0x3f5c('0x1f')](util['format'](_0x3f5c('0x44'),_0x5824b2['uniqueid']),_0x35f92f);}};exports[_0x3f5c('0x46')]=function(_0x1fafc5){try{if(!_[_0x3f5c('0x22')](channels[_0x1fafc5[_0x3f5c('0x9')]])){utils['debug'](util[_0x3f5c('0x7')]('[%s][calls][varset]',_0x1fafc5[_0x3f5c('0x9')]),_0x1fafc5);if(!_['isNil'](_0x1fafc5[_0x3f5c('0x47')]['xmd-originatecalleridnum'])){utils['info'](util[_0x3f5c('0x7')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x1fafc5[_0x3f5c('0x9')],_0x1fafc5[_0x3f5c('0x48')]));channels[_0x1fafc5[_0x3f5c('0x9')]][_0x3f5c('0x49')]=_0x1fafc5['value'];}if(!_['isNil'](_0x1fafc5['variable'][_0x3f5c('0x4a')])){utils['info'](util['format'](_0x3f5c('0x4b'),_0x1fafc5[_0x3f5c('0x9')],_0x1fafc5[_0x3f5c('0x48')]));channels[_0x1fafc5['uniqueid']]['destination']=_0x1fafc5[_0x3f5c('0x48')];channels[_0x1fafc5[_0x3f5c('0x9')]][_0x3f5c('0x2c')]='\x22'+_0x1fafc5['value']+_0x3f5c('0x4c')+_0x1fafc5[_0x3f5c('0x48')]+'>';}if(!_[_0x3f5c('0x22')](_0x1fafc5[_0x3f5c('0x47')]['xmd-callerid-preview'])||!_[_0x3f5c('0x22')](_0x1fafc5[_0x3f5c('0x47')]['xmd-callerid'])){utils['info'](util[_0x3f5c('0x7')](_0x3f5c('0x4d'),_0x1fafc5['uniqueid'],!_[_0x3f5c('0x22')](_0x1fafc5['variable'][_0x3f5c('0x4e')])?_0x3f5c('0x4e'):_0x3f5c('0x4f'),_0x1fafc5['value']));channels[_0x1fafc5[_0x3f5c('0x9')]][_0x3f5c('0x2c')]=_0x1fafc5[_0x3f5c('0x48')];}if(!_[_0x3f5c('0x22')](_0x1fafc5['variable'][_0x3f5c('0x50')])||!_[_0x3f5c('0x22')](_0x1fafc5['variable'][_0x3f5c('0x51')])){utils[_0x3f5c('0x6')](util[_0x3f5c('0x7')](_0x3f5c('0x4d'),_0x1fafc5[_0x3f5c('0x9')],!_[_0x3f5c('0x22')](_0x1fafc5[_0x3f5c('0x47')][_0x3f5c('0x50')])?'xmd-queue':_0x3f5c('0x51'),_0x1fafc5[_0x3f5c('0x48')]));channels[_0x1fafc5[_0x3f5c('0x9')]]['lastapplication']=_0x3f5c('0x52');channels[_0x1fafc5[_0x3f5c('0x9')]][_0x3f5c('0x53')]=_0x1fafc5[_0x3f5c('0x48')];channels[_0x1fafc5['uniqueid']][_0x3f5c('0xb')]=!![];}if(!_[_0x3f5c('0x22')](_0x1fafc5[_0x3f5c('0x47')][_0x3f5c('0x54')])){utils[_0x3f5c('0x6')](util['format'](_0x3f5c('0x55'),_0x1fafc5[_0x3f5c('0x9')],_0x1fafc5[_0x3f5c('0x48')]));channels[_0x1fafc5[_0x3f5c('0x9')]][_0x3f5c('0x56')]=_0x1fafc5[_0x3f5c('0x48')];}if(!_[_0x3f5c('0x22')](_0x1fafc5[_0x3f5c('0x47')][_0x3f5c('0x57')])){utils[_0x3f5c('0x6')](util[_0x3f5c('0x7')](_0x3f5c('0x58'),_0x1fafc5['uniqueid'],_0x1fafc5[_0x3f5c('0x48')]));channels[_0x1fafc5[_0x3f5c('0x9')]]['type']=_0x1fafc5[_0x3f5c('0x48')];}if(!_['isNil'](_0x1fafc5[_0x3f5c('0x47')]['outboundrouteid'])){utils[_0x3f5c('0x6')](util[_0x3f5c('0x7')](_0x3f5c('0x59'),_0x1fafc5[_0x3f5c('0x9')],_0x1fafc5['value']));channels[_0x1fafc5[_0x3f5c('0x9')]][_0x3f5c('0x5a')]=_0x1fafc5['value'];}if(!_[_0x3f5c('0x22')](_0x1fafc5['variable'][_0x3f5c('0x5b')])){utils[_0x3f5c('0x6')](util['format'](_0x3f5c('0x5c'),_0x1fafc5['uniqueid'],_0x1fafc5[_0x3f5c('0x48')]));channels[_0x1fafc5['uniqueid']][_0x3f5c('0x5b')]=_0x1fafc5[_0x3f5c('0x48')];}}}catch(_0x3017fa){utils[_0x3f5c('0x1f')](util[_0x3f5c('0x7')]('[%s][calls][varset]',_0x1fafc5[_0x3f5c('0x9')]),_0x3017fa);}};exports['newexten']=function(_0x4755bd){try{if(!_[_0x3f5c('0x22')](channels[_0x4755bd['uniqueid']])){utils['debug'](util[_0x3f5c('0x7')]('[%s][calls][newexten]',_0x4755bd['uniqueid']),_0x4755bd);utils['info'](util[_0x3f5c('0x7')](_0x3f5c('0x5d'),_0x4755bd[_0x3f5c('0x9')],_0x4755bd[_0x3f5c('0x5e')],_0x4755bd[_0x3f5c('0x5f')]));if(_0x4755bd[_0x3f5c('0x5e')][_0x3f5c('0x60')]()==_0x3f5c('0x61')&&_[_0x3f5c('0x62')](_0x4755bd[_0x3f5c('0x5f')]['toLowerCase'](),'cdr')){var _0x35190e=_0x4755bd[_0x3f5c('0x5f')][_0x3f5c('0x63')]('=');var _0x3fc1fd=_0x35190e[0x0][_0x3f5c('0x64')](_0x35190e[0x0][_0x3f5c('0x65')]('(')+0x1,_0x35190e[0x0]['lastIndexOf'](')'));var _0x4721ac=_0x35190e[0x1];channels[_0x4755bd['uniqueid']][_0x3fc1fd]=_0x4721ac;}if(!_[_0x3f5c('0x66')]([_0x3f5c('0x67'),_0x3f5c('0x68'),_0x3f5c('0x69'),_0x3f5c('0x61'),_0x3f5c('0x6a')],_0x4755bd[_0x3f5c('0x5e')][_0x3f5c('0x60')]())){channels[_0x4755bd[_0x3f5c('0x9')]][_0x3f5c('0x6b')]=_0x4755bd[_0x3f5c('0x5e')];channels[_0x4755bd[_0x3f5c('0x9')]][_0x3f5c('0x53')]=_0x4755bd[_0x3f5c('0x5f')];}}}catch(_0x59c9c5){utils[_0x3f5c('0x1f')](util[_0x3f5c('0x7')](_0x3f5c('0x6c'),_0x4755bd['uniqueid']),_0x59c9c5);}}; \ No newline at end of file +var _0xc0da=['_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid','xmd-callerid-preview','xmd-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','then','UserId','request','CreateVoiceCallReport','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','newstate','debug','isNil','channelstate','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','error','[%s][calls][newstate]','hangup','callerid','calleridname','cause-txt','endtime','duration','starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','destinationchannel','secondtransfererchannel','userfield','transfertargetchannel','origtransfererchannel'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc0da,0x1e5));var _0xac0d=function(_0xe2b137,_0x446498){_0xe2b137=_0xe2b137-0x0;var _0x33395d=_0xc0da[_0xe2b137];return _0x33395d;};'use strict';var _=require(_0xac0d('0x0'));var util=require('util');var utils=require(_0xac0d('0x1'));var dispositions=[_0xac0d('0x2'),_0xac0d('0x3'),_0xac0d('0x3'),_0xac0d('0x2'),_0xac0d('0x2'),_0xac0d('0x2'),_0xac0d('0x4'),_0xac0d('0x5'),_0xac0d('0x3'),_0xac0d('0x3'),_0xac0d('0x3')];var channels={};function writeDB(_0x559286){utils[_0xac0d('0x6')](util[_0xac0d('0x7')](_0xac0d('0x8'),_0x559286[_0xac0d('0x9')],_0x559286[_0xac0d('0xa')],_0x559286[_0xac0d('0xb')],_0x559286[_0xac0d('0xc')],_0x559286[_0xac0d('0xd')],_0x559286[_0xac0d('0xe')],_0x559286[_0xac0d('0xf')],_0x559286[_0xac0d('0x10')]));if(_0x559286[_0xac0d('0x11')]){utils['getUserByInternal'](_0x559286[_0xac0d('0x11')])[_0xac0d('0x12')](function(_0x7bb925){if(_0x7bb925){_0x559286[_0xac0d('0x13')]=_0x7bb925['id'];}utils[_0xac0d('0x14')](_0xac0d('0x15'),_0x559286);});}else{utils[_0xac0d('0x14')](_0xac0d('0x15'),_0x559286);}if(channels[_0x559286[_0xac0d('0x9')]]){delete channels[_0x559286[_0xac0d('0x9')]];}}exports['newchannel']=function(_0x35ec6d){try{utils['debug'](util[_0xac0d('0x7')](_0xac0d('0x16'),_0x35ec6d[_0xac0d('0x9')]),_0x35ec6d);if(_0x35ec6d['uniqueid']==_0x35ec6d[_0xac0d('0x17')]&&_0x35ec6d[_0xac0d('0xa')]!=_0xac0d('0x18')){utils[_0xac0d('0x6')](util[_0xac0d('0x7')](_0xac0d('0x19'),_0x35ec6d['uniqueid'],_0x35ec6d[_0xac0d('0x1a')],_0x35ec6d[_0xac0d('0x1b')]));channels[_0x35ec6d['uniqueid']]={'uniqueid':_0x35ec6d[_0xac0d('0x9')],'accountcode':_0x35ec6d['accountcode'],'source':_0x35ec6d[_0xac0d('0xe')],'destination':_0x35ec6d[_0xac0d('0x1b')],'destinationcontext':_0x35ec6d[_0xac0d('0x1a')],'channel':_0x35ec6d[_0xac0d('0xa')],'starttime':utils[_0xac0d('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xac0d('0x2'),'amaflags':'DOCUMENTATION'};}}catch(_0x25bda1){utils['error'](util['format'](_0xac0d('0x16'),_0x35ec6d[_0xac0d('0x9')]),_0x25bda1);}};exports[_0xac0d('0x1d')]=function(_0x187dbd){try{utils[_0xac0d('0x1e')](util[_0xac0d('0x7')]('[%s][calls][newstate]',_0x187dbd[_0xac0d('0x9')]),_0x187dbd);if(!_[_0xac0d('0x1f')](channels[_0x187dbd[_0xac0d('0x9')]])&&_0x187dbd[_0xac0d('0x20')]==0x6){utils[_0xac0d('0x6')](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x187dbd[_0xac0d('0x9')],_0x187dbd['context'],_0x187dbd['channel']));if(_['isNil'](channels[_0x187dbd[_0xac0d('0x9')]][_0xac0d('0x21')])){channels[_0x187dbd[_0xac0d('0x9')]][_0xac0d('0x21')]=utils[_0xac0d('0x1c')]();}}else if(!_[_0xac0d('0x1f')](channels[_0x187dbd[_0xac0d('0x17')]])&&_0x187dbd[_0xac0d('0x20')]==0x6&&_0x187dbd[_0xac0d('0x1a')]!=_0xac0d('0x22')){utils[_0xac0d('0x6')](util[_0xac0d('0x7')](_0xac0d('0x23'),_0x187dbd['uniqueid'],_0x187dbd['linkedid'],_0x187dbd[_0xac0d('0x1a')],_0x187dbd[_0xac0d('0xa')]));channels[_0x187dbd[_0xac0d('0x17')]][_0xac0d('0x11')]=_0x187dbd[_0xac0d('0x11')];channels[_0x187dbd[_0xac0d('0x17')]]['destinationchannel']=_0x187dbd[_0xac0d('0xa')];if(_[_0xac0d('0x1f')](channels[_0x187dbd['linkedid']]['answertime'])){channels[_0x187dbd[_0xac0d('0x17')]][_0xac0d('0x24')]=utils[_0xac0d('0x1c')]();}channels[_0x187dbd[_0xac0d('0x17')]][_0xac0d('0x25')]=dispositions[_['toNumber'](_0x187dbd[_0xac0d('0x20')])]||'ANSWERED';}}catch(_0x44823b){utils[_0xac0d('0x26')](util[_0xac0d('0x7')](_0xac0d('0x27'),_0x187dbd['uniqueid']),_0x44823b);}};exports[_0xac0d('0x28')]=function(_0x5eebd7){try{if(!_['isNil'](channels[_0x5eebd7[_0xac0d('0x9')]])){utils[_0xac0d('0x1e')](util[_0xac0d('0x7')]('[%s][calls][hangup]',_0x5eebd7['uniqueid']),_0x5eebd7);if(_[_0xac0d('0x1f')](channels[_0x5eebd7['uniqueid']]['callerid'])){channels[_0x5eebd7[_0xac0d('0x9')]][_0xac0d('0x29')]=_0x5eebd7[_0xac0d('0x2a')]+'\x20<'+_0x5eebd7[_0xac0d('0xe')]+'>';}utils[_0xac0d('0x6')](util[_0xac0d('0x7')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x5eebd7['uniqueid'],channels[_0x5eebd7['uniqueid']][_0xac0d('0x29')],_0x5eebd7[_0xac0d('0x2b')]));channels[_0x5eebd7['uniqueid']][_0xac0d('0x2c')]=utils[_0xac0d('0x1c')]();channels[_0x5eebd7[_0xac0d('0x9')]][_0xac0d('0x2d')]=utils['diffTime'](channels[_0x5eebd7[_0xac0d('0x9')]][_0xac0d('0x2c')],channels[_0x5eebd7[_0xac0d('0x9')]][_0xac0d('0x2e')]);channels[_0x5eebd7[_0xac0d('0x9')]][_0xac0d('0x2f')]=channels[_0x5eebd7['uniqueid']]['answertime']?utils[_0xac0d('0x30')](channels[_0x5eebd7[_0xac0d('0x9')]][_0xac0d('0x2c')],channels[_0x5eebd7[_0xac0d('0x9')]][_0xac0d('0x24')]):0x0;writeDB(channels[_0x5eebd7[_0xac0d('0x9')]]);}}catch(_0x48d485){utils[_0xac0d('0x26')](util['format']('[%s][calls][hangup]',_0x5eebd7[_0xac0d('0x9')]),_0x48d485);}};exports[_0xac0d('0x31')]=function(_0x2c43a5){try{if(!_[_0xac0d('0x1f')](channels[_0x2c43a5[_0xac0d('0x32')]])){utils[_0xac0d('0x1e')](util[_0xac0d('0x7')](_0xac0d('0x33'),_0x2c43a5[_0xac0d('0x34')]),_0x2c43a5);if(channels[_0x2c43a5[_0xac0d('0x32')]][_0xac0d('0xa')]==_0x2c43a5[_0xac0d('0x35')]){utils[_0xac0d('0x6')](util[_0xac0d('0x7')](_0xac0d('0x36'),_0x2c43a5[_0xac0d('0x34')],_0x2c43a5['localtwolinkedid'],_0x2c43a5['secondtransfererchannel']));channels[_0x2c43a5[_0xac0d('0x32')]][_0xac0d('0x37')]=_0x2c43a5[_0xac0d('0x38')];channels[_0x2c43a5[_0xac0d('0x32')]][_0xac0d('0x39')]='_attended';}else if(channels[_0x2c43a5['localtwolinkedid']][_0xac0d('0xa')]=_0x2c43a5[_0xac0d('0x3a')]){utils[_0xac0d('0x6')](util[_0xac0d('0x7')](_0xac0d('0x36'),_0x2c43a5['origtransfereruniqueid'],_0x2c43a5[_0xac0d('0x32')],_0x2c43a5['origtransfererchannel']));channels[_0x2c43a5['localtwolinkedid']][_0xac0d('0x37')]=_0x2c43a5[_0xac0d('0x3b')];channels[_0x2c43a5[_0xac0d('0x32')]][_0xac0d('0x39')]=_0xac0d('0x3c');}}}catch(_0x30dbe3){utils[_0xac0d('0x26')](util['format'](_0xac0d('0x33'),_0x2c43a5['origtransfereruniqueid']),_0x30dbe3);}};exports[_0xac0d('0x3d')]=function(_0x2b36be){try{if(!_['isNil'](channels[_0x2b36be[_0xac0d('0x9')]])){utils[_0xac0d('0x1e')](util[_0xac0d('0x7')](_0xac0d('0x3e'),_0x2b36be[_0xac0d('0x9')]),_0x2b36be);channels[_0x2b36be[_0xac0d('0x9')]][_0xac0d('0x3f')]=utils[_0xac0d('0x1c')]();utils[_0xac0d('0x6')](util[_0xac0d('0x7')](_0xac0d('0x40'),_0x2b36be['uniqueid'],channels[_0x2b36be[_0xac0d('0x9')]][_0xac0d('0x3f')]));}}catch(_0x45775d){utils[_0xac0d('0x26')](util['format'](_0xac0d('0x3e'),_0x2b36be['uniqueid']),_0x45775d);}};exports['musiconholdstop']=function(_0x5e5588){try{if(!_[_0xac0d('0x1f')](channels[_0x5e5588[_0xac0d('0x9')]])){utils[_0xac0d('0x1e')](util[_0xac0d('0x7')](_0xac0d('0x41'),_0x5e5588[_0xac0d('0x9')]),_0x5e5588);if(!_[_0xac0d('0x1f')](channels[_0x5e5588[_0xac0d('0x9')]][_0xac0d('0x3f')])){channels[_0x5e5588['uniqueid']][_0xac0d('0x42')]+=utils[_0xac0d('0x30')](utils[_0xac0d('0x1c')](),channels[_0x5e5588[_0xac0d('0x9')]][_0xac0d('0x3f')]);utils[_0xac0d('0x6')](util['format'](_0xac0d('0x43'),_0x5e5588[_0xac0d('0x9')],channels[_0x5e5588[_0xac0d('0x9')]][_0xac0d('0x42')]));delete channels[_0x5e5588[_0xac0d('0x9')]][_0xac0d('0x3f')];}}}catch(_0x70760b){utils['error'](util[_0xac0d('0x7')](_0xac0d('0x41'),_0x5e5588[_0xac0d('0x9')]),_0x70760b);}};exports[_0xac0d('0x44')]=function(_0x332a5f){try{if(!_['isNil'](channels[_0x332a5f[_0xac0d('0x9')]])){utils['debug'](util[_0xac0d('0x7')]('[%s][calls][varset]',_0x332a5f['uniqueid']),_0x332a5f);if(!_[_0xac0d('0x1f')](_0x332a5f['variable'][_0xac0d('0x45')])){utils['info'](util[_0xac0d('0x7')](_0xac0d('0x46'),_0x332a5f[_0xac0d('0x9')],_0x332a5f[_0xac0d('0x47')]));channels[_0x332a5f[_0xac0d('0x9')]][_0xac0d('0x48')]=_0x332a5f[_0xac0d('0x47')];}if(!_[_0xac0d('0x1f')](_0x332a5f[_0xac0d('0x49')]['xmd-phone'])){utils[_0xac0d('0x6')](util['format'](_0xac0d('0x4a'),_0x332a5f[_0xac0d('0x9')],_0x332a5f[_0xac0d('0x47')]));channels[_0x332a5f['uniqueid']][_0xac0d('0x4b')]=_0x332a5f[_0xac0d('0x47')];channels[_0x332a5f['uniqueid']]['callerid']='\x22'+_0x332a5f[_0xac0d('0x47')]+'\x22\x20<'+_0x332a5f[_0xac0d('0x47')]+'>';}if(!_['isNil'](_0x332a5f[_0xac0d('0x49')]['xmd-callerid-preview'])||!_['isNil'](_0x332a5f[_0xac0d('0x49')][_0xac0d('0x4c')])){utils[_0xac0d('0x6')](util[_0xac0d('0x7')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x332a5f['uniqueid'],!_['isNil'](_0x332a5f[_0xac0d('0x49')][_0xac0d('0x4d')])?_0xac0d('0x4d'):_0xac0d('0x4c'),_0x332a5f['value']));channels[_0x332a5f['uniqueid']][_0xac0d('0x29')]=_0x332a5f[_0xac0d('0x47')];}if(!_[_0xac0d('0x1f')](_0x332a5f[_0xac0d('0x49')][_0xac0d('0x4e')])||!_[_0xac0d('0x1f')](_0x332a5f[_0xac0d('0x49')]['xmcs-queue'])){utils['info'](util[_0xac0d('0x7')](_0xac0d('0x4f'),_0x332a5f[_0xac0d('0x9')],!_[_0xac0d('0x1f')](_0x332a5f['variable']['xmd-queue'])?_0xac0d('0x4e'):_0xac0d('0x50'),_0x332a5f[_0xac0d('0x47')]));channels[_0x332a5f[_0xac0d('0x9')]][_0xac0d('0x51')]=_0xac0d('0x52');channels[_0x332a5f[_0xac0d('0x9')]][_0xac0d('0x53')]=_0x332a5f[_0xac0d('0x47')];channels[_0x332a5f[_0xac0d('0x9')]][_0xac0d('0xb')]=!![];}if(!_['isNil'](_0x332a5f['variable'][_0xac0d('0x54')])){utils['info'](util[_0xac0d('0x7')](_0xac0d('0x55'),_0x332a5f[_0xac0d('0x9')],_0x332a5f[_0xac0d('0x47')]));channels[_0x332a5f[_0xac0d('0x9')]]['ContactId']=_0x332a5f[_0xac0d('0x47')];}if(!_[_0xac0d('0x1f')](_0x332a5f['variable']['xmd-cdrtype'])){utils[_0xac0d('0x6')](util['format'](_0xac0d('0x56'),_0x332a5f[_0xac0d('0x9')],_0x332a5f['value']));channels[_0x332a5f[_0xac0d('0x9')]][_0xac0d('0x57')]=_0x332a5f[_0xac0d('0x47')];}if(!_['isNil'](_0x332a5f[_0xac0d('0x49')][_0xac0d('0x58')])){utils[_0xac0d('0x6')](util[_0xac0d('0x7')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x332a5f[_0xac0d('0x9')],_0x332a5f[_0xac0d('0x47')]));channels[_0x332a5f[_0xac0d('0x9')]][_0xac0d('0x59')]=_0x332a5f[_0xac0d('0x47')];}if(!_[_0xac0d('0x1f')](_0x332a5f['variable'][_0xac0d('0x5a')])){utils[_0xac0d('0x6')](util[_0xac0d('0x7')](_0xac0d('0x5b'),_0x332a5f['uniqueid'],_0x332a5f[_0xac0d('0x47')]));channels[_0x332a5f[_0xac0d('0x9')]][_0xac0d('0x5a')]=_0x332a5f['value'];}}}catch(_0x264081){utils[_0xac0d('0x26')](util['format'](_0xac0d('0x5c'),_0x332a5f[_0xac0d('0x9')]),_0x264081);}};exports[_0xac0d('0x5d')]=function(_0x26fc35){try{if(!_[_0xac0d('0x1f')](channels[_0x26fc35[_0xac0d('0x9')]])){utils[_0xac0d('0x1e')](util[_0xac0d('0x7')](_0xac0d('0x5e'),_0x26fc35[_0xac0d('0x9')]),_0x26fc35);utils[_0xac0d('0x6')](util['format'](_0xac0d('0x5f'),_0x26fc35[_0xac0d('0x9')],_0x26fc35[_0xac0d('0x60')],_0x26fc35[_0xac0d('0x61')]));if(_0x26fc35[_0xac0d('0x60')][_0xac0d('0x62')]()==_0xac0d('0x63')&&_[_0xac0d('0x64')](_0x26fc35[_0xac0d('0x61')]['toLowerCase'](),_0xac0d('0x65'))){var _0x3f4eb7=_0x26fc35['appdata'][_0xac0d('0x66')]('=');var _0x5a9046=_0x3f4eb7[0x0][_0xac0d('0x67')](_0x3f4eb7[0x0][_0xac0d('0x68')]('(')+0x1,_0x3f4eb7[0x0][_0xac0d('0x68')](')'));var _0x79990b=_0x3f4eb7[0x1];channels[_0x26fc35[_0xac0d('0x9')]][_0x5a9046]=_0x79990b;}if(!_[_0xac0d('0x69')]([_0xac0d('0x28'),_0xac0d('0x6a'),_0xac0d('0x6b'),_0xac0d('0x63'),_0xac0d('0x6c')],_0x26fc35['application'][_0xac0d('0x62')]())){channels[_0x26fc35[_0xac0d('0x9')]]['lastapplication']=_0x26fc35['application'];channels[_0x26fc35[_0xac0d('0x9')]][_0xac0d('0x53')]=_0x26fc35[_0xac0d('0x61')];}}}catch(_0x30f2ee){utils[_0xac0d('0x26')](util[_0xac0d('0x7')](_0xac0d('0x5e'),_0x26fc35['uniqueid']),_0x30f2ee);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 3e41182..ac6abf9 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 _0x9473=['connect','info','shutdown','[core]\x20shutdown','error','[core]\x20close','managerevent','./utils'];(function(_0x272d90,_0x5e70ff){var _0x2bf4a2=function(_0x544da6){while(--_0x544da6){_0x272d90['push'](_0x272d90['shift']());}};_0x2bf4a2(++_0x5e70ff);}(_0x9473,0xbf));var _0x3947=function(_0x1187f4,_0x1a92cd){_0x1187f4=_0x1187f4-0x0;var _0x176f78=_0x9473[_0x1187f4];return _0x176f78;};'use strict';var utils=require(_0x3947('0x0'));exports[_0x3947('0x1')]=function(){utils[_0x3947('0x2')]('[core]\x20connected');};exports[_0x3947('0x3')]=function(){utils[_0x3947('0x2')](_0x3947('0x4'));};exports['fullybooted']=function(){utils[_0x3947('0x2')]('[core]\x20fullybooted');};exports[_0x3947('0x5')]=function(_0x5edafa){utils[_0x3947('0x5')]('[core]\x20error',_0x5edafa);};exports['close']=function(){utils[_0x3947('0x2')](_0x3947('0x6'));};exports[_0x3947('0x7')]=function(_0x4fc264){}; \ No newline at end of file +var _0x3295=['[core]\x20shutdown','error','[core]\x20error','close','managerevent','./utils','connect','info','[core]\x20connected','shutdown'];(function(_0x2156d2,_0x3a58df){var _0x1a9488=function(_0x2da74e){while(--_0x2da74e){_0x2156d2['push'](_0x2156d2['shift']());}};_0x1a9488(++_0x3a58df);}(_0x3295,0x14f));var _0x5329=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x3295[_0x1b6c6d];return _0x290d9d;};'use strict';var utils=require(_0x5329('0x0'));exports[_0x5329('0x1')]=function(){utils[_0x5329('0x2')](_0x5329('0x3'));};exports[_0x5329('0x4')]=function(){utils[_0x5329('0x2')](_0x5329('0x5'));};exports['fullybooted']=function(){utils['info']('[core]\x20fullybooted');};exports[_0x5329('0x6')]=function(_0x50547e){utils[_0x5329('0x6')](_0x5329('0x7'),_0x50547e);};exports[_0x5329('0x8')]=function(){utils['info']('[core]\x20close');};exports[_0x5329('0x9')]=function(_0x191d20){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 164576f..241ac40 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 _0xa9de=['endtime','holdtime','billableseconds','lodash','util','./utils','format','uniqueid','channel','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','info','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','assign','starttime','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','dialstatus','ANSWER','answertime','now','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime'];(function(_0x331846,_0x2b8675){var _0x183f6c=function(_0x19aabc){while(--_0x19aabc){_0x331846['push'](_0x331846['shift']());}};_0x183f6c(++_0x2b8675);}(_0xa9de,0xa5));var _0xea9d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa9de[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xea9d('0x0'));var util=require(_0xea9d('0x1'));var utils=require(_0xea9d('0x2'));var dials={};function writeDB(_0x58589b){utils['info'](util[_0xea9d('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x58589b[_0xea9d('0x4')],_0x58589b[_0xea9d('0x5')],_0x58589b['dialstring'],_0x58589b[_0xea9d('0x6')],_0x58589b[_0xea9d('0x7')],_0x58589b['dialstatus']));utils[_0xea9d('0x8')](_0xea9d('0x9'),_0x58589b);delete dials[_0x58589b[_0xea9d('0x4')]];}exports[_0xea9d('0xa')]=function(_0x50d635){try{utils[_0xea9d('0xb')](util[_0xea9d('0x3')](_0xea9d('0xc'),_0x50d635[_0xea9d('0x4')]),_0x50d635);utils['info'](util[_0xea9d('0x3')](_0xea9d('0xd'),_0x50d635['uniqueid'],_0x50d635[_0xea9d('0xe')],_0x50d635[_0xea9d('0xf')]));if(_0x50d635[_0xea9d('0xe')][_0xea9d('0x10')]()==_0xea9d('0x11')&&_[_0xea9d('0x12')](_0x50d635[_0xea9d('0xf')][_0xea9d('0x10')](),_0xea9d('0x13'))){var _0x167d50=_0x50d635[_0xea9d('0xf')][_0xea9d('0x14')]('=');dials[_0x50d635[_0xea9d('0x4')]]={'routeId':_0x167d50[0x1]};}}catch(_0xcc233){utils[_0xea9d('0x15')](util['format'](_0xea9d('0xc'),_0x50d635['uniqueid']),_0xcc233);}};exports[_0xea9d('0x16')]=function(_0x1782da){try{utils[_0xea9d('0xb')](util[_0xea9d('0x3')](_0xea9d('0x17'),_0x1782da[_0xea9d('0x4')]),_0x1782da);if(!_[_0xea9d('0x18')](_0x1782da[_0xea9d('0x19')]['outboundrouteid'])){utils[_0xea9d('0x1a')](util['format'](_0xea9d('0x1b'),_0x1782da['uniqueid'],_0x1782da[_0xea9d('0x1c')]));dials[_0x1782da[_0xea9d('0x4')]]={'routeId':_0x1782da[_0xea9d('0x1c')]};}}catch(_0x3209be){utils[_0xea9d('0x15')](util[_0xea9d('0x3')]('[%s][dials][varset]',_0x1782da[_0xea9d('0x4')]),_0x3209be);}};exports[_0xea9d('0x1d')]=function(_0x70000){try{if(!_[_0xea9d('0x18')](dials[_0x70000[_0xea9d('0x4')]])){utils[_0xea9d('0xb')](util[_0xea9d('0x3')]('[%s][dials][dialbegin]',_0x70000[_0xea9d('0x4')]),_0x70000);dials[_0x70000[_0xea9d('0x4')]]=_[_0xea9d('0x1e')](dials[_0x70000[_0xea9d('0x4')]],_0x70000);dials[_0x70000['uniqueid']][_0xea9d('0x1f')]=utils['now']();dials[_0x70000[_0xea9d('0x4')]][_0xea9d('0x20')]='called';utils['info'](util[_0xea9d('0x3')](_0xea9d('0x21'),_0x70000['uniqueid'],dials[_0x70000[_0xea9d('0x4')]][_0xea9d('0x1f')]));}}catch(_0xcd8aa3){utils[_0xea9d('0x15')](util[_0xea9d('0x3')](_0xea9d('0x22'),_0x70000[_0xea9d('0x4')]),_0xcd8aa3);}};exports[_0xea9d('0x23')]=function(_0x2cdb89){try{if(!_[_0xea9d('0x18')](dials[_0x2cdb89[_0xea9d('0x4')]])){utils[_0xea9d('0xb')](util[_0xea9d('0x3')](_0xea9d('0x24'),_0x2cdb89['uniqueid']),_0x2cdb89);dials[_0x2cdb89[_0xea9d('0x4')]][_0xea9d('0x25')]=_0x2cdb89[_0xea9d('0x25')];if(_0x2cdb89[_0xea9d('0x25')]==_0xea9d('0x26')){dials[_0x2cdb89[_0xea9d('0x4')]]=_['assign'](dials[_0x2cdb89[_0xea9d('0x4')]],_0x2cdb89);dials[_0x2cdb89['uniqueid']][_0xea9d('0x27')]=utils[_0xea9d('0x28')]();dials[_0x2cdb89[_0xea9d('0x4')]][_0xea9d('0x20')]='connect';utils[_0xea9d('0x1a')](util[_0xea9d('0x3')](_0xea9d('0x29'),_0x2cdb89[_0xea9d('0x4')],_0x2cdb89[_0xea9d('0x25')],dials[_0x2cdb89[_0xea9d('0x4')]][_0xea9d('0x27')]));}else{utils[_0xea9d('0x1a')](util[_0xea9d('0x3')](_0xea9d('0x2a'),_0x2cdb89[_0xea9d('0x4')],_0x2cdb89['dialstatus']));}}}catch(_0x275e53){utils[_0xea9d('0x15')](util['format'](_0xea9d('0x24'),_0x2cdb89[_0xea9d('0x4')]),_0x275e53);}};exports[_0xea9d('0x2b')]=function(_0x29600f){try{if(!_[_0xea9d('0x18')](dials[_0x29600f[_0xea9d('0x4')]])){utils[_0xea9d('0xb')](util['format'](_0xea9d('0x2c'),_0x29600f['uniqueid']),_0x29600f);utils[_0xea9d('0x1a')](util[_0xea9d('0x3')](_0xea9d('0x2d'),_0x29600f['uniqueid'],_0x29600f['calleridnum'],_0x29600f[_0xea9d('0x2e')],_0x29600f[_0xea9d('0x2f')]));dials[_0x29600f['uniqueid']]=_['assign'](dials[_0x29600f[_0xea9d('0x4')]],{'endtime':utils['now'](),'lastevent':_0xea9d('0x30')});dials[_0x29600f[_0xea9d('0x4')]][_0xea9d('0x31')]=utils[_0xea9d('0x32')](dials[_0x29600f['uniqueid']][_0xea9d('0x33')],dials[_0x29600f[_0xea9d('0x4')]][_0xea9d('0x1f')]);dials[_0x29600f[_0xea9d('0x4')]][_0xea9d('0x34')]=utils[_0xea9d('0x32')](dials[_0x29600f[_0xea9d('0x4')]][_0xea9d('0x27')]||dials[_0x29600f[_0xea9d('0x4')]][_0xea9d('0x33')],dials[_0x29600f[_0xea9d('0x4')]]['starttime']);dials[_0x29600f[_0xea9d('0x4')]][_0xea9d('0x35')]=dials[_0x29600f[_0xea9d('0x4')]][_0xea9d('0x27')]?utils['diffTime'](dials[_0x29600f[_0xea9d('0x4')]][_0xea9d('0x33')],dials[_0x29600f[_0xea9d('0x4')]][_0xea9d('0x27')]):0x0;writeDB(dials[_0x29600f[_0xea9d('0x4')]]);}}catch(_0x1ac52e){utils[_0xea9d('0x15')](util[_0xea9d('0x3')](_0xea9d('0x2c'),_0x29600f[_0xea9d('0x4')]),_0x1ac52e);}}; \ No newline at end of file +var _0xb6d8=['cause-txt','complete','duration','endtime','diffTime','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','isNil','debug','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname'];(function(_0x157da8,_0x3f507e){var _0x598217=function(_0x28f3d5){while(--_0x28f3d5){_0x157da8['push'](_0x157da8['shift']());}};_0x598217(++_0x3f507e);}(_0xb6d8,0x1d9));var _0x8b6d=function(_0x10ad77,_0x2f63e6){_0x10ad77=_0x10ad77-0x0;var _0x416b85=_0xb6d8[_0x10ad77];return _0x416b85;};'use strict';var _=require(_0x8b6d('0x0'));var util=require(_0x8b6d('0x1'));var utils=require(_0x8b6d('0x2'));var dials={};function writeDB(_0x538c09){utils[_0x8b6d('0x3')](util[_0x8b6d('0x4')](_0x8b6d('0x5'),_0x538c09[_0x8b6d('0x6')],_0x538c09[_0x8b6d('0x7')],_0x538c09[_0x8b6d('0x8')],_0x538c09[_0x8b6d('0x9')],_0x538c09[_0x8b6d('0xa')],_0x538c09[_0x8b6d('0xb')]));utils[_0x8b6d('0xc')](_0x8b6d('0xd'),_0x538c09);delete dials[_0x538c09[_0x8b6d('0x6')]];}exports[_0x8b6d('0xe')]=function(_0x23a8f9){try{utils['debug'](util[_0x8b6d('0x4')](_0x8b6d('0xf'),_0x23a8f9['uniqueid']),_0x23a8f9);utils[_0x8b6d('0x3')](util[_0x8b6d('0x4')](_0x8b6d('0x10'),_0x23a8f9['uniqueid'],_0x23a8f9[_0x8b6d('0x11')],_0x23a8f9[_0x8b6d('0x12')]));if(_0x23a8f9[_0x8b6d('0x11')][_0x8b6d('0x13')]()==_0x8b6d('0x14')&&_[_0x8b6d('0x15')](_0x23a8f9[_0x8b6d('0x12')]['toLowerCase'](),_0x8b6d('0x16'))){var _0x4e5c18=_0x23a8f9[_0x8b6d('0x12')][_0x8b6d('0x17')]('=');dials[_0x23a8f9[_0x8b6d('0x6')]]={'routeId':_0x4e5c18[0x1]};}}catch(_0x370436){utils[_0x8b6d('0x18')](util[_0x8b6d('0x4')](_0x8b6d('0xf'),_0x23a8f9[_0x8b6d('0x6')]),_0x370436);}};exports['varset']=function(_0x239251){try{utils['debug'](util[_0x8b6d('0x4')](_0x8b6d('0x19'),_0x239251[_0x8b6d('0x6')]),_0x239251);if(!_['isNil'](_0x239251[_0x8b6d('0x1a')][_0x8b6d('0x1b')])){utils[_0x8b6d('0x3')](util[_0x8b6d('0x4')](_0x8b6d('0x1c'),_0x239251[_0x8b6d('0x6')],_0x239251['value']));dials[_0x239251['uniqueid']]={'routeId':_0x239251['value']};}}catch(_0x375877){utils[_0x8b6d('0x18')](util['format']('[%s][dials][varset]',_0x239251[_0x8b6d('0x6')]),_0x375877);}};exports['dialbegin']=function(_0x9cb650){try{if(!_[_0x8b6d('0x1d')](dials[_0x9cb650[_0x8b6d('0x6')]])){utils[_0x8b6d('0x1e')](util['format'](_0x8b6d('0x1f'),_0x9cb650[_0x8b6d('0x6')]),_0x9cb650);dials[_0x9cb650[_0x8b6d('0x6')]]=_[_0x8b6d('0x20')](dials[_0x9cb650[_0x8b6d('0x6')]],_0x9cb650);dials[_0x9cb650[_0x8b6d('0x6')]][_0x8b6d('0x21')]=utils[_0x8b6d('0x22')]();dials[_0x9cb650[_0x8b6d('0x6')]][_0x8b6d('0x23')]=_0x8b6d('0x24');utils['info'](util[_0x8b6d('0x4')](_0x8b6d('0x25'),_0x9cb650[_0x8b6d('0x6')],dials[_0x9cb650[_0x8b6d('0x6')]][_0x8b6d('0x21')]));}}catch(_0x4a86ec){utils[_0x8b6d('0x18')](util[_0x8b6d('0x4')](_0x8b6d('0x1f'),_0x9cb650[_0x8b6d('0x6')]),_0x4a86ec);}};exports[_0x8b6d('0x26')]=function(_0x467aa3){try{if(!_[_0x8b6d('0x1d')](dials[_0x467aa3[_0x8b6d('0x6')]])){utils[_0x8b6d('0x1e')](util[_0x8b6d('0x4')]('[%s][dials][dialend]',_0x467aa3[_0x8b6d('0x6')]),_0x467aa3);dials[_0x467aa3[_0x8b6d('0x6')]][_0x8b6d('0xb')]=_0x467aa3[_0x8b6d('0xb')];if(_0x467aa3['dialstatus']==_0x8b6d('0x27')){dials[_0x467aa3[_0x8b6d('0x6')]]=_[_0x8b6d('0x20')](dials[_0x467aa3[_0x8b6d('0x6')]],_0x467aa3);dials[_0x467aa3[_0x8b6d('0x6')]][_0x8b6d('0x28')]=utils[_0x8b6d('0x22')]();dials[_0x467aa3[_0x8b6d('0x6')]][_0x8b6d('0x23')]='connect';utils[_0x8b6d('0x3')](util['format']('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x467aa3['uniqueid'],_0x467aa3['dialstatus'],dials[_0x467aa3['uniqueid']][_0x8b6d('0x28')]));}else{utils[_0x8b6d('0x3')](util['format'](_0x8b6d('0x29'),_0x467aa3['uniqueid'],_0x467aa3[_0x8b6d('0xb')]));}}}catch(_0x412594){utils['error'](util[_0x8b6d('0x4')](_0x8b6d('0x2a'),_0x467aa3['uniqueid']),_0x412594);}};exports[_0x8b6d('0x2b')]=function(_0x3b0b8d){try{if(!_['isNil'](dials[_0x3b0b8d[_0x8b6d('0x6')]])){utils[_0x8b6d('0x1e')](util[_0x8b6d('0x4')](_0x8b6d('0x2c'),_0x3b0b8d[_0x8b6d('0x6')]),_0x3b0b8d);utils[_0x8b6d('0x3')](util[_0x8b6d('0x4')](_0x8b6d('0x2d'),_0x3b0b8d[_0x8b6d('0x6')],_0x3b0b8d[_0x8b6d('0x9')],_0x3b0b8d[_0x8b6d('0x2e')],_0x3b0b8d[_0x8b6d('0x2f')]));dials[_0x3b0b8d[_0x8b6d('0x6')]]=_[_0x8b6d('0x20')](dials[_0x3b0b8d[_0x8b6d('0x6')]],{'endtime':utils[_0x8b6d('0x22')](),'lastevent':_0x8b6d('0x30')});dials[_0x3b0b8d[_0x8b6d('0x6')]][_0x8b6d('0x31')]=utils['diffTime'](dials[_0x3b0b8d[_0x8b6d('0x6')]][_0x8b6d('0x32')],dials[_0x3b0b8d[_0x8b6d('0x6')]][_0x8b6d('0x21')]);dials[_0x3b0b8d['uniqueid']]['holdtime']=utils[_0x8b6d('0x33')](dials[_0x3b0b8d['uniqueid']][_0x8b6d('0x28')]||dials[_0x3b0b8d[_0x8b6d('0x6')]][_0x8b6d('0x32')],dials[_0x3b0b8d[_0x8b6d('0x6')]][_0x8b6d('0x21')]);dials[_0x3b0b8d[_0x8b6d('0x6')]]['billableseconds']=dials[_0x3b0b8d[_0x8b6d('0x6')]][_0x8b6d('0x28')]?utils['diffTime'](dials[_0x3b0b8d[_0x8b6d('0x6')]][_0x8b6d('0x32')],dials[_0x3b0b8d[_0x8b6d('0x6')]][_0x8b6d('0x28')]):0x0;writeDB(dials[_0x3b0b8d[_0x8b6d('0x6')]]);}}catch(_0x32e00b){utils['error'](util[_0x8b6d('0x4')](_0x8b6d('0x2c'),_0x3b0b8d[_0x8b6d('0x6')]),_0x32e00b);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 7880e62..eea4ffe 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 _0xb1e0=['password','xdr','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','asterisk','port','username'];(function(_0xf5809,_0x262f82){var _0x3a65f3=function(_0x48f8ca){while(--_0x48f8ca){_0xf5809['push'](_0xf5809['shift']());}};_0x3a65f3(++_0x262f82);}(_0xb1e0,0x1ce));var _0x0b1e=function(_0x4c70cb,_0x35a5cb){_0x4c70cb=_0x4c70cb-0x0;var _0x470faa=_0xb1e0[_0x4c70cb];return _0x470faa;};var AsteriskManager=require(_0x0b1e('0x0'));var config=require(_0x0b1e('0x1'));var utils=require(_0x0b1e('0x2'));var util=require(_0x0b1e('0x3'));var ami=new AsteriskManager(config[_0x0b1e('0x4')][_0x0b1e('0x5')],config[_0x0b1e('0x4')]['ip'],config[_0x0b1e('0x4')][_0x0b1e('0x6')],config['asterisk'][_0x0b1e('0x7')],!![]);ami['keepConnected']();if(config[_0x0b1e('0x8')]&&config[_0x0b1e('0x8')]['disabled']){utils['info']('XDR\x20DISABLED');}else{var agents=require(_0x0b1e('0x9'));var calls=require(_0x0b1e('0xa'));var queues=require(_0x0b1e('0xb'));var recordings=require(_0x0b1e('0xc'));var members=require('./members.controller');var dials=require(_0x0b1e('0xd'));var transfers=require(_0x0b1e('0xe'));var core=require(_0x0b1e('0xf'));ami['on'](_0x0b1e('0x10'),core[_0x0b1e('0x10')]);ami['on'](_0x0b1e('0x11'),core[_0x0b1e('0x11')]);ami['on']('fullybooted',core[_0x0b1e('0x12')]);ami['on'](_0x0b1e('0x13'),core[_0x0b1e('0x13')]);ami['on'](_0x0b1e('0x14'),core[_0x0b1e('0x14')]);ami['on'](_0x0b1e('0x15'),core['managerevent']);ami['on'](_0x0b1e('0x16'),function(_0x58b44f){try{utils['debug'](util[_0x0b1e('0x17')](_0x0b1e('0x18'),_0x58b44f['device']),_0x58b44f);members[_0x0b1e('0x16')](_0x58b44f);}catch(_0x1a306f){utils[_0x0b1e('0x13')](util[_0x0b1e('0x17')](_0x0b1e('0x18'),_0x58b44f[_0x0b1e('0x19')]),_0x1a306f);}});ami['on'](_0x0b1e('0x1a'),function(_0x4208d0){try{utils[_0x0b1e('0x1b')](util[_0x0b1e('0x17')](_0x0b1e('0x1c'),_0x4208d0[_0x0b1e('0x1d')]),_0x4208d0);agents['agentcalled'](_0x4208d0);}catch(_0x5b069b){utils[_0x0b1e('0x13')](util[_0x0b1e('0x17')]('[%s][index][agentcalled]',_0x4208d0['uniqueid']),_0x5b069b);}});ami['on'](_0x0b1e('0x1e'),function(_0x19466c){try{utils[_0x0b1e('0x1b')](util[_0x0b1e('0x17')](_0x0b1e('0x1f'),_0x19466c[_0x0b1e('0x1d')]),_0x19466c);agents[_0x0b1e('0x1e')](_0x19466c);}catch(_0x4f67f3){utils['error'](util[_0x0b1e('0x17')]('[%s][index][agentringnoanswer]',_0x19466c[_0x0b1e('0x1d')]),_0x4f67f3);}});ami['on'](_0x0b1e('0x20'),function(_0x24e7ee){try{utils['debug'](util[_0x0b1e('0x17')](_0x0b1e('0x21'),_0x24e7ee[_0x0b1e('0x1d')]),_0x24e7ee);agents[_0x0b1e('0x20')](_0x24e7ee);queues[_0x0b1e('0x20')](_0x24e7ee);}catch(_0x3584a5){utils['error'](util[_0x0b1e('0x17')](_0x0b1e('0x21'),_0x24e7ee[_0x0b1e('0x1d')]),_0x3584a5);}});ami['on'](_0x0b1e('0x22'),function(_0x55a510){try{utils[_0x0b1e('0x1b')](util[_0x0b1e('0x17')](_0x0b1e('0x23'),_0x55a510[_0x0b1e('0x1d')]),_0x55a510);agents[_0x0b1e('0x22')](_0x55a510);queues[_0x0b1e('0x22')](_0x55a510);members[_0x0b1e('0x22')](_0x55a510);}catch(_0x1e75cb){utils[_0x0b1e('0x13')](util[_0x0b1e('0x17')](_0x0b1e('0x23'),_0x55a510[_0x0b1e('0x1d')]),_0x1e75cb);}});ami['on'](_0x0b1e('0x24'),function(_0x1f9736){try{utils[_0x0b1e('0x1b')](util['format'](_0x0b1e('0x25'),_0x1f9736[_0x0b1e('0x1d')]),_0x1f9736);agents[_0x0b1e('0x24')](_0x1f9736);queues[_0x0b1e('0x24')](_0x1f9736);}catch(_0x246cf9){utils[_0x0b1e('0x13')](util[_0x0b1e('0x17')](_0x0b1e('0x25'),_0x1f9736[_0x0b1e('0x1d')]),_0x246cf9);}});ami['on'](_0x0b1e('0x26'),function(_0x4e29ab){try{utils[_0x0b1e('0x1b')](util[_0x0b1e('0x17')](_0x0b1e('0x27'),_0x4e29ab[_0x0b1e('0x1d')]),_0x4e29ab);queues[_0x0b1e('0x26')](_0x4e29ab);recordings['queuecallerjoin'](_0x4e29ab);}catch(_0x4781a1){utils['error'](util['format'](_0x0b1e('0x27'),_0x4e29ab['uniqueid']),_0x4781a1);}});ami['on'](_0x0b1e('0x28'),function(_0xf4411f){try{utils[_0x0b1e('0x1b')](util['format']('[%s][index][queuecallerleave]',_0xf4411f[_0x0b1e('0x1d')]),_0xf4411f);queues['queuecallerleave'](_0xf4411f);}catch(_0x31006e){utils[_0x0b1e('0x13')](util[_0x0b1e('0x17')](_0x0b1e('0x29'),_0xf4411f[_0x0b1e('0x1d')]),_0x31006e);}});ami['on'](_0x0b1e('0x2a'),function(_0x231350){try{utils['debug'](util[_0x0b1e('0x17')](_0x0b1e('0x2b'),_0x231350[_0x0b1e('0x1d')]),_0x231350);queues[_0x0b1e('0x2a')](_0x231350);calls[_0x0b1e('0x2a')](_0x231350);}catch(_0x21e5bd){utils[_0x0b1e('0x13')](util[_0x0b1e('0x17')](_0x0b1e('0x2b'),_0x231350[_0x0b1e('0x1d')]),_0x21e5bd);}});ami['on']('musiconholdstop',function(_0x50fc6b){try{utils[_0x0b1e('0x1b')](util['format'](_0x0b1e('0x2c'),_0x50fc6b[_0x0b1e('0x1d')]),_0x50fc6b);queues['musiconholdstop'](_0x50fc6b);calls[_0x0b1e('0x2d')](_0x50fc6b);}catch(_0x4259bb){utils['error'](util['format'](_0x0b1e('0x2c'),_0x50fc6b[_0x0b1e('0x1d')]),_0x4259bb);}});ami['on'](_0x0b1e('0x2e'),function(_0x52cb18){try{utils[_0x0b1e('0x1b')](util[_0x0b1e('0x17')](_0x0b1e('0x2f'),_0x52cb18[_0x0b1e('0x1d')]),_0x52cb18);calls['newstate'](_0x52cb18);recordings[_0x0b1e('0x2e')](_0x52cb18);}catch(_0x576763){utils[_0x0b1e('0x13')](util['format']('[%s][index][newstate]',_0x52cb18['uniqueid']),_0x576763);}});ami['on'](_0x0b1e('0x30'),function(_0x14aab5){try{utils[_0x0b1e('0x1b')](util[_0x0b1e('0x17')](_0x0b1e('0x31'),_0x14aab5[_0x0b1e('0x1d')]),_0x14aab5);calls[_0x0b1e('0x30')](_0x14aab5);recordings['hangup'](_0x14aab5);dials[_0x0b1e('0x30')](_0x14aab5);agents[_0x0b1e('0x30')](_0x14aab5);queues[_0x0b1e('0x30')](_0x14aab5);}catch(_0x5ab822){utils['error'](util[_0x0b1e('0x17')](_0x0b1e('0x31'),_0x14aab5[_0x0b1e('0x1d')]),_0x5ab822);}});ami['on'](_0x0b1e('0x32'),function(_0x251dba){try{utils[_0x0b1e('0x1b')](util[_0x0b1e('0x17')](_0x0b1e('0x33'),_0x251dba[_0x0b1e('0x1d')]),_0x251dba);members[_0x0b1e('0x32')](_0x251dba);}catch(_0x5d13f4){utils[_0x0b1e('0x13')](util[_0x0b1e('0x17')]('[%s][index][cdr]',_0x251dba[_0x0b1e('0x1d')]),_0x5d13f4);}});ami['on']('blindtransfer',function(_0x594ecb){try{utils[_0x0b1e('0x1b')](util[_0x0b1e('0x17')](_0x0b1e('0x34'),_0x594ecb['uniqueid']),_0x594ecb);queues[_0x0b1e('0x35')](_0x594ecb);agents['blindtransfer'](_0x594ecb);transfers[_0x0b1e('0x35')](_0x594ecb);}catch(_0x380c39){utils[_0x0b1e('0x13')](util[_0x0b1e('0x17')](_0x0b1e('0x34'),_0x594ecb[_0x0b1e('0x1d')]),_0x380c39);}});ami['on'](_0x0b1e('0x36'),function(_0xc6075c){try{utils[_0x0b1e('0x1b')](util[_0x0b1e('0x17')](_0x0b1e('0x37'),_0xc6075c[_0x0b1e('0x38')]),_0xc6075c);queues[_0x0b1e('0x36')](_0xc6075c);transfers['attendedtransfer'](_0xc6075c);agents[_0x0b1e('0x36')](_0xc6075c);calls['attendedtransfer'](_0xc6075c);}catch(_0x216e26){utils[_0x0b1e('0x13')](util[_0x0b1e('0x17')](_0x0b1e('0x37'),_0xc6075c['origtransfereruniqueid']),_0x216e26);}});ami['on'](_0x0b1e('0x39'),function(_0x3759df){try{utils[_0x0b1e('0x1b')](util[_0x0b1e('0x17')](_0x0b1e('0x3a'),_0x3759df[_0x0b1e('0x1d')]),_0x3759df);queues[_0x0b1e('0x39')](_0x3759df);recordings[_0x0b1e('0x39')](_0x3759df);calls[_0x0b1e('0x39')](_0x3759df);dials[_0x0b1e('0x39')](_0x3759df);}catch(_0x5bf5fb){utils[_0x0b1e('0x13')](util[_0x0b1e('0x17')]('[%s][index][varset]',_0x3759df[_0x0b1e('0x1d')]),_0x5bf5fb);}});ami['on'](_0x0b1e('0x3b'),function(_0x4d0ceb){try{utils[_0x0b1e('0x1b')](util[_0x0b1e('0x17')]('[%s][index][newexten]',_0x4d0ceb[_0x0b1e('0x1d')]),_0x4d0ceb);calls[_0x0b1e('0x3b')](_0x4d0ceb);recordings[_0x0b1e('0x3b')](_0x4d0ceb);dials[_0x0b1e('0x3b')](_0x4d0ceb);}catch(_0x415a90){utils['error'](util[_0x0b1e('0x17')](_0x0b1e('0x3c'),_0x4d0ceb[_0x0b1e('0x1d')]),_0x415a90);}});ami['on'](_0x0b1e('0x3d'),function(_0x47c0db){try{utils['debug'](util[_0x0b1e('0x17')]('[%s][index][newchannel]',_0x47c0db[_0x0b1e('0x1d')]),_0x47c0db);calls[_0x0b1e('0x3d')](_0x47c0db);recordings[_0x0b1e('0x3d')](_0x47c0db);}catch(_0x125a69){utils['error'](util[_0x0b1e('0x17')](_0x0b1e('0x3e'),_0x47c0db[_0x0b1e('0x1d')]),_0x125a69);}});ami['on'](_0x0b1e('0x3f'),function(_0x31a33a){try{utils['debug'](util[_0x0b1e('0x17')](_0x0b1e('0x40'),_0x31a33a[_0x0b1e('0x1d')]),_0x31a33a);dials[_0x0b1e('0x3f')](_0x31a33a);}catch(_0x1d0f86){utils[_0x0b1e('0x13')](util[_0x0b1e('0x17')]('[%s]dialbegin',_0x31a33a[_0x0b1e('0x1d')]),_0x1d0f86);}});ami['on']('dialend',function(_0x373f07){try{utils['debug'](util['format']('[%s][index][dialend]',_0x373f07[_0x0b1e('0x1d')]),_0x373f07);dials[_0x0b1e('0x41')](_0x373f07);}catch(_0x2c76a0){utils[_0x0b1e('0x13')](util[_0x0b1e('0x17')](_0x0b1e('0x42'),_0x373f07[_0x0b1e('0x1d')]),_0x2c76a0);}});} \ No newline at end of file +var _0x5fcf=['queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','asterisk','port','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','agentcalled','format','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]'];(function(_0x2bd1ec,_0x3fe65f){var _0x2f7577=function(_0x5234fb){while(--_0x5234fb){_0x2bd1ec['push'](_0x2bd1ec['shift']());}};_0x2f7577(++_0x3fe65f);}(_0x5fcf,0x1bc));var _0xf5fc=function(_0x1ca8a3,_0x31e103){_0x1ca8a3=_0x1ca8a3-0x0;var _0x2ef004=_0x5fcf[_0x1ca8a3];return _0x2ef004;};var AsteriskManager=require(_0xf5fc('0x0'));var config=require('../../config/environment');var utils=require(_0xf5fc('0x1'));var util=require(_0xf5fc('0x2'));var ami=new AsteriskManager(config[_0xf5fc('0x3')][_0xf5fc('0x4')],config[_0xf5fc('0x3')]['ip'],config[_0xf5fc('0x3')][_0xf5fc('0x5')],config[_0xf5fc('0x3')][_0xf5fc('0x6')],!![]);ami[_0xf5fc('0x7')]();if(config[_0xf5fc('0x8')]&&config[_0xf5fc('0x8')][_0xf5fc('0x9')]){utils[_0xf5fc('0xa')](_0xf5fc('0xb'));}else{var agents=require(_0xf5fc('0xc'));var calls=require('./calls.controller');var queues=require(_0xf5fc('0xd'));var recordings=require(_0xf5fc('0xe'));var members=require('./members.controller');var dials=require(_0xf5fc('0xf'));var transfers=require(_0xf5fc('0x10'));var core=require(_0xf5fc('0x11'));ami['on']('connect',core[_0xf5fc('0x12')]);ami['on'](_0xf5fc('0x13'),core['shutdown']);ami['on'](_0xf5fc('0x14'),core[_0xf5fc('0x14')]);ami['on'](_0xf5fc('0x15'),core['error']);ami['on'](_0xf5fc('0x16'),core['close']);ami['on'](_0xf5fc('0x17'),core['managerevent']);ami['on'](_0xf5fc('0x18'),function(_0x494a71){try{utils[_0xf5fc('0x19')](util['format'](_0xf5fc('0x1a'),_0x494a71[_0xf5fc('0x1b')]),_0x494a71);members[_0xf5fc('0x18')](_0x494a71);}catch(_0x568278){utils['error'](util['format'](_0xf5fc('0x1a'),_0x494a71[_0xf5fc('0x1b')]),_0x568278);}});ami['on'](_0xf5fc('0x1c'),function(_0x37cdc5){try{utils[_0xf5fc('0x19')](util[_0xf5fc('0x1d')]('[%s][index][agentcalled]',_0x37cdc5[_0xf5fc('0x1e')]),_0x37cdc5);agents[_0xf5fc('0x1c')](_0x37cdc5);}catch(_0x1c8e1a){utils['error'](util[_0xf5fc('0x1d')](_0xf5fc('0x1f'),_0x37cdc5[_0xf5fc('0x1e')]),_0x1c8e1a);}});ami['on'](_0xf5fc('0x20'),function(_0x576691){try{utils[_0xf5fc('0x19')](util['format'](_0xf5fc('0x21'),_0x576691[_0xf5fc('0x1e')]),_0x576691);agents['agentringnoanswer'](_0x576691);}catch(_0x92fd51){utils[_0xf5fc('0x15')](util[_0xf5fc('0x1d')](_0xf5fc('0x21'),_0x576691['uniqueid']),_0x92fd51);}});ami['on']('agentconnect',function(_0x3f1dad){try{utils[_0xf5fc('0x19')](util[_0xf5fc('0x1d')](_0xf5fc('0x22'),_0x3f1dad['uniqueid']),_0x3f1dad);agents['agentconnect'](_0x3f1dad);queues[_0xf5fc('0x23')](_0x3f1dad);}catch(_0x5c1393){utils['error'](util[_0xf5fc('0x1d')](_0xf5fc('0x22'),_0x3f1dad['uniqueid']),_0x5c1393);}});ami['on'](_0xf5fc('0x24'),function(_0x42bcf9){try{utils['debug'](util[_0xf5fc('0x1d')]('[%s][index][agentcomplete]',_0x42bcf9[_0xf5fc('0x1e')]),_0x42bcf9);agents[_0xf5fc('0x24')](_0x42bcf9);queues[_0xf5fc('0x24')](_0x42bcf9);members[_0xf5fc('0x24')](_0x42bcf9);}catch(_0x497f86){utils[_0xf5fc('0x15')](util[_0xf5fc('0x1d')](_0xf5fc('0x25'),_0x42bcf9[_0xf5fc('0x1e')]),_0x497f86);}});ami['on']('queuecallerabandon',function(_0x3d1253){try{utils[_0xf5fc('0x19')](util['format'](_0xf5fc('0x26'),_0x3d1253[_0xf5fc('0x1e')]),_0x3d1253);agents['queuecallerabandon'](_0x3d1253);queues[_0xf5fc('0x27')](_0x3d1253);}catch(_0x50064b){utils[_0xf5fc('0x15')](util['format'](_0xf5fc('0x26'),_0x3d1253[_0xf5fc('0x1e')]),_0x50064b);}});ami['on'](_0xf5fc('0x28'),function(_0x394986){try{utils[_0xf5fc('0x19')](util['format'](_0xf5fc('0x29'),_0x394986['uniqueid']),_0x394986);queues[_0xf5fc('0x28')](_0x394986);recordings['queuecallerjoin'](_0x394986);}catch(_0x482d68){utils[_0xf5fc('0x15')](util['format'](_0xf5fc('0x29'),_0x394986[_0xf5fc('0x1e')]),_0x482d68);}});ami['on'](_0xf5fc('0x2a'),function(_0x48e9e9){try{utils[_0xf5fc('0x19')](util['format'](_0xf5fc('0x2b'),_0x48e9e9['uniqueid']),_0x48e9e9);queues[_0xf5fc('0x2a')](_0x48e9e9);}catch(_0x399dd0){utils[_0xf5fc('0x15')](util[_0xf5fc('0x1d')](_0xf5fc('0x2b'),_0x48e9e9['uniqueid']),_0x399dd0);}});ami['on'](_0xf5fc('0x2c'),function(_0x12213c){try{utils[_0xf5fc('0x19')](util[_0xf5fc('0x1d')](_0xf5fc('0x2d'),_0x12213c[_0xf5fc('0x1e')]),_0x12213c);queues['musiconholdstart'](_0x12213c);calls[_0xf5fc('0x2c')](_0x12213c);}catch(_0x4c3730){utils['error'](util[_0xf5fc('0x1d')](_0xf5fc('0x2d'),_0x12213c[_0xf5fc('0x1e')]),_0x4c3730);}});ami['on']('musiconholdstop',function(_0x2a30bf){try{utils[_0xf5fc('0x19')](util[_0xf5fc('0x1d')]('[%s][index][musiconholdstop]',_0x2a30bf[_0xf5fc('0x1e')]),_0x2a30bf);queues[_0xf5fc('0x2e')](_0x2a30bf);calls[_0xf5fc('0x2e')](_0x2a30bf);}catch(_0x18ab27){utils[_0xf5fc('0x15')](util[_0xf5fc('0x1d')](_0xf5fc('0x2f'),_0x2a30bf[_0xf5fc('0x1e')]),_0x18ab27);}});ami['on'](_0xf5fc('0x30'),function(_0x53cce8){try{utils[_0xf5fc('0x19')](util['format'](_0xf5fc('0x31'),_0x53cce8['uniqueid']),_0x53cce8);calls['newstate'](_0x53cce8);recordings[_0xf5fc('0x30')](_0x53cce8);}catch(_0x4aa448){utils['error'](util[_0xf5fc('0x1d')]('[%s][index][newstate]',_0x53cce8[_0xf5fc('0x1e')]),_0x4aa448);}});ami['on'](_0xf5fc('0x32'),function(_0x15ec96){try{utils['debug'](util[_0xf5fc('0x1d')](_0xf5fc('0x33'),_0x15ec96[_0xf5fc('0x1e')]),_0x15ec96);calls[_0xf5fc('0x32')](_0x15ec96);recordings[_0xf5fc('0x32')](_0x15ec96);dials['hangup'](_0x15ec96);agents[_0xf5fc('0x32')](_0x15ec96);queues[_0xf5fc('0x32')](_0x15ec96);}catch(_0x431f46){utils[_0xf5fc('0x15')](util['format'](_0xf5fc('0x33'),_0x15ec96[_0xf5fc('0x1e')]),_0x431f46);}});ami['on']('cdr',function(_0x34a2f5){try{utils[_0xf5fc('0x19')](util['format']('[%s][index][cdr]',_0x34a2f5[_0xf5fc('0x1e')]),_0x34a2f5);members[_0xf5fc('0x34')](_0x34a2f5);}catch(_0x7b529f){utils[_0xf5fc('0x15')](util[_0xf5fc('0x1d')](_0xf5fc('0x35'),_0x34a2f5[_0xf5fc('0x1e')]),_0x7b529f);}});ami['on'](_0xf5fc('0x36'),function(_0x5f1922){try{utils[_0xf5fc('0x19')](util[_0xf5fc('0x1d')](_0xf5fc('0x37'),_0x5f1922[_0xf5fc('0x1e')]),_0x5f1922);queues[_0xf5fc('0x36')](_0x5f1922);agents[_0xf5fc('0x36')](_0x5f1922);transfers['blindtransfer'](_0x5f1922);}catch(_0x20b6db){utils['error'](util['format']('[%s][index][blindtransfer]',_0x5f1922['uniqueid']),_0x20b6db);}});ami['on'](_0xf5fc('0x38'),function(_0x5c74b3){try{utils[_0xf5fc('0x19')](util[_0xf5fc('0x1d')](_0xf5fc('0x39'),_0x5c74b3[_0xf5fc('0x3a')]),_0x5c74b3);queues[_0xf5fc('0x38')](_0x5c74b3);transfers[_0xf5fc('0x38')](_0x5c74b3);agents[_0xf5fc('0x38')](_0x5c74b3);calls[_0xf5fc('0x38')](_0x5c74b3);}catch(_0x1a6dd4){utils[_0xf5fc('0x15')](util[_0xf5fc('0x1d')](_0xf5fc('0x39'),_0x5c74b3['origtransfereruniqueid']),_0x1a6dd4);}});ami['on'](_0xf5fc('0x3b'),function(_0x386c66){try{utils['debug'](util[_0xf5fc('0x1d')](_0xf5fc('0x3c'),_0x386c66[_0xf5fc('0x1e')]),_0x386c66);queues[_0xf5fc('0x3b')](_0x386c66);recordings[_0xf5fc('0x3b')](_0x386c66);calls['varset'](_0x386c66);dials[_0xf5fc('0x3b')](_0x386c66);}catch(_0x1d6107){utils[_0xf5fc('0x15')](util[_0xf5fc('0x1d')](_0xf5fc('0x3c'),_0x386c66[_0xf5fc('0x1e')]),_0x1d6107);}});ami['on']('newexten',function(_0x19e083){try{utils[_0xf5fc('0x19')](util['format']('[%s][index][newexten]',_0x19e083[_0xf5fc('0x1e')]),_0x19e083);calls[_0xf5fc('0x3d')](_0x19e083);recordings[_0xf5fc('0x3d')](_0x19e083);dials[_0xf5fc('0x3d')](_0x19e083);}catch(_0x556b3e){utils[_0xf5fc('0x15')](util['format'](_0xf5fc('0x3e'),_0x19e083['uniqueid']),_0x556b3e);}});ami['on']('newchannel',function(_0x5c16b4){try{utils[_0xf5fc('0x19')](util[_0xf5fc('0x1d')]('[%s][index][newchannel]',_0x5c16b4['uniqueid']),_0x5c16b4);calls[_0xf5fc('0x3f')](_0x5c16b4);recordings['newchannel'](_0x5c16b4);}catch(_0x3ffade){utils['error'](util[_0xf5fc('0x1d')](_0xf5fc('0x40'),_0x5c16b4[_0xf5fc('0x1e')]),_0x3ffade);}});ami['on']('dialbegin',function(_0x585418){try{utils['debug'](util['format'](_0xf5fc('0x41'),_0x585418[_0xf5fc('0x1e')]),_0x585418);dials['dialbegin'](_0x585418);}catch(_0x2eb846){utils[_0xf5fc('0x15')](util['format'](_0xf5fc('0x42'),_0x585418['uniqueid']),_0x2eb846);}});ami['on'](_0xf5fc('0x43'),function(_0x351525){try{utils['debug'](util[_0xf5fc('0x1d')](_0xf5fc('0x44'),_0x351525[_0xf5fc('0x1e')]),_0x351525);dials[_0xf5fc('0x43')](_0x351525);}catch(_0x23e724){utils[_0xf5fc('0x15')](util[_0xf5fc('0x1d')](_0xf5fc('0x44'),_0x351525[_0xf5fc('0x1e')]),_0x23e724);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index eb27244..bd19b0d 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 _0x6503=['assign','error','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','data3','destinationchannel','lodash','util','./utils','Local/_attended@transfer','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type','getUserByInterface','then','internal','request','getUserByName','split','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','uniqueid','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','NOT_INUSE','isNil','exitAt','diffTime','enterAt','agentcomplete','queue'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x6503,0x71));var _0x3650=function(_0xa6e865,_0x227d6b){_0xa6e865=_0xa6e865-0x0;var _0x47b757=_0x6503[_0xa6e865];return _0x47b757;};'use strict';var _=require(_0x3650('0x0'));var util=require(_0x3650('0x1'));var utils=require(_0x3650('0x2'));var members={};var exclude=[_0x3650('0x3'),'Queue:'];function writeDB(_0x4acb41){utils[_0x3650('0x4')](util[_0x3650('0x5')](_0x3650('0x6'),_0x4acb41['uniqueid'],_0x4acb41[_0x3650('0x7')],_0x4acb41[_0x3650('0x8')],_0x4acb41[_0x3650('0x9')],_0x4acb41[_0x3650('0xa')],_0x4acb41[_0x3650('0xb')]));if(_0x4acb41[_0x3650('0x7')]){utils[_0x3650('0xc')](_0x4acb41['interface'])[_0x3650('0xd')](function(_0x126a1d){if(_0x126a1d){_0x4acb41['membername']=_0x126a1d['name'];_0x4acb41['internal']=_0x126a1d[_0x3650('0xe')];utils[_0x3650('0xf')]('CreateMemberReport',_0x4acb41);}else{utils[_0x3650('0x10')](_0x4acb41[_0x3650('0x7')][_0x3650('0x11')]('/')[0x1])[_0x3650('0xd')](function(_0x38619b){if(_0x38619b){_0x4acb41['membername']=_0x38619b['name'];_0x4acb41[_0x3650('0xe')]=_0x38619b[_0x3650('0xe')];utils[_0x3650('0xf')]('CreateMemberReport',_0x4acb41);}});}})['catch'](function(_0x5ee86d){utils['error'](util[_0x3650('0x5')](_0x3650('0x12'),_0x4acb41['uniqueid']),_0x5ee86d);});}delete members[_0x4acb41[_0x3650('0x7')]];}function startsWith(_0x3d75a6,_0x3b6304){return _[_0x3650('0x13')](_0x3d75a6,function(_0x5eab65){return _[_0x3650('0x14')](_0x3b6304,_0x5eab65);});}exports[_0x3650('0x15')]=function(_0x2b6df0){try{utils[_0x3650('0x16')](util[_0x3650('0x5')](_0x3650('0x17'),members[_0x2b6df0['device']]?members[_0x2b6df0['device']][_0x3650('0x18')]:_0x2b6df0[_0x3650('0x19')]),_0x2b6df0);utils[_0x3650('0x4')](util['format'](_0x3650('0x1a'),members[_0x2b6df0[_0x3650('0x19')]]?members[_0x2b6df0[_0x3650('0x19')]][_0x3650('0x18')]:_0x2b6df0[_0x3650('0x19')],_0x2b6df0[_0x3650('0x1b')],_0x2b6df0[_0x3650('0x19')]));switch(_0x2b6df0[_0x3650('0x1b')]){case _0x3650('0x1c'):case _0x3650('0x1d'):if(!startsWith(exclude,_0x2b6df0[_0x3650('0x19')])){members[_0x2b6df0[_0x3650('0x19')]]={'channel':_0x3650('0x1e'),'interface':_0x2b6df0[_0x3650('0x19')],'type':_0x3650('0x1f'),'enterAt':utils[_0x3650('0x20')](),'role':'agent'};}break;case _0x3650('0x21'):if(!_[_0x3650('0x22')](members[_0x2b6df0[_0x3650('0x19')]])){members[_0x2b6df0[_0x3650('0x19')]][_0x3650('0x23')]=utils[_0x3650('0x20')]();members[_0x2b6df0[_0x3650('0x19')]]['duration']=utils[_0x3650('0x24')](members[_0x2b6df0['device']][_0x3650('0x23')],members[_0x2b6df0[_0x3650('0x19')]][_0x3650('0x25')]);if(members[_0x2b6df0[_0x3650('0x19')]]['uniqueid']){writeDB(members[_0x2b6df0['device']]);}}break;default:break;}}catch(_0x3999fc){utils['error'](util[_0x3650('0x5')]('[%s][members][devicestatechange]',members[_0x2b6df0[_0x3650('0x19')]]?members[_0x2b6df0[_0x3650('0x19')]]['uniqueid']:_0x2b6df0[_0x3650('0x19')]),_0x3999fc);}};exports[_0x3650('0x26')]=function(_0x32fa8a){try{if(!_['isNil'](members[_0x32fa8a[_0x3650('0x7')]])){utils[_0x3650('0x16')](util[_0x3650('0x5')]('[%s][members][agentcomplete]',_0x32fa8a[_0x3650('0x18')]),_0x32fa8a);utils[_0x3650('0x4')](util[_0x3650('0x5')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x32fa8a[_0x3650('0x18')],_0x32fa8a[_0x3650('0x7')],_0x32fa8a[_0x3650('0x27')]));members[_0x32fa8a[_0x3650('0x7')]]=_[_0x3650('0x28')](members[_0x32fa8a[_0x3650('0x7')]],{'data4':_0x32fa8a[_0x3650('0x27')],'uniqueid':_0x32fa8a['uniqueid']});}}catch(_0x3106e3){utils[_0x3650('0x29')](util[_0x3650('0x5')](_0x3650('0x2a'),_0x32fa8a[_0x3650('0x18')]),_0x3106e3);}};exports[_0x3650('0x2b')]=function(_0x1fbcfd){try{utils['debug'](util[_0x3650('0x5')](_0x3650('0x2c'),_0x1fbcfd[_0x3650('0x18')]),_0x1fbcfd);if(_0x1fbcfd[_0x3650('0x8')]){var _0x38ffdf=_0x1fbcfd['channel'][_0x3650('0x11')]('-')[0x0];if(!_[_0x3650('0x22')](members[_0x38ffdf])){members[_0x38ffdf]=_[_0x3650('0x28')](members[_0x38ffdf],{'data1':members[_0x38ffdf]['data1']||_0x1fbcfd['type'],'data2':members[_0x38ffdf][_0x3650('0x9')]||_0x1fbcfd[_0x3650('0x2d')],'data3':members[_0x38ffdf]['data3']||_0x1fbcfd[_0x3650('0x2e')],'uniqueid':members[_0x38ffdf][_0x3650('0x18')]||_0x1fbcfd[_0x3650('0x18')]});utils[_0x3650('0x4')](util[_0x3650('0x5')](_0x3650('0x2f'),_0x1fbcfd['uniqueid'],members[_0x38ffdf][_0x3650('0x30')],members[_0x38ffdf]['data2'],members[_0x38ffdf][_0x3650('0x31')]));if(members[_0x38ffdf][_0x3650('0x23')]){writeDB(members[_0x38ffdf]);}}}if(_0x1fbcfd[_0x3650('0x32')]){var _0x34c88c=_0x1fbcfd[_0x3650('0x32')][_0x3650('0x11')]('-')[0x0];if(!_[_0x3650('0x22')](members[_0x34c88c])){members[_0x34c88c]=_[_0x3650('0x28')](members[_0x34c88c],{'data1':members[_0x34c88c]['data1']||_0x1fbcfd[_0x3650('0xb')],'data2':members[_0x34c88c][_0x3650('0x9')]||_0x1fbcfd[_0x3650('0x2d')],'data3':members[_0x34c88c]['data3']||_0x1fbcfd[_0x3650('0x2e')],'uniqueid':members[_0x34c88c][_0x3650('0x18')]||_0x1fbcfd[_0x3650('0x18')]});utils[_0x3650('0x4')](util['format'](_0x3650('0x2f'),_0x1fbcfd[_0x3650('0x18')],members[_0x34c88c][_0x3650('0x30')],members[_0x34c88c][_0x3650('0x9')],members[_0x34c88c][_0x3650('0x31')]));if(members[_0x34c88c][_0x3650('0x23')]){writeDB(members[_0x34c88c]);}}}}catch(_0x61e685){utils[_0x3650('0x29')](util[_0x3650('0x5')](_0x3650('0x2c'),_0x1fbcfd[_0x3650('0x18')]),_0x61e685);}}; \ No newline at end of file +var _0x9d3c=['debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','now','agent','isNil','duration','diffTime','exitAt','enterAt','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','error','cdr','data1','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','[%s][members][cdr]','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split','then','catch','[%s][members][writeDB]','uniqueid','some','devicestatechange'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x9d3c,0x80));var _0xc9d3=function(_0x2e2b3e,_0x5f1f3a){_0x2e2b3e=_0x2e2b3e-0x0;var _0xbd158=_0x9d3c[_0x2e2b3e];return _0xbd158;};'use strict';var _=require('lodash');var util=require(_0xc9d3('0x0'));var utils=require(_0xc9d3('0x1'));var members={};var exclude=[_0xc9d3('0x2'),_0xc9d3('0x3')];function writeDB(_0x2369a8){utils[_0xc9d3('0x4')](util[_0xc9d3('0x5')](_0xc9d3('0x6'),_0x2369a8['uniqueid'],_0x2369a8[_0xc9d3('0x7')],_0x2369a8[_0xc9d3('0x8')],_0x2369a8[_0xc9d3('0x9')],_0x2369a8[_0xc9d3('0xa')],_0x2369a8[_0xc9d3('0xb')]));if(_0x2369a8[_0xc9d3('0x7')]){utils[_0xc9d3('0xc')](_0x2369a8['interface'])['then'](function(_0x1d5628){if(_0x1d5628){_0x2369a8[_0xc9d3('0xa')]=_0x1d5628[_0xc9d3('0xd')];_0x2369a8[_0xc9d3('0xe')]=_0x1d5628[_0xc9d3('0xe')];utils[_0xc9d3('0xf')](_0xc9d3('0x10'),_0x2369a8);}else{utils[_0xc9d3('0x11')](_0x2369a8[_0xc9d3('0x7')][_0xc9d3('0x12')]('/')[0x1])[_0xc9d3('0x13')](function(_0x45fa5a){if(_0x45fa5a){_0x2369a8[_0xc9d3('0xa')]=_0x45fa5a[_0xc9d3('0xd')];_0x2369a8[_0xc9d3('0xe')]=_0x45fa5a[_0xc9d3('0xe')];utils[_0xc9d3('0xf')](_0xc9d3('0x10'),_0x2369a8);}});}})[_0xc9d3('0x14')](function(_0xed4c93){utils['error'](util[_0xc9d3('0x5')](_0xc9d3('0x15'),_0x2369a8[_0xc9d3('0x16')]),_0xed4c93);});}delete members[_0x2369a8[_0xc9d3('0x7')]];}function startsWith(_0x4da64e,_0x4eb284){return _[_0xc9d3('0x17')](_0x4da64e,function(_0x51b0c8){return _['startsWith'](_0x4eb284,_0x51b0c8);});}exports[_0xc9d3('0x18')]=function(_0x27f369){try{utils[_0xc9d3('0x19')](util['format'](_0xc9d3('0x1a'),members[_0x27f369['device']]?members[_0x27f369['device']][_0xc9d3('0x16')]:_0x27f369[_0xc9d3('0x1b')]),_0x27f369);utils['info'](util[_0xc9d3('0x5')](_0xc9d3('0x1c'),members[_0x27f369[_0xc9d3('0x1b')]]?members[_0x27f369[_0xc9d3('0x1b')]][_0xc9d3('0x16')]:_0x27f369[_0xc9d3('0x1b')],_0x27f369[_0xc9d3('0x1d')],_0x27f369[_0xc9d3('0x1b')]));switch(_0x27f369[_0xc9d3('0x1d')]){case'INUSE':case _0xc9d3('0x1e'):if(!startsWith(exclude,_0x27f369[_0xc9d3('0x1b')])){members[_0x27f369[_0xc9d3('0x1b')]]={'channel':_0xc9d3('0x1f'),'interface':_0x27f369['device'],'type':'TALKING','enterAt':utils[_0xc9d3('0x20')](),'role':_0xc9d3('0x21')};}break;case'NOT_INUSE':if(!_[_0xc9d3('0x22')](members[_0x27f369[_0xc9d3('0x1b')]])){members[_0x27f369[_0xc9d3('0x1b')]]['exitAt']=utils['now']();members[_0x27f369[_0xc9d3('0x1b')]][_0xc9d3('0x23')]=utils[_0xc9d3('0x24')](members[_0x27f369[_0xc9d3('0x1b')]][_0xc9d3('0x25')],members[_0x27f369[_0xc9d3('0x1b')]][_0xc9d3('0x26')]);if(members[_0x27f369[_0xc9d3('0x1b')]][_0xc9d3('0x16')]){writeDB(members[_0x27f369['device']]);}}break;default:break;}}catch(_0x4eb03d){utils['error'](util[_0xc9d3('0x5')](_0xc9d3('0x1a'),members[_0x27f369[_0xc9d3('0x1b')]]?members[_0x27f369[_0xc9d3('0x1b')]]['uniqueid']:_0x27f369[_0xc9d3('0x1b')]),_0x4eb03d);}};exports[_0xc9d3('0x27')]=function(_0x210742){try{if(!_[_0xc9d3('0x22')](members[_0x210742[_0xc9d3('0x7')]])){utils[_0xc9d3('0x19')](util[_0xc9d3('0x5')]('[%s][members][agentcomplete]',_0x210742[_0xc9d3('0x16')]),_0x210742);utils[_0xc9d3('0x4')](util['format'](_0xc9d3('0x28'),_0x210742[_0xc9d3('0x16')],_0x210742[_0xc9d3('0x7')],_0x210742[_0xc9d3('0x29')]));members[_0x210742[_0xc9d3('0x7')]]=_[_0xc9d3('0x2a')](members[_0x210742[_0xc9d3('0x7')]],{'data4':_0x210742['queue'],'uniqueid':_0x210742[_0xc9d3('0x16')]});}}catch(_0x16cf42){utils[_0xc9d3('0x2b')](util[_0xc9d3('0x5')]('[%s][members][agentcomplete]',_0x210742[_0xc9d3('0x16')]),_0x16cf42);}};exports[_0xc9d3('0x2c')]=function(_0x82f226){try{utils['debug'](util[_0xc9d3('0x5')]('[%s][members][cdr]',_0x82f226[_0xc9d3('0x16')]),_0x82f226);if(_0x82f226[_0xc9d3('0x8')]){var _0x352dd7=_0x82f226[_0xc9d3('0x8')]['split']('-')[0x0];if(!_[_0xc9d3('0x22')](members[_0x352dd7])){members[_0x352dd7]=_[_0xc9d3('0x2a')](members[_0x352dd7],{'data1':members[_0x352dd7][_0xc9d3('0x2d')]||_0x82f226[_0xc9d3('0xb')],'data2':members[_0x352dd7]['data2']||_0x82f226[_0xc9d3('0x2e')],'data3':members[_0x352dd7][_0xc9d3('0x2f')]||_0x82f226['destination'],'uniqueid':members[_0x352dd7]['uniqueid']||_0x82f226['uniqueid']});utils['info'](util[_0xc9d3('0x5')](_0xc9d3('0x30'),_0x82f226[_0xc9d3('0x16')],members[_0x352dd7][_0xc9d3('0x2d')],members[_0x352dd7][_0xc9d3('0x9')],members[_0x352dd7][_0xc9d3('0x2f')]));if(members[_0x352dd7][_0xc9d3('0x25')]){writeDB(members[_0x352dd7]);}}}if(_0x82f226['destinationchannel']){var _0x2dd48e=_0x82f226[_0xc9d3('0x31')][_0xc9d3('0x12')]('-')[0x0];if(!_['isNil'](members[_0x2dd48e])){members[_0x2dd48e]=_[_0xc9d3('0x2a')](members[_0x2dd48e],{'data1':members[_0x2dd48e][_0xc9d3('0x2d')]||_0x82f226[_0xc9d3('0xb')],'data2':members[_0x2dd48e]['data2']||_0x82f226['source'],'data3':members[_0x2dd48e]['data3']||_0x82f226['destination'],'uniqueid':members[_0x2dd48e][_0xc9d3('0x16')]||_0x82f226[_0xc9d3('0x16')]});utils[_0xc9d3('0x4')](util[_0xc9d3('0x5')](_0xc9d3('0x30'),_0x82f226['uniqueid'],members[_0x2dd48e][_0xc9d3('0x2d')],members[_0x2dd48e][_0xc9d3('0x9')],members[_0x2dd48e][_0xc9d3('0x2f')]));if(members[_0x2dd48e][_0xc9d3('0x25')]){writeDB(members[_0x2dd48e]);}}}}catch(_0x1d1b1d){utils[_0xc9d3('0x2b')](util['format'](_0xc9d3('0x32'),_0x82f226[_0xc9d3('0x16')]),_0x1d1b1d);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index f97b94a..b03b177 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 _0xcac2=['[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%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','connectedlinename','diffTime','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','[%s][queues][agentcomplete]','assigned','queuecallercompleteAt','reason','transfer','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDED','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','uniqueid','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name'];(function(_0x367ab4,_0x4c87ec){var _0x228ae9=function(_0x2a91cc){while(--_0x2a91cc){_0x367ab4['push'](_0x367ab4['shift']());}};_0x228ae9(++_0x4c87ec);}(_0xcac2,0x1e8));var _0x2cac=function(_0x11098b,_0x3c8e40){_0x11098b=_0x11098b-0x0;var _0x4a6da6=_0xcac2[_0x11098b];return _0x4a6da6;};'use strict';var _=require(_0x2cac('0x0'));var util=require(_0x2cac('0x1'));var utils=require(_0x2cac('0x2'));var queues={};function writeDB(_0x50026e){utils[_0x2cac('0x3')](util[_0x2cac('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x50026e['uniqueid'],_0x50026e['channel'],_0x50026e['queue'],_0x50026e[_0x2cac('0x5')],_0x50026e[_0x2cac('0x6')],_0x50026e[_0x2cac('0x7')],_0x50026e[_0x2cac('0x8')]));if(_0x50026e[_0x2cac('0x9')]){utils[_0x2cac('0xa')](_0x50026e[_0x2cac('0x9')])['then'](function(_0x5df249){if(_0x5df249){_0x50026e[_0x2cac('0xb')]=_0x5df249['type'];}utils[_0x2cac('0xc')](_0x2cac('0xd'),_0x50026e);});}else{utils['request']('CreateVoiceQueueReport',_0x50026e);}if(_0x50026e[_0x2cac('0xe')]){delete queues[_0x50026e[_0x2cac('0xe')]];}else{delete queues[_0x50026e['uniqueid']];}}exports[_0x2cac('0xf')]=function(_0x54599e){try{utils[_0x2cac('0x10')](util[_0x2cac('0x4')](_0x2cac('0x11'),_0x54599e[_0x2cac('0x12')]),_0x54599e);utils[_0x2cac('0x3')](util['format'](_0x2cac('0x13'),_0x54599e[_0x2cac('0x12')],_0x54599e['queue'],_0x54599e[_0x2cac('0x14')]));queues[_0x54599e[_0x2cac('0x12')]]=_[_0x2cac('0x15')](_0x54599e,{'originalposition':_0x54599e['position'],'queuecallerjoinAt':utils[_0x2cac('0x16')](),'mohtime':0x0});}catch(_0x354ab7){utils[_0x2cac('0x17')](util['format'](_0x2cac('0x11'),_0x54599e[_0x2cac('0x12')]),_0x354ab7);}};exports[_0x2cac('0x18')]=function(_0x4d4646){try{if(!_['isNil'](queues[_0x4d4646[_0x2cac('0x12')]])){utils[_0x2cac('0x10')](util[_0x2cac('0x4')](_0x2cac('0x19'),_0x4d4646[_0x2cac('0x12')]),_0x4d4646);if(queues[_0x4d4646['uniqueid']][_0x2cac('0x1a')]){if(!queues[_0x4d4646[_0x2cac('0x12')]][_0x2cac('0x1b')]&&!queues[_0x4d4646[_0x2cac('0x12')]][_0x2cac('0x1c')]){queues[_0x4d4646[_0x2cac('0x12')]][_0x2cac('0x1d')]=!![];queues[_0x4d4646[_0x2cac('0x12')]]['queuecallercompleteAt']=utils[_0x2cac('0x16')]();queues[_0x4d4646[_0x2cac('0x12')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils[_0x2cac('0x3')](util['format'](_0x2cac('0x1e'),_0x4d4646[_0x2cac('0x12')],queues[_0x4d4646['uniqueid']][_0x2cac('0x1f')],queues[_0x4d4646['uniqueid']][_0x2cac('0x8')]));writeDB(queues[_0x4d4646[_0x2cac('0x12')]]);}else if(queues[_0x4d4646[_0x2cac('0x12')]][_0x2cac('0xe')]){utils['info'](util[_0x2cac('0x4')](_0x2cac('0x20'),_0x4d4646[_0x2cac('0x12')],queues[_0x4d4646[_0x2cac('0x12')]][_0x2cac('0x1f')],queues[_0x4d4646[_0x2cac('0x12')]]['transfereduniqueid']));queues[queues[_0x4d4646[_0x2cac('0x12')]][_0x2cac('0xe')]]=queues[_0x4d4646['uniqueid']];queues[queues[_0x4d4646[_0x2cac('0x12')]]['transfereduniqueid']][_0x2cac('0x21')]=0x2;delete queues[_0x4d4646[_0x2cac('0x12')]];}}}catch(_0x5d70a7){utils['error'](util[_0x2cac('0x4')](_0x2cac('0x19'),_0x4d4646[_0x2cac('0x12')]),_0x5d70a7);}};exports['varset']=function(_0x1657c5){try{utils[_0x2cac('0x10')](util[_0x2cac('0x4')]('[%s][queues][varset]',_0x1657c5[_0x2cac('0x12')]),_0x1657c5);if(!_[_0x2cac('0x22')](_0x1657c5[_0x2cac('0x23')][_0x2cac('0x24')])&&_0x1657c5[_0x2cac('0x25')][_0x2cac('0x26')]()!==_0x2cac('0x27')){if(!_['isNil'](queues[_0x1657c5[_0x2cac('0x12')]])){queues[_0x1657c5[_0x2cac('0x12')]][_0x2cac('0x1b')]=![];queues[_0x1657c5['uniqueid']][_0x2cac('0x28')]=null;queues[_0x1657c5[_0x2cac('0x12')]][_0x2cac('0x1c')]=!![];queues[_0x1657c5[_0x2cac('0x12')]][_0x2cac('0x29')]=utils[_0x2cac('0x16')]();queues[_0x1657c5[_0x2cac('0x12')]][_0x2cac('0x8')]=_0x1657c5[_0x2cac('0x25')]['toUpperCase']();utils['info'](util['format'](_0x2cac('0x2a'),_0x1657c5[_0x2cac('0x12')],queues[_0x1657c5['uniqueid']]['name'],_0x1657c5['value'],queues[_0x1657c5['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x1657c5[_0x2cac('0x12')]]);}}else if(!_['isNil'](_0x1657c5[_0x2cac('0x23')][_0x2cac('0x2b')])){if(!_[_0x2cac('0x22')](queues[_0x1657c5[_0x2cac('0x12')]])&&!queues[_0x1657c5[_0x2cac('0x12')]][_0x2cac('0x1b')]){queues[_0x1657c5[_0x2cac('0x12')]][_0x2cac('0x1b')]=![];queues[_0x1657c5[_0x2cac('0x12')]][_0x2cac('0x28')]=null;queues[_0x1657c5['uniqueid']][_0x2cac('0x1c')]=!![];queues[_0x1657c5[_0x2cac('0x12')]]['queuecallerexitAt']=utils['now']();queues[_0x1657c5[_0x2cac('0x12')]][_0x2cac('0x8')]=_0x2cac('0x2c');utils[_0x2cac('0x3')](util[_0x2cac('0x4')](_0x2cac('0x2d'),_0x1657c5[_0x2cac('0x12')],queues[_0x1657c5[_0x2cac('0x12')]][_0x2cac('0x1f')],_0x1657c5[_0x2cac('0x25')],queues[_0x1657c5['uniqueid']]['queuecallerexitreason']));}}}catch(_0x2124e1){utils[_0x2cac('0x17')](util[_0x2cac('0x4')](_0x2cac('0x2e'),_0x1657c5[_0x2cac('0x12')]),_0x2124e1);}};exports[_0x2cac('0x1b')]=function(_0x467b6b){try{if(!_[_0x2cac('0x22')](queues[_0x467b6b[_0x2cac('0x12')]])){utils[_0x2cac('0x10')](util['format'](_0x2cac('0x2f'),_0x467b6b[_0x2cac('0x12')]),_0x467b6b);queues[_0x467b6b[_0x2cac('0x12')]][_0x2cac('0x1c')]=![];queues[_0x467b6b[_0x2cac('0x12')]]['queuecallerexitAt']=null;queues[_0x467b6b[_0x2cac('0x12')]][_0x2cac('0x1b')]=!![];queues[_0x467b6b['uniqueid']][_0x2cac('0x28')]=utils[_0x2cac('0x16')]();queues[_0x467b6b[_0x2cac('0x12')]][_0x2cac('0x8')]=_0x2cac('0x30');utils[_0x2cac('0x3')](util['format'](_0x2cac('0x31'),_0x467b6b[_0x2cac('0x12')],queues[_0x467b6b['uniqueid']][_0x2cac('0x1f')],queues[_0x467b6b[_0x2cac('0x12')]][_0x2cac('0x8')]));}}catch(_0x48f174){utils[_0x2cac('0x17')](util['format']('[%s][queues][queuecallerabandon]',_0x467b6b['uniqueid']),_0x48f174);}};exports[_0x2cac('0x32')]=function(_0x2fdff6){try{if(!_['isNil'](queues[_0x2fdff6['uniqueid']])){utils[_0x2cac('0x10')](util[_0x2cac('0x4')](_0x2cac('0x33'),_0x2fdff6[_0x2cac('0x12')]),_0x2fdff6);utils[_0x2cac('0x3')](util['format'](_0x2cac('0x34'),_0x2fdff6[_0x2cac('0x12')],queues[_0x2fdff6[_0x2cac('0x12')]][_0x2cac('0x1f')],_0x2fdff6['connectedlinenum'],_0x2fdff6[_0x2cac('0x35')]));queues[_0x2fdff6[_0x2cac('0x12')]][_0x2cac('0x32')]=!![];queues[_0x2fdff6[_0x2cac('0x12')]][_0x2cac('0x1a')]=utils['now']();queues[_0x2fdff6[_0x2cac('0x12')]]['holdtime']=utils[_0x2cac('0x36')](queues[_0x2fdff6[_0x2cac('0x12')]][_0x2cac('0x1a')],queues[_0x2fdff6[_0x2cac('0x12')]][_0x2cac('0x37')]);queues[_0x2fdff6[_0x2cac('0x12')]][_0x2cac('0x14')]=_0x2fdff6[_0x2cac('0x14')];queues[_0x2fdff6[_0x2cac('0x12')]][_0x2cac('0x38')]=_0x2fdff6[_0x2cac('0x38')];queues[_0x2fdff6[_0x2cac('0x12')]][_0x2cac('0x39')]=_0x2fdff6[_0x2cac('0x39')];queues[_0x2fdff6[_0x2cac('0x12')]][_0x2cac('0x35')]=_0x2fdff6[_0x2cac('0x35')];}}catch(_0x1f9653){utils[_0x2cac('0x17')](util['format'](_0x2cac('0x33'),_0x2fdff6[_0x2cac('0x12')]),_0x1f9653);}};exports[_0x2cac('0x3a')]=function(_0x5975cc){try{if(!_['isNil'](queues[_0x5975cc[_0x2cac('0x12')]])){utils[_0x2cac('0x10')](util[_0x2cac('0x4')](_0x2cac('0x3b'),_0x5975cc[_0x2cac('0x12')]),_0x5975cc);utils[_0x2cac('0x3')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x5975cc['uniqueid'],queues[_0x5975cc[_0x2cac('0x12')]]['name'],_0x5975cc[_0x2cac('0x3c')],_0x5975cc[_0x2cac('0x3d')]));queues[_0x5975cc[_0x2cac('0x12')]][_0x2cac('0x1b')]=![];queues[_0x5975cc[_0x2cac('0x12')]][_0x2cac('0x1b')]=![];queues[_0x5975cc[_0x2cac('0x12')]]['queuecallerabandonAt']=null;queues[_0x5975cc['uniqueid']]['queuecallerexit']=![];queues[_0x5975cc[_0x2cac('0x12')]][_0x2cac('0x8')]=null;queues[_0x5975cc[_0x2cac('0x12')]][_0x2cac('0x29')]=null;queues[_0x5975cc['uniqueid']]['assigned']=!![];queues[_0x5975cc['uniqueid']][_0x2cac('0x7')]=_0x5975cc['destaccountcode'];queues[_0x5975cc[_0x2cac('0x12')]][_0x2cac('0x5')]=_0x5975cc[_0x2cac('0x3c')];}}catch(_0x2ec788){utils[_0x2cac('0x17')](util[_0x2cac('0x4')](_0x2cac('0x3b'),_0x5975cc['uniqueid']),_0x2ec788);}};exports['agentcomplete']=function(_0x31a443){try{if(!_[_0x2cac('0x22')](queues[_0x31a443[_0x2cac('0x12')]])){if(queues[_0x31a443['uniqueid']][_0x2cac('0x1a')]){utils[_0x2cac('0x10')](util[_0x2cac('0x4')](_0x2cac('0x3e'),_0x31a443['uniqueid']),_0x31a443);queues[_0x31a443[_0x2cac('0x12')]][_0x2cac('0x1b')]=![];queues[_0x31a443['uniqueid']]['queuecallerabandon']=![];queues[_0x31a443[_0x2cac('0x12')]]['queuecallerabandonAt']=null;queues[_0x31a443['uniqueid']][_0x2cac('0x1c')]=![];queues[_0x31a443[_0x2cac('0x12')]][_0x2cac('0x29')]=null;queues[_0x31a443[_0x2cac('0x12')]][_0x2cac('0x3f')]=!![];queues[_0x31a443[_0x2cac('0x12')]][_0x2cac('0x5')]=_0x31a443[_0x2cac('0x3c')];queues[_0x31a443[_0x2cac('0x12')]]['queuecallercomplete']=!![];queues[_0x31a443[_0x2cac('0x12')]][_0x2cac('0x40')]=utils[_0x2cac('0x16')]();if(_0x31a443[_0x2cac('0x41')]==_0x2cac('0x42')){if(!queues[_0x31a443['uniqueid']]['transfer']){queues[_0x31a443[_0x2cac('0x12')]][_0x2cac('0x8')]='TRANSFER';}}else{queues[_0x31a443[_0x2cac('0x12')]][_0x2cac('0x8')]='COMPLETEDBY'+_0x31a443[_0x2cac('0x41')][_0x2cac('0x26')]();}utils['info'](util[_0x2cac('0x4')](_0x2cac('0x43'),_0x31a443[_0x2cac('0x12')],queues[_0x31a443[_0x2cac('0x12')]]['name'],_0x31a443[_0x2cac('0x3c')],queues[_0x31a443['uniqueid']][_0x2cac('0x8')]));writeDB(queues[_0x31a443[_0x2cac('0x12')]]);}}}catch(_0x316bf2){utils['error'](util[_0x2cac('0x4')](_0x2cac('0x3e'),_0x31a443[_0x2cac('0x12')]),_0x316bf2);}};exports[_0x2cac('0x44')]=function(_0x314ed0){try{if(!_[_0x2cac('0x22')](queues[_0x314ed0[_0x2cac('0x45')]])){utils[_0x2cac('0x10')](util['format']('[%s][queues][blindtransfer]',_0x314ed0[_0x2cac('0x12')]),_0x314ed0);queues[_0x314ed0[_0x2cac('0x45')]]['transfer']=!![];queues[_0x314ed0['transfereeuniqueid']]['transfertype']=_0x2cac('0x46');queues[_0x314ed0[_0x2cac('0x45')]][_0x2cac('0x47')]=_0x314ed0[_0x2cac('0x48')];queues[_0x314ed0[_0x2cac('0x45')]][_0x2cac('0x49')]=_0x314ed0['transfereeuniqueid'];queues[_0x314ed0[_0x2cac('0x45')]][_0x2cac('0x8')]=_0x2cac('0x4a');utils[_0x2cac('0x3')](util['format'](_0x2cac('0x4b'),_0x314ed0[_0x2cac('0x12')],queues[_0x314ed0[_0x2cac('0x45')]][_0x2cac('0x1f')],_0x314ed0[_0x2cac('0x45')],_0x314ed0[_0x2cac('0x48')]));}}catch(_0x49b542){utils[_0x2cac('0x17')](util['format'](_0x2cac('0x4c'),_0x314ed0[_0x2cac('0x12')]),_0x49b542);}};exports[_0x2cac('0x4d')]=function(_0x551a2d){try{utils[_0x2cac('0x10')](util['format'](_0x2cac('0x4e'),_0x551a2d[_0x2cac('0x4f')]),_0x551a2d);if(_0x551a2d[_0x2cac('0x4f')]==_0x551a2d[_0x2cac('0x50')]){if(!_[_0x2cac('0x22')](queues[_0x551a2d[_0x2cac('0x51')]])){utils[_0x2cac('0x3')](util[_0x2cac('0x4')](_0x2cac('0x52'),_0x551a2d[_0x2cac('0x4f')],queues[_0x551a2d[_0x2cac('0x51')]][_0x2cac('0x1f')],_0x551a2d[_0x2cac('0x53')]));queues[_0x551a2d['secondtransfererlinkedid']][_0x2cac('0x42')]=!![];queues[_0x551a2d[_0x2cac('0x51')]][_0x2cac('0x54')]='ATTENDED';queues[_0x551a2d[_0x2cac('0x51')]][_0x2cac('0x47')]=_0x551a2d[_0x2cac('0x53')];queues[_0x551a2d[_0x2cac('0x51')]]['transferuniqueid']=_0x551a2d[_0x2cac('0x4f')];queues[_0x551a2d[_0x2cac('0x51')]][_0x2cac('0x8')]=_0x2cac('0x55');}if(!_[_0x2cac('0x22')](queues[_0x551a2d[_0x2cac('0x50')]])){if(_0x551a2d[_0x2cac('0x56')]&&queues[_0x551a2d[_0x2cac('0x56')]]){queues[_0x551a2d[_0x2cac('0x56')]]['queuecallerenterreason']=0x1;queues[_0x551a2d[_0x2cac('0x45')]]=_['clone'](queues[_0x551a2d[_0x2cac('0x56')]]);queues[_0x551a2d[_0x2cac('0x45')]][_0x2cac('0xe')]=_0x551a2d[_0x2cac('0x57')];queues[_0x551a2d[_0x2cac('0x45')]][_0x2cac('0x21')]=0x2;queues[_0x551a2d[_0x2cac('0x45')]][_0x2cac('0x6')]=queues[_0x551a2d[_0x2cac('0x51')]][_0x2cac('0x6')];queues[_0x551a2d['transfereeuniqueid']]['calleridname']=queues[_0x551a2d[_0x2cac('0x51')]][_0x2cac('0x58')];queues[_0x551a2d['transfereeuniqueid']][_0x2cac('0x37')]=utils[_0x2cac('0x16')]();queues[_0x551a2d[_0x2cac('0x45')]]['queuecallerleaveAt']=utils[_0x2cac('0x16')]();queues[_0x551a2d[_0x2cac('0x45')]][_0x2cac('0x59')]=0x0;queues[_0x551a2d[_0x2cac('0x45')]][_0x2cac('0x5a')]=0x0;utils[_0x2cac('0x3')](util['format'](_0x2cac('0x5b'),_0x551a2d[_0x2cac('0x4f')],queues[_0x551a2d[_0x2cac('0x45')]][_0x2cac('0x1f')],queues[_0x551a2d[_0x2cac('0x45')]][_0x2cac('0x6')],queues[_0x551a2d['transfereeuniqueid']][_0x2cac('0x58')]));}else{utils['info'](util['format'](_0x2cac('0x5c'),_0x551a2d[_0x2cac('0x4f')],queues[_0x551a2d[_0x2cac('0x50')]][_0x2cac('0x1f')],_0x551a2d['secondtransfererlinkedid']));queues[_0x551a2d[_0x2cac('0x50')]][_0x2cac('0xe')]=_0x551a2d[_0x2cac('0x51')];}}}else if(_0x551a2d[_0x2cac('0x5d')]==_0x551a2d[_0x2cac('0x51')]){if(!_[_0x2cac('0x22')](queues[_0x551a2d[_0x2cac('0x50')]])){utils[_0x2cac('0x3')](util[_0x2cac('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x551a2d[_0x2cac('0x4f')],queues[_0x551a2d['origtransfererlinkedid']][_0x2cac('0x1f')],_0x551a2d[_0x2cac('0x5d')],_0x551a2d[_0x2cac('0x5e')]));queues[_0x551a2d[_0x2cac('0x50')]][_0x2cac('0x42')]=!![];queues[_0x551a2d[_0x2cac('0x50')]][_0x2cac('0x54')]=_0x2cac('0x5f');queues[_0x551a2d[_0x2cac('0x50')]][_0x2cac('0x47')]=_0x551a2d['secondtransfererexten'];queues[_0x551a2d[_0x2cac('0x50')]]['transferuniqueid']=_0x551a2d[_0x2cac('0x5d')];queues[_0x551a2d[_0x2cac('0x50')]][_0x2cac('0x8')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x551a2d[_0x2cac('0x51')]])){if(_0x551a2d[_0x2cac('0x60')]&&queues[_0x551a2d[_0x2cac('0x60')]]){queues[_0x551a2d[_0x2cac('0x60')]][_0x2cac('0x21')]=0x1;queues[_0x551a2d['transfertargetuniqueid']]=_[_0x2cac('0x61')](queues[_0x551a2d[_0x2cac('0x60')]]);queues[_0x551a2d[_0x2cac('0x57')]][_0x2cac('0xe')]=_0x551a2d[_0x2cac('0x57')];queues[_0x551a2d[_0x2cac('0x57')]]['queuecallerenterreason']=0x2;queues[_0x551a2d[_0x2cac('0x57')]][_0x2cac('0x6')]=queues[_0x551a2d['origtransfererlinkedid']]['calleridnum'];queues[_0x551a2d['transfertargetuniqueid']][_0x2cac('0x58')]=queues[_0x551a2d[_0x2cac('0x50')]]['calleridname'];queues[_0x551a2d[_0x2cac('0x57')]][_0x2cac('0x37')]=utils['now']();queues[_0x551a2d[_0x2cac('0x57')]][_0x2cac('0x1a')]=utils[_0x2cac('0x16')]();queues[_0x551a2d[_0x2cac('0x57')]]['holdtime']=0x0;queues[_0x551a2d[_0x2cac('0x57')]][_0x2cac('0x5a')]=0x0;utils['info'](util['format'](_0x2cac('0x62'),_0x551a2d[_0x2cac('0x4f')],queues[_0x551a2d[_0x2cac('0x57')]]['name'],queues[_0x551a2d[_0x2cac('0x57')]][_0x2cac('0xe')],queues[_0x551a2d[_0x2cac('0x57')]][_0x2cac('0x6')],queues[_0x551a2d[_0x2cac('0x57')]]['calleridname']));}else{utils['info'](util[_0x2cac('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x551a2d[_0x2cac('0x4f')],queues[_0x551a2d[_0x2cac('0x51')]][_0x2cac('0x1f')],_0x551a2d[_0x2cac('0x50')]));queues[_0x551a2d[_0x2cac('0x51')]][_0x2cac('0xe')]=_0x551a2d[_0x2cac('0x50')];}}}}catch(_0x1b5778){utils['error'](util[_0x2cac('0x4')](_0x2cac('0x4e'),_0x551a2d[_0x2cac('0x4f')]),_0x1b5778);}};exports['musiconholdstart']=function(_0x438b6e){try{if(!_[_0x2cac('0x22')](queues[_0x438b6e['uniqueid']])){utils['debug'](util['format'](_0x2cac('0x63'),_0x438b6e['uniqueid']),_0x438b6e);queues[_0x438b6e['uniqueid']][_0x2cac('0x64')]=utils[_0x2cac('0x16')]();utils['info'](util[_0x2cac('0x4')](_0x2cac('0x65'),_0x438b6e[_0x2cac('0x12')],queues[_0x438b6e['uniqueid']][_0x2cac('0x1f')],queues[_0x438b6e[_0x2cac('0x12')]]['musiconholdstartAt']));}}catch(_0x6c7c50){utils[_0x2cac('0x17')](util[_0x2cac('0x4')](_0x2cac('0x63'),_0x438b6e[_0x2cac('0x12')]),_0x6c7c50);}};exports['musiconholdstop']=function(_0x3e611e){try{if(!_[_0x2cac('0x22')](queues[_0x3e611e['uniqueid']])){if(!_['isNil'](queues[_0x3e611e[_0x2cac('0x12')]]['musiconholdstartAt'])){utils[_0x2cac('0x10')](util['format']('[%s][queues][musiconholdstop]',_0x3e611e['uniqueid']),_0x3e611e);queues[_0x3e611e[_0x2cac('0x12')]][_0x2cac('0x5a')]+=utils['diffTime'](utils['now'](),queues[_0x3e611e[_0x2cac('0x12')]][_0x2cac('0x64')]);utils[_0x2cac('0x3')](util[_0x2cac('0x4')](_0x2cac('0x66'),_0x3e611e[_0x2cac('0x12')],queues[_0x3e611e[_0x2cac('0x12')]][_0x2cac('0x1f')],queues[_0x3e611e[_0x2cac('0x12')]][_0x2cac('0x5a')]));delete queues[_0x3e611e[_0x2cac('0x12')]][_0x2cac('0x64')];}}}catch(_0xc6e300){utils[_0x2cac('0x17')](util['format'](_0x2cac('0x67'),_0x3e611e[_0x2cac('0x12')]),_0xc6e300);}}; \ No newline at end of file +var _0x80e0=['position','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','[%s][queues][agentcomplete]','queuecallercomplete','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','origtransfererlinkedid','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','[%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','ATTENDEDTRANSFER','transfertargetlinkedid','mohtime','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queue','type','request','CreateVoiceQueueReport','queuecallerjoin','debug','format','now','[%s][queues][queuecallerjoin]','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercompleteAt','queuecallerexitreason','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','transfereduniqueid','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','error','varset','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime'];(function(_0x276796,_0x51fd78){var _0x230bfa=function(_0xa08e42){while(--_0xa08e42){_0x276796['push'](_0x276796['shift']());}};_0x230bfa(++_0x51fd78);}(_0x80e0,0x9d));var _0x080e=function(_0x4da03e,_0x494dcc){_0x4da03e=_0x4da03e-0x0;var _0x207cc3=_0x80e0[_0x4da03e];return _0x207cc3;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x080e('0x0'));var queues={};function writeDB(_0x29c84f){utils[_0x080e('0x1')](util['format'](_0x080e('0x2'),_0x29c84f[_0x080e('0x3')],_0x29c84f[_0x080e('0x4')],_0x29c84f['queue'],_0x29c84f[_0x080e('0x5')],_0x29c84f[_0x080e('0x6')],_0x29c84f[_0x080e('0x7')],_0x29c84f['queuecallerexitreason']));if(_0x29c84f['queue']){utils['getVoiceQueueByName'](_0x29c84f[_0x080e('0x8')])['then'](function(_0x2886dd){if(_0x2886dd){_0x29c84f['type']=_0x2886dd[_0x080e('0x9')];}utils[_0x080e('0xa')](_0x080e('0xb'),_0x29c84f);});}else{utils[_0x080e('0xa')](_0x080e('0xb'),_0x29c84f);}if(_0x29c84f['transfereduniqueid']){delete queues[_0x29c84f['transfereduniqueid']];}else{delete queues[_0x29c84f[_0x080e('0x3')]];}}exports[_0x080e('0xc')]=function(_0x453e2e){try{utils[_0x080e('0xd')](util['format']('[%s][queues][queuecallerjoin]',_0x453e2e[_0x080e('0x3')]),_0x453e2e);utils[_0x080e('0x1')](util[_0x080e('0xe')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x453e2e[_0x080e('0x3')],_0x453e2e[_0x080e('0x8')],_0x453e2e['position']));queues[_0x453e2e['uniqueid']]=_['assign'](_0x453e2e,{'originalposition':_0x453e2e['position'],'queuecallerjoinAt':utils[_0x080e('0xf')](),'mohtime':0x0});}catch(_0x16429a){utils['error'](util['format'](_0x080e('0x10'),_0x453e2e['uniqueid']),_0x16429a);}};exports['hangup']=function(_0x1b87fb){try{if(!_['isNil'](queues[_0x1b87fb[_0x080e('0x3')]])){utils[_0x080e('0xd')](util[_0x080e('0xe')](_0x080e('0x11'),_0x1b87fb['uniqueid']),_0x1b87fb);if(queues[_0x1b87fb[_0x080e('0x3')]][_0x080e('0x12')]){if(!queues[_0x1b87fb[_0x080e('0x3')]]['queuecallerabandon']&&!queues[_0x1b87fb[_0x080e('0x3')]][_0x080e('0x13')]){queues[_0x1b87fb[_0x080e('0x3')]]['queuecallercomplete']=!![];queues[_0x1b87fb[_0x080e('0x3')]][_0x080e('0x14')]=utils[_0x080e('0xf')]();queues[_0x1b87fb['uniqueid']][_0x080e('0x15')]='COMPLETEDBYAGENT';}utils[_0x080e('0x1')](util[_0x080e('0xe')](_0x080e('0x16'),_0x1b87fb[_0x080e('0x3')],queues[_0x1b87fb[_0x080e('0x3')]][_0x080e('0x17')],queues[_0x1b87fb[_0x080e('0x3')]]['queuecallerexitreason']));writeDB(queues[_0x1b87fb[_0x080e('0x3')]]);}else if(queues[_0x1b87fb[_0x080e('0x3')]][_0x080e('0x18')]){utils[_0x080e('0x1')](util[_0x080e('0xe')](_0x080e('0x19'),_0x1b87fb[_0x080e('0x3')],queues[_0x1b87fb[_0x080e('0x3')]][_0x080e('0x17')],queues[_0x1b87fb[_0x080e('0x3')]][_0x080e('0x18')]));queues[queues[_0x1b87fb['uniqueid']][_0x080e('0x18')]]=queues[_0x1b87fb['uniqueid']];queues[queues[_0x1b87fb[_0x080e('0x3')]][_0x080e('0x18')]]['queuecallerenterreason']=0x2;delete queues[_0x1b87fb[_0x080e('0x3')]];}}}catch(_0x3d7fa5){utils[_0x080e('0x1a')](util[_0x080e('0xe')](_0x080e('0x11'),_0x1b87fb[_0x080e('0x3')]),_0x3d7fa5);}};exports[_0x080e('0x1b')]=function(_0x142426){try{utils[_0x080e('0xd')](util['format']('[%s][queues][varset]',_0x142426[_0x080e('0x3')]),_0x142426);if(!_[_0x080e('0x1c')](_0x142426[_0x080e('0x1d')][_0x080e('0x1e')])&&_0x142426[_0x080e('0x1f')][_0x080e('0x20')]()!==_0x080e('0x21')){if(!_[_0x080e('0x1c')](queues[_0x142426[_0x080e('0x3')]])){queues[_0x142426[_0x080e('0x3')]][_0x080e('0x22')]=![];queues[_0x142426[_0x080e('0x3')]][_0x080e('0x23')]=null;queues[_0x142426['uniqueid']][_0x080e('0x13')]=!![];queues[_0x142426['uniqueid']][_0x080e('0x24')]=utils[_0x080e('0xf')]();queues[_0x142426[_0x080e('0x3')]][_0x080e('0x15')]=_0x142426[_0x080e('0x1f')][_0x080e('0x20')]();utils[_0x080e('0x1')](util[_0x080e('0xe')](_0x080e('0x25'),_0x142426[_0x080e('0x3')],queues[_0x142426[_0x080e('0x3')]][_0x080e('0x17')],_0x142426[_0x080e('0x1f')],queues[_0x142426['uniqueid']][_0x080e('0x15')]));writeDB(queues[_0x142426[_0x080e('0x3')]]);}}else if(!_[_0x080e('0x1c')](_0x142426['variable'][_0x080e('0x26')])){if(!_[_0x080e('0x1c')](queues[_0x142426[_0x080e('0x3')]])&&!queues[_0x142426[_0x080e('0x3')]][_0x080e('0x22')]){queues[_0x142426['uniqueid']]['queuecallerabandon']=![];queues[_0x142426[_0x080e('0x3')]][_0x080e('0x23')]=null;queues[_0x142426[_0x080e('0x3')]][_0x080e('0x13')]=!![];queues[_0x142426[_0x080e('0x3')]][_0x080e('0x24')]=utils[_0x080e('0xf')]();queues[_0x142426[_0x080e('0x3')]]['queuecallerexitreason']=_0x080e('0x27');utils['info'](util[_0x080e('0xe')](_0x080e('0x28'),_0x142426[_0x080e('0x3')],queues[_0x142426[_0x080e('0x3')]][_0x080e('0x17')],_0x142426[_0x080e('0x1f')],queues[_0x142426[_0x080e('0x3')]][_0x080e('0x15')]));}}}catch(_0x392530){utils[_0x080e('0x1a')](util[_0x080e('0xe')](_0x080e('0x29'),_0x142426[_0x080e('0x3')]),_0x392530);}};exports[_0x080e('0x22')]=function(_0x4a59ce){try{if(!_[_0x080e('0x1c')](queues[_0x4a59ce[_0x080e('0x3')]])){utils['debug'](util[_0x080e('0xe')]('[%s][queues][queuecallerabandon]',_0x4a59ce[_0x080e('0x3')]),_0x4a59ce);queues[_0x4a59ce[_0x080e('0x3')]][_0x080e('0x13')]=![];queues[_0x4a59ce['uniqueid']]['queuecallerexitAt']=null;queues[_0x4a59ce['uniqueid']]['queuecallerabandon']=!![];queues[_0x4a59ce[_0x080e('0x3')]][_0x080e('0x23')]=utils[_0x080e('0xf')]();queues[_0x4a59ce[_0x080e('0x3')]][_0x080e('0x15')]=_0x080e('0x2a');utils[_0x080e('0x1')](util[_0x080e('0xe')](_0x080e('0x2b'),_0x4a59ce['uniqueid'],queues[_0x4a59ce[_0x080e('0x3')]][_0x080e('0x17')],queues[_0x4a59ce['uniqueid']][_0x080e('0x15')]));}}catch(_0x3adcd9){utils[_0x080e('0x1a')](util[_0x080e('0xe')](_0x080e('0x2c'),_0x4a59ce[_0x080e('0x3')]),_0x3adcd9);}};exports[_0x080e('0x2d')]=function(_0x1a3e48){try{if(!_[_0x080e('0x1c')](queues[_0x1a3e48['uniqueid']])){utils['debug'](util[_0x080e('0xe')]('[%s][queues][queuecallerleave]',_0x1a3e48[_0x080e('0x3')]),_0x1a3e48);utils[_0x080e('0x1')](util[_0x080e('0xe')](_0x080e('0x2e'),_0x1a3e48[_0x080e('0x3')],queues[_0x1a3e48[_0x080e('0x3')]]['name'],_0x1a3e48[_0x080e('0x2f')],_0x1a3e48[_0x080e('0x30')]));queues[_0x1a3e48['uniqueid']][_0x080e('0x2d')]=!![];queues[_0x1a3e48[_0x080e('0x3')]]['queuecallerleaveAt']=utils['now']();queues[_0x1a3e48[_0x080e('0x3')]][_0x080e('0x31')]=utils[_0x080e('0x32')](queues[_0x1a3e48[_0x080e('0x3')]][_0x080e('0x12')],queues[_0x1a3e48[_0x080e('0x3')]]['queuecallerjoinAt']);queues[_0x1a3e48['uniqueid']][_0x080e('0x33')]=_0x1a3e48['position'];queues[_0x1a3e48['uniqueid']]['count']=_0x1a3e48[_0x080e('0x34')];queues[_0x1a3e48[_0x080e('0x3')]][_0x080e('0x2f')]=_0x1a3e48[_0x080e('0x2f')];queues[_0x1a3e48[_0x080e('0x3')]]['connectedlinename']=_0x1a3e48[_0x080e('0x30')];}}catch(_0x46389a){utils['error'](util[_0x080e('0xe')](_0x080e('0x35'),_0x1a3e48[_0x080e('0x3')]),_0x46389a);}};exports[_0x080e('0x36')]=function(_0x46f7ab){try{if(!_[_0x080e('0x1c')](queues[_0x46f7ab[_0x080e('0x3')]])){utils[_0x080e('0xd')](util[_0x080e('0xe')](_0x080e('0x37'),_0x46f7ab[_0x080e('0x3')]),_0x46f7ab);utils[_0x080e('0x1')](util[_0x080e('0xe')](_0x080e('0x38'),_0x46f7ab[_0x080e('0x3')],queues[_0x46f7ab[_0x080e('0x3')]][_0x080e('0x17')],_0x46f7ab[_0x080e('0x39')],_0x46f7ab['destaccountcode']));queues[_0x46f7ab[_0x080e('0x3')]]['queuecallerabandon']=![];queues[_0x46f7ab[_0x080e('0x3')]]['queuecallerabandon']=![];queues[_0x46f7ab['uniqueid']][_0x080e('0x23')]=null;queues[_0x46f7ab[_0x080e('0x3')]][_0x080e('0x13')]=![];queues[_0x46f7ab['uniqueid']][_0x080e('0x15')]=null;queues[_0x46f7ab[_0x080e('0x3')]][_0x080e('0x24')]=null;queues[_0x46f7ab[_0x080e('0x3')]][_0x080e('0x3a')]=!![];queues[_0x46f7ab[_0x080e('0x3')]][_0x080e('0x7')]=_0x46f7ab[_0x080e('0x3b')];queues[_0x46f7ab[_0x080e('0x3')]][_0x080e('0x5')]=_0x46f7ab[_0x080e('0x39')];}}catch(_0x4dc592){utils[_0x080e('0x1a')](util[_0x080e('0xe')]('[%s][queues][agentconnect]',_0x46f7ab['uniqueid']),_0x4dc592);}};exports['agentcomplete']=function(_0x2cb542){try{if(!_[_0x080e('0x1c')](queues[_0x2cb542['uniqueid']])){if(queues[_0x2cb542['uniqueid']][_0x080e('0x12')]){utils[_0x080e('0xd')](util[_0x080e('0xe')](_0x080e('0x3c'),_0x2cb542[_0x080e('0x3')]),_0x2cb542);queues[_0x2cb542['uniqueid']][_0x080e('0x22')]=![];queues[_0x2cb542[_0x080e('0x3')]][_0x080e('0x22')]=![];queues[_0x2cb542['uniqueid']][_0x080e('0x23')]=null;queues[_0x2cb542['uniqueid']]['queuecallerexit']=![];queues[_0x2cb542[_0x080e('0x3')]][_0x080e('0x24')]=null;queues[_0x2cb542[_0x080e('0x3')]][_0x080e('0x3a')]=!![];queues[_0x2cb542['uniqueid']][_0x080e('0x5')]=_0x2cb542[_0x080e('0x39')];queues[_0x2cb542[_0x080e('0x3')]][_0x080e('0x3d')]=!![];queues[_0x2cb542[_0x080e('0x3')]]['queuecallercompleteAt']=utils[_0x080e('0xf')]();if(_0x2cb542[_0x080e('0x3e')]==_0x080e('0x3f')){if(!queues[_0x2cb542[_0x080e('0x3')]][_0x080e('0x3f')]){queues[_0x2cb542['uniqueid']][_0x080e('0x15')]='TRANSFER';}}else{queues[_0x2cb542[_0x080e('0x3')]][_0x080e('0x15')]=_0x080e('0x40')+_0x2cb542['reason'][_0x080e('0x20')]();}utils[_0x080e('0x1')](util[_0x080e('0xe')](_0x080e('0x41'),_0x2cb542[_0x080e('0x3')],queues[_0x2cb542['uniqueid']][_0x080e('0x17')],_0x2cb542['membername'],queues[_0x2cb542[_0x080e('0x3')]][_0x080e('0x15')]));writeDB(queues[_0x2cb542[_0x080e('0x3')]]);}}}catch(_0x48d8f8){utils['error'](util[_0x080e('0xe')]('[%s][queues][agentcomplete]',_0x2cb542[_0x080e('0x3')]),_0x48d8f8);}};exports[_0x080e('0x42')]=function(_0x23da58){try{if(!_[_0x080e('0x1c')](queues[_0x23da58[_0x080e('0x43')]])){utils['debug'](util[_0x080e('0xe')](_0x080e('0x44'),_0x23da58[_0x080e('0x3')]),_0x23da58);queues[_0x23da58[_0x080e('0x43')]]['transfer']=!![];queues[_0x23da58['transfereeuniqueid']][_0x080e('0x45')]='BLIND';queues[_0x23da58[_0x080e('0x43')]][_0x080e('0x46')]=_0x23da58[_0x080e('0x47')];queues[_0x23da58[_0x080e('0x43')]][_0x080e('0x48')]=_0x23da58[_0x080e('0x43')];queues[_0x23da58['transfereeuniqueid']][_0x080e('0x15')]=_0x080e('0x49');utils[_0x080e('0x1')](util[_0x080e('0xe')](_0x080e('0x4a'),_0x23da58['uniqueid'],queues[_0x23da58[_0x080e('0x43')]]['name'],_0x23da58[_0x080e('0x43')],_0x23da58[_0x080e('0x47')]));}}catch(_0x2aee7b){utils[_0x080e('0x1a')](util[_0x080e('0xe')](_0x080e('0x44'),_0x23da58[_0x080e('0x3')]),_0x2aee7b);}};exports[_0x080e('0x4b')]=function(_0x1ece32){try{utils[_0x080e('0xd')](util[_0x080e('0xe')](_0x080e('0x4c'),_0x1ece32[_0x080e('0x4d')]),_0x1ece32);if(_0x1ece32[_0x080e('0x4d')]==_0x1ece32['origtransfererlinkedid']){if(!_[_0x080e('0x1c')](queues[_0x1ece32[_0x080e('0x4e')]])){utils[_0x080e('0x1')](util[_0x080e('0xe')](_0x080e('0x4f'),_0x1ece32[_0x080e('0x4d')],queues[_0x1ece32[_0x080e('0x4e')]]['name'],_0x1ece32[_0x080e('0x50')]));queues[_0x1ece32[_0x080e('0x4e')]][_0x080e('0x3f')]=!![];queues[_0x1ece32[_0x080e('0x4e')]]['transfertype']=_0x080e('0x51');queues[_0x1ece32[_0x080e('0x4e')]]['transferexten']=_0x1ece32['origtransfererexten'];queues[_0x1ece32['secondtransfererlinkedid']][_0x080e('0x48')]=_0x1ece32[_0x080e('0x4d')];queues[_0x1ece32[_0x080e('0x4e')]][_0x080e('0x15')]='ATTENDEDTRANSFER';}if(!_[_0x080e('0x1c')](queues[_0x1ece32[_0x080e('0x52')]])){if(_0x1ece32[_0x080e('0x53')]&&queues[_0x1ece32[_0x080e('0x53')]]){queues[_0x1ece32[_0x080e('0x53')]][_0x080e('0x54')]=0x1;queues[_0x1ece32[_0x080e('0x43')]]=_[_0x080e('0x55')](queues[_0x1ece32['transfereelinkedid']]);queues[_0x1ece32[_0x080e('0x43')]][_0x080e('0x18')]=_0x1ece32[_0x080e('0x56')];queues[_0x1ece32[_0x080e('0x43')]][_0x080e('0x54')]=0x2;queues[_0x1ece32[_0x080e('0x43')]]['calleridnum']=queues[_0x1ece32['secondtransfererlinkedid']][_0x080e('0x6')];queues[_0x1ece32['transfereeuniqueid']][_0x080e('0x57')]=queues[_0x1ece32['secondtransfererlinkedid']][_0x080e('0x57')];queues[_0x1ece32['transfereeuniqueid']][_0x080e('0x58')]=utils[_0x080e('0xf')]();queues[_0x1ece32[_0x080e('0x43')]][_0x080e('0x12')]=utils[_0x080e('0xf')]();queues[_0x1ece32[_0x080e('0x43')]]['holdtime']=0x0;queues[_0x1ece32[_0x080e('0x43')]]['mohtime']=0x0;utils['info'](util[_0x080e('0xe')](_0x080e('0x59'),_0x1ece32[_0x080e('0x4d')],queues[_0x1ece32[_0x080e('0x43')]][_0x080e('0x17')],queues[_0x1ece32[_0x080e('0x43')]][_0x080e('0x6')],queues[_0x1ece32[_0x080e('0x43')]][_0x080e('0x57')]));}else{utils[_0x080e('0x1')](util[_0x080e('0xe')](_0x080e('0x5a'),_0x1ece32[_0x080e('0x4d')],queues[_0x1ece32['origtransfererlinkedid']]['name'],_0x1ece32[_0x080e('0x4e')]));queues[_0x1ece32[_0x080e('0x52')]][_0x080e('0x18')]=_0x1ece32['secondtransfererlinkedid'];}}}else if(_0x1ece32[_0x080e('0x5b')]==_0x1ece32[_0x080e('0x4e')]){if(!_[_0x080e('0x1c')](queues[_0x1ece32[_0x080e('0x52')]])){utils['info'](util['format'](_0x080e('0x5c'),_0x1ece32[_0x080e('0x4d')],queues[_0x1ece32[_0x080e('0x52')]]['name'],_0x1ece32['secondtransfereruniqueid'],_0x1ece32[_0x080e('0x5d')]));queues[_0x1ece32['origtransfererlinkedid']][_0x080e('0x3f')]=!![];queues[_0x1ece32[_0x080e('0x52')]][_0x080e('0x45')]='ATTENDED';queues[_0x1ece32[_0x080e('0x52')]]['transferexten']=_0x1ece32[_0x080e('0x5d')];queues[_0x1ece32['origtransfererlinkedid']][_0x080e('0x48')]=_0x1ece32['secondtransfereruniqueid'];queues[_0x1ece32[_0x080e('0x52')]]['queuecallerexitreason']=_0x080e('0x5e');}if(!_[_0x080e('0x1c')](queues[_0x1ece32[_0x080e('0x4e')]])){if(_0x1ece32[_0x080e('0x5f')]&&queues[_0x1ece32[_0x080e('0x5f')]]){queues[_0x1ece32[_0x080e('0x5f')]][_0x080e('0x54')]=0x1;queues[_0x1ece32[_0x080e('0x56')]]=_[_0x080e('0x55')](queues[_0x1ece32[_0x080e('0x5f')]]);queues[_0x1ece32[_0x080e('0x56')]][_0x080e('0x18')]=_0x1ece32[_0x080e('0x56')];queues[_0x1ece32['transfertargetuniqueid']][_0x080e('0x54')]=0x2;queues[_0x1ece32[_0x080e('0x56')]][_0x080e('0x6')]=queues[_0x1ece32[_0x080e('0x52')]][_0x080e('0x6')];queues[_0x1ece32[_0x080e('0x56')]][_0x080e('0x57')]=queues[_0x1ece32[_0x080e('0x52')]][_0x080e('0x57')];queues[_0x1ece32['transfertargetuniqueid']][_0x080e('0x58')]=utils[_0x080e('0xf')]();queues[_0x1ece32[_0x080e('0x56')]][_0x080e('0x12')]=utils[_0x080e('0xf')]();queues[_0x1ece32[_0x080e('0x56')]][_0x080e('0x31')]=0x0;queues[_0x1ece32['transfertargetuniqueid']][_0x080e('0x60')]=0x0;utils[_0x080e('0x1')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x1ece32[_0x080e('0x4d')],queues[_0x1ece32['transfertargetuniqueid']]['name'],queues[_0x1ece32['transfertargetuniqueid']][_0x080e('0x18')],queues[_0x1ece32[_0x080e('0x56')]][_0x080e('0x6')],queues[_0x1ece32[_0x080e('0x56')]][_0x080e('0x57')]));}else{utils[_0x080e('0x1')](util['format'](_0x080e('0x5a'),_0x1ece32['origtransfereruniqueid'],queues[_0x1ece32['secondtransfererlinkedid']]['name'],_0x1ece32[_0x080e('0x52')]));queues[_0x1ece32[_0x080e('0x4e')]][_0x080e('0x18')]=_0x1ece32[_0x080e('0x52')];}}}}catch(_0x57cbd4){utils[_0x080e('0x1a')](util[_0x080e('0xe')]('[%s][queues][attendedtransfer]',_0x1ece32[_0x080e('0x4d')]),_0x57cbd4);}};exports[_0x080e('0x61')]=function(_0x4aa47e){try{if(!_[_0x080e('0x1c')](queues[_0x4aa47e[_0x080e('0x3')]])){utils[_0x080e('0xd')](util[_0x080e('0xe')](_0x080e('0x62'),_0x4aa47e['uniqueid']),_0x4aa47e);queues[_0x4aa47e[_0x080e('0x3')]][_0x080e('0x63')]=utils['now']();utils['info'](util[_0x080e('0xe')](_0x080e('0x64'),_0x4aa47e[_0x080e('0x3')],queues[_0x4aa47e['uniqueid']][_0x080e('0x17')],queues[_0x4aa47e[_0x080e('0x3')]]['musiconholdstartAt']));}}catch(_0x5ad26e){utils[_0x080e('0x1a')](util[_0x080e('0xe')](_0x080e('0x62'),_0x4aa47e[_0x080e('0x3')]),_0x5ad26e);}};exports[_0x080e('0x65')]=function(_0x40835c){try{if(!_[_0x080e('0x1c')](queues[_0x40835c[_0x080e('0x3')]])){if(!_[_0x080e('0x1c')](queues[_0x40835c['uniqueid']][_0x080e('0x63')])){utils[_0x080e('0xd')](util[_0x080e('0xe')](_0x080e('0x66'),_0x40835c[_0x080e('0x3')]),_0x40835c);queues[_0x40835c['uniqueid']]['mohtime']+=utils[_0x080e('0x32')](utils[_0x080e('0xf')](),queues[_0x40835c['uniqueid']][_0x080e('0x63')]);utils[_0x080e('0x1')](util[_0x080e('0xe')](_0x080e('0x67'),_0x40835c['uniqueid'],queues[_0x40835c['uniqueid']][_0x080e('0x17')],queues[_0x40835c['uniqueid']]['mohtime']));delete queues[_0x40835c['uniqueid']][_0x080e('0x63')];}}}catch(_0x172b74){utils[_0x080e('0x1a')](util['format'](_0x080e('0x66'),_0x40835c[_0x080e('0x3')]),_0x172b74);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index c272d00..9b667df 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 _0xa508=['outbound','monitors','forEach','clone','[%s][recordings][hangup]','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','util','info','uniqueid','accountcode','getUserByInternal','then','membername','UserId','request','CreateVoiceRecording','newchannel','debug','format','linkedid','exten','context','channel','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','channelstate','transfer','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','.WAV','find','push','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename'];(function(_0x202f1d,_0x4863d1){var _0x22ad04=function(_0x214e9a){while(--_0x214e9a){_0x202f1d['push'](_0x202f1d['shift']());}};_0x22ad04(++_0x4863d1);}(_0xa508,0x187));var _0x8a50=function(_0x4c1327,_0xd2183e){_0x4c1327=_0x4c1327-0x0;var _0x436f33=_0xa508[_0x4c1327];return _0x436f33;};'use strict';var _=require(_0x8a50('0x0'));var util=require(_0x8a50('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x428d67){utils[_0x8a50('0x2')](util['format']('[%s][recordings][writeDB]',_0x428d67[_0x8a50('0x3')]));if(_0x428d67[_0x8a50('0x4')]){utils[_0x8a50('0x5')](_0x428d67['accountcode'])[_0x8a50('0x6')](function(_0x297214){if(_0x297214){_0x428d67[_0x8a50('0x7')]=_0x297214['name'];_0x428d67[_0x8a50('0x8')]=_0x297214['id'];}utils[_0x8a50('0x9')](_0x8a50('0xa'),_0x428d67);});}else{utils['request'](_0x8a50('0xa'),_0x428d67);}}exports[_0x8a50('0xb')]=function(_0x21ef6f){try{utils[_0x8a50('0xc')](util[_0x8a50('0xd')]('[%s][recordings][newchannel]',_0x21ef6f[_0x8a50('0x3')]),_0x21ef6f);if(_0x21ef6f[_0x8a50('0x3')]==_0x21ef6f[_0x8a50('0xe')]){utils[_0x8a50('0x2')](util[_0x8a50('0xd')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x21ef6f[_0x8a50('0x3')],_0x21ef6f['context'],_0x21ef6f[_0x8a50('0xf')]));recordings[_0x21ef6f[_0x8a50('0x3')]]={'uniqueid':_0x21ef6f[_0x8a50('0x3')],'accountcode':_0x21ef6f[_0x8a50('0x4')],'exten':_0x21ef6f['exten'],'context':_0x21ef6f[_0x8a50('0x10')],'channel':_0x21ef6f[_0x8a50('0x11')],'monitors':[]};}}catch(_0x4276b7){utils['error'](util[_0x8a50('0xd')](_0x8a50('0x12'),_0x21ef6f[_0x8a50('0x3')]),_0x4276b7);}};exports[_0x8a50('0x13')]=function(_0x280f06){try{utils[_0x8a50('0xc')](util[_0x8a50('0xd')](_0x8a50('0x14'),_0x280f06[_0x8a50('0x3')]),_0x280f06);if(!_['isNil'](recordings[_0x280f06[_0x8a50('0x3')]])&&_0x280f06['channelstate']==0x6){utils[_0x8a50('0x2')](util[_0x8a50('0xd')](_0x8a50('0x15'),_0x280f06[_0x8a50('0x3')],_0x280f06['context'],_0x280f06['channel']));}else if(!_[_0x8a50('0x16')](recordings[_0x280f06[_0x8a50('0xe')]])&&_0x280f06[_0x8a50('0x17')]==0x6&&_0x280f06[_0x8a50('0x10')]!=_0x8a50('0x18')){utils[_0x8a50('0x2')](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x280f06[_0x8a50('0x3')],_0x280f06[_0x8a50('0xe')],_0x280f06[_0x8a50('0x10')],_0x280f06['channel']));recordings[_0x280f06[_0x8a50('0xe')]]['accountcode']=_0x280f06[_0x8a50('0x4')];}}catch(_0x52a026){utils[_0x8a50('0x19')](util[_0x8a50('0xd')](_0x8a50('0x14'),_0x280f06['uniqueid']),_0x52a026);}};exports[_0x8a50('0x1a')]=function(_0x5424a1){try{if(!_[_0x8a50('0x16')](_0x5424a1['variable'])&&!_['isNil'](_0x5424a1[_0x8a50('0x1b')][_0x8a50('0x1c')])){utils['debug'](util[_0x8a50('0xd')](_0x8a50('0x1d'),_0x5424a1[_0x8a50('0x3')]),_0x5424a1);utils[_0x8a50('0x2')](util[_0x8a50('0xd')](_0x8a50('0x1e'),_0x5424a1[_0x8a50('0x3')],_0x5424a1[_0x8a50('0x1b')],_0x5424a1[_0x8a50('0x1f')]));if(_['endsWith'](_0x5424a1[_0x8a50('0x1f')],_0x8a50('0x20'))){_0x5424a1[_0x8a50('0x1f')]=_0x5424a1[_0x8a50('0x1f')][_0x8a50('0x21')]('.wav49',_0x8a50('0x22'));}if(recordings[_0x5424a1['linkedid']]){var _0x34acf0=_[_0x8a50('0x23')](recordings[_0x5424a1['linkedid']]['monitors'],{'value':_0x5424a1['value']});if(_[_0x8a50('0x16')](_0x34acf0)){recordings[_0x5424a1[_0x8a50('0xe')]]['monitors'][_0x8a50('0x24')]({'value':_0x5424a1[_0x8a50('0x1f')]});}}}}catch(_0x3730ab){utils[_0x8a50('0x19')](util[_0x8a50('0xd')](_0x8a50('0x1d'),_0x5424a1[_0x8a50('0x3')]),_0x3730ab);}};exports['hangup']=function(_0x3ff553){try{if(!_[_0x8a50('0x16')](recordings[_0x3ff553['uniqueid']])){utils['debug'](util[_0x8a50('0xd')]('[%s][recordings][hangup]',_0x3ff553[_0x8a50('0x3')]),_0x3ff553);utils[_0x8a50('0x2')](util[_0x8a50('0xd')](_0x8a50('0x25'),_0x3ff553[_0x8a50('0x3')],_0x3ff553[_0x8a50('0x26')],_0x3ff553[_0x8a50('0x27')],_0x3ff553[_0x8a50('0x28')]));recordings[_0x3ff553[_0x8a50('0x3')]]['calleridnum']=_0x3ff553[_0x8a50('0x26')];recordings[_0x3ff553[_0x8a50('0x3')]]['calleridname']=_0x3ff553[_0x8a50('0x27')];recordings[_0x3ff553[_0x8a50('0x3')]][_0x8a50('0x29')]=_0x3ff553[_0x8a50('0x29')];recordings[_0x3ff553[_0x8a50('0x3')]][_0x8a50('0x2a')]=_0x3ff553['connectedlinename'];if(recordings[_0x3ff553['uniqueid']]['type']==_0x8a50('0x2b')&&recordings[_0x3ff553[_0x8a50('0x3')]][_0x8a50('0x4')]){recordings[_0x3ff553[_0x8a50('0x3')]]['connectedlinenum']=recordings[_0x3ff553['uniqueid']][_0x8a50('0x4')];recordings[_0x3ff553[_0x8a50('0x3')]][_0x8a50('0x2a')]='';}recordings[_0x3ff553[_0x8a50('0x3')]][_0x8a50('0x2c')][_0x8a50('0x2d')](function(_0x3a4c81){var _0x4859c9=_[_0x8a50('0x2e')](recordings[_0x3ff553[_0x8a50('0x3')]]);_0x4859c9[_0x8a50('0x1f')]=_0x3a4c81['value'];writeDB(_0x4859c9);});delete recordings[_0x3ff553['uniqueid']];}}catch(_0x3e69d2){utils[_0x8a50('0x19')](util[_0x8a50('0xd')](_0x8a50('0x2f'),_0x3ff553[_0x8a50('0x3')]),_0x3e69d2);}};exports['newexten']=function(_0x25b754){try{if(!_[_0x8a50('0x16')](recordings[_0x25b754[_0x8a50('0x3')]])){utils[_0x8a50('0xc')](util['format'](_0x8a50('0x30'),_0x25b754[_0x8a50('0x3')]),_0x25b754);utils[_0x8a50('0x2')](util[_0x8a50('0xd')](_0x8a50('0x31'),_0x25b754['uniqueid'],_0x25b754[_0x8a50('0x32')],_0x25b754[_0x8a50('0x33')]));if(_0x25b754[_0x8a50('0x32')][_0x8a50('0x34')]()==_0x8a50('0x35')&&_[_0x8a50('0x36')](_0x25b754[_0x8a50('0x33')]['toLowerCase'](),_0x8a50('0x37'))){var _0x5a7a48=_0x25b754[_0x8a50('0x33')][_0x8a50('0x38')]('=');var _0x6e2068=_0x5a7a48[0x0][_0x8a50('0x39')](_0x5a7a48[0x0][_0x8a50('0x3a')]('(')+0x1,_0x5a7a48[0x0][_0x8a50('0x3a')](')'));var _0x5de047=_0x5a7a48[0x1];recordings[_0x25b754[_0x8a50('0x3')]][_0x6e2068]=_0x5de047;}}}catch(_0x4d4a54){utils[_0x8a50('0x19')](util[_0x8a50('0xd')](_0x8a50('0x30'),_0x25b754[_0x8a50('0x3')]),_0x4d4a54);}};exports[_0x8a50('0x3b')]=function(_0x5d4348){try{if(!_[_0x8a50('0x16')](recordings[_0x5d4348['uniqueid']])){utils[_0x8a50('0xc')](util[_0x8a50('0xd')](_0x8a50('0x3c'),_0x5d4348['uniqueid']),_0x5d4348);utils[_0x8a50('0x2')](util[_0x8a50('0xd')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x5d4348[_0x8a50('0x3')],_0x5d4348[_0x8a50('0x3d')]));recordings[_0x5d4348[_0x8a50('0x3')]][_0x8a50('0x3d')]=_0x5d4348[_0x8a50('0x3d')];}}catch(_0x4eed08){utils['error'](util[_0x8a50('0xd')](_0x8a50('0x3c'),_0x5d4348[_0x8a50('0x3')]),_0x4eed08);}}; \ No newline at end of file +var _0x9d53=['uniqueid','context','exten','channel','error','format','[%s][recordings][newchannel]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','isNil','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','variable','value','.wav49','replace','.WAV','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','cause-txt','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','./utils','info','[%s][recordings][writeDB]','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]\x20context:%s\x20exten:%s'];(function(_0x50ea0e,_0x1dd00d){var _0x479385=function(_0x9e4644){while(--_0x9e4644){_0x50ea0e['push'](_0x50ea0e['shift']());}};_0x479385(++_0x1dd00d);}(_0x9d53,0xf1));var _0x39d5=function(_0x37faec,_0x472b4a){_0x37faec=_0x37faec-0x0;var _0x4ab2e2=_0x9d53[_0x37faec];return _0x4ab2e2;};'use strict';var _=require(_0x39d5('0x0'));var util=require('util');var utils=require(_0x39d5('0x1'));var recordings={};function writeDB(_0x5b5c44){utils[_0x39d5('0x2')](util['format'](_0x39d5('0x3'),_0x5b5c44['uniqueid']));if(_0x5b5c44[_0x39d5('0x4')]){utils[_0x39d5('0x5')](_0x5b5c44[_0x39d5('0x4')])[_0x39d5('0x6')](function(_0x28c41e){if(_0x28c41e){_0x5b5c44[_0x39d5('0x7')]=_0x28c41e[_0x39d5('0x8')];_0x5b5c44[_0x39d5('0x9')]=_0x28c41e['id'];}utils[_0x39d5('0xa')]('CreateVoiceRecording',_0x5b5c44);});}else{utils[_0x39d5('0xa')](_0x39d5('0xb'),_0x5b5c44);}}exports[_0x39d5('0xc')]=function(_0x319487){try{utils[_0x39d5('0xd')](util['format']('[%s][recordings][newchannel]',_0x319487['uniqueid']),_0x319487);if(_0x319487['uniqueid']==_0x319487['linkedid']){utils[_0x39d5('0x2')](util['format'](_0x39d5('0xe'),_0x319487[_0x39d5('0xf')],_0x319487[_0x39d5('0x10')],_0x319487[_0x39d5('0x11')]));recordings[_0x319487['uniqueid']]={'uniqueid':_0x319487['uniqueid'],'accountcode':_0x319487[_0x39d5('0x4')],'exten':_0x319487['exten'],'context':_0x319487['context'],'channel':_0x319487[_0x39d5('0x12')],'monitors':[]};}}catch(_0x5ccc36){utils[_0x39d5('0x13')](util[_0x39d5('0x14')](_0x39d5('0x15'),_0x319487['uniqueid']),_0x5ccc36);}};exports['newstate']=function(_0xe7d1e4){try{utils[_0x39d5('0xd')](util[_0x39d5('0x14')]('[%s][recordings][newstate]',_0xe7d1e4[_0x39d5('0xf')]),_0xe7d1e4);if(!_['isNil'](recordings[_0xe7d1e4['uniqueid']])&&_0xe7d1e4[_0x39d5('0x16')]==0x6){utils[_0x39d5('0x2')](util[_0x39d5('0x14')](_0x39d5('0x17'),_0xe7d1e4['uniqueid'],_0xe7d1e4[_0x39d5('0x10')],_0xe7d1e4[_0x39d5('0x12')]));}else if(!_['isNil'](recordings[_0xe7d1e4[_0x39d5('0x18')]])&&_0xe7d1e4[_0x39d5('0x16')]==0x6&&_0xe7d1e4[_0x39d5('0x10')]!=_0x39d5('0x19')){utils[_0x39d5('0x2')](util[_0x39d5('0x14')](_0x39d5('0x1a'),_0xe7d1e4[_0x39d5('0xf')],_0xe7d1e4[_0x39d5('0x18')],_0xe7d1e4['context'],_0xe7d1e4['channel']));recordings[_0xe7d1e4[_0x39d5('0x18')]]['accountcode']=_0xe7d1e4[_0x39d5('0x4')];}}catch(_0x1805e7){utils[_0x39d5('0x13')](util['format'](_0x39d5('0x1b'),_0xe7d1e4[_0x39d5('0xf')]),_0x1805e7);}};exports['varset']=function(_0x8872f8){try{if(!_[_0x39d5('0x1c')](_0x8872f8['variable'])&&!_[_0x39d5('0x1c')](_0x8872f8['variable'][_0x39d5('0x1d')])){utils['debug'](util['format'](_0x39d5('0x1e'),_0x8872f8[_0x39d5('0xf')]),_0x8872f8);utils['info'](util[_0x39d5('0x14')](_0x39d5('0x1f'),_0x8872f8[_0x39d5('0xf')],_0x8872f8[_0x39d5('0x20')],_0x8872f8[_0x39d5('0x21')]));if(_['endsWith'](_0x8872f8[_0x39d5('0x21')],_0x39d5('0x22'))){_0x8872f8['value']=_0x8872f8['value'][_0x39d5('0x23')](_0x39d5('0x22'),_0x39d5('0x24'));}if(recordings[_0x8872f8[_0x39d5('0x18')]]){var _0x2a5c0a=_['find'](recordings[_0x8872f8[_0x39d5('0x18')]]['monitors'],{'value':_0x8872f8[_0x39d5('0x21')]});if(_[_0x39d5('0x1c')](_0x2a5c0a)){recordings[_0x8872f8[_0x39d5('0x18')]][_0x39d5('0x25')][_0x39d5('0x26')]({'value':_0x8872f8['value']});}}}}catch(_0x587449){utils[_0x39d5('0x13')](util['format']('[%s][recordings][varset]',_0x8872f8[_0x39d5('0xf')]),_0x587449);}};exports[_0x39d5('0x27')]=function(_0x3691d1){try{if(!_['isNil'](recordings[_0x3691d1['uniqueid']])){utils['debug'](util[_0x39d5('0x14')](_0x39d5('0x28'),_0x3691d1[_0x39d5('0xf')]),_0x3691d1);utils[_0x39d5('0x2')](util[_0x39d5('0x14')](_0x39d5('0x29'),_0x3691d1[_0x39d5('0xf')],_0x3691d1['calleridnum'],_0x3691d1['calleridname'],_0x3691d1[_0x39d5('0x2a')]));recordings[_0x3691d1[_0x39d5('0xf')]][_0x39d5('0x2b')]=_0x3691d1[_0x39d5('0x2b')];recordings[_0x3691d1[_0x39d5('0xf')]]['calleridname']=_0x3691d1[_0x39d5('0x2c')];recordings[_0x3691d1[_0x39d5('0xf')]][_0x39d5('0x2d')]=_0x3691d1['connectedlinenum'];recordings[_0x3691d1[_0x39d5('0xf')]][_0x39d5('0x2e')]=_0x3691d1['connectedlinename'];if(recordings[_0x3691d1['uniqueid']][_0x39d5('0x2f')]==_0x39d5('0x30')&&recordings[_0x3691d1[_0x39d5('0xf')]]['accountcode']){recordings[_0x3691d1[_0x39d5('0xf')]][_0x39d5('0x2d')]=recordings[_0x3691d1['uniqueid']][_0x39d5('0x4')];recordings[_0x3691d1['uniqueid']][_0x39d5('0x2e')]='';}recordings[_0x3691d1[_0x39d5('0xf')]][_0x39d5('0x25')][_0x39d5('0x31')](function(_0x14980f){var _0x53cc01=_[_0x39d5('0x32')](recordings[_0x3691d1[_0x39d5('0xf')]]);_0x53cc01['value']=_0x14980f[_0x39d5('0x21')];writeDB(_0x53cc01);});delete recordings[_0x3691d1[_0x39d5('0xf')]];}}catch(_0x209ce0){utils[_0x39d5('0x13')](util['format'](_0x39d5('0x28'),_0x3691d1[_0x39d5('0xf')]),_0x209ce0);}};exports[_0x39d5('0x33')]=function(_0x5f150a){try{if(!_[_0x39d5('0x1c')](recordings[_0x5f150a[_0x39d5('0xf')]])){utils[_0x39d5('0xd')](util[_0x39d5('0x14')](_0x39d5('0x34'),_0x5f150a[_0x39d5('0xf')]),_0x5f150a);utils[_0x39d5('0x2')](util[_0x39d5('0x14')](_0x39d5('0x35'),_0x5f150a[_0x39d5('0xf')],_0x5f150a[_0x39d5('0x36')],_0x5f150a[_0x39d5('0x37')]));if(_0x5f150a[_0x39d5('0x36')][_0x39d5('0x38')]()==_0x39d5('0x39')&&_[_0x39d5('0x3a')](_0x5f150a[_0x39d5('0x37')][_0x39d5('0x38')](),_0x39d5('0x3b'))){var _0x3b2fba=_0x5f150a[_0x39d5('0x37')]['split']('=');var _0xe860c2=_0x3b2fba[0x0]['substring'](_0x3b2fba[0x0][_0x39d5('0x3c')]('(')+0x1,_0x3b2fba[0x0][_0x39d5('0x3c')](')'));var _0x455b06=_0x3b2fba[0x1];recordings[_0x5f150a[_0x39d5('0xf')]][_0xe860c2]=_0x455b06;}}}catch(_0x758488){utils[_0x39d5('0x13')](util[_0x39d5('0x14')]('[%s][recordings][newexten]',_0x5f150a[_0x39d5('0xf')]),_0x758488);}};exports['queuecallerjoin']=function(_0x1bfb6e){try{if(!_[_0x39d5('0x1c')](recordings[_0x1bfb6e[_0x39d5('0xf')]])){utils[_0x39d5('0xd')](util['format'](_0x39d5('0x3d'),_0x1bfb6e[_0x39d5('0xf')]),_0x1bfb6e);utils[_0x39d5('0x2')](util[_0x39d5('0x14')](_0x39d5('0x3e'),_0x1bfb6e[_0x39d5('0xf')],_0x1bfb6e[_0x39d5('0x3f')]));recordings[_0x1bfb6e['uniqueid']][_0x39d5('0x3f')]=_0x1bfb6e[_0x39d5('0x3f')];}}catch(_0x47ba2e){utils[_0x39d5('0x13')](util['format'](_0x39d5('0x3d'),_0x1bfb6e[_0x39d5('0xf')]),_0x47ba2e);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index ed62780..24f7dad 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 _0x7abc=['transfereechannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','request','CreateVoiceTransferReport','blindtransfer','debug','format','uniqueid','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','error','[%s][transfers][blindtransfer]','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransferercontext','secondtransfererexten','origtransfererexten','attended'];(function(_0x44e00a,_0x248bbc){var _0x2bdfba=function(_0x5e66c4){while(--_0x5e66c4){_0x44e00a['push'](_0x44e00a['shift']());}};_0x2bdfba(++_0x248bbc);}(_0x7abc,0x182));var _0xc7ab=function(_0x29cc6b,_0x118c25){_0x29cc6b=_0x29cc6b-0x0;var _0x5a5af0=_0x7abc[_0x29cc6b];return _0x5a5af0;};'use strict';var _=require(_0xc7ab('0x0'));var util=require(_0xc7ab('0x1'));var utils=require(_0xc7ab('0x2'));function writeDB(_0x2d8c84){utils[_0xc7ab('0x3')](util['format'](_0xc7ab('0x4'),_0x2d8c84[_0xc7ab('0x5')]==='attended'?_0x2d8c84['origtransfereruniqueid']:_0x2d8c84['uniqueid'],_0x2d8c84['type']));utils[_0xc7ab('0x6')](_0xc7ab('0x7'),_0x2d8c84);}exports[_0xc7ab('0x8')]=function(_0x35c11e){try{utils[_0xc7ab('0x9')](util[_0xc7ab('0xa')]('[%s][transfers][blindtransfer]',_0x35c11e[_0xc7ab('0xb')]),_0x35c11e);utils['info'](util[_0xc7ab('0xa')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x35c11e['uniqueid'],_0x35c11e[_0xc7ab('0xc')],_0x35c11e[_0xc7ab('0xd')],_0x35c11e[_0xc7ab('0xe')],_0x35c11e[_0xc7ab('0xf')]));_0x35c11e[_0xc7ab('0x5')]='blind';writeDB(_0x35c11e);}catch(_0x182647){utils[_0xc7ab('0x10')](util[_0xc7ab('0xa')](_0xc7ab('0x11'),_0x35c11e[_0xc7ab('0xb')]),_0x182647);}};exports[_0xc7ab('0x12')]=function(_0x3edbff){try{utils['debug'](util['format'](_0xc7ab('0x13'),_0x3edbff[_0xc7ab('0x14')]),_0x3edbff);utils[_0xc7ab('0x3')](util[_0xc7ab('0xa')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x3edbff[_0xc7ab('0x14')],_0x3edbff[_0xc7ab('0x15')],_0x3edbff[_0xc7ab('0x16')],_0x3edbff[_0xc7ab('0x17')],_0x3edbff[_0xc7ab('0x18')]));_0x3edbff=_[_0xc7ab('0x19')](_0x3edbff,{'transfererchannel':_0x3edbff[_0xc7ab('0x1a')],'transferercalleridnum':_0x3edbff[_0xc7ab('0x15')],'transferercalleridname':_0x3edbff[_0xc7ab('0x16')],'transfererconnectedlinenum':_0x3edbff[_0xc7ab('0x1b')],'transfererconnectedlinename':_0x3edbff['secondtransfererconnectedlinename'],'transfereraccountcode':_0x3edbff['origtransfereraccountcode'],'transferercontext':_0x3edbff[_0xc7ab('0x1c')],'transfererexten':_0x3edbff[_0xc7ab('0x1d')],'transfererlinkedid':_0x3edbff['origtransfererlinkedid'],'context':_0x3edbff['origtransferercontext'],'extension':_0x3edbff[_0xc7ab('0x1e')],'type':_0xc7ab('0x1f')});if(_['isNil'](_0x3edbff[_0xc7ab('0x20')])){_0x3edbff=_[_0xc7ab('0x19')](_0x3edbff,{'transfereechannel':_0x3edbff['transfertargetchannel'],'transfereecalleridnum':_0x3edbff[_0xc7ab('0x17')],'transfereecalleridname':_0x3edbff[_0xc7ab('0x18')],'transfereeconnectedlinenum':_0x3edbff[_0xc7ab('0x21')],'transfereeconnectedlinename':_0x3edbff[_0xc7ab('0x22')],'transfereeaccountcode':_0x3edbff[_0xc7ab('0x23')],'transfereecontext':_0x3edbff['transfertargetcontext'],'transfereeexten':_0x3edbff[_0xc7ab('0x24')],'transfereelinkedid':_0x3edbff[_0xc7ab('0x25')]});}writeDB(_0x3edbff);}catch(_0x55d4bd){utils['error'](util[_0xc7ab('0xa')](_0xc7ab('0x13'),_0x3edbff['origtransfereruniqueid']),_0x55d4bd);}}; \ No newline at end of file +var _0x4594=['origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridname','blind','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum'];(function(_0x435e54,_0x321dfe){var _0x2764d7=function(_0x5b81f4){while(--_0x5b81f4){_0x435e54['push'](_0x435e54['shift']());}};_0x2764d7(++_0x321dfe);}(_0x4594,0x1a1));var _0x4459=function(_0x9e7aa3,_0x1d2c49){_0x9e7aa3=_0x9e7aa3-0x0;var _0x56e07b=_0x4594[_0x9e7aa3];return _0x56e07b;};'use strict';var _=require(_0x4459('0x0'));var util=require(_0x4459('0x1'));var utils=require(_0x4459('0x2'));function writeDB(_0x1946f6){utils[_0x4459('0x3')](util[_0x4459('0x4')](_0x4459('0x5'),_0x1946f6[_0x4459('0x6')]===_0x4459('0x7')?_0x1946f6[_0x4459('0x8')]:_0x1946f6['uniqueid'],_0x1946f6[_0x4459('0x6')]));utils[_0x4459('0x9')](_0x4459('0xa'),_0x1946f6);}exports[_0x4459('0xb')]=function(_0x26a7f9){try{utils[_0x4459('0xc')](util[_0x4459('0x4')](_0x4459('0xd'),_0x26a7f9[_0x4459('0xe')]),_0x26a7f9);utils['info'](util[_0x4459('0x4')](_0x4459('0xf'),_0x26a7f9[_0x4459('0xe')],_0x26a7f9[_0x4459('0x10')],_0x26a7f9['transferercalleridname'],_0x26a7f9['transfereecalleridnum'],_0x26a7f9[_0x4459('0x11')]));_0x26a7f9[_0x4459('0x6')]=_0x4459('0x12');writeDB(_0x26a7f9);}catch(_0x270088){utils['error'](util[_0x4459('0x4')]('[%s][transfers][blindtransfer]',_0x26a7f9[_0x4459('0xe')]),_0x270088);}};exports[_0x4459('0x13')]=function(_0x264f31){try{utils[_0x4459('0xc')](util[_0x4459('0x4')](_0x4459('0x14'),_0x264f31[_0x4459('0x8')]),_0x264f31);utils[_0x4459('0x3')](util['format'](_0x4459('0x15'),_0x264f31[_0x4459('0x8')],_0x264f31[_0x4459('0x16')],_0x264f31[_0x4459('0x17')],_0x264f31[_0x4459('0x18')],_0x264f31['transfertargetcalleridname']));_0x264f31=_[_0x4459('0x19')](_0x264f31,{'transfererchannel':_0x264f31[_0x4459('0x1a')],'transferercalleridnum':_0x264f31['origtransferercalleridnum'],'transferercalleridname':_0x264f31['origtransferercalleridname'],'transfererconnectedlinenum':_0x264f31[_0x4459('0x1b')],'transfererconnectedlinename':_0x264f31[_0x4459('0x1c')],'transfereraccountcode':_0x264f31[_0x4459('0x1d')],'transferercontext':_0x264f31[_0x4459('0x1e')],'transfererexten':_0x264f31['secondtransfererexten'],'transfererlinkedid':_0x264f31['origtransfererlinkedid'],'context':_0x264f31[_0x4459('0x1f')],'extension':_0x264f31[_0x4459('0x20')],'type':_0x4459('0x7')});if(_[_0x4459('0x21')](_0x264f31[_0x4459('0x22')])){_0x264f31=_[_0x4459('0x19')](_0x264f31,{'transfereechannel':_0x264f31[_0x4459('0x23')],'transfereecalleridnum':_0x264f31[_0x4459('0x18')],'transfereecalleridname':_0x264f31[_0x4459('0x24')],'transfereeconnectedlinenum':_0x264f31['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x264f31[_0x4459('0x25')],'transfereeaccountcode':_0x264f31[_0x4459('0x26')],'transfereecontext':_0x264f31[_0x4459('0x27')],'transfereeexten':_0x264f31['transfertargetexten'],'transfereelinkedid':_0x264f31['transfertargetlinkedid']});}writeDB(_0x264f31);}catch(_0x3f07a7){utils['error'](util[_0x4459('0x4')](_0x4459('0x14'),_0x264f31[_0x4459('0x8')]),_0x3f07a7);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 906a14d..4f4e2c8 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(_0x130339,_0x1cf3e0){var _0x1bbcc6=function(_0x45a33b){while(--_0x45a33b){_0x130339['push'](_0x130339['shift']());}};_0x1bbcc6(++_0x1cf3e0);}(_0x7a54,0x106));var _0x47a5=function(_0x4d36f0,_0x25950c){_0x4d36f0=_0x4d36f0-0x0;var _0x5a485d=_0x7a54[_0x4d36f0];return _0x5a485d;};'use strict';var BPromise=require(_0x47a5('0x0'));var jayson=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var util=require('util');var client=jayson[_0x47a5('0x3')][_0x47a5('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x47a5('0x5'));exports[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){logger[_0x47a5('0x6')](_0x2a1a7e,_0x3717e1?util['inspect'](_0x3717e1,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x7')]=function(_0x59199c,_0x343372){logger[_0x47a5('0x7')](_0x59199c,_0x343372?util['inspect'](_0x343372,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x8')]=function(_0x5077f3,_0x5d90b3){logger['error'](_0x5077f3,_0x5d90b3?util[_0x47a5('0x9')](_0x5d90b3,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0xa')]=function(_0x5e31dd,_0x2eb0dd){return client['request'](_0x5e31dd,{'body':_0x2eb0dd})['then'](function(_0x1f47f4){logger[_0x47a5('0x7')](_0x47a5('0xb'),_0x5e31dd,_0x1f47f4?util[_0x47a5('0x9')](_0x1f47f4,{'showHidden':![],'depth':null}):'');})[_0x47a5('0xc')](function(_0xd308b8){logger[_0x47a5('0x8')]('[utils][request]\x20name:%s',_0x5e31dd,_0xd308b8?util[_0x47a5('0x9')](_0xd308b8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x221b54){return client[_0x47a5('0xa')](_0x47a5('0xd'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xe'),_0x47a5('0xf'),_0x47a5('0x10')],'where':_0x221b54,'limit':0x1}})[_0x47a5('0x11')](function(_0x4e99a8){logger[_0x47a5('0x7')](_0x47a5('0x12'),JSON[_0x47a5('0x13')](_0x221b54),_0x4e99a8?util[_0x47a5('0x9')](_0x4e99a8,{'showHidden':![],'depth':null}):'');return _0x4e99a8[_0x47a5('0x14')]['length']?_0x4e99a8['result'][0x0]:null;});}exports[_0x47a5('0x15')]=function(_0x4b966e){return new BPromise(function(_0x5247fd,_0x423a81){if(_0x4b966e){return getUser({'internal':_0x4b966e})[_0x47a5('0x11')](function(_0x2ce454){logger[_0x47a5('0x6')](_0x47a5('0x16'),_0x4b966e,_0x2ce454?_0x47a5('0x17'):_0x47a5('0x18'));return _0x5247fd(_0x2ce454);})[_0x47a5('0xc')](function(_0x3aed38){logger['error'](_0x47a5('0x19'),_0x3aed38?util[_0x47a5('0x9')](_0x3aed38,{'showHidden':![],'depth':null}):'');return _0x5247fd(null);});}return _0x5247fd(null);});};exports['getUserByInterface']=function(_0x2b0360){return new BPromise(function(_0x1f03f7,_0x36874d){if(_0x2b0360){return getUser({'interface':_0x2b0360})['then'](function(_0xb8ae6c){logger[_0x47a5('0x6')](_0x47a5('0x1a'),_0x2b0360,_0xb8ae6c?_0x47a5('0x17'):'notfound');return _0x1f03f7(_0xb8ae6c);})[_0x47a5('0xc')](function(_0x385687){logger['error'](_0x47a5('0x1b'),_0x385687?util[_0x47a5('0x9')](_0x385687,{'showHidden':![],'depth':null}):'');return _0x1f03f7(null);});}return _0x1f03f7(null);});};exports[_0x47a5('0x1c')]=function(_0x129ce5){return new BPromise(function(_0x3abd6a,_0x50bf17){if(_0x129ce5){return getUser({'name':_0x129ce5})['then'](function(_0x136745){logger['info'](_0x47a5('0x1d'),_0x129ce5,_0x136745?'found':_0x47a5('0x18'));return _0x3abd6a(_0x136745);})[_0x47a5('0xc')](function(_0x36ad34){logger[_0x47a5('0x8')](_0x47a5('0x1e'),_0x36ad34?util[_0x47a5('0x9')](_0x36ad34,{'showHidden':![],'depth':null}):'');return _0x3abd6a(null);});}return _0x3abd6a(null);});};exports[_0x47a5('0x1f')]=function(_0x136b14){return new BPromise(function(_0x16631f,_0x361bfa){if(_0x136b14){return client[_0x47a5('0xa')](_0x47a5('0x20'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xf'),'type',_0x47a5('0x21'),'acwTimeout'],'where':{'name':_0x136b14},'limit':0x1}})[_0x47a5('0x11')](function(_0x9ac908){logger[_0x47a5('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0x136b14,_0x9ac908?util[_0x47a5('0x9')](_0x9ac908,{'showHidden':![],'depth':null}):'');logger[_0x47a5('0x6')](_0x47a5('0x22'),_0x136b14,_0x9ac908?_0x47a5('0x17'):'notfound');return _0x16631f(_0x9ac908['result'][_0x47a5('0x23')]?_0x9ac908[_0x47a5('0x14')][0x0]:null);})['catch'](function(_0x4e1006){logger[_0x47a5('0x8')](_0x47a5('0x24'),_0x4e1006?util['inspect'](_0x4e1006,{'showHidden':![],'depth':null}):'');return _0x16631f(null);});}return _0x16631f(null);});};exports[_0x47a5('0x25')]=function(_0x53119b,_0x122ed6){return moment(_0x53119b)[_0x47a5('0x26')](_0x122ed6,'seconds')['format'](_0x47a5('0x27'));};exports['subtractTime']=function(_0x403028,_0x87e4c9){return moment(_0x403028)[_0x47a5('0x28')](_0x87e4c9,'seconds')[_0x47a5('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x65542e,_0x5a8a7c){return moment(_0x65542e)[_0x47a5('0x2a')](moment(_0x5a8a7c),'seconds');};exports[_0x47a5('0x2b')]=function(_0x3534cb,_0x38c8d4){return parseInt(_0x3534cb,0xa)+parseInt(_0x38c8d4,0xa);};exports[_0x47a5('0x2c')]=function(){return moment()[_0x47a5('0x29')](_0x47a5('0x27'));};exports[_0x47a5('0x2d')]=function(_0x452be5,_0x1a0d23){if(_0x1a0d23){return moment(_0x452be5)['isAfter'](_0x1a0d23);}return!![];};exports[_0x47a5('0x2e')]=function(_0x10f136,_0x511c06){if(_0x511c06){return moment(_0x10f136)[_0x47a5('0x2e')](_0x511c06);}else if(_0x10f136){return!![];}return![];}; \ No newline at end of file +var _0xb10b=['util','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','moment'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xb10b,0x12a));var _0xbb10=function(_0x203a81,_0x37aefa){_0x203a81=_0x203a81-0x0;var _0x5b45f8=_0xb10b[_0x203a81];return _0x5b45f8;};'use strict';var BPromise=require(_0xbb10('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var client=jayson[_0xbb10('0x3')]['http']({'port':0x2329});var logger=require(_0xbb10('0x4'))(_0xbb10('0x5'));exports[_0xbb10('0x6')]=function(_0x22320e,_0x49baf4){logger[_0xbb10('0x6')](_0x22320e,_0x49baf4?util['inspect'](_0x49baf4,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x7')]=function(_0x3cdd53,_0x513741){logger[_0xbb10('0x7')](_0x3cdd53,_0x513741?util[_0xbb10('0x8')](_0x513741,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x9')]=function(_0x1c3ee5,_0x2353ef){logger[_0xbb10('0x9')](_0x1c3ee5,_0x2353ef?util[_0xbb10('0x8')](_0x2353ef,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0xa')]=function(_0x5ab04a,_0x4e47f8){return client[_0xbb10('0xa')](_0x5ab04a,{'body':_0x4e47f8})[_0xbb10('0xb')](function(_0xce64f3){logger['debug'](_0xbb10('0xc'),_0x5ab04a,_0xce64f3?util['inspect'](_0xce64f3,{'showHidden':![],'depth':null}):'');})[_0xbb10('0xd')](function(_0x916a32){logger[_0xbb10('0x9')](_0xbb10('0xc'),_0x5ab04a,_0x916a32?util[_0xbb10('0x8')](_0x916a32,{'showHidden':![],'depth':null}):'');});};function getUser(_0x147230){return client['request'](_0xbb10('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0xf'),_0xbb10('0x10'),_0xbb10('0x11')],'where':_0x147230,'limit':0x1}})[_0xbb10('0xb')](function(_0x2f2ebf){logger[_0xbb10('0x7')](_0xbb10('0x12'),JSON[_0xbb10('0x13')](_0x147230),_0x2f2ebf?util[_0xbb10('0x8')](_0x2f2ebf,{'showHidden':![],'depth':null}):'');return _0x2f2ebf['result'][_0xbb10('0x14')]?_0x2f2ebf[_0xbb10('0x15')][0x0]:null;});}exports[_0xbb10('0x16')]=function(_0x42db98){return new BPromise(function(_0x378da8,_0x1682a4){if(_0x42db98){return getUser({'internal':_0x42db98})[_0xbb10('0xb')](function(_0x30efc6){logger[_0xbb10('0x6')](_0xbb10('0x17'),_0x42db98,_0x30efc6?'found':_0xbb10('0x18'));return _0x378da8(_0x30efc6);})[_0xbb10('0xd')](function(_0x388fab){logger[_0xbb10('0x9')](_0xbb10('0x19'),_0x388fab?util[_0xbb10('0x8')](_0x388fab,{'showHidden':![],'depth':null}):'');return _0x378da8(null);});}return _0x378da8(null);});};exports['getUserByInterface']=function(_0x12f888){return new BPromise(function(_0x12ef77,_0x50aea1){if(_0x12f888){return getUser({'interface':_0x12f888})['then'](function(_0x8e2b97){logger[_0xbb10('0x6')](_0xbb10('0x1a'),_0x12f888,_0x8e2b97?_0xbb10('0x1b'):_0xbb10('0x18'));return _0x12ef77(_0x8e2b97);})[_0xbb10('0xd')](function(_0x407cb4){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x407cb4?util[_0xbb10('0x8')](_0x407cb4,{'showHidden':![],'depth':null}):'');return _0x12ef77(null);});}return _0x12ef77(null);});};exports[_0xbb10('0x1d')]=function(_0x26ad93){return new BPromise(function(_0x537898,_0x4fedac){if(_0x26ad93){return getUser({'name':_0x26ad93})['then'](function(_0xc93a04){logger[_0xbb10('0x6')](_0xbb10('0x1e'),_0x26ad93,_0xc93a04?'found':_0xbb10('0x18'));return _0x537898(_0xc93a04);})[_0xbb10('0xd')](function(_0x6ed43b){logger[_0xbb10('0x9')](_0xbb10('0x1f'),_0x6ed43b?util[_0xbb10('0x8')](_0x6ed43b,{'showHidden':![],'depth':null}):'');return _0x537898(null);});}return _0x537898(null);});};exports[_0xbb10('0x20')]=function(_0x4aabb9){return new BPromise(function(_0x3796c7,_0x21ac54){if(_0x4aabb9){return client[_0xbb10('0xa')](_0xbb10('0x21'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0x10'),_0xbb10('0x22'),'acw',_0xbb10('0x23')],'where':{'name':_0x4aabb9},'limit':0x1}})['then'](function(_0x448d5c){logger['debug'](_0xbb10('0x24'),_0x4aabb9,_0x448d5c?util[_0xbb10('0x8')](_0x448d5c,{'showHidden':![],'depth':null}):'');logger[_0xbb10('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4aabb9,_0x448d5c?'found':_0xbb10('0x18'));return _0x3796c7(_0x448d5c[_0xbb10('0x15')]['length']?_0x448d5c[_0xbb10('0x15')][0x0]:null);})[_0xbb10('0xd')](function(_0x2f653f){logger[_0xbb10('0x9')](_0xbb10('0x25'),_0x2f653f?util[_0xbb10('0x8')](_0x2f653f,{'showHidden':![],'depth':null}):'');return _0x3796c7(null);});}return _0x3796c7(null);});};exports[_0xbb10('0x26')]=function(_0x4975f5,_0x25acb3){return moment(_0x4975f5)[_0xbb10('0x27')](_0x25acb3,_0xbb10('0x28'))[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2b')]=function(_0x188cbd,_0x10202c){return moment(_0x188cbd)[_0xbb10('0x2c')](_0x10202c,'seconds')[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2d')]=function(_0x3c3c45,_0x570f5a){return moment(_0x3c3c45)[_0xbb10('0x2e')](moment(_0x570f5a),'seconds');};exports['sumTime']=function(_0x3eb3cc,_0x40c164){return parseInt(_0x3eb3cc,0xa)+parseInt(_0x40c164,0xa);};exports[_0xbb10('0x2f')]=function(){return moment()[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x30')]=function(_0x547062,_0x1e5bbd){if(_0x1e5bbd){return moment(_0x547062)[_0xbb10('0x30')](_0x1e5bbd);}return!![];};exports['isBefore']=function(_0x5e3fbd,_0x5cd55f){if(_0x5cd55f){return moment(_0x5e3fbd)[_0xbb10('0x31')](_0x5cd55f);}else if(_0x5e3fbd){return!![];}return![];}; \ No newline at end of file